From: Andrea Bianco Date: Wed, 27 Jan 2021 14:08:36 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Tag: 2.5.14 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=032eef5eb1c414450ccc959e49effc8ff508851b;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f767791..a424b1a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-01-27T13:46:39.502Z", + "time": "2021-01-27T14:01:29.198Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 1a7567b..54c4945 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-01-27T13:46:39.502Z", + "time": "2021-01-27T14:01:29.198Z", "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 10b6bb9..f303f27 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 _0xbf00=['integration','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','action','STRING','contactManager'];(function(_0x314843,_0x13f6e8){var _0x50480=function(_0x5a9e35){while(--_0x5a9e35){_0x314843['push'](_0x314843['shift']());}};_0x50480(++_0x13f6e8);}(_0xbf00,0x1e9));var _0x0bf0=function(_0x52282a,_0x45aef7){_0x52282a=_0x52282a-0x0;var _0x3c66b4=_0xbf00[_0x52282a];return _0x3c66b4;};'use strict';var Sequelize=require(_0x0bf0('0x0'));module[_0x0bf0('0x1')]={'name':{'type':Sequelize[_0x0bf0('0x2')],'get':function(_0xb7f4aa){return this['getDataValue'](_0x0bf0('0x3'));}},'action':{'type':Sequelize[_0x0bf0('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0bf0('0x5'),_0x0bf0('0x6'),'motionbar',_0x0bf0('0x7'),'urlForward',_0x0bf0('0x8'),_0x0bf0('0x9'),_0x0bf0('0xa')]],'msg':_0x0bf0('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0bf0('0x4')](0x1000),'comment':_0x0bf0('0xc')},'data2':{'type':Sequelize[_0x0bf0('0x4')](0x1000),'comment':_0x0bf0('0xd')},'data3':{'type':Sequelize[_0x0bf0('0x4')](0x1000),'comment':_0x0bf0('0xe')},'data4':{'type':Sequelize[_0x0bf0('0x4')](0x1000)},'data5':{'type':Sequelize[_0x0bf0('0x4')](0x1000)},'data6':{'type':Sequelize[_0x0bf0('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x20a3=['sequelize','VIRTUAL','getDataValue','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','TEXT'];(function(_0x53921f,_0x576f9f){var _0x1e160d=function(_0x1a3cb4){while(--_0x1a3cb4){_0x53921f['push'](_0x53921f['shift']());}};_0x1e160d(++_0x576f9f);}(_0x20a3,0x1c8));var _0x320a=function(_0x4d95e8,_0x8c6139){_0x4d95e8=_0x4d95e8-0x0;var _0x508106=_0x20a3[_0x4d95e8];return _0x508106;};'use strict';var Sequelize=require(_0x320a('0x0'));module['exports']={'name':{'type':Sequelize[_0x320a('0x1')],'get':function(_0x353ed1){return this[_0x320a('0x2')]('action');}},'action':{'type':Sequelize[_0x320a('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x320a('0x4'),'integration',_0x320a('0x5'),_0x320a('0x6'),_0x320a('0x7'),_0x320a('0x8'),_0x320a('0x9'),'script']],'msg':_0x320a('0xa')}},'comment':_0x320a('0xa')},'data1':{'type':Sequelize[_0x320a('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x320a('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x320a('0x3')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x320a('0x3')](0x1000)},'data5':{'type':Sequelize[_0x320a('0x3')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x320a('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 172bfd9..16a4deb 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 _0x1b65=['crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x239f86,_0x1dfabb){var _0x25123a=function(_0x20b487){while(--_0x20b487){_0x239f86['push'](_0x239f86['shift']());}};_0x25123a(++_0x1dfabb);}(_0x1b65,0x1b4));var _0x51b6=function(_0x331b08,_0x2c5937){_0x331b08=_0x331b08-0x0;var _0x5034d9=_0x1b65[_0x331b08];return _0x5034d9;};'use strict';var pdf=require(_0x51b6('0x0'));var emlformat=require(_0x51b6('0x1'));var rimraf=require(_0x51b6('0x2'));var zipdir=require(_0x51b6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51b6('0x4'));var moment=require(_0x51b6('0x5'));var BPromise=require(_0x51b6('0x6'));var Mustache=require(_0x51b6('0x7'));var util=require(_0x51b6('0x8'));var path=require(_0x51b6('0x9'));var sox=require(_0x51b6('0xa'));var csv=require('to-csv');var ejs=require(_0x51b6('0xb'));var fs=require('fs');var _=require(_0x51b6('0xc'));var squel=require(_0x51b6('0xd'));var crypto=require(_0x51b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51b6('0xf'));var toCsv=require(_0x51b6('0x10'));var querystring=require('querystring');var Papa=require(_0x51b6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x12'));var as=require(_0x51b6('0x13'));var hardwareService=require(_0x51b6('0x14'));var logger=require(_0x51b6('0x15'))(_0x51b6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51b6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd605,_0x422bd4){_0x422bd4=_0x422bd4||0xcc;return function(_0x4ca143){if(_0x4ca143){return _0x4cd605[_0x51b6('0x18')](_0x422bd4);}return _0x4cd605['status'](_0x422bd4)[_0x51b6('0x19')]();};}function respondWithResult(_0x24a386,_0x2890ee){_0x2890ee=_0x2890ee||0xc8;return function(_0x235d8c){if(_0x235d8c){return _0x24a386[_0x51b6('0x1a')](_0x2890ee)[_0x51b6('0x1b')](_0x235d8c);}};}function respondWithFilteredResult(_0x4c6cd0,_0x23549b){return function(_0x596863){if(_0x596863){var _0x39583d=_0x596863[_0x51b6('0x1c')],_0x4c99fb=_0x23549b[_0x51b6('0x1d')],_0x4007b0=_0x23549b[_0x51b6('0x1d')]+_0x23549b[_0x51b6('0x1e')],_0x500a82;if(_0x4007b0>=_0x39583d){_0x4007b0=_0x39583d;_0x500a82=0xc8;}else{_0x500a82=0xce;}_0x4c6cd0[_0x51b6('0x1a')](_0x500a82);return _0x4c6cd0[_0x51b6('0x1f')]('Content-Range',_0x4c99fb+'-'+_0x4007b0+'/'+_0x39583d)[_0x51b6('0x1b')](_0x596863);}return null;};}function patchUpdates(_0x5b8a31){return function(_0x2974f0){try{jsonpatch[_0x51b6('0x20')](_0x2974f0,_0x5b8a31,!![]);}catch(_0x506367){return BPromise[_0x51b6('0x21')](_0x506367);}return _0x2974f0[_0x51b6('0x22')]();};}function saveUpdates(_0x3fee21,_0x471783){return function(_0x21c90c){if(_0x21c90c){return _0x21c90c[_0x51b6('0x23')](_0x3fee21)[_0x51b6('0x24')](function(_0x1e70fc){return _0x1e70fc;});}return null;};}function removeEntity(_0x4ab876,_0x35d2ab){return function(_0x11db4e){if(_0x11db4e){return _0x11db4e[_0x51b6('0x25')]()[_0x51b6('0x24')](function(){_0x4ab876['status'](0xcc)[_0x51b6('0x19')]();});}};}function handleEntityNotFound(_0x3680af,_0x51c013){return function(_0x5de6e3){if(!_0x5de6e3){_0x3680af[_0x51b6('0x18')](0x194);}return _0x5de6e3;};}function handleError(_0x47499e,_0x3518ba){_0x3518ba=_0x3518ba||0x1f4;return function(_0x59193e){logger['error'](_0x59193e[_0x51b6('0x26')]);if(_0x59193e[_0x51b6('0x27')]){delete _0x59193e[_0x51b6('0x27')];}_0x47499e['status'](_0x3518ba)[_0x51b6('0x28')](_0x59193e);};}exports[_0x51b6('0x23')]=function(_0x5a8a5b,_0x2df2fa){if(_0x5a8a5b[_0x51b6('0x29')]['id']){delete _0x5a8a5b[_0x51b6('0x29')]['id'];}return db[_0x51b6('0x2a')][_0x51b6('0x2b')]({'where':{'id':_0x5a8a5b['params']['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x2df2fa,null))[_0x51b6('0x24')](saveUpdates(_0x5a8a5b[_0x51b6('0x29')],null))['then'](respondWithResult(_0x2df2fa,null))[_0x51b6('0x2c')](handleError(_0x2df2fa,null));};exports[_0x51b6('0x25')]=function(_0x29d89b,_0x155e67){return db['Action'][_0x51b6('0x2b')]({'where':{'id':_0x29d89b['params']['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x155e67,null))[_0x51b6('0x24')](removeEntity(_0x155e67,null))['catch'](handleError(_0x155e67,null));}; \ No newline at end of file +var _0x36c3=['error','stack','name','body','Action','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','set','Content-Range','update','then','status'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x36c3,0x1a6));var _0x336c=function(_0x1fc36f,_0x464552){_0x1fc36f=_0x1fc36f-0x0;var _0x2856b4=_0x36c3[_0x1fc36f];return _0x2856b4;};'use strict';var pdf=require(_0x336c('0x0'));var emlformat=require(_0x336c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x336c('0x2'));var jsonpatch=require(_0x336c('0x3'));var rp=require(_0x336c('0x4'));var moment=require(_0x336c('0x5'));var BPromise=require(_0x336c('0x6'));var Mustache=require(_0x336c('0x7'));var util=require(_0x336c('0x8'));var path=require('path');var sox=require(_0x336c('0x9'));var csv=require(_0x336c('0xa'));var ejs=require(_0x336c('0xb'));var fs=require('fs');var _=require(_0x336c('0xc'));var squel=require(_0x336c('0xd'));var crypto=require('crypto');var jsforce=require(_0x336c('0xe'));var deskjs=require(_0x336c('0xf'));var toCsv=require(_0x336c('0xa'));var querystring=require(_0x336c('0x10'));var Papa=require(_0x336c('0x11'));var Redis=require(_0x336c('0x12'));var authService=require(_0x336c('0x13'));var qs=require(_0x336c('0x14'));var as=require(_0x336c('0x15'));var hardwareService=require(_0x336c('0x16'));var logger=require(_0x336c('0x17'))(_0x336c('0x18'));var utils=require(_0x336c('0x19'));var config=require(_0x336c('0x1a'));var licenseUtil=require(_0x336c('0x1b'));var db=require(_0x336c('0x1c'))['db'];function respondWithStatusCode(_0x94b601,_0x4b08f8){_0x4b08f8=_0x4b08f8||0xcc;return function(_0x592a5b){if(_0x592a5b){return _0x94b601[_0x336c('0x1d')](_0x4b08f8);}return _0x94b601['status'](_0x4b08f8)[_0x336c('0x1e')]();};}function respondWithResult(_0xc6a857,_0x2115ce){_0x2115ce=_0x2115ce||0xc8;return function(_0x345be6){if(_0x345be6){return _0xc6a857['status'](_0x2115ce)[_0x336c('0x1f')](_0x345be6);}};}function respondWithFilteredResult(_0x15bc2b,_0x4ce90a){return function(_0x23b375){if(_0x23b375){var _0x5f5ae1=_0x23b375['count'],_0x2c7474=_0x4ce90a[_0x336c('0x20')],_0x4f73b2=_0x4ce90a[_0x336c('0x20')]+_0x4ce90a['limit'],_0x20f10a;if(_0x4f73b2>=_0x5f5ae1){_0x4f73b2=_0x5f5ae1;_0x20f10a=0xc8;}else{_0x20f10a=0xce;}_0x15bc2b['status'](_0x20f10a);return _0x15bc2b[_0x336c('0x21')](_0x336c('0x22'),_0x2c7474+'-'+_0x4f73b2+'/'+_0x5f5ae1)[_0x336c('0x1f')](_0x23b375);}return null;};}function patchUpdates(_0x221408){return function(_0x366182){try{jsonpatch['apply'](_0x366182,_0x221408,!![]);}catch(_0x327e10){return BPromise['reject'](_0x327e10);}return _0x366182['save']();};}function saveUpdates(_0x5f401e,_0x9d4fc6){return function(_0x17abed){if(_0x17abed){return _0x17abed[_0x336c('0x23')](_0x5f401e)['then'](function(_0x5adb5f){return _0x5adb5f;});}return null;};}function removeEntity(_0x5b6cc3,_0x3ba228){return function(_0x60d259){if(_0x60d259){return _0x60d259['destroy']()[_0x336c('0x24')](function(){_0x5b6cc3[_0x336c('0x25')](0xcc)[_0x336c('0x1e')]();});}};}function handleEntityNotFound(_0x56a6fb,_0x473164){return function(_0x314f5f){if(!_0x314f5f){_0x56a6fb[_0x336c('0x1d')](0x194);}return _0x314f5f;};}function handleError(_0xc46031,_0x4bd54c){_0x4bd54c=_0x4bd54c||0x1f4;return function(_0x401660){logger[_0x336c('0x26')](_0x401660[_0x336c('0x27')]);if(_0x401660[_0x336c('0x28')]){delete _0x401660[_0x336c('0x28')];}_0xc46031[_0x336c('0x25')](_0x4bd54c)['send'](_0x401660);};}exports[_0x336c('0x23')]=function(_0x3d2442,_0x2a1fb3){if(_0x3d2442[_0x336c('0x29')]['id']){delete _0x3d2442['body']['id'];}return db[_0x336c('0x2a')][_0x336c('0x2b')]({'where':{'id':_0x3d2442['params']['id']}})['then'](handleEntityNotFound(_0x2a1fb3,null))['then'](saveUpdates(_0x3d2442[_0x336c('0x29')],null))[_0x336c('0x24')](respondWithResult(_0x2a1fb3,null))['catch'](handleError(_0x2a1fb3,null));};exports['destroy']=function(_0x4dbbc7,_0x209c2b){return db[_0x336c('0x2a')][_0x336c('0x2b')]({'where':{'id':_0x4dbbc7[_0x336c('0x2c')]['id']}})[_0x336c('0x24')](handleEntityNotFound(_0x209c2b,null))[_0x336c('0x24')](removeEntity(_0x209c2b,null))[_0x336c('0x2d')](handleError(_0x209c2b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 41e12ab..2a26b66 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 _0x1810=['path','exports','define','Action','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2005be,_0x15f6e1){var _0x1a017e=function(_0x4b9934){while(--_0x4b9934){_0x2005be['push'](_0x2005be['shift']());}};_0x1a017e(++_0x15f6e1);}(_0x1810,0x19e));var _0x0181=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x1810[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x0181('0x0'));var util=require(_0x0181('0x1'));var logger=require(_0x0181('0x2'))('api');var moment=require(_0x0181('0x3'));var BPromise=require(_0x0181('0x4'));var rp=require(_0x0181('0x5'));var fs=require('fs');var path=require(_0x0181('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x0181('0x7')]=function(_0xf259f4,_0x5c4076){return _0xf259f4[_0x0181('0x8')](_0x0181('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8005=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','lodash'];(function(_0x8bf7e0,_0x1965e9){var _0xb2a20d=function(_0x43a9ea){while(--_0x43a9ea){_0x8bf7e0['push'](_0x8bf7e0['shift']());}};_0xb2a20d(++_0x1965e9);}(_0x8005,0xfb));var _0x5800=function(_0x324fe8,_0x1ccb46){_0x324fe8=_0x324fe8-0x0;var _0x4a1cd9=_0x8005[_0x324fe8];return _0x4a1cd9;};'use strict';var _=require(_0x5800('0x0'));var util=require(_0x5800('0x1'));var logger=require(_0x5800('0x2'))(_0x5800('0x3'));var moment=require('moment');var BPromise=require(_0x5800('0x4'));var rp=require(_0x5800('0x5'));var fs=require('fs');var path=require(_0x5800('0x6'));var rimraf=require(_0x5800('0x7'));var config=require(_0x5800('0x8'));var attributes=require(_0x5800('0x9'));module[_0x5800('0xa')]=function(_0x1493ef,_0x5edae2){return _0x1493ef[_0x5800('0xb')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e2e120f..9ea60c1 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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x7cfc36,_0x371bfc){var _0x556fca=function(_0x249bc6){while(--_0x249bc6){_0x7cfc36['push'](_0x7cfc36['shift']());}};_0x556fca(++_0x371bfc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ 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','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x4320cd,_0x142d9a){var _0x3f8915=function(_0x13f202){while(--_0x13f202){_0x4320cd['push'](_0x4320cd['shift']());}};_0x3f8915(++_0x142d9a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xcb91[_0x4ec9e3];return _0x2883ce;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index 6d101e0..0cffe33 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 _0x9955=['./action.controller','put','/:id','isAuthenticated','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x9955,0x103));var _0x5995=function(_0x5de62e,_0x24945d){_0x5de62e=_0x5de62e-0x0;var _0xd20de8=_0x9955[_0x5de62e];return _0xd20de8;};'use strict';var multer=require('multer');var util=require(_0x5995('0x0'));var path=require(_0x5995('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5995('0x2')]();var auth=require(_0x5995('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5995('0x4'));var controller=require(_0x5995('0x5'));router[_0x5995('0x6')](_0x5995('0x7'),auth[_0x5995('0x8')](),controller['update']);router['delete'](_0x5995('0x7'),auth[_0x5995('0x8')](),controller[_0x5995('0x9')]);module[_0x5995('0xa')]=router; \ No newline at end of file +var _0x46d8=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','delete','isAuthenticated','exports','multer'];(function(_0x13d370,_0x2b1fdb){var _0x340ddd=function(_0x2000ed){while(--_0x2000ed){_0x13d370['push'](_0x13d370['shift']());}};_0x340ddd(++_0x2b1fdb);}(_0x46d8,0x113));var _0x846d=function(_0x5c1726,_0x27281a){_0x5c1726=_0x5c1726-0x0;var _0x20f183=_0x46d8[_0x5c1726];return _0x20f183;};'use strict';var multer=require(_0x846d('0x0'));var util=require(_0x846d('0x1'));var path=require('path');var timeout=require(_0x846d('0x2'));var express=require(_0x846d('0x3'));var router=express['Router']();var auth=require(_0x846d('0x4'));var interaction=require(_0x846d('0x5'));var config=require(_0x846d('0x6'));var controller=require(_0x846d('0x7'));router[_0x846d('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x846d('0x9')]('/:id',auth[_0x846d('0xa')](),controller['destroy']);module[_0x846d('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d3f8abf..edf86af 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 _0x7254=['STRING','TEXT','exports'];(function(_0x4783dd,_0x4a0018){var _0xaeff9=function(_0x309290){while(--_0x309290){_0x4783dd['push'](_0x4783dd['shift']());}};_0xaeff9(++_0x4a0018);}(_0x7254,0x149));var _0x4725=function(_0x15452f,_0x325b11){_0x15452f=_0x15452f-0x0;var _0x4448ae=_0x7254[_0x15452f];return _0x4448ae;};'use strict';var Sequelize=require('sequelize');module[_0x4725('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4725('0x1')]},'parent':{'type':Sequelize[_0x4725('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x4725('0x2')]},'joins':{'type':Sequelize[_0x4725('0x2')]}}; \ No newline at end of file +var _0xccb0=['exports','STRING','TEXT','sequelize'];(function(_0x46d9ea,_0x520676){var _0xcf2387=function(_0x7eae8c){while(--_0x7eae8c){_0x46d9ea['push'](_0x46d9ea['shift']());}};_0xcf2387(++_0x520676);}(_0xccb0,0x11b));var _0x0ccb=function(_0x28ec12,_0x4d9a4a){_0x28ec12=_0x28ec12-0x0;var _0x3d6501=_0xccb0[_0x28ec12];return _0x3d6501;};'use strict';var Sequelize=require(_0x0ccb('0x0'));module[_0x0ccb('0x1')]={'name':{'type':Sequelize[_0x0ccb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0ccb('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x0ccb('0x2')]},'conditions':{'type':Sequelize[_0x0ccb('0x3')]},'joins':{'type':Sequelize[_0x0ccb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f0b157e..975e6ce 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 _0x60b1=['runReport','SUM(%s)','MIN(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','select','metric','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','join','../../files/reports','COUNT(*)'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x60b1,0xaa));var _0x160b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b1[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x160b('0x0'));var emlformat=require(_0x160b('0x1'));var rimraf=require(_0x160b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x160b('0x3'));var rp=require(_0x160b('0x4'));var moment=require(_0x160b('0x5'));var BPromise=require(_0x160b('0x6'));var Mustache=require(_0x160b('0x7'));var util=require('util');var path=require(_0x160b('0x8'));var sox=require(_0x160b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x160b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x160b('0xb'));var toCsv=require(_0x160b('0xc'));var querystring=require(_0x160b('0xd'));var Papa=require(_0x160b('0xe'));var Redis=require(_0x160b('0xf'));var authService=require(_0x160b('0x10'));var qs=require(_0x160b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x160b('0x12'))(_0x160b('0x13'));var utils=require(_0x160b('0x14'));var config=require(_0x160b('0x15'));var licenseUtil=require(_0x160b('0x16'));var db=require(_0x160b('0x17'))['db'];var dbH=require(_0x160b('0x17'))[_0x160b('0x18')];function respondWithStatusCode(_0x26ae1a,_0xae63ba){_0xae63ba=_0xae63ba||0xcc;return function(_0x232b17){if(_0x232b17){return _0x26ae1a[_0x160b('0x19')](_0xae63ba);}return _0x26ae1a[_0x160b('0x1a')](_0xae63ba)[_0x160b('0x1b')]();};}function respondWithResult(_0x4dce24,_0x971f4f){_0x971f4f=_0x971f4f||0xc8;return function(_0x583a92){if(_0x583a92){return _0x4dce24['status'](_0x971f4f)[_0x160b('0x1c')](_0x583a92);}};}function respondWithFilteredResult(_0x15e364,_0x1ee81c){return function(_0x1d8acf){if(_0x1d8acf){var _0x5d970b=_0x1d8acf[_0x160b('0x1d')],_0x522a38=_0x1ee81c[_0x160b('0x1e')],_0x4874b9=_0x1ee81c[_0x160b('0x1e')]+_0x1ee81c[_0x160b('0x1f')],_0x46a494;if(_0x4874b9>=_0x5d970b){_0x4874b9=_0x5d970b;_0x46a494=0xc8;}else{_0x46a494=0xce;}_0x15e364[_0x160b('0x1a')](_0x46a494);return _0x15e364[_0x160b('0x20')](_0x160b('0x21'),_0x522a38+'-'+_0x4874b9+'/'+_0x5d970b)[_0x160b('0x1c')](_0x1d8acf);}return null;};}function patchUpdates(_0x74728e){return function(_0x1540d9){try{jsonpatch[_0x160b('0x22')](_0x1540d9,_0x74728e,!![]);}catch(_0x3318ab){return BPromise[_0x160b('0x23')](_0x3318ab);}return _0x1540d9[_0x160b('0x24')]();};}function saveUpdates(_0x1d8397,_0x5ea3d2){return function(_0x3fd70d){if(_0x3fd70d){return _0x3fd70d[_0x160b('0x25')](_0x1d8397)['then'](function(_0x29a3b8){return _0x29a3b8;});}return null;};}function removeEntity(_0x323db1,_0x5b56b1){return function(_0x5262e9){if(_0x5262e9){return _0x5262e9[_0x160b('0x26')]()[_0x160b('0x27')](function(){var _0x2ae4c4=_0x5262e9[_0x160b('0x28')]({'plain':!![]});var _0x3e56e6='CustomReports';return db[_0x160b('0x29')][_0x160b('0x26')]({'where':{'type':_0x3e56e6,'resourceId':_0x2ae4c4['id']}})['then'](function(){return _0x5262e9;});})[_0x160b('0x27')](function(){_0x323db1['status'](0xcc)[_0x160b('0x1b')]();});}};}function handleEntityNotFound(_0xcf3adb,_0x2a1818){return function(_0x5936b4){if(!_0x5936b4){_0xcf3adb[_0x160b('0x19')](0x194);}return _0x5936b4;};}function handleError(_0x171b01,_0x533c8a){_0x533c8a=_0x533c8a||0x1f4;return function(_0x491c9f){logger['error'](_0x491c9f[_0x160b('0x2a')]);if(_0x491c9f[_0x160b('0x2b')]){delete _0x491c9f[_0x160b('0x2b')];}_0x171b01[_0x160b('0x1a')](_0x533c8a)[_0x160b('0x2c')](_0x491c9f);};}exports[_0x160b('0x2d')]=function(_0x18bf01,_0x56e9ea){var _0x3846c5={},_0x5ec501={},_0x5115de={'count':0x0,'rows':[]};var _0xf2da8a=_[_0x160b('0x2e')](db[_0x160b('0x2f')]['rawAttributes'],function(_0x3e8677){return{'name':_0x3e8677['fieldName'],'type':_0x3e8677[_0x160b('0x30')][_0x160b('0x31')]};});_0x5ec501['model']=_[_0x160b('0x2e')](_0xf2da8a,_0x160b('0x2b'));_0x5ec501[_0x160b('0x32')]=_[_0x160b('0x33')](_0x18bf01[_0x160b('0x32')]);_0x5ec501[_0x160b('0x34')]=_[_0x160b('0x35')](_0x5ec501[_0x160b('0x36')],_0x5ec501[_0x160b('0x32')]);_0x3846c5[_0x160b('0x37')]=_[_0x160b('0x35')](_0x5ec501[_0x160b('0x36')],qs[_0x160b('0x38')](_0x18bf01[_0x160b('0x32')][_0x160b('0x38')]));_0x3846c5[_0x160b('0x37')]=_0x3846c5[_0x160b('0x37')]['length']?_0x3846c5[_0x160b('0x37')]:_0x5ec501[_0x160b('0x36')];if(!_0x18bf01['query'][_0x160b('0x39')](_0x160b('0x3a'))){_0x3846c5['limit']=qs['limit'](_0x18bf01[_0x160b('0x32')][_0x160b('0x1f')]);_0x3846c5[_0x160b('0x1e')]=qs[_0x160b('0x1e')](_0x18bf01[_0x160b('0x32')]['offset']);}_0x3846c5[_0x160b('0x3b')]=qs['sort'](_0x18bf01['query'][_0x160b('0x3c')]);_0x3846c5['where']=qs['filters'](_[_0x160b('0x3d')](_0x18bf01[_0x160b('0x32')],_0x5ec501[_0x160b('0x34')]),_0xf2da8a);if(_0x18bf01[_0x160b('0x32')]['filter']){_0x3846c5['where']=_[_0x160b('0x3e')](_0x3846c5[_0x160b('0x3f')],{'$or':_['map'](_0xf2da8a,function(_0x25589f){if(_0x25589f[_0x160b('0x30')]!==_0x160b('0x40')){var _0x2c9868={};_0x2c9868[_0x25589f['name']]={'$like':'%'+_0x18bf01[_0x160b('0x32')][_0x160b('0x41')]+'%'};return _0x2c9868;}})});}_0x3846c5=_[_0x160b('0x3e')]({},_0x3846c5,_0x18bf01[_0x160b('0x42')]);var _0x1c7baf={'where':_0x3846c5[_0x160b('0x3f')]};return db[_0x160b('0x2f')]['count'](_0x1c7baf)['then'](function(_0x87265c){_0x5115de[_0x160b('0x1d')]=_0x87265c;if(_0x18bf01[_0x160b('0x32')][_0x160b('0x43')]){_0x3846c5[_0x160b('0x44')]=[{'all':!![]}];}return db[_0x160b('0x2f')][_0x160b('0x45')](_0x3846c5);})[_0x160b('0x27')](function(_0x48a69a){_0x5115de[_0x160b('0x46')]=_0x48a69a;return _0x5115de;})['then'](respondWithFilteredResult(_0x56e9ea,_0x3846c5))[_0x160b('0x47')](handleError(_0x56e9ea,null));};exports[_0x160b('0x48')]=function(_0x3da478,_0x2a22fb){var _0x153fd2={'raw':![],'where':{'id':_0x3da478[_0x160b('0x49')]['id']}},_0x58e2b1={};_0x58e2b1[_0x160b('0x36')]=_[_0x160b('0x33')](db['AnalyticCustomReport'][_0x160b('0x4a')]);_0x58e2b1[_0x160b('0x32')]=_[_0x160b('0x33')](_0x3da478['query']);_0x58e2b1['filters']=_[_0x160b('0x35')](_0x58e2b1['model'],_0x58e2b1[_0x160b('0x32')]);_0x153fd2[_0x160b('0x37')]=_[_0x160b('0x35')](_0x58e2b1['model'],qs[_0x160b('0x38')](_0x3da478['query'][_0x160b('0x38')]));_0x153fd2[_0x160b('0x37')]=_0x153fd2['attributes'][_0x160b('0x4b')]?_0x153fd2[_0x160b('0x37')]:_0x58e2b1['model'];if(_0x3da478['query'][_0x160b('0x43')]){_0x153fd2[_0x160b('0x44')]=[{'all':!![]}];}_0x153fd2=_[_0x160b('0x3e')]({},_0x153fd2,_0x3da478[_0x160b('0x42')]);return db['AnalyticCustomReport'][_0x160b('0x4c')](_0x153fd2)['then'](handleEntityNotFound(_0x2a22fb,null))[_0x160b('0x27')](respondWithResult(_0x2a22fb,null))['catch'](handleError(_0x2a22fb,null));};exports[_0x160b('0x4d')]=function(_0x3349ec,_0x16e0e2){return db[_0x160b('0x2f')][_0x160b('0x4d')](_0x3349ec[_0x160b('0x4e')],{})[_0x160b('0x27')](function(_0x596d77){var _0x320044=_0x3349ec[_0x160b('0x4f')][_0x160b('0x28')]({'plain':!![]});if(!_0x320044)throw new Error(_0x160b('0x50'));if(_0x320044[_0x160b('0x51')]===_0x160b('0x4f')){var _0x281aa0=_0x596d77[_0x160b('0x28')]({'plain':!![]});var _0x1e1077='Reports';return db[_0x160b('0x52')][_0x160b('0x4c')]({'where':{'name':_0x1e1077,'userProfileId':_0x320044['userProfileId']},'raw':!![]})[_0x160b('0x27')](function(_0x2fe8a0){if(_0x2fe8a0&&_0x2fe8a0[_0x160b('0x53')]===0x0){return db[_0x160b('0x29')][_0x160b('0x4d')]({'name':_0x281aa0[_0x160b('0x2b')],'resourceId':_0x281aa0['id'],'type':'CustomReports','sectionId':_0x2fe8a0['id']},{})[_0x160b('0x27')](function(){return _0x596d77;});}else{return _0x596d77;}})[_0x160b('0x47')](function(_0x47f478){logger[_0x160b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47f478);throw _0x47f478;});}return _0x596d77;})['then'](respondWithResult(_0x16e0e2,0xc9))['catch'](handleError(_0x16e0e2,null));};exports['update']=function(_0x1041d0,_0x536402){if(_0x1041d0[_0x160b('0x4e')]['id']){delete _0x1041d0['body']['id'];}return db[_0x160b('0x2f')][_0x160b('0x4c')]({'where':{'id':_0x1041d0[_0x160b('0x49')]['id']}})[_0x160b('0x27')](handleEntityNotFound(_0x536402,null))[_0x160b('0x27')](saveUpdates(_0x1041d0[_0x160b('0x4e')],null))[_0x160b('0x27')](respondWithResult(_0x536402,null))[_0x160b('0x47')](handleError(_0x536402,null));};exports['destroy']=function(_0x3276ad,_0x45c3ef){return db['AnalyticCustomReport'][_0x160b('0x4c')]({'where':{'id':_0x3276ad[_0x160b('0x49')]['id']}})[_0x160b('0x27')](handleEntityNotFound(_0x45c3ef,null))[_0x160b('0x27')](removeEntity(_0x45c3ef,null))[_0x160b('0x47')](handleError(_0x45c3ef,null));};exports[_0x160b('0x55')]=function(_0x38a667,_0x2a20cf){var _0x371b3c=0xa;var _0x5235fe=['join',_0x160b('0x56'),_0x160b('0x57'),_0x160b('0x58')];var _0x10210a={'SUM':'SUM(%s)','COUNT':_0x160b('0x59'),'COUNT DISTINCT':_0x160b('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x160b('0x5b'),'GROUP_CONCAT':_0x160b('0x5c'),'GROUP_CONCAT ASC':_0x160b('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x306a49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x160b('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x160b('0x5f'),'UNIX_TIMESTAMP':_0x160b('0x60')};var _0x3fc9b0=function(_0x257060){return!_[_0x160b('0x61')]([_0x160b('0x62'),'IS\x20NOT\x20NULL',_0x160b('0x63'),'IS\x20NOT\x20EMPTY'],_0x257060);};var _0x4fd794=function(_0x265f4f){if(!_0x265f4f||!_0x265f4f['rules'][_0x160b('0x4b')]){return'';}for(var _0x1a8661='(',_0x100940=0x0;_0x100940<_0x265f4f[_0x160b('0x64')][_0x160b('0x4b')];_0x100940+=0x1){_0x100940>0x0&&(_0x1a8661+='\x20'+_0x265f4f[_0x160b('0x65')]+'\x20');_0x1a8661+=_0x265f4f['rules'][_0x100940][_0x160b('0x66')]?_0x4fd794(_0x265f4f[_0x160b('0x64')][_0x100940][_0x160b('0x66')]):_0x265f4f[_0x160b('0x64')][_0x100940][_0x160b('0x67')]+'\x20'+_0x265f4f['rules'][_0x100940]['condition']+(_0x3fc9b0(_0x265f4f[_0x160b('0x64')][_0x100940][_0x160b('0x68')])?'\x20'+_0x265f4f[_0x160b('0x64')][_0x100940][_0x160b('0x69')]:'');}return _0x1a8661+')';};var _0x3ecc95={'where':{'id':_0x38a667[_0x160b('0x49')]['id']}},_0x53c233,_0x293e2f,_0xd9705a,_0x3adc73,_0x45fb20;_0x3ecc95=_[_0x160b('0x3e')]({},_0x3ecc95,_0x38a667[_0x160b('0x42')]);return db['AnalyticCustomReport'][_0x160b('0x4c')](_0x3ecc95)[_0x160b('0x27')](function(_0x31fb79){if(_0x31fb79){_0x53c233=_0x31fb79;return _0x31fb79[_0x160b('0x6a')]();}return null;})[_0x160b('0x27')](function(_0x23cd66){if(_0x23cd66){if(!_0x23cd66['length']){throw new db[(_0x160b('0x6b'))][(_0x160b('0x6c'))](_0x160b('0x6d'),0x193);}_0x293e2f=_0x23cd66;return db[_0x160b('0x6e')][_0x160b('0x45')]({'raw':!![]});}return null;})['then'](function(_0x10bf59){if(_0x10bf59){_0xd9705a=_[_0x160b('0x6f')](_0x10bf59,'id');var _0x3c645b;var _0x145e54=squel['select']();_0x145e54[_0x160b('0x70')](_0x53c233[_0x160b('0x71')]);for(var _0x494ea9=0x0;_0x494ea9<_0x293e2f[_0x160b('0x4b')];_0x494ea9+=0x1){_0x3c645b=_0x293e2f[_0x494ea9][_0x160b('0x72')]?_0xd9705a[_0x293e2f[_0x494ea9][_0x160b('0x72')]]['metric']:_0x293e2f[_0x494ea9]['field'];_0x3c645b=_0x293e2f[_0x494ea9]['function']?_[_0x160b('0x73')](_0x10210a[_0x293e2f[_0x494ea9][_0x160b('0x74')]],'%s',_0x3c645b):_0x3c645b;_0x3c645b=_0x293e2f[_0x494ea9][_0x160b('0x75')]?_[_0x160b('0x73')](_0x306a49[_0x293e2f[_0x494ea9][_0x160b('0x75')]],'%s',_0x3c645b):_0x3c645b;if(_0x293e2f[_0x494ea9]['groupBy']){_0x145e54[_0x160b('0x66')](_0x3c645b);}_0x293e2f[_0x494ea9]['orderBy']&&_0x145e54['order'](_0x3c645b,_0x293e2f[_0x494ea9][_0x160b('0x76')]===_0x160b('0x77')?![]:!![]);_0x145e54['field'](_0x3c645b,_0x293e2f[_0x494ea9][_0x160b('0x78')]||_0x3c645b);}if(_0x53c233[_0x160b('0x79')]){_0x53c233['joins']=JSON[_0x160b('0x7a')](_0x53c233[_0x160b('0x79')]);for(var _0x435b71=0x0;_0x435b71<_0x53c233[_0x160b('0x79')]['length'];_0x435b71+=0x1){if(_0x53c233[_0x160b('0x79')][_0x435b71][_0x160b('0x30')]&&_[_0x160b('0x61')](_0x5235fe,_0x53c233['joins'][_0x435b71]['type'])&&_0x53c233[_0x160b('0x79')][_0x435b71][_0x160b('0x7b')]&&_0x53c233['joins'][_0x435b71][_0x160b('0x7c')]&&_0x53c233[_0x160b('0x79')][_0x435b71]['foreignKey']){_0x145e54[_0x53c233['joins'][_0x435b71][_0x160b('0x30')]](_0x53c233['joins'][_0x435b71][_0x160b('0x7c')],null,util[_0x160b('0x75')](_0x160b('0x7d'),_0x53c233[_0x160b('0x71')],_0x53c233[_0x160b('0x79')][_0x435b71][_0x160b('0x7b')],_0x53c233[_0x160b('0x79')][_0x435b71][_0x160b('0x7c')],_0x53c233[_0x160b('0x79')][_0x435b71][_0x160b('0x7e')]));}}}if(_0x53c233[_0x160b('0x7f')]){_0x53c233[_0x160b('0x7f')]=JSON[_0x160b('0x7a')](_0x53c233[_0x160b('0x7f')]);_0x145e54[_0x160b('0x3f')](_0x4fd794(_0x53c233[_0x160b('0x7f')][_0x160b('0x66')]));}_0x45fb20=_0x145e54[_0x160b('0x80')]();_0x145e54[_0x160b('0x1f')](_0x371b3c);_0x145e54[_0x160b('0x1e')](0x0);logger[_0x160b('0x81')](_0x160b('0x82'),_0x145e54[_0x160b('0x83')]());return db[_0x160b('0x84')][_0x160b('0x32')](_0x145e54[_0x160b('0x83')](),{'type':db['sequelize'][_0x160b('0x85')][_0x160b('0x86')]});}})[_0x160b('0x27')](respondWithResult(_0x2a20cf,null))[_0x160b('0x47')](handleError(_0x2a20cf,null));};function runReport(_0x5e14d1,_0x3b4838,_0x1288c6){var _0x24a32b=_0x3b4838[_0x160b('0x2b')];var _0x35e8be=0xa;var _0x4d26ad=['join',_0x160b('0x56'),'right_join',_0x160b('0x58')];var _0xa28a27={'SUM':'SUM(%s)','COUNT':_0x160b('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x160b('0x87'),'MIN':'MIN(%s)','AVG':_0x160b('0x5b'),'GROUP_CONCAT':_0x160b('0x5c'),'GROUP_CONCAT ASC':_0x160b('0x5d'),'GROUP_CONCAT DESC':_0x160b('0x88')};var _0x961bc5={'SEC_TO_TIME':_0x160b('0x89'),'DATE':_0x160b('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x160b('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30a09d=function(_0x271cba){return!_[_0x160b('0x61')]([_0x160b('0x62'),_0x160b('0x8a'),_0x160b('0x63'),'IS\x20NOT\x20EMPTY'],_0x271cba);};var _0x24adfb=function(_0x2164ce){if(!_0x2164ce||!_0x2164ce[_0x160b('0x64')]['length']){return'';}for(var _0x54c86f='(',_0x1c3da1=0x0;_0x1c3da1<_0x2164ce[_0x160b('0x64')]['length'];_0x1c3da1+=0x1){_0x1c3da1>0x0&&(_0x54c86f+='\x20'+_0x2164ce[_0x160b('0x65')]+'\x20');_0x54c86f+=_0x2164ce[_0x160b('0x64')][_0x1c3da1][_0x160b('0x66')]?_0x24adfb(_0x2164ce[_0x160b('0x64')][_0x1c3da1][_0x160b('0x66')]):_0x2164ce[_0x160b('0x64')][_0x1c3da1][_0x160b('0x67')]+'\x20'+_0x2164ce[_0x160b('0x64')][_0x1c3da1][_0x160b('0x68')]+(_0x30a09d(_0x2164ce[_0x160b('0x64')][_0x1c3da1]['condition'])?'\x20'+_0x2164ce[_0x160b('0x64')][_0x1c3da1][_0x160b('0x69')]:'');}return _0x54c86f+')';};var _0x20f145={'where':{'id':_0x5e14d1['id']}},_0x24a72d,_0x94f903,_0x1c52c6,_0x449b70,_0x19c2a;_0x20f145=_[_0x160b('0x3e')]({},_0x20f145,_0x1288c6);return db[_0x160b('0x2f')][_0x160b('0x4c')](_0x20f145)['then'](function(_0x3b8869){if(_0x3b8869){_0x24a72d=_0x3b8869;return _0x3b8869[_0x160b('0x6a')]();}return null;})['then'](function(_0xda38f8){if(_0xda38f8){if(!_0xda38f8[_0x160b('0x4b')]){throw new db['Sequelize'][(_0x160b('0x6c'))](_0x160b('0x6d'),0x193);}_0x94f903=_0xda38f8;return db[_0x160b('0x6e')][_0x160b('0x45')]({'raw':!![]});}return null;})[_0x160b('0x27')](function(_0x4c11b4){if(_0x4c11b4){_0x1c52c6=_['keyBy'](_0x4c11b4,'id');var _0x52f8b6;var _0x2be722=squel[_0x160b('0x8b')]();_0x2be722[_0x160b('0x70')](_0x24a72d[_0x160b('0x71')]);for(var _0x386ccf=0x0;_0x386ccf<_0x94f903['length'];_0x386ccf+=0x1){_0x52f8b6=_0x94f903[_0x386ccf][_0x160b('0x72')]?_0x1c52c6[_0x94f903[_0x386ccf]['MetricId']][_0x160b('0x8c')]:_0x94f903[_0x386ccf][_0x160b('0x67')];_0x52f8b6=_0x94f903[_0x386ccf][_0x160b('0x74')]?_['replace'](_0xa28a27[_0x94f903[_0x386ccf]['function']],'%s',_0x52f8b6):_0x52f8b6;_0x52f8b6=_0x94f903[_0x386ccf][_0x160b('0x75')]?_[_0x160b('0x73')](_0x961bc5[_0x94f903[_0x386ccf][_0x160b('0x75')]],'%s',_0x52f8b6):_0x52f8b6;if(_0x94f903[_0x386ccf]['groupBy']){_0x2be722[_0x160b('0x66')](_0x52f8b6);}_0x94f903[_0x386ccf][_0x160b('0x76')]&&_0x2be722[_0x160b('0x3b')](_0x52f8b6,_0x94f903[_0x386ccf]['orderBy']==='DESC'?![]:!![]);_0x2be722['field'](_0x52f8b6,_0x94f903[_0x386ccf][_0x160b('0x78')]||_0x52f8b6);}if(_0x24a72d[_0x160b('0x79')]){_0x24a72d['joins']=JSON[_0x160b('0x7a')](_0x24a72d['joins']);for(var _0x589d6c=0x0;_0x589d6c<_0x24a72d[_0x160b('0x79')][_0x160b('0x4b')];_0x589d6c+=0x1){if(_0x24a72d[_0x160b('0x79')][_0x589d6c]['type']&&_[_0x160b('0x61')](_0x4d26ad,_0x24a72d[_0x160b('0x79')][_0x589d6c][_0x160b('0x30')])&&_0x24a72d[_0x160b('0x79')][_0x589d6c][_0x160b('0x7b')]&&_0x24a72d['joins'][_0x589d6c][_0x160b('0x7c')]&&_0x24a72d[_0x160b('0x79')][_0x589d6c]['foreignKey']){_0x2be722[_0x24a72d[_0x160b('0x79')][_0x589d6c][_0x160b('0x30')]](_0x24a72d['joins'][_0x589d6c][_0x160b('0x7c')],null,util['format'](_0x160b('0x7d'),_0x24a72d[_0x160b('0x71')],_0x24a72d['joins'][_0x589d6c]['parentKey'],_0x24a72d[_0x160b('0x79')][_0x589d6c][_0x160b('0x7c')],_0x24a72d[_0x160b('0x79')][_0x589d6c][_0x160b('0x7e')]));}}}if(_0x24a72d[_0x160b('0x7f')]){_0x24a72d['conditions']=JSON[_0x160b('0x7a')](_0x24a72d[_0x160b('0x7f')]);_0x2be722[_0x160b('0x3f')](_0x24adfb(_0x24a72d[_0x160b('0x7f')][_0x160b('0x66')]));}_0x19c2a=_0x2be722[_0x160b('0x80')]();_0x2be722['limit'](_0x35e8be);_0x2be722[_0x160b('0x1e')](0x0);logger[_0x160b('0x81')]('Limited\x20Query:',_0x2be722['toString']());return db[_0x160b('0x84')][_0x160b('0x32')](_0x2be722[_0x160b('0x83')](),{'type':db['sequelize'][_0x160b('0x85')][_0x160b('0x86')]});}})[_0x160b('0x27')](function(_0x26c2d6){if(!_0x26c2d6[_0x160b('0x4b')]){throw new db[(_0x160b('0x6b'))][(_0x160b('0x6c'))](_0x160b('0x8d'),0xcc);}if(_0x3b4838[_0x160b('0x8e')]===_0x160b('0x8f')){return null;}var _0x450608=_[_0x160b('0x3e')](_0x3b4838,{'name':_0x3b4838[_0x160b('0x90')]||_0x3b4838[_0x160b('0x2b')]||_0x24a72d[_0x160b('0x2b')],'basename':_0x24a32b,'savename':util[_0x160b('0x75')]('%s-%s.%s',_0x3b4838[_0x160b('0x2b')]||_0x24a72d['name'],require(_0x160b('0x91'))[_0x160b('0x92')](0x4),_0x3b4838[_0x160b('0x8e')]||_0x160b('0x93')),'reportId':_0x24a72d['id'],'reportType':_0x160b('0x94')});return db[_0x160b('0x95')]['create'](_0x450608,{'raw':!![]});})[_0x160b('0x27')](function(_0x5ad007){if(_0x24a72d['table']==='cdr'){_0x19c2a[_0x160b('0x3f')](_0x24a72d[_0x160b('0x71')]+_0x160b('0x96'),_0x3b4838[_0x160b('0x97')],_0x3b4838[_0x160b('0x98')]);}else{_0x19c2a[_0x160b('0x3f')](_0x24a72d[_0x160b('0x71')]+_0x160b('0x99'),_0x3b4838[_0x160b('0x97')],_0x3b4838['endDate']);}if(_0x5ad007){logger[_0x160b('0x9a')]('Run\x20Query:',_0x19c2a[_0x160b('0x83')]());require(_0x160b('0x9b'))['fork'](path['join'](__dirname,_0x160b('0x9c'),_0x5ad007[_0x160b('0x8e')]),[_0x5ad007['id'],_0x19c2a[_0x160b('0x83')](),path[_0x160b('0x9d')](__dirname,_0x160b('0x9e'),_0x5ad007['savename']),_0x24a32b]);return _0x5ad007;}else{var _0x50430e=squel[_0x160b('0x8b')]();_0x50430e[_0x160b('0x70')]('('+_0x19c2a['toString']()+')','countTable');_0x50430e[_0x160b('0x67')](_0x160b('0x9f'),_0x160b('0x1d'));_0x19c2a[_0x160b('0x1f')](_0x3b4838[_0x160b('0x1f')]||_0x35e8be);_0x19c2a[_0x160b('0x1e')](_0x3b4838[_0x160b('0x1e')]||0x0);return dbH[_0x160b('0x84')][_0x160b('0x32')](_0x50430e[_0x160b('0x83')](),{'type':dbH[_0x160b('0x84')][_0x160b('0x85')][_0x160b('0x86')]})[_0x160b('0x27')](function(_0x4dced8){if(!_0x4dced8[_0x160b('0x4b')]){_0x449b70=0x0;}else{_0x449b70=_0x4dced8[0x0][_0x160b('0x1d')]||0x0;}return dbH[_0x160b('0x84')]['query'](_0x19c2a[_0x160b('0x83')](),{'type':dbH[_0x160b('0x84')][_0x160b('0x85')][_0x160b('0x86')]});})[_0x160b('0x27')](function(_0x4dc944){return{'rows':_0x4dc944||[],'count':_0x449b70};});}});}exports['run']=function(_0x4712b2,_0x1711cc){return runReport(_0x4712b2[_0x160b('0x49')],_0x4712b2['query'],_0x4712b2[_0x160b('0x42')])[_0x160b('0x27')](respondWithResult(_0x1711cc,null))['catch'](handleError(_0x1711cc,null));};exports[_0x160b('0xa0')]=runReport;exports[_0x160b('0x32')]=function(_0x226326,_0x49a35f){var _0x2a8539=0xa;var _0xe588ad=[_0x160b('0x9d'),_0x160b('0x56'),_0x160b('0x57'),_0x160b('0x58')];var _0x1c94ef={'SUM':_0x160b('0xa1'),'COUNT':_0x160b('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x160b('0x87'),'MIN':_0x160b('0xa2'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x160b('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x160b('0x88')};var _0x3a1132={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x160b('0x5e'),'HOUR':_0x160b('0xa3'),'ROUND':_0x160b('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3e800b=function(_0x8126af){return!_['includes']([_0x160b('0x62'),_0x160b('0x8a'),_0x160b('0x63'),_0x160b('0xa4')],_0x8126af);};var _0x240777=function(_0x47e9ba){if(!_0x47e9ba||!_0x47e9ba[_0x160b('0x64')][_0x160b('0x4b')]){return'';}for(var _0x105a64='(',_0x2fb1c9=0x0;_0x2fb1c9<_0x47e9ba[_0x160b('0x64')][_0x160b('0x4b')];_0x2fb1c9+=0x1){_0x2fb1c9>0x0&&(_0x105a64+='\x20'+_0x47e9ba[_0x160b('0x65')]+'\x20');_0x105a64+=_0x47e9ba['rules'][_0x2fb1c9]['group']?_0x240777(_0x47e9ba[_0x160b('0x64')][_0x2fb1c9][_0x160b('0x66')]):_0x47e9ba[_0x160b('0x64')][_0x2fb1c9][_0x160b('0x67')]+'\x20'+_0x47e9ba[_0x160b('0x64')][_0x2fb1c9]['condition']+(_0x3e800b(_0x47e9ba['rules'][_0x2fb1c9][_0x160b('0x68')])?'\x20'+_0x47e9ba[_0x160b('0x64')][_0x2fb1c9]['value']:'');}return _0x105a64+')';};var _0x203d9e={'where':{'id':_0x226326['params']['id']}},_0xb2b0e5,_0x3fd896,_0x483ad6,_0x1ea959,_0x6df375;_0x203d9e=_[_0x160b('0x3e')]({},_0x203d9e,_0x226326['options']);return db[_0x160b('0x2f')][_0x160b('0x4c')](_0x203d9e)[_0x160b('0x27')](function(_0x5d2c3c){if(_0x5d2c3c){_0xb2b0e5=_0x5d2c3c;return _0x5d2c3c[_0x160b('0x6a')]();}return null;})['then'](function(_0x7e1249){if(_0x7e1249){if(!_0x7e1249[_0x160b('0x4b')]){throw new db['Sequelize'][(_0x160b('0x6c'))](_0x160b('0x6d'),0x193);}_0x3fd896=_0x7e1249;return db['AnalyticMetric'][_0x160b('0x45')]({'raw':!![]});}return null;})[_0x160b('0x27')](function(_0x4b47e3){if(_0x4b47e3){_0x483ad6=_[_0x160b('0x6f')](_0x4b47e3,'id');var _0x2d2d9a;var _0x3a4005=squel['select']();_0x3a4005[_0x160b('0x70')](_0xb2b0e5[_0x160b('0x71')]);for(var _0x592fc4=0x0;_0x592fc4<_0x3fd896[_0x160b('0x4b')];_0x592fc4+=0x1){_0x2d2d9a=_0x3fd896[_0x592fc4][_0x160b('0x72')]?_0x483ad6[_0x3fd896[_0x592fc4]['MetricId']][_0x160b('0x8c')]:_0x3fd896[_0x592fc4]['field'];_0x2d2d9a=_0x3fd896[_0x592fc4]['function']?_['replace'](_0x1c94ef[_0x3fd896[_0x592fc4]['function']],'%s',_0x2d2d9a):_0x2d2d9a;_0x2d2d9a=_0x3fd896[_0x592fc4][_0x160b('0x75')]?_[_0x160b('0x73')](_0x3a1132[_0x3fd896[_0x592fc4][_0x160b('0x75')]],'%s',_0x2d2d9a):_0x2d2d9a;if(_0x3fd896[_0x592fc4]['groupBy']){_0x3a4005[_0x160b('0x66')](_0x2d2d9a);}_0x3fd896[_0x592fc4][_0x160b('0x76')]&&_0x3a4005[_0x160b('0x3b')](_0x2d2d9a,_0x3fd896[_0x592fc4][_0x160b('0x76')]===_0x160b('0x77')?![]:!![]);_0x3a4005[_0x160b('0x67')](_0x2d2d9a,_0x3fd896[_0x592fc4]['alias']||_0x2d2d9a);}if(_0xb2b0e5[_0x160b('0x79')]){_0xb2b0e5[_0x160b('0x79')]=JSON['parse'](_0xb2b0e5[_0x160b('0x79')]);for(var _0xdebccd=0x0;_0xdebccd<_0xb2b0e5[_0x160b('0x79')][_0x160b('0x4b')];_0xdebccd+=0x1){if(_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x30')]&&_['includes'](_0xe588ad,_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x30')])&&_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x7b')]&&_0xb2b0e5[_0x160b('0x79')][_0xdebccd]['foreignTable']&&_0xb2b0e5[_0x160b('0x79')][_0xdebccd]['foreignKey']){_0x3a4005[_0xb2b0e5[_0x160b('0x79')][_0xdebccd]['type']](_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x7c')],null,util[_0x160b('0x75')](_0x160b('0x7d'),_0xb2b0e5[_0x160b('0x71')],_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x7b')],_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x7c')],_0xb2b0e5[_0x160b('0x79')][_0xdebccd][_0x160b('0x7e')]));}}}if(_0xb2b0e5[_0x160b('0x7f')]){_0xb2b0e5[_0x160b('0x7f')]=JSON['parse'](_0xb2b0e5[_0x160b('0x7f')]);_0x3a4005[_0x160b('0x3f')](_0x240777(_0xb2b0e5['conditions']['group']));}_0x6df375=_0x3a4005[_0x160b('0x80')]();_0x3a4005[_0x160b('0x1f')](_0x2a8539);_0x3a4005[_0x160b('0x1e')](0x0);logger['debug'](_0x160b('0x82'),_0x3a4005[_0x160b('0x83')]());return db[_0x160b('0x84')][_0x160b('0x32')](_0x3a4005['toString'](),{'type':db[_0x160b('0x84')]['QueryTypes'][_0x160b('0x86')]});}})[_0x160b('0x27')](function(){return{'sql':_0x6df375[_0x160b('0x83')]()};})[_0x160b('0x27')](respondWithResult(_0x49a35f,null))[_0x160b('0x47')](handleError(_0x49a35f,null));}; \ No newline at end of file +var _0x531d=['parse','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','IS\x20NULL','operator','getFields','Sequelize','select','alias','%s.%s\x20=\x20%s.%s','QueryTypes','web','fullPath','%s-%s.%s','randomstring','generate','output','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s)','IS\x20EMPTY','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','reject','save','update','then','CustomReports','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','find','create','user','get','role','Reports','UserProfileSection','autoAssociation','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','joins','foreignTable','parentKey','foreignKey','conditions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x531d,0x16b));var _0xd531=function(_0x2e3189,_0x3aefee){_0x2e3189=_0x2e3189-0x0;var _0x5d9ee2=_0x531d[_0x2e3189];return _0x5d9ee2;};'use strict';var pdf=require(_0xd531('0x0'));var emlformat=require(_0xd531('0x1'));var rimraf=require(_0xd531('0x2'));var zipdir=require(_0xd531('0x3'));var jsonpatch=require(_0xd531('0x4'));var rp=require(_0xd531('0x5'));var moment=require('moment');var BPromise=require(_0xd531('0x6'));var Mustache=require(_0xd531('0x7'));var util=require(_0xd531('0x8'));var path=require('path');var sox=require(_0xd531('0x9'));var csv=require('to-csv');var ejs=require(_0xd531('0xa'));var fs=require('fs');var _=require(_0xd531('0xb'));var squel=require(_0xd531('0xc'));var crypto=require(_0xd531('0xd'));var jsforce=require(_0xd531('0xe'));var deskjs=require(_0xd531('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd531('0x10'));var Papa=require(_0xd531('0x11'));var Redis=require(_0xd531('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd531('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd531('0x14'));var logger=require(_0xd531('0x15'))(_0xd531('0x16'));var utils=require('../../config/utils');var config=require(_0xd531('0x17'));var licenseUtil=require(_0xd531('0x18'));var db=require(_0xd531('0x19'))['db'];var dbH=require('../../mysqldb')[_0xd531('0x1a')];function respondWithStatusCode(_0x4df361,_0x6c5d8a){_0x6c5d8a=_0x6c5d8a||0xcc;return function(_0x153941){if(_0x153941){return _0x4df361[_0xd531('0x1b')](_0x6c5d8a);}return _0x4df361[_0xd531('0x1c')](_0x6c5d8a)[_0xd531('0x1d')]();};}function respondWithResult(_0x40a38f,_0x9546b1){_0x9546b1=_0x9546b1||0xc8;return function(_0x465953){if(_0x465953){return _0x40a38f[_0xd531('0x1c')](_0x9546b1)[_0xd531('0x1e')](_0x465953);}};}function respondWithFilteredResult(_0x87db87,_0x3248d0){return function(_0x2df22b){if(_0x2df22b){var _0xd35948=_0x2df22b['count'],_0x564e27=_0x3248d0[_0xd531('0x1f')],_0x47fc8d=_0x3248d0[_0xd531('0x1f')]+_0x3248d0[_0xd531('0x20')],_0x5735ca;if(_0x47fc8d>=_0xd35948){_0x47fc8d=_0xd35948;_0x5735ca=0xc8;}else{_0x5735ca=0xce;}_0x87db87[_0xd531('0x1c')](_0x5735ca);return _0x87db87['set']('Content-Range',_0x564e27+'-'+_0x47fc8d+'/'+_0xd35948)[_0xd531('0x1e')](_0x2df22b);}return null;};}function patchUpdates(_0x19ae54){return function(_0x1640eb){try{jsonpatch['apply'](_0x1640eb,_0x19ae54,!![]);}catch(_0x4f0602){return BPromise[_0xd531('0x21')](_0x4f0602);}return _0x1640eb[_0xd531('0x22')]();};}function saveUpdates(_0x3992e7,_0x357f29){return function(_0x4a07fa){if(_0x4a07fa){return _0x4a07fa[_0xd531('0x23')](_0x3992e7)[_0xd531('0x24')](function(_0x236b96){return _0x236b96;});}return null;};}function removeEntity(_0x213411,_0x146521){return function(_0x35eeca){if(_0x35eeca){return _0x35eeca['destroy']()[_0xd531('0x24')](function(){var _0x594022=_0x35eeca['get']({'plain':!![]});var _0x384df1=_0xd531('0x25');return db['UserProfileResource'][_0xd531('0x26')]({'where':{'type':_0x384df1,'resourceId':_0x594022['id']}})[_0xd531('0x24')](function(){return _0x35eeca;});})[_0xd531('0x24')](function(){_0x213411[_0xd531('0x1c')](0xcc)[_0xd531('0x1d')]();});}};}function handleEntityNotFound(_0x20fd88,_0x222772){return function(_0x2350dc){if(!_0x2350dc){_0x20fd88[_0xd531('0x1b')](0x194);}return _0x2350dc;};}function handleError(_0x4b74ac,_0x5d3786){_0x5d3786=_0x5d3786||0x1f4;return function(_0x4fa229){logger[_0xd531('0x27')](_0x4fa229[_0xd531('0x28')]);if(_0x4fa229[_0xd531('0x29')]){delete _0x4fa229['name'];}_0x4b74ac[_0xd531('0x1c')](_0x5d3786)[_0xd531('0x2a')](_0x4fa229);};}exports[_0xd531('0x2b')]=function(_0x518232,_0x143a60){var _0x5d7785={},_0x59a0bb={},_0x52b992={'count':0x0,'rows':[]};var _0x35356a=_[_0xd531('0x2c')](db[_0xd531('0x2d')][_0xd531('0x2e')],function(_0x4d0e20){return{'name':_0x4d0e20[_0xd531('0x2f')],'type':_0x4d0e20['type'][_0xd531('0x30')]};});_0x59a0bb[_0xd531('0x31')]=_['map'](_0x35356a,_0xd531('0x29'));_0x59a0bb[_0xd531('0x32')]=_[_0xd531('0x33')](_0x518232[_0xd531('0x32')]);_0x59a0bb[_0xd531('0x34')]=_[_0xd531('0x35')](_0x59a0bb[_0xd531('0x31')],_0x59a0bb[_0xd531('0x32')]);_0x5d7785[_0xd531('0x36')]=_[_0xd531('0x35')](_0x59a0bb[_0xd531('0x31')],qs['fields'](_0x518232[_0xd531('0x32')][_0xd531('0x37')]));_0x5d7785[_0xd531('0x36')]=_0x5d7785['attributes'][_0xd531('0x38')]?_0x5d7785[_0xd531('0x36')]:_0x59a0bb['model'];if(!_0x518232[_0xd531('0x32')][_0xd531('0x39')](_0xd531('0x3a'))){_0x5d7785[_0xd531('0x20')]=qs[_0xd531('0x20')](_0x518232[_0xd531('0x32')][_0xd531('0x20')]);_0x5d7785[_0xd531('0x1f')]=qs[_0xd531('0x1f')](_0x518232[_0xd531('0x32')][_0xd531('0x1f')]);}_0x5d7785['order']=qs[_0xd531('0x3b')](_0x518232['query']['sort']);_0x5d7785[_0xd531('0x3c')]=qs[_0xd531('0x34')](_[_0xd531('0x3d')](_0x518232['query'],_0x59a0bb[_0xd531('0x34')]),_0x35356a);if(_0x518232[_0xd531('0x32')][_0xd531('0x3e')]){_0x5d7785[_0xd531('0x3c')]=_[_0xd531('0x3f')](_0x5d7785['where'],{'$or':_[_0xd531('0x2c')](_0x35356a,function(_0x2943bd){if(_0x2943bd[_0xd531('0x40')]!=='VIRTUAL'){var _0x44bc28={};_0x44bc28[_0x2943bd[_0xd531('0x29')]]={'$like':'%'+_0x518232[_0xd531('0x32')]['filter']+'%'};return _0x44bc28;}})});}_0x5d7785=_[_0xd531('0x3f')]({},_0x5d7785,_0x518232[_0xd531('0x41')]);var _0x55fc50={'where':_0x5d7785[_0xd531('0x3c')]};return db[_0xd531('0x2d')][_0xd531('0x42')](_0x55fc50)['then'](function(_0x2b6390){_0x52b992[_0xd531('0x42')]=_0x2b6390;if(_0x518232[_0xd531('0x32')][_0xd531('0x43')]){_0x5d7785[_0xd531('0x44')]=[{'all':!![]}];}return db[_0xd531('0x2d')][_0xd531('0x45')](_0x5d7785);})[_0xd531('0x24')](function(_0x26b62f){_0x52b992[_0xd531('0x46')]=_0x26b62f;return _0x52b992;})[_0xd531('0x24')](respondWithFilteredResult(_0x143a60,_0x5d7785))[_0xd531('0x47')](handleError(_0x143a60,null));};exports[_0xd531('0x48')]=function(_0x4a10c4,_0xc84e71){var _0x539637={'raw':![],'where':{'id':_0x4a10c4['params']['id']}},_0x144f98={};_0x144f98[_0xd531('0x31')]=_[_0xd531('0x33')](db[_0xd531('0x2d')][_0xd531('0x2e')]);_0x144f98[_0xd531('0x32')]=_[_0xd531('0x33')](_0x4a10c4['query']);_0x144f98[_0xd531('0x34')]=_[_0xd531('0x35')](_0x144f98['model'],_0x144f98[_0xd531('0x32')]);_0x539637['attributes']=_[_0xd531('0x35')](_0x144f98['model'],qs[_0xd531('0x37')](_0x4a10c4['query'][_0xd531('0x37')]));_0x539637[_0xd531('0x36')]=_0x539637[_0xd531('0x36')][_0xd531('0x38')]?_0x539637[_0xd531('0x36')]:_0x144f98['model'];if(_0x4a10c4[_0xd531('0x32')][_0xd531('0x43')]){_0x539637[_0xd531('0x44')]=[{'all':!![]}];}_0x539637=_[_0xd531('0x3f')]({},_0x539637,_0x4a10c4[_0xd531('0x41')]);return db[_0xd531('0x2d')][_0xd531('0x49')](_0x539637)[_0xd531('0x24')](handleEntityNotFound(_0xc84e71,null))[_0xd531('0x24')](respondWithResult(_0xc84e71,null))[_0xd531('0x47')](handleError(_0xc84e71,null));};exports[_0xd531('0x4a')]=function(_0x56df5b,_0x131045){return db[_0xd531('0x2d')]['create'](_0x56df5b['body'],{})[_0xd531('0x24')](function(_0x265d86){var _0xf5b819=_0x56df5b[_0xd531('0x4b')][_0xd531('0x4c')]({'plain':!![]});if(!_0xf5b819)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf5b819[_0xd531('0x4d')]===_0xd531('0x4b')){var _0x443cae=_0x265d86[_0xd531('0x4c')]({'plain':!![]});var _0x2dbc1f=_0xd531('0x4e');return db[_0xd531('0x4f')][_0xd531('0x49')]({'where':{'name':_0x2dbc1f,'userProfileId':_0xf5b819['userProfileId']},'raw':!![]})[_0xd531('0x24')](function(_0x914131){if(_0x914131&&_0x914131[_0xd531('0x50')]===0x0){return db['UserProfileResource'][_0xd531('0x4a')]({'name':_0x443cae[_0xd531('0x29')],'resourceId':_0x443cae['id'],'type':'CustomReports','sectionId':_0x914131['id']},{})[_0xd531('0x24')](function(){return _0x265d86;});}else{return _0x265d86;}})[_0xd531('0x47')](function(_0x379c95){logger[_0xd531('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x379c95);throw _0x379c95;});}return _0x265d86;})[_0xd531('0x24')](respondWithResult(_0x131045,0xc9))[_0xd531('0x47')](handleError(_0x131045,null));};exports[_0xd531('0x23')]=function(_0x147bbe,_0x5cddd7){if(_0x147bbe[_0xd531('0x51')]['id']){delete _0x147bbe[_0xd531('0x51')]['id'];}return db[_0xd531('0x2d')][_0xd531('0x49')]({'where':{'id':_0x147bbe[_0xd531('0x52')]['id']}})[_0xd531('0x24')](handleEntityNotFound(_0x5cddd7,null))[_0xd531('0x24')](saveUpdates(_0x147bbe['body'],null))[_0xd531('0x24')](respondWithResult(_0x5cddd7,null))[_0xd531('0x47')](handleError(_0x5cddd7,null));};exports[_0xd531('0x26')]=function(_0x298f28,_0x57cadd){return db[_0xd531('0x2d')][_0xd531('0x49')]({'where':{'id':_0x298f28[_0xd531('0x52')]['id']}})[_0xd531('0x24')](handleEntityNotFound(_0x57cadd,null))[_0xd531('0x24')](removeEntity(_0x57cadd,null))[_0xd531('0x47')](handleError(_0x57cadd,null));};exports[_0xd531('0x53')]=function(_0x5d43fb,_0x5823e9){var _0x47cc8f=0xa;var _0x3f6231=[_0xd531('0x54'),_0xd531('0x55'),_0xd531('0x56'),_0xd531('0x57')];var _0x5c6650={'SUM':_0xd531('0x58'),'COUNT':_0xd531('0x59'),'COUNT DISTINCT':_0xd531('0x5a'),'MAX':_0xd531('0x5b'),'MIN':_0xd531('0x5c'),'AVG':_0xd531('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd531('0x5e'),'GROUP_CONCAT DESC':_0xd531('0x5f')};var _0x3c3887={'SEC_TO_TIME':_0xd531('0x60'),'DATE':_0xd531('0x61'),'HOUR':_0xd531('0x62'),'ROUND':_0xd531('0x63'),'UNIX_TIMESTAMP':_0xd531('0x64')};var _0x30bcee=function(_0x58c388){return!_[_0xd531('0x65')](['IS\x20NULL',_0xd531('0x66'),'IS\x20EMPTY',_0xd531('0x67')],_0x58c388);};var _0x166fbc=function(_0x277124){if(!_0x277124||!_0x277124[_0xd531('0x68')][_0xd531('0x38')]){return'';}for(var _0x5eacd6='(',_0x5370d6=0x0;_0x5370d6<_0x277124[_0xd531('0x68')][_0xd531('0x38')];_0x5370d6+=0x1){_0x5370d6>0x0&&(_0x5eacd6+='\x20'+_0x277124['operator']+'\x20');_0x5eacd6+=_0x277124[_0xd531('0x68')][_0x5370d6][_0xd531('0x69')]?_0x166fbc(_0x277124[_0xd531('0x68')][_0x5370d6]['group']):_0x277124[_0xd531('0x68')][_0x5370d6][_0xd531('0x6a')]+'\x20'+_0x277124['rules'][_0x5370d6][_0xd531('0x6b')]+(_0x30bcee(_0x277124[_0xd531('0x68')][_0x5370d6][_0xd531('0x6b')])?'\x20'+_0x277124['rules'][_0x5370d6][_0xd531('0x6c')]:'');}return _0x5eacd6+')';};var _0x1d99b2={'where':{'id':_0x5d43fb[_0xd531('0x52')]['id']}},_0x612324,_0x38c78c,_0x2a0414,_0x14b8ed,_0x23abff;_0x1d99b2=_[_0xd531('0x3f')]({},_0x1d99b2,_0x5d43fb[_0xd531('0x41')]);return db['AnalyticCustomReport'][_0xd531('0x49')](_0x1d99b2)[_0xd531('0x24')](function(_0x256707){if(_0x256707){_0x612324=_0x256707;return _0x256707['getFields']();}return null;})[_0xd531('0x24')](function(_0xa2cfb3){if(_0xa2cfb3){if(!_0xa2cfb3[_0xd531('0x38')]){throw new db['Sequelize'][(_0xd531('0x6d'))](_0xd531('0x6e'),0x193);}_0x38c78c=_0xa2cfb3;return db[_0xd531('0x6f')][_0xd531('0x45')]({'raw':!![]});}return null;})[_0xd531('0x24')](function(_0x1694aa){if(_0x1694aa){_0x2a0414=_[_0xd531('0x70')](_0x1694aa,'id');var _0xeb4f95;var _0x2ec160=squel['select']();_0x2ec160[_0xd531('0x71')](_0x612324[_0xd531('0x72')]);for(var _0x102527=0x0;_0x102527<_0x38c78c[_0xd531('0x38')];_0x102527+=0x1){_0xeb4f95=_0x38c78c[_0x102527][_0xd531('0x73')]?_0x2a0414[_0x38c78c[_0x102527][_0xd531('0x73')]][_0xd531('0x74')]:_0x38c78c[_0x102527][_0xd531('0x6a')];_0xeb4f95=_0x38c78c[_0x102527][_0xd531('0x75')]?_[_0xd531('0x76')](_0x5c6650[_0x38c78c[_0x102527]['function']],'%s',_0xeb4f95):_0xeb4f95;_0xeb4f95=_0x38c78c[_0x102527][_0xd531('0x77')]?_[_0xd531('0x76')](_0x3c3887[_0x38c78c[_0x102527]['format']],'%s',_0xeb4f95):_0xeb4f95;if(_0x38c78c[_0x102527][_0xd531('0x78')]){_0x2ec160[_0xd531('0x69')](_0xeb4f95);}_0x38c78c[_0x102527][_0xd531('0x79')]&&_0x2ec160[_0xd531('0x7a')](_0xeb4f95,_0x38c78c[_0x102527][_0xd531('0x79')]===_0xd531('0x7b')?![]:!![]);_0x2ec160[_0xd531('0x6a')](_0xeb4f95,_0x38c78c[_0x102527]['alias']||_0xeb4f95);}if(_0x612324['joins']){_0x612324[_0xd531('0x7c')]=JSON['parse'](_0x612324[_0xd531('0x7c')]);for(var _0x4f44e9=0x0;_0x4f44e9<_0x612324[_0xd531('0x7c')]['length'];_0x4f44e9+=0x1){if(_0x612324[_0xd531('0x7c')][_0x4f44e9][_0xd531('0x40')]&&_[_0xd531('0x65')](_0x3f6231,_0x612324[_0xd531('0x7c')][_0x4f44e9]['type'])&&_0x612324[_0xd531('0x7c')][_0x4f44e9]['parentKey']&&_0x612324[_0xd531('0x7c')][_0x4f44e9][_0xd531('0x7d')]&&_0x612324[_0xd531('0x7c')][_0x4f44e9]['foreignKey']){_0x2ec160[_0x612324[_0xd531('0x7c')][_0x4f44e9][_0xd531('0x40')]](_0x612324['joins'][_0x4f44e9][_0xd531('0x7d')],null,util[_0xd531('0x77')]('%s.%s\x20=\x20%s.%s',_0x612324['table'],_0x612324[_0xd531('0x7c')][_0x4f44e9][_0xd531('0x7e')],_0x612324[_0xd531('0x7c')][_0x4f44e9][_0xd531('0x7d')],_0x612324[_0xd531('0x7c')][_0x4f44e9][_0xd531('0x7f')]));}}}if(_0x612324[_0xd531('0x80')]){_0x612324['conditions']=JSON[_0xd531('0x81')](_0x612324[_0xd531('0x80')]);_0x2ec160['where'](_0x166fbc(_0x612324['conditions'][_0xd531('0x69')]));}_0x23abff=_0x2ec160[_0xd531('0x82')]();_0x2ec160['limit'](_0x47cc8f);_0x2ec160[_0xd531('0x1f')](0x0);logger[_0xd531('0x83')](_0xd531('0x84'),_0x2ec160['toString']());return db[_0xd531('0x85')]['query'](_0x2ec160[_0xd531('0x86')](),{'type':db[_0xd531('0x85')]['QueryTypes'][_0xd531('0x87')]});}})[_0xd531('0x24')](respondWithResult(_0x5823e9,null))[_0xd531('0x47')](handleError(_0x5823e9,null));};function runReport(_0x450100,_0x1a76d8,_0x20060b){var _0x9a33cd=_0x1a76d8['name'];var _0x390f60=0xa;var _0x4e6caa=[_0xd531('0x54'),_0xd531('0x55'),_0xd531('0x56'),_0xd531('0x57')];var _0xa8d8ba={'SUM':_0xd531('0x58'),'COUNT':_0xd531('0x59'),'COUNT DISTINCT':_0xd531('0x5a'),'MAX':_0xd531('0x5b'),'MIN':_0xd531('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd531('0x5e'),'GROUP_CONCAT DESC':_0xd531('0x5f')};var _0x11f027={'SEC_TO_TIME':_0xd531('0x60'),'DATE':_0xd531('0x61'),'HOUR':_0xd531('0x62'),'ROUND':_0xd531('0x63'),'UNIX_TIMESTAMP':_0xd531('0x64')};var _0x362492=function(_0x191c64){return!_[_0xd531('0x65')]([_0xd531('0x88'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xd531('0x67')],_0x191c64);};var _0x311d5e=function(_0x1aecfc){if(!_0x1aecfc||!_0x1aecfc[_0xd531('0x68')][_0xd531('0x38')]){return'';}for(var _0x5f23be='(',_0x3450d7=0x0;_0x3450d7<_0x1aecfc['rules']['length'];_0x3450d7+=0x1){_0x3450d7>0x0&&(_0x5f23be+='\x20'+_0x1aecfc[_0xd531('0x89')]+'\x20');_0x5f23be+=_0x1aecfc[_0xd531('0x68')][_0x3450d7][_0xd531('0x69')]?_0x311d5e(_0x1aecfc[_0xd531('0x68')][_0x3450d7][_0xd531('0x69')]):_0x1aecfc['rules'][_0x3450d7][_0xd531('0x6a')]+'\x20'+_0x1aecfc[_0xd531('0x68')][_0x3450d7][_0xd531('0x6b')]+(_0x362492(_0x1aecfc['rules'][_0x3450d7]['condition'])?'\x20'+_0x1aecfc['rules'][_0x3450d7]['value']:'');}return _0x5f23be+')';};var _0x21b6ea={'where':{'id':_0x450100['id']}},_0x5f0880,_0x503e92,_0x1b0b32,_0x210c3c,_0x1abb74;_0x21b6ea=_[_0xd531('0x3f')]({},_0x21b6ea,_0x20060b);return db[_0xd531('0x2d')]['find'](_0x21b6ea)[_0xd531('0x24')](function(_0x4a55a6){if(_0x4a55a6){_0x5f0880=_0x4a55a6;return _0x4a55a6[_0xd531('0x8a')]();}return null;})['then'](function(_0x3d1ed9){if(_0x3d1ed9){if(!_0x3d1ed9[_0xd531('0x38')]){throw new db[(_0xd531('0x8b'))][(_0xd531('0x6d'))](_0xd531('0x6e'),0x193);}_0x503e92=_0x3d1ed9;return db[_0xd531('0x6f')][_0xd531('0x45')]({'raw':!![]});}return null;})[_0xd531('0x24')](function(_0xb6cabf){if(_0xb6cabf){_0x1b0b32=_[_0xd531('0x70')](_0xb6cabf,'id');var _0x38e755;var _0x3826d5=squel[_0xd531('0x8c')]();_0x3826d5[_0xd531('0x71')](_0x5f0880[_0xd531('0x72')]);for(var _0xf5c49a=0x0;_0xf5c49a<_0x503e92[_0xd531('0x38')];_0xf5c49a+=0x1){_0x38e755=_0x503e92[_0xf5c49a][_0xd531('0x73')]?_0x1b0b32[_0x503e92[_0xf5c49a][_0xd531('0x73')]]['metric']:_0x503e92[_0xf5c49a][_0xd531('0x6a')];_0x38e755=_0x503e92[_0xf5c49a][_0xd531('0x75')]?_[_0xd531('0x76')](_0xa8d8ba[_0x503e92[_0xf5c49a][_0xd531('0x75')]],'%s',_0x38e755):_0x38e755;_0x38e755=_0x503e92[_0xf5c49a][_0xd531('0x77')]?_['replace'](_0x11f027[_0x503e92[_0xf5c49a]['format']],'%s',_0x38e755):_0x38e755;if(_0x503e92[_0xf5c49a]['groupBy']){_0x3826d5[_0xd531('0x69')](_0x38e755);}_0x503e92[_0xf5c49a]['orderBy']&&_0x3826d5[_0xd531('0x7a')](_0x38e755,_0x503e92[_0xf5c49a]['orderBy']===_0xd531('0x7b')?![]:!![]);_0x3826d5[_0xd531('0x6a')](_0x38e755,_0x503e92[_0xf5c49a][_0xd531('0x8d')]||_0x38e755);}if(_0x5f0880[_0xd531('0x7c')]){_0x5f0880[_0xd531('0x7c')]=JSON[_0xd531('0x81')](_0x5f0880[_0xd531('0x7c')]);for(var _0x4bf17a=0x0;_0x4bf17a<_0x5f0880[_0xd531('0x7c')][_0xd531('0x38')];_0x4bf17a+=0x1){if(_0x5f0880['joins'][_0x4bf17a]['type']&&_[_0xd531('0x65')](_0x4e6caa,_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x40')])&&_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x7e')]&&_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x7d')]&&_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x7f')]){_0x3826d5[_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x40')]](_0x5f0880['joins'][_0x4bf17a][_0xd531('0x7d')],null,util[_0xd531('0x77')](_0xd531('0x8e'),_0x5f0880[_0xd531('0x72')],_0x5f0880['joins'][_0x4bf17a][_0xd531('0x7e')],_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x7d')],_0x5f0880[_0xd531('0x7c')][_0x4bf17a][_0xd531('0x7f')]));}}}if(_0x5f0880[_0xd531('0x80')]){_0x5f0880['conditions']=JSON[_0xd531('0x81')](_0x5f0880[_0xd531('0x80')]);_0x3826d5[_0xd531('0x3c')](_0x311d5e(_0x5f0880[_0xd531('0x80')][_0xd531('0x69')]));}_0x1abb74=_0x3826d5['clone']();_0x3826d5[_0xd531('0x20')](_0x390f60);_0x3826d5[_0xd531('0x1f')](0x0);logger[_0xd531('0x83')](_0xd531('0x84'),_0x3826d5[_0xd531('0x86')]());return db[_0xd531('0x85')][_0xd531('0x32')](_0x3826d5[_0xd531('0x86')](),{'type':db[_0xd531('0x85')][_0xd531('0x8f')][_0xd531('0x87')]});}})[_0xd531('0x24')](function(_0x70fe06){if(!_0x70fe06[_0xd531('0x38')]){throw new db[(_0xd531('0x8b'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x1a76d8['output']===_0xd531('0x90')){return null;}var _0x41710b=_[_0xd531('0x3f')](_0x1a76d8,{'name':_0x1a76d8[_0xd531('0x91')]||_0x1a76d8[_0xd531('0x29')]||_0x5f0880[_0xd531('0x29')],'basename':_0x9a33cd,'savename':util['format'](_0xd531('0x92'),_0x1a76d8[_0xd531('0x29')]||_0x5f0880[_0xd531('0x29')],require(_0xd531('0x93'))[_0xd531('0x94')](0x4),_0x1a76d8[_0xd531('0x95')]||'csv'),'reportId':_0x5f0880['id'],'reportType':'custom'});return db[_0xd531('0x96')]['create'](_0x41710b,{'raw':!![]});})[_0xd531('0x24')](function(_0x38f4cc){if(_0x5f0880[_0xd531('0x72')]==='cdr'){_0x1abb74[_0xd531('0x3c')](_0x5f0880[_0xd531('0x72')]+_0xd531('0x97'),_0x1a76d8[_0xd531('0x98')],_0x1a76d8[_0xd531('0x99')]);}else{_0x1abb74[_0xd531('0x3c')](_0x5f0880[_0xd531('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a76d8[_0xd531('0x98')],_0x1a76d8[_0xd531('0x99')]);}if(_0x38f4cc){logger[_0xd531('0x9a')]('Run\x20Query:',_0x1abb74[_0xd531('0x86')]());require(_0xd531('0x9b'))[_0xd531('0x9c')](path[_0xd531('0x54')](__dirname,_0xd531('0x9d'),_0x38f4cc[_0xd531('0x95')]),[_0x38f4cc['id'],_0x1abb74[_0xd531('0x86')](),path[_0xd531('0x54')](__dirname,_0xd531('0x9e'),_0x38f4cc[_0xd531('0x9f')]),_0x9a33cd]);return _0x38f4cc;}else{var _0x792fc=squel['select']();_0x792fc['from']('('+_0x1abb74['toString']()+')',_0xd531('0xa0'));_0x792fc[_0xd531('0x6a')](_0xd531('0xa1'),_0xd531('0x42'));_0x1abb74[_0xd531('0x20')](_0x1a76d8[_0xd531('0x20')]||_0x390f60);_0x1abb74[_0xd531('0x1f')](_0x1a76d8['offset']||0x0);return dbH[_0xd531('0x85')][_0xd531('0x32')](_0x792fc[_0xd531('0x86')](),{'type':dbH[_0xd531('0x85')][_0xd531('0x8f')][_0xd531('0x87')]})[_0xd531('0x24')](function(_0x501124){if(!_0x501124['length']){_0x210c3c=0x0;}else{_0x210c3c=_0x501124[0x0][_0xd531('0x42')]||0x0;}return dbH[_0xd531('0x85')][_0xd531('0x32')](_0x1abb74[_0xd531('0x86')](),{'type':dbH[_0xd531('0x85')]['QueryTypes'][_0xd531('0x87')]});})[_0xd531('0x24')](function(_0x45bdb9){return{'rows':_0x45bdb9||[],'count':_0x210c3c};});}});}exports['run']=function(_0x3aad8f,_0x30a8db){return runReport(_0x3aad8f[_0xd531('0x52')],_0x3aad8f['query'],_0x3aad8f[_0xd531('0x41')])[_0xd531('0x24')](respondWithResult(_0x30a8db,null))[_0xd531('0x47')](handleError(_0x30a8db,null));};exports['runReport']=runReport;exports[_0xd531('0x32')]=function(_0x2196fc,_0x3be835){var _0x71e1fb=0xa;var _0x28d569=['join',_0xd531('0x55'),_0xd531('0x56'),_0xd531('0x57')];var _0x2285f3={'SUM':'SUM(%s)','COUNT':_0xd531('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd531('0x5b'),'MIN':_0xd531('0x5c'),'AVG':_0xd531('0x5d'),'GROUP_CONCAT':_0xd531('0xa2'),'GROUP_CONCAT ASC':_0xd531('0x5e'),'GROUP_CONCAT DESC':_0xd531('0x5f')};var _0x5a47fc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x16611a=function(_0x31cdc4){return!_['includes']([_0xd531('0x88'),'IS\x20NOT\x20NULL',_0xd531('0xa3'),_0xd531('0x67')],_0x31cdc4);};var _0x281955=function(_0x1c425e){if(!_0x1c425e||!_0x1c425e['rules']['length']){return'';}for(var _0x292c2b='(',_0x1edfa0=0x0;_0x1edfa0<_0x1c425e[_0xd531('0x68')][_0xd531('0x38')];_0x1edfa0+=0x1){_0x1edfa0>0x0&&(_0x292c2b+='\x20'+_0x1c425e[_0xd531('0x89')]+'\x20');_0x292c2b+=_0x1c425e[_0xd531('0x68')][_0x1edfa0][_0xd531('0x69')]?_0x281955(_0x1c425e[_0xd531('0x68')][_0x1edfa0][_0xd531('0x69')]):_0x1c425e[_0xd531('0x68')][_0x1edfa0][_0xd531('0x6a')]+'\x20'+_0x1c425e[_0xd531('0x68')][_0x1edfa0][_0xd531('0x6b')]+(_0x16611a(_0x1c425e['rules'][_0x1edfa0][_0xd531('0x6b')])?'\x20'+_0x1c425e[_0xd531('0x68')][_0x1edfa0][_0xd531('0x6c')]:'');}return _0x292c2b+')';};var _0x32ef8b={'where':{'id':_0x2196fc['params']['id']}},_0x48ad17,_0xe89e62,_0x2027ed,_0x4d5737,_0x444c81;_0x32ef8b=_[_0xd531('0x3f')]({},_0x32ef8b,_0x2196fc['options']);return db[_0xd531('0x2d')]['find'](_0x32ef8b)['then'](function(_0x3958f1){if(_0x3958f1){_0x48ad17=_0x3958f1;return _0x3958f1['getFields']();}return null;})[_0xd531('0x24')](function(_0x5afbf4){if(_0x5afbf4){if(!_0x5afbf4[_0xd531('0x38')]){throw new db[(_0xd531('0x8b'))][(_0xd531('0x6d'))](_0xd531('0x6e'),0x193);}_0xe89e62=_0x5afbf4;return db[_0xd531('0x6f')][_0xd531('0x45')]({'raw':!![]});}return null;})[_0xd531('0x24')](function(_0x19c756){if(_0x19c756){_0x2027ed=_[_0xd531('0x70')](_0x19c756,'id');var _0x392edc;var _0x271987=squel[_0xd531('0x8c')]();_0x271987[_0xd531('0x71')](_0x48ad17[_0xd531('0x72')]);for(var _0x13b34a=0x0;_0x13b34a<_0xe89e62[_0xd531('0x38')];_0x13b34a+=0x1){_0x392edc=_0xe89e62[_0x13b34a][_0xd531('0x73')]?_0x2027ed[_0xe89e62[_0x13b34a][_0xd531('0x73')]][_0xd531('0x74')]:_0xe89e62[_0x13b34a]['field'];_0x392edc=_0xe89e62[_0x13b34a]['function']?_[_0xd531('0x76')](_0x2285f3[_0xe89e62[_0x13b34a]['function']],'%s',_0x392edc):_0x392edc;_0x392edc=_0xe89e62[_0x13b34a]['format']?_[_0xd531('0x76')](_0x5a47fc[_0xe89e62[_0x13b34a][_0xd531('0x77')]],'%s',_0x392edc):_0x392edc;if(_0xe89e62[_0x13b34a][_0xd531('0x78')]){_0x271987['group'](_0x392edc);}_0xe89e62[_0x13b34a]['orderBy']&&_0x271987['order'](_0x392edc,_0xe89e62[_0x13b34a][_0xd531('0x79')]===_0xd531('0x7b')?![]:!![]);_0x271987[_0xd531('0x6a')](_0x392edc,_0xe89e62[_0x13b34a][_0xd531('0x8d')]||_0x392edc);}if(_0x48ad17['joins']){_0x48ad17[_0xd531('0x7c')]=JSON[_0xd531('0x81')](_0x48ad17[_0xd531('0x7c')]);for(var _0x44af85=0x0;_0x44af85<_0x48ad17[_0xd531('0x7c')][_0xd531('0x38')];_0x44af85+=0x1){if(_0x48ad17[_0xd531('0x7c')][_0x44af85][_0xd531('0x40')]&&_['includes'](_0x28d569,_0x48ad17[_0xd531('0x7c')][_0x44af85][_0xd531('0x40')])&&_0x48ad17['joins'][_0x44af85][_0xd531('0x7e')]&&_0x48ad17[_0xd531('0x7c')][_0x44af85][_0xd531('0x7d')]&&_0x48ad17['joins'][_0x44af85]['foreignKey']){_0x271987[_0x48ad17['joins'][_0x44af85][_0xd531('0x40')]](_0x48ad17[_0xd531('0x7c')][_0x44af85][_0xd531('0x7d')],null,util[_0xd531('0x77')](_0xd531('0x8e'),_0x48ad17['table'],_0x48ad17[_0xd531('0x7c')][_0x44af85][_0xd531('0x7e')],_0x48ad17[_0xd531('0x7c')][_0x44af85]['foreignTable'],_0x48ad17['joins'][_0x44af85][_0xd531('0x7f')]));}}}if(_0x48ad17['conditions']){_0x48ad17[_0xd531('0x80')]=JSON[_0xd531('0x81')](_0x48ad17[_0xd531('0x80')]);_0x271987[_0xd531('0x3c')](_0x281955(_0x48ad17[_0xd531('0x80')][_0xd531('0x69')]));}_0x444c81=_0x271987[_0xd531('0x82')]();_0x271987[_0xd531('0x20')](_0x71e1fb);_0x271987['offset'](0x0);logger[_0xd531('0x83')]('Limited\x20Query:',_0x271987[_0xd531('0x86')]());return db[_0xd531('0x85')][_0xd531('0x32')](_0x271987[_0xd531('0x86')](),{'type':db[_0xd531('0x85')][_0xd531('0x8f')][_0xd531('0x87')]});}})['then'](function(){return{'sql':_0x444c81[_0xd531('0x86')]()};})['then'](respondWithResult(_0x3be835,null))[_0xd531('0x47')](handleError(_0x3be835,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 378897d..f33e46f 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 _0x0427=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x0427,0x173));var _0x7042=function(_0x3c6c53,_0x177746){_0x3c6c53=_0x3c6c53-0x0;var _0x55e70d=_0x0427[_0x3c6c53];return _0x55e70d;};'use strict';var _=require(_0x7042('0x0'));var util=require(_0x7042('0x1'));var logger=require('../../config/logger')(_0x7042('0x2'));var moment=require(_0x7042('0x3'));var BPromise=require(_0x7042('0x4'));var rp=require(_0x7042('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7042('0x6'));var config=require(_0x7042('0x7'));var attributes=require(_0x7042('0x8'));module[_0x7042('0x9')]=function(_0x430ccd,_0xa68e28){return _0x430ccd[_0x7042('0xa')](_0x7042('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd415=['./analyticCustomReport.attributes','exports','define','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x499bd9,_0x51a209){var _0x5eb275=function(_0x4ce722){while(--_0x4ce722){_0x499bd9['push'](_0x499bd9['shift']());}};_0x5eb275(++_0x51a209);}(_0xd415,0x99));var _0x5d41=function(_0x44512b,_0x199f03){_0x44512b=_0x44512b-0x0;var _0x30e108=_0xd415[_0x44512b];return _0x30e108;};'use strict';var _=require(_0x5d41('0x0'));var util=require(_0x5d41('0x1'));var logger=require(_0x5d41('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d41('0x3'));var fs=require('fs');var path=require(_0x5d41('0x4'));var rimraf=require(_0x5d41('0x5'));var config=require(_0x5d41('0x6'));var attributes=require(_0x5d41('0x7'));module[_0x5d41('0x8')]=function(_0x482cb0,_0x39da73){return _0x482cb0[_0x5d41('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index c814be5..8025481 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 _0x1d6e=['AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x22431e,_0x5af0a3){var _0xd978e9=function(_0x2bbdd7){while(--_0x2bbdd7){_0x22431e['push'](_0x22431e['shift']());}};_0xd978e9(++_0x5af0a3);}(_0x1d6e,0x119));var _0xe1d6=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x1d6e[_0x350258];return _0x3714b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1d6('0x0'));var BPromise=require(_0xe1d6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1d6('0x2'));var db=require(_0xe1d6('0x3'))['db'];var utils=require(_0xe1d6('0x4'));var logger=require(_0xe1d6('0x5'))(_0xe1d6('0x6'));var config=require(_0xe1d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1d6('0x8')][_0xe1d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d94bd,_0x1f0fc9,_0x5ce873){return new BPromise(function(_0x308479,_0x487c42){return client[_0xe1d6('0xa')](_0x4d94bd,_0x5ce873)[_0xe1d6('0xb')](function(_0x2580a4){logger[_0xe1d6('0xc')](_0xe1d6('0xd'),_0x1f0fc9,'request\x20sent');logger[_0xe1d6('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1f0fc9,_0xe1d6('0xf'),JSON['stringify'](_0x2580a4));if(_0x2580a4[_0xe1d6('0x10')]){if(_0x2580a4['error'][_0xe1d6('0x11')]===0x1f4){logger['error'](_0xe1d6('0xd'),_0x1f0fc9,_0x2580a4[_0xe1d6('0x10')][_0xe1d6('0x12')]);return _0x487c42(_0x2580a4[_0xe1d6('0x10')][_0xe1d6('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1f0fc9,_0x2580a4[_0xe1d6('0x10')][_0xe1d6('0x12')]);return _0x308479(_0x2580a4[_0xe1d6('0x10')]['message']);}else{logger[_0xe1d6('0xc')](_0xe1d6('0xd'),_0x1f0fc9,'request\x20sent');_0x308479(_0x2580a4[_0xe1d6('0x13')][_0xe1d6('0x12')]);}})[_0xe1d6('0x14')](function(_0x230b69){logger['error'](_0xe1d6('0xd'),_0x1f0fc9,_0x230b69);_0x487c42(_0x230b69);});});} \ No newline at end of file +var _0x735d=['rpc','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','../../mysqldb'];(function(_0x40e677,_0x4c7219){var _0xdb0adb=function(_0x2b6ea3){while(--_0x2b6ea3){_0x40e677['push'](_0x40e677['shift']());}};_0xdb0adb(++_0x4c7219);}(_0x735d,0x10a));var _0xd735=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x735d[_0x13e300];return _0x5a3eea;};'use strict';var _=require('lodash');var util=require(_0xd735('0x0'));var moment=require(_0xd735('0x1'));var BPromise=require('bluebird');var rs=require(_0xd735('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd735('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd735('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd735('0x5')][_0xd735('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x134a05,_0x5c677e,_0x41a305){return new BPromise(function(_0x145ba9,_0x530f9e){return client[_0xd735('0x7')](_0x134a05,_0x41a305)[_0xd735('0x8')](function(_0x4b45b6){logger[_0xd735('0x9')](_0xd735('0xa'),_0x5c677e,_0xd735('0xb'));logger['debug'](_0xd735('0xc'),_0x5c677e,_0xd735('0xb'),JSON['stringify'](_0x4b45b6));if(_0x4b45b6['error']){if(_0x4b45b6[_0xd735('0xd')][_0xd735('0xe')]===0x1f4){logger[_0xd735('0xd')](_0xd735('0xa'),_0x5c677e,_0x4b45b6[_0xd735('0xd')][_0xd735('0xf')]);return _0x530f9e(_0x4b45b6[_0xd735('0xd')][_0xd735('0xf')]);}logger[_0xd735('0xd')](_0xd735('0xa'),_0x5c677e,_0x4b45b6['error'][_0xd735('0xf')]);return _0x145ba9(_0x4b45b6['error']['message']);}else{logger[_0xd735('0x9')](_0xd735('0xa'),_0x5c677e,_0xd735('0xb'));_0x145ba9(_0x4b45b6[_0xd735('0x10')][_0xd735('0xf')]);}})[_0xd735('0x11')](function(_0x1bcac2){logger[_0xd735('0xd')](_0xd735('0xa'),_0x5c677e,_0x1bcac2);_0x530f9e(_0x1bcac2);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 84d3740..bec52ed 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 _0x7dc6=['query','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','/:id/run','run','/:id/query'];(function(_0x13dc08,_0x88de66){var _0x217ef4=function(_0x4b5eae){while(--_0x4b5eae){_0x13dc08['push'](_0x13dc08['shift']());}};_0x217ef4(++_0x88de66);}(_0x7dc6,0xc8));var _0x67dc=function(_0x147eec,_0x556ea9){_0x147eec=_0x147eec-0x0;var _0x4abdd1=_0x7dc6[_0x147eec];return _0x4abdd1;};'use strict';var multer=require('multer');var util=require(_0x67dc('0x0'));var path=require(_0x67dc('0x1'));var timeout=require(_0x67dc('0x2'));var express=require(_0x67dc('0x3'));var router=express[_0x67dc('0x4')]();var auth=require(_0x67dc('0x5'));var interaction=require(_0x67dc('0x6'));var config=require(_0x67dc('0x7'));var controller=require(_0x67dc('0x8'));router[_0x67dc('0x9')]('/',auth[_0x67dc('0xa')](),controller[_0x67dc('0xb')]);router[_0x67dc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x67dc('0x9')](_0x67dc('0xc'),auth[_0x67dc('0xa')](),controller['preview']);router[_0x67dc('0x9')](_0x67dc('0xd'),auth['isAuthenticated'](),controller[_0x67dc('0xe')]);router[_0x67dc('0x9')](_0x67dc('0xf'),auth[_0x67dc('0xa')](),controller[_0x67dc('0x10')]);router[_0x67dc('0x11')]('/',auth[_0x67dc('0xa')](),controller[_0x67dc('0x12')]);router[_0x67dc('0x13')]('/:id',auth[_0x67dc('0xa')](),controller[_0x67dc('0x14')]);router[_0x67dc('0x15')](_0x67dc('0x16'),auth[_0x67dc('0xa')](),controller['destroy']);module[_0x67dc('0x17')]=router; \ No newline at end of file +var _0x90fb=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','show','/:id/preview','isAuthenticated','preview','/:id/run','run','post','put','delete','/:id','exports','multer'];(function(_0x1f2bac,_0x27660a){var _0x284bee=function(_0x3487a5){while(--_0x3487a5){_0x1f2bac['push'](_0x1f2bac['shift']());}};_0x284bee(++_0x27660a);}(_0x90fb,0x142));var _0xb90f=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x90fb[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xb90f('0x0'));var util=require('util');var path=require(_0xb90f('0x1'));var timeout=require(_0xb90f('0x2'));var express=require('express');var router=express[_0xb90f('0x3')]();var auth=require(_0xb90f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb90f('0x5'));var controller=require(_0xb90f('0x6'));router[_0xb90f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb90f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb90f('0x8')]);router[_0xb90f('0x7')](_0xb90f('0x9'),auth[_0xb90f('0xa')](),controller[_0xb90f('0xb')]);router[_0xb90f('0x7')](_0xb90f('0xc'),auth[_0xb90f('0xa')](),controller[_0xb90f('0xd')]);router['get']('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0xb90f('0xe')]('/',auth[_0xb90f('0xa')](),controller['create']);router[_0xb90f('0xf')]('/:id',auth[_0xb90f('0xa')](),controller['update']);router[_0xb90f('0x10')](_0xb90f('0x11'),auth[_0xb90f('0xa')](),controller['destroy']);module[_0xb90f('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e998da1..11daef0 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 _0xe2eb=['exports','STRING','TEXT'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xe2eb,0xb4));var _0xbe2e=function(_0x41e497,_0x20599f){_0x41e497=_0x41e497-0x0;var _0x37c780=_0xe2eb[_0x41e497];return _0x37c780;};'use strict';var Sequelize=require('sequelize');module[_0xbe2e('0x0')]={'name':{'type':Sequelize[_0xbe2e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbe2e('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xbe2e('0x1')]},'conditions':{'type':Sequelize[_0xbe2e('0x2')]},'joins':{'type':Sequelize[_0xbe2e('0x2')]}}; \ No newline at end of file +var _0x8f21=['TEXT','sequelize','exports','STRING'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x8f21,0x81));var _0x18f2=function(_0x44b476,_0x1de037){_0x44b476=_0x44b476-0x0;var _0x1d5e2d=_0x8f21[_0x44b476];return _0x1d5e2d;};'use strict';var Sequelize=require(_0x18f2('0x0'));module[_0x18f2('0x1')]={'name':{'type':Sequelize[_0x18f2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x18f2('0x2')]},'conditions':{'type':Sequelize[_0x18f2('0x3')]},'joins':{'type':Sequelize[_0x18f2('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c6d57e8..f15f20c 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 _0x4202=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','AnalyticDefaultReport','includeAll','include','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','left_join','cross_join','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','runReport','IS\x20NULL','value','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json'];(function(_0x3202a1,_0x109353){var _0x232d64=function(_0x3c19e3){while(--_0x3c19e3){_0x3202a1['push'](_0x3202a1['shift']());}};_0x232d64(++_0x109353);}(_0x4202,0x8c));var _0x2420=function(_0x4cc21a,_0x3677fe){_0x4cc21a=_0x4cc21a-0x0;var _0x426d76=_0x4202[_0x4cc21a];return _0x426d76;};'use strict';var pdf=require(_0x2420('0x0'));var emlformat=require(_0x2420('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2420('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2420('0x3'));var moment=require(_0x2420('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2420('0x5'));var util=require(_0x2420('0x6'));var path=require('path');var sox=require(_0x2420('0x7'));var csv=require(_0x2420('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2420('0x9'));var squel=require(_0x2420('0xa'));var crypto=require(_0x2420('0xb'));var jsforce=require(_0x2420('0xc'));var deskjs=require(_0x2420('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2420('0xe'));var Papa=require(_0x2420('0xf'));var Redis=require(_0x2420('0x10'));var authService=require(_0x2420('0x11'));var qs=require(_0x2420('0x12'));var as=require(_0x2420('0x13'));var hardwareService=require(_0x2420('0x14'));var logger=require(_0x2420('0x15'))(_0x2420('0x16'));var utils=require('../../config/utils');var config=require(_0x2420('0x17'));var licenseUtil=require(_0x2420('0x18'));var db=require(_0x2420('0x19'))['db'];var dbH=require(_0x2420('0x19'))[_0x2420('0x1a')];function respondWithStatusCode(_0x38de02,_0x5d1938){_0x5d1938=_0x5d1938||0xcc;return function(_0x4e2924){if(_0x4e2924){return _0x38de02[_0x2420('0x1b')](_0x5d1938);}return _0x38de02[_0x2420('0x1c')](_0x5d1938)[_0x2420('0x1d')]();};}function respondWithResult(_0x5520f4,_0xeb2b8b){_0xeb2b8b=_0xeb2b8b||0xc8;return function(_0x202ce1){if(_0x202ce1){return _0x5520f4[_0x2420('0x1c')](_0xeb2b8b)[_0x2420('0x1e')](_0x202ce1);}};}function respondWithFilteredResult(_0x5b1e6a,_0x8c8939){return function(_0x4ed11d){if(_0x4ed11d){var _0x38f11c=_0x4ed11d[_0x2420('0x1f')],_0x27d8c9=_0x8c8939[_0x2420('0x20')],_0x4458c9=_0x8c8939[_0x2420('0x20')]+_0x8c8939[_0x2420('0x21')],_0x29db2e;if(_0x4458c9>=_0x38f11c){_0x4458c9=_0x38f11c;_0x29db2e=0xc8;}else{_0x29db2e=0xce;}_0x5b1e6a[_0x2420('0x1c')](_0x29db2e);return _0x5b1e6a[_0x2420('0x22')](_0x2420('0x23'),_0x27d8c9+'-'+_0x4458c9+'/'+_0x38f11c)[_0x2420('0x1e')](_0x4ed11d);}return null;};}function patchUpdates(_0x24f9ec){return function(_0x4dabbf){try{jsonpatch[_0x2420('0x24')](_0x4dabbf,_0x24f9ec,!![]);}catch(_0x18755a){return BPromise[_0x2420('0x25')](_0x18755a);}return _0x4dabbf[_0x2420('0x26')]();};}function saveUpdates(_0x400a42,_0x4741cc){return function(_0x40ea01){if(_0x40ea01){return _0x40ea01[_0x2420('0x27')](_0x400a42)[_0x2420('0x28')](function(_0x566b7f){return _0x566b7f;});}return null;};}function removeEntity(_0x3b2d39,_0x201809){return function(_0x4bd93a){if(_0x4bd93a){return _0x4bd93a[_0x2420('0x29')]()[_0x2420('0x28')](function(){var _0x389d01=_0x4bd93a[_0x2420('0x2a')]({'plain':!![]});var _0xab2167='DefaultReports';return db['UserProfileResource']['destroy']({'where':{'type':_0xab2167,'resourceId':_0x389d01['id']}})[_0x2420('0x28')](function(){return _0x4bd93a;});})['then'](function(){_0x3b2d39[_0x2420('0x1c')](0xcc)[_0x2420('0x1d')]();});}};}function handleEntityNotFound(_0x5eeace,_0x49f845){return function(_0x43c335){if(!_0x43c335){_0x5eeace['sendStatus'](0x194);}return _0x43c335;};}function handleError(_0x5232dd,_0x5d0a5f){_0x5d0a5f=_0x5d0a5f||0x1f4;return function(_0x9f6548){logger[_0x2420('0x2b')](_0x9f6548[_0x2420('0x2c')]);if(_0x9f6548[_0x2420('0x2d')]){delete _0x9f6548[_0x2420('0x2d')];}_0x5232dd[_0x2420('0x1c')](_0x5d0a5f)[_0x2420('0x2e')](_0x9f6548);};}exports[_0x2420('0x2f')]=function(_0x594e1a,_0x2773e1){var _0x4cc105={},_0x532f9c={},_0xfd5289={'count':0x0,'rows':[]};var _0x952e5c=_[_0x2420('0x30')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x2b1a35){return{'name':_0x2b1a35[_0x2420('0x31')],'type':_0x2b1a35['type'][_0x2420('0x32')]};});_0x532f9c['model']=_[_0x2420('0x30')](_0x952e5c,'name');_0x532f9c['query']=_[_0x2420('0x33')](_0x594e1a[_0x2420('0x34')]);_0x532f9c[_0x2420('0x35')]=_['intersection'](_0x532f9c['model'],_0x532f9c[_0x2420('0x34')]);_0x4cc105[_0x2420('0x36')]=_[_0x2420('0x37')](_0x532f9c[_0x2420('0x38')],qs[_0x2420('0x39')](_0x594e1a['query'][_0x2420('0x39')]));_0x4cc105[_0x2420('0x36')]=_0x4cc105[_0x2420('0x36')][_0x2420('0x3a')]?_0x4cc105[_0x2420('0x36')]:_0x532f9c[_0x2420('0x38')];if(!_0x594e1a[_0x2420('0x34')]['hasOwnProperty'](_0x2420('0x3b'))){_0x4cc105[_0x2420('0x21')]=qs['limit'](_0x594e1a[_0x2420('0x34')][_0x2420('0x21')]);_0x4cc105[_0x2420('0x20')]=qs[_0x2420('0x20')](_0x594e1a[_0x2420('0x34')][_0x2420('0x20')]);}_0x4cc105[_0x2420('0x3c')]=qs[_0x2420('0x3d')](_0x594e1a[_0x2420('0x34')][_0x2420('0x3d')]);_0x4cc105[_0x2420('0x3e')]=qs['filters'](_[_0x2420('0x3f')](_0x594e1a[_0x2420('0x34')],_0x532f9c[_0x2420('0x35')]),_0x952e5c);if(_0x594e1a[_0x2420('0x34')][_0x2420('0x40')]){_0x4cc105[_0x2420('0x3e')]=_['merge'](_0x4cc105[_0x2420('0x3e')],{'$or':_[_0x2420('0x30')](_0x952e5c,function(_0x3d73c7){if(_0x3d73c7[_0x2420('0x41')]!=='VIRTUAL'){var _0x5d8911={};_0x5d8911[_0x3d73c7[_0x2420('0x2d')]]={'$like':'%'+_0x594e1a['query']['filter']+'%'};return _0x5d8911;}})});}_0x4cc105=_[_0x2420('0x42')]({},_0x4cc105,_0x594e1a[_0x2420('0x43')]);var _0x33c7cf={'where':_0x4cc105[_0x2420('0x3e')]};return db[_0x2420('0x44')]['count'](_0x33c7cf)[_0x2420('0x28')](function(_0x2b5da6){_0xfd5289[_0x2420('0x1f')]=_0x2b5da6;if(_0x594e1a[_0x2420('0x34')][_0x2420('0x45')]){_0x4cc105[_0x2420('0x46')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x4cc105);})['then'](function(_0x4747c2){_0xfd5289['rows']=_0x4747c2;return _0xfd5289;})[_0x2420('0x28')](respondWithFilteredResult(_0x2773e1,_0x4cc105))[_0x2420('0x47')](handleError(_0x2773e1,null));};exports[_0x2420('0x48')]=function(_0x14065d,_0x4fad55){var _0xf49d1b={'raw':!![],'where':{'id':_0x14065d[_0x2420('0x49')]['id']}},_0x21641a={};_0x21641a[_0x2420('0x38')]=_[_0x2420('0x33')](db[_0x2420('0x44')][_0x2420('0x4a')]);_0x21641a[_0x2420('0x34')]=_['keys'](_0x14065d['query']);_0x21641a[_0x2420('0x35')]=_['intersection'](_0x21641a[_0x2420('0x38')],_0x21641a[_0x2420('0x34')]);_0xf49d1b[_0x2420('0x36')]=_[_0x2420('0x37')](_0x21641a[_0x2420('0x38')],qs[_0x2420('0x39')](_0x14065d[_0x2420('0x34')][_0x2420('0x39')]));_0xf49d1b['attributes']=_0xf49d1b[_0x2420('0x36')]['length']?_0xf49d1b[_0x2420('0x36')]:_0x21641a[_0x2420('0x38')];if(_0x14065d['query'][_0x2420('0x45')]){_0xf49d1b[_0x2420('0x46')]=[{'all':!![]}];}_0xf49d1b=_[_0x2420('0x42')]({},_0xf49d1b,_0x14065d[_0x2420('0x43')]);return db[_0x2420('0x44')][_0x2420('0x4b')](_0xf49d1b)[_0x2420('0x28')](handleEntityNotFound(_0x4fad55,null))['then'](respondWithResult(_0x4fad55,null))[_0x2420('0x47')](handleError(_0x4fad55,null));};exports[_0x2420('0x4c')]=function(_0x430776,_0x46d3ce){return db['AnalyticDefaultReport']['create'](_0x430776['body'],{})['then'](function(_0x1c9a13){var _0xebbd18=_0x430776[_0x2420('0x4d')][_0x2420('0x2a')]({'plain':!![]});if(!_0xebbd18)throw new Error(_0x2420('0x4e'));if(_0xebbd18[_0x2420('0x4f')]==='user'){var _0x1591e0=_0x1c9a13[_0x2420('0x2a')]({'plain':!![]});var _0x1bc4cd=_0x2420('0x50');return db[_0x2420('0x51')]['find']({'where':{'name':_0x1bc4cd,'userProfileId':_0xebbd18[_0x2420('0x52')]},'raw':!![]})[_0x2420('0x28')](function(_0x15bf5a){if(_0x15bf5a&&_0x15bf5a['autoAssociation']===0x0){return db[_0x2420('0x53')][_0x2420('0x4c')]({'name':_0x1591e0[_0x2420('0x2d')],'resourceId':_0x1591e0['id'],'type':'DefaultReports','sectionId':_0x15bf5a['id']},{})[_0x2420('0x28')](function(){return _0x1c9a13;});}else{return _0x1c9a13;}})['catch'](function(_0x207c82){logger['error'](_0x2420('0x54'),_0x207c82);throw _0x207c82;});}return _0x1c9a13;})[_0x2420('0x28')](respondWithResult(_0x46d3ce,0xc9))[_0x2420('0x47')](handleError(_0x46d3ce,null));};exports[_0x2420('0x27')]=function(_0x1946db,_0x4e9ecc){if(_0x1946db['body']['id']){delete _0x1946db[_0x2420('0x55')]['id'];}return db['AnalyticDefaultReport'][_0x2420('0x4b')]({'where':{'id':_0x1946db['params']['id']}})[_0x2420('0x28')](handleEntityNotFound(_0x4e9ecc,null))[_0x2420('0x28')](saveUpdates(_0x1946db[_0x2420('0x55')],null))[_0x2420('0x28')](respondWithResult(_0x4e9ecc,null))['catch'](handleError(_0x4e9ecc,null));};exports['destroy']=function(_0x6a8e79,_0x230e78){return db['AnalyticDefaultReport'][_0x2420('0x4b')]({'where':{'id':_0x6a8e79[_0x2420('0x49')]['id']}})[_0x2420('0x28')](handleEntityNotFound(_0x230e78,null))['then'](removeEntity(_0x230e78,null))[_0x2420('0x47')](handleError(_0x230e78,null));};exports[_0x2420('0x56')]=function(_0x506fef,_0x12fad7){var _0x3daabb=0xa;var _0xa34c0=['join','left_join',_0x2420('0x57'),'cross_join'];var _0x1701fe={'SUM':_0x2420('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2420('0x59'),'MAX':'MAX(%s)','MIN':_0x2420('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2420('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2420('0x5c')};var _0x4bbb39={'SEC_TO_TIME':_0x2420('0x5d'),'DATE':_0x2420('0x5e'),'HOUR':_0x2420('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x355795=function(_0x1ed01f){return!_[_0x2420('0x60')](['IS\x20NULL',_0x2420('0x61'),_0x2420('0x62'),_0x2420('0x63')],_0x1ed01f);};var _0x4a25a0=function(_0x11a585){if(!_0x11a585||!_0x11a585[_0x2420('0x64')][_0x2420('0x3a')]){return'';}for(var _0x2290f3='(',_0x3318f2=0x0;_0x3318f2<_0x11a585[_0x2420('0x64')][_0x2420('0x3a')];_0x3318f2+=0x1){_0x3318f2>0x0&&(_0x2290f3+='\x20'+_0x11a585[_0x2420('0x65')]+'\x20');_0x2290f3+=_0x11a585[_0x2420('0x64')][_0x3318f2][_0x2420('0x66')]?_0x4a25a0(_0x11a585[_0x2420('0x64')][_0x3318f2][_0x2420('0x66')]):_0x11a585['rules'][_0x3318f2][_0x2420('0x67')]+'\x20'+_0x11a585[_0x2420('0x64')][_0x3318f2][_0x2420('0x68')]+(_0x355795(_0x11a585[_0x2420('0x64')][_0x3318f2]['condition'])?'\x20'+_0x11a585[_0x2420('0x64')][_0x3318f2]['value']:'');}return _0x2290f3+')';};var _0x34fd15={'where':{'id':_0x506fef[_0x2420('0x49')]['id']}},_0x35e768,_0x3e8aad,_0x55177a,_0x56d6b9,_0xd28c58;_0x34fd15=_['merge']({},_0x34fd15,_0x506fef[_0x2420('0x43')]);return db[_0x2420('0x44')][_0x2420('0x4b')](_0x34fd15)[_0x2420('0x28')](function(_0x29779f){if(_0x29779f){_0x35e768=_0x29779f;return _0x29779f[_0x2420('0x69')]();}return null;})['then'](function(_0x35ecbb){if(_0x35ecbb){if(!_0x35ecbb['length']){throw new db[(_0x2420('0x6a'))][(_0x2420('0x6b'))](_0x2420('0x6c'),0x193);}_0x3e8aad=_0x35ecbb;return db[_0x2420('0x6d')][_0x2420('0x6e')]({'raw':!![]});}return null;})['then'](function(_0x5c1aff){if(_0x5c1aff){_0x55177a=_[_0x2420('0x6f')](_0x5c1aff,'id');var _0x7f90b0;var _0x31a5c7=squel[_0x2420('0x70')]();_0x31a5c7[_0x2420('0x71')](_0x35e768[_0x2420('0x72')]);for(var _0x1bf03a=0x0;_0x1bf03a<_0x3e8aad[_0x2420('0x3a')];_0x1bf03a+=0x1){_0x7f90b0=_0x3e8aad[_0x1bf03a][_0x2420('0x73')]?_0x55177a[_0x3e8aad[_0x1bf03a]['MetricId']][_0x2420('0x74')]:_0x3e8aad[_0x1bf03a][_0x2420('0x67')];_0x7f90b0=_0x3e8aad[_0x1bf03a][_0x2420('0x75')]?_[_0x2420('0x76')](_0x1701fe[_0x3e8aad[_0x1bf03a]['function']],'%s',_0x7f90b0):_0x7f90b0;_0x7f90b0=_0x3e8aad[_0x1bf03a][_0x2420('0x77')]?_['replace'](_0x4bbb39[_0x3e8aad[_0x1bf03a][_0x2420('0x77')]],'%s',_0x7f90b0):_0x7f90b0;if(_0x3e8aad[_0x1bf03a][_0x2420('0x78')]){_0x31a5c7[_0x2420('0x66')](_0x7f90b0);}_0x3e8aad[_0x1bf03a][_0x2420('0x79')]&&_0x31a5c7[_0x2420('0x3c')](_0x7f90b0,_0x3e8aad[_0x1bf03a][_0x2420('0x79')]===_0x2420('0x7a')?![]:!![]);_0x31a5c7[_0x2420('0x67')](_0x7f90b0,_0x3e8aad[_0x1bf03a][_0x2420('0x7b')]||_0x7f90b0);}if(_0x35e768[_0x2420('0x7c')]){_0x35e768[_0x2420('0x7c')]=JSON['parse'](_0x35e768['joins']);for(var _0x212361=0x0;_0x212361<_0x35e768[_0x2420('0x7c')][_0x2420('0x3a')];_0x212361+=0x1){if(_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x41')]&&_[_0x2420('0x60')](_0xa34c0,_0x35e768[_0x2420('0x7c')][_0x212361]['type'])&&_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x7d')]&&_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x7e')]&&_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x7f')]){_0x31a5c7[_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x41')]](_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x7e')],null,util['format'](_0x2420('0x80'),_0x35e768[_0x2420('0x72')],_0x35e768['joins'][_0x212361][_0x2420('0x7d')],_0x35e768[_0x2420('0x7c')][_0x212361][_0x2420('0x7e')],_0x35e768['joins'][_0x212361][_0x2420('0x7f')]));}}}if(_0x35e768[_0x2420('0x81')]){_0x35e768[_0x2420('0x81')]=JSON[_0x2420('0x82')](_0x35e768[_0x2420('0x81')]);_0x31a5c7[_0x2420('0x3e')](_0x4a25a0(_0x35e768[_0x2420('0x81')][_0x2420('0x66')]));}_0xd28c58=_0x31a5c7[_0x2420('0x83')]();_0x31a5c7['limit'](_0x3daabb);_0x31a5c7[_0x2420('0x20')](0x0);logger[_0x2420('0x84')](_0x2420('0x85'),_0x31a5c7[_0x2420('0x86')]());return db[_0x2420('0x87')][_0x2420('0x34')](_0x31a5c7[_0x2420('0x86')](),{'type':db[_0x2420('0x87')][_0x2420('0x88')]['SELECT']});}})[_0x2420('0x28')](respondWithResult(_0x12fad7,null))[_0x2420('0x47')](handleError(_0x12fad7,null));};function runReport(_0x348fe1,_0x163cb4,_0x465445){var _0x255677=_0x163cb4[_0x2420('0x2d')];var _0x59f7ca=0xa;var _0x5b74e4=[_0x2420('0x89'),_0x2420('0x8a'),_0x2420('0x57'),_0x2420('0x8b')];var _0x1c1ec2={'SUM':'SUM(%s)','COUNT':_0x2420('0x8c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2420('0x8d'),'MIN':'MIN(%s)','AVG':_0x2420('0x8e'),'GROUP_CONCAT':_0x2420('0x5b'),'GROUP_CONCAT ASC':_0x2420('0x8f'),'GROUP_CONCAT DESC':_0x2420('0x5c')};var _0x2444d1={'SEC_TO_TIME':_0x2420('0x5d'),'DATE':_0x2420('0x5e'),'HOUR':_0x2420('0x5f'),'ROUND':_0x2420('0x90'),'UNIX_TIMESTAMP':_0x2420('0x91')};var _0x564a25=function(_0x4a3909){return!_['includes'](['IS\x20NULL',_0x2420('0x61'),_0x2420('0x62'),_0x2420('0x63')],_0x4a3909);};var _0x45ba4c=function(_0x8ce15d){if(!_0x8ce15d||!_0x8ce15d[_0x2420('0x64')][_0x2420('0x3a')]){return'';}for(var _0x7afba9='(',_0x51ff25=0x0;_0x51ff25<_0x8ce15d[_0x2420('0x64')]['length'];_0x51ff25+=0x1){_0x51ff25>0x0&&(_0x7afba9+='\x20'+_0x8ce15d[_0x2420('0x65')]+'\x20');_0x7afba9+=_0x8ce15d['rules'][_0x51ff25]['group']?_0x45ba4c(_0x8ce15d[_0x2420('0x64')][_0x51ff25][_0x2420('0x66')]):_0x8ce15d[_0x2420('0x64')][_0x51ff25]['field']+'\x20'+_0x8ce15d[_0x2420('0x64')][_0x51ff25][_0x2420('0x68')]+(_0x564a25(_0x8ce15d[_0x2420('0x64')][_0x51ff25][_0x2420('0x68')])?'\x20'+_0x8ce15d[_0x2420('0x64')][_0x51ff25]['value']:'');}return _0x7afba9+')';};var _0x35f6aa={'where':{'id':_0x348fe1['id']}},_0xbf08e8,_0x3a970b,_0x4dfc2b,_0x295f66,_0x441ed3;_0x35f6aa=_[_0x2420('0x42')]({},_0x35f6aa,_0x465445);return db[_0x2420('0x44')][_0x2420('0x4b')](_0x35f6aa)['then'](function(_0x59f4b9){if(_0x59f4b9){_0xbf08e8=_0x59f4b9;return _0x59f4b9['getFields']();}return null;})[_0x2420('0x28')](function(_0x1a05c6){if(_0x1a05c6){if(!_0x1a05c6['length']){throw new db[(_0x2420('0x6a'))][(_0x2420('0x6b'))](_0x2420('0x6c'),0x193);}_0x3a970b=_0x1a05c6;return db[_0x2420('0x6d')][_0x2420('0x6e')]({'raw':!![]});}return null;})[_0x2420('0x28')](function(_0x2d58bc){if(_0x2d58bc){_0x4dfc2b=_['keyBy'](_0x2d58bc,'id');var _0x1304d2;var _0x1631d3=squel['select']();_0x1631d3[_0x2420('0x71')](_0xbf08e8[_0x2420('0x72')]);for(var _0x11f762=0x0;_0x11f762<_0x3a970b[_0x2420('0x3a')];_0x11f762+=0x1){_0x1304d2=_0x3a970b[_0x11f762][_0x2420('0x73')]?_0x4dfc2b[_0x3a970b[_0x11f762][_0x2420('0x73')]][_0x2420('0x74')]:_0x3a970b[_0x11f762][_0x2420('0x67')];_0x1304d2=_0x3a970b[_0x11f762][_0x2420('0x75')]?_['replace'](_0x1c1ec2[_0x3a970b[_0x11f762][_0x2420('0x75')]],'%s',_0x1304d2):_0x1304d2;_0x1304d2=_0x3a970b[_0x11f762]['format']?_[_0x2420('0x76')](_0x2444d1[_0x3a970b[_0x11f762][_0x2420('0x77')]],'%s',_0x1304d2):_0x1304d2;if(_0x3a970b[_0x11f762][_0x2420('0x78')]){_0x1631d3[_0x2420('0x66')](_0x1304d2);}_0x3a970b[_0x11f762][_0x2420('0x79')]&&_0x1631d3[_0x2420('0x3c')](_0x1304d2,_0x3a970b[_0x11f762][_0x2420('0x79')]===_0x2420('0x7a')?![]:!![]);_0x1631d3[_0x2420('0x67')](_0x1304d2,_0x3a970b[_0x11f762][_0x2420('0x7b')]||_0x1304d2);}if(_0xbf08e8[_0x2420('0x7c')]){_0xbf08e8[_0x2420('0x7c')]=JSON[_0x2420('0x82')](_0xbf08e8[_0x2420('0x7c')]);for(var _0xb0db2f=0x0;_0xb0db2f<_0xbf08e8[_0x2420('0x7c')][_0x2420('0x3a')];_0xb0db2f+=0x1){if(_0xbf08e8[_0x2420('0x7c')][_0xb0db2f][_0x2420('0x41')]&&_[_0x2420('0x60')](_0x5b74e4,_0xbf08e8[_0x2420('0x7c')][_0xb0db2f]['type'])&&_0xbf08e8[_0x2420('0x7c')][_0xb0db2f][_0x2420('0x7d')]&&_0xbf08e8[_0x2420('0x7c')][_0xb0db2f][_0x2420('0x7e')]&&_0xbf08e8['joins'][_0xb0db2f]['foreignKey']){_0x1631d3[_0xbf08e8[_0x2420('0x7c')][_0xb0db2f][_0x2420('0x41')]](_0xbf08e8[_0x2420('0x7c')][_0xb0db2f]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0xbf08e8[_0x2420('0x72')],_0xbf08e8['joins'][_0xb0db2f][_0x2420('0x7d')],_0xbf08e8[_0x2420('0x7c')][_0xb0db2f][_0x2420('0x7e')],_0xbf08e8[_0x2420('0x7c')][_0xb0db2f][_0x2420('0x7f')]));}}}if(_0xbf08e8[_0x2420('0x81')]){_0xbf08e8[_0x2420('0x81')]=JSON[_0x2420('0x82')](_0xbf08e8[_0x2420('0x81')]);_0x1631d3[_0x2420('0x3e')](_0x45ba4c(_0xbf08e8[_0x2420('0x81')][_0x2420('0x66')]));}_0x441ed3=_0x1631d3[_0x2420('0x83')]();_0x1631d3[_0x2420('0x21')](_0x59f7ca);_0x1631d3[_0x2420('0x20')](0x0);logger['debug'](_0x2420('0x85'),_0x1631d3[_0x2420('0x86')]());return db[_0x2420('0x87')][_0x2420('0x34')](_0x1631d3['toString'](),{'type':db['sequelize']['QueryTypes'][_0x2420('0x92')]});}})['then'](function(_0x407beb){if(!_0x407beb[_0x2420('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0x2420('0x93'),0xcc);}if(_0x163cb4[_0x2420('0x94')]===_0x2420('0x95')){return null;}var _0x393487=_[_0x2420('0x42')](_0x163cb4,{'name':_0x163cb4[_0x2420('0x96')]||_0x163cb4[_0x2420('0x2d')]||_0xbf08e8[_0x2420('0x2d')],'basename':_0x255677,'savename':util[_0x2420('0x77')](_0x2420('0x97'),_0x163cb4['name']||_0xbf08e8[_0x2420('0x2d')],require(_0x2420('0x98'))[_0x2420('0x99')](0x4),_0x163cb4['output']||_0x2420('0x9a')),'reportId':_0xbf08e8['id'],'reportType':_0x2420('0x9b')});return db[_0x2420('0x9c')][_0x2420('0x4c')](_0x393487,{'raw':!![]});})[_0x2420('0x28')](function(_0xbecbb9){if(_0xbf08e8[_0x2420('0x72')]===_0x2420('0x9d')){_0x441ed3[_0x2420('0x3e')](_0xbf08e8['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x163cb4[_0x2420('0x9e')],_0x163cb4[_0x2420('0x9f')]);}else{_0x441ed3['where'](_0xbf08e8[_0x2420('0x72')]+_0x2420('0xa0'),_0x163cb4[_0x2420('0x9e')],_0x163cb4['endDate']);}if(_0xbecbb9){logger['info'](_0x2420('0xa1'),_0x441ed3[_0x2420('0x86')]());require(_0x2420('0xa2'))[_0x2420('0xa3')](path['join'](__dirname,_0x2420('0xa4'),_0xbecbb9['output']),[_0xbecbb9['id'],_0x441ed3[_0x2420('0x86')](),path['join'](__dirname,'../../files/reports',_0xbecbb9['savename']),_0x255677]);return _0xbecbb9;}else{var _0x2598cf=squel[_0x2420('0x70')]();_0x2598cf['from']('('+_0x441ed3[_0x2420('0x86')]()+')',_0x2420('0xa5'));_0x2598cf[_0x2420('0x67')](_0x2420('0xa6'),_0x2420('0x1f'));_0x441ed3[_0x2420('0x21')](_0x163cb4[_0x2420('0x21')]||_0x59f7ca);_0x441ed3['offset'](_0x163cb4[_0x2420('0x20')]||0x0);return dbH[_0x2420('0x87')]['query'](_0x2598cf[_0x2420('0x86')](),{'type':dbH[_0x2420('0x87')][_0x2420('0x88')]['SELECT']})['then'](function(_0x16ee63){if(!_0x16ee63[_0x2420('0x3a')]){_0x295f66=0x0;}else{_0x295f66=_0x16ee63[0x0][_0x2420('0x1f')]||0x0;}return dbH[_0x2420('0x87')][_0x2420('0x34')](_0x441ed3['toString'](),{'type':dbH['sequelize'][_0x2420('0x88')][_0x2420('0x92')]});})[_0x2420('0x28')](function(_0x3b8636){return{'rows':_0x3b8636||[],'count':_0x295f66};});}});}exports[_0x2420('0xa7')]=function(_0x25b23f,_0x24a28a){return runReport(_0x25b23f[_0x2420('0x49')],_0x25b23f[_0x2420('0x34')],_0x25b23f[_0x2420('0x43')])['then'](respondWithResult(_0x24a28a,null))[_0x2420('0x47')](handleError(_0x24a28a,null));};exports[_0x2420('0xa8')]=runReport;exports[_0x2420('0x34')]=function(_0x20de25,_0x50d44b){var _0x1f3cf3=0xa;var _0x2b97bf=[_0x2420('0x89'),'left_join',_0x2420('0x57'),_0x2420('0x8b')];var _0x31765f={'SUM':_0x2420('0x58'),'COUNT':_0x2420('0x8c'),'COUNT DISTINCT':_0x2420('0x59'),'MAX':_0x2420('0x8d'),'MIN':_0x2420('0x5a'),'AVG':_0x2420('0x8e'),'GROUP_CONCAT':_0x2420('0x5b'),'GROUP_CONCAT ASC':_0x2420('0x8f'),'GROUP_CONCAT DESC':_0x2420('0x5c')};var _0x25c94b={'SEC_TO_TIME':_0x2420('0x5d'),'DATE':_0x2420('0x5e'),'HOUR':_0x2420('0x5f'),'ROUND':_0x2420('0x90'),'UNIX_TIMESTAMP':_0x2420('0x91')};var _0x32fe3b=function(_0x5d1611){return!_[_0x2420('0x60')]([_0x2420('0xa9'),_0x2420('0x61'),_0x2420('0x62'),_0x2420('0x63')],_0x5d1611);};var _0x3477f0=function(_0x1550f6){if(!_0x1550f6||!_0x1550f6[_0x2420('0x64')][_0x2420('0x3a')]){return'';}for(var _0x125206='(',_0x37fc69=0x0;_0x37fc69<_0x1550f6[_0x2420('0x64')][_0x2420('0x3a')];_0x37fc69+=0x1){_0x37fc69>0x0&&(_0x125206+='\x20'+_0x1550f6[_0x2420('0x65')]+'\x20');_0x125206+=_0x1550f6[_0x2420('0x64')][_0x37fc69]['group']?_0x3477f0(_0x1550f6[_0x2420('0x64')][_0x37fc69][_0x2420('0x66')]):_0x1550f6[_0x2420('0x64')][_0x37fc69][_0x2420('0x67')]+'\x20'+_0x1550f6[_0x2420('0x64')][_0x37fc69][_0x2420('0x68')]+(_0x32fe3b(_0x1550f6[_0x2420('0x64')][_0x37fc69][_0x2420('0x68')])?'\x20'+_0x1550f6[_0x2420('0x64')][_0x37fc69][_0x2420('0xaa')]:'');}return _0x125206+')';};var _0xbb9642={'where':{'id':_0x20de25[_0x2420('0x49')]['id']}},_0x4ae840,_0x2ccf40,_0x54a9b2,_0x5215b4,_0x361f24;_0xbb9642=_[_0x2420('0x42')]({},_0xbb9642,_0x20de25[_0x2420('0x43')]);return db[_0x2420('0x44')][_0x2420('0x4b')](_0xbb9642)[_0x2420('0x28')](function(_0x53eb42){if(_0x53eb42){_0x4ae840=_0x53eb42;return _0x53eb42['getFields']();}return null;})[_0x2420('0x28')](function(_0x27efb0){if(_0x27efb0){if(!_0x27efb0['length']){throw new db[(_0x2420('0x6a'))]['ValidationErrorItem'](_0x2420('0x6c'),0x193);}_0x2ccf40=_0x27efb0;return db[_0x2420('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2420('0x28')](function(_0x3971c5){if(_0x3971c5){_0x54a9b2=_[_0x2420('0x6f')](_0x3971c5,'id');var _0x1110cc;var _0x26489c=squel[_0x2420('0x70')]();_0x26489c[_0x2420('0x71')](_0x4ae840[_0x2420('0x72')]);for(var _0x518584=0x0;_0x518584<_0x2ccf40[_0x2420('0x3a')];_0x518584+=0x1){_0x1110cc=_0x2ccf40[_0x518584][_0x2420('0x73')]?_0x54a9b2[_0x2ccf40[_0x518584][_0x2420('0x73')]]['metric']:_0x2ccf40[_0x518584][_0x2420('0x67')];_0x1110cc=_0x2ccf40[_0x518584][_0x2420('0x75')]?_[_0x2420('0x76')](_0x31765f[_0x2ccf40[_0x518584][_0x2420('0x75')]],'%s',_0x1110cc):_0x1110cc;_0x1110cc=_0x2ccf40[_0x518584]['format']?_[_0x2420('0x76')](_0x25c94b[_0x2ccf40[_0x518584][_0x2420('0x77')]],'%s',_0x1110cc):_0x1110cc;if(_0x2ccf40[_0x518584][_0x2420('0x78')]){_0x26489c[_0x2420('0x66')](_0x1110cc);}_0x2ccf40[_0x518584][_0x2420('0x79')]&&_0x26489c['order'](_0x1110cc,_0x2ccf40[_0x518584][_0x2420('0x79')]===_0x2420('0x7a')?![]:!![]);_0x26489c[_0x2420('0x67')](_0x1110cc,_0x2ccf40[_0x518584][_0x2420('0x7b')]||_0x1110cc);}if(_0x4ae840[_0x2420('0x7c')]){_0x4ae840[_0x2420('0x7c')]=JSON['parse'](_0x4ae840[_0x2420('0x7c')]);for(var _0x530b80=0x0;_0x530b80<_0x4ae840[_0x2420('0x7c')][_0x2420('0x3a')];_0x530b80+=0x1){if(_0x4ae840['joins'][_0x530b80][_0x2420('0x41')]&&_[_0x2420('0x60')](_0x2b97bf,_0x4ae840['joins'][_0x530b80][_0x2420('0x41')])&&_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x7d')]&&_0x4ae840[_0x2420('0x7c')][_0x530b80]['foreignTable']&&_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x7f')]){_0x26489c[_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x41')]](_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x7e')],null,util[_0x2420('0x77')](_0x2420('0x80'),_0x4ae840[_0x2420('0x72')],_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x7d')],_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x7e')],_0x4ae840[_0x2420('0x7c')][_0x530b80][_0x2420('0x7f')]));}}}if(_0x4ae840[_0x2420('0x81')]){_0x4ae840[_0x2420('0x81')]=JSON[_0x2420('0x82')](_0x4ae840[_0x2420('0x81')]);_0x26489c[_0x2420('0x3e')](_0x3477f0(_0x4ae840[_0x2420('0x81')][_0x2420('0x66')]));}_0x361f24=_0x26489c[_0x2420('0x83')]();_0x26489c[_0x2420('0x21')](_0x1f3cf3);_0x26489c[_0x2420('0x20')](0x0);logger[_0x2420('0x84')](_0x2420('0x85'),_0x26489c[_0x2420('0x86')]());return db[_0x2420('0x87')][_0x2420('0x34')](_0x26489c[_0x2420('0x86')](),{'type':db['sequelize'][_0x2420('0x88')]['SELECT']});}})[_0x2420('0x28')](function(){return{'sql':_0x361f24['toString']()};})['then'](respondWithResult(_0x50d44b,null))[_0x2420('0x47')](handleError(_0x50d44b,null));}; \ No newline at end of file +var _0xac0d=['conditions','parse','clone','debug','toString','sequelize','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','value','ValidationErrorItem','keyBy','MetricId','function','Limited\x20Query:','SELECT','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','default','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','MAX(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticDefaultReport','includeAll','rows','catch','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','metric','field','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xac0d,0x181));var _0xdac0=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xac0d[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0xdac0('0x0'));var emlformat=require(_0xdac0('0x1'));var rimraf=require(_0xdac0('0x2'));var zipdir=require(_0xdac0('0x3'));var jsonpatch=require(_0xdac0('0x4'));var rp=require(_0xdac0('0x5'));var moment=require(_0xdac0('0x6'));var BPromise=require(_0xdac0('0x7'));var Mustache=require(_0xdac0('0x8'));var util=require(_0xdac0('0x9'));var path=require(_0xdac0('0xa'));var sox=require(_0xdac0('0xb'));var csv=require(_0xdac0('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdac0('0xd'));var squel=require('squel');var crypto=require(_0xdac0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac0('0xf'));var toCsv=require(_0xdac0('0xc'));var querystring=require(_0xdac0('0x10'));var Papa=require(_0xdac0('0x11'));var Redis=require(_0xdac0('0x12'));var authService=require(_0xdac0('0x13'));var qs=require(_0xdac0('0x14'));var as=require(_0xdac0('0x15'));var hardwareService=require(_0xdac0('0x16'));var logger=require(_0xdac0('0x17'))(_0xdac0('0x18'));var utils=require('../../config/utils');var config=require(_0xdac0('0x19'));var licenseUtil=require(_0xdac0('0x1a'));var db=require(_0xdac0('0x1b'))['db'];var dbH=require(_0xdac0('0x1b'))[_0xdac0('0x1c')];function respondWithStatusCode(_0x5bd953,_0x2f79df){_0x2f79df=_0x2f79df||0xcc;return function(_0x46aa85){if(_0x46aa85){return _0x5bd953[_0xdac0('0x1d')](_0x2f79df);}return _0x5bd953[_0xdac0('0x1e')](_0x2f79df)[_0xdac0('0x1f')]();};}function respondWithResult(_0x130dc6,_0x2063bd){_0x2063bd=_0x2063bd||0xc8;return function(_0x3eb832){if(_0x3eb832){return _0x130dc6[_0xdac0('0x1e')](_0x2063bd)[_0xdac0('0x20')](_0x3eb832);}};}function respondWithFilteredResult(_0x23a996,_0x17fec7){return function(_0x21513c){if(_0x21513c){var _0x5c2a4d=_0x21513c[_0xdac0('0x21')],_0x48e8cc=_0x17fec7['offset'],_0x59bbaf=_0x17fec7[_0xdac0('0x22')]+_0x17fec7[_0xdac0('0x23')],_0x4ed96b;if(_0x59bbaf>=_0x5c2a4d){_0x59bbaf=_0x5c2a4d;_0x4ed96b=0xc8;}else{_0x4ed96b=0xce;}_0x23a996['status'](_0x4ed96b);return _0x23a996[_0xdac0('0x24')](_0xdac0('0x25'),_0x48e8cc+'-'+_0x59bbaf+'/'+_0x5c2a4d)['json'](_0x21513c);}return null;};}function patchUpdates(_0x2e5d52){return function(_0x13b0e9){try{jsonpatch['apply'](_0x13b0e9,_0x2e5d52,!![]);}catch(_0x179f4c){return BPromise[_0xdac0('0x26')](_0x179f4c);}return _0x13b0e9[_0xdac0('0x27')]();};}function saveUpdates(_0x3438de,_0x255982){return function(_0x25f581){if(_0x25f581){return _0x25f581[_0xdac0('0x28')](_0x3438de)[_0xdac0('0x29')](function(_0x1b6abc){return _0x1b6abc;});}return null;};}function removeEntity(_0x383f0d,_0x4eb2ce){return function(_0x5a5a72){if(_0x5a5a72){return _0x5a5a72[_0xdac0('0x2a')]()['then'](function(){var _0x22e1b4=_0x5a5a72[_0xdac0('0x2b')]({'plain':!![]});var _0xe5950e=_0xdac0('0x2c');return db['UserProfileResource'][_0xdac0('0x2a')]({'where':{'type':_0xe5950e,'resourceId':_0x22e1b4['id']}})['then'](function(){return _0x5a5a72;});})[_0xdac0('0x29')](function(){_0x383f0d[_0xdac0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a98ba,_0x56136b){return function(_0x11ad42){if(!_0x11ad42){_0x5a98ba[_0xdac0('0x1d')](0x194);}return _0x11ad42;};}function handleError(_0x3facae,_0x3fb0db){_0x3fb0db=_0x3fb0db||0x1f4;return function(_0x247e74){logger[_0xdac0('0x2d')](_0x247e74[_0xdac0('0x2e')]);if(_0x247e74['name']){delete _0x247e74[_0xdac0('0x2f')];}_0x3facae[_0xdac0('0x1e')](_0x3fb0db)['send'](_0x247e74);};}exports[_0xdac0('0x30')]=function(_0x1c6de3,_0x312c4e){var _0x1d57d7={},_0xf0c54b={},_0xae2f5d={'count':0x0,'rows':[]};var _0x536ee9=_[_0xdac0('0x31')](db['AnalyticDefaultReport'][_0xdac0('0x32')],function(_0x3c19a6){return{'name':_0x3c19a6[_0xdac0('0x33')],'type':_0x3c19a6[_0xdac0('0x34')][_0xdac0('0x35')]};});_0xf0c54b[_0xdac0('0x36')]=_[_0xdac0('0x31')](_0x536ee9,_0xdac0('0x2f'));_0xf0c54b[_0xdac0('0x37')]=_['keys'](_0x1c6de3['query']);_0xf0c54b[_0xdac0('0x38')]=_[_0xdac0('0x39')](_0xf0c54b[_0xdac0('0x36')],_0xf0c54b[_0xdac0('0x37')]);_0x1d57d7[_0xdac0('0x3a')]=_['intersection'](_0xf0c54b[_0xdac0('0x36')],qs['fields'](_0x1c6de3[_0xdac0('0x37')][_0xdac0('0x3b')]));_0x1d57d7['attributes']=_0x1d57d7['attributes'][_0xdac0('0x3c')]?_0x1d57d7['attributes']:_0xf0c54b[_0xdac0('0x36')];if(!_0x1c6de3[_0xdac0('0x37')]['hasOwnProperty'](_0xdac0('0x3d'))){_0x1d57d7[_0xdac0('0x23')]=qs[_0xdac0('0x23')](_0x1c6de3[_0xdac0('0x37')]['limit']);_0x1d57d7['offset']=qs['offset'](_0x1c6de3[_0xdac0('0x37')][_0xdac0('0x22')]);}_0x1d57d7[_0xdac0('0x3e')]=qs['sort'](_0x1c6de3[_0xdac0('0x37')][_0xdac0('0x3f')]);_0x1d57d7[_0xdac0('0x40')]=qs['filters'](_[_0xdac0('0x41')](_0x1c6de3['query'],_0xf0c54b[_0xdac0('0x38')]),_0x536ee9);if(_0x1c6de3[_0xdac0('0x37')]['filter']){_0x1d57d7['where']=_[_0xdac0('0x42')](_0x1d57d7['where'],{'$or':_['map'](_0x536ee9,function(_0x21f3bb){if(_0x21f3bb[_0xdac0('0x34')]!==_0xdac0('0x43')){var _0x4e47cb={};_0x4e47cb[_0x21f3bb[_0xdac0('0x2f')]]={'$like':'%'+_0x1c6de3['query'][_0xdac0('0x44')]+'%'};return _0x4e47cb;}})});}_0x1d57d7=_[_0xdac0('0x42')]({},_0x1d57d7,_0x1c6de3[_0xdac0('0x45')]);var _0x132ead={'where':_0x1d57d7[_0xdac0('0x40')]};return db[_0xdac0('0x46')][_0xdac0('0x21')](_0x132ead)[_0xdac0('0x29')](function(_0x1dcf3b){_0xae2f5d[_0xdac0('0x21')]=_0x1dcf3b;if(_0x1c6de3[_0xdac0('0x37')][_0xdac0('0x47')]){_0x1d57d7['include']=[{'all':!![]}];}return db[_0xdac0('0x46')]['findAll'](_0x1d57d7);})['then'](function(_0x143f8b){_0xae2f5d[_0xdac0('0x48')]=_0x143f8b;return _0xae2f5d;})[_0xdac0('0x29')](respondWithFilteredResult(_0x312c4e,_0x1d57d7))[_0xdac0('0x49')](handleError(_0x312c4e,null));};exports[_0xdac0('0x4a')]=function(_0x176ffd,_0x28f1af){var _0x5202d8={'raw':!![],'where':{'id':_0x176ffd[_0xdac0('0x4b')]['id']}},_0x43853d={};_0x43853d['model']=_['keys'](db[_0xdac0('0x46')]['rawAttributes']);_0x43853d['query']=_[_0xdac0('0x4c')](_0x176ffd[_0xdac0('0x37')]);_0x43853d[_0xdac0('0x38')]=_['intersection'](_0x43853d[_0xdac0('0x36')],_0x43853d[_0xdac0('0x37')]);_0x5202d8['attributes']=_[_0xdac0('0x39')](_0x43853d[_0xdac0('0x36')],qs[_0xdac0('0x3b')](_0x176ffd[_0xdac0('0x37')][_0xdac0('0x3b')]));_0x5202d8[_0xdac0('0x3a')]=_0x5202d8['attributes']['length']?_0x5202d8[_0xdac0('0x3a')]:_0x43853d[_0xdac0('0x36')];if(_0x176ffd[_0xdac0('0x37')][_0xdac0('0x47')]){_0x5202d8[_0xdac0('0x4d')]=[{'all':!![]}];}_0x5202d8=_[_0xdac0('0x42')]({},_0x5202d8,_0x176ffd[_0xdac0('0x45')]);return db[_0xdac0('0x46')][_0xdac0('0x4e')](_0x5202d8)[_0xdac0('0x29')](handleEntityNotFound(_0x28f1af,null))[_0xdac0('0x29')](respondWithResult(_0x28f1af,null))[_0xdac0('0x49')](handleError(_0x28f1af,null));};exports[_0xdac0('0x4f')]=function(_0xf72557,_0x45e874){return db[_0xdac0('0x46')]['create'](_0xf72557[_0xdac0('0x50')],{})[_0xdac0('0x29')](function(_0x4a28bd){var _0xacacf9=_0xf72557['user'][_0xdac0('0x2b')]({'plain':!![]});if(!_0xacacf9)throw new Error(_0xdac0('0x51'));if(_0xacacf9['role']===_0xdac0('0x52')){var _0x3be4f3=_0x4a28bd[_0xdac0('0x2b')]({'plain':!![]});var _0x1aaa94='Reports';return db['UserProfileSection'][_0xdac0('0x4e')]({'where':{'name':_0x1aaa94,'userProfileId':_0xacacf9[_0xdac0('0x53')]},'raw':!![]})['then'](function(_0x1592a5){if(_0x1592a5&&_0x1592a5['autoAssociation']===0x0){return db[_0xdac0('0x54')][_0xdac0('0x4f')]({'name':_0x3be4f3[_0xdac0('0x2f')],'resourceId':_0x3be4f3['id'],'type':_0xdac0('0x2c'),'sectionId':_0x1592a5['id']},{})['then'](function(){return _0x4a28bd;});}else{return _0x4a28bd;}})['catch'](function(_0x33873a){logger['error'](_0xdac0('0x55'),_0x33873a);throw _0x33873a;});}return _0x4a28bd;})[_0xdac0('0x29')](respondWithResult(_0x45e874,0xc9))['catch'](handleError(_0x45e874,null));};exports['update']=function(_0x29540a,_0x48da28){if(_0x29540a[_0xdac0('0x50')]['id']){delete _0x29540a[_0xdac0('0x50')]['id'];}return db[_0xdac0('0x46')][_0xdac0('0x4e')]({'where':{'id':_0x29540a[_0xdac0('0x4b')]['id']}})[_0xdac0('0x29')](handleEntityNotFound(_0x48da28,null))[_0xdac0('0x29')](saveUpdates(_0x29540a[_0xdac0('0x50')],null))[_0xdac0('0x29')](respondWithResult(_0x48da28,null))[_0xdac0('0x49')](handleError(_0x48da28,null));};exports[_0xdac0('0x2a')]=function(_0x3d2b0e,_0x4ffd6c){return db[_0xdac0('0x46')]['find']({'where':{'id':_0x3d2b0e[_0xdac0('0x4b')]['id']}})[_0xdac0('0x29')](handleEntityNotFound(_0x4ffd6c,null))[_0xdac0('0x29')](removeEntity(_0x4ffd6c,null))['catch'](handleError(_0x4ffd6c,null));};exports[_0xdac0('0x56')]=function(_0x3a5655,_0x84e6f6){var _0x4fe6b3=0xa;var _0x17f5b0=[_0xdac0('0x57'),_0xdac0('0x58'),'right_join',_0xdac0('0x59')];var _0x4b1459={'SUM':_0xdac0('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xdac0('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xdac0('0x5c'),'GROUP_CONCAT ASC':_0xdac0('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5aae35={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdac0('0x5e'),'HOUR':_0xdac0('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42c981=function(_0x31d34e){return!_[_0xdac0('0x60')]([_0xdac0('0x61'),'IS\x20NOT\x20NULL',_0xdac0('0x62'),_0xdac0('0x63')],_0x31d34e);};var _0x45b38e=function(_0x137bc8){if(!_0x137bc8||!_0x137bc8[_0xdac0('0x64')][_0xdac0('0x3c')]){return'';}for(var _0x56354a='(',_0x18cd09=0x0;_0x18cd09<_0x137bc8[_0xdac0('0x64')][_0xdac0('0x3c')];_0x18cd09+=0x1){_0x18cd09>0x0&&(_0x56354a+='\x20'+_0x137bc8[_0xdac0('0x65')]+'\x20');_0x56354a+=_0x137bc8[_0xdac0('0x64')][_0x18cd09][_0xdac0('0x66')]?_0x45b38e(_0x137bc8[_0xdac0('0x64')][_0x18cd09]['group']):_0x137bc8[_0xdac0('0x64')][_0x18cd09]['field']+'\x20'+_0x137bc8['rules'][_0x18cd09][_0xdac0('0x67')]+(_0x42c981(_0x137bc8['rules'][_0x18cd09][_0xdac0('0x67')])?'\x20'+_0x137bc8[_0xdac0('0x64')][_0x18cd09]['value']:'');}return _0x56354a+')';};var _0x51ea41={'where':{'id':_0x3a5655[_0xdac0('0x4b')]['id']}},_0x39131d,_0x5375d5,_0x55ac14,_0x33cc95,_0x1ce937;_0x51ea41=_[_0xdac0('0x42')]({},_0x51ea41,_0x3a5655[_0xdac0('0x45')]);return db[_0xdac0('0x46')][_0xdac0('0x4e')](_0x51ea41)[_0xdac0('0x29')](function(_0x874234){if(_0x874234){_0x39131d=_0x874234;return _0x874234[_0xdac0('0x68')]();}return null;})[_0xdac0('0x29')](function(_0x306aba){if(_0x306aba){if(!_0x306aba[_0xdac0('0x3c')]){throw new db[(_0xdac0('0x69'))]['ValidationErrorItem'](_0xdac0('0x6a'),0x193);}_0x5375d5=_0x306aba;return db[_0xdac0('0x6b')][_0xdac0('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x21b41a){if(_0x21b41a){_0x55ac14=_['keyBy'](_0x21b41a,'id');var _0x358c34;var _0x5a75d1=squel[_0xdac0('0x6d')]();_0x5a75d1[_0xdac0('0x6e')](_0x39131d['table']);for(var _0x489ea4=0x0;_0x489ea4<_0x5375d5[_0xdac0('0x3c')];_0x489ea4+=0x1){_0x358c34=_0x5375d5[_0x489ea4]['MetricId']?_0x55ac14[_0x5375d5[_0x489ea4]['MetricId']][_0xdac0('0x6f')]:_0x5375d5[_0x489ea4][_0xdac0('0x70')];_0x358c34=_0x5375d5[_0x489ea4]['function']?_[_0xdac0('0x71')](_0x4b1459[_0x5375d5[_0x489ea4]['function']],'%s',_0x358c34):_0x358c34;_0x358c34=_0x5375d5[_0x489ea4][_0xdac0('0x72')]?_[_0xdac0('0x71')](_0x5aae35[_0x5375d5[_0x489ea4]['format']],'%s',_0x358c34):_0x358c34;if(_0x5375d5[_0x489ea4][_0xdac0('0x73')]){_0x5a75d1[_0xdac0('0x66')](_0x358c34);}_0x5375d5[_0x489ea4][_0xdac0('0x74')]&&_0x5a75d1[_0xdac0('0x3e')](_0x358c34,_0x5375d5[_0x489ea4]['orderBy']===_0xdac0('0x75')?![]:!![]);_0x5a75d1['field'](_0x358c34,_0x5375d5[_0x489ea4][_0xdac0('0x76')]||_0x358c34);}if(_0x39131d[_0xdac0('0x77')]){_0x39131d[_0xdac0('0x77')]=JSON['parse'](_0x39131d['joins']);for(var _0x4037b9=0x0;_0x4037b9<_0x39131d[_0xdac0('0x77')][_0xdac0('0x3c')];_0x4037b9+=0x1){if(_0x39131d[_0xdac0('0x77')][_0x4037b9]['type']&&_[_0xdac0('0x60')](_0x17f5b0,_0x39131d['joins'][_0x4037b9][_0xdac0('0x34')])&&_0x39131d[_0xdac0('0x77')][_0x4037b9][_0xdac0('0x78')]&&_0x39131d[_0xdac0('0x77')][_0x4037b9][_0xdac0('0x79')]&&_0x39131d[_0xdac0('0x77')][_0x4037b9][_0xdac0('0x7a')]){_0x5a75d1[_0x39131d[_0xdac0('0x77')][_0x4037b9][_0xdac0('0x34')]](_0x39131d['joins'][_0x4037b9][_0xdac0('0x79')],null,util[_0xdac0('0x72')](_0xdac0('0x7b'),_0x39131d[_0xdac0('0x7c')],_0x39131d[_0xdac0('0x77')][_0x4037b9][_0xdac0('0x78')],_0x39131d['joins'][_0x4037b9][_0xdac0('0x79')],_0x39131d[_0xdac0('0x77')][_0x4037b9][_0xdac0('0x7a')]));}}}if(_0x39131d[_0xdac0('0x7d')]){_0x39131d[_0xdac0('0x7d')]=JSON[_0xdac0('0x7e')](_0x39131d[_0xdac0('0x7d')]);_0x5a75d1[_0xdac0('0x40')](_0x45b38e(_0x39131d[_0xdac0('0x7d')][_0xdac0('0x66')]));}_0x1ce937=_0x5a75d1[_0xdac0('0x7f')]();_0x5a75d1[_0xdac0('0x23')](_0x4fe6b3);_0x5a75d1[_0xdac0('0x22')](0x0);logger[_0xdac0('0x80')]('Limited\x20Query:',_0x5a75d1[_0xdac0('0x81')]());return db[_0xdac0('0x82')][_0xdac0('0x37')](_0x5a75d1[_0xdac0('0x81')](),{'type':db[_0xdac0('0x82')]['QueryTypes']['SELECT']});}})[_0xdac0('0x29')](respondWithResult(_0x84e6f6,null))[_0xdac0('0x49')](handleError(_0x84e6f6,null));};function runReport(_0x29f5fe,_0x3e48de,_0x4a3f98){var _0x60109d=_0x3e48de['name'];var _0x59db28=0xa;var _0x968c0a=[_0xdac0('0x57'),'left_join',_0xdac0('0x83'),_0xdac0('0x59')];var _0x175970={'SUM':'SUM(%s)','COUNT':_0xdac0('0x84'),'COUNT DISTINCT':_0xdac0('0x85'),'MAX':'MAX(%s)','MIN':_0xdac0('0x5b'),'AVG':_0xdac0('0x86'),'GROUP_CONCAT':_0xdac0('0x5c'),'GROUP_CONCAT ASC':_0xdac0('0x5d'),'GROUP_CONCAT DESC':_0xdac0('0x87')};var _0x46e93d={'SEC_TO_TIME':_0xdac0('0x88'),'DATE':_0xdac0('0x5e'),'HOUR':_0xdac0('0x5f'),'ROUND':_0xdac0('0x89'),'UNIX_TIMESTAMP':_0xdac0('0x8a')};var _0x51ebc7=function(_0x2f61f3){return!_[_0xdac0('0x60')]([_0xdac0('0x61'),_0xdac0('0x8b'),'IS\x20EMPTY',_0xdac0('0x63')],_0x2f61f3);};var _0x1dd83b=function(_0x2f5763){if(!_0x2f5763||!_0x2f5763['rules']['length']){return'';}for(var _0x45a7ad='(',_0x2179f2=0x0;_0x2179f2<_0x2f5763[_0xdac0('0x64')][_0xdac0('0x3c')];_0x2179f2+=0x1){_0x2179f2>0x0&&(_0x45a7ad+='\x20'+_0x2f5763[_0xdac0('0x65')]+'\x20');_0x45a7ad+=_0x2f5763[_0xdac0('0x64')][_0x2179f2][_0xdac0('0x66')]?_0x1dd83b(_0x2f5763[_0xdac0('0x64')][_0x2179f2][_0xdac0('0x66')]):_0x2f5763['rules'][_0x2179f2][_0xdac0('0x70')]+'\x20'+_0x2f5763[_0xdac0('0x64')][_0x2179f2][_0xdac0('0x67')]+(_0x51ebc7(_0x2f5763[_0xdac0('0x64')][_0x2179f2][_0xdac0('0x67')])?'\x20'+_0x2f5763[_0xdac0('0x64')][_0x2179f2][_0xdac0('0x8c')]:'');}return _0x45a7ad+')';};var _0x150558={'where':{'id':_0x29f5fe['id']}},_0x174adc,_0x173309,_0x1f78f4,_0x548094,_0x543269;_0x150558=_[_0xdac0('0x42')]({},_0x150558,_0x4a3f98);return db[_0xdac0('0x46')][_0xdac0('0x4e')](_0x150558)[_0xdac0('0x29')](function(_0x13ea19){if(_0x13ea19){_0x174adc=_0x13ea19;return _0x13ea19[_0xdac0('0x68')]();}return null;})[_0xdac0('0x29')](function(_0x24cf44){if(_0x24cf44){if(!_0x24cf44[_0xdac0('0x3c')]){throw new db[(_0xdac0('0x69'))][(_0xdac0('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x173309=_0x24cf44;return db[_0xdac0('0x6b')][_0xdac0('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x27f474){if(_0x27f474){_0x1f78f4=_[_0xdac0('0x8e')](_0x27f474,'id');var _0x253962;var _0x11b385=squel[_0xdac0('0x6d')]();_0x11b385[_0xdac0('0x6e')](_0x174adc[_0xdac0('0x7c')]);for(var _0x45554e=0x0;_0x45554e<_0x173309['length'];_0x45554e+=0x1){_0x253962=_0x173309[_0x45554e][_0xdac0('0x8f')]?_0x1f78f4[_0x173309[_0x45554e][_0xdac0('0x8f')]][_0xdac0('0x6f')]:_0x173309[_0x45554e]['field'];_0x253962=_0x173309[_0x45554e]['function']?_['replace'](_0x175970[_0x173309[_0x45554e][_0xdac0('0x90')]],'%s',_0x253962):_0x253962;_0x253962=_0x173309[_0x45554e]['format']?_[_0xdac0('0x71')](_0x46e93d[_0x173309[_0x45554e]['format']],'%s',_0x253962):_0x253962;if(_0x173309[_0x45554e][_0xdac0('0x73')]){_0x11b385[_0xdac0('0x66')](_0x253962);}_0x173309[_0x45554e]['orderBy']&&_0x11b385[_0xdac0('0x3e')](_0x253962,_0x173309[_0x45554e]['orderBy']==='DESC'?![]:!![]);_0x11b385[_0xdac0('0x70')](_0x253962,_0x173309[_0x45554e]['alias']||_0x253962);}if(_0x174adc[_0xdac0('0x77')]){_0x174adc[_0xdac0('0x77')]=JSON['parse'](_0x174adc['joins']);for(var _0x4ad972=0x0;_0x4ad972<_0x174adc[_0xdac0('0x77')]['length'];_0x4ad972+=0x1){if(_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x34')]&&_[_0xdac0('0x60')](_0x968c0a,_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x34')])&&_0x174adc['joins'][_0x4ad972]['parentKey']&&_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x79')]&&_0x174adc['joins'][_0x4ad972][_0xdac0('0x7a')]){_0x11b385[_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x34')]](_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x79')],null,util[_0xdac0('0x72')](_0xdac0('0x7b'),_0x174adc['table'],_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x78')],_0x174adc[_0xdac0('0x77')][_0x4ad972][_0xdac0('0x79')],_0x174adc['joins'][_0x4ad972][_0xdac0('0x7a')]));}}}if(_0x174adc['conditions']){_0x174adc[_0xdac0('0x7d')]=JSON[_0xdac0('0x7e')](_0x174adc[_0xdac0('0x7d')]);_0x11b385[_0xdac0('0x40')](_0x1dd83b(_0x174adc[_0xdac0('0x7d')][_0xdac0('0x66')]));}_0x543269=_0x11b385['clone']();_0x11b385['limit'](_0x59db28);_0x11b385[_0xdac0('0x22')](0x0);logger['debug'](_0xdac0('0x91'),_0x11b385[_0xdac0('0x81')]());return db[_0xdac0('0x82')][_0xdac0('0x37')](_0x11b385[_0xdac0('0x81')](),{'type':db[_0xdac0('0x82')]['QueryTypes'][_0xdac0('0x92')]});}})[_0xdac0('0x29')](function(_0x1d5203){if(!_0x1d5203[_0xdac0('0x3c')]){throw new db[(_0xdac0('0x69'))]['ValidationErrorItem'](_0xdac0('0x93'),0xcc);}if(_0x3e48de[_0xdac0('0x94')]===_0xdac0('0x95')){return null;}var _0x2b77b8=_[_0xdac0('0x42')](_0x3e48de,{'name':_0x3e48de[_0xdac0('0x96')]||_0x3e48de['name']||_0x174adc[_0xdac0('0x2f')],'basename':_0x60109d,'savename':util[_0xdac0('0x72')]('%s-%s.%s',_0x3e48de[_0xdac0('0x2f')]||_0x174adc[_0xdac0('0x2f')],require(_0xdac0('0x97'))[_0xdac0('0x98')](0x4),_0x3e48de[_0xdac0('0x94')]||_0xdac0('0x99')),'reportId':_0x174adc['id'],'reportType':_0xdac0('0x9a')});return db['AnalyticExtractedReport']['create'](_0x2b77b8,{'raw':!![]});})[_0xdac0('0x29')](function(_0x132ef6){if(_0x174adc[_0xdac0('0x7c')]==='cdr'){_0x543269['where'](_0x174adc[_0xdac0('0x7c')]+_0xdac0('0x9b'),_0x3e48de[_0xdac0('0x9c')],_0x3e48de[_0xdac0('0x9d')]);}else{_0x543269['where'](_0x174adc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3e48de[_0xdac0('0x9c')],_0x3e48de[_0xdac0('0x9d')]);}if(_0x132ef6){logger[_0xdac0('0x9e')](_0xdac0('0x9f'),_0x543269[_0xdac0('0x81')]());require(_0xdac0('0xa0'))[_0xdac0('0xa1')](path[_0xdac0('0x57')](__dirname,_0xdac0('0xa2'),_0x132ef6[_0xdac0('0x94')]),[_0x132ef6['id'],_0x543269[_0xdac0('0x81')](),path['join'](__dirname,_0xdac0('0xa3'),_0x132ef6[_0xdac0('0xa4')]),_0x60109d]);return _0x132ef6;}else{var _0xbb07cf=squel['select']();_0xbb07cf[_0xdac0('0x6e')]('('+_0x543269[_0xdac0('0x81')]()+')','countTable');_0xbb07cf['field'](_0xdac0('0xa5'),_0xdac0('0x21'));_0x543269['limit'](_0x3e48de['limit']||_0x59db28);_0x543269[_0xdac0('0x22')](_0x3e48de[_0xdac0('0x22')]||0x0);return dbH[_0xdac0('0x82')][_0xdac0('0x37')](_0xbb07cf[_0xdac0('0x81')](),{'type':dbH[_0xdac0('0x82')][_0xdac0('0xa6')][_0xdac0('0x92')]})[_0xdac0('0x29')](function(_0x41e67c){if(!_0x41e67c[_0xdac0('0x3c')]){_0x548094=0x0;}else{_0x548094=_0x41e67c[0x0][_0xdac0('0x21')]||0x0;}return dbH[_0xdac0('0x82')]['query'](_0x543269[_0xdac0('0x81')](),{'type':dbH['sequelize'][_0xdac0('0xa6')][_0xdac0('0x92')]});})[_0xdac0('0x29')](function(_0x9b5c8){return{'rows':_0x9b5c8||[],'count':_0x548094};});}});}exports[_0xdac0('0xa7')]=function(_0x2d192c,_0x3b5e1f){return runReport(_0x2d192c[_0xdac0('0x4b')],_0x2d192c['query'],_0x2d192c[_0xdac0('0x45')])[_0xdac0('0x29')](respondWithResult(_0x3b5e1f,null))['catch'](handleError(_0x3b5e1f,null));};exports[_0xdac0('0xa8')]=runReport;exports[_0xdac0('0x37')]=function(_0xa9aade,_0x4f128c){var _0x4d7973=0xa;var _0x6f223b=['join',_0xdac0('0x58'),'right_join',_0xdac0('0x59')];var _0x561f08={'SUM':_0xdac0('0x5a'),'COUNT':_0xdac0('0x84'),'COUNT DISTINCT':_0xdac0('0x85'),'MAX':_0xdac0('0xa9'),'MIN':_0xdac0('0x5b'),'AVG':_0xdac0('0x86'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xdac0('0x5d'),'GROUP_CONCAT DESC':_0xdac0('0x87')};var _0x4ae855={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdac0('0x5e'),'HOUR':_0xdac0('0x5f'),'ROUND':_0xdac0('0x89'),'UNIX_TIMESTAMP':_0xdac0('0x8a')};var _0x536615=function(_0x12575d){return!_[_0xdac0('0x60')]([_0xdac0('0x61'),_0xdac0('0x8b'),_0xdac0('0x62'),_0xdac0('0x63')],_0x12575d);};var _0x2fc47d=function(_0x24e578){if(!_0x24e578||!_0x24e578['rules'][_0xdac0('0x3c')]){return'';}for(var _0x451ab3='(',_0x1b4d5b=0x0;_0x1b4d5b<_0x24e578['rules']['length'];_0x1b4d5b+=0x1){_0x1b4d5b>0x0&&(_0x451ab3+='\x20'+_0x24e578[_0xdac0('0x65')]+'\x20');_0x451ab3+=_0x24e578[_0xdac0('0x64')][_0x1b4d5b][_0xdac0('0x66')]?_0x2fc47d(_0x24e578['rules'][_0x1b4d5b]['group']):_0x24e578[_0xdac0('0x64')][_0x1b4d5b][_0xdac0('0x70')]+'\x20'+_0x24e578[_0xdac0('0x64')][_0x1b4d5b][_0xdac0('0x67')]+(_0x536615(_0x24e578[_0xdac0('0x64')][_0x1b4d5b][_0xdac0('0x67')])?'\x20'+_0x24e578['rules'][_0x1b4d5b]['value']:'');}return _0x451ab3+')';};var _0x594827={'where':{'id':_0xa9aade[_0xdac0('0x4b')]['id']}},_0x1e9edb,_0x5e9a81,_0x223129,_0xd9ff81,_0x2f40b0;_0x594827=_[_0xdac0('0x42')]({},_0x594827,_0xa9aade['options']);return db[_0xdac0('0x46')][_0xdac0('0x4e')](_0x594827)[_0xdac0('0x29')](function(_0x5559ca){if(_0x5559ca){_0x1e9edb=_0x5559ca;return _0x5559ca['getFields']();}return null;})['then'](function(_0x57d710){if(_0x57d710){if(!_0x57d710[_0xdac0('0x3c')]){throw new db[(_0xdac0('0x69'))][(_0xdac0('0x8d'))](_0xdac0('0x6a'),0x193);}_0x5e9a81=_0x57d710;return db[_0xdac0('0x6b')][_0xdac0('0x6c')]({'raw':!![]});}return null;})[_0xdac0('0x29')](function(_0x317514){if(_0x317514){_0x223129=_['keyBy'](_0x317514,'id');var _0x17c928;var _0x4504f0=squel['select']();_0x4504f0[_0xdac0('0x6e')](_0x1e9edb[_0xdac0('0x7c')]);for(var _0x192d40=0x0;_0x192d40<_0x5e9a81[_0xdac0('0x3c')];_0x192d40+=0x1){_0x17c928=_0x5e9a81[_0x192d40][_0xdac0('0x8f')]?_0x223129[_0x5e9a81[_0x192d40][_0xdac0('0x8f')]]['metric']:_0x5e9a81[_0x192d40][_0xdac0('0x70')];_0x17c928=_0x5e9a81[_0x192d40]['function']?_[_0xdac0('0x71')](_0x561f08[_0x5e9a81[_0x192d40]['function']],'%s',_0x17c928):_0x17c928;_0x17c928=_0x5e9a81[_0x192d40][_0xdac0('0x72')]?_[_0xdac0('0x71')](_0x4ae855[_0x5e9a81[_0x192d40]['format']],'%s',_0x17c928):_0x17c928;if(_0x5e9a81[_0x192d40][_0xdac0('0x73')]){_0x4504f0[_0xdac0('0x66')](_0x17c928);}_0x5e9a81[_0x192d40][_0xdac0('0x74')]&&_0x4504f0['order'](_0x17c928,_0x5e9a81[_0x192d40][_0xdac0('0x74')]==='DESC'?![]:!![]);_0x4504f0['field'](_0x17c928,_0x5e9a81[_0x192d40][_0xdac0('0x76')]||_0x17c928);}if(_0x1e9edb['joins']){_0x1e9edb[_0xdac0('0x77')]=JSON[_0xdac0('0x7e')](_0x1e9edb[_0xdac0('0x77')]);for(var _0x1ede20=0x0;_0x1ede20<_0x1e9edb[_0xdac0('0x77')][_0xdac0('0x3c')];_0x1ede20+=0x1){if(_0x1e9edb[_0xdac0('0x77')][_0x1ede20]['type']&&_[_0xdac0('0x60')](_0x6f223b,_0x1e9edb[_0xdac0('0x77')][_0x1ede20][_0xdac0('0x34')])&&_0x1e9edb[_0xdac0('0x77')][_0x1ede20][_0xdac0('0x78')]&&_0x1e9edb[_0xdac0('0x77')][_0x1ede20]['foreignTable']&&_0x1e9edb[_0xdac0('0x77')][_0x1ede20][_0xdac0('0x7a')]){_0x4504f0[_0x1e9edb['joins'][_0x1ede20][_0xdac0('0x34')]](_0x1e9edb[_0xdac0('0x77')][_0x1ede20][_0xdac0('0x79')],null,util[_0xdac0('0x72')]('%s.%s\x20=\x20%s.%s',_0x1e9edb[_0xdac0('0x7c')],_0x1e9edb[_0xdac0('0x77')][_0x1ede20]['parentKey'],_0x1e9edb[_0xdac0('0x77')][_0x1ede20][_0xdac0('0x79')],_0x1e9edb[_0xdac0('0x77')][_0x1ede20][_0xdac0('0x7a')]));}}}if(_0x1e9edb['conditions']){_0x1e9edb[_0xdac0('0x7d')]=JSON['parse'](_0x1e9edb[_0xdac0('0x7d')]);_0x4504f0[_0xdac0('0x40')](_0x2fc47d(_0x1e9edb['conditions'][_0xdac0('0x66')]));}_0x2f40b0=_0x4504f0['clone']();_0x4504f0[_0xdac0('0x23')](_0x4d7973);_0x4504f0[_0xdac0('0x22')](0x0);logger[_0xdac0('0x80')]('Limited\x20Query:',_0x4504f0[_0xdac0('0x81')]());return db[_0xdac0('0x82')][_0xdac0('0x37')](_0x4504f0[_0xdac0('0x81')](),{'type':db['sequelize'][_0xdac0('0xa6')][_0xdac0('0x92')]});}})['then'](function(){return{'sql':_0x2f40b0['toString']()};})[_0xdac0('0x29')](respondWithResult(_0x4f128c,null))[_0xdac0('0x49')](handleError(_0x4f128c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8fbb7b7..cb7dbcb 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 _0xcd89=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x588914,_0x6fb9ed){var _0x12f961=function(_0x5d70e){while(--_0x5d70e){_0x588914['push'](_0x588914['shift']());}};_0x12f961(++_0x6fb9ed);}(_0xcd89,0xe1));var _0x9cd8=function(_0x51d691,_0x54bd9f){_0x51d691=_0x51d691-0x0;var _0x404a12=_0xcd89[_0x51d691];return _0x404a12;};'use strict';var _=require(_0x9cd8('0x0'));var util=require(_0x9cd8('0x1'));var logger=require(_0x9cd8('0x2'))(_0x9cd8('0x3'));var moment=require(_0x9cd8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9cd8('0x5'));var fs=require('fs');var path=require(_0x9cd8('0x6'));var rimraf=require('rimraf');var config=require(_0x9cd8('0x7'));var attributes=require(_0x9cd8('0x8'));module[_0x9cd8('0x9')]=function(_0x11b931,_0x43650e){return _0x11b931[_0x9cd8('0xa')](_0x9cd8('0xb'),attributes,{'tableName':_0x9cd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8818=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x8818,0x64));var _0x8881=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8818[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x8881('0x0'));var util=require(_0x8881('0x1'));var logger=require(_0x8881('0x2'))(_0x8881('0x3'));var moment=require(_0x8881('0x4'));var BPromise=require(_0x8881('0x5'));var rp=require(_0x8881('0x6'));var fs=require('fs');var path=require(_0x8881('0x7'));var rimraf=require(_0x8881('0x8'));var config=require(_0x8881('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0x8881('0xa')]=function(_0x2678bf,_0xc768d7){return _0x2678bf[_0x8881('0xb')](_0x8881('0xc'),attributes,{'tableName':_0x8881('0xd'),'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 0137da4..e123a85 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 _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','code','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x6f2f[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});} \ No newline at end of file +var _0x98b8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b58bf,_0x6996d3){var _0xbda193=function(_0x5cd544){while(--_0x5cd544){_0x5b58bf['push'](_0x5b58bf['shift']());}};_0xbda193(++_0x6996d3);}(_0x98b8,0x93));var _0x898b=function(_0x4260d9,_0x798704){_0x4260d9=_0x4260d9-0x0;var _0x56aa24=_0x98b8[_0x4260d9];return _0x56aa24;};'use strict';var _=require(_0x898b('0x0'));var util=require(_0x898b('0x1'));var moment=require(_0x898b('0x2'));var BPromise=require(_0x898b('0x3'));var rs=require(_0x898b('0x4'));var fs=require('fs');var Redis=require(_0x898b('0x5'));var db=require(_0x898b('0x6'))['db'];var utils=require(_0x898b('0x7'));var logger=require(_0x898b('0x8'))(_0x898b('0x9'));var config=require(_0x898b('0xa'));var jayson=require(_0x898b('0xb'));var client=jayson[_0x898b('0xc')][_0x898b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x124030,_0x4e9410,_0x3989f9){return new BPromise(function(_0x32e2e,_0x4220a7){return client[_0x898b('0xe')](_0x124030,_0x3989f9)[_0x898b('0xf')](function(_0x46118b){logger[_0x898b('0x10')](_0x898b('0x11'),_0x4e9410,'request\x20sent');logger[_0x898b('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4e9410,'request\x20sent',JSON[_0x898b('0x13')](_0x46118b));if(_0x46118b[_0x898b('0x14')]){if(_0x46118b[_0x898b('0x14')][_0x898b('0x15')]===0x1f4){logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);return _0x4220a7(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b['error'][_0x898b('0x16')]);return _0x32e2e(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4e9410,_0x898b('0x17'));_0x32e2e(_0x46118b[_0x898b('0x18')][_0x898b('0x16')]);}})[_0x898b('0x19')](function(_0x54cd3b){logger[_0x898b('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4e9410,_0x54cd3b);_0x4220a7(_0x54cd3b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 162a9d6..3923f94 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 _0x1fa8=['Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query','query','post','create','update','delete','exports','path','express'];(function(_0x303327,_0x1809d3){var _0x3b8fe3=function(_0x4a512a){while(--_0x4a512a){_0x303327['push'](_0x303327['shift']());}};_0x3b8fe3(++_0x1809d3);}(_0x1fa8,0x108));var _0x81fa=function(_0x416541,_0xc1193a){_0x416541=_0x416541-0x0;var _0x1206c9=_0x1fa8[_0x416541];return _0x1206c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x81fa('0x0'));var timeout=require('connect-timeout');var express=require(_0x81fa('0x1'));var router=express[_0x81fa('0x2')]();var auth=require(_0x81fa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x81fa('0x4'));var controller=require('./analyticDefaultReport.controller');router[_0x81fa('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x81fa('0x6'),auth[_0x81fa('0x7')](),controller[_0x81fa('0x8')]);router[_0x81fa('0x5')]('/:id/preview',auth[_0x81fa('0x7')](),controller[_0x81fa('0x9')]);router[_0x81fa('0x5')](_0x81fa('0xa'),auth[_0x81fa('0x7')](),controller[_0x81fa('0xb')]);router[_0x81fa('0x5')](_0x81fa('0xc'),auth[_0x81fa('0x7')](),controller[_0x81fa('0xd')]);router[_0x81fa('0xe')]('/',auth[_0x81fa('0x7')](),controller[_0x81fa('0xf')]);router['put']('/:id',auth[_0x81fa('0x7')](),controller[_0x81fa('0x10')]);router[_0x81fa('0x11')](_0x81fa('0x6'),auth[_0x81fa('0x7')](),controller['destroy']);module[_0x81fa('0x12')]=router; \ No newline at end of file +var _0x9807=['Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','show','/:id/preview','preview','/:id/run','isAuthenticated','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9807,0x93));var _0x7980=function(_0x2547cc,_0x36e84d){_0x2547cc=_0x2547cc-0x0;var _0x34662c=_0x9807[_0x2547cc];return _0x34662c;};'use strict';var multer=require(_0x7980('0x0'));var util=require('util');var path=require(_0x7980('0x1'));var timeout=require('connect-timeout');var express=require(_0x7980('0x2'));var router=express[_0x7980('0x3')]();var auth=require(_0x7980('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7980('0x5'));var controller=require(_0x7980('0x6'));router[_0x7980('0x7')]('/',auth['isAuthenticated'](),controller[_0x7980('0x8')]);router[_0x7980('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7980('0x9')]);router[_0x7980('0x7')](_0x7980('0xa'),auth['isAuthenticated'](),controller[_0x7980('0xb')]);router[_0x7980('0x7')](_0x7980('0xc'),auth[_0x7980('0xd')](),controller[_0x7980('0xe')]);router['get'](_0x7980('0xf'),auth[_0x7980('0xd')](),controller[_0x7980('0x10')]);router[_0x7980('0x11')]('/',auth['isAuthenticated'](),controller[_0x7980('0x12')]);router[_0x7980('0x13')](_0x7980('0x14'),auth['isAuthenticated'](),controller[_0x7980('0x15')]);router[_0x7980('0x16')](_0x7980('0x14'),auth[_0x7980('0xd')](),controller[_0x7980('0x17')]);module[_0x7980('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 733218c..af0c9e4 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 _0x070c=['STRING','pdf','xlsx','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','exports'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x070c,0x17f));var _0xc070=function(_0xd7e1ac,_0x5d253b){_0xd7e1ac=_0xd7e1ac-0x0;var _0x270568=_0x070c[_0xd7e1ac];return _0x270568;};'use strict';var Sequelize=require(_0xc070('0x0'));var moment=require('moment');module[_0xc070('0x1')]={'name':{'type':Sequelize[_0xc070('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xc070('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xc070('0x3'),_0xc070('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc070('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc070('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xc070('0x6')},'type':{'type':Sequelize[_0xc070('0x7')](_0xc070('0x8'),_0xc070('0x9')),'allowNull':![],'defaultValue':_0xc070('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xc070('0xa')]},'reportType':{'type':Sequelize[_0xc070('0x2')]}}; \ No newline at end of file +var _0xfc02=['STRING','csv','pdf','xlsx','DATE','ENUM','manual','scheduled','INTEGER','UNSIGNED','moment','exports'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xfc02,0x1de));var _0x2fc0=function(_0x29d13e,_0x2b01de){_0x29d13e=_0x29d13e-0x0;var _0x1f8e2f=_0xfc02[_0x29d13e];return _0x1f8e2f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2fc0('0x0'));module[_0x2fc0('0x1')]={'name':{'type':Sequelize[_0x2fc0('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x2fc0('0x3'),_0x2fc0('0x4'),_0x2fc0('0x5')),'allowNull':![],'defaultValue':_0x2fc0('0x3')},'savename':{'type':Sequelize[_0x2fc0('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2fc0('0x6')]},'endDate':{'type':Sequelize[_0x2fc0('0x6')]},'status':{'type':Sequelize[_0x2fc0('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x2fc0('0x7')](_0x2fc0('0x8'),_0x2fc0('0x9')),'allowNull':![],'defaultValue':_0x2fc0('0x8')},'reportId':{'type':Sequelize[_0x2fc0('0xa')](0xb)[_0x2fc0('0xb')]},'reportType':{'type':Sequelize[_0x2fc0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 15b0ac2..8e52699 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 _0x18f6=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','map','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticExtractedReport','includeAll','rows','catch','show','params','fields','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','output','existsSync','join','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','toLowerCase','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache'];(function(_0xe571a9,_0x3bb4d2){var _0x24eb18=function(_0xc6306c){while(--_0xc6306c){_0xe571a9['push'](_0xe571a9['shift']());}};_0x24eb18(++_0x3bb4d2);}(_0x18f6,0x16e));var _0x618f=function(_0x93398c,_0xb9e33f){_0x93398c=_0x93398c-0x0;var _0xa694e9=_0x18f6[_0x93398c];return _0xa694e9;};'use strict';var pdf=require(_0x618f('0x0'));var emlformat=require(_0x618f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x618f('0x2'));var rp=require(_0x618f('0x3'));var moment=require(_0x618f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x618f('0x5'));var util=require('util');var path=require(_0x618f('0x6'));var sox=require(_0x618f('0x7'));var csv=require(_0x618f('0x8'));var ejs=require(_0x618f('0x9'));var fs=require('fs');var _=require(_0x618f('0xa'));var squel=require(_0x618f('0xb'));var crypto=require('crypto');var jsforce=require(_0x618f('0xc'));var deskjs=require(_0x618f('0xd'));var toCsv=require(_0x618f('0x8'));var querystring=require(_0x618f('0xe'));var Papa=require(_0x618f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x618f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x618f('0x11'))(_0x618f('0x12'));var utils=require('../../config/utils');var config=require(_0x618f('0x13'));var licenseUtil=require(_0x618f('0x14'));var db=require(_0x618f('0x15'))['db'];function respondWithStatusCode(_0x4da324,_0x22f790){_0x22f790=_0x22f790||0xcc;return function(_0x5a5f02){if(_0x5a5f02){return _0x4da324[_0x618f('0x16')](_0x22f790);}return _0x4da324[_0x618f('0x17')](_0x22f790)[_0x618f('0x18')]();};}function respondWithResult(_0x97055e,_0x36ab49){_0x36ab49=_0x36ab49||0xc8;return function(_0x2622ea){if(_0x2622ea){return _0x97055e[_0x618f('0x17')](_0x36ab49)[_0x618f('0x19')](_0x2622ea);}};}function respondWithFilteredResult(_0x73b49,_0x12751c){return function(_0x4e3e8b){if(_0x4e3e8b){var _0x1dc341=_0x4e3e8b[_0x618f('0x1a')],_0x2c11ef=_0x12751c[_0x618f('0x1b')],_0x57d002=_0x12751c[_0x618f('0x1b')]+_0x12751c[_0x618f('0x1c')],_0x6b699c;if(_0x57d002>=_0x1dc341){_0x57d002=_0x1dc341;_0x6b699c=0xc8;}else{_0x6b699c=0xce;}_0x73b49['status'](_0x6b699c);return _0x73b49['set'](_0x618f('0x1d'),_0x2c11ef+'-'+_0x57d002+'/'+_0x1dc341)['json'](_0x4e3e8b);}return null;};}function patchUpdates(_0x4dcc65){return function(_0x2647f2){try{jsonpatch[_0x618f('0x1e')](_0x2647f2,_0x4dcc65,!![]);}catch(_0x469223){return BPromise[_0x618f('0x1f')](_0x469223);}return _0x2647f2[_0x618f('0x20')]();};}function saveUpdates(_0x284747,_0x4c4420){return function(_0x37ed6b){if(_0x37ed6b){return _0x37ed6b[_0x618f('0x21')](_0x284747)[_0x618f('0x22')](function(_0x2cbf72){return _0x2cbf72;});}return null;};}function removeEntity(_0x55877f,_0x12f7f7){return function(_0x2f6958){if(_0x2f6958){return _0x2f6958[_0x618f('0x23')]()[_0x618f('0x22')](function(){var _0x2939ac=_0x2f6958[_0x618f('0x24')]({'plain':!![]});var _0x5674e1=_0x618f('0x25');return db[_0x618f('0x26')][_0x618f('0x23')]({'where':{'type':_0x5674e1,'resourceId':_0x2939ac['id']}})[_0x618f('0x22')](function(){return _0x2f6958;});})[_0x618f('0x22')](function(){_0x55877f[_0x618f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e432f,_0x59187d){return function(_0x239086){if(!_0x239086){_0x1e432f[_0x618f('0x16')](0x194);}return _0x239086;};}function handleError(_0x54494c,_0x413c09){_0x413c09=_0x413c09||0x1f4;return function(_0x1723ad){logger['error'](_0x1723ad[_0x618f('0x27')]);if(_0x1723ad[_0x618f('0x28')]){delete _0x1723ad['name'];}_0x54494c[_0x618f('0x17')](_0x413c09)[_0x618f('0x29')](_0x1723ad);};}exports['index']=function(_0x225acc,_0xaf0429){var _0x507ec6={},_0x562f73={},_0x566c06={'count':0x0,'rows':[]};var _0x181797=_[_0x618f('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x4f7a3b){return{'name':_0x4f7a3b['fieldName'],'type':_0x4f7a3b[_0x618f('0x2b')]['key']};});_0x562f73[_0x618f('0x2c')]=_[_0x618f('0x2a')](_0x181797,'name');_0x562f73['query']=_[_0x618f('0x2d')](_0x225acc['query']);_0x562f73[_0x618f('0x2e')]=_[_0x618f('0x2f')](_0x562f73[_0x618f('0x2c')],_0x562f73[_0x618f('0x30')]);_0x507ec6[_0x618f('0x31')]=_[_0x618f('0x2f')](_0x562f73[_0x618f('0x2c')],qs['fields'](_0x225acc[_0x618f('0x30')]['fields']));_0x507ec6[_0x618f('0x31')]=_0x507ec6[_0x618f('0x31')][_0x618f('0x32')]?_0x507ec6['attributes']:_0x562f73['model'];if(!_0x225acc['query'][_0x618f('0x33')](_0x618f('0x34'))){_0x507ec6[_0x618f('0x1c')]=qs[_0x618f('0x1c')](_0x225acc[_0x618f('0x30')][_0x618f('0x1c')]);_0x507ec6[_0x618f('0x1b')]=qs['offset'](_0x225acc['query'][_0x618f('0x1b')]);}_0x507ec6[_0x618f('0x35')]=qs[_0x618f('0x36')](_0x225acc[_0x618f('0x30')][_0x618f('0x36')]);_0x507ec6[_0x618f('0x37')]=qs[_0x618f('0x2e')](_[_0x618f('0x38')](_0x225acc[_0x618f('0x30')],_0x562f73[_0x618f('0x2e')]),_0x181797);if(_0x225acc['query'][_0x618f('0x39')]){_0x507ec6[_0x618f('0x37')]=_['merge'](_0x507ec6['where'],{'$or':_[_0x618f('0x2a')](_0x181797,function(_0x5288e4){if(_0x5288e4[_0x618f('0x2b')]!==_0x618f('0x3a')){var _0x58034d={};_0x58034d[_0x5288e4[_0x618f('0x28')]]={'$like':'%'+_0x225acc[_0x618f('0x30')][_0x618f('0x39')]+'%'};return _0x58034d;}})});}_0x507ec6=_[_0x618f('0x3b')]({},_0x507ec6,_0x225acc[_0x618f('0x3c')]);var _0x3aed95={'where':_0x507ec6['where']};return db[_0x618f('0x3d')][_0x618f('0x1a')](_0x3aed95)[_0x618f('0x22')](function(_0x2606ae){_0x566c06[_0x618f('0x1a')]=_0x2606ae;if(_0x225acc[_0x618f('0x30')][_0x618f('0x3e')]){_0x507ec6['include']=[{'all':!![]}];}return db[_0x618f('0x3d')]['findAll'](_0x507ec6);})[_0x618f('0x22')](function(_0x5ed4a6){_0x566c06[_0x618f('0x3f')]=_0x5ed4a6;return _0x566c06;})[_0x618f('0x22')](respondWithFilteredResult(_0xaf0429,_0x507ec6))[_0x618f('0x40')](handleError(_0xaf0429,null));};exports[_0x618f('0x41')]=function(_0x41d8c5,_0xc8320f){var _0xc91c94={'raw':!![],'where':{'id':_0x41d8c5[_0x618f('0x42')]['id']}},_0x59d325={};_0x59d325[_0x618f('0x2c')]=_[_0x618f('0x2d')](db[_0x618f('0x3d')]['rawAttributes']);_0x59d325[_0x618f('0x30')]=_[_0x618f('0x2d')](_0x41d8c5['query']);_0x59d325[_0x618f('0x2e')]=_[_0x618f('0x2f')](_0x59d325[_0x618f('0x2c')],_0x59d325[_0x618f('0x30')]);_0xc91c94[_0x618f('0x31')]=_['intersection'](_0x59d325[_0x618f('0x2c')],qs[_0x618f('0x43')](_0x41d8c5['query'][_0x618f('0x43')]));_0xc91c94[_0x618f('0x31')]=_0xc91c94['attributes'][_0x618f('0x32')]?_0xc91c94[_0x618f('0x31')]:_0x59d325['model'];if(_0x41d8c5[_0x618f('0x30')][_0x618f('0x3e')]){_0xc91c94[_0x618f('0x44')]=[{'all':!![]}];}_0xc91c94=_[_0x618f('0x3b')]({},_0xc91c94,_0x41d8c5['options']);return db[_0x618f('0x3d')][_0x618f('0x45')](_0xc91c94)[_0x618f('0x22')](handleEntityNotFound(_0xc8320f,null))['then'](respondWithResult(_0xc8320f,null))[_0x618f('0x40')](handleError(_0xc8320f,null));};exports[_0x618f('0x46')]=function(_0x39dc74,_0x20abc3){return db[_0x618f('0x3d')]['create'](_0x39dc74['body'],{})[_0x618f('0x22')](function(_0x546597){var _0x13d39a=_0x39dc74['user'][_0x618f('0x24')]({'plain':!![]});if(!_0x13d39a)throw new Error(_0x618f('0x47'));if(_0x13d39a[_0x618f('0x48')]===_0x618f('0x49')){var _0x1523b8=_0x546597[_0x618f('0x24')]({'plain':!![]});var _0x1663ea=_0x618f('0x25');return db[_0x618f('0x4a')]['find']({'where':{'name':_0x1663ea,'userProfileId':_0x13d39a[_0x618f('0x4b')]},'raw':!![]})[_0x618f('0x22')](function(_0x203c9c){if(_0x203c9c&&_0x203c9c[_0x618f('0x4c')]===0x0){return db['UserProfileResource'][_0x618f('0x46')]({'name':_0x1523b8[_0x618f('0x28')],'resourceId':_0x1523b8['id'],'type':_0x203c9c[_0x618f('0x28')],'sectionId':_0x203c9c['id']},{})[_0x618f('0x22')](function(){return _0x546597;});}else{return _0x546597;}})[_0x618f('0x40')](function(_0x5b4f09){logger[_0x618f('0x4d')](_0x618f('0x4e'),_0x5b4f09);throw _0x5b4f09;});}return _0x546597;})['then'](respondWithResult(_0x20abc3,0xc9))[_0x618f('0x40')](handleError(_0x20abc3,null));};exports[_0x618f('0x21')]=function(_0x5b4d5d,_0x4c817a){if(_0x5b4d5d[_0x618f('0x4f')]['id']){delete _0x5b4d5d[_0x618f('0x4f')]['id'];}return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x5b4d5d[_0x618f('0x42')]['id']}})[_0x618f('0x22')](handleEntityNotFound(_0x4c817a,null))['then'](saveUpdates(_0x5b4d5d[_0x618f('0x4f')],null))[_0x618f('0x22')](respondWithResult(_0x4c817a,null))[_0x618f('0x40')](handleError(_0x4c817a,null));};exports[_0x618f('0x23')]=function(_0x300add,_0x2b2c71){return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x300add['params']['id']}})[_0x618f('0x22')](handleEntityNotFound(_0x2b2c71,null))['then'](removeEntity(_0x2b2c71,null))[_0x618f('0x40')](handleError(_0x2b2c71,null));};exports[_0x618f('0x50')]=function(_0x1317ac,_0x41f0cb,_0x59fbfc){return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x1317ac[_0x618f('0x42')]['id']},'attributes':[_0x618f('0x28'),_0x618f('0x51'),'savename',_0x618f('0x52')],'raw':!![]})[_0x618f('0x22')](handleEntityNotFound(_0x41f0cb,null))[_0x618f('0x22')](function(_0x2ddf21){if(_0x2ddf21){if(!fs[_0x618f('0x53')](path[_0x618f('0x54')](config['root'],_0x618f('0x55'),_0x2ddf21[_0x618f('0x56')]))){throw new db[(_0x618f('0x57'))]['ValidationError'](_0x618f('0x58'));}if(_0x1317ac[_0x618f('0x30')]['exists']){return _0x41f0cb[_0x618f('0x16')](0xc8);}return _0x41f0cb[_0x618f('0x50')](path['join'](config[_0x618f('0x59')],_0x618f('0x55'),_0x2ddf21['savename']),util[_0x618f('0x5a')](_0x618f('0x5b'),_0x2ddf21[_0x618f('0x51')]||_0x2ddf21[_0x618f('0x28')],_0x2ddf21[_0x618f('0x52')][_0x618f('0x5c')]()));}})[_0x618f('0x40')](handleError(_0x41f0cb,null));}; \ No newline at end of file +var _0x8e6c=['body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','download','basename','savename','existsSync','root','Sequelize','ValidationError','join','server/files/reports','%s.%s','output','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x8e6c,0xda));var _0xc8e6=function(_0x517d0e,_0x12f6f4){_0x517d0e=_0x517d0e-0x0;var _0xa78035=_0x8e6c[_0x517d0e];return _0xa78035;};'use strict';var pdf=require(_0xc8e6('0x0'));var emlformat=require(_0xc8e6('0x1'));var rimraf=require(_0xc8e6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8e6('0x3'));var rp=require(_0xc8e6('0x4'));var moment=require('moment');var BPromise=require(_0xc8e6('0x5'));var Mustache=require(_0xc8e6('0x6'));var util=require(_0xc8e6('0x7'));var path=require(_0xc8e6('0x8'));var sox=require(_0xc8e6('0x9'));var csv=require(_0xc8e6('0xa'));var ejs=require(_0xc8e6('0xb'));var fs=require('fs');var _=require(_0xc8e6('0xc'));var squel=require(_0xc8e6('0xd'));var crypto=require(_0xc8e6('0xe'));var jsforce=require(_0xc8e6('0xf'));var deskjs=require(_0xc8e6('0x10'));var toCsv=require(_0xc8e6('0xa'));var querystring=require(_0xc8e6('0x11'));var Papa=require(_0xc8e6('0x12'));var Redis=require('ioredis');var authService=require(_0xc8e6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc8e6('0x14'));var hardwareService=require(_0xc8e6('0x15'));var logger=require('../../config/logger')(_0xc8e6('0x16'));var utils=require(_0xc8e6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8e6('0x18'));var db=require(_0xc8e6('0x19'))['db'];function respondWithStatusCode(_0x222ced,_0xb13273){_0xb13273=_0xb13273||0xcc;return function(_0x5dbdbb){if(_0x5dbdbb){return _0x222ced[_0xc8e6('0x1a')](_0xb13273);}return _0x222ced[_0xc8e6('0x1b')](_0xb13273)[_0xc8e6('0x1c')]();};}function respondWithResult(_0x4c5ddd,_0x312528){_0x312528=_0x312528||0xc8;return function(_0x21d6a7){if(_0x21d6a7){return _0x4c5ddd[_0xc8e6('0x1b')](_0x312528)[_0xc8e6('0x1d')](_0x21d6a7);}};}function respondWithFilteredResult(_0x25e3d8,_0x3e369c){return function(_0x23c2b2){if(_0x23c2b2){var _0x49ac66=_0x23c2b2[_0xc8e6('0x1e')],_0x300bc3=_0x3e369c[_0xc8e6('0x1f')],_0x59fd43=_0x3e369c['offset']+_0x3e369c[_0xc8e6('0x20')],_0x200932;if(_0x59fd43>=_0x49ac66){_0x59fd43=_0x49ac66;_0x200932=0xc8;}else{_0x200932=0xce;}_0x25e3d8[_0xc8e6('0x1b')](_0x200932);return _0x25e3d8[_0xc8e6('0x21')]('Content-Range',_0x300bc3+'-'+_0x59fd43+'/'+_0x49ac66)[_0xc8e6('0x1d')](_0x23c2b2);}return null;};}function patchUpdates(_0x4e8e58){return function(_0x48bc7d){try{jsonpatch[_0xc8e6('0x22')](_0x48bc7d,_0x4e8e58,!![]);}catch(_0x406487){return BPromise[_0xc8e6('0x23')](_0x406487);}return _0x48bc7d[_0xc8e6('0x24')]();};}function saveUpdates(_0x426d80,_0x597d57){return function(_0x235b51){if(_0x235b51){return _0x235b51[_0xc8e6('0x25')](_0x426d80)[_0xc8e6('0x26')](function(_0x17b556){return _0x17b556;});}return null;};}function removeEntity(_0x4388fa,_0x43206a){return function(_0xe14d3a){if(_0xe14d3a){return _0xe14d3a[_0xc8e6('0x27')]()[_0xc8e6('0x26')](function(){var _0x2d0b4a=_0xe14d3a[_0xc8e6('0x28')]({'plain':!![]});var _0x5f47b2=_0xc8e6('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x5f47b2,'resourceId':_0x2d0b4a['id']}})[_0xc8e6('0x26')](function(){return _0xe14d3a;});})[_0xc8e6('0x26')](function(){_0x4388fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x559e0d,_0x24c3fe){return function(_0x30b9dc){if(!_0x30b9dc){_0x559e0d[_0xc8e6('0x1a')](0x194);}return _0x30b9dc;};}function handleError(_0x537f44,_0x1c2ae5){_0x1c2ae5=_0x1c2ae5||0x1f4;return function(_0x170e31){logger[_0xc8e6('0x2a')](_0x170e31[_0xc8e6('0x2b')]);if(_0x170e31[_0xc8e6('0x2c')]){delete _0x170e31[_0xc8e6('0x2c')];}_0x537f44['status'](_0x1c2ae5)[_0xc8e6('0x2d')](_0x170e31);};}exports[_0xc8e6('0x2e')]=function(_0x5d942f,_0x25210c){var _0x44e865={},_0x1db626={},_0x3c47a8={'count':0x0,'rows':[]};var _0x3d3b2d=_[_0xc8e6('0x2f')](db[_0xc8e6('0x30')][_0xc8e6('0x31')],function(_0x56ca16){return{'name':_0x56ca16[_0xc8e6('0x32')],'type':_0x56ca16[_0xc8e6('0x33')][_0xc8e6('0x34')]};});_0x1db626[_0xc8e6('0x35')]=_[_0xc8e6('0x2f')](_0x3d3b2d,_0xc8e6('0x2c'));_0x1db626['query']=_[_0xc8e6('0x36')](_0x5d942f[_0xc8e6('0x37')]);_0x1db626[_0xc8e6('0x38')]=_[_0xc8e6('0x39')](_0x1db626[_0xc8e6('0x35')],_0x1db626['query']);_0x44e865[_0xc8e6('0x3a')]=_[_0xc8e6('0x39')](_0x1db626['model'],qs[_0xc8e6('0x3b')](_0x5d942f[_0xc8e6('0x37')][_0xc8e6('0x3b')]));_0x44e865[_0xc8e6('0x3a')]=_0x44e865[_0xc8e6('0x3a')][_0xc8e6('0x3c')]?_0x44e865[_0xc8e6('0x3a')]:_0x1db626[_0xc8e6('0x35')];if(!_0x5d942f[_0xc8e6('0x37')][_0xc8e6('0x3d')](_0xc8e6('0x3e'))){_0x44e865[_0xc8e6('0x20')]=qs[_0xc8e6('0x20')](_0x5d942f[_0xc8e6('0x37')][_0xc8e6('0x20')]);_0x44e865['offset']=qs[_0xc8e6('0x1f')](_0x5d942f[_0xc8e6('0x37')][_0xc8e6('0x1f')]);}_0x44e865[_0xc8e6('0x3f')]=qs[_0xc8e6('0x40')](_0x5d942f[_0xc8e6('0x37')]['sort']);_0x44e865[_0xc8e6('0x41')]=qs[_0xc8e6('0x38')](_[_0xc8e6('0x42')](_0x5d942f[_0xc8e6('0x37')],_0x1db626[_0xc8e6('0x38')]),_0x3d3b2d);if(_0x5d942f['query'][_0xc8e6('0x43')]){_0x44e865[_0xc8e6('0x41')]=_[_0xc8e6('0x44')](_0x44e865[_0xc8e6('0x41')],{'$or':_[_0xc8e6('0x2f')](_0x3d3b2d,function(_0xfc723b){if(_0xfc723b['type']!==_0xc8e6('0x45')){var _0x23b1ed={};_0x23b1ed[_0xfc723b[_0xc8e6('0x2c')]]={'$like':'%'+_0x5d942f[_0xc8e6('0x37')][_0xc8e6('0x43')]+'%'};return _0x23b1ed;}})});}_0x44e865=_[_0xc8e6('0x44')]({},_0x44e865,_0x5d942f['options']);var _0x35cd5d={'where':_0x44e865[_0xc8e6('0x41')]};return db[_0xc8e6('0x30')][_0xc8e6('0x1e')](_0x35cd5d)[_0xc8e6('0x26')](function(_0x57fe34){_0x3c47a8[_0xc8e6('0x1e')]=_0x57fe34;if(_0x5d942f['query'][_0xc8e6('0x46')]){_0x44e865[_0xc8e6('0x47')]=[{'all':!![]}];}return db[_0xc8e6('0x30')][_0xc8e6('0x48')](_0x44e865);})['then'](function(_0x4aed2f){_0x3c47a8[_0xc8e6('0x49')]=_0x4aed2f;return _0x3c47a8;})[_0xc8e6('0x26')](respondWithFilteredResult(_0x25210c,_0x44e865))[_0xc8e6('0x4a')](handleError(_0x25210c,null));};exports[_0xc8e6('0x4b')]=function(_0xc84103,_0x2b10d0){var _0x108395={'raw':!![],'where':{'id':_0xc84103['params']['id']}},_0x5b1e64={};_0x5b1e64['model']=_[_0xc8e6('0x36')](db[_0xc8e6('0x30')][_0xc8e6('0x31')]);_0x5b1e64[_0xc8e6('0x37')]=_[_0xc8e6('0x36')](_0xc84103['query']);_0x5b1e64[_0xc8e6('0x38')]=_[_0xc8e6('0x39')](_0x5b1e64[_0xc8e6('0x35')],_0x5b1e64[_0xc8e6('0x37')]);_0x108395[_0xc8e6('0x3a')]=_[_0xc8e6('0x39')](_0x5b1e64[_0xc8e6('0x35')],qs['fields'](_0xc84103[_0xc8e6('0x37')][_0xc8e6('0x3b')]));_0x108395['attributes']=_0x108395[_0xc8e6('0x3a')]['length']?_0x108395['attributes']:_0x5b1e64[_0xc8e6('0x35')];if(_0xc84103[_0xc8e6('0x37')]['includeAll']){_0x108395[_0xc8e6('0x47')]=[{'all':!![]}];}_0x108395=_[_0xc8e6('0x44')]({},_0x108395,_0xc84103[_0xc8e6('0x4c')]);return db[_0xc8e6('0x30')][_0xc8e6('0x4d')](_0x108395)[_0xc8e6('0x26')](handleEntityNotFound(_0x2b10d0,null))[_0xc8e6('0x26')](respondWithResult(_0x2b10d0,null))[_0xc8e6('0x4a')](handleError(_0x2b10d0,null));};exports[_0xc8e6('0x4e')]=function(_0xb03f38,_0x377d93){return db['AnalyticExtractedReport'][_0xc8e6('0x4e')](_0xb03f38[_0xc8e6('0x4f')],{})[_0xc8e6('0x26')](function(_0x2251f0){var _0x17429c=_0xb03f38[_0xc8e6('0x50')][_0xc8e6('0x28')]({'plain':!![]});if(!_0x17429c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17429c[_0xc8e6('0x51')]==='user'){var _0x428f51=_0x2251f0['get']({'plain':!![]});var _0x3fbce5='ExtractedReports';return db[_0xc8e6('0x52')][_0xc8e6('0x4d')]({'where':{'name':_0x3fbce5,'userProfileId':_0x17429c[_0xc8e6('0x53')]},'raw':!![]})[_0xc8e6('0x26')](function(_0x4b86a5){if(_0x4b86a5&&_0x4b86a5[_0xc8e6('0x54')]===0x0){return db[_0xc8e6('0x55')][_0xc8e6('0x4e')]({'name':_0x428f51[_0xc8e6('0x2c')],'resourceId':_0x428f51['id'],'type':_0x4b86a5[_0xc8e6('0x2c')],'sectionId':_0x4b86a5['id']},{})[_0xc8e6('0x26')](function(){return _0x2251f0;});}else{return _0x2251f0;}})[_0xc8e6('0x4a')](function(_0x3f30ea){logger[_0xc8e6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f30ea);throw _0x3f30ea;});}return _0x2251f0;})[_0xc8e6('0x26')](respondWithResult(_0x377d93,0xc9))['catch'](handleError(_0x377d93,null));};exports[_0xc8e6('0x25')]=function(_0x5c0ba2,_0x12c572){if(_0x5c0ba2[_0xc8e6('0x4f')]['id']){delete _0x5c0ba2['body']['id'];}return db[_0xc8e6('0x30')][_0xc8e6('0x4d')]({'where':{'id':_0x5c0ba2['params']['id']}})['then'](handleEntityNotFound(_0x12c572,null))[_0xc8e6('0x26')](saveUpdates(_0x5c0ba2[_0xc8e6('0x4f')],null))[_0xc8e6('0x26')](respondWithResult(_0x12c572,null))[_0xc8e6('0x4a')](handleError(_0x12c572,null));};exports['destroy']=function(_0x4ed9bd,_0x2bc77b){return db[_0xc8e6('0x30')][_0xc8e6('0x4d')]({'where':{'id':_0x4ed9bd[_0xc8e6('0x56')]['id']}})[_0xc8e6('0x26')](handleEntityNotFound(_0x2bc77b,null))['then'](removeEntity(_0x2bc77b,null))[_0xc8e6('0x4a')](handleError(_0x2bc77b,null));};exports[_0xc8e6('0x57')]=function(_0x31db9a,_0x4b85a4,_0x1df851){return db[_0xc8e6('0x30')]['find']({'where':{'id':_0x31db9a['params']['id']},'attributes':['name',_0xc8e6('0x58'),_0xc8e6('0x59'),'output'],'raw':!![]})[_0xc8e6('0x26')](handleEntityNotFound(_0x4b85a4,null))['then'](function(_0x1f6362){if(_0x1f6362){if(!fs[_0xc8e6('0x5a')](path['join'](config[_0xc8e6('0x5b')],'server/files/reports',_0x1f6362[_0xc8e6('0x59')]))){throw new db[(_0xc8e6('0x5c'))][(_0xc8e6('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x31db9a[_0xc8e6('0x37')]['exists']){return _0x4b85a4[_0xc8e6('0x1a')](0xc8);}return _0x4b85a4[_0xc8e6('0x57')](path[_0xc8e6('0x5e')](config[_0xc8e6('0x5b')],_0xc8e6('0x5f'),_0x1f6362[_0xc8e6('0x59')]),util['format'](_0xc8e6('0x60'),_0x1f6362['basename']||_0x1f6362[_0xc8e6('0x2c')],_0x1f6362[_0xc8e6('0x61')][_0xc8e6('0x62')]()));}})[_0xc8e6('0x4a')](handleError(_0x4b85a4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 217b073..30f3106 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 _0xeab9=['moment','bluebird','request-promise','rimraf','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api'];(function(_0x490a07,_0x15eb97){var _0x39fed6=function(_0x15386a){while(--_0x15386a){_0x490a07['push'](_0x490a07['shift']());}};_0x39fed6(++_0x15eb97);}(_0xeab9,0xc2));var _0x9eab=function(_0x48befb,_0x502bb7){_0x48befb=_0x48befb-0x0;var _0x45eb9b=_0xeab9[_0x48befb];return _0x45eb9b;};'use strict';var _=require(_0x9eab('0x0'));var util=require(_0x9eab('0x1'));var logger=require(_0x9eab('0x2'))(_0x9eab('0x3'));var moment=require(_0x9eab('0x4'));var BPromise=require(_0x9eab('0x5'));var rp=require(_0x9eab('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eab('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x9eab('0x8')]=function(_0x2a4202,_0x2ce642){return _0x2a4202[_0x9eab('0x9')](_0x9eab('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2083=['AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x2083,0x1cd));var _0x3208=function(_0x37154c,_0x1765c3){_0x37154c=_0x37154c-0x0;var _0x216e0a=_0x2083[_0x37154c];return _0x216e0a;};'use strict';var _=require('lodash');var util=require(_0x3208('0x0'));var logger=require(_0x3208('0x1'))(_0x3208('0x2'));var moment=require(_0x3208('0x3'));var BPromise=require('bluebird');var rp=require(_0x3208('0x4'));var fs=require('fs');var path=require(_0x3208('0x5'));var rimraf=require('rimraf');var config=require(_0x3208('0x6'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x52e63e,_0x370903){return _0x52e63e['define'](_0x3208('0x7'),attributes,{'tableName':_0x3208('0x8'),'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 bc37e3d..dfd3445 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 _0xcb12=['info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x511639,_0x41e752){var _0x1d882d=function(_0x46025e){while(--_0x46025e){_0x511639['push'](_0x511639['shift']());}};_0x1d882d(++_0x41e752);}(_0xcb12,0x139));var _0x2cb1=function(_0x3f33d5,_0x5dfae0){_0x3f33d5=_0x3f33d5-0x0;var _0x1544f0=_0xcb12[_0x3f33d5];return _0x1544f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2cb1('0x0'));var rs=require(_0x2cb1('0x1'));var fs=require('fs');var Redis=require(_0x2cb1('0x2'));var db=require(_0x2cb1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cb1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2cb1('0x5'));var client=jayson[_0x2cb1('0x6')][_0x2cb1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf5325a,_0x2cc0e1,_0x9df9e4){return new BPromise(function(_0x591891,_0xb6c314){return client[_0x2cb1('0x8')](_0xf5325a,_0x9df9e4)[_0x2cb1('0x9')](function(_0x4223b5){logger[_0x2cb1('0xa')](_0x2cb1('0xb'),_0x2cc0e1,'request\x20sent');logger[_0x2cb1('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2cc0e1,_0x2cb1('0xd'),JSON[_0x2cb1('0xe')](_0x4223b5));if(_0x4223b5[_0x2cb1('0xf')]){if(_0x4223b5[_0x2cb1('0xf')]['code']===0x1f4){logger[_0x2cb1('0xf')](_0x2cb1('0xb'),_0x2cc0e1,_0x4223b5[_0x2cb1('0xf')][_0x2cb1('0x10')]);return _0xb6c314(_0x4223b5[_0x2cb1('0xf')]['message']);}logger[_0x2cb1('0xf')](_0x2cb1('0xb'),_0x2cc0e1,_0x4223b5[_0x2cb1('0xf')]['message']);return _0x591891(_0x4223b5['error'][_0x2cb1('0x10')]);}else{logger[_0x2cb1('0xa')](_0x2cb1('0xb'),_0x2cc0e1,_0x2cb1('0xd'));_0x591891(_0x4223b5[_0x2cb1('0x11')][_0x2cb1('0x10')]);}})[_0x2cb1('0x12')](function(_0x770127){logger[_0x2cb1('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2cc0e1,_0x770127);_0xb6c314(_0x770127);});});} \ No newline at end of file +var _0xf62d=['info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x5f367e,_0x496f43){var _0x520ecf=function(_0x24ba0d){while(--_0x24ba0d){_0x5f367e['push'](_0x5f367e['shift']());}};_0x520ecf(++_0x496f43);}(_0xf62d,0x199));var _0xdf62=function(_0x4cabc0,_0x350976){_0x4cabc0=_0x4cabc0-0x0;var _0x4c92de=_0xf62d[_0x4cabc0];return _0x4c92de;};'use strict';var _=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var moment=require('moment');var BPromise=require(_0xdf62('0x2'));var rs=require(_0xdf62('0x3'));var fs=require('fs');var Redis=require(_0xdf62('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf62('0x5'))(_0xdf62('0x6'));var config=require(_0xdf62('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf62('0x8')][_0xdf62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59e0ee,_0x5d6966,_0x16792e){return new BPromise(function(_0x402fab,_0x21fc02){return client['request'](_0x59e0ee,_0x16792e)[_0xdf62('0xa')](function(_0x38ea4f){logger[_0xdf62('0xb')](_0xdf62('0xc'),_0x5d6966,'request\x20sent');logger[_0xdf62('0xd')](_0xdf62('0xe'),_0x5d6966,_0xdf62('0xf'),JSON['stringify'](_0x38ea4f));if(_0x38ea4f[_0xdf62('0x10')]){if(_0x38ea4f['error'][_0xdf62('0x11')]===0x1f4){logger[_0xdf62('0x10')](_0xdf62('0xc'),_0x5d6966,_0x38ea4f[_0xdf62('0x10')][_0xdf62('0x12')]);return _0x21fc02(_0x38ea4f[_0xdf62('0x10')]['message']);}logger[_0xdf62('0x10')](_0xdf62('0xc'),_0x5d6966,_0x38ea4f[_0xdf62('0x10')][_0xdf62('0x12')]);return _0x402fab(_0x38ea4f['error'][_0xdf62('0x12')]);}else{logger[_0xdf62('0xb')](_0xdf62('0xc'),_0x5d6966,'request\x20sent');_0x402fab(_0x38ea4f['result'][_0xdf62('0x12')]);}})[_0xdf62('0x13')](function(_0x44a9ff){logger[_0xdf62('0x10')](_0xdf62('0xc'),_0x5d6966,_0x44a9ff);_0x21fc02(_0x44a9ff);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b46fa81..ed3a511 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 _0xd5ab=['delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','update'];(function(_0xfbd45c,_0x52c611){var _0x432e51=function(_0x125f9c){while(--_0x125f9c){_0xfbd45c['push'](_0xfbd45c['shift']());}};_0x432e51(++_0x52c611);}(_0xd5ab,0x89));var _0xbd5a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd5ab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var path=require(_0xbd5a('0x2'));var timeout=require(_0xbd5a('0x3'));var express=require('express');var router=express[_0xbd5a('0x4')]();var auth=require(_0xbd5a('0x5'));var interaction=require(_0xbd5a('0x6'));var config=require(_0xbd5a('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xbd5a('0x8')]('/',auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xa')]);router[_0xbd5a('0x8')](_0xbd5a('0xb'),auth[_0xbd5a('0x9')](),controller['show']);router[_0xbd5a('0x8')](_0xbd5a('0xc'),auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xd')]);router[_0xbd5a('0xe')]('/',auth[_0xbd5a('0x9')](),controller['create']);router['put'](_0xbd5a('0xb'),auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xf')]);router[_0xbd5a('0x10')](_0xbd5a('0xb'),auth[_0xbd5a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfa69=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','destroy','multer'];(function(_0x463dfc,_0x1b72bc){var _0x145d20=function(_0x4bb822){while(--_0x4bb822){_0x463dfc['push'](_0x463dfc['shift']());}};_0x145d20(++_0x1b72bc);}(_0xfa69,0x1ed));var _0x9fa6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfa69[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x9fa6('0x0'));var util=require(_0x9fa6('0x1'));var path=require(_0x9fa6('0x2'));var timeout=require('connect-timeout');var express=require(_0x9fa6('0x3'));var router=express[_0x9fa6('0x4')]();var auth=require(_0x9fa6('0x5'));var interaction=require(_0x9fa6('0x6'));var config=require(_0x9fa6('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x9fa6('0x8')]('/',auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xa')]);router[_0x9fa6('0x8')](_0x9fa6('0xb'),auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xc')]);router['get'](_0x9fa6('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x9fa6('0xe')]('/',auth[_0x9fa6('0x9')](),controller[_0x9fa6('0xf')]);router[_0x9fa6('0x10')](_0x9fa6('0xb'),auth['isAuthenticated'](),controller[_0x9fa6('0x11')]);router['delete'](_0x9fa6('0xb'),auth[_0x9fa6('0x9')](),controller[_0x9fa6('0x12')]);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 7834796..289b876 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 _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1961c5,_0x19b0bc){var _0x33879e=function(_0x4bf361){while(--_0x4bf361){_0x1961c5['push'](_0x1961c5['shift']());}};_0x33879e(++_0x19b0bc);}(_0x1261,0x144));var _0x1126=function(_0x33ac75,_0x4953e3){_0x33ac75=_0x33ac75-0x0;var _0x34d5f2=_0x1261[_0x33ac75];return _0x34d5f2;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x561893,_0x30f08a){var _0x4142a3=function(_0x3cfe33){while(--_0x3cfe33){_0x561893['push'](_0x561893['shift']());}};_0x4142a3(++_0x30f08a);}(_0xe14b,0x93));var _0xbe14=function(_0x450c23,_0x7199a2){_0x450c23=_0x450c23-0x0;var _0x280efe=_0xe14b[_0x450c23];return _0x280efe;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 06e7cba..f144306 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 _0xf3a2=['destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','Content-Range','json','reject','update','then','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate'];(function(_0x2344d8,_0x19e83d){var _0x542939=function(_0x3e7bcf){while(--_0x3e7bcf){_0x2344d8['push'](_0x2344d8['shift']());}};_0x542939(++_0x19e83d);}(_0xf3a2,0xb1));var _0x2f3a=function(_0x51d9bc,_0x9c3df0){_0x51d9bc=_0x51d9bc-0x0;var _0x5ae6d7=_0xf3a2[_0x51d9bc];return _0x5ae6d7;};'use strict';var pdf=require(_0x2f3a('0x0'));var emlformat=require(_0x2f3a('0x1'));var rimraf=require(_0x2f3a('0x2'));var zipdir=require(_0x2f3a('0x3'));var jsonpatch=require(_0x2f3a('0x4'));var rp=require(_0x2f3a('0x5'));var moment=require(_0x2f3a('0x6'));var BPromise=require(_0x2f3a('0x7'));var Mustache=require(_0x2f3a('0x8'));var util=require(_0x2f3a('0x9'));var path=require(_0x2f3a('0xa'));var sox=require(_0x2f3a('0xb'));var csv=require(_0x2f3a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2f3a('0xd'));var crypto=require('crypto');var jsforce=require(_0x2f3a('0xe'));var deskjs=require(_0x2f3a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2f3a('0x10'));var Papa=require(_0x2f3a('0x11'));var Redis=require('ioredis');var authService=require(_0x2f3a('0x12'));var qs=require(_0x2f3a('0x13'));var as=require(_0x2f3a('0x14'));var hardwareService=require(_0x2f3a('0x15'));var logger=require(_0x2f3a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2f3a('0x17'));var licenseUtil=require(_0x2f3a('0x18'));var db=require(_0x2f3a('0x19'))['db'];function respondWithStatusCode(_0x134932,_0x8d5e63){_0x8d5e63=_0x8d5e63||0xcc;return function(_0x2942c1){if(_0x2942c1){return _0x134932[_0x2f3a('0x1a')](_0x8d5e63);}return _0x134932['status'](_0x8d5e63)[_0x2f3a('0x1b')]();};}function respondWithResult(_0x25b28d,_0x4839e1){_0x4839e1=_0x4839e1||0xc8;return function(_0x31ebb1){if(_0x31ebb1){return _0x25b28d['status'](_0x4839e1)['json'](_0x31ebb1);}};}function respondWithFilteredResult(_0xf53b84,_0x1c8fa4){return function(_0x962f54){if(_0x962f54){var _0x1bb670=_0x962f54['count'],_0x378461=_0x1c8fa4[_0x2f3a('0x1c')],_0x1a6a5e=_0x1c8fa4['offset']+_0x1c8fa4[_0x2f3a('0x1d')],_0x357a57;if(_0x1a6a5e>=_0x1bb670){_0x1a6a5e=_0x1bb670;_0x357a57=0xc8;}else{_0x357a57=0xce;}_0xf53b84[_0x2f3a('0x1e')](_0x357a57);return _0xf53b84['set'](_0x2f3a('0x1f'),_0x378461+'-'+_0x1a6a5e+'/'+_0x1bb670)[_0x2f3a('0x20')](_0x962f54);}return null;};}function patchUpdates(_0x3d34a9){return function(_0x588cd8){try{jsonpatch['apply'](_0x588cd8,_0x3d34a9,!![]);}catch(_0xf9c6dd){return BPromise[_0x2f3a('0x21')](_0xf9c6dd);}return _0x588cd8['save']();};}function saveUpdates(_0x56d144,_0x19ca5c){return function(_0x401602){if(_0x401602){return _0x401602[_0x2f3a('0x22')](_0x56d144)[_0x2f3a('0x23')](function(_0x479ee8){return _0x479ee8;});}return null;};}function removeEntity(_0x2718a5,_0x3e291f){return function(_0x31586e){if(_0x31586e){return _0x31586e['destroy']()[_0x2f3a('0x23')](function(){_0x2718a5[_0x2f3a('0x1e')](0xcc)[_0x2f3a('0x1b')]();});}};}function handleEntityNotFound(_0x3b9a62,_0xd29a0){return function(_0x5b88b7){if(!_0x5b88b7){_0x3b9a62['sendStatus'](0x194);}return _0x5b88b7;};}function handleError(_0x147476,_0x2746be){_0x2746be=_0x2746be||0x1f4;return function(_0x364532){logger['error'](_0x364532[_0x2f3a('0x24')]);if(_0x364532['name']){delete _0x364532[_0x2f3a('0x25')];}_0x147476[_0x2f3a('0x1e')](_0x2746be)[_0x2f3a('0x26')](_0x364532);};}exports[_0x2f3a('0x27')]=function(_0x32e81f,_0x4a08f6){var _0x8ecce0={},_0x2f9587={},_0x48ddca={'count':0x0,'rows':[]};var _0x5a1a0c=_[_0x2f3a('0x28')](db[_0x2f3a('0x29')][_0x2f3a('0x2a')],function(_0x48f964){return{'name':_0x48f964[_0x2f3a('0x2b')],'type':_0x48f964[_0x2f3a('0x2c')][_0x2f3a('0x2d')]};});_0x2f9587[_0x2f3a('0x2e')]=_[_0x2f3a('0x28')](_0x5a1a0c,'name');_0x2f9587[_0x2f3a('0x2f')]=_[_0x2f3a('0x30')](_0x32e81f[_0x2f3a('0x2f')]);_0x2f9587['filters']=_[_0x2f3a('0x31')](_0x2f9587[_0x2f3a('0x2e')],_0x2f9587[_0x2f3a('0x2f')]);_0x8ecce0['attributes']=_['intersection'](_0x2f9587[_0x2f3a('0x2e')],qs['fields'](_0x32e81f['query'][_0x2f3a('0x32')]));_0x8ecce0[_0x2f3a('0x33')]=_0x8ecce0[_0x2f3a('0x33')][_0x2f3a('0x34')]?_0x8ecce0[_0x2f3a('0x33')]:_0x2f9587[_0x2f3a('0x2e')];if(!_0x32e81f[_0x2f3a('0x2f')][_0x2f3a('0x35')]('nolimit')){_0x8ecce0[_0x2f3a('0x1d')]=qs['limit'](_0x32e81f[_0x2f3a('0x2f')]['limit']);_0x8ecce0[_0x2f3a('0x1c')]=qs[_0x2f3a('0x1c')](_0x32e81f[_0x2f3a('0x2f')][_0x2f3a('0x1c')]);}_0x8ecce0[_0x2f3a('0x36')]=qs['sort'](_0x32e81f[_0x2f3a('0x2f')][_0x2f3a('0x37')]);_0x8ecce0[_0x2f3a('0x38')]=qs[_0x2f3a('0x39')](_[_0x2f3a('0x3a')](_0x32e81f[_0x2f3a('0x2f')],_0x2f9587[_0x2f3a('0x39')]),_0x5a1a0c);if(_0x32e81f[_0x2f3a('0x2f')][_0x2f3a('0x3b')]){_0x8ecce0[_0x2f3a('0x38')]=_['merge'](_0x8ecce0['where'],{'$or':_[_0x2f3a('0x28')](_0x5a1a0c,function(_0x23c3f4){if(_0x23c3f4[_0x2f3a('0x2c')]!==_0x2f3a('0x3c')){var _0x28bfb4={};_0x28bfb4[_0x23c3f4[_0x2f3a('0x25')]]={'$like':'%'+_0x32e81f['query']['filter']+'%'};return _0x28bfb4;}})});}_0x8ecce0=_[_0x2f3a('0x3d')]({},_0x8ecce0,_0x32e81f[_0x2f3a('0x3e')]);var _0x178e50={'where':_0x8ecce0['where']};return db[_0x2f3a('0x29')][_0x2f3a('0x3f')](_0x178e50)[_0x2f3a('0x23')](function(_0x3dd259){_0x48ddca[_0x2f3a('0x3f')]=_0x3dd259;if(_0x32e81f[_0x2f3a('0x2f')][_0x2f3a('0x40')]){_0x8ecce0[_0x2f3a('0x41')]=[{'all':!![]}];}return db[_0x2f3a('0x29')][_0x2f3a('0x42')](_0x8ecce0);})[_0x2f3a('0x23')](function(_0x3d93e4){_0x48ddca[_0x2f3a('0x43')]=_0x3d93e4;return _0x48ddca;})[_0x2f3a('0x23')](respondWithFilteredResult(_0x4a08f6,_0x8ecce0))[_0x2f3a('0x44')](handleError(_0x4a08f6,null));};exports[_0x2f3a('0x45')]=function(_0x137bea,_0x4712e4){var _0x4f32ee={'raw':![],'where':{'id':_0x137bea[_0x2f3a('0x46')]['id']}},_0x4eee4a={};_0x4eee4a[_0x2f3a('0x2e')]=_[_0x2f3a('0x30')](db[_0x2f3a('0x29')][_0x2f3a('0x2a')]);_0x4eee4a[_0x2f3a('0x2f')]=_[_0x2f3a('0x30')](_0x137bea['query']);_0x4eee4a[_0x2f3a('0x39')]=_['intersection'](_0x4eee4a[_0x2f3a('0x2e')],_0x4eee4a['query']);_0x4f32ee[_0x2f3a('0x33')]=_['intersection'](_0x4eee4a[_0x2f3a('0x2e')],qs[_0x2f3a('0x32')](_0x137bea['query'][_0x2f3a('0x32')]));_0x4f32ee[_0x2f3a('0x33')]=_0x4f32ee[_0x2f3a('0x33')][_0x2f3a('0x34')]?_0x4f32ee[_0x2f3a('0x33')]:_0x4eee4a[_0x2f3a('0x2e')];if(_0x137bea[_0x2f3a('0x2f')]['includeAll']){_0x4f32ee[_0x2f3a('0x41')]=[{'all':!![]}];}_0x4f32ee=_[_0x2f3a('0x3d')]({},_0x4f32ee,_0x137bea[_0x2f3a('0x3e')]);return db[_0x2f3a('0x29')][_0x2f3a('0x47')](_0x4f32ee)[_0x2f3a('0x23')](handleEntityNotFound(_0x4712e4,null))[_0x2f3a('0x23')](respondWithResult(_0x4712e4,null))['catch'](handleError(_0x4712e4,null));};exports[_0x2f3a('0x48')]=function(_0x5cfa5c,_0x49289d){return db['AnalyticFieldReport']['create'](_0x5cfa5c[_0x2f3a('0x49')],{})['then'](respondWithResult(_0x49289d,0xc9))[_0x2f3a('0x44')](handleError(_0x49289d,null));};exports[_0x2f3a('0x4a')]=function(_0x23739f,_0x9e6b53){return db['AnalyticFieldReport'][_0x2f3a('0x4a')](_0x23739f[_0x2f3a('0x49')],{'raw':![],'individualHooks':!![]})[_0x2f3a('0x23')](respondWithResult(_0x9e6b53,0xc9))[_0x2f3a('0x44')](handleError(_0x9e6b53,null));};exports[_0x2f3a('0x22')]=function(_0x591732,_0x67955){if(_0x591732[_0x2f3a('0x49')]['id']){delete _0x591732['body']['id'];}return db[_0x2f3a('0x29')]['find']({'where':{'id':_0x591732[_0x2f3a('0x46')]['id']}})[_0x2f3a('0x23')](handleEntityNotFound(_0x67955,null))[_0x2f3a('0x23')](saveUpdates(_0x591732[_0x2f3a('0x49')],null))[_0x2f3a('0x23')](respondWithResult(_0x67955,null))[_0x2f3a('0x44')](handleError(_0x67955,null));};exports[_0x2f3a('0x4b')]=function(_0x3af084,_0x22a2bd){return db[_0x2f3a('0x29')][_0x2f3a('0x47')]({'where':{'id':_0x3af084[_0x2f3a('0x46')]['id']}})[_0x2f3a('0x23')](handleEntityNotFound(_0x22a2bd,null))[_0x2f3a('0x23')](removeEntity(_0x22a2bd,null))[_0x2f3a('0x44')](handleError(_0x22a2bd,null));};exports[_0x2f3a('0x4c')]=function(_0xd243ff,_0x18ad62){return db[_0x2f3a('0x29')][_0x2f3a('0x4b')]({'where':{'id':_0xd243ff[_0x2f3a('0x2f')][_0x2f3a('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x2f3a('0x23')](respondWithResult(_0x18ad62,0xcc))['catch'](handleError(_0x18ad62,null));};exports[_0x2f3a('0x4e')]=function(_0x4f0957,_0x3048a,_0x3c3761){return db[_0x2f3a('0x4f')][_0x2f3a('0x50')]({'where':{'id':_0x4f0957[_0x2f3a('0x46')]['id']}})[_0x2f3a('0x23')](handleEntityNotFound(_0x3048a,null))['then'](function(_0x5e0c59){if(_0x5e0c59){return db[_0x2f3a('0x51')][_0x2f3a('0x52')](function(_0x4a611b){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x4f0957[_0x2f3a('0x46')]['id']},'transaction':_0x4a611b})[_0x2f3a('0x23')](function(_0x2c7c3b){var _0x5983fb=_['map'](_0x4f0957[_0x2f3a('0x49')],function(_0x5a0d1f){delete _0x5a0d1f['id'];_0x5a0d1f[_0x2f3a('0x53')]=_0x4f0957[_0x2f3a('0x46')]['id'];return _0x5a0d1f;});return db[_0x2f3a('0x29')]['bulkCreate'](_0x5983fb,{'transaction':_0x4a611b});});})[_0x2f3a('0x23')](function(){return db['AnalyticFieldReport'][_0x2f3a('0x42')]({'where':{'CustomReportId':_0x4f0957['params']['id']}});});}})[_0x2f3a('0x23')](respondWithResult(_0x3048a,null))[_0x2f3a('0x44')](handleError(_0x3048a,null));}; \ No newline at end of file +var _0xfd43=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','bulkCreate','params','bulkDestroy','addFields','findOne','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where'];(function(_0x210a6c,_0x3ae28b){var _0x20eb37=function(_0x418368){while(--_0x418368){_0x210a6c['push'](_0x210a6c['shift']());}};_0x20eb37(++_0x3ae28b);}(_0xfd43,0xf9));var _0x3fd4=function(_0x17c540,_0x587758){_0x17c540=_0x17c540-0x0;var _0x242bbc=_0xfd43[_0x17c540];return _0x242bbc;};'use strict';var pdf=require(_0x3fd4('0x0'));var emlformat=require(_0x3fd4('0x1'));var rimraf=require(_0x3fd4('0x2'));var zipdir=require(_0x3fd4('0x3'));var jsonpatch=require(_0x3fd4('0x4'));var rp=require(_0x3fd4('0x5'));var moment=require(_0x3fd4('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3fd4('0x7'));var path=require('path');var sox=require(_0x3fd4('0x8'));var csv=require(_0x3fd4('0x9'));var ejs=require(_0x3fd4('0xa'));var fs=require('fs');var _=require(_0x3fd4('0xb'));var squel=require(_0x3fd4('0xc'));var crypto=require(_0x3fd4('0xd'));var jsforce=require(_0x3fd4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3fd4('0xf'));var Redis=require(_0x3fd4('0x10'));var authService=require(_0x3fd4('0x11'));var qs=require(_0x3fd4('0x12'));var as=require(_0x3fd4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3fd4('0x14'));var utils=require(_0x3fd4('0x15'));var config=require(_0x3fd4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fd4('0x17'))['db'];function respondWithStatusCode(_0x227e62,_0x5641d2){_0x5641d2=_0x5641d2||0xcc;return function(_0x499445){if(_0x499445){return _0x227e62[_0x3fd4('0x18')](_0x5641d2);}return _0x227e62[_0x3fd4('0x19')](_0x5641d2)[_0x3fd4('0x1a')]();};}function respondWithResult(_0x574453,_0x487608){_0x487608=_0x487608||0xc8;return function(_0x57b3b4){if(_0x57b3b4){return _0x574453[_0x3fd4('0x19')](_0x487608)[_0x3fd4('0x1b')](_0x57b3b4);}};}function respondWithFilteredResult(_0x290616,_0x35de86){return function(_0x5448e9){if(_0x5448e9){var _0x6b22a9=_0x5448e9[_0x3fd4('0x1c')],_0x59a597=_0x35de86['offset'],_0x32ecfa=_0x35de86[_0x3fd4('0x1d')]+_0x35de86[_0x3fd4('0x1e')],_0x177e98;if(_0x32ecfa>=_0x6b22a9){_0x32ecfa=_0x6b22a9;_0x177e98=0xc8;}else{_0x177e98=0xce;}_0x290616[_0x3fd4('0x19')](_0x177e98);return _0x290616['set']('Content-Range',_0x59a597+'-'+_0x32ecfa+'/'+_0x6b22a9)['json'](_0x5448e9);}return null;};}function patchUpdates(_0x228a3a){return function(_0x10d4cd){try{jsonpatch[_0x3fd4('0x1f')](_0x10d4cd,_0x228a3a,!![]);}catch(_0x2f4a7a){return BPromise[_0x3fd4('0x20')](_0x2f4a7a);}return _0x10d4cd['save']();};}function saveUpdates(_0x25b243,_0x2c16a3){return function(_0x34ab38){if(_0x34ab38){return _0x34ab38[_0x3fd4('0x21')](_0x25b243)[_0x3fd4('0x22')](function(_0x35caf4){return _0x35caf4;});}return null;};}function removeEntity(_0x1e941e,_0x18f18a){return function(_0x209182){if(_0x209182){return _0x209182[_0x3fd4('0x23')]()[_0x3fd4('0x22')](function(){_0x1e941e['status'](0xcc)[_0x3fd4('0x1a')]();});}};}function handleEntityNotFound(_0x5ce12b,_0x152f27){return function(_0x1f84d1){if(!_0x1f84d1){_0x5ce12b['sendStatus'](0x194);}return _0x1f84d1;};}function handleError(_0x555220,_0x5d7713){_0x5d7713=_0x5d7713||0x1f4;return function(_0x320c4b){logger[_0x3fd4('0x24')](_0x320c4b[_0x3fd4('0x25')]);if(_0x320c4b[_0x3fd4('0x26')]){delete _0x320c4b[_0x3fd4('0x26')];}_0x555220['status'](_0x5d7713)[_0x3fd4('0x27')](_0x320c4b);};}exports['index']=function(_0x23de37,_0x22a1bf){var _0x4634c1={},_0xaf16ea={},_0x2de9a4={'count':0x0,'rows':[]};var _0x1c18d8=_[_0x3fd4('0x28')](db[_0x3fd4('0x29')][_0x3fd4('0x2a')],function(_0x3add67){return{'name':_0x3add67[_0x3fd4('0x2b')],'type':_0x3add67[_0x3fd4('0x2c')][_0x3fd4('0x2d')]};});_0xaf16ea[_0x3fd4('0x2e')]=_['map'](_0x1c18d8,'name');_0xaf16ea[_0x3fd4('0x2f')]=_[_0x3fd4('0x30')](_0x23de37[_0x3fd4('0x2f')]);_0xaf16ea['filters']=_[_0x3fd4('0x31')](_0xaf16ea['model'],_0xaf16ea[_0x3fd4('0x2f')]);_0x4634c1[_0x3fd4('0x32')]=_[_0x3fd4('0x31')](_0xaf16ea[_0x3fd4('0x2e')],qs[_0x3fd4('0x33')](_0x23de37['query'][_0x3fd4('0x33')]));_0x4634c1[_0x3fd4('0x32')]=_0x4634c1[_0x3fd4('0x32')][_0x3fd4('0x34')]?_0x4634c1[_0x3fd4('0x32')]:_0xaf16ea['model'];if(!_0x23de37[_0x3fd4('0x2f')][_0x3fd4('0x35')](_0x3fd4('0x36'))){_0x4634c1['limit']=qs[_0x3fd4('0x1e')](_0x23de37[_0x3fd4('0x2f')]['limit']);_0x4634c1[_0x3fd4('0x1d')]=qs['offset'](_0x23de37[_0x3fd4('0x2f')][_0x3fd4('0x1d')]);}_0x4634c1['order']=qs[_0x3fd4('0x37')](_0x23de37[_0x3fd4('0x2f')][_0x3fd4('0x37')]);_0x4634c1['where']=qs[_0x3fd4('0x38')](_['pick'](_0x23de37['query'],_0xaf16ea['filters']),_0x1c18d8);if(_0x23de37[_0x3fd4('0x2f')][_0x3fd4('0x39')]){_0x4634c1[_0x3fd4('0x3a')]=_[_0x3fd4('0x3b')](_0x4634c1['where'],{'$or':_['map'](_0x1c18d8,function(_0x12a7d2){if(_0x12a7d2[_0x3fd4('0x2c')]!==_0x3fd4('0x3c')){var _0x5c4edf={};_0x5c4edf[_0x12a7d2[_0x3fd4('0x26')]]={'$like':'%'+_0x23de37['query']['filter']+'%'};return _0x5c4edf;}})});}_0x4634c1=_['merge']({},_0x4634c1,_0x23de37[_0x3fd4('0x3d')]);var _0x45ddfa={'where':_0x4634c1[_0x3fd4('0x3a')]};return db[_0x3fd4('0x29')]['count'](_0x45ddfa)[_0x3fd4('0x22')](function(_0x3c7d6a){_0x2de9a4[_0x3fd4('0x1c')]=_0x3c7d6a;if(_0x23de37[_0x3fd4('0x2f')][_0x3fd4('0x3e')]){_0x4634c1[_0x3fd4('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x3fd4('0x40')](_0x4634c1);})[_0x3fd4('0x22')](function(_0x4c65f4){_0x2de9a4[_0x3fd4('0x41')]=_0x4c65f4;return _0x2de9a4;})['then'](respondWithFilteredResult(_0x22a1bf,_0x4634c1))['catch'](handleError(_0x22a1bf,null));};exports[_0x3fd4('0x42')]=function(_0x3f49e8,_0x48baa1){var _0x2bc33f={'raw':![],'where':{'id':_0x3f49e8['params']['id']}},_0x42ecd3={};_0x42ecd3[_0x3fd4('0x2e')]=_[_0x3fd4('0x30')](db['AnalyticFieldReport'][_0x3fd4('0x2a')]);_0x42ecd3[_0x3fd4('0x2f')]=_['keys'](_0x3f49e8[_0x3fd4('0x2f')]);_0x42ecd3[_0x3fd4('0x38')]=_['intersection'](_0x42ecd3[_0x3fd4('0x2e')],_0x42ecd3[_0x3fd4('0x2f')]);_0x2bc33f[_0x3fd4('0x32')]=_[_0x3fd4('0x31')](_0x42ecd3[_0x3fd4('0x2e')],qs[_0x3fd4('0x33')](_0x3f49e8['query']['fields']));_0x2bc33f[_0x3fd4('0x32')]=_0x2bc33f[_0x3fd4('0x32')]['length']?_0x2bc33f[_0x3fd4('0x32')]:_0x42ecd3[_0x3fd4('0x2e')];if(_0x3f49e8[_0x3fd4('0x2f')][_0x3fd4('0x3e')]){_0x2bc33f[_0x3fd4('0x3f')]=[{'all':!![]}];}_0x2bc33f=_[_0x3fd4('0x3b')]({},_0x2bc33f,_0x3f49e8[_0x3fd4('0x3d')]);return db[_0x3fd4('0x29')][_0x3fd4('0x43')](_0x2bc33f)[_0x3fd4('0x22')](handleEntityNotFound(_0x48baa1,null))[_0x3fd4('0x22')](respondWithResult(_0x48baa1,null))[_0x3fd4('0x44')](handleError(_0x48baa1,null));};exports[_0x3fd4('0x45')]=function(_0x29a8b7,_0x22eead){return db[_0x3fd4('0x29')][_0x3fd4('0x45')](_0x29a8b7[_0x3fd4('0x46')],{})['then'](respondWithResult(_0x22eead,0xc9))['catch'](handleError(_0x22eead,null));};exports[_0x3fd4('0x47')]=function(_0x5e6d50,_0x3a9588){return db[_0x3fd4('0x29')]['bulkCreate'](_0x5e6d50[_0x3fd4('0x46')],{'raw':![],'individualHooks':!![]})[_0x3fd4('0x22')](respondWithResult(_0x3a9588,0xc9))['catch'](handleError(_0x3a9588,null));};exports[_0x3fd4('0x21')]=function(_0x4b90d4,_0x2a01d5){if(_0x4b90d4['body']['id']){delete _0x4b90d4[_0x3fd4('0x46')]['id'];}return db['AnalyticFieldReport'][_0x3fd4('0x43')]({'where':{'id':_0x4b90d4[_0x3fd4('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a01d5,null))[_0x3fd4('0x22')](saveUpdates(_0x4b90d4[_0x3fd4('0x46')],null))[_0x3fd4('0x22')](respondWithResult(_0x2a01d5,null))[_0x3fd4('0x44')](handleError(_0x2a01d5,null));};exports[_0x3fd4('0x23')]=function(_0x39f822,_0x4bb5f8){return db[_0x3fd4('0x29')][_0x3fd4('0x43')]({'where':{'id':_0x39f822['params']['id']}})['then'](handleEntityNotFound(_0x4bb5f8,null))[_0x3fd4('0x22')](removeEntity(_0x4bb5f8,null))[_0x3fd4('0x44')](handleError(_0x4bb5f8,null));};exports[_0x3fd4('0x49')]=function(_0x58ca8c,_0x281190){return db[_0x3fd4('0x29')][_0x3fd4('0x23')]({'where':{'id':_0x58ca8c[_0x3fd4('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3fd4('0x22')](respondWithResult(_0x281190,0xcc))[_0x3fd4('0x44')](handleError(_0x281190,null));};exports[_0x3fd4('0x4a')]=function(_0x3ece83,_0x1ccd55,_0x2cf0f3){return db['AnalyticCustomReport'][_0x3fd4('0x4b')]({'where':{'id':_0x3ece83[_0x3fd4('0x48')]['id']}})[_0x3fd4('0x22')](handleEntityNotFound(_0x1ccd55,null))[_0x3fd4('0x22')](function(_0x12f6f4){if(_0x12f6f4){return db['sequelize'][_0x3fd4('0x4c')](function(_0x5053cf){return db['AnalyticFieldReport'][_0x3fd4('0x23')]({'where':{'CustomReportId':_0x3ece83[_0x3fd4('0x48')]['id']},'transaction':_0x5053cf})[_0x3fd4('0x22')](function(_0x4cbf2e){var _0x4c67de=_['map'](_0x3ece83[_0x3fd4('0x46')],function(_0x27d9df){delete _0x27d9df['id'];_0x27d9df['CustomReportId']=_0x3ece83['params']['id'];return _0x27d9df;});return db[_0x3fd4('0x29')][_0x3fd4('0x47')](_0x4c67de,{'transaction':_0x5053cf});});})['then'](function(){return db['AnalyticFieldReport'][_0x3fd4('0x40')]({'where':{'CustomReportId':_0x3ece83['params']['id']}});});}})[_0x3fd4('0x22')](respondWithResult(_0x1ccd55,null))[_0x3fd4('0x44')](handleError(_0x1ccd55,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a5de5ec..3981e18 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 _0xa75b=['moment','bluebird','request-promise','path','./analyticFieldReport.attributes','exports','lodash','../../config/logger','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa75b,0x19b));var _0xba75=function(_0x5b4228,_0x14d7ae){_0x5b4228=_0x5b4228-0x0;var _0xa0e4f5=_0xa75b[_0x5b4228];return _0xa0e4f5;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require(_0xba75('0x1'))(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var rp=require(_0xba75('0x5'));var fs=require('fs');var path=require(_0xba75('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba75('0x7'));module[_0xba75('0x8')]=function(_0x18d0e3,_0x53f8bf){return _0x18d0e3['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3096=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','analytics_report_fields','lodash','util'];(function(_0x2286d3,_0x40bb85){var _0x39d1a8=function(_0x185a32){while(--_0x185a32){_0x2286d3['push'](_0x2286d3['shift']());}};_0x39d1a8(++_0x40bb85);}(_0x3096,0x80));var _0x6309=function(_0x4143ee,_0x4d6aef){_0x4143ee=_0x4143ee-0x0;var _0x5eb013=_0x3096[_0x4143ee];return _0x5eb013;};'use strict';var _=require(_0x6309('0x0'));var util=require(_0x6309('0x1'));var logger=require(_0x6309('0x2'))('api');var moment=require(_0x6309('0x3'));var BPromise=require(_0x6309('0x4'));var rp=require(_0x6309('0x5'));var fs=require('fs');var path=require(_0x6309('0x6'));var rimraf=require(_0x6309('0x7'));var config=require(_0x6309('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0xd467c0,_0x4a42f9){return _0xd467c0['define']('AnalyticFieldReport',attributes,{'tableName':_0x6309('0x9'),'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 6080128..ce48a00 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 _0x5ffe=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5ffe,0x1c0));var _0xe5ff=function(_0x5a8756,_0xb886f4){_0x5a8756=_0x5a8756-0x0;var _0x73d83a=_0x5ffe[_0x5a8756];return _0x73d83a;};'use strict';var _=require(_0xe5ff('0x0'));var util=require(_0xe5ff('0x1'));var moment=require(_0xe5ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5ff('0x3'));var fs=require('fs');var Redis=require(_0xe5ff('0x4'));var db=require(_0xe5ff('0x5'))['db'];var utils=require(_0xe5ff('0x6'));var logger=require(_0xe5ff('0x7'))(_0xe5ff('0x8'));var config=require(_0xe5ff('0x9'));var jayson=require(_0xe5ff('0xa'));var client=jayson[_0xe5ff('0xb')][_0xe5ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30e521,_0x1d96ca,_0x410988){return new BPromise(function(_0x1c2ae4,_0x2ac7d5){return client[_0xe5ff('0xd')](_0x30e521,_0x410988)[_0xe5ff('0xe')](function(_0x5b447d){logger[_0xe5ff('0xf')](_0xe5ff('0x10'),_0x1d96ca,_0xe5ff('0x11'));logger[_0xe5ff('0x12')](_0xe5ff('0x13'),_0x1d96ca,_0xe5ff('0x11'),JSON['stringify'](_0x5b447d));if(_0x5b447d[_0xe5ff('0x14')]){if(_0x5b447d[_0xe5ff('0x14')]['code']===0x1f4){logger[_0xe5ff('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d96ca,_0x5b447d[_0xe5ff('0x14')]['message']);return _0x2ac7d5(_0x5b447d[_0xe5ff('0x14')][_0xe5ff('0x15')]);}logger[_0xe5ff('0x14')](_0xe5ff('0x10'),_0x1d96ca,_0x5b447d[_0xe5ff('0x14')][_0xe5ff('0x15')]);return _0x1c2ae4(_0x5b447d[_0xe5ff('0x14')]['message']);}else{logger[_0xe5ff('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d96ca,_0xe5ff('0x11'));_0x1c2ae4(_0x5b447d['result'][_0xe5ff('0x15')]);}})[_0xe5ff('0x16')](function(_0x179aed){logger[_0xe5ff('0x14')](_0xe5ff('0x10'),_0x1d96ca,_0x179aed);_0x2ac7d5(_0x179aed);});});} \ No newline at end of file +var _0x4cc6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x4cc6,0xd9));var _0x64cc=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x4cc6[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x64cc('0x0'));var util=require(_0x64cc('0x1'));var moment=require(_0x64cc('0x2'));var BPromise=require(_0x64cc('0x3'));var rs=require(_0x64cc('0x4'));var fs=require('fs');var Redis=require(_0x64cc('0x5'));var db=require(_0x64cc('0x6'))['db'];var utils=require(_0x64cc('0x7'));var logger=require('../../config/logger')(_0x64cc('0x8'));var config=require(_0x64cc('0x9'));var jayson=require(_0x64cc('0xa'));var client=jayson['client'][_0x64cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x254374,_0x227e0d,_0x7c0aa4){return new BPromise(function(_0x346368,_0x40ce39){return client[_0x64cc('0xc')](_0x254374,_0x7c0aa4)[_0x64cc('0xd')](function(_0x233659){logger['info'](_0x64cc('0xe'),_0x227e0d,_0x64cc('0xf'));logger[_0x64cc('0x10')](_0x64cc('0x11'),_0x227e0d,_0x64cc('0xf'),JSON[_0x64cc('0x12')](_0x233659));if(_0x233659[_0x64cc('0x13')]){if(_0x233659['error']['code']===0x1f4){logger[_0x64cc('0x13')](_0x64cc('0xe'),_0x227e0d,_0x233659[_0x64cc('0x13')]['message']);return _0x40ce39(_0x233659[_0x64cc('0x13')][_0x64cc('0x14')]);}logger['error'](_0x64cc('0xe'),_0x227e0d,_0x233659[_0x64cc('0x13')][_0x64cc('0x14')]);return _0x346368(_0x233659['error'][_0x64cc('0x14')]);}else{logger[_0x64cc('0x15')](_0x64cc('0xe'),_0x227e0d,_0x64cc('0xf'));_0x346368(_0x233659[_0x64cc('0x16')][_0x64cc('0x14')]);}})[_0x64cc('0x17')](function(_0x3562c7){logger[_0x64cc('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x227e0d,_0x3562c7);_0x40ce39(_0x3562c7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3785e52..b25c361 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 _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x756e9,_0xc02466){var _0x243653=function(_0x4dc96f){while(--_0x4dc96f){_0x756e9['push'](_0x756e9['shift']());}};_0x243653(++_0xc02466);}(_0xe14b,0x93));var _0xbe14=function(_0x481a3c,_0x187121){_0x481a3c=_0x481a3c-0x0;var _0x4284ce=_0xe14b[_0x481a3c];return _0x4284ce;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'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 auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 57cbbcd..6f2ad5d 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 _0xb447=['name','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb447,0xd5));var _0x7b44=function(_0x2a4a7f,_0x41204e){_0x2a4a7f=_0x2a4a7f-0x0;var _0x2104df=_0xb447[_0x2a4a7f];return _0x2104df;};'use strict';var Sequelize=require(_0x7b44('0x0'));module[_0x7b44('0x1')]={'name':{'type':Sequelize[_0x7b44('0x2')],'allowNull':![],'unique':_0x7b44('0x3')},'table':{'type':Sequelize[_0x7b44('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c50=['TEXT','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8c50,0xcd));var _0x08c5=function(_0x36722c,_0x4017b6){_0x36722c=_0x36722c-0x0;var _0x40d2aa=_0x8c50[_0x36722c];return _0x40d2aa;};'use strict';var Sequelize=require('sequelize');module[_0x08c5('0x0')]={'name':{'type':Sequelize[_0x08c5('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x08c5('0x1')]},'metric':{'type':Sequelize[_0x08c5('0x2')]},'description':{'type':Sequelize[_0x08c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 99ee593..caa926a 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 _0x8e23=['update','destroy','then','get','Metrics','UserProfileResource','end','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject'];(function(_0x13f03f,_0xc4546b){var _0x5253d0=function(_0x4d2c93){while(--_0x4d2c93){_0x13f03f['push'](_0x13f03f['shift']());}};_0x5253d0(++_0xc4546b);}(_0x8e23,0x80));var _0x38e2=function(_0xbba55c,_0x45fb1f){_0xbba55c=_0xbba55c-0x0;var _0x41aa53=_0x8e23[_0xbba55c];return _0x41aa53;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x38e2('0x0'));var rimraf=require(_0x38e2('0x1'));var zipdir=require(_0x38e2('0x2'));var jsonpatch=require(_0x38e2('0x3'));var rp=require(_0x38e2('0x4'));var moment=require('moment');var BPromise=require(_0x38e2('0x5'));var Mustache=require(_0x38e2('0x6'));var util=require(_0x38e2('0x7'));var path=require(_0x38e2('0x8'));var sox=require('sox');var csv=require(_0x38e2('0x9'));var ejs=require(_0x38e2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38e2('0xb'));var crypto=require('crypto');var jsforce=require(_0x38e2('0xc'));var deskjs=require(_0x38e2('0xd'));var toCsv=require(_0x38e2('0x9'));var querystring=require(_0x38e2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38e2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x38e2('0x10'));var hardwareService=require(_0x38e2('0x11'));var logger=require(_0x38e2('0x12'))(_0x38e2('0x13'));var utils=require(_0x38e2('0x14'));var config=require(_0x38e2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x38e2('0x16'))['db'];function respondWithStatusCode(_0x208f61,_0x19aac7){_0x19aac7=_0x19aac7||0xcc;return function(_0x22e4ff){if(_0x22e4ff){return _0x208f61[_0x38e2('0x17')](_0x19aac7);}return _0x208f61[_0x38e2('0x18')](_0x19aac7)['end']();};}function respondWithResult(_0x37b39b,_0x25a371){_0x25a371=_0x25a371||0xc8;return function(_0x18f62b){if(_0x18f62b){return _0x37b39b['status'](_0x25a371)[_0x38e2('0x19')](_0x18f62b);}};}function respondWithFilteredResult(_0x35d934,_0x1c15c9){return function(_0x4fd0ee){if(_0x4fd0ee){var _0x53bb6b=_0x4fd0ee['count'],_0x2414f5=_0x1c15c9[_0x38e2('0x1a')],_0x147a95=_0x1c15c9[_0x38e2('0x1a')]+_0x1c15c9[_0x38e2('0x1b')],_0x554d2a;if(_0x147a95>=_0x53bb6b){_0x147a95=_0x53bb6b;_0x554d2a=0xc8;}else{_0x554d2a=0xce;}_0x35d934['status'](_0x554d2a);return _0x35d934['set'](_0x38e2('0x1c'),_0x2414f5+'-'+_0x147a95+'/'+_0x53bb6b)[_0x38e2('0x19')](_0x4fd0ee);}return null;};}function patchUpdates(_0x22e2c1){return function(_0x4da258){try{jsonpatch['apply'](_0x4da258,_0x22e2c1,!![]);}catch(_0x2b30c0){return BPromise[_0x38e2('0x1d')](_0x2b30c0);}return _0x4da258['save']();};}function saveUpdates(_0x918c72,_0x722636){return function(_0x43ca81){if(_0x43ca81){return _0x43ca81[_0x38e2('0x1e')](_0x918c72)['then'](function(_0x464257){return _0x464257;});}return null;};}function removeEntity(_0x5481df,_0x2c18fb){return function(_0x55f5c6){if(_0x55f5c6){return _0x55f5c6[_0x38e2('0x1f')]()[_0x38e2('0x20')](function(){var _0xebb829=_0x55f5c6[_0x38e2('0x21')]({'plain':!![]});var _0x3ee082=_0x38e2('0x22');return db[_0x38e2('0x23')][_0x38e2('0x1f')]({'where':{'type':_0x3ee082,'resourceId':_0xebb829['id']}})[_0x38e2('0x20')](function(){return _0x55f5c6;});})[_0x38e2('0x20')](function(){_0x5481df[_0x38e2('0x18')](0xcc)[_0x38e2('0x24')]();});}};}function handleEntityNotFound(_0x197ec5,_0x381c91){return function(_0x1253ef){if(!_0x1253ef){_0x197ec5['sendStatus'](0x194);}return _0x1253ef;};}function handleError(_0x55901c,_0x3297b7){_0x3297b7=_0x3297b7||0x1f4;return function(_0xd69f06){logger['error'](_0xd69f06['stack']);if(_0xd69f06[_0x38e2('0x25')]){delete _0xd69f06[_0x38e2('0x25')];}_0x55901c['status'](_0x3297b7)['send'](_0xd69f06);};}exports[_0x38e2('0x26')]=function(_0x2d2731,_0x3be71c){var _0x21f2c4={},_0x2e6888={},_0x2744c7={'count':0x0,'rows':[]};var _0x81e4db=_[_0x38e2('0x27')](db[_0x38e2('0x28')][_0x38e2('0x29')],function(_0x2fd9e6){return{'name':_0x2fd9e6[_0x38e2('0x2a')],'type':_0x2fd9e6[_0x38e2('0x2b')]['key']};});_0x2e6888[_0x38e2('0x2c')]=_[_0x38e2('0x27')](_0x81e4db,_0x38e2('0x25'));_0x2e6888['query']=_[_0x38e2('0x2d')](_0x2d2731[_0x38e2('0x2e')]);_0x2e6888[_0x38e2('0x2f')]=_[_0x38e2('0x30')](_0x2e6888['model'],_0x2e6888[_0x38e2('0x2e')]);_0x21f2c4[_0x38e2('0x31')]=_[_0x38e2('0x30')](_0x2e6888['model'],qs[_0x38e2('0x32')](_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x32')]));_0x21f2c4[_0x38e2('0x31')]=_0x21f2c4[_0x38e2('0x31')][_0x38e2('0x33')]?_0x21f2c4[_0x38e2('0x31')]:_0x2e6888['model'];if(!_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x34')](_0x38e2('0x35'))){_0x21f2c4[_0x38e2('0x1b')]=qs[_0x38e2('0x1b')](_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x1b')]);_0x21f2c4[_0x38e2('0x1a')]=qs[_0x38e2('0x1a')](_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x1a')]);}_0x21f2c4[_0x38e2('0x36')]=qs[_0x38e2('0x37')](_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x37')]);_0x21f2c4[_0x38e2('0x38')]=qs[_0x38e2('0x2f')](_[_0x38e2('0x39')](_0x2d2731[_0x38e2('0x2e')],_0x2e6888[_0x38e2('0x2f')]),_0x81e4db);if(_0x2d2731[_0x38e2('0x2e')]['filter']){_0x21f2c4[_0x38e2('0x38')]=_[_0x38e2('0x3a')](_0x21f2c4[_0x38e2('0x38')],{'$or':_[_0x38e2('0x27')](_0x81e4db,function(_0x249a06){if(_0x249a06[_0x38e2('0x2b')]!=='VIRTUAL'){var _0x38bd5f={};_0x38bd5f[_0x249a06['name']]={'$like':'%'+_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x3b')]+'%'};return _0x38bd5f;}})});}_0x21f2c4=_[_0x38e2('0x3a')]({},_0x21f2c4,_0x2d2731[_0x38e2('0x3c')]);var _0x5d66ce={'where':_0x21f2c4[_0x38e2('0x38')]};return db[_0x38e2('0x28')][_0x38e2('0x3d')](_0x5d66ce)[_0x38e2('0x20')](function(_0x5455c9){_0x2744c7['count']=_0x5455c9;if(_0x2d2731[_0x38e2('0x2e')][_0x38e2('0x3e')]){_0x21f2c4[_0x38e2('0x3f')]=[{'all':!![]}];}return db[_0x38e2('0x28')][_0x38e2('0x40')](_0x21f2c4);})[_0x38e2('0x20')](function(_0x590059){_0x2744c7[_0x38e2('0x41')]=_0x590059;return _0x2744c7;})['then'](respondWithFilteredResult(_0x3be71c,_0x21f2c4))[_0x38e2('0x42')](handleError(_0x3be71c,null));};exports[_0x38e2('0x43')]=function(_0x2b25b2,_0x5225d7){var _0x57192c={'raw':!![],'where':{'id':_0x2b25b2['params']['id']}},_0x363ef5={};_0x363ef5['model']=_[_0x38e2('0x2d')](db[_0x38e2('0x28')][_0x38e2('0x29')]);_0x363ef5[_0x38e2('0x2e')]=_[_0x38e2('0x2d')](_0x2b25b2[_0x38e2('0x2e')]);_0x363ef5[_0x38e2('0x2f')]=_[_0x38e2('0x30')](_0x363ef5[_0x38e2('0x2c')],_0x363ef5[_0x38e2('0x2e')]);_0x57192c[_0x38e2('0x31')]=_['intersection'](_0x363ef5[_0x38e2('0x2c')],qs[_0x38e2('0x32')](_0x2b25b2[_0x38e2('0x2e')]['fields']));_0x57192c[_0x38e2('0x31')]=_0x57192c['attributes'][_0x38e2('0x33')]?_0x57192c[_0x38e2('0x31')]:_0x363ef5['model'];if(_0x2b25b2[_0x38e2('0x2e')][_0x38e2('0x3e')]){_0x57192c[_0x38e2('0x3f')]=[{'all':!![]}];}_0x57192c=_[_0x38e2('0x3a')]({},_0x57192c,_0x2b25b2[_0x38e2('0x3c')]);return db['AnalyticMetric'][_0x38e2('0x44')](_0x57192c)[_0x38e2('0x20')](handleEntityNotFound(_0x5225d7,null))[_0x38e2('0x20')](respondWithResult(_0x5225d7,null))['catch'](handleError(_0x5225d7,null));};exports[_0x38e2('0x45')]=function(_0xbaea5b,_0x3cd286){return db[_0x38e2('0x28')][_0x38e2('0x45')](_0xbaea5b[_0x38e2('0x46')],{})['then'](function(_0x17828f){var _0x1f51d2=_0xbaea5b[_0x38e2('0x47')][_0x38e2('0x21')]({'plain':!![]});if(!_0x1f51d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f51d2[_0x38e2('0x48')]===_0x38e2('0x47')){var _0x5a7d4d=_0x17828f['get']({'plain':!![]});var _0x3ae6f9=_0x38e2('0x22');return db[_0x38e2('0x49')][_0x38e2('0x44')]({'where':{'name':_0x3ae6f9,'userProfileId':_0x1f51d2[_0x38e2('0x4a')]},'raw':!![]})[_0x38e2('0x20')](function(_0x2a2c67){if(_0x2a2c67&&_0x2a2c67[_0x38e2('0x4b')]===0x0){return db[_0x38e2('0x23')][_0x38e2('0x45')]({'name':_0x5a7d4d['name'],'resourceId':_0x5a7d4d['id'],'type':_0x2a2c67['name'],'sectionId':_0x2a2c67['id']},{})['then'](function(){return _0x17828f;});}else{return _0x17828f;}})['catch'](function(_0x108634){logger[_0x38e2('0x4c')](_0x38e2('0x4d'),_0x108634);throw _0x108634;});}return _0x17828f;})[_0x38e2('0x20')](respondWithResult(_0x3cd286,0xc9))[_0x38e2('0x42')](handleError(_0x3cd286,null));};exports[_0x38e2('0x1e')]=function(_0x442c69,_0x1e1366){if(_0x442c69['body']['id']){delete _0x442c69[_0x38e2('0x46')]['id'];}return db[_0x38e2('0x28')][_0x38e2('0x44')]({'where':{'id':_0x442c69[_0x38e2('0x4e')]['id']}})[_0x38e2('0x20')](handleEntityNotFound(_0x1e1366,null))[_0x38e2('0x20')](saveUpdates(_0x442c69[_0x38e2('0x46')],null))[_0x38e2('0x20')](respondWithResult(_0x1e1366,null))[_0x38e2('0x42')](handleError(_0x1e1366,null));};exports[_0x38e2('0x1f')]=function(_0x4d2c52,_0x59f044){return db['AnalyticMetric'][_0x38e2('0x44')]({'where':{'id':_0x4d2c52[_0x38e2('0x4e')]['id']}})[_0x38e2('0x20')](handleEntityNotFound(_0x59f044,null))[_0x38e2('0x20')](removeEntity(_0x59f044,null))[_0x38e2('0x42')](handleError(_0x59f044,null));}; \ No newline at end of file +var _0xca4c=['AnalyticMetric','rawAttributes','type','model','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','name','send','index','map'];(function(_0x19c6ed,_0x45860d){var _0xb36e60=function(_0x154391){while(--_0x154391){_0x19c6ed['push'](_0x19c6ed['shift']());}};_0xb36e60(++_0x45860d);}(_0xca4c,0x70));var _0xcca4=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xca4c[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0xcca4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcca4('0x1'));var zipdir=require(_0xcca4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcca4('0x3'));var moment=require(_0xcca4('0x4'));var BPromise=require(_0xcca4('0x5'));var Mustache=require(_0xcca4('0x6'));var util=require(_0xcca4('0x7'));var path=require(_0xcca4('0x8'));var sox=require(_0xcca4('0x9'));var csv=require(_0xcca4('0xa'));var ejs=require(_0xcca4('0xb'));var fs=require('fs');var _=require(_0xcca4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcca4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcca4('0xe'));var qs=require(_0xcca4('0xf'));var as=require(_0xcca4('0x10'));var hardwareService=require(_0xcca4('0x11'));var logger=require(_0xcca4('0x12'))(_0xcca4('0x13'));var utils=require('../../config/utils');var config=require(_0xcca4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcca4('0x15'))['db'];function respondWithStatusCode(_0x123b14,_0xd39fb5){_0xd39fb5=_0xd39fb5||0xcc;return function(_0x3aa56e){if(_0x3aa56e){return _0x123b14['sendStatus'](_0xd39fb5);}return _0x123b14[_0xcca4('0x16')](_0xd39fb5)[_0xcca4('0x17')]();};}function respondWithResult(_0x3154ab,_0xc19644){_0xc19644=_0xc19644||0xc8;return function(_0x5f2dc6){if(_0x5f2dc6){return _0x3154ab['status'](_0xc19644)[_0xcca4('0x18')](_0x5f2dc6);}};}function respondWithFilteredResult(_0x3b1136,_0x54f45c){return function(_0x3f2afa){if(_0x3f2afa){var _0x2b6789=_0x3f2afa[_0xcca4('0x19')],_0x303822=_0x54f45c[_0xcca4('0x1a')],_0x25aaeb=_0x54f45c[_0xcca4('0x1a')]+_0x54f45c['limit'],_0x186708;if(_0x25aaeb>=_0x2b6789){_0x25aaeb=_0x2b6789;_0x186708=0xc8;}else{_0x186708=0xce;}_0x3b1136[_0xcca4('0x16')](_0x186708);return _0x3b1136[_0xcca4('0x1b')](_0xcca4('0x1c'),_0x303822+'-'+_0x25aaeb+'/'+_0x2b6789)[_0xcca4('0x18')](_0x3f2afa);}return null;};}function patchUpdates(_0xe4b798){return function(_0x427247){try{jsonpatch[_0xcca4('0x1d')](_0x427247,_0xe4b798,!![]);}catch(_0x25e0d2){return BPromise[_0xcca4('0x1e')](_0x25e0d2);}return _0x427247[_0xcca4('0x1f')]();};}function saveUpdates(_0x45e486,_0x16e0f0){return function(_0x3a41d1){if(_0x3a41d1){return _0x3a41d1[_0xcca4('0x20')](_0x45e486)[_0xcca4('0x21')](function(_0x3bb1d3){return _0x3bb1d3;});}return null;};}function removeEntity(_0x31235a,_0x3a841b){return function(_0x4a2be9){if(_0x4a2be9){return _0x4a2be9[_0xcca4('0x22')]()[_0xcca4('0x21')](function(){var _0x5f40e0=_0x4a2be9[_0xcca4('0x23')]({'plain':!![]});var _0x47ff3b=_0xcca4('0x24');return db[_0xcca4('0x25')][_0xcca4('0x22')]({'where':{'type':_0x47ff3b,'resourceId':_0x5f40e0['id']}})[_0xcca4('0x21')](function(){return _0x4a2be9;});})[_0xcca4('0x21')](function(){_0x31235a[_0xcca4('0x16')](0xcc)[_0xcca4('0x17')]();});}};}function handleEntityNotFound(_0x3dfe00,_0x257ec5){return function(_0x3270fc){if(!_0x3270fc){_0x3dfe00[_0xcca4('0x26')](0x194);}return _0x3270fc;};}function handleError(_0x4a86b8,_0x147fbb){_0x147fbb=_0x147fbb||0x1f4;return function(_0x389ff7){logger[_0xcca4('0x27')](_0x389ff7['stack']);if(_0x389ff7[_0xcca4('0x28')]){delete _0x389ff7[_0xcca4('0x28')];}_0x4a86b8[_0xcca4('0x16')](_0x147fbb)[_0xcca4('0x29')](_0x389ff7);};}exports[_0xcca4('0x2a')]=function(_0x1a4f08,_0x1d599e){var _0x18fc1a={},_0x38a36f={},_0x1ad684={'count':0x0,'rows':[]};var _0x301fae=_[_0xcca4('0x2b')](db[_0xcca4('0x2c')][_0xcca4('0x2d')],function(_0x3d79fd){return{'name':_0x3d79fd['fieldName'],'type':_0x3d79fd[_0xcca4('0x2e')]['key']};});_0x38a36f[_0xcca4('0x2f')]=_[_0xcca4('0x2b')](_0x301fae,'name');_0x38a36f[_0xcca4('0x30')]=_['keys'](_0x1a4f08[_0xcca4('0x30')]);_0x38a36f[_0xcca4('0x31')]=_['intersection'](_0x38a36f[_0xcca4('0x2f')],_0x38a36f['query']);_0x18fc1a[_0xcca4('0x32')]=_[_0xcca4('0x33')](_0x38a36f['model'],qs[_0xcca4('0x34')](_0x1a4f08['query'][_0xcca4('0x34')]));_0x18fc1a[_0xcca4('0x32')]=_0x18fc1a['attributes']['length']?_0x18fc1a['attributes']:_0x38a36f[_0xcca4('0x2f')];if(!_0x1a4f08['query']['hasOwnProperty'](_0xcca4('0x35'))){_0x18fc1a['limit']=qs['limit'](_0x1a4f08['query'][_0xcca4('0x36')]);_0x18fc1a[_0xcca4('0x1a')]=qs[_0xcca4('0x1a')](_0x1a4f08[_0xcca4('0x30')][_0xcca4('0x1a')]);}_0x18fc1a[_0xcca4('0x37')]=qs['sort'](_0x1a4f08[_0xcca4('0x30')][_0xcca4('0x38')]);_0x18fc1a[_0xcca4('0x39')]=qs[_0xcca4('0x31')](_['pick'](_0x1a4f08[_0xcca4('0x30')],_0x38a36f[_0xcca4('0x31')]),_0x301fae);if(_0x1a4f08['query']['filter']){_0x18fc1a['where']=_[_0xcca4('0x3a')](_0x18fc1a[_0xcca4('0x39')],{'$or':_[_0xcca4('0x2b')](_0x301fae,function(_0x6fbc9c){if(_0x6fbc9c[_0xcca4('0x2e')]!==_0xcca4('0x3b')){var _0x4db985={};_0x4db985[_0x6fbc9c['name']]={'$like':'%'+_0x1a4f08['query'][_0xcca4('0x3c')]+'%'};return _0x4db985;}})});}_0x18fc1a=_[_0xcca4('0x3a')]({},_0x18fc1a,_0x1a4f08[_0xcca4('0x3d')]);var _0x1e3636={'where':_0x18fc1a['where']};return db[_0xcca4('0x2c')]['count'](_0x1e3636)[_0xcca4('0x21')](function(_0x41f96b){_0x1ad684[_0xcca4('0x19')]=_0x41f96b;if(_0x1a4f08['query'][_0xcca4('0x3e')]){_0x18fc1a[_0xcca4('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xcca4('0x40')](_0x18fc1a);})[_0xcca4('0x21')](function(_0x443f45){_0x1ad684['rows']=_0x443f45;return _0x1ad684;})[_0xcca4('0x21')](respondWithFilteredResult(_0x1d599e,_0x18fc1a))[_0xcca4('0x41')](handleError(_0x1d599e,null));};exports[_0xcca4('0x42')]=function(_0x339a89,_0x37f74a){var _0x121dac={'raw':!![],'where':{'id':_0x339a89[_0xcca4('0x43')]['id']}},_0x4be3fd={};_0x4be3fd[_0xcca4('0x2f')]=_[_0xcca4('0x44')](db['AnalyticMetric'][_0xcca4('0x2d')]);_0x4be3fd[_0xcca4('0x30')]=_['keys'](_0x339a89[_0xcca4('0x30')]);_0x4be3fd[_0xcca4('0x31')]=_[_0xcca4('0x33')](_0x4be3fd[_0xcca4('0x2f')],_0x4be3fd[_0xcca4('0x30')]);_0x121dac['attributes']=_[_0xcca4('0x33')](_0x4be3fd['model'],qs['fields'](_0x339a89[_0xcca4('0x30')][_0xcca4('0x34')]));_0x121dac[_0xcca4('0x32')]=_0x121dac[_0xcca4('0x32')][_0xcca4('0x45')]?_0x121dac[_0xcca4('0x32')]:_0x4be3fd[_0xcca4('0x2f')];if(_0x339a89[_0xcca4('0x30')][_0xcca4('0x3e')]){_0x121dac[_0xcca4('0x3f')]=[{'all':!![]}];}_0x121dac=_['merge']({},_0x121dac,_0x339a89[_0xcca4('0x3d')]);return db[_0xcca4('0x2c')][_0xcca4('0x46')](_0x121dac)[_0xcca4('0x21')](handleEntityNotFound(_0x37f74a,null))[_0xcca4('0x21')](respondWithResult(_0x37f74a,null))[_0xcca4('0x41')](handleError(_0x37f74a,null));};exports[_0xcca4('0x47')]=function(_0x3b9be3,_0x24d3a4){return db[_0xcca4('0x2c')][_0xcca4('0x47')](_0x3b9be3[_0xcca4('0x48')],{})[_0xcca4('0x21')](function(_0x35ffe5){var _0x362d0a=_0x3b9be3['user'][_0xcca4('0x23')]({'plain':!![]});if(!_0x362d0a)throw new Error(_0xcca4('0x49'));if(_0x362d0a[_0xcca4('0x4a')]==='user'){var _0x1ac3e1=_0x35ffe5[_0xcca4('0x23')]({'plain':!![]});var _0x3b3a9d=_0xcca4('0x24');return db[_0xcca4('0x4b')][_0xcca4('0x46')]({'where':{'name':_0x3b3a9d,'userProfileId':_0x362d0a['userProfileId']},'raw':!![]})[_0xcca4('0x21')](function(_0x300641){if(_0x300641&&_0x300641[_0xcca4('0x4c')]===0x0){return db[_0xcca4('0x25')][_0xcca4('0x47')]({'name':_0x1ac3e1[_0xcca4('0x28')],'resourceId':_0x1ac3e1['id'],'type':_0x300641[_0xcca4('0x28')],'sectionId':_0x300641['id']},{})[_0xcca4('0x21')](function(){return _0x35ffe5;});}else{return _0x35ffe5;}})[_0xcca4('0x41')](function(_0x4d9fe8){logger[_0xcca4('0x27')](_0xcca4('0x4d'),_0x4d9fe8);throw _0x4d9fe8;});}return _0x35ffe5;})[_0xcca4('0x21')](respondWithResult(_0x24d3a4,0xc9))[_0xcca4('0x41')](handleError(_0x24d3a4,null));};exports[_0xcca4('0x20')]=function(_0x54588d,_0x3d5de2){if(_0x54588d[_0xcca4('0x48')]['id']){delete _0x54588d[_0xcca4('0x48')]['id'];}return db[_0xcca4('0x2c')]['find']({'where':{'id':_0x54588d['params']['id']}})['then'](handleEntityNotFound(_0x3d5de2,null))['then'](saveUpdates(_0x54588d[_0xcca4('0x48')],null))[_0xcca4('0x21')](respondWithResult(_0x3d5de2,null))[_0xcca4('0x41')](handleError(_0x3d5de2,null));};exports[_0xcca4('0x22')]=function(_0x19c32c,_0x46b8cc){return db['AnalyticMetric'][_0xcca4('0x46')]({'where':{'id':_0x19c32c['params']['id']}})[_0xcca4('0x21')](handleEntityNotFound(_0x46b8cc,null))[_0xcca4('0x21')](removeEntity(_0x46b8cc,null))['catch'](handleError(_0x46b8cc,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ecb04d2..218948e 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 _0xf0a7=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2f24d0,_0x12efce){var _0x2f89fe=function(_0x4d7858){while(--_0x4d7858){_0x2f24d0['push'](_0x2f24d0['shift']());}};_0x2f89fe(++_0x12efce);}(_0xf0a7,0x1b2));var _0x7f0a=function(_0x3153a4,_0x184b55){_0x3153a4=_0x3153a4-0x0;var _0x55e5b8=_0xf0a7[_0x3153a4];return _0x55e5b8;};'use strict';var _=require(_0x7f0a('0x0'));var util=require(_0x7f0a('0x1'));var logger=require(_0x7f0a('0x2'))(_0x7f0a('0x3'));var moment=require(_0x7f0a('0x4'));var BPromise=require(_0x7f0a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f0a('0x6'));var rimraf=require(_0x7f0a('0x7'));var config=require(_0x7f0a('0x8'));var attributes=require(_0x7f0a('0x9'));module['exports']=function(_0x506a3c,_0x383f43){return _0x506a3c[_0x7f0a('0xa')](_0x7f0a('0xb'),attributes,{'tableName':_0x7f0a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91f1=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','util','../../config/logger','bluebird'];(function(_0x54aaba,_0xbe9108){var _0x29a29a=function(_0x88185){while(--_0x88185){_0x54aaba['push'](_0x54aaba['shift']());}};_0x29a29a(++_0xbe9108);}(_0x91f1,0x75));var _0x191f=function(_0x2ed40d,_0x78e9cc){_0x2ed40d=_0x2ed40d-0x0;var _0x40cdab=_0x91f1[_0x2ed40d];return _0x40cdab;};'use strict';var _=require('lodash');var util=require(_0x191f('0x0'));var logger=require(_0x191f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x191f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x191f('0x3'));var config=require(_0x191f('0x4'));var attributes=require(_0x191f('0x5'));module[_0x191f('0x6')]=function(_0x4bc9ea,_0x36b319){return _0x4bc9ea[_0x191f('0x7')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index a82ef74..8ed4178 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 _0xcc6b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20f4fa,_0x434923){var _0x3111ed=function(_0xe3e453){while(--_0xe3e453){_0x20f4fa['push'](_0x20f4fa['shift']());}};_0x3111ed(++_0x434923);}(_0xcc6b,0x82));var _0xbcc6=function(_0x4bdb8d,_0x288010){_0x4bdb8d=_0x4bdb8d-0x0;var _0x46d352=_0xcc6b[_0x4bdb8d];return _0x46d352;};'use strict';var _=require(_0xbcc6('0x0'));var util=require(_0xbcc6('0x1'));var moment=require(_0xbcc6('0x2'));var BPromise=require(_0xbcc6('0x3'));var rs=require(_0xbcc6('0x4'));var fs=require('fs');var Redis=require(_0xbcc6('0x5'));var db=require(_0xbcc6('0x6'))['db'];var utils=require(_0xbcc6('0x7'));var logger=require(_0xbcc6('0x8'))(_0xbcc6('0x9'));var config=require(_0xbcc6('0xa'));var jayson=require(_0xbcc6('0xb'));var client=jayson['client'][_0xbcc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ef613,_0xa293ac,_0x3327be){return new BPromise(function(_0x356c41,_0x1c3ce7){return client['request'](_0x4ef613,_0x3327be)['then'](function(_0x1066bb){logger['info'](_0xbcc6('0xd'),_0xa293ac,_0xbcc6('0xe'));logger[_0xbcc6('0xf')](_0xbcc6('0x10'),_0xa293ac,_0xbcc6('0xe'),JSON[_0xbcc6('0x11')](_0x1066bb));if(_0x1066bb['error']){if(_0x1066bb[_0xbcc6('0x12')]['code']===0x1f4){logger[_0xbcc6('0x12')](_0xbcc6('0xd'),_0xa293ac,_0x1066bb[_0xbcc6('0x12')]['message']);return _0x1c3ce7(_0x1066bb[_0xbcc6('0x12')]['message']);}logger['error'](_0xbcc6('0xd'),_0xa293ac,_0x1066bb[_0xbcc6('0x12')][_0xbcc6('0x13')]);return _0x356c41(_0x1066bb[_0xbcc6('0x12')][_0xbcc6('0x13')]);}else{logger[_0xbcc6('0x14')](_0xbcc6('0xd'),_0xa293ac,_0xbcc6('0xe'));_0x356c41(_0x1066bb[_0xbcc6('0x15')][_0xbcc6('0x13')]);}})[_0xbcc6('0x16')](function(_0x2fa1be){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0xa293ac,_0x2fa1be);_0x1c3ce7(_0x2fa1be);});});} \ No newline at end of file +var _0x0bd0=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x24920c,_0x1ba05a){var _0x3086cb=function(_0x33abd2){while(--_0x33abd2){_0x24920c['push'](_0x24920c['shift']());}};_0x3086cb(++_0x1ba05a);}(_0x0bd0,0x175));var _0x00bd=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0x0bd0[_0x2afb44];return _0x15ccc2;};'use strict';var _=require(_0x00bd('0x0'));var util=require('util');var moment=require(_0x00bd('0x1'));var BPromise=require(_0x00bd('0x2'));var rs=require(_0x00bd('0x3'));var fs=require('fs');var Redis=require(_0x00bd('0x4'));var db=require(_0x00bd('0x5'))['db'];var utils=require(_0x00bd('0x6'));var logger=require(_0x00bd('0x7'))('rpc');var config=require(_0x00bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x00bd('0x9')][_0x00bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24c723,_0x3d8c5c,_0x354cba){return new BPromise(function(_0x29c359,_0x17e7e7){return client[_0x00bd('0xb')](_0x24c723,_0x354cba)[_0x00bd('0xc')](function(_0x4e1b77){logger[_0x00bd('0xd')](_0x00bd('0xe'),_0x3d8c5c,'request\x20sent');logger[_0x00bd('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3d8c5c,'request\x20sent',JSON['stringify'](_0x4e1b77));if(_0x4e1b77['error']){if(_0x4e1b77[_0x00bd('0x10')][_0x00bd('0x11')]===0x1f4){logger[_0x00bd('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3d8c5c,_0x4e1b77[_0x00bd('0x10')][_0x00bd('0x12')]);return _0x17e7e7(_0x4e1b77[_0x00bd('0x10')][_0x00bd('0x12')]);}logger[_0x00bd('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3d8c5c,_0x4e1b77[_0x00bd('0x10')]['message']);return _0x29c359(_0x4e1b77[_0x00bd('0x10')]['message']);}else{logger['info'](_0x00bd('0xe'),_0x3d8c5c,'request\x20sent');_0x29c359(_0x4e1b77[_0x00bd('0x13')][_0x00bd('0x12')]);}})[_0x00bd('0x14')](function(_0x4c73f5){logger[_0x00bd('0x10')](_0x00bd('0xe'),_0x3d8c5c,_0x4c73f5);_0x17e7e7(_0x4c73f5);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3542195..0dff64d 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 _0x66fa=['index','get','/:id','isAuthenticated','show','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x66fa,0x117));var _0xa66f=function(_0x5e3a09,_0x4b2a0c){_0x5e3a09=_0x5e3a09-0x0;var _0x1e35de=_0x66fa[_0x5e3a09];return _0x1e35de;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa66f('0x9')]);router[_0xa66f('0xa')](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0xd')]);router['post']('/',auth[_0xa66f('0xc')](),controller['create']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0xc')](),controller['update']);router['delete']('/:id',auth[_0xa66f('0xc')](),controller[_0xa66f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x53ec,0x192));var _0xc53e=function(_0x3e3bed,_0x28cdc0){_0x3e3bed=_0x3e3bed-0x0;var _0x30595b=_0x53ec[_0x3e3bed];return _0x30595b;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a393568..0f2b6d0 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 _0x2aaf=['sequelize'];(function(_0x13a9a2,_0x114444){var _0x5b30ad=function(_0x443da7){while(--_0x443da7){_0x13a9a2['push'](_0x13a9a2['shift']());}};_0x5b30ad(++_0x114444);}(_0x2aaf,0xce));var _0xf2aa=function(_0x3f6c5c,_0x164c12){_0x3f6c5c=_0x3f6c5c-0x0;var _0x94f504=_0x2aaf[_0x3f6c5c];return _0x94f504;};'use strict';var Sequelize=require(_0xf2aa('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x2426=['TEXT','exports'];(function(_0x13c56d,_0x2155db){var _0x10c158=function(_0x28f67a){while(--_0x28f67a){_0x13c56d['push'](_0x13c56d['shift']());}};_0x10c158(++_0x2155db);}(_0x2426,0x16d));var _0x6242=function(_0x420bb2,_0x46e617){_0x420bb2=_0x420bb2-0x0;var _0x3173fd=_0x2426[_0x420bb2];return _0x3173fd;};'use strict';var Sequelize=require('sequelize');module[_0x6242('0x0')]={'tree':{'type':Sequelize[_0x6242('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index daa05d9..777f933 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 _0x3d88=['type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','save','then','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x4fe9c0,_0x3cf62a){var _0x493705=function(_0x2c26f4){while(--_0x2c26f4){_0x4fe9c0['push'](_0x4fe9c0['shift']());}};_0x493705(++_0x3cf62a);}(_0x3d88,0xf9));var _0x83d8=function(_0x5d8d7e,_0x4a971e){_0x5d8d7e=_0x5d8d7e-0x0;var _0x25006f=_0x3d88[_0x5d8d7e];return _0x25006f;};'use strict';var pdf=require(_0x83d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x83d8('0x1'));var zipdir=require(_0x83d8('0x2'));var jsonpatch=require(_0x83d8('0x3'));var rp=require(_0x83d8('0x4'));var moment=require(_0x83d8('0x5'));var BPromise=require(_0x83d8('0x6'));var Mustache=require(_0x83d8('0x7'));var util=require('util');var path=require(_0x83d8('0x8'));var sox=require('sox');var csv=require(_0x83d8('0x9'));var ejs=require(_0x83d8('0xa'));var fs=require('fs');var _=require(_0x83d8('0xb'));var squel=require(_0x83d8('0xc'));var crypto=require(_0x83d8('0xd'));var jsforce=require(_0x83d8('0xe'));var deskjs=require(_0x83d8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x83d8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x83d8('0x11'));var qs=require(_0x83d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83d8('0x13'));var logger=require(_0x83d8('0x14'))('api');var utils=require(_0x83d8('0x15'));var config=require(_0x83d8('0x16'));var licenseUtil=require(_0x83d8('0x17'));var db=require(_0x83d8('0x18'))['db'];function respondWithStatusCode(_0x3d02ba,_0x4ed7d3){_0x4ed7d3=_0x4ed7d3||0xcc;return function(_0x4e7dcf){if(_0x4e7dcf){return _0x3d02ba[_0x83d8('0x19')](_0x4ed7d3);}return _0x3d02ba[_0x83d8('0x1a')](_0x4ed7d3)[_0x83d8('0x1b')]();};}function respondWithResult(_0x5c804a,_0x75905){_0x75905=_0x75905||0xc8;return function(_0x5af8f2){if(_0x5af8f2){return _0x5c804a[_0x83d8('0x1a')](_0x75905)['json'](_0x5af8f2);}};}function respondWithFilteredResult(_0x21e894,_0x345872){return function(_0x11b553){if(_0x11b553){var _0x309a46=_0x11b553['count'],_0x3fa8a0=_0x345872[_0x83d8('0x1c')],_0x491d7b=_0x345872['offset']+_0x345872[_0x83d8('0x1d')],_0x4bc4a7;if(_0x491d7b>=_0x309a46){_0x491d7b=_0x309a46;_0x4bc4a7=0xc8;}else{_0x4bc4a7=0xce;}_0x21e894[_0x83d8('0x1a')](_0x4bc4a7);return _0x21e894[_0x83d8('0x1e')](_0x83d8('0x1f'),_0x3fa8a0+'-'+_0x491d7b+'/'+_0x309a46)[_0x83d8('0x20')](_0x11b553);}return null;};}function patchUpdates(_0x2b603a){return function(_0x2d39a5){try{jsonpatch['apply'](_0x2d39a5,_0x2b603a,!![]);}catch(_0x23f537){return BPromise['reject'](_0x23f537);}return _0x2d39a5[_0x83d8('0x21')]();};}function saveUpdates(_0x14cb48,_0x25540c){return function(_0x1bb2b8){if(_0x1bb2b8){return _0x1bb2b8['update'](_0x14cb48)[_0x83d8('0x22')](function(_0x1486d5){return _0x1486d5;});}return null;};}function removeEntity(_0x48eca2,_0x146db0){return function(_0x466642){if(_0x466642){return _0x466642['destroy']()[_0x83d8('0x22')](function(){_0x48eca2[_0x83d8('0x1a')](0xcc)[_0x83d8('0x1b')]();});}};}function handleEntityNotFound(_0x45227f,_0x29df7a){return function(_0x32c306){if(!_0x32c306){_0x45227f['sendStatus'](0x194);}return _0x32c306;};}function handleError(_0x4aecfd,_0x5c85ec){_0x5c85ec=_0x5c85ec||0x1f4;return function(_0x49c4c7){logger[_0x83d8('0x23')](_0x49c4c7['stack']);if(_0x49c4c7[_0x83d8('0x24')]){delete _0x49c4c7[_0x83d8('0x24')];}_0x4aecfd[_0x83d8('0x1a')](_0x5c85ec)[_0x83d8('0x25')](_0x49c4c7);};}exports[_0x83d8('0x26')]=function(_0x29c820,_0x3ddd0b){var _0x4b9462={},_0x156204={},_0x33f782={'count':0x0,'rows':[]};var _0x3c5919=_[_0x83d8('0x27')](db[_0x83d8('0x28')][_0x83d8('0x29')],function(_0x4a3494){return{'name':_0x4a3494[_0x83d8('0x2a')],'type':_0x4a3494[_0x83d8('0x2b')][_0x83d8('0x2c')]};});_0x156204[_0x83d8('0x2d')]=_['map'](_0x3c5919,_0x83d8('0x24'));_0x156204[_0x83d8('0x2e')]=_[_0x83d8('0x2f')](_0x29c820[_0x83d8('0x2e')]);_0x156204[_0x83d8('0x30')]=_[_0x83d8('0x31')](_0x156204['model'],_0x156204[_0x83d8('0x2e')]);_0x4b9462[_0x83d8('0x32')]=_[_0x83d8('0x31')](_0x156204[_0x83d8('0x2d')],qs['fields'](_0x29c820['query'][_0x83d8('0x33')]));_0x4b9462[_0x83d8('0x32')]=_0x4b9462['attributes'][_0x83d8('0x34')]?_0x4b9462[_0x83d8('0x32')]:_0x156204[_0x83d8('0x2d')];if(!_0x29c820[_0x83d8('0x2e')]['hasOwnProperty'](_0x83d8('0x35'))){_0x4b9462[_0x83d8('0x1d')]=qs[_0x83d8('0x1d')](_0x29c820[_0x83d8('0x2e')]['limit']);_0x4b9462[_0x83d8('0x1c')]=qs[_0x83d8('0x1c')](_0x29c820[_0x83d8('0x2e')][_0x83d8('0x1c')]);}_0x4b9462[_0x83d8('0x36')]=qs[_0x83d8('0x37')](_0x29c820[_0x83d8('0x2e')]['sort']);_0x4b9462[_0x83d8('0x38')]=qs[_0x83d8('0x30')](_[_0x83d8('0x39')](_0x29c820[_0x83d8('0x2e')],_0x156204[_0x83d8('0x30')]),_0x3c5919);if(_0x29c820['query'][_0x83d8('0x3a')]){_0x4b9462['where']=_[_0x83d8('0x3b')](_0x4b9462['where'],{'$or':_['map'](_0x3c5919,function(_0x38f1bc){if(_0x38f1bc[_0x83d8('0x2b')]!==_0x83d8('0x3c')){var _0x3ad384={};_0x3ad384[_0x38f1bc['name']]={'$like':'%'+_0x29c820[_0x83d8('0x2e')][_0x83d8('0x3a')]+'%'};return _0x3ad384;}})});}_0x4b9462=_[_0x83d8('0x3b')]({},_0x4b9462,_0x29c820['options']);var _0x3beb2f={'where':_0x4b9462[_0x83d8('0x38')]};return db[_0x83d8('0x28')]['count'](_0x3beb2f)[_0x83d8('0x22')](function(_0x1114fc){_0x33f782[_0x83d8('0x3d')]=_0x1114fc;if(_0x29c820[_0x83d8('0x2e')][_0x83d8('0x3e')]){_0x4b9462[_0x83d8('0x3f')]=[{'all':!![]}];}return db[_0x83d8('0x28')][_0x83d8('0x40')](_0x4b9462);})[_0x83d8('0x22')](function(_0x344b96){_0x33f782[_0x83d8('0x41')]=_0x344b96;return _0x33f782;})[_0x83d8('0x22')](respondWithFilteredResult(_0x3ddd0b,_0x4b9462))[_0x83d8('0x42')](handleError(_0x3ddd0b,null));};exports['show']=function(_0x517431,_0x53966c){var _0x55f107={'raw':!![],'where':{'id':_0x517431[_0x83d8('0x43')]['id']}},_0x3429bb={};_0x3429bb[_0x83d8('0x2d')]=_[_0x83d8('0x2f')](db[_0x83d8('0x28')][_0x83d8('0x29')]);_0x3429bb[_0x83d8('0x2e')]=_[_0x83d8('0x2f')](_0x517431['query']);_0x3429bb['filters']=_[_0x83d8('0x31')](_0x3429bb[_0x83d8('0x2d')],_0x3429bb[_0x83d8('0x2e')]);_0x55f107[_0x83d8('0x32')]=_[_0x83d8('0x31')](_0x3429bb['model'],qs[_0x83d8('0x33')](_0x517431['query'][_0x83d8('0x33')]));_0x55f107[_0x83d8('0x32')]=_0x55f107['attributes'][_0x83d8('0x34')]?_0x55f107['attributes']:_0x3429bb['model'];if(_0x517431[_0x83d8('0x2e')][_0x83d8('0x3e')]){_0x55f107['include']=[{'all':!![]}];}_0x55f107=_[_0x83d8('0x3b')]({},_0x55f107,_0x517431['options']);return db['AnalyticTreeReport'][_0x83d8('0x44')](_0x55f107)[_0x83d8('0x22')](handleEntityNotFound(_0x53966c,null))[_0x83d8('0x22')](respondWithResult(_0x53966c,null))[_0x83d8('0x42')](handleError(_0x53966c,null));};exports[_0x83d8('0x45')]=function(_0x12dc08,_0x362900){return db[_0x83d8('0x28')][_0x83d8('0x45')](_0x12dc08['body'],{})[_0x83d8('0x22')](respondWithResult(_0x362900,0xc9))['catch'](handleError(_0x362900,null));};exports[_0x83d8('0x46')]=function(_0x2fd12a,_0x41140d){if(_0x2fd12a[_0x83d8('0x47')]['id']){delete _0x2fd12a[_0x83d8('0x47')]['id'];}return db['AnalyticTreeReport'][_0x83d8('0x44')]({'where':{'id':_0x2fd12a[_0x83d8('0x43')]['id']}})[_0x83d8('0x22')](handleEntityNotFound(_0x41140d,null))[_0x83d8('0x22')](saveUpdates(_0x2fd12a[_0x83d8('0x47')],null))[_0x83d8('0x22')](respondWithResult(_0x41140d,null))[_0x83d8('0x42')](handleError(_0x41140d,null));};exports[_0x83d8('0x48')]=function(_0x596f84,_0x4ca47d){return db[_0x83d8('0x28')][_0x83d8('0x44')]({'where':{'id':_0x596f84[_0x83d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ca47d,null))[_0x83d8('0x22')](removeEntity(_0x4ca47d,null))[_0x83d8('0x42')](handleError(_0x4ca47d,null));}; \ No newline at end of file +var _0x20c8=['send','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x20c8,0x144));var _0x820c=function(_0x3c6bed,_0x3078f2){_0x3c6bed=_0x3c6bed-0x0;var _0x6e5565=_0x20c8[_0x3c6bed];return _0x6e5565;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x820c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x820c('0x1'));var rp=require('request-promise');var moment=require(_0x820c('0x2'));var BPromise=require(_0x820c('0x3'));var Mustache=require(_0x820c('0x4'));var util=require(_0x820c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x820c('0x6'));var ejs=require(_0x820c('0x7'));var fs=require('fs');var _=require(_0x820c('0x8'));var squel=require(_0x820c('0x9'));var crypto=require(_0x820c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x820c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x820c('0xc'));var Papa=require(_0x820c('0xd'));var Redis=require(_0x820c('0xe'));var authService=require(_0x820c('0xf'));var qs=require(_0x820c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x820c('0x11'));var logger=require(_0x820c('0x12'))('api');var utils=require(_0x820c('0x13'));var config=require(_0x820c('0x14'));var licenseUtil=require(_0x820c('0x15'));var db=require(_0x820c('0x16'))['db'];function respondWithStatusCode(_0x55d509,_0x1b1e29){_0x1b1e29=_0x1b1e29||0xcc;return function(_0x3eb2a5){if(_0x3eb2a5){return _0x55d509[_0x820c('0x17')](_0x1b1e29);}return _0x55d509[_0x820c('0x18')](_0x1b1e29)['end']();};}function respondWithResult(_0x4c99b8,_0x11326d){_0x11326d=_0x11326d||0xc8;return function(_0x219b24){if(_0x219b24){return _0x4c99b8['status'](_0x11326d)['json'](_0x219b24);}};}function respondWithFilteredResult(_0x10cb9d,_0x2627f8){return function(_0x56c49b){if(_0x56c49b){var _0x12801b=_0x56c49b[_0x820c('0x19')],_0x24399e=_0x2627f8[_0x820c('0x1a')],_0x5d34a3=_0x2627f8[_0x820c('0x1a')]+_0x2627f8[_0x820c('0x1b')],_0x47cca5;if(_0x5d34a3>=_0x12801b){_0x5d34a3=_0x12801b;_0x47cca5=0xc8;}else{_0x47cca5=0xce;}_0x10cb9d[_0x820c('0x18')](_0x47cca5);return _0x10cb9d[_0x820c('0x1c')](_0x820c('0x1d'),_0x24399e+'-'+_0x5d34a3+'/'+_0x12801b)[_0x820c('0x1e')](_0x56c49b);}return null;};}function patchUpdates(_0x19de71){return function(_0x272f21){try{jsonpatch[_0x820c('0x1f')](_0x272f21,_0x19de71,!![]);}catch(_0x1c6a44){return BPromise[_0x820c('0x20')](_0x1c6a44);}return _0x272f21[_0x820c('0x21')]();};}function saveUpdates(_0x57744d,_0x3e22cb){return function(_0x28d904){if(_0x28d904){return _0x28d904[_0x820c('0x22')](_0x57744d)['then'](function(_0x47c12c){return _0x47c12c;});}return null;};}function removeEntity(_0x1144ac,_0x4ae634){return function(_0x55ae22){if(_0x55ae22){return _0x55ae22[_0x820c('0x23')]()[_0x820c('0x24')](function(){_0x1144ac[_0x820c('0x18')](0xcc)[_0x820c('0x25')]();});}};}function handleEntityNotFound(_0x2c6e55,_0x5601c1){return function(_0x449b45){if(!_0x449b45){_0x2c6e55[_0x820c('0x17')](0x194);}return _0x449b45;};}function handleError(_0x4e3056,_0x1fa45d){_0x1fa45d=_0x1fa45d||0x1f4;return function(_0x2f3320){logger[_0x820c('0x26')](_0x2f3320[_0x820c('0x27')]);if(_0x2f3320[_0x820c('0x28')]){delete _0x2f3320[_0x820c('0x28')];}_0x4e3056[_0x820c('0x18')](_0x1fa45d)[_0x820c('0x29')](_0x2f3320);};}exports['index']=function(_0x2d5f62,_0x302ca4){var _0x296c86={},_0x13ae34={},_0x38add3={'count':0x0,'rows':[]};var _0x420497=_[_0x820c('0x2a')](db[_0x820c('0x2b')][_0x820c('0x2c')],function(_0x10ba84){return{'name':_0x10ba84[_0x820c('0x2d')],'type':_0x10ba84[_0x820c('0x2e')]['key']};});_0x13ae34[_0x820c('0x2f')]=_[_0x820c('0x2a')](_0x420497,_0x820c('0x28'));_0x13ae34[_0x820c('0x30')]=_['keys'](_0x2d5f62[_0x820c('0x30')]);_0x13ae34[_0x820c('0x31')]=_[_0x820c('0x32')](_0x13ae34[_0x820c('0x2f')],_0x13ae34[_0x820c('0x30')]);_0x296c86[_0x820c('0x33')]=_[_0x820c('0x32')](_0x13ae34[_0x820c('0x2f')],qs[_0x820c('0x34')](_0x2d5f62[_0x820c('0x30')][_0x820c('0x34')]));_0x296c86['attributes']=_0x296c86[_0x820c('0x33')][_0x820c('0x35')]?_0x296c86[_0x820c('0x33')]:_0x13ae34['model'];if(!_0x2d5f62[_0x820c('0x30')][_0x820c('0x36')](_0x820c('0x37'))){_0x296c86['limit']=qs['limit'](_0x2d5f62['query']['limit']);_0x296c86['offset']=qs[_0x820c('0x1a')](_0x2d5f62[_0x820c('0x30')][_0x820c('0x1a')]);}_0x296c86[_0x820c('0x38')]=qs['sort'](_0x2d5f62[_0x820c('0x30')][_0x820c('0x39')]);_0x296c86['where']=qs[_0x820c('0x31')](_[_0x820c('0x3a')](_0x2d5f62[_0x820c('0x30')],_0x13ae34['filters']),_0x420497);if(_0x2d5f62[_0x820c('0x30')]['filter']){_0x296c86[_0x820c('0x3b')]=_[_0x820c('0x3c')](_0x296c86[_0x820c('0x3b')],{'$or':_['map'](_0x420497,function(_0x5385e2){if(_0x5385e2[_0x820c('0x2e')]!==_0x820c('0x3d')){var _0x5523fb={};_0x5523fb[_0x5385e2['name']]={'$like':'%'+_0x2d5f62[_0x820c('0x30')]['filter']+'%'};return _0x5523fb;}})});}_0x296c86=_[_0x820c('0x3c')]({},_0x296c86,_0x2d5f62[_0x820c('0x3e')]);var _0x4b1bea={'where':_0x296c86[_0x820c('0x3b')]};return db['AnalyticTreeReport'][_0x820c('0x19')](_0x4b1bea)[_0x820c('0x24')](function(_0x258ded){_0x38add3[_0x820c('0x19')]=_0x258ded;if(_0x2d5f62[_0x820c('0x30')][_0x820c('0x3f')]){_0x296c86[_0x820c('0x40')]=[{'all':!![]}];}return db[_0x820c('0x2b')][_0x820c('0x41')](_0x296c86);})[_0x820c('0x24')](function(_0x14d18e){_0x38add3[_0x820c('0x42')]=_0x14d18e;return _0x38add3;})['then'](respondWithFilteredResult(_0x302ca4,_0x296c86))[_0x820c('0x43')](handleError(_0x302ca4,null));};exports['show']=function(_0xfda112,_0x280dba){var _0x3f9704={'raw':!![],'where':{'id':_0xfda112[_0x820c('0x44')]['id']}},_0x261b5e={};_0x261b5e['model']=_[_0x820c('0x45')](db[_0x820c('0x2b')][_0x820c('0x2c')]);_0x261b5e[_0x820c('0x30')]=_[_0x820c('0x45')](_0xfda112['query']);_0x261b5e[_0x820c('0x31')]=_['intersection'](_0x261b5e[_0x820c('0x2f')],_0x261b5e[_0x820c('0x30')]);_0x3f9704[_0x820c('0x33')]=_[_0x820c('0x32')](_0x261b5e['model'],qs[_0x820c('0x34')](_0xfda112[_0x820c('0x30')]['fields']));_0x3f9704[_0x820c('0x33')]=_0x3f9704[_0x820c('0x33')]['length']?_0x3f9704[_0x820c('0x33')]:_0x261b5e[_0x820c('0x2f')];if(_0xfda112['query'][_0x820c('0x3f')]){_0x3f9704[_0x820c('0x40')]=[{'all':!![]}];}_0x3f9704=_[_0x820c('0x3c')]({},_0x3f9704,_0xfda112[_0x820c('0x3e')]);return db[_0x820c('0x2b')][_0x820c('0x46')](_0x3f9704)[_0x820c('0x24')](handleEntityNotFound(_0x280dba,null))[_0x820c('0x24')](respondWithResult(_0x280dba,null))[_0x820c('0x43')](handleError(_0x280dba,null));};exports[_0x820c('0x47')]=function(_0x299979,_0x37f5da){return db[_0x820c('0x2b')][_0x820c('0x47')](_0x299979[_0x820c('0x48')],{})[_0x820c('0x24')](respondWithResult(_0x37f5da,0xc9))[_0x820c('0x43')](handleError(_0x37f5da,null));};exports[_0x820c('0x22')]=function(_0x121c1b,_0x503ee6){if(_0x121c1b[_0x820c('0x48')]['id']){delete _0x121c1b[_0x820c('0x48')]['id'];}return db['AnalyticTreeReport'][_0x820c('0x46')]({'where':{'id':_0x121c1b[_0x820c('0x44')]['id']}})[_0x820c('0x24')](handleEntityNotFound(_0x503ee6,null))['then'](saveUpdates(_0x121c1b[_0x820c('0x48')],null))[_0x820c('0x24')](respondWithResult(_0x503ee6,null))[_0x820c('0x43')](handleError(_0x503ee6,null));};exports['destroy']=function(_0x2fe23e,_0x2cd223){return db[_0x820c('0x2b')]['find']({'where':{'id':_0x2fe23e[_0x820c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cd223,null))['then'](removeEntity(_0x2cd223,null))['catch'](handleError(_0x2cd223,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e206793..80209dc 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 _0x75b6=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport'];(function(_0x1eb00f,_0x4a1731){var _0x8fadfd=function(_0xd26ae){while(--_0xd26ae){_0x1eb00f['push'](_0x1eb00f['shift']());}};_0x8fadfd(++_0x4a1731);}(_0x75b6,0x1a4));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x675b('0x1'));var moment=require(_0x675b('0x2'));var BPromise=require(_0x675b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x675b('0x4'));var rimraf=require(_0x675b('0x5'));var config=require(_0x675b('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x675b('0x7')]=function(_0x5332ee,_0x20b740){return _0x5332ee[_0x675b('0x8')](_0x675b('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb90a=['../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','lodash','util','api'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xb90a,0x12a));var _0xab90=function(_0xadbfee,_0x26ea7a){_0xadbfee=_0xadbfee-0x0;var _0x5a118e=_0xb90a[_0xadbfee];return _0x5a118e;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var logger=require('../../config/logger')(_0xab90('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab90('0x3'));var attributes=require(_0xab90('0x4'));module['exports']=function(_0x5e0540,_0xf36407){return _0x5e0540[_0xab90('0x5')](_0xab90('0x6'),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 85e730d..dc0b02c 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 _0x1240=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','util','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1240,0xe4));var _0x0124=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x1240[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require(_0x0124('0x0'));var moment=require(_0x0124('0x1'));var BPromise=require(_0x0124('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0124('0x3'));var db=require(_0x0124('0x4'))['db'];var utils=require(_0x0124('0x5'));var logger=require(_0x0124('0x6'))(_0x0124('0x7'));var config=require('../../config/environment');var jayson=require(_0x0124('0x8'));var client=jayson[_0x0124('0x9')][_0x0124('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e9e3,_0xe33bc2,_0x36089a){return new BPromise(function(_0x1406c2,_0x1779c2){return client[_0x0124('0xb')](_0x14e9e3,_0x36089a)[_0x0124('0xc')](function(_0x80acc5){logger[_0x0124('0xd')](_0x0124('0xe'),_0xe33bc2,'request\x20sent');logger[_0x0124('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xe33bc2,_0x0124('0x10'),JSON['stringify'](_0x80acc5));if(_0x80acc5[_0x0124('0x11')]){if(_0x80acc5[_0x0124('0x11')]['code']===0x1f4){logger[_0x0124('0x11')](_0x0124('0xe'),_0xe33bc2,_0x80acc5[_0x0124('0x11')][_0x0124('0x12')]);return _0x1779c2(_0x80acc5[_0x0124('0x11')][_0x0124('0x12')]);}logger['error'](_0x0124('0xe'),_0xe33bc2,_0x80acc5['error']['message']);return _0x1406c2(_0x80acc5[_0x0124('0x11')][_0x0124('0x12')]);}else{logger[_0x0124('0xd')](_0x0124('0xe'),_0xe33bc2,_0x0124('0x10'));_0x1406c2(_0x80acc5[_0x0124('0x13')][_0x0124('0x12')]);}})[_0x0124('0x14')](function(_0x6298a){logger['error'](_0x0124('0xe'),_0xe33bc2,_0x6298a);_0x1779c2(_0x6298a);});});} \ No newline at end of file +var _0x2405=['request','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5014e4,_0x2969a2){var _0x4fe7d9=function(_0x59deea){while(--_0x59deea){_0x5014e4['push'](_0x5014e4['shift']());}};_0x4fe7d9(++_0x2969a2);}(_0x2405,0x184));var _0x5240=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x2405[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require(_0x5240('0x0'));var util=require(_0x5240('0x1'));var moment=require(_0x5240('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5240('0x3'));var db=require(_0x5240('0x4'))['db'];var utils=require(_0x5240('0x5'));var logger=require(_0x5240('0x6'))(_0x5240('0x7'));var config=require(_0x5240('0x8'));var jayson=require(_0x5240('0x9'));var client=jayson['client'][_0x5240('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4591e0,_0x3188a7,_0x55e94f){return new BPromise(function(_0xffa0b1,_0x3288b4){return client[_0x5240('0xb')](_0x4591e0,_0x55e94f)['then'](function(_0x366d10){logger[_0x5240('0xc')](_0x5240('0xd'),_0x3188a7,'request\x20sent');logger['debug'](_0x5240('0xe'),_0x3188a7,'request\x20sent',JSON[_0x5240('0xf')](_0x366d10));if(_0x366d10[_0x5240('0x10')]){if(_0x366d10[_0x5240('0x10')][_0x5240('0x11')]===0x1f4){logger[_0x5240('0x10')](_0x5240('0xd'),_0x3188a7,_0x366d10[_0x5240('0x10')][_0x5240('0x12')]);return _0x3288b4(_0x366d10[_0x5240('0x10')][_0x5240('0x12')]);}logger[_0x5240('0x10')](_0x5240('0xd'),_0x3188a7,_0x366d10[_0x5240('0x10')][_0x5240('0x12')]);return _0xffa0b1(_0x366d10[_0x5240('0x10')]['message']);}else{logger['info'](_0x5240('0xd'),_0x3188a7,_0x5240('0x13'));_0xffa0b1(_0x366d10['result'][_0x5240('0x12')]);}})[_0x5240('0x14')](function(_0x488ea2){logger[_0x5240('0x10')](_0x5240('0xd'),_0x3188a7,_0x488ea2);_0x3288b4(_0x488ea2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0989cab..c4a6637 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 _0xf0fc=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','post','/:id','update','delete','destroy','multer','util','path'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xf0fc,0x13d));var _0xcf0f=function(_0x34ec4c,_0x4ba6d0){_0x34ec4c=_0x34ec4c-0x0;var _0x51ea16=_0xf0fc[_0x34ec4c];return _0x51ea16;};'use strict';var multer=require(_0xcf0f('0x0'));var util=require(_0xcf0f('0x1'));var path=require(_0xcf0f('0x2'));var timeout=require(_0xcf0f('0x3'));var express=require(_0xcf0f('0x4'));var router=express[_0xcf0f('0x5')]();var auth=require(_0xcf0f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf0f('0x7'));var controller=require(_0xcf0f('0x8'));router[_0xcf0f('0x9')]('/',auth[_0xcf0f('0xa')](),controller['index']);router[_0xcf0f('0x9')]('/:id',auth[_0xcf0f('0xa')](),controller['show']);router[_0xcf0f('0xb')]('/',auth[_0xcf0f('0xa')](),controller['create']);router['put'](_0xcf0f('0xc'),auth[_0xcf0f('0xa')](),controller[_0xcf0f('0xd')]);router[_0xcf0f('0xe')](_0xcf0f('0xc'),auth[_0xcf0f('0xa')](),controller[_0xcf0f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x442a=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','put','delete','/:id','exports','multer','util','path'];(function(_0x37e320,_0x4e4fdc){var _0x4f0b34=function(_0x3f243a){while(--_0x3f243a){_0x37e320['push'](_0x37e320['shift']());}};_0x4f0b34(++_0x4e4fdc);}(_0x442a,0x16d));var _0xa442=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x442a[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xa442('0x0'));var util=require(_0xa442('0x1'));var path=require(_0xa442('0x2'));var timeout=require(_0xa442('0x3'));var express=require(_0xa442('0x4'));var router=express['Router']();var auth=require(_0xa442('0x5'));var interaction=require(_0xa442('0x6'));var config=require(_0xa442('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xa442('0x8')]('/',auth[_0xa442('0x9')](),controller[_0xa442('0xa')]);router['get']('/:id',auth[_0xa442('0x9')](),controller[_0xa442('0xb')]);router['post']('/',auth[_0xa442('0x9')](),controller['create']);router[_0xa442('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa442('0xd')](_0xa442('0xe'),auth[_0xa442('0x9')](),controller['destroy']);module[_0xa442('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8b4d375..6b494f8 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 _0xa70f=['STRING','sequelize'];(function(_0x343565,_0x2b5fcd){var _0x6c5538=function(_0x10b68f){while(--_0x10b68f){_0x343565['push'](_0x343565['shift']());}};_0x6c5538(++_0x2b5fcd);}(_0xa70f,0x101));var _0xfa70=function(_0x2e52d9,_0x3b45af){_0x2e52d9=_0x2e52d9-0x0;var _0x593995=_0xa70f[_0x2e52d9];return _0x593995;};'use strict';var Sequelize=require(_0xfa70('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa70('0x1')]},'basename':{'type':Sequelize[_0xfa70('0x1')]},'type':{'type':Sequelize[_0xfa70('0x1')]}}; \ No newline at end of file +var _0x4a7a=['exports','STRING','sequelize'];(function(_0x370ca8,_0x2626f2){var _0x5382c8=function(_0x2fa17e){while(--_0x2fa17e){_0x370ca8['push'](_0x370ca8['shift']());}};_0x5382c8(++_0x2626f2);}(_0x4a7a,0x12e));var _0xa4a7=function(_0x49ff3f,_0x531e8f){_0x49ff3f=_0x49ff3f-0x0;var _0x4f9703=_0x4a7a[_0x49ff3f];return _0x4f9703;};'use strict';var Sequelize=require(_0xa4a7('0x0'));module[_0xa4a7('0x1')]={'name':{'type':Sequelize[_0xa4a7('0x2')]},'basename':{'type':Sequelize[_0xa4a7('0x2')]},'type':{'type':Sequelize[_0xa4a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4b022c7..5bc346a 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 _0x6b8e=['../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','params','includeAll','options','find','get','omit','updatedAt','body','createdAt','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','join','server/files/attachments/','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x320537,_0x58e3f5){var _0x1a213a=function(_0x469509){while(--_0x469509){_0x320537['push'](_0x320537['shift']());}};_0x1a213a(++_0x58e3f5);}(_0x6b8e,0x92));var _0xe6b8=function(_0x372bd9,_0x2d5ef1){_0x372bd9=_0x372bd9-0x0;var _0x914906=_0x6b8e[_0x372bd9];return _0x914906;};'use strict';var pdf=require(_0xe6b8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe6b8('0x1'));var zipdir=require(_0xe6b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6b8('0x3'));var Mustache=require(_0xe6b8('0x4'));var util=require(_0xe6b8('0x5'));var path=require(_0xe6b8('0x6'));var sox=require(_0xe6b8('0x7'));var csv=require(_0xe6b8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6b8('0x9'));var squel=require(_0xe6b8('0xa'));var crypto=require(_0xe6b8('0xb'));var jsforce=require(_0xe6b8('0xc'));var deskjs=require(_0xe6b8('0xd'));var toCsv=require(_0xe6b8('0x8'));var querystring=require(_0xe6b8('0xe'));var Papa=require(_0xe6b8('0xf'));var Redis=require(_0xe6b8('0x10'));var authService=require(_0xe6b8('0x11'));var qs=require(_0xe6b8('0x12'));var as=require(_0xe6b8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6b8('0x14'))(_0xe6b8('0x15'));var utils=require(_0xe6b8('0x16'));var config=require(_0xe6b8('0x17'));var licenseUtil=require(_0xe6b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e6cf6,_0x503993){_0x503993=_0x503993||0xcc;return function(_0x3f1c3a){if(_0x3f1c3a){return _0x3e6cf6['sendStatus'](_0x503993);}return _0x3e6cf6[_0xe6b8('0x19')](_0x503993)[_0xe6b8('0x1a')]();};}function respondWithResult(_0x27ac4a,_0x2024d0){_0x2024d0=_0x2024d0||0xc8;return function(_0x1c2752){if(_0x1c2752){return _0x27ac4a[_0xe6b8('0x19')](_0x2024d0)['json'](_0x1c2752);}};}function respondWithFilteredResult(_0x3fcbe9,_0x16a66d){return function(_0xc7a790){if(_0xc7a790){var _0x13aa38=_0xc7a790[_0xe6b8('0x1b')],_0x1f559d=_0x16a66d[_0xe6b8('0x1c')],_0x525fd8=_0x16a66d[_0xe6b8('0x1c')]+_0x16a66d[_0xe6b8('0x1d')],_0x3e11cc;if(_0x525fd8>=_0x13aa38){_0x525fd8=_0x13aa38;_0x3e11cc=0xc8;}else{_0x3e11cc=0xce;}_0x3fcbe9[_0xe6b8('0x19')](_0x3e11cc);return _0x3fcbe9[_0xe6b8('0x1e')](_0xe6b8('0x1f'),_0x1f559d+'-'+_0x525fd8+'/'+_0x13aa38)[_0xe6b8('0x20')](_0xc7a790);}return null;};}function patchUpdates(_0x27f3ed){return function(_0x3da98c){try{jsonpatch[_0xe6b8('0x21')](_0x3da98c,_0x27f3ed,!![]);}catch(_0x31cc9b){return BPromise[_0xe6b8('0x22')](_0x31cc9b);}return _0x3da98c[_0xe6b8('0x23')]();};}function saveUpdates(_0x103756,_0x4e8801){return function(_0x2df8eb){if(_0x2df8eb){return _0x2df8eb[_0xe6b8('0x24')](_0x103756)[_0xe6b8('0x25')](function(_0x1ffdf6){return _0x1ffdf6;});}return null;};}function removeEntity(_0x11e6c0,_0x18220a){return function(_0xf485ca){if(_0xf485ca){return _0xf485ca['destroy']()[_0xe6b8('0x25')](function(){_0x11e6c0[_0xe6b8('0x19')](0xcc)[_0xe6b8('0x1a')]();});}};}function handleEntityNotFound(_0x125f0e,_0x53eda1){return function(_0x389740){if(!_0x389740){_0x125f0e[_0xe6b8('0x26')](0x194);}return _0x389740;};}function handleError(_0x1b71b4,_0x4a3b9f){_0x4a3b9f=_0x4a3b9f||0x1f4;return function(_0x560dcf){logger[_0xe6b8('0x27')](_0x560dcf[_0xe6b8('0x28')]);if(_0x560dcf['name']){delete _0x560dcf[_0xe6b8('0x29')];}_0x1b71b4[_0xe6b8('0x19')](_0x4a3b9f)['send'](_0x560dcf);};}exports[_0xe6b8('0x2a')]=function(_0x251a36,_0x356582){var _0x514fc2={},_0x8d55da={},_0x488f72={'count':0x0,'rows':[]};var _0x2b458e=_[_0xe6b8('0x2b')](db[_0xe6b8('0x2c')][_0xe6b8('0x2d')],function(_0x233270){return{'name':_0x233270['fieldName'],'type':_0x233270[_0xe6b8('0x2e')]['key']};});_0x8d55da[_0xe6b8('0x2f')]=_['map'](_0x2b458e,_0xe6b8('0x29'));_0x8d55da['query']=_[_0xe6b8('0x30')](_0x251a36[_0xe6b8('0x31')]);_0x8d55da[_0xe6b8('0x32')]=_[_0xe6b8('0x33')](_0x8d55da['model'],_0x8d55da[_0xe6b8('0x31')]);_0x514fc2[_0xe6b8('0x34')]=_[_0xe6b8('0x33')](_0x8d55da[_0xe6b8('0x2f')],qs[_0xe6b8('0x35')](_0x251a36[_0xe6b8('0x31')][_0xe6b8('0x35')]));_0x514fc2[_0xe6b8('0x34')]=_0x514fc2[_0xe6b8('0x34')][_0xe6b8('0x36')]?_0x514fc2[_0xe6b8('0x34')]:_0x8d55da[_0xe6b8('0x2f')];if(!_0x251a36['query']['hasOwnProperty'](_0xe6b8('0x37'))){_0x514fc2['limit']=qs['limit'](_0x251a36[_0xe6b8('0x31')][_0xe6b8('0x1d')]);_0x514fc2[_0xe6b8('0x1c')]=qs[_0xe6b8('0x1c')](_0x251a36[_0xe6b8('0x31')][_0xe6b8('0x1c')]);}_0x514fc2[_0xe6b8('0x38')]=qs[_0xe6b8('0x39')](_0x251a36['query'][_0xe6b8('0x39')]);_0x514fc2[_0xe6b8('0x3a')]=qs['filters'](_[_0xe6b8('0x3b')](_0x251a36['query'],_0x8d55da['filters']),_0x2b458e);if(_0x251a36['query'][_0xe6b8('0x3c')]){_0x514fc2[_0xe6b8('0x3a')]=_['merge'](_0x514fc2[_0xe6b8('0x3a')],{'$or':_[_0xe6b8('0x2b')](_0x2b458e,function(_0x161e84){if(_0x161e84[_0xe6b8('0x2e')]!=='VIRTUAL'){var _0x2912f0={};_0x2912f0[_0x161e84[_0xe6b8('0x29')]]={'$like':'%'+_0x251a36[_0xe6b8('0x31')][_0xe6b8('0x3c')]+'%'};return _0x2912f0;}})});}_0x514fc2=_[_0xe6b8('0x3d')]({},_0x514fc2,_0x251a36['options']);var _0x1c24d1={'where':_0x514fc2[_0xe6b8('0x3a')]};return db[_0xe6b8('0x2c')][_0xe6b8('0x1b')](_0x1c24d1)[_0xe6b8('0x25')](function(_0x457943){_0x488f72[_0xe6b8('0x1b')]=_0x457943;if(_0x251a36[_0xe6b8('0x31')]['includeAll']){_0x514fc2[_0xe6b8('0x3e')]=[{'all':!![]}];}return db[_0xe6b8('0x2c')]['findAll'](_0x514fc2);})[_0xe6b8('0x25')](function(_0x1abdbd){_0x488f72[_0xe6b8('0x3f')]=_0x1abdbd;return _0x488f72;})['then'](respondWithFilteredResult(_0x356582,_0x514fc2))[_0xe6b8('0x40')](handleError(_0x356582,null));};exports['show']=function(_0x3801b7,_0x3084cb){var _0x3be54d={'raw':!![],'where':{'id':_0x3801b7[_0xe6b8('0x41')]['id']}},_0xf989bb={};_0xf989bb[_0xe6b8('0x2f')]=_['keys'](db[_0xe6b8('0x2c')][_0xe6b8('0x2d')]);_0xf989bb[_0xe6b8('0x31')]=_[_0xe6b8('0x30')](_0x3801b7[_0xe6b8('0x31')]);_0xf989bb[_0xe6b8('0x32')]=_[_0xe6b8('0x33')](_0xf989bb[_0xe6b8('0x2f')],_0xf989bb[_0xe6b8('0x31')]);_0x3be54d['attributes']=_[_0xe6b8('0x33')](_0xf989bb[_0xe6b8('0x2f')],qs[_0xe6b8('0x35')](_0x3801b7[_0xe6b8('0x31')][_0xe6b8('0x35')]));_0x3be54d[_0xe6b8('0x34')]=_0x3be54d[_0xe6b8('0x34')][_0xe6b8('0x36')]?_0x3be54d[_0xe6b8('0x34')]:_0xf989bb[_0xe6b8('0x2f')];if(_0x3801b7[_0xe6b8('0x31')][_0xe6b8('0x42')]){_0x3be54d[_0xe6b8('0x3e')]=[{'all':!![]}];}_0x3be54d=_[_0xe6b8('0x3d')]({},_0x3be54d,_0x3801b7['options']);return db[_0xe6b8('0x2c')]['find'](_0x3be54d)['then'](handleEntityNotFound(_0x3084cb,null))[_0xe6b8('0x25')](respondWithResult(_0x3084cb,null))[_0xe6b8('0x40')](handleError(_0x3084cb,null));};exports['clone']=function(_0x413aee,_0x5e58fb){var _0x6c7120={'where':{'id':_0x413aee['params']['id']}},_0x488d16={};_0x488d16['model']=_['keys'](db[_0xe6b8('0x2c')][_0xe6b8('0x2d')]);_0x6c7120[_0xe6b8('0x34')]=_[_0xe6b8('0x33')](_0x488d16[_0xe6b8('0x2f')],qs[_0xe6b8('0x35')](_0x413aee['query'][_0xe6b8('0x35')]));_0x6c7120[_0xe6b8('0x34')]=_0x6c7120[_0xe6b8('0x34')][_0xe6b8('0x36')]?_0x6c7120[_0xe6b8('0x34')]:_0x488d16[_0xe6b8('0x2f')];if(_0x413aee[_0xe6b8('0x31')][_0xe6b8('0x42')]){_0x6c7120[_0xe6b8('0x3e')]=[{'all':!![]}];}_0x6c7120=_['merge']({},_0x6c7120,_0x413aee[_0xe6b8('0x43')]);return db[_0xe6b8('0x2c')][_0xe6b8('0x44')](_0x6c7120)[_0xe6b8('0x25')](handleEntityNotFound(_0x5e58fb,null))[_0xe6b8('0x25')](function(_0x5f1b97){if(_0x5f1b97){var _0x85db1f=_0x5f1b97[_0xe6b8('0x45')]({'plain':!![]});_0x85db1f=qs[_0xe6b8('0x46')](_0x85db1f,['id','createdAt',_0xe6b8('0x47')]);_0x413aee[_0xe6b8('0x48')]=_[_0xe6b8('0x46')](_0x413aee['body'],['id',_0xe6b8('0x49'),_0xe6b8('0x47')]);return db[_0xe6b8('0x2c')][_0xe6b8('0x4a')](_[_0xe6b8('0x3d')](_0x85db1f,_0x413aee['body']),{'include':_0x413aee[_0xe6b8('0x31')][_0xe6b8('0x42')]?[{'all':!![]}]:undefined});}})[_0xe6b8('0x25')](respondWithResult(_0x5e58fb,0xc9))['catch'](handleError(_0x5e58fb,null));};exports[_0xe6b8('0x24')]=function(_0x4c0461,_0x32ed45){if(_0x4c0461['body']['id']){delete _0x4c0461[_0xe6b8('0x48')]['id'];}return db[_0xe6b8('0x2c')][_0xe6b8('0x44')]({'where':{'id':_0x4c0461[_0xe6b8('0x41')]['id']}})[_0xe6b8('0x25')](handleEntityNotFound(_0x32ed45,null))[_0xe6b8('0x25')](saveUpdates(_0x4c0461[_0xe6b8('0x48')],null))[_0xe6b8('0x25')](respondWithResult(_0x32ed45,null))[_0xe6b8('0x40')](handleError(_0x32ed45,null));};exports[_0xe6b8('0x4b')]=function(_0x3f60d1,_0x1ec879){return db[_0xe6b8('0x2c')]['find']({'where':{'id':_0x3f60d1[_0xe6b8('0x41')]['id']}})[_0xe6b8('0x25')](handleEntityNotFound(_0x1ec879,null))[_0xe6b8('0x25')](removeEntity(_0x1ec879,null))[_0xe6b8('0x40')](handleError(_0x1ec879,null));};exports[_0xe6b8('0x4a')]=function(_0x4c084f,_0x298977,_0xd63ef2){_0x4c084f['body'][_0xe6b8('0x29')]=_0x4c084f[_0xe6b8('0x4c')][_0xe6b8('0x4d')];_0x4c084f[_0xe6b8('0x48')][_0xe6b8('0x4e')]=_0x4c084f[_0xe6b8('0x4c')][_0xe6b8('0x4f')];_0x4c084f[_0xe6b8('0x48')]['type']=_0x4c084f['file'][_0xe6b8('0x50')];return db['Attachment'][_0xe6b8('0x4a')](_0x4c084f[_0xe6b8('0x48')])[_0xe6b8('0x25')](respondWithResult(_0x298977,0xc9))['catch'](handleError(_0x298977,null));};exports[_0xe6b8('0x51')]=function(_0x3d93a1,_0x51dfcf,_0x3d4c09){return db[_0xe6b8('0x2c')][_0xe6b8('0x52')]({'where':{'id':_0x3d93a1[_0xe6b8('0x41')]['id']},'raw':!![]})[_0xe6b8('0x25')](handleEntityNotFound(_0x51dfcf,null))[_0xe6b8('0x25')](function(_0x7a75b){if(_0x7a75b){return _0x51dfcf['download'](path[_0xe6b8('0x53')](config['root'],_0xe6b8('0x54'),_0x7a75b[_0xe6b8('0x4e')]));}})[_0xe6b8('0x40')](handleError(_0x51dfcf,null));}; \ No newline at end of file +var _0x0307=['body','omit','update','create','file','originalname','basename','filename','mimetype','download','findOne','join','server/files/attachments/','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','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','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','count','includeAll','include','Attachment','rows','catch','params','keys','clone','find','createdAt','updatedAt'];(function(_0x5d284b,_0x105a76){var _0xf8f20e=function(_0x5d002a){while(--_0x5d002a){_0x5d284b['push'](_0x5d284b['shift']());}};_0xf8f20e(++_0x105a76);}(_0x0307,0x1b1));var _0x7030=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x0307[_0x1147ab];return _0x55cb5a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7030('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7030('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7030('0x2'));var moment=require(_0x7030('0x3'));var BPromise=require(_0x7030('0x4'));var Mustache=require(_0x7030('0x5'));var util=require(_0x7030('0x6'));var path=require(_0x7030('0x7'));var sox=require(_0x7030('0x8'));var csv=require(_0x7030('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7030('0xa'));var squel=require(_0x7030('0xb'));var crypto=require('crypto');var jsforce=require(_0x7030('0xc'));var deskjs=require(_0x7030('0xd'));var toCsv=require(_0x7030('0x9'));var querystring=require(_0x7030('0xe'));var Papa=require(_0x7030('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7030('0x10'));var as=require(_0x7030('0x11'));var hardwareService=require(_0x7030('0x12'));var logger=require(_0x7030('0x13'))(_0x7030('0x14'));var utils=require(_0x7030('0x15'));var config=require(_0x7030('0x16'));var licenseUtil=require(_0x7030('0x17'));var db=require(_0x7030('0x18'))['db'];function respondWithStatusCode(_0x2b904f,_0x2a6280){_0x2a6280=_0x2a6280||0xcc;return function(_0x3b3a18){if(_0x3b3a18){return _0x2b904f[_0x7030('0x19')](_0x2a6280);}return _0x2b904f[_0x7030('0x1a')](_0x2a6280)[_0x7030('0x1b')]();};}function respondWithResult(_0x5682dc,_0x4deb2e){_0x4deb2e=_0x4deb2e||0xc8;return function(_0x128179){if(_0x128179){return _0x5682dc[_0x7030('0x1a')](_0x4deb2e)[_0x7030('0x1c')](_0x128179);}};}function respondWithFilteredResult(_0x10d3de,_0x1e5a8a){return function(_0x267b67){if(_0x267b67){var _0x113914=_0x267b67['count'],_0x120c20=_0x1e5a8a['offset'],_0x5ea38f=_0x1e5a8a[_0x7030('0x1d')]+_0x1e5a8a[_0x7030('0x1e')],_0x21b41f;if(_0x5ea38f>=_0x113914){_0x5ea38f=_0x113914;_0x21b41f=0xc8;}else{_0x21b41f=0xce;}_0x10d3de[_0x7030('0x1a')](_0x21b41f);return _0x10d3de['set'](_0x7030('0x1f'),_0x120c20+'-'+_0x5ea38f+'/'+_0x113914)[_0x7030('0x1c')](_0x267b67);}return null;};}function patchUpdates(_0x22dd33){return function(_0x19a57c){try{jsonpatch[_0x7030('0x20')](_0x19a57c,_0x22dd33,!![]);}catch(_0x23bb9c){return BPromise[_0x7030('0x21')](_0x23bb9c);}return _0x19a57c[_0x7030('0x22')]();};}function saveUpdates(_0x5fc88c,_0x1a6049){return function(_0x54f3c1){if(_0x54f3c1){return _0x54f3c1['update'](_0x5fc88c)[_0x7030('0x23')](function(_0x166c89){return _0x166c89;});}return null;};}function removeEntity(_0x30a431,_0x221720){return function(_0x1b7a97){if(_0x1b7a97){return _0x1b7a97[_0x7030('0x24')]()['then'](function(){_0x30a431[_0x7030('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b6150,_0x4a8227){return function(_0x45c2e7){if(!_0x45c2e7){_0x7b6150[_0x7030('0x19')](0x194);}return _0x45c2e7;};}function handleError(_0x266898,_0xeaf255){_0xeaf255=_0xeaf255||0x1f4;return function(_0x51d9ac){logger[_0x7030('0x25')](_0x51d9ac['stack']);if(_0x51d9ac[_0x7030('0x26')]){delete _0x51d9ac[_0x7030('0x26')];}_0x266898[_0x7030('0x1a')](_0xeaf255)['send'](_0x51d9ac);};}exports[_0x7030('0x27')]=function(_0x2e086e,_0x44ed2f){var _0x56b4ce={},_0x10dedd={},_0x40640b={'count':0x0,'rows':[]};var _0x2369ef=_[_0x7030('0x28')](db['Attachment'][_0x7030('0x29')],function(_0x127787){return{'name':_0x127787[_0x7030('0x2a')],'type':_0x127787[_0x7030('0x2b')]['key']};});_0x10dedd[_0x7030('0x2c')]=_[_0x7030('0x28')](_0x2369ef,_0x7030('0x26'));_0x10dedd[_0x7030('0x2d')]=_['keys'](_0x2e086e['query']);_0x10dedd['filters']=_['intersection'](_0x10dedd[_0x7030('0x2c')],_0x10dedd[_0x7030('0x2d')]);_0x56b4ce[_0x7030('0x2e')]=_[_0x7030('0x2f')](_0x10dedd[_0x7030('0x2c')],qs[_0x7030('0x30')](_0x2e086e[_0x7030('0x2d')][_0x7030('0x30')]));_0x56b4ce[_0x7030('0x2e')]=_0x56b4ce[_0x7030('0x2e')][_0x7030('0x31')]?_0x56b4ce[_0x7030('0x2e')]:_0x10dedd[_0x7030('0x2c')];if(!_0x2e086e[_0x7030('0x2d')][_0x7030('0x32')](_0x7030('0x33'))){_0x56b4ce[_0x7030('0x1e')]=qs[_0x7030('0x1e')](_0x2e086e['query'][_0x7030('0x1e')]);_0x56b4ce['offset']=qs[_0x7030('0x1d')](_0x2e086e[_0x7030('0x2d')]['offset']);}_0x56b4ce[_0x7030('0x34')]=qs[_0x7030('0x35')](_0x2e086e[_0x7030('0x2d')][_0x7030('0x35')]);_0x56b4ce['where']=qs[_0x7030('0x36')](_['pick'](_0x2e086e[_0x7030('0x2d')],_0x10dedd[_0x7030('0x36')]),_0x2369ef);if(_0x2e086e[_0x7030('0x2d')][_0x7030('0x37')]){_0x56b4ce[_0x7030('0x38')]=_['merge'](_0x56b4ce['where'],{'$or':_[_0x7030('0x28')](_0x2369ef,function(_0x481974){if(_0x481974['type']!=='VIRTUAL'){var _0x1e23bc={};_0x1e23bc[_0x481974[_0x7030('0x26')]]={'$like':'%'+_0x2e086e[_0x7030('0x2d')][_0x7030('0x37')]+'%'};return _0x1e23bc;}})});}_0x56b4ce=_[_0x7030('0x39')]({},_0x56b4ce,_0x2e086e[_0x7030('0x3a')]);var _0x351bf6={'where':_0x56b4ce[_0x7030('0x38')]};return db['Attachment'][_0x7030('0x3b')](_0x351bf6)[_0x7030('0x23')](function(_0x2e9244){_0x40640b[_0x7030('0x3b')]=_0x2e9244;if(_0x2e086e[_0x7030('0x2d')][_0x7030('0x3c')]){_0x56b4ce[_0x7030('0x3d')]=[{'all':!![]}];}return db[_0x7030('0x3e')]['findAll'](_0x56b4ce);})[_0x7030('0x23')](function(_0x366db3){_0x40640b[_0x7030('0x3f')]=_0x366db3;return _0x40640b;})['then'](respondWithFilteredResult(_0x44ed2f,_0x56b4ce))[_0x7030('0x40')](handleError(_0x44ed2f,null));};exports['show']=function(_0x1d5eee,_0x14fd67){var _0x3dd2f3={'raw':!![],'where':{'id':_0x1d5eee[_0x7030('0x41')]['id']}},_0x1d2e65={};_0x1d2e65[_0x7030('0x2c')]=_[_0x7030('0x42')](db[_0x7030('0x3e')][_0x7030('0x29')]);_0x1d2e65[_0x7030('0x2d')]=_[_0x7030('0x42')](_0x1d5eee[_0x7030('0x2d')]);_0x1d2e65['filters']=_[_0x7030('0x2f')](_0x1d2e65[_0x7030('0x2c')],_0x1d2e65[_0x7030('0x2d')]);_0x3dd2f3[_0x7030('0x2e')]=_[_0x7030('0x2f')](_0x1d2e65[_0x7030('0x2c')],qs[_0x7030('0x30')](_0x1d5eee['query'][_0x7030('0x30')]));_0x3dd2f3[_0x7030('0x2e')]=_0x3dd2f3['attributes']['length']?_0x3dd2f3[_0x7030('0x2e')]:_0x1d2e65[_0x7030('0x2c')];if(_0x1d5eee[_0x7030('0x2d')][_0x7030('0x3c')]){_0x3dd2f3[_0x7030('0x3d')]=[{'all':!![]}];}_0x3dd2f3=_[_0x7030('0x39')]({},_0x3dd2f3,_0x1d5eee[_0x7030('0x3a')]);return db[_0x7030('0x3e')]['find'](_0x3dd2f3)[_0x7030('0x23')](handleEntityNotFound(_0x14fd67,null))[_0x7030('0x23')](respondWithResult(_0x14fd67,null))['catch'](handleError(_0x14fd67,null));};exports[_0x7030('0x43')]=function(_0x5e1bd8,_0x28f829){var _0x2b4209={'where':{'id':_0x5e1bd8[_0x7030('0x41')]['id']}},_0x2379f1={};_0x2379f1[_0x7030('0x2c')]=_[_0x7030('0x42')](db[_0x7030('0x3e')][_0x7030('0x29')]);_0x2b4209[_0x7030('0x2e')]=_[_0x7030('0x2f')](_0x2379f1[_0x7030('0x2c')],qs[_0x7030('0x30')](_0x5e1bd8['query']['fields']));_0x2b4209[_0x7030('0x2e')]=_0x2b4209[_0x7030('0x2e')][_0x7030('0x31')]?_0x2b4209[_0x7030('0x2e')]:_0x2379f1['model'];if(_0x5e1bd8[_0x7030('0x2d')][_0x7030('0x3c')]){_0x2b4209[_0x7030('0x3d')]=[{'all':!![]}];}_0x2b4209=_[_0x7030('0x39')]({},_0x2b4209,_0x5e1bd8[_0x7030('0x3a')]);return db[_0x7030('0x3e')][_0x7030('0x44')](_0x2b4209)[_0x7030('0x23')](handleEntityNotFound(_0x28f829,null))['then'](function(_0x4ed57d){if(_0x4ed57d){var _0x49703c=_0x4ed57d['get']({'plain':!![]});_0x49703c=qs['omit'](_0x49703c,['id',_0x7030('0x45'),_0x7030('0x46')]);_0x5e1bd8[_0x7030('0x47')]=_[_0x7030('0x48')](_0x5e1bd8['body'],['id','createdAt',_0x7030('0x46')]);return db[_0x7030('0x3e')]['create'](_[_0x7030('0x39')](_0x49703c,_0x5e1bd8[_0x7030('0x47')]),{'include':_0x5e1bd8['query'][_0x7030('0x3c')]?[{'all':!![]}]:undefined});}})[_0x7030('0x23')](respondWithResult(_0x28f829,0xc9))[_0x7030('0x40')](handleError(_0x28f829,null));};exports[_0x7030('0x49')]=function(_0x13210d,_0x42d3ca){if(_0x13210d['body']['id']){delete _0x13210d[_0x7030('0x47')]['id'];}return db[_0x7030('0x3e')][_0x7030('0x44')]({'where':{'id':_0x13210d[_0x7030('0x41')]['id']}})[_0x7030('0x23')](handleEntityNotFound(_0x42d3ca,null))['then'](saveUpdates(_0x13210d[_0x7030('0x47')],null))[_0x7030('0x23')](respondWithResult(_0x42d3ca,null))[_0x7030('0x40')](handleError(_0x42d3ca,null));};exports['destroy']=function(_0x15553e,_0x220d38){return db[_0x7030('0x3e')][_0x7030('0x44')]({'where':{'id':_0x15553e[_0x7030('0x41')]['id']}})[_0x7030('0x23')](handleEntityNotFound(_0x220d38,null))[_0x7030('0x23')](removeEntity(_0x220d38,null))['catch'](handleError(_0x220d38,null));};exports[_0x7030('0x4a')]=function(_0x53b95b,_0x41eb93,_0x39bab3){_0x53b95b[_0x7030('0x47')]['name']=_0x53b95b[_0x7030('0x4b')][_0x7030('0x4c')];_0x53b95b[_0x7030('0x47')][_0x7030('0x4d')]=_0x53b95b[_0x7030('0x4b')][_0x7030('0x4e')];_0x53b95b[_0x7030('0x47')]['type']=_0x53b95b[_0x7030('0x4b')][_0x7030('0x4f')];return db[_0x7030('0x3e')][_0x7030('0x4a')](_0x53b95b['body'])[_0x7030('0x23')](respondWithResult(_0x41eb93,0xc9))[_0x7030('0x40')](handleError(_0x41eb93,null));};exports[_0x7030('0x50')]=function(_0xe2de05,_0x71a351,_0x3bf410){return db[_0x7030('0x3e')][_0x7030('0x51')]({'where':{'id':_0xe2de05['params']['id']},'raw':!![]})[_0x7030('0x23')](handleEntityNotFound(_0x71a351,null))[_0x7030('0x23')](function(_0x360aa5){if(_0x360aa5){return _0x71a351['download'](path[_0x7030('0x52')](config['root'],_0x7030('0x53'),_0x360aa5[_0x7030('0x4d')]));}})[_0x7030('0x40')](handleError(_0x71a351,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1c94345..cdd07be 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 _0x23db=['api','moment','bluebird','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x23db,0x141));var _0xb23d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x23db[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var logger=require(_0xb23d('0x2'))(_0xb23d('0x3'));var moment=require(_0xb23d('0x4'));var BPromise=require(_0xb23d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb23d('0x6'));var config=require(_0xb23d('0x7'));var attributes=require('./attachment.attributes');module[_0xb23d('0x8')]=function(_0x3a2ba6,_0x105811){return _0x3a2ba6[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0664=['./attachment.attributes','exports','define','Attachment','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xd9dfa8,_0x4d4a3f){var _0x521b20=function(_0x2fe1d2){while(--_0x2fe1d2){_0xd9dfa8['push'](_0xd9dfa8['shift']());}};_0x521b20(++_0x4d4a3f);}(_0x0664,0x93));var _0x4066=function(_0x3f3bf1,_0x524bcd){_0x3f3bf1=_0x3f3bf1-0x0;var _0x49f87c=_0x0664[_0x3f3bf1];return _0x49f87c;};'use strict';var _=require('lodash');var util=require(_0x4066('0x0'));var logger=require('../../config/logger')(_0x4066('0x1'));var moment=require(_0x4066('0x2'));var BPromise=require('bluebird');var rp=require(_0x4066('0x3'));var fs=require('fs');var path=require(_0x4066('0x4'));var rimraf=require(_0x4066('0x5'));var config=require(_0x4066('0x6'));var attributes=require(_0x4066('0x7'));module[_0x4066('0x8')]=function(_0x2febd3,_0x1e2bf0){return _0x2febd3[_0x4066('0x9')](_0x4066('0xa'),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 c7f6490..4134c75 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 _0x322c=['error','Attachment,\x20%s,\x20%s','message','result','CreateAttachment','Attachment','body','options','raw','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x322c,0x19f));var _0xc322=function(_0x2d271f,_0x282d0d){_0x2d271f=_0x2d271f-0x0;var _0x361f72=_0x322c[_0x2d271f];return _0x361f72;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc322('0x0'));var BPromise=require(_0xc322('0x1'));var rs=require(_0xc322('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc322('0x3'))['db'];var utils=require(_0xc322('0x4'));var logger=require('../../config/logger')(_0xc322('0x5'));var config=require(_0xc322('0x6'));var jayson=require(_0xc322('0x7'));var client=jayson[_0xc322('0x8')][_0xc322('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd91cb5,_0x38e6ed,_0x58f63a){return new BPromise(function(_0x50c7bd,_0x2f255a){return client[_0xc322('0xa')](_0xd91cb5,_0x58f63a)[_0xc322('0xb')](function(_0x4b27ca){logger[_0xc322('0xc')]('Attachment,\x20%s,\x20%s',_0x38e6ed,'request\x20sent');logger[_0xc322('0xd')](_0xc322('0xe'),_0x38e6ed,_0xc322('0xf'),JSON[_0xc322('0x10')](_0x4b27ca));if(_0x4b27ca[_0xc322('0x11')]){if(_0x4b27ca[_0xc322('0x11')]['code']===0x1f4){logger[_0xc322('0x11')](_0xc322('0x12'),_0x38e6ed,_0x4b27ca[_0xc322('0x11')][_0xc322('0x13')]);return _0x2f255a(_0x4b27ca[_0xc322('0x11')][_0xc322('0x13')]);}logger['error'](_0xc322('0x12'),_0x38e6ed,_0x4b27ca[_0xc322('0x11')][_0xc322('0x13')]);return _0x50c7bd(_0x4b27ca[_0xc322('0x11')][_0xc322('0x13')]);}else{logger['info'](_0xc322('0x12'),_0x38e6ed,_0xc322('0xf'));_0x50c7bd(_0x4b27ca[_0xc322('0x14')]['message']);}})['catch'](function(_0x318b45){logger['error'](_0xc322('0x12'),_0x38e6ed,_0x318b45);_0x2f255a(_0x318b45);});});}exports[_0xc322('0x15')]=function(_0x3655a2){var _0x5eb27b=this;return new Promise(function(_0x583202,_0x32fb31){return db[_0xc322('0x16')]['create'](_0x3655a2[_0xc322('0x17')],{'raw':_0x3655a2['options']?_0x3655a2[_0xc322('0x18')][_0xc322('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5f0761){logger[_0xc322('0xc')]('CreateAttachment',_0x3655a2);logger[_0xc322('0xd')](_0xc322('0x15'),_0x3655a2,JSON['stringify'](_0x5f0761));_0x583202(_0x5f0761);})[_0xc322('0x1a')](function(_0x510ef1){logger[_0xc322('0x11')](_0xc322('0x15'),_0x510ef1[_0xc322('0x13')],_0x3655a2);_0x32fb31(_0x5eb27b[_0xc322('0x11')](0x1f4,_0x510ef1[_0xc322('0x13')]));});});}; \ No newline at end of file +var _0xfa0c=['then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa0c,0xdb));var _0xcfa0=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0xfa0c[_0x2f6233];return _0x1c9c36;};'use strict';var _=require(_0xcfa0('0x0'));var util=require(_0xcfa0('0x1'));var moment=require(_0xcfa0('0x2'));var BPromise=require(_0xcfa0('0x3'));var rs=require(_0xcfa0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfa0('0x5'))['db'];var utils=require(_0xcfa0('0x6'));var logger=require('../../config/logger')(_0xcfa0('0x7'));var config=require(_0xcfa0('0x8'));var jayson=require(_0xcfa0('0x9'));var client=jayson[_0xcfa0('0xa')][_0xcfa0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50062c,_0x1ace37,_0x3f53bc){return new BPromise(function(_0x48d7e4,_0x1084df){return client[_0xcfa0('0xc')](_0x50062c,_0x3f53bc)[_0xcfa0('0xd')](function(_0x448750){logger[_0xcfa0('0xe')](_0xcfa0('0xf'),_0x1ace37,_0xcfa0('0x10'));logger[_0xcfa0('0x11')](_0xcfa0('0x12'),_0x1ace37,'request\x20sent',JSON[_0xcfa0('0x13')](_0x448750));if(_0x448750['error']){if(_0x448750[_0xcfa0('0x14')]['code']===0x1f4){logger['error'](_0xcfa0('0xf'),_0x1ace37,_0x448750[_0xcfa0('0x14')]['message']);return _0x1084df(_0x448750['error'][_0xcfa0('0x15')]);}logger['error'](_0xcfa0('0xf'),_0x1ace37,_0x448750[_0xcfa0('0x14')][_0xcfa0('0x15')]);return _0x48d7e4(_0x448750[_0xcfa0('0x14')][_0xcfa0('0x15')]);}else{logger[_0xcfa0('0xe')](_0xcfa0('0xf'),_0x1ace37,_0xcfa0('0x10'));_0x48d7e4(_0x448750[_0xcfa0('0x16')][_0xcfa0('0x15')]);}})[_0xcfa0('0x17')](function(_0x464bc1){logger[_0xcfa0('0x14')](_0xcfa0('0xf'),_0x1ace37,_0x464bc1);_0x1084df(_0x464bc1);});});}exports[_0xcfa0('0x18')]=function(_0x156026){var _0x26b64c=this;return new Promise(function(_0x5cc71b,_0x2fa8f2){return db[_0xcfa0('0x19')][_0xcfa0('0x1a')](_0x156026['body'],{'raw':_0x156026['options']?_0x156026[_0xcfa0('0x1b')][_0xcfa0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x387fe5){logger[_0xcfa0('0xe')](_0xcfa0('0x18'),_0x156026);logger[_0xcfa0('0x11')](_0xcfa0('0x18'),_0x156026,JSON[_0xcfa0('0x13')](_0x387fe5));_0x5cc71b(_0x387fe5);})['catch'](function(_0xcf3ccf){logger[_0xcfa0('0x14')](_0xcfa0('0x18'),_0xcf3ccf[_0xcfa0('0x15')],_0x156026);_0x2fa8f2(_0x26b64c[_0xcfa0('0x14')](0x1f4,_0xcf3ccf[_0xcfa0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a519f44..a6b8770 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 _0x7462=['index','/:id','show','/:id/download','download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','single','file','create','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3f7e41,_0x11197e){var _0x32f95f=function(_0x2efb36){while(--_0x2efb36){_0x3f7e41['push'](_0x3f7e41['shift']());}};_0x32f95f(++_0x11197e);}(_0x7462,0x165));var _0x2746=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x7462[_0x11946c];return _0x383935;};'use strict';var multer=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2746('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2746('0x3'));var config=require(_0x2746('0x4'));var controller=require('./attachment.controller');router[_0x2746('0x5')]('/',auth[_0x2746('0x6')](),controller[_0x2746('0x7')]);router[_0x2746('0x5')](_0x2746('0x8'),auth[_0x2746('0x6')](),controller[_0x2746('0x9')]);router[_0x2746('0x5')](_0x2746('0xa'),auth['isAuthenticated'](),controller[_0x2746('0xb')]);router[_0x2746('0xc')]('/:id/clone',auth[_0x2746('0x6')](),controller[_0x2746('0xd')]);var upload=multer({'storage':multer[_0x2746('0xe')]({'destination':function(_0x5aef7e,_0xd36298,_0x32201b){_0x32201b(null,path[_0x2746('0xf')](config[_0x2746('0x10')],_0x2746('0x11')));},'filename':function(_0x1fbbc7,_0x51ddae,_0x126a1f){_0x126a1f(null,util[_0x2746('0x12')](_0x2746('0x13'),Date[_0x2746('0x14')](),_0x51ddae['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2746('0xc')]('/',upload[_0x2746('0x15')](_0x2746('0x16')),controller[_0x2746('0x17')]);router['put'](_0x2746('0x8'),auth[_0x2746('0x6')](),controller['update']);router['delete'](_0x2746('0x8'),auth[_0x2746('0x6')](),controller[_0x2746('0x18')]);module[_0x2746('0x19')]=router; \ No newline at end of file +var _0x390a=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','/:id/clone','diskStorage','join','root','%s-%s','now','replace','create','delete'];(function(_0x3fe08f,_0x4ab686){var _0x583610=function(_0x354a72){while(--_0x354a72){_0x3fe08f['push'](_0x3fe08f['shift']());}};_0x583610(++_0x4ab686);}(_0x390a,0xc9));var _0xa390=function(_0x4e1785,_0x2ff29e){_0x4e1785=_0x4e1785-0x0;var _0x15a274=_0x390a[_0x4e1785];return _0x15a274;};'use strict';var multer=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var path=require(_0xa390('0x2'));var timeout=require(_0xa390('0x3'));var express=require('express');var router=express[_0xa390('0x4')]();var auth=require(_0xa390('0x5'));var interaction=require(_0xa390('0x6'));var config=require(_0xa390('0x7'));var controller=require('./attachment.controller');router[_0xa390('0x8')]('/',auth[_0xa390('0x9')](),controller[_0xa390('0xa')]);router['get'](_0xa390('0xb'),auth[_0xa390('0x9')](),controller['show']);router['get'](_0xa390('0xc'),auth[_0xa390('0x9')](),controller[_0xa390('0xd')]);router[_0xa390('0xe')](_0xa390('0xf'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xa390('0x10')]({'destination':function(_0x34f0fe,_0x1ecd8b,_0x484b38){_0x484b38(null,path[_0xa390('0x11')](config[_0xa390('0x12')],'server/files/attachments/'));},'filename':function(_0x8580d5,_0x2bee3b,_0x57a89a){_0x57a89a(null,util['format'](_0xa390('0x13'),Date[_0xa390('0x14')](),_0x2bee3b['originalname'][_0xa390('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single']('file'),controller[_0xa390('0x16')]);router['put'](_0xa390('0xb'),auth[_0xa390('0x9')](),controller['update']);router[_0xa390('0x17')](_0xa390('0xb'),auth['isAuthenticated'](),controller[_0xa390('0x18')]);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 515fb47..5a07625 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 _0xbb51=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','clearBlockUser','then','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','/login','profile','email','use','google','clientSecret','callbackURL','Setting','blockDuration','User','find','value','admin','user','agent'];(function(_0x31a4b4,_0xc4859b){var _0x26edbd=function(_0x522f54){while(--_0x522f54){_0x31a4b4['push'](_0x31a4b4['shift']());}};_0x26edbd(++_0xc4859b);}(_0xbb51,0x1e7));var _0x1bb5=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xbb51[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x1bb5('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x1bb5('0x1'))[_0x1bb5('0x2')];var moment=require(_0x1bb5('0x3'));var db=require(_0x1bb5('0x4'))['db'];var config=require(_0x1bb5('0x5'));var signToken=require(_0x1bb5('0x6'))[_0x1bb5('0x7')];var utils=require(_0x1bb5('0x8'));exports['login']=passport[_0x1bb5('0x9')]('google',{'failureRedirect':_0x1bb5('0xa'),'scope':[_0x1bb5('0xb'),_0x1bb5('0xc')],'session':![]});exports['callback']=passport[_0x1bb5('0x9')]('google',{'failureRedirect':_0x1bb5('0xa'),'session':![]});passport[_0x1bb5('0xd')](new GoogleStrategy({'clientID':config[_0x1bb5('0xe')]?config[_0x1bb5('0xe')]['clientID']:'id','clientSecret':config[_0x1bb5('0xe')]?config[_0x1bb5('0xe')][_0x1bb5('0xf')]:'secret','callbackURL':config[_0x1bb5('0xe')]?config['google'][_0x1bb5('0x10')]:''},function(_0x2ba633,_0x39728d,_0x9dd231,_0x44b63d){var _0x4d6fe0,_0x42b7dc;return db[_0x1bb5('0x11')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1bb5('0x12')],'raw':!![]})['then'](function(_0x54048e){_0x4d6fe0=_0x54048e;return db[_0x1bb5('0x13')][_0x1bb5('0x14')]({'where':{'email':_['map'](_0x9dd231['emails'],_0x1bb5('0x15')),'role':{'$or':[_0x1bb5('0x16'),_0x1bb5('0x17'),_0x1bb5('0x18')]}}});})['then'](function(_0x286fb2){_0x42b7dc=_0x286fb2;if(_0x42b7dc){if(_0x42b7dc['disabled']){return _0x44b63d(_0x1bb5('0x19'));}else if(_0x4d6fe0[_0x1bb5('0x12')]>0x0){if(_0x42b7dc['blocked']){if(moment(_0x42b7dc[_0x1bb5('0x1a')])[_0x1bb5('0x1b')](_0x4d6fe0[_0x1bb5('0x12')],'minutes')>moment()){return _0x44b63d(_0x1bb5('0x19'));}else{return utils[_0x1bb5('0x1c')](_0x42b7dc,0x0,![],null)[_0x1bb5('0x1d')](function(){return utils['getLicense'](_0x42b7dc);})[_0x1bb5('0x1d')](function(){return _0x44b63d(null,_0x42b7dc);});}}else{return utils[_0x1bb5('0x1e')](_0x42b7dc)['then'](function(){return _0x44b63d(null,_0x42b7dc);});}}else{return utils[_0x1bb5('0x1e')](_0x42b7dc)[_0x1bb5('0x1d')](function(){return _0x44b63d(null,_0x42b7dc);});}}return _0x44b63d(_0x1bb5('0x19'));})[_0x1bb5('0x1f')](function(_0x34de2d){_0x44b63d(_0x34de2d);});})); \ No newline at end of file +var _0x4ae9=['clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense','catch','lodash','passport','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','clientID'];(function(_0x56b5af,_0x1babca){var _0x5600bd=function(_0x1df977){while(--_0x1df977){_0x56b5af['push'](_0x56b5af['shift']());}};_0x5600bd(++_0x1babca);}(_0x4ae9,0xfa));var _0x94ae=function(_0x748f64,_0x1ab840){_0x748f64=_0x748f64-0x0;var _0x50a19c=_0x4ae9[_0x748f64];return _0x50a19c;};'use strict';var _=require(_0x94ae('0x0'));var passport=require(_0x94ae('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x94ae('0x2')];var moment=require('moment');var db=require(_0x94ae('0x3'))['db'];var config=require(_0x94ae('0x4'));var signToken=require(_0x94ae('0x5'))[_0x94ae('0x6')];var utils=require(_0x94ae('0x7'));exports[_0x94ae('0x8')]=passport[_0x94ae('0x9')](_0x94ae('0xa'),{'failureRedirect':_0x94ae('0xb'),'scope':[_0x94ae('0xc'),_0x94ae('0xd')],'session':![]});exports[_0x94ae('0xe')]=passport[_0x94ae('0x9')](_0x94ae('0xa'),{'failureRedirect':_0x94ae('0xb'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x94ae('0xa')]?config[_0x94ae('0xa')][_0x94ae('0xf')]:'id','clientSecret':config[_0x94ae('0xa')]?config['google'][_0x94ae('0x10')]:_0x94ae('0x11'),'callbackURL':config['google']?config[_0x94ae('0xa')][_0x94ae('0x12')]:''},function(_0x1c3841,_0x34e9f1,_0x255175,_0x136067){var _0xe8584b,_0x247e20;return db[_0x94ae('0x13')][_0x94ae('0x14')]({'where':{'id':0x1},'attributes':[_0x94ae('0x15'),_0x94ae('0x16')],'raw':!![]})[_0x94ae('0x17')](function(_0x16aa3a){_0xe8584b=_0x16aa3a;return db[_0x94ae('0x18')][_0x94ae('0x19')]({'where':{'email':_['map'](_0x255175['emails'],_0x94ae('0x1a')),'role':{'$or':[_0x94ae('0x1b'),_0x94ae('0x1c'),_0x94ae('0x1d')]}}});})[_0x94ae('0x17')](function(_0x1daadf){_0x247e20=_0x1daadf;if(_0x247e20){if(_0x247e20[_0x94ae('0x1e')]){return _0x136067(_0x94ae('0x1f'));}else if(_0xe8584b[_0x94ae('0x16')]>0x0){if(_0x247e20[_0x94ae('0x20')]){if(moment(_0x247e20[_0x94ae('0x21')])['add'](_0xe8584b[_0x94ae('0x16')],_0x94ae('0x22'))>moment()){return _0x136067(_0x94ae('0x1f'));}else{return utils[_0x94ae('0x23')](_0x247e20,0x0,![],null)[_0x94ae('0x17')](function(){return utils[_0x94ae('0x24')](_0x247e20);})[_0x94ae('0x17')](function(){return _0x136067(null,_0x247e20);});}}else{return utils[_0x94ae('0x24')](_0x247e20)[_0x94ae('0x17')](function(){return _0x136067(null,_0x247e20);});}}else{return utils['getLicense'](_0x247e20)[_0x94ae('0x17')](function(){return _0x136067(null,_0x247e20);});}}return _0x136067(_0x94ae('0x1f'));})[_0x94ae('0x25')](function(_0x177c3c){_0x136067(_0x177c3c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fff3c31..799116e 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 _0x2242=['passport','Router','../user/user.controller.js','../../components/auth/service','login','get','callback','isMiddleware','exports','express'];(function(_0x2a3bb5,_0x1199a0){var _0x6ec9fd=function(_0x360f9a){while(--_0x360f9a){_0x2a3bb5['push'](_0x2a3bb5['shift']());}};_0x6ec9fd(++_0x1199a0);}(_0x2242,0x1a3));var _0x2224=function(_0x11a3ac,_0x16f24a){_0x11a3ac=_0x11a3ac-0x0;var _0x5a97f1=_0x2242[_0x11a3ac];return _0x5a97f1;};'use strict';var express=require(_0x2224('0x0'));var passport=require(_0x2224('0x1'));var router=express[_0x2224('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x2224('0x3'));var authService=require(_0x2224('0x4'));router['get']('/',controller[_0x2224('0x5')]);router[_0x2224('0x6')]('/callback',controller[_0x2224('0x7')],authService[_0x2224('0x8')],userController[_0x2224('0x5')],authService['setTokenCookie']);module[_0x2224('0x9')]=router; \ No newline at end of file +var _0x1c4d=['callback','setTokenCookie','exports','passport','Router','./authGoogle.controller','../../components/auth/service','get','login'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x42a206,_0x2b1612){_0x42a206=_0x42a206-0x0;var _0x35eb3b=_0x1c4d[_0x42a206];return _0x35eb3b;};'use strict';var express=require('express');var passport=require(_0xd1c4('0x0'));var router=express[_0xd1c4('0x1')]();var controller=require(_0xd1c4('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xd1c4('0x3'));router[_0xd1c4('0x4')]('/',controller[_0xd1c4('0x5')]);router[_0xd1c4('0x4')]('/callback',controller[_0xd1c4('0x6')],authService['isMiddleware'],userController[_0xd1c4('0x5')],authService[_0xd1c4('0x7')]);module[_0xd1c4('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 bc2f5d5..9ccc50d 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 _0x187d=['blockedAt','loginAttempts','admin','agent','authenticate','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','blocked','getLicense','catch','MailAccount','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','Smtp','port','secure','authentication','auth','user','pass','merge','email','request','SendMail','error','format','stringify','status','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','resetPasswordToken','resetPasswordExpires','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x187d,0x93));var _0xd187=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x187d[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0xd187('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd187('0x1'))[_0xd187('0x2')];var jayson=require(_0xd187('0x3'));var _=require(_0xd187('0x4'));var rs=require(_0xd187('0x5'));var moment=require(_0xd187('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xd187('0x7'));var utils=require(_0xd187('0x8'));var client=jayson['client'][_0xd187('0x9')]({'port':0x232b});function localAuthenticate(_0x58ee7,_0x444a60,_0x1d3fe4,_0x28ce2f){var _0x2d6992,_0x358c45;return db[_0xd187('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd187('0xb'),_0xd187('0xc')],'raw':!![]})[_0xd187('0xd')](function(_0x473866){_0x2d6992=_0x473866;return _0x58ee7[_0xd187('0xe')]({'attributes':['id',_0xd187('0xf'),'password',_0xd187('0x10'),_0xd187('0x11'),_0xd187('0x12'),'blocked',_0xd187('0x13'),_0xd187('0x14')],'where':{'name':_0x444a60,'role':{'$or':[_0xd187('0x15'),'user',_0xd187('0x16')]}}});})[_0xd187('0xd')](function(_0x37870e){if(!_0x37870e||_0x37870e&&_0x37870e[_0xd187('0xf')]!==_0x444a60){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x358c45=_0x37870e;return _0x358c45;}})[_0xd187('0xd')](function(){_0x358c45[_0xd187('0x17')](_0x1d3fe4,function(_0x45ab10,_0x188cfe){var _0x4c8f68=_0x358c45[_0xd187('0x14')]+0x1;if(_0x45ab10){return _0x28ce2f(_0x45ab10);}else if(!_0x188cfe){if(_0x358c45['disabled']){return _0x28ce2f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2d6992[_0xd187('0xb')]>0x0){if(_0x358c45['blocked']){if(_0x2d6992['blockDuration']>0x0){if(moment(_0x358c45[_0xd187('0x13')])[_0xd187('0x18')](_0x2d6992[_0xd187('0xc')],_0xd187('0x19'))>moment()){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}else{return utils[_0xd187('0x1b')](_0x358c45,_0x4c8f68,![],null)[_0xd187('0xd')](function(){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});});}}else{return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}}else{if(_0x4c8f68>=_0x2d6992[_0xd187('0xb')]){return utils[_0xd187('0x1b')](_0x358c45,0x0,!![],moment())[_0xd187('0xd')](function(){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});});}else{return utils['clearBlockUser'](_0x358c45,_0x4c8f68,![],null)[_0xd187('0xd')](function(){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});});}}}else{return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}}else{if(_0x358c45['disabled']){return _0x28ce2f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2d6992['allowedLoginAttempts']>0x0){if(_0x358c45[_0xd187('0x1c')]){if(_0x2d6992[_0xd187('0xc')]>0x0){if(moment(_0x358c45[_0xd187('0x13')])['add'](_0x2d6992[_0xd187('0xc')],'minutes')>moment()){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}else{return utils['clearBlockUser'](_0x358c45,0x0,![],null)[_0xd187('0xd')](function(){return utils['getLicense'](_0x358c45);})['then'](function(){return _0x28ce2f(null,_0x358c45);});}}else{return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}}else{return utils['clearBlockUser'](_0x358c45,0x0,![],null)[_0xd187('0xd')](function(){return utils[_0xd187('0x1d')](_0x358c45);})['then'](function(){return _0x28ce2f(null,_0x358c45);})['catch'](function(_0x848ddd){return _0x28ce2f(null,![],_0x848ddd);});}}else{if(_0x358c45[_0xd187('0x1c')]){return _0x28ce2f(null,![],{'message':_0xd187('0x1a')});}else{return utils[_0xd187('0x1d')](_0x358c45)['then'](function(){return _0x28ce2f(null,_0x358c45);});}}}});})[_0xd187('0x1e')](function(_0x2875c8){return _0x28ce2f(null,![],_0x2875c8);});}function sendServiceMail(_0x5c8e52){return db[_0xd187('0x1f')][_0xd187('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd187('0xf'),'email'],'include':[{'model':db[_0xd187('0x21')],'as':'Smtp'}]})[_0xd187('0xd')](function(_0x19e75f){if(!_0x19e75f){throw new Error(_0xd187('0x22'));}var _0x352b66={'tls':{'rejectUnauthorized':![]}};if(_0x19e75f['Smtp'][_0xd187('0x23')]){_0x352b66[_0xd187('0x23')]=_0x19e75f['Smtp']['service'];}else{_0x352b66[_0xd187('0x24')]=_0x19e75f[_0xd187('0x25')][_0xd187('0x24')];_0x352b66[_0xd187('0x26')]=_0x19e75f[_0xd187('0x25')][_0xd187('0x26')];_0x352b66[_0xd187('0x27')]=_0x19e75f[_0xd187('0x25')]['secure'];}if(_0x19e75f[_0xd187('0x25')][_0xd187('0x28')]){_0x352b66[_0xd187('0x29')]={'user':_0x19e75f['Smtp'][_0xd187('0x2a')],'pass':_0x19e75f['Smtp'][_0xd187('0x2b')]};}var _0x43dc68={'account':_0x352b66,'message':_[_0xd187('0x2c')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x19e75f[_0xd187('0xf')],_0x19e75f[_0xd187('0x2d')]||_0x19e75f['Smtp'][_0xd187('0x2a')])},_0x5c8e52)};return client[_0xd187('0x2e')](_0xd187('0x2f'),_0x43dc68);})['then'](function(_0x527c6f){if(_0x527c6f[_0xd187('0x30')]){throw new Error(util[_0xd187('0x31')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x527c6f['error']['message']||JSON[_0xd187('0x32')](_0x527c6f['error'])));}return!![];});}function handleError(_0x28c252,_0x35c381,_0x5728be){return _0x28c252[_0xd187('0x33')](_0x35c381||0x1f4)['send']({'message':_0x5728be?_0x5728be[_0xd187('0x34')]||_0x5728be:''});}exports[_0xd187('0x35')]=function(_0x4af59f,_0x1a6256,_0x1d6d97){passport['authenticate'](_0xd187('0x36'),function(_0x5ec6cd,_0x5f01b7,_0x26b06d){var _0x388569=_0x5ec6cd||_0x26b06d;if(_0x388569){return handleError(_0x1a6256,0x191,_0x388569);}if(!_0x5f01b7){return handleError(_0x1a6256,0x194,{'message':_0xd187('0x37')});}else{var _0x1a8f54={'payload':{'id':_0x5f01b7['id'],'role':_0x5f01b7[_0xd187('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1a8f54)[_0xd187('0xd')](function(_0xe090ad){_0x1a6256[_0xd187('0x38')]({'id':_0x5f01b7['id'],'token':_0xe090ad,'statusCall':'','isAlreadyLogged':_0x5f01b7['online']});});}})(_0x4af59f,_0x1a6256,_0x1d6d97);};exports['forgot']=function(_0x538c05,_0x595195,_0x21bb3c){if(!_0x538c05[_0xd187('0x39')][_0xd187('0x2d')]){return handleError(_0x595195,0x1f4,{'message':_0xd187('0x3a')});}var _0x13436d=rs[_0xd187('0x3b')]();_0x538c05[_0xd187('0x39')][_0xd187('0x2d')]=_0x538c05['body'][_0xd187('0x2d')][_0xd187('0x3c')]()[_0xd187('0x3d')]();var _0x51c7fc;return db[_0xd187('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd187('0xb'),_0xd187('0xc')],'raw':!![]})[_0xd187('0xd')](function(_0xb5322c){_0x51c7fc=_0xb5322c;return db[_0xd187('0x3e')]['find']({'where':{'email':_0x538c05[_0xd187('0x39')][_0xd187('0x2d')]}});})[_0xd187('0xd')](function(_0x3fa19c){if(!_0x3fa19c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3fa19c[_0xd187('0x12')]){throw new Error(_0xd187('0x3f'));}if(_0x3fa19c['blocked']){if(moment(_0x3fa19c[_0xd187('0x13')])[_0xd187('0x18')](_0x51c7fc['blockDuration'],'minutes')>moment()){throw new Error(_0xd187('0x40'));}else{_0x3fa19c[_0xd187('0x1c')]=![];_0x3fa19c['blockedAt']=null;}}_0x3fa19c['resetPasswordToken']=_0x13436d;_0x3fa19c['resetPasswordExpires']=Date[_0xd187('0x41')]()+0x36ee80;return _0x3fa19c[_0xd187('0x42')]();})[_0xd187('0xd')](function(){return sendServiceMail({'to':_0x538c05[_0xd187('0x39')][_0xd187('0x2d')],'subject':_0xd187('0x43'),'text':_0xd187('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xd187('0x45')+_0x538c05[_0xd187('0x46')][_0xd187('0x24')]+_0xd187('0x47')+_0x13436d+'\x0a\x0a'+_0xd187('0x48')});})[_0xd187('0xd')](function(){_0x595195[_0xd187('0x33')](0xc8)[_0xd187('0x49')]({'message':'Reset\x20Email\x20sent!'});})[_0xd187('0x1e')](function(_0x2657be){return handleError(_0x595195,0x1f4,_0x2657be);});};exports[_0xd187('0x4a')]=function(_0x1449d7,_0x36b99d,_0x5ad646){return db[_0xd187('0x3e')][_0xd187('0x20')]({'where':{'resetPasswordToken':_0x1449d7['params'][_0xd187('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xd187('0x41')]()}}})['then'](function(_0x59bf03){if(!_0x59bf03){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xd187('0xe')]({'attributes':['id',_0xd187('0x4c'),_0xd187('0x4d'),_0xd187('0x4e')]})[_0xd187('0xd')](function(_0xafc31){if(_0xafc31[_0xd187('0x4c')])authService['validatePasswordPattern'](_0x1449d7[_0xd187('0x39')][_0xd187('0x4f')]);if(!_0xafc31[_0xd187('0x4d')]||!_0x59bf03[_0xd187('0x50')])return _0x59bf03;authService['validatePasswordHistory'](_0x1449d7[_0xd187('0x39')]['password'],_0x59bf03['previousPasswords'],_0xafc31[_0xd187('0x4e')]);return _0x59bf03;})['then'](function(){_0x59bf03[_0xd187('0x4f')]=_0x1449d7[_0xd187('0x39')][_0xd187('0x4f')];_0x59bf03[_0xd187('0x51')]=null;_0x59bf03[_0xd187('0x52')]=null;return _0x59bf03[_0xd187('0x42')]();});})[_0xd187('0xd')](function(){_0x36b99d[_0xd187('0x33')](0xc8)[_0xd187('0x49')]({'message':'Password\x20reset!'});})[_0xd187('0x1e')](function(_0x298a34){return handleError(_0x36b99d,0x1f4,_0x298a34);});};passport['use'](new LocalStrategy({'usernameField':_0xd187('0xf'),'passwordField':_0xd187('0x4f')},function(_0x2de8ee,_0x57eaf5,_0x2b87fe){return localAuthenticate(db[_0xd187('0x3e')],_0x2de8ee,_0x57eaf5,_0x2b87fe);})); \ No newline at end of file +var _0xb145=['../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','findOne','name','password','salt','disabled','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','email','SendMail','error','format','stringify','status','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','https://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb145,0xa3));var _0x5b14=function(_0x1dda63,_0x3f6ddc){_0x1dda63=_0x1dda63-0x0;var _0x1c2290=_0xb145[_0x1dda63];return _0x1c2290;};'use strict';var util=require('util');var passport=require(_0x5b14('0x0'));var LocalStrategy=require(_0x5b14('0x1'))[_0x5b14('0x2')];var jayson=require(_0x5b14('0x3'));var _=require(_0x5b14('0x4'));var rs=require(_0x5b14('0x5'));var moment=require(_0x5b14('0x6'));var db=require(_0x5b14('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5b14('0x8'));var client=jayson[_0x5b14('0x9')][_0x5b14('0xa')]({'port':0x232b});function localAuthenticate(_0x4d82ad,_0x50fd91,_0x1d12ed,_0x2a3921){var _0x34530a,_0x62cdcd;return db[_0x5b14('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x5b14('0xc'),_0x5b14('0xd')],'raw':!![]})['then'](function(_0x1d8b5f){_0x34530a=_0x1d8b5f;return _0x4d82ad[_0x5b14('0xe')]({'attributes':['id',_0x5b14('0xf'),_0x5b14('0x10'),_0x5b14('0x11'),'role',_0x5b14('0x12'),'blocked',_0x5b14('0x13'),_0x5b14('0x14')],'where':{'name':_0x50fd91,'role':{'$or':[_0x5b14('0x15'),_0x5b14('0x16'),_0x5b14('0x17')]}}});})[_0x5b14('0x18')](function(_0x52ffa9){if(!_0x52ffa9||_0x52ffa9&&_0x52ffa9[_0x5b14('0xf')]!==_0x50fd91){throw new Error(_0x5b14('0x19'));}else{_0x62cdcd=_0x52ffa9;return _0x62cdcd;}})[_0x5b14('0x18')](function(){_0x62cdcd[_0x5b14('0x1a')](_0x1d12ed,function(_0xba7e13,_0x2a8fe5){var _0x68f695=_0x62cdcd[_0x5b14('0x14')]+0x1;if(_0xba7e13){return _0x2a3921(_0xba7e13);}else if(!_0x2a8fe5){if(_0x62cdcd[_0x5b14('0x12')]){return _0x2a3921(null,![],{'message':_0x5b14('0x19')});}else if(_0x34530a[_0x5b14('0xc')]>0x0){if(_0x62cdcd[_0x5b14('0x1b')]){if(_0x34530a['blockDuration']>0x0){if(moment(_0x62cdcd[_0x5b14('0x13')])['add'](_0x34530a['blockDuration'],'minutes')>moment()){return _0x2a3921(null,![],{'message':_0x5b14('0x19')});}else{return utils[_0x5b14('0x1c')](_0x62cdcd,_0x68f695,![],null)[_0x5b14('0x18')](function(){return _0x2a3921(null,![],{'message':_0x5b14('0x19')});});}}else{return _0x2a3921(null,![],{'message':_0x5b14('0x19')});}}else{if(_0x68f695>=_0x34530a[_0x5b14('0xc')]){return utils[_0x5b14('0x1c')](_0x62cdcd,0x0,!![],moment())['then'](function(){return _0x2a3921(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x62cdcd,_0x68f695,![],null)[_0x5b14('0x18')](function(){return _0x2a3921(null,![],{'message':_0x5b14('0x19')});});}}}else{return _0x2a3921(null,![],{'message':_0x5b14('0x19')});}}else{if(_0x62cdcd[_0x5b14('0x12')]){return _0x2a3921(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x34530a[_0x5b14('0xc')]>0x0){if(_0x62cdcd[_0x5b14('0x1b')]){if(_0x34530a['blockDuration']>0x0){if(moment(_0x62cdcd[_0x5b14('0x13')])[_0x5b14('0x1d')](_0x34530a['blockDuration'],_0x5b14('0x1e'))>moment()){return _0x2a3921(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x62cdcd,0x0,![],null)['then'](function(){return utils['getLicense'](_0x62cdcd);})[_0x5b14('0x18')](function(){return _0x2a3921(null,_0x62cdcd);});}}else{return _0x2a3921(null,![],{'message':_0x5b14('0x19')});}}else{return utils[_0x5b14('0x1c')](_0x62cdcd,0x0,![],null)['then'](function(){return utils[_0x5b14('0x1f')](_0x62cdcd);})[_0x5b14('0x18')](function(){return _0x2a3921(null,_0x62cdcd);})[_0x5b14('0x20')](function(_0x143648){return _0x2a3921(null,![],_0x143648);});}}else{if(_0x62cdcd[_0x5b14('0x1b')]){return _0x2a3921(null,![],{'message':_0x5b14('0x19')});}else{return utils[_0x5b14('0x1f')](_0x62cdcd)[_0x5b14('0x18')](function(){return _0x2a3921(null,_0x62cdcd);});}}}});})[_0x5b14('0x20')](function(_0x4e9609){return _0x2a3921(null,![],_0x4e9609);});}function sendServiceMail(_0xbe39bc){return db[_0x5b14('0x21')][_0x5b14('0x22')]({'where':{'service':!![]},'attributes':['id',_0x5b14('0xf'),'email'],'include':[{'model':db[_0x5b14('0x23')],'as':_0x5b14('0x24')}]})['then'](function(_0x4ecf7c){if(!_0x4ecf7c){throw new Error(_0x5b14('0x25'));}var _0x3fb23b={'tls':{'rejectUnauthorized':![]}};if(_0x4ecf7c['Smtp']['service']){_0x3fb23b[_0x5b14('0x26')]=_0x4ecf7c['Smtp'][_0x5b14('0x26')];}else{_0x3fb23b[_0x5b14('0x27')]=_0x4ecf7c['Smtp']['host'];_0x3fb23b[_0x5b14('0x28')]=_0x4ecf7c[_0x5b14('0x24')][_0x5b14('0x28')];_0x3fb23b['secure']=_0x4ecf7c[_0x5b14('0x24')]['secure'];}if(_0x4ecf7c[_0x5b14('0x24')][_0x5b14('0x29')]){_0x3fb23b[_0x5b14('0x2a')]={'user':_0x4ecf7c[_0x5b14('0x24')]['user'],'pass':_0x4ecf7c[_0x5b14('0x24')][_0x5b14('0x2b')]};}var _0x2a1aa7={'account':_0x3fb23b,'message':_[_0x5b14('0x2c')]({'from':util['format'](_0x5b14('0x2d'),_0x4ecf7c[_0x5b14('0xf')],_0x4ecf7c[_0x5b14('0x2e')]||_0x4ecf7c['Smtp'][_0x5b14('0x16')])},_0xbe39bc)};return client['request'](_0x5b14('0x2f'),_0x2a1aa7);})[_0x5b14('0x18')](function(_0x49b0c9){if(_0x49b0c9[_0x5b14('0x30')]){throw new Error(util[_0x5b14('0x31')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x49b0c9[_0x5b14('0x30')]['message']||JSON[_0x5b14('0x32')](_0x49b0c9[_0x5b14('0x30')])));}return!![];});}function handleError(_0x178d4c,_0x284226,_0x514950){return _0x178d4c[_0x5b14('0x33')](_0x284226||0x1f4)[_0x5b14('0x34')]({'message':_0x514950?_0x514950[_0x5b14('0x35')]||_0x514950:''});}exports[_0x5b14('0x36')]=function(_0x2f8714,_0x2428b0,_0x30888f){passport[_0x5b14('0x1a')](_0x5b14('0x37'),function(_0xc93d0b,_0x423ed0,_0x3f9d1d){var _0x25aded=_0xc93d0b||_0x3f9d1d;if(_0x25aded){return handleError(_0x2428b0,0x191,_0x25aded);}if(!_0x423ed0){return handleError(_0x2428b0,0x194,{'message':_0x5b14('0x38')});}else{var _0x12d6ec={'payload':{'id':_0x423ed0['id'],'role':_0x423ed0[_0x5b14('0x39')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x12d6ec)[_0x5b14('0x18')](function(_0x572872){_0x2428b0[_0x5b14('0x3a')]({'id':_0x423ed0['id'],'token':_0x572872,'statusCall':'','isAlreadyLogged':_0x423ed0[_0x5b14('0x3b')]});});}})(_0x2f8714,_0x2428b0,_0x30888f);};exports['forgot']=function(_0x4c05ac,_0x4d9e69,_0x42a381){if(!_0x4c05ac[_0x5b14('0x3c')]['email']){return handleError(_0x4d9e69,0x1f4,{'message':_0x5b14('0x3d')});}var _0x21e7ec=rs[_0x5b14('0x3e')]();_0x4c05ac[_0x5b14('0x3c')][_0x5b14('0x2e')]=_0x4c05ac['body'][_0x5b14('0x2e')][_0x5b14('0x3f')]()['toLowerCase']();var _0x996aee;return db[_0x5b14('0xb')][_0x5b14('0xe')]({'where':{'id':0x1},'attributes':[_0x5b14('0xc'),'blockDuration'],'raw':!![]})[_0x5b14('0x18')](function(_0x2f9ce0){_0x996aee=_0x2f9ce0;return db[_0x5b14('0x40')][_0x5b14('0x22')]({'where':{'email':_0x4c05ac['body'][_0x5b14('0x2e')]}});})[_0x5b14('0x18')](function(_0x376eee){if(!_0x376eee){throw new Error(_0x5b14('0x41'));}if(_0x376eee['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x376eee[_0x5b14('0x1b')]){if(moment(_0x376eee[_0x5b14('0x13')])['add'](_0x996aee[_0x5b14('0xd')],'minutes')>moment()){throw new Error(_0x5b14('0x42'));}else{_0x376eee[_0x5b14('0x1b')]=![];_0x376eee[_0x5b14('0x13')]=null;}}_0x376eee[_0x5b14('0x43')]=_0x21e7ec;_0x376eee[_0x5b14('0x44')]=Date['now']()+0x36ee80;return _0x376eee[_0x5b14('0x45')]();})[_0x5b14('0x18')](function(){return sendServiceMail({'to':_0x4c05ac[_0x5b14('0x3c')][_0x5b14('0x2e')],'subject':_0x5b14('0x46'),'text':'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'+_0x5b14('0x47')+_0x4c05ac['headers']['host']+'/reset/'+_0x21e7ec+'\x0a\x0a'+_0x5b14('0x48')});})[_0x5b14('0x18')](function(){_0x4d9e69[_0x5b14('0x33')](0xc8)[_0x5b14('0x34')]({'message':_0x5b14('0x49')});})[_0x5b14('0x20')](function(_0x1d550f){return handleError(_0x4d9e69,0x1f4,_0x1d550f);});};exports['reset']=function(_0x548e1c,_0x49a803,_0x5d3ce6){return db['User'][_0x5b14('0x22')]({'where':{'resetPasswordToken':_0x548e1c[_0x5b14('0x4a')][_0x5b14('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x5b14('0x4c')]()}}})[_0x5b14('0x18')](function(_0x56dda8){if(!_0x56dda8){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x5b14('0xb')][_0x5b14('0xe')]({'attributes':['id','securePassword',_0x5b14('0x4d'),_0x5b14('0x4e')]})['then'](function(_0x55159b){if(_0x55159b[_0x5b14('0x4f')])authService[_0x5b14('0x50')](_0x548e1c[_0x5b14('0x3c')]['password']);if(!_0x55159b[_0x5b14('0x4d')]||!_0x56dda8[_0x5b14('0x51')])return _0x56dda8;authService[_0x5b14('0x52')](_0x548e1c[_0x5b14('0x3c')][_0x5b14('0x10')],_0x56dda8[_0x5b14('0x51')],_0x55159b[_0x5b14('0x4e')]);return _0x56dda8;})['then'](function(){_0x56dda8[_0x5b14('0x10')]=_0x548e1c['body'][_0x5b14('0x10')];_0x56dda8[_0x5b14('0x43')]=null;_0x56dda8[_0x5b14('0x44')]=null;return _0x56dda8[_0x5b14('0x45')]();});})[_0x5b14('0x18')](function(){_0x49a803[_0x5b14('0x33')](0xc8)[_0x5b14('0x34')]({'message':_0x5b14('0x53')});})[_0x5b14('0x20')](function(_0x27803d){return handleError(_0x49a803,0x1f4,_0x27803d);});};passport[_0x5b14('0x54')](new LocalStrategy({'usernameField':_0x5b14('0xf'),'passwordField':'password'},function(_0x59326e,_0x4d1a88,_0x16aa01){return localAuthenticate(db[_0x5b14('0x40')],_0x59326e,_0x4d1a88,_0x16aa01);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0a26bfc..7964594 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 _0x11dd=['exports','express','./authLocal.controller','post','login','forgot','/reset/:token','reset'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11dd,0xe1));var _0xd11d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x11dd[_0xc4001c];return _0x49f7bc;};'use strict';var express=require(_0xd11d('0x0'));var router=express['Router']();var controller=require(_0xd11d('0x1'));router[_0xd11d('0x2')]('/',controller[_0xd11d('0x3')]);router[_0xd11d('0x2')]('/forgot',controller[_0xd11d('0x4')]);router[_0xd11d('0x2')](_0xd11d('0x5'),controller[_0xd11d('0x6')]);module[_0xd11d('0x7')]=router; \ No newline at end of file +var _0x43ab=['exports','express','Router','login','post','/reset/:token'];(function(_0x2b6a5e,_0x59d2a0){var _0x174ebe=function(_0x306b4b){while(--_0x306b4b){_0x2b6a5e['push'](_0x2b6a5e['shift']());}};_0x174ebe(++_0x59d2a0);}(_0x43ab,0xc1));var _0xb43a=function(_0x1e28aa,_0x5a2c5a){_0x1e28aa=_0x1e28aa-0x0;var _0x21bbb1=_0x43ab[_0x1e28aa];return _0x21bbb1;};'use strict';var express=require(_0xb43a('0x0'));var router=express[_0xb43a('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xb43a('0x2')]);router['post']('/forgot',controller['forgot']);router[_0xb43a('0x3')](_0xb43a('0x4'),controller['reset']);module[_0xb43a('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e321401..55e7681 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 _0xa8a9=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x968dca,_0x453a5f){var _0x22e036=function(_0x135c16){while(--_0x135c16){_0x968dca['push'](_0x968dca['shift']());}};_0x22e036(++_0x453a5f);}(_0xa8a9,0x1de));var _0x9a8a=function(_0x316834,_0x61ff76){_0x316834=_0x316834-0x0;var _0x2efaa5=_0xa8a9[_0x316834];return _0x2efaa5;};'use strict';var Sequelize=require('sequelize');module[_0x9a8a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9a8a('0x1')]},'description':{'type':Sequelize[_0x9a8a('0x1')]},'status':{'type':Sequelize[_0x9a8a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9a8a('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9a04=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9a04,0x1c9));var _0x49a0=function(_0x2e1929,_0x25a558){_0x2e1929=_0x2e1929-0x0;var _0x350be3=_0x9a04[_0x2e1929];return _0x350be3;};'use strict';var Sequelize=require(_0x49a0('0x0'));module[_0x49a0('0x1')]={'name':{'type':Sequelize[_0x49a0('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x49a0('0x2')]},'status':{'type':Sequelize[_0x49a0('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x49a0('0x4')],'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 da15039..9786740 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 _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x57a065,_0x36bdda){var _0x2a7e02=function(_0x3fbb28){while(--_0x3fbb28){_0x57a065['push'](_0x57a065['shift']());}};_0x2a7e02(++_0x36bdda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0xab4a02,_0x469803){var _0x39a49f=function(_0x2cfe64){while(--_0x2cfe64){_0xab4a02['push'](_0xab4a02['shift']());}};_0x39a49f(++_0x469803);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f673621..7618215 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 _0x8845=['rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x5a1029,_0x664bcd){var _0x8ff753=function(_0xea00d2){while(--_0xea00d2){_0x5a1029['push'](_0x5a1029['shift']());}};_0x8ff753(++_0x664bcd);}(_0x8845,0x8a));var _0x5884=function(_0x192cff,_0x2157af){_0x192cff=_0x192cff-0x0;var _0x10f2c3=_0x8845[_0x192cff];return _0x10f2c3;};'use strict';var _=require(_0x5884('0x0'));var util=require(_0x5884('0x1'));var logger=require(_0x5884('0x2'))('api');var moment=require(_0x5884('0x3'));var BPromise=require(_0x5884('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5884('0x5'));var rimraf=require(_0x5884('0x6'));var config=require(_0x5884('0x7'));var attributes=require('./automation.attributes');module[_0x5884('0x8')]=function(_0x538386,_0x51e2e8){return _0x538386[_0x5884('0x9')](_0x5884('0xa'),attributes,{'tableName':_0x5884('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x464a=['path','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','../../config/logger','api','request-promise'];(function(_0x3bab53,_0x46230f){var _0x1a969e=function(_0x15ecb1){while(--_0x15ecb1){_0x3bab53['push'](_0x3bab53['shift']());}};_0x1a969e(++_0x46230f);}(_0x464a,0x127));var _0xa464=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x464a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa464('0x0'));var util=require(_0xa464('0x1'));var logger=require(_0xa464('0x2'))(_0xa464('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa464('0x4'));var fs=require('fs');var path=require(_0xa464('0x5'));var rimraf=require(_0xa464('0x6'));var config=require(_0xa464('0x7'));var attributes=require(_0xa464('0x8'));module[_0xa464('0x9')]=function(_0xf4409b,_0x46894a){return _0xf4409b[_0xa464('0xa')]('Automation',attributes,{'tableName':_0xa464('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 15b8698..d80a29e 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 _0xefca=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch'];(function(_0x233d92,_0x2b3694){var _0x33e488=function(_0x3e492f){while(--_0x3e492f){_0x233d92['push'](_0x233d92['shift']());}};_0x33e488(++_0x2b3694);}(_0xefca,0xe7));var _0xaefc=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xefca[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require(_0xaefc('0x0'));var moment=require(_0xaefc('0x1'));var BPromise=require(_0xaefc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaefc('0x3'));var db=require(_0xaefc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaefc('0x5'))(_0xaefc('0x6'));var config=require(_0xaefc('0x7'));var jayson=require(_0xaefc('0x8'));var client=jayson[_0xaefc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590411,_0x50dc09,_0x4b0c33){return new BPromise(function(_0x1013cb,_0x50c0fd){return client[_0xaefc('0xa')](_0x590411,_0x4b0c33)[_0xaefc('0xb')](function(_0x351a34){logger[_0xaefc('0xc')]('Automation,\x20%s,\x20%s',_0x50dc09,_0xaefc('0xd'));logger['debug'](_0xaefc('0xe'),_0x50dc09,_0xaefc('0xd'),JSON['stringify'](_0x351a34));if(_0x351a34[_0xaefc('0xf')]){if(_0x351a34[_0xaefc('0xf')][_0xaefc('0x10')]===0x1f4){logger['error'](_0xaefc('0x11'),_0x50dc09,_0x351a34[_0xaefc('0xf')][_0xaefc('0x12')]);return _0x50c0fd(_0x351a34['error'][_0xaefc('0x12')]);}logger['error'](_0xaefc('0x11'),_0x50dc09,_0x351a34[_0xaefc('0xf')][_0xaefc('0x12')]);return _0x1013cb(_0x351a34['error']['message']);}else{logger[_0xaefc('0xc')]('Automation,\x20%s,\x20%s',_0x50dc09,_0xaefc('0xd'));_0x1013cb(_0x351a34[_0xaefc('0x13')][_0xaefc('0x12')]);}})[_0xaefc('0x14')](function(_0x4671f5){logger[_0xaefc('0xf')]('Automation,\x20%s,\x20%s',_0x50dc09,_0x4671f5);_0x50c0fd(_0x4671f5);});});} \ No newline at end of file +var _0xd730=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xd730,0xfd));var _0x0d73=function(_0x46379f,_0x5764bc){_0x46379f=_0x46379f-0x0;var _0x41a7f0=_0xd730[_0x46379f];return _0x41a7f0;};'use strict';var _=require('lodash');var util=require(_0x0d73('0x0'));var moment=require('moment');var BPromise=require(_0x0d73('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d73('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d73('0x3'));var logger=require(_0x0d73('0x4'))(_0x0d73('0x5'));var config=require(_0x0d73('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0d73('0x7')][_0x0d73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55aba2,_0x1dc342,_0x5b966e){return new BPromise(function(_0x2a7202,_0x4a39f0){return client['request'](_0x55aba2,_0x5b966e)[_0x0d73('0x9')](function(_0x5792d1){logger[_0x0d73('0xa')](_0x0d73('0xb'),_0x1dc342,_0x0d73('0xc'));logger['debug'](_0x0d73('0xd'),_0x1dc342,'request\x20sent',JSON[_0x0d73('0xe')](_0x5792d1));if(_0x5792d1[_0x0d73('0xf')]){if(_0x5792d1[_0x0d73('0xf')][_0x0d73('0x10')]===0x1f4){logger[_0x0d73('0xf')](_0x0d73('0xb'),_0x1dc342,_0x5792d1[_0x0d73('0xf')][_0x0d73('0x11')]);return _0x4a39f0(_0x5792d1[_0x0d73('0xf')][_0x0d73('0x11')]);}logger[_0x0d73('0xf')](_0x0d73('0xb'),_0x1dc342,_0x5792d1[_0x0d73('0xf')]['message']);return _0x2a7202(_0x5792d1[_0x0d73('0xf')][_0x0d73('0x11')]);}else{logger[_0x0d73('0xa')](_0x0d73('0xb'),_0x1dc342,_0x0d73('0xc'));_0x2a7202(_0x5792d1['result'][_0x0d73('0x11')]);}})[_0x0d73('0x12')](function(_0x515c9a){logger['error']('Automation,\x20%s,\x20%s',_0x1dc342,_0x515c9a);_0x4a39f0(_0x515c9a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e4aec32..ba85aa7 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 _0x7426=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','/:id/conditions','getConditions','/:id/actions','post','addConditions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7426,0x1df));var _0x6742=function(_0x343357,_0x49ac67){_0x343357=_0x343357-0x0;var _0x5d0423=_0x7426[_0x343357];return _0x5d0423;};'use strict';var multer=require('multer');var util=require(_0x6742('0x0'));var path=require(_0x6742('0x1'));var timeout=require(_0x6742('0x2'));var express=require(_0x6742('0x3'));var router=express[_0x6742('0x4')]();var auth=require(_0x6742('0x5'));var interaction=require(_0x6742('0x6'));var config=require(_0x6742('0x7'));var controller=require(_0x6742('0x8'));router['get']('/',auth[_0x6742('0x9')](),controller['index']);router[_0x6742('0xa')](_0x6742('0xb'),auth[_0x6742('0x9')](),controller['show']);router['get'](_0x6742('0xc'),auth[_0x6742('0x9')](),controller[_0x6742('0xd')]);router[_0x6742('0xa')](_0x6742('0xe'),auth[_0x6742('0x9')](),controller['getActions']);router[_0x6742('0xf')]('/',auth[_0x6742('0x9')](),controller['create']);router[_0x6742('0xf')](_0x6742('0xc'),auth[_0x6742('0x9')](),controller[_0x6742('0x10')]);router[_0x6742('0xf')](_0x6742('0xe'),auth['isAuthenticated'](),controller['addActions']);router[_0x6742('0x11')](_0x6742('0xb'),auth['isAuthenticated'](),controller[_0x6742('0x12')]);router[_0x6742('0x13')](_0x6742('0xb'),auth[_0x6742('0x9')](),controller[_0x6742('0x14')]);module[_0x6742('0x15')]=router; \ No newline at end of file +var _0x8481=['../../config/environment','./automation.controller','isAuthenticated','show','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x312440,_0x10c4aa){var _0x145314=function(_0x508530){while(--_0x508530){_0x312440['push'](_0x312440['shift']());}};_0x145314(++_0x10c4aa);}(_0x8481,0x1c7));var _0x1848=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x8481[_0x231dda];return _0x3f88cb;};'use strict';var multer=require(_0x1848('0x0'));var util=require('util');var path=require(_0x1848('0x1'));var timeout=require(_0x1848('0x2'));var express=require(_0x1848('0x3'));var router=express[_0x1848('0x4')]();var auth=require(_0x1848('0x5'));var interaction=require(_0x1848('0x6'));var config=require(_0x1848('0x7'));var controller=require(_0x1848('0x8'));router['get']('/',auth[_0x1848('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1848('0xa')]);router[_0x1848('0xb')](_0x1848('0xc'),auth[_0x1848('0x9')](),controller[_0x1848('0xd')]);router['get'](_0x1848('0xe'),auth[_0x1848('0x9')](),controller[_0x1848('0xf')]);router[_0x1848('0x10')]('/',auth[_0x1848('0x9')](),controller[_0x1848('0x11')]);router[_0x1848('0x10')](_0x1848('0xc'),auth[_0x1848('0x9')](),controller[_0x1848('0x12')]);router['post'](_0x1848('0xe'),auth[_0x1848('0x9')](),controller['addActions']);router['put'](_0x1848('0x13'),auth[_0x1848('0x9')](),controller['update']);router[_0x1848('0x14')](_0x1848('0x13'),auth[_0x1848('0x9')](),controller[_0x1848('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 281a1ab..bbc30de 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 _0x9359=['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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x9359,0x92));var _0x9935=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9359[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9935('0x0'));module['exports']={'name':{'type':Sequelize[_0x9935('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9935('0x2')](_0x9935('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9935('0x4')],'defaultValue':0x0,'comment':_0x9935('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x9935('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9935('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9935('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9935('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9935('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9935('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9935('0x7')](0x5)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'defaultValue':0x3,'comment':_0x9935('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9935('0x7')](0x5)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9935('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9935('0xc')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9935('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x9935('0x2')]('always',_0x9935('0xd'),_0x9935('0xe')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9935('0x7')](0x9)[_0x9935('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9935('0xf')},'dialAMDGreeting':{'type':Sequelize[_0x9935('0x7')](0x9)[_0x9935('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9935('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9935('0x7')](0x9)[_0x9935('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9935('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9935('0x7')](0x9)[_0x9935('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9935('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9935('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9935('0x7')](0x9)[_0x9935('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9935('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9935('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9935('0x7')](0x5)[_0x9935('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9935('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9935('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9935('0x15')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9935('0x16'),_0x9935('0x17')),'defaultValue':_0x9935('0x16')},'dialPrefix':{'type':Sequelize[_0x9935('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9935('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9935('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9935('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9935('0x1a')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9935('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x9935('0x7')](0x5)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9935('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9935('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x9935('0x7')](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9935('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9935('0x7')](0x5)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9935('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9935('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9935('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9935('0x7')](0x5)[_0x9935('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9935('0x21')}}; \ No newline at end of file +var _0x618e=['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\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x618e,0x136));var _0xe618=function(_0x3b154f,_0x14fd22){_0x3b154f=_0x3b154f-0x0;var _0xe53d42=_0x618e[_0x3b154f];return _0xe53d42;};'use strict';var Sequelize=require(_0xe618('0x0'));module[_0xe618('0x1')]={'name':{'type':Sequelize[_0xe618('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe618('0x3')](_0xe618('0x4')),'allowNull':![],'defaultValue':_0xe618('0x4')},'description':{'type':Sequelize[_0xe618('0x2')]},'active':{'type':Sequelize[_0xe618('0x5')],'defaultValue':0x0,'comment':_0xe618('0x6')},'limitCalls':{'type':Sequelize[_0xe618('0x7')](0x4)[_0xe618('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe618('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe618('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe618('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xe618('0x7')](0x3)[_0xe618('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe618('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe618('0x7')](0x3)[_0xe618('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe618('0x7')](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe618('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xe618('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe618('0x7')](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe618('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe618('0x8')],'defaultValue':0x3,'comment':_0xe618('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe618('0x7')](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe618('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe618('0xf')},'dialTimezone':{'type':Sequelize[_0xe618('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe618('0x2')],'defaultValue':_0xe618('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xe618('0x3')]('always',_0xe618('0x11'),_0xe618('0x12')),'defaultValue':_0xe618('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe618('0x7')](0x9)[_0xe618('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xe618('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe618('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe618('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe618('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe618('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe618('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xe618('0x7')](0x9)[_0xe618('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe618('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe618('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe618('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe618('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xe618('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe618('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe618('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe618('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe618('0x3')]('DESC',_0xe618('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xe618('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe618('0x7')](0x3)[_0xe618('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe618('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe618('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe618('0x7')](0x3)[_0xe618('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe618('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe618('0x7')](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe618('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xe618('0x7')](0x3)[_0xe618('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe618('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe618('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe618('0x7')](0x3)[_0xe618('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe618('0x7')](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe618('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe618('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe618('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe618('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe618('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe618('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe618('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9956634..51e3206 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 _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x3e220d,_0x164b97){var _0x59a6dd=function(_0x9842cc){while(--_0x9842cc){_0x3e220d['push'](_0x3e220d['shift']());}};_0x59a6dd(++_0x164b97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x363a13,_0x3275f3){var _0x546bcc=function(_0x302003){while(--_0x302003){_0x363a13['push'](_0x363a13['shift']());}};_0x546bcc(++_0x3275f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5a3c135..571a1a1 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 _0xe2f1=['bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','define','campaigns','lodash','util','../../config/logger','moment'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0xe2f1,0x1c4));var _0x1e2f=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xe2f1[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0x1e2f('0x0'));var util=require(_0x1e2f('0x1'));var logger=require(_0x1e2f('0x2'))('api');var moment=require(_0x1e2f('0x3'));var BPromise=require(_0x1e2f('0x4'));var rp=require(_0x1e2f('0x5'));var fs=require('fs');var path=require(_0x1e2f('0x6'));var rimraf=require(_0x1e2f('0x7'));var config=require(_0x1e2f('0x8'));var attributes=require(_0x1e2f('0x9'));module['exports']=function(_0x10c851,_0x119410){return _0x10c851[_0x1e2f('0xa')]('Campaign',attributes,{'tableName':_0x1e2f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef4c=['define','Campaign','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes'];(function(_0x333e86,_0x5f3fde){var _0x511893=function(_0x32f482){while(--_0x32f482){_0x333e86['push'](_0x333e86['shift']());}};_0x511893(++_0x5f3fde);}(_0xef4c,0x10a));var _0xcef4=function(_0x14206d,_0x1e51e0){_0x14206d=_0x14206d-0x0;var _0xa05c40=_0xef4c[_0x14206d];return _0xa05c40;};'use strict';var _=require(_0xcef4('0x0'));var util=require('util');var logger=require(_0xcef4('0x1'))(_0xcef4('0x2'));var moment=require(_0xcef4('0x3'));var BPromise=require(_0xcef4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcef4('0x5'));var rimraf=require(_0xcef4('0x6'));var config=require(_0xcef4('0x7'));var attributes=require(_0xcef4('0x8'));module['exports']=function(_0x15a032,_0x109d34){return _0x15a032[_0xcef4('0x9')](_0xcef4('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 80ba11d..98ca948 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x27d6f9,_0x2421c8){var _0x1598d1=function(_0x1b8a9e){while(--_0x1b8a9e){_0x27d6f9['push'](_0x27d6f9['shift']());}};_0x1598d1(++_0x2421c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x387dec,_0x48ceb5){var _0xbc50ca=function(_0x10aeaf){while(--_0x10aeaf){_0x387dec['push'](_0x387dec['shift']());}};_0xbc50ca(++_0x48ceb5);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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']('Campaign,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 440cce8..ce5b490 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 _0x6a57=['getHopperFinals','getLists','getBlackLists','create','post','/:id/clone','addLists','/:id/blacklists','addBlackLists','update','delete','destroy','/:id/lists','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x6a57,0x75));var _0x76a5=function(_0x3c54d3,_0x9719e3){_0x3c54d3=_0x3c54d3-0x0;var _0xd67c8f=_0x6a57[_0x3c54d3];return _0xd67c8f;};'use strict';var multer=require(_0x76a5('0x0'));var util=require(_0x76a5('0x1'));var path=require(_0x76a5('0x2'));var timeout=require(_0x76a5('0x3'));var express=require(_0x76a5('0x4'));var router=express[_0x76a5('0x5')]();var auth=require(_0x76a5('0x6'));var interaction=require(_0x76a5('0x7'));var config=require(_0x76a5('0x8'));var controller=require(_0x76a5('0x9'));router[_0x76a5('0xa')]('/',auth[_0x76a5('0xb')](),controller[_0x76a5('0xc')]);router[_0x76a5('0xa')](_0x76a5('0xd'),auth[_0x76a5('0xb')](),controller['show']);router['get'](_0x76a5('0xe'),auth[_0x76a5('0xb')](),controller[_0x76a5('0xf')]);router[_0x76a5('0xa')](_0x76a5('0x10'),auth[_0x76a5('0xb')](),controller[_0x76a5('0x11')]);router[_0x76a5('0xa')](_0x76a5('0x12'),auth['isAuthenticated'](),controller[_0x76a5('0x13')]);router[_0x76a5('0xa')]('/:id/hopper_black',auth[_0x76a5('0xb')](),controller['getHopperBlacks']);router[_0x76a5('0xa')]('/:id/lists',auth[_0x76a5('0xb')](),controller[_0x76a5('0x14')]);router[_0x76a5('0xa')]('/:id/blacklists',auth[_0x76a5('0xb')](),controller[_0x76a5('0x15')]);router['post']('/',auth[_0x76a5('0xb')](),controller[_0x76a5('0x16')]);router[_0x76a5('0x17')](_0x76a5('0x18'),auth['isAuthenticated'](),controller['clone']);router[_0x76a5('0x17')]('/:id/lists',auth[_0x76a5('0xb')](),controller[_0x76a5('0x19')]);router['post'](_0x76a5('0x1a'),auth[_0x76a5('0xb')](),controller[_0x76a5('0x1b')]);router['put'](_0x76a5('0xd'),auth[_0x76a5('0xb')](),controller[_0x76a5('0x1c')]);router[_0x76a5('0x1d')](_0x76a5('0xd'),auth[_0x76a5('0xb')](),controller[_0x76a5('0x1e')]);router['delete'](_0x76a5('0x1f'),auth[_0x76a5('0xb')](),controller[_0x76a5('0x20')]);router['delete'](_0x76a5('0x1a'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x76a5('0x21')]=router; \ No newline at end of file +var _0x01d2=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','connect-timeout','express','Router','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x108957,_0x318131){var _0x16fb79=function(_0x43111b){while(--_0x43111b){_0x108957['push'](_0x108957['shift']());}};_0x16fb79(++_0x318131);}(_0x01d2,0x86));var _0x201d=function(_0x1ab593,_0x4f286f){_0x1ab593=_0x1ab593-0x0;var _0x344fa7=_0x01d2[_0x1ab593];return _0x344fa7;};'use strict';var multer=require('multer');var util=require(_0x201d('0x0'));var path=require('path');var timeout=require(_0x201d('0x1'));var express=require(_0x201d('0x2'));var router=express[_0x201d('0x3')]();var auth=require(_0x201d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x201d('0x5'));router[_0x201d('0x6')]('/',auth[_0x201d('0x7')](),controller[_0x201d('0x8')]);router[_0x201d('0x6')](_0x201d('0x9'),auth[_0x201d('0x7')](),controller[_0x201d('0xa')]);router[_0x201d('0x6')](_0x201d('0xb'),auth[_0x201d('0x7')](),controller['getHoppers']);router['get'](_0x201d('0xc'),auth[_0x201d('0x7')](),controller['getHopperHistories']);router[_0x201d('0x6')](_0x201d('0xd'),auth[_0x201d('0x7')](),controller[_0x201d('0xe')]);router[_0x201d('0x6')](_0x201d('0xf'),auth[_0x201d('0x7')](),controller['getHopperBlacks']);router[_0x201d('0x6')](_0x201d('0x10'),auth['isAuthenticated'](),controller[_0x201d('0x11')]);router[_0x201d('0x6')](_0x201d('0x12'),auth[_0x201d('0x7')](),controller[_0x201d('0x13')]);router[_0x201d('0x14')]('/',auth[_0x201d('0x7')](),controller['create']);router[_0x201d('0x14')]('/:id/clone',auth[_0x201d('0x7')](),controller['clone']);router[_0x201d('0x14')]('/:id/lists',auth[_0x201d('0x7')](),controller[_0x201d('0x15')]);router[_0x201d('0x14')](_0x201d('0x12'),auth[_0x201d('0x7')](),controller[_0x201d('0x16')]);router[_0x201d('0x17')](_0x201d('0x9'),auth[_0x201d('0x7')](),controller[_0x201d('0x18')]);router[_0x201d('0x19')](_0x201d('0x9'),auth[_0x201d('0x7')](),controller[_0x201d('0x1a')]);router[_0x201d('0x19')]('/:id/lists',auth[_0x201d('0x7')](),controller[_0x201d('0x1b')]);router['delete']('/:id/blacklists',auth[_0x201d('0x7')](),controller[_0x201d('0x1c')]);module[_0x201d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6fc35e6..cd97794 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 _0xb896=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x2f3b49,_0x169755){var _0x31984d=function(_0xd8ef3a){while(--_0xd8ef3a){_0x2f3b49['push'](_0x2f3b49['shift']());}};_0x31984d(++_0x169755);}(_0xb896,0xbd));var _0x6b89=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0xb896[_0xdd82b4];return _0x549bb2;};'use strict';var Sequelize=require(_0x6b89('0x0'));module[_0x6b89('0x1')]={'key':{'type':Sequelize[_0x6b89('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6b89('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x6b89('0x2')]},'name':{'type':Sequelize[_0x6b89('0x4')],'get':function(){return this[_0x6b89('0x5')](_0x6b89('0x6'));}}}; \ No newline at end of file +var _0xbdc4=['STRING','TEXT','getDataValue','sequelize'];(function(_0x36373c,_0x46fc83){var _0x2af4b4=function(_0x355429){while(--_0x355429){_0x36373c['push'](_0x36373c['shift']());}};_0x2af4b4(++_0x46fc83);}(_0xbdc4,0xab));var _0x4bdc=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xbdc4[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x4bdc('0x0'));module['exports']={'key':{'type':Sequelize[_0x4bdc('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x4bdc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4bdc('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4bdc('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5e8e4ad..e9e6760 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 _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 12bf032..49bad1d 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 _0x4133=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x190d89,_0x3cf28b){var _0x4f1b38=function(_0x2454ec){while(--_0x2454ec){_0x190d89['push'](_0x190d89['shift']());}};_0x4f1b38(++_0x3cf28b);}(_0x4133,0x17a));var _0x3413=function(_0x2e0e6d,_0x375753){_0x2e0e6d=_0x2e0e6d-0x0;var _0x454fc4=_0x4133[_0x2e0e6d];return _0x454fc4;};'use strict';var _=require(_0x3413('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3413('0x1'));var moment=require(_0x3413('0x2'));var BPromise=require(_0x3413('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3413('0x4'));var rimraf=require(_0x3413('0x5'));var config=require(_0x3413('0x6'));var attributes=require(_0x3413('0x7'));module[_0x3413('0x8')]=function(_0xc8146d,_0x266492){return _0xc8146d[_0x3413('0x9')](_0x3413('0xa'),attributes,{'tableName':_0x3413('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3413('0xc'),'collate':_0x3413('0xd')});}; \ No newline at end of file +var _0xaa3f=['util','api','moment','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','lodash'];(function(_0x15d3af,_0x456866){var _0x5db407=function(_0x38727f){while(--_0x38727f){_0x15d3af['push'](_0x15d3af['shift']());}};_0x5db407(++_0x456866);}(_0xaa3f,0x95));var _0xfaa3=function(_0x1bc4e0,_0x2d3fb8){_0x1bc4e0=_0x1bc4e0-0x0;var _0xb4c533=_0xaa3f[_0x1bc4e0];return _0xb4c533;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require('../../config/logger')(_0xfaa3('0x2'));var moment=require(_0xfaa3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaa3('0x4'));var rimraf=require(_0xfaa3('0x5'));var config=require('../../config/environment');var attributes=require(_0xfaa3('0x6'));module['exports']=function(_0x3f85e4,_0x5760ee){return _0x3f85e4[_0xfaa3('0x7')](_0xfaa3('0x8'),attributes,{'tableName':_0xfaa3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6d674a7..9a54614 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 _0x3bcd=['CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3cec95,_0x8b662f){var _0x273cea=function(_0x17386f){while(--_0x17386f){_0x3cec95['push'](_0x3cec95['shift']());}};_0x273cea(++_0x8b662f);}(_0x3bcd,0xf9));var _0xd3bc=function(_0x506cbf,_0xb7e1d8){_0x506cbf=_0x506cbf-0x0;var _0x5513f1=_0x3bcd[_0x506cbf];return _0x5513f1;};'use strict';var _=require(_0xd3bc('0x0'));var util=require('util');var moment=require(_0xd3bc('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3bc('0x2'));var fs=require('fs');var Redis=require(_0xd3bc('0x3'));var db=require(_0xd3bc('0x4'))['db'];var utils=require(_0xd3bc('0x5'));var logger=require('../../config/logger')(_0xd3bc('0x6'));var config=require(_0xd3bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3bc('0x8')][_0xd3bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbe6eb6,_0x190d7d,_0x31691a){return new BPromise(function(_0x2a406a,_0x278ed0){return client[_0xd3bc('0xa')](_0xbe6eb6,_0x31691a)[_0xd3bc('0xb')](function(_0x5605f3){logger['info'](_0xd3bc('0xc'),_0x190d7d,_0xd3bc('0xd'));logger[_0xd3bc('0xe')](_0xd3bc('0xf'),_0x190d7d,_0xd3bc('0xd'),JSON['stringify'](_0x5605f3));if(_0x5605f3[_0xd3bc('0x10')]){if(_0x5605f3['error'][_0xd3bc('0x11')]===0x1f4){logger[_0xd3bc('0x10')](_0xd3bc('0xc'),_0x190d7d,_0x5605f3[_0xd3bc('0x10')][_0xd3bc('0x12')]);return _0x278ed0(_0x5605f3[_0xd3bc('0x10')][_0xd3bc('0x12')]);}logger[_0xd3bc('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x190d7d,_0x5605f3[_0xd3bc('0x10')][_0xd3bc('0x12')]);return _0x2a406a(_0x5605f3[_0xd3bc('0x10')][_0xd3bc('0x12')]);}else{logger[_0xd3bc('0x13')](_0xd3bc('0xc'),_0x190d7d,'request\x20sent');_0x2a406a(_0x5605f3[_0xd3bc('0x14')][_0xd3bc('0x12')]);}})[_0xd3bc('0x15')](function(_0x40975f){logger[_0xd3bc('0x10')](_0xd3bc('0xc'),_0x190d7d,_0x40975f);_0x278ed0(_0x40975f);});});} \ No newline at end of file +var _0xd615=['CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd615,0x1ec));var _0x5d61=function(_0x1cac9f,_0x4d9691){_0x1cac9f=_0x1cac9f-0x0;var _0x14ea8f=_0xd615[_0x1cac9f];return _0x14ea8f;};'use strict';var _=require(_0x5d61('0x0'));var util=require(_0x5d61('0x1'));var moment=require(_0x5d61('0x2'));var BPromise=require(_0x5d61('0x3'));var rs=require(_0x5d61('0x4'));var fs=require('fs');var Redis=require(_0x5d61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d61('0x6'));var logger=require(_0x5d61('0x7'))(_0x5d61('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d61('0x9'));var client=jayson['client'][_0x5d61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e3118,_0x4946dd,_0xc12fd5){return new BPromise(function(_0x21b74b,_0x577e69){return client[_0x5d61('0xb')](_0x4e3118,_0xc12fd5)[_0x5d61('0xc')](function(_0xde9b73){logger[_0x5d61('0xd')](_0x5d61('0xe'),_0x4946dd,_0x5d61('0xf'));logger[_0x5d61('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x4946dd,_0x5d61('0xf'),JSON['stringify'](_0xde9b73));if(_0xde9b73[_0x5d61('0x11')]){if(_0xde9b73['error'][_0x5d61('0x12')]===0x1f4){logger[_0x5d61('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x4946dd,_0xde9b73[_0x5d61('0x11')]['message']);return _0x577e69(_0xde9b73[_0x5d61('0x11')][_0x5d61('0x13')]);}logger[_0x5d61('0x11')](_0x5d61('0xe'),_0x4946dd,_0xde9b73[_0x5d61('0x11')]['message']);return _0x21b74b(_0xde9b73[_0x5d61('0x11')][_0x5d61('0x13')]);}else{logger[_0x5d61('0xd')](_0x5d61('0xe'),_0x4946dd,_0x5d61('0xf'));_0x21b74b(_0xde9b73[_0x5d61('0x14')]['message']);}})[_0x5d61('0x15')](function(_0x1e7d29){logger[_0x5d61('0x11')](_0x5d61('0xe'),_0x4946dd,_0x1e7d29);_0x577e69(_0x1e7d29);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 8f8d027..5bd31fa 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 _0x2c79=['update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2c79,0x102));var _0x92c7=function(_0x5e2d99,_0x53bd2f){_0x5e2d99=_0x5e2d99-0x0;var _0x43f756=_0x2c79[_0x5e2d99];return _0x43f756;};'use strict';var multer=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var path=require('path');var timeout=require(_0x92c7('0x2'));var express=require(_0x92c7('0x3'));var router=express['Router']();var auth=require(_0x92c7('0x4'));var interaction=require(_0x92c7('0x5'));var config=require('../../config/environment');var controller=require(_0x92c7('0x6'));router[_0x92c7('0x7')]('/',auth[_0x92c7('0x8')](),controller[_0x92c7('0x9')]);router[_0x92c7('0x7')](_0x92c7('0xa'),auth[_0x92c7('0x8')](),controller['show']);router[_0x92c7('0xb')]('/',auth[_0x92c7('0x8')](),controller[_0x92c7('0xc')]);router[_0x92c7('0xd')](_0x92c7('0xa'),auth[_0x92c7('0x8')](),controller[_0x92c7('0xe')]);router['delete'](_0x92c7('0xa'),auth[_0x92c7('0x8')](),controller[_0x92c7('0xf')]);module[_0x92c7('0x10')]=router; \ No newline at end of file +var _0xe351=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show'];(function(_0x491cc9,_0x5b92a6){var _0x164c8d=function(_0x5c1c5f){while(--_0x5c1c5f){_0x491cc9['push'](_0x491cc9['shift']());}};_0x164c8d(++_0x5b92a6);}(_0xe351,0x10b));var _0x1e35=function(_0x4cada5,_0x56c586){_0x4cada5=_0x4cada5-0x0;var _0x1539a2=_0xe351[_0x4cada5];return _0x1539a2;};'use strict';var multer=require(_0x1e35('0x0'));var util=require(_0x1e35('0x1'));var path=require(_0x1e35('0x2'));var timeout=require(_0x1e35('0x3'));var express=require(_0x1e35('0x4'));var router=express[_0x1e35('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1e35('0x6'));var config=require(_0x1e35('0x7'));var controller=require(_0x1e35('0x8'));router[_0x1e35('0x9')]('/',auth[_0x1e35('0xa')](),controller[_0x1e35('0xb')]);router[_0x1e35('0x9')]('/:id',auth[_0x1e35('0xa')](),controller[_0x1e35('0xc')]);router[_0x1e35('0xd')]('/',auth[_0x1e35('0xa')](),controller[_0x1e35('0xe')]);router[_0x1e35('0xf')](_0x1e35('0x10'),auth[_0x1e35('0xa')](),controller[_0x1e35('0x11')]);router['delete']('/:id',auth[_0x1e35('0xa')](),controller[_0x1e35('0x12')]);module[_0x1e35('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 75f6b9a..0d0a926 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 _0x5a8c=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x1abaef,_0x4c0213){var _0x514bc4=function(_0x15104e){while(--_0x15104e){_0x1abaef['push'](_0x1abaef['shift']());}};_0x514bc4(++_0x4c0213);}(_0x5a8c,0x111));var _0xc5a8=function(_0x2d8120,_0x4c157e){_0x2d8120=_0x2d8120-0x0;var _0x45df59=_0x5a8c[_0x2d8120];return _0x45df59;};'use strict';var Sequelize=require(_0xc5a8('0x0'));module[_0xc5a8('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xc5a8('0x2')},'clid':{'type':Sequelize[_0xc5a8('0x3')]},'src':{'type':Sequelize[_0xc5a8('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xc5a8('0x3')]},'channel':{'type':Sequelize[_0xc5a8('0x3')]},'dstchannel':{'type':Sequelize[_0xc5a8('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xc5a8('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc5a8('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc5a8('0x3')]},'userfield':{'type':Sequelize[_0xc5a8('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xc5a8('0x3')]},'peeraccount':{'type':Sequelize[_0xc5a8('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xc5a8('0x3')]}}; \ No newline at end of file +var _0x9968=['INTEGER','exports','DATE','STRING'];(function(_0x41210e,_0x2a3522){var _0x40033e=function(_0x156cdb){while(--_0x156cdb){_0x41210e['push'](_0x41210e['shift']());}};_0x40033e(++_0x2a3522);}(_0x9968,0x1c1));var _0x8996=function(_0x2911b6,_0x33d69c){_0x2911b6=_0x2911b6-0x0;var _0x9f4952=_0x9968[_0x2911b6];return _0x9f4952;};'use strict';var Sequelize=require('sequelize');module[_0x8996('0x0')]={'calldate':{'type':Sequelize[_0x8996('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8996('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8996('0x2')]},'dstchannel':{'type':Sequelize[_0x8996('0x2')]},'lastapp':{'type':Sequelize[_0x8996('0x2')]},'lastdata':{'type':Sequelize[_0x8996('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8996('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8996('0x2')]},'amaflags':{'type':Sequelize[_0x8996('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x8996('0x2')]},'uniqueid':{'type':Sequelize[_0x8996('0x2')]},'linkedid':{'type':Sequelize[_0x8996('0x2')]},'sequence':{'type':Sequelize[_0x8996('0x2')]},'peeraccount':{'type':Sequelize[_0x8996('0x2')]},'type':{'type':Sequelize[_0x8996('0x2')]},'tag':{'type':Sequelize[_0x8996('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 2a643d5..f103018 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 _0x55a0=['keys','filters','intersection','attributes','length','nolimit','limit','order','sort','filter','where','merge','map','type','VIRTUAL','options','then','count','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','set','reject','update','destroy','error','name','send','index','Cdr','fieldName','key','model','query'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x55a0,0x67));var _0x055a=function(_0x16d644,_0x46545e){_0x16d644=_0x16d644-0x0;var _0xf808cc=_0x55a0[_0x16d644];return _0xf808cc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x055a('0x0'));var rimraf=require(_0x055a('0x1'));var zipdir=require(_0x055a('0x2'));var jsonpatch=require(_0x055a('0x3'));var rp=require(_0x055a('0x4'));var moment=require(_0x055a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x055a('0x6'));var util=require('util');var path=require(_0x055a('0x7'));var sox=require(_0x055a('0x8'));var csv=require(_0x055a('0x9'));var ejs=require(_0x055a('0xa'));var fs=require('fs');var _=require(_0x055a('0xb'));var squel=require('squel');var crypto=require(_0x055a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x055a('0xd'));var toCsv=require(_0x055a('0x9'));var querystring=require(_0x055a('0xe'));var Papa=require(_0x055a('0xf'));var Redis=require(_0x055a('0x10'));var authService=require(_0x055a('0x11'));var qs=require(_0x055a('0x12'));var as=require(_0x055a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x055a('0x14'));var utils=require(_0x055a('0x15'));var config=require(_0x055a('0x16'));var licenseUtil=require(_0x055a('0x17'));var db=require(_0x055a('0x18'))['db'];function respondWithStatusCode(_0x47ff14,_0xe43dd6){_0xe43dd6=_0xe43dd6||0xcc;return function(_0x137f8a){if(_0x137f8a){return _0x47ff14[_0x055a('0x19')](_0xe43dd6);}return _0x47ff14['status'](_0xe43dd6)[_0x055a('0x1a')]();};}function respondWithResult(_0xcfcc68,_0x2a0397){_0x2a0397=_0x2a0397||0xc8;return function(_0x4afe5c){if(_0x4afe5c){return _0xcfcc68[_0x055a('0x1b')](_0x2a0397)[_0x055a('0x1c')](_0x4afe5c);}};}function respondWithFilteredResult(_0x1e4397,_0x5cd4c7){return function(_0x5f4adc){if(_0x5f4adc){var _0x5d252c=_0x5f4adc['count'],_0x5c57b2=_0x5cd4c7['offset'],_0x1bac29=_0x5cd4c7[_0x055a('0x1d')]+_0x5cd4c7['limit'],_0x579645;if(_0x1bac29>=_0x5d252c){_0x1bac29=_0x5d252c;_0x579645=0xc8;}else{_0x579645=0xce;}_0x1e4397[_0x055a('0x1b')](_0x579645);return _0x1e4397[_0x055a('0x1e')]('Content-Range',_0x5c57b2+'-'+_0x1bac29+'/'+_0x5d252c)['json'](_0x5f4adc);}return null;};}function patchUpdates(_0x6dd987){return function(_0x4eb48d){try{jsonpatch['apply'](_0x4eb48d,_0x6dd987,!![]);}catch(_0x27b0e5){return BPromise[_0x055a('0x1f')](_0x27b0e5);}return _0x4eb48d['save']();};}function saveUpdates(_0x19a1b1,_0x10802e){return function(_0xfcbcdb){if(_0xfcbcdb){return _0xfcbcdb[_0x055a('0x20')](_0x19a1b1)['then'](function(_0x2ad732){return _0x2ad732;});}return null;};}function removeEntity(_0x5c31c7,_0x58c208){return function(_0x40865c){if(_0x40865c){return _0x40865c[_0x055a('0x21')]()['then'](function(){_0x5c31c7[_0x055a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13078f,_0x48265b){return function(_0x492330){if(!_0x492330){_0x13078f[_0x055a('0x19')](0x194);}return _0x492330;};}function handleError(_0x18cb82,_0x7dff11){_0x7dff11=_0x7dff11||0x1f4;return function(_0x3eaf75){logger[_0x055a('0x22')](_0x3eaf75['stack']);if(_0x3eaf75[_0x055a('0x23')]){delete _0x3eaf75[_0x055a('0x23')];}_0x18cb82[_0x055a('0x1b')](_0x7dff11)[_0x055a('0x24')](_0x3eaf75);};}exports[_0x055a('0x25')]=function(_0x444c96,_0x241070){var _0x516129={},_0x51eb7f={},_0x58b60a={'count':0x0,'rows':[]};var _0x22d6a2=_['map'](db[_0x055a('0x26')]['rawAttributes'],function(_0x2ea610){return{'name':_0x2ea610[_0x055a('0x27')],'type':_0x2ea610['type'][_0x055a('0x28')]};});_0x51eb7f[_0x055a('0x29')]=_['map'](_0x22d6a2,_0x055a('0x23'));_0x51eb7f[_0x055a('0x2a')]=_[_0x055a('0x2b')](_0x444c96['query']);_0x51eb7f[_0x055a('0x2c')]=_[_0x055a('0x2d')](_0x51eb7f[_0x055a('0x29')],_0x51eb7f['query']);_0x516129[_0x055a('0x2e')]=_['intersection'](_0x51eb7f[_0x055a('0x29')],qs['fields'](_0x444c96[_0x055a('0x2a')]['fields']));_0x516129[_0x055a('0x2e')]=_0x516129['attributes'][_0x055a('0x2f')]?_0x516129[_0x055a('0x2e')]:_0x51eb7f[_0x055a('0x29')];if(!_0x444c96[_0x055a('0x2a')]['hasOwnProperty'](_0x055a('0x30'))){_0x516129[_0x055a('0x31')]=qs['limit'](_0x444c96[_0x055a('0x2a')]['limit']);_0x516129[_0x055a('0x1d')]=qs['offset'](_0x444c96[_0x055a('0x2a')][_0x055a('0x1d')]);}_0x516129[_0x055a('0x32')]=qs['sort'](_0x444c96[_0x055a('0x2a')][_0x055a('0x33')]);_0x516129['where']=qs[_0x055a('0x2c')](_['pick'](_0x444c96['query'],_0x51eb7f[_0x055a('0x2c')]),_0x22d6a2);if(_0x444c96[_0x055a('0x2a')][_0x055a('0x34')]){_0x516129[_0x055a('0x35')]=_[_0x055a('0x36')](_0x516129[_0x055a('0x35')],{'$or':_[_0x055a('0x37')](_0x22d6a2,function(_0x3a0bff){if(_0x3a0bff[_0x055a('0x38')]!==_0x055a('0x39')){var _0xa3a677={};_0xa3a677[_0x3a0bff['name']]={'$like':'%'+_0x444c96[_0x055a('0x2a')]['filter']+'%'};return _0xa3a677;}})});}_0x516129=_[_0x055a('0x36')]({},_0x516129,_0x444c96[_0x055a('0x3a')]);var _0xc7eb22={'where':_0x516129[_0x055a('0x35')]};return db[_0x055a('0x26')]['count'](_0xc7eb22)[_0x055a('0x3b')](function(_0x3fefa7){_0x58b60a[_0x055a('0x3c')]=_0x3fefa7;if(_0x444c96[_0x055a('0x2a')][_0x055a('0x3d')]){_0x516129[_0x055a('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0x055a('0x3f')](_0x516129);})[_0x055a('0x3b')](function(_0x560beb){_0x58b60a['rows']=_0x560beb;return _0x58b60a;})['then'](respondWithFilteredResult(_0x241070,_0x516129))[_0x055a('0x40')](handleError(_0x241070,null));};exports[_0x055a('0x41')]=function(_0x4ed547,_0x3eed13){var _0xa6e4f3={'raw':!![],'where':{'id':_0x4ed547[_0x055a('0x42')]['id']}},_0x2d4659={};_0x2d4659[_0x055a('0x29')]=_[_0x055a('0x2b')](db[_0x055a('0x26')][_0x055a('0x43')]);_0x2d4659[_0x055a('0x2a')]=_[_0x055a('0x2b')](_0x4ed547[_0x055a('0x2a')]);_0x2d4659[_0x055a('0x2c')]=_[_0x055a('0x2d')](_0x2d4659[_0x055a('0x29')],_0x2d4659[_0x055a('0x2a')]);_0xa6e4f3['attributes']=_[_0x055a('0x2d')](_0x2d4659[_0x055a('0x29')],qs[_0x055a('0x44')](_0x4ed547[_0x055a('0x2a')]['fields']));_0xa6e4f3[_0x055a('0x2e')]=_0xa6e4f3[_0x055a('0x2e')][_0x055a('0x2f')]?_0xa6e4f3[_0x055a('0x2e')]:_0x2d4659[_0x055a('0x29')];if(_0x4ed547['query'][_0x055a('0x3d')]){_0xa6e4f3[_0x055a('0x3e')]=[{'all':!![]}];}_0xa6e4f3=_[_0x055a('0x36')]({},_0xa6e4f3,_0x4ed547[_0x055a('0x3a')]);return db[_0x055a('0x26')][_0x055a('0x45')](_0xa6e4f3)[_0x055a('0x3b')](handleEntityNotFound(_0x3eed13,null))[_0x055a('0x3b')](respondWithResult(_0x3eed13,null))[_0x055a('0x40')](handleError(_0x3eed13,null));};exports[_0x055a('0x46')]=function(_0x1cbad4,_0x545d00){return db[_0x055a('0x26')]['create'](_0x1cbad4[_0x055a('0x47')],{})['then'](respondWithResult(_0x545d00,0xc9))[_0x055a('0x40')](handleError(_0x545d00,null));};exports[_0x055a('0x20')]=function(_0x45b941,_0xcfc6e){if(_0x45b941['body']['id']){delete _0x45b941[_0x055a('0x47')]['id'];}return db[_0x055a('0x26')]['find']({'where':{'id':_0x45b941['params']['id']}})[_0x055a('0x3b')](handleEntityNotFound(_0xcfc6e,null))['then'](saveUpdates(_0x45b941[_0x055a('0x47')],null))[_0x055a('0x3b')](respondWithResult(_0xcfc6e,null))[_0x055a('0x40')](handleError(_0xcfc6e,null));};exports[_0x055a('0x21')]=function(_0x298f6e,_0x7e4455){return db['Cdr'][_0x055a('0x45')]({'where':{'id':_0x298f6e[_0x055a('0x42')]['id']}})[_0x055a('0x3b')](handleEntityNotFound(_0x7e4455,null))[_0x055a('0x3b')](removeEntity(_0x7e4455,null))[_0x055a('0x40')](handleError(_0x7e4455,null));};exports[_0x055a('0x48')]=function(_0x2192ab,_0x2e34cd){return db[_0x055a('0x26')]['describe']()[_0x055a('0x3b')](respondWithResult(_0x2e34cd,null))['catch'](handleError(_0x2e34cd,null));}; \ No newline at end of file +var _0x3a65=['filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','Cdr','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','key','model','keys','query'];(function(_0x35ebbb,_0xe862ef){var _0x29d9b=function(_0x4fee98){while(--_0x4fee98){_0x35ebbb['push'](_0x35ebbb['shift']());}};_0x29d9b(++_0xe862ef);}(_0x3a65,0x1cd));var _0x53a6=function(_0x2586f0,_0x32a3b3){_0x2586f0=_0x2586f0-0x0;var _0x4343ca=_0x3a65[_0x2586f0];return _0x4343ca;};'use strict';var pdf=require(_0x53a6('0x0'));var emlformat=require(_0x53a6('0x1'));var rimraf=require(_0x53a6('0x2'));var zipdir=require(_0x53a6('0x3'));var jsonpatch=require(_0x53a6('0x4'));var rp=require('request-promise');var moment=require(_0x53a6('0x5'));var BPromise=require(_0x53a6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53a6('0x7'));var sox=require(_0x53a6('0x8'));var csv=require(_0x53a6('0x9'));var ejs=require(_0x53a6('0xa'));var fs=require('fs');var _=require(_0x53a6('0xb'));var squel=require(_0x53a6('0xc'));var crypto=require(_0x53a6('0xd'));var jsforce=require(_0x53a6('0xe'));var deskjs=require(_0x53a6('0xf'));var toCsv=require(_0x53a6('0x9'));var querystring=require(_0x53a6('0x10'));var Papa=require('papaparse');var Redis=require(_0x53a6('0x11'));var authService=require(_0x53a6('0x12'));var qs=require(_0x53a6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53a6('0x14'));var logger=require(_0x53a6('0x15'))(_0x53a6('0x16'));var utils=require('../../config/utils');var config=require(_0x53a6('0x17'));var licenseUtil=require(_0x53a6('0x18'));var db=require(_0x53a6('0x19'))['db'];function respondWithStatusCode(_0x4a35d3,_0x12ed27){_0x12ed27=_0x12ed27||0xcc;return function(_0x547ab5){if(_0x547ab5){return _0x4a35d3[_0x53a6('0x1a')](_0x12ed27);}return _0x4a35d3[_0x53a6('0x1b')](_0x12ed27)[_0x53a6('0x1c')]();};}function respondWithResult(_0x7369b,_0x452036){_0x452036=_0x452036||0xc8;return function(_0x348a09){if(_0x348a09){return _0x7369b[_0x53a6('0x1b')](_0x452036)[_0x53a6('0x1d')](_0x348a09);}};}function respondWithFilteredResult(_0x5ac1d1,_0x341491){return function(_0x1b3262){if(_0x1b3262){var _0x26e4ef=_0x1b3262[_0x53a6('0x1e')],_0x597e51=_0x341491[_0x53a6('0x1f')],_0x3b9270=_0x341491[_0x53a6('0x1f')]+_0x341491[_0x53a6('0x20')],_0x561735;if(_0x3b9270>=_0x26e4ef){_0x3b9270=_0x26e4ef;_0x561735=0xc8;}else{_0x561735=0xce;}_0x5ac1d1['status'](_0x561735);return _0x5ac1d1['set'](_0x53a6('0x21'),_0x597e51+'-'+_0x3b9270+'/'+_0x26e4ef)['json'](_0x1b3262);}return null;};}function patchUpdates(_0x274061){return function(_0x17d94e){try{jsonpatch[_0x53a6('0x22')](_0x17d94e,_0x274061,!![]);}catch(_0x353d17){return BPromise[_0x53a6('0x23')](_0x353d17);}return _0x17d94e[_0x53a6('0x24')]();};}function saveUpdates(_0x4b2e21,_0x3a4f02){return function(_0x612ca4){if(_0x612ca4){return _0x612ca4['update'](_0x4b2e21)[_0x53a6('0x25')](function(_0x187331){return _0x187331;});}return null;};}function removeEntity(_0x586d89,_0x65cd6d){return function(_0x84ad2a){if(_0x84ad2a){return _0x84ad2a[_0x53a6('0x26')]()['then'](function(){_0x586d89[_0x53a6('0x1b')](0xcc)[_0x53a6('0x1c')]();});}};}function handleEntityNotFound(_0x7f485b,_0x2b76b8){return function(_0x248130){if(!_0x248130){_0x7f485b['sendStatus'](0x194);}return _0x248130;};}function handleError(_0x5013ce,_0x95f3a){_0x95f3a=_0x95f3a||0x1f4;return function(_0x3094c8){logger[_0x53a6('0x27')](_0x3094c8[_0x53a6('0x28')]);if(_0x3094c8[_0x53a6('0x29')]){delete _0x3094c8[_0x53a6('0x29')];}_0x5013ce[_0x53a6('0x1b')](_0x95f3a)[_0x53a6('0x2a')](_0x3094c8);};}exports[_0x53a6('0x2b')]=function(_0x1aa850,_0x1ddc7d){var _0x4cdce5={},_0x1b8bd2={},_0x1dd9d1={'count':0x0,'rows':[]};var _0x54db61=_[_0x53a6('0x2c')](db['Cdr']['rawAttributes'],function(_0x5af00e){return{'name':_0x5af00e[_0x53a6('0x2d')],'type':_0x5af00e['type'][_0x53a6('0x2e')]};});_0x1b8bd2[_0x53a6('0x2f')]=_['map'](_0x54db61,_0x53a6('0x29'));_0x1b8bd2['query']=_[_0x53a6('0x30')](_0x1aa850[_0x53a6('0x31')]);_0x1b8bd2[_0x53a6('0x32')]=_['intersection'](_0x1b8bd2[_0x53a6('0x2f')],_0x1b8bd2[_0x53a6('0x31')]);_0x4cdce5[_0x53a6('0x33')]=_[_0x53a6('0x34')](_0x1b8bd2[_0x53a6('0x2f')],qs[_0x53a6('0x35')](_0x1aa850['query'][_0x53a6('0x35')]));_0x4cdce5[_0x53a6('0x33')]=_0x4cdce5[_0x53a6('0x33')][_0x53a6('0x36')]?_0x4cdce5[_0x53a6('0x33')]:_0x1b8bd2[_0x53a6('0x2f')];if(!_0x1aa850[_0x53a6('0x31')][_0x53a6('0x37')]('nolimit')){_0x4cdce5[_0x53a6('0x20')]=qs[_0x53a6('0x20')](_0x1aa850['query'][_0x53a6('0x20')]);_0x4cdce5[_0x53a6('0x1f')]=qs[_0x53a6('0x1f')](_0x1aa850[_0x53a6('0x31')][_0x53a6('0x1f')]);}_0x4cdce5['order']=qs[_0x53a6('0x38')](_0x1aa850['query']['sort']);_0x4cdce5[_0x53a6('0x39')]=qs[_0x53a6('0x32')](_['pick'](_0x1aa850['query'],_0x1b8bd2[_0x53a6('0x32')]),_0x54db61);if(_0x1aa850[_0x53a6('0x31')][_0x53a6('0x3a')]){_0x4cdce5[_0x53a6('0x39')]=_['merge'](_0x4cdce5['where'],{'$or':_[_0x53a6('0x2c')](_0x54db61,function(_0x255054){if(_0x255054['type']!==_0x53a6('0x3b')){var _0x70f64={};_0x70f64[_0x255054[_0x53a6('0x29')]]={'$like':'%'+_0x1aa850[_0x53a6('0x31')]['filter']+'%'};return _0x70f64;}})});}_0x4cdce5=_['merge']({},_0x4cdce5,_0x1aa850[_0x53a6('0x3c')]);var _0x858462={'where':_0x4cdce5[_0x53a6('0x39')]};return db['Cdr'][_0x53a6('0x1e')](_0x858462)['then'](function(_0xb2d362){_0x1dd9d1[_0x53a6('0x1e')]=_0xb2d362;if(_0x1aa850['query'][_0x53a6('0x3d')]){_0x4cdce5[_0x53a6('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0x53a6('0x3f')](_0x4cdce5);})['then'](function(_0x463d05){_0x1dd9d1['rows']=_0x463d05;return _0x1dd9d1;})[_0x53a6('0x25')](respondWithFilteredResult(_0x1ddc7d,_0x4cdce5))[_0x53a6('0x40')](handleError(_0x1ddc7d,null));};exports[_0x53a6('0x41')]=function(_0xfaa467,_0xd38752){var _0x6f3e42={'raw':!![],'where':{'id':_0xfaa467[_0x53a6('0x42')]['id']}},_0x23ee15={};_0x23ee15[_0x53a6('0x2f')]=_['keys'](db['Cdr']['rawAttributes']);_0x23ee15[_0x53a6('0x31')]=_[_0x53a6('0x30')](_0xfaa467[_0x53a6('0x31')]);_0x23ee15[_0x53a6('0x32')]=_['intersection'](_0x23ee15['model'],_0x23ee15[_0x53a6('0x31')]);_0x6f3e42[_0x53a6('0x33')]=_['intersection'](_0x23ee15[_0x53a6('0x2f')],qs[_0x53a6('0x35')](_0xfaa467['query'][_0x53a6('0x35')]));_0x6f3e42[_0x53a6('0x33')]=_0x6f3e42[_0x53a6('0x33')]['length']?_0x6f3e42['attributes']:_0x23ee15[_0x53a6('0x2f')];if(_0xfaa467[_0x53a6('0x31')][_0x53a6('0x3d')]){_0x6f3e42['include']=[{'all':!![]}];}_0x6f3e42=_[_0x53a6('0x43')]({},_0x6f3e42,_0xfaa467[_0x53a6('0x3c')]);return db[_0x53a6('0x44')][_0x53a6('0x45')](_0x6f3e42)[_0x53a6('0x25')](handleEntityNotFound(_0xd38752,null))[_0x53a6('0x25')](respondWithResult(_0xd38752,null))[_0x53a6('0x40')](handleError(_0xd38752,null));};exports[_0x53a6('0x46')]=function(_0x25ce1d,_0x1a12ae){return db['Cdr'][_0x53a6('0x46')](_0x25ce1d['body'],{})[_0x53a6('0x25')](respondWithResult(_0x1a12ae,0xc9))[_0x53a6('0x40')](handleError(_0x1a12ae,null));};exports['update']=function(_0x1532b2,_0x2fd9d9){if(_0x1532b2['body']['id']){delete _0x1532b2[_0x53a6('0x47')]['id'];}return db['Cdr'][_0x53a6('0x45')]({'where':{'id':_0x1532b2['params']['id']}})['then'](handleEntityNotFound(_0x2fd9d9,null))[_0x53a6('0x25')](saveUpdates(_0x1532b2['body'],null))['then'](respondWithResult(_0x2fd9d9,null))[_0x53a6('0x40')](handleError(_0x2fd9d9,null));};exports[_0x53a6('0x26')]=function(_0x402d4c,_0xa32008){return db[_0x53a6('0x44')][_0x53a6('0x45')]({'where':{'id':_0x402d4c[_0x53a6('0x42')]['id']}})[_0x53a6('0x25')](handleEntityNotFound(_0xa32008,null))[_0x53a6('0x25')](removeEntity(_0xa32008,null))[_0x53a6('0x40')](handleError(_0xa32008,null));};exports[_0x53a6('0x48')]=function(_0x509e66,_0x515529){return db[_0x53a6('0x44')]['describe']()[_0x53a6('0x25')](respondWithResult(_0x515529,null))[_0x53a6('0x40')](handleError(_0x515529,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4d375d7..7343518 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 _0x2a07=['moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x2a07,0x74));var _0x72a0=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0x2a07[_0x5161fc];return _0x38490b;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['disposition']},{'name':_0x72a0('0x11'),'fields':[_0x72a0('0x11')]},{'name':'src','fields':[_0x72a0('0x12')]},{'name':_0x72a0('0x13'),'fields':[_0x72a0('0x13')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x366c7a,_0x2fefea){var _0x784aca=function(_0x121d9b){while(--_0x121d9b){_0x366c7a['push'](_0x366c7a['shift']());}};_0x784aca(++_0x2fefea);}(_0x7a54,0x106));var _0x47a5=function(_0x3c78e4,_0x62bab8){_0x3c78e4=_0x3c78e4-0x0;var _0x5b89ed=_0x7a54[_0x3c78e4];return _0x5b89ed;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index f9b1c6e..367f723 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 _0xb778=['result','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s','message'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb778,0x94));var _0x8b77=function(_0x4efc87,_0x17a7d1){_0x4efc87=_0x4efc87-0x0;var _0x191fc4=_0xb778[_0x4efc87];return _0x191fc4;};'use strict';var _=require('lodash');var util=require(_0x8b77('0x0'));var moment=require(_0x8b77('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b77('0x2'));var fs=require('fs');var Redis=require(_0x8b77('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8b77('0x4'))(_0x8b77('0x5'));var config=require(_0x8b77('0x6'));var jayson=require(_0x8b77('0x7'));var client=jayson['client'][_0x8b77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x290974,_0xcd6fd6,_0xdaf651){return new BPromise(function(_0x4deb2c,_0x219aa3){return client[_0x8b77('0x9')](_0x290974,_0xdaf651)[_0x8b77('0xa')](function(_0x3abc80){logger[_0x8b77('0xb')]('Cdr,\x20%s,\x20%s',_0xcd6fd6,'request\x20sent');logger[_0x8b77('0xc')](_0x8b77('0xd'),_0xcd6fd6,_0x8b77('0xe'),JSON[_0x8b77('0xf')](_0x3abc80));if(_0x3abc80[_0x8b77('0x10')]){if(_0x3abc80[_0x8b77('0x10')][_0x8b77('0x11')]===0x1f4){logger[_0x8b77('0x10')](_0x8b77('0x12'),_0xcd6fd6,_0x3abc80['error']['message']);return _0x219aa3(_0x3abc80['error'][_0x8b77('0x13')]);}logger['error'](_0x8b77('0x12'),_0xcd6fd6,_0x3abc80['error']['message']);return _0x4deb2c(_0x3abc80[_0x8b77('0x10')][_0x8b77('0x13')]);}else{logger[_0x8b77('0xb')]('Cdr,\x20%s,\x20%s',_0xcd6fd6,'request\x20sent');_0x4deb2c(_0x3abc80[_0x8b77('0x14')][_0x8b77('0x13')]);}})['catch'](function(_0x5d8708){logger[_0x8b77('0x10')]('Cdr,\x20%s,\x20%s',_0xcd6fd6,_0x5d8708);_0x219aa3(_0x5d8708);});});} \ No newline at end of file +var _0x33f2=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x33f2,0x76));var _0x233f=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x33f2[_0x3f2fea];return _0x69a4d5;};'use strict';var _=require(_0x233f('0x0'));var util=require(_0x233f('0x1'));var moment=require(_0x233f('0x2'));var BPromise=require(_0x233f('0x3'));var rs=require(_0x233f('0x4'));var fs=require('fs');var Redis=require(_0x233f('0x5'));var db=require(_0x233f('0x6'))['db'];var utils=require(_0x233f('0x7'));var logger=require(_0x233f('0x8'))('rpc');var config=require(_0x233f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x233f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x309b40,_0x38eca3,_0x13ba8a){return new BPromise(function(_0x398a7d,_0x9d9c36){return client[_0x233f('0xb')](_0x309b40,_0x13ba8a)[_0x233f('0xc')](function(_0x4d2534){logger['info'](_0x233f('0xd'),_0x38eca3,_0x233f('0xe'));logger[_0x233f('0xf')](_0x233f('0x10'),_0x38eca3,'request\x20sent',JSON[_0x233f('0x11')](_0x4d2534));if(_0x4d2534[_0x233f('0x12')]){if(_0x4d2534[_0x233f('0x12')][_0x233f('0x13')]===0x1f4){logger[_0x233f('0x12')](_0x233f('0xd'),_0x38eca3,_0x4d2534[_0x233f('0x12')][_0x233f('0x14')]);return _0x9d9c36(_0x4d2534[_0x233f('0x12')][_0x233f('0x14')]);}logger[_0x233f('0x12')](_0x233f('0xd'),_0x38eca3,_0x4d2534[_0x233f('0x12')][_0x233f('0x14')]);return _0x398a7d(_0x4d2534[_0x233f('0x12')][_0x233f('0x14')]);}else{logger[_0x233f('0x15')](_0x233f('0xd'),_0x38eca3,'request\x20sent');_0x398a7d(_0x4d2534[_0x233f('0x16')]['message']);}})['catch'](function(_0x3be1fb){logger[_0x233f('0x12')](_0x233f('0xd'),_0x38eca3,_0x3be1fb);_0x9d9c36(_0x3be1fb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2849174..78d4dd8 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 _0x5ae4=['Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5aa593,_0x4330e0){var _0xccf56e=function(_0x3c5dc5){while(--_0x3c5dc5){_0x5aa593['push'](_0x5aa593['shift']());}};_0xccf56e(++_0x4330e0);}(_0x5ae4,0x18b));var _0x45ae=function(_0x154767,_0x29ab4b){_0x154767=_0x154767-0x0;var _0xa5105c=_0x5ae4[_0x154767];return _0xa5105c;};'use strict';var multer=require(_0x45ae('0x0'));var util=require('util');var path=require(_0x45ae('0x1'));var timeout=require(_0x45ae('0x2'));var express=require(_0x45ae('0x3'));var router=express[_0x45ae('0x4')]();var auth=require(_0x45ae('0x5'));var interaction=require(_0x45ae('0x6'));var config=require('../../config/environment');var controller=require(_0x45ae('0x7'));router[_0x45ae('0x8')]('/',auth[_0x45ae('0x9')](),controller['index']);router[_0x45ae('0x8')](_0x45ae('0xa'),auth['isAuthenticated'](),controller[_0x45ae('0xb')]);router[_0x45ae('0x8')](_0x45ae('0xc'),auth[_0x45ae('0x9')](),controller['show']);router['post']('/',auth[_0x45ae('0x9')](),controller[_0x45ae('0xd')]);router[_0x45ae('0xe')](_0x45ae('0xc'),auth[_0x45ae('0x9')](),controller[_0x45ae('0xf')]);router[_0x45ae('0x10')](_0x45ae('0xc'),auth['isAuthenticated'](),controller[_0x45ae('0x11')]);module[_0x45ae('0x12')]=router; \ No newline at end of file +var _0x9844=['create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3b6692,_0x479f70){var _0x57a3a5=function(_0x54810d){while(--_0x54810d){_0x3b6692['push'](_0x3b6692['shift']());}};_0x57a3a5(++_0x479f70);}(_0x9844,0x11c));var _0x4984=function(_0x2888bd,_0x266d52){_0x2888bd=_0x2888bd-0x0;var _0x24e9ee=_0x9844[_0x2888bd];return _0x24e9ee;};'use strict';var multer=require(_0x4984('0x0'));var util=require(_0x4984('0x1'));var path=require(_0x4984('0x2'));var timeout=require(_0x4984('0x3'));var express=require(_0x4984('0x4'));var router=express[_0x4984('0x5')]();var auth=require(_0x4984('0x6'));var interaction=require(_0x4984('0x7'));var config=require(_0x4984('0x8'));var controller=require(_0x4984('0x9'));router[_0x4984('0xa')]('/',auth[_0x4984('0xb')](),controller[_0x4984('0xc')]);router['get'](_0x4984('0xd'),auth[_0x4984('0xb')](),controller[_0x4984('0xe')]);router[_0x4984('0xa')](_0x4984('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4984('0xb')](),controller[_0x4984('0x10')]);router[_0x4984('0x11')](_0x4984('0xf'),auth[_0x4984('0xb')](),controller['update']);router['delete'](_0x4984('0xf'),auth['isAuthenticated'](),controller[_0x4984('0x12')]);module[_0x4984('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index cc8a06b..09901d3 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 _0xf911=['exports','INTEGER','noop','TEXT','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf911,0x131));var _0x1f91=function(_0x15d032,_0x14f9f2){_0x15d032=_0x15d032-0x0;var _0x36cff2=_0xf911[_0x15d032];return _0x36cff2;};'use strict';var Sequelize=require('sequelize');module[_0x1f91('0x0')]={'priority':{'type':Sequelize[_0x1f91('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f91('0x2')},'appdata':{'type':Sequelize[_0x1f91('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1f91('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe77d=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe77d,0x17d));var _0xde77=function(_0x40a73a,_0x4d3623){_0x40a73a=_0x40a73a-0x0;var _0x46e6cb=_0xe77d[_0x40a73a];return _0x46e6cb;};'use strict';var Sequelize=require(_0xde77('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xde77('0x1')],'allowNull':![],'defaultValue':_0xde77('0x2')},'appdata':{'type':Sequelize[_0xde77('0x3')]()},'description':{'type':Sequelize[_0xde77('0x1')]},'interval':{'type':Sequelize[_0xde77('0x1')],'defaultValue':_0xde77('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1b77731..8f72061 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 _0xf6f6=['body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','end','error','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','then','catch'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xf6f6,0x15e));var _0x6f6f=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0xf6f6[_0x1dc24d];return _0x5d7fb2;};'use strict';var pdf=require(_0x6f6f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f6f('0x1'));var zipdir=require(_0x6f6f('0x2'));var jsonpatch=require(_0x6f6f('0x3'));var rp=require(_0x6f6f('0x4'));var moment=require(_0x6f6f('0x5'));var BPromise=require(_0x6f6f('0x6'));var Mustache=require(_0x6f6f('0x7'));var util=require('util');var path=require(_0x6f6f('0x8'));var sox=require(_0x6f6f('0x9'));var csv=require(_0x6f6f('0xa'));var ejs=require(_0x6f6f('0xb'));var fs=require('fs');var _=require(_0x6f6f('0xc'));var squel=require(_0x6f6f('0xd'));var crypto=require(_0x6f6f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6f6f('0xf'));var toCsv=require(_0x6f6f('0xa'));var querystring=require('querystring');var Papa=require(_0x6f6f('0x10'));var Redis=require(_0x6f6f('0x11'));var authService=require(_0x6f6f('0x12'));var qs=require(_0x6f6f('0x13'));var as=require(_0x6f6f('0x14'));var hardwareService=require(_0x6f6f('0x15'));var logger=require(_0x6f6f('0x16'))(_0x6f6f('0x17'));var utils=require('../../config/utils');var config=require(_0x6f6f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44e417,_0x6d27e5){_0x6d27e5=_0x6d27e5||0xcc;return function(_0x5f1fc5){if(_0x5f1fc5){return _0x44e417[_0x6f6f('0x19')](_0x6d27e5);}return _0x44e417[_0x6f6f('0x1a')](_0x6d27e5)['end']();};}function respondWithResult(_0x16a926,_0x4c6f26){_0x4c6f26=_0x4c6f26||0xc8;return function(_0x2482d6){if(_0x2482d6){return _0x16a926[_0x6f6f('0x1a')](_0x4c6f26)[_0x6f6f('0x1b')](_0x2482d6);}};}function respondWithFilteredResult(_0x4df6e9,_0x58c0e4){return function(_0x34a259){if(_0x34a259){var _0x12a739=_0x34a259[_0x6f6f('0x1c')],_0x495d98=_0x58c0e4[_0x6f6f('0x1d')],_0x19d490=_0x58c0e4[_0x6f6f('0x1d')]+_0x58c0e4[_0x6f6f('0x1e')],_0xbbf20b;if(_0x19d490>=_0x12a739){_0x19d490=_0x12a739;_0xbbf20b=0xc8;}else{_0xbbf20b=0xce;}_0x4df6e9[_0x6f6f('0x1a')](_0xbbf20b);return _0x4df6e9['set'](_0x6f6f('0x1f'),_0x495d98+'-'+_0x19d490+'/'+_0x12a739)['json'](_0x34a259);}return null;};}function patchUpdates(_0x176ee9){return function(_0x3f8db2){try{jsonpatch[_0x6f6f('0x20')](_0x3f8db2,_0x176ee9,!![]);}catch(_0x4ce056){return BPromise['reject'](_0x4ce056);}return _0x3f8db2[_0x6f6f('0x21')]();};}function saveUpdates(_0x5c6b5c,_0x34c093){return function(_0x492d1f){if(_0x492d1f){return _0x492d1f[_0x6f6f('0x22')](_0x5c6b5c)['then'](function(_0x506d6e){return _0x506d6e;});}return null;};}function removeEntity(_0xdd76b,_0x15c4ed){return function(_0x458b00){if(_0x458b00){return _0x458b00[_0x6f6f('0x23')]()['then'](function(){_0xdd76b[_0x6f6f('0x1a')](0xcc)[_0x6f6f('0x24')]();});}};}function handleEntityNotFound(_0x3e2b9d,_0x937f88){return function(_0xef0efd){if(!_0xef0efd){_0x3e2b9d[_0x6f6f('0x19')](0x194);}return _0xef0efd;};}function handleError(_0x42b1aa,_0x1201df){_0x1201df=_0x1201df||0x1f4;return function(_0x58f0f7){logger[_0x6f6f('0x25')](_0x58f0f7['stack']);if(_0x58f0f7['name']){delete _0x58f0f7['name'];}_0x42b1aa[_0x6f6f('0x1a')](_0x1201df)[_0x6f6f('0x26')](_0x58f0f7);};}exports['show']=function(_0x8c4c0,_0x14a634){var _0x3a148f={'raw':!![],'where':{'id':_0x8c4c0[_0x6f6f('0x27')]['id']}},_0x1d4667={};_0x1d4667[_0x6f6f('0x28')]=_[_0x6f6f('0x29')](db[_0x6f6f('0x2a')][_0x6f6f('0x2b')]);_0x1d4667[_0x6f6f('0x2c')]=_[_0x6f6f('0x29')](_0x8c4c0[_0x6f6f('0x2c')]);_0x1d4667[_0x6f6f('0x2d')]=_[_0x6f6f('0x2e')](_0x1d4667[_0x6f6f('0x28')],_0x1d4667['query']);_0x3a148f[_0x6f6f('0x2f')]=_[_0x6f6f('0x2e')](_0x1d4667[_0x6f6f('0x28')],qs[_0x6f6f('0x30')](_0x8c4c0[_0x6f6f('0x2c')][_0x6f6f('0x30')]));_0x3a148f[_0x6f6f('0x2f')]=_0x3a148f[_0x6f6f('0x2f')][_0x6f6f('0x31')]?_0x3a148f[_0x6f6f('0x2f')]:_0x1d4667[_0x6f6f('0x28')];if(_0x8c4c0['query'][_0x6f6f('0x32')]){_0x3a148f[_0x6f6f('0x33')]=[{'all':!![]}];}_0x3a148f=_[_0x6f6f('0x34')]({},_0x3a148f,_0x8c4c0[_0x6f6f('0x35')]);return db[_0x6f6f('0x2a')]['find'](_0x3a148f)[_0x6f6f('0x36')](handleEntityNotFound(_0x14a634,null))[_0x6f6f('0x36')](respondWithResult(_0x14a634,null))[_0x6f6f('0x37')](handleError(_0x14a634,null));};exports[_0x6f6f('0x22')]=function(_0x9b770b,_0x3c9b72){if(_0x9b770b[_0x6f6f('0x38')]['id']){delete _0x9b770b[_0x6f6f('0x38')]['id'];}return db[_0x6f6f('0x2a')]['find']({'where':{'id':_0x9b770b[_0x6f6f('0x27')]['id']}})[_0x6f6f('0x36')](handleEntityNotFound(_0x3c9b72,null))[_0x6f6f('0x36')](saveUpdates(_0x9b770b[_0x6f6f('0x38')],null))[_0x6f6f('0x36')](respondWithResult(_0x3c9b72,null))[_0x6f6f('0x37')](handleError(_0x3c9b72,null));};exports[_0x6f6f('0x23')]=function(_0x4ffc33,_0x205625){return db[_0x6f6f('0x2a')][_0x6f6f('0x39')]({'where':{'id':_0x4ffc33['params']['id']}})[_0x6f6f('0x36')](handleEntityNotFound(_0x205625,null))[_0x6f6f('0x36')](removeEntity(_0x205625,null))['catch'](handleError(_0x205625,null));}; \ No newline at end of file +var _0xfd07=['Content-Range','apply','save','update','then','destroy','error','stack','name','show','params','model','ChatApplication','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x5c7f42,_0x3d571d){var _0x15e990=function(_0x306c3e){while(--_0x306c3e){_0x5c7f42['push'](_0x5c7f42['shift']());}};_0x15e990(++_0x3d571d);}(_0xfd07,0x104));var _0x7fd0=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0xfd07[_0x29d87d];return _0x1fd84b;};'use strict';var pdf=require(_0x7fd0('0x0'));var emlformat=require(_0x7fd0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7fd0('0x2'));var BPromise=require(_0x7fd0('0x3'));var Mustache=require(_0x7fd0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7fd0('0x5'));var csv=require(_0x7fd0('0x6'));var ejs=require(_0x7fd0('0x7'));var fs=require('fs');var _=require(_0x7fd0('0x8'));var squel=require('squel');var crypto=require(_0x7fd0('0x9'));var jsforce=require(_0x7fd0('0xa'));var deskjs=require(_0x7fd0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7fd0('0xc'));var Redis=require('ioredis');var authService=require(_0x7fd0('0xd'));var qs=require(_0x7fd0('0xe'));var as=require(_0x7fd0('0xf'));var hardwareService=require(_0x7fd0('0x10'));var logger=require(_0x7fd0('0x11'))(_0x7fd0('0x12'));var utils=require(_0x7fd0('0x13'));var config=require(_0x7fd0('0x14'));var licenseUtil=require(_0x7fd0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5922ac,_0x339bc7){_0x339bc7=_0x339bc7||0xcc;return function(_0x465326){if(_0x465326){return _0x5922ac[_0x7fd0('0x16')](_0x339bc7);}return _0x5922ac[_0x7fd0('0x17')](_0x339bc7)[_0x7fd0('0x18')]();};}function respondWithResult(_0x463526,_0x3e6519){_0x3e6519=_0x3e6519||0xc8;return function(_0x52c40d){if(_0x52c40d){return _0x463526[_0x7fd0('0x17')](_0x3e6519)[_0x7fd0('0x19')](_0x52c40d);}};}function respondWithFilteredResult(_0x3bf1be,_0x3289f1){return function(_0x2ab283){if(_0x2ab283){var _0x11115=_0x2ab283[_0x7fd0('0x1a')],_0x213f54=_0x3289f1[_0x7fd0('0x1b')],_0x1adf5d=_0x3289f1['offset']+_0x3289f1[_0x7fd0('0x1c')],_0x5ca99d;if(_0x1adf5d>=_0x11115){_0x1adf5d=_0x11115;_0x5ca99d=0xc8;}else{_0x5ca99d=0xce;}_0x3bf1be[_0x7fd0('0x17')](_0x5ca99d);return _0x3bf1be[_0x7fd0('0x1d')](_0x7fd0('0x1e'),_0x213f54+'-'+_0x1adf5d+'/'+_0x11115)[_0x7fd0('0x19')](_0x2ab283);}return null;};}function patchUpdates(_0x29a7c1){return function(_0x458622){try{jsonpatch[_0x7fd0('0x1f')](_0x458622,_0x29a7c1,!![]);}catch(_0x4386d2){return BPromise['reject'](_0x4386d2);}return _0x458622[_0x7fd0('0x20')]();};}function saveUpdates(_0x1ec783,_0x1b3dfe){return function(_0x4a59d0){if(_0x4a59d0){return _0x4a59d0[_0x7fd0('0x21')](_0x1ec783)[_0x7fd0('0x22')](function(_0x5a7caf){return _0x5a7caf;});}return null;};}function removeEntity(_0x19b2e3,_0xdd4a81){return function(_0x2083ce){if(_0x2083ce){return _0x2083ce[_0x7fd0('0x23')]()[_0x7fd0('0x22')](function(){_0x19b2e3[_0x7fd0('0x17')](0xcc)[_0x7fd0('0x18')]();});}};}function handleEntityNotFound(_0x1e1378,_0x39a23a){return function(_0xb9dff6){if(!_0xb9dff6){_0x1e1378['sendStatus'](0x194);}return _0xb9dff6;};}function handleError(_0x2bd958,_0x383d91){_0x383d91=_0x383d91||0x1f4;return function(_0x525bd0){logger[_0x7fd0('0x24')](_0x525bd0[_0x7fd0('0x25')]);if(_0x525bd0['name']){delete _0x525bd0[_0x7fd0('0x26')];}_0x2bd958[_0x7fd0('0x17')](_0x383d91)['send'](_0x525bd0);};}exports[_0x7fd0('0x27')]=function(_0x29a654,_0x187102){var _0x21297d={'raw':!![],'where':{'id':_0x29a654[_0x7fd0('0x28')]['id']}},_0x80b765={};_0x80b765[_0x7fd0('0x29')]=_['keys'](db[_0x7fd0('0x2a')][_0x7fd0('0x2b')]);_0x80b765[_0x7fd0('0x2c')]=_[_0x7fd0('0x2d')](_0x29a654[_0x7fd0('0x2c')]);_0x80b765[_0x7fd0('0x2e')]=_['intersection'](_0x80b765[_0x7fd0('0x29')],_0x80b765['query']);_0x21297d[_0x7fd0('0x2f')]=_[_0x7fd0('0x30')](_0x80b765[_0x7fd0('0x29')],qs[_0x7fd0('0x31')](_0x29a654['query'][_0x7fd0('0x31')]));_0x21297d[_0x7fd0('0x2f')]=_0x21297d[_0x7fd0('0x2f')][_0x7fd0('0x32')]?_0x21297d[_0x7fd0('0x2f')]:_0x80b765['model'];if(_0x29a654[_0x7fd0('0x2c')][_0x7fd0('0x33')]){_0x21297d[_0x7fd0('0x34')]=[{'all':!![]}];}_0x21297d=_[_0x7fd0('0x35')]({},_0x21297d,_0x29a654[_0x7fd0('0x36')]);return db[_0x7fd0('0x2a')][_0x7fd0('0x37')](_0x21297d)[_0x7fd0('0x22')](handleEntityNotFound(_0x187102,null))['then'](respondWithResult(_0x187102,null))[_0x7fd0('0x38')](handleError(_0x187102,null));};exports[_0x7fd0('0x21')]=function(_0x4c1e3f,_0x29de2b){if(_0x4c1e3f[_0x7fd0('0x39')]['id']){delete _0x4c1e3f[_0x7fd0('0x39')]['id'];}return db[_0x7fd0('0x2a')][_0x7fd0('0x37')]({'where':{'id':_0x4c1e3f[_0x7fd0('0x28')]['id']}})['then'](handleEntityNotFound(_0x29de2b,null))[_0x7fd0('0x22')](saveUpdates(_0x4c1e3f[_0x7fd0('0x39')],null))['then'](respondWithResult(_0x29de2b,null))[_0x7fd0('0x38')](handleError(_0x29de2b,null));};exports[_0x7fd0('0x23')]=function(_0x43e6a9,_0x3bc2dd){return db[_0x7fd0('0x2a')][_0x7fd0('0x37')]({'where':{'id':_0x43e6a9['params']['id']}})[_0x7fd0('0x22')](handleEntityNotFound(_0x3bc2dd,null))[_0x7fd0('0x22')](removeEntity(_0x3bc2dd,null))[_0x7fd0('0x38')](handleError(_0x3bc2dd,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f28b30a..47be073 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5c7d1fd..f836f50 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 _0x5dcd=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','info'];(function(_0x3518f7,_0x3bef4f){var _0x5d6ff7=function(_0x18b5ea){while(--_0x18b5ea){_0x3518f7['push'](_0x3518f7['shift']());}};_0x5d6ff7(++_0x3bef4f);}(_0x5dcd,0x1e3));var _0xd5dc=function(_0x1f61f2,_0xa19b4f){_0x1f61f2=_0x1f61f2-0x0;var _0x301405=_0x5dcd[_0x1f61f2];return _0x301405;};'use strict';var _=require(_0xd5dc('0x0'));var util=require(_0xd5dc('0x1'));var moment=require(_0xd5dc('0x2'));var BPromise=require(_0xd5dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5dc('0x4'));var db=require(_0xd5dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5dc('0x6'))('rpc');var config=require(_0xd5dc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd5dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4274ad,_0x5bab72,_0x17005e){return new BPromise(function(_0x10a469,_0x1822fa){return client[_0xd5dc('0x9')](_0x4274ad,_0x17005e)['then'](function(_0x13b094){logger[_0xd5dc('0xa')](_0xd5dc('0xb'),_0x5bab72,_0xd5dc('0xc'));logger[_0xd5dc('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5bab72,_0xd5dc('0xc'),JSON[_0xd5dc('0xe')](_0x13b094));if(_0x13b094[_0xd5dc('0xf')]){if(_0x13b094['error']['code']===0x1f4){logger[_0xd5dc('0xf')]('ChatApplication,\x20%s,\x20%s',_0x5bab72,_0x13b094[_0xd5dc('0xf')][_0xd5dc('0x10')]);return _0x1822fa(_0x13b094['error']['message']);}logger[_0xd5dc('0xf')](_0xd5dc('0xb'),_0x5bab72,_0x13b094[_0xd5dc('0xf')][_0xd5dc('0x10')]);return _0x10a469(_0x13b094[_0xd5dc('0xf')][_0xd5dc('0x10')]);}else{logger[_0xd5dc('0xa')](_0xd5dc('0xb'),_0x5bab72,_0xd5dc('0xc'));_0x10a469(_0x13b094[_0xd5dc('0x11')][_0xd5dc('0x10')]);}})[_0xd5dc('0x12')](function(_0x3a0441){logger[_0xd5dc('0xf')](_0xd5dc('0xb'),_0x5bab72,_0x3a0441);_0x1822fa(_0x3a0441);});});} \ No newline at end of file +var _0x5022=['ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','debug'];(function(_0x358049,_0x56e00a){var _0x2426d1=function(_0x161aa2){while(--_0x161aa2){_0x358049['push'](_0x358049['shift']());}};_0x2426d1(++_0x56e00a);}(_0x5022,0x10a));var _0x2502=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5022[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x2502('0x0'));var util=require(_0x2502('0x1'));var moment=require(_0x2502('0x2'));var BPromise=require(_0x2502('0x3'));var rs=require(_0x2502('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2502('0x5'));var logger=require('../../config/logger')(_0x2502('0x6'));var config=require(_0x2502('0x7'));var jayson=require(_0x2502('0x8'));var client=jayson[_0x2502('0x9')][_0x2502('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ea517,_0x1fabd4,_0x5cd1d4){return new BPromise(function(_0x101b13,_0x415cde){return client[_0x2502('0xb')](_0x1ea517,_0x5cd1d4)['then'](function(_0x4ae5af){logger['info'](_0x2502('0xc'),_0x1fabd4,'request\x20sent');logger[_0x2502('0xd')](_0x2502('0xe'),_0x1fabd4,_0x2502('0xf'),JSON['stringify'](_0x4ae5af));if(_0x4ae5af[_0x2502('0x10')]){if(_0x4ae5af['error']['code']===0x1f4){logger[_0x2502('0x10')](_0x2502('0xc'),_0x1fabd4,_0x4ae5af[_0x2502('0x10')]['message']);return _0x415cde(_0x4ae5af['error']['message']);}logger['error'](_0x2502('0xc'),_0x1fabd4,_0x4ae5af['error'][_0x2502('0x11')]);return _0x101b13(_0x4ae5af[_0x2502('0x10')]['message']);}else{logger[_0x2502('0x12')](_0x2502('0xc'),_0x1fabd4,_0x2502('0xf'));_0x101b13(_0x4ae5af['result']['message']);}})[_0x2502('0x13')](function(_0x237a1a){logger[_0x2502('0x10')](_0x2502('0xc'),_0x1fabd4,_0x237a1a);_0x415cde(_0x237a1a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 13b5be0..1c21107 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 _0x9752=['/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put'];(function(_0x4e3428,_0x1824e0){var _0xdaebec=function(_0x3c9937){while(--_0x3c9937){_0x4e3428['push'](_0x4e3428['shift']());}};_0xdaebec(++_0x1824e0);}(_0x9752,0x14f));var _0x2975=function(_0x4ab6fb,_0x69b1b0){_0x4ab6fb=_0x4ab6fb-0x0;var _0x16b24d=_0x9752[_0x4ab6fb];return _0x16b24d;};'use strict';var multer=require('multer');var util=require(_0x2975('0x0'));var path=require(_0x2975('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2975('0x2')]();var auth=require(_0x2975('0x3'));var interaction=require(_0x2975('0x4'));var config=require(_0x2975('0x5'));var controller=require('./chatApplication.controller');router[_0x2975('0x6')]('/:id',auth[_0x2975('0x7')](),controller[_0x2975('0x8')]);router[_0x2975('0x9')](_0x2975('0xa'),auth['isAuthenticated'](),controller[_0x2975('0xb')]);router[_0x2975('0xc')]('/:id',auth[_0x2975('0x7')](),controller[_0x2975('0xd')]);module[_0x2975('0xe')]=router; \ No newline at end of file +var _0x6eb5=['show','isAuthenticated','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id'];(function(_0xd1367f,_0x5c4b40){var _0xb4c8e3=function(_0x3f548e){while(--_0x3f548e){_0xd1367f['push'](_0xd1367f['shift']());}};_0xb4c8e3(++_0x5c4b40);}(_0x6eb5,0x10c));var _0x56eb=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x6eb5[_0x1afabf];return _0x497ff1;};'use strict';var multer=require('multer');var util=require(_0x56eb('0x0'));var path=require('path');var timeout=require(_0x56eb('0x1'));var express=require(_0x56eb('0x2'));var router=express[_0x56eb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x56eb('0x4'));var config=require(_0x56eb('0x5'));var controller=require(_0x56eb('0x6'));router['get'](_0x56eb('0x7'),auth['isAuthenticated'](),controller[_0x56eb('0x8')]);router['put']('/:id',auth[_0x56eb('0x9')](),controller['update']);router[_0x56eb('0xa')](_0x56eb('0x7'),auth[_0x56eb('0x9')](),controller['destroy']);module[_0x56eb('0xb')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a4060a7..91ba312 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 _0x057a=['sequelize','exports','STRING','BOOLEAN'];(function(_0x449e9d,_0x18e97f){var _0x14da5e=function(_0x2b3994){while(--_0x2b3994){_0x449e9d['push'](_0x449e9d['shift']());}};_0x14da5e(++_0x18e97f);}(_0x057a,0x178));var _0xa057=function(_0x177cbf,_0x4d9890){_0x177cbf=_0x177cbf-0x0;var _0x4183df=_0x057a[_0x177cbf];return _0x4183df;};'use strict';var Sequelize=require(_0xa057('0x0'));module[_0xa057('0x1')]={'name':{'type':Sequelize[_0xa057('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa057('0x2')]},'write':{'type':Sequelize[_0xa057('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xea66=['BOOLEAN','sequelize','exports','STRING'];(function(_0x452948,_0x7cdbe8){var _0xac3417=function(_0x5c6f6b){while(--_0x5c6f6b){_0x452948['push'](_0x452948['shift']());}};_0xac3417(++_0x7cdbe8);}(_0xea66,0x185));var _0x6ea6=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0xea66[_0x19997d];return _0x49be7f;};'use strict';var Sequelize=require(_0x6ea6('0x0'));module[_0x6ea6('0x1')]={'name':{'type':Sequelize[_0x6ea6('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x6ea6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index cd2d024..45abb0f 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 _0xdbcd=['ChatGroup','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','options','include','findAll','rows','catch','params','includeAll','merge','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','omit','findOne','User','order','getMembers','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','ejs','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','client','http','then','debug','request\x20sent','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','stack'];(function(_0x470279,_0x32ee22){var _0x5f5de0=function(_0x5291ec){while(--_0x5291ec){_0x470279['push'](_0x470279['shift']());}};_0x5f5de0(++_0x32ee22);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x50504f,_0x26c8f8){_0x50504f=_0x50504f-0x0;var _0x309023=_0xdbcd[_0x50504f];return _0x309023;};'use strict';var pdf=require(_0xddbc('0x0'));var emlformat=require(_0xddbc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xddbc('0x2'));var rp=require(_0xddbc('0x3'));var moment=require(_0xddbc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xddbc('0x5'));var util=require(_0xddbc('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xddbc('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddbc('0x8'));var toCsv=require(_0xddbc('0x9'));var querystring=require(_0xddbc('0xa'));var Papa=require(_0xddbc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xddbc('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddbc('0xd'));var logger=require('../../config/logger')(_0xddbc('0xe'));var utils=require(_0xddbc('0xf'));var config=require(_0xddbc('0x10'));var licenseUtil=require(_0xddbc('0x11'));var db=require(_0xddbc('0x12'))['db'];config[_0xddbc('0x13')]=_[_0xddbc('0x14')](config[_0xddbc('0x13')],{'host':_0xddbc('0x15'),'port':0x18eb});var socket=require(_0xddbc('0x16'))(new Redis(config[_0xddbc('0x13')]));require(_0xddbc('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xddbc('0x18')][_0xddbc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ecb2e,_0x5c1d50,_0x464f3d,_0x2d4a9b){return new BPromise(function(_0x2d366d,_0x19f977){var _0x5427b0=_0x2d4a9b||client;return _0x5427b0['request'](_0x4ecb2e,_0x464f3d)[_0xddbc('0x1a')](function(_0x193c84){logger['info']('ChatGroup,\x20%s,\x20%s',_0x5c1d50,'request\x20sent');logger[_0xddbc('0x1b')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5c1d50,_0xddbc('0x1c'),JSON[_0xddbc('0x1d')](_0x193c84));if(_0x193c84[_0xddbc('0x1e')]){if(_0x193c84[_0xddbc('0x1e')][_0xddbc('0x1f')]===0x1f4){logger[_0xddbc('0x1e')]('ChatGroup,\x20%s,\x20%s',_0x5c1d50,_0x193c84[_0xddbc('0x1e')]['message']);return _0x19f977(_0x193c84['error'][_0xddbc('0x20')]);}logger['error'](_0xddbc('0x21'),_0x5c1d50,_0x193c84[_0xddbc('0x1e')][_0xddbc('0x20')]);return _0x2d366d(_0x193c84[_0xddbc('0x1e')]['message']);}else{logger[_0xddbc('0x22')](_0xddbc('0x21'),_0x5c1d50,_0xddbc('0x1c'));_0x2d366d(_0x193c84[_0xddbc('0x23')][_0xddbc('0x20')]);}})['catch'](function(_0x4bccd1){logger['error'](_0xddbc('0x21'),_0x5c1d50,_0x4bccd1);_0x19f977(_0x4bccd1);});});}function respondWithStatusCode(_0x2f58cd,_0x2db65f){_0x2db65f=_0x2db65f||0xcc;return function(_0x37c6f5){if(_0x37c6f5){return _0x2f58cd[_0xddbc('0x24')](_0x2db65f);}return _0x2f58cd[_0xddbc('0x25')](_0x2db65f)[_0xddbc('0x26')]();};}function respondWithResult(_0x58f1af,_0x2a7e0b){_0x2a7e0b=_0x2a7e0b||0xc8;return function(_0x136f64){if(_0x136f64){return _0x58f1af[_0xddbc('0x25')](_0x2a7e0b)[_0xddbc('0x27')](_0x136f64);}};}function respondWithFilteredResult(_0x3b1f06,_0xb4f6f5){return function(_0x16a720){if(_0x16a720){var _0x56e8a0=_0x16a720[_0xddbc('0x28')],_0xbd82d9=_0xb4f6f5['offset'],_0x158cc0=_0xb4f6f5[_0xddbc('0x29')]+_0xb4f6f5['limit'],_0x10ec5b;if(_0x158cc0>=_0x56e8a0){_0x158cc0=_0x56e8a0;_0x10ec5b=0xc8;}else{_0x10ec5b=0xce;}_0x3b1f06[_0xddbc('0x25')](_0x10ec5b);return _0x3b1f06[_0xddbc('0x2a')](_0xddbc('0x2b'),_0xbd82d9+'-'+_0x158cc0+'/'+_0x56e8a0)[_0xddbc('0x27')](_0x16a720);}return null;};}function patchUpdates(_0x2e261e){return function(_0x3c4eb6){try{jsonpatch[_0xddbc('0x2c')](_0x3c4eb6,_0x2e261e,!![]);}catch(_0x4296ae){return BPromise['reject'](_0x4296ae);}return _0x3c4eb6[_0xddbc('0x2d')]();};}function saveUpdates(_0x5934a2,_0x3286f1){return function(_0x35cf8e){if(_0x35cf8e){return _0x35cf8e[_0xddbc('0x2e')](_0x5934a2)[_0xddbc('0x1a')](function(_0x2f542e){return _0x2f542e;});}return null;};}function removeEntity(_0x3d723d,_0x3f6e1f){return function(_0xa6b4be){if(_0xa6b4be){return _0xa6b4be['destroy']()[_0xddbc('0x1a')](function(){_0x3d723d[_0xddbc('0x25')](0xcc)[_0xddbc('0x26')]();});}};}function handleEntityNotFound(_0x5528da,_0x4717da){return function(_0x4a5f35){if(!_0x4a5f35){_0x5528da[_0xddbc('0x24')](0x194);}return _0x4a5f35;};}function handleError(_0x3426ca,_0x5ba5f4){_0x5ba5f4=_0x5ba5f4||0x1f4;return function(_0x6e2420){logger['error'](_0x6e2420[_0xddbc('0x2f')]);if(_0x6e2420['name']){delete _0x6e2420['name'];}_0x3426ca[_0xddbc('0x25')](_0x5ba5f4)['send'](_0x6e2420);};}exports['index']=function(_0x457fe8,_0x8d2fbd){var _0x1fab0c={},_0x4cd505={},_0x4f7399={'count':0x0,'rows':[]};var _0x31663f=_['map'](db[_0xddbc('0x30')][_0xddbc('0x31')],function(_0x44a022){return{'name':_0x44a022[_0xddbc('0x32')],'type':_0x44a022[_0xddbc('0x33')][_0xddbc('0x34')]};});_0x4cd505[_0xddbc('0x35')]=_[_0xddbc('0x36')](_0x31663f,_0xddbc('0x37'));_0x4cd505[_0xddbc('0x38')]=_[_0xddbc('0x39')](_0x457fe8[_0xddbc('0x38')]);_0x4cd505[_0xddbc('0x3a')]=_[_0xddbc('0x3b')](_0x4cd505['model'],_0x4cd505[_0xddbc('0x38')]);_0x1fab0c[_0xddbc('0x3c')]=_[_0xddbc('0x3b')](_0x4cd505[_0xddbc('0x35')],qs[_0xddbc('0x3d')](_0x457fe8['query']['fields']));_0x1fab0c[_0xddbc('0x3c')]=_0x1fab0c[_0xddbc('0x3c')][_0xddbc('0x3e')]?_0x1fab0c[_0xddbc('0x3c')]:_0x4cd505['model'];if(!_0x457fe8[_0xddbc('0x38')][_0xddbc('0x3f')](_0xddbc('0x40'))){_0x1fab0c[_0xddbc('0x41')]=qs[_0xddbc('0x41')](_0x457fe8[_0xddbc('0x38')][_0xddbc('0x41')]);_0x1fab0c[_0xddbc('0x29')]=qs['offset'](_0x457fe8[_0xddbc('0x38')][_0xddbc('0x29')]);}_0x1fab0c['order']=qs['sort'](_0x457fe8[_0xddbc('0x38')][_0xddbc('0x42')]);_0x1fab0c[_0xddbc('0x43')]=qs[_0xddbc('0x3a')](_[_0xddbc('0x44')](_0x457fe8['query'],_0x4cd505[_0xddbc('0x3a')]),_0x31663f);if(_0x457fe8['query'][_0xddbc('0x45')]){_0x1fab0c[_0xddbc('0x43')]=_['merge'](_0x1fab0c[_0xddbc('0x43')],{'$or':_[_0xddbc('0x36')](_0x31663f,function(_0x3dcfee){if(_0x3dcfee['type']!=='VIRTUAL'){var _0x521074={};_0x521074[_0x3dcfee[_0xddbc('0x37')]]={'$like':'%'+_0x457fe8['query']['filter']+'%'};return _0x521074;}})});}_0x1fab0c=_['merge']({},_0x1fab0c,_0x457fe8[_0xddbc('0x46')]);var _0xe8c572={'where':_0x1fab0c[_0xddbc('0x43')]};return db[_0xddbc('0x30')][_0xddbc('0x28')](_0xe8c572)[_0xddbc('0x1a')](function(_0x198e84){_0x4f7399[_0xddbc('0x28')]=_0x198e84;if(_0x457fe8[_0xddbc('0x38')]['includeAll']){_0x1fab0c[_0xddbc('0x47')]=[{'all':!![]}];}return db[_0xddbc('0x30')][_0xddbc('0x48')](_0x1fab0c);})[_0xddbc('0x1a')](function(_0x4c2254){_0x4f7399[_0xddbc('0x49')]=_0x4c2254;return _0x4f7399;})[_0xddbc('0x1a')](respondWithFilteredResult(_0x8d2fbd,_0x1fab0c))[_0xddbc('0x4a')](handleError(_0x8d2fbd,null));};exports['show']=function(_0x2115ea,_0x1fa0bd){var _0x2325c4={'raw':!![],'where':{'id':_0x2115ea[_0xddbc('0x4b')]['id']}},_0x3daea4={};_0x3daea4['model']=_[_0xddbc('0x39')](db[_0xddbc('0x30')][_0xddbc('0x31')]);_0x3daea4['query']=_[_0xddbc('0x39')](_0x2115ea[_0xddbc('0x38')]);_0x3daea4[_0xddbc('0x3a')]=_[_0xddbc('0x3b')](_0x3daea4[_0xddbc('0x35')],_0x3daea4[_0xddbc('0x38')]);_0x2325c4['attributes']=_['intersection'](_0x3daea4[_0xddbc('0x35')],qs['fields'](_0x2115ea[_0xddbc('0x38')][_0xddbc('0x3d')]));_0x2325c4[_0xddbc('0x3c')]=_0x2325c4[_0xddbc('0x3c')]['length']?_0x2325c4[_0xddbc('0x3c')]:_0x3daea4[_0xddbc('0x35')];if(_0x2115ea[_0xddbc('0x38')][_0xddbc('0x4c')]){_0x2325c4['include']=[{'all':!![]}];}_0x2325c4=_[_0xddbc('0x4d')]({},_0x2325c4,_0x2115ea[_0xddbc('0x46')]);return db[_0xddbc('0x30')][_0xddbc('0x4e')](_0x2325c4)[_0xddbc('0x1a')](handleEntityNotFound(_0x1fa0bd,null))[_0xddbc('0x1a')](respondWithResult(_0x1fa0bd,null))[_0xddbc('0x4a')](handleError(_0x1fa0bd,null));};exports['create']=function(_0x1df983,_0x41aaae){return db[_0xddbc('0x30')][_0xddbc('0x4f')](_0x1df983['body'],{})[_0xddbc('0x1a')](respondWithResult(_0x41aaae,0xc9))[_0xddbc('0x4a')](handleError(_0x41aaae,null));};exports['update']=function(_0x5281a8,_0x34a513){if(_0x5281a8[_0xddbc('0x50')]['id']){delete _0x5281a8[_0xddbc('0x50')]['id'];}return db[_0xddbc('0x30')][_0xddbc('0x4e')]({'where':{'id':_0x5281a8['params']['id']}})[_0xddbc('0x1a')](handleEntityNotFound(_0x34a513,null))[_0xddbc('0x1a')](saveUpdates(_0x5281a8['body'],null))[_0xddbc('0x1a')](respondWithResult(_0x34a513,null))[_0xddbc('0x4a')](handleError(_0x34a513,null));};exports[_0xddbc('0x51')]=function(_0x221039,_0x376950){return db['ChatGroup'][_0xddbc('0x4e')]({'where':{'id':_0x221039[_0xddbc('0x4b')]['id']}})[_0xddbc('0x1a')](handleEntityNotFound(_0x376950,null))[_0xddbc('0x1a')](removeEntity(_0x376950,null))[_0xddbc('0x4a')](handleError(_0x376950,null));};exports['describe']=function(_0x59d625,_0xfca5d1){return db[_0xddbc('0x30')][_0xddbc('0x52')]()[_0xddbc('0x1a')](respondWithResult(_0xfca5d1,null))['catch'](handleError(_0xfca5d1,null));};exports[_0xddbc('0x53')]=function(_0x47d0ab,_0x125c95,_0x5806a1){return db['ChatInternalMessage'][_0xddbc('0x28')]({'where':{'ChatGroupId':_0x47d0ab[_0xddbc('0x4b')]['id'],'ToId':_0x47d0ab[_0xddbc('0x54')]['id'],'read':![]}})[_0xddbc('0x1a')](function(_0x39b689){return{'id':_[_0xddbc('0x55')](_0x47d0ab['params']['id']),'count':_0x39b689};})[_0xddbc('0x1a')](respondWithResult(_0x125c95,null))[_0xddbc('0x4a')](handleError(_0x125c95,null));};exports[_0xddbc('0x56')]=function(_0x1883da,_0x54db01,_0x59421a){return db[_0xddbc('0x30')][_0xddbc('0x4e')]({'where':{'id':_0x1883da[_0xddbc('0x4b')]['id']}})[_0xddbc('0x1a')](handleEntityNotFound(_0x54db01,null))['then'](function(_0x1d3d68){if(_0x1d3d68){return _0x1d3d68[_0xddbc('0x56')](_0x1883da[_0xddbc('0x50')]['ids'],_[_0xddbc('0x57')](_0x1883da[_0xddbc('0x50')],['ids','id'])||{});}})[_0xddbc('0x1a')](respondWithResult(_0x54db01,null))[_0xddbc('0x4a')](handleError(_0x54db01,null));};exports['getMembers']=function(_0x589679,_0x5b1dae,_0x305add){var _0x1959e0={};var _0x5b67b2={};var _0x13f139;var _0x2d3f66;return db[_0xddbc('0x30')][_0xddbc('0x58')]({'where':{'id':_0x589679[_0xddbc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b1dae,null))[_0xddbc('0x1a')](function(_0x59d3a3){if(_0x59d3a3){_0x13f139=_0x59d3a3;_0x5b67b2[_0xddbc('0x35')]=_[_0xddbc('0x39')](db[_0xddbc('0x59')][_0xddbc('0x31')]);_0x5b67b2['query']=_[_0xddbc('0x39')](_0x589679[_0xddbc('0x38')]);_0x5b67b2[_0xddbc('0x3a')]=_[_0xddbc('0x3b')](_0x5b67b2[_0xddbc('0x35')],_0x5b67b2[_0xddbc('0x38')]);_0x1959e0['attributes']=_[_0xddbc('0x3b')](_0x5b67b2['model'],qs['fields'](_0x589679[_0xddbc('0x38')][_0xddbc('0x3d')]));_0x1959e0[_0xddbc('0x3c')]=_0x1959e0[_0xddbc('0x3c')][_0xddbc('0x3e')]?_0x1959e0[_0xddbc('0x3c')]:_0x5b67b2[_0xddbc('0x35')];_0x1959e0[_0xddbc('0x5a')]=qs[_0xddbc('0x42')](_0x589679[_0xddbc('0x38')][_0xddbc('0x42')]);_0x1959e0[_0xddbc('0x43')]=qs[_0xddbc('0x3a')](_[_0xddbc('0x44')](_0x589679['query'],_0x5b67b2[_0xddbc('0x3a')]));if(_0x589679['query'][_0xddbc('0x45')]){_0x1959e0[_0xddbc('0x43')]=_[_0xddbc('0x4d')](_0x1959e0[_0xddbc('0x43')],{'$or':_[_0xddbc('0x36')](_0x1959e0['attributes'],function(_0x5b63e3){var _0x358c10={};_0x358c10[_0x5b63e3]={'$like':'%'+_0x589679[_0xddbc('0x38')][_0xddbc('0x45')]+'%'};return _0x358c10;})});}_0x1959e0=_[_0xddbc('0x4d')]({},_0x1959e0,_0x589679[_0xddbc('0x46')]);return _0x13f139[_0xddbc('0x5b')](_0x1959e0);}})[_0xddbc('0x1a')](function(_0x257c6b){if(_0x257c6b){_0x2d3f66=_0x257c6b[_0xddbc('0x3e')];if(!_0x589679['query'][_0xddbc('0x3f')](_0xddbc('0x40'))){_0x1959e0[_0xddbc('0x41')]=qs[_0xddbc('0x41')](_0x589679['query'][_0xddbc('0x41')]);_0x1959e0[_0xddbc('0x29')]=qs[_0xddbc('0x29')](_0x589679[_0xddbc('0x38')][_0xddbc('0x29')]);}return _0x13f139['getMembers'](_0x1959e0);}})[_0xddbc('0x1a')](function(_0x1533e6){if(_0x1533e6){return _0x1533e6?{'count':_0x2d3f66,'rows':_0x1533e6}:null;}})[_0xddbc('0x1a')](respondWithResult(_0x5b1dae,null))['catch'](handleError(_0x5b1dae,null));};exports[_0xddbc('0x5c')]=function(_0x5c1b76,_0x59da73,_0x65190f){return db[_0xddbc('0x30')][_0xddbc('0x4e')]({'where':{'id':_0x5c1b76['params']['id']}})[_0xddbc('0x1a')](handleEntityNotFound(_0x59da73,null))['then'](function(_0x3c1522){if(_0x3c1522){return _0x3c1522[_0xddbc('0x5c')](_0x5c1b76[_0xddbc('0x38')]['ids']);}})[_0xddbc('0x1a')](respondWithStatusCode(_0x59da73,null))[_0xddbc('0x4a')](handleError(_0x59da73,null));};exports[_0xddbc('0x5d')]=function(_0x294b6d,_0x34fd1f,_0x3583e4){if(_0x294b6d[_0xddbc('0x50')]['id']){delete _0x294b6d[_0xddbc('0x50')]['id'];}return db['ChatGroup'][_0xddbc('0x4e')]({'where':{'id':_0x294b6d[_0xddbc('0x4b')]['id']}})[_0xddbc('0x1a')](handleEntityNotFound(_0x34fd1f,null))[_0xddbc('0x1a')](function(_0x53c660){if(_0x53c660){_0x294b6d['body'][_0xddbc('0x5e')]=_0x53c660['id'];return db[_0xddbc('0x5f')][_0xddbc('0x4f')](_0x294b6d[_0xddbc('0x50')]);}})[_0xddbc('0x1a')](respondWithResult(_0x34fd1f,null))[_0xddbc('0x4a')](handleError(_0x34fd1f,null));};exports[_0xddbc('0x60')]=function(_0x39b39c,_0x4a6f14,_0x38f66b){var _0x141ee5={};var _0x3bed88={};var _0x4612c2;var _0x1774b9;return db[_0xddbc('0x30')][_0xddbc('0x58')]({'where':{'id':_0x39b39c[_0xddbc('0x4b')]['id']}})[_0xddbc('0x1a')](handleEntityNotFound(_0x4a6f14,null))[_0xddbc('0x1a')](function(_0xffc01){if(_0xffc01){_0x4612c2=_0xffc01;_0x3bed88['model']=_['keys'](db[_0xddbc('0x5f')]['rawAttributes']);_0x3bed88['query']=_['keys'](_0x39b39c[_0xddbc('0x38')]);_0x3bed88[_0xddbc('0x3a')]=_[_0xddbc('0x3b')](_0x3bed88[_0xddbc('0x35')],_0x3bed88[_0xddbc('0x38')]);_0x141ee5['attributes']=_[_0xddbc('0x3b')](_0x3bed88[_0xddbc('0x35')],qs['fields'](_0x39b39c[_0xddbc('0x38')]['fields']));_0x141ee5[_0xddbc('0x3c')]=_0x141ee5['attributes'][_0xddbc('0x3e')]?_0x141ee5['attributes']:_0x3bed88[_0xddbc('0x35')];_0x141ee5['order']=qs['sort'](_0x39b39c[_0xddbc('0x38')][_0xddbc('0x42')]);_0x141ee5[_0xddbc('0x43')]=qs['filters'](_[_0xddbc('0x44')](_0x39b39c[_0xddbc('0x38')],_0x3bed88[_0xddbc('0x3a')]));if(_0x39b39c[_0xddbc('0x38')][_0xddbc('0x45')]){_0x141ee5['where']=_[_0xddbc('0x4d')](_0x141ee5[_0xddbc('0x43')],{'$or':_[_0xddbc('0x36')](_0x141ee5['attributes'],function(_0x5ad362){var _0x58c68f={};_0x58c68f[_0x5ad362]={'$like':'%'+_0x39b39c['query']['filter']+'%'};return _0x58c68f;})});}if(_0x39b39c[_0xddbc('0x38')][_0xddbc('0x61')]){var _0x20a360=_0x39b39c[_0xddbc('0x38')][_0xddbc('0x61')]['split'](',');var _0x2b8b4c={};_0x2b8b4c[_0x20a360[0x0]]={'$gte':moment(_0x20a360[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x141ee5[_0xddbc('0x43')]=_[_0xddbc('0x4d')](_0x141ee5[_0xddbc('0x43')],_0x2b8b4c);}_0x141ee5=_[_0xddbc('0x4d')]({},_0x141ee5,_0x39b39c[_0xddbc('0x46')]);return _0x4612c2[_0xddbc('0x60')](_0x141ee5);}})[_0xddbc('0x1a')](function(_0x4d469d){if(_0x4d469d){_0x1774b9=_0x4d469d[_0xddbc('0x3e')];if(!_0x39b39c['query']['hasOwnProperty'](_0xddbc('0x40'))){_0x141ee5[_0xddbc('0x41')]=qs['limit'](_0x39b39c[_0xddbc('0x38')][_0xddbc('0x41')]);_0x141ee5[_0xddbc('0x29')]=qs[_0xddbc('0x29')](_0x39b39c['query'][_0xddbc('0x29')]);}return _0x4612c2['getMessages'](_0x141ee5);}})[_0xddbc('0x1a')](function(_0x1c8af4){if(_0x1c8af4){return _0x1c8af4?{'count':_0x1774b9,'rows':_0x1c8af4}:null;}})[_0xddbc('0x1a')](respondWithResult(_0x4a6f14,null))['catch'](handleError(_0x4a6f14,null));}; \ No newline at end of file +var _0x4e47=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','update','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','sort','removeMembers','addMessage','getMessages','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4e47,0x17f));var _0x74e4=function(_0x12cc70,_0xd67d7f){_0x12cc70=_0x12cc70-0x0;var _0x6f7b0d=_0x4e47[_0x12cc70];return _0x6f7b0d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x74e4('0x0'));var zipdir=require(_0x74e4('0x1'));var jsonpatch=require(_0x74e4('0x2'));var rp=require(_0x74e4('0x3'));var moment=require(_0x74e4('0x4'));var BPromise=require(_0x74e4('0x5'));var Mustache=require(_0x74e4('0x6'));var util=require(_0x74e4('0x7'));var path=require('path');var sox=require(_0x74e4('0x8'));var csv=require(_0x74e4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x74e4('0xa'));var squel=require(_0x74e4('0xb'));var crypto=require(_0x74e4('0xc'));var jsforce=require(_0x74e4('0xd'));var deskjs=require(_0x74e4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x74e4('0xf'));var Papa=require(_0x74e4('0x10'));var Redis=require(_0x74e4('0x11'));var authService=require(_0x74e4('0x12'));var qs=require(_0x74e4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74e4('0x14'));var logger=require(_0x74e4('0x15'))('api');var utils=require(_0x74e4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x74e4('0x17'));var db=require(_0x74e4('0x18'))['db'];config[_0x74e4('0x19')]=_[_0x74e4('0x1a')](config[_0x74e4('0x19')],{'host':_0x74e4('0x1b'),'port':0x18eb});var socket=require(_0x74e4('0x1c'))(new Redis(config[_0x74e4('0x19')]));require(_0x74e4('0x1d'))[_0x74e4('0x1e')](socket);var jayson=require(_0x74e4('0x1f'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f942b,_0x564953,_0x22cbed,_0x436369){return new BPromise(function(_0x2c427b,_0x565321){var _0x386f18=_0x436369||client;return _0x386f18[_0x74e4('0x20')](_0x4f942b,_0x22cbed)[_0x74e4('0x21')](function(_0x886bd1){logger[_0x74e4('0x22')](_0x74e4('0x23'),_0x564953,_0x74e4('0x24'));logger[_0x74e4('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x564953,_0x74e4('0x24'),JSON[_0x74e4('0x26')](_0x886bd1));if(_0x886bd1['error']){if(_0x886bd1['error']['code']===0x1f4){logger[_0x74e4('0x27')](_0x74e4('0x23'),_0x564953,_0x886bd1[_0x74e4('0x27')][_0x74e4('0x28')]);return _0x565321(_0x886bd1[_0x74e4('0x27')][_0x74e4('0x28')]);}logger[_0x74e4('0x27')](_0x74e4('0x23'),_0x564953,_0x886bd1[_0x74e4('0x27')]['message']);return _0x2c427b(_0x886bd1[_0x74e4('0x27')][_0x74e4('0x28')]);}else{logger[_0x74e4('0x22')]('ChatGroup,\x20%s,\x20%s',_0x564953,_0x74e4('0x24'));_0x2c427b(_0x886bd1['result'][_0x74e4('0x28')]);}})['catch'](function(_0x143549){logger[_0x74e4('0x27')](_0x74e4('0x23'),_0x564953,_0x143549);_0x565321(_0x143549);});});}function respondWithStatusCode(_0x4baf61,_0x3ae37c){_0x3ae37c=_0x3ae37c||0xcc;return function(_0x5dc803){if(_0x5dc803){return _0x4baf61[_0x74e4('0x29')](_0x3ae37c);}return _0x4baf61[_0x74e4('0x2a')](_0x3ae37c)[_0x74e4('0x2b')]();};}function respondWithResult(_0x12c9a0,_0x22c768){_0x22c768=_0x22c768||0xc8;return function(_0x59203d){if(_0x59203d){return _0x12c9a0[_0x74e4('0x2a')](_0x22c768)[_0x74e4('0x2c')](_0x59203d);}};}function respondWithFilteredResult(_0x1dd270,_0x68ad72){return function(_0x4a0b02){if(_0x4a0b02){var _0x37817f=_0x4a0b02[_0x74e4('0x2d')],_0x4111d5=_0x68ad72['offset'],_0xfc2953=_0x68ad72[_0x74e4('0x2e')]+_0x68ad72[_0x74e4('0x2f')],_0x316142;if(_0xfc2953>=_0x37817f){_0xfc2953=_0x37817f;_0x316142=0xc8;}else{_0x316142=0xce;}_0x1dd270[_0x74e4('0x2a')](_0x316142);return _0x1dd270[_0x74e4('0x30')](_0x74e4('0x31'),_0x4111d5+'-'+_0xfc2953+'/'+_0x37817f)[_0x74e4('0x2c')](_0x4a0b02);}return null;};}function patchUpdates(_0x3cd749){return function(_0x541823){try{jsonpatch['apply'](_0x541823,_0x3cd749,!![]);}catch(_0x144557){return BPromise['reject'](_0x144557);}return _0x541823['save']();};}function saveUpdates(_0x203b19,_0x372889){return function(_0x272ae5){if(_0x272ae5){return _0x272ae5['update'](_0x203b19)[_0x74e4('0x21')](function(_0xed51b0){return _0xed51b0;});}return null;};}function removeEntity(_0x4a72a8,_0x123dae){return function(_0x19a0e2){if(_0x19a0e2){return _0x19a0e2[_0x74e4('0x32')]()[_0x74e4('0x21')](function(){_0x4a72a8['status'](0xcc)[_0x74e4('0x2b')]();});}};}function handleEntityNotFound(_0x2ebbfa,_0xdd7d0a){return function(_0x59a242){if(!_0x59a242){_0x2ebbfa['sendStatus'](0x194);}return _0x59a242;};}function handleError(_0xa5c6d,_0x35376f){_0x35376f=_0x35376f||0x1f4;return function(_0x135659){logger[_0x74e4('0x27')](_0x135659[_0x74e4('0x33')]);if(_0x135659[_0x74e4('0x34')]){delete _0x135659[_0x74e4('0x34')];}_0xa5c6d[_0x74e4('0x2a')](_0x35376f)[_0x74e4('0x35')](_0x135659);};}exports[_0x74e4('0x36')]=function(_0x16b4f8,_0x1269ce){var _0x3ba945={},_0x2b5a4e={},_0x1eeef9={'count':0x0,'rows':[]};var _0x2a23ec=_[_0x74e4('0x37')](db[_0x74e4('0x38')][_0x74e4('0x39')],function(_0x49b315){return{'name':_0x49b315[_0x74e4('0x3a')],'type':_0x49b315[_0x74e4('0x3b')][_0x74e4('0x3c')]};});_0x2b5a4e[_0x74e4('0x3d')]=_['map'](_0x2a23ec,_0x74e4('0x34'));_0x2b5a4e[_0x74e4('0x3e')]=_[_0x74e4('0x3f')](_0x16b4f8[_0x74e4('0x3e')]);_0x2b5a4e[_0x74e4('0x40')]=_[_0x74e4('0x41')](_0x2b5a4e[_0x74e4('0x3d')],_0x2b5a4e[_0x74e4('0x3e')]);_0x3ba945[_0x74e4('0x42')]=_[_0x74e4('0x41')](_0x2b5a4e[_0x74e4('0x3d')],qs['fields'](_0x16b4f8['query'][_0x74e4('0x43')]));_0x3ba945[_0x74e4('0x42')]=_0x3ba945['attributes'][_0x74e4('0x44')]?_0x3ba945[_0x74e4('0x42')]:_0x2b5a4e[_0x74e4('0x3d')];if(!_0x16b4f8[_0x74e4('0x3e')]['hasOwnProperty'](_0x74e4('0x45'))){_0x3ba945[_0x74e4('0x2f')]=qs[_0x74e4('0x2f')](_0x16b4f8['query'][_0x74e4('0x2f')]);_0x3ba945['offset']=qs[_0x74e4('0x2e')](_0x16b4f8[_0x74e4('0x3e')][_0x74e4('0x2e')]);}_0x3ba945[_0x74e4('0x46')]=qs['sort'](_0x16b4f8[_0x74e4('0x3e')]['sort']);_0x3ba945['where']=qs[_0x74e4('0x40')](_[_0x74e4('0x47')](_0x16b4f8[_0x74e4('0x3e')],_0x2b5a4e[_0x74e4('0x40')]),_0x2a23ec);if(_0x16b4f8[_0x74e4('0x3e')][_0x74e4('0x48')]){_0x3ba945[_0x74e4('0x49')]=_[_0x74e4('0x4a')](_0x3ba945[_0x74e4('0x49')],{'$or':_['map'](_0x2a23ec,function(_0x5030d5){if(_0x5030d5['type']!==_0x74e4('0x4b')){var _0x47e527={};_0x47e527[_0x5030d5['name']]={'$like':'%'+_0x16b4f8[_0x74e4('0x3e')]['filter']+'%'};return _0x47e527;}})});}_0x3ba945=_[_0x74e4('0x4a')]({},_0x3ba945,_0x16b4f8[_0x74e4('0x4c')]);var _0xdf8f1a={'where':_0x3ba945[_0x74e4('0x49')]};return db[_0x74e4('0x38')][_0x74e4('0x2d')](_0xdf8f1a)[_0x74e4('0x21')](function(_0x52396a){_0x1eeef9[_0x74e4('0x2d')]=_0x52396a;if(_0x16b4f8[_0x74e4('0x3e')][_0x74e4('0x4d')]){_0x3ba945[_0x74e4('0x4e')]=[{'all':!![]}];}return db['ChatGroup'][_0x74e4('0x4f')](_0x3ba945);})[_0x74e4('0x21')](function(_0x5b25d9){_0x1eeef9[_0x74e4('0x50')]=_0x5b25d9;return _0x1eeef9;})['then'](respondWithFilteredResult(_0x1269ce,_0x3ba945))['catch'](handleError(_0x1269ce,null));};exports['show']=function(_0x2daccf,_0x2ad2d3){var _0x3d5ab3={'raw':!![],'where':{'id':_0x2daccf[_0x74e4('0x51')]['id']}},_0x43acc4={};_0x43acc4[_0x74e4('0x3d')]=_[_0x74e4('0x3f')](db['ChatGroup'][_0x74e4('0x39')]);_0x43acc4['query']=_[_0x74e4('0x3f')](_0x2daccf[_0x74e4('0x3e')]);_0x43acc4[_0x74e4('0x40')]=_['intersection'](_0x43acc4[_0x74e4('0x3d')],_0x43acc4[_0x74e4('0x3e')]);_0x3d5ab3['attributes']=_[_0x74e4('0x41')](_0x43acc4[_0x74e4('0x3d')],qs[_0x74e4('0x43')](_0x2daccf[_0x74e4('0x3e')][_0x74e4('0x43')]));_0x3d5ab3['attributes']=_0x3d5ab3[_0x74e4('0x42')][_0x74e4('0x44')]?_0x3d5ab3[_0x74e4('0x42')]:_0x43acc4[_0x74e4('0x3d')];if(_0x2daccf['query'][_0x74e4('0x4d')]){_0x3d5ab3[_0x74e4('0x4e')]=[{'all':!![]}];}_0x3d5ab3=_[_0x74e4('0x4a')]({},_0x3d5ab3,_0x2daccf[_0x74e4('0x4c')]);return db[_0x74e4('0x38')][_0x74e4('0x52')](_0x3d5ab3)[_0x74e4('0x21')](handleEntityNotFound(_0x2ad2d3,null))[_0x74e4('0x21')](respondWithResult(_0x2ad2d3,null))[_0x74e4('0x53')](handleError(_0x2ad2d3,null));};exports['create']=function(_0x561bdf,_0xb3fa23){return db[_0x74e4('0x38')][_0x74e4('0x54')](_0x561bdf[_0x74e4('0x55')],{})[_0x74e4('0x21')](respondWithResult(_0xb3fa23,0xc9))[_0x74e4('0x53')](handleError(_0xb3fa23,null));};exports[_0x74e4('0x56')]=function(_0x419df7,_0x3286be){if(_0x419df7[_0x74e4('0x55')]['id']){delete _0x419df7[_0x74e4('0x55')]['id'];}return db[_0x74e4('0x38')][_0x74e4('0x52')]({'where':{'id':_0x419df7[_0x74e4('0x51')]['id']}})[_0x74e4('0x21')](handleEntityNotFound(_0x3286be,null))[_0x74e4('0x21')](saveUpdates(_0x419df7[_0x74e4('0x55')],null))[_0x74e4('0x21')](respondWithResult(_0x3286be,null))[_0x74e4('0x53')](handleError(_0x3286be,null));};exports[_0x74e4('0x32')]=function(_0x1da1de,_0x565a94){return db['ChatGroup'][_0x74e4('0x52')]({'where':{'id':_0x1da1de[_0x74e4('0x51')]['id']}})['then'](handleEntityNotFound(_0x565a94,null))['then'](removeEntity(_0x565a94,null))['catch'](handleError(_0x565a94,null));};exports[_0x74e4('0x57')]=function(_0x389ff9,_0x2cf936){return db['ChatGroup'][_0x74e4('0x57')]()[_0x74e4('0x21')](respondWithResult(_0x2cf936,null))[_0x74e4('0x53')](handleError(_0x2cf936,null));};exports[_0x74e4('0x58')]=function(_0x346ac4,_0x909c79,_0x2c3a96){return db[_0x74e4('0x59')][_0x74e4('0x2d')]({'where':{'ChatGroupId':_0x346ac4[_0x74e4('0x51')]['id'],'ToId':_0x346ac4['user']['id'],'read':![]}})[_0x74e4('0x21')](function(_0x2a75e9){return{'id':_[_0x74e4('0x5a')](_0x346ac4[_0x74e4('0x51')]['id']),'count':_0x2a75e9};})[_0x74e4('0x21')](respondWithResult(_0x909c79,null))[_0x74e4('0x53')](handleError(_0x909c79,null));};exports[_0x74e4('0x5b')]=function(_0x216a07,_0x21eada,_0x5784e9){return db[_0x74e4('0x38')][_0x74e4('0x52')]({'where':{'id':_0x216a07[_0x74e4('0x51')]['id']}})[_0x74e4('0x21')](handleEntityNotFound(_0x21eada,null))[_0x74e4('0x21')](function(_0x38c0b3){if(_0x38c0b3){return _0x38c0b3['addMembers'](_0x216a07[_0x74e4('0x55')]['ids'],_['omit'](_0x216a07[_0x74e4('0x55')],[_0x74e4('0x5c'),'id'])||{});}})[_0x74e4('0x21')](respondWithResult(_0x21eada,null))[_0x74e4('0x53')](handleError(_0x21eada,null));};exports[_0x74e4('0x5d')]=function(_0x1396a5,_0x317e97,_0x404b31){var _0x305b22={};var _0x393db1={};var _0x3bb4f6;var _0xaaaf5e;return db[_0x74e4('0x38')][_0x74e4('0x5e')]({'where':{'id':_0x1396a5[_0x74e4('0x51')]['id']}})[_0x74e4('0x21')](handleEntityNotFound(_0x317e97,null))['then'](function(_0x210a8b){if(_0x210a8b){_0x3bb4f6=_0x210a8b;_0x393db1[_0x74e4('0x3d')]=_[_0x74e4('0x3f')](db['User'][_0x74e4('0x39')]);_0x393db1[_0x74e4('0x3e')]=_[_0x74e4('0x3f')](_0x1396a5[_0x74e4('0x3e')]);_0x393db1[_0x74e4('0x40')]=_[_0x74e4('0x41')](_0x393db1[_0x74e4('0x3d')],_0x393db1[_0x74e4('0x3e')]);_0x305b22[_0x74e4('0x42')]=_[_0x74e4('0x41')](_0x393db1[_0x74e4('0x3d')],qs[_0x74e4('0x43')](_0x1396a5[_0x74e4('0x3e')]['fields']));_0x305b22['attributes']=_0x305b22['attributes'][_0x74e4('0x44')]?_0x305b22[_0x74e4('0x42')]:_0x393db1[_0x74e4('0x3d')];_0x305b22['order']=qs[_0x74e4('0x5f')](_0x1396a5['query'][_0x74e4('0x5f')]);_0x305b22[_0x74e4('0x49')]=qs[_0x74e4('0x40')](_[_0x74e4('0x47')](_0x1396a5[_0x74e4('0x3e')],_0x393db1[_0x74e4('0x40')]));if(_0x1396a5['query'][_0x74e4('0x48')]){_0x305b22[_0x74e4('0x49')]=_[_0x74e4('0x4a')](_0x305b22['where'],{'$or':_[_0x74e4('0x37')](_0x305b22['attributes'],function(_0x2239bf){var _0xa65289={};_0xa65289[_0x2239bf]={'$like':'%'+_0x1396a5[_0x74e4('0x3e')][_0x74e4('0x48')]+'%'};return _0xa65289;})});}_0x305b22=_['merge']({},_0x305b22,_0x1396a5['options']);return _0x3bb4f6[_0x74e4('0x5d')](_0x305b22);}})[_0x74e4('0x21')](function(_0x68b024){if(_0x68b024){_0xaaaf5e=_0x68b024[_0x74e4('0x44')];if(!_0x1396a5[_0x74e4('0x3e')]['hasOwnProperty']('nolimit')){_0x305b22[_0x74e4('0x2f')]=qs[_0x74e4('0x2f')](_0x1396a5['query'][_0x74e4('0x2f')]);_0x305b22[_0x74e4('0x2e')]=qs['offset'](_0x1396a5[_0x74e4('0x3e')][_0x74e4('0x2e')]);}return _0x3bb4f6['getMembers'](_0x305b22);}})[_0x74e4('0x21')](function(_0x25c4c3){if(_0x25c4c3){return _0x25c4c3?{'count':_0xaaaf5e,'rows':_0x25c4c3}:null;}})[_0x74e4('0x21')](respondWithResult(_0x317e97,null))[_0x74e4('0x53')](handleError(_0x317e97,null));};exports['removeMembers']=function(_0x40acaf,_0x56025d,_0x1d3d5f){return db['ChatGroup'][_0x74e4('0x52')]({'where':{'id':_0x40acaf[_0x74e4('0x51')]['id']}})[_0x74e4('0x21')](handleEntityNotFound(_0x56025d,null))[_0x74e4('0x21')](function(_0x4fe3e4){if(_0x4fe3e4){return _0x4fe3e4[_0x74e4('0x60')](_0x40acaf[_0x74e4('0x3e')][_0x74e4('0x5c')]);}})[_0x74e4('0x21')](respondWithStatusCode(_0x56025d,null))[_0x74e4('0x53')](handleError(_0x56025d,null));};exports[_0x74e4('0x61')]=function(_0x2f432b,_0x5381ba,_0x57ff55){if(_0x2f432b[_0x74e4('0x55')]['id']){delete _0x2f432b[_0x74e4('0x55')]['id'];}return db[_0x74e4('0x38')][_0x74e4('0x52')]({'where':{'id':_0x2f432b[_0x74e4('0x51')]['id']}})['then'](handleEntityNotFound(_0x5381ba,null))[_0x74e4('0x21')](function(_0xf4716a){if(_0xf4716a){_0x2f432b['body']['ChatGroupId']=_0xf4716a['id'];return db['ChatInternalMessage']['create'](_0x2f432b['body']);}})[_0x74e4('0x21')](respondWithResult(_0x5381ba,null))[_0x74e4('0x53')](handleError(_0x5381ba,null));};exports[_0x74e4('0x62')]=function(_0x4439f3,_0x950b1f,_0x3e71a1){var _0x13bdb0={};var _0x390ee1={};var _0x43ab17;var _0x2e8a20;return db['ChatGroup'][_0x74e4('0x5e')]({'where':{'id':_0x4439f3[_0x74e4('0x51')]['id']}})[_0x74e4('0x21')](handleEntityNotFound(_0x950b1f,null))[_0x74e4('0x21')](function(_0x1aa302){if(_0x1aa302){_0x43ab17=_0x1aa302;_0x390ee1[_0x74e4('0x3d')]=_[_0x74e4('0x3f')](db[_0x74e4('0x59')]['rawAttributes']);_0x390ee1['query']=_[_0x74e4('0x3f')](_0x4439f3[_0x74e4('0x3e')]);_0x390ee1['filters']=_['intersection'](_0x390ee1[_0x74e4('0x3d')],_0x390ee1[_0x74e4('0x3e')]);_0x13bdb0[_0x74e4('0x42')]=_[_0x74e4('0x41')](_0x390ee1[_0x74e4('0x3d')],qs[_0x74e4('0x43')](_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x43')]));_0x13bdb0[_0x74e4('0x42')]=_0x13bdb0[_0x74e4('0x42')]['length']?_0x13bdb0[_0x74e4('0x42')]:_0x390ee1[_0x74e4('0x3d')];_0x13bdb0['order']=qs['sort'](_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x5f')]);_0x13bdb0[_0x74e4('0x49')]=qs[_0x74e4('0x40')](_['pick'](_0x4439f3[_0x74e4('0x3e')],_0x390ee1['filters']));if(_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x48')]){_0x13bdb0[_0x74e4('0x49')]=_[_0x74e4('0x4a')](_0x13bdb0[_0x74e4('0x49')],{'$or':_['map'](_0x13bdb0[_0x74e4('0x42')],function(_0x41c53b){var _0x180980={};_0x180980[_0x41c53b]={'$like':'%'+_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x48')]+'%'};return _0x180980;})});}if(_0x4439f3['query']['$gte']){var _0x27315d=_0x4439f3[_0x74e4('0x3e')]['$gte']['split'](',');var _0x3fab4e={};_0x3fab4e[_0x27315d[0x0]]={'$gte':moment(_0x27315d[0x1])['format'](_0x74e4('0x63'))};_0x13bdb0[_0x74e4('0x49')]=_['merge'](_0x13bdb0[_0x74e4('0x49')],_0x3fab4e);}_0x13bdb0=_[_0x74e4('0x4a')]({},_0x13bdb0,_0x4439f3['options']);return _0x43ab17[_0x74e4('0x62')](_0x13bdb0);}})[_0x74e4('0x21')](function(_0xdfe7f3){if(_0xdfe7f3){_0x2e8a20=_0xdfe7f3['length'];if(!_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x64')](_0x74e4('0x45'))){_0x13bdb0[_0x74e4('0x2f')]=qs[_0x74e4('0x2f')](_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x2f')]);_0x13bdb0[_0x74e4('0x2e')]=qs[_0x74e4('0x2e')](_0x4439f3[_0x74e4('0x3e')][_0x74e4('0x2e')]);}return _0x43ab17[_0x74e4('0x62')](_0x13bdb0);}})['then'](function(_0x29e632){if(_0x29e632){return _0x29e632?{'count':_0x2e8a20,'rows':_0x29e632}:null;}})[_0x74e4('0x21')](respondWithResult(_0x950b1f,null))[_0x74e4('0x53')](handleError(_0x950b1f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9a6a957..dcc1bbc 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 _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x5a18c3,_0x5c6928){var _0x3e22e7=function(_0x1cc5a5){while(--_0x1cc5a5){_0x5a18c3['push'](_0x5a18c3['shift']());}};_0x3e22e7(++_0x5c6928);}(_0x2ef3,0xba));var _0x32ef=function(_0x467f86,_0x56f6c1){_0x467f86=_0x467f86-0x0;var _0x16c0c8=_0x2ef3[_0x467f86];return _0x16c0c8;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x490da9,_0x31214f){var _0x5b9821=function(_0x1423e0){while(--_0x1423e0){_0x490da9['push'](_0x490da9['shift']());}};_0x5b9821(++_0x31214f);}(_0x2ef3,0xba));var _0x32ef=function(_0x5c8e6f,_0x56262d){_0x5c8e6f=_0x5c8e6f-0x0;var _0xb182f5=_0x2ef3[_0x5c8e6f];return _0xb182f5;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 58921b4..d98d169 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 _0x56a4=['./chatGroup.attributes','exports','chat_groups','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x43ce24,_0x4883a0){var _0x2cba88=function(_0x5afd0b){while(--_0x5afd0b){_0x43ce24['push'](_0x43ce24['shift']());}};_0x2cba88(++_0x4883a0);}(_0x56a4,0x11b));var _0x456a=function(_0x38b1fe,_0x53aedb){_0x38b1fe=_0x38b1fe-0x0;var _0x1b3f86=_0x56a4[_0x38b1fe];return _0x1b3f86;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('ChatGroup',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55d2=['../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x27d66e,_0x1eeff6){var _0x2f7081=function(_0x2f8d23){while(--_0x2f8d23){_0x27d66e['push'](_0x27d66e['shift']());}};_0x2f7081(++_0x1eeff6);}(_0x55d2,0x9f));var _0x255d=function(_0x40d800,_0x5c4a47){_0x40d800=_0x40d800-0x0;var _0x22fb2f=_0x55d2[_0x40d800];return _0x22fb2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x255d('0x0'))(_0x255d('0x1'));var moment=require(_0x255d('0x2'));var BPromise=require(_0x255d('0x3'));var rp=require(_0x255d('0x4'));var fs=require('fs');var path=require(_0x255d('0x5'));var rimraf=require('rimraf');var config=require(_0x255d('0x6'));var attributes=require(_0x255d('0x7'));module[_0x255d('0x8')]=function(_0x38017a,_0x58dae4){return _0x38017a['define'](_0x255d('0x9'),attributes,{'tableName':_0x255d('0xa'),'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 b6a1bad..c8d8f61 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 _0x088f=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0xc3f291,_0x9b52e9){var _0x11e318=function(_0x355318){while(--_0x355318){_0xc3f291['push'](_0xc3f291['shift']());}};_0x11e318(++_0x9b52e9);}(_0x088f,0x152));var _0xf088=function(_0x1f82a1,_0x2324f4){_0x1f82a1=_0x1f82a1-0x0;var _0x5772d2=_0x088f[_0x1f82a1];return _0x5772d2;};'use strict';var _=require(_0xf088('0x0'));var util=require(_0xf088('0x1'));var moment=require('moment');var BPromise=require(_0xf088('0x2'));var rs=require(_0xf088('0x3'));var fs=require('fs');var Redis=require(_0xf088('0x4'));var db=require(_0xf088('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf088('0x6'));var config=require(_0xf088('0x7'));var jayson=require(_0xf088('0x8'));var client=jayson[_0xf088('0x9')][_0xf088('0xa')]({'port':0x232a});config[_0xf088('0xb')]=_[_0xf088('0xc')](config[_0xf088('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf088('0xb')]));require(_0xf088('0xd'))[_0xf088('0xe')](socket);function respondWithRpcPromise(_0x3e1b80,_0x24770c,_0x2e8b97){return new BPromise(function(_0x563515,_0x4d8e32){return client[_0xf088('0xf')](_0x3e1b80,_0x2e8b97)['then'](function(_0x4a95b9){logger[_0xf088('0x10')](_0xf088('0x11'),_0x24770c,_0xf088('0x12'));logger[_0xf088('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x24770c,_0xf088('0x12'),JSON[_0xf088('0x14')](_0x4a95b9));if(_0x4a95b9[_0xf088('0x15')]){if(_0x4a95b9[_0xf088('0x15')][_0xf088('0x16')]===0x1f4){logger[_0xf088('0x15')](_0xf088('0x11'),_0x24770c,_0x4a95b9[_0xf088('0x15')][_0xf088('0x17')]);return _0x4d8e32(_0x4a95b9[_0xf088('0x15')][_0xf088('0x17')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x24770c,_0x4a95b9[_0xf088('0x15')][_0xf088('0x17')]);return _0x563515(_0x4a95b9['error'][_0xf088('0x17')]);}else{logger[_0xf088('0x10')]('ChatGroup,\x20%s,\x20%s',_0x24770c,_0xf088('0x12'));_0x563515(_0x4a95b9[_0xf088('0x18')][_0xf088('0x17')]);}})[_0xf088('0x19')](function(_0x2a3451){logger[_0xf088('0x15')](_0xf088('0x11'),_0x24770c,_0x2a3451);_0x4d8e32(_0x2a3451);});});} \ No newline at end of file +var _0x0334=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x587ba5,_0xaee173){var _0x422915=function(_0x459024){while(--_0x459024){_0x587ba5['push'](_0x587ba5['shift']());}};_0x422915(++_0xaee173);}(_0x0334,0xf4));var _0x4033=function(_0xb57040,_0x308251){_0xb57040=_0xb57040-0x0;var _0x55baea=_0x0334[_0xb57040];return _0x55baea;};'use strict';var _=require(_0x4033('0x0'));var util=require(_0x4033('0x1'));var moment=require(_0x4033('0x2'));var BPromise=require(_0x4033('0x3'));var rs=require(_0x4033('0x4'));var fs=require('fs');var Redis=require(_0x4033('0x5'));var db=require(_0x4033('0x6'))['db'];var utils=require(_0x4033('0x7'));var logger=require(_0x4033('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4033('0x9'));var client=jayson[_0x4033('0xa')][_0x4033('0xb')]({'port':0x232a});config[_0x4033('0xc')]=_[_0x4033('0xd')](config[_0x4033('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x56b7a2,_0x2efbb6,_0x3d12d5){return new BPromise(function(_0x2abe3f,_0x42becc){return client[_0x4033('0xe')](_0x56b7a2,_0x3d12d5)[_0x4033('0xf')](function(_0x59d55d){logger['info'](_0x4033('0x10'),_0x2efbb6,_0x4033('0x11'));logger[_0x4033('0x12')](_0x4033('0x13'),_0x2efbb6,_0x4033('0x11'),JSON[_0x4033('0x14')](_0x59d55d));if(_0x59d55d[_0x4033('0x15')]){if(_0x59d55d[_0x4033('0x15')]['code']===0x1f4){logger['error'](_0x4033('0x10'),_0x2efbb6,_0x59d55d[_0x4033('0x15')]['message']);return _0x42becc(_0x59d55d[_0x4033('0x15')][_0x4033('0x16')]);}logger['error'](_0x4033('0x10'),_0x2efbb6,_0x59d55d[_0x4033('0x15')]['message']);return _0x2abe3f(_0x59d55d[_0x4033('0x15')][_0x4033('0x16')]);}else{logger[_0x4033('0x17')]('ChatGroup,\x20%s,\x20%s',_0x2efbb6,_0x4033('0x11'));_0x2abe3f(_0x59d55d[_0x4033('0x18')][_0x4033('0x16')]);}})['catch'](function(_0x2146bb){logger['error']('ChatGroup,\x20%s,\x20%s',_0x2efbb6,_0x2146bb);_0x42becc(_0x2146bb);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index db647b5..48a8532 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 _0xd837=['save','remove','update','emit','removeListener','register','chatGroup:','./chatGroup.events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd837,0x1ef));var _0x7d83=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xd837[_0x4cf8d4];return _0x2c1beb;};'use strict';var ChatGroupEvents=require(_0x7d83('0x0'));var events=[_0x7d83('0x1'),_0x7d83('0x2'),_0x7d83('0x3')];function createListener(_0x53778b,_0x448a31){return function(_0x5c3462){_0x448a31[_0x7d83('0x4')](_0x53778b,_0x5c3462);};}function removeListener(_0x5775e0,_0xc26327){return function(){ChatGroupEvents[_0x7d83('0x5')](_0x5775e0,_0xc26327);};}exports[_0x7d83('0x6')]=function(_0x3743e5){for(var _0x48a3c3=0x0,_0x378501=events['length'];_0x48a3c3<_0x378501;_0x48a3c3++){var _0x3677e5=events[_0x48a3c3];var _0x5bc044=createListener(_0x7d83('0x7')+_0x3677e5,_0x3743e5);ChatGroupEvents['on'](_0x3677e5,_0x5bc044);}}; \ No newline at end of file +var _0xaed9=['./chatGroup.events','remove','emit','removeListener','length'];(function(_0x6e1577,_0x49e7d5){var _0x114e35=function(_0x333d7b){while(--_0x333d7b){_0x6e1577['push'](_0x6e1577['shift']());}};_0x114e35(++_0x49e7d5);}(_0xaed9,0x118));var _0x9aed=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0xaed9[_0x5fa520];return _0x1bf6c4;};'use strict';var ChatGroupEvents=require(_0x9aed('0x0'));var events=['save',_0x9aed('0x1'),'update'];function createListener(_0x1fb37a,_0x1fb83b){return function(_0x41db10){_0x1fb83b[_0x9aed('0x2')](_0x1fb37a,_0x41db10);};}function removeListener(_0x3ed9ee,_0x468394){return function(){ChatGroupEvents[_0x9aed('0x3')](_0x3ed9ee,_0x468394);};}exports['register']=function(_0x426806){for(var _0x257211=0x0,_0x5424a6=events[_0x9aed('0x4')];_0x257211<_0x5424a6;_0x257211++){var _0x828fb3=events[_0x257211];var _0x5ea816=createListener('chatGroup:'+_0x828fb3,_0x426806);ChatGroupEvents['on'](_0x828fb3,_0x5ea816);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fa1b9fc..bb8bd47 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 _0xaf97=['express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','/:id','destroy','removeMembers','exports','util','path','connect-timeout'];(function(_0x58b7be,_0xce365e){var _0x522cdb=function(_0x3964ac){while(--_0x3964ac){_0x58b7be['push'](_0x58b7be['shift']());}};_0x522cdb(++_0xce365e);}(_0xaf97,0x75));var _0x7af9=function(_0x54ad8c,_0x567562){_0x54ad8c=_0x54ad8c-0x0;var _0x44d335=_0xaf97[_0x54ad8c];return _0x44d335;};'use strict';var multer=require('multer');var util=require(_0x7af9('0x0'));var path=require(_0x7af9('0x1'));var timeout=require(_0x7af9('0x2'));var express=require(_0x7af9('0x3'));var router=express[_0x7af9('0x4')]();var auth=require(_0x7af9('0x5'));var interaction=require(_0x7af9('0x6'));var config=require('../../config/environment');var controller=require(_0x7af9('0x7'));router[_0x7af9('0x8')]('/',auth[_0x7af9('0x9')](),controller[_0x7af9('0xa')]);router[_0x7af9('0x8')]('/describe',auth[_0x7af9('0x9')](),controller[_0x7af9('0xb')]);router[_0x7af9('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7af9('0x8')](_0x7af9('0xc'),auth['isAuthenticated'](),controller['getUnread']);router[_0x7af9('0x8')](_0x7af9('0xd'),auth[_0x7af9('0x9')](),controller[_0x7af9('0xe')]);router['get'](_0x7af9('0xf'),auth[_0x7af9('0x9')](),controller[_0x7af9('0x10')]);router['post']('/',auth[_0x7af9('0x9')](),controller[_0x7af9('0x11')]);router[_0x7af9('0x12')](_0x7af9('0xd'),auth[_0x7af9('0x9')](),controller[_0x7af9('0x13')]);router[_0x7af9('0x12')](_0x7af9('0xf'),auth[_0x7af9('0x9')](),controller['addMessage']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7af9('0x14'),auth[_0x7af9('0x9')](),controller[_0x7af9('0x15')]);router['delete'](_0x7af9('0xd'),auth[_0x7af9('0x9')](),controller[_0x7af9('0x16')]);module[_0x7af9('0x17')]=router; \ No newline at end of file +var _0xb1cb=['/:id/messages','put','delete','destroy','removeMembers','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','index','describe','/:id','show','/:id/unread','isAuthenticated','getUnread','getMembers','getMessages','post','create','/:id/members','addMembers'];(function(_0xb522af,_0x15a423){var _0x31156f=function(_0x15e69d){while(--_0x15e69d){_0xb522af['push'](_0xb522af['shift']());}};_0x31156f(++_0x15a423);}(_0xb1cb,0xbb));var _0xbb1c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb1cb[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xbb1c('0x0'));var util=require('util');var path=require(_0xbb1c('0x1'));var timeout=require(_0xbb1c('0x2'));var express=require(_0xbb1c('0x3'));var router=express['Router']();var auth=require(_0xbb1c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb1c('0x5'));var controller=require(_0xbb1c('0x6'));router[_0xbb1c('0x7')]('/',auth['isAuthenticated'](),controller[_0xbb1c('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbb1c('0x9')]);router[_0xbb1c('0x7')](_0xbb1c('0xa'),auth['isAuthenticated'](),controller[_0xbb1c('0xb')]);router[_0xbb1c('0x7')](_0xbb1c('0xc'),auth[_0xbb1c('0xd')](),controller[_0xbb1c('0xe')]);router[_0xbb1c('0x7')]('/:id/members',auth[_0xbb1c('0xd')](),controller[_0xbb1c('0xf')]);router[_0xbb1c('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbb1c('0x10')]);router[_0xbb1c('0x11')]('/',auth[_0xbb1c('0xd')](),controller[_0xbb1c('0x12')]);router[_0xbb1c('0x11')](_0xbb1c('0x13'),auth[_0xbb1c('0xd')](),controller[_0xbb1c('0x14')]);router[_0xbb1c('0x11')](_0xbb1c('0x15'),auth['isAuthenticated'](),controller['addMessage']);router[_0xbb1c('0x16')](_0xbb1c('0xa'),auth[_0xbb1c('0xd')](),controller['update']);router[_0xbb1c('0x17')](_0xbb1c('0xa'),auth[_0xbb1c('0xd')](),controller[_0xbb1c('0x18')]);router['delete'](_0xbb1c('0x13'),auth[_0xbb1c('0xd')](),controller[_0xbb1c('0x19')]);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 2fb3341..07c385f 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 _0x9991=['sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','TEXT','STRING','DATE','long','out'];(function(_0x14914a,_0x3eae81){var _0x3766ec=function(_0x2d6c73){while(--_0x2d6c73){_0x14914a['push'](_0x14914a['shift']());}};_0x3766ec(++_0x3eae81);}(_0x9991,0x14a));var _0x1999=function(_0x26df62,_0x441984){_0x26df62=_0x26df62-0x0;var _0x56c50b=_0x9991[_0x26df62];return _0x56c50b;};'use strict';var Sequelize=require(_0x1999('0x0'));module[_0x1999('0x1')]={'closed':{'type':Sequelize[_0x1999('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1999('0x3')]},'ratingType':{'type':Sequelize[_0x1999('0x4')]('star',_0x1999('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1999('0x6')]},'pathTranscript':{'type':Sequelize[_0x1999('0x6')]},'mailTranscript':{'type':Sequelize[_0x1999('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1999('0x8')]},'disposition':{'type':Sequelize[_0x1999('0x7')]},'secondDisposition':{'type':Sequelize[_0x1999('0x7')]},'thirdDisposition':{'type':Sequelize[_0x1999('0x7')]},'note':{'type':Sequelize[_0x1999('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1999('0x7')]},'osVersion':{'type':Sequelize[_0x1999('0x7')]},'deviceModel':{'type':Sequelize[_0x1999('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x1999('0x6')]},'customerIp':{'type':Sequelize[_0x1999('0x7')]},'formData':{'type':Sequelize[_0x1999('0x6')](_0x1999('0x9'))},'read1stAt':{'type':Sequelize[_0x1999('0x8')]},'lastMsgAt':{'type':Sequelize[_0x1999('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x1999('0x4')]('in',_0x1999('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1999('0x7')]},'customerPort':{'type':Sequelize[_0x1999('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb82e=['ENUM','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xb82e,0x172));var _0xeb82=function(_0x4a6584,_0x32afcb){_0x4a6584=_0x4a6584-0x0;var _0x54f82c=_0xb82e[_0x4a6584];return _0x54f82c;};'use strict';var Sequelize=require(_0xeb82('0x0'));module[_0xeb82('0x1')]={'closed':{'type':Sequelize[_0xeb82('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xeb82('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xeb82('0x4'),_0xeb82('0x5')),'defaultValue':_0xeb82('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xeb82('0x6')]},'mailTranscript':{'type':Sequelize[_0xeb82('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xeb82('0x7')]},'secondDisposition':{'type':Sequelize[_0xeb82('0x7')]},'thirdDisposition':{'type':Sequelize[_0xeb82('0x7')]},'note':{'type':Sequelize[_0xeb82('0x7')]},'browserName':{'type':Sequelize[_0xeb82('0x7')]},'browserVersion':{'type':Sequelize[_0xeb82('0x7')]},'osName':{'type':Sequelize[_0xeb82('0x7')]},'osVersion':{'type':Sequelize[_0xeb82('0x7')]},'deviceModel':{'type':Sequelize[_0xeb82('0x7')]},'deviceVendor':{'type':Sequelize[_0xeb82('0x7')]},'deviceType':{'type':Sequelize[_0xeb82('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xeb82('0x7')]},'formData':{'type':Sequelize[_0xeb82('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xeb82('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xeb82('0x7')]},'customerPort':{'type':Sequelize[_0xeb82('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xeb82('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1908f2d..d28600b 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 _0xf1e8=['filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','show','params','includeAll','options','create','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','ValidationError','ChatMessage','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','nolimit','include','findAll','getMyMessages','secret','includeAgent','setTags','spread','chatInteractionTags:save','removeTags','unix','server','files','tmp','firstName','lastName','attachments','Account','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','stack','name','map','TagIds','Tags','split','forEach','push','ChatInteraction','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag'];(function(_0x235ae3,_0x2e5f1e){var _0xf631d1=function(_0x51fe40){while(--_0x51fe40){_0x235ae3['push'](_0x235ae3['shift']());}};_0xf631d1(++_0x2e5f1e);}(_0xf1e8,0x1c9));var _0x8f1e=function(_0x124c30,_0x4fdf92){_0x124c30=_0x124c30-0x0;var _0x31bca4=_0xf1e8[_0x124c30];return _0x31bca4;};'use strict';var pdf=require(_0x8f1e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8f1e('0x1'));var zipdir=require(_0x8f1e('0x2'));var jsonpatch=require(_0x8f1e('0x3'));var rp=require(_0x8f1e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f1e('0x5'));var util=require(_0x8f1e('0x6'));var path=require(_0x8f1e('0x7'));var sox=require(_0x8f1e('0x8'));var csv=require(_0x8f1e('0x9'));var ejs=require(_0x8f1e('0xa'));var fs=require('fs');var _=require(_0x8f1e('0xb'));var squel=require(_0x8f1e('0xc'));var crypto=require('crypto');var jsforce=require(_0x8f1e('0xd'));var deskjs=require(_0x8f1e('0xe'));var toCsv=require(_0x8f1e('0x9'));var querystring=require(_0x8f1e('0xf'));var Papa=require(_0x8f1e('0x10'));var Redis=require(_0x8f1e('0x11'));var authService=require(_0x8f1e('0x12'));var qs=require(_0x8f1e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f1e('0x14'))(_0x8f1e('0x15'));var utils=require('../../config/utils');var config=require(_0x8f1e('0x16'));var licenseUtil=require(_0x8f1e('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8f1e('0x18')](config[_0x8f1e('0x19')],{'host':_0x8f1e('0x1a'),'port':0x18eb});var socket=require(_0x8f1e('0x1b'))(new Redis(config[_0x8f1e('0x19')]));require(_0x8f1e('0x1c'))[_0x8f1e('0x1d')](socket);var jayson=require(_0x8f1e('0x1e'));var client=jayson[_0x8f1e('0x1f')][_0x8f1e('0x20')]({'port':0x232b});var client9004=jayson[_0x8f1e('0x1f')][_0x8f1e('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x52e4c6,_0x2994c6,_0x40bdbb,_0x16a54c){return new BPromise(function(_0x146845,_0x5ab21d){var _0x326303=_0x16a54c||client;return _0x326303['request'](_0x52e4c6,_0x40bdbb)['then'](function(_0x71ddbd){logger['info'](_0x8f1e('0x21'),_0x2994c6,_0x8f1e('0x22'));logger[_0x8f1e('0x23')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2994c6,'request\x20sent',JSON[_0x8f1e('0x24')](_0x71ddbd));if(_0x71ddbd[_0x8f1e('0x25')]){if(_0x71ddbd[_0x8f1e('0x25')][_0x8f1e('0x26')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2994c6,_0x71ddbd[_0x8f1e('0x25')][_0x8f1e('0x27')]);return _0x5ab21d(_0x71ddbd[_0x8f1e('0x25')][_0x8f1e('0x27')]);}logger[_0x8f1e('0x25')](_0x8f1e('0x21'),_0x2994c6,_0x71ddbd[_0x8f1e('0x25')][_0x8f1e('0x27')]);return _0x146845(_0x71ddbd['error'][_0x8f1e('0x27')]);}else{logger[_0x8f1e('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x2994c6,_0x8f1e('0x22'));_0x146845(_0x71ddbd['result'][_0x8f1e('0x27')]);}})[_0x8f1e('0x29')](function(_0x4c4714){logger[_0x8f1e('0x25')](_0x8f1e('0x21'),_0x2994c6,_0x4c4714);_0x5ab21d(_0x4c4714);});});}function respondWithStatusCode(_0x39ebe8,_0x532054){_0x532054=_0x532054||0xcc;return function(_0x125a0f){if(_0x125a0f){return _0x39ebe8[_0x8f1e('0x2a')](_0x532054);}return _0x39ebe8[_0x8f1e('0x2b')](_0x532054)[_0x8f1e('0x2c')]();};}function respondWithResult(_0x5bb3fb,_0x5f1a05){_0x5f1a05=_0x5f1a05||0xc8;return function(_0x461c73){if(_0x461c73){return _0x5bb3fb[_0x8f1e('0x2b')](_0x5f1a05)[_0x8f1e('0x2d')](_0x461c73);}};}function respondWithFilteredResult(_0xc9f61d,_0x135a45){return function(_0x33764d){if(_0x33764d){var _0x32fdec=_0x33764d[_0x8f1e('0x2e')],_0x5b653e=_0x135a45[_0x8f1e('0x2f')],_0x5df02b=_0x135a45['offset']+_0x135a45[_0x8f1e('0x30')],_0x5cc255;if(_0x5df02b>=_0x32fdec){_0x5df02b=_0x32fdec;_0x5cc255=0xc8;}else{_0x5cc255=0xce;}_0xc9f61d[_0x8f1e('0x2b')](_0x5cc255);return _0xc9f61d[_0x8f1e('0x31')]('Content-Range',_0x5b653e+'-'+_0x5df02b+'/'+_0x32fdec)[_0x8f1e('0x2d')](_0x33764d);}return null;};}function patchUpdates(_0x2f934c){return function(_0x2788fd){try{jsonpatch['apply'](_0x2788fd,_0x2f934c,!![]);}catch(_0x52f238){return BPromise[_0x8f1e('0x32')](_0x52f238);}return _0x2788fd[_0x8f1e('0x33')]();};}function saveUpdates(_0x4e3996,_0xa9de23){return function(_0x1fe24a){if(_0x1fe24a){return _0x1fe24a[_0x8f1e('0x34')](_0x4e3996)[_0x8f1e('0x35')](function(_0x37bb85){return _0x37bb85;});}return null;};}function removeEntity(_0x2fdb5d,_0x32173c){return function(_0x3739c7){if(_0x3739c7){return _0x3739c7[_0x8f1e('0x36')]()[_0x8f1e('0x35')](function(){_0x2fdb5d[_0x8f1e('0x2b')](0xcc)[_0x8f1e('0x2c')]();});}};}function handleEntityNotFound(_0x5e446a,_0x2f6742){return function(_0x4b4109){if(!_0x4b4109){_0x5e446a[_0x8f1e('0x2a')](0x194);}return _0x4b4109;};}function handleError(_0xef9c19,_0x4a781c){_0x4a781c=_0x4a781c||0x1f4;return function(_0x3231bc){logger['error'](_0x3231bc[_0x8f1e('0x37')]);if(_0x3231bc[_0x8f1e('0x38')]){delete _0x3231bc['name'];}_0xef9c19[_0x8f1e('0x2b')](_0x4a781c)['send'](_0x3231bc);};}function getInteractionUsers(_0x450f2f,_0x44437c){return new BPromise(function(_0x274d81,_0x2f32b3){try{if(_0x44437c[_0x450f2f['id']]){_0x450f2f['Users']=_[_0x8f1e('0x39')](_0x44437c[_0x450f2f['id']],function(_0x2915ed){return{'id':_0x2915ed['id'],'fullname':_0x2915ed['fullname']};});}}catch(_0x1d4960){_0x2f32b3(_0x1d4960);}_0x274d81(_0x450f2f);});}function getInteractionTags(_0x254140,_0xe4733b){return new BPromise(function(_0x28e3ec,_0x15f823){try{if(_0x254140[_0x8f1e('0x3a')]){_0x254140[_0x8f1e('0x3b')]=[];_0x254140[_0x8f1e('0x3a')][_0x8f1e('0x3c')](',')[_0x8f1e('0x3d')](function(_0x4e80e5){_0x254140[_0x8f1e('0x3b')][_0x8f1e('0x3e')](_0xe4733b[_0x4e80e5]);});}delete _0x254140[_0x8f1e('0x3a')];}catch(_0x4fd27b){_0x15f823(_0x4fd27b);}_0x28e3ec(_0x254140);});}function updateChatInteraction(_0x41a013,_0x1ff2e0,_0x524f04){return new BPromise(function(_0x4f3cf5,_0x4e1770){return getInteractionUsers(_0x41a013,_0x524f04)['then'](function(_0x38dd64){return getInteractionTags(_0x38dd64,_0x1ff2e0);})[_0x8f1e('0x35')](function(_0x296112){_0x4f3cf5(_0x296112);})['catch'](function(_0x555b7a){_0x4e1770(_0x555b7a);});});}exports['index']=function(_0x53cba5,_0x401084){var _0x1320d6={},_0x946d={},_0x59cf54={'count':0x0,'rows':[]};var _0x4511c2=_[_0x8f1e('0x39')](db[_0x8f1e('0x3f')][_0x8f1e('0x40')],function(_0x45fedd){return{'name':_0x45fedd[_0x8f1e('0x41')],'type':_0x45fedd[_0x8f1e('0x42')]['key']};});_0x946d['model']=_[_0x8f1e('0x39')](_0x4511c2,_0x8f1e('0x38'));_0x946d[_0x8f1e('0x43')]=_['keys'](_0x53cba5[_0x8f1e('0x43')]);_0x946d[_0x8f1e('0x44')]=_[_0x8f1e('0x45')](_0x946d['model'],_0x946d[_0x8f1e('0x43')]);_0x1320d6[_0x8f1e('0x46')]=_[_0x8f1e('0x45')](_0x946d[_0x8f1e('0x47')],qs[_0x8f1e('0x48')](_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x48')]));_0x1320d6[_0x8f1e('0x46')]=_0x1320d6['attributes'][_0x8f1e('0x49')]?_0x1320d6[_0x8f1e('0x46')]:_0x946d[_0x8f1e('0x47')];if(!_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x4a')]('nolimit')){_0x1320d6[_0x8f1e('0x30')]=qs[_0x8f1e('0x30')](_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x30')]);_0x1320d6['offset']=qs[_0x8f1e('0x2f')](_0x53cba5['query']['offset']);}_0x1320d6[_0x8f1e('0x4b')]=qs[_0x8f1e('0x4c')](_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x4c')]);_0x1320d6[_0x8f1e('0x4d')]=qs[_0x8f1e('0x44')](_[_0x8f1e('0x4e')](_0x53cba5[_0x8f1e('0x43')],_0x946d[_0x8f1e('0x44')]),_0x4511c2);var _0x5bc134=[];var _0x560bd6=squel[_0x8f1e('0x4f')]()[_0x8f1e('0x50')]('id')[_0x8f1e('0x50')](_0x8f1e('0x38'))['field'](_0x8f1e('0x51'))['from'](_0x8f1e('0x52'));var _0x8f20a2=squel[_0x8f1e('0x4f')]()['field']('u.id')[_0x8f1e('0x50')](_0x8f1e('0x53'))[_0x8f1e('0x50')](_0x8f1e('0x54'))[_0x8f1e('0x55')](_0x8f1e('0x56'),'ui')[_0x8f1e('0x57')](_0x8f1e('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x41cdbe=squel[_0x8f1e('0x4f')]()['from'](_0x8f1e('0x59'),'i')[_0x8f1e('0x57')](_0x8f1e('0x5a'),'c',_0x8f1e('0x5b'))[_0x8f1e('0x57')]('users','o',_0x8f1e('0x5c'))[_0x8f1e('0x57')](_0x8f1e('0x5d'),'a',_0x8f1e('0x5e'))[_0x8f1e('0x57')](_0x8f1e('0x5f'),'me',_0x8f1e('0x60'))['left_join'](_0x8f1e('0x61'),'it',_0x8f1e('0x62'))[_0x8f1e('0x57')](_0x8f1e('0x52'),'t',_0x8f1e('0x63'));var _0x2b19d8=squel[_0x8f1e('0x64')]();var _0x2d532f=[];var _0x10f634=squel['expr']();var _0x10bf21;if(_0x53cba5['query']['search']){_0x10bf21=as[_0x8f1e('0x65')](_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x66')]);var _0x213f02=_0x10bf21['sqlOperator'];for(var _0x7fd61b=0x0;_0x7fd61b<_0x10bf21[_0x8f1e('0x67')][_0x8f1e('0x49')];_0x7fd61b++){var _0x232660=_0x10bf21[_0x8f1e('0x67')][_0x7fd61b];var _0x507ad4='i';var _0x5915f7=_['find'](_0x4511c2,[_0x8f1e('0x38'),_0x232660[_0x8f1e('0x50')]]);if(!_0x5915f7){switch(_0x232660[_0x8f1e('0x50')]){case _0x8f1e('0x68'):if(_0x232660[_0x8f1e('0x69')]==0x1){_0x41cdbe[_0x8f1e('0x6a')]('`'+_0x232660[_0x8f1e('0x50')]+_0x8f1e('0x6b'));}else{_0x41cdbe[_0x8f1e('0x6a')]('`'+_0x232660[_0x8f1e('0x50')]+'`\x20>\x200');}break;case _0x8f1e('0x6c'):if(_0x232660['operator']===_0x8f1e('0x6d')){if(_0x232660[_0x8f1e('0x69')][_0x8f1e('0x3c')]('\x20')[_0x8f1e('0x49')]>0x1){_0x2b19d8[_0x213f02](_0x8f1e('0x6e'),qs[_0x8f1e('0x6f')](_0x232660[_0x8f1e('0x69')]),null);}else{var _0x491b9b='%'+_0x232660[_0x8f1e('0x69')]+'%';_0x2b19d8[_0x213f02]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x491b9b,_0x491b9b,_0x491b9b);}}else{_0x5915f7=_[_0x8f1e('0x70')](_0x4511c2,[_0x8f1e('0x38'),_0x8f1e('0x71')]);_0x232660[_0x8f1e('0x50')]=_0x8f1e('0x71');_0x265e2c=as[_0x8f1e('0x72')](_0x507ad4,_0x5915f7['type'],_0x232660);_0x2b19d8[_0x213f02](_0x265e2c[_0x8f1e('0x73')],_0x265e2c['value'][_0x8f1e('0x74')],_0x265e2c[_0x8f1e('0x69')][_0x8f1e('0x2c')]);}break;case'Tag':var _0x339ea0=_0x232660['value'][_0x8f1e('0x3c')](',')[_0x8f1e('0x39')](function(_0x133085){return Number(_0x133085);});_0x339ea0[_0x8f1e('0x3d')](function(_0x1cb0be){_0x10f634['or'](_0x8f1e('0x75'),'%,'+_0x1cb0be+',%');});_0x2d532f=_[_0x8f1e('0x76')](_0x2d532f,_0x339ea0);break;case _0x8f1e('0x77'):if(_0x232660[_0x8f1e('0x78')]===_0x8f1e('0x6d')){_0x2b19d8[_0x213f02](_0x8f1e('0x79'),'%'+_0x232660[_0x8f1e('0x69')]+'%',null);}else{_0x5915f7=_[_0x8f1e('0x70')](_0x4511c2,[_0x8f1e('0x38'),_0x8f1e('0x7a')]);_0x232660[_0x8f1e('0x50')]=_0x8f1e('0x7a');_0x265e2c=as['buildExpression'](_0x507ad4,_0x5915f7[_0x8f1e('0x42')],_0x232660);_0x2b19d8[_0x213f02](_0x265e2c[_0x8f1e('0x73')],_0x265e2c['value'][_0x8f1e('0x74')],_0x265e2c[_0x8f1e('0x69')][_0x8f1e('0x2c')]);}break;case _0x8f1e('0x7b'):_0x265e2c=as[_0x8f1e('0x72')]('me',null,_0x232660);_0x2b19d8[_0x213f02](_0x265e2c[_0x8f1e('0x73')],_0x265e2c['value'][_0x8f1e('0x74')],_0x265e2c[_0x8f1e('0x69')][_0x8f1e('0x2c')]);break;}}else{var _0x265e2c=as[_0x8f1e('0x72')](_0x507ad4,_0x5915f7[_0x8f1e('0x42')],_0x232660);_0x2b19d8[_0x213f02](_0x265e2c[_0x8f1e('0x73')],_0x265e2c[_0x8f1e('0x69')][_0x8f1e('0x74')],_0x265e2c[_0x8f1e('0x69')][_0x8f1e('0x2c')]);}}}else{var _0x308ab4=_(_0x53cba5['query'])[_0x8f1e('0x7c')]()[_0x8f1e('0x39')](function(_0xf5f928){return _['some'](_0x4511c2,[_0x8f1e('0x38'),_0xf5f928])?_0xf5f928:undefined;})[_0x8f1e('0x7d')]()[_0x8f1e('0x69')]();if(!_['isEmpty'](_0x308ab4)){_0x308ab4['forEach'](function(_0x319144){if(_0x319144===_0x8f1e('0x7e')){_0x41cdbe[_0x8f1e('0x4d')](_0x8f1e('0x7f'),[][_0x8f1e('0x80')](_0x53cba5['query'][_0x319144]));}else if(_0x319144===_0x8f1e('0x81')){var _0x2a5d8e=JSON['parse'](_0x53cba5[_0x8f1e('0x43')][_0x319144])[_0x8f1e('0x82')];var _0x3d20b4=JSON[_0x8f1e('0x83')](_0x53cba5[_0x8f1e('0x43')][_0x319144])[_0x8f1e('0x84')];_0x41cdbe['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a5d8e,_0x3d20b4);}else{if(_0x53cba5[_0x8f1e('0x43')][_0x319144]===_0x8f1e('0x85')){_0x41cdbe[_0x8f1e('0x4d')]('i.'+_0x319144+_0x8f1e('0x86'));}else{_0x41cdbe['where']('i.'+_0x319144+_0x8f1e('0x87'),_0x53cba5['query'][_0x319144]);}}});}if(_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x88')]){if(_0x53cba5[_0x8f1e('0x43')]['read']==0x1){_0x41cdbe[_0x8f1e('0x6a')](_0x8f1e('0x89'));}else{_0x41cdbe[_0x8f1e('0x6a')]('`unreadMessages`\x20>\x200');}}if(_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x8a')]){_0x2d532f=_['isArray'](_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x8a')])?_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x8a')]:new Array(_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x8a')]);_0x2d532f[_0x8f1e('0x3d')](function(_0x52099e){_0x10f634['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x52099e+',%');});}if(_0x53cba5[_0x8f1e('0x43')]['filter']){var _0xbb4b93=_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x8b')][_0x8f1e('0x8c')]('\x5c','\x5c\x5c')[_0x8f1e('0x8c')](/'/g,'\x27\x27');if(qs[_0x8f1e('0x8d')](_0xbb4b93)){_0x2b19d8['or'](_0x8f1e('0x8e'),_0xbb4b93+'%');}else{_0x2b19d8['or'](_0x8f1e('0x8f'),qs[_0x8f1e('0x6f')](_0xbb4b93))['or'](_0x8f1e('0x90'),_0xbb4b93+'%');}}}_0x41cdbe['where'](_0x2b19d8);_0x41cdbe[_0x8f1e('0x91')]('i.id');var _0x3944de={'type':db[_0x8f1e('0x92')][_0x8f1e('0x93')]['SELECT'],'raw':!![]};var _0x3504df=_0x41cdbe[_0x8f1e('0x94')]();_0x3504df['field'](_0x8f1e('0x95'));_0x3504df['field'](_0x8f1e('0x96'),_0x8f1e('0x68'));if(_0x1320d6['order']){_0x1320d6['order']['forEach'](function(_0x2c49dd){var _0x191e91=_0x2c49dd[0x0]===_0x8f1e('0x97')?_0x2c49dd[0x0]:'i.'+_0x2c49dd[0x0];_0x41cdbe['order'](_0x191e91,_0x2c49dd[0x1]===_0x8f1e('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x2d532f)){_0x41cdbe[_0x8f1e('0x6a')](_0x10f634);_0x3504df['where'](_0x8f1e('0x99'),_0x2d532f);}BPromise[_0x8f1e('0x9a')]()[_0x8f1e('0x35')](function(){if(!_0x10bf21){if(_0x53cba5['query'][_0x8f1e('0x7e')])return;_0x3504df[_0x8f1e('0x4d')](_0x8f1e('0x9b'));_0x41cdbe[_0x8f1e('0x4d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x53cba5['user'][_0x8f1e('0x9c')]!==_0x8f1e('0x9d'))return;return _0x53cba5[_0x8f1e('0x9e')][_0x8f1e('0x9f')]({'attributes':['id'],'raw':!![]})[_0x8f1e('0x35')](function(_0x43ed8d){if(_[_0x8f1e('0xa0')](_0x43ed8d)){_0x3504df['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x41cdbe[_0x8f1e('0x4d')](_0x8f1e('0xa1'));}else{_0x3504df['where'](_0x8f1e('0x7f'),_[_0x8f1e('0x39')](_0x43ed8d,'id'));_0x41cdbe[_0x8f1e('0x4d')](_0x8f1e('0x7f'),_[_0x8f1e('0x39')](_0x43ed8d,'id'));}});})[_0x8f1e('0x35')](function(){if(_0x53cba5[_0x8f1e('0x9e')]['role']==='agent'&&!_0x10bf21&&!_0x53cba5[_0x8f1e('0x43')][_0x8f1e('0x7e')])return[];return db[_0x8f1e('0xa2')]['query'](_0x3504df['toString'](),_0x3944de);})[_0x8f1e('0x35')](function(_0x436e7e){_0x59cf54[_0x8f1e('0x2e')]=_0x436e7e[_0x8f1e('0x49')];if(_0x59cf54[_0x8f1e('0x2e')]===0x0)return[];return db['sequelize'][_0x8f1e('0x43')](_0x560bd6[_0x8f1e('0xa3')](),_0x3944de)[_0x8f1e('0x35')](function(_0x30ea44){_0x5bc134=_[_0x8f1e('0xa4')](_0x30ea44,'id');_0x3944de=_[_0x8f1e('0xa5')](_0x3944de,{'model':db[_0x8f1e('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53cba5[_0x8f1e('0x43')]['fields']){_0x1320d6[_0x8f1e('0x46')]['forEach'](function(_0x2075aa){_0x41cdbe['field']('i.'+_0x2075aa);});}else{_0x41cdbe[_0x8f1e('0x50')](_0x8f1e('0x96'),_0x8f1e('0x68'));_0x41cdbe['field'](_0x8f1e('0xa6'),_0x8f1e('0xa7'));_0x41cdbe[_0x8f1e('0x50')](_0x8f1e('0xa8'),_0x8f1e('0xa9'));_0x41cdbe[_0x8f1e('0x50')](_0x8f1e('0xaa'),_0x8f1e('0x97'));_0x41cdbe['field'](_0x8f1e('0xab'));_0x41cdbe['field'](_0x8f1e('0xac'),'Contact.firstName');_0x41cdbe[_0x8f1e('0x50')]('c.lastName',_0x8f1e('0xad'));_0x41cdbe[_0x8f1e('0x50')]('c.email','Contact.email');_0x41cdbe['field'](_0x8f1e('0xae'),_0x8f1e('0xaf'));_0x41cdbe[_0x8f1e('0x50')](_0x8f1e('0xb0'),_0x8f1e('0xb1'));_0x41cdbe[_0x8f1e('0x50')]('c.fax',_0x8f1e('0xb2'));_0x41cdbe['field'](_0x8f1e('0xb3'),_0x8f1e('0xb4'));_0x41cdbe[_0x8f1e('0x50')](_0x8f1e('0xb5'),_0x8f1e('0xb6'));_0x41cdbe[_0x8f1e('0x50')](_0x8f1e('0xb7'),_0x8f1e('0x3a'));}if(_0x1320d6[_0x8f1e('0x30')])_0x41cdbe[_0x8f1e('0x30')](_0x1320d6[_0x8f1e('0x30')]);if(_0x1320d6[_0x8f1e('0x2f')])_0x41cdbe['offset'](_0x1320d6[_0x8f1e('0x2f')]);return db[_0x8f1e('0xa2')][_0x8f1e('0x43')](_0x41cdbe[_0x8f1e('0xa3')](),_0x3944de);})['then'](function(_0xb1f9ec){_0x8f20a2[_0x8f1e('0x4d')]('ui.ChatInteractionId\x20IN\x20?',_[_0x8f1e('0x39')](_0xb1f9ec,'id'));return db[_0x8f1e('0xa2')][_0x8f1e('0x43')](_0x8f20a2[_0x8f1e('0xa3')](),_0x3944de)['then'](function(_0x3b566c){var _0x4af090=_[_0x8f1e('0xb8')](_0x3b566c,_0x8f1e('0xb9'));var _0x10e23a=[];_0xb1f9ec['forEach'](function(_0x3fec68){_0x10e23a['push'](updateChatInteraction(_0x3fec68,_0x5bc134,_0x4af090));});return BPromise[_0x8f1e('0xba')](_0x10e23a);});});})[_0x8f1e('0x35')](function(_0x4fd5a7){_0x59cf54[_0x8f1e('0xbb')]=_0x4fd5a7;return _0x59cf54;})[_0x8f1e('0x35')](respondWithFilteredResult(_0x401084,_0x1320d6))['catch'](handleError(_0x401084,null));};exports[_0x8f1e('0xbc')]=function(_0x39c614,_0xb7753b){var _0x3ad360={'raw':![],'where':{'id':_0x39c614[_0x8f1e('0xbd')]['id']}},_0x595213={};_0x595213[_0x8f1e('0x47')]=_[_0x8f1e('0x7c')](db[_0x8f1e('0x3f')][_0x8f1e('0x40')]);_0x595213['query']=_['keys'](_0x39c614[_0x8f1e('0x43')]);_0x595213[_0x8f1e('0x44')]=_[_0x8f1e('0x45')](_0x595213[_0x8f1e('0x47')],_0x595213[_0x8f1e('0x43')]);_0x3ad360[_0x8f1e('0x46')]=_[_0x8f1e('0x45')](_0x595213['model'],qs[_0x8f1e('0x48')](_0x39c614[_0x8f1e('0x43')][_0x8f1e('0x48')]));_0x3ad360[_0x8f1e('0x46')]=_0x3ad360[_0x8f1e('0x46')][_0x8f1e('0x49')]?_0x3ad360[_0x8f1e('0x46')]:_0x595213[_0x8f1e('0x47')];if(_0x39c614[_0x8f1e('0x43')][_0x8f1e('0xbe')]){_0x3ad360['include']=[{'all':!![]}];}_0x3ad360=_[_0x8f1e('0xa5')]({},_0x3ad360,_0x39c614[_0x8f1e('0xbf')]);return db['ChatInteraction']['find'](_0x3ad360)[_0x8f1e('0x35')](handleEntityNotFound(_0xb7753b,null))[_0x8f1e('0x35')](respondWithResult(_0xb7753b,null))['catch'](handleError(_0xb7753b,null));};exports[_0x8f1e('0xc0')]=function(_0x351b54,_0x5a1b15){return db[_0x8f1e('0x3f')][_0x8f1e('0xc0')](_0x351b54['body'],{})[_0x8f1e('0x35')](respondWithResult(_0x5a1b15,0xc9))[_0x8f1e('0x29')](handleError(_0x5a1b15,null));};exports[_0x8f1e('0x34')]=function(_0x5654cf,_0x455016){if(_0x5654cf['body']['id']){delete _0x5654cf[_0x8f1e('0x7b')]['id'];}return db[_0x8f1e('0x3f')][_0x8f1e('0x70')]({'where':{'id':_0x5654cf[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0x455016,null))[_0x8f1e('0x35')](saveUpdates(_0x5654cf[_0x8f1e('0x7b')],null))['then'](respondWithResult(_0x455016,null))[_0x8f1e('0x29')](handleError(_0x455016,null));};exports[_0x8f1e('0x36')]=function(_0x28daec,_0x422fa1){return db[_0x8f1e('0x3f')]['find']({'where':{'id':_0x28daec[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0x422fa1,null))['then'](removeEntity(_0x422fa1,null))[_0x8f1e('0x29')](handleError(_0x422fa1,null));};exports['describe']=function(_0x36e913,_0x3db07d){return db[_0x8f1e('0x3f')]['describe']()[_0x8f1e('0x35')](respondWithResult(_0x3db07d,null))['catch'](handleError(_0x3db07d,null));};exports[_0x8f1e('0xc1')]=function(_0x50173f,_0xac03f6){var _0x279e72=_0x50173f[_0x8f1e('0xbd')]['id'];var _0x4a153c;var _0x26458b;var _0x2902ae;return db['ChatInteraction'][_0x8f1e('0xc2')]({'where':{'id':_0x279e72}})['then'](function(_0x6ae236){_0x4a153c=_0x6ae236;return db[_0x8f1e('0xc3')][_0x8f1e('0xc2')]({'where':{'id':_0x6ae236[_0x8f1e('0x7e')]},'attributes':['id',_0x8f1e('0xc4'),_0x8f1e('0xc5')],'raw':!![]});})[_0x8f1e('0x35')](function(_0x3afdec){if(_0x3afdec&&_0x3afdec[_0x8f1e('0xc4')]&&_0x3afdec['vidaooEscalation']){_0x26458b=_0x3afdec;var _0x4637d2={'rejectUnauthorized':![],'method':_0x8f1e('0xc6'),'uri':_0x8f1e('0xc7'),'headers':{'X-APIKEY':_0x3afdec['vidaooApiKey']},'body':{'name':'MotionCWB:'+_0x279e72},'redirect':'follow','json':!![]};return rp(_0x4637d2);}else{throw new db[(_0x8f1e('0x92'))][(_0x8f1e('0xc8'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8f1e('0x35')](function(_0x3da12a){_0x2902ae=_0x3da12a;if(_0x2902ae['id']){var _0x302c09={'body':_0x2902ae['join_url'],'ChatWebsiteId':_0x26458b['id'],'ChatInteractionId':_0x4a153c['id'],'direction':'out','UserId':_0x50173f['user']['id']};return db[_0x8f1e('0xc9')][_0x8f1e('0xc0')](_0x302c09,{});}else{throw new db['Sequelize']['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x8f1e('0x35')](function(){return _0x4a153c[_0x8f1e('0xca')]({'vidaooSessionId':_0x2902ae['id']});})[_0x8f1e('0x35')](respondWithResult(_0xac03f6,null))[_0x8f1e('0x29')](handleError(_0xac03f6,null));};exports['customUpdate']=function(_0x1baf3d,_0x5765dd){if(_0x1baf3d[_0x8f1e('0x7b')]['id']){delete _0x1baf3d['body']['id'];}return db['ChatInteraction'][_0x8f1e('0x70')]({'where':{'id':_0x1baf3d[_0x8f1e('0xbd')]['id']}})['then'](handleEntityNotFound(_0x5765dd,null))[_0x8f1e('0x35')](saveUpdates(_0x1baf3d[_0x8f1e('0x7b')],null))[_0x8f1e('0x35')](respondWithResult(_0x5765dd,null))[_0x8f1e('0x29')](handleError(_0x5765dd,null));};exports[_0x8f1e('0xcb')]=function(_0x3e45ad,_0x8433e1,_0x23a00d){if(_0x3e45ad[_0x8f1e('0x7b')]['id']){delete _0x3e45ad['body']['id'];}return db[_0x8f1e('0x3f')][_0x8f1e('0x70')]({'where':{'id':_0x3e45ad['params']['id']}})[_0x8f1e('0x35')](function(_0x14f954){if(!_0x14f954){logger[_0x8f1e('0x25')](_0x8f1e('0xcc'),_0x8f1e('0xcb'),0x194,_0x8f1e('0xcd'));_0x8433e1[_0x8f1e('0x2a')](0x194);}else{if(_0x14f954[_0x8f1e('0x7a')]){throw new db[(_0x8f1e('0x92'))][(_0x8f1e('0xc8'))](_0x8f1e('0xce'));}}return _0x14f954;})[_0x8f1e('0x35')](function(_0x2987da){if(_0x2987da){return _0x2987da[_0x8f1e('0x34')]({'closed':_0x3e45ad['body'][_0x8f1e('0xcf')],'disposition':_0x3e45ad[_0x8f1e('0x7b')][_0x8f1e('0xd0')]})[_0x8f1e('0x35')](function(_0x37e4e1){return _0x37e4e1;});}})[_0x8f1e('0x35')](function(_0x2cf83a){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3e45ad[_0x8f1e('0x7b')],client9004);})['then'](respondWithResult(_0x8433e1,null))[_0x8f1e('0x29')](handleError(_0x8433e1,null));};exports[_0x8f1e('0xd1')]=function(_0x5ccaa5,_0x2e3eda,_0x382313){_0x5ccaa5[_0x8f1e('0x7b')][_0x8f1e('0x38')]=_0x5ccaa5[_0x8f1e('0xd2')]['originalname'];_0x5ccaa5[_0x8f1e('0x7b')][_0x8f1e('0xd3')]=_0x5ccaa5[_0x8f1e('0xd2')][_0x8f1e('0xd4')];_0x5ccaa5[_0x8f1e('0x7b')][_0x8f1e('0x42')]=_0x5ccaa5['file'][_0x8f1e('0xd5')];return db[_0x8f1e('0xd6')][_0x8f1e('0xc0')](_0x5ccaa5[_0x8f1e('0x7b')])[_0x8f1e('0x35')](respondWithResult(_0x2e3eda,0xc9))[_0x8f1e('0x29')](handleError(_0x2e3eda,null));};exports[_0x8f1e('0xd7')]=function(_0x52f21c,_0x2858f4,_0x2f47e4){return db['ChatInteraction'][_0x8f1e('0xc2')]({'where':{'id':_0x52f21c[_0x8f1e('0xbd')]['id']},'raw':!![]})[_0x8f1e('0x35')](handleEntityNotFound(_0x2858f4,null))['then'](function(_0x28e418){if(_0x28e418){if(_0x28e418['closed']){return _0x2858f4[_0x8f1e('0x2b')](0x193)[_0x8f1e('0x2d')]({'status':0x193,'message':_0x8f1e('0xd8')});}return db[_0x8f1e('0xd6')][_0x8f1e('0xc2')]({'where':{'id':_0x52f21c['query'][_0x8f1e('0xd9')]},'raw':!![]})['then'](handleEntityNotFound(_0x2858f4,null));}})['then'](function(_0x5e41d8){if(_0x5e41d8){return _0x2858f4[_0x8f1e('0xda')](path[_0x8f1e('0xdb')](config[_0x8f1e('0xdc')],_0x8f1e('0xdd'),_0x5e41d8[_0x8f1e('0xd3')]));}})['catch'](handleError(_0x2858f4,null));};exports['close']=function(_0x1be7e9,_0x3e759c){var _0x503be4=null;var _0xc5d551=null;var _0x1288f8=null;var _0x454852=null;if(_0x1be7e9[_0x8f1e('0x7b')]['id']){delete _0x1be7e9[_0x8f1e('0x7b')]['id'];}if(_0x1be7e9[_0x8f1e('0x7b')][_0x8f1e('0xde')]){_0x454852=path['join'](config[_0x8f1e('0xdc')],_0x8f1e('0xdf'),util[_0x8f1e('0xe0')](_0x8f1e('0xe1'),Date[_0x8f1e('0xe2')]()));_0x1be7e9[_0x8f1e('0x7b')][_0x8f1e('0xe3')]=_0x454852;}return db['ChatInteraction'][_0x8f1e('0x70')]({'where':{'id':_0x1be7e9[_0x8f1e('0xbd')]['id']},'include':[{'model':db[_0x8f1e('0xc9')],'as':_0x8f1e('0xe4'),'include':[{'model':db['User'],'as':_0x8f1e('0x77')}]}]})[_0x8f1e('0x35')](handleEntityNotFound(_0x3e759c,null))['then'](saveUpdates(_0x1be7e9[_0x8f1e('0x7b')],null))[_0x8f1e('0x35')](function(_0xef35ea){if(_0xef35ea){_0x503be4=_0xef35ea;return db['ChatWebsite'][_0x8f1e('0x70')]({'where':{'id':_0x503be4[_0x8f1e('0x7e')]}});}})[_0x8f1e('0x35')](function(_0x70b47c){if(_0x70b47c){_0x1288f8=_0x70b47c;return db['CmContact'][_0x8f1e('0x70')]({'where':{'id':_0x503be4[_0x8f1e('0x71')]}});}})[_0x8f1e('0x35')](function(_0x45eb69){if(_0x45eb69){_0xc5d551=_0x45eb69;if(_0x454852){var _0x5ebc5c=null;for(var _0x36c035=0x1;_0x36c035<_0x503be4[_0x8f1e('0xe4')][_0x8f1e('0x49')];++_0x36c035){_0x5ebc5c=_0x503be4[_0x8f1e('0xe4')][_0x36c035];var _0x393b27=_0x5ebc5c['UserId']?util[_0x8f1e('0xe0')](_0x8f1e('0xe5'),_0x1288f8['agentAlias'],_0x5ebc5c[_0x8f1e('0x7a')]):_0x8f1e('0xe6');var _0x4fae2f=_0x1be7e9['body'][_0x8f1e('0xe7')]||util[_0x8f1e('0xe0')]('%s%d',_0x8f1e('0xe8'),_0x5ebc5c['ContactId']);switch(_0x1288f8[_0x8f1e('0xe9')]){case _0x8f1e('0xea'):_0x393b27=_0x5ebc5c[_0x8f1e('0x7a')]?util[_0x8f1e('0xe0')](_0x8f1e('0xe5'),_0x1288f8[_0x8f1e('0xeb')],_0x5ebc5c['UserId']):_0x8f1e('0xe6');break;case _0x8f1e('0xec'):_0x393b27=_0x5ebc5c['UserId']?_0x5ebc5c[_0x8f1e('0x77')][_0x8f1e('0xed')]||_0x5ebc5c[_0x8f1e('0x77')][_0x8f1e('0xee')]:_0x8f1e('0xe6');break;case'agent_fullname':_0x393b27=_0x5ebc5c[_0x8f1e('0x7a')]?_0x5ebc5c[_0x8f1e('0x77')][_0x8f1e('0xee')]:_0x8f1e('0xe6');break;default:_0x393b27=_0x5ebc5c[_0x8f1e('0x7a')]?util[_0x8f1e('0xe0')](_0x8f1e('0xe5'),_0x1288f8[_0x8f1e('0xeb')],_0x5ebc5c[_0x8f1e('0x7a')]):_0x8f1e('0xe6');}var _0xab3f79=util['format'](_0x8f1e('0xef'),moment(_0x5ebc5c[_0x8f1e('0x81')])['format'](_0x8f1e('0xf0')),_0x5ebc5c[_0x8f1e('0xf1')]==='in'?_0x4fae2f:_0x393b27,_0x5ebc5c[_0x8f1e('0x7b')]);if(!_0x5ebc5c['secret']){fs[_0x8f1e('0xf2')](_0x454852,_0xab3f79);}}return db['MailAccount'][_0x8f1e('0xc2')]({'where':{'service':!![]},'include':[{'model':db[_0x8f1e('0xf3')],'as':'Smtp','raw':!![]}]});}}})[_0x8f1e('0x35')](function(_0x5b7bc1){if(_0x5b7bc1&&_0x5b7bc1[_0x8f1e('0xf4')]&&_0x1be7e9[_0x8f1e('0x7b')]){var _0xaa0743={'tls':{'rejectUnauthorized':![]}};if(_0x5b7bc1[_0x8f1e('0xf4')]['service']){_0xaa0743[_0x8f1e('0xf5')]=_0x5b7bc1['Smtp'][_0x8f1e('0xf5')];}else{_0xaa0743[_0x8f1e('0xf6')]=_0x5b7bc1[_0x8f1e('0xf4')][_0x8f1e('0xf6')];_0xaa0743[_0x8f1e('0xf7')]=_0x5b7bc1['Smtp'][_0x8f1e('0xf7')];_0xaa0743[_0x8f1e('0xf8')]=_0x5b7bc1[_0x8f1e('0xf4')][_0x8f1e('0xf8')];}if(_0x5b7bc1[_0x8f1e('0xf4')]['authentication']){_0xaa0743[_0x8f1e('0xf9')]={'user':_0x5b7bc1[_0x8f1e('0xf4')][_0x8f1e('0x9e')],'pass':_0x5b7bc1[_0x8f1e('0xf4')]['pass']};}return respondWithRpcPromise('SendMail',_0x8f1e('0xfa'),{'account':_0xaa0743,'message':{'from':util['format'](_0x8f1e('0xfb'),_0x5b7bc1[_0x8f1e('0x38')],_0x5b7bc1[_0x8f1e('0xfc')]||_0x5b7bc1['Smtp'][_0x8f1e('0x9e')]),'to':_0x1be7e9['body'][_0x8f1e('0xde')],'subject':_0x8f1e('0xfd'),'text':util[_0x8f1e('0xe0')](_0x8f1e('0xfe'),_0x1be7e9['body'][_0x8f1e('0xde')]),'attachments':[{'path':_0x454852}]}})[_0x8f1e('0x35')](function(){return _0x503be4;})[_0x8f1e('0x29')](function(_0xf1764){console[_0x8f1e('0x25')](_0xf1764);});}else{return _0x503be4;}})[_0x8f1e('0x35')](respondWithStatusCode(_0x3e759c,0xc8))[_0x8f1e('0x29')](handleError(_0x3e759c,null));};exports[_0x8f1e('0xff')]=function(_0x3c69c4,_0x348b70,_0x429671){return db[_0x8f1e('0xc9')]['find']({'where':{'id':_0x3c69c4[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0x348b70,null))[_0x8f1e('0x35')](function(_0x399c55){if(_0x399c55){return _0x399c55[_0x8f1e('0xff')](_0x3c69c4[_0x8f1e('0x7b')]['ids'],_[_0x8f1e('0x100')](_0x3c69c4[_0x8f1e('0x7b')],[_0x8f1e('0x101'),'id'])||{});}})[_0x8f1e('0x35')](respondWithResult(_0x348b70,null))[_0x8f1e('0x29')](handleError(_0x348b70,null));};exports['getMessages']=function(_0x3ddfc2,_0x16856f,_0x22cc22){var _0x440e18={'raw':![],'where':{}};var _0x12c488={};var _0x2df383={'count':0x0,'rows':[]};return db[_0x8f1e('0x3f')]['findOne']({'where':{'id':_0x3ddfc2[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0x16856f,null))[_0x8f1e('0x35')](function(_0x95ac61){if(_0x95ac61){_0x12c488['model']=_[_0x8f1e('0x7c')](db[_0x8f1e('0xc9')][_0x8f1e('0x40')]);_0x12c488['query']=_['keys'](_0x3ddfc2[_0x8f1e('0x43')]);_0x12c488[_0x8f1e('0x44')]=_[_0x8f1e('0x45')](_0x12c488['model'],_0x12c488[_0x8f1e('0x43')]);_0x440e18[_0x8f1e('0x46')]=_[_0x8f1e('0x45')](_0x12c488[_0x8f1e('0x47')],qs[_0x8f1e('0x48')](_0x3ddfc2[_0x8f1e('0x43')][_0x8f1e('0x48')]));_0x440e18[_0x8f1e('0x46')]=_0x440e18[_0x8f1e('0x46')][_0x8f1e('0x49')]?_0x440e18['attributes']:_0x12c488['model'];if(!_0x3ddfc2['query']['hasOwnProperty'](_0x8f1e('0x102'))){_0x440e18['limit']=qs['limit'](_0x3ddfc2['query'][_0x8f1e('0x30')]);_0x440e18[_0x8f1e('0x2f')]=qs[_0x8f1e('0x2f')](_0x3ddfc2[_0x8f1e('0x43')][_0x8f1e('0x2f')]);}_0x440e18['order']=qs[_0x8f1e('0x4c')](_0x3ddfc2[_0x8f1e('0x43')][_0x8f1e('0x4c')]);_0x440e18[_0x8f1e('0x4d')]=qs['filters'](_['pick'](_0x3ddfc2[_0x8f1e('0x43')],_0x12c488[_0x8f1e('0x44')]));_0x440e18[_0x8f1e('0x4d')][_0x8f1e('0xb9')]=_0x95ac61['id'];if(_0x3ddfc2[_0x8f1e('0x43')][_0x8f1e('0x8b')]){_0x440e18[_0x8f1e('0x4d')]=_[_0x8f1e('0xa5')](_0x440e18[_0x8f1e('0x4d')],{'$or':_[_0x8f1e('0x39')](_0x440e18[_0x8f1e('0x46')],function(_0xa5c658){var _0x4fd099={};_0x4fd099[_0xa5c658]={'$like':'%'+_0x3ddfc2[_0x8f1e('0x43')][_0x8f1e('0x8b')]+'%'};return _0x4fd099;})});}if(_0x3ddfc2[_0x8f1e('0x43')][_0x8f1e('0x82')]){var _0x23c8f7=_0x3ddfc2['query']['$gte'][_0x8f1e('0x3c')](',');var _0x4d40b0={};_0x4d40b0[_0x23c8f7[0x0]]={'$gte':moment(_0x23c8f7[0x1])[_0x8f1e('0xe0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x440e18['where']=_[_0x8f1e('0xa5')](_0x440e18[_0x8f1e('0x4d')],_0x4d40b0);}_0x440e18=_[_0x8f1e('0xa5')]({},_0x440e18,_0x3ddfc2[_0x8f1e('0xbf')]);return db[_0x8f1e('0xc9')][_0x8f1e('0x2e')]({'where':_0x440e18['where']})[_0x8f1e('0x35')](function(_0x8fd866){_0x2df383[_0x8f1e('0x2e')]=_0x8fd866;if(_0x3ddfc2['query']['includeAll']){_0x440e18[_0x8f1e('0x103')]=[{'all':!![]}];}return db['ChatMessage'][_0x8f1e('0x104')](_0x440e18);})[_0x8f1e('0x35')](function(_0x1433ab){_0x2df383[_0x8f1e('0xbb')]=_0x1433ab;return _0x2df383;});}})[_0x8f1e('0x35')](respondWithFilteredResult(_0x16856f,_0x440e18))['catch'](handleError(_0x16856f,null));};exports[_0x8f1e('0x105')]=function(_0x313d5f,_0xbf650f,_0x395161){var _0x338fad={'where':{}},_0x5a6fca={},_0x5dd27e={'count':0x0,'rows':[]};return db[_0x8f1e('0x3f')]['findOne']({'where':{'id':_0x313d5f[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0xbf650f,null))[_0x8f1e('0x35')](function(_0x16c8bd){if(_0x16c8bd){_0x5a6fca[_0x8f1e('0x47')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x5a6fca[_0x8f1e('0x43')]=_[_0x8f1e('0x7c')](_0x313d5f[_0x8f1e('0x43')]);_0x5a6fca[_0x8f1e('0x44')]=_['intersection'](_0x5a6fca['model'],_0x5a6fca['query']);_0x338fad[_0x8f1e('0x46')]=_[_0x8f1e('0x45')](_0x5a6fca[_0x8f1e('0x47')],qs[_0x8f1e('0x48')](_0x313d5f['query']['fields']));_0x338fad[_0x8f1e('0x46')]=_0x338fad[_0x8f1e('0x46')]['length']?_0x338fad['attributes']:_0x5a6fca[_0x8f1e('0x47')];if(!_0x313d5f['query']['hasOwnProperty']('nolimit')){_0x338fad[_0x8f1e('0x30')]=qs['limit'](_0x313d5f[_0x8f1e('0x43')][_0x8f1e('0x30')]);_0x338fad['offset']=qs[_0x8f1e('0x2f')](_0x313d5f[_0x8f1e('0x43')][_0x8f1e('0x2f')]);}_0x338fad[_0x8f1e('0x4b')]=qs[_0x8f1e('0x4c')](_0x313d5f['query'][_0x8f1e('0x4c')]);_0x338fad[_0x8f1e('0x4d')]=qs[_0x8f1e('0x44')](_[_0x8f1e('0x4e')](_0x313d5f['query'],_0x5a6fca['filters']));_0x338fad[_0x8f1e('0x4d')][_0x8f1e('0xb9')]=_0x16c8bd['id'];if(_0x313d5f[_0x8f1e('0x43')][_0x8f1e('0x8b')]){_0x338fad['where']=_[_0x8f1e('0xa5')](_0x338fad['where'],{'$or':_[_0x8f1e('0x39')](_0x338fad[_0x8f1e('0x46')],function(_0x2f5298){var _0x114956={};_0x114956[_0x2f5298]={'$like':'%'+_0x313d5f[_0x8f1e('0x43')][_0x8f1e('0x8b')]+'%'};return _0x114956;})});}_0x338fad[_0x8f1e('0x4d')][_0x8f1e('0x106')]=![];if(_0x313d5f['query']['id']){_0x338fad['where']['id']={'$gt':_0x313d5f['query']['id']};}_0x338fad=_[_0x8f1e('0xa5')]({},_0x338fad,_0x313d5f[_0x8f1e('0xbf')]);return db[_0x8f1e('0xc9')][_0x8f1e('0x2e')]({'where':_0x338fad[_0x8f1e('0x4d')]})[_0x8f1e('0x35')](function(_0x2abfee){_0x5dd27e[_0x8f1e('0x2e')]=_0x2abfee;_0x338fad[_0x8f1e('0x103')]=[];if(_0x313d5f[_0x8f1e('0x43')][_0x8f1e('0x107')]){_0x338fad[_0x8f1e('0x103')][_0x8f1e('0x3e')]({'model':db[_0x8f1e('0x77')],'as':_0x8f1e('0x77'),'attributes':['id',_0x8f1e('0xee'),'alias']});}if(_0x313d5f[_0x8f1e('0x43')][_0x8f1e('0xbe')]){_0x338fad[_0x8f1e('0x103')]=[{'all':!![]}];}return db['ChatMessage'][_0x8f1e('0x104')](_0x338fad);})[_0x8f1e('0x35')](function(_0x34e8bb){_0x5dd27e[_0x8f1e('0xbb')]=_0x34e8bb;return _0x5dd27e;});}})[_0x8f1e('0x35')](respondWithFilteredResult(_0xbf650f,_0x338fad))['catch'](handleError(_0xbf650f,null));};exports['addTags']=function(_0x488b5d,_0x31eedb,_0x2637d5){return db[_0x8f1e('0x3f')][_0x8f1e('0x70')]({'where':{'id':_0x488b5d[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0x31eedb,null))['then'](function(_0x298af9){if(_0x298af9){return _0x298af9[_0x8f1e('0x108')](_0x488b5d[_0x8f1e('0x7b')]['ids'],_[_0x8f1e('0x100')](_0x488b5d[_0x8f1e('0x7b')],['ids','id'])||{})[_0x8f1e('0x109')](function(){return db['Tag'][_0x8f1e('0x104')]({'attributes':['id',_0x8f1e('0x38'),'color'],'where':{'id':_0x488b5d[_0x8f1e('0x7b')][_0x8f1e('0x101')]}});})[_0x8f1e('0x35')](function(_0x3491e8){socket['emit'](_0x8f1e('0x10a'),{'id':Number(_0x488b5d['params']['id']),'tags':_0x3491e8||[]});return{'id':Number(_0x488b5d[_0x8f1e('0xbd')]['id']),'tags':_0x3491e8||[]};});}})['then'](respondWithResult(_0x31eedb,null))[_0x8f1e('0x29')](handleError(_0x31eedb,null));};exports[_0x8f1e('0x10b')]=function(_0x56fde5,_0x3dadcb,_0x2ff639){return db[_0x8f1e('0x3f')]['find']({'where':{'id':_0x56fde5[_0x8f1e('0xbd')]['id']}})[_0x8f1e('0x35')](handleEntityNotFound(_0x3dadcb,null))[_0x8f1e('0x35')](function(_0x697588){if(_0x697588){return _0x697588[_0x8f1e('0x10b')](_0x56fde5['query'][_0x8f1e('0x101')]);}})[_0x8f1e('0x35')](respondWithStatusCode(_0x3dadcb,null))[_0x8f1e('0x29')](handleError(_0x3dadcb,null));};exports[_0x8f1e('0xda')]=function(_0xa3aa1,_0x2d0124){var _0x423f1d=moment()[_0x8f1e('0x10c')]()[_0x8f1e('0xa3')]();var _0x2f5b76=path[_0x8f1e('0xdb')](config[_0x8f1e('0xdc')],_0x8f1e('0x10d'),_0x8f1e('0x10e'),_0x8f1e('0x10f'));var _0x50a2af=path['join'](config['root'],_0x8f1e('0x10d'),_0x8f1e('0x10e'),'attachments');var _0xf3aa87=path[_0x8f1e('0xdb')](_0x2f5b76,_0x423f1d);var _0x184de3=util[_0x8f1e('0xe0')]('transcript-%d-%s.zip',_0xa3aa1[_0x8f1e('0xbd')]['id'],_0x423f1d);var _0x37eaf0=path['join'](_0x2f5b76,_0x184de3);var _0x53d882=[];_0x53d882[_0x8f1e('0x3e')]({'model':db[_0x8f1e('0x77')],'as':_0x8f1e('0x77'),'attributes':['id',_0x8f1e('0xee')],'raw':!![]});_0x53d882['push']({'model':db['CmContact'],'as':_0x8f1e('0x6c'),'attributes':['id',_0x8f1e('0x110'),_0x8f1e('0x111')],'raw':!![]});if(_0xa3aa1[_0x8f1e('0x43')][_0x8f1e('0x112')]){_0x53d882[_0x8f1e('0x3e')]({'model':db[_0x8f1e('0xd6')],'as':_0x8f1e('0xd6'),'raw':!![]});}var _0x3a25c6=[{'model':db['ChatMessage'],'as':_0x8f1e('0xe4'),'attributes':['id',_0x8f1e('0x7b'),_0x8f1e('0x81'),_0x8f1e('0xf1'),_0x8f1e('0x106'),'read'],'include':_0x53d882}];_0x3a25c6[_0x8f1e('0x3e')]({'model':db[_0x8f1e('0xc3')],'as':_0x8f1e('0x113'),'attributes':['id','name']});_0x3a25c6[_0x8f1e('0x3e')]({'model':db[_0x8f1e('0x77')],'as':'Owner','attributes':['id',_0x8f1e('0xee')]});return db[_0x8f1e('0x3f')][_0x8f1e('0x70')]({'where':{'id':_0xa3aa1[_0x8f1e('0xbd')]['id']},'include':_0x3a25c6})['then'](handleEntityNotFound(_0x2d0124,null))[_0x8f1e('0x35')](function(_0x365ad2){if(_0x365ad2){var _0x422603=_0x365ad2['get']({'plain':!![]});fs['mkdirSync'](_0xf3aa87);var _0x2c2126={'format':'A4','border':_0x8f1e('0x114'),'header':{'height':'40px','contents':{'first':_0x8f1e('0x115')}},'footer':{'height':_0x8f1e('0x116'),'contents':{'default':util[_0x8f1e('0xe0')](_0x8f1e('0x117'),util[_0x8f1e('0xe0')](_0x8f1e('0x118'),_0x8f1e('0x119'),_0x422603['id']),moment()[_0x8f1e('0xe0')](_0x8f1e('0x11a'))[_0x8f1e('0xa3')]())}}};var _0x4fa446={'channel':_0x8f1e('0x119'),'account':_0x422603[_0x8f1e('0x113')]['name'],'agent':_0x422603['Owner']?_0x422603[_0x8f1e('0x11b')][_0x8f1e('0xee')]:'N.A.','createdAt':moment(_0x422603[_0x8f1e('0x81')])[_0x8f1e('0xe0')](_0x8f1e('0x11c'))[_0x8f1e('0xa3')](),'closedAt':_0x422603[_0x8f1e('0xcf')]?moment(_0x422603[_0x8f1e('0x11d')])[_0x8f1e('0xe0')](_0x8f1e('0x11c'))[_0x8f1e('0xa3')]():'','disposition':_0x422603[_0x8f1e('0xd0')],'chatInfo':{'browser':_0x422603['browserName'],'os':_0x422603[_0x8f1e('0x11e')],'referer':_0x422603['referer'],'customerIp':_0x422603[_0x8f1e('0x11f')],'customerPort':_0x422603[_0x8f1e('0x120')]?_0x422603[_0x8f1e('0x120')]:'N.A.'},'messages':_(_0x422603[_0x8f1e('0xe4')])[_0x8f1e('0x121')]()[_0x8f1e('0x8b')]({'secret':![]})[_0x8f1e('0x39')](function(_0x2fca15){if(_0x2fca15[_0x8f1e('0xd6')]){var _0x324ff9=path[_0x8f1e('0xdb')](_0x50a2af,_0x2fca15[_0x8f1e('0xd6')][_0x8f1e('0xd3')]);if(fs[_0x8f1e('0x122')](_0x324ff9)){fs[_0x8f1e('0x123')](_0x324ff9)[_0x8f1e('0x124')](fs[_0x8f1e('0x125')](path['join'](_0xf3aa87,_0x2fca15[_0x8f1e('0xd6')][_0x8f1e('0xd3')])));}}return{'date':moment(_0x2fca15[_0x8f1e('0x81')])[_0x8f1e('0xe0')](_0x8f1e('0x11c'))['toString'](),'sender':_0x2fca15[_0x8f1e('0xf1')]==='out'?_0x2fca15[_0x8f1e('0x77')]?_0x2fca15[_0x8f1e('0x77')][_0x8f1e('0xee')]:_0x8f1e('0xe6'):_0x2fca15[_0x8f1e('0x6c')][_0x8f1e('0x110')]+(_0x2fca15['Contact']['lastName']?'\x20'+_0x2fca15[_0x8f1e('0x6c')][_0x8f1e('0x111')]:''),'body':_0x2fca15[_0x8f1e('0xd6')]?_0x2fca15[_0x8f1e('0xd6')][_0x8f1e('0xd3')]:_0x2fca15['body'],'direction':_0x2fca15[_0x8f1e('0xf1')]==='out'?'A':'C','secret':_0x2fca15[_0x8f1e('0x106')],'read':_0x2fca15[_0x8f1e('0x88')],'attachment':_0x2fca15[_0x8f1e('0xd6')]};})[_0x8f1e('0x69')]()};return ejs[_0x8f1e('0x126')](path[_0x8f1e('0xdb')](config[_0x8f1e('0xdc')],'server',_0x8f1e('0x127'),'downloadInteraction.html'),{'interaction':_0x4fa446})[_0x8f1e('0x35')](function(_0x44dd40){return new BPromise(function(_0x40bf80,_0x197472){pdf[_0x8f1e('0xc0')](_0x44dd40,_0x2c2126)['toFile'](path[_0x8f1e('0xdb')](_0xf3aa87,'transcript-'+_0x422603['id']+'-'+_0x423f1d+'.pdf'),function(_0x5683cc,_0x5c5fc9){if(_0x5683cc)return _0x197472(_0x5683cc);_0x40bf80(_0x5c5fc9);});});})[_0x8f1e('0x35')](function(){return new BPromise(function(_0x34b9a1,_0x2dd753){zipdir(_0xf3aa87,{'saveTo':_0x37eaf0},function(_0x3370d2,_0x40eeec){if(_0x3370d2)return _0x2dd753(_0x3370d2);return _0x34b9a1(_0x40eeec);});})[_0x8f1e('0x35')](function(){return new BPromise(function(_0x457373,_0x431b15){rimraf(_0xf3aa87,function(_0x3f24e8){if(_0x3f24e8)_0x431b15(_0x3f24e8);return _0x457373();});});})[_0x8f1e('0x35')](function(){return _0x2d0124[_0x8f1e('0xda')](_0x37eaf0,_0x184de3,function(_0x1f4d83){if(_0x1f4d83){console[_0x8f1e('0x128')](_0x8f1e('0x129'),_0x1f4d83);}else{fs['unlinkSync'](_0x37eaf0);}});});});}else{return _0x2d0124[_0x8f1e('0x2a')](0xc8);}})[_0x8f1e('0x29')](handleError(_0x2d0124,null));}; \ No newline at end of file +var _0x5e77=['i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','SELECT','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','i.ChatWebsiteId\x20IS\x20NULL','user','toString','count','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','rawAttributes','includeAll','include','create','params','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','root','server/files/attachments/','close','join','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','addMessage','omit','ids','getMessages','nolimit','ChatInteractionId','options','findAll','getMyMessages','includeAgent','alias','addTags','setTags','emit','chatInteractionTags:save','removeTags','server','tmp','files','attachments','Contact','lastName','Account','Owner','get','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','direction','firstName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','ChatInteraction','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','ChatWebsiteId'];(function(_0x5c0809,_0x5c2154){var _0x174741=function(_0x535754){while(--_0x535754){_0x5c0809['push'](_0x5c0809['shift']());}};_0x174741(++_0x5c2154);}(_0x5e77,0xb0));var _0x75e7=function(_0x27bca8,_0x191f63){_0x27bca8=_0x27bca8-0x0;var _0x370163=_0x5e77[_0x27bca8];return _0x370163;};'use strict';var pdf=require(_0x75e7('0x0'));var emlformat=require(_0x75e7('0x1'));var rimraf=require(_0x75e7('0x2'));var zipdir=require(_0x75e7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75e7('0x4'));var moment=require(_0x75e7('0x5'));var BPromise=require(_0x75e7('0x6'));var Mustache=require(_0x75e7('0x7'));var util=require(_0x75e7('0x8'));var path=require('path');var sox=require(_0x75e7('0x9'));var csv=require(_0x75e7('0xa'));var ejs=require(_0x75e7('0xb'));var fs=require('fs');var _=require(_0x75e7('0xc'));var squel=require('squel');var crypto=require(_0x75e7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x75e7('0xe'));var toCsv=require(_0x75e7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75e7('0xf'));var authService=require(_0x75e7('0x10'));var qs=require(_0x75e7('0x11'));var as=require(_0x75e7('0x12'));var hardwareService=require(_0x75e7('0x13'));var logger=require('../../config/logger')(_0x75e7('0x14'));var utils=require(_0x75e7('0x15'));var config=require(_0x75e7('0x16'));var licenseUtil=require(_0x75e7('0x17'));var db=require(_0x75e7('0x18'))['db'];config['redis']=_[_0x75e7('0x19')](config[_0x75e7('0x1a')],{'host':_0x75e7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75e7('0x1a')]));require(_0x75e7('0x1c'))['register'](socket);var jayson=require(_0x75e7('0x1d'));var client=jayson[_0x75e7('0x1e')][_0x75e7('0x1f')]({'port':0x232b});var client9004=jayson[_0x75e7('0x1e')][_0x75e7('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x52ce04,_0x17b5b4,_0x34be84,_0x5c28cf){return new BPromise(function(_0x5d3c32,_0x523e1e){var _0x24c4f9=_0x5c28cf||client;return _0x24c4f9[_0x75e7('0x20')](_0x52ce04,_0x34be84)['then'](function(_0x1fc41a){logger[_0x75e7('0x21')](_0x75e7('0x22'),_0x17b5b4,_0x75e7('0x23'));logger['debug'](_0x75e7('0x24'),_0x17b5b4,_0x75e7('0x23'),JSON[_0x75e7('0x25')](_0x1fc41a));if(_0x1fc41a[_0x75e7('0x26')]){if(_0x1fc41a['error'][_0x75e7('0x27')]===0x1f4){logger[_0x75e7('0x26')](_0x75e7('0x22'),_0x17b5b4,_0x1fc41a[_0x75e7('0x26')][_0x75e7('0x28')]);return _0x523e1e(_0x1fc41a[_0x75e7('0x26')]['message']);}logger[_0x75e7('0x26')](_0x75e7('0x22'),_0x17b5b4,_0x1fc41a[_0x75e7('0x26')]['message']);return _0x5d3c32(_0x1fc41a[_0x75e7('0x26')][_0x75e7('0x28')]);}else{logger[_0x75e7('0x21')](_0x75e7('0x22'),_0x17b5b4,_0x75e7('0x23'));_0x5d3c32(_0x1fc41a[_0x75e7('0x29')]['message']);}})['catch'](function(_0x2b678e){logger[_0x75e7('0x26')](_0x75e7('0x22'),_0x17b5b4,_0x2b678e);_0x523e1e(_0x2b678e);});});}function respondWithStatusCode(_0x38f2f0,_0x286137){_0x286137=_0x286137||0xcc;return function(_0x4d68fd){if(_0x4d68fd){return _0x38f2f0[_0x75e7('0x2a')](_0x286137);}return _0x38f2f0[_0x75e7('0x2b')](_0x286137)['end']();};}function respondWithResult(_0x5d090d,_0x5d56){_0x5d56=_0x5d56||0xc8;return function(_0x7e1596){if(_0x7e1596){return _0x5d090d[_0x75e7('0x2b')](_0x5d56)['json'](_0x7e1596);}};}function respondWithFilteredResult(_0x5b8235,_0x7b2960){return function(_0xcd4deb){if(_0xcd4deb){var _0x100bee=_0xcd4deb['count'],_0x53f8d9=_0x7b2960[_0x75e7('0x2c')],_0x12f6d7=_0x7b2960[_0x75e7('0x2c')]+_0x7b2960[_0x75e7('0x2d')],_0x2e52dc;if(_0x12f6d7>=_0x100bee){_0x12f6d7=_0x100bee;_0x2e52dc=0xc8;}else{_0x2e52dc=0xce;}_0x5b8235['status'](_0x2e52dc);return _0x5b8235[_0x75e7('0x2e')](_0x75e7('0x2f'),_0x53f8d9+'-'+_0x12f6d7+'/'+_0x100bee)[_0x75e7('0x30')](_0xcd4deb);}return null;};}function patchUpdates(_0x3b2935){return function(_0x20fa01){try{jsonpatch[_0x75e7('0x31')](_0x20fa01,_0x3b2935,!![]);}catch(_0x4a0134){return BPromise[_0x75e7('0x32')](_0x4a0134);}return _0x20fa01[_0x75e7('0x33')]();};}function saveUpdates(_0x570f1e,_0x5b63ed){return function(_0x6a1e4d){if(_0x6a1e4d){return _0x6a1e4d[_0x75e7('0x34')](_0x570f1e)['then'](function(_0x3f6e1f){return _0x3f6e1f;});}return null;};}function removeEntity(_0x48caec,_0x47cd19){return function(_0xb67c38){if(_0xb67c38){return _0xb67c38[_0x75e7('0x35')]()[_0x75e7('0x36')](function(){_0x48caec['status'](0xcc)[_0x75e7('0x37')]();});}};}function handleEntityNotFound(_0x3a8e9d,_0x39087a){return function(_0x16cf93){if(!_0x16cf93){_0x3a8e9d['sendStatus'](0x194);}return _0x16cf93;};}function handleError(_0x598cde,_0x33d679){_0x33d679=_0x33d679||0x1f4;return function(_0x184b31){logger[_0x75e7('0x26')](_0x184b31[_0x75e7('0x38')]);if(_0x184b31[_0x75e7('0x39')]){delete _0x184b31[_0x75e7('0x39')];}_0x598cde[_0x75e7('0x2b')](_0x33d679)[_0x75e7('0x3a')](_0x184b31);};}function getInteractionUsers(_0x1ee4e7,_0x47ab6e){return new BPromise(function(_0x8e948e,_0x226663){try{if(_0x47ab6e[_0x1ee4e7['id']]){_0x1ee4e7[_0x75e7('0x3b')]=_[_0x75e7('0x3c')](_0x47ab6e[_0x1ee4e7['id']],function(_0x44d908){return{'id':_0x44d908['id'],'fullname':_0x44d908[_0x75e7('0x3d')]};});}}catch(_0x5627a3){_0x226663(_0x5627a3);}_0x8e948e(_0x1ee4e7);});}function getInteractionTags(_0x122365,_0x1ad6d4){return new BPromise(function(_0x27c559,_0x425ad1){try{if(_0x122365[_0x75e7('0x3e')]){_0x122365['Tags']=[];_0x122365[_0x75e7('0x3e')][_0x75e7('0x3f')](',')[_0x75e7('0x40')](function(_0x229b75){_0x122365[_0x75e7('0x41')][_0x75e7('0x42')](_0x1ad6d4[_0x229b75]);});}delete _0x122365['TagIds'];}catch(_0x47bf1d){_0x425ad1(_0x47bf1d);}_0x27c559(_0x122365);});}function updateChatInteraction(_0x397a5e,_0x11cec3,_0x202092){return new BPromise(function(_0x42dfce,_0x16a761){return getInteractionUsers(_0x397a5e,_0x202092)['then'](function(_0x1c4e9a){return getInteractionTags(_0x1c4e9a,_0x11cec3);})[_0x75e7('0x36')](function(_0x516586){_0x42dfce(_0x516586);})[_0x75e7('0x43')](function(_0x5895c7){_0x16a761(_0x5895c7);});});}exports['index']=function(_0x173d5d,_0x585185){var _0x14f54e={},_0x3fc661={},_0x249e09={'count':0x0,'rows':[]};var _0x3d0688=_['map'](db[_0x75e7('0x44')]['rawAttributes'],function(_0x2d065a){return{'name':_0x2d065a[_0x75e7('0x45')],'type':_0x2d065a['type']['key']};});_0x3fc661[_0x75e7('0x46')]=_['map'](_0x3d0688,_0x75e7('0x39'));_0x3fc661['query']=_[_0x75e7('0x47')](_0x173d5d[_0x75e7('0x48')]);_0x3fc661[_0x75e7('0x49')]=_[_0x75e7('0x4a')](_0x3fc661['model'],_0x3fc661[_0x75e7('0x48')]);_0x14f54e['attributes']=_['intersection'](_0x3fc661['model'],qs[_0x75e7('0x4b')](_0x173d5d[_0x75e7('0x48')][_0x75e7('0x4b')]));_0x14f54e[_0x75e7('0x4c')]=_0x14f54e[_0x75e7('0x4c')]['length']?_0x14f54e['attributes']:_0x3fc661['model'];if(!_0x173d5d['query'][_0x75e7('0x4d')]('nolimit')){_0x14f54e[_0x75e7('0x2d')]=qs[_0x75e7('0x2d')](_0x173d5d[_0x75e7('0x48')][_0x75e7('0x2d')]);_0x14f54e['offset']=qs[_0x75e7('0x2c')](_0x173d5d[_0x75e7('0x48')][_0x75e7('0x2c')]);}_0x14f54e[_0x75e7('0x4e')]=qs[_0x75e7('0x4f')](_0x173d5d[_0x75e7('0x48')][_0x75e7('0x4f')]);_0x14f54e[_0x75e7('0x50')]=qs[_0x75e7('0x49')](_[_0x75e7('0x51')](_0x173d5d[_0x75e7('0x48')],_0x3fc661[_0x75e7('0x49')]),_0x3d0688);var _0x50af4e=[];var _0x23d32c=squel[_0x75e7('0x52')]()['field']('id')[_0x75e7('0x53')]('name')[_0x75e7('0x53')](_0x75e7('0x54'))[_0x75e7('0x55')](_0x75e7('0x56'));var _0x4a87e8=squel[_0x75e7('0x52')]()['field'](_0x75e7('0x57'))[_0x75e7('0x53')](_0x75e7('0x58'))[_0x75e7('0x53')](_0x75e7('0x59'))[_0x75e7('0x55')]('user_has_chat_interactions','ui')[_0x75e7('0x5a')](_0x75e7('0x5b'),'u',_0x75e7('0x5c'));var _0x3a82dc=squel[_0x75e7('0x52')]()[_0x75e7('0x55')](_0x75e7('0x5d'),'i')[_0x75e7('0x5a')](_0x75e7('0x5e'),'c',_0x75e7('0x5f'))[_0x75e7('0x5a')](_0x75e7('0x5b'),'o','o.id\x20=\x20i.UserId')[_0x75e7('0x5a')](_0x75e7('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x75e7('0x61'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x75e7('0x5a')](_0x75e7('0x62'),'it',_0x75e7('0x63'))['left_join'](_0x75e7('0x56'),'t',_0x75e7('0x64'));var _0x149f69=squel[_0x75e7('0x65')]();var _0x287e1a=[];var _0x289941=squel['expr']();var _0x42eacd;if(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x66')]){_0x42eacd=as[_0x75e7('0x67')](_0x173d5d['query'][_0x75e7('0x66')]);var _0x3e520c=_0x42eacd[_0x75e7('0x68')];for(var _0x540fa3=0x0;_0x540fa3<_0x42eacd[_0x75e7('0x69')][_0x75e7('0x6a')];_0x540fa3++){var _0x1f9454=_0x42eacd['conditions'][_0x540fa3];var _0x39ae70='i';var _0x4cf215=_[_0x75e7('0x6b')](_0x3d0688,['name',_0x1f9454[_0x75e7('0x53')]]);if(!_0x4cf215){switch(_0x1f9454[_0x75e7('0x53')]){case _0x75e7('0x6c'):if(_0x1f9454[_0x75e7('0x6d')]==0x1){_0x3a82dc[_0x75e7('0x6e')]('`'+_0x1f9454[_0x75e7('0x53')]+_0x75e7('0x6f'));}else{_0x3a82dc['having']('`'+_0x1f9454[_0x75e7('0x53')]+_0x75e7('0x70'));}break;case'Contact':if(_0x1f9454[_0x75e7('0x71')]===_0x75e7('0x72')){if(_0x1f9454['value'][_0x75e7('0x3f')]('\x20')[_0x75e7('0x6a')]>0x1){_0x149f69[_0x3e520c](_0x75e7('0x73'),qs[_0x75e7('0x74')](_0x1f9454[_0x75e7('0x6d')]),null);}else{var _0x1181df='%'+_0x1f9454['value']+'%';_0x149f69[_0x3e520c](_0x75e7('0x75'),_0x1181df,_0x1181df,_0x1181df);}}else{_0x4cf215=_[_0x75e7('0x6b')](_0x3d0688,[_0x75e7('0x39'),'ContactId']);_0x1f9454[_0x75e7('0x53')]=_0x75e7('0x76');_0x2090f6=as[_0x75e7('0x77')](_0x39ae70,_0x4cf215[_0x75e7('0x78')],_0x1f9454);_0x149f69[_0x3e520c](_0x2090f6[_0x75e7('0x79')],_0x2090f6['value'][_0x75e7('0x7a')],_0x2090f6[_0x75e7('0x6d')][_0x75e7('0x37')]);}break;case _0x75e7('0x7b'):var _0x421579=_0x1f9454['value'][_0x75e7('0x3f')](',')['map'](function(_0x3ebefc){return Number(_0x3ebefc);});_0x421579['forEach'](function(_0x5c5548){_0x289941['or'](_0x75e7('0x7c'),'%,'+_0x5c5548+',%');});_0x287e1a=_[_0x75e7('0x7d')](_0x287e1a,_0x421579);break;case _0x75e7('0x7e'):if(_0x1f9454[_0x75e7('0x71')]==='$substring'){_0x149f69[_0x3e520c](_0x75e7('0x7f'),'%'+_0x1f9454['value']+'%',null);}else{_0x4cf215=_['find'](_0x3d0688,[_0x75e7('0x39'),_0x75e7('0x80')]);_0x1f9454[_0x75e7('0x53')]=_0x75e7('0x80');_0x2090f6=as['buildExpression'](_0x39ae70,_0x4cf215[_0x75e7('0x78')],_0x1f9454);_0x149f69[_0x3e520c](_0x2090f6[_0x75e7('0x79')],_0x2090f6[_0x75e7('0x6d')][_0x75e7('0x7a')],_0x2090f6['value'][_0x75e7('0x37')]);}break;case _0x75e7('0x81'):_0x2090f6=as['buildExpression']('me',null,_0x1f9454);_0x149f69[_0x3e520c](_0x2090f6[_0x75e7('0x79')],_0x2090f6[_0x75e7('0x6d')][_0x75e7('0x7a')],_0x2090f6[_0x75e7('0x6d')][_0x75e7('0x37')]);break;}}else{var _0x2090f6=as[_0x75e7('0x77')](_0x39ae70,_0x4cf215[_0x75e7('0x78')],_0x1f9454);_0x149f69[_0x3e520c](_0x2090f6['text'],_0x2090f6['value'][_0x75e7('0x7a')],_0x2090f6[_0x75e7('0x6d')]['end']);}}}else{var _0x30d4f3=_(_0x173d5d[_0x75e7('0x48')])[_0x75e7('0x47')]()[_0x75e7('0x3c')](function(_0x258c17){return _[_0x75e7('0x82')](_0x3d0688,[_0x75e7('0x39'),_0x258c17])?_0x258c17:undefined;})[_0x75e7('0x83')]()[_0x75e7('0x6d')]();if(!_[_0x75e7('0x84')](_0x30d4f3)){_0x30d4f3[_0x75e7('0x40')](function(_0x413780){if(_0x413780===_0x75e7('0x85')){_0x3a82dc[_0x75e7('0x50')](_0x75e7('0x86'),[][_0x75e7('0x87')](_0x173d5d[_0x75e7('0x48')][_0x413780]));}else if(_0x413780===_0x75e7('0x88')){var _0x309c71=JSON[_0x75e7('0x89')](_0x173d5d['query'][_0x413780])[_0x75e7('0x8a')];var _0x259cc8=JSON[_0x75e7('0x89')](_0x173d5d[_0x75e7('0x48')][_0x413780])[_0x75e7('0x8b')];_0x3a82dc['where'](_0x75e7('0x8c'),_0x309c71,_0x259cc8);}else{if(_0x173d5d[_0x75e7('0x48')][_0x413780]==='null'){_0x3a82dc[_0x75e7('0x50')]('i.'+_0x413780+'\x20IS\x20NULL');}else{_0x3a82dc[_0x75e7('0x50')]('i.'+_0x413780+_0x75e7('0x8d'),_0x173d5d[_0x75e7('0x48')][_0x413780]);}}});}if(_0x173d5d[_0x75e7('0x48')]['read']){if(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x8e')]==0x1){_0x3a82dc[_0x75e7('0x6e')](_0x75e7('0x8f'));}else{_0x3a82dc[_0x75e7('0x6e')](_0x75e7('0x90'));}}if(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x91')]){_0x287e1a=_[_0x75e7('0x92')](_0x173d5d['query'][_0x75e7('0x91')])?_0x173d5d['query'][_0x75e7('0x91')]:new Array(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x91')]);_0x287e1a['forEach'](function(_0x4d4a2a){_0x289941['or'](_0x75e7('0x7c'),'%,'+_0x4d4a2a+',%');});}if(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x93')]){var _0x2d6bae=_0x173d5d[_0x75e7('0x48')][_0x75e7('0x93')][_0x75e7('0x94')]('\x5c','\x5c\x5c')[_0x75e7('0x94')](/'/g,'\x27\x27');if(qs[_0x75e7('0x95')](_0x2d6bae)){_0x149f69['or']('i.id\x20LIKE\x20?',_0x2d6bae+'%');}else{_0x149f69['or'](_0x75e7('0x96'),qs['getFullTextValue'](_0x2d6bae))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2d6bae+'%');}}}_0x3a82dc['where'](_0x149f69);_0x3a82dc['group'](_0x75e7('0x97'));var _0x3c2463={'type':db[_0x75e7('0x98')]['QueryTypes'][_0x75e7('0x99')],'raw':!![]};var _0x517b4e=_0x3a82dc['clone']();_0x517b4e[_0x75e7('0x53')](_0x75e7('0x97'));_0x517b4e[_0x75e7('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x75e7('0x6c'));if(_0x14f54e[_0x75e7('0x4e')]){_0x14f54e['order'][_0x75e7('0x40')](function(_0x3527f3){var _0x199163=_0x3527f3[0x0]==='contactName'?_0x3527f3[0x0]:'i.'+_0x3527f3[0x0];_0x3a82dc[_0x75e7('0x4e')](_0x199163,_0x3527f3[0x1]===_0x75e7('0x9a')?![]:!![]);});}if(!_[_0x75e7('0x84')](_0x287e1a)){_0x3a82dc['having'](_0x289941);_0x517b4e[_0x75e7('0x50')](_0x75e7('0x9b'),_0x287e1a);}BPromise['resolve']()[_0x75e7('0x36')](function(){if(!_0x42eacd){if(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x85')])return;_0x517b4e[_0x75e7('0x50')](_0x75e7('0x9c'));_0x3a82dc[_0x75e7('0x50')](_0x75e7('0x9c'));return;}if(_0x173d5d['user'][_0x75e7('0x9d')]!==_0x75e7('0x9e'))return;return _0x173d5d['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x75e7('0x36')](function(_0x4822c4){if(_['isEmpty'](_0x4822c4)){_0x517b4e[_0x75e7('0x50')](_0x75e7('0x9f'));_0x3a82dc[_0x75e7('0x50')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x517b4e['where'](_0x75e7('0x86'),_['map'](_0x4822c4,'id'));_0x3a82dc['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x75e7('0x3c')](_0x4822c4,'id'));}});})[_0x75e7('0x36')](function(){if(_0x173d5d[_0x75e7('0xa0')]['role']===_0x75e7('0x9e')&&!_0x42eacd&&!_0x173d5d[_0x75e7('0x48')]['ChatWebsiteId'])return[];return db['sequelize']['query'](_0x517b4e[_0x75e7('0xa1')](),_0x3c2463);})['then'](function(_0x4f466b){_0x249e09[_0x75e7('0xa2')]=_0x4f466b[_0x75e7('0x6a')];if(_0x249e09[_0x75e7('0xa2')]===0x0)return[];return db[_0x75e7('0xa3')]['query'](_0x23d32c['toString'](),_0x3c2463)[_0x75e7('0x36')](function(_0x59e7e1){_0x50af4e=_['keyBy'](_0x59e7e1,'id');_0x3c2463=_[_0x75e7('0xa4')](_0x3c2463,{'model':db[_0x75e7('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x173d5d[_0x75e7('0x48')][_0x75e7('0x4b')]){_0x14f54e['attributes'][_0x75e7('0x40')](function(_0x34401e){_0x3a82dc[_0x75e7('0x53')]('i.'+_0x34401e);});}else{_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xa5'),_0x75e7('0x6c'));_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xa6'),'Account.key');_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xa7'),_0x75e7('0xa8'));_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xa9'),_0x75e7('0xaa'));_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xab'));_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xac'),_0x75e7('0xad'));_0x3a82dc['field'](_0x75e7('0xae'),_0x75e7('0xaf'));_0x3a82dc[_0x75e7('0x53')]('c.email',_0x75e7('0xb0'));_0x3a82dc['field'](_0x75e7('0xb1'),'Contact.phone');_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xb2'),'Contact.mobile');_0x3a82dc['field'](_0x75e7('0xb3'),'Contact.fax');_0x3a82dc[_0x75e7('0x53')](_0x75e7('0xb4'),_0x75e7('0xb5'));_0x3a82dc[_0x75e7('0x53')]('o.internal',_0x75e7('0xb6'));_0x3a82dc['field'](_0x75e7('0xb7'),_0x75e7('0x3e'));}if(_0x14f54e[_0x75e7('0x2d')])_0x3a82dc[_0x75e7('0x2d')](_0x14f54e[_0x75e7('0x2d')]);if(_0x14f54e[_0x75e7('0x2c')])_0x3a82dc[_0x75e7('0x2c')](_0x14f54e['offset']);return db[_0x75e7('0xa3')][_0x75e7('0x48')](_0x3a82dc[_0x75e7('0xa1')](),_0x3c2463);})[_0x75e7('0x36')](function(_0xcb81a2){_0x4a87e8['where'](_0x75e7('0xb8'),_[_0x75e7('0x3c')](_0xcb81a2,'id'));return db['sequelize']['query'](_0x4a87e8[_0x75e7('0xa1')](),_0x3c2463)[_0x75e7('0x36')](function(_0x2dd713){var _0x3c7313=_[_0x75e7('0xb9')](_0x2dd713,'ChatInteractionId');var _0x518a0d=[];_0xcb81a2[_0x75e7('0x40')](function(_0x38ad5b){_0x518a0d[_0x75e7('0x42')](updateChatInteraction(_0x38ad5b,_0x50af4e,_0x3c7313));});return BPromise[_0x75e7('0xba')](_0x518a0d);});});})[_0x75e7('0x36')](function(_0x58fa67){_0x249e09[_0x75e7('0xbb')]=_0x58fa67;return _0x249e09;})[_0x75e7('0x36')](respondWithFilteredResult(_0x585185,_0x14f54e))['catch'](handleError(_0x585185,null));};exports['show']=function(_0x4ccf69,_0x4cf9c5){var _0x30a333={'raw':![],'where':{'id':_0x4ccf69['params']['id']}},_0x57e994={};_0x57e994[_0x75e7('0x46')]=_[_0x75e7('0x47')](db[_0x75e7('0x44')][_0x75e7('0xbc')]);_0x57e994[_0x75e7('0x48')]=_[_0x75e7('0x47')](_0x4ccf69['query']);_0x57e994[_0x75e7('0x49')]=_['intersection'](_0x57e994[_0x75e7('0x46')],_0x57e994[_0x75e7('0x48')]);_0x30a333[_0x75e7('0x4c')]=_['intersection'](_0x57e994[_0x75e7('0x46')],qs[_0x75e7('0x4b')](_0x4ccf69[_0x75e7('0x48')][_0x75e7('0x4b')]));_0x30a333['attributes']=_0x30a333['attributes']['length']?_0x30a333['attributes']:_0x57e994[_0x75e7('0x46')];if(_0x4ccf69[_0x75e7('0x48')][_0x75e7('0xbd')]){_0x30a333[_0x75e7('0xbe')]=[{'all':!![]}];}_0x30a333=_[_0x75e7('0xa4')]({},_0x30a333,_0x4ccf69['options']);return db[_0x75e7('0x44')][_0x75e7('0x6b')](_0x30a333)[_0x75e7('0x36')](handleEntityNotFound(_0x4cf9c5,null))['then'](respondWithResult(_0x4cf9c5,null))[_0x75e7('0x43')](handleError(_0x4cf9c5,null));};exports[_0x75e7('0xbf')]=function(_0x26a9a0,_0x7bdf6e){return db[_0x75e7('0x44')][_0x75e7('0xbf')](_0x26a9a0[_0x75e7('0x81')],{})[_0x75e7('0x36')](respondWithResult(_0x7bdf6e,0xc9))[_0x75e7('0x43')](handleError(_0x7bdf6e,null));};exports[_0x75e7('0x34')]=function(_0x50aef1,_0x2e950a){if(_0x50aef1['body']['id']){delete _0x50aef1[_0x75e7('0x81')]['id'];}return db[_0x75e7('0x44')][_0x75e7('0x6b')]({'where':{'id':_0x50aef1[_0x75e7('0xc0')]['id']}})[_0x75e7('0x36')](handleEntityNotFound(_0x2e950a,null))[_0x75e7('0x36')](saveUpdates(_0x50aef1['body'],null))[_0x75e7('0x36')](respondWithResult(_0x2e950a,null))['catch'](handleError(_0x2e950a,null));};exports[_0x75e7('0x35')]=function(_0x5ba754,_0x4edd08){return db[_0x75e7('0x44')][_0x75e7('0x6b')]({'where':{'id':_0x5ba754[_0x75e7('0xc0')]['id']}})[_0x75e7('0x36')](handleEntityNotFound(_0x4edd08,null))[_0x75e7('0x36')](removeEntity(_0x4edd08,null))['catch'](handleError(_0x4edd08,null));};exports['describe']=function(_0x421388,_0x3c816e){return db[_0x75e7('0x44')]['describe']()[_0x75e7('0x36')](respondWithResult(_0x3c816e,null))[_0x75e7('0x43')](handleError(_0x3c816e,null));};exports[_0x75e7('0xc1')]=function(_0x26d401,_0x66810){var _0x5e5559=_0x26d401['params']['id'];var _0xc1940d;var _0x463d71;var _0x4c8736;return db[_0x75e7('0x44')]['findOne']({'where':{'id':_0x5e5559}})[_0x75e7('0x36')](function(_0x219b7e){_0xc1940d=_0x219b7e;return db[_0x75e7('0xc2')][_0x75e7('0xc3')]({'where':{'id':_0x219b7e[_0x75e7('0x85')]},'attributes':['id',_0x75e7('0xc4'),_0x75e7('0xc5')],'raw':!![]});})[_0x75e7('0x36')](function(_0x181c42){if(_0x181c42&&_0x181c42['vidaooApiKey']&&_0x181c42[_0x75e7('0xc5')]){_0x463d71=_0x181c42;var _0x17b355={'rejectUnauthorized':![],'method':_0x75e7('0xc6'),'uri':_0x75e7('0xc7'),'headers':{'X-APIKEY':_0x181c42[_0x75e7('0xc4')]},'body':{'name':_0x75e7('0xc8')+_0x5e5559},'redirect':_0x75e7('0xc9'),'json':!![]};return rp(_0x17b355);}else{throw new db['Sequelize'][(_0x75e7('0xca'))](_0x75e7('0xcb'));}})[_0x75e7('0x36')](function(_0x130b3b){_0x4c8736=_0x130b3b;if(_0x4c8736['id']){var _0x5cf71b={'body':_0x4c8736['join_url'],'ChatWebsiteId':_0x463d71['id'],'ChatInteractionId':_0xc1940d['id'],'direction':_0x75e7('0xcc'),'UserId':_0x26d401['user']['id']};return db[_0x75e7('0xcd')][_0x75e7('0xbf')](_0x5cf71b,{});}else{throw new db[(_0x75e7('0x98'))][(_0x75e7('0xca'))](_0x75e7('0xce'));}})[_0x75e7('0x36')](function(){return _0xc1940d['updateAttributes']({'vidaooSessionId':_0x4c8736['id']});})['then'](respondWithResult(_0x66810,null))[_0x75e7('0x43')](handleError(_0x66810,null));};exports[_0x75e7('0xcf')]=function(_0x1fa08e,_0x438e2c){if(_0x1fa08e[_0x75e7('0x81')]['id']){delete _0x1fa08e[_0x75e7('0x81')]['id'];}return db[_0x75e7('0x44')][_0x75e7('0x6b')]({'where':{'id':_0x1fa08e[_0x75e7('0xc0')]['id']}})[_0x75e7('0x36')](handleEntityNotFound(_0x438e2c,null))[_0x75e7('0x36')](saveUpdates(_0x1fa08e[_0x75e7('0x81')],null))[_0x75e7('0x36')](respondWithResult(_0x438e2c,null))[_0x75e7('0x43')](handleError(_0x438e2c,null));};exports[_0x75e7('0xd0')]=function(_0x4bd333,_0x9ae308,_0x3b3052){if(_0x4bd333[_0x75e7('0x81')]['id']){delete _0x4bd333[_0x75e7('0x81')]['id'];}return db['ChatInteraction'][_0x75e7('0x6b')]({'where':{'id':_0x4bd333[_0x75e7('0xc0')]['id']}})[_0x75e7('0x36')](function(_0x24232e){if(!_0x24232e){logger[_0x75e7('0x26')](_0x75e7('0xd1'),_0x75e7('0xd0'),0x194,'entity\x20not\x20found');_0x9ae308[_0x75e7('0x2a')](0x194);}else{if(_0x24232e[_0x75e7('0x80')]){throw new db[(_0x75e7('0x98'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x24232e;})['then'](function(_0x5d3e36){if(_0x5d3e36){return _0x5d3e36[_0x75e7('0x34')]({'closed':_0x4bd333['body'][_0x75e7('0xd2')],'disposition':_0x4bd333[_0x75e7('0x81')]['disposition']})[_0x75e7('0x36')](function(_0x5a96f3){return _0x5a96f3;});}})[_0x75e7('0x36')](function(_0x483d8f){return respondWithRpcPromise(_0x75e7('0xd3'),_0x75e7('0xd0'),_0x4bd333['body'],client9004);})['then'](respondWithResult(_0x9ae308,null))[_0x75e7('0x43')](handleError(_0x9ae308,null));};exports[_0x75e7('0xd4')]=function(_0x4b9a0e,_0x1b4221,_0x11d791){_0x4b9a0e[_0x75e7('0x81')][_0x75e7('0x39')]=_0x4b9a0e['file'][_0x75e7('0xd5')];_0x4b9a0e[_0x75e7('0x81')][_0x75e7('0xd6')]=_0x4b9a0e[_0x75e7('0xd7')][_0x75e7('0xd8')];_0x4b9a0e[_0x75e7('0x81')][_0x75e7('0x78')]=_0x4b9a0e[_0x75e7('0xd7')][_0x75e7('0xd9')];return db[_0x75e7('0xda')]['create'](_0x4b9a0e[_0x75e7('0x81')])['then'](respondWithResult(_0x1b4221,0xc9))['catch'](handleError(_0x1b4221,null));};exports[_0x75e7('0xdb')]=function(_0x28abdd,_0x288eee,_0x5329e3){return db['ChatInteraction'][_0x75e7('0xc3')]({'where':{'id':_0x28abdd[_0x75e7('0xc0')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x288eee,null))[_0x75e7('0x36')](function(_0x33a09e){if(_0x33a09e){if(_0x33a09e[_0x75e7('0xd2')]){return _0x288eee['status'](0x193)[_0x75e7('0x30')]({'status':0x193,'message':_0x75e7('0xdc')});}return db[_0x75e7('0xda')][_0x75e7('0xc3')]({'where':{'id':_0x28abdd['query'][_0x75e7('0xdd')]},'raw':!![]})['then'](handleEntityNotFound(_0x288eee,null));}})[_0x75e7('0x36')](function(_0x2abb33){if(_0x2abb33){return _0x288eee[_0x75e7('0xde')](path['join'](config[_0x75e7('0xdf')],_0x75e7('0xe0'),_0x2abb33['basename']));}})[_0x75e7('0x43')](handleError(_0x288eee,null));};exports[_0x75e7('0xe1')]=function(_0x120b1c,_0xaa3d65){var _0x720e3e=null;var _0x504750=null;var _0xca0e3=null;var _0x45af60=null;if(_0x120b1c[_0x75e7('0x81')]['id']){delete _0x120b1c[_0x75e7('0x81')]['id'];}if(_0x120b1c['body']['mailTranscript']){_0x45af60=path[_0x75e7('0xe2')](config[_0x75e7('0xdf')],_0x75e7('0xe3'),util[_0x75e7('0xe4')](_0x75e7('0xe5'),Date[_0x75e7('0xe6')]()));_0x120b1c[_0x75e7('0x81')][_0x75e7('0xe7')]=_0x45af60;}return db['ChatInteraction'][_0x75e7('0x6b')]({'where':{'id':_0x120b1c[_0x75e7('0xc0')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x75e7('0xe8'),'include':[{'model':db[_0x75e7('0x7e')],'as':_0x75e7('0x7e')}]}]})['then'](handleEntityNotFound(_0xaa3d65,null))[_0x75e7('0x36')](saveUpdates(_0x120b1c[_0x75e7('0x81')],null))[_0x75e7('0x36')](function(_0x1cd41a){if(_0x1cd41a){_0x720e3e=_0x1cd41a;return db['ChatWebsite']['find']({'where':{'id':_0x720e3e['ChatWebsiteId']}});}})[_0x75e7('0x36')](function(_0x4ecda3){if(_0x4ecda3){_0xca0e3=_0x4ecda3;return db[_0x75e7('0xe9')][_0x75e7('0x6b')]({'where':{'id':_0x720e3e[_0x75e7('0x76')]}});}})[_0x75e7('0x36')](function(_0x5eddda){if(_0x5eddda){_0x504750=_0x5eddda;if(_0x45af60){var _0x4f2e04=null;for(var _0x13bf30=0x1;_0x13bf30<_0x720e3e[_0x75e7('0xe8')][_0x75e7('0x6a')];++_0x13bf30){_0x4f2e04=_0x720e3e[_0x75e7('0xe8')][_0x13bf30];var _0x5696c7=_0x4f2e04[_0x75e7('0x80')]?util['format'](_0x75e7('0xea'),_0xca0e3[_0x75e7('0xeb')],_0x4f2e04[_0x75e7('0x80')]):_0x75e7('0xec');var _0x3d6da2=_0x120b1c[_0x75e7('0x81')]['customer']||util[_0x75e7('0xe4')](_0x75e7('0xea'),_0x75e7('0xed'),_0x4f2e04[_0x75e7('0x76')]);switch(_0xca0e3[_0x75e7('0xee')]){case _0x75e7('0xef'):_0x5696c7=_0x4f2e04[_0x75e7('0x80')]?util[_0x75e7('0xe4')](_0x75e7('0xea'),_0xca0e3[_0x75e7('0xeb')],_0x4f2e04[_0x75e7('0x80')]):_0x75e7('0xec');break;case'agent_alias':_0x5696c7=_0x4f2e04['UserId']?_0x4f2e04[_0x75e7('0x7e')]['alias']||_0x4f2e04['User'][_0x75e7('0x3d')]:'System';break;case _0x75e7('0xf0'):_0x5696c7=_0x4f2e04[_0x75e7('0x80')]?_0x4f2e04[_0x75e7('0x7e')][_0x75e7('0x3d')]:_0x75e7('0xec');break;default:_0x5696c7=_0x4f2e04[_0x75e7('0x80')]?util[_0x75e7('0xe4')](_0x75e7('0xea'),_0xca0e3[_0x75e7('0xeb')],_0x4f2e04['UserId']):'System';}var _0x301775=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x4f2e04[_0x75e7('0x88')])[_0x75e7('0xe4')](_0x75e7('0xf1')),_0x4f2e04['direction']==='in'?_0x3d6da2:_0x5696c7,_0x4f2e04[_0x75e7('0x81')]);if(!_0x4f2e04[_0x75e7('0xf2')]){fs[_0x75e7('0xf3')](_0x45af60,_0x301775);}}return db['MailAccount'][_0x75e7('0xc3')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x75e7('0xf4'),'raw':!![]}]});}}})[_0x75e7('0x36')](function(_0x25d516){if(_0x25d516&&_0x25d516[_0x75e7('0xf4')]&&_0x120b1c['body']){var _0xc4ec9d={'tls':{'rejectUnauthorized':![]}};if(_0x25d516[_0x75e7('0xf4')]['service']){_0xc4ec9d[_0x75e7('0xf5')]=_0x25d516[_0x75e7('0xf4')]['service'];}else{_0xc4ec9d[_0x75e7('0xf6')]=_0x25d516[_0x75e7('0xf4')][_0x75e7('0xf6')];_0xc4ec9d['port']=_0x25d516['Smtp'][_0x75e7('0xf7')];_0xc4ec9d['secure']=_0x25d516['Smtp'][_0x75e7('0xf8')];}if(_0x25d516['Smtp'][_0x75e7('0xf9')]){_0xc4ec9d['auth']={'user':_0x25d516[_0x75e7('0xf4')][_0x75e7('0xa0')],'pass':_0x25d516[_0x75e7('0xf4')][_0x75e7('0xfa')]};}return respondWithRpcPromise(_0x75e7('0xfb'),'sendMail',{'account':_0xc4ec9d,'message':{'from':util[_0x75e7('0xe4')](_0x75e7('0xfc'),_0x25d516['name'],_0x25d516[_0x75e7('0xfd')]||_0x25d516['Smtp']['user']),'to':_0x120b1c[_0x75e7('0x81')][_0x75e7('0xfe')],'subject':_0x75e7('0xff'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x120b1c[_0x75e7('0x81')][_0x75e7('0xfe')]),'attachments':[{'path':_0x45af60}]}})[_0x75e7('0x36')](function(){return _0x720e3e;})[_0x75e7('0x43')](function(_0x23fb80){console['error'](_0x23fb80);});}else{return _0x720e3e;}})['then'](respondWithStatusCode(_0xaa3d65,0xc8))[_0x75e7('0x43')](handleError(_0xaa3d65,null));};exports[_0x75e7('0x100')]=function(_0x13e511,_0xc3cbd7,_0x4d209b){return db['ChatMessage']['find']({'where':{'id':_0x13e511[_0x75e7('0xc0')]['id']}})['then'](handleEntityNotFound(_0xc3cbd7,null))[_0x75e7('0x36')](function(_0x3a6934){if(_0x3a6934){return _0x3a6934[_0x75e7('0x100')](_0x13e511[_0x75e7('0x81')]['ids'],_[_0x75e7('0x101')](_0x13e511[_0x75e7('0x81')],[_0x75e7('0x102'),'id'])||{});}})['then'](respondWithResult(_0xc3cbd7,null))[_0x75e7('0x43')](handleError(_0xc3cbd7,null));};exports[_0x75e7('0x103')]=function(_0x310481,_0x3725e0,_0x856a3){var _0x3fd941={'raw':![],'where':{}};var _0x2d17c1={};var _0x1d4ddf={'count':0x0,'rows':[]};return db[_0x75e7('0x44')]['findOne']({'where':{'id':_0x310481[_0x75e7('0xc0')]['id']}})['then'](handleEntityNotFound(_0x3725e0,null))['then'](function(_0x3f584e){if(_0x3f584e){_0x2d17c1[_0x75e7('0x46')]=_['keys'](db[_0x75e7('0xcd')]['rawAttributes']);_0x2d17c1['query']=_[_0x75e7('0x47')](_0x310481[_0x75e7('0x48')]);_0x2d17c1[_0x75e7('0x49')]=_[_0x75e7('0x4a')](_0x2d17c1['model'],_0x2d17c1['query']);_0x3fd941['attributes']=_[_0x75e7('0x4a')](_0x2d17c1['model'],qs['fields'](_0x310481[_0x75e7('0x48')][_0x75e7('0x4b')]));_0x3fd941[_0x75e7('0x4c')]=_0x3fd941[_0x75e7('0x4c')]['length']?_0x3fd941[_0x75e7('0x4c')]:_0x2d17c1[_0x75e7('0x46')];if(!_0x310481[_0x75e7('0x48')][_0x75e7('0x4d')](_0x75e7('0x104'))){_0x3fd941['limit']=qs[_0x75e7('0x2d')](_0x310481[_0x75e7('0x48')]['limit']);_0x3fd941['offset']=qs[_0x75e7('0x2c')](_0x310481[_0x75e7('0x48')][_0x75e7('0x2c')]);}_0x3fd941[_0x75e7('0x4e')]=qs[_0x75e7('0x4f')](_0x310481[_0x75e7('0x48')][_0x75e7('0x4f')]);_0x3fd941['where']=qs[_0x75e7('0x49')](_[_0x75e7('0x51')](_0x310481[_0x75e7('0x48')],_0x2d17c1[_0x75e7('0x49')]));_0x3fd941['where'][_0x75e7('0x105')]=_0x3f584e['id'];if(_0x310481['query']['filter']){_0x3fd941['where']=_[_0x75e7('0xa4')](_0x3fd941[_0x75e7('0x50')],{'$or':_['map'](_0x3fd941[_0x75e7('0x4c')],function(_0x49a7c8){var _0x472257={};_0x472257[_0x49a7c8]={'$like':'%'+_0x310481[_0x75e7('0x48')][_0x75e7('0x93')]+'%'};return _0x472257;})});}if(_0x310481[_0x75e7('0x48')][_0x75e7('0x8a')]){var _0x4c1a8c=_0x310481['query'][_0x75e7('0x8a')][_0x75e7('0x3f')](',');var _0x472b8b={};_0x472b8b[_0x4c1a8c[0x0]]={'$gte':moment(_0x4c1a8c[0x1])[_0x75e7('0xe4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3fd941[_0x75e7('0x50')]=_[_0x75e7('0xa4')](_0x3fd941[_0x75e7('0x50')],_0x472b8b);}_0x3fd941=_['merge']({},_0x3fd941,_0x310481[_0x75e7('0x106')]);return db[_0x75e7('0xcd')][_0x75e7('0xa2')]({'where':_0x3fd941[_0x75e7('0x50')]})['then'](function(_0x25eb67){_0x1d4ddf[_0x75e7('0xa2')]=_0x25eb67;if(_0x310481[_0x75e7('0x48')]['includeAll']){_0x3fd941[_0x75e7('0xbe')]=[{'all':!![]}];}return db[_0x75e7('0xcd')][_0x75e7('0x107')](_0x3fd941);})[_0x75e7('0x36')](function(_0x361e6a){_0x1d4ddf[_0x75e7('0xbb')]=_0x361e6a;return _0x1d4ddf;});}})[_0x75e7('0x36')](respondWithFilteredResult(_0x3725e0,_0x3fd941))['catch'](handleError(_0x3725e0,null));};exports[_0x75e7('0x108')]=function(_0x3edea0,_0x47bfcb,_0x1d0470){var _0x574fc0={'where':{}},_0x7d6c1a={},_0x130685={'count':0x0,'rows':[]};return db[_0x75e7('0x44')][_0x75e7('0xc3')]({'where':{'id':_0x3edea0[_0x75e7('0xc0')]['id']}})[_0x75e7('0x36')](handleEntityNotFound(_0x47bfcb,null))['then'](function(_0x3448af){if(_0x3448af){_0x7d6c1a['model']=_['keys'](db[_0x75e7('0xcd')]['rawAttributes']);_0x7d6c1a[_0x75e7('0x48')]=_['keys'](_0x3edea0['query']);_0x7d6c1a[_0x75e7('0x49')]=_[_0x75e7('0x4a')](_0x7d6c1a['model'],_0x7d6c1a['query']);_0x574fc0['attributes']=_[_0x75e7('0x4a')](_0x7d6c1a['model'],qs[_0x75e7('0x4b')](_0x3edea0[_0x75e7('0x48')][_0x75e7('0x4b')]));_0x574fc0[_0x75e7('0x4c')]=_0x574fc0[_0x75e7('0x4c')][_0x75e7('0x6a')]?_0x574fc0[_0x75e7('0x4c')]:_0x7d6c1a[_0x75e7('0x46')];if(!_0x3edea0['query'][_0x75e7('0x4d')](_0x75e7('0x104'))){_0x574fc0[_0x75e7('0x2d')]=qs['limit'](_0x3edea0[_0x75e7('0x48')][_0x75e7('0x2d')]);_0x574fc0['offset']=qs['offset'](_0x3edea0[_0x75e7('0x48')][_0x75e7('0x2c')]);}_0x574fc0[_0x75e7('0x4e')]=qs['sort'](_0x3edea0[_0x75e7('0x48')][_0x75e7('0x4f')]);_0x574fc0[_0x75e7('0x50')]=qs[_0x75e7('0x49')](_[_0x75e7('0x51')](_0x3edea0['query'],_0x7d6c1a[_0x75e7('0x49')]));_0x574fc0['where']['ChatInteractionId']=_0x3448af['id'];if(_0x3edea0[_0x75e7('0x48')]['filter']){_0x574fc0[_0x75e7('0x50')]=_[_0x75e7('0xa4')](_0x574fc0[_0x75e7('0x50')],{'$or':_[_0x75e7('0x3c')](_0x574fc0['attributes'],function(_0x14d28e){var _0x1af27f={};_0x1af27f[_0x14d28e]={'$like':'%'+_0x3edea0[_0x75e7('0x48')][_0x75e7('0x93')]+'%'};return _0x1af27f;})});}_0x574fc0[_0x75e7('0x50')][_0x75e7('0xf2')]=![];if(_0x3edea0[_0x75e7('0x48')]['id']){_0x574fc0['where']['id']={'$gt':_0x3edea0['query']['id']};}_0x574fc0=_[_0x75e7('0xa4')]({},_0x574fc0,_0x3edea0['options']);return db[_0x75e7('0xcd')][_0x75e7('0xa2')]({'where':_0x574fc0[_0x75e7('0x50')]})[_0x75e7('0x36')](function(_0x5c83cb){_0x130685[_0x75e7('0xa2')]=_0x5c83cb;_0x574fc0[_0x75e7('0xbe')]=[];if(_0x3edea0[_0x75e7('0x48')][_0x75e7('0x109')]){_0x574fc0[_0x75e7('0xbe')][_0x75e7('0x42')]({'model':db['User'],'as':'User','attributes':['id',_0x75e7('0x3d'),_0x75e7('0x10a')]});}if(_0x3edea0[_0x75e7('0x48')][_0x75e7('0xbd')]){_0x574fc0[_0x75e7('0xbe')]=[{'all':!![]}];}return db['ChatMessage'][_0x75e7('0x107')](_0x574fc0);})['then'](function(_0x152767){_0x130685['rows']=_0x152767;return _0x130685;});}})[_0x75e7('0x36')](respondWithFilteredResult(_0x47bfcb,_0x574fc0))['catch'](handleError(_0x47bfcb,null));};exports[_0x75e7('0x10b')]=function(_0x539440,_0x942466,_0x204334){return db[_0x75e7('0x44')][_0x75e7('0x6b')]({'where':{'id':_0x539440[_0x75e7('0xc0')]['id']}})[_0x75e7('0x36')](handleEntityNotFound(_0x942466,null))[_0x75e7('0x36')](function(_0x4e3fc4){if(_0x4e3fc4){return _0x4e3fc4[_0x75e7('0x10c')](_0x539440[_0x75e7('0x81')][_0x75e7('0x102')],_[_0x75e7('0x101')](_0x539440[_0x75e7('0x81')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x75e7('0x107')]({'attributes':['id',_0x75e7('0x39'),_0x75e7('0x54')],'where':{'id':_0x539440[_0x75e7('0x81')][_0x75e7('0x102')]}});})['then'](function(_0x53c8f2){socket[_0x75e7('0x10d')](_0x75e7('0x10e'),{'id':Number(_0x539440[_0x75e7('0xc0')]['id']),'tags':_0x53c8f2||[]});return{'id':Number(_0x539440[_0x75e7('0xc0')]['id']),'tags':_0x53c8f2||[]};});}})[_0x75e7('0x36')](respondWithResult(_0x942466,null))[_0x75e7('0x43')](handleError(_0x942466,null));};exports[_0x75e7('0x10f')]=function(_0x34bf94,_0x4321dc,_0x4fe449){return db[_0x75e7('0x44')][_0x75e7('0x6b')]({'where':{'id':_0x34bf94['params']['id']}})[_0x75e7('0x36')](handleEntityNotFound(_0x4321dc,null))[_0x75e7('0x36')](function(_0xbcd7d8){if(_0xbcd7d8){return _0xbcd7d8[_0x75e7('0x10f')](_0x34bf94['query'][_0x75e7('0x102')]);}})['then'](respondWithStatusCode(_0x4321dc,null))[_0x75e7('0x43')](handleError(_0x4321dc,null));};exports['download']=function(_0x33e338,_0x316f2d){var _0x328591=moment()['unix']()[_0x75e7('0xa1')]();var _0x2fe354=path[_0x75e7('0xe2')](config['root'],_0x75e7('0x110'),'files',_0x75e7('0x111'));var _0x18286d=path['join'](config['root'],_0x75e7('0x110'),_0x75e7('0x112'),_0x75e7('0x113'));var _0x314acd=path[_0x75e7('0xe2')](_0x2fe354,_0x328591);var _0x16d21c=util[_0x75e7('0xe4')]('transcript-%d-%s.zip',_0x33e338[_0x75e7('0xc0')]['id'],_0x328591);var _0x41ca66=path[_0x75e7('0xe2')](_0x2fe354,_0x16d21c);var _0x3192aa=[];_0x3192aa[_0x75e7('0x42')]({'model':db[_0x75e7('0x7e')],'as':_0x75e7('0x7e'),'attributes':['id',_0x75e7('0x3d')],'raw':!![]});_0x3192aa[_0x75e7('0x42')]({'model':db[_0x75e7('0xe9')],'as':_0x75e7('0x114'),'attributes':['id','firstName',_0x75e7('0x115')],'raw':!![]});if(_0x33e338['query'][_0x75e7('0x113')]){_0x3192aa[_0x75e7('0x42')]({'model':db[_0x75e7('0xda')],'as':_0x75e7('0xda'),'raw':!![]});}var _0x24cc28=[{'model':db[_0x75e7('0xcd')],'as':_0x75e7('0xe8'),'attributes':['id',_0x75e7('0x81'),_0x75e7('0x88'),'direction',_0x75e7('0xf2'),_0x75e7('0x8e')],'include':_0x3192aa}];_0x24cc28[_0x75e7('0x42')]({'model':db[_0x75e7('0xc2')],'as':_0x75e7('0x116'),'attributes':['id',_0x75e7('0x39')]});_0x24cc28[_0x75e7('0x42')]({'model':db[_0x75e7('0x7e')],'as':_0x75e7('0x117'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x75e7('0x6b')]({'where':{'id':_0x33e338[_0x75e7('0xc0')]['id']},'include':_0x24cc28})[_0x75e7('0x36')](handleEntityNotFound(_0x316f2d,null))[_0x75e7('0x36')](function(_0x51e34a){if(_0x51e34a){var _0x3d2e59=_0x51e34a[_0x75e7('0x118')]({'plain':!![]});fs[_0x75e7('0x119')](_0x314acd);var _0x36cc6f={'format':'A4','border':_0x75e7('0x11a'),'header':{'height':_0x75e7('0x11b'),'contents':{'first':_0x75e7('0x11c')}},'footer':{'height':_0x75e7('0x11d'),'contents':{'default':util['format'](_0x75e7('0x11e'),util[_0x75e7('0xe4')](_0x75e7('0x11f'),_0x75e7('0x120'),_0x3d2e59['id']),moment()[_0x75e7('0xe4')]('YYYY-MM-DD')['toString']())}}};var _0x4e5dde={'channel':_0x75e7('0x120'),'account':_0x3d2e59['Account'][_0x75e7('0x39')],'agent':_0x3d2e59[_0x75e7('0x117')]?_0x3d2e59[_0x75e7('0x117')][_0x75e7('0x3d')]:_0x75e7('0x121'),'createdAt':moment(_0x3d2e59[_0x75e7('0x88')])[_0x75e7('0xe4')](_0x75e7('0x122'))[_0x75e7('0xa1')](),'closedAt':_0x3d2e59['closed']?moment(_0x3d2e59['closedAt'])[_0x75e7('0xe4')](_0x75e7('0x122'))[_0x75e7('0xa1')]():'','disposition':_0x3d2e59[_0x75e7('0x123')],'chatInfo':{'browser':_0x3d2e59[_0x75e7('0x124')],'os':_0x3d2e59[_0x75e7('0x125')],'referer':_0x3d2e59[_0x75e7('0x126')],'customerIp':_0x3d2e59[_0x75e7('0x127')],'customerPort':_0x3d2e59[_0x75e7('0x128')]?_0x3d2e59[_0x75e7('0x128')]:_0x75e7('0x121')},'messages':_(_0x3d2e59[_0x75e7('0xe8')])[_0x75e7('0x129')]()[_0x75e7('0x93')]({'secret':![]})[_0x75e7('0x3c')](function(_0x2a7703){if(_0x2a7703[_0x75e7('0xda')]){var _0x1fbb18=path[_0x75e7('0xe2')](_0x18286d,_0x2a7703[_0x75e7('0xda')][_0x75e7('0xd6')]);if(fs['existsSync'](_0x1fbb18)){fs[_0x75e7('0x12a')](_0x1fbb18)[_0x75e7('0x12b')](fs[_0x75e7('0x12c')](path[_0x75e7('0xe2')](_0x314acd,_0x2a7703[_0x75e7('0xda')][_0x75e7('0xd6')])));}}return{'date':moment(_0x2a7703[_0x75e7('0x88')])[_0x75e7('0xe4')](_0x75e7('0x122'))[_0x75e7('0xa1')](),'sender':_0x2a7703[_0x75e7('0x12d')]===_0x75e7('0xcc')?_0x2a7703[_0x75e7('0x7e')]?_0x2a7703[_0x75e7('0x7e')][_0x75e7('0x3d')]:_0x75e7('0xec'):_0x2a7703[_0x75e7('0x114')][_0x75e7('0x12e')]+(_0x2a7703['Contact']['lastName']?'\x20'+_0x2a7703['Contact'][_0x75e7('0x115')]:''),'body':_0x2a7703[_0x75e7('0xda')]?_0x2a7703[_0x75e7('0xda')][_0x75e7('0xd6')]:_0x2a7703[_0x75e7('0x81')],'direction':_0x2a7703[_0x75e7('0x12d')]===_0x75e7('0xcc')?'A':'C','secret':_0x2a7703[_0x75e7('0xf2')],'read':_0x2a7703[_0x75e7('0x8e')],'attachment':_0x2a7703[_0x75e7('0xda')]};})[_0x75e7('0x6d')]()};return ejs[_0x75e7('0x12f')](path['join'](config['root'],_0x75e7('0x110'),_0x75e7('0x130'),_0x75e7('0x131')),{'interaction':_0x4e5dde})[_0x75e7('0x36')](function(_0x122416){return new BPromise(function(_0x432cc0,_0x18b283){pdf[_0x75e7('0xbf')](_0x122416,_0x36cc6f)[_0x75e7('0x132')](path[_0x75e7('0xe2')](_0x314acd,'transcript-'+_0x3d2e59['id']+'-'+_0x328591+_0x75e7('0x133')),function(_0x5e0955,_0x139e73){if(_0x5e0955)return _0x18b283(_0x5e0955);_0x432cc0(_0x139e73);});});})[_0x75e7('0x36')](function(){return new BPromise(function(_0x42dcb4,_0x51882c){zipdir(_0x314acd,{'saveTo':_0x41ca66},function(_0x1886cd,_0x4f215e){if(_0x1886cd)return _0x51882c(_0x1886cd);return _0x42dcb4(_0x4f215e);});})[_0x75e7('0x36')](function(){return new BPromise(function(_0x403230,_0x42f6ba){rimraf(_0x314acd,function(_0x2727ed){if(_0x2727ed)_0x42f6ba(_0x2727ed);return _0x403230();});});})[_0x75e7('0x36')](function(){return _0x316f2d[_0x75e7('0xde')](_0x41ca66,_0x16d21c,function(_0x1b3612){if(_0x1b3612){console[_0x75e7('0x134')](_0x75e7('0x135'),_0x1b3612);}else{fs['unlinkSync'](_0x41ca66);}});});});}else{return _0x316f2d['sendStatus'](0xc8);}})[_0x75e7('0x43')](handleError(_0x316f2d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5def035..8491f8a 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 _0x38b8=['catch','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x38b8,0x7b));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x838b('0x0'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x838b('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x838b('0x2')](0x0);var events={'afterCreate':_0x838b('0x3'),'afterUpdate':_0x838b('0x4'),'afterDestroy':_0x838b('0x5')};function emitEvent(_0x3f1f73){return function(_0x4c6b93,_0x35c845,_0x45a625){_0x4c6b93['getUsers']({'attributes':['id'],'raw':!![]})[_0x838b('0x6')](function(_0x6df9f6){_0x4c6b93[_0x838b('0x7')](_0x838b('0x8'),_0x6df9f6[_0x838b('0x9')](function(_0x5687a4){return{'id':_0x5687a4['id']};}));return ChatMessage[_0x838b('0xa')]({'where':{'ChatInteractionId':_0x4c6b93['id'],'direction':'in','read':![]},'raw':!![]});})[_0x838b('0x6')](function(_0x26071b){_0x4c6b93[_0x838b('0x7')]('unreadMessages',_0x26071b[_0x838b('0xb')]);ChatInteractionEvents['emit'](_0x3f1f73+':'+_0x4c6b93['id'],_0x4c6b93);ChatInteractionEvents[_0x838b('0xc')](_0x3f1f73,_0x4c6b93);_0x45a625(null);})[_0x838b('0xd')](_0x45a625(null));};}for(var e in events){if(events[_0x838b('0xe')](e)){var event=events[e];ChatInteraction[_0x838b('0xf')](e,emitEvent(event));}}module[_0x838b('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xf604=['hook','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x689fec,_0x1f0e16){var _0x1ddefe=function(_0x5f2e8f){while(--_0x5f2e8f){_0x689fec['push'](_0x689fec['shift']());}};_0x1ddefe(++_0x1f0e16);}(_0xf604,0x122));var _0x4f60=function(_0x5e6aad,_0x3cdddd){_0x5e6aad=_0x5e6aad-0x0;var _0x55deab=_0xf604[_0x5e6aad];return _0x55deab;};'use strict';var EventEmitter=require(_0x4f60('0x0'));var ChatInteraction=require(_0x4f60('0x1'))['db'][_0x4f60('0x2')];var ChatMessage=require(_0x4f60('0x1'))['db'][_0x4f60('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f60('0x4'),'afterUpdate':_0x4f60('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4df399){return function(_0x10da6d,_0x5a37dc,_0xf4caef){_0x10da6d[_0x4f60('0x6')]({'attributes':['id'],'raw':!![]})[_0x4f60('0x7')](function(_0x154b5c){_0x10da6d[_0x4f60('0x8')](_0x4f60('0x9'),_0x154b5c[_0x4f60('0xa')](function(_0x3439d9){return{'id':_0x3439d9['id']};}));return ChatMessage[_0x4f60('0xb')]({'where':{'ChatInteractionId':_0x10da6d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f60('0x7')](function(_0x59a4f6){_0x10da6d[_0x4f60('0x8')](_0x4f60('0xc'),_0x59a4f6[_0x4f60('0xd')]);ChatInteractionEvents[_0x4f60('0xe')](_0x4df399+':'+_0x10da6d['id'],_0x10da6d);ChatInteractionEvents[_0x4f60('0xe')](_0x4df399,_0x10da6d);_0xf4caef(null);})[_0x4f60('0xf')](_0xf4caef(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4f60('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 64e6b0b..dfff318 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 _0x3374=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5c5f2f,_0x4325f3){var _0x4ecef=function(_0x94d18c){while(--_0x94d18c){_0x5c5f2f['push'](_0x5c5f2f['shift']());}};_0x4ecef(++_0x4325f3);}(_0x3374,0x6b));var _0x4337=function(_0x57cb34,_0x319287){_0x57cb34=_0x57cb34-0x0;var _0x293b47=_0x3374[_0x57cb34];return _0x293b47;};'use strict';var _=require(_0x4337('0x0'));var util=require(_0x4337('0x1'));var logger=require(_0x4337('0x2'))(_0x4337('0x3'));var moment=require(_0x4337('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4337('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x4337('0x6')]=function(_0x492ad6,_0x45adff){return _0x492ad6[_0x4337('0x7')](_0x4337('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32cba0,_0x29d4c3,_0x4073ca){if(_0x32cba0[_0x4337('0x9')](_0x4337('0xa'))){_0x32cba0[_0x4337('0xb')]=moment()['format'](_0x4337('0xc'));}_0x4073ca(null,_0x32cba0);}},'charset':_0x4337('0xd'),'collate':_0x4337('0xe')});}; \ No newline at end of file +var _0xf1df=['closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x5a5aca,_0x368fbb){var _0x1cb523=function(_0x43f690){while(--_0x43f690){_0x5a5aca['push'](_0x5a5aca['shift']());}};_0x1cb523(++_0x368fbb);}(_0xf1df,0x136));var _0xff1d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf1df[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xff1d('0x0'));var util=require('util');var logger=require(_0xff1d('0x1'))(_0xff1d('0x2'));var moment=require(_0xff1d('0x3'));var BPromise=require(_0xff1d('0x4'));var rp=require(_0xff1d('0x5'));var fs=require('fs');var path=require(_0xff1d('0x6'));var rimraf=require(_0xff1d('0x7'));var config=require(_0xff1d('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xff1d('0x9')]=function(_0x2dcf99,_0x13a293){return _0x2dcf99[_0xff1d('0xa')](_0xff1d('0xb'),attributes,{'tableName':_0xff1d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x150d0b,_0x50825e,_0x49823a){if(_0x150d0b[_0xff1d('0xd')]('closed')){_0x150d0b[_0xff1d('0xe')]=moment()['format'](_0xff1d('0xf'));}_0x49823a(null,_0x150d0b);}},'charset':_0xff1d('0x10'),'collate':_0xff1d('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 54688ca..708de93 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 _0xadd5=['ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','AddTagsToChatInteraction','addTags'];(function(_0x281305,_0x2998d6){var _0x56ffbe=function(_0x270b4c){while(--_0x270b4c){_0x281305['push'](_0x281305['shift']());}};_0x56ffbe(++_0x2998d6);}(_0xadd5,0xd0));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5add('0x0'));var util=require(_0x5add('0x1'));var moment=require(_0x5add('0x2'));var BPromise=require(_0x5add('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5add('0x4'));var db=require(_0x5add('0x5'))['db'];var utils=require(_0x5add('0x6'));var logger=require(_0x5add('0x7'))(_0x5add('0x8'));var config=require(_0x5add('0x9'));var jayson=require(_0x5add('0xa'));var client=jayson[_0x5add('0xb')]['http']({'port':0x232a});config[_0x5add('0xc')]=_[_0x5add('0xd')](config[_0x5add('0xc')],{'host':_0x5add('0xe'),'port':0x18eb});var socket=require(_0x5add('0xf'))(new Redis(config[_0x5add('0xc')]));require('./chatInteraction.socket')[_0x5add('0x10')](socket);function respondWithRpcPromise(_0x471ec3,_0x229df1,_0xf47e3){return new BPromise(function(_0x4d7933,_0x5d0863){return client['request'](_0x471ec3,_0xf47e3)[_0x5add('0x11')](function(_0x56590d){logger[_0x5add('0x12')](_0x5add('0x13'),_0x229df1,'request\x20sent');logger[_0x5add('0x14')](_0x5add('0x15'),_0x229df1,_0x5add('0x16'),JSON[_0x5add('0x17')](_0x56590d));if(_0x56590d[_0x5add('0x18')]){if(_0x56590d[_0x5add('0x18')][_0x5add('0x19')]===0x1f4){logger[_0x5add('0x18')](_0x5add('0x13'),_0x229df1,_0x56590d['error'][_0x5add('0x1a')]);return _0x5d0863(_0x56590d[_0x5add('0x18')][_0x5add('0x1a')]);}logger[_0x5add('0x18')](_0x5add('0x13'),_0x229df1,_0x56590d[_0x5add('0x18')]['message']);return _0x4d7933(_0x56590d[_0x5add('0x18')][_0x5add('0x1a')]);}else{logger[_0x5add('0x12')](_0x5add('0x13'),_0x229df1,_0x5add('0x16'));_0x4d7933(_0x56590d[_0x5add('0x1b')][_0x5add('0x1a')]);}})[_0x5add('0x1c')](function(_0x5e3f44){logger['error'](_0x5add('0x13'),_0x229df1,_0x5e3f44);_0x5d0863(_0x5e3f44);});});}exports[_0x5add('0x1d')]=function(_0x325d5c){var _0x32d5c8=this;return new Promise(function(_0x56475a,_0x3f8d45){return db[_0x5add('0x1e')]['update'](_0x325d5c[_0x5add('0x1f')],{'raw':_0x325d5c[_0x5add('0x20')]?_0x325d5c[_0x5add('0x20')][_0x5add('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325d5c[_0x5add('0x20')]?_0x325d5c[_0x5add('0x20')][_0x5add('0x22')]||null:null,'attributes':_0x325d5c[_0x5add('0x20')]?_0x325d5c[_0x5add('0x20')][_0x5add('0x23')]||null:null,'limit':_0x325d5c[_0x5add('0x20')]?_0x325d5c[_0x5add('0x20')]['limit']||null:null})[_0x5add('0x11')](function(_0x55dc87){logger['info'](_0x5add('0x1d'),_0x325d5c);logger[_0x5add('0x14')]('UpdateChatInteraction',_0x325d5c,JSON[_0x5add('0x17')](_0x55dc87));_0x56475a(_0x55dc87);})[_0x5add('0x1c')](function(_0x503094){logger[_0x5add('0x18')](_0x5add('0x1d'),_0x503094[_0x5add('0x1a')],_0x325d5c);_0x3f8d45(_0x32d5c8[_0x5add('0x18')](0x1f4,_0x503094[_0x5add('0x1a')]));});});};exports[_0x5add('0x24')]=function(_0xd77162){return new Promise(function(_0xca172e,_0x1ec5f8){return db[_0x5add('0x1e')]['find']({'where':_0xd77162['options']?_0xd77162[_0x5add('0x20')][_0x5add('0x22')]||null:null})[_0x5add('0x11')](function(_0x27fdbc){if(_0x27fdbc){return _0x27fdbc[_0x5add('0x25')](_0xd77162[_0x5add('0x1f')][_0x5add('0x26')],_[_0x5add('0x27')](_0xd77162[_0x5add('0x1f')],['ids','id'])||{});}})['spread'](function(_0x5a2d90){logger['info'](_0x5add('0x28'),_0xd77162);logger[_0x5add('0x14')]('AddTags',_0xd77162,JSON[_0x5add('0x17')](_0x5a2d90));_0xca172e(_0x5a2d90);})['catch'](function(_0x487a83){logger['error']('AddTags',_0x487a83[_0x5add('0x1a')],_0xd77162);_0x1ec5f8(_this['error'](0x1f4,_0x487a83[_0x5add('0x1a')]));});});}; \ No newline at end of file +var _0xa7f2=['request\x20sent','result','UpdateChatInteraction','update','body','options','raw','attributes','limit','stringify','catch','ChatInteraction','find','where','addTags','ids','omit','spread','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x43a6b3,_0x149718){var _0x525b9b=function(_0x1a8fab){while(--_0x1a8fab){_0x43a6b3['push'](_0x43a6b3['shift']());}};_0x525b9b(++_0x149718);}(_0xa7f2,0xda));var _0x2a7f=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0xa7f2[_0x3b826d];return _0x38e1b3;};'use strict';var _=require(_0x2a7f('0x0'));var util=require('util');var moment=require(_0x2a7f('0x1'));var BPromise=require(_0x2a7f('0x2'));var rs=require(_0x2a7f('0x3'));var fs=require('fs');var Redis=require(_0x2a7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a7f('0x5'));var logger=require(_0x2a7f('0x6'))(_0x2a7f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a7f('0x8')][_0x2a7f('0x9')]({'port':0x232a});config[_0x2a7f('0xa')]=_[_0x2a7f('0xb')](config[_0x2a7f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a7f('0xc'))(new Redis(config[_0x2a7f('0xa')]));require('./chatInteraction.socket')[_0x2a7f('0xd')](socket);function respondWithRpcPromise(_0x59d1d0,_0x12d3c0,_0x1567d8){return new BPromise(function(_0x4ff048,_0x5cd5a7){return client['request'](_0x59d1d0,_0x1567d8)[_0x2a7f('0xe')](function(_0x48c0c8){logger[_0x2a7f('0xf')](_0x2a7f('0x10'),_0x12d3c0,'request\x20sent');logger[_0x2a7f('0x11')](_0x2a7f('0x12'),_0x12d3c0,'request\x20sent',JSON['stringify'](_0x48c0c8));if(_0x48c0c8[_0x2a7f('0x13')]){if(_0x48c0c8[_0x2a7f('0x13')][_0x2a7f('0x14')]===0x1f4){logger[_0x2a7f('0x13')](_0x2a7f('0x10'),_0x12d3c0,_0x48c0c8[_0x2a7f('0x13')][_0x2a7f('0x15')]);return _0x5cd5a7(_0x48c0c8['error']['message']);}logger[_0x2a7f('0x13')](_0x2a7f('0x10'),_0x12d3c0,_0x48c0c8[_0x2a7f('0x13')][_0x2a7f('0x15')]);return _0x4ff048(_0x48c0c8[_0x2a7f('0x13')][_0x2a7f('0x15')]);}else{logger[_0x2a7f('0xf')](_0x2a7f('0x10'),_0x12d3c0,_0x2a7f('0x16'));_0x4ff048(_0x48c0c8[_0x2a7f('0x17')]['message']);}})['catch'](function(_0x3261dd){logger[_0x2a7f('0x13')](_0x2a7f('0x10'),_0x12d3c0,_0x3261dd);_0x5cd5a7(_0x3261dd);});});}exports[_0x2a7f('0x18')]=function(_0x2dd8fb){var _0x1438d6=this;return new Promise(function(_0x5c215e,_0x459023){return db['ChatInteraction'][_0x2a7f('0x19')](_0x2dd8fb[_0x2a7f('0x1a')],{'raw':_0x2dd8fb[_0x2a7f('0x1b')]?_0x2dd8fb[_0x2a7f('0x1b')][_0x2a7f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dd8fb[_0x2a7f('0x1b')]?_0x2dd8fb['options']['where']||null:null,'attributes':_0x2dd8fb[_0x2a7f('0x1b')]?_0x2dd8fb[_0x2a7f('0x1b')][_0x2a7f('0x1d')]||null:null,'limit':_0x2dd8fb[_0x2a7f('0x1b')]?_0x2dd8fb[_0x2a7f('0x1b')][_0x2a7f('0x1e')]||null:null})['then'](function(_0x20596c){logger[_0x2a7f('0xf')](_0x2a7f('0x18'),_0x2dd8fb);logger[_0x2a7f('0x11')]('UpdateChatInteraction',_0x2dd8fb,JSON[_0x2a7f('0x1f')](_0x20596c));_0x5c215e(_0x20596c);})[_0x2a7f('0x20')](function(_0x147a33){logger[_0x2a7f('0x13')](_0x2a7f('0x18'),_0x147a33[_0x2a7f('0x15')],_0x2dd8fb);_0x459023(_0x1438d6['error'](0x1f4,_0x147a33['message']));});});};exports['AddTagsToChatInteraction']=function(_0x5ab960){return new Promise(function(_0x2b631b,_0x24c601){return db[_0x2a7f('0x21')][_0x2a7f('0x22')]({'where':_0x5ab960[_0x2a7f('0x1b')]?_0x5ab960[_0x2a7f('0x1b')][_0x2a7f('0x23')]||null:null})[_0x2a7f('0xe')](function(_0x5b30c3){if(_0x5b30c3){return _0x5b30c3[_0x2a7f('0x24')](_0x5ab960[_0x2a7f('0x1a')][_0x2a7f('0x25')],_[_0x2a7f('0x26')](_0x5ab960[_0x2a7f('0x1a')],[_0x2a7f('0x25'),'id'])||{});}})[_0x2a7f('0x27')](function(_0x7d796b){logger[_0x2a7f('0xf')]('AddTags',_0x5ab960);logger[_0x2a7f('0x11')]('AddTags',_0x5ab960,JSON[_0x2a7f('0x1f')](_0x7d796b));_0x2b631b(_0x7d796b);})[_0x2a7f('0x20')](function(_0x45163b){logger[_0x2a7f('0x13')]('AddTags',_0x45163b[_0x2a7f('0x15')],_0x5ab960);_0x24c601(_this[_0x2a7f('0x13')](0x1f4,_0x45163b[_0x2a7f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index de41c31..63aa915 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 _0xfe59=['length','update','emit','register'];(function(_0x2ce6a6,_0x58e423){var _0x52611d=function(_0x30fa43){while(--_0x30fa43){_0x2ce6a6['push'](_0x2ce6a6['shift']());}};_0x52611d(++_0x58e423);}(_0xfe59,0xdd));var _0x9fe5=function(_0x4ad58c,_0x200d00){_0x4ad58c=_0x4ad58c-0x0;var _0x421f8a=_0xfe59[_0x4ad58c];return _0x421f8a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0x9fe5('0x0')];function createListener(_0x1ddee1,_0x4847f7){return function(_0x1bd870){_0x4847f7[_0x9fe5('0x1')](_0x1ddee1,_0x1bd870);};}function removeListener(_0x4c61fc,_0x8e0491){return function(){ChatInteractionEvents['removeListener'](_0x4c61fc,_0x8e0491);};}exports[_0x9fe5('0x2')]=function(_0x4c1184){for(var _0x17d397=0x0,_0x2cb74d=events[_0x9fe5('0x3')];_0x17d397<_0x2cb74d;_0x17d397++){var _0x489ae2=events[_0x17d397];var _0x59b628=createListener('chatInteraction:'+_0x489ae2,_0x4c1184);ChatInteractionEvents['on'](_0x489ae2,_0x59b628);}}; \ No newline at end of file +var _0x77b0=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x77b0,0x144));var _0x077b=function(_0x4eb4d9,_0x5d9847){_0x4eb4d9=_0x4eb4d9-0x0;var _0x2a6305=_0x77b0[_0x4eb4d9];return _0x2a6305;};'use strict';var ChatInteractionEvents=require(_0x077b('0x0'));var events=[_0x077b('0x1'),_0x077b('0x2'),_0x077b('0x3')];function createListener(_0x373f0d,_0x2f93a7){return function(_0x5313e7){_0x2f93a7['emit'](_0x373f0d,_0x5313e7);};}function removeListener(_0x11e082,_0x1f156b){return function(){ChatInteractionEvents[_0x077b('0x4')](_0x11e082,_0x1f156b);};}exports[_0x077b('0x5')]=function(_0x526ccd){for(var _0x4fd8e7=0x0,_0x31e7d2=events[_0x077b('0x6')];_0x4fd8e7<_0x31e7d2;_0x4fd8e7++){var _0x216e43=events[_0x4fd8e7];var _0x17a2e5=createListener(_0x077b('0x7')+_0x216e43,_0x526ccd);ChatInteractionEvents['on'](_0x216e43,_0x17a2e5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4d5e401..188f398 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 _0xac75=['createVidaooSession','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac75,0x12a));var _0x5ac7=function(_0x1c1a4d,_0x46b403){_0x1c1a4d=_0x1c1a4d-0x0;var _0x3c17ea=_0xac75[_0x1c1a4d];return _0x3c17ea;};'use strict';var multer=require(_0x5ac7('0x0'));var util=require(_0x5ac7('0x1'));var path=require(_0x5ac7('0x2'));var timeout=require(_0x5ac7('0x3'));var express=require(_0x5ac7('0x4'));var router=express[_0x5ac7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5ac7('0x6'));var config=require(_0x5ac7('0x7'));var controller=require(_0x5ac7('0x8'));router[_0x5ac7('0x9')]('/',auth[_0x5ac7('0xa')](),controller[_0x5ac7('0xb')]);router[_0x5ac7('0x9')](_0x5ac7('0xc'),auth[_0x5ac7('0xa')](),controller['describe']);router['get'](_0x5ac7('0xd'),auth[_0x5ac7('0xe')](),controller[_0x5ac7('0xf')]);router['get'](_0x5ac7('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x5ac7('0x11')]);router[_0x5ac7('0x9')](_0x5ac7('0x12'),auth['isAuthenticated'](),controller[_0x5ac7('0x13')]);router['get'](_0x5ac7('0x14'),auth[_0x5ac7('0xe')](),controller[_0x5ac7('0x15')]);router[_0x5ac7('0x9')](_0x5ac7('0x16'),auth[_0x5ac7('0xa')](),controller['download']);router[_0x5ac7('0x17')]('/',auth[_0x5ac7('0xa')](),controller[_0x5ac7('0x18')]);router['post'](_0x5ac7('0x19'),auth[_0x5ac7('0xa')](),controller[_0x5ac7('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x59da74,_0x10d691,_0x5f54e6){_0x5f54e6(null,path['join'](config[_0x5ac7('0x1b')],_0x5ac7('0x1c')));},'filename':function(_0x5d8ffb,_0x8696eb,_0x5690a5){_0x5690a5(null,util['format'](_0x5ac7('0x1d'),Date[_0x5ac7('0x1e')](),_0x8696eb[_0x5ac7('0x1f')][_0x5ac7('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5ac7('0x17')](_0x5ac7('0x21'),upload[_0x5ac7('0x22')](_0x5ac7('0x23')),controller[_0x5ac7('0x24')]);router[_0x5ac7('0x17')]('/:id/messages',auth[_0x5ac7('0xe')](),controller['addMessage']);router[_0x5ac7('0x17')](_0x5ac7('0x25'),auth[_0x5ac7('0xa')](),interaction[_0x5ac7('0x26')](_0x5ac7('0x27'),_0x5ac7('0x28')),controller[_0x5ac7('0x29')]);router['put']('/:id',auth[_0x5ac7('0xa')](),interaction[_0x5ac7('0x26')](_0x5ac7('0x27'),_0x5ac7('0x2a')),controller[_0x5ac7('0x2b')]);router[_0x5ac7('0x2c')]('/:id/custom_update',controller[_0x5ac7('0x2d')]);router[_0x5ac7('0x2c')](_0x5ac7('0x2e'),auth[_0x5ac7('0xe')](),controller[_0x5ac7('0x2f')]);router['put'](_0x5ac7('0x30'),controller[_0x5ac7('0x31')]);router[_0x5ac7('0x32')]('/:id',auth[_0x5ac7('0xa')](),interaction[_0x5ac7('0x26')](_0x5ac7('0x27'),_0x5ac7('0x33')),controller[_0x5ac7('0x34')]);router[_0x5ac7('0x32')]('/:id/tags',auth[_0x5ac7('0xa')](),controller['removeTags']);module[_0x5ac7('0x35')]=router; \ No newline at end of file +var _0x297a=['get','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','download','/:id/vidaoo','diskStorage','join','root','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/abandon','abandon','/:id/close','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','describe','/:id','isChatInteractionAuthorized'];(function(_0x2c07b9,_0x105ee4){var _0x2dfec3=function(_0x58f3be){while(--_0x58f3be){_0x2c07b9['push'](_0x2c07b9['shift']());}};_0x2dfec3(++_0x105ee4);}(_0x297a,0x128));var _0xa297=function(_0x1a8fa9,_0xdd4b72){_0x1a8fa9=_0x1a8fa9-0x0;var _0x2ac523=_0x297a[_0x1a8fa9];return _0x2ac523;};'use strict';var multer=require('multer');var util=require(_0xa297('0x0'));var path=require(_0xa297('0x1'));var timeout=require(_0xa297('0x2'));var express=require(_0xa297('0x3'));var router=express[_0xa297('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa297('0x5'));var config=require(_0xa297('0x6'));var controller=require(_0xa297('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xa297('0x8')](),controller[_0xa297('0x9')]);router['get'](_0xa297('0xa'),auth[_0xa297('0xb')](),controller['show']);router[_0xa297('0xc')](_0xa297('0xd'),auth[_0xa297('0xb')](),controller[_0xa297('0xe')]);router[_0xa297('0xc')]('/:id/messages',auth[_0xa297('0x8')](),controller[_0xa297('0xf')]);router[_0xa297('0xc')](_0xa297('0x10'),auth[_0xa297('0xb')](),controller['getMyMessages']);router[_0xa297('0xc')]('/:id/download',auth[_0xa297('0x8')](),controller[_0xa297('0x11')]);router['post']('/',auth[_0xa297('0x8')](),controller['create']);router['post'](_0xa297('0x12'),auth[_0xa297('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xa297('0x13')]({'destination':function(_0x475226,_0xb13681,_0x4ea0b8){_0x4ea0b8(null,path[_0xa297('0x14')](config[_0xa297('0x15')],'server/files/attachments/'));},'filename':function(_0x60dff7,_0x596ab6,_0x15d409){_0x15d409(null,util['format'](_0xa297('0x16'),Date['now'](),_0x596ab6[_0xa297('0x17')][_0xa297('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa297('0x19'),upload[_0xa297('0x1a')](_0xa297('0x1b')),controller[_0xa297('0x1c')]);router['post'](_0xa297('0x1d'),auth[_0xa297('0xb')](),controller[_0xa297('0x1e')]);router['post'](_0xa297('0x1f'),auth[_0xa297('0x8')](),interaction[_0xa297('0x20')](_0xa297('0x21'),_0xa297('0x22')),controller['addTags']);router[_0xa297('0x23')](_0xa297('0xa'),auth[_0xa297('0x8')](),interaction[_0xa297('0x20')](_0xa297('0x21'),_0xa297('0x24')),controller[_0xa297('0x25')]);router[_0xa297('0x23')]('/:id/custom_update',controller['customUpdate']);router[_0xa297('0x23')](_0xa297('0x26'),auth[_0xa297('0xb')](),controller[_0xa297('0x27')]);router[_0xa297('0x23')](_0xa297('0x28'),controller['close']);router['delete'](_0xa297('0xa'),auth[_0xa297('0x8')](),interaction[_0xa297('0x20')](_0xa297('0x21'),'chatinteraction:destroy'),controller['destroy']);router[_0xa297('0x29')]('/:id/tags',auth[_0xa297('0x8')](),controller[_0xa297('0x2a')]);module[_0xa297('0x2b')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c303aab..a8f456a 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 _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4975,0x86));var _0x5497=function(_0x2b822c,_0x3a8595){_0x2b822c=_0x2b822c-0x0;var _0x13f886=_0x4975[_0x2b822c];return _0x13f886;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x231e21,_0x4542c6){var _0x5432c3=function(_0x5f3cbf){while(--_0x5f3cbf){_0x231e21['push'](_0x231e21['shift']());}};_0x5432c3(++_0x4542c6);}(_0x57ca,0x108));var _0xa57c=function(_0x4b2241,_0x12ad87){_0x4b2241=_0x4b2241-0x0;var _0x3da870=_0x57ca[_0x4b2241];return _0x3da870;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d3505d8..9e4401b 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 _0x2fad=['count','offset','limit','set','Content-Range','apply','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','show','create','catch','update','body','find','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','agent','push','createdAt','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','status','end','json'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2fad,0x127));var _0xd2fa=function(_0x4dd479,_0x26d87a){_0x4dd479=_0x4dd479-0x0;var _0x1b6807=_0x2fad[_0x4dd479];return _0x1b6807;};'use strict';var pdf=require(_0xd2fa('0x0'));var emlformat=require(_0xd2fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd2fa('0x2'));var jsonpatch=require(_0xd2fa('0x3'));var rp=require(_0xd2fa('0x4'));var moment=require(_0xd2fa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd2fa('0x6'));var util=require(_0xd2fa('0x7'));var path=require(_0xd2fa('0x8'));var sox=require(_0xd2fa('0x9'));var csv=require('to-csv');var ejs=require(_0xd2fa('0xa'));var fs=require('fs');var _=require(_0xd2fa('0xb'));var squel=require(_0xd2fa('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd2fa('0xd'));var toCsv=require(_0xd2fa('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd2fa('0xf'));var authService=require(_0xd2fa('0x10'));var qs=require(_0xd2fa('0x11'));var as=require(_0xd2fa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2fa('0x13'))('api');var utils=require(_0xd2fa('0x14'));var config=require(_0xd2fa('0x15'));var licenseUtil=require(_0xd2fa('0x16'));var db=require(_0xd2fa('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd2fa('0x18'),'port':0x18eb});var socket=require(_0xd2fa('0x19'))(new Redis(config[_0xd2fa('0x1a')]));require(_0xd2fa('0x1b'))[_0xd2fa('0x1c')](socket);function respondWithStatusCode(_0xaeafd3,_0x5b314a){_0x5b314a=_0x5b314a||0xcc;return function(_0x50203e){if(_0x50203e){return _0xaeafd3['sendStatus'](_0x5b314a);}return _0xaeafd3[_0xd2fa('0x1d')](_0x5b314a)[_0xd2fa('0x1e')]();};}function respondWithResult(_0x438be3,_0x25fbc5){_0x25fbc5=_0x25fbc5||0xc8;return function(_0x1462d2){if(_0x1462d2){return _0x438be3[_0xd2fa('0x1d')](_0x25fbc5)[_0xd2fa('0x1f')](_0x1462d2);}};}function respondWithFilteredResult(_0x6eb3b1,_0x410719){return function(_0x4ce638){if(_0x4ce638){var _0x20e933=_0x4ce638[_0xd2fa('0x20')],_0x86cc92=_0x410719['offset'],_0x535417=_0x410719[_0xd2fa('0x21')]+_0x410719[_0xd2fa('0x22')],_0x535e0d;if(_0x535417>=_0x20e933){_0x535417=_0x20e933;_0x535e0d=0xc8;}else{_0x535e0d=0xce;}_0x6eb3b1[_0xd2fa('0x1d')](_0x535e0d);return _0x6eb3b1[_0xd2fa('0x23')](_0xd2fa('0x24'),_0x86cc92+'-'+_0x535417+'/'+_0x20e933)['json'](_0x4ce638);}return null;};}function patchUpdates(_0x53adf1){return function(_0xd4f109){try{jsonpatch[_0xd2fa('0x25')](_0xd4f109,_0x53adf1,!![]);}catch(_0x568812){return BPromise['reject'](_0x568812);}return _0xd4f109['save']();};}function saveUpdates(_0x308e46,_0x167d62){return function(_0x103c78){if(_0x103c78){return _0x103c78['update'](_0x308e46)['then'](function(_0x37734b){return _0x37734b;});}return null;};}function removeEntity(_0x2356c6,_0x2377b7){return function(_0x48e74d){if(_0x48e74d){return _0x48e74d[_0xd2fa('0x26')]()['then'](function(){_0x2356c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12e06c,_0x2c0624){return function(_0x29f577){if(!_0x29f577){_0x12e06c['sendStatus'](0x194);}return _0x29f577;};}function handleError(_0x59ffdd,_0x16feb5){_0x16feb5=_0x16feb5||0x1f4;return function(_0x25855b){logger[_0xd2fa('0x27')](_0x25855b['stack']);if(_0x25855b['name']){delete _0x25855b[_0xd2fa('0x28')];}_0x59ffdd['status'](_0x16feb5)[_0xd2fa('0x29')](_0x25855b);};}exports[_0xd2fa('0x2a')]=function(_0x33f393,_0x4a9393){var _0x4e5561={},_0x33d62c={},_0x4ae57e={'count':0x0,'rows':[]};var _0xdcb87c=_['map'](db[_0xd2fa('0x2b')][_0xd2fa('0x2c')],function(_0xf162d0){return{'name':_0xf162d0[_0xd2fa('0x2d')],'type':_0xf162d0[_0xd2fa('0x2e')][_0xd2fa('0x2f')]};});_0x33d62c['model']=_[_0xd2fa('0x30')](_0xdcb87c,_0xd2fa('0x28'));_0x33d62c['query']=_[_0xd2fa('0x31')](_0x33f393[_0xd2fa('0x32')]);_0x33d62c[_0xd2fa('0x33')]=_[_0xd2fa('0x34')](_0x33d62c[_0xd2fa('0x35')],_0x33d62c['query']);_0x4e5561[_0xd2fa('0x36')]=_['intersection'](_0x33d62c[_0xd2fa('0x35')],qs[_0xd2fa('0x37')](_0x33f393[_0xd2fa('0x32')][_0xd2fa('0x37')]));_0x4e5561[_0xd2fa('0x36')]=_0x4e5561[_0xd2fa('0x36')][_0xd2fa('0x38')]?_0x4e5561[_0xd2fa('0x36')]:_0x33d62c[_0xd2fa('0x35')];if(!_0x33f393[_0xd2fa('0x32')][_0xd2fa('0x39')](_0xd2fa('0x3a'))){_0x4e5561['limit']=qs['limit'](_0x33f393[_0xd2fa('0x32')]['limit']);_0x4e5561[_0xd2fa('0x21')]=qs[_0xd2fa('0x21')](_0x33f393[_0xd2fa('0x32')][_0xd2fa('0x21')]);}_0x4e5561[_0xd2fa('0x3b')]=qs['sort'](_0x33f393[_0xd2fa('0x32')][_0xd2fa('0x3c')]);_0x4e5561[_0xd2fa('0x3d')]=qs[_0xd2fa('0x33')](_[_0xd2fa('0x3e')](_0x33f393[_0xd2fa('0x32')],_0x33d62c[_0xd2fa('0x33')]),_0xdcb87c);if(_0x33f393[_0xd2fa('0x32')][_0xd2fa('0x3f')]){_0x4e5561[_0xd2fa('0x3d')]=_[_0xd2fa('0x40')](_0x4e5561[_0xd2fa('0x3d')],{'$or':_['map'](_0xdcb87c,function(_0x59c6e6){if(_0x59c6e6[_0xd2fa('0x2e')]!==_0xd2fa('0x41')){var _0x22cadd={};_0x22cadd[_0x59c6e6[_0xd2fa('0x28')]]={'$like':'%'+_0x33f393['query'][_0xd2fa('0x3f')]+'%'};return _0x22cadd;}})});}_0x4e5561=_['merge']({},_0x4e5561,_0x33f393['options']);var _0x186a00={'where':_0x4e5561[_0xd2fa('0x3d')]};return db[_0xd2fa('0x2b')][_0xd2fa('0x20')](_0x186a00)[_0xd2fa('0x42')](function(_0x5ae2d4){_0x4ae57e[_0xd2fa('0x20')]=_0x5ae2d4;if(_0x33f393['query'][_0xd2fa('0x43')]){_0x4e5561[_0xd2fa('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4e5561);})[_0xd2fa('0x42')](function(_0x58fbbb){_0x4ae57e['rows']=_0x58fbbb;return _0x4ae57e;})[_0xd2fa('0x42')](respondWithFilteredResult(_0x4a9393,_0x4e5561))['catch'](handleError(_0x4a9393,null));};exports[_0xd2fa('0x45')]=function(_0x33a146,_0x5d4239){var _0x538e03={'raw':!![],'where':{'id':_0x33a146['params']['id']}},_0x4e8efd={};_0x4e8efd[_0xd2fa('0x35')]=_[_0xd2fa('0x31')](db[_0xd2fa('0x2b')][_0xd2fa('0x2c')]);_0x4e8efd['query']=_['keys'](_0x33a146[_0xd2fa('0x32')]);_0x4e8efd[_0xd2fa('0x33')]=_[_0xd2fa('0x34')](_0x4e8efd[_0xd2fa('0x35')],_0x4e8efd[_0xd2fa('0x32')]);_0x538e03[_0xd2fa('0x36')]=_[_0xd2fa('0x34')](_0x4e8efd[_0xd2fa('0x35')],qs[_0xd2fa('0x37')](_0x33a146[_0xd2fa('0x32')][_0xd2fa('0x37')]));_0x538e03[_0xd2fa('0x36')]=_0x538e03[_0xd2fa('0x36')][_0xd2fa('0x38')]?_0x538e03[_0xd2fa('0x36')]:_0x4e8efd[_0xd2fa('0x35')];if(_0x33a146['query'][_0xd2fa('0x43')]){_0x538e03[_0xd2fa('0x44')]=[{'all':!![]}];}_0x538e03=_[_0xd2fa('0x40')]({},_0x538e03,_0x33a146['options']);return db['ChatInternalMessage']['find'](_0x538e03)['then'](handleEntityNotFound(_0x5d4239,null))[_0xd2fa('0x42')](respondWithResult(_0x5d4239,null))['catch'](handleError(_0x5d4239,null));};exports['create']=function(_0x2509b7,_0x44a53d){return db[_0xd2fa('0x2b')][_0xd2fa('0x46')](_0x2509b7['body'],{})[_0xd2fa('0x42')](respondWithResult(_0x44a53d,0xc9))[_0xd2fa('0x47')](handleError(_0x44a53d,null));};exports[_0xd2fa('0x48')]=function(_0x5549b4,_0x1e1b5b){if(_0x5549b4[_0xd2fa('0x49')]['id']){delete _0x5549b4[_0xd2fa('0x49')]['id'];}return db[_0xd2fa('0x2b')][_0xd2fa('0x4a')]({'where':{'id':_0x5549b4['params']['id']}})[_0xd2fa('0x42')](handleEntityNotFound(_0x1e1b5b,null))[_0xd2fa('0x42')](saveUpdates(_0x5549b4[_0xd2fa('0x49')],null))[_0xd2fa('0x42')](respondWithResult(_0x1e1b5b,null))[_0xd2fa('0x47')](handleError(_0x1e1b5b,null));};exports[_0xd2fa('0x26')]=function(_0x4349da,_0x1fb722){return db[_0xd2fa('0x2b')][_0xd2fa('0x4a')]({'where':{'id':_0x4349da['params']['id']}})[_0xd2fa('0x42')](handleEntityNotFound(_0x1fb722,null))[_0xd2fa('0x42')](removeEntity(_0x1fb722,null))[_0xd2fa('0x47')](handleError(_0x1fb722,null));};exports[_0xd2fa('0x4b')]=function(_0x23bb53,_0x25ccf4){return db[_0xd2fa('0x2b')]['describe']()[_0xd2fa('0x42')](respondWithResult(_0x25ccf4,null))[_0xd2fa('0x47')](handleError(_0x25ccf4,null));};function wrapUser(_0x33d14d){return function(_0x454476){var _0x400278=_0x33d14d[_0xd2fa('0x4c')]({'plain':!![]});_0x400278[_0xd2fa('0x4d')]=[];if(_0x454476){_0x400278[_0xd2fa('0x4e')]=_0x454476['createdAt'];_0x400278['lastMessage']=_0x454476;}else{_0x400278[_0xd2fa('0x4e')]=moment(0x0)[_0xd2fa('0x4f')](_0xd2fa('0x50'));_0x400278[_0xd2fa('0x51')]={};}return _0x400278;};}exports[_0xd2fa('0x52')]=function(_0x5263dd,_0x34b035,_0x3909b6){var _0x4d4840=[];return db[_0xd2fa('0x53')][_0xd2fa('0x54')]({'where':{'role':['agent',_0xd2fa('0x55'),_0xd2fa('0x56')]},'attributes':['id',_0xd2fa('0x57'),_0xd2fa('0x28'),_0xd2fa('0x58'),_0xd2fa('0x59'),_0xd2fa('0x5a'),_0xd2fa('0x5b'),_0xd2fa('0x5c'),_0xd2fa('0x5d'),_0xd2fa('0x5e')],'order':qs[_0xd2fa('0x3c')]('-online'),'include':[{'model':db[_0xd2fa('0x5f')],'as':'VoiceQueues','attributes':['id',_0xd2fa('0x28'),_0xd2fa('0x2e')],'through':{'attributes':[]}}]})[_0xd2fa('0x42')](function(_0x11c1f4){if(_0x11c1f4){var _0x28a1c9=_0x5263dd['user'][_0xd2fa('0x4c')]({'plain':!![]});if(!_0x28a1c9)throw new Error(_0xd2fa('0x60'));if(_0x28a1c9[_0xd2fa('0x58')]===_0xd2fa('0x56')){return db['UserProfileSection'][_0xd2fa('0x4a')]({'where':{'name':_0xd2fa('0x61'),'userProfileId':_0x28a1c9[_0xd2fa('0x62')]},'raw':!![]})['then'](function(_0x3b89e9){if(_0x3b89e9){if(_0x3b89e9['autoAssociation']===0x0){return db[_0xd2fa('0x63')][_0xd2fa('0x54')]({'where':{'sectionId':_0x3b89e9['id']},'raw':!![]})['then'](function(_0x24dcbc){var _0x3f1228=[];if(_[_0xd2fa('0x64')](_0x24dcbc)){_0x3f1228=_[_0xd2fa('0x3f')](_0x11c1f4,function(_0x570298){if(_0x570298[_0xd2fa('0x58')]!==_0xd2fa('0x65')){return _0x570298;}});return _0x3f1228;}else{for(var _0x2692ba=0x0;_0x2692ba<_0x11c1f4[_0xd2fa('0x38')];_0x2692ba++){var _0x4c9bc3=_0x11c1f4[_0x2692ba];if(_0x4c9bc3[_0xd2fa('0x58')]===_0xd2fa('0x65')){var _0x5401d5=_['find'](_0x24dcbc,function(_0x1e0824){return _0x1e0824['resourceId']===_0x4c9bc3['id'];});if(_0x5401d5)_0x3f1228[_0xd2fa('0x66')](_0x4c9bc3);}else{_0x3f1228[_0xd2fa('0x66')](_0x4c9bc3);}}return _0x3f1228;}});}else{return _0x11c1f4;}}else{var _0x4d40ec=_[_0xd2fa('0x3f')](_0x11c1f4,function(_0x1f99ab){if(_0x1f99ab[_0xd2fa('0x58')]!==_0xd2fa('0x65')){return _0x1f99ab;}});return _0x4d40ec;}});}else{return _0x11c1f4;}}})['then'](function(_0x3c12ad){var _0x2703cf=[];if(_0x3c12ad){_0x4d4840=_0x3c12ad;for(var _0x1ff682=0x0;_0x1ff682<_0x3c12ad['length'];_0x1ff682+=0x1){_0x4d4840[_0x1ff682][_0xd2fa('0x4d')]=[];_0x2703cf['push'](db[_0xd2fa('0x2b')]['find']({'where':{'FromId':[_0x5263dd[_0xd2fa('0x56')]['id'],_0x3c12ad[_0x1ff682]['id']],'ToId':[_0x5263dd[_0xd2fa('0x56')]['id'],_0x3c12ad[_0x1ff682]['id']],'ChatGroupId':null},'attributes':['id',_0xd2fa('0x67'),_0xd2fa('0x68'),_0xd2fa('0x69'),_0xd2fa('0x6a'),_0xd2fa('0x49')],'order':qs[_0xd2fa('0x3c')](_0xd2fa('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd2fa('0x42')](wrapUser(_0x3c12ad[_0x1ff682])));}return BPromise[_0xd2fa('0x6c')](_0x2703cf);}return[];})[_0xd2fa('0x42')](function(_0x47ab51){return{'rows':_0x47ab51,'count':_0x47ab51[_0xd2fa('0x38')]};})['then'](respondWithResult(_0x34b035,null))[_0xd2fa('0x47')](handleError(_0x34b035,null));}; \ No newline at end of file +var _0x3edc=['User','findAll','agent','admin','fullname','role','userpic','internal','online','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','index','ChatInternalMessage','rawAttributes','type','map','keys','intersection','model','attributes','query','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x3edc,0x160));var _0xc3ed=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x3edc[_0x5774be];return _0x4914b4;};'use strict';var pdf=require(_0xc3ed('0x0'));var emlformat=require(_0xc3ed('0x1'));var rimraf=require(_0xc3ed('0x2'));var zipdir=require(_0xc3ed('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3ed('0x4'));var moment=require('moment');var BPromise=require(_0xc3ed('0x5'));var Mustache=require(_0xc3ed('0x6'));var util=require('util');var path=require(_0xc3ed('0x7'));var sox=require(_0xc3ed('0x8'));var csv=require('to-csv');var ejs=require(_0xc3ed('0x9'));var fs=require('fs');var _=require(_0xc3ed('0xa'));var squel=require(_0xc3ed('0xb'));var crypto=require(_0xc3ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3ed('0xd'));var toCsv=require(_0xc3ed('0xe'));var querystring=require(_0xc3ed('0xf'));var Papa=require(_0xc3ed('0x10'));var Redis=require(_0xc3ed('0x11'));var authService=require(_0xc3ed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc3ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3ed('0x14'))(_0xc3ed('0x15'));var utils=require(_0xc3ed('0x16'));var config=require(_0xc3ed('0x17'));var licenseUtil=require(_0xc3ed('0x18'));var db=require(_0xc3ed('0x19'))['db'];config[_0xc3ed('0x1a')]=_[_0xc3ed('0x1b')](config[_0xc3ed('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3ed('0x1a')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x2b2ced,_0x13863b){_0x13863b=_0x13863b||0xcc;return function(_0xa88b1a){if(_0xa88b1a){return _0x2b2ced[_0xc3ed('0x1c')](_0x13863b);}return _0x2b2ced[_0xc3ed('0x1d')](_0x13863b)[_0xc3ed('0x1e')]();};}function respondWithResult(_0x442337,_0x2fb91f){_0x2fb91f=_0x2fb91f||0xc8;return function(_0x4a42b1){if(_0x4a42b1){return _0x442337[_0xc3ed('0x1d')](_0x2fb91f)[_0xc3ed('0x1f')](_0x4a42b1);}};}function respondWithFilteredResult(_0x5906fe,_0x13e807){return function(_0x226382){if(_0x226382){var _0x3bddaf=_0x226382['count'],_0x193eb4=_0x13e807[_0xc3ed('0x20')],_0x4115ad=_0x13e807[_0xc3ed('0x20')]+_0x13e807['limit'],_0x168960;if(_0x4115ad>=_0x3bddaf){_0x4115ad=_0x3bddaf;_0x168960=0xc8;}else{_0x168960=0xce;}_0x5906fe[_0xc3ed('0x1d')](_0x168960);return _0x5906fe[_0xc3ed('0x21')](_0xc3ed('0x22'),_0x193eb4+'-'+_0x4115ad+'/'+_0x3bddaf)['json'](_0x226382);}return null;};}function patchUpdates(_0x28983d){return function(_0x422f6d){try{jsonpatch[_0xc3ed('0x23')](_0x422f6d,_0x28983d,!![]);}catch(_0x5f0bb0){return BPromise[_0xc3ed('0x24')](_0x5f0bb0);}return _0x422f6d['save']();};}function saveUpdates(_0x48aff4,_0x383b9a){return function(_0x5c64bb){if(_0x5c64bb){return _0x5c64bb[_0xc3ed('0x25')](_0x48aff4)[_0xc3ed('0x26')](function(_0x5e966d){return _0x5e966d;});}return null;};}function removeEntity(_0x38e83b,_0x309c73){return function(_0x175171){if(_0x175171){return _0x175171[_0xc3ed('0x27')]()[_0xc3ed('0x26')](function(){_0x38e83b[_0xc3ed('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2156d8,_0x1fa221){return function(_0x1382b3){if(!_0x1382b3){_0x2156d8[_0xc3ed('0x1c')](0x194);}return _0x1382b3;};}function handleError(_0x5edf80,_0x400cea){_0x400cea=_0x400cea||0x1f4;return function(_0x4a728f){logger[_0xc3ed('0x28')](_0x4a728f['stack']);if(_0x4a728f[_0xc3ed('0x29')]){delete _0x4a728f[_0xc3ed('0x29')];}_0x5edf80['status'](_0x400cea)['send'](_0x4a728f);};}exports[_0xc3ed('0x2a')]=function(_0x89699a,_0x3074e8){var _0xf56e0={},_0x39de49={},_0x97e912={'count':0x0,'rows':[]};var _0x2482d8=_['map'](db[_0xc3ed('0x2b')][_0xc3ed('0x2c')],function(_0x563711){return{'name':_0x563711['fieldName'],'type':_0x563711[_0xc3ed('0x2d')]['key']};});_0x39de49['model']=_[_0xc3ed('0x2e')](_0x2482d8,'name');_0x39de49['query']=_[_0xc3ed('0x2f')](_0x89699a['query']);_0x39de49['filters']=_[_0xc3ed('0x30')](_0x39de49[_0xc3ed('0x31')],_0x39de49['query']);_0xf56e0[_0xc3ed('0x32')]=_[_0xc3ed('0x30')](_0x39de49[_0xc3ed('0x31')],qs['fields'](_0x89699a[_0xc3ed('0x33')][_0xc3ed('0x34')]));_0xf56e0[_0xc3ed('0x32')]=_0xf56e0[_0xc3ed('0x32')][_0xc3ed('0x35')]?_0xf56e0[_0xc3ed('0x32')]:_0x39de49[_0xc3ed('0x31')];if(!_0x89699a[_0xc3ed('0x33')][_0xc3ed('0x36')](_0xc3ed('0x37'))){_0xf56e0[_0xc3ed('0x38')]=qs[_0xc3ed('0x38')](_0x89699a[_0xc3ed('0x33')][_0xc3ed('0x38')]);_0xf56e0[_0xc3ed('0x20')]=qs[_0xc3ed('0x20')](_0x89699a[_0xc3ed('0x33')]['offset']);}_0xf56e0[_0xc3ed('0x39')]=qs[_0xc3ed('0x3a')](_0x89699a[_0xc3ed('0x33')][_0xc3ed('0x3a')]);_0xf56e0['where']=qs[_0xc3ed('0x3b')](_[_0xc3ed('0x3c')](_0x89699a[_0xc3ed('0x33')],_0x39de49['filters']),_0x2482d8);if(_0x89699a[_0xc3ed('0x33')]['filter']){_0xf56e0[_0xc3ed('0x3d')]=_[_0xc3ed('0x3e')](_0xf56e0[_0xc3ed('0x3d')],{'$or':_['map'](_0x2482d8,function(_0x44ac51){if(_0x44ac51[_0xc3ed('0x2d')]!==_0xc3ed('0x3f')){var _0x3f0e61={};_0x3f0e61[_0x44ac51[_0xc3ed('0x29')]]={'$like':'%'+_0x89699a[_0xc3ed('0x33')][_0xc3ed('0x40')]+'%'};return _0x3f0e61;}})});}_0xf56e0=_['merge']({},_0xf56e0,_0x89699a[_0xc3ed('0x41')]);var _0x50b8ff={'where':_0xf56e0[_0xc3ed('0x3d')]};return db[_0xc3ed('0x2b')][_0xc3ed('0x42')](_0x50b8ff)['then'](function(_0x404ee1){_0x97e912[_0xc3ed('0x42')]=_0x404ee1;if(_0x89699a[_0xc3ed('0x33')][_0xc3ed('0x43')]){_0xf56e0[_0xc3ed('0x44')]=[{'all':!![]}];}return db[_0xc3ed('0x2b')]['findAll'](_0xf56e0);})[_0xc3ed('0x26')](function(_0x45a304){_0x97e912[_0xc3ed('0x45')]=_0x45a304;return _0x97e912;})['then'](respondWithFilteredResult(_0x3074e8,_0xf56e0))[_0xc3ed('0x46')](handleError(_0x3074e8,null));};exports[_0xc3ed('0x47')]=function(_0x42f51d,_0x5c40c1){var _0x33b058={'raw':!![],'where':{'id':_0x42f51d['params']['id']}},_0x1a0e13={};_0x1a0e13[_0xc3ed('0x31')]=_[_0xc3ed('0x2f')](db[_0xc3ed('0x2b')][_0xc3ed('0x2c')]);_0x1a0e13['query']=_[_0xc3ed('0x2f')](_0x42f51d[_0xc3ed('0x33')]);_0x1a0e13[_0xc3ed('0x3b')]=_[_0xc3ed('0x30')](_0x1a0e13[_0xc3ed('0x31')],_0x1a0e13[_0xc3ed('0x33')]);_0x33b058[_0xc3ed('0x32')]=_[_0xc3ed('0x30')](_0x1a0e13[_0xc3ed('0x31')],qs[_0xc3ed('0x34')](_0x42f51d[_0xc3ed('0x33')][_0xc3ed('0x34')]));_0x33b058[_0xc3ed('0x32')]=_0x33b058[_0xc3ed('0x32')]['length']?_0x33b058['attributes']:_0x1a0e13[_0xc3ed('0x31')];if(_0x42f51d[_0xc3ed('0x33')]['includeAll']){_0x33b058[_0xc3ed('0x44')]=[{'all':!![]}];}_0x33b058=_[_0xc3ed('0x3e')]({},_0x33b058,_0x42f51d[_0xc3ed('0x41')]);return db['ChatInternalMessage'][_0xc3ed('0x48')](_0x33b058)[_0xc3ed('0x26')](handleEntityNotFound(_0x5c40c1,null))[_0xc3ed('0x26')](respondWithResult(_0x5c40c1,null))['catch'](handleError(_0x5c40c1,null));};exports[_0xc3ed('0x49')]=function(_0x8bf2f1,_0x354a91){return db[_0xc3ed('0x2b')][_0xc3ed('0x49')](_0x8bf2f1['body'],{})['then'](respondWithResult(_0x354a91,0xc9))[_0xc3ed('0x46')](handleError(_0x354a91,null));};exports[_0xc3ed('0x25')]=function(_0x5997ec,_0x188530){if(_0x5997ec[_0xc3ed('0x4a')]['id']){delete _0x5997ec[_0xc3ed('0x4a')]['id'];}return db[_0xc3ed('0x2b')]['find']({'where':{'id':_0x5997ec[_0xc3ed('0x4b')]['id']}})[_0xc3ed('0x26')](handleEntityNotFound(_0x188530,null))[_0xc3ed('0x26')](saveUpdates(_0x5997ec['body'],null))[_0xc3ed('0x26')](respondWithResult(_0x188530,null))['catch'](handleError(_0x188530,null));};exports['destroy']=function(_0x3e13fa,_0x243c13){return db[_0xc3ed('0x2b')][_0xc3ed('0x48')]({'where':{'id':_0x3e13fa[_0xc3ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x243c13,null))[_0xc3ed('0x26')](removeEntity(_0x243c13,null))[_0xc3ed('0x46')](handleError(_0x243c13,null));};exports[_0xc3ed('0x4c')]=function(_0x214085,_0x3831cf){return db[_0xc3ed('0x2b')][_0xc3ed('0x4c')]()[_0xc3ed('0x26')](respondWithResult(_0x3831cf,null))[_0xc3ed('0x46')](handleError(_0x3831cf,null));};function wrapUser(_0x59ab7e){return function(_0x423c0f){var _0x433896=_0x59ab7e[_0xc3ed('0x4d')]({'plain':!![]});_0x433896[_0xc3ed('0x4e')]=[];if(_0x423c0f){_0x433896[_0xc3ed('0x4f')]=_0x423c0f[_0xc3ed('0x50')];_0x433896[_0xc3ed('0x51')]=_0x423c0f;}else{_0x433896[_0xc3ed('0x4f')]=moment(0x0)[_0xc3ed('0x52')](_0xc3ed('0x53'));_0x433896['lastMessage']={};}return _0x433896;};}exports['getUsers']=function(_0x28e481,_0x5d3238,_0x1ebf0f){var _0x48f87a=[];return db[_0xc3ed('0x54')][_0xc3ed('0x55')]({'where':{'role':[_0xc3ed('0x56'),_0xc3ed('0x57'),'user']},'attributes':['id',_0xc3ed('0x58'),'name',_0xc3ed('0x59'),_0xc3ed('0x5a'),_0xc3ed('0x5b'),_0xc3ed('0x5c'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs['sort'](_0xc3ed('0x5d')),'include':[{'model':db[_0xc3ed('0x5e')],'as':_0xc3ed('0x5f'),'attributes':['id','name',_0xc3ed('0x2d')],'through':{'attributes':[]}}]})[_0xc3ed('0x26')](function(_0x47cabf){if(_0x47cabf){var _0x3aeaae=_0x28e481[_0xc3ed('0x60')]['get']({'plain':!![]});if(!_0x3aeaae)throw new Error(_0xc3ed('0x61'));if(_0x3aeaae['role']===_0xc3ed('0x60')){return db[_0xc3ed('0x62')]['find']({'where':{'name':_0xc3ed('0x63'),'userProfileId':_0x3aeaae[_0xc3ed('0x64')]},'raw':!![]})[_0xc3ed('0x26')](function(_0x495edc){if(_0x495edc){if(_0x495edc[_0xc3ed('0x65')]===0x0){return db[_0xc3ed('0x66')][_0xc3ed('0x55')]({'where':{'sectionId':_0x495edc['id']},'raw':!![]})[_0xc3ed('0x26')](function(_0x5b9f3a){var _0x1687f6=[];if(_[_0xc3ed('0x67')](_0x5b9f3a)){_0x1687f6=_['filter'](_0x47cabf,function(_0x2dccb6){if(_0x2dccb6[_0xc3ed('0x59')]!==_0xc3ed('0x56')){return _0x2dccb6;}});return _0x1687f6;}else{for(var _0x4dfade=0x0;_0x4dfade<_0x47cabf[_0xc3ed('0x35')];_0x4dfade++){var _0x58ce88=_0x47cabf[_0x4dfade];if(_0x58ce88[_0xc3ed('0x59')]==='agent'){var _0x1e9b2e=_[_0xc3ed('0x48')](_0x5b9f3a,function(_0xe8cffc){return _0xe8cffc[_0xc3ed('0x68')]===_0x58ce88['id'];});if(_0x1e9b2e)_0x1687f6[_0xc3ed('0x69')](_0x58ce88);}else{_0x1687f6['push'](_0x58ce88);}}return _0x1687f6;}});}else{return _0x47cabf;}}else{var _0x37367c=_[_0xc3ed('0x40')](_0x47cabf,function(_0x4bb0d2){if(_0x4bb0d2[_0xc3ed('0x59')]!=='agent'){return _0x4bb0d2;}});return _0x37367c;}});}else{return _0x47cabf;}}})[_0xc3ed('0x26')](function(_0x59c5ef){var _0x2d8c7e=[];if(_0x59c5ef){_0x48f87a=_0x59c5ef;for(var _0x57e417=0x0;_0x57e417<_0x59c5ef[_0xc3ed('0x35')];_0x57e417+=0x1){_0x48f87a[_0x57e417][_0xc3ed('0x4e')]=[];_0x2d8c7e[_0xc3ed('0x69')](db['ChatInternalMessage'][_0xc3ed('0x48')]({'where':{'FromId':[_0x28e481[_0xc3ed('0x60')]['id'],_0x59c5ef[_0x57e417]['id']],'ToId':[_0x28e481[_0xc3ed('0x60')]['id'],_0x59c5ef[_0x57e417]['id']],'ChatGroupId':null},'attributes':['id',_0xc3ed('0x50'),'FromId',_0xc3ed('0x6a'),_0xc3ed('0x6b'),_0xc3ed('0x4a')],'order':qs[_0xc3ed('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x59c5ef[_0x57e417])));}return BPromise[_0xc3ed('0x6c')](_0x2d8c7e);}return[];})['then'](function(_0x1af5f2){return{'rows':_0x1af5f2,'count':_0x1af5f2[_0xc3ed('0x35')]};})[_0xc3ed('0x26')](respondWithResult(_0x5d3238,null))[_0xc3ed('0x46')](handleError(_0x5d3238,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e5b7213..17a2971 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 _0xdcc4=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0xc66af2,_0x14f6d8){var _0x38d439=function(_0x544ab8){while(--_0x544ab8){_0xc66af2['push'](_0xc66af2['shift']());}};_0x38d439(++_0x14f6d8);}(_0xdcc4,0xea));var _0x4dcc=function(_0x4f896a,_0x51f7d7){_0x4f896a=_0x4f896a-0x0;var _0x88adef=_0xdcc4[_0x4f896a];return _0x88adef;};'use strict';var EventEmitter=require(_0x4dcc('0x0'));var ChatInternalMessage=require(_0x4dcc('0x1'))['db'][_0x4dcc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4dcc('0x3')](0x0);var events={'afterCreate':_0x4dcc('0x4'),'afterUpdate':'update','afterDestroy':_0x4dcc('0x5')};function emitEvent(_0x5c1ea7){return function(_0x416d97,_0x30c165,_0x34bc8d){ChatInternalMessageEvents[_0x4dcc('0x6')](_0x5c1ea7+':'+_0x416d97['id'],_0x416d97);ChatInternalMessageEvents['emit'](_0x5c1ea7,_0x416d97);_0x34bc8d(null);};}for(var e in events){if(events[_0x4dcc('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x4dcc('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4a25=['remove','emit','hasOwnProperty','exports','events','ChatInternalMessage','save','update'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x4a25,0x1d4));var _0x54a2=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x4a25[_0x311666];return _0x2bc692;};'use strict';var EventEmitter=require(_0x54a2('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x54a2('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54a2('0x2'),'afterUpdate':_0x54a2('0x3'),'afterDestroy':_0x54a2('0x4')};function emitEvent(_0x3e5d5b){return function(_0x5c6c1f,_0x3031e9,_0x15f81b){ChatInternalMessageEvents[_0x54a2('0x5')](_0x3e5d5b+':'+_0x5c6c1f['id'],_0x5c6c1f);ChatInternalMessageEvents[_0x54a2('0x5')](_0x3e5d5b,_0x5c6c1f);_0x15f81b(null);};}for(var e in events){if(events[_0x54a2('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x54a2('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5765155..09378ce 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 _0xe706=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0xe706,0xa3));var _0x6e70=function(_0x41a3af,_0x5b49fb){_0x41a3af=_0x41a3af-0x0;var _0x5698f0=_0xe706[_0x41a3af];return _0x5698f0;};'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':!![],'charset':_0x6e70('0xe'),'collate':_0x6e70('0xf')});}; \ No newline at end of file +var _0xb43b=['./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2ef862,_0x87674a){_0x2ef862=_0x2ef862-0x0;var _0x5cefc1=_0xb43b[_0x2ef862];return _0x5cefc1;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb43('0xb'),'collate':_0xbb43('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3144117..de23351 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 _0xa323=['lodash','moment','bluebird','randomstring','../../config/logger','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xa323,0x6e));var _0x3a32=function(_0x380df2,_0x281a15){_0x380df2=_0x380df2-0x0;var _0x47f4df=_0xa323[_0x380df2];return _0x47f4df;};'use strict';var _=require(_0x3a32('0x0'));var util=require('util');var moment=require(_0x3a32('0x1'));var BPromise=require(_0x3a32('0x2'));var rs=require(_0x3a32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a32('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a32('0x5')][_0x3a32('0x6')]({'port':0x232a});config[_0x3a32('0x7')]=_['defaults'](config['redis'],{'host':_0x3a32('0x8'),'port':0x18eb});var socket=require(_0x3a32('0x9'))(new Redis(config[_0x3a32('0x7')]));require(_0x3a32('0xa'))[_0x3a32('0xb')](socket);function respondWithRpcPromise(_0x28193a,_0xa61fd3,_0x442b14){return new BPromise(function(_0x595ce8,_0xb9866f){return client['request'](_0x28193a,_0x442b14)[_0x3a32('0xc')](function(_0x3d0d11){logger[_0x3a32('0xd')](_0x3a32('0xe'),_0xa61fd3,_0x3a32('0xf'));logger[_0x3a32('0x10')](_0x3a32('0x11'),_0xa61fd3,_0x3a32('0xf'),JSON[_0x3a32('0x12')](_0x3d0d11));if(_0x3d0d11[_0x3a32('0x13')]){if(_0x3d0d11['error']['code']===0x1f4){logger[_0x3a32('0x13')](_0x3a32('0xe'),_0xa61fd3,_0x3d0d11['error'][_0x3a32('0x14')]);return _0xb9866f(_0x3d0d11[_0x3a32('0x13')][_0x3a32('0x14')]);}logger[_0x3a32('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xa61fd3,_0x3d0d11[_0x3a32('0x13')]['message']);return _0x595ce8(_0x3d0d11[_0x3a32('0x13')][_0x3a32('0x14')]);}else{logger[_0x3a32('0xd')](_0x3a32('0xe'),_0xa61fd3,_0x3a32('0xf'));_0x595ce8(_0x3d0d11[_0x3a32('0x15')][_0x3a32('0x14')]);}})['catch'](function(_0x334400){logger[_0x3a32('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xa61fd3,_0x334400);_0xb9866f(_0x334400);});});} \ No newline at end of file +var _0x9094=['info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x408041,_0x1999de){var _0x5024ca=function(_0x5a517f){while(--_0x5a517f){_0x408041['push'](_0x408041['shift']());}};_0x5024ca(++_0x1999de);}(_0x9094,0xca));var _0x4909=function(_0x31fa8a,_0x4472ee){_0x31fa8a=_0x31fa8a-0x0;var _0x1f8c34=_0x9094[_0x31fa8a];return _0x1f8c34;};'use strict';var _=require(_0x4909('0x0'));var util=require(_0x4909('0x1'));var moment=require(_0x4909('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4909('0x3'));var db=require(_0x4909('0x4'))['db'];var utils=require(_0x4909('0x5'));var logger=require(_0x4909('0x6'))(_0x4909('0x7'));var config=require(_0x4909('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4909('0x9')]['http']({'port':0x232a});config[_0x4909('0xa')]=_['defaults'](config[_0x4909('0xa')],{'host':_0x4909('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4909('0xa')]));require(_0x4909('0xc'))[_0x4909('0xd')](socket);function respondWithRpcPromise(_0x2a5509,_0x1b23f1,_0x449a92){return new BPromise(function(_0x5c250e,_0x44fb9a){return client[_0x4909('0xe')](_0x2a5509,_0x449a92)[_0x4909('0xf')](function(_0x2bb951){logger['info'](_0x4909('0x10'),_0x1b23f1,_0x4909('0x11'));logger[_0x4909('0x12')](_0x4909('0x13'),_0x1b23f1,'request\x20sent',JSON['stringify'](_0x2bb951));if(_0x2bb951[_0x4909('0x14')]){if(_0x2bb951['error'][_0x4909('0x15')]===0x1f4){logger['error'](_0x4909('0x10'),_0x1b23f1,_0x2bb951[_0x4909('0x14')][_0x4909('0x16')]);return _0x44fb9a(_0x2bb951[_0x4909('0x14')]['message']);}logger[_0x4909('0x14')](_0x4909('0x10'),_0x1b23f1,_0x2bb951['error'][_0x4909('0x16')]);return _0x5c250e(_0x2bb951['error'][_0x4909('0x16')]);}else{logger[_0x4909('0x17')](_0x4909('0x10'),_0x1b23f1,_0x4909('0x11'));_0x5c250e(_0x2bb951['result'][_0x4909('0x16')]);}})[_0x4909('0x18')](function(_0x2699a3){logger[_0x4909('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x1b23f1,_0x2699a3);_0x44fb9a(_0x2699a3);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4b25826..ce9cd9b 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 _0xcf1c=['chatInternalMessage:','./chatInternalMessage.events','save','update','removeListener','length'];(function(_0xc1dec1,_0x173b5e){var _0x441c1a=function(_0x2fd155){while(--_0x2fd155){_0xc1dec1['push'](_0xc1dec1['shift']());}};_0x441c1a(++_0x173b5e);}(_0xcf1c,0x18d));var _0xccf1=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0xcf1c[_0x2cdcf9];return _0x39412d;};'use strict';var ChatInternalMessageEvents=require(_0xccf1('0x0'));var events=[_0xccf1('0x1'),'remove',_0xccf1('0x2')];function createListener(_0x3b9acb,_0x1d0b09){return function(_0x2800a8){_0x1d0b09['emit'](_0x3b9acb,_0x2800a8);};}function removeListener(_0x5d3e85,_0x509c8d){return function(){ChatInternalMessageEvents[_0xccf1('0x3')](_0x5d3e85,_0x509c8d);};}exports['register']=function(_0x17e358){for(var _0x2ee316=0x0,_0x2c381f=events[_0xccf1('0x4')];_0x2ee316<_0x2c381f;_0x2ee316++){var _0x1ee241=events[_0x2ee316];var _0x12ca5d=createListener(_0xccf1('0x5')+_0x1ee241,_0x17e358);ChatInternalMessageEvents['on'](_0x1ee241,_0x12ca5d);}}; \ No newline at end of file +var _0x0a9a=['update','register','chatInternalMessage:','save'];(function(_0x5f1731,_0x4f7d62){var _0x95aa32=function(_0x270c67){while(--_0x270c67){_0x5f1731['push'](_0x5f1731['shift']());}};_0x95aa32(++_0x4f7d62);}(_0x0a9a,0x183));var _0xa0a9=function(_0x3fd859,_0x52bdaf){_0x3fd859=_0x3fd859-0x0;var _0x4443c9=_0x0a9a[_0x3fd859];return _0x4443c9;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xa0a9('0x0'),'remove',_0xa0a9('0x1')];function createListener(_0x3cff22,_0x34801b){return function(_0x49162f){_0x34801b['emit'](_0x3cff22,_0x49162f);};}function removeListener(_0x317a94,_0x360be5){return function(){ChatInternalMessageEvents['removeListener'](_0x317a94,_0x360be5);};}exports[_0xa0a9('0x2')]=function(_0xc65bbb){for(var _0x1aa717=0x0,_0x31d689=events['length'];_0x1aa717<_0x31d689;_0x1aa717++){var _0x2b2eb4=events[_0x1aa717];var _0x520f42=createListener(_0xa0a9('0x3')+_0x2b2eb4,_0xc65bbb);ChatInternalMessageEvents['on'](_0x2b2eb4,_0x520f42);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d243525..000dc7b 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x5c3048,_0x3b098a){var _0x24f9ed=function(_0x1b8cd4){while(--_0x1b8cd4){_0x5c3048['push'](_0x5c3048['shift']());}};_0x24f9ed(++_0x3b098a);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x5c984f,_0x5a2d78){var _0x15bf22=function(_0x531491){while(--_0x531491){_0x5c984f['push'](_0x5c984f['shift']());}};_0x15bf22(++_0x5a2d78);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3a39c32..3e5674e 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 _0x1b49=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1b49,0x1e1));var _0x91b4=function(_0x148c1d,_0x537052){_0x148c1d=_0x148c1d-0x0;var _0xed1bda=_0x1b49[_0x148c1d];return _0xed1bda;};'use strict';var Sequelize=require(_0x91b4('0x0'));module[_0x91b4('0x1')]={'body':{'type':Sequelize[_0x91b4('0x2')](_0x91b4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x91b4('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x91b4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x91b4('0x5')]('in',_0x91b4('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x91b4('0x7')]},'providerName':{'type':Sequelize[_0x91b4('0x8')]},'providerResponse':{'type':Sequelize[_0x91b4('0x2')]}}; \ No newline at end of file +var _0x98e3=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98e3,0x1f3));var _0x398e=function(_0x4cc649,_0x26e04d){_0x4cc649=_0x4cc649-0x0;var _0x522478=_0x98e3[_0x4cc649];return _0x522478;};'use strict';var Sequelize=require(_0x398e('0x0'));module[_0x398e('0x1')]={'body':{'type':Sequelize[_0x398e('0x2')](_0x398e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x398e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x398e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x398e('0x5')),'defaultValue':_0x398e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x398e('0x6')]},'providerName':{'type':Sequelize[_0x398e('0x7')]},'providerResponse':{'type':Sequelize[_0x398e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8045843..f8bd630 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 _0x0385=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','formData','../../config/logger','chat','ChatInteraction','ChatInteractionId','RejectMessage','rejectMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','create','body','find','params','describe','readAt','format','UserId','user','CmContact','Contact','get','isNil','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x45c0ab,_0xa024aa){var _0x58c693=function(_0xbd47fc){while(--_0xbd47fc){_0x45c0ab['push'](_0x45c0ab['shift']());}};_0x58c693(++_0xa024aa);}(_0x0385,0x180));var _0x5038=function(_0x12dcb1,_0x22fd13){_0x12dcb1=_0x12dcb1-0x0;var _0x41bf78=_0x0385[_0x12dcb1];return _0x41bf78;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5038('0x0'));var rimraf=require(_0x5038('0x1'));var zipdir=require(_0x5038('0x2'));var jsonpatch=require(_0x5038('0x3'));var rp=require(_0x5038('0x4'));var moment=require('moment');var BPromise=require(_0x5038('0x5'));var Mustache=require('mustache');var util=require(_0x5038('0x6'));var path=require(_0x5038('0x7'));var sox=require(_0x5038('0x8'));var csv=require('to-csv');var ejs=require(_0x5038('0x9'));var fs=require('fs');var _=require(_0x5038('0xa'));var squel=require(_0x5038('0xb'));var crypto=require(_0x5038('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5038('0xd'));var querystring=require(_0x5038('0xe'));var Papa=require('papaparse');var Redis=require(_0x5038('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5038('0x10'));var as=require(_0x5038('0x11'));var hardwareService=require(_0x5038('0x12'));var logger=require('../../config/logger')(_0x5038('0x13'));var utils=require('../../config/utils');var config=require(_0x5038('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5038('0x15'))['db'];config[_0x5038('0x16')]=_[_0x5038('0x17')](config[_0x5038('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x5038('0x18'))(new Redis(config[_0x5038('0x16')]));require(_0x5038('0x19'))[_0x5038('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5038('0x1b')]({'port':0x232c});var client9002=jayson[_0x5038('0x1c')][_0x5038('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x122631,_0x5d261b,_0x797ff9,_0x215ee3){return new BPromise(function(_0x4f4a0a,_0x97550d){var _0x5dad7a=_0x215ee3||client;return _0x5dad7a[_0x5038('0x1d')](_0x122631,_0x797ff9)[_0x5038('0x1e')](function(_0xfc3065){logger[_0x5038('0x1f')](_0x5038('0x20'),_0x5d261b,_0x5038('0x21'));logger[_0x5038('0x22')](_0x5038('0x23'),_0x5d261b,_0x5038('0x21'),JSON[_0x5038('0x24')](_0xfc3065));if(_0xfc3065[_0x5038('0x25')]){if(_0xfc3065['error'][_0x5038('0x26')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5d261b,_0xfc3065[_0x5038('0x25')][_0x5038('0x27')]);return _0x97550d(_0xfc3065[_0x5038('0x25')]['message']);}logger[_0x5038('0x25')](_0x5038('0x20'),_0x5d261b,_0xfc3065[_0x5038('0x25')][_0x5038('0x27')]);return _0x4f4a0a(_0xfc3065[_0x5038('0x25')]['message']);}else{logger['info'](_0x5038('0x20'),_0x5d261b,_0x5038('0x21'));_0x4f4a0a(_0xfc3065[_0x5038('0x28')][_0x5038('0x27')]);}})[_0x5038('0x29')](function(_0x3091fa){logger[_0x5038('0x25')](_0x5038('0x20'),_0x5d261b,_0x3091fa);_0x97550d(_0x3091fa);});});}function respondWithStatusCode(_0x4ecc3a,_0xb3289c){_0xb3289c=_0xb3289c||0xcc;return function(_0x21f0fa){if(_0x21f0fa){return _0x4ecc3a[_0x5038('0x2a')](_0xb3289c);}return _0x4ecc3a[_0x5038('0x2b')](_0xb3289c)[_0x5038('0x2c')]();};}function respondWithResult(_0x33e6b4,_0x4e0fce){_0x4e0fce=_0x4e0fce||0xc8;return function(_0x5a8f53){if(_0x5a8f53){return _0x33e6b4[_0x5038('0x2b')](_0x4e0fce)[_0x5038('0x2d')](_0x5a8f53);}};}function respondWithFilteredResult(_0x41ee74,_0x5f18e1){return function(_0xb34702){if(_0xb34702){var _0x34e722=_0xb34702[_0x5038('0x2e')],_0x414c96=_0x5f18e1[_0x5038('0x2f')],_0x2685cd=_0x5f18e1[_0x5038('0x2f')]+_0x5f18e1[_0x5038('0x30')],_0x5ad746;if(_0x2685cd>=_0x34e722){_0x2685cd=_0x34e722;_0x5ad746=0xc8;}else{_0x5ad746=0xce;}_0x41ee74[_0x5038('0x2b')](_0x5ad746);return _0x41ee74[_0x5038('0x31')](_0x5038('0x32'),_0x414c96+'-'+_0x2685cd+'/'+_0x34e722)[_0x5038('0x2d')](_0xb34702);}return null;};}function patchUpdates(_0x1466f3){return function(_0x15c0d5){try{jsonpatch[_0x5038('0x33')](_0x15c0d5,_0x1466f3,!![]);}catch(_0x1afe91){return BPromise[_0x5038('0x34')](_0x1afe91);}return _0x15c0d5[_0x5038('0x35')]();};}function saveUpdates(_0x47e8f8,_0x5dde54){return function(_0x35d00b){if(_0x35d00b){return _0x35d00b[_0x5038('0x36')](_0x47e8f8)[_0x5038('0x1e')](function(_0x596df7){return _0x596df7;});}return null;};}function removeEntity(_0x1da3b8,_0x2d9177){return function(_0x2c20c3){if(_0x2c20c3){return _0x2c20c3[_0x5038('0x37')]()['then'](function(){_0x1da3b8[_0x5038('0x2b')](0xcc)[_0x5038('0x2c')]();});}};}function handleEntityNotFound(_0x5218d0,_0x1bb639){return function(_0x504947){if(!_0x504947){_0x5218d0['sendStatus'](0x194);}return _0x504947;};}function handleError(_0x3e2ed8,_0xe46c1f){_0xe46c1f=_0xe46c1f||0x1f4;return function(_0x33ddde){logger[_0x5038('0x25')](_0x33ddde[_0x5038('0x38')]);if(_0x33ddde['name']){delete _0x33ddde[_0x5038('0x39')];}_0x3e2ed8['status'](_0xe46c1f)[_0x5038('0x3a')](_0x33ddde);};}exports[_0x5038('0x3b')]=function(_0x466b4c,_0x1c31d2){var _0x2b2b0c={},_0x503652={},_0x1da39e={'count':0x0,'rows':[]};var _0x5a5f1a=_[_0x5038('0x3c')](db[_0x5038('0x3d')][_0x5038('0x3e')],function(_0x1f40d6){return{'name':_0x1f40d6['fieldName'],'type':_0x1f40d6[_0x5038('0x3f')][_0x5038('0x40')]};});_0x503652['model']=_[_0x5038('0x3c')](_0x5a5f1a,'name');_0x503652[_0x5038('0x41')]=_[_0x5038('0x42')](_0x466b4c[_0x5038('0x41')]);_0x503652[_0x5038('0x43')]=_[_0x5038('0x44')](_0x503652[_0x5038('0x45')],_0x503652[_0x5038('0x41')]);_0x2b2b0c[_0x5038('0x46')]=_['intersection'](_0x503652['model'],qs[_0x5038('0x47')](_0x466b4c[_0x5038('0x41')][_0x5038('0x47')]));_0x2b2b0c['attributes']=_0x2b2b0c[_0x5038('0x46')][_0x5038('0x48')]?_0x2b2b0c[_0x5038('0x46')]:_0x503652[_0x5038('0x45')];if(!_0x466b4c[_0x5038('0x41')][_0x5038('0x49')]('nolimit')){_0x2b2b0c[_0x5038('0x30')]=qs['limit'](_0x466b4c['query']['limit']);_0x2b2b0c[_0x5038('0x2f')]=qs[_0x5038('0x2f')](_0x466b4c['query'][_0x5038('0x2f')]);}_0x2b2b0c[_0x5038('0x4a')]=qs[_0x5038('0x4b')](_0x466b4c[_0x5038('0x41')][_0x5038('0x4b')]);_0x2b2b0c[_0x5038('0x4c')]=qs[_0x5038('0x43')](_[_0x5038('0x4d')](_0x466b4c[_0x5038('0x41')],_0x503652[_0x5038('0x43')]),_0x5a5f1a);if(_0x466b4c[_0x5038('0x41')]['filter']){_0x2b2b0c['where']=_[_0x5038('0x4e')](_0x2b2b0c['where'],{'$or':_[_0x5038('0x3c')](_0x5a5f1a,function(_0x52290e){if(_0x52290e[_0x5038('0x3f')]!==_0x5038('0x4f')){var _0x30747a={};_0x30747a[_0x52290e['name']]={'$like':'%'+_0x466b4c[_0x5038('0x41')][_0x5038('0x50')]+'%'};return _0x30747a;}})});}_0x2b2b0c=_[_0x5038('0x4e')]({},_0x2b2b0c,_0x466b4c[_0x5038('0x51')]);var _0x58b9f3={'where':_0x2b2b0c[_0x5038('0x4c')]};return db[_0x5038('0x3d')][_0x5038('0x2e')](_0x58b9f3)[_0x5038('0x1e')](function(_0x4da7aa){_0x1da39e['count']=_0x4da7aa;if(_0x466b4c[_0x5038('0x41')]['includeAll']){_0x2b2b0c[_0x5038('0x52')]=[{'all':!![]}];}return db[_0x5038('0x3d')][_0x5038('0x53')](_0x2b2b0c);})[_0x5038('0x1e')](function(_0x3931e3){_0x1da39e[_0x5038('0x54')]=_0x3931e3;return _0x1da39e;})[_0x5038('0x1e')](respondWithFilteredResult(_0x1c31d2,_0x2b2b0c))[_0x5038('0x29')](handleError(_0x1c31d2,null));};exports[_0x5038('0x55')]=function(_0xd077ed,_0x1b272c){var _0x1ee2c6={'raw':!![],'where':{'id':_0xd077ed['params']['id']}},_0x47d0d1={};_0x47d0d1[_0x5038('0x45')]=_['keys'](db['ChatMessage'][_0x5038('0x3e')]);_0x47d0d1[_0x5038('0x41')]=_[_0x5038('0x42')](_0xd077ed['query']);_0x47d0d1[_0x5038('0x43')]=_[_0x5038('0x44')](_0x47d0d1['model'],_0x47d0d1[_0x5038('0x41')]);_0x1ee2c6[_0x5038('0x46')]=_['intersection'](_0x47d0d1['model'],qs[_0x5038('0x47')](_0xd077ed[_0x5038('0x41')][_0x5038('0x47')]));_0x1ee2c6['attributes']=_0x1ee2c6[_0x5038('0x46')]['length']?_0x1ee2c6[_0x5038('0x46')]:_0x47d0d1[_0x5038('0x45')];if(_0xd077ed[_0x5038('0x41')]['includeAll']){_0x1ee2c6[_0x5038('0x52')]=[{'all':!![]}];}_0x1ee2c6=_[_0x5038('0x4e')]({},_0x1ee2c6,_0xd077ed['options']);return db[_0x5038('0x3d')]['find'](_0x1ee2c6)[_0x5038('0x1e')](handleEntityNotFound(_0x1b272c,null))[_0x5038('0x1e')](respondWithResult(_0x1b272c,null))[_0x5038('0x29')](handleError(_0x1b272c,null));};exports[_0x5038('0x56')]=function(_0x44cde9,_0x554f3c){return db[_0x5038('0x3d')][_0x5038('0x56')](_0x44cde9[_0x5038('0x57')],{})[_0x5038('0x1e')](respondWithResult(_0x554f3c,0xc9))['catch'](handleError(_0x554f3c,null));};exports[_0x5038('0x36')]=function(_0xfb55c0,_0x2634ae){if(_0xfb55c0[_0x5038('0x57')]['id']){delete _0xfb55c0[_0x5038('0x57')]['id'];}return db[_0x5038('0x3d')][_0x5038('0x58')]({'where':{'id':_0xfb55c0[_0x5038('0x59')]['id']}})[_0x5038('0x1e')](handleEntityNotFound(_0x2634ae,null))['then'](saveUpdates(_0xfb55c0[_0x5038('0x57')],null))[_0x5038('0x1e')](respondWithResult(_0x2634ae,null))[_0x5038('0x29')](handleError(_0x2634ae,null));};exports[_0x5038('0x37')]=function(_0x4b0f67,_0x48557f){return db['ChatMessage']['find']({'where':{'id':_0x4b0f67[_0x5038('0x59')]['id']}})['then'](handleEntityNotFound(_0x48557f,null))['then'](removeEntity(_0x48557f,null))[_0x5038('0x29')](handleError(_0x48557f,null));};exports[_0x5038('0x5a')]=function(_0x591370,_0x59743e){return db[_0x5038('0x3d')][_0x5038('0x5a')]()[_0x5038('0x1e')](respondWithResult(_0x59743e,null))[_0x5038('0x29')](handleError(_0x59743e,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0xcb3541,_0x1740ae,_0x52befb){var _0xb765bb={'channel':'chat'};if(_0xcb3541[_0x5038('0x57')]['id']){delete _0xcb3541[_0x5038('0x57')]['id'];}_0xcb3541['body']['read']=!![];_0xcb3541[_0x5038('0x57')][_0x5038('0x5b')]=moment()[_0x5038('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xcb3541['body'][_0x5038('0x5d')]=_0xcb3541[_0x5038('0x57')][_0x5038('0x5d')]||_0xcb3541[_0x5038('0x5e')]['id'];return db['ChatMessage'][_0x5038('0x58')]({'where':{'id':_0xcb3541['params']['id'],'UserId':null},'include':[{'model':db[_0x5038('0x5f')],'as':_0x5038('0x60')}]})[_0x5038('0x1e')](handleEntityNotFound(_0x1740ae,null))['then'](saveUpdates(_0xcb3541[_0x5038('0x57')],null))[_0x5038('0x1e')](function(_0x2d3ba9){if(_0x2d3ba9){_0xb765bb[_0x5038('0x27')]=_0x2d3ba9[_0x5038('0x61')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2d3ba9['ChatInteractionId']}});}return null;})[_0x5038('0x1e')](handleEntityNotFound(_0x1740ae,null))[_0x5038('0x1e')](function(_0x2a5b73){if(_0x2a5b73){return _0x2a5b73[_0x5038('0x36')]({'UserId':_0xcb3541['body'][_0x5038('0x5d')],'read1stAt':_[_0x5038('0x62')](_0x2a5b73['read1stAt'])?moment()[_0x5038('0x5c')](_0x5038('0x63')):undefined});}return null;})['then'](function(_0x2cbb3a){if(_0x2cbb3a){_0xb765bb[_0x5038('0x64')]=_0x2cbb3a[_0x5038('0x61')]({'plain':!![]});interaction_log[_0x5038('0x1f')](_0x5038('0x65'),_0xcb3541['user']['id'],_0xcb3541[_0x5038('0x5e')][_0x5038('0x39')],_0xcb3541[_0x5038('0x5e')][_0x5038('0x66')],_0xb765bb[_0x5038('0x64')]['id'],_0xcb3541['body']?JSON[_0x5038('0x24')](_0xcb3541[_0x5038('0x57')]):_0x5038('0x67'));return respondWithRpcPromise(_0x5038('0x68'),_0x5038('0x69'),_0xb765bb);}return null;})[_0x5038('0x1e')](function(_0x39b3b){if(_0x39b3b){if(_0xcb3541[_0x5038('0x57')][_0x5038('0x6a')]){_0xb765bb[_0x5038('0x27')][_0x5038('0x6b')]=util[_0x5038('0x5c')](_0x5038('0x6c'),_0xcb3541['user']['name']);_0xb765bb[_0x5038('0x27')][_0x5038('0x6d')]=_0xb765bb[_0x5038('0x6d')];_0xb765bb[_0x5038('0x27')][_0x5038('0x6e')]=_0x5038('0x6f');return respondWithRpcPromise('EventManager',_0x5038('0x70'),{'event':_0x5038('0x71'),'message':_[_0x5038('0x4e')](_0xb765bb['message'],JSON['parse'](_0xb765bb[_0x5038('0x64')][_0x5038('0x72')]))},client9002)['then'](function(){return _0xb765bb;});}return _0xb765bb;}return null;})[_0x5038('0x1e')](respondWithResult(_0x1740ae,null))[_0x5038('0x29')](handleError(_0x1740ae,null));};var interaction_log=require(_0x5038('0x73'))('chat-interactions');exports[_0x5038('0x34')]=function(_0x543249,_0x143a8e,_0x4ed81a){var _0xb7d56d={'agent':{},'channel':_0x5038('0x74')};if(_0x543249[_0x5038('0x57')]['id']){delete _0x543249[_0x5038('0x57')]['id'];}_0x543249['body'][_0x5038('0x5d')]=_0x543249[_0x5038('0x57')][_0x5038('0x5d')]||_0x543249['user']['id'];_0xb7d56d['agent']['id']=_0x543249[_0x5038('0x57')]['UserId'];return db[_0x5038('0x3d')][_0x5038('0x58')]({'where':{'id':_0x543249[_0x5038('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x143a8e,null))[_0x5038('0x1e')](function(_0x3afd81){if(_0x3afd81){_0xb7d56d[_0x5038('0x27')]=_0x3afd81['get']({'plain':!![]});return db[_0x5038('0x75')][_0x5038('0x58')]({'where':{'id':_0x3afd81[_0x5038('0x76')]}});}return null;})[_0x5038('0x1e')](handleEntityNotFound(_0x143a8e,null))['then'](function(_0x566239){if(_0x566239){_0xb7d56d[_0x5038('0x64')]=_0x566239['get']({'plain':!![]});interaction_log[_0x5038('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x543249['user']['id'],_0x543249[_0x5038('0x5e')]['name'],_0x543249[_0x5038('0x5e')][_0x5038('0x66')],_0xb7d56d[_0x5038('0x64')]['id'],_0x543249[_0x5038('0x57')]?JSON[_0x5038('0x24')](_0x543249['body']):_0x5038('0x67'));return respondWithRpcPromise(_0x5038('0x77'),_0x5038('0x78'),_0xb7d56d);}return null;})[_0x5038('0x1e')](function(_0x7c75e9){if(_0x7c75e9){_0x7c75e9[_0x5038('0x27')][_0x5038('0x6b')]=util[_0x5038('0x5c')](_0x5038('0x6c'),_0x543249['user']['name']);_0x7c75e9[_0x5038('0x27')][_0x5038('0x6d')]=_0xb7d56d[_0x5038('0x6d')];_0x7c75e9[_0x5038('0x27')][_0x5038('0x6e')]=_0x5038('0x34');respondWithRpcPromise('EventManager',_0x5038('0x70'),{'event':'rejectmessage','message':_0x7c75e9['message']},client9002);return _0xb7d56d;}return null;})[_0x5038('0x1e')](respondWithResult(_0x143a8e,null))[_0x5038('0x29')](handleError(_0x143a8e,null));}; \ No newline at end of file +var _0x77a2=['stack','name','map','ChatMessage','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','includeAll','include','findAll','rows','show','params','options','find','catch','create','update','body','describe','../../config/logger','chat-interactions','accept','read','format','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','merge','formData','chat','agent','role','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy'];(function(_0x406ae7,_0x12181b){var _0x5a5b9d=function(_0x3f20c2){while(--_0x3f20c2){_0x406ae7['push'](_0x406ae7['shift']());}};_0x5a5b9d(++_0x12181b);}(_0x77a2,0x1b0));var _0x277a=function(_0x2d8a35,_0x1d7f2b){_0x2d8a35=_0x2d8a35-0x0;var _0x38ac7d=_0x77a2[_0x2d8a35];return _0x38ac7d;};'use strict';var pdf=require(_0x277a('0x0'));var emlformat=require(_0x277a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x277a('0x2'));var rp=require(_0x277a('0x3'));var moment=require(_0x277a('0x4'));var BPromise=require(_0x277a('0x5'));var Mustache=require(_0x277a('0x6'));var util=require(_0x277a('0x7'));var path=require(_0x277a('0x8'));var sox=require(_0x277a('0x9'));var csv=require(_0x277a('0xa'));var ejs=require(_0x277a('0xb'));var fs=require('fs');var _=require(_0x277a('0xc'));var squel=require(_0x277a('0xd'));var crypto=require(_0x277a('0xe'));var jsforce=require(_0x277a('0xf'));var deskjs=require(_0x277a('0x10'));var toCsv=require(_0x277a('0xa'));var querystring=require(_0x277a('0x11'));var Papa=require(_0x277a('0x12'));var Redis=require('ioredis');var authService=require(_0x277a('0x13'));var qs=require(_0x277a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x277a('0x15'));var utils=require(_0x277a('0x16'));var config=require(_0x277a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x277a('0x18'))['db'];config[_0x277a('0x19')]=_['defaults'](config[_0x277a('0x19')],{'host':_0x277a('0x1a'),'port':0x18eb});var socket=require(_0x277a('0x1b'))(new Redis(config[_0x277a('0x19')]));require(_0x277a('0x1c'))[_0x277a('0x1d')](socket);var jayson=require(_0x277a('0x1e'));var client=jayson[_0x277a('0x1f')][_0x277a('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x277a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xcf60df,_0x202369,_0x3fd8c9,_0x13abb0){return new BPromise(function(_0x354374,_0x103868){var _0xd682d5=_0x13abb0||client;return _0xd682d5[_0x277a('0x21')](_0xcf60df,_0x3fd8c9)[_0x277a('0x22')](function(_0x29cb38){logger[_0x277a('0x23')](_0x277a('0x24'),_0x202369,_0x277a('0x25'));logger[_0x277a('0x26')](_0x277a('0x27'),_0x202369,_0x277a('0x25'),JSON[_0x277a('0x28')](_0x29cb38));if(_0x29cb38[_0x277a('0x29')]){if(_0x29cb38[_0x277a('0x29')][_0x277a('0x2a')]===0x1f4){logger[_0x277a('0x29')]('ChatMessage,\x20%s,\x20%s',_0x202369,_0x29cb38[_0x277a('0x29')][_0x277a('0x2b')]);return _0x103868(_0x29cb38[_0x277a('0x29')][_0x277a('0x2b')]);}logger[_0x277a('0x29')](_0x277a('0x24'),_0x202369,_0x29cb38[_0x277a('0x29')][_0x277a('0x2b')]);return _0x354374(_0x29cb38['error'][_0x277a('0x2b')]);}else{logger[_0x277a('0x23')](_0x277a('0x24'),_0x202369,'request\x20sent');_0x354374(_0x29cb38['result'][_0x277a('0x2b')]);}})['catch'](function(_0x3b9855){logger['error']('ChatMessage,\x20%s,\x20%s',_0x202369,_0x3b9855);_0x103868(_0x3b9855);});});}function respondWithStatusCode(_0x5a97e2,_0x220432){_0x220432=_0x220432||0xcc;return function(_0x137a61){if(_0x137a61){return _0x5a97e2[_0x277a('0x2c')](_0x220432);}return _0x5a97e2[_0x277a('0x2d')](_0x220432)[_0x277a('0x2e')]();};}function respondWithResult(_0x516eb3,_0x61b1a1){_0x61b1a1=_0x61b1a1||0xc8;return function(_0x2b6448){if(_0x2b6448){return _0x516eb3['status'](_0x61b1a1)[_0x277a('0x2f')](_0x2b6448);}};}function respondWithFilteredResult(_0x43f31a,_0x51d5a3){return function(_0x400235){if(_0x400235){var _0x5a84e7=_0x400235[_0x277a('0x30')],_0x15408e=_0x51d5a3[_0x277a('0x31')],_0x15109b=_0x51d5a3[_0x277a('0x31')]+_0x51d5a3[_0x277a('0x32')],_0x3aae50;if(_0x15109b>=_0x5a84e7){_0x15109b=_0x5a84e7;_0x3aae50=0xc8;}else{_0x3aae50=0xce;}_0x43f31a['status'](_0x3aae50);return _0x43f31a['set'](_0x277a('0x33'),_0x15408e+'-'+_0x15109b+'/'+_0x5a84e7)[_0x277a('0x2f')](_0x400235);}return null;};}function patchUpdates(_0x4d9165){return function(_0x26f8fa){try{jsonpatch[_0x277a('0x34')](_0x26f8fa,_0x4d9165,!![]);}catch(_0x163222){return BPromise[_0x277a('0x35')](_0x163222);}return _0x26f8fa[_0x277a('0x36')]();};}function saveUpdates(_0x45651d,_0xc896e2){return function(_0x125d6b){if(_0x125d6b){return _0x125d6b['update'](_0x45651d)[_0x277a('0x22')](function(_0x58cb47){return _0x58cb47;});}return null;};}function removeEntity(_0x3b4338,_0xe3c670){return function(_0x8e1ab3){if(_0x8e1ab3){return _0x8e1ab3[_0x277a('0x37')]()[_0x277a('0x22')](function(){_0x3b4338['status'](0xcc)[_0x277a('0x2e')]();});}};}function handleEntityNotFound(_0x295a93,_0x2af170){return function(_0x338c27){if(!_0x338c27){_0x295a93[_0x277a('0x2c')](0x194);}return _0x338c27;};}function handleError(_0x5f20c5,_0x301b7d){_0x301b7d=_0x301b7d||0x1f4;return function(_0x52815b){logger[_0x277a('0x29')](_0x52815b[_0x277a('0x38')]);if(_0x52815b[_0x277a('0x39')]){delete _0x52815b['name'];}_0x5f20c5[_0x277a('0x2d')](_0x301b7d)['send'](_0x52815b);};}exports['index']=function(_0x5add23,_0x5dfb9e){var _0xd917e3={},_0x5716ca={},_0x23f377={'count':0x0,'rows':[]};var _0xec22=_[_0x277a('0x3a')](db[_0x277a('0x3b')][_0x277a('0x3c')],function(_0x1d1a57){return{'name':_0x1d1a57[_0x277a('0x3d')],'type':_0x1d1a57[_0x277a('0x3e')]['key']};});_0x5716ca[_0x277a('0x3f')]=_[_0x277a('0x3a')](_0xec22,_0x277a('0x39'));_0x5716ca['query']=_[_0x277a('0x40')](_0x5add23[_0x277a('0x41')]);_0x5716ca['filters']=_[_0x277a('0x42')](_0x5716ca[_0x277a('0x3f')],_0x5716ca[_0x277a('0x41')]);_0xd917e3[_0x277a('0x43')]=_['intersection'](_0x5716ca[_0x277a('0x3f')],qs['fields'](_0x5add23[_0x277a('0x41')][_0x277a('0x44')]));_0xd917e3[_0x277a('0x43')]=_0xd917e3[_0x277a('0x43')]['length']?_0xd917e3['attributes']:_0x5716ca[_0x277a('0x3f')];if(!_0x5add23[_0x277a('0x41')][_0x277a('0x45')](_0x277a('0x46'))){_0xd917e3[_0x277a('0x32')]=qs[_0x277a('0x32')](_0x5add23['query'][_0x277a('0x32')]);_0xd917e3[_0x277a('0x31')]=qs['offset'](_0x5add23[_0x277a('0x41')][_0x277a('0x31')]);}_0xd917e3['order']=qs[_0x277a('0x47')](_0x5add23[_0x277a('0x41')]['sort']);_0xd917e3['where']=qs['filters'](_['pick'](_0x5add23[_0x277a('0x41')],_0x5716ca[_0x277a('0x48')]),_0xec22);if(_0x5add23[_0x277a('0x41')][_0x277a('0x49')]){_0xd917e3['where']=_['merge'](_0xd917e3[_0x277a('0x4a')],{'$or':_[_0x277a('0x3a')](_0xec22,function(_0x523aae){if(_0x523aae[_0x277a('0x3e')]!=='VIRTUAL'){var _0x4e8748={};_0x4e8748[_0x523aae[_0x277a('0x39')]]={'$like':'%'+_0x5add23[_0x277a('0x41')]['filter']+'%'};return _0x4e8748;}})});}_0xd917e3=_['merge']({},_0xd917e3,_0x5add23['options']);var _0x2d7e1b={'where':_0xd917e3['where']};return db['ChatMessage'][_0x277a('0x30')](_0x2d7e1b)[_0x277a('0x22')](function(_0x490f37){_0x23f377[_0x277a('0x30')]=_0x490f37;if(_0x5add23[_0x277a('0x41')][_0x277a('0x4b')]){_0xd917e3[_0x277a('0x4c')]=[{'all':!![]}];}return db['ChatMessage'][_0x277a('0x4d')](_0xd917e3);})[_0x277a('0x22')](function(_0x168a13){_0x23f377[_0x277a('0x4e')]=_0x168a13;return _0x23f377;})[_0x277a('0x22')](respondWithFilteredResult(_0x5dfb9e,_0xd917e3))['catch'](handleError(_0x5dfb9e,null));};exports[_0x277a('0x4f')]=function(_0x428e58,_0x3f8400){var _0x3bb076={'raw':!![],'where':{'id':_0x428e58[_0x277a('0x50')]['id']}},_0x52706d={};_0x52706d[_0x277a('0x3f')]=_['keys'](db[_0x277a('0x3b')][_0x277a('0x3c')]);_0x52706d[_0x277a('0x41')]=_['keys'](_0x428e58[_0x277a('0x41')]);_0x52706d['filters']=_[_0x277a('0x42')](_0x52706d[_0x277a('0x3f')],_0x52706d[_0x277a('0x41')]);_0x3bb076[_0x277a('0x43')]=_[_0x277a('0x42')](_0x52706d[_0x277a('0x3f')],qs[_0x277a('0x44')](_0x428e58[_0x277a('0x41')][_0x277a('0x44')]));_0x3bb076[_0x277a('0x43')]=_0x3bb076[_0x277a('0x43')]['length']?_0x3bb076[_0x277a('0x43')]:_0x52706d[_0x277a('0x3f')];if(_0x428e58[_0x277a('0x41')]['includeAll']){_0x3bb076[_0x277a('0x4c')]=[{'all':!![]}];}_0x3bb076=_['merge']({},_0x3bb076,_0x428e58[_0x277a('0x51')]);return db['ChatMessage'][_0x277a('0x52')](_0x3bb076)['then'](handleEntityNotFound(_0x3f8400,null))[_0x277a('0x22')](respondWithResult(_0x3f8400,null))[_0x277a('0x53')](handleError(_0x3f8400,null));};exports[_0x277a('0x54')]=function(_0x2a13b7,_0x25f026){return db[_0x277a('0x3b')]['create'](_0x2a13b7['body'],{})[_0x277a('0x22')](respondWithResult(_0x25f026,0xc9))[_0x277a('0x53')](handleError(_0x25f026,null));};exports[_0x277a('0x55')]=function(_0x5060f3,_0x207918){if(_0x5060f3[_0x277a('0x56')]['id']){delete _0x5060f3[_0x277a('0x56')]['id'];}return db[_0x277a('0x3b')][_0x277a('0x52')]({'where':{'id':_0x5060f3['params']['id']}})[_0x277a('0x22')](handleEntityNotFound(_0x207918,null))[_0x277a('0x22')](saveUpdates(_0x5060f3[_0x277a('0x56')],null))['then'](respondWithResult(_0x207918,null))['catch'](handleError(_0x207918,null));};exports[_0x277a('0x37')]=function(_0x2d669a,_0xffdde2){return db[_0x277a('0x3b')][_0x277a('0x52')]({'where':{'id':_0x2d669a[_0x277a('0x50')]['id']}})[_0x277a('0x22')](handleEntityNotFound(_0xffdde2,null))[_0x277a('0x22')](removeEntity(_0xffdde2,null))['catch'](handleError(_0xffdde2,null));};exports[_0x277a('0x57')]=function(_0x3924a6,_0x33937f){return db[_0x277a('0x3b')]['describe']()[_0x277a('0x22')](respondWithResult(_0x33937f,null))[_0x277a('0x53')](handleError(_0x33937f,null));};var interaction_log=require(_0x277a('0x58'))(_0x277a('0x59'));exports[_0x277a('0x5a')]=function(_0x3da8a3,_0x1091eb,_0x382c44){var _0x4b3b0a={'channel':'chat'};if(_0x3da8a3[_0x277a('0x56')]['id']){delete _0x3da8a3[_0x277a('0x56')]['id'];}_0x3da8a3[_0x277a('0x56')][_0x277a('0x5b')]=!![];_0x3da8a3[_0x277a('0x56')]['readAt']=moment()[_0x277a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3da8a3['body'][_0x277a('0x5d')]=_0x3da8a3[_0x277a('0x56')][_0x277a('0x5d')]||_0x3da8a3['user']['id'];return db[_0x277a('0x3b')][_0x277a('0x52')]({'where':{'id':_0x3da8a3[_0x277a('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x277a('0x5e')],'as':_0x277a('0x5f')}]})['then'](handleEntityNotFound(_0x1091eb,null))['then'](saveUpdates(_0x3da8a3[_0x277a('0x56')],null))[_0x277a('0x22')](function(_0x44eadc){if(_0x44eadc){_0x4b3b0a['message']=_0x44eadc[_0x277a('0x60')]({'plain':!![]});return db[_0x277a('0x61')][_0x277a('0x52')]({'where':{'id':_0x44eadc[_0x277a('0x62')]}});}return null;})[_0x277a('0x22')](handleEntityNotFound(_0x1091eb,null))[_0x277a('0x22')](function(_0x525a96){if(_0x525a96){return _0x525a96[_0x277a('0x55')]({'UserId':_0x3da8a3[_0x277a('0x56')][_0x277a('0x5d')],'read1stAt':_[_0x277a('0x63')](_0x525a96[_0x277a('0x64')])?moment()[_0x277a('0x5c')](_0x277a('0x65')):undefined});}return null;})[_0x277a('0x22')](function(_0x2a551d){if(_0x2a551d){_0x4b3b0a[_0x277a('0x66')]=_0x2a551d[_0x277a('0x60')]({'plain':!![]});interaction_log[_0x277a('0x23')](_0x277a('0x67'),_0x3da8a3['user']['id'],_0x3da8a3[_0x277a('0x68')]['name'],_0x3da8a3['user']['role'],_0x4b3b0a['interaction']['id'],_0x3da8a3[_0x277a('0x56')]?JSON['stringify'](_0x3da8a3[_0x277a('0x56')]):_0x277a('0x69'));return respondWithRpcPromise(_0x277a('0x6a'),_0x277a('0x6b'),_0x4b3b0a);}return null;})[_0x277a('0x22')](function(_0x397f7d){if(_0x397f7d){if(_0x3da8a3[_0x277a('0x56')][_0x277a('0x6c')]){_0x4b3b0a[_0x277a('0x2b')][_0x277a('0x6d')]=util[_0x277a('0x5c')](_0x277a('0x6e'),_0x3da8a3['user'][_0x277a('0x39')]);_0x4b3b0a[_0x277a('0x2b')][_0x277a('0x6f')]=_0x4b3b0a[_0x277a('0x6f')];_0x4b3b0a[_0x277a('0x2b')]['event']=_0x277a('0x5a');return respondWithRpcPromise(_0x277a('0x70'),_0x277a('0x70'),{'event':_0x277a('0x71'),'message':_[_0x277a('0x72')](_0x4b3b0a[_0x277a('0x2b')],JSON['parse'](_0x4b3b0a['interaction'][_0x277a('0x73')]))},client9002)[_0x277a('0x22')](function(){return _0x4b3b0a;});}return _0x4b3b0a;}return null;})[_0x277a('0x22')](respondWithResult(_0x1091eb,null))[_0x277a('0x53')](handleError(_0x1091eb,null));};var interaction_log=require(_0x277a('0x58'))(_0x277a('0x59'));exports['reject']=function(_0x9c92d1,_0x2e37f0,_0x3fe4e3){var _0x535626={'agent':{},'channel':_0x277a('0x74')};if(_0x9c92d1[_0x277a('0x56')]['id']){delete _0x9c92d1[_0x277a('0x56')]['id'];}_0x9c92d1['body']['UserId']=_0x9c92d1[_0x277a('0x56')][_0x277a('0x5d')]||_0x9c92d1['user']['id'];_0x535626[_0x277a('0x75')]['id']=_0x9c92d1[_0x277a('0x56')][_0x277a('0x5d')];return db[_0x277a('0x3b')][_0x277a('0x52')]({'where':{'id':_0x9c92d1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e37f0,null))['then'](function(_0x19fbe3){if(_0x19fbe3){_0x535626['message']=_0x19fbe3[_0x277a('0x60')]({'plain':!![]});return db[_0x277a('0x61')][_0x277a('0x52')]({'where':{'id':_0x19fbe3[_0x277a('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x2e37f0,null))['then'](function(_0x42a25e){if(_0x42a25e){_0x535626[_0x277a('0x66')]=_0x42a25e[_0x277a('0x60')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x9c92d1[_0x277a('0x68')]['id'],_0x9c92d1[_0x277a('0x68')][_0x277a('0x39')],_0x9c92d1['user'][_0x277a('0x76')],_0x535626[_0x277a('0x66')]['id'],_0x9c92d1[_0x277a('0x56')]?JSON[_0x277a('0x28')](_0x9c92d1[_0x277a('0x56')]):'null');return respondWithRpcPromise(_0x277a('0x77'),_0x277a('0x78'),_0x535626);}return null;})[_0x277a('0x22')](function(_0x3ef58){if(_0x3ef58){_0x3ef58['message'][_0x277a('0x6d')]=util[_0x277a('0x5c')](_0x277a('0x6e'),_0x9c92d1[_0x277a('0x68')][_0x277a('0x39')]);_0x3ef58['message'][_0x277a('0x6f')]=_0x535626[_0x277a('0x6f')];_0x3ef58[_0x277a('0x2b')]['event']='reject';respondWithRpcPromise(_0x277a('0x70'),_0x277a('0x70'),{'event':_0x277a('0x79'),'message':_0x3ef58[_0x277a('0x2b')]},client9002);return _0x535626;}return null;})[_0x277a('0x22')](respondWithResult(_0x2e37f0,null))[_0x277a('0x53')](handleError(_0x2e37f0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index f459790..91af486 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 _0xcf6d=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','ChatMessage'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xcf6d,0x67));var _0xdcf6=function(_0x4dcd3d,_0x1ad254){_0x4dcd3d=_0x4dcd3d-0x0;var _0x3eef2d=_0xcf6d[_0x4dcd3d];return _0x3eef2d;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xdcf6('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xdcf6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdcf6('0x2'),'afterDestroy':_0xdcf6('0x3')};function emitEvent(_0x25d253){return function(_0x264340,_0x3dc82f,_0x3d5114){ChatMessageEvents[_0xdcf6('0x4')](_0x25d253+':'+_0x264340['id'],_0x264340);ChatMessageEvents['emit'](_0x25d253,_0x264340);_0x3d5114(null);};}for(var e in events){if(events[_0xdcf6('0x5')](e)){var event=events[e];ChatMessage[_0xdcf6('0x6')](e,emitEvent(event));}}module[_0xdcf6('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x0065=['hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','emit'];(function(_0x293014,_0x3108af){var _0x5134c8=function(_0x44f89e){while(--_0x44f89e){_0x293014['push'](_0x293014['shift']());}};_0x5134c8(++_0x3108af);}(_0x0065,0xbf));var _0x5006=function(_0x3e8c6d,_0x1b536f){_0x3e8c6d=_0x3e8c6d-0x0;var _0x450309=_0x0065[_0x3e8c6d];return _0x450309;};'use strict';var EventEmitter=require(_0x5006('0x0'));var ChatMessage=require(_0x5006('0x1'))['db'][_0x5006('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5006('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47596a){return function(_0xdde40e,_0xfd491f,_0x307c2f){ChatMessageEvents[_0x5006('0x4')](_0x47596a+':'+_0xdde40e['id'],_0xdde40e);ChatMessageEvents[_0x5006('0x4')](_0x47596a,_0xdde40e);_0x307c2f(null);};}for(var e in events){if(events[_0x5006('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x5006('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6e5343a..fa368e3 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 _0x3e22=['ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x86fa97,_0x31346d){var _0x3e34a0=function(_0x362cc7){while(--_0x362cc7){_0x86fa97['push'](_0x86fa97['shift']());}};_0x3e34a0(++_0x31346d);}(_0x3e22,0xd6));var _0x23e2=function(_0xa6d252,_0xf664a8){_0xa6d252=_0xa6d252-0x0;var _0x498d25=_0x3e22[_0xa6d252];return _0x498d25;};'use strict';var _=require(_0x23e2('0x0'));var util=require(_0x23e2('0x1'));var logger=require(_0x23e2('0x2'))(_0x23e2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23e2('0x4'));var fs=require('fs');var path=require(_0x23e2('0x5'));var rimraf=require(_0x23e2('0x6'));var config=require(_0x23e2('0x7'));var attributes=require('./chatMessage.attributes');module[_0x23e2('0x8')]=function(_0x8165c6,_0x19a1a3){return _0x8165c6[_0x23e2('0x9')](_0x23e2('0xa'),attributes,{'tableName':_0x23e2('0xb'),'paranoid':![],'indexes':[{'name':_0x23e2('0xc'),'fields':[_0x23e2('0xd')],'type':_0x23e2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e70b4,_0xcdefb0,_0x205fa5){var _0x1d3c34=_0x8165c6['models'];var _0x91d3cd=_0x2e70b4[_0x23e2('0xf')]({'plain':!![]});if(_0x91d3cd[_0x23e2('0x10')][_0x23e2('0x11')]()==='in'||_0x91d3cd[_0x23e2('0x10')][_0x23e2('0x11')]()==='out'&&!_0x91d3cd[_0x23e2('0x12')]&&!_[_0x23e2('0x13')](_0x91d3cd['UserId'])){_0x1d3c34[_0x23e2('0x14')][_0x23e2('0x15')]({'where':{'id':_0x91d3cd[_0x23e2('0x16')]}})[_0x23e2('0x17')](function(_0x125ce3){if(_0x125ce3){_0x125ce3[_0x23e2('0x18')]({'lastMsgAt':_0x91d3cd[_0x23e2('0x19')],'lastMsgDirection':_0x91d3cd[_0x23e2('0x10')]['toLowerCase']()});}})[_0x23e2('0x1a')](function(_0x44b3ee){console['error'](_0x44b3ee);});}_0x205fa5();}},'charset':_0x23e2('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7042=['out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','get','direction','toLowerCase'];(function(_0x40d3e4,_0x30bda8){var _0x781868=function(_0x5d5aac){while(--_0x5d5aac){_0x40d3e4['push'](_0x40d3e4['shift']());}};_0x781868(++_0x30bda8);}(_0x7042,0x16b));var _0x2704=function(_0x17700a,_0x4d45c3){_0x17700a=_0x17700a-0x0;var _0x7b7845=_0x7042[_0x17700a];return _0x7b7845;};'use strict';var _=require(_0x2704('0x0'));var util=require(_0x2704('0x1'));var logger=require('../../config/logger')(_0x2704('0x2'));var moment=require('moment');var BPromise=require(_0x2704('0x3'));var rp=require(_0x2704('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2704('0x5'));var config=require(_0x2704('0x6'));var attributes=require(_0x2704('0x7'));module['exports']=function(_0x1633cb,_0x4b7aae){return _0x1633cb[_0x2704('0x8')]('ChatMessage',attributes,{'tableName':_0x2704('0x9'),'paranoid':![],'indexes':[{'name':_0x2704('0xa'),'fields':[_0x2704('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x293e32,_0x4e7b65,_0x293580){var _0x20b081=_0x1633cb['models'];var _0xbd4e7c=_0x293e32[_0x2704('0xc')]({'plain':!![]});if(_0xbd4e7c[_0x2704('0xd')][_0x2704('0xe')]()==='in'||_0xbd4e7c[_0x2704('0xd')]['toLowerCase']()===_0x2704('0xf')&&!_0xbd4e7c[_0x2704('0x10')]&&!_[_0x2704('0x11')](_0xbd4e7c[_0x2704('0x12')])){_0x20b081[_0x2704('0x13')][_0x2704('0x14')]({'where':{'id':_0xbd4e7c[_0x2704('0x15')]}})[_0x2704('0x16')](function(_0x57aec3){if(_0x57aec3){_0x57aec3[_0x2704('0x17')]({'lastMsgAt':_0xbd4e7c['createdAt'],'lastMsgDirection':_0xbd4e7c['direction']['toLowerCase']()});}})['catch'](function(_0x3fd249){console[_0x2704('0x18')](_0x3fd249);});}_0x293580();}},'charset':_0x2704('0x19'),'collate':_0x2704('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4c52389..e0e4ea8 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 _0x01c7=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xdf9a3,_0x59b0ab){var _0xe01d17=function(_0x1c8dd6){while(--_0x1c8dd6){_0xdf9a3['push'](_0xdf9a3['shift']());}};_0xe01d17(++_0x59b0ab);}(_0x01c7,0x1e9));var _0x701c=function(_0x574af1,_0x53c393){_0x574af1=_0x574af1-0x0;var _0x2b8672=_0x01c7[_0x574af1];return _0x2b8672;};'use strict';var _=require(_0x701c('0x0'));var util=require(_0x701c('0x1'));var moment=require(_0x701c('0x2'));var BPromise=require(_0x701c('0x3'));var rs=require(_0x701c('0x4'));var fs=require('fs');var Redis=require(_0x701c('0x5'));var db=require(_0x701c('0x6'))['db'];var utils=require(_0x701c('0x7'));var logger=require(_0x701c('0x8'))(_0x701c('0x9'));var config=require('../../config/environment');var jayson=require(_0x701c('0xa'));var client=jayson[_0x701c('0xb')][_0x701c('0xc')]({'port':0x232a});config[_0x701c('0xd')]=_['defaults'](config['redis'],{'host':_0x701c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x701c('0xd')]));require(_0x701c('0xf'))['register'](socket);function respondWithRpcPromise(_0x264f8b,_0x416dcc,_0x531d24){return new BPromise(function(_0x256ff4,_0x35f573){return client['request'](_0x264f8b,_0x531d24)[_0x701c('0x10')](function(_0x4d5b46){logger['info'](_0x701c('0x11'),_0x416dcc,'request\x20sent');logger[_0x701c('0x12')](_0x701c('0x13'),_0x416dcc,_0x701c('0x14'),JSON[_0x701c('0x15')](_0x4d5b46));if(_0x4d5b46['error']){if(_0x4d5b46[_0x701c('0x16')][_0x701c('0x17')]===0x1f4){logger[_0x701c('0x16')]('ChatMessage,\x20%s,\x20%s',_0x416dcc,_0x4d5b46[_0x701c('0x16')][_0x701c('0x18')]);return _0x35f573(_0x4d5b46['error'][_0x701c('0x18')]);}logger[_0x701c('0x16')](_0x701c('0x11'),_0x416dcc,_0x4d5b46[_0x701c('0x16')][_0x701c('0x18')]);return _0x256ff4(_0x4d5b46[_0x701c('0x16')][_0x701c('0x18')]);}else{logger[_0x701c('0x19')](_0x701c('0x11'),_0x416dcc,'request\x20sent');_0x256ff4(_0x4d5b46[_0x701c('0x1a')][_0x701c('0x18')]);}})[_0x701c('0x1b')](function(_0x407b3c){logger[_0x701c('0x16')](_0x701c('0x11'),_0x416dcc,_0x407b3c);_0x35f573(_0x407b3c);});});}exports[_0x701c('0x1c')]=function(_0x148c5a){var _0x266874=this;return new Promise(function(_0xb114de,_0x4939f8){return db[_0x701c('0x1d')][_0x701c('0x1e')](_0x148c5a['body'],{'raw':_0x148c5a[_0x701c('0x1f')]?_0x148c5a['options'][_0x701c('0x20')]===undefined?!![]:![]:!![]})[_0x701c('0x10')](function(_0x665ceb){logger[_0x701c('0x19')](_0x701c('0x1c'),_0x148c5a);logger['debug'](_0x701c('0x1c'),_0x148c5a,JSON[_0x701c('0x15')](_0x665ceb));_0xb114de(_0x665ceb);})[_0x701c('0x1b')](function(_0x1b1493){logger[_0x701c('0x16')](_0x701c('0x1c'),_0x1b1493[_0x701c('0x18')],_0x148c5a);_0x4939f8(_0x266874[_0x701c('0x16')](0x1f4,_0x1b1493[_0x701c('0x18')]));});});}; \ No newline at end of file +var _0xe650=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','ChatMessage','body','options','raw','CreateChatMessage','debug','catch','lodash','util','bluebird'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xe650,0x126));var _0x0e65=function(_0x49c341,_0x5b9570){_0x49c341=_0x49c341-0x0;var _0x1c106d=_0xe650[_0x49c341];return _0x1c106d;};'use strict';var _=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var moment=require('moment');var BPromise=require(_0x0e65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e65('0x3'));var db=require(_0x0e65('0x4'))['db'];var utils=require(_0x0e65('0x5'));var logger=require(_0x0e65('0x6'))(_0x0e65('0x7'));var config=require(_0x0e65('0x8'));var jayson=require(_0x0e65('0x9'));var client=jayson['client'][_0x0e65('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0e65('0xb')],{'host':_0x0e65('0xc'),'port':0x18eb});var socket=require(_0x0e65('0xd'))(new Redis(config[_0x0e65('0xb')]));require(_0x0e65('0xe'))[_0x0e65('0xf')](socket);function respondWithRpcPromise(_0x59850c,_0x4e1766,_0x423b80){return new BPromise(function(_0x2adac6,_0x51a0b3){return client[_0x0e65('0x10')](_0x59850c,_0x423b80)[_0x0e65('0x11')](function(_0x2be232){logger['info']('ChatMessage,\x20%s,\x20%s',_0x4e1766,'request\x20sent');logger['debug'](_0x0e65('0x12'),_0x4e1766,_0x0e65('0x13'),JSON['stringify'](_0x2be232));if(_0x2be232[_0x0e65('0x14')]){if(_0x2be232[_0x0e65('0x14')][_0x0e65('0x15')]===0x1f4){logger[_0x0e65('0x14')](_0x0e65('0x16'),_0x4e1766,_0x2be232[_0x0e65('0x14')][_0x0e65('0x17')]);return _0x51a0b3(_0x2be232[_0x0e65('0x14')]['message']);}logger[_0x0e65('0x14')](_0x0e65('0x16'),_0x4e1766,_0x2be232[_0x0e65('0x14')][_0x0e65('0x17')]);return _0x2adac6(_0x2be232[_0x0e65('0x14')][_0x0e65('0x17')]);}else{logger[_0x0e65('0x18')](_0x0e65('0x16'),_0x4e1766,'request\x20sent');_0x2adac6(_0x2be232[_0x0e65('0x19')]['message']);}})['catch'](function(_0x3747ab){logger[_0x0e65('0x14')]('ChatMessage,\x20%s,\x20%s',_0x4e1766,_0x3747ab);_0x51a0b3(_0x3747ab);});});}exports['CreateChatMessage']=function(_0x42d6ed){var _0x25fa3f=this;return new Promise(function(_0x4cd159,_0x3f54e1){return db[_0x0e65('0x1a')]['create'](_0x42d6ed[_0x0e65('0x1b')],{'raw':_0x42d6ed[_0x0e65('0x1c')]?_0x42d6ed[_0x0e65('0x1c')][_0x0e65('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2032ee){logger[_0x0e65('0x18')](_0x0e65('0x1e'),_0x42d6ed);logger[_0x0e65('0x1f')]('CreateChatMessage',_0x42d6ed,JSON['stringify'](_0x2032ee));_0x4cd159(_0x2032ee);})[_0x0e65('0x20')](function(_0x5e7ec6){logger[_0x0e65('0x14')]('CreateChatMessage',_0x5e7ec6[_0x0e65('0x17')],_0x42d6ed);_0x3f54e1(_0x25fa3f[_0x0e65('0x14')](0x1f4,_0x5e7ec6[_0x0e65('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9bb325f..9b3ae6c 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 _0x2a07=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x5c37eb,_0x5becfe){var _0x43fee2=function(_0x476231){while(--_0x476231){_0x5c37eb['push'](_0x5c37eb['shift']());}};_0x43fee2(++_0x5becfe);}(_0x2a07,0x74));var _0x72a0=function(_0x445dc4,_0x3764da){_0x445dc4=_0x445dc4-0x0;var _0x19f060=_0x2a07[_0x445dc4];return _0x19f060;};'use strict';var ChatMessageEvents=require(_0x72a0('0x0'));var events=[_0x72a0('0x1'),_0x72a0('0x2'),_0x72a0('0x3')];function createListener(_0x1cad29,_0x548164){return function(_0x335b7c){_0x548164[_0x72a0('0x4')](_0x1cad29,_0x335b7c);};}function removeListener(_0x135982,_0x45b155){return function(){ChatMessageEvents[_0x72a0('0x5')](_0x135982,_0x45b155);};}exports[_0x72a0('0x6')]=function(_0x3ccf6d){for(var _0x20dab9=0x0,_0x193e3b=events[_0x72a0('0x7')];_0x20dab9<_0x193e3b;_0x20dab9++){var _0x21c819=events[_0x20dab9];var _0x2c04eb=createListener(_0x72a0('0x8')+_0x21c819,_0x3ccf6d);ChatMessageEvents['on'](_0x21c819,_0x2c04eb);}}; \ No newline at end of file +var _0xfdbd=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x4e322e,_0x1a3190){var _0x5ee728=function(_0x33e64a){while(--_0x33e64a){_0x4e322e['push'](_0x4e322e['shift']());}};_0x5ee728(++_0x1a3190);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xfdbd[_0xd09668];return _0x68726;};'use strict';var ChatMessageEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){ChatMessageEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);ChatMessageEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5ff67a6..8b4723c 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 _0xea51=['post','tracked','chat','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1fa4bd,_0x325a40){var _0x5ee352=function(_0x18b39d){while(--_0x18b39d){_0x1fa4bd['push'](_0x1fa4bd['shift']());}};_0x5ee352(++_0x325a40);}(_0xea51,0xf8));var _0x1ea5=function(_0x38cbd7,_0x503573){_0x38cbd7=_0x38cbd7-0x0;var _0x3f2923=_0xea51[_0x38cbd7];return _0x3f2923;};'use strict';var multer=require(_0x1ea5('0x0'));var util=require('util');var path=require(_0x1ea5('0x1'));var timeout=require(_0x1ea5('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1ea5('0x3'));var interaction=require(_0x1ea5('0x4'));var config=require(_0x1ea5('0x5'));var controller=require('./chatMessage.controller');router[_0x1ea5('0x6')]('/',auth[_0x1ea5('0x7')](),controller['index']);router[_0x1ea5('0x6')](_0x1ea5('0x8'),auth[_0x1ea5('0x7')](),controller[_0x1ea5('0x9')]);router[_0x1ea5('0x6')](_0x1ea5('0xa'),auth[_0x1ea5('0x7')](),controller[_0x1ea5('0xb')]);router[_0x1ea5('0xc')]('/',auth[_0x1ea5('0x7')](),interaction[_0x1ea5('0xd')](_0x1ea5('0xe'),_0x1ea5('0xf')),controller[_0x1ea5('0x10')]);router['put']('/:id',controller[_0x1ea5('0x11')]);router[_0x1ea5('0x12')](_0x1ea5('0x13'),auth['isAuthenticated'](),controller[_0x1ea5('0x14')]);router['put'](_0x1ea5('0x15'),auth['isAuthenticated'](),controller[_0x1ea5('0x16')]);router[_0x1ea5('0x17')]('/:id',auth[_0x1ea5('0x7')](),controller[_0x1ea5('0x18')]);module[_0x1ea5('0x19')]=router; \ No newline at end of file +var _0x3242=['index','/describe','describe','/:id','post','tracked','chat','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./chatMessage.controller','get','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3242,0x87));var _0x2324=function(_0x33aded,_0x173eb7){_0x33aded=_0x33aded-0x0;var _0x3e1558=_0x3242[_0x33aded];return _0x3e1558;};'use strict';var multer=require(_0x2324('0x0'));var util=require(_0x2324('0x1'));var path=require(_0x2324('0x2'));var timeout=require(_0x2324('0x3'));var express=require(_0x2324('0x4'));var router=express['Router']();var auth=require(_0x2324('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2324('0x6'));router[_0x2324('0x7')]('/',auth[_0x2324('0x8')](),controller[_0x2324('0x9')]);router[_0x2324('0x7')](_0x2324('0xa'),auth[_0x2324('0x8')](),controller[_0x2324('0xb')]);router['get'](_0x2324('0xc'),auth[_0x2324('0x8')](),controller['show']);router[_0x2324('0xd')]('/',auth[_0x2324('0x8')](),interaction[_0x2324('0xe')](_0x2324('0xf'),'chatmessage:create'),controller['create']);router[_0x2324('0x10')](_0x2324('0xc'),controller[_0x2324('0x11')]);router[_0x2324('0x10')](_0x2324('0x12'),auth[_0x2324('0x8')](),controller[_0x2324('0x13')]);router[_0x2324('0x10')](_0x2324('0x14'),auth[_0x2324('0x8')](),controller[_0x2324('0x15')]);router['delete'](_0x2324('0xc'),auth[_0x2324('0x8')](),controller[_0x2324('0x16')]);module[_0x2324('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f32a319..1d60e68 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 _0x494e=['exports','TEXT','medium','sequelize'];(function(_0x54f01a,_0x12e01c){var _0x4787f1=function(_0x89ae1b){while(--_0x89ae1b){_0x54f01a['push'](_0x54f01a['shift']());}};_0x4787f1(++_0x12e01c);}(_0x494e,0xf3));var _0xe494=function(_0x5c5f2a,_0x324c91){_0x5c5f2a=_0x5c5f2a-0x0;var _0x3e9f1a=_0x494e[_0x5c5f2a];return _0x3e9f1a;};'use strict';var Sequelize=require(_0xe494('0x0'));module[_0xe494('0x1')]={'body':{'type':Sequelize[_0xe494('0x2')](_0xe494('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x81c9=['sequelize'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x81c9,0x193));var _0x981c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x81c9[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x981c('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index d116728..4bd8f72 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 _0x7ff5=['bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','error','name','send','index','map','ChatOfflineMessage','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7ff5,0xcd));var _0x57ff=function(_0x101760,_0x40781f){_0x101760=_0x101760-0x0;var _0x59c49a=_0x7ff5[_0x101760];return _0x59c49a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57ff('0x0'));var rimraf=require(_0x57ff('0x1'));var zipdir=require(_0x57ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57ff('0x3'));var moment=require(_0x57ff('0x4'));var BPromise=require(_0x57ff('0x5'));var Mustache=require('mustache');var util=require(_0x57ff('0x6'));var path=require('path');var sox=require(_0x57ff('0x7'));var csv=require(_0x57ff('0x8'));var ejs=require(_0x57ff('0x9'));var fs=require('fs');var _=require(_0x57ff('0xa'));var squel=require('squel');var crypto=require(_0x57ff('0xb'));var jsforce=require(_0x57ff('0xc'));var deskjs=require(_0x57ff('0xd'));var toCsv=require(_0x57ff('0x8'));var querystring=require(_0x57ff('0xe'));var Papa=require(_0x57ff('0xf'));var Redis=require(_0x57ff('0x10'));var authService=require(_0x57ff('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x57ff('0x12'));var hardwareService=require(_0x57ff('0x13'));var logger=require(_0x57ff('0x14'))(_0x57ff('0x15'));var utils=require(_0x57ff('0x16'));var config=require(_0x57ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x57ff('0x18'))['db'];function respondWithStatusCode(_0x1c1ef3,_0xa7c6a4){_0xa7c6a4=_0xa7c6a4||0xcc;return function(_0x39ff9c){if(_0x39ff9c){return _0x1c1ef3[_0x57ff('0x19')](_0xa7c6a4);}return _0x1c1ef3[_0x57ff('0x1a')](_0xa7c6a4)[_0x57ff('0x1b')]();};}function respondWithResult(_0x214d95,_0x41d4cf){_0x41d4cf=_0x41d4cf||0xc8;return function(_0x83a17e){if(_0x83a17e){return _0x214d95[_0x57ff('0x1a')](_0x41d4cf)['json'](_0x83a17e);}};}function respondWithFilteredResult(_0x30fd66,_0x5ecd6a){return function(_0x352c60){if(_0x352c60){var _0x4c09e3=_0x352c60[_0x57ff('0x1c')],_0x108be4=_0x5ecd6a[_0x57ff('0x1d')],_0x211338=_0x5ecd6a[_0x57ff('0x1d')]+_0x5ecd6a[_0x57ff('0x1e')],_0x2437c2;if(_0x211338>=_0x4c09e3){_0x211338=_0x4c09e3;_0x2437c2=0xc8;}else{_0x2437c2=0xce;}_0x30fd66[_0x57ff('0x1a')](_0x2437c2);return _0x30fd66[_0x57ff('0x1f')]('Content-Range',_0x108be4+'-'+_0x211338+'/'+_0x4c09e3)[_0x57ff('0x20')](_0x352c60);}return null;};}function patchUpdates(_0x31e07f){return function(_0x1afda9){try{jsonpatch[_0x57ff('0x21')](_0x1afda9,_0x31e07f,!![]);}catch(_0x58c3dc){return BPromise[_0x57ff('0x22')](_0x58c3dc);}return _0x1afda9['save']();};}function saveUpdates(_0x226a89,_0x1cae38){return function(_0xe536cc){if(_0xe536cc){return _0xe536cc[_0x57ff('0x23')](_0x226a89)[_0x57ff('0x24')](function(_0x309baf){return _0x309baf;});}return null;};}function removeEntity(_0x14d140,_0x2177b4){return function(_0x91a911){if(_0x91a911){return _0x91a911[_0x57ff('0x25')]()[_0x57ff('0x24')](function(){_0x14d140[_0x57ff('0x1a')](0xcc)[_0x57ff('0x1b')]();});}};}function handleEntityNotFound(_0x39a6a9,_0x299060){return function(_0x38dcfd){if(!_0x38dcfd){_0x39a6a9[_0x57ff('0x19')](0x194);}return _0x38dcfd;};}function handleError(_0x16622e,_0x2c884f){_0x2c884f=_0x2c884f||0x1f4;return function(_0x2e6ef2){logger[_0x57ff('0x26')](_0x2e6ef2['stack']);if(_0x2e6ef2[_0x57ff('0x27')]){delete _0x2e6ef2[_0x57ff('0x27')];}_0x16622e[_0x57ff('0x1a')](_0x2c884f)[_0x57ff('0x28')](_0x2e6ef2);};}exports[_0x57ff('0x29')]=function(_0x45933b,_0x2e30c9){var _0x134aba={},_0x8290a9={},_0x48af93={'count':0x0,'rows':[]};var _0x1c5581=_[_0x57ff('0x2a')](db[_0x57ff('0x2b')]['rawAttributes'],function(_0xebbdd){return{'name':_0xebbdd[_0x57ff('0x2c')],'type':_0xebbdd[_0x57ff('0x2d')][_0x57ff('0x2e')]};});_0x8290a9[_0x57ff('0x2f')]=_[_0x57ff('0x2a')](_0x1c5581,'name');_0x8290a9[_0x57ff('0x30')]=_['keys'](_0x45933b[_0x57ff('0x30')]);_0x8290a9[_0x57ff('0x31')]=_['intersection'](_0x8290a9['model'],_0x8290a9['query']);_0x134aba[_0x57ff('0x32')]=_[_0x57ff('0x33')](_0x8290a9[_0x57ff('0x2f')],qs[_0x57ff('0x34')](_0x45933b[_0x57ff('0x30')][_0x57ff('0x34')]));_0x134aba[_0x57ff('0x32')]=_0x134aba[_0x57ff('0x32')][_0x57ff('0x35')]?_0x134aba[_0x57ff('0x32')]:_0x8290a9['model'];if(!_0x45933b['query'][_0x57ff('0x36')](_0x57ff('0x37'))){_0x134aba['limit']=qs[_0x57ff('0x1e')](_0x45933b[_0x57ff('0x30')][_0x57ff('0x1e')]);_0x134aba[_0x57ff('0x1d')]=qs[_0x57ff('0x1d')](_0x45933b['query'][_0x57ff('0x1d')]);}_0x134aba['order']=qs[_0x57ff('0x38')](_0x45933b[_0x57ff('0x30')][_0x57ff('0x38')]);_0x134aba[_0x57ff('0x39')]=qs[_0x57ff('0x31')](_[_0x57ff('0x3a')](_0x45933b['query'],_0x8290a9[_0x57ff('0x31')]),_0x1c5581);if(_0x45933b[_0x57ff('0x30')]['filter']){_0x134aba[_0x57ff('0x39')]=_['merge'](_0x134aba[_0x57ff('0x39')],{'$or':_[_0x57ff('0x2a')](_0x1c5581,function(_0x598397){if(_0x598397[_0x57ff('0x2d')]!=='VIRTUAL'){var _0x4582d4={};_0x4582d4[_0x598397['name']]={'$like':'%'+_0x45933b[_0x57ff('0x30')]['filter']+'%'};return _0x4582d4;}})});}_0x134aba=_[_0x57ff('0x3b')]({},_0x134aba,_0x45933b[_0x57ff('0x3c')]);var _0x62179b={'where':_0x134aba[_0x57ff('0x39')]};return db['ChatOfflineMessage'][_0x57ff('0x1c')](_0x62179b)[_0x57ff('0x24')](function(_0x4fc6c9){_0x48af93['count']=_0x4fc6c9;if(_0x45933b['query'][_0x57ff('0x3d')]){_0x134aba[_0x57ff('0x3e')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x134aba);})['then'](function(_0x146f5f){_0x48af93['rows']=_0x146f5f;return _0x48af93;})['then'](respondWithFilteredResult(_0x2e30c9,_0x134aba))[_0x57ff('0x3f')](handleError(_0x2e30c9,null));};exports['show']=function(_0x2aae34,_0x126b46){var _0x3e02d5={'raw':!![],'where':{'id':_0x2aae34[_0x57ff('0x40')]['id']}},_0x1047b4={};_0x1047b4[_0x57ff('0x2f')]=_[_0x57ff('0x41')](db[_0x57ff('0x2b')]['rawAttributes']);_0x1047b4['query']=_[_0x57ff('0x41')](_0x2aae34[_0x57ff('0x30')]);_0x1047b4[_0x57ff('0x31')]=_[_0x57ff('0x33')](_0x1047b4[_0x57ff('0x2f')],_0x1047b4[_0x57ff('0x30')]);_0x3e02d5['attributes']=_[_0x57ff('0x33')](_0x1047b4[_0x57ff('0x2f')],qs['fields'](_0x2aae34['query'][_0x57ff('0x34')]));_0x3e02d5[_0x57ff('0x32')]=_0x3e02d5[_0x57ff('0x32')][_0x57ff('0x35')]?_0x3e02d5[_0x57ff('0x32')]:_0x1047b4['model'];if(_0x2aae34[_0x57ff('0x30')]['includeAll']){_0x3e02d5['include']=[{'all':!![]}];}_0x3e02d5=_['merge']({},_0x3e02d5,_0x2aae34[_0x57ff('0x3c')]);return db[_0x57ff('0x2b')][_0x57ff('0x42')](_0x3e02d5)['then'](handleEntityNotFound(_0x126b46,null))[_0x57ff('0x24')](respondWithResult(_0x126b46,null))[_0x57ff('0x3f')](handleError(_0x126b46,null));};exports[_0x57ff('0x43')]=function(_0x508c8a,_0xe1ddc7){return db[_0x57ff('0x2b')][_0x57ff('0x43')](_0x508c8a['body'],{})['then'](respondWithResult(_0xe1ddc7,0xc9))['catch'](handleError(_0xe1ddc7,null));};exports[_0x57ff('0x23')]=function(_0x2f047f,_0x41b194){if(_0x2f047f['body']['id']){delete _0x2f047f[_0x57ff('0x44')]['id'];}return db[_0x57ff('0x2b')][_0x57ff('0x42')]({'where':{'id':_0x2f047f['params']['id']}})['then'](handleEntityNotFound(_0x41b194,null))['then'](saveUpdates(_0x2f047f[_0x57ff('0x44')],null))[_0x57ff('0x24')](respondWithResult(_0x41b194,null))['catch'](handleError(_0x41b194,null));};exports[_0x57ff('0x25')]=function(_0x38f962,_0x1fbdc7){return db[_0x57ff('0x2b')][_0x57ff('0x42')]({'where':{'id':_0x38f962[_0x57ff('0x40')]['id']}})[_0x57ff('0x24')](handleEntityNotFound(_0x1fbdc7,null))[_0x57ff('0x24')](removeEntity(_0x1fbdc7,null))[_0x57ff('0x3f')](handleError(_0x1fbdc7,null));};exports[_0x57ff('0x45')]=function(_0x24190a,_0x40f530){return db[_0x57ff('0x2b')][_0x57ff('0x45')]()[_0x57ff('0x24')](respondWithResult(_0x40f530,null))[_0x57ff('0x3f')](handleError(_0x40f530,null));}; \ No newline at end of file +var _0x2b4f=['options','count','includeAll','findAll','rows','show','params','keys','filters','fields','length','find','catch','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','sendStatus','name','send','index','ChatOfflineMessage','rawAttributes','type','model','map','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xf3a61c,_0x4ef53d){var _0xc30e18=function(_0x29612b){while(--_0x29612b){_0xf3a61c['push'](_0xf3a61c['shift']());}};_0xc30e18(++_0x4ef53d);}(_0x2b4f,0x142));var _0xf2b4=function(_0x5e2c36,_0x448fc5){_0x5e2c36=_0x5e2c36-0x0;var _0x498fba=_0x2b4f[_0x5e2c36];return _0x498fba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2b4('0x1'));var jsonpatch=require(_0xf2b4('0x2'));var rp=require(_0xf2b4('0x3'));var moment=require(_0xf2b4('0x4'));var BPromise=require(_0xf2b4('0x5'));var Mustache=require('mustache');var util=require(_0xf2b4('0x6'));var path=require(_0xf2b4('0x7'));var sox=require(_0xf2b4('0x8'));var csv=require(_0xf2b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2b4('0xa'));var squel=require('squel');var crypto=require(_0xf2b4('0xb'));var jsforce=require(_0xf2b4('0xc'));var deskjs=require(_0xf2b4('0xd'));var toCsv=require(_0xf2b4('0x9'));var querystring=require(_0xf2b4('0xe'));var Papa=require(_0xf2b4('0xf'));var Redis=require(_0xf2b4('0x10'));var authService=require(_0xf2b4('0x11'));var qs=require(_0xf2b4('0x12'));var as=require(_0xf2b4('0x13'));var hardwareService=require(_0xf2b4('0x14'));var logger=require(_0xf2b4('0x15'))(_0xf2b4('0x16'));var utils=require(_0xf2b4('0x17'));var config=require(_0xf2b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2b4('0x19'))['db'];function respondWithStatusCode(_0x39f318,_0x25942b){_0x25942b=_0x25942b||0xcc;return function(_0x2c4495){if(_0x2c4495){return _0x39f318['sendStatus'](_0x25942b);}return _0x39f318['status'](_0x25942b)[_0xf2b4('0x1a')]();};}function respondWithResult(_0x5172c0,_0x435022){_0x435022=_0x435022||0xc8;return function(_0x1f5b60){if(_0x1f5b60){return _0x5172c0[_0xf2b4('0x1b')](_0x435022)['json'](_0x1f5b60);}};}function respondWithFilteredResult(_0x4fcecf,_0x39fcea){return function(_0x235ad7){if(_0x235ad7){var _0x3daaf6=_0x235ad7['count'],_0x323f7b=_0x39fcea[_0xf2b4('0x1c')],_0x562ab8=_0x39fcea[_0xf2b4('0x1c')]+_0x39fcea[_0xf2b4('0x1d')],_0x3d57a3;if(_0x562ab8>=_0x3daaf6){_0x562ab8=_0x3daaf6;_0x3d57a3=0xc8;}else{_0x3d57a3=0xce;}_0x4fcecf[_0xf2b4('0x1b')](_0x3d57a3);return _0x4fcecf[_0xf2b4('0x1e')](_0xf2b4('0x1f'),_0x323f7b+'-'+_0x562ab8+'/'+_0x3daaf6)[_0xf2b4('0x20')](_0x235ad7);}return null;};}function patchUpdates(_0x5b63b9){return function(_0x4a1b6a){try{jsonpatch[_0xf2b4('0x21')](_0x4a1b6a,_0x5b63b9,!![]);}catch(_0x23e9b6){return BPromise[_0xf2b4('0x22')](_0x23e9b6);}return _0x4a1b6a[_0xf2b4('0x23')]();};}function saveUpdates(_0x38afe7,_0x305fa0){return function(_0x15dcd6){if(_0x15dcd6){return _0x15dcd6['update'](_0x38afe7)[_0xf2b4('0x24')](function(_0x12f1c0){return _0x12f1c0;});}return null;};}function removeEntity(_0x2b3897,_0x5fc66e){return function(_0x51330b){if(_0x51330b){return _0x51330b['destroy']()[_0xf2b4('0x24')](function(){_0x2b3897[_0xf2b4('0x1b')](0xcc)[_0xf2b4('0x1a')]();});}};}function handleEntityNotFound(_0x290658,_0x7daac1){return function(_0x4561d7){if(!_0x4561d7){_0x290658[_0xf2b4('0x25')](0x194);}return _0x4561d7;};}function handleError(_0x4346c1,_0x2ee93b){_0x2ee93b=_0x2ee93b||0x1f4;return function(_0x1b9fb4){logger['error'](_0x1b9fb4['stack']);if(_0x1b9fb4[_0xf2b4('0x26')]){delete _0x1b9fb4[_0xf2b4('0x26')];}_0x4346c1['status'](_0x2ee93b)[_0xf2b4('0x27')](_0x1b9fb4);};}exports[_0xf2b4('0x28')]=function(_0x3007eb,_0x19eec2){var _0x181e50={},_0x2f8606={},_0xcff709={'count':0x0,'rows':[]};var _0x444875=_['map'](db[_0xf2b4('0x29')][_0xf2b4('0x2a')],function(_0xe7971a){return{'name':_0xe7971a['fieldName'],'type':_0xe7971a[_0xf2b4('0x2b')]['key']};});_0x2f8606[_0xf2b4('0x2c')]=_[_0xf2b4('0x2d')](_0x444875,_0xf2b4('0x26'));_0x2f8606['query']=_['keys'](_0x3007eb[_0xf2b4('0x2e')]);_0x2f8606['filters']=_['intersection'](_0x2f8606['model'],_0x2f8606[_0xf2b4('0x2e')]);_0x181e50[_0xf2b4('0x2f')]=_[_0xf2b4('0x30')](_0x2f8606[_0xf2b4('0x2c')],qs['fields'](_0x3007eb[_0xf2b4('0x2e')]['fields']));_0x181e50[_0xf2b4('0x2f')]=_0x181e50[_0xf2b4('0x2f')]['length']?_0x181e50['attributes']:_0x2f8606[_0xf2b4('0x2c')];if(!_0x3007eb[_0xf2b4('0x2e')][_0xf2b4('0x31')](_0xf2b4('0x32'))){_0x181e50[_0xf2b4('0x1d')]=qs[_0xf2b4('0x1d')](_0x3007eb[_0xf2b4('0x2e')]['limit']);_0x181e50[_0xf2b4('0x1c')]=qs['offset'](_0x3007eb[_0xf2b4('0x2e')][_0xf2b4('0x1c')]);}_0x181e50[_0xf2b4('0x33')]=qs[_0xf2b4('0x34')](_0x3007eb['query'][_0xf2b4('0x34')]);_0x181e50[_0xf2b4('0x35')]=qs['filters'](_[_0xf2b4('0x36')](_0x3007eb[_0xf2b4('0x2e')],_0x2f8606['filters']),_0x444875);if(_0x3007eb[_0xf2b4('0x2e')][_0xf2b4('0x37')]){_0x181e50[_0xf2b4('0x35')]=_[_0xf2b4('0x38')](_0x181e50[_0xf2b4('0x35')],{'$or':_[_0xf2b4('0x2d')](_0x444875,function(_0x413ca5){if(_0x413ca5['type']!==_0xf2b4('0x39')){var _0x183c9a={};_0x183c9a[_0x413ca5[_0xf2b4('0x26')]]={'$like':'%'+_0x3007eb[_0xf2b4('0x2e')][_0xf2b4('0x37')]+'%'};return _0x183c9a;}})});}_0x181e50=_[_0xf2b4('0x38')]({},_0x181e50,_0x3007eb[_0xf2b4('0x3a')]);var _0x121f8f={'where':_0x181e50[_0xf2b4('0x35')]};return db[_0xf2b4('0x29')]['count'](_0x121f8f)['then'](function(_0x2185f6){_0xcff709[_0xf2b4('0x3b')]=_0x2185f6;if(_0x3007eb[_0xf2b4('0x2e')][_0xf2b4('0x3c')]){_0x181e50['include']=[{'all':!![]}];}return db[_0xf2b4('0x29')][_0xf2b4('0x3d')](_0x181e50);})[_0xf2b4('0x24')](function(_0x2c5bc4){_0xcff709[_0xf2b4('0x3e')]=_0x2c5bc4;return _0xcff709;})[_0xf2b4('0x24')](respondWithFilteredResult(_0x19eec2,_0x181e50))['catch'](handleError(_0x19eec2,null));};exports[_0xf2b4('0x3f')]=function(_0xe64d82,_0x3968d4){var _0x1dedb3={'raw':!![],'where':{'id':_0xe64d82[_0xf2b4('0x40')]['id']}},_0x45530a={};_0x45530a[_0xf2b4('0x2c')]=_[_0xf2b4('0x41')](db['ChatOfflineMessage']['rawAttributes']);_0x45530a[_0xf2b4('0x2e')]=_[_0xf2b4('0x41')](_0xe64d82['query']);_0x45530a[_0xf2b4('0x42')]=_[_0xf2b4('0x30')](_0x45530a['model'],_0x45530a['query']);_0x1dedb3[_0xf2b4('0x2f')]=_[_0xf2b4('0x30')](_0x45530a[_0xf2b4('0x2c')],qs[_0xf2b4('0x43')](_0xe64d82[_0xf2b4('0x2e')][_0xf2b4('0x43')]));_0x1dedb3[_0xf2b4('0x2f')]=_0x1dedb3[_0xf2b4('0x2f')][_0xf2b4('0x44')]?_0x1dedb3[_0xf2b4('0x2f')]:_0x45530a[_0xf2b4('0x2c')];if(_0xe64d82['query'][_0xf2b4('0x3c')]){_0x1dedb3['include']=[{'all':!![]}];}_0x1dedb3=_[_0xf2b4('0x38')]({},_0x1dedb3,_0xe64d82[_0xf2b4('0x3a')]);return db['ChatOfflineMessage'][_0xf2b4('0x45')](_0x1dedb3)[_0xf2b4('0x24')](handleEntityNotFound(_0x3968d4,null))[_0xf2b4('0x24')](respondWithResult(_0x3968d4,null))[_0xf2b4('0x46')](handleError(_0x3968d4,null));};exports[_0xf2b4('0x47')]=function(_0x2fc782,_0x34ddda){return db['ChatOfflineMessage']['create'](_0x2fc782[_0xf2b4('0x48')],{})[_0xf2b4('0x24')](respondWithResult(_0x34ddda,0xc9))[_0xf2b4('0x46')](handleError(_0x34ddda,null));};exports[_0xf2b4('0x49')]=function(_0x37bd9a,_0x188199){if(_0x37bd9a[_0xf2b4('0x48')]['id']){delete _0x37bd9a['body']['id'];}return db['ChatOfflineMessage'][_0xf2b4('0x45')]({'where':{'id':_0x37bd9a[_0xf2b4('0x40')]['id']}})[_0xf2b4('0x24')](handleEntityNotFound(_0x188199,null))['then'](saveUpdates(_0x37bd9a['body'],null))[_0xf2b4('0x24')](respondWithResult(_0x188199,null))['catch'](handleError(_0x188199,null));};exports[_0xf2b4('0x4a')]=function(_0x144cf7,_0x2f9d92){return db[_0xf2b4('0x29')][_0xf2b4('0x45')]({'where':{'id':_0x144cf7['params']['id']}})['then'](handleEntityNotFound(_0x2f9d92,null))[_0xf2b4('0x24')](removeEntity(_0x2f9d92,null))[_0xf2b4('0x46')](handleError(_0x2f9d92,null));};exports[_0xf2b4('0x4b')]=function(_0x3e7612,_0x41c200){return db[_0xf2b4('0x29')][_0xf2b4('0x4b')]()[_0xf2b4('0x24')](respondWithResult(_0x41c200,null))[_0xf2b4('0x46')](handleError(_0x41c200,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 9d904c1..0c23209 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 _0x032e=['api','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x599bb4,_0x3cce13){var _0x11c5c0=function(_0x3c4ef4){while(--_0x3c4ef4){_0x599bb4['push'](_0x599bb4['shift']());}};_0x11c5c0(++_0x3cce13);}(_0x032e,0x124));var _0xe032=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x032e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe032('0xc'),'collate':_0xe032('0xd')});}; \ No newline at end of file +var _0x032e=['api','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x50a008,_0x46083e){var _0x165d01=function(_0x54c50f){while(--_0x54c50f){_0x50a008['push'](_0x50a008['shift']());}};_0x165d01(++_0x46083e);}(_0x032e,0x124));var _0xe032=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x032e[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe032('0xc'),'collate':_0xe032('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b835ddf..82fb7e2 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 _0x9349=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5ca784,_0x28bea2){var _0x5aa579=function(_0x531234){while(--_0x531234){_0x5ca784['push'](_0x5ca784['shift']());}};_0x5aa579(++_0x28bea2);}(_0x9349,0x6d));var _0x9934=function(_0xca1cd4,_0x424206){_0xca1cd4=_0xca1cd4-0x0;var _0x3848ea=_0x9349[_0xca1cd4];return _0x3848ea;};'use strict';var _=require(_0x9934('0x0'));var util=require(_0x9934('0x1'));var moment=require('moment');var BPromise=require(_0x9934('0x2'));var rs=require(_0x9934('0x3'));var fs=require('fs');var Redis=require(_0x9934('0x4'));var db=require(_0x9934('0x5'))['db'];var utils=require(_0x9934('0x6'));var logger=require(_0x9934('0x7'))(_0x9934('0x8'));var config=require(_0x9934('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9934('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46c8cb,_0x20e9e5,_0x5d3355){return new BPromise(function(_0x235496,_0x484847){return client[_0x9934('0xb')](_0x46c8cb,_0x5d3355)[_0x9934('0xc')](function(_0x2d4147){logger[_0x9934('0xd')](_0x9934('0xe'),_0x20e9e5,'request\x20sent');logger[_0x9934('0xf')](_0x9934('0x10'),_0x20e9e5,_0x9934('0x11'),JSON['stringify'](_0x2d4147));if(_0x2d4147['error']){if(_0x2d4147['error'][_0x9934('0x12')]===0x1f4){logger[_0x9934('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x20e9e5,_0x2d4147[_0x9934('0x13')][_0x9934('0x14')]);return _0x484847(_0x2d4147[_0x9934('0x13')]['message']);}logger[_0x9934('0x13')](_0x9934('0xe'),_0x20e9e5,_0x2d4147[_0x9934('0x13')][_0x9934('0x14')]);return _0x235496(_0x2d4147[_0x9934('0x13')][_0x9934('0x14')]);}else{logger['info'](_0x9934('0xe'),_0x20e9e5,_0x9934('0x11'));_0x235496(_0x2d4147[_0x9934('0x15')]['message']);}})[_0x9934('0x16')](function(_0x4798c0){logger[_0x9934('0x13')](_0x9934('0xe'),_0x20e9e5,_0x4798c0);_0x484847(_0x4798c0);});});} \ No newline at end of file +var _0x745c=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x745c,0xb0));var _0xc745=function(_0x53fb63,_0x2497b0){_0x53fb63=_0x53fb63-0x0;var _0x3fd488=_0x745c[_0x53fb63];return _0x3fd488;};'use strict';var _=require('lodash');var util=require(_0xc745('0x0'));var moment=require(_0xc745('0x1'));var BPromise=require(_0xc745('0x2'));var rs=require(_0xc745('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc745('0x4'))['db'];var utils=require(_0xc745('0x5'));var logger=require(_0xc745('0x6'))('rpc');var config=require(_0xc745('0x7'));var jayson=require(_0xc745('0x8'));var client=jayson[_0xc745('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c0bc,_0xe49c8b,_0x363e67){return new BPromise(function(_0x4bc2dd,_0x3937d9){return client['request'](_0x4c0bc,_0x363e67)[_0xc745('0xa')](function(_0x3403ec){logger[_0xc745('0xb')](_0xc745('0xc'),_0xe49c8b,_0xc745('0xd'));logger[_0xc745('0xe')](_0xc745('0xf'),_0xe49c8b,'request\x20sent',JSON['stringify'](_0x3403ec));if(_0x3403ec['error']){if(_0x3403ec[_0xc745('0x10')][_0xc745('0x11')]===0x1f4){logger[_0xc745('0x10')](_0xc745('0xc'),_0xe49c8b,_0x3403ec[_0xc745('0x10')][_0xc745('0x12')]);return _0x3937d9(_0x3403ec[_0xc745('0x10')][_0xc745('0x12')]);}logger[_0xc745('0x10')](_0xc745('0xc'),_0xe49c8b,_0x3403ec[_0xc745('0x10')][_0xc745('0x12')]);return _0x4bc2dd(_0x3403ec['error'][_0xc745('0x12')]);}else{logger[_0xc745('0xb')](_0xc745('0xc'),_0xe49c8b,'request\x20sent');_0x4bc2dd(_0x3403ec[_0xc745('0x13')][_0xc745('0x12')]);}})[_0xc745('0x14')](function(_0x5ab729){logger[_0xc745('0x10')](_0xc745('0xc'),_0xe49c8b,_0x5ab729);_0x3937d9(_0x5ab729);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index cf0f2e5..96f8ec6 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 _0x6135=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update'];(function(_0x5099fa,_0x733aa2){var _0x965f5b=function(_0x5d6397){while(--_0x5d6397){_0x5099fa['push'](_0x5099fa['shift']());}};_0x965f5b(++_0x733aa2);}(_0x6135,0x80));var _0x5613=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x6135[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x5613('0x0'));var util=require(_0x5613('0x1'));var path=require(_0x5613('0x2'));var timeout=require(_0x5613('0x3'));var express=require(_0x5613('0x4'));var router=express[_0x5613('0x5')]();var auth=require(_0x5613('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5613('0x7'));var controller=require(_0x5613('0x8'));router[_0x5613('0x9')]('/',auth['isAuthenticated'](),controller[_0x5613('0xa')]);router[_0x5613('0x9')](_0x5613('0xb'),auth['isAuthenticated'](),controller[_0x5613('0xc')]);router[_0x5613('0x9')](_0x5613('0xd'),auth[_0x5613('0xe')](),controller[_0x5613('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5613('0x10')]);router[_0x5613('0x11')](_0x5613('0xd'),auth[_0x5613('0xe')](),controller[_0x5613('0x12')]);router['delete']('/:id',auth[_0x5613('0xe')](),controller[_0x5613('0x13')]);module[_0x5613('0x14')]=router; \ No newline at end of file +var _0x4d51=['show','post','create','put','update','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x4d51,0x16f));var _0x14d5=function(_0x35367b,_0x514fea){_0x35367b=_0x35367b-0x0;var _0x13da13=_0x4d51[_0x35367b];return _0x13da13;};'use strict';var multer=require(_0x14d5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x14d5('0x1'));var router=express[_0x14d5('0x2')]();var auth=require(_0x14d5('0x3'));var interaction=require(_0x14d5('0x4'));var config=require(_0x14d5('0x5'));var controller=require(_0x14d5('0x6'));router[_0x14d5('0x7')]('/',auth[_0x14d5('0x8')](),controller['index']);router[_0x14d5('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x14d5('0x9')]);router[_0x14d5('0x7')](_0x14d5('0xa'),auth[_0x14d5('0x8')](),controller[_0x14d5('0xb')]);router[_0x14d5('0xc')]('/',auth[_0x14d5('0x8')](),controller[_0x14d5('0xd')]);router[_0x14d5('0xe')](_0x14d5('0xa'),auth[_0x14d5('0x8')](),controller[_0x14d5('0xf')]);router['delete'](_0x14d5('0xa'),auth[_0x14d5('0x8')](),controller[_0x14d5('0x10')]);module[_0x14d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c65dd58..dd52618 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 _0x3866=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x3866,0xb5));var _0x6386=function(_0x36a0bb,_0x367dfd){_0x36a0bb=_0x36a0bb-0x0;var _0x2f59fd=_0x3866[_0x36a0bb];return _0x2f59fd;};'use strict';var Sequelize=require(_0x6386('0x0'));module[_0x6386('0x1')]={'name':{'type':Sequelize[_0x6386('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6386('0x3')](_0x6386('0x4'),_0x6386('0x5')),'defaultValue':_0x6386('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6386('0x6')]}}; \ No newline at end of file +var _0x2f8a=['ENUM','timeout','mouseOver','STRING','sequelize','exports'];(function(_0x215370,_0x5864df){var _0x38bab5=function(_0x315425){while(--_0x315425){_0x215370['push'](_0x215370['shift']());}};_0x38bab5(++_0x5864df);}(_0x2f8a,0xb2));var _0xa2f8=function(_0x439b57,_0x29f647){_0x439b57=_0x439b57-0x0;var _0x3e9dc1=_0x2f8a[_0x439b57];return _0x3e9dc1;};'use strict';var Sequelize=require(_0xa2f8('0x0'));module[_0xa2f8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa2f8('0x2')]('mouseOver',_0xa2f8('0x3')),'defaultValue':_0xa2f8('0x4')},'selector':{'type':Sequelize[_0xa2f8('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fa3d836..aecc0db 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 _0x555b=['status','count','limit','set','Content-Range','json','apply','reject','save','then','end','error','name','send','show','params','rawAttributes','keys','filters','intersection','model','query','attributes','fields','includeAll','include','options','ChatProactiveAction','find','catch','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x946a82,_0xefd3e1){var _0x4da5bf=function(_0x5f5b14){while(--_0x5f5b14){_0x946a82['push'](_0x946a82['shift']());}};_0x4da5bf(++_0xefd3e1);}(_0x555b,0x105));var _0xb555=function(_0xfc46a4,_0x2b2560){_0xfc46a4=_0xfc46a4-0x0;var _0x13180c=_0x555b[_0xfc46a4];return _0x13180c;};'use strict';var pdf=require(_0xb555('0x0'));var emlformat=require(_0xb555('0x1'));var rimraf=require(_0xb555('0x2'));var zipdir=require(_0xb555('0x3'));var jsonpatch=require(_0xb555('0x4'));var rp=require('request-promise');var moment=require(_0xb555('0x5'));var BPromise=require(_0xb555('0x6'));var Mustache=require(_0xb555('0x7'));var util=require('util');var path=require(_0xb555('0x8'));var sox=require('sox');var csv=require(_0xb555('0x9'));var ejs=require(_0xb555('0xa'));var fs=require('fs');var _=require(_0xb555('0xb'));var squel=require(_0xb555('0xc'));var crypto=require(_0xb555('0xd'));var jsforce=require(_0xb555('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb555('0x9'));var querystring=require('querystring');var Papa=require(_0xb555('0xf'));var Redis=require(_0xb555('0x10'));var authService=require(_0xb555('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb555('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb555('0x13'))(_0xb555('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb555('0x15'));var db=require(_0xb555('0x16'))['db'];function respondWithStatusCode(_0x19cee6,_0x4afb12){_0x4afb12=_0x4afb12||0xcc;return function(_0x1391dc){if(_0x1391dc){return _0x19cee6[_0xb555('0x17')](_0x4afb12);}return _0x19cee6['status'](_0x4afb12)['end']();};}function respondWithResult(_0x35eb77,_0x37ef32){_0x37ef32=_0x37ef32||0xc8;return function(_0x5e16be){if(_0x5e16be){return _0x35eb77[_0xb555('0x18')](_0x37ef32)['json'](_0x5e16be);}};}function respondWithFilteredResult(_0x1e55f4,_0x42956a){return function(_0x2946e9){if(_0x2946e9){var _0x414926=_0x2946e9[_0xb555('0x19')],_0x207aea=_0x42956a['offset'],_0x411a0f=_0x42956a['offset']+_0x42956a[_0xb555('0x1a')],_0x1e137c;if(_0x411a0f>=_0x414926){_0x411a0f=_0x414926;_0x1e137c=0xc8;}else{_0x1e137c=0xce;}_0x1e55f4[_0xb555('0x18')](_0x1e137c);return _0x1e55f4[_0xb555('0x1b')](_0xb555('0x1c'),_0x207aea+'-'+_0x411a0f+'/'+_0x414926)[_0xb555('0x1d')](_0x2946e9);}return null;};}function patchUpdates(_0x1736d4){return function(_0x5a4c9d){try{jsonpatch[_0xb555('0x1e')](_0x5a4c9d,_0x1736d4,!![]);}catch(_0x3d1a7b){return BPromise[_0xb555('0x1f')](_0x3d1a7b);}return _0x5a4c9d[_0xb555('0x20')]();};}function saveUpdates(_0x42cc8b,_0x328bf5){return function(_0xbff43f){if(_0xbff43f){return _0xbff43f['update'](_0x42cc8b)[_0xb555('0x21')](function(_0x105eb7){return _0x105eb7;});}return null;};}function removeEntity(_0x169dad,_0x38b69b){return function(_0x301721){if(_0x301721){return _0x301721['destroy']()[_0xb555('0x21')](function(){_0x169dad[_0xb555('0x18')](0xcc)[_0xb555('0x22')]();});}};}function handleEntityNotFound(_0x109d98,_0xba2673){return function(_0x32edeb){if(!_0x32edeb){_0x109d98[_0xb555('0x17')](0x194);}return _0x32edeb;};}function handleError(_0xa8af98,_0x136d7e){_0x136d7e=_0x136d7e||0x1f4;return function(_0x2794e1){logger[_0xb555('0x23')](_0x2794e1['stack']);if(_0x2794e1[_0xb555('0x24')]){delete _0x2794e1[_0xb555('0x24')];}_0xa8af98[_0xb555('0x18')](_0x136d7e)[_0xb555('0x25')](_0x2794e1);};}exports[_0xb555('0x26')]=function(_0x41c2ab,_0x34109c){var _0x2b1b6d={'raw':!![],'where':{'id':_0x41c2ab[_0xb555('0x27')]['id']}},_0x1257ac={};_0x1257ac['model']=_['keys'](db['ChatProactiveAction'][_0xb555('0x28')]);_0x1257ac['query']=_[_0xb555('0x29')](_0x41c2ab['query']);_0x1257ac[_0xb555('0x2a')]=_[_0xb555('0x2b')](_0x1257ac[_0xb555('0x2c')],_0x1257ac[_0xb555('0x2d')]);_0x2b1b6d[_0xb555('0x2e')]=_[_0xb555('0x2b')](_0x1257ac['model'],qs[_0xb555('0x2f')](_0x41c2ab[_0xb555('0x2d')][_0xb555('0x2f')]));_0x2b1b6d[_0xb555('0x2e')]=_0x2b1b6d[_0xb555('0x2e')]['length']?_0x2b1b6d[_0xb555('0x2e')]:_0x1257ac[_0xb555('0x2c')];if(_0x41c2ab[_0xb555('0x2d')][_0xb555('0x30')]){_0x2b1b6d[_0xb555('0x31')]=[{'all':!![]}];}_0x2b1b6d=_['merge']({},_0x2b1b6d,_0x41c2ab[_0xb555('0x32')]);return db[_0xb555('0x33')][_0xb555('0x34')](_0x2b1b6d)[_0xb555('0x21')](handleEntityNotFound(_0x34109c,null))['then'](respondWithResult(_0x34109c,null))[_0xb555('0x35')](handleError(_0x34109c,null));};exports['create']=function(_0x5e66f4,_0x118fc1){return db[_0xb555('0x33')]['create'](_0x5e66f4[_0xb555('0x36')],{})[_0xb555('0x21')](respondWithResult(_0x118fc1,0xc9))[_0xb555('0x35')](handleError(_0x118fc1,null));};exports[_0xb555('0x37')]=function(_0x3ebb4f,_0x294f4c){if(_0x3ebb4f['body']['id']){delete _0x3ebb4f[_0xb555('0x36')]['id'];}return db[_0xb555('0x33')][_0xb555('0x34')]({'where':{'id':_0x3ebb4f['params']['id']}})['then'](handleEntityNotFound(_0x294f4c,null))[_0xb555('0x21')](saveUpdates(_0x3ebb4f['body'],null))[_0xb555('0x21')](respondWithResult(_0x294f4c,null))[_0xb555('0x35')](handleError(_0x294f4c,null));};exports[_0xb555('0x38')]=function(_0x4d41cb,_0x4df0a1){return db['ChatProactiveAction'][_0xb555('0x34')]({'where':{'id':_0x4d41cb[_0xb555('0x27')]['id']}})[_0xb555('0x21')](handleEntityNotFound(_0x4df0a1,null))['then'](removeEntity(_0x4df0a1,null))['catch'](handleError(_0x4df0a1,null));}; \ No newline at end of file +var _0x6102=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5f5bdc,_0x5981ba){var _0x439e18=function(_0x27b6e6){while(--_0x27b6e6){_0x5f5bdc['push'](_0x5f5bdc['shift']());}};_0x439e18(++_0x5981ba);}(_0x6102,0x118));var _0x2610=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x6102[_0x307d86];return _0x361745;};'use strict';var pdf=require(_0x2610('0x0'));var emlformat=require(_0x2610('0x1'));var rimraf=require(_0x2610('0x2'));var zipdir=require(_0x2610('0x3'));var jsonpatch=require(_0x2610('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2610('0x5'));var util=require('util');var path=require(_0x2610('0x6'));var sox=require('sox');var csv=require(_0x2610('0x7'));var ejs=require(_0x2610('0x8'));var fs=require('fs');var _=require(_0x2610('0x9'));var squel=require(_0x2610('0xa'));var crypto=require('crypto');var jsforce=require(_0x2610('0xb'));var deskjs=require(_0x2610('0xc'));var toCsv=require(_0x2610('0x7'));var querystring=require(_0x2610('0xd'));var Papa=require('papaparse');var Redis=require(_0x2610('0xe'));var authService=require(_0x2610('0xf'));var qs=require(_0x2610('0x10'));var as=require(_0x2610('0x11'));var hardwareService=require(_0x2610('0x12'));var logger=require(_0x2610('0x13'))(_0x2610('0x14'));var utils=require(_0x2610('0x15'));var config=require(_0x2610('0x16'));var licenseUtil=require(_0x2610('0x17'));var db=require(_0x2610('0x18'))['db'];function respondWithStatusCode(_0x54ea2c,_0x517f22){_0x517f22=_0x517f22||0xcc;return function(_0x5a76e1){if(_0x5a76e1){return _0x54ea2c[_0x2610('0x19')](_0x517f22);}return _0x54ea2c[_0x2610('0x1a')](_0x517f22)['end']();};}function respondWithResult(_0x3189b4,_0x4a6444){_0x4a6444=_0x4a6444||0xc8;return function(_0x5a04e6){if(_0x5a04e6){return _0x3189b4[_0x2610('0x1a')](_0x4a6444)[_0x2610('0x1b')](_0x5a04e6);}};}function respondWithFilteredResult(_0x3ab9ec,_0x472e9b){return function(_0x5e9375){if(_0x5e9375){var _0x171a63=_0x5e9375[_0x2610('0x1c')],_0x2f896a=_0x472e9b[_0x2610('0x1d')],_0x50493a=_0x472e9b['offset']+_0x472e9b[_0x2610('0x1e')],_0x5ea057;if(_0x50493a>=_0x171a63){_0x50493a=_0x171a63;_0x5ea057=0xc8;}else{_0x5ea057=0xce;}_0x3ab9ec['status'](_0x5ea057);return _0x3ab9ec[_0x2610('0x1f')](_0x2610('0x20'),_0x2f896a+'-'+_0x50493a+'/'+_0x171a63)[_0x2610('0x1b')](_0x5e9375);}return null;};}function patchUpdates(_0x46df5c){return function(_0xff6e8e){try{jsonpatch[_0x2610('0x21')](_0xff6e8e,_0x46df5c,!![]);}catch(_0x5a63f1){return BPromise[_0x2610('0x22')](_0x5a63f1);}return _0xff6e8e[_0x2610('0x23')]();};}function saveUpdates(_0xc71ea,_0x2ed77f){return function(_0x5c1b41){if(_0x5c1b41){return _0x5c1b41['update'](_0xc71ea)[_0x2610('0x24')](function(_0x12e418){return _0x12e418;});}return null;};}function removeEntity(_0xce5ee9,_0x3764ff){return function(_0x3ffc92){if(_0x3ffc92){return _0x3ffc92['destroy']()[_0x2610('0x24')](function(){_0xce5ee9[_0x2610('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x109a19,_0x47fc55){return function(_0x500661){if(!_0x500661){_0x109a19[_0x2610('0x19')](0x194);}return _0x500661;};}function handleError(_0x28501c,_0x54c3f0){_0x54c3f0=_0x54c3f0||0x1f4;return function(_0x443c7c){logger[_0x2610('0x25')](_0x443c7c[_0x2610('0x26')]);if(_0x443c7c[_0x2610('0x27')]){delete _0x443c7c[_0x2610('0x27')];}_0x28501c[_0x2610('0x1a')](_0x54c3f0)[_0x2610('0x28')](_0x443c7c);};}exports[_0x2610('0x29')]=function(_0x55ba95,_0x481b2f){var _0x2f666b={'raw':!![],'where':{'id':_0x55ba95[_0x2610('0x2a')]['id']}},_0x2a7665={};_0x2a7665['model']=_[_0x2610('0x2b')](db[_0x2610('0x2c')][_0x2610('0x2d')]);_0x2a7665[_0x2610('0x2e')]=_['keys'](_0x55ba95[_0x2610('0x2e')]);_0x2a7665[_0x2610('0x2f')]=_[_0x2610('0x30')](_0x2a7665['model'],_0x2a7665['query']);_0x2f666b[_0x2610('0x31')]=_[_0x2610('0x30')](_0x2a7665[_0x2610('0x32')],qs[_0x2610('0x33')](_0x55ba95['query'][_0x2610('0x33')]));_0x2f666b['attributes']=_0x2f666b['attributes'][_0x2610('0x34')]?_0x2f666b[_0x2610('0x31')]:_0x2a7665[_0x2610('0x32')];if(_0x55ba95['query'][_0x2610('0x35')]){_0x2f666b[_0x2610('0x36')]=[{'all':!![]}];}_0x2f666b=_[_0x2610('0x37')]({},_0x2f666b,_0x55ba95[_0x2610('0x38')]);return db[_0x2610('0x2c')][_0x2610('0x39')](_0x2f666b)[_0x2610('0x24')](handleEntityNotFound(_0x481b2f,null))['then'](respondWithResult(_0x481b2f,null))['catch'](handleError(_0x481b2f,null));};exports[_0x2610('0x3a')]=function(_0x8da8f,_0x19e9a6){return db[_0x2610('0x2c')][_0x2610('0x3a')](_0x8da8f[_0x2610('0x3b')],{})['then'](respondWithResult(_0x19e9a6,0xc9))[_0x2610('0x3c')](handleError(_0x19e9a6,null));};exports['update']=function(_0x26c26e,_0x4306ad){if(_0x26c26e[_0x2610('0x3b')]['id']){delete _0x26c26e['body']['id'];}return db[_0x2610('0x2c')][_0x2610('0x39')]({'where':{'id':_0x26c26e[_0x2610('0x2a')]['id']}})[_0x2610('0x24')](handleEntityNotFound(_0x4306ad,null))['then'](saveUpdates(_0x26c26e[_0x2610('0x3b')],null))[_0x2610('0x24')](respondWithResult(_0x4306ad,null))[_0x2610('0x3c')](handleError(_0x4306ad,null));};exports['destroy']=function(_0x487600,_0x40bb9){return db[_0x2610('0x2c')]['find']({'where':{'id':_0x487600[_0x2610('0x2a')]['id']}})[_0x2610('0x24')](handleEntityNotFound(_0x40bb9,null))[_0x2610('0x24')](removeEntity(_0x40bb9,null))[_0x2610('0x3c')](handleError(_0x40bb9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 395edde..73e0e43 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 _0xd9af=['api','moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','../../config/logger'];(function(_0x21481a,_0x2a349f){var _0x19bc8d=function(_0x3dbea1){while(--_0x3dbea1){_0x21481a['push'](_0x21481a['shift']());}};_0x19bc8d(++_0x2a349f);}(_0xd9af,0x95));var _0xfd9a=function(_0x1c0225,_0xd962b0){_0x1c0225=_0x1c0225-0x0;var _0x2fad19=_0xd9af[_0x1c0225];return _0x2fad19;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd9a('0x0'))(_0xfd9a('0x1'));var moment=require(_0xfd9a('0x2'));var BPromise=require(_0xfd9a('0x3'));var rp=require(_0xfd9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd9a('0x5'));var config=require('../../config/environment');var attributes=require(_0xfd9a('0x6'));module[_0xfd9a('0x7')]=function(_0x30eb7c,_0x2baf19){return _0x30eb7c[_0xfd9a('0x8')]('ChatProactiveAction',attributes,{'tableName':_0xfd9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37b2=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x5818b9,_0x3e0c5f){var _0x4848a8=function(_0x24d9ce){while(--_0x24d9ce){_0x5818b9['push'](_0x5818b9['shift']());}};_0x4848a8(++_0x3e0c5f);}(_0x37b2,0x75));var _0x237b=function(_0x9e266f,_0x3cc6d8){_0x9e266f=_0x9e266f-0x0;var _0x4f810e=_0x37b2[_0x9e266f];return _0x4f810e;};'use strict';var _=require('lodash');var util=require(_0x237b('0x0'));var logger=require(_0x237b('0x1'))(_0x237b('0x2'));var moment=require('moment');var BPromise=require(_0x237b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x237b('0x4'));var rimraf=require(_0x237b('0x5'));var config=require(_0x237b('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x237b('0x7')]=function(_0x35ccb9,_0x2c2a1e){return _0x35ccb9[_0x237b('0x8')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','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 8aa6ce7..b42b74f 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 _0xd881=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','request\x20sent','debug','stringify','code','error','ChatProactiveAction,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x23bcd7,_0x293524){var _0x921192=function(_0x1d9baa){while(--_0x1d9baa){_0x23bcd7['push'](_0x23bcd7['shift']());}};_0x921192(++_0x293524);}(_0xd881,0x167));var _0x1d88=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd881[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x1d88('0x0'));var util=require(_0x1d88('0x1'));var moment=require(_0x1d88('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d88('0x3'));var fs=require('fs');var Redis=require(_0x1d88('0x4'));var db=require(_0x1d88('0x5'))['db'];var utils=require(_0x1d88('0x6'));var logger=require('../../config/logger')(_0x1d88('0x7'));var config=require(_0x1d88('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1d88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe573a6,_0x12b3ad,_0x3e90d2){return new BPromise(function(_0x600746,_0x53b081){return client[_0x1d88('0xa')](_0xe573a6,_0x3e90d2)['then'](function(_0x107339){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x12b3ad,_0x1d88('0xb'));logger[_0x1d88('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x12b3ad,_0x1d88('0xb'),JSON[_0x1d88('0xd')](_0x107339));if(_0x107339['error']){if(_0x107339['error'][_0x1d88('0xe')]===0x1f4){logger[_0x1d88('0xf')](_0x1d88('0x10'),_0x12b3ad,_0x107339[_0x1d88('0xf')][_0x1d88('0x11')]);return _0x53b081(_0x107339[_0x1d88('0xf')]['message']);}logger[_0x1d88('0xf')](_0x1d88('0x10'),_0x12b3ad,_0x107339[_0x1d88('0xf')][_0x1d88('0x11')]);return _0x600746(_0x107339[_0x1d88('0xf')][_0x1d88('0x11')]);}else{logger[_0x1d88('0x12')](_0x1d88('0x10'),_0x12b3ad,_0x1d88('0xb'));_0x600746(_0x107339[_0x1d88('0x13')]['message']);}})['catch'](function(_0x530184){logger[_0x1d88('0xf')](_0x1d88('0x10'),_0x12b3ad,_0x530184);_0x53b081(_0x530184);});});} \ No newline at end of file +var _0x295d=['then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4c844d,_0x3ac798){var _0x38488a=function(_0x3699ad){while(--_0x3699ad){_0x4c844d['push'](_0x4c844d['shift']());}};_0x38488a(++_0x3ac798);}(_0x295d,0x15c));var _0xd295=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x295d[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xd295('0x0'));var util=require(_0xd295('0x1'));var moment=require(_0xd295('0x2'));var BPromise=require(_0xd295('0x3'));var rs=require(_0xd295('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd295('0x5'));var logger=require(_0xd295('0x6'))(_0xd295('0x7'));var config=require(_0xd295('0x8'));var jayson=require(_0xd295('0x9'));var client=jayson['client'][_0xd295('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52c2f0,_0x379bbc,_0x5a4a9d){return new BPromise(function(_0x2c7ef2,_0x5e8354){return client[_0xd295('0xb')](_0x52c2f0,_0x5a4a9d)[_0xd295('0xc')](function(_0x424308){logger[_0xd295('0xd')](_0xd295('0xe'),_0x379bbc,_0xd295('0xf'));logger[_0xd295('0x10')](_0xd295('0x11'),_0x379bbc,_0xd295('0xf'),JSON[_0xd295('0x12')](_0x424308));if(_0x424308[_0xd295('0x13')]){if(_0x424308['error'][_0xd295('0x14')]===0x1f4){logger[_0xd295('0x13')](_0xd295('0xe'),_0x379bbc,_0x424308[_0xd295('0x13')][_0xd295('0x15')]);return _0x5e8354(_0x424308[_0xd295('0x13')][_0xd295('0x15')]);}logger['error'](_0xd295('0xe'),_0x379bbc,_0x424308[_0xd295('0x13')]['message']);return _0x2c7ef2(_0x424308[_0xd295('0x13')][_0xd295('0x15')]);}else{logger[_0xd295('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x379bbc,_0xd295('0xf'));_0x2c7ef2(_0x424308[_0xd295('0x16')][_0xd295('0x15')]);}})[_0xd295('0x17')](function(_0x2d5f0e){logger[_0xd295('0x13')](_0xd295('0xe'),_0x379bbc,_0x2d5f0e);_0x5e8354(_0x2d5f0e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9f21ec2..c709e9f 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 _0xb7d8=['show','post','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x42a9fa,_0x3cf3be){var _0x119059=function(_0x1c833d){while(--_0x1c833d){_0x42a9fa['push'](_0x42a9fa['shift']());}};_0x119059(++_0x3cf3be);}(_0xb7d8,0x163));var _0x8b7d=function(_0x4939dd,_0x34ec98){_0x4939dd=_0x4939dd-0x0;var _0x37dfc9=_0xb7d8[_0x4939dd];return _0x37dfc9;};'use strict';var multer=require(_0x8b7d('0x0'));var util=require(_0x8b7d('0x1'));var path=require('path');var timeout=require(_0x8b7d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8b7d('0x3'));var interaction=require(_0x8b7d('0x4'));var config=require('../../config/environment');var controller=require(_0x8b7d('0x5'));router[_0x8b7d('0x6')](_0x8b7d('0x7'),auth[_0x8b7d('0x8')](),controller[_0x8b7d('0x9')]);router[_0x8b7d('0xa')]('/',auth[_0x8b7d('0x8')](),controller['create']);router['put'](_0x8b7d('0x7'),auth[_0x8b7d('0x8')](),controller[_0x8b7d('0xb')]);router[_0x8b7d('0xc')](_0x8b7d('0x7'),auth[_0x8b7d('0x8')](),controller[_0x8b7d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2739=['../../components/auth/service','../../config/environment','isAuthenticated','show','post','put','/:id','update','delete','destroy','multer','path','connect-timeout'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x2739,0x10e));var _0x9273=function(_0x4b2d4d,_0x3bef41){_0x4b2d4d=_0x4b2d4d-0x0;var _0x275b52=_0x2739[_0x4b2d4d];return _0x275b52;};'use strict';var multer=require(_0x9273('0x0'));var util=require('util');var path=require(_0x9273('0x1'));var timeout=require(_0x9273('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9273('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9273('0x4'));var controller=require('./chatProactiveAction.controller');router['get']('/:id',auth[_0x9273('0x5')](),controller[_0x9273('0x6')]);router[_0x9273('0x7')]('/',auth[_0x9273('0x5')](),controller['create']);router[_0x9273('0x8')](_0x9273('0x9'),auth[_0x9273('0x5')](),controller[_0x9273('0xa')]);router[_0x9273('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9273('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 270ac47..9c42125 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 _0xa335=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x131f88,_0x41484c){var _0x5a5e96=function(_0x5e1b0a){while(--_0x5e1b0a){_0x131f88['push'](_0x131f88['shift']());}};_0x5a5e96(++_0x41484c);}(_0xa335,0xdd));var _0x5a33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa335[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5a33('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a33('0x1')],'unique':_0x5a33('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5a33('0x1')]},'timeout':{'type':Sequelize[_0x5a33('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5a33('0x4')](_0x5a33('0x5'),_0x5a33('0x6'),_0x5a33('0x7'))}}; \ No newline at end of file +var _0x5e0d=['sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x5e0d,0xf0));var _0xd5e0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5e0d[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0xd5e0('0x0'));module[_0xd5e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd5e0('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd5e0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd5e0('0x4')](_0xd5e0('0x5'),_0xd5e0('0x6'),_0xd5e0('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2dc0713..1141f60 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 _0x3cdd=['merge','options','includeAll','include','rows','show','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','update','body','describe','getMembers','findOne','UserChatQueue','length','pick','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','getTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','addTeams','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','all','union','compact','value','ids','isEmpty','forEach','emit','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','get','UserProfileResource','destroy','name','send','index','map','ChatQueue','fieldName','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x232cf2,_0x4ffb79){var _0x463cec=function(_0x581b60){while(--_0x581b60){_0x232cf2['push'](_0x232cf2['shift']());}};_0x463cec(++_0x4ffb79);}(_0x3cdd,0x176));var _0xd3cd=function(_0x4f4695,_0x440225){_0x4f4695=_0x4f4695-0x0;var _0x1674f8=_0x3cdd[_0x4f4695];return _0x1674f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd3cd('0x2'));var BPromise=require(_0xd3cd('0x3'));var Mustache=require(_0xd3cd('0x4'));var util=require(_0xd3cd('0x5'));var path=require(_0xd3cd('0x6'));var sox=require(_0xd3cd('0x7'));var csv=require(_0xd3cd('0x8'));var ejs=require(_0xd3cd('0x9'));var fs=require('fs');var _=require(_0xd3cd('0xa'));var squel=require(_0xd3cd('0xb'));var crypto=require(_0xd3cd('0xc'));var jsforce=require(_0xd3cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd3cd('0x8'));var querystring=require('querystring');var Papa=require(_0xd3cd('0xe'));var Redis=require(_0xd3cd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd3cd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3cd('0x11'));var logger=require(_0xd3cd('0x12'))(_0xd3cd('0x13'));var utils=require(_0xd3cd('0x14'));var config=require(_0xd3cd('0x15'));var licenseUtil=require(_0xd3cd('0x16'));var db=require(_0xd3cd('0x17'))['db'];config['redis']=_[_0xd3cd('0x18')](config[_0xd3cd('0x19')],{'host':_0xd3cd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3cd('0x19')]));require(_0xd3cd('0x1b'))[_0xd3cd('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd3cd('0x1d')][_0xd3cd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x371b2a,_0x37b299,_0x2cbc42,_0x50cfc6){return new BPromise(function(_0x1b1d70,_0x3b2591){var _0x1418e8=_0x50cfc6||client;return _0x1418e8[_0xd3cd('0x1f')](_0x371b2a,_0x2cbc42)[_0xd3cd('0x20')](function(_0x28062b){logger[_0xd3cd('0x21')](_0xd3cd('0x22'),_0x37b299,_0xd3cd('0x23'));logger['debug'](_0xd3cd('0x24'),_0x37b299,_0xd3cd('0x23'),JSON[_0xd3cd('0x25')](_0x28062b));if(_0x28062b['error']){if(_0x28062b['error'][_0xd3cd('0x26')]===0x1f4){logger['error'](_0xd3cd('0x22'),_0x37b299,_0x28062b[_0xd3cd('0x27')][_0xd3cd('0x28')]);return _0x3b2591(_0x28062b[_0xd3cd('0x27')][_0xd3cd('0x28')]);}logger[_0xd3cd('0x27')]('ChatQueue,\x20%s,\x20%s',_0x37b299,_0x28062b[_0xd3cd('0x27')][_0xd3cd('0x28')]);return _0x1b1d70(_0x28062b[_0xd3cd('0x27')][_0xd3cd('0x28')]);}else{logger[_0xd3cd('0x21')]('ChatQueue,\x20%s,\x20%s',_0x37b299,_0xd3cd('0x23'));_0x1b1d70(_0x28062b[_0xd3cd('0x29')][_0xd3cd('0x28')]);}})[_0xd3cd('0x2a')](function(_0x221144){logger[_0xd3cd('0x27')]('ChatQueue,\x20%s,\x20%s',_0x37b299,_0x221144);_0x3b2591(_0x221144);});});}function respondWithStatusCode(_0x3f3111,_0x1b3f6e){_0x1b3f6e=_0x1b3f6e||0xcc;return function(_0x4e2517){if(_0x4e2517){return _0x3f3111[_0xd3cd('0x2b')](_0x1b3f6e);}return _0x3f3111[_0xd3cd('0x2c')](_0x1b3f6e)[_0xd3cd('0x2d')]();};}function respondWithResult(_0x489c15,_0x6c7987){_0x6c7987=_0x6c7987||0xc8;return function(_0x52c982){if(_0x52c982){return _0x489c15[_0xd3cd('0x2c')](_0x6c7987)[_0xd3cd('0x2e')](_0x52c982);}};}function respondWithFilteredResult(_0x392e99,_0x5729f8){return function(_0x28333a){if(_0x28333a){var _0x364bf3=_0x28333a[_0xd3cd('0x2f')],_0x2ef240=_0x5729f8[_0xd3cd('0x30')],_0x314ea6=_0x5729f8['offset']+_0x5729f8[_0xd3cd('0x31')],_0x494ad4;if(_0x314ea6>=_0x364bf3){_0x314ea6=_0x364bf3;_0x494ad4=0xc8;}else{_0x494ad4=0xce;}_0x392e99['status'](_0x494ad4);return _0x392e99[_0xd3cd('0x32')](_0xd3cd('0x33'),_0x2ef240+'-'+_0x314ea6+'/'+_0x364bf3)[_0xd3cd('0x2e')](_0x28333a);}return null;};}function patchUpdates(_0x5a0d27){return function(_0x36a06e){try{jsonpatch[_0xd3cd('0x34')](_0x36a06e,_0x5a0d27,!![]);}catch(_0x5e99a2){return BPromise[_0xd3cd('0x35')](_0x5e99a2);}return _0x36a06e[_0xd3cd('0x36')]();};}function saveUpdates(_0x4fb2ad,_0x44e630){return function(_0x3aeab9){if(_0x3aeab9){return _0x3aeab9['update'](_0x4fb2ad)[_0xd3cd('0x20')](function(_0x2abe45){return _0x2abe45;});}return null;};}function removeEntity(_0x388987,_0x1a744b){return function(_0xf6c32d){if(_0xf6c32d){return _0xf6c32d['destroy']()[_0xd3cd('0x20')](function(){var _0x2bb1af=_0xf6c32d[_0xd3cd('0x37')]({'plain':!![]});var _0x3ee6fb='ChatQueues';return db[_0xd3cd('0x38')][_0xd3cd('0x39')]({'where':{'type':_0x3ee6fb,'resourceId':_0x2bb1af['id']}})[_0xd3cd('0x20')](function(){return _0xf6c32d;});})[_0xd3cd('0x20')](function(){_0x388987[_0xd3cd('0x2c')](0xcc)[_0xd3cd('0x2d')]();});}};}function handleEntityNotFound(_0x8ca3f6,_0x26b9c4){return function(_0x2f1277){if(!_0x2f1277){_0x8ca3f6[_0xd3cd('0x2b')](0x194);}return _0x2f1277;};}function handleError(_0x5d1f27,_0x402ccf){_0x402ccf=_0x402ccf||0x1f4;return function(_0xa04edf){logger[_0xd3cd('0x27')](_0xa04edf['stack']);if(_0xa04edf[_0xd3cd('0x3a')]){delete _0xa04edf['name'];}_0x5d1f27[_0xd3cd('0x2c')](_0x402ccf)[_0xd3cd('0x3b')](_0xa04edf);};}exports[_0xd3cd('0x3c')]=function(_0x24ac3d,_0x11aeaf){var _0x168324={},_0x1e6af5={},_0x22543f={'count':0x0,'rows':[]};var _0x25e4c3=_[_0xd3cd('0x3d')](db[_0xd3cd('0x3e')]['rawAttributes'],function(_0x48556c){return{'name':_0x48556c[_0xd3cd('0x3f')],'type':_0x48556c[_0xd3cd('0x40')][_0xd3cd('0x41')]};});_0x1e6af5['model']=_['map'](_0x25e4c3,'name');_0x1e6af5[_0xd3cd('0x42')]=_[_0xd3cd('0x43')](_0x24ac3d[_0xd3cd('0x42')]);_0x1e6af5[_0xd3cd('0x44')]=_['intersection'](_0x1e6af5[_0xd3cd('0x45')],_0x1e6af5[_0xd3cd('0x42')]);_0x168324['attributes']=_['intersection'](_0x1e6af5[_0xd3cd('0x45')],qs[_0xd3cd('0x46')](_0x24ac3d[_0xd3cd('0x42')][_0xd3cd('0x46')]));_0x168324[_0xd3cd('0x47')]=_0x168324[_0xd3cd('0x47')]['length']?_0x168324['attributes']:_0x1e6af5['model'];if(!_0x24ac3d[_0xd3cd('0x42')][_0xd3cd('0x48')](_0xd3cd('0x49'))){_0x168324['limit']=qs[_0xd3cd('0x31')](_0x24ac3d[_0xd3cd('0x42')][_0xd3cd('0x31')]);_0x168324['offset']=qs[_0xd3cd('0x30')](_0x24ac3d[_0xd3cd('0x42')]['offset']);}_0x168324[_0xd3cd('0x4a')]=qs[_0xd3cd('0x4b')](_0x24ac3d['query'][_0xd3cd('0x4b')]);_0x168324[_0xd3cd('0x4c')]=qs[_0xd3cd('0x44')](_['pick'](_0x24ac3d[_0xd3cd('0x42')],_0x1e6af5[_0xd3cd('0x44')]),_0x25e4c3);if(_0x24ac3d[_0xd3cd('0x42')][_0xd3cd('0x4d')]){_0x168324[_0xd3cd('0x4c')]=_['merge'](_0x168324[_0xd3cd('0x4c')],{'$or':_[_0xd3cd('0x3d')](_0x25e4c3,function(_0x557f9f){if(_0x557f9f['type']!==_0xd3cd('0x4e')){var _0x12e8e1={};_0x12e8e1[_0x557f9f[_0xd3cd('0x3a')]]={'$like':'%'+_0x24ac3d[_0xd3cd('0x42')][_0xd3cd('0x4d')]+'%'};return _0x12e8e1;}})});}_0x168324=_[_0xd3cd('0x4f')]({},_0x168324,_0x24ac3d[_0xd3cd('0x50')]);var _0x27f0af={'where':_0x168324[_0xd3cd('0x4c')]};return db[_0xd3cd('0x3e')][_0xd3cd('0x2f')](_0x27f0af)['then'](function(_0x312572){_0x22543f['count']=_0x312572;if(_0x24ac3d['query'][_0xd3cd('0x51')]){_0x168324[_0xd3cd('0x52')]=[{'all':!![]}];}return db[_0xd3cd('0x3e')]['findAll'](_0x168324);})['then'](function(_0x676813){_0x22543f[_0xd3cd('0x53')]=_0x676813;return _0x22543f;})[_0xd3cd('0x20')](respondWithFilteredResult(_0x11aeaf,_0x168324))[_0xd3cd('0x2a')](handleError(_0x11aeaf,null));};exports[_0xd3cd('0x54')]=function(_0x243ed1,_0x5e3725){var _0x5e3b35={'raw':!![],'where':{'id':_0x243ed1[_0xd3cd('0x55')]['id']}},_0x52a0a1={};_0x52a0a1[_0xd3cd('0x45')]=_['keys'](db[_0xd3cd('0x3e')][_0xd3cd('0x56')]);_0x52a0a1[_0xd3cd('0x42')]=_[_0xd3cd('0x43')](_0x243ed1['query']);_0x52a0a1[_0xd3cd('0x44')]=_[_0xd3cd('0x57')](_0x52a0a1[_0xd3cd('0x45')],_0x52a0a1[_0xd3cd('0x42')]);_0x5e3b35[_0xd3cd('0x47')]=_['intersection'](_0x52a0a1[_0xd3cd('0x45')],qs[_0xd3cd('0x46')](_0x243ed1[_0xd3cd('0x42')]['fields']));_0x5e3b35[_0xd3cd('0x47')]=_0x5e3b35[_0xd3cd('0x47')]['length']?_0x5e3b35[_0xd3cd('0x47')]:_0x52a0a1[_0xd3cd('0x45')];if(_0x243ed1[_0xd3cd('0x42')][_0xd3cd('0x51')]){_0x5e3b35[_0xd3cd('0x52')]=[{'all':!![]}];}_0x5e3b35=_[_0xd3cd('0x4f')]({},_0x5e3b35,_0x243ed1[_0xd3cd('0x50')]);return db['ChatQueue'][_0xd3cd('0x58')](_0x5e3b35)[_0xd3cd('0x20')](handleEntityNotFound(_0x5e3725,null))[_0xd3cd('0x20')](respondWithResult(_0x5e3725,null))['catch'](handleError(_0x5e3725,null));};exports[_0xd3cd('0x59')]=function(_0x27072b,_0x12e29e){return db[_0xd3cd('0x3e')][_0xd3cd('0x59')](_0x27072b['body'],{})[_0xd3cd('0x20')](function(_0x319891){var _0x184f97=_0x27072b[_0xd3cd('0x5a')][_0xd3cd('0x37')]({'plain':!![]});if(!_0x184f97)throw new Error(_0xd3cd('0x5b'));if(_0x184f97['role']===_0xd3cd('0x5a')){var _0x53c7ca=_0x319891[_0xd3cd('0x37')]({'plain':!![]});var _0xc5691d=_0xd3cd('0x5c');return db[_0xd3cd('0x5d')][_0xd3cd('0x58')]({'where':{'name':_0xc5691d,'userProfileId':_0x184f97[_0xd3cd('0x5e')]},'raw':!![]})['then'](function(_0x4cb0c8){if(_0x4cb0c8&&_0x4cb0c8[_0xd3cd('0x5f')]===0x0){return db['UserProfileResource'][_0xd3cd('0x59')]({'name':_0x53c7ca[_0xd3cd('0x3a')],'resourceId':_0x53c7ca['id'],'type':_0x4cb0c8[_0xd3cd('0x3a')],'sectionId':_0x4cb0c8['id']},{})[_0xd3cd('0x20')](function(){return _0x319891;});}else{return _0x319891;}})['catch'](function(_0x16dd22){logger[_0xd3cd('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16dd22);throw _0x16dd22;});}return _0x319891;})[_0xd3cd('0x20')](respondWithResult(_0x12e29e,0xc9))[_0xd3cd('0x2a')](handleError(_0x12e29e,null));};exports[_0xd3cd('0x60')]=function(_0x2c66f1,_0x5b8f1d){if(_0x2c66f1['body']['id']){delete _0x2c66f1[_0xd3cd('0x61')]['id'];}return db[_0xd3cd('0x3e')][_0xd3cd('0x58')]({'where':{'id':_0x2c66f1['params']['id']}})[_0xd3cd('0x20')](handleEntityNotFound(_0x5b8f1d,null))[_0xd3cd('0x20')](saveUpdates(_0x2c66f1[_0xd3cd('0x61')],null))['then'](respondWithResult(_0x5b8f1d,null))[_0xd3cd('0x2a')](handleError(_0x5b8f1d,null));};exports['destroy']=function(_0x2edf7c,_0x54d649){return db[_0xd3cd('0x3e')][_0xd3cd('0x58')]({'where':{'id':_0x2edf7c[_0xd3cd('0x55')]['id']}})[_0xd3cd('0x20')](handleEntityNotFound(_0x54d649,null))[_0xd3cd('0x20')](removeEntity(_0x54d649,null))[_0xd3cd('0x2a')](handleError(_0x54d649,null));};exports[_0xd3cd('0x62')]=function(_0x3eae2a,_0x5ed138){return db[_0xd3cd('0x3e')][_0xd3cd('0x62')]()['then'](respondWithResult(_0x5ed138,null))[_0xd3cd('0x2a')](handleError(_0x5ed138,null));};exports[_0xd3cd('0x63')]=function(_0x38a2ee,_0x279674,_0x334fd6){var _0x12a6d3={'raw':!![],'where':{}},_0xff8bdf={},_0x36aa70;return db['ChatQueue'][_0xd3cd('0x64')]({'where':{'id':_0x38a2ee[_0xd3cd('0x55')]['id']}})[_0xd3cd('0x20')](handleEntityNotFound(_0x279674,null))['then'](function(_0x41614a){if(_0x41614a){_0x36aa70=_0x41614a['get']({'plain':!![]});_0xff8bdf['model']=_['keys'](db[_0xd3cd('0x65')][_0xd3cd('0x56')]);_0xff8bdf[_0xd3cd('0x42')]=_[_0xd3cd('0x43')](_0x38a2ee[_0xd3cd('0x42')]);_0xff8bdf['filters']=_['intersection'](_0xff8bdf[_0xd3cd('0x45')],_0xff8bdf['query']);_0x12a6d3[_0xd3cd('0x47')]=_[_0xd3cd('0x57')](_0xff8bdf[_0xd3cd('0x45')],qs[_0xd3cd('0x46')](_0x38a2ee['query']['fields']));_0x12a6d3['attributes']=_0x12a6d3[_0xd3cd('0x47')][_0xd3cd('0x66')]?_0x12a6d3['attributes']:_0xff8bdf[_0xd3cd('0x45')];if(!_0x38a2ee[_0xd3cd('0x42')][_0xd3cd('0x48')](_0xd3cd('0x49'))){_0x12a6d3['limit']=qs[_0xd3cd('0x31')](_0x38a2ee['query']['limit']);_0x12a6d3[_0xd3cd('0x30')]=qs[_0xd3cd('0x30')](_0x38a2ee['query'][_0xd3cd('0x30')]);}_0x12a6d3[_0xd3cd('0x4a')]=qs[_0xd3cd('0x4b')](_0x38a2ee[_0xd3cd('0x42')]['sort']);_0x12a6d3[_0xd3cd('0x4c')]=qs[_0xd3cd('0x44')](_[_0xd3cd('0x67')](_0x38a2ee[_0xd3cd('0x42')],_0xff8bdf[_0xd3cd('0x44')]));_0x12a6d3[_0xd3cd('0x4c')]['ChatQueueId']=_0x41614a['id'];if(_0x38a2ee[_0xd3cd('0x42')]['filter']){_0x12a6d3[_0xd3cd('0x4c')]=_[_0xd3cd('0x4f')](_0x12a6d3[_0xd3cd('0x4c')],{'$or':_[_0xd3cd('0x3d')](_0x12a6d3['attributes'],function(_0x271c0d){var _0x381055={};_0x381055[_0x271c0d]={'$like':'%'+_0x38a2ee['query'][_0xd3cd('0x4d')]+'%'};return _0x381055;})});}_0x12a6d3=_[_0xd3cd('0x4f')]({},_0x12a6d3,_0x38a2ee[_0xd3cd('0x50')]);return db['UserChatQueue'][_0xd3cd('0x68')](_0x12a6d3);}})[_0xd3cd('0x20')](function(_0x19f42d){if(_0x19f42d){return db[_0xd3cd('0x69')][_0xd3cd('0x6a')]({'where':{'id':_[_0xd3cd('0x3d')](_0x19f42d,_0xd3cd('0x6b')),'role':_0xd3cd('0x6c')},'attributes':['id',_0xd3cd('0x3a'),_0xd3cd('0x6d'),_0xd3cd('0x6e'),_0xd3cd('0x6f')]});}})[_0xd3cd('0x20')](function(_0x1a8a4f){if(_0x1a8a4f){return{'count':_0x1a8a4f['count'],'rows':_['map'](_0x1a8a4f[_0xd3cd('0x53')],function(_0x12e66d){return{'membername':_0x12e66d[_0xd3cd('0x3a')],'UserId':_0x12e66d['id'],'queue_name':_0x36aa70[_0xd3cd('0x3a')],'ChatQueueId':_0x36aa70['id'],'interface':util['format'](_0xd3cd('0x70'),'SIP',_0x12e66d[_0xd3cd('0x3a')]),'penalty':0x0,'paused':_0x12e66d[_0xd3cd('0x6d')],'createdAt':_0x12e66d[_0xd3cd('0x6f')],'updatedAt':_0x12e66d[_0xd3cd('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x279674,_0x12a6d3))[_0xd3cd('0x2a')](handleError(_0x279674,null));};exports[_0xd3cd('0x71')]=function(_0x1b9eb5,_0xd19ba2,_0x434158){var _0x22197d={};var _0x28e424={};var _0x32022e;var _0x26d048;return db['ChatQueue']['findOne']({'where':{'id':_0x1b9eb5[_0xd3cd('0x55')]['id']}})[_0xd3cd('0x20')](handleEntityNotFound(_0xd19ba2,null))[_0xd3cd('0x20')](function(_0x17bed7){if(_0x17bed7){_0x32022e=_0x17bed7;_0x28e424['model']=_[_0xd3cd('0x43')](db[_0xd3cd('0x72')][_0xd3cd('0x56')]);_0x28e424[_0xd3cd('0x42')]=_[_0xd3cd('0x43')](_0x1b9eb5[_0xd3cd('0x42')]);_0x28e424[_0xd3cd('0x44')]=_[_0xd3cd('0x57')](_0x28e424[_0xd3cd('0x45')],_0x28e424[_0xd3cd('0x42')]);_0x22197d[_0xd3cd('0x47')]=_[_0xd3cd('0x57')](_0x28e424[_0xd3cd('0x45')],qs[_0xd3cd('0x46')](_0x1b9eb5[_0xd3cd('0x42')][_0xd3cd('0x46')]));_0x22197d[_0xd3cd('0x47')]=_0x22197d['attributes'][_0xd3cd('0x66')]?_0x22197d['attributes']:_0x28e424[_0xd3cd('0x45')];_0x22197d['order']=qs[_0xd3cd('0x4b')](_0x1b9eb5[_0xd3cd('0x42')][_0xd3cd('0x4b')]);_0x22197d['where']=qs[_0xd3cd('0x44')](_[_0xd3cd('0x67')](_0x1b9eb5[_0xd3cd('0x42')],_0x28e424[_0xd3cd('0x44')]));if(_0x1b9eb5['query'][_0xd3cd('0x4d')]){_0x22197d['where']=_['merge'](_0x22197d[_0xd3cd('0x4c')],{'$or':_[_0xd3cd('0x3d')](_0x22197d['attributes'],function(_0x334f85){var _0x139f97={};_0x139f97[_0x334f85]={'$like':'%'+_0x1b9eb5[_0xd3cd('0x42')][_0xd3cd('0x4d')]+'%'};return _0x139f97;})});}_0x22197d=_[_0xd3cd('0x4f')]({},_0x22197d,_0x1b9eb5[_0xd3cd('0x50')]);return _0x32022e[_0xd3cd('0x71')](_0x22197d);}})[_0xd3cd('0x20')](function(_0x34d233){if(_0x34d233){_0x26d048=_0x34d233[_0xd3cd('0x66')];if(!_0x1b9eb5['query'][_0xd3cd('0x48')](_0xd3cd('0x49'))){_0x22197d[_0xd3cd('0x31')]=qs[_0xd3cd('0x31')](_0x1b9eb5['query'][_0xd3cd('0x31')]);_0x22197d[_0xd3cd('0x30')]=qs[_0xd3cd('0x30')](_0x1b9eb5['query']['offset']);}return _0x32022e[_0xd3cd('0x71')](_0x22197d);}})[_0xd3cd('0x20')](function(_0x2bfe39){if(_0x2bfe39){return _0x2bfe39?{'count':_0x26d048,'rows':_0x2bfe39}:null;}})[_0xd3cd('0x20')](respondWithResult(_0xd19ba2,null))[_0xd3cd('0x2a')](handleError(_0xd19ba2,null));};exports['addTeams']=function(_0x47ab0f,_0x2e9f7b,_0x2e160e){var _0x158c90=_0x47ab0f[_0xd3cd('0x61')]['ids'];return db[_0xd3cd('0x72')][_0xd3cd('0x68')]({'where':{'id':_0x158c90},'attributes':['id'],'include':[{'model':db[_0xd3cd('0x69')],'as':_0xd3cd('0x73'),'attributes':['id',_0xd3cd('0x3a'),_0xd3cd('0x74'),_0xd3cd('0x75'),_0xd3cd('0x76')],'raw':!![]}]})['then'](function(_0x14718e){if(_0x14718e){var _0x625cd=_[_0xd3cd('0x77')](_0x14718e,function(_0x1b3af4){var _0x1a41f4=_0x1b3af4[_0xd3cd('0x37')]({'plain':!![]});return _0x1a41f4[_0xd3cd('0x73')];});return db[_0xd3cd('0x3e')][_0xd3cd('0x58')]({'where':{'id':_0x47ab0f['params']['id']}})[_0xd3cd('0x20')](function(_0x52559f){return db['sequelize'][_0xd3cd('0x78')](function(_0x20bd93){return _0x52559f[_0xd3cd('0x79')](_0x158c90,{'transaction':_0x20bd93})[_0xd3cd('0x20')](function(){return BPromise['each'](_0x625cd,function(_0x3e2299){return db[_0xd3cd('0x65')]['findOrCreate']({'where':{'UserId':_0x3e2299['id'],'ChatQueueId':_0x47ab0f[_0xd3cd('0x55')]['id']},'transaction':_0x20bd93});});})[_0xd3cd('0x20')](function(){_0x625cd['forEach'](function(_0x359bc0){socket['emit'](_0xd3cd('0x7a'),{'UserId':_0x359bc0['id'],'ChatQueueId':_0x52559f['id']});});});});});}})[_0xd3cd('0x20')](respondWithStatusCode(_0x2e9f7b,null))[_0xd3cd('0x2a')](handleError(_0x2e9f7b,null));};exports[_0xd3cd('0x7b')]=function(_0x35829d,_0xd72f9f,_0x33f093){return db[_0xd3cd('0x72')][_0xd3cd('0x68')]({'where':{'id':_0x35829d[_0xd3cd('0x42')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd3cd('0x69')],'as':_0xd3cd('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xd72f9f,null))[_0xd3cd('0x20')](function(_0x59fb60){var _0x169336=_['map'](_0x59fb60,'id');var _0x1aec76=[];var _0x451b36=[];var _0x1b67c5=squel[_0xd3cd('0x7c')]();_0x1b67c5[_0xd3cd('0x7d')](_0xd3cd('0x7e'))[_0xd3cd('0x7f')](_0xd3cd('0x80'),'tq')[_0xd3cd('0x81')](_0xd3cd('0x82'),'ut',_0xd3cd('0x83'))[_0xd3cd('0x4c')](_0xd3cd('0x84'),_0x35829d[_0xd3cd('0x55')]['id']);for(var _0x1a10d8=0x0;_0x1a10d8<_0x59fb60[_0xd3cd('0x66')];_0x1a10d8+=0x1){let _0x3439d6=_0x59fb60[_0x1a10d8];for(var _0x753fab=0x0;_0x753fab<_0x3439d6[_0xd3cd('0x73')][_0xd3cd('0x66')];_0x753fab+=0x1){let _0x118694=_0x3439d6[_0xd3cd('0x73')][_0x753fab];var _0x282f7b=_0x1b67c5[_0xd3cd('0x85')]();_0x282f7b[_0xd3cd('0x4c')]('ut.UserId\x20=\x20?',_0x118694['id']);_0x451b36[_0xd3cd('0x86')](db['sequelize'][_0xd3cd('0x42')](_0x282f7b['toString'](),{'type':db[_0xd3cd('0x87')][_0xd3cd('0x88')]['SELECT']})['then'](function(_0xacfa89){if(_0xacfa89[_0xd3cd('0x66')]===0x1){return _0x118694['id'];}else{var _0x20d475=_['every'](_[_0xd3cd('0x3d')](_0xacfa89,'TeamId'),function(_0x518508){return _['includes'](_0x169336,_0x518508);});if(_0x20d475){return _0x118694['id'];}}}));}}return BPromise[_0xd3cd('0x89')](_0x451b36)[_0xd3cd('0x20')](function(_0x4c8fdb){_0x1aec76=_(_0x1aec76)[_0xd3cd('0x8a')](_0x4c8fdb)[_0xd3cd('0x8b')]()[_0xd3cd('0x8c')]();return db[_0xd3cd('0x3e')]['find']({'where':{'id':_0x35829d[_0xd3cd('0x55')]['id']}})[_0xd3cd('0x20')](function(_0x59ef5e){return db['sequelize']['transaction'](function(_0x1776db){return _0x59ef5e[_0xd3cd('0x7b')](_0x35829d[_0xd3cd('0x42')][_0xd3cd('0x8d')],{'transaction':_0x1776db})[_0xd3cd('0x20')](function(){if(!_[_0xd3cd('0x8e')](_0x1aec76)){return _0x59ef5e['removeAgents'](_0x1aec76,{'transaction':_0x1776db});}})[_0xd3cd('0x20')](function(){_0x1aec76[_0xd3cd('0x8f')](function(_0x2d0e39){socket[_0xd3cd('0x90')](_0xd3cd('0x91'),{'UserId':_0x2d0e39,'ChatQueueId':_0x59ef5e['id']});});});});});});})[_0xd3cd('0x20')](respondWithStatusCode(_0xd72f9f,null))[_0xd3cd('0x2a')](handleError(_0xd72f9f,null));};exports[_0xd3cd('0x92')]=function(_0x58552c,_0x45e449,_0x412ce5){return db[_0xd3cd('0x3e')]['find']({'where':{'id':_0x58552c[_0xd3cd('0x55')]['id']}})[_0xd3cd('0x20')](handleEntityNotFound(_0x45e449,null))[_0xd3cd('0x20')](function(_0x126c40){if(_0x126c40){return _0x126c40[_0xd3cd('0x92')](_0x58552c['body']['ids'],_['omit'](_0x58552c[_0xd3cd('0x61')],['ids','id'])||{})[_0xd3cd('0x93')](function(_0x3a5e9c){for(var _0xb0871=0x0;_0xb0871<_0x58552c[_0xd3cd('0x61')][_0xd3cd('0x8d')][_0xd3cd('0x66')];_0xb0871+=0x1){socket[_0xd3cd('0x90')](_0xd3cd('0x7a'),{'UserId':_0x58552c[_0xd3cd('0x61')]['ids'][_0xb0871],'ChatQueueId':_0x58552c[_0xd3cd('0x55')]['id']});}return _0x3a5e9c;});}})[_0xd3cd('0x20')](respondWithResult(_0x45e449,null))[_0xd3cd('0x2a')](handleError(_0x45e449,null));};exports[_0xd3cd('0x94')]=function(_0x90053f,_0x5395dc,_0x572313){return db['ChatQueue']['find']({'where':{'id':_0x90053f[_0xd3cd('0x55')]['id']}})['then'](handleEntityNotFound(_0x5395dc,null))[_0xd3cd('0x20')](function(_0x4f7d10){if(_0x4f7d10){return _0x4f7d10['removeAgents'](_0x90053f[_0xd3cd('0x42')][_0xd3cd('0x8d')])[_0xd3cd('0x20')](function(){if(_[_0xd3cd('0x95')](_0x90053f[_0xd3cd('0x42')][_0xd3cd('0x8d')])){for(var _0x167680=0x0;_0x167680<_0x90053f['query'][_0xd3cd('0x8d')][_0xd3cd('0x66')];_0x167680+=0x1){socket[_0xd3cd('0x90')](_0xd3cd('0x91'),{'UserId':Number(_0x90053f['query'][_0xd3cd('0x8d')][_0x167680]),'ChatQueueId':Number(_0x90053f[_0xd3cd('0x55')]['id'])});}}else{socket['emit'](_0xd3cd('0x91'),{'UserId':Number(_0x90053f[_0xd3cd('0x42')][_0xd3cd('0x8d')]),'ChatQueueId':Number(_0x90053f[_0xd3cd('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x5395dc,null))['catch'](handleError(_0x5395dc,null));};exports[_0xd3cd('0x96')]=function(_0x3baebf,_0xa597db,_0x49ee14){var _0xbb0aea={};var _0x32530e={};var _0x305ae0;var _0x28ae81;return db[_0xd3cd('0x3e')][_0xd3cd('0x64')]({'where':{'id':_0x3baebf['params']['id']}})[_0xd3cd('0x20')](handleEntityNotFound(_0xa597db,null))['then'](function(_0x555242){if(_0x555242){_0x305ae0=_0x555242;_0x32530e[_0xd3cd('0x45')]=_[_0xd3cd('0x43')](db[_0xd3cd('0x69')]['rawAttributes']);_0x32530e[_0xd3cd('0x42')]=_[_0xd3cd('0x43')](_0x3baebf['query']);_0x32530e[_0xd3cd('0x44')]=_['intersection'](_0x32530e['model'],_0x32530e[_0xd3cd('0x42')]);_0xbb0aea[_0xd3cd('0x47')]=_[_0xd3cd('0x57')](_0x32530e[_0xd3cd('0x45')],qs[_0xd3cd('0x46')](_0x3baebf['query'][_0xd3cd('0x46')]));_0xbb0aea[_0xd3cd('0x47')]=_0xbb0aea['attributes'][_0xd3cd('0x66')]?_0xbb0aea['attributes']:_0x32530e[_0xd3cd('0x45')];_0xbb0aea['order']=qs['sort'](_0x3baebf[_0xd3cd('0x42')][_0xd3cd('0x4b')]);_0xbb0aea[_0xd3cd('0x4c')]=qs[_0xd3cd('0x44')](_[_0xd3cd('0x67')](_0x3baebf['query'],_0x32530e[_0xd3cd('0x44')]));if(_0x3baebf[_0xd3cd('0x42')][_0xd3cd('0x4d')]){_0xbb0aea[_0xd3cd('0x4c')]=_[_0xd3cd('0x4f')](_0xbb0aea[_0xd3cd('0x4c')],{'$or':_[_0xd3cd('0x3d')](_0xbb0aea[_0xd3cd('0x47')],function(_0x1573f3){var _0x348840={};_0x348840[_0x1573f3]={'$like':'%'+_0x3baebf[_0xd3cd('0x42')][_0xd3cd('0x4d')]+'%'};return _0x348840;})});}_0xbb0aea=_[_0xd3cd('0x4f')]({},_0xbb0aea,_0x3baebf[_0xd3cd('0x50')]);return _0x305ae0[_0xd3cd('0x96')](_0xbb0aea);}})[_0xd3cd('0x20')](function(_0x6aa6fd){if(_0x6aa6fd){_0x28ae81=_0x6aa6fd[_0xd3cd('0x66')];if(!_0x3baebf[_0xd3cd('0x42')][_0xd3cd('0x48')](_0xd3cd('0x49'))){_0xbb0aea['limit']=qs['limit'](_0x3baebf[_0xd3cd('0x42')]['limit']);_0xbb0aea[_0xd3cd('0x30')]=qs[_0xd3cd('0x30')](_0x3baebf[_0xd3cd('0x42')][_0xd3cd('0x30')]);}return _0x305ae0[_0xd3cd('0x96')](_0xbb0aea);}})[_0xd3cd('0x20')](function(_0x2c16b0){if(_0x2c16b0){return _0x2c16b0?{'count':_0x28ae81,'rows':_0x2c16b0}:null;}})[_0xd3cd('0x20')](respondWithResult(_0xa597db,null))[_0xd3cd('0x2a')](handleError(_0xa597db,null));}; \ No newline at end of file +var _0x434f=['fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','sort','ChatQueueId','UserChatQueue','findAndCountAll','UserId','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','show','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x434f,0xdc));var _0xf434=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x434f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xf434('0x0'));var emlformat=require(_0xf434('0x1'));var rimraf=require(_0xf434('0x2'));var zipdir=require(_0xf434('0x3'));var jsonpatch=require(_0xf434('0x4'));var rp=require('request-promise');var moment=require(_0xf434('0x5'));var BPromise=require(_0xf434('0x6'));var Mustache=require(_0xf434('0x7'));var util=require(_0xf434('0x8'));var path=require(_0xf434('0x9'));var sox=require('sox');var csv=require(_0xf434('0xa'));var ejs=require(_0xf434('0xb'));var fs=require('fs');var _=require(_0xf434('0xc'));var squel=require('squel');var crypto=require(_0xf434('0xd'));var jsforce=require(_0xf434('0xe'));var deskjs=require(_0xf434('0xf'));var toCsv=require(_0xf434('0xa'));var querystring=require(_0xf434('0x10'));var Papa=require(_0xf434('0x11'));var Redis=require(_0xf434('0x12'));var authService=require(_0xf434('0x13'));var qs=require(_0xf434('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf434('0x15'));var utils=require('../../config/utils');var config=require(_0xf434('0x16'));var licenseUtil=require(_0xf434('0x17'));var db=require(_0xf434('0x18'))['db'];config['redis']=_[_0xf434('0x19')](config[_0xf434('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf434('0x1b'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xf434('0x1c')](socket);var jayson=require(_0xf434('0x1d'));var client=jayson[_0xf434('0x1e')][_0xf434('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3c006a,_0x130742,_0x58cd62,_0xae279c){return new BPromise(function(_0x3710d6,_0x4e1a7c){var _0x397649=_0xae279c||client;return _0x397649[_0xf434('0x20')](_0x3c006a,_0x58cd62)[_0xf434('0x21')](function(_0x53c966){logger[_0xf434('0x22')](_0xf434('0x23'),_0x130742,_0xf434('0x24'));logger[_0xf434('0x25')](_0xf434('0x26'),_0x130742,_0xf434('0x24'),JSON[_0xf434('0x27')](_0x53c966));if(_0x53c966[_0xf434('0x28')]){if(_0x53c966[_0xf434('0x28')][_0xf434('0x29')]===0x1f4){logger[_0xf434('0x28')](_0xf434('0x23'),_0x130742,_0x53c966['error'][_0xf434('0x2a')]);return _0x4e1a7c(_0x53c966['error'][_0xf434('0x2a')]);}logger[_0xf434('0x28')](_0xf434('0x23'),_0x130742,_0x53c966[_0xf434('0x28')]['message']);return _0x3710d6(_0x53c966[_0xf434('0x28')][_0xf434('0x2a')]);}else{logger['info'](_0xf434('0x23'),_0x130742,_0xf434('0x24'));_0x3710d6(_0x53c966[_0xf434('0x2b')][_0xf434('0x2a')]);}})[_0xf434('0x2c')](function(_0xc2bc87){logger[_0xf434('0x28')](_0xf434('0x23'),_0x130742,_0xc2bc87);_0x4e1a7c(_0xc2bc87);});});}function respondWithStatusCode(_0x40f3dd,_0x3d8885){_0x3d8885=_0x3d8885||0xcc;return function(_0x48eaa7){if(_0x48eaa7){return _0x40f3dd[_0xf434('0x2d')](_0x3d8885);}return _0x40f3dd[_0xf434('0x2e')](_0x3d8885)[_0xf434('0x2f')]();};}function respondWithResult(_0x5da21a,_0x1b2498){_0x1b2498=_0x1b2498||0xc8;return function(_0x2da3a4){if(_0x2da3a4){return _0x5da21a[_0xf434('0x2e')](_0x1b2498)[_0xf434('0x30')](_0x2da3a4);}};}function respondWithFilteredResult(_0x11375b,_0x318087){return function(_0x35979d){if(_0x35979d){var _0x497fdd=_0x35979d[_0xf434('0x31')],_0x3796ab=_0x318087['offset'],_0x323267=_0x318087[_0xf434('0x32')]+_0x318087[_0xf434('0x33')],_0x202e29;if(_0x323267>=_0x497fdd){_0x323267=_0x497fdd;_0x202e29=0xc8;}else{_0x202e29=0xce;}_0x11375b[_0xf434('0x2e')](_0x202e29);return _0x11375b[_0xf434('0x34')](_0xf434('0x35'),_0x3796ab+'-'+_0x323267+'/'+_0x497fdd)[_0xf434('0x30')](_0x35979d);}return null;};}function patchUpdates(_0x15cf76){return function(_0x60da61){try{jsonpatch[_0xf434('0x36')](_0x60da61,_0x15cf76,!![]);}catch(_0xb2d525){return BPromise[_0xf434('0x37')](_0xb2d525);}return _0x60da61[_0xf434('0x38')]();};}function saveUpdates(_0x2d4b72,_0x2a97e7){return function(_0x50b9fa){if(_0x50b9fa){return _0x50b9fa['update'](_0x2d4b72)[_0xf434('0x21')](function(_0xb9d15f){return _0xb9d15f;});}return null;};}function removeEntity(_0x5d74f4,_0x4318a8){return function(_0x344728){if(_0x344728){return _0x344728[_0xf434('0x39')]()[_0xf434('0x21')](function(){var _0x282d38=_0x344728[_0xf434('0x3a')]({'plain':!![]});var _0x242c09='ChatQueues';return db[_0xf434('0x3b')][_0xf434('0x39')]({'where':{'type':_0x242c09,'resourceId':_0x282d38['id']}})['then'](function(){return _0x344728;});})[_0xf434('0x21')](function(){_0x5d74f4[_0xf434('0x2e')](0xcc)[_0xf434('0x2f')]();});}};}function handleEntityNotFound(_0x340d7d,_0x59861a){return function(_0x281e08){if(!_0x281e08){_0x340d7d[_0xf434('0x2d')](0x194);}return _0x281e08;};}function handleError(_0x326b98,_0x22f3e3){_0x22f3e3=_0x22f3e3||0x1f4;return function(_0x541fd8){logger[_0xf434('0x28')](_0x541fd8[_0xf434('0x3c')]);if(_0x541fd8['name']){delete _0x541fd8[_0xf434('0x3d')];}_0x326b98['status'](_0x22f3e3)['send'](_0x541fd8);};}exports['index']=function(_0x496535,_0x28f7d3){var _0x172c03={},_0x2415f9={},_0x1c49d6={'count':0x0,'rows':[]};var _0x5afab1=_[_0xf434('0x3e')](db[_0xf434('0x3f')][_0xf434('0x40')],function(_0x48644a){return{'name':_0x48644a[_0xf434('0x41')],'type':_0x48644a[_0xf434('0x42')][_0xf434('0x43')]};});_0x2415f9[_0xf434('0x44')]=_['map'](_0x5afab1,_0xf434('0x3d'));_0x2415f9[_0xf434('0x45')]=_[_0xf434('0x46')](_0x496535[_0xf434('0x45')]);_0x2415f9[_0xf434('0x47')]=_[_0xf434('0x48')](_0x2415f9[_0xf434('0x44')],_0x2415f9[_0xf434('0x45')]);_0x172c03[_0xf434('0x49')]=_[_0xf434('0x48')](_0x2415f9['model'],qs['fields'](_0x496535[_0xf434('0x45')]['fields']));_0x172c03['attributes']=_0x172c03[_0xf434('0x49')]['length']?_0x172c03['attributes']:_0x2415f9['model'];if(!_0x496535[_0xf434('0x45')][_0xf434('0x4a')](_0xf434('0x4b'))){_0x172c03[_0xf434('0x33')]=qs[_0xf434('0x33')](_0x496535[_0xf434('0x45')][_0xf434('0x33')]);_0x172c03['offset']=qs[_0xf434('0x32')](_0x496535[_0xf434('0x45')]['offset']);}_0x172c03[_0xf434('0x4c')]=qs['sort'](_0x496535[_0xf434('0x45')]['sort']);_0x172c03[_0xf434('0x4d')]=qs['filters'](_[_0xf434('0x4e')](_0x496535[_0xf434('0x45')],_0x2415f9[_0xf434('0x47')]),_0x5afab1);if(_0x496535[_0xf434('0x45')][_0xf434('0x4f')]){_0x172c03['where']=_[_0xf434('0x50')](_0x172c03[_0xf434('0x4d')],{'$or':_['map'](_0x5afab1,function(_0x18bef5){if(_0x18bef5[_0xf434('0x42')]!=='VIRTUAL'){var _0x3daf27={};_0x3daf27[_0x18bef5['name']]={'$like':'%'+_0x496535['query'][_0xf434('0x4f')]+'%'};return _0x3daf27;}})});}_0x172c03=_[_0xf434('0x50')]({},_0x172c03,_0x496535[_0xf434('0x51')]);var _0x2b880b={'where':_0x172c03[_0xf434('0x4d')]};return db[_0xf434('0x3f')][_0xf434('0x31')](_0x2b880b)[_0xf434('0x21')](function(_0x2e9485){_0x1c49d6[_0xf434('0x31')]=_0x2e9485;if(_0x496535[_0xf434('0x45')][_0xf434('0x52')]){_0x172c03['include']=[{'all':!![]}];}return db[_0xf434('0x3f')][_0xf434('0x53')](_0x172c03);})['then'](function(_0x150e15){_0x1c49d6['rows']=_0x150e15;return _0x1c49d6;})[_0xf434('0x21')](respondWithFilteredResult(_0x28f7d3,_0x172c03))['catch'](handleError(_0x28f7d3,null));};exports[_0xf434('0x54')]=function(_0x4abf95,_0x2248d4){var _0xa1e973={'raw':!![],'where':{'id':_0x4abf95[_0xf434('0x55')]['id']}},_0x354239={};_0x354239[_0xf434('0x44')]=_[_0xf434('0x46')](db[_0xf434('0x3f')][_0xf434('0x40')]);_0x354239[_0xf434('0x45')]=_[_0xf434('0x46')](_0x4abf95[_0xf434('0x45')]);_0x354239['filters']=_[_0xf434('0x48')](_0x354239[_0xf434('0x44')],_0x354239['query']);_0xa1e973['attributes']=_[_0xf434('0x48')](_0x354239[_0xf434('0x44')],qs[_0xf434('0x56')](_0x4abf95[_0xf434('0x45')][_0xf434('0x56')]));_0xa1e973['attributes']=_0xa1e973[_0xf434('0x49')][_0xf434('0x57')]?_0xa1e973[_0xf434('0x49')]:_0x354239[_0xf434('0x44')];if(_0x4abf95['query'][_0xf434('0x52')]){_0xa1e973['include']=[{'all':!![]}];}_0xa1e973=_[_0xf434('0x50')]({},_0xa1e973,_0x4abf95[_0xf434('0x51')]);return db[_0xf434('0x3f')][_0xf434('0x58')](_0xa1e973)[_0xf434('0x21')](handleEntityNotFound(_0x2248d4,null))[_0xf434('0x21')](respondWithResult(_0x2248d4,null))[_0xf434('0x2c')](handleError(_0x2248d4,null));};exports[_0xf434('0x59')]=function(_0x2bf220,_0x449a3d){return db['ChatQueue'][_0xf434('0x59')](_0x2bf220['body'],{})[_0xf434('0x21')](function(_0x618d7d){var _0xd0cb71=_0x2bf220[_0xf434('0x5a')][_0xf434('0x3a')]({'plain':!![]});if(!_0xd0cb71)throw new Error(_0xf434('0x5b'));if(_0xd0cb71['role']===_0xf434('0x5a')){var _0x30f81d=_0x618d7d[_0xf434('0x3a')]({'plain':!![]});var _0x1fee48=_0xf434('0x5c');return db[_0xf434('0x5d')][_0xf434('0x58')]({'where':{'name':_0x1fee48,'userProfileId':_0xd0cb71['userProfileId']},'raw':!![]})[_0xf434('0x21')](function(_0x2b3069){if(_0x2b3069&&_0x2b3069[_0xf434('0x5e')]===0x0){return db[_0xf434('0x3b')][_0xf434('0x59')]({'name':_0x30f81d[_0xf434('0x3d')],'resourceId':_0x30f81d['id'],'type':_0x2b3069[_0xf434('0x3d')],'sectionId':_0x2b3069['id']},{})[_0xf434('0x21')](function(){return _0x618d7d;});}else{return _0x618d7d;}})[_0xf434('0x2c')](function(_0x4cb72a){logger[_0xf434('0x28')](_0xf434('0x5f'),_0x4cb72a);throw _0x4cb72a;});}return _0x618d7d;})[_0xf434('0x21')](respondWithResult(_0x449a3d,0xc9))[_0xf434('0x2c')](handleError(_0x449a3d,null));};exports['update']=function(_0x22fbc3,_0x3a5c67){if(_0x22fbc3[_0xf434('0x60')]['id']){delete _0x22fbc3[_0xf434('0x60')]['id'];}return db['ChatQueue'][_0xf434('0x58')]({'where':{'id':_0x22fbc3['params']['id']}})[_0xf434('0x21')](handleEntityNotFound(_0x3a5c67,null))['then'](saveUpdates(_0x22fbc3[_0xf434('0x60')],null))['then'](respondWithResult(_0x3a5c67,null))['catch'](handleError(_0x3a5c67,null));};exports[_0xf434('0x39')]=function(_0x353744,_0x16571e){return db[_0xf434('0x3f')][_0xf434('0x58')]({'where':{'id':_0x353744[_0xf434('0x55')]['id']}})['then'](handleEntityNotFound(_0x16571e,null))[_0xf434('0x21')](removeEntity(_0x16571e,null))[_0xf434('0x2c')](handleError(_0x16571e,null));};exports[_0xf434('0x61')]=function(_0x61805d,_0x1108f5){return db['ChatQueue'][_0xf434('0x61')]()[_0xf434('0x21')](respondWithResult(_0x1108f5,null))['catch'](handleError(_0x1108f5,null));};exports[_0xf434('0x62')]=function(_0x45a9da,_0x5c7381,_0x4c556d){var _0x3cb3e9={'raw':!![],'where':{}},_0x274f9d={},_0x563ee6;return db[_0xf434('0x3f')][_0xf434('0x63')]({'where':{'id':_0x45a9da['params']['id']}})[_0xf434('0x21')](handleEntityNotFound(_0x5c7381,null))[_0xf434('0x21')](function(_0x1de1f4){if(_0x1de1f4){_0x563ee6=_0x1de1f4[_0xf434('0x3a')]({'plain':!![]});_0x274f9d[_0xf434('0x44')]=_[_0xf434('0x46')](db['UserChatQueue'][_0xf434('0x40')]);_0x274f9d['query']=_[_0xf434('0x46')](_0x45a9da[_0xf434('0x45')]);_0x274f9d['filters']=_['intersection'](_0x274f9d[_0xf434('0x44')],_0x274f9d['query']);_0x3cb3e9[_0xf434('0x49')]=_[_0xf434('0x48')](_0x274f9d[_0xf434('0x44')],qs[_0xf434('0x56')](_0x45a9da['query'][_0xf434('0x56')]));_0x3cb3e9[_0xf434('0x49')]=_0x3cb3e9[_0xf434('0x49')][_0xf434('0x57')]?_0x3cb3e9[_0xf434('0x49')]:_0x274f9d[_0xf434('0x44')];if(!_0x45a9da['query'][_0xf434('0x4a')](_0xf434('0x4b'))){_0x3cb3e9['limit']=qs[_0xf434('0x33')](_0x45a9da[_0xf434('0x45')][_0xf434('0x33')]);_0x3cb3e9[_0xf434('0x32')]=qs['offset'](_0x45a9da[_0xf434('0x45')][_0xf434('0x32')]);}_0x3cb3e9[_0xf434('0x4c')]=qs[_0xf434('0x64')](_0x45a9da[_0xf434('0x45')][_0xf434('0x64')]);_0x3cb3e9[_0xf434('0x4d')]=qs[_0xf434('0x47')](_[_0xf434('0x4e')](_0x45a9da[_0xf434('0x45')],_0x274f9d[_0xf434('0x47')]));_0x3cb3e9[_0xf434('0x4d')][_0xf434('0x65')]=_0x1de1f4['id'];if(_0x45a9da[_0xf434('0x45')][_0xf434('0x4f')]){_0x3cb3e9[_0xf434('0x4d')]=_[_0xf434('0x50')](_0x3cb3e9[_0xf434('0x4d')],{'$or':_['map'](_0x3cb3e9[_0xf434('0x49')],function(_0x56f1e8){var _0x3f6e5f={};_0x3f6e5f[_0x56f1e8]={'$like':'%'+_0x45a9da[_0xf434('0x45')]['filter']+'%'};return _0x3f6e5f;})});}_0x3cb3e9=_[_0xf434('0x50')]({},_0x3cb3e9,_0x45a9da[_0xf434('0x51')]);return db[_0xf434('0x66')][_0xf434('0x53')](_0x3cb3e9);}})[_0xf434('0x21')](function(_0x86dfc8){if(_0x86dfc8){return db['User'][_0xf434('0x67')]({'where':{'id':_[_0xf434('0x3e')](_0x86dfc8,_0xf434('0x68')),'role':'agent'},'attributes':['id',_0xf434('0x3d'),_0xf434('0x69'),_0xf434('0x6a'),_0xf434('0x6b')]});}})[_0xf434('0x21')](function(_0x51aaa5){if(_0x51aaa5){return{'count':_0x51aaa5[_0xf434('0x31')],'rows':_[_0xf434('0x3e')](_0x51aaa5[_0xf434('0x6c')],function(_0x1d4971){return{'membername':_0x1d4971[_0xf434('0x3d')],'UserId':_0x1d4971['id'],'queue_name':_0x563ee6[_0xf434('0x3d')],'ChatQueueId':_0x563ee6['id'],'interface':util[_0xf434('0x6d')](_0xf434('0x6e'),_0xf434('0x6f'),_0x1d4971[_0xf434('0x3d')]),'penalty':0x0,'paused':_0x1d4971[_0xf434('0x69')],'createdAt':_0x1d4971['createdAt'],'updatedAt':_0x1d4971[_0xf434('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf434('0x21')](respondWithFilteredResult(_0x5c7381,_0x3cb3e9))[_0xf434('0x2c')](handleError(_0x5c7381,null));};exports['getTeams']=function(_0x28d089,_0x31b6dd,_0x5817c9){var _0x212c56={};var _0x1ce895={};var _0x2e01b6;var _0x311e08;return db[_0xf434('0x3f')][_0xf434('0x63')]({'where':{'id':_0x28d089[_0xf434('0x55')]['id']}})[_0xf434('0x21')](handleEntityNotFound(_0x31b6dd,null))['then'](function(_0x1d77d7){if(_0x1d77d7){_0x2e01b6=_0x1d77d7;_0x1ce895[_0xf434('0x44')]=_[_0xf434('0x46')](db[_0xf434('0x70')][_0xf434('0x40')]);_0x1ce895['query']=_['keys'](_0x28d089[_0xf434('0x45')]);_0x1ce895[_0xf434('0x47')]=_['intersection'](_0x1ce895['model'],_0x1ce895['query']);_0x212c56['attributes']=_[_0xf434('0x48')](_0x1ce895[_0xf434('0x44')],qs[_0xf434('0x56')](_0x28d089[_0xf434('0x45')]['fields']));_0x212c56[_0xf434('0x49')]=_0x212c56[_0xf434('0x49')]['length']?_0x212c56[_0xf434('0x49')]:_0x1ce895[_0xf434('0x44')];_0x212c56[_0xf434('0x4c')]=qs[_0xf434('0x64')](_0x28d089['query'][_0xf434('0x64')]);_0x212c56[_0xf434('0x4d')]=qs[_0xf434('0x47')](_[_0xf434('0x4e')](_0x28d089[_0xf434('0x45')],_0x1ce895[_0xf434('0x47')]));if(_0x28d089[_0xf434('0x45')][_0xf434('0x4f')]){_0x212c56[_0xf434('0x4d')]=_[_0xf434('0x50')](_0x212c56['where'],{'$or':_[_0xf434('0x3e')](_0x212c56[_0xf434('0x49')],function(_0x5e28ed){var _0x27b65d={};_0x27b65d[_0x5e28ed]={'$like':'%'+_0x28d089[_0xf434('0x45')]['filter']+'%'};return _0x27b65d;})});}_0x212c56=_[_0xf434('0x50')]({},_0x212c56,_0x28d089['options']);return _0x2e01b6[_0xf434('0x71')](_0x212c56);}})[_0xf434('0x21')](function(_0x3bf439){if(_0x3bf439){_0x311e08=_0x3bf439[_0xf434('0x57')];if(!_0x28d089[_0xf434('0x45')]['hasOwnProperty']('nolimit')){_0x212c56[_0xf434('0x33')]=qs[_0xf434('0x33')](_0x28d089[_0xf434('0x45')]['limit']);_0x212c56[_0xf434('0x32')]=qs[_0xf434('0x32')](_0x28d089[_0xf434('0x45')][_0xf434('0x32')]);}return _0x2e01b6[_0xf434('0x71')](_0x212c56);}})[_0xf434('0x21')](function(_0x1091a9){if(_0x1091a9){return _0x1091a9?{'count':_0x311e08,'rows':_0x1091a9}:null;}})['then'](respondWithResult(_0x31b6dd,null))['catch'](handleError(_0x31b6dd,null));};exports[_0xf434('0x72')]=function(_0x26d269,_0xe6811a,_0x27a4d9){var _0x5b2f65=_0x26d269[_0xf434('0x60')][_0xf434('0x73')];return db[_0xf434('0x70')][_0xf434('0x53')]({'where':{'id':_0x5b2f65},'attributes':['id'],'include':[{'model':db[_0xf434('0x74')],'as':_0xf434('0x75'),'attributes':['id','name',_0xf434('0x76'),_0xf434('0x77'),_0xf434('0x78')],'raw':!![]}]})[_0xf434('0x21')](function(_0x1922e0){if(_0x1922e0){var _0x30ae15=_[_0xf434('0x79')](_0x1922e0,function(_0x2f1298){var _0x2e8f05=_0x2f1298[_0xf434('0x3a')]({'plain':!![]});return _0x2e8f05[_0xf434('0x75')];});return db[_0xf434('0x3f')][_0xf434('0x58')]({'where':{'id':_0x26d269[_0xf434('0x55')]['id']}})[_0xf434('0x21')](function(_0x41d694){return db[_0xf434('0x7a')][_0xf434('0x7b')](function(_0x183319){return _0x41d694[_0xf434('0x72')](_0x5b2f65,{'transaction':_0x183319})[_0xf434('0x21')](function(){return BPromise[_0xf434('0x7c')](_0x30ae15,function(_0x7e423f){return db[_0xf434('0x66')][_0xf434('0x7d')]({'where':{'UserId':_0x7e423f['id'],'ChatQueueId':_0x26d269[_0xf434('0x55')]['id']},'transaction':_0x183319});});})[_0xf434('0x21')](function(){_0x30ae15[_0xf434('0x7e')](function(_0x4c3f72){socket[_0xf434('0x7f')](_0xf434('0x80'),{'UserId':_0x4c3f72['id'],'ChatQueueId':_0x41d694['id']});});});});});}})[_0xf434('0x21')](respondWithStatusCode(_0xe6811a,null))[_0xf434('0x2c')](handleError(_0xe6811a,null));};exports['removeTeams']=function(_0x220275,_0x330cd2,_0x5c0b7a){return db[_0xf434('0x70')][_0xf434('0x53')]({'where':{'id':_0x220275[_0xf434('0x45')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf434('0x74')],'as':_0xf434('0x75'),'attributes':['id'],'raw':!![]}]})[_0xf434('0x21')](handleEntityNotFound(_0x330cd2,null))[_0xf434('0x21')](function(_0x3033e8){var _0x20a35d=_[_0xf434('0x3e')](_0x3033e8,'id');var _0x4b0c67=[];var _0x1e6ab1=[];var _0x191899=squel[_0xf434('0x81')]();_0x191899[_0xf434('0x82')](_0xf434('0x83'))['from'](_0xf434('0x84'),'tq')[_0xf434('0x85')]('user_has_teams','ut',_0xf434('0x86'))[_0xf434('0x4d')](_0xf434('0x87'),_0x220275[_0xf434('0x55')]['id']);for(var _0x2d5068=0x0;_0x2d5068<_0x3033e8['length'];_0x2d5068+=0x1){let _0x39a3fa=_0x3033e8[_0x2d5068];for(var _0xf1a98c=0x0;_0xf1a98c<_0x39a3fa[_0xf434('0x75')][_0xf434('0x57')];_0xf1a98c+=0x1){let _0x5b6f72=_0x39a3fa[_0xf434('0x75')][_0xf1a98c];var _0x1726d1=_0x191899[_0xf434('0x88')]();_0x1726d1[_0xf434('0x4d')](_0xf434('0x89'),_0x5b6f72['id']);_0x1e6ab1[_0xf434('0x8a')](db[_0xf434('0x7a')]['query'](_0x1726d1['toString'](),{'type':db[_0xf434('0x7a')][_0xf434('0x8b')][_0xf434('0x8c')]})['then'](function(_0x208ce8){if(_0x208ce8[_0xf434('0x57')]===0x1){return _0x5b6f72['id'];}else{var _0x4b92ff=_['every'](_['map'](_0x208ce8,_0xf434('0x8d')),function(_0xf593b5){return _[_0xf434('0x8e')](_0x20a35d,_0xf593b5);});if(_0x4b92ff){return _0x5b6f72['id'];}}}));}}return BPromise['all'](_0x1e6ab1)[_0xf434('0x21')](function(_0x2d5831){_0x4b0c67=_(_0x4b0c67)[_0xf434('0x8f')](_0x2d5831)[_0xf434('0x90')]()[_0xf434('0x91')]();return db['ChatQueue']['find']({'where':{'id':_0x220275[_0xf434('0x55')]['id']}})['then'](function(_0x389778){return db[_0xf434('0x7a')]['transaction'](function(_0x41f7f0){return _0x389778['removeTeams'](_0x220275[_0xf434('0x45')][_0xf434('0x73')],{'transaction':_0x41f7f0})[_0xf434('0x21')](function(){if(!_[_0xf434('0x92')](_0x4b0c67)){return _0x389778[_0xf434('0x93')](_0x4b0c67,{'transaction':_0x41f7f0});}})['then'](function(){_0x4b0c67[_0xf434('0x7e')](function(_0x33e609){socket['emit'](_0xf434('0x94'),{'UserId':_0x33e609,'ChatQueueId':_0x389778['id']});});});});});});})[_0xf434('0x21')](respondWithStatusCode(_0x330cd2,null))[_0xf434('0x2c')](handleError(_0x330cd2,null));};exports[_0xf434('0x95')]=function(_0xb896a,_0x5ca34e,_0x1a96bd){return db[_0xf434('0x3f')][_0xf434('0x58')]({'where':{'id':_0xb896a[_0xf434('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ca34e,null))[_0xf434('0x21')](function(_0x4a8853){if(_0x4a8853){return _0x4a8853[_0xf434('0x95')](_0xb896a[_0xf434('0x60')][_0xf434('0x73')],_['omit'](_0xb896a['body'],[_0xf434('0x73'),'id'])||{})[_0xf434('0x96')](function(_0x1835d1){for(var _0x14275f=0x0;_0x14275f<_0xb896a['body']['ids'][_0xf434('0x57')];_0x14275f+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0xb896a['body'][_0xf434('0x73')][_0x14275f],'ChatQueueId':_0xb896a[_0xf434('0x55')]['id']});}return _0x1835d1;});}})['then'](respondWithResult(_0x5ca34e,null))[_0xf434('0x2c')](handleError(_0x5ca34e,null));};exports[_0xf434('0x93')]=function(_0x4b0a2e,_0x4853af,_0x61173c){return db[_0xf434('0x3f')][_0xf434('0x58')]({'where':{'id':_0x4b0a2e[_0xf434('0x55')]['id']}})['then'](handleEntityNotFound(_0x4853af,null))[_0xf434('0x21')](function(_0x2d01f6){if(_0x2d01f6){return _0x2d01f6[_0xf434('0x93')](_0x4b0a2e[_0xf434('0x45')][_0xf434('0x73')])[_0xf434('0x21')](function(){if(_[_0xf434('0x97')](_0x4b0a2e['query'][_0xf434('0x73')])){for(var _0x128b36=0x0;_0x128b36<_0x4b0a2e[_0xf434('0x45')][_0xf434('0x73')]['length'];_0x128b36+=0x1){socket['emit'](_0xf434('0x94'),{'UserId':Number(_0x4b0a2e[_0xf434('0x45')][_0xf434('0x73')][_0x128b36]),'ChatQueueId':Number(_0x4b0a2e[_0xf434('0x55')]['id'])});}}else{socket[_0xf434('0x7f')](_0xf434('0x94'),{'UserId':Number(_0x4b0a2e['query'][_0xf434('0x73')]),'ChatQueueId':Number(_0x4b0a2e['params']['id'])});}});}})[_0xf434('0x21')](respondWithStatusCode(_0x4853af,null))[_0xf434('0x2c')](handleError(_0x4853af,null));};exports['getAgents']=function(_0x3c0cea,_0x4b88fd,_0x51d940){var _0x3244d7={};var _0xb5cab={};var _0x2abf0b;var _0x2ce9ec;return db['ChatQueue'][_0xf434('0x63')]({'where':{'id':_0x3c0cea[_0xf434('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b88fd,null))['then'](function(_0x1825a0){if(_0x1825a0){_0x2abf0b=_0x1825a0;_0xb5cab[_0xf434('0x44')]=_[_0xf434('0x46')](db[_0xf434('0x74')][_0xf434('0x40')]);_0xb5cab['query']=_[_0xf434('0x46')](_0x3c0cea[_0xf434('0x45')]);_0xb5cab['filters']=_[_0xf434('0x48')](_0xb5cab[_0xf434('0x44')],_0xb5cab[_0xf434('0x45')]);_0x3244d7[_0xf434('0x49')]=_[_0xf434('0x48')](_0xb5cab[_0xf434('0x44')],qs[_0xf434('0x56')](_0x3c0cea[_0xf434('0x45')]['fields']));_0x3244d7[_0xf434('0x49')]=_0x3244d7['attributes'][_0xf434('0x57')]?_0x3244d7['attributes']:_0xb5cab[_0xf434('0x44')];_0x3244d7[_0xf434('0x4c')]=qs[_0xf434('0x64')](_0x3c0cea[_0xf434('0x45')][_0xf434('0x64')]);_0x3244d7['where']=qs['filters'](_[_0xf434('0x4e')](_0x3c0cea[_0xf434('0x45')],_0xb5cab[_0xf434('0x47')]));if(_0x3c0cea['query'][_0xf434('0x4f')]){_0x3244d7['where']=_[_0xf434('0x50')](_0x3244d7[_0xf434('0x4d')],{'$or':_[_0xf434('0x3e')](_0x3244d7[_0xf434('0x49')],function(_0x257da4){var _0x4f55dc={};_0x4f55dc[_0x257da4]={'$like':'%'+_0x3c0cea[_0xf434('0x45')][_0xf434('0x4f')]+'%'};return _0x4f55dc;})});}_0x3244d7=_[_0xf434('0x50')]({},_0x3244d7,_0x3c0cea[_0xf434('0x51')]);return _0x2abf0b[_0xf434('0x98')](_0x3244d7);}})[_0xf434('0x21')](function(_0x21ac88){if(_0x21ac88){_0x2ce9ec=_0x21ac88['length'];if(!_0x3c0cea[_0xf434('0x45')]['hasOwnProperty'](_0xf434('0x4b'))){_0x3244d7['limit']=qs[_0xf434('0x33')](_0x3c0cea[_0xf434('0x45')]['limit']);_0x3244d7[_0xf434('0x32')]=qs[_0xf434('0x32')](_0x3c0cea['query'][_0xf434('0x32')]);}return _0x2abf0b['getAgents'](_0x3244d7);}})[_0xf434('0x21')](function(_0x400c2a){if(_0x400c2a){return _0x400c2a?{'count':_0x2ce9ec,'rows':_0x400c2a}:null;}})[_0xf434('0x21')](respondWithResult(_0x4b88fd,null))[_0xf434('0x2c')](handleError(_0x4b88fd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1c8206f..8109f47 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x484a32,_0x4159c5){var _0x4a00fd=function(_0x385332){while(--_0x385332){_0x484a32['push'](_0x484a32['shift']());}};_0x4a00fd(++_0x4159c5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bb161,_0x25b93c){_0x1bb161=_0x1bb161-0x0;var _0x2d4246=_0xb10b[_0x1bb161];return _0x2d4246;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3c6268d..b10761a 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 _0x9e89=['define','chat_queues','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./chatQueue.attributes','exports'];(function(_0x42a77a,_0x330d1a){var _0xf4ca74=function(_0x26b68c){while(--_0x26b68c){_0x42a77a['push'](_0x42a77a['shift']());}};_0xf4ca74(++_0x330d1a);}(_0x9e89,0x16a));var _0x99e8=function(_0x473a66,_0x597ed9){_0x473a66=_0x473a66-0x0;var _0x18c775=_0x9e89[_0x473a66];return _0x18c775;};'use strict';var _=require(_0x99e8('0x0'));var util=require(_0x99e8('0x1'));var logger=require(_0x99e8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x99e8('0x3'));var rp=require(_0x99e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x99e8('0x5'));var attributes=require(_0x99e8('0x6'));module[_0x99e8('0x7')]=function(_0x356a11,_0x2f7112){return _0x356a11[_0x99e8('0x8')]('ChatQueue',attributes,{'tableName':_0x99e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x579e=['rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','util','api','moment','bluebird','path'];(function(_0x129c27,_0x333c44){var _0x5a8017=function(_0x5c5083){while(--_0x5c5083){_0x129c27['push'](_0x129c27['shift']());}};_0x5a8017(++_0x333c44);}(_0x579e,0x1c9));var _0xe579=function(_0x57410d,_0x1c5dcf){_0x57410d=_0x57410d-0x0;var _0x4ff73d=_0x579e[_0x57410d];return _0x4ff73d;};'use strict';var _=require('lodash');var util=require(_0xe579('0x0'));var logger=require('../../config/logger')(_0xe579('0x1'));var moment=require(_0xe579('0x2'));var BPromise=require(_0xe579('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe579('0x4'));var rimraf=require(_0xe579('0x5'));var config=require(_0xe579('0x6'));var attributes=require(_0xe579('0x7'));module['exports']=function(_0x36e10f,_0x1bf941){return _0x36e10f[_0xe579('0x8')](_0xe579('0x9'),attributes,{'tableName':_0xe579('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 2b55326..f0bef1e 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 _0xc893=['model','catch','ShowChatQueue','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x5255fb,_0x5b7838){var _0x1dde0c=function(_0xa99a73){while(--_0xa99a73){_0x5255fb['push'](_0x5255fb['shift']());}};_0x1dde0c(++_0x5b7838);}(_0xc893,0x194));var _0x3c89=function(_0x48250c,_0x3c14b0){_0x48250c=_0x48250c-0x0;var _0x5dd6d9=_0xc893[_0x48250c];return _0x5dd6d9;};'use strict';var _=require('lodash');var util=require(_0x3c89('0x0'));var moment=require(_0x3c89('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c89('0x2'));var db=require(_0x3c89('0x3'))['db'];var utils=require(_0x3c89('0x4'));var logger=require(_0x3c89('0x5'))(_0x3c89('0x6'));var config=require(_0x3c89('0x7'));var jayson=require(_0x3c89('0x8'));var client=jayson['client'][_0x3c89('0x9')]({'port':0x232a});config[_0x3c89('0xa')]=_[_0x3c89('0xb')](config[_0x3c89('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c89('0xc'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x3c89('0xd')](socket);function respondWithRpcPromise(_0x4b8ce9,_0x2c026e,_0x161ed1){return new BPromise(function(_0x53ed5c,_0x182415){return client[_0x3c89('0xe')](_0x4b8ce9,_0x161ed1)[_0x3c89('0xf')](function(_0x18443e){logger[_0x3c89('0x10')](_0x3c89('0x11'),_0x2c026e,_0x3c89('0x12'));logger[_0x3c89('0x13')](_0x3c89('0x14'),_0x2c026e,_0x3c89('0x12'),JSON[_0x3c89('0x15')](_0x18443e));if(_0x18443e[_0x3c89('0x16')]){if(_0x18443e[_0x3c89('0x16')][_0x3c89('0x17')]===0x1f4){logger['error'](_0x3c89('0x11'),_0x2c026e,_0x18443e[_0x3c89('0x16')][_0x3c89('0x18')]);return _0x182415(_0x18443e[_0x3c89('0x16')][_0x3c89('0x18')]);}logger[_0x3c89('0x16')](_0x3c89('0x11'),_0x2c026e,_0x18443e[_0x3c89('0x16')][_0x3c89('0x18')]);return _0x53ed5c(_0x18443e[_0x3c89('0x16')][_0x3c89('0x18')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2c026e,_0x3c89('0x12'));_0x53ed5c(_0x18443e[_0x3c89('0x19')]['message']);}})['catch'](function(_0x425d5c){logger[_0x3c89('0x16')](_0x3c89('0x11'),_0x2c026e,_0x425d5c);_0x182415(_0x425d5c);});});}exports[_0x3c89('0x1a')]=function(_0x570485){var _0x9a689e=this;return new Promise(function(_0x246c13,_0x218509){return db[_0x3c89('0x1b')][_0x3c89('0x1c')]({'raw':_0x570485[_0x3c89('0x1d')]?_0x570485[_0x3c89('0x1d')][_0x3c89('0x1e')]===undefined?!![]:![]:!![],'where':_0x570485[_0x3c89('0x1d')]?_0x570485[_0x3c89('0x1d')][_0x3c89('0x1f')]||null:null,'attributes':_0x570485[_0x3c89('0x1d')]?_0x570485[_0x3c89('0x1d')][_0x3c89('0x20')]||null:null,'limit':_0x570485[_0x3c89('0x1d')]?_0x570485[_0x3c89('0x1d')][_0x3c89('0x21')]||null:null,'include':_0x570485[_0x3c89('0x1d')]?_0x570485[_0x3c89('0x1d')][_0x3c89('0x22')]?_['map'](_0x570485[_0x3c89('0x1d')]['include'],function(_0x4ea71a){return{'model':db[_0x4ea71a['model']],'as':_0x4ea71a['as'],'attributes':_0x4ea71a[_0x3c89('0x20')],'include':_0x4ea71a[_0x3c89('0x22')]?_[_0x3c89('0x23')](_0x4ea71a['include'],function(_0x393553){return{'model':db[_0x393553[_0x3c89('0x24')]],'as':_0x393553['as'],'attributes':_0x393553['attributes'],'include':_0x393553['include']?_[_0x3c89('0x23')](_0x393553[_0x3c89('0x22')],function(_0x269227){return{'model':db[_0x269227['model']],'as':_0x269227['as'],'attributes':_0x269227['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c89('0xf')](function(_0x1eb726){logger['info'](_0x3c89('0x1a'),_0x570485);logger[_0x3c89('0x13')](_0x3c89('0x1a'),_0x570485,JSON[_0x3c89('0x15')](_0x1eb726));_0x246c13(_0x1eb726);})[_0x3c89('0x25')](function(_0x1fdbf4){logger[_0x3c89('0x16')]('GetChatQueue',_0x1fdbf4[_0x3c89('0x18')],_0x570485);_0x218509(_0x9a689e[_0x3c89('0x16')](0x1f4,_0x1fdbf4[_0x3c89('0x18')]));});});};exports[_0x3c89('0x26')]=function(_0x49b50a){var _0x408383=this;return new Promise(function(_0x4d2c6c,_0x7cc999){return db[_0x3c89('0x1b')][_0x3c89('0x27')]({'raw':_0x49b50a['options']?_0x49b50a[_0x3c89('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x49b50a[_0x3c89('0x1d')]?_0x49b50a[_0x3c89('0x1d')]['where']||null:null,'attributes':_0x49b50a[_0x3c89('0x1d')]?_0x49b50a[_0x3c89('0x1d')][_0x3c89('0x20')]||null:null,'include':_0x49b50a[_0x3c89('0x1d')]?_0x49b50a[_0x3c89('0x1d')][_0x3c89('0x22')]?_['map'](_0x49b50a[_0x3c89('0x1d')][_0x3c89('0x22')],function(_0x248594){return{'model':db[_0x248594[_0x3c89('0x24')]],'as':_0x248594['as'],'attributes':_0x248594[_0x3c89('0x20')],'include':_0x248594[_0x3c89('0x22')]?_['map'](_0x248594[_0x3c89('0x22')],function(_0xb0526f){return{'model':db[_0xb0526f[_0x3c89('0x24')]],'as':_0xb0526f['as'],'attributes':_0xb0526f['attributes'],'include':_0xb0526f[_0x3c89('0x22')]?_[_0x3c89('0x23')](_0xb0526f[_0x3c89('0x22')],function(_0x1e9759){return{'model':db[_0x1e9759[_0x3c89('0x24')]],'as':_0x1e9759['as'],'attributes':_0x1e9759[_0x3c89('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3c89('0xf')](function(_0x1cb827){logger['info']('ShowChatQueue',_0x49b50a);logger[_0x3c89('0x13')](_0x3c89('0x26'),_0x49b50a,JSON[_0x3c89('0x15')](_0x1cb827));_0x4d2c6c(_0x1cb827);})['catch'](function(_0x511580){logger['error'](_0x3c89('0x26'),_0x511580[_0x3c89('0x18')],_0x49b50a);_0x7cc999(_0x408383[_0x3c89('0x16')](0x1f4,_0x511580[_0x3c89('0x18')]));});});}; \ No newline at end of file +var _0x57c3=['attributes','limit','include','model','map','debug','ShowChatQueue','ChatQueue','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetChatQueue','options'];(function(_0x5b064e,_0x488cfd){var _0x537d1d=function(_0x3bacb0){while(--_0x3bacb0){_0x5b064e['push'](_0x5b064e['shift']());}};_0x537d1d(++_0x488cfd);}(_0x57c3,0xc2));var _0x357c=function(_0x4b9eec,_0x2dfbb0){_0x4b9eec=_0x4b9eec-0x0;var _0x2f530f=_0x57c3[_0x4b9eec];return _0x2f530f;};'use strict';var _=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var moment=require(_0x357c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x357c('0x3'))['db'];var utils=require(_0x357c('0x4'));var logger=require(_0x357c('0x5'))(_0x357c('0x6'));var config=require('../../config/environment');var jayson=require(_0x357c('0x7'));var client=jayson['client'][_0x357c('0x8')]({'port':0x232a});config[_0x357c('0x9')]=_[_0x357c('0xa')](config[_0x357c('0x9')],{'host':_0x357c('0xb'),'port':0x18eb});var socket=require(_0x357c('0xc'))(new Redis(config[_0x357c('0x9')]));require('./chatQueue.socket')[_0x357c('0xd')](socket);function respondWithRpcPromise(_0x1c30bd,_0x214216,_0x14f062){return new BPromise(function(_0x46286d,_0xe99073){return client[_0x357c('0xe')](_0x1c30bd,_0x14f062)[_0x357c('0xf')](function(_0xd4399f){logger[_0x357c('0x10')](_0x357c('0x11'),_0x214216,_0x357c('0x12'));logger['debug'](_0x357c('0x13'),_0x214216,_0x357c('0x12'),JSON[_0x357c('0x14')](_0xd4399f));if(_0xd4399f['error']){if(_0xd4399f['error'][_0x357c('0x15')]===0x1f4){logger[_0x357c('0x16')](_0x357c('0x11'),_0x214216,_0xd4399f[_0x357c('0x16')][_0x357c('0x17')]);return _0xe99073(_0xd4399f[_0x357c('0x16')]['message']);}logger[_0x357c('0x16')](_0x357c('0x11'),_0x214216,_0xd4399f['error']['message']);return _0x46286d(_0xd4399f[_0x357c('0x16')][_0x357c('0x17')]);}else{logger[_0x357c('0x10')]('ChatQueue,\x20%s,\x20%s',_0x214216,_0x357c('0x12'));_0x46286d(_0xd4399f[_0x357c('0x18')][_0x357c('0x17')]);}})[_0x357c('0x19')](function(_0x3b4259){logger[_0x357c('0x16')](_0x357c('0x11'),_0x214216,_0x3b4259);_0xe99073(_0x3b4259);});});}exports[_0x357c('0x1a')]=function(_0x22af86){var _0x5da9b1=this;return new Promise(function(_0x147b66,_0xe3956){return db['ChatQueue']['findAll']({'raw':_0x22af86[_0x357c('0x1b')]?_0x22af86[_0x357c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x22af86[_0x357c('0x1b')]?_0x22af86[_0x357c('0x1b')]['where']||null:null,'attributes':_0x22af86[_0x357c('0x1b')]?_0x22af86[_0x357c('0x1b')][_0x357c('0x1c')]||null:null,'limit':_0x22af86[_0x357c('0x1b')]?_0x22af86[_0x357c('0x1b')][_0x357c('0x1d')]||null:null,'include':_0x22af86[_0x357c('0x1b')]?_0x22af86[_0x357c('0x1b')]['include']?_['map'](_0x22af86[_0x357c('0x1b')][_0x357c('0x1e')],function(_0x134274){return{'model':db[_0x134274[_0x357c('0x1f')]],'as':_0x134274['as'],'attributes':_0x134274[_0x357c('0x1c')],'include':_0x134274['include']?_[_0x357c('0x20')](_0x134274['include'],function(_0x406753){return{'model':db[_0x406753[_0x357c('0x1f')]],'as':_0x406753['as'],'attributes':_0x406753[_0x357c('0x1c')],'include':_0x406753['include']?_[_0x357c('0x20')](_0x406753[_0x357c('0x1e')],function(_0x34984f){return{'model':db[_0x34984f[_0x357c('0x1f')]],'as':_0x34984f['as'],'attributes':_0x34984f[_0x357c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x357c('0xf')](function(_0x28031a){logger[_0x357c('0x10')]('GetChatQueue',_0x22af86);logger[_0x357c('0x21')](_0x357c('0x1a'),_0x22af86,JSON[_0x357c('0x14')](_0x28031a));_0x147b66(_0x28031a);})[_0x357c('0x19')](function(_0x288957){logger['error'](_0x357c('0x1a'),_0x288957[_0x357c('0x17')],_0x22af86);_0xe3956(_0x5da9b1[_0x357c('0x16')](0x1f4,_0x288957[_0x357c('0x17')]));});});};exports[_0x357c('0x22')]=function(_0x16f54a){var _0x3122b1=this;return new Promise(function(_0x3fc1d9,_0x3829df){return db[_0x357c('0x23')][_0x357c('0x24')]({'raw':_0x16f54a[_0x357c('0x1b')]?_0x16f54a[_0x357c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x16f54a[_0x357c('0x1b')]?_0x16f54a[_0x357c('0x1b')]['where']||null:null,'attributes':_0x16f54a[_0x357c('0x1b')]?_0x16f54a[_0x357c('0x1b')][_0x357c('0x1c')]||null:null,'include':_0x16f54a[_0x357c('0x1b')]?_0x16f54a[_0x357c('0x1b')][_0x357c('0x1e')]?_['map'](_0x16f54a[_0x357c('0x1b')][_0x357c('0x1e')],function(_0x2e5f02){return{'model':db[_0x2e5f02['model']],'as':_0x2e5f02['as'],'attributes':_0x2e5f02[_0x357c('0x1c')],'include':_0x2e5f02[_0x357c('0x1e')]?_[_0x357c('0x20')](_0x2e5f02['include'],function(_0x5115c9){return{'model':db[_0x5115c9[_0x357c('0x1f')]],'as':_0x5115c9['as'],'attributes':_0x5115c9[_0x357c('0x1c')],'include':_0x5115c9[_0x357c('0x1e')]?_['map'](_0x5115c9[_0x357c('0x1e')],function(_0x4c62cd){return{'model':db[_0x4c62cd[_0x357c('0x1f')]],'as':_0x4c62cd['as'],'attributes':_0x4c62cd[_0x357c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x357c('0xf')](function(_0x42dac0){logger[_0x357c('0x10')]('ShowChatQueue',_0x16f54a);logger[_0x357c('0x21')](_0x357c('0x22'),_0x16f54a,JSON[_0x357c('0x14')](_0x42dac0));_0x3fc1d9(_0x42dac0);})[_0x357c('0x19')](function(_0x33b988){logger[_0x357c('0x16')](_0x357c('0x22'),_0x33b988[_0x357c('0x17')],_0x16f54a);_0x3829df(_0x3122b1[_0x357c('0x16')](0x1f4,_0x33b988['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8739289..6a69c25 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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x4e0863,_0x1ec822){var _0x3133d7=function(_0x3fca7d){while(--_0x3fca7d){_0x4e0863['push'](_0x4e0863['shift']());}};_0x3133d7(++_0x1ec822);}(_0xb10b,0x12a));var _0xbb10=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xb10b[_0x37d0bc];return _0x170e60;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x1d9463,_0x110575){var _0xee1e67=function(_0x4f6608){while(--_0x4f6608){_0x1d9463['push'](_0x1d9463['shift']());}};_0xee1e67(++_0x110575);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6191a76..e01ce56 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 _0x655c=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get'];(function(_0xf7dfff,_0x17ed47){var _0xa55b3d=function(_0x340fbd){while(--_0x340fbd){_0xf7dfff['push'](_0xf7dfff['shift']());}};_0xa55b3d(++_0x17ed47);}(_0x655c,0x85));var _0xc655=function(_0x42a1d6,_0x520ab4){_0x42a1d6=_0x42a1d6-0x0;var _0x29ade0=_0x655c[_0x42a1d6];return _0x29ade0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc655('0x0'));var timeout=require(_0xc655('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xc655('0x2'));var interaction=require(_0xc655('0x3'));var config=require(_0xc655('0x4'));var controller=require(_0xc655('0x5'));router[_0xc655('0x6')]('/',auth[_0xc655('0x7')](),controller[_0xc655('0x8')]);router[_0xc655('0x6')](_0xc655('0x9'),auth['isAuthenticated'](),controller[_0xc655('0xa')]);router[_0xc655('0x6')](_0xc655('0xb'),auth['isAuthenticated'](),controller[_0xc655('0xc')]);router[_0xc655('0x6')](_0xc655('0xd'),auth[_0xc655('0x7')](),controller[_0xc655('0xe')]);router[_0xc655('0x6')](_0xc655('0xf'),auth[_0xc655('0x7')](),controller[_0xc655('0x10')]);router['get'](_0xc655('0x11'),auth[_0xc655('0x7')](),controller[_0xc655('0x12')]);router[_0xc655('0x13')]('/',auth['isAuthenticated'](),controller[_0xc655('0x14')]);router['post'](_0xc655('0xf'),auth[_0xc655('0x7')](),controller[_0xc655('0x15')]);router[_0xc655('0x13')](_0xc655('0x11'),auth[_0xc655('0x7')](),controller[_0xc655('0x16')]);router[_0xc655('0x17')]('/:id',auth[_0xc655('0x7')](),controller['update']);router[_0xc655('0x18')](_0xc655('0xb'),auth[_0xc655('0x7')](),controller[_0xc655('0x19')]);router[_0xc655('0x18')](_0xc655('0xf'),auth['isAuthenticated'](),controller[_0xc655('0x1a')]);router[_0xc655('0x18')](_0xc655('0x11'),auth[_0xc655('0x7')](),controller['removeAgents']);module[_0xc655('0x1b')]=router; \ No newline at end of file +var _0xbf6e=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','addAgents','put','delete','/:id','destroy','removeTeams'];(function(_0x4d5f19,_0x551768){var _0x5cf05d=function(_0x2c4b11){while(--_0x2c4b11){_0x4d5f19['push'](_0x4d5f19['shift']());}};_0x5cf05d(++_0x551768);}(_0xbf6e,0xb0));var _0xebf6=function(_0x30dcab,_0x5c2cd3){_0x30dcab=_0x30dcab-0x0;var _0x428333=_0xbf6e[_0x30dcab];return _0x428333;};'use strict';var multer=require(_0xebf6('0x0'));var util=require(_0xebf6('0x1'));var path=require(_0xebf6('0x2'));var timeout=require(_0xebf6('0x3'));var express=require(_0xebf6('0x4'));var router=express[_0xebf6('0x5')]();var auth=require(_0xebf6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xebf6('0x7'));var controller=require('./chatQueue.controller');router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['describe']);router[_0xebf6('0x8')]('/:id',auth[_0xebf6('0x9')](),controller[_0xebf6('0xc')]);router[_0xebf6('0x8')](_0xebf6('0xd'),auth[_0xebf6('0x9')](),controller[_0xebf6('0xe')]);router[_0xebf6('0x8')](_0xebf6('0xf'),auth['isAuthenticated'](),controller[_0xebf6('0x10')]);router[_0xebf6('0x8')]('/:id/users',auth[_0xebf6('0x9')](),controller[_0xebf6('0x11')]);router['post']('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0x12')]);router[_0xebf6('0x13')](_0xebf6('0xf'),auth[_0xebf6('0x9')](),controller[_0xebf6('0x14')]);router[_0xebf6('0x13')]('/:id/users',auth[_0xebf6('0x9')](),controller[_0xebf6('0x15')]);router[_0xebf6('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xebf6('0x17')](_0xebf6('0x18'),auth[_0xebf6('0x9')](),controller[_0xebf6('0x19')]);router[_0xebf6('0x17')](_0xebf6('0xf'),auth[_0xebf6('0x9')](),controller[_0xebf6('0x1a')]);router[_0xebf6('0x17')]('/:id/users',auth[_0xebf6('0x9')](),controller[_0xebf6('0x1b')]);module[_0xebf6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0752ead..2ac8511 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 _0xd168=['DATE','moment','sequelize','STRING'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd168,0x1a5));var _0x8d16=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xd168[_0x5a79e2];return _0x266c45;};'use strict';var moment=require(_0x8d16('0x0'));var Sequelize=require(_0x8d16('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8d16('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8d16('0x2')]},'joinAt':{'type':Sequelize[_0x8d16('0x3')]},'leaveAt':{'type':Sequelize[_0x8d16('0x3')]},'acceptAt':{'type':Sequelize[_0x8d16('0x3')]},'exitAt':{'type':Sequelize[_0x8d16('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf988=['moment','sequelize','STRING','DATE'];(function(_0x26660c,_0xa474ef){var _0x21fb98=function(_0xcedc16){while(--_0xcedc16){_0x26660c['push'](_0x26660c['shift']());}};_0x21fb98(++_0xa474ef);}(_0xf988,0x78));var _0x8f98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf988[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8f98('0x0'));var Sequelize=require(_0x8f98('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8f98('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8f98('0x2')]},'joinAt':{'type':Sequelize[_0x8f98('0x3')]},'leaveAt':{'type':Sequelize[_0x8f98('0x3')]},'acceptAt':{'type':Sequelize[_0x8f98('0x3')]},'exitAt':{'type':Sequelize[_0x8f98('0x3')]},'reason':{'type':Sequelize[_0x8f98('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7181ce3..cb73657 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 _0x15f1=['include','options','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','findAll','rows','catch','show','params','keys','filters','includeAll'];(function(_0x332299,_0x247952){var _0x5f4d5b=function(_0x5398bb){while(--_0x5398bb){_0x332299['push'](_0x332299['shift']());}};_0x5f4d5b(++_0x247952);}(_0x15f1,0x190));var _0x115f=function(_0x16837f,_0x5bf229){_0x16837f=_0x16837f-0x0;var _0x9eccc9=_0x15f1[_0x16837f];return _0x9eccc9;};'use strict';var pdf=require(_0x115f('0x0'));var emlformat=require(_0x115f('0x1'));var rimraf=require(_0x115f('0x2'));var zipdir=require(_0x115f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x115f('0x4'));var moment=require(_0x115f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x115f('0x6'));var path=require(_0x115f('0x7'));var sox=require(_0x115f('0x8'));var csv=require(_0x115f('0x9'));var ejs=require(_0x115f('0xa'));var fs=require('fs');var _=require(_0x115f('0xb'));var squel=require(_0x115f('0xc'));var crypto=require(_0x115f('0xd'));var jsforce=require(_0x115f('0xe'));var deskjs=require(_0x115f('0xf'));var toCsv=require(_0x115f('0x9'));var querystring=require(_0x115f('0x10'));var Papa=require(_0x115f('0x11'));var Redis=require(_0x115f('0x12'));var authService=require(_0x115f('0x13'));var qs=require(_0x115f('0x14'));var as=require(_0x115f('0x15'));var hardwareService=require(_0x115f('0x16'));var logger=require(_0x115f('0x17'))(_0x115f('0x18'));var utils=require(_0x115f('0x19'));var config=require(_0x115f('0x1a'));var licenseUtil=require(_0x115f('0x1b'));var db=require(_0x115f('0x1c'))['db'];function respondWithStatusCode(_0x365fc1,_0x3c39e1){_0x3c39e1=_0x3c39e1||0xcc;return function(_0x54e5fd){if(_0x54e5fd){return _0x365fc1['sendStatus'](_0x3c39e1);}return _0x365fc1['status'](_0x3c39e1)[_0x115f('0x1d')]();};}function respondWithResult(_0x387856,_0x81c1ca){_0x81c1ca=_0x81c1ca||0xc8;return function(_0x54edce){if(_0x54edce){return _0x387856[_0x115f('0x1e')](_0x81c1ca)[_0x115f('0x1f')](_0x54edce);}};}function respondWithFilteredResult(_0x1c297b,_0x1ae501){return function(_0x5c0893){if(_0x5c0893){var _0x2daeeb=_0x5c0893['count'],_0x3f6702=_0x1ae501[_0x115f('0x20')],_0x436899=_0x1ae501[_0x115f('0x20')]+_0x1ae501[_0x115f('0x21')],_0x10be93;if(_0x436899>=_0x2daeeb){_0x436899=_0x2daeeb;_0x10be93=0xc8;}else{_0x10be93=0xce;}_0x1c297b[_0x115f('0x1e')](_0x10be93);return _0x1c297b['set'](_0x115f('0x22'),_0x3f6702+'-'+_0x436899+'/'+_0x2daeeb)[_0x115f('0x1f')](_0x5c0893);}return null;};}function patchUpdates(_0x1c4ce7){return function(_0x589593){try{jsonpatch['apply'](_0x589593,_0x1c4ce7,!![]);}catch(_0x2eae3a){return BPromise['reject'](_0x2eae3a);}return _0x589593[_0x115f('0x23')]();};}function saveUpdates(_0x151a18,_0x20be38){return function(_0x2aaf20){if(_0x2aaf20){return _0x2aaf20[_0x115f('0x24')](_0x151a18)[_0x115f('0x25')](function(_0x1bfb9c){return _0x1bfb9c;});}return null;};}function removeEntity(_0xa7896,_0x347e3c){return function(_0x2e0518){if(_0x2e0518){return _0x2e0518[_0x115f('0x26')]()[_0x115f('0x25')](function(){_0xa7896[_0x115f('0x1e')](0xcc)[_0x115f('0x1d')]();});}};}function handleEntityNotFound(_0x2e18e9,_0x31035e){return function(_0x4b09f5){if(!_0x4b09f5){_0x2e18e9[_0x115f('0x27')](0x194);}return _0x4b09f5;};}function handleError(_0x2965e2,_0x229147){_0x229147=_0x229147||0x1f4;return function(_0x2ffd0e){logger['error'](_0x2ffd0e[_0x115f('0x28')]);if(_0x2ffd0e[_0x115f('0x29')]){delete _0x2ffd0e[_0x115f('0x29')];}_0x2965e2['status'](_0x229147)[_0x115f('0x2a')](_0x2ffd0e);};}exports[_0x115f('0x2b')]=function(_0x4c75f6,_0x3c0bf1){var _0x17dfed={},_0x3f2354={},_0x1ee2b5={'count':0x0,'rows':[]};var _0x42a119=_[_0x115f('0x2c')](db[_0x115f('0x2d')][_0x115f('0x2e')],function(_0x43fd23){return{'name':_0x43fd23[_0x115f('0x2f')],'type':_0x43fd23[_0x115f('0x30')][_0x115f('0x31')]};});_0x3f2354[_0x115f('0x32')]=_[_0x115f('0x2c')](_0x42a119,_0x115f('0x29'));_0x3f2354[_0x115f('0x33')]=_['keys'](_0x4c75f6[_0x115f('0x33')]);_0x3f2354['filters']=_[_0x115f('0x34')](_0x3f2354['model'],_0x3f2354[_0x115f('0x33')]);_0x17dfed['attributes']=_[_0x115f('0x34')](_0x3f2354[_0x115f('0x32')],qs['fields'](_0x4c75f6['query'][_0x115f('0x35')]));_0x17dfed[_0x115f('0x36')]=_0x17dfed['attributes'][_0x115f('0x37')]?_0x17dfed['attributes']:_0x3f2354[_0x115f('0x32')];if(!_0x4c75f6[_0x115f('0x33')][_0x115f('0x38')](_0x115f('0x39'))){_0x17dfed[_0x115f('0x21')]=qs[_0x115f('0x21')](_0x4c75f6['query'][_0x115f('0x21')]);_0x17dfed[_0x115f('0x20')]=qs[_0x115f('0x20')](_0x4c75f6['query'][_0x115f('0x20')]);}_0x17dfed[_0x115f('0x3a')]=qs[_0x115f('0x3b')](_0x4c75f6[_0x115f('0x33')]['sort']);_0x17dfed[_0x115f('0x3c')]=qs['filters'](_[_0x115f('0x3d')](_0x4c75f6[_0x115f('0x33')],_0x3f2354['filters']),_0x42a119);if(_0x4c75f6[_0x115f('0x33')][_0x115f('0x3e')]){_0x17dfed[_0x115f('0x3c')]=_['merge'](_0x17dfed[_0x115f('0x3c')],{'$or':_[_0x115f('0x2c')](_0x42a119,function(_0x3d7ed7){if(_0x3d7ed7['type']!==_0x115f('0x3f')){var _0x16cc8b={};_0x16cc8b[_0x3d7ed7['name']]={'$like':'%'+_0x4c75f6[_0x115f('0x33')]['filter']+'%'};return _0x16cc8b;}})});}_0x17dfed=_[_0x115f('0x40')]({},_0x17dfed,_0x4c75f6['options']);var _0x3895ee={'where':_0x17dfed[_0x115f('0x3c')]};return db[_0x115f('0x2d')][_0x115f('0x41')](_0x3895ee)['then'](function(_0x53cba8){_0x1ee2b5[_0x115f('0x41')]=_0x53cba8;if(_0x4c75f6['query']['includeAll']){_0x17dfed['include']=[{'all':!![]}];}return db[_0x115f('0x2d')][_0x115f('0x42')](_0x17dfed);})['then'](function(_0x55e6fa){_0x1ee2b5[_0x115f('0x43')]=_0x55e6fa;return _0x1ee2b5;})[_0x115f('0x25')](respondWithFilteredResult(_0x3c0bf1,_0x17dfed))[_0x115f('0x44')](handleError(_0x3c0bf1,null));};exports[_0x115f('0x45')]=function(_0x44689c,_0xafb744){var _0x1ef71d={'raw':!![],'where':{'id':_0x44689c[_0x115f('0x46')]['id']}},_0x3e7cb4={};_0x3e7cb4[_0x115f('0x32')]=_[_0x115f('0x47')](db['ChatQueueReport'][_0x115f('0x2e')]);_0x3e7cb4[_0x115f('0x33')]=_['keys'](_0x44689c['query']);_0x3e7cb4[_0x115f('0x48')]=_[_0x115f('0x34')](_0x3e7cb4['model'],_0x3e7cb4[_0x115f('0x33')]);_0x1ef71d['attributes']=_[_0x115f('0x34')](_0x3e7cb4[_0x115f('0x32')],qs['fields'](_0x44689c[_0x115f('0x33')][_0x115f('0x35')]));_0x1ef71d['attributes']=_0x1ef71d[_0x115f('0x36')]['length']?_0x1ef71d[_0x115f('0x36')]:_0x3e7cb4[_0x115f('0x32')];if(_0x44689c[_0x115f('0x33')][_0x115f('0x49')]){_0x1ef71d[_0x115f('0x4a')]=[{'all':!![]}];}_0x1ef71d=_[_0x115f('0x40')]({},_0x1ef71d,_0x44689c[_0x115f('0x4b')]);return db[_0x115f('0x2d')][_0x115f('0x4c')](_0x1ef71d)[_0x115f('0x25')](handleEntityNotFound(_0xafb744,null))['then'](respondWithResult(_0xafb744,null))[_0x115f('0x44')](handleError(_0xafb744,null));};exports['create']=function(_0x6aaae6,_0x17d3ca){return db[_0x115f('0x2d')]['create'](_0x6aaae6[_0x115f('0x4d')],{})[_0x115f('0x25')](respondWithResult(_0x17d3ca,0xc9))[_0x115f('0x44')](handleError(_0x17d3ca,null));};exports['update']=function(_0x524a5b,_0x40c14b){if(_0x524a5b[_0x115f('0x4d')]['id']){delete _0x524a5b[_0x115f('0x4d')]['id'];}return db[_0x115f('0x2d')]['find']({'where':{'id':_0x524a5b[_0x115f('0x46')]['id']}})['then'](handleEntityNotFound(_0x40c14b,null))[_0x115f('0x25')](saveUpdates(_0x524a5b[_0x115f('0x4d')],null))[_0x115f('0x25')](respondWithResult(_0x40c14b,null))[_0x115f('0x44')](handleError(_0x40c14b,null));};exports[_0x115f('0x26')]=function(_0x431b13,_0x47b41c){return db[_0x115f('0x2d')]['find']({'where':{'id':_0x431b13[_0x115f('0x46')]['id']}})[_0x115f('0x25')](handleEntityNotFound(_0x47b41c,null))[_0x115f('0x25')](removeEntity(_0x47b41c,null))[_0x115f('0x44')](handleError(_0x47b41c,null));};exports[_0x115f('0x4e')]=function(_0x279843,_0x502303){return db[_0x115f('0x2d')]['describe']()[_0x115f('0x25')](respondWithResult(_0x502303,null))[_0x115f('0x44')](handleError(_0x502303,null));}; \ No newline at end of file +var _0xd485=['order','sort','filter','where','merge','VIRTUAL','options','ChatQueueReport','includeAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x52913a,_0x3b4c96){var _0x3869d8=function(_0x4e89bf){while(--_0x4e89bf){_0x52913a['push'](_0x52913a['shift']());}};_0x3869d8(++_0x3b4c96);}(_0xd485,0xf9));var _0x5d48=function(_0x5c0465,_0x175a47){_0x5c0465=_0x5c0465-0x0;var _0x32e8ac=_0xd485[_0x5c0465];return _0x32e8ac;};'use strict';var pdf=require(_0x5d48('0x0'));var emlformat=require(_0x5d48('0x1'));var rimraf=require(_0x5d48('0x2'));var zipdir=require(_0x5d48('0x3'));var jsonpatch=require(_0x5d48('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5d48('0x5'));var Mustache=require(_0x5d48('0x6'));var util=require(_0x5d48('0x7'));var path=require(_0x5d48('0x8'));var sox=require(_0x5d48('0x9'));var csv=require(_0x5d48('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5d48('0xb'));var squel=require('squel');var crypto=require(_0x5d48('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5d48('0xd'));var toCsv=require(_0x5d48('0xa'));var querystring=require('querystring');var Papa=require(_0x5d48('0xe'));var Redis=require(_0x5d48('0xf'));var authService=require(_0x5d48('0x10'));var qs=require(_0x5d48('0x11'));var as=require(_0x5d48('0x12'));var hardwareService=require(_0x5d48('0x13'));var logger=require(_0x5d48('0x14'))(_0x5d48('0x15'));var utils=require(_0x5d48('0x16'));var config=require(_0x5d48('0x17'));var licenseUtil=require(_0x5d48('0x18'));var db=require(_0x5d48('0x19'))['db'];function respondWithStatusCode(_0x4de92c,_0x9ef1c7){_0x9ef1c7=_0x9ef1c7||0xcc;return function(_0x4728f7){if(_0x4728f7){return _0x4de92c[_0x5d48('0x1a')](_0x9ef1c7);}return _0x4de92c['status'](_0x9ef1c7)[_0x5d48('0x1b')]();};}function respondWithResult(_0x328ed8,_0x19efca){_0x19efca=_0x19efca||0xc8;return function(_0x47c9c9){if(_0x47c9c9){return _0x328ed8[_0x5d48('0x1c')](_0x19efca)['json'](_0x47c9c9);}};}function respondWithFilteredResult(_0x1a00de,_0x4dc583){return function(_0x3bf66e){if(_0x3bf66e){var _0x415af4=_0x3bf66e[_0x5d48('0x1d')],_0x113795=_0x4dc583['offset'],_0x521684=_0x4dc583[_0x5d48('0x1e')]+_0x4dc583[_0x5d48('0x1f')],_0x40b90b;if(_0x521684>=_0x415af4){_0x521684=_0x415af4;_0x40b90b=0xc8;}else{_0x40b90b=0xce;}_0x1a00de['status'](_0x40b90b);return _0x1a00de['set'](_0x5d48('0x20'),_0x113795+'-'+_0x521684+'/'+_0x415af4)[_0x5d48('0x21')](_0x3bf66e);}return null;};}function patchUpdates(_0x25beab){return function(_0x3cde23){try{jsonpatch[_0x5d48('0x22')](_0x3cde23,_0x25beab,!![]);}catch(_0x2b04a0){return BPromise[_0x5d48('0x23')](_0x2b04a0);}return _0x3cde23[_0x5d48('0x24')]();};}function saveUpdates(_0x377883,_0xfbcda4){return function(_0x2270aa){if(_0x2270aa){return _0x2270aa[_0x5d48('0x25')](_0x377883)[_0x5d48('0x26')](function(_0x232131){return _0x232131;});}return null;};}function removeEntity(_0xdc6295,_0x5b0407){return function(_0x79bf3b){if(_0x79bf3b){return _0x79bf3b[_0x5d48('0x27')]()[_0x5d48('0x26')](function(){_0xdc6295[_0x5d48('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x224580,_0x10af8a){return function(_0x4371a8){if(!_0x4371a8){_0x224580[_0x5d48('0x1a')](0x194);}return _0x4371a8;};}function handleError(_0x342dc3,_0x346ccc){_0x346ccc=_0x346ccc||0x1f4;return function(_0x5d0c6f){logger[_0x5d48('0x28')](_0x5d0c6f[_0x5d48('0x29')]);if(_0x5d0c6f[_0x5d48('0x2a')]){delete _0x5d0c6f[_0x5d48('0x2a')];}_0x342dc3[_0x5d48('0x1c')](_0x346ccc)[_0x5d48('0x2b')](_0x5d0c6f);};}exports[_0x5d48('0x2c')]=function(_0x5f9038,_0x4afdea){var _0x20781={},_0x32745c={},_0x120ecb={'count':0x0,'rows':[]};var _0x41bec5=_[_0x5d48('0x2d')](db['ChatQueueReport'][_0x5d48('0x2e')],function(_0xe9b26e){return{'name':_0xe9b26e[_0x5d48('0x2f')],'type':_0xe9b26e[_0x5d48('0x30')][_0x5d48('0x31')]};});_0x32745c['model']=_['map'](_0x41bec5,_0x5d48('0x2a'));_0x32745c['query']=_[_0x5d48('0x32')](_0x5f9038[_0x5d48('0x33')]);_0x32745c[_0x5d48('0x34')]=_[_0x5d48('0x35')](_0x32745c[_0x5d48('0x36')],_0x32745c[_0x5d48('0x33')]);_0x20781[_0x5d48('0x37')]=_[_0x5d48('0x35')](_0x32745c[_0x5d48('0x36')],qs[_0x5d48('0x38')](_0x5f9038[_0x5d48('0x33')][_0x5d48('0x38')]));_0x20781[_0x5d48('0x37')]=_0x20781['attributes'][_0x5d48('0x39')]?_0x20781[_0x5d48('0x37')]:_0x32745c[_0x5d48('0x36')];if(!_0x5f9038[_0x5d48('0x33')][_0x5d48('0x3a')]('nolimit')){_0x20781[_0x5d48('0x1f')]=qs[_0x5d48('0x1f')](_0x5f9038['query']['limit']);_0x20781[_0x5d48('0x1e')]=qs[_0x5d48('0x1e')](_0x5f9038['query'][_0x5d48('0x1e')]);}_0x20781[_0x5d48('0x3b')]=qs[_0x5d48('0x3c')](_0x5f9038[_0x5d48('0x33')]['sort']);_0x20781['where']=qs['filters'](_['pick'](_0x5f9038[_0x5d48('0x33')],_0x32745c[_0x5d48('0x34')]),_0x41bec5);if(_0x5f9038[_0x5d48('0x33')][_0x5d48('0x3d')]){_0x20781[_0x5d48('0x3e')]=_[_0x5d48('0x3f')](_0x20781[_0x5d48('0x3e')],{'$or':_['map'](_0x41bec5,function(_0x5d9aa6){if(_0x5d9aa6[_0x5d48('0x30')]!==_0x5d48('0x40')){var _0x43e27b={};_0x43e27b[_0x5d9aa6[_0x5d48('0x2a')]]={'$like':'%'+_0x5f9038['query'][_0x5d48('0x3d')]+'%'};return _0x43e27b;}})});}_0x20781=_[_0x5d48('0x3f')]({},_0x20781,_0x5f9038[_0x5d48('0x41')]);var _0x4a3a12={'where':_0x20781[_0x5d48('0x3e')]};return db[_0x5d48('0x42')][_0x5d48('0x1d')](_0x4a3a12)['then'](function(_0x7c80a8){_0x120ecb[_0x5d48('0x1d')]=_0x7c80a8;if(_0x5f9038['query'][_0x5d48('0x43')]){_0x20781['include']=[{'all':!![]}];}return db[_0x5d48('0x42')]['findAll'](_0x20781);})[_0x5d48('0x26')](function(_0x2c4d0a){_0x120ecb[_0x5d48('0x44')]=_0x2c4d0a;return _0x120ecb;})[_0x5d48('0x26')](respondWithFilteredResult(_0x4afdea,_0x20781))[_0x5d48('0x45')](handleError(_0x4afdea,null));};exports[_0x5d48('0x46')]=function(_0x184b28,_0x178a02){var _0x256612={'raw':!![],'where':{'id':_0x184b28[_0x5d48('0x47')]['id']}},_0x261bca={};_0x261bca['model']=_['keys'](db[_0x5d48('0x42')]['rawAttributes']);_0x261bca[_0x5d48('0x33')]=_[_0x5d48('0x32')](_0x184b28['query']);_0x261bca[_0x5d48('0x34')]=_[_0x5d48('0x35')](_0x261bca[_0x5d48('0x36')],_0x261bca[_0x5d48('0x33')]);_0x256612['attributes']=_[_0x5d48('0x35')](_0x261bca[_0x5d48('0x36')],qs[_0x5d48('0x38')](_0x184b28[_0x5d48('0x33')][_0x5d48('0x38')]));_0x256612[_0x5d48('0x37')]=_0x256612[_0x5d48('0x37')][_0x5d48('0x39')]?_0x256612['attributes']:_0x261bca[_0x5d48('0x36')];if(_0x184b28[_0x5d48('0x33')][_0x5d48('0x43')]){_0x256612[_0x5d48('0x48')]=[{'all':!![]}];}_0x256612=_[_0x5d48('0x3f')]({},_0x256612,_0x184b28['options']);return db[_0x5d48('0x42')][_0x5d48('0x49')](_0x256612)[_0x5d48('0x26')](handleEntityNotFound(_0x178a02,null))[_0x5d48('0x26')](respondWithResult(_0x178a02,null))[_0x5d48('0x45')](handleError(_0x178a02,null));};exports[_0x5d48('0x4a')]=function(_0x99d3ad,_0x2a8a8a){return db['ChatQueueReport'][_0x5d48('0x4a')](_0x99d3ad['body'],{})[_0x5d48('0x26')](respondWithResult(_0x2a8a8a,0xc9))[_0x5d48('0x45')](handleError(_0x2a8a8a,null));};exports[_0x5d48('0x25')]=function(_0x373c54,_0x4ed628){if(_0x373c54[_0x5d48('0x4b')]['id']){delete _0x373c54[_0x5d48('0x4b')]['id'];}return db[_0x5d48('0x42')]['find']({'where':{'id':_0x373c54[_0x5d48('0x47')]['id']}})[_0x5d48('0x26')](handleEntityNotFound(_0x4ed628,null))['then'](saveUpdates(_0x373c54[_0x5d48('0x4b')],null))['then'](respondWithResult(_0x4ed628,null))[_0x5d48('0x45')](handleError(_0x4ed628,null));};exports['destroy']=function(_0x2bd31c,_0x4c23fb){return db[_0x5d48('0x42')][_0x5d48('0x49')]({'where':{'id':_0x2bd31c[_0x5d48('0x47')]['id']}})[_0x5d48('0x26')](handleEntityNotFound(_0x4c23fb,null))[_0x5d48('0x26')](removeEntity(_0x4c23fb,null))[_0x5d48('0x45')](handleError(_0x4c23fb,null));};exports[_0x5d48('0x4c')]=function(_0x51bab5,_0x30cdf5){return db[_0x5d48('0x42')][_0x5d48('0x4c')]()['then'](respondWithResult(_0x30cdf5,null))[_0x5d48('0x45')](handleError(_0x30cdf5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7bfb36d..03ebafe 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 _0x23ad=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x104d03,_0x1e8e8b){var _0x4c54ed=function(_0x525de){while(--_0x525de){_0x104d03['push'](_0x104d03['shift']());}};_0x4c54ed(++_0x1e8e8b);}(_0x23ad,0x107));var _0xd23a=function(_0x23186f,_0x1af8e6){_0x23186f=_0x23186f-0x0;var _0x59cc05=_0x23ad[_0x23186f];return _0x59cc05;};'use strict';var _=require(_0xd23a('0x0'));var util=require(_0xd23a('0x1'));var logger=require(_0xd23a('0x2'))(_0xd23a('0x3'));var moment=require(_0xd23a('0x4'));var BPromise=require(_0xd23a('0x5'));var rp=require(_0xd23a('0x6'));var fs=require('fs');var path=require(_0xd23a('0x7'));var rimraf=require(_0xd23a('0x8'));var config=require(_0xd23a('0x9'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x1f7d01,_0x358865){return _0x1f7d01[_0xd23a('0xa')](_0xd23a('0xb'),attributes,{'tableName':_0xd23a('0xc'),'paranoid':![],'indexes':[{'name':_0xd23a('0xd'),'fields':[_0xd23a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc834=['./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1a7e2c,_0x4088aa){var _0x95e590=function(_0x39791){while(--_0x39791){_0x1a7e2c['push'](_0x1a7e2c['shift']());}};_0x95e590(++_0x4088aa);}(_0xc834,0x11d));var _0x4c83=function(_0x5523dd,_0x49e617){_0x5523dd=_0x5523dd-0x0;var _0x2ef814=_0xc834[_0x5523dd];return _0x2ef814;};'use strict';var _=require('lodash');var util=require(_0x4c83('0x0'));var logger=require(_0x4c83('0x1'))(_0x4c83('0x2'));var moment=require(_0x4c83('0x3'));var BPromise=require(_0x4c83('0x4'));var rp=require(_0x4c83('0x5'));var fs=require('fs');var path=require(_0x4c83('0x6'));var rimraf=require(_0x4c83('0x7'));var config=require(_0x4c83('0x8'));var attributes=require(_0x4c83('0x9'));module['exports']=function(_0x542dbf,_0xdb729f){return _0x542dbf[_0x4c83('0xa')](_0x4c83('0xb'),attributes,{'tableName':_0x4c83('0xc'),'paranoid':![],'indexes':[{'name':_0x4c83('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index dd787dd..5156828 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 _0xd64a=['ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','CreateChatQueueReport'];(function(_0x369cf2,_0x47e28c){var _0x5c7d3e=function(_0x4143d9){while(--_0x4143d9){_0x369cf2['push'](_0x369cf2['shift']());}};_0x5c7d3e(++_0x47e28c);}(_0xd64a,0x73));var _0xad64=function(_0x28b38e,_0x9785e2){_0x28b38e=_0x28b38e-0x0;var _0x51d789=_0xd64a[_0x28b38e];return _0x51d789;};'use strict';var _=require('lodash');var util=require(_0xad64('0x0'));var moment=require(_0xad64('0x1'));var BPromise=require(_0xad64('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad64('0x4'));var logger=require(_0xad64('0x5'))(_0xad64('0x6'));var config=require(_0xad64('0x7'));var jayson=require(_0xad64('0x8'));var client=jayson[_0xad64('0x9')][_0xad64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278d29,_0x4f51bc,_0x136aa8){return new BPromise(function(_0x3f14dc,_0x5ca80e){return client[_0xad64('0xb')](_0x278d29,_0x136aa8)[_0xad64('0xc')](function(_0x507b54){logger[_0xad64('0xd')](_0xad64('0xe'),_0x4f51bc,_0xad64('0xf'));logger[_0xad64('0x10')](_0xad64('0x11'),_0x4f51bc,_0xad64('0xf'),JSON[_0xad64('0x12')](_0x507b54));if(_0x507b54['error']){if(_0x507b54['error'][_0xad64('0x13')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4f51bc,_0x507b54['error'][_0xad64('0x14')]);return _0x5ca80e(_0x507b54['error'][_0xad64('0x14')]);}logger['error'](_0xad64('0xe'),_0x4f51bc,_0x507b54[_0xad64('0x15')]['message']);return _0x3f14dc(_0x507b54[_0xad64('0x15')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4f51bc,_0xad64('0xf'));_0x3f14dc(_0x507b54[_0xad64('0x16')]['message']);}})[_0xad64('0x17')](function(_0x3e1a66){logger[_0xad64('0x15')](_0xad64('0xe'),_0x4f51bc,_0x3e1a66);_0x5ca80e(_0x3e1a66);});});}exports[_0xad64('0x18')]=function(_0x1ec16d){var _0x5c834c=this;return new Promise(function(_0x425781,_0x1f67be){return db[_0xad64('0x19')][_0xad64('0x1a')](_0x1ec16d[_0xad64('0x1b')],{'raw':_0x1ec16d[_0xad64('0x1c')]?_0x1ec16d[_0xad64('0x1c')][_0xad64('0x1d')]===undefined?!![]:![]:!![]})[_0xad64('0xc')](function(_0x340809){logger['info'](_0xad64('0x18'),_0x1ec16d);logger[_0xad64('0x10')](_0xad64('0x18'),_0x1ec16d,JSON[_0xad64('0x12')](_0x340809));_0x425781(_0x340809);})['catch'](function(_0x5a9bb6){logger[_0xad64('0x15')](_0xad64('0x18'),_0x5a9bb6['message'],_0x1ec16d);_0x1f67be(_0x5c834c[_0xad64('0x15')](0x1f4,_0x5a9bb6[_0xad64('0x14')]));});});};exports[_0xad64('0x1e')]=function(_0x202be5){var _0xe348a=this;return new Promise(function(_0x588553,_0x9d3e0){return db['ChatQueueReport'][_0xad64('0x1f')](_0x202be5[_0xad64('0x1b')],{'raw':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x20')]||null:null,'attributes':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x21')]||null:null,'limit':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x22')]||null:null})[_0xad64('0xc')](function(_0x3ffa7b){logger['info']('UpdateChatQueueReport',_0x202be5);logger['debug'](_0xad64('0x1e'),_0x202be5,JSON[_0xad64('0x12')](_0x3ffa7b));_0x588553(_0x3ffa7b);})['catch'](function(_0x17b9b9){logger['error'](_0xad64('0x1e'),_0x17b9b9[_0xad64('0x14')],_0x202be5);_0x9d3e0(_0xe348a[_0xad64('0x15')](0x1f4,_0x17b9b9[_0xad64('0x14')]));});});}; \ No newline at end of file +var _0xc95f=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','body','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','limit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc95f,0x122));var _0xfc95=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0xc95f[_0x3b3210];return _0x5b5484;};'use strict';var _=require(_0xfc95('0x0'));var util=require('util');var moment=require(_0xfc95('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc95('0x2'));var fs=require('fs');var Redis=require(_0xfc95('0x3'));var db=require(_0xfc95('0x4'))['db'];var utils=require(_0xfc95('0x5'));var logger=require('../../config/logger')(_0xfc95('0x6'));var config=require(_0xfc95('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfc95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15c95b,_0x31e97a,_0x528e88){return new BPromise(function(_0x11a424,_0x2ee809){return client['request'](_0x15c95b,_0x528e88)[_0xfc95('0x9')](function(_0xee8511){logger[_0xfc95('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x31e97a,_0xfc95('0xb'));logger[_0xfc95('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x31e97a,_0xfc95('0xb'),JSON[_0xfc95('0xd')](_0xee8511));if(_0xee8511[_0xfc95('0xe')]){if(_0xee8511['error'][_0xfc95('0xf')]===0x1f4){logger['error'](_0xfc95('0x10'),_0x31e97a,_0xee8511['error'][_0xfc95('0x11')]);return _0x2ee809(_0xee8511[_0xfc95('0xe')][_0xfc95('0x11')]);}logger[_0xfc95('0xe')](_0xfc95('0x10'),_0x31e97a,_0xee8511[_0xfc95('0xe')][_0xfc95('0x11')]);return _0x11a424(_0xee8511['error']['message']);}else{logger[_0xfc95('0xa')](_0xfc95('0x10'),_0x31e97a,_0xfc95('0xb'));_0x11a424(_0xee8511[_0xfc95('0x12')][_0xfc95('0x11')]);}})[_0xfc95('0x13')](function(_0x129652){logger[_0xfc95('0xe')](_0xfc95('0x10'),_0x31e97a,_0x129652);_0x2ee809(_0x129652);});});}exports[_0xfc95('0x14')]=function(_0x46656f){var _0x1fd208=this;return new Promise(function(_0x24e02f,_0x25334c){return db['ChatQueueReport']['create'](_0x46656f[_0xfc95('0x15')],{'raw':_0x46656f[_0xfc95('0x16')]?_0x46656f['options'][_0xfc95('0x17')]===undefined?!![]:![]:!![]})[_0xfc95('0x9')](function(_0x1dc165){logger[_0xfc95('0xa')](_0xfc95('0x14'),_0x46656f);logger[_0xfc95('0xc')]('CreateChatQueueReport',_0x46656f,JSON[_0xfc95('0xd')](_0x1dc165));_0x24e02f(_0x1dc165);})[_0xfc95('0x13')](function(_0x152a6d){logger[_0xfc95('0xe')]('CreateChatQueueReport',_0x152a6d['message'],_0x46656f);_0x25334c(_0x1fd208[_0xfc95('0xe')](0x1f4,_0x152a6d['message']));});});};exports[_0xfc95('0x18')]=function(_0x2e42f6){var _0x12efe8=this;return new Promise(function(_0x13e3a6,_0x56f7aa){return db[_0xfc95('0x19')][_0xfc95('0x1a')](_0x2e42f6['body'],{'raw':_0x2e42f6[_0xfc95('0x16')]?_0x2e42f6['options'][_0xfc95('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e42f6[_0xfc95('0x16')]?_0x2e42f6[_0xfc95('0x16')][_0xfc95('0x1b')]||null:null,'attributes':_0x2e42f6[_0xfc95('0x16')]?_0x2e42f6[_0xfc95('0x16')]['attributes']||null:null,'limit':_0x2e42f6['options']?_0x2e42f6['options'][_0xfc95('0x1c')]||null:null})['then'](function(_0xcfdd67){logger[_0xfc95('0xa')](_0xfc95('0x18'),_0x2e42f6);logger[_0xfc95('0xc')](_0xfc95('0x18'),_0x2e42f6,JSON[_0xfc95('0xd')](_0xcfdd67));_0x13e3a6(_0xcfdd67);})[_0xfc95('0x13')](function(_0x172211){logger[_0xfc95('0xe')]('UpdateChatQueueReport',_0x172211['message'],_0x2e42f6);_0x56f7aa(_0x12efe8[_0xfc95('0xe')](0x1f4,_0x172211['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f3c0c71..b45bc98 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 _0x21b2=['index','/describe','isAuthenticated','/:id','post','create','delete','util','path','connect-timeout','../../components/auth/service','../../config/environment','get'];(function(_0x4d98b8,_0x539839){var _0x5e271b=function(_0x280ac6){while(--_0x280ac6){_0x4d98b8['push'](_0x4d98b8['shift']());}};_0x5e271b(++_0x539839);}(_0x21b2,0x118));var _0x221b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x21b2[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require(_0x221b('0x0'));var path=require(_0x221b('0x1'));var timeout=require(_0x221b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x221b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x221b('0x4'));var controller=require('./chatQueueReport.controller');router[_0x221b('0x5')]('/',auth['isAuthenticated'](),controller[_0x221b('0x6')]);router[_0x221b('0x5')](_0x221b('0x7'),auth[_0x221b('0x8')](),controller['describe']);router[_0x221b('0x5')](_0x221b('0x9'),auth[_0x221b('0x8')](),controller['show']);router[_0x221b('0xa')]('/',auth[_0x221b('0x8')](),controller[_0x221b('0xb')]);router['put'](_0x221b('0x9'),auth[_0x221b('0x8')](),controller['update']);router[_0x221b('0xc')]('/:id',auth[_0x221b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x953c=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatQueueReport.controller','index','/describe','get','/:id','isAuthenticated','show','post','put','update'];(function(_0x1e1c0a,_0x51891b){var _0x22c353=function(_0x577563){while(--_0x577563){_0x1e1c0a['push'](_0x1e1c0a['shift']());}};_0x22c353(++_0x51891b);}(_0x953c,0xcb));var _0xc953=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x953c[_0x102881];return _0x5c63d0;};'use strict';var multer=require(_0xc953('0x0'));var util=require(_0xc953('0x1'));var path=require(_0xc953('0x2'));var timeout=require(_0xc953('0x3'));var express=require(_0xc953('0x4'));var router=express[_0xc953('0x5')]();var auth=require(_0xc953('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc953('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc953('0x8')]);router['get'](_0xc953('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xc953('0xa')](_0xc953('0xb'),auth[_0xc953('0xc')](),controller[_0xc953('0xd')]);router[_0xc953('0xe')]('/',auth[_0xc953('0xc')](),controller['create']);router[_0xc953('0xf')]('/:id',auth[_0xc953('0xc')](),controller[_0xc953('0x10')]);router[_0xc953('0x11')](_0xc953('0xb'),auth[_0xc953('0xc')](),controller[_0xc953('0x12')]);module[_0xc953('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 72ce72a..70b6254 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 _0xecb6=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x186430,_0x2fcba3){var _0x45c82f=function(_0x2fe22b){while(--_0x2fe22b){_0x186430['push'](_0x186430['shift']());}};_0x45c82f(++_0x2fcba3);}(_0xecb6,0x1c7));var _0x6ecb=function(_0x10055a,_0x50b6fb){_0x10055a=_0x10055a-0x0;var _0x52f8f9=_0xecb6[_0x10055a];return _0x52f8f9;};'use strict';var moment=require(_0x6ecb('0x0'));var Sequelize=require(_0x6ecb('0x1'));module[_0x6ecb('0x2')]={'uniqueid':{'type':Sequelize[_0x6ecb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6ecb('0x4')]('account',_0x6ecb('0x5'),_0x6ecb('0x6')),'allowNull':![],'defaultValue':_0x6ecb('0x6')},'transferredAt':{'type':Sequelize[_0x6ecb('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6ecb('0x8')]}}; \ No newline at end of file +var _0x62c0=['DATE','sequelize','STRING','ENUM','account','agent','queue'];(function(_0xb4a73b,_0xc97490){var _0x55a4a9=function(_0x228fe1){while(--_0x228fe1){_0xb4a73b['push'](_0xb4a73b['shift']());}};_0x55a4a9(++_0xc97490);}(_0x62c0,0xb7));var _0x062c=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x62c0[_0x44d9ab];return _0x31485e;};'use strict';var moment=require('moment');var Sequelize=require(_0x062c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x062c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x062c('0x2')](_0x062c('0x3'),_0x062c('0x4'),_0x062c('0x5')),'allowNull':![],'defaultValue':_0x062c('0x5')},'transferredAt':{'type':Sequelize[_0x062c('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 28b85f4..c9048bf 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 _0x5680=['VIRTUAL','merge','where','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','type'];(function(_0xbaf699,_0x4aa945){var _0x55a131=function(_0x219dd7){while(--_0x219dd7){_0xbaf699['push'](_0xbaf699['shift']());}};_0x55a131(++_0x4aa945);}(_0x5680,0x1b1));var _0x0568=function(_0x410ba5,_0x2071cd){_0x410ba5=_0x410ba5-0x0;var _0x40014e=_0x5680[_0x410ba5];return _0x40014e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0568('0x0'));var rimraf=require(_0x0568('0x1'));var zipdir=require(_0x0568('0x2'));var jsonpatch=require(_0x0568('0x3'));var rp=require(_0x0568('0x4'));var moment=require(_0x0568('0x5'));var BPromise=require(_0x0568('0x6'));var Mustache=require('mustache');var util=require(_0x0568('0x7'));var path=require(_0x0568('0x8'));var sox=require('sox');var csv=require(_0x0568('0x9'));var ejs=require(_0x0568('0xa'));var fs=require('fs');var _=require(_0x0568('0xb'));var squel=require(_0x0568('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0568('0x9'));var querystring=require(_0x0568('0xd'));var Papa=require(_0x0568('0xe'));var Redis=require('ioredis');var authService=require(_0x0568('0xf'));var qs=require(_0x0568('0x10'));var as=require(_0x0568('0x11'));var hardwareService=require(_0x0568('0x12'));var logger=require(_0x0568('0x13'))(_0x0568('0x14'));var utils=require(_0x0568('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0568('0x16'))['db'];function respondWithStatusCode(_0x31601b,_0x357f6b){_0x357f6b=_0x357f6b||0xcc;return function(_0xbd4799){if(_0xbd4799){return _0x31601b[_0x0568('0x17')](_0x357f6b);}return _0x31601b[_0x0568('0x18')](_0x357f6b)['end']();};}function respondWithResult(_0x619fe1,_0x2a54af){_0x2a54af=_0x2a54af||0xc8;return function(_0x2fe67a){if(_0x2fe67a){return _0x619fe1[_0x0568('0x18')](_0x2a54af)[_0x0568('0x19')](_0x2fe67a);}};}function respondWithFilteredResult(_0x16c5a0,_0x53bab8){return function(_0x1f95ff){if(_0x1f95ff){var _0x9668c7=_0x1f95ff[_0x0568('0x1a')],_0x5c38dd=_0x53bab8[_0x0568('0x1b')],_0x5c4533=_0x53bab8[_0x0568('0x1b')]+_0x53bab8[_0x0568('0x1c')],_0x3461fd;if(_0x5c4533>=_0x9668c7){_0x5c4533=_0x9668c7;_0x3461fd=0xc8;}else{_0x3461fd=0xce;}_0x16c5a0[_0x0568('0x18')](_0x3461fd);return _0x16c5a0['set']('Content-Range',_0x5c38dd+'-'+_0x5c4533+'/'+_0x9668c7)[_0x0568('0x19')](_0x1f95ff);}return null;};}function patchUpdates(_0x3bad56){return function(_0x287a9a){try{jsonpatch[_0x0568('0x1d')](_0x287a9a,_0x3bad56,!![]);}catch(_0x166187){return BPromise[_0x0568('0x1e')](_0x166187);}return _0x287a9a[_0x0568('0x1f')]();};}function saveUpdates(_0x192cb3,_0x43b328){return function(_0x3fd3c9){if(_0x3fd3c9){return _0x3fd3c9[_0x0568('0x20')](_0x192cb3)[_0x0568('0x21')](function(_0x14e72e){return _0x14e72e;});}return null;};}function removeEntity(_0xeeb662,_0x418787){return function(_0x4c6cd8){if(_0x4c6cd8){return _0x4c6cd8[_0x0568('0x22')]()[_0x0568('0x21')](function(){_0xeeb662['status'](0xcc)[_0x0568('0x23')]();});}};}function handleEntityNotFound(_0x201ba0,_0x101872){return function(_0x27be8c){if(!_0x27be8c){_0x201ba0['sendStatus'](0x194);}return _0x27be8c;};}function handleError(_0x1afd3b,_0x4decd1){_0x4decd1=_0x4decd1||0x1f4;return function(_0x11ae7e){logger['error'](_0x11ae7e[_0x0568('0x24')]);if(_0x11ae7e[_0x0568('0x25')]){delete _0x11ae7e[_0x0568('0x25')];}_0x1afd3b[_0x0568('0x18')](_0x4decd1)[_0x0568('0x26')](_0x11ae7e);};}exports[_0x0568('0x27')]=function(_0x4dc7ae,_0xed0b3e){var _0x1d8af9={},_0x5d721d={},_0x464654={'count':0x0,'rows':[]};var _0x43ebc0=_[_0x0568('0x28')](db[_0x0568('0x29')][_0x0568('0x2a')],function(_0x53c2a7){return{'name':_0x53c2a7[_0x0568('0x2b')],'type':_0x53c2a7['type']['key']};});_0x5d721d['model']=_[_0x0568('0x28')](_0x43ebc0,_0x0568('0x25'));_0x5d721d[_0x0568('0x2c')]=_[_0x0568('0x2d')](_0x4dc7ae[_0x0568('0x2c')]);_0x5d721d[_0x0568('0x2e')]=_[_0x0568('0x2f')](_0x5d721d[_0x0568('0x30')],_0x5d721d[_0x0568('0x2c')]);_0x1d8af9[_0x0568('0x31')]=_[_0x0568('0x2f')](_0x5d721d[_0x0568('0x30')],qs[_0x0568('0x32')](_0x4dc7ae['query'][_0x0568('0x32')]));_0x1d8af9[_0x0568('0x31')]=_0x1d8af9['attributes'][_0x0568('0x33')]?_0x1d8af9[_0x0568('0x31')]:_0x5d721d[_0x0568('0x30')];if(!_0x4dc7ae['query'][_0x0568('0x34')](_0x0568('0x35'))){_0x1d8af9[_0x0568('0x1c')]=qs[_0x0568('0x1c')](_0x4dc7ae[_0x0568('0x2c')][_0x0568('0x1c')]);_0x1d8af9[_0x0568('0x1b')]=qs['offset'](_0x4dc7ae['query'][_0x0568('0x1b')]);}_0x1d8af9['order']=qs['sort'](_0x4dc7ae[_0x0568('0x2c')]['sort']);_0x1d8af9['where']=qs[_0x0568('0x2e')](_[_0x0568('0x36')](_0x4dc7ae['query'],_0x5d721d['filters']),_0x43ebc0);if(_0x4dc7ae['query'][_0x0568('0x37')]){_0x1d8af9['where']=_['merge'](_0x1d8af9['where'],{'$or':_[_0x0568('0x28')](_0x43ebc0,function(_0x30b2ef){if(_0x30b2ef[_0x0568('0x38')]!==_0x0568('0x39')){var _0x5387e0={};_0x5387e0[_0x30b2ef[_0x0568('0x25')]]={'$like':'%'+_0x4dc7ae['query'][_0x0568('0x37')]+'%'};return _0x5387e0;}})});}_0x1d8af9=_[_0x0568('0x3a')]({},_0x1d8af9,_0x4dc7ae['options']);var _0x459784={'where':_0x1d8af9[_0x0568('0x3b')]};return db[_0x0568('0x29')][_0x0568('0x1a')](_0x459784)[_0x0568('0x21')](function(_0x3d80cc){_0x464654[_0x0568('0x1a')]=_0x3d80cc;if(_0x4dc7ae['query'][_0x0568('0x3c')]){_0x1d8af9['include']=[{'all':!![]}];}return db[_0x0568('0x29')]['findAll'](_0x1d8af9);})[_0x0568('0x21')](function(_0x24dd3c){_0x464654[_0x0568('0x3d')]=_0x24dd3c;return _0x464654;})[_0x0568('0x21')](respondWithFilteredResult(_0xed0b3e,_0x1d8af9))[_0x0568('0x3e')](handleError(_0xed0b3e,null));};exports[_0x0568('0x3f')]=function(_0xe601ae,_0x4314bc){var _0x23c8d9={'raw':!![],'where':{'id':_0xe601ae[_0x0568('0x40')]['id']}},_0x245616={};_0x245616[_0x0568('0x30')]=_['keys'](db[_0x0568('0x29')]['rawAttributes']);_0x245616[_0x0568('0x2c')]=_['keys'](_0xe601ae[_0x0568('0x2c')]);_0x245616['filters']=_[_0x0568('0x2f')](_0x245616['model'],_0x245616[_0x0568('0x2c')]);_0x23c8d9[_0x0568('0x31')]=_[_0x0568('0x2f')](_0x245616[_0x0568('0x30')],qs['fields'](_0xe601ae[_0x0568('0x2c')][_0x0568('0x32')]));_0x23c8d9['attributes']=_0x23c8d9[_0x0568('0x31')][_0x0568('0x33')]?_0x23c8d9[_0x0568('0x31')]:_0x245616[_0x0568('0x30')];if(_0xe601ae[_0x0568('0x2c')][_0x0568('0x3c')]){_0x23c8d9[_0x0568('0x41')]=[{'all':!![]}];}_0x23c8d9=_[_0x0568('0x3a')]({},_0x23c8d9,_0xe601ae['options']);return db[_0x0568('0x29')][_0x0568('0x42')](_0x23c8d9)[_0x0568('0x21')](handleEntityNotFound(_0x4314bc,null))['then'](respondWithResult(_0x4314bc,null))[_0x0568('0x3e')](handleError(_0x4314bc,null));};exports[_0x0568('0x43')]=function(_0x3e01d9,_0xa86ce1){return db['ChatTransferReport'][_0x0568('0x43')](_0x3e01d9[_0x0568('0x44')],{})['then'](respondWithResult(_0xa86ce1,0xc9))['catch'](handleError(_0xa86ce1,null));};exports['update']=function(_0x2a76c9,_0xecb8cd){if(_0x2a76c9[_0x0568('0x44')]['id']){delete _0x2a76c9[_0x0568('0x44')]['id'];}return db[_0x0568('0x29')][_0x0568('0x42')]({'where':{'id':_0x2a76c9[_0x0568('0x40')]['id']}})['then'](handleEntityNotFound(_0xecb8cd,null))[_0x0568('0x21')](saveUpdates(_0x2a76c9[_0x0568('0x44')],null))[_0x0568('0x21')](respondWithResult(_0xecb8cd,null))[_0x0568('0x3e')](handleError(_0xecb8cd,null));};exports[_0x0568('0x22')]=function(_0x3aee3e,_0x23f125){return db[_0x0568('0x29')][_0x0568('0x42')]({'where':{'id':_0x3aee3e[_0x0568('0x40')]['id']}})[_0x0568('0x21')](handleEntityNotFound(_0x23f125,null))['then'](removeEntity(_0x23f125,null))[_0x0568('0x3e')](handleError(_0x23f125,null));};exports[_0x0568('0x45')]=function(_0x267f91,_0x46e97b){return db[_0x0568('0x29')][_0x0568('0x45')]()[_0x0568('0x21')](respondWithResult(_0x46e97b,null))[_0x0568('0x3e')](handleError(_0x46e97b,null));}; \ No newline at end of file +var _0x4348=['rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','html-pdf','eml-format'];(function(_0x1f0677,_0x443bab){var _0xb33478=function(_0x4695e4){while(--_0x4695e4){_0x1f0677['push'](_0x1f0677['shift']());}};_0xb33478(++_0x443bab);}(_0x4348,0xa0));var _0x8434=function(_0x2bda68,_0x21c2e4){_0x2bda68=_0x2bda68-0x0;var _0x22588c=_0x4348[_0x2bda68];return _0x22588c;};'use strict';var pdf=require(_0x8434('0x0'));var emlformat=require(_0x8434('0x1'));var rimraf=require(_0x8434('0x2'));var zipdir=require(_0x8434('0x3'));var jsonpatch=require(_0x8434('0x4'));var rp=require(_0x8434('0x5'));var moment=require(_0x8434('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8434('0x7'));var util=require(_0x8434('0x8'));var path=require(_0x8434('0x9'));var sox=require(_0x8434('0xa'));var csv=require(_0x8434('0xb'));var ejs=require(_0x8434('0xc'));var fs=require('fs');var _=require(_0x8434('0xd'));var squel=require(_0x8434('0xe'));var crypto=require(_0x8434('0xf'));var jsforce=require(_0x8434('0x10'));var deskjs=require(_0x8434('0x11'));var toCsv=require(_0x8434('0xb'));var querystring=require(_0x8434('0x12'));var Papa=require(_0x8434('0x13'));var Redis=require(_0x8434('0x14'));var authService=require(_0x8434('0x15'));var qs=require(_0x8434('0x16'));var as=require(_0x8434('0x17'));var hardwareService=require(_0x8434('0x18'));var logger=require(_0x8434('0x19'))(_0x8434('0x1a'));var utils=require(_0x8434('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x8434('0x1c'));var db=require(_0x8434('0x1d'))['db'];function respondWithStatusCode(_0x352baa,_0x1998f4){_0x1998f4=_0x1998f4||0xcc;return function(_0x1a86d9){if(_0x1a86d9){return _0x352baa[_0x8434('0x1e')](_0x1998f4);}return _0x352baa[_0x8434('0x1f')](_0x1998f4)['end']();};}function respondWithResult(_0x5762f6,_0x41e484){_0x41e484=_0x41e484||0xc8;return function(_0x46891c){if(_0x46891c){return _0x5762f6[_0x8434('0x1f')](_0x41e484)[_0x8434('0x20')](_0x46891c);}};}function respondWithFilteredResult(_0x1ea12e,_0x1b8fec){return function(_0x58acaf){if(_0x58acaf){var _0x28c7c4=_0x58acaf[_0x8434('0x21')],_0x535e49=_0x1b8fec[_0x8434('0x22')],_0x76a711=_0x1b8fec[_0x8434('0x22')]+_0x1b8fec[_0x8434('0x23')],_0x3cf846;if(_0x76a711>=_0x28c7c4){_0x76a711=_0x28c7c4;_0x3cf846=0xc8;}else{_0x3cf846=0xce;}_0x1ea12e[_0x8434('0x1f')](_0x3cf846);return _0x1ea12e[_0x8434('0x24')](_0x8434('0x25'),_0x535e49+'-'+_0x76a711+'/'+_0x28c7c4)[_0x8434('0x20')](_0x58acaf);}return null;};}function patchUpdates(_0x2a504f){return function(_0x2efdda){try{jsonpatch['apply'](_0x2efdda,_0x2a504f,!![]);}catch(_0x22d7aa){return BPromise[_0x8434('0x26')](_0x22d7aa);}return _0x2efdda['save']();};}function saveUpdates(_0x4f3e8e,_0x593e15){return function(_0x6b729e){if(_0x6b729e){return _0x6b729e[_0x8434('0x27')](_0x4f3e8e)[_0x8434('0x28')](function(_0x2afc28){return _0x2afc28;});}return null;};}function removeEntity(_0x4f56b2,_0x1e7663){return function(_0x423421){if(_0x423421){return _0x423421[_0x8434('0x29')]()[_0x8434('0x28')](function(){_0x4f56b2[_0x8434('0x1f')](0xcc)[_0x8434('0x2a')]();});}};}function handleEntityNotFound(_0x2c7200,_0x32ef8f){return function(_0xdad253){if(!_0xdad253){_0x2c7200['sendStatus'](0x194);}return _0xdad253;};}function handleError(_0x5cfc2a,_0x6a6875){_0x6a6875=_0x6a6875||0x1f4;return function(_0x2cb11e){logger[_0x8434('0x2b')](_0x2cb11e[_0x8434('0x2c')]);if(_0x2cb11e[_0x8434('0x2d')]){delete _0x2cb11e[_0x8434('0x2d')];}_0x5cfc2a[_0x8434('0x1f')](_0x6a6875)[_0x8434('0x2e')](_0x2cb11e);};}exports[_0x8434('0x2f')]=function(_0x2120c5,_0x4ac4bd){var _0x208ae2={},_0x4b6beb={},_0x695c45={'count':0x0,'rows':[]};var _0x2abb79=_[_0x8434('0x30')](db[_0x8434('0x31')][_0x8434('0x32')],function(_0x498140){return{'name':_0x498140[_0x8434('0x33')],'type':_0x498140[_0x8434('0x34')][_0x8434('0x35')]};});_0x4b6beb[_0x8434('0x36')]=_[_0x8434('0x30')](_0x2abb79,'name');_0x4b6beb['query']=_['keys'](_0x2120c5[_0x8434('0x37')]);_0x4b6beb[_0x8434('0x38')]=_['intersection'](_0x4b6beb[_0x8434('0x36')],_0x4b6beb['query']);_0x208ae2[_0x8434('0x39')]=_[_0x8434('0x3a')](_0x4b6beb[_0x8434('0x36')],qs[_0x8434('0x3b')](_0x2120c5[_0x8434('0x37')][_0x8434('0x3b')]));_0x208ae2[_0x8434('0x39')]=_0x208ae2[_0x8434('0x39')][_0x8434('0x3c')]?_0x208ae2[_0x8434('0x39')]:_0x4b6beb['model'];if(!_0x2120c5['query']['hasOwnProperty'](_0x8434('0x3d'))){_0x208ae2[_0x8434('0x23')]=qs[_0x8434('0x23')](_0x2120c5['query']['limit']);_0x208ae2[_0x8434('0x22')]=qs['offset'](_0x2120c5[_0x8434('0x37')]['offset']);}_0x208ae2['order']=qs[_0x8434('0x3e')](_0x2120c5[_0x8434('0x37')]['sort']);_0x208ae2[_0x8434('0x3f')]=qs[_0x8434('0x38')](_[_0x8434('0x40')](_0x2120c5[_0x8434('0x37')],_0x4b6beb['filters']),_0x2abb79);if(_0x2120c5[_0x8434('0x37')][_0x8434('0x41')]){_0x208ae2[_0x8434('0x3f')]=_[_0x8434('0x42')](_0x208ae2[_0x8434('0x3f')],{'$or':_[_0x8434('0x30')](_0x2abb79,function(_0x12a852){if(_0x12a852[_0x8434('0x34')]!==_0x8434('0x43')){var _0x4d1359={};_0x4d1359[_0x12a852[_0x8434('0x2d')]]={'$like':'%'+_0x2120c5['query']['filter']+'%'};return _0x4d1359;}})});}_0x208ae2=_['merge']({},_0x208ae2,_0x2120c5['options']);var _0x3cd5af={'where':_0x208ae2[_0x8434('0x3f')]};return db[_0x8434('0x31')][_0x8434('0x21')](_0x3cd5af)[_0x8434('0x28')](function(_0xe1670b){_0x695c45[_0x8434('0x21')]=_0xe1670b;if(_0x2120c5[_0x8434('0x37')][_0x8434('0x44')]){_0x208ae2[_0x8434('0x45')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x8434('0x46')](_0x208ae2);})['then'](function(_0x38d082){_0x695c45[_0x8434('0x47')]=_0x38d082;return _0x695c45;})[_0x8434('0x28')](respondWithFilteredResult(_0x4ac4bd,_0x208ae2))[_0x8434('0x48')](handleError(_0x4ac4bd,null));};exports[_0x8434('0x49')]=function(_0x11b2bf,_0x38f67a){var _0x1b8485={'raw':!![],'where':{'id':_0x11b2bf[_0x8434('0x4a')]['id']}},_0x4fa33f={};_0x4fa33f['model']=_['keys'](db[_0x8434('0x31')][_0x8434('0x32')]);_0x4fa33f[_0x8434('0x37')]=_[_0x8434('0x4b')](_0x11b2bf[_0x8434('0x37')]);_0x4fa33f[_0x8434('0x38')]=_[_0x8434('0x3a')](_0x4fa33f['model'],_0x4fa33f[_0x8434('0x37')]);_0x1b8485[_0x8434('0x39')]=_[_0x8434('0x3a')](_0x4fa33f['model'],qs[_0x8434('0x3b')](_0x11b2bf[_0x8434('0x37')][_0x8434('0x3b')]));_0x1b8485['attributes']=_0x1b8485[_0x8434('0x39')][_0x8434('0x3c')]?_0x1b8485[_0x8434('0x39')]:_0x4fa33f[_0x8434('0x36')];if(_0x11b2bf[_0x8434('0x37')][_0x8434('0x44')]){_0x1b8485[_0x8434('0x45')]=[{'all':!![]}];}_0x1b8485=_[_0x8434('0x42')]({},_0x1b8485,_0x11b2bf[_0x8434('0x4c')]);return db[_0x8434('0x31')][_0x8434('0x4d')](_0x1b8485)[_0x8434('0x28')](handleEntityNotFound(_0x38f67a,null))[_0x8434('0x28')](respondWithResult(_0x38f67a,null))[_0x8434('0x48')](handleError(_0x38f67a,null));};exports[_0x8434('0x4e')]=function(_0x36f1f7,_0x4731cb){return db[_0x8434('0x31')]['create'](_0x36f1f7[_0x8434('0x4f')],{})[_0x8434('0x28')](respondWithResult(_0x4731cb,0xc9))[_0x8434('0x48')](handleError(_0x4731cb,null));};exports[_0x8434('0x27')]=function(_0x3e8d40,_0x59182a){if(_0x3e8d40[_0x8434('0x4f')]['id']){delete _0x3e8d40[_0x8434('0x4f')]['id'];}return db[_0x8434('0x31')][_0x8434('0x4d')]({'where':{'id':_0x3e8d40[_0x8434('0x4a')]['id']}})[_0x8434('0x28')](handleEntityNotFound(_0x59182a,null))[_0x8434('0x28')](saveUpdates(_0x3e8d40[_0x8434('0x4f')],null))[_0x8434('0x28')](respondWithResult(_0x59182a,null))[_0x8434('0x48')](handleError(_0x59182a,null));};exports['destroy']=function(_0x1db200,_0x24cbe4){return db[_0x8434('0x31')][_0x8434('0x4d')]({'where':{'id':_0x1db200[_0x8434('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24cbe4,null))['then'](removeEntity(_0x24cbe4,null))[_0x8434('0x48')](handleError(_0x24cbe4,null));};exports[_0x8434('0x50')]=function(_0x209a41,_0x35620c){return db[_0x8434('0x31')]['describe']()[_0x8434('0x28')](respondWithResult(_0x35620c,null))[_0x8434('0x48')](handleError(_0x35620c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3f55449..bfd6a85 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 _0x2f42=['lodash','util','../../config/logger','moment','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x3e63c6,_0x2c3160){var _0x5216af=function(_0x344563){while(--_0x344563){_0x3e63c6['push'](_0x3e63c6['shift']());}};_0x5216af(++_0x2c3160);}(_0x2f42,0x90));var _0x22f4=function(_0x38e8d,_0x5d8b4d){_0x38e8d=_0x38e8d-0x0;var _0x1b9238=_0x2f42[_0x38e8d];return _0x1b9238;};'use strict';var _=require(_0x22f4('0x0'));var util=require(_0x22f4('0x1'));var logger=require(_0x22f4('0x2'))('api');var moment=require(_0x22f4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22f4('0x4'));var rimraf=require('rimraf');var config=require(_0x22f4('0x5'));var attributes=require(_0x22f4('0x6'));module[_0x22f4('0x7')]=function(_0x386042,_0x1a9596){return _0x386042[_0x22f4('0x8')](_0x22f4('0x9'),attributes,{'tableName':_0x22f4('0xa'),'paranoid':![],'indexes':[{'name':_0x22f4('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0105=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','request-promise','path'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x0105,0x1dc));var _0x5010=function(_0x391299,_0x1a8ea4){_0x391299=_0x391299-0x0;var _0x13353e=_0x0105[_0x391299];return _0x13353e;};'use strict';var _=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var logger=require('../../config/logger')(_0x5010('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5010('0x3'));var fs=require('fs');var path=require(_0x5010('0x4'));var rimraf=require(_0x5010('0x5'));var config=require(_0x5010('0x6'));var attributes=require(_0x5010('0x7'));module[_0x5010('0x8')]=function(_0x565f9b,_0x2d0500){return _0x565f9b[_0x5010('0x9')](_0x5010('0xa'),attributes,{'tableName':_0x5010('0xb'),'paranoid':![],'indexes':[{'name':_0x5010('0xc'),'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 29d6491..c131ae4 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 _0x6604=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','request\x20sent','debug'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x6604,0x1ab));var _0x4660=function(_0x1a2400,_0x3d2bef){_0x1a2400=_0x1a2400-0x0;var _0x25b24d=_0x6604[_0x1a2400];return _0x25b24d;};'use strict';var _=require(_0x4660('0x0'));var util=require(_0x4660('0x1'));var moment=require(_0x4660('0x2'));var BPromise=require(_0x4660('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4660('0x4'));var db=require(_0x4660('0x5'))['db'];var utils=require(_0x4660('0x6'));var logger=require(_0x4660('0x7'))(_0x4660('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4660('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dad1f,_0xdda522,_0x3f2c1b){return new BPromise(function(_0xef10af,_0x5022c8){return client['request'](_0x5dad1f,_0x3f2c1b)[_0x4660('0xa')](function(_0x266abf){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xdda522,_0x4660('0xb'));logger[_0x4660('0xc')](_0x4660('0xd'),_0xdda522,_0x4660('0xb'),JSON[_0x4660('0xe')](_0x266abf));if(_0x266abf[_0x4660('0xf')]){if(_0x266abf[_0x4660('0xf')]['code']===0x1f4){logger[_0x4660('0xf')](_0x4660('0x10'),_0xdda522,_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);return _0x5022c8(_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);}logger['error'](_0x4660('0x10'),_0xdda522,_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);return _0xef10af(_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);}else{logger[_0x4660('0x12')](_0x4660('0x10'),_0xdda522,'request\x20sent');_0xef10af(_0x266abf[_0x4660('0x13')][_0x4660('0x11')]);}})['catch'](function(_0x4f1378){logger['error'](_0x4660('0x10'),_0xdda522,_0x4f1378);_0x5022c8(_0x4f1378);});});} \ No newline at end of file +var _0xf26d=['error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4e4544,_0x23ca79){var _0x36da71=function(_0x19ee78){while(--_0x19ee78){_0x4e4544['push'](_0x4e4544['shift']());}};_0x36da71(++_0x23ca79);}(_0xf26d,0x1cf));var _0xdf26=function(_0x40efc8,_0x2b196b){_0x40efc8=_0x40efc8-0x0;var _0x21f631=_0xf26d[_0x40efc8];return _0x21f631;};'use strict';var _=require(_0xdf26('0x0'));var util=require(_0xdf26('0x1'));var moment=require('moment');var BPromise=require(_0xdf26('0x2'));var rs=require(_0xdf26('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf26('0x4'))['db'];var utils=require(_0xdf26('0x5'));var logger=require(_0xdf26('0x6'))(_0xdf26('0x7'));var config=require(_0xdf26('0x8'));var jayson=require(_0xdf26('0x9'));var client=jayson[_0xdf26('0xa')][_0xdf26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad4ad,_0x2595c3,_0x22ba09){return new BPromise(function(_0xb731b5,_0x2580f0){return client[_0xdf26('0xc')](_0x5ad4ad,_0x22ba09)[_0xdf26('0xd')](function(_0x2b40ae){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x2595c3,_0xdf26('0xe'));logger[_0xdf26('0xf')](_0xdf26('0x10'),_0x2595c3,'request\x20sent',JSON['stringify'](_0x2b40ae));if(_0x2b40ae[_0xdf26('0x11')]){if(_0x2b40ae[_0xdf26('0x11')][_0xdf26('0x12')]===0x1f4){logger[_0xdf26('0x11')](_0xdf26('0x13'),_0x2595c3,_0x2b40ae[_0xdf26('0x11')][_0xdf26('0x14')]);return _0x2580f0(_0x2b40ae['error']['message']);}logger['error'](_0xdf26('0x13'),_0x2595c3,_0x2b40ae[_0xdf26('0x11')][_0xdf26('0x14')]);return _0xb731b5(_0x2b40ae[_0xdf26('0x11')]['message']);}else{logger[_0xdf26('0x15')](_0xdf26('0x13'),_0x2595c3,'request\x20sent');_0xb731b5(_0x2b40ae[_0xdf26('0x16')]['message']);}})[_0xdf26('0x17')](function(_0x2ec349){logger[_0xdf26('0x11')](_0xdf26('0x13'),_0x2595c3,_0x2ec349);_0x2580f0(_0x2ec349);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 99739a6..f9306a5 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x2312cc,_0x23ff63){var _0x3f8064=function(_0x31a9ef){while(--_0x31a9ef){_0x2312cc['push'](_0x2312cc['shift']());}};_0x3f8064(++_0x23ff63);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x0b0e[_0x2ab3d9];return _0x210a54;};'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 auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index ab58c33..ab4d9a7 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 _0x8a8b=['TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','input','name','text','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','parse','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','INTEGER','Powered\x20by\x20xCALLY'];(function(_0x4e73f1,_0x45f380){var _0xafc80d=function(_0x1444c2){while(--_0x1444c2){_0x4e73f1['push'](_0x4e73f1['shift']());}};_0xafc80d(++_0x45f380);}(_0x8a8b,0xae));var _0xb8a8=function(_0x241669,_0x588cfc){_0x241669=_0x241669-0x0;var _0x14f2ba=_0x8a8b[_0x241669];return _0x14f2ba;};'use strict';var Sequelize=require(_0xb8a8('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xb8a8('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xb8a8('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xb8a8('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb8a8('0x2')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb8a8('0x2')},'key':{'type':Sequelize[_0xb8a8('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb8a8('0x3'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb8a8('0x3'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb8a8('0x1')],'allowNull':![],'defaultValue':_0xb8a8('0x4'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb8a8('0x1')]},'animation':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb8a8('0x6')](_0xb8a8('0x7'),_0xb8a8('0x8')),'defaultValue':_0xb8a8('0x7')},'header_online':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x9')},'start_chat_button':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0xa')},'offline_chat_button':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0xb')},'header_offline':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb8a8('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb8a8('0xe')]},'closingQuestion':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x11')},'closingMessage':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x12')},'closingMessageButton':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0xb')},'skipMessageButton':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xb8a8('0x6')](_0xb8a8('0x14'),_0xb8a8('0x15')),'defaultValue':_0xb8a8('0x14')},'ratingStarsNumber':{'type':Sequelize[_0xb8a8('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb8a8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb8a8('0x16'),'variable':null,'config':{'placeholder':_0xb8a8('0x17'),'type':_0xb8a8('0x18'),'required':!![]},'props':{'title':_0xb8a8('0x17'),'helpText':''}},{'type':'input','props':{'title':_0xb8a8('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb8a8('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xb8a8('0x19'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x5dadd6){return this[_0xb8a8('0x1a')](_0xb8a8('0x19'),JSON[_0xb8a8('0x1b')](_0x5dadd6));}},'offlineForm':{'type':Sequelize[_0xb8a8('0xe')],'defaultValue':function(){return JSON[_0xb8a8('0x1b')]({'items':[{'type':'input','props':{'title':_0xb8a8('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xb8a8('0x2'),'type':_0xb8a8('0x2')},'variable':null},{'type':_0xb8a8('0x1c'),'config':{'placeholder':_0xb8a8('0x1d')},'props':{'title':'Comments','helpText':_0xb8a8('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xb8a8('0x1f')](_0xb8a8('0x20'))?JSON[_0xb8a8('0x21')](this[_0xb8a8('0x1f')]('offlineForm')):{};},'set':function(_0x4aec01){return this[_0xb8a8('0x1a')](_0xb8a8('0x20'),JSON[_0xb8a8('0x1b')](_0x4aec01));}},'token':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':function(){return rs[_0xb8a8('0x22')]();}},'autoclose':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb8a8('0x1')]},'forwardOffline':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb8a8('0x23')},'waitingMessage':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x25')},'skipUnmanaged':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb8a8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb8a8('0xe')],'defaultValue':function(){return _0xb8a8('0x26');}},'notificationSound':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x27')},'verticalAlignment':{'type':Sequelize[_0xb8a8('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x28')},'defaultTitle':{'type':Sequelize[_0xb8a8('0x1')]},'customerAvatar':{'type':Sequelize[_0xb8a8('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb8a8('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb8a8('0x1')],'allowNull':![],'defaultValue':_0xb8a8('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8a8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb8a8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':_0xb8a8('0x2a')},'systemAvatar':{'type':Sequelize[_0xb8a8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8a8('0xc')],'comment':_0xb8a8('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![],'comment':_0xb8a8('0x2c'),'set':function(_0x597878){if(!_0x597878)this[_0xb8a8('0x1a')](_0xb8a8('0x2d'),null);this[_0xb8a8('0x1a')](_0xb8a8('0x2e'),_0x597878);}},'vidaooEscalation':{'type':Sequelize[_0xb8a8('0x5')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb8a8('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xf6ca=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','thumb','star','INTEGER','stringify','name','input','onlineForm','parse','getDataValue','setDataValue','textarea','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','alternate','#fafafa'];(function(_0x2107db,_0x30c9f9){var _0x535d48=function(_0x5ce4b9){while(--_0x5ce4b9){_0x2107db['push'](_0x2107db['shift']());}};_0x535d48(++_0x30c9f9);}(_0xf6ca,0x15a));var _0xaf6c=function(_0x29b6b6,_0x46b6c2){_0x29b6b6=_0x29b6b6-0x0;var _0x3943db=_0xf6ca[_0x29b6b6];return _0x3943db;};'use strict';var Sequelize=require(_0xaf6c('0x0'));var rs=require(_0xaf6c('0x1'));module[_0xaf6c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xaf6c('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x4')},'key':{'type':Sequelize[_0xaf6c('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xaf6c('0x3')],'allowNull':![],'defaultValue':_0xaf6c('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xaf6c('0x3')],'allowNull':![],'defaultValue':_0xaf6c('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaf6c('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xaf6c('0x3')]},'animation':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xaf6c('0x8')](_0xaf6c('0x9'),_0xaf6c('0xa')),'defaultValue':_0xaf6c('0x9')},'header_online':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0xb')},'offline_chat_button':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0xc')},'header_offline':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0xd')},'download_transcript':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xaf6c('0xf')]},'closingQuestion':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x11')},'closingMessage':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x12')},'closingMessageButton':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0xc')},'skipMessageButton':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x13')},'ratingType':{'type':Sequelize['ENUM']('star',_0xaf6c('0x14')),'defaultValue':_0xaf6c('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xaf6c('0x16')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xaf6c('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xaf6c('0x18'),'type':'text','required':!![]},'props':{'title':_0xaf6c('0x18'),'helpText':''}},{'type':_0xaf6c('0x19'),'props':{'title':_0xaf6c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xaf6c('0x4'),'type':_0xaf6c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xaf6c('0x1a'))?JSON[_0xaf6c('0x1b')](this[_0xaf6c('0x1c')](_0xaf6c('0x1a'))):{};},'set':function(_0x201c96){return this[_0xaf6c('0x1d')](_0xaf6c('0x1a'),JSON[_0xaf6c('0x17')](_0x201c96));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xaf6c('0x19'),'props':{'title':_0xaf6c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xaf6c('0x4'),'type':_0xaf6c('0x4')},'variable':null},{'type':_0xaf6c('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xaf6c('0x1c')](_0xaf6c('0x1f'))?JSON['parse'](this[_0xaf6c('0x1c')](_0xaf6c('0x1f'))):{};},'set':function(_0x8566fb){return this[_0xaf6c('0x1d')](_0xaf6c('0x1f'),JSON[_0xaf6c('0x17')](_0x8566fb));}},'token':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':function(){return rs[_0xaf6c('0x20')]();}},'autoclose':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xaf6c('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xaf6c('0x3')]},'waitingTitle':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x21')},'waitingMessage':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x22')},'offlineMessageSubject':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xaf6c('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x25')},'skipUnmanaged':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xaf6c('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xaf6c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xaf6c('0x26');}},'notificationSound':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xaf6c('0x16')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':_0xaf6c('0x27')},'defaultTitle':{'type':Sequelize[_0xaf6c('0x3')]},'customerAvatar':{'type':Sequelize[_0xaf6c('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xaf6c('0x16')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xaf6c('0x3')],'allowNull':![],'defaultValue':_0xaf6c('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaf6c('0x16')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaf6c('0x16')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xaf6c('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xaf6c('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaf6c('0x16')],'comment':_0xaf6c('0x29')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x459e5c){if(!_0x459e5c)this[_0xaf6c('0x1d')](_0xaf6c('0x2a'),null);this[_0xaf6c('0x1d')]('mandatoryDisposition',_0x459e5c);}},'vidaooEscalation':{'type':Sequelize[_0xaf6c('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0299fe9..d950e7b 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 _0xe9b6=['applications','list','orderBy','priority','asc','ListId','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','%s\x20%s','unknown','format','version','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','ids','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','stringify','connection','referer','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','false','offlineForm','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','rows','show','params','rawAttributes','keys','include','find','create','role','user','UserProfileSection','userProfileId','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','CannedAnswer','hasOwnProperty','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xe9b6,0x197));var _0x6e9b=function(_0x3f9262,_0x73c1c4){_0x3f9262=_0x3f9262-0x0;var _0x36348a=_0xe9b6[_0x3f9262];return _0x36348a;};'use strict';var pdf=require(_0x6e9b('0x0'));var emlformat=require(_0x6e9b('0x1'));var rimraf=require(_0x6e9b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e9b('0x3'));var rp=require(_0x6e9b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e9b('0x5'));var path=require(_0x6e9b('0x6'));var sox=require(_0x6e9b('0x7'));var csv=require(_0x6e9b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6e9b('0x9'));var crypto=require(_0x6e9b('0xa'));var jsforce=require(_0x6e9b('0xb'));var deskjs=require(_0x6e9b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6e9b('0xd'));var Papa=require(_0x6e9b('0xe'));var Redis=require(_0x6e9b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6e9b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e9b('0x11'));var logger=require(_0x6e9b('0x12'))(_0x6e9b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e9b('0x14'));var db=require('../../mysqldb')['db'];config[_0x6e9b('0x15')]=_[_0x6e9b('0x16')](config[_0x6e9b('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e9b('0x17'))(new Redis(config['redis']));require(_0x6e9b('0x18'))[_0x6e9b('0x19')](socket);var jayson=require(_0x6e9b('0x1a'));var client=jayson['client'][_0x6e9b('0x1b')]({'port':0x232c});var client9002=jayson[_0x6e9b('0x1c')][_0x6e9b('0x1b')]({'port':0x232a});var client9003=jayson['client'][_0x6e9b('0x1b')]({'port':0x232b});function respondWithRpcPromise(_0x51c9ce,_0x294f18,_0x7ceae4,_0x395cc8){return new BPromise(function(_0x2d3bc7,_0x706f2b){var _0x32ecbe=_0x395cc8||client;return _0x32ecbe[_0x6e9b('0x1d')](_0x51c9ce,_0x7ceae4)[_0x6e9b('0x1e')](function(_0x19bdeb){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x294f18,_0x6e9b('0x1f'));logger[_0x6e9b('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x294f18,'request\x20sent',JSON['stringify'](_0x19bdeb));if(_0x19bdeb[_0x6e9b('0x21')]){if(_0x19bdeb[_0x6e9b('0x21')]['code']===0x1f4){logger[_0x6e9b('0x21')](_0x6e9b('0x22'),_0x294f18,_0x19bdeb[_0x6e9b('0x21')][_0x6e9b('0x23')]);return _0x706f2b(_0x19bdeb[_0x6e9b('0x21')][_0x6e9b('0x23')]);}logger[_0x6e9b('0x21')](_0x6e9b('0x22'),_0x294f18,_0x19bdeb[_0x6e9b('0x21')][_0x6e9b('0x23')]);return _0x2d3bc7(_0x19bdeb['error'][_0x6e9b('0x23')]);}else{logger['info'](_0x6e9b('0x22'),_0x294f18,_0x6e9b('0x1f'));_0x2d3bc7(_0x19bdeb[_0x6e9b('0x24')][_0x6e9b('0x23')]);}})[_0x6e9b('0x25')](function(_0x4ec8ef){logger[_0x6e9b('0x21')](_0x6e9b('0x22'),_0x294f18,_0x4ec8ef);_0x706f2b(_0x4ec8ef);});});}function respondWithStatusCode(_0x377ff7,_0x424a25){_0x424a25=_0x424a25||0xcc;return function(_0x3a27db){if(_0x3a27db){return _0x377ff7[_0x6e9b('0x26')](_0x424a25);}return _0x377ff7[_0x6e9b('0x27')](_0x424a25)[_0x6e9b('0x28')]();};}function respondWithResult(_0x103ee0,_0x54001b){_0x54001b=_0x54001b||0xc8;return function(_0x38244b){if(_0x38244b){return _0x103ee0[_0x6e9b('0x27')](_0x54001b)[_0x6e9b('0x29')](_0x38244b);}};}function respondWithFilteredResult(_0x11b177,_0x676f22){return function(_0xc42331){if(_0xc42331){var _0x5ad0d5=_0xc42331[_0x6e9b('0x2a')],_0x54408a=_0x676f22[_0x6e9b('0x2b')],_0x583dda=_0x676f22[_0x6e9b('0x2b')]+_0x676f22[_0x6e9b('0x2c')],_0x5d0483;if(_0x583dda>=_0x5ad0d5){_0x583dda=_0x5ad0d5;_0x5d0483=0xc8;}else{_0x5d0483=0xce;}_0x11b177[_0x6e9b('0x27')](_0x5d0483);return _0x11b177[_0x6e9b('0x2d')](_0x6e9b('0x2e'),_0x54408a+'-'+_0x583dda+'/'+_0x5ad0d5)['json'](_0xc42331);}return null;};}function patchUpdates(_0x447d05){return function(_0x1a3577){try{jsonpatch[_0x6e9b('0x2f')](_0x1a3577,_0x447d05,!![]);}catch(_0x385641){return BPromise[_0x6e9b('0x30')](_0x385641);}return _0x1a3577[_0x6e9b('0x31')]();};}function saveUpdates(_0x1001fe,_0x5f2eaf){return function(_0x47a7d2){if(_0x47a7d2){return _0x47a7d2[_0x6e9b('0x32')](_0x1001fe)['then'](function(_0x525002){return _0x525002;});}return null;};}function removeEntity(_0x391dc6,_0x39153b){return function(_0x55d646){if(_0x55d646){return _0x55d646[_0x6e9b('0x33')]()[_0x6e9b('0x1e')](function(){var _0x83f005=_0x55d646[_0x6e9b('0x34')]({'plain':!![]});var _0x551787='ChatWebsites';return db[_0x6e9b('0x35')]['destroy']({'where':{'type':_0x551787,'resourceId':_0x83f005['id']}})[_0x6e9b('0x1e')](function(){return _0x55d646;});})[_0x6e9b('0x1e')](function(){_0x391dc6[_0x6e9b('0x27')](0xcc)[_0x6e9b('0x28')]();});}};}function handleEntityNotFound(_0x6d9946,_0x592c80){return function(_0x49aeb6){if(!_0x49aeb6){_0x6d9946[_0x6e9b('0x26')](0x194);}return _0x49aeb6;};}function handleError(_0x59563c,_0x2a8464){_0x2a8464=_0x2a8464||0x1f4;return function(_0x4c9b90){logger['error'](_0x4c9b90[_0x6e9b('0x36')]);if(_0x4c9b90[_0x6e9b('0x37')]){delete _0x4c9b90[_0x6e9b('0x37')];}_0x59563c[_0x6e9b('0x27')](_0x2a8464)['send'](_0x4c9b90);};}exports['index']=function(_0x4b81e5,_0xab681d){var _0x47522b={'include':[{'model':db[_0x6e9b('0x38')],'as':_0x6e9b('0x39')}]},_0x262138={},_0x17bed0={'count':0x0,'rows':[]};var _0x2e652d=_['map'](db[_0x6e9b('0x3a')]['rawAttributes'],function(_0x1c2bdd){return{'name':_0x1c2bdd[_0x6e9b('0x3b')],'type':_0x1c2bdd[_0x6e9b('0x3c')][_0x6e9b('0x3d')]};});_0x262138['model']=_['map'](_0x2e652d,_0x6e9b('0x37'));_0x262138[_0x6e9b('0x3e')]=_['keys'](_0x4b81e5[_0x6e9b('0x3e')]);_0x262138[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x262138[_0x6e9b('0x41')],_0x262138[_0x6e9b('0x3e')]);_0x47522b['attributes']=_['intersection'](_0x262138[_0x6e9b('0x41')],qs[_0x6e9b('0x42')](_0x4b81e5[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0x47522b['attributes']=_0x47522b[_0x6e9b('0x43')][_0x6e9b('0x44')]?_0x47522b[_0x6e9b('0x43')]:_0x262138[_0x6e9b('0x41')];if(!_0x4b81e5[_0x6e9b('0x3e')]['hasOwnProperty'](_0x6e9b('0x45'))){_0x47522b['limit']=qs['limit'](_0x4b81e5[_0x6e9b('0x3e')][_0x6e9b('0x2c')]);_0x47522b['offset']=qs[_0x6e9b('0x2b')](_0x4b81e5[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}_0x47522b[_0x6e9b('0x46')]=qs[_0x6e9b('0x47')](_0x4b81e5[_0x6e9b('0x3e')][_0x6e9b('0x47')]);_0x47522b[_0x6e9b('0x48')]=qs[_0x6e9b('0x3f')](_['pick'](_0x4b81e5[_0x6e9b('0x3e')],_0x262138['filters']),_0x2e652d);if(_0x4b81e5[_0x6e9b('0x3e')]['filter']){_0x47522b[_0x6e9b('0x48')]=_[_0x6e9b('0x49')](_0x47522b[_0x6e9b('0x48')],{'$or':_[_0x6e9b('0x4a')](_0x2e652d,function(_0x6af773){if(_0x6af773['type']!==_0x6e9b('0x4b')){var _0x2d64fb={};_0x2d64fb[_0x6af773['name']]={'$like':'%'+_0x4b81e5[_0x6e9b('0x3e')][_0x6e9b('0x4c')]+'%'};return _0x2d64fb;}})});}_0x47522b=_[_0x6e9b('0x49')]({},_0x47522b,_0x4b81e5[_0x6e9b('0x4d')]);var _0x1308cb={'where':_0x47522b[_0x6e9b('0x48')]};return db[_0x6e9b('0x3a')][_0x6e9b('0x2a')](_0x1308cb)[_0x6e9b('0x1e')](function(_0x50eede){_0x17bed0['count']=_0x50eede;if(_0x4b81e5[_0x6e9b('0x3e')][_0x6e9b('0x4e')]){_0x47522b['include']=[{'all':!![]}];}return db[_0x6e9b('0x3a')]['findAll'](_0x47522b);})[_0x6e9b('0x1e')](function(_0x18cd0c){_0x17bed0[_0x6e9b('0x4f')]=_0x18cd0c;return _0x17bed0;})[_0x6e9b('0x1e')](respondWithFilteredResult(_0xab681d,_0x47522b))['catch'](handleError(_0xab681d,null));};exports[_0x6e9b('0x50')]=function(_0x3aa15b,_0x379694){var _0x1efe1c={'raw':![],'where':{'id':_0x3aa15b[_0x6e9b('0x51')]['id']},'include':[{'model':db[_0x6e9b('0x38')],'as':_0x6e9b('0x39')}]},_0x11983c={};_0x11983c[_0x6e9b('0x41')]=_['keys'](db['ChatWebsite'][_0x6e9b('0x52')]);_0x11983c[_0x6e9b('0x3e')]=_[_0x6e9b('0x53')](_0x3aa15b[_0x6e9b('0x3e')]);_0x11983c[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x11983c[_0x6e9b('0x41')],_0x11983c[_0x6e9b('0x3e')]);_0x1efe1c[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x11983c[_0x6e9b('0x41')],qs['fields'](_0x3aa15b['query'][_0x6e9b('0x42')]));_0x1efe1c[_0x6e9b('0x43')]=_0x1efe1c['attributes'][_0x6e9b('0x44')]?_0x1efe1c[_0x6e9b('0x43')]:_0x11983c[_0x6e9b('0x41')];if(_0x3aa15b[_0x6e9b('0x3e')][_0x6e9b('0x4e')]){_0x1efe1c[_0x6e9b('0x54')]=[{'all':!![]}];}_0x1efe1c=_[_0x6e9b('0x49')]({},_0x1efe1c,_0x3aa15b['options']);return db[_0x6e9b('0x3a')][_0x6e9b('0x55')](_0x1efe1c)['then'](handleEntityNotFound(_0x379694,null))[_0x6e9b('0x1e')](respondWithResult(_0x379694,null))[_0x6e9b('0x25')](handleError(_0x379694,null));};exports[_0x6e9b('0x56')]=function(_0x27e109,_0x92d9e3){return db['ChatWebsite']['create'](_0x27e109['body'],{})[_0x6e9b('0x1e')](function(_0x277778){var _0x4497d8=_0x27e109['user'][_0x6e9b('0x34')]({'plain':!![]});if(!_0x4497d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4497d8[_0x6e9b('0x57')]===_0x6e9b('0x58')){var _0x5ab220=_0x277778[_0x6e9b('0x34')]({'plain':!![]});var _0x36806c='ChatWebsites';return db[_0x6e9b('0x59')]['find']({'where':{'name':_0x36806c,'userProfileId':_0x4497d8[_0x6e9b('0x5a')]},'raw':!![]})['then'](function(_0x34e14f){if(_0x34e14f&&_0x34e14f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5ab220[_0x6e9b('0x37')],'resourceId':_0x5ab220['id'],'type':_0x34e14f['name'],'sectionId':_0x34e14f['id']},{})[_0x6e9b('0x1e')](function(){return _0x277778;});}else{return _0x277778;}})[_0x6e9b('0x25')](function(_0x438769){logger[_0x6e9b('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x438769);throw _0x438769;});}return _0x277778;})[_0x6e9b('0x1e')](respondWithResult(_0x92d9e3,0xc9))[_0x6e9b('0x25')](handleError(_0x92d9e3,null));};exports[_0x6e9b('0x32')]=function(_0x5797f0,_0x190dcc){if(_0x5797f0[_0x6e9b('0x5b')]['id']){delete _0x5797f0[_0x6e9b('0x5b')]['id'];}return db['ChatWebsite'][_0x6e9b('0x55')]({'where':{'id':_0x5797f0[_0x6e9b('0x51')]['id']},'include':[{'model':db[_0x6e9b('0x38')],'as':'mandatoryDispositionPause'}]})[_0x6e9b('0x1e')](handleEntityNotFound(_0x190dcc,null))[_0x6e9b('0x1e')](saveUpdates(_0x5797f0[_0x6e9b('0x5b')],null))['then'](respondWithResult(_0x190dcc,null))[_0x6e9b('0x25')](handleError(_0x190dcc,null));};exports[_0x6e9b('0x33')]=function(_0x2d9a30,_0x4eea8e){return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x2d9a30[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x4eea8e,null))[_0x6e9b('0x1e')](removeEntity(_0x4eea8e,null))[_0x6e9b('0x25')](handleError(_0x4eea8e,null));};exports[_0x6e9b('0x5c')]=function(_0x41b24a,_0xd632aa){return db[_0x6e9b('0x3a')][_0x6e9b('0x5c')]()[_0x6e9b('0x1e')](respondWithResult(_0xd632aa,null))[_0x6e9b('0x25')](handleError(_0xd632aa,null));};exports[_0x6e9b('0x5d')]=function(_0x2589a8,_0x4d0990,_0x18a834){if(_0x2589a8[_0x6e9b('0x5b')]['id']){delete _0x2589a8[_0x6e9b('0x5b')]['id'];}return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x2589a8[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x4d0990,null))[_0x6e9b('0x1e')](function(_0x311ff1){if(_0x311ff1){_0x2589a8[_0x6e9b('0x5b')][_0x6e9b('0x5e')]=_0x311ff1['id'];return db[_0x6e9b('0x5f')][_0x6e9b('0x56')](_0x2589a8[_0x6e9b('0x5b')]);}})[_0x6e9b('0x1e')](respondWithResult(_0x4d0990,null))[_0x6e9b('0x25')](handleError(_0x4d0990,null));};exports[_0x6e9b('0x60')]=function(_0x8db002,_0x395f56,_0x43414e){var _0xc1df45={'raw':![],'where':{}};var _0x5c762b={};var _0x368f73={'count':0x0,'rows':[]};return db[_0x6e9b('0x3a')][_0x6e9b('0x61')]({'where':{'id':_0x8db002['params']['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x395f56,null))['then'](function(_0x3b2d33){if(_0x3b2d33){_0x5c762b['model']=_['keys'](db[_0x6e9b('0x5f')][_0x6e9b('0x52')]);_0x5c762b['query']=_[_0x6e9b('0x53')](_0x8db002[_0x6e9b('0x3e')]);_0x5c762b['filters']=_[_0x6e9b('0x40')](_0x5c762b['model'],_0x5c762b[_0x6e9b('0x3e')]);_0xc1df45[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x5c762b['model'],qs[_0x6e9b('0x42')](_0x8db002[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0xc1df45[_0x6e9b('0x43')]=_0xc1df45[_0x6e9b('0x43')]['length']?_0xc1df45[_0x6e9b('0x43')]:_0x5c762b[_0x6e9b('0x41')];if(!_0x8db002[_0x6e9b('0x3e')]['hasOwnProperty'](_0x6e9b('0x45'))){_0xc1df45[_0x6e9b('0x2c')]=qs[_0x6e9b('0x2c')](_0x8db002[_0x6e9b('0x3e')][_0x6e9b('0x2c')]);_0xc1df45[_0x6e9b('0x2b')]=qs[_0x6e9b('0x2b')](_0x8db002[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}_0xc1df45[_0x6e9b('0x46')]=qs[_0x6e9b('0x47')](_0x8db002[_0x6e9b('0x3e')][_0x6e9b('0x47')]);_0xc1df45[_0x6e9b('0x48')]=qs[_0x6e9b('0x3f')](_[_0x6e9b('0x62')](_0x8db002[_0x6e9b('0x3e')],_0x5c762b[_0x6e9b('0x3f')]));_0xc1df45['where'][_0x6e9b('0x5e')]=_0x3b2d33['id'];if(_0x8db002[_0x6e9b('0x3e')]['filter']){_0xc1df45[_0x6e9b('0x48')]=_['merge'](_0xc1df45[_0x6e9b('0x48')],{'$or':_[_0x6e9b('0x4a')](_0xc1df45[_0x6e9b('0x43')],function(_0x46d55a){var _0x276a7e={};_0x276a7e[_0x46d55a]={'$like':'%'+_0x8db002[_0x6e9b('0x3e')][_0x6e9b('0x4c')]+'%'};return _0x276a7e;})});}_0xc1df45=_[_0x6e9b('0x49')]({},_0xc1df45,_0x8db002[_0x6e9b('0x4d')]);return db['Disposition']['count']({'where':_0xc1df45[_0x6e9b('0x48')]})[_0x6e9b('0x1e')](function(_0x98e094){_0x368f73['count']=_0x98e094;if(_0x8db002[_0x6e9b('0x3e')]['includeAll']){_0xc1df45['include']=[{'all':!![]}];}return db['Disposition'][_0x6e9b('0x63')](_0xc1df45);})['then'](function(_0x39b918){_0x368f73[_0x6e9b('0x4f')]=_0x39b918;return _0x368f73;});}})['then'](respondWithFilteredResult(_0x395f56,_0xc1df45))[_0x6e9b('0x25')](handleError(_0x395f56,null));};exports[_0x6e9b('0x64')]=function(_0x4bfb78,_0x3016cb,_0x3aeacb){return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x4bfb78[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x3016cb,null))[_0x6e9b('0x1e')](function(_0x4411b0){if(_0x4411b0){return _0x4411b0['removeDispositions'](_0x4bfb78[_0x6e9b('0x3e')]['ids']);}})[_0x6e9b('0x1e')](respondWithStatusCode(_0x3016cb,null))['catch'](handleError(_0x3016cb,null));};exports['addAnswer']=function(_0x4f399d,_0x5d6529,_0x5683e7){if(_0x4f399d['body']['id']){delete _0x4f399d[_0x6e9b('0x5b')]['id'];}return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x4f399d[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x5d6529,null))[_0x6e9b('0x1e')](function(_0x2ed248){if(_0x2ed248){_0x4f399d[_0x6e9b('0x5b')][_0x6e9b('0x5e')]=_0x2ed248['id'];return db['CannedAnswer'][_0x6e9b('0x56')](_0x4f399d[_0x6e9b('0x5b')]);}})[_0x6e9b('0x1e')](respondWithResult(_0x5d6529,null))['catch'](handleError(_0x5d6529,null));};exports['getAnswers']=function(_0x4dd95c,_0x31769c,_0x1df552){var _0x5369e1={'raw':![],'where':{}};var _0x3bb258={};var _0xe4122a={'count':0x0,'rows':[]};return db[_0x6e9b('0x3a')][_0x6e9b('0x61')]({'where':{'id':_0x4dd95c[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x31769c,null))[_0x6e9b('0x1e')](function(_0x340e75){if(_0x340e75){_0x3bb258['model']=_['keys'](db[_0x6e9b('0x65')]['rawAttributes']);_0x3bb258[_0x6e9b('0x3e')]=_[_0x6e9b('0x53')](_0x4dd95c[_0x6e9b('0x3e')]);_0x3bb258[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x3bb258[_0x6e9b('0x41')],_0x3bb258['query']);_0x5369e1[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x3bb258[_0x6e9b('0x41')],qs['fields'](_0x4dd95c[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0x5369e1[_0x6e9b('0x43')]=_0x5369e1[_0x6e9b('0x43')][_0x6e9b('0x44')]?_0x5369e1[_0x6e9b('0x43')]:_0x3bb258[_0x6e9b('0x41')];if(!_0x4dd95c[_0x6e9b('0x3e')][_0x6e9b('0x66')](_0x6e9b('0x45'))){_0x5369e1[_0x6e9b('0x2c')]=qs[_0x6e9b('0x2c')](_0x4dd95c['query'][_0x6e9b('0x2c')]);_0x5369e1['offset']=qs[_0x6e9b('0x2b')](_0x4dd95c[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}_0x5369e1[_0x6e9b('0x46')]=qs[_0x6e9b('0x47')](_0x4dd95c[_0x6e9b('0x3e')]['sort']);_0x5369e1['where']=qs[_0x6e9b('0x3f')](_[_0x6e9b('0x62')](_0x4dd95c[_0x6e9b('0x3e')],_0x3bb258[_0x6e9b('0x3f')]));_0x5369e1[_0x6e9b('0x48')]['ChatWebsiteId']=_0x340e75['id'];if(_0x4dd95c[_0x6e9b('0x3e')][_0x6e9b('0x4c')]){_0x5369e1['where']=_[_0x6e9b('0x49')](_0x5369e1[_0x6e9b('0x48')],{'$or':_[_0x6e9b('0x4a')](_0x5369e1[_0x6e9b('0x43')],function(_0x33552d){var _0x40548e={};_0x40548e[_0x33552d]={'$like':'%'+_0x4dd95c['query'][_0x6e9b('0x4c')]+'%'};return _0x40548e;})});}_0x5369e1=_['merge']({},_0x5369e1,_0x4dd95c[_0x6e9b('0x4d')]);return db[_0x6e9b('0x65')][_0x6e9b('0x2a')]({'where':_0x5369e1[_0x6e9b('0x48')]})[_0x6e9b('0x1e')](function(_0x462a0){_0xe4122a[_0x6e9b('0x2a')]=_0x462a0;if(_0x4dd95c['query'][_0x6e9b('0x4e')]){_0x5369e1[_0x6e9b('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6e9b('0x63')](_0x5369e1);})[_0x6e9b('0x1e')](function(_0x5ece82){_0xe4122a[_0x6e9b('0x4f')]=_0x5ece82;return _0xe4122a;});}})[_0x6e9b('0x1e')](respondWithFilteredResult(_0x31769c,_0x5369e1))[_0x6e9b('0x25')](handleError(_0x31769c,null));};exports['removeAnswers']=function(_0x187c97,_0x5aa1df,_0x39c749){return db['ChatWebsite'][_0x6e9b('0x55')]({'where':{'id':_0x187c97[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x5aa1df,null))[_0x6e9b('0x1e')](function(_0x34b88e){if(_0x34b88e){return _0x34b88e['removeAnswers'](_0x187c97['query']['ids']);}})[_0x6e9b('0x1e')](respondWithStatusCode(_0x5aa1df,null))[_0x6e9b('0x25')](handleError(_0x5aa1df,null));};exports['addLogo']=function(_0x39c916,_0xfc1439,_0x5673d3){_0x39c916[_0x6e9b('0x5b')]['sitepic']=_0x39c916[_0x6e9b('0x67')][_0x6e9b('0x68')];return db['ChatWebsite'][_0x6e9b('0x55')]({'where':{'id':_0x39c916[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0xfc1439,null))['then'](saveUpdates(_0x39c916[_0x6e9b('0x5b')],null))['then'](respondWithResult(_0xfc1439,null))[_0x6e9b('0x25')](handleError(_0xfc1439,null));};exports[_0x6e9b('0x69')]=function(_0x12c479,_0x4c81d1,_0x36bfc7){_0x12c479['body'][_0x6e9b('0x6a')]=_0x12c479[_0x6e9b('0x67')][_0x6e9b('0x68')];return db[_0x6e9b('0x3a')]['find']({'where':{'id':_0x12c479['params']['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x4c81d1,null))['then'](saveUpdates(_0x12c479[_0x6e9b('0x5b')],null))[_0x6e9b('0x1e')](respondWithResult(_0x4c81d1,null))[_0x6e9b('0x25')](handleError(_0x4c81d1,null));};exports['addCustomerAvatar']=function(_0x557ad4,_0x187cff,_0x2ed57c){_0x557ad4[_0x6e9b('0x5b')][_0x6e9b('0x6b')]=_0x557ad4[_0x6e9b('0x67')][_0x6e9b('0x68')];return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x557ad4[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x187cff,null))[_0x6e9b('0x1e')](saveUpdates(_0x557ad4['body'],null))['then'](respondWithResult(_0x187cff,null))[_0x6e9b('0x25')](handleError(_0x187cff,null));};exports[_0x6e9b('0x6c')]=function(_0x2fbb26,_0x61e70a,_0x51572c){_0x2fbb26[_0x6e9b('0x5b')]['systemAvatar']=_0x2fbb26[_0x6e9b('0x67')][_0x6e9b('0x68')];return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x2fbb26[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x61e70a,null))['then'](saveUpdates(_0x2fbb26['body'],null))[_0x6e9b('0x1e')](respondWithResult(_0x61e70a,null))['catch'](handleError(_0x61e70a,null));};exports[_0x6e9b('0x6d')]=function(_0x2a3629,_0x233a80,_0x348f13){var _0x1a565b=path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],'server/files/images/logos/default_logo.svg');var _0x30bc39={'where':{'id':_0x2a3629['params']['id']},'attributes':['id',_0x6e9b('0x70')],'raw':!![]};var _0x32f04b=![];return require(_0x6e9b('0x14'))[_0x6e9b('0x71')]()[_0x6e9b('0x1e')](function(_0x2e815d){if(_0x2e815d){_0x32f04b=_0x2e815d[_0x6e9b('0x72')];}})[_0x6e9b('0x1e')](function(){return db[_0x6e9b('0x3a')][_0x6e9b('0x55')](_0x30bc39);})[_0x6e9b('0x1e')](handleEntityNotFound(_0x233a80,null))[_0x6e9b('0x1e')](function(_0x44d388){if(_0x44d388){if(!_[_0x6e9b('0x73')](_0x44d388[_0x6e9b('0x70')])){if(fs[_0x6e9b('0x74')](path[_0x6e9b('0x6e')](config['root'],_0x6e9b('0x75'),_0x44d388[_0x6e9b('0x70')]))&&_0x32f04b){_0x1a565b=path[_0x6e9b('0x6e')](config['root'],_0x6e9b('0x75'),_0x44d388[_0x6e9b('0x70')]);}}return _0x233a80[_0x6e9b('0x76')](_0x1a565b);}})['catch'](handleError(_0x233a80,null));};exports[_0x6e9b('0x77')]=function(_0x5300b2,_0x229849,_0x9bfe14){var _0x3c4b0e=path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],_0x6e9b('0x78'));var _0x1cceba={'where':{'id':_0x5300b2['params']['id']},'attributes':['id',_0x6e9b('0x6a')],'raw':!![]};return db[_0x6e9b('0x3a')][_0x6e9b('0x55')](_0x1cceba)[_0x6e9b('0x1e')](handleEntityNotFound(_0x229849,null))[_0x6e9b('0x1e')](function(_0x4921a6){if(_0x4921a6){if(!_[_0x6e9b('0x73')](_0x4921a6['agentAvatar'])){if(fs[_0x6e9b('0x74')](path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],_0x6e9b('0x79'),_0x4921a6[_0x6e9b('0x6a')]))){_0x3c4b0e=path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],_0x6e9b('0x79'),_0x4921a6['agentAvatar']);}}return _0x229849[_0x6e9b('0x76')](_0x3c4b0e);}})[_0x6e9b('0x25')](handleError(_0x229849,null));};exports[_0x6e9b('0x7a')]=function(_0x59fcc7,_0x4c33e5,_0x326372){var _0x1fba55=path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],'server/files/images/avatars/customer_avatar.png');var _0x5468fa={'where':{'id':_0x59fcc7[_0x6e9b('0x51')]['id']},'attributes':['id',_0x6e9b('0x6b'),_0x6e9b('0x7b')],'raw':!![]};return db['ChatWebsite'][_0x6e9b('0x55')](_0x5468fa)[_0x6e9b('0x1e')](handleEntityNotFound(_0x4c33e5,null))['then'](function(_0x1d244c){if(_0x1d244c){if(!_['isNil'](_0x1d244c['customerAvatar'])){if(fs[_0x6e9b('0x74')](path[_0x6e9b('0x6e')](config['root'],_0x6e9b('0x79'),_0x1d244c['customerAvatar']))&&_0x1d244c['showCustomerAvatar']){_0x1fba55=path[_0x6e9b('0x6e')](config['root'],_0x6e9b('0x79'),_0x1d244c[_0x6e9b('0x6b')]);}}return _0x4c33e5[_0x6e9b('0x76')](_0x1fba55);}})['catch'](handleError(_0x4c33e5,null));};exports[_0x6e9b('0x7c')]=function(_0xbc3e97,_0x415782,_0x42799f){var _0x13b52a=path['join'](config[_0x6e9b('0x6f')],_0x6e9b('0x7d'));var _0x29ab11={'where':{'id':_0xbc3e97[_0x6e9b('0x51')]['id']},'attributes':['id',_0x6e9b('0x7e')],'raw':!![]};return db['ChatWebsite'][_0x6e9b('0x55')](_0x29ab11)[_0x6e9b('0x1e')](handleEntityNotFound(_0x415782,null))[_0x6e9b('0x1e')](function(_0x3d43d3){if(_0x3d43d3){if(!_['isNil'](_0x3d43d3[_0x6e9b('0x7e')])){if(fs[_0x6e9b('0x74')](path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],'server/files/images/avatars/',_0x3d43d3[_0x6e9b('0x7e')]))){_0x13b52a=path[_0x6e9b('0x6e')](config['root'],'server/files/images/avatars/',_0x3d43d3['systemAvatar']);}}return _0x415782[_0x6e9b('0x76')](_0x13b52a);}})[_0x6e9b('0x25')](handleError(_0x415782,null));};exports[_0x6e9b('0x7f')]=function(_0xa9828,_0x545557,_0x544230){var _0x1762e0=require(_0x6e9b('0x80'));var _0x2d850b=new _0x1762e0();var _0x2862e2=_0x2d850b[_0x6e9b('0x81')](_0xa9828[_0x6e9b('0x82')][_0x6e9b('0x83')])[_0x6e9b('0x84')]();var _0x3e3d69={'body':_0xa9828['body'],'channel':_0x6e9b('0x85')};var _0x47ecb4=[];var _0x3d3577=[];var _0x6a30b1={};var _0x3d297a=![];return db[_0x6e9b('0x86')][_0x6e9b('0x5c')]()['then'](function(_0x145b37){if(!_0x145b37){throw new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))](_0x6e9b('0x89'));}_0x47ecb4=_[_0x6e9b('0x8a')](_[_0x6e9b('0x53')](_0x145b37),[_0x6e9b('0x8b'),'updatedAt']);_0x3d3577=_['difference'](_[_0x6e9b('0x53')](_0x145b37),[_0x6e9b('0x8b'),_0x6e9b('0x8c'),_0x6e9b('0x8d'),'ListId']);if(_0xa9828['body']['id']){delete _0xa9828[_0x6e9b('0x5b')]['id'];}if(_[_0x6e9b('0x73')](_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x8e')])){throw new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))](_0x6e9b('0x8f'));}if(_['isNil'](_0xa9828['body'][_0x6e9b('0x5b')])||_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x5b')]===''){throw new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))](_0x6e9b('0x90'));}if(_[_0x6e9b('0x73')](_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x91')])){throw new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))](_0x6e9b('0x92')+_0x3d3577);}if(!_[_0x6e9b('0x93')](_0x3d3577,_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x91')])){throw new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d3577);}_0x6a30b1[_0xa9828['body'][_0x6e9b('0x91')]]=_0xa9828['body']['from'];})[_0x6e9b('0x1e')](function(){return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0xa9828[_0x6e9b('0x51')]['id']},'include':[{'model':db[_0x6e9b('0x94')],'as':_0x6e9b('0x95'),'include':[{'model':db['CmContact'],'as':_0x6e9b('0x96'),'where':_0x6a30b1,'limit':0x1,'order':[[_0x6e9b('0x8c'),_0x6e9b('0x97')]]}]},{'model':db[_0x6e9b('0x98')],'as':_0x6e9b('0x99')}]});})['then'](handleEntityNotFound(_0x545557,null))[_0x6e9b('0x1e')](function(_0x4dd58b){if(_0x4dd58b&&_0x4dd58b[_0x6e9b('0x95')]){_0x3e3d69[_0x6e9b('0x9a')]=_0x4dd58b;_0x3e3d69[_0x6e9b('0x9b')]=_0x4dd58b[_0x6e9b('0x99')];_0x3e3d69[_0x6e9b('0x9c')]=_0x4dd58b['List'];_0x3e3d69[_0x6e9b('0x9b')]=_[_0x6e9b('0x9d')](_0x3e3d69[_0x6e9b('0x9b')],[_0x6e9b('0x9e')],[_0x6e9b('0x9f')]);if(_0x3e3d69['account'][_0x6e9b('0x99')]){delete _0x3e3d69[_0x6e9b('0x9a')]['Applications'];}if(_0x3e3d69[_0x6e9b('0x9a')][_0x6e9b('0x95')]&&_0x3e3d69['account'][_0x6e9b('0x95')][_0x6e9b('0x96')][_0x6e9b('0x44')]){return _0x3e3d69[_0x6e9b('0x9a')][_0x6e9b('0x95')][_0x6e9b('0x96')][0x0];}var _0x5ab800=_[_0x6e9b('0x16')](_0xa9828[_0x6e9b('0x5b')],{'firstName':_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x8e')],'ListId':_0x4dd58b[_0x6e9b('0xa0')]});_0x5ab800[_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x91')]]=_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x8e')];return db[_0x6e9b('0x86')][_0x6e9b('0x56')](_0x5ab800,{'fields':_0x47ecb4,'raw':!![]});}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x545557,null))[_0x6e9b('0x1e')](function(_0xc8b7fb){_0x3e3d69[_0x6e9b('0xa1')]=_0xc8b7fb;var _0x59aac3=_0xa9828[_0x6e9b('0x5b')]['customerIp'];if(_0xa9828[_0x6e9b('0x82')][_0x6e9b('0xa2')]){_0x59aac3=_0xa9828[_0x6e9b('0x82')][_0x6e9b('0xa2')];}else if(_0xa9828[_0x6e9b('0x82')][_0x6e9b('0xa3')]){_0x59aac3=_[_0x6e9b('0xa4')](_0xa9828[_0x6e9b('0x82')][_0x6e9b('0xa3')][_0x6e9b('0xa5')](','));}if(_0xc8b7fb){var _0x483f53={'ContactId':_0xc8b7fb['id'],'ChatWebsiteId':_0xa9828[_0x6e9b('0x51')]['id'],'from':(_0xc8b7fb[_0x6e9b('0xa6')]||'')+'\x20'+(_0xc8b7fb[_0x6e9b('0xa7')]||''),'customerIp':_0x59aac3,'customerPort':_0xa9828[_0x6e9b('0x82')]['x-real-port']?_0xa9828[_0x6e9b('0x82')][_0x6e9b('0xa8')]:null,'referer':_0xa9828[_0x6e9b('0x5b')]['referer'],'browserName':_0x2862e2[_0x6e9b('0xa9')][_0x6e9b('0x37')]&&_0x2862e2['browser']['version']?util['format'](_0x6e9b('0xaa'),_0x2862e2[_0x6e9b('0xa9')][_0x6e9b('0x37')],_0x2862e2[_0x6e9b('0xa9')]['version']):_0x6e9b('0xab'),'browserVersion':_0x2862e2[_0x6e9b('0xa9')]['version']||_0x6e9b('0xab'),'osName':util[_0x6e9b('0xac')](_0x6e9b('0xaa'),_0x2862e2['os'][_0x6e9b('0x37')],_0x2862e2['os'][_0x6e9b('0xad')]),'osVersion':_0x2862e2['os']['version'],'deviceModel':_0x2862e2[_0x6e9b('0xae')]['model']&&_0x2862e2['device'][_0x6e9b('0xaf')]?util['format'](_0x6e9b('0xb0'),_0x2862e2[_0x6e9b('0xae')][_0x6e9b('0x41')],_0x2862e2[_0x6e9b('0xae')][_0x6e9b('0xaf')],_0x2862e2[_0x6e9b('0xae')][_0x6e9b('0x3c')]):null,'deviceVendor':_0x2862e2[_0x6e9b('0xae')][_0x6e9b('0xaf')],'deviceType':_0x2862e2[_0x6e9b('0xae')][_0x6e9b('0x3c')],'formData':JSON['stringify'](_0xa9828[_0x6e9b('0x5b')])};var _0x500bba={'ChatWebsiteId':_0xa9828[_0x6e9b('0x51')]['id'],'closed':![]};if(_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb1')]){_0x500bba[_0x6e9b('0xb1')]=_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb1')];return db[_0x6e9b('0xb2')]['find']({'where':_0x500bba})[_0x6e9b('0x1e')](function(_0x11aa99){if(_0x11aa99){return[_0x11aa99,![]];}_0x483f53['threadId']=_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb1')];_0x483f53[_0x6e9b('0xb3')]=_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb3')];return db['ChatInteraction']['create'](_0x483f53)['then'](function(_0x314f62){return[_0x314f62,!![]];});});}_0x500bba[_0x6e9b('0xb4')]=_0xc8b7fb['id'];if(_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb5')]&&_0xa9828[_0x6e9b('0x5b')]['interaction']['id']){_0x500bba['id']=_0xa9828['body'][_0x6e9b('0xb5')]['id'];return db[_0x6e9b('0xb2')][_0x6e9b('0x55')]({'where':_0x500bba})[_0x6e9b('0x1e')](function(_0x391a0d){if(_0x391a0d){return[_0x391a0d,![]];}return db[_0x6e9b('0xb2')][_0x6e9b('0x56')](_0x483f53)[_0x6e9b('0x1e')](function(_0x453bc7){return[_0x453bc7,!![]];});});}return db[_0x6e9b('0xb2')][_0x6e9b('0x56')](_0x483f53)[_0x6e9b('0x1e')](function(_0x564e0b){return[_0x564e0b,!![]];});}})[_0x6e9b('0xb6')](function(_0x3a4153,_0x2d7e69){if(_0x3a4153){_0x3d297a=_0x2d7e69;if(!_0x2d7e69){var _0xbeeed7={'from':(_0x3e3d69[_0x6e9b('0xa1')]['firstName']||'')+'\x20'+(_0x3e3d69[_0x6e9b('0xa1')][_0x6e9b('0xa7')]||'')};if(_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb1')]&&_0xa9828[_0x6e9b('0x5b')]['messageId']&&_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb1')]!=_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb7')]){_0xbeeed7['threadId']=_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xb7')];}return _0x3a4153[_0x6e9b('0x32')](_0xbeeed7);}else{return _0x3a4153;}}})[_0x6e9b('0x1e')](function(_0xa9a4ba){_0x3e3d69[_0x6e9b('0xb5')]=_0xa9a4ba['get']({'plain':!![]});_0x3e3d69[_0x6e9b('0xb5')][_0x6e9b('0xb8')]=_0x3d297a;if(_0x3e3d69[_0x6e9b('0xb5')]['created']){if(_0x3e3d69[_0x6e9b('0x9a')][_0x6e9b('0xb9')]){_0x3e3d69[_0x6e9b('0x9b')][_0x6e9b('0xba')]({'id':0x0,'priority':_0x3e3d69[_0x6e9b('0x9b')][_0x6e9b('0x44')]+0x1,'app':'close','appdata':_0x6e9b('0xbb'),'interval':_0x6e9b('0xbc')});}}return db[_0x6e9b('0xbd')]['create']({'body':_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0x5b')],'ChatWebsiteId':_0xa9828[_0x6e9b('0x51')]['id'],'ChatInteractionId':_0xa9a4ba['id'],'direction':'in','ContactId':_0x3e3d69[_0x6e9b('0xa1')]['id'],'AttachmentId':_0xa9828[_0x6e9b('0x5b')][_0x6e9b('0xbe')]});})[_0x6e9b('0x1e')](function(_0x35e621){_0x3e3d69[_0x6e9b('0x23')]=_0x35e621;if(_0x3e3d69[_0x6e9b('0xb5')]['UserId']){return db['User'][_0x6e9b('0x55')]({'attributes':['id',_0x6e9b('0x37')],'where':{'id':_0x3e3d69[_0x6e9b('0xb5')][_0x6e9b('0xbf')]}})[_0x6e9b('0x1e')](function(_0x55a13a){if(_0x55a13a){_0x3e3d69[_0x6e9b('0x9b')][_0x6e9b('0xc0')]({'id':0x0,'priority':0x0,'app':_0x6e9b('0xc1'),'appdata':_0x55a13a[_0x6e9b('0x37')]+','+(_0x3e3d69[_0x6e9b('0x9a')][_0x6e9b('0xc2')]||0xa),'interval':_0x6e9b('0xbc')});_0x3e3d69[_0x6e9b('0xc3')]=!![];}return respondWithRpcPromise(_0x6e9b('0xc4'),'startRouting',_0x3e3d69);});}return respondWithRpcPromise(_0x6e9b('0xc4'),_0x6e9b('0xc5'),_0x3e3d69);})[_0x6e9b('0x1e')](function(_0xae3765){respondWithRpcPromise(_0x6e9b('0xc6'),'EventManager',{'event':'notify','message':_0xae3765},client9002);return _0xae3765;})[_0x6e9b('0x1e')](respondWithResult(_0x545557,null))['catch'](handleError(_0x545557,null));};exports['offline']=function(_0x12f2ca,_0x2d48dc,_0x2cba03){var _0x49c681,_0x721157,_0x264cbe;var _0xc47b7b=[];var _0xf166f5=[];var _0x40bd51={};return db[_0x6e9b('0x86')]['describe']()['then'](function(_0x4e964a){if(!_0x4e964a){throw new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))](_0x6e9b('0x89'));}_0xf166f5=_[_0x6e9b('0x8a')](_[_0x6e9b('0x53')](_0x4e964a),[_0x6e9b('0x8b'),'updatedAt']);_0xc47b7b=_[_0x6e9b('0x8a')](_[_0x6e9b('0x53')](_0x4e964a),[_0x6e9b('0x8b'),_0x6e9b('0x8c'),'CompanyId',_0x6e9b('0xa0')]);if(_0x12f2ca[_0x6e9b('0x5b')]['id']){delete _0x12f2ca['body']['id'];}if(_['isNil'](_0x12f2ca[_0x6e9b('0x5b')][_0x6e9b('0x8e')])){throw _0x2d48dc['status'](0x1f4)[_0x6e9b('0xc7')](new db['Sequelize'][(_0x6e9b('0x88'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x12f2ca['body']['body'])||_0x12f2ca[_0x6e9b('0x5b')]['body']===''){throw _0x2d48dc[_0x6e9b('0x27')](0x1f4)['send'](new db[(_0x6e9b('0x87'))][(_0x6e9b('0x88'))](_0x6e9b('0x90')));}if(_[_0x6e9b('0x73')](_0x12f2ca[_0x6e9b('0x5b')][_0x6e9b('0xc8')])){throw _0x2d48dc[_0x6e9b('0x27')](0x1f4)[_0x6e9b('0xc7')](new db[(_0x6e9b('0x87'))]['ValidationError'](_0x6e9b('0xc9')+_0xc47b7b));}if(!_[_0x6e9b('0x93')](_0xc47b7b,_0x12f2ca['body'][_0x6e9b('0xc8')])){throw _0x2d48dc[_0x6e9b('0x27')](0x1f4)[_0x6e9b('0xc7')](new db['Sequelize'][(_0x6e9b('0x88'))](_0x6e9b('0xca')+_0xc47b7b));}_0x40bd51[_0x12f2ca[_0x6e9b('0x5b')][_0x6e9b('0xc8')]]=_0x12f2ca['body']['from'];})[_0x6e9b('0x1e')](function(){return db[_0x6e9b('0x3a')]['find']({'where':{'id':_0x12f2ca[_0x6e9b('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x6e9b('0x95')}]});})[_0x6e9b('0x1e')](handleEntityNotFound(_0x2d48dc,null))['then'](function(_0x262568){if(_0x262568&&_0x262568[_0x6e9b('0x95')]){_0x721157=_0x262568;var _0x583aea=_[_0x6e9b('0x16')](_0x12f2ca['body'],{'firstName':_0x12f2ca['body']['from'],'phone':_0x12f2ca[_0x6e9b('0x5b')]['from'],'ListId':_0x262568[_0x6e9b('0xa0')]});_0x583aea[_0x12f2ca['body'][_0x6e9b('0xc8')]]=_0x12f2ca['body'][_0x6e9b('0x8e')];return db[_0x6e9b('0x86')][_0x6e9b('0xcb')]({'where':_0x40bd51,'defaults':_0x583aea});}})[_0x6e9b('0xb6')](function(_0x59847a){if(_0x59847a){_0x264cbe=_0x59847a;var _0x3262f7=fs['readFileSync'](path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],_0x6e9b('0xcc')),_0x6e9b('0xcd'));var _0x298192=ejs['render'](_0x3262f7,{'body':_[_0x6e9b('0xce')](_0x12f2ca[_0x6e9b('0x5b')][_0x6e9b('0x5b')]),'bodyTitle':_0x721157[_0x6e9b('0xcf')]});return db[_0x6e9b('0xd0')]['create']({'body':_0x298192,'ContactId':_0x59847a['id'],'ChatWebsiteId':_0x721157['id']});}})[_0x6e9b('0x1e')](function(_0x144b59){if(_0x144b59){_0x49c681=_0x144b59;return db['MailAccount'][_0x6e9b('0x61')]({'where':{'service':!![]},'include':[{'model':db[_0x6e9b('0xd1')],'as':_0x6e9b('0xd2'),'raw':!![]}]});}})[_0x6e9b('0x1e')](function(_0x53354e){if(_0x53354e&&_0x53354e[_0x6e9b('0xd2')]&&_0x721157[_0x6e9b('0xd3')]){var _0x482dd6={'tls':{'rejectUnauthorized':![]}};if(_0x53354e[_0x6e9b('0xd2')][_0x6e9b('0xd4')]){_0x482dd6['service']=_0x53354e[_0x6e9b('0xd2')][_0x6e9b('0xd4')];}else{_0x482dd6[_0x6e9b('0xd5')]=_0x53354e['Smtp'][_0x6e9b('0xd5')];_0x482dd6['port']=_0x53354e['Smtp'][_0x6e9b('0xd6')];_0x482dd6[_0x6e9b('0xd7')]=_0x53354e[_0x6e9b('0xd2')][_0x6e9b('0xd7')];}if(_0x53354e[_0x6e9b('0xd2')][_0x6e9b('0xd8')]){_0x482dd6[_0x6e9b('0xd9')]={'user':_0x53354e[_0x6e9b('0xd2')]['user'],'pass':_0x53354e['Smtp'][_0x6e9b('0xda')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x482dd6,'message':{'from':util['format'](_0x6e9b('0xdb'),_0x53354e[_0x6e9b('0x37')],_0x53354e[_0x6e9b('0xdc')]||_0x53354e['Smtp']['user']),'to':_0x721157[_0x6e9b('0xd3')],'subject':_0x721157[_0x6e9b('0xdd')],'text':_0x49c681[_0x6e9b('0x5b')]}},client9003)['then'](function(){return _0x49c681;})[_0x6e9b('0x25')](function(_0x411657){console[_0x6e9b('0x21')](_0x411657);});}})[_0x6e9b('0x1e')](function(){if(_0x49c681){return _0x49c681;}})[_0x6e9b('0x1e')](respondWithResult(_0x2d48dc,null))['catch'](handleError(_0x2d48dc,null));};exports[_0x6e9b('0xde')]=function(_0x190e48,_0x404615,_0x5a726a){return db[_0x6e9b('0xb2')]['find']({'where':{'id':_0x190e48[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x404615,null))[_0x6e9b('0x1e')](function(_0x393ac6){if(_0x393ac6){return _0x393ac6[_0x6e9b('0xde')](_0x190e48[_0x6e9b('0x5b')]['ids'],_['omit'](_0x190e48[_0x6e9b('0x5b')],[_0x6e9b('0xdf'),'id'])||{});}})['then'](respondWithResult(_0x404615,null))['catch'](handleError(_0x404615,null));};exports[_0x6e9b('0xe0')]=function(_0x196bde,_0x5814cf,_0x5a0a1f){var _0x21bddc={'raw':![],'where':{}};var _0x49e3a3={};var _0x14c80a={'count':0x0,'rows':[]};return db[_0x6e9b('0x3a')][_0x6e9b('0x61')]({'where':{'id':_0x196bde[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x5814cf,null))[_0x6e9b('0x1e')](function(_0xe635f4){if(_0xe635f4){_0x49e3a3[_0x6e9b('0x41')]=_[_0x6e9b('0x53')](db[_0x6e9b('0xb2')][_0x6e9b('0x52')]);_0x49e3a3[_0x6e9b('0x3e')]=_['keys'](_0x196bde[_0x6e9b('0x3e')]);_0x49e3a3[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x49e3a3[_0x6e9b('0x41')],_0x49e3a3[_0x6e9b('0x3e')]);_0x21bddc[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x49e3a3[_0x6e9b('0x41')],qs[_0x6e9b('0x42')](_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0x21bddc['attributes']=_0x21bddc[_0x6e9b('0x43')][_0x6e9b('0x44')]?_0x21bddc[_0x6e9b('0x43')]:_0x49e3a3[_0x6e9b('0x41')];if(!_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x66')](_0x6e9b('0x45'))){_0x21bddc[_0x6e9b('0x2c')]=qs[_0x6e9b('0x2c')](_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x2c')]);_0x21bddc[_0x6e9b('0x2b')]=qs['offset'](_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}_0x21bddc[_0x6e9b('0x46')]=qs[_0x6e9b('0x47')](_0x196bde[_0x6e9b('0x3e')]['sort']);_0x21bddc[_0x6e9b('0x48')]=qs[_0x6e9b('0x3f')](_[_0x6e9b('0x62')](_0x196bde[_0x6e9b('0x3e')],_0x49e3a3['filters']));_0x21bddc[_0x6e9b('0x48')]['ChatWebsiteId']=_0xe635f4['id'];if(_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x4c')]){_0x21bddc['where']=_[_0x6e9b('0x49')](_0x21bddc['where'],{'$or':_[_0x6e9b('0x4a')](_0x21bddc[_0x6e9b('0x43')],function(_0x558f03){var _0x5781a5={};_0x5781a5[_0x558f03]={'$like':'%'+_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x4c')]+'%'};return _0x5781a5;})});}_0x21bddc=_[_0x6e9b('0x49')]({},_0x21bddc,_0x196bde[_0x6e9b('0x4d')]);return db[_0x6e9b('0xb2')]['count']({'where':_0x21bddc[_0x6e9b('0x48')]})[_0x6e9b('0x1e')](function(_0x13f710){_0x14c80a[_0x6e9b('0x2a')]=_0x13f710;if(_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0x4e')]){_0x21bddc['include']=[{'model':db[_0x6e9b('0x86')],'as':_0x6e9b('0xe1'),'required':![]},{'model':db[_0x6e9b('0xe2')],'as':_0x6e9b('0xe3'),'attributes':[_0x6e9b('0x37'),_0x6e9b('0xe4'),_0x6e9b('0xe5')],'required':![]},{'model':db[_0x6e9b('0xe6')],'as':_0x6e9b('0xe7'),'attributes':['id',_0x6e9b('0x37'),_0x6e9b('0xe8')],'where':_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0xe9')]?{'id':_0x196bde[_0x6e9b('0x3e')]['tag']}:undefined,'required':_0x196bde[_0x6e9b('0x3e')][_0x6e9b('0xe9')]?!![]:![]}];}return db['ChatInteraction'][_0x6e9b('0x63')](_0x21bddc);})['then'](function(_0x705aa3){_0x14c80a['rows']=_0x705aa3;return _0x14c80a;});}})[_0x6e9b('0x1e')](respondWithFilteredResult(_0x5814cf,_0x21bddc))[_0x6e9b('0x25')](handleError(_0x5814cf,null));};function iftimePromise(_0x5df4d9,_0x3910de){return respondWithRpcPromise(_0x6e9b('0xea'),_0x6e9b('0xeb'),{'command':_0x3910de[_0x6e9b('0xec')]?util[_0x6e9b('0xac')](_0x6e9b('0xed'),_0x5df4d9[_0x6e9b('0xee')],_0x3910de['timezone']):util[_0x6e9b('0xac')](_0x6e9b('0xef'),_0x5df4d9[_0x6e9b('0xee')])},client9002)[_0x6e9b('0x1e')](function(_0x4cd043){var _0x39b848=_0x4cd043&&_0x4cd043['indexOf']('true')>=0x0?!![]:![];logger['info'](_0x6e9b('0xf0'),_0x3910de['id'],_0x5df4d9['id'],_0x5df4d9['interval'],_0x39b848?'ONLINE':'OFFLINE',_0x3910de[_0x6e9b('0xec')]?_0x3910de[_0x6e9b('0xec')]:_0x6e9b('0xf1'));return _0x39b848;})[_0x6e9b('0x25')](function(_0x3ba56){logger[_0x6e9b('0x21')](_0x6e9b('0xf0'),_0x3910de['id'],_0x5df4d9['id'],_0x5df4d9['interval'],util[_0x6e9b('0xf2')](_0x3ba56,{'showHidden':![],'depth':null}),_0x3910de[_0x6e9b('0xec')]?_0x3910de[_0x6e9b('0xec')]:'No\x20timezone');return![];});}exports[_0x6e9b('0xeb')]=function(_0x591700,_0x1cf638,_0x4f8cf6){var _0x5648ae=0x0;var _0xd85701=0x0;var _0x3764c8=![];var _0x2f6f21;var _0x5a20ab;return db['ChatWebsite'][_0x6e9b('0x55')]({'where':{'id':_0x591700[_0x6e9b('0x51')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x6e9b('0xf3')],'as':_0x6e9b('0xf4'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x6e9b('0x1e')](handleEntityNotFound(_0x1cf638,null))[_0x6e9b('0x1e')](function(_0x445f08){if(_0x445f08){_0x2f6f21=_0x445f08;return _0x445f08[_0x6e9b('0xf5')]({'raw':!![]});}})['then'](function(_0xe68e04){if(_0x2f6f21){if(_0xe68e04){_0x5a20ab=_0xe68e04;}}return require(_0x6e9b('0x14'))['getLicense']();})[_0x6e9b('0x1e')](function(_0x304fe5){if(_0x304fe5){_0xd85701=_0x304fe5[_0x6e9b('0xf6')];_0x3764c8=_0x304fe5[_0x6e9b('0x72')];}})[_0x6e9b('0x1e')](function(){return db[_0x6e9b('0xb2')][_0x6e9b('0x2a')]({'where':{'closed':![]}});})[_0x6e9b('0x1e')](function(_0x1fdf93){_0x5648ae=_0x1fdf93;if(_0xd85701&&_0x1fdf93>_0xd85701){return db[_0x6e9b('0xf7')]['findOne']({'where':{'id':0x1}})[_0x6e9b('0x1e')](function(_0x5a7111){if(_0x5a7111){_0x5a7111[_0x6e9b('0xf8')](_0x6e9b('0xf9'));}});}})[_0x6e9b('0x1e')](function(){if(_0x2f6f21[_0x6e9b('0xf3')]&&_0x2f6f21[_0x6e9b('0xf3')]['Intervals']){var _0x7b8448=[];for(var _0x2100f6=0x0;_0x2100f6<_0x2f6f21[_0x6e9b('0xf3')]['Intervals'][_0x6e9b('0x44')];_0x2100f6++){var _0x8ce4f1=_0x2f6f21['Interval'][_0x6e9b('0xf4')][_0x2100f6]['get']({'plain':!![]});_0x7b8448['push'](iftimePromise(_0x8ce4f1,_0x2f6f21));}return BPromise[_0x6e9b('0xfa')](_0x7b8448)[_0x6e9b('0x1e')](function(_0x11d78a){return _[_0x6e9b('0xfb')](_0x11d78a);});}else{return!![];}})[_0x6e9b('0x1e')](function(_0x105976){var _0x137e0c=fs['readFileSync'](path[_0x6e9b('0x6e')](config[_0x6e9b('0x6f')],_0x6e9b('0xfc')),_0x6e9b('0xcd'));var _0x22a51e={'remote':_0x2f6f21[_0x6e9b('0xfd')],'query':querystring[_0x6e9b('0xfe')](_[_0x6e9b('0x49')](_0x2f6f21[_0x6e9b('0x34')]({'plain':!![]}),{'customerIp':_0x591700[_0x6e9b('0x82')][_0x6e9b('0xa3')]||_0x591700[_0x6e9b('0x82')]['x-real-ip']||_0x591700[_0x6e9b('0xff')]['remoteAddress']||_0x591700['ip'],'referer':_0x591700['headers'][_0x6e9b('0x100')],'openedInteractions':_0x5648ae,'maxInteractions':_0xd85701,'virtual':_0x3764c8[_0x6e9b('0xf6')],'online':_0x105976,'custom':_0x3764c8}))['replace'](/'/g,'\x5c\x27')};_0x1cf638['send'](ejs[_0x6e9b('0x101')](Mustache[_0x6e9b('0x101')](_0x137e0c,_0x22a51e),{'proactiveActions':_0x5a20ab,'alignment':_0x2f6f21[_0x6e9b('0x102')],'verticalAlignment':_0x2f6f21[_0x6e9b('0x103')],'div_color':_0x2f6f21[_0x6e9b('0xe8')],'text_color':_0x2f6f21[_0x6e9b('0x104')]}));})[_0x6e9b('0x25')](handleError(_0x1cf638,null));};exports[_0x6e9b('0x105')]=function(_0x257ce0,_0x1855f9,_0x3be015){return db[_0x6e9b('0x3a')]['findOne']({'where':{'id':_0x257ce0[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x1855f9,null))[_0x6e9b('0x1e')](function(_0x2448ce){if(_0x2448ce){return db[_0x6e9b('0x106')][_0x6e9b('0x107')](function(_0x34c191){return db[_0x6e9b('0x98')][_0x6e9b('0x33')]({'where':{'ChatWebsiteId':_0x257ce0['params']['id']},'transaction':_0x34c191})[_0x6e9b('0x1e')](function(_0x51af6c){var _0x451ae9=_[_0x6e9b('0x4a')](_0x257ce0['body'],function(_0x288db4){_0x288db4[_0x6e9b('0x5e')]=_0x257ce0[_0x6e9b('0x51')]['id'];return _0x288db4;});return db[_0x6e9b('0x98')]['bulkCreate'](_0x451ae9,{'transaction':_0x34c191});});})[_0x6e9b('0x1e')](function(){return db[_0x6e9b('0x98')][_0x6e9b('0x108')]({'where':{'ChatWebsiteId':_0x257ce0['params']['id']},'order':'priority'});});}})[_0x6e9b('0x1e')](respondWithResult(_0x1855f9,null))[_0x6e9b('0x25')](handleError(_0x1855f9,null));};exports[_0x6e9b('0x109')]=function(_0x399cf0,_0x3e0633,_0x5c9371){var _0x5dee75={};var _0x51da8d={};var _0x14f1bc;var _0x40744d;return db[_0x6e9b('0x3a')]['findOne']({'where':{'id':_0x399cf0['params']['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x3e0633,null))['then'](function(_0x273a56){if(_0x273a56){_0x14f1bc=_0x273a56;_0x51da8d[_0x6e9b('0x41')]=_['keys'](db[_0x6e9b('0x98')][_0x6e9b('0x52')]);_0x51da8d['query']=_[_0x6e9b('0x53')](_0x399cf0['query']);_0x51da8d[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x51da8d['model'],_0x51da8d['query']);_0x5dee75[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x51da8d['model'],qs['fields'](_0x399cf0[_0x6e9b('0x3e')]['fields']));_0x5dee75[_0x6e9b('0x43')]=_0x5dee75[_0x6e9b('0x43')][_0x6e9b('0x44')]?_0x5dee75[_0x6e9b('0x43')]:_0x51da8d['model'];_0x5dee75['order']=qs[_0x6e9b('0x47')](_0x399cf0[_0x6e9b('0x3e')]['sort']);_0x5dee75['where']=qs[_0x6e9b('0x3f')](_['pick'](_0x399cf0[_0x6e9b('0x3e')],_0x51da8d[_0x6e9b('0x3f')]));if(_0x399cf0[_0x6e9b('0x3e')][_0x6e9b('0x4c')]){_0x5dee75[_0x6e9b('0x48')]=_[_0x6e9b('0x49')](_0x5dee75[_0x6e9b('0x48')],{'$or':_[_0x6e9b('0x4a')](_0x5dee75[_0x6e9b('0x43')],function(_0x40bedc){var _0x53ce2f={};_0x53ce2f[_0x40bedc]={'$like':'%'+_0x399cf0['query'][_0x6e9b('0x4c')]+'%'};return _0x53ce2f;})});}_0x5dee75=_[_0x6e9b('0x49')]({},_0x5dee75,_0x399cf0[_0x6e9b('0x4d')]);return _0x14f1bc[_0x6e9b('0x109')](_0x5dee75);}})['then'](function(_0x430c69){if(_0x430c69){_0x40744d=_0x430c69['length'];if(!_0x399cf0[_0x6e9b('0x3e')][_0x6e9b('0x66')](_0x6e9b('0x45'))){_0x5dee75[_0x6e9b('0x2c')]=qs[_0x6e9b('0x2c')](_0x399cf0[_0x6e9b('0x3e')][_0x6e9b('0x2c')]);_0x5dee75[_0x6e9b('0x2b')]=qs[_0x6e9b('0x2b')](_0x399cf0[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}return _0x14f1bc[_0x6e9b('0x109')](_0x5dee75);}})[_0x6e9b('0x1e')](function(_0x33eee2){if(_0x33eee2){return _0x33eee2?{'count':_0x40744d,'rows':_0x33eee2}:null;}})[_0x6e9b('0x1e')](respondWithResult(_0x3e0633,null))[_0x6e9b('0x25')](handleError(_0x3e0633,null));};exports[_0x6e9b('0x10a')]=function(_0x587066,_0xc2a07d,_0x346072){return db[_0x6e9b('0x10b')][_0x6e9b('0x55')]({'where':{'id':_0x587066['params']['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0xc2a07d,null))[_0x6e9b('0x1e')](function(_0x4e33a6){if(_0x4e33a6){return _0x4e33a6[_0x6e9b('0x10a')](_0x587066[_0x6e9b('0x5b')][_0x6e9b('0xdf')],_[_0x6e9b('0x10c')](_0x587066[_0x6e9b('0x5b')],[_0x6e9b('0xdf'),'id'])||{});}})[_0x6e9b('0x1e')](respondWithResult(_0xc2a07d,null))[_0x6e9b('0x25')](handleError(_0xc2a07d,null));};exports[_0x6e9b('0xf5')]=function(_0x4ecfbf,_0x132061,_0x10666c){var _0x24e62e={};var _0x59590c={};var _0x1ee217;var _0x3c6bb9;return db[_0x6e9b('0x3a')][_0x6e9b('0x61')]({'where':{'id':_0x4ecfbf[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x132061,null))[_0x6e9b('0x1e')](function(_0x312d0a){if(_0x312d0a){_0x1ee217=_0x312d0a;_0x59590c[_0x6e9b('0x41')]=_[_0x6e9b('0x53')](db[_0x6e9b('0x10d')][_0x6e9b('0x52')]);_0x59590c[_0x6e9b('0x3e')]=_['keys'](_0x4ecfbf['query']);_0x59590c['filters']=_[_0x6e9b('0x40')](_0x59590c['model'],_0x59590c['query']);_0x24e62e[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x59590c[_0x6e9b('0x41')],qs['fields'](_0x4ecfbf[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0x24e62e['attributes']=_0x24e62e['attributes']['length']?_0x24e62e[_0x6e9b('0x43')]:_0x59590c['model'];_0x24e62e[_0x6e9b('0x46')]=qs[_0x6e9b('0x47')](_0x4ecfbf[_0x6e9b('0x3e')][_0x6e9b('0x47')]);_0x24e62e['where']=qs['filters'](_[_0x6e9b('0x62')](_0x4ecfbf['query'],_0x59590c[_0x6e9b('0x3f')]));if(_0x4ecfbf[_0x6e9b('0x3e')][_0x6e9b('0x4c')]){_0x24e62e[_0x6e9b('0x48')]=_[_0x6e9b('0x49')](_0x24e62e['where'],{'$or':_[_0x6e9b('0x4a')](_0x24e62e['attributes'],function(_0x1eeeab){var _0x34479f={};_0x34479f[_0x1eeeab]={'$like':'%'+_0x4ecfbf[_0x6e9b('0x3e')]['filter']+'%'};return _0x34479f;})});}_0x24e62e=_['merge']({},_0x24e62e,_0x4ecfbf[_0x6e9b('0x4d')]);return _0x1ee217['getProactiveActions'](_0x24e62e);}})[_0x6e9b('0x1e')](function(_0x12193f){if(_0x12193f){_0x3c6bb9=_0x12193f[_0x6e9b('0x44')];if(!_0x4ecfbf[_0x6e9b('0x3e')][_0x6e9b('0x66')](_0x6e9b('0x45'))){_0x24e62e[_0x6e9b('0x2c')]=qs['limit'](_0x4ecfbf['query'][_0x6e9b('0x2c')]);_0x24e62e['offset']=qs['offset'](_0x4ecfbf[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}return _0x1ee217['getProactiveActions'](_0x24e62e);}})[_0x6e9b('0x1e')](function(_0x5b7058){if(_0x5b7058){return _0x5b7058?{'count':_0x3c6bb9,'rows':_0x5b7058}:null;}})[_0x6e9b('0x1e')](respondWithResult(_0x132061,null))[_0x6e9b('0x25')](handleError(_0x132061,null));};exports['getFields']=function(_0x2c7564,_0x438516,_0x3da14e){var _0xd0002=_0x2c7564[_0x6e9b('0x3e')]['online']===_0x6e9b('0x10e')?_0x6e9b('0x10f'):_0x6e9b('0x110');return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'attributes':['id',_0xd0002],'where':{'id':_0x2c7564[_0x6e9b('0x51')]['id']}})['then'](handleEntityNotFound(_0x438516,null))[_0x6e9b('0x1e')](function(_0x16aa7b){if(_0x16aa7b){var _0x507e1f=_0x16aa7b[_0xd0002];var _0x237b72=_0x507e1f&&_0x507e1f[_0x6e9b('0x111')]?_0x507e1f['items']:[];_0x438516[_0x6e9b('0xc7')]({'fromKey':_[_0x6e9b('0x73')](_0x507e1f[_0x6e9b('0x112')])?undefined:_0x507e1f[_0x6e9b('0x112')],'count':_0x237b72[_0x6e9b('0x44')],'rows':_0x237b72});}})[_0x6e9b('0x25')](handleError(_0x438516,null));};exports['getOfflineMessages']=function(_0x2ecb72,_0xf1be0c,_0x2d28df){var _0x5a5d56={'raw':![],'where':{}};var _0x32a2b2={};var _0x41d7d4={'count':0x0,'rows':[]};return db[_0x6e9b('0x3a')][_0x6e9b('0x61')]({'where':{'id':_0x2ecb72[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0xf1be0c,null))['then'](function(_0x48b60a){if(_0x48b60a){_0x32a2b2[_0x6e9b('0x41')]=_[_0x6e9b('0x53')](db['ChatOfflineMessage'][_0x6e9b('0x52')]);_0x32a2b2[_0x6e9b('0x3e')]=_[_0x6e9b('0x53')](_0x2ecb72[_0x6e9b('0x3e')]);_0x32a2b2[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x32a2b2['model'],_0x32a2b2['query']);_0x5a5d56[_0x6e9b('0x43')]=_['intersection'](_0x32a2b2['model'],qs[_0x6e9b('0x42')](_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0x5a5d56['attributes']=_0x5a5d56['attributes'][_0x6e9b('0x44')]?_0x5a5d56[_0x6e9b('0x43')]:_0x32a2b2[_0x6e9b('0x41')];if(!_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x66')](_0x6e9b('0x45'))){_0x5a5d56['limit']=qs[_0x6e9b('0x2c')](_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x2c')]);_0x5a5d56[_0x6e9b('0x2b')]=qs[_0x6e9b('0x2b')](_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x2b')]);}_0x5a5d56[_0x6e9b('0x46')]=qs[_0x6e9b('0x47')](_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x47')]);_0x5a5d56[_0x6e9b('0x48')]=qs[_0x6e9b('0x3f')](_[_0x6e9b('0x62')](_0x2ecb72[_0x6e9b('0x3e')],_0x32a2b2['filters']));_0x5a5d56['where'][_0x6e9b('0x5e')]=_0x48b60a['id'];if(_0x2ecb72['query'][_0x6e9b('0x4c')]){_0x5a5d56[_0x6e9b('0x48')]=_['merge'](_0x5a5d56[_0x6e9b('0x48')],{'$or':_[_0x6e9b('0x4a')](_0x5a5d56['attributes'],function(_0x2f81e8){var _0x226347={};_0x226347[_0x2f81e8]={'$like':'%'+_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x4c')]+'%'};return _0x226347;})});}_0x5a5d56=_[_0x6e9b('0x49')]({},_0x5a5d56,_0x2ecb72[_0x6e9b('0x4d')]);return db['ChatOfflineMessage']['count']({'where':_0x5a5d56[_0x6e9b('0x48')]})[_0x6e9b('0x1e')](function(_0x32f081){_0x41d7d4[_0x6e9b('0x2a')]=_0x32f081;if(_0x2ecb72[_0x6e9b('0x3e')][_0x6e9b('0x4e')]){_0x5a5d56[_0x6e9b('0x54')]=[{'all':!![]}];}else{_0x5a5d56[_0x6e9b('0x54')]=[{'model':db[_0x6e9b('0x86')],'as':'Contact','required':![]}];}return db[_0x6e9b('0xd0')][_0x6e9b('0x63')](_0x5a5d56);})[_0x6e9b('0x1e')](function(_0x5d2cfb){_0x41d7d4[_0x6e9b('0x4f')]=_0x5d2cfb;return _0x41d7d4;});}})[_0x6e9b('0x1e')](respondWithFilteredResult(_0xf1be0c,_0x5a5d56))[_0x6e9b('0x25')](handleError(_0xf1be0c,null));};exports[_0x6e9b('0x113')]=function(_0x442fcf,_0x3d3673,_0x429cc7){return db['ChatWebsite'][_0x6e9b('0x55')]({'where':{'id':_0x442fcf[_0x6e9b('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d3673,null))[_0x6e9b('0x1e')](function(_0x357b2f){if(_0x357b2f){return _0x357b2f[_0x6e9b('0x113')](_0x442fcf[_0x6e9b('0x5b')][_0x6e9b('0xdf')],_[_0x6e9b('0x10c')](_0x442fcf[_0x6e9b('0x5b')],[_0x6e9b('0xdf'),'id'])||{})[_0x6e9b('0xb6')](function(_0x588d50){for(var _0x145834=0x0;_0x145834<_0x442fcf[_0x6e9b('0x5b')][_0x6e9b('0xdf')][_0x6e9b('0x44')];_0x145834+=0x1){socket[_0x6e9b('0x114')](_0x6e9b('0x115'),{'UserId':_0x442fcf[_0x6e9b('0x5b')]['ids'][_0x145834],'ChatWebsiteId':_0x442fcf[_0x6e9b('0x51')]['id']});}return _0x588d50;});}})[_0x6e9b('0x1e')](respondWithResult(_0x3d3673,null))[_0x6e9b('0x25')](handleError(_0x3d3673,null));};exports[_0x6e9b('0x116')]=function(_0x10ac7d,_0x19b6ec,_0x25660b){return db[_0x6e9b('0x3a')][_0x6e9b('0x55')]({'where':{'id':_0x10ac7d[_0x6e9b('0x51')]['id']}})['then'](handleEntityNotFound(_0x19b6ec,null))[_0x6e9b('0x1e')](function(_0x2a6563){if(_0x2a6563){return _0x2a6563['removeAgents'](_0x10ac7d[_0x6e9b('0x3e')]['ids'])[_0x6e9b('0x1e')](function(){if(_['isArray'](_0x10ac7d[_0x6e9b('0x3e')][_0x6e9b('0xdf')])){for(var _0x48e342=0x0;_0x48e342<_0x10ac7d[_0x6e9b('0x3e')][_0x6e9b('0xdf')]['length'];_0x48e342+=0x1){socket[_0x6e9b('0x114')](_0x6e9b('0x117'),{'UserId':Number(_0x10ac7d[_0x6e9b('0x3e')][_0x6e9b('0xdf')][_0x48e342]),'ChatWebsiteId':Number(_0x10ac7d['params']['id'])});}}else{socket[_0x6e9b('0x114')](_0x6e9b('0x117'),{'UserId':Number(_0x10ac7d[_0x6e9b('0x3e')]['ids']),'ChatWebsiteId':Number(_0x10ac7d[_0x6e9b('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x19b6ec,null))[_0x6e9b('0x25')](handleError(_0x19b6ec,null));};exports[_0x6e9b('0x118')]=function(_0x397379,_0x258e1d,_0x1ae22b){var _0x43f47c={};var _0x72fef={};var _0x31d090;var _0x4c3acf;return db[_0x6e9b('0x3a')][_0x6e9b('0x61')]({'where':{'id':_0x397379[_0x6e9b('0x51')]['id']}})[_0x6e9b('0x1e')](handleEntityNotFound(_0x258e1d,null))[_0x6e9b('0x1e')](function(_0x127249){if(_0x127249){_0x31d090=_0x127249;_0x72fef[_0x6e9b('0x41')]=_[_0x6e9b('0x53')](db['User'][_0x6e9b('0x52')]);_0x72fef[_0x6e9b('0x3e')]=_[_0x6e9b('0x53')](_0x397379[_0x6e9b('0x3e')]);_0x72fef[_0x6e9b('0x3f')]=_[_0x6e9b('0x40')](_0x72fef[_0x6e9b('0x41')],_0x72fef[_0x6e9b('0x3e')]);_0x43f47c[_0x6e9b('0x43')]=_[_0x6e9b('0x40')](_0x72fef[_0x6e9b('0x41')],qs['fields'](_0x397379[_0x6e9b('0x3e')][_0x6e9b('0x42')]));_0x43f47c[_0x6e9b('0x43')]=_0x43f47c[_0x6e9b('0x43')]['length']?_0x43f47c[_0x6e9b('0x43')]:_0x72fef[_0x6e9b('0x41')];_0x43f47c['order']=qs[_0x6e9b('0x47')](_0x397379[_0x6e9b('0x3e')][_0x6e9b('0x47')]);_0x43f47c[_0x6e9b('0x48')]=qs[_0x6e9b('0x3f')](_['pick'](_0x397379[_0x6e9b('0x3e')],_0x72fef['filters']));if(_0x397379[_0x6e9b('0x3e')][_0x6e9b('0x4c')]){_0x43f47c[_0x6e9b('0x48')]=_[_0x6e9b('0x49')](_0x43f47c[_0x6e9b('0x48')],{'$or':_[_0x6e9b('0x4a')](_0x43f47c[_0x6e9b('0x43')],function(_0x4715fc){var _0x15ff2e={};_0x15ff2e[_0x4715fc]={'$like':'%'+_0x397379['query']['filter']+'%'};return _0x15ff2e;})});}_0x43f47c=_[_0x6e9b('0x49')]({},_0x43f47c,_0x397379[_0x6e9b('0x4d')]);return _0x31d090[_0x6e9b('0x118')](_0x43f47c);}})['then'](function(_0x5343a0){if(_0x5343a0){_0x4c3acf=_0x5343a0[_0x6e9b('0x44')];if(!_0x397379[_0x6e9b('0x3e')][_0x6e9b('0x66')](_0x6e9b('0x45'))){_0x43f47c[_0x6e9b('0x2c')]=qs['limit'](_0x397379[_0x6e9b('0x3e')][_0x6e9b('0x2c')]);_0x43f47c['offset']=qs[_0x6e9b('0x2b')](_0x397379[_0x6e9b('0x3e')]['offset']);}return _0x31d090[_0x6e9b('0x118')](_0x43f47c);}})['then'](function(_0x44e019){if(_0x44e019){return _0x44e019?{'count':_0x4c3acf,'rows':_0x44e019}:null;}})['then'](respondWithResult(_0x258e1d,null))['catch'](handleError(_0x258e1d,null));}; \ No newline at end of file +var _0x7d0b=['chatLicenseExceeded','Intervals','all','some','utf8','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','addApplications','sequelize','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','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','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','get','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filter','merge','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getDispositions','findOne','Disposition','nolimit','order','pick','ChatWebsiteId','options','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','getLicense','isNil','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','Sequelize','createdAt','updatedAt','difference','from\x20is\x20mandatory','ValidationError','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','asc','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','no\x20available\x20attributes','CompanyId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','spread','readFileSync','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','fullname','internal','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','custom','License','increment'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x7d0b,0x13c));var _0xb7d0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7d0b[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xb7d0('0x0'));var emlformat=require(_0xb7d0('0x1'));var rimraf=require(_0xb7d0('0x2'));var zipdir=require(_0xb7d0('0x3'));var jsonpatch=require(_0xb7d0('0x4'));var rp=require(_0xb7d0('0x5'));var moment=require(_0xb7d0('0x6'));var BPromise=require(_0xb7d0('0x7'));var Mustache=require('mustache');var util=require(_0xb7d0('0x8'));var path=require(_0xb7d0('0x9'));var sox=require(_0xb7d0('0xa'));var csv=require(_0xb7d0('0xb'));var ejs=require(_0xb7d0('0xc'));var fs=require('fs');var _=require(_0xb7d0('0xd'));var squel=require('squel');var crypto=require(_0xb7d0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb7d0('0xf'));var toCsv=require(_0xb7d0('0xb'));var querystring=require(_0xb7d0('0x10'));var Papa=require(_0xb7d0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb7d0('0x12'));var as=require(_0xb7d0('0x13'));var hardwareService=require(_0xb7d0('0x14'));var logger=require(_0xb7d0('0x15'))(_0xb7d0('0x16'));var utils=require(_0xb7d0('0x17'));var config=require(_0xb7d0('0x18'));var licenseUtil=require(_0xb7d0('0x19'));var db=require(_0xb7d0('0x1a'))['db'];config[_0xb7d0('0x1b')]=_[_0xb7d0('0x1c')](config[_0xb7d0('0x1b')],{'host':_0xb7d0('0x1d'),'port':0x18eb});var socket=require(_0xb7d0('0x1e'))(new Redis(config['redis']));require(_0xb7d0('0x1f'))[_0xb7d0('0x20')](socket);var jayson=require(_0xb7d0('0x21'));var client=jayson[_0xb7d0('0x22')][_0xb7d0('0x23')]({'port':0x232c});var client9002=jayson[_0xb7d0('0x22')][_0xb7d0('0x23')]({'port':0x232a});var client9003=jayson[_0xb7d0('0x22')]['http']({'port':0x232b});function respondWithRpcPromise(_0xb096d1,_0x5018a2,_0x4eb40f,_0x3be0f1){return new BPromise(function(_0x5c6b38,_0x36951d){var _0x50e0a6=_0x3be0f1||client;return _0x50e0a6[_0xb7d0('0x24')](_0xb096d1,_0x4eb40f)[_0xb7d0('0x25')](function(_0x321ca9){logger['info'](_0xb7d0('0x26'),_0x5018a2,_0xb7d0('0x27'));logger[_0xb7d0('0x28')](_0xb7d0('0x29'),_0x5018a2,_0xb7d0('0x27'),JSON[_0xb7d0('0x2a')](_0x321ca9));if(_0x321ca9[_0xb7d0('0x2b')]){if(_0x321ca9[_0xb7d0('0x2b')][_0xb7d0('0x2c')]===0x1f4){logger['error'](_0xb7d0('0x26'),_0x5018a2,_0x321ca9[_0xb7d0('0x2b')][_0xb7d0('0x2d')]);return _0x36951d(_0x321ca9[_0xb7d0('0x2b')][_0xb7d0('0x2d')]);}logger['error'](_0xb7d0('0x26'),_0x5018a2,_0x321ca9['error'][_0xb7d0('0x2d')]);return _0x5c6b38(_0x321ca9['error'][_0xb7d0('0x2d')]);}else{logger[_0xb7d0('0x2e')](_0xb7d0('0x26'),_0x5018a2,'request\x20sent');_0x5c6b38(_0x321ca9[_0xb7d0('0x2f')]['message']);}})['catch'](function(_0x32fc12){logger['error'](_0xb7d0('0x26'),_0x5018a2,_0x32fc12);_0x36951d(_0x32fc12);});});}function respondWithStatusCode(_0x9a386e,_0x267efa){_0x267efa=_0x267efa||0xcc;return function(_0x2874aa){if(_0x2874aa){return _0x9a386e['sendStatus'](_0x267efa);}return _0x9a386e['status'](_0x267efa)[_0xb7d0('0x30')]();};}function respondWithResult(_0x4ec454,_0x1564f2){_0x1564f2=_0x1564f2||0xc8;return function(_0x1de6e0){if(_0x1de6e0){return _0x4ec454[_0xb7d0('0x31')](_0x1564f2)[_0xb7d0('0x32')](_0x1de6e0);}};}function respondWithFilteredResult(_0x162b69,_0x2d35a8){return function(_0x3785bb){if(_0x3785bb){var _0x5dd6c1=_0x3785bb[_0xb7d0('0x33')],_0x39f5d3=_0x2d35a8[_0xb7d0('0x34')],_0x144d66=_0x2d35a8[_0xb7d0('0x34')]+_0x2d35a8['limit'],_0x9eb694;if(_0x144d66>=_0x5dd6c1){_0x144d66=_0x5dd6c1;_0x9eb694=0xc8;}else{_0x9eb694=0xce;}_0x162b69[_0xb7d0('0x31')](_0x9eb694);return _0x162b69['set'](_0xb7d0('0x35'),_0x39f5d3+'-'+_0x144d66+'/'+_0x5dd6c1)[_0xb7d0('0x32')](_0x3785bb);}return null;};}function patchUpdates(_0x228550){return function(_0x4f1082){try{jsonpatch[_0xb7d0('0x36')](_0x4f1082,_0x228550,!![]);}catch(_0x5bc7cd){return BPromise[_0xb7d0('0x37')](_0x5bc7cd);}return _0x4f1082[_0xb7d0('0x38')]();};}function saveUpdates(_0x4d46e3,_0x488454){return function(_0x3986f9){if(_0x3986f9){return _0x3986f9[_0xb7d0('0x39')](_0x4d46e3)[_0xb7d0('0x25')](function(_0x21a0a6){return _0x21a0a6;});}return null;};}function removeEntity(_0x2bbe6d,_0x491c77){return function(_0x4dbd86){if(_0x4dbd86){return _0x4dbd86[_0xb7d0('0x3a')]()['then'](function(){var _0x5af08b=_0x4dbd86[_0xb7d0('0x3b')]({'plain':!![]});var _0x3ca700='ChatWebsites';return db['UserProfileResource'][_0xb7d0('0x3a')]({'where':{'type':_0x3ca700,'resourceId':_0x5af08b['id']}})['then'](function(){return _0x4dbd86;});})[_0xb7d0('0x25')](function(){_0x2bbe6d[_0xb7d0('0x31')](0xcc)[_0xb7d0('0x30')]();});}};}function handleEntityNotFound(_0x926b4f,_0x2ef0a5){return function(_0x231b76){if(!_0x231b76){_0x926b4f['sendStatus'](0x194);}return _0x231b76;};}function handleError(_0x27115b,_0x503603){_0x503603=_0x503603||0x1f4;return function(_0xb964ab){logger[_0xb7d0('0x2b')](_0xb964ab[_0xb7d0('0x3c')]);if(_0xb964ab[_0xb7d0('0x3d')]){delete _0xb964ab[_0xb7d0('0x3d')];}_0x27115b[_0xb7d0('0x31')](_0x503603)['send'](_0xb964ab);};}exports[_0xb7d0('0x3e')]=function(_0x11200b,_0x3e9bb0){var _0xdc0650={'include':[{'model':db[_0xb7d0('0x3f')],'as':_0xb7d0('0x40')}]},_0x59e934={},_0x5d5055={'count':0x0,'rows':[]};var _0xfe5057=_[_0xb7d0('0x41')](db[_0xb7d0('0x42')]['rawAttributes'],function(_0xe9c11c){return{'name':_0xe9c11c[_0xb7d0('0x43')],'type':_0xe9c11c[_0xb7d0('0x44')][_0xb7d0('0x45')]};});_0x59e934[_0xb7d0('0x46')]=_[_0xb7d0('0x41')](_0xfe5057,'name');_0x59e934[_0xb7d0('0x47')]=_[_0xb7d0('0x48')](_0x11200b[_0xb7d0('0x47')]);_0x59e934[_0xb7d0('0x49')]=_[_0xb7d0('0x4a')](_0x59e934['model'],_0x59e934[_0xb7d0('0x47')]);_0xdc0650['attributes']=_['intersection'](_0x59e934['model'],qs[_0xb7d0('0x4b')](_0x11200b['query']['fields']));_0xdc0650[_0xb7d0('0x4c')]=_0xdc0650[_0xb7d0('0x4c')][_0xb7d0('0x4d')]?_0xdc0650[_0xb7d0('0x4c')]:_0x59e934['model'];if(!_0x11200b[_0xb7d0('0x47')][_0xb7d0('0x4e')]('nolimit')){_0xdc0650['limit']=qs[_0xb7d0('0x4f')](_0x11200b[_0xb7d0('0x47')][_0xb7d0('0x4f')]);_0xdc0650['offset']=qs[_0xb7d0('0x34')](_0x11200b[_0xb7d0('0x47')][_0xb7d0('0x34')]);}_0xdc0650['order']=qs[_0xb7d0('0x50')](_0x11200b[_0xb7d0('0x47')][_0xb7d0('0x50')]);_0xdc0650[_0xb7d0('0x51')]=qs[_0xb7d0('0x49')](_['pick'](_0x11200b[_0xb7d0('0x47')],_0x59e934[_0xb7d0('0x49')]),_0xfe5057);if(_0x11200b[_0xb7d0('0x47')][_0xb7d0('0x52')]){_0xdc0650['where']=_[_0xb7d0('0x53')](_0xdc0650[_0xb7d0('0x51')],{'$or':_[_0xb7d0('0x41')](_0xfe5057,function(_0x139b7c){if(_0x139b7c['type']!=='VIRTUAL'){var _0x459925={};_0x459925[_0x139b7c['name']]={'$like':'%'+_0x11200b[_0xb7d0('0x47')]['filter']+'%'};return _0x459925;}})});}_0xdc0650=_['merge']({},_0xdc0650,_0x11200b['options']);var _0x261c75={'where':_0xdc0650['where']};return db[_0xb7d0('0x42')][_0xb7d0('0x33')](_0x261c75)['then'](function(_0xf454d5){_0x5d5055['count']=_0xf454d5;if(_0x11200b[_0xb7d0('0x47')]['includeAll']){_0xdc0650[_0xb7d0('0x54')]=[{'all':!![]}];}return db[_0xb7d0('0x42')]['findAll'](_0xdc0650);})[_0xb7d0('0x25')](function(_0x46587e){_0x5d5055[_0xb7d0('0x55')]=_0x46587e;return _0x5d5055;})[_0xb7d0('0x25')](respondWithFilteredResult(_0x3e9bb0,_0xdc0650))[_0xb7d0('0x56')](handleError(_0x3e9bb0,null));};exports[_0xb7d0('0x57')]=function(_0x21afdf,_0x41876b){var _0x118bb8={'raw':![],'where':{'id':_0x21afdf[_0xb7d0('0x58')]['id']},'include':[{'model':db[_0xb7d0('0x3f')],'as':_0xb7d0('0x40')}]},_0x507492={};_0x507492['model']=_[_0xb7d0('0x48')](db[_0xb7d0('0x42')][_0xb7d0('0x59')]);_0x507492['query']=_[_0xb7d0('0x48')](_0x21afdf[_0xb7d0('0x47')]);_0x507492[_0xb7d0('0x49')]=_['intersection'](_0x507492[_0xb7d0('0x46')],_0x507492['query']);_0x118bb8[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0x507492[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0x21afdf[_0xb7d0('0x47')][_0xb7d0('0x4b')]));_0x118bb8[_0xb7d0('0x4c')]=_0x118bb8[_0xb7d0('0x4c')]['length']?_0x118bb8[_0xb7d0('0x4c')]:_0x507492[_0xb7d0('0x46')];if(_0x21afdf['query'][_0xb7d0('0x5a')]){_0x118bb8[_0xb7d0('0x54')]=[{'all':!![]}];}_0x118bb8=_[_0xb7d0('0x53')]({},_0x118bb8,_0x21afdf['options']);return db[_0xb7d0('0x42')][_0xb7d0('0x5b')](_0x118bb8)['then'](handleEntityNotFound(_0x41876b,null))['then'](respondWithResult(_0x41876b,null))[_0xb7d0('0x56')](handleError(_0x41876b,null));};exports[_0xb7d0('0x5c')]=function(_0x2f3d7e,_0x4d1d69){return db[_0xb7d0('0x42')][_0xb7d0('0x5c')](_0x2f3d7e[_0xb7d0('0x5d')],{})[_0xb7d0('0x25')](function(_0xeeef9c){var _0x325cde=_0x2f3d7e[_0xb7d0('0x5e')][_0xb7d0('0x3b')]({'plain':!![]});if(!_0x325cde)throw new Error(_0xb7d0('0x5f'));if(_0x325cde[_0xb7d0('0x60')]===_0xb7d0('0x5e')){var _0x4f5571=_0xeeef9c[_0xb7d0('0x3b')]({'plain':!![]});var _0x3e6470=_0xb7d0('0x61');return db[_0xb7d0('0x62')]['find']({'where':{'name':_0x3e6470,'userProfileId':_0x325cde[_0xb7d0('0x63')]},'raw':!![]})[_0xb7d0('0x25')](function(_0x18edcf){if(_0x18edcf&&_0x18edcf[_0xb7d0('0x64')]===0x0){return db[_0xb7d0('0x65')]['create']({'name':_0x4f5571[_0xb7d0('0x3d')],'resourceId':_0x4f5571['id'],'type':_0x18edcf['name'],'sectionId':_0x18edcf['id']},{})[_0xb7d0('0x25')](function(){return _0xeeef9c;});}else{return _0xeeef9c;}})[_0xb7d0('0x56')](function(_0xa48e4){logger['error'](_0xb7d0('0x66'),_0xa48e4);throw _0xa48e4;});}return _0xeeef9c;})[_0xb7d0('0x25')](respondWithResult(_0x4d1d69,0xc9))[_0xb7d0('0x56')](handleError(_0x4d1d69,null));};exports[_0xb7d0('0x39')]=function(_0x9524ed,_0x56b69a){if(_0x9524ed[_0xb7d0('0x5d')]['id']){delete _0x9524ed[_0xb7d0('0x5d')]['id'];}return db[_0xb7d0('0x42')]['find']({'where':{'id':_0x9524ed['params']['id']},'include':[{'model':db[_0xb7d0('0x3f')],'as':_0xb7d0('0x40')}]})[_0xb7d0('0x25')](handleEntityNotFound(_0x56b69a,null))[_0xb7d0('0x25')](saveUpdates(_0x9524ed[_0xb7d0('0x5d')],null))[_0xb7d0('0x25')](respondWithResult(_0x56b69a,null))[_0xb7d0('0x56')](handleError(_0x56b69a,null));};exports[_0xb7d0('0x3a')]=function(_0x902ab2,_0xf52aee){return db[_0xb7d0('0x42')]['find']({'where':{'id':_0x902ab2['params']['id']}})['then'](handleEntityNotFound(_0xf52aee,null))['then'](removeEntity(_0xf52aee,null))['catch'](handleError(_0xf52aee,null));};exports[_0xb7d0('0x67')]=function(_0x404c5a,_0x3a9017){return db[_0xb7d0('0x42')][_0xb7d0('0x67')]()['then'](respondWithResult(_0x3a9017,null))[_0xb7d0('0x56')](handleError(_0x3a9017,null));};exports['addDisposition']=function(_0x17d015,_0x292e58,_0x2105bf){if(_0x17d015[_0xb7d0('0x5d')]['id']){delete _0x17d015[_0xb7d0('0x5d')]['id'];}return db[_0xb7d0('0x42')]['find']({'where':{'id':_0x17d015[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x292e58,null))['then'](function(_0x4aed43){if(_0x4aed43){_0x17d015[_0xb7d0('0x5d')]['ChatWebsiteId']=_0x4aed43['id'];return db['Disposition'][_0xb7d0('0x5c')](_0x17d015['body']);}})[_0xb7d0('0x25')](respondWithResult(_0x292e58,null))[_0xb7d0('0x56')](handleError(_0x292e58,null));};exports[_0xb7d0('0x68')]=function(_0xa51b23,_0x516704,_0x4b6fba){var _0x2a7eeb={'raw':![],'where':{}};var _0x599ebd={};var _0x56cf59={'count':0x0,'rows':[]};return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0xa51b23[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x516704,null))['then'](function(_0x5af5ea){if(_0x5af5ea){_0x599ebd['model']=_[_0xb7d0('0x48')](db[_0xb7d0('0x6a')][_0xb7d0('0x59')]);_0x599ebd[_0xb7d0('0x47')]=_[_0xb7d0('0x48')](_0xa51b23[_0xb7d0('0x47')]);_0x599ebd['filters']=_[_0xb7d0('0x4a')](_0x599ebd[_0xb7d0('0x46')],_0x599ebd['query']);_0x2a7eeb[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0x599ebd[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0xa51b23[_0xb7d0('0x47')]['fields']));_0x2a7eeb[_0xb7d0('0x4c')]=_0x2a7eeb[_0xb7d0('0x4c')][_0xb7d0('0x4d')]?_0x2a7eeb[_0xb7d0('0x4c')]:_0x599ebd[_0xb7d0('0x46')];if(!_0xa51b23[_0xb7d0('0x47')]['hasOwnProperty'](_0xb7d0('0x6b'))){_0x2a7eeb['limit']=qs[_0xb7d0('0x4f')](_0xa51b23['query'][_0xb7d0('0x4f')]);_0x2a7eeb[_0xb7d0('0x34')]=qs[_0xb7d0('0x34')](_0xa51b23[_0xb7d0('0x47')][_0xb7d0('0x34')]);}_0x2a7eeb[_0xb7d0('0x6c')]=qs[_0xb7d0('0x50')](_0xa51b23[_0xb7d0('0x47')][_0xb7d0('0x50')]);_0x2a7eeb['where']=qs[_0xb7d0('0x49')](_[_0xb7d0('0x6d')](_0xa51b23[_0xb7d0('0x47')],_0x599ebd[_0xb7d0('0x49')]));_0x2a7eeb[_0xb7d0('0x51')][_0xb7d0('0x6e')]=_0x5af5ea['id'];if(_0xa51b23[_0xb7d0('0x47')][_0xb7d0('0x52')]){_0x2a7eeb[_0xb7d0('0x51')]=_[_0xb7d0('0x53')](_0x2a7eeb[_0xb7d0('0x51')],{'$or':_[_0xb7d0('0x41')](_0x2a7eeb[_0xb7d0('0x4c')],function(_0x42713d){var _0x37f75c={};_0x37f75c[_0x42713d]={'$like':'%'+_0xa51b23[_0xb7d0('0x47')][_0xb7d0('0x52')]+'%'};return _0x37f75c;})});}_0x2a7eeb=_[_0xb7d0('0x53')]({},_0x2a7eeb,_0xa51b23[_0xb7d0('0x6f')]);return db['Disposition']['count']({'where':_0x2a7eeb['where']})[_0xb7d0('0x25')](function(_0x17887e){_0x56cf59[_0xb7d0('0x33')]=_0x17887e;if(_0xa51b23['query'][_0xb7d0('0x5a')]){_0x2a7eeb[_0xb7d0('0x54')]=[{'all':!![]}];}return db[_0xb7d0('0x6a')][_0xb7d0('0x70')](_0x2a7eeb);})[_0xb7d0('0x25')](function(_0x4d0b27){_0x56cf59[_0xb7d0('0x55')]=_0x4d0b27;return _0x56cf59;});}})[_0xb7d0('0x25')](respondWithFilteredResult(_0x516704,_0x2a7eeb))[_0xb7d0('0x56')](handleError(_0x516704,null));};exports[_0xb7d0('0x71')]=function(_0xcb14b8,_0x1a2668,_0x3ca5a4){return db['ChatWebsite'][_0xb7d0('0x5b')]({'where':{'id':_0xcb14b8['params']['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x1a2668,null))['then'](function(_0x5b7145){if(_0x5b7145){return _0x5b7145[_0xb7d0('0x71')](_0xcb14b8[_0xb7d0('0x47')][_0xb7d0('0x72')]);}})[_0xb7d0('0x25')](respondWithStatusCode(_0x1a2668,null))[_0xb7d0('0x56')](handleError(_0x1a2668,null));};exports['addAnswer']=function(_0x2cf630,_0x1a47f7,_0x821ecb){if(_0x2cf630['body']['id']){delete _0x2cf630[_0xb7d0('0x5d')]['id'];}return db[_0xb7d0('0x42')]['find']({'where':{'id':_0x2cf630[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x1a47f7,null))[_0xb7d0('0x25')](function(_0x58c5c4){if(_0x58c5c4){_0x2cf630['body'][_0xb7d0('0x6e')]=_0x58c5c4['id'];return db['CannedAnswer'][_0xb7d0('0x5c')](_0x2cf630[_0xb7d0('0x5d')]);}})['then'](respondWithResult(_0x1a47f7,null))[_0xb7d0('0x56')](handleError(_0x1a47f7,null));};exports[_0xb7d0('0x73')]=function(_0xa0fb5e,_0xb9d1fd,_0x47e84b){var _0x491d42={'raw':![],'where':{}};var _0xfa3671={};var _0x96b378={'count':0x0,'rows':[]};return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0xa0fb5e['params']['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0xb9d1fd,null))[_0xb7d0('0x25')](function(_0x14f394){if(_0x14f394){_0xfa3671[_0xb7d0('0x46')]=_[_0xb7d0('0x48')](db[_0xb7d0('0x74')]['rawAttributes']);_0xfa3671['query']=_[_0xb7d0('0x48')](_0xa0fb5e[_0xb7d0('0x47')]);_0xfa3671[_0xb7d0('0x49')]=_[_0xb7d0('0x4a')](_0xfa3671['model'],_0xfa3671[_0xb7d0('0x47')]);_0x491d42[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0xfa3671[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0xa0fb5e['query'][_0xb7d0('0x4b')]));_0x491d42['attributes']=_0x491d42['attributes'][_0xb7d0('0x4d')]?_0x491d42[_0xb7d0('0x4c')]:_0xfa3671[_0xb7d0('0x46')];if(!_0xa0fb5e[_0xb7d0('0x47')][_0xb7d0('0x4e')](_0xb7d0('0x6b'))){_0x491d42[_0xb7d0('0x4f')]=qs[_0xb7d0('0x4f')](_0xa0fb5e[_0xb7d0('0x47')][_0xb7d0('0x4f')]);_0x491d42[_0xb7d0('0x34')]=qs['offset'](_0xa0fb5e[_0xb7d0('0x47')][_0xb7d0('0x34')]);}_0x491d42[_0xb7d0('0x6c')]=qs[_0xb7d0('0x50')](_0xa0fb5e[_0xb7d0('0x47')][_0xb7d0('0x50')]);_0x491d42[_0xb7d0('0x51')]=qs[_0xb7d0('0x49')](_[_0xb7d0('0x6d')](_0xa0fb5e[_0xb7d0('0x47')],_0xfa3671[_0xb7d0('0x49')]));_0x491d42[_0xb7d0('0x51')]['ChatWebsiteId']=_0x14f394['id'];if(_0xa0fb5e['query']['filter']){_0x491d42[_0xb7d0('0x51')]=_[_0xb7d0('0x53')](_0x491d42[_0xb7d0('0x51')],{'$or':_[_0xb7d0('0x41')](_0x491d42['attributes'],function(_0xe6540b){var _0x278e55={};_0x278e55[_0xe6540b]={'$like':'%'+_0xa0fb5e[_0xb7d0('0x47')][_0xb7d0('0x52')]+'%'};return _0x278e55;})});}_0x491d42=_['merge']({},_0x491d42,_0xa0fb5e[_0xb7d0('0x6f')]);return db[_0xb7d0('0x74')]['count']({'where':_0x491d42[_0xb7d0('0x51')]})[_0xb7d0('0x25')](function(_0x2b614f){_0x96b378[_0xb7d0('0x33')]=_0x2b614f;if(_0xa0fb5e[_0xb7d0('0x47')][_0xb7d0('0x5a')]){_0x491d42[_0xb7d0('0x54')]=[{'all':!![]}];}return db[_0xb7d0('0x74')][_0xb7d0('0x70')](_0x491d42);})[_0xb7d0('0x25')](function(_0x33631b){_0x96b378['rows']=_0x33631b;return _0x96b378;});}})['then'](respondWithFilteredResult(_0xb9d1fd,_0x491d42))['catch'](handleError(_0xb9d1fd,null));};exports[_0xb7d0('0x75')]=function(_0x3af97d,_0x2b810e,_0x38bc51){return db[_0xb7d0('0x42')][_0xb7d0('0x5b')]({'where':{'id':_0x3af97d[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x2b810e,null))[_0xb7d0('0x25')](function(_0x15fc40){if(_0x15fc40){return _0x15fc40[_0xb7d0('0x75')](_0x3af97d[_0xb7d0('0x47')]['ids']);}})[_0xb7d0('0x25')](respondWithStatusCode(_0x2b810e,null))[_0xb7d0('0x56')](handleError(_0x2b810e,null));};exports[_0xb7d0('0x76')]=function(_0x1c6479,_0x4a33b2,_0xcaccc5){_0x1c6479[_0xb7d0('0x5d')][_0xb7d0('0x77')]=_0x1c6479[_0xb7d0('0x78')]['filename'];return db['ChatWebsite'][_0xb7d0('0x5b')]({'where':{'id':_0x1c6479[_0xb7d0('0x58')]['id']}})['then'](handleEntityNotFound(_0x4a33b2,null))[_0xb7d0('0x25')](saveUpdates(_0x1c6479[_0xb7d0('0x5d')],null))[_0xb7d0('0x25')](respondWithResult(_0x4a33b2,null))[_0xb7d0('0x56')](handleError(_0x4a33b2,null));};exports[_0xb7d0('0x79')]=function(_0x30d656,_0x21f05a,_0x28323b){_0x30d656[_0xb7d0('0x5d')][_0xb7d0('0x7a')]=_0x30d656['file'][_0xb7d0('0x7b')];return db[_0xb7d0('0x42')][_0xb7d0('0x5b')]({'where':{'id':_0x30d656['params']['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x21f05a,null))[_0xb7d0('0x25')](saveUpdates(_0x30d656[_0xb7d0('0x5d')],null))[_0xb7d0('0x25')](respondWithResult(_0x21f05a,null))[_0xb7d0('0x56')](handleError(_0x21f05a,null));};exports[_0xb7d0('0x7c')]=function(_0x55bf5a,_0x2222ea,_0x4f393e){_0x55bf5a['body'][_0xb7d0('0x7d')]=_0x55bf5a['file'][_0xb7d0('0x7b')];return db['ChatWebsite'][_0xb7d0('0x5b')]({'where':{'id':_0x55bf5a[_0xb7d0('0x58')]['id']}})['then'](handleEntityNotFound(_0x2222ea,null))['then'](saveUpdates(_0x55bf5a['body'],null))['then'](respondWithResult(_0x2222ea,null))[_0xb7d0('0x56')](handleError(_0x2222ea,null));};exports[_0xb7d0('0x7e')]=function(_0x36446d,_0x349701,_0x2d61a0){_0x36446d[_0xb7d0('0x5d')]['systemAvatar']=_0x36446d[_0xb7d0('0x78')][_0xb7d0('0x7b')];return db['ChatWebsite'][_0xb7d0('0x5b')]({'where':{'id':_0x36446d['params']['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x349701,null))['then'](saveUpdates(_0x36446d[_0xb7d0('0x5d')],null))['then'](respondWithResult(_0x349701,null))[_0xb7d0('0x56')](handleError(_0x349701,null));};exports[_0xb7d0('0x7f')]=function(_0x173e8a,_0x1d5b3e,_0x18a7bd){var _0x4fb45e=path['join'](config[_0xb7d0('0x80')],'server/files/images/logos/default_logo.svg');var _0x337a47={'where':{'id':_0x173e8a[_0xb7d0('0x58')]['id']},'attributes':['id',_0xb7d0('0x77')],'raw':!![]};var _0x117701=![];return require(_0xb7d0('0x19'))[_0xb7d0('0x81')]()['then'](function(_0x1621a9){if(_0x1621a9){_0x117701=_0x1621a9['custom'];}})[_0xb7d0('0x25')](function(){return db[_0xb7d0('0x42')][_0xb7d0('0x5b')](_0x337a47);})['then'](handleEntityNotFound(_0x1d5b3e,null))['then'](function(_0x1faa99){if(_0x1faa99){if(!_[_0xb7d0('0x82')](_0x1faa99[_0xb7d0('0x77')])){if(fs[_0xb7d0('0x83')](path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],_0xb7d0('0x85'),_0x1faa99['sitepic']))&&_0x117701){_0x4fb45e=path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],_0xb7d0('0x85'),_0x1faa99[_0xb7d0('0x77')]);}}return _0x1d5b3e['download'](_0x4fb45e);}})[_0xb7d0('0x56')](handleError(_0x1d5b3e,null));};exports[_0xb7d0('0x86')]=function(_0x161e46,_0x43bbe8,_0x5a943c){var _0x76927=path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],_0xb7d0('0x87'));var _0x19cf3d={'where':{'id':_0x161e46['params']['id']},'attributes':['id',_0xb7d0('0x7a')],'raw':!![]};return db[_0xb7d0('0x42')][_0xb7d0('0x5b')](_0x19cf3d)[_0xb7d0('0x25')](handleEntityNotFound(_0x43bbe8,null))['then'](function(_0x39105a){if(_0x39105a){if(!_[_0xb7d0('0x82')](_0x39105a[_0xb7d0('0x7a')])){if(fs[_0xb7d0('0x83')](path['join'](config[_0xb7d0('0x80')],_0xb7d0('0x88'),_0x39105a[_0xb7d0('0x7a')]))){_0x76927=path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],_0xb7d0('0x88'),_0x39105a[_0xb7d0('0x7a')]);}}return _0x43bbe8[_0xb7d0('0x89')](_0x76927);}})['catch'](handleError(_0x43bbe8,null));};exports[_0xb7d0('0x8a')]=function(_0x3adf49,_0x1b552d,_0x30a0ba){var _0xb2ac06=path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],'server/files/images/avatars/customer_avatar.png');var _0x14f530={'where':{'id':_0x3adf49[_0xb7d0('0x58')]['id']},'attributes':['id',_0xb7d0('0x7d'),_0xb7d0('0x8b')],'raw':!![]};return db[_0xb7d0('0x42')][_0xb7d0('0x5b')](_0x14f530)[_0xb7d0('0x25')](handleEntityNotFound(_0x1b552d,null))[_0xb7d0('0x25')](function(_0x577c74){if(_0x577c74){if(!_[_0xb7d0('0x82')](_0x577c74[_0xb7d0('0x7d')])){if(fs[_0xb7d0('0x83')](path[_0xb7d0('0x84')](config['root'],_0xb7d0('0x88'),_0x577c74[_0xb7d0('0x7d')]))&&_0x577c74[_0xb7d0('0x8b')]){_0xb2ac06=path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],_0xb7d0('0x88'),_0x577c74['customerAvatar']);}}return _0x1b552d[_0xb7d0('0x89')](_0xb2ac06);}})[_0xb7d0('0x56')](handleError(_0x1b552d,null));};exports[_0xb7d0('0x8c')]=function(_0x34aa45,_0x98a2c,_0x246d08){var _0x49a9c0=path[_0xb7d0('0x84')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x491b95={'where':{'id':_0x34aa45[_0xb7d0('0x58')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xb7d0('0x42')][_0xb7d0('0x5b')](_0x491b95)[_0xb7d0('0x25')](handleEntityNotFound(_0x98a2c,null))['then'](function(_0x536386){if(_0x536386){if(!_[_0xb7d0('0x82')](_0x536386[_0xb7d0('0x8d')])){if(fs[_0xb7d0('0x83')](path[_0xb7d0('0x84')](config['root'],_0xb7d0('0x88'),_0x536386[_0xb7d0('0x8d')]))){_0x49a9c0=path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],_0xb7d0('0x88'),_0x536386[_0xb7d0('0x8d')]);}}return _0x98a2c['download'](_0x49a9c0);}})[_0xb7d0('0x56')](handleError(_0x98a2c,null));};exports[_0xb7d0('0x8e')]=function(_0xd83049,_0x422e6d,_0x45c885){var _0x1d7692=require(_0xb7d0('0x8f'));var _0x53587b=new _0x1d7692();var _0x11c47a=_0x53587b[_0xb7d0('0x90')](_0xd83049['headers'][_0xb7d0('0x91')])[_0xb7d0('0x92')]();var _0x504c92={'body':_0xd83049[_0xb7d0('0x5d')],'channel':'chat'};var _0x57e4f2=[];var _0x2cd8eb=[];var _0x1955a9={};var _0x29cf76=![];return db[_0xb7d0('0x93')][_0xb7d0('0x67')]()[_0xb7d0('0x25')](function(_0x47f595){if(!_0x47f595){throw new db[(_0xb7d0('0x94'))]['ValidationError']('no\x20available\x20attributes');}_0x57e4f2=_['difference'](_[_0xb7d0('0x48')](_0x47f595),[_0xb7d0('0x95'),_0xb7d0('0x96')]);_0x2cd8eb=_[_0xb7d0('0x97')](_[_0xb7d0('0x48')](_0x47f595),[_0xb7d0('0x95'),_0xb7d0('0x96'),'CompanyId','ListId']);if(_0xd83049[_0xb7d0('0x5d')]['id']){delete _0xd83049[_0xb7d0('0x5d')]['id'];}if(_[_0xb7d0('0x82')](_0xd83049[_0xb7d0('0x5d')]['from'])){throw new db[(_0xb7d0('0x94'))]['ValidationError'](_0xb7d0('0x98'));}if(_[_0xb7d0('0x82')](_0xd83049[_0xb7d0('0x5d')]['body'])||_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0x5d')]===''){throw new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb7d0('0x82')](_0xd83049[_0xb7d0('0x5d')]['mapKey'])){throw new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2cd8eb);}if(!_[_0xb7d0('0x9a')](_0x2cd8eb,_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0x9b')])){throw new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))](_0xb7d0('0x9c')+_0x2cd8eb);}_0x1955a9[_0xd83049[_0xb7d0('0x5d')]['mapKey']]=_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0x9d')];})[_0xb7d0('0x25')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xd83049[_0xb7d0('0x58')]['id']},'include':[{'model':db[_0xb7d0('0x9e')],'as':_0xb7d0('0x9f'),'include':[{'model':db[_0xb7d0('0x93')],'as':_0xb7d0('0xa0'),'where':_0x1955a9,'limit':0x1,'order':[[_0xb7d0('0x96'),'DESC']]}]},{'model':db[_0xb7d0('0xa1')],'as':_0xb7d0('0xa2')}]});})[_0xb7d0('0x25')](handleEntityNotFound(_0x422e6d,null))['then'](function(_0x1f6649){if(_0x1f6649&&_0x1f6649['List']){_0x504c92[_0xb7d0('0xa3')]=_0x1f6649;_0x504c92[_0xb7d0('0xa4')]=_0x1f6649[_0xb7d0('0xa2')];_0x504c92[_0xb7d0('0xa5')]=_0x1f6649[_0xb7d0('0x9f')];_0x504c92[_0xb7d0('0xa4')]=_[_0xb7d0('0xa6')](_0x504c92[_0xb7d0('0xa4')],['priority'],[_0xb7d0('0xa7')]);if(_0x504c92['account']['Applications']){delete _0x504c92[_0xb7d0('0xa3')][_0xb7d0('0xa2')];}if(_0x504c92[_0xb7d0('0xa3')][_0xb7d0('0x9f')]&&_0x504c92['account']['List']['Contacts'][_0xb7d0('0x4d')]){return _0x504c92[_0xb7d0('0xa3')][_0xb7d0('0x9f')][_0xb7d0('0xa0')][0x0];}var _0x5e04eb=_[_0xb7d0('0x1c')](_0xd83049[_0xb7d0('0x5d')],{'firstName':_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0x9d')],'ListId':_0x1f6649[_0xb7d0('0xa8')]});_0x5e04eb[_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0x9b')]]=_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0x9d')];return db[_0xb7d0('0x93')][_0xb7d0('0x5c')](_0x5e04eb,{'fields':_0x57e4f2,'raw':!![]});}})['then'](handleEntityNotFound(_0x422e6d,null))[_0xb7d0('0x25')](function(_0x313979){_0x504c92[_0xb7d0('0xa9')]=_0x313979;var _0x29f22a=_0xd83049['body'][_0xb7d0('0xaa')];if(_0xd83049[_0xb7d0('0xab')][_0xb7d0('0xac')]){_0x29f22a=_0xd83049[_0xb7d0('0xab')]['cf-connecting-ip'];}else if(_0xd83049[_0xb7d0('0xab')][_0xb7d0('0xad')]){_0x29f22a=_['first'](_0xd83049['headers'][_0xb7d0('0xad')][_0xb7d0('0xae')](','));}if(_0x313979){var _0x2743c3={'ContactId':_0x313979['id'],'ChatWebsiteId':_0xd83049[_0xb7d0('0x58')]['id'],'from':(_0x313979[_0xb7d0('0xaf')]||'')+'\x20'+(_0x313979[_0xb7d0('0xb0')]||''),'customerIp':_0x29f22a,'customerPort':_0xd83049['headers']['x-real-port']?_0xd83049[_0xb7d0('0xab')]['x-real-port']:null,'referer':_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xb1')],'browserName':_0x11c47a['browser'][_0xb7d0('0x3d')]&&_0x11c47a[_0xb7d0('0xb2')][_0xb7d0('0xb3')]?util[_0xb7d0('0xb4')](_0xb7d0('0xb5'),_0x11c47a['browser'][_0xb7d0('0x3d')],_0x11c47a['browser']['version']):_0xb7d0('0xb6'),'browserVersion':_0x11c47a[_0xb7d0('0xb2')][_0xb7d0('0xb3')]||'unknown','osName':util['format'](_0xb7d0('0xb5'),_0x11c47a['os'][_0xb7d0('0x3d')],_0x11c47a['os'][_0xb7d0('0xb3')]),'osVersion':_0x11c47a['os'][_0xb7d0('0xb3')],'deviceModel':_0x11c47a[_0xb7d0('0xb7')][_0xb7d0('0x46')]&&_0x11c47a[_0xb7d0('0xb7')][_0xb7d0('0xb8')]?util['format'](_0xb7d0('0xb9'),_0x11c47a[_0xb7d0('0xb7')][_0xb7d0('0x46')],_0x11c47a[_0xb7d0('0xb7')][_0xb7d0('0xb8')],_0x11c47a[_0xb7d0('0xb7')][_0xb7d0('0x44')]):null,'deviceVendor':_0x11c47a[_0xb7d0('0xb7')][_0xb7d0('0xb8')],'deviceType':_0x11c47a[_0xb7d0('0xb7')]['type'],'formData':JSON[_0xb7d0('0x2a')](_0xd83049[_0xb7d0('0x5d')])};var _0x2d4e5e={'ChatWebsiteId':_0xd83049['params']['id'],'closed':![]};if(_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xba')]){_0x2d4e5e['threadId']=_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xba')];return db['ChatInteraction']['find']({'where':_0x2d4e5e})[_0xb7d0('0x25')](function(_0x292d3a){if(_0x292d3a){return[_0x292d3a,![]];}_0x2743c3[_0xb7d0('0xba')]=_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xba')];_0x2743c3['externalUrl']=_0xd83049['body']['externalUrl'];return db[_0xb7d0('0xbb')]['create'](_0x2743c3)['then'](function(_0x5701c0){return[_0x5701c0,!![]];});});}_0x2d4e5e[_0xb7d0('0xbc')]=_0x313979['id'];if(_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xbd')]&&_0xd83049['body'][_0xb7d0('0xbd')]['id']){_0x2d4e5e['id']=_0xd83049[_0xb7d0('0x5d')]['interaction']['id'];return db['ChatInteraction'][_0xb7d0('0x5b')]({'where':_0x2d4e5e})[_0xb7d0('0x25')](function(_0x2d7e3b){if(_0x2d7e3b){return[_0x2d7e3b,![]];}return db[_0xb7d0('0xbb')][_0xb7d0('0x5c')](_0x2743c3)['then'](function(_0x5b0f30){return[_0x5b0f30,!![]];});});}return db[_0xb7d0('0xbb')]['create'](_0x2743c3)[_0xb7d0('0x25')](function(_0x31e862){return[_0x31e862,!![]];});}})['spread'](function(_0x55247e,_0x318d5f){if(_0x55247e){_0x29cf76=_0x318d5f;if(!_0x318d5f){var _0x11402b={'from':(_0x504c92[_0xb7d0('0xa9')][_0xb7d0('0xaf')]||'')+'\x20'+(_0x504c92[_0xb7d0('0xa9')][_0xb7d0('0xb0')]||'')};if(_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xba')]&&_0xd83049[_0xb7d0('0x5d')]['messageId']&&_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xba')]!=_0xd83049[_0xb7d0('0x5d')][_0xb7d0('0xbe')]){_0x11402b['threadId']=_0xd83049['body']['messageId'];}return _0x55247e[_0xb7d0('0x39')](_0x11402b);}else{return _0x55247e;}}})[_0xb7d0('0x25')](function(_0x93be4c){_0x504c92[_0xb7d0('0xbd')]=_0x93be4c[_0xb7d0('0x3b')]({'plain':!![]});_0x504c92['interaction']['created']=_0x29cf76;if(_0x504c92[_0xb7d0('0xbd')][_0xb7d0('0xbf')]){if(_0x504c92[_0xb7d0('0xa3')][_0xb7d0('0xc0')]){_0x504c92[_0xb7d0('0xa4')][_0xb7d0('0xc1')]({'id':0x0,'priority':_0x504c92[_0xb7d0('0xa4')][_0xb7d0('0x4d')]+0x1,'app':_0xb7d0('0xc2'),'appdata':_0xb7d0('0xc3'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xb7d0('0x5c')]({'body':_0xd83049[_0xb7d0('0x5d')]['body'],'ChatWebsiteId':_0xd83049[_0xb7d0('0x58')]['id'],'ChatInteractionId':_0x93be4c['id'],'direction':'in','ContactId':_0x504c92[_0xb7d0('0xa9')]['id'],'AttachmentId':_0xd83049[_0xb7d0('0x5d')]['AttachmentId']});})['then'](function(_0x2e5bca){_0x504c92['message']=_0x2e5bca;if(_0x504c92['interaction'][_0xb7d0('0xc4')]){return db[_0xb7d0('0xc5')]['find']({'attributes':['id',_0xb7d0('0x3d')],'where':{'id':_0x504c92[_0xb7d0('0xbd')][_0xb7d0('0xc4')]}})[_0xb7d0('0x25')](function(_0xd00ea){if(_0xd00ea){_0x504c92['applications'][_0xb7d0('0xc6')]({'id':0x0,'priority':0x0,'app':_0xb7d0('0xc7'),'appdata':_0xd00ea[_0xb7d0('0x3d')]+','+(_0x504c92[_0xb7d0('0xa3')][_0xb7d0('0xc8')]||0xa),'interval':_0xb7d0('0xc9')});_0x504c92['forcedOwnership']=!![];}return respondWithRpcPromise(_0xb7d0('0xca'),_0xb7d0('0xcb'),_0x504c92);});}return respondWithRpcPromise(_0xb7d0('0xca'),_0xb7d0('0xcb'),_0x504c92);})[_0xb7d0('0x25')](function(_0x28488c){respondWithRpcPromise(_0xb7d0('0xcc'),_0xb7d0('0xcc'),{'event':_0xb7d0('0x8e'),'message':_0x28488c},client9002);return _0x28488c;})[_0xb7d0('0x25')](respondWithResult(_0x422e6d,null))[_0xb7d0('0x56')](handleError(_0x422e6d,null));};exports['offline']=function(_0x161460,_0x14a1b9,_0x2c223f){var _0x205f05,_0x378fde,_0x4071dc;var _0x1085a6=[];var _0x28cc3e=[];var _0x2dca7c={};return db[_0xb7d0('0x93')][_0xb7d0('0x67')]()[_0xb7d0('0x25')](function(_0x2e4a6e){if(!_0x2e4a6e){throw new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))](_0xb7d0('0xcd'));}_0x28cc3e=_[_0xb7d0('0x97')](_[_0xb7d0('0x48')](_0x2e4a6e),[_0xb7d0('0x95'),_0xb7d0('0x96')]);_0x1085a6=_[_0xb7d0('0x97')](_[_0xb7d0('0x48')](_0x2e4a6e),[_0xb7d0('0x95'),_0xb7d0('0x96'),_0xb7d0('0xce'),_0xb7d0('0xa8')]);if(_0x161460[_0xb7d0('0x5d')]['id']){delete _0x161460[_0xb7d0('0x5d')]['id'];}if(_[_0xb7d0('0x82')](_0x161460[_0xb7d0('0x5d')][_0xb7d0('0x9d')])){throw _0x14a1b9[_0xb7d0('0x31')](0x1f4)[_0xb7d0('0xcf')](new db['Sequelize'][(_0xb7d0('0x99'))](_0xb7d0('0x98')));}if(_[_0xb7d0('0x82')](_0x161460[_0xb7d0('0x5d')][_0xb7d0('0x5d')])||_0x161460[_0xb7d0('0x5d')]['body']===''){throw _0x14a1b9[_0xb7d0('0x31')](0x1f4)['send'](new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb7d0('0x82')](_0x161460[_0xb7d0('0x5d')][_0xb7d0('0xd0')])){throw _0x14a1b9[_0xb7d0('0x31')](0x1f4)[_0xb7d0('0xcf')](new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))](_0xb7d0('0xd1')+_0x1085a6));}if(!_[_0xb7d0('0x9a')](_0x1085a6,_0x161460[_0xb7d0('0x5d')][_0xb7d0('0xd0')])){throw _0x14a1b9[_0xb7d0('0x31')](0x1f4)[_0xb7d0('0xcf')](new db[(_0xb7d0('0x94'))][(_0xb7d0('0x99'))](_0xb7d0('0xd2')+_0x1085a6));}_0x2dca7c[_0x161460[_0xb7d0('0x5d')][_0xb7d0('0xd0')]]=_0x161460[_0xb7d0('0x5d')][_0xb7d0('0x9d')];})['then'](function(){return db[_0xb7d0('0x42')][_0xb7d0('0x5b')]({'where':{'id':_0x161460['params']['id']},'include':[{'model':db[_0xb7d0('0x9e')],'as':_0xb7d0('0x9f')}]});})[_0xb7d0('0x25')](handleEntityNotFound(_0x14a1b9,null))[_0xb7d0('0x25')](function(_0x2de45d){if(_0x2de45d&&_0x2de45d['List']){_0x378fde=_0x2de45d;var _0x261882=_[_0xb7d0('0x1c')](_0x161460[_0xb7d0('0x5d')],{'firstName':_0x161460[_0xb7d0('0x5d')]['from'],'phone':_0x161460[_0xb7d0('0x5d')]['from'],'ListId':_0x2de45d['ListId']});_0x261882[_0x161460['body'][_0xb7d0('0xd0')]]=_0x161460[_0xb7d0('0x5d')][_0xb7d0('0x9d')];return db[_0xb7d0('0x93')]['findOrCreate']({'where':_0x2dca7c,'defaults':_0x261882});}})[_0xb7d0('0xd3')](function(_0x355e50){if(_0x355e50){_0x4071dc=_0x355e50;var _0x5f53fb=fs[_0xb7d0('0xd4')](path[_0xb7d0('0x84')](config[_0xb7d0('0x80')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x4c1d90=ejs['render'](_0x5f53fb,{'body':_[_0xb7d0('0xd5')](_0x161460[_0xb7d0('0x5d')]['body']),'bodyTitle':_0x378fde[_0xb7d0('0xd6')]});return db[_0xb7d0('0xd7')][_0xb7d0('0x5c')]({'body':_0x4c1d90,'ContactId':_0x355e50['id'],'ChatWebsiteId':_0x378fde['id']});}})[_0xb7d0('0x25')](function(_0x4f12e3){if(_0x4f12e3){_0x205f05=_0x4f12e3;return db[_0xb7d0('0xd8')][_0xb7d0('0x69')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0xb7d0('0x25')](function(_0x2714b5){if(_0x2714b5&&_0x2714b5[_0xb7d0('0xd9')]&&_0x378fde[_0xb7d0('0xda')]){var _0x1d1bcb={'tls':{'rejectUnauthorized':![]}};if(_0x2714b5[_0xb7d0('0xd9')]['service']){_0x1d1bcb[_0xb7d0('0xdb')]=_0x2714b5[_0xb7d0('0xd9')][_0xb7d0('0xdb')];}else{_0x1d1bcb[_0xb7d0('0xdc')]=_0x2714b5[_0xb7d0('0xd9')][_0xb7d0('0xdc')];_0x1d1bcb[_0xb7d0('0xdd')]=_0x2714b5[_0xb7d0('0xd9')][_0xb7d0('0xdd')];_0x1d1bcb[_0xb7d0('0xde')]=_0x2714b5[_0xb7d0('0xd9')][_0xb7d0('0xde')];}if(_0x2714b5[_0xb7d0('0xd9')][_0xb7d0('0xdf')]){_0x1d1bcb['auth']={'user':_0x2714b5[_0xb7d0('0xd9')][_0xb7d0('0x5e')],'pass':_0x2714b5['Smtp']['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x1d1bcb,'message':{'from':util[_0xb7d0('0xb4')](_0xb7d0('0xe0'),_0x2714b5[_0xb7d0('0x3d')],_0x2714b5[_0xb7d0('0xe1')]||_0x2714b5['Smtp'][_0xb7d0('0x5e')]),'to':_0x378fde[_0xb7d0('0xda')],'subject':_0x378fde[_0xb7d0('0xe2')],'text':_0x205f05[_0xb7d0('0x5d')]}},client9003)['then'](function(){return _0x205f05;})['catch'](function(_0x8f573b){console[_0xb7d0('0x2b')](_0x8f573b);});}})[_0xb7d0('0x25')](function(){if(_0x205f05){return _0x205f05;}})['then'](respondWithResult(_0x14a1b9,null))[_0xb7d0('0x56')](handleError(_0x14a1b9,null));};exports[_0xb7d0('0xe3')]=function(_0x51bb10,_0x8cb310,_0x14d6d2){return db['ChatInteraction'][_0xb7d0('0x5b')]({'where':{'id':_0x51bb10[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x8cb310,null))[_0xb7d0('0x25')](function(_0x5c8edf){if(_0x5c8edf){return _0x5c8edf[_0xb7d0('0xe3')](_0x51bb10[_0xb7d0('0x5d')][_0xb7d0('0x72')],_[_0xb7d0('0xe4')](_0x51bb10[_0xb7d0('0x5d')],[_0xb7d0('0x72'),'id'])||{});}})['then'](respondWithResult(_0x8cb310,null))[_0xb7d0('0x56')](handleError(_0x8cb310,null));};exports[_0xb7d0('0xe5')]=function(_0x32fcb7,_0x34d527,_0x1f9a0a){var _0x337535={'raw':![],'where':{}};var _0xd6f4fd={};var _0x28fb1c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb7d0('0x69')]({'where':{'id':_0x32fcb7[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x34d527,null))['then'](function(_0x2332f5){if(_0x2332f5){_0xd6f4fd[_0xb7d0('0x46')]=_[_0xb7d0('0x48')](db[_0xb7d0('0xbb')][_0xb7d0('0x59')]);_0xd6f4fd[_0xb7d0('0x47')]=_[_0xb7d0('0x48')](_0x32fcb7['query']);_0xd6f4fd[_0xb7d0('0x49')]=_['intersection'](_0xd6f4fd[_0xb7d0('0x46')],_0xd6f4fd[_0xb7d0('0x47')]);_0x337535[_0xb7d0('0x4c')]=_['intersection'](_0xd6f4fd[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0x32fcb7['query'][_0xb7d0('0x4b')]));_0x337535[_0xb7d0('0x4c')]=_0x337535[_0xb7d0('0x4c')][_0xb7d0('0x4d')]?_0x337535['attributes']:_0xd6f4fd[_0xb7d0('0x46')];if(!_0x32fcb7[_0xb7d0('0x47')][_0xb7d0('0x4e')]('nolimit')){_0x337535[_0xb7d0('0x4f')]=qs[_0xb7d0('0x4f')](_0x32fcb7['query'][_0xb7d0('0x4f')]);_0x337535['offset']=qs['offset'](_0x32fcb7['query'][_0xb7d0('0x34')]);}_0x337535[_0xb7d0('0x6c')]=qs[_0xb7d0('0x50')](_0x32fcb7[_0xb7d0('0x47')][_0xb7d0('0x50')]);_0x337535['where']=qs[_0xb7d0('0x49')](_[_0xb7d0('0x6d')](_0x32fcb7['query'],_0xd6f4fd['filters']));_0x337535[_0xb7d0('0x51')]['ChatWebsiteId']=_0x2332f5['id'];if(_0x32fcb7[_0xb7d0('0x47')]['filter']){_0x337535[_0xb7d0('0x51')]=_[_0xb7d0('0x53')](_0x337535[_0xb7d0('0x51')],{'$or':_[_0xb7d0('0x41')](_0x337535[_0xb7d0('0x4c')],function(_0x4168db){var _0x4dc8a0={};_0x4dc8a0[_0x4168db]={'$like':'%'+_0x32fcb7[_0xb7d0('0x47')]['filter']+'%'};return _0x4dc8a0;})});}_0x337535=_['merge']({},_0x337535,_0x32fcb7[_0xb7d0('0x6f')]);return db[_0xb7d0('0xbb')][_0xb7d0('0x33')]({'where':_0x337535[_0xb7d0('0x51')]})['then'](function(_0x57a88c){_0x28fb1c[_0xb7d0('0x33')]=_0x57a88c;if(_0x32fcb7[_0xb7d0('0x47')][_0xb7d0('0x5a')]){_0x337535[_0xb7d0('0x54')]=[{'model':db[_0xb7d0('0x93')],'as':'Contact','required':![]},{'model':db[_0xb7d0('0xc5')],'as':'Owner','attributes':[_0xb7d0('0x3d'),_0xb7d0('0xe6'),_0xb7d0('0xe7')],'required':![]},{'model':db['Tag'],'as':_0xb7d0('0xe8'),'attributes':['id',_0xb7d0('0x3d'),'color'],'where':_0x32fcb7[_0xb7d0('0x47')][_0xb7d0('0xe9')]?{'id':_0x32fcb7[_0xb7d0('0x47')][_0xb7d0('0xe9')]}:undefined,'required':_0x32fcb7['query'][_0xb7d0('0xe9')]?!![]:![]}];}return db[_0xb7d0('0xbb')][_0xb7d0('0x70')](_0x337535);})['then'](function(_0x5dcf3f){_0x28fb1c[_0xb7d0('0x55')]=_0x5dcf3f;return _0x28fb1c;});}})[_0xb7d0('0x25')](respondWithFilteredResult(_0x34d527,_0x337535))[_0xb7d0('0x56')](handleError(_0x34d527,null));};function iftimePromise(_0x6fc5f0,_0x4e0358){return respondWithRpcPromise(_0xb7d0('0xea'),_0xb7d0('0xeb'),{'command':_0x4e0358[_0xb7d0('0xec')]?util['format'](_0xb7d0('0xed'),_0x6fc5f0[_0xb7d0('0xee')],_0x4e0358['timezone']):util[_0xb7d0('0xb4')](_0xb7d0('0xef'),_0x6fc5f0['interval'])},client9002)[_0xb7d0('0x25')](function(_0x1f9377){var _0x3e6291=_0x1f9377&&_0x1f9377['indexOf'](_0xb7d0('0xf0'))>=0x0?!![]:![];logger[_0xb7d0('0x2e')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4e0358['id'],_0x6fc5f0['id'],_0x6fc5f0['interval'],_0x3e6291?_0xb7d0('0xf1'):'OFFLINE',_0x4e0358['timezone']?_0x4e0358[_0xb7d0('0xec')]:_0xb7d0('0xf2'));return _0x3e6291;})[_0xb7d0('0x56')](function(_0x2ae01f){logger[_0xb7d0('0x2b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4e0358['id'],_0x6fc5f0['id'],_0x6fc5f0[_0xb7d0('0xee')],util[_0xb7d0('0xf3')](_0x2ae01f,{'showHidden':![],'depth':null}),_0x4e0358[_0xb7d0('0xec')]?_0x4e0358[_0xb7d0('0xec')]:_0xb7d0('0xf2'));return![];});}exports[_0xb7d0('0xeb')]=function(_0x2887b6,_0x599144,_0x1d6ecd){var _0x386750=0x0;var _0x5bd587=0x0;var _0x54d806=![];var _0xd6a8c4;var _0x15312d;return db['ChatWebsite'][_0xb7d0('0x5b')]({'where':{'id':_0x2887b6[_0xb7d0('0x58')]['id']},'include':[{'model':db['Interval'],'as':_0xb7d0('0xf4'),'include':[{'model':db[_0xb7d0('0xf4')],'as':'Intervals','attributes':['id',_0xb7d0('0xee')],'raw':!![]}]}]})[_0xb7d0('0x25')](handleEntityNotFound(_0x599144,null))[_0xb7d0('0x25')](function(_0x51cd1c){if(_0x51cd1c){_0xd6a8c4=_0x51cd1c;return _0x51cd1c[_0xb7d0('0xf5')]({'raw':!![]});}})[_0xb7d0('0x25')](function(_0x1217ce){if(_0xd6a8c4){if(_0x1217ce){_0x15312d=_0x1217ce;}}return require(_0xb7d0('0x19'))[_0xb7d0('0x81')]();})[_0xb7d0('0x25')](function(_0x2b7f39){if(_0x2b7f39){_0x5bd587=_0x2b7f39[_0xb7d0('0xf6')];_0x54d806=_0x2b7f39[_0xb7d0('0xf7')];}})[_0xb7d0('0x25')](function(){return db['ChatInteraction'][_0xb7d0('0x33')]({'where':{'closed':![]}});})['then'](function(_0x7b6e6f){_0x386750=_0x7b6e6f;if(_0x5bd587&&_0x7b6e6f>_0x5bd587){return db[_0xb7d0('0xf8')][_0xb7d0('0x69')]({'where':{'id':0x1}})[_0xb7d0('0x25')](function(_0x2cea83){if(_0x2cea83){_0x2cea83[_0xb7d0('0xf9')](_0xb7d0('0xfa'));}});}})[_0xb7d0('0x25')](function(){if(_0xd6a8c4[_0xb7d0('0xf4')]&&_0xd6a8c4[_0xb7d0('0xf4')][_0xb7d0('0xfb')]){var _0x1421e2=[];for(var _0xbb6979=0x0;_0xbb6979<_0xd6a8c4['Interval']['Intervals'][_0xb7d0('0x4d')];_0xbb6979++){var _0x7013ec=_0xd6a8c4[_0xb7d0('0xf4')][_0xb7d0('0xfb')][_0xbb6979]['get']({'plain':!![]});_0x1421e2['push'](iftimePromise(_0x7013ec,_0xd6a8c4));}return BPromise[_0xb7d0('0xfc')](_0x1421e2)['then'](function(_0x23480d){return _[_0xb7d0('0xfd')](_0x23480d);});}else{return!![];}})[_0xb7d0('0x25')](function(_0x5dfce1){var _0x172ac1=fs[_0xb7d0('0xd4')](path['join'](config['root'],'server/files/chat/iframe.js'),_0xb7d0('0xfe'));var _0x3afe6f={'remote':_0xd6a8c4['remote'],'query':querystring['stringify'](_[_0xb7d0('0x53')](_0xd6a8c4['get']({'plain':!![]}),{'customerIp':_0x2887b6[_0xb7d0('0xab')][_0xb7d0('0xad')]||_0x2887b6['headers'][_0xb7d0('0xff')]||_0x2887b6[_0xb7d0('0x100')][_0xb7d0('0x101')]||_0x2887b6['ip'],'referer':_0x2887b6[_0xb7d0('0xab')][_0xb7d0('0xb1')],'openedInteractions':_0x386750,'maxInteractions':_0x5bd587,'virtual':_0x54d806[_0xb7d0('0xf6')],'online':_0x5dfce1,'custom':_0x54d806}))[_0xb7d0('0x102')](/'/g,'\x5c\x27')};_0x599144[_0xb7d0('0xcf')](ejs[_0xb7d0('0x103')](Mustache[_0xb7d0('0x103')](_0x172ac1,_0x3afe6f),{'proactiveActions':_0x15312d,'alignment':_0xd6a8c4[_0xb7d0('0x104')],'verticalAlignment':_0xd6a8c4[_0xb7d0('0x105')],'div_color':_0xd6a8c4['color'],'text_color':_0xd6a8c4['textColor']}));})[_0xb7d0('0x56')](handleError(_0x599144,null));};exports[_0xb7d0('0x106')]=function(_0xa9ae70,_0xeb1af1,_0x54aea3){return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0xa9ae70[_0xb7d0('0x58')]['id']}})['then'](handleEntityNotFound(_0xeb1af1,null))[_0xb7d0('0x25')](function(_0x564d08){if(_0x564d08){return db[_0xb7d0('0x107')]['transaction'](function(_0x34b08a){return db[_0xb7d0('0xa1')][_0xb7d0('0x3a')]({'where':{'ChatWebsiteId':_0xa9ae70[_0xb7d0('0x58')]['id']},'transaction':_0x34b08a})['then'](function(_0xd84e11){var _0x1423d0=_[_0xb7d0('0x41')](_0xa9ae70[_0xb7d0('0x5d')],function(_0x150db9){_0x150db9[_0xb7d0('0x6e')]=_0xa9ae70[_0xb7d0('0x58')]['id'];return _0x150db9;});return db[_0xb7d0('0xa1')]['bulkCreate'](_0x1423d0,{'transaction':_0x34b08a});});})[_0xb7d0('0x25')](function(){return db[_0xb7d0('0xa1')][_0xb7d0('0x108')]({'where':{'ChatWebsiteId':_0xa9ae70[_0xb7d0('0x58')]['id']},'order':'priority'});});}})[_0xb7d0('0x25')](respondWithResult(_0xeb1af1,null))[_0xb7d0('0x56')](handleError(_0xeb1af1,null));};exports[_0xb7d0('0x109')]=function(_0x40b165,_0x35e9a2,_0x3cfb64){var _0x50d794={};var _0x4147ed={};var _0x47593a;var _0x4490f6;return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0x40b165[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x35e9a2,null))['then'](function(_0x1bed5c){if(_0x1bed5c){_0x47593a=_0x1bed5c;_0x4147ed['model']=_[_0xb7d0('0x48')](db[_0xb7d0('0xa1')][_0xb7d0('0x59')]);_0x4147ed[_0xb7d0('0x47')]=_[_0xb7d0('0x48')](_0x40b165[_0xb7d0('0x47')]);_0x4147ed['filters']=_[_0xb7d0('0x4a')](_0x4147ed[_0xb7d0('0x46')],_0x4147ed[_0xb7d0('0x47')]);_0x50d794[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0x4147ed[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0x40b165[_0xb7d0('0x47')][_0xb7d0('0x4b')]));_0x50d794['attributes']=_0x50d794[_0xb7d0('0x4c')][_0xb7d0('0x4d')]?_0x50d794[_0xb7d0('0x4c')]:_0x4147ed[_0xb7d0('0x46')];_0x50d794['order']=qs['sort'](_0x40b165['query'][_0xb7d0('0x50')]);_0x50d794[_0xb7d0('0x51')]=qs['filters'](_['pick'](_0x40b165['query'],_0x4147ed[_0xb7d0('0x49')]));if(_0x40b165[_0xb7d0('0x47')][_0xb7d0('0x52')]){_0x50d794[_0xb7d0('0x51')]=_[_0xb7d0('0x53')](_0x50d794['where'],{'$or':_[_0xb7d0('0x41')](_0x50d794[_0xb7d0('0x4c')],function(_0x52b863){var _0x4316fc={};_0x4316fc[_0x52b863]={'$like':'%'+_0x40b165[_0xb7d0('0x47')]['filter']+'%'};return _0x4316fc;})});}_0x50d794=_[_0xb7d0('0x53')]({},_0x50d794,_0x40b165[_0xb7d0('0x6f')]);return _0x47593a[_0xb7d0('0x109')](_0x50d794);}})['then'](function(_0x38bb4d){if(_0x38bb4d){_0x4490f6=_0x38bb4d[_0xb7d0('0x4d')];if(!_0x40b165[_0xb7d0('0x47')][_0xb7d0('0x4e')]('nolimit')){_0x50d794['limit']=qs[_0xb7d0('0x4f')](_0x40b165[_0xb7d0('0x47')][_0xb7d0('0x4f')]);_0x50d794[_0xb7d0('0x34')]=qs[_0xb7d0('0x34')](_0x40b165[_0xb7d0('0x47')][_0xb7d0('0x34')]);}return _0x47593a[_0xb7d0('0x109')](_0x50d794);}})[_0xb7d0('0x25')](function(_0x18ca7d){if(_0x18ca7d){return _0x18ca7d?{'count':_0x4490f6,'rows':_0x18ca7d}:null;}})[_0xb7d0('0x25')](respondWithResult(_0x35e9a2,null))[_0xb7d0('0x56')](handleError(_0x35e9a2,null));};exports[_0xb7d0('0x10a')]=function(_0x5e9c0d,_0x1ce015,_0xf15a49){return db[_0xb7d0('0x10b')]['find']({'where':{'id':_0x5e9c0d[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x1ce015,null))[_0xb7d0('0x25')](function(_0x3fd8a2){if(_0x3fd8a2){return _0x3fd8a2[_0xb7d0('0x10a')](_0x5e9c0d[_0xb7d0('0x5d')][_0xb7d0('0x72')],_[_0xb7d0('0xe4')](_0x5e9c0d['body'],[_0xb7d0('0x72'),'id'])||{});}})[_0xb7d0('0x25')](respondWithResult(_0x1ce015,null))[_0xb7d0('0x56')](handleError(_0x1ce015,null));};exports[_0xb7d0('0xf5')]=function(_0x2f52d7,_0x4973f7,_0x3d7bc7){var _0x1b4f8b={};var _0x3e56c0={};var _0x42aa23;var _0x35d0ea;return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0x2f52d7[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x4973f7,null))[_0xb7d0('0x25')](function(_0x2231ef){if(_0x2231ef){_0x42aa23=_0x2231ef;_0x3e56c0[_0xb7d0('0x46')]=_['keys'](db[_0xb7d0('0x10c')][_0xb7d0('0x59')]);_0x3e56c0[_0xb7d0('0x47')]=_[_0xb7d0('0x48')](_0x2f52d7[_0xb7d0('0x47')]);_0x3e56c0[_0xb7d0('0x49')]=_[_0xb7d0('0x4a')](_0x3e56c0[_0xb7d0('0x46')],_0x3e56c0[_0xb7d0('0x47')]);_0x1b4f8b[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0x3e56c0[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0x2f52d7[_0xb7d0('0x47')][_0xb7d0('0x4b')]));_0x1b4f8b[_0xb7d0('0x4c')]=_0x1b4f8b[_0xb7d0('0x4c')][_0xb7d0('0x4d')]?_0x1b4f8b['attributes']:_0x3e56c0[_0xb7d0('0x46')];_0x1b4f8b[_0xb7d0('0x6c')]=qs['sort'](_0x2f52d7['query'][_0xb7d0('0x50')]);_0x1b4f8b[_0xb7d0('0x51')]=qs[_0xb7d0('0x49')](_[_0xb7d0('0x6d')](_0x2f52d7[_0xb7d0('0x47')],_0x3e56c0[_0xb7d0('0x49')]));if(_0x2f52d7['query']['filter']){_0x1b4f8b[_0xb7d0('0x51')]=_[_0xb7d0('0x53')](_0x1b4f8b[_0xb7d0('0x51')],{'$or':_[_0xb7d0('0x41')](_0x1b4f8b[_0xb7d0('0x4c')],function(_0x553a51){var _0x3fbdba={};_0x3fbdba[_0x553a51]={'$like':'%'+_0x2f52d7['query'][_0xb7d0('0x52')]+'%'};return _0x3fbdba;})});}_0x1b4f8b=_[_0xb7d0('0x53')]({},_0x1b4f8b,_0x2f52d7['options']);return _0x42aa23[_0xb7d0('0xf5')](_0x1b4f8b);}})[_0xb7d0('0x25')](function(_0x13562f){if(_0x13562f){_0x35d0ea=_0x13562f[_0xb7d0('0x4d')];if(!_0x2f52d7[_0xb7d0('0x47')][_0xb7d0('0x4e')]('nolimit')){_0x1b4f8b[_0xb7d0('0x4f')]=qs['limit'](_0x2f52d7[_0xb7d0('0x47')][_0xb7d0('0x4f')]);_0x1b4f8b[_0xb7d0('0x34')]=qs[_0xb7d0('0x34')](_0x2f52d7[_0xb7d0('0x47')][_0xb7d0('0x34')]);}return _0x42aa23['getProactiveActions'](_0x1b4f8b);}})[_0xb7d0('0x25')](function(_0x5efd14){if(_0x5efd14){return _0x5efd14?{'count':_0x35d0ea,'rows':_0x5efd14}:null;}})[_0xb7d0('0x25')](respondWithResult(_0x4973f7,null))[_0xb7d0('0x56')](handleError(_0x4973f7,null));};exports[_0xb7d0('0x10d')]=function(_0x1cee63,_0x4332f4,_0xa5ff1c){var _0x44ea90=_0x1cee63[_0xb7d0('0x47')][_0xb7d0('0x10e')]===_0xb7d0('0x10f')?'offlineForm':_0xb7d0('0x110');return db['ChatWebsite'][_0xb7d0('0x5b')]({'attributes':['id',_0x44ea90],'where':{'id':_0x1cee63[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x4332f4,null))[_0xb7d0('0x25')](function(_0x1f0d4b){if(_0x1f0d4b){var _0x1ddaff=_0x1f0d4b[_0x44ea90];var _0x3f4800=_0x1ddaff&&_0x1ddaff[_0xb7d0('0x111')]?_0x1ddaff['items']:[];_0x4332f4[_0xb7d0('0xcf')]({'fromKey':_[_0xb7d0('0x82')](_0x1ddaff[_0xb7d0('0x112')])?undefined:_0x1ddaff[_0xb7d0('0x112')],'count':_0x3f4800[_0xb7d0('0x4d')],'rows':_0x3f4800});}})[_0xb7d0('0x56')](handleError(_0x4332f4,null));};exports[_0xb7d0('0x113')]=function(_0x14bd23,_0x3e263a,_0x3de23c){var _0x2128d9={'raw':![],'where':{}};var _0x1918e0={};var _0x28fbae={'count':0x0,'rows':[]};return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0x14bd23[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x3e263a,null))[_0xb7d0('0x25')](function(_0x4b0fcd){if(_0x4b0fcd){_0x1918e0[_0xb7d0('0x46')]=_['keys'](db[_0xb7d0('0xd7')][_0xb7d0('0x59')]);_0x1918e0['query']=_[_0xb7d0('0x48')](_0x14bd23[_0xb7d0('0x47')]);_0x1918e0[_0xb7d0('0x49')]=_['intersection'](_0x1918e0[_0xb7d0('0x46')],_0x1918e0['query']);_0x2128d9[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0x1918e0[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0x14bd23['query']['fields']));_0x2128d9['attributes']=_0x2128d9['attributes'][_0xb7d0('0x4d')]?_0x2128d9[_0xb7d0('0x4c')]:_0x1918e0['model'];if(!_0x14bd23[_0xb7d0('0x47')][_0xb7d0('0x4e')](_0xb7d0('0x6b'))){_0x2128d9[_0xb7d0('0x4f')]=qs[_0xb7d0('0x4f')](_0x14bd23['query'][_0xb7d0('0x4f')]);_0x2128d9[_0xb7d0('0x34')]=qs[_0xb7d0('0x34')](_0x14bd23['query'][_0xb7d0('0x34')]);}_0x2128d9[_0xb7d0('0x6c')]=qs[_0xb7d0('0x50')](_0x14bd23['query'][_0xb7d0('0x50')]);_0x2128d9[_0xb7d0('0x51')]=qs[_0xb7d0('0x49')](_[_0xb7d0('0x6d')](_0x14bd23[_0xb7d0('0x47')],_0x1918e0[_0xb7d0('0x49')]));_0x2128d9[_0xb7d0('0x51')][_0xb7d0('0x6e')]=_0x4b0fcd['id'];if(_0x14bd23[_0xb7d0('0x47')][_0xb7d0('0x52')]){_0x2128d9['where']=_[_0xb7d0('0x53')](_0x2128d9[_0xb7d0('0x51')],{'$or':_[_0xb7d0('0x41')](_0x2128d9[_0xb7d0('0x4c')],function(_0x59d2eb){var _0x4f9869={};_0x4f9869[_0x59d2eb]={'$like':'%'+_0x14bd23[_0xb7d0('0x47')][_0xb7d0('0x52')]+'%'};return _0x4f9869;})});}_0x2128d9=_[_0xb7d0('0x53')]({},_0x2128d9,_0x14bd23[_0xb7d0('0x6f')]);return db[_0xb7d0('0xd7')][_0xb7d0('0x33')]({'where':_0x2128d9[_0xb7d0('0x51')]})[_0xb7d0('0x25')](function(_0xe368c0){_0x28fbae['count']=_0xe368c0;if(_0x14bd23['query'][_0xb7d0('0x5a')]){_0x2128d9['include']=[{'all':!![]}];}else{_0x2128d9[_0xb7d0('0x54')]=[{'model':db[_0xb7d0('0x93')],'as':_0xb7d0('0x114'),'required':![]}];}return db[_0xb7d0('0xd7')][_0xb7d0('0x70')](_0x2128d9);})[_0xb7d0('0x25')](function(_0x133e78){_0x28fbae['rows']=_0x133e78;return _0x28fbae;});}})[_0xb7d0('0x25')](respondWithFilteredResult(_0x3e263a,_0x2128d9))['catch'](handleError(_0x3e263a,null));};exports[_0xb7d0('0x115')]=function(_0x25a071,_0x2000fb,_0x1bf890){return db[_0xb7d0('0x42')][_0xb7d0('0x5b')]({'where':{'id':_0x25a071['params']['id']}})['then'](handleEntityNotFound(_0x2000fb,null))[_0xb7d0('0x25')](function(_0x532604){if(_0x532604){return _0x532604['addAgents'](_0x25a071['body'][_0xb7d0('0x72')],_[_0xb7d0('0xe4')](_0x25a071[_0xb7d0('0x5d')],[_0xb7d0('0x72'),'id'])||{})[_0xb7d0('0xd3')](function(_0xc9f150){for(var _0x163dc8=0x0;_0x163dc8<_0x25a071[_0xb7d0('0x5d')][_0xb7d0('0x72')][_0xb7d0('0x4d')];_0x163dc8+=0x1){socket[_0xb7d0('0x116')](_0xb7d0('0x117'),{'UserId':_0x25a071['body'][_0xb7d0('0x72')][_0x163dc8],'ChatWebsiteId':_0x25a071[_0xb7d0('0x58')]['id']});}return _0xc9f150;});}})[_0xb7d0('0x25')](respondWithResult(_0x2000fb,null))[_0xb7d0('0x56')](handleError(_0x2000fb,null));};exports[_0xb7d0('0x118')]=function(_0x1ffe16,_0x559d95,_0x2e8a3e){return db['ChatWebsite'][_0xb7d0('0x5b')]({'where':{'id':_0x1ffe16[_0xb7d0('0x58')]['id']}})['then'](handleEntityNotFound(_0x559d95,null))[_0xb7d0('0x25')](function(_0x1b0a4d){if(_0x1b0a4d){return _0x1b0a4d[_0xb7d0('0x118')](_0x1ffe16['query'][_0xb7d0('0x72')])[_0xb7d0('0x25')](function(){if(_['isArray'](_0x1ffe16['query'][_0xb7d0('0x72')])){for(var _0xfcd810=0x0;_0xfcd810<_0x1ffe16['query'][_0xb7d0('0x72')]['length'];_0xfcd810+=0x1){socket[_0xb7d0('0x116')](_0xb7d0('0x119'),{'UserId':Number(_0x1ffe16['query'][_0xb7d0('0x72')][_0xfcd810]),'ChatWebsiteId':Number(_0x1ffe16[_0xb7d0('0x58')]['id'])});}}else{socket['emit'](_0xb7d0('0x119'),{'UserId':Number(_0x1ffe16[_0xb7d0('0x47')]['ids']),'ChatWebsiteId':Number(_0x1ffe16[_0xb7d0('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x559d95,null))[_0xb7d0('0x56')](handleError(_0x559d95,null));};exports[_0xb7d0('0x11a')]=function(_0x5ae7b8,_0x10a6e0,_0x13f1f9){var _0x118232={};var _0x562b43={};var _0x5dff34;var _0x20375d;return db[_0xb7d0('0x42')][_0xb7d0('0x69')]({'where':{'id':_0x5ae7b8[_0xb7d0('0x58')]['id']}})[_0xb7d0('0x25')](handleEntityNotFound(_0x10a6e0,null))[_0xb7d0('0x25')](function(_0x43ebf7){if(_0x43ebf7){_0x5dff34=_0x43ebf7;_0x562b43[_0xb7d0('0x46')]=_[_0xb7d0('0x48')](db[_0xb7d0('0xc5')][_0xb7d0('0x59')]);_0x562b43[_0xb7d0('0x47')]=_['keys'](_0x5ae7b8['query']);_0x562b43[_0xb7d0('0x49')]=_[_0xb7d0('0x4a')](_0x562b43[_0xb7d0('0x46')],_0x562b43['query']);_0x118232[_0xb7d0('0x4c')]=_[_0xb7d0('0x4a')](_0x562b43[_0xb7d0('0x46')],qs[_0xb7d0('0x4b')](_0x5ae7b8[_0xb7d0('0x47')]['fields']));_0x118232['attributes']=_0x118232['attributes'][_0xb7d0('0x4d')]?_0x118232[_0xb7d0('0x4c')]:_0x562b43[_0xb7d0('0x46')];_0x118232['order']=qs['sort'](_0x5ae7b8[_0xb7d0('0x47')][_0xb7d0('0x50')]);_0x118232[_0xb7d0('0x51')]=qs[_0xb7d0('0x49')](_['pick'](_0x5ae7b8['query'],_0x562b43[_0xb7d0('0x49')]));if(_0x5ae7b8[_0xb7d0('0x47')][_0xb7d0('0x52')]){_0x118232[_0xb7d0('0x51')]=_[_0xb7d0('0x53')](_0x118232[_0xb7d0('0x51')],{'$or':_['map'](_0x118232['attributes'],function(_0x544e1f){var _0x442db0={};_0x442db0[_0x544e1f]={'$like':'%'+_0x5ae7b8[_0xb7d0('0x47')][_0xb7d0('0x52')]+'%'};return _0x442db0;})});}_0x118232=_['merge']({},_0x118232,_0x5ae7b8[_0xb7d0('0x6f')]);return _0x5dff34[_0xb7d0('0x11a')](_0x118232);}})[_0xb7d0('0x25')](function(_0x4edafe){if(_0x4edafe){_0x20375d=_0x4edafe[_0xb7d0('0x4d')];if(!_0x5ae7b8['query'][_0xb7d0('0x4e')]('nolimit')){_0x118232[_0xb7d0('0x4f')]=qs['limit'](_0x5ae7b8[_0xb7d0('0x47')][_0xb7d0('0x4f')]);_0x118232[_0xb7d0('0x34')]=qs['offset'](_0x5ae7b8[_0xb7d0('0x47')]['offset']);}return _0x5dff34[_0xb7d0('0x11a')](_0x118232);}})[_0xb7d0('0x25')](function(_0x5ee93a){if(_0x5ee93a){return _0x5ee93a?{'count':_0x20375d,'rows':_0x5ee93a}:null;}})[_0xb7d0('0x25')](respondWithResult(_0x10a6e0,null))[_0xb7d0('0x56')](handleError(_0x10a6e0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8d0f447..c001bbc 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 _0xc978=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3b940c,_0x48b4f3){var _0x58af9a=function(_0x561a34){while(--_0x561a34){_0x3b940c['push'](_0x3b940c['shift']());}};_0x58af9a(++_0x48b4f3);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x8c97('0x0'));var ChatWebsite=require(_0x8c97('0x1'))['db'][_0x8c97('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8c97('0x3')](0x0);var events={'afterCreate':_0x8c97('0x4'),'afterUpdate':_0x8c97('0x5'),'afterDestroy':'remove'};function emitEvent(_0x23f5e9){return function(_0x23c28d,_0x3ad972,_0x2f12fc){ChatWebsiteEvents[_0x8c97('0x6')](_0x23f5e9+':'+_0x23c28d['id'],_0x23c28d);ChatWebsiteEvents[_0x8c97('0x6')](_0x23f5e9,_0x23c28d);_0x2f12fc(null);};}for(var e in events){if(events[_0x8c97('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x8c97('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x85d0=['update','remove','emit','hasOwnProperty','hook','exports','save'];(function(_0x1df9c4,_0x31ed6d){var _0x54a9fe=function(_0x540de8){while(--_0x540de8){_0x1df9c4['push'](_0x1df9c4['shift']());}};_0x54a9fe(++_0x31ed6d);}(_0x85d0,0x164));var _0x085d=function(_0x4c5ddc,_0x7f4108){_0x4c5ddc=_0x4c5ddc-0x0;var _0x59afd8=_0x85d0[_0x4c5ddc];return _0x59afd8;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x085d('0x0'),'afterUpdate':_0x085d('0x1'),'afterDestroy':_0x085d('0x2')};function emitEvent(_0x313db8){return function(_0x231765,_0x19ae4c,_0x4818c1){ChatWebsiteEvents[_0x085d('0x3')](_0x313db8+':'+_0x231765['id'],_0x231765);ChatWebsiteEvents['emit'](_0x313db8,_0x231765);_0x4818c1(null);};}for(var e in events){if(events[_0x085d('0x4')](e)){var event=events[e];ChatWebsite[_0x085d('0x5')](e,emitEvent(event));}}module[_0x085d('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 79824fa..cc7da81 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 _0x58a4=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x22c2e3,_0x3ccbac){var _0x4dea58=function(_0x3a0ecb){while(--_0x3a0ecb){_0x22c2e3['push'](_0x22c2e3['shift']());}};_0x4dea58(++_0x3ccbac);}(_0x58a4,0xbf));var _0x458a=function(_0x4a352c,_0x1844ac){_0x4a352c=_0x4a352c-0x0;var _0x488000=_0x58a4[_0x4a352c];return _0x488000;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require(_0x458a('0x2'))(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var BPromise=require(_0x458a('0x5'));var rp=require(_0x458a('0x6'));var fs=require('fs');var path=require(_0x458a('0x7'));var rimraf=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var attributes=require(_0x458a('0xa'));module[_0x458a('0xb')]=function(_0x2f5d44,_0x57de3c){return _0x2f5d44['define'](_0x458a('0xc'),attributes,{'tableName':_0x458a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75b=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','api','moment','bluebird'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xa75b,0x170));var _0xba75=function(_0x1a0c43,_0x70a1a8){_0x1a0c43=_0x1a0c43-0x0;var _0x278c1b=_0xa75b[_0x1a0c43];return _0x278c1b;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),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 dcc3bf7..f58be79 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 _0x2a07=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x1c6551,_0x3fbc2e){var _0x3f7434=function(_0x4af978){while(--_0x4af978){_0x1c6551['push'](_0x1c6551['shift']());}};_0x3f7434(++_0x3fbc2e);}(_0x2a07,0x74));var _0x72a0=function(_0xb13d17,_0x1cd499){_0xb13d17=_0xb13d17-0x0;var _0x23c99e=_0x2a07[_0xb13d17];return _0x23c99e;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});config[_0x72a0('0xd')]=_[_0x72a0('0xe')](config[_0x72a0('0xd')],{'host':_0x72a0('0xf'),'port':0x18eb});var socket=require(_0x72a0('0x10'))(new Redis(config[_0x72a0('0xd')]));require(_0x72a0('0x11'))[_0x72a0('0x12')](socket);function respondWithRpcPromise(_0x5c1d1e,_0x169dc2,_0x1109f7){return new BPromise(function(_0x54abf6,_0x46fb8a){return client[_0x72a0('0x13')](_0x5c1d1e,_0x1109f7)[_0x72a0('0x14')](function(_0x44d7cf){logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));logger[_0x72a0('0x17')](_0x72a0('0x18'),_0x169dc2,_0x72a0('0x16'),JSON[_0x72a0('0x19')](_0x44d7cf));if(_0x44d7cf[_0x72a0('0x1a')]){if(_0x44d7cf[_0x72a0('0x1a')]['code']===0x1f4){logger['error'](_0x72a0('0x1b'),_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x46fb8a(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}logger[_0x72a0('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x54abf6(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}else{logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));_0x54abf6(_0x44d7cf[_0x72a0('0x1d')][_0x72a0('0x1c')]);}})['catch'](function(_0x144bfc){logger[_0x72a0('0x1a')](_0x72a0('0x1b'),_0x169dc2,_0x144bfc);_0x46fb8a(_0x144bfc);});});} \ No newline at end of file +var _0x687b=['request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x528d91,_0x424630){var _0x26d9d1=function(_0x328254){while(--_0x328254){_0x528d91['push'](_0x528d91['shift']());}};_0x26d9d1(++_0x424630);}(_0x687b,0x14a));var _0xb687=function(_0x4717b8,_0x331c49){_0x4717b8=_0x4717b8-0x0;var _0x42a536=_0x687b[_0x4717b8];return _0x42a536;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});config[_0xb687('0xc')]=_[_0xb687('0xd')](config['redis'],{'host':_0xb687('0xe'),'port':0x18eb});var socket=require(_0xb687('0xf'))(new Redis(config['redis']));require(_0xb687('0x10'))[_0xb687('0x11')](socket);function respondWithRpcPromise(_0x825ad,_0x15dc9a,_0x404fdb){return new BPromise(function(_0x309d84,_0x3e6271){return client[_0xb687('0x12')](_0x825ad,_0x404fdb)[_0xb687('0x13')](function(_0x5103b9){logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));logger[_0xb687('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x15dc9a,'request\x20sent',JSON[_0xb687('0x18')](_0x5103b9));if(_0x5103b9[_0xb687('0x19')]){if(_0x5103b9['error'][_0xb687('0x1a')]===0x1f4){logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x3e6271(_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);}logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x309d84(_0x5103b9[_0xb687('0x19')]['message']);}else{logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));_0x309d84(_0x5103b9['result']['message']);}})[_0xb687('0x1c')](function(_0x3a10ef){logger[_0xb687('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x15dc9a,_0x3a10ef);_0x3e6271(_0x3a10ef);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 522c486..3bb447e 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x40fcda,_0x2e8598){var _0x38e739=function(_0x16d71a){while(--_0x16d71a){_0x40fcda['push'](_0x40fcda['shift']());}};_0x38e739(++_0x2e8598);}(_0xb10b,0x12a));var _0xbb10=function(_0x54ba5b,_0x5b7508){_0x54ba5b=_0x54ba5b-0x0;var _0x5e16ac=_0xb10b[_0x54ba5b];return _0x5e16ac;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0xab8668,_0x5204ac){var _0x571c10=function(_0x4ed488){while(--_0x4ed488){_0xab8668['push'](_0xab8668['shift']());}};_0x571c10(++_0x5204ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0xb10b[_0x53c256];return _0x25feb6;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c39f82b..2c0ae24 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 _0x044b=['create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addAgents','put','destroy','delete','removeAnswers','exports','path','connect-timeout','express','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','get','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x044b,0x188));var _0xb044=function(_0x27c2b3,_0x2e034e){_0x27c2b3=_0x27c2b3-0x0;var _0x37ad8c=_0x044b[_0x27c2b3];return _0x37ad8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb044('0x0'));var timeout=require(_0xb044('0x1'));var express=require(_0xb044('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb044('0x3'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xb044('0x4')](),controller[_0xb044('0x5')]);router['get'](_0xb044('0x6'),auth[_0xb044('0x4')](),controller[_0xb044('0x7')]);router['get'](_0xb044('0x8'),auth[_0xb044('0x4')](),controller[_0xb044('0x9')]);router['get'](_0xb044('0xa'),auth['isAuthenticated'](),controller[_0xb044('0xb')]);router[_0xb044('0xc')](_0xb044('0xd'),auth[_0xb044('0x4')](),controller[_0xb044('0xe')]);router[_0xb044('0xc')](_0xb044('0xf'),controller['getLogo']);router[_0xb044('0xc')](_0xb044('0x10'),controller['getAvatar']);router[_0xb044('0xc')](_0xb044('0x11'),controller[_0xb044('0x12')]);router['get'](_0xb044('0x13'),controller[_0xb044('0x14')]);router['get'](_0xb044('0x15'),auth[_0xb044('0x4')](),controller[_0xb044('0x16')]);router['get'](_0xb044('0x17'),controller[_0xb044('0x18')]);router[_0xb044('0xc')](_0xb044('0x19'),auth[_0xb044('0x4')](),controller[_0xb044('0x1a')]);router[_0xb044('0xc')](_0xb044('0x1b'),auth[_0xb044('0x4')](),controller[_0xb044('0x1c')]);router[_0xb044('0xc')](_0xb044('0x1d'),controller[_0xb044('0x1e')]);router[_0xb044('0xc')](_0xb044('0x1f'),auth[_0xb044('0x4')](),controller[_0xb044('0x20')]);router[_0xb044('0xc')](_0xb044('0x21'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb044('0x22')]('/',auth['isAuthenticated'](),controller[_0xb044('0x23')]);router[_0xb044('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xb044('0x4')](),controller[_0xb044('0x24')]);var upload=multer({'storage':multer[_0xb044('0x25')]({'destination':function(_0x405516,_0x33389f,_0x5cab63){_0x5cab63(null,path[_0xb044('0x26')](config[_0xb044('0x27')],_0xb044('0x28')));},'filename':function(_0xa3372f,_0x543508,_0x3b29b8){_0x3b29b8(null,util[_0xb044('0x29')](_0xb044('0x2a'),Date[_0xb044('0x2b')](),_0x543508[_0xb044('0x2c')]));}})});router[_0xb044('0x22')](_0xb044('0xf'),upload[_0xb044('0x2d')](_0xb044('0x2e')),controller[_0xb044('0x2f')]);var upload=multer({'storage':multer[_0xb044('0x25')]({'destination':function(_0x325420,_0x523fb9,_0xf77238){_0xf77238(null,path['join'](config[_0xb044('0x27')],_0xb044('0x30')));},'filename':function(_0x555143,_0xdc433,_0x40a739){_0x40a739(null,util[_0xb044('0x29')]('%s-%s',Date[_0xb044('0x2b')](),_0xdc433[_0xb044('0x2c')]));}})});router[_0xb044('0x22')](_0xb044('0x10'),upload[_0xb044('0x2d')](_0xb044('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xb044('0x25')]({'destination':function(_0x4e1725,_0x35f94a,_0x1943d3){_0x1943d3(null,path['join'](config[_0xb044('0x27')],'server/files/images/avatars/'));},'filename':function(_0x463536,_0x25605f,_0xe40e38){_0xe40e38(null,util[_0xb044('0x29')]('%s-%s',Date[_0xb044('0x2b')](),_0x25605f[_0xb044('0x2c')]));}})});router[_0xb044('0x22')](_0xb044('0x11'),upload['single'](_0xb044('0x2e')),controller[_0xb044('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39c55b,_0xa464de,_0x31898c){_0x31898c(null,path[_0xb044('0x26')](config[_0xb044('0x27')],_0xb044('0x30')));},'filename':function(_0x818df7,_0x1a398b,_0x112c6e){_0x112c6e(null,util[_0xb044('0x29')]('%s-%s',Date[_0xb044('0x2b')](),_0x1a398b[_0xb044('0x2c')]));}})});router['post']('/:id/system_avatar',upload[_0xb044('0x2d')](_0xb044('0x2e')),controller[_0xb044('0x32')]);router[_0xb044('0x22')](_0xb044('0x33'),controller[_0xb044('0x34')]);router[_0xb044('0x22')](_0xb044('0x35'),controller['offline']);router[_0xb044('0x22')](_0xb044('0x15'),auth[_0xb044('0x4')](),controller[_0xb044('0x36')]);router[_0xb044('0x22')](_0xb044('0x19'),auth[_0xb044('0x4')](),controller['addApplications']);router[_0xb044('0x22')](_0xb044('0x1b'),auth[_0xb044('0x4')](),controller['addProactiveActions']);router[_0xb044('0x22')](_0xb044('0x21'),auth[_0xb044('0x4')](),controller[_0xb044('0x37')]);router[_0xb044('0x38')](_0xb044('0x8'),auth[_0xb044('0x4')](),controller['update']);router['delete'](_0xb044('0x8'),auth[_0xb044('0x4')](),controller[_0xb044('0x39')]);router[_0xb044('0x3a')](_0xb044('0xa'),auth[_0xb044('0x4')](),controller['removeDispositions']);router[_0xb044('0x3a')](_0xb044('0xd'),auth[_0xb044('0x4')](),controller[_0xb044('0x3b')]);router[_0xb044('0x3a')](_0xb044('0x21'),auth[_0xb044('0x4')](),controller['removeAgents']);module[_0xb044('0x3c')]=router; \ No newline at end of file +var _0xf5ee=['index','/describe','describe','/:id','show','getDispositions','isAuthenticated','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','/:id/canned_answers','diskStorage','root','format','%s-%s','now','originalname','file','join','server/files/images/avatars/','single','addAvatar','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get'];(function(_0x3d316e,_0x45afe4){var _0x22b230=function(_0x18336f){while(--_0x18336f){_0x3d316e['push'](_0x3d316e['shift']());}};_0x22b230(++_0x45afe4);}(_0xf5ee,0x106));var _0xef5e=function(_0x1fcd06,_0x2f39b6){_0x1fcd06=_0x1fcd06-0x0;var _0x2e6670=_0xf5ee[_0x1fcd06];return _0x2e6670;};'use strict';var multer=require(_0xef5e('0x0'));var util=require(_0xef5e('0x1'));var path=require(_0xef5e('0x2'));var timeout=require(_0xef5e('0x3'));var express=require(_0xef5e('0x4'));var router=express['Router']();var auth=require(_0xef5e('0x5'));var interaction=require(_0xef5e('0x6'));var config=require(_0xef5e('0x7'));var controller=require(_0xef5e('0x8'));router[_0xef5e('0x9')]('/',auth['isAuthenticated'](),controller[_0xef5e('0xa')]);router[_0xef5e('0x9')](_0xef5e('0xb'),auth['isAuthenticated'](),controller[_0xef5e('0xc')]);router[_0xef5e('0x9')](_0xef5e('0xd'),auth['isAuthenticated'](),controller[_0xef5e('0xe')]);router[_0xef5e('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xef5e('0xf')]);router[_0xef5e('0x9')]('/:id/canned_answers',auth[_0xef5e('0x10')](),controller[_0xef5e('0x11')]);router[_0xef5e('0x9')](_0xef5e('0x12'),controller[_0xef5e('0x13')]);router['get'](_0xef5e('0x14'),controller['getAvatar']);router[_0xef5e('0x9')](_0xef5e('0x15'),controller[_0xef5e('0x16')]);router[_0xef5e('0x9')](_0xef5e('0x17'),controller[_0xef5e('0x18')]);router[_0xef5e('0x9')](_0xef5e('0x19'),auth[_0xef5e('0x10')](),controller['getInteractions']);router[_0xef5e('0x9')](_0xef5e('0x1a'),controller[_0xef5e('0x1b')]);router[_0xef5e('0x9')](_0xef5e('0x1c'),auth[_0xef5e('0x10')](),controller[_0xef5e('0x1d')]);router[_0xef5e('0x9')](_0xef5e('0x1e'),auth[_0xef5e('0x10')](),controller[_0xef5e('0x1f')]);router[_0xef5e('0x9')]('/:id/fields',controller[_0xef5e('0x20')]);router['get']('/:id/offline_messages',auth[_0xef5e('0x10')](),controller[_0xef5e('0x21')]);router[_0xef5e('0x9')](_0xef5e('0x22'),auth[_0xef5e('0x10')](),controller['getAgents']);router[_0xef5e('0x23')]('/',auth['isAuthenticated'](),controller[_0xef5e('0x24')]);router[_0xef5e('0x23')]('/:id/dispositions',auth[_0xef5e('0x10')](),controller[_0xef5e('0x25')]);router[_0xef5e('0x23')](_0xef5e('0x26'),auth[_0xef5e('0x10')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xef5e('0x27')]({'destination':function(_0x149a22,_0xd17a19,_0x2627e4){_0x2627e4(null,path['join'](config[_0xef5e('0x28')],'server/files/images/logos/'));},'filename':function(_0x2a8c07,_0x29151c,_0x11539c){_0x11539c(null,util[_0xef5e('0x29')](_0xef5e('0x2a'),Date[_0xef5e('0x2b')](),_0x29151c[_0xef5e('0x2c')]));}})});router[_0xef5e('0x23')](_0xef5e('0x12'),upload['single'](_0xef5e('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0xef5e('0x27')]({'destination':function(_0x10a879,_0x31c9af,_0x303c5c){_0x303c5c(null,path[_0xef5e('0x2e')](config['root'],_0xef5e('0x2f')));},'filename':function(_0x59d2a2,_0x44b3be,_0x5815db){_0x5815db(null,util[_0xef5e('0x29')]('%s-%s',Date[_0xef5e('0x2b')](),_0x44b3be[_0xef5e('0x2c')]));}})});router[_0xef5e('0x23')](_0xef5e('0x14'),upload[_0xef5e('0x30')](_0xef5e('0x2d')),controller[_0xef5e('0x31')]);var upload=multer({'storage':multer[_0xef5e('0x27')]({'destination':function(_0x11561a,_0x3d2a46,_0x5f3b24){_0x5f3b24(null,path[_0xef5e('0x2e')](config[_0xef5e('0x28')],_0xef5e('0x2f')));},'filename':function(_0x55b3fb,_0x5beb18,_0x3f6958){_0x3f6958(null,util[_0xef5e('0x29')](_0xef5e('0x2a'),Date[_0xef5e('0x2b')](),_0x5beb18[_0xef5e('0x2c')]));}})});router['post'](_0xef5e('0x15'),upload[_0xef5e('0x30')]('file'),controller[_0xef5e('0x32')]);var upload=multer({'storage':multer[_0xef5e('0x27')]({'destination':function(_0x29a31f,_0x2a7562,_0x57977e){_0x57977e(null,path['join'](config[_0xef5e('0x28')],_0xef5e('0x2f')));},'filename':function(_0x4a0b2e,_0x177c9e,_0x35aa8c){_0x35aa8c(null,util[_0xef5e('0x29')](_0xef5e('0x2a'),Date[_0xef5e('0x2b')](),_0x177c9e[_0xef5e('0x2c')]));}})});router[_0xef5e('0x23')](_0xef5e('0x17'),upload[_0xef5e('0x30')](_0xef5e('0x2d')),controller['addSystemAvatar']);router['post'](_0xef5e('0x33'),controller[_0xef5e('0x34')]);router[_0xef5e('0x23')](_0xef5e('0x35'),controller[_0xef5e('0x36')]);router[_0xef5e('0x23')]('/:id/interactions',auth[_0xef5e('0x10')](),controller[_0xef5e('0x37')]);router['post'](_0xef5e('0x1c'),auth[_0xef5e('0x10')](),controller[_0xef5e('0x38')]);router[_0xef5e('0x23')]('/:id/proactive_actions',auth[_0xef5e('0x10')](),controller[_0xef5e('0x39')]);router[_0xef5e('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0xef5e('0x3a')]);router[_0xef5e('0x3b')](_0xef5e('0xd'),auth['isAuthenticated'](),controller[_0xef5e('0x3c')]);router[_0xef5e('0x3d')](_0xef5e('0xd'),auth[_0xef5e('0x10')](),controller[_0xef5e('0x3e')]);router[_0xef5e('0x3d')](_0xef5e('0x3f'),auth[_0xef5e('0x10')](),controller[_0xef5e('0x40')]);router['delete'](_0xef5e('0x26'),auth['isAuthenticated'](),controller[_0xef5e('0x41')]);router['delete'](_0xef5e('0x22'),auth[_0xef5e('0x10')](),controller[_0xef5e('0x42')]);module[_0xef5e('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 228f2a7..17131bf 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 _0x21cd=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x36b997,_0x4675f5){var _0x103258=function(_0x916663){while(--_0x916663){_0x36b997['push'](_0x36b997['shift']());}};_0x103258(++_0x4675f5);}(_0x21cd,0x6a));var _0xd21c=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x21cd[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xd21c('0x0'));module[_0xd21c('0x1')]={'name':{'type':Sequelize[_0xd21c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd21c('0x3')](_0xd21c('0x4'),_0xd21c('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xd21c('0x2')]},'data2':{'type':Sequelize[_0xd21c('0x2')]}}; \ No newline at end of file +var _0x304b=['Google','exports','STRING','ENUM','AmazonAWS'];(function(_0x4f67da,_0x58faef){var _0x3f6811=function(_0xd321d2){while(--_0xd321d2){_0x4f67da['push'](_0x4f67da['shift']());}};_0x3f6811(++_0x58faef);}(_0x304b,0xfb));var _0xb304=function(_0x48f5da,_0x3a4161){_0x48f5da=_0x48f5da-0x0;var _0x4d2a50=_0x304b[_0x48f5da];return _0x4d2a50;};'use strict';var Sequelize=require('sequelize');module[_0xb304('0x0')]={'name':{'type':Sequelize[_0xb304('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb304('0x2')](_0xb304('0x3'),_0xb304('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xb304('0x1')]},'data2':{'type':Sequelize[_0xb304('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 4058d15..55a05eb 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 _0x5686=['apply','save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','CloudProvider','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x244677,_0x444efb){var _0x424e7d=function(_0x25d045){while(--_0x25d045){_0x244677['push'](_0x244677['shift']());}};_0x424e7d(++_0x444efb);}(_0x5686,0xbc));var _0x6568=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x5686[_0x39f375];return _0x463f93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6568('0x0'));var rimraf=require(_0x6568('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6568('0x2'));var rp=require(_0x6568('0x3'));var moment=require(_0x6568('0x4'));var BPromise=require(_0x6568('0x5'));var Mustache=require(_0x6568('0x6'));var util=require(_0x6568('0x7'));var path=require(_0x6568('0x8'));var sox=require('sox');var csv=require(_0x6568('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6568('0xa'));var squel=require(_0x6568('0xb'));var crypto=require('crypto');var jsforce=require(_0x6568('0xc'));var deskjs=require(_0x6568('0xd'));var toCsv=require(_0x6568('0x9'));var querystring=require('querystring');var Papa=require(_0x6568('0xe'));var Redis=require(_0x6568('0xf'));var authService=require(_0x6568('0x10'));var qs=require(_0x6568('0x11'));var as=require(_0x6568('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6568('0x13'))(_0x6568('0x14'));var utils=require(_0x6568('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6568('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae9cb,_0x42e59e){_0x42e59e=_0x42e59e||0xcc;return function(_0x569576){if(_0x569576){return _0x4ae9cb['sendStatus'](_0x42e59e);}return _0x4ae9cb[_0x6568('0x17')](_0x42e59e)[_0x6568('0x18')]();};}function respondWithResult(_0x3d410c,_0x1bde82){_0x1bde82=_0x1bde82||0xc8;return function(_0x3b9668){if(_0x3b9668){return _0x3d410c['status'](_0x1bde82)[_0x6568('0x19')](_0x3b9668);}};}function respondWithFilteredResult(_0x422d2c,_0x3b467d){return function(_0x5d7050){if(_0x5d7050){var _0x34ee76=_0x5d7050[_0x6568('0x1a')],_0x20450a=_0x3b467d[_0x6568('0x1b')],_0x1f5cae=_0x3b467d['offset']+_0x3b467d[_0x6568('0x1c')],_0x220db0;if(_0x1f5cae>=_0x34ee76){_0x1f5cae=_0x34ee76;_0x220db0=0xc8;}else{_0x220db0=0xce;}_0x422d2c[_0x6568('0x17')](_0x220db0);return _0x422d2c[_0x6568('0x1d')](_0x6568('0x1e'),_0x20450a+'-'+_0x1f5cae+'/'+_0x34ee76)[_0x6568('0x19')](_0x5d7050);}return null;};}function patchUpdates(_0x3b4467){return function(_0x2bf57a){try{jsonpatch[_0x6568('0x1f')](_0x2bf57a,_0x3b4467,!![]);}catch(_0x854239){return BPromise['reject'](_0x854239);}return _0x2bf57a[_0x6568('0x20')]();};}function saveUpdates(_0x556659,_0x59aad4){return function(_0x589184){if(_0x589184){return _0x589184[_0x6568('0x21')](_0x556659)[_0x6568('0x22')](function(_0x55ba58){return _0x55ba58;});}return null;};}function removeEntity(_0x132597,_0x4c1613){return function(_0x1fa134){if(_0x1fa134){return _0x1fa134[_0x6568('0x23')]()[_0x6568('0x22')](function(){_0x132597[_0x6568('0x17')](0xcc)[_0x6568('0x18')]();});}};}function handleEntityNotFound(_0x5415bf,_0x465180){return function(_0x33642e){if(!_0x33642e){_0x5415bf[_0x6568('0x24')](0x194);}return _0x33642e;};}function handleError(_0x1e2a76,_0x3e870a){_0x3e870a=_0x3e870a||0x1f4;return function(_0xe6d75e){logger[_0x6568('0x25')](_0xe6d75e[_0x6568('0x26')]);if(_0xe6d75e['name']){delete _0xe6d75e[_0x6568('0x27')];}_0x1e2a76[_0x6568('0x17')](_0x3e870a)['send'](_0xe6d75e);};}exports[_0x6568('0x28')]=function(_0x2db85f,_0x186609){var _0x369cb5={},_0x5ca42d={},_0x4820f5={'count':0x0,'rows':[]};var _0x25f7a4=_['map'](db['CloudProvider'][_0x6568('0x29')],function(_0x5590bc){return{'name':_0x5590bc[_0x6568('0x2a')],'type':_0x5590bc[_0x6568('0x2b')]['key']};});_0x5ca42d['model']=_['map'](_0x25f7a4,'name');_0x5ca42d['query']=_[_0x6568('0x2c')](_0x2db85f[_0x6568('0x2d')]);_0x5ca42d['filters']=_[_0x6568('0x2e')](_0x5ca42d['model'],_0x5ca42d['query']);_0x369cb5[_0x6568('0x2f')]=_[_0x6568('0x2e')](_0x5ca42d[_0x6568('0x30')],qs[_0x6568('0x31')](_0x2db85f[_0x6568('0x2d')][_0x6568('0x31')]));_0x369cb5[_0x6568('0x2f')]=_0x369cb5[_0x6568('0x2f')][_0x6568('0x32')]?_0x369cb5[_0x6568('0x2f')]:_0x5ca42d[_0x6568('0x30')];if(!_0x2db85f[_0x6568('0x2d')][_0x6568('0x33')](_0x6568('0x34'))){_0x369cb5[_0x6568('0x1c')]=qs[_0x6568('0x1c')](_0x2db85f['query']['limit']);_0x369cb5[_0x6568('0x1b')]=qs[_0x6568('0x1b')](_0x2db85f['query']['offset']);}_0x369cb5[_0x6568('0x35')]=qs[_0x6568('0x36')](_0x2db85f[_0x6568('0x2d')]['sort']);_0x369cb5['where']=qs[_0x6568('0x37')](_[_0x6568('0x38')](_0x2db85f['query'],_0x5ca42d[_0x6568('0x37')]),_0x25f7a4);if(_0x2db85f[_0x6568('0x2d')][_0x6568('0x39')]){_0x369cb5[_0x6568('0x3a')]=_[_0x6568('0x3b')](_0x369cb5[_0x6568('0x3a')],{'$or':_[_0x6568('0x3c')](_0x25f7a4,function(_0x2ff81b){if(_0x2ff81b[_0x6568('0x2b')]!==_0x6568('0x3d')){var _0x117c70={};_0x117c70[_0x2ff81b[_0x6568('0x27')]]={'$like':'%'+_0x2db85f['query'][_0x6568('0x39')]+'%'};return _0x117c70;}})});}_0x369cb5=_[_0x6568('0x3b')]({},_0x369cb5,_0x2db85f[_0x6568('0x3e')]);var _0x20f755={'where':_0x369cb5['where']};return db[_0x6568('0x3f')][_0x6568('0x1a')](_0x20f755)[_0x6568('0x22')](function(_0x5f3f84){_0x4820f5[_0x6568('0x1a')]=_0x5f3f84;if(_0x2db85f[_0x6568('0x2d')][_0x6568('0x40')]){_0x369cb5[_0x6568('0x41')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x369cb5);})[_0x6568('0x22')](function(_0x595691){_0x4820f5[_0x6568('0x42')]=_0x595691;return _0x4820f5;})[_0x6568('0x22')](respondWithFilteredResult(_0x186609,_0x369cb5))[_0x6568('0x43')](handleError(_0x186609,null));};exports[_0x6568('0x44')]=function(_0x266d7c,_0x57dc5b){var _0x4012cf={'raw':!![],'where':{'id':_0x266d7c[_0x6568('0x45')]['id']}},_0x285f44={};_0x285f44[_0x6568('0x30')]=_[_0x6568('0x2c')](db[_0x6568('0x3f')]['rawAttributes']);_0x285f44['query']=_['keys'](_0x266d7c[_0x6568('0x2d')]);_0x285f44[_0x6568('0x37')]=_[_0x6568('0x2e')](_0x285f44[_0x6568('0x30')],_0x285f44[_0x6568('0x2d')]);_0x4012cf['attributes']=_[_0x6568('0x2e')](_0x285f44[_0x6568('0x30')],qs[_0x6568('0x31')](_0x266d7c[_0x6568('0x2d')][_0x6568('0x31')]));_0x4012cf['attributes']=_0x4012cf['attributes'][_0x6568('0x32')]?_0x4012cf[_0x6568('0x2f')]:_0x285f44[_0x6568('0x30')];if(_0x266d7c[_0x6568('0x2d')]['includeAll']){_0x4012cf[_0x6568('0x41')]=[{'all':!![]}];}_0x4012cf=_[_0x6568('0x3b')]({},_0x4012cf,_0x266d7c[_0x6568('0x3e')]);return db[_0x6568('0x3f')][_0x6568('0x46')](_0x4012cf)[_0x6568('0x22')](handleEntityNotFound(_0x57dc5b,null))['then'](respondWithResult(_0x57dc5b,null))[_0x6568('0x43')](handleError(_0x57dc5b,null));};exports[_0x6568('0x47')]=function(_0x433358,_0x32efd3){return db[_0x6568('0x3f')]['create'](_0x433358[_0x6568('0x48')],{})[_0x6568('0x22')](respondWithResult(_0x32efd3,0xc9))['catch'](handleError(_0x32efd3,null));};exports[_0x6568('0x21')]=function(_0x21ff21,_0x41dbaf){if(_0x21ff21['body']['id']){delete _0x21ff21[_0x6568('0x48')]['id'];}return db[_0x6568('0x3f')]['find']({'where':{'id':_0x21ff21[_0x6568('0x45')]['id']}})['then'](handleEntityNotFound(_0x41dbaf,null))[_0x6568('0x22')](saveUpdates(_0x21ff21[_0x6568('0x48')],null))['then'](respondWithResult(_0x41dbaf,null))[_0x6568('0x43')](handleError(_0x41dbaf,null));};exports[_0x6568('0x23')]=function(_0x20aa77,_0x34658c){return db['CloudProvider'][_0x6568('0x46')]({'where':{'id':_0x20aa77['params']['id']}})['then'](handleEntityNotFound(_0x34658c,null))[_0x6568('0x22')](removeEntity(_0x34658c,null))[_0x6568('0x43')](handleError(_0x34658c,null));}; \ No newline at end of file +var _0xa581=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','CloudProvider','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','count','includeAll','rows','catch','params','keys','include','merge','find','create','update','body','html-pdf','eml-format'];(function(_0x982fbd,_0x47e9d1){var _0x652488=function(_0xfaa971){while(--_0xfaa971){_0x982fbd['push'](_0x982fbd['shift']());}};_0x652488(++_0x47e9d1);}(_0xa581,0x90));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1a58('0x0'));var emlformat=require(_0x1a58('0x1'));var rimraf=require(_0x1a58('0x2'));var zipdir=require(_0x1a58('0x3'));var jsonpatch=require(_0x1a58('0x4'));var rp=require(_0x1a58('0x5'));var moment=require(_0x1a58('0x6'));var BPromise=require(_0x1a58('0x7'));var Mustache=require('mustache');var util=require(_0x1a58('0x8'));var path=require(_0x1a58('0x9'));var sox=require(_0x1a58('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a58('0xb'));var squel=require(_0x1a58('0xc'));var crypto=require(_0x1a58('0xd'));var jsforce=require(_0x1a58('0xe'));var deskjs=require(_0x1a58('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1a58('0x10'));var Papa=require(_0x1a58('0x11'));var Redis=require(_0x1a58('0x12'));var authService=require(_0x1a58('0x13'));var qs=require(_0x1a58('0x14'));var as=require(_0x1a58('0x15'));var hardwareService=require(_0x1a58('0x16'));var logger=require(_0x1a58('0x17'))(_0x1a58('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a58('0x19'));var db=require(_0x1a58('0x1a'))['db'];function respondWithStatusCode(_0x26fbb6,_0x2e5f81){_0x2e5f81=_0x2e5f81||0xcc;return function(_0x1fbfd9){if(_0x1fbfd9){return _0x26fbb6[_0x1a58('0x1b')](_0x2e5f81);}return _0x26fbb6[_0x1a58('0x1c')](_0x2e5f81)[_0x1a58('0x1d')]();};}function respondWithResult(_0x3956cd,_0x2936e0){_0x2936e0=_0x2936e0||0xc8;return function(_0x5d2ab0){if(_0x5d2ab0){return _0x3956cd[_0x1a58('0x1c')](_0x2936e0)['json'](_0x5d2ab0);}};}function respondWithFilteredResult(_0x39653d,_0x38a578){return function(_0x13952d){if(_0x13952d){var _0x5761eb=_0x13952d['count'],_0x4b7039=_0x38a578[_0x1a58('0x1e')],_0x54fa6e=_0x38a578[_0x1a58('0x1e')]+_0x38a578[_0x1a58('0x1f')],_0x340d84;if(_0x54fa6e>=_0x5761eb){_0x54fa6e=_0x5761eb;_0x340d84=0xc8;}else{_0x340d84=0xce;}_0x39653d[_0x1a58('0x1c')](_0x340d84);return _0x39653d[_0x1a58('0x20')](_0x1a58('0x21'),_0x4b7039+'-'+_0x54fa6e+'/'+_0x5761eb)['json'](_0x13952d);}return null;};}function patchUpdates(_0x41aec5){return function(_0x897e75){try{jsonpatch[_0x1a58('0x22')](_0x897e75,_0x41aec5,!![]);}catch(_0x3d6b35){return BPromise[_0x1a58('0x23')](_0x3d6b35);}return _0x897e75[_0x1a58('0x24')]();};}function saveUpdates(_0x472195,_0x37e51d){return function(_0x9c0fb8){if(_0x9c0fb8){return _0x9c0fb8['update'](_0x472195)[_0x1a58('0x25')](function(_0xe173fa){return _0xe173fa;});}return null;};}function removeEntity(_0x530801,_0x2a61c0){return function(_0x5442d6){if(_0x5442d6){return _0x5442d6[_0x1a58('0x26')]()[_0x1a58('0x25')](function(){_0x530801[_0x1a58('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cbf86,_0xe05971){return function(_0x587784){if(!_0x587784){_0x5cbf86[_0x1a58('0x1b')](0x194);}return _0x587784;};}function handleError(_0x22d6cf,_0x1a17f9){_0x1a17f9=_0x1a17f9||0x1f4;return function(_0x56e129){logger['error'](_0x56e129[_0x1a58('0x27')]);if(_0x56e129[_0x1a58('0x28')]){delete _0x56e129['name'];}_0x22d6cf['status'](_0x1a17f9)['send'](_0x56e129);};}exports[_0x1a58('0x29')]=function(_0x22842a,_0x2a9934){var _0x3a4317={},_0x5e0abe={},_0x3ce6c5={'count':0x0,'rows':[]};var _0x3f368e=_['map'](db[_0x1a58('0x2a')][_0x1a58('0x2b')],function(_0x2b77c8){return{'name':_0x2b77c8[_0x1a58('0x2c')],'type':_0x2b77c8[_0x1a58('0x2d')]['key']};});_0x5e0abe[_0x1a58('0x2e')]=_['map'](_0x3f368e,'name');_0x5e0abe['query']=_['keys'](_0x22842a[_0x1a58('0x2f')]);_0x5e0abe[_0x1a58('0x30')]=_[_0x1a58('0x31')](_0x5e0abe[_0x1a58('0x2e')],_0x5e0abe[_0x1a58('0x2f')]);_0x3a4317[_0x1a58('0x32')]=_[_0x1a58('0x31')](_0x5e0abe[_0x1a58('0x2e')],qs[_0x1a58('0x33')](_0x22842a['query']['fields']));_0x3a4317[_0x1a58('0x32')]=_0x3a4317['attributes'][_0x1a58('0x34')]?_0x3a4317[_0x1a58('0x32')]:_0x5e0abe['model'];if(!_0x22842a[_0x1a58('0x2f')][_0x1a58('0x35')](_0x1a58('0x36'))){_0x3a4317[_0x1a58('0x1f')]=qs[_0x1a58('0x1f')](_0x22842a[_0x1a58('0x2f')][_0x1a58('0x1f')]);_0x3a4317[_0x1a58('0x1e')]=qs['offset'](_0x22842a[_0x1a58('0x2f')][_0x1a58('0x1e')]);}_0x3a4317['order']=qs[_0x1a58('0x37')](_0x22842a[_0x1a58('0x2f')][_0x1a58('0x37')]);_0x3a4317[_0x1a58('0x38')]=qs['filters'](_[_0x1a58('0x39')](_0x22842a[_0x1a58('0x2f')],_0x5e0abe['filters']),_0x3f368e);if(_0x22842a[_0x1a58('0x2f')][_0x1a58('0x3a')]){_0x3a4317['where']=_['merge'](_0x3a4317['where'],{'$or':_[_0x1a58('0x3b')](_0x3f368e,function(_0x54a0c8){if(_0x54a0c8[_0x1a58('0x2d')]!=='VIRTUAL'){var _0x18b185={};_0x18b185[_0x54a0c8[_0x1a58('0x28')]]={'$like':'%'+_0x22842a['query'][_0x1a58('0x3a')]+'%'};return _0x18b185;}})});}_0x3a4317=_['merge']({},_0x3a4317,_0x22842a[_0x1a58('0x3c')]);var _0x37ed20={'where':_0x3a4317[_0x1a58('0x38')]};return db[_0x1a58('0x2a')][_0x1a58('0x3d')](_0x37ed20)[_0x1a58('0x25')](function(_0x2dedb7){_0x3ce6c5[_0x1a58('0x3d')]=_0x2dedb7;if(_0x22842a[_0x1a58('0x2f')][_0x1a58('0x3e')]){_0x3a4317['include']=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x3a4317);})[_0x1a58('0x25')](function(_0x4a8f7b){_0x3ce6c5[_0x1a58('0x3f')]=_0x4a8f7b;return _0x3ce6c5;})['then'](respondWithFilteredResult(_0x2a9934,_0x3a4317))[_0x1a58('0x40')](handleError(_0x2a9934,null));};exports['show']=function(_0x2b83df,_0x145e7c){var _0x33840d={'raw':!![],'where':{'id':_0x2b83df[_0x1a58('0x41')]['id']}},_0x67a5ea={};_0x67a5ea['model']=_['keys'](db[_0x1a58('0x2a')][_0x1a58('0x2b')]);_0x67a5ea[_0x1a58('0x2f')]=_[_0x1a58('0x42')](_0x2b83df['query']);_0x67a5ea[_0x1a58('0x30')]=_[_0x1a58('0x31')](_0x67a5ea[_0x1a58('0x2e')],_0x67a5ea[_0x1a58('0x2f')]);_0x33840d['attributes']=_[_0x1a58('0x31')](_0x67a5ea[_0x1a58('0x2e')],qs['fields'](_0x2b83df[_0x1a58('0x2f')][_0x1a58('0x33')]));_0x33840d['attributes']=_0x33840d['attributes']['length']?_0x33840d[_0x1a58('0x32')]:_0x67a5ea[_0x1a58('0x2e')];if(_0x2b83df[_0x1a58('0x2f')][_0x1a58('0x3e')]){_0x33840d[_0x1a58('0x43')]=[{'all':!![]}];}_0x33840d=_[_0x1a58('0x44')]({},_0x33840d,_0x2b83df[_0x1a58('0x3c')]);return db[_0x1a58('0x2a')][_0x1a58('0x45')](_0x33840d)[_0x1a58('0x25')](handleEntityNotFound(_0x145e7c,null))[_0x1a58('0x25')](respondWithResult(_0x145e7c,null))[_0x1a58('0x40')](handleError(_0x145e7c,null));};exports['create']=function(_0x45e086,_0x6478ec){return db[_0x1a58('0x2a')][_0x1a58('0x46')](_0x45e086['body'],{})[_0x1a58('0x25')](respondWithResult(_0x6478ec,0xc9))['catch'](handleError(_0x6478ec,null));};exports[_0x1a58('0x47')]=function(_0x4928d5,_0x454d64){if(_0x4928d5[_0x1a58('0x48')]['id']){delete _0x4928d5[_0x1a58('0x48')]['id'];}return db['CloudProvider'][_0x1a58('0x45')]({'where':{'id':_0x4928d5['params']['id']}})[_0x1a58('0x25')](handleEntityNotFound(_0x454d64,null))[_0x1a58('0x25')](saveUpdates(_0x4928d5[_0x1a58('0x48')],null))[_0x1a58('0x25')](respondWithResult(_0x454d64,null))[_0x1a58('0x40')](handleError(_0x454d64,null));};exports[_0x1a58('0x26')]=function(_0x26da75,_0x3aaa6e){return db[_0x1a58('0x2a')][_0x1a58('0x45')]({'where':{'id':_0x26da75[_0x1a58('0x41')]['id']}})['then'](handleEntityNotFound(_0x3aaa6e,null))[_0x1a58('0x25')](removeEntity(_0x3aaa6e,null))[_0x1a58('0x40')](handleError(_0x3aaa6e,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3269d15..2c271af 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 _0xb4c9=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x408600,_0x1e5934){var _0x1e0d32=function(_0x3a250d){while(--_0x3a250d){_0x408600['push'](_0x408600['shift']());}};_0x1e0d32(++_0x1e5934);}(_0xb4c9,0x16a));var _0x9b4c=function(_0x4d723e,_0x2928ae){_0x4d723e=_0x4d723e-0x0;var _0x137ec2=_0xb4c9[_0x4d723e];return _0x137ec2;};'use strict';var _=require(_0x9b4c('0x0'));var util=require(_0x9b4c('0x1'));var logger=require(_0x9b4c('0x2'))(_0x9b4c('0x3'));var moment=require(_0x9b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b4c('0x5'));var fs=require('fs');var path=require(_0x9b4c('0x6'));var rimraf=require(_0x9b4c('0x7'));var config=require(_0x9b4c('0x8'));var attributes=require('./cloudProvider.attributes');module[_0x9b4c('0x9')]=function(_0x4384bb,_0x42b4c3){return _0x4384bb['define'](_0x9b4c('0xa'),attributes,{'tableName':_0x9b4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d80=['../../config/logger','api','bluebird','request-promise','../../config/environment','exports','cloud_providers','lodash','util'];(function(_0x51245f,_0x161fd1){var _0x55dcaa=function(_0x2208c8){while(--_0x2208c8){_0x51245f['push'](_0x51245f['shift']());}};_0x55dcaa(++_0x161fd1);}(_0x5d80,0x15d));var _0x05d8=function(_0x25a73b,_0x341995){_0x25a73b=_0x25a73b-0x0;var _0x383c76=_0x5d80[_0x25a73b];return _0x383c76;};'use strict';var _=require(_0x05d8('0x0'));var util=require(_0x05d8('0x1'));var logger=require(_0x05d8('0x2'))(_0x05d8('0x3'));var moment=require('moment');var BPromise=require(_0x05d8('0x4'));var rp=require(_0x05d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x05d8('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x05d8('0x7')]=function(_0x5e7db2,_0x37a6d5){return _0x5e7db2['define']('CloudProvider',attributes,{'tableName':_0x05d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 9f453e6..9a957ed 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 _0x1269=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis'];(function(_0xbe1fd0,_0x1cc3be){var _0x37ab42=function(_0x362422){while(--_0x362422){_0xbe1fd0['push'](_0xbe1fd0['shift']());}};_0x37ab42(++_0x1cc3be);}(_0x1269,0xb0));var _0x9126=function(_0x590861,_0x42c7f3){_0x590861=_0x590861-0x0;var _0x1d0a80=_0x1269[_0x590861];return _0x1d0a80;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9126('0x0'));var BPromise=require(_0x9126('0x1'));var rs=require(_0x9126('0x2'));var fs=require('fs');var Redis=require(_0x9126('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9126('0x4'));var config=require(_0x9126('0x5'));var jayson=require(_0x9126('0x6'));var client=jayson[_0x9126('0x7')][_0x9126('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x291aa3,_0x14bddd,_0x14b493){return new BPromise(function(_0x21a302,_0x568481){return client[_0x9126('0x9')](_0x291aa3,_0x14b493)['then'](function(_0x3d8f66){logger[_0x9126('0xa')]('CloudProvider,\x20%s,\x20%s',_0x14bddd,_0x9126('0xb'));logger[_0x9126('0xc')](_0x9126('0xd'),_0x14bddd,_0x9126('0xb'),JSON[_0x9126('0xe')](_0x3d8f66));if(_0x3d8f66[_0x9126('0xf')]){if(_0x3d8f66[_0x9126('0xf')][_0x9126('0x10')]===0x1f4){logger[_0x9126('0xf')](_0x9126('0x11'),_0x14bddd,_0x3d8f66[_0x9126('0xf')][_0x9126('0x12')]);return _0x568481(_0x3d8f66[_0x9126('0xf')]['message']);}logger[_0x9126('0xf')](_0x9126('0x11'),_0x14bddd,_0x3d8f66[_0x9126('0xf')][_0x9126('0x12')]);return _0x21a302(_0x3d8f66[_0x9126('0xf')][_0x9126('0x12')]);}else{logger[_0x9126('0xa')](_0x9126('0x11'),_0x14bddd,_0x9126('0xb'));_0x21a302(_0x3d8f66[_0x9126('0x13')][_0x9126('0x12')]);}})['catch'](function(_0x3eff9b){logger[_0x9126('0xf')]('CloudProvider,\x20%s,\x20%s',_0x14bddd,_0x3eff9b);_0x568481(_0x3eff9b);});});} \ No newline at end of file +var _0x745a=['request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x436905,_0xbaa66){var _0x130637=function(_0xe957b4){while(--_0xe957b4){_0x436905['push'](_0x436905['shift']());}};_0x130637(++_0xbaa66);}(_0x745a,0x1cf));var _0xa745=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x745a[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xa745('0x0'));var util=require(_0xa745('0x1'));var moment=require(_0xa745('0x2'));var BPromise=require('bluebird');var rs=require(_0xa745('0x3'));var fs=require('fs');var Redis=require(_0xa745('0x4'));var db=require(_0xa745('0x5'))['db'];var utils=require(_0xa745('0x6'));var logger=require(_0xa745('0x7'))(_0xa745('0x8'));var config=require(_0xa745('0x9'));var jayson=require(_0xa745('0xa'));var client=jayson[_0xa745('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8b0f5,_0x4d1b47,_0x4b113a){return new BPromise(function(_0x334be0,_0x44c4ac){return client[_0xa745('0xc')](_0x8b0f5,_0x4b113a)[_0xa745('0xd')](function(_0x223153){logger[_0xa745('0xe')]('CloudProvider,\x20%s,\x20%s',_0x4d1b47,_0xa745('0xf'));logger[_0xa745('0x10')](_0xa745('0x11'),_0x4d1b47,'request\x20sent',JSON[_0xa745('0x12')](_0x223153));if(_0x223153['error']){if(_0x223153['error'][_0xa745('0x13')]===0x1f4){logger[_0xa745('0x14')](_0xa745('0x15'),_0x4d1b47,_0x223153[_0xa745('0x14')][_0xa745('0x16')]);return _0x44c4ac(_0x223153[_0xa745('0x14')][_0xa745('0x16')]);}logger['error'](_0xa745('0x15'),_0x4d1b47,_0x223153[_0xa745('0x14')]['message']);return _0x334be0(_0x223153['error'][_0xa745('0x16')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x4d1b47,_0xa745('0xf'));_0x334be0(_0x223153[_0xa745('0x17')][_0xa745('0x16')]);}})[_0xa745('0x18')](function(_0x51f263){logger[_0xa745('0x14')]('CloudProvider,\x20%s,\x20%s',_0x4d1b47,_0x51f263);_0x44c4ac(_0x51f263);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2a9ae1b..699a2b6 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 _0x61ef=['../../config/environment','./cloudProvider.controller','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2c803d,_0x5ce1c5){var _0x57660f=function(_0x2d3d8b){while(--_0x2d3d8b){_0x2c803d['push'](_0x2c803d['shift']());}};_0x57660f(++_0x5ce1c5);}(_0x61ef,0x1ce));var _0xf61e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x61ef[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xf61e('0x0'));var util=require(_0xf61e('0x1'));var path=require(_0xf61e('0x2'));var timeout=require(_0xf61e('0x3'));var express=require(_0xf61e('0x4'));var router=express[_0xf61e('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf61e('0x6'));var controller=require(_0xf61e('0x7'));router['get']('/',auth[_0xf61e('0x8')](),controller[_0xf61e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf61e('0xa')]('/',auth[_0xf61e('0x8')](),controller[_0xf61e('0xb')]);router[_0xf61e('0xc')](_0xf61e('0xd'),auth[_0xf61e('0x8')](),controller[_0xf61e('0xe')]);router[_0xf61e('0xf')]('/:id',auth[_0xf61e('0x8')](),controller[_0xf61e('0x10')]);module[_0xf61e('0x11')]=router; \ No newline at end of file +var _0xe61d=['delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','index','get','show','post','create','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe61d,0xc1));var _0xde61=function(_0x2dc80c,_0x275d00){_0x2dc80c=_0x2dc80c-0x0;var _0x43e7d6=_0xe61d[_0x2dc80c];return _0x43e7d6;};'use strict';var multer=require(_0xde61('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde61('0x1'));var router=express[_0xde61('0x2')]();var auth=require(_0xde61('0x3'));var interaction=require(_0xde61('0x4'));var config=require(_0xde61('0x5'));var controller=require(_0xde61('0x6'));router['get']('/',auth[_0xde61('0x7')](),controller[_0xde61('0x8')]);router[_0xde61('0x9')]('/:id',auth[_0xde61('0x7')](),controller[_0xde61('0xa')]);router[_0xde61('0xb')]('/',auth['isAuthenticated'](),controller[_0xde61('0xc')]);router[_0xde61('0xd')](_0xde61('0xe'),auth[_0xde61('0x7')](),controller[_0xde61('0xf')]);router[_0xde61('0x10')](_0xde61('0xe'),auth[_0xde61('0x7')](),controller[_0xde61('0x11')]);module[_0xde61('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b90e76d..5da8498 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 _0xa4f5=['sequelize','exports','STRING'];(function(_0x230e0d,_0x1346e0){var _0x310861=function(_0x24ba74){while(--_0x24ba74){_0x230e0d['push'](_0x230e0d['shift']());}};_0x310861(++_0x1346e0);}(_0xa4f5,0xe1));var _0x5a4f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa4f5[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x5a4f('0x0'));module[_0x5a4f('0x1')]={'name':{'type':Sequelize[_0x5a4f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5a4f('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x5a4f('0x2')]},'phone':{'type':Sequelize[_0x5a4f('0x2')]},'fax':{'type':Sequelize[_0x5a4f('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x5a4f('0x2')]},'postalCode':{'type':Sequelize[_0x5a4f('0x2')]},'city':{'type':Sequelize[_0x5a4f('0x2')]},'country':{'type':Sequelize[_0x5a4f('0x2')]},'email':{'type':Sequelize[_0x5a4f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5a4f('0x2')]},'sStreet':{'type':Sequelize[_0x5a4f('0x2')]},'sPostalCode':{'type':Sequelize[_0x5a4f('0x2')]},'sCity':{'type':Sequelize[_0x5a4f('0x2')]},'sCountry':{'type':Sequelize[_0x5a4f('0x2')]},'description':{'type':Sequelize[_0x5a4f('0x2')]}}; \ No newline at end of file +var _0xd7c4=['STRING','sequelize','exports','name'];(function(_0xce0e44,_0x44e3a3){var _0x209bb2=function(_0x1ce4c7){while(--_0x1ce4c7){_0xce0e44['push'](_0xce0e44['shift']());}};_0x209bb2(++_0x44e3a3);}(_0xd7c4,0x1b5));var _0x4d7c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7c4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4d7c('0x0'));module[_0x4d7c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4d7c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4d7c('0x3')]},'companyId':{'type':Sequelize[_0x4d7c('0x3')]},'website':{'type':Sequelize[_0x4d7c('0x3')]},'phone':{'type':Sequelize[_0x4d7c('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d7c('0x3')]},'street':{'type':Sequelize[_0x4d7c('0x3')]},'postalCode':{'type':Sequelize[_0x4d7c('0x3')]},'city':{'type':Sequelize[_0x4d7c('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4d7c('0x3')]},'sStreet':{'type':Sequelize[_0x4d7c('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4d7c('0x3')]},'sCountry':{'type':Sequelize[_0x4d7c('0x3')]},'description':{'type':Sequelize[_0x4d7c('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bbdbd49..d89f0d2 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 _0x0294=['sort','where','filters','pick','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','findOne','merge','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','Companies','error','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x188bfe,_0x2517cc){var _0x1a9efa=function(_0x361964){while(--_0x361964){_0x188bfe['push'](_0x188bfe['shift']());}};_0x1a9efa(++_0x2517cc);}(_0x0294,0x18e));var _0x4029=function(_0x4780cf,_0x27fde7){_0x4780cf=_0x4780cf-0x0;var _0x3a156c=_0x0294[_0x4780cf];return _0x3a156c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4029('0x0'));var rimraf=require(_0x4029('0x1'));var zipdir=require(_0x4029('0x2'));var jsonpatch=require(_0x4029('0x3'));var rp=require(_0x4029('0x4'));var moment=require(_0x4029('0x5'));var BPromise=require(_0x4029('0x6'));var Mustache=require(_0x4029('0x7'));var util=require(_0x4029('0x8'));var path=require(_0x4029('0x9'));var sox=require(_0x4029('0xa'));var csv=require(_0x4029('0xb'));var ejs=require(_0x4029('0xc'));var fs=require('fs');var _=require(_0x4029('0xd'));var squel=require(_0x4029('0xe'));var crypto=require('crypto');var jsforce=require(_0x4029('0xf'));var deskjs=require(_0x4029('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4029('0x11'));var Papa=require(_0x4029('0x12'));var Redis=require(_0x4029('0x13'));var authService=require(_0x4029('0x14'));var qs=require(_0x4029('0x15'));var as=require(_0x4029('0x16'));var hardwareService=require(_0x4029('0x17'));var logger=require('../../config/logger')(_0x4029('0x18'));var utils=require(_0x4029('0x19'));var config=require(_0x4029('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4029('0x1b'))['db'];function respondWithStatusCode(_0x263a8d,_0x1958b5){_0x1958b5=_0x1958b5||0xcc;return function(_0x4c6a49){if(_0x4c6a49){return _0x263a8d[_0x4029('0x1c')](_0x1958b5);}return _0x263a8d[_0x4029('0x1d')](_0x1958b5)[_0x4029('0x1e')]();};}function respondWithResult(_0x3da601,_0x17f4e4){_0x17f4e4=_0x17f4e4||0xc8;return function(_0x363074){if(_0x363074){return _0x3da601[_0x4029('0x1d')](_0x17f4e4)['json'](_0x363074);}};}function respondWithFilteredResult(_0xe5e92b,_0x2cdaec){return function(_0x1adc90){if(_0x1adc90){var _0x5f4cb4=_0x1adc90[_0x4029('0x1f')],_0x181610=_0x2cdaec['offset'],_0x2af160=_0x2cdaec[_0x4029('0x20')]+_0x2cdaec[_0x4029('0x21')],_0x1e3e31;if(_0x2af160>=_0x5f4cb4){_0x2af160=_0x5f4cb4;_0x1e3e31=0xc8;}else{_0x1e3e31=0xce;}_0xe5e92b[_0x4029('0x1d')](_0x1e3e31);return _0xe5e92b['set'](_0x4029('0x22'),_0x181610+'-'+_0x2af160+'/'+_0x5f4cb4)[_0x4029('0x23')](_0x1adc90);}return null;};}function patchUpdates(_0x31e29b){return function(_0x19042f){try{jsonpatch[_0x4029('0x24')](_0x19042f,_0x31e29b,!![]);}catch(_0x3a9a9a){return BPromise[_0x4029('0x25')](_0x3a9a9a);}return _0x19042f[_0x4029('0x26')]();};}function saveUpdates(_0x486ac9,_0x55cd02){return function(_0x5ba946){if(_0x5ba946){return _0x5ba946['update'](_0x486ac9)[_0x4029('0x27')](function(_0x56bbe7){return _0x56bbe7;});}return null;};}function removeEntity(_0x2af02a,_0x2fba41){return function(_0xe8567c){if(_0xe8567c){return _0xe8567c[_0x4029('0x28')]()[_0x4029('0x27')](function(){var _0xae91e0=_0xe8567c['get']({'plain':!![]});var _0x1451bb=_0x4029('0x29');return db['UserProfileResource'][_0x4029('0x28')]({'where':{'type':_0x1451bb,'resourceId':_0xae91e0['id']}})[_0x4029('0x27')](function(){return _0xe8567c;});})['then'](function(){_0x2af02a[_0x4029('0x1d')](0xcc)[_0x4029('0x1e')]();});}};}function handleEntityNotFound(_0x1713c1,_0x10eb87){return function(_0x26070e){if(!_0x26070e){_0x1713c1['sendStatus'](0x194);}return _0x26070e;};}function handleError(_0x4c0a8a,_0x12a9dc){_0x12a9dc=_0x12a9dc||0x1f4;return function(_0xde049){logger[_0x4029('0x2a')](_0xde049['stack']);if(_0xde049['name']){delete _0xde049['name'];}_0x4c0a8a[_0x4029('0x1d')](_0x12a9dc)[_0x4029('0x2b')](_0xde049);};}exports[_0x4029('0x2c')]=function(_0x2b469e,_0x1685e3){var _0x5c785d={},_0x3b9020={},_0x275d5d={'count':0x0,'rows':[]};return db[_0x4029('0x2d')][_0x4029('0x2e')]()[_0x4029('0x27')](function(_0x592975){_0x3b9020[_0x4029('0x2f')]=_[_0x4029('0x30')](_0x592975);_0x3b9020[_0x4029('0x31')]=_[_0x4029('0x30')](_0x2b469e[_0x4029('0x31')]);_0x3b9020['filters']=_[_0x4029('0x32')](_0x3b9020[_0x4029('0x2f')],_0x3b9020['query']);_0x5c785d[_0x4029('0x33')]=_[_0x4029('0x32')](_0x3b9020[_0x4029('0x2f')],qs[_0x4029('0x34')](_0x2b469e['query'][_0x4029('0x34')]));_0x5c785d[_0x4029('0x33')]=_0x5c785d[_0x4029('0x33')][_0x4029('0x35')]?_0x5c785d[_0x4029('0x33')]:_0x3b9020[_0x4029('0x2f')];if(!_0x2b469e[_0x4029('0x31')][_0x4029('0x36')](_0x4029('0x37'))){_0x5c785d[_0x4029('0x21')]=qs['limit'](_0x2b469e[_0x4029('0x31')][_0x4029('0x21')]);_0x5c785d[_0x4029('0x20')]=qs[_0x4029('0x20')](_0x2b469e[_0x4029('0x31')][_0x4029('0x20')]);}_0x5c785d[_0x4029('0x38')]=qs[_0x4029('0x39')](_0x2b469e[_0x4029('0x31')]['sort']);_0x5c785d[_0x4029('0x3a')]=qs[_0x4029('0x3b')](_[_0x4029('0x3c')](_0x2b469e[_0x4029('0x31')],_0x3b9020['filters']),_0x592975);if(_0x2b469e[_0x4029('0x31')][_0x4029('0x3d')]){_0x5c785d[_0x4029('0x3a')]=_['merge'](_0x5c785d[_0x4029('0x3a')],{'$or':_['map'](_0x5c785d[_0x4029('0x33')],function(_0x5e5715){var _0x4efcc9={};_0x4efcc9[_0x5e5715]={'$like':'%'+_0x2b469e['query'][_0x4029('0x3d')]+'%'};return _0x4efcc9;})});}_0x5c785d=_['merge']({},_0x5c785d,_0x2b469e[_0x4029('0x3e')]);var _0x33c375={'where':_0x5c785d[_0x4029('0x3a')]};return db[_0x4029('0x2d')]['count'](_0x33c375)[_0x4029('0x27')](function(_0x46c3d2){_0x275d5d[_0x4029('0x1f')]=_0x46c3d2;if(_0x2b469e[_0x4029('0x31')][_0x4029('0x3f')]){_0x5c785d[_0x4029('0x40')]=[{'all':!![]}];}return db[_0x4029('0x2d')]['findAll'](_0x5c785d);})[_0x4029('0x27')](function(_0x53572f){_0x275d5d[_0x4029('0x41')]=_0x53572f;return _0x275d5d;})[_0x4029('0x27')](respondWithFilteredResult(_0x1685e3,_0x5c785d))[_0x4029('0x42')](handleError(_0x1685e3,null));})[_0x4029('0x42')](handleError(_0x1685e3,null));};exports[_0x4029('0x43')]=function(_0xbf39d8,_0xb4f440){var _0x4160f4={'raw':![],'where':{'id':_0xbf39d8[_0x4029('0x44')]['id']}},_0x23cc98={};_0x23cc98['model']=_[_0x4029('0x30')](db[_0x4029('0x2d')][_0x4029('0x45')]);_0x23cc98[_0x4029('0x31')]=_[_0x4029('0x30')](_0xbf39d8[_0x4029('0x31')]);_0x23cc98['filters']=_[_0x4029('0x32')](_0x23cc98['model'],_0x23cc98[_0x4029('0x31')]);_0x4160f4[_0x4029('0x33')]=_[_0x4029('0x32')](_0x23cc98[_0x4029('0x2f')],qs[_0x4029('0x34')](_0xbf39d8[_0x4029('0x31')][_0x4029('0x34')]));_0x4160f4['attributes']=_0x4160f4[_0x4029('0x33')]['length']?_0x4160f4[_0x4029('0x33')]:_0x23cc98[_0x4029('0x2f')];if(_0xbf39d8['query'][_0x4029('0x3f')]){_0x4160f4['include']=[{'all':!![]}];}_0x4160f4=_['merge']({},_0x4160f4,_0xbf39d8[_0x4029('0x3e')]);return db[_0x4029('0x2d')][_0x4029('0x46')](_0x4160f4)['then'](handleEntityNotFound(_0xb4f440,null))[_0x4029('0x27')](respondWithResult(_0xb4f440,null))[_0x4029('0x42')](handleError(_0xb4f440,null));};exports[_0x4029('0x47')]=function(_0x549d80,_0x7e0976){return db[_0x4029('0x2d')]['create'](_0x549d80[_0x4029('0x48')],{})[_0x4029('0x27')](function(_0x1b0033){var _0x3563cf=_0x549d80[_0x4029('0x49')][_0x4029('0x4a')]({'plain':!![]});if(!_0x3563cf)throw new Error(_0x4029('0x4b'));if(_0x3563cf[_0x4029('0x4c')]===_0x4029('0x49')){var _0x58ac79=_0x1b0033[_0x4029('0x4a')]({'plain':!![]});var _0x94a985=_0x4029('0x29');return db[_0x4029('0x4d')][_0x4029('0x46')]({'where':{'name':_0x94a985,'userProfileId':_0x3563cf[_0x4029('0x4e')]},'raw':!![]})['then'](function(_0x496b55){if(_0x496b55&&_0x496b55[_0x4029('0x4f')]===0x0){return db['UserProfileResource'][_0x4029('0x47')]({'name':_0x58ac79[_0x4029('0x50')],'resourceId':_0x58ac79['id'],'type':_0x496b55[_0x4029('0x50')],'sectionId':_0x496b55['id']},{})[_0x4029('0x27')](function(){return _0x1b0033;});}else{return _0x1b0033;}})[_0x4029('0x42')](function(_0x22b0e4){logger[_0x4029('0x2a')](_0x4029('0x51'),_0x22b0e4);throw _0x22b0e4;});}return _0x1b0033;})[_0x4029('0x27')](respondWithResult(_0x7e0976,0xc9))[_0x4029('0x42')](handleError(_0x7e0976,null));};exports[_0x4029('0x52')]=function(_0x3a482c,_0x1c1a1b){if(_0x3a482c[_0x4029('0x48')]['id']){delete _0x3a482c['body']['id'];}return db[_0x4029('0x2d')][_0x4029('0x46')]({'where':{'id':_0x3a482c['params']['id']}})[_0x4029('0x27')](handleEntityNotFound(_0x1c1a1b,null))[_0x4029('0x27')](saveUpdates(_0x3a482c[_0x4029('0x48')],null))['then'](respondWithResult(_0x1c1a1b,null))[_0x4029('0x42')](handleError(_0x1c1a1b,null));};exports['destroy']=function(_0x43c6e9,_0x41512e){return db['CmCompany'][_0x4029('0x46')]({'where':{'id':_0x43c6e9[_0x4029('0x44')]['id']}})[_0x4029('0x27')](handleEntityNotFound(_0x41512e,null))[_0x4029('0x27')](removeEntity(_0x41512e,null))[_0x4029('0x42')](handleError(_0x41512e,null));};exports['describe']=function(_0x2b0706,_0x57ee8a){return db[_0x4029('0x2d')][_0x4029('0x2e')]()['then'](respondWithResult(_0x57ee8a,null))[_0x4029('0x42')](handleError(_0x57ee8a,null));};exports[_0x4029('0x53')]=function(_0x38b50a,_0x3aa5fa,_0x4bd6d5){return db[_0x4029('0x54')][_0x4029('0x46')]({'where':{'id':_0x38b50a[_0x4029('0x44')]['id']}})[_0x4029('0x27')](handleEntityNotFound(_0x3aa5fa,null))['then'](function(_0xa63c97){if(_0xa63c97){return _0xa63c97[_0x4029('0x53')](_0x38b50a[_0x4029('0x48')][_0x4029('0x55')],_[_0x4029('0x56')](_0x38b50a[_0x4029('0x48')],[_0x4029('0x55'),'id'])||{});}})[_0x4029('0x27')](respondWithResult(_0x3aa5fa,null))[_0x4029('0x42')](handleError(_0x3aa5fa,null));};exports[_0x4029('0x57')]=function(_0xa097c8,_0x13fc07,_0x2236b9){var _0x42237c={};var _0x223ad7={};var _0x2fedd1;var _0x468c4d;return db[_0x4029('0x2d')][_0x4029('0x58')]({'where':{'id':_0xa097c8[_0x4029('0x44')]['id']}})[_0x4029('0x27')](handleEntityNotFound(_0x13fc07,null))[_0x4029('0x27')](function(_0x18dcc8){if(_0x18dcc8){_0x2fedd1=_0x18dcc8;_0x223ad7[_0x4029('0x2f')]=_[_0x4029('0x30')](db[_0x4029('0x54')][_0x4029('0x45')]);_0x223ad7[_0x4029('0x31')]=_[_0x4029('0x30')](_0xa097c8[_0x4029('0x31')]);_0x223ad7[_0x4029('0x3b')]=_['intersection'](_0x223ad7['model'],_0x223ad7[_0x4029('0x31')]);_0x42237c[_0x4029('0x33')]=_['intersection'](_0x223ad7['model'],qs[_0x4029('0x34')](_0xa097c8[_0x4029('0x31')][_0x4029('0x34')]));_0x42237c[_0x4029('0x33')]=_0x42237c[_0x4029('0x33')][_0x4029('0x35')]?_0x42237c[_0x4029('0x33')]:_0x223ad7[_0x4029('0x2f')];_0x42237c[_0x4029('0x38')]=qs[_0x4029('0x39')](_0xa097c8[_0x4029('0x31')][_0x4029('0x39')]);_0x42237c[_0x4029('0x3a')]=qs[_0x4029('0x3b')](_[_0x4029('0x3c')](_0xa097c8[_0x4029('0x31')],_0x223ad7['filters']));if(_0xa097c8[_0x4029('0x31')][_0x4029('0x3d')]){_0x42237c[_0x4029('0x3a')]=_[_0x4029('0x59')](_0x42237c[_0x4029('0x3a')],{'$or':_[_0x4029('0x5a')](_0x42237c[_0x4029('0x33')],function(_0x4c83d1){var _0x28da96={};_0x28da96[_0x4c83d1]={'$like':'%'+_0xa097c8['query'][_0x4029('0x3d')]+'%'};return _0x28da96;})});}_0x42237c=_[_0x4029('0x59')]({},_0x42237c,_0xa097c8[_0x4029('0x3e')]);return _0x2fedd1[_0x4029('0x57')](_0x42237c);}})[_0x4029('0x27')](function(_0x1ea44a){if(_0x1ea44a){_0x468c4d=_0x1ea44a[_0x4029('0x35')];if(!_0xa097c8['query']['hasOwnProperty']('nolimit')){_0x42237c[_0x4029('0x21')]=qs[_0x4029('0x21')](_0xa097c8[_0x4029('0x31')][_0x4029('0x21')]);_0x42237c[_0x4029('0x20')]=qs['offset'](_0xa097c8['query']['offset']);}return _0x2fedd1[_0x4029('0x57')](_0x42237c);}})['then'](function(_0x326050){if(_0x326050){return _0x326050?{'count':_0x468c4d,'rows':_0x326050}:null;}})[_0x4029('0x27')](respondWithResult(_0x13fc07,null))[_0x4029('0x42')](handleError(_0x13fc07,null));}; \ No newline at end of file +var _0x4171=['json','apply','reject','save','then','get','Companies','UserProfileResource','destroy','name','send','index','CmCompany','describe','keys','query','intersection','model','attributes','fields','length','limit','order','where','filters','pick','filter','merge','map','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmContact','addContacts','ids','omit','getContacts','options','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range'];(function(_0x1ca91c,_0x131938){var _0x5e858f=function(_0x797f59){while(--_0x797f59){_0x1ca91c['push'](_0x1ca91c['shift']());}};_0x5e858f(++_0x131938);}(_0x4171,0x1d2));var _0x1417=function(_0x5bed4f,_0x587438){_0x5bed4f=_0x5bed4f-0x0;var _0x643e99=_0x4171[_0x5bed4f];return _0x643e99;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1417('0x0'));var rimraf=require(_0x1417('0x1'));var zipdir=require(_0x1417('0x2'));var jsonpatch=require(_0x1417('0x3'));var rp=require(_0x1417('0x4'));var moment=require(_0x1417('0x5'));var BPromise=require(_0x1417('0x6'));var Mustache=require(_0x1417('0x7'));var util=require(_0x1417('0x8'));var path=require(_0x1417('0x9'));var sox=require('sox');var csv=require(_0x1417('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1417('0xb'));var squel=require(_0x1417('0xc'));var crypto=require(_0x1417('0xd'));var jsforce=require(_0x1417('0xe'));var deskjs=require(_0x1417('0xf'));var toCsv=require(_0x1417('0xa'));var querystring=require(_0x1417('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1417('0x11'));var qs=require(_0x1417('0x12'));var as=require(_0x1417('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1417('0x14'))(_0x1417('0x15'));var utils=require('../../config/utils');var config=require(_0x1417('0x16'));var licenseUtil=require(_0x1417('0x17'));var db=require(_0x1417('0x18'))['db'];function respondWithStatusCode(_0x4129a6,_0x3febaa){_0x3febaa=_0x3febaa||0xcc;return function(_0x3ccf9d){if(_0x3ccf9d){return _0x4129a6[_0x1417('0x19')](_0x3febaa);}return _0x4129a6['status'](_0x3febaa)[_0x1417('0x1a')]();};}function respondWithResult(_0x53ed49,_0x5c2f2b){_0x5c2f2b=_0x5c2f2b||0xc8;return function(_0x393f8a){if(_0x393f8a){return _0x53ed49[_0x1417('0x1b')](_0x5c2f2b)['json'](_0x393f8a);}};}function respondWithFilteredResult(_0x5e9314,_0x38fdeb){return function(_0x17014d){if(_0x17014d){var _0xd14732=_0x17014d[_0x1417('0x1c')],_0x517962=_0x38fdeb[_0x1417('0x1d')],_0x23662b=_0x38fdeb[_0x1417('0x1d')]+_0x38fdeb['limit'],_0x5f16e9;if(_0x23662b>=_0xd14732){_0x23662b=_0xd14732;_0x5f16e9=0xc8;}else{_0x5f16e9=0xce;}_0x5e9314[_0x1417('0x1b')](_0x5f16e9);return _0x5e9314[_0x1417('0x1e')](_0x1417('0x1f'),_0x517962+'-'+_0x23662b+'/'+_0xd14732)[_0x1417('0x20')](_0x17014d);}return null;};}function patchUpdates(_0x3673ee){return function(_0x2854f9){try{jsonpatch[_0x1417('0x21')](_0x2854f9,_0x3673ee,!![]);}catch(_0x114329){return BPromise[_0x1417('0x22')](_0x114329);}return _0x2854f9[_0x1417('0x23')]();};}function saveUpdates(_0x31c1c5,_0x2128cd){return function(_0x444966){if(_0x444966){return _0x444966['update'](_0x31c1c5)[_0x1417('0x24')](function(_0xcbaf08){return _0xcbaf08;});}return null;};}function removeEntity(_0x5ac1e1,_0x295714){return function(_0x1d0f13){if(_0x1d0f13){return _0x1d0f13['destroy']()[_0x1417('0x24')](function(){var _0x3cef95=_0x1d0f13[_0x1417('0x25')]({'plain':!![]});var _0x13b494=_0x1417('0x26');return db[_0x1417('0x27')][_0x1417('0x28')]({'where':{'type':_0x13b494,'resourceId':_0x3cef95['id']}})['then'](function(){return _0x1d0f13;});})[_0x1417('0x24')](function(){_0x5ac1e1[_0x1417('0x1b')](0xcc)[_0x1417('0x1a')]();});}};}function handleEntityNotFound(_0x105874,_0x25a427){return function(_0x4650d6){if(!_0x4650d6){_0x105874[_0x1417('0x19')](0x194);}return _0x4650d6;};}function handleError(_0x5d5458,_0x330816){_0x330816=_0x330816||0x1f4;return function(_0x27afbc){logger['error'](_0x27afbc['stack']);if(_0x27afbc[_0x1417('0x29')]){delete _0x27afbc[_0x1417('0x29')];}_0x5d5458['status'](_0x330816)[_0x1417('0x2a')](_0x27afbc);};}exports[_0x1417('0x2b')]=function(_0x8e7070,_0x54ded8){var _0x2da34a={},_0x188a25={},_0x346994={'count':0x0,'rows':[]};return db[_0x1417('0x2c')][_0x1417('0x2d')]()['then'](function(_0x39eb30){_0x188a25['model']=_[_0x1417('0x2e')](_0x39eb30);_0x188a25[_0x1417('0x2f')]=_['keys'](_0x8e7070[_0x1417('0x2f')]);_0x188a25['filters']=_[_0x1417('0x30')](_0x188a25[_0x1417('0x31')],_0x188a25['query']);_0x2da34a[_0x1417('0x32')]=_[_0x1417('0x30')](_0x188a25[_0x1417('0x31')],qs[_0x1417('0x33')](_0x8e7070[_0x1417('0x2f')][_0x1417('0x33')]));_0x2da34a[_0x1417('0x32')]=_0x2da34a[_0x1417('0x32')][_0x1417('0x34')]?_0x2da34a[_0x1417('0x32')]:_0x188a25['model'];if(!_0x8e7070[_0x1417('0x2f')]['hasOwnProperty']('nolimit')){_0x2da34a[_0x1417('0x35')]=qs[_0x1417('0x35')](_0x8e7070['query'][_0x1417('0x35')]);_0x2da34a[_0x1417('0x1d')]=qs[_0x1417('0x1d')](_0x8e7070[_0x1417('0x2f')][_0x1417('0x1d')]);}_0x2da34a[_0x1417('0x36')]=qs['sort'](_0x8e7070[_0x1417('0x2f')]['sort']);_0x2da34a[_0x1417('0x37')]=qs[_0x1417('0x38')](_[_0x1417('0x39')](_0x8e7070['query'],_0x188a25['filters']),_0x39eb30);if(_0x8e7070[_0x1417('0x2f')][_0x1417('0x3a')]){_0x2da34a[_0x1417('0x37')]=_[_0x1417('0x3b')](_0x2da34a['where'],{'$or':_[_0x1417('0x3c')](_0x2da34a[_0x1417('0x32')],function(_0x23bd1b){var _0x554c57={};_0x554c57[_0x23bd1b]={'$like':'%'+_0x8e7070['query']['filter']+'%'};return _0x554c57;})});}_0x2da34a=_[_0x1417('0x3b')]({},_0x2da34a,_0x8e7070['options']);var _0x1ad7d3={'where':_0x2da34a['where']};return db['CmCompany'][_0x1417('0x1c')](_0x1ad7d3)[_0x1417('0x24')](function(_0x55a111){_0x346994[_0x1417('0x1c')]=_0x55a111;if(_0x8e7070[_0x1417('0x2f')][_0x1417('0x3d')]){_0x2da34a[_0x1417('0x3e')]=[{'all':!![]}];}return db[_0x1417('0x2c')][_0x1417('0x3f')](_0x2da34a);})[_0x1417('0x24')](function(_0x344d4a){_0x346994[_0x1417('0x40')]=_0x344d4a;return _0x346994;})[_0x1417('0x24')](respondWithFilteredResult(_0x54ded8,_0x2da34a))[_0x1417('0x41')](handleError(_0x54ded8,null));})[_0x1417('0x41')](handleError(_0x54ded8,null));};exports['show']=function(_0x1aa14e,_0x437998){var _0x499bea={'raw':![],'where':{'id':_0x1aa14e[_0x1417('0x42')]['id']}},_0x406f13={};_0x406f13[_0x1417('0x31')]=_[_0x1417('0x2e')](db[_0x1417('0x2c')][_0x1417('0x43')]);_0x406f13['query']=_[_0x1417('0x2e')](_0x1aa14e[_0x1417('0x2f')]);_0x406f13[_0x1417('0x38')]=_[_0x1417('0x30')](_0x406f13[_0x1417('0x31')],_0x406f13['query']);_0x499bea[_0x1417('0x32')]=_['intersection'](_0x406f13[_0x1417('0x31')],qs[_0x1417('0x33')](_0x1aa14e['query'][_0x1417('0x33')]));_0x499bea[_0x1417('0x32')]=_0x499bea['attributes'][_0x1417('0x34')]?_0x499bea[_0x1417('0x32')]:_0x406f13[_0x1417('0x31')];if(_0x1aa14e[_0x1417('0x2f')]['includeAll']){_0x499bea[_0x1417('0x3e')]=[{'all':!![]}];}_0x499bea=_['merge']({},_0x499bea,_0x1aa14e['options']);return db[_0x1417('0x2c')][_0x1417('0x44')](_0x499bea)[_0x1417('0x24')](handleEntityNotFound(_0x437998,null))[_0x1417('0x24')](respondWithResult(_0x437998,null))[_0x1417('0x41')](handleError(_0x437998,null));};exports['create']=function(_0x35e46e,_0x474429){return db[_0x1417('0x2c')][_0x1417('0x45')](_0x35e46e[_0x1417('0x46')],{})[_0x1417('0x24')](function(_0x5f59ad){var _0x442250=_0x35e46e['user'][_0x1417('0x25')]({'plain':!![]});if(!_0x442250)throw new Error(_0x1417('0x47'));if(_0x442250[_0x1417('0x48')]==='user'){var _0x23dc5b=_0x5f59ad['get']({'plain':!![]});var _0xb24ba1=_0x1417('0x26');return db['UserProfileSection'][_0x1417('0x44')]({'where':{'name':_0xb24ba1,'userProfileId':_0x442250['userProfileId']},'raw':!![]})['then'](function(_0x102b26){if(_0x102b26&&_0x102b26['autoAssociation']===0x0){return db['UserProfileResource'][_0x1417('0x45')]({'name':_0x23dc5b['name'],'resourceId':_0x23dc5b['id'],'type':_0x102b26[_0x1417('0x29')],'sectionId':_0x102b26['id']},{})[_0x1417('0x24')](function(){return _0x5f59ad;});}else{return _0x5f59ad;}})[_0x1417('0x41')](function(_0x117b19){logger[_0x1417('0x49')](_0x1417('0x4a'),_0x117b19);throw _0x117b19;});}return _0x5f59ad;})[_0x1417('0x24')](respondWithResult(_0x474429,0xc9))['catch'](handleError(_0x474429,null));};exports[_0x1417('0x4b')]=function(_0x548caf,_0x53f932){if(_0x548caf[_0x1417('0x46')]['id']){delete _0x548caf[_0x1417('0x46')]['id'];}return db[_0x1417('0x2c')][_0x1417('0x44')]({'where':{'id':_0x548caf[_0x1417('0x42')]['id']}})[_0x1417('0x24')](handleEntityNotFound(_0x53f932,null))[_0x1417('0x24')](saveUpdates(_0x548caf[_0x1417('0x46')],null))['then'](respondWithResult(_0x53f932,null))[_0x1417('0x41')](handleError(_0x53f932,null));};exports[_0x1417('0x28')]=function(_0x5b8a95,_0x3386dd){return db[_0x1417('0x2c')][_0x1417('0x44')]({'where':{'id':_0x5b8a95[_0x1417('0x42')]['id']}})[_0x1417('0x24')](handleEntityNotFound(_0x3386dd,null))[_0x1417('0x24')](removeEntity(_0x3386dd,null))[_0x1417('0x41')](handleError(_0x3386dd,null));};exports[_0x1417('0x2d')]=function(_0x364389,_0x13e640){return db[_0x1417('0x2c')][_0x1417('0x2d')]()[_0x1417('0x24')](respondWithResult(_0x13e640,null))[_0x1417('0x41')](handleError(_0x13e640,null));};exports['addContacts']=function(_0x23e6aa,_0x4d7573,_0x3d5c84){return db[_0x1417('0x4c')][_0x1417('0x44')]({'where':{'id':_0x23e6aa[_0x1417('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d7573,null))[_0x1417('0x24')](function(_0xc59dda){if(_0xc59dda){return _0xc59dda[_0x1417('0x4d')](_0x23e6aa[_0x1417('0x46')][_0x1417('0x4e')],_[_0x1417('0x4f')](_0x23e6aa[_0x1417('0x46')],[_0x1417('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4d7573,null))[_0x1417('0x41')](handleError(_0x4d7573,null));};exports[_0x1417('0x50')]=function(_0x16fdcf,_0x20f6c1,_0x598f99){var _0x59aa91={};var _0x1342df={};var _0x1591ea;var _0x4d4bad;return db[_0x1417('0x2c')]['findOne']({'where':{'id':_0x16fdcf[_0x1417('0x42')]['id']}})['then'](handleEntityNotFound(_0x20f6c1,null))[_0x1417('0x24')](function(_0x1383f4){if(_0x1383f4){_0x1591ea=_0x1383f4;_0x1342df['model']=_[_0x1417('0x2e')](db[_0x1417('0x4c')][_0x1417('0x43')]);_0x1342df['query']=_[_0x1417('0x2e')](_0x16fdcf[_0x1417('0x2f')]);_0x1342df[_0x1417('0x38')]=_[_0x1417('0x30')](_0x1342df[_0x1417('0x31')],_0x1342df['query']);_0x59aa91[_0x1417('0x32')]=_[_0x1417('0x30')](_0x1342df[_0x1417('0x31')],qs[_0x1417('0x33')](_0x16fdcf['query'][_0x1417('0x33')]));_0x59aa91[_0x1417('0x32')]=_0x59aa91[_0x1417('0x32')][_0x1417('0x34')]?_0x59aa91['attributes']:_0x1342df[_0x1417('0x31')];_0x59aa91[_0x1417('0x36')]=qs['sort'](_0x16fdcf[_0x1417('0x2f')]['sort']);_0x59aa91['where']=qs['filters'](_[_0x1417('0x39')](_0x16fdcf[_0x1417('0x2f')],_0x1342df[_0x1417('0x38')]));if(_0x16fdcf[_0x1417('0x2f')][_0x1417('0x3a')]){_0x59aa91[_0x1417('0x37')]=_[_0x1417('0x3b')](_0x59aa91[_0x1417('0x37')],{'$or':_['map'](_0x59aa91[_0x1417('0x32')],function(_0x1b9211){var _0x212793={};_0x212793[_0x1b9211]={'$like':'%'+_0x16fdcf[_0x1417('0x2f')][_0x1417('0x3a')]+'%'};return _0x212793;})});}_0x59aa91=_[_0x1417('0x3b')]({},_0x59aa91,_0x16fdcf[_0x1417('0x51')]);return _0x1591ea[_0x1417('0x50')](_0x59aa91);}})['then'](function(_0x206a51){if(_0x206a51){_0x4d4bad=_0x206a51[_0x1417('0x34')];if(!_0x16fdcf[_0x1417('0x2f')]['hasOwnProperty'](_0x1417('0x52'))){_0x59aa91[_0x1417('0x35')]=qs[_0x1417('0x35')](_0x16fdcf[_0x1417('0x2f')][_0x1417('0x35')]);_0x59aa91[_0x1417('0x1d')]=qs[_0x1417('0x1d')](_0x16fdcf['query'][_0x1417('0x1d')]);}return _0x1591ea[_0x1417('0x50')](_0x59aa91);}})[_0x1417('0x24')](function(_0x34353a){if(_0x34353a){return _0x34353a?{'count':_0x4d4bad,'rows':_0x34353a}:null;}})[_0x1417('0x24')](respondWithResult(_0x20f6c1,null))[_0x1417('0x41')](handleError(_0x20f6c1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index cc18977..6374c6d 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 _0x00b3=['cm_companies','lodash','api','moment','path','rimraf','../../config/environment','exports','define','CmCompany'];(function(_0x2b4cd0,_0x457878){var _0x474616=function(_0x435315){while(--_0x435315){_0x2b4cd0['push'](_0x2b4cd0['shift']());}};_0x474616(++_0x457878);}(_0x00b3,0x97));var _0x300b=function(_0x43eb90,_0x3b1152){_0x43eb90=_0x43eb90-0x0;var _0x222c04=_0x00b3[_0x43eb90];return _0x222c04;};'use strict';var _=require(_0x300b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x300b('0x3'));var rimraf=require(_0x300b('0x4'));var config=require(_0x300b('0x5'));var attributes=require('./cmCompany.attributes');module[_0x300b('0x6')]=function(_0xbceeb8,_0x34a5cd){return _0xbceeb8[_0x300b('0x7')](_0x300b('0x8'),attributes,{'tableName':_0x300b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a4=['./cmCompany.attributes','exports','cm_companies','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x336e2d,_0x22f813){var _0x32c30d=function(_0x5557fc){while(--_0x5557fc){_0x336e2d['push'](_0x336e2d['shift']());}};_0x32c30d(++_0x22f813);}(_0x56a4,0x11b));var _0x456a=function(_0x5fd04,_0x5d6fff){_0x5fd04=_0x5fd04-0x0;var _0x48c27b=_0x56a4[_0x5fd04];return _0x48c27b;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('CmCompany',attributes,{'tableName':_0x456a('0x9'),'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 7f05b28..6d096f9 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 _0xe32a=['catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x33efcb,_0x2cf6de){var _0x32dc62=function(_0x5a80c7){while(--_0x5a80c7){_0x33efcb['push'](_0x33efcb['shift']());}};_0x32dc62(++_0x2cf6de);}(_0xe32a,0x191));var _0xae32=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xe32a[_0x263f4c];return _0x3a78d3;};'use strict';var _=require(_0xae32('0x0'));var util=require(_0xae32('0x1'));var moment=require('moment');var BPromise=require(_0xae32('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae32('0x3'))['db'];var utils=require(_0xae32('0x4'));var logger=require(_0xae32('0x5'))('rpc');var config=require(_0xae32('0x6'));var jayson=require(_0xae32('0x7'));var client=jayson['client'][_0xae32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x392bff,_0x4ce710,_0x34569d){return new BPromise(function(_0x13f273,_0x5b43d9){return client['request'](_0x392bff,_0x34569d)[_0xae32('0x9')](function(_0x1db3da){logger[_0xae32('0xa')](_0xae32('0xb'),_0x4ce710,'request\x20sent');logger[_0xae32('0xc')](_0xae32('0xd'),_0x4ce710,'request\x20sent',JSON[_0xae32('0xe')](_0x1db3da));if(_0x1db3da[_0xae32('0xf')]){if(_0x1db3da[_0xae32('0xf')]['code']===0x1f4){logger[_0xae32('0xf')](_0xae32('0xb'),_0x4ce710,_0x1db3da[_0xae32('0xf')][_0xae32('0x10')]);return _0x5b43d9(_0x1db3da[_0xae32('0xf')]['message']);}logger[_0xae32('0xf')](_0xae32('0xb'),_0x4ce710,_0x1db3da[_0xae32('0xf')]['message']);return _0x13f273(_0x1db3da[_0xae32('0xf')]['message']);}else{logger['info'](_0xae32('0xb'),_0x4ce710,_0xae32('0x11'));_0x13f273(_0x1db3da[_0xae32('0x12')][_0xae32('0x10')]);}})[_0xae32('0x13')](function(_0x4da773){logger[_0xae32('0xf')](_0xae32('0xb'),_0x4ce710,_0x4da773);_0x5b43d9(_0x4da773);});});} \ No newline at end of file +var _0xcc35=['client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','CmCompany,\x20%s,\x20%s','result','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xcc35,0xad));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cc3('0x0'));var db=require(_0x5cc3('0x1'))['db'];var utils=require(_0x5cc3('0x2'));var logger=require(_0x5cc3('0x3'))(_0x5cc3('0x4'));var config=require(_0x5cc3('0x5'));var jayson=require(_0x5cc3('0x6'));var client=jayson[_0x5cc3('0x7')][_0x5cc3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5df516,_0x57773a,_0xa4f79d){return new BPromise(function(_0x95b6e5,_0x1277ad){return client[_0x5cc3('0x9')](_0x5df516,_0xa4f79d)[_0x5cc3('0xa')](function(_0x19c84e){logger[_0x5cc3('0xb')]('CmCompany,\x20%s,\x20%s',_0x57773a,_0x5cc3('0xc'));logger[_0x5cc3('0xd')](_0x5cc3('0xe'),_0x57773a,_0x5cc3('0xc'),JSON[_0x5cc3('0xf')](_0x19c84e));if(_0x19c84e[_0x5cc3('0x10')]){if(_0x19c84e[_0x5cc3('0x10')]['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x57773a,_0x19c84e['error'][_0x5cc3('0x11')]);return _0x1277ad(_0x19c84e[_0x5cc3('0x10')][_0x5cc3('0x11')]);}logger[_0x5cc3('0x10')](_0x5cc3('0x12'),_0x57773a,_0x19c84e[_0x5cc3('0x10')]['message']);return _0x95b6e5(_0x19c84e['error']['message']);}else{logger[_0x5cc3('0xb')](_0x5cc3('0x12'),_0x57773a,_0x5cc3('0xc'));_0x95b6e5(_0x19c84e[_0x5cc3('0x13')][_0x5cc3('0x11')]);}})['catch'](function(_0x41661e){logger[_0x5cc3('0x10')](_0x5cc3('0x12'),_0x57773a,_0x41661e);_0x1277ad(_0x41661e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 820af14..bfe702b 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 _0xe3da=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','/:id/contacts','getContacts','post','addContacts'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['describe']);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xb')](),controller['create']);router[_0xae3d('0x11')]('/:id/contacts',auth[_0xae3d('0xb')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router[_0xae3d('0x15')](_0xae3d('0xe'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x16')]);module[_0xae3d('0x17')]=router; \ No newline at end of file +var _0x3d04=['/:id/contacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/:id','show','getContacts','create','post'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var auth=require(_0x43d0('0x6'));var interaction=require(_0x43d0('0x7'));var config=require('../../config/environment');var controller=require(_0x43d0('0x8'));router[_0x43d0('0x9')]('/',auth[_0x43d0('0xa')](),controller[_0x43d0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x43d0('0x9')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0xd')]);router[_0x43d0('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43d0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router[_0x43d0('0x10')](_0x43d0('0x11'),auth[_0x43d0('0xa')](),controller['addContacts']);router[_0x43d0('0x12')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x13')]);router[_0x43d0('0x14')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x15')]);module[_0x43d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 063f7c9..b7664eb 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 _0xbd88=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x19ee72,_0x19cc4a){var _0x520bd5=function(_0x22b589){while(--_0x22b589){_0x19ee72['push'](_0x19ee72['shift']());}};_0x520bd5(++_0x19cc4a);}(_0xbd88,0x178));var _0x8bd8=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xbd88[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x8bd8('0x0'));var Sequelize=require('sequelize');module[_0x8bd8('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8bd8('0x2')]},'street':{'type':Sequelize[_0x8bd8('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8bd8('0x2')]},'dateOfBirth':{'type':Sequelize[_0x8bd8('0x2')]},'description':{'type':Sequelize[_0x8bd8('0x3')]},'phone':{'type':Sequelize[_0x8bd8('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8bd8('0x2')]},'email':{'type':Sequelize[_0x8bd8('0x2')]},'url':{'type':Sequelize[_0x8bd8('0x2')]},'facebook':{'type':Sequelize[_0x8bd8('0x2')]},'fb_data':{'type':Sequelize[_0x8bd8('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x8bd8('0x2')]},'teams':{'type':Sequelize[_0x8bd8('0x2')]},'viber':{'type':Sequelize[_0x8bd8('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x8bd8('0x2')]},'telegram':{'type':Sequelize[_0x8bd8('0x2')]},'UserId':{'type':Sequelize[_0x8bd8('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8bd8('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8bd8('0x6')],'defaultValue':Sequelize[_0x8bd8('0x7')]}}; \ No newline at end of file +var _0x609b=['TEXT','INTEGER','UNSIGNED','NOW','sequelize','STRING'];(function(_0x349c89,_0x138bed){var _0x9ea201=function(_0x47d735){while(--_0x47d735){_0x349c89['push'](_0x349c89['shift']());}};_0x9ea201(++_0x138bed);}(_0x609b,0x160));var _0xb609=function(_0x58cac3,_0x57691f){_0x58cac3=_0x58cac3-0x0;var _0x3fd89c=_0x609b[_0x58cac3];return _0x3fd89c;};'use strict';var _=require('lodash');var Sequelize=require(_0xb609('0x0'));module['exports']={'firstName':{'type':Sequelize[_0xb609('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb609('0x1')]},'street':{'type':Sequelize[_0xb609('0x1')]},'postalCode':{'type':Sequelize[_0xb609('0x1')]},'city':{'type':Sequelize[_0xb609('0x1')]},'country':{'type':Sequelize[_0xb609('0x1')]},'dateOfBirth':{'type':Sequelize[_0xb609('0x1')]},'description':{'type':Sequelize[_0xb609('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xb609('0x1')]},'fax':{'type':Sequelize[_0xb609('0x1')]},'email':{'type':Sequelize[_0xb609('0x1')]},'url':{'type':Sequelize[_0xb609('0x1')]},'facebook':{'type':Sequelize[_0xb609('0x1')]},'fb_data':{'type':Sequelize[_0xb609('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xb609('0x1')]},'teams':{'type':Sequelize[_0xb609('0x1')]},'viber':{'type':Sequelize[_0xb609('0x1')]},'line':{'type':Sequelize[_0xb609('0x1')]},'wechat':{'type':Sequelize[_0xb609('0x1')]},'telegram':{'type':Sequelize[_0xb609('0x1')]},'UserId':{'type':Sequelize[_0xb609('0x3')]},'priority':{'type':Sequelize[_0xb609('0x3')](0x2)[_0xb609('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xb609('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4afd7ec..b97fc6c 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 _0x9957=['c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','params','describe','tags','columnName','displayName','findAll','alias','values','body','get','join','info','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','create','bulkCreate','duplicates','$or','findOrCreate','show','$and','omit','format','cf_%d','table','cm_contacts','id\x20=\x20?','toParam','text','phone','rawAttributes','options','getTags','setTags','ids','getHoppers','ContactId','include','rows','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','binding','child_process','fork','../../components/import/cm/csv2','message','exit','error\x20child\x20process','getJourney','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','callerid','endtime','duration','note','userThirdDisposition','fullname','createdAt','VoiceCallReport','findAndCountAll','startCase','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Account','Owner','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','openchannel','externalUrl','threadId','Interaction','all','flatten','sortBy','reverse','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','field','color','select','from','left_join','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','fieldType','datetime','DATE','buildExpression','start','filter','isNil','ListId','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','clone','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','CmContact','c.lastName','c.mobile','c.fax','c.email','c.createdAt'];(function(_0x17371c,_0x1a1e9c){var _0x422265=function(_0x7b77ad){while(--_0x7b77ad){_0x17371c['push'](_0x17371c['shift']());}};_0x422265(++_0x1a1e9c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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'];config[_0x7995('0x1b')]=_[_0x7995('0x1c')](config[_0x7995('0x1b')],{'host':_0x7995('0x1d'),'port':0x18eb});var socket=require(_0x7995('0x1e'))(new Redis(config['redis']));require('./cmContact.socket')[_0x7995('0x1f')](socket);function respondWithStatusCode(_0x2233dd,_0x24b5bb){_0x24b5bb=_0x24b5bb||0xcc;return function(_0x321ae8){if(_0x321ae8){return _0x2233dd[_0x7995('0x20')](_0x24b5bb);}return _0x2233dd[_0x7995('0x21')](_0x24b5bb)[_0x7995('0x22')]();};}function respondWithResult(_0x41cbf0,_0x5377e5){_0x5377e5=_0x5377e5||0xc8;return function(_0x2eeacc){if(_0x2eeacc){return _0x41cbf0['status'](_0x5377e5)[_0x7995('0x23')](_0x2eeacc);}};}function respondWithFilteredResult(_0x37f297,_0x43d4b8){return function(_0x291317){if(_0x291317){var _0x1e1415=_0x291317[_0x7995('0x24')],_0x37a7d4=_0x43d4b8['offset'],_0x4faa60=_0x43d4b8['offset']+_0x43d4b8[_0x7995('0x25')],_0x54c9ae;if(_0x4faa60>=_0x1e1415){_0x4faa60=_0x1e1415;_0x54c9ae=0xc8;}else{_0x54c9ae=0xce;}_0x37f297[_0x7995('0x21')](_0x54c9ae);return _0x37f297['set'](_0x7995('0x26'),_0x37a7d4+'-'+_0x4faa60+'/'+_0x1e1415)['json'](_0x291317);}return null;};}function patchUpdates(_0x4b1a8e){return function(_0x3e4c54){try{jsonpatch[_0x7995('0x27')](_0x3e4c54,_0x4b1a8e,!![]);}catch(_0x350fd9){return BPromise[_0x7995('0x28')](_0x350fd9);}return _0x3e4c54[_0x7995('0x29')]();};}function saveUpdates(_0x1c278a,_0x5d40ae){return function(_0x32a09a){if(_0x32a09a){return _0x32a09a[_0x7995('0x2a')](_0x1c278a)[_0x7995('0x2b')](function(_0x285437){return _0x285437;});}return null;};}function removeEntity(_0x563799,_0x13bc35){return function(_0x475351){if(_0x475351){return _0x475351[_0x7995('0x2c')]()['then'](function(){_0x563799[_0x7995('0x21')](0xcc)[_0x7995('0x22')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x20')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2d')](_0x5911c3[_0x7995('0x2e')]);if(_0x5911c3[_0x7995('0x2f')]){delete _0x5911c3[_0x7995('0x2f')];}_0x56691a[_0x7995('0x21')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x30')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x7995('0x2b')](function(_0xe6b0b3){var _0x327a81=[];for(var _0x2b874d=0x0;_0x2b874d0x1){_0x40fc68['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7995('0x71')](_0x332a85),null);}else{if(qs[_0x7995('0x72')](_0x332a85)){_0x40fc68['or'](_0x7995('0x73'),_0x332a85+'%');_0x40fc68['or'](_0x7995('0x74'),_0x332a85+'%');_0x40fc68['or'](_0x7995('0x75'),_0x332a85+'%');_0x40fc68['or'](_0x7995('0x76'),_0x332a85+'%');}else if(qs[_0x7995('0x77')](_0x332a85)){_0x40fc68['or'](_0x7995('0x78'),_0x332a85+'%');}else{_0x40fc68['or'](_0x7995('0x79'),'%'+_0x332a85+'%');_0x40fc68['or']('c.lastName\x20LIKE\x20?','%'+_0x332a85+'%');_0x40fc68['or'](_0x7995('0x78'),'%'+_0x332a85+'%');}}}}_0x23da6b[_0x7995('0x44')](_0x40fc68);_0x23da6b[_0x7995('0x7a')](_0x7995('0x7b'));var _0x59c5aa={'type':db['Sequelize'][_0x7995('0x7c')][_0x7995('0x7d')],'raw':!![]};var _0x47d5d7=_0x23da6b[_0x7995('0x7e')]()[_0x7995('0x47')](_0x7995('0x7b'));if(_0x3250e0[_0x7995('0x42')]){_0x3250e0[_0x7995('0x42')]['forEach'](function(_0x457d09){_0x23da6b['order']('c.'+_0x457d09[0x0],_0x457d09[0x1]===_0x7995('0x7f')?![]:!![]);});}if(!_[_0x7995('0x80')](_0x6c7bec)){_0x23da6b[_0x7995('0x81')](_0x4e09b7);_0x47d5d7[_0x7995('0x44')](_0x7995('0x82'),_0x6c7bec);}BPromise[_0x7995('0x83')]()[_0x7995('0x2b')](function(){if(!_0x1c37c6)return;if(_0x514445[_0x7995('0x84')][_0x7995('0x85')]!==_0x7995('0x86'))return;if(!_[_0x7995('0x87')](_0x1c37c6[_0x7995('0x54')],['field',_0x7995('0x5c')])){return _0x514445[_0x7995('0x84')][_0x7995('0x88')]({'attributes':['id'],'raw':!![]})[_0x7995('0x2b')](function(_0x2c6548){if(_['isEmpty'](_0x2c6548)){_0x47d5d7['where'](_0x7995('0x89'));_0x23da6b[_0x7995('0x44')](_0x7995('0x89'));}else{_0x47d5d7[_0x7995('0x44')]('c.ListId\x20IN\x20?',_[_0x7995('0x58')](_0x2c6548,'id'));_0x23da6b['where']('c.ListId\x20IN\x20?',_[_0x7995('0x58')](_0x2c6548,'id'));}});}})[_0x7995('0x2b')](function(){if(_0x514445[_0x7995('0x84')][_0x7995('0x85')]===_0x7995('0x86')&&!_0x1c37c6&&!_0x514445[_0x7995('0x3b')][_0x7995('0x68')])return[];return db[_0x7995('0x8a')][_0x7995('0x3b')](_0x47d5d7[_0x7995('0x8b')](),_0x59c5aa);})['then'](function(_0x2dc1f7){_0x574574[_0x7995('0x24')]=_0x2dc1f7[_0x7995('0x32')];if(_0x574574['count']===0x0)return[];return db[_0x7995('0x8a')][_0x7995('0x3b')](_0x53cda2[_0x7995('0x8b')](),_0x59c5aa)[_0x7995('0x2b')](function(_0x3b0d30){_0x7b4e67=_[_0x7995('0x8c')](_0x3b0d30,'id');_0x59c5aa=_[_0x7995('0x8d')](_0x59c5aa,{'model':db[_0x7995('0x8e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x514445[_0x7995('0x3b')][_0x7995('0x3d')]){_0x3250e0[_0x7995('0x3e')]['forEach'](function(_0x5e8b4c){_0x23da6b[_0x7995('0x47')]('c.'+_0x5e8b4c);});}else{_0x23da6b[_0x7995('0x47')](_0x7995('0x7b'));_0x23da6b[_0x7995('0x47')]('c.firstName');_0x23da6b[_0x7995('0x47')](_0x7995('0x8f'));_0x23da6b['field']('c.phone');_0x23da6b[_0x7995('0x47')](_0x7995('0x90'));_0x23da6b['field'](_0x7995('0x91'));_0x23da6b['field'](_0x7995('0x92'));_0x23da6b[_0x7995('0x47')]('c.ListId');_0x23da6b['field'](_0x7995('0x93'));_0x23da6b['field'](_0x7995('0x94'));_0x23da6b[_0x7995('0x47')](_0x7995('0x95'));_0x23da6b[_0x7995('0x47')](_0x7995('0x96'),_0x7995('0x97'));}if(_0x3250e0[_0x7995('0x25')])_0x23da6b[_0x7995('0x25')](_0x3250e0[_0x7995('0x25')]);if(_0x3250e0[_0x7995('0x41')])_0x23da6b[_0x7995('0x41')](_0x3250e0[_0x7995('0x41')]);return db[_0x7995('0x8a')][_0x7995('0x3b')](_0x23da6b[_0x7995('0x8b')](),_0x59c5aa);});})[_0x7995('0x2b')](function(_0x6ad274){_0x6ad274[_0x7995('0x59')](function(_0x2ff7ba){if(_0x2ff7ba[_0x7995('0x97')]){_0x2ff7ba[_0x7995('0x98')]=[];_0x2ff7ba[_0x7995('0x97')][_0x7995('0x57')](',')[_0x7995('0x59')](function(_0x260ef1){_0x2ff7ba[_0x7995('0x98')][_0x7995('0x34')](_0x7b4e67[_0x260ef1]);});}delete _0x2ff7ba[_0x7995('0x97')];});_0x574574['rows']=_0x6ad274;return _0x574574;})[_0x7995('0x2b')](respondWithFilteredResult(_0x456a28,_0x3250e0));})[_0x7995('0x99')](handleError(_0x456a28,null));};exports['destroy']=function(_0x4c85cb,_0x15e8d1){return db[_0x7995('0x8e')][_0x7995('0x55')]({'where':{'id':_0x4c85cb[_0x7995('0x9a')]['id']}})[_0x7995('0x2b')](handleEntityNotFound(_0x15e8d1,null))[_0x7995('0x2b')](removeEntity(_0x15e8d1,null))['catch'](handleError(_0x15e8d1,null));};exports[_0x7995('0x9b')]=function(_0xb68962,_0x3fea6a){return db[_0x7995('0x8e')][_0x7995('0x9b')]()[_0x7995('0x2b')](function(_0x151d99){delete _0x151d99[_0x7995('0x9c')];for(var _0x560095=0x0;_0x560095=_0x34e41a){_0x237947=_0x34e41a;_0x254677=0xc8;}else{_0x254677=0xce;}_0x50b3f6[_0x834e('0x24')](_0x254677);return _0x50b3f6[_0x834e('0x29')]('Content-Range',_0xb993a1+'-'+_0x237947+'/'+_0x34e41a)[_0x834e('0x25')](_0x211e9a);}return null;};}function patchUpdates(_0x62f8f1){return function(_0x5a05c0){try{jsonpatch[_0x834e('0x2a')](_0x5a05c0,_0x62f8f1,!![]);}catch(_0x28d687){return BPromise[_0x834e('0x2b')](_0x28d687);}return _0x5a05c0['save']();};}function saveUpdates(_0x4e3f48,_0x231619){return function(_0x34563b){if(_0x34563b){return _0x34563b['update'](_0x4e3f48)[_0x834e('0x2c')](function(_0x1dc1e0){return _0x1dc1e0;});}return null;};}function removeEntity(_0x58f4fd,_0x3bc4f7){return function(_0x2e1983){if(_0x2e1983){return _0x2e1983[_0x834e('0x2d')]()['then'](function(){_0x58f4fd[_0x834e('0x24')](0xcc)[_0x834e('0x23')]();});}};}function handleEntityNotFound(_0x5e1cc5,_0x5bef62){return function(_0x1e713a){if(!_0x1e713a){_0x5e1cc5['sendStatus'](0x194);}return _0x1e713a;};}function handleError(_0x2826ec,_0x3f1b0b){_0x3f1b0b=_0x3f1b0b||0x1f4;return function(_0x3db026){logger[_0x834e('0x2e')](_0x3db026[_0x834e('0x2f')]);if(_0x3db026[_0x834e('0x30')]){delete _0x3db026['name'];}_0x2826ec['status'](_0x3f1b0b)['send'](_0x3db026);};}exports['index']=function(_0x2c7a8d,_0x567cea){var _0x106d6a={},_0x5dacc1={},_0xb5bc06={'count':0x0,'rows':[]};return db[_0x834e('0x31')][_0x834e('0x32')]()[_0x834e('0x2c')](function(_0x4551f5){var _0x390119=[];for(var _0x3d149d=0x0;_0x3d149d0x1){_0x51c731['or'](_0x834e('0x70'),qs[_0x834e('0x71')](_0x5a2924),null);}else{if(qs[_0x834e('0x72')](_0x5a2924)){_0x51c731['or'](_0x834e('0x73'),_0x5a2924+'%');_0x51c731['or'](_0x834e('0x74'),_0x5a2924+'%');_0x51c731['or'](_0x834e('0x75'),_0x5a2924+'%');_0x51c731['or'](_0x834e('0x76'),_0x5a2924+'%');}else if(qs[_0x834e('0x77')](_0x5a2924)){_0x51c731['or'](_0x834e('0x78'),_0x5a2924+'%');}else{_0x51c731['or'](_0x834e('0x79'),'%'+_0x5a2924+'%');_0x51c731['or'](_0x834e('0x7a'),'%'+_0x5a2924+'%');_0x51c731['or'](_0x834e('0x78'),'%'+_0x5a2924+'%');}}}}_0x16969b[_0x834e('0x4f')](_0x51c731);_0x16969b[_0x834e('0x7b')](_0x834e('0x7c'));var _0x14ed83={'type':db[_0x834e('0x7d')][_0x834e('0x7e')][_0x834e('0x7f')],'raw':!![]};var _0x2cb233=_0x16969b['clone']()[_0x834e('0x47')](_0x834e('0x7c'));if(_0x106d6a[_0x834e('0x44')]){_0x106d6a[_0x834e('0x44')]['forEach'](function(_0x30faa8){_0x16969b['order']('c.'+_0x30faa8[0x0],_0x30faa8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x834e('0x68')](_0x3f2321)){_0x16969b[_0x834e('0x80')](_0xa880cb);_0x2cb233[_0x834e('0x4f')](_0x834e('0x81'),_0x3f2321);}BPromise[_0x834e('0x82')]()[_0x834e('0x2c')](function(){if(!_0x252ea0)return;if(_0x2c7a8d[_0x834e('0x83')][_0x834e('0x84')]!=='agent')return;if(!_[_0x834e('0x85')](_0x252ea0['conditions'],[_0x834e('0x47'),_0x834e('0x5d')])){return _0x2c7a8d['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x834e('0x2c')](function(_0x82f2a7){if(_[_0x834e('0x68')](_0x82f2a7)){_0x2cb233[_0x834e('0x4f')](_0x834e('0x86'));_0x16969b['where'](_0x834e('0x86'));}else{_0x2cb233[_0x834e('0x4f')](_0x834e('0x69'),_[_0x834e('0x59')](_0x82f2a7,'id'));_0x16969b[_0x834e('0x4f')](_0x834e('0x69'),_[_0x834e('0x59')](_0x82f2a7,'id'));}});}})[_0x834e('0x2c')](function(){if(_0x2c7a8d[_0x834e('0x83')][_0x834e('0x84')]==='agent'&&!_0x252ea0&&!_0x2c7a8d[_0x834e('0x3c')][_0x834e('0x87')])return[];return db[_0x834e('0x88')][_0x834e('0x3c')](_0x2cb233['toString'](),_0x14ed83);})[_0x834e('0x2c')](function(_0x4ac5f2){_0xb5bc06['count']=_0x4ac5f2['length'];if(_0xb5bc06[_0x834e('0x26')]===0x0)return[];return db[_0x834e('0x88')]['query'](_0x16ac45[_0x834e('0x89')](),_0x14ed83)[_0x834e('0x2c')](function(_0x4d4477){_0x35380e=_[_0x834e('0x8a')](_0x4d4477,'id');_0x14ed83=_[_0x834e('0x8b')](_0x14ed83,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c7a8d['query'][_0x834e('0x40')]){_0x106d6a[_0x834e('0x41')][_0x834e('0x5a')](function(_0x44c909){_0x16969b[_0x834e('0x47')]('c.'+_0x44c909);});}else{_0x16969b['field'](_0x834e('0x7c'));_0x16969b['field'](_0x834e('0x8c'));_0x16969b[_0x834e('0x47')](_0x834e('0x8d'));_0x16969b['field'](_0x834e('0x8e'));_0x16969b[_0x834e('0x47')]('c.mobile');_0x16969b[_0x834e('0x47')](_0x834e('0x8f'));_0x16969b[_0x834e('0x47')]('c.email');_0x16969b[_0x834e('0x47')](_0x834e('0x90'));_0x16969b[_0x834e('0x47')](_0x834e('0x91'));_0x16969b[_0x834e('0x47')](_0x834e('0x92'));_0x16969b[_0x834e('0x47')](_0x834e('0x93'));_0x16969b[_0x834e('0x47')](_0x834e('0x94'),'TagIds');}if(_0x106d6a['limit'])_0x16969b['limit'](_0x106d6a[_0x834e('0x28')]);if(_0x106d6a[_0x834e('0x27')])_0x16969b[_0x834e('0x27')](_0x106d6a[_0x834e('0x27')]);return db[_0x834e('0x88')]['query'](_0x16969b['toString'](),_0x14ed83);});})[_0x834e('0x2c')](function(_0x1ad428){_0x1ad428[_0x834e('0x5a')](function(_0x18ddac){if(_0x18ddac[_0x834e('0x95')]){_0x18ddac['Tags']=[];_0x18ddac[_0x834e('0x95')][_0x834e('0x58')](',')[_0x834e('0x5a')](function(_0x4e1735){_0x18ddac[_0x834e('0x96')][_0x834e('0x36')](_0x35380e[_0x4e1735]);});}delete _0x18ddac[_0x834e('0x95')];});_0xb5bc06[_0x834e('0x97')]=_0x1ad428;return _0xb5bc06;})[_0x834e('0x2c')](respondWithFilteredResult(_0x567cea,_0x106d6a));})['catch'](handleError(_0x567cea,null));};exports['destroy']=function(_0x227797,_0x40a872){return db['CmContact'][_0x834e('0x98')]({'where':{'id':_0x227797['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x40a872,null))[_0x834e('0x2c')](removeEntity(_0x40a872,null))[_0x834e('0x99')](handleError(_0x40a872,null));};exports['describe']=function(_0x155c0f,_0x49e721){return db['CmContact']['describe']()[_0x834e('0x2c')](function(_0x4627ac){delete _0x4627ac[_0x834e('0x9a')];for(var _0x1d76c6=0x0;_0x1d76c6{}\s\\|]/g,'-');_0x101e8b(null,util[_0x4b4f('0x21')](_0x4b4f('0x22'),path[_0x4b4f('0x23')](_0x34b915['originalname'],path[_0x4b4f('0x24')](_0x34b915['originalname'])),Date[_0x4b4f('0x25')](),path['extname'](_0x34b915[_0x4b4f('0x20')])));}})});router['post'](_0x4b4f('0x26'),upload[_0x4b4f('0x27')]('file'),controller[_0x4b4f('0x28')]);var upload=multer({'storage':multer[_0x4b4f('0x29')]({'destination':function(_0x104dda,_0x396a9a,_0x8e600e){_0x8e600e(null,path[_0x4b4f('0x1d')](config[_0x4b4f('0x1e')],_0x4b4f('0x1f')));},'filename':function(_0x5978c9,_0x5b3502,_0x2f2fbb){_0x5b3502[_0x4b4f('0x20')]=_0x5b3502[_0x4b4f('0x20')][_0x4b4f('0x2a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f2fbb(null,util[_0x4b4f('0x21')](_0x4b4f('0x22'),path[_0x4b4f('0x23')](_0x5b3502[_0x4b4f('0x20')],path[_0x4b4f('0x24')](_0x5b3502[_0x4b4f('0x20')])),Date[_0x4b4f('0x25')](),path['extname'](_0x5b3502['originalname'])));}})});router[_0x4b4f('0x16')](_0x4b4f('0x2b'),upload[_0x4b4f('0x27')](_0x4b4f('0x2c')),controller[_0x4b4f('0x2d')]);router[_0x4b4f('0x16')]('/upload/:id',auth[_0x4b4f('0x9')](),controller[_0x4b4f('0x2e')]);router[_0x4b4f('0x2f')]('/:id',auth[_0x4b4f('0x9')](),controller['update']);router[_0x4b4f('0x30')]('/:id',auth[_0x4b4f('0x9')](),controller[_0x4b4f('0x31')]);module[_0x4b4f('0x32')]=router; \ No newline at end of file +var _0x0972=['destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','getJourney','merge','create','post','/create_many','setTags','diskStorage','server/files/tmp','originalname','format','%s-%s%s','basename','extname','/csv','single','file','root','replace','now','/upload','upload','put','update','delete'];(function(_0x1cb6ec,_0x1255ce){var _0x2148c8=function(_0x9411ef){while(--_0x9411ef){_0x1cb6ec['push'](_0x1cb6ec['shift']());}};_0x2148c8(++_0x1255ce);}(_0x0972,0x64));var _0x2097=function(_0x4b6515,_0x35f66d){_0x4b6515=_0x4b6515-0x0;var _0x4bc37e=_0x0972[_0x4b6515];return _0x4bc37e;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var auth=require(_0x2097('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2097('0x4'));var controller=require(_0x2097('0x5'));router[_0x2097('0x6')]('/',auth[_0x2097('0x7')](),controller[_0x2097('0x8')]);router[_0x2097('0x6')](_0x2097('0x9'),auth['isAuthenticated'](),controller[_0x2097('0xa')]);router[_0x2097('0x6')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0xc')]);router['get'](_0x2097('0xd'),auth[_0x2097('0x7')](),controller[_0x2097('0xe')]);router[_0x2097('0x6')](_0x2097('0xf'),auth[_0x2097('0x7')](),controller[_0x2097('0x10')]);router[_0x2097('0x6')](_0x2097('0x11'),auth[_0x2097('0x7')](),controller[_0x2097('0x12')]);router[_0x2097('0x6')](_0x2097('0x13'),auth[_0x2097('0x7')](),controller[_0x2097('0x14')]);router[_0x2097('0x6')](_0x2097('0x15'),auth[_0x2097('0x7')](),controller[_0x2097('0x16')]);router[_0x2097('0x6')]('/:id/journey',auth[_0x2097('0x7')](),controller[_0x2097('0x17')]);router['post']('/merge',auth['isAuthenticated'](),controller[_0x2097('0x18')]);router['post']('/',auth[_0x2097('0x7')](),controller[_0x2097('0x19')]);router[_0x2097('0x1a')](_0x2097('0x1b'),auth[_0x2097('0x7')](),controller['bulkCreate']);router[_0x2097('0x1a')](_0x2097('0xd'),auth[_0x2097('0x7')](),controller[_0x2097('0x1c')]);var upload=multer({'storage':multer[_0x2097('0x1d')]({'destination':function(_0x235304,_0x253f5d,_0x46b5e0){_0x46b5e0(null,path['join'](config['root'],_0x2097('0x1e')));},'filename':function(_0x569c21,_0x227c00,_0x1ac5f1){_0x227c00['originalname']=_0x227c00[_0x2097('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ac5f1(null,util[_0x2097('0x20')](_0x2097('0x21'),path[_0x2097('0x22')](_0x227c00[_0x2097('0x1f')],path[_0x2097('0x23')](_0x227c00[_0x2097('0x1f')])),Date['now'](),path[_0x2097('0x23')](_0x227c00['originalname'])));}})});router[_0x2097('0x1a')](_0x2097('0x24'),upload[_0x2097('0x25')](_0x2097('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x2097('0x1d')]({'destination':function(_0x80c5ee,_0x56af3b,_0x1229fc){_0x1229fc(null,path['join'](config[_0x2097('0x27')],'server/files/tmp'));},'filename':function(_0xbc0339,_0x33e8d1,_0x407a2a){_0x33e8d1[_0x2097('0x1f')]=_0x33e8d1[_0x2097('0x1f')][_0x2097('0x28')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x407a2a(null,util[_0x2097('0x20')]('%s-%s%s',path[_0x2097('0x22')](_0x33e8d1[_0x2097('0x1f')],path['extname'](_0x33e8d1[_0x2097('0x1f')])),Date[_0x2097('0x29')](),path['extname'](_0x33e8d1['originalname'])));}})});router[_0x2097('0x1a')](_0x2097('0x2a'),upload[_0x2097('0x25')](_0x2097('0x26')),controller[_0x2097('0x2b')]);router[_0x2097('0x1a')]('/upload/:id',auth[_0x2097('0x7')](),controller['import']);router[_0x2097('0x2c')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0x2d')]);router[_0x2097('0x2e')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0x2f')]);module[_0x2097('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a0dd2ef..7d318bd 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 _0xe181=['ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','long','type','select','values','isArray','stringify','setDataValue','BOOLEAN'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xe181,0x68));var _0x1e18=function(_0x3b0d12,_0x581b78){_0x3b0d12=_0x3b0d12-0x0;var _0x44eb08=_0xe181[_0x3b0d12];return _0x44eb08;};'use strict';var Sequelize=require(_0x1e18('0x0'));var _=require('lodash');module[_0x1e18('0x1')]={'name':{'type':Sequelize[_0x1e18('0x2')],'get':function(_0x19e683){return this[_0x1e18('0x3')](_0x1e18('0x4'));}},'alias':{'type':Sequelize[_0x1e18('0x5')],'allowNull':![],'set':function(_0x3ec619){this['setDataValue'](_0x1e18('0x4'),_0x3ec619?_0x3ec619:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x1e18('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x1e18('0x6')](_0x1e18('0x7')),'get':function(){if(this[_0x1e18('0x3')](_0x1e18('0x8'))===_0x1e18('0x9')){return JSON['parse'](this[_0x1e18('0x3')](_0x1e18('0xa')));}else{return this[_0x1e18('0x3')](_0x1e18('0xa'));}},'set':function(_0x19d0bc){if(Array[_0x1e18('0xb')](_0x19d0bc)){this['setDataValue'](_0x1e18('0xa'),JSON[_0x1e18('0xc')](_0x19d0bc));}else{this[_0x1e18('0xd')](_0x1e18('0xa'),_0x19d0bc);}}},'required':{'type':Sequelize[_0x1e18('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1e18('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1e18('0xf')](_0x1e18('0x10'))}}; \ No newline at end of file +var _0x68f5=['getDataValue','alias','STRING','name','type','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','sequelize','lodash','exports'];(function(_0x53a29e,_0x36c7dd){var _0x66f68d=function(_0x1f2b65){while(--_0x1f2b65){_0x53a29e['push'](_0x53a29e['shift']());}};_0x66f68d(++_0x36c7dd);}(_0x68f5,0x11a));var _0x568f=function(_0x5b243e,_0x22580d){_0x5b243e=_0x5b243e-0x0;var _0x2806d5=_0x68f5[_0x5b243e];return _0x2806d5;};'use strict';var Sequelize=require(_0x568f('0x0'));var _=require(_0x568f('0x1'));module[_0x568f('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x25a405){return this[_0x568f('0x3')](_0x568f('0x4'));}},'alias':{'type':Sequelize[_0x568f('0x5')],'allowNull':![],'set':function(_0x425217){this['setDataValue'](_0x568f('0x4'),_0x425217?_0x425217:this[_0x568f('0x3')](_0x568f('0x6')));}},'type':{'type':Sequelize[_0x568f('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x568f('0x3')](_0x568f('0x7'))===_0x568f('0x8')){return JSON['parse'](this[_0x568f('0x3')]('values'));}else{return this[_0x568f('0x3')](_0x568f('0x9'));}},'set':function(_0x570cc4){if(Array[_0x568f('0xa')](_0x570cc4)){this[_0x568f('0xb')](_0x568f('0x9'),JSON[_0x568f('0xc')](_0x570cc4));}else{this[_0x568f('0xb')](_0x568f('0x9'),_0x570cc4);}}},'required':{'type':Sequelize[_0x568f('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x568f('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x568f('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 63a6a81..3941e9a 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 _0xb957=['merge','options','includeAll','include','findAll','rows','show','keys','find','catch','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','CmCustomField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x2eabd6,_0x5942be){var _0x158c26=function(_0x1af466){while(--_0x1af466){_0x2eabd6['push'](_0x2eabd6['shift']());}};_0x158c26(++_0x5942be);}(_0xb957,0x6d));var _0x7b95=function(_0x3afc8a,_0x262e99){_0x3afc8a=_0x3afc8a-0x0;var _0x4fbfa3=_0xb957[_0x3afc8a];return _0x4fbfa3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7b95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b95('0x1'));var rp=require(_0x7b95('0x2'));var moment=require(_0x7b95('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b95('0x4'));var util=require(_0x7b95('0x5'));var path=require(_0x7b95('0x6'));var sox=require(_0x7b95('0x7'));var csv=require(_0x7b95('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b95('0x9'));var squel=require(_0x7b95('0xa'));var crypto=require(_0x7b95('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b95('0x8'));var querystring=require(_0x7b95('0xc'));var Papa=require(_0x7b95('0xd'));var Redis=require(_0x7b95('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b95('0xf'));var logger=require(_0x7b95('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7b95('0x11'));var licenseUtil=require(_0x7b95('0x12'));var db=require(_0x7b95('0x13'))['db'];function respondWithStatusCode(_0x534650,_0x5df477){_0x5df477=_0x5df477||0xcc;return function(_0x399542){if(_0x399542){return _0x534650['sendStatus'](_0x5df477);}return _0x534650[_0x7b95('0x14')](_0x5df477)[_0x7b95('0x15')]();};}function respondWithResult(_0x7e63d3,_0x3818bd){_0x3818bd=_0x3818bd||0xc8;return function(_0x5dedf2){if(_0x5dedf2){return _0x7e63d3['status'](_0x3818bd)[_0x7b95('0x16')](_0x5dedf2);}};}function respondWithFilteredResult(_0x1fd4e5,_0x241ccf){return function(_0x1fa5ad){if(_0x1fa5ad){var _0x87f9c1=_0x1fa5ad[_0x7b95('0x17')],_0x2ee847=_0x241ccf[_0x7b95('0x18')],_0xa1874e=_0x241ccf[_0x7b95('0x18')]+_0x241ccf['limit'],_0x44e836;if(_0xa1874e>=_0x87f9c1){_0xa1874e=_0x87f9c1;_0x44e836=0xc8;}else{_0x44e836=0xce;}_0x1fd4e5[_0x7b95('0x14')](_0x44e836);return _0x1fd4e5[_0x7b95('0x19')](_0x7b95('0x1a'),_0x2ee847+'-'+_0xa1874e+'/'+_0x87f9c1)[_0x7b95('0x16')](_0x1fa5ad);}return null;};}function patchUpdates(_0x3678d9){return function(_0xc26a6e){try{jsonpatch[_0x7b95('0x1b')](_0xc26a6e,_0x3678d9,!![]);}catch(_0x3b0325){return BPromise['reject'](_0x3b0325);}return _0xc26a6e[_0x7b95('0x1c')]();};}function saveUpdates(_0x342ecc,_0x32fe1c){return function(_0x13c60e){if(_0x13c60e){return _0x13c60e[_0x7b95('0x1d')](_0x342ecc)[_0x7b95('0x1e')](function(_0x4157c3){return _0x4157c3;});}return null;};}function removeEntity(_0x1657bd,_0x2144c1){return function(_0x3deae3){if(_0x3deae3){return _0x3deae3[_0x7b95('0x1f')]()[_0x7b95('0x1e')](function(){_0x1657bd[_0x7b95('0x14')](0xcc)[_0x7b95('0x15')]();});}};}function handleEntityNotFound(_0x4acc74,_0x1c0a41){return function(_0x1ff81c){if(!_0x1ff81c){_0x4acc74['sendStatus'](0x194);}return _0x1ff81c;};}function handleError(_0x2e7795,_0x39b5fe){_0x39b5fe=_0x39b5fe||0x1f4;return function(_0x184d4f){logger[_0x7b95('0x20')](_0x184d4f[_0x7b95('0x21')]);if(_0x184d4f[_0x7b95('0x22')]){delete _0x184d4f[_0x7b95('0x22')];}_0x2e7795['status'](_0x39b5fe)[_0x7b95('0x23')](_0x184d4f);};}exports['index']=function(_0x2fdc2d,_0x41d863){var _0x1b6e6b={},_0x1c7a56={},_0x43504f={'count':0x0,'rows':[]};var _0xaa3991=_['map'](db[_0x7b95('0x24')][_0x7b95('0x25')],function(_0x47cd20){return{'name':_0x47cd20[_0x7b95('0x26')],'type':_0x47cd20[_0x7b95('0x27')][_0x7b95('0x28')]};});_0x1c7a56[_0x7b95('0x29')]=_['differenceBy'](_[_0x7b95('0x2a')](_0xaa3991,_0x7b95('0x22')),[_0x7b95('0x22')]);_0x1c7a56['query']=_['keys'](_0x2fdc2d[_0x7b95('0x2b')]);_0x1c7a56[_0x7b95('0x2c')]=_['intersection'](_0x1c7a56[_0x7b95('0x29')],_0x1c7a56['query']);_0x1b6e6b[_0x7b95('0x2d')]=_[_0x7b95('0x2e')](_0x1c7a56['model'],qs['fields'](_0x2fdc2d[_0x7b95('0x2b')][_0x7b95('0x2f')]));_0x1b6e6b[_0x7b95('0x2d')]=_0x1b6e6b[_0x7b95('0x2d')][_0x7b95('0x30')]?_0x1b6e6b[_0x7b95('0x2d')]:_0x1c7a56['model'];if(!_0x2fdc2d[_0x7b95('0x2b')][_0x7b95('0x31')](_0x7b95('0x32'))){_0x1b6e6b[_0x7b95('0x33')]=qs['limit'](_0x2fdc2d['query'][_0x7b95('0x33')]);_0x1b6e6b[_0x7b95('0x18')]=qs[_0x7b95('0x18')](_0x2fdc2d[_0x7b95('0x2b')][_0x7b95('0x18')]);}_0x1b6e6b[_0x7b95('0x34')]=qs[_0x7b95('0x35')](_0x2fdc2d[_0x7b95('0x2b')][_0x7b95('0x35')]);_0x1b6e6b[_0x7b95('0x36')]=qs[_0x7b95('0x2c')](_[_0x7b95('0x37')](_0x2fdc2d[_0x7b95('0x2b')],_0x1c7a56['filters']),_0xaa3991);if(_0x2fdc2d[_0x7b95('0x2b')][_0x7b95('0x38')]){_0x1b6e6b[_0x7b95('0x36')]=_[_0x7b95('0x39')](_0x1b6e6b[_0x7b95('0x36')],{'$or':_[_0x7b95('0x2a')](_0xaa3991,function(_0x5fd466){if(_0x5fd466[_0x7b95('0x27')]!=='VIRTUAL'){var _0x541d14={};_0x541d14[_0x5fd466[_0x7b95('0x22')]]={'$like':'%'+_0x2fdc2d[_0x7b95('0x2b')][_0x7b95('0x38')]+'%'};return _0x541d14;}})});}_0x1b6e6b=_[_0x7b95('0x39')]({},_0x1b6e6b,_0x2fdc2d[_0x7b95('0x3a')]);var _0x49851a={'where':_0x1b6e6b[_0x7b95('0x36')]};return db[_0x7b95('0x24')]['count'](_0x49851a)['then'](function(_0x41a8a7){_0x43504f[_0x7b95('0x17')]=_0x41a8a7;if(_0x2fdc2d['query'][_0x7b95('0x3b')]){_0x1b6e6b[_0x7b95('0x3c')]=[{'all':!![]}];}return db[_0x7b95('0x24')][_0x7b95('0x3d')](_0x1b6e6b);})['then'](function(_0x482c11){_0x43504f[_0x7b95('0x3e')]=_0x482c11;return _0x43504f;})[_0x7b95('0x1e')](respondWithFilteredResult(_0x41d863,_0x1b6e6b))['catch'](handleError(_0x41d863,null));};exports[_0x7b95('0x3f')]=function(_0x587ec2,_0x3a1668){var _0x548075={'raw':!![],'where':{'id':_0x587ec2['params']['id']}},_0x33c375={};_0x33c375['model']=_['keys'](db[_0x7b95('0x24')][_0x7b95('0x25')]);_0x33c375[_0x7b95('0x2b')]=_[_0x7b95('0x40')](_0x587ec2[_0x7b95('0x2b')]);_0x33c375[_0x7b95('0x2c')]=_[_0x7b95('0x2e')](_0x33c375[_0x7b95('0x29')],_0x33c375[_0x7b95('0x2b')]);_0x548075[_0x7b95('0x2d')]=_[_0x7b95('0x2e')](_0x33c375['model'],qs['fields'](_0x587ec2[_0x7b95('0x2b')][_0x7b95('0x2f')]));_0x548075[_0x7b95('0x2d')]=_0x548075['attributes'][_0x7b95('0x30')]?_0x548075[_0x7b95('0x2d')]:_0x33c375[_0x7b95('0x29')];if(_0x587ec2['query'][_0x7b95('0x3b')]){_0x548075['include']=[{'all':!![]}];}_0x548075=_[_0x7b95('0x39')]({},_0x548075,_0x587ec2[_0x7b95('0x3a')]);return db[_0x7b95('0x24')][_0x7b95('0x41')](_0x548075)[_0x7b95('0x1e')](handleEntityNotFound(_0x3a1668,null))[_0x7b95('0x1e')](respondWithResult(_0x3a1668,null))[_0x7b95('0x42')](handleError(_0x3a1668,null));};exports[_0x7b95('0x1d')]=function(_0x168f80,_0x247a6e){if(_0x168f80[_0x7b95('0x43')]['id']){delete _0x168f80[_0x7b95('0x43')]['id'];}return db['CmCustomField'][_0x7b95('0x41')]({'where':{'id':_0x168f80[_0x7b95('0x44')]['id']}})['then'](handleEntityNotFound(_0x247a6e,null))[_0x7b95('0x1e')](saveUpdates(_0x168f80[_0x7b95('0x43')],null))['then'](respondWithResult(_0x247a6e,null))['catch'](handleError(_0x247a6e,null));};exports[_0x7b95('0x1f')]=function(_0x30d7e3,_0x1b13a8){return db[_0x7b95('0x24')][_0x7b95('0x41')]({'where':{'id':_0x30d7e3[_0x7b95('0x44')]['id']}})[_0x7b95('0x1e')](handleEntityNotFound(_0x1b13a8,null))[_0x7b95('0x1e')](removeEntity(_0x1b13a8,null))[_0x7b95('0x42')](handleError(_0x1b13a8,null));};exports[_0x7b95('0x45')]=function(_0x1e8b41,_0x72281e){var _0x58f2e1;return db[_0x7b95('0x46')][_0x7b95('0x47')](function(_0x4a9540){return db[_0x7b95('0x24')][_0x7b95('0x45')](_0x1e8b41[_0x7b95('0x43')],{'transaction':_0x4a9540})['then'](function(_0x33e1b1){_0x58f2e1=_0x33e1b1;var _0x573a23={'type':db[_0x7b95('0x48')][_0x7b95('0x49')],'transaction':_0x4a9540};switch(_0x1e8b41[_0x7b95('0x43')][_0x7b95('0x27')]){case _0x7b95('0x4a'):_0x573a23[_0x7b95('0x27')]=db[_0x7b95('0x48')][_0x7b95('0x49')];break;case _0x7b95('0x4b'):_0x573a23['type']=db[_0x7b95('0x48')][_0x7b95('0x4c')];break;case _0x7b95('0x4d'):_0x573a23['type']=db[_0x7b95('0x48')][_0x7b95('0x4e')];_0x573a23[_0x7b95('0x4f')]=![];break;default:}return db[_0x7b95('0x46')][_0x7b95('0x50')][_0x7b95('0x51')]('cm_contacts',util[_0x7b95('0x52')]('cf_%d',_0x58f2e1['id']),_0x573a23);})[_0x7b95('0x1e')](function(){return _0x58f2e1;});})[_0x7b95('0x1e')](respondWithResult(_0x72281e,0xc9))[_0x7b95('0x42')](handleError(_0x72281e,null));}; \ No newline at end of file +var _0x9269=['desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','CmCustomField','findAll','catch','show','params','includeAll','include','options','find','update','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x533990,_0x21fe8d){var _0x5a5e2a=function(_0x2539c3){while(--_0x2539c3){_0x533990['push'](_0x533990['shift']());}};_0x5a5e2a(++_0x21fe8d);}(_0x9269,0x147));var _0x9926=function(_0x38d9cb,_0x30654d){_0x38d9cb=_0x38d9cb-0x0;var _0x15102a=_0x9269[_0x38d9cb];return _0x15102a;};'use strict';var pdf=require(_0x9926('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9926('0x1'));var zipdir=require(_0x9926('0x2'));var jsonpatch=require(_0x9926('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9926('0x4'));var util=require(_0x9926('0x5'));var path=require(_0x9926('0x6'));var sox=require(_0x9926('0x7'));var csv=require(_0x9926('0x8'));var ejs=require(_0x9926('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9926('0xa'));var crypto=require(_0x9926('0xb'));var jsforce=require(_0x9926('0xc'));var deskjs=require(_0x9926('0xd'));var toCsv=require(_0x9926('0x8'));var querystring=require(_0x9926('0xe'));var Papa=require('papaparse');var Redis=require(_0x9926('0xf'));var authService=require(_0x9926('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9926('0x11'));var logger=require(_0x9926('0x12'))(_0x9926('0x13'));var utils=require(_0x9926('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9926('0x15'))['db'];function respondWithStatusCode(_0x40bb2e,_0x43412b){_0x43412b=_0x43412b||0xcc;return function(_0x182de2){if(_0x182de2){return _0x40bb2e['sendStatus'](_0x43412b);}return _0x40bb2e[_0x9926('0x16')](_0x43412b)[_0x9926('0x17')]();};}function respondWithResult(_0x4b5f2c,_0x4f103e){_0x4f103e=_0x4f103e||0xc8;return function(_0x1425d3){if(_0x1425d3){return _0x4b5f2c['status'](_0x4f103e)[_0x9926('0x18')](_0x1425d3);}};}function respondWithFilteredResult(_0x19ab70,_0x1506b2){return function(_0x5c1e3d){if(_0x5c1e3d){var _0x290391=_0x5c1e3d[_0x9926('0x19')],_0x1fc93d=_0x1506b2[_0x9926('0x1a')],_0x43e26b=_0x1506b2[_0x9926('0x1a')]+_0x1506b2[_0x9926('0x1b')],_0x1b2924;if(_0x43e26b>=_0x290391){_0x43e26b=_0x290391;_0x1b2924=0xc8;}else{_0x1b2924=0xce;}_0x19ab70['status'](_0x1b2924);return _0x19ab70['set'](_0x9926('0x1c'),_0x1fc93d+'-'+_0x43e26b+'/'+_0x290391)[_0x9926('0x18')](_0x5c1e3d);}return null;};}function patchUpdates(_0x2dac12){return function(_0x322284){try{jsonpatch[_0x9926('0x1d')](_0x322284,_0x2dac12,!![]);}catch(_0x20638e){return BPromise['reject'](_0x20638e);}return _0x322284['save']();};}function saveUpdates(_0x6b6d0e,_0x52aec0){return function(_0x5c9e0a){if(_0x5c9e0a){return _0x5c9e0a['update'](_0x6b6d0e)[_0x9926('0x1e')](function(_0x25036e){return _0x25036e;});}return null;};}function removeEntity(_0x9c88ad,_0x28061b){return function(_0x578054){if(_0x578054){return _0x578054[_0x9926('0x1f')]()[_0x9926('0x1e')](function(){_0x9c88ad[_0x9926('0x16')](0xcc)[_0x9926('0x17')]();});}};}function handleEntityNotFound(_0x201571,_0x2b9ecf){return function(_0x2a24bf){if(!_0x2a24bf){_0x201571[_0x9926('0x20')](0x194);}return _0x2a24bf;};}function handleError(_0x4e9bad,_0x57adba){_0x57adba=_0x57adba||0x1f4;return function(_0x59b2c9){logger[_0x9926('0x21')](_0x59b2c9[_0x9926('0x22')]);if(_0x59b2c9[_0x9926('0x23')]){delete _0x59b2c9[_0x9926('0x23')];}_0x4e9bad[_0x9926('0x16')](_0x57adba)[_0x9926('0x24')](_0x59b2c9);};}exports[_0x9926('0x25')]=function(_0x2fb84b,_0x59532d){var _0x306c16={},_0x859755={},_0x50d3ac={'count':0x0,'rows':[]};var _0x22d3a9=_[_0x9926('0x26')](db['CmCustomField'][_0x9926('0x27')],function(_0x29dd4a){return{'name':_0x29dd4a[_0x9926('0x28')],'type':_0x29dd4a[_0x9926('0x29')][_0x9926('0x2a')]};});_0x859755[_0x9926('0x2b')]=_['differenceBy'](_[_0x9926('0x26')](_0x22d3a9,'name'),[_0x9926('0x23')]);_0x859755['query']=_[_0x9926('0x2c')](_0x2fb84b[_0x9926('0x2d')]);_0x859755[_0x9926('0x2e')]=_['intersection'](_0x859755[_0x9926('0x2b')],_0x859755['query']);_0x306c16[_0x9926('0x2f')]=_[_0x9926('0x30')](_0x859755['model'],qs[_0x9926('0x31')](_0x2fb84b['query'][_0x9926('0x31')]));_0x306c16['attributes']=_0x306c16[_0x9926('0x2f')][_0x9926('0x32')]?_0x306c16[_0x9926('0x2f')]:_0x859755['model'];if(!_0x2fb84b[_0x9926('0x2d')][_0x9926('0x33')]('nolimit')){_0x306c16[_0x9926('0x1b')]=qs[_0x9926('0x1b')](_0x2fb84b[_0x9926('0x2d')][_0x9926('0x1b')]);_0x306c16[_0x9926('0x1a')]=qs[_0x9926('0x1a')](_0x2fb84b[_0x9926('0x2d')][_0x9926('0x1a')]);}_0x306c16[_0x9926('0x34')]=qs[_0x9926('0x35')](_0x2fb84b[_0x9926('0x2d')][_0x9926('0x35')]);_0x306c16[_0x9926('0x36')]=qs[_0x9926('0x2e')](_[_0x9926('0x37')](_0x2fb84b['query'],_0x859755[_0x9926('0x2e')]),_0x22d3a9);if(_0x2fb84b[_0x9926('0x2d')]['filter']){_0x306c16[_0x9926('0x36')]=_[_0x9926('0x38')](_0x306c16[_0x9926('0x36')],{'$or':_[_0x9926('0x26')](_0x22d3a9,function(_0xdbe40c){if(_0xdbe40c[_0x9926('0x29')]!==_0x9926('0x39')){var _0x5b39a0={};_0x5b39a0[_0xdbe40c[_0x9926('0x23')]]={'$like':'%'+_0x2fb84b['query'][_0x9926('0x3a')]+'%'};return _0x5b39a0;}})});}_0x306c16=_[_0x9926('0x38')]({},_0x306c16,_0x2fb84b['options']);var _0x36787a={'where':_0x306c16[_0x9926('0x36')]};return db[_0x9926('0x3b')][_0x9926('0x19')](_0x36787a)[_0x9926('0x1e')](function(_0x2fe543){_0x50d3ac[_0x9926('0x19')]=_0x2fe543;if(_0x2fb84b[_0x9926('0x2d')]['includeAll']){_0x306c16['include']=[{'all':!![]}];}return db[_0x9926('0x3b')][_0x9926('0x3c')](_0x306c16);})[_0x9926('0x1e')](function(_0x413a40){_0x50d3ac['rows']=_0x413a40;return _0x50d3ac;})['then'](respondWithFilteredResult(_0x59532d,_0x306c16))[_0x9926('0x3d')](handleError(_0x59532d,null));};exports[_0x9926('0x3e')]=function(_0x1cd014,_0x15a6a3){var _0x3c343a={'raw':!![],'where':{'id':_0x1cd014[_0x9926('0x3f')]['id']}},_0x55817a={};_0x55817a[_0x9926('0x2b')]=_[_0x9926('0x2c')](db[_0x9926('0x3b')][_0x9926('0x27')]);_0x55817a['query']=_['keys'](_0x1cd014[_0x9926('0x2d')]);_0x55817a['filters']=_[_0x9926('0x30')](_0x55817a[_0x9926('0x2b')],_0x55817a[_0x9926('0x2d')]);_0x3c343a[_0x9926('0x2f')]=_[_0x9926('0x30')](_0x55817a[_0x9926('0x2b')],qs[_0x9926('0x31')](_0x1cd014[_0x9926('0x2d')][_0x9926('0x31')]));_0x3c343a[_0x9926('0x2f')]=_0x3c343a[_0x9926('0x2f')][_0x9926('0x32')]?_0x3c343a[_0x9926('0x2f')]:_0x55817a['model'];if(_0x1cd014[_0x9926('0x2d')][_0x9926('0x40')]){_0x3c343a[_0x9926('0x41')]=[{'all':!![]}];}_0x3c343a=_[_0x9926('0x38')]({},_0x3c343a,_0x1cd014[_0x9926('0x42')]);return db['CmCustomField'][_0x9926('0x43')](_0x3c343a)[_0x9926('0x1e')](handleEntityNotFound(_0x15a6a3,null))[_0x9926('0x1e')](respondWithResult(_0x15a6a3,null))[_0x9926('0x3d')](handleError(_0x15a6a3,null));};exports[_0x9926('0x44')]=function(_0x378302,_0x5516e1){if(_0x378302[_0x9926('0x45')]['id']){delete _0x378302[_0x9926('0x45')]['id'];}return db[_0x9926('0x3b')]['find']({'where':{'id':_0x378302[_0x9926('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5516e1,null))[_0x9926('0x1e')](saveUpdates(_0x378302[_0x9926('0x45')],null))[_0x9926('0x1e')](respondWithResult(_0x5516e1,null))[_0x9926('0x3d')](handleError(_0x5516e1,null));};exports['destroy']=function(_0x39ad71,_0x4ed854){return db[_0x9926('0x3b')][_0x9926('0x43')]({'where':{'id':_0x39ad71[_0x9926('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4ed854,null))['then'](removeEntity(_0x4ed854,null))[_0x9926('0x3d')](handleError(_0x4ed854,null));};exports[_0x9926('0x46')]=function(_0x2979af,_0x5b029e){var _0x3f348e;return db['sequelize'][_0x9926('0x47')](function(_0x1f09d2){return db[_0x9926('0x3b')]['create'](_0x2979af[_0x9926('0x45')],{'transaction':_0x1f09d2})[_0x9926('0x1e')](function(_0x19d630){_0x3f348e=_0x19d630;var _0x3fd14e={'type':db[_0x9926('0x48')][_0x9926('0x49')],'transaction':_0x1f09d2};switch(_0x2979af[_0x9926('0x45')][_0x9926('0x29')]){case _0x9926('0x4a'):_0x3fd14e[_0x9926('0x29')]=db[_0x9926('0x48')]['TEXT'];break;case _0x9926('0x4b'):_0x3fd14e[_0x9926('0x29')]=db['Sequelize'][_0x9926('0x4c')];break;case _0x9926('0x4d'):_0x3fd14e[_0x9926('0x29')]=db[_0x9926('0x48')]['BOOLEAN'];_0x3fd14e[_0x9926('0x4e')]=![];break;default:}return db[_0x9926('0x4f')][_0x9926('0x50')][_0x9926('0x51')](_0x9926('0x52'),util[_0x9926('0x53')](_0x9926('0x54'),_0x3f348e['id']),_0x3fd14e);})[_0x9926('0x1e')](function(){return _0x3f348e;});})[_0x9926('0x1e')](respondWithResult(_0x5b029e,0xc9))[_0x9926('0x3d')](handleError(_0x5b029e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 584a350..e702463 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 _0x7d11=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1847c7,_0x1fa2ee){var _0x442cd8=function(_0x2ed3ee){while(--_0x2ed3ee){_0x1847c7['push'](_0x1847c7['shift']());}};_0x442cd8(++_0x1fa2ee);}(_0x7d11,0x95));var _0x17d1=function(_0x1eb0eb,_0x5627a9){_0x1eb0eb=_0x1eb0eb-0x0;var _0x479b1a=_0x7d11[_0x1eb0eb];return _0x479b1a;};'use strict';var _=require('lodash');var util=require(_0x17d1('0x0'));var logger=require(_0x17d1('0x1'))(_0x17d1('0x2'));var moment=require(_0x17d1('0x3'));var BPromise=require(_0x17d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17d1('0x5'));var rimraf=require(_0x17d1('0x6'));var config=require(_0x17d1('0x7'));var attributes=require(_0x17d1('0x8'));module[_0x17d1('0x9')]=function(_0x1e6370,_0x3b3536){return _0x1e6370[_0x17d1('0xa')](_0x17d1('0xb'),attributes,{'tableName':_0x17d1('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885f=['cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCustomField'];(function(_0x5a3c85,_0x51fcc0){var _0x5d5453=function(_0xdd7788){while(--_0xdd7788){_0x5a3c85['push'](_0x5a3c85['shift']());}};_0x5d5453(++_0x51fcc0);}(_0x885f,0x1b1));var _0xf885=function(_0x18a257,_0x12d221){_0x18a257=_0x18a257-0x0;var _0x35ec40=_0x885f[_0x18a257];return _0x35ec40;};'use strict';var _=require('lodash');var util=require(_0xf885('0x0'));var logger=require(_0xf885('0x1'))(_0xf885('0x2'));var moment=require(_0xf885('0x3'));var BPromise=require(_0xf885('0x4'));var rp=require(_0xf885('0x5'));var fs=require('fs');var path=require(_0xf885('0x6'));var rimraf=require(_0xf885('0x7'));var config=require(_0xf885('0x8'));var attributes=require('./cmCustomField.attributes');module[_0xf885('0x9')]=function(_0x434ac7,_0x16861b){return _0x434ac7['define'](_0xf885('0xa'),attributes,{'tableName':_0xf885('0xb'),'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 0d92612..87fae73 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 _0x5089=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1627cd,_0x2a9058){var _0x3d7971=function(_0x15d6a8){while(--_0x15d6a8){_0x1627cd['push'](_0x1627cd['shift']());}};_0x3d7971(++_0x2a9058);}(_0x5089,0x1bb));var _0x9508=function(_0xe455e7,_0x29fb65){_0xe455e7=_0xe455e7-0x0;var _0xfc683e=_0x5089[_0xe455e7];return _0xfc683e;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var moment=require('moment');var BPromise=require(_0x9508('0x2'));var rs=require(_0x9508('0x3'));var fs=require('fs');var Redis=require(_0x9508('0x4'));var db=require(_0x9508('0x5'))['db'];var utils=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var jayson=require(_0x9508('0x8'));var client=jayson[_0x9508('0x9')][_0x9508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3c6,_0x1dc04c,_0x42d13a){return new BPromise(function(_0x55a5de,_0x14dae7){return client[_0x9508('0xb')](_0x4ab3c6,_0x42d13a)['then'](function(_0x342ddd){logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));logger[_0x9508('0xe')](_0x9508('0xf'),_0x1dc04c,_0x9508('0xd'),JSON[_0x9508('0x10')](_0x342ddd));if(_0x342ddd['error']){if(_0x342ddd[_0x9508('0x11')]['code']===0x1f4){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x342ddd['error'][_0x9508('0x12')]);return _0x14dae7(_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);}logger[_0x9508('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1dc04c,_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);return _0x55a5de(_0x342ddd['error'][_0x9508('0x12')]);}else{logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));_0x55a5de(_0x342ddd[_0x9508('0x13')][_0x9508('0x12')]);}})[_0x9508('0x14')](function(_0x343802){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x343802);_0x14dae7(_0x343802);});});} \ No newline at end of file +var _0xb49a=['info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x488056,_0x727c33){var _0x66f226=function(_0x539cff){while(--_0x539cff){_0x488056['push'](_0x488056['shift']());}};_0x66f226(++_0x727c33);}(_0xb49a,0xfb));var _0xab49=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb49a[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('CmCustomField,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f1f6558..74ebb16 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 _0xe651=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0x1ca090,_0x228c7f){var _0x52c3ce=function(_0x38aa73){while(--_0x38aa73){_0x1ca090['push'](_0x1ca090['shift']());}};_0x52c3ce(++_0x228c7f);}(_0xe651,0x1a5));var _0x1e65=function(_0x4206f9,_0xbb9cd1){_0x4206f9=_0x4206f9-0x0;var _0x47cfda=_0xe651[_0x4206f9];return _0x47cfda;};'use strict';var multer=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var path=require(_0x1e65('0x2'));var timeout=require(_0x1e65('0x3'));var express=require(_0x1e65('0x4'));var router=express[_0x1e65('0x5')]();var auth=require(_0x1e65('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e65('0x7'));var controller=require(_0x1e65('0x8'));router[_0x1e65('0x9')]('/',auth[_0x1e65('0xa')](),controller[_0x1e65('0xb')]);router['get']('/:id',auth[_0x1e65('0xa')](),controller['show']);router[_0x1e65('0xc')]('/',auth[_0x1e65('0xa')](),controller[_0x1e65('0xd')]);router[_0x1e65('0xe')](_0x1e65('0xf'),auth[_0x1e65('0xa')](),controller['update']);router[_0x1e65('0x10')](_0x1e65('0xf'),auth['isAuthenticated'](),controller[_0x1e65('0x11')]);module[_0x1e65('0x12')]=router; \ No newline at end of file +var _0xedc1=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3f877a,_0x438f7f){var _0x68e0ce=function(_0x1e3333){while(--_0x1e3333){_0x3f877a['push'](_0x3f877a['shift']());}};_0x68e0ce(++_0x438f7f);}(_0xedc1,0xac));var _0x1edc=function(_0x40710f,_0x3f145e){_0x40710f=_0x40710f-0x0;var _0x591385=_0xedc1[_0x40710f];return _0x591385;};'use strict';var multer=require(_0x1edc('0x0'));var util=require(_0x1edc('0x1'));var path=require(_0x1edc('0x2'));var timeout=require(_0x1edc('0x3'));var express=require(_0x1edc('0x4'));var router=express[_0x1edc('0x5')]();var auth=require(_0x1edc('0x6'));var interaction=require(_0x1edc('0x7'));var config=require(_0x1edc('0x8'));var controller=require(_0x1edc('0x9'));router[_0x1edc('0xa')]('/',auth[_0x1edc('0xb')](),controller[_0x1edc('0xc')]);router['get'](_0x1edc('0xd'),auth[_0x1edc('0xb')](),controller[_0x1edc('0xe')]);router[_0x1edc('0xf')]('/',auth[_0x1edc('0xb')](),controller[_0x1edc('0x10')]);router[_0x1edc('0x11')](_0x1edc('0xd'),auth['isAuthenticated'](),controller[_0x1edc('0x12')]);router[_0x1edc('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1edc('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 41b889d..ecb88b9 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 _0x72b1=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x1a3ab1,_0x5b927){var _0x1ad85f=function(_0x2eb953){while(--_0x2eb953){_0x1a3ab1['push'](_0x1a3ab1['shift']());}};_0x1ad85f(++_0x5b927);}(_0x72b1,0x16e));var _0x172b=function(_0x1aa9e8,_0x2f6bde){_0x1aa9e8=_0x1aa9e8-0x0;var _0x1bbd0a=_0x72b1[_0x1aa9e8];return _0x1bbd0a;};'use strict';var moment=require(_0x172b('0x0'));var Sequelize=require('sequelize');module[_0x172b('0x1')]={'phone':{'type':Sequelize[_0x172b('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x172b('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x172b('0x4')],'defaultValue':moment()[_0x172b('0x5')](_0x172b('0x6'))},'countbusyretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x172b('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x172b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x172b('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x172b('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x172b('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x172b('0x7')],'unique':_0x172b('0x9')},'UserId':{'type':Sequelize[_0x172b('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x172b('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x172b('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x172b('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2ca=['STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x388582,_0x1f7757){var _0x31a48d=function(_0x4f5abe){while(--_0x4f5abe){_0x388582['push'](_0x388582['shift']());}};_0x31a48d(++_0x1f7757);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0xf2ca[_0x591db7];return _0x4ad760;};'use strict';var moment=require(_0xaf2c('0x0'));var Sequelize=require(_0xaf2c('0x1'));module[_0xaf2c('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xaf2c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xaf2c('0x4')],'defaultValue':moment()[_0xaf2c('0x5')](_0xaf2c('0x6'))},'countbusyretry':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xaf2c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaf2c('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaf2c('0x4')]},'priority':{'type':Sequelize[_0xaf2c('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xaf2c('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xaf2c('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xaf2c('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xaf2c('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xaf2c('0x9')},'CampaignId':{'type':Sequelize[_0xaf2c('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 013257b..f6117c6 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 _0x17d1=['catch','params','keys','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','getVoiceQueues','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','CmCompany','Company','CmList','List','dialActive','outbound','isNumber','error','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','update','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','include','findAll','rows'];(function(_0x317507,_0x5a34c6){var _0x1ac12c=function(_0x3eac95){while(--_0x3eac95){_0x317507['push'](_0x317507['shift']());}};_0x1ac12c(++_0x5a34c6);}(_0x17d1,0xc9));var _0x117d=function(_0xf520f7,_0x3b756b){_0xf520f7=_0xf520f7-0x0;var _0x43fc3f=_0x17d1[_0xf520f7];return _0x43fc3f;};'use strict';var pdf=require(_0x117d('0x0'));var emlformat=require(_0x117d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x117d('0x2'));var rp=require(_0x117d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x117d('0x4'));var util=require(_0x117d('0x5'));var path=require(_0x117d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x117d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x117d('0x8'));var crypto=require(_0x117d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x117d('0xa'));var toCsv=require(_0x117d('0xb'));var querystring=require(_0x117d('0xc'));var Papa=require(_0x117d('0xd'));var Redis=require(_0x117d('0xe'));var authService=require(_0x117d('0xf'));var qs=require(_0x117d('0x10'));var as=require(_0x117d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x117d('0x12'))(_0x117d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x117d('0x14'));var db=require(_0x117d('0x15'))['db'];function respondWithStatusCode(_0x942e2c,_0x46ba04){_0x46ba04=_0x46ba04||0xcc;return function(_0x4e486d){if(_0x4e486d){return _0x942e2c[_0x117d('0x16')](_0x46ba04);}return _0x942e2c['status'](_0x46ba04)[_0x117d('0x17')]();};}function respondWithResult(_0x4836df,_0x322bd6){_0x322bd6=_0x322bd6||0xc8;return function(_0x2f8e6a){if(_0x2f8e6a){return _0x4836df[_0x117d('0x18')](_0x322bd6)[_0x117d('0x19')](_0x2f8e6a);}};}function respondWithFilteredResult(_0x51752b,_0x3d7151){return function(_0x47055e){if(_0x47055e){var _0x24de6b=_0x47055e[_0x117d('0x1a')],_0x1be81c=_0x3d7151[_0x117d('0x1b')],_0x48db8a=_0x3d7151[_0x117d('0x1b')]+_0x3d7151['limit'],_0x223aae;if(_0x48db8a>=_0x24de6b){_0x48db8a=_0x24de6b;_0x223aae=0xc8;}else{_0x223aae=0xce;}_0x51752b[_0x117d('0x18')](_0x223aae);return _0x51752b['set'](_0x117d('0x1c'),_0x1be81c+'-'+_0x48db8a+'/'+_0x24de6b)['json'](_0x47055e);}return null;};}function patchUpdates(_0xcb60c5){return function(_0x3d9f3f){try{jsonpatch[_0x117d('0x1d')](_0x3d9f3f,_0xcb60c5,!![]);}catch(_0x226297){return BPromise[_0x117d('0x1e')](_0x226297);}return _0x3d9f3f['save']();};}function saveUpdates(_0x253a42,_0x1a816f){return function(_0x3e047e){if(_0x3e047e){return _0x3e047e[_0x117d('0x1f')](_0x253a42)[_0x117d('0x20')](function(_0x51d06d){return _0x51d06d;});}return null;};}function removeEntity(_0x1205fe,_0x1def09){return function(_0x512740){if(_0x512740){return _0x512740['destroy']()[_0x117d('0x20')](function(){_0x1205fe[_0x117d('0x18')](0xcc)[_0x117d('0x17')]();});}};}function handleEntityNotFound(_0x150cdf,_0x1fb841){return function(_0x460c06){if(!_0x460c06){_0x150cdf[_0x117d('0x16')](0x194);}return _0x460c06;};}function handleError(_0x38bdba,_0x4a6abd){_0x4a6abd=_0x4a6abd||0x1f4;return function(_0x1abc1e){logger['error'](_0x1abc1e[_0x117d('0x21')]);if(_0x1abc1e[_0x117d('0x22')]){delete _0x1abc1e[_0x117d('0x22')];}_0x38bdba[_0x117d('0x18')](_0x4a6abd)[_0x117d('0x23')](_0x1abc1e);};}exports['index']=function(_0x24ce93,_0x264ee8){var _0x347a9f={},_0x44a12f={},_0x2376da={'count':0x0,'rows':[]};var _0x3a3f97=_[_0x117d('0x24')](db['CmHopper'][_0x117d('0x25')],function(_0x2edd00){return{'name':_0x2edd00[_0x117d('0x26')],'type':_0x2edd00[_0x117d('0x27')][_0x117d('0x28')]};});_0x44a12f[_0x117d('0x29')]=_[_0x117d('0x24')](_0x3a3f97,_0x117d('0x22'));_0x44a12f[_0x117d('0x2a')]=_['keys'](_0x24ce93['query']);_0x44a12f[_0x117d('0x2b')]=_[_0x117d('0x2c')](_0x44a12f[_0x117d('0x29')],_0x44a12f[_0x117d('0x2a')]);_0x44a12f[_0x117d('0x2b')]=_[_0x117d('0x2d')](_0x44a12f['filters'],[_0x117d('0x2e'),_0x117d('0x2f'),_0x117d('0x30'),'$gte',_0x117d('0x31'),_0x117d('0x32'),_0x117d('0x33'),_0x117d('0x34'),_0x117d('0x35'),'$between',_0x117d('0x36'),_0x117d('0x37'),_0x117d('0x38'),_0x117d('0x39'),_0x117d('0x3a'),_0x117d('0x3b'),_0x117d('0x3c'),_0x117d('0x39'),_0x117d('0x3d'),_0x117d('0x3e'),_0x117d('0x3f'),_0x117d('0x40')]);_0x347a9f['attributes']=_[_0x117d('0x2c')](_0x44a12f[_0x117d('0x29')],qs[_0x117d('0x41')](_0x24ce93[_0x117d('0x2a')]['fields']));_0x347a9f[_0x117d('0x42')]=_0x347a9f[_0x117d('0x42')][_0x117d('0x43')]?_0x347a9f[_0x117d('0x42')]:_0x44a12f[_0x117d('0x29')];if(!_0x24ce93['query'][_0x117d('0x44')](_0x117d('0x45'))){_0x347a9f[_0x117d('0x46')]=qs['limit'](_0x24ce93['query'][_0x117d('0x46')]);_0x347a9f[_0x117d('0x1b')]=qs[_0x117d('0x1b')](_0x24ce93[_0x117d('0x2a')][_0x117d('0x1b')]);}_0x347a9f[_0x117d('0x47')]=qs['sort'](_0x24ce93[_0x117d('0x2a')]['sort']);_0x347a9f[_0x117d('0x48')]=qs[_0x117d('0x2b')](_[_0x117d('0x49')](_0x24ce93[_0x117d('0x2a')],_0x44a12f[_0x117d('0x2b')]),_0x3a3f97);if(_0x24ce93[_0x117d('0x2a')][_0x117d('0x4a')]){_0x347a9f[_0x117d('0x48')]=_[_0x117d('0x4b')](_0x347a9f[_0x117d('0x48')],{'$or':_[_0x117d('0x24')](_0x3a3f97,function(_0x1ca1b2){if(_0x1ca1b2[_0x117d('0x27')]!==_0x117d('0x4c')){var _0x424ac6={};_0x424ac6[_0x1ca1b2['name']]={'$like':'%'+_0x24ce93[_0x117d('0x2a')][_0x117d('0x4a')]+'%'};return _0x424ac6;}})});}_0x347a9f=_[_0x117d('0x4b')]({},_0x347a9f,_0x24ce93[_0x117d('0x4d')]);var _0x2e9f7b={'where':_0x347a9f[_0x117d('0x48')]};return db[_0x117d('0x4e')][_0x117d('0x1a')](_0x2e9f7b)['then'](function(_0x2a7f05){_0x2376da[_0x117d('0x1a')]=_0x2a7f05;if(_0x24ce93['query'][_0x117d('0x4f')]){_0x347a9f[_0x117d('0x50')]=[{'all':!![]}];}return db[_0x117d('0x4e')][_0x117d('0x51')](_0x347a9f);})[_0x117d('0x20')](function(_0x434d42){_0x2376da[_0x117d('0x52')]=_0x434d42;return _0x2376da;})[_0x117d('0x20')](respondWithFilteredResult(_0x264ee8,_0x347a9f))[_0x117d('0x53')](handleError(_0x264ee8,null));};exports['show']=function(_0x200e1d,_0x468849){var _0x508d9a={'raw':!![],'where':{'id':_0x200e1d[_0x117d('0x54')]['id']}},_0x4b503a={};_0x4b503a[_0x117d('0x29')]=_[_0x117d('0x55')](db[_0x117d('0x4e')][_0x117d('0x25')]);_0x4b503a[_0x117d('0x2a')]=_[_0x117d('0x55')](_0x200e1d[_0x117d('0x2a')]);_0x4b503a[_0x117d('0x2b')]=_[_0x117d('0x2c')](_0x4b503a[_0x117d('0x29')],_0x4b503a[_0x117d('0x2a')]);_0x508d9a[_0x117d('0x42')]=_[_0x117d('0x2c')](_0x4b503a['model'],qs['fields'](_0x200e1d[_0x117d('0x2a')][_0x117d('0x41')]));_0x508d9a[_0x117d('0x42')]=_0x508d9a[_0x117d('0x42')][_0x117d('0x43')]?_0x508d9a[_0x117d('0x42')]:_0x4b503a[_0x117d('0x29')];if(_0x200e1d[_0x117d('0x2a')][_0x117d('0x4f')]){_0x508d9a['include']=[{'all':!![]}];}_0x508d9a=_[_0x117d('0x4b')]({},_0x508d9a,_0x200e1d[_0x117d('0x4d')]);return db[_0x117d('0x4e')][_0x117d('0x56')](_0x508d9a)['then'](handleEntityNotFound(_0x468849,null))['then'](respondWithResult(_0x468849,null))[_0x117d('0x53')](handleError(_0x468849,null));};exports[_0x117d('0x57')]=function(_0x511969,_0x332492){return db[_0x117d('0x4e')][_0x117d('0x57')](_0x511969[_0x117d('0x58')],{})[_0x117d('0x20')](respondWithResult(_0x332492,0xc9))[_0x117d('0x53')](handleError(_0x332492,null));};exports[_0x117d('0x1f')]=function(_0x379ac8,_0x524694){if(_0x379ac8['body']['id']){delete _0x379ac8[_0x117d('0x58')]['id'];}return db[_0x117d('0x4e')]['find']({'where':{'id':_0x379ac8[_0x117d('0x54')]['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x524694,null))['then'](saveUpdates(_0x379ac8[_0x117d('0x58')],null))[_0x117d('0x20')](respondWithResult(_0x524694,null))['catch'](handleError(_0x524694,null));};exports[_0x117d('0x59')]=function(_0x2d099e,_0x18f054){return db[_0x117d('0x4e')][_0x117d('0x59')]()[_0x117d('0x20')](respondWithResult(_0x18f054,null))[_0x117d('0x53')](handleError(_0x18f054,null));};exports[_0x117d('0x5a')]=function(_0x3eee46,_0xd0470){var _0x30e4b3;return db[_0x117d('0x4e')][_0x117d('0x56')]({'where':{'id':_0x3eee46[_0x117d('0x54')]['id']}})['then'](handleEntityNotFound(_0xd0470,null))['then'](function(_0x4b3cbd){if(_0x4b3cbd){return _0x4b3cbd[_0x117d('0x5a')]()[_0x117d('0x20')](function(_0x174524){return _0x174524;});}})[_0x117d('0x20')](function(_0x380d1b){_0x30e4b3=_0x380d1b;if(_0x380d1b){if(_0x380d1b[_0x117d('0x5b')]||_0x380d1b[_0x117d('0x5c')]){return db[_0x380d1b[_0x117d('0x5b')]?_0x117d('0x5d'):_0x117d('0x5e')]['find']({'where':{'id':_0x380d1b[_0x117d('0x5b')]?_0x380d1b[_0x117d('0x5b')]:_0x380d1b['CampaignId']},'attributes':['id',_0x117d('0x22')],'raw':!![]});}}})['then'](function(_0x3af85d){var _0x97cc27={};if(_0x3af85d){_[_0x117d('0x4b')](_0x97cc27,_[_0x117d('0x5f')](_0x30e4b3['dataValues'],['createdAt',_0x117d('0x60'),'id']));_0x97cc27[_0x117d('0x61')]=0x15;_0x97cc27[_0x117d('0x62')]=_0x117d('0x63');_0x97cc27[_0x117d('0x64')]=_0x3af85d[_0x117d('0x22')];_0x97cc27[_0x117d('0x65')]=_0x3eee46[_0x117d('0x66')][_0x117d('0x22')];_0x97cc27['UserId']=_0x3eee46[_0x117d('0x66')]['id'];_0x97cc27['deleted']=!![];_0x97cc27['deletedat']=moment()[_0x117d('0x67')](_0x117d('0x68'));_0x97cc27[_0x117d('0x69')]=_0x30e4b3['phone'];_0x97cc27[_0x117d('0x6a')]=_0x30e4b3[_0x117d('0x5b')]?_0x117d('0x6b'):'ivr';return db[_0x117d('0x6c')]['find']({'where':{'id':_0x97cc27[_0x117d('0x6d')]},'attributes':['firstName','lastName']})['then'](function(_0x1eaef0){if(!_[_0x117d('0x6e')](_0xd0470)&&!_[_0x117d('0x6e')](_0x1eaef0[_0x117d('0x6f')])){_0x97cc27[_0x117d('0x70')]=_0x1eaef0['firstName'];if(!_[_0x117d('0x6e')](_0x1eaef0[_0x117d('0x71')])){_0x97cc27[_0x117d('0x70')]+='\x20'+_0x1eaef0[_0x117d('0x71')];}}})[_0x117d('0x72')](function(){return db['CmHopperFinal'][_0x117d('0x57')](_0x97cc27);});}})[_0x117d('0x20')](function(){return _0xd0470[_0x117d('0x18')](0xcc)[_0x117d('0x17')]();})[_0x117d('0x53')](handleError(_0xd0470,null));};exports['getPreview']=function(_0x295128,_0xc4ab8a,_0x202f26){var _0x3fd612=[];return db[_0x117d('0x6c')][_0x117d('0x59')]()[_0x117d('0x20')](function(_0x5bc622){_0x3fd612=_[_0x117d('0x55')](_0x5bc622);return _0x295128[_0x117d('0x66')][_0x117d('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x117d('0x74')],'raw':!![]});})['then'](function(_0x2b67a1){if(_0x2b67a1&&_0x2b67a1[_0x117d('0x43')]){return db[_0x117d('0x75')][_0x117d('0x76')](function(_0x2fab75){var _0x5161c5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x117d('0x67')](_0x117d('0x68'))},'VoiceQueueId':{'$in':_[_0x117d('0x24')](_0x2b67a1,'id')},'$or':[{'UserId':null},{'UserId':_0x295128[_0x117d('0x66')]['id']}]};var _0x387a5e=[];if(_0x295128['body']['direction']&&_0x295128['body'][_0x117d('0x77')]===_0x117d('0x78')){if(!_[_0x117d('0x79')](_0x295128['body']['hopperIds'])){_0x5161c5['id']={'$in':_0x295128['body']['hopperIds']};}_0x387a5e=[[_0x117d('0x7a'),_0x117d('0x7b')],[_0x117d('0x7c'),_0x2b67a1[0x0][_0x117d('0x74')]===_0x117d('0x7b')?_0x117d('0x7d'):_0x117d('0x7b')],db[_0x117d('0x75')][_0x117d('0x7e')](_0x117d('0x7f')),['id',_0x117d('0x7d')]];}else{if(!_[_0x117d('0x79')](_0x295128['body']['hopperIds'])){_0x5161c5['id']={'$notIn':_0x295128[_0x117d('0x58')]['hopperIds']};}_0x387a5e=[[_0x117d('0x7a'),_0x117d('0x7d')],[_0x117d('0x7c'),_0x2b67a1[0x0][_0x117d('0x74')]],db[_0x117d('0x75')][_0x117d('0x7e')](_0x117d('0x80')),['id',_0x117d('0x7b')]];}return db[_0x117d('0x4e')][_0x117d('0x81')]({'attributes':['id','scheduledat'],'where':_0x5161c5,'order':_0x387a5e,'transaction':_0x2fab75,'lock':_0x2fab75[_0x117d('0x82')][_0x117d('0x83')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x3fd612,'include':[{'model':db[_0x117d('0x84')],'as':_0x117d('0x85'),'attributes':['id',_0x117d('0x22')]}]},{'model':db[_0x117d('0x86')],'as':_0x117d('0x87'),'attributes':['id',_0x117d('0x22')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x117d('0x88')]}]})['then'](function(_0x4f4ff8){if(_0x4f4ff8){return _0x4f4ff8['update']({'UserId':_0x295128['user']['id']},{'transaction':_0x2fab75});}});});}})[_0x117d('0x20')](handleEntityNotFound(_0xc4ab8a,null))[_0x117d('0x20')](respondWithResult(_0xc4ab8a,null))[_0x117d('0x53')](handleError(_0xc4ab8a,null));};exports['getOpenContacts']=function(_0x5c03d8,_0x41aa82,_0x113c0b){return _0x5c03d8[_0x117d('0x66')][_0x117d('0x73')]({'where':{'type':_0x117d('0x89'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x4d77cc){if(_0x4d77cc&&_0x4d77cc['length']){return db[_0x117d('0x4e')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x117d('0x68'))},'VoiceQueueId':{'$in':_['map'](_0x4d77cc,'id')},'$or':[{'UserId':null},{'UserId':_0x5c03d8[_0x117d('0x66')]['id']}]}});}return 0x0;})['then'](function(_0x1aeec1){if(!_[_0x117d('0x6e')](_0x1aeec1)&&_[_0x117d('0x8a')](_0x1aeec1)){return _0x41aa82[_0x117d('0x18')](0xc8)[_0x117d('0x19')]({'contacts':_0x1aeec1});}else{logger[_0x117d('0x8b')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x117d('0x8c'),0x194,_0x117d('0x8d'));_0x41aa82[_0x117d('0x16')](0x194);}})[_0x117d('0x53')](handleError(_0x41aa82,null));}; \ No newline at end of file +var _0x065e=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopper','key','model','query','filters','intersection','$and','$gt','$lt','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','find','create','body','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','deleted','campaign','membername','user','UserId','deletedat','format','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmContact','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','CmCompany','CmList','List','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash'];(function(_0x1220dc,_0x448145){var _0x264ada=function(_0x171972){while(--_0x171972){_0x1220dc['push'](_0x1220dc['shift']());}};_0x264ada(++_0x448145);}(_0x065e,0x1a7));var _0xe065=function(_0x6edc85,_0x2c7710){_0x6edc85=_0x6edc85-0x0;var _0x4631a9=_0x065e[_0x6edc85];return _0x4631a9;};'use strict';var pdf=require(_0xe065('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe065('0x1'));var rp=require(_0xe065('0x2'));var moment=require(_0xe065('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe065('0x4'));var path=require(_0xe065('0x5'));var sox=require('sox');var csv=require(_0xe065('0x6'));var ejs=require(_0xe065('0x7'));var fs=require('fs');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('0x6'));var querystring=require(_0xe065('0xb'));var Papa=require(_0xe065('0xc'));var Redis=require(_0xe065('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xe'));var as=require(_0xe065('0xf'));var hardwareService=require(_0xe065('0x10'));var logger=require(_0xe065('0x11'))(_0xe065('0x12'));var utils=require(_0xe065('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x14'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x15')](_0xf5ab44);}return _0x13b697[_0xe065('0x16')](_0xf5ab44)[_0xe065('0x17')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x16')](_0x29297b)[_0xe065('0x18')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=_0x434e07[_0xe065('0x19')],_0x2e5feb=_0xc5ef4f['offset'],_0x545100=_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')],_0x1ba88d;if(_0x545100>=_0x352206){_0x545100=_0x352206;_0x1ba88d=0xc8;}else{_0x1ba88d=0xce;}_0x15d365[_0xe065('0x16')](_0x1ba88d);return _0x15d365[_0xe065('0x1c')](_0xe065('0x1d'),_0x2e5feb+'-'+_0x545100+'/'+_0x352206)[_0xe065('0x18')](_0x434e07);}return null;};}function patchUpdates(_0x2ab8ae){return function(_0x5000e1){try{jsonpatch[_0xe065('0x1e')](_0x5000e1,_0x2ab8ae,!![]);}catch(_0x52e9b2){return BPromise[_0xe065('0x1f')](_0x52e9b2);}return _0x5000e1[_0xe065('0x20')]();};}function saveUpdates(_0x55f55c,_0x1c6567){return function(_0x587d47){if(_0x587d47){return _0x587d47[_0xe065('0x21')](_0x55f55c)[_0xe065('0x22')](function(_0x216f26){return _0x216f26;});}return null;};}function removeEntity(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x23')]()[_0xe065('0x22')](function(){_0x110556[_0xe065('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7208af,_0x43b712){return function(_0x44ec95){if(!_0x44ec95){_0x7208af[_0xe065('0x15')](0x194);}return _0x44ec95;};}function handleError(_0x5e8b60,_0x517d53){_0x517d53=_0x517d53||0x1f4;return function(_0x164965){logger['error'](_0x164965[_0xe065('0x24')]);if(_0x164965[_0xe065('0x25')]){delete _0x164965[_0xe065('0x25')];}_0x5e8b60[_0xe065('0x16')](_0x517d53)[_0xe065('0x26')](_0x164965);};}exports[_0xe065('0x27')]=function(_0x3b1caf,_0x26a159){var _0x52cd9c={},_0x58bbd2={},_0x14de01={'count':0x0,'rows':[]};var _0x10e6ba=_[_0xe065('0x28')](db[_0xe065('0x29')]['rawAttributes'],function(_0x23f573){return{'name':_0x23f573['fieldName'],'type':_0x23f573['type'][_0xe065('0x2a')]};});_0x58bbd2[_0xe065('0x2b')]=_[_0xe065('0x28')](_0x10e6ba,'name');_0x58bbd2[_0xe065('0x2c')]=_['keys'](_0x3b1caf[_0xe065('0x2c')]);_0x58bbd2[_0xe065('0x2d')]=_[_0xe065('0x2e')](_0x58bbd2[_0xe065('0x2b')],_0x58bbd2['query']);_0x58bbd2[_0xe065('0x2d')]=_['concat'](_0x58bbd2[_0xe065('0x2d')],[_0xe065('0x2f'),'$or',_0xe065('0x30'),'$gte',_0xe065('0x31'),'$lte',_0xe065('0x32'),_0xe065('0x33'),_0xe065('0x34'),_0xe065('0x35'),'$notBetween',_0xe065('0x36'),_0xe065('0x37'),_0xe065('0x38'),_0xe065('0x39'),_0xe065('0x3a'),_0xe065('0x3b'),'$like',_0xe065('0x3c'),_0xe065('0x3d'),'$contained',_0xe065('0x3e')]);_0x52cd9c[_0xe065('0x3f')]=_[_0xe065('0x2e')](_0x58bbd2[_0xe065('0x2b')],qs[_0xe065('0x40')](_0x3b1caf[_0xe065('0x2c')][_0xe065('0x40')]));_0x52cd9c['attributes']=_0x52cd9c[_0xe065('0x3f')]['length']?_0x52cd9c[_0xe065('0x3f')]:_0x58bbd2[_0xe065('0x2b')];if(!_0x3b1caf[_0xe065('0x2c')][_0xe065('0x41')](_0xe065('0x42'))){_0x52cd9c[_0xe065('0x1b')]=qs['limit'](_0x3b1caf[_0xe065('0x2c')][_0xe065('0x1b')]);_0x52cd9c[_0xe065('0x1a')]=qs['offset'](_0x3b1caf[_0xe065('0x2c')][_0xe065('0x1a')]);}_0x52cd9c[_0xe065('0x43')]=qs[_0xe065('0x44')](_0x3b1caf[_0xe065('0x2c')]['sort']);_0x52cd9c[_0xe065('0x45')]=qs[_0xe065('0x2d')](_['pick'](_0x3b1caf[_0xe065('0x2c')],_0x58bbd2['filters']),_0x10e6ba);if(_0x3b1caf[_0xe065('0x2c')][_0xe065('0x46')]){_0x52cd9c['where']=_[_0xe065('0x47')](_0x52cd9c[_0xe065('0x45')],{'$or':_['map'](_0x10e6ba,function(_0x16b5da){if(_0x16b5da[_0xe065('0x48')]!==_0xe065('0x49')){var _0x44a3f6={};_0x44a3f6[_0x16b5da[_0xe065('0x25')]]={'$like':'%'+_0x3b1caf[_0xe065('0x2c')][_0xe065('0x46')]+'%'};return _0x44a3f6;}})});}_0x52cd9c=_[_0xe065('0x47')]({},_0x52cd9c,_0x3b1caf[_0xe065('0x4a')]);var _0x445738={'where':_0x52cd9c[_0xe065('0x45')]};return db[_0xe065('0x29')][_0xe065('0x19')](_0x445738)['then'](function(_0x5b617a){_0x14de01[_0xe065('0x19')]=_0x5b617a;if(_0x3b1caf[_0xe065('0x2c')]['includeAll']){_0x52cd9c[_0xe065('0x4b')]=[{'all':!![]}];}return db[_0xe065('0x29')][_0xe065('0x4c')](_0x52cd9c);})[_0xe065('0x22')](function(_0x41f123){_0x14de01[_0xe065('0x4d')]=_0x41f123;return _0x14de01;})[_0xe065('0x22')](respondWithFilteredResult(_0x26a159,_0x52cd9c))[_0xe065('0x4e')](handleError(_0x26a159,null));};exports[_0xe065('0x4f')]=function(_0x52073d,_0x2451d4){var _0x161849={'raw':!![],'where':{'id':_0x52073d['params']['id']}},_0x299f96={};_0x299f96[_0xe065('0x2b')]=_[_0xe065('0x50')](db[_0xe065('0x29')][_0xe065('0x51')]);_0x299f96['query']=_[_0xe065('0x50')](_0x52073d[_0xe065('0x2c')]);_0x299f96[_0xe065('0x2d')]=_[_0xe065('0x2e')](_0x299f96[_0xe065('0x2b')],_0x299f96[_0xe065('0x2c')]);_0x161849[_0xe065('0x3f')]=_['intersection'](_0x299f96[_0xe065('0x2b')],qs[_0xe065('0x40')](_0x52073d[_0xe065('0x2c')][_0xe065('0x40')]));_0x161849[_0xe065('0x3f')]=_0x161849[_0xe065('0x3f')][_0xe065('0x52')]?_0x161849['attributes']:_0x299f96[_0xe065('0x2b')];if(_0x52073d['query'][_0xe065('0x53')]){_0x161849[_0xe065('0x4b')]=[{'all':!![]}];}_0x161849=_[_0xe065('0x47')]({},_0x161849,_0x52073d['options']);return db[_0xe065('0x29')][_0xe065('0x54')](_0x161849)[_0xe065('0x22')](handleEntityNotFound(_0x2451d4,null))[_0xe065('0x22')](respondWithResult(_0x2451d4,null))[_0xe065('0x4e')](handleError(_0x2451d4,null));};exports[_0xe065('0x55')]=function(_0x310d28,_0x16335a){return db[_0xe065('0x29')][_0xe065('0x55')](_0x310d28[_0xe065('0x56')],{})[_0xe065('0x22')](respondWithResult(_0x16335a,0xc9))[_0xe065('0x4e')](handleError(_0x16335a,null));};exports['update']=function(_0x4aeea2,_0x584201){if(_0x4aeea2[_0xe065('0x56')]['id']){delete _0x4aeea2['body']['id'];}return db[_0xe065('0x29')][_0xe065('0x54')]({'where':{'id':_0x4aeea2[_0xe065('0x57')]['id']}})['then'](handleEntityNotFound(_0x584201,null))[_0xe065('0x22')](saveUpdates(_0x4aeea2[_0xe065('0x56')],null))['then'](respondWithResult(_0x584201,null))[_0xe065('0x4e')](handleError(_0x584201,null));};exports[_0xe065('0x58')]=function(_0x18c7de,_0x15d40f){return db[_0xe065('0x29')][_0xe065('0x58')]()[_0xe065('0x22')](respondWithResult(_0x15d40f,null))[_0xe065('0x4e')](handleError(_0x15d40f,null));};exports[_0xe065('0x23')]=function(_0x26a770,_0x49a367){var _0x19007e;return db[_0xe065('0x29')][_0xe065('0x54')]({'where':{'id':_0x26a770[_0xe065('0x57')]['id']}})['then'](handleEntityNotFound(_0x49a367,null))[_0xe065('0x22')](function(_0x217309){if(_0x217309){return _0x217309[_0xe065('0x23')]()[_0xe065('0x22')](function(_0x4b2d0a){return _0x4b2d0a;});}})[_0xe065('0x22')](function(_0x38da45){_0x19007e=_0x38da45;if(_0x38da45){if(_0x38da45[_0xe065('0x59')]||_0x38da45['CampaignId']){return db[_0x38da45[_0xe065('0x59')]?_0xe065('0x5a'):_0xe065('0x5b')][_0xe065('0x54')]({'where':{'id':_0x38da45[_0xe065('0x59')]?_0x38da45[_0xe065('0x59')]:_0x38da45[_0xe065('0x5c')]},'attributes':['id',_0xe065('0x25')],'raw':!![]});}}})[_0xe065('0x22')](function(_0x5ec6fe){var _0x2accad={};if(_0x5ec6fe){_['merge'](_0x2accad,_[_0xe065('0x5d')](_0x19007e[_0xe065('0x5e')],[_0xe065('0x5f'),'updatedAt','id']));_0x2accad['state']=0x15;_0x2accad['statedesc']=_0xe065('0x60');_0x2accad[_0xe065('0x61')]=_0x5ec6fe[_0xe065('0x25')];_0x2accad[_0xe065('0x62')]=_0x26a770[_0xe065('0x63')][_0xe065('0x25')];_0x2accad[_0xe065('0x64')]=_0x26a770[_0xe065('0x63')]['id'];_0x2accad[_0xe065('0x60')]=!![];_0x2accad[_0xe065('0x65')]=moment()[_0xe065('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x2accad['calleridnum']=_0x19007e[_0xe065('0x67')];_0x2accad[_0xe065('0x68')]=_0x19007e['VoiceQueueId']?_0xe065('0x69'):'ivr';return db['CmContact'][_0xe065('0x54')]({'where':{'id':_0x2accad[_0xe065('0x6a')]},'attributes':[_0xe065('0x6b'),_0xe065('0x6c')]})[_0xe065('0x22')](function(_0x817baf){if(!_[_0xe065('0x6d')](_0x49a367)&&!_['isNil'](_0x817baf[_0xe065('0x6b')])){_0x2accad[_0xe065('0x6e')]=_0x817baf[_0xe065('0x6b')];if(!_[_0xe065('0x6d')](_0x817baf[_0xe065('0x6c')])){_0x2accad['calleridname']+='\x20'+_0x817baf[_0xe065('0x6c')];}}})[_0xe065('0x6f')](function(){return db[_0xe065('0x70')][_0xe065('0x55')](_0x2accad);});}})[_0xe065('0x22')](function(){return _0x49a367[_0xe065('0x16')](0xcc)['end']();})['catch'](handleError(_0x49a367,null));};exports['getPreview']=function(_0x50f6e9,_0x5c3d7a,_0x2fa994){var _0x45b033=[];return db[_0xe065('0x71')][_0xe065('0x58')]()[_0xe065('0x22')](function(_0x1aeeb1){_0x45b033=_[_0xe065('0x50')](_0x1aeeb1);return _0x50f6e9[_0xe065('0x63')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe065('0x72')},'attributes':['id',_0xe065('0x73')],'raw':!![]});})[_0xe065('0x22')](function(_0x573201){if(_0x573201&&_0x573201[_0xe065('0x52')]){return db[_0xe065('0x74')][_0xe065('0x75')](function(_0x4765a0){var _0x136e40={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe065('0x66')](_0xe065('0x76'))},'VoiceQueueId':{'$in':_[_0xe065('0x28')](_0x573201,'id')},'$or':[{'UserId':null},{'UserId':_0x50f6e9[_0xe065('0x63')]['id']}]};var _0xecef2=[];if(_0x50f6e9[_0xe065('0x56')][_0xe065('0x77')]&&_0x50f6e9[_0xe065('0x56')][_0xe065('0x77')]===_0xe065('0x78')){if(!_[_0xe065('0x79')](_0x50f6e9[_0xe065('0x56')][_0xe065('0x7a')])){_0x136e40['id']={'$in':_0x50f6e9['body'][_0xe065('0x7a')]};}_0xecef2=[[_0xe065('0x7b'),_0xe065('0x7c')],[_0xe065('0x7d'),_0x573201[0x0][_0xe065('0x73')]===_0xe065('0x7c')?_0xe065('0x7e'):_0xe065('0x7c')],db[_0xe065('0x74')][_0xe065('0x7f')](_0xe065('0x80')),['id',_0xe065('0x7e')]];}else{if(!_[_0xe065('0x79')](_0x50f6e9[_0xe065('0x56')][_0xe065('0x7a')])){_0x136e40['id']={'$notIn':_0x50f6e9[_0xe065('0x56')][_0xe065('0x7a')]};}_0xecef2=[['priority',_0xe065('0x7e')],[_0xe065('0x7d'),_0x573201[0x0][_0xe065('0x73')]],db[_0xe065('0x74')][_0xe065('0x7f')](_0xe065('0x81')),['id',_0xe065('0x7c')]];}return db[_0xe065('0x29')][_0xe065('0x82')]({'attributes':['id',_0xe065('0x83')],'where':_0x136e40,'order':_0xecef2,'transaction':_0x4765a0,'lock':_0x4765a0['LOCK']['UPDATE'],'include':[{'model':db[_0xe065('0x71')],'as':'Contact','attributes':_0x45b033,'include':[{'model':db[_0xe065('0x84')],'as':'Company','attributes':['id',_0xe065('0x25')]}]},{'model':db[_0xe065('0x85')],'as':_0xe065('0x86'),'attributes':['id',_0xe065('0x25')]},{'model':db[_0xe065('0x5a')],'as':_0xe065('0x87'),'attributes':['id',_0xe065('0x25'),_0xe065('0x88')]}]})[_0xe065('0x22')](function(_0x48b92c){if(_0x48b92c){return _0x48b92c[_0xe065('0x21')]({'UserId':_0x50f6e9[_0xe065('0x63')]['id']},{'transaction':_0x4765a0});}});});}})[_0xe065('0x22')](handleEntityNotFound(_0x5c3d7a,null))[_0xe065('0x22')](respondWithResult(_0x5c3d7a,null))['catch'](handleError(_0x5c3d7a,null));};exports[_0xe065('0x89')]=function(_0x2fdaae,_0x34d103,_0x4ff8d5){return _0x2fdaae[_0xe065('0x63')][_0xe065('0x8a')]({'where':{'type':_0xe065('0x8b'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xe065('0x22')](function(_0x3834c1){if(_0x3834c1&&_0x3834c1['length']){return db['CmHopper'][_0xe065('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe065('0x66')](_0xe065('0x76'))},'VoiceQueueId':{'$in':_[_0xe065('0x28')](_0x3834c1,'id')},'$or':[{'UserId':null},{'UserId':_0x2fdaae[_0xe065('0x63')]['id']}]}});}return 0x0;})['then'](function(_0x53985a){if(!_[_0xe065('0x6d')](_0x53985a)&&_[_0xe065('0x8c')](_0x53985a)){return _0x34d103['status'](0xc8)[_0xe065('0x18')]({'contacts':_0x53985a});}else{logger[_0xe065('0x8d')](_0xe065('0x8e'),_0xe065('0x89'),0x194,_0xe065('0x8f'));_0x34d103[_0xe065('0x15')](0x194);}})[_0xe065('0x4e')](handleError(_0x34d103,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e2f12a1..25b7128 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 _0x152f=['cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper'];(function(_0x159359,_0x2f1ec2){var _0xa0ef58=function(_0x24ad05){while(--_0x24ad05){_0x159359['push'](_0x159359['shift']());}};_0xa0ef58(++_0x2f1ec2);}(_0x152f,0x125));var _0xf152=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x152f[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0xf152('0x0'));var util=require(_0xf152('0x1'));var logger=require(_0xf152('0x2'))(_0xf152('0x3'));var moment=require('moment');var BPromise=require(_0xf152('0x4'));var rp=require(_0xf152('0x5'));var fs=require('fs');var path=require(_0xf152('0x6'));var rimraf=require(_0xf152('0x7'));var config=require(_0xf152('0x8'));var attributes=require(_0xf152('0x9'));module[_0xf152('0xa')]=function(_0x1c274c,_0x782a99){return _0x1c274c[_0xf152('0xb')](_0xf152('0xc'),attributes,{'tableName':_0xf152('0xd'),'paranoid':![],'indexes':[{'name':_0xf152('0xe'),'fields':[_0xf152('0xe')]},{'name':_0xf152('0xf'),'fields':[_0xf152('0xf')]},{'name':_0xf152('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5515=['path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x390680,_0x44392b){var _0x117c4a=function(_0x48759b){while(--_0x48759b){_0x390680['push'](_0x390680['shift']());}};_0x117c4a(++_0x44392b);}(_0x5515,0x9f));var _0x5551=function(_0x54c8ed,_0x4ff37c){_0x54c8ed=_0x54c8ed-0x0;var _0x5bb93e=_0x5515[_0x54c8ed];return _0x5bb93e;};'use strict';var _=require('lodash');var util=require(_0x5551('0x0'));var logger=require(_0x5551('0x1'))(_0x5551('0x2'));var moment=require(_0x5551('0x3'));var BPromise=require(_0x5551('0x4'));var rp=require(_0x5551('0x5'));var fs=require('fs');var path=require(_0x5551('0x6'));var rimraf=require(_0x5551('0x7'));var config=require(_0x5551('0x8'));var attributes=require(_0x5551('0x9'));module[_0x5551('0xa')]=function(_0x4af3f6,_0x191c2c){return _0x4af3f6[_0x5551('0xb')]('CmHopper',attributes,{'tableName':_0x5551('0xc'),'paranoid':![],'indexes':[{'name':_0x5551('0xd'),'fields':[_0x5551('0xd')]},{'name':'phone','fields':['phone']},{'name':_0x5551('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4001f62..e885e4b 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 _0x0a75=['where','attributes','limit','include','map','model','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','order','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw'];(function(_0x583143,_0x28e170){var _0x1a203e=function(_0x1aeb71){while(--_0x1aeb71){_0x583143['push'](_0x583143['shift']());}};_0x1a203e(++_0x28e170);}(_0x0a75,0xb9));var _0x50a7=function(_0x547bc4,_0x5ce58f){_0x547bc4=_0x547bc4-0x0;var _0x5d5cfd=_0x0a75[_0x547bc4];return _0x5d5cfd;};'use strict';var _=require(_0x50a7('0x0'));var util=require(_0x50a7('0x1'));var moment=require('moment');var BPromise=require(_0x50a7('0x2'));var rs=require(_0x50a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50a7('0x4'))['db'];var utils=require(_0x50a7('0x5'));var logger=require(_0x50a7('0x6'))('rpc');var config=require(_0x50a7('0x7'));var jayson=require(_0x50a7('0x8'));var client=jayson['client'][_0x50a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24f8cb,_0xafbfbd,_0x20ccb9){return new BPromise(function(_0x2a5716,_0x224247){return client[_0x50a7('0xa')](_0x24f8cb,_0x20ccb9)[_0x50a7('0xb')](function(_0x16d7e3){logger[_0x50a7('0xc')](_0x50a7('0xd'),_0xafbfbd,_0x50a7('0xe'));logger[_0x50a7('0xf')](_0x50a7('0x10'),_0xafbfbd,'request\x20sent',JSON[_0x50a7('0x11')](_0x16d7e3));if(_0x16d7e3[_0x50a7('0x12')]){if(_0x16d7e3['error'][_0x50a7('0x13')]===0x1f4){logger['error'](_0x50a7('0xd'),_0xafbfbd,_0x16d7e3[_0x50a7('0x12')][_0x50a7('0x14')]);return _0x224247(_0x16d7e3['error'][_0x50a7('0x14')]);}logger[_0x50a7('0x12')](_0x50a7('0xd'),_0xafbfbd,_0x16d7e3[_0x50a7('0x12')][_0x50a7('0x14')]);return _0x2a5716(_0x16d7e3[_0x50a7('0x12')]['message']);}else{logger[_0x50a7('0xc')](_0x50a7('0xd'),_0xafbfbd,_0x50a7('0xe'));_0x2a5716(_0x16d7e3[_0x50a7('0x15')][_0x50a7('0x14')]);}})[_0x50a7('0x16')](function(_0x5047fc){logger['error'](_0x50a7('0xd'),_0xafbfbd,_0x5047fc);_0x224247(_0x5047fc);});});}exports[_0x50a7('0x17')]=function(_0x196482){var _0x12f868=this;return new Promise(function(_0x4d3264,_0x126f2b){return db[_0x50a7('0x18')][_0x50a7('0x19')]({'raw':_0x196482[_0x50a7('0x1a')]?_0x196482[_0x50a7('0x1a')][_0x50a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x196482[_0x50a7('0x1a')]?_0x196482[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'attributes':_0x196482[_0x50a7('0x1a')]?_0x196482['options'][_0x50a7('0x1d')]||null:null,'limit':_0x196482[_0x50a7('0x1a')]?_0x196482[_0x50a7('0x1a')][_0x50a7('0x1e')]||null:null,'include':_0x196482['options']?_0x196482['options'][_0x50a7('0x1f')]?_[_0x50a7('0x20')](_0x196482[_0x50a7('0x1a')][_0x50a7('0x1f')],function(_0x142ab1){return{'model':db[_0x142ab1[_0x50a7('0x21')]],'as':_0x142ab1['as'],'attributes':_0x142ab1[_0x50a7('0x1d')],'include':_0x142ab1[_0x50a7('0x1f')]?_[_0x50a7('0x20')](_0x142ab1['include'],function(_0x27f0d1){return{'model':db[_0x27f0d1['model']],'as':_0x27f0d1['as'],'attributes':_0x27f0d1[_0x50a7('0x1d')],'include':_0x27f0d1[_0x50a7('0x1f')]?_[_0x50a7('0x20')](_0x27f0d1[_0x50a7('0x1f')],function(_0x4f9e92){return{'model':db[_0x4f9e92[_0x50a7('0x21')]],'as':_0x4f9e92['as'],'attributes':_0x4f9e92[_0x50a7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50a7('0xb')](function(_0x4a121f){logger[_0x50a7('0xc')]('GetCmHopper',_0x196482);logger[_0x50a7('0xf')](_0x50a7('0x17'),_0x196482,JSON[_0x50a7('0x11')](_0x4a121f));_0x4d3264(_0x4a121f);})[_0x50a7('0x16')](function(_0x5980b5){logger['error']('GetCmHopper',_0x5980b5[_0x50a7('0x14')],_0x196482);_0x126f2b(_0x12f868[_0x50a7('0x12')](0x1f4,_0x5980b5[_0x50a7('0x14')]));});});};exports[_0x50a7('0x22')]=function(_0x5722d3){var _0x2617f4=this;return new Promise(function(_0x450431,_0x4de18f){return db[_0x50a7('0x18')][_0x50a7('0x23')]({'raw':_0x5722d3[_0x50a7('0x1a')]?_0x5722d3['options'][_0x50a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5722d3['options']?_0x5722d3[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'attributes':_0x5722d3['options']?_0x5722d3[_0x50a7('0x1a')][_0x50a7('0x1d')]||null:null,'include':_0x5722d3[_0x50a7('0x1a')]?_0x5722d3[_0x50a7('0x1a')][_0x50a7('0x1f')]?_[_0x50a7('0x20')](_0x5722d3[_0x50a7('0x1a')]['include'],function(_0x252df5){return{'model':db[_0x252df5[_0x50a7('0x21')]],'as':_0x252df5['as'],'attributes':_0x252df5[_0x50a7('0x1d')],'include':_0x252df5['include']?_[_0x50a7('0x20')](_0x252df5[_0x50a7('0x1f')],function(_0x5b5b60){return{'model':db[_0x5b5b60['model']],'as':_0x5b5b60['as'],'attributes':_0x5b5b60[_0x50a7('0x1d')],'include':_0x5b5b60[_0x50a7('0x1f')]?_['map'](_0x5b5b60[_0x50a7('0x1f')],function(_0x59be19){return{'model':db[_0x59be19[_0x50a7('0x21')]],'as':_0x59be19['as'],'attributes':_0x59be19['attributes']};}):[]};}):[]};}):[]:[]})[_0x50a7('0xb')](function(_0x3ebca5){logger[_0x50a7('0xc')]('ShowCmHopper',_0x5722d3);logger['debug'](_0x50a7('0x22'),_0x5722d3,JSON[_0x50a7('0x11')](_0x3ebca5));_0x450431(_0x3ebca5);})[_0x50a7('0x16')](function(_0x347174){logger['error'](_0x50a7('0x22'),_0x347174[_0x50a7('0x14')],_0x5722d3);_0x4de18f(_0x2617f4[_0x50a7('0x12')](0x1f4,_0x347174[_0x50a7('0x14')]));});});};exports['CreateCmHopper']=function(_0x53cb44){var _0x5bbc1e=this;return new Promise(function(_0x28745d,_0x1e65ad){return db[_0x50a7('0x18')][_0x50a7('0x24')](_0x53cb44[_0x50a7('0x25')],{'raw':_0x53cb44['options']?_0x53cb44[_0x50a7('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x50a7('0xb')](function(_0x32f836){logger[_0x50a7('0xc')](_0x50a7('0x26'),_0x53cb44);logger[_0x50a7('0xf')](_0x50a7('0x26'),_0x53cb44,JSON[_0x50a7('0x11')](_0x32f836));_0x28745d(_0x32f836);})[_0x50a7('0x16')](function(_0x10b4a8){logger[_0x50a7('0x12')](_0x50a7('0x26'),_0x10b4a8[_0x50a7('0x14')],_0x53cb44);_0x1e65ad(_0x5bbc1e[_0x50a7('0x12')](0x1f4,_0x10b4a8['message']));});});};exports[_0x50a7('0x27')]=function(_0x2ca6f2){var _0x45570c=this;return new Promise(function(_0x1d4f85,_0xbe1689){return db[_0x50a7('0x18')][_0x50a7('0x28')](_0x2ca6f2[_0x50a7('0x25')],{'raw':_0x2ca6f2[_0x50a7('0x1a')]?_0x2ca6f2[_0x50a7('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca6f2['options']?_0x2ca6f2[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'attributes':_0x2ca6f2[_0x50a7('0x1a')]?_0x2ca6f2['options'][_0x50a7('0x1d')]||null:null,'limit':_0x2ca6f2['options']?_0x2ca6f2[_0x50a7('0x1a')][_0x50a7('0x1e')]||null:null})[_0x50a7('0xb')](function(_0x2287d2){logger['info'](_0x50a7('0x27'),_0x2ca6f2);logger[_0x50a7('0xf')](_0x50a7('0x27'),_0x2ca6f2,JSON[_0x50a7('0x11')](_0x2287d2));_0x1d4f85(_0x2287d2);})[_0x50a7('0x16')](function(_0x119fd0){logger[_0x50a7('0x12')](_0x50a7('0x27'),_0x119fd0[_0x50a7('0x14')],_0x2ca6f2);_0xbe1689(_0x45570c[_0x50a7('0x12')](0x1f4,_0x119fd0[_0x50a7('0x14')]));});});};exports['DestroyCmHopper']=function(_0x7e8ef8){var _0xede8ab=this;return new Promise(function(_0x7c5c8,_0x8f0f88){return db['CmHopper'][_0x50a7('0x29')]({'where':_0x7e8ef8[_0x50a7('0x1a')]?_0x7e8ef8[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null})[_0x50a7('0xb')](function(_0x59996d){logger[_0x50a7('0xc')](_0x50a7('0x2a'),_0x7e8ef8);logger['debug']('DestroyCmHopper',_0x7e8ef8,JSON['stringify'](_0x59996d));_0x7c5c8(_0x59996d);})[_0x50a7('0x16')](function(_0x4b574d){logger[_0x50a7('0x12')]('DestroyCmHopper',_0x4b574d['message'],_0x7e8ef8);_0x8f0f88(_0xede8ab[_0x50a7('0x12')](0x1f4,_0x4b574d[_0x50a7('0x14')]));});});};exports[_0x50a7('0x2b')]=function(_0x5e9e74){var _0x255c9a=this;return new Promise(function(_0x593757,_0x32a00a){return db[_0x50a7('0x2c')][_0x50a7('0x2d')]()[_0x50a7('0xb')](function(_0x20b182){return db['sequelize']['transaction'](function(_0x2dbf24){return db[_0x50a7('0x18')][_0x50a7('0x19')]({'where':_0x5e9e74[_0x50a7('0x1a')]?_0x5e9e74[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'attributes':_0x5e9e74[_0x50a7('0x1a')]?_0x5e9e74[_0x50a7('0x1a')][_0x50a7('0x1d')]||null:null,'limit':_0x5e9e74['options']?_0x5e9e74[_0x50a7('0x1a')]['limit']||null:null,'order':_0x5e9e74[_0x50a7('0x1a')]?_0x5e9e74[_0x50a7('0x1a')]['order']||null:null,'transaction':_0x2dbf24,'lock':_0x2dbf24[_0x50a7('0x2e')][_0x50a7('0x2f')],'include':[{'model':db['CmContact'],'as':_0x50a7('0x30'),'attributes':_[_0x50a7('0x31')](_0x20b182)},{'model':db[_0x50a7('0x32')],'as':_0x50a7('0x33'),'attributes':['id',_0x50a7('0x34'),_0x50a7('0x35')]}]})[_0x50a7('0xb')](function(_0x183e6e){var _0x1e690a=[];var _0x1360ef=[];for(var _0x42748e=0x0;_0x42748e<_0x183e6e[_0x50a7('0x36')];_0x42748e+=0x1){if(!_0x1360ef['includes'](_0x183e6e[_0x42748e][_0x50a7('0x37')])){_0x1360ef['push'](_0x183e6e[_0x42748e][_0x50a7('0x37')]);_0x1e690a[_0x50a7('0x38')](_0x183e6e[_0x42748e]['update'](_0x5e9e74[_0x50a7('0x25')],{'transaction':_0x2dbf24}));}}return BPromise[_0x50a7('0x39')](_0x1e690a);});})['then'](function(_0xd467de){logger[_0x50a7('0xc')]('GetContactDialer',_0x5e9e74);logger['debug'](_0x50a7('0x2b'),_0x5e9e74,JSON[_0x50a7('0x11')](_0xd467de));_0x593757(_0xd467de);})[_0x50a7('0x16')](function(_0x1051c7){logger['error'](_0x50a7('0x2b'),_0x1051c7[_0x50a7('0x14')],_0x5e9e74);_0x32a00a(_0x255c9a[_0x50a7('0x12')](0x1f4,_0x1051c7[_0x50a7('0x14')]));});});});};exports[_0x50a7('0x3a')]=function(_0x269f99){var _0x1d9c85=this;return new Promise(function(_0x49e7a9,_0x585bb0){return db[_0x50a7('0x3b')][_0x50a7('0x3c')](function(_0x37ff3f){return db[_0x50a7('0x3d')][_0x50a7('0x24')](_0x269f99[_0x50a7('0x25')],{'raw':_0x269f99[_0x50a7('0x1a')]?_0x269f99[_0x50a7('0x1a')][_0x50a7('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x37ff3f})[_0x50a7('0xb')](function(){return db[_0x50a7('0x18')][_0x50a7('0x29')]({'where':_0x269f99[_0x50a7('0x1a')]?_0x269f99[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'transaction':_0x37ff3f});});})[_0x50a7('0xb')](function(_0x16cb2f){logger[_0x50a7('0xc')](_0x50a7('0x3a'),_0x269f99);logger[_0x50a7('0xf')]('MoveContactManagedDialer',_0x269f99,JSON[_0x50a7('0x11')](_0x16cb2f));_0x49e7a9(_0x16cb2f);})[_0x50a7('0x16')](function(_0x4de4b8){logger[_0x50a7('0x12')](_0x50a7('0x3a'),_0x4de4b8[_0x50a7('0x14')],_0x269f99);_0x585bb0(_0x1d9c85['error'](0x1f4,_0x4de4b8['message']));});});};exports['CountReScheduled']=function(_0x5d10f6){var _0x417ff2=this;return new Promise(function(_0x4c046c,_0xc4628){return db[_0x50a7('0x18')]['findAll']({'raw':_0x5d10f6[_0x50a7('0x1a')]?_0x5d10f6[_0x50a7('0x1a')][_0x50a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d10f6['options']?_0x5d10f6[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x50a7('0x3e'),db[_0x50a7('0x3b')]['fn']('IF',db['sequelize'][_0x50a7('0x3f')](_0x50a7('0x40')+util['format']('\x22%s\x22',moment()[_0x50a7('0x41')](_0x50a7('0x42')))+_0x50a7('0x43')))),'contactsRescheduled']]})[_0x50a7('0xb')](function(_0x350954){logger['info'](_0x50a7('0x44'),_0x5d10f6);logger['debug'](_0x50a7('0x44'),_0x5d10f6,JSON[_0x50a7('0x11')](_0x350954));_0x4c046c(_0x350954);})[_0x50a7('0x16')](function(_0x33c3e2){logger[_0x50a7('0x12')](_0x50a7('0x44'),_0x33c3e2[_0x50a7('0x14')],_0x5d10f6);_0xc4628(_0x417ff2[_0x50a7('0x12')](0x1f4,_0x33c3e2['message']));});});};exports[_0x50a7('0x45')]=function(_0x3c9dca){var _0x4ccf13=this;return new Promise(function(_0x53d6e0,_0x1c78ca){return db[_0x50a7('0x2c')][_0x50a7('0x2d')]()[_0x50a7('0xb')](function(_0x1082c1){return db['sequelize'][_0x50a7('0x3c')](function(_0x3ae5b9){return db[_0x50a7('0x18')][_0x50a7('0x19')]({'where':_0x3c9dca[_0x50a7('0x1a')]?_0x3c9dca[_0x50a7('0x1a')][_0x50a7('0x1c')]||null:null,'attributes':_0x3c9dca[_0x50a7('0x1a')]?_0x3c9dca['options'][_0x50a7('0x1d')]||null:null,'limit':0x1,'order':_0x3c9dca[_0x50a7('0x1a')]?_0x3c9dca['options'][_0x50a7('0x46')]||null:null,'group':db['CmHopper'][_0x50a7('0x37')],'transaction':_0x3ae5b9,'lock':_0x3ae5b9[_0x50a7('0x2e')][_0x50a7('0x2f')],'include':_0x3c9dca['options']?_0x3c9dca[_0x50a7('0x1a')]['include']?_['map'](_0x3c9dca['options'][_0x50a7('0x1f')],function(_0x411a1e){return{'model':db[_0x411a1e[_0x50a7('0x21')]],'as':_0x411a1e['as'],'attributes':_0x411a1e[_0x50a7('0x1d')],'include':_0x411a1e['include']?_[_0x50a7('0x20')](_0x411a1e[_0x50a7('0x1f')],function(_0x377125){return{'model':db[_0x377125[_0x50a7('0x21')]],'as':_0x377125['as'],'attributes':_0x377125['attributes'],'include':_0x377125['include']?_[_0x50a7('0x20')](_0x377125[_0x50a7('0x1f')],function(_0x148601){return{'model':db[_0x148601[_0x50a7('0x21')]],'as':_0x148601['as'],'attributes':_0x148601[_0x50a7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50a7('0xb')](function(_0xa88ed){var _0x386159=[];for(var _0x419332=0x0;_0x419332<_0xa88ed[_0x50a7('0x36')];_0x419332+=0x1){_0x386159[_0x50a7('0x38')](_0xa88ed[_0x419332][_0x50a7('0x28')](_0x3c9dca['body'],{'transaction':_0x3ae5b9}));}return BPromise['all'](_0x386159);});})[_0x50a7('0xb')](function(_0x28892a){logger[_0x50a7('0xc')]('GetContactRecallMe',_0x3c9dca);logger[_0x50a7('0xf')](_0x50a7('0x45'),_0x3c9dca,JSON['stringify'](_0x28892a));_0x53d6e0(_0x28892a);})[_0x50a7('0x16')](function(_0x57171a){logger['error'](_0x50a7('0x45'),_0x57171a[_0x50a7('0x14')],_0x3c9dca);_0x1c78ca(_0x4ccf13['error'](0x1f4,_0x57171a[_0x50a7('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x1a8b52){var _0x5b1035=this;return new Promise(function(_0x2b2210,_0x3d65f1){db[_0x50a7('0x2c')]['describe']()[_0x50a7('0xb')](function(_0x253ddb){return db[_0x50a7('0x18')][_0x50a7('0x19')]({'raw':_0x1a8b52[_0x50a7('0x1a')]?_0x1a8b52[_0x50a7('0x1a')][_0x50a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a8b52['options']?_0x1a8b52[_0x50a7('0x1a')]['where']||null:null,'attributes':_0x1a8b52['options']?_0x1a8b52[_0x50a7('0x1a')][_0x50a7('0x1d')]||null:null,'limit':_0x1a8b52[_0x50a7('0x1a')]?_0x1a8b52[_0x50a7('0x1a')][_0x50a7('0x1e')]||null:null,'include':_0x1a8b52['options']?_0x1a8b52[_0x50a7('0x1a')][_0x50a7('0x1f')]?_[_0x50a7('0x20')](_0x1a8b52['options'][_0x50a7('0x1f')],function(_0x33fc71){return{'model':db[_0x33fc71['model']],'as':_0x33fc71['as'],'attributes':_0x33fc71['as']===_0x50a7('0x30')?_[_0x50a7('0x31')](_0x253ddb):_0x33fc71['attributes'],'include':_0x33fc71[_0x50a7('0x1f')]?_['map'](_0x33fc71[_0x50a7('0x1f')],function(_0x561226){return{'model':db[_0x561226['model']],'as':_0x561226['as'],'attributes':_0x561226[_0x50a7('0x1d')],'include':_0x561226['include']?_[_0x50a7('0x20')](_0x561226['include'],function(_0x14fdab){return{'model':db[_0x14fdab[_0x50a7('0x21')]],'as':_0x14fdab['as'],'attributes':_0x14fdab['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x512837){logger[_0x50a7('0xc')](_0x50a7('0x17'),_0x1a8b52);logger['debug'](_0x50a7('0x17'),_0x1a8b52,JSON[_0x50a7('0x11')](_0x512837));_0x2b2210(_0x512837);})[_0x50a7('0x16')](function(_0x2cc075){logger[_0x50a7('0x12')]('GetCmHopper',_0x2cc075[_0x50a7('0x14')],_0x1a8b52);_0x3d65f1(_0x5b1035[_0x50a7('0x12')](0x1f4,_0x2cc075[_0x50a7('0x14')]));});});});}; \ No newline at end of file +var _0x4167=['keys','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','find','raw','create','CreateCmHopper','UpdateCmHopper','body','DestroyCmHopper','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','length','UserId','push','all','GetContactDialer','MoveContactManagedDialer','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','describe','update'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x4167,0x8b));var _0x7416=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4167[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7416('0x0'));var util=require(_0x7416('0x1'));var moment=require('moment');var BPromise=require(_0x7416('0x2'));var rs=require(_0x7416('0x3'));var fs=require('fs');var Redis=require(_0x7416('0x4'));var db=require(_0x7416('0x5'))['db'];var utils=require(_0x7416('0x6'));var logger=require(_0x7416('0x7'))('rpc');var config=require(_0x7416('0x8'));var jayson=require(_0x7416('0x9'));var client=jayson[_0x7416('0xa')][_0x7416('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x276cb5,_0x387955,_0x1395be){return new BPromise(function(_0x4f34e8,_0x2966e9){return client[_0x7416('0xc')](_0x276cb5,_0x1395be)[_0x7416('0xd')](function(_0x1953cc){logger[_0x7416('0xe')]('CmHopper,\x20%s,\x20%s',_0x387955,_0x7416('0xf'));logger[_0x7416('0x10')](_0x7416('0x11'),_0x387955,_0x7416('0xf'),JSON[_0x7416('0x12')](_0x1953cc));if(_0x1953cc[_0x7416('0x13')]){if(_0x1953cc[_0x7416('0x13')][_0x7416('0x14')]===0x1f4){logger[_0x7416('0x13')](_0x7416('0x15'),_0x387955,_0x1953cc['error'][_0x7416('0x16')]);return _0x2966e9(_0x1953cc['error']['message']);}logger[_0x7416('0x13')]('CmHopper,\x20%s,\x20%s',_0x387955,_0x1953cc[_0x7416('0x13')][_0x7416('0x16')]);return _0x4f34e8(_0x1953cc[_0x7416('0x13')][_0x7416('0x16')]);}else{logger[_0x7416('0xe')](_0x7416('0x15'),_0x387955,'request\x20sent');_0x4f34e8(_0x1953cc[_0x7416('0x17')]['message']);}})[_0x7416('0x18')](function(_0x56bdd2){logger[_0x7416('0x13')](_0x7416('0x15'),_0x387955,_0x56bdd2);_0x2966e9(_0x56bdd2);});});}exports[_0x7416('0x19')]=function(_0x2380b9){var _0x2f09d1=this;return new Promise(function(_0x2234e0,_0x4fbfdf){return db[_0x7416('0x1a')][_0x7416('0x1b')]({'raw':_0x2380b9[_0x7416('0x1c')]?_0x2380b9[_0x7416('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2380b9['options']?_0x2380b9[_0x7416('0x1c')][_0x7416('0x1d')]||null:null,'attributes':_0x2380b9[_0x7416('0x1c')]?_0x2380b9[_0x7416('0x1c')][_0x7416('0x1e')]||null:null,'limit':_0x2380b9[_0x7416('0x1c')]?_0x2380b9[_0x7416('0x1c')][_0x7416('0x1f')]||null:null,'include':_0x2380b9[_0x7416('0x1c')]?_0x2380b9[_0x7416('0x1c')][_0x7416('0x20')]?_[_0x7416('0x21')](_0x2380b9[_0x7416('0x1c')][_0x7416('0x20')],function(_0x3c0fe4){return{'model':db[_0x3c0fe4[_0x7416('0x22')]],'as':_0x3c0fe4['as'],'attributes':_0x3c0fe4[_0x7416('0x1e')],'include':_0x3c0fe4[_0x7416('0x20')]?_[_0x7416('0x21')](_0x3c0fe4[_0x7416('0x20')],function(_0x40f770){return{'model':db[_0x40f770[_0x7416('0x22')]],'as':_0x40f770['as'],'attributes':_0x40f770[_0x7416('0x1e')],'include':_0x40f770[_0x7416('0x20')]?_[_0x7416('0x21')](_0x40f770[_0x7416('0x20')],function(_0x109238){return{'model':db[_0x109238[_0x7416('0x22')]],'as':_0x109238['as'],'attributes':_0x109238[_0x7416('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7416('0xd')](function(_0x416497){logger['info'](_0x7416('0x19'),_0x2380b9);logger['debug']('GetCmHopper',_0x2380b9,JSON[_0x7416('0x12')](_0x416497));_0x2234e0(_0x416497);})[_0x7416('0x18')](function(_0x28e57b){logger[_0x7416('0x13')](_0x7416('0x19'),_0x28e57b[_0x7416('0x16')],_0x2380b9);_0x4fbfdf(_0x2f09d1['error'](0x1f4,_0x28e57b['message']));});});};exports[_0x7416('0x23')]=function(_0x1e50d5){var _0x2dfe27=this;return new Promise(function(_0x3c24fc,_0xf7ab02){return db[_0x7416('0x1a')][_0x7416('0x24')]({'raw':_0x1e50d5[_0x7416('0x1c')]?_0x1e50d5['options'][_0x7416('0x25')]===undefined?!![]:![]:!![],'where':_0x1e50d5[_0x7416('0x1c')]?_0x1e50d5[_0x7416('0x1c')][_0x7416('0x1d')]||null:null,'attributes':_0x1e50d5['options']?_0x1e50d5[_0x7416('0x1c')]['attributes']||null:null,'include':_0x1e50d5['options']?_0x1e50d5[_0x7416('0x1c')][_0x7416('0x20')]?_[_0x7416('0x21')](_0x1e50d5[_0x7416('0x1c')][_0x7416('0x20')],function(_0x33993c){return{'model':db[_0x33993c['model']],'as':_0x33993c['as'],'attributes':_0x33993c['attributes'],'include':_0x33993c[_0x7416('0x20')]?_['map'](_0x33993c['include'],function(_0x5a31fa){return{'model':db[_0x5a31fa['model']],'as':_0x5a31fa['as'],'attributes':_0x5a31fa[_0x7416('0x1e')],'include':_0x5a31fa[_0x7416('0x20')]?_[_0x7416('0x21')](_0x5a31fa['include'],function(_0x4c89ee){return{'model':db[_0x4c89ee[_0x7416('0x22')]],'as':_0x4c89ee['as'],'attributes':_0x4c89ee[_0x7416('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7416('0xd')](function(_0x5d2838){logger['info'](_0x7416('0x23'),_0x1e50d5);logger['debug'](_0x7416('0x23'),_0x1e50d5,JSON[_0x7416('0x12')](_0x5d2838));_0x3c24fc(_0x5d2838);})[_0x7416('0x18')](function(_0x278dda){logger['error']('ShowCmHopper',_0x278dda[_0x7416('0x16')],_0x1e50d5);_0xf7ab02(_0x2dfe27[_0x7416('0x13')](0x1f4,_0x278dda['message']));});});};exports['CreateCmHopper']=function(_0x34d4d6){var _0x4de4b8=this;return new Promise(function(_0xf0dbaa,_0x5edc65){return db[_0x7416('0x1a')][_0x7416('0x26')](_0x34d4d6['body'],{'raw':_0x34d4d6['options']?_0x34d4d6['options'][_0x7416('0x25')]===undefined?!![]:![]:!![]})['then'](function(_0x13556a){logger[_0x7416('0xe')](_0x7416('0x27'),_0x34d4d6);logger['debug']('CreateCmHopper',_0x34d4d6,JSON[_0x7416('0x12')](_0x13556a));_0xf0dbaa(_0x13556a);})['catch'](function(_0x14d1a8){logger[_0x7416('0x13')](_0x7416('0x27'),_0x14d1a8[_0x7416('0x16')],_0x34d4d6);_0x5edc65(_0x4de4b8[_0x7416('0x13')](0x1f4,_0x14d1a8[_0x7416('0x16')]));});});};exports[_0x7416('0x28')]=function(_0x256e17){var _0x19e145=this;return new Promise(function(_0x18fad7,_0xabff29){return db['CmHopper']['update'](_0x256e17[_0x7416('0x29')],{'raw':_0x256e17['options']?_0x256e17[_0x7416('0x1c')][_0x7416('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x256e17[_0x7416('0x1c')]?_0x256e17['options'][_0x7416('0x1d')]||null:null,'attributes':_0x256e17[_0x7416('0x1c')]?_0x256e17[_0x7416('0x1c')][_0x7416('0x1e')]||null:null,'limit':_0x256e17[_0x7416('0x1c')]?_0x256e17['options'][_0x7416('0x1f')]||null:null})[_0x7416('0xd')](function(_0x3e2704){logger['info'](_0x7416('0x28'),_0x256e17);logger[_0x7416('0x10')](_0x7416('0x28'),_0x256e17,JSON['stringify'](_0x3e2704));_0x18fad7(_0x3e2704);})[_0x7416('0x18')](function(_0x4f6f4b){logger['error'](_0x7416('0x28'),_0x4f6f4b[_0x7416('0x16')],_0x256e17);_0xabff29(_0x19e145[_0x7416('0x13')](0x1f4,_0x4f6f4b[_0x7416('0x16')]));});});};exports[_0x7416('0x2a')]=function(_0x4dafcc){var _0x4a75e1=this;return new Promise(function(_0x42ad62,_0x2e9b3f){return db[_0x7416('0x1a')]['destroy']({'where':_0x4dafcc[_0x7416('0x1c')]?_0x4dafcc[_0x7416('0x1c')][_0x7416('0x1d')]||null:null})['then'](function(_0x5521b1){logger[_0x7416('0xe')](_0x7416('0x2a'),_0x4dafcc);logger['debug'](_0x7416('0x2a'),_0x4dafcc,JSON[_0x7416('0x12')](_0x5521b1));_0x42ad62(_0x5521b1);})[_0x7416('0x18')](function(_0x4e80b3){logger['error'](_0x7416('0x2a'),_0x4e80b3[_0x7416('0x16')],_0x4dafcc);_0x2e9b3f(_0x4a75e1[_0x7416('0x13')](0x1f4,_0x4e80b3[_0x7416('0x16')]));});});};exports['GetContactDialer']=function(_0x588d49){var _0x115b14=this;return new Promise(function(_0x253069,_0x7db6a5){return db[_0x7416('0x2b')]['describe']()[_0x7416('0xd')](function(_0x40448f){return db[_0x7416('0x2c')][_0x7416('0x2d')](function(_0x3dca52){return db[_0x7416('0x1a')]['findAll']({'where':_0x588d49[_0x7416('0x1c')]?_0x588d49['options'][_0x7416('0x1d')]||null:null,'attributes':_0x588d49[_0x7416('0x1c')]?_0x588d49[_0x7416('0x1c')][_0x7416('0x1e')]||null:null,'limit':_0x588d49[_0x7416('0x1c')]?_0x588d49['options'][_0x7416('0x1f')]||null:null,'order':_0x588d49[_0x7416('0x1c')]?_0x588d49['options'][_0x7416('0x2e')]||null:null,'transaction':_0x3dca52,'lock':_0x3dca52[_0x7416('0x2f')][_0x7416('0x30')],'include':[{'model':db[_0x7416('0x2b')],'as':_0x7416('0x31'),'attributes':_['keys'](_0x40448f)},{'model':db[_0x7416('0x32')],'as':_0x7416('0x33'),'attributes':['id','name','voicePause']}]})[_0x7416('0xd')](function(_0x4fa289){var _0x57947c=[];var _0x2bcf43=[];for(var _0x2a9282=0x0;_0x2a9282<_0x4fa289[_0x7416('0x34')];_0x2a9282+=0x1){if(!_0x2bcf43['includes'](_0x4fa289[_0x2a9282][_0x7416('0x35')])){_0x2bcf43[_0x7416('0x36')](_0x4fa289[_0x2a9282][_0x7416('0x35')]);_0x57947c[_0x7416('0x36')](_0x4fa289[_0x2a9282]['update'](_0x588d49[_0x7416('0x29')],{'transaction':_0x3dca52}));}}return BPromise[_0x7416('0x37')](_0x57947c);});})[_0x7416('0xd')](function(_0x1c152a){logger['info'](_0x7416('0x38'),_0x588d49);logger[_0x7416('0x10')]('GetContactDialer',_0x588d49,JSON['stringify'](_0x1c152a));_0x253069(_0x1c152a);})[_0x7416('0x18')](function(_0x3356e7){logger[_0x7416('0x13')](_0x7416('0x38'),_0x3356e7['message'],_0x588d49);_0x7db6a5(_0x115b14[_0x7416('0x13')](0x1f4,_0x3356e7[_0x7416('0x16')]));});});});};exports[_0x7416('0x39')]=function(_0x510844){var _0x199788=this;return new Promise(function(_0x3b9b2f,_0x3893c4){return db[_0x7416('0x2c')]['transaction'](function(_0x47d952){return db['CmHopperFinal'][_0x7416('0x26')](_0x510844[_0x7416('0x29')],{'raw':_0x510844[_0x7416('0x1c')]?_0x510844[_0x7416('0x1c')][_0x7416('0x25')]===undefined?!![]:![]:!![],'transaction':_0x47d952})[_0x7416('0xd')](function(){return db[_0x7416('0x1a')]['destroy']({'where':_0x510844[_0x7416('0x1c')]?_0x510844[_0x7416('0x1c')][_0x7416('0x1d')]||null:null,'transaction':_0x47d952});});})[_0x7416('0xd')](function(_0x32dbe1){logger[_0x7416('0xe')](_0x7416('0x39'),_0x510844);logger[_0x7416('0x10')](_0x7416('0x39'),_0x510844,JSON[_0x7416('0x12')](_0x32dbe1));_0x3b9b2f(_0x32dbe1);})[_0x7416('0x18')](function(_0x261d45){logger['error'](_0x7416('0x39'),_0x261d45['message'],_0x510844);_0x3893c4(_0x199788[_0x7416('0x13')](0x1f4,_0x261d45['message']));});});};exports['CountReScheduled']=function(_0x3d93c5){var _0x5b9955=this;return new Promise(function(_0x28e3ac,_0x4ca8e7){return db[_0x7416('0x1a')][_0x7416('0x1b')]({'raw':_0x3d93c5['options']?_0x3d93c5[_0x7416('0x1c')][_0x7416('0x25')]===undefined?!![]:![]:!![],'where':_0x3d93c5['options']?_0x3d93c5[_0x7416('0x1c')][_0x7416('0x1d')]||null:null,'attributes':[[db[_0x7416('0x2c')]['fn']('COUNT',db[_0x7416('0x2c')]['fn']('IF',db[_0x7416('0x2c')]['literal'](_0x7416('0x3a')+util[_0x7416('0x3b')](_0x7416('0x3c'),moment()['format'](_0x7416('0x3d')))+_0x7416('0x3e')))),_0x7416('0x3f')]]})['then'](function(_0xa3322a){logger[_0x7416('0xe')]('CountReScheduled',_0x3d93c5);logger[_0x7416('0x10')](_0x7416('0x40'),_0x3d93c5,JSON['stringify'](_0xa3322a));_0x28e3ac(_0xa3322a);})[_0x7416('0x18')](function(_0x1c702f){logger['error'](_0x7416('0x40'),_0x1c702f[_0x7416('0x16')],_0x3d93c5);_0x4ca8e7(_0x5b9955['error'](0x1f4,_0x1c702f[_0x7416('0x16')]));});});};exports[_0x7416('0x41')]=function(_0x4be89b){var _0x545536=this;return new Promise(function(_0x9f857f,_0x3a4fc6){return db[_0x7416('0x2b')][_0x7416('0x42')]()[_0x7416('0xd')](function(_0x5e7c54){return db[_0x7416('0x2c')][_0x7416('0x2d')](function(_0x13b763){return db['CmHopper'][_0x7416('0x1b')]({'where':_0x4be89b['options']?_0x4be89b[_0x7416('0x1c')][_0x7416('0x1d')]||null:null,'attributes':_0x4be89b[_0x7416('0x1c')]?_0x4be89b[_0x7416('0x1c')]['attributes']||null:null,'limit':0x1,'order':_0x4be89b[_0x7416('0x1c')]?_0x4be89b[_0x7416('0x1c')][_0x7416('0x2e')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x13b763,'lock':_0x13b763['LOCK'][_0x7416('0x30')],'include':_0x4be89b[_0x7416('0x1c')]?_0x4be89b[_0x7416('0x1c')][_0x7416('0x20')]?_[_0x7416('0x21')](_0x4be89b[_0x7416('0x1c')][_0x7416('0x20')],function(_0x3899f2){return{'model':db[_0x3899f2['model']],'as':_0x3899f2['as'],'attributes':_0x3899f2[_0x7416('0x1e')],'include':_0x3899f2['include']?_['map'](_0x3899f2[_0x7416('0x20')],function(_0x2859a8){return{'model':db[_0x2859a8['model']],'as':_0x2859a8['as'],'attributes':_0x2859a8[_0x7416('0x1e')],'include':_0x2859a8[_0x7416('0x20')]?_[_0x7416('0x21')](_0x2859a8[_0x7416('0x20')],function(_0x2a49a9){return{'model':db[_0x2a49a9[_0x7416('0x22')]],'as':_0x2a49a9['as'],'attributes':_0x2a49a9[_0x7416('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa19cb){var _0x41cb02=[];for(var _0x310a12=0x0;_0x310a12<_0xa19cb['length'];_0x310a12+=0x1){_0x41cb02[_0x7416('0x36')](_0xa19cb[_0x310a12][_0x7416('0x43')](_0x4be89b[_0x7416('0x29')],{'transaction':_0x13b763}));}return BPromise[_0x7416('0x37')](_0x41cb02);});})[_0x7416('0xd')](function(_0x1d7d9f){logger[_0x7416('0xe')]('GetContactRecallMe',_0x4be89b);logger[_0x7416('0x10')](_0x7416('0x41'),_0x4be89b,JSON[_0x7416('0x12')](_0x1d7d9f));_0x9f857f(_0x1d7d9f);})[_0x7416('0x18')](function(_0x16ae0b){logger[_0x7416('0x13')](_0x7416('0x41'),_0x16ae0b[_0x7416('0x16')],_0x4be89b);_0x3a4fc6(_0x545536[_0x7416('0x13')](0x1f4,_0x16ae0b[_0x7416('0x16')]));});});});};exports['GetCmHopperPreview']=function(_0x3abd17){var _0x5f558c=this;return new Promise(function(_0x10d525,_0x4b872e){db[_0x7416('0x2b')][_0x7416('0x42')]()[_0x7416('0xd')](function(_0x2d1c25){return db[_0x7416('0x1a')]['findAll']({'raw':_0x3abd17[_0x7416('0x1c')]?_0x3abd17[_0x7416('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3abd17['options']?_0x3abd17[_0x7416('0x1c')][_0x7416('0x1d')]||null:null,'attributes':_0x3abd17['options']?_0x3abd17[_0x7416('0x1c')][_0x7416('0x1e')]||null:null,'limit':_0x3abd17[_0x7416('0x1c')]?_0x3abd17[_0x7416('0x1c')]['limit']||null:null,'include':_0x3abd17['options']?_0x3abd17[_0x7416('0x1c')][_0x7416('0x20')]?_[_0x7416('0x21')](_0x3abd17[_0x7416('0x1c')][_0x7416('0x20')],function(_0x2537dd){return{'model':db[_0x2537dd['model']],'as':_0x2537dd['as'],'attributes':_0x2537dd['as']===_0x7416('0x31')?_[_0x7416('0x44')](_0x2d1c25):_0x2537dd[_0x7416('0x1e')],'include':_0x2537dd[_0x7416('0x20')]?_[_0x7416('0x21')](_0x2537dd[_0x7416('0x20')],function(_0x2c6fd6){return{'model':db[_0x2c6fd6['model']],'as':_0x2c6fd6['as'],'attributes':_0x2c6fd6[_0x7416('0x1e')],'include':_0x2c6fd6['include']?_[_0x7416('0x21')](_0x2c6fd6[_0x7416('0x20')],function(_0x440cf7){return{'model':db[_0x440cf7[_0x7416('0x22')]],'as':_0x440cf7['as'],'attributes':_0x440cf7[_0x7416('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7416('0xd')](function(_0x2486be){logger[_0x7416('0xe')]('GetCmHopper',_0x3abd17);logger['debug'](_0x7416('0x19'),_0x3abd17,JSON[_0x7416('0x12')](_0x2486be));_0x10d525(_0x2486be);})[_0x7416('0x18')](function(_0x1ba5ed){logger[_0x7416('0x13')](_0x7416('0x19'),_0x1ba5ed['message'],_0x3abd17);_0x4b872e(_0x5f558c[_0x7416('0x13')](0x1f4,_0x1ba5ed['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9fd4b67..f57c44f 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 _0x4849=['post','create','/preview','getPreview','put','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','show'];(function(_0x1b09a0,_0x247b90){var _0x5c943e=function(_0x150ee5){while(--_0x150ee5){_0x1b09a0['push'](_0x1b09a0['shift']());}};_0x5c943e(++_0x247b90);}(_0x4849,0xf8));var _0x9484=function(_0x454bd9,_0x4af0a5){_0x454bd9=_0x454bd9-0x0;var _0x3e0596=_0x4849[_0x454bd9];return _0x3e0596;};'use strict';var multer=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var path=require(_0x9484('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9484('0x3')]();var auth=require(_0x9484('0x4'));var interaction=require(_0x9484('0x5'));var config=require(_0x9484('0x6'));var controller=require(_0x9484('0x7'));router[_0x9484('0x8')]('/',auth[_0x9484('0x9')](),controller[_0x9484('0xa')]);router[_0x9484('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9484('0xb')]);router['get'](_0x9484('0xc'),auth[_0x9484('0x9')](),controller[_0x9484('0xd')]);router[_0x9484('0x8')](_0x9484('0xe'),auth[_0x9484('0x9')](),controller[_0x9484('0xf')]);router[_0x9484('0x10')]('/',auth[_0x9484('0x9')](),controller[_0x9484('0x11')]);router[_0x9484('0x10')](_0x9484('0x12'),auth[_0x9484('0x9')](),controller[_0x9484('0x13')]);router[_0x9484('0x14')]('/:id',auth[_0x9484('0x9')](),controller['update']);router[_0x9484('0x15')](_0x9484('0xe'),auth[_0x9484('0x9')](),controller[_0x9484('0x16')]);module[_0x9484('0x17')]=router; \ No newline at end of file +var _0xe6e4=['../../components/interaction/service','../../config/environment','get','/describe','describe','/opencontacts','isAuthenticated','getOpenContacts','/:id','show','post','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x577cb0,_0x26747e){var _0x25d4e9=function(_0x13ca7a){while(--_0x13ca7a){_0x577cb0['push'](_0x577cb0['shift']());}};_0x25d4e9(++_0x26747e);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x3728bd,_0x405db5){_0x3728bd=_0x3728bd-0x0;var _0xdf5cb5=_0xe6e4[_0x3728bd];return _0xdf5cb5;};'use strict';var multer=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var path=require(_0x4e6e('0x2'));var timeout=require(_0x4e6e('0x3'));var express=require(_0x4e6e('0x4'));var router=express[_0x4e6e('0x5')]();var auth=require(_0x4e6e('0x6'));var interaction=require(_0x4e6e('0x7'));var config=require(_0x4e6e('0x8'));var controller=require('./cmHopper.controller');router[_0x4e6e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4e6e('0x9')](_0x4e6e('0xa'),auth['isAuthenticated'](),controller[_0x4e6e('0xb')]);router[_0x4e6e('0x9')](_0x4e6e('0xc'),auth[_0x4e6e('0xd')](),controller[_0x4e6e('0xe')]);router['get'](_0x4e6e('0xf'),auth[_0x4e6e('0xd')](),controller[_0x4e6e('0x10')]);router[_0x4e6e('0x11')]('/',auth[_0x4e6e('0xd')](),controller['create']);router[_0x4e6e('0x11')](_0x4e6e('0x12'),auth['isAuthenticated'](),controller[_0x4e6e('0x13')]);router[_0x4e6e('0x14')](_0x4e6e('0xf'),auth[_0x4e6e('0xd')](),controller[_0x4e6e('0x15')]);router[_0x4e6e('0x16')](_0x4e6e('0xf'),auth['isAuthenticated'](),controller[_0x4e6e('0x17')]);module[_0x4e6e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0e42df1..4c68e15 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 _0xba79=['sequelize','exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xba79,0x7d));var _0x9ba7=function(_0x3bb9a0,_0x487264){_0x3bb9a0=_0x3bb9a0-0x0;var _0x4bda1b=_0xba79[_0x3bb9a0];return _0x4bda1b;};'use strict';var moment=require(_0x9ba7('0x0'));var Sequelize=require(_0x9ba7('0x1'));module[_0x9ba7('0x2')]={'phone':{'type':Sequelize[_0x9ba7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9ba7('0x4')},'ListId':{'type':Sequelize[_0x9ba7('0x5')],'unique':_0x9ba7('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x9ba7('0x4')}}; \ No newline at end of file +var _0x5ac9=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x492d4a,_0x5cd9f4){var _0x6b5831=function(_0x2ed9d3){while(--_0x2ed9d3){_0x492d4a['push'](_0x492d4a['shift']());}};_0x6b5831(++_0x5cd9f4);}(_0x5ac9,0x117));var _0x95ac=function(_0x6c322c,_0x27ec5d){_0x6c322c=_0x6c322c-0x0;var _0x4560e1=_0x5ac9[_0x6c322c];return _0x4560e1;};'use strict';var moment=require(_0x95ac('0x0'));var Sequelize=require(_0x95ac('0x1'));module[_0x95ac('0x2')]={'phone':{'type':Sequelize[_0x95ac('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x95ac('0x4')],'unique':_0x95ac('0x5')},'ListId':{'type':Sequelize[_0x95ac('0x4')],'unique':_0x95ac('0x5')},'VoiceQueueId':{'type':Sequelize[_0x95ac('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ac72c7d..831fe48 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 _0x544b=['destroy','end','sendStatus','stack','name','send','index','map','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','CmHopperBlack','includeAll','findAll','rows','show','params','rawAttributes','include','merge','options','catch','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','Content-Range','reject','update','then'];(function(_0x36e686,_0x3dd2c3){var _0x204c88=function(_0x1c82c7){while(--_0x1c82c7){_0x36e686['push'](_0x36e686['shift']());}};_0x204c88(++_0x3dd2c3);}(_0x544b,0x1c5));var _0xb544=function(_0x49dd14,_0x5880c2){_0x49dd14=_0x49dd14-0x0;var _0x27114e=_0x544b[_0x49dd14];return _0x27114e;};'use strict';var pdf=require(_0xb544('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb544('0x1'));var zipdir=require(_0xb544('0x2'));var jsonpatch=require(_0xb544('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb544('0x4'));var util=require(_0xb544('0x5'));var path=require(_0xb544('0x6'));var sox=require(_0xb544('0x7'));var csv=require('to-csv');var ejs=require(_0xb544('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb544('0x9'));var crypto=require('crypto');var jsforce=require(_0xb544('0xa'));var deskjs=require(_0xb544('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb544('0xc'));var Redis=require(_0xb544('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb544('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb544('0xf'));var logger=require(_0xb544('0x10'))(_0xb544('0x11'));var utils=require(_0xb544('0x12'));var config=require(_0xb544('0x13'));var licenseUtil=require(_0xb544('0x14'));var db=require(_0xb544('0x15'))['db'];function respondWithStatusCode(_0x551a24,_0x4f131b){_0x4f131b=_0x4f131b||0xcc;return function(_0x330304){if(_0x330304){return _0x551a24['sendStatus'](_0x4f131b);}return _0x551a24[_0xb544('0x16')](_0x4f131b)['end']();};}function respondWithResult(_0x5a1a39,_0x1304fa){_0x1304fa=_0x1304fa||0xc8;return function(_0x3b7a62){if(_0x3b7a62){return _0x5a1a39[_0xb544('0x16')](_0x1304fa)[_0xb544('0x17')](_0x3b7a62);}};}function respondWithFilteredResult(_0x480282,_0xf3b354){return function(_0x1d170d){if(_0x1d170d){var _0x5e730b=_0x1d170d[_0xb544('0x18')],_0x164333=_0xf3b354[_0xb544('0x19')],_0x19a4cc=_0xf3b354[_0xb544('0x19')]+_0xf3b354['limit'],_0x3bd594;if(_0x19a4cc>=_0x5e730b){_0x19a4cc=_0x5e730b;_0x3bd594=0xc8;}else{_0x3bd594=0xce;}_0x480282[_0xb544('0x16')](_0x3bd594);return _0x480282['set'](_0xb544('0x1a'),_0x164333+'-'+_0x19a4cc+'/'+_0x5e730b)[_0xb544('0x17')](_0x1d170d);}return null;};}function patchUpdates(_0x138297){return function(_0x3fd5f2){try{jsonpatch['apply'](_0x3fd5f2,_0x138297,!![]);}catch(_0x458306){return BPromise[_0xb544('0x1b')](_0x458306);}return _0x3fd5f2['save']();};}function saveUpdates(_0x324e26,_0x1f945a){return function(_0x56cc61){if(_0x56cc61){return _0x56cc61[_0xb544('0x1c')](_0x324e26)[_0xb544('0x1d')](function(_0xd87e75){return _0xd87e75;});}return null;};}function removeEntity(_0xe4d4b9,_0x44a34d){return function(_0x4d9343){if(_0x4d9343){return _0x4d9343[_0xb544('0x1e')]()['then'](function(){_0xe4d4b9[_0xb544('0x16')](0xcc)[_0xb544('0x1f')]();});}};}function handleEntityNotFound(_0x4c3fd0,_0x2ab6d5){return function(_0x48462e){if(!_0x48462e){_0x4c3fd0[_0xb544('0x20')](0x194);}return _0x48462e;};}function handleError(_0x64b287,_0x3f0f0e){_0x3f0f0e=_0x3f0f0e||0x1f4;return function(_0x481d3a){logger['error'](_0x481d3a[_0xb544('0x21')]);if(_0x481d3a[_0xb544('0x22')]){delete _0x481d3a[_0xb544('0x22')];}_0x64b287['status'](_0x3f0f0e)[_0xb544('0x23')](_0x481d3a);};}exports[_0xb544('0x24')]=function(_0x1d24c6,_0x3409a3){var _0x491012={},_0x410f22={},_0x5c0b8b={'count':0x0,'rows':[]};var _0x3a6739=_[_0xb544('0x25')](db['CmHopperBlack']['rawAttributes'],function(_0xc4031c){return{'name':_0xc4031c['fieldName'],'type':_0xc4031c[_0xb544('0x26')][_0xb544('0x27')]};});_0x410f22['model']=_[_0xb544('0x25')](_0x3a6739,'name');_0x410f22[_0xb544('0x28')]=_[_0xb544('0x29')](_0x1d24c6['query']);_0x410f22['filters']=_[_0xb544('0x2a')](_0x410f22[_0xb544('0x2b')],_0x410f22[_0xb544('0x28')]);_0x491012[_0xb544('0x2c')]=_[_0xb544('0x2a')](_0x410f22['model'],qs['fields'](_0x1d24c6['query']['fields']));_0x491012[_0xb544('0x2c')]=_0x491012['attributes'][_0xb544('0x2d')]?_0x491012[_0xb544('0x2c')]:_0x410f22[_0xb544('0x2b')];if(!_0x1d24c6[_0xb544('0x28')][_0xb544('0x2e')]('nolimit')){_0x491012[_0xb544('0x2f')]=qs['limit'](_0x1d24c6[_0xb544('0x28')]['limit']);_0x491012[_0xb544('0x19')]=qs['offset'](_0x1d24c6['query'][_0xb544('0x19')]);}_0x491012[_0xb544('0x30')]=qs[_0xb544('0x31')](_0x1d24c6[_0xb544('0x28')][_0xb544('0x31')]);_0x491012[_0xb544('0x32')]=qs[_0xb544('0x33')](_[_0xb544('0x34')](_0x1d24c6['query'],_0x410f22[_0xb544('0x33')]),_0x3a6739);if(_0x1d24c6['query'][_0xb544('0x35')]){_0x491012['where']=_['merge'](_0x491012['where'],{'$or':_[_0xb544('0x25')](_0x3a6739,function(_0x3a1383){if(_0x3a1383[_0xb544('0x26')]!==_0xb544('0x36')){var _0xe5e5e2={};_0xe5e5e2[_0x3a1383[_0xb544('0x22')]]={'$like':'%'+_0x1d24c6[_0xb544('0x28')][_0xb544('0x35')]+'%'};return _0xe5e5e2;}})});}_0x491012=_['merge']({},_0x491012,_0x1d24c6['options']);var _0x44c082={'where':_0x491012['where']};return db[_0xb544('0x37')][_0xb544('0x18')](_0x44c082)[_0xb544('0x1d')](function(_0xb9cfe3){_0x5c0b8b[_0xb544('0x18')]=_0xb9cfe3;if(_0x1d24c6[_0xb544('0x28')][_0xb544('0x38')]){_0x491012['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xb544('0x39')](_0x491012);})['then'](function(_0x402ae5){_0x5c0b8b[_0xb544('0x3a')]=_0x402ae5;return _0x5c0b8b;})[_0xb544('0x1d')](respondWithFilteredResult(_0x3409a3,_0x491012))['catch'](handleError(_0x3409a3,null));};exports[_0xb544('0x3b')]=function(_0x4de6a6,_0x3f909d){var _0x2fb0e8={'raw':!![],'where':{'id':_0x4de6a6[_0xb544('0x3c')]['id']}},_0x32aba3={};_0x32aba3[_0xb544('0x2b')]=_[_0xb544('0x29')](db[_0xb544('0x37')][_0xb544('0x3d')]);_0x32aba3[_0xb544('0x28')]=_[_0xb544('0x29')](_0x4de6a6[_0xb544('0x28')]);_0x32aba3[_0xb544('0x33')]=_[_0xb544('0x2a')](_0x32aba3[_0xb544('0x2b')],_0x32aba3[_0xb544('0x28')]);_0x2fb0e8[_0xb544('0x2c')]=_[_0xb544('0x2a')](_0x32aba3[_0xb544('0x2b')],qs['fields'](_0x4de6a6['query']['fields']));_0x2fb0e8[_0xb544('0x2c')]=_0x2fb0e8[_0xb544('0x2c')][_0xb544('0x2d')]?_0x2fb0e8[_0xb544('0x2c')]:_0x32aba3['model'];if(_0x4de6a6[_0xb544('0x28')][_0xb544('0x38')]){_0x2fb0e8[_0xb544('0x3e')]=[{'all':!![]}];}_0x2fb0e8=_[_0xb544('0x3f')]({},_0x2fb0e8,_0x4de6a6[_0xb544('0x40')]);return db[_0xb544('0x37')]['find'](_0x2fb0e8)[_0xb544('0x1d')](handleEntityNotFound(_0x3f909d,null))[_0xb544('0x1d')](respondWithResult(_0x3f909d,null))[_0xb544('0x41')](handleError(_0x3f909d,null));};exports[_0xb544('0x1c')]=function(_0xdddcf8,_0x11cb52){if(_0xdddcf8[_0xb544('0x42')]['id']){delete _0xdddcf8[_0xb544('0x42')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0xdddcf8['params']['id']}})[_0xb544('0x1d')](handleEntityNotFound(_0x11cb52,null))[_0xb544('0x1d')](saveUpdates(_0xdddcf8[_0xb544('0x42')],null))['then'](respondWithResult(_0x11cb52,null))[_0xb544('0x41')](handleError(_0x11cb52,null));};exports[_0xb544('0x1e')]=function(_0x41af76,_0x4aa5d8){return db['CmHopperBlack'][_0xb544('0x43')]({'where':{'id':_0x41af76['params']['id']}})[_0xb544('0x1d')](handleEntityNotFound(_0x4aa5d8,null))[_0xb544('0x1d')](removeEntity(_0x4aa5d8,null))[_0xb544('0x41')](handleError(_0x4aa5d8,null));};exports[_0xb544('0x44')]=function(_0x434be5,_0x5b54d1){return db['CmHopperBlack'][_0xb544('0x44')]()[_0xb544('0x1d')](respondWithResult(_0x5b54d1,null))[_0xb544('0x41')](handleError(_0x5b54d1,null));}; \ No newline at end of file +var _0x90e8=['../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','describe','html-pdf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0x90e8,0x141));var _0x890e=function(_0x8c7cfe,_0x4ec64d){_0x8c7cfe=_0x8c7cfe-0x0;var _0xe0f0d8=_0x90e8[_0x8c7cfe];return _0xe0f0d8;};'use strict';var pdf=require(_0x890e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x890e('0x1'));var moment=require(_0x890e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x890e('0x3'));var path=require(_0x890e('0x4'));var sox=require(_0x890e('0x5'));var csv=require(_0x890e('0x6'));var ejs=require(_0x890e('0x7'));var fs=require('fs');var _=require(_0x890e('0x8'));var squel=require(_0x890e('0x9'));var crypto=require(_0x890e('0xa'));var jsforce=require(_0x890e('0xb'));var deskjs=require(_0x890e('0xc'));var toCsv=require(_0x890e('0x6'));var querystring=require(_0x890e('0xd'));var Papa=require(_0x890e('0xe'));var Redis=require(_0x890e('0xf'));var authService=require(_0x890e('0x10'));var qs=require(_0x890e('0x11'));var as=require(_0x890e('0x12'));var hardwareService=require(_0x890e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x890e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x890e('0x15'))['db'];function respondWithStatusCode(_0x2e9d8b,_0xdcd0b2){_0xdcd0b2=_0xdcd0b2||0xcc;return function(_0x4a21c4){if(_0x4a21c4){return _0x2e9d8b[_0x890e('0x16')](_0xdcd0b2);}return _0x2e9d8b[_0x890e('0x17')](_0xdcd0b2)[_0x890e('0x18')]();};}function respondWithResult(_0x1d8654,_0x33a3a4){_0x33a3a4=_0x33a3a4||0xc8;return function(_0x228a66){if(_0x228a66){return _0x1d8654['status'](_0x33a3a4)[_0x890e('0x19')](_0x228a66);}};}function respondWithFilteredResult(_0x13a286,_0x52f2ce){return function(_0x4f2426){if(_0x4f2426){var _0x16c056=_0x4f2426[_0x890e('0x1a')],_0x1b339c=_0x52f2ce[_0x890e('0x1b')],_0x513443=_0x52f2ce[_0x890e('0x1b')]+_0x52f2ce[_0x890e('0x1c')],_0x43c272;if(_0x513443>=_0x16c056){_0x513443=_0x16c056;_0x43c272=0xc8;}else{_0x43c272=0xce;}_0x13a286[_0x890e('0x17')](_0x43c272);return _0x13a286[_0x890e('0x1d')]('Content-Range',_0x1b339c+'-'+_0x513443+'/'+_0x16c056)[_0x890e('0x19')](_0x4f2426);}return null;};}function patchUpdates(_0x265c51){return function(_0x4ec396){try{jsonpatch['apply'](_0x4ec396,_0x265c51,!![]);}catch(_0x435179){return BPromise[_0x890e('0x1e')](_0x435179);}return _0x4ec396[_0x890e('0x1f')]();};}function saveUpdates(_0x224741,_0x323543){return function(_0x50ba61){if(_0x50ba61){return _0x50ba61[_0x890e('0x20')](_0x224741)[_0x890e('0x21')](function(_0x289f1c){return _0x289f1c;});}return null;};}function removeEntity(_0x373574,_0x55d784){return function(_0x27bfcf){if(_0x27bfcf){return _0x27bfcf[_0x890e('0x22')]()['then'](function(){_0x373574[_0x890e('0x17')](0xcc)[_0x890e('0x18')]();});}};}function handleEntityNotFound(_0x585f4f,_0x58e213){return function(_0x33191b){if(!_0x33191b){_0x585f4f[_0x890e('0x16')](0x194);}return _0x33191b;};}function handleError(_0x47a5ba,_0x56fbc6){_0x56fbc6=_0x56fbc6||0x1f4;return function(_0x32cc27){logger[_0x890e('0x23')](_0x32cc27['stack']);if(_0x32cc27[_0x890e('0x24')]){delete _0x32cc27[_0x890e('0x24')];}_0x47a5ba[_0x890e('0x17')](_0x56fbc6)['send'](_0x32cc27);};}exports['index']=function(_0x6db5ba,_0x12e910){var _0xada016={},_0x95c754={},_0x1abbaf={'count':0x0,'rows':[]};var _0x390687=_[_0x890e('0x25')](db['CmHopperBlack']['rawAttributes'],function(_0x23bb1e){return{'name':_0x23bb1e[_0x890e('0x26')],'type':_0x23bb1e['type']['key']};});_0x95c754[_0x890e('0x27')]=_[_0x890e('0x25')](_0x390687,'name');_0x95c754[_0x890e('0x28')]=_[_0x890e('0x29')](_0x6db5ba[_0x890e('0x28')]);_0x95c754[_0x890e('0x2a')]=_[_0x890e('0x2b')](_0x95c754[_0x890e('0x27')],_0x95c754[_0x890e('0x28')]);_0xada016[_0x890e('0x2c')]=_[_0x890e('0x2b')](_0x95c754[_0x890e('0x27')],qs[_0x890e('0x2d')](_0x6db5ba[_0x890e('0x28')][_0x890e('0x2d')]));_0xada016['attributes']=_0xada016[_0x890e('0x2c')][_0x890e('0x2e')]?_0xada016[_0x890e('0x2c')]:_0x95c754[_0x890e('0x27')];if(!_0x6db5ba[_0x890e('0x28')]['hasOwnProperty'](_0x890e('0x2f'))){_0xada016[_0x890e('0x1c')]=qs[_0x890e('0x1c')](_0x6db5ba[_0x890e('0x28')]['limit']);_0xada016[_0x890e('0x1b')]=qs[_0x890e('0x1b')](_0x6db5ba['query']['offset']);}_0xada016[_0x890e('0x30')]=qs[_0x890e('0x31')](_0x6db5ba[_0x890e('0x28')][_0x890e('0x31')]);_0xada016['where']=qs[_0x890e('0x2a')](_['pick'](_0x6db5ba[_0x890e('0x28')],_0x95c754['filters']),_0x390687);if(_0x6db5ba[_0x890e('0x28')][_0x890e('0x32')]){_0xada016[_0x890e('0x33')]=_[_0x890e('0x34')](_0xada016['where'],{'$or':_['map'](_0x390687,function(_0x503efa){if(_0x503efa[_0x890e('0x35')]!==_0x890e('0x36')){var _0x98c96d={};_0x98c96d[_0x503efa[_0x890e('0x24')]]={'$like':'%'+_0x6db5ba[_0x890e('0x28')]['filter']+'%'};return _0x98c96d;}})});}_0xada016=_[_0x890e('0x34')]({},_0xada016,_0x6db5ba[_0x890e('0x37')]);var _0x3dcafd={'where':_0xada016['where']};return db[_0x890e('0x38')]['count'](_0x3dcafd)[_0x890e('0x21')](function(_0x4a4e55){_0x1abbaf['count']=_0x4a4e55;if(_0x6db5ba[_0x890e('0x28')][_0x890e('0x39')]){_0xada016[_0x890e('0x3a')]=[{'all':!![]}];}return db[_0x890e('0x38')][_0x890e('0x3b')](_0xada016);})[_0x890e('0x21')](function(_0x11bda4){_0x1abbaf[_0x890e('0x3c')]=_0x11bda4;return _0x1abbaf;})['then'](respondWithFilteredResult(_0x12e910,_0xada016))[_0x890e('0x3d')](handleError(_0x12e910,null));};exports[_0x890e('0x3e')]=function(_0x301738,_0x403143){var _0x38a2c2={'raw':!![],'where':{'id':_0x301738[_0x890e('0x3f')]['id']}},_0x217548={};_0x217548[_0x890e('0x27')]=_['keys'](db[_0x890e('0x38')][_0x890e('0x40')]);_0x217548[_0x890e('0x28')]=_[_0x890e('0x29')](_0x301738['query']);_0x217548[_0x890e('0x2a')]=_[_0x890e('0x2b')](_0x217548[_0x890e('0x27')],_0x217548['query']);_0x38a2c2[_0x890e('0x2c')]=_[_0x890e('0x2b')](_0x217548[_0x890e('0x27')],qs['fields'](_0x301738[_0x890e('0x28')]['fields']));_0x38a2c2[_0x890e('0x2c')]=_0x38a2c2['attributes'][_0x890e('0x2e')]?_0x38a2c2[_0x890e('0x2c')]:_0x217548[_0x890e('0x27')];if(_0x301738[_0x890e('0x28')]['includeAll']){_0x38a2c2[_0x890e('0x3a')]=[{'all':!![]}];}_0x38a2c2=_['merge']({},_0x38a2c2,_0x301738[_0x890e('0x37')]);return db[_0x890e('0x38')][_0x890e('0x41')](_0x38a2c2)[_0x890e('0x21')](handleEntityNotFound(_0x403143,null))[_0x890e('0x21')](respondWithResult(_0x403143,null))['catch'](handleError(_0x403143,null));};exports['update']=function(_0x2fe700,_0x32ee47){if(_0x2fe700[_0x890e('0x42')]['id']){delete _0x2fe700[_0x890e('0x42')]['id'];}return db[_0x890e('0x38')][_0x890e('0x41')]({'where':{'id':_0x2fe700[_0x890e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x32ee47,null))[_0x890e('0x21')](saveUpdates(_0x2fe700[_0x890e('0x42')],null))[_0x890e('0x21')](respondWithResult(_0x32ee47,null))['catch'](handleError(_0x32ee47,null));};exports[_0x890e('0x22')]=function(_0x26fdbb,_0x397629){return db[_0x890e('0x38')][_0x890e('0x41')]({'where':{'id':_0x26fdbb['params']['id']}})[_0x890e('0x21')](handleEntityNotFound(_0x397629,null))[_0x890e('0x21')](removeEntity(_0x397629,null))[_0x890e('0x3d')](handleError(_0x397629,null));};exports[_0x890e('0x43')]=function(_0x47111e,_0x14a8db){return db[_0x890e('0x38')][_0x890e('0x43')]()[_0x890e('0x21')](respondWithResult(_0x14a8db,null))[_0x890e('0x3d')](handleError(_0x14a8db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 4e556a2..0e3ec42 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 _0x4847=['exports','define','CmHopperBlack','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6da2dd,_0x479056){var _0x27cee8=function(_0x2f06c8){while(--_0x2f06c8){_0x6da2dd['push'](_0x6da2dd['shift']());}};_0x27cee8(++_0x479056);}(_0x4847,0x1e7));var _0x7484=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4847[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7484('0x0'));var util=require(_0x7484('0x1'));var logger=require('../../config/logger')(_0x7484('0x2'));var moment=require('moment');var BPromise=require(_0x7484('0x3'));var rp=require(_0x7484('0x4'));var fs=require('fs');var path=require(_0x7484('0x5'));var rimraf=require(_0x7484('0x6'));var config=require(_0x7484('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x7484('0x8')]=function(_0x505776,_0x330100){return _0x505776[_0x7484('0x9')](_0x7484('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc85d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','../../config/logger'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0xc85d,0x6a));var _0xdc85=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xc85d[_0xa60623];return _0x4a6487;};'use strict';var _=require('lodash');var util=require(_0xdc85('0x0'));var logger=require(_0xdc85('0x1'))(_0xdc85('0x2'));var moment=require('moment');var BPromise=require(_0xdc85('0x3'));var rp=require(_0xdc85('0x4'));var fs=require('fs');var path=require(_0xdc85('0x5'));var rimraf=require(_0xdc85('0x6'));var config=require(_0xdc85('0x7'));var attributes=require(_0xdc85('0x8'));module['exports']=function(_0x406aef,_0x36cf06){return _0x406aef[_0xdc85('0x9')](_0xdc85('0xa'),attributes,{'tableName':_0xdc85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index df1822e..268535a 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 _0xa9a1=['result','options','raw','where','limit','include','map','model','attributes','catch','GetCmHopperBlack','CmHopperBlack','update','body','then','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1d7c3e,_0x25d8c4){var _0x1a5c88=function(_0x438c80){while(--_0x438c80){_0x1d7c3e['push'](_0x1d7c3e['shift']());}};_0x1a5c88(++_0x25d8c4);}(_0xa9a1,0x171));var _0x1a9a=function(_0x2a8734,_0x119e32){_0x2a8734=_0x2a8734-0x0;var _0x8bb476=_0xa9a1[_0x2a8734];return _0x8bb476;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a9a('0x0'));var BPromise=require(_0x1a9a('0x1'));var rs=require(_0x1a9a('0x2'));var fs=require('fs');var Redis=require(_0x1a9a('0x3'));var db=require(_0x1a9a('0x4'))['db'];var utils=require(_0x1a9a('0x5'));var logger=require(_0x1a9a('0x6'))(_0x1a9a('0x7'));var config=require(_0x1a9a('0x8'));var jayson=require(_0x1a9a('0x9'));var client=jayson['client'][_0x1a9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d68bc,_0x2f355f,_0x107040){return new BPromise(function(_0x4a8d66,_0x3deff6){return client[_0x1a9a('0xb')](_0x2d68bc,_0x107040)['then'](function(_0x5b869d){logger[_0x1a9a('0xc')](_0x1a9a('0xd'),_0x2f355f,_0x1a9a('0xe'));logger[_0x1a9a('0xf')](_0x1a9a('0x10'),_0x2f355f,_0x1a9a('0xe'),JSON[_0x1a9a('0x11')](_0x5b869d));if(_0x5b869d[_0x1a9a('0x12')]){if(_0x5b869d[_0x1a9a('0x12')][_0x1a9a('0x13')]===0x1f4){logger[_0x1a9a('0x12')](_0x1a9a('0xd'),_0x2f355f,_0x5b869d[_0x1a9a('0x12')][_0x1a9a('0x14')]);return _0x3deff6(_0x5b869d[_0x1a9a('0x12')][_0x1a9a('0x14')]);}logger[_0x1a9a('0x12')](_0x1a9a('0xd'),_0x2f355f,_0x5b869d['error'][_0x1a9a('0x14')]);return _0x4a8d66(_0x5b869d[_0x1a9a('0x12')][_0x1a9a('0x14')]);}else{logger[_0x1a9a('0xc')](_0x1a9a('0xd'),_0x2f355f,_0x1a9a('0xe'));_0x4a8d66(_0x5b869d[_0x1a9a('0x15')][_0x1a9a('0x14')]);}})['catch'](function(_0x295c03){logger[_0x1a9a('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2f355f,_0x295c03);_0x3deff6(_0x295c03);});});}exports['GetCmHopperBlack']=function(_0x1cef91){var _0x13dd77=this;return new Promise(function(_0xdc45b2,_0x8abe43){return db['CmHopperBlack']['findAll']({'raw':_0x1cef91[_0x1a9a('0x16')]?_0x1cef91[_0x1a9a('0x16')][_0x1a9a('0x17')]===undefined?!![]:![]:!![],'where':_0x1cef91[_0x1a9a('0x16')]?_0x1cef91[_0x1a9a('0x16')][_0x1a9a('0x18')]||null:null,'attributes':_0x1cef91[_0x1a9a('0x16')]?_0x1cef91[_0x1a9a('0x16')]['attributes']||null:null,'limit':_0x1cef91[_0x1a9a('0x16')]?_0x1cef91[_0x1a9a('0x16')][_0x1a9a('0x19')]||null:null,'include':_0x1cef91['options']?_0x1cef91[_0x1a9a('0x16')][_0x1a9a('0x1a')]?_[_0x1a9a('0x1b')](_0x1cef91['options']['include'],function(_0x47c9a2){return{'model':db[_0x47c9a2[_0x1a9a('0x1c')]],'as':_0x47c9a2['as'],'attributes':_0x47c9a2[_0x1a9a('0x1d')],'include':_0x47c9a2[_0x1a9a('0x1a')]?_[_0x1a9a('0x1b')](_0x47c9a2[_0x1a9a('0x1a')],function(_0x47df61){return{'model':db[_0x47df61[_0x1a9a('0x1c')]],'as':_0x47df61['as'],'attributes':_0x47df61[_0x1a9a('0x1d')],'include':_0x47df61[_0x1a9a('0x1a')]?_['map'](_0x47df61[_0x1a9a('0x1a')],function(_0x1bf539){return{'model':db[_0x1bf539['model']],'as':_0x1bf539['as'],'attributes':_0x1bf539[_0x1a9a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe16271){logger['info']('GetCmHopperBlack',_0x1cef91);logger[_0x1a9a('0xf')]('GetCmHopperBlack',_0x1cef91,JSON[_0x1a9a('0x11')](_0xe16271));_0xdc45b2(_0xe16271);})[_0x1a9a('0x1e')](function(_0x3adc43){logger[_0x1a9a('0x12')](_0x1a9a('0x1f'),_0x3adc43[_0x1a9a('0x14')],_0x1cef91);_0x8abe43(_0x13dd77[_0x1a9a('0x12')](0x1f4,_0x3adc43[_0x1a9a('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x386415){var _0x4aaf69=this;return new Promise(function(_0x298244,_0x4ae45f){return db[_0x1a9a('0x20')][_0x1a9a('0x21')](_0x386415[_0x1a9a('0x22')],{'raw':_0x386415[_0x1a9a('0x16')]?_0x386415['options'][_0x1a9a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x386415['options']?_0x386415[_0x1a9a('0x16')][_0x1a9a('0x18')]||null:null,'attributes':_0x386415[_0x1a9a('0x16')]?_0x386415['options'][_0x1a9a('0x1d')]||null:null,'limit':_0x386415[_0x1a9a('0x16')]?_0x386415[_0x1a9a('0x16')][_0x1a9a('0x19')]||null:null})[_0x1a9a('0x23')](function(_0x3c710a){logger['info']('UpdateCmHopperBlack',_0x386415);logger[_0x1a9a('0xf')](_0x1a9a('0x24'),_0x386415,JSON[_0x1a9a('0x11')](_0x3c710a));_0x298244(_0x3c710a);})[_0x1a9a('0x1e')](function(_0x4f7990){logger[_0x1a9a('0x12')](_0x1a9a('0x24'),_0x4f7990[_0x1a9a('0x14')],_0x386415);_0x4ae45f(_0x4aaf69[_0x1a9a('0x12')](0x1f4,_0x4f7990[_0x1a9a('0x14')]));});});};exports[_0x1a9a('0x25')]=function(_0x5852cf){var _0x550a52=this;return new Promise(function(_0x3d87b1,_0x3cd9c3){return db[_0x1a9a('0x20')][_0x1a9a('0x26')]({'where':_0x5852cf[_0x1a9a('0x16')]?_0x5852cf[_0x1a9a('0x16')][_0x1a9a('0x18')]||null:null})[_0x1a9a('0x23')](function(_0x1bc252){logger[_0x1a9a('0xc')](_0x1a9a('0x25'),_0x5852cf);logger[_0x1a9a('0xf')](_0x1a9a('0x25'),_0x5852cf,JSON['stringify'](_0x1bc252));_0x3d87b1(_0x1bc252);})[_0x1a9a('0x1e')](function(_0x1767ef){logger[_0x1a9a('0x12')](_0x1a9a('0x25'),_0x1767ef[_0x1a9a('0x14')],_0x5852cf);_0x3cd9c3(_0x550a52[_0x1a9a('0x12')](0x1f4,_0x1767ef[_0x1a9a('0x14')]));});});}; \ No newline at end of file +var _0x9c06=['where','limit','include','map','model','attributes','UpdateCmHopperBlack','body','info','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x2a24b2,_0x171540){var _0x2ed7d3=function(_0x49a1e7){while(--_0x49a1e7){_0x2a24b2['push'](_0x2a24b2['shift']());}};_0x2ed7d3(++_0x171540);}(_0x9c06,0xd3));var _0x69c0=function(_0x3fd930,_0x4a32a1){_0x3fd930=_0x3fd930-0x0;var _0x38b346=_0x9c06[_0x3fd930];return _0x38b346;};'use strict';var _=require(_0x69c0('0x0'));var util=require(_0x69c0('0x1'));var moment=require(_0x69c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x69c0('0x3'));var fs=require('fs');var Redis=require(_0x69c0('0x4'));var db=require(_0x69c0('0x5'))['db'];var utils=require(_0x69c0('0x6'));var logger=require(_0x69c0('0x7'))(_0x69c0('0x8'));var config=require(_0x69c0('0x9'));var jayson=require(_0x69c0('0xa'));var client=jayson[_0x69c0('0xb')][_0x69c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31a237,_0x369074,_0xf574b4){return new BPromise(function(_0x4b0943,_0x10427f){return client[_0x69c0('0xd')](_0x31a237,_0xf574b4)[_0x69c0('0xe')](function(_0x3a6ddc){logger['info'](_0x69c0('0xf'),_0x369074,_0x69c0('0x10'));logger[_0x69c0('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x369074,_0x69c0('0x10'),JSON[_0x69c0('0x12')](_0x3a6ddc));if(_0x3a6ddc[_0x69c0('0x13')]){if(_0x3a6ddc[_0x69c0('0x13')][_0x69c0('0x14')]===0x1f4){logger[_0x69c0('0x13')](_0x69c0('0xf'),_0x369074,_0x3a6ddc[_0x69c0('0x13')][_0x69c0('0x15')]);return _0x10427f(_0x3a6ddc[_0x69c0('0x13')][_0x69c0('0x15')]);}logger[_0x69c0('0x13')](_0x69c0('0xf'),_0x369074,_0x3a6ddc[_0x69c0('0x13')][_0x69c0('0x15')]);return _0x4b0943(_0x3a6ddc[_0x69c0('0x13')][_0x69c0('0x15')]);}else{logger['info'](_0x69c0('0xf'),_0x369074,_0x69c0('0x10'));_0x4b0943(_0x3a6ddc[_0x69c0('0x16')][_0x69c0('0x15')]);}})[_0x69c0('0x17')](function(_0x4c363c){logger[_0x69c0('0x13')](_0x69c0('0xf'),_0x369074,_0x4c363c);_0x10427f(_0x4c363c);});});}exports[_0x69c0('0x18')]=function(_0x653698){var _0x5ed98a=this;return new Promise(function(_0x9f8cee,_0x45bc0f){return db[_0x69c0('0x19')][_0x69c0('0x1a')]({'raw':_0x653698[_0x69c0('0x1b')]?_0x653698['options'][_0x69c0('0x1c')]===undefined?!![]:![]:!![],'where':_0x653698[_0x69c0('0x1b')]?_0x653698[_0x69c0('0x1b')][_0x69c0('0x1d')]||null:null,'attributes':_0x653698[_0x69c0('0x1b')]?_0x653698[_0x69c0('0x1b')]['attributes']||null:null,'limit':_0x653698[_0x69c0('0x1b')]?_0x653698['options'][_0x69c0('0x1e')]||null:null,'include':_0x653698['options']?_0x653698[_0x69c0('0x1b')][_0x69c0('0x1f')]?_[_0x69c0('0x20')](_0x653698[_0x69c0('0x1b')][_0x69c0('0x1f')],function(_0x235f05){return{'model':db[_0x235f05[_0x69c0('0x21')]],'as':_0x235f05['as'],'attributes':_0x235f05[_0x69c0('0x22')],'include':_0x235f05[_0x69c0('0x1f')]?_[_0x69c0('0x20')](_0x235f05[_0x69c0('0x1f')],function(_0x16e623){return{'model':db[_0x16e623[_0x69c0('0x21')]],'as':_0x16e623['as'],'attributes':_0x16e623[_0x69c0('0x22')],'include':_0x16e623['include']?_[_0x69c0('0x20')](_0x16e623[_0x69c0('0x1f')],function(_0x35f663){return{'model':db[_0x35f663[_0x69c0('0x21')]],'as':_0x35f663['as'],'attributes':_0x35f663[_0x69c0('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39ee47){logger['info'](_0x69c0('0x18'),_0x653698);logger['debug']('GetCmHopperBlack',_0x653698,JSON[_0x69c0('0x12')](_0x39ee47));_0x9f8cee(_0x39ee47);})[_0x69c0('0x17')](function(_0x3360c7){logger[_0x69c0('0x13')](_0x69c0('0x18'),_0x3360c7[_0x69c0('0x15')],_0x653698);_0x45bc0f(_0x5ed98a['error'](0x1f4,_0x3360c7[_0x69c0('0x15')]));});});};exports[_0x69c0('0x23')]=function(_0x1bc417){var _0x2c6887=this;return new Promise(function(_0x3f1dec,_0x1f1b56){return db[_0x69c0('0x19')]['update'](_0x1bc417[_0x69c0('0x24')],{'raw':_0x1bc417[_0x69c0('0x1b')]?_0x1bc417[_0x69c0('0x1b')][_0x69c0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bc417['options']?_0x1bc417[_0x69c0('0x1b')][_0x69c0('0x1d')]||null:null,'attributes':_0x1bc417[_0x69c0('0x1b')]?_0x1bc417[_0x69c0('0x1b')][_0x69c0('0x22')]||null:null,'limit':_0x1bc417[_0x69c0('0x1b')]?_0x1bc417[_0x69c0('0x1b')]['limit']||null:null})['then'](function(_0x210311){logger[_0x69c0('0x25')](_0x69c0('0x23'),_0x1bc417);logger[_0x69c0('0x11')](_0x69c0('0x23'),_0x1bc417,JSON[_0x69c0('0x12')](_0x210311));_0x3f1dec(_0x210311);})[_0x69c0('0x17')](function(_0x56dfe3){logger['error']('UpdateCmHopperBlack',_0x56dfe3[_0x69c0('0x15')],_0x1bc417);_0x1f1b56(_0x2c6887[_0x69c0('0x13')](0x1f4,_0x56dfe3['message']));});});};exports[_0x69c0('0x26')]=function(_0x18c2e7){var _0x17b704=this;return new Promise(function(_0x364cbf,_0x13cac2){return db[_0x69c0('0x19')][_0x69c0('0x27')]({'where':_0x18c2e7['options']?_0x18c2e7[_0x69c0('0x1b')]['where']||null:null})['then'](function(_0x16e626){logger['info'](_0x69c0('0x26'),_0x18c2e7);logger[_0x69c0('0x11')]('DestroyCmHopperBlack',_0x18c2e7,JSON[_0x69c0('0x12')](_0x16e626));_0x364cbf(_0x16e626);})['catch'](function(_0x55ad48){logger[_0x69c0('0x13')](_0x69c0('0x26'),_0x55ad48[_0x69c0('0x15')],_0x18c2e7);_0x13cac2(_0x17b704[_0x69c0('0x13')](0x1f4,_0x55ad48[_0x69c0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c82f316..cab07bc 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 _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','put','update','delete','/:id'];(function(_0xfc0cc7,_0x22bec6){var _0x2cf404=function(_0x5e086f){while(--_0x5e086f){_0xfc0cc7['push'](_0xfc0cc7['shift']());}};_0x2cf404(++_0x22bec6);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xf2ca[_0x283127];return _0x43da5d;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xb')]('/:id',auth[_0xaf2c('0x9')](),controller['show']);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf2c('0x12')]=router; \ No newline at end of file +var _0x425d=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5152d5,_0x48bad5){var _0x403953=function(_0x3802a1){while(--_0x3802a1){_0x5152d5['push'](_0x5152d5['shift']());}};_0x403953(++_0x48bad5);}(_0x425d,0x1e0));var _0xd425=function(_0x4be634,_0x2b1a67){_0x4be634=_0x4be634-0x0;var _0x2df900=_0x425d[_0x4be634];return _0x2df900;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./cmHopperBlack.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0xe')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);module[_0xd425('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 69e3686..1fe5017 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 _0xbf46=['STRING','INTEGER','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x3245f7,_0x26bfad){var _0x472f77=function(_0x391589){while(--_0x391589){_0x3245f7['push'](_0x3245f7['shift']());}};_0x472f77(++_0x26bfad);}(_0xbf46,0x107));var _0x6bf4=function(_0x117ab9,_0x45c7b6){_0x117ab9=_0x117ab9-0x0;var _0x258a48=_0xbf46[_0x117ab9];return _0x258a48;};'use strict';var Sequelize=require(_0x6bf4('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6bf4('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x6bf4('0x1')]},'originatecalleridname':{'type':Sequelize[_0x6bf4('0x1')]},'calleridnum':{'type':Sequelize[_0x6bf4('0x1')]},'calleridname':{'type':Sequelize[_0x6bf4('0x1')]},'starttime':{'type':Sequelize[_0x6bf4('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6bf4('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6bf4('0x1')]},'campaign':{'type':Sequelize[_0x6bf4('0x1')]},'campaigntype':{'type':Sequelize[_0x6bf4('0x1')]},'membername':{'type':Sequelize[_0x6bf4('0x1')]},'reason':{'type':Sequelize[_0x6bf4('0x1')]},'disposition':{'type':Sequelize[_0x6bf4('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x8f683f){var _0x3ee992=this[_0x6bf4('0x4')](_0x6bf4('0x5'));if(_0x3ee992&&_0x8f683f){this[_0x6bf4('0x6')](_0x6bf4('0x7'),moment(_0x8f683f)['diff'](moment(_0x3ee992),_0x6bf4('0x8')));}return this[_0x6bf4('0x6')](_0x6bf4('0x9'),_0x8f683f);}},'amd':{'type':Sequelize[_0x6bf4('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6bf4('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6bf4('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6bf4('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6bf4('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6bf4('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6bf4('0x3')]},'recallme':{'type':Sequelize[_0x6bf4('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6bf4('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6bf4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d63=['sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','diff','seconds','BOOLEAN'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x0d63,0xf2));var _0x30d6=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0x0d63[_0xab9f3d];return _0x5283bf;};'use strict';var Sequelize=require(_0x30d6('0x0'));var moment=require(_0x30d6('0x1'));module[_0x30d6('0x2')]={'state':{'type':Sequelize[_0x30d6('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x30d6('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x30d6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x30d6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x30d6('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x30d6('0x4')]},'originatecalleridname':{'type':Sequelize[_0x30d6('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x30d6('0x4')]},'starttime':{'type':Sequelize[_0x30d6('0x5')]},'responsetime':{'type':Sequelize[_0x30d6('0x5')]},'answertime':{'type':Sequelize[_0x30d6('0x5')]},'droptime':{'type':Sequelize[_0x30d6('0x5')]},'endtime':{'type':Sequelize[_0x30d6('0x5')]},'ringtime':{'type':Sequelize[_0x30d6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x30d6('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x30d6('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x30d6('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x30d6('0x4')]},'thirdDisposition':{'type':Sequelize[_0x30d6('0x4')]},'dispositionat':{'type':Sequelize[_0x30d6('0x5')],'set':function(_0x37bf0f){var _0x2a79e0=this[_0x30d6('0x6')]('endtime');if(_0x2a79e0&&_0x37bf0f){this[_0x30d6('0x7')]('followuptime',moment(_0x37bf0f)[_0x30d6('0x8')](moment(_0x2a79e0),_0x30d6('0x9')));}return this[_0x30d6('0x7')]('dispositionat',_0x37bf0f);}},'amd':{'type':Sequelize[_0x30d6('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x30d6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x30d6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x30d6('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x30d6('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x30d6('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x30d6('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x30d6('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x30d6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x30d6('0x3')],'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 5621d42..db55b3e 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 _0xfe57=['NOW()','scheduledAt','ANY_VALUE(ContactId)','field','updatedAt','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','filter','where','VIRTUAL','merge','options','CmHopperFinal','count','catch','show','keys','includeAll','include','find','describe','body','uniqueid','params','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','phone','ContactId','ListId','VoiceQueueId','createdAt','select','ANY_VALUE(calleridnum)'];(function(_0x138a02,_0x32c4be){var _0x12823e=function(_0x364ab0){while(--_0x364ab0){_0x138a02['push'](_0x138a02['shift']());}};_0x12823e(++_0x32c4be);}(_0xfe57,0x195));var _0x7fe5=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xfe57[_0x1bb58c];return _0x277586;};'use strict';var pdf=require(_0x7fe5('0x0'));var emlformat=require(_0x7fe5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe5('0x2'));var rp=require(_0x7fe5('0x3'));var moment=require(_0x7fe5('0x4'));var BPromise=require(_0x7fe5('0x5'));var Mustache=require(_0x7fe5('0x6'));var util=require(_0x7fe5('0x7'));var path=require(_0x7fe5('0x8'));var sox=require(_0x7fe5('0x9'));var csv=require(_0x7fe5('0xa'));var ejs=require(_0x7fe5('0xb'));var fs=require('fs');var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=_0x221ab2['count'],_0x4989a=_0x39f175[_0x7fe5('0x1b')],_0x3f699b=_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1c')],_0x104bc8;if(_0x3f699b>=_0xbdf0a4){_0x3f699b=_0xbdf0a4;_0x104bc8=0xc8;}else{_0x104bc8=0xce;}_0x56e76f[_0x7fe5('0x1d')](_0x104bc8);return _0x56e76f[_0x7fe5('0x1e')](_0x7fe5('0x1f'),_0x4989a+'-'+_0x3f699b+'/'+_0xbdf0a4)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x29b0bd){return function(_0x478523){try{jsonpatch[_0x7fe5('0x20')](_0x478523,_0x29b0bd,!![]);}catch(_0x53e996){return BPromise['reject'](_0x53e996);}return _0x478523[_0x7fe5('0x21')]();};}function saveUpdates(_0x459c2d,_0x2f6592){return function(_0x327301){if(_0x327301){return _0x327301[_0x7fe5('0x22')](_0x459c2d)[_0x7fe5('0x23')](function(_0x24efbb){return _0x24efbb;});}return null;};}function removeEntity(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x24')]()[_0x7fe5('0x23')](function(){_0xdd9df7['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x2f39e0,_0x43e547){return function(_0x508826){if(!_0x508826){_0x2f39e0[_0x7fe5('0x18')](0x194);}return _0x508826;};}function handleError(_0x48ee56,_0xf358ed){_0xf358ed=_0xf358ed||0x1f4;return function(_0x53f522){logger[_0x7fe5('0x25')](_0x53f522[_0x7fe5('0x26')]);if(_0x53f522[_0x7fe5('0x27')]){delete _0x53f522[_0x7fe5('0x27')];}_0x48ee56[_0x7fe5('0x1d')](_0xf358ed)[_0x7fe5('0x28')](_0x53f522);};}exports['index']=function(_0x5f2d25,_0x417a56){var _0x450759={},_0x27b66d={},_0x13c96b={'count':0x0,'rows':[]};var _0x51407b=_[_0x7fe5('0x29')](db['CmHopperFinal'][_0x7fe5('0x2a')],function(_0x1420de){return{'name':_0x1420de[_0x7fe5('0x2b')],'type':_0x1420de[_0x7fe5('0x2c')][_0x7fe5('0x2d')]};});_0x27b66d[_0x7fe5('0x2e')]=_['map'](_0x51407b,_0x7fe5('0x27'));_0x27b66d[_0x7fe5('0x2f')]=_['keys'](_0x5f2d25[_0x7fe5('0x2f')]);_0x27b66d[_0x7fe5('0x30')]=_[_0x7fe5('0x31')](_0x27b66d[_0x7fe5('0x2e')],_0x27b66d[_0x7fe5('0x2f')]);_0x450759['attributes']=_['intersection'](_0x27b66d[_0x7fe5('0x2e')],qs[_0x7fe5('0x32')](_0x5f2d25[_0x7fe5('0x2f')][_0x7fe5('0x32')]));_0x450759['attributes']=_0x450759[_0x7fe5('0x33')][_0x7fe5('0x34')]?_0x450759[_0x7fe5('0x33')]:_0x27b66d[_0x7fe5('0x2e')];if(!_0x5f2d25[_0x7fe5('0x2f')][_0x7fe5('0x35')]('nolimit')){_0x450759[_0x7fe5('0x1c')]=qs[_0x7fe5('0x1c')](_0x5f2d25[_0x7fe5('0x2f')][_0x7fe5('0x1c')]);_0x450759['offset']=qs['offset'](_0x5f2d25[_0x7fe5('0x2f')]['offset']);}_0x450759[_0x7fe5('0x36')]=qs['sort'](_0x5f2d25[_0x7fe5('0x2f')]['sort']);_0x450759['where']=qs['filters'](_['pick'](_0x5f2d25[_0x7fe5('0x2f')],_0x27b66d[_0x7fe5('0x30')]),_0x51407b);if(_0x5f2d25['query'][_0x7fe5('0x37')]){_0x450759[_0x7fe5('0x38')]=_['merge'](_0x450759[_0x7fe5('0x38')],{'$or':_['map'](_0x51407b,function(_0x4aeed2){if(_0x4aeed2[_0x7fe5('0x2c')]!==_0x7fe5('0x39')){var _0x1e27ef={};_0x1e27ef[_0x4aeed2[_0x7fe5('0x27')]]={'$like':'%'+_0x5f2d25[_0x7fe5('0x2f')]['filter']+'%'};return _0x1e27ef;}})});}_0x450759=_[_0x7fe5('0x3a')]({},_0x450759,_0x5f2d25[_0x7fe5('0x3b')]);var _0x5839b2={'where':_0x450759[_0x7fe5('0x38')]};return db[_0x7fe5('0x3c')][_0x7fe5('0x3d')](_0x5839b2)[_0x7fe5('0x23')](function(_0x21c6d0){_0x13c96b[_0x7fe5('0x3d')]=_0x21c6d0;if(_0x5f2d25[_0x7fe5('0x2f')]['includeAll']){_0x450759['include']=[{'all':!![]}];}return db[_0x7fe5('0x3c')]['findAll'](_0x450759);})[_0x7fe5('0x23')](function(_0x26be07){_0x13c96b['rows']=_0x26be07;return _0x13c96b;})[_0x7fe5('0x23')](respondWithFilteredResult(_0x417a56,_0x450759))[_0x7fe5('0x3e')](handleError(_0x417a56,null));};exports[_0x7fe5('0x3f')]=function(_0x1c3e08,_0x2fd004){var _0x2a31c0={'raw':!![],'where':{'id':_0x1c3e08['params']['id']}},_0x1cd6d3={};_0x1cd6d3['model']=_[_0x7fe5('0x40')](db['CmHopperFinal'][_0x7fe5('0x2a')]);_0x1cd6d3[_0x7fe5('0x2f')]=_[_0x7fe5('0x40')](_0x1c3e08[_0x7fe5('0x2f')]);_0x1cd6d3['filters']=_[_0x7fe5('0x31')](_0x1cd6d3['model'],_0x1cd6d3['query']);_0x2a31c0[_0x7fe5('0x33')]=_[_0x7fe5('0x31')](_0x1cd6d3['model'],qs[_0x7fe5('0x32')](_0x1c3e08[_0x7fe5('0x2f')][_0x7fe5('0x32')]));_0x2a31c0[_0x7fe5('0x33')]=_0x2a31c0[_0x7fe5('0x33')]['length']?_0x2a31c0[_0x7fe5('0x33')]:_0x1cd6d3[_0x7fe5('0x2e')];if(_0x1c3e08['query'][_0x7fe5('0x41')]){_0x2a31c0[_0x7fe5('0x42')]=[{'all':!![]}];}_0x2a31c0=_[_0x7fe5('0x3a')]({},_0x2a31c0,_0x1c3e08[_0x7fe5('0x3b')]);return db['CmHopperFinal'][_0x7fe5('0x43')](_0x2a31c0)[_0x7fe5('0x23')](handleEntityNotFound(_0x2fd004,null))[_0x7fe5('0x23')](respondWithResult(_0x2fd004,null))['catch'](handleError(_0x2fd004,null));};exports[_0x7fe5('0x44')]=function(_0x38e470,_0x3efc98){return db['CmHopperFinal'][_0x7fe5('0x44')]()[_0x7fe5('0x23')](respondWithResult(_0x3efc98,null))[_0x7fe5('0x3e')](handleError(_0x3efc98,null));};exports['update']=function(_0x19c4a6,_0x211933){if(_0x19c4a6[_0x7fe5('0x45')][_0x7fe5('0x46')]){delete _0x19c4a6[_0x7fe5('0x45')][_0x7fe5('0x46')];}return db[_0x7fe5('0x3c')][_0x7fe5('0x43')]({'where':{'uniqueid':_0x19c4a6[_0x7fe5('0x47')]['id']}})[_0x7fe5('0x23')](handleEntityNotFound(_0x211933,null))[_0x7fe5('0x23')](saveUpdates(_0x19c4a6['body'],null))['then'](respondWithResult(_0x211933,null))['catch'](handleError(_0x211933,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x402c09,_0x5c4f3e,_0x31a345){return db[_0x7fe5('0x3c')][_0x7fe5('0x48')]({'raw':![],'where':{'VoiceQueueId':_0x402c09[_0x7fe5('0x47')]['id']},'attributes':[[db[_0x7fe5('0x49')]['fn']('COUNT',db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x4b')))),_0x7fe5('0x4c')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x7fe5('0x4e')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0x7fe5('0x4f')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x50')))),'congestionContacts'],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7fe5('0x51')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x52')))),_0x7fe5('0x53')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x54')))),_0x7fe5('0x55')],[db[_0x7fe5('0x49')]['fn']('COUNT',db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7fe5('0x23')](handleEntityNotFound(_0x5c4f3e,null))['then'](respondWithResult(_0x5c4f3e,null))[_0x7fe5('0x3e')](handleError(_0x5c4f3e,null));};exports[_0x7fe5('0x56')]=function(_0x491702,_0x16deb8,_0x47c811){return db[_0x7fe5('0x3c')][_0x7fe5('0x48')]({'raw':![],'where':{'CampaignId':_0x491702[_0x7fe5('0x47')]['id']},'attributes':[[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize']['literal'](_0x7fe5('0x4b')))),_0x7fe5('0x4c')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x57')))),_0x7fe5('0x4e')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db['sequelize']['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x58')))),_0x7fe5('0x4f')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x50')))),_0x7fe5('0x59')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7fe5('0x51')],[db['sequelize']['fn'](_0x7fe5('0x4d'),db['sequelize']['fn']('IF',db[_0x7fe5('0x49')][_0x7fe5('0x4a')](_0x7fe5('0x52')))),_0x7fe5('0x53')],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db[_0x7fe5('0x49')]['literal'](_0x7fe5('0x54')))),'reCallContacts'],[db[_0x7fe5('0x49')]['fn'](_0x7fe5('0x4d'),db[_0x7fe5('0x49')]['fn']('IF',db['sequelize'][_0x7fe5('0x4a')](_0x7fe5('0x5a')))),_0x7fe5('0x5b')]]})[_0x7fe5('0x23')](handleEntityNotFound(_0x16deb8,null))[_0x7fe5('0x23')](respondWithResult(_0x16deb8,null))[_0x7fe5('0x3e')](handleError(_0x16deb8,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2bf9ed,_0x46d509,_0x4b0d01){return db[_0x7fe5('0x5c')][_0x7fe5('0x43')]({'where':{'id':_0x2bf9ed['params']['id']}})[_0x7fe5('0x23')](handleEntityNotFound(_0x46d509,null))['then'](function(_0x128d4d){var _0x3577be;if(_0x128d4d){_0x3577be=squel[_0x7fe5('0x5d')]()[_0x7fe5('0x5e')](_0x7fe5('0x5f'))['fromQuery']([_0x7fe5('0x60'),'scheduledAt',_0x7fe5('0x61'),_0x7fe5('0x62'),_0x7fe5('0x63'),_0x7fe5('0x64'),'updatedAt'],squel[_0x7fe5('0x65')]()['field'](_0x7fe5('0x66'),_0x7fe5('0x60'))['field'](_0x7fe5('0x67'),_0x7fe5('0x68'))['field'](_0x7fe5('0x69'),_0x7fe5('0x61'))[_0x7fe5('0x6a')]('ANY_VALUE(ListId)',_0x7fe5('0x62'))[_0x7fe5('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x7fe5('0x63'))[_0x7fe5('0x6a')]('NOW()',_0x7fe5('0x64'))['field']('NOW()',_0x7fe5('0x6b'))[_0x7fe5('0x6c')]('cm_hopper_final')['where'](_0x7fe5('0x6d'),_0x2bf9ed['params']['id'][_0x7fe5('0x6e')]())['where'](_0x7fe5('0x6f'),_0x2bf9ed[_0x7fe5('0x45')][_0x7fe5('0x70')][_0x7fe5('0x6e')]())[_0x7fe5('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')](_0x7fe5('0x60'))[_0x7fe5('0x6c')](_0x7fe5('0x5f'))[_0x7fe5('0x38')](_0x7fe5('0x6d'),_0x2bf9ed[_0x7fe5('0x47')]['id']['toString']()))[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')](_0x7fe5('0x72'))['from'](_0x7fe5('0x73'))[_0x7fe5('0x38')](_0x7fe5('0x6d'),_0x2bf9ed[_0x7fe5('0x47')]['id'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')](_0x7fe5('0x74')))[_0x7fe5('0x75')](_0x7fe5('0x61')))[_0x7fe5('0x6e')]();return db[_0x7fe5('0x49')]['query'](_0x3577be);}return[];})[_0x7fe5('0x23')](respondWithResult(_0x46d509,null))[_0x7fe5('0x3e')](handleError(_0x46d509,null));};exports[_0x7fe5('0x76')]=function(_0x2d44c4,_0x22caf8,_0x53ee9f){return db[_0x7fe5('0x77')][_0x7fe5('0x43')]({'where':{'id':_0x2d44c4[_0x7fe5('0x47')]['id']}})['then'](handleEntityNotFound(_0x22caf8,null))['then'](function(_0x4a85c8){var _0x45c599;if(_0x4a85c8){_0x45c599=squel[_0x7fe5('0x5d')]()[_0x7fe5('0x5e')](_0x7fe5('0x5f'))['fromQuery']([_0x7fe5('0x60'),_0x7fe5('0x68'),'ContactId','ListId',_0x7fe5('0x78'),_0x7fe5('0x64'),_0x7fe5('0x6b')],squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')]('ANY_VALUE(calleridnum)',_0x7fe5('0x60'))['field'](_0x7fe5('0x67'),_0x7fe5('0x68'))[_0x7fe5('0x6a')](_0x7fe5('0x69'),_0x7fe5('0x61'))[_0x7fe5('0x6a')](_0x7fe5('0x79'),_0x7fe5('0x62'))[_0x7fe5('0x6a')](_0x7fe5('0x7a'),_0x7fe5('0x78'))['field'](_0x7fe5('0x67'),_0x7fe5('0x64'))[_0x7fe5('0x6a')](_0x7fe5('0x67'),_0x7fe5('0x6b'))[_0x7fe5('0x6c')]('cm_hopper_final')[_0x7fe5('0x38')](_0x7fe5('0x7b'),_0x2d44c4[_0x7fe5('0x47')]['id'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')]('state\x20=\x20?',_0x2d44c4['body']['state'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')](_0x7fe5('0x7c'))[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()[_0x7fe5('0x6a')](_0x7fe5('0x60'))[_0x7fe5('0x6c')](_0x7fe5('0x5f'))['where'](_0x7fe5('0x7b'),_0x2d44c4['params']['id']['toString']()))[_0x7fe5('0x38')](_0x7fe5('0x71'),squel[_0x7fe5('0x65')]()['field'](_0x7fe5('0x72'))['from']('cm_hopper_final')[_0x7fe5('0x38')](_0x7fe5('0x7b'),_0x2d44c4[_0x7fe5('0x47')]['id'][_0x7fe5('0x6e')]())[_0x7fe5('0x38')](_0x7fe5('0x74')))[_0x7fe5('0x75')](_0x7fe5('0x61')))[_0x7fe5('0x6e')]();return db[_0x7fe5('0x49')]['query'](_0x45c599);}return[];})[_0x7fe5('0x23')](respondWithResult(_0x22caf8,null))[_0x7fe5('0x3e')](handleError(_0x22caf8,null));};exports[_0x7fe5('0x7d')]=function(_0x448514,_0x4e082b,_0x21a6fb){return db[_0x7fe5('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x448514[_0x7fe5('0x45')][_0x7fe5('0x63')],'CampaignId':_0x448514[_0x7fe5('0x45')][_0x7fe5('0x78')],'ContactId':_0x448514[_0x7fe5('0x45')][_0x7fe5('0x61')]}})[_0x7fe5('0x23')](handleEntityNotFound(_0x4e082b,null))[_0x7fe5('0x23')](function(_0x55f461){if(_0x55f461){return _0x55f461;}return null;})[_0x7fe5('0x23')](respondWithResult(_0x4e082b,null))[_0x7fe5('0x3e')](handleError(_0x4e082b,null));}; \ No newline at end of file +var _0x826a=['`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','insert','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts'];(function(_0x105ff0,_0x53f35b){var _0xbc927f=function(_0x182c83){while(--_0x182c83){_0x105ff0['push'](_0x105ff0['shift']());}};_0xbc927f(++_0x53f35b);}(_0x826a,0x1aa));var _0xa826=function(_0x229f4a,_0x3045d1){_0x229f4a=_0x229f4a-0x0;var _0xf2c5d7=_0x826a[_0x229f4a];return _0xf2c5d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa826('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa826('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa826('0x2'));var moment=require(_0xa826('0x3'));var BPromise=require(_0xa826('0x4'));var Mustache=require(_0xa826('0x5'));var util=require('util');var path=require(_0xa826('0x6'));var sox=require(_0xa826('0x7'));var csv=require(_0xa826('0x8'));var ejs=require(_0xa826('0x9'));var fs=require('fs');var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x8'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var as=require(_0xa826('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa826('0x15'))('api');var utils=require(_0xa826('0x16'));var config=require(_0xa826('0x17'));var licenseUtil=require(_0xa826('0x18'));var db=require(_0xa826('0x19'))['db'];function respondWithStatusCode(_0x212fac,_0x40838f){_0x40838f=_0x40838f||0xcc;return function(_0x2f1d39){if(_0x2f1d39){return _0x212fac['sendStatus'](_0x40838f);}return _0x212fac[_0xa826('0x1a')](_0x40838f)['end']();};}function respondWithResult(_0x3e99b0,_0x41c0c2){_0x41c0c2=_0x41c0c2||0xc8;return function(_0x5dc0c7){if(_0x5dc0c7){return _0x3e99b0['status'](_0x41c0c2)['json'](_0x5dc0c7);}};}function respondWithFilteredResult(_0x1b6d16,_0x4f25bd){return function(_0x4c546b){if(_0x4c546b){var _0x9a3788=_0x4c546b[_0xa826('0x1b')],_0x142474=_0x4f25bd[_0xa826('0x1c')],_0x2e15e2=_0x4f25bd[_0xa826('0x1c')]+_0x4f25bd[_0xa826('0x1d')],_0x5832b9;if(_0x2e15e2>=_0x9a3788){_0x2e15e2=_0x9a3788;_0x5832b9=0xc8;}else{_0x5832b9=0xce;}_0x1b6d16[_0xa826('0x1a')](_0x5832b9);return _0x1b6d16['set'](_0xa826('0x1e'),_0x142474+'-'+_0x2e15e2+'/'+_0x9a3788)[_0xa826('0x1f')](_0x4c546b);}return null;};}function patchUpdates(_0x229b90){return function(_0x57e96e){try{jsonpatch['apply'](_0x57e96e,_0x229b90,!![]);}catch(_0x156127){return BPromise[_0xa826('0x20')](_0x156127);}return _0x57e96e[_0xa826('0x21')]();};}function saveUpdates(_0x8d1650,_0x124564){return function(_0x4e0f43){if(_0x4e0f43){return _0x4e0f43[_0xa826('0x22')](_0x8d1650)[_0xa826('0x23')](function(_0x3272fb){return _0x3272fb;});}return null;};}function removeEntity(_0x5d410f,_0x5ddeef){return function(_0x361ca5){if(_0x361ca5){return _0x361ca5[_0xa826('0x24')]()[_0xa826('0x23')](function(){_0x5d410f['status'](0xcc)[_0xa826('0x25')]();});}};}function handleEntityNotFound(_0x26ef25,_0x1d4ade){return function(_0x448b4d){if(!_0x448b4d){_0x26ef25[_0xa826('0x26')](0x194);}return _0x448b4d;};}function handleError(_0x4d6909,_0x13329a){_0x13329a=_0x13329a||0x1f4;return function(_0x4fa5db){logger[_0xa826('0x27')](_0x4fa5db[_0xa826('0x28')]);if(_0x4fa5db['name']){delete _0x4fa5db[_0xa826('0x29')];}_0x4d6909[_0xa826('0x1a')](_0x13329a)[_0xa826('0x2a')](_0x4fa5db);};}exports[_0xa826('0x2b')]=function(_0x1107a4,_0x3c6307){var _0x14e836={},_0x3b9c6d={},_0x36ded2={'count':0x0,'rows':[]};var _0x3d126c=_[_0xa826('0x2c')](db[_0xa826('0x2d')][_0xa826('0x2e')],function(_0x2cb586){return{'name':_0x2cb586[_0xa826('0x2f')],'type':_0x2cb586[_0xa826('0x30')]['key']};});_0x3b9c6d[_0xa826('0x31')]=_['map'](_0x3d126c,_0xa826('0x29'));_0x3b9c6d[_0xa826('0x32')]=_[_0xa826('0x33')](_0x1107a4[_0xa826('0x32')]);_0x3b9c6d[_0xa826('0x34')]=_['intersection'](_0x3b9c6d['model'],_0x3b9c6d[_0xa826('0x32')]);_0x14e836[_0xa826('0x35')]=_[_0xa826('0x36')](_0x3b9c6d[_0xa826('0x31')],qs['fields'](_0x1107a4[_0xa826('0x32')][_0xa826('0x37')]));_0x14e836['attributes']=_0x14e836[_0xa826('0x35')]['length']?_0x14e836[_0xa826('0x35')]:_0x3b9c6d[_0xa826('0x31')];if(!_0x1107a4[_0xa826('0x32')][_0xa826('0x38')](_0xa826('0x39'))){_0x14e836['limit']=qs[_0xa826('0x1d')](_0x1107a4[_0xa826('0x32')][_0xa826('0x1d')]);_0x14e836[_0xa826('0x1c')]=qs[_0xa826('0x1c')](_0x1107a4[_0xa826('0x32')][_0xa826('0x1c')]);}_0x14e836[_0xa826('0x3a')]=qs[_0xa826('0x3b')](_0x1107a4[_0xa826('0x32')][_0xa826('0x3b')]);_0x14e836['where']=qs[_0xa826('0x34')](_['pick'](_0x1107a4[_0xa826('0x32')],_0x3b9c6d['filters']),_0x3d126c);if(_0x1107a4[_0xa826('0x32')][_0xa826('0x3c')]){_0x14e836[_0xa826('0x3d')]=_[_0xa826('0x3e')](_0x14e836[_0xa826('0x3d')],{'$or':_[_0xa826('0x2c')](_0x3d126c,function(_0xf1e041){if(_0xf1e041[_0xa826('0x30')]!==_0xa826('0x3f')){var _0xb1a771={};_0xb1a771[_0xf1e041[_0xa826('0x29')]]={'$like':'%'+_0x1107a4[_0xa826('0x32')]['filter']+'%'};return _0xb1a771;}})});}_0x14e836=_[_0xa826('0x3e')]({},_0x14e836,_0x1107a4[_0xa826('0x40')]);var _0x251208={'where':_0x14e836['where']};return db[_0xa826('0x2d')][_0xa826('0x1b')](_0x251208)['then'](function(_0x1ceca5){_0x36ded2['count']=_0x1ceca5;if(_0x1107a4['query'][_0xa826('0x41')]){_0x14e836[_0xa826('0x42')]=[{'all':!![]}];}return db[_0xa826('0x2d')][_0xa826('0x43')](_0x14e836);})[_0xa826('0x23')](function(_0x322187){_0x36ded2['rows']=_0x322187;return _0x36ded2;})[_0xa826('0x23')](respondWithFilteredResult(_0x3c6307,_0x14e836))[_0xa826('0x44')](handleError(_0x3c6307,null));};exports[_0xa826('0x45')]=function(_0x14fc0d,_0x244fd3){var _0x19292e={'raw':!![],'where':{'id':_0x14fc0d[_0xa826('0x46')]['id']}},_0x5e9a3d={};_0x5e9a3d[_0xa826('0x31')]=_[_0xa826('0x33')](db[_0xa826('0x2d')][_0xa826('0x2e')]);_0x5e9a3d['query']=_[_0xa826('0x33')](_0x14fc0d[_0xa826('0x32')]);_0x5e9a3d[_0xa826('0x34')]=_[_0xa826('0x36')](_0x5e9a3d[_0xa826('0x31')],_0x5e9a3d[_0xa826('0x32')]);_0x19292e[_0xa826('0x35')]=_[_0xa826('0x36')](_0x5e9a3d[_0xa826('0x31')],qs[_0xa826('0x37')](_0x14fc0d[_0xa826('0x32')][_0xa826('0x37')]));_0x19292e['attributes']=_0x19292e[_0xa826('0x35')][_0xa826('0x47')]?_0x19292e[_0xa826('0x35')]:_0x5e9a3d['model'];if(_0x14fc0d[_0xa826('0x32')][_0xa826('0x41')]){_0x19292e[_0xa826('0x42')]=[{'all':!![]}];}_0x19292e=_[_0xa826('0x3e')]({},_0x19292e,_0x14fc0d[_0xa826('0x40')]);return db['CmHopperFinal'][_0xa826('0x48')](_0x19292e)[_0xa826('0x23')](handleEntityNotFound(_0x244fd3,null))[_0xa826('0x23')](respondWithResult(_0x244fd3,null))[_0xa826('0x44')](handleError(_0x244fd3,null));};exports[_0xa826('0x49')]=function(_0x30aac0,_0xe5b5e5){return db['CmHopperFinal'][_0xa826('0x49')]()['then'](respondWithResult(_0xe5b5e5,null))['catch'](handleError(_0xe5b5e5,null));};exports['update']=function(_0x26a858,_0x35d118){if(_0x26a858[_0xa826('0x4a')][_0xa826('0x4b')]){delete _0x26a858['body'][_0xa826('0x4b')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x26a858[_0xa826('0x46')]['id']}})[_0xa826('0x23')](handleEntityNotFound(_0x35d118,null))['then'](saveUpdates(_0x26a858[_0xa826('0x4a')],null))[_0xa826('0x23')](respondWithResult(_0x35d118,null))['catch'](handleError(_0x35d118,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5b238e,_0x4c469a,_0x5782a0){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5b238e[_0xa826('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xa826('0x4c'),db['sequelize']['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x4f')))),_0xa826('0x50')],[db[_0xa826('0x4d')]['fn']('COUNT',db[_0xa826('0x4d')]['fn']('IF',db['sequelize']['literal'](_0xa826('0x51')))),_0xa826('0x52')],[db['sequelize']['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')]['literal'](_0xa826('0x53')))),_0xa826('0x54')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x55')))),'congestionContacts'],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa826('0x56')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db['sequelize']['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa826('0x57')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x58')))),_0xa826('0x59')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db['sequelize'][_0xa826('0x4e')](_0xa826('0x5a')))),_0xa826('0x5b')]]})[_0xa826('0x23')](handleEntityNotFound(_0x4c469a,null))[_0xa826('0x23')](respondWithResult(_0x4c469a,null))[_0xa826('0x44')](handleError(_0x4c469a,null));};exports[_0xa826('0x5c')]=function(_0x50ec85,_0x53062c,_0x330789){return db[_0xa826('0x2d')][_0xa826('0x43')]({'raw':![],'where':{'CampaignId':_0x50ec85['params']['id']},'attributes':[[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db['sequelize']['literal'](_0xa826('0x4f')))),_0xa826('0x50')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db['sequelize']['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x51')))),_0xa826('0x52')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x55')))),_0xa826('0x5d')],[db[_0xa826('0x4d')]['fn']('COUNT',db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa826('0x56')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x5e')))),_0xa826('0x57')],[db[_0xa826('0x4d')]['fn'](_0xa826('0x4c'),db[_0xa826('0x4d')]['fn']('IF',db[_0xa826('0x4d')][_0xa826('0x4e')](_0xa826('0x58')))),_0xa826('0x59')],[db['sequelize']['fn'](_0xa826('0x4c'),db['sequelize']['fn']('IF',db[_0xa826('0x4d')]['literal'](_0xa826('0x5a')))),'answeringMachine']]})[_0xa826('0x23')](handleEntityNotFound(_0x53062c,null))[_0xa826('0x23')](respondWithResult(_0x53062c,null))[_0xa826('0x44')](handleError(_0x53062c,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5d41f8,_0x5ea2d2,_0x16222c){return db[_0xa826('0x5f')][_0xa826('0x48')]({'where':{'id':_0x5d41f8['params']['id']}})[_0xa826('0x23')](handleEntityNotFound(_0x5ea2d2,null))[_0xa826('0x23')](function(_0x19e39f){var _0x425fe2;if(_0x19e39f){_0x425fe2=squel['insert']()[_0xa826('0x60')](_0xa826('0x61'))[_0xa826('0x62')]([_0xa826('0x63'),_0xa826('0x64'),'ContactId','ListId',_0xa826('0x65'),_0xa826('0x66'),_0xa826('0x67')],squel[_0xa826('0x68')]()[_0xa826('0x69')]('ANY_VALUE(calleridnum)','phone')[_0xa826('0x69')](_0xa826('0x6a'),_0xa826('0x64'))[_0xa826('0x69')](_0xa826('0x6b'),_0xa826('0x6c'))['field'](_0xa826('0x6d'),'ListId')[_0xa826('0x69')](_0xa826('0x6e'),'VoiceQueueId')[_0xa826('0x69')]('NOW()',_0xa826('0x66'))['field'](_0xa826('0x6a'),_0xa826('0x67'))[_0xa826('0x6f')](_0xa826('0x70'))[_0xa826('0x3d')](_0xa826('0x71'),_0x5d41f8['params']['id']['toString']())[_0xa826('0x3d')]('state\x20=\x20?',_0x5d41f8[_0xa826('0x4a')][_0xa826('0x72')][_0xa826('0x73')]())['where'](_0xa826('0x74'))[_0xa826('0x3d')](_0xa826('0x75'),squel[_0xa826('0x68')]()[_0xa826('0x69')]('phone')[_0xa826('0x6f')](_0xa826('0x61'))[_0xa826('0x3d')](_0xa826('0x71'),_0x5d41f8[_0xa826('0x46')]['id'][_0xa826('0x73')]()))[_0xa826('0x3d')](_0xa826('0x75'),squel[_0xa826('0x68')]()[_0xa826('0x69')]('calleridnum')[_0xa826('0x6f')](_0xa826('0x70'))['where']('VoiceQueueId\x20=\x20?',_0x5d41f8[_0xa826('0x46')]['id'][_0xa826('0x73')]())['where'](_0xa826('0x76')))[_0xa826('0x77')](_0xa826('0x6c')))[_0xa826('0x73')]();return db['sequelize']['query'](_0x425fe2);}return[];})[_0xa826('0x23')](respondWithResult(_0x5ea2d2,null))[_0xa826('0x44')](handleError(_0x5ea2d2,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3447f5,_0x16510b,_0xfc6c6e){return db[_0xa826('0x78')][_0xa826('0x48')]({'where':{'id':_0x3447f5[_0xa826('0x46')]['id']}})[_0xa826('0x23')](handleEntityNotFound(_0x16510b,null))[_0xa826('0x23')](function(_0x4e7e2a){var _0xca2123;if(_0x4e7e2a){_0xca2123=squel[_0xa826('0x79')]()[_0xa826('0x60')](_0xa826('0x61'))['fromQuery']([_0xa826('0x63'),_0xa826('0x64'),_0xa826('0x6c'),_0xa826('0x7a'),_0xa826('0x7b'),_0xa826('0x66'),_0xa826('0x67')],squel['select']()[_0xa826('0x69')](_0xa826('0x7c'),_0xa826('0x63'))[_0xa826('0x69')](_0xa826('0x6a'),_0xa826('0x64'))['field'](_0xa826('0x6b'),_0xa826('0x6c'))[_0xa826('0x69')]('ANY_VALUE(ListId)',_0xa826('0x7a'))[_0xa826('0x69')](_0xa826('0x7d'),_0xa826('0x7b'))['field'](_0xa826('0x6a'),_0xa826('0x66'))['field'](_0xa826('0x6a'),'updatedAt')[_0xa826('0x6f')](_0xa826('0x70'))[_0xa826('0x3d')](_0xa826('0x7e'),_0x3447f5[_0xa826('0x46')]['id'][_0xa826('0x73')]())['where'](_0xa826('0x7f'),_0x3447f5[_0xa826('0x4a')][_0xa826('0x72')][_0xa826('0x73')]())['where'](_0xa826('0x74'))[_0xa826('0x3d')](_0xa826('0x75'),squel[_0xa826('0x68')]()[_0xa826('0x69')](_0xa826('0x63'))[_0xa826('0x6f')](_0xa826('0x61'))['where']('CampaignId\x20=\x20?',_0x3447f5[_0xa826('0x46')]['id'][_0xa826('0x73')]()))[_0xa826('0x3d')](_0xa826('0x75'),squel[_0xa826('0x68')]()['field']('calleridnum')[_0xa826('0x6f')]('cm_hopper_final')['where'](_0xa826('0x7e'),_0x3447f5[_0xa826('0x46')]['id'][_0xa826('0x73')]())[_0xa826('0x3d')]('state\x20=\x204'))['group'](_0xa826('0x6c')))[_0xa826('0x73')]();return db[_0xa826('0x4d')][_0xa826('0x32')](_0xca2123);}return[];})[_0xa826('0x23')](respondWithResult(_0x16510b,null))[_0xa826('0x44')](handleError(_0x16510b,null));};exports['checkContactHopper']=function(_0x89b7d3,_0x1cc899,_0x171b13){return db[_0xa826('0x80')][_0xa826('0x81')]({'where':{'VoiceQueueId':_0x89b7d3['body'][_0xa826('0x65')],'CampaignId':_0x89b7d3['body'][_0xa826('0x7b')],'ContactId':_0x89b7d3[_0xa826('0x4a')][_0xa826('0x6c')]}})[_0xa826('0x23')](handleEntityNotFound(_0x1cc899,null))[_0xa826('0x23')](function(_0x1ff7b8){if(_0x1ff7b8){return _0x1ff7b8;}return null;})[_0xa826('0x23')](respondWithResult(_0x1cc899,null))[_0xa826('0x44')](handleError(_0x1cc899,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 03dac04..aff5548 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 _0xa468=['api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x5d75b1,_0x58c4ea){var _0x4bd2c4=function(_0x284a06){while(--_0x284a06){_0x5d75b1['push'](_0x5d75b1['shift']());}};_0x4bd2c4(++_0x58c4ea);}(_0xa468,0xcf));var _0x8a46=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xa468[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x8a46('0x0'));var util=require(_0x8a46('0x1'));var logger=require(_0x8a46('0x2'))(_0x8a46('0x3'));var moment=require(_0x8a46('0x4'));var BPromise=require(_0x8a46('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a46('0x6'));var rimraf=require(_0x8a46('0x7'));var config=require(_0x8a46('0x8'));var attributes=require(_0x8a46('0x9'));module[_0x8a46('0xa')]=function(_0xf1129,_0xf12c98){return _0xf1129[_0x8a46('0xb')]('CmHopperFinal',attributes,{'tableName':_0x8a46('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x8a46('0xd')]},{'name':_0x8a46('0xe'),'fields':[_0x8a46('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94b5=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x94b5,0x10b));var _0x594b=function(_0x16def0,_0x3ddcfd){_0x16def0=_0x16def0-0x0;var _0x84af7b=_0x94b5[_0x16def0];return _0x84af7b;};'use strict';var _=require('lodash');var util=require(_0x594b('0x0'));var logger=require(_0x594b('0x1'))(_0x594b('0x2'));var moment=require(_0x594b('0x3'));var BPromise=require(_0x594b('0x4'));var rp=require(_0x594b('0x5'));var fs=require('fs');var path=require(_0x594b('0x6'));var rimraf=require(_0x594b('0x7'));var config=require(_0x594b('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0x594b('0x9')]=function(_0x35c62f,_0x2c80b5){return _0x35c62f['define'](_0x594b('0xa'),attributes,{'tableName':_0x594b('0xb'),'paranoid':![],'indexes':[{'name':_0x594b('0xc'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0x594b('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 15fc053..60df22a 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 _0x3ba6=['CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x3ba6,0x77));var _0x63ba=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x3ba6[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0x63ba('0x0'));var util=require('util');var moment=require(_0x63ba('0x1'));var BPromise=require(_0x63ba('0x2'));var rs=require(_0x63ba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63ba('0x4'))['db'];var utils=require(_0x63ba('0x5'));var logger=require(_0x63ba('0x6'))(_0x63ba('0x7'));var config=require(_0x63ba('0x8'));var jayson=require(_0x63ba('0x9'));var client=jayson[_0x63ba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x498633,_0x36cec9,_0x44bab4){return new BPromise(function(_0x4a063e,_0x28dd4b){return client['request'](_0x498633,_0x44bab4)[_0x63ba('0xb')](function(_0x315440){logger[_0x63ba('0xc')](_0x63ba('0xd'),_0x36cec9,_0x63ba('0xe'));logger[_0x63ba('0xf')](_0x63ba('0x10'),_0x36cec9,_0x63ba('0xe'),JSON[_0x63ba('0x11')](_0x315440));if(_0x315440[_0x63ba('0x12')]){if(_0x315440[_0x63ba('0x12')]['code']===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x36cec9,_0x315440[_0x63ba('0x12')][_0x63ba('0x13')]);return _0x28dd4b(_0x315440[_0x63ba('0x12')][_0x63ba('0x13')]);}logger[_0x63ba('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x36cec9,_0x315440[_0x63ba('0x12')][_0x63ba('0x13')]);return _0x4a063e(_0x315440[_0x63ba('0x12')]['message']);}else{logger[_0x63ba('0xc')](_0x63ba('0xd'),_0x36cec9,_0x63ba('0xe'));_0x4a063e(_0x315440[_0x63ba('0x14')][_0x63ba('0x13')]);}})[_0x63ba('0x15')](function(_0x1c26dc){logger[_0x63ba('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x36cec9,_0x1c26dc);_0x28dd4b(_0x1c26dc);});});}exports[_0x63ba('0x16')]=function(_0x2e8542){var _0x5e1e98=this;return new Promise(function(_0x56e414,_0x1840cb){return db[_0x63ba('0x17')]['create'](_0x2e8542[_0x63ba('0x18')],{'raw':_0x2e8542[_0x63ba('0x19')]?_0x2e8542[_0x63ba('0x19')][_0x63ba('0x1a')]===undefined?!![]:![]:!![]})[_0x63ba('0xb')](function(_0x9b1e7b){logger[_0x63ba('0xc')](_0x63ba('0x16'),_0x2e8542);logger[_0x63ba('0xf')]('CreateCmHopperFinal',_0x2e8542,JSON[_0x63ba('0x11')](_0x9b1e7b));_0x56e414(_0x9b1e7b);})[_0x63ba('0x15')](function(_0x3f2316){logger[_0x63ba('0x12')]('CreateCmHopperFinal',_0x3f2316[_0x63ba('0x13')],_0x2e8542);_0x1840cb(_0x5e1e98[_0x63ba('0x12')](0x1f4,_0x3f2316[_0x63ba('0x13')]));});});}; \ No newline at end of file +var _0x4a73=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopperFinal','create','body','options','raw','catch','CreateCmHopperFinal','util'];(function(_0x3d5e5d,_0x430add){var _0x1b2de9=function(_0x37141c){while(--_0x37141c){_0x3d5e5d['push'](_0x3d5e5d['shift']());}};_0x1b2de9(++_0x430add);}(_0x4a73,0x187));var _0x34a7=function(_0x45d240,_0x34912f){_0x45d240=_0x45d240-0x0;var _0x2562ff=_0x4a73[_0x45d240];return _0x2562ff;};'use strict';var _=require('lodash');var util=require(_0x34a7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x34a7('0x1'));var fs=require('fs');var Redis=require(_0x34a7('0x2'));var db=require(_0x34a7('0x3'))['db'];var utils=require(_0x34a7('0x4'));var logger=require(_0x34a7('0x5'))(_0x34a7('0x6'));var config=require(_0x34a7('0x7'));var jayson=require(_0x34a7('0x8'));var client=jayson[_0x34a7('0x9')][_0x34a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x523f06,_0x34c2a3,_0x2bb053){return new BPromise(function(_0xb17553,_0x46602e){return client['request'](_0x523f06,_0x2bb053)['then'](function(_0x591a8a){logger[_0x34a7('0xb')](_0x34a7('0xc'),_0x34c2a3,'request\x20sent');logger[_0x34a7('0xd')](_0x34a7('0xe'),_0x34c2a3,_0x34a7('0xf'),JSON[_0x34a7('0x10')](_0x591a8a));if(_0x591a8a['error']){if(_0x591a8a[_0x34a7('0x11')][_0x34a7('0x12')]===0x1f4){logger['error'](_0x34a7('0xc'),_0x34c2a3,_0x591a8a[_0x34a7('0x11')][_0x34a7('0x13')]);return _0x46602e(_0x591a8a[_0x34a7('0x11')][_0x34a7('0x13')]);}logger[_0x34a7('0x11')](_0x34a7('0xc'),_0x34c2a3,_0x591a8a[_0x34a7('0x11')]['message']);return _0xb17553(_0x591a8a[_0x34a7('0x11')][_0x34a7('0x13')]);}else{logger['info'](_0x34a7('0xc'),_0x34c2a3,'request\x20sent');_0xb17553(_0x591a8a[_0x34a7('0x14')][_0x34a7('0x13')]);}})['catch'](function(_0x3a9310){logger[_0x34a7('0x11')](_0x34a7('0xc'),_0x34c2a3,_0x3a9310);_0x46602e(_0x3a9310);});});}exports['CreateCmHopperFinal']=function(_0x233135){var _0x5b863b=this;return new Promise(function(_0xd51e33,_0x546872){return db[_0x34a7('0x15')][_0x34a7('0x16')](_0x233135[_0x34a7('0x17')],{'raw':_0x233135[_0x34a7('0x18')]?_0x233135['options'][_0x34a7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x7c6346){logger[_0x34a7('0xb')]('CreateCmHopperFinal',_0x233135);logger['debug']('CreateCmHopperFinal',_0x233135,JSON[_0x34a7('0x10')](_0x7c6346));_0xd51e33(_0x7c6346);})[_0x34a7('0x1a')](function(_0x2ba4af){logger['error'](_0x34a7('0x1b'),_0x2ba4af['message'],_0x233135);_0x546872(_0x5b863b['error'](0x1f4,_0x2ba4af[_0x34a7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 879dfab..fd435e2 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 _0x22cc=['/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x22cc,0x1d1));var _0xc22c=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x22cc[_0x2f6f50];return _0x2cf365;};'use strict';var multer=require(_0xc22c('0x0'));var util=require(_0xc22c('0x1'));var path=require(_0xc22c('0x2'));var timeout=require('connect-timeout');var express=require(_0xc22c('0x3'));var router=express['Router']();var auth=require(_0xc22c('0x4'));var interaction=require(_0xc22c('0x5'));var config=require('../../config/environment');var controller=require(_0xc22c('0x6'));router['get']('/',auth[_0xc22c('0x7')](),controller[_0xc22c('0x8')]);router[_0xc22c('0x9')](_0xc22c('0xa'),auth[_0xc22c('0x7')](),controller[_0xc22c('0xb')]);router[_0xc22c('0x9')](_0xc22c('0xc'),auth[_0xc22c('0x7')](),controller[_0xc22c('0xd')]);router[_0xc22c('0x9')](_0xc22c('0xe'),auth[_0xc22c('0x7')](),controller[_0xc22c('0xf')]);router[_0xc22c('0x9')](_0xc22c('0x10'),auth[_0xc22c('0x7')](),controller[_0xc22c('0x11')]);router[_0xc22c('0x12')](_0xc22c('0x13'),auth[_0xc22c('0x7')](),controller[_0xc22c('0x14')]);router[_0xc22c('0x12')](_0xc22c('0x15'),auth[_0xc22c('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xc22c('0x12')](_0xc22c('0x16'),auth['isAuthenticated'](),controller[_0xc22c('0x17')]);router[_0xc22c('0x18')](_0xc22c('0xc'),auth[_0xc22c('0x7')](),controller[_0xc22c('0x19')]);module[_0xc22c('0x1a')]=router; \ No newline at end of file +var _0xee27=['isAuthenticated','index','get','/describe','describe','/:id','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x31fcf2,_0x395280){var _0x3418ee=function(_0x33ff6d){while(--_0x33ff6d){_0x31fcf2['push'](_0x31fcf2['shift']());}};_0x3418ee(++_0x395280);}(_0xee27,0x1ee));var _0x7ee2=function(_0x5b6171,_0x59dc94){_0x5b6171=_0x5b6171-0x0;var _0x454329=_0xee27[_0x5b6171];return _0x454329;};'use strict';var multer=require(_0x7ee2('0x0'));var util=require(_0x7ee2('0x1'));var path=require(_0x7ee2('0x2'));var timeout=require(_0x7ee2('0x3'));var express=require(_0x7ee2('0x4'));var router=express[_0x7ee2('0x5')]();var auth=require(_0x7ee2('0x6'));var interaction=require(_0x7ee2('0x7'));var config=require(_0x7ee2('0x8'));var controller=require(_0x7ee2('0x9'));router['get']('/',auth[_0x7ee2('0xa')](),controller[_0x7ee2('0xb')]);router[_0x7ee2('0xc')](_0x7ee2('0xd'),auth[_0x7ee2('0xa')](),controller[_0x7ee2('0xe')]);router[_0x7ee2('0xc')](_0x7ee2('0xf'),auth[_0x7ee2('0xa')](),controller['show']);router['get'](_0x7ee2('0x10'),auth[_0x7ee2('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x7ee2('0xc')](_0x7ee2('0x11'),auth['isAuthenticated'](),controller[_0x7ee2('0x12')]);router[_0x7ee2('0x13')](_0x7ee2('0x14'),auth[_0x7ee2('0xa')](),controller[_0x7ee2('0x15')]);router['post'](_0x7ee2('0x16'),auth[_0x7ee2('0xa')](),controller[_0x7ee2('0x17')]);router[_0x7ee2('0x13')](_0x7ee2('0x18'),auth[_0x7ee2('0xa')](),controller[_0x7ee2('0x19')]);router[_0x7ee2('0x1a')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x7ee2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6c48f67..f8e98c0 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 _0xe628=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xe628,0x1bf));var _0x8e62=function(_0x149ad5,_0x12b417){_0x149ad5=_0x149ad5-0x0;var _0x2566b7=_0xe628[_0x149ad5];return _0x2566b7;};'use strict';var Sequelize=require(_0x8e62('0x0'));module['exports']={'state':{'type':Sequelize[_0x8e62('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8e62('0x2')]},'scheduledat':{'type':Sequelize[_0x8e62('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8e62('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x8e62('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8e62('0x2')]},'calleridnum':{'type':Sequelize[_0x8e62('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8e62('0x3')]},'responsetime':{'type':Sequelize[_0x8e62('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8e62('0x3')]},'endtime':{'type':Sequelize[_0x8e62('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8e62('0x2')]},'campaigntype':{'type':Sequelize[_0x8e62('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8e62('0x2')]},'amd':{'type':Sequelize[_0x8e62('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8e62('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8e62('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8e62('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8e62('0x3')]},'recallme':{'type':Sequelize[_0x8e62('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8e62('0x3')]},'edited':{'type':Sequelize[_0x8e62('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8e62('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4271=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x4271,0x108));var _0x1427=function(_0x291df7,_0x4d98bf){_0x291df7=_0x291df7-0x0;var _0x5c10cd=_0x4271[_0x291df7];return _0x5c10cd;};'use strict';var Sequelize=require(_0x1427('0x0'));module[_0x1427('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1427('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1427('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x1427('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1427('0x2')]},'calleridnum':{'type':Sequelize[_0x1427('0x2')]},'calleridname':{'type':Sequelize[_0x1427('0x2')]},'starttime':{'type':Sequelize[_0x1427('0x4')]},'responsetime':{'type':Sequelize[_0x1427('0x4')]},'answertime':{'type':Sequelize[_0x1427('0x4')]},'droptime':{'type':Sequelize[_0x1427('0x4')]},'endtime':{'type':Sequelize[_0x1427('0x4')]},'ringtime':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1427('0x2')]},'campaign':{'type':Sequelize[_0x1427('0x2')]},'campaigntype':{'type':Sequelize[_0x1427('0x2')]},'membername':{'type':Sequelize[_0x1427('0x2')]},'reason':{'type':Sequelize[_0x1427('0x2')]},'amd':{'type':Sequelize[_0x1427('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1427('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1427('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1427('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1427('0x4')]},'recallme':{'type':Sequelize[_0x1427('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1427('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1427('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index b0e1396..491984f 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 _0x3b50=['describe','body','uniqueid','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create'];(function(_0x53ebec,_0x2b6254){var _0x441f4f=function(_0x120ca1){while(--_0x120ca1){_0x53ebec['push'](_0x53ebec['shift']());}};_0x441f4f(++_0x2b6254);}(_0x3b50,0x12f));var _0x03b5=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3b50[_0x3de8a4];return _0x4635cf;};'use strict';var pdf=require(_0x03b5('0x0'));var emlformat=require(_0x03b5('0x1'));var rimraf=require(_0x03b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x03b5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03b5('0x4'));var util=require(_0x03b5('0x5'));var path=require(_0x03b5('0x6'));var sox=require(_0x03b5('0x7'));var csv=require(_0x03b5('0x8'));var ejs=require(_0x03b5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x03b5('0xa'));var jsforce=require(_0x03b5('0xb'));var deskjs=require(_0x03b5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x03b5('0xd'));var Papa=require(_0x03b5('0xe'));var Redis=require(_0x03b5('0xf'));var authService=require(_0x03b5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03b5('0x11'));var logger=require(_0x03b5('0x12'))(_0x03b5('0x13'));var utils=require(_0x03b5('0x14'));var config=require(_0x03b5('0x15'));var licenseUtil=require(_0x03b5('0x16'));var db=require(_0x03b5('0x17'))['db'];function respondWithStatusCode(_0x128e29,_0x5a24d8){_0x5a24d8=_0x5a24d8||0xcc;return function(_0x3c0931){if(_0x3c0931){return _0x128e29[_0x03b5('0x18')](_0x5a24d8);}return _0x128e29['status'](_0x5a24d8)[_0x03b5('0x19')]();};}function respondWithResult(_0x40cb40,_0x48e077){_0x48e077=_0x48e077||0xc8;return function(_0x3c7623){if(_0x3c7623){return _0x40cb40[_0x03b5('0x1a')](_0x48e077)[_0x03b5('0x1b')](_0x3c7623);}};}function respondWithFilteredResult(_0x15df45,_0x3c82d1){return function(_0x4fe248){if(_0x4fe248){var _0x1c6c00=_0x4fe248[_0x03b5('0x1c')],_0x34df56=_0x3c82d1[_0x03b5('0x1d')],_0x3a1b8b=_0x3c82d1[_0x03b5('0x1d')]+_0x3c82d1['limit'],_0x3327fc;if(_0x3a1b8b>=_0x1c6c00){_0x3a1b8b=_0x1c6c00;_0x3327fc=0xc8;}else{_0x3327fc=0xce;}_0x15df45[_0x03b5('0x1a')](_0x3327fc);return _0x15df45[_0x03b5('0x1e')](_0x03b5('0x1f'),_0x34df56+'-'+_0x3a1b8b+'/'+_0x1c6c00)['json'](_0x4fe248);}return null;};}function patchUpdates(_0x136b0b){return function(_0x1b4f35){try{jsonpatch[_0x03b5('0x20')](_0x1b4f35,_0x136b0b,!![]);}catch(_0x4de4b9){return BPromise['reject'](_0x4de4b9);}return _0x1b4f35[_0x03b5('0x21')]();};}function saveUpdates(_0x37fd03,_0x58207e){return function(_0x2eec1f){if(_0x2eec1f){return _0x2eec1f[_0x03b5('0x22')](_0x37fd03)['then'](function(_0x1074e4){return _0x1074e4;});}return null;};}function removeEntity(_0x85b760,_0x16c1f0){return function(_0x2bfd28){if(_0x2bfd28){return _0x2bfd28[_0x03b5('0x23')]()[_0x03b5('0x24')](function(){_0x85b760[_0x03b5('0x1a')](0xcc)[_0x03b5('0x19')]();});}};}function handleEntityNotFound(_0x16cf9b,_0xe8e3b4){return function(_0x3033cc){if(!_0x3033cc){_0x16cf9b[_0x03b5('0x18')](0x194);}return _0x3033cc;};}function handleError(_0x513345,_0x13ccde){_0x13ccde=_0x13ccde||0x1f4;return function(_0x39ac7b){logger['error'](_0x39ac7b[_0x03b5('0x25')]);if(_0x39ac7b['name']){delete _0x39ac7b[_0x03b5('0x26')];}_0x513345[_0x03b5('0x1a')](_0x13ccde)[_0x03b5('0x27')](_0x39ac7b);};}exports[_0x03b5('0x28')]=function(_0x268fab,_0x452ad4){var _0x1c8f8a={},_0x346dbf={},_0x90e30f={'count':0x0,'rows':[]};var _0x1f0ec9=_[_0x03b5('0x29')](db[_0x03b5('0x2a')]['rawAttributes'],function(_0x5526a5){return{'name':_0x5526a5[_0x03b5('0x2b')],'type':_0x5526a5[_0x03b5('0x2c')][_0x03b5('0x2d')]};});_0x346dbf['model']=_[_0x03b5('0x29')](_0x1f0ec9,_0x03b5('0x26'));_0x346dbf[_0x03b5('0x2e')]=_[_0x03b5('0x2f')](_0x268fab[_0x03b5('0x2e')]);_0x346dbf['filters']=_[_0x03b5('0x30')](_0x346dbf[_0x03b5('0x31')],_0x346dbf[_0x03b5('0x2e')]);_0x1c8f8a[_0x03b5('0x32')]=_[_0x03b5('0x30')](_0x346dbf[_0x03b5('0x31')],qs[_0x03b5('0x33')](_0x268fab[_0x03b5('0x2e')][_0x03b5('0x33')]));_0x1c8f8a['attributes']=_0x1c8f8a['attributes'][_0x03b5('0x34')]?_0x1c8f8a[_0x03b5('0x32')]:_0x346dbf[_0x03b5('0x31')];if(!_0x268fab[_0x03b5('0x2e')][_0x03b5('0x35')](_0x03b5('0x36'))){_0x1c8f8a[_0x03b5('0x37')]=qs[_0x03b5('0x37')](_0x268fab['query'][_0x03b5('0x37')]);_0x1c8f8a[_0x03b5('0x1d')]=qs[_0x03b5('0x1d')](_0x268fab[_0x03b5('0x2e')][_0x03b5('0x1d')]);}_0x1c8f8a['order']=qs[_0x03b5('0x38')](_0x268fab['query']['sort']);_0x1c8f8a[_0x03b5('0x39')]=qs['filters'](_[_0x03b5('0x3a')](_0x268fab[_0x03b5('0x2e')],_0x346dbf[_0x03b5('0x3b')]),_0x1f0ec9);if(_0x268fab['query'][_0x03b5('0x3c')]){_0x1c8f8a[_0x03b5('0x39')]=_[_0x03b5('0x3d')](_0x1c8f8a['where'],{'$or':_[_0x03b5('0x29')](_0x1f0ec9,function(_0x228fd9){if(_0x228fd9['type']!==_0x03b5('0x3e')){var _0x3577d7={};_0x3577d7[_0x228fd9[_0x03b5('0x26')]]={'$like':'%'+_0x268fab['query'][_0x03b5('0x3c')]+'%'};return _0x3577d7;}})});}_0x1c8f8a=_[_0x03b5('0x3d')]({},_0x1c8f8a,_0x268fab[_0x03b5('0x3f')]);var _0x27aa47={'where':_0x1c8f8a[_0x03b5('0x39')]};return db[_0x03b5('0x2a')][_0x03b5('0x1c')](_0x27aa47)['then'](function(_0xfe4bf6){_0x90e30f[_0x03b5('0x1c')]=_0xfe4bf6;if(_0x268fab[_0x03b5('0x2e')][_0x03b5('0x40')]){_0x1c8f8a[_0x03b5('0x41')]=[{'all':!![]}];}return db[_0x03b5('0x2a')]['findAll'](_0x1c8f8a);})[_0x03b5('0x24')](function(_0x5e3256){_0x90e30f['rows']=_0x5e3256;return _0x90e30f;})[_0x03b5('0x24')](respondWithFilteredResult(_0x452ad4,_0x1c8f8a))[_0x03b5('0x42')](handleError(_0x452ad4,null));};exports[_0x03b5('0x43')]=function(_0x1dec05,_0x1c55b6){var _0x149ff7={'raw':!![],'where':{'id':_0x1dec05[_0x03b5('0x44')]['id']}},_0x307b20={};_0x307b20[_0x03b5('0x31')]=_[_0x03b5('0x2f')](db['CmHopperHistory'][_0x03b5('0x45')]);_0x307b20[_0x03b5('0x2e')]=_[_0x03b5('0x2f')](_0x1dec05['query']);_0x307b20['filters']=_[_0x03b5('0x30')](_0x307b20['model'],_0x307b20[_0x03b5('0x2e')]);_0x149ff7[_0x03b5('0x32')]=_[_0x03b5('0x30')](_0x307b20[_0x03b5('0x31')],qs[_0x03b5('0x33')](_0x1dec05[_0x03b5('0x2e')]['fields']));_0x149ff7['attributes']=_0x149ff7[_0x03b5('0x32')]['length']?_0x149ff7['attributes']:_0x307b20[_0x03b5('0x31')];if(_0x1dec05['query'][_0x03b5('0x40')]){_0x149ff7['include']=[{'all':!![]}];}_0x149ff7=_[_0x03b5('0x3d')]({},_0x149ff7,_0x1dec05[_0x03b5('0x3f')]);return db['CmHopperHistory'][_0x03b5('0x46')](_0x149ff7)[_0x03b5('0x24')](handleEntityNotFound(_0x1c55b6,null))['then'](respondWithResult(_0x1c55b6,null))['catch'](handleError(_0x1c55b6,null));};exports[_0x03b5('0x47')]=function(_0x33989c,_0x144e38){return db['CmHopperHistory']['create'](_0x33989c['body'],{})[_0x03b5('0x24')](respondWithResult(_0x144e38,0xc9))[_0x03b5('0x42')](handleError(_0x144e38,null));};exports[_0x03b5('0x48')]=function(_0x3d2b6a,_0x3a6195){return db[_0x03b5('0x2a')][_0x03b5('0x48')]()['then'](respondWithResult(_0x3a6195,null))['catch'](handleError(_0x3a6195,null));};exports[_0x03b5('0x22')]=function(_0x112b73,_0x5f2c6b){if(_0x112b73[_0x03b5('0x49')][_0x03b5('0x4a')]){delete _0x112b73[_0x03b5('0x49')]['uniqueid'];}return db[_0x03b5('0x2a')]['find']({'where':{'uniqueid':_0x112b73[_0x03b5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f2c6b,null))['then'](saveUpdates(_0x112b73[_0x03b5('0x49')],null))['then'](respondWithResult(_0x5f2c6b,null))['catch'](handleError(_0x5f2c6b,null));}; \ No newline at end of file +var _0x5833=['update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','create','body','describe','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save'];(function(_0x20033f,_0x1e2dc0){var _0x3e8084=function(_0xaae64b){while(--_0xaae64b){_0x20033f['push'](_0x20033f['shift']());}};_0x3e8084(++_0x1e2dc0);}(_0x5833,0x15d));var _0x3583=function(_0x433fc0,_0x8d5066){_0x433fc0=_0x433fc0-0x0;var _0x2f5819=_0x5833[_0x433fc0];return _0x2f5819;};'use strict';var pdf=require(_0x3583('0x0'));var emlformat=require(_0x3583('0x1'));var rimraf=require(_0x3583('0x2'));var zipdir=require(_0x3583('0x3'));var jsonpatch=require(_0x3583('0x4'));var rp=require(_0x3583('0x5'));var moment=require(_0x3583('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3583('0x7'));var path=require(_0x3583('0x8'));var sox=require(_0x3583('0x9'));var csv=require(_0x3583('0xa'));var ejs=require(_0x3583('0xb'));var fs=require('fs');var _=require(_0x3583('0xc'));var squel=require('squel');var crypto=require(_0x3583('0xd'));var jsforce=require(_0x3583('0xe'));var deskjs=require(_0x3583('0xf'));var toCsv=require(_0x3583('0xa'));var querystring=require(_0x3583('0x10'));var Papa=require(_0x3583('0x11'));var Redis=require(_0x3583('0x12'));var authService=require(_0x3583('0x13'));var qs=require(_0x3583('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3583('0x15'));var logger=require(_0x3583('0x16'))(_0x3583('0x17'));var utils=require(_0x3583('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3583('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1841b0,_0x4b5557){_0x4b5557=_0x4b5557||0xcc;return function(_0x56d607){if(_0x56d607){return _0x1841b0[_0x3583('0x1a')](_0x4b5557);}return _0x1841b0[_0x3583('0x1b')](_0x4b5557)[_0x3583('0x1c')]();};}function respondWithResult(_0x17402,_0x30661e){_0x30661e=_0x30661e||0xc8;return function(_0x43c3e8){if(_0x43c3e8){return _0x17402['status'](_0x30661e)[_0x3583('0x1d')](_0x43c3e8);}};}function respondWithFilteredResult(_0x1d00b2,_0x1750f4){return function(_0x489395){if(_0x489395){var _0x500932=_0x489395[_0x3583('0x1e')],_0x5017bf=_0x1750f4[_0x3583('0x1f')],_0x5367e0=_0x1750f4['offset']+_0x1750f4[_0x3583('0x20')],_0x5ab6c6;if(_0x5367e0>=_0x500932){_0x5367e0=_0x500932;_0x5ab6c6=0xc8;}else{_0x5ab6c6=0xce;}_0x1d00b2[_0x3583('0x1b')](_0x5ab6c6);return _0x1d00b2[_0x3583('0x21')](_0x3583('0x22'),_0x5017bf+'-'+_0x5367e0+'/'+_0x500932)[_0x3583('0x1d')](_0x489395);}return null;};}function patchUpdates(_0x5c811d){return function(_0xda4e21){try{jsonpatch['apply'](_0xda4e21,_0x5c811d,!![]);}catch(_0x52a634){return BPromise['reject'](_0x52a634);}return _0xda4e21[_0x3583('0x23')]();};}function saveUpdates(_0x377e83,_0x22e0f7){return function(_0x5a61dc){if(_0x5a61dc){return _0x5a61dc[_0x3583('0x24')](_0x377e83)[_0x3583('0x25')](function(_0x7a3452){return _0x7a3452;});}return null;};}function removeEntity(_0x3638b2,_0xd6ec1f){return function(_0xe97890){if(_0xe97890){return _0xe97890[_0x3583('0x26')]()[_0x3583('0x25')](function(){_0x3638b2[_0x3583('0x1b')](0xcc)[_0x3583('0x1c')]();});}};}function handleEntityNotFound(_0x3787f1,_0x24914b){return function(_0x316f67){if(!_0x316f67){_0x3787f1['sendStatus'](0x194);}return _0x316f67;};}function handleError(_0x58d280,_0x323fff){_0x323fff=_0x323fff||0x1f4;return function(_0x5a2799){logger[_0x3583('0x27')](_0x5a2799[_0x3583('0x28')]);if(_0x5a2799[_0x3583('0x29')]){delete _0x5a2799[_0x3583('0x29')];}_0x58d280[_0x3583('0x1b')](_0x323fff)[_0x3583('0x2a')](_0x5a2799);};}exports[_0x3583('0x2b')]=function(_0x59716e,_0x2536f8){var _0x45e5e2={},_0x2a07e9={},_0x12587b={'count':0x0,'rows':[]};var _0xffc2f8=_[_0x3583('0x2c')](db[_0x3583('0x2d')][_0x3583('0x2e')],function(_0x11d1b9){return{'name':_0x11d1b9[_0x3583('0x2f')],'type':_0x11d1b9[_0x3583('0x30')][_0x3583('0x31')]};});_0x2a07e9[_0x3583('0x32')]=_[_0x3583('0x2c')](_0xffc2f8,_0x3583('0x29'));_0x2a07e9['query']=_[_0x3583('0x33')](_0x59716e[_0x3583('0x34')]);_0x2a07e9[_0x3583('0x35')]=_[_0x3583('0x36')](_0x2a07e9[_0x3583('0x32')],_0x2a07e9[_0x3583('0x34')]);_0x45e5e2[_0x3583('0x37')]=_[_0x3583('0x36')](_0x2a07e9[_0x3583('0x32')],qs['fields'](_0x59716e[_0x3583('0x34')]['fields']));_0x45e5e2[_0x3583('0x37')]=_0x45e5e2['attributes'][_0x3583('0x38')]?_0x45e5e2[_0x3583('0x37')]:_0x2a07e9[_0x3583('0x32')];if(!_0x59716e['query']['hasOwnProperty'](_0x3583('0x39'))){_0x45e5e2[_0x3583('0x20')]=qs[_0x3583('0x20')](_0x59716e[_0x3583('0x34')]['limit']);_0x45e5e2['offset']=qs['offset'](_0x59716e[_0x3583('0x34')]['offset']);}_0x45e5e2['order']=qs[_0x3583('0x3a')](_0x59716e['query'][_0x3583('0x3a')]);_0x45e5e2[_0x3583('0x3b')]=qs[_0x3583('0x35')](_[_0x3583('0x3c')](_0x59716e['query'],_0x2a07e9[_0x3583('0x35')]),_0xffc2f8);if(_0x59716e[_0x3583('0x34')][_0x3583('0x3d')]){_0x45e5e2[_0x3583('0x3b')]=_[_0x3583('0x3e')](_0x45e5e2[_0x3583('0x3b')],{'$or':_[_0x3583('0x2c')](_0xffc2f8,function(_0x1b1f25){if(_0x1b1f25['type']!==_0x3583('0x3f')){var _0x26a9b1={};_0x26a9b1[_0x1b1f25['name']]={'$like':'%'+_0x59716e[_0x3583('0x34')][_0x3583('0x3d')]+'%'};return _0x26a9b1;}})});}_0x45e5e2=_[_0x3583('0x3e')]({},_0x45e5e2,_0x59716e[_0x3583('0x40')]);var _0x35252d={'where':_0x45e5e2[_0x3583('0x3b')]};return db[_0x3583('0x2d')][_0x3583('0x1e')](_0x35252d)[_0x3583('0x25')](function(_0x1f659f){_0x12587b['count']=_0x1f659f;if(_0x59716e[_0x3583('0x34')][_0x3583('0x41')]){_0x45e5e2['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3583('0x42')](_0x45e5e2);})[_0x3583('0x25')](function(_0x4aca6a){_0x12587b[_0x3583('0x43')]=_0x4aca6a;return _0x12587b;})['then'](respondWithFilteredResult(_0x2536f8,_0x45e5e2))[_0x3583('0x44')](handleError(_0x2536f8,null));};exports[_0x3583('0x45')]=function(_0xbc9fc2,_0x50ede3){var _0x4b02af={'raw':!![],'where':{'id':_0xbc9fc2[_0x3583('0x46')]['id']}},_0x1fac4d={};_0x1fac4d['model']=_[_0x3583('0x33')](db[_0x3583('0x2d')][_0x3583('0x2e')]);_0x1fac4d['query']=_['keys'](_0xbc9fc2[_0x3583('0x34')]);_0x1fac4d[_0x3583('0x35')]=_['intersection'](_0x1fac4d['model'],_0x1fac4d['query']);_0x4b02af[_0x3583('0x37')]=_['intersection'](_0x1fac4d['model'],qs[_0x3583('0x47')](_0xbc9fc2[_0x3583('0x34')]['fields']));_0x4b02af[_0x3583('0x37')]=_0x4b02af[_0x3583('0x37')][_0x3583('0x38')]?_0x4b02af[_0x3583('0x37')]:_0x1fac4d['model'];if(_0xbc9fc2['query'][_0x3583('0x41')]){_0x4b02af['include']=[{'all':!![]}];}_0x4b02af=_['merge']({},_0x4b02af,_0xbc9fc2['options']);return db[_0x3583('0x2d')]['find'](_0x4b02af)[_0x3583('0x25')](handleEntityNotFound(_0x50ede3,null))['then'](respondWithResult(_0x50ede3,null))[_0x3583('0x44')](handleError(_0x50ede3,null));};exports['create']=function(_0x2ab6c6,_0x392088){return db[_0x3583('0x2d')][_0x3583('0x48')](_0x2ab6c6[_0x3583('0x49')],{})['then'](respondWithResult(_0x392088,0xc9))['catch'](handleError(_0x392088,null));};exports[_0x3583('0x4a')]=function(_0xfd2415,_0x1f272b){return db[_0x3583('0x2d')]['describe']()[_0x3583('0x25')](respondWithResult(_0x1f272b,null))['catch'](handleError(_0x1f272b,null));};exports[_0x3583('0x24')]=function(_0x34a869,_0x6814ed){if(_0x34a869['body'][_0x3583('0x4b')]){delete _0x34a869[_0x3583('0x49')]['uniqueid'];}return db[_0x3583('0x2d')][_0x3583('0x4c')]({'where':{'uniqueid':_0x34a869[_0x3583('0x46')]['id']}})[_0x3583('0x25')](handleEntityNotFound(_0x6814ed,null))[_0x3583('0x25')](saveUpdates(_0x34a869['body'],null))['then'](respondWithResult(_0x6814ed,null))['catch'](handleError(_0x6814ed,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5396011..7009835 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 _0x967c=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment'];(function(_0x26921f,_0x1e40d9){var _0x46b9dc=function(_0x2053f0){while(--_0x2053f0){_0x26921f['push'](_0x26921f['shift']());}};_0x46b9dc(++_0x1e40d9);}(_0x967c,0x1de));var _0xc967=function(_0x1085bd,_0x82f656){_0x1085bd=_0x1085bd-0x0;var _0x2e8717=_0x967c[_0x1085bd];return _0x2e8717;};'use strict';var _=require(_0xc967('0x0'));var util=require('util');var logger=require(_0xc967('0x1'))('api');var moment=require(_0xc967('0x2'));var BPromise=require(_0xc967('0x3'));var rp=require(_0xc967('0x4'));var fs=require('fs');var path=require(_0xc967('0x5'));var rimraf=require('rimraf');var config=require(_0xc967('0x6'));var attributes=require(_0xc967('0x7'));module['exports']=function(_0x2099fb,_0x3254ec){return _0x2099fb[_0xc967('0x8')](_0xc967('0x9'),attributes,{'tableName':_0xc967('0xa'),'paranoid':![],'indexes':[{'name':_0xc967('0xb'),'fields':['endtime']},{'name':_0xc967('0xc'),'fields':[_0xc967('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b58=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0xc07a11,_0x1e4f70){var _0x4aa138=function(_0x3d2054){while(--_0x3d2054){_0xc07a11['push'](_0xc07a11['shift']());}};_0x4aa138(++_0x1e4f70);}(_0x7b58,0x1bd));var _0x87b5=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x7b58[_0x4e6eac];return _0x79f963;};'use strict';var _=require(_0x87b5('0x0'));var util=require(_0x87b5('0x1'));var logger=require(_0x87b5('0x2'))('api');var moment=require(_0x87b5('0x3'));var BPromise=require(_0x87b5('0x4'));var rp=require(_0x87b5('0x5'));var fs=require('fs');var path=require(_0x87b5('0x6'));var rimraf=require(_0x87b5('0x7'));var config=require(_0x87b5('0x8'));var attributes=require(_0x87b5('0x9'));module[_0x87b5('0xa')]=function(_0x5f49ba,_0x313b1b){return _0x5f49ba[_0x87b5('0xb')](_0x87b5('0xc'),attributes,{'tableName':_0x87b5('0xd'),'paranoid':![],'indexes':[{'name':_0x87b5('0xe'),'fields':[_0x87b5('0xe')]},{'name':_0x87b5('0xf'),'fields':[_0x87b5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 55efb44..0831e14 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 _0xacd3=['predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperHistory','create','options','AvgHandleTime','CmHopperHistory','findAll','raw','where','sequelize','col'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xacd3,0xc8));var _0x3acd=function(_0x917aac,_0x262a35){_0x917aac=_0x917aac-0x0;var _0x1133b5=_0xacd3[_0x917aac];return _0x1133b5;};'use strict';var _=require(_0x3acd('0x0'));var util=require(_0x3acd('0x1'));var moment=require('moment');var BPromise=require(_0x3acd('0x2'));var rs=require(_0x3acd('0x3'));var fs=require('fs');var Redis=require(_0x3acd('0x4'));var db=require(_0x3acd('0x5'))['db'];var utils=require(_0x3acd('0x6'));var logger=require(_0x3acd('0x7'))(_0x3acd('0x8'));var config=require(_0x3acd('0x9'));var jayson=require(_0x3acd('0xa'));var client=jayson[_0x3acd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30aac4,_0x10b215,_0x5e4661){return new BPromise(function(_0x3e82f4,_0xbd27af){return client[_0x3acd('0xc')](_0x30aac4,_0x5e4661)[_0x3acd('0xd')](function(_0x372e70){logger['info'](_0x3acd('0xe'),_0x10b215,_0x3acd('0xf'));logger[_0x3acd('0x10')](_0x3acd('0x11'),_0x10b215,_0x3acd('0xf'),JSON[_0x3acd('0x12')](_0x372e70));if(_0x372e70[_0x3acd('0x13')]){if(_0x372e70[_0x3acd('0x13')][_0x3acd('0x14')]===0x1f4){logger[_0x3acd('0x13')](_0x3acd('0xe'),_0x10b215,_0x372e70[_0x3acd('0x13')][_0x3acd('0x15')]);return _0xbd27af(_0x372e70[_0x3acd('0x13')]['message']);}logger[_0x3acd('0x13')](_0x3acd('0xe'),_0x10b215,_0x372e70['error'][_0x3acd('0x15')]);return _0x3e82f4(_0x372e70['error']['message']);}else{logger[_0x3acd('0x16')]('CmHopperHistory,\x20%s,\x20%s',_0x10b215,_0x3acd('0xf'));_0x3e82f4(_0x372e70['result'][_0x3acd('0x15')]);}})[_0x3acd('0x17')](function(_0xed05fa){logger[_0x3acd('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x10b215,_0xed05fa);_0xbd27af(_0xed05fa);});});}exports[_0x3acd('0x18')]=function(_0x2a6f8d){var _0x3dff57=this;return new Promise(function(_0x1fd172,_0x2dce42){return db['CmHopperHistory'][_0x3acd('0x19')](_0x2a6f8d['body'],{'raw':_0x2a6f8d[_0x3acd('0x1a')]?_0x2a6f8d[_0x3acd('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x3acd('0xd')](function(_0x3af34b){logger[_0x3acd('0x16')](_0x3acd('0x18'),_0x2a6f8d);logger[_0x3acd('0x10')](_0x3acd('0x18'),_0x2a6f8d,JSON[_0x3acd('0x12')](_0x3af34b));_0x1fd172(_0x3af34b);})[_0x3acd('0x17')](function(_0x98d8ec){logger[_0x3acd('0x13')](_0x3acd('0x18'),_0x98d8ec[_0x3acd('0x15')],_0x2a6f8d);_0x2dce42(_0x3dff57[_0x3acd('0x13')](0x1f4,_0x98d8ec[_0x3acd('0x15')]));});});};exports[_0x3acd('0x1b')]=function(_0x40eff1){var _0x1f24e7=this;return new Promise(function(_0x1785f1,_0x27394b){return db[_0x3acd('0x1c')][_0x3acd('0x1d')]({'raw':_0x40eff1['options']?_0x40eff1[_0x3acd('0x1a')][_0x3acd('0x1e')]===undefined?!![]:![]:!![],'where':_0x40eff1[_0x3acd('0x1a')]?_0x40eff1[_0x3acd('0x1a')][_0x3acd('0x1f')]||null:null,'attributes':[[db[_0x3acd('0x20')]['fn']('COUNT',db[_0x3acd('0x20')][_0x3acd('0x21')]('id')),_0x3acd('0x22')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db['sequelize'][_0x3acd('0x24')](_0x3acd('0x25')))),_0x3acd('0x26')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')]['literal'](_0x3acd('0x27')))),_0x3acd('0x28')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db['sequelize'][_0x3acd('0x24')](_0x3acd('0x29')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x3acd('0x2a'),db['sequelize']['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x2b')))),_0x3acd('0x2c')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x2a'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3acd('0x2d')]]})[_0x3acd('0xd')](function(_0x140ac5){logger[_0x3acd('0x16')](_0x3acd('0x1b'),_0x40eff1);logger['debug']('AvgHandleTime',_0x40eff1,JSON['stringify'](_0x140ac5));_0x1785f1(_0x140ac5);})[_0x3acd('0x17')](function(_0x226ef8){logger[_0x3acd('0x13')](_0x3acd('0x1b'),_0x226ef8[_0x3acd('0x15')],_0x40eff1);_0x27394b(_0x1f24e7[_0x3acd('0x13')](0x1f4,_0x226ef8[_0x3acd('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1cbe68){var _0x317d96=this;return new Promise(function(_0xa2e304,_0x4012c5){return db['CmHopperHistory'][_0x3acd('0x1d')]({'raw':_0x1cbe68[_0x3acd('0x1a')]?_0x1cbe68['options'][_0x3acd('0x1e')]===undefined?!![]:![]:!![],'where':_0x1cbe68[_0x3acd('0x1a')]?_0x1cbe68['options']['where']||null:null,'attributes':[[_0x3acd('0x2e'),_0x3acd('0x2f')],[db['sequelize']['fn'](_0x3acd('0x23'),db['sequelize']['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x30')))),_0x3acd('0x31')],[db['sequelize']['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')]['literal'](_0x3acd('0x32')))),_0x3acd('0x33')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db['sequelize'][_0x3acd('0x24')](_0x3acd('0x25')))),_0x3acd('0x34')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3acd('0x24')](_0x3acd('0x35')))),_0x3acd('0x36')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x37')))),_0x3acd('0x38')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x39')))),_0x3acd('0x3a')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db['sequelize']['literal'](_0x3acd('0x3b')))),_0x3acd('0x3c')],[db['sequelize']['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db['sequelize'][_0x3acd('0x24')](_0x3acd('0x3d')))),_0x3acd('0x3e')],[db[_0x3acd('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3acd('0x24')](_0x3acd('0x3f')))),_0x3acd('0x40')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x41')))),_0x3acd('0x42')],[db['sequelize']['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x43')))),_0x3acd('0x44')],[db[_0x3acd('0x20')]['fn'](_0x3acd('0x23'),db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')]['literal'](_0x3acd('0x45')))),_0x3acd('0x46')],[db[_0x3acd('0x20')]['fn']('COUNT',db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')]['literal'](_0x3acd('0x47')))),'outboundRejectCallsDay'],[db[_0x3acd('0x20')]['fn']('COUNT',db[_0x3acd('0x20')]['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x48')))),_0x3acd('0x49')]],'group':['campaign']})[_0x3acd('0xd')](function(_0x3c9208){logger['info']('GetVoiceQueueHopperHistory',_0x1cbe68);logger[_0x3acd('0x10')](_0x3acd('0x4a'),_0x1cbe68,JSON[_0x3acd('0x12')](_0x3c9208));_0xa2e304(_0x3c9208);})[_0x3acd('0x17')](function(_0x52b351){logger['error'](_0x3acd('0x4a'),_0x52b351[_0x3acd('0x15')],_0x1cbe68);_0x4012c5(_0x317d96['error'](0x1f4,_0x52b351['message']));});});};exports[_0x3acd('0x4b')]=function(_0x302d12){var _0x37b159=this;return new Promise(function(_0x36cfca,_0x4ae5d7){return db[_0x3acd('0x1c')][_0x3acd('0x1d')]({'raw':_0x302d12[_0x3acd('0x1a')]?_0x302d12['options'][_0x3acd('0x1e')]===undefined?!![]:![]:!![],'where':_0x302d12['options']?_0x302d12[_0x3acd('0x1a')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x3acd('0x20')]['fn']('COUNT',db[_0x3acd('0x20')][_0x3acd('0x21')]('id')),_0x3acd('0x4c')],[db[_0x3acd('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3acd('0x20')][_0x3acd('0x24')](_0x3acd('0x25')))),_0x3acd('0x4d')]],'group':[_0x3acd('0x2e')]})[_0x3acd('0xd')](function(_0x9e5426){logger[_0x3acd('0x16')](_0x3acd('0x4b'),_0x302d12);logger['debug'](_0x3acd('0x4b'),_0x302d12,JSON[_0x3acd('0x12')](_0x9e5426));_0x36cfca(_0x9e5426);})[_0x3acd('0x17')](function(_0x3bc3bb){logger[_0x3acd('0x13')](_0x3acd('0x4b'),_0x3bc3bb[_0x3acd('0x15')],_0x302d12);_0x4ae5d7(_0x37b159['error'](0x1f4,_0x3bc3bb[_0x3acd('0x15')]));});});}; \ No newline at end of file +var _0x9877=['CmHopperHistory,\x20%s,\x20%s','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x545f7f,_0x1023c3){var _0x1d9fec=function(_0x5c99e9){while(--_0x5c99e9){_0x545f7f['push'](_0x545f7f['shift']());}};_0x1d9fec(++_0x1023c3);}(_0x9877,0x10c));var _0x7987=function(_0x134828,_0x255bf2){_0x134828=_0x134828-0x0;var _0x20e667=_0x9877[_0x134828];return _0x20e667;};'use strict';var _=require(_0x7987('0x0'));var util=require(_0x7987('0x1'));var moment=require(_0x7987('0x2'));var BPromise=require(_0x7987('0x3'));var rs=require(_0x7987('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7987('0x5'))['db'];var utils=require(_0x7987('0x6'));var logger=require(_0x7987('0x7'))('rpc');var config=require(_0x7987('0x8'));var jayson=require(_0x7987('0x9'));var client=jayson[_0x7987('0xa')][_0x7987('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x168ce3,_0x386b0c,_0x13cbea){return new BPromise(function(_0x4201dc,_0x467de5){return client[_0x7987('0xc')](_0x168ce3,_0x13cbea)[_0x7987('0xd')](function(_0x1b1d4a){logger[_0x7987('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x386b0c,_0x7987('0xf'));logger[_0x7987('0x10')](_0x7987('0x11'),_0x386b0c,_0x7987('0xf'),JSON['stringify'](_0x1b1d4a));if(_0x1b1d4a[_0x7987('0x12')]){if(_0x1b1d4a['error'][_0x7987('0x13')]===0x1f4){logger[_0x7987('0x12')](_0x7987('0x14'),_0x386b0c,_0x1b1d4a[_0x7987('0x12')]['message']);return _0x467de5(_0x1b1d4a[_0x7987('0x12')]['message']);}logger[_0x7987('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x386b0c,_0x1b1d4a['error']['message']);return _0x4201dc(_0x1b1d4a['error']['message']);}else{logger[_0x7987('0xe')](_0x7987('0x14'),_0x386b0c,_0x7987('0xf'));_0x4201dc(_0x1b1d4a['result'][_0x7987('0x15')]);}})[_0x7987('0x16')](function(_0x40882b){logger[_0x7987('0x12')](_0x7987('0x14'),_0x386b0c,_0x40882b);_0x467de5(_0x40882b);});});}exports[_0x7987('0x17')]=function(_0xe87109){var _0xe04472=this;return new Promise(function(_0x4964a4,_0x470d91){return db[_0x7987('0x18')][_0x7987('0x19')](_0xe87109[_0x7987('0x1a')],{'raw':_0xe87109[_0x7987('0x1b')]?_0xe87109['options'][_0x7987('0x1c')]===undefined?!![]:![]:!![]})[_0x7987('0xd')](function(_0x4ac8ce){logger[_0x7987('0xe')](_0x7987('0x17'),_0xe87109);logger[_0x7987('0x10')](_0x7987('0x17'),_0xe87109,JSON[_0x7987('0x1d')](_0x4ac8ce));_0x4964a4(_0x4ac8ce);})['catch'](function(_0x1adc6a){logger['error'](_0x7987('0x17'),_0x1adc6a[_0x7987('0x15')],_0xe87109);_0x470d91(_0xe04472['error'](0x1f4,_0x1adc6a[_0x7987('0x15')]));});});};exports[_0x7987('0x1e')]=function(_0x345b49){var _0x170436=this;return new Promise(function(_0x529978,_0x113db7){return db['CmHopperHistory'][_0x7987('0x1f')]({'raw':_0x345b49[_0x7987('0x1b')]?_0x345b49[_0x7987('0x1b')][_0x7987('0x1c')]===undefined?!![]:![]:!![],'where':_0x345b49['options']?_0x345b49[_0x7987('0x1b')][_0x7987('0x20')]||null:null,'attributes':[[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['col']('id')),_0x7987('0x22')],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db['sequelize'][_0x7987('0x24')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x26')))),_0x7987('0x27')],[db[_0x7987('0x21')]['fn'](_0x7987('0x28'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x29')))),_0x7987('0x2a')],[db[_0x7987('0x21')]['fn'](_0x7987('0x28'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x2b')))),_0x7987('0x2c')]]})[_0x7987('0xd')](function(_0x29dcf0){logger[_0x7987('0xe')]('AvgHandleTime',_0x345b49);logger[_0x7987('0x10')]('AvgHandleTime',_0x345b49,JSON['stringify'](_0x29dcf0));_0x529978(_0x29dcf0);})[_0x7987('0x16')](function(_0x4f9109){logger['error'](_0x7987('0x1e'),_0x4f9109[_0x7987('0x15')],_0x345b49);_0x113db7(_0x170436['error'](0x1f4,_0x4f9109[_0x7987('0x15')]));});});};exports[_0x7987('0x2d')]=function(_0x415f4f){var _0x501ade=this;return new Promise(function(_0x44afa6,_0xcba467){return db[_0x7987('0x18')][_0x7987('0x1f')]({'raw':_0x415f4f[_0x7987('0x1b')]?_0x415f4f[_0x7987('0x1b')][_0x7987('0x1c')]===undefined?!![]:![]:!![],'where':_0x415f4f[_0x7987('0x1b')]?_0x415f4f[_0x7987('0x1b')][_0x7987('0x20')]||null:null,'attributes':[[_0x7987('0x2e'),'name'],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x2f')))),_0x7987('0x30')],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x31')))),_0x7987('0x32')],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db['sequelize']['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x33')))),_0x7987('0x34')],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x35')))),'outboundBusyCallsDay'],[db[_0x7987('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x7987('0x36')],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db['sequelize'][_0x7987('0x24')](_0x7987('0x38')))),_0x7987('0x39')],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x3a')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db['sequelize']['literal'](_0x7987('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x3c')))),_0x7987('0x3d')],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')]['literal'](_0x7987('0x3e')))),_0x7987('0x3f')],[db[_0x7987('0x21')]['fn']('COUNT',db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x40')))),_0x7987('0x3d')],[db['sequelize']['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x41')))),_0x7987('0x42')]],'group':['campaign']})[_0x7987('0xd')](function(_0x1173f9){logger['info'](_0x7987('0x2d'),_0x415f4f);logger[_0x7987('0x10')](_0x7987('0x2d'),_0x415f4f,JSON[_0x7987('0x1d')](_0x1173f9));_0x44afa6(_0x1173f9);})[_0x7987('0x16')](function(_0x56cfe7){logger[_0x7987('0x12')](_0x7987('0x2d'),_0x56cfe7[_0x7987('0x15')],_0x415f4f);_0xcba467(_0x501ade['error'](0x1f4,_0x56cfe7[_0x7987('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x51e766){var _0x59d1d8=this;return new Promise(function(_0x13cc48,_0x338dfe){return db[_0x7987('0x18')][_0x7987('0x1f')]({'raw':_0x51e766['options']?_0x51e766[_0x7987('0x1b')][_0x7987('0x1c')]===undefined?!![]:![]:!![],'where':_0x51e766[_0x7987('0x1b')]?_0x51e766[_0x7987('0x1b')][_0x7987('0x20')]||null:null,'attributes':[[_0x7987('0x2e'),_0x7987('0x43')],[db[_0x7987('0x21')]['fn'](_0x7987('0x23'),db[_0x7987('0x21')][_0x7987('0x44')]('id')),_0x7987('0x45')],[db['sequelize']['fn'](_0x7987('0x23'),db[_0x7987('0x21')]['fn']('IF',db[_0x7987('0x21')][_0x7987('0x24')](_0x7987('0x33')))),_0x7987('0x46')]],'group':[_0x7987('0x2e')]})[_0x7987('0xd')](function(_0x2f4d04){logger[_0x7987('0xe')](_0x7987('0x47'),_0x51e766);logger['debug'](_0x7987('0x47'),_0x51e766,JSON[_0x7987('0x1d')](_0x2f4d04));_0x13cc48(_0x2f4d04);})[_0x7987('0x16')](function(_0x5c6b61){logger[_0x7987('0x12')]('GetCampaignHopperHistory',_0x5c6b61['message'],_0x51e766);_0x338dfe(_0x59d1d8[_0x7987('0x12')](0x1f4,_0x5c6b61[_0x7987('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 01dc585..aa31e93 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 _0x46e1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','multer'];(function(_0xad713,_0xa9b3ed){var _0xd9d678=function(_0x34ae77){while(--_0x34ae77){_0xad713['push'](_0xad713['shift']());}};_0xd9d678(++_0xa9b3ed);}(_0x46e1,0x155));var _0x146e=function(_0x4f3789,_0x1b9cc2){_0x4f3789=_0x4f3789-0x0;var _0x16ef3c=_0x46e1[_0x4f3789];return _0x16ef3c;};'use strict';var multer=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var path=require(_0x146e('0x2'));var timeout=require(_0x146e('0x3'));var express=require(_0x146e('0x4'));var router=express[_0x146e('0x5')]();var auth=require(_0x146e('0x6'));var interaction=require(_0x146e('0x7'));var config=require(_0x146e('0x8'));var controller=require(_0x146e('0x9'));router['get']('/',auth[_0x146e('0xa')](),controller[_0x146e('0xb')]);router[_0x146e('0xc')](_0x146e('0xd'),auth[_0x146e('0xa')](),controller[_0x146e('0xe')]);router[_0x146e('0xc')]('/:id',auth[_0x146e('0xa')](),controller['show']);router[_0x146e('0xf')]('/',auth[_0x146e('0xa')](),controller[_0x146e('0x10')]);router[_0x146e('0x11')](_0x146e('0x12'),auth[_0x146e('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xbd3c=['path','express','Router','../../components/auth/service','./cmHopperHistory.controller','isAuthenticated','index','/describe','describe','/:id','show','post','multer','util'];(function(_0x13f9da,_0xe6f2){var _0x1ffdef=function(_0x3145b8){while(--_0x3145b8){_0x13f9da['push'](_0x13f9da['shift']());}};_0x1ffdef(++_0xe6f2);}(_0xbd3c,0xc2));var _0xcbd3=function(_0xbfb2ee,_0x317b2d){_0xbfb2ee=_0xbfb2ee-0x0;var _0x390f2e=_0xbd3c[_0xbfb2ee];return _0x390f2e;};'use strict';var multer=require(_0xcbd3('0x0'));var util=require(_0xcbd3('0x1'));var path=require(_0xcbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbd3('0x3'));var router=express[_0xcbd3('0x4')]();var auth=require(_0xcbd3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcbd3('0x6'));router['get']('/',auth[_0xcbd3('0x7')](),controller[_0xcbd3('0x8')]);router['get'](_0xcbd3('0x9'),auth[_0xcbd3('0x7')](),controller[_0xcbd3('0xa')]);router['get'](_0xcbd3('0xb'),auth[_0xcbd3('0x7')](),controller[_0xcbd3('0xc')]);router[_0xcbd3('0xd')]('/',auth[_0xcbd3('0x7')](),controller['create']);router['put'](_0xcbd3('0xb'),auth[_0xcbd3('0x7')](),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 4cc6a9d..ea06f92 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 _0x0602=['STRING','name','sequelize','exports'];(function(_0x1b15b4,_0x4b5d7c){var _0x10d385=function(_0x2be5c6){while(--_0x2be5c6){_0x1b15b4['push'](_0x1b15b4['shift']());}};_0x10d385(++_0x4b5d7c);}(_0x0602,0xde));var _0x2060=function(_0x9a53f2,_0x318faf){_0x9a53f2=_0x9a53f2-0x0;var _0x4e399a=_0x0602[_0x9a53f2];return _0x4e399a;};'use strict';var Sequelize=require(_0x2060('0x0'));module[_0x2060('0x1')]={'name':{'type':Sequelize[_0x2060('0x2')],'unique':_0x2060('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2060('0x2')]},'dialPrefix':{'type':Sequelize[_0x2060('0x2')]}}; \ No newline at end of file +var _0xa311=['exports','STRING','sequelize'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xa311,0x80));var _0x1a31=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0xa311[_0x333714];return _0x4c211e;};'use strict';var Sequelize=require(_0x1a31('0x0'));module[_0x1a31('0x1')]={'name':{'type':Sequelize[_0x1a31('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x1a31('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2265607..0f24375 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 _0xf4b2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','CmList','findAll','rows','show','params','keys','length','include','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','order','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','addCustomFields','TEXT','number','Sequelize','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','options','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1859bf,_0x17bb6f){var _0x11843d=function(_0x1bf020){while(--_0x1bf020){_0x1859bf['push'](_0x1859bf['shift']());}};_0x11843d(++_0x17bb6f);}(_0xf4b2,0x105));var _0x2f4b=function(_0x184350,_0x2112a){_0x184350=_0x184350-0x0;var _0x3d4b27=_0xf4b2[_0x184350];return _0x3d4b27;};'use strict';var pdf=require(_0x2f4b('0x0'));var emlformat=require(_0x2f4b('0x1'));var rimraf=require(_0x2f4b('0x2'));var zipdir=require(_0x2f4b('0x3'));var jsonpatch=require(_0x2f4b('0x4'));var rp=require(_0x2f4b('0x5'));var moment=require(_0x2f4b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f4b('0x7'));var path=require(_0x2f4b('0x8'));var sox=require('sox');var csv=require(_0x2f4b('0x9'));var ejs=require(_0x2f4b('0xa'));var fs=require('fs');var _=require(_0x2f4b('0xb'));var squel=require('squel');var crypto=require(_0x2f4b('0xc'));var jsforce=require(_0x2f4b('0xd'));var deskjs=require(_0x2f4b('0xe'));var toCsv=require(_0x2f4b('0x9'));var querystring=require(_0x2f4b('0xf'));var Papa=require(_0x2f4b('0x10'));var Redis=require(_0x2f4b('0x11'));var authService=require(_0x2f4b('0x12'));var qs=require(_0x2f4b('0x13'));var as=require(_0x2f4b('0x14'));var hardwareService=require(_0x2f4b('0x15'));var logger=require('../../config/logger')(_0x2f4b('0x16'));var utils=require(_0x2f4b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f4b('0x18'))['db'];config[_0x2f4b('0x19')]=_[_0x2f4b('0x1a')](config[_0x2f4b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f4b('0x1b'))(new Redis(config[_0x2f4b('0x19')]));require(_0x2f4b('0x1c'))['register'](socket);function respondWithStatusCode(_0x3118a7,_0x300501){_0x300501=_0x300501||0xcc;return function(_0x249423){if(_0x249423){return _0x3118a7[_0x2f4b('0x1d')](_0x300501);}return _0x3118a7['status'](_0x300501)[_0x2f4b('0x1e')]();};}function respondWithResult(_0x23443c,_0x2847b1){_0x2847b1=_0x2847b1||0xc8;return function(_0xf19e23){if(_0xf19e23){return _0x23443c[_0x2f4b('0x1f')](_0x2847b1)[_0x2f4b('0x20')](_0xf19e23);}};}function respondWithFilteredResult(_0x4c458c,_0xf49a56){return function(_0x287a13){if(_0x287a13){var _0x244850=_0x287a13[_0x2f4b('0x21')],_0x168d1f=_0xf49a56[_0x2f4b('0x22')],_0x32f977=_0xf49a56[_0x2f4b('0x22')]+_0xf49a56[_0x2f4b('0x23')],_0x55abf8;if(_0x32f977>=_0x244850){_0x32f977=_0x244850;_0x55abf8=0xc8;}else{_0x55abf8=0xce;}_0x4c458c['status'](_0x55abf8);return _0x4c458c['set'](_0x2f4b('0x24'),_0x168d1f+'-'+_0x32f977+'/'+_0x244850)[_0x2f4b('0x20')](_0x287a13);}return null;};}function patchUpdates(_0x1e1caf){return function(_0x26cc3a){try{jsonpatch[_0x2f4b('0x25')](_0x26cc3a,_0x1e1caf,!![]);}catch(_0x590208){return BPromise[_0x2f4b('0x26')](_0x590208);}return _0x26cc3a['save']();};}function saveUpdates(_0x49528b,_0x405777){return function(_0x50526a){if(_0x50526a){return _0x50526a[_0x2f4b('0x27')](_0x49528b)[_0x2f4b('0x28')](function(_0x4708f5){return _0x4708f5;});}return null;};}function removeEntity(_0x22e3b4,_0x4f9a0b){return function(_0x486e33){if(_0x486e33){return _0x486e33[_0x2f4b('0x29')]()[_0x2f4b('0x28')](function(){var _0x3145fd=_0x486e33[_0x2f4b('0x2a')]({'plain':!![]});var _0x53f01f=_0x2f4b('0x2b');return db[_0x2f4b('0x2c')][_0x2f4b('0x29')]({'where':{'type':_0x53f01f,'resourceId':_0x3145fd['id']}})[_0x2f4b('0x28')](function(){return _0x486e33;});})[_0x2f4b('0x28')](function(){_0x22e3b4[_0x2f4b('0x1f')](0xcc)[_0x2f4b('0x1e')]();});}};}function handleEntityNotFound(_0x5390c8,_0xfa6722){return function(_0x196e8b){if(!_0x196e8b){_0x5390c8['sendStatus'](0x194);}return _0x196e8b;};}function handleError(_0x1e22dd,_0x2a00d9){_0x2a00d9=_0x2a00d9||0x1f4;return function(_0x187623){logger[_0x2f4b('0x2d')](_0x187623[_0x2f4b('0x2e')]);if(_0x187623['name']){delete _0x187623[_0x2f4b('0x2f')];}_0x1e22dd[_0x2f4b('0x1f')](_0x2a00d9)[_0x2f4b('0x30')](_0x187623);};}exports['index']=function(_0x35aa68,_0x14bb73){var _0x539c48={},_0x357378={},_0x397c78={'count':0x0,'rows':[]};var _0x3324fa=_[_0x2f4b('0x31')](db['CmList'][_0x2f4b('0x32')],function(_0x1919f2){return{'name':_0x1919f2['fieldName'],'type':_0x1919f2[_0x2f4b('0x33')][_0x2f4b('0x34')]};});_0x357378[_0x2f4b('0x35')]=_[_0x2f4b('0x31')](_0x3324fa,_0x2f4b('0x2f'));_0x357378[_0x2f4b('0x36')]=_['keys'](_0x35aa68[_0x2f4b('0x36')]);_0x357378[_0x2f4b('0x37')]=_[_0x2f4b('0x38')](_0x357378[_0x2f4b('0x35')],_0x357378['query']);_0x539c48[_0x2f4b('0x39')]=_[_0x2f4b('0x38')](_0x357378['model'],qs[_0x2f4b('0x3a')](_0x35aa68[_0x2f4b('0x36')]['fields']));_0x539c48[_0x2f4b('0x39')]=_0x539c48[_0x2f4b('0x39')]['length']?_0x539c48[_0x2f4b('0x39')]:_0x357378[_0x2f4b('0x35')];if(!_0x35aa68[_0x2f4b('0x36')][_0x2f4b('0x3b')](_0x2f4b('0x3c'))){_0x539c48[_0x2f4b('0x23')]=qs[_0x2f4b('0x23')](_0x35aa68[_0x2f4b('0x36')][_0x2f4b('0x23')]);_0x539c48['offset']=qs['offset'](_0x35aa68[_0x2f4b('0x36')][_0x2f4b('0x22')]);}_0x539c48['order']=qs['sort'](_0x35aa68[_0x2f4b('0x36')][_0x2f4b('0x3d')]);_0x539c48['where']=qs[_0x2f4b('0x37')](_[_0x2f4b('0x3e')](_0x35aa68['query'],_0x357378[_0x2f4b('0x37')]),_0x3324fa);if(_0x35aa68['query'][_0x2f4b('0x3f')]){_0x539c48[_0x2f4b('0x40')]=_[_0x2f4b('0x41')](_0x539c48[_0x2f4b('0x40')],{'$or':_[_0x2f4b('0x31')](_0x3324fa,function(_0x30a678){if(_0x30a678[_0x2f4b('0x33')]!=='VIRTUAL'){var _0xfc1c57={};_0xfc1c57[_0x30a678[_0x2f4b('0x2f')]]={'$like':'%'+_0x35aa68[_0x2f4b('0x36')][_0x2f4b('0x3f')]+'%'};return _0xfc1c57;}})});}_0x539c48=_[_0x2f4b('0x41')]({},_0x539c48,_0x35aa68['options']);var _0xa1fb56={'where':_0x539c48[_0x2f4b('0x40')]};return db['CmList']['count'](_0xa1fb56)[_0x2f4b('0x28')](function(_0x1b06fb){_0x397c78[_0x2f4b('0x21')]=_0x1b06fb;if(_0x35aa68[_0x2f4b('0x36')][_0x2f4b('0x42')]){_0x539c48['include']=[{'all':!![]}];}return db[_0x2f4b('0x43')][_0x2f4b('0x44')](_0x539c48);})[_0x2f4b('0x28')](function(_0x1d418f){_0x397c78[_0x2f4b('0x45')]=_0x1d418f;return _0x397c78;})[_0x2f4b('0x28')](respondWithFilteredResult(_0x14bb73,_0x539c48))['catch'](handleError(_0x14bb73,null));};exports[_0x2f4b('0x46')]=function(_0x1726b5,_0x2b5e3e){var _0x4ec2d4={'raw':![],'where':{'id':_0x1726b5[_0x2f4b('0x47')]['id']}},_0xf98ae={};_0xf98ae[_0x2f4b('0x35')]=_['keys'](db[_0x2f4b('0x43')][_0x2f4b('0x32')]);_0xf98ae['query']=_[_0x2f4b('0x48')](_0x1726b5[_0x2f4b('0x36')]);_0xf98ae['filters']=_[_0x2f4b('0x38')](_0xf98ae[_0x2f4b('0x35')],_0xf98ae[_0x2f4b('0x36')]);_0x4ec2d4['attributes']=_[_0x2f4b('0x38')](_0xf98ae[_0x2f4b('0x35')],qs[_0x2f4b('0x3a')](_0x1726b5[_0x2f4b('0x36')][_0x2f4b('0x3a')]));_0x4ec2d4[_0x2f4b('0x39')]=_0x4ec2d4['attributes'][_0x2f4b('0x49')]?_0x4ec2d4[_0x2f4b('0x39')]:_0xf98ae[_0x2f4b('0x35')];if(_0x1726b5[_0x2f4b('0x36')][_0x2f4b('0x42')]){_0x4ec2d4[_0x2f4b('0x4a')]=[{'all':!![]}];}_0x4ec2d4=_[_0x2f4b('0x41')]({},_0x4ec2d4,_0x1726b5['options']);return db['CmList'][_0x2f4b('0x4b')](_0x4ec2d4)[_0x2f4b('0x28')](handleEntityNotFound(_0x2b5e3e,null))[_0x2f4b('0x28')](respondWithResult(_0x2b5e3e,null))[_0x2f4b('0x4c')](handleError(_0x2b5e3e,null));};exports['create']=function(_0x357303,_0x539fe3){return db[_0x2f4b('0x43')]['create'](_0x357303['body'],{})[_0x2f4b('0x28')](function(_0x1e3f84){var _0x2fdf10=_0x357303['user']['get']({'plain':!![]});if(!_0x2fdf10)throw new Error(_0x2f4b('0x4d'));if(_0x2fdf10['role']===_0x2f4b('0x4e')){var _0x5b9702=_0x1e3f84[_0x2f4b('0x2a')]({'plain':!![]});var _0x2a0a77=_0x2f4b('0x2b');return db[_0x2f4b('0x4f')][_0x2f4b('0x4b')]({'where':{'name':_0x2a0a77,'userProfileId':_0x2fdf10['userProfileId']},'raw':!![]})[_0x2f4b('0x28')](function(_0x3bfdc3){if(_0x3bfdc3&&_0x3bfdc3['autoAssociation']===0x0){return db['UserProfileResource'][_0x2f4b('0x50')]({'name':_0x5b9702[_0x2f4b('0x2f')],'resourceId':_0x5b9702['id'],'type':_0x3bfdc3[_0x2f4b('0x2f')],'sectionId':_0x3bfdc3['id']},{})['then'](function(){return _0x1e3f84;});}else{return _0x1e3f84;}})['catch'](function(_0x3d4b5c){logger[_0x2f4b('0x2d')](_0x2f4b('0x51'),_0x3d4b5c);throw _0x3d4b5c;});}return _0x1e3f84;})[_0x2f4b('0x28')](respondWithResult(_0x539fe3,0xc9))['catch'](handleError(_0x539fe3,null));};exports[_0x2f4b('0x27')]=function(_0x53015d,_0x5cb4ae){if(_0x53015d[_0x2f4b('0x52')]['id']){delete _0x53015d[_0x2f4b('0x52')]['id'];}return db[_0x2f4b('0x43')][_0x2f4b('0x4b')]({'where':{'id':_0x53015d[_0x2f4b('0x47')]['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x5cb4ae,null))[_0x2f4b('0x28')](saveUpdates(_0x53015d[_0x2f4b('0x52')],null))[_0x2f4b('0x28')](respondWithResult(_0x5cb4ae,null))[_0x2f4b('0x4c')](handleError(_0x5cb4ae,null));};exports[_0x2f4b('0x29')]=function(_0x2f894d,_0x41290f){return db[_0x2f4b('0x43')][_0x2f4b('0x4b')]({'where':{'id':_0x2f894d[_0x2f4b('0x47')]['id']}})['then'](handleEntityNotFound(_0x41290f,null))[_0x2f4b('0x28')](removeEntity(_0x41290f,null))[_0x2f4b('0x4c')](handleError(_0x41290f,null));};exports[_0x2f4b('0x53')]=function(_0x42062f,_0x230dda){return db[_0x2f4b('0x43')][_0x2f4b('0x53')]()[_0x2f4b('0x28')](respondWithResult(_0x230dda,null))[_0x2f4b('0x4c')](handleError(_0x230dda,null));};exports[_0x2f4b('0x54')]=function(_0x41a827,_0x1d16c3,_0x1abe45){if(_0x41a827['body']['id']){delete _0x41a827[_0x2f4b('0x52')]['id'];}return db[_0x2f4b('0x43')][_0x2f4b('0x4b')]({'where':{'id':_0x41a827[_0x2f4b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d16c3,null))[_0x2f4b('0x28')](function(_0x1c8332){if(_0x1c8332){_0x41a827[_0x2f4b('0x52')][_0x2f4b('0x55')]=_0x1c8332['id'];return db['Disposition'][_0x2f4b('0x50')](_0x41a827[_0x2f4b('0x52')]);}})[_0x2f4b('0x28')](respondWithResult(_0x1d16c3,null))[_0x2f4b('0x4c')](handleError(_0x1d16c3,null));};exports[_0x2f4b('0x56')]=function(_0x15d2a7,_0x412d99,_0x3fbe20){var _0x341fc5={'raw':![],'where':{}};var _0x3e29b5={};var _0x2c5d35={'count':0x0,'rows':[]};return db[_0x2f4b('0x43')][_0x2f4b('0x57')]({'where':{'id':_0x15d2a7[_0x2f4b('0x47')]['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x412d99,null))[_0x2f4b('0x28')](function(_0x58ec95){if(_0x58ec95){_0x3e29b5[_0x2f4b('0x35')]=_[_0x2f4b('0x48')](db[_0x2f4b('0x58')][_0x2f4b('0x32')]);_0x3e29b5['query']=_[_0x2f4b('0x48')](_0x15d2a7[_0x2f4b('0x36')]);_0x3e29b5[_0x2f4b('0x37')]=_[_0x2f4b('0x38')](_0x3e29b5[_0x2f4b('0x35')],_0x3e29b5['query']);_0x341fc5[_0x2f4b('0x39')]=_[_0x2f4b('0x38')](_0x3e29b5[_0x2f4b('0x35')],qs[_0x2f4b('0x3a')](_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x3a')]));_0x341fc5[_0x2f4b('0x39')]=_0x341fc5[_0x2f4b('0x39')]['length']?_0x341fc5['attributes']:_0x3e29b5['model'];if(!_0x15d2a7[_0x2f4b('0x36')]['hasOwnProperty']('nolimit')){_0x341fc5[_0x2f4b('0x23')]=qs[_0x2f4b('0x23')](_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x23')]);_0x341fc5['offset']=qs['offset'](_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x22')]);}_0x341fc5['order']=qs[_0x2f4b('0x3d')](_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x3d')]);_0x341fc5[_0x2f4b('0x40')]=qs[_0x2f4b('0x37')](_[_0x2f4b('0x3e')](_0x15d2a7[_0x2f4b('0x36')],_0x3e29b5[_0x2f4b('0x37')]));_0x341fc5[_0x2f4b('0x40')][_0x2f4b('0x55')]=_0x58ec95['id'];if(_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x3f')]){_0x341fc5['where']=_[_0x2f4b('0x41')](_0x341fc5[_0x2f4b('0x40')],{'$or':_[_0x2f4b('0x31')](_0x341fc5['attributes'],function(_0x27135d){var _0x63e4dd={};_0x63e4dd[_0x27135d]={'$like':'%'+_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x3f')]+'%'};return _0x63e4dd;})});}_0x341fc5=_[_0x2f4b('0x41')]({},_0x341fc5,_0x15d2a7['options']);return db[_0x2f4b('0x58')][_0x2f4b('0x21')]({'where':_0x341fc5[_0x2f4b('0x40')]})[_0x2f4b('0x28')](function(_0x1bf2e9){_0x2c5d35[_0x2f4b('0x21')]=_0x1bf2e9;if(_0x15d2a7[_0x2f4b('0x36')][_0x2f4b('0x42')]){_0x341fc5[_0x2f4b('0x4a')]=[{'all':!![]}];}return db[_0x2f4b('0x58')][_0x2f4b('0x44')](_0x341fc5);})[_0x2f4b('0x28')](function(_0x589dfb){_0x2c5d35[_0x2f4b('0x45')]=_0x589dfb;return _0x2c5d35;});}})[_0x2f4b('0x28')](respondWithFilteredResult(_0x412d99,_0x341fc5))[_0x2f4b('0x4c')](handleError(_0x412d99,null));};exports['removeDispositions']=function(_0x4591aa,_0x26a7f8,_0x19b171){return db['CmList']['find']({'where':{'id':_0x4591aa[_0x2f4b('0x47')]['id']}})['then'](handleEntityNotFound(_0x26a7f8,null))[_0x2f4b('0x28')](function(_0x4c560f){if(_0x4c560f){return _0x4c560f[_0x2f4b('0x59')](_0x4591aa[_0x2f4b('0x36')][_0x2f4b('0x5a')]);}})[_0x2f4b('0x28')](respondWithStatusCode(_0x26a7f8,null))[_0x2f4b('0x4c')](handleError(_0x26a7f8,null));};exports[_0x2f4b('0x5b')]=function(_0x2f27ae,_0x50c6b7,_0xf5f74b){return db['CmList']['find']({'where':{'id':_0x2f27ae[_0x2f4b('0x47')]['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x50c6b7,null))['then'](function(_0xa3fa7){if(_0xa3fa7){var _0x1ed647=[];var _0x5e0345={'success':[],'errors':[]};return db[_0x2f4b('0x5c')][_0x2f4b('0x53')]()[_0x2f4b('0x28')](function(_0x16ce34){if(_0x2f27ae[_0x2f4b('0x52')]['tags']&&_[_0x2f4b('0x5d')](_0x2f27ae[_0x2f4b('0x52')][_0x2f4b('0x5e')])){if(_0x2f27ae['body'][_0x2f4b('0x5e')][_0x2f4b('0x49')]){_0x2f27ae['body']['tags']=_0x2f27ae['body']['tags']['join'](';')+';';}else{_0x2f27ae[_0x2f4b('0x52')][_0x2f4b('0x5e')]=null;}}else{_0x2f27ae[_0x2f4b('0x52')][_0x2f4b('0x5e')]=null;}if(_0x2f27ae[_0x2f4b('0x52')]&&_[_0x2f4b('0x5d')](_0x2f27ae[_0x2f4b('0x52')])){for(var _0x570cb9=0x0;_0x570cb9<_0x2f27ae['body']['length'];_0x570cb9+=0x1){_0x2f27ae['body'][_0x570cb9]['ListId']=_0x2f27ae[_0x2f4b('0x47')]['id'];_0x1ed647[_0x2f4b('0x5f')](_0x2f27ae[_0x2f4b('0x52')][_0x570cb9]);}return BPromise[_0x2f4b('0x60')](_0x1ed647,function(_0x4233ca){return db['CmContact'][_0x2f4b('0x50')](_['omit'](_0x4233ca,['ids','id'])||{},{'fields':_[_0x2f4b('0x48')](_0x16ce34),'raw':!![]})[_0x2f4b('0x28')](function(_0x148782){_0x5e0345[_0x2f4b('0x61')][_0x2f4b('0x5f')](_0x148782['dataValues']);})[_0x2f4b('0x4c')](function(_0x5bb20d){_0x5e0345[_0x2f4b('0x62')][_0x2f4b('0x5f')]({'data':_0x4233ca,'error':_0x5bb20d[_0x2f4b('0x63')]});});})[_0x2f4b('0x28')](function(_0x4b7799){return _0x5e0345;})[_0x2f4b('0x4c')](function(_0x39b43b){return _0x39b43b;});}else{_0x50c6b7[_0x2f4b('0x1f')](0x190)['json']({'message':_0x2f4b('0x64')});}});}})[_0x2f4b('0x28')](respondWithResult(_0x50c6b7,null))[_0x2f4b('0x4c')](handleError(_0x50c6b7,null));};exports[_0x2f4b('0x65')]=function(_0x117f2c,_0x533990,_0x36084b){var _0x40faa9;return db[_0x2f4b('0x43')][_0x2f4b('0x4b')]({'where':{'id':_0x117f2c['params']['id']},'include':[{'model':db[_0x2f4b('0x66')],'as':_0x2f4b('0x67')}]})['then'](handleEntityNotFound(_0x533990,null))['then'](function(_0x1f4a91){if(_0x1f4a91){_0x40faa9=_0x1f4a91;return db['CmContact'][_0x2f4b('0x32')];}})[_0x2f4b('0x28')](function(_0x1c4109){if(_0x1c4109){var _0x44d9b8={};var _0x5a40d0={};_0x5a40d0[_0x2f4b('0x35')]=_[_0x2f4b('0x68')](_['keys'](_0x1c4109),_[_0x2f4b('0x31')](_0x40faa9[_0x2f4b('0x67')],function(_0x251178){return util[_0x2f4b('0x69')](_0x2f4b('0x6a'),_0x251178['id']);}));_0x5a40d0[_0x2f4b('0x36')]=_['keys'](_0x117f2c[_0x2f4b('0x36')]);_0x5a40d0[_0x2f4b('0x37')]=_[_0x2f4b('0x38')](_0x5a40d0[_0x2f4b('0x35')],_0x5a40d0['query']);_0x44d9b8[_0x2f4b('0x39')]=_['intersection'](_0x5a40d0['model'],qs[_0x2f4b('0x3a')](_0x117f2c[_0x2f4b('0x36')][_0x2f4b('0x3a')]));_0x44d9b8[_0x2f4b('0x39')]=_0x44d9b8[_0x2f4b('0x39')][_0x2f4b('0x49')]?_0x44d9b8[_0x2f4b('0x39')]:_0x5a40d0[_0x2f4b('0x35')];if(!_0x117f2c[_0x2f4b('0x36')][_0x2f4b('0x3b')](_0x2f4b('0x3c'))){_0x44d9b8[_0x2f4b('0x23')]=qs[_0x2f4b('0x23')](_0x117f2c['query'][_0x2f4b('0x23')]);_0x44d9b8[_0x2f4b('0x22')]=qs[_0x2f4b('0x22')](_0x117f2c[_0x2f4b('0x36')]['offset']);}_0x44d9b8['order']=qs[_0x2f4b('0x3d')](_0x117f2c[_0x2f4b('0x36')][_0x2f4b('0x3d')]);_0x44d9b8[_0x2f4b('0x40')]=qs[_0x2f4b('0x37')](_[_0x2f4b('0x3e')](_0x117f2c[_0x2f4b('0x36')],_0x5a40d0[_0x2f4b('0x37')]));_0x44d9b8[_0x2f4b('0x6b')]=!![];if(_0x117f2c['query'][_0x2f4b('0x3f')]){_0x44d9b8['where']=_[_0x2f4b('0x41')](_0x44d9b8[_0x2f4b('0x40')],{'$or':_[_0x2f4b('0x31')](_0x44d9b8['attributes'],function(_0x16fadd){var _0x1dfe3c={};_0x1dfe3c[_0x16fadd]={'$like':'%'+_0x117f2c[_0x2f4b('0x36')][_0x2f4b('0x3f')]+'%'};return _0x1dfe3c;})});}_0x44d9b8=_[_0x2f4b('0x41')]({},_0x44d9b8,_0x117f2c['options']);return _0x40faa9[_0x2f4b('0x65')](_0x44d9b8);}})[_0x2f4b('0x28')](respondWithResult(_0x533990,null))[_0x2f4b('0x4c')](handleError(_0x533990,null));};exports['getContactsCsv']=function(_0x41a980,_0x33153f,_0x4981a6){var _0x2dcaf6;return db[_0x2f4b('0x43')][_0x2f4b('0x4b')]({'where':{'id':_0x41a980[_0x2f4b('0x47')]['id']},'include':[{'model':db[_0x2f4b('0x66')],'as':_0x2f4b('0x67')}]})[_0x2f4b('0x28')](handleEntityNotFound(_0x33153f,null))[_0x2f4b('0x28')](function(_0x148a6f){if(_0x148a6f){_0x2dcaf6=_0x148a6f;return db[_0x2f4b('0x5c')][_0x2f4b('0x32')];}})[_0x2f4b('0x28')](function(_0x5eaccc){if(_0x5eaccc){var _0xc53d04={};var _0xab51c3={};_0xab51c3[_0x2f4b('0x35')]=_['concat'](_[_0x2f4b('0x48')](_0x5eaccc),_[_0x2f4b('0x31')](_0x2dcaf6[_0x2f4b('0x67')],function(_0x39f421){return util[_0x2f4b('0x69')](_0x2f4b('0x6a'),_0x39f421['id']);}));_0xab51c3['query']=_['keys'](_0x41a980[_0x2f4b('0x36')]);_0xab51c3[_0x2f4b('0x37')]=_[_0x2f4b('0x38')](_0xab51c3[_0x2f4b('0x35')],_0xab51c3[_0x2f4b('0x36')]);_0xc53d04[_0x2f4b('0x39')]=_['intersection'](_0xab51c3[_0x2f4b('0x35')],qs[_0x2f4b('0x3a')](_0x41a980[_0x2f4b('0x36')]['fields']));_0xc53d04[_0x2f4b('0x39')]=_0xc53d04['attributes'][_0x2f4b('0x49')]?_0xc53d04[_0x2f4b('0x39')]:_0xab51c3[_0x2f4b('0x35')];if(!_0x41a980[_0x2f4b('0x36')][_0x2f4b('0x3b')](_0x2f4b('0x3c'))){_0xc53d04[_0x2f4b('0x23')]=qs[_0x2f4b('0x23')](_0x41a980[_0x2f4b('0x36')][_0x2f4b('0x23')]);_0xc53d04[_0x2f4b('0x22')]=qs[_0x2f4b('0x22')](_0x41a980[_0x2f4b('0x36')][_0x2f4b('0x22')]);}_0xc53d04[_0x2f4b('0x6c')]=qs[_0x2f4b('0x3d')](_0x41a980[_0x2f4b('0x36')]['sort']);_0xc53d04[_0x2f4b('0x40')]=qs[_0x2f4b('0x37')](_[_0x2f4b('0x3e')](_0x41a980[_0x2f4b('0x36')],_0xab51c3[_0x2f4b('0x37')]));_0xc53d04[_0x2f4b('0x6b')]=!![];if(_0x41a980[_0x2f4b('0x36')][_0x2f4b('0x3f')]){_0xc53d04[_0x2f4b('0x40')]=_['merge'](_0xc53d04[_0x2f4b('0x40')],{'$or':_[_0x2f4b('0x31')](_0xc53d04[_0x2f4b('0x39')],function(_0x3583ad){var _0x2afe45={};_0x2afe45[_0x3583ad]={'$like':'%'+_0x41a980['query'][_0x2f4b('0x3f')]+'%'};return _0x2afe45;})});}_0xc53d04=_['merge']({},_0xc53d04,_0x41a980['options']);return _0x2dcaf6[_0x2f4b('0x65')](_0xc53d04);}})[_0x2f4b('0x28')](function(_0x48fed5){if(!_[_0x2f4b('0x6d')](_0x48fed5)){var _0x5a4983=toCsv(_0x48fed5);var _0x4b44ef=Date[_0x2f4b('0x6e')]();fs[_0x2f4b('0x6f')](util[_0x2f4b('0x69')]('/tmp/list_%d_%s.csv',_0x2dcaf6['id'],_0x4b44ef),_0x5a4983);_0x33153f[_0x2f4b('0x70')](_0x2f4b('0x71'),_0x2f4b('0x72')+util[_0x2f4b('0x69')]('list_%d_%s.csv',_0x2dcaf6['id'],_0x4b44ef));_0x33153f[_0x2f4b('0x70')](_0x2f4b('0x73'),_0x2f4b('0x74'));return _0x33153f['download'](util[_0x2f4b('0x69')]('/tmp/list_%d_%s.csv',_0x2dcaf6['id'],_0x4b44ef));}else{return _0x33153f['sendStatus'](0xcc);}})[_0x2f4b('0x4c')](handleError(_0x33153f,null));};exports[_0x2f4b('0x75')]=function(_0x12b032,_0x33a3de,_0x41f522){var _0x1415d9;delete _0x12b032[_0x2f4b('0x52')]['id'];return db['CmList'][_0x2f4b('0x57')]({'where':{'id':_0x12b032['params']['id']}})['then'](handleEntityNotFound(_0x33a3de,null))['then'](function(_0x5aaa93){if(_0x5aaa93){return db[_0x2f4b('0x76')]['transaction'](function(_0x392a71){return db['CmCustomField'][_0x2f4b('0x50')](_0x12b032[_0x2f4b('0x52')],{'transaction':_0x392a71})[_0x2f4b('0x28')](function(_0x45fc12){_0x1415d9=_0x45fc12;return _0x5aaa93[_0x2f4b('0x77')](_0x45fc12,{'transaction':_0x392a71});})[_0x2f4b('0x28')](function(){var _0x19d6b3={'type':db['Sequelize'][_0x2f4b('0x78')],'transaction':_0x392a71};switch(_0x12b032[_0x2f4b('0x52')][_0x2f4b('0x33')]){case'text':_0x19d6b3[_0x2f4b('0x33')]=db['Sequelize'][_0x2f4b('0x78')];break;case _0x2f4b('0x79'):_0x19d6b3[_0x2f4b('0x33')]=db[_0x2f4b('0x7a')]['INTEGER'];break;case _0x2f4b('0x7b'):_0x19d6b3[_0x2f4b('0x33')]=db[_0x2f4b('0x7a')][_0x2f4b('0x7c')];_0x19d6b3[_0x2f4b('0x7d')]=![];break;default:}return db[_0x2f4b('0x76')]['queryInterface'][_0x2f4b('0x7e')](_0x2f4b('0x7f'),util[_0x2f4b('0x69')](_0x2f4b('0x80'),_0x1415d9['id']),_0x19d6b3);})[_0x2f4b('0x28')](function(){return _0x1415d9;});});}})[_0x2f4b('0x28')](respondWithResult(_0x33a3de,null))[_0x2f4b('0x4c')](handleError(_0x33a3de,null));};exports[_0x2f4b('0x81')]=function(_0x1472f6,_0x489dad,_0x5c1d44){var _0x5dfe55={};var _0x3cdae5={};var _0x3d07e6;var _0x360aeb;return db['CmList'][_0x2f4b('0x57')]({'where':{'id':_0x1472f6['params']['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x489dad,null))[_0x2f4b('0x28')](function(_0x405b3b){if(_0x405b3b){_0x3d07e6=_0x405b3b;_0x3cdae5['model']=_[_0x2f4b('0x48')](db['CmCustomField'][_0x2f4b('0x32')]);_0x3cdae5[_0x2f4b('0x36')]=_[_0x2f4b('0x48')](_0x1472f6['query']);_0x3cdae5[_0x2f4b('0x37')]=_[_0x2f4b('0x38')](_0x3cdae5['model'],_0x3cdae5[_0x2f4b('0x36')]);_0x5dfe55[_0x2f4b('0x39')]=_[_0x2f4b('0x38')](_0x3cdae5[_0x2f4b('0x35')],qs[_0x2f4b('0x3a')](_0x1472f6[_0x2f4b('0x36')][_0x2f4b('0x3a')]));_0x5dfe55[_0x2f4b('0x39')]=_0x5dfe55[_0x2f4b('0x39')]['length']?_0x5dfe55[_0x2f4b('0x39')]:_0x3cdae5[_0x2f4b('0x35')];_0x5dfe55[_0x2f4b('0x6c')]=qs[_0x2f4b('0x3d')](_0x1472f6[_0x2f4b('0x36')][_0x2f4b('0x3d')]);_0x5dfe55[_0x2f4b('0x40')]=qs['filters'](_[_0x2f4b('0x3e')](_0x1472f6[_0x2f4b('0x36')],_0x3cdae5[_0x2f4b('0x37')]));_0x5dfe55[_0x2f4b('0x40')]=_[_0x2f4b('0x41')](_0x5dfe55[_0x2f4b('0x40')],{'$or':[{'ListId':_0x405b3b['id']},{'ListId':null}]});if(_0x1472f6[_0x2f4b('0x36')][_0x2f4b('0x3f')]){_0x5dfe55[_0x2f4b('0x40')]=_[_0x2f4b('0x41')](_0x5dfe55[_0x2f4b('0x40')],{'$or':_[_0x2f4b('0x31')](_0x5dfe55[_0x2f4b('0x39')],function(_0x5ba1fc){var _0x50b621={};_0x50b621[_0x5ba1fc]={'$like':'%'+_0x1472f6[_0x2f4b('0x36')][_0x2f4b('0x3f')]+'%'};return _0x50b621;})});}_0x5dfe55=_['merge']({},_0x5dfe55,_0x1472f6[_0x2f4b('0x82')]);return db[_0x2f4b('0x66')]['findAndCountAll'](_0x5dfe55);}})['then'](respondWithResult(_0x489dad,null))[_0x2f4b('0x4c')](handleError(_0x489dad,null));};exports[_0x2f4b('0x83')]=function(_0x244486,_0x5f3470,_0x29a40a){return db[_0x2f4b('0x43')][_0x2f4b('0x4b')]({'where':{'id':_0x244486[_0x2f4b('0x47')]['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x5f3470,null))[_0x2f4b('0x28')](function(_0x2b852b){if(_0x2b852b){return _0x2b852b['addAgents'](_0x244486[_0x2f4b('0x52')][_0x2f4b('0x5a')],_['omit'](_0x244486[_0x2f4b('0x52')],[_0x2f4b('0x5a'),'id'])||{})[_0x2f4b('0x84')](function(_0x28fcb0){for(var _0xa13731=0x0;_0xa13731<_0x244486['body'][_0x2f4b('0x5a')]['length'];_0xa13731+=0x1){socket[_0x2f4b('0x85')](_0x2f4b('0x86'),{'UserId':_0x244486[_0x2f4b('0x52')][_0x2f4b('0x5a')][_0xa13731],'CmListId':_0x244486['params']['id']});}return _0x28fcb0;});}})['then'](respondWithResult(_0x5f3470,null))[_0x2f4b('0x4c')](handleError(_0x5f3470,null));};exports[_0x2f4b('0x87')]=function(_0x1b87b8,_0x585b9d,_0x5049c2){return db['CmList'][_0x2f4b('0x4b')]({'where':{'id':_0x1b87b8[_0x2f4b('0x47')]['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x585b9d,null))['then'](function(_0x4c8137){if(_0x4c8137){return _0x4c8137['removeAgents'](_0x1b87b8[_0x2f4b('0x36')][_0x2f4b('0x5a')])['then'](function(){if(_[_0x2f4b('0x5d')](_0x1b87b8['query'][_0x2f4b('0x5a')])){for(var _0x40efc3=0x0;_0x40efc3<_0x1b87b8[_0x2f4b('0x36')]['ids'][_0x2f4b('0x49')];_0x40efc3+=0x1){socket[_0x2f4b('0x85')](_0x2f4b('0x88'),{'UserId':Number(_0x1b87b8['query'][_0x2f4b('0x5a')][_0x40efc3]),'CmListId':Number(_0x1b87b8[_0x2f4b('0x47')]['id'])});}}else{socket[_0x2f4b('0x85')](_0x2f4b('0x88'),{'UserId':Number(_0x1b87b8[_0x2f4b('0x36')][_0x2f4b('0x5a')]),'CmListId':Number(_0x1b87b8[_0x2f4b('0x47')]['id'])});}});}})[_0x2f4b('0x28')](respondWithStatusCode(_0x585b9d,null))['catch'](handleError(_0x585b9d,null));};exports['getAgents']=function(_0x368bce,_0x46c200,_0x2ae4cc){var _0x3a98d6={};var _0x3c7abb={};var _0x1622ad;var _0x4172d9;return db[_0x2f4b('0x43')][_0x2f4b('0x57')]({'where':{'id':_0x368bce[_0x2f4b('0x47')]['id']}})[_0x2f4b('0x28')](handleEntityNotFound(_0x46c200,null))[_0x2f4b('0x28')](function(_0x3b210c){if(_0x3b210c){_0x1622ad=_0x3b210c;_0x3c7abb['model']=_['keys'](db[_0x2f4b('0x89')][_0x2f4b('0x32')]);_0x3c7abb[_0x2f4b('0x36')]=_[_0x2f4b('0x48')](_0x368bce[_0x2f4b('0x36')]);_0x3c7abb['filters']=_[_0x2f4b('0x38')](_0x3c7abb[_0x2f4b('0x35')],_0x3c7abb[_0x2f4b('0x36')]);_0x3a98d6[_0x2f4b('0x39')]=_['intersection'](_0x3c7abb['model'],qs[_0x2f4b('0x3a')](_0x368bce['query'][_0x2f4b('0x3a')]));_0x3a98d6[_0x2f4b('0x39')]=_0x3a98d6['attributes'][_0x2f4b('0x49')]?_0x3a98d6[_0x2f4b('0x39')]:_0x3c7abb[_0x2f4b('0x35')];_0x3a98d6[_0x2f4b('0x6c')]=qs[_0x2f4b('0x3d')](_0x368bce[_0x2f4b('0x36')][_0x2f4b('0x3d')]);_0x3a98d6[_0x2f4b('0x40')]=qs[_0x2f4b('0x37')](_[_0x2f4b('0x3e')](_0x368bce[_0x2f4b('0x36')],_0x3c7abb[_0x2f4b('0x37')]));if(_0x368bce[_0x2f4b('0x36')][_0x2f4b('0x3f')]){_0x3a98d6[_0x2f4b('0x40')]=_['merge'](_0x3a98d6['where'],{'$or':_[_0x2f4b('0x31')](_0x3a98d6[_0x2f4b('0x39')],function(_0x2b9500){var _0xa60627={};_0xa60627[_0x2b9500]={'$like':'%'+_0x368bce[_0x2f4b('0x36')]['filter']+'%'};return _0xa60627;})});}_0x3a98d6=_[_0x2f4b('0x41')]({},_0x3a98d6,_0x368bce[_0x2f4b('0x82')]);return _0x1622ad[_0x2f4b('0x8a')](_0x3a98d6);}})[_0x2f4b('0x28')](function(_0x369b3b){if(_0x369b3b){_0x4172d9=_0x369b3b['length'];if(!_0x368bce[_0x2f4b('0x36')]['hasOwnProperty']('nolimit')){_0x3a98d6[_0x2f4b('0x23')]=qs['limit'](_0x368bce[_0x2f4b('0x36')][_0x2f4b('0x23')]);_0x3a98d6[_0x2f4b('0x22')]=qs[_0x2f4b('0x22')](_0x368bce[_0x2f4b('0x36')][_0x2f4b('0x22')]);}return _0x1622ad['getAgents'](_0x3a98d6);}})['then'](function(_0x14513a){if(_0x14513a){return _0x14513a?{'count':_0x4172d9,'rows':_0x14513a}:null;}})[_0x2f4b('0x28')](respondWithResult(_0x46c200,null))[_0x2f4b('0x4c')](handleError(_0x46c200,null));}; \ No newline at end of file +var _0x1192=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Lists','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','CmList','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','CmCustomField','raw','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','end','status','json'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1192,0x71));var _0x2119=function(_0x45b36c,_0x4efbfe){_0x45b36c=_0x45b36c-0x0;var _0x1dad2f=_0x1192[_0x45b36c];return _0x1dad2f;};'use strict';var pdf=require(_0x2119('0x0'));var emlformat=require(_0x2119('0x1'));var rimraf=require(_0x2119('0x2'));var zipdir=require(_0x2119('0x3'));var jsonpatch=require(_0x2119('0x4'));var rp=require(_0x2119('0x5'));var moment=require(_0x2119('0x6'));var BPromise=require(_0x2119('0x7'));var Mustache=require(_0x2119('0x8'));var util=require(_0x2119('0x9'));var path=require(_0x2119('0xa'));var sox=require(_0x2119('0xb'));var csv=require(_0x2119('0xc'));var ejs=require(_0x2119('0xd'));var fs=require('fs');var _=require(_0x2119('0xe'));var squel=require(_0x2119('0xf'));var crypto=require(_0x2119('0x10'));var jsforce=require(_0x2119('0x11'));var deskjs=require(_0x2119('0x12'));var toCsv=require('to-csv');var querystring=require(_0x2119('0x13'));var Papa=require(_0x2119('0x14'));var Redis=require('ioredis');var authService=require(_0x2119('0x15'));var qs=require(_0x2119('0x16'));var as=require(_0x2119('0x17'));var hardwareService=require(_0x2119('0x18'));var logger=require(_0x2119('0x19'))(_0x2119('0x1a'));var utils=require(_0x2119('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x2119('0x1c'));var db=require(_0x2119('0x1d'))['db'];config[_0x2119('0x1e')]=_[_0x2119('0x1f')](config[_0x2119('0x1e')],{'host':_0x2119('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2119('0x1e')]));require(_0x2119('0x21'))['register'](socket);function respondWithStatusCode(_0x40ccc5,_0x3275cd){_0x3275cd=_0x3275cd||0xcc;return function(_0x4160be){if(_0x4160be){return _0x40ccc5[_0x2119('0x22')](_0x3275cd);}return _0x40ccc5['status'](_0x3275cd)[_0x2119('0x23')]();};}function respondWithResult(_0x407622,_0x2dc351){_0x2dc351=_0x2dc351||0xc8;return function(_0x2da5cb){if(_0x2da5cb){return _0x407622[_0x2119('0x24')](_0x2dc351)[_0x2119('0x25')](_0x2da5cb);}};}function respondWithFilteredResult(_0xb3d5e2,_0x4c68b6){return function(_0x1275aa){if(_0x1275aa){var _0x12be49=_0x1275aa[_0x2119('0x26')],_0x5ab410=_0x4c68b6[_0x2119('0x27')],_0x170a9f=_0x4c68b6[_0x2119('0x27')]+_0x4c68b6['limit'],_0x57be46;if(_0x170a9f>=_0x12be49){_0x170a9f=_0x12be49;_0x57be46=0xc8;}else{_0x57be46=0xce;}_0xb3d5e2[_0x2119('0x24')](_0x57be46);return _0xb3d5e2[_0x2119('0x28')](_0x2119('0x29'),_0x5ab410+'-'+_0x170a9f+'/'+_0x12be49)[_0x2119('0x25')](_0x1275aa);}return null;};}function patchUpdates(_0x4c4b95){return function(_0x3bda1c){try{jsonpatch[_0x2119('0x2a')](_0x3bda1c,_0x4c4b95,!![]);}catch(_0xa87c9f){return BPromise[_0x2119('0x2b')](_0xa87c9f);}return _0x3bda1c[_0x2119('0x2c')]();};}function saveUpdates(_0xbfc9d9,_0x6bd311){return function(_0x19a913){if(_0x19a913){return _0x19a913[_0x2119('0x2d')](_0xbfc9d9)[_0x2119('0x2e')](function(_0xaf159c){return _0xaf159c;});}return null;};}function removeEntity(_0xb0c05c,_0x332413){return function(_0x19f2f4){if(_0x19f2f4){return _0x19f2f4[_0x2119('0x2f')]()[_0x2119('0x2e')](function(){var _0x96ab72=_0x19f2f4['get']({'plain':!![]});var _0x1a5d81=_0x2119('0x30');return db['UserProfileResource'][_0x2119('0x2f')]({'where':{'type':_0x1a5d81,'resourceId':_0x96ab72['id']}})[_0x2119('0x2e')](function(){return _0x19f2f4;});})[_0x2119('0x2e')](function(){_0xb0c05c[_0x2119('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbf67,_0x19b2a0){return function(_0x25f5c7){if(!_0x25f5c7){_0x2dbf67[_0x2119('0x22')](0x194);}return _0x25f5c7;};}function handleError(_0x4b3c18,_0x5eeb81){_0x5eeb81=_0x5eeb81||0x1f4;return function(_0x557a30){logger[_0x2119('0x31')](_0x557a30[_0x2119('0x32')]);if(_0x557a30[_0x2119('0x33')]){delete _0x557a30[_0x2119('0x33')];}_0x4b3c18[_0x2119('0x24')](_0x5eeb81)[_0x2119('0x34')](_0x557a30);};}exports[_0x2119('0x35')]=function(_0x2afbd8,_0x100bb9){var _0x23cca4={},_0x21d476={},_0x25a539={'count':0x0,'rows':[]};var _0x3af735=_[_0x2119('0x36')](db['CmList']['rawAttributes'],function(_0x132c55){return{'name':_0x132c55[_0x2119('0x37')],'type':_0x132c55[_0x2119('0x38')][_0x2119('0x39')]};});_0x21d476[_0x2119('0x3a')]=_['map'](_0x3af735,_0x2119('0x33'));_0x21d476['query']=_[_0x2119('0x3b')](_0x2afbd8[_0x2119('0x3c')]);_0x21d476[_0x2119('0x3d')]=_[_0x2119('0x3e')](_0x21d476['model'],_0x21d476['query']);_0x23cca4['attributes']=_['intersection'](_0x21d476[_0x2119('0x3a')],qs['fields'](_0x2afbd8[_0x2119('0x3c')]['fields']));_0x23cca4[_0x2119('0x3f')]=_0x23cca4[_0x2119('0x3f')][_0x2119('0x40')]?_0x23cca4[_0x2119('0x3f')]:_0x21d476[_0x2119('0x3a')];if(!_0x2afbd8[_0x2119('0x3c')][_0x2119('0x41')](_0x2119('0x42'))){_0x23cca4[_0x2119('0x43')]=qs['limit'](_0x2afbd8['query']['limit']);_0x23cca4[_0x2119('0x27')]=qs['offset'](_0x2afbd8[_0x2119('0x3c')][_0x2119('0x27')]);}_0x23cca4[_0x2119('0x44')]=qs[_0x2119('0x45')](_0x2afbd8[_0x2119('0x3c')]['sort']);_0x23cca4['where']=qs[_0x2119('0x3d')](_[_0x2119('0x46')](_0x2afbd8[_0x2119('0x3c')],_0x21d476[_0x2119('0x3d')]),_0x3af735);if(_0x2afbd8[_0x2119('0x3c')][_0x2119('0x47')]){_0x23cca4[_0x2119('0x48')]=_[_0x2119('0x49')](_0x23cca4[_0x2119('0x48')],{'$or':_[_0x2119('0x36')](_0x3af735,function(_0x147eaf){if(_0x147eaf[_0x2119('0x38')]!=='VIRTUAL'){var _0x319941={};_0x319941[_0x147eaf[_0x2119('0x33')]]={'$like':'%'+_0x2afbd8[_0x2119('0x3c')][_0x2119('0x47')]+'%'};return _0x319941;}})});}_0x23cca4=_[_0x2119('0x49')]({},_0x23cca4,_0x2afbd8[_0x2119('0x4a')]);var _0x2ed15a={'where':_0x23cca4[_0x2119('0x48')]};return db[_0x2119('0x4b')][_0x2119('0x26')](_0x2ed15a)[_0x2119('0x2e')](function(_0x27301e){_0x25a539[_0x2119('0x26')]=_0x27301e;if(_0x2afbd8[_0x2119('0x3c')][_0x2119('0x4c')]){_0x23cca4[_0x2119('0x4d')]=[{'all':!![]}];}return db[_0x2119('0x4b')][_0x2119('0x4e')](_0x23cca4);})[_0x2119('0x2e')](function(_0x19800a){_0x25a539[_0x2119('0x4f')]=_0x19800a;return _0x25a539;})[_0x2119('0x2e')](respondWithFilteredResult(_0x100bb9,_0x23cca4))[_0x2119('0x50')](handleError(_0x100bb9,null));};exports[_0x2119('0x51')]=function(_0x521de6,_0x31cb41){var _0x1bc22c={'raw':![],'where':{'id':_0x521de6['params']['id']}},_0x6960fe={};_0x6960fe[_0x2119('0x3a')]=_[_0x2119('0x3b')](db[_0x2119('0x4b')][_0x2119('0x52')]);_0x6960fe[_0x2119('0x3c')]=_['keys'](_0x521de6['query']);_0x6960fe['filters']=_[_0x2119('0x3e')](_0x6960fe[_0x2119('0x3a')],_0x6960fe['query']);_0x1bc22c[_0x2119('0x3f')]=_['intersection'](_0x6960fe[_0x2119('0x3a')],qs[_0x2119('0x53')](_0x521de6[_0x2119('0x3c')][_0x2119('0x53')]));_0x1bc22c[_0x2119('0x3f')]=_0x1bc22c[_0x2119('0x3f')][_0x2119('0x40')]?_0x1bc22c[_0x2119('0x3f')]:_0x6960fe[_0x2119('0x3a')];if(_0x521de6[_0x2119('0x3c')][_0x2119('0x4c')]){_0x1bc22c['include']=[{'all':!![]}];}_0x1bc22c=_[_0x2119('0x49')]({},_0x1bc22c,_0x521de6[_0x2119('0x4a')]);return db[_0x2119('0x4b')][_0x2119('0x54')](_0x1bc22c)[_0x2119('0x2e')](handleEntityNotFound(_0x31cb41,null))[_0x2119('0x2e')](respondWithResult(_0x31cb41,null))[_0x2119('0x50')](handleError(_0x31cb41,null));};exports[_0x2119('0x55')]=function(_0xab2a70,_0x217e42){return db['CmList'][_0x2119('0x55')](_0xab2a70['body'],{})[_0x2119('0x2e')](function(_0x365053){var _0x3d29cf=_0xab2a70[_0x2119('0x56')][_0x2119('0x57')]({'plain':!![]});if(!_0x3d29cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d29cf['role']==='user'){var _0x2a4bc6=_0x365053[_0x2119('0x57')]({'plain':!![]});var _0x45471c=_0x2119('0x30');return db[_0x2119('0x58')][_0x2119('0x54')]({'where':{'name':_0x45471c,'userProfileId':_0x3d29cf['userProfileId']},'raw':!![]})[_0x2119('0x2e')](function(_0x4c72e0){if(_0x4c72e0&&_0x4c72e0[_0x2119('0x59')]===0x0){return db[_0x2119('0x5a')][_0x2119('0x55')]({'name':_0x2a4bc6['name'],'resourceId':_0x2a4bc6['id'],'type':_0x4c72e0[_0x2119('0x33')],'sectionId':_0x4c72e0['id']},{})[_0x2119('0x2e')](function(){return _0x365053;});}else{return _0x365053;}})[_0x2119('0x50')](function(_0x34d128){logger[_0x2119('0x31')](_0x2119('0x5b'),_0x34d128);throw _0x34d128;});}return _0x365053;})['then'](respondWithResult(_0x217e42,0xc9))[_0x2119('0x50')](handleError(_0x217e42,null));};exports[_0x2119('0x2d')]=function(_0x4b27ea,_0x28c963){if(_0x4b27ea['body']['id']){delete _0x4b27ea['body']['id'];}return db[_0x2119('0x4b')][_0x2119('0x54')]({'where':{'id':_0x4b27ea[_0x2119('0x5c')]['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x28c963,null))['then'](saveUpdates(_0x4b27ea[_0x2119('0x5d')],null))[_0x2119('0x2e')](respondWithResult(_0x28c963,null))[_0x2119('0x50')](handleError(_0x28c963,null));};exports[_0x2119('0x2f')]=function(_0x5c4b67,_0x141b20){return db[_0x2119('0x4b')]['find']({'where':{'id':_0x5c4b67[_0x2119('0x5c')]['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x141b20,null))['then'](removeEntity(_0x141b20,null))[_0x2119('0x50')](handleError(_0x141b20,null));};exports[_0x2119('0x5e')]=function(_0x286167,_0x2d41be){return db[_0x2119('0x4b')][_0x2119('0x5e')]()[_0x2119('0x2e')](respondWithResult(_0x2d41be,null))[_0x2119('0x50')](handleError(_0x2d41be,null));};exports[_0x2119('0x5f')]=function(_0x3c6366,_0x52d4f3,_0x18aef4){if(_0x3c6366[_0x2119('0x5d')]['id']){delete _0x3c6366['body']['id'];}return db[_0x2119('0x4b')]['find']({'where':{'id':_0x3c6366[_0x2119('0x5c')]['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x52d4f3,null))[_0x2119('0x2e')](function(_0x2acd3a){if(_0x2acd3a){_0x3c6366['body'][_0x2119('0x60')]=_0x2acd3a['id'];return db[_0x2119('0x61')]['create'](_0x3c6366[_0x2119('0x5d')]);}})[_0x2119('0x2e')](respondWithResult(_0x52d4f3,null))[_0x2119('0x50')](handleError(_0x52d4f3,null));};exports[_0x2119('0x62')]=function(_0x5061e2,_0xd1a955,_0x34e585){var _0x3bd697={'raw':![],'where':{}};var _0xefc5dc={};var _0x324938={'count':0x0,'rows':[]};return db['CmList'][_0x2119('0x63')]({'where':{'id':_0x5061e2[_0x2119('0x5c')]['id']}})['then'](handleEntityNotFound(_0xd1a955,null))['then'](function(_0x28fb67){if(_0x28fb67){_0xefc5dc[_0x2119('0x3a')]=_[_0x2119('0x3b')](db[_0x2119('0x61')][_0x2119('0x52')]);_0xefc5dc['query']=_[_0x2119('0x3b')](_0x5061e2[_0x2119('0x3c')]);_0xefc5dc[_0x2119('0x3d')]=_[_0x2119('0x3e')](_0xefc5dc['model'],_0xefc5dc[_0x2119('0x3c')]);_0x3bd697[_0x2119('0x3f')]=_[_0x2119('0x3e')](_0xefc5dc[_0x2119('0x3a')],qs[_0x2119('0x53')](_0x5061e2[_0x2119('0x3c')]['fields']));_0x3bd697[_0x2119('0x3f')]=_0x3bd697[_0x2119('0x3f')]['length']?_0x3bd697['attributes']:_0xefc5dc[_0x2119('0x3a')];if(!_0x5061e2['query'][_0x2119('0x41')]('nolimit')){_0x3bd697[_0x2119('0x43')]=qs[_0x2119('0x43')](_0x5061e2[_0x2119('0x3c')][_0x2119('0x43')]);_0x3bd697[_0x2119('0x27')]=qs[_0x2119('0x27')](_0x5061e2[_0x2119('0x3c')][_0x2119('0x27')]);}_0x3bd697['order']=qs['sort'](_0x5061e2[_0x2119('0x3c')]['sort']);_0x3bd697['where']=qs['filters'](_[_0x2119('0x46')](_0x5061e2[_0x2119('0x3c')],_0xefc5dc[_0x2119('0x3d')]));_0x3bd697[_0x2119('0x48')][_0x2119('0x60')]=_0x28fb67['id'];if(_0x5061e2[_0x2119('0x3c')][_0x2119('0x47')]){_0x3bd697['where']=_[_0x2119('0x49')](_0x3bd697[_0x2119('0x48')],{'$or':_[_0x2119('0x36')](_0x3bd697[_0x2119('0x3f')],function(_0x5c382e){var _0x3c390e={};_0x3c390e[_0x5c382e]={'$like':'%'+_0x5061e2[_0x2119('0x3c')]['filter']+'%'};return _0x3c390e;})});}_0x3bd697=_['merge']({},_0x3bd697,_0x5061e2[_0x2119('0x4a')]);return db[_0x2119('0x61')][_0x2119('0x26')]({'where':_0x3bd697[_0x2119('0x48')]})[_0x2119('0x2e')](function(_0x1b45e5){_0x324938[_0x2119('0x26')]=_0x1b45e5;if(_0x5061e2[_0x2119('0x3c')][_0x2119('0x4c')]){_0x3bd697[_0x2119('0x4d')]=[{'all':!![]}];}return db[_0x2119('0x61')]['findAll'](_0x3bd697);})[_0x2119('0x2e')](function(_0x1e8f52){_0x324938[_0x2119('0x4f')]=_0x1e8f52;return _0x324938;});}})['then'](respondWithFilteredResult(_0xd1a955,_0x3bd697))[_0x2119('0x50')](handleError(_0xd1a955,null));};exports[_0x2119('0x64')]=function(_0x1f25ab,_0x40a135,_0x32cc0e){return db[_0x2119('0x4b')][_0x2119('0x54')]({'where':{'id':_0x1f25ab['params']['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x40a135,null))['then'](function(_0x1314c4){if(_0x1314c4){return _0x1314c4[_0x2119('0x64')](_0x1f25ab[_0x2119('0x3c')][_0x2119('0x65')]);}})[_0x2119('0x2e')](respondWithStatusCode(_0x40a135,null))[_0x2119('0x50')](handleError(_0x40a135,null));};exports[_0x2119('0x66')]=function(_0x1bf5be,_0x5313a9,_0x5cfb8f){return db['CmList']['find']({'where':{'id':_0x1bf5be[_0x2119('0x5c')]['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x5313a9,null))[_0x2119('0x2e')](function(_0x18172d){if(_0x18172d){var _0x182e43=[];var _0x3f2ef1={'success':[],'errors':[]};return db[_0x2119('0x67')]['describe']()[_0x2119('0x2e')](function(_0xfaae23){if(_0x1bf5be[_0x2119('0x5d')]['tags']&&_[_0x2119('0x68')](_0x1bf5be[_0x2119('0x5d')][_0x2119('0x69')])){if(_0x1bf5be[_0x2119('0x5d')][_0x2119('0x69')][_0x2119('0x40')]){_0x1bf5be[_0x2119('0x5d')][_0x2119('0x69')]=_0x1bf5be[_0x2119('0x5d')][_0x2119('0x69')][_0x2119('0x6a')](';')+';';}else{_0x1bf5be['body']['tags']=null;}}else{_0x1bf5be[_0x2119('0x5d')][_0x2119('0x69')]=null;}if(_0x1bf5be['body']&&_['isArray'](_0x1bf5be[_0x2119('0x5d')])){for(var _0x349bbd=0x0;_0x349bbd<_0x1bf5be[_0x2119('0x5d')][_0x2119('0x40')];_0x349bbd+=0x1){_0x1bf5be[_0x2119('0x5d')][_0x349bbd][_0x2119('0x60')]=_0x1bf5be[_0x2119('0x5c')]['id'];_0x182e43[_0x2119('0x6b')](_0x1bf5be[_0x2119('0x5d')][_0x349bbd]);}return BPromise[_0x2119('0x6c')](_0x182e43,function(_0x559b5b){return db[_0x2119('0x67')][_0x2119('0x55')](_[_0x2119('0x6d')](_0x559b5b,[_0x2119('0x65'),'id'])||{},{'fields':_[_0x2119('0x3b')](_0xfaae23),'raw':!![]})['then'](function(_0x5dd21d){_0x3f2ef1[_0x2119('0x6e')][_0x2119('0x6b')](_0x5dd21d[_0x2119('0x6f')]);})[_0x2119('0x50')](function(_0x5410a3){_0x3f2ef1['errors'][_0x2119('0x6b')]({'data':_0x559b5b,'error':_0x5410a3[_0x2119('0x70')]});});})[_0x2119('0x2e')](function(_0x359099){return _0x3f2ef1;})[_0x2119('0x50')](function(_0x1760fa){return _0x1760fa;});}else{_0x5313a9['status'](0x190)[_0x2119('0x25')]({'message':_0x2119('0x71')});}});}})[_0x2119('0x2e')](respondWithResult(_0x5313a9,null))[_0x2119('0x50')](handleError(_0x5313a9,null));};exports[_0x2119('0x72')]=function(_0x374921,_0xb82688,_0x10cd2d){var _0x31c5b0;return db[_0x2119('0x4b')][_0x2119('0x54')]({'where':{'id':_0x374921[_0x2119('0x5c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x2119('0x73')}]})[_0x2119('0x2e')](handleEntityNotFound(_0xb82688,null))['then'](function(_0x4cde75){if(_0x4cde75){_0x31c5b0=_0x4cde75;return db['CmContact'][_0x2119('0x52')];}})['then'](function(_0x1e364f){if(_0x1e364f){var _0x1461c3={};var _0x1a729f={};_0x1a729f[_0x2119('0x3a')]=_[_0x2119('0x74')](_[_0x2119('0x3b')](_0x1e364f),_[_0x2119('0x36')](_0x31c5b0[_0x2119('0x73')],function(_0x2f8906){return util[_0x2119('0x75')](_0x2119('0x76'),_0x2f8906['id']);}));_0x1a729f['query']=_[_0x2119('0x3b')](_0x374921['query']);_0x1a729f[_0x2119('0x3d')]=_['intersection'](_0x1a729f['model'],_0x1a729f[_0x2119('0x3c')]);_0x1461c3[_0x2119('0x3f')]=_['intersection'](_0x1a729f['model'],qs[_0x2119('0x53')](_0x374921[_0x2119('0x3c')][_0x2119('0x53')]));_0x1461c3[_0x2119('0x3f')]=_0x1461c3[_0x2119('0x3f')][_0x2119('0x40')]?_0x1461c3[_0x2119('0x3f')]:_0x1a729f[_0x2119('0x3a')];if(!_0x374921[_0x2119('0x3c')][_0x2119('0x41')](_0x2119('0x42'))){_0x1461c3[_0x2119('0x43')]=qs[_0x2119('0x43')](_0x374921['query']['limit']);_0x1461c3[_0x2119('0x27')]=qs[_0x2119('0x27')](_0x374921['query'][_0x2119('0x27')]);}_0x1461c3[_0x2119('0x44')]=qs[_0x2119('0x45')](_0x374921[_0x2119('0x3c')][_0x2119('0x45')]);_0x1461c3[_0x2119('0x48')]=qs[_0x2119('0x3d')](_[_0x2119('0x46')](_0x374921[_0x2119('0x3c')],_0x1a729f[_0x2119('0x3d')]));_0x1461c3['raw']=!![];if(_0x374921[_0x2119('0x3c')][_0x2119('0x47')]){_0x1461c3[_0x2119('0x48')]=_['merge'](_0x1461c3['where'],{'$or':_[_0x2119('0x36')](_0x1461c3['attributes'],function(_0x23c788){var _0x1a690c={};_0x1a690c[_0x23c788]={'$like':'%'+_0x374921[_0x2119('0x3c')][_0x2119('0x47')]+'%'};return _0x1a690c;})});}_0x1461c3=_['merge']({},_0x1461c3,_0x374921[_0x2119('0x4a')]);return _0x31c5b0[_0x2119('0x72')](_0x1461c3);}})[_0x2119('0x2e')](respondWithResult(_0xb82688,null))[_0x2119('0x50')](handleError(_0xb82688,null));};exports['getContactsCsv']=function(_0x5e86ff,_0x3888ec,_0x372fb4){var _0x19033f;return db[_0x2119('0x4b')][_0x2119('0x54')]({'where':{'id':_0x5e86ff[_0x2119('0x5c')]['id']},'include':[{'model':db[_0x2119('0x77')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x3888ec,null))[_0x2119('0x2e')](function(_0x5a0a46){if(_0x5a0a46){_0x19033f=_0x5a0a46;return db[_0x2119('0x67')][_0x2119('0x52')];}})[_0x2119('0x2e')](function(_0x32e753){if(_0x32e753){var _0xd14bd9={};var _0x3b8ac6={};_0x3b8ac6['model']=_[_0x2119('0x74')](_[_0x2119('0x3b')](_0x32e753),_[_0x2119('0x36')](_0x19033f[_0x2119('0x73')],function(_0x99f770){return util[_0x2119('0x75')](_0x2119('0x76'),_0x99f770['id']);}));_0x3b8ac6[_0x2119('0x3c')]=_[_0x2119('0x3b')](_0x5e86ff[_0x2119('0x3c')]);_0x3b8ac6['filters']=_['intersection'](_0x3b8ac6[_0x2119('0x3a')],_0x3b8ac6[_0x2119('0x3c')]);_0xd14bd9[_0x2119('0x3f')]=_[_0x2119('0x3e')](_0x3b8ac6[_0x2119('0x3a')],qs[_0x2119('0x53')](_0x5e86ff[_0x2119('0x3c')][_0x2119('0x53')]));_0xd14bd9['attributes']=_0xd14bd9['attributes']['length']?_0xd14bd9[_0x2119('0x3f')]:_0x3b8ac6['model'];if(!_0x5e86ff[_0x2119('0x3c')][_0x2119('0x41')]('nolimit')){_0xd14bd9[_0x2119('0x43')]=qs[_0x2119('0x43')](_0x5e86ff[_0x2119('0x3c')]['limit']);_0xd14bd9[_0x2119('0x27')]=qs[_0x2119('0x27')](_0x5e86ff['query']['offset']);}_0xd14bd9[_0x2119('0x44')]=qs['sort'](_0x5e86ff[_0x2119('0x3c')]['sort']);_0xd14bd9['where']=qs[_0x2119('0x3d')](_[_0x2119('0x46')](_0x5e86ff['query'],_0x3b8ac6[_0x2119('0x3d')]));_0xd14bd9[_0x2119('0x78')]=!![];if(_0x5e86ff[_0x2119('0x3c')][_0x2119('0x47')]){_0xd14bd9[_0x2119('0x48')]=_[_0x2119('0x49')](_0xd14bd9[_0x2119('0x48')],{'$or':_[_0x2119('0x36')](_0xd14bd9[_0x2119('0x3f')],function(_0x5c0173){var _0x1af33b={};_0x1af33b[_0x5c0173]={'$like':'%'+_0x5e86ff[_0x2119('0x3c')][_0x2119('0x47')]+'%'};return _0x1af33b;})});}_0xd14bd9=_[_0x2119('0x49')]({},_0xd14bd9,_0x5e86ff[_0x2119('0x4a')]);return _0x19033f['getContacts'](_0xd14bd9);}})[_0x2119('0x2e')](function(_0x5ac320){if(!_['isEmpty'](_0x5ac320)){var _0x447283=toCsv(_0x5ac320);var _0x3d818a=Date[_0x2119('0x79')]();fs[_0x2119('0x7a')](util[_0x2119('0x75')](_0x2119('0x7b'),_0x19033f['id'],_0x3d818a),_0x447283);_0x3888ec[_0x2119('0x7c')]('Content-disposition','attachment;\x20filename='+util[_0x2119('0x75')](_0x2119('0x7d'),_0x19033f['id'],_0x3d818a));_0x3888ec[_0x2119('0x7c')](_0x2119('0x7e'),'text/csv');return _0x3888ec[_0x2119('0x7f')](util[_0x2119('0x75')](_0x2119('0x7b'),_0x19033f['id'],_0x3d818a));}else{return _0x3888ec['sendStatus'](0xcc);}})[_0x2119('0x50')](handleError(_0x3888ec,null));};exports[_0x2119('0x80')]=function(_0x2ab945,_0x2e3866,_0x416612){var _0x9bb937;delete _0x2ab945[_0x2119('0x5d')]['id'];return db[_0x2119('0x4b')][_0x2119('0x63')]({'where':{'id':_0x2ab945[_0x2119('0x5c')]['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x2e3866,null))[_0x2119('0x2e')](function(_0x788a6){if(_0x788a6){return db[_0x2119('0x81')][_0x2119('0x82')](function(_0x5350e2){return db[_0x2119('0x77')]['create'](_0x2ab945[_0x2119('0x5d')],{'transaction':_0x5350e2})['then'](function(_0x3eaf12){_0x9bb937=_0x3eaf12;return _0x788a6[_0x2119('0x83')](_0x3eaf12,{'transaction':_0x5350e2});})[_0x2119('0x2e')](function(){var _0x42c059={'type':db['Sequelize']['TEXT'],'transaction':_0x5350e2};switch(_0x2ab945[_0x2119('0x5d')][_0x2119('0x38')]){case _0x2119('0x84'):_0x42c059['type']=db[_0x2119('0x85')][_0x2119('0x86')];break;case _0x2119('0x87'):_0x42c059[_0x2119('0x38')]=db[_0x2119('0x85')][_0x2119('0x88')];break;case _0x2119('0x89'):_0x42c059[_0x2119('0x38')]=db['Sequelize'][_0x2119('0x8a')];_0x42c059[_0x2119('0x8b')]=![];break;default:}return db[_0x2119('0x81')][_0x2119('0x8c')][_0x2119('0x8d')](_0x2119('0x8e'),util[_0x2119('0x75')](_0x2119('0x8f'),_0x9bb937['id']),_0x42c059);})[_0x2119('0x2e')](function(){return _0x9bb937;});});}})[_0x2119('0x2e')](respondWithResult(_0x2e3866,null))[_0x2119('0x50')](handleError(_0x2e3866,null));};exports['getCustomFields']=function(_0x48a3df,_0x2d6455,_0x25b3f6){var _0x359ec8={};var _0x4cd628={};var _0x36bc18;var _0x17bc9f;return db[_0x2119('0x4b')][_0x2119('0x63')]({'where':{'id':_0x48a3df[_0x2119('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2d6455,null))['then'](function(_0x5bef71){if(_0x5bef71){_0x36bc18=_0x5bef71;_0x4cd628[_0x2119('0x3a')]=_[_0x2119('0x3b')](db['CmCustomField'][_0x2119('0x52')]);_0x4cd628[_0x2119('0x3c')]=_[_0x2119('0x3b')](_0x48a3df[_0x2119('0x3c')]);_0x4cd628[_0x2119('0x3d')]=_[_0x2119('0x3e')](_0x4cd628['model'],_0x4cd628['query']);_0x359ec8[_0x2119('0x3f')]=_[_0x2119('0x3e')](_0x4cd628[_0x2119('0x3a')],qs['fields'](_0x48a3df[_0x2119('0x3c')][_0x2119('0x53')]));_0x359ec8['attributes']=_0x359ec8[_0x2119('0x3f')][_0x2119('0x40')]?_0x359ec8[_0x2119('0x3f')]:_0x4cd628[_0x2119('0x3a')];_0x359ec8['order']=qs['sort'](_0x48a3df['query'][_0x2119('0x45')]);_0x359ec8['where']=qs[_0x2119('0x3d')](_['pick'](_0x48a3df[_0x2119('0x3c')],_0x4cd628['filters']));_0x359ec8[_0x2119('0x48')]=_['merge'](_0x359ec8[_0x2119('0x48')],{'$or':[{'ListId':_0x5bef71['id']},{'ListId':null}]});if(_0x48a3df['query'][_0x2119('0x47')]){_0x359ec8[_0x2119('0x48')]=_[_0x2119('0x49')](_0x359ec8[_0x2119('0x48')],{'$or':_[_0x2119('0x36')](_0x359ec8[_0x2119('0x3f')],function(_0x53e071){var _0x1d6746={};_0x1d6746[_0x53e071]={'$like':'%'+_0x48a3df[_0x2119('0x3c')][_0x2119('0x47')]+'%'};return _0x1d6746;})});}_0x359ec8=_[_0x2119('0x49')]({},_0x359ec8,_0x48a3df[_0x2119('0x4a')]);return db[_0x2119('0x77')]['findAndCountAll'](_0x359ec8);}})[_0x2119('0x2e')](respondWithResult(_0x2d6455,null))[_0x2119('0x50')](handleError(_0x2d6455,null));};exports[_0x2119('0x90')]=function(_0x532a05,_0x393f8f,_0x5efabe){return db['CmList'][_0x2119('0x54')]({'where':{'id':_0x532a05[_0x2119('0x5c')]['id']}})['then'](handleEntityNotFound(_0x393f8f,null))['then'](function(_0x20bf8e){if(_0x20bf8e){return _0x20bf8e[_0x2119('0x90')](_0x532a05['body'][_0x2119('0x65')],_[_0x2119('0x6d')](_0x532a05[_0x2119('0x5d')],[_0x2119('0x65'),'id'])||{})[_0x2119('0x91')](function(_0x42eb54){for(var _0x250992=0x0;_0x250992<_0x532a05[_0x2119('0x5d')][_0x2119('0x65')][_0x2119('0x40')];_0x250992+=0x1){socket[_0x2119('0x92')]('userCmList:save',{'UserId':_0x532a05[_0x2119('0x5d')][_0x2119('0x65')][_0x250992],'CmListId':_0x532a05[_0x2119('0x5c')]['id']});}return _0x42eb54;});}})['then'](respondWithResult(_0x393f8f,null))['catch'](handleError(_0x393f8f,null));};exports[_0x2119('0x93')]=function(_0x551b54,_0x53d400,_0xf9d398){return db[_0x2119('0x4b')][_0x2119('0x54')]({'where':{'id':_0x551b54[_0x2119('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53d400,null))[_0x2119('0x2e')](function(_0x25a23d){if(_0x25a23d){return _0x25a23d[_0x2119('0x93')](_0x551b54[_0x2119('0x3c')][_0x2119('0x65')])[_0x2119('0x2e')](function(){if(_[_0x2119('0x68')](_0x551b54[_0x2119('0x3c')][_0x2119('0x65')])){for(var _0x2d311f=0x0;_0x2d311f<_0x551b54[_0x2119('0x3c')][_0x2119('0x65')][_0x2119('0x40')];_0x2d311f+=0x1){socket['emit'](_0x2119('0x94'),{'UserId':Number(_0x551b54['query'][_0x2119('0x65')][_0x2d311f]),'CmListId':Number(_0x551b54['params']['id'])});}}else{socket[_0x2119('0x92')](_0x2119('0x94'),{'UserId':Number(_0x551b54['query'][_0x2119('0x65')]),'CmListId':Number(_0x551b54[_0x2119('0x5c')]['id'])});}});}})[_0x2119('0x2e')](respondWithStatusCode(_0x53d400,null))[_0x2119('0x50')](handleError(_0x53d400,null));};exports[_0x2119('0x95')]=function(_0x3a2a9a,_0x50df5e,_0x38ec96){var _0x365949={};var _0x4d8501={};var _0xc7bd54;var _0x5f1d79;return db[_0x2119('0x4b')]['findOne']({'where':{'id':_0x3a2a9a[_0x2119('0x5c')]['id']}})[_0x2119('0x2e')](handleEntityNotFound(_0x50df5e,null))['then'](function(_0x45a4de){if(_0x45a4de){_0xc7bd54=_0x45a4de;_0x4d8501[_0x2119('0x3a')]=_[_0x2119('0x3b')](db[_0x2119('0x96')][_0x2119('0x52')]);_0x4d8501['query']=_[_0x2119('0x3b')](_0x3a2a9a[_0x2119('0x3c')]);_0x4d8501[_0x2119('0x3d')]=_[_0x2119('0x3e')](_0x4d8501[_0x2119('0x3a')],_0x4d8501[_0x2119('0x3c')]);_0x365949[_0x2119('0x3f')]=_['intersection'](_0x4d8501[_0x2119('0x3a')],qs['fields'](_0x3a2a9a[_0x2119('0x3c')][_0x2119('0x53')]));_0x365949[_0x2119('0x3f')]=_0x365949[_0x2119('0x3f')][_0x2119('0x40')]?_0x365949[_0x2119('0x3f')]:_0x4d8501[_0x2119('0x3a')];_0x365949['order']=qs['sort'](_0x3a2a9a['query'][_0x2119('0x45')]);_0x365949[_0x2119('0x48')]=qs['filters'](_['pick'](_0x3a2a9a[_0x2119('0x3c')],_0x4d8501[_0x2119('0x3d')]));if(_0x3a2a9a[_0x2119('0x3c')][_0x2119('0x47')]){_0x365949[_0x2119('0x48')]=_[_0x2119('0x49')](_0x365949[_0x2119('0x48')],{'$or':_[_0x2119('0x36')](_0x365949[_0x2119('0x3f')],function(_0x14a898){var _0x304eb5={};_0x304eb5[_0x14a898]={'$like':'%'+_0x3a2a9a['query'][_0x2119('0x47')]+'%'};return _0x304eb5;})});}_0x365949=_[_0x2119('0x49')]({},_0x365949,_0x3a2a9a[_0x2119('0x4a')]);return _0xc7bd54['getAgents'](_0x365949);}})[_0x2119('0x2e')](function(_0x19b045){if(_0x19b045){_0x5f1d79=_0x19b045[_0x2119('0x40')];if(!_0x3a2a9a['query'][_0x2119('0x41')]('nolimit')){_0x365949[_0x2119('0x43')]=qs[_0x2119('0x43')](_0x3a2a9a[_0x2119('0x3c')][_0x2119('0x43')]);_0x365949[_0x2119('0x27')]=qs['offset'](_0x3a2a9a[_0x2119('0x3c')]['offset']);}return _0xc7bd54['getAgents'](_0x365949);}})[_0x2119('0x2e')](function(_0x51c69e){if(_0x51c69e){return _0x51c69e?{'count':_0x5f1d79,'rows':_0x51c69e}:null;}})[_0x2119('0x2e')](respondWithResult(_0x50df5e,null))[_0x2119('0x50')](handleError(_0x50df5e,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1be3af5..0f7bdfa 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 _0xf1ec=['setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb','CmList'];(function(_0x5d2170,_0x17572e){var _0x3e7aba=function(_0x233d9b){while(--_0x233d9b){_0x5d2170['push'](_0x5d2170['shift']());}};_0x3e7aba(++_0x17572e);}(_0xf1ec,0x107));var _0xcf1e=function(_0x444f36,_0x1df79b){_0x444f36=_0x444f36-0x0;var _0x2578da=_0xf1ec[_0x444f36];return _0x2578da;};'use strict';var EventEmitter=require(_0xcf1e('0x0'));var CmList=require(_0xcf1e('0x1'))['db'][_0xcf1e('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xcf1e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x408812){return function(_0x121b73,_0x439a43,_0x4cd7b4){CmListEvents[_0xcf1e('0x4')](_0x408812+':'+_0x121b73['id'],_0x121b73);CmListEvents['emit'](_0x408812,_0x121b73);_0x4cd7b4(null);};}for(var e in events){if(events[_0xcf1e('0x5')](e)){var event=events[e];CmList[_0xcf1e('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xd03c=['../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd03c,0x1dd));var _0xcd03=function(_0x4fdae6,_0x20ec79){_0x4fdae6=_0x4fdae6-0x0;var _0x49aea1=_0xd03c[_0x4fdae6];return _0x49aea1;};'use strict';var EventEmitter=require('events');var CmList=require(_0xcd03('0x0'))['db'][_0xcd03('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xcd03('0x2')](0x0);var events={'afterCreate':_0xcd03('0x3'),'afterUpdate':_0xcd03('0x4'),'afterDestroy':_0xcd03('0x5')};function emitEvent(_0x426ca3){return function(_0x4a64be,_0x1235a7,_0xbcfd1b){CmListEvents[_0xcd03('0x6')](_0x426ca3+':'+_0x4a64be['id'],_0x4a64be);CmListEvents['emit'](_0x426ca3,_0x4a64be);_0xbcfd1b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xcd03('0x7')](e,emitEvent(event));}}module[_0xcd03('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f517a49..b5bb4fe 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 _0xaf8f=['./cmList.attributes','exports','CmList','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xaf8f,0xff));var _0xfaf8=function(_0x8203b7,_0x117ba8){_0x8203b7=_0x8203b7-0x0;var _0x35ecfd=_0xaf8f[_0x8203b7];return _0x35ecfd;};'use strict';var _=require(_0xfaf8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfaf8('0x1'));var moment=require('moment');var BPromise=require(_0xfaf8('0x2'));var rp=require(_0xfaf8('0x3'));var fs=require('fs');var path=require(_0xfaf8('0x4'));var rimraf=require('rimraf');var config=require(_0xfaf8('0x5'));var attributes=require(_0xfaf8('0x6'));module[_0xfaf8('0x7')]=function(_0x1b0ebd,_0x3b2ea2){return _0x1b0ebd['define'](_0xfaf8('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19bb=['./cmList.attributes','exports','CmList','cm_lists','../../config/logger','api','path','rimraf'];(function(_0x5301fb,_0x43a7cb){var _0x481b00=function(_0x14cbe6){while(--_0x14cbe6){_0x5301fb['push'](_0x5301fb['shift']());}};_0x481b00(++_0x43a7cb);}(_0x19bb,0x184));var _0xb19b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19bb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb19b('0x0'))(_0xb19b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb19b('0x2'));var rimraf=require(_0xb19b('0x3'));var config=require('../../config/environment');var attributes=require(_0xb19b('0x4'));module[_0xb19b('0x5')]=function(_0x3844c8,_0x15554b){return _0x3844c8['define'](_0xb19b('0x6'),attributes,{'tableName':_0xb19b('0x7'),'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 5757f97..dfe7778 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 _0x9f8c=['util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9f8c,0x1f3));var _0xc9f8=function(_0x5b37ce,_0x549642){_0x5b37ce=_0x5b37ce-0x0;var _0x36c44f=_0x9f8c[_0x5b37ce];return _0x36c44f;};'use strict';var _=require(_0xc9f8('0x0'));var util=require(_0xc9f8('0x1'));var moment=require(_0xc9f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9f8('0x4'));var logger=require(_0xc9f8('0x5'))('rpc');var config=require(_0xc9f8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc9f8('0x7')][_0xc9f8('0x8')]({'port':0x232a});config[_0xc9f8('0x9')]=_[_0xc9f8('0xa')](config[_0xc9f8('0x9')],{'host':_0xc9f8('0xb'),'port':0x18eb});var socket=require(_0xc9f8('0xc'))(new Redis(config[_0xc9f8('0x9')]));require(_0xc9f8('0xd'))[_0xc9f8('0xe')](socket);function respondWithRpcPromise(_0x1a04fc,_0x5b4aa8,_0x3c75e2){return new BPromise(function(_0x2cbcfe,_0x181640){return client['request'](_0x1a04fc,_0x3c75e2)['then'](function(_0x2e897d){logger['info'](_0xc9f8('0xf'),_0x5b4aa8,_0xc9f8('0x10'));logger[_0xc9f8('0x11')](_0xc9f8('0x12'),_0x5b4aa8,_0xc9f8('0x10'),JSON[_0xc9f8('0x13')](_0x2e897d));if(_0x2e897d[_0xc9f8('0x14')]){if(_0x2e897d[_0xc9f8('0x14')][_0xc9f8('0x15')]===0x1f4){logger['error'](_0xc9f8('0xf'),_0x5b4aa8,_0x2e897d[_0xc9f8('0x14')][_0xc9f8('0x16')]);return _0x181640(_0x2e897d['error'][_0xc9f8('0x16')]);}logger[_0xc9f8('0x14')]('CmList,\x20%s,\x20%s',_0x5b4aa8,_0x2e897d[_0xc9f8('0x14')][_0xc9f8('0x16')]);return _0x2cbcfe(_0x2e897d[_0xc9f8('0x14')]['message']);}else{logger[_0xc9f8('0x17')](_0xc9f8('0xf'),_0x5b4aa8,_0xc9f8('0x10'));_0x2cbcfe(_0x2e897d['result']['message']);}})[_0xc9f8('0x18')](function(_0x377c41){logger[_0xc9f8('0x14')](_0xc9f8('0xf'),_0x5b4aa8,_0x377c41);_0x181640(_0x377c41);});});} \ No newline at end of file +var _0x2eb0=['request','then','debug','stringify','error','CmList,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x2eb0,0x1d6));var _0x02eb=function(_0x12def4,_0x183f05){_0x12def4=_0x12def4-0x0;var _0x20e4bd=_0x2eb0[_0x12def4];return _0x20e4bd;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var moment=require(_0x02eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x02eb('0x3'));var fs=require('fs');var Redis=require(_0x02eb('0x4'));var db=require(_0x02eb('0x5'))['db'];var utils=require(_0x02eb('0x6'));var logger=require(_0x02eb('0x7'))('rpc');var config=require(_0x02eb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x02eb('0x9')][_0x02eb('0xa')]({'port':0x232a});config['redis']=_[_0x02eb('0xb')](config['redis'],{'host':_0x02eb('0xc'),'port':0x18eb});var socket=require(_0x02eb('0xd'))(new Redis(config['redis']));require(_0x02eb('0xe'))[_0x02eb('0xf')](socket);function respondWithRpcPromise(_0x1302bd,_0x5b2556,_0x57faf8){return new BPromise(function(_0xdedb19,_0x2f0b7a){return client[_0x02eb('0x10')](_0x1302bd,_0x57faf8)[_0x02eb('0x11')](function(_0x22658a){logger['info']('CmList,\x20%s,\x20%s',_0x5b2556,'request\x20sent');logger[_0x02eb('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x5b2556,'request\x20sent',JSON[_0x02eb('0x13')](_0x22658a));if(_0x22658a['error']){if(_0x22658a[_0x02eb('0x14')]['code']===0x1f4){logger[_0x02eb('0x14')](_0x02eb('0x15'),_0x5b2556,_0x22658a[_0x02eb('0x14')]['message']);return _0x2f0b7a(_0x22658a['error'][_0x02eb('0x16')]);}logger[_0x02eb('0x14')](_0x02eb('0x15'),_0x5b2556,_0x22658a['error'][_0x02eb('0x16')]);return _0xdedb19(_0x22658a[_0x02eb('0x14')][_0x02eb('0x16')]);}else{logger[_0x02eb('0x17')](_0x02eb('0x15'),_0x5b2556,_0x02eb('0x18'));_0xdedb19(_0x22658a[_0x02eb('0x19')][_0x02eb('0x16')]);}})[_0x02eb('0x1a')](function(_0x164871){logger['error'](_0x02eb('0x15'),_0x5b2556,_0x164871);_0x2f0b7a(_0x164871);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index dfdbb53..f91d34f 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 _0x6dac=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x543d2f,_0x3b9795){var _0xd4ca00=function(_0x58c861){while(--_0x58c861){_0x543d2f['push'](_0x543d2f['shift']());}};_0xd4ca00(++_0x3b9795);}(_0x6dac,0x16e));var _0xc6da=function(_0x3e4445,_0x3c5a73){_0x3e4445=_0x3e4445-0x0;var _0x41c5b8=_0x6dac[_0x3e4445];return _0x41c5b8;};'use strict';var CmListEvents=require(_0xc6da('0x0'));var events=[_0xc6da('0x1'),_0xc6da('0x2'),_0xc6da('0x3')];function createListener(_0x133ecc,_0x224a52){return function(_0x3391f5){_0x224a52[_0xc6da('0x4')](_0x133ecc,_0x3391f5);};}function removeListener(_0x28663f,_0x338470){return function(){CmListEvents[_0xc6da('0x5')](_0x28663f,_0x338470);};}exports[_0xc6da('0x6')]=function(_0x325f49){for(var _0x5caf49=0x0,_0x1ebd11=events[_0xc6da('0x7')];_0x5caf49<_0x1ebd11;_0x5caf49++){var _0x5a0d8d=events[_0x5caf49];var _0x3047d3=createListener(_0xc6da('0x8')+_0x5a0d8d,_0x325f49);CmListEvents['on'](_0x5a0d8d,_0x3047d3);}}; \ No newline at end of file +var _0x6132=['save','remove','update','emit','removeListener','length','./cmList.events'];(function(_0x5da702,_0x26c19d){var _0xedb955=function(_0x268dd0){while(--_0x268dd0){_0x5da702['push'](_0x5da702['shift']());}};_0xedb955(++_0x26c19d);}(_0x6132,0x13a));var _0x2613=function(_0x605f43,_0x4f148c){_0x605f43=_0x605f43-0x0;var _0x4acc17=_0x6132[_0x605f43];return _0x4acc17;};'use strict';var CmListEvents=require(_0x2613('0x0'));var events=[_0x2613('0x1'),_0x2613('0x2'),_0x2613('0x3')];function createListener(_0x4a191a,_0x2e19a7){return function(_0x1a9371){_0x2e19a7[_0x2613('0x4')](_0x4a191a,_0x1a9371);};}function removeListener(_0x35c979,_0x555746){return function(){CmListEvents[_0x2613('0x5')](_0x35c979,_0x555746);};}exports['register']=function(_0x59240d){for(var _0x30cac4=0x0,_0x309663=events[_0x2613('0x6')];_0x30cac4<_0x309663;_0x30cac4++){var _0x465a32=events[_0x30cac4];var _0xe295ea=createListener('cmList:'+_0x465a32,_0x59240d);CmListEvents['on'](_0x465a32,_0xe295ea);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8af8ad4..af44d67 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f5fbe1f..c429d88 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3a38f8,_0x5f3907){var _0x13f6ab=function(_0x2f66cd){while(--_0x2f66cd){_0x3a38f8['push'](_0x3a38f8['shift']());}};_0x13f6ab(++_0x5f3907);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0xb212a6,_0x154094){var _0x1e3750=function(_0x4a0372){while(--_0x4a0372){_0xb212a6['push'](_0xb212a6['shift']());}};_0x1e3750(++_0x154094);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 122e0b7..efa7e0a 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 _0x67ed=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x13ee72,_0x5f0bb6){var _0x5d3d3d=function(_0x5c295a){while(--_0x5c295a){_0x13ee72['push'](_0x13ee72['shift']());}};_0x5d3d3d(++_0x5f0bb6);}(_0x67ed,0xc4));var _0xd67e=function(_0x2ab8f5,_0x30138b){_0x2ab8f5=_0x2ab8f5-0x0;var _0x466234=_0x67ed[_0x2ab8f5];return _0x466234;};'use strict';var pdf=require(_0xd67e('0x0'));var emlformat=require(_0xd67e('0x1'));var rimraf=require(_0xd67e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd67e('0x3'));var rp=require(_0xd67e('0x4'));var moment=require(_0xd67e('0x5'));var BPromise=require(_0xd67e('0x6'));var Mustache=require(_0xd67e('0x7'));var util=require(_0xd67e('0x8'));var path=require(_0xd67e('0x9'));var sox=require(_0xd67e('0xa'));var csv=require(_0xd67e('0xb'));var ejs=require(_0xd67e('0xc'));var fs=require('fs');var _=require(_0xd67e('0xd'));var squel=require(_0xd67e('0xe'));var crypto=require('crypto');var jsforce=require(_0xd67e('0xf'));var deskjs=require(_0xd67e('0x10'));var toCsv=require(_0xd67e('0xb'));var querystring=require(_0xd67e('0x11'));var Papa=require(_0xd67e('0x12'));var Redis=require(_0xd67e('0x13'));var authService=require(_0xd67e('0x14'));var qs=require(_0xd67e('0x15'));var as=require(_0xd67e('0x16'));var hardwareService=require(_0xd67e('0x17'));var logger=require(_0xd67e('0x18'))(_0xd67e('0x19'));var utils=require(_0xd67e('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xd67e('0x1b'));var db=require(_0xd67e('0x1c'))['db'];function respondWithStatusCode(_0x234a4a,_0x26360b){_0x26360b=_0x26360b||0xcc;return function(_0x385aac){if(_0x385aac){return _0x234a4a[_0xd67e('0x1d')](_0x26360b);}return _0x234a4a[_0xd67e('0x1e')](_0x26360b)[_0xd67e('0x1f')]();};}function respondWithResult(_0x181486,_0x1220dd){_0x1220dd=_0x1220dd||0xc8;return function(_0x18de6c){if(_0x18de6c){return _0x181486[_0xd67e('0x1e')](_0x1220dd)[_0xd67e('0x20')](_0x18de6c);}};}function respondWithFilteredResult(_0x2df4a7,_0x51170b){return function(_0x4c6cae){if(_0x4c6cae){var _0x2a6672=_0x4c6cae[_0xd67e('0x21')],_0x2293a6=_0x51170b['offset'],_0x2c9ebb=_0x51170b[_0xd67e('0x22')]+_0x51170b[_0xd67e('0x23')],_0x4bbd65;if(_0x2c9ebb>=_0x2a6672){_0x2c9ebb=_0x2a6672;_0x4bbd65=0xc8;}else{_0x4bbd65=0xce;}_0x2df4a7[_0xd67e('0x1e')](_0x4bbd65);return _0x2df4a7[_0xd67e('0x24')](_0xd67e('0x25'),_0x2293a6+'-'+_0x2c9ebb+'/'+_0x2a6672)[_0xd67e('0x20')](_0x4c6cae);}return null;};}function patchUpdates(_0x1a25fd){return function(_0xb03469){try{jsonpatch[_0xd67e('0x26')](_0xb03469,_0x1a25fd,!![]);}catch(_0xc3e8ad){return BPromise[_0xd67e('0x27')](_0xc3e8ad);}return _0xb03469[_0xd67e('0x28')]();};}function saveUpdates(_0x1ce03f,_0x4d2a7d){return function(_0x1fd9ef){if(_0x1fd9ef){return _0x1fd9ef[_0xd67e('0x29')](_0x1ce03f)[_0xd67e('0x2a')](function(_0x292a96){return _0x292a96;});}return null;};}function removeEntity(_0x322b2b,_0x105c3c){return function(_0x354dfb){if(_0x354dfb){return _0x354dfb[_0xd67e('0x2b')]()[_0xd67e('0x2a')](function(){_0x322b2b[_0xd67e('0x1e')](0xcc)[_0xd67e('0x1f')]();});}};}function handleEntityNotFound(_0x22d533,_0x59555f){return function(_0x42cba4){if(!_0x42cba4){_0x22d533[_0xd67e('0x1d')](0x194);}return _0x42cba4;};}function handleError(_0x113263,_0x523cab){_0x523cab=_0x523cab||0x1f4;return function(_0x1c0259){logger[_0xd67e('0x2c')](_0x1c0259[_0xd67e('0x2d')]);if(_0x1c0259['name']){delete _0x1c0259['name'];}_0x113263['status'](_0x523cab)['send'](_0x1c0259);};}exports[_0xd67e('0x29')]=function(_0x3172cd,_0x5e745d){if(_0x3172cd[_0xd67e('0x2e')]['id']){delete _0x3172cd[_0xd67e('0x2e')]['id'];}return db[_0xd67e('0x2f')][_0xd67e('0x30')]({'where':{'id':_0x3172cd[_0xd67e('0x31')]['id']}})[_0xd67e('0x2a')](handleEntityNotFound(_0x5e745d,null))[_0xd67e('0x2a')](saveUpdates(_0x3172cd[_0xd67e('0x2e')],null))[_0xd67e('0x2a')](respondWithResult(_0x5e745d,null))[_0xd67e('0x32')](handleError(_0x5e745d,null));};exports[_0xd67e('0x2b')]=function(_0x529366,_0xee9d53){return db[_0xd67e('0x2f')][_0xd67e('0x30')]({'where':{'id':_0x529366[_0xd67e('0x31')]['id']}})['then'](handleEntityNotFound(_0xee9d53,null))['then'](removeEntity(_0xee9d53,null))[_0xd67e('0x32')](handleError(_0xee9d53,null));}; \ No newline at end of file +var _0x9fd9=['path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9fd9,0xc6));var _0x99fd=function(_0x27bafa,_0x24ebc1){_0x27bafa=_0x27bafa-0x0;var _0x19a006=_0x9fd9[_0x27bafa];return _0x19a006;};'use strict';var pdf=require(_0x99fd('0x0'));var emlformat=require(_0x99fd('0x1'));var rimraf=require(_0x99fd('0x2'));var zipdir=require(_0x99fd('0x3'));var jsonpatch=require(_0x99fd('0x4'));var rp=require(_0x99fd('0x5'));var moment=require(_0x99fd('0x6'));var BPromise=require(_0x99fd('0x7'));var Mustache=require(_0x99fd('0x8'));var util=require(_0x99fd('0x9'));var path=require(_0x99fd('0xa'));var sox=require(_0x99fd('0xb'));var csv=require('to-csv');var ejs=require(_0x99fd('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99fd('0xd'));var crypto=require(_0x99fd('0xe'));var jsforce=require(_0x99fd('0xf'));var deskjs=require(_0x99fd('0x10'));var toCsv=require(_0x99fd('0x11'));var querystring=require('querystring');var Papa=require(_0x99fd('0x12'));var Redis=require(_0x99fd('0x13'));var authService=require(_0x99fd('0x14'));var qs=require(_0x99fd('0x15'));var as=require(_0x99fd('0x16'));var hardwareService=require(_0x99fd('0x17'));var logger=require(_0x99fd('0x18'))(_0x99fd('0x19'));var utils=require(_0x99fd('0x1a'));var config=require(_0x99fd('0x1b'));var licenseUtil=require(_0x99fd('0x1c'));var db=require(_0x99fd('0x1d'))['db'];function respondWithStatusCode(_0x22ff68,_0x4564b8){_0x4564b8=_0x4564b8||0xcc;return function(_0x22a21f){if(_0x22a21f){return _0x22ff68[_0x99fd('0x1e')](_0x4564b8);}return _0x22ff68[_0x99fd('0x1f')](_0x4564b8)[_0x99fd('0x20')]();};}function respondWithResult(_0x35dd02,_0xb6cc61){_0xb6cc61=_0xb6cc61||0xc8;return function(_0x5dbcf4){if(_0x5dbcf4){return _0x35dd02[_0x99fd('0x1f')](_0xb6cc61)[_0x99fd('0x21')](_0x5dbcf4);}};}function respondWithFilteredResult(_0x223811,_0x43d9e4){return function(_0x29be9){if(_0x29be9){var _0xac977b=_0x29be9[_0x99fd('0x22')],_0x2362e2=_0x43d9e4[_0x99fd('0x23')],_0x5c7cde=_0x43d9e4['offset']+_0x43d9e4[_0x99fd('0x24')],_0x287674;if(_0x5c7cde>=_0xac977b){_0x5c7cde=_0xac977b;_0x287674=0xc8;}else{_0x287674=0xce;}_0x223811[_0x99fd('0x1f')](_0x287674);return _0x223811[_0x99fd('0x25')]('Content-Range',_0x2362e2+'-'+_0x5c7cde+'/'+_0xac977b)['json'](_0x29be9);}return null;};}function patchUpdates(_0x5007d8){return function(_0x575937){try{jsonpatch[_0x99fd('0x26')](_0x575937,_0x5007d8,!![]);}catch(_0x40fe05){return BPromise[_0x99fd('0x27')](_0x40fe05);}return _0x575937[_0x99fd('0x28')]();};}function saveUpdates(_0x4f88f2,_0x281e83){return function(_0x1ff943){if(_0x1ff943){return _0x1ff943[_0x99fd('0x29')](_0x4f88f2)[_0x99fd('0x2a')](function(_0xa53ae7){return _0xa53ae7;});}return null;};}function removeEntity(_0x20ed32,_0x4ac7f5){return function(_0x37a624){if(_0x37a624){return _0x37a624[_0x99fd('0x2b')]()[_0x99fd('0x2a')](function(){_0x20ed32[_0x99fd('0x1f')](0xcc)[_0x99fd('0x20')]();});}};}function handleEntityNotFound(_0x540b94,_0x46f152){return function(_0x55f0c8){if(!_0x55f0c8){_0x540b94['sendStatus'](0x194);}return _0x55f0c8;};}function handleError(_0x5af4fc,_0x3c086c){_0x3c086c=_0x3c086c||0x1f4;return function(_0x17bc20){logger[_0x99fd('0x2c')](_0x17bc20[_0x99fd('0x2d')]);if(_0x17bc20[_0x99fd('0x2e')]){delete _0x17bc20[_0x99fd('0x2e')];}_0x5af4fc[_0x99fd('0x1f')](_0x3c086c)[_0x99fd('0x2f')](_0x17bc20);};}exports[_0x99fd('0x29')]=function(_0x9235d0,_0x34c48e){if(_0x9235d0[_0x99fd('0x30')]['id']){delete _0x9235d0[_0x99fd('0x30')]['id'];}return db[_0x99fd('0x31')][_0x99fd('0x32')]({'where':{'id':_0x9235d0['params']['id']}})[_0x99fd('0x2a')](handleEntityNotFound(_0x34c48e,null))['then'](saveUpdates(_0x9235d0[_0x99fd('0x30')],null))[_0x99fd('0x2a')](respondWithResult(_0x34c48e,null))[_0x99fd('0x33')](handleError(_0x34c48e,null));};exports[_0x99fd('0x2b')]=function(_0xa514ca,_0x4a3d33){return db[_0x99fd('0x31')]['find']({'where':{'id':_0xa514ca['params']['id']}})[_0x99fd('0x2a')](handleEntityNotFound(_0x4a3d33,null))[_0x99fd('0x2a')](removeEntity(_0x4a3d33,null))[_0x99fd('0x33')](handleError(_0x4a3d33,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 781fc93..3ce7f2d 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 _0xe6ed=['Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x456c9d,_0xa6b604){var _0x38d5c=function(_0x5c0323){while(--_0x5c0323){_0x456c9d['push'](_0x456c9d['shift']());}};_0x38d5c(++_0xa6b604);}(_0xe6ed,0xf0));var _0xde6e=function(_0x3e5d1d,_0x42df87){_0x3e5d1d=_0x3e5d1d-0x0;var _0x9f5fea=_0xe6ed[_0x3e5d1d];return _0x9f5fea;};'use strict';var _=require(_0xde6e('0x0'));var util=require(_0xde6e('0x1'));var logger=require(_0xde6e('0x2'))(_0xde6e('0x3'));var moment=require(_0xde6e('0x4'));var BPromise=require(_0xde6e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde6e('0x6'));var rimraf=require(_0xde6e('0x7'));var config=require(_0xde6e('0x8'));var attributes=require(_0xde6e('0x9'));module[_0xde6e('0xa')]=function(_0x461054,_0x3fcb13){return _0x461054[_0xde6e('0xb')](_0xde6e('0xc'),attributes,{'tableName':_0xde6e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd659=['../../config/environment','./condition.attributes','exports','define','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd659,0x1bd));var _0x9d65=function(_0x37982c,_0x16ea92){_0x37982c=_0x37982c-0x0;var _0x34621e=_0xd659[_0x37982c];return _0x34621e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d65('0x0'))(_0x9d65('0x1'));var moment=require(_0x9d65('0x2'));var BPromise=require(_0x9d65('0x3'));var rp=require(_0x9d65('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d65('0x5'));var config=require(_0x9d65('0x6'));var attributes=require(_0x9d65('0x7'));module[_0x9d65('0x8')]=function(_0x15c39a,_0x53a60f){return _0x15c39a[_0x9d65('0x9')]('Condition',attributes,{'tableName':_0x9d65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 005fa24..6193159 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 _0x0cbc=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x38e777,_0x492c88){var _0x1c79ea=function(_0x28c88e){while(--_0x28c88e){_0x38e777['push'](_0x38e777['shift']());}};_0x1c79ea(++_0x492c88);}(_0x0cbc,0x6e));var _0xc0cb=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x0cbc[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0xc0cb('0x0'));var util=require(_0xc0cb('0x1'));var moment=require(_0xc0cb('0x2'));var BPromise=require(_0xc0cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0cb('0x4'));var db=require(_0xc0cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc0cb('0x6'));var config=require('../../config/environment');var jayson=require(_0xc0cb('0x7'));var client=jayson[_0xc0cb('0x8')][_0xc0cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d5535,_0x51558c,_0x5086da){return new BPromise(function(_0x468f1c,_0x3d243d){return client[_0xc0cb('0xa')](_0x4d5535,_0x5086da)[_0xc0cb('0xb')](function(_0x4d517b){logger[_0xc0cb('0xc')](_0xc0cb('0xd'),_0x51558c,_0xc0cb('0xe'));logger['debug'](_0xc0cb('0xf'),_0x51558c,'request\x20sent',JSON[_0xc0cb('0x10')](_0x4d517b));if(_0x4d517b['error']){if(_0x4d517b['error']['code']===0x1f4){logger[_0xc0cb('0x11')]('Condition,\x20%s,\x20%s',_0x51558c,_0x4d517b[_0xc0cb('0x11')][_0xc0cb('0x12')]);return _0x3d243d(_0x4d517b[_0xc0cb('0x11')]['message']);}logger[_0xc0cb('0x11')](_0xc0cb('0xd'),_0x51558c,_0x4d517b[_0xc0cb('0x11')]['message']);return _0x468f1c(_0x4d517b[_0xc0cb('0x11')][_0xc0cb('0x12')]);}else{logger[_0xc0cb('0xc')]('Condition,\x20%s,\x20%s',_0x51558c,_0xc0cb('0xe'));_0x468f1c(_0x4d517b[_0xc0cb('0x13')]['message']);}})[_0xc0cb('0x14')](function(_0x4279eb){logger[_0xc0cb('0x11')](_0xc0cb('0xd'),_0x51558c,_0x4279eb);_0x3d243d(_0x4279eb);});});} \ No newline at end of file +var _0xd215=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1127bc,_0x19bfc6){var _0xf5b589=function(_0x1093a0){while(--_0x1093a0){_0x1127bc['push'](_0x1127bc['shift']());}};_0xf5b589(++_0x19bfc6);}(_0xd215,0x13a));var _0x5d21=function(_0x1bcd65,_0x4cd053){_0x1bcd65=_0x1bcd65-0x0;var _0x34a8e9=_0xd215[_0x1bcd65];return _0x34a8e9;};'use strict';var _=require(_0x5d21('0x0'));var util=require(_0x5d21('0x1'));var moment=require('moment');var BPromise=require(_0x5d21('0x2'));var rs=require(_0x5d21('0x3'));var fs=require('fs');var Redis=require(_0x5d21('0x4'));var db=require(_0x5d21('0x5'))['db'];var utils=require(_0x5d21('0x6'));var logger=require('../../config/logger')(_0x5d21('0x7'));var config=require(_0x5d21('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d21('0x9')][_0x5d21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaf97ee,_0x1107a6,_0x551a6f){return new BPromise(function(_0x405b09,_0x1e0d11){return client[_0x5d21('0xb')](_0xaf97ee,_0x551a6f)[_0x5d21('0xc')](function(_0x422906){logger['info'](_0x5d21('0xd'),_0x1107a6,_0x5d21('0xe'));logger[_0x5d21('0xf')](_0x5d21('0x10'),_0x1107a6,_0x5d21('0xe'),JSON[_0x5d21('0x11')](_0x422906));if(_0x422906[_0x5d21('0x12')]){if(_0x422906[_0x5d21('0x12')][_0x5d21('0x13')]===0x1f4){logger[_0x5d21('0x12')](_0x5d21('0xd'),_0x1107a6,_0x422906['error'][_0x5d21('0x14')]);return _0x1e0d11(_0x422906[_0x5d21('0x12')]['message']);}logger[_0x5d21('0x12')](_0x5d21('0xd'),_0x1107a6,_0x422906['error'][_0x5d21('0x14')]);return _0x405b09(_0x422906[_0x5d21('0x12')][_0x5d21('0x14')]);}else{logger[_0x5d21('0x15')]('Condition,\x20%s,\x20%s',_0x1107a6,_0x5d21('0xe'));_0x405b09(_0x422906['result'][_0x5d21('0x14')]);}})['catch'](function(_0x25610a){logger['error'](_0x5d21('0xd'),_0x1107a6,_0x25610a);_0x1e0d11(_0x25610a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 46b2e3d..2c623d6 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 _0x70e7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer'];(function(_0x5f33a7,_0x4c5ea8){var _0x16c1fa=function(_0x5d96c9){while(--_0x5d96c9){_0x5f33a7['push'](_0x5f33a7['shift']());}};_0x16c1fa(++_0x4c5ea8);}(_0x70e7,0x1ca));var _0x770e=function(_0x34a6b9,_0x5c5d42){_0x34a6b9=_0x34a6b9-0x0;var _0x2304a0=_0x70e7[_0x34a6b9];return _0x2304a0;};'use strict';var multer=require(_0x770e('0x0'));var util=require(_0x770e('0x1'));var path=require(_0x770e('0x2'));var timeout=require(_0x770e('0x3'));var express=require(_0x770e('0x4'));var router=express[_0x770e('0x5')]();var auth=require(_0x770e('0x6'));var interaction=require(_0x770e('0x7'));var config=require(_0x770e('0x8'));var controller=require(_0x770e('0x9'));router[_0x770e('0xa')](_0x770e('0xb'),auth['isAuthenticated'](),controller[_0x770e('0xc')]);router[_0x770e('0xd')](_0x770e('0xb'),auth[_0x770e('0xe')](),controller[_0x770e('0xf')]);module[_0x770e('0x10')]=router; \ No newline at end of file +var _0x5a59=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x5a43b8,_0x2e0eb2){var _0x26eeef=function(_0x4b1451){while(--_0x4b1451){_0x5a43b8['push'](_0x5a43b8['shift']());}};_0x26eeef(++_0x2e0eb2);}(_0x5a59,0x94));var _0x95a5=function(_0x3a9a32,_0x4416de){_0x3a9a32=_0x3a9a32-0x0;var _0x5b46=_0x5a59[_0x3a9a32];return _0x5b46;};'use strict';var multer=require(_0x95a5('0x0'));var util=require(_0x95a5('0x1'));var path=require(_0x95a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x95a5('0x3'));var router=express[_0x95a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x95a5('0x5'));var config=require(_0x95a5('0x6'));var controller=require(_0x95a5('0x7'));router[_0x95a5('0x8')](_0x95a5('0x9'),auth[_0x95a5('0xa')](),controller[_0x95a5('0xb')]);router[_0x95a5('0xc')](_0x95a5('0x9'),auth[_0x95a5('0xa')](),controller['destroy']);module[_0x95a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 772dd78..a365aca 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 _0x3a0f=['STRING'];(function(_0x23b5f4,_0x233ad5){var _0x3b4984=function(_0x2a8ea0){while(--_0x2a8ea0){_0x23b5f4['push'](_0x23b5f4['shift']());}};_0x3b4984(++_0x233ad5);}(_0x3a0f,0x145));var _0xf3a0=function(_0x3a4f9c,_0x13aabe){_0x3a4f9c=_0x3a4f9c-0x0;var _0x48a682=_0x3a0f[_0x3a4f9c];return _0x48a682;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf3a0('0x0')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4a9c=['exports','STRING','name','sequelize'];(function(_0x155f58,_0x4d0489){var _0x51fb9d=function(_0x5d93ae){while(--_0x5d93ae){_0x155f58['push'](_0x155f58['shift']());}};_0x51fb9d(++_0x4d0489);}(_0x4a9c,0x1d3));var _0xc4a9=function(_0x2004b4,_0x180dcd){_0x2004b4=_0x2004b4-0x0;var _0xc3a097=_0x4a9c[_0x2004b4];return _0xc3a097;};'use strict';var Sequelize=require(_0xc4a9('0x0'));module[_0xc4a9('0x1')]={'name':{'type':Sequelize[_0xc4a9('0x2')],'allowNull':![],'unique':_0xc4a9('0x3')},'description':{'type':Sequelize[_0xc4a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d918adc..06ce389 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 _0x58a0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','Dashboard','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','iframe','attrUrl','attrs','https://','attrPath','clock','HH:mm:ss','attrTimezone','value','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','DashboardItem','getItems','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x58a0,0x162));var _0x058a=function(_0x45d31c,_0xd0b936){_0x45d31c=_0x45d31c-0x0;var _0x33c23a=_0x58a0[_0x45d31c];return _0x33c23a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x058a('0x0'));var zipdir=require(_0x058a('0x1'));var jsonpatch=require(_0x058a('0x2'));var rp=require('request-promise');var moment=require(_0x058a('0x3'));var BPromise=require(_0x058a('0x4'));var Mustache=require(_0x058a('0x5'));var util=require(_0x058a('0x6'));var path=require(_0x058a('0x7'));var sox=require(_0x058a('0x8'));var csv=require(_0x058a('0x9'));var ejs=require(_0x058a('0xa'));var fs=require('fs');var _=require(_0x058a('0xb'));var squel=require(_0x058a('0xc'));var crypto=require(_0x058a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x058a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x058a('0xf'));var Redis=require(_0x058a('0x10'));var authService=require(_0x058a('0x11'));var qs=require(_0x058a('0x12'));var as=require(_0x058a('0x13'));var hardwareService=require(_0x058a('0x14'));var logger=require(_0x058a('0x15'))(_0x058a('0x16'));var utils=require(_0x058a('0x17'));var config=require(_0x058a('0x18'));var licenseUtil=require(_0x058a('0x19'));var db=require(_0x058a('0x1a'))['db'];config[_0x058a('0x1b')]=_[_0x058a('0x1c')](config[_0x058a('0x1b')],{'host':_0x058a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x058a('0x1b')]));require(_0x058a('0x1e'))['register'](socket);function respondWithStatusCode(_0x9f18e,_0x434542){_0x434542=_0x434542||0xcc;return function(_0x317f48){if(_0x317f48){return _0x9f18e[_0x058a('0x1f')](_0x434542);}return _0x9f18e['status'](_0x434542)['end']();};}function respondWithResult(_0x3ac832,_0xea15f9){_0xea15f9=_0xea15f9||0xc8;return function(_0x7476){if(_0x7476){return _0x3ac832[_0x058a('0x20')](_0xea15f9)[_0x058a('0x21')](_0x7476);}};}function respondWithFilteredResult(_0x3485b6,_0x2300c0){return function(_0x240c5b){if(_0x240c5b){var _0x200724=_0x240c5b[_0x058a('0x22')],_0x5db939=_0x2300c0[_0x058a('0x23')],_0x1c7e44=_0x2300c0[_0x058a('0x23')]+_0x2300c0['limit'],_0x4be7ea;if(_0x1c7e44>=_0x200724){_0x1c7e44=_0x200724;_0x4be7ea=0xc8;}else{_0x4be7ea=0xce;}_0x3485b6['status'](_0x4be7ea);return _0x3485b6[_0x058a('0x24')](_0x058a('0x25'),_0x5db939+'-'+_0x1c7e44+'/'+_0x200724)[_0x058a('0x21')](_0x240c5b);}return null;};}function patchUpdates(_0x374930){return function(_0x4c5e00){try{jsonpatch['apply'](_0x4c5e00,_0x374930,!![]);}catch(_0x280bcf){return BPromise[_0x058a('0x26')](_0x280bcf);}return _0x4c5e00[_0x058a('0x27')]();};}function saveUpdates(_0x2f3cc8,_0x95e2b5){return function(_0x3a93b7){if(_0x3a93b7){return _0x3a93b7[_0x058a('0x28')](_0x2f3cc8)[_0x058a('0x29')](function(_0x50f0d8){return _0x50f0d8;});}return null;};}function removeEntity(_0x3f87a8,_0x938c86){return function(_0x2a7c87){if(_0x2a7c87){return _0x2a7c87[_0x058a('0x2a')]()[_0x058a('0x29')](function(){var _0x4ca07e=_0x2a7c87[_0x058a('0x2b')]({'plain':!![]});var _0x129267=_0x058a('0x2c');return db[_0x058a('0x2d')]['destroy']({'where':{'type':_0x129267,'resourceId':_0x4ca07e['id']}})[_0x058a('0x29')](function(){return _0x2a7c87;});})[_0x058a('0x29')](function(){_0x3f87a8[_0x058a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x670327,_0x3f2369){return function(_0x5d69aa){if(!_0x5d69aa){_0x670327['sendStatus'](0x194);}return _0x5d69aa;};}function handleError(_0x33dd75,_0x46ad4b){_0x46ad4b=_0x46ad4b||0x1f4;return function(_0x56e951){logger[_0x058a('0x2e')](_0x56e951['stack']);if(_0x56e951[_0x058a('0x2f')]){delete _0x56e951[_0x058a('0x2f')];}_0x33dd75['status'](_0x46ad4b)[_0x058a('0x30')](_0x56e951);};}exports[_0x058a('0x31')]=function(_0x1a42f7,_0x4fcbcf){var _0x4f1a41={},_0x12493c={},_0x2dfdda={'count':0x0,'rows':[]};var _0x477d90=_['map'](db[_0x058a('0x32')][_0x058a('0x33')],function(_0x11430a){return{'name':_0x11430a[_0x058a('0x34')],'type':_0x11430a['type']['key']};});_0x12493c[_0x058a('0x35')]=_[_0x058a('0x36')](_0x477d90,_0x058a('0x2f'));_0x12493c[_0x058a('0x37')]=_['keys'](_0x1a42f7[_0x058a('0x37')]);_0x12493c[_0x058a('0x38')]=_['intersection'](_0x12493c[_0x058a('0x35')],_0x12493c[_0x058a('0x37')]);_0x4f1a41['attributes']=_[_0x058a('0x39')](_0x12493c[_0x058a('0x35')],qs[_0x058a('0x3a')](_0x1a42f7[_0x058a('0x37')]['fields']));_0x4f1a41[_0x058a('0x3b')]=_0x4f1a41[_0x058a('0x3b')][_0x058a('0x3c')]?_0x4f1a41[_0x058a('0x3b')]:_0x12493c[_0x058a('0x35')];if(!_0x1a42f7[_0x058a('0x37')][_0x058a('0x3d')](_0x058a('0x3e'))){_0x4f1a41[_0x058a('0x3f')]=qs['limit'](_0x1a42f7[_0x058a('0x37')][_0x058a('0x3f')]);_0x4f1a41['offset']=qs[_0x058a('0x23')](_0x1a42f7[_0x058a('0x37')][_0x058a('0x23')]);}_0x4f1a41['order']=qs[_0x058a('0x40')](_0x1a42f7[_0x058a('0x37')][_0x058a('0x40')]);_0x4f1a41['where']=qs[_0x058a('0x38')](_[_0x058a('0x41')](_0x1a42f7['query'],_0x12493c[_0x058a('0x38')]),_0x477d90);if(_0x1a42f7[_0x058a('0x37')][_0x058a('0x42')]){_0x4f1a41[_0x058a('0x43')]=_[_0x058a('0x44')](_0x4f1a41[_0x058a('0x43')],{'$or':_[_0x058a('0x36')](_0x477d90,function(_0x2df11e){if(_0x2df11e[_0x058a('0x45')]!==_0x058a('0x46')){var _0xf0414c={};_0xf0414c[_0x2df11e[_0x058a('0x2f')]]={'$like':'%'+_0x1a42f7[_0x058a('0x37')][_0x058a('0x42')]+'%'};return _0xf0414c;}})});}_0x4f1a41=_['merge']({},_0x4f1a41,_0x1a42f7[_0x058a('0x47')]);var _0x29601d={'where':_0x4f1a41[_0x058a('0x43')]};return db['Dashboard'][_0x058a('0x22')](_0x29601d)[_0x058a('0x29')](function(_0x2a3b6d){_0x2dfdda[_0x058a('0x22')]=_0x2a3b6d;if(_0x1a42f7[_0x058a('0x37')][_0x058a('0x48')]){_0x4f1a41[_0x058a('0x49')]=[{'all':!![]}];}return db['Dashboard'][_0x058a('0x4a')](_0x4f1a41);})[_0x058a('0x29')](function(_0x110caf){_0x2dfdda[_0x058a('0x4b')]=_0x110caf;return _0x2dfdda;})['then'](respondWithFilteredResult(_0x4fcbcf,_0x4f1a41))[_0x058a('0x4c')](handleError(_0x4fcbcf,null));};exports[_0x058a('0x4d')]=function(_0x55e015,_0x59e528){var _0x6952a1={'raw':![],'where':{'id':_0x55e015[_0x058a('0x4e')]['id']}},_0x2a307a={};_0x2a307a[_0x058a('0x35')]=_[_0x058a('0x4f')](db[_0x058a('0x32')][_0x058a('0x33')]);_0x2a307a[_0x058a('0x37')]=_[_0x058a('0x4f')](_0x55e015[_0x058a('0x37')]);_0x2a307a['filters']=_['intersection'](_0x2a307a[_0x058a('0x35')],_0x2a307a[_0x058a('0x37')]);_0x6952a1[_0x058a('0x3b')]=_[_0x058a('0x39')](_0x2a307a[_0x058a('0x35')],qs[_0x058a('0x3a')](_0x55e015['query'][_0x058a('0x3a')]));_0x6952a1[_0x058a('0x3b')]=_0x6952a1[_0x058a('0x3b')][_0x058a('0x3c')]?_0x6952a1[_0x058a('0x3b')]:_0x2a307a[_0x058a('0x35')];if(_0x55e015[_0x058a('0x37')][_0x058a('0x48')]){_0x6952a1[_0x058a('0x49')]=[{'all':!![]}];}_0x6952a1=_['merge']({},_0x6952a1,_0x55e015[_0x058a('0x47')]);return db[_0x058a('0x32')][_0x058a('0x50')](_0x6952a1)[_0x058a('0x29')](handleEntityNotFound(_0x59e528,null))[_0x058a('0x29')](respondWithResult(_0x59e528,null))[_0x058a('0x4c')](handleError(_0x59e528,null));};exports[_0x058a('0x51')]=function(_0x1ca70b,_0x33d8d7){return db[_0x058a('0x32')][_0x058a('0x51')](_0x1ca70b[_0x058a('0x52')],{})[_0x058a('0x29')](function(_0x24b330){var _0x359941=_0x1ca70b['user'][_0x058a('0x2b')]({'plain':!![]});if(!_0x359941)throw new Error(_0x058a('0x53'));if(_0x359941[_0x058a('0x54')]===_0x058a('0x55')){var _0x39812d=_0x24b330['get']({'plain':!![]});var _0x1d4d21=_0x058a('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x1d4d21,'userProfileId':_0x359941[_0x058a('0x56')]},'raw':!![]})[_0x058a('0x29')](function(_0x2c7f3b){if(_0x2c7f3b&&_0x2c7f3b[_0x058a('0x57')]===0x0){return db[_0x058a('0x2d')]['create']({'name':_0x39812d[_0x058a('0x2f')],'resourceId':_0x39812d['id'],'type':_0x2c7f3b[_0x058a('0x2f')],'sectionId':_0x2c7f3b['id']},{})[_0x058a('0x29')](function(){return _0x24b330;});}else{return _0x24b330;}})[_0x058a('0x4c')](function(_0x23dcee){logger[_0x058a('0x2e')](_0x058a('0x58'),_0x23dcee);throw _0x23dcee;});}return _0x24b330;})[_0x058a('0x29')](respondWithResult(_0x33d8d7,0xc9))[_0x058a('0x4c')](handleError(_0x33d8d7,null));};exports[_0x058a('0x59')]=function(_0x224482,_0x3e3637){var _0x44bbc8={'where':{'id':_0x224482[_0x058a('0x4e')]['id']}},_0x3801e9={};_0x3801e9[_0x058a('0x35')]=_[_0x058a('0x4f')](db[_0x058a('0x32')][_0x058a('0x33')]);_0x44bbc8[_0x058a('0x3b')]=_[_0x058a('0x39')](_0x3801e9[_0x058a('0x35')],qs['fields'](_0x224482['query'][_0x058a('0x3a')]));_0x44bbc8[_0x058a('0x3b')]=_0x44bbc8[_0x058a('0x3b')]['length']?_0x44bbc8[_0x058a('0x3b')]:_0x3801e9[_0x058a('0x35')];if(_0x224482[_0x058a('0x37')]['includeAll']){_0x44bbc8['include']=[{'all':!![]}];}_0x44bbc8=_['merge']({},_0x44bbc8,_0x224482[_0x058a('0x47')]);return db['Dashboard'][_0x058a('0x50')](_0x44bbc8)[_0x058a('0x29')](handleEntityNotFound(_0x3e3637,null))[_0x058a('0x29')](function(_0x44306c){if(_0x44306c){var _0x3ec556=_0x44306c[_0x058a('0x2b')]({'plain':!![]});_0x3ec556=qs[_0x058a('0x5a')](_0x3ec556,['id',_0x058a('0x5b'),_0x058a('0x5c')]);_0x224482[_0x058a('0x52')]=_['omit'](_0x224482[_0x058a('0x52')],['id',_0x058a('0x5b'),_0x058a('0x5c')]);return db[_0x058a('0x32')][_0x058a('0x51')](_[_0x058a('0x44')](_0x3ec556,_0x224482['body']),{'include':_0x224482[_0x058a('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x058a('0x29')](function(_0x51156a){var _0x5f13a0=_0x224482[_0x058a('0x55')]['get']({'plain':!![]});if(!_0x5f13a0)throw new Error(_0x058a('0x53'));if(_0x5f13a0[_0x058a('0x54')]==='user'){var _0x52c3fd=_0x51156a[_0x058a('0x2b')]({'plain':!![]});var _0xeaca2f='CustomDashboards';return db[_0x058a('0x5d')][_0x058a('0x50')]({'where':{'name':_0xeaca2f,'userProfileId':_0x5f13a0['userProfileId']},'raw':!![]})[_0x058a('0x29')](function(_0x2623d1){if(_0x2623d1&&_0x2623d1[_0x058a('0x57')]===0x0){return db[_0x058a('0x2d')][_0x058a('0x51')]({'name':_0x52c3fd['name'],'resourceId':_0x52c3fd['id'],'type':_0x2623d1[_0x058a('0x2f')],'sectionId':_0x2623d1['id']},{})[_0x058a('0x29')](function(){return _0x51156a;});}else{return _0x51156a;}})[_0x058a('0x4c')](function(_0x2ded76){logger['error'](_0x058a('0x58'),_0x2ded76);throw _0x2ded76;});}return _0x51156a;});}})[_0x058a('0x29')](respondWithResult(_0x3e3637,0xc9))[_0x058a('0x4c')](handleError(_0x3e3637,null));};exports['update']=function(_0x4f7474,_0x179280){if(_0x4f7474[_0x058a('0x52')]['id']){delete _0x4f7474['body']['id'];}return db['Dashboard'][_0x058a('0x50')]({'where':{'id':_0x4f7474['params']['id']}})['then'](handleEntityNotFound(_0x179280,null))['then'](saveUpdates(_0x4f7474[_0x058a('0x52')],null))[_0x058a('0x29')](respondWithResult(_0x179280,null))['catch'](handleError(_0x179280,null));};exports[_0x058a('0x2a')]=function(_0x1dd841,_0xc35b29){return db[_0x058a('0x32')]['find']({'where':{'id':_0x1dd841[_0x058a('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc35b29,null))[_0x058a('0x29')](removeEntity(_0xc35b29,null))['catch'](handleError(_0xc35b29,null));};function widgetAttributes(_0x16103f){try{switch(_0x16103f['type']){case _0x058a('0x5e'):return[{'name':_0x058a('0x5f'),'value':_0x16103f['attrUrl']||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x0]?_0x16103f[_0x058a('0x60')][0x0]['value']:undefined)||_0x058a('0x61')}];case'custom':return[{'name':_0x058a('0x62'),'value':_0x16103f[_0x058a('0x62')]||(_0x16103f[_0x058a('0x60')]&&_0x16103f['attrs'][0x0]?_0x16103f[_0x058a('0x60')][0x0]['value']:undefined)||''}];case _0x058a('0x63'):return[{'name':'attrHourFormat','value':_0x16103f['attrHourFormat']||(_0x16103f[_0x058a('0x60')]&&_0x16103f['attrs'][0x0]?_0x16103f[_0x058a('0x60')][0x0]['value']:undefined)||_0x058a('0x64')},{'name':_0x058a('0x65'),'value':_0x16103f[_0x058a('0x65')]||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x1]?_0x16103f[_0x058a('0x60')][0x1][_0x058a('0x66')]:undefined)||_0x058a('0x67')},{'name':_0x058a('0x68'),'value':_0x16103f[_0x058a('0x68')]||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x2]?_0x16103f['attrs'][0x2][_0x058a('0x66')]:undefined)||0xc}];case _0x058a('0x69'):return[{'name':_0x058a('0x6a'),'value':_0x16103f['attrMetric']||(_0x16103f[_0x058a('0x60')]&&_0x16103f['attrs'][0x0]?_0x16103f[_0x058a('0x60')][0x0]['value']:undefined)||_0x058a('0x6b')},{'name':_0x058a('0x6c'),'value':_0x16103f[_0x058a('0x6c')]||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x1]?_0x16103f[_0x058a('0x60')][0x1][_0x058a('0x66')]:undefined)||[]},{'name':_0x058a('0x68'),'value':_0x16103f[_0x058a('0x68')]||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x2]?_0x16103f[_0x058a('0x60')][0x2][_0x058a('0x66')]:undefined)||0x14}];case'multibar-chart':case _0x058a('0x6d'):return[{'name':_0x058a('0x6e'),'value':_0x16103f[_0x058a('0x6e')]||(_0x16103f['attrs']&&_0x16103f[_0x058a('0x60')][0x0]?_0x16103f['attrs'][0x0][_0x058a('0x66')]:undefined)||_0x058a('0x6b')},{'name':_0x058a('0x6f'),'value':_0x16103f[_0x058a('0x6f')]||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x1]?_0x16103f['attrs'][0x1][_0x058a('0x66')]:undefined)||null},{'name':_0x058a('0x70'),'value':_0x16103f[_0x058a('0x70')]||(_0x16103f['attrs']&&_0x16103f[_0x058a('0x60')][0x2]?_0x16103f[_0x058a('0x60')][0x2][_0x058a('0x66')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x16103f[_0x058a('0x6c')]||(_0x16103f['attrs']&&_0x16103f[_0x058a('0x60')][0x3]?_0x16103f['attrs'][0x3]['value']:undefined)||[]}];case _0x058a('0x71'):return[{'name':_0x058a('0x72'),'type':_0x16103f[_0x058a('0x73')]||(_0x16103f['attrs']&&_0x16103f['attrs'][0x0]?_0x16103f[_0x058a('0x60')][0x0][_0x058a('0x45')]:undefined)||null,'value':_0x16103f['attrReport']||(_0x16103f[_0x058a('0x60')]&&_0x16103f[_0x058a('0x60')][0x0]?_0x16103f[_0x058a('0x60')][0x0][_0x058a('0x66')]:undefined)||null},{'name':_0x058a('0x74'),'value':_0x16103f[_0x058a('0x74')]||(_0x16103f['attrs']&&_0x16103f[_0x058a('0x60')][0x1]?_0x16103f[_0x058a('0x60')][0x1][_0x058a('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x57a6ec){logger[_0x058a('0x2e')](_0x058a('0x75'),JSON[_0x058a('0x76')](_0x57a6ec));return[];}}exports[_0x058a('0x77')]=function(_0x52ef76,_0x21b5da,_0x285223){if(_0x52ef76[_0x058a('0x52')]['id']){delete _0x52ef76[_0x058a('0x52')]['id'];}return db['Dashboard'][_0x058a('0x50')]({'where':{'id':_0x52ef76[_0x058a('0x4e')]['id']}})[_0x058a('0x29')](handleEntityNotFound(_0x21b5da,null))[_0x058a('0x29')](function(_0x3eee8c){if(_0x3eee8c){_0x52ef76[_0x058a('0x52')][_0x058a('0x78')]=_0x3eee8c['id'];_0x52ef76[_0x058a('0x52')]['attrs']=widgetAttributes(_0x52ef76[_0x058a('0x52')]);return db['DashboardItem'][_0x058a('0x51')](_0x52ef76[_0x058a('0x52')]);}})[_0x058a('0x29')](respondWithResult(_0x21b5da,null))['catch'](handleError(_0x21b5da,null));};exports['getItems']=function(_0x2d05ef,_0x84a86f,_0x585746){var _0x2df133={};var _0x481554={};var _0x1e4176;var _0x5d1435;return db['Dashboard'][_0x058a('0x79')]({'where':{'id':_0x2d05ef[_0x058a('0x4e')]['id']}})[_0x058a('0x29')](handleEntityNotFound(_0x84a86f,null))['then'](function(_0x69524){if(_0x69524){_0x1e4176=_0x69524;_0x481554['model']=_[_0x058a('0x4f')](db[_0x058a('0x7a')][_0x058a('0x33')]);_0x481554['query']=_[_0x058a('0x4f')](_0x2d05ef[_0x058a('0x37')]);_0x481554[_0x058a('0x38')]=_[_0x058a('0x39')](_0x481554[_0x058a('0x35')],_0x481554['query']);_0x2df133['attributes']=_[_0x058a('0x39')](_0x481554[_0x058a('0x35')],qs[_0x058a('0x3a')](_0x2d05ef[_0x058a('0x37')][_0x058a('0x3a')]));_0x2df133[_0x058a('0x3b')]=_0x2df133[_0x058a('0x3b')][_0x058a('0x3c')]?_0x2df133['attributes']:_0x481554[_0x058a('0x35')];_0x2df133['order']=qs[_0x058a('0x40')](_0x2d05ef[_0x058a('0x37')]['sort']);_0x2df133['where']=qs[_0x058a('0x38')](_[_0x058a('0x41')](_0x2d05ef['query'],_0x481554[_0x058a('0x38')]));if(_0x2d05ef[_0x058a('0x37')][_0x058a('0x42')]){_0x2df133['where']=_[_0x058a('0x44')](_0x2df133['where'],{'$or':_[_0x058a('0x36')](_0x2df133[_0x058a('0x3b')],function(_0x363cfa){var _0x1aed80={};_0x1aed80[_0x363cfa]={'$like':'%'+_0x2d05ef['query'][_0x058a('0x42')]+'%'};return _0x1aed80;})});}_0x2df133=_[_0x058a('0x44')]({},_0x2df133,_0x2d05ef[_0x058a('0x47')]);return _0x1e4176[_0x058a('0x7b')](_0x2df133);}})['then'](function(_0x89fde6){if(_0x89fde6){_0x5d1435=_0x89fde6[_0x058a('0x3c')];if(!_0x2d05ef['query'][_0x058a('0x3d')](_0x058a('0x3e'))){_0x2df133[_0x058a('0x3f')]=qs[_0x058a('0x3f')](_0x2d05ef[_0x058a('0x37')][_0x058a('0x3f')]);_0x2df133[_0x058a('0x23')]=qs[_0x058a('0x23')](_0x2d05ef[_0x058a('0x37')][_0x058a('0x23')]);}return _0x1e4176[_0x058a('0x7b')](_0x2df133);}})[_0x058a('0x29')](function(_0x59c626){if(_0x59c626){return _0x59c626?{'count':_0x5d1435,'rows':_0x59c626}:null;}})['then'](respondWithResult(_0x84a86f,null))[_0x058a('0x4c')](handleError(_0x84a86f,null));}; \ No newline at end of file +var _0x399d=['attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','limit','set','Content-Range','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','filter','options','count','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom'];(function(_0x10ca1a,_0x5cd9c3){var _0x4bb286=function(_0x3996b3){while(--_0x3996b3){_0x10ca1a['push'](_0x10ca1a['shift']());}};_0x4bb286(++_0x5cd9c3);}(_0x399d,0x10d));var _0xd399=function(_0x3732d6,_0x2dddb6){_0x3732d6=_0x3732d6-0x0;var _0x4bf6e5=_0x399d[_0x3732d6];return _0x4bf6e5;};'use strict';var pdf=require(_0xd399('0x0'));var emlformat=require(_0xd399('0x1'));var rimraf=require(_0xd399('0x2'));var zipdir=require(_0xd399('0x3'));var jsonpatch=require(_0xd399('0x4'));var rp=require('request-promise');var moment=require(_0xd399('0x5'));var BPromise=require(_0xd399('0x6'));var Mustache=require(_0xd399('0x7'));var util=require(_0xd399('0x8'));var path=require(_0xd399('0x9'));var sox=require('sox');var csv=require(_0xd399('0xa'));var ejs=require(_0xd399('0xb'));var fs=require('fs');var _=require(_0xd399('0xc'));var squel=require(_0xd399('0xd'));var crypto=require(_0xd399('0xe'));var jsforce=require(_0xd399('0xf'));var deskjs=require(_0xd399('0x10'));var toCsv=require(_0xd399('0xa'));var querystring=require(_0xd399('0x11'));var Papa=require(_0xd399('0x12'));var Redis=require(_0xd399('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd399('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd399('0x15'));var config=require(_0xd399('0x16'));var licenseUtil=require(_0xd399('0x17'));var db=require(_0xd399('0x18'))['db'];config[_0xd399('0x19')]=_[_0xd399('0x1a')](config['redis'],{'host':_0xd399('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd399('0x19')]));require(_0xd399('0x1c'))['register'](socket);function respondWithStatusCode(_0x456b1c,_0x37824b){_0x37824b=_0x37824b||0xcc;return function(_0x54d214){if(_0x54d214){return _0x456b1c[_0xd399('0x1d')](_0x37824b);}return _0x456b1c[_0xd399('0x1e')](_0x37824b)[_0xd399('0x1f')]();};}function respondWithResult(_0x265fdc,_0x1c2cd7){_0x1c2cd7=_0x1c2cd7||0xc8;return function(_0x1dc9f6){if(_0x1dc9f6){return _0x265fdc[_0xd399('0x1e')](_0x1c2cd7)[_0xd399('0x20')](_0x1dc9f6);}};}function respondWithFilteredResult(_0x7ab90d,_0x672a4f){return function(_0x136cb0){if(_0x136cb0){var _0x140881=_0x136cb0['count'],_0x1b4cfb=_0x672a4f['offset'],_0x14a7b4=_0x672a4f['offset']+_0x672a4f[_0xd399('0x21')],_0x2a46ad;if(_0x14a7b4>=_0x140881){_0x14a7b4=_0x140881;_0x2a46ad=0xc8;}else{_0x2a46ad=0xce;}_0x7ab90d['status'](_0x2a46ad);return _0x7ab90d[_0xd399('0x22')](_0xd399('0x23'),_0x1b4cfb+'-'+_0x14a7b4+'/'+_0x140881)[_0xd399('0x20')](_0x136cb0);}return null;};}function patchUpdates(_0x2a5661){return function(_0x58eb01){try{jsonpatch['apply'](_0x58eb01,_0x2a5661,!![]);}catch(_0x59644a){return BPromise[_0xd399('0x24')](_0x59644a);}return _0x58eb01[_0xd399('0x25')]();};}function saveUpdates(_0x198c9f,_0x58bc15){return function(_0xd51d1c){if(_0xd51d1c){return _0xd51d1c['update'](_0x198c9f)[_0xd399('0x26')](function(_0x3f19fb){return _0x3f19fb;});}return null;};}function removeEntity(_0x5f0068,_0x32938d){return function(_0xa167ff){if(_0xa167ff){return _0xa167ff[_0xd399('0x27')]()[_0xd399('0x26')](function(){var _0x26ce0e=_0xa167ff[_0xd399('0x28')]({'plain':!![]});var _0x510d07=_0xd399('0x29');return db[_0xd399('0x2a')]['destroy']({'where':{'type':_0x510d07,'resourceId':_0x26ce0e['id']}})[_0xd399('0x26')](function(){return _0xa167ff;});})[_0xd399('0x26')](function(){_0x5f0068[_0xd399('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e7487,_0x5cfd3b){return function(_0x5095e2){if(!_0x5095e2){_0x1e7487[_0xd399('0x1d')](0x194);}return _0x5095e2;};}function handleError(_0x168f90,_0x47f685){_0x47f685=_0x47f685||0x1f4;return function(_0x9ab812){logger[_0xd399('0x2b')](_0x9ab812['stack']);if(_0x9ab812[_0xd399('0x2c')]){delete _0x9ab812[_0xd399('0x2c')];}_0x168f90[_0xd399('0x1e')](_0x47f685)[_0xd399('0x2d')](_0x9ab812);};}exports['index']=function(_0x487e9b,_0x32e5be){var _0x3d61ff={},_0x4910ac={},_0x9bc27d={'count':0x0,'rows':[]};var _0x196f7c=_[_0xd399('0x2e')](db[_0xd399('0x2f')][_0xd399('0x30')],function(_0x11501c){return{'name':_0x11501c[_0xd399('0x31')],'type':_0x11501c[_0xd399('0x32')][_0xd399('0x33')]};});_0x4910ac[_0xd399('0x34')]=_[_0xd399('0x2e')](_0x196f7c,_0xd399('0x2c'));_0x4910ac[_0xd399('0x35')]=_[_0xd399('0x36')](_0x487e9b['query']);_0x4910ac[_0xd399('0x37')]=_['intersection'](_0x4910ac[_0xd399('0x34')],_0x4910ac['query']);_0x3d61ff[_0xd399('0x38')]=_['intersection'](_0x4910ac[_0xd399('0x34')],qs[_0xd399('0x39')](_0x487e9b[_0xd399('0x35')][_0xd399('0x39')]));_0x3d61ff[_0xd399('0x38')]=_0x3d61ff[_0xd399('0x38')][_0xd399('0x3a')]?_0x3d61ff[_0xd399('0x38')]:_0x4910ac['model'];if(!_0x487e9b[_0xd399('0x35')][_0xd399('0x3b')](_0xd399('0x3c'))){_0x3d61ff[_0xd399('0x21')]=qs[_0xd399('0x21')](_0x487e9b[_0xd399('0x35')]['limit']);_0x3d61ff[_0xd399('0x3d')]=qs[_0xd399('0x3d')](_0x487e9b['query'][_0xd399('0x3d')]);}_0x3d61ff[_0xd399('0x3e')]=qs[_0xd399('0x3f')](_0x487e9b[_0xd399('0x35')]['sort']);_0x3d61ff[_0xd399('0x40')]=qs[_0xd399('0x37')](_['pick'](_0x487e9b[_0xd399('0x35')],_0x4910ac['filters']),_0x196f7c);if(_0x487e9b[_0xd399('0x35')]['filter']){_0x3d61ff[_0xd399('0x40')]=_[_0xd399('0x41')](_0x3d61ff[_0xd399('0x40')],{'$or':_['map'](_0x196f7c,function(_0x471bf1){if(_0x471bf1[_0xd399('0x32')]!=='VIRTUAL'){var _0x30eeca={};_0x30eeca[_0x471bf1[_0xd399('0x2c')]]={'$like':'%'+_0x487e9b['query'][_0xd399('0x42')]+'%'};return _0x30eeca;}})});}_0x3d61ff=_[_0xd399('0x41')]({},_0x3d61ff,_0x487e9b[_0xd399('0x43')]);var _0x59c2f6={'where':_0x3d61ff[_0xd399('0x40')]};return db[_0xd399('0x2f')]['count'](_0x59c2f6)[_0xd399('0x26')](function(_0x56ec30){_0x9bc27d[_0xd399('0x44')]=_0x56ec30;if(_0x487e9b[_0xd399('0x35')]['includeAll']){_0x3d61ff['include']=[{'all':!![]}];}return db['Dashboard'][_0xd399('0x45')](_0x3d61ff);})[_0xd399('0x26')](function(_0x507ad6){_0x9bc27d[_0xd399('0x46')]=_0x507ad6;return _0x9bc27d;})[_0xd399('0x26')](respondWithFilteredResult(_0x32e5be,_0x3d61ff))[_0xd399('0x47')](handleError(_0x32e5be,null));};exports[_0xd399('0x48')]=function(_0x3025d9,_0x45520c){var _0x40eebe={'raw':![],'where':{'id':_0x3025d9[_0xd399('0x49')]['id']}},_0x5e07ca={};_0x5e07ca['model']=_[_0xd399('0x36')](db['Dashboard'][_0xd399('0x30')]);_0x5e07ca[_0xd399('0x35')]=_['keys'](_0x3025d9[_0xd399('0x35')]);_0x5e07ca['filters']=_[_0xd399('0x4a')](_0x5e07ca[_0xd399('0x34')],_0x5e07ca[_0xd399('0x35')]);_0x40eebe[_0xd399('0x38')]=_[_0xd399('0x4a')](_0x5e07ca[_0xd399('0x34')],qs['fields'](_0x3025d9['query'][_0xd399('0x39')]));_0x40eebe['attributes']=_0x40eebe[_0xd399('0x38')][_0xd399('0x3a')]?_0x40eebe[_0xd399('0x38')]:_0x5e07ca[_0xd399('0x34')];if(_0x3025d9[_0xd399('0x35')][_0xd399('0x4b')]){_0x40eebe['include']=[{'all':!![]}];}_0x40eebe=_[_0xd399('0x41')]({},_0x40eebe,_0x3025d9[_0xd399('0x43')]);return db['Dashboard'][_0xd399('0x4c')](_0x40eebe)[_0xd399('0x26')](handleEntityNotFound(_0x45520c,null))[_0xd399('0x26')](respondWithResult(_0x45520c,null))['catch'](handleError(_0x45520c,null));};exports[_0xd399('0x4d')]=function(_0x1d89e4,_0x321e7b){return db[_0xd399('0x2f')][_0xd399('0x4d')](_0x1d89e4[_0xd399('0x4e')],{})[_0xd399('0x26')](function(_0x2923ed){var _0x2cc1d2=_0x1d89e4[_0xd399('0x4f')][_0xd399('0x28')]({'plain':!![]});if(!_0x2cc1d2)throw new Error(_0xd399('0x50'));if(_0x2cc1d2[_0xd399('0x51')]===_0xd399('0x4f')){var _0x37fdc4=_0x2923ed[_0xd399('0x28')]({'plain':!![]});var _0x14a6b5='CustomDashboards';return db[_0xd399('0x52')][_0xd399('0x4c')]({'where':{'name':_0x14a6b5,'userProfileId':_0x2cc1d2[_0xd399('0x53')]},'raw':!![]})[_0xd399('0x26')](function(_0x1d8f4e){if(_0x1d8f4e&&_0x1d8f4e[_0xd399('0x54')]===0x0){return db['UserProfileResource'][_0xd399('0x4d')]({'name':_0x37fdc4['name'],'resourceId':_0x37fdc4['id'],'type':_0x1d8f4e['name'],'sectionId':_0x1d8f4e['id']},{})['then'](function(){return _0x2923ed;});}else{return _0x2923ed;}})['catch'](function(_0x274cc5){logger[_0xd399('0x2b')](_0xd399('0x55'),_0x274cc5);throw _0x274cc5;});}return _0x2923ed;})[_0xd399('0x26')](respondWithResult(_0x321e7b,0xc9))['catch'](handleError(_0x321e7b,null));};exports[_0xd399('0x56')]=function(_0x55d364,_0x262fb4){var _0x5cf95b={'where':{'id':_0x55d364['params']['id']}},_0x21a3d9={};_0x21a3d9[_0xd399('0x34')]=_[_0xd399('0x36')](db[_0xd399('0x2f')][_0xd399('0x30')]);_0x5cf95b[_0xd399('0x38')]=_['intersection'](_0x21a3d9[_0xd399('0x34')],qs['fields'](_0x55d364[_0xd399('0x35')][_0xd399('0x39')]));_0x5cf95b['attributes']=_0x5cf95b[_0xd399('0x38')][_0xd399('0x3a')]?_0x5cf95b['attributes']:_0x21a3d9[_0xd399('0x34')];if(_0x55d364[_0xd399('0x35')][_0xd399('0x4b')]){_0x5cf95b[_0xd399('0x57')]=[{'all':!![]}];}_0x5cf95b=_[_0xd399('0x41')]({},_0x5cf95b,_0x55d364[_0xd399('0x43')]);return db['Dashboard'][_0xd399('0x4c')](_0x5cf95b)[_0xd399('0x26')](handleEntityNotFound(_0x262fb4,null))[_0xd399('0x26')](function(_0x7c88d7){if(_0x7c88d7){var _0x582446=_0x7c88d7['get']({'plain':!![]});_0x582446=qs[_0xd399('0x58')](_0x582446,['id',_0xd399('0x59'),_0xd399('0x5a')]);_0x55d364[_0xd399('0x4e')]=_[_0xd399('0x58')](_0x55d364[_0xd399('0x4e')],['id','createdAt',_0xd399('0x5a')]);return db[_0xd399('0x2f')]['create'](_[_0xd399('0x41')](_0x582446,_0x55d364[_0xd399('0x4e')]),{'include':_0x55d364[_0xd399('0x35')][_0xd399('0x4b')]?[{'all':!![]}]:undefined})[_0xd399('0x26')](function(_0x59ab6f){var _0x2838db=_0x55d364['user'][_0xd399('0x28')]({'plain':!![]});if(!_0x2838db)throw new Error(_0xd399('0x50'));if(_0x2838db['role']===_0xd399('0x4f')){var _0x2449a2=_0x59ab6f['get']({'plain':!![]});var _0x514a23=_0xd399('0x29');return db[_0xd399('0x52')]['find']({'where':{'name':_0x514a23,'userProfileId':_0x2838db['userProfileId']},'raw':!![]})[_0xd399('0x26')](function(_0x223714){if(_0x223714&&_0x223714['autoAssociation']===0x0){return db[_0xd399('0x2a')][_0xd399('0x4d')]({'name':_0x2449a2['name'],'resourceId':_0x2449a2['id'],'type':_0x223714[_0xd399('0x2c')],'sectionId':_0x223714['id']},{})[_0xd399('0x26')](function(){return _0x59ab6f;});}else{return _0x59ab6f;}})['catch'](function(_0x2858e8){logger['error'](_0xd399('0x55'),_0x2858e8);throw _0x2858e8;});}return _0x59ab6f;});}})[_0xd399('0x26')](respondWithResult(_0x262fb4,0xc9))[_0xd399('0x47')](handleError(_0x262fb4,null));};exports['update']=function(_0x2a6b85,_0x12cd54){if(_0x2a6b85[_0xd399('0x4e')]['id']){delete _0x2a6b85[_0xd399('0x4e')]['id'];}return db[_0xd399('0x2f')][_0xd399('0x4c')]({'where':{'id':_0x2a6b85[_0xd399('0x49')]['id']}})[_0xd399('0x26')](handleEntityNotFound(_0x12cd54,null))[_0xd399('0x26')](saveUpdates(_0x2a6b85[_0xd399('0x4e')],null))[_0xd399('0x26')](respondWithResult(_0x12cd54,null))[_0xd399('0x47')](handleError(_0x12cd54,null));};exports[_0xd399('0x27')]=function(_0xcbbd76,_0xec2d63){return db[_0xd399('0x2f')][_0xd399('0x4c')]({'where':{'id':_0xcbbd76[_0xd399('0x49')]['id']}})['then'](handleEntityNotFound(_0xec2d63,null))[_0xd399('0x26')](removeEntity(_0xec2d63,null))[_0xd399('0x47')](handleError(_0xec2d63,null));};function widgetAttributes(_0x3790da){try{switch(_0x3790da[_0xd399('0x32')]){case _0xd399('0x5b'):return[{'name':_0xd399('0x5c'),'value':_0x3790da['attrUrl']||(_0x3790da['attrs']&&_0x3790da[_0xd399('0x5d')][0x0]?_0x3790da[_0xd399('0x5d')][0x0][_0xd399('0x5e')]:undefined)||_0xd399('0x5f')}];case _0xd399('0x60'):return[{'name':_0xd399('0x61'),'value':_0x3790da[_0xd399('0x61')]||(_0x3790da['attrs']&&_0x3790da[_0xd399('0x5d')][0x0]?_0x3790da['attrs'][0x0][_0xd399('0x5e')]:undefined)||''}];case _0xd399('0x62'):return[{'name':_0xd399('0x63'),'value':_0x3790da[_0xd399('0x63')]||(_0x3790da['attrs']&&_0x3790da[_0xd399('0x5d')][0x0]?_0x3790da[_0xd399('0x5d')][0x0][_0xd399('0x5e')]:undefined)||_0xd399('0x64')},{'name':_0xd399('0x65'),'value':_0x3790da[_0xd399('0x65')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da['attrs'][0x1]?_0x3790da[_0xd399('0x5d')][0x1][_0xd399('0x5e')]:undefined)||_0xd399('0x66')},{'name':_0xd399('0x67'),'value':_0x3790da[_0xd399('0x67')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da[_0xd399('0x5d')][0x2]?_0x3790da['attrs'][0x2][_0xd399('0x5e')]:undefined)||0xc}];case _0xd399('0x68'):return[{'name':_0xd399('0x69'),'value':_0x3790da['attrMetric']||(_0x3790da['attrs']&&_0x3790da[_0xd399('0x5d')][0x0]?_0x3790da['attrs'][0x0][_0xd399('0x5e')]:undefined)||'total'},{'name':_0xd399('0x6a'),'value':_0x3790da[_0xd399('0x6a')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da['attrs'][0x1]?_0x3790da[_0xd399('0x5d')][0x1][_0xd399('0x5e')]:undefined)||[]},{'name':_0xd399('0x67'),'value':_0x3790da[_0xd399('0x67')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da[_0xd399('0x5d')][0x2]?_0x3790da[_0xd399('0x5d')][0x2][_0xd399('0x5e')]:undefined)||0x14}];case _0xd399('0x6b'):case _0xd399('0x6c'):return[{'name':_0xd399('0x6d'),'value':_0x3790da[_0xd399('0x6d')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da[_0xd399('0x5d')][0x0]?_0x3790da[_0xd399('0x5d')][0x0][_0xd399('0x5e')]:undefined)||_0xd399('0x6e')},{'name':'attrSerie2','value':_0x3790da['attrSerie2']||(_0x3790da[_0xd399('0x5d')]&&_0x3790da[_0xd399('0x5d')][0x1]?_0x3790da[_0xd399('0x5d')][0x1][_0xd399('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x3790da[_0xd399('0x6f')]||(_0x3790da['attrs']&&_0x3790da[_0xd399('0x5d')][0x2]?_0x3790da[_0xd399('0x5d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3790da['attrVoiceQueues']||(_0x3790da[_0xd399('0x5d')]&&_0x3790da[_0xd399('0x5d')][0x3]?_0x3790da[_0xd399('0x5d')][0x3][_0xd399('0x5e')]:undefined)||[]}];case _0xd399('0x70'):return[{'name':_0xd399('0x71'),'type':_0x3790da[_0xd399('0x72')]||(_0x3790da['attrs']&&_0x3790da['attrs'][0x0]?_0x3790da[_0xd399('0x5d')][0x0][_0xd399('0x32')]:undefined)||null,'value':_0x3790da[_0xd399('0x71')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da[_0xd399('0x5d')][0x0]?_0x3790da[_0xd399('0x5d')][0x0][_0xd399('0x5e')]:undefined)||null},{'name':_0xd399('0x73'),'value':_0x3790da[_0xd399('0x73')]||(_0x3790da[_0xd399('0x5d')]&&_0x3790da['attrs'][0x1]?_0x3790da[_0xd399('0x5d')][0x1][_0xd399('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x2120d7){logger[_0xd399('0x2b')](_0xd399('0x74'),JSON['stringify'](_0x2120d7));return[];}}exports[_0xd399('0x75')]=function(_0x1779b5,_0x16cd31,_0x4ec3e1){if(_0x1779b5[_0xd399('0x4e')]['id']){delete _0x1779b5['body']['id'];}return db[_0xd399('0x2f')][_0xd399('0x4c')]({'where':{'id':_0x1779b5[_0xd399('0x49')]['id']}})[_0xd399('0x26')](handleEntityNotFound(_0x16cd31,null))[_0xd399('0x26')](function(_0x126200){if(_0x126200){_0x1779b5[_0xd399('0x4e')][_0xd399('0x76')]=_0x126200['id'];_0x1779b5['body'][_0xd399('0x5d')]=widgetAttributes(_0x1779b5[_0xd399('0x4e')]);return db[_0xd399('0x77')][_0xd399('0x4d')](_0x1779b5[_0xd399('0x4e')]);}})[_0xd399('0x26')](respondWithResult(_0x16cd31,null))[_0xd399('0x47')](handleError(_0x16cd31,null));};exports[_0xd399('0x78')]=function(_0x560d25,_0x47c5d4,_0x5595e1){var _0x1d36bc={};var _0x5c00a5={};var _0xac35e0;var _0x3edfdc;return db[_0xd399('0x2f')]['findOne']({'where':{'id':_0x560d25[_0xd399('0x49')]['id']}})['then'](handleEntityNotFound(_0x47c5d4,null))[_0xd399('0x26')](function(_0x9f8b95){if(_0x9f8b95){_0xac35e0=_0x9f8b95;_0x5c00a5['model']=_[_0xd399('0x36')](db['DashboardItem'][_0xd399('0x30')]);_0x5c00a5[_0xd399('0x35')]=_[_0xd399('0x36')](_0x560d25[_0xd399('0x35')]);_0x5c00a5[_0xd399('0x37')]=_[_0xd399('0x4a')](_0x5c00a5[_0xd399('0x34')],_0x5c00a5[_0xd399('0x35')]);_0x1d36bc[_0xd399('0x38')]=_[_0xd399('0x4a')](_0x5c00a5[_0xd399('0x34')],qs[_0xd399('0x39')](_0x560d25[_0xd399('0x35')][_0xd399('0x39')]));_0x1d36bc['attributes']=_0x1d36bc[_0xd399('0x38')]['length']?_0x1d36bc[_0xd399('0x38')]:_0x5c00a5[_0xd399('0x34')];_0x1d36bc[_0xd399('0x3e')]=qs[_0xd399('0x3f')](_0x560d25[_0xd399('0x35')][_0xd399('0x3f')]);_0x1d36bc[_0xd399('0x40')]=qs['filters'](_[_0xd399('0x79')](_0x560d25[_0xd399('0x35')],_0x5c00a5[_0xd399('0x37')]));if(_0x560d25[_0xd399('0x35')][_0xd399('0x42')]){_0x1d36bc['where']=_['merge'](_0x1d36bc[_0xd399('0x40')],{'$or':_[_0xd399('0x2e')](_0x1d36bc[_0xd399('0x38')],function(_0x2d0864){var _0x5ebab2={};_0x5ebab2[_0x2d0864]={'$like':'%'+_0x560d25[_0xd399('0x35')][_0xd399('0x42')]+'%'};return _0x5ebab2;})});}_0x1d36bc=_[_0xd399('0x41')]({},_0x1d36bc,_0x560d25[_0xd399('0x43')]);return _0xac35e0[_0xd399('0x78')](_0x1d36bc);}})[_0xd399('0x26')](function(_0x320c9a){if(_0x320c9a){_0x3edfdc=_0x320c9a[_0xd399('0x3a')];if(!_0x560d25['query'][_0xd399('0x3b')](_0xd399('0x3c'))){_0x1d36bc[_0xd399('0x21')]=qs['limit'](_0x560d25[_0xd399('0x35')][_0xd399('0x21')]);_0x1d36bc[_0xd399('0x3d')]=qs[_0xd399('0x3d')](_0x560d25[_0xd399('0x35')]['offset']);}return _0xac35e0['getItems'](_0x1d36bc);}})['then'](function(_0x2967f4){if(_0x2967f4){return _0x2967f4?{'count':_0x3edfdc,'rows':_0x2967f4}:null;}})[_0xd399('0x26')](respondWithResult(_0x47c5d4,null))[_0xd399('0x47')](handleError(_0x47c5d4,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1c3f237..b84183d 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 _0x8a01=['save','update','emit','exports','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a01,0xba));var _0x18a0=function(_0x5ab591,_0x37d129){_0x5ab591=_0x5ab591-0x0;var _0x395751=_0x8a01[_0x5ab591];return _0x395751;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x18a0('0x0'))['db'][_0x18a0('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x18a0('0x2')](0x0);var events={'afterCreate':_0x18a0('0x3'),'afterUpdate':_0x18a0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x423454){return function(_0x29e20b,_0x16f487,_0x2606c7){DashboardEvents[_0x18a0('0x5')](_0x423454+':'+_0x29e20b['id'],_0x29e20b);DashboardEvents[_0x18a0('0x5')](_0x423454,_0x29e20b);_0x2606c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x18a0('0x6')]=DashboardEvents; \ No newline at end of file +var _0x14b1=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x34400d,_0x801e39){var _0x97cb35=function(_0x30f484){while(--_0x30f484){_0x34400d['push'](_0x34400d['shift']());}};_0x97cb35(++_0x801e39);}(_0x14b1,0x101));var _0x114b=function(_0x183d0e,_0x1f520f){_0x183d0e=_0x183d0e-0x0;var _0x278ff8=_0x14b1[_0x183d0e];return _0x278ff8;};'use strict';var EventEmitter=require(_0x114b('0x0'));var Dashboard=require(_0x114b('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x114b('0x2')](0x0);var events={'afterCreate':_0x114b('0x3'),'afterUpdate':_0x114b('0x4'),'afterDestroy':_0x114b('0x5')};function emitEvent(_0x1ce69c){return function(_0x22f7a5,_0x3f88da,_0x5a226d){DashboardEvents[_0x114b('0x6')](_0x1ce69c+':'+_0x22f7a5['id'],_0x22f7a5);DashboardEvents[_0x114b('0x6')](_0x1ce69c,_0x22f7a5);_0x5a226d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x114b('0x7')](e,emitEvent(event));}}module[_0x114b('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 35991df..8285b36 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 _0x85a6=['bluebird','path','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x85a6,0x172));var _0x685a=function(_0x277367,_0x319679){_0x277367=_0x277367-0x0;var _0x3c1d34=_0x85a6[_0x277367];return _0x3c1d34;};'use strict';var _=require(_0x685a('0x0'));var util=require(_0x685a('0x1'));var logger=require('../../config/logger')(_0x685a('0x2'));var moment=require(_0x685a('0x3'));var BPromise=require(_0x685a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x685a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x685a('0x6'));module[_0x685a('0x7')]=function(_0x577896,_0x5601f2){return _0x577896[_0x685a('0x8')](_0x685a('0x9'),attributes,{'tableName':_0x685a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3cd=['moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards'];(function(_0x121fcc,_0x4366b1){var _0x32f7ea=function(_0x23e658){while(--_0x23e658){_0x121fcc['push'](_0x121fcc['shift']());}};_0x32f7ea(++_0x4366b1);}(_0xd3cd,0x8c));var _0xdd3c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3cd[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdd3c('0x0'));var BPromise=require('bluebird');var rp=require(_0xdd3c('0x1'));var fs=require('fs');var path=require(_0xdd3c('0x2'));var rimraf=require(_0xdd3c('0x3'));var config=require(_0xdd3c('0x4'));var attributes=require(_0xdd3c('0x5'));module[_0xdd3c('0x6')]=function(_0x2de8b1,_0x28f697){return _0x2de8b1[_0xdd3c('0x7')](_0xdd3c('0x8'),attributes,{'tableName':_0xdd3c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index c77ab94..2c746f5 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 _0xe95a=['then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe95a,0x168));var _0xae95=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe95a[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var moment=require(_0xae95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae95('0x3'));var db=require(_0xae95('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae95('0x5'));var config=require(_0xae95('0x6'));var jayson=require(_0xae95('0x7'));var client=jayson[_0xae95('0x8')][_0xae95('0x9')]({'port':0x232a});config[_0xae95('0xa')]=_[_0xae95('0xb')](config[_0xae95('0xa')],{'host':_0xae95('0xc'),'port':0x18eb});var socket=require(_0xae95('0xd'))(new Redis(config[_0xae95('0xa')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x417dca,_0x2b8703,_0x44cbaa){return new BPromise(function(_0xf83ef5,_0x27ea24){return client[_0xae95('0xe')](_0x417dca,_0x44cbaa)[_0xae95('0xf')](function(_0x143b69){logger['info'](_0xae95('0x10'),_0x2b8703,_0xae95('0x11'));logger[_0xae95('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2b8703,_0xae95('0x11'),JSON[_0xae95('0x13')](_0x143b69));if(_0x143b69['error']){if(_0x143b69[_0xae95('0x14')][_0xae95('0x15')]===0x1f4){logger['error'](_0xae95('0x10'),_0x2b8703,_0x143b69[_0xae95('0x14')][_0xae95('0x16')]);return _0x27ea24(_0x143b69[_0xae95('0x14')][_0xae95('0x16')]);}logger[_0xae95('0x14')](_0xae95('0x10'),_0x2b8703,_0x143b69[_0xae95('0x14')]['message']);return _0xf83ef5(_0x143b69['error'][_0xae95('0x16')]);}else{logger[_0xae95('0x17')]('Dashboard,\x20%s,\x20%s',_0x2b8703,'request\x20sent');_0xf83ef5(_0x143b69['result'][_0xae95('0x16')]);}})[_0xae95('0x18')](function(_0x2e7f75){logger['error'](_0xae95('0x10'),_0x2b8703,_0x2e7f75);_0x27ea24(_0x2e7f75);});});} \ No newline at end of file +var _0xa87a=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request'];(function(_0x4bd3e5,_0x211303){var _0x39fa28=function(_0x102ab2){while(--_0x102ab2){_0x4bd3e5['push'](_0x4bd3e5['shift']());}};_0x39fa28(++_0x211303);}(_0xa87a,0x1e6));var _0xaa87=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xa87a[_0x30faec];return _0x29484f;};'use strict';var _=require(_0xaa87('0x0'));var util=require('util');var moment=require(_0xaa87('0x1'));var BPromise=require(_0xaa87('0x2'));var rs=require(_0xaa87('0x3'));var fs=require('fs');var Redis=require(_0xaa87('0x4'));var db=require(_0xaa87('0x5'))['db'];var utils=require(_0xaa87('0x6'));var logger=require('../../config/logger')(_0xaa87('0x7'));var config=require(_0xaa87('0x8'));var jayson=require(_0xaa87('0x9'));var client=jayson[_0xaa87('0xa')][_0xaa87('0xb')]({'port':0x232a});config['redis']=_[_0xaa87('0xc')](config[_0xaa87('0xd')],{'host':_0xaa87('0xe'),'port':0x18eb});var socket=require(_0xaa87('0xf'))(new Redis(config[_0xaa87('0xd')]));require('./dashboard.socket')[_0xaa87('0x10')](socket);function respondWithRpcPromise(_0x54cf9d,_0x4ffbe5,_0x231ca5){return new BPromise(function(_0x221391,_0xbe713d){return client[_0xaa87('0x11')](_0x54cf9d,_0x231ca5)[_0xaa87('0x12')](function(_0x47ab2d){logger[_0xaa87('0x13')](_0xaa87('0x14'),_0x4ffbe5,_0xaa87('0x15'));logger[_0xaa87('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4ffbe5,'request\x20sent',JSON[_0xaa87('0x17')](_0x47ab2d));if(_0x47ab2d[_0xaa87('0x18')]){if(_0x47ab2d[_0xaa87('0x18')][_0xaa87('0x19')]===0x1f4){logger['error'](_0xaa87('0x14'),_0x4ffbe5,_0x47ab2d[_0xaa87('0x18')][_0xaa87('0x1a')]);return _0xbe713d(_0x47ab2d[_0xaa87('0x18')]['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x4ffbe5,_0x47ab2d[_0xaa87('0x18')][_0xaa87('0x1a')]);return _0x221391(_0x47ab2d['error']['message']);}else{logger[_0xaa87('0x13')](_0xaa87('0x14'),_0x4ffbe5,_0xaa87('0x15'));_0x221391(_0x47ab2d[_0xaa87('0x1b')][_0xaa87('0x1a')]);}})['catch'](function(_0x5564d0){logger[_0xaa87('0x18')]('Dashboard,\x20%s,\x20%s',_0x4ffbe5,_0x5564d0);_0xbe713d(_0x5564d0);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4a605cc..0052e05 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 _0x1995=['emit','removeListener','length','./dashboard.events','remove','update'];(function(_0x27d3d2,_0x48ccda){var _0x319e94=function(_0x7b9dd0){while(--_0x7b9dd0){_0x27d3d2['push'](_0x27d3d2['shift']());}};_0x319e94(++_0x48ccda);}(_0x1995,0x147));var _0x5199=function(_0x1b185a,_0x407eb0){_0x1b185a=_0x1b185a-0x0;var _0xd2e4df=_0x1995[_0x1b185a];return _0xd2e4df;};'use strict';var DashboardEvents=require(_0x5199('0x0'));var events=['save',_0x5199('0x1'),_0x5199('0x2')];function createListener(_0x57244d,_0x1921f2){return function(_0x50379f){_0x1921f2[_0x5199('0x3')](_0x57244d,_0x50379f);};}function removeListener(_0x92a413,_0x5bebde){return function(){DashboardEvents[_0x5199('0x4')](_0x92a413,_0x5bebde);};}exports['register']=function(_0x39c536){for(var _0x443b76=0x0,_0xd8bbeb=events[_0x5199('0x5')];_0x443b76<_0xd8bbeb;_0x443b76++){var _0x7714b=events[_0x443b76];var _0x1217ad=createListener('dashboard:'+_0x7714b,_0x39c536);DashboardEvents['on'](_0x7714b,_0x1217ad);}}; \ No newline at end of file +var _0x1df2=['dashboard:','save','remove','update','emit','removeListener','register','length'];(function(_0x1ddf5d,_0x1eee83){var _0x174a27=function(_0x583486){while(--_0x583486){_0x1ddf5d['push'](_0x1ddf5d['shift']());}};_0x174a27(++_0x1eee83);}(_0x1df2,0x171));var _0x21df=function(_0x4186fe,_0x566e7f){_0x4186fe=_0x4186fe-0x0;var _0xfbe9e2=_0x1df2[_0x4186fe];return _0xfbe9e2;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x21df('0x0'),_0x21df('0x1'),_0x21df('0x2')];function createListener(_0x31bcbb,_0x505bd8){return function(_0x4507d4){_0x505bd8[_0x21df('0x3')](_0x31bcbb,_0x4507d4);};}function removeListener(_0x3105dd,_0xd143c){return function(){DashboardEvents[_0x21df('0x4')](_0x3105dd,_0xd143c);};}exports[_0x21df('0x5')]=function(_0x11e49a){for(var _0x2ab7fc=0x0,_0x5f348b=events[_0x21df('0x6')];_0x2ab7fc<_0x5f348b;_0x2ab7fc++){var _0x22ed5c=events[_0x2ab7fc];var _0x5edeef=createListener(_0x21df('0x7')+_0x22ed5c,_0x11e49a);DashboardEvents['on'](_0x22ed5c,_0x5edeef);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4fefabc..9d9b7a9 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x3fe5e0,_0x35e58c){var _0x543577=function(_0x4cc82e){while(--_0x4cc82e){_0x3fe5e0['push'](_0x3fe5e0['shift']());}};_0x543577(++_0x35e58c);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index badd7da..60a33cd 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 _0xebae=['stringify','INTEGER','#2196f3','sequelize','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0xebae,0x10b));var _0xeeba=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0xebae[_0x30e004];return _0x5ca247;};'use strict';var Sequelize=require(_0xeeba('0x0'));var squel=require('squel');var _=require(_0xeeba('0x1'));module[_0xeeba('0x2')]={'title':{'type':Sequelize[_0xeeba('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xeeba('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xeeba('0x4')](_0xeeba('0x5')),'get':function(){try{return JSON[_0xeeba('0x6')](this['getDataValue'](_0xeeba('0x7')));}catch(_0x2bc54b){return[];}},'set':function(_0x1242e2){try{this[_0xeeba('0x8')](_0xeeba('0x7'),JSON[_0xeeba('0x9')](_0x1242e2));}catch(_0x3edc54){this['setDataValue'](_0xeeba('0x7'),JSON[_0xeeba('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeeba('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xeeba('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeeba('0x3')],'allowNull':![],'defaultValue':_0xeeba('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x952f=['setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x335dd4,_0x101b74){var _0x32e79a=function(_0x56ac30){while(--_0x56ac30){_0x335dd4['push'](_0x335dd4['shift']());}};_0x32e79a(++_0x101b74);}(_0x952f,0x1c7));var _0xf952=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x952f[_0x39780c];return _0x53c19b;};'use strict';var Sequelize=require(_0xf952('0x0'));var squel=require(_0xf952('0x1'));var _=require(_0xf952('0x2'));module[_0xf952('0x3')]={'title':{'type':Sequelize[_0xf952('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xf952('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf952('0x5')](_0xf952('0x6')),'get':function(){try{return JSON[_0xf952('0x7')](this[_0xf952('0x8')](_0xf952('0x9')));}catch(_0x217d48){return[];}},'set':function(_0x4943aa){try{this[_0xf952('0xa')](_0xf952('0x9'),JSON[_0xf952('0xb')](_0x4943aa));}catch(_0x288e94){this['setDataValue'](_0xf952('0x9'),JSON[_0xf952('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xf952('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf952('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf952('0xc')]},'col':{'type':Sequelize[_0xf952('0xc')]},'background':{'type':Sequelize[_0xf952('0x4')],'allowNull':![],'defaultValue':_0xf952('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xf952('0x4')],'allowNull':![],'defaultValue':_0xf952('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a9c3fe0..e046976 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 _0x94a4=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','end','offset','limit','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce'];(function(_0x1e003e,_0x43482a){var _0x7eb25=function(_0x2bbc67){while(--_0x2bbc67){_0x1e003e['push'](_0x1e003e['shift']());}};_0x7eb25(++_0x43482a);}(_0x94a4,0xee));var _0x494a=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x94a4[_0x4ae6ef];return _0x3cbb4e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x494a('0x0'));var jsonpatch=require(_0x494a('0x1'));var rp=require(_0x494a('0x2'));var moment=require(_0x494a('0x3'));var BPromise=require(_0x494a('0x4'));var Mustache=require('mustache');var util=require(_0x494a('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x494a('0x6'));var fs=require('fs');var _=require(_0x494a('0x7'));var squel=require(_0x494a('0x8'));var crypto=require(_0x494a('0x9'));var jsforce=require(_0x494a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x494a('0xb'));var querystring=require(_0x494a('0xc'));var Papa=require(_0x494a('0xd'));var Redis=require(_0x494a('0xe'));var authService=require(_0x494a('0xf'));var qs=require(_0x494a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x494a('0x11'));var logger=require(_0x494a('0x12'))('api');var utils=require(_0x494a('0x13'));var config=require(_0x494a('0x14'));var licenseUtil=require(_0x494a('0x15'));var db=require(_0x494a('0x16'))['db'];config[_0x494a('0x17')]=_[_0x494a('0x18')](config['redis'],{'host':_0x494a('0x19'),'port':0x18eb});var socket=require(_0x494a('0x1a'))(new Redis(config['redis']));require(_0x494a('0x1b'))['register'](socket);function respondWithStatusCode(_0x365c26,_0x55864c){_0x55864c=_0x55864c||0xcc;return function(_0x552c20){if(_0x552c20){return _0x365c26['sendStatus'](_0x55864c);}return _0x365c26[_0x494a('0x1c')](_0x55864c)[_0x494a('0x1d')]();};}function respondWithResult(_0x2cc14f,_0x1fbbf4){_0x1fbbf4=_0x1fbbf4||0xc8;return function(_0x294a6d){if(_0x294a6d){return _0x2cc14f[_0x494a('0x1c')](_0x1fbbf4)['json'](_0x294a6d);}};}function respondWithFilteredResult(_0x586845,_0x40fa8b){return function(_0x1ac691){if(_0x1ac691){var _0x1b50d7=_0x1ac691['count'],_0x381703=_0x40fa8b[_0x494a('0x1e')],_0x45d0c7=_0x40fa8b[_0x494a('0x1e')]+_0x40fa8b[_0x494a('0x1f')],_0x56fa97;if(_0x45d0c7>=_0x1b50d7){_0x45d0c7=_0x1b50d7;_0x56fa97=0xc8;}else{_0x56fa97=0xce;}_0x586845[_0x494a('0x1c')](_0x56fa97);return _0x586845[_0x494a('0x20')](_0x494a('0x21'),_0x381703+'-'+_0x45d0c7+'/'+_0x1b50d7)[_0x494a('0x22')](_0x1ac691);}return null;};}function patchUpdates(_0x3ffdfc){return function(_0x2f4e1c){try{jsonpatch['apply'](_0x2f4e1c,_0x3ffdfc,!![]);}catch(_0x12a057){return BPromise[_0x494a('0x23')](_0x12a057);}return _0x2f4e1c[_0x494a('0x24')]();};}function saveUpdates(_0x4fb5c3,_0x106579){return function(_0x5d3ad0){if(_0x5d3ad0){return _0x5d3ad0['update'](_0x4fb5c3)[_0x494a('0x25')](function(_0x286c3f){return _0x286c3f;});}return null;};}function removeEntity(_0x559ab1,_0x408ea6){return function(_0x123b32){if(_0x123b32){return _0x123b32[_0x494a('0x26')]()['then'](function(){_0x559ab1[_0x494a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f372e,_0x56812f){return function(_0x879ae6){if(!_0x879ae6){_0x3f372e[_0x494a('0x27')](0x194);}return _0x879ae6;};}function handleError(_0x23a836,_0x5e5001){_0x5e5001=_0x5e5001||0x1f4;return function(_0x1a4249){logger[_0x494a('0x28')](_0x1a4249['stack']);if(_0x1a4249[_0x494a('0x29')]){delete _0x1a4249[_0x494a('0x29')];}_0x23a836[_0x494a('0x1c')](_0x5e5001)[_0x494a('0x2a')](_0x1a4249);};}exports['show']=function(_0xbbb8e2,_0x317a87){var _0x5ba8db={'raw':![],'where':{'id':_0xbbb8e2[_0x494a('0x2b')]['id']}},_0x42d934={};_0x42d934[_0x494a('0x2c')]=_[_0x494a('0x2d')](db[_0x494a('0x2e')][_0x494a('0x2f')]);_0x42d934[_0x494a('0x30')]=_[_0x494a('0x2d')](_0xbbb8e2[_0x494a('0x30')]);_0x42d934[_0x494a('0x31')]=_[_0x494a('0x32')](_0x42d934['model'],_0x42d934['query']);_0x5ba8db[_0x494a('0x33')]=_[_0x494a('0x32')](_0x42d934[_0x494a('0x2c')],qs[_0x494a('0x34')](_0xbbb8e2[_0x494a('0x30')][_0x494a('0x34')]));_0x5ba8db[_0x494a('0x33')]=_0x5ba8db['attributes'][_0x494a('0x35')]?_0x5ba8db['attributes']:_0x42d934['model'];if(_0xbbb8e2[_0x494a('0x30')][_0x494a('0x36')]){_0x5ba8db['include']=[{'all':!![]}];}_0x5ba8db=_['merge']({},_0x5ba8db,_0xbbb8e2[_0x494a('0x37')]);return db[_0x494a('0x2e')][_0x494a('0x38')](_0x5ba8db)[_0x494a('0x25')](handleEntityNotFound(_0x317a87,null))[_0x494a('0x25')](respondWithResult(_0x317a87,null))[_0x494a('0x39')](handleError(_0x317a87,null));};exports[_0x494a('0x26')]=function(_0x4f1052,_0x4cc9fb){return db[_0x494a('0x2e')][_0x494a('0x38')]({'where':{'id':_0x4f1052[_0x494a('0x2b')]['id']}})[_0x494a('0x25')](handleEntityNotFound(_0x4cc9fb,null))[_0x494a('0x25')](removeEntity(_0x4cc9fb,null))['catch'](handleError(_0x4cc9fb,null));};function widgetAttributes(_0x4f0cae){try{switch(_0x4f0cae[_0x494a('0x3a')]){case _0x494a('0x3b'):return[{'name':_0x494a('0x3c'),'value':_0x4f0cae[_0x494a('0x3c')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x0]?_0x4f0cae['attrs'][0x0][_0x494a('0x3e')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x4f0cae['attrPath']||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x0]?_0x4f0cae['attrs'][0x0][_0x494a('0x3e')]:undefined)||''}];case _0x494a('0x3f'):return[{'name':'attrHourFormat','value':_0x4f0cae[_0x494a('0x40')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x0]?_0x4f0cae['attrs'][0x0]['value']:undefined)||_0x494a('0x41')},{'name':_0x494a('0x42'),'value':_0x4f0cae[_0x494a('0x42')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x1]?_0x4f0cae[_0x494a('0x3d')][0x1][_0x494a('0x3e')]:undefined)||_0x494a('0x43')},{'name':'attrFontSize','value':_0x4f0cae[_0x494a('0x44')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x2]?_0x4f0cae[_0x494a('0x3d')][0x2][_0x494a('0x3e')]:undefined)||0xc}];case _0x494a('0x45'):return[{'name':_0x494a('0x46'),'value':_0x4f0cae[_0x494a('0x46')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x0]?_0x4f0cae[_0x494a('0x3d')][0x0][_0x494a('0x3e')]:undefined)||_0x494a('0x47')},{'name':'attrVoiceQueues','value':_0x4f0cae[_0x494a('0x48')]||(_0x4f0cae['attrs']&&_0x4f0cae[_0x494a('0x3d')][0x1]?_0x4f0cae['attrs'][0x1][_0x494a('0x3e')]:undefined)||[]},{'name':_0x494a('0x44'),'value':_0x4f0cae['attrFontSize']||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x2]?_0x4f0cae[_0x494a('0x3d')][0x2][_0x494a('0x3e')]:undefined)||0x14}];case _0x494a('0x49'):case'pie-chart':return[{'name':_0x494a('0x4a'),'value':_0x4f0cae[_0x494a('0x4a')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x0]?_0x4f0cae[_0x494a('0x3d')][0x0][_0x494a('0x3e')]:undefined)||'total'},{'name':_0x494a('0x4b'),'value':_0x4f0cae[_0x494a('0x4b')]||(_0x4f0cae['attrs']&&_0x4f0cae[_0x494a('0x3d')][0x1]?_0x4f0cae[_0x494a('0x3d')][0x1]['value']:undefined)||null},{'name':_0x494a('0x4c'),'value':_0x4f0cae[_0x494a('0x4c')]||(_0x4f0cae['attrs']&&_0x4f0cae[_0x494a('0x3d')][0x2]?_0x4f0cae[_0x494a('0x3d')][0x2]['value']:undefined)||null},{'name':_0x494a('0x48'),'value':_0x4f0cae[_0x494a('0x48')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae['attrs'][0x3]?_0x4f0cae[_0x494a('0x3d')][0x3][_0x494a('0x3e')]:undefined)||[]}];case'web-report':return[{'name':_0x494a('0x4d'),'type':_0x4f0cae['reportType']||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x0]?_0x4f0cae[_0x494a('0x3d')][0x0][_0x494a('0x3a')]:undefined)||null,'value':_0x4f0cae[_0x494a('0x4d')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae['attrs'][0x0]?_0x4f0cae[_0x494a('0x3d')][0x0][_0x494a('0x3e')]:undefined)||null},{'name':_0x494a('0x4e'),'value':_0x4f0cae[_0x494a('0x4e')]||(_0x4f0cae[_0x494a('0x3d')]&&_0x4f0cae[_0x494a('0x3d')][0x1]?_0x4f0cae[_0x494a('0x3d')][0x1][_0x494a('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x1fd4c8){logger[_0x494a('0x28')](_0x494a('0x4f'),JSON['stringify'](_0x1fd4c8));return[];}}exports[_0x494a('0x50')]=function(_0x514a1a,_0x5c78dc){if(_0x514a1a[_0x494a('0x51')]){_0x514a1a['body'][_0x494a('0x3d')]=widgetAttributes(_0x514a1a[_0x494a('0x51')]);}return db[_0x494a('0x2e')][_0x494a('0x50')](_0x514a1a['body'],{})[_0x494a('0x25')](respondWithResult(_0x5c78dc,0xc9))['catch'](handleError(_0x5c78dc,null));};exports[_0x494a('0x52')]=function(_0x51c665,_0x207215){if(_0x51c665[_0x494a('0x51')]['id']){delete _0x51c665[_0x494a('0x51')]['id'];}_0x51c665['body']['attrs']=widgetAttributes(_0x51c665[_0x494a('0x51')]);return db[_0x494a('0x2e')][_0x494a('0x38')]({'where':{'id':_0x51c665['params']['id']}})[_0x494a('0x25')](handleEntityNotFound(_0x207215,null))['then'](saveUpdates(_0x51c665[_0x494a('0x51')],null))[_0x494a('0x25')](respondWithResult(_0x207215,null))[_0x494a('0x39')](handleError(_0x207215,null));}; \ No newline at end of file +var _0xc64c=['options','DashboardItem','find','catch','type','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrReport','stringify','body','create','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','merge'];(function(_0x326211,_0x233dc9){var _0x58c209=function(_0x1d21c5){while(--_0x1d21c5){_0x326211['push'](_0x326211['shift']());}};_0x58c209(++_0x233dc9);}(_0xc64c,0x11e));var _0xcc64=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc64c[_0x7e2eb0];return _0xd92de4;};'use strict';var pdf=require(_0xcc64('0x0'));var emlformat=require(_0xcc64('0x1'));var rimraf=require(_0xcc64('0x2'));var zipdir=require(_0xcc64('0x3'));var jsonpatch=require(_0xcc64('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc64('0x5'));var util=require(_0xcc64('0x6'));var path=require(_0xcc64('0x7'));var sox=require(_0xcc64('0x8'));var csv=require(_0xcc64('0x9'));var ejs=require(_0xcc64('0xa'));var fs=require('fs');var _=require(_0xcc64('0xb'));var squel=require(_0xcc64('0xc'));var crypto=require(_0xcc64('0xd'));var jsforce=require(_0xcc64('0xe'));var deskjs=require(_0xcc64('0xf'));var toCsv=require(_0xcc64('0x9'));var querystring=require(_0xcc64('0x10'));var Papa=require(_0xcc64('0x11'));var Redis=require(_0xcc64('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcc64('0x13'));var as=require(_0xcc64('0x14'));var hardwareService=require(_0xcc64('0x15'));var logger=require(_0xcc64('0x16'))('api');var utils=require(_0xcc64('0x17'));var config=require(_0xcc64('0x18'));var licenseUtil=require(_0xcc64('0x19'));var db=require('../../mysqldb')['db'];config[_0xcc64('0x1a')]=_['defaults'](config['redis'],{'host':_0xcc64('0x1b'),'port':0x18eb});var socket=require(_0xcc64('0x1c'))(new Redis(config[_0xcc64('0x1a')]));require(_0xcc64('0x1d'))[_0xcc64('0x1e')](socket);function respondWithStatusCode(_0x46d400,_0x3a25d4){_0x3a25d4=_0x3a25d4||0xcc;return function(_0x3aa1d8){if(_0x3aa1d8){return _0x46d400[_0xcc64('0x1f')](_0x3a25d4);}return _0x46d400['status'](_0x3a25d4)['end']();};}function respondWithResult(_0x2767f7,_0x3272dd){_0x3272dd=_0x3272dd||0xc8;return function(_0x3ae3f1){if(_0x3ae3f1){return _0x2767f7[_0xcc64('0x20')](_0x3272dd)[_0xcc64('0x21')](_0x3ae3f1);}};}function respondWithFilteredResult(_0x305ec0,_0x1ad566){return function(_0x4a62af){if(_0x4a62af){var _0x112016=_0x4a62af['count'],_0x232b30=_0x1ad566['offset'],_0x522e82=_0x1ad566[_0xcc64('0x22')]+_0x1ad566[_0xcc64('0x23')],_0x554ea3;if(_0x522e82>=_0x112016){_0x522e82=_0x112016;_0x554ea3=0xc8;}else{_0x554ea3=0xce;}_0x305ec0['status'](_0x554ea3);return _0x305ec0[_0xcc64('0x24')](_0xcc64('0x25'),_0x232b30+'-'+_0x522e82+'/'+_0x112016)[_0xcc64('0x21')](_0x4a62af);}return null;};}function patchUpdates(_0x4b5ef8){return function(_0x499765){try{jsonpatch['apply'](_0x499765,_0x4b5ef8,!![]);}catch(_0xee60b3){return BPromise[_0xcc64('0x26')](_0xee60b3);}return _0x499765[_0xcc64('0x27')]();};}function saveUpdates(_0x2e4a07,_0xdbe364){return function(_0x41f068){if(_0x41f068){return _0x41f068[_0xcc64('0x28')](_0x2e4a07)[_0xcc64('0x29')](function(_0x297b04){return _0x297b04;});}return null;};}function removeEntity(_0x25ec51,_0x3c227e){return function(_0x2ca4fb){if(_0x2ca4fb){return _0x2ca4fb['destroy']()[_0xcc64('0x29')](function(){_0x25ec51[_0xcc64('0x20')](0xcc)[_0xcc64('0x2a')]();});}};}function handleEntityNotFound(_0x5cf608,_0x25cc29){return function(_0x7fccb7){if(!_0x7fccb7){_0x5cf608[_0xcc64('0x1f')](0x194);}return _0x7fccb7;};}function handleError(_0x4f1699,_0x5a03b1){_0x5a03b1=_0x5a03b1||0x1f4;return function(_0x575a87){logger[_0xcc64('0x2b')](_0x575a87[_0xcc64('0x2c')]);if(_0x575a87[_0xcc64('0x2d')]){delete _0x575a87[_0xcc64('0x2d')];}_0x4f1699[_0xcc64('0x20')](_0x5a03b1)[_0xcc64('0x2e')](_0x575a87);};}exports[_0xcc64('0x2f')]=function(_0x31d88e,_0xf5e777){var _0x4d4998={'raw':![],'where':{'id':_0x31d88e[_0xcc64('0x30')]['id']}},_0x4359ee={};_0x4359ee[_0xcc64('0x31')]=_[_0xcc64('0x32')](db['DashboardItem']['rawAttributes']);_0x4359ee[_0xcc64('0x33')]=_['keys'](_0x31d88e[_0xcc64('0x33')]);_0x4359ee['filters']=_[_0xcc64('0x34')](_0x4359ee[_0xcc64('0x31')],_0x4359ee['query']);_0x4d4998['attributes']=_[_0xcc64('0x34')](_0x4359ee[_0xcc64('0x31')],qs[_0xcc64('0x35')](_0x31d88e[_0xcc64('0x33')][_0xcc64('0x35')]));_0x4d4998[_0xcc64('0x36')]=_0x4d4998[_0xcc64('0x36')][_0xcc64('0x37')]?_0x4d4998[_0xcc64('0x36')]:_0x4359ee[_0xcc64('0x31')];if(_0x31d88e[_0xcc64('0x33')][_0xcc64('0x38')]){_0x4d4998['include']=[{'all':!![]}];}_0x4d4998=_[_0xcc64('0x39')]({},_0x4d4998,_0x31d88e[_0xcc64('0x3a')]);return db[_0xcc64('0x3b')]['find'](_0x4d4998)['then'](handleEntityNotFound(_0xf5e777,null))[_0xcc64('0x29')](respondWithResult(_0xf5e777,null))['catch'](handleError(_0xf5e777,null));};exports['destroy']=function(_0x12b20c,_0x4396c0){return db['DashboardItem'][_0xcc64('0x3c')]({'where':{'id':_0x12b20c[_0xcc64('0x30')]['id']}})[_0xcc64('0x29')](handleEntityNotFound(_0x4396c0,null))[_0xcc64('0x29')](removeEntity(_0x4396c0,null))[_0xcc64('0x3d')](handleError(_0x4396c0,null));};function widgetAttributes(_0x17253a){try{switch(_0x17253a[_0xcc64('0x3e')]){case'iframe':return[{'name':'attrUrl','value':_0x17253a[_0xcc64('0x3f')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x0]?_0x17253a['attrs'][0x0][_0xcc64('0x41')]:undefined)||_0xcc64('0x42')}];case _0xcc64('0x43'):return[{'name':'attrPath','value':_0x17253a['attrPath']||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x0]?_0x17253a['attrs'][0x0]['value']:undefined)||''}];case _0xcc64('0x44'):return[{'name':'attrHourFormat','value':_0x17253a[_0xcc64('0x45')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a['attrs'][0x0]?_0x17253a[_0xcc64('0x40')][0x0][_0xcc64('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xcc64('0x46'),'value':_0x17253a['attrTimezone']||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x1]?_0x17253a[_0xcc64('0x40')][0x1][_0xcc64('0x41')]:undefined)||_0xcc64('0x47')},{'name':_0xcc64('0x48'),'value':_0x17253a[_0xcc64('0x48')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x2]?_0x17253a[_0xcc64('0x40')][0x2][_0xcc64('0x41')]:undefined)||0xc}];case _0xcc64('0x49'):return[{'name':_0xcc64('0x4a'),'value':_0x17253a[_0xcc64('0x4a')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x0]?_0x17253a[_0xcc64('0x40')][0x0][_0xcc64('0x41')]:undefined)||_0xcc64('0x4b')},{'name':_0xcc64('0x4c'),'value':_0x17253a['attrVoiceQueues']||(_0x17253a[_0xcc64('0x40')]&&_0x17253a['attrs'][0x1]?_0x17253a[_0xcc64('0x40')][0x1][_0xcc64('0x41')]:undefined)||[]},{'name':_0xcc64('0x48'),'value':_0x17253a['attrFontSize']||(_0x17253a[_0xcc64('0x40')]&&_0x17253a['attrs'][0x2]?_0x17253a[_0xcc64('0x40')][0x2][_0xcc64('0x41')]:undefined)||0x14}];case'multibar-chart':case _0xcc64('0x4d'):return[{'name':_0xcc64('0x4e'),'value':_0x17253a[_0xcc64('0x4e')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x0]?_0x17253a['attrs'][0x0][_0xcc64('0x41')]:undefined)||_0xcc64('0x4b')},{'name':'attrSerie2','value':_0x17253a['attrSerie2']||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x1]?_0x17253a[_0xcc64('0x40')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x17253a[_0xcc64('0x4f')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x2]?_0x17253a[_0xcc64('0x40')][0x2]['value']:undefined)||null},{'name':_0xcc64('0x4c'),'value':_0x17253a[_0xcc64('0x4c')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x3]?_0x17253a[_0xcc64('0x40')][0x3]['value']:undefined)||[]}];case _0xcc64('0x50'):return[{'name':'attrReport','type':_0x17253a[_0xcc64('0x51')]||(_0x17253a['attrs']&&_0x17253a[_0xcc64('0x40')][0x0]?_0x17253a[_0xcc64('0x40')][0x0][_0xcc64('0x3e')]:undefined)||null,'value':_0x17253a[_0xcc64('0x52')]||(_0x17253a[_0xcc64('0x40')]&&_0x17253a[_0xcc64('0x40')][0x0]?_0x17253a[_0xcc64('0x40')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x17253a['attrRefresh']||(_0x17253a[_0xcc64('0x40')]&&_0x17253a['attrs'][0x1]?_0x17253a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5e984f){logger[_0xcc64('0x2b')]('widgetAttributes:\x20%s',JSON[_0xcc64('0x53')](_0x5e984f));return[];}}exports['create']=function(_0xfdba09,_0xd18674){if(_0xfdba09['body']){_0xfdba09[_0xcc64('0x54')][_0xcc64('0x40')]=widgetAttributes(_0xfdba09[_0xcc64('0x54')]);}return db['DashboardItem'][_0xcc64('0x55')](_0xfdba09[_0xcc64('0x54')],{})[_0xcc64('0x29')](respondWithResult(_0xd18674,0xc9))['catch'](handleError(_0xd18674,null));};exports['update']=function(_0x376aea,_0xfa4183){if(_0x376aea[_0xcc64('0x54')]['id']){delete _0x376aea[_0xcc64('0x54')]['id'];}_0x376aea[_0xcc64('0x54')][_0xcc64('0x40')]=widgetAttributes(_0x376aea[_0xcc64('0x54')]);return db[_0xcc64('0x3b')][_0xcc64('0x3c')]({'where':{'id':_0x376aea['params']['id']}})[_0xcc64('0x29')](handleEntityNotFound(_0xfa4183,null))[_0xcc64('0x29')](saveUpdates(_0x376aea['body'],null))['then'](respondWithResult(_0xfa4183,null))[_0xcc64('0x3d')](handleError(_0xfa4183,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 368fc57..be65f29 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 _0xf01c=['exports','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x26caff,_0x6c2d7a){var _0x413bac=function(_0x5f31d3){while(--_0x5f31d3){_0x26caff['push'](_0x26caff['shift']());}};_0x413bac(++_0x6c2d7a);}(_0xf01c,0x157));var _0xcf01=function(_0x12392c,_0x2f004f){_0x12392c=_0x12392c-0x0;var _0x2875f3=_0xf01c[_0x12392c];return _0x2875f3;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xcf01('0x0'))['db'][_0xcf01('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcf01('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf01('0x3'),'afterDestroy':_0xcf01('0x4')};function emitEvent(_0x34c8fa){return function(_0x2ab4d2,_0x2881ad,_0x20ae09){DashboardItemEvents['emit'](_0x34c8fa+':'+_0x2ab4d2['id'],_0x2ab4d2);DashboardItemEvents[_0xcf01('0x5')](_0x34c8fa,_0x2ab4d2);_0x20ae09(null);};}for(var e in events){if(events[_0xcf01('0x6')](e)){var event=events[e];DashboardItem[_0xcf01('0x7')](e,emitEvent(event));}}module[_0xcf01('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x9d73=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0xd2667d,_0x3d8fdf){var _0x3a9133=function(_0x2289e4){while(--_0x2289e4){_0xd2667d['push'](_0xd2667d['shift']());}};_0x3a9133(++_0x3d8fdf);}(_0x9d73,0x1ef));var _0x39d7=function(_0x3ace4f,_0x52e778){_0x3ace4f=_0x3ace4f-0x0;var _0x46002c=_0x9d73[_0x3ace4f];return _0x46002c;};'use strict';var EventEmitter=require(_0x39d7('0x0'));var DashboardItem=require(_0x39d7('0x1'))['db'][_0x39d7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x39d7('0x3')](0x0);var events={'afterCreate':_0x39d7('0x4'),'afterUpdate':_0x39d7('0x5'),'afterDestroy':_0x39d7('0x6')};function emitEvent(_0x45974b){return function(_0x4aa5aa,_0xa40de5,_0x1cb188){DashboardItemEvents['emit'](_0x45974b+':'+_0x4aa5aa['id'],_0x4aa5aa);DashboardItemEvents[_0x39d7('0x7')](_0x45974b,_0x4aa5aa);_0x1cb188(null);};}for(var e in events){if(events[_0x39d7('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x39d7('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 08fbf84..6b617cc 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 _0xbca7=['define','DashboardItem','dashboard_items','lodash','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbca7,0x179));var _0x7bca=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xbca7[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7bca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7bca('0x1'));var moment=require(_0x7bca('0x2'));var BPromise=require(_0x7bca('0x3'));var rp=require(_0x7bca('0x4'));var fs=require('fs');var path=require(_0x7bca('0x5'));var rimraf=require(_0x7bca('0x6'));var config=require('../../config/environment');var attributes=require(_0x7bca('0x7'));module['exports']=function(_0x3b12ef,_0xeeaac7){return _0x3b12ef[_0x7bca('0x8')](_0x7bca('0x9'),attributes,{'tableName':_0x7bca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1aa=['bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','util','../../config/logger','api','moment'];(function(_0x571840,_0x43897e){var _0x1915d7=function(_0x2dafd1){while(--_0x2dafd1){_0x571840['push'](_0x571840['shift']());}};_0x1915d7(++_0x43897e);}(_0xd1aa,0x1ca));var _0xad1a=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0xd1aa[_0x199b1f];return _0x267ac9;};'use strict';var _=require('lodash');var util=require(_0xad1a('0x0'));var logger=require(_0xad1a('0x1'))(_0xad1a('0x2'));var moment=require(_0xad1a('0x3'));var BPromise=require(_0xad1a('0x4'));var rp=require(_0xad1a('0x5'));var fs=require('fs');var path=require(_0xad1a('0x6'));var rimraf=require('rimraf');var config=require(_0xad1a('0x7'));var attributes=require(_0xad1a('0x8'));module['exports']=function(_0x181f77,_0x263c19){return _0x181f77['define'](_0xad1a('0x9'),attributes,{'tableName':_0xad1a('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 189fa7c..2178f0d 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 _0x064f=['client','redis','defaults','localhost','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x064f,0xfa));var _0xf064=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x064f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xf064('0x0'));var util=require(_0xf064('0x1'));var moment=require('moment');var BPromise=require(_0xf064('0x2'));var rs=require(_0xf064('0x3'));var fs=require('fs');var Redis=require(_0xf064('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf064('0x5'));var logger=require(_0xf064('0x6'))(_0xf064('0x7'));var config=require(_0xf064('0x8'));var jayson=require(_0xf064('0x9'));var client=jayson[_0xf064('0xa')]['http']({'port':0x232a});config[_0xf064('0xb')]=_[_0xf064('0xc')](config[_0xf064('0xb')],{'host':_0xf064('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf064('0xb')]));require(_0xf064('0xe'))[_0xf064('0xf')](socket);function respondWithRpcPromise(_0x236f22,_0x50b84f,_0x5e1b2e){return new BPromise(function(_0x2cb44b,_0x4855e6){return client[_0xf064('0x10')](_0x236f22,_0x5e1b2e)[_0xf064('0x11')](function(_0x50e8e1){logger['info'](_0xf064('0x12'),_0x50b84f,'request\x20sent');logger['debug'](_0xf064('0x13'),_0x50b84f,_0xf064('0x14'),JSON['stringify'](_0x50e8e1));if(_0x50e8e1[_0xf064('0x15')]){if(_0x50e8e1[_0xf064('0x15')][_0xf064('0x16')]===0x1f4){logger[_0xf064('0x15')]('DashboardItem,\x20%s,\x20%s',_0x50b84f,_0x50e8e1['error'][_0xf064('0x17')]);return _0x4855e6(_0x50e8e1[_0xf064('0x15')][_0xf064('0x17')]);}logger[_0xf064('0x15')](_0xf064('0x12'),_0x50b84f,_0x50e8e1[_0xf064('0x15')]['message']);return _0x2cb44b(_0x50e8e1[_0xf064('0x15')][_0xf064('0x17')]);}else{logger[_0xf064('0x18')]('DashboardItem,\x20%s,\x20%s',_0x50b84f,_0xf064('0x14'));_0x2cb44b(_0x50e8e1['result'][_0xf064('0x17')]);}})[_0xf064('0x19')](function(_0x48ca78){logger[_0xf064('0x15')]('DashboardItem,\x20%s,\x20%s',_0x50b84f,_0x48ca78);_0x4855e6(_0x48ca78);});});} \ No newline at end of file +var _0x1e9a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','moment','bluebird'];(function(_0x242d4a,_0x91bd8){var _0x7999e6=function(_0x3d1d54){while(--_0x3d1d54){_0x242d4a['push'](_0x242d4a['shift']());}};_0x7999e6(++_0x91bd8);}(_0x1e9a,0x1b7));var _0xa1e9=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x1e9a[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xa1e9('0x0'));var util=require('util');var moment=require(_0xa1e9('0x1'));var BPromise=require(_0xa1e9('0x2'));var rs=require(_0xa1e9('0x3'));var fs=require('fs');var Redis=require(_0xa1e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1e9('0x5'));var logger=require(_0xa1e9('0x6'))(_0xa1e9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1e9('0x8'));var client=jayson[_0xa1e9('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa1e9('0xa')](config[_0xa1e9('0xb')],{'host':_0xa1e9('0xc'),'port':0x18eb});var socket=require(_0xa1e9('0xd'))(new Redis(config['redis']));require(_0xa1e9('0xe'))[_0xa1e9('0xf')](socket);function respondWithRpcPromise(_0x5f04b4,_0x13d06f,_0x2d2eeb){return new BPromise(function(_0x3398c3,_0xee5dc8){return client[_0xa1e9('0x10')](_0x5f04b4,_0x2d2eeb)[_0xa1e9('0x11')](function(_0x19df1f){logger['info'](_0xa1e9('0x12'),_0x13d06f,_0xa1e9('0x13'));logger[_0xa1e9('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x13d06f,_0xa1e9('0x13'),JSON[_0xa1e9('0x15')](_0x19df1f));if(_0x19df1f[_0xa1e9('0x16')]){if(_0x19df1f[_0xa1e9('0x16')][_0xa1e9('0x17')]===0x1f4){logger[_0xa1e9('0x16')](_0xa1e9('0x12'),_0x13d06f,_0x19df1f[_0xa1e9('0x16')][_0xa1e9('0x18')]);return _0xee5dc8(_0x19df1f['error']['message']);}logger[_0xa1e9('0x16')](_0xa1e9('0x12'),_0x13d06f,_0x19df1f[_0xa1e9('0x16')][_0xa1e9('0x18')]);return _0x3398c3(_0x19df1f['error'][_0xa1e9('0x18')]);}else{logger[_0xa1e9('0x19')]('DashboardItem,\x20%s,\x20%s',_0x13d06f,'request\x20sent');_0x3398c3(_0x19df1f['result'][_0xa1e9('0x18')]);}})['catch'](function(_0x5b4f00){logger['error'](_0xa1e9('0x12'),_0x13d06f,_0x5b4f00);_0xee5dc8(_0x5b4f00);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 414f982..1047233 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 _0xb312=['update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x218385,_0x6e7d09){var _0x3f3162=function(_0x341969){while(--_0x341969){_0x218385['push'](_0x218385['shift']());}};_0x3f3162(++_0x6e7d09);}(_0xb312,0x65));var _0x2b31=function(_0x33d2e6,_0x157859){_0x33d2e6=_0x33d2e6-0x0;var _0x12d808=_0xb312[_0x33d2e6];return _0x12d808;};'use strict';var DashboardItemEvents=require(_0x2b31('0x0'));var events=[_0x2b31('0x1'),_0x2b31('0x2'),_0x2b31('0x3')];function createListener(_0x5a9da2,_0x3a147c){return function(_0x2d690a){_0x3a147c[_0x2b31('0x4')](_0x5a9da2,_0x2d690a);};}function removeListener(_0x23849c,_0x1df158){return function(){DashboardItemEvents[_0x2b31('0x5')](_0x23849c,_0x1df158);};}exports['register']=function(_0x186816){for(var _0x1bc12e=0x0,_0x1c0f59=events[_0x2b31('0x6')];_0x1bc12e<_0x1c0f59;_0x1bc12e++){var _0x494dee=events[_0x1bc12e];var _0x5288fc=createListener(_0x2b31('0x7')+_0x494dee,_0x186816);DashboardItemEvents['on'](_0x494dee,_0x5288fc);}}; \ No newline at end of file +var _0xc938=['dashboardItem:','./dashboardItem.events','save','update','emit','removeListener','register'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0xc938,0x190));var _0x8c93=function(_0x6f0410,_0x519540){_0x6f0410=_0x6f0410-0x0;var _0x2847f0=_0xc938[_0x6f0410];return _0x2847f0;};'use strict';var DashboardItemEvents=require(_0x8c93('0x0'));var events=[_0x8c93('0x1'),'remove',_0x8c93('0x2')];function createListener(_0x425d03,_0x4321ba){return function(_0x106594){_0x4321ba[_0x8c93('0x3')](_0x425d03,_0x106594);};}function removeListener(_0x457e18,_0xe7e924){return function(){DashboardItemEvents[_0x8c93('0x4')](_0x457e18,_0xe7e924);};}exports[_0x8c93('0x5')]=function(_0x13bb98){for(var _0x36d271=0x0,_0x5a50cc=events['length'];_0x36d271<_0x5a50cc;_0x36d271++){var _0x1721a8=events[_0x36d271];var _0x49e300=createListener(_0x8c93('0x6')+_0x1721a8,_0x13bb98);DashboardItemEvents['on'](_0x1721a8,_0x49e300);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 62e0ef5..f147d2b 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 _0x326f=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post'];(function(_0x9a4a34,_0x5550e1){var _0x9be0e1=function(_0x15102d){while(--_0x15102d){_0x9a4a34['push'](_0x9a4a34['shift']());}};_0x9be0e1(++_0x5550e1);}(_0x326f,0xd1));var _0xf326=function(_0x5dd9d9,_0xa21869){_0x5dd9d9=_0x5dd9d9-0x0;var _0x4638bb=_0x326f[_0x5dd9d9];return _0x4638bb;};'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 auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller['show']);router[_0xf326('0xb')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf326('0xe')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);module[_0xf326('0x10')]=router; \ No newline at end of file +var _0x1cb9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path'];(function(_0x278864,_0x52533e){var _0x2d05ac=function(_0x47eb02){while(--_0x47eb02){_0x278864['push'](_0x278864['shift']());}};_0x2d05ac(++_0x52533e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x17103c,_0x4c66d9){_0x17103c=_0x17103c-0x0;var _0x2e2e68=_0x1cb9[_0x17103c];return _0x2e2e68;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./dashboardItem.controller');router[_0x91cb('0x7')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x9')](),controller['create']);router[_0x91cb('0xc')]('/:id',auth[_0x91cb('0x9')](),controller['update']);router[_0x91cb('0xd')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xe')]);module[_0x91cb('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 68d1aaa..3cb9c24 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 _0x88c7=['third','sequelize','exports','STRING','ENUM','second'];(function(_0x2ec536,_0x20bf87){var _0x122df3=function(_0x520c46){while(--_0x520c46){_0x2ec536['push'](_0x2ec536['shift']());}};_0x122df3(++_0x20bf87);}(_0x88c7,0x16f));var _0x788c=function(_0x3556d8,_0x3526ef){_0x3556d8=_0x3556d8-0x0;var _0x392edb=_0x88c7[_0x3556d8];return _0x392edb;};'use strict';var Sequelize=require(_0x788c('0x0'));module[_0x788c('0x1')]={'name':{'type':Sequelize[_0x788c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x788c('0x3')]('first',_0x788c('0x4'),_0x788c('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x788c('0x2')]}}; \ No newline at end of file +var _0xed98=['third','first','sequelize','exports','STRING','ENUM','second'];(function(_0x4cf61c,_0x5ce95c){var _0x16ef44=function(_0x46ae0f){while(--_0x46ae0f){_0x4cf61c['push'](_0x4cf61c['shift']());}};_0x16ef44(++_0x5ce95c);}(_0xed98,0x6b));var _0x8ed9=function(_0x1f64a6,_0x2a6c65){_0x1f64a6=_0x1f64a6-0x0;var _0x333938=_0xed98[_0x1f64a6];return _0x333938;};'use strict';var Sequelize=require(_0x8ed9('0x0'));module[_0x8ed9('0x1')]={'name':{'type':Sequelize[_0x8ed9('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8ed9('0x3')]('first',_0x8ed9('0x4'),_0x8ed9('0x5')),'allowNull':![],'defaultValue':_0x8ed9('0x6')},'description':{'type':Sequelize[_0x8ed9('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b18c41f..0b630e8 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 _0x9e2e=['body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Disposition','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','include','merge','options','create','user','role','Dispositions','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x9e2e,0x1db));var _0xe9e2=function(_0x2c17aa,_0x34c6de){_0x2c17aa=_0x2c17aa-0x0;var _0x15e203=_0x9e2e[_0x2c17aa];return _0x15e203;};'use strict';var pdf=require(_0xe9e2('0x0'));var emlformat=require(_0xe9e2('0x1'));var rimraf=require(_0xe9e2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe9e2('0x3'));var moment=require(_0xe9e2('0x4'));var BPromise=require(_0xe9e2('0x5'));var Mustache=require(_0xe9e2('0x6'));var util=require(_0xe9e2('0x7'));var path=require(_0xe9e2('0x8'));var sox=require(_0xe9e2('0x9'));var csv=require(_0xe9e2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe9e2('0xb'));var crypto=require('crypto');var jsforce=require(_0xe9e2('0xc'));var deskjs=require(_0xe9e2('0xd'));var toCsv=require(_0xe9e2('0xa'));var querystring=require(_0xe9e2('0xe'));var Papa=require('papaparse');var Redis=require(_0xe9e2('0xf'));var authService=require(_0xe9e2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe9e2('0x11'));var hardwareService=require(_0xe9e2('0x12'));var logger=require(_0xe9e2('0x13'))('api');var utils=require(_0xe9e2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe9e2('0x15'));var db=require(_0xe9e2('0x16'))['db'];function respondWithStatusCode(_0x2cdd07,_0x6cd206){_0x6cd206=_0x6cd206||0xcc;return function(_0x30da3d){if(_0x30da3d){return _0x2cdd07['sendStatus'](_0x6cd206);}return _0x2cdd07[_0xe9e2('0x17')](_0x6cd206)[_0xe9e2('0x18')]();};}function respondWithResult(_0x34f87c,_0x24f60b){_0x24f60b=_0x24f60b||0xc8;return function(_0x21c89b){if(_0x21c89b){return _0x34f87c['status'](_0x24f60b)[_0xe9e2('0x19')](_0x21c89b);}};}function respondWithFilteredResult(_0xfae283,_0x42a5c8){return function(_0x14eb2b){if(_0x14eb2b){var _0x355bde=_0x14eb2b[_0xe9e2('0x1a')],_0x5c11d8=_0x42a5c8[_0xe9e2('0x1b')],_0x430180=_0x42a5c8[_0xe9e2('0x1b')]+_0x42a5c8[_0xe9e2('0x1c')],_0x299d4b;if(_0x430180>=_0x355bde){_0x430180=_0x355bde;_0x299d4b=0xc8;}else{_0x299d4b=0xce;}_0xfae283[_0xe9e2('0x17')](_0x299d4b);return _0xfae283[_0xe9e2('0x1d')]('Content-Range',_0x5c11d8+'-'+_0x430180+'/'+_0x355bde)['json'](_0x14eb2b);}return null;};}function patchUpdates(_0x5a17e0){return function(_0x14186f){try{jsonpatch[_0xe9e2('0x1e')](_0x14186f,_0x5a17e0,!![]);}catch(_0xaa1f63){return BPromise[_0xe9e2('0x1f')](_0xaa1f63);}return _0x14186f['save']();};}function saveUpdates(_0x52aec2,_0x146720){return function(_0x4b79d6){if(_0x4b79d6){return _0x4b79d6[_0xe9e2('0x20')](_0x52aec2)[_0xe9e2('0x21')](function(_0x51aecd){return _0x51aecd;});}return null;};}function removeEntity(_0xb37bbb,_0x33707b){return function(_0x4508e5){if(_0x4508e5){return _0x4508e5[_0xe9e2('0x22')]()[_0xe9e2('0x21')](function(){var _0x381f6f=_0x4508e5[_0xe9e2('0x23')]({'plain':!![]});var _0x4d785e='Dispositions';return db[_0xe9e2('0x24')]['destroy']({'where':{'type':_0x4d785e,'resourceId':_0x381f6f['id']}})[_0xe9e2('0x21')](function(){return _0x4508e5;});})['then'](function(){_0xb37bbb[_0xe9e2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0a30,_0x5015bc){return function(_0x5c800e){if(!_0x5c800e){_0x2d0a30['sendStatus'](0x194);}return _0x5c800e;};}function handleError(_0x457907,_0x37fe75){_0x37fe75=_0x37fe75||0x1f4;return function(_0x2486a2){logger[_0xe9e2('0x25')](_0x2486a2[_0xe9e2('0x26')]);if(_0x2486a2[_0xe9e2('0x27')]){delete _0x2486a2[_0xe9e2('0x27')];}_0x457907[_0xe9e2('0x17')](_0x37fe75)[_0xe9e2('0x28')](_0x2486a2);};}exports[_0xe9e2('0x29')]=function(_0x1ea834,_0x5c9a70){var _0x5e254b={},_0x299356={},_0x2a2dd4={'count':0x0,'rows':[]};var _0x44299e=_[_0xe9e2('0x2a')](db[_0xe9e2('0x2b')]['rawAttributes'],function(_0xbdc22d){return{'name':_0xbdc22d[_0xe9e2('0x2c')],'type':_0xbdc22d[_0xe9e2('0x2d')]['key']};});_0x299356[_0xe9e2('0x2e')]=_[_0xe9e2('0x2a')](_0x44299e,_0xe9e2('0x27'));_0x299356[_0xe9e2('0x2f')]=_[_0xe9e2('0x30')](_0x1ea834[_0xe9e2('0x2f')]);_0x299356[_0xe9e2('0x31')]=_[_0xe9e2('0x32')](_0x299356[_0xe9e2('0x2e')],_0x299356[_0xe9e2('0x2f')]);_0x5e254b['attributes']=_[_0xe9e2('0x32')](_0x299356[_0xe9e2('0x2e')],qs['fields'](_0x1ea834['query'][_0xe9e2('0x33')]));_0x5e254b['attributes']=_0x5e254b[_0xe9e2('0x34')][_0xe9e2('0x35')]?_0x5e254b[_0xe9e2('0x34')]:_0x299356[_0xe9e2('0x2e')];if(!_0x1ea834[_0xe9e2('0x2f')][_0xe9e2('0x36')](_0xe9e2('0x37'))){_0x5e254b[_0xe9e2('0x1c')]=qs[_0xe9e2('0x1c')](_0x1ea834[_0xe9e2('0x2f')][_0xe9e2('0x1c')]);_0x5e254b[_0xe9e2('0x1b')]=qs['offset'](_0x1ea834[_0xe9e2('0x2f')][_0xe9e2('0x1b')]);}_0x5e254b['order']=qs[_0xe9e2('0x38')](_0x1ea834['query'][_0xe9e2('0x38')]);_0x5e254b[_0xe9e2('0x39')]=qs[_0xe9e2('0x31')](_[_0xe9e2('0x3a')](_0x1ea834[_0xe9e2('0x2f')],_0x299356['filters']),_0x44299e);if(_0x1ea834[_0xe9e2('0x2f')][_0xe9e2('0x3b')]){_0x5e254b['where']=_['merge'](_0x5e254b['where'],{'$or':_[_0xe9e2('0x2a')](_0x44299e,function(_0x520778){if(_0x520778[_0xe9e2('0x2d')]!==_0xe9e2('0x3c')){var _0x28deb9={};_0x28deb9[_0x520778[_0xe9e2('0x27')]]={'$like':'%'+_0x1ea834['query'][_0xe9e2('0x3b')]+'%'};return _0x28deb9;}})});}_0x5e254b=_['merge']({},_0x5e254b,_0x1ea834['options']);var _0x3b91e8={'where':_0x5e254b[_0xe9e2('0x39')]};return db[_0xe9e2('0x2b')][_0xe9e2('0x1a')](_0x3b91e8)['then'](function(_0x4d4c93){_0x2a2dd4['count']=_0x4d4c93;if(_0x1ea834[_0xe9e2('0x2f')][_0xe9e2('0x3d')]){_0x5e254b['include']=[{'all':!![]}];}return db['Disposition'][_0xe9e2('0x3e')](_0x5e254b);})[_0xe9e2('0x21')](function(_0x3d3f6f){_0x2a2dd4[_0xe9e2('0x3f')]=_0x3d3f6f;return _0x2a2dd4;})[_0xe9e2('0x21')](respondWithFilteredResult(_0x5c9a70,_0x5e254b))[_0xe9e2('0x40')](handleError(_0x5c9a70,null));};exports['show']=function(_0xc8275d,_0x66fef3){var _0x9ac648={'raw':!![],'where':{'id':_0xc8275d[_0xe9e2('0x41')]['id']}},_0x22c3c4={};_0x22c3c4[_0xe9e2('0x2e')]=_[_0xe9e2('0x30')](db['Disposition'][_0xe9e2('0x42')]);_0x22c3c4[_0xe9e2('0x2f')]=_[_0xe9e2('0x30')](_0xc8275d['query']);_0x22c3c4[_0xe9e2('0x31')]=_[_0xe9e2('0x32')](_0x22c3c4['model'],_0x22c3c4[_0xe9e2('0x2f')]);_0x9ac648[_0xe9e2('0x34')]=_[_0xe9e2('0x32')](_0x22c3c4[_0xe9e2('0x2e')],qs['fields'](_0xc8275d[_0xe9e2('0x2f')][_0xe9e2('0x33')]));_0x9ac648[_0xe9e2('0x34')]=_0x9ac648[_0xe9e2('0x34')][_0xe9e2('0x35')]?_0x9ac648['attributes']:_0x22c3c4[_0xe9e2('0x2e')];if(_0xc8275d[_0xe9e2('0x2f')][_0xe9e2('0x3d')]){_0x9ac648[_0xe9e2('0x43')]=[{'all':!![]}];}_0x9ac648=_[_0xe9e2('0x44')]({},_0x9ac648,_0xc8275d[_0xe9e2('0x45')]);return db[_0xe9e2('0x2b')]['find'](_0x9ac648)[_0xe9e2('0x21')](handleEntityNotFound(_0x66fef3,null))[_0xe9e2('0x21')](respondWithResult(_0x66fef3,null))[_0xe9e2('0x40')](handleError(_0x66fef3,null));};exports[_0xe9e2('0x46')]=function(_0x257ce3,_0x48506e){return db['Disposition'][_0xe9e2('0x46')](_0x257ce3['body'],{})[_0xe9e2('0x21')](function(_0x4272e6){var _0x1e2b5c=_0x257ce3[_0xe9e2('0x47')][_0xe9e2('0x23')]({'plain':!![]});if(!_0x1e2b5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e2b5c[_0xe9e2('0x48')]===_0xe9e2('0x47')){var _0x41c5b4=_0x4272e6[_0xe9e2('0x23')]({'plain':!![]});var _0x4ce722=_0xe9e2('0x49');return db[_0xe9e2('0x4a')][_0xe9e2('0x4b')]({'where':{'name':_0x4ce722,'userProfileId':_0x1e2b5c['userProfileId']},'raw':!![]})['then'](function(_0x2a6d2b){if(_0x2a6d2b&&_0x2a6d2b[_0xe9e2('0x4c')]===0x0){return db[_0xe9e2('0x24')]['create']({'name':_0x41c5b4[_0xe9e2('0x27')],'resourceId':_0x41c5b4['id'],'type':_0x2a6d2b['name'],'sectionId':_0x2a6d2b['id']},{})[_0xe9e2('0x21')](function(){return _0x4272e6;});}else{return _0x4272e6;}})[_0xe9e2('0x40')](function(_0x40cd5b){logger[_0xe9e2('0x25')](_0xe9e2('0x4d'),_0x40cd5b);throw _0x40cd5b;});}return _0x4272e6;})[_0xe9e2('0x21')](respondWithResult(_0x48506e,0xc9))[_0xe9e2('0x40')](handleError(_0x48506e,null));};exports[_0xe9e2('0x20')]=function(_0x31586f,_0x16512f){if(_0x31586f[_0xe9e2('0x4e')]['id']){delete _0x31586f[_0xe9e2('0x4e')]['id'];}return db[_0xe9e2('0x2b')]['find']({'where':{'id':_0x31586f[_0xe9e2('0x41')]['id']}})[_0xe9e2('0x21')](handleEntityNotFound(_0x16512f,null))[_0xe9e2('0x21')](saveUpdates(_0x31586f[_0xe9e2('0x4e')],null))['then'](respondWithResult(_0x16512f,null))[_0xe9e2('0x40')](handleError(_0x16512f,null));};exports[_0xe9e2('0x22')]=function(_0x4b968d,_0xe550e0){return db[_0xe9e2('0x2b')][_0xe9e2('0x4b')]({'where':{'id':_0x4b968d[_0xe9e2('0x41')]['id']}})[_0xe9e2('0x21')](handleEntityNotFound(_0xe550e0,null))[_0xe9e2('0x21')](removeEntity(_0xe550e0,null))[_0xe9e2('0x40')](handleError(_0xe550e0,null));}; \ No newline at end of file +var _0x51f2=['create','body','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find'];(function(_0x42976c,_0x48d1d1){var _0x4b7c5e=function(_0x278578){while(--_0x278578){_0x42976c['push'](_0x42976c['shift']());}};_0x4b7c5e(++_0x48d1d1);}(_0x51f2,0x102));var _0x251f=function(_0xb87014,_0x524eaa){_0xb87014=_0xb87014-0x0;var _0x1f0cc7=_0x51f2[_0xb87014];return _0x1f0cc7;};'use strict';var pdf=require(_0x251f('0x0'));var emlformat=require(_0x251f('0x1'));var rimraf=require(_0x251f('0x2'));var zipdir=require(_0x251f('0x3'));var jsonpatch=require(_0x251f('0x4'));var rp=require(_0x251f('0x5'));var moment=require(_0x251f('0x6'));var BPromise=require(_0x251f('0x7'));var Mustache=require(_0x251f('0x8'));var util=require(_0x251f('0x9'));var path=require(_0x251f('0xa'));var sox=require(_0x251f('0xb'));var csv=require('to-csv');var ejs=require(_0x251f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x251f('0xd'));var jsforce=require(_0x251f('0xe'));var deskjs=require(_0x251f('0xf'));var toCsv=require(_0x251f('0x10'));var querystring=require(_0x251f('0x11'));var Papa=require(_0x251f('0x12'));var Redis=require(_0x251f('0x13'));var authService=require(_0x251f('0x14'));var qs=require(_0x251f('0x15'));var as=require(_0x251f('0x16'));var hardwareService=require(_0x251f('0x17'));var logger=require(_0x251f('0x18'))(_0x251f('0x19'));var utils=require(_0x251f('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x251f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c2a92,_0x14d90d){_0x14d90d=_0x14d90d||0xcc;return function(_0x1c8487){if(_0x1c8487){return _0x1c2a92[_0x251f('0x1c')](_0x14d90d);}return _0x1c2a92[_0x251f('0x1d')](_0x14d90d)[_0x251f('0x1e')]();};}function respondWithResult(_0x158baa,_0x30efba){_0x30efba=_0x30efba||0xc8;return function(_0x190839){if(_0x190839){return _0x158baa['status'](_0x30efba)[_0x251f('0x1f')](_0x190839);}};}function respondWithFilteredResult(_0x403261,_0x4b9e77){return function(_0x4420b7){if(_0x4420b7){var _0x4cd874=_0x4420b7[_0x251f('0x20')],_0x513e7c=_0x4b9e77[_0x251f('0x21')],_0x41068f=_0x4b9e77['offset']+_0x4b9e77[_0x251f('0x22')],_0x34a61b;if(_0x41068f>=_0x4cd874){_0x41068f=_0x4cd874;_0x34a61b=0xc8;}else{_0x34a61b=0xce;}_0x403261['status'](_0x34a61b);return _0x403261[_0x251f('0x23')]('Content-Range',_0x513e7c+'-'+_0x41068f+'/'+_0x4cd874)[_0x251f('0x1f')](_0x4420b7);}return null;};}function patchUpdates(_0x4d940b){return function(_0x59f322){try{jsonpatch[_0x251f('0x24')](_0x59f322,_0x4d940b,!![]);}catch(_0x33c76a){return BPromise[_0x251f('0x25')](_0x33c76a);}return _0x59f322[_0x251f('0x26')]();};}function saveUpdates(_0x1708b0,_0x23ed88){return function(_0x419377){if(_0x419377){return _0x419377[_0x251f('0x27')](_0x1708b0)[_0x251f('0x28')](function(_0x33d208){return _0x33d208;});}return null;};}function removeEntity(_0x40b65f,_0x497a71){return function(_0x497a34){if(_0x497a34){return _0x497a34[_0x251f('0x29')]()[_0x251f('0x28')](function(){var _0x329681=_0x497a34['get']({'plain':!![]});var _0x5a2ccc=_0x251f('0x2a');return db[_0x251f('0x2b')][_0x251f('0x29')]({'where':{'type':_0x5a2ccc,'resourceId':_0x329681['id']}})[_0x251f('0x28')](function(){return _0x497a34;});})['then'](function(){_0x40b65f[_0x251f('0x1d')](0xcc)[_0x251f('0x1e')]();});}};}function handleEntityNotFound(_0x1d7591,_0x5b2cd3){return function(_0x2b448b){if(!_0x2b448b){_0x1d7591[_0x251f('0x1c')](0x194);}return _0x2b448b;};}function handleError(_0x51409b,_0x36c5d9){_0x36c5d9=_0x36c5d9||0x1f4;return function(_0x527174){logger[_0x251f('0x2c')](_0x527174[_0x251f('0x2d')]);if(_0x527174['name']){delete _0x527174[_0x251f('0x2e')];}_0x51409b[_0x251f('0x1d')](_0x36c5d9)[_0x251f('0x2f')](_0x527174);};}exports[_0x251f('0x30')]=function(_0x14465c,_0x18910b){var _0x4e30f2={},_0x4c30a2={},_0x3b1ad6={'count':0x0,'rows':[]};var _0x3bf35d=_[_0x251f('0x31')](db[_0x251f('0x32')][_0x251f('0x33')],function(_0x125f0c){return{'name':_0x125f0c[_0x251f('0x34')],'type':_0x125f0c[_0x251f('0x35')][_0x251f('0x36')]};});_0x4c30a2[_0x251f('0x37')]=_[_0x251f('0x31')](_0x3bf35d,_0x251f('0x2e'));_0x4c30a2['query']=_[_0x251f('0x38')](_0x14465c[_0x251f('0x39')]);_0x4c30a2[_0x251f('0x3a')]=_['intersection'](_0x4c30a2[_0x251f('0x37')],_0x4c30a2[_0x251f('0x39')]);_0x4e30f2[_0x251f('0x3b')]=_[_0x251f('0x3c')](_0x4c30a2[_0x251f('0x37')],qs[_0x251f('0x3d')](_0x14465c['query']['fields']));_0x4e30f2['attributes']=_0x4e30f2[_0x251f('0x3b')][_0x251f('0x3e')]?_0x4e30f2['attributes']:_0x4c30a2[_0x251f('0x37')];if(!_0x14465c[_0x251f('0x39')][_0x251f('0x3f')]('nolimit')){_0x4e30f2[_0x251f('0x22')]=qs['limit'](_0x14465c[_0x251f('0x39')][_0x251f('0x22')]);_0x4e30f2['offset']=qs['offset'](_0x14465c[_0x251f('0x39')][_0x251f('0x21')]);}_0x4e30f2['order']=qs[_0x251f('0x40')](_0x14465c['query'][_0x251f('0x40')]);_0x4e30f2['where']=qs[_0x251f('0x3a')](_['pick'](_0x14465c[_0x251f('0x39')],_0x4c30a2[_0x251f('0x3a')]),_0x3bf35d);if(_0x14465c['query'][_0x251f('0x41')]){_0x4e30f2['where']=_[_0x251f('0x42')](_0x4e30f2[_0x251f('0x43')],{'$or':_[_0x251f('0x31')](_0x3bf35d,function(_0x5a01a2){if(_0x5a01a2[_0x251f('0x35')]!==_0x251f('0x44')){var _0x4f5a6d={};_0x4f5a6d[_0x5a01a2[_0x251f('0x2e')]]={'$like':'%'+_0x14465c[_0x251f('0x39')]['filter']+'%'};return _0x4f5a6d;}})});}_0x4e30f2=_[_0x251f('0x42')]({},_0x4e30f2,_0x14465c['options']);var _0x10a057={'where':_0x4e30f2['where']};return db[_0x251f('0x32')][_0x251f('0x20')](_0x10a057)[_0x251f('0x28')](function(_0x42713e){_0x3b1ad6[_0x251f('0x20')]=_0x42713e;if(_0x14465c['query'][_0x251f('0x45')]){_0x4e30f2[_0x251f('0x46')]=[{'all':!![]}];}return db[_0x251f('0x32')][_0x251f('0x47')](_0x4e30f2);})['then'](function(_0x33377c){_0x3b1ad6[_0x251f('0x48')]=_0x33377c;return _0x3b1ad6;})[_0x251f('0x28')](respondWithFilteredResult(_0x18910b,_0x4e30f2))[_0x251f('0x49')](handleError(_0x18910b,null));};exports[_0x251f('0x4a')]=function(_0x44cf75,_0x1b5122){var _0x59ab05={'raw':!![],'where':{'id':_0x44cf75[_0x251f('0x4b')]['id']}},_0x38982c={};_0x38982c[_0x251f('0x37')]=_['keys'](db['Disposition'][_0x251f('0x33')]);_0x38982c['query']=_['keys'](_0x44cf75[_0x251f('0x39')]);_0x38982c[_0x251f('0x3a')]=_[_0x251f('0x3c')](_0x38982c[_0x251f('0x37')],_0x38982c[_0x251f('0x39')]);_0x59ab05[_0x251f('0x3b')]=_[_0x251f('0x3c')](_0x38982c[_0x251f('0x37')],qs[_0x251f('0x3d')](_0x44cf75[_0x251f('0x39')]['fields']));_0x59ab05[_0x251f('0x3b')]=_0x59ab05[_0x251f('0x3b')][_0x251f('0x3e')]?_0x59ab05[_0x251f('0x3b')]:_0x38982c[_0x251f('0x37')];if(_0x44cf75[_0x251f('0x39')][_0x251f('0x45')]){_0x59ab05['include']=[{'all':!![]}];}_0x59ab05=_[_0x251f('0x42')]({},_0x59ab05,_0x44cf75[_0x251f('0x4c')]);return db[_0x251f('0x32')][_0x251f('0x4d')](_0x59ab05)['then'](handleEntityNotFound(_0x1b5122,null))[_0x251f('0x28')](respondWithResult(_0x1b5122,null))['catch'](handleError(_0x1b5122,null));};exports[_0x251f('0x4e')]=function(_0xf93813,_0x485737){return db[_0x251f('0x32')][_0x251f('0x4e')](_0xf93813[_0x251f('0x4f')],{})[_0x251f('0x28')](function(_0x4b4c0c){var _0x507710=_0xf93813['user']['get']({'plain':!![]});if(!_0x507710)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x507710['role']===_0x251f('0x50')){var _0x13d378=_0x4b4c0c[_0x251f('0x51')]({'plain':!![]});var _0x3c64be=_0x251f('0x2a');return db['UserProfileSection'][_0x251f('0x4d')]({'where':{'name':_0x3c64be,'userProfileId':_0x507710[_0x251f('0x52')]},'raw':!![]})[_0x251f('0x28')](function(_0x4215f4){if(_0x4215f4&&_0x4215f4['autoAssociation']===0x0){return db[_0x251f('0x2b')][_0x251f('0x4e')]({'name':_0x13d378[_0x251f('0x2e')],'resourceId':_0x13d378['id'],'type':_0x4215f4['name'],'sectionId':_0x4215f4['id']},{})[_0x251f('0x28')](function(){return _0x4b4c0c;});}else{return _0x4b4c0c;}})['catch'](function(_0x5d76f3){logger[_0x251f('0x2c')](_0x251f('0x53'),_0x5d76f3);throw _0x5d76f3;});}return _0x4b4c0c;})[_0x251f('0x28')](respondWithResult(_0x485737,0xc9))[_0x251f('0x49')](handleError(_0x485737,null));};exports[_0x251f('0x27')]=function(_0x3beb16,_0x1705ff){if(_0x3beb16['body']['id']){delete _0x3beb16[_0x251f('0x4f')]['id'];}return db[_0x251f('0x32')]['find']({'where':{'id':_0x3beb16[_0x251f('0x4b')]['id']}})[_0x251f('0x28')](handleEntityNotFound(_0x1705ff,null))['then'](saveUpdates(_0x3beb16[_0x251f('0x4f')],null))[_0x251f('0x28')](respondWithResult(_0x1705ff,null))[_0x251f('0x49')](handleError(_0x1705ff,null));};exports[_0x251f('0x29')]=function(_0x473b74,_0x28da92){return db[_0x251f('0x32')][_0x251f('0x4d')]({'where':{'id':_0x473b74[_0x251f('0x4b')]['id']}})[_0x251f('0x28')](handleEntityNotFound(_0x28da92,null))[_0x251f('0x28')](removeEntity(_0x28da92,null))[_0x251f('0x49')](handleError(_0x28da92,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7203a42..abc2571 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 _0xe132=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe132,0x162));var _0x2e13=function(_0x2630b3,_0x5f1eee){_0x2630b3=_0x2630b3-0x0;var _0x5f15ae=_0xe132[_0x2630b3];return _0x5f15ae;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2e13('0xb'),'fields':[_0x2e13('0xc'),_0x2e13('0xd')]},{'unique':!![],'name':_0x2e13('0xe'),'fields':[_0x2e13('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x2e13('0xf'),'fields':[_0x2e13('0xc'),_0x2e13('0x10')]},{'unique':!![],'name':_0x2e13('0x11'),'fields':[_0x2e13('0xc'),_0x2e13('0x12')]},{'unique':!![],'name':_0x2e13('0x13'),'fields':['name',_0x2e13('0x14')]},{'unique':!![],'name':_0x2e13('0x15'),'fields':[_0x2e13('0xc'),_0x2e13('0x16')]},{'unique':!![],'name':_0x2e13('0x17'),'fields':[_0x2e13('0xc'),_0x2e13('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49fe=['path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','name_voice','name','ListId','name_chat','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','../../config/logger','bluebird'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x49fe,0x100));var _0xe49f=function(_0x499dc5,_0x52f05d){_0x499dc5=_0x499dc5-0x0;var _0x1fd5ba=_0x49fe[_0x499dc5];return _0x1fd5ba;};'use strict';var _=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var logger=require(_0xe49f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe49f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe49f('0x4'));var rimraf=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var attributes=require(_0xe49f('0x7'));module['exports']=function(_0x20633a,_0x51fe70){return _0x20633a[_0xe49f('0x8')](_0xe49f('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xe49f('0xa'),'fields':[_0xe49f('0xb'),_0xe49f('0xc')]},{'unique':!![],'name':_0xe49f('0xd'),'fields':[_0xe49f('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xe49f('0xb'),_0xe49f('0xe')]},{'unique':!![],'name':'name_sms','fields':['name',_0xe49f('0xf')]},{'unique':!![],'name':_0xe49f('0x10'),'fields':[_0xe49f('0xb'),_0xe49f('0x11')]},{'unique':!![],'name':_0xe49f('0x12'),'fields':[_0xe49f('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xe49f('0xb'),_0xe49f('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index fcbc020..fdfff5d 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 _0x04bd=['request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','Disposition,\x20%s,\x20%s','debug'];(function(_0x3e36b6,_0x43de3b){var _0x4a3a36=function(_0x13f6a0){while(--_0x13f6a0){_0x3e36b6['push'](_0x3e36b6['shift']());}};_0x4a3a36(++_0x43de3b);}(_0x04bd,0x195));var _0xd04b=function(_0x3a1323,_0xa09950){_0x3a1323=_0x3a1323-0x0;var _0x3f3616=_0x04bd[_0x3a1323];return _0x3f3616;};'use strict';var _=require(_0xd04b('0x0'));var util=require(_0xd04b('0x1'));var moment=require('moment');var BPromise=require(_0xd04b('0x2'));var rs=require(_0xd04b('0x3'));var fs=require('fs');var Redis=require(_0xd04b('0x4'));var db=require(_0xd04b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd04b('0x6'))('rpc');var config=require(_0xd04b('0x7'));var jayson=require(_0xd04b('0x8'));var client=jayson['client'][_0xd04b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34d94e,_0x504449,_0x4da65d){return new BPromise(function(_0x3a3e11,_0x48083b){return client['request'](_0x34d94e,_0x4da65d)['then'](function(_0x55dc37){logger[_0xd04b('0xa')](_0xd04b('0xb'),_0x504449,'request\x20sent');logger[_0xd04b('0xc')]('Disposition,\x20%s,\x20%s,\x20%s',_0x504449,_0xd04b('0xd'),JSON[_0xd04b('0xe')](_0x55dc37));if(_0x55dc37[_0xd04b('0xf')]){if(_0x55dc37[_0xd04b('0xf')][_0xd04b('0x10')]===0x1f4){logger[_0xd04b('0xf')](_0xd04b('0xb'),_0x504449,_0x55dc37[_0xd04b('0xf')][_0xd04b('0x11')]);return _0x48083b(_0x55dc37['error'][_0xd04b('0x11')]);}logger[_0xd04b('0xf')]('Disposition,\x20%s,\x20%s',_0x504449,_0x55dc37[_0xd04b('0xf')][_0xd04b('0x11')]);return _0x3a3e11(_0x55dc37[_0xd04b('0xf')][_0xd04b('0x11')]);}else{logger[_0xd04b('0xa')](_0xd04b('0xb'),_0x504449,_0xd04b('0xd'));_0x3a3e11(_0x55dc37['result']['message']);}})[_0xd04b('0x12')](function(_0x402108){logger[_0xd04b('0xf')](_0xd04b('0xb'),_0x504449,_0x402108);_0x48083b(_0x402108);});});} \ No newline at end of file +var _0x6573=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment'];(function(_0xfb0f30,_0x531a40){var _0x13bf38=function(_0x43ea7f){while(--_0x43ea7f){_0xfb0f30['push'](_0xfb0f30['shift']());}};_0x13bf38(++_0x531a40);}(_0x6573,0x138));var _0x3657=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6573[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3657('0x0'));var util=require(_0x3657('0x1'));var moment=require(_0x3657('0x2'));var BPromise=require('bluebird');var rs=require(_0x3657('0x3'));var fs=require('fs');var Redis=require(_0x3657('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3657('0x5'));var logger=require(_0x3657('0x6'))(_0x3657('0x7'));var config=require(_0x3657('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3657('0x9')][_0x3657('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aee61,_0x48ee95,_0x35c4f7){return new BPromise(function(_0x1446a6,_0x2c6ef9){return client[_0x3657('0xb')](_0x4aee61,_0x35c4f7)[_0x3657('0xc')](function(_0x453423){logger[_0x3657('0xd')](_0x3657('0xe'),_0x48ee95,'request\x20sent');logger[_0x3657('0xf')](_0x3657('0x10'),_0x48ee95,'request\x20sent',JSON['stringify'](_0x453423));if(_0x453423['error']){if(_0x453423[_0x3657('0x11')]['code']===0x1f4){logger[_0x3657('0x11')](_0x3657('0xe'),_0x48ee95,_0x453423[_0x3657('0x11')][_0x3657('0x12')]);return _0x2c6ef9(_0x453423[_0x3657('0x11')][_0x3657('0x12')]);}logger[_0x3657('0x11')](_0x3657('0xe'),_0x48ee95,_0x453423[_0x3657('0x11')]['message']);return _0x1446a6(_0x453423['error'][_0x3657('0x12')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x48ee95,_0x3657('0x13'));_0x1446a6(_0x453423['result'][_0x3657('0x12')]);}})[_0x3657('0x14')](function(_0x47abe1){logger['error']('Disposition,\x20%s,\x20%s',_0x48ee95,_0x47abe1);_0x2c6ef9(_0x47abe1);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index d5b2ccb..0e302c7 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 _0x7158=['../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x2db695,_0x59af41){var _0x54518e=function(_0x1d6191){while(--_0x1d6191){_0x2db695['push'](_0x2db695['shift']());}};_0x54518e(++_0x59af41);}(_0x7158,0xfa));var _0x8715=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x7158[_0x151418];return _0x40e29a;};'use strict';var multer=require(_0x8715('0x0'));var util=require(_0x8715('0x1'));var path=require('path');var timeout=require(_0x8715('0x2'));var express=require(_0x8715('0x3'));var router=express[_0x8715('0x4')]();var auth=require(_0x8715('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8715('0x6'));var controller=require(_0x8715('0x7'));router[_0x8715('0x8')]('/',auth[_0x8715('0x9')](),controller[_0x8715('0xa')]);router['get'](_0x8715('0xb'),auth[_0x8715('0x9')](),controller[_0x8715('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8715('0xd')]);router[_0x8715('0xe')](_0x8715('0xb'),auth[_0x8715('0x9')](),controller[_0x8715('0xf')]);router[_0x8715('0x10')](_0x8715('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd940=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','/:id','show','put','update'];(function(_0x3f7171,_0x515c21){var _0x4a6f16=function(_0x48790f){while(--_0x48790f){_0x3f7171['push'](_0x3f7171['shift']());}};_0x4a6f16(++_0x515c21);}(_0xd940,0xff));var _0x0d94=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0xd940[_0xf2662b];return _0x257dc7;};'use strict';var multer=require(_0x0d94('0x0'));var util=require(_0x0d94('0x1'));var path=require(_0x0d94('0x2'));var timeout=require(_0x0d94('0x3'));var express=require('express');var router=express[_0x0d94('0x4')]();var auth=require(_0x0d94('0x5'));var interaction=require(_0x0d94('0x6'));var config=require(_0x0d94('0x7'));var controller=require(_0x0d94('0x8'));router['get']('/',auth[_0x0d94('0x9')](),controller[_0x0d94('0xa')]);router['get'](_0x0d94('0xb'),auth[_0x0d94('0x9')](),controller[_0x0d94('0xc')]);router['post']('/',auth[_0x0d94('0x9')](),controller['create']);router[_0x0d94('0xd')](_0x0d94('0xb'),auth[_0x0d94('0x9')](),controller[_0x0d94('0xe')]);router[_0x0d94('0xf')](_0x0d94('0xb'),auth['isAuthenticated'](),controller[_0x0d94('0x10')]);module[_0x0d94('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 087d22a..195d00d 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 _0x4fe6=['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','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','12000','7200','9600','14400','INTEGER','SIP'];(function(_0x2f8b0f,_0x2654eb){var _0x384196=function(_0x5a7991){while(--_0x5a7991){_0x2f8b0f['push'](_0x2f8b0f['shift']());}};_0x384196(++_0x2654eb);}(_0x4fe6,0x143));var _0x64fe=function(_0x260cdb,_0x34fd75){_0x260cdb=_0x260cdb-0x0;var _0x2c11bf=_0x4fe6[_0x260cdb];return _0x2c11bf;};'use strict';var Sequelize=require(_0x64fe('0x0'));module[_0x64fe('0x1')]={'name':{'type':Sequelize[_0x64fe('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x64fe('0x2')]},'ecm':{'type':Sequelize[_0x64fe('0x3')](_0x64fe('0x4'),'no'),'defaultValue':_0x64fe('0x4')},'headerinfo':{'type':Sequelize[_0x64fe('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x64fe('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x64fe('0x3')](_0x64fe('0x5'),_0x64fe('0x6'),'7200','9600',_0x64fe('0x7'),'14400'),'defaultValue':_0x64fe('0x6')},'maxrate':{'type':Sequelize[_0x64fe('0x3')](_0x64fe('0x5'),_0x64fe('0x6'),_0x64fe('0x8'),_0x64fe('0x9'),_0x64fe('0x7'),'14400'),'defaultValue':_0x64fe('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x64fe('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x64fe('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x64fe('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x64fe('0x3')](_0x64fe('0xc'),'IAX',_0x64fe('0xd'),_0x64fe('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x64fe('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x64fe('0xf')],'defaultValue':function(){return _0x64fe('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x64fe('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x64fe('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x64fe('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x64fe('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x64fe('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x64fe('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x64fe('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x64fe('0x11')],'defaultValue':![],'comment':_0x64fe('0x13'),'set':function(_0x41f11a){if(!_0x41f11a)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x64fe('0x14'),_0x41f11a);}}}; \ No newline at end of file +var _0x7e5d=['KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI'];(function(_0x53a167,_0x4bf6c7){var _0x150263=function(_0x422191){while(--_0x422191){_0x53a167['push'](_0x53a167['shift']());}};_0x150263(++_0x4bf6c7);}(_0x7e5d,0x17f));var _0xd7e5=function(_0x5cf42f,_0x120a24){_0x5cf42f=_0x5cf42f-0x0;var _0x4fe6f6=_0x7e5d[_0x5cf42f];return _0x4fe6f6;};'use strict';var Sequelize=require('sequelize');module[_0xd7e5('0x0')]={'name':{'type':Sequelize[_0xd7e5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xd7e5('0x2')]('yes','no'),'defaultValue':_0xd7e5('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xd7e5('0x4')},'localstationid':{'type':Sequelize[_0xd7e5('0x1')],'unique':_0xd7e5('0x5')},'minrate':{'type':Sequelize[_0xd7e5('0x2')](_0xd7e5('0x6'),_0xd7e5('0x7'),_0xd7e5('0x8'),_0xd7e5('0x9'),_0xd7e5('0xa'),_0xd7e5('0xb')),'defaultValue':_0xd7e5('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xd7e5('0x7'),_0xd7e5('0x8'),_0xd7e5('0x9'),_0xd7e5('0xa'),_0xd7e5('0xb')),'defaultValue':_0xd7e5('0xb')},'modem':{'type':Sequelize[_0xd7e5('0x1')],'defaultValue':_0xd7e5('0xc')},'gateway':{'type':Sequelize[_0xd7e5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd7e5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd7e5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd7e5('0x2')](_0xd7e5('0xe'),_0xd7e5('0xf'),_0xd7e5('0x10'),_0xd7e5('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xd7e5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd7e5('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd7e5('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd7e5('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd7e5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd7e5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd7e5('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd7e5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd7e5('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xd7e5('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xd7e5('0x13')],'defaultValue':![],'comment':_0xd7e5('0x15'),'set':function(_0xba7376){if(!_0xba7376)this[_0xd7e5('0x16')](_0xd7e5('0x17'),null);this[_0xd7e5('0x16')](_0xd7e5('0x18'),_0xba7376);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 6d6cafb..d1a1c87 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 _0x7fec=['show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','pick','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','get','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','FaxAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows'];(function(_0x4a7e74,_0x79de87){var _0x27e787=function(_0x1c61c8){while(--_0x1c61c8){_0x4a7e74['push'](_0x4a7e74['shift']());}};_0x27e787(++_0x79de87);}(_0x7fec,0x6e));var _0xc7fe=function(_0xc60b90,_0x4370b8){_0xc60b90=_0xc60b90-0x0;var _0x3a4aa1=_0x7fec[_0xc60b90];return _0x3a4aa1;};'use strict';var pdf=require(_0xc7fe('0x0'));var emlformat=require(_0xc7fe('0x1'));var rimraf=require(_0xc7fe('0x2'));var zipdir=require(_0xc7fe('0x3'));var jsonpatch=require(_0xc7fe('0x4'));var rp=require(_0xc7fe('0x5'));var moment=require(_0xc7fe('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc7fe('0x7'));var util=require('util');var path=require(_0xc7fe('0x8'));var sox=require(_0xc7fe('0x9'));var csv=require(_0xc7fe('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc7fe('0xb'));var crypto=require(_0xc7fe('0xc'));var jsforce=require(_0xc7fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc7fe('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc7fe('0xe'));var authService=require(_0xc7fe('0xf'));var qs=require(_0xc7fe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7fe('0x11'));var logger=require('../../config/logger')(_0xc7fe('0x12'));var utils=require(_0xc7fe('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc7fe('0x14'))['db'];config['redis']=_[_0xc7fe('0x15')](config[_0xc7fe('0x16')],{'host':_0xc7fe('0x17'),'port':0x18eb});var socket=require(_0xc7fe('0x18'))(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);var jayson=require(_0xc7fe('0x19'));var client=jayson[_0xc7fe('0x1a')][_0xc7fe('0x1b')]({'port':0x232c});var client9002=jayson[_0xc7fe('0x1a')][_0xc7fe('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x353241,_0x388118,_0x8bc322,_0x52638f){return new BPromise(function(_0x57f40c,_0x4cab90){var _0x97c3ee=_0x52638f||client;return _0x97c3ee[_0xc7fe('0x1c')](_0x353241,_0x8bc322)[_0xc7fe('0x1d')](function(_0x14a3c7){logger[_0xc7fe('0x1e')](_0xc7fe('0x1f'),_0x388118,_0xc7fe('0x20'));logger['debug'](_0xc7fe('0x21'),_0x388118,'request\x20sent',JSON['stringify'](_0x14a3c7));if(_0x14a3c7[_0xc7fe('0x22')]){if(_0x14a3c7[_0xc7fe('0x22')][_0xc7fe('0x23')]===0x1f4){logger[_0xc7fe('0x22')](_0xc7fe('0x1f'),_0x388118,_0x14a3c7[_0xc7fe('0x22')][_0xc7fe('0x24')]);return _0x4cab90(_0x14a3c7[_0xc7fe('0x22')][_0xc7fe('0x24')]);}logger[_0xc7fe('0x22')]('FaxAccount,\x20%s,\x20%s',_0x388118,_0x14a3c7[_0xc7fe('0x22')][_0xc7fe('0x24')]);return _0x57f40c(_0x14a3c7['error'][_0xc7fe('0x24')]);}else{logger['info'](_0xc7fe('0x1f'),_0x388118,_0xc7fe('0x20'));_0x57f40c(_0x14a3c7[_0xc7fe('0x25')][_0xc7fe('0x24')]);}})[_0xc7fe('0x26')](function(_0x49927a){logger[_0xc7fe('0x22')](_0xc7fe('0x1f'),_0x388118,_0x49927a);_0x4cab90(_0x49927a);});});}function respondWithStatusCode(_0x1f3b30,_0x4842ce){_0x4842ce=_0x4842ce||0xcc;return function(_0x3cf61c){if(_0x3cf61c){return _0x1f3b30[_0xc7fe('0x27')](_0x4842ce);}return _0x1f3b30[_0xc7fe('0x28')](_0x4842ce)[_0xc7fe('0x29')]();};}function respondWithResult(_0x89594a,_0x6bb212){_0x6bb212=_0x6bb212||0xc8;return function(_0x425f40){if(_0x425f40){return _0x89594a[_0xc7fe('0x28')](_0x6bb212)['json'](_0x425f40);}};}function respondWithFilteredResult(_0x3e8767,_0x17f304){return function(_0x58fd1b){if(_0x58fd1b){var _0x390d86=_0x58fd1b[_0xc7fe('0x2a')],_0x587a18=_0x17f304[_0xc7fe('0x2b')],_0x51f07d=_0x17f304[_0xc7fe('0x2b')]+_0x17f304[_0xc7fe('0x2c')],_0x4f1aa1;if(_0x51f07d>=_0x390d86){_0x51f07d=_0x390d86;_0x4f1aa1=0xc8;}else{_0x4f1aa1=0xce;}_0x3e8767[_0xc7fe('0x28')](_0x4f1aa1);return _0x3e8767[_0xc7fe('0x2d')](_0xc7fe('0x2e'),_0x587a18+'-'+_0x51f07d+'/'+_0x390d86)[_0xc7fe('0x2f')](_0x58fd1b);}return null;};}function patchUpdates(_0x197d2e){return function(_0x349f55){try{jsonpatch[_0xc7fe('0x30')](_0x349f55,_0x197d2e,!![]);}catch(_0x40b0c7){return BPromise[_0xc7fe('0x31')](_0x40b0c7);}return _0x349f55[_0xc7fe('0x32')]();};}function saveUpdates(_0x1d22b0,_0x54abae){return function(_0x2d665f){if(_0x2d665f){return _0x2d665f[_0xc7fe('0x33')](_0x1d22b0)['then'](function(_0x36fc09){return _0x36fc09;});}return null;};}function removeEntity(_0x521f77,_0x39c2ae){return function(_0xef38e6){if(_0xef38e6){return _0xef38e6[_0xc7fe('0x34')]()['then'](function(){var _0x502a42=_0xef38e6['get']({'plain':!![]});var _0x1d042a=_0xc7fe('0x35');return db['UserProfileResource'][_0xc7fe('0x34')]({'where':{'type':_0x1d042a,'resourceId':_0x502a42['id']}})[_0xc7fe('0x1d')](function(){return _0xef38e6;});})[_0xc7fe('0x1d')](function(){_0x521f77[_0xc7fe('0x28')](0xcc)[_0xc7fe('0x29')]();});}};}function handleEntityNotFound(_0x5d6d0f,_0x54a85b){return function(_0x9e0e3c){if(!_0x9e0e3c){_0x5d6d0f['sendStatus'](0x194);}return _0x9e0e3c;};}function handleError(_0x582fd6,_0x533da4){_0x533da4=_0x533da4||0x1f4;return function(_0x24b40e){logger[_0xc7fe('0x22')](_0x24b40e[_0xc7fe('0x36')]);if(_0x24b40e[_0xc7fe('0x37')]){delete _0x24b40e['name'];}_0x582fd6['status'](_0x533da4)[_0xc7fe('0x38')](_0x24b40e);};}exports['index']=function(_0x3b2c46,_0x4aae26){var _0x16c7b4={'include':[{'model':db[_0xc7fe('0x39')],'as':_0xc7fe('0x3a')}]},_0x43fb30={},_0x3284e5={'count':0x0,'rows':[]};var _0x7b6fa0=_[_0xc7fe('0x3b')](db['FaxAccount'][_0xc7fe('0x3c')],function(_0x15b6d2){return{'name':_0x15b6d2['fieldName'],'type':_0x15b6d2[_0xc7fe('0x3d')][_0xc7fe('0x3e')]};});_0x43fb30[_0xc7fe('0x3f')]=_[_0xc7fe('0x3b')](_0x7b6fa0,_0xc7fe('0x37'));_0x43fb30[_0xc7fe('0x40')]=_[_0xc7fe('0x41')](_0x3b2c46[_0xc7fe('0x40')]);_0x43fb30[_0xc7fe('0x42')]=_[_0xc7fe('0x43')](_0x43fb30['model'],_0x43fb30[_0xc7fe('0x40')]);_0x16c7b4[_0xc7fe('0x44')]=_[_0xc7fe('0x43')](_0x43fb30['model'],qs['fields'](_0x3b2c46[_0xc7fe('0x40')][_0xc7fe('0x45')]));_0x16c7b4[_0xc7fe('0x44')]=_0x16c7b4[_0xc7fe('0x44')][_0xc7fe('0x46')]?_0x16c7b4[_0xc7fe('0x44')]:_0x43fb30[_0xc7fe('0x3f')];if(!_0x3b2c46[_0xc7fe('0x40')]['hasOwnProperty'](_0xc7fe('0x47'))){_0x16c7b4['limit']=qs[_0xc7fe('0x2c')](_0x3b2c46[_0xc7fe('0x40')][_0xc7fe('0x2c')]);_0x16c7b4['offset']=qs[_0xc7fe('0x2b')](_0x3b2c46[_0xc7fe('0x40')][_0xc7fe('0x2b')]);}_0x16c7b4[_0xc7fe('0x48')]=qs[_0xc7fe('0x49')](_0x3b2c46[_0xc7fe('0x40')][_0xc7fe('0x49')]);_0x16c7b4[_0xc7fe('0x4a')]=qs['filters'](_['pick'](_0x3b2c46[_0xc7fe('0x40')],_0x43fb30['filters']),_0x7b6fa0);if(_0x3b2c46[_0xc7fe('0x40')][_0xc7fe('0x4b')]){_0x16c7b4[_0xc7fe('0x4a')]=_[_0xc7fe('0x4c')](_0x16c7b4['where'],{'$or':_[_0xc7fe('0x3b')](_0x7b6fa0,function(_0x4cffac){if(_0x4cffac[_0xc7fe('0x3d')]!==_0xc7fe('0x4d')){var _0x210d13={};_0x210d13[_0x4cffac[_0xc7fe('0x37')]]={'$like':'%'+_0x3b2c46['query'][_0xc7fe('0x4b')]+'%'};return _0x210d13;}})});}_0x16c7b4=_['merge']({},_0x16c7b4,_0x3b2c46[_0xc7fe('0x4e')]);var _0x14677b={'where':_0x16c7b4[_0xc7fe('0x4a')]};return db[_0xc7fe('0x4f')][_0xc7fe('0x2a')](_0x14677b)[_0xc7fe('0x1d')](function(_0x5e997c){_0x3284e5[_0xc7fe('0x2a')]=_0x5e997c;if(_0x3b2c46['query'][_0xc7fe('0x50')]){_0x16c7b4[_0xc7fe('0x51')]=[{'all':!![]}];}return db[_0xc7fe('0x4f')][_0xc7fe('0x52')](_0x16c7b4);})['then'](function(_0x40ff37){_0x3284e5[_0xc7fe('0x53')]=_0x40ff37;return _0x3284e5;})[_0xc7fe('0x1d')](respondWithFilteredResult(_0x4aae26,_0x16c7b4))[_0xc7fe('0x26')](handleError(_0x4aae26,null));};exports[_0xc7fe('0x54')]=function(_0x3faaec,_0x10131a){var _0x180f0c={'raw':![],'where':{'id':_0x3faaec['params']['id']},'include':[{'model':db['Pause'],'as':_0xc7fe('0x3a')}]},_0x89147c={};_0x89147c[_0xc7fe('0x3f')]=_[_0xc7fe('0x41')](db[_0xc7fe('0x4f')]['rawAttributes']);_0x89147c[_0xc7fe('0x40')]=_[_0xc7fe('0x41')](_0x3faaec['query']);_0x89147c[_0xc7fe('0x42')]=_[_0xc7fe('0x43')](_0x89147c[_0xc7fe('0x3f')],_0x89147c[_0xc7fe('0x40')]);_0x180f0c[_0xc7fe('0x44')]=_['intersection'](_0x89147c['model'],qs[_0xc7fe('0x45')](_0x3faaec[_0xc7fe('0x40')][_0xc7fe('0x45')]));_0x180f0c[_0xc7fe('0x44')]=_0x180f0c[_0xc7fe('0x44')][_0xc7fe('0x46')]?_0x180f0c[_0xc7fe('0x44')]:_0x89147c[_0xc7fe('0x3f')];if(_0x3faaec[_0xc7fe('0x40')][_0xc7fe('0x50')]){_0x180f0c[_0xc7fe('0x51')]=[{'all':!![]}];}_0x180f0c=_[_0xc7fe('0x4c')]({},_0x180f0c,_0x3faaec['options']);return db[_0xc7fe('0x4f')][_0xc7fe('0x55')](_0x180f0c)['then'](handleEntityNotFound(_0x10131a,null))['then'](respondWithResult(_0x10131a,null))[_0xc7fe('0x26')](handleError(_0x10131a,null));};exports[_0xc7fe('0x56')]=function(_0x399c24,_0x32b5d0){return db[_0xc7fe('0x4f')][_0xc7fe('0x56')](_0x399c24[_0xc7fe('0x57')],{})[_0xc7fe('0x1d')](function(_0x19d3a2){var _0xaabef3=_0x399c24[_0xc7fe('0x58')]['get']({'plain':!![]});if(!_0xaabef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaabef3[_0xc7fe('0x59')]===_0xc7fe('0x58')){var _0x4f306a=_0x19d3a2['get']({'plain':!![]});var _0x2b411d=_0xc7fe('0x35');return db[_0xc7fe('0x5a')]['find']({'where':{'name':_0x2b411d,'userProfileId':_0xaabef3[_0xc7fe('0x5b')]},'raw':!![]})[_0xc7fe('0x1d')](function(_0xeeedae){if(_0xeeedae&&_0xeeedae[_0xc7fe('0x5c')]===0x0){return db[_0xc7fe('0x5d')]['create']({'name':_0x4f306a['name'],'resourceId':_0x4f306a['id'],'type':_0xeeedae[_0xc7fe('0x37')],'sectionId':_0xeeedae['id']},{})[_0xc7fe('0x1d')](function(){return _0x19d3a2;});}else{return _0x19d3a2;}})['catch'](function(_0x1b515e){logger['error'](_0xc7fe('0x5e'),_0x1b515e);throw _0x1b515e;});}return _0x19d3a2;})[_0xc7fe('0x1d')](respondWithResult(_0x32b5d0,0xc9))[_0xc7fe('0x26')](handleError(_0x32b5d0,null));};exports[_0xc7fe('0x33')]=function(_0x1057a4,_0x537905){if(_0x1057a4[_0xc7fe('0x57')]['id']){delete _0x1057a4[_0xc7fe('0x57')]['id'];}return db[_0xc7fe('0x4f')][_0xc7fe('0x55')]({'where':{'id':_0x1057a4[_0xc7fe('0x5f')]['id']},'include':[{'model':db[_0xc7fe('0x39')],'as':'mandatoryDispositionPause'}]})[_0xc7fe('0x1d')](handleEntityNotFound(_0x537905,null))[_0xc7fe('0x1d')](saveUpdates(_0x1057a4[_0xc7fe('0x57')],null))['then'](respondWithResult(_0x537905,null))[_0xc7fe('0x26')](handleError(_0x537905,null));};exports[_0xc7fe('0x34')]=function(_0x4203b7,_0x323b99){return db[_0xc7fe('0x4f')][_0xc7fe('0x55')]({'where':{'id':_0x4203b7['params']['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x323b99,null))[_0xc7fe('0x1d')](removeEntity(_0x323b99,null))[_0xc7fe('0x26')](handleError(_0x323b99,null));};exports['describe']=function(_0x661417,_0x5bff43){return db[_0xc7fe('0x4f')][_0xc7fe('0x60')]()[_0xc7fe('0x1d')](respondWithResult(_0x5bff43,null))['catch'](handleError(_0x5bff43,null));};exports[_0xc7fe('0x61')]=function(_0x2606e7,_0x44aee7,_0x1fbea6){if(_0x2606e7[_0xc7fe('0x57')]['id']){delete _0x2606e7[_0xc7fe('0x57')]['id'];}return db[_0xc7fe('0x4f')][_0xc7fe('0x55')]({'where':{'id':_0x2606e7['params']['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x44aee7,null))[_0xc7fe('0x1d')](function(_0x53944e){if(_0x53944e){_0x2606e7[_0xc7fe('0x57')][_0xc7fe('0x62')]=_0x53944e['id'];return db['Disposition'][_0xc7fe('0x56')](_0x2606e7[_0xc7fe('0x57')]);}})['then'](respondWithResult(_0x44aee7,null))['catch'](handleError(_0x44aee7,null));};exports[_0xc7fe('0x63')]=function(_0x36e3ed,_0x38e9f3,_0x32be86){var _0x340a70={'raw':![],'where':{}};var _0x439161={};var _0x4e5c27={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc7fe('0x64')]({'where':{'id':_0x36e3ed[_0xc7fe('0x5f')]['id']}})['then'](handleEntityNotFound(_0x38e9f3,null))[_0xc7fe('0x1d')](function(_0x2e8971){if(_0x2e8971){_0x439161['model']=_[_0xc7fe('0x41')](db[_0xc7fe('0x65')][_0xc7fe('0x3c')]);_0x439161[_0xc7fe('0x40')]=_[_0xc7fe('0x41')](_0x36e3ed['query']);_0x439161['filters']=_[_0xc7fe('0x43')](_0x439161['model'],_0x439161[_0xc7fe('0x40')]);_0x340a70[_0xc7fe('0x44')]=_[_0xc7fe('0x43')](_0x439161['model'],qs[_0xc7fe('0x45')](_0x36e3ed['query'][_0xc7fe('0x45')]));_0x340a70[_0xc7fe('0x44')]=_0x340a70[_0xc7fe('0x44')]['length']?_0x340a70[_0xc7fe('0x44')]:_0x439161[_0xc7fe('0x3f')];if(!_0x36e3ed[_0xc7fe('0x40')][_0xc7fe('0x66')]('nolimit')){_0x340a70['limit']=qs[_0xc7fe('0x2c')](_0x36e3ed[_0xc7fe('0x40')][_0xc7fe('0x2c')]);_0x340a70[_0xc7fe('0x2b')]=qs['offset'](_0x36e3ed[_0xc7fe('0x40')][_0xc7fe('0x2b')]);}_0x340a70[_0xc7fe('0x48')]=qs[_0xc7fe('0x49')](_0x36e3ed[_0xc7fe('0x40')][_0xc7fe('0x49')]);_0x340a70[_0xc7fe('0x4a')]=qs[_0xc7fe('0x42')](_['pick'](_0x36e3ed[_0xc7fe('0x40')],_0x439161['filters']));_0x340a70[_0xc7fe('0x4a')][_0xc7fe('0x62')]=_0x2e8971['id'];if(_0x36e3ed[_0xc7fe('0x40')]['filter']){_0x340a70[_0xc7fe('0x4a')]=_[_0xc7fe('0x4c')](_0x340a70[_0xc7fe('0x4a')],{'$or':_[_0xc7fe('0x3b')](_0x340a70[_0xc7fe('0x44')],function(_0x56add0){var _0x271261={};_0x271261[_0x56add0]={'$like':'%'+_0x36e3ed['query'][_0xc7fe('0x4b')]+'%'};return _0x271261;})});}_0x340a70=_[_0xc7fe('0x4c')]({},_0x340a70,_0x36e3ed[_0xc7fe('0x4e')]);return db[_0xc7fe('0x65')][_0xc7fe('0x2a')]({'where':_0x340a70[_0xc7fe('0x4a')]})[_0xc7fe('0x1d')](function(_0x3b60bd){_0x4e5c27['count']=_0x3b60bd;if(_0x36e3ed['query'][_0xc7fe('0x50')]){_0x340a70[_0xc7fe('0x51')]=[{'all':!![]}];}return db['Disposition'][_0xc7fe('0x52')](_0x340a70);})[_0xc7fe('0x1d')](function(_0x3ae364){_0x4e5c27[_0xc7fe('0x53')]=_0x3ae364;return _0x4e5c27;});}})['then'](respondWithFilteredResult(_0x38e9f3,_0x340a70))[_0xc7fe('0x26')](handleError(_0x38e9f3,null));};exports[_0xc7fe('0x67')]=function(_0x52f6ed,_0x1f6a4d,_0x3f0af6){return db[_0xc7fe('0x4f')]['find']({'where':{'id':_0x52f6ed[_0xc7fe('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1f6a4d,null))[_0xc7fe('0x1d')](function(_0x2ec635){if(_0x2ec635){return _0x2ec635[_0xc7fe('0x67')](_0x52f6ed[_0xc7fe('0x40')][_0xc7fe('0x68')]);}})[_0xc7fe('0x1d')](respondWithStatusCode(_0x1f6a4d,null))[_0xc7fe('0x26')](handleError(_0x1f6a4d,null));};exports['addAnswer']=function(_0x5094cc,_0x13797d,_0x1e3495){if(_0x5094cc[_0xc7fe('0x57')]['id']){delete _0x5094cc[_0xc7fe('0x57')]['id'];}return db['FaxAccount'][_0xc7fe('0x55')]({'where':{'id':_0x5094cc[_0xc7fe('0x5f')]['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x13797d,null))[_0xc7fe('0x1d')](function(_0x6facc6){if(_0x6facc6){_0x5094cc[_0xc7fe('0x57')][_0xc7fe('0x62')]=_0x6facc6['id'];return db[_0xc7fe('0x69')][_0xc7fe('0x56')](_0x5094cc[_0xc7fe('0x57')]);}})['then'](respondWithResult(_0x13797d,null))['catch'](handleError(_0x13797d,null));};exports[_0xc7fe('0x6a')]=function(_0x395313,_0x4f53ae,_0x27bdb9){var _0x488b30={'raw':![],'where':{}};var _0x369c03={};var _0x5f2398={'count':0x0,'rows':[]};return db[_0xc7fe('0x4f')][_0xc7fe('0x64')]({'where':{'id':_0x395313[_0xc7fe('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4f53ae,null))[_0xc7fe('0x1d')](function(_0x340436){if(_0x340436){_0x369c03['model']=_[_0xc7fe('0x41')](db[_0xc7fe('0x69')][_0xc7fe('0x3c')]);_0x369c03['query']=_[_0xc7fe('0x41')](_0x395313[_0xc7fe('0x40')]);_0x369c03[_0xc7fe('0x42')]=_[_0xc7fe('0x43')](_0x369c03['model'],_0x369c03[_0xc7fe('0x40')]);_0x488b30[_0xc7fe('0x44')]=_[_0xc7fe('0x43')](_0x369c03['model'],qs[_0xc7fe('0x45')](_0x395313[_0xc7fe('0x40')]['fields']));_0x488b30[_0xc7fe('0x44')]=_0x488b30['attributes'][_0xc7fe('0x46')]?_0x488b30[_0xc7fe('0x44')]:_0x369c03[_0xc7fe('0x3f')];if(!_0x395313['query']['hasOwnProperty']('nolimit')){_0x488b30['limit']=qs['limit'](_0x395313['query'][_0xc7fe('0x2c')]);_0x488b30[_0xc7fe('0x2b')]=qs[_0xc7fe('0x2b')](_0x395313['query'][_0xc7fe('0x2b')]);}_0x488b30[_0xc7fe('0x48')]=qs[_0xc7fe('0x49')](_0x395313[_0xc7fe('0x40')][_0xc7fe('0x49')]);_0x488b30[_0xc7fe('0x4a')]=qs[_0xc7fe('0x42')](_['pick'](_0x395313[_0xc7fe('0x40')],_0x369c03[_0xc7fe('0x42')]));_0x488b30['where'][_0xc7fe('0x62')]=_0x340436['id'];if(_0x395313['query'][_0xc7fe('0x4b')]){_0x488b30[_0xc7fe('0x4a')]=_[_0xc7fe('0x4c')](_0x488b30['where'],{'$or':_[_0xc7fe('0x3b')](_0x488b30[_0xc7fe('0x44')],function(_0x4a1da7){var _0x12a256={};_0x12a256[_0x4a1da7]={'$like':'%'+_0x395313[_0xc7fe('0x40')][_0xc7fe('0x4b')]+'%'};return _0x12a256;})});}_0x488b30=_[_0xc7fe('0x4c')]({},_0x488b30,_0x395313['options']);return db[_0xc7fe('0x69')][_0xc7fe('0x2a')]({'where':_0x488b30[_0xc7fe('0x4a')]})[_0xc7fe('0x1d')](function(_0x22f1ba){_0x5f2398[_0xc7fe('0x2a')]=_0x22f1ba;if(_0x395313['query']['includeAll']){_0x488b30[_0xc7fe('0x51')]=[{'all':!![]}];}return db[_0xc7fe('0x69')][_0xc7fe('0x52')](_0x488b30);})['then'](function(_0x44c66f){_0x5f2398[_0xc7fe('0x53')]=_0x44c66f;return _0x5f2398;});}})[_0xc7fe('0x1d')](respondWithFilteredResult(_0x4f53ae,_0x488b30))[_0xc7fe('0x26')](handleError(_0x4f53ae,null));};exports[_0xc7fe('0x6b')]=function(_0x55de27,_0x369950,_0x510526){return db[_0xc7fe('0x4f')][_0xc7fe('0x55')]({'where':{'id':_0x55de27['params']['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x369950,null))[_0xc7fe('0x1d')](function(_0x25d526){if(_0x25d526){return _0x25d526[_0xc7fe('0x6b')](_0x55de27[_0xc7fe('0x40')][_0xc7fe('0x68')]);}})['then'](respondWithStatusCode(_0x369950,null))[_0xc7fe('0x26')](handleError(_0x369950,null));};exports[_0xc7fe('0x6c')]=function(_0x1c4b1e,_0x5d3ebd,_0x2759f6){return db[_0xc7fe('0x6d')]['find']({'where':{'id':_0x1c4b1e[_0xc7fe('0x5f')]['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x5d3ebd,null))[_0xc7fe('0x1d')](function(_0x24274c){if(_0x24274c){return _0x24274c[_0xc7fe('0x6c')](_0x1c4b1e[_0xc7fe('0x57')][_0xc7fe('0x68')],_[_0xc7fe('0x6e')](_0x1c4b1e[_0xc7fe('0x57')],[_0xc7fe('0x68'),'id'])||{});}})['then'](respondWithResult(_0x5d3ebd,null))[_0xc7fe('0x26')](handleError(_0x5d3ebd,null));};exports[_0xc7fe('0x6f')]=function(_0x582f9f,_0x1e5dae,_0x2e3e9d){var _0x57e39f={'raw':![],'where':{}};var _0xc9b55f={};var _0x2c9cdd={'count':0x0,'rows':[]};return db[_0xc7fe('0x4f')][_0xc7fe('0x64')]({'where':{'id':_0x582f9f[_0xc7fe('0x5f')]['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x1e5dae,null))['then'](function(_0x2348d4){if(_0x2348d4){_0xc9b55f[_0xc7fe('0x3f')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0xc9b55f[_0xc7fe('0x40')]=_['keys'](_0x582f9f[_0xc7fe('0x40')]);_0xc9b55f['filters']=_[_0xc7fe('0x43')](_0xc9b55f[_0xc7fe('0x3f')],_0xc9b55f[_0xc7fe('0x40')]);_0x57e39f['attributes']=_[_0xc7fe('0x43')](_0xc9b55f[_0xc7fe('0x3f')],qs[_0xc7fe('0x45')](_0x582f9f[_0xc7fe('0x40')]['fields']));_0x57e39f[_0xc7fe('0x44')]=_0x57e39f[_0xc7fe('0x44')][_0xc7fe('0x46')]?_0x57e39f[_0xc7fe('0x44')]:_0xc9b55f[_0xc7fe('0x3f')];if(!_0x582f9f[_0xc7fe('0x40')][_0xc7fe('0x66')]('nolimit')){_0x57e39f['limit']=qs[_0xc7fe('0x2c')](_0x582f9f[_0xc7fe('0x40')][_0xc7fe('0x2c')]);_0x57e39f[_0xc7fe('0x2b')]=qs['offset'](_0x582f9f[_0xc7fe('0x40')][_0xc7fe('0x2b')]);}_0x57e39f[_0xc7fe('0x48')]=qs['sort'](_0x582f9f[_0xc7fe('0x40')][_0xc7fe('0x49')]);_0x57e39f['where']=qs[_0xc7fe('0x42')](_['pick'](_0x582f9f['query'],_0xc9b55f[_0xc7fe('0x42')]));_0x57e39f[_0xc7fe('0x4a')]['FaxAccountId']=_0x2348d4['id'];if(_0x582f9f['query'][_0xc7fe('0x4b')]){_0x57e39f[_0xc7fe('0x4a')]=_[_0xc7fe('0x4c')](_0x57e39f[_0xc7fe('0x4a')],{'$or':_['map'](_0x57e39f['attributes'],function(_0xa7420c){var _0x2b9126={};_0x2b9126[_0xa7420c]={'$like':'%'+_0x582f9f['query'][_0xc7fe('0x4b')]+'%'};return _0x2b9126;})});}_0x57e39f=_[_0xc7fe('0x4c')]({},_0x57e39f,_0x582f9f[_0xc7fe('0x4e')]);return db[_0xc7fe('0x6d')][_0xc7fe('0x2a')]({'where':_0x57e39f[_0xc7fe('0x4a')]})[_0xc7fe('0x1d')](function(_0x4f268c){_0x2c9cdd['count']=_0x4f268c;if(_0x582f9f[_0xc7fe('0x40')][_0xc7fe('0x50')]){_0x57e39f['include']=[{'model':db[_0xc7fe('0x70')],'as':_0xc7fe('0x71'),'required':![]},{'model':db[_0xc7fe('0x72')],'as':_0xc7fe('0x73'),'attributes':[_0xc7fe('0x37'),_0xc7fe('0x74'),'internal'],'required':![]},{'model':db[_0xc7fe('0x75')],'as':_0xc7fe('0x76'),'attributes':['id',_0xc7fe('0x37'),_0xc7fe('0x77')],'where':_0x582f9f[_0xc7fe('0x40')]['tag']?{'id':_0x582f9f[_0xc7fe('0x40')][_0xc7fe('0x78')]}:undefined,'required':_0x582f9f[_0xc7fe('0x40')]['tag']?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x57e39f);})[_0xc7fe('0x1d')](function(_0x4e0068){_0x2c9cdd[_0xc7fe('0x53')]=_0x4e0068;return _0x2c9cdd;});}})[_0xc7fe('0x1d')](respondWithFilteredResult(_0x1e5dae,_0x57e39f))[_0xc7fe('0x26')](handleError(_0x1e5dae,null));};exports['addApplications']=function(_0x3dcc42,_0x4156cf,_0x511890){return db[_0xc7fe('0x4f')][_0xc7fe('0x64')]({'where':{'id':_0x3dcc42['params']['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x4156cf,null))[_0xc7fe('0x1d')](function(_0x269faf){if(_0x269faf){return db[_0xc7fe('0x79')]['transaction'](function(_0x3d5e66){return db[_0xc7fe('0x7a')][_0xc7fe('0x34')]({'where':{'FaxAccountId':_0x3dcc42[_0xc7fe('0x5f')]['id']},'transaction':_0x3d5e66})[_0xc7fe('0x1d')](function(_0x988a2d){var _0x121aab=_[_0xc7fe('0x3b')](_0x3dcc42[_0xc7fe('0x57')],function(_0x3890a2){_0x3890a2[_0xc7fe('0x62')]=_0x3dcc42['params']['id'];return _0x3890a2;});return db[_0xc7fe('0x7a')][_0xc7fe('0x7b')](_0x121aab,{'transaction':_0x3d5e66});});})[_0xc7fe('0x1d')](function(){return db[_0xc7fe('0x7a')][_0xc7fe('0x7c')]({'where':{'FaxAccountId':_0x3dcc42['params']['id']},'order':_0xc7fe('0x7d')});});}})[_0xc7fe('0x1d')](respondWithResult(_0x4156cf,null))['catch'](handleError(_0x4156cf,null));};exports[_0xc7fe('0x7e')]=function(_0x3677c9,_0x5d0943,_0x31d511){var _0x265156={};var _0x599213={};var _0x3672dc;var _0x20b61a;return db[_0xc7fe('0x4f')][_0xc7fe('0x64')]({'where':{'id':_0x3677c9[_0xc7fe('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5d0943,null))[_0xc7fe('0x1d')](function(_0x4fc30d){if(_0x4fc30d){_0x3672dc=_0x4fc30d;_0x599213['model']=_[_0xc7fe('0x41')](db[_0xc7fe('0x7a')]['rawAttributes']);_0x599213['query']=_[_0xc7fe('0x41')](_0x3677c9[_0xc7fe('0x40')]);_0x599213[_0xc7fe('0x42')]=_[_0xc7fe('0x43')](_0x599213[_0xc7fe('0x3f')],_0x599213[_0xc7fe('0x40')]);_0x265156[_0xc7fe('0x44')]=_['intersection'](_0x599213[_0xc7fe('0x3f')],qs['fields'](_0x3677c9[_0xc7fe('0x40')]['fields']));_0x265156[_0xc7fe('0x44')]=_0x265156[_0xc7fe('0x44')][_0xc7fe('0x46')]?_0x265156[_0xc7fe('0x44')]:_0x599213[_0xc7fe('0x3f')];_0x265156[_0xc7fe('0x48')]=qs[_0xc7fe('0x49')](_0x3677c9[_0xc7fe('0x40')][_0xc7fe('0x49')]);_0x265156[_0xc7fe('0x4a')]=qs[_0xc7fe('0x42')](_[_0xc7fe('0x7f')](_0x3677c9['query'],_0x599213[_0xc7fe('0x42')]));if(_0x3677c9['query'][_0xc7fe('0x4b')]){_0x265156['where']=_[_0xc7fe('0x4c')](_0x265156[_0xc7fe('0x4a')],{'$or':_['map'](_0x265156[_0xc7fe('0x44')],function(_0x4b4e41){var _0xd58179={};_0xd58179[_0x4b4e41]={'$like':'%'+_0x3677c9[_0xc7fe('0x40')]['filter']+'%'};return _0xd58179;})});}_0x265156=_['merge']({},_0x265156,_0x3677c9[_0xc7fe('0x4e')]);return _0x3672dc[_0xc7fe('0x7e')](_0x265156);}})[_0xc7fe('0x1d')](function(_0x185c01){if(_0x185c01){_0x20b61a=_0x185c01[_0xc7fe('0x46')];if(!_0x3677c9[_0xc7fe('0x40')]['hasOwnProperty'](_0xc7fe('0x47'))){_0x265156[_0xc7fe('0x2c')]=qs[_0xc7fe('0x2c')](_0x3677c9['query'][_0xc7fe('0x2c')]);_0x265156['offset']=qs[_0xc7fe('0x2b')](_0x3677c9[_0xc7fe('0x40')][_0xc7fe('0x2b')]);}return _0x3672dc[_0xc7fe('0x7e')](_0x265156);}})[_0xc7fe('0x1d')](function(_0x1f0a4e){if(_0x1f0a4e){return _0x1f0a4e?{'count':_0x20b61a,'rows':_0x1f0a4e}:null;}})['then'](respondWithResult(_0x5d0943,null))['catch'](handleError(_0x5d0943,null));};function Extension(_0x109ccb,_0x49b235,_0x12e7a1,_0x5d6ffa){this[_0xc7fe('0x80')]=_0xc7fe('0x81');this[_0xc7fe('0x82')]=_0x109ccb['localstationid'];this[_0xc7fe('0x83')]=_0x5d6ffa;this[_0xc7fe('0x3d')]=_0xc7fe('0x84');this[_0xc7fe('0x85')]=_0xc7fe('0x86');this['FaxAccountId']=_0x109ccb['id'];this[_0xc7fe('0x7d')]=_0x49b235;this[_0xc7fe('0x87')]=_0x12e7a1;}function createExtensionsReciveFax(_0x2232ac){var _0x10b3fd=0x1;var _0x341cf1=[];_0x341cf1[_0xc7fe('0x88')](new Extension(_0x2232ac,_0x10b3fd,'','Answer'));_0x10b3fd+=0x1;_0x341cf1['push'](new Extension(_0x2232ac,_0x10b3fd,_0xc7fe('0x89'),_0xc7fe('0x8a')));_0x10b3fd+=0x1;for(var _0x1d4da6 in _0x2232ac){if(_0x2232ac[_0xc7fe('0x66')](_0x1d4da6)&&(_0x1d4da6==='ecm'||_0x1d4da6==='localstationid'||_0x1d4da6==='gateway'||_0x1d4da6===_0xc7fe('0x8b')||_0x1d4da6===_0xc7fe('0x8c')||_0x1d4da6===_0xc7fe('0x8d')||_0x1d4da6===_0xc7fe('0x8e')||_0x1d4da6===_0xc7fe('0x8f')||_0x1d4da6===_0xc7fe('0x90'))){_0x341cf1[_0xc7fe('0x88')](new Extension(_0x2232ac,_0x10b3fd,_0xc7fe('0x91')+_0x1d4da6+')='+_0x2232ac[_0x1d4da6],_0xc7fe('0x8a')));_0x10b3fd+=0x1;}}_0x341cf1[_0xc7fe('0x88')](new Extension(_0x2232ac,_0x10b3fd,'6',_0xc7fe('0x92')));_0x10b3fd+=0x1;_0x341cf1[_0xc7fe('0x88')](new Extension(_0x2232ac,_0x10b3fd,_0xc7fe('0x93'),_0xc7fe('0x94')));_0x10b3fd=0x0;return _0x341cf1;}exports[_0xc7fe('0x95')]=function(_0x180433,_0x170655,_0x526e8b){var _0x207980;return db['sequelize'][_0xc7fe('0x96')](function(_0x534caa){return db[_0xc7fe('0x4f')][_0xc7fe('0x56')](_0x180433['body'],{'transaction':_0x534caa})['then'](function(_0x3764b0){_0x207980=_0x3764b0[_0xc7fe('0x97')]({'plain':!![]});return db[_0xc7fe('0x98')]['bulkCreate'](createExtensionsReciveFax(_0x207980),{'transaction':_0x534caa});});})[_0xc7fe('0x1d')](function(){return _0x207980;})[_0xc7fe('0x1d')](respondWithResult(_0x170655,null))[_0xc7fe('0x26')](handleError(_0x170655,null));};exports[_0xc7fe('0x99')]=function(_0x414b36,_0x23b6ef,_0x2057c8){var _0x6a2ec;return db[_0xc7fe('0x79')][_0xc7fe('0x96')](function(_0x3f0bed){return db[_0xc7fe('0x4f')][_0xc7fe('0x33')](_0x414b36[_0xc7fe('0x57')],{'where':{'id':_0x414b36[_0xc7fe('0x57')]['id']},'transaction':_0x3f0bed})[_0xc7fe('0x1d')](function(_0x1f63c6){return db[_0xc7fe('0x98')][_0xc7fe('0x34')]({'where':{'FaxAccountId':_0x414b36[_0xc7fe('0x57')]['id']},'transaction':_0x3f0bed})[_0xc7fe('0x1d')](function(_0x398df6){return db['VoiceExtension'][_0xc7fe('0x7b')](createExtensionsReciveFax(_[_0xc7fe('0x6e')](_0x414b36[_0xc7fe('0x57')],[_0xc7fe('0x9a'),_0xc7fe('0x3e'),'createdAt',_0xc7fe('0x9b'),_0xc7fe('0x9c'),_0xc7fe('0x9d')])),{'transaction':_0x3f0bed});});});})[_0xc7fe('0x1d')](function(){return db[_0xc7fe('0x4f')][_0xc7fe('0x9e')](_0x414b36[_0xc7fe('0x57')]['id']);})[_0xc7fe('0x1d')](respondWithResult(_0x23b6ef,null))[_0xc7fe('0x26')](handleError(_0x23b6ef,null));};exports[_0xc7fe('0x9f')]=function(_0x4f4146,_0x298a12,_0x5f2bf7){var _0x3c80bb={'raw':!![],'where':{}};var _0x1425c5={};var _0x3f7eb0={'count':0x0,'rows':[]};return db[_0xc7fe('0x4f')][_0xc7fe('0x64')]({'where':{'id':_0x4f4146[_0xc7fe('0x5f')]['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x298a12,null))[_0xc7fe('0x1d')](function(_0x304a02){if(_0x304a02){_0x1425c5[_0xc7fe('0x3f')]=_[_0xc7fe('0x41')](db[_0xc7fe('0xa0')]['rawAttributes']);_0x1425c5[_0xc7fe('0x40')]=_['keys'](_0x4f4146['query']);_0x1425c5[_0xc7fe('0x42')]=_[_0xc7fe('0x43')](_0x1425c5[_0xc7fe('0x3f')],_0x1425c5['query']);_0x3c80bb[_0xc7fe('0x44')]=_['intersection'](_0x1425c5[_0xc7fe('0x3f')],qs[_0xc7fe('0x45')](_0x4f4146['query'][_0xc7fe('0x45')]));_0x3c80bb[_0xc7fe('0x44')]=_0x3c80bb[_0xc7fe('0x44')][_0xc7fe('0x46')]?_0x3c80bb[_0xc7fe('0x44')]:_0x1425c5[_0xc7fe('0x3f')];if(!_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0x66')](_0xc7fe('0x47'))){_0x3c80bb[_0xc7fe('0x2c')]=qs[_0xc7fe('0x2c')](_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0x2c')]);_0x3c80bb[_0xc7fe('0x2b')]=qs[_0xc7fe('0x2b')](_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0x2b')]);}_0x3c80bb[_0xc7fe('0x48')]=qs[_0xc7fe('0x49')](_0x4f4146['query']['sort']);_0x3c80bb['where']=qs[_0xc7fe('0x42')](_['pick'](_0x4f4146[_0xc7fe('0x40')],_0x1425c5['filters']));_0x3c80bb[_0xc7fe('0x4a')][_0xc7fe('0x62')]=_0x304a02['id'];if(_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0x4b')]){_0x3c80bb[_0xc7fe('0x4a')]=_[_0xc7fe('0x4c')](_0x3c80bb[_0xc7fe('0x4a')],{'$or':_[_0xc7fe('0x3b')](_0x3c80bb['attributes'],function(_0x264997){var _0x394847={};_0x394847[_0x264997]={'$like':'%'+_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0x4b')]+'%'};return _0x394847;})});}if(_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0xa1')]){var _0x3ca6f1=_0x4f4146[_0xc7fe('0x40')][_0xc7fe('0xa1')][_0xc7fe('0xa2')](',');var _0x11c5cb={};_0x11c5cb[_0x3ca6f1[0x0]]={'$gte':moment(_0x3ca6f1[0x1])[_0xc7fe('0xa3')](_0xc7fe('0xa4'))};_0x3c80bb[_0xc7fe('0x4a')]=_[_0xc7fe('0x4c')](_0x3c80bb[_0xc7fe('0x4a')],_0x11c5cb);}_0x3c80bb=_[_0xc7fe('0x4c')]({},_0x3c80bb,_0x4f4146['options']);return db[_0xc7fe('0xa0')][_0xc7fe('0x2a')]({'where':_0x3c80bb[_0xc7fe('0x4a')]})['then'](function(_0x54b143){_0x3f7eb0[_0xc7fe('0x2a')]=_0x54b143;if(_0x4f4146[_0xc7fe('0x40')]['includeAll']){_0x3c80bb[_0xc7fe('0x51')]=[{'all':!![]}];}return db[_0xc7fe('0xa0')][_0xc7fe('0x52')](_0x3c80bb);})[_0xc7fe('0x1d')](function(_0x458625){_0x3f7eb0[_0xc7fe('0x53')]=_0x458625;return _0x3f7eb0;});}})[_0xc7fe('0x1d')](respondWithFilteredResult(_0x298a12,_0x3c80bb))[_0xc7fe('0x26')](handleError(_0x298a12,null));};exports[_0xc7fe('0x38')]=function(_0x4bf3ab,_0x5243c2,_0x43ccd5){var _0x244661,_0x3af63a={},_0x3282d2;if(_0x4bf3ab[_0xc7fe('0x57')]['to']){_0x3282d2=_0x4bf3ab[_0xc7fe('0x57')]['to'][0x0];}return db['FaxAccount'][_0xc7fe('0x55')]({'where':{'id':_0x4bf3ab[_0xc7fe('0x5f')]['id']},'include':[{'model':db[_0xc7fe('0xa5')],'as':_0xc7fe('0xa6'),'include':[{'model':db[_0xc7fe('0x70')],'as':_0xc7fe('0xa7'),'where':{'fax':_0x3282d2},'limit':0x1,'order':[[_0xc7fe('0x9b'),_0xc7fe('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x5243c2,null))[_0xc7fe('0x1d')](function(_0x5521b1){_0x244661=_0x5521b1;if(_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')]&&_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')]['length']){for(var _0x386a25=0x0;_0x386a25<_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')]['length'];_0x386a25+=0x1){_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')][_0x386a25]={'filename':_0x4bf3ab['body'][_0xc7fe('0xa9')][_0x386a25][_0xc7fe('0x37')],'id':_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')][_0x386a25]['id'],'path':path[_0xc7fe('0xaa')](config[_0xc7fe('0xab')],_0xc7fe('0xac'),_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')][_0x386a25][_0xc7fe('0xad')])};}}return respondWithRpcPromise(_0xc7fe('0xae'),_0xc7fe('0xae'),{'FaxAccountId':_[_0xc7fe('0xaf')](_0x4bf3ab[_0xc7fe('0x5f')]['id'])?undefined:_0x4bf3ab[_0xc7fe('0x5f')]['id'],'path':_[_0xc7fe('0xaf')](_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')][0x0][_0xc7fe('0x8')])?undefined:_0x4bf3ab['body'][_0xc7fe('0xa9')][0x0][_0xc7fe('0x8')],'fax':_[_0xc7fe('0xaf')](_0x4bf3ab[_0xc7fe('0x57')]['to'][0x0])?undefined:_0x4bf3ab[_0xc7fe('0x57')]['to'][0x0]},client9002);})[_0xc7fe('0x1d')](function(){if(_0x244661){if(_[_0xc7fe('0xaf')](_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xb0')])){_0x4bf3ab['body'][_0xc7fe('0xb0')]=util['format'](_0xc7fe('0xb1'),_0x244661[_0xc7fe('0x37')],_0x244661[_0xc7fe('0xb2')]);}if(_0x244661[_0xc7fe('0xa6')]){if(_0x244661[_0xc7fe('0xa6')][_0xc7fe('0xa7')][_0xc7fe('0x46')]){return _0x244661[_0xc7fe('0xa6')][_0xc7fe('0xa7')][0x0];}else{return db[_0xc7fe('0x70')]['create'](_['defaults'](_0x4bf3ab[_0xc7fe('0x57')],{'firstName':_0x4bf3ab[_0xc7fe('0x57')]['to'][0x0],'phone':_0x4bf3ab['body']['to'][0x0],'fax':_0x4bf3ab[_0xc7fe('0x57')]['to'][0x0],'ListId':_0x244661[_0xc7fe('0x9d')]}));}}else{throw new Error(_0xc7fe('0xb3'));}}else{throw new Error(_0xc7fe('0xb4'));}})[_0xc7fe('0x1d')](function(_0x1002c8){if(_0x1002c8){return db['FaxInteraction'][_0xc7fe('0x55')]({'where':{'ContactId':_0x1002c8['id'],'closed':![],'FaxAccountId':_0x244661['id']}})[_0xc7fe('0x1d')](function(_0x314c4d){if(_0x314c4d){return[_0x314c4d,![]];}return db[_0xc7fe('0x6d')]['create']({'UserId':_0x4bf3ab[_0xc7fe('0x58')]['id'],'ContactId':_0x1002c8['id'],'FaxAccountId':_0x244661['id'],'fax':_0x4bf3ab[_0xc7fe('0x57')]['to'][0x0],'firstMsgDirection':_0xc7fe('0xb5'),'Messages':[_['merge'](_0x4bf3ab[_0xc7fe('0x57')],{'read':![],'body':_0x4bf3ab[_0xc7fe('0x57')]['attachments'][0x0][_0xc7fe('0xb6')],'FaxAccountId':_0x244661['id'],'UserId':_0x4bf3ab[_0xc7fe('0x58')]['id'],'ContactId':_0x1002c8['id'],'AttachmentId':_0x4bf3ab['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xc7fe('0xa0')],'as':_0xc7fe('0xb7')}]})[_0xc7fe('0x1d')](function(_0x53174c){return[_0x53174c,!![]];});});}else{throw new Error(_0xc7fe('0xb8'));}})['spread'](function(_0x5635fe,_0x51ed81){if(_0x51ed81){return _0x5635fe;}return db['FaxMessage'][_0xc7fe('0x56')]({'direction':_0xc7fe('0xb5'),'read':![],'body':_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')][0x0][_0xc7fe('0xb6')],'FaxAccountId':_0x244661['id'],'FaxInteractionId':_0x5635fe['id'],'UserId':_0x4bf3ab[_0xc7fe('0x58')]['id'],'ContactId':_0x5635fe['ContactId'],'AttachmentId':_0x4bf3ab['body'][_0xc7fe('0xa9')][0x0]['id']})['then'](function(_0x4f9c64){_0x5635fe['dataValues'][_0xc7fe('0xb7')]=[];_0x5635fe[_0xc7fe('0xb9')][_0xc7fe('0xb7')][_0xc7fe('0x88')](_0x4f9c64['dataValues']);return _0x5635fe;});})[_0xc7fe('0x1d')](function(_0x2acbfc){respondWithRpcPromise('SendFax',_0xc7fe('0xba'),{'FaxAccountId':_[_0xc7fe('0xaf')](_0x4bf3ab[_0xc7fe('0x5f')]['id'])?undefined:_0x4bf3ab['params']['id'],'path':_['isNil'](_0x4bf3ab[_0xc7fe('0x57')]['attachments'][0x0][_0xc7fe('0x8')])?undefined:_0x4bf3ab['body'][_0xc7fe('0xa9')][0x0][_0xc7fe('0x8')],'fax':_[_0xc7fe('0xaf')](_0x4bf3ab['body']['to'][0x0])?undefined:_0x4bf3ab['body']['to'][0x0],'AttachmentId':_0x4bf3ab[_0xc7fe('0x57')][_0xc7fe('0xa9')][0x0]['id']},client9002)[_0xc7fe('0x1d')](function(_0x29e5ff){logger[_0xc7fe('0x1e')](_0xc7fe('0xbb'),_0x29e5ff);})['catch'](function(_0x588a3f){logger[_0xc7fe('0x1e')](_0xc7fe('0xbb'),_0x588a3f);});return _0x2acbfc;})['then'](respondWithResult(_0x5243c2,null))[_0xc7fe('0x26')](handleError(_0x5243c2,null));};exports[_0xc7fe('0xbc')]=function(_0x1642d1,_0x363893,_0x483d51){return db['FaxAccount']['find']({'where':{'id':_0x1642d1['params']['id']}})['then'](handleEntityNotFound(_0x363893,null))[_0xc7fe('0x1d')](function(_0x303a5e){if(_0x303a5e){return _0x303a5e[_0xc7fe('0xbc')](_0x1642d1[_0xc7fe('0x57')][_0xc7fe('0x68')],_[_0xc7fe('0x6e')](_0x1642d1[_0xc7fe('0x57')],[_0xc7fe('0x68'),'id'])||{})[_0xc7fe('0xbd')](function(_0x46808e){for(var _0x44f118=0x0;_0x44f118<_0x1642d1['body'][_0xc7fe('0x68')][_0xc7fe('0x46')];_0x44f118+=0x1){socket[_0xc7fe('0xbe')](_0xc7fe('0xbf'),{'UserId':_0x1642d1[_0xc7fe('0x57')][_0xc7fe('0x68')][_0x44f118],'FaxAccountId':_0x1642d1['params']['id']});}return _0x46808e;});}})[_0xc7fe('0x1d')](respondWithResult(_0x363893,null))['catch'](handleError(_0x363893,null));};exports['removeAgents']=function(_0x3eb5f8,_0x2a0bde,_0x1445cc){return db[_0xc7fe('0x4f')][_0xc7fe('0x55')]({'where':{'id':_0x3eb5f8[_0xc7fe('0x5f')]['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x2a0bde,null))[_0xc7fe('0x1d')](function(_0x597e88){if(_0x597e88){return _0x597e88['removeAgents'](_0x3eb5f8[_0xc7fe('0x40')][_0xc7fe('0x68')])['then'](function(){if(_[_0xc7fe('0xc0')](_0x3eb5f8[_0xc7fe('0x40')][_0xc7fe('0x68')])){for(var _0xed36b7=0x0;_0xed36b7<_0x3eb5f8[_0xc7fe('0x40')][_0xc7fe('0x68')]['length'];_0xed36b7+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3eb5f8[_0xc7fe('0x40')][_0xc7fe('0x68')][_0xed36b7]),'FaxAccountId':Number(_0x3eb5f8[_0xc7fe('0x5f')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3eb5f8['query']['ids']),'FaxAccountId':Number(_0x3eb5f8[_0xc7fe('0x5f')]['id'])});}});}})[_0xc7fe('0x1d')](respondWithStatusCode(_0x2a0bde,null))[_0xc7fe('0x26')](handleError(_0x2a0bde,null));};exports[_0xc7fe('0xc1')]=function(_0x361c3b,_0x35a916,_0x5aeab0){var _0x74f1ee={};var _0x10dc31={};var _0x5940ea;var _0x575e2a;return db[_0xc7fe('0x4f')][_0xc7fe('0x64')]({'where':{'id':_0x361c3b[_0xc7fe('0x5f')]['id']}})[_0xc7fe('0x1d')](handleEntityNotFound(_0x35a916,null))[_0xc7fe('0x1d')](function(_0x2b8868){if(_0x2b8868){_0x5940ea=_0x2b8868;_0x10dc31[_0xc7fe('0x3f')]=_['keys'](db[_0xc7fe('0x72')][_0xc7fe('0x3c')]);_0x10dc31[_0xc7fe('0x40')]=_[_0xc7fe('0x41')](_0x361c3b[_0xc7fe('0x40')]);_0x10dc31[_0xc7fe('0x42')]=_[_0xc7fe('0x43')](_0x10dc31['model'],_0x10dc31[_0xc7fe('0x40')]);_0x74f1ee['attributes']=_[_0xc7fe('0x43')](_0x10dc31[_0xc7fe('0x3f')],qs[_0xc7fe('0x45')](_0x361c3b['query'][_0xc7fe('0x45')]));_0x74f1ee[_0xc7fe('0x44')]=_0x74f1ee[_0xc7fe('0x44')][_0xc7fe('0x46')]?_0x74f1ee[_0xc7fe('0x44')]:_0x10dc31[_0xc7fe('0x3f')];_0x74f1ee[_0xc7fe('0x48')]=qs[_0xc7fe('0x49')](_0x361c3b['query'][_0xc7fe('0x49')]);_0x74f1ee[_0xc7fe('0x4a')]=qs[_0xc7fe('0x42')](_[_0xc7fe('0x7f')](_0x361c3b[_0xc7fe('0x40')],_0x10dc31[_0xc7fe('0x42')]));if(_0x361c3b[_0xc7fe('0x40')]['filter']){_0x74f1ee['where']=_[_0xc7fe('0x4c')](_0x74f1ee[_0xc7fe('0x4a')],{'$or':_['map'](_0x74f1ee['attributes'],function(_0xd591fe){var _0x320e53={};_0x320e53[_0xd591fe]={'$like':'%'+_0x361c3b[_0xc7fe('0x40')][_0xc7fe('0x4b')]+'%'};return _0x320e53;})});}_0x74f1ee=_[_0xc7fe('0x4c')]({},_0x74f1ee,_0x361c3b[_0xc7fe('0x4e')]);return _0x5940ea[_0xc7fe('0xc1')](_0x74f1ee);}})[_0xc7fe('0x1d')](function(_0x520e43){if(_0x520e43){_0x575e2a=_0x520e43[_0xc7fe('0x46')];if(!_0x361c3b[_0xc7fe('0x40')][_0xc7fe('0x66')]('nolimit')){_0x74f1ee['limit']=qs[_0xc7fe('0x2c')](_0x361c3b[_0xc7fe('0x40')][_0xc7fe('0x2c')]);_0x74f1ee[_0xc7fe('0x2b')]=qs[_0xc7fe('0x2b')](_0x361c3b[_0xc7fe('0x40')][_0xc7fe('0x2b')]);}return _0x5940ea['getAgents'](_0x74f1ee);}})[_0xc7fe('0x1d')](function(_0xd2e90f){if(_0xd2e90f){return _0xd2e90f?{'count':_0x575e2a,'rows':_0xd2e90f}:null;}})['then'](respondWithResult(_0x35a916,null))[_0xc7fe('0x26')](handleError(_0x35a916,null));}; \ No newline at end of file +var _0x9933=['headerinfo','minrate','modem','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','key','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','updatedAt','DESC','attachments','join','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','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','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','destroy','get','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','create','findOne','Disposition','nolimit','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','description','appdata','push','Answer','Set','gateway','faxdetect'];(function(_0x482e9a,_0x27e5e1){var _0x480ef6=function(_0x4c41e7){while(--_0x4c41e7){_0x482e9a['push'](_0x482e9a['shift']());}};_0x480ef6(++_0x27e5e1);}(_0x9933,0xe5));var _0x3993=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9933[_0x160c73];return _0xd9302;};'use strict';var pdf=require(_0x3993('0x0'));var emlformat=require(_0x3993('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3993('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3993('0x3'));var moment=require(_0x3993('0x4'));var BPromise=require(_0x3993('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3993('0x6'));var csv=require('to-csv');var ejs=require(_0x3993('0x7'));var fs=require('fs');var _=require(_0x3993('0x8'));var squel=require(_0x3993('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3993('0xa'));var toCsv=require(_0x3993('0xb'));var querystring=require(_0x3993('0xc'));var Papa=require(_0x3993('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3993('0xe'));var as=require(_0x3993('0xf'));var hardwareService=require(_0x3993('0x10'));var logger=require('../../config/logger')(_0x3993('0x11'));var utils=require(_0x3993('0x12'));var config=require(_0x3993('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3993('0x14'))['db'];config[_0x3993('0x15')]=_[_0x3993('0x16')](config[_0x3993('0x15')],{'host':_0x3993('0x17'),'port':0x18eb});var socket=require(_0x3993('0x18'))(new Redis(config[_0x3993('0x15')]));require(_0x3993('0x19'))['register'](socket);var jayson=require(_0x3993('0x1a'));var client=jayson[_0x3993('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x3993('0x1b')][_0x3993('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x35b0a3,_0x5415a4,_0x1279f0,_0x31fa9f){return new BPromise(function(_0x8ea867,_0x59bc0a){var _0x3bc0e9=_0x31fa9f||client;return _0x3bc0e9[_0x3993('0x1d')](_0x35b0a3,_0x1279f0)[_0x3993('0x1e')](function(_0x56e208){logger[_0x3993('0x1f')](_0x3993('0x20'),_0x5415a4,_0x3993('0x21'));logger[_0x3993('0x22')](_0x3993('0x23'),_0x5415a4,_0x3993('0x21'),JSON[_0x3993('0x24')](_0x56e208));if(_0x56e208[_0x3993('0x25')]){if(_0x56e208[_0x3993('0x25')][_0x3993('0x26')]===0x1f4){logger['error'](_0x3993('0x20'),_0x5415a4,_0x56e208['error'][_0x3993('0x27')]);return _0x59bc0a(_0x56e208[_0x3993('0x25')][_0x3993('0x27')]);}logger[_0x3993('0x25')](_0x3993('0x20'),_0x5415a4,_0x56e208[_0x3993('0x25')][_0x3993('0x27')]);return _0x8ea867(_0x56e208[_0x3993('0x25')][_0x3993('0x27')]);}else{logger['info'](_0x3993('0x20'),_0x5415a4,_0x3993('0x21'));_0x8ea867(_0x56e208['result'][_0x3993('0x27')]);}})[_0x3993('0x28')](function(_0x54c9bd){logger[_0x3993('0x25')](_0x3993('0x20'),_0x5415a4,_0x54c9bd);_0x59bc0a(_0x54c9bd);});});}function respondWithStatusCode(_0x10f6e5,_0x47886c){_0x47886c=_0x47886c||0xcc;return function(_0x2d5bb6){if(_0x2d5bb6){return _0x10f6e5[_0x3993('0x29')](_0x47886c);}return _0x10f6e5[_0x3993('0x2a')](_0x47886c)[_0x3993('0x2b')]();};}function respondWithResult(_0x424fc8,_0x392b05){_0x392b05=_0x392b05||0xc8;return function(_0x3db4b1){if(_0x3db4b1){return _0x424fc8[_0x3993('0x2a')](_0x392b05)['json'](_0x3db4b1);}};}function respondWithFilteredResult(_0x2f52c4,_0x1c7fe9){return function(_0x32c80c){if(_0x32c80c){var _0x4fd8d7=_0x32c80c[_0x3993('0x2c')],_0x353ccc=_0x1c7fe9['offset'],_0x18880a=_0x1c7fe9[_0x3993('0x2d')]+_0x1c7fe9[_0x3993('0x2e')],_0x4f3712;if(_0x18880a>=_0x4fd8d7){_0x18880a=_0x4fd8d7;_0x4f3712=0xc8;}else{_0x4f3712=0xce;}_0x2f52c4[_0x3993('0x2a')](_0x4f3712);return _0x2f52c4['set'](_0x3993('0x2f'),_0x353ccc+'-'+_0x18880a+'/'+_0x4fd8d7)[_0x3993('0x30')](_0x32c80c);}return null;};}function patchUpdates(_0x3aa89d){return function(_0x4128e0){try{jsonpatch['apply'](_0x4128e0,_0x3aa89d,!![]);}catch(_0x51aaa0){return BPromise[_0x3993('0x31')](_0x51aaa0);}return _0x4128e0[_0x3993('0x32')]();};}function saveUpdates(_0x1c5e21,_0x4546d1){return function(_0x302e7d){if(_0x302e7d){return _0x302e7d['update'](_0x1c5e21)['then'](function(_0x1b7322){return _0x1b7322;});}return null;};}function removeEntity(_0x34fa57,_0x2d9529){return function(_0x1e66da){if(_0x1e66da){return _0x1e66da[_0x3993('0x33')]()[_0x3993('0x1e')](function(){var _0x3f485e=_0x1e66da[_0x3993('0x34')]({'plain':!![]});var _0x191f63=_0x3993('0x35');return db['UserProfileResource'][_0x3993('0x33')]({'where':{'type':_0x191f63,'resourceId':_0x3f485e['id']}})[_0x3993('0x1e')](function(){return _0x1e66da;});})[_0x3993('0x1e')](function(){_0x34fa57[_0x3993('0x2a')](0xcc)[_0x3993('0x2b')]();});}};}function handleEntityNotFound(_0x22ab7c,_0x5f0893){return function(_0x5bf747){if(!_0x5bf747){_0x22ab7c[_0x3993('0x29')](0x194);}return _0x5bf747;};}function handleError(_0x4303f2,_0x131431){_0x131431=_0x131431||0x1f4;return function(_0x18e8c1){logger[_0x3993('0x25')](_0x18e8c1[_0x3993('0x36')]);if(_0x18e8c1[_0x3993('0x37')]){delete _0x18e8c1['name'];}_0x4303f2[_0x3993('0x2a')](_0x131431)[_0x3993('0x38')](_0x18e8c1);};}exports[_0x3993('0x39')]=function(_0x46160e,_0x2291ee){var _0x3c6622={'include':[{'model':db[_0x3993('0x3a')],'as':_0x3993('0x3b')}]},_0x3ec330={},_0xcd8a5={'count':0x0,'rows':[]};var _0xcc03d7=_[_0x3993('0x3c')](db[_0x3993('0x3d')][_0x3993('0x3e')],function(_0x44d78e){return{'name':_0x44d78e[_0x3993('0x3f')],'type':_0x44d78e['type']['key']};});_0x3ec330[_0x3993('0x40')]=_[_0x3993('0x3c')](_0xcc03d7,_0x3993('0x37'));_0x3ec330[_0x3993('0x41')]=_[_0x3993('0x42')](_0x46160e[_0x3993('0x41')]);_0x3ec330['filters']=_['intersection'](_0x3ec330['model'],_0x3ec330[_0x3993('0x41')]);_0x3c6622[_0x3993('0x43')]=_['intersection'](_0x3ec330[_0x3993('0x40')],qs[_0x3993('0x44')](_0x46160e[_0x3993('0x41')][_0x3993('0x44')]));_0x3c6622['attributes']=_0x3c6622['attributes'][_0x3993('0x45')]?_0x3c6622[_0x3993('0x43')]:_0x3ec330[_0x3993('0x40')];if(!_0x46160e[_0x3993('0x41')][_0x3993('0x46')]('nolimit')){_0x3c6622[_0x3993('0x2e')]=qs[_0x3993('0x2e')](_0x46160e[_0x3993('0x41')][_0x3993('0x2e')]);_0x3c6622[_0x3993('0x2d')]=qs[_0x3993('0x2d')](_0x46160e[_0x3993('0x41')][_0x3993('0x2d')]);}_0x3c6622[_0x3993('0x47')]=qs[_0x3993('0x48')](_0x46160e[_0x3993('0x41')]['sort']);_0x3c6622[_0x3993('0x49')]=qs[_0x3993('0x4a')](_[_0x3993('0x4b')](_0x46160e[_0x3993('0x41')],_0x3ec330[_0x3993('0x4a')]),_0xcc03d7);if(_0x46160e['query'][_0x3993('0x4c')]){_0x3c6622['where']=_['merge'](_0x3c6622[_0x3993('0x49')],{'$or':_[_0x3993('0x3c')](_0xcc03d7,function(_0x5e0be7){if(_0x5e0be7['type']!==_0x3993('0x4d')){var _0x5895fa={};_0x5895fa[_0x5e0be7[_0x3993('0x37')]]={'$like':'%'+_0x46160e['query'][_0x3993('0x4c')]+'%'};return _0x5895fa;}})});}_0x3c6622=_[_0x3993('0x4e')]({},_0x3c6622,_0x46160e[_0x3993('0x4f')]);var _0x13eeca={'where':_0x3c6622[_0x3993('0x49')]};return db[_0x3993('0x3d')]['count'](_0x13eeca)['then'](function(_0x1be290){_0xcd8a5[_0x3993('0x2c')]=_0x1be290;if(_0x46160e[_0x3993('0x41')][_0x3993('0x50')]){_0x3c6622[_0x3993('0x51')]=[{'all':!![]}];}return db[_0x3993('0x3d')][_0x3993('0x52')](_0x3c6622);})[_0x3993('0x1e')](function(_0x31d8b4){_0xcd8a5[_0x3993('0x53')]=_0x31d8b4;return _0xcd8a5;})[_0x3993('0x1e')](respondWithFilteredResult(_0x2291ee,_0x3c6622))['catch'](handleError(_0x2291ee,null));};exports[_0x3993('0x54')]=function(_0xe9c75b,_0x531554){var _0x94e356={'raw':![],'where':{'id':_0xe9c75b['params']['id']},'include':[{'model':db[_0x3993('0x3a')],'as':_0x3993('0x3b')}]},_0x34e951={};_0x34e951[_0x3993('0x40')]=_[_0x3993('0x42')](db[_0x3993('0x3d')][_0x3993('0x3e')]);_0x34e951[_0x3993('0x41')]=_[_0x3993('0x42')](_0xe9c75b[_0x3993('0x41')]);_0x34e951['filters']=_[_0x3993('0x55')](_0x34e951[_0x3993('0x40')],_0x34e951[_0x3993('0x41')]);_0x94e356['attributes']=_[_0x3993('0x55')](_0x34e951[_0x3993('0x40')],qs['fields'](_0xe9c75b[_0x3993('0x41')]['fields']));_0x94e356['attributes']=_0x94e356[_0x3993('0x43')][_0x3993('0x45')]?_0x94e356['attributes']:_0x34e951['model'];if(_0xe9c75b[_0x3993('0x41')]['includeAll']){_0x94e356[_0x3993('0x51')]=[{'all':!![]}];}_0x94e356=_[_0x3993('0x4e')]({},_0x94e356,_0xe9c75b[_0x3993('0x4f')]);return db[_0x3993('0x3d')][_0x3993('0x56')](_0x94e356)[_0x3993('0x1e')](handleEntityNotFound(_0x531554,null))[_0x3993('0x1e')](respondWithResult(_0x531554,null))['catch'](handleError(_0x531554,null));};exports['create']=function(_0x4ef202,_0x1bfe09){return db['FaxAccount']['create'](_0x4ef202[_0x3993('0x57')],{})[_0x3993('0x1e')](function(_0x4f952e){var _0x4a8571=_0x4ef202[_0x3993('0x58')]['get']({'plain':!![]});if(!_0x4a8571)throw new Error(_0x3993('0x59'));if(_0x4a8571['role']===_0x3993('0x58')){var _0xa06bb=_0x4f952e[_0x3993('0x34')]({'plain':!![]});var _0x8bdce9=_0x3993('0x35');return db[_0x3993('0x5a')][_0x3993('0x56')]({'where':{'name':_0x8bdce9,'userProfileId':_0x4a8571['userProfileId']},'raw':!![]})[_0x3993('0x1e')](function(_0x4c38a3){if(_0x4c38a3&&_0x4c38a3['autoAssociation']===0x0){return db[_0x3993('0x5b')]['create']({'name':_0xa06bb[_0x3993('0x37')],'resourceId':_0xa06bb['id'],'type':_0x4c38a3[_0x3993('0x37')],'sectionId':_0x4c38a3['id']},{})[_0x3993('0x1e')](function(){return _0x4f952e;});}else{return _0x4f952e;}})['catch'](function(_0x994caa){logger[_0x3993('0x25')](_0x3993('0x5c'),_0x994caa);throw _0x994caa;});}return _0x4f952e;})[_0x3993('0x1e')](respondWithResult(_0x1bfe09,0xc9))[_0x3993('0x28')](handleError(_0x1bfe09,null));};exports[_0x3993('0x5d')]=function(_0xef7b1,_0x4b003c){if(_0xef7b1[_0x3993('0x57')]['id']){delete _0xef7b1[_0x3993('0x57')]['id'];}return db['FaxAccount'][_0x3993('0x56')]({'where':{'id':_0xef7b1[_0x3993('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x3993('0x3b')}]})['then'](handleEntityNotFound(_0x4b003c,null))[_0x3993('0x1e')](saveUpdates(_0xef7b1['body'],null))[_0x3993('0x1e')](respondWithResult(_0x4b003c,null))[_0x3993('0x28')](handleError(_0x4b003c,null));};exports['destroy']=function(_0x395b1d,_0x3fb72a){return db[_0x3993('0x3d')][_0x3993('0x56')]({'where':{'id':_0x395b1d['params']['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x3fb72a,null))[_0x3993('0x1e')](removeEntity(_0x3fb72a,null))[_0x3993('0x28')](handleError(_0x3fb72a,null));};exports['describe']=function(_0x19d17a,_0x55e5e5){return db[_0x3993('0x3d')]['describe']()[_0x3993('0x1e')](respondWithResult(_0x55e5e5,null))[_0x3993('0x28')](handleError(_0x55e5e5,null));};exports['addDisposition']=function(_0x30718d,_0x5392a1,_0x297cf9){if(_0x30718d[_0x3993('0x57')]['id']){delete _0x30718d[_0x3993('0x57')]['id'];}return db[_0x3993('0x3d')][_0x3993('0x56')]({'where':{'id':_0x30718d[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x5392a1,null))[_0x3993('0x1e')](function(_0x56e3f1){if(_0x56e3f1){_0x30718d['body']['FaxAccountId']=_0x56e3f1['id'];return db['Disposition'][_0x3993('0x5f')](_0x30718d[_0x3993('0x57')]);}})['then'](respondWithResult(_0x5392a1,null))[_0x3993('0x28')](handleError(_0x5392a1,null));};exports['getDispositions']=function(_0x3305da,_0x1cabd5,_0x15b582){var _0x5441ab={'raw':![],'where':{}};var _0x3ad876={};var _0x2aa39c={'count':0x0,'rows':[]};return db[_0x3993('0x3d')][_0x3993('0x60')]({'where':{'id':_0x3305da['params']['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x1cabd5,null))[_0x3993('0x1e')](function(_0x13b795){if(_0x13b795){_0x3ad876[_0x3993('0x40')]=_['keys'](db[_0x3993('0x61')][_0x3993('0x3e')]);_0x3ad876[_0x3993('0x41')]=_[_0x3993('0x42')](_0x3305da[_0x3993('0x41')]);_0x3ad876['filters']=_['intersection'](_0x3ad876[_0x3993('0x40')],_0x3ad876['query']);_0x5441ab[_0x3993('0x43')]=_[_0x3993('0x55')](_0x3ad876['model'],qs[_0x3993('0x44')](_0x3305da['query']['fields']));_0x5441ab['attributes']=_0x5441ab[_0x3993('0x43')][_0x3993('0x45')]?_0x5441ab[_0x3993('0x43')]:_0x3ad876[_0x3993('0x40')];if(!_0x3305da[_0x3993('0x41')][_0x3993('0x46')](_0x3993('0x62'))){_0x5441ab[_0x3993('0x2e')]=qs[_0x3993('0x2e')](_0x3305da[_0x3993('0x41')]['limit']);_0x5441ab['offset']=qs[_0x3993('0x2d')](_0x3305da[_0x3993('0x41')][_0x3993('0x2d')]);}_0x5441ab[_0x3993('0x47')]=qs[_0x3993('0x48')](_0x3305da['query']['sort']);_0x5441ab[_0x3993('0x49')]=qs[_0x3993('0x4a')](_[_0x3993('0x4b')](_0x3305da[_0x3993('0x41')],_0x3ad876[_0x3993('0x4a')]));_0x5441ab[_0x3993('0x49')][_0x3993('0x63')]=_0x13b795['id'];if(_0x3305da[_0x3993('0x41')][_0x3993('0x4c')]){_0x5441ab[_0x3993('0x49')]=_[_0x3993('0x4e')](_0x5441ab[_0x3993('0x49')],{'$or':_[_0x3993('0x3c')](_0x5441ab['attributes'],function(_0x411d60){var _0x125b9f={};_0x125b9f[_0x411d60]={'$like':'%'+_0x3305da['query'][_0x3993('0x4c')]+'%'};return _0x125b9f;})});}_0x5441ab=_['merge']({},_0x5441ab,_0x3305da[_0x3993('0x4f')]);return db[_0x3993('0x61')]['count']({'where':_0x5441ab['where']})[_0x3993('0x1e')](function(_0x1f375d){_0x2aa39c[_0x3993('0x2c')]=_0x1f375d;if(_0x3305da[_0x3993('0x41')]['includeAll']){_0x5441ab[_0x3993('0x51')]=[{'all':!![]}];}return db[_0x3993('0x61')][_0x3993('0x52')](_0x5441ab);})['then'](function(_0x3445ad){_0x2aa39c[_0x3993('0x53')]=_0x3445ad;return _0x2aa39c;});}})['then'](respondWithFilteredResult(_0x1cabd5,_0x5441ab))[_0x3993('0x28')](handleError(_0x1cabd5,null));};exports['removeDispositions']=function(_0x52d38e,_0x393fc7,_0x57150e){return db[_0x3993('0x3d')][_0x3993('0x56')]({'where':{'id':_0x52d38e[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x393fc7,null))['then'](function(_0x5dc5e9){if(_0x5dc5e9){return _0x5dc5e9[_0x3993('0x64')](_0x52d38e[_0x3993('0x41')][_0x3993('0x65')]);}})['then'](respondWithStatusCode(_0x393fc7,null))['catch'](handleError(_0x393fc7,null));};exports['addAnswer']=function(_0x41643f,_0x25e511,_0x29b99b){if(_0x41643f[_0x3993('0x57')]['id']){delete _0x41643f[_0x3993('0x57')]['id'];}return db[_0x3993('0x3d')][_0x3993('0x56')]({'where':{'id':_0x41643f[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x25e511,null))['then'](function(_0x2fb04f){if(_0x2fb04f){_0x41643f[_0x3993('0x57')][_0x3993('0x63')]=_0x2fb04f['id'];return db[_0x3993('0x66')][_0x3993('0x5f')](_0x41643f[_0x3993('0x57')]);}})['then'](respondWithResult(_0x25e511,null))['catch'](handleError(_0x25e511,null));};exports[_0x3993('0x67')]=function(_0x11d014,_0x30bef4,_0x3cd8e5){var _0x5a833d={'raw':![],'where':{}};var _0x5e240e={};var _0x1d24a5={'count':0x0,'rows':[]};return db[_0x3993('0x3d')]['findOne']({'where':{'id':_0x11d014[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x30bef4,null))[_0x3993('0x1e')](function(_0x4f240a){if(_0x4f240a){_0x5e240e['model']=_[_0x3993('0x42')](db[_0x3993('0x66')][_0x3993('0x3e')]);_0x5e240e['query']=_[_0x3993('0x42')](_0x11d014[_0x3993('0x41')]);_0x5e240e['filters']=_[_0x3993('0x55')](_0x5e240e['model'],_0x5e240e[_0x3993('0x41')]);_0x5a833d[_0x3993('0x43')]=_[_0x3993('0x55')](_0x5e240e[_0x3993('0x40')],qs[_0x3993('0x44')](_0x11d014[_0x3993('0x41')][_0x3993('0x44')]));_0x5a833d[_0x3993('0x43')]=_0x5a833d[_0x3993('0x43')][_0x3993('0x45')]?_0x5a833d[_0x3993('0x43')]:_0x5e240e['model'];if(!_0x11d014[_0x3993('0x41')][_0x3993('0x46')](_0x3993('0x62'))){_0x5a833d[_0x3993('0x2e')]=qs[_0x3993('0x2e')](_0x11d014['query'][_0x3993('0x2e')]);_0x5a833d[_0x3993('0x2d')]=qs['offset'](_0x11d014['query'][_0x3993('0x2d')]);}_0x5a833d[_0x3993('0x47')]=qs['sort'](_0x11d014['query'][_0x3993('0x48')]);_0x5a833d['where']=qs[_0x3993('0x4a')](_[_0x3993('0x4b')](_0x11d014[_0x3993('0x41')],_0x5e240e['filters']));_0x5a833d[_0x3993('0x49')]['FaxAccountId']=_0x4f240a['id'];if(_0x11d014[_0x3993('0x41')]['filter']){_0x5a833d[_0x3993('0x49')]=_['merge'](_0x5a833d[_0x3993('0x49')],{'$or':_[_0x3993('0x3c')](_0x5a833d[_0x3993('0x43')],function(_0x351012){var _0x265c1c={};_0x265c1c[_0x351012]={'$like':'%'+_0x11d014['query']['filter']+'%'};return _0x265c1c;})});}_0x5a833d=_[_0x3993('0x4e')]({},_0x5a833d,_0x11d014[_0x3993('0x4f')]);return db[_0x3993('0x66')][_0x3993('0x2c')]({'where':_0x5a833d[_0x3993('0x49')]})[_0x3993('0x1e')](function(_0x2ee3a5){_0x1d24a5[_0x3993('0x2c')]=_0x2ee3a5;if(_0x11d014[_0x3993('0x41')][_0x3993('0x50')]){_0x5a833d[_0x3993('0x51')]=[{'all':!![]}];}return db[_0x3993('0x66')][_0x3993('0x52')](_0x5a833d);})['then'](function(_0x19d3f4){_0x1d24a5[_0x3993('0x53')]=_0x19d3f4;return _0x1d24a5;});}})[_0x3993('0x1e')](respondWithFilteredResult(_0x30bef4,_0x5a833d))[_0x3993('0x28')](handleError(_0x30bef4,null));};exports[_0x3993('0x68')]=function(_0x3976b9,_0x406dc4,_0x3491a2){return db[_0x3993('0x3d')]['find']({'where':{'id':_0x3976b9[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x406dc4,null))['then'](function(_0x347072){if(_0x347072){return _0x347072['removeAnswers'](_0x3976b9[_0x3993('0x41')][_0x3993('0x65')]);}})[_0x3993('0x1e')](respondWithStatusCode(_0x406dc4,null))['catch'](handleError(_0x406dc4,null));};exports['addInteraction']=function(_0x27a67b,_0xe5527b,_0x21785c){return db['FaxInteraction'][_0x3993('0x56')]({'where':{'id':_0x27a67b[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0xe5527b,null))[_0x3993('0x1e')](function(_0x4effde){if(_0x4effde){return _0x4effde[_0x3993('0x69')](_0x27a67b['body'][_0x3993('0x65')],_['omit'](_0x27a67b[_0x3993('0x57')],['ids','id'])||{});}})[_0x3993('0x1e')](respondWithResult(_0xe5527b,null))[_0x3993('0x28')](handleError(_0xe5527b,null));};exports['getInteractions']=function(_0x1a9179,_0x4b0f00,_0x334400){var _0x598635={'raw':![],'where':{}};var _0x2d5411={};var _0x564ea5={'count':0x0,'rows':[]};return db[_0x3993('0x3d')][_0x3993('0x60')]({'where':{'id':_0x1a9179[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x4b0f00,null))['then'](function(_0x1fde11){if(_0x1fde11){_0x2d5411[_0x3993('0x40')]=_[_0x3993('0x42')](db['FaxInteraction'][_0x3993('0x3e')]);_0x2d5411['query']=_[_0x3993('0x42')](_0x1a9179['query']);_0x2d5411[_0x3993('0x4a')]=_[_0x3993('0x55')](_0x2d5411['model'],_0x2d5411[_0x3993('0x41')]);_0x598635[_0x3993('0x43')]=_['intersection'](_0x2d5411[_0x3993('0x40')],qs[_0x3993('0x44')](_0x1a9179[_0x3993('0x41')][_0x3993('0x44')]));_0x598635[_0x3993('0x43')]=_0x598635['attributes'][_0x3993('0x45')]?_0x598635['attributes']:_0x2d5411['model'];if(!_0x1a9179[_0x3993('0x41')]['hasOwnProperty']('nolimit')){_0x598635['limit']=qs[_0x3993('0x2e')](_0x1a9179['query']['limit']);_0x598635[_0x3993('0x2d')]=qs[_0x3993('0x2d')](_0x1a9179[_0x3993('0x41')][_0x3993('0x2d')]);}_0x598635['order']=qs[_0x3993('0x48')](_0x1a9179[_0x3993('0x41')]['sort']);_0x598635[_0x3993('0x49')]=qs[_0x3993('0x4a')](_[_0x3993('0x4b')](_0x1a9179[_0x3993('0x41')],_0x2d5411[_0x3993('0x4a')]));_0x598635[_0x3993('0x49')][_0x3993('0x63')]=_0x1fde11['id'];if(_0x1a9179[_0x3993('0x41')][_0x3993('0x4c')]){_0x598635[_0x3993('0x49')]=_['merge'](_0x598635[_0x3993('0x49')],{'$or':_[_0x3993('0x3c')](_0x598635[_0x3993('0x43')],function(_0xc0aa5d){var _0xa08327={};_0xa08327[_0xc0aa5d]={'$like':'%'+_0x1a9179[_0x3993('0x41')][_0x3993('0x4c')]+'%'};return _0xa08327;})});}_0x598635=_[_0x3993('0x4e')]({},_0x598635,_0x1a9179[_0x3993('0x4f')]);return db[_0x3993('0x6a')][_0x3993('0x2c')]({'where':_0x598635['where']})[_0x3993('0x1e')](function(_0x4946a3){_0x564ea5[_0x3993('0x2c')]=_0x4946a3;if(_0x1a9179[_0x3993('0x41')][_0x3993('0x50')]){_0x598635['include']=[{'model':db[_0x3993('0x6b')],'as':_0x3993('0x6c'),'required':![]},{'model':db['User'],'as':_0x3993('0x6d'),'attributes':[_0x3993('0x37'),_0x3993('0x6e'),_0x3993('0x6f')],'required':![]},{'model':db[_0x3993('0x70')],'as':_0x3993('0x71'),'attributes':['id','name',_0x3993('0x72')],'where':_0x1a9179[_0x3993('0x41')][_0x3993('0x73')]?{'id':_0x1a9179[_0x3993('0x41')][_0x3993('0x73')]}:undefined,'required':_0x1a9179[_0x3993('0x41')][_0x3993('0x73')]?!![]:![]}];}return db[_0x3993('0x6a')][_0x3993('0x52')](_0x598635);})[_0x3993('0x1e')](function(_0x538f10){_0x564ea5[_0x3993('0x53')]=_0x538f10;return _0x564ea5;});}})[_0x3993('0x1e')](respondWithFilteredResult(_0x4b0f00,_0x598635))['catch'](handleError(_0x4b0f00,null));};exports[_0x3993('0x74')]=function(_0xac4a77,_0x559433,_0x2413e7){return db[_0x3993('0x3d')][_0x3993('0x60')]({'where':{'id':_0xac4a77[_0x3993('0x5e')]['id']}})['then'](handleEntityNotFound(_0x559433,null))[_0x3993('0x1e')](function(_0x17a092){if(_0x17a092){return db[_0x3993('0x75')][_0x3993('0x76')](function(_0x5bedc){return db[_0x3993('0x77')][_0x3993('0x33')]({'where':{'FaxAccountId':_0xac4a77[_0x3993('0x5e')]['id']},'transaction':_0x5bedc})[_0x3993('0x1e')](function(_0x889469){var _0x261922=_[_0x3993('0x3c')](_0xac4a77[_0x3993('0x57')],function(_0x1cf950){_0x1cf950['FaxAccountId']=_0xac4a77[_0x3993('0x5e')]['id'];return _0x1cf950;});return db[_0x3993('0x77')][_0x3993('0x78')](_0x261922,{'transaction':_0x5bedc});});})[_0x3993('0x1e')](function(){return db[_0x3993('0x77')]['findAndCountAll']({'where':{'FaxAccountId':_0xac4a77['params']['id']},'order':_0x3993('0x79')});});}})[_0x3993('0x1e')](respondWithResult(_0x559433,null))['catch'](handleError(_0x559433,null));};exports[_0x3993('0x7a')]=function(_0x1b61a8,_0x2d64ff,_0x41df74){var _0x45eba5={};var _0x3b0410={};var _0xc7eab0;var _0x5ee6fc;return db['FaxAccount']['findOne']({'where':{'id':_0x1b61a8[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x2d64ff,null))['then'](function(_0x1d2a46){if(_0x1d2a46){_0xc7eab0=_0x1d2a46;_0x3b0410['model']=_[_0x3993('0x42')](db[_0x3993('0x77')][_0x3993('0x3e')]);_0x3b0410['query']=_[_0x3993('0x42')](_0x1b61a8['query']);_0x3b0410[_0x3993('0x4a')]=_[_0x3993('0x55')](_0x3b0410[_0x3993('0x40')],_0x3b0410[_0x3993('0x41')]);_0x45eba5[_0x3993('0x43')]=_[_0x3993('0x55')](_0x3b0410[_0x3993('0x40')],qs['fields'](_0x1b61a8[_0x3993('0x41')][_0x3993('0x44')]));_0x45eba5[_0x3993('0x43')]=_0x45eba5[_0x3993('0x43')][_0x3993('0x45')]?_0x45eba5[_0x3993('0x43')]:_0x3b0410['model'];_0x45eba5[_0x3993('0x47')]=qs[_0x3993('0x48')](_0x1b61a8[_0x3993('0x41')]['sort']);_0x45eba5[_0x3993('0x49')]=qs[_0x3993('0x4a')](_['pick'](_0x1b61a8[_0x3993('0x41')],_0x3b0410[_0x3993('0x4a')]));if(_0x1b61a8[_0x3993('0x41')][_0x3993('0x4c')]){_0x45eba5[_0x3993('0x49')]=_[_0x3993('0x4e')](_0x45eba5[_0x3993('0x49')],{'$or':_[_0x3993('0x3c')](_0x45eba5[_0x3993('0x43')],function(_0x46981f){var _0x5b8810={};_0x5b8810[_0x46981f]={'$like':'%'+_0x1b61a8[_0x3993('0x41')][_0x3993('0x4c')]+'%'};return _0x5b8810;})});}_0x45eba5=_[_0x3993('0x4e')]({},_0x45eba5,_0x1b61a8[_0x3993('0x4f')]);return _0xc7eab0[_0x3993('0x7a')](_0x45eba5);}})[_0x3993('0x1e')](function(_0x5a1d35){if(_0x5a1d35){_0x5ee6fc=_0x5a1d35['length'];if(!_0x1b61a8[_0x3993('0x41')][_0x3993('0x46')]('nolimit')){_0x45eba5[_0x3993('0x2e')]=qs[_0x3993('0x2e')](_0x1b61a8[_0x3993('0x41')]['limit']);_0x45eba5['offset']=qs[_0x3993('0x2d')](_0x1b61a8[_0x3993('0x41')][_0x3993('0x2d')]);}return _0xc7eab0['getApplications'](_0x45eba5);}})[_0x3993('0x1e')](function(_0x53b507){if(_0x53b507){return _0x53b507?{'count':_0x5ee6fc,'rows':_0x53b507}:null;}})[_0x3993('0x1e')](respondWithResult(_0x2d64ff,null))[_0x3993('0x28')](handleError(_0x2d64ff,null));};function Extension(_0x921f5b,_0x1b1487,_0x28a3e2,_0x133732){this[_0x3993('0x7b')]=_0x3993('0x7c');this[_0x3993('0x7d')]=_0x921f5b[_0x3993('0x7e')];this[_0x3993('0x7f')]=_0x133732;this[_0x3993('0x80')]=_0x3993('0x81');this[_0x3993('0x82')]='Fax\x20Extension';this[_0x3993('0x63')]=_0x921f5b['id'];this[_0x3993('0x79')]=_0x1b1487;this[_0x3993('0x83')]=_0x28a3e2;}function createExtensionsReciveFax(_0x23c9d6){var _0x23638a=0x1;var _0xcea491=[];_0xcea491[_0x3993('0x84')](new Extension(_0x23c9d6,_0x23638a,'',_0x3993('0x85')));_0x23638a+=0x1;_0xcea491[_0x3993('0x84')](new Extension(_0x23c9d6,_0x23638a,'CDR(type)=inbound-fax',_0x3993('0x86')));_0x23638a+=0x1;for(var _0x40f0e5 in _0x23c9d6){if(_0x23c9d6[_0x3993('0x46')](_0x40f0e5)&&(_0x40f0e5==='ecm'||_0x40f0e5==='localstationid'||_0x40f0e5===_0x3993('0x87')||_0x40f0e5===_0x3993('0x88')||_0x40f0e5===_0x3993('0x89')||_0x40f0e5==='maxrate'||_0x40f0e5===_0x3993('0x8a')||_0x40f0e5===_0x3993('0x8b')||_0x40f0e5==='t38timeout')){_0xcea491[_0x3993('0x84')](new Extension(_0x23c9d6,_0x23638a,_0x3993('0x8c')+_0x40f0e5+')='+_0x23c9d6[_0x40f0e5],_0x3993('0x86')));_0x23638a+=0x1;}}_0xcea491[_0x3993('0x84')](new Extension(_0x23c9d6,_0x23638a,'6','Wait'));_0x23638a+=0x1;_0xcea491[_0x3993('0x84')](new Extension(_0x23c9d6,_0x23638a,'/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',_0x3993('0x8d')));_0x23638a=0x0;return _0xcea491;}exports[_0x3993('0x8e')]=function(_0x2b45fd,_0x4b14c2,_0x5a800a){var _0x52323d;return db[_0x3993('0x75')][_0x3993('0x76')](function(_0x54d595){return db[_0x3993('0x3d')][_0x3993('0x5f')](_0x2b45fd[_0x3993('0x57')],{'transaction':_0x54d595})[_0x3993('0x1e')](function(_0x3d1337){_0x52323d=_0x3d1337[_0x3993('0x34')]({'plain':!![]});return db[_0x3993('0x8f')][_0x3993('0x78')](createExtensionsReciveFax(_0x52323d),{'transaction':_0x54d595});});})['then'](function(){return _0x52323d;})[_0x3993('0x1e')](respondWithResult(_0x4b14c2,null))[_0x3993('0x28')](handleError(_0x4b14c2,null));};exports[_0x3993('0x90')]=function(_0x2c65ed,_0x10d697,_0x47d5d1){var _0x4f3045;return db[_0x3993('0x75')]['transaction'](function(_0x3301d1){return db['FaxAccount']['update'](_0x2c65ed['body'],{'where':{'id':_0x2c65ed['body']['id']},'transaction':_0x3301d1})[_0x3993('0x1e')](function(_0x2324bc){return db[_0x3993('0x8f')][_0x3993('0x33')]({'where':{'FaxAccountId':_0x2c65ed['body']['id']},'transaction':_0x3301d1})['then'](function(_0x30acd7){return db[_0x3993('0x8f')]['bulkCreate'](createExtensionsReciveFax(_[_0x3993('0x91')](_0x2c65ed['body'],[_0x3993('0x92'),_0x3993('0x93'),'createdAt','updatedAt',_0x3993('0x94'),_0x3993('0x95')])),{'transaction':_0x3301d1});});});})['then'](function(){return db[_0x3993('0x3d')][_0x3993('0x96')](_0x2c65ed[_0x3993('0x57')]['id']);})[_0x3993('0x1e')](respondWithResult(_0x10d697,null))[_0x3993('0x28')](handleError(_0x10d697,null));};exports[_0x3993('0x97')]=function(_0x48e8bb,_0xcdcf40,_0x51da57){var _0x224c5e={'raw':!![],'where':{}};var _0x1ad476={};var _0x4dd2ca={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3993('0x60')]({'where':{'id':_0x48e8bb[_0x3993('0x5e')]['id']}})['then'](handleEntityNotFound(_0xcdcf40,null))[_0x3993('0x1e')](function(_0x37383e){if(_0x37383e){_0x1ad476[_0x3993('0x40')]=_[_0x3993('0x42')](db[_0x3993('0x98')][_0x3993('0x3e')]);_0x1ad476[_0x3993('0x41')]=_[_0x3993('0x42')](_0x48e8bb[_0x3993('0x41')]);_0x1ad476['filters']=_[_0x3993('0x55')](_0x1ad476[_0x3993('0x40')],_0x1ad476[_0x3993('0x41')]);_0x224c5e['attributes']=_['intersection'](_0x1ad476['model'],qs[_0x3993('0x44')](_0x48e8bb[_0x3993('0x41')][_0x3993('0x44')]));_0x224c5e[_0x3993('0x43')]=_0x224c5e[_0x3993('0x43')][_0x3993('0x45')]?_0x224c5e[_0x3993('0x43')]:_0x1ad476[_0x3993('0x40')];if(!_0x48e8bb[_0x3993('0x41')][_0x3993('0x46')](_0x3993('0x62'))){_0x224c5e['limit']=qs[_0x3993('0x2e')](_0x48e8bb[_0x3993('0x41')][_0x3993('0x2e')]);_0x224c5e[_0x3993('0x2d')]=qs[_0x3993('0x2d')](_0x48e8bb[_0x3993('0x41')]['offset']);}_0x224c5e[_0x3993('0x47')]=qs[_0x3993('0x48')](_0x48e8bb[_0x3993('0x41')][_0x3993('0x48')]);_0x224c5e[_0x3993('0x49')]=qs[_0x3993('0x4a')](_[_0x3993('0x4b')](_0x48e8bb[_0x3993('0x41')],_0x1ad476[_0x3993('0x4a')]));_0x224c5e[_0x3993('0x49')][_0x3993('0x63')]=_0x37383e['id'];if(_0x48e8bb[_0x3993('0x41')][_0x3993('0x4c')]){_0x224c5e[_0x3993('0x49')]=_[_0x3993('0x4e')](_0x224c5e['where'],{'$or':_['map'](_0x224c5e['attributes'],function(_0x1e6c03){var _0x2d6f1a={};_0x2d6f1a[_0x1e6c03]={'$like':'%'+_0x48e8bb[_0x3993('0x41')][_0x3993('0x4c')]+'%'};return _0x2d6f1a;})});}if(_0x48e8bb[_0x3993('0x41')][_0x3993('0x99')]){var _0x14a4f5=_0x48e8bb[_0x3993('0x41')][_0x3993('0x99')][_0x3993('0x9a')](',');var _0x55b8ec={};_0x55b8ec[_0x14a4f5[0x0]]={'$gte':moment(_0x14a4f5[0x1])[_0x3993('0x9b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x224c5e['where']=_[_0x3993('0x4e')](_0x224c5e['where'],_0x55b8ec);}_0x224c5e=_['merge']({},_0x224c5e,_0x48e8bb['options']);return db[_0x3993('0x98')][_0x3993('0x2c')]({'where':_0x224c5e[_0x3993('0x49')]})[_0x3993('0x1e')](function(_0x429b11){_0x4dd2ca[_0x3993('0x2c')]=_0x429b11;if(_0x48e8bb[_0x3993('0x41')][_0x3993('0x50')]){_0x224c5e[_0x3993('0x51')]=[{'all':!![]}];}return db[_0x3993('0x98')][_0x3993('0x52')](_0x224c5e);})[_0x3993('0x1e')](function(_0x27aae9){_0x4dd2ca[_0x3993('0x53')]=_0x27aae9;return _0x4dd2ca;});}})['then'](respondWithFilteredResult(_0xcdcf40,_0x224c5e))[_0x3993('0x28')](handleError(_0xcdcf40,null));};exports[_0x3993('0x38')]=function(_0xce38ae,_0x3b2b03,_0x548bdb){var _0x95a262,_0x3cf54b={},_0x4868b1;if(_0xce38ae['body']['to']){_0x4868b1=_0xce38ae['body']['to'][0x0];}return db['FaxAccount'][_0x3993('0x56')]({'where':{'id':_0xce38ae[_0x3993('0x5e')]['id']},'include':[{'model':db[_0x3993('0x9c')],'as':_0x3993('0x9d'),'include':[{'model':db[_0x3993('0x6b')],'as':'Contacts','where':{'fax':_0x4868b1},'limit':0x1,'order':[[_0x3993('0x9e'),_0x3993('0x9f')]]}]}]})[_0x3993('0x1e')](handleEntityNotFound(_0x3b2b03,null))['then'](function(_0x50bdb2){_0x95a262=_0x50bdb2;if(_0xce38ae[_0x3993('0x57')][_0x3993('0xa0')]&&_0xce38ae['body']['attachments']['length']){for(var _0x2f1f3e=0x0;_0x2f1f3e<_0xce38ae[_0x3993('0x57')]['attachments'][_0x3993('0x45')];_0x2f1f3e+=0x1){_0xce38ae[_0x3993('0x57')]['attachments'][_0x2f1f3e]={'filename':_0xce38ae[_0x3993('0x57')][_0x3993('0xa0')][_0x2f1f3e][_0x3993('0x37')],'id':_0xce38ae[_0x3993('0x57')][_0x3993('0xa0')][_0x2f1f3e]['id'],'path':path[_0x3993('0xa1')](config['root'],'server/files/attachments',_0xce38ae['body'][_0x3993('0xa0')][_0x2f1f3e]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x3993('0xa2')](_0xce38ae[_0x3993('0x5e')]['id'])?undefined:_0xce38ae[_0x3993('0x5e')]['id'],'path':_['isNil'](_0xce38ae['body']['attachments'][0x0][_0x3993('0xa3')])?undefined:_0xce38ae[_0x3993('0x57')][_0x3993('0xa0')][0x0][_0x3993('0xa3')],'fax':_[_0x3993('0xa2')](_0xce38ae['body']['to'][0x0])?undefined:_0xce38ae['body']['to'][0x0]},client9002);})['then'](function(){if(_0x95a262){if(_[_0x3993('0xa2')](_0xce38ae['body'][_0x3993('0xa4')])){_0xce38ae[_0x3993('0x57')][_0x3993('0xa4')]=util[_0x3993('0x9b')](_0x3993('0xa5'),_0x95a262['name'],_0x95a262[_0x3993('0xa6')]);}if(_0x95a262[_0x3993('0x9d')]){if(_0x95a262[_0x3993('0x9d')][_0x3993('0xa7')][_0x3993('0x45')]){return _0x95a262[_0x3993('0x9d')]['Contacts'][0x0];}else{return db[_0x3993('0x6b')]['create'](_[_0x3993('0x16')](_0xce38ae[_0x3993('0x57')],{'firstName':_0xce38ae[_0x3993('0x57')]['to'][0x0],'phone':_0xce38ae[_0x3993('0x57')]['to'][0x0],'fax':_0xce38ae['body']['to'][0x0],'ListId':_0x95a262[_0x3993('0x95')]}));}}else{throw new Error(_0x3993('0xa8'));}}else{throw new Error(_0x3993('0xa9'));}})['then'](function(_0x1b7422){if(_0x1b7422){return db[_0x3993('0x6a')][_0x3993('0x56')]({'where':{'ContactId':_0x1b7422['id'],'closed':![],'FaxAccountId':_0x95a262['id']}})[_0x3993('0x1e')](function(_0xe60e7f){if(_0xe60e7f){return[_0xe60e7f,![]];}return db[_0x3993('0x6a')][_0x3993('0x5f')]({'UserId':_0xce38ae['user']['id'],'ContactId':_0x1b7422['id'],'FaxAccountId':_0x95a262['id'],'fax':_0xce38ae[_0x3993('0x57')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0xce38ae[_0x3993('0x57')],{'read':![],'body':_0xce38ae['body'][_0x3993('0xa0')][0x0][_0x3993('0xaa')],'FaxAccountId':_0x95a262['id'],'UserId':_0xce38ae[_0x3993('0x58')]['id'],'ContactId':_0x1b7422['id'],'AttachmentId':_0xce38ae['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x3993('0xab')}]})[_0x3993('0x1e')](function(_0xe5caeb){return[_0xe5caeb,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3993('0xac')](function(_0x51ca58,_0x31a907){if(_0x31a907){return _0x51ca58;}return db['FaxMessage'][_0x3993('0x5f')]({'direction':_0x3993('0xad'),'read':![],'body':_0xce38ae[_0x3993('0x57')][_0x3993('0xa0')][0x0][_0x3993('0xaa')],'FaxAccountId':_0x95a262['id'],'FaxInteractionId':_0x51ca58['id'],'UserId':_0xce38ae[_0x3993('0x58')]['id'],'ContactId':_0x51ca58['ContactId'],'AttachmentId':_0xce38ae[_0x3993('0x57')]['attachments'][0x0]['id']})[_0x3993('0x1e')](function(_0x390d60){_0x51ca58[_0x3993('0xae')][_0x3993('0xab')]=[];_0x51ca58[_0x3993('0xae')]['Messages'][_0x3993('0x84')](_0x390d60[_0x3993('0xae')]);return _0x51ca58;});})['then'](function(_0x3ffbb8){respondWithRpcPromise(_0x3993('0xaf'),_0x3993('0xaf'),{'FaxAccountId':_[_0x3993('0xa2')](_0xce38ae[_0x3993('0x5e')]['id'])?undefined:_0xce38ae[_0x3993('0x5e')]['id'],'path':_[_0x3993('0xa2')](_0xce38ae[_0x3993('0x57')]['attachments'][0x0][_0x3993('0xa3')])?undefined:_0xce38ae['body'][_0x3993('0xa0')][0x0][_0x3993('0xa3')],'fax':_[_0x3993('0xa2')](_0xce38ae[_0x3993('0x57')]['to'][0x0])?undefined:_0xce38ae[_0x3993('0x57')]['to'][0x0],'AttachmentId':_0xce38ae[_0x3993('0x57')][_0x3993('0xa0')][0x0]['id']},client9002)['then'](function(_0x30c7e8){logger[_0x3993('0x1f')]('SendFaxRpc,\x20%s',_0x30c7e8);})[_0x3993('0x28')](function(_0x298228){logger['info']('SendFaxRpc,\x20%s',_0x298228);});return _0x3ffbb8;})['then'](respondWithResult(_0x3b2b03,null))[_0x3993('0x28')](handleError(_0x3b2b03,null));};exports['addAgents']=function(_0x3cdb72,_0x57ab8a,_0x468e8c){return db['FaxAccount']['find']({'where':{'id':_0x3cdb72[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x57ab8a,null))[_0x3993('0x1e')](function(_0x1b74c7){if(_0x1b74c7){return _0x1b74c7[_0x3993('0xb0')](_0x3cdb72[_0x3993('0x57')][_0x3993('0x65')],_[_0x3993('0x91')](_0x3cdb72['body'],[_0x3993('0x65'),'id'])||{})[_0x3993('0xac')](function(_0x581051){for(var _0x230a97=0x0;_0x230a97<_0x3cdb72[_0x3993('0x57')][_0x3993('0x65')][_0x3993('0x45')];_0x230a97+=0x1){socket[_0x3993('0xb1')](_0x3993('0xb2'),{'UserId':_0x3cdb72[_0x3993('0x57')]['ids'][_0x230a97],'FaxAccountId':_0x3cdb72['params']['id']});}return _0x581051;});}})[_0x3993('0x1e')](respondWithResult(_0x57ab8a,null))[_0x3993('0x28')](handleError(_0x57ab8a,null));};exports[_0x3993('0xb3')]=function(_0x35c122,_0x47a6b4,_0x2c5fc3){return db[_0x3993('0x3d')]['find']({'where':{'id':_0x35c122[_0x3993('0x5e')]['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x47a6b4,null))[_0x3993('0x1e')](function(_0x4c71e5){if(_0x4c71e5){return _0x4c71e5['removeAgents'](_0x35c122[_0x3993('0x41')][_0x3993('0x65')])[_0x3993('0x1e')](function(){if(_['isArray'](_0x35c122['query']['ids'])){for(var _0x31ff37=0x0;_0x31ff37<_0x35c122[_0x3993('0x41')][_0x3993('0x65')][_0x3993('0x45')];_0x31ff37+=0x1){socket['emit'](_0x3993('0xb4'),{'UserId':Number(_0x35c122['query'][_0x3993('0x65')][_0x31ff37]),'FaxAccountId':Number(_0x35c122[_0x3993('0x5e')]['id'])});}}else{socket['emit'](_0x3993('0xb4'),{'UserId':Number(_0x35c122['query']['ids']),'FaxAccountId':Number(_0x35c122[_0x3993('0x5e')]['id'])});}});}})[_0x3993('0x1e')](respondWithStatusCode(_0x47a6b4,null))[_0x3993('0x28')](handleError(_0x47a6b4,null));};exports[_0x3993('0xb5')]=function(_0x354ae8,_0x1e7d1c,_0x5b6237){var _0x302d5e={};var _0x29cb28={};var _0x4889ba;var _0x5c293f;return db[_0x3993('0x3d')][_0x3993('0x60')]({'where':{'id':_0x354ae8['params']['id']}})[_0x3993('0x1e')](handleEntityNotFound(_0x1e7d1c,null))['then'](function(_0x111349){if(_0x111349){_0x4889ba=_0x111349;_0x29cb28[_0x3993('0x40')]=_[_0x3993('0x42')](db[_0x3993('0xb6')][_0x3993('0x3e')]);_0x29cb28[_0x3993('0x41')]=_[_0x3993('0x42')](_0x354ae8[_0x3993('0x41')]);_0x29cb28[_0x3993('0x4a')]=_[_0x3993('0x55')](_0x29cb28[_0x3993('0x40')],_0x29cb28[_0x3993('0x41')]);_0x302d5e['attributes']=_[_0x3993('0x55')](_0x29cb28[_0x3993('0x40')],qs[_0x3993('0x44')](_0x354ae8[_0x3993('0x41')]['fields']));_0x302d5e[_0x3993('0x43')]=_0x302d5e[_0x3993('0x43')][_0x3993('0x45')]?_0x302d5e[_0x3993('0x43')]:_0x29cb28[_0x3993('0x40')];_0x302d5e['order']=qs['sort'](_0x354ae8['query'][_0x3993('0x48')]);_0x302d5e['where']=qs[_0x3993('0x4a')](_[_0x3993('0x4b')](_0x354ae8['query'],_0x29cb28['filters']));if(_0x354ae8[_0x3993('0x41')]['filter']){_0x302d5e[_0x3993('0x49')]=_[_0x3993('0x4e')](_0x302d5e['where'],{'$or':_[_0x3993('0x3c')](_0x302d5e[_0x3993('0x43')],function(_0x40b8d3){var _0x22c700={};_0x22c700[_0x40b8d3]={'$like':'%'+_0x354ae8[_0x3993('0x41')][_0x3993('0x4c')]+'%'};return _0x22c700;})});}_0x302d5e=_[_0x3993('0x4e')]({},_0x302d5e,_0x354ae8[_0x3993('0x4f')]);return _0x4889ba[_0x3993('0xb5')](_0x302d5e);}})[_0x3993('0x1e')](function(_0x43d5da){if(_0x43d5da){_0x5c293f=_0x43d5da[_0x3993('0x45')];if(!_0x354ae8[_0x3993('0x41')][_0x3993('0x46')](_0x3993('0x62'))){_0x302d5e[_0x3993('0x2e')]=qs[_0x3993('0x2e')](_0x354ae8[_0x3993('0x41')][_0x3993('0x2e')]);_0x302d5e[_0x3993('0x2d')]=qs[_0x3993('0x2d')](_0x354ae8[_0x3993('0x41')]['offset']);}return _0x4889ba[_0x3993('0xb5')](_0x302d5e);}})[_0x3993('0x1e')](function(_0x1d6819){if(_0x1d6819){return _0x1d6819?{'count':_0x5c293f,'rows':_0x1d6819}:null;}})[_0x3993('0x1e')](respondWithResult(_0x1e7d1c,null))[_0x3993('0x28')](handleError(_0x1e7d1c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b05a2cf..6d279c6 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 _0x6301=['update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6301,0xa4));var _0x1630=function(_0x1b3a09,_0x20c774){_0x1b3a09=_0x1b3a09-0x0;var _0x357bb8=_0x6301[_0x1b3a09];return _0x357bb8;};'use strict';var EventEmitter=require(_0x1630('0x0'));var FaxAccount=require(_0x1630('0x1'))['db'][_0x1630('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1630('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1630('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2729f5){return function(_0x57963c,_0x25093f,_0x32e2aa){FaxAccountEvents[_0x1630('0x5')](_0x2729f5+':'+_0x57963c['id'],_0x57963c);FaxAccountEvents[_0x1630('0x5')](_0x2729f5,_0x57963c);_0x32e2aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x1630('0x6')](e,emitEvent(event));}}module[_0x1630('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xc6dd=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xc6dd,0xdd));var _0xdc6d=function(_0x278013,_0x55c88d){_0x278013=_0x278013-0x0;var _0x5c96bf=_0xc6dd[_0x278013];return _0x5c96bf;};'use strict';var EventEmitter=require(_0xdc6d('0x0'));var FaxAccount=require(_0xdc6d('0x1'))['db'][_0xdc6d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdc6d('0x3')](0x0);var events={'afterCreate':_0xdc6d('0x4'),'afterUpdate':'update','afterDestroy':_0xdc6d('0x5')};function emitEvent(_0x4ab4bb){return function(_0x50b822,_0x46e0d3,_0x136a40){FaxAccountEvents['emit'](_0x4ab4bb+':'+_0x50b822['id'],_0x50b822);FaxAccountEvents['emit'](_0x4ab4bb,_0x50b822);_0x136a40(null);};}for(var e in events){if(events[_0xdc6d('0x6')](e)){var event=events[e];FaxAccount[_0xdc6d('0x7')](e,emitEvent(event));}}module[_0xdc6d('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 feea281..274fb7a 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 _0x6816=['rimraf','./faxAccount.attributes','exports','FaxAccount','fax_accounts','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x449bc6,_0x4938a0){var _0xfce655=function(_0x2e891b){while(--_0x2e891b){_0x449bc6['push'](_0x449bc6['shift']());}};_0xfce655(++_0x4938a0);}(_0x6816,0x118));var _0x6681=function(_0x5da412,_0x369e18){_0x5da412=_0x5da412-0x0;var _0x931e93=_0x6816[_0x5da412];return _0x931e93;};'use strict';var _=require('lodash');var util=require(_0x6681('0x0'));var logger=require(_0x6681('0x1'))(_0x6681('0x2'));var moment=require('moment');var BPromise=require(_0x6681('0x3'));var rp=require(_0x6681('0x4'));var fs=require('fs');var path=require(_0x6681('0x5'));var rimraf=require(_0x6681('0x6'));var config=require('../../config/environment');var attributes=require(_0x6681('0x7'));module[_0x6681('0x8')]=function(_0x5ea70d,_0x4b09f7){return _0x5ea70d['define'](_0x6681('0x9'),attributes,{'tableName':_0x6681('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e55=['fax_accounts','../../config/logger','api','moment','request-promise','path','rimraf','define','FaxAccount'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x9e55,0x1b1));var _0x59e5=function(_0x3ba51e,_0x23882e){_0x3ba51e=_0x3ba51e-0x0;var _0x4d1db0=_0x9e55[_0x3ba51e];return _0x4d1db0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x59e5('0x0'))(_0x59e5('0x1'));var moment=require(_0x59e5('0x2'));var BPromise=require('bluebird');var rp=require(_0x59e5('0x3'));var fs=require('fs');var path=require(_0x59e5('0x4'));var rimraf=require(_0x59e5('0x5'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0x20d453,_0x2d3bc3){return _0x20d453[_0x59e5('0x6')](_0x59e5('0x7'),attributes,{'tableName':_0x59e5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 3c4bd2f..d0a72c4 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 _0x7899=['get','applications','list','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','created','FaxMessage','ContactId','UserId','interaction','unshift','agent','name','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','FaxAccount','findAll','raw','options','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','Contacts','DESC','Applications','List'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x7899,0xd1));var _0x9789=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0x7899[_0x193ddf];return _0x5bc6df;};'use strict';var _=require(_0x9789('0x0'));var util=require(_0x9789('0x1'));var moment=require(_0x9789('0x2'));var BPromise=require(_0x9789('0x3'));var rs=require(_0x9789('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9789('0x5'))['db'];var utils=require(_0x9789('0x6'));var logger=require(_0x9789('0x7'))(_0x9789('0x8'));var config=require(_0x9789('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9789('0xa')][_0x9789('0xb')]({'port':0x232c});config[_0x9789('0xc')]=_[_0x9789('0xd')](config['redis'],{'host':_0x9789('0xe'),'port':0x18eb});var socket=require(_0x9789('0xf'))(new Redis(config[_0x9789('0xc')]));require('./faxAccount.socket')[_0x9789('0x10')](socket);function respondWithRpcPromise(_0x109a8e,_0x13c29d,_0x17986b){return new BPromise(function(_0x3e0894,_0x4c03c3){return client[_0x9789('0x11')](_0x109a8e,_0x17986b)[_0x9789('0x12')](function(_0x55949a){logger['info']('FaxAccount,\x20%s,\x20%s',_0x13c29d,_0x9789('0x13'));logger[_0x9789('0x14')](_0x9789('0x15'),_0x13c29d,'request\x20sent',JSON[_0x9789('0x16')](_0x55949a));if(_0x55949a['error']){if(_0x55949a[_0x9789('0x17')][_0x9789('0x18')]===0x1f4){logger[_0x9789('0x17')](_0x9789('0x19'),_0x13c29d,_0x55949a[_0x9789('0x17')][_0x9789('0x1a')]);return _0x4c03c3(_0x55949a[_0x9789('0x17')][_0x9789('0x1a')]);}logger[_0x9789('0x17')](_0x9789('0x19'),_0x13c29d,_0x55949a[_0x9789('0x17')][_0x9789('0x1a')]);return _0x3e0894(_0x55949a[_0x9789('0x17')][_0x9789('0x1a')]);}else{logger[_0x9789('0x1b')](_0x9789('0x19'),_0x13c29d,_0x9789('0x13'));_0x3e0894(_0x55949a[_0x9789('0x1c')][_0x9789('0x1a')]);}})[_0x9789('0x1d')](function(_0x507a5a){logger[_0x9789('0x17')](_0x9789('0x19'),_0x13c29d,_0x507a5a);_0x4c03c3(_0x507a5a);});});}exports['GetFaxAccount']=function(_0x2278c5){var _0x42f0ae=this;return new Promise(function(_0x1814d5,_0x10553d){return db[_0x9789('0x1e')][_0x9789('0x1f')]({'raw':_0x2278c5['options']?_0x2278c5['options'][_0x9789('0x20')]===undefined?!![]:![]:!![],'where':_0x2278c5[_0x9789('0x21')]?_0x2278c5[_0x9789('0x21')][_0x9789('0x22')]||null:null,'attributes':_0x2278c5[_0x9789('0x21')]?_0x2278c5[_0x9789('0x21')][_0x9789('0x23')]||null:null,'limit':_0x2278c5['options']?_0x2278c5['options'][_0x9789('0x24')]||null:null,'include':_0x2278c5[_0x9789('0x21')]?_0x2278c5[_0x9789('0x21')][_0x9789('0x25')]?_[_0x9789('0x26')](_0x2278c5[_0x9789('0x21')][_0x9789('0x25')],function(_0x1fd205){return{'model':db[_0x1fd205[_0x9789('0x27')]],'as':_0x1fd205['as'],'attributes':_0x1fd205['attributes'],'include':_0x1fd205[_0x9789('0x25')]?_['map'](_0x1fd205[_0x9789('0x25')],function(_0x4a7f4b){return{'model':db[_0x4a7f4b[_0x9789('0x27')]],'as':_0x4a7f4b['as'],'attributes':_0x4a7f4b['attributes'],'include':_0x4a7f4b[_0x9789('0x25')]?_[_0x9789('0x26')](_0x4a7f4b[_0x9789('0x25')],function(_0x3ca5c4){return{'model':db[_0x3ca5c4[_0x9789('0x27')]],'as':_0x3ca5c4['as'],'attributes':_0x3ca5c4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33f89f){logger[_0x9789('0x1b')](_0x9789('0x28'),_0x2278c5);logger[_0x9789('0x14')](_0x9789('0x28'),_0x2278c5,JSON['stringify'](_0x33f89f));_0x1814d5(_0x33f89f);})[_0x9789('0x1d')](function(_0x18e9dc){logger[_0x9789('0x17')](_0x9789('0x28'),_0x18e9dc[_0x9789('0x1a')],_0x2278c5);_0x10553d(_0x42f0ae[_0x9789('0x17')](0x1f4,_0x18e9dc[_0x9789('0x1a')]));});});};exports[_0x9789('0x29')]=function(_0x3ecccf,_0x5acb4a,_0x39cb81){var _0x47732f=this;return new Promise(function(_0x59eb2e,_0x9c0d65){var _0x5487cc={'body':_0x3ecccf[_0x9789('0x2a')],'channel':_0x9789('0x2b')};var _0x404496=[];var _0x3cc444=[];var _0x4ff93e={};return db['CmContact'][_0x9789('0x2c')]()[_0x9789('0x12')](function(_0x272c66){if(!_0x272c66){throw new db[(_0x9789('0x2d'))][(_0x9789('0x2e'))]('no\x20available\x20attributes');}_0x404496=_[_0x9789('0x2f')](_[_0x9789('0x30')](_0x272c66),[_0x9789('0x31'),_0x9789('0x32')]);_0x3cc444=_['difference'](_[_0x9789('0x30')](_0x272c66),[_0x9789('0x31'),_0x9789('0x32'),'CompanyId',_0x9789('0x33')]);if(_0x3ecccf['body']['id']){delete _0x3ecccf[_0x9789('0x2a')]['id'];}if(_[_0x9789('0x34')](_0x3ecccf[_0x9789('0x2a')][_0x9789('0x35')])){throw new db[(_0x9789('0x2d'))]['ValidationError'](_0x9789('0x36'));}if(_['isNil'](_0x3ecccf[_0x9789('0x2a')][_0x9789('0x2a')])||_0x3ecccf[_0x9789('0x2a')][_0x9789('0x2a')]===''){throw new db['Sequelize'][(_0x9789('0x2e'))](_0x9789('0x37'));}if(_['isNil'](_0x3ecccf[_0x9789('0x2a')][_0x9789('0x38')])){throw new db[(_0x9789('0x2d'))][(_0x9789('0x2e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cc444);}if(!_[_0x9789('0x39')](_0x3cc444,_0x3ecccf['body']['mapKey'])){throw new db[(_0x9789('0x2d'))][(_0x9789('0x2e'))](_0x9789('0x3a')+_0x3cc444);}_0x4ff93e[_0x3ecccf['body'][_0x9789('0x38')]]=_0x3ecccf[_0x9789('0x2a')][_0x9789('0x35')];})['then'](function(){return db[_0x9789('0x1e')][_0x9789('0x3b')]({'where':{'id':_0x3ecccf[_0x9789('0x3c')]['id']},'include':[{'model':db[_0x9789('0x3d')],'as':'List','include':[{'model':db[_0x9789('0x3e')],'as':_0x9789('0x3f'),'where':_0x4ff93e,'limit':0x1,'order':[['updatedAt',_0x9789('0x40')]]}]},{'model':db['FaxApplication'],'as':_0x9789('0x41')}]});})['then'](function(_0x46822b){if(_0x46822b&&_0x46822b[_0x9789('0x42')]){var _0x2707f8=_0x46822b[_0x9789('0x43')]({'plain':!![]});_0x5487cc[_0x9789('0x3c')]=_0x2707f8;_0x5487cc[_0x9789('0x44')]=_0x2707f8['Applications'];_0x5487cc[_0x9789('0x45')]=_0x2707f8['List'];_0x5487cc[_0x9789('0x44')]=_[_0x9789('0x46')](_0x5487cc[_0x9789('0x44')],['priority'],[_0x9789('0x47')]);if(_0x5487cc[_0x9789('0x3c')][_0x9789('0x41')]){delete _0x5487cc['account'][_0x9789('0x41')];}if(_0x5487cc['account'][_0x9789('0x42')]&&_0x5487cc['account']['List'][_0x9789('0x3f')][_0x9789('0x48')]){return _0x5487cc[_0x9789('0x3c')][_0x9789('0x42')]['Contacts'][0x0];}var _0x4ac7e5=_[_0x9789('0xd')](_0x3ecccf[_0x9789('0x2a')],{'firstName':_0x3ecccf[_0x9789('0x2a')]['from'],'ListId':_0x2707f8[_0x9789('0x33')]});_0x4ac7e5[_0x3ecccf[_0x9789('0x2a')][_0x9789('0x38')]]=_0x3ecccf[_0x9789('0x2a')][_0x9789('0x35')];return db[_0x9789('0x3e')][_0x9789('0x49')](_0x4ac7e5,{'fields':_0x404496,'raw':!![]});}})[_0x9789('0x12')](function(_0x1e2ff0){_0x5487cc[_0x9789('0x4a')]=_0x1e2ff0;if(_0x1e2ff0){var _0x31d535={'ContactId':_0x1e2ff0['id'],'FaxAccountId':_0x3ecccf[_0x9789('0x3c')]['id'],'fax':_0x1e2ff0['fax']};return db['FaxInteraction'][_0x9789('0x3b')]({'where':{'ContactId':_0x1e2ff0['id'],'closed':![],'FaxAccountId':_0x3ecccf['account']['id']}})[_0x9789('0x12')](function(_0x37ce0a){if(_0x37ce0a){return[_0x37ce0a,![]];}return db[_0x9789('0x4b')][_0x9789('0x49')](_0x31d535)[_0x9789('0x12')](function(_0x37b798){return[_0x37b798,!![]];});});}else{throw new Error(_0x9789('0x4c'));}})[_0x9789('0x4d')](function(_0x58b228,_0x4bfe9d){var _0x2eedd7=_0x58b228[_0x9789('0x43')]({'plain':!![]});if(_0x4bfe9d){if(_0x5487cc[_0x9789('0x3c')][_0x9789('0x4e')]){_0x5487cc[_0x9789('0x44')]['push']({'id':0x0,'priority':_0x5487cc[_0x9789('0x44')][_0x9789('0x48')]+0x1,'app':_0x9789('0x4f'),'appdata':_0x9789('0x50'),'interval':'*,*,*,*'});}_0x2eedd7['created']=!![];}else{_0x2eedd7[_0x9789('0x51')]=![];}_0x5487cc['interaction']=_0x2eedd7;return db[_0x9789('0x52')][_0x9789('0x49')]({'body':_0x3ecccf[_0x9789('0x2a')][_0x9789('0x2a')],'FaxAccountId':_0x3ecccf[_0x9789('0x3c')]['id'],'FaxInteractionId':_0x58b228['id'],'direction':'in','ContactId':_0x58b228[_0x9789('0x53')],'AttachmentId':_0x3ecccf[_0x9789('0x2a')]['AttachmentId']});})[_0x9789('0x12')](function(_0x4f6da9){_0x5487cc['message']=_0x4f6da9;if(_0x5487cc['interaction'][_0x9789('0x54')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x5487cc[_0x9789('0x55')]['UserId']}})['then'](function(_0x125f58){if(_0x125f58){_0x5487cc[_0x9789('0x44')][_0x9789('0x56')]({'id':0x0,'priority':0x0,'app':_0x9789('0x57'),'appdata':_0x125f58[_0x9789('0x58')]+','+(_0x5487cc[_0x9789('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0x9789('0x59')});}return respondWithRpcPromise(_0x9789('0x5a'),_0x9789('0x5b'),_0x5487cc);});}return respondWithRpcPromise('Start','startRouting',_0x5487cc);})['then'](function(_0x4daa21){_0x59eb2e(_0x4daa21);})[_0x9789('0x1d')](function(_0x3eb239){_0x9c0d65(_0x47732f[_0x9789('0x17')](0x1f4,_0x3eb239[_0x9789('0x1a')]));});});}; \ No newline at end of file +var _0x6a72=['contact','fax','find','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','User','name','UserId','agent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','CmList','List','Contacts','FaxApplication','Applications','account','applications','priority','asc','length','create'];(function(_0x5bd044,_0xafd5fa){var _0x582fd7=function(_0x1accb9){while(--_0x1accb9){_0x5bd044['push'](_0x5bd044['shift']());}};_0x582fd7(++_0xafd5fa);}(_0x6a72,0x1ec));var _0x26a7=function(_0x87cb2b,_0x33c1a6){_0x87cb2b=_0x87cb2b-0x0;var _0x152d0d=_0x6a72[_0x87cb2b];return _0x152d0d;};'use strict';var _=require('lodash');var util=require(_0x26a7('0x0'));var moment=require('moment');var BPromise=require(_0x26a7('0x1'));var rs=require(_0x26a7('0x2'));var fs=require('fs');var Redis=require(_0x26a7('0x3'));var db=require(_0x26a7('0x4'))['db'];var utils=require(_0x26a7('0x5'));var logger=require(_0x26a7('0x6'))(_0x26a7('0x7'));var config=require(_0x26a7('0x8'));var jayson=require(_0x26a7('0x9'));var client=jayson['client'][_0x26a7('0xa')]({'port':0x232c});config['redis']=_[_0x26a7('0xb')](config['redis'],{'host':_0x26a7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x26a7('0xd')]));require(_0x26a7('0xe'))[_0x26a7('0xf')](socket);function respondWithRpcPromise(_0x48165f,_0xa02516,_0x3a65dc){return new BPromise(function(_0xf76092,_0x4274fe){return client[_0x26a7('0x10')](_0x48165f,_0x3a65dc)[_0x26a7('0x11')](function(_0x4c666e){logger[_0x26a7('0x12')](_0x26a7('0x13'),_0xa02516,_0x26a7('0x14'));logger[_0x26a7('0x15')](_0x26a7('0x16'),_0xa02516,'request\x20sent',JSON['stringify'](_0x4c666e));if(_0x4c666e[_0x26a7('0x17')]){if(_0x4c666e[_0x26a7('0x17')][_0x26a7('0x18')]===0x1f4){logger[_0x26a7('0x17')](_0x26a7('0x13'),_0xa02516,_0x4c666e[_0x26a7('0x17')]['message']);return _0x4274fe(_0x4c666e[_0x26a7('0x17')][_0x26a7('0x19')]);}logger[_0x26a7('0x17')](_0x26a7('0x13'),_0xa02516,_0x4c666e['error'][_0x26a7('0x19')]);return _0xf76092(_0x4c666e['error'][_0x26a7('0x19')]);}else{logger['info'](_0x26a7('0x13'),_0xa02516,_0x26a7('0x14'));_0xf76092(_0x4c666e[_0x26a7('0x1a')][_0x26a7('0x19')]);}})[_0x26a7('0x1b')](function(_0x56f2a4){logger[_0x26a7('0x17')](_0x26a7('0x13'),_0xa02516,_0x56f2a4);_0x4274fe(_0x56f2a4);});});}exports[_0x26a7('0x1c')]=function(_0x25769e){var _0x370539=this;return new Promise(function(_0x233998,_0x5c293e){return db['FaxAccount'][_0x26a7('0x1d')]({'raw':_0x25769e[_0x26a7('0x1e')]?_0x25769e['options'][_0x26a7('0x1f')]===undefined?!![]:![]:!![],'where':_0x25769e[_0x26a7('0x1e')]?_0x25769e[_0x26a7('0x1e')][_0x26a7('0x20')]||null:null,'attributes':_0x25769e[_0x26a7('0x1e')]?_0x25769e[_0x26a7('0x1e')][_0x26a7('0x21')]||null:null,'limit':_0x25769e[_0x26a7('0x1e')]?_0x25769e['options'][_0x26a7('0x22')]||null:null,'include':_0x25769e['options']?_0x25769e[_0x26a7('0x1e')][_0x26a7('0x23')]?_[_0x26a7('0x24')](_0x25769e[_0x26a7('0x1e')][_0x26a7('0x23')],function(_0x1bd9eb){return{'model':db[_0x1bd9eb[_0x26a7('0x25')]],'as':_0x1bd9eb['as'],'attributes':_0x1bd9eb['attributes'],'include':_0x1bd9eb[_0x26a7('0x23')]?_['map'](_0x1bd9eb['include'],function(_0x2235f5){return{'model':db[_0x2235f5['model']],'as':_0x2235f5['as'],'attributes':_0x2235f5[_0x26a7('0x21')],'include':_0x2235f5[_0x26a7('0x23')]?_[_0x26a7('0x24')](_0x2235f5['include'],function(_0x55a5f6){return{'model':db[_0x55a5f6[_0x26a7('0x25')]],'as':_0x55a5f6['as'],'attributes':_0x55a5f6[_0x26a7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40cae8){logger[_0x26a7('0x12')]('GetFaxAccount',_0x25769e);logger[_0x26a7('0x15')](_0x26a7('0x1c'),_0x25769e,JSON[_0x26a7('0x26')](_0x40cae8));_0x233998(_0x40cae8);})['catch'](function(_0x45ecea){logger[_0x26a7('0x17')](_0x26a7('0x1c'),_0x45ecea[_0x26a7('0x19')],_0x25769e);_0x5c293e(_0x370539[_0x26a7('0x17')](0x1f4,_0x45ecea['message']));});});};exports[_0x26a7('0x27')]=function(_0x538c87,_0x480177,_0x6b8aeb){var _0x477ff2=this;return new Promise(function(_0x1abee1,_0x53d848){var _0x300a22={'body':_0x538c87[_0x26a7('0x28')],'channel':'fax'};var _0x5cbfac=[];var _0x45827e=[];var _0x42b35b={};return db[_0x26a7('0x29')][_0x26a7('0x2a')]()[_0x26a7('0x11')](function(_0x5a74f2){if(!_0x5a74f2){throw new db[(_0x26a7('0x2b'))]['ValidationError'](_0x26a7('0x2c'));}_0x5cbfac=_[_0x26a7('0x2d')](_[_0x26a7('0x2e')](_0x5a74f2),[_0x26a7('0x2f'),_0x26a7('0x30')]);_0x45827e=_['difference'](_[_0x26a7('0x2e')](_0x5a74f2),[_0x26a7('0x2f'),_0x26a7('0x30'),_0x26a7('0x31'),_0x26a7('0x32')]);if(_0x538c87[_0x26a7('0x28')]['id']){delete _0x538c87[_0x26a7('0x28')]['id'];}if(_[_0x26a7('0x33')](_0x538c87[_0x26a7('0x28')][_0x26a7('0x34')])){throw new db['Sequelize']['ValidationError'](_0x26a7('0x35'));}if(_['isNil'](_0x538c87[_0x26a7('0x28')]['body'])||_0x538c87[_0x26a7('0x28')][_0x26a7('0x28')]===''){throw new db[(_0x26a7('0x2b'))][(_0x26a7('0x36'))](_0x26a7('0x37'));}if(_[_0x26a7('0x33')](_0x538c87['body'][_0x26a7('0x38')])){throw new db[(_0x26a7('0x2b'))][(_0x26a7('0x36'))](_0x26a7('0x39')+_0x45827e);}if(!_[_0x26a7('0x3a')](_0x45827e,_0x538c87[_0x26a7('0x28')][_0x26a7('0x38')])){throw new db[(_0x26a7('0x2b'))][(_0x26a7('0x36'))](_0x26a7('0x3b')+_0x45827e);}_0x42b35b[_0x538c87[_0x26a7('0x28')]['mapKey']]=_0x538c87['body']['from'];})[_0x26a7('0x11')](function(){return db[_0x26a7('0x3c')]['find']({'where':{'id':_0x538c87['account']['id']},'include':[{'model':db[_0x26a7('0x3d')],'as':_0x26a7('0x3e'),'include':[{'model':db['CmContact'],'as':_0x26a7('0x3f'),'where':_0x42b35b,'limit':0x1,'order':[[_0x26a7('0x30'),'DESC']]}]},{'model':db[_0x26a7('0x40')],'as':_0x26a7('0x41')}]});})[_0x26a7('0x11')](function(_0x1d0504){if(_0x1d0504&&_0x1d0504['List']){var _0x5dd331=_0x1d0504['get']({'plain':!![]});_0x300a22[_0x26a7('0x42')]=_0x5dd331;_0x300a22[_0x26a7('0x43')]=_0x5dd331[_0x26a7('0x41')];_0x300a22['list']=_0x5dd331[_0x26a7('0x3e')];_0x300a22[_0x26a7('0x43')]=_['orderBy'](_0x300a22[_0x26a7('0x43')],[_0x26a7('0x44')],[_0x26a7('0x45')]);if(_0x300a22[_0x26a7('0x42')][_0x26a7('0x41')]){delete _0x300a22[_0x26a7('0x42')][_0x26a7('0x41')];}if(_0x300a22[_0x26a7('0x42')]['List']&&_0x300a22[_0x26a7('0x42')][_0x26a7('0x3e')][_0x26a7('0x3f')][_0x26a7('0x46')]){return _0x300a22['account'][_0x26a7('0x3e')][_0x26a7('0x3f')][0x0];}var _0x13ef6b=_[_0x26a7('0xb')](_0x538c87['body'],{'firstName':_0x538c87[_0x26a7('0x28')][_0x26a7('0x34')],'ListId':_0x5dd331[_0x26a7('0x32')]});_0x13ef6b[_0x538c87['body'][_0x26a7('0x38')]]=_0x538c87[_0x26a7('0x28')][_0x26a7('0x34')];return db[_0x26a7('0x29')][_0x26a7('0x47')](_0x13ef6b,{'fields':_0x5cbfac,'raw':!![]});}})[_0x26a7('0x11')](function(_0x56f68b){_0x300a22[_0x26a7('0x48')]=_0x56f68b;if(_0x56f68b){var _0x3e4d66={'ContactId':_0x56f68b['id'],'FaxAccountId':_0x538c87[_0x26a7('0x42')]['id'],'fax':_0x56f68b[_0x26a7('0x49')]};return db['FaxInteraction'][_0x26a7('0x4a')]({'where':{'ContactId':_0x56f68b['id'],'closed':![],'FaxAccountId':_0x538c87[_0x26a7('0x42')]['id']}})['then'](function(_0x1483d1){if(_0x1483d1){return[_0x1483d1,![]];}return db[_0x26a7('0x4b')][_0x26a7('0x47')](_0x3e4d66)[_0x26a7('0x11')](function(_0xe16d1d){return[_0xe16d1d,!![]];});});}else{throw new Error(_0x26a7('0x4c'));}})[_0x26a7('0x4d')](function(_0x50592f,_0x34721d){var _0x48c375=_0x50592f[_0x26a7('0x4e')]({'plain':!![]});if(_0x34721d){if(_0x300a22[_0x26a7('0x42')][_0x26a7('0x4f')]){_0x300a22[_0x26a7('0x43')][_0x26a7('0x50')]({'id':0x0,'priority':_0x300a22[_0x26a7('0x43')][_0x26a7('0x46')]+0x1,'app':_0x26a7('0x51'),'appdata':_0x26a7('0x52'),'interval':_0x26a7('0x53')});}_0x48c375[_0x26a7('0x54')]=!![];}else{_0x48c375['created']=![];}_0x300a22[_0x26a7('0x55')]=_0x48c375;return db['FaxMessage'][_0x26a7('0x47')]({'body':_0x538c87['body'][_0x26a7('0x28')],'FaxAccountId':_0x538c87[_0x26a7('0x42')]['id'],'FaxInteractionId':_0x50592f['id'],'direction':'in','ContactId':_0x50592f[_0x26a7('0x56')],'AttachmentId':_0x538c87[_0x26a7('0x28')][_0x26a7('0x57')]});})[_0x26a7('0x11')](function(_0x3520c2){_0x300a22[_0x26a7('0x19')]=_0x3520c2;if(_0x300a22[_0x26a7('0x55')]['UserId']){return db[_0x26a7('0x58')][_0x26a7('0x4a')]({'attributes':['id',_0x26a7('0x59')],'where':{'id':_0x300a22[_0x26a7('0x55')][_0x26a7('0x5a')]}})[_0x26a7('0x11')](function(_0x538558){if(_0x538558){_0x300a22['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x26a7('0x5b'),'appdata':_0x538558[_0x26a7('0x59')]+','+(_0x300a22[_0x26a7('0x42')]['waitForTheAssignedAgent']||0xa),'interval':_0x26a7('0x53')});}return respondWithRpcPromise(_0x26a7('0x5c'),_0x26a7('0x5d'),_0x300a22);});}return respondWithRpcPromise(_0x26a7('0x5c'),_0x26a7('0x5d'),_0x300a22);})[_0x26a7('0x11')](function(_0x29bf37){_0x1abee1(_0x29bf37);})['catch'](function(_0x2121a3){_0x53d848(_0x477ff2[_0x26a7('0x17')](0x1f4,_0x2121a3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6ba939c..0018df8 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 _0xbff5=['register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xbff5,0x1bc));var _0x5bff=function(_0x569398,_0x4c8853){_0x569398=_0x569398-0x0;var _0x503d75=_0xbff5[_0x569398];return _0x503d75;};'use strict';var FaxAccountEvents=require(_0x5bff('0x0'));var events=[_0x5bff('0x1'),_0x5bff('0x2'),_0x5bff('0x3')];function createListener(_0x41c38b,_0x43a41b){return function(_0x3bd90c){_0x43a41b['emit'](_0x41c38b,_0x3bd90c);};}function removeListener(_0x3868ae,_0x486083){return function(){FaxAccountEvents['removeListener'](_0x3868ae,_0x486083);};}exports[_0x5bff('0x4')]=function(_0x1d8650){for(var _0x151add=0x0,_0xa54c57=events[_0x5bff('0x5')];_0x151add<_0xa54c57;_0x151add++){var _0xd4b9dc=events[_0x151add];var _0x1acb49=createListener(_0x5bff('0x6')+_0xd4b9dc,_0x1d8650);FaxAccountEvents['on'](_0xd4b9dc,_0x1acb49);}}; \ No newline at end of file +var _0xb145=['register','length','faxAccount:','save','remove','update','emit','removeListener'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0xb145,0xa3));var _0x5b14=function(_0x349a6c,_0x51cecd){_0x349a6c=_0x349a6c-0x0;var _0x333984=_0xb145[_0x349a6c];return _0x333984;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x5b14('0x0'),_0x5b14('0x1'),_0x5b14('0x2')];function createListener(_0x1298e7,_0x40609d){return function(_0x3defa8){_0x40609d[_0x5b14('0x3')](_0x1298e7,_0x3defa8);};}function removeListener(_0x34b4cd,_0x5111cd){return function(){FaxAccountEvents[_0x5b14('0x4')](_0x34b4cd,_0x5111cd);};}exports[_0x5b14('0x5')]=function(_0x392425){for(var _0x4d82ad=0x0,_0x50fd91=events[_0x5b14('0x6')];_0x4d82ad<_0x50fd91;_0x4d82ad++){var _0x2a3921=events[_0x4d82ad];var _0x34530a=createListener(_0x5b14('0x7')+_0x2a3921,_0x392425);FaxAccountEvents['on'](_0x2a3921,_0x34530a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 49d262b..66e5a64 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 _0x47d0=['removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeAnswers'];(function(_0x5bcc94,_0x13b673){var _0x442dbf=function(_0x11bc92){while(--_0x11bc92){_0x5bcc94['push'](_0x5bcc94['shift']());}};_0x442dbf(++_0x13b673);}(_0x47d0,0x1ed));var _0x047d=function(_0x317bf7,_0x4afb15){_0x317bf7=_0x317bf7-0x0;var _0x27499d=_0x47d0[_0x317bf7];return _0x27499d;};'use strict';var multer=require(_0x047d('0x0'));var util=require(_0x047d('0x1'));var path=require(_0x047d('0x2'));var timeout=require(_0x047d('0x3'));var express=require(_0x047d('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x047d('0x5'));var config=require(_0x047d('0x6'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0x047d('0x7')](),controller[_0x047d('0x8')]);router[_0x047d('0x9')](_0x047d('0xa'),auth[_0x047d('0x7')](),controller[_0x047d('0xb')]);router[_0x047d('0x9')](_0x047d('0xc'),auth[_0x047d('0x7')](),controller[_0x047d('0xd')]);router['get'](_0x047d('0xe'),auth[_0x047d('0x7')](),controller[_0x047d('0xf')]);router[_0x047d('0x9')]('/:id/canned_answers',auth[_0x047d('0x7')](),controller[_0x047d('0x10')]);router[_0x047d('0x9')](_0x047d('0x11'),auth[_0x047d('0x7')](),controller[_0x047d('0x12')]);router['get'](_0x047d('0x13'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/messages',auth[_0x047d('0x7')](),controller[_0x047d('0x14')]);router[_0x047d('0x9')](_0x047d('0x15'),auth['isAuthenticated'](),controller[_0x047d('0x16')]);router[_0x047d('0x17')]('/',auth[_0x047d('0x7')](),controller[_0x047d('0x18')]);router[_0x047d('0x17')](_0x047d('0xe'),auth[_0x047d('0x7')](),controller[_0x047d('0x19')]);router[_0x047d('0x17')](_0x047d('0x1a'),auth[_0x047d('0x7')](),controller['addAnswer']);router[_0x047d('0x17')](_0x047d('0x11'),auth[_0x047d('0x7')](),controller[_0x047d('0x1b')]);router[_0x047d('0x17')]('/:id/applications',auth[_0x047d('0x7')](),controller[_0x047d('0x1c')]);router[_0x047d('0x17')](_0x047d('0x1d'),auth['isAuthenticated'](),controller[_0x047d('0x1e')]);router[_0x047d('0x17')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x047d('0x1f')]);router['post'](_0x047d('0x20'),auth[_0x047d('0x7')](),controller[_0x047d('0x21')]);router[_0x047d('0x17')](_0x047d('0x15'),auth[_0x047d('0x7')](),controller[_0x047d('0x22')]);router[_0x047d('0x23')](_0x047d('0xc'),auth[_0x047d('0x7')](),controller[_0x047d('0x24')]);router[_0x047d('0x25')](_0x047d('0xc'),auth[_0x047d('0x7')](),controller[_0x047d('0x26')]);router[_0x047d('0x25')](_0x047d('0xe'),auth[_0x047d('0x7')](),controller['removeDispositions']);router[_0x047d('0x25')](_0x047d('0x1a'),auth[_0x047d('0x7')](),controller[_0x047d('0x27')]);router['delete'](_0x047d('0x15'),auth[_0x047d('0x7')](),controller[_0x047d('0x28')]);module['exports']=router; \ No newline at end of file +var _0xafc7=['destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/interactions','getApplications','/:id/messages','/:id/users','getAgents','create','addDisposition','/:id/canned_answers','addAnswer','post','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','/:id','update'];(function(_0x10ea3a,_0x1909b6){var _0x3202a0=function(_0x2fb5bb){while(--_0x2fb5bb){_0x10ea3a['push'](_0x10ea3a['shift']());}};_0x3202a0(++_0x1909b6);}(_0xafc7,0xe9));var _0x7afc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xafc7[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7afc('0x0'));var util=require(_0x7afc('0x1'));var path=require(_0x7afc('0x2'));var timeout=require(_0x7afc('0x3'));var express=require('express');var router=express[_0x7afc('0x4')]();var auth=require(_0x7afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x7afc('0x6')]('/',auth[_0x7afc('0x7')](),controller[_0x7afc('0x8')]);router['get']('/describe',auth[_0x7afc('0x7')](),controller[_0x7afc('0x9')]);router[_0x7afc('0x6')]('/:id',auth[_0x7afc('0x7')](),controller[_0x7afc('0xa')]);router[_0x7afc('0x6')](_0x7afc('0xb'),auth['isAuthenticated'](),controller[_0x7afc('0xc')]);router[_0x7afc('0x6')]('/:id/canned_answers',auth[_0x7afc('0x7')](),controller['getAnswers']);router[_0x7afc('0x6')](_0x7afc('0xd'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x7afc('0x6')]('/:id/applications',auth[_0x7afc('0x7')](),controller[_0x7afc('0xe')]);router[_0x7afc('0x6')](_0x7afc('0xf'),auth[_0x7afc('0x7')](),controller['getMessages']);router[_0x7afc('0x6')](_0x7afc('0x10'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x11')]);router['post']('/',auth[_0x7afc('0x7')](),controller[_0x7afc('0x12')]);router['post'](_0x7afc('0xb'),auth['isAuthenticated'](),controller[_0x7afc('0x13')]);router['post'](_0x7afc('0x14'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x15')]);router[_0x7afc('0x16')](_0x7afc('0xd'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x17')]);router[_0x7afc('0x16')]('/:id/applications',auth[_0x7afc('0x7')](),controller['addApplications']);router[_0x7afc('0x16')](_0x7afc('0x18'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x19')]);router[_0x7afc('0x16')](_0x7afc('0x1a'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x1b')]);router['post'](_0x7afc('0x1c'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x1d')]);router[_0x7afc('0x16')](_0x7afc('0x10'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x1e')]);router['put'](_0x7afc('0x1f'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x20')]);router['delete'](_0x7afc('0x1f'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x21')]);router[_0x7afc('0x22')](_0x7afc('0xb'),auth[_0x7afc('0x7')](),controller[_0x7afc('0x23')]);router[_0x7afc('0x22')](_0x7afc('0x14'),auth['isAuthenticated'](),controller[_0x7afc('0x24')]);router[_0x7afc('0x22')](_0x7afc('0x10'),auth[_0x7afc('0x7')](),controller['removeAgents']);module[_0x7afc('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 2b6abae..975b3e4 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 _0xd916=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x58474e,_0x3d6b7e){var _0x2aee7b=function(_0x4b01e8){while(--_0x4b01e8){_0x58474e['push'](_0x58474e['shift']());}};_0x2aee7b(++_0x3d6b7e);}(_0xd916,0x18a));var _0x6d91=function(_0x3e1fe8,_0x223c26){_0x3e1fe8=_0x3e1fe8-0x0;var _0x55d8e5=_0xd916[_0x3e1fe8];return _0x55d8e5;};'use strict';var Sequelize=require(_0x6d91('0x0'));module[_0x6d91('0x1')]={'priority':{'type':Sequelize[_0x6d91('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6d91('0x3')],'allowNull':![],'defaultValue':_0x6d91('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6d91('0x3')]},'interval':{'type':Sequelize[_0x6d91('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfb11=['TEXT','sequelize','INTEGER','STRING'];(function(_0x5764f0,_0x2598ef){var _0x336ac5=function(_0x55e333){while(--_0x55e333){_0x5764f0['push'](_0x5764f0['shift']());}};_0x336ac5(++_0x2598ef);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xfb11[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1fb1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1fb1('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1fb1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1fb1('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6647210..68bda05 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 _0x3c0b=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0x3c0b,0xef));var _0xb3c0=function(_0x10e5de,_0x31a689){_0x10e5de=_0x10e5de-0x0;var _0x1758af=_0x3c0b[_0x10e5de];return _0x1758af;};'use strict';var pdf=require(_0xb3c0('0x0'));var emlformat=require(_0xb3c0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c0('0x2'));var rp=require(_0xb3c0('0x3'));var moment=require(_0xb3c0('0x4'));var BPromise=require(_0xb3c0('0x5'));var Mustache=require(_0xb3c0('0x6'));var util=require(_0xb3c0('0x7'));var path=require('path');var sox=require(_0xb3c0('0x8'));var csv=require(_0xb3c0('0x9'));var ejs=require(_0xb3c0('0xa'));var fs=require('fs');var _=require(_0xb3c0('0xb'));var squel=require(_0xb3c0('0xc'));var crypto=require(_0xb3c0('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb3c0('0x9'));var querystring=require('querystring');var Papa=require(_0xb3c0('0xe'));var Redis=require(_0xb3c0('0xf'));var authService=require(_0xb3c0('0x10'));var qs=require(_0xb3c0('0x11'));var as=require(_0xb3c0('0x12'));var hardwareService=require(_0xb3c0('0x13'));var logger=require('../../config/logger')(_0xb3c0('0x14'));var utils=require(_0xb3c0('0x15'));var config=require(_0xb3c0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3c0('0x17'))['db'];function respondWithStatusCode(_0x17a4e1,_0x378542){_0x378542=_0x378542||0xcc;return function(_0x556d85){if(_0x556d85){return _0x17a4e1[_0xb3c0('0x18')](_0x378542);}return _0x17a4e1[_0xb3c0('0x19')](_0x378542)[_0xb3c0('0x1a')]();};}function respondWithResult(_0x271279,_0x120cd3){_0x120cd3=_0x120cd3||0xc8;return function(_0x38fb50){if(_0x38fb50){return _0x271279[_0xb3c0('0x19')](_0x120cd3)['json'](_0x38fb50);}};}function respondWithFilteredResult(_0x11a97b,_0xcfbc3b){return function(_0x2ae298){if(_0x2ae298){var _0x609a2=_0x2ae298[_0xb3c0('0x1b')],_0x494875=_0xcfbc3b[_0xb3c0('0x1c')],_0x5cc644=_0xcfbc3b[_0xb3c0('0x1c')]+_0xcfbc3b[_0xb3c0('0x1d')],_0x2c7fed;if(_0x5cc644>=_0x609a2){_0x5cc644=_0x609a2;_0x2c7fed=0xc8;}else{_0x2c7fed=0xce;}_0x11a97b[_0xb3c0('0x19')](_0x2c7fed);return _0x11a97b['set'](_0xb3c0('0x1e'),_0x494875+'-'+_0x5cc644+'/'+_0x609a2)[_0xb3c0('0x1f')](_0x2ae298);}return null;};}function patchUpdates(_0x183c2e){return function(_0x34d299){try{jsonpatch['apply'](_0x34d299,_0x183c2e,!![]);}catch(_0x5ed0e6){return BPromise[_0xb3c0('0x20')](_0x5ed0e6);}return _0x34d299[_0xb3c0('0x21')]();};}function saveUpdates(_0x24b7ad,_0x23e037){return function(_0xca2722){if(_0xca2722){return _0xca2722[_0xb3c0('0x22')](_0x24b7ad)[_0xb3c0('0x23')](function(_0x53ffc2){return _0x53ffc2;});}return null;};}function removeEntity(_0x3fe0a7,_0x6cb71b){return function(_0x371bd7){if(_0x371bd7){return _0x371bd7[_0xb3c0('0x24')]()[_0xb3c0('0x23')](function(){_0x3fe0a7[_0xb3c0('0x19')](0xcc)[_0xb3c0('0x1a')]();});}};}function handleEntityNotFound(_0x34b8c3,_0x1d1b8c){return function(_0x2da926){if(!_0x2da926){_0x34b8c3[_0xb3c0('0x18')](0x194);}return _0x2da926;};}function handleError(_0x38bd88,_0x4b201e){_0x4b201e=_0x4b201e||0x1f4;return function(_0x8a9a23){logger[_0xb3c0('0x25')](_0x8a9a23['stack']);if(_0x8a9a23[_0xb3c0('0x26')]){delete _0x8a9a23[_0xb3c0('0x26')];}_0x38bd88['status'](_0x4b201e)[_0xb3c0('0x27')](_0x8a9a23);};}exports[_0xb3c0('0x28')]=function(_0x208255,_0x184440){var _0x1b2789={},_0x3e61cd={},_0x8927c1={'count':0x0,'rows':[]};var _0x544de4=_[_0xb3c0('0x29')](db[_0xb3c0('0x2a')][_0xb3c0('0x2b')],function(_0xa0d00f){return{'name':_0xa0d00f[_0xb3c0('0x2c')],'type':_0xa0d00f[_0xb3c0('0x2d')]['key']};});_0x3e61cd[_0xb3c0('0x2e')]=_[_0xb3c0('0x29')](_0x544de4,_0xb3c0('0x26'));_0x3e61cd[_0xb3c0('0x2f')]=_[_0xb3c0('0x30')](_0x208255[_0xb3c0('0x2f')]);_0x3e61cd[_0xb3c0('0x31')]=_[_0xb3c0('0x32')](_0x3e61cd['model'],_0x3e61cd[_0xb3c0('0x2f')]);_0x1b2789[_0xb3c0('0x33')]=_[_0xb3c0('0x32')](_0x3e61cd[_0xb3c0('0x2e')],qs['fields'](_0x208255[_0xb3c0('0x2f')][_0xb3c0('0x34')]));_0x1b2789[_0xb3c0('0x33')]=_0x1b2789[_0xb3c0('0x33')][_0xb3c0('0x35')]?_0x1b2789[_0xb3c0('0x33')]:_0x3e61cd[_0xb3c0('0x2e')];if(!_0x208255['query'][_0xb3c0('0x36')](_0xb3c0('0x37'))){_0x1b2789[_0xb3c0('0x1d')]=qs[_0xb3c0('0x1d')](_0x208255['query']['limit']);_0x1b2789[_0xb3c0('0x1c')]=qs[_0xb3c0('0x1c')](_0x208255[_0xb3c0('0x2f')][_0xb3c0('0x1c')]);}_0x1b2789[_0xb3c0('0x38')]=qs['sort'](_0x208255[_0xb3c0('0x2f')]['sort']);_0x1b2789[_0xb3c0('0x39')]=qs[_0xb3c0('0x31')](_[_0xb3c0('0x3a')](_0x208255[_0xb3c0('0x2f')],_0x3e61cd[_0xb3c0('0x31')]),_0x544de4);if(_0x208255[_0xb3c0('0x2f')]['filter']){_0x1b2789[_0xb3c0('0x39')]=_[_0xb3c0('0x3b')](_0x1b2789[_0xb3c0('0x39')],{'$or':_[_0xb3c0('0x29')](_0x544de4,function(_0x212c72){if(_0x212c72[_0xb3c0('0x2d')]!==_0xb3c0('0x3c')){var _0x2a8cde={};_0x2a8cde[_0x212c72[_0xb3c0('0x26')]]={'$like':'%'+_0x208255[_0xb3c0('0x2f')][_0xb3c0('0x3d')]+'%'};return _0x2a8cde;}})});}_0x1b2789=_[_0xb3c0('0x3b')]({},_0x1b2789,_0x208255['options']);var _0x4201cc={'where':_0x1b2789[_0xb3c0('0x39')]};return db[_0xb3c0('0x2a')][_0xb3c0('0x1b')](_0x4201cc)[_0xb3c0('0x23')](function(_0x238e1b){_0x8927c1['count']=_0x238e1b;if(_0x208255[_0xb3c0('0x2f')][_0xb3c0('0x3e')]){_0x1b2789[_0xb3c0('0x3f')]=[{'all':!![]}];}return db[_0xb3c0('0x2a')]['findAll'](_0x1b2789);})['then'](function(_0x2ffb3f){_0x8927c1[_0xb3c0('0x40')]=_0x2ffb3f;return _0x8927c1;})[_0xb3c0('0x23')](respondWithFilteredResult(_0x184440,_0x1b2789))[_0xb3c0('0x41')](handleError(_0x184440,null));};exports[_0xb3c0('0x42')]=function(_0x4ca103,_0x4e858a){var _0x3656a5={'raw':!![],'where':{'id':_0x4ca103[_0xb3c0('0x43')]['id']}},_0x3412e3={};_0x3412e3[_0xb3c0('0x2e')]=_['keys'](db['FaxApplication'][_0xb3c0('0x2b')]);_0x3412e3[_0xb3c0('0x2f')]=_[_0xb3c0('0x30')](_0x4ca103[_0xb3c0('0x2f')]);_0x3412e3[_0xb3c0('0x31')]=_[_0xb3c0('0x32')](_0x3412e3[_0xb3c0('0x2e')],_0x3412e3['query']);_0x3656a5['attributes']=_['intersection'](_0x3412e3[_0xb3c0('0x2e')],qs['fields'](_0x4ca103[_0xb3c0('0x2f')]['fields']));_0x3656a5['attributes']=_0x3656a5[_0xb3c0('0x33')][_0xb3c0('0x35')]?_0x3656a5[_0xb3c0('0x33')]:_0x3412e3['model'];if(_0x4ca103[_0xb3c0('0x2f')][_0xb3c0('0x3e')]){_0x3656a5['include']=[{'all':!![]}];}_0x3656a5=_[_0xb3c0('0x3b')]({},_0x3656a5,_0x4ca103[_0xb3c0('0x44')]);return db[_0xb3c0('0x2a')][_0xb3c0('0x45')](_0x3656a5)[_0xb3c0('0x23')](handleEntityNotFound(_0x4e858a,null))[_0xb3c0('0x23')](respondWithResult(_0x4e858a,null))[_0xb3c0('0x41')](handleError(_0x4e858a,null));};exports[_0xb3c0('0x46')]=function(_0x418f6a,_0x168d14){return db['FaxApplication']['create'](_0x418f6a[_0xb3c0('0x47')],{})['then'](respondWithResult(_0x168d14,0xc9))[_0xb3c0('0x41')](handleError(_0x168d14,null));};exports['update']=function(_0x48e019,_0x5a9a21){if(_0x48e019[_0xb3c0('0x47')]['id']){delete _0x48e019['body']['id'];}return db[_0xb3c0('0x2a')][_0xb3c0('0x45')]({'where':{'id':_0x48e019[_0xb3c0('0x43')]['id']}})[_0xb3c0('0x23')](handleEntityNotFound(_0x5a9a21,null))[_0xb3c0('0x23')](saveUpdates(_0x48e019[_0xb3c0('0x47')],null))['then'](respondWithResult(_0x5a9a21,null))['catch'](handleError(_0x5a9a21,null));};exports['destroy']=function(_0x402b61,_0xa8d52a){return db['FaxApplication']['find']({'where':{'id':_0x402b61[_0xb3c0('0x43')]['id']}})[_0xb3c0('0x23')](handleEntityNotFound(_0xa8d52a,null))[_0xb3c0('0x23')](removeEntity(_0xa8d52a,null))['catch'](handleError(_0xa8d52a,null));}; \ No newline at end of file +var _0xafc4=['options','includeAll','include','catch','show','params','fields','length','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x5931e3,_0x1ef024){var _0x27e81f=function(_0x4b72dc){while(--_0x4b72dc){_0x5931e3['push'](_0x5931e3['shift']());}};_0x27e81f(++_0x1ef024);}(_0xafc4,0x1da));var _0x4afc=function(_0x45f988,_0x4354db){_0x45f988=_0x45f988-0x0;var _0x19c2f8=_0xafc4[_0x45f988];return _0x19c2f8;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require(_0x4afc('0x1'));var rimraf=require(_0x4afc('0x2'));var zipdir=require(_0x4afc('0x3'));var jsonpatch=require(_0x4afc('0x4'));var rp=require(_0x4afc('0x5'));var moment=require(_0x4afc('0x6'));var BPromise=require(_0x4afc('0x7'));var Mustache=require(_0x4afc('0x8'));var util=require('util');var path=require(_0x4afc('0x9'));var sox=require(_0x4afc('0xa'));var csv=require('to-csv');var ejs=require(_0x4afc('0xb'));var fs=require('fs');var _=require(_0x4afc('0xc'));var squel=require(_0x4afc('0xd'));var crypto=require(_0x4afc('0xe'));var jsforce=require(_0x4afc('0xf'));var deskjs=require(_0x4afc('0x10'));var toCsv=require(_0x4afc('0x11'));var querystring=require(_0x4afc('0x12'));var Papa=require(_0x4afc('0x13'));var Redis=require(_0x4afc('0x14'));var authService=require(_0x4afc('0x15'));var qs=require(_0x4afc('0x16'));var as=require(_0x4afc('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4afc('0x18'));var utils=require('../../config/utils');var config=require(_0x4afc('0x19'));var licenseUtil=require(_0x4afc('0x1a'));var db=require(_0x4afc('0x1b'))['db'];function respondWithStatusCode(_0x7bb3b2,_0x5d1cc0){_0x5d1cc0=_0x5d1cc0||0xcc;return function(_0x27143e){if(_0x27143e){return _0x7bb3b2[_0x4afc('0x1c')](_0x5d1cc0);}return _0x7bb3b2[_0x4afc('0x1d')](_0x5d1cc0)[_0x4afc('0x1e')]();};}function respondWithResult(_0x119da3,_0xf517d){_0xf517d=_0xf517d||0xc8;return function(_0x21f61b){if(_0x21f61b){return _0x119da3[_0x4afc('0x1d')](_0xf517d)[_0x4afc('0x1f')](_0x21f61b);}};}function respondWithFilteredResult(_0x123c55,_0x1b3e28){return function(_0x133461){if(_0x133461){var _0x1eec63=_0x133461[_0x4afc('0x20')],_0x4f8c12=_0x1b3e28[_0x4afc('0x21')],_0x54ca2e=_0x1b3e28[_0x4afc('0x21')]+_0x1b3e28['limit'],_0x5d90bb;if(_0x54ca2e>=_0x1eec63){_0x54ca2e=_0x1eec63;_0x5d90bb=0xc8;}else{_0x5d90bb=0xce;}_0x123c55[_0x4afc('0x1d')](_0x5d90bb);return _0x123c55[_0x4afc('0x22')](_0x4afc('0x23'),_0x4f8c12+'-'+_0x54ca2e+'/'+_0x1eec63)[_0x4afc('0x1f')](_0x133461);}return null;};}function patchUpdates(_0x57146a){return function(_0x3f0016){try{jsonpatch[_0x4afc('0x24')](_0x3f0016,_0x57146a,!![]);}catch(_0x3c30bd){return BPromise['reject'](_0x3c30bd);}return _0x3f0016[_0x4afc('0x25')]();};}function saveUpdates(_0x2685b1,_0x223d46){return function(_0x186260){if(_0x186260){return _0x186260[_0x4afc('0x26')](_0x2685b1)[_0x4afc('0x27')](function(_0x11b734){return _0x11b734;});}return null;};}function removeEntity(_0x38df5c,_0x12a9f2){return function(_0x3fa210){if(_0x3fa210){return _0x3fa210['destroy']()[_0x4afc('0x27')](function(){_0x38df5c[_0x4afc('0x1d')](0xcc)[_0x4afc('0x1e')]();});}};}function handleEntityNotFound(_0x34d37f,_0x16fa74){return function(_0x20942c){if(!_0x20942c){_0x34d37f['sendStatus'](0x194);}return _0x20942c;};}function handleError(_0x56d688,_0x28d3db){_0x28d3db=_0x28d3db||0x1f4;return function(_0x3fc21f){logger[_0x4afc('0x28')](_0x3fc21f['stack']);if(_0x3fc21f[_0x4afc('0x29')]){delete _0x3fc21f[_0x4afc('0x29')];}_0x56d688[_0x4afc('0x1d')](_0x28d3db)[_0x4afc('0x2a')](_0x3fc21f);};}exports[_0x4afc('0x2b')]=function(_0x4ab5b1,_0x4e926f){var _0x61364a={},_0x202f4b={},_0x19908d={'count':0x0,'rows':[]};var _0x173dbb=_[_0x4afc('0x2c')](db[_0x4afc('0x2d')][_0x4afc('0x2e')],function(_0x145a71){return{'name':_0x145a71[_0x4afc('0x2f')],'type':_0x145a71[_0x4afc('0x30')][_0x4afc('0x31')]};});_0x202f4b[_0x4afc('0x32')]=_[_0x4afc('0x2c')](_0x173dbb,_0x4afc('0x29'));_0x202f4b[_0x4afc('0x33')]=_[_0x4afc('0x34')](_0x4ab5b1['query']);_0x202f4b['filters']=_[_0x4afc('0x35')](_0x202f4b['model'],_0x202f4b[_0x4afc('0x33')]);_0x61364a[_0x4afc('0x36')]=_[_0x4afc('0x35')](_0x202f4b[_0x4afc('0x32')],qs['fields'](_0x4ab5b1['query']['fields']));_0x61364a[_0x4afc('0x36')]=_0x61364a[_0x4afc('0x36')]['length']?_0x61364a['attributes']:_0x202f4b[_0x4afc('0x32')];if(!_0x4ab5b1[_0x4afc('0x33')][_0x4afc('0x37')]('nolimit')){_0x61364a[_0x4afc('0x38')]=qs[_0x4afc('0x38')](_0x4ab5b1[_0x4afc('0x33')][_0x4afc('0x38')]);_0x61364a['offset']=qs[_0x4afc('0x21')](_0x4ab5b1[_0x4afc('0x33')]['offset']);}_0x61364a[_0x4afc('0x39')]=qs[_0x4afc('0x3a')](_0x4ab5b1[_0x4afc('0x33')][_0x4afc('0x3a')]);_0x61364a[_0x4afc('0x3b')]=qs[_0x4afc('0x3c')](_[_0x4afc('0x3d')](_0x4ab5b1[_0x4afc('0x33')],_0x202f4b[_0x4afc('0x3c')]),_0x173dbb);if(_0x4ab5b1[_0x4afc('0x33')][_0x4afc('0x3e')]){_0x61364a[_0x4afc('0x3b')]=_[_0x4afc('0x3f')](_0x61364a[_0x4afc('0x3b')],{'$or':_['map'](_0x173dbb,function(_0x1cf7c5){if(_0x1cf7c5['type']!==_0x4afc('0x40')){var _0xad66d3={};_0xad66d3[_0x1cf7c5[_0x4afc('0x29')]]={'$like':'%'+_0x4ab5b1[_0x4afc('0x33')]['filter']+'%'};return _0xad66d3;}})});}_0x61364a=_[_0x4afc('0x3f')]({},_0x61364a,_0x4ab5b1[_0x4afc('0x41')]);var _0xd21043={'where':_0x61364a[_0x4afc('0x3b')]};return db[_0x4afc('0x2d')]['count'](_0xd21043)['then'](function(_0x233e97){_0x19908d[_0x4afc('0x20')]=_0x233e97;if(_0x4ab5b1[_0x4afc('0x33')][_0x4afc('0x42')]){_0x61364a[_0x4afc('0x43')]=[{'all':!![]}];}return db[_0x4afc('0x2d')]['findAll'](_0x61364a);})[_0x4afc('0x27')](function(_0x45c751){_0x19908d['rows']=_0x45c751;return _0x19908d;})[_0x4afc('0x27')](respondWithFilteredResult(_0x4e926f,_0x61364a))[_0x4afc('0x44')](handleError(_0x4e926f,null));};exports[_0x4afc('0x45')]=function(_0x21001a,_0x2f203b){var _0x593caf={'raw':!![],'where':{'id':_0x21001a[_0x4afc('0x46')]['id']}},_0x11f6ee={};_0x11f6ee[_0x4afc('0x32')]=_[_0x4afc('0x34')](db['FaxApplication'][_0x4afc('0x2e')]);_0x11f6ee['query']=_[_0x4afc('0x34')](_0x21001a['query']);_0x11f6ee[_0x4afc('0x3c')]=_[_0x4afc('0x35')](_0x11f6ee[_0x4afc('0x32')],_0x11f6ee[_0x4afc('0x33')]);_0x593caf['attributes']=_[_0x4afc('0x35')](_0x11f6ee['model'],qs['fields'](_0x21001a['query'][_0x4afc('0x47')]));_0x593caf[_0x4afc('0x36')]=_0x593caf[_0x4afc('0x36')][_0x4afc('0x48')]?_0x593caf['attributes']:_0x11f6ee[_0x4afc('0x32')];if(_0x21001a['query']['includeAll']){_0x593caf['include']=[{'all':!![]}];}_0x593caf=_[_0x4afc('0x3f')]({},_0x593caf,_0x21001a[_0x4afc('0x41')]);return db[_0x4afc('0x2d')][_0x4afc('0x49')](_0x593caf)[_0x4afc('0x27')](handleEntityNotFound(_0x2f203b,null))[_0x4afc('0x27')](respondWithResult(_0x2f203b,null))[_0x4afc('0x44')](handleError(_0x2f203b,null));};exports[_0x4afc('0x4a')]=function(_0x1a2a56,_0x2cfba6){return db[_0x4afc('0x2d')][_0x4afc('0x4a')](_0x1a2a56[_0x4afc('0x4b')],{})['then'](respondWithResult(_0x2cfba6,0xc9))[_0x4afc('0x44')](handleError(_0x2cfba6,null));};exports[_0x4afc('0x26')]=function(_0x3da346,_0x1af45d){if(_0x3da346[_0x4afc('0x4b')]['id']){delete _0x3da346[_0x4afc('0x4b')]['id'];}return db[_0x4afc('0x2d')]['find']({'where':{'id':_0x3da346[_0x4afc('0x46')]['id']}})[_0x4afc('0x27')](handleEntityNotFound(_0x1af45d,null))['then'](saveUpdates(_0x3da346['body'],null))[_0x4afc('0x27')](respondWithResult(_0x1af45d,null))[_0x4afc('0x44')](handleError(_0x1af45d,null));};exports[_0x4afc('0x4c')]=function(_0x119b33,_0x27f836){return db[_0x4afc('0x2d')][_0x4afc('0x49')]({'where':{'id':_0x119b33[_0x4afc('0x46')]['id']}})[_0x4afc('0x27')](handleEntityNotFound(_0x27f836,null))[_0x4afc('0x27')](removeEntity(_0x27f836,null))[_0x4afc('0x44')](handleError(_0x27f836,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index a6391dd..de927fc 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 _0x4b31=['utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','utf8mb4'];(function(_0x261ef1,_0x4a0da5){var _0x141509=function(_0x4512ce){while(--_0x4512ce){_0x261ef1['push'](_0x261ef1['shift']());}};_0x141509(++_0x4a0da5);}(_0x4b31,0xf1));var _0x14b3=function(_0x36284b,_0x2b7436){_0x36284b=_0x36284b-0x0;var _0x23c34a=_0x4b31[_0x36284b];return _0x23c34a;};'use strict';var _=require(_0x14b3('0x0'));var util=require('util');var logger=require(_0x14b3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x14b3('0x2'));var rp=require(_0x14b3('0x3'));var fs=require('fs');var path=require(_0x14b3('0x4'));var rimraf=require(_0x14b3('0x5'));var config=require(_0x14b3('0x6'));var attributes=require(_0x14b3('0x7'));module['exports']=function(_0x2209ef,_0x7d67c5){return _0x2209ef[_0x14b3('0x8')](_0x14b3('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14b3('0xa'),'collate':_0x14b3('0xb')});}; \ No newline at end of file +var _0x08cc=['../../config/environment','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x08cc,0xcb));var _0xc08c=function(_0x1f75ed,_0x5b8610){_0x1f75ed=_0x1f75ed-0x0;var _0x1dc49d=_0x08cc[_0x1f75ed];return _0x1dc49d;};'use strict';var _=require(_0xc08c('0x0'));var util=require(_0xc08c('0x1'));var logger=require(_0xc08c('0x2'))(_0xc08c('0x3'));var moment=require('moment');var BPromise=require(_0xc08c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc08c('0x5'));var rimraf=require('rimraf');var config=require(_0xc08c('0x6'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5de39e,_0x1a0083){return _0x5de39e[_0xc08c('0x7')]('FaxApplication',attributes,{'tableName':_0xc08c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc08c('0x9'),'collate':_0xc08c('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 06f02a4..36b437e 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 _0x28cf=['info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5b818e,_0x4200d9){var _0x1d689f=function(_0x7c3799){while(--_0x7c3799){_0x5b818e['push'](_0x5b818e['shift']());}};_0x1d689f(++_0x4200d9);}(_0x28cf,0x165));var _0xf28c=function(_0x3de061,_0xfa3361){_0x3de061=_0x3de061-0x0;var _0x5c6ffe=_0x28cf[_0x3de061];return _0x5c6ffe;};'use strict';var _=require('lodash');var util=require(_0xf28c('0x0'));var moment=require(_0xf28c('0x1'));var BPromise=require(_0xf28c('0x2'));var rs=require(_0xf28c('0x3'));var fs=require('fs');var Redis=require(_0xf28c('0x4'));var db=require(_0xf28c('0x5'))['db'];var utils=require(_0xf28c('0x6'));var logger=require(_0xf28c('0x7'))(_0xf28c('0x8'));var config=require(_0xf28c('0x9'));var jayson=require(_0xf28c('0xa'));var client=jayson[_0xf28c('0xb')][_0xf28c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe65589,_0x3faaea,_0x5cfc06){return new BPromise(function(_0x51027b,_0x4f2dc6){return client[_0xf28c('0xd')](_0xe65589,_0x5cfc06)[_0xf28c('0xe')](function(_0x9fd238){logger[_0xf28c('0xf')](_0xf28c('0x10'),_0x3faaea,'request\x20sent');logger[_0xf28c('0x11')](_0xf28c('0x12'),_0x3faaea,_0xf28c('0x13'),JSON['stringify'](_0x9fd238));if(_0x9fd238[_0xf28c('0x14')]){if(_0x9fd238[_0xf28c('0x14')]['code']===0x1f4){logger['error'](_0xf28c('0x10'),_0x3faaea,_0x9fd238[_0xf28c('0x14')][_0xf28c('0x15')]);return _0x4f2dc6(_0x9fd238[_0xf28c('0x14')][_0xf28c('0x15')]);}logger[_0xf28c('0x14')](_0xf28c('0x10'),_0x3faaea,_0x9fd238[_0xf28c('0x14')][_0xf28c('0x15')]);return _0x51027b(_0x9fd238['error'][_0xf28c('0x15')]);}else{logger[_0xf28c('0xf')](_0xf28c('0x10'),_0x3faaea,'request\x20sent');_0x51027b(_0x9fd238[_0xf28c('0x16')][_0xf28c('0x15')]);}})[_0xf28c('0x17')](function(_0x4ed5c9){logger[_0xf28c('0x14')]('FaxApplication,\x20%s,\x20%s',_0x3faaea,_0x4ed5c9);_0x4f2dc6(_0x4ed5c9);});});}exports[_0xf28c('0x18')]=function(_0xeea8f9){var _0x3b0166=this;return new Promise(function(_0x3d6e68,_0x17719a){return db['FaxApplication'][_0xf28c('0x19')](_0xeea8f9[_0xf28c('0x1a')],{'raw':_0xeea8f9[_0xf28c('0x1b')]?_0xeea8f9[_0xf28c('0x1b')][_0xf28c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeea8f9[_0xf28c('0x1b')]?_0xeea8f9['options'][_0xf28c('0x1d')]||null:null,'attributes':_0xeea8f9[_0xf28c('0x1b')]?_0xeea8f9[_0xf28c('0x1b')]['attributes']||null:null,'limit':_0xeea8f9[_0xf28c('0x1b')]?_0xeea8f9[_0xf28c('0x1b')][_0xf28c('0x1e')]||null:null})['then'](function(_0x219ea0){logger['info'](_0xf28c('0x18'),_0xeea8f9);logger[_0xf28c('0x11')]('UpdateFaxApplication',_0xeea8f9,JSON['stringify'](_0x219ea0));_0x3d6e68(_0x219ea0);})[_0xf28c('0x17')](function(_0x4da866){logger[_0xf28c('0x14')](_0xf28c('0x18'),_0x4da866['message'],_0xeea8f9);_0x17719a(_0x3b0166[_0xf28c('0x14')](0x1f4,_0x4da866['message']));});});}; \ No newline at end of file +var _0x8762=['FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x389875,_0x889deb){var _0x418114=function(_0x54a606){while(--_0x54a606){_0x389875['push'](_0x389875['shift']());}};_0x418114(++_0x889deb);}(_0x8762,0x19d));var _0x2876=function(_0x3fa199,_0xc0fcd){_0x3fa199=_0x3fa199-0x0;var _0x4595a7=_0x8762[_0x3fa199];return _0x4595a7;};'use strict';var _=require(_0x2876('0x0'));var util=require(_0x2876('0x1'));var moment=require(_0x2876('0x2'));var BPromise=require(_0x2876('0x3'));var rs=require(_0x2876('0x4'));var fs=require('fs');var Redis=require(_0x2876('0x5'));var db=require(_0x2876('0x6'))['db'];var utils=require(_0x2876('0x7'));var logger=require(_0x2876('0x8'))(_0x2876('0x9'));var config=require(_0x2876('0xa'));var jayson=require(_0x2876('0xb'));var client=jayson[_0x2876('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x500a20,_0x55f6fb,_0x3c9425){return new BPromise(function(_0x1d0bfc,_0x16a307){return client[_0x2876('0xd')](_0x500a20,_0x3c9425)[_0x2876('0xe')](function(_0x4f0ac1){logger[_0x2876('0xf')](_0x2876('0x10'),_0x55f6fb,_0x2876('0x11'));logger['debug'](_0x2876('0x12'),_0x55f6fb,_0x2876('0x11'),JSON['stringify'](_0x4f0ac1));if(_0x4f0ac1[_0x2876('0x13')]){if(_0x4f0ac1[_0x2876('0x13')][_0x2876('0x14')]===0x1f4){logger[_0x2876('0x13')](_0x2876('0x10'),_0x55f6fb,_0x4f0ac1['error'][_0x2876('0x15')]);return _0x16a307(_0x4f0ac1[_0x2876('0x13')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x55f6fb,_0x4f0ac1[_0x2876('0x13')][_0x2876('0x15')]);return _0x1d0bfc(_0x4f0ac1['error'][_0x2876('0x15')]);}else{logger[_0x2876('0xf')](_0x2876('0x10'),_0x55f6fb,_0x2876('0x11'));_0x1d0bfc(_0x4f0ac1[_0x2876('0x16')][_0x2876('0x15')]);}})[_0x2876('0x17')](function(_0xa82539){logger[_0x2876('0x13')](_0x2876('0x10'),_0x55f6fb,_0xa82539);_0x16a307(_0xa82539);});});}exports[_0x2876('0x18')]=function(_0x2a6b97){var _0x198576=this;return new Promise(function(_0x467e45,_0xc6e49){return db[_0x2876('0x19')]['update'](_0x2a6b97['body'],{'raw':_0x2a6b97['options']?_0x2a6b97[_0x2876('0x1a')][_0x2876('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a6b97[_0x2876('0x1a')]?_0x2a6b97[_0x2876('0x1a')][_0x2876('0x1c')]||null:null,'attributes':_0x2a6b97[_0x2876('0x1a')]?_0x2a6b97[_0x2876('0x1a')][_0x2876('0x1d')]||null:null,'limit':_0x2a6b97[_0x2876('0x1a')]?_0x2a6b97['options'][_0x2876('0x1e')]||null:null})['then'](function(_0x5f5611){logger[_0x2876('0xf')](_0x2876('0x18'),_0x2a6b97);logger[_0x2876('0x1f')]('UpdateFaxApplication',_0x2a6b97,JSON[_0x2876('0x20')](_0x5f5611));_0x467e45(_0x5f5611);})[_0x2876('0x17')](function(_0x5bd0d0){logger[_0x2876('0x13')](_0x2876('0x18'),_0x5bd0d0[_0x2876('0x15')],_0x2a6b97);_0xc6e49(_0x198576[_0x2876('0x13')](0x1f4,_0x5bd0d0[_0x2876('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 584dc5b..edc6f54 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 _0x7da7=['util','path','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0x434804,_0x415f68){_0x434804=_0x434804-0x0;var _0x573fc8=_0x7da7[_0x434804];return _0x573fc8;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')]('/',auth[_0x77da('0x7')](),controller[_0x77da('0xc')]);router[_0x77da('0xd')]('/:id',auth[_0x77da('0x7')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id',auth[_0x77da('0x7')](),controller[_0x77da('0x10')]);module[_0x77da('0x11')]=router; \ No newline at end of file +var _0x5d17=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','exports','multer','util','express','Router'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x5d17,0x114));var _0x75d1=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x5d17[_0x4664db];return _0x5615b4;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x8')](),controller[_0x75d1('0xc')]);router['put']('/:id',auth[_0x75d1('0x8')](),controller['update']);router['delete'](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller['destroy']);module[_0x75d1('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 87ac25a..03c6f90 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 _0x737d=['ENUM','out','sequelize','exports','STRING','DATE'];(function(_0x1091cb,_0x3efe0e){var _0x3ad5b5=function(_0x128901){while(--_0x128901){_0x1091cb['push'](_0x1091cb['shift']());}};_0x3ad5b5(++_0x3efe0e);}(_0x737d,0xbc));var _0xd737=function(_0x42f1df,_0x114957){_0x42f1df=_0x42f1df-0x0;var _0x4cd294=_0x737d[_0x42f1df];return _0x4cd294;};'use strict';var Sequelize=require(_0xd737('0x0'));module[_0xd737('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd737('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd737('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd737('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6737=['DATE','exports','BOOLEAN','STRING','ENUM'];(function(_0x14aaae,_0x1a261){var _0x5a1189=function(_0x7673ce){while(--_0x7673ce){_0x14aaae['push'](_0x14aaae['shift']());}};_0x5a1189(++_0x1a261);}(_0x6737,0xe2));var _0x7673=function(_0x1794a1,_0x5ba658){_0x1794a1=_0x1794a1-0x0;var _0x41d7ae=_0x6737[_0x1794a1];return _0x41d7ae;};'use strict';var Sequelize=require('sequelize');module[_0x7673('0x0')]={'closed':{'type':Sequelize[_0x7673('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7673('0x2')]},'secondDisposition':{'type':Sequelize[_0x7673('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7673('0x2')]},'note':{'type':Sequelize[_0x7673('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x7673('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7673('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7673('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7673('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 5a25695..c50701c 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 _0xc5e6=['u.id\x20=\x20ui.UserId','fax_interactions','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','user','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','includeAll','include','create','params','describe','FaxMessage','ids','omit','getMessages','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','format','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','Content-Range','update','destroy','error','stack','name','map','fullname','Tags','split','forEach','push','TagIds','then','catch','index','FaxInteraction','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','field','from','tools_tags','select','u.id','u.fullname','user_has_fax_interactions','left_join','users'];(function(_0x5d2431,_0x40d418){var _0xacec44=function(_0x51ff38){while(--_0x51ff38){_0x5d2431['push'](_0x5d2431['shift']());}};_0xacec44(++_0x40d418);}(_0xc5e6,0x83));var _0x6c5e=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xc5e6[_0x556634];return _0x4429fd;};'use strict';var pdf=require(_0x6c5e('0x0'));var emlformat=require(_0x6c5e('0x1'));var rimraf=require(_0x6c5e('0x2'));var zipdir=require(_0x6c5e('0x3'));var jsonpatch=require(_0x6c5e('0x4'));var rp=require(_0x6c5e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6c5e('0x6'));var util=require(_0x6c5e('0x7'));var path=require(_0x6c5e('0x8'));var sox=require(_0x6c5e('0x9'));var csv=require('to-csv');var ejs=require(_0x6c5e('0xa'));var fs=require('fs');var _=require(_0x6c5e('0xb'));var squel=require(_0x6c5e('0xc'));var crypto=require(_0x6c5e('0xd'));var jsforce=require(_0x6c5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6c5e('0xf'));var querystring=require(_0x6c5e('0x10'));var Papa=require(_0x6c5e('0x11'));var Redis=require(_0x6c5e('0x12'));var authService=require(_0x6c5e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6c5e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c5e('0x15'))(_0x6c5e('0x16'));var utils=require('../../config/utils');var config=require(_0x6c5e('0x17'));var licenseUtil=require(_0x6c5e('0x18'));var db=require('../../mysqldb')['db'];config[_0x6c5e('0x19')]=_[_0x6c5e('0x1a')](config[_0x6c5e('0x19')],{'host':_0x6c5e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c5e('0x19')]));require('./faxInteraction.socket')[_0x6c5e('0x1c')](socket);function respondWithStatusCode(_0x88515d,_0x5d2749){_0x5d2749=_0x5d2749||0xcc;return function(_0xda36d0){if(_0xda36d0){return _0x88515d[_0x6c5e('0x1d')](_0x5d2749);}return _0x88515d[_0x6c5e('0x1e')](_0x5d2749)[_0x6c5e('0x1f')]();};}function respondWithResult(_0x2aa023,_0x507e06){_0x507e06=_0x507e06||0xc8;return function(_0x49f65a){if(_0x49f65a){return _0x2aa023[_0x6c5e('0x1e')](_0x507e06)[_0x6c5e('0x20')](_0x49f65a);}};}function respondWithFilteredResult(_0x582aa9,_0x106cf9){return function(_0x4daef8){if(_0x4daef8){var _0x532c94=_0x4daef8[_0x6c5e('0x21')],_0x519020=_0x106cf9[_0x6c5e('0x22')],_0x89d53b=_0x106cf9[_0x6c5e('0x22')]+_0x106cf9[_0x6c5e('0x23')],_0x3e8f1f;if(_0x89d53b>=_0x532c94){_0x89d53b=_0x532c94;_0x3e8f1f=0xc8;}else{_0x3e8f1f=0xce;}_0x582aa9['status'](_0x3e8f1f);return _0x582aa9['set'](_0x6c5e('0x24'),_0x519020+'-'+_0x89d53b+'/'+_0x532c94)[_0x6c5e('0x20')](_0x4daef8);}return null;};}function patchUpdates(_0x2951bc){return function(_0x897db8){try{jsonpatch['apply'](_0x897db8,_0x2951bc,!![]);}catch(_0x3df6d7){return BPromise['reject'](_0x3df6d7);}return _0x897db8['save']();};}function saveUpdates(_0x486f0a,_0xee1f63){return function(_0x5c6e8c){if(_0x5c6e8c){return _0x5c6e8c[_0x6c5e('0x25')](_0x486f0a)['then'](function(_0x50587c){return _0x50587c;});}return null;};}function removeEntity(_0x7503b1,_0x432555){return function(_0x545e15){if(_0x545e15){return _0x545e15[_0x6c5e('0x26')]()['then'](function(){_0x7503b1[_0x6c5e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4969e2,_0xcf1c34){return function(_0x4488c9){if(!_0x4488c9){_0x4969e2[_0x6c5e('0x1d')](0x194);}return _0x4488c9;};}function handleError(_0x4231d8,_0x5e226c){_0x5e226c=_0x5e226c||0x1f4;return function(_0x3d0d9a){logger[_0x6c5e('0x27')](_0x3d0d9a[_0x6c5e('0x28')]);if(_0x3d0d9a['name']){delete _0x3d0d9a[_0x6c5e('0x29')];}_0x4231d8[_0x6c5e('0x1e')](_0x5e226c)['send'](_0x3d0d9a);};}function getInteractionUsers(_0x1b35d6,_0x1a0bb2){return new BPromise(function(_0x4f6397,_0xa78b27){try{if(_0x1a0bb2[_0x1b35d6['id']]){_0x1b35d6['Users']=_[_0x6c5e('0x2a')](_0x1a0bb2[_0x1b35d6['id']],function(_0x422c3b){return{'id':_0x422c3b['id'],'fullname':_0x422c3b[_0x6c5e('0x2b')]};});}}catch(_0x9526f0){_0xa78b27(_0x9526f0);}_0x4f6397(_0x1b35d6);});}function getInteractionTags(_0x7635e6,_0x506d66){return new BPromise(function(_0x3e5942,_0x1e1e6){try{if(_0x7635e6['TagIds']){_0x7635e6[_0x6c5e('0x2c')]=[];_0x7635e6['TagIds'][_0x6c5e('0x2d')](',')[_0x6c5e('0x2e')](function(_0x3b16e9){_0x7635e6[_0x6c5e('0x2c')][_0x6c5e('0x2f')](_0x506d66[_0x3b16e9]);});}delete _0x7635e6[_0x6c5e('0x30')];}catch(_0xafb33){_0x1e1e6(_0xafb33);}_0x3e5942(_0x7635e6);});}function updateFaxInteraction(_0x264090,_0x3fe657,_0x1b7feb){return new BPromise(function(_0xaa1579,_0x10c4d8){return getInteractionUsers(_0x264090,_0x1b7feb)[_0x6c5e('0x31')](function(_0x1cd522){return getInteractionTags(_0x1cd522,_0x3fe657);})['then'](function(_0x52ca24){_0xaa1579(_0x52ca24);})[_0x6c5e('0x32')](function(_0x478964){_0x10c4d8(_0x478964);});});}exports[_0x6c5e('0x33')]=function(_0x4ba869,_0x50ae58){var _0x12b5d8={},_0x5c4ddb={},_0x41629e={'count':0x0,'rows':[]};var _0x118294=_[_0x6c5e('0x2a')](db[_0x6c5e('0x34')][_0x6c5e('0x35')],function(_0x44f9d8){return{'name':_0x44f9d8[_0x6c5e('0x36')],'type':_0x44f9d8[_0x6c5e('0x37')]['key']};});_0x5c4ddb['model']=_[_0x6c5e('0x2a')](_0x118294,'name');_0x5c4ddb[_0x6c5e('0x38')]=_[_0x6c5e('0x39')](_0x4ba869[_0x6c5e('0x38')]);_0x5c4ddb[_0x6c5e('0x3a')]=_['intersection'](_0x5c4ddb[_0x6c5e('0x3b')],_0x5c4ddb['query']);_0x12b5d8[_0x6c5e('0x3c')]=_[_0x6c5e('0x3d')](_0x5c4ddb['model'],qs[_0x6c5e('0x3e')](_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x3e')]));_0x12b5d8[_0x6c5e('0x3c')]=_0x12b5d8[_0x6c5e('0x3c')][_0x6c5e('0x3f')]?_0x12b5d8['attributes']:_0x5c4ddb[_0x6c5e('0x3b')];if(!_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x40')](_0x6c5e('0x41'))){_0x12b5d8[_0x6c5e('0x23')]=qs[_0x6c5e('0x23')](_0x4ba869['query'][_0x6c5e('0x23')]);_0x12b5d8[_0x6c5e('0x22')]=qs[_0x6c5e('0x22')](_0x4ba869[_0x6c5e('0x38')]['offset']);}_0x12b5d8[_0x6c5e('0x42')]=qs[_0x6c5e('0x43')](_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x43')]);_0x12b5d8[_0x6c5e('0x44')]=qs[_0x6c5e('0x3a')](_['pick'](_0x4ba869[_0x6c5e('0x38')],_0x5c4ddb['filters']),_0x118294);var _0x49d571=[];var _0x5a4a7a=squel['select']()[_0x6c5e('0x45')]('id')[_0x6c5e('0x45')](_0x6c5e('0x29'))[_0x6c5e('0x45')]('color')[_0x6c5e('0x46')](_0x6c5e('0x47'));var _0x3acd78=squel[_0x6c5e('0x48')]()[_0x6c5e('0x45')](_0x6c5e('0x49'))[_0x6c5e('0x45')](_0x6c5e('0x4a'))[_0x6c5e('0x45')]('ui.FaxInteractionId')[_0x6c5e('0x46')](_0x6c5e('0x4b'),'ui')[_0x6c5e('0x4c')](_0x6c5e('0x4d'),'u',_0x6c5e('0x4e'));var _0x4d95f5=squel[_0x6c5e('0x48')]()[_0x6c5e('0x46')](_0x6c5e('0x4f'),'i')[_0x6c5e('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6c5e('0x4c')](_0x6c5e('0x4d'),'o',_0x6c5e('0x50'))['left_join']('fax_accounts','a',_0x6c5e('0x51'))[_0x6c5e('0x4c')]('fax_messages','me',_0x6c5e('0x52'))[_0x6c5e('0x4c')](_0x6c5e('0x53'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x6c5e('0x47'),'t','t.id\x20=\x20it.TagId');var _0x523a1c=squel[_0x6c5e('0x54')]();var _0x51ac4f=[];var _0x1f45ce=squel['expr']();var _0x5c7b27;if(_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x55')]){_0x5c7b27=as[_0x6c5e('0x56')](_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x55')]);var _0x3a4883=_0x5c7b27[_0x6c5e('0x57')];for(var _0x4935d9=0x0;_0x4935d9<_0x5c7b27[_0x6c5e('0x58')][_0x6c5e('0x3f')];_0x4935d9++){var _0x44d228=_0x5c7b27[_0x6c5e('0x58')][_0x4935d9];var _0x6dfa1b='i';var _0x400376=_[_0x6c5e('0x59')](_0x118294,[_0x6c5e('0x29'),_0x44d228[_0x6c5e('0x45')]]);if(!_0x400376){switch(_0x44d228[_0x6c5e('0x45')]){case _0x6c5e('0x5a'):if(_0x44d228[_0x6c5e('0x5b')]==0x1){_0x4d95f5[_0x6c5e('0x5c')]('`'+_0x44d228[_0x6c5e('0x45')]+_0x6c5e('0x5d'));}else{_0x4d95f5['having']('`'+_0x44d228[_0x6c5e('0x45')]+_0x6c5e('0x5e'));}break;case _0x6c5e('0x5f'):if(_0x44d228[_0x6c5e('0x60')]===_0x6c5e('0x61')){if(_0x44d228['value']['split']('\x20')[_0x6c5e('0x3f')]>0x1){_0x523a1c[_0x3a4883](_0x6c5e('0x62'),qs[_0x6c5e('0x63')](_0x44d228[_0x6c5e('0x5b')]),null);}else{var _0x4ca78a='%'+_0x44d228[_0x6c5e('0x5b')]+'%';_0x523a1c[_0x3a4883](_0x6c5e('0x64'),_0x4ca78a,_0x4ca78a,_0x4ca78a);}}else{_0x400376=_[_0x6c5e('0x59')](_0x118294,[_0x6c5e('0x29'),_0x6c5e('0x65')]);_0x44d228[_0x6c5e('0x45')]=_0x6c5e('0x65');_0x5880b3=as['buildExpression'](_0x6dfa1b,_0x400376[_0x6c5e('0x37')],_0x44d228);_0x523a1c[_0x3a4883](_0x5880b3[_0x6c5e('0x66')],_0x5880b3[_0x6c5e('0x5b')]['start'],_0x5880b3[_0x6c5e('0x5b')]['end']);}break;case _0x6c5e('0x67'):var _0x4f4130=_0x44d228[_0x6c5e('0x5b')][_0x6c5e('0x2d')](',')[_0x6c5e('0x2a')](function(_0x378a65){return Number(_0x378a65);});_0x4f4130[_0x6c5e('0x2e')](function(_0x4a6982){_0x1f45ce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a6982+',%');});_0x51ac4f=_[_0x6c5e('0x68')](_0x51ac4f,_0x4f4130);break;case _0x6c5e('0x69'):if(_0x44d228['operator']===_0x6c5e('0x61')){_0x523a1c[_0x3a4883](_0x6c5e('0x6a'),'%'+_0x44d228[_0x6c5e('0x5b')]+'%',null);}else{_0x400376=_[_0x6c5e('0x59')](_0x118294,[_0x6c5e('0x29'),_0x6c5e('0x6b')]);_0x44d228[_0x6c5e('0x45')]=_0x6c5e('0x6b');_0x5880b3=as[_0x6c5e('0x6c')](_0x6dfa1b,_0x400376[_0x6c5e('0x37')],_0x44d228);_0x523a1c[_0x3a4883](_0x5880b3[_0x6c5e('0x66')],_0x5880b3[_0x6c5e('0x5b')][_0x6c5e('0x6d')],_0x5880b3[_0x6c5e('0x5b')]['end']);}break;case _0x6c5e('0x6e'):_0x5880b3=as[_0x6c5e('0x6c')]('me',null,_0x44d228);_0x523a1c[_0x3a4883](_0x5880b3[_0x6c5e('0x66')],_0x5880b3[_0x6c5e('0x5b')][_0x6c5e('0x6d')],_0x5880b3[_0x6c5e('0x5b')][_0x6c5e('0x1f')]);break;}}else{var _0x5880b3=as[_0x6c5e('0x6c')](_0x6dfa1b,_0x400376['type'],_0x44d228);_0x523a1c[_0x3a4883](_0x5880b3[_0x6c5e('0x66')],_0x5880b3[_0x6c5e('0x5b')][_0x6c5e('0x6d')],_0x5880b3[_0x6c5e('0x5b')][_0x6c5e('0x1f')]);}}}else{var _0x17a159=_(_0x4ba869['query'])[_0x6c5e('0x39')]()['map'](function(_0x511f49){return _[_0x6c5e('0x6f')](_0x118294,[_0x6c5e('0x29'),_0x511f49])?_0x511f49:undefined;})[_0x6c5e('0x70')]()['value']();if(!_[_0x6c5e('0x71')](_0x17a159)){_0x17a159[_0x6c5e('0x2e')](function(_0x456fa2){if(_0x456fa2===_0x6c5e('0x72')){_0x4d95f5[_0x6c5e('0x44')]('i.FaxAccountId\x20IN\x20?',[][_0x6c5e('0x73')](_0x4ba869[_0x6c5e('0x38')][_0x456fa2]));}else if(_0x456fa2===_0x6c5e('0x74')){var _0x1a3454=JSON[_0x6c5e('0x75')](_0x4ba869[_0x6c5e('0x38')][_0x456fa2])[_0x6c5e('0x76')];var _0x48bd0e=JSON[_0x6c5e('0x75')](_0x4ba869[_0x6c5e('0x38')][_0x456fa2])['$lte'];_0x4d95f5['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a3454,_0x48bd0e);}else{if(_0x4ba869[_0x6c5e('0x38')][_0x456fa2]===_0x6c5e('0x77')){_0x4d95f5[_0x6c5e('0x44')]('i.'+_0x456fa2+_0x6c5e('0x78'));}else{_0x4d95f5[_0x6c5e('0x44')]('i.'+_0x456fa2+_0x6c5e('0x79'),_0x4ba869['query'][_0x456fa2]);}}});}if(_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x7a')]){if(_0x4ba869[_0x6c5e('0x38')]['read']==0x1){_0x4d95f5[_0x6c5e('0x5c')](_0x6c5e('0x7b'));}else{_0x4d95f5[_0x6c5e('0x5c')](_0x6c5e('0x7c'));}}if(_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x7d')]){_0x51ac4f=_[_0x6c5e('0x7e')](_0x4ba869[_0x6c5e('0x38')]['tag'])?_0x4ba869['query'][_0x6c5e('0x7d')]:new Array(_0x4ba869[_0x6c5e('0x38')]['tag']);_0x51ac4f['forEach'](function(_0x3b9149){_0x1f45ce['or'](_0x6c5e('0x7f'),'%,'+_0x3b9149+',%');});}if(_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x80')]){var _0x43e1bf=_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x80')][_0x6c5e('0x81')]('\x5c','\x5c\x5c')[_0x6c5e('0x81')](/'/g,'\x27\x27');if(qs[_0x6c5e('0x82')](_0x43e1bf)){_0x523a1c['or']('i.id\x20LIKE\x20?',_0x43e1bf+'%')['or'](_0x6c5e('0x83'),_0x43e1bf+'%');}_0x523a1c['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x43e1bf+'%');}}_0x4d95f5['where'](_0x523a1c);_0x4d95f5['group'](_0x6c5e('0x84'));var _0x75af00={'type':db[_0x6c5e('0x85')][_0x6c5e('0x86')][_0x6c5e('0x87')],'raw':!![]};var _0x5d1ebe=_0x4d95f5[_0x6c5e('0x88')]();_0x5d1ebe['field'](_0x6c5e('0x84'));_0x5d1ebe[_0x6c5e('0x45')](_0x6c5e('0x89'),'unreadMessages');if(_0x12b5d8[_0x6c5e('0x42')]){_0x12b5d8[_0x6c5e('0x42')][_0x6c5e('0x2e')](function(_0x19f5ee){var _0x339c31=_0x19f5ee[0x0]==='contactName'?_0x19f5ee[0x0]:'i.'+_0x19f5ee[0x0];_0x4d95f5[_0x6c5e('0x42')](_0x339c31,_0x19f5ee[0x1]===_0x6c5e('0x8a')?![]:!![]);});}if(!_[_0x6c5e('0x71')](_0x51ac4f)){_0x4d95f5[_0x6c5e('0x5c')](_0x1f45ce);_0x5d1ebe['where'](_0x6c5e('0x8b'),_0x51ac4f);}BPromise[_0x6c5e('0x8c')]()['then'](function(){if(!_0x5c7b27){if(_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x72')])return;_0x5d1ebe['where'](_0x6c5e('0x8d'));_0x4d95f5['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4ba869['user'][_0x6c5e('0x8e')]!==_0x6c5e('0x8f'))return;return _0x4ba869['user'][_0x6c5e('0x90')]({'attributes':['id'],'raw':!![]})[_0x6c5e('0x31')](function(_0x4bfbf4){if(_['isEmpty'](_0x4bfbf4)){_0x5d1ebe[_0x6c5e('0x44')](_0x6c5e('0x91'));_0x4d95f5['where'](_0x6c5e('0x91'));}else{_0x5d1ebe['where'](_0x6c5e('0x92'),_['map'](_0x4bfbf4,'id'));_0x4d95f5[_0x6c5e('0x44')](_0x6c5e('0x92'),_[_0x6c5e('0x2a')](_0x4bfbf4,'id'));}});})[_0x6c5e('0x31')](function(){if(_0x4ba869[_0x6c5e('0x93')][_0x6c5e('0x8e')]===_0x6c5e('0x8f')&&!_0x5c7b27&&!_0x4ba869[_0x6c5e('0x38')]['FaxAccountId'])return[];return db[_0x6c5e('0x94')][_0x6c5e('0x38')](_0x5d1ebe[_0x6c5e('0x95')](),_0x75af00);})['then'](function(_0x1d9f7d){_0x41629e[_0x6c5e('0x21')]=_0x1d9f7d[_0x6c5e('0x3f')];if(_0x41629e[_0x6c5e('0x21')]===0x0)return[];return db['sequelize'][_0x6c5e('0x38')](_0x5a4a7a[_0x6c5e('0x95')](),_0x75af00)[_0x6c5e('0x31')](function(_0x1510e8){_0x49d571=_[_0x6c5e('0x96')](_0x1510e8,'id');_0x75af00=_[_0x6c5e('0x97')](_0x75af00,{'model':db[_0x6c5e('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ba869[_0x6c5e('0x38')][_0x6c5e('0x3e')]){_0x12b5d8[_0x6c5e('0x3c')][_0x6c5e('0x2e')](function(_0x5ae84d){_0x4d95f5['field']('i.'+_0x5ae84d);});}else{_0x4d95f5[_0x6c5e('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0x98'),_0x6c5e('0x99'));_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0x9a'),'Account.mandatoryDisposition');_0x4d95f5[_0x6c5e('0x45')]('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');_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0x9b'));_0x4d95f5['field'](_0x6c5e('0x9c'),_0x6c5e('0x9d'));_0x4d95f5[_0x6c5e('0x45')]('c.lastName',_0x6c5e('0x9e'));_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0x9f'),_0x6c5e('0xa0'));_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0xa1'),_0x6c5e('0xa2'));_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0xa3'),_0x6c5e('0xa4'));_0x4d95f5[_0x6c5e('0x45')]('c.fax','Contact.fax');_0x4d95f5['field'](_0x6c5e('0xa5'),_0x6c5e('0xa6'));_0x4d95f5['field']('o.internal',_0x6c5e('0xa7'));_0x4d95f5[_0x6c5e('0x45')](_0x6c5e('0xa8'),_0x6c5e('0x30'));}if(_0x12b5d8[_0x6c5e('0x23')])_0x4d95f5[_0x6c5e('0x23')](_0x12b5d8[_0x6c5e('0x23')]);if(_0x12b5d8[_0x6c5e('0x22')])_0x4d95f5[_0x6c5e('0x22')](_0x12b5d8[_0x6c5e('0x22')]);return db[_0x6c5e('0x94')][_0x6c5e('0x38')](_0x4d95f5[_0x6c5e('0x95')](),_0x75af00);})[_0x6c5e('0x31')](function(_0x2b74a0){_0x3acd78[_0x6c5e('0x44')](_0x6c5e('0xa9'),_[_0x6c5e('0x2a')](_0x2b74a0,'id'));return db[_0x6c5e('0x94')][_0x6c5e('0x38')](_0x3acd78['toString'](),_0x75af00)[_0x6c5e('0x31')](function(_0x13855a){var _0x407bbe=_[_0x6c5e('0xaa')](_0x13855a,'FaxInteractionId');var _0x4ae98f=[];_0x2b74a0[_0x6c5e('0x2e')](function(_0x93c2aa){_0x4ae98f[_0x6c5e('0x2f')](updateFaxInteraction(_0x93c2aa,_0x49d571,_0x407bbe));});return BPromise[_0x6c5e('0xab')](_0x4ae98f);});});})[_0x6c5e('0x31')](function(_0xe3189c){_0x41629e['rows']=_0xe3189c;return _0x41629e;})[_0x6c5e('0x31')](respondWithFilteredResult(_0x50ae58,_0x12b5d8))['catch'](handleError(_0x50ae58,null));};exports['show']=function(_0x35ade5,_0x5cc18d){var _0x3778e7={'raw':![],'where':{'id':_0x35ade5['params']['id']}},_0x55d1b3={};_0x55d1b3[_0x6c5e('0x3b')]=_[_0x6c5e('0x39')](db['FaxInteraction'][_0x6c5e('0x35')]);_0x55d1b3[_0x6c5e('0x38')]=_[_0x6c5e('0x39')](_0x35ade5[_0x6c5e('0x38')]);_0x55d1b3[_0x6c5e('0x3a')]=_[_0x6c5e('0x3d')](_0x55d1b3[_0x6c5e('0x3b')],_0x55d1b3['query']);_0x3778e7[_0x6c5e('0x3c')]=_[_0x6c5e('0x3d')](_0x55d1b3['model'],qs['fields'](_0x35ade5['query'][_0x6c5e('0x3e')]));_0x3778e7[_0x6c5e('0x3c')]=_0x3778e7[_0x6c5e('0x3c')][_0x6c5e('0x3f')]?_0x3778e7['attributes']:_0x55d1b3[_0x6c5e('0x3b')];if(_0x35ade5[_0x6c5e('0x38')][_0x6c5e('0xac')]){_0x3778e7[_0x6c5e('0xad')]=[{'all':!![]}];}_0x3778e7=_['merge']({},_0x3778e7,_0x35ade5['options']);return db[_0x6c5e('0x34')][_0x6c5e('0x59')](_0x3778e7)[_0x6c5e('0x31')](handleEntityNotFound(_0x5cc18d,null))[_0x6c5e('0x31')](respondWithResult(_0x5cc18d,null))[_0x6c5e('0x32')](handleError(_0x5cc18d,null));};exports[_0x6c5e('0xae')]=function(_0xe37bfe,_0x26202b){return db[_0x6c5e('0x34')]['create'](_0xe37bfe[_0x6c5e('0x6e')],{})['then'](respondWithResult(_0x26202b,0xc9))[_0x6c5e('0x32')](handleError(_0x26202b,null));};exports[_0x6c5e('0x25')]=function(_0x1d94e9,_0x2228aa){if(_0x1d94e9[_0x6c5e('0x6e')]['id']){delete _0x1d94e9[_0x6c5e('0x6e')]['id'];}return db['FaxInteraction'][_0x6c5e('0x59')]({'where':{'id':_0x1d94e9[_0x6c5e('0xaf')]['id']}})[_0x6c5e('0x31')](handleEntityNotFound(_0x2228aa,null))['then'](saveUpdates(_0x1d94e9[_0x6c5e('0x6e')],null))['then'](respondWithResult(_0x2228aa,null))[_0x6c5e('0x32')](handleError(_0x2228aa,null));};exports[_0x6c5e('0x26')]=function(_0x3835d3,_0x825f83){return db[_0x6c5e('0x34')][_0x6c5e('0x59')]({'where':{'id':_0x3835d3[_0x6c5e('0xaf')]['id']}})[_0x6c5e('0x31')](handleEntityNotFound(_0x825f83,null))[_0x6c5e('0x31')](removeEntity(_0x825f83,null))[_0x6c5e('0x32')](handleError(_0x825f83,null));};exports[_0x6c5e('0xb0')]=function(_0x182e95,_0x327534){return db[_0x6c5e('0x34')][_0x6c5e('0xb0')]()['then'](respondWithResult(_0x327534,null))[_0x6c5e('0x32')](handleError(_0x327534,null));};exports['addMessage']=function(_0x3799e6,_0xe11b88,_0x587c51){return db[_0x6c5e('0xb1')][_0x6c5e('0x59')]({'where':{'id':_0x3799e6[_0x6c5e('0xaf')]['id']}})[_0x6c5e('0x31')](handleEntityNotFound(_0xe11b88,null))[_0x6c5e('0x31')](function(_0x44b103){if(_0x44b103){return _0x44b103['addMessage'](_0x3799e6[_0x6c5e('0x6e')][_0x6c5e('0xb2')],_[_0x6c5e('0xb3')](_0x3799e6[_0x6c5e('0x6e')],['ids','id'])||{});}})[_0x6c5e('0x31')](respondWithResult(_0xe11b88,null))['catch'](handleError(_0xe11b88,null));};exports[_0x6c5e('0xb4')]=function(_0x5ef092,_0x174a65,_0x11647b){var _0x15aa52={'raw':![],'where':{}};var _0x4702fd={};var _0x404839={'count':0x0,'rows':[]};return db[_0x6c5e('0x34')]['findOne']({'where':{'id':_0x5ef092[_0x6c5e('0xaf')]['id']}})[_0x6c5e('0x31')](handleEntityNotFound(_0x174a65,null))[_0x6c5e('0x31')](function(_0x514e7f){if(_0x514e7f){_0x4702fd['model']=_[_0x6c5e('0x39')](db[_0x6c5e('0xb1')][_0x6c5e('0x35')]);_0x4702fd[_0x6c5e('0x38')]=_[_0x6c5e('0x39')](_0x5ef092[_0x6c5e('0x38')]);_0x4702fd[_0x6c5e('0x3a')]=_[_0x6c5e('0x3d')](_0x4702fd[_0x6c5e('0x3b')],_0x4702fd[_0x6c5e('0x38')]);_0x15aa52[_0x6c5e('0x3c')]=_[_0x6c5e('0x3d')](_0x4702fd[_0x6c5e('0x3b')],qs[_0x6c5e('0x3e')](_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0x3e')]));_0x15aa52[_0x6c5e('0x3c')]=_0x15aa52['attributes'][_0x6c5e('0x3f')]?_0x15aa52[_0x6c5e('0x3c')]:_0x4702fd[_0x6c5e('0x3b')];if(!_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0x40')](_0x6c5e('0x41'))){_0x15aa52[_0x6c5e('0x23')]=qs[_0x6c5e('0x23')](_0x5ef092[_0x6c5e('0x38')]['limit']);_0x15aa52[_0x6c5e('0x22')]=qs[_0x6c5e('0x22')](_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0x22')]);}_0x15aa52[_0x6c5e('0x42')]=qs[_0x6c5e('0x43')](_0x5ef092[_0x6c5e('0x38')]['sort']);_0x15aa52[_0x6c5e('0x44')]=qs['filters'](_['pick'](_0x5ef092[_0x6c5e('0x38')],_0x4702fd[_0x6c5e('0x3a')]));_0x15aa52[_0x6c5e('0x44')][_0x6c5e('0xb5')]=_0x514e7f['id'];if(_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0x80')]){_0x15aa52['where']=_[_0x6c5e('0x97')](_0x15aa52[_0x6c5e('0x44')],{'$or':_[_0x6c5e('0x2a')](_0x15aa52['attributes'],function(_0x51e7ca){var _0x2ef7c0={};_0x2ef7c0[_0x51e7ca]={'$like':'%'+_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0x80')]+'%'};return _0x2ef7c0;})});}if(_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0x76')]){var _0x38acd9=_0x5ef092[_0x6c5e('0x38')]['$gte'][_0x6c5e('0x2d')](',');var _0xa60764={};_0xa60764[_0x38acd9[0x0]]={'$gte':moment(_0x38acd9[0x1])['format'](_0x6c5e('0xb6'))};_0x15aa52[_0x6c5e('0x44')]=_[_0x6c5e('0x97')](_0x15aa52[_0x6c5e('0x44')],_0xa60764);}_0x15aa52=_['merge']({},_0x15aa52,_0x5ef092['options']);return db['FaxMessage'][_0x6c5e('0x21')]({'where':_0x15aa52['where']})[_0x6c5e('0x31')](function(_0x15d086){_0x404839[_0x6c5e('0x21')]=_0x15d086;if(_0x5ef092[_0x6c5e('0x38')][_0x6c5e('0xac')]){_0x15aa52[_0x6c5e('0xad')]=[{'all':!![]}];}return db['FaxMessage'][_0x6c5e('0xb7')](_0x15aa52);})[_0x6c5e('0x31')](function(_0x7f9cff){_0x404839['rows']=_0x7f9cff;return _0x404839;});}})[_0x6c5e('0x31')](respondWithFilteredResult(_0x174a65,_0x15aa52))['catch'](handleError(_0x174a65,null));};exports[_0x6c5e('0xb8')]=function(_0x489e23,_0x134014,_0x341d4e){return db[_0x6c5e('0x34')][_0x6c5e('0x59')]({'where':{'id':_0x489e23['params']['id']}})['then'](handleEntityNotFound(_0x134014,null))['then'](function(_0x542757){if(_0x542757){return _0x542757['setTags'](_0x489e23[_0x6c5e('0x6e')][_0x6c5e('0xb2')],_[_0x6c5e('0xb3')](_0x489e23[_0x6c5e('0x6e')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x6c5e('0xb7')]({'attributes':['id',_0x6c5e('0x29'),_0x6c5e('0xb9')],'where':{'id':_0x489e23[_0x6c5e('0x6e')][_0x6c5e('0xb2')]}});})[_0x6c5e('0x31')](function(_0x13506e){socket[_0x6c5e('0xba')](_0x6c5e('0xbb'),{'id':Number(_0x489e23[_0x6c5e('0xaf')]['id']),'tags':_0x13506e||[]});return{'id':Number(_0x489e23[_0x6c5e('0xaf')]['id']),'tags':_0x13506e||[]};});}})['then'](respondWithResult(_0x134014,null))[_0x6c5e('0x32')](handleError(_0x134014,null));};exports[_0x6c5e('0xbc')]=function(_0x1b505e,_0x585b0a,_0x29996e){return db[_0x6c5e('0x34')][_0x6c5e('0x59')]({'where':{'id':_0x1b505e['params']['id']}})['then'](handleEntityNotFound(_0x585b0a,null))[_0x6c5e('0x31')](function(_0x4b6e9c){if(_0x4b6e9c){return _0x4b6e9c[_0x6c5e('0xbc')](_0x1b505e[_0x6c5e('0x38')][_0x6c5e('0xb2')]);}})[_0x6c5e('0x31')](respondWithStatusCode(_0x585b0a,null))[_0x6c5e('0x32')](handleError(_0x585b0a,null));};exports[_0x6c5e('0xbd')]=function(_0xb7a730,_0xd4bad0){var _0x52f2e8=moment()[_0x6c5e('0xbe')]()[_0x6c5e('0x95')]();var _0x594b9e=path[_0x6c5e('0xbf')](config[_0x6c5e('0xc0')],_0x6c5e('0xc1'),_0x6c5e('0xc2'),'tmp');var _0x5441e3=path[_0x6c5e('0xbf')](config[_0x6c5e('0xc0')],_0x6c5e('0xc1'),_0x6c5e('0xc2'),_0x6c5e('0xc3'));var _0x236f8e=path[_0x6c5e('0xbf')](_0x594b9e,_0x52f2e8);var _0x27302a=util[_0x6c5e('0xc4')]('transcript-%d-%s.zip',_0xb7a730[_0x6c5e('0xaf')]['id'],_0x52f2e8);var _0x2b5358=path[_0x6c5e('0xbf')](_0x594b9e,_0x27302a);var _0x14345c=[];_0x14345c[_0x6c5e('0x2f')]({'model':db['Attachment'],'as':_0x6c5e('0xc5'),'raw':!![]});var _0x176afe=[{'model':db[_0x6c5e('0xb1')],'as':_0x6c5e('0xc6'),'attributes':['id','body',_0x6c5e('0x74')],'include':_0x14345c}];return db['FaxInteraction']['find']({'where':{'id':_0xb7a730[_0x6c5e('0xaf')]['id']},'include':_0x176afe})[_0x6c5e('0x31')](handleEntityNotFound(_0xd4bad0,null))[_0x6c5e('0x31')](function(_0x519f24){if(_0x519f24&&_0x519f24[_0x6c5e('0xc6')]){var _0x4a7990=_0x519f24[_0x6c5e('0xc7')]({'plain':!![]});fs[_0x6c5e('0xc8')](_0x236f8e);for(var _0x36257c=0x0;_0x36257c<_0x4a7990[_0x6c5e('0xc6')][_0x6c5e('0x3f')];_0x36257c++){var _0x475770=_0x4a7990[_0x6c5e('0xc6')][_0x36257c]['Attachment'];if(_0x475770){var _0x34a83e=path[_0x6c5e('0xbf')](_0x5441e3,_0x475770['basename']);if(fs[_0x6c5e('0xc9')](_0x34a83e)){fs[_0x6c5e('0xca')](_0x34a83e)[_0x6c5e('0xcb')](fs[_0x6c5e('0xcc')](path[_0x6c5e('0xbf')](_0x236f8e,_0x475770[_0x6c5e('0xcd')])));}}}return BPromise[_0x6c5e('0x8c')]()[_0x6c5e('0x31')](function(){return new BPromise(function(_0x1ff4b3,_0x57af8e){zipdir(_0x236f8e,{'saveTo':_0x2b5358},function(_0x70e957,_0x37bc7d){if(_0x70e957)return _0x57af8e(_0x70e957);return _0x1ff4b3(_0x37bc7d);});})['then'](function(){return new BPromise(function(_0x468c56,_0x301270){rimraf(_0x236f8e,function(_0x1d4f53){if(_0x1d4f53)_0x301270(_0x1d4f53);return _0x468c56();});});})[_0x6c5e('0x31')](function(){return _0xd4bad0[_0x6c5e('0xbd')](_0x2b5358,_0x27302a,function(_0x2d0530){if(_0x2d0530){console[_0x6c5e('0xce')](_0x6c5e('0xcf'),_0x2d0530);}else{fs[_0x6c5e('0xd0')](_0x2b5358);}});});});}else{return _0xd4bad0['sendStatus'](0xc8);}})['catch'](handleError(_0xd4bad0,null));}; \ No newline at end of file +var _0x5f83=['user','agent','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','includeAll','merge','options','create','params','describe','addMessage','FaxMessage','omit','findOne','rawAttributes','nolimit','filter','$gte','format','include','findAll','addTags','setTags','ids','spread','faxInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','FaxInteraction','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','select','field','color','from','u.id','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL'];(function(_0x4168b0,_0x566b80){var _0x5d488e=function(_0x506861){while(--_0x506861){_0x4168b0['push'](_0x4168b0['shift']());}};_0x5d488e(++_0x566b80);}(_0x5f83,0x120));var _0x35f8=function(_0x5a86b0,_0x5d7b16){_0x5a86b0=_0x5a86b0-0x0;var _0x32bd12=_0x5f83[_0x5a86b0];return _0x32bd12;};'use strict';var pdf=require(_0x35f8('0x0'));var emlformat=require(_0x35f8('0x1'));var rimraf=require(_0x35f8('0x2'));var zipdir=require(_0x35f8('0x3'));var jsonpatch=require(_0x35f8('0x4'));var rp=require('request-promise');var moment=require(_0x35f8('0x5'));var BPromise=require(_0x35f8('0x6'));var Mustache=require(_0x35f8('0x7'));var util=require(_0x35f8('0x8'));var path=require('path');var sox=require(_0x35f8('0x9'));var csv=require(_0x35f8('0xa'));var ejs=require(_0x35f8('0xb'));var fs=require('fs');var _=require(_0x35f8('0xc'));var squel=require(_0x35f8('0xd'));var crypto=require('crypto');var jsforce=require(_0x35f8('0xe'));var deskjs=require(_0x35f8('0xf'));var toCsv=require(_0x35f8('0xa'));var querystring=require(_0x35f8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x35f8('0x11'));var as=require(_0x35f8('0x12'));var hardwareService=require(_0x35f8('0x13'));var logger=require('../../config/logger')(_0x35f8('0x14'));var utils=require(_0x35f8('0x15'));var config=require(_0x35f8('0x16'));var licenseUtil=require(_0x35f8('0x17'));var db=require(_0x35f8('0x18'))['db'];config[_0x35f8('0x19')]=_['defaults'](config['redis'],{'host':_0x35f8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35f8('0x19')]));require('./faxInteraction.socket')[_0x35f8('0x1b')](socket);function respondWithStatusCode(_0x437dce,_0x16eced){_0x16eced=_0x16eced||0xcc;return function(_0x487e65){if(_0x487e65){return _0x437dce[_0x35f8('0x1c')](_0x16eced);}return _0x437dce[_0x35f8('0x1d')](_0x16eced)['end']();};}function respondWithResult(_0x46c849,_0x4c77c0){_0x4c77c0=_0x4c77c0||0xc8;return function(_0x42fdc9){if(_0x42fdc9){return _0x46c849[_0x35f8('0x1d')](_0x4c77c0)[_0x35f8('0x1e')](_0x42fdc9);}};}function respondWithFilteredResult(_0x58f583,_0x2bef4b){return function(_0x3bf745){if(_0x3bf745){var _0x3b49f2=_0x3bf745[_0x35f8('0x1f')],_0x5d9948=_0x2bef4b['offset'],_0x28e529=_0x2bef4b[_0x35f8('0x20')]+_0x2bef4b[_0x35f8('0x21')],_0x361a38;if(_0x28e529>=_0x3b49f2){_0x28e529=_0x3b49f2;_0x361a38=0xc8;}else{_0x361a38=0xce;}_0x58f583['status'](_0x361a38);return _0x58f583[_0x35f8('0x22')](_0x35f8('0x23'),_0x5d9948+'-'+_0x28e529+'/'+_0x3b49f2)[_0x35f8('0x1e')](_0x3bf745);}return null;};}function patchUpdates(_0x368f70){return function(_0x43e52d){try{jsonpatch[_0x35f8('0x24')](_0x43e52d,_0x368f70,!![]);}catch(_0x2a0fe0){return BPromise[_0x35f8('0x25')](_0x2a0fe0);}return _0x43e52d[_0x35f8('0x26')]();};}function saveUpdates(_0x2d2d47,_0x56d5c9){return function(_0x3c915a){if(_0x3c915a){return _0x3c915a[_0x35f8('0x27')](_0x2d2d47)[_0x35f8('0x28')](function(_0x2374ee){return _0x2374ee;});}return null;};}function removeEntity(_0x5e5acd,_0x65bf2a){return function(_0x4ab70c){if(_0x4ab70c){return _0x4ab70c[_0x35f8('0x29')]()[_0x35f8('0x28')](function(){_0x5e5acd[_0x35f8('0x1d')](0xcc)[_0x35f8('0x2a')]();});}};}function handleEntityNotFound(_0x5d77f9,_0x1c59f4){return function(_0x20277e){if(!_0x20277e){_0x5d77f9[_0x35f8('0x1c')](0x194);}return _0x20277e;};}function handleError(_0x1daa54,_0x25434c){_0x25434c=_0x25434c||0x1f4;return function(_0x3defc4){logger['error'](_0x3defc4[_0x35f8('0x2b')]);if(_0x3defc4[_0x35f8('0x2c')]){delete _0x3defc4['name'];}_0x1daa54[_0x35f8('0x1d')](_0x25434c)['send'](_0x3defc4);};}function getInteractionUsers(_0x5bed8c,_0x616970){return new BPromise(function(_0x3c305e,_0x4630a9){try{if(_0x616970[_0x5bed8c['id']]){_0x5bed8c[_0x35f8('0x2d')]=_[_0x35f8('0x2e')](_0x616970[_0x5bed8c['id']],function(_0x47ad75){return{'id':_0x47ad75['id'],'fullname':_0x47ad75[_0x35f8('0x2f')]};});}}catch(_0x2afe07){_0x4630a9(_0x2afe07);}_0x3c305e(_0x5bed8c);});}function getInteractionTags(_0x161d39,_0x2deb0b){return new BPromise(function(_0x297e36,_0x19e08a){try{if(_0x161d39['TagIds']){_0x161d39[_0x35f8('0x30')]=[];_0x161d39[_0x35f8('0x31')][_0x35f8('0x32')](',')[_0x35f8('0x33')](function(_0x178506){_0x161d39[_0x35f8('0x30')][_0x35f8('0x34')](_0x2deb0b[_0x178506]);});}delete _0x161d39[_0x35f8('0x31')];}catch(_0x471970){_0x19e08a(_0x471970);}_0x297e36(_0x161d39);});}function updateFaxInteraction(_0x380d6e,_0x18ed29,_0x97e4d5){return new BPromise(function(_0x5cd4d6,_0x2172aa){return getInteractionUsers(_0x380d6e,_0x97e4d5)[_0x35f8('0x28')](function(_0x371787){return getInteractionTags(_0x371787,_0x18ed29);})[_0x35f8('0x28')](function(_0x1ff471){_0x5cd4d6(_0x1ff471);})[_0x35f8('0x35')](function(_0x4d15bd){_0x2172aa(_0x4d15bd);});});}exports[_0x35f8('0x36')]=function(_0x495057,_0xb13e03){var _0x1e7cc4={},_0x53ee75={},_0x15c21a={'count':0x0,'rows':[]};var _0x53dce3=_[_0x35f8('0x2e')](db[_0x35f8('0x37')]['rawAttributes'],function(_0x298ac3){return{'name':_0x298ac3[_0x35f8('0x38')],'type':_0x298ac3['type']['key']};});_0x53ee75[_0x35f8('0x39')]=_['map'](_0x53dce3,'name');_0x53ee75[_0x35f8('0x3a')]=_[_0x35f8('0x3b')](_0x495057[_0x35f8('0x3a')]);_0x53ee75[_0x35f8('0x3c')]=_[_0x35f8('0x3d')](_0x53ee75[_0x35f8('0x39')],_0x53ee75[_0x35f8('0x3a')]);_0x1e7cc4[_0x35f8('0x3e')]=_[_0x35f8('0x3d')](_0x53ee75['model'],qs[_0x35f8('0x3f')](_0x495057['query'][_0x35f8('0x3f')]));_0x1e7cc4['attributes']=_0x1e7cc4['attributes'][_0x35f8('0x40')]?_0x1e7cc4[_0x35f8('0x3e')]:_0x53ee75[_0x35f8('0x39')];if(!_0x495057[_0x35f8('0x3a')][_0x35f8('0x41')]('nolimit')){_0x1e7cc4[_0x35f8('0x21')]=qs[_0x35f8('0x21')](_0x495057[_0x35f8('0x3a')]['limit']);_0x1e7cc4[_0x35f8('0x20')]=qs['offset'](_0x495057[_0x35f8('0x3a')]['offset']);}_0x1e7cc4[_0x35f8('0x42')]=qs['sort'](_0x495057[_0x35f8('0x3a')][_0x35f8('0x43')]);_0x1e7cc4['where']=qs['filters'](_[_0x35f8('0x44')](_0x495057['query'],_0x53ee75[_0x35f8('0x3c')]),_0x53dce3);var _0x508e1a=[];var _0x246ed4=squel[_0x35f8('0x45')]()[_0x35f8('0x46')]('id')[_0x35f8('0x46')](_0x35f8('0x2c'))['field'](_0x35f8('0x47'))[_0x35f8('0x48')]('tools_tags');var _0x34213f=squel[_0x35f8('0x45')]()['field'](_0x35f8('0x49'))[_0x35f8('0x46')]('u.fullname')[_0x35f8('0x46')]('ui.FaxInteractionId')[_0x35f8('0x48')]('user_has_fax_interactions','ui')[_0x35f8('0x4a')](_0x35f8('0x4b'),'u',_0x35f8('0x4c'));var _0x40a2af=squel[_0x35f8('0x45')]()[_0x35f8('0x48')](_0x35f8('0x4d'),'i')['left_join'](_0x35f8('0x4e'),'c',_0x35f8('0x4f'))[_0x35f8('0x4a')](_0x35f8('0x4b'),'o',_0x35f8('0x50'))[_0x35f8('0x4a')](_0x35f8('0x51'),'a',_0x35f8('0x52'))[_0x35f8('0x4a')]('fax_messages','me',_0x35f8('0x53'))['left_join']('fax_interaction_has_tags','it',_0x35f8('0x54'))[_0x35f8('0x4a')](_0x35f8('0x55'),'t',_0x35f8('0x56'));var _0xf886e8=squel[_0x35f8('0x57')]();var _0x1da6cf=[];var _0x17869b=squel[_0x35f8('0x57')]();var _0x4f20ae;if(_0x495057[_0x35f8('0x3a')]['search']){_0x4f20ae=as[_0x35f8('0x58')](_0x495057[_0x35f8('0x3a')][_0x35f8('0x59')]);var _0x3debd2=_0x4f20ae[_0x35f8('0x5a')];for(var _0x238153=0x0;_0x238153<_0x4f20ae[_0x35f8('0x5b')][_0x35f8('0x40')];_0x238153++){var _0x3a69ee=_0x4f20ae['conditions'][_0x238153];var _0x2914bc='i';var _0x300d6c=_[_0x35f8('0x5c')](_0x53dce3,['name',_0x3a69ee[_0x35f8('0x46')]]);if(!_0x300d6c){switch(_0x3a69ee['field']){case _0x35f8('0x5d'):if(_0x3a69ee['value']==0x1){_0x40a2af[_0x35f8('0x5e')]('`'+_0x3a69ee[_0x35f8('0x46')]+_0x35f8('0x5f'));}else{_0x40a2af['having']('`'+_0x3a69ee[_0x35f8('0x46')]+_0x35f8('0x60'));}break;case _0x35f8('0x61'):if(_0x3a69ee['operator']===_0x35f8('0x62')){if(_0x3a69ee[_0x35f8('0x63')][_0x35f8('0x32')]('\x20')['length']>0x1){_0xf886e8[_0x3debd2](_0x35f8('0x64'),qs[_0x35f8('0x65')](_0x3a69ee[_0x35f8('0x63')]),null);}else{var _0x7bdbd0='%'+_0x3a69ee[_0x35f8('0x63')]+'%';_0xf886e8[_0x3debd2](_0x35f8('0x66'),_0x7bdbd0,_0x7bdbd0,_0x7bdbd0);}}else{_0x300d6c=_[_0x35f8('0x5c')](_0x53dce3,[_0x35f8('0x2c'),_0x35f8('0x67')]);_0x3a69ee[_0x35f8('0x46')]='ContactId';_0x41009c=as[_0x35f8('0x68')](_0x2914bc,_0x300d6c[_0x35f8('0x69')],_0x3a69ee);_0xf886e8[_0x3debd2](_0x41009c[_0x35f8('0x6a')],_0x41009c[_0x35f8('0x63')][_0x35f8('0x6b')],_0x41009c[_0x35f8('0x63')]['end']);}break;case _0x35f8('0x6c'):var _0x1dd15d=_0x3a69ee[_0x35f8('0x63')][_0x35f8('0x32')](',')[_0x35f8('0x2e')](function(_0x187683){return Number(_0x187683);});_0x1dd15d[_0x35f8('0x33')](function(_0x439f3d){_0x17869b['or'](_0x35f8('0x6d'),'%,'+_0x439f3d+',%');});_0x1da6cf=_['union'](_0x1da6cf,_0x1dd15d);break;case _0x35f8('0x6e'):if(_0x3a69ee[_0x35f8('0x6f')]==='$substring'){_0xf886e8[_0x3debd2](_0x35f8('0x70'),'%'+_0x3a69ee[_0x35f8('0x63')]+'%',null);}else{_0x300d6c=_['find'](_0x53dce3,['name','UserId']);_0x3a69ee[_0x35f8('0x46')]='UserId';_0x41009c=as[_0x35f8('0x68')](_0x2914bc,_0x300d6c[_0x35f8('0x69')],_0x3a69ee);_0xf886e8[_0x3debd2](_0x41009c[_0x35f8('0x6a')],_0x41009c[_0x35f8('0x63')][_0x35f8('0x6b')],_0x41009c[_0x35f8('0x63')][_0x35f8('0x2a')]);}break;case _0x35f8('0x71'):_0x41009c=as[_0x35f8('0x68')]('me',null,_0x3a69ee);_0xf886e8[_0x3debd2](_0x41009c[_0x35f8('0x6a')],_0x41009c['value'][_0x35f8('0x6b')],_0x41009c[_0x35f8('0x63')][_0x35f8('0x2a')]);break;}}else{var _0x41009c=as[_0x35f8('0x68')](_0x2914bc,_0x300d6c[_0x35f8('0x69')],_0x3a69ee);_0xf886e8[_0x3debd2](_0x41009c[_0x35f8('0x6a')],_0x41009c[_0x35f8('0x63')]['start'],_0x41009c[_0x35f8('0x63')][_0x35f8('0x2a')]);}}}else{var _0x57def4=_(_0x495057['query'])['keys']()[_0x35f8('0x2e')](function(_0x2a2133){return _['some'](_0x53dce3,[_0x35f8('0x2c'),_0x2a2133])?_0x2a2133:undefined;})['compact']()[_0x35f8('0x63')]();if(!_[_0x35f8('0x72')](_0x57def4)){_0x57def4['forEach'](function(_0x31910f){if(_0x31910f===_0x35f8('0x73')){_0x40a2af[_0x35f8('0x74')](_0x35f8('0x75'),[][_0x35f8('0x76')](_0x495057['query'][_0x31910f]));}else if(_0x31910f===_0x35f8('0x77')){var _0x3156a1=JSON[_0x35f8('0x78')](_0x495057['query'][_0x31910f])['$gte'];var _0x29fc89=JSON['parse'](_0x495057[_0x35f8('0x3a')][_0x31910f])[_0x35f8('0x79')];_0x40a2af[_0x35f8('0x74')](_0x35f8('0x7a'),_0x3156a1,_0x29fc89);}else{if(_0x495057[_0x35f8('0x3a')][_0x31910f]===_0x35f8('0x7b')){_0x40a2af[_0x35f8('0x74')]('i.'+_0x31910f+_0x35f8('0x7c'));}else{_0x40a2af['where']('i.'+_0x31910f+_0x35f8('0x7d'),_0x495057['query'][_0x31910f]);}}});}if(_0x495057[_0x35f8('0x3a')]['read']){if(_0x495057[_0x35f8('0x3a')][_0x35f8('0x7e')]==0x1){_0x40a2af[_0x35f8('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x40a2af[_0x35f8('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x495057[_0x35f8('0x3a')]['tag']){_0x1da6cf=_[_0x35f8('0x7f')](_0x495057[_0x35f8('0x3a')]['tag'])?_0x495057[_0x35f8('0x3a')]['tag']:new Array(_0x495057[_0x35f8('0x3a')][_0x35f8('0x80')]);_0x1da6cf[_0x35f8('0x33')](function(_0x55a8af){_0x17869b['or'](_0x35f8('0x6d'),'%,'+_0x55a8af+',%');});}if(_0x495057[_0x35f8('0x3a')]['filter']){var _0x394051=_0x495057[_0x35f8('0x3a')]['filter'][_0x35f8('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x35f8('0x82')](_0x394051)){_0xf886e8['or'](_0x35f8('0x83'),_0x394051+'%')['or'](_0x35f8('0x84'),_0x394051+'%');}_0xf886e8['or'](_0x35f8('0x85'),_0x394051+'%');}}_0x40a2af[_0x35f8('0x74')](_0xf886e8);_0x40a2af[_0x35f8('0x86')]('i.id');var _0x147141={'type':db[_0x35f8('0x87')][_0x35f8('0x88')][_0x35f8('0x89')],'raw':!![]};var _0x8b565a=_0x40a2af['clone']();_0x8b565a['field'](_0x35f8('0x8a'));_0x8b565a[_0x35f8('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x35f8('0x5d'));if(_0x1e7cc4[_0x35f8('0x42')]){_0x1e7cc4[_0x35f8('0x42')][_0x35f8('0x33')](function(_0x5ab3cd){var _0x373af7=_0x5ab3cd[0x0]===_0x35f8('0x8b')?_0x5ab3cd[0x0]:'i.'+_0x5ab3cd[0x0];_0x40a2af[_0x35f8('0x42')](_0x373af7,_0x5ab3cd[0x1]===_0x35f8('0x8c')?![]:!![]);});}if(!_[_0x35f8('0x72')](_0x1da6cf)){_0x40a2af[_0x35f8('0x5e')](_0x17869b);_0x8b565a[_0x35f8('0x74')]('t.id\x20IN\x20?',_0x1da6cf);}BPromise[_0x35f8('0x8d')]()[_0x35f8('0x28')](function(){if(!_0x4f20ae){if(_0x495057[_0x35f8('0x3a')][_0x35f8('0x73')])return;_0x8b565a[_0x35f8('0x74')](_0x35f8('0x8e'));_0x40a2af[_0x35f8('0x74')](_0x35f8('0x8e'));return;}if(_0x495057['user'][_0x35f8('0x8f')]!=='agent')return;return _0x495057['user'][_0x35f8('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2b0223){if(_[_0x35f8('0x72')](_0x2b0223)){_0x8b565a['where'](_0x35f8('0x91'));_0x40a2af[_0x35f8('0x74')](_0x35f8('0x91'));}else{_0x8b565a['where']('i.FaxAccountId\x20IN\x20?',_[_0x35f8('0x2e')](_0x2b0223,'id'));_0x40a2af['where']('i.FaxAccountId\x20IN\x20?',_[_0x35f8('0x2e')](_0x2b0223,'id'));}});})[_0x35f8('0x28')](function(){if(_0x495057[_0x35f8('0x92')]['role']===_0x35f8('0x93')&&!_0x4f20ae&&!_0x495057[_0x35f8('0x3a')][_0x35f8('0x73')])return[];return db[_0x35f8('0x94')][_0x35f8('0x3a')](_0x8b565a[_0x35f8('0x95')](),_0x147141);})[_0x35f8('0x28')](function(_0x3c45a2){_0x15c21a['count']=_0x3c45a2[_0x35f8('0x40')];if(_0x15c21a[_0x35f8('0x1f')]===0x0)return[];return db[_0x35f8('0x94')][_0x35f8('0x3a')](_0x246ed4[_0x35f8('0x95')](),_0x147141)[_0x35f8('0x28')](function(_0x10da5f){_0x508e1a=_[_0x35f8('0x96')](_0x10da5f,'id');_0x147141=_['merge'](_0x147141,{'model':db[_0x35f8('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x495057[_0x35f8('0x3a')][_0x35f8('0x3f')]){_0x1e7cc4[_0x35f8('0x3e')]['forEach'](function(_0x6125f){_0x40a2af[_0x35f8('0x46')]('i.'+_0x6125f);});}else{_0x40a2af[_0x35f8('0x46')](_0x35f8('0x97'),_0x35f8('0x5d'));_0x40a2af[_0x35f8('0x46')](_0x35f8('0x98'),_0x35f8('0x99'));_0x40a2af['field'](_0x35f8('0x9a'),_0x35f8('0x9b'));_0x40a2af[_0x35f8('0x46')](_0x35f8('0x9c'),_0x35f8('0x8b'));_0x40a2af['field'](_0x35f8('0x9d'));_0x40a2af[_0x35f8('0x46')](_0x35f8('0x9e'),_0x35f8('0x9f'));_0x40a2af[_0x35f8('0x46')](_0x35f8('0xa0'),'Contact.lastName');_0x40a2af[_0x35f8('0x46')](_0x35f8('0xa1'),'Contact.email');_0x40a2af[_0x35f8('0x46')](_0x35f8('0xa2'),_0x35f8('0xa3'));_0x40a2af[_0x35f8('0x46')](_0x35f8('0xa4'),'Contact.mobile');_0x40a2af[_0x35f8('0x46')](_0x35f8('0xa5'),'Contact.fax');_0x40a2af['field'](_0x35f8('0xa6'),'Owner.fullname');_0x40a2af[_0x35f8('0x46')](_0x35f8('0xa7'),_0x35f8('0xa8'));_0x40a2af['field'](_0x35f8('0xa9'),_0x35f8('0x31'));}if(_0x1e7cc4[_0x35f8('0x21')])_0x40a2af[_0x35f8('0x21')](_0x1e7cc4[_0x35f8('0x21')]);if(_0x1e7cc4[_0x35f8('0x20')])_0x40a2af[_0x35f8('0x20')](_0x1e7cc4[_0x35f8('0x20')]);return db[_0x35f8('0x94')][_0x35f8('0x3a')](_0x40a2af[_0x35f8('0x95')](),_0x147141);})[_0x35f8('0x28')](function(_0x42d11b){_0x34213f['where'](_0x35f8('0xaa'),_[_0x35f8('0x2e')](_0x42d11b,'id'));return db['sequelize'][_0x35f8('0x3a')](_0x34213f[_0x35f8('0x95')](),_0x147141)[_0x35f8('0x28')](function(_0x139334){var _0x1b7437=_[_0x35f8('0xab')](_0x139334,_0x35f8('0xac'));var _0x2f5560=[];_0x42d11b[_0x35f8('0x33')](function(_0x4eb1d8){_0x2f5560[_0x35f8('0x34')](updateFaxInteraction(_0x4eb1d8,_0x508e1a,_0x1b7437));});return BPromise['all'](_0x2f5560);});});})[_0x35f8('0x28')](function(_0x114c8b){_0x15c21a[_0x35f8('0xad')]=_0x114c8b;return _0x15c21a;})['then'](respondWithFilteredResult(_0xb13e03,_0x1e7cc4))[_0x35f8('0x35')](handleError(_0xb13e03,null));};exports[_0x35f8('0xae')]=function(_0x5c824f,_0x58a1a3){var _0x313506={'raw':![],'where':{'id':_0x5c824f['params']['id']}},_0xfc44f6={};_0xfc44f6[_0x35f8('0x39')]=_[_0x35f8('0x3b')](db[_0x35f8('0x37')]['rawAttributes']);_0xfc44f6['query']=_[_0x35f8('0x3b')](_0x5c824f[_0x35f8('0x3a')]);_0xfc44f6[_0x35f8('0x3c')]=_[_0x35f8('0x3d')](_0xfc44f6[_0x35f8('0x39')],_0xfc44f6[_0x35f8('0x3a')]);_0x313506[_0x35f8('0x3e')]=_['intersection'](_0xfc44f6['model'],qs[_0x35f8('0x3f')](_0x5c824f[_0x35f8('0x3a')]['fields']));_0x313506['attributes']=_0x313506[_0x35f8('0x3e')][_0x35f8('0x40')]?_0x313506[_0x35f8('0x3e')]:_0xfc44f6[_0x35f8('0x39')];if(_0x5c824f[_0x35f8('0x3a')][_0x35f8('0xaf')]){_0x313506['include']=[{'all':!![]}];}_0x313506=_[_0x35f8('0xb0')]({},_0x313506,_0x5c824f[_0x35f8('0xb1')]);return db[_0x35f8('0x37')]['find'](_0x313506)['then'](handleEntityNotFound(_0x58a1a3,null))[_0x35f8('0x28')](respondWithResult(_0x58a1a3,null))['catch'](handleError(_0x58a1a3,null));};exports[_0x35f8('0xb2')]=function(_0x4a6cda,_0x416a35){return db['FaxInteraction'][_0x35f8('0xb2')](_0x4a6cda[_0x35f8('0x71')],{})[_0x35f8('0x28')](respondWithResult(_0x416a35,0xc9))[_0x35f8('0x35')](handleError(_0x416a35,null));};exports[_0x35f8('0x27')]=function(_0x286cd8,_0x23c061){if(_0x286cd8[_0x35f8('0x71')]['id']){delete _0x286cd8['body']['id'];}return db[_0x35f8('0x37')][_0x35f8('0x5c')]({'where':{'id':_0x286cd8[_0x35f8('0xb3')]['id']}})[_0x35f8('0x28')](handleEntityNotFound(_0x23c061,null))[_0x35f8('0x28')](saveUpdates(_0x286cd8[_0x35f8('0x71')],null))[_0x35f8('0x28')](respondWithResult(_0x23c061,null))['catch'](handleError(_0x23c061,null));};exports[_0x35f8('0x29')]=function(_0x30fd2f,_0x1241e2){return db[_0x35f8('0x37')][_0x35f8('0x5c')]({'where':{'id':_0x30fd2f[_0x35f8('0xb3')]['id']}})['then'](handleEntityNotFound(_0x1241e2,null))[_0x35f8('0x28')](removeEntity(_0x1241e2,null))[_0x35f8('0x35')](handleError(_0x1241e2,null));};exports[_0x35f8('0xb4')]=function(_0xd1c5be,_0x49ce6f){return db['FaxInteraction']['describe']()[_0x35f8('0x28')](respondWithResult(_0x49ce6f,null))['catch'](handleError(_0x49ce6f,null));};exports[_0x35f8('0xb5')]=function(_0x50bf7f,_0x11fe71,_0x46f5cd){return db[_0x35f8('0xb6')][_0x35f8('0x5c')]({'where':{'id':_0x50bf7f[_0x35f8('0xb3')]['id']}})[_0x35f8('0x28')](handleEntityNotFound(_0x11fe71,null))['then'](function(_0x486937){if(_0x486937){return _0x486937['addMessage'](_0x50bf7f[_0x35f8('0x71')]['ids'],_[_0x35f8('0xb7')](_0x50bf7f['body'],['ids','id'])||{});}})[_0x35f8('0x28')](respondWithResult(_0x11fe71,null))[_0x35f8('0x35')](handleError(_0x11fe71,null));};exports['getMessages']=function(_0x295f21,_0x636936,_0x737641){var _0x46c492={'raw':![],'where':{}};var _0x84b5f6={};var _0x13db3b={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x35f8('0xb8')]({'where':{'id':_0x295f21[_0x35f8('0xb3')]['id']}})[_0x35f8('0x28')](handleEntityNotFound(_0x636936,null))[_0x35f8('0x28')](function(_0x480903){if(_0x480903){_0x84b5f6[_0x35f8('0x39')]=_[_0x35f8('0x3b')](db[_0x35f8('0xb6')][_0x35f8('0xb9')]);_0x84b5f6[_0x35f8('0x3a')]=_[_0x35f8('0x3b')](_0x295f21[_0x35f8('0x3a')]);_0x84b5f6[_0x35f8('0x3c')]=_[_0x35f8('0x3d')](_0x84b5f6['model'],_0x84b5f6['query']);_0x46c492[_0x35f8('0x3e')]=_['intersection'](_0x84b5f6['model'],qs['fields'](_0x295f21[_0x35f8('0x3a')][_0x35f8('0x3f')]));_0x46c492[_0x35f8('0x3e')]=_0x46c492[_0x35f8('0x3e')][_0x35f8('0x40')]?_0x46c492[_0x35f8('0x3e')]:_0x84b5f6[_0x35f8('0x39')];if(!_0x295f21[_0x35f8('0x3a')]['hasOwnProperty'](_0x35f8('0xba'))){_0x46c492[_0x35f8('0x21')]=qs[_0x35f8('0x21')](_0x295f21[_0x35f8('0x3a')][_0x35f8('0x21')]);_0x46c492[_0x35f8('0x20')]=qs['offset'](_0x295f21[_0x35f8('0x3a')][_0x35f8('0x20')]);}_0x46c492[_0x35f8('0x42')]=qs[_0x35f8('0x43')](_0x295f21[_0x35f8('0x3a')][_0x35f8('0x43')]);_0x46c492[_0x35f8('0x74')]=qs[_0x35f8('0x3c')](_[_0x35f8('0x44')](_0x295f21[_0x35f8('0x3a')],_0x84b5f6[_0x35f8('0x3c')]));_0x46c492[_0x35f8('0x74')][_0x35f8('0xac')]=_0x480903['id'];if(_0x295f21['query'][_0x35f8('0xbb')]){_0x46c492[_0x35f8('0x74')]=_[_0x35f8('0xb0')](_0x46c492[_0x35f8('0x74')],{'$or':_[_0x35f8('0x2e')](_0x46c492[_0x35f8('0x3e')],function(_0x385e9b){var _0xa81435={};_0xa81435[_0x385e9b]={'$like':'%'+_0x295f21['query'][_0x35f8('0xbb')]+'%'};return _0xa81435;})});}if(_0x295f21['query'][_0x35f8('0xbc')]){var _0x231020=_0x295f21[_0x35f8('0x3a')][_0x35f8('0xbc')]['split'](',');var _0x58b797={};_0x58b797[_0x231020[0x0]]={'$gte':moment(_0x231020[0x1])[_0x35f8('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x46c492[_0x35f8('0x74')]=_[_0x35f8('0xb0')](_0x46c492['where'],_0x58b797);}_0x46c492=_[_0x35f8('0xb0')]({},_0x46c492,_0x295f21['options']);return db['FaxMessage']['count']({'where':_0x46c492[_0x35f8('0x74')]})[_0x35f8('0x28')](function(_0x920d56){_0x13db3b[_0x35f8('0x1f')]=_0x920d56;if(_0x295f21[_0x35f8('0x3a')]['includeAll']){_0x46c492[_0x35f8('0xbe')]=[{'all':!![]}];}return db[_0x35f8('0xb6')][_0x35f8('0xbf')](_0x46c492);})[_0x35f8('0x28')](function(_0x269c8b){_0x13db3b[_0x35f8('0xad')]=_0x269c8b;return _0x13db3b;});}})['then'](respondWithFilteredResult(_0x636936,_0x46c492))[_0x35f8('0x35')](handleError(_0x636936,null));};exports[_0x35f8('0xc0')]=function(_0x24b1f5,_0x2594f3,_0x473ff5){return db[_0x35f8('0x37')][_0x35f8('0x5c')]({'where':{'id':_0x24b1f5[_0x35f8('0xb3')]['id']}})[_0x35f8('0x28')](handleEntityNotFound(_0x2594f3,null))[_0x35f8('0x28')](function(_0x2864c6){if(_0x2864c6){return _0x2864c6[_0x35f8('0xc1')](_0x24b1f5['body']['ids'],_[_0x35f8('0xb7')](_0x24b1f5['body'],[_0x35f8('0xc2'),'id'])||{})[_0x35f8('0xc3')](function(){return db[_0x35f8('0x6c')]['findAll']({'attributes':['id',_0x35f8('0x2c'),_0x35f8('0x47')],'where':{'id':_0x24b1f5[_0x35f8('0x71')][_0x35f8('0xc2')]}});})[_0x35f8('0x28')](function(_0x120c8a){socket['emit'](_0x35f8('0xc4'),{'id':Number(_0x24b1f5[_0x35f8('0xb3')]['id']),'tags':_0x120c8a||[]});return{'id':Number(_0x24b1f5[_0x35f8('0xb3')]['id']),'tags':_0x120c8a||[]};});}})['then'](respondWithResult(_0x2594f3,null))[_0x35f8('0x35')](handleError(_0x2594f3,null));};exports['removeTags']=function(_0x3c1a4f,_0x49847d,_0xec54cf){return db[_0x35f8('0x37')][_0x35f8('0x5c')]({'where':{'id':_0x3c1a4f[_0x35f8('0xb3')]['id']}})[_0x35f8('0x28')](handleEntityNotFound(_0x49847d,null))[_0x35f8('0x28')](function(_0xe77921){if(_0xe77921){return _0xe77921[_0x35f8('0xc5')](_0x3c1a4f[_0x35f8('0x3a')][_0x35f8('0xc2')]);}})[_0x35f8('0x28')](respondWithStatusCode(_0x49847d,null))[_0x35f8('0x35')](handleError(_0x49847d,null));};exports[_0x35f8('0xc6')]=function(_0x38dab9,_0x43d0df){var _0x6f36a9=moment()[_0x35f8('0xc7')]()[_0x35f8('0x95')]();var _0xcb575c=path[_0x35f8('0xc8')](config['root'],_0x35f8('0xc9'),_0x35f8('0xca'),'tmp');var _0x592560=path[_0x35f8('0xc8')](config[_0x35f8('0xcb')],_0x35f8('0xc9'),_0x35f8('0xca'),_0x35f8('0xcc'));var _0x2f0e36=path[_0x35f8('0xc8')](_0xcb575c,_0x6f36a9);var _0x50251e=util[_0x35f8('0xbd')](_0x35f8('0xcd'),_0x38dab9[_0x35f8('0xb3')]['id'],_0x6f36a9);var _0x5eca53=path[_0x35f8('0xc8')](_0xcb575c,_0x50251e);var _0x25e36a=[];_0x25e36a[_0x35f8('0x34')]({'model':db[_0x35f8('0xce')],'as':_0x35f8('0xce'),'raw':!![]});var _0x33e89c=[{'model':db[_0x35f8('0xb6')],'as':_0x35f8('0xcf'),'attributes':['id',_0x35f8('0x71'),_0x35f8('0x77')],'include':_0x25e36a}];return db[_0x35f8('0x37')][_0x35f8('0x5c')]({'where':{'id':_0x38dab9[_0x35f8('0xb3')]['id']},'include':_0x33e89c})['then'](handleEntityNotFound(_0x43d0df,null))['then'](function(_0x4c00a3){if(_0x4c00a3&&_0x4c00a3['Messages']){var _0x18cc64=_0x4c00a3['get']({'plain':!![]});fs[_0x35f8('0xd0')](_0x2f0e36);for(var _0x18de3d=0x0;_0x18de3d<_0x18cc64[_0x35f8('0xcf')]['length'];_0x18de3d++){var _0x2e580d=_0x18cc64[_0x35f8('0xcf')][_0x18de3d]['Attachment'];if(_0x2e580d){var _0x588f4e=path[_0x35f8('0xc8')](_0x592560,_0x2e580d[_0x35f8('0xd1')]);if(fs[_0x35f8('0xd2')](_0x588f4e)){fs[_0x35f8('0xd3')](_0x588f4e)[_0x35f8('0xd4')](fs[_0x35f8('0xd5')](path[_0x35f8('0xc8')](_0x2f0e36,_0x2e580d['basename'])));}}}return BPromise[_0x35f8('0x8d')]()[_0x35f8('0x28')](function(){return new BPromise(function(_0x15ca6d,_0x46caa3){zipdir(_0x2f0e36,{'saveTo':_0x5eca53},function(_0x2f96fb,_0x386580){if(_0x2f96fb)return _0x46caa3(_0x2f96fb);return _0x15ca6d(_0x386580);});})[_0x35f8('0x28')](function(){return new BPromise(function(_0x49e51b,_0x178d26){rimraf(_0x2f0e36,function(_0x264ba4){if(_0x264ba4)_0x178d26(_0x264ba4);return _0x49e51b();});});})[_0x35f8('0x28')](function(){return _0x43d0df[_0x35f8('0xc6')](_0x5eca53,_0x50251e,function(_0x2c150e){if(_0x2c150e){console[_0x35f8('0xd6')](_0x35f8('0xd7'),_0x2c150e);}else{fs[_0x35f8('0xd8')](_0x5eca53);}});});});}else{return _0x43d0df[_0x35f8('0x1c')](0xc8);}})[_0x35f8('0x35')](handleError(_0x43d0df,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2b84905..3b1c3c8 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x4eeb9a,_0x1d4396){var _0x51055b=function(_0x5bad60){while(--_0x5bad60){_0x4eeb9a['push'](_0x4eeb9a['shift']());}};_0x51055b(++_0x1d4396);}(_0x326f,0xd1));var _0xf326=function(_0x3f7121,_0x510a56){_0x3f7121=_0x3f7121-0x0;var _0x4c7194=_0x326f[_0x3f7121];return _0x4c7194;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a638324..e0b840c 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 _0x566a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','request-promise','../../config/environment','./faxInteraction.attributes','exports','fax_interactions'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x566a,0xf5));var _0xa566=function(_0x30dc3b,_0x56e474){_0x30dc3b=_0x30dc3b-0x0;var _0x592c4a=_0x566a[_0x30dc3b];return _0x592c4a;};'use strict';var _=require(_0xa566('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa566('0x1'));var moment=require('moment');var BPromise=require(_0xa566('0x2'));var rp=require(_0xa566('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa566('0x4'));var attributes=require(_0xa566('0x5'));module[_0xa566('0x6')]=function(_0x47ec25,_0x107bcc){return _0x47ec25['define']('FaxInteraction',attributes,{'tableName':_0xa566('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37ae0e,_0x4d5bd0,_0x58bd31){if(_0x37ae0e['changed']('closed')){_0x37ae0e[_0xa566('0x8')]=moment()[_0xa566('0x9')](_0xa566('0xa'));}_0x58bd31(null,_0x37ae0e);}}});}; \ No newline at end of file +var _0x1b58=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','define','FaxInteraction'];(function(_0x33befa,_0x29adc6){var _0x2e86ad=function(_0x3feded){while(--_0x3feded){_0x33befa['push'](_0x33befa['shift']());}};_0x2e86ad(++_0x29adc6);}(_0x1b58,0x72));var _0x81b5=function(_0x1ff019,_0x5e28f5){_0x1ff019=_0x1ff019-0x0;var _0x36be01=_0x1b58[_0x1ff019];return _0x36be01;};'use strict';var _=require(_0x81b5('0x0'));var util=require(_0x81b5('0x1'));var logger=require(_0x81b5('0x2'))(_0x81b5('0x3'));var moment=require(_0x81b5('0x4'));var BPromise=require(_0x81b5('0x5'));var rp=require(_0x81b5('0x6'));var fs=require('fs');var path=require(_0x81b5('0x7'));var rimraf=require('rimraf');var config=require(_0x81b5('0x8'));var attributes=require(_0x81b5('0x9'));module['exports']=function(_0x58e80d,_0x50cd27){return _0x58e80d[_0x81b5('0xa')](_0x81b5('0xb'),attributes,{'tableName':_0x81b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e97f9,_0x443848,_0x21d37b){if(_0x4e97f9[_0x81b5('0xd')](_0x81b5('0xe'))){_0x4e97f9[_0x81b5('0xf')]=moment()[_0x81b5('0x10')](_0x81b5('0x11'));}_0x21d37b(null,_0x4e97f9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 66056d9..8521624 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 _0xf89e=['jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','then','AddTagsToFaxInteraction','find','addTags','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xf89e,0x175));var _0xef89=function(_0x4bbe65,_0x3e70ce){_0x4bbe65=_0x4bbe65-0x0;var _0x20aeee=_0xf89e[_0x4bbe65];return _0x20aeee;};'use strict';var _=require(_0xef89('0x0'));var util=require(_0xef89('0x1'));var moment=require(_0xef89('0x2'));var BPromise=require('bluebird');var rs=require(_0xef89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef89('0x4'))['db'];var utils=require(_0xef89('0x5'));var logger=require('../../config/logger')(_0xef89('0x6'));var config=require('../../config/environment');var jayson=require(_0xef89('0x7'));var client=jayson['client'][_0xef89('0x8')]({'port':0x232a});config[_0xef89('0x9')]=_[_0xef89('0xa')](config[_0xef89('0x9')],{'host':_0xef89('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xef89('0xc'))[_0xef89('0xd')](socket);function respondWithRpcPromise(_0x5a00ac,_0x51cbdf,_0x10a1f7){return new BPromise(function(_0x5357f9,_0x5a2880){return client[_0xef89('0xe')](_0x5a00ac,_0x10a1f7)['then'](function(_0x272caf){logger[_0xef89('0xf')](_0xef89('0x10'),_0x51cbdf,_0xef89('0x11'));logger[_0xef89('0x12')](_0xef89('0x13'),_0x51cbdf,_0xef89('0x11'),JSON[_0xef89('0x14')](_0x272caf));if(_0x272caf[_0xef89('0x15')]){if(_0x272caf[_0xef89('0x15')][_0xef89('0x16')]===0x1f4){logger[_0xef89('0x15')](_0xef89('0x10'),_0x51cbdf,_0x272caf['error']['message']);return _0x5a2880(_0x272caf[_0xef89('0x15')][_0xef89('0x17')]);}logger[_0xef89('0x15')](_0xef89('0x10'),_0x51cbdf,_0x272caf[_0xef89('0x15')][_0xef89('0x17')]);return _0x5357f9(_0x272caf[_0xef89('0x15')]['message']);}else{logger[_0xef89('0xf')](_0xef89('0x10'),_0x51cbdf,_0xef89('0x11'));_0x5357f9(_0x272caf[_0xef89('0x18')][_0xef89('0x17')]);}})[_0xef89('0x19')](function(_0x284ea1){logger[_0xef89('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x51cbdf,_0x284ea1);_0x5a2880(_0x284ea1);});});}exports[_0xef89('0x1a')]=function(_0x573e95){var _0x563243=this;return new Promise(function(_0x4e08e8,_0x5d4ca7){return db[_0xef89('0x1b')][_0xef89('0x1c')](_0x573e95[_0xef89('0x1d')],{'raw':_0x573e95[_0xef89('0x1e')]?_0x573e95[_0xef89('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573e95[_0xef89('0x1e')]?_0x573e95[_0xef89('0x1e')][_0xef89('0x1f')]||null:null,'attributes':_0x573e95[_0xef89('0x1e')]?_0x573e95['options']['attributes']||null:null,'limit':_0x573e95[_0xef89('0x1e')]?_0x573e95[_0xef89('0x1e')]['limit']||null:null})[_0xef89('0x20')](function(_0x38eb3d){logger[_0xef89('0xf')](_0xef89('0x1a'),_0x573e95);logger[_0xef89('0x12')](_0xef89('0x1a'),_0x573e95,JSON['stringify'](_0x38eb3d));_0x4e08e8(_0x38eb3d);})[_0xef89('0x19')](function(_0x33e3d5){logger[_0xef89('0x15')](_0xef89('0x1a'),_0x33e3d5['message'],_0x573e95);_0x5d4ca7(_0x563243[_0xef89('0x15')](0x1f4,_0x33e3d5[_0xef89('0x17')]));});});};exports[_0xef89('0x21')]=function(_0x314fab){return new Promise(function(_0x3d042a,_0x5df856){return db[_0xef89('0x1b')][_0xef89('0x22')]({'where':_0x314fab[_0xef89('0x1e')]?_0x314fab['options'][_0xef89('0x1f')]||null:null})['then'](function(_0x1ab650){if(_0x1ab650){return _0x1ab650[_0xef89('0x23')](_0x314fab[_0xef89('0x1d')]['ids'],_['omit'](_0x314fab[_0xef89('0x1d')],['ids','id'])||{});}})[_0xef89('0x24')](function(_0x349889){logger[_0xef89('0xf')](_0xef89('0x25'),_0x314fab);logger[_0xef89('0x12')]('AddTags',_0x314fab,JSON[_0xef89('0x14')](_0x349889));_0x3d042a(_0x349889);})[_0xef89('0x19')](function(_0x408b8f){logger[_0xef89('0x15')](_0xef89('0x25'),_0x408b8f[_0xef89('0x17')],_0x314fab);_0x5df856(_this[_0xef89('0x15')](0x1f4,_0x408b8f['message']));});});}; \ No newline at end of file +var _0xe743=['AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxInteraction','FaxInteraction','update','body','options','where','catch'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xe743,0x134));var _0x3e74=function(_0x5e60a0,_0x1b26ff){_0x5e60a0=_0x5e60a0-0x0;var _0x53efc0=_0xe743[_0x5e60a0];return _0x53efc0;};'use strict';var _=require(_0x3e74('0x0'));var util=require(_0x3e74('0x1'));var moment=require(_0x3e74('0x2'));var BPromise=require(_0x3e74('0x3'));var rs=require(_0x3e74('0x4'));var fs=require('fs');var Redis=require(_0x3e74('0x5'));var db=require(_0x3e74('0x6'))['db'];var utils=require(_0x3e74('0x7'));var logger=require(_0x3e74('0x8'))(_0x3e74('0x9'));var config=require('../../config/environment');var jayson=require(_0x3e74('0xa'));var client=jayson[_0x3e74('0xb')][_0x3e74('0xc')]({'port':0x232a});config['redis']=_[_0x3e74('0xd')](config[_0x3e74('0xe')],{'host':_0x3e74('0xf'),'port':0x18eb});var socket=require(_0x3e74('0x10'))(new Redis(config[_0x3e74('0xe')]));require(_0x3e74('0x11'))['register'](socket);function respondWithRpcPromise(_0x32ce43,_0x3a709b,_0x25f2ac){return new BPromise(function(_0x2f2891,_0x235a75){return client[_0x3e74('0x12')](_0x32ce43,_0x25f2ac)[_0x3e74('0x13')](function(_0x3532fd){logger[_0x3e74('0x14')](_0x3e74('0x15'),_0x3a709b,_0x3e74('0x16'));logger[_0x3e74('0x17')](_0x3e74('0x18'),_0x3a709b,_0x3e74('0x16'),JSON[_0x3e74('0x19')](_0x3532fd));if(_0x3532fd['error']){if(_0x3532fd[_0x3e74('0x1a')][_0x3e74('0x1b')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3a709b,_0x3532fd[_0x3e74('0x1a')]['message']);return _0x235a75(_0x3532fd['error'][_0x3e74('0x1c')]);}logger[_0x3e74('0x1a')](_0x3e74('0x15'),_0x3a709b,_0x3532fd[_0x3e74('0x1a')][_0x3e74('0x1c')]);return _0x2f2891(_0x3532fd[_0x3e74('0x1a')][_0x3e74('0x1c')]);}else{logger[_0x3e74('0x14')](_0x3e74('0x15'),_0x3a709b,_0x3e74('0x16'));_0x2f2891(_0x3532fd['result'][_0x3e74('0x1c')]);}})['catch'](function(_0x54f18e){logger[_0x3e74('0x1a')](_0x3e74('0x15'),_0x3a709b,_0x54f18e);_0x235a75(_0x54f18e);});});}exports[_0x3e74('0x1d')]=function(_0xa14bd4){var _0x404cd7=this;return new Promise(function(_0x1d3dda,_0x5b9108){return db[_0x3e74('0x1e')][_0x3e74('0x1f')](_0xa14bd4[_0x3e74('0x20')],{'raw':_0xa14bd4[_0x3e74('0x21')]?_0xa14bd4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa14bd4[_0x3e74('0x21')]?_0xa14bd4[_0x3e74('0x21')][_0x3e74('0x22')]||null:null,'attributes':_0xa14bd4[_0x3e74('0x21')]?_0xa14bd4[_0x3e74('0x21')]['attributes']||null:null,'limit':_0xa14bd4[_0x3e74('0x21')]?_0xa14bd4[_0x3e74('0x21')]['limit']||null:null})[_0x3e74('0x13')](function(_0x3dbaed){logger[_0x3e74('0x14')](_0x3e74('0x1d'),_0xa14bd4);logger[_0x3e74('0x17')](_0x3e74('0x1d'),_0xa14bd4,JSON[_0x3e74('0x19')](_0x3dbaed));_0x1d3dda(_0x3dbaed);})[_0x3e74('0x23')](function(_0x21d4ad){logger['error']('UpdateFaxInteraction',_0x21d4ad[_0x3e74('0x1c')],_0xa14bd4);_0x5b9108(_0x404cd7[_0x3e74('0x1a')](0x1f4,_0x21d4ad[_0x3e74('0x1c')]));});});};exports[_0x3e74('0x24')]=function(_0x2e0bdb){return new Promise(function(_0x5e3249,_0xbf692d){return db[_0x3e74('0x1e')][_0x3e74('0x25')]({'where':_0x2e0bdb[_0x3e74('0x21')]?_0x2e0bdb[_0x3e74('0x21')][_0x3e74('0x22')]||null:null})[_0x3e74('0x13')](function(_0xb51bab){if(_0xb51bab){return _0xb51bab[_0x3e74('0x26')](_0x2e0bdb['body']['ids'],_[_0x3e74('0x27')](_0x2e0bdb['body'],[_0x3e74('0x28'),'id'])||{});}})[_0x3e74('0x29')](function(_0xfc73df){logger[_0x3e74('0x14')](_0x3e74('0x2a'),_0x2e0bdb);logger[_0x3e74('0x17')]('AddTags',_0x2e0bdb,JSON[_0x3e74('0x19')](_0xfc73df));_0x5e3249(_0xfc73df);})[_0x3e74('0x23')](function(_0x34a094){logger[_0x3e74('0x1a')](_0x3e74('0x2a'),_0x34a094[_0x3e74('0x1c')],_0x2e0bdb);_0xbf692d(_this[_0x3e74('0x1a')](0x1f4,_0x34a094[_0x3e74('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2e7aa43..e6dc83c 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 _0x6f62=['remove','update','removeListener','length','save'];(function(_0x4b7092,_0x290851){var _0x40cece=function(_0x84cd3f){while(--_0x84cd3f){_0x4b7092['push'](_0x4b7092['shift']());}};_0x40cece(++_0x290851);}(_0x6f62,0x144));var _0x26f6=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x6f62[_0x5ddaac];return _0x2a9c58;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x26f6('0x0'),_0x26f6('0x1'),_0x26f6('0x2')];function createListener(_0x520f32,_0x457493){return function(_0xcccca3){_0x457493['emit'](_0x520f32,_0xcccca3);};}function removeListener(_0x3c417f,_0x236134){return function(){FaxInteractionEvents[_0x26f6('0x3')](_0x3c417f,_0x236134);};}exports['register']=function(_0x170465){for(var _0x15dbd5=0x0,_0x4849d2=events[_0x26f6('0x4')];_0x15dbd5<_0x4849d2;_0x15dbd5++){var _0xbbd4b0=events[_0x15dbd5];var _0x5f307a=createListener('faxInteraction:'+_0xbbd4b0,_0x170465);FaxInteractionEvents['on'](_0xbbd4b0,_0x5f307a);}}; \ No newline at end of file +var _0xc934=['update','emit','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x2f163d,_0x40185b){var _0x11e1ed=function(_0x5d570b){while(--_0x5d570b){_0x2f163d['push'](_0x2f163d['shift']());}};_0x11e1ed(++_0x40185b);}(_0xc934,0x18f));var _0x4c93=function(_0xf72c35,_0x210584){_0xf72c35=_0xf72c35-0x0;var _0x3b6009=_0xc934[_0xf72c35];return _0x3b6009;};'use strict';var FaxInteractionEvents=require(_0x4c93('0x0'));var events=[_0x4c93('0x1'),_0x4c93('0x2'),_0x4c93('0x3')];function createListener(_0x51aca5,_0x3b4fdf){return function(_0x54708b){_0x3b4fdf[_0x4c93('0x4')](_0x51aca5,_0x54708b);};}function removeListener(_0x1f66d2,_0x19ca67){return function(){FaxInteractionEvents['removeListener'](_0x1f66d2,_0x19ca67);};}exports['register']=function(_0xb7f752){for(var _0x53147a=0x0,_0xc1d3f1=events['length'];_0x53147a<_0xc1d3f1;_0x53147a++){var _0x3cfe1b=events[_0x53147a];var _0x3d1fac=createListener(_0x4c93('0x5')+_0x3cfe1b,_0xb7f752);FaxInteractionEvents['on'](_0x3cfe1b,_0x3d1fac);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index bffd4da..b2a63f9 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 _0xb688=['delete','faxinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','addTags','put','fax','update'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0xb688,0xcf));var _0x8b68=function(_0x4e6a6d,_0x304e36){_0x4e6a6d=_0x4e6a6d-0x0;var _0x2fd87e=_0xb688[_0x4e6a6d];return _0x2fd87e;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',auth[_0x8b68('0x9')](),controller['index']);router[_0x8b68('0x8')]('/describe',auth[_0x8b68('0x9')](),controller[_0x8b68('0xa')]);router[_0x8b68('0x8')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xc')]);router[_0x8b68('0x8')](_0x8b68('0xd'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xe')]);router[_0x8b68('0x8')](_0x8b68('0xf'),auth[_0x8b68('0x9')](),controller['download']);router[_0x8b68('0x10')]('/',auth[_0x8b68('0x9')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x10')](_0x8b68('0xd'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x12')]);router[_0x8b68('0x10')](_0x8b68('0x13'),auth['isAuthenticated'](),interaction[_0x8b68('0x14')]('fax','faxinteraction:addtags'),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')](_0x8b68('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x8b68('0x17'),'faxinteraction:update'),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),interaction['tracked'](_0x8b68('0x17'),_0x8b68('0x1a')),controller['destroy']);router[_0x8b68('0x19')](_0x8b68('0x13'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x1b')]);module[_0x8b68('0x1c')]=router; \ No newline at end of file +var _0x4fc2=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','removeTags'];(function(_0x48a964,_0x3c59d0){var _0x3a917a=function(_0x5d2041){while(--_0x5d2041){_0x48a964['push'](_0x48a964['shift']());}};_0x3a917a(++_0x3c59d0);}(_0x4fc2,0x111));var _0x24fc=function(_0x2886e9,_0x302883){_0x2886e9=_0x2886e9-0x0;var _0x1bd6c0=_0x4fc2[_0x2886e9];return _0x1bd6c0;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x8')](_0x24fc('0x10'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x12')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x13')]);router[_0x24fc('0x12')]('/:id/messages',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x12')](_0x24fc('0x15'),auth[_0x24fc('0xa')](),interaction[_0x24fc('0x16')]('fax',_0x24fc('0x17')),controller[_0x24fc('0x18')]);router[_0x24fc('0x19')](_0x24fc('0xc'),auth['isAuthenticated'](),interaction[_0x24fc('0x16')]('fax',_0x24fc('0x1a')),controller[_0x24fc('0x1b')]);router[_0x24fc('0x1c')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),interaction['tracked'](_0x24fc('0x1d'),_0x24fc('0x1e')),controller[_0x24fc('0x1f')]);router[_0x24fc('0x1c')]('/:id/tags',auth[_0x24fc('0xa')](),controller[_0x24fc('0x20')]);module[_0x24fc('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 008a9bd..d9fcc85 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 _0xd736=['exports','TEXT','ENUM','out','sequelize'];(function(_0x14066c,_0x5ab83a){var _0x4e5797=function(_0x1f912f){while(--_0x1f912f){_0x14066c['push'](_0x14066c['shift']());}};_0x4e5797(++_0x5ab83a);}(_0xd736,0xa9));var _0x6d73=function(_0x37e8a8,_0x121a98){_0x37e8a8=_0x37e8a8-0x0;var _0x456e21=_0xd736[_0x37e8a8];return _0x456e21;};'use strict';var Sequelize=require(_0x6d73('0x0'));module[_0x6d73('0x1')]={'body':{'type':Sequelize[_0x6d73('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6d73('0x3')]('in',_0x6d73('0x4')),'defaultValue':_0x6d73('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xeb7e=['exports','TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x1afa9a,_0x2297ae){var _0x35d2a9=function(_0x1c40b8){while(--_0x1c40b8){_0x1afa9a['push'](_0x1afa9a['shift']());}};_0x35d2a9(++_0x2297ae);}(_0xeb7e,0x117));var _0xeeb7=function(_0x4eaa32,_0x473ad9){_0x4eaa32=_0x4eaa32-0x0;var _0x28d2b1=_0xeb7e[_0x4eaa32];return _0x28d2b1;};'use strict';var Sequelize=require(_0xeeb7('0x0'));module[_0xeeb7('0x1')]={'body':{'type':Sequelize[_0xeeb7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeeb7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeeb7('0x4')]('in',_0xeeb7('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xeeb7('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xeeb7('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 9401a28..bdaf897 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 _0x5fae=['key','model','query','keys','filters','intersection','fields','length','attributes','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','params','update','body','find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','get','FaxInteraction','FaxInteractionId','UserId','read1stAt','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','sendStatus','end','status','limit','set','json','reject','save','destroy','name','send','index','map','FaxMessage','rawAttributes','type'];(function(_0x525608,_0x8f7ed6){var _0x2a4e98=function(_0x47356d){while(--_0x47356d){_0x525608['push'](_0x525608['shift']());}};_0x2a4e98(++_0x8f7ed6);}(_0x5fae,0x152));var _0xe5fa=function(_0x55c4f4,_0x5cee72){_0x55c4f4=_0x55c4f4-0x0;var _0x20684c=_0x5fae[_0x55c4f4];return _0x20684c;};'use strict';var pdf=require(_0xe5fa('0x0'));var emlformat=require(_0xe5fa('0x1'));var rimraf=require(_0xe5fa('0x2'));var zipdir=require(_0xe5fa('0x3'));var jsonpatch=require(_0xe5fa('0x4'));var rp=require(_0xe5fa('0x5'));var moment=require(_0xe5fa('0x6'));var BPromise=require(_0xe5fa('0x7'));var Mustache=require('mustache');var util=require(_0xe5fa('0x8'));var path=require(_0xe5fa('0x9'));var sox=require(_0xe5fa('0xa'));var csv=require(_0xe5fa('0xb'));var ejs=require(_0xe5fa('0xc'));var fs=require('fs');var _=require(_0xe5fa('0xd'));var squel=require('squel');var crypto=require(_0xe5fa('0xe'));var jsforce=require(_0xe5fa('0xf'));var deskjs=require(_0xe5fa('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe5fa('0x11'));var Papa=require(_0xe5fa('0x12'));var Redis=require('ioredis');var authService=require(_0xe5fa('0x13'));var qs=require(_0xe5fa('0x14'));var as=require(_0xe5fa('0x15'));var hardwareService=require(_0xe5fa('0x16'));var logger=require(_0xe5fa('0x17'))(_0xe5fa('0x18'));var utils=require(_0xe5fa('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe5fa('0x1a'))['db'];config[_0xe5fa('0x1b')]=_[_0xe5fa('0x1c')](config[_0xe5fa('0x1b')],{'host':_0xe5fa('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5fa('0x1b')]));require('./faxMessage.socket')[_0xe5fa('0x1e')](socket);var jayson=require(_0xe5fa('0x1f'));var client=jayson[_0xe5fa('0x20')][_0xe5fa('0x21')]({'port':0x232c});var client9002=jayson[_0xe5fa('0x20')][_0xe5fa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x556726,_0xf71cf,_0x2d2598,_0x4b4a79){return new BPromise(function(_0x530fdc,_0x57de8c){var _0x1fac34=_0x4b4a79||client;return _0x1fac34[_0xe5fa('0x22')](_0x556726,_0x2d2598)[_0xe5fa('0x23')](function(_0x187efd){logger['info'](_0xe5fa('0x24'),_0xf71cf,'request\x20sent');logger[_0xe5fa('0x25')](_0xe5fa('0x26'),_0xf71cf,_0xe5fa('0x27'),JSON['stringify'](_0x187efd));if(_0x187efd[_0xe5fa('0x28')]){if(_0x187efd['error']['code']===0x1f4){logger[_0xe5fa('0x28')](_0xe5fa('0x24'),_0xf71cf,_0x187efd[_0xe5fa('0x28')][_0xe5fa('0x29')]);return _0x57de8c(_0x187efd[_0xe5fa('0x28')][_0xe5fa('0x29')]);}logger[_0xe5fa('0x28')]('FaxMessage,\x20%s,\x20%s',_0xf71cf,_0x187efd[_0xe5fa('0x28')][_0xe5fa('0x29')]);return _0x530fdc(_0x187efd[_0xe5fa('0x28')][_0xe5fa('0x29')]);}else{logger[_0xe5fa('0x2a')](_0xe5fa('0x24'),_0xf71cf,'request\x20sent');_0x530fdc(_0x187efd[_0xe5fa('0x2b')][_0xe5fa('0x29')]);}})[_0xe5fa('0x2c')](function(_0x146c3f){logger['error'](_0xe5fa('0x24'),_0xf71cf,_0x146c3f);_0x57de8c(_0x146c3f);});});}function respondWithStatusCode(_0x3668c0,_0x422d70){_0x422d70=_0x422d70||0xcc;return function(_0xcdece2){if(_0xcdece2){return _0x3668c0[_0xe5fa('0x2d')](_0x422d70);}return _0x3668c0['status'](_0x422d70)[_0xe5fa('0x2e')]();};}function respondWithResult(_0x44a552,_0x393a60){_0x393a60=_0x393a60||0xc8;return function(_0x7ba81c){if(_0x7ba81c){return _0x44a552[_0xe5fa('0x2f')](_0x393a60)['json'](_0x7ba81c);}};}function respondWithFilteredResult(_0x4c9037,_0x185c26){return function(_0x2e3255){if(_0x2e3255){var _0x57e403=_0x2e3255['count'],_0x2e6c1d=_0x185c26['offset'],_0x2082f8=_0x185c26['offset']+_0x185c26[_0xe5fa('0x30')],_0x5d2d2b;if(_0x2082f8>=_0x57e403){_0x2082f8=_0x57e403;_0x5d2d2b=0xc8;}else{_0x5d2d2b=0xce;}_0x4c9037['status'](_0x5d2d2b);return _0x4c9037[_0xe5fa('0x31')]('Content-Range',_0x2e6c1d+'-'+_0x2082f8+'/'+_0x57e403)[_0xe5fa('0x32')](_0x2e3255);}return null;};}function patchUpdates(_0x385c95){return function(_0x463e5e){try{jsonpatch['apply'](_0x463e5e,_0x385c95,!![]);}catch(_0x3614f0){return BPromise[_0xe5fa('0x33')](_0x3614f0);}return _0x463e5e[_0xe5fa('0x34')]();};}function saveUpdates(_0x1b4604,_0x439cbf){return function(_0x27a257){if(_0x27a257){return _0x27a257['update'](_0x1b4604)['then'](function(_0xc4537){return _0xc4537;});}return null;};}function removeEntity(_0x429fc0,_0x282487){return function(_0x5d7c79){if(_0x5d7c79){return _0x5d7c79[_0xe5fa('0x35')]()['then'](function(){_0x429fc0[_0xe5fa('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0f2f,_0x19b55d){return function(_0x45a2ed){if(!_0x45a2ed){_0x4d0f2f[_0xe5fa('0x2d')](0x194);}return _0x45a2ed;};}function handleError(_0x37917d,_0x1e1357){_0x1e1357=_0x1e1357||0x1f4;return function(_0x434edc){logger['error'](_0x434edc['stack']);if(_0x434edc[_0xe5fa('0x36')]){delete _0x434edc[_0xe5fa('0x36')];}_0x37917d[_0xe5fa('0x2f')](_0x1e1357)[_0xe5fa('0x37')](_0x434edc);};}exports[_0xe5fa('0x38')]=function(_0x510934,_0x294b69){var _0x4a609c={},_0x25a391={},_0x2ab7c4={'count':0x0,'rows':[]};var _0x98a21e=_[_0xe5fa('0x39')](db[_0xe5fa('0x3a')][_0xe5fa('0x3b')],function(_0x11ac5b){return{'name':_0x11ac5b['fieldName'],'type':_0x11ac5b[_0xe5fa('0x3c')][_0xe5fa('0x3d')]};});_0x25a391[_0xe5fa('0x3e')]=_[_0xe5fa('0x39')](_0x98a21e,'name');_0x25a391[_0xe5fa('0x3f')]=_[_0xe5fa('0x40')](_0x510934[_0xe5fa('0x3f')]);_0x25a391[_0xe5fa('0x41')]=_['intersection'](_0x25a391['model'],_0x25a391[_0xe5fa('0x3f')]);_0x4a609c['attributes']=_[_0xe5fa('0x42')](_0x25a391[_0xe5fa('0x3e')],qs[_0xe5fa('0x43')](_0x510934[_0xe5fa('0x3f')][_0xe5fa('0x43')]));_0x4a609c['attributes']=_0x4a609c['attributes'][_0xe5fa('0x44')]?_0x4a609c[_0xe5fa('0x45')]:_0x25a391['model'];if(!_0x510934[_0xe5fa('0x3f')]['hasOwnProperty']('nolimit')){_0x4a609c[_0xe5fa('0x30')]=qs[_0xe5fa('0x30')](_0x510934[_0xe5fa('0x3f')][_0xe5fa('0x30')]);_0x4a609c[_0xe5fa('0x46')]=qs[_0xe5fa('0x46')](_0x510934[_0xe5fa('0x3f')]['offset']);}_0x4a609c[_0xe5fa('0x47')]=qs[_0xe5fa('0x48')](_0x510934[_0xe5fa('0x3f')][_0xe5fa('0x48')]);_0x4a609c[_0xe5fa('0x49')]=qs[_0xe5fa('0x41')](_[_0xe5fa('0x4a')](_0x510934['query'],_0x25a391['filters']),_0x98a21e);if(_0x510934['query'][_0xe5fa('0x4b')]){_0x4a609c[_0xe5fa('0x49')]=_['merge'](_0x4a609c['where'],{'$or':_[_0xe5fa('0x39')](_0x98a21e,function(_0x47173c){if(_0x47173c['type']!==_0xe5fa('0x4c')){var _0x64fb4a={};_0x64fb4a[_0x47173c[_0xe5fa('0x36')]]={'$like':'%'+_0x510934['query'][_0xe5fa('0x4b')]+'%'};return _0x64fb4a;}})});}_0x4a609c=_[_0xe5fa('0x4d')]({},_0x4a609c,_0x510934[_0xe5fa('0x4e')]);var _0x4748aa={'where':_0x4a609c[_0xe5fa('0x49')]};return db['FaxMessage'][_0xe5fa('0x4f')](_0x4748aa)[_0xe5fa('0x23')](function(_0x25d950){_0x2ab7c4[_0xe5fa('0x4f')]=_0x25d950;if(_0x510934[_0xe5fa('0x3f')][_0xe5fa('0x50')]){_0x4a609c['include']=[{'all':!![]}];}return db[_0xe5fa('0x3a')][_0xe5fa('0x51')](_0x4a609c);})[_0xe5fa('0x23')](function(_0x5dca19){_0x2ab7c4[_0xe5fa('0x52')]=_0x5dca19;return _0x2ab7c4;})[_0xe5fa('0x23')](respondWithFilteredResult(_0x294b69,_0x4a609c))['catch'](handleError(_0x294b69,null));};exports['show']=function(_0x41150b,_0xfe3da8){var _0x1133bf={'raw':!![],'where':{'id':_0x41150b[_0xe5fa('0x53')]['id']}},_0x3e48d4={};_0x3e48d4[_0xe5fa('0x3e')]=_[_0xe5fa('0x40')](db[_0xe5fa('0x3a')][_0xe5fa('0x3b')]);_0x3e48d4[_0xe5fa('0x3f')]=_['keys'](_0x41150b[_0xe5fa('0x3f')]);_0x3e48d4['filters']=_[_0xe5fa('0x42')](_0x3e48d4['model'],_0x3e48d4['query']);_0x1133bf[_0xe5fa('0x45')]=_[_0xe5fa('0x42')](_0x3e48d4[_0xe5fa('0x3e')],qs[_0xe5fa('0x43')](_0x41150b[_0xe5fa('0x3f')]['fields']));_0x1133bf[_0xe5fa('0x45')]=_0x1133bf[_0xe5fa('0x45')][_0xe5fa('0x44')]?_0x1133bf[_0xe5fa('0x45')]:_0x3e48d4['model'];if(_0x41150b[_0xe5fa('0x3f')]['includeAll']){_0x1133bf['include']=[{'all':!![]}];}_0x1133bf=_[_0xe5fa('0x4d')]({},_0x1133bf,_0x41150b['options']);return db['FaxMessage']['find'](_0x1133bf)[_0xe5fa('0x23')](handleEntityNotFound(_0xfe3da8,null))['then'](respondWithResult(_0xfe3da8,null))[_0xe5fa('0x2c')](handleError(_0xfe3da8,null));};exports[_0xe5fa('0x54')]=function(_0x25b95e,_0x2dea8b){if(_0x25b95e[_0xe5fa('0x55')]['id']){delete _0x25b95e[_0xe5fa('0x55')]['id'];}return db['FaxMessage'][_0xe5fa('0x56')]({'where':{'id':_0x25b95e[_0xe5fa('0x53')]['id']}})[_0xe5fa('0x23')](handleEntityNotFound(_0x2dea8b,null))[_0xe5fa('0x23')](saveUpdates(_0x25b95e[_0xe5fa('0x55')],null))[_0xe5fa('0x23')](respondWithResult(_0x2dea8b,null))['catch'](handleError(_0x2dea8b,null));};exports[_0xe5fa('0x35')]=function(_0x11ad5d,_0x151875){return db['FaxMessage']['find']({'where':{'id':_0x11ad5d[_0xe5fa('0x53')]['id']}})[_0xe5fa('0x23')](handleEntityNotFound(_0x151875,null))[_0xe5fa('0x23')](removeEntity(_0x151875,null))['catch'](handleError(_0x151875,null));};exports[_0xe5fa('0x57')]=function(_0x3f3275,_0x306cf1){return db[_0xe5fa('0x3a')]['describe']()[_0xe5fa('0x23')](respondWithResult(_0x306cf1,null))[_0xe5fa('0x2c')](handleError(_0x306cf1,null));};var interaction_log=require(_0xe5fa('0x17'))(_0xe5fa('0x58'));exports[_0xe5fa('0x59')]=function(_0x394064,_0x184e6f,_0x292faa){var _0x5e3181={'channel':_0xe5fa('0x5a')};if(_0x394064[_0xe5fa('0x55')]['id']){delete _0x394064[_0xe5fa('0x55')]['id'];}_0x394064['body'][_0xe5fa('0x5b')]=!![];_0x394064[_0xe5fa('0x55')][_0xe5fa('0x5c')]=moment()[_0xe5fa('0x5d')](_0xe5fa('0x5e'));_0x394064[_0xe5fa('0x55')]['UserId']=_0x394064[_0xe5fa('0x55')]['UserId']||_0x394064['user']['id'];return db[_0xe5fa('0x3a')][_0xe5fa('0x56')]({'where':{'id':_0x394064[_0xe5fa('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xe5fa('0x5f')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x184e6f,null))['then'](saveUpdates(_0x394064[_0xe5fa('0x55')],null))[_0xe5fa('0x23')](function(_0xb97131){if(_0xb97131){_0x5e3181['message']=_0xb97131[_0xe5fa('0x60')]({'plain':!![]});return db[_0xe5fa('0x61')][_0xe5fa('0x56')]({'where':{'id':_0xb97131[_0xe5fa('0x62')]}});}return null;})[_0xe5fa('0x23')](handleEntityNotFound(_0x184e6f,null))[_0xe5fa('0x23')](function(_0x992da4){if(_0x992da4){return _0x992da4['update']({'UserId':_0x394064[_0xe5fa('0x55')][_0xe5fa('0x63')],'read1stAt':_['isNil'](_0x992da4[_0xe5fa('0x64')])?moment()[_0xe5fa('0x5d')](_0xe5fa('0x5e')):undefined});}return null;})[_0xe5fa('0x23')](function(_0x5653d7){if(_0x5653d7){_0x5e3181[_0xe5fa('0x65')]=_0x5653d7[_0xe5fa('0x60')]({'plain':!![]});interaction_log[_0xe5fa('0x2a')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x394064[_0xe5fa('0x66')]['id'],_0x394064['user']['name'],_0x394064['user'][_0xe5fa('0x67')],_0x5e3181[_0xe5fa('0x65')]['id'],_0x394064[_0xe5fa('0x55')]?JSON[_0xe5fa('0x68')](_0x394064[_0xe5fa('0x55')]):_0xe5fa('0x69'));return respondWithRpcPromise(_0xe5fa('0x6a'),_0xe5fa('0x6b'),_0x5e3181);}return null;})[_0xe5fa('0x23')](function(_0x598eb2){if(_0x598eb2){if(_0x394064[_0xe5fa('0x55')][_0xe5fa('0x6c')]){_0x5e3181[_0xe5fa('0x29')]['interface']=util[_0xe5fa('0x5d')]('SIP/%s',_0x394064[_0xe5fa('0x66')][_0xe5fa('0x36')]);_0x5e3181[_0xe5fa('0x29')][_0xe5fa('0x6d')]=_0x5e3181[_0xe5fa('0x6d')];_0x5e3181[_0xe5fa('0x29')][_0xe5fa('0x6e')]=_0xe5fa('0x59');return respondWithRpcPromise('EventManager',_0xe5fa('0x6f'),{'event':'acceptmessage','message':_0x5e3181[_0xe5fa('0x29')]},client9002)[_0xe5fa('0x23')](function(){return _0x5e3181;});}return _0x5e3181;}return null;})[_0xe5fa('0x23')](respondWithResult(_0x184e6f,null))[_0xe5fa('0x2c')](handleError(_0x184e6f,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xe5fa('0x33')]=function(_0x5aadf2,_0x2848d0,_0x1367c6){var _0x3b3677={'agent':{},'channel':_0xe5fa('0x5a')};if(_0x5aadf2[_0xe5fa('0x55')]['id']){delete _0x5aadf2[_0xe5fa('0x55')]['id'];}_0x5aadf2[_0xe5fa('0x55')]['UserId']=_0x5aadf2['body']['UserId']||_0x5aadf2[_0xe5fa('0x66')]['id'];_0x3b3677[_0xe5fa('0x70')]['id']=_0x5aadf2[_0xe5fa('0x55')][_0xe5fa('0x63')];return db[_0xe5fa('0x3a')]['find']({'where':{'id':_0x5aadf2['params']['id'],'UserId':null}})[_0xe5fa('0x23')](handleEntityNotFound(_0x2848d0,null))[_0xe5fa('0x23')](function(_0x3f4b84){if(_0x3f4b84){_0x3b3677[_0xe5fa('0x29')]=_0x3f4b84['get']({'plain':!![]});return db[_0xe5fa('0x61')]['find']({'where':{'id':_0x3f4b84[_0xe5fa('0x62')]}});}return null;})[_0xe5fa('0x23')](handleEntityNotFound(_0x2848d0,null))[_0xe5fa('0x23')](function(_0x274fcf){if(_0x274fcf){_0x3b3677[_0xe5fa('0x65')]=_0x274fcf['get']({'plain':!![]});interaction_log['info'](_0xe5fa('0x71'),_0x5aadf2[_0xe5fa('0x66')]['id'],_0x5aadf2[_0xe5fa('0x66')]['name'],_0x5aadf2[_0xe5fa('0x66')][_0xe5fa('0x67')],_0x3b3677[_0xe5fa('0x65')]['id'],_0x5aadf2[_0xe5fa('0x55')]?JSON[_0xe5fa('0x68')](_0x5aadf2[_0xe5fa('0x55')]):'null');return respondWithRpcPromise(_0xe5fa('0x72'),_0xe5fa('0x73'),_0x3b3677);}return null;})[_0xe5fa('0x23')](function(_0x5617ca){if(_0x5617ca){_0x5617ca[_0xe5fa('0x29')][_0xe5fa('0x74')]=util[_0xe5fa('0x5d')](_0xe5fa('0x75'),_0x5aadf2[_0xe5fa('0x66')][_0xe5fa('0x36')]);_0x5617ca[_0xe5fa('0x29')][_0xe5fa('0x6d')]=_0x3b3677['channel'];_0x5617ca[_0xe5fa('0x29')]['event']='reject';respondWithRpcPromise(_0xe5fa('0x6f'),_0xe5fa('0x6f'),{'event':_0xe5fa('0x76'),'message':_0x5617ca[_0xe5fa('0x29')]},client9002);return _0x3b3677;}return null;})['then'](respondWithResult(_0x2848d0,null))['catch'](handleError(_0x2848d0,null));};exports[_0xe5fa('0x77')]=function(_0x109ecc,_0x4c6e7c){var _0x32e260;return db[_0xe5fa('0x3a')]['create'](_0x109ecc[_0xe5fa('0x55')],{})[_0xe5fa('0x23')](function(_0x5c9ea6){_0x32e260=_0x5c9ea6;return db[_0xe5fa('0x5f')][_0xe5fa('0x78')]({'where':{'id':_0x32e260['ContactId']}});})[_0xe5fa('0x23')](function(_0x55da80){if(_[_0xe5fa('0x79')](_0x55da80)){return;}else{_0x32e260[_0xe5fa('0x5a')]=_0x55da80[_0xe5fa('0x5a')];return db[_0xe5fa('0x7a')][_0xe5fa('0x78')]({'where':{'id':_0x32e260[_0xe5fa('0x7b')]}});}})['then'](function(_0x41c242){return respondWithRpcPromise(_0xe5fa('0x7c'),_0xe5fa('0x7c'),{'FaxAccountId':_[_0xe5fa('0x79')](_0x109ecc[_0xe5fa('0x55')])?undefined:_0x109ecc[_0xe5fa('0x55')]['FaxAccountId'],'path':_[_0xe5fa('0x79')](_0x41c242)?undefined:util[_0xe5fa('0x5d')](_0xe5fa('0x7d'),_0x41c242[_0xe5fa('0x7e')]),'fax':_[_0xe5fa('0x79')](_0x32e260[_0xe5fa('0x5a')])?undefined:_0x32e260[_0xe5fa('0x5a')],'AttachmentId':_0x32e260[_0xe5fa('0x7b')]},client9002);})[_0xe5fa('0x23')](respondWithResult(_0x4c6e7c,0xc9))[_0xe5fa('0x2c')](handleError(_0x4c6e7c,null));};exports[_0xe5fa('0x7f')]=function(_0x38f511,_0x238a5b){var _0x41cc27=path[_0xe5fa('0x80')](config[_0xe5fa('0x81')],_0xe5fa('0x82'),_0xe5fa('0x83'),_0xe5fa('0x84'));return db[_0xe5fa('0x3a')][_0xe5fa('0x56')]({'where':{'id':_0x38f511['params']['id']},'include':[{'model':db[_0xe5fa('0x7a')],'as':_0xe5fa('0x7a')}]})['then'](handleEntityNotFound(_0x238a5b,null))[_0xe5fa('0x23')](function(_0x4de479){if(_0x4de479){return _0x238a5b[_0xe5fa('0x7f')](path[_0xe5fa('0x80')](_0x41cc27,_0x4de479[_0xe5fa('0x7a')][_0xe5fa('0x7e')]));}})['catch'](handleError(_0x238a5b,null));}; \ No newline at end of file +var _0x5b1c=['length','body','find','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','null','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','role','RejectMessage','rejectMessage','create','findOne','ContactId','Attachment','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','download','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','fields'];(function(_0x1fdfc9,_0x58764a){var _0x2887c8=function(_0x236137){while(--_0x236137){_0x1fdfc9['push'](_0x1fdfc9['shift']());}};_0x2887c8(++_0x58764a);}(_0x5b1c,0x1b9));var _0xc5b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5b1c[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xc5b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc5b1('0x1'));var zipdir=require(_0xc5b1('0x2'));var jsonpatch=require(_0xc5b1('0x3'));var rp=require(_0xc5b1('0x4'));var moment=require(_0xc5b1('0x5'));var BPromise=require(_0xc5b1('0x6'));var Mustache=require(_0xc5b1('0x7'));var util=require(_0xc5b1('0x8'));var path=require(_0xc5b1('0x9'));var sox=require(_0xc5b1('0xa'));var csv=require(_0xc5b1('0xb'));var ejs=require(_0xc5b1('0xc'));var fs=require('fs');var _=require(_0xc5b1('0xd'));var squel=require(_0xc5b1('0xe'));var crypto=require(_0xc5b1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc5b1('0x10'));var toCsv=require(_0xc5b1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5b1('0x11'));var authService=require(_0xc5b1('0x12'));var qs=require(_0xc5b1('0x13'));var as=require(_0xc5b1('0x14'));var hardwareService=require(_0xc5b1('0x15'));var logger=require(_0xc5b1('0x16'))(_0xc5b1('0x17'));var utils=require(_0xc5b1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc5b1('0x19'));var db=require(_0xc5b1('0x1a'))['db'];config[_0xc5b1('0x1b')]=_[_0xc5b1('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc5b1('0x1d'))(new Redis(config[_0xc5b1('0x1b')]));require(_0xc5b1('0x1e'))[_0xc5b1('0x1f')](socket);var jayson=require(_0xc5b1('0x20'));var client=jayson[_0xc5b1('0x21')][_0xc5b1('0x22')]({'port':0x232c});var client9002=jayson[_0xc5b1('0x21')][_0xc5b1('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5a61fa,_0x4880d1,_0x14e0a9,_0x5d1b0c){return new BPromise(function(_0x2b42bf,_0x2fb570){var _0x3bc11b=_0x5d1b0c||client;return _0x3bc11b[_0xc5b1('0x23')](_0x5a61fa,_0x14e0a9)['then'](function(_0x4d1725){logger[_0xc5b1('0x24')](_0xc5b1('0x25'),_0x4880d1,_0xc5b1('0x26'));logger[_0xc5b1('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4880d1,'request\x20sent',JSON[_0xc5b1('0x28')](_0x4d1725));if(_0x4d1725[_0xc5b1('0x29')]){if(_0x4d1725[_0xc5b1('0x29')]['code']===0x1f4){logger[_0xc5b1('0x29')]('FaxMessage,\x20%s,\x20%s',_0x4880d1,_0x4d1725[_0xc5b1('0x29')][_0xc5b1('0x2a')]);return _0x2fb570(_0x4d1725[_0xc5b1('0x29')][_0xc5b1('0x2a')]);}logger[_0xc5b1('0x29')](_0xc5b1('0x25'),_0x4880d1,_0x4d1725[_0xc5b1('0x29')][_0xc5b1('0x2a')]);return _0x2b42bf(_0x4d1725[_0xc5b1('0x29')][_0xc5b1('0x2a')]);}else{logger[_0xc5b1('0x24')](_0xc5b1('0x25'),_0x4880d1,'request\x20sent');_0x2b42bf(_0x4d1725['result'][_0xc5b1('0x2a')]);}})[_0xc5b1('0x2b')](function(_0x53e9f9){logger[_0xc5b1('0x29')](_0xc5b1('0x25'),_0x4880d1,_0x53e9f9);_0x2fb570(_0x53e9f9);});});}function respondWithStatusCode(_0x29d52a,_0x536efa){_0x536efa=_0x536efa||0xcc;return function(_0x36aa94){if(_0x36aa94){return _0x29d52a[_0xc5b1('0x2c')](_0x536efa);}return _0x29d52a[_0xc5b1('0x2d')](_0x536efa)[_0xc5b1('0x2e')]();};}function respondWithResult(_0xa0b9bc,_0x441e48){_0x441e48=_0x441e48||0xc8;return function(_0x317f3f){if(_0x317f3f){return _0xa0b9bc[_0xc5b1('0x2d')](_0x441e48)[_0xc5b1('0x2f')](_0x317f3f);}};}function respondWithFilteredResult(_0x37fca1,_0x1fc4fa){return function(_0x181518){if(_0x181518){var _0x125b53=_0x181518[_0xc5b1('0x30')],_0xc7d0a5=_0x1fc4fa[_0xc5b1('0x31')],_0x10f07c=_0x1fc4fa[_0xc5b1('0x31')]+_0x1fc4fa[_0xc5b1('0x32')],_0x2d2e7d;if(_0x10f07c>=_0x125b53){_0x10f07c=_0x125b53;_0x2d2e7d=0xc8;}else{_0x2d2e7d=0xce;}_0x37fca1[_0xc5b1('0x2d')](_0x2d2e7d);return _0x37fca1[_0xc5b1('0x33')](_0xc5b1('0x34'),_0xc7d0a5+'-'+_0x10f07c+'/'+_0x125b53)['json'](_0x181518);}return null;};}function patchUpdates(_0x190919){return function(_0x5d407e){try{jsonpatch[_0xc5b1('0x35')](_0x5d407e,_0x190919,!![]);}catch(_0x30a782){return BPromise[_0xc5b1('0x36')](_0x30a782);}return _0x5d407e[_0xc5b1('0x37')]();};}function saveUpdates(_0x3b73b5,_0x366e91){return function(_0x22fc28){if(_0x22fc28){return _0x22fc28[_0xc5b1('0x38')](_0x3b73b5)[_0xc5b1('0x39')](function(_0x44f07a){return _0x44f07a;});}return null;};}function removeEntity(_0x40cf6b,_0x1e9170){return function(_0x5478c6){if(_0x5478c6){return _0x5478c6[_0xc5b1('0x3a')]()[_0xc5b1('0x39')](function(){_0x40cf6b['status'](0xcc)[_0xc5b1('0x2e')]();});}};}function handleEntityNotFound(_0x216b99,_0x508ff0){return function(_0x181234){if(!_0x181234){_0x216b99[_0xc5b1('0x2c')](0x194);}return _0x181234;};}function handleError(_0x108c43,_0x26bc51){_0x26bc51=_0x26bc51||0x1f4;return function(_0x34eaa3){logger[_0xc5b1('0x29')](_0x34eaa3[_0xc5b1('0x3b')]);if(_0x34eaa3[_0xc5b1('0x3c')]){delete _0x34eaa3[_0xc5b1('0x3c')];}_0x108c43[_0xc5b1('0x2d')](_0x26bc51)[_0xc5b1('0x3d')](_0x34eaa3);};}exports[_0xc5b1('0x3e')]=function(_0x4ea75d,_0x18d76e){var _0x3b5369={},_0x3969dd={},_0x3259d7={'count':0x0,'rows':[]};var _0x14e755=_[_0xc5b1('0x3f')](db[_0xc5b1('0x40')][_0xc5b1('0x41')],function(_0x5d93b9){return{'name':_0x5d93b9[_0xc5b1('0x42')],'type':_0x5d93b9['type'][_0xc5b1('0x43')]};});_0x3969dd['model']=_['map'](_0x14e755,_0xc5b1('0x3c'));_0x3969dd['query']=_[_0xc5b1('0x44')](_0x4ea75d['query']);_0x3969dd[_0xc5b1('0x45')]=_[_0xc5b1('0x46')](_0x3969dd[_0xc5b1('0x47')],_0x3969dd[_0xc5b1('0x48')]);_0x3b5369[_0xc5b1('0x49')]=_[_0xc5b1('0x46')](_0x3969dd[_0xc5b1('0x47')],qs['fields'](_0x4ea75d[_0xc5b1('0x48')]['fields']));_0x3b5369[_0xc5b1('0x49')]=_0x3b5369[_0xc5b1('0x49')]['length']?_0x3b5369[_0xc5b1('0x49')]:_0x3969dd[_0xc5b1('0x47')];if(!_0x4ea75d[_0xc5b1('0x48')][_0xc5b1('0x4a')](_0xc5b1('0x4b'))){_0x3b5369[_0xc5b1('0x32')]=qs[_0xc5b1('0x32')](_0x4ea75d[_0xc5b1('0x48')][_0xc5b1('0x32')]);_0x3b5369[_0xc5b1('0x31')]=qs[_0xc5b1('0x31')](_0x4ea75d['query']['offset']);}_0x3b5369[_0xc5b1('0x4c')]=qs[_0xc5b1('0x4d')](_0x4ea75d[_0xc5b1('0x48')][_0xc5b1('0x4d')]);_0x3b5369['where']=qs[_0xc5b1('0x45')](_[_0xc5b1('0x4e')](_0x4ea75d[_0xc5b1('0x48')],_0x3969dd[_0xc5b1('0x45')]),_0x14e755);if(_0x4ea75d['query'][_0xc5b1('0x4f')]){_0x3b5369[_0xc5b1('0x50')]=_[_0xc5b1('0x51')](_0x3b5369[_0xc5b1('0x50')],{'$or':_[_0xc5b1('0x3f')](_0x14e755,function(_0xd5b9aa){if(_0xd5b9aa[_0xc5b1('0x52')]!==_0xc5b1('0x53')){var _0x36911c={};_0x36911c[_0xd5b9aa[_0xc5b1('0x3c')]]={'$like':'%'+_0x4ea75d[_0xc5b1('0x48')][_0xc5b1('0x4f')]+'%'};return _0x36911c;}})});}_0x3b5369=_[_0xc5b1('0x51')]({},_0x3b5369,_0x4ea75d[_0xc5b1('0x54')]);var _0x454c18={'where':_0x3b5369[_0xc5b1('0x50')]};return db[_0xc5b1('0x40')][_0xc5b1('0x30')](_0x454c18)[_0xc5b1('0x39')](function(_0x2fbf4c){_0x3259d7['count']=_0x2fbf4c;if(_0x4ea75d[_0xc5b1('0x48')][_0xc5b1('0x55')]){_0x3b5369[_0xc5b1('0x56')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3b5369);})[_0xc5b1('0x39')](function(_0x4dc6df){_0x3259d7[_0xc5b1('0x57')]=_0x4dc6df;return _0x3259d7;})[_0xc5b1('0x39')](respondWithFilteredResult(_0x18d76e,_0x3b5369))['catch'](handleError(_0x18d76e,null));};exports[_0xc5b1('0x58')]=function(_0x15b3a9,_0x5387c7){var _0x3b5204={'raw':!![],'where':{'id':_0x15b3a9[_0xc5b1('0x59')]['id']}},_0x4f1984={};_0x4f1984[_0xc5b1('0x47')]=_[_0xc5b1('0x44')](db[_0xc5b1('0x40')][_0xc5b1('0x41')]);_0x4f1984[_0xc5b1('0x48')]=_[_0xc5b1('0x44')](_0x15b3a9['query']);_0x4f1984[_0xc5b1('0x45')]=_[_0xc5b1('0x46')](_0x4f1984[_0xc5b1('0x47')],_0x4f1984['query']);_0x3b5204[_0xc5b1('0x49')]=_['intersection'](_0x4f1984['model'],qs[_0xc5b1('0x5a')](_0x15b3a9[_0xc5b1('0x48')][_0xc5b1('0x5a')]));_0x3b5204[_0xc5b1('0x49')]=_0x3b5204[_0xc5b1('0x49')][_0xc5b1('0x5b')]?_0x3b5204[_0xc5b1('0x49')]:_0x4f1984['model'];if(_0x15b3a9[_0xc5b1('0x48')][_0xc5b1('0x55')]){_0x3b5204['include']=[{'all':!![]}];}_0x3b5204=_[_0xc5b1('0x51')]({},_0x3b5204,_0x15b3a9[_0xc5b1('0x54')]);return db[_0xc5b1('0x40')]['find'](_0x3b5204)[_0xc5b1('0x39')](handleEntityNotFound(_0x5387c7,null))['then'](respondWithResult(_0x5387c7,null))[_0xc5b1('0x2b')](handleError(_0x5387c7,null));};exports[_0xc5b1('0x38')]=function(_0x2dbce6,_0x51b9c4){if(_0x2dbce6[_0xc5b1('0x5c')]['id']){delete _0x2dbce6['body']['id'];}return db[_0xc5b1('0x40')]['find']({'where':{'id':_0x2dbce6['params']['id']}})[_0xc5b1('0x39')](handleEntityNotFound(_0x51b9c4,null))['then'](saveUpdates(_0x2dbce6[_0xc5b1('0x5c')],null))['then'](respondWithResult(_0x51b9c4,null))[_0xc5b1('0x2b')](handleError(_0x51b9c4,null));};exports[_0xc5b1('0x3a')]=function(_0x16d51e,_0x5c40ab){return db[_0xc5b1('0x40')][_0xc5b1('0x5d')]({'where':{'id':_0x16d51e[_0xc5b1('0x59')]['id']}})[_0xc5b1('0x39')](handleEntityNotFound(_0x5c40ab,null))[_0xc5b1('0x39')](removeEntity(_0x5c40ab,null))[_0xc5b1('0x2b')](handleError(_0x5c40ab,null));};exports[_0xc5b1('0x5e')]=function(_0x279793,_0x2cbcf0){return db['FaxMessage'][_0xc5b1('0x5e')]()['then'](respondWithResult(_0x2cbcf0,null))[_0xc5b1('0x2b')](handleError(_0x2cbcf0,null));};var interaction_log=require('../../config/logger')(_0xc5b1('0x5f'));exports[_0xc5b1('0x60')]=function(_0x1f5b45,_0x534e57,_0x3761a8){var _0x5bf9c8={'channel':_0xc5b1('0x61')};if(_0x1f5b45[_0xc5b1('0x5c')]['id']){delete _0x1f5b45[_0xc5b1('0x5c')]['id'];}_0x1f5b45['body'][_0xc5b1('0x62')]=!![];_0x1f5b45[_0xc5b1('0x5c')]['readAt']=moment()[_0xc5b1('0x63')](_0xc5b1('0x64'));_0x1f5b45[_0xc5b1('0x5c')][_0xc5b1('0x65')]=_0x1f5b45['body'][_0xc5b1('0x65')]||_0x1f5b45[_0xc5b1('0x66')]['id'];return db[_0xc5b1('0x40')][_0xc5b1('0x5d')]({'where':{'id':_0x1f5b45[_0xc5b1('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xc5b1('0x67')],'as':'Contact'}]})[_0xc5b1('0x39')](handleEntityNotFound(_0x534e57,null))['then'](saveUpdates(_0x1f5b45['body'],null))[_0xc5b1('0x39')](function(_0x113680){if(_0x113680){_0x5bf9c8['message']=_0x113680['get']({'plain':!![]});return db[_0xc5b1('0x68')][_0xc5b1('0x5d')]({'where':{'id':_0x113680[_0xc5b1('0x69')]}});}return null;})[_0xc5b1('0x39')](handleEntityNotFound(_0x534e57,null))[_0xc5b1('0x39')](function(_0x4619f6){if(_0x4619f6){return _0x4619f6['update']({'UserId':_0x1f5b45[_0xc5b1('0x5c')]['UserId'],'read1stAt':_[_0xc5b1('0x6a')](_0x4619f6[_0xc5b1('0x6b')])?moment()[_0xc5b1('0x63')](_0xc5b1('0x64')):undefined});}return null;})[_0xc5b1('0x39')](function(_0x5ccc65){if(_0x5ccc65){_0x5bf9c8[_0xc5b1('0x6c')]=_0x5ccc65[_0xc5b1('0x6d')]({'plain':!![]});interaction_log[_0xc5b1('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f5b45[_0xc5b1('0x66')]['id'],_0x1f5b45[_0xc5b1('0x66')][_0xc5b1('0x3c')],_0x1f5b45[_0xc5b1('0x66')]['role'],_0x5bf9c8[_0xc5b1('0x6c')]['id'],_0x1f5b45[_0xc5b1('0x5c')]?JSON[_0xc5b1('0x28')](_0x1f5b45[_0xc5b1('0x5c')]):_0xc5b1('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xc5b1('0x6f'),_0x5bf9c8);}return null;})[_0xc5b1('0x39')](function(_0x5675f5){if(_0x5675f5){if(_0x1f5b45[_0xc5b1('0x5c')]['manual']){_0x5bf9c8[_0xc5b1('0x2a')][_0xc5b1('0x70')]=util[_0xc5b1('0x63')](_0xc5b1('0x71'),_0x1f5b45['user'][_0xc5b1('0x3c')]);_0x5bf9c8[_0xc5b1('0x2a')][_0xc5b1('0x72')]=_0x5bf9c8[_0xc5b1('0x72')];_0x5bf9c8[_0xc5b1('0x2a')][_0xc5b1('0x73')]=_0xc5b1('0x60');return respondWithRpcPromise(_0xc5b1('0x74'),_0xc5b1('0x74'),{'event':_0xc5b1('0x75'),'message':_0x5bf9c8[_0xc5b1('0x2a')]},client9002)[_0xc5b1('0x39')](function(){return _0x5bf9c8;});}return _0x5bf9c8;}return null;})['then'](respondWithResult(_0x534e57,null))['catch'](handleError(_0x534e57,null));};var interaction_log=require(_0xc5b1('0x16'))('fax-interactions');exports[_0xc5b1('0x36')]=function(_0x1bfbf4,_0x5c9254,_0x394ad2){var _0x3954d2={'agent':{},'channel':_0xc5b1('0x61')};if(_0x1bfbf4[_0xc5b1('0x5c')]['id']){delete _0x1bfbf4[_0xc5b1('0x5c')]['id'];}_0x1bfbf4[_0xc5b1('0x5c')][_0xc5b1('0x65')]=_0x1bfbf4[_0xc5b1('0x5c')]['UserId']||_0x1bfbf4[_0xc5b1('0x66')]['id'];_0x3954d2[_0xc5b1('0x76')]['id']=_0x1bfbf4[_0xc5b1('0x5c')][_0xc5b1('0x65')];return db[_0xc5b1('0x40')][_0xc5b1('0x5d')]({'where':{'id':_0x1bfbf4[_0xc5b1('0x59')]['id'],'UserId':null}})[_0xc5b1('0x39')](handleEntityNotFound(_0x5c9254,null))['then'](function(_0xc0130c){if(_0xc0130c){_0x3954d2['message']=_0xc0130c[_0xc5b1('0x6d')]({'plain':!![]});return db[_0xc5b1('0x68')][_0xc5b1('0x5d')]({'where':{'id':_0xc0130c['FaxInteractionId']}});}return null;})[_0xc5b1('0x39')](handleEntityNotFound(_0x5c9254,null))[_0xc5b1('0x39')](function(_0x20359e){if(_0x20359e){_0x3954d2[_0xc5b1('0x6c')]=_0x20359e[_0xc5b1('0x6d')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1bfbf4[_0xc5b1('0x66')]['id'],_0x1bfbf4[_0xc5b1('0x66')]['name'],_0x1bfbf4[_0xc5b1('0x66')][_0xc5b1('0x77')],_0x3954d2[_0xc5b1('0x6c')]['id'],_0x1bfbf4['body']?JSON[_0xc5b1('0x28')](_0x1bfbf4[_0xc5b1('0x5c')]):_0xc5b1('0x6e'));return respondWithRpcPromise(_0xc5b1('0x78'),_0xc5b1('0x79'),_0x3954d2);}return null;})[_0xc5b1('0x39')](function(_0x572b26){if(_0x572b26){_0x572b26['message'][_0xc5b1('0x70')]=util[_0xc5b1('0x63')]('SIP/%s',_0x1bfbf4[_0xc5b1('0x66')][_0xc5b1('0x3c')]);_0x572b26['message'][_0xc5b1('0x72')]=_0x3954d2[_0xc5b1('0x72')];_0x572b26[_0xc5b1('0x2a')][_0xc5b1('0x73')]=_0xc5b1('0x36');respondWithRpcPromise('EventManager',_0xc5b1('0x74'),{'event':'rejectmessage','message':_0x572b26['message']},client9002);return _0x3954d2;}return null;})['then'](respondWithResult(_0x5c9254,null))[_0xc5b1('0x2b')](handleError(_0x5c9254,null));};exports[_0xc5b1('0x7a')]=function(_0x533b9b,_0x402eb0){var _0x581f79;return db[_0xc5b1('0x40')][_0xc5b1('0x7a')](_0x533b9b['body'],{})[_0xc5b1('0x39')](function(_0x38e8c8){_0x581f79=_0x38e8c8;return db[_0xc5b1('0x67')][_0xc5b1('0x7b')]({'where':{'id':_0x581f79[_0xc5b1('0x7c')]}});})[_0xc5b1('0x39')](function(_0x2caff2){if(_[_0xc5b1('0x6a')](_0x2caff2)){return;}else{_0x581f79[_0xc5b1('0x61')]=_0x2caff2['fax'];return db[_0xc5b1('0x7d')][_0xc5b1('0x7b')]({'where':{'id':_0x581f79['AttachmentId']}});}})[_0xc5b1('0x39')](function(_0x2c57b6){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xc5b1('0x6a')](_0x533b9b[_0xc5b1('0x5c')])?undefined:_0x533b9b['body']['FaxAccountId'],'path':_[_0xc5b1('0x6a')](_0x2c57b6)?undefined:util['format'](_0xc5b1('0x7e'),_0x2c57b6[_0xc5b1('0x7f')]),'fax':_[_0xc5b1('0x6a')](_0x581f79[_0xc5b1('0x61')])?undefined:_0x581f79[_0xc5b1('0x61')],'AttachmentId':_0x581f79[_0xc5b1('0x80')]},client9002);})['then'](respondWithResult(_0x402eb0,0xc9))[_0xc5b1('0x2b')](handleError(_0x402eb0,null));};exports['download']=function(_0x1778ba,_0x57757f){var _0x321f0c=path[_0xc5b1('0x81')](config[_0xc5b1('0x82')],_0xc5b1('0x83'),'files','attachments');return db[_0xc5b1('0x40')]['find']({'where':{'id':_0x1778ba[_0xc5b1('0x59')]['id']},'include':[{'model':db[_0xc5b1('0x7d')],'as':'Attachment'}]})[_0xc5b1('0x39')](handleEntityNotFound(_0x57757f,null))[_0xc5b1('0x39')](function(_0x5bae63){if(_0x5bae63){return _0x57757f[_0xc5b1('0x84')](path[_0xc5b1('0x81')](_0x321f0c,_0x5bae63[_0xc5b1('0x7d')]['basename']));}})[_0xc5b1('0x2b')](handleError(_0x57757f,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c32919f..fea7b4c 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x25a86b,_0x269489){var _0x584cac=function(_0x3ad0ec){while(--_0x3ad0ec){_0x25a86b['push'](_0x25a86b['shift']());}};_0x584cac(++_0x269489);}(_0x7217,0x19e));var _0x7721=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7217[_0xc6be3a];return _0x56a310;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x3aa999,_0x344fb7){var _0x969324=function(_0x16b80e){while(--_0x16b80e){_0x3aa999['push'](_0x3aa999['shift']());}};_0x969324(++_0x344fb7);}(_0x008c,0x188));var _0xc008=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x008c[_0x39a2d6];return _0x23af66;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index dc9c0ad..f76d2a1 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 _0x1a8b=['./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','models','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','direction','toLowerCase','catch','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2e2ef9,_0x99cef8){var _0x1f50fe=function(_0x1e6464){while(--_0x1e6464){_0x2e2ef9['push'](_0x2e2ef9['shift']());}};_0x1f50fe(++_0x99cef8);}(_0x1a8b,0x173));var _0xb1a8=function(_0x1e96d6,_0x4acfa0){_0x1e96d6=_0x1e96d6-0x0;var _0x95b2d4=_0x1a8b[_0x1e96d6];return _0x95b2d4;};'use strict';var _=require(_0xb1a8('0x0'));var util=require(_0xb1a8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb1a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xb1a8('0x3'));var fs=require('fs');var path=require(_0xb1a8('0x4'));var rimraf=require(_0xb1a8('0x5'));var config=require(_0xb1a8('0x6'));var attributes=require(_0xb1a8('0x7'));module[_0xb1a8('0x8')]=function(_0x5a5828,_0x325b14){return _0x5a5828[_0xb1a8('0x9')](_0xb1a8('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb1a8('0xb'),'fields':[_0xb1a8('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9451f4,_0x50c432,_0x16bc21){var _0x4fba0e=_0x5a5828[_0xb1a8('0xd')];var _0x260848=_0x9451f4['get']({'plain':!![]});if(_0x260848['direction']['toLowerCase']()==='in'||_0x260848['direction']['toLowerCase']()===_0xb1a8('0xe')&&!_0x260848[_0xb1a8('0xf')]&&!_[_0xb1a8('0x10')](_0x260848[_0xb1a8('0x11')])){_0x4fba0e[_0xb1a8('0x12')]['findOne']({'where':{'id':_0x260848[_0xb1a8('0x13')]}})[_0xb1a8('0x14')](function(_0x1cf67a){if(_0x1cf67a){_0x1cf67a[_0xb1a8('0x15')]({'lastMsgAt':_0x260848[_0xb1a8('0x16')],'lastMsgDirection':_0x260848[_0xb1a8('0x17')][_0xb1a8('0x18')]()});}})[_0xb1a8('0x19')](function(_0x3b7354){console['error'](_0x3b7354);});}_0x16bc21();}},'charset':'utf8mb4','collate':_0xb1a8('0x1a')});}; \ No newline at end of file +var _0x7607=['UserId','FaxInteraction','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','path','rimraf','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret'];(function(_0xc963f1,_0x5f5377){var _0x1187d1=function(_0x587dba){while(--_0x587dba){_0xc963f1['push'](_0xc963f1['shift']());}};_0x1187d1(++_0x5f5377);}(_0x7607,0x86));var _0x7760=function(_0x3c1038,_0x5c9a04){_0x3c1038=_0x3c1038-0x0;var _0x21bd3c=_0x7607[_0x3c1038];return _0x21bd3c;};'use strict';var _=require(_0x7760('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7760('0x1'));var rp=require(_0x7760('0x2'));var fs=require('fs');var path=require(_0x7760('0x3'));var rimraf=require(_0x7760('0x4'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x7760('0x5')]=function(_0xaaa4b8,_0x29594d){return _0xaaa4b8[_0x7760('0x6')](_0x7760('0x7'),attributes,{'tableName':_0x7760('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x7760('0x9')],'type':_0x7760('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a0eda,_0xc584aa,_0x3f0fe8){var _0x53bde6=_0xaaa4b8[_0x7760('0xb')];var _0x3e5983=_0x2a0eda[_0x7760('0xc')]({'plain':!![]});if(_0x3e5983[_0x7760('0xd')][_0x7760('0xe')]()==='in'||_0x3e5983['direction'][_0x7760('0xe')]()==='out'&&!_0x3e5983[_0x7760('0xf')]&&!_['isNil'](_0x3e5983[_0x7760('0x10')])){_0x53bde6[_0x7760('0x11')][_0x7760('0x12')]({'where':{'id':_0x3e5983['FaxInteractionId']}})[_0x7760('0x13')](function(_0x52ef2f){if(_0x52ef2f){_0x52ef2f[_0x7760('0x14')]({'lastMsgAt':_0x3e5983[_0x7760('0x15')],'lastMsgDirection':_0x3e5983[_0x7760('0xd')][_0x7760('0xe')]()});}})['catch'](function(_0x101d75){console[_0x7760('0x16')](_0x101d75);});}_0x3f0fe8();}},'charset':_0x7760('0x17'),'collate':_0x7760('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5aee99d..d9446e7 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 _0x9d83=['localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','then','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x565021,_0x1dd79d){var _0x453df6=function(_0x21a61f){while(--_0x21a61f){_0x565021['push'](_0x565021['shift']());}};_0x453df6(++_0x1dd79d);}(_0x9d83,0x138));var _0x39d8=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x9d83[_0x508c10];return _0x3108b5;};'use strict';var _=require(_0x39d8('0x0'));var util=require(_0x39d8('0x1'));var moment=require(_0x39d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x39d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x39d8('0x5'))(_0x39d8('0x6'));var config=require(_0x39d8('0x7'));var jayson=require(_0x39d8('0x8'));var client=jayson['client'][_0x39d8('0x9')]({'port':0x232a});config[_0x39d8('0xa')]=_[_0x39d8('0xb')](config[_0x39d8('0xa')],{'host':_0x39d8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x39d8('0xa')]));require(_0x39d8('0xd'))[_0x39d8('0xe')](socket);function respondWithRpcPromise(_0x52bb14,_0x4895a0,_0x19e71d){return new BPromise(function(_0x1b65fc,_0x5db4a4){return client[_0x39d8('0xf')](_0x52bb14,_0x19e71d)['then'](function(_0x30d599){logger[_0x39d8('0x10')](_0x39d8('0x11'),_0x4895a0,_0x39d8('0x12'));logger[_0x39d8('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4895a0,_0x39d8('0x12'),JSON[_0x39d8('0x14')](_0x30d599));if(_0x30d599[_0x39d8('0x15')]){if(_0x30d599[_0x39d8('0x15')]['code']===0x1f4){logger['error'](_0x39d8('0x11'),_0x4895a0,_0x30d599[_0x39d8('0x15')]['message']);return _0x5db4a4(_0x30d599[_0x39d8('0x15')][_0x39d8('0x16')]);}logger[_0x39d8('0x15')](_0x39d8('0x11'),_0x4895a0,_0x30d599[_0x39d8('0x15')][_0x39d8('0x16')]);return _0x1b65fc(_0x30d599[_0x39d8('0x15')][_0x39d8('0x16')]);}else{logger[_0x39d8('0x10')](_0x39d8('0x11'),_0x4895a0,_0x39d8('0x12'));_0x1b65fc(_0x30d599['result'][_0x39d8('0x16')]);}})[_0x39d8('0x17')](function(_0x54b113){logger['error'](_0x39d8('0x11'),_0x4895a0,_0x54b113);_0x5db4a4(_0x54b113);});});}exports['CreateFaxMessage']=function(_0x1869ce){var _0xda61a0=this;return new Promise(function(_0x12bcb4,_0x1467a1){return db[_0x39d8('0x18')][_0x39d8('0x19')](_0x1869ce[_0x39d8('0x1a')],{'raw':_0x1869ce[_0x39d8('0x1b')]?_0x1869ce[_0x39d8('0x1b')][_0x39d8('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x309c0a){logger[_0x39d8('0x10')](_0x39d8('0x1d'),_0x1869ce);logger['debug'](_0x39d8('0x1d'),_0x1869ce,JSON[_0x39d8('0x14')](_0x309c0a));_0x12bcb4(_0x309c0a);})['catch'](function(_0xb03149){logger[_0x39d8('0x15')](_0x39d8('0x1d'),_0xb03149[_0x39d8('0x16')],_0x1869ce);_0x1467a1(_0xda61a0[_0x39d8('0x15')](0x1f4,_0xb03149[_0x39d8('0x16')]));});});};exports[_0x39d8('0x1e')]=function(_0x3a21c4){var _0x21ea4e=this;return new Promise(function(_0x43935c,_0x22b9fc){return db[_0x39d8('0x18')][_0x39d8('0x1f')](_0x3a21c4[_0x39d8('0x1a')],{'raw':_0x3a21c4[_0x39d8('0x1b')]?_0x3a21c4[_0x39d8('0x1b')][_0x39d8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a21c4[_0x39d8('0x1b')]?_0x3a21c4[_0x39d8('0x1b')][_0x39d8('0x20')]||null:null,'attributes':_0x3a21c4[_0x39d8('0x1b')]?_0x3a21c4[_0x39d8('0x1b')][_0x39d8('0x21')]||null:null,'limit':_0x3a21c4['options']?_0x3a21c4[_0x39d8('0x1b')][_0x39d8('0x22')]||null:null})[_0x39d8('0x23')](function(_0xdf9f14){logger[_0x39d8('0x10')](_0x39d8('0x1e'),_0x3a21c4);logger['debug'](_0x39d8('0x1e'),_0x3a21c4,JSON[_0x39d8('0x14')](_0xdf9f14));_0x43935c(_0xdf9f14);})[_0x39d8('0x17')](function(_0x35fc0a){logger[_0x39d8('0x15')](_0x39d8('0x1e'),_0x35fc0a['message'],_0x3a21c4);_0x22b9fc(_0x21ea4e[_0x39d8('0x15')](0x1f4,_0x35fc0a['message']));});});}; \ No newline at end of file +var _0xdab8=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then'];(function(_0x431fd5,_0x337a53){var _0x6a18e3=function(_0x2ea559){while(--_0x2ea559){_0x431fd5['push'](_0x431fd5['shift']());}};_0x6a18e3(++_0x337a53);}(_0xdab8,0x8a));var _0x8dab=function(_0x181302,_0x1d393b){_0x181302=_0x181302-0x0;var _0x8cc166=_0xdab8[_0x181302];return _0x8cc166;};'use strict';var _=require('lodash');var util=require(_0x8dab('0x0'));var moment=require(_0x8dab('0x1'));var BPromise=require('bluebird');var rs=require(_0x8dab('0x2'));var fs=require('fs');var Redis=require(_0x8dab('0x3'));var db=require(_0x8dab('0x4'))['db'];var utils=require(_0x8dab('0x5'));var logger=require(_0x8dab('0x6'))(_0x8dab('0x7'));var config=require(_0x8dab('0x8'));var jayson=require(_0x8dab('0x9'));var client=jayson[_0x8dab('0xa')][_0x8dab('0xb')]({'port':0x232a});config['redis']=_[_0x8dab('0xc')](config[_0x8dab('0xd')],{'host':_0x8dab('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dab('0xd')]));require('./faxMessage.socket')[_0x8dab('0xf')](socket);function respondWithRpcPromise(_0x29125d,_0x26d869,_0x33188e){return new BPromise(function(_0x41f859,_0x414612){return client[_0x8dab('0x10')](_0x29125d,_0x33188e)[_0x8dab('0x11')](function(_0x3d5640){logger['info'](_0x8dab('0x12'),_0x26d869,_0x8dab('0x13'));logger[_0x8dab('0x14')](_0x8dab('0x15'),_0x26d869,_0x8dab('0x13'),JSON[_0x8dab('0x16')](_0x3d5640));if(_0x3d5640[_0x8dab('0x17')]){if(_0x3d5640[_0x8dab('0x17')][_0x8dab('0x18')]===0x1f4){logger['error'](_0x8dab('0x12'),_0x26d869,_0x3d5640['error']['message']);return _0x414612(_0x3d5640['error'][_0x8dab('0x19')]);}logger[_0x8dab('0x17')]('FaxMessage,\x20%s,\x20%s',_0x26d869,_0x3d5640[_0x8dab('0x17')][_0x8dab('0x19')]);return _0x41f859(_0x3d5640['error'][_0x8dab('0x19')]);}else{logger[_0x8dab('0x1a')](_0x8dab('0x12'),_0x26d869,'request\x20sent');_0x41f859(_0x3d5640[_0x8dab('0x1b')][_0x8dab('0x19')]);}})[_0x8dab('0x1c')](function(_0x2ccf9b){logger[_0x8dab('0x17')]('FaxMessage,\x20%s,\x20%s',_0x26d869,_0x2ccf9b);_0x414612(_0x2ccf9b);});});}exports['CreateFaxMessage']=function(_0x44fb6a){var _0x4f600e=this;return new Promise(function(_0x2a670e,_0x20c3d1){return db[_0x8dab('0x1d')][_0x8dab('0x1e')](_0x44fb6a[_0x8dab('0x1f')],{'raw':_0x44fb6a[_0x8dab('0x20')]?_0x44fb6a[_0x8dab('0x20')][_0x8dab('0x21')]===undefined?!![]:![]:!![]})[_0x8dab('0x11')](function(_0x2b1b07){logger['info'](_0x8dab('0x22'),_0x44fb6a);logger['debug'](_0x8dab('0x22'),_0x44fb6a,JSON[_0x8dab('0x16')](_0x2b1b07));_0x2a670e(_0x2b1b07);})[_0x8dab('0x1c')](function(_0xbca646){logger[_0x8dab('0x17')](_0x8dab('0x22'),_0xbca646[_0x8dab('0x19')],_0x44fb6a);_0x20c3d1(_0x4f600e[_0x8dab('0x17')](0x1f4,_0xbca646[_0x8dab('0x19')]));});});};exports[_0x8dab('0x23')]=function(_0x548ad7){var _0x5c3fa3=this;return new Promise(function(_0x19c4ee,_0x59fbfe){return db['FaxMessage'][_0x8dab('0x24')](_0x548ad7[_0x8dab('0x1f')],{'raw':_0x548ad7[_0x8dab('0x20')]?_0x548ad7[_0x8dab('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x548ad7[_0x8dab('0x20')]?_0x548ad7['options']['where']||null:null,'attributes':_0x548ad7[_0x8dab('0x20')]?_0x548ad7['options'][_0x8dab('0x25')]||null:null,'limit':_0x548ad7['options']?_0x548ad7[_0x8dab('0x20')][_0x8dab('0x26')]||null:null})[_0x8dab('0x11')](function(_0x421d31){logger[_0x8dab('0x1a')](_0x8dab('0x23'),_0x548ad7);logger[_0x8dab('0x14')](_0x8dab('0x23'),_0x548ad7,JSON['stringify'](_0x421d31));_0x19c4ee(_0x421d31);})[_0x8dab('0x1c')](function(_0x952099){logger['error'](_0x8dab('0x23'),_0x952099[_0x8dab('0x19')],_0x548ad7);_0x59fbfe(_0x5c3fa3[_0x8dab('0x17')](0x1f4,_0x952099[_0x8dab('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3b1ace4..be5e4fc 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0af7baf..e20460e 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 _0xa190=['faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','/:id','show','/:id/download','tracked','fax'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa190,0x176));var _0x0a19=function(_0x140bb8,_0x26b570){_0x140bb8=_0x140bb8-0x0;var _0xb04dd=_0xa190[_0x140bb8];return _0xb04dd;};'use strict';var multer=require(_0x0a19('0x0'));var util=require(_0x0a19('0x1'));var path=require(_0x0a19('0x2'));var timeout=require(_0x0a19('0x3'));var express=require(_0x0a19('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0a19('0x5'));var config=require(_0x0a19('0x6'));var controller=require(_0x0a19('0x7'));router[_0x0a19('0x8')]('/',auth[_0x0a19('0x9')](),controller['index']);router[_0x0a19('0x8')]('/describe',auth[_0x0a19('0x9')](),controller[_0x0a19('0xa')]);router[_0x0a19('0x8')](_0x0a19('0xb'),auth[_0x0a19('0x9')](),controller[_0x0a19('0xc')]);router[_0x0a19('0x8')](_0x0a19('0xd'),auth[_0x0a19('0x9')](),controller['download']);router['post']('/',auth[_0x0a19('0x9')](),interaction[_0x0a19('0xe')](_0x0a19('0xf'),_0x0a19('0x10')),controller[_0x0a19('0x11')]);router[_0x0a19('0x12')](_0x0a19('0xb'),auth[_0x0a19('0x9')](),controller[_0x0a19('0x13')]);router[_0x0a19('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x0a19('0x14')]);router[_0x0a19('0x12')](_0x0a19('0x15'),auth[_0x0a19('0x9')](),controller[_0x0a19('0x16')]);router[_0x0a19('0x17')](_0x0a19('0xb'),auth[_0x0a19('0x9')](),controller[_0x0a19('0x18')]);module[_0x0a19('0x19')]=router; \ No newline at end of file +var _0x2deb=['/:id/accept','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./faxMessage.controller','index','isAuthenticated','/:id','show','get','download','fax','faxmessage:create','create','put','update'];(function(_0x51a98a,_0x230997){var _0x4b23d6=function(_0x989b1b){while(--_0x989b1b){_0x51a98a['push'](_0x51a98a['shift']());}};_0x4b23d6(++_0x230997);}(_0x2deb,0xf2));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var path=require(_0xb2de('0x2'));var timeout=require(_0xb2de('0x3'));var express=require('express');var router=express[_0xb2de('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2de('0x5'));var config=require('../../config/environment');var controller=require(_0xb2de('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2de('0x7')]);router['get']('/describe',auth[_0xb2de('0x8')](),controller['describe']);router['get'](_0xb2de('0x9'),auth[_0xb2de('0x8')](),controller[_0xb2de('0xa')]);router[_0xb2de('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xb2de('0xc')]);router['post']('/',auth[_0xb2de('0x8')](),interaction['tracked'](_0xb2de('0xd'),_0xb2de('0xe')),controller[_0xb2de('0xf')]);router[_0xb2de('0x10')](_0xb2de('0x9'),auth[_0xb2de('0x8')](),controller[_0xb2de('0x11')]);router[_0xb2de('0x10')](_0xb2de('0x12'),auth[_0xb2de('0x8')](),controller['accept']);router[_0xb2de('0x10')]('/:id/reject',auth[_0xb2de('0x8')](),controller['reject']);router['delete'](_0xb2de('0x9'),auth['isAuthenticated'](),controller[_0xb2de('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 059cea3..1482d2a 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 _0xd2e3=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0xd2e3,0x10a));var _0x3d2e=function(_0xb339b,_0x33be9d){_0xb339b=_0xb339b-0x0;var _0x418005=_0xd2e3[_0xb339b];return _0x418005;};'use strict';var Sequelize=require(_0x3d2e('0x0'));module[_0x3d2e('0x1')]={'name':{'type':Sequelize[_0x3d2e('0x2')],'unique':_0x3d2e('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3d2e('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3d2e('0x5'),_0x3d2e('0x6'),_0x3d2e('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3d2e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x005d=['roundrobin','INTEGER','sequelize','STRING','name','rrmemory','beepall'];(function(_0x1f60e3,_0xdc3079){var _0x5b4128=function(_0x4c198a){while(--_0x4c198a){_0x1f60e3['push'](_0x1f60e3['shift']());}};_0x5b4128(++_0xdc3079);}(_0x005d,0x64));var _0xd005=function(_0x455049,_0x3a6aae){_0x455049=_0x455049-0x0;var _0x47bbe8=_0x005d[_0x455049];return _0x47bbe8;};'use strict';var Sequelize=require(_0xd005('0x0'));module['exports']={'name':{'type':Sequelize[_0xd005('0x1')],'unique':_0xd005('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd005('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd005('0x3'),_0xd005('0x4'),_0xd005('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd005('0x6')],'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 d7b2d2a..6332a67 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 _0xc9cc=['transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','FaxQueues','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','include','findAll','catch','show','params','length','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserFaxQueue','FaxQueueId','UserId','agent','faxPause','updatedAt','createdAt','rows','format','SIP','findOne','Team','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap'];(function(_0x30595a,_0x2fe77d){var _0x570e62=function(_0xa57766){while(--_0xa57766){_0x30595a['push'](_0x30595a['shift']());}};_0x570e62(++_0x2fe77d);}(_0xc9cc,0xb0));var _0xcc9c=function(_0x424d1d,_0x33893a){_0x424d1d=_0x424d1d-0x0;var _0xc6947f=_0xc9cc[_0x424d1d];return _0xc6947f;};'use strict';var pdf=require(_0xcc9c('0x0'));var emlformat=require(_0xcc9c('0x1'));var rimraf=require(_0xcc9c('0x2'));var zipdir=require(_0xcc9c('0x3'));var jsonpatch=require(_0xcc9c('0x4'));var rp=require(_0xcc9c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc9c('0x6'));var util=require('util');var path=require(_0xcc9c('0x7'));var sox=require('sox');var csv=require(_0xcc9c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcc9c('0x9'));var squel=require(_0xcc9c('0xa'));var crypto=require(_0xcc9c('0xb'));var jsforce=require(_0xcc9c('0xc'));var deskjs=require(_0xcc9c('0xd'));var toCsv=require(_0xcc9c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc9c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcc9c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc9c('0x10'));var logger=require(_0xcc9c('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc9c('0x12'));var db=require(_0xcc9c('0x13'))['db'];config[_0xcc9c('0x14')]=_[_0xcc9c('0x15')](config[_0xcc9c('0x14')],{'host':_0xcc9c('0x16'),'port':0x18eb});var socket=require(_0xcc9c('0x17'))(new Redis(config['redis']));require(_0xcc9c('0x18'))[_0xcc9c('0x19')](socket);function respondWithStatusCode(_0x1e6480,_0xabc8d6){_0xabc8d6=_0xabc8d6||0xcc;return function(_0x245a5f){if(_0x245a5f){return _0x1e6480[_0xcc9c('0x1a')](_0xabc8d6);}return _0x1e6480[_0xcc9c('0x1b')](_0xabc8d6)[_0xcc9c('0x1c')]();};}function respondWithResult(_0x5917ba,_0x41da2a){_0x41da2a=_0x41da2a||0xc8;return function(_0x1d0f7b){if(_0x1d0f7b){return _0x5917ba[_0xcc9c('0x1b')](_0x41da2a)[_0xcc9c('0x1d')](_0x1d0f7b);}};}function respondWithFilteredResult(_0x1fe884,_0x2228c6){return function(_0x332582){if(_0x332582){var _0x3977e7=_0x332582[_0xcc9c('0x1e')],_0x564661=_0x2228c6[_0xcc9c('0x1f')],_0x2d0f1c=_0x2228c6[_0xcc9c('0x1f')]+_0x2228c6['limit'],_0x423759;if(_0x2d0f1c>=_0x3977e7){_0x2d0f1c=_0x3977e7;_0x423759=0xc8;}else{_0x423759=0xce;}_0x1fe884[_0xcc9c('0x1b')](_0x423759);return _0x1fe884['set'](_0xcc9c('0x20'),_0x564661+'-'+_0x2d0f1c+'/'+_0x3977e7)[_0xcc9c('0x1d')](_0x332582);}return null;};}function patchUpdates(_0x1a889d){return function(_0xbe0f41){try{jsonpatch[_0xcc9c('0x21')](_0xbe0f41,_0x1a889d,!![]);}catch(_0x46c73e){return BPromise[_0xcc9c('0x22')](_0x46c73e);}return _0xbe0f41[_0xcc9c('0x23')]();};}function saveUpdates(_0x34a940,_0x2655a6){return function(_0x2c5e3d){if(_0x2c5e3d){return _0x2c5e3d[_0xcc9c('0x24')](_0x34a940)[_0xcc9c('0x25')](function(_0x2fd3e3){return _0x2fd3e3;});}return null;};}function removeEntity(_0x4d9031,_0xe116a5){return function(_0x1deb3f){if(_0x1deb3f){return _0x1deb3f['destroy']()[_0xcc9c('0x25')](function(){var _0x13df75=_0x1deb3f['get']({'plain':!![]});var _0x29a392=_0xcc9c('0x26');return db['UserProfileResource'][_0xcc9c('0x27')]({'where':{'type':_0x29a392,'resourceId':_0x13df75['id']}})[_0xcc9c('0x25')](function(){return _0x1deb3f;});})['then'](function(){_0x4d9031[_0xcc9c('0x1b')](0xcc)[_0xcc9c('0x1c')]();});}};}function handleEntityNotFound(_0x5aa33c,_0x15fcce){return function(_0x52af01){if(!_0x52af01){_0x5aa33c['sendStatus'](0x194);}return _0x52af01;};}function handleError(_0x3b1e7b,_0x44d17d){_0x44d17d=_0x44d17d||0x1f4;return function(_0xeea7da){logger[_0xcc9c('0x28')](_0xeea7da[_0xcc9c('0x29')]);if(_0xeea7da['name']){delete _0xeea7da[_0xcc9c('0x2a')];}_0x3b1e7b[_0xcc9c('0x1b')](_0x44d17d)[_0xcc9c('0x2b')](_0xeea7da);};}exports[_0xcc9c('0x2c')]=function(_0x3e4da6,_0x4f8e42){var _0x1f472d={},_0x3e4aeb={},_0x6718e0={'count':0x0,'rows':[]};var _0x49f664=_[_0xcc9c('0x2d')](db[_0xcc9c('0x2e')][_0xcc9c('0x2f')],function(_0x891de2){return{'name':_0x891de2[_0xcc9c('0x30')],'type':_0x891de2[_0xcc9c('0x31')]['key']};});_0x3e4aeb['model']=_[_0xcc9c('0x2d')](_0x49f664,'name');_0x3e4aeb[_0xcc9c('0x32')]=_[_0xcc9c('0x33')](_0x3e4da6[_0xcc9c('0x32')]);_0x3e4aeb['filters']=_[_0xcc9c('0x34')](_0x3e4aeb[_0xcc9c('0x35')],_0x3e4aeb[_0xcc9c('0x32')]);_0x1f472d[_0xcc9c('0x36')]=_[_0xcc9c('0x34')](_0x3e4aeb[_0xcc9c('0x35')],qs[_0xcc9c('0x37')](_0x3e4da6['query'][_0xcc9c('0x37')]));_0x1f472d[_0xcc9c('0x36')]=_0x1f472d[_0xcc9c('0x36')]['length']?_0x1f472d[_0xcc9c('0x36')]:_0x3e4aeb[_0xcc9c('0x35')];if(!_0x3e4da6['query'][_0xcc9c('0x38')](_0xcc9c('0x39'))){_0x1f472d[_0xcc9c('0x3a')]=qs[_0xcc9c('0x3a')](_0x3e4da6[_0xcc9c('0x32')][_0xcc9c('0x3a')]);_0x1f472d[_0xcc9c('0x1f')]=qs['offset'](_0x3e4da6[_0xcc9c('0x32')][_0xcc9c('0x1f')]);}_0x1f472d[_0xcc9c('0x3b')]=qs[_0xcc9c('0x3c')](_0x3e4da6['query'][_0xcc9c('0x3c')]);_0x1f472d[_0xcc9c('0x3d')]=qs[_0xcc9c('0x3e')](_[_0xcc9c('0x3f')](_0x3e4da6[_0xcc9c('0x32')],_0x3e4aeb[_0xcc9c('0x3e')]),_0x49f664);if(_0x3e4da6[_0xcc9c('0x32')][_0xcc9c('0x40')]){_0x1f472d[_0xcc9c('0x3d')]=_['merge'](_0x1f472d['where'],{'$or':_[_0xcc9c('0x2d')](_0x49f664,function(_0xadd585){if(_0xadd585['type']!=='VIRTUAL'){var _0x2d68d0={};_0x2d68d0[_0xadd585[_0xcc9c('0x2a')]]={'$like':'%'+_0x3e4da6[_0xcc9c('0x32')][_0xcc9c('0x40')]+'%'};return _0x2d68d0;}})});}_0x1f472d=_[_0xcc9c('0x41')]({},_0x1f472d,_0x3e4da6['options']);var _0x3d9b35={'where':_0x1f472d[_0xcc9c('0x3d')]};return db[_0xcc9c('0x2e')][_0xcc9c('0x1e')](_0x3d9b35)[_0xcc9c('0x25')](function(_0x590197){_0x6718e0['count']=_0x590197;if(_0x3e4da6[_0xcc9c('0x32')]['includeAll']){_0x1f472d[_0xcc9c('0x42')]=[{'all':!![]}];}return db[_0xcc9c('0x2e')][_0xcc9c('0x43')](_0x1f472d);})['then'](function(_0x5a0f4d){_0x6718e0['rows']=_0x5a0f4d;return _0x6718e0;})['then'](respondWithFilteredResult(_0x4f8e42,_0x1f472d))[_0xcc9c('0x44')](handleError(_0x4f8e42,null));};exports[_0xcc9c('0x45')]=function(_0x5a14fd,_0x2c61ad){var _0x42ecff={'raw':!![],'where':{'id':_0x5a14fd[_0xcc9c('0x46')]['id']}},_0x5f2af0={};_0x5f2af0[_0xcc9c('0x35')]=_[_0xcc9c('0x33')](db[_0xcc9c('0x2e')][_0xcc9c('0x2f')]);_0x5f2af0[_0xcc9c('0x32')]=_[_0xcc9c('0x33')](_0x5a14fd[_0xcc9c('0x32')]);_0x5f2af0[_0xcc9c('0x3e')]=_['intersection'](_0x5f2af0[_0xcc9c('0x35')],_0x5f2af0[_0xcc9c('0x32')]);_0x42ecff[_0xcc9c('0x36')]=_['intersection'](_0x5f2af0[_0xcc9c('0x35')],qs['fields'](_0x5a14fd[_0xcc9c('0x32')][_0xcc9c('0x37')]));_0x42ecff[_0xcc9c('0x36')]=_0x42ecff[_0xcc9c('0x36')][_0xcc9c('0x47')]?_0x42ecff[_0xcc9c('0x36')]:_0x5f2af0[_0xcc9c('0x35')];if(_0x5a14fd[_0xcc9c('0x32')][_0xcc9c('0x48')]){_0x42ecff[_0xcc9c('0x42')]=[{'all':!![]}];}_0x42ecff=_['merge']({},_0x42ecff,_0x5a14fd[_0xcc9c('0x49')]);return db[_0xcc9c('0x2e')]['find'](_0x42ecff)['then'](handleEntityNotFound(_0x2c61ad,null))[_0xcc9c('0x25')](respondWithResult(_0x2c61ad,null))['catch'](handleError(_0x2c61ad,null));};exports[_0xcc9c('0x4a')]=function(_0x493f1e,_0x1be988){return db[_0xcc9c('0x2e')][_0xcc9c('0x4a')](_0x493f1e[_0xcc9c('0x4b')],{})['then'](function(_0x493e75){var _0x4e1925=_0x493f1e[_0xcc9c('0x4c')][_0xcc9c('0x4d')]({'plain':!![]});if(!_0x4e1925)throw new Error(_0xcc9c('0x4e'));if(_0x4e1925[_0xcc9c('0x4f')]===_0xcc9c('0x4c')){var _0x51c041=_0x493e75[_0xcc9c('0x4d')]({'plain':!![]});var _0x415e86=_0xcc9c('0x26');return db[_0xcc9c('0x50')]['find']({'where':{'name':_0x415e86,'userProfileId':_0x4e1925[_0xcc9c('0x51')]},'raw':!![]})[_0xcc9c('0x25')](function(_0x21d13b){if(_0x21d13b&&_0x21d13b[_0xcc9c('0x52')]===0x0){return db[_0xcc9c('0x53')][_0xcc9c('0x4a')]({'name':_0x51c041[_0xcc9c('0x2a')],'resourceId':_0x51c041['id'],'type':_0x21d13b[_0xcc9c('0x2a')],'sectionId':_0x21d13b['id']},{})[_0xcc9c('0x25')](function(){return _0x493e75;});}else{return _0x493e75;}})[_0xcc9c('0x44')](function(_0x239016){logger[_0xcc9c('0x28')](_0xcc9c('0x54'),_0x239016);throw _0x239016;});}return _0x493e75;})[_0xcc9c('0x25')](respondWithResult(_0x1be988,0xc9))[_0xcc9c('0x44')](handleError(_0x1be988,null));};exports['update']=function(_0x172d04,_0x390344){if(_0x172d04['body']['id']){delete _0x172d04[_0xcc9c('0x4b')]['id'];}return db[_0xcc9c('0x2e')][_0xcc9c('0x55')]({'where':{'id':_0x172d04[_0xcc9c('0x46')]['id']}})[_0xcc9c('0x25')](handleEntityNotFound(_0x390344,null))['then'](saveUpdates(_0x172d04[_0xcc9c('0x4b')],null))['then'](respondWithResult(_0x390344,null))[_0xcc9c('0x44')](handleError(_0x390344,null));};exports[_0xcc9c('0x27')]=function(_0x3e6c7a,_0x28e138){return db[_0xcc9c('0x2e')][_0xcc9c('0x55')]({'where':{'id':_0x3e6c7a[_0xcc9c('0x46')]['id']}})[_0xcc9c('0x25')](handleEntityNotFound(_0x28e138,null))[_0xcc9c('0x25')](removeEntity(_0x28e138,null))['catch'](handleError(_0x28e138,null));};exports[_0xcc9c('0x56')]=function(_0xa5c9c9,_0x37f3c8){return db[_0xcc9c('0x2e')][_0xcc9c('0x56')]()[_0xcc9c('0x25')](respondWithResult(_0x37f3c8,null))[_0xcc9c('0x44')](handleError(_0x37f3c8,null));};exports[_0xcc9c('0x57')]=function(_0x30d984,_0x7b53dd,_0x34e6da){var _0x5a8a75={'raw':!![],'where':{}},_0x44b92a={},_0x1b2eb6;return db[_0xcc9c('0x2e')]['findOne']({'where':{'id':_0x30d984[_0xcc9c('0x46')]['id']}})[_0xcc9c('0x25')](handleEntityNotFound(_0x7b53dd,null))[_0xcc9c('0x25')](function(_0x475680){if(_0x475680){_0x1b2eb6=_0x475680[_0xcc9c('0x4d')]({'plain':!![]});_0x44b92a[_0xcc9c('0x35')]=_[_0xcc9c('0x33')](db[_0xcc9c('0x58')][_0xcc9c('0x2f')]);_0x44b92a[_0xcc9c('0x32')]=_[_0xcc9c('0x33')](_0x30d984[_0xcc9c('0x32')]);_0x44b92a[_0xcc9c('0x3e')]=_[_0xcc9c('0x34')](_0x44b92a['model'],_0x44b92a['query']);_0x5a8a75[_0xcc9c('0x36')]=_['intersection'](_0x44b92a[_0xcc9c('0x35')],qs[_0xcc9c('0x37')](_0x30d984[_0xcc9c('0x32')]['fields']));_0x5a8a75[_0xcc9c('0x36')]=_0x5a8a75['attributes'][_0xcc9c('0x47')]?_0x5a8a75[_0xcc9c('0x36')]:_0x44b92a[_0xcc9c('0x35')];if(!_0x30d984['query'][_0xcc9c('0x38')](_0xcc9c('0x39'))){_0x5a8a75[_0xcc9c('0x3a')]=qs[_0xcc9c('0x3a')](_0x30d984[_0xcc9c('0x32')][_0xcc9c('0x3a')]);_0x5a8a75[_0xcc9c('0x1f')]=qs[_0xcc9c('0x1f')](_0x30d984[_0xcc9c('0x32')][_0xcc9c('0x1f')]);}_0x5a8a75[_0xcc9c('0x3b')]=qs[_0xcc9c('0x3c')](_0x30d984[_0xcc9c('0x32')][_0xcc9c('0x3c')]);_0x5a8a75[_0xcc9c('0x3d')]=qs[_0xcc9c('0x3e')](_[_0xcc9c('0x3f')](_0x30d984[_0xcc9c('0x32')],_0x44b92a[_0xcc9c('0x3e')]));_0x5a8a75[_0xcc9c('0x3d')][_0xcc9c('0x59')]=_0x475680['id'];if(_0x30d984[_0xcc9c('0x32')][_0xcc9c('0x40')]){_0x5a8a75[_0xcc9c('0x3d')]=_[_0xcc9c('0x41')](_0x5a8a75[_0xcc9c('0x3d')],{'$or':_['map'](_0x5a8a75['attributes'],function(_0x2298e0){var _0x555e7a={};_0x555e7a[_0x2298e0]={'$like':'%'+_0x30d984[_0xcc9c('0x32')][_0xcc9c('0x40')]+'%'};return _0x555e7a;})});}_0x5a8a75=_[_0xcc9c('0x41')]({},_0x5a8a75,_0x30d984[_0xcc9c('0x49')]);return db[_0xcc9c('0x58')][_0xcc9c('0x43')](_0x5a8a75);}})[_0xcc9c('0x25')](function(_0x3c6665){if(_0x3c6665){return db['User']['findAndCountAll']({'where':{'id':_[_0xcc9c('0x2d')](_0x3c6665,_0xcc9c('0x5a')),'role':_0xcc9c('0x5b')},'attributes':['id',_0xcc9c('0x2a'),_0xcc9c('0x5c'),_0xcc9c('0x5d'),_0xcc9c('0x5e')]});}})['then'](function(_0x183029){if(_0x183029){return{'count':_0x183029[_0xcc9c('0x1e')],'rows':_[_0xcc9c('0x2d')](_0x183029[_0xcc9c('0x5f')],function(_0x56f3db){return{'membername':_0x56f3db['name'],'UserId':_0x56f3db['id'],'queue_name':_0x1b2eb6['name'],'FaxQueueId':_0x1b2eb6['id'],'interface':util[_0xcc9c('0x60')]('%s/%s',_0xcc9c('0x61'),_0x56f3db[_0xcc9c('0x2a')]),'penalty':0x0,'paused':_0x56f3db['faxPause'],'createdAt':_0x56f3db[_0xcc9c('0x5e')],'updatedAt':_0x56f3db[_0xcc9c('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcc9c('0x25')](respondWithFilteredResult(_0x7b53dd,_0x5a8a75))[_0xcc9c('0x44')](handleError(_0x7b53dd,null));};exports['getTeams']=function(_0x3cf519,_0x1a9358,_0x2ce6d5){var _0x5b0a9e={};var _0x1ef03a={};var _0x17ffa3;var _0x24ada3;return db[_0xcc9c('0x2e')][_0xcc9c('0x62')]({'where':{'id':_0x3cf519['params']['id']}})['then'](handleEntityNotFound(_0x1a9358,null))[_0xcc9c('0x25')](function(_0x3d1ee6){if(_0x3d1ee6){_0x17ffa3=_0x3d1ee6;_0x1ef03a['model']=_[_0xcc9c('0x33')](db[_0xcc9c('0x63')][_0xcc9c('0x2f')]);_0x1ef03a[_0xcc9c('0x32')]=_[_0xcc9c('0x33')](_0x3cf519[_0xcc9c('0x32')]);_0x1ef03a[_0xcc9c('0x3e')]=_[_0xcc9c('0x34')](_0x1ef03a[_0xcc9c('0x35')],_0x1ef03a[_0xcc9c('0x32')]);_0x5b0a9e[_0xcc9c('0x36')]=_[_0xcc9c('0x34')](_0x1ef03a[_0xcc9c('0x35')],qs['fields'](_0x3cf519[_0xcc9c('0x32')][_0xcc9c('0x37')]));_0x5b0a9e[_0xcc9c('0x36')]=_0x5b0a9e[_0xcc9c('0x36')][_0xcc9c('0x47')]?_0x5b0a9e['attributes']:_0x1ef03a['model'];_0x5b0a9e[_0xcc9c('0x3b')]=qs['sort'](_0x3cf519[_0xcc9c('0x32')][_0xcc9c('0x3c')]);_0x5b0a9e[_0xcc9c('0x3d')]=qs[_0xcc9c('0x3e')](_[_0xcc9c('0x3f')](_0x3cf519['query'],_0x1ef03a[_0xcc9c('0x3e')]));if(_0x3cf519[_0xcc9c('0x32')]['filter']){_0x5b0a9e[_0xcc9c('0x3d')]=_[_0xcc9c('0x41')](_0x5b0a9e[_0xcc9c('0x3d')],{'$or':_[_0xcc9c('0x2d')](_0x5b0a9e['attributes'],function(_0x4f026c){var _0x12fc15={};_0x12fc15[_0x4f026c]={'$like':'%'+_0x3cf519[_0xcc9c('0x32')][_0xcc9c('0x40')]+'%'};return _0x12fc15;})});}_0x5b0a9e=_[_0xcc9c('0x41')]({},_0x5b0a9e,_0x3cf519[_0xcc9c('0x49')]);return _0x17ffa3[_0xcc9c('0x64')](_0x5b0a9e);}})['then'](function(_0x3cc1b7){if(_0x3cc1b7){_0x24ada3=_0x3cc1b7[_0xcc9c('0x47')];if(!_0x3cf519[_0xcc9c('0x32')][_0xcc9c('0x38')]('nolimit')){_0x5b0a9e[_0xcc9c('0x3a')]=qs[_0xcc9c('0x3a')](_0x3cf519[_0xcc9c('0x32')][_0xcc9c('0x3a')]);_0x5b0a9e[_0xcc9c('0x1f')]=qs[_0xcc9c('0x1f')](_0x3cf519[_0xcc9c('0x32')]['offset']);}return _0x17ffa3['getTeams'](_0x5b0a9e);}})[_0xcc9c('0x25')](function(_0x325e33){if(_0x325e33){return _0x325e33?{'count':_0x24ada3,'rows':_0x325e33}:null;}})['then'](respondWithResult(_0x1a9358,null))[_0xcc9c('0x44')](handleError(_0x1a9358,null));};exports[_0xcc9c('0x65')]=function(_0x23e8bf,_0x5210c3,_0x40336f){var _0x10d2b4=_0x23e8bf[_0xcc9c('0x4b')][_0xcc9c('0x66')];return db[_0xcc9c('0x63')][_0xcc9c('0x43')]({'where':{'id':_0x10d2b4},'attributes':['id'],'include':[{'model':db[_0xcc9c('0x67')],'as':_0xcc9c('0x68'),'attributes':['id','name','online',_0xcc9c('0x69'),_0xcc9c('0x6a')],'raw':!![]}]})[_0xcc9c('0x25')](function(_0x5d7b2d){if(_0x5d7b2d){var _0xa79d5c=_[_0xcc9c('0x6b')](_0x5d7b2d,function(_0x1434a1){var _0x231d65=_0x1434a1[_0xcc9c('0x4d')]({'plain':!![]});return _0x231d65['Agents'];});return db[_0xcc9c('0x2e')]['find']({'where':{'id':_0x23e8bf[_0xcc9c('0x46')]['id']}})[_0xcc9c('0x25')](function(_0x29764e){return db['sequelize'][_0xcc9c('0x6c')](function(_0x26ddcb){return _0x29764e[_0xcc9c('0x65')](_0x10d2b4,{'transaction':_0x26ddcb})[_0xcc9c('0x25')](function(){return BPromise[_0xcc9c('0x6d')](_0xa79d5c,function(_0x27db56){return db[_0xcc9c('0x58')][_0xcc9c('0x6e')]({'where':{'UserId':_0x27db56['id'],'FaxQueueId':_0x23e8bf['params']['id']},'transaction':_0x26ddcb});});})['then'](function(){_0xa79d5c[_0xcc9c('0x6f')](function(_0x56c180){socket['emit'](_0xcc9c('0x70'),{'UserId':_0x56c180['id'],'FaxQueueId':_0x29764e['id']});});});});});}})[_0xcc9c('0x25')](respondWithStatusCode(_0x5210c3,null))['catch'](handleError(_0x5210c3,null));};exports[_0xcc9c('0x71')]=function(_0x156b7a,_0x1df49b,_0x99a430){return db['Team']['findAll']({'where':{'id':_0x156b7a[_0xcc9c('0x32')][_0xcc9c('0x66')]},'attributes':['id'],'include':[{'model':db[_0xcc9c('0x67')],'as':_0xcc9c('0x68'),'attributes':['id'],'raw':!![]}]})[_0xcc9c('0x25')](handleEntityNotFound(_0x1df49b,null))[_0xcc9c('0x25')](function(_0x1ef934){var _0x308ec9=_[_0xcc9c('0x2d')](_0x1ef934,'id');var _0x3f2e97=[];var _0x55f435=[];var _0x24c019=squel[_0xcc9c('0x72')]();_0x24c019['field'](_0xcc9c('0x73'))[_0xcc9c('0x74')](_0xcc9c('0x75'),'tq')[_0xcc9c('0x76')](_0xcc9c('0x77'),'ut',_0xcc9c('0x78'))[_0xcc9c('0x3d')](_0xcc9c('0x79'),_0x156b7a[_0xcc9c('0x46')]['id']);for(var _0x12f7db=0x0;_0x12f7db<_0x1ef934[_0xcc9c('0x47')];_0x12f7db+=0x1){let _0xf2d8da=_0x1ef934[_0x12f7db];for(var _0x14cfc8=0x0;_0x14cfc8<_0xf2d8da[_0xcc9c('0x68')][_0xcc9c('0x47')];_0x14cfc8+=0x1){let _0x559630=_0xf2d8da[_0xcc9c('0x68')][_0x14cfc8];var _0x553f04=_0x24c019[_0xcc9c('0x7a')]();_0x553f04[_0xcc9c('0x3d')](_0xcc9c('0x7b'),_0x559630['id']);_0x55f435[_0xcc9c('0x7c')](db[_0xcc9c('0x7d')][_0xcc9c('0x32')](_0x553f04['toString'](),{'type':db[_0xcc9c('0x7d')][_0xcc9c('0x7e')][_0xcc9c('0x7f')]})[_0xcc9c('0x25')](function(_0x40b2b7){if(_0x40b2b7['length']===0x1){return _0x559630['id'];}else{var _0x44bfe8=_[_0xcc9c('0x80')](_[_0xcc9c('0x2d')](_0x40b2b7,_0xcc9c('0x81')),function(_0x3f5808){return _['includes'](_0x308ec9,_0x3f5808);});if(_0x44bfe8){return _0x559630['id'];}}}));}}return BPromise[_0xcc9c('0x82')](_0x55f435)['then'](function(_0x205f19){_0x3f2e97=_(_0x3f2e97)[_0xcc9c('0x83')](_0x205f19)[_0xcc9c('0x84')]()[_0xcc9c('0x85')]();return db[_0xcc9c('0x2e')][_0xcc9c('0x55')]({'where':{'id':_0x156b7a['params']['id']}})[_0xcc9c('0x25')](function(_0x4df004){return db[_0xcc9c('0x7d')]['transaction'](function(_0x3113da){return _0x4df004[_0xcc9c('0x71')](_0x156b7a[_0xcc9c('0x32')][_0xcc9c('0x66')],{'transaction':_0x3113da})[_0xcc9c('0x25')](function(){if(!_[_0xcc9c('0x86')](_0x3f2e97)){return _0x4df004[_0xcc9c('0x87')](_0x3f2e97,{'transaction':_0x3113da});}})[_0xcc9c('0x25')](function(){_0x3f2e97[_0xcc9c('0x6f')](function(_0x520c91){socket[_0xcc9c('0x88')](_0xcc9c('0x89'),{'UserId':_0x520c91,'FaxQueueId':_0x4df004['id']});});});});});});})[_0xcc9c('0x25')](respondWithStatusCode(_0x1df49b,null))['catch'](handleError(_0x1df49b,null));};exports[_0xcc9c('0x8a')]=function(_0x159eae,_0x4d81ae,_0x32a998){return db[_0xcc9c('0x2e')][_0xcc9c('0x55')]({'where':{'id':_0x159eae[_0xcc9c('0x46')]['id']}})[_0xcc9c('0x25')](handleEntityNotFound(_0x4d81ae,null))[_0xcc9c('0x25')](function(_0xe89c1f){if(_0xe89c1f){return _0xe89c1f[_0xcc9c('0x8a')](_0x159eae[_0xcc9c('0x4b')][_0xcc9c('0x66')],_['omit'](_0x159eae[_0xcc9c('0x4b')],['ids','id'])||{})[_0xcc9c('0x8b')](function(_0x5f5060){for(var _0x2e626d=0x0;_0x2e626d<_0x159eae[_0xcc9c('0x4b')][_0xcc9c('0x66')][_0xcc9c('0x47')];_0x2e626d+=0x1){socket[_0xcc9c('0x88')]('userFaxQueue:save',{'UserId':_0x159eae['body'][_0xcc9c('0x66')][_0x2e626d],'FaxQueueId':_0x159eae[_0xcc9c('0x46')]['id']});}return _0x5f5060;});}})[_0xcc9c('0x25')](respondWithResult(_0x4d81ae,null))[_0xcc9c('0x44')](handleError(_0x4d81ae,null));};exports['removeAgents']=function(_0x476793,_0x2c42be,_0x1d9dcb){return db[_0xcc9c('0x2e')][_0xcc9c('0x55')]({'where':{'id':_0x476793[_0xcc9c('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c42be,null))[_0xcc9c('0x25')](function(_0x329598){if(_0x329598){return _0x329598[_0xcc9c('0x87')](_0x476793['query'][_0xcc9c('0x66')])[_0xcc9c('0x25')](function(){if(_[_0xcc9c('0x8c')](_0x476793[_0xcc9c('0x32')][_0xcc9c('0x66')])){for(var _0x4b4510=0x0;_0x4b4510<_0x476793[_0xcc9c('0x32')][_0xcc9c('0x66')]['length'];_0x4b4510+=0x1){socket[_0xcc9c('0x88')](_0xcc9c('0x89'),{'UserId':Number(_0x476793[_0xcc9c('0x32')][_0xcc9c('0x66')][_0x4b4510]),'FaxQueueId':Number(_0x476793[_0xcc9c('0x46')]['id'])});}}else{socket[_0xcc9c('0x88')](_0xcc9c('0x89'),{'UserId':Number(_0x476793[_0xcc9c('0x32')][_0xcc9c('0x66')]),'FaxQueueId':Number(_0x476793['params']['id'])});}});}})[_0xcc9c('0x25')](respondWithStatusCode(_0x2c42be,null))[_0xcc9c('0x44')](handleError(_0x2c42be,null));};exports['getAgents']=function(_0x23fd93,_0x55989a,_0x3898c9){var _0x3668c0={};var _0xaf0c80={};var _0x1b1ab1;var _0x28eaff;return db[_0xcc9c('0x2e')][_0xcc9c('0x62')]({'where':{'id':_0x23fd93[_0xcc9c('0x46')]['id']}})[_0xcc9c('0x25')](handleEntityNotFound(_0x55989a,null))[_0xcc9c('0x25')](function(_0x1180aa){if(_0x1180aa){_0x1b1ab1=_0x1180aa;_0xaf0c80[_0xcc9c('0x35')]=_['keys'](db[_0xcc9c('0x67')][_0xcc9c('0x2f')]);_0xaf0c80[_0xcc9c('0x32')]=_[_0xcc9c('0x33')](_0x23fd93['query']);_0xaf0c80[_0xcc9c('0x3e')]=_[_0xcc9c('0x34')](_0xaf0c80[_0xcc9c('0x35')],_0xaf0c80[_0xcc9c('0x32')]);_0x3668c0[_0xcc9c('0x36')]=_[_0xcc9c('0x34')](_0xaf0c80[_0xcc9c('0x35')],qs['fields'](_0x23fd93[_0xcc9c('0x32')][_0xcc9c('0x37')]));_0x3668c0[_0xcc9c('0x36')]=_0x3668c0['attributes'][_0xcc9c('0x47')]?_0x3668c0[_0xcc9c('0x36')]:_0xaf0c80[_0xcc9c('0x35')];_0x3668c0[_0xcc9c('0x3b')]=qs[_0xcc9c('0x3c')](_0x23fd93['query'][_0xcc9c('0x3c')]);_0x3668c0[_0xcc9c('0x3d')]=qs['filters'](_['pick'](_0x23fd93[_0xcc9c('0x32')],_0xaf0c80[_0xcc9c('0x3e')]));if(_0x23fd93[_0xcc9c('0x32')][_0xcc9c('0x40')]){_0x3668c0[_0xcc9c('0x3d')]=_[_0xcc9c('0x41')](_0x3668c0[_0xcc9c('0x3d')],{'$or':_['map'](_0x3668c0[_0xcc9c('0x36')],function(_0x1874bc){var _0x5751eb={};_0x5751eb[_0x1874bc]={'$like':'%'+_0x23fd93[_0xcc9c('0x32')][_0xcc9c('0x40')]+'%'};return _0x5751eb;})});}_0x3668c0=_[_0xcc9c('0x41')]({},_0x3668c0,_0x23fd93[_0xcc9c('0x49')]);return _0x1b1ab1[_0xcc9c('0x8d')](_0x3668c0);}})[_0xcc9c('0x25')](function(_0x308236){if(_0x308236){_0x28eaff=_0x308236[_0xcc9c('0x47')];if(!_0x23fd93[_0xcc9c('0x32')]['hasOwnProperty']('nolimit')){_0x3668c0[_0xcc9c('0x3a')]=qs[_0xcc9c('0x3a')](_0x23fd93['query']['limit']);_0x3668c0['offset']=qs[_0xcc9c('0x1f')](_0x23fd93[_0xcc9c('0x32')][_0xcc9c('0x1f')]);}return _0x1b1ab1['getAgents'](_0x3668c0);}})['then'](function(_0x112698){if(_0x112698){return _0x112698?{'count':_0x28eaff,'rows':_0x112698}:null;}})['then'](respondWithResult(_0x55989a,null))[_0xcc9c('0x44')](handleError(_0x55989a,null));}; \ No newline at end of file +var _0x0879=['filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','FaxQueue','type','map','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x31ca49,_0x5e6186){var _0x59548b=function(_0x58b04c){while(--_0x58b04c){_0x31ca49['push'](_0x31ca49['shift']());}};_0x59548b(++_0x5e6186);}(_0x0879,0x1e9));var _0x9087=function(_0x5e2e6e,_0x119816){_0x5e2e6e=_0x5e2e6e-0x0;var _0x4e4637=_0x0879[_0x5e2e6e];return _0x4e4637;};'use strict';var pdf=require(_0x9087('0x0'));var emlformat=require(_0x9087('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9087('0x2'));var jsonpatch=require(_0x9087('0x3'));var rp=require(_0x9087('0x4'));var moment=require('moment');var BPromise=require(_0x9087('0x5'));var Mustache=require(_0x9087('0x6'));var util=require(_0x9087('0x7'));var path=require(_0x9087('0x8'));var sox=require('sox');var csv=require(_0x9087('0x9'));var ejs=require(_0x9087('0xa'));var fs=require('fs');var _=require(_0x9087('0xb'));var squel=require(_0x9087('0xc'));var crypto=require(_0x9087('0xd'));var jsforce=require(_0x9087('0xe'));var deskjs=require(_0x9087('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9087('0x10'));var Papa=require('papaparse');var Redis=require(_0x9087('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9087('0x12'));var hardwareService=require(_0x9087('0x13'));var logger=require('../../config/logger')(_0x9087('0x14'));var utils=require(_0x9087('0x15'));var config=require(_0x9087('0x16'));var licenseUtil=require(_0x9087('0x17'));var db=require('../../mysqldb')['db'];config[_0x9087('0x18')]=_[_0x9087('0x19')](config[_0x9087('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9087('0x1a'))(new Redis(config[_0x9087('0x18')]));require(_0x9087('0x1b'))['register'](socket);function respondWithStatusCode(_0x43e290,_0x377e9a){_0x377e9a=_0x377e9a||0xcc;return function(_0x250fb0){if(_0x250fb0){return _0x43e290[_0x9087('0x1c')](_0x377e9a);}return _0x43e290['status'](_0x377e9a)[_0x9087('0x1d')]();};}function respondWithResult(_0x144521,_0x51fc87){_0x51fc87=_0x51fc87||0xc8;return function(_0x47d3e3){if(_0x47d3e3){return _0x144521[_0x9087('0x1e')](_0x51fc87)['json'](_0x47d3e3);}};}function respondWithFilteredResult(_0x5590f9,_0xd9b1b){return function(_0x569a46){if(_0x569a46){var _0x45e93e=_0x569a46[_0x9087('0x1f')],_0x392fd3=_0xd9b1b[_0x9087('0x20')],_0x4721d6=_0xd9b1b[_0x9087('0x20')]+_0xd9b1b[_0x9087('0x21')],_0x4d3030;if(_0x4721d6>=_0x45e93e){_0x4721d6=_0x45e93e;_0x4d3030=0xc8;}else{_0x4d3030=0xce;}_0x5590f9['status'](_0x4d3030);return _0x5590f9['set'](_0x9087('0x22'),_0x392fd3+'-'+_0x4721d6+'/'+_0x45e93e)[_0x9087('0x23')](_0x569a46);}return null;};}function patchUpdates(_0x25d7c1){return function(_0x209f95){try{jsonpatch[_0x9087('0x24')](_0x209f95,_0x25d7c1,!![]);}catch(_0x597c31){return BPromise['reject'](_0x597c31);}return _0x209f95[_0x9087('0x25')]();};}function saveUpdates(_0x585c86,_0x346707){return function(_0x281e65){if(_0x281e65){return _0x281e65[_0x9087('0x26')](_0x585c86)[_0x9087('0x27')](function(_0x66c3bf){return _0x66c3bf;});}return null;};}function removeEntity(_0x52713b,_0x45c711){return function(_0x17b43a){if(_0x17b43a){return _0x17b43a[_0x9087('0x28')]()[_0x9087('0x27')](function(){var _0x4f3e97=_0x17b43a[_0x9087('0x29')]({'plain':!![]});var _0x4ca6b7=_0x9087('0x2a');return db[_0x9087('0x2b')][_0x9087('0x28')]({'where':{'type':_0x4ca6b7,'resourceId':_0x4f3e97['id']}})[_0x9087('0x27')](function(){return _0x17b43a;});})[_0x9087('0x27')](function(){_0x52713b['status'](0xcc)[_0x9087('0x1d')]();});}};}function handleEntityNotFound(_0x3c957c,_0x4a0fc7){return function(_0x6675f7){if(!_0x6675f7){_0x3c957c[_0x9087('0x1c')](0x194);}return _0x6675f7;};}function handleError(_0x46c9ce,_0x38d7dc){_0x38d7dc=_0x38d7dc||0x1f4;return function(_0x189929){logger[_0x9087('0x2c')](_0x189929[_0x9087('0x2d')]);if(_0x189929[_0x9087('0x2e')]){delete _0x189929['name'];}_0x46c9ce[_0x9087('0x1e')](_0x38d7dc)[_0x9087('0x2f')](_0x189929);};}exports['index']=function(_0x3c877d,_0x44fc65){var _0x486b47={},_0x283e32={},_0x48e146={'count':0x0,'rows':[]};var _0x37d8a2=_['map'](db[_0x9087('0x30')]['rawAttributes'],function(_0x18a83b){return{'name':_0x18a83b['fieldName'],'type':_0x18a83b[_0x9087('0x31')]['key']};});_0x283e32['model']=_[_0x9087('0x32')](_0x37d8a2,'name');_0x283e32[_0x9087('0x33')]=_['keys'](_0x3c877d[_0x9087('0x33')]);_0x283e32['filters']=_['intersection'](_0x283e32[_0x9087('0x34')],_0x283e32[_0x9087('0x33')]);_0x486b47[_0x9087('0x35')]=_[_0x9087('0x36')](_0x283e32[_0x9087('0x34')],qs['fields'](_0x3c877d['query'][_0x9087('0x37')]));_0x486b47[_0x9087('0x35')]=_0x486b47[_0x9087('0x35')][_0x9087('0x38')]?_0x486b47[_0x9087('0x35')]:_0x283e32[_0x9087('0x34')];if(!_0x3c877d[_0x9087('0x33')][_0x9087('0x39')]('nolimit')){_0x486b47[_0x9087('0x21')]=qs['limit'](_0x3c877d[_0x9087('0x33')][_0x9087('0x21')]);_0x486b47['offset']=qs[_0x9087('0x20')](_0x3c877d[_0x9087('0x33')][_0x9087('0x20')]);}_0x486b47[_0x9087('0x3a')]=qs[_0x9087('0x3b')](_0x3c877d[_0x9087('0x33')]['sort']);_0x486b47[_0x9087('0x3c')]=qs[_0x9087('0x3d')](_[_0x9087('0x3e')](_0x3c877d[_0x9087('0x33')],_0x283e32[_0x9087('0x3d')]),_0x37d8a2);if(_0x3c877d['query'][_0x9087('0x3f')]){_0x486b47['where']=_['merge'](_0x486b47['where'],{'$or':_[_0x9087('0x32')](_0x37d8a2,function(_0x2cfd9a){if(_0x2cfd9a[_0x9087('0x31')]!==_0x9087('0x40')){var _0x2f6501={};_0x2f6501[_0x2cfd9a[_0x9087('0x2e')]]={'$like':'%'+_0x3c877d[_0x9087('0x33')]['filter']+'%'};return _0x2f6501;}})});}_0x486b47=_['merge']({},_0x486b47,_0x3c877d[_0x9087('0x41')]);var _0x1e4f14={'where':_0x486b47[_0x9087('0x3c')]};return db[_0x9087('0x30')][_0x9087('0x1f')](_0x1e4f14)[_0x9087('0x27')](function(_0x27c0d3){_0x48e146[_0x9087('0x1f')]=_0x27c0d3;if(_0x3c877d['query'][_0x9087('0x42')]){_0x486b47[_0x9087('0x43')]=[{'all':!![]}];}return db['FaxQueue'][_0x9087('0x44')](_0x486b47);})[_0x9087('0x27')](function(_0x4f6ded){_0x48e146[_0x9087('0x45')]=_0x4f6ded;return _0x48e146;})[_0x9087('0x27')](respondWithFilteredResult(_0x44fc65,_0x486b47))['catch'](handleError(_0x44fc65,null));};exports[_0x9087('0x46')]=function(_0x5a0741,_0x39fecb){var _0x39564f={'raw':!![],'where':{'id':_0x5a0741[_0x9087('0x47')]['id']}},_0x4f031f={};_0x4f031f[_0x9087('0x34')]=_[_0x9087('0x48')](db[_0x9087('0x30')][_0x9087('0x49')]);_0x4f031f['query']=_[_0x9087('0x48')](_0x5a0741[_0x9087('0x33')]);_0x4f031f[_0x9087('0x3d')]=_['intersection'](_0x4f031f[_0x9087('0x34')],_0x4f031f[_0x9087('0x33')]);_0x39564f[_0x9087('0x35')]=_[_0x9087('0x36')](_0x4f031f[_0x9087('0x34')],qs[_0x9087('0x37')](_0x5a0741['query'][_0x9087('0x37')]));_0x39564f[_0x9087('0x35')]=_0x39564f[_0x9087('0x35')][_0x9087('0x38')]?_0x39564f[_0x9087('0x35')]:_0x4f031f[_0x9087('0x34')];if(_0x5a0741[_0x9087('0x33')][_0x9087('0x42')]){_0x39564f[_0x9087('0x43')]=[{'all':!![]}];}_0x39564f=_[_0x9087('0x4a')]({},_0x39564f,_0x5a0741[_0x9087('0x41')]);return db[_0x9087('0x30')][_0x9087('0x4b')](_0x39564f)[_0x9087('0x27')](handleEntityNotFound(_0x39fecb,null))['then'](respondWithResult(_0x39fecb,null))['catch'](handleError(_0x39fecb,null));};exports[_0x9087('0x4c')]=function(_0x39db9b,_0x4c8466){return db['FaxQueue']['create'](_0x39db9b[_0x9087('0x4d')],{})['then'](function(_0x9f10a1){var _0x257fbb=_0x39db9b[_0x9087('0x4e')]['get']({'plain':!![]});if(!_0x257fbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x257fbb[_0x9087('0x4f')]===_0x9087('0x4e')){var _0x18274=_0x9f10a1[_0x9087('0x29')]({'plain':!![]});var _0x4a3df2='FaxQueues';return db[_0x9087('0x50')][_0x9087('0x4b')]({'where':{'name':_0x4a3df2,'userProfileId':_0x257fbb[_0x9087('0x51')]},'raw':!![]})['then'](function(_0x52346a){if(_0x52346a&&_0x52346a[_0x9087('0x52')]===0x0){return db[_0x9087('0x2b')][_0x9087('0x4c')]({'name':_0x18274[_0x9087('0x2e')],'resourceId':_0x18274['id'],'type':_0x52346a[_0x9087('0x2e')],'sectionId':_0x52346a['id']},{})[_0x9087('0x27')](function(){return _0x9f10a1;});}else{return _0x9f10a1;}})[_0x9087('0x53')](function(_0x3ff22b){logger[_0x9087('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ff22b);throw _0x3ff22b;});}return _0x9f10a1;})['then'](respondWithResult(_0x4c8466,0xc9))[_0x9087('0x53')](handleError(_0x4c8466,null));};exports[_0x9087('0x26')]=function(_0x2a7837,_0x33afb0){if(_0x2a7837[_0x9087('0x4d')]['id']){delete _0x2a7837['body']['id'];}return db[_0x9087('0x30')][_0x9087('0x4b')]({'where':{'id':_0x2a7837[_0x9087('0x47')]['id']}})[_0x9087('0x27')](handleEntityNotFound(_0x33afb0,null))['then'](saveUpdates(_0x2a7837[_0x9087('0x4d')],null))[_0x9087('0x27')](respondWithResult(_0x33afb0,null))[_0x9087('0x53')](handleError(_0x33afb0,null));};exports[_0x9087('0x28')]=function(_0x40c855,_0x3a9515){return db[_0x9087('0x30')]['find']({'where':{'id':_0x40c855[_0x9087('0x47')]['id']}})[_0x9087('0x27')](handleEntityNotFound(_0x3a9515,null))[_0x9087('0x27')](removeEntity(_0x3a9515,null))[_0x9087('0x53')](handleError(_0x3a9515,null));};exports[_0x9087('0x54')]=function(_0xb9ca2a,_0x1e4916){return db[_0x9087('0x30')][_0x9087('0x54')]()[_0x9087('0x27')](respondWithResult(_0x1e4916,null))[_0x9087('0x53')](handleError(_0x1e4916,null));};exports[_0x9087('0x55')]=function(_0x7da4fb,_0x572fd3,_0x4e8c52){var _0x8542a8={'raw':!![],'where':{}},_0x5c2cda={},_0x1ca8e3;return db[_0x9087('0x30')][_0x9087('0x56')]({'where':{'id':_0x7da4fb[_0x9087('0x47')]['id']}})[_0x9087('0x27')](handleEntityNotFound(_0x572fd3,null))[_0x9087('0x27')](function(_0x17aa11){if(_0x17aa11){_0x1ca8e3=_0x17aa11[_0x9087('0x29')]({'plain':!![]});_0x5c2cda['model']=_['keys'](db[_0x9087('0x57')][_0x9087('0x49')]);_0x5c2cda[_0x9087('0x33')]=_[_0x9087('0x48')](_0x7da4fb[_0x9087('0x33')]);_0x5c2cda[_0x9087('0x3d')]=_[_0x9087('0x36')](_0x5c2cda[_0x9087('0x34')],_0x5c2cda['query']);_0x8542a8[_0x9087('0x35')]=_[_0x9087('0x36')](_0x5c2cda[_0x9087('0x34')],qs['fields'](_0x7da4fb['query'][_0x9087('0x37')]));_0x8542a8[_0x9087('0x35')]=_0x8542a8['attributes'][_0x9087('0x38')]?_0x8542a8[_0x9087('0x35')]:_0x5c2cda[_0x9087('0x34')];if(!_0x7da4fb[_0x9087('0x33')][_0x9087('0x39')](_0x9087('0x58'))){_0x8542a8[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x7da4fb[_0x9087('0x33')][_0x9087('0x21')]);_0x8542a8[_0x9087('0x20')]=qs[_0x9087('0x20')](_0x7da4fb[_0x9087('0x33')]['offset']);}_0x8542a8[_0x9087('0x3a')]=qs[_0x9087('0x3b')](_0x7da4fb[_0x9087('0x33')][_0x9087('0x3b')]);_0x8542a8[_0x9087('0x3c')]=qs[_0x9087('0x3d')](_[_0x9087('0x3e')](_0x7da4fb[_0x9087('0x33')],_0x5c2cda[_0x9087('0x3d')]));_0x8542a8[_0x9087('0x3c')][_0x9087('0x59')]=_0x17aa11['id'];if(_0x7da4fb[_0x9087('0x33')][_0x9087('0x3f')]){_0x8542a8[_0x9087('0x3c')]=_[_0x9087('0x4a')](_0x8542a8[_0x9087('0x3c')],{'$or':_[_0x9087('0x32')](_0x8542a8['attributes'],function(_0x3eb449){var _0x4ae1d3={};_0x4ae1d3[_0x3eb449]={'$like':'%'+_0x7da4fb[_0x9087('0x33')][_0x9087('0x3f')]+'%'};return _0x4ae1d3;})});}_0x8542a8=_['merge']({},_0x8542a8,_0x7da4fb[_0x9087('0x41')]);return db[_0x9087('0x57')][_0x9087('0x44')](_0x8542a8);}})[_0x9087('0x27')](function(_0x176f80){if(_0x176f80){return db[_0x9087('0x5a')][_0x9087('0x5b')]({'where':{'id':_[_0x9087('0x32')](_0x176f80,_0x9087('0x5c')),'role':'agent'},'attributes':['id',_0x9087('0x2e'),_0x9087('0x5d'),_0x9087('0x5e'),_0x9087('0x5f')]});}})[_0x9087('0x27')](function(_0x405943){if(_0x405943){return{'count':_0x405943[_0x9087('0x1f')],'rows':_[_0x9087('0x32')](_0x405943[_0x9087('0x45')],function(_0x59fc7e){return{'membername':_0x59fc7e[_0x9087('0x2e')],'UserId':_0x59fc7e['id'],'queue_name':_0x1ca8e3[_0x9087('0x2e')],'FaxQueueId':_0x1ca8e3['id'],'interface':util[_0x9087('0x60')](_0x9087('0x61'),'SIP',_0x59fc7e[_0x9087('0x2e')]),'penalty':0x0,'paused':_0x59fc7e[_0x9087('0x5d')],'createdAt':_0x59fc7e['createdAt'],'updatedAt':_0x59fc7e[_0x9087('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9087('0x27')](respondWithFilteredResult(_0x572fd3,_0x8542a8))[_0x9087('0x53')](handleError(_0x572fd3,null));};exports[_0x9087('0x62')]=function(_0x5900d4,_0x20bacf,_0x37e5a9){var _0x210dcc={};var _0x1ce2b1={};var _0x2eb7fe;var _0x1bf1f1;return db['FaxQueue'][_0x9087('0x56')]({'where':{'id':_0x5900d4[_0x9087('0x47')]['id']}})[_0x9087('0x27')](handleEntityNotFound(_0x20bacf,null))['then'](function(_0x210acb){if(_0x210acb){_0x2eb7fe=_0x210acb;_0x1ce2b1[_0x9087('0x34')]=_[_0x9087('0x48')](db[_0x9087('0x63')][_0x9087('0x49')]);_0x1ce2b1[_0x9087('0x33')]=_[_0x9087('0x48')](_0x5900d4['query']);_0x1ce2b1[_0x9087('0x3d')]=_[_0x9087('0x36')](_0x1ce2b1[_0x9087('0x34')],_0x1ce2b1[_0x9087('0x33')]);_0x210dcc[_0x9087('0x35')]=_[_0x9087('0x36')](_0x1ce2b1[_0x9087('0x34')],qs[_0x9087('0x37')](_0x5900d4[_0x9087('0x33')][_0x9087('0x37')]));_0x210dcc[_0x9087('0x35')]=_0x210dcc[_0x9087('0x35')][_0x9087('0x38')]?_0x210dcc['attributes']:_0x1ce2b1[_0x9087('0x34')];_0x210dcc[_0x9087('0x3a')]=qs['sort'](_0x5900d4[_0x9087('0x33')][_0x9087('0x3b')]);_0x210dcc[_0x9087('0x3c')]=qs[_0x9087('0x3d')](_[_0x9087('0x3e')](_0x5900d4['query'],_0x1ce2b1[_0x9087('0x3d')]));if(_0x5900d4[_0x9087('0x33')][_0x9087('0x3f')]){_0x210dcc[_0x9087('0x3c')]=_['merge'](_0x210dcc[_0x9087('0x3c')],{'$or':_[_0x9087('0x32')](_0x210dcc[_0x9087('0x35')],function(_0x169c45){var _0x245890={};_0x245890[_0x169c45]={'$like':'%'+_0x5900d4[_0x9087('0x33')][_0x9087('0x3f')]+'%'};return _0x245890;})});}_0x210dcc=_['merge']({},_0x210dcc,_0x5900d4[_0x9087('0x41')]);return _0x2eb7fe[_0x9087('0x62')](_0x210dcc);}})['then'](function(_0x297225){if(_0x297225){_0x1bf1f1=_0x297225['length'];if(!_0x5900d4['query']['hasOwnProperty'](_0x9087('0x58'))){_0x210dcc[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x5900d4[_0x9087('0x33')]['limit']);_0x210dcc['offset']=qs[_0x9087('0x20')](_0x5900d4['query'][_0x9087('0x20')]);}return _0x2eb7fe['getTeams'](_0x210dcc);}})['then'](function(_0x5cb934){if(_0x5cb934){return _0x5cb934?{'count':_0x1bf1f1,'rows':_0x5cb934}:null;}})[_0x9087('0x27')](respondWithResult(_0x20bacf,null))['catch'](handleError(_0x20bacf,null));};exports[_0x9087('0x64')]=function(_0x4c55f8,_0x1f8125,_0x2b47df){var _0xa749ad=_0x4c55f8['body'][_0x9087('0x65')];return db[_0x9087('0x63')][_0x9087('0x44')]({'where':{'id':_0xa749ad},'attributes':['id'],'include':[{'model':db[_0x9087('0x5a')],'as':_0x9087('0x66'),'attributes':['id',_0x9087('0x2e'),_0x9087('0x67'),_0x9087('0x68'),_0x9087('0x69')],'raw':!![]}]})[_0x9087('0x27')](function(_0x241c83){if(_0x241c83){var _0x21a1b4=_[_0x9087('0x6a')](_0x241c83,function(_0x564b05){var _0x33e0b1=_0x564b05[_0x9087('0x29')]({'plain':!![]});return _0x33e0b1[_0x9087('0x66')];});return db[_0x9087('0x30')][_0x9087('0x4b')]({'where':{'id':_0x4c55f8[_0x9087('0x47')]['id']}})[_0x9087('0x27')](function(_0x3e8933){return db[_0x9087('0x6b')][_0x9087('0x6c')](function(_0x2dc1d1){return _0x3e8933[_0x9087('0x64')](_0xa749ad,{'transaction':_0x2dc1d1})[_0x9087('0x27')](function(){return BPromise[_0x9087('0x6d')](_0x21a1b4,function(_0x326655){return db[_0x9087('0x57')][_0x9087('0x6e')]({'where':{'UserId':_0x326655['id'],'FaxQueueId':_0x4c55f8[_0x9087('0x47')]['id']},'transaction':_0x2dc1d1});});})[_0x9087('0x27')](function(){_0x21a1b4[_0x9087('0x6f')](function(_0x1fd554){socket[_0x9087('0x70')](_0x9087('0x71'),{'UserId':_0x1fd554['id'],'FaxQueueId':_0x3e8933['id']});});});});});}})['then'](respondWithStatusCode(_0x1f8125,null))[_0x9087('0x53')](handleError(_0x1f8125,null));};exports[_0x9087('0x72')]=function(_0x284281,_0x3676d6,_0x27b948){return db['Team'][_0x9087('0x44')]({'where':{'id':_0x284281[_0x9087('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9087('0x5a')],'as':_0x9087('0x66'),'attributes':['id'],'raw':!![]}]})[_0x9087('0x27')](handleEntityNotFound(_0x3676d6,null))[_0x9087('0x27')](function(_0x1d9817){var _0x3bfbdc=_[_0x9087('0x32')](_0x1d9817,'id');var _0x5b288f=[];var _0x1a6788=[];var _0x1e6af0=squel['select']();_0x1e6af0['field'](_0x9087('0x73'))[_0x9087('0x74')](_0x9087('0x75'),'tq')[_0x9087('0x76')](_0x9087('0x77'),'ut',_0x9087('0x78'))['where'](_0x9087('0x79'),_0x284281[_0x9087('0x47')]['id']);for(var _0x506c97=0x0;_0x506c97<_0x1d9817[_0x9087('0x38')];_0x506c97+=0x1){let _0x42255a=_0x1d9817[_0x506c97];for(var _0x5d94d4=0x0;_0x5d94d4<_0x42255a[_0x9087('0x66')][_0x9087('0x38')];_0x5d94d4+=0x1){let _0x16bfe2=_0x42255a[_0x9087('0x66')][_0x5d94d4];var _0xd7a7ac=_0x1e6af0[_0x9087('0x7a')]();_0xd7a7ac[_0x9087('0x3c')](_0x9087('0x7b'),_0x16bfe2['id']);_0x1a6788[_0x9087('0x7c')](db[_0x9087('0x6b')][_0x9087('0x33')](_0xd7a7ac[_0x9087('0x7d')](),{'type':db[_0x9087('0x6b')]['QueryTypes'][_0x9087('0x7e')]})['then'](function(_0x2b42dc){if(_0x2b42dc[_0x9087('0x38')]===0x1){return _0x16bfe2['id'];}else{var _0x4e8076=_['every'](_[_0x9087('0x32')](_0x2b42dc,_0x9087('0x7f')),function(_0x278ba3){return _[_0x9087('0x80')](_0x3bfbdc,_0x278ba3);});if(_0x4e8076){return _0x16bfe2['id'];}}}));}}return BPromise['all'](_0x1a6788)[_0x9087('0x27')](function(_0x562ee2){_0x5b288f=_(_0x5b288f)[_0x9087('0x81')](_0x562ee2)[_0x9087('0x82')]()[_0x9087('0x83')]();return db['FaxQueue']['find']({'where':{'id':_0x284281[_0x9087('0x47')]['id']}})[_0x9087('0x27')](function(_0x375459){return db[_0x9087('0x6b')][_0x9087('0x6c')](function(_0x3d6e7f){return _0x375459[_0x9087('0x72')](_0x284281['query'][_0x9087('0x65')],{'transaction':_0x3d6e7f})['then'](function(){if(!_['isEmpty'](_0x5b288f)){return _0x375459[_0x9087('0x84')](_0x5b288f,{'transaction':_0x3d6e7f});}})[_0x9087('0x27')](function(){_0x5b288f[_0x9087('0x6f')](function(_0x1b7c67){socket[_0x9087('0x70')](_0x9087('0x85'),{'UserId':_0x1b7c67,'FaxQueueId':_0x375459['id']});});});});});});})[_0x9087('0x27')](respondWithStatusCode(_0x3676d6,null))[_0x9087('0x53')](handleError(_0x3676d6,null));};exports[_0x9087('0x86')]=function(_0x5a0e8d,_0x24849f,_0x3a9b21){return db[_0x9087('0x30')]['find']({'where':{'id':_0x5a0e8d['params']['id']}})['then'](handleEntityNotFound(_0x24849f,null))[_0x9087('0x27')](function(_0x3d3ba2){if(_0x3d3ba2){return _0x3d3ba2['addAgents'](_0x5a0e8d[_0x9087('0x4d')][_0x9087('0x65')],_[_0x9087('0x87')](_0x5a0e8d['body'],[_0x9087('0x65'),'id'])||{})[_0x9087('0x88')](function(_0x47fa53){for(var _0x3242ac=0x0;_0x3242ac<_0x5a0e8d['body'][_0x9087('0x65')]['length'];_0x3242ac+=0x1){socket[_0x9087('0x70')](_0x9087('0x71'),{'UserId':_0x5a0e8d[_0x9087('0x4d')]['ids'][_0x3242ac],'FaxQueueId':_0x5a0e8d[_0x9087('0x47')]['id']});}return _0x47fa53;});}})[_0x9087('0x27')](respondWithResult(_0x24849f,null))[_0x9087('0x53')](handleError(_0x24849f,null));};exports[_0x9087('0x84')]=function(_0xe9af7f,_0x7e18ae,_0x188f0d){return db[_0x9087('0x30')]['find']({'where':{'id':_0xe9af7f[_0x9087('0x47')]['id']}})[_0x9087('0x27')](handleEntityNotFound(_0x7e18ae,null))[_0x9087('0x27')](function(_0x107543){if(_0x107543){return _0x107543[_0x9087('0x84')](_0xe9af7f['query'][_0x9087('0x65')])[_0x9087('0x27')](function(){if(_['isArray'](_0xe9af7f['query'][_0x9087('0x65')])){for(var _0x50df19=0x0;_0x50df19<_0xe9af7f[_0x9087('0x33')]['ids']['length'];_0x50df19+=0x1){socket[_0x9087('0x70')](_0x9087('0x85'),{'UserId':Number(_0xe9af7f['query'][_0x9087('0x65')][_0x50df19]),'FaxQueueId':Number(_0xe9af7f[_0x9087('0x47')]['id'])});}}else{socket['emit'](_0x9087('0x85'),{'UserId':Number(_0xe9af7f['query'][_0x9087('0x65')]),'FaxQueueId':Number(_0xe9af7f['params']['id'])});}});}})[_0x9087('0x27')](respondWithStatusCode(_0x7e18ae,null))['catch'](handleError(_0x7e18ae,null));};exports[_0x9087('0x89')]=function(_0x4ac34d,_0x2e27d1,_0x4072bb){var _0x26171a={};var _0x584c01={};var _0x221619;var _0x5dfa4c;return db[_0x9087('0x30')]['findOne']({'where':{'id':_0x4ac34d[_0x9087('0x47')]['id']}})[_0x9087('0x27')](handleEntityNotFound(_0x2e27d1,null))[_0x9087('0x27')](function(_0x5c4ca9){if(_0x5c4ca9){_0x221619=_0x5c4ca9;_0x584c01[_0x9087('0x34')]=_['keys'](db['User'][_0x9087('0x49')]);_0x584c01[_0x9087('0x33')]=_[_0x9087('0x48')](_0x4ac34d[_0x9087('0x33')]);_0x584c01['filters']=_[_0x9087('0x36')](_0x584c01['model'],_0x584c01[_0x9087('0x33')]);_0x26171a['attributes']=_[_0x9087('0x36')](_0x584c01[_0x9087('0x34')],qs[_0x9087('0x37')](_0x4ac34d[_0x9087('0x33')][_0x9087('0x37')]));_0x26171a[_0x9087('0x35')]=_0x26171a[_0x9087('0x35')][_0x9087('0x38')]?_0x26171a[_0x9087('0x35')]:_0x584c01[_0x9087('0x34')];_0x26171a['order']=qs[_0x9087('0x3b')](_0x4ac34d[_0x9087('0x33')][_0x9087('0x3b')]);_0x26171a[_0x9087('0x3c')]=qs[_0x9087('0x3d')](_[_0x9087('0x3e')](_0x4ac34d[_0x9087('0x33')],_0x584c01[_0x9087('0x3d')]));if(_0x4ac34d[_0x9087('0x33')]['filter']){_0x26171a[_0x9087('0x3c')]=_[_0x9087('0x4a')](_0x26171a[_0x9087('0x3c')],{'$or':_['map'](_0x26171a[_0x9087('0x35')],function(_0x372006){var _0x5a3373={};_0x5a3373[_0x372006]={'$like':'%'+_0x4ac34d['query'][_0x9087('0x3f')]+'%'};return _0x5a3373;})});}_0x26171a=_[_0x9087('0x4a')]({},_0x26171a,_0x4ac34d[_0x9087('0x41')]);return _0x221619['getAgents'](_0x26171a);}})[_0x9087('0x27')](function(_0x232249){if(_0x232249){_0x5dfa4c=_0x232249[_0x9087('0x38')];if(!_0x4ac34d['query'][_0x9087('0x39')](_0x9087('0x58'))){_0x26171a[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x4ac34d['query'][_0x9087('0x21')]);_0x26171a[_0x9087('0x20')]=qs[_0x9087('0x20')](_0x4ac34d[_0x9087('0x33')][_0x9087('0x20')]);}return _0x221619[_0x9087('0x89')](_0x26171a);}})[_0x9087('0x27')](function(_0x1d9e2e){if(_0x1d9e2e){return _0x1d9e2e?{'count':_0x5dfa4c,'rows':_0x1d9e2e}:null;}})[_0x9087('0x27')](respondWithResult(_0x2e27d1,null))[_0x9087('0x53')](handleError(_0x2e27d1,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7146ec3..1c3ead2 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 _0xfc79=['hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfc79,0xe3));var _0x9fc7=function(_0x330ff4,_0x11615b){_0x330ff4=_0x330ff4-0x0;var _0x2b4ee4=_0xfc79[_0x330ff4];return _0x2b4ee4;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x9fc7('0x0'))['db'][_0x9fc7('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9fc7('0x2')](0x0);var events={'afterCreate':_0x9fc7('0x3'),'afterUpdate':_0x9fc7('0x4'),'afterDestroy':_0x9fc7('0x5')};function emitEvent(_0x5cb82b){return function(_0x404f20,_0x2c859f,_0x575047){FaxQueueEvents[_0x9fc7('0x6')](_0x5cb82b+':'+_0x404f20['id'],_0x404f20);FaxQueueEvents[_0x9fc7('0x6')](_0x5cb82b,_0x404f20);_0x575047(null);};}for(var e in events){if(events[_0x9fc7('0x7')](e)){var event=events[e];FaxQueue[_0x9fc7('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x9011=['save','remove','emit','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x9011,0xa7));var _0x1901=function(_0x40db91,_0x232c51){_0x40db91=_0x40db91-0x0;var _0x3e1912=_0x9011[_0x40db91];return _0x3e1912;};'use strict';var EventEmitter=require(_0x1901('0x0'));var FaxQueue=require(_0x1901('0x1'))['db'][_0x1901('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1901('0x3')](0x0);var events={'afterCreate':_0x1901('0x4'),'afterUpdate':'update','afterDestroy':_0x1901('0x5')};function emitEvent(_0x489fc9){return function(_0x100f7e,_0x390d46,_0x1e899c){FaxQueueEvents[_0x1901('0x6')](_0x489fc9+':'+_0x100f7e['id'],_0x100f7e);FaxQueueEvents['emit'](_0x489fc9,_0x100f7e);_0x1e899c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1901('0x7')](e,emitEvent(event));}}module[_0x1901('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2997b00..b3a3a5a 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 _0x68b7=['rimraf','../../config/environment','define','FaxQueue','fax_queues','lodash','moment','path'];(function(_0x544a35,_0x125ca8){var _0x2e49b2=function(_0x4ba1d9){while(--_0x4ba1d9){_0x544a35['push'](_0x544a35['shift']());}};_0x2e49b2(++_0x125ca8);}(_0x68b7,0xd5));var _0x768b=function(_0x586fdd,_0x578398){_0x586fdd=_0x586fdd-0x0;var _0x2b046f=_0x68b7[_0x586fdd];return _0x2b046f;};'use strict';var _=require(_0x768b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x768b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x768b('0x2'));var rimraf=require(_0x768b('0x3'));var config=require(_0x768b('0x4'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x2a77fb,_0x49574b){return _0x2a77fb[_0x768b('0x5')](_0x768b('0x6'),attributes,{'tableName':_0x768b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcab3=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./faxQueue.attributes','define'];(function(_0x43cbbd,_0xd626e8){var _0x410896=function(_0x1c8d38){while(--_0x1c8d38){_0x43cbbd['push'](_0x43cbbd['shift']());}};_0x410896(++_0xd626e8);}(_0xcab3,0xff));var _0x3cab=function(_0x494b0c,_0x5cb008){_0x494b0c=_0x494b0c-0x0;var _0x5b51c3=_0xcab3[_0x494b0c];return _0x5b51c3;};'use strict';var _=require(_0x3cab('0x0'));var util=require(_0x3cab('0x1'));var logger=require(_0x3cab('0x2'))(_0x3cab('0x3'));var moment=require('moment');var BPromise=require(_0x3cab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cab('0x5'));var rimraf=require('rimraf');var config=require(_0x3cab('0x6'));var attributes=require(_0x3cab('0x7'));module['exports']=function(_0xd12162,_0x4a5546){return _0xd12162[_0x3cab('0x8')](_0x3cab('0x9'),attributes,{'tableName':_0x3cab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 15e7ff9..fbeaa75 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 _0xc058=['util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxQueue','options','raw','include','map','model','attributes','catch','ShowFaxQueue','FaxQueue','find','where'];(function(_0x370b9e,_0xdef116){var _0xe0a3e9=function(_0x1144e5){while(--_0x1144e5){_0x370b9e['push'](_0x370b9e['shift']());}};_0xe0a3e9(++_0xdef116);}(_0xc058,0x6c));var _0x8c05=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc058[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x8c05('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c05('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c05('0x2'));var logger=require('../../config/logger')(_0x8c05('0x3'));var config=require(_0x8c05('0x4'));var jayson=require(_0x8c05('0x5'));var client=jayson[_0x8c05('0x6')][_0x8c05('0x7')]({'port':0x232a});config[_0x8c05('0x8')]=_[_0x8c05('0x9')](config[_0x8c05('0x8')],{'host':_0x8c05('0xa'),'port':0x18eb});var socket=require(_0x8c05('0xb'))(new Redis(config[_0x8c05('0x8')]));require('./faxQueue.socket')[_0x8c05('0xc')](socket);function respondWithRpcPromise(_0x49534a,_0x140184,_0x594511){return new BPromise(function(_0x10ec30,_0x2ba935){return client[_0x8c05('0xd')](_0x49534a,_0x594511)[_0x8c05('0xe')](function(_0x2ba614){logger[_0x8c05('0xf')](_0x8c05('0x10'),_0x140184,_0x8c05('0x11'));logger[_0x8c05('0x12')](_0x8c05('0x13'),_0x140184,_0x8c05('0x11'),JSON[_0x8c05('0x14')](_0x2ba614));if(_0x2ba614[_0x8c05('0x15')]){if(_0x2ba614['error'][_0x8c05('0x16')]===0x1f4){logger[_0x8c05('0x15')]('FaxQueue,\x20%s,\x20%s',_0x140184,_0x2ba614[_0x8c05('0x15')][_0x8c05('0x17')]);return _0x2ba935(_0x2ba614[_0x8c05('0x15')]['message']);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x140184,_0x2ba614[_0x8c05('0x15')][_0x8c05('0x17')]);return _0x10ec30(_0x2ba614[_0x8c05('0x15')][_0x8c05('0x17')]);}else{logger[_0x8c05('0xf')](_0x8c05('0x10'),_0x140184,_0x8c05('0x11'));_0x10ec30(_0x2ba614['result'][_0x8c05('0x17')]);}})['catch'](function(_0x40867f){logger[_0x8c05('0x15')]('FaxQueue,\x20%s,\x20%s',_0x140184,_0x40867f);_0x2ba935(_0x40867f);});});}exports[_0x8c05('0x18')]=function(_0x164118){var _0x323a5c=this;return new Promise(function(_0x1c235a,_0x4503a9){return db['FaxQueue']['findAll']({'raw':_0x164118['options']?_0x164118[_0x8c05('0x19')][_0x8c05('0x1a')]===undefined?!![]:![]:!![],'where':_0x164118[_0x8c05('0x19')]?_0x164118['options']['where']||null:null,'attributes':_0x164118['options']?_0x164118['options']['attributes']||null:null,'limit':_0x164118[_0x8c05('0x19')]?_0x164118[_0x8c05('0x19')]['limit']||null:null,'include':_0x164118[_0x8c05('0x19')]?_0x164118['options'][_0x8c05('0x1b')]?_[_0x8c05('0x1c')](_0x164118[_0x8c05('0x19')]['include'],function(_0x21de38){return{'model':db[_0x21de38[_0x8c05('0x1d')]],'as':_0x21de38['as'],'attributes':_0x21de38['attributes'],'include':_0x21de38[_0x8c05('0x1b')]?_[_0x8c05('0x1c')](_0x21de38['include'],function(_0x385777){return{'model':db[_0x385777[_0x8c05('0x1d')]],'as':_0x385777['as'],'attributes':_0x385777['attributes'],'include':_0x385777[_0x8c05('0x1b')]?_[_0x8c05('0x1c')](_0x385777[_0x8c05('0x1b')],function(_0x22c12a){return{'model':db[_0x22c12a[_0x8c05('0x1d')]],'as':_0x22c12a['as'],'attributes':_0x22c12a[_0x8c05('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8c05('0xe')](function(_0x396ff4){logger[_0x8c05('0xf')](_0x8c05('0x18'),_0x164118);logger['debug'](_0x8c05('0x18'),_0x164118,JSON[_0x8c05('0x14')](_0x396ff4));_0x1c235a(_0x396ff4);})[_0x8c05('0x1f')](function(_0x432a84){logger[_0x8c05('0x15')](_0x8c05('0x18'),_0x432a84['message'],_0x164118);_0x4503a9(_0x323a5c[_0x8c05('0x15')](0x1f4,_0x432a84['message']));});});};exports[_0x8c05('0x20')]=function(_0x3b705e){var _0x25865c=this;return new Promise(function(_0x350e34,_0x57d9e2){return db[_0x8c05('0x21')][_0x8c05('0x22')]({'raw':_0x3b705e[_0x8c05('0x19')]?_0x3b705e[_0x8c05('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3b705e[_0x8c05('0x19')]?_0x3b705e[_0x8c05('0x19')][_0x8c05('0x23')]||null:null,'attributes':_0x3b705e[_0x8c05('0x19')]?_0x3b705e[_0x8c05('0x19')][_0x8c05('0x1e')]||null:null,'include':_0x3b705e[_0x8c05('0x19')]?_0x3b705e[_0x8c05('0x19')][_0x8c05('0x1b')]?_[_0x8c05('0x1c')](_0x3b705e['options'][_0x8c05('0x1b')],function(_0x1ccee2){return{'model':db[_0x1ccee2[_0x8c05('0x1d')]],'as':_0x1ccee2['as'],'attributes':_0x1ccee2[_0x8c05('0x1e')],'include':_0x1ccee2[_0x8c05('0x1b')]?_['map'](_0x1ccee2[_0x8c05('0x1b')],function(_0x5b37d4){return{'model':db[_0x5b37d4[_0x8c05('0x1d')]],'as':_0x5b37d4['as'],'attributes':_0x5b37d4['attributes'],'include':_0x5b37d4['include']?_[_0x8c05('0x1c')](_0x5b37d4[_0x8c05('0x1b')],function(_0x5e863d){return{'model':db[_0x5e863d[_0x8c05('0x1d')]],'as':_0x5e863d['as'],'attributes':_0x5e863d[_0x8c05('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8c05('0xe')](function(_0x1045e9){logger['info'](_0x8c05('0x20'),_0x3b705e);logger[_0x8c05('0x12')](_0x8c05('0x20'),_0x3b705e,JSON['stringify'](_0x1045e9));_0x350e34(_0x1045e9);})[_0x8c05('0x1f')](function(_0x19f1cf){logger[_0x8c05('0x15')]('ShowFaxQueue',_0x19f1cf[_0x8c05('0x17')],_0x3b705e);_0x57d9e2(_0x25865c[_0x8c05('0x15')](0x1f4,_0x19f1cf[_0x8c05('0x17')]));});});}; \ No newline at end of file +var _0xb98c=['find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue'];(function(_0x565c86,_0x40928d){var _0x16ba1f=function(_0xbfc39b){while(--_0xbfc39b){_0x565c86['push'](_0x565c86['shift']());}};_0x16ba1f(++_0x40928d);}(_0xb98c,0x160));var _0xcb98=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xb98c[_0x240261];return _0x45c332;};'use strict';var _=require(_0xcb98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcb98('0x1'));var rs=require(_0xcb98('0x2'));var fs=require('fs');var Redis=require(_0xcb98('0x3'));var db=require(_0xcb98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb98('0x5'))(_0xcb98('0x6'));var config=require(_0xcb98('0x7'));var jayson=require(_0xcb98('0x8'));var client=jayson[_0xcb98('0x9')][_0xcb98('0xa')]({'port':0x232a});config[_0xcb98('0xb')]=_[_0xcb98('0xc')](config['redis'],{'host':_0xcb98('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb98('0xb')]));require(_0xcb98('0xe'))[_0xcb98('0xf')](socket);function respondWithRpcPromise(_0x11622e,_0x29c30b,_0x52ad3a){return new BPromise(function(_0x5e1fe9,_0x5b6ff6){return client[_0xcb98('0x10')](_0x11622e,_0x52ad3a)[_0xcb98('0x11')](function(_0x3ec61d){logger[_0xcb98('0x12')]('FaxQueue,\x20%s,\x20%s',_0x29c30b,_0xcb98('0x13'));logger[_0xcb98('0x14')](_0xcb98('0x15'),_0x29c30b,_0xcb98('0x13'),JSON[_0xcb98('0x16')](_0x3ec61d));if(_0x3ec61d[_0xcb98('0x17')]){if(_0x3ec61d[_0xcb98('0x17')]['code']===0x1f4){logger[_0xcb98('0x17')](_0xcb98('0x18'),_0x29c30b,_0x3ec61d['error'][_0xcb98('0x19')]);return _0x5b6ff6(_0x3ec61d['error'][_0xcb98('0x19')]);}logger['error'](_0xcb98('0x18'),_0x29c30b,_0x3ec61d[_0xcb98('0x17')][_0xcb98('0x19')]);return _0x5e1fe9(_0x3ec61d[_0xcb98('0x17')][_0xcb98('0x19')]);}else{logger[_0xcb98('0x12')](_0xcb98('0x18'),_0x29c30b,'request\x20sent');_0x5e1fe9(_0x3ec61d['result']['message']);}})[_0xcb98('0x1a')](function(_0x15e1d1){logger[_0xcb98('0x17')](_0xcb98('0x18'),_0x29c30b,_0x15e1d1);_0x5b6ff6(_0x15e1d1);});});}exports[_0xcb98('0x1b')]=function(_0xc2b354){var _0x2bce47=this;return new Promise(function(_0x1fad2d,_0x127a01){return db['FaxQueue'][_0xcb98('0x1c')]({'raw':_0xc2b354[_0xcb98('0x1d')]?_0xc2b354[_0xcb98('0x1d')][_0xcb98('0x1e')]===undefined?!![]:![]:!![],'where':_0xc2b354[_0xcb98('0x1d')]?_0xc2b354[_0xcb98('0x1d')][_0xcb98('0x1f')]||null:null,'attributes':_0xc2b354[_0xcb98('0x1d')]?_0xc2b354[_0xcb98('0x1d')][_0xcb98('0x20')]||null:null,'limit':_0xc2b354[_0xcb98('0x1d')]?_0xc2b354[_0xcb98('0x1d')][_0xcb98('0x21')]||null:null,'include':_0xc2b354[_0xcb98('0x1d')]?_0xc2b354[_0xcb98('0x1d')][_0xcb98('0x22')]?_[_0xcb98('0x23')](_0xc2b354[_0xcb98('0x1d')][_0xcb98('0x22')],function(_0x18952f){return{'model':db[_0x18952f[_0xcb98('0x24')]],'as':_0x18952f['as'],'attributes':_0x18952f['attributes'],'include':_0x18952f[_0xcb98('0x22')]?_[_0xcb98('0x23')](_0x18952f['include'],function(_0x1acf88){return{'model':db[_0x1acf88[_0xcb98('0x24')]],'as':_0x1acf88['as'],'attributes':_0x1acf88[_0xcb98('0x20')],'include':_0x1acf88['include']?_[_0xcb98('0x23')](_0x1acf88['include'],function(_0x235d4b){return{'model':db[_0x235d4b[_0xcb98('0x24')]],'as':_0x235d4b['as'],'attributes':_0x235d4b[_0xcb98('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8822e){logger[_0xcb98('0x12')]('GetFaxQueue',_0xc2b354);logger[_0xcb98('0x14')](_0xcb98('0x1b'),_0xc2b354,JSON[_0xcb98('0x16')](_0x8822e));_0x1fad2d(_0x8822e);})[_0xcb98('0x1a')](function(_0x6fdf1d){logger[_0xcb98('0x17')](_0xcb98('0x1b'),_0x6fdf1d['message'],_0xc2b354);_0x127a01(_0x2bce47[_0xcb98('0x17')](0x1f4,_0x6fdf1d[_0xcb98('0x19')]));});});};exports[_0xcb98('0x25')]=function(_0x18fef2){var _0x21f713=this;return new Promise(function(_0x54a4d3,_0x409385){return db['FaxQueue'][_0xcb98('0x26')]({'raw':_0x18fef2['options']?_0x18fef2[_0xcb98('0x1d')][_0xcb98('0x1e')]===undefined?!![]:![]:!![],'where':_0x18fef2['options']?_0x18fef2['options']['where']||null:null,'attributes':_0x18fef2[_0xcb98('0x1d')]?_0x18fef2[_0xcb98('0x1d')]['attributes']||null:null,'include':_0x18fef2['options']?_0x18fef2[_0xcb98('0x1d')]['include']?_['map'](_0x18fef2['options'][_0xcb98('0x22')],function(_0x3a83d3){return{'model':db[_0x3a83d3['model']],'as':_0x3a83d3['as'],'attributes':_0x3a83d3[_0xcb98('0x20')],'include':_0x3a83d3[_0xcb98('0x22')]?_[_0xcb98('0x23')](_0x3a83d3['include'],function(_0x33b7ba){return{'model':db[_0x33b7ba[_0xcb98('0x24')]],'as':_0x33b7ba['as'],'attributes':_0x33b7ba[_0xcb98('0x20')],'include':_0x33b7ba['include']?_['map'](_0x33b7ba[_0xcb98('0x22')],function(_0xcb16d5){return{'model':db[_0xcb16d5['model']],'as':_0xcb16d5['as'],'attributes':_0xcb16d5[_0xcb98('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d9d84){logger[_0xcb98('0x12')](_0xcb98('0x25'),_0x18fef2);logger['debug'](_0xcb98('0x25'),_0x18fef2,JSON[_0xcb98('0x16')](_0x1d9d84));_0x54a4d3(_0x1d9d84);})['catch'](function(_0x349b00){logger['error'](_0xcb98('0x25'),_0x349b00['message'],_0x18fef2);_0x409385(_0x21f713[_0xcb98('0x17')](0x1f4,_0x349b00[_0xcb98('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e9d3562..5a7dc3d 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 _0xfe28=['./faxQueue.events','save','remove','emit','length','faxQueue:'];(function(_0x1c7481,_0x85bf87){var _0x14ca2c=function(_0x3e0961){while(--_0x3e0961){_0x1c7481['push'](_0x1c7481['shift']());}};_0x14ca2c(++_0x85bf87);}(_0xfe28,0xfc));var _0x8fe2=function(_0xecbd4b,_0xc50cf5){_0xecbd4b=_0xecbd4b-0x0;var _0x14ef74=_0xfe28[_0xecbd4b];return _0x14ef74;};'use strict';var FaxQueueEvents=require(_0x8fe2('0x0'));var events=[_0x8fe2('0x1'),_0x8fe2('0x2'),'update'];function createListener(_0x1f2349,_0x20c8d8){return function(_0x3a9a28){_0x20c8d8[_0x8fe2('0x3')](_0x1f2349,_0x3a9a28);};}function removeListener(_0x25bb7a,_0x173fca){return function(){FaxQueueEvents['removeListener'](_0x25bb7a,_0x173fca);};}exports['register']=function(_0x22be56){for(var _0x25bb9c=0x0,_0x1b732c=events[_0x8fe2('0x4')];_0x25bb9c<_0x1b732c;_0x25bb9c++){var _0x4fbf1c=events[_0x25bb9c];var _0x10e190=createListener(_0x8fe2('0x5')+_0x4fbf1c,_0x22be56);FaxQueueEvents['on'](_0x4fbf1c,_0x10e190);}}; \ No newline at end of file +var _0x89ff=['register','./faxQueue.events','save','remove','emit'];(function(_0x54f00a,_0x1b34eb){var _0x55a9d7=function(_0x270830){while(--_0x270830){_0x54f00a['push'](_0x54f00a['shift']());}};_0x55a9d7(++_0x1b34eb);}(_0x89ff,0x187));var _0xf89f=function(_0x1c05c0,_0x38e872){_0x1c05c0=_0x1c05c0-0x0;var _0x4b8d87=_0x89ff[_0x1c05c0];return _0x4b8d87;};'use strict';var FaxQueueEvents=require(_0xf89f('0x0'));var events=[_0xf89f('0x1'),_0xf89f('0x2'),'update'];function createListener(_0x302ead,_0x2d1fa4){return function(_0x3e60e2){_0x2d1fa4[_0xf89f('0x3')](_0x302ead,_0x3e60e2);};}function removeListener(_0xe90c3f,_0xcf8a7b){return function(){FaxQueueEvents['removeListener'](_0xe90c3f,_0xcf8a7b);};}exports[_0xf89f('0x4')]=function(_0x24abe2){for(var _0x5802a3=0x0,_0x3dd056=events['length'];_0x5802a3<_0x3dd056;_0x5802a3++){var _0x1a6afe=events[_0x5802a3];var _0x2e6c7a=createListener('faxQueue:'+_0x1a6afe,_0x24abe2);FaxQueueEvents['on'](_0x1a6afe,_0x2e6c7a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 0b7f313..c8bd87c 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb10b,0x12a));var _0xbb10=function(_0x1dfce3,_0x491d21){_0x1dfce3=_0x1dfce3-0x0;var _0x127504=_0xb10b[_0x1dfce3];return _0x127504;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','/:id/teams'];(function(_0x57a6f0,_0x22caa5){var _0x587933=function(_0xae106b){while(--_0xae106b){_0x57a6f0['push'](_0x57a6f0['shift']());}};_0x587933(++_0x22caa5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d94b1,_0x29bbad){_0x2d94b1=_0x2d94b1-0x0;var _0x3a1d08=_0x5f2f[_0x2d94b1];return _0x3a1d08;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7822e93..0ad9f9a 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 _0xf07d=['STRING','DATE','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf07d,0xae));var _0xdf07=function(_0x2fd78c,_0x4238dc){_0x2fd78c=_0x2fd78c-0x0;var _0x372ea1=_0xf07d[_0x2fd78c];return _0x372ea1;};'use strict';var moment=require(_0xdf07('0x0'));var Sequelize=require(_0xdf07('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf07('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdf07('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdf07('0x2')]}}; \ No newline at end of file +var _0xc9b6=['STRING','moment','exports','DATE'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xc9b6,0x141));var _0x6c9b=function(_0xa8f5ed,_0x37f782){_0xa8f5ed=_0xa8f5ed-0x0;var _0x99f5be=_0xc9b6[_0xa8f5ed];return _0x99f5be;};'use strict';var moment=require(_0x6c9b('0x0'));var Sequelize=require('sequelize');module[_0x6c9b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6c9b('0x2')]},'acceptAt':{'type':Sequelize[_0x6c9b('0x2')]},'exitAt':{'type':Sequelize[_0x6c9b('0x2')]},'reason':{'type':Sequelize[_0x6c9b('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 82b1718..6f720da 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 _0x84ca=['error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','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','../../mysqldb','status','end','json','count','offset','set','reject','save','update','destroy','then'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0x84ca,0xc1));var _0xa84c=function(_0x1ee791,_0x2700b8){_0x1ee791=_0x1ee791-0x0;var _0x140da9=_0x84ca[_0x1ee791];return _0x140da9;};'use strict';var pdf=require(_0xa84c('0x0'));var emlformat=require(_0xa84c('0x1'));var rimraf=require(_0xa84c('0x2'));var zipdir=require(_0xa84c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa84c('0x4'));var BPromise=require(_0xa84c('0x5'));var Mustache=require(_0xa84c('0x6'));var util=require(_0xa84c('0x7'));var path=require(_0xa84c('0x8'));var sox=require(_0xa84c('0x9'));var csv=require(_0xa84c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa84c('0xb'));var squel=require(_0xa84c('0xc'));var crypto=require(_0xa84c('0xd'));var jsforce=require(_0xa84c('0xe'));var deskjs=require(_0xa84c('0xf'));var toCsv=require(_0xa84c('0xa'));var querystring=require(_0xa84c('0x10'));var Papa=require(_0xa84c('0x11'));var Redis=require(_0xa84c('0x12'));var authService=require(_0xa84c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa84c('0x14'));var hardwareService=require(_0xa84c('0x15'));var logger=require('../../config/logger')(_0xa84c('0x16'));var utils=require(_0xa84c('0x17'));var config=require(_0xa84c('0x18'));var licenseUtil=require(_0xa84c('0x19'));var db=require(_0xa84c('0x1a'))['db'];function respondWithStatusCode(_0x554347,_0x55b2f2){_0x55b2f2=_0x55b2f2||0xcc;return function(_0x41aef3){if(_0x41aef3){return _0x554347['sendStatus'](_0x55b2f2);}return _0x554347[_0xa84c('0x1b')](_0x55b2f2)[_0xa84c('0x1c')]();};}function respondWithResult(_0x181f34,_0x78941a){_0x78941a=_0x78941a||0xc8;return function(_0x5ec8b4){if(_0x5ec8b4){return _0x181f34['status'](_0x78941a)[_0xa84c('0x1d')](_0x5ec8b4);}};}function respondWithFilteredResult(_0x228c02,_0x4ea731){return function(_0x7ef129){if(_0x7ef129){var _0x2fa90d=_0x7ef129[_0xa84c('0x1e')],_0xa5166b=_0x4ea731[_0xa84c('0x1f')],_0x5ab974=_0x4ea731[_0xa84c('0x1f')]+_0x4ea731['limit'],_0x4bab01;if(_0x5ab974>=_0x2fa90d){_0x5ab974=_0x2fa90d;_0x4bab01=0xc8;}else{_0x4bab01=0xce;}_0x228c02[_0xa84c('0x1b')](_0x4bab01);return _0x228c02[_0xa84c('0x20')]('Content-Range',_0xa5166b+'-'+_0x5ab974+'/'+_0x2fa90d)[_0xa84c('0x1d')](_0x7ef129);}return null;};}function patchUpdates(_0x3ca27c){return function(_0x37df31){try{jsonpatch['apply'](_0x37df31,_0x3ca27c,!![]);}catch(_0x1b1de1){return BPromise[_0xa84c('0x21')](_0x1b1de1);}return _0x37df31[_0xa84c('0x22')]();};}function saveUpdates(_0x4c8d71,_0x1744d2){return function(_0x12894d){if(_0x12894d){return _0x12894d[_0xa84c('0x23')](_0x4c8d71)['then'](function(_0x4f0622){return _0x4f0622;});}return null;};}function removeEntity(_0x8adc74,_0x366ad1){return function(_0x24ea2b){if(_0x24ea2b){return _0x24ea2b[_0xa84c('0x24')]()[_0xa84c('0x25')](function(){_0x8adc74[_0xa84c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11a8ff,_0x5d2212){return function(_0xbb638d){if(!_0xbb638d){_0x11a8ff['sendStatus'](0x194);}return _0xbb638d;};}function handleError(_0x408faa,_0x463fa6){_0x463fa6=_0x463fa6||0x1f4;return function(_0x2a604d){logger[_0xa84c('0x26')](_0x2a604d[_0xa84c('0x27')]);if(_0x2a604d[_0xa84c('0x28')]){delete _0x2a604d[_0xa84c('0x28')];}_0x408faa[_0xa84c('0x1b')](_0x463fa6)[_0xa84c('0x29')](_0x2a604d);};}exports[_0xa84c('0x2a')]=function(_0x582dfb,_0x30a5ef){var _0x2ca867={},_0x2e92c1={},_0x230954={'count':0x0,'rows':[]};var _0x22fade=_[_0xa84c('0x2b')](db[_0xa84c('0x2c')][_0xa84c('0x2d')],function(_0x40db7d){return{'name':_0x40db7d[_0xa84c('0x2e')],'type':_0x40db7d[_0xa84c('0x2f')][_0xa84c('0x30')]};});_0x2e92c1[_0xa84c('0x31')]=_[_0xa84c('0x2b')](_0x22fade,'name');_0x2e92c1[_0xa84c('0x32')]=_[_0xa84c('0x33')](_0x582dfb[_0xa84c('0x32')]);_0x2e92c1['filters']=_[_0xa84c('0x34')](_0x2e92c1[_0xa84c('0x31')],_0x2e92c1[_0xa84c('0x32')]);_0x2ca867[_0xa84c('0x35')]=_['intersection'](_0x2e92c1[_0xa84c('0x31')],qs[_0xa84c('0x36')](_0x582dfb[_0xa84c('0x32')][_0xa84c('0x36')]));_0x2ca867[_0xa84c('0x35')]=_0x2ca867['attributes'][_0xa84c('0x37')]?_0x2ca867[_0xa84c('0x35')]:_0x2e92c1[_0xa84c('0x31')];if(!_0x582dfb[_0xa84c('0x32')][_0xa84c('0x38')]('nolimit')){_0x2ca867[_0xa84c('0x39')]=qs[_0xa84c('0x39')](_0x582dfb['query'][_0xa84c('0x39')]);_0x2ca867[_0xa84c('0x1f')]=qs[_0xa84c('0x1f')](_0x582dfb[_0xa84c('0x32')][_0xa84c('0x1f')]);}_0x2ca867[_0xa84c('0x3a')]=qs[_0xa84c('0x3b')](_0x582dfb[_0xa84c('0x32')]['sort']);_0x2ca867[_0xa84c('0x3c')]=qs[_0xa84c('0x3d')](_[_0xa84c('0x3e')](_0x582dfb[_0xa84c('0x32')],_0x2e92c1[_0xa84c('0x3d')]),_0x22fade);if(_0x582dfb[_0xa84c('0x32')][_0xa84c('0x3f')]){_0x2ca867[_0xa84c('0x3c')]=_[_0xa84c('0x40')](_0x2ca867['where'],{'$or':_[_0xa84c('0x2b')](_0x22fade,function(_0x466553){if(_0x466553[_0xa84c('0x2f')]!==_0xa84c('0x41')){var _0x4de853={};_0x4de853[_0x466553['name']]={'$like':'%'+_0x582dfb[_0xa84c('0x32')][_0xa84c('0x3f')]+'%'};return _0x4de853;}})});}_0x2ca867=_[_0xa84c('0x40')]({},_0x2ca867,_0x582dfb[_0xa84c('0x42')]);var _0x39f727={'where':_0x2ca867[_0xa84c('0x3c')]};return db[_0xa84c('0x2c')][_0xa84c('0x1e')](_0x39f727)['then'](function(_0x12f635){_0x230954['count']=_0x12f635;if(_0x582dfb[_0xa84c('0x32')][_0xa84c('0x43')]){_0x2ca867[_0xa84c('0x44')]=[{'all':!![]}];}return db[_0xa84c('0x2c')][_0xa84c('0x45')](_0x2ca867);})['then'](function(_0x475292){_0x230954[_0xa84c('0x46')]=_0x475292;return _0x230954;})[_0xa84c('0x25')](respondWithFilteredResult(_0x30a5ef,_0x2ca867))[_0xa84c('0x47')](handleError(_0x30a5ef,null));};exports['show']=function(_0x2ca9a3,_0xbfbb14){var _0x5449={'raw':!![],'where':{'id':_0x2ca9a3['params']['id']}},_0x580ee0={};_0x580ee0[_0xa84c('0x31')]=_['keys'](db['FaxQueueReport'][_0xa84c('0x2d')]);_0x580ee0['query']=_[_0xa84c('0x33')](_0x2ca9a3[_0xa84c('0x32')]);_0x580ee0[_0xa84c('0x3d')]=_['intersection'](_0x580ee0[_0xa84c('0x31')],_0x580ee0[_0xa84c('0x32')]);_0x5449[_0xa84c('0x35')]=_['intersection'](_0x580ee0[_0xa84c('0x31')],qs['fields'](_0x2ca9a3[_0xa84c('0x32')][_0xa84c('0x36')]));_0x5449[_0xa84c('0x35')]=_0x5449[_0xa84c('0x35')]['length']?_0x5449[_0xa84c('0x35')]:_0x580ee0['model'];if(_0x2ca9a3[_0xa84c('0x32')][_0xa84c('0x43')]){_0x5449[_0xa84c('0x44')]=[{'all':!![]}];}_0x5449=_[_0xa84c('0x40')]({},_0x5449,_0x2ca9a3[_0xa84c('0x42')]);return db[_0xa84c('0x2c')][_0xa84c('0x48')](_0x5449)['then'](handleEntityNotFound(_0xbfbb14,null))[_0xa84c('0x25')](respondWithResult(_0xbfbb14,null))[_0xa84c('0x47')](handleError(_0xbfbb14,null));};exports[_0xa84c('0x49')]=function(_0x17f3e7,_0x12b165){return db[_0xa84c('0x2c')]['create'](_0x17f3e7[_0xa84c('0x4a')],{})[_0xa84c('0x25')](respondWithResult(_0x12b165,0xc9))[_0xa84c('0x47')](handleError(_0x12b165,null));};exports[_0xa84c('0x23')]=function(_0x25e7a0,_0x260e54){if(_0x25e7a0[_0xa84c('0x4a')]['id']){delete _0x25e7a0[_0xa84c('0x4a')]['id'];}return db[_0xa84c('0x2c')][_0xa84c('0x48')]({'where':{'id':_0x25e7a0[_0xa84c('0x4b')]['id']}})[_0xa84c('0x25')](handleEntityNotFound(_0x260e54,null))[_0xa84c('0x25')](saveUpdates(_0x25e7a0['body'],null))[_0xa84c('0x25')](respondWithResult(_0x260e54,null))['catch'](handleError(_0x260e54,null));};exports[_0xa84c('0x24')]=function(_0x2c9177,_0x4aff26){return db['FaxQueueReport'][_0xa84c('0x48')]({'where':{'id':_0x2c9177[_0xa84c('0x4b')]['id']}})[_0xa84c('0x25')](handleEntityNotFound(_0x4aff26,null))['then'](removeEntity(_0x4aff26,null))[_0xa84c('0x47')](handleError(_0x4aff26,null));};exports[_0xa84c('0x4c')]=function(_0x442174,_0xeedba0){return db[_0xa84c('0x2c')][_0xa84c('0x4c')]()[_0xa84c('0x25')](respondWithResult(_0xeedba0,null))[_0xa84c('0x47')](handleError(_0xeedba0,null));}; \ No newline at end of file +var _0xbc5f=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto'];(function(_0x5ce405,_0x29315d){var _0x42de0c=function(_0x281976){while(--_0x281976){_0x5ce405['push'](_0x5ce405['shift']());}};_0x42de0c(++_0x29315d);}(_0xbc5f,0x118));var _0xfbc5=function(_0x302933,_0x1b99b0){_0x302933=_0x302933-0x0;var _0x438e79=_0xbc5f[_0x302933];return _0x438e79;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfbc5('0x0'));var rimraf=require(_0xfbc5('0x1'));var zipdir=require(_0xfbc5('0x2'));var jsonpatch=require(_0xfbc5('0x3'));var rp=require(_0xfbc5('0x4'));var moment=require(_0xfbc5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbc5('0x6'));var util=require('util');var path=require(_0xfbc5('0x7'));var sox=require(_0xfbc5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbc5('0x9'));var squel=require(_0xfbc5('0xa'));var crypto=require(_0xfbc5('0xb'));var jsforce=require(_0xfbc5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfbc5('0xd'));var querystring=require(_0xfbc5('0xe'));var Papa=require(_0xfbc5('0xf'));var Redis=require(_0xfbc5('0x10'));var authService=require(_0xfbc5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfbc5('0x12'));var hardwareService=require(_0xfbc5('0x13'));var logger=require('../../config/logger')(_0xfbc5('0x14'));var utils=require(_0xfbc5('0x15'));var config=require(_0xfbc5('0x16'));var licenseUtil=require(_0xfbc5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352c5a,_0x1d0a3d){_0x1d0a3d=_0x1d0a3d||0xcc;return function(_0x55fe5a){if(_0x55fe5a){return _0x352c5a[_0xfbc5('0x18')](_0x1d0a3d);}return _0x352c5a[_0xfbc5('0x19')](_0x1d0a3d)[_0xfbc5('0x1a')]();};}function respondWithResult(_0x409a0f,_0x14b4cd){_0x14b4cd=_0x14b4cd||0xc8;return function(_0x214a0a){if(_0x214a0a){return _0x409a0f['status'](_0x14b4cd)[_0xfbc5('0x1b')](_0x214a0a);}};}function respondWithFilteredResult(_0x26493c,_0x2564dc){return function(_0x53a809){if(_0x53a809){var _0x411bad=_0x53a809[_0xfbc5('0x1c')],_0x5e616d=_0x2564dc['offset'],_0x39992b=_0x2564dc[_0xfbc5('0x1d')]+_0x2564dc['limit'],_0x28c716;if(_0x39992b>=_0x411bad){_0x39992b=_0x411bad;_0x28c716=0xc8;}else{_0x28c716=0xce;}_0x26493c[_0xfbc5('0x19')](_0x28c716);return _0x26493c['set'](_0xfbc5('0x1e'),_0x5e616d+'-'+_0x39992b+'/'+_0x411bad)[_0xfbc5('0x1b')](_0x53a809);}return null;};}function patchUpdates(_0x102b76){return function(_0x4d90cd){try{jsonpatch[_0xfbc5('0x1f')](_0x4d90cd,_0x102b76,!![]);}catch(_0x2ef85d){return BPromise[_0xfbc5('0x20')](_0x2ef85d);}return _0x4d90cd[_0xfbc5('0x21')]();};}function saveUpdates(_0x400380,_0x292617){return function(_0x5537d8){if(_0x5537d8){return _0x5537d8['update'](_0x400380)[_0xfbc5('0x22')](function(_0x536439){return _0x536439;});}return null;};}function removeEntity(_0x15e99a,_0x50b9eb){return function(_0x1bdf2c){if(_0x1bdf2c){return _0x1bdf2c[_0xfbc5('0x23')]()[_0xfbc5('0x22')](function(){_0x15e99a[_0xfbc5('0x19')](0xcc)[_0xfbc5('0x1a')]();});}};}function handleEntityNotFound(_0x5a158c,_0x4edec9){return function(_0x3ec980){if(!_0x3ec980){_0x5a158c[_0xfbc5('0x18')](0x194);}return _0x3ec980;};}function handleError(_0x4f96d6,_0x46a021){_0x46a021=_0x46a021||0x1f4;return function(_0xe41be1){logger[_0xfbc5('0x24')](_0xe41be1[_0xfbc5('0x25')]);if(_0xe41be1[_0xfbc5('0x26')]){delete _0xe41be1['name'];}_0x4f96d6[_0xfbc5('0x19')](_0x46a021)[_0xfbc5('0x27')](_0xe41be1);};}exports['index']=function(_0x320a9d,_0xe52244){var _0x1023f7={},_0x266b40={},_0x2988e7={'count':0x0,'rows':[]};var _0x9d2274=_['map'](db[_0xfbc5('0x28')][_0xfbc5('0x29')],function(_0x518024){return{'name':_0x518024[_0xfbc5('0x2a')],'type':_0x518024[_0xfbc5('0x2b')]['key']};});_0x266b40[_0xfbc5('0x2c')]=_[_0xfbc5('0x2d')](_0x9d2274,'name');_0x266b40[_0xfbc5('0x2e')]=_[_0xfbc5('0x2f')](_0x320a9d[_0xfbc5('0x2e')]);_0x266b40['filters']=_[_0xfbc5('0x30')](_0x266b40['model'],_0x266b40[_0xfbc5('0x2e')]);_0x1023f7[_0xfbc5('0x31')]=_['intersection'](_0x266b40[_0xfbc5('0x2c')],qs['fields'](_0x320a9d[_0xfbc5('0x2e')][_0xfbc5('0x32')]));_0x1023f7[_0xfbc5('0x31')]=_0x1023f7['attributes'][_0xfbc5('0x33')]?_0x1023f7[_0xfbc5('0x31')]:_0x266b40['model'];if(!_0x320a9d['query']['hasOwnProperty'](_0xfbc5('0x34'))){_0x1023f7[_0xfbc5('0x35')]=qs[_0xfbc5('0x35')](_0x320a9d[_0xfbc5('0x2e')][_0xfbc5('0x35')]);_0x1023f7[_0xfbc5('0x1d')]=qs[_0xfbc5('0x1d')](_0x320a9d[_0xfbc5('0x2e')][_0xfbc5('0x1d')]);}_0x1023f7[_0xfbc5('0x36')]=qs[_0xfbc5('0x37')](_0x320a9d[_0xfbc5('0x2e')][_0xfbc5('0x37')]);_0x1023f7[_0xfbc5('0x38')]=qs[_0xfbc5('0x39')](_['pick'](_0x320a9d[_0xfbc5('0x2e')],_0x266b40[_0xfbc5('0x39')]),_0x9d2274);if(_0x320a9d[_0xfbc5('0x2e')]['filter']){_0x1023f7['where']=_[_0xfbc5('0x3a')](_0x1023f7[_0xfbc5('0x38')],{'$or':_['map'](_0x9d2274,function(_0x2b44e5){if(_0x2b44e5['type']!==_0xfbc5('0x3b')){var _0x57534f={};_0x57534f[_0x2b44e5[_0xfbc5('0x26')]]={'$like':'%'+_0x320a9d['query']['filter']+'%'};return _0x57534f;}})});}_0x1023f7=_[_0xfbc5('0x3a')]({},_0x1023f7,_0x320a9d[_0xfbc5('0x3c')]);var _0x538246={'where':_0x1023f7['where']};return db['FaxQueueReport'][_0xfbc5('0x1c')](_0x538246)['then'](function(_0x48f981){_0x2988e7[_0xfbc5('0x1c')]=_0x48f981;if(_0x320a9d['query'][_0xfbc5('0x3d')]){_0x1023f7[_0xfbc5('0x3e')]=[{'all':!![]}];}return db[_0xfbc5('0x28')][_0xfbc5('0x3f')](_0x1023f7);})[_0xfbc5('0x22')](function(_0x50df4a){_0x2988e7[_0xfbc5('0x40')]=_0x50df4a;return _0x2988e7;})[_0xfbc5('0x22')](respondWithFilteredResult(_0xe52244,_0x1023f7))[_0xfbc5('0x41')](handleError(_0xe52244,null));};exports[_0xfbc5('0x42')]=function(_0x37eb12,_0x251687){var _0x244e58={'raw':!![],'where':{'id':_0x37eb12[_0xfbc5('0x43')]['id']}},_0x10c9aa={};_0x10c9aa[_0xfbc5('0x2c')]=_['keys'](db[_0xfbc5('0x28')]['rawAttributes']);_0x10c9aa[_0xfbc5('0x2e')]=_[_0xfbc5('0x2f')](_0x37eb12[_0xfbc5('0x2e')]);_0x10c9aa[_0xfbc5('0x39')]=_['intersection'](_0x10c9aa['model'],_0x10c9aa[_0xfbc5('0x2e')]);_0x244e58[_0xfbc5('0x31')]=_[_0xfbc5('0x30')](_0x10c9aa[_0xfbc5('0x2c')],qs['fields'](_0x37eb12['query'][_0xfbc5('0x32')]));_0x244e58['attributes']=_0x244e58['attributes'][_0xfbc5('0x33')]?_0x244e58[_0xfbc5('0x31')]:_0x10c9aa[_0xfbc5('0x2c')];if(_0x37eb12['query'][_0xfbc5('0x3d')]){_0x244e58[_0xfbc5('0x3e')]=[{'all':!![]}];}_0x244e58=_['merge']({},_0x244e58,_0x37eb12['options']);return db[_0xfbc5('0x28')][_0xfbc5('0x44')](_0x244e58)[_0xfbc5('0x22')](handleEntityNotFound(_0x251687,null))[_0xfbc5('0x22')](respondWithResult(_0x251687,null))[_0xfbc5('0x41')](handleError(_0x251687,null));};exports[_0xfbc5('0x45')]=function(_0x5c1570,_0x1bcd4a){return db['FaxQueueReport'][_0xfbc5('0x45')](_0x5c1570[_0xfbc5('0x46')],{})[_0xfbc5('0x22')](respondWithResult(_0x1bcd4a,0xc9))[_0xfbc5('0x41')](handleError(_0x1bcd4a,null));};exports[_0xfbc5('0x47')]=function(_0x36dc75,_0x195716){if(_0x36dc75['body']['id']){delete _0x36dc75['body']['id'];}return db[_0xfbc5('0x28')][_0xfbc5('0x44')]({'where':{'id':_0x36dc75[_0xfbc5('0x43')]['id']}})['then'](handleEntityNotFound(_0x195716,null))[_0xfbc5('0x22')](saveUpdates(_0x36dc75[_0xfbc5('0x46')],null))[_0xfbc5('0x22')](respondWithResult(_0x195716,null))[_0xfbc5('0x41')](handleError(_0x195716,null));};exports[_0xfbc5('0x23')]=function(_0x17841d,_0x3a3b13){return db[_0xfbc5('0x28')][_0xfbc5('0x44')]({'where':{'id':_0x17841d[_0xfbc5('0x43')]['id']}})[_0xfbc5('0x22')](handleEntityNotFound(_0x3a3b13,null))[_0xfbc5('0x22')](removeEntity(_0x3a3b13,null))[_0xfbc5('0x41')](handleError(_0x3a3b13,null));};exports[_0xfbc5('0x48')]=function(_0x4bc8c3,_0x448cf2){return db[_0xfbc5('0x28')][_0xfbc5('0x48')]()[_0xfbc5('0x22')](respondWithResult(_0x448cf2,null))[_0xfbc5('0x41')](handleError(_0x448cf2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2a31d0d..72f9f65 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 _0x9463=['./faxQueueReport.attributes','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x9463,0x7d));var _0x3946=function(_0x3b19dd,_0x127776){_0x3b19dd=_0x3b19dd-0x0;var _0x445b0c=_0x9463[_0x3b19dd];return _0x445b0c;};'use strict';var _=require(_0x3946('0x0'));var util=require(_0x3946('0x1'));var logger=require(_0x3946('0x2'))(_0x3946('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3946('0x4'));var fs=require('fs');var path=require(_0x3946('0x5'));var rimraf=require(_0x3946('0x6'));var config=require('../../config/environment');var attributes=require(_0x3946('0x7'));module['exports']=function(_0x165183,_0x236296){return _0x165183['define'](_0x3946('0x8'),attributes,{'tableName':_0x3946('0x9'),'paranoid':![],'indexes':[{'name':_0x3946('0xa'),'fields':[_0x3946('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x859f=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./faxQueueReport.attributes','FaxQueueReport','report_fax_queue'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x859f,0x109));var _0xf859=function(_0x585281,_0x5b2d3d){_0x585281=_0x585281-0x0;var _0x5f14af=_0x859f[_0x585281];return _0x5f14af;};'use strict';var _=require(_0xf859('0x0'));var util=require(_0xf859('0x1'));var logger=require(_0xf859('0x2'))(_0xf859('0x3'));var moment=require('moment');var BPromise=require(_0xf859('0x4'));var rp=require(_0xf859('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf859('0x6'));var config=require('../../config/environment');var attributes=require(_0xf859('0x7'));module['exports']=function(_0x73042,_0x40cbc4){return _0x73042['define'](_0xf859('0x8'),attributes,{'tableName':_0xf859('0x9'),'paranoid':![],'indexes':[{'name':_0xf859('0xa'),'fields':[_0xf859('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1e5c57a..c1e0883 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 _0xe12a=['http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','where','limit','UpdateFaxQueueReport','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x74a6bb,_0x1ef881){var _0x3d6cd6=function(_0x5f5330){while(--_0x5f5330){_0x74a6bb['push'](_0x74a6bb['shift']());}};_0x3d6cd6(++_0x1ef881);}(_0xe12a,0x116));var _0xae12=function(_0x5ef57f,_0x1d8cb8){_0x5ef57f=_0x5ef57f-0x0;var _0x3ee0ff=_0xe12a[_0x5ef57f];return _0x3ee0ff;};'use strict';var _=require(_0xae12('0x0'));var util=require(_0xae12('0x1'));var moment=require(_0xae12('0x2'));var BPromise=require(_0xae12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae12('0x4'));var db=require(_0xae12('0x5'))['db'];var utils=require(_0xae12('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xae12('0x7'));var jayson=require(_0xae12('0x8'));var client=jayson[_0xae12('0x9')][_0xae12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49894f,_0x415fd8,_0x4bac1a){return new BPromise(function(_0x5a1a38,_0x5051e9){return client[_0xae12('0xb')](_0x49894f,_0x4bac1a)[_0xae12('0xc')](function(_0x5d4452){logger['info'](_0xae12('0xd'),_0x415fd8,'request\x20sent');logger[_0xae12('0xe')](_0xae12('0xf'),_0x415fd8,_0xae12('0x10'),JSON['stringify'](_0x5d4452));if(_0x5d4452[_0xae12('0x11')]){if(_0x5d4452[_0xae12('0x11')][_0xae12('0x12')]===0x1f4){logger[_0xae12('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x415fd8,_0x5d4452['error']['message']);return _0x5051e9(_0x5d4452[_0xae12('0x11')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x415fd8,_0x5d4452[_0xae12('0x11')][_0xae12('0x13')]);return _0x5a1a38(_0x5d4452[_0xae12('0x11')]['message']);}else{logger[_0xae12('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x415fd8,_0xae12('0x10'));_0x5a1a38(_0x5d4452[_0xae12('0x15')]['message']);}})[_0xae12('0x16')](function(_0x1e536a){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x415fd8,_0x1e536a);_0x5051e9(_0x1e536a);});});}exports['CreateFaxQueueReport']=function(_0x45c607){var _0x4d8f8e=this;return new Promise(function(_0x593c4e,_0x232d91){return db[_0xae12('0x17')][_0xae12('0x18')](_0x45c607['body'],{'raw':_0x45c607[_0xae12('0x19')]?_0x45c607['options'][_0xae12('0x1a')]===undefined?!![]:![]:!![]})[_0xae12('0xc')](function(_0x531ad4){logger[_0xae12('0x14')](_0xae12('0x1b'),_0x45c607);logger[_0xae12('0xe')]('CreateFaxQueueReport',_0x45c607,JSON['stringify'](_0x531ad4));_0x593c4e(_0x531ad4);})[_0xae12('0x16')](function(_0x35aa61){logger['error'](_0xae12('0x1b'),_0x35aa61[_0xae12('0x13')],_0x45c607);_0x232d91(_0x4d8f8e['error'](0x1f4,_0x35aa61['message']));});});};exports['UpdateFaxQueueReport']=function(_0x240ccd){var _0xd0dfdc=this;return new Promise(function(_0x1c4a90,_0x195cd0){return db[_0xae12('0x17')]['update'](_0x240ccd['body'],{'raw':_0x240ccd['options']?_0x240ccd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240ccd['options']?_0x240ccd['options'][_0xae12('0x1c')]||null:null,'attributes':_0x240ccd[_0xae12('0x19')]?_0x240ccd[_0xae12('0x19')]['attributes']||null:null,'limit':_0x240ccd[_0xae12('0x19')]?_0x240ccd[_0xae12('0x19')][_0xae12('0x1d')]||null:null})[_0xae12('0xc')](function(_0x34cac1){logger[_0xae12('0x14')](_0xae12('0x1e'),_0x240ccd);logger[_0xae12('0xe')]('UpdateFaxQueueReport',_0x240ccd,JSON[_0xae12('0x1f')](_0x34cac1));_0x1c4a90(_0x34cac1);})[_0xae12('0x16')](function(_0x2b76e7){logger[_0xae12('0x11')]('UpdateFaxQueueReport',_0x2b76e7[_0xae12('0x13')],_0x240ccd);_0x195cd0(_0xd0dfdc[_0xae12('0x11')](0x1f4,_0x2b76e7[_0xae12('0x13')]));});});}; \ No newline at end of file +var _0xde5d=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','FaxQueueReport','update','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird'];(function(_0xa06077,_0x153ab4){var _0x372015=function(_0x496ef1){while(--_0x496ef1){_0xa06077['push'](_0xa06077['shift']());}};_0x372015(++_0x153ab4);}(_0xde5d,0xab));var _0xdde5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xde5d[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xdde5('0x0'));var util=require(_0xdde5('0x1'));var moment=require(_0xdde5('0x2'));var BPromise=require(_0xdde5('0x3'));var rs=require(_0xdde5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdde5('0x5'))['db'];var utils=require(_0xdde5('0x6'));var logger=require(_0xdde5('0x7'))(_0xdde5('0x8'));var config=require(_0xdde5('0x9'));var jayson=require(_0xdde5('0xa'));var client=jayson[_0xdde5('0xb')][_0xdde5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f884c,_0x1964a7,_0x118918){return new BPromise(function(_0xddea48,_0x153516){return client[_0xdde5('0xd')](_0x1f884c,_0x118918)[_0xdde5('0xe')](function(_0x5477e8){logger[_0xdde5('0xf')](_0xdde5('0x10'),_0x1964a7,_0xdde5('0x11'));logger[_0xdde5('0x12')](_0xdde5('0x13'),_0x1964a7,'request\x20sent',JSON[_0xdde5('0x14')](_0x5477e8));if(_0x5477e8['error']){if(_0x5477e8[_0xdde5('0x15')][_0xdde5('0x16')]===0x1f4){logger[_0xdde5('0x15')](_0xdde5('0x10'),_0x1964a7,_0x5477e8[_0xdde5('0x15')][_0xdde5('0x17')]);return _0x153516(_0x5477e8[_0xdde5('0x15')][_0xdde5('0x17')]);}logger[_0xdde5('0x15')](_0xdde5('0x10'),_0x1964a7,_0x5477e8[_0xdde5('0x15')][_0xdde5('0x17')]);return _0xddea48(_0x5477e8[_0xdde5('0x15')]['message']);}else{logger['info'](_0xdde5('0x10'),_0x1964a7,_0xdde5('0x11'));_0xddea48(_0x5477e8[_0xdde5('0x18')]['message']);}})[_0xdde5('0x19')](function(_0x15aa28){logger[_0xdde5('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x1964a7,_0x15aa28);_0x153516(_0x15aa28);});});}exports[_0xdde5('0x1a')]=function(_0x2d11a4){var _0x4f29f1=this;return new Promise(function(_0x526162,_0x2e63d2){return db['FaxQueueReport'][_0xdde5('0x1b')](_0x2d11a4[_0xdde5('0x1c')],{'raw':_0x2d11a4[_0xdde5('0x1d')]?_0x2d11a4[_0xdde5('0x1d')][_0xdde5('0x1e')]===undefined?!![]:![]:!![]})[_0xdde5('0xe')](function(_0x278a01){logger[_0xdde5('0xf')](_0xdde5('0x1a'),_0x2d11a4);logger[_0xdde5('0x12')](_0xdde5('0x1a'),_0x2d11a4,JSON['stringify'](_0x278a01));_0x526162(_0x278a01);})['catch'](function(_0x20a53f){logger[_0xdde5('0x15')](_0xdde5('0x1a'),_0x20a53f['message'],_0x2d11a4);_0x2e63d2(_0x4f29f1[_0xdde5('0x15')](0x1f4,_0x20a53f['message']));});});};exports['UpdateFaxQueueReport']=function(_0x35659e){var _0x14d393=this;return new Promise(function(_0x17b107,_0x36d06c){return db[_0xdde5('0x1f')][_0xdde5('0x20')](_0x35659e[_0xdde5('0x1c')],{'raw':_0x35659e[_0xdde5('0x1d')]?_0x35659e[_0xdde5('0x1d')][_0xdde5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35659e[_0xdde5('0x1d')]?_0x35659e[_0xdde5('0x1d')]['where']||null:null,'attributes':_0x35659e[_0xdde5('0x1d')]?_0x35659e[_0xdde5('0x1d')]['attributes']||null:null,'limit':_0x35659e[_0xdde5('0x1d')]?_0x35659e['options'][_0xdde5('0x21')]||null:null})[_0xdde5('0xe')](function(_0x17d922){logger[_0xdde5('0xf')](_0xdde5('0x22'),_0x35659e);logger[_0xdde5('0x12')]('UpdateFaxQueueReport',_0x35659e,JSON[_0xdde5('0x14')](_0x17d922));_0x17b107(_0x17d922);})[_0xdde5('0x19')](function(_0x525900){logger[_0xdde5('0x15')]('UpdateFaxQueueReport',_0x525900[_0xdde5('0x17')],_0x35659e);_0x36d06c(_0x14d393[_0xdde5('0x15')](0x1f4,_0x525900[_0xdde5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ba6d59e..d02c24e 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 _0xb711=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','util','path','connect-timeout','express','Router'];(function(_0x36368c,_0x464b85){var _0x1b2107=function(_0x11983a){while(--_0x11983a){_0x36368c['push'](_0x36368c['shift']());}};_0x1b2107(++_0x464b85);}(_0xb711,0x163));var _0x1b71=function(_0x57bb9e,_0x1f1570){_0x57bb9e=_0x57bb9e-0x0;var _0x1f6e96=_0xb711[_0x57bb9e];return _0x1f6e96;};'use strict';var multer=require('multer');var util=require(_0x1b71('0x0'));var path=require(_0x1b71('0x1'));var timeout=require(_0x1b71('0x2'));var express=require(_0x1b71('0x3'));var router=express[_0x1b71('0x4')]();var auth=require(_0x1b71('0x5'));var interaction=require(_0x1b71('0x6'));var config=require(_0x1b71('0x7'));var controller=require('./faxQueueReport.controller');router[_0x1b71('0x8')]('/',auth[_0x1b71('0x9')](),controller[_0x1b71('0xa')]);router[_0x1b71('0x8')]('/describe',auth[_0x1b71('0x9')](),controller[_0x1b71('0xb')]);router[_0x1b71('0x8')](_0x1b71('0xc'),auth[_0x1b71('0x9')](),controller[_0x1b71('0xd')]);router[_0x1b71('0xe')]('/',auth[_0x1b71('0x9')](),controller[_0x1b71('0xf')]);router['put'](_0x1b71('0xc'),auth[_0x1b71('0x9')](),controller[_0x1b71('0x10')]);router[_0x1b71('0x11')]('/:id',auth[_0x1b71('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2ecc=['/:id','show','post','create','delete','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe'];(function(_0xb00ea4,_0x1a4159){var _0x494b49=function(_0xafe7c1){while(--_0xafe7c1){_0xb00ea4['push'](_0xb00ea4['shift']());}};_0x494b49(++_0x1a4159);}(_0x2ecc,0x1e7));var _0xc2ec=function(_0x1a89a5,_0x5cb8f2){_0x1a89a5=_0x1a89a5-0x0;var _0x6da6ed=_0x2ecc[_0x1a89a5];return _0x6da6ed;};'use strict';var multer=require(_0xc2ec('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc2ec('0x1'));var router=express['Router']();var auth=require(_0xc2ec('0x2'));var interaction=require(_0xc2ec('0x3'));var config=require(_0xc2ec('0x4'));var controller=require(_0xc2ec('0x5'));router[_0xc2ec('0x6')]('/',auth[_0xc2ec('0x7')](),controller['index']);router[_0xc2ec('0x6')](_0xc2ec('0x8'),auth[_0xc2ec('0x7')](),controller['describe']);router[_0xc2ec('0x6')](_0xc2ec('0x9'),auth['isAuthenticated'](),controller[_0xc2ec('0xa')]);router[_0xc2ec('0xb')]('/',auth['isAuthenticated'](),controller[_0xc2ec('0xc')]);router['put'](_0xc2ec('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc2ec('0xd')](_0xc2ec('0x9'),auth[_0xc2ec('0x7')](),controller[_0xc2ec('0xe')]);module[_0xc2ec('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e4f0a34..22395e1 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 _0x5ba9=['moment','sequelize','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x24b3fd,_0x3d7922){var _0x5bebf4=function(_0x39dfdc){while(--_0x39dfdc){_0x24b3fd['push'](_0x24b3fd['shift']());}};_0x5bebf4(++_0x3d7922);}(_0x5ba9,0x10e));var _0x95ba=function(_0xa6487d,_0x5b7b02){_0xa6487d=_0xa6487d-0x0;var _0x39217c=_0x5ba9[_0xa6487d];return _0x39217c;};'use strict';var moment=require(_0x95ba('0x0'));var Sequelize=require(_0x95ba('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x95ba('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x95ba('0x3')](_0x95ba('0x4'),_0x95ba('0x5'),_0x95ba('0x6')),'allowNull':![],'defaultValue':_0x95ba('0x6')},'transferredAt':{'type':Sequelize[_0x95ba('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x95ba('0x8')]}}; \ No newline at end of file +var _0x2455=['queue','DATE','NOW','exports','STRING','ENUM','agent'];(function(_0x53bd8c,_0x2dc2b7){var _0x5d0155=function(_0x43b6b5){while(--_0x43b6b5){_0x53bd8c['push'](_0x53bd8c['shift']());}};_0x5d0155(++_0x2dc2b7);}(_0x2455,0x1f4));var _0x5245=function(_0x13062b,_0x285d7d){_0x13062b=_0x13062b-0x0;var _0x564586=_0x2455[_0x13062b];return _0x564586;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5245('0x0')]={'uniqueid':{'type':Sequelize[_0x5245('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5245('0x2')]('account',_0x5245('0x3'),_0x5245('0x4')),'allowNull':![],'defaultValue':_0x5245('0x4')},'transferredAt':{'type':Sequelize[_0x5245('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x5245('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7470b41..fc77f46 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 _0x9a14=['options','FaxTransferReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x9a14,0xa8));var _0x49a1=function(_0x27b836,_0x5a16b6){_0x27b836=_0x27b836-0x0;var _0x57879f=_0x9a14[_0x27b836];return _0x57879f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49a1('0x0'));var zipdir=require(_0x49a1('0x1'));var jsonpatch=require(_0x49a1('0x2'));var rp=require(_0x49a1('0x3'));var moment=require(_0x49a1('0x4'));var BPromise=require(_0x49a1('0x5'));var Mustache=require(_0x49a1('0x6'));var util=require(_0x49a1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x49a1('0x8'));var squel=require(_0x49a1('0x9'));var crypto=require(_0x49a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x49a1('0xb'));var toCsv=require(_0x49a1('0xc'));var querystring=require(_0x49a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x49a1('0xe'));var authService=require(_0x49a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x49a1('0x10'));var hardwareService=require(_0x49a1('0x11'));var logger=require(_0x49a1('0x12'))(_0x49a1('0x13'));var utils=require(_0x49a1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x49a1('0x15'));var db=require(_0x49a1('0x16'))['db'];function respondWithStatusCode(_0x380db3,_0x58101a){_0x58101a=_0x58101a||0xcc;return function(_0x20138b){if(_0x20138b){return _0x380db3[_0x49a1('0x17')](_0x58101a);}return _0x380db3[_0x49a1('0x18')](_0x58101a)[_0x49a1('0x19')]();};}function respondWithResult(_0x35f2fd,_0x6bce27){_0x6bce27=_0x6bce27||0xc8;return function(_0x278713){if(_0x278713){return _0x35f2fd[_0x49a1('0x18')](_0x6bce27)[_0x49a1('0x1a')](_0x278713);}};}function respondWithFilteredResult(_0x39676e,_0x13fe24){return function(_0x5c6d06){if(_0x5c6d06){var _0x27dff1=_0x5c6d06[_0x49a1('0x1b')],_0x383bea=_0x13fe24[_0x49a1('0x1c')],_0x20aa5d=_0x13fe24['offset']+_0x13fe24[_0x49a1('0x1d')],_0x479ceb;if(_0x20aa5d>=_0x27dff1){_0x20aa5d=_0x27dff1;_0x479ceb=0xc8;}else{_0x479ceb=0xce;}_0x39676e['status'](_0x479ceb);return _0x39676e[_0x49a1('0x1e')](_0x49a1('0x1f'),_0x383bea+'-'+_0x20aa5d+'/'+_0x27dff1)['json'](_0x5c6d06);}return null;};}function patchUpdates(_0x3997e8){return function(_0x508f32){try{jsonpatch[_0x49a1('0x20')](_0x508f32,_0x3997e8,!![]);}catch(_0x468bac){return BPromise[_0x49a1('0x21')](_0x468bac);}return _0x508f32['save']();};}function saveUpdates(_0x15d7e6,_0x37b66f){return function(_0x37d888){if(_0x37d888){return _0x37d888[_0x49a1('0x22')](_0x15d7e6)[_0x49a1('0x23')](function(_0x115de3){return _0x115de3;});}return null;};}function removeEntity(_0x50aace,_0xe5c860){return function(_0x108d66){if(_0x108d66){return _0x108d66[_0x49a1('0x24')]()['then'](function(){_0x50aace[_0x49a1('0x18')](0xcc)[_0x49a1('0x19')]();});}};}function handleEntityNotFound(_0x28785d,_0x4b4bf3){return function(_0x4d13b7){if(!_0x4d13b7){_0x28785d[_0x49a1('0x17')](0x194);}return _0x4d13b7;};}function handleError(_0x1ed188,_0x2aff51){_0x2aff51=_0x2aff51||0x1f4;return function(_0x38c624){logger[_0x49a1('0x25')](_0x38c624[_0x49a1('0x26')]);if(_0x38c624[_0x49a1('0x27')]){delete _0x38c624['name'];}_0x1ed188[_0x49a1('0x18')](_0x2aff51)[_0x49a1('0x28')](_0x38c624);};}exports[_0x49a1('0x29')]=function(_0x2935d1,_0x20af10){var _0x1e3f21={},_0x3a5aec={},_0x232289={'count':0x0,'rows':[]};var _0x5b3842=_[_0x49a1('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x5de8cb){return{'name':_0x5de8cb[_0x49a1('0x2b')],'type':_0x5de8cb[_0x49a1('0x2c')][_0x49a1('0x2d')]};});_0x3a5aec['model']=_[_0x49a1('0x2a')](_0x5b3842,_0x49a1('0x27'));_0x3a5aec[_0x49a1('0x2e')]=_[_0x49a1('0x2f')](_0x2935d1[_0x49a1('0x2e')]);_0x3a5aec[_0x49a1('0x30')]=_[_0x49a1('0x31')](_0x3a5aec[_0x49a1('0x32')],_0x3a5aec[_0x49a1('0x2e')]);_0x1e3f21[_0x49a1('0x33')]=_[_0x49a1('0x31')](_0x3a5aec[_0x49a1('0x32')],qs[_0x49a1('0x34')](_0x2935d1[_0x49a1('0x2e')][_0x49a1('0x34')]));_0x1e3f21[_0x49a1('0x33')]=_0x1e3f21['attributes'][_0x49a1('0x35')]?_0x1e3f21['attributes']:_0x3a5aec['model'];if(!_0x2935d1[_0x49a1('0x2e')][_0x49a1('0x36')](_0x49a1('0x37'))){_0x1e3f21['limit']=qs[_0x49a1('0x1d')](_0x2935d1[_0x49a1('0x2e')]['limit']);_0x1e3f21['offset']=qs[_0x49a1('0x1c')](_0x2935d1[_0x49a1('0x2e')][_0x49a1('0x1c')]);}_0x1e3f21[_0x49a1('0x38')]=qs[_0x49a1('0x39')](_0x2935d1[_0x49a1('0x2e')][_0x49a1('0x39')]);_0x1e3f21[_0x49a1('0x3a')]=qs[_0x49a1('0x30')](_[_0x49a1('0x3b')](_0x2935d1[_0x49a1('0x2e')],_0x3a5aec[_0x49a1('0x30')]),_0x5b3842);if(_0x2935d1[_0x49a1('0x2e')][_0x49a1('0x3c')]){_0x1e3f21[_0x49a1('0x3a')]=_[_0x49a1('0x3d')](_0x1e3f21['where'],{'$or':_[_0x49a1('0x2a')](_0x5b3842,function(_0x20261f){if(_0x20261f['type']!==_0x49a1('0x3e')){var _0x4d2ed0={};_0x4d2ed0[_0x20261f[_0x49a1('0x27')]]={'$like':'%'+_0x2935d1[_0x49a1('0x2e')]['filter']+'%'};return _0x4d2ed0;}})});}_0x1e3f21=_[_0x49a1('0x3d')]({},_0x1e3f21,_0x2935d1[_0x49a1('0x3f')]);var _0x2dfee7={'where':_0x1e3f21[_0x49a1('0x3a')]};return db[_0x49a1('0x40')][_0x49a1('0x1b')](_0x2dfee7)[_0x49a1('0x23')](function(_0x247469){_0x232289[_0x49a1('0x1b')]=_0x247469;if(_0x2935d1[_0x49a1('0x2e')][_0x49a1('0x41')]){_0x1e3f21[_0x49a1('0x42')]=[{'all':!![]}];}return db[_0x49a1('0x40')][_0x49a1('0x43')](_0x1e3f21);})[_0x49a1('0x23')](function(_0xd0124d){_0x232289[_0x49a1('0x44')]=_0xd0124d;return _0x232289;})[_0x49a1('0x23')](respondWithFilteredResult(_0x20af10,_0x1e3f21))['catch'](handleError(_0x20af10,null));};exports[_0x49a1('0x45')]=function(_0x3f2de1,_0x7aa1bf){var _0xbcf833={'raw':!![],'where':{'id':_0x3f2de1[_0x49a1('0x46')]['id']}},_0x277bbe={};_0x277bbe['model']=_[_0x49a1('0x2f')](db[_0x49a1('0x40')][_0x49a1('0x47')]);_0x277bbe['query']=_[_0x49a1('0x2f')](_0x3f2de1['query']);_0x277bbe['filters']=_[_0x49a1('0x31')](_0x277bbe[_0x49a1('0x32')],_0x277bbe[_0x49a1('0x2e')]);_0xbcf833[_0x49a1('0x33')]=_[_0x49a1('0x31')](_0x277bbe['model'],qs[_0x49a1('0x34')](_0x3f2de1[_0x49a1('0x2e')][_0x49a1('0x34')]));_0xbcf833[_0x49a1('0x33')]=_0xbcf833['attributes']['length']?_0xbcf833[_0x49a1('0x33')]:_0x277bbe[_0x49a1('0x32')];if(_0x3f2de1['query'][_0x49a1('0x41')]){_0xbcf833[_0x49a1('0x42')]=[{'all':!![]}];}_0xbcf833=_['merge']({},_0xbcf833,_0x3f2de1[_0x49a1('0x3f')]);return db[_0x49a1('0x40')][_0x49a1('0x48')](_0xbcf833)[_0x49a1('0x23')](handleEntityNotFound(_0x7aa1bf,null))[_0x49a1('0x23')](respondWithResult(_0x7aa1bf,null))[_0x49a1('0x49')](handleError(_0x7aa1bf,null));};exports['create']=function(_0x35e98e,_0x5537d3){return db[_0x49a1('0x40')][_0x49a1('0x4a')](_0x35e98e[_0x49a1('0x4b')],{})[_0x49a1('0x23')](respondWithResult(_0x5537d3,0xc9))[_0x49a1('0x49')](handleError(_0x5537d3,null));};exports[_0x49a1('0x22')]=function(_0x33e99b,_0x533895){if(_0x33e99b[_0x49a1('0x4b')]['id']){delete _0x33e99b[_0x49a1('0x4b')]['id'];}return db[_0x49a1('0x40')][_0x49a1('0x48')]({'where':{'id':_0x33e99b['params']['id']}})[_0x49a1('0x23')](handleEntityNotFound(_0x533895,null))[_0x49a1('0x23')](saveUpdates(_0x33e99b[_0x49a1('0x4b')],null))[_0x49a1('0x23')](respondWithResult(_0x533895,null))[_0x49a1('0x49')](handleError(_0x533895,null));};exports[_0x49a1('0x24')]=function(_0x3730cd,_0xad997b){return db[_0x49a1('0x40')]['find']({'where':{'id':_0x3730cd[_0x49a1('0x46')]['id']}})[_0x49a1('0x23')](handleEntityNotFound(_0xad997b,null))[_0x49a1('0x23')](removeEntity(_0xad997b,null))[_0x49a1('0x49')](handleError(_0xad997b,null));};exports[_0x49a1('0x4c')]=function(_0x3bda19,_0x3a274c){return db['FaxTransferReport'][_0x49a1('0x4c')]()['then'](respondWithResult(_0x3a274c,null))[_0x49a1('0x49')](handleError(_0x3a274c,null));}; \ No newline at end of file +var _0x61df=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','FaxTransferReport','findAll','rows','catch','show','params','find','create','update','body','describe','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4113bc,_0x182a8e){var _0x17450a=function(_0x4c1e37){while(--_0x4c1e37){_0x4113bc['push'](_0x4113bc['shift']());}};_0x17450a(++_0x182a8e);}(_0x61df,0xbd));var _0xf61d=function(_0x3c3e3f,_0x3bdc20){_0x3c3e3f=_0x3c3e3f-0x0;var _0x2577c0=_0x61df[_0x3c3e3f];return _0x2577c0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf61d('0x0'));var jsonpatch=require(_0xf61d('0x1'));var rp=require('request-promise');var moment=require(_0xf61d('0x2'));var BPromise=require(_0xf61d('0x3'));var Mustache=require('mustache');var util=require(_0xf61d('0x4'));var path=require(_0xf61d('0x5'));var sox=require(_0xf61d('0x6'));var csv=require(_0xf61d('0x7'));var ejs=require(_0xf61d('0x8'));var fs=require('fs');var _=require(_0xf61d('0x9'));var squel=require('squel');var crypto=require(_0xf61d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf61d('0xb'));var toCsv=require(_0xf61d('0x7'));var querystring=require(_0xf61d('0xc'));var Papa=require(_0xf61d('0xd'));var Redis=require(_0xf61d('0xe'));var authService=require(_0xf61d('0xf'));var qs=require(_0xf61d('0x10'));var as=require(_0xf61d('0x11'));var hardwareService=require(_0xf61d('0x12'));var logger=require(_0xf61d('0x13'))(_0xf61d('0x14'));var utils=require(_0xf61d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf61d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5afe1f,_0x373485){_0x373485=_0x373485||0xcc;return function(_0x4dd265){if(_0x4dd265){return _0x5afe1f['sendStatus'](_0x373485);}return _0x5afe1f['status'](_0x373485)[_0xf61d('0x17')]();};}function respondWithResult(_0x4d7606,_0x498e8f){_0x498e8f=_0x498e8f||0xc8;return function(_0x16c514){if(_0x16c514){return _0x4d7606[_0xf61d('0x18')](_0x498e8f)[_0xf61d('0x19')](_0x16c514);}};}function respondWithFilteredResult(_0xf653c,_0x5c9d38){return function(_0x11b1cc){if(_0x11b1cc){var _0x35b91e=_0x11b1cc['count'],_0x2e8c3f=_0x5c9d38[_0xf61d('0x1a')],_0x3c3f7d=_0x5c9d38[_0xf61d('0x1a')]+_0x5c9d38[_0xf61d('0x1b')],_0x51405a;if(_0x3c3f7d>=_0x35b91e){_0x3c3f7d=_0x35b91e;_0x51405a=0xc8;}else{_0x51405a=0xce;}_0xf653c[_0xf61d('0x18')](_0x51405a);return _0xf653c[_0xf61d('0x1c')](_0xf61d('0x1d'),_0x2e8c3f+'-'+_0x3c3f7d+'/'+_0x35b91e)[_0xf61d('0x19')](_0x11b1cc);}return null;};}function patchUpdates(_0x4d0432){return function(_0x4a8430){try{jsonpatch[_0xf61d('0x1e')](_0x4a8430,_0x4d0432,!![]);}catch(_0x28e417){return BPromise[_0xf61d('0x1f')](_0x28e417);}return _0x4a8430[_0xf61d('0x20')]();};}function saveUpdates(_0x1bf1bc,_0x16ebb5){return function(_0x1c0b90){if(_0x1c0b90){return _0x1c0b90['update'](_0x1bf1bc)[_0xf61d('0x21')](function(_0x5e020b){return _0x5e020b;});}return null;};}function removeEntity(_0x3ca02d,_0x41b6c1){return function(_0x4006a0){if(_0x4006a0){return _0x4006a0[_0xf61d('0x22')]()[_0xf61d('0x21')](function(){_0x3ca02d[_0xf61d('0x18')](0xcc)[_0xf61d('0x17')]();});}};}function handleEntityNotFound(_0xcacda8,_0x55a002){return function(_0x59f754){if(!_0x59f754){_0xcacda8['sendStatus'](0x194);}return _0x59f754;};}function handleError(_0x425802,_0x1ebb0f){_0x1ebb0f=_0x1ebb0f||0x1f4;return function(_0x17164a){logger[_0xf61d('0x23')](_0x17164a['stack']);if(_0x17164a[_0xf61d('0x24')]){delete _0x17164a[_0xf61d('0x24')];}_0x425802['status'](_0x1ebb0f)['send'](_0x17164a);};}exports[_0xf61d('0x25')]=function(_0x11bcd1,_0x5b262f){var _0x16cf95={},_0x15e5d1={},_0x4d194d={'count':0x0,'rows':[]};var _0x427dc4=_['map'](db['FaxTransferReport'][_0xf61d('0x26')],function(_0x251846){return{'name':_0x251846['fieldName'],'type':_0x251846[_0xf61d('0x27')]['key']};});_0x15e5d1[_0xf61d('0x28')]=_['map'](_0x427dc4,_0xf61d('0x24'));_0x15e5d1[_0xf61d('0x29')]=_[_0xf61d('0x2a')](_0x11bcd1[_0xf61d('0x29')]);_0x15e5d1['filters']=_[_0xf61d('0x2b')](_0x15e5d1[_0xf61d('0x28')],_0x15e5d1[_0xf61d('0x29')]);_0x16cf95[_0xf61d('0x2c')]=_[_0xf61d('0x2b')](_0x15e5d1[_0xf61d('0x28')],qs[_0xf61d('0x2d')](_0x11bcd1[_0xf61d('0x29')]['fields']));_0x16cf95[_0xf61d('0x2c')]=_0x16cf95[_0xf61d('0x2c')][_0xf61d('0x2e')]?_0x16cf95['attributes']:_0x15e5d1[_0xf61d('0x28')];if(!_0x11bcd1[_0xf61d('0x29')]['hasOwnProperty']('nolimit')){_0x16cf95[_0xf61d('0x1b')]=qs[_0xf61d('0x1b')](_0x11bcd1[_0xf61d('0x29')][_0xf61d('0x1b')]);_0x16cf95[_0xf61d('0x1a')]=qs['offset'](_0x11bcd1[_0xf61d('0x29')][_0xf61d('0x1a')]);}_0x16cf95[_0xf61d('0x2f')]=qs[_0xf61d('0x30')](_0x11bcd1[_0xf61d('0x29')][_0xf61d('0x30')]);_0x16cf95[_0xf61d('0x31')]=qs[_0xf61d('0x32')](_[_0xf61d('0x33')](_0x11bcd1['query'],_0x15e5d1['filters']),_0x427dc4);if(_0x11bcd1[_0xf61d('0x29')][_0xf61d('0x34')]){_0x16cf95[_0xf61d('0x31')]=_[_0xf61d('0x35')](_0x16cf95[_0xf61d('0x31')],{'$or':_[_0xf61d('0x36')](_0x427dc4,function(_0x186f0d){if(_0x186f0d[_0xf61d('0x27')]!==_0xf61d('0x37')){var _0x1a9ed3={};_0x1a9ed3[_0x186f0d[_0xf61d('0x24')]]={'$like':'%'+_0x11bcd1[_0xf61d('0x29')][_0xf61d('0x34')]+'%'};return _0x1a9ed3;}})});}_0x16cf95=_[_0xf61d('0x35')]({},_0x16cf95,_0x11bcd1['options']);var _0x1e9e0a={'where':_0x16cf95[_0xf61d('0x31')]};return db['FaxTransferReport']['count'](_0x1e9e0a)[_0xf61d('0x21')](function(_0x5e0af6){_0x4d194d['count']=_0x5e0af6;if(_0x11bcd1['query'][_0xf61d('0x38')]){_0x16cf95[_0xf61d('0x39')]=[{'all':!![]}];}return db[_0xf61d('0x3a')][_0xf61d('0x3b')](_0x16cf95);})['then'](function(_0x715b46){_0x4d194d[_0xf61d('0x3c')]=_0x715b46;return _0x4d194d;})[_0xf61d('0x21')](respondWithFilteredResult(_0x5b262f,_0x16cf95))[_0xf61d('0x3d')](handleError(_0x5b262f,null));};exports[_0xf61d('0x3e')]=function(_0x32d7bc,_0x5d7d7d){var _0x4548bb={'raw':!![],'where':{'id':_0x32d7bc[_0xf61d('0x3f')]['id']}},_0x2b5a76={};_0x2b5a76[_0xf61d('0x28')]=_['keys'](db[_0xf61d('0x3a')][_0xf61d('0x26')]);_0x2b5a76[_0xf61d('0x29')]=_[_0xf61d('0x2a')](_0x32d7bc['query']);_0x2b5a76[_0xf61d('0x32')]=_[_0xf61d('0x2b')](_0x2b5a76[_0xf61d('0x28')],_0x2b5a76[_0xf61d('0x29')]);_0x4548bb[_0xf61d('0x2c')]=_[_0xf61d('0x2b')](_0x2b5a76['model'],qs[_0xf61d('0x2d')](_0x32d7bc[_0xf61d('0x29')][_0xf61d('0x2d')]));_0x4548bb[_0xf61d('0x2c')]=_0x4548bb[_0xf61d('0x2c')][_0xf61d('0x2e')]?_0x4548bb[_0xf61d('0x2c')]:_0x2b5a76[_0xf61d('0x28')];if(_0x32d7bc[_0xf61d('0x29')]['includeAll']){_0x4548bb['include']=[{'all':!![]}];}_0x4548bb=_[_0xf61d('0x35')]({},_0x4548bb,_0x32d7bc['options']);return db[_0xf61d('0x3a')][_0xf61d('0x40')](_0x4548bb)['then'](handleEntityNotFound(_0x5d7d7d,null))['then'](respondWithResult(_0x5d7d7d,null))[_0xf61d('0x3d')](handleError(_0x5d7d7d,null));};exports[_0xf61d('0x41')]=function(_0x3c0457,_0x3f6def){return db[_0xf61d('0x3a')]['create'](_0x3c0457['body'],{})[_0xf61d('0x21')](respondWithResult(_0x3f6def,0xc9))[_0xf61d('0x3d')](handleError(_0x3f6def,null));};exports[_0xf61d('0x42')]=function(_0x8ab12f,_0x4fce2e){if(_0x8ab12f[_0xf61d('0x43')]['id']){delete _0x8ab12f['body']['id'];}return db[_0xf61d('0x3a')]['find']({'where':{'id':_0x8ab12f[_0xf61d('0x3f')]['id']}})[_0xf61d('0x21')](handleEntityNotFound(_0x4fce2e,null))[_0xf61d('0x21')](saveUpdates(_0x8ab12f['body'],null))[_0xf61d('0x21')](respondWithResult(_0x4fce2e,null))['catch'](handleError(_0x4fce2e,null));};exports['destroy']=function(_0x2444d5,_0x568254){return db[_0xf61d('0x3a')][_0xf61d('0x40')]({'where':{'id':_0x2444d5[_0xf61d('0x3f')]['id']}})[_0xf61d('0x21')](handleEntityNotFound(_0x568254,null))[_0xf61d('0x21')](removeEntity(_0x568254,null))[_0xf61d('0x3d')](handleError(_0x568254,null));};exports['describe']=function(_0x245280,_0x40bd74){return db[_0xf61d('0x3a')][_0xf61d('0x44')]()[_0xf61d('0x21')](respondWithResult(_0x40bd74,null))[_0xf61d('0x3d')](handleError(_0x40bd74,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index cde9472..fa88b70 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 _0xceb9=['uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x5bd6fb,_0x48c31c){var _0x470751=function(_0x23f04b){while(--_0x23f04b){_0x5bd6fb['push'](_0x5bd6fb['shift']());}};_0x470751(++_0x48c31c);}(_0xceb9,0x16d));var _0x9ceb=function(_0x2b8d56,_0x115f11){_0x2b8d56=_0x2b8d56-0x0;var _0x2fd881=_0xceb9[_0x2b8d56];return _0x2fd881;};'use strict';var _=require(_0x9ceb('0x0'));var util=require(_0x9ceb('0x1'));var logger=require(_0x9ceb('0x2'))('api');var moment=require(_0x9ceb('0x3'));var BPromise=require(_0x9ceb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ceb('0x5'));var rimraf=require(_0x9ceb('0x6'));var config=require(_0x9ceb('0x7'));var attributes=require(_0x9ceb('0x8'));module[_0x9ceb('0x9')]=function(_0x3b9c3d,_0x282872){return _0x3b9c3d[_0x9ceb('0xa')](_0x9ceb('0xb'),attributes,{'tableName':_0x9ceb('0xc'),'paranoid':![],'indexes':[{'name':_0x9ceb('0xd'),'fields':[_0x9ceb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe22d=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','lodash'];(function(_0x6d2976,_0x2e27b5){var _0x50031f=function(_0x2c6969){while(--_0x2c6969){_0x6d2976['push'](_0x6d2976['shift']());}};_0x50031f(++_0x2e27b5);}(_0xe22d,0x1bb));var _0xde22=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe22d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xde22('0x0'));var util=require(_0xde22('0x1'));var logger=require(_0xde22('0x2'))(_0xde22('0x3'));var moment=require(_0xde22('0x4'));var BPromise=require(_0xde22('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde22('0x6'));var rimraf=require('rimraf');var config=require(_0xde22('0x7'));var attributes=require(_0xde22('0x8'));module[_0xde22('0x9')]=function(_0x6881b4,_0x129e05){return _0x6881b4[_0xde22('0xa')](_0xde22('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2d24c1c..bd67533 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 _0xb9bc=['rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0xb9bc,0x74));var _0xcb9b=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xb9bc[_0x4fc421];return _0x8c6d63;};'use strict';var _=require(_0xcb9b('0x0'));var util=require(_0xcb9b('0x1'));var moment=require(_0xcb9b('0x2'));var BPromise=require(_0xcb9b('0x3'));var rs=require(_0xcb9b('0x4'));var fs=require('fs');var Redis=require(_0xcb9b('0x5'));var db=require(_0xcb9b('0x6'))['db'];var utils=require(_0xcb9b('0x7'));var logger=require(_0xcb9b('0x8'))(_0xcb9b('0x9'));var config=require(_0xcb9b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcb9b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d6c60,_0x1c8942,_0x888e8e){return new BPromise(function(_0x471225,_0x2c72e1){return client[_0xcb9b('0xc')](_0x3d6c60,_0x888e8e)[_0xcb9b('0xd')](function(_0x54a9c0){logger[_0xcb9b('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x1c8942,_0xcb9b('0xf'));logger[_0xcb9b('0x10')](_0xcb9b('0x11'),_0x1c8942,_0xcb9b('0xf'),JSON[_0xcb9b('0x12')](_0x54a9c0));if(_0x54a9c0[_0xcb9b('0x13')]){if(_0x54a9c0[_0xcb9b('0x13')][_0xcb9b('0x14')]===0x1f4){logger[_0xcb9b('0x13')](_0xcb9b('0x15'),_0x1c8942,_0x54a9c0['error'][_0xcb9b('0x16')]);return _0x2c72e1(_0x54a9c0[_0xcb9b('0x13')]['message']);}logger[_0xcb9b('0x13')](_0xcb9b('0x15'),_0x1c8942,_0x54a9c0['error']['message']);return _0x471225(_0x54a9c0[_0xcb9b('0x13')][_0xcb9b('0x16')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x1c8942,_0xcb9b('0xf'));_0x471225(_0x54a9c0[_0xcb9b('0x17')][_0xcb9b('0x16')]);}})[_0xcb9b('0x18')](function(_0x2723dd){logger[_0xcb9b('0x13')](_0xcb9b('0x15'),_0x1c8942,_0x2723dd);_0x2c72e1(_0x2723dd);});});} \ No newline at end of file +var _0xdf13=['../../config/utils','../../config/environment','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x3f97a7,_0x4732e9){var _0x4cead3=function(_0x4fb68c){while(--_0x4fb68c){_0x3f97a7['push'](_0x3f97a7['shift']());}};_0x4cead3(++_0x4732e9);}(_0xdf13,0xf2));var _0x3df1=function(_0x5f0f2c,_0x9817bf){_0x5f0f2c=_0x5f0f2c-0x0;var _0x104e69=_0xdf13[_0x5f0f2c];return _0x104e69;};'use strict';var _=require(_0x3df1('0x0'));var util=require(_0x3df1('0x1'));var moment=require(_0x3df1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3df1('0x3'));var db=require(_0x3df1('0x4'))['db'];var utils=require(_0x3df1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3df1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3df1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdeb401,_0x37398e,_0x2ed260){return new BPromise(function(_0x33f6dd,_0x57054d){return client[_0x3df1('0x8')](_0xdeb401,_0x2ed260)[_0x3df1('0x9')](function(_0x43b82e){logger[_0x3df1('0xa')](_0x3df1('0xb'),_0x37398e,_0x3df1('0xc'));logger[_0x3df1('0xd')](_0x3df1('0xe'),_0x37398e,_0x3df1('0xc'),JSON['stringify'](_0x43b82e));if(_0x43b82e[_0x3df1('0xf')]){if(_0x43b82e['error'][_0x3df1('0x10')]===0x1f4){logger['error'](_0x3df1('0xb'),_0x37398e,_0x43b82e['error']['message']);return _0x57054d(_0x43b82e[_0x3df1('0xf')][_0x3df1('0x11')]);}logger[_0x3df1('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x37398e,_0x43b82e[_0x3df1('0xf')][_0x3df1('0x11')]);return _0x33f6dd(_0x43b82e['error'][_0x3df1('0x11')]);}else{logger[_0x3df1('0xa')](_0x3df1('0xb'),_0x37398e,_0x3df1('0xc'));_0x33f6dd(_0x43b82e['result'][_0x3df1('0x11')]);}})[_0x3df1('0x12')](function(_0x10721d){logger[_0x3df1('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x37398e,_0x10721d);_0x57054d(_0x10721d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 284f0da..485402e 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 _0x375e=['./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x375e,0x151));var _0xe375=function(_0x2e1307,_0x23a9e1){_0x2e1307=_0x2e1307-0x0;var _0x4afadb=_0x375e[_0x2e1307];return _0x4afadb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe375('0x0'));var express=require(_0xe375('0x1'));var router=express[_0xe375('0x2')]();var auth=require(_0xe375('0x3'));var interaction=require(_0xe375('0x4'));var config=require('../../config/environment');var controller=require(_0xe375('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe375('0x6')](_0xe375('0x7'),auth[_0xe375('0x8')](),controller[_0xe375('0x9')]);router[_0xe375('0x6')](_0xe375('0xa'),auth[_0xe375('0x8')](),controller[_0xe375('0xb')]);router['post']('/',auth[_0xe375('0x8')](),controller[_0xe375('0xc')]);router[_0xe375('0xd')](_0xe375('0xa'),auth[_0xe375('0x8')](),controller[_0xe375('0xe')]);router[_0xe375('0xf')](_0xe375('0xa'),auth['isAuthenticated'](),controller[_0xe375('0x10')]);module[_0xe375('0x11')]=router; \ No newline at end of file +var _0x116f=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x40c120,_0x945e7a){var _0xe9f0d=function(_0x40c637){while(--_0x40c637){_0x40c120['push'](_0x40c120['shift']());}};_0xe9f0d(++_0x945e7a);}(_0x116f,0x141));var _0xf116=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x116f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf116('0x0'));var util=require(_0xf116('0x1'));var path=require(_0xf116('0x2'));var timeout=require('connect-timeout');var express=require(_0xf116('0x3'));var router=express[_0xf116('0x4')]();var auth=require(_0xf116('0x5'));var interaction=require(_0xf116('0x6'));var config=require(_0xf116('0x7'));var controller=require(_0xf116('0x8'));router[_0xf116('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf116('0xa'),auth[_0xf116('0xb')](),controller[_0xf116('0xc')]);router[_0xf116('0x9')](_0xf116('0xd'),auth[_0xf116('0xb')](),controller[_0xf116('0xe')]);router[_0xf116('0xf')]('/',auth[_0xf116('0xb')](),controller[_0xf116('0x10')]);router[_0xf116('0x11')](_0xf116('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xf116('0x12')](_0xf116('0xd'),auth[_0xf116('0xb')](),controller[_0xf116('0x13')]);module[_0xf116('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5bfd568..2608b34 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 _0x0e20=['update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','create','addConfiguration','put'];(function(_0x497c14,_0x56f7bf){var _0x31bb35=function(_0x22f85c){while(--_0x22f85c){_0x497c14['push'](_0x497c14['shift']());}};_0x31bb35(++_0x56f7bf);}(_0x0e20,0x192));var _0x00e2=function(_0x22ae26,_0x4a01d5){_0x22ae26=_0x22ae26-0x0;var _0x2da4b1=_0x0e20[_0x22ae26];return _0x2da4b1;};'use strict';var multer=require(_0x00e2('0x0'));var util=require(_0x00e2('0x1'));var path=require('path');var timeout=require(_0x00e2('0x2'));var express=require(_0x00e2('0x3'));var router=express[_0x00e2('0x4')]();var auth=require(_0x00e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x00e2('0x6'));var controller=require(_0x00e2('0x7'));router['get']('/',auth[_0x00e2('0x8')](),controller['index']);router[_0x00e2('0x9')](_0x00e2('0xa'),auth[_0x00e2('0x8')](),controller['show']);router['get'](_0x00e2('0xb'),auth[_0x00e2('0x8')](),controller[_0x00e2('0xc')]);router[_0x00e2('0x9')]('/:id/fields',auth[_0x00e2('0x8')](),controller['getFields']);router['post']('/',auth[_0x00e2('0x8')](),controller[_0x00e2('0xd')]);router['post'](_0x00e2('0xb'),auth[_0x00e2('0x8')](),controller[_0x00e2('0xe')]);router[_0x00e2('0xf')](_0x00e2('0xa'),auth[_0x00e2('0x8')](),controller[_0x00e2('0x10')]);router[_0x00e2('0x11')]('/:id',auth[_0x00e2('0x8')](),controller['destroy']);module[_0x00e2('0x12')]=router; \ No newline at end of file +var _0xd92d=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','delete','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd92d,0x178));var _0xdd92=function(_0x2344d6,_0x41831b){_0x2344d6=_0x2344d6-0x0;var _0x40bc47=_0xd92d[_0x2344d6];return _0x40bc47;};'use strict';var multer=require(_0xdd92('0x0'));var util=require(_0xdd92('0x1'));var path=require(_0xdd92('0x2'));var timeout=require(_0xdd92('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xdd92('0x4'));var interaction=require(_0xdd92('0x5'));var config=require(_0xdd92('0x6'));var controller=require(_0xdd92('0x7'));router[_0xdd92('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd92('0x9')]);router[_0xdd92('0x8')](_0xdd92('0xa'),auth['isAuthenticated'](),controller[_0xdd92('0xb')]);router['get'](_0xdd92('0xc'),auth[_0xdd92('0xd')](),controller[_0xdd92('0xe')]);router[_0xdd92('0x8')]('/:id/fields',auth[_0xdd92('0xd')](),controller[_0xdd92('0xf')]);router[_0xdd92('0x10')]('/',auth[_0xdd92('0xd')](),controller[_0xdd92('0x11')]);router[_0xdd92('0x10')]('/:id/configurations',auth[_0xdd92('0xd')](),controller[_0xdd92('0x12')]);router['put'](_0xdd92('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdd92('0x13')]('/:id',auth[_0xdd92('0xd')](),controller[_0xdd92('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3fb824d..5d8ef57 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 _0x8109=['integrationTab','sequelize','STRING','ENUM','basic','newTab'];(function(_0xbd767a,_0x1b57b4){var _0x4c11e2=function(_0x547e15){while(--_0x547e15){_0xbd767a['push'](_0xbd767a['shift']());}};_0x4c11e2(++_0x1b57b4);}(_0x8109,0xa9));var _0x9810=function(_0xca8ecc,_0x398626){_0xca8ecc=_0xca8ecc-0x0;var _0x30e976=_0x8109[_0xca8ecc];return _0x30e976;};'use strict';var Sequelize=require(_0x9810('0x0'));module['exports']={'name':{'type':Sequelize[_0x9810('0x1')]},'description':{'type':Sequelize[_0x9810('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9810('0x1')]},'authType':{'type':Sequelize[_0x9810('0x2')](_0x9810('0x3')),'defaultValue':_0x9810('0x3')},'password':{'type':Sequelize[_0x9810('0x1')]},'consumerKey':{'type':Sequelize[_0x9810('0x1')]},'consumerSecret':{'type':Sequelize[_0x9810('0x1')]},'token':{'type':Sequelize[_0x9810('0x1')]},'tokenSecret':{'type':Sequelize[_0x9810('0x1')]},'serverUrl':{'type':Sequelize[_0x9810('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9810('0x2')]('integrationTab',_0x9810('0x4')),'defaultValue':_0x9810('0x5')}}; \ No newline at end of file +var _0x4d5a=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x53174f,_0x986a3b){var _0x1cbd1c=function(_0x5bbcb1){while(--_0x5bbcb1){_0x53174f['push'](_0x53174f['shift']());}};_0x1cbd1c(++_0x986a3b);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4d5a[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xa4d5('0x0')]={'name':{'type':Sequelize[_0xa4d5('0x1')]},'description':{'type':Sequelize[_0xa4d5('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa4d5('0x1')]},'authType':{'type':Sequelize[_0xa4d5('0x2')](_0xa4d5('0x3')),'defaultValue':_0xa4d5('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa4d5('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa4d5('0x1')]},'serverUrl':{'type':Sequelize[_0xa4d5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa4d5('0x2')](_0xa4d5('0x4'),_0xa4d5('0x5')),'defaultValue':_0xa4d5('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 01b0fa9..7e5acf6 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 _0xa339=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','DeskAccount','count','includeAll','length','include','options','find','create','body','params','destroy','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','channel','type','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','password','consumerKey','slice','format','%s/custom_fields','application/json','authType','basic','Authorization','Basic\x20%s','toString','concat','_embedded','label','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','name','send','map','rawAttributes','fieldName','model'];(function(_0x212348,_0x55415c){var _0x1696e9=function(_0x2b87cb){while(--_0x2b87cb){_0x212348['push'](_0x212348['shift']());}};_0x1696e9(++_0x55415c);}(_0xa339,0x113));var _0x9a33=function(_0xc3ee64,_0x12dc6c){_0xc3ee64=_0xc3ee64-0x0;var _0x444707=_0xa339[_0xc3ee64];return _0x444707;};'use strict';var pdf=require(_0x9a33('0x0'));var emlformat=require(_0x9a33('0x1'));var rimraf=require(_0x9a33('0x2'));var zipdir=require(_0x9a33('0x3'));var jsonpatch=require(_0x9a33('0x4'));var rp=require('request-promise');var moment=require(_0x9a33('0x5'));var BPromise=require(_0x9a33('0x6'));var Mustache=require(_0x9a33('0x7'));var util=require('util');var path=require(_0x9a33('0x8'));var sox=require(_0x9a33('0x9'));var csv=require(_0x9a33('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a33('0xb'));var squel=require(_0x9a33('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a33('0xd'));var toCsv=require(_0x9a33('0xa'));var querystring=require('querystring');var Papa=require(_0x9a33('0xe'));var Redis=require(_0x9a33('0xf'));var authService=require(_0x9a33('0x10'));var qs=require(_0x9a33('0x11'));var as=require(_0x9a33('0x12'));var hardwareService=require(_0x9a33('0x13'));var logger=require('../../config/logger')(_0x9a33('0x14'));var utils=require('../../config/utils');var config=require(_0x9a33('0x15'));var licenseUtil=require(_0x9a33('0x16'));var db=require(_0x9a33('0x17'))['db'];var integrations=require(_0x9a33('0x18'));var jayson=require(_0x9a33('0x19'));var client=jayson[_0x9a33('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x569ae6,_0x35cbd6,_0x9e3bfc,_0x349727){return new BPromise(function(_0x155911,_0x563fa4){var _0x31c19d=_0x349727||client;return _0x31c19d['request'](_0x569ae6,_0x9e3bfc)['then'](function(_0x58d369){logger[_0x9a33('0x1b')](_0x9a33('0x1c'),_0x35cbd6,_0x9a33('0x1d'));logger[_0x9a33('0x1e')](_0x9a33('0x1f'),_0x35cbd6,_0x9a33('0x1d'),JSON[_0x9a33('0x20')](_0x58d369));if(_0x58d369[_0x9a33('0x21')]){if(_0x58d369[_0x9a33('0x21')][_0x9a33('0x22')]===0x1f4){logger[_0x9a33('0x21')](_0x9a33('0x1c'),_0x35cbd6,_0x58d369[_0x9a33('0x21')][_0x9a33('0x23')]);return _0x563fa4(_0x58d369[_0x9a33('0x21')]['message']);}logger['error'](_0x9a33('0x1c'),_0x35cbd6,_0x58d369[_0x9a33('0x21')]['message']);return _0x155911(_0x58d369[_0x9a33('0x21')]['message']);}else{logger[_0x9a33('0x1b')](_0x9a33('0x1c'),_0x35cbd6,_0x9a33('0x1d'));_0x155911(_0x58d369['result'][_0x9a33('0x23')]);}})[_0x9a33('0x24')](function(_0x5af2f4){logger[_0x9a33('0x21')](_0x9a33('0x1c'),_0x35cbd6,_0x5af2f4);_0x563fa4(_0x5af2f4);});});}function respondWithStatusCode(_0x71c783,_0x4e9dc3){_0x4e9dc3=_0x4e9dc3||0xcc;return function(_0x3e2f6d){if(_0x3e2f6d){return _0x71c783['sendStatus'](_0x4e9dc3);}return _0x71c783[_0x9a33('0x25')](_0x4e9dc3)[_0x9a33('0x26')]();};}function respondWithResult(_0x31e5a9,_0xb951b){_0xb951b=_0xb951b||0xc8;return function(_0x3408fd){if(_0x3408fd){return _0x31e5a9[_0x9a33('0x25')](_0xb951b)['json'](_0x3408fd);}};}function respondWithFilteredResult(_0x1594f1,_0x437946){return function(_0x31f63b){if(_0x31f63b){var _0x324d6e=_0x31f63b['count'],_0x225758=_0x437946[_0x9a33('0x27')],_0x1bb251=_0x437946[_0x9a33('0x27')]+_0x437946[_0x9a33('0x28')],_0x5d1ff1;if(_0x1bb251>=_0x324d6e){_0x1bb251=_0x324d6e;_0x5d1ff1=0xc8;}else{_0x5d1ff1=0xce;}_0x1594f1['status'](_0x5d1ff1);return _0x1594f1[_0x9a33('0x29')](_0x9a33('0x2a'),_0x225758+'-'+_0x1bb251+'/'+_0x324d6e)[_0x9a33('0x2b')](_0x31f63b);}return null;};}function patchUpdates(_0x547c8e){return function(_0x5a84c4){try{jsonpatch[_0x9a33('0x2c')](_0x5a84c4,_0x547c8e,!![]);}catch(_0x2140f6){return BPromise[_0x9a33('0x2d')](_0x2140f6);}return _0x5a84c4[_0x9a33('0x2e')]();};}function saveUpdates(_0x573c3c,_0x5ceb37){return function(_0x5b70b1){if(_0x5b70b1){return _0x5b70b1[_0x9a33('0x2f')](_0x573c3c)[_0x9a33('0x30')](function(_0x18c6bc){return _0x18c6bc;});}return null;};}function removeEntity(_0x14c11c,_0x4043be){return function(_0x1e7896){if(_0x1e7896){return _0x1e7896['destroy']()[_0x9a33('0x30')](function(){_0x14c11c[_0x9a33('0x25')](0xcc)[_0x9a33('0x26')]();});}};}function handleEntityNotFound(_0x563e2e,_0x13eb90){return function(_0x41d306){if(!_0x41d306){_0x563e2e['sendStatus'](0x194);}return _0x41d306;};}function handleError(_0x2c8c83,_0x28cc81){_0x28cc81=_0x28cc81||0x1f4;return function(_0x13cdfe){logger[_0x9a33('0x21')](_0x13cdfe['stack']);if(_0x13cdfe[_0x9a33('0x31')]){delete _0x13cdfe[_0x9a33('0x31')];}_0x2c8c83['status'](_0x28cc81)[_0x9a33('0x32')](_0x13cdfe);};}exports['index']=function(_0x5a09a1,_0x25a878){var _0x2d6134={},_0x4bb441={},_0x5f452f={'count':0x0,'rows':[]};var _0x2924c8=_[_0x9a33('0x33')](db['DeskAccount'][_0x9a33('0x34')],function(_0x2db147){return{'name':_0x2db147[_0x9a33('0x35')],'type':_0x2db147['type']['key']};});_0x4bb441[_0x9a33('0x36')]=_[_0x9a33('0x33')](_0x2924c8,_0x9a33('0x31'));_0x4bb441[_0x9a33('0x37')]=_[_0x9a33('0x38')](_0x5a09a1[_0x9a33('0x37')]);_0x4bb441[_0x9a33('0x39')]=_[_0x9a33('0x3a')](_0x4bb441[_0x9a33('0x36')],_0x4bb441[_0x9a33('0x37')]);_0x2d6134[_0x9a33('0x3b')]=_['intersection'](_0x4bb441[_0x9a33('0x36')],qs[_0x9a33('0x3c')](_0x5a09a1['query'][_0x9a33('0x3c')]));_0x2d6134['attributes']=_0x2d6134[_0x9a33('0x3b')]['length']?_0x2d6134[_0x9a33('0x3b')]:_0x4bb441[_0x9a33('0x36')];if(!_0x5a09a1['query'][_0x9a33('0x3d')]('nolimit')){_0x2d6134['limit']=qs[_0x9a33('0x28')](_0x5a09a1[_0x9a33('0x37')][_0x9a33('0x28')]);_0x2d6134['offset']=qs[_0x9a33('0x27')](_0x5a09a1[_0x9a33('0x37')][_0x9a33('0x27')]);}_0x2d6134[_0x9a33('0x3e')]=qs[_0x9a33('0x3f')](_0x5a09a1[_0x9a33('0x37')]['sort']);_0x2d6134['where']=qs[_0x9a33('0x39')](_['pick'](_0x5a09a1[_0x9a33('0x37')],_0x4bb441[_0x9a33('0x39')]),_0x2924c8);if(_0x5a09a1['query']['filter']){_0x2d6134[_0x9a33('0x40')]=_['merge'](_0x2d6134[_0x9a33('0x40')],{'$or':_[_0x9a33('0x33')](_0x2924c8,function(_0x546930){if(_0x546930['type']!==_0x9a33('0x41')){var _0x4b74e6={};_0x4b74e6[_0x546930['name']]={'$like':'%'+_0x5a09a1[_0x9a33('0x37')][_0x9a33('0x42')]+'%'};return _0x4b74e6;}})});}_0x2d6134=_[_0x9a33('0x43')]({},_0x2d6134,_0x5a09a1['options']);var _0x43ebac={'where':_0x2d6134[_0x9a33('0x40')]};return db[_0x9a33('0x44')][_0x9a33('0x45')](_0x43ebac)[_0x9a33('0x30')](function(_0xab022c){_0x5f452f[_0x9a33('0x45')]=_0xab022c;if(_0x5a09a1['query'][_0x9a33('0x46')]){_0x2d6134['include']=[{'all':!![]}];}return db[_0x9a33('0x44')]['findAll'](_0x2d6134);})[_0x9a33('0x30')](function(_0xd483c5){_0x5f452f['rows']=_0xd483c5;return _0x5f452f;})[_0x9a33('0x30')](respondWithFilteredResult(_0x25a878,_0x2d6134))['catch'](handleError(_0x25a878,null));};exports['show']=function(_0x104065,_0x420bc8){var _0x30f4b7={'raw':![],'where':{'id':_0x104065['params']['id']}},_0x1dc2d3={};_0x1dc2d3[_0x9a33('0x36')]=_[_0x9a33('0x38')](db[_0x9a33('0x44')][_0x9a33('0x34')]);_0x1dc2d3['query']=_[_0x9a33('0x38')](_0x104065[_0x9a33('0x37')]);_0x1dc2d3[_0x9a33('0x39')]=_['intersection'](_0x1dc2d3[_0x9a33('0x36')],_0x1dc2d3['query']);_0x30f4b7[_0x9a33('0x3b')]=_['intersection'](_0x1dc2d3[_0x9a33('0x36')],qs['fields'](_0x104065[_0x9a33('0x37')][_0x9a33('0x3c')]));_0x30f4b7[_0x9a33('0x3b')]=_0x30f4b7['attributes'][_0x9a33('0x47')]?_0x30f4b7[_0x9a33('0x3b')]:_0x1dc2d3[_0x9a33('0x36')];if(_0x104065['query']['includeAll']){_0x30f4b7[_0x9a33('0x48')]=[{'all':!![]}];}_0x30f4b7=_[_0x9a33('0x43')]({},_0x30f4b7,_0x104065[_0x9a33('0x49')]);return db[_0x9a33('0x44')][_0x9a33('0x4a')](_0x30f4b7)[_0x9a33('0x30')](handleEntityNotFound(_0x420bc8,null))['then'](respondWithResult(_0x420bc8,null))[_0x9a33('0x24')](handleError(_0x420bc8,null));};exports['create']=function(_0x4cdfeb,_0x4d816b){return db[_0x9a33('0x44')][_0x9a33('0x4b')](_0x4cdfeb[_0x9a33('0x4c')],{})['then'](respondWithResult(_0x4d816b,0xc9))[_0x9a33('0x24')](handleError(_0x4d816b,null));};exports[_0x9a33('0x2f')]=function(_0x29a22a,_0x15e5de){if(_0x29a22a[_0x9a33('0x4c')]['id']){delete _0x29a22a[_0x9a33('0x4c')]['id'];}return db[_0x9a33('0x44')][_0x9a33('0x4a')]({'where':{'id':_0x29a22a[_0x9a33('0x4d')]['id']}})[_0x9a33('0x30')](handleEntityNotFound(_0x15e5de,null))['then'](saveUpdates(_0x29a22a[_0x9a33('0x4c')],null))[_0x9a33('0x30')](respondWithResult(_0x15e5de,null))[_0x9a33('0x24')](handleError(_0x15e5de,null));};exports[_0x9a33('0x4e')]=function(_0x43f053,_0x45462e){return db['DeskAccount'][_0x9a33('0x4a')]({'where':{'id':_0x43f053[_0x9a33('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45462e,null))[_0x9a33('0x30')](removeEntity(_0x45462e,null))[_0x9a33('0x24')](handleError(_0x45462e,null));};exports[_0x9a33('0x4f')]=function(_0x313270,_0x476eae,_0x2ebdb3){var _0x2c8561={};var _0x5b7a4d={};var _0x11e0e3;var _0x45f4d1;return db['DeskAccount'][_0x9a33('0x50')]({'where':{'id':_0x313270['params']['id']}})[_0x9a33('0x30')](handleEntityNotFound(_0x476eae,null))['then'](function(_0x11e918){if(_0x11e918){_0x11e0e3=_0x11e918;_0x5b7a4d['model']=_[_0x9a33('0x38')](db['DeskConfiguration'][_0x9a33('0x34')]);_0x5b7a4d[_0x9a33('0x37')]=_[_0x9a33('0x38')](_0x313270[_0x9a33('0x37')]);_0x5b7a4d[_0x9a33('0x39')]=_[_0x9a33('0x3a')](_0x5b7a4d[_0x9a33('0x36')],_0x5b7a4d[_0x9a33('0x37')]);_0x2c8561[_0x9a33('0x3b')]=_[_0x9a33('0x3a')](_0x5b7a4d[_0x9a33('0x36')],qs[_0x9a33('0x3c')](_0x313270[_0x9a33('0x37')][_0x9a33('0x3c')]));_0x2c8561[_0x9a33('0x3b')]=_0x2c8561['attributes'][_0x9a33('0x47')]?_0x2c8561['attributes']:_0x5b7a4d['model'];_0x2c8561[_0x9a33('0x3e')]=qs[_0x9a33('0x3f')](_0x313270[_0x9a33('0x37')]['sort']);_0x2c8561['where']=qs[_0x9a33('0x39')](_['pick'](_0x313270[_0x9a33('0x37')],_0x5b7a4d[_0x9a33('0x39')]));if(_0x313270[_0x9a33('0x37')][_0x9a33('0x42')]){_0x2c8561[_0x9a33('0x40')]=_[_0x9a33('0x43')](_0x2c8561[_0x9a33('0x40')],{'$or':_[_0x9a33('0x33')](_0x2c8561[_0x9a33('0x3b')],function(_0x73a13c){var _0x100391={};_0x100391[_0x73a13c]={'$like':'%'+_0x313270[_0x9a33('0x37')][_0x9a33('0x42')]+'%'};return _0x100391;})});}_0x2c8561=_[_0x9a33('0x43')]({},_0x2c8561,_0x313270[_0x9a33('0x49')]);return _0x11e0e3['getConfigurations'](_0x2c8561);}})['then'](function(_0x5af947){if(_0x5af947){_0x45f4d1=_0x5af947['length'];if(!_0x313270[_0x9a33('0x37')][_0x9a33('0x3d')](_0x9a33('0x51'))){_0x2c8561[_0x9a33('0x28')]=qs[_0x9a33('0x28')](_0x313270[_0x9a33('0x37')]['limit']);_0x2c8561[_0x9a33('0x27')]=qs['offset'](_0x313270[_0x9a33('0x37')][_0x9a33('0x27')]);}return _0x11e0e3[_0x9a33('0x4f')](_0x2c8561);}})['then'](function(_0x4a92cb){if(_0x4a92cb){return _0x4a92cb?{'count':_0x45f4d1,'rows':_0x4a92cb}:null;}})[_0x9a33('0x30')](respondWithResult(_0x476eae,null))[_0x9a33('0x24')](handleError(_0x476eae,null));};exports[_0x9a33('0x52')]=function(_0xf1270f,_0x646a01,_0x43741e){if(_0xf1270f[_0x9a33('0x4c')]['id']){delete _0xf1270f[_0x9a33('0x4c')]['id'];}return db['DeskAccount'][_0x9a33('0x50')]({'where':{'id':_0xf1270f['params']['id']}})[_0x9a33('0x30')](handleEntityNotFound(_0x646a01,null))[_0x9a33('0x30')](function(_0x8abd3d){if(_0x8abd3d){_0xf1270f[_0x9a33('0x4c')][_0x9a33('0x53')]=_0x8abd3d['id'];_0xf1270f[_0x9a33('0x4c')][_0x9a33('0x54')]=integrations['getSubjects'](_0xf1270f[_0x9a33('0x4c')][_0x9a33('0x55')],_0xf1270f[_0x9a33('0x4c')][_0x9a33('0x56')]);_0xf1270f['body']['Descriptions']=integrations[_0x9a33('0x57')](_0xf1270f[_0x9a33('0x4c')]['channel'],_0xf1270f[_0x9a33('0x4c')][_0x9a33('0x56')]);return db[_0x9a33('0x58')][_0x9a33('0x4b')](_0xf1270f['body'],{'include':[{'model':db[_0x9a33('0x59')],'as':_0x9a33('0x54')},{'model':db[_0x9a33('0x59')],'as':'Descriptions'}]});}return null;})[_0x9a33('0x30')](respondWithResult(_0x646a01,null))['catch'](handleError(_0x646a01,null));};exports[_0x9a33('0x5a')]=function(_0x330830,_0x347e71,_0x4f0ce3){var _0x2039a4=[{'name':_0x9a33('0x5b'),'label':_0x9a33('0x5b'),'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 _0x4a8a07='';return db['DeskAccount']['findOne']({'where':{'id':_0x330830[_0x9a33('0x4d')]['id']},'attributes':['id',_0x9a33('0x5c'),'authType','username',_0x9a33('0x5d'),_0x9a33('0x5e'),'consumerSecret','token','tokenSecret']})[_0x9a33('0x30')](handleEntityNotFound(_0x347e71,null))[_0x9a33('0x30')](function(_0x3c9c4a){if(_0x3c9c4a){_0x4a8a07=_0x3c9c4a[_0x9a33('0x5c')];var _0x1af640=_0x4a8a07[_0x9a33('0x5f')](-0x1);if(_0x1af640==='/'){_0x4a8a07=_0x4a8a07['substring'](0x0,_0x4a8a07['lastIndexOf'](_0x1af640));}var _0xce0f84={'method':'GET','uri':util[_0x9a33('0x60')](_0x9a33('0x61'),_0x4a8a07),'headers':{'Content-Type':'application/json','Accept':_0x9a33('0x62')},'json':!![]};if(_0x3c9c4a[_0x9a33('0x63')]===_0x9a33('0x64')){_0xce0f84['headers'][_0x9a33('0x65')]=util['format'](_0x9a33('0x66'),new Buffer(util['format']('%s:%s',_0x3c9c4a['username'],_0x3c9c4a['password']))[_0x9a33('0x67')]('base64'));}return rp(_0xce0f84)[_0x9a33('0x30')](function(_0x5da89a){return _0x2039a4[_0x9a33('0x68')](_[_0x9a33('0x33')](_0x5da89a[_0x9a33('0x69')]['entries'],function(_0x587075){return{'id':_0x587075[_0x9a33('0x31')],'name':_0x587075['name'],'type':_0x587075[_0x9a33('0x56')],'active':_0x587075['active'],'label':_0x587075[_0x9a33('0x6a')],'custom':!![]};}));});}})[_0x9a33('0x30')](function(_0x2ba4d0){return{'count':_0x2ba4d0[_0x9a33('0x47')],'rows':_0x2ba4d0};})['then'](respondWithResult(_0x347e71,null))[_0x9a33('0x24')](function(_0x971c50){var _0x283e6f=_0x330830['query'][_0x9a33('0x6b')]?0x1f4:_0x971c50[_0x9a33('0x6c')]||0x1f4;logger[_0x9a33('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x9a33('0x5a'),_0x283e6f,JSON[_0x9a33('0x20')](_0x971c50));delete _0x971c50[_0x9a33('0x31')];if(_0x283e6f===0x191){_0x283e6f=0x190;}_0x347e71[_0x9a33('0x25')](_0x283e6f)[_0x9a33('0x32')](_0x330830['query']['test']?{'message':_0x9a33('0x6d'),'statusCode':_0x971c50['statusCode']}:_0x971c50);});}; \ No newline at end of file +var _0xb47b=['consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','Authorization','toString','base64','concat','_embedded','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','mustache','util','sox','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../components/integrations/configuration','jayson/promise','http','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskAccount','includeAll','findAll','params','include','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username'];(function(_0x32f47e,_0x5acd97){var _0x1f1e6e=function(_0xd794f6){while(--_0xd794f6){_0x32f47e['push'](_0x32f47e['shift']());}};_0x1f1e6e(++_0x5acd97);}(_0xb47b,0x166));var _0xbb47=function(_0x50f74e,_0x12c5dd){_0x50f74e=_0x50f74e-0x0;var _0x5b16f1=_0xb47b[_0x50f74e];return _0x5b16f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb47('0x0'));var rimraf=require(_0xbb47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb47('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbb47('0x3'));var util=require(_0xbb47('0x4'));var path=require('path');var sox=require(_0xbb47('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbb47('0x6'));var crypto=require(_0xbb47('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xbb47('0x8'));var toCsv=require('to-csv');var querystring=require(_0xbb47('0x9'));var Papa=require(_0xbb47('0xa'));var Redis=require(_0xbb47('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xbb47('0xc'));var as=require(_0xbb47('0xd'));var hardwareService=require(_0xbb47('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbb47('0xf'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xbb47('0x10'));var jayson=require(_0xbb47('0x11'));var client=jayson['client'][_0xbb47('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x509137,_0x3c2421,_0x3d40c1,_0x59a04e){return new BPromise(function(_0x39a267,_0xd97e3d){var _0x7323fa=_0x59a04e||client;return _0x7323fa['request'](_0x509137,_0x3d40c1)[_0xbb47('0x13')](function(_0x1a9ebc){logger[_0xbb47('0x14')]('DeskAccount,\x20%s,\x20%s',_0x3c2421,'request\x20sent');logger[_0xbb47('0x15')](_0xbb47('0x16'),_0x3c2421,_0xbb47('0x17'),JSON[_0xbb47('0x18')](_0x1a9ebc));if(_0x1a9ebc[_0xbb47('0x19')]){if(_0x1a9ebc['error'][_0xbb47('0x1a')]===0x1f4){logger[_0xbb47('0x19')](_0xbb47('0x1b'),_0x3c2421,_0x1a9ebc[_0xbb47('0x19')][_0xbb47('0x1c')]);return _0xd97e3d(_0x1a9ebc[_0xbb47('0x19')][_0xbb47('0x1c')]);}logger[_0xbb47('0x19')](_0xbb47('0x1b'),_0x3c2421,_0x1a9ebc[_0xbb47('0x19')]['message']);return _0x39a267(_0x1a9ebc[_0xbb47('0x19')]['message']);}else{logger[_0xbb47('0x14')](_0xbb47('0x1b'),_0x3c2421,_0xbb47('0x17'));_0x39a267(_0x1a9ebc['result'][_0xbb47('0x1c')]);}})[_0xbb47('0x1d')](function(_0x30e0bc){logger[_0xbb47('0x19')](_0xbb47('0x1b'),_0x3c2421,_0x30e0bc);_0xd97e3d(_0x30e0bc);});});}function respondWithStatusCode(_0x46063b,_0x39e543){_0x39e543=_0x39e543||0xcc;return function(_0x4f55ba){if(_0x4f55ba){return _0x46063b[_0xbb47('0x1e')](_0x39e543);}return _0x46063b[_0xbb47('0x1f')](_0x39e543)[_0xbb47('0x20')]();};}function respondWithResult(_0x58fade,_0x38b291){_0x38b291=_0x38b291||0xc8;return function(_0x38729b){if(_0x38729b){return _0x58fade['status'](_0x38b291)[_0xbb47('0x21')](_0x38729b);}};}function respondWithFilteredResult(_0x5cf206,_0x1406b1){return function(_0x10aa7a){if(_0x10aa7a){var _0x38b416=_0x10aa7a[_0xbb47('0x22')],_0x4b3952=_0x1406b1['offset'],_0x2f8eb6=_0x1406b1['offset']+_0x1406b1[_0xbb47('0x23')],_0x4bef13;if(_0x2f8eb6>=_0x38b416){_0x2f8eb6=_0x38b416;_0x4bef13=0xc8;}else{_0x4bef13=0xce;}_0x5cf206[_0xbb47('0x1f')](_0x4bef13);return _0x5cf206[_0xbb47('0x24')](_0xbb47('0x25'),_0x4b3952+'-'+_0x2f8eb6+'/'+_0x38b416)['json'](_0x10aa7a);}return null;};}function patchUpdates(_0x104c9a){return function(_0x5dcab9){try{jsonpatch[_0xbb47('0x26')](_0x5dcab9,_0x104c9a,!![]);}catch(_0x11210c){return BPromise[_0xbb47('0x27')](_0x11210c);}return _0x5dcab9['save']();};}function saveUpdates(_0x48ebf7,_0x3aff5c){return function(_0x287a8a){if(_0x287a8a){return _0x287a8a[_0xbb47('0x28')](_0x48ebf7)[_0xbb47('0x13')](function(_0x1cf4c0){return _0x1cf4c0;});}return null;};}function removeEntity(_0x2cd06c,_0x279d85){return function(_0x19ff4d){if(_0x19ff4d){return _0x19ff4d['destroy']()[_0xbb47('0x13')](function(){_0x2cd06c[_0xbb47('0x1f')](0xcc)[_0xbb47('0x20')]();});}};}function handleEntityNotFound(_0x2afa1b,_0x4e2116){return function(_0x5d0b82){if(!_0x5d0b82){_0x2afa1b[_0xbb47('0x1e')](0x194);}return _0x5d0b82;};}function handleError(_0x4aaf59,_0x2a4256){_0x2a4256=_0x2a4256||0x1f4;return function(_0x56e3b7){logger[_0xbb47('0x19')](_0x56e3b7[_0xbb47('0x29')]);if(_0x56e3b7[_0xbb47('0x2a')]){delete _0x56e3b7[_0xbb47('0x2a')];}_0x4aaf59[_0xbb47('0x1f')](_0x2a4256)['send'](_0x56e3b7);};}exports[_0xbb47('0x2b')]=function(_0x3c2aa0,_0xe1ef49){var _0x21478a={},_0x402dc6={},_0xc7a89d={'count':0x0,'rows':[]};var _0x81c2df=_['map'](db['DeskAccount'][_0xbb47('0x2c')],function(_0x263eed){return{'name':_0x263eed[_0xbb47('0x2d')],'type':_0x263eed[_0xbb47('0x2e')][_0xbb47('0x2f')]};});_0x402dc6[_0xbb47('0x30')]=_[_0xbb47('0x31')](_0x81c2df,_0xbb47('0x2a'));_0x402dc6[_0xbb47('0x32')]=_[_0xbb47('0x33')](_0x3c2aa0['query']);_0x402dc6[_0xbb47('0x34')]=_[_0xbb47('0x35')](_0x402dc6[_0xbb47('0x30')],_0x402dc6[_0xbb47('0x32')]);_0x21478a[_0xbb47('0x36')]=_[_0xbb47('0x35')](_0x402dc6[_0xbb47('0x30')],qs[_0xbb47('0x37')](_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x37')]));_0x21478a[_0xbb47('0x36')]=_0x21478a[_0xbb47('0x36')][_0xbb47('0x38')]?_0x21478a['attributes']:_0x402dc6[_0xbb47('0x30')];if(!_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x39')](_0xbb47('0x3a'))){_0x21478a[_0xbb47('0x23')]=qs[_0xbb47('0x23')](_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x23')]);_0x21478a[_0xbb47('0x3b')]=qs[_0xbb47('0x3b')](_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x3b')]);}_0x21478a[_0xbb47('0x3c')]=qs[_0xbb47('0x3d')](_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x3d')]);_0x21478a['where']=qs[_0xbb47('0x34')](_[_0xbb47('0x3e')](_0x3c2aa0[_0xbb47('0x32')],_0x402dc6[_0xbb47('0x34')]),_0x81c2df);if(_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x3f')]){_0x21478a[_0xbb47('0x40')]=_[_0xbb47('0x41')](_0x21478a[_0xbb47('0x40')],{'$or':_['map'](_0x81c2df,function(_0x58193d){if(_0x58193d['type']!==_0xbb47('0x42')){var _0x84021f={};_0x84021f[_0x58193d[_0xbb47('0x2a')]]={'$like':'%'+_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x3f')]+'%'};return _0x84021f;}})});}_0x21478a=_[_0xbb47('0x41')]({},_0x21478a,_0x3c2aa0[_0xbb47('0x43')]);var _0x27efc9={'where':_0x21478a[_0xbb47('0x40')]};return db[_0xbb47('0x44')][_0xbb47('0x22')](_0x27efc9)[_0xbb47('0x13')](function(_0x596f7b){_0xc7a89d['count']=_0x596f7b;if(_0x3c2aa0[_0xbb47('0x32')][_0xbb47('0x45')]){_0x21478a['include']=[{'all':!![]}];}return db['DeskAccount'][_0xbb47('0x46')](_0x21478a);})[_0xbb47('0x13')](function(_0x1d6074){_0xc7a89d['rows']=_0x1d6074;return _0xc7a89d;})[_0xbb47('0x13')](respondWithFilteredResult(_0xe1ef49,_0x21478a))['catch'](handleError(_0xe1ef49,null));};exports['show']=function(_0x401165,_0x5e2f65){var _0x33c6fd={'raw':![],'where':{'id':_0x401165[_0xbb47('0x47')]['id']}},_0x12bd5f={};_0x12bd5f[_0xbb47('0x30')]=_[_0xbb47('0x33')](db[_0xbb47('0x44')][_0xbb47('0x2c')]);_0x12bd5f[_0xbb47('0x32')]=_[_0xbb47('0x33')](_0x401165[_0xbb47('0x32')]);_0x12bd5f[_0xbb47('0x34')]=_['intersection'](_0x12bd5f['model'],_0x12bd5f[_0xbb47('0x32')]);_0x33c6fd['attributes']=_[_0xbb47('0x35')](_0x12bd5f[_0xbb47('0x30')],qs[_0xbb47('0x37')](_0x401165[_0xbb47('0x32')][_0xbb47('0x37')]));_0x33c6fd[_0xbb47('0x36')]=_0x33c6fd[_0xbb47('0x36')][_0xbb47('0x38')]?_0x33c6fd['attributes']:_0x12bd5f[_0xbb47('0x30')];if(_0x401165[_0xbb47('0x32')]['includeAll']){_0x33c6fd[_0xbb47('0x48')]=[{'all':!![]}];}_0x33c6fd=_[_0xbb47('0x41')]({},_0x33c6fd,_0x401165[_0xbb47('0x43')]);return db[_0xbb47('0x44')][_0xbb47('0x49')](_0x33c6fd)[_0xbb47('0x13')](handleEntityNotFound(_0x5e2f65,null))['then'](respondWithResult(_0x5e2f65,null))[_0xbb47('0x1d')](handleError(_0x5e2f65,null));};exports[_0xbb47('0x4a')]=function(_0x54e902,_0x1a33ff){return db[_0xbb47('0x44')][_0xbb47('0x4a')](_0x54e902['body'],{})['then'](respondWithResult(_0x1a33ff,0xc9))[_0xbb47('0x1d')](handleError(_0x1a33ff,null));};exports[_0xbb47('0x28')]=function(_0x59cca4,_0x1ec5d5){if(_0x59cca4['body']['id']){delete _0x59cca4[_0xbb47('0x4b')]['id'];}return db[_0xbb47('0x44')]['find']({'where':{'id':_0x59cca4['params']['id']}})[_0xbb47('0x13')](handleEntityNotFound(_0x1ec5d5,null))[_0xbb47('0x13')](saveUpdates(_0x59cca4[_0xbb47('0x4b')],null))['then'](respondWithResult(_0x1ec5d5,null))[_0xbb47('0x1d')](handleError(_0x1ec5d5,null));};exports['destroy']=function(_0x1e2a58,_0x364dd5){return db[_0xbb47('0x44')][_0xbb47('0x49')]({'where':{'id':_0x1e2a58[_0xbb47('0x47')]['id']}})[_0xbb47('0x13')](handleEntityNotFound(_0x364dd5,null))['then'](removeEntity(_0x364dd5,null))[_0xbb47('0x1d')](handleError(_0x364dd5,null));};exports[_0xbb47('0x4c')]=function(_0x5c30b1,_0x42b41d,_0x2ac663){var _0x51b7f2={};var _0x11bf5d={};var _0x5c5fcb;var _0x1e6884;return db['DeskAccount'][_0xbb47('0x4d')]({'where':{'id':_0x5c30b1['params']['id']}})[_0xbb47('0x13')](handleEntityNotFound(_0x42b41d,null))[_0xbb47('0x13')](function(_0x214118){if(_0x214118){_0x5c5fcb=_0x214118;_0x11bf5d[_0xbb47('0x30')]=_[_0xbb47('0x33')](db[_0xbb47('0x4e')][_0xbb47('0x2c')]);_0x11bf5d[_0xbb47('0x32')]=_[_0xbb47('0x33')](_0x5c30b1['query']);_0x11bf5d['filters']=_['intersection'](_0x11bf5d[_0xbb47('0x30')],_0x11bf5d[_0xbb47('0x32')]);_0x51b7f2['attributes']=_[_0xbb47('0x35')](_0x11bf5d[_0xbb47('0x30')],qs[_0xbb47('0x37')](_0x5c30b1[_0xbb47('0x32')][_0xbb47('0x37')]));_0x51b7f2[_0xbb47('0x36')]=_0x51b7f2[_0xbb47('0x36')][_0xbb47('0x38')]?_0x51b7f2[_0xbb47('0x36')]:_0x11bf5d[_0xbb47('0x30')];_0x51b7f2[_0xbb47('0x3c')]=qs[_0xbb47('0x3d')](_0x5c30b1[_0xbb47('0x32')][_0xbb47('0x3d')]);_0x51b7f2[_0xbb47('0x40')]=qs[_0xbb47('0x34')](_[_0xbb47('0x3e')](_0x5c30b1['query'],_0x11bf5d['filters']));if(_0x5c30b1[_0xbb47('0x32')]['filter']){_0x51b7f2['where']=_[_0xbb47('0x41')](_0x51b7f2['where'],{'$or':_['map'](_0x51b7f2[_0xbb47('0x36')],function(_0x1e7d76){var _0x23a369={};_0x23a369[_0x1e7d76]={'$like':'%'+_0x5c30b1[_0xbb47('0x32')][_0xbb47('0x3f')]+'%'};return _0x23a369;})});}_0x51b7f2=_[_0xbb47('0x41')]({},_0x51b7f2,_0x5c30b1['options']);return _0x5c5fcb[_0xbb47('0x4c')](_0x51b7f2);}})[_0xbb47('0x13')](function(_0x473506){if(_0x473506){_0x1e6884=_0x473506[_0xbb47('0x38')];if(!_0x5c30b1[_0xbb47('0x32')]['hasOwnProperty'](_0xbb47('0x3a'))){_0x51b7f2['limit']=qs[_0xbb47('0x23')](_0x5c30b1[_0xbb47('0x32')][_0xbb47('0x23')]);_0x51b7f2[_0xbb47('0x3b')]=qs['offset'](_0x5c30b1[_0xbb47('0x32')]['offset']);}return _0x5c5fcb[_0xbb47('0x4c')](_0x51b7f2);}})[_0xbb47('0x13')](function(_0x57651a){if(_0x57651a){return _0x57651a?{'count':_0x1e6884,'rows':_0x57651a}:null;}})['then'](respondWithResult(_0x42b41d,null))[_0xbb47('0x1d')](handleError(_0x42b41d,null));};exports['addConfiguration']=function(_0x274efa,_0x21aa84,_0x56df77){if(_0x274efa[_0xbb47('0x4b')]['id']){delete _0x274efa[_0xbb47('0x4b')]['id'];}return db[_0xbb47('0x44')]['findOne']({'where':{'id':_0x274efa[_0xbb47('0x47')]['id']}})[_0xbb47('0x13')](handleEntityNotFound(_0x21aa84,null))[_0xbb47('0x13')](function(_0x44049a){if(_0x44049a){_0x274efa[_0xbb47('0x4b')][_0xbb47('0x4f')]=_0x44049a['id'];_0x274efa[_0xbb47('0x4b')][_0xbb47('0x50')]=integrations[_0xbb47('0x51')](_0x274efa[_0xbb47('0x4b')][_0xbb47('0x52')],_0x274efa[_0xbb47('0x4b')][_0xbb47('0x2e')]);_0x274efa[_0xbb47('0x4b')][_0xbb47('0x53')]=integrations[_0xbb47('0x54')](_0x274efa[_0xbb47('0x4b')][_0xbb47('0x52')],_0x274efa[_0xbb47('0x4b')]['type']);return db[_0xbb47('0x4e')][_0xbb47('0x4a')](_0x274efa[_0xbb47('0x4b')],{'include':[{'model':db[_0xbb47('0x55')],'as':_0xbb47('0x50')},{'model':db['DeskField'],'as':_0xbb47('0x53')}]});}return null;})[_0xbb47('0x13')](respondWithResult(_0x21aa84,null))['catch'](handleError(_0x21aa84,null));};exports[_0xbb47('0x56')]=function(_0x374986,_0x2f4b63,_0x420f4c){var _0x54251a=[{'name':_0xbb47('0x57'),'label':_0xbb47('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 _0x4a6e14='';return db[_0xbb47('0x44')]['findOne']({'where':{'id':_0x374986['params']['id']},'attributes':['id',_0xbb47('0x58'),'authType',_0xbb47('0x59'),'password',_0xbb47('0x5a'),'consumerSecret',_0xbb47('0x5b'),_0xbb47('0x5c')]})[_0xbb47('0x13')](handleEntityNotFound(_0x2f4b63,null))[_0xbb47('0x13')](function(_0x34b369){if(_0x34b369){_0x4a6e14=_0x34b369[_0xbb47('0x58')];var _0x26ce7a=_0x4a6e14[_0xbb47('0x5d')](-0x1);if(_0x26ce7a==='/'){_0x4a6e14=_0x4a6e14[_0xbb47('0x5e')](0x0,_0x4a6e14[_0xbb47('0x5f')](_0x26ce7a));}var _0x5d3202={'method':_0xbb47('0x60'),'uri':util[_0xbb47('0x61')](_0xbb47('0x62'),_0x4a6e14),'headers':{'Content-Type':_0xbb47('0x63'),'Accept':_0xbb47('0x63')},'json':!![]};if(_0x34b369[_0xbb47('0x64')]===_0xbb47('0x65')){_0x5d3202['headers'][_0xbb47('0x66')]=util[_0xbb47('0x61')]('Basic\x20%s',new Buffer(util[_0xbb47('0x61')]('%s:%s',_0x34b369['username'],_0x34b369['password']))[_0xbb47('0x67')](_0xbb47('0x68')));}return rp(_0x5d3202)[_0xbb47('0x13')](function(_0x1874dd){return _0x54251a[_0xbb47('0x69')](_['map'](_0x1874dd[_0xbb47('0x6a')]['entries'],function(_0x4f5526){return{'id':_0x4f5526[_0xbb47('0x2a')],'name':_0x4f5526[_0xbb47('0x2a')],'type':_0x4f5526[_0xbb47('0x2e')],'active':_0x4f5526['active'],'label':_0x4f5526[_0xbb47('0x6b')],'custom':!![]};}));});}})['then'](function(_0x4ac26b){return{'count':_0x4ac26b['length'],'rows':_0x4ac26b};})[_0xbb47('0x13')](respondWithResult(_0x2f4b63,null))[_0xbb47('0x1d')](function(_0x4c7c22){var _0x1706a7=_0x374986[_0xbb47('0x32')][_0xbb47('0x6c')]?0x1f4:_0x4c7c22[_0xbb47('0x6d')]||0x1f4;logger[_0xbb47('0x19')](_0xbb47('0x6e'),'getFields',_0x1706a7,JSON['stringify'](_0x4c7c22));delete _0x4c7c22[_0xbb47('0x2a')];if(_0x1706a7===0x191){_0x1706a7=0x190;}_0x2f4b63[_0xbb47('0x1f')](_0x1706a7)['send'](_0x374986[_0xbb47('0x32')][_0xbb47('0x6c')]?{'message':_0xbb47('0x6f'),'statusCode':_0x4c7c22[_0xbb47('0x6d')]}:_0x4c7c22);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7454561..1464bd3 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 _0x0d58=['./intDeskAccount.attributes','../../components/integrations/configuration','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14914a,_0x3eae81){var _0x3766ec=function(_0x2d6c73){while(--_0x2d6c73){_0x14914a['push'](_0x14914a['shift']());}};_0x3766ec(++_0x3eae81);}(_0x0d58,0x6f));var _0x80d5=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x0d58[_0x38537f];return _0x141e23;};'use strict';var _=require(_0x80d5('0x0'));var util=require(_0x80d5('0x1'));var logger=require(_0x80d5('0x2'))(_0x80d5('0x3'));var moment=require(_0x80d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x80d5('0x5'));var fs=require('fs');var path=require(_0x80d5('0x6'));var rimraf=require(_0x80d5('0x7'));var config=require(_0x80d5('0x8'));var attributes=require(_0x80d5('0x9'));var integrations=require(_0x80d5('0xa'));module['exports']=function(_0x3ac7ae,_0x1d8e0c){return _0x3ac7ae['define']('DeskAccount',attributes,{'tableName':_0x80d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28f8=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x413e35,_0x5dfc98){var _0x498fa4=function(_0x5edb89){while(--_0x5edb89){_0x413e35['push'](_0x413e35['shift']());}};_0x498fa4(++_0x5dfc98);}(_0x28f8,0x19d));var _0x828f=function(_0xd553ab,_0x788918){_0xd553ab=_0xd553ab-0x0;var _0x215442=_0x28f8[_0xd553ab];return _0x215442;};'use strict';var _=require(_0x828f('0x0'));var util=require('util');var logger=require(_0x828f('0x1'))(_0x828f('0x2'));var moment=require(_0x828f('0x3'));var BPromise=require(_0x828f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x828f('0x5'));var rimraf=require('rimraf');var config=require(_0x828f('0x6'));var attributes=require(_0x828f('0x7'));var integrations=require(_0x828f('0x8'));module[_0x828f('0x9')]=function(_0x3835f9,_0x52b008){return _0x3835f9[_0x828f('0xa')]('DeskAccount',attributes,{'tableName':_0x828f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 98d855b..06091ba 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 _0x7499=['../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','model','map','ShowDeskAccount','find','util','moment','bluebird','ioredis'];(function(_0x3e8d19,_0x525de9){var _0x237b24=function(_0x4e337a){while(--_0x4e337a){_0x3e8d19['push'](_0x3e8d19['shift']());}};_0x237b24(++_0x525de9);}(_0x7499,0x97));var _0x9749=function(_0x911353,_0x1648ed){_0x911353=_0x911353-0x0;var _0x2f05fa=_0x7499[_0x911353];return _0x2f05fa;};'use strict';var _=require('lodash');var util=require(_0x9749('0x0'));var moment=require(_0x9749('0x1'));var BPromise=require(_0x9749('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9749('0x3'));var db=require(_0x9749('0x4'))['db'];var utils=require(_0x9749('0x5'));var logger=require('../../config/logger')(_0x9749('0x6'));var config=require('../../config/environment');var jayson=require(_0x9749('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x153fa2,_0x3989ef,_0x44a223){return new BPromise(function(_0x32f126,_0x4c633a){return client[_0x9749('0x8')](_0x153fa2,_0x44a223)['then'](function(_0x399787){logger[_0x9749('0x9')](_0x9749('0xa'),_0x3989ef,_0x9749('0xb'));logger[_0x9749('0xc')](_0x9749('0xd'),_0x3989ef,'request\x20sent',JSON[_0x9749('0xe')](_0x399787));if(_0x399787[_0x9749('0xf')]){if(_0x399787[_0x9749('0xf')]['code']===0x1f4){logger[_0x9749('0xf')](_0x9749('0xa'),_0x3989ef,_0x399787['error']['message']);return _0x4c633a(_0x399787['error'][_0x9749('0x10')]);}logger['error'](_0x9749('0xa'),_0x3989ef,_0x399787[_0x9749('0xf')][_0x9749('0x10')]);return _0x32f126(_0x399787[_0x9749('0xf')][_0x9749('0x10')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3989ef,_0x9749('0xb'));_0x32f126(_0x399787[_0x9749('0x11')][_0x9749('0x10')]);}})[_0x9749('0x12')](function(_0x27e0b7){logger[_0x9749('0xf')](_0x9749('0xa'),_0x3989ef,_0x27e0b7);_0x4c633a(_0x27e0b7);});});}exports[_0x9749('0x13')]=function(_0x2d4247){var _0x16660d=this;return new Promise(function(_0x22180b,_0x5e736c){return db[_0x9749('0x14')][_0x9749('0x15')]({'raw':_0x2d4247[_0x9749('0x16')]?_0x2d4247[_0x9749('0x16')][_0x9749('0x17')]===undefined?!![]:![]:!![],'where':_0x2d4247[_0x9749('0x16')]?_0x2d4247[_0x9749('0x16')][_0x9749('0x18')]||null:null,'attributes':_0x2d4247[_0x9749('0x16')]?_0x2d4247[_0x9749('0x16')][_0x9749('0x19')]||null:null,'limit':_0x2d4247[_0x9749('0x16')]?_0x2d4247[_0x9749('0x16')]['limit']||null:null,'include':_0x2d4247['options']?_0x2d4247[_0x9749('0x16')][_0x9749('0x1a')]?_['map'](_0x2d4247[_0x9749('0x16')]['include'],function(_0x1d3463){return{'model':db[_0x1d3463[_0x9749('0x1b')]],'as':_0x1d3463['as'],'attributes':_0x1d3463[_0x9749('0x19')],'include':_0x1d3463['include']?_[_0x9749('0x1c')](_0x1d3463[_0x9749('0x1a')],function(_0x3deb1b){return{'model':db[_0x3deb1b['model']],'as':_0x3deb1b['as'],'attributes':_0x3deb1b['attributes'],'include':_0x3deb1b[_0x9749('0x1a')]?_[_0x9749('0x1c')](_0x3deb1b[_0x9749('0x1a')],function(_0x3d9494){return{'model':db[_0x3d9494[_0x9749('0x1b')]],'as':_0x3d9494['as'],'attributes':_0x3d9494[_0x9749('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b94c2){logger[_0x9749('0x9')](_0x9749('0x13'),_0x2d4247);logger[_0x9749('0xc')]('GetDeskAccount',_0x2d4247,JSON[_0x9749('0xe')](_0x3b94c2));_0x22180b(_0x3b94c2);})['catch'](function(_0x32bb73){logger[_0x9749('0xf')](_0x9749('0x13'),_0x32bb73[_0x9749('0x10')],_0x2d4247);_0x5e736c(_0x16660d['error'](0x1f4,_0x32bb73[_0x9749('0x10')]));});});};exports[_0x9749('0x1d')]=function(_0x32c6d8){var _0x3ba48d=this;return new Promise(function(_0x29f1cb,_0xb773e){return db['DeskAccount'][_0x9749('0x1e')]({'raw':_0x32c6d8[_0x9749('0x16')]?_0x32c6d8[_0x9749('0x16')][_0x9749('0x17')]===undefined?!![]:![]:!![],'where':_0x32c6d8[_0x9749('0x16')]?_0x32c6d8['options']['where']||null:null,'attributes':_0x32c6d8[_0x9749('0x16')]?_0x32c6d8[_0x9749('0x16')][_0x9749('0x19')]||null:null,'include':_0x32c6d8[_0x9749('0x16')]?_0x32c6d8[_0x9749('0x16')][_0x9749('0x1a')]?_[_0x9749('0x1c')](_0x32c6d8[_0x9749('0x16')][_0x9749('0x1a')],function(_0x527ef7){return{'model':db[_0x527ef7['model']],'as':_0x527ef7['as'],'attributes':_0x527ef7['attributes'],'include':_0x527ef7[_0x9749('0x1a')]?_[_0x9749('0x1c')](_0x527ef7[_0x9749('0x1a')],function(_0x10c8da){return{'model':db[_0x10c8da[_0x9749('0x1b')]],'as':_0x10c8da['as'],'attributes':_0x10c8da[_0x9749('0x19')],'include':_0x10c8da['include']?_['map'](_0x10c8da[_0x9749('0x1a')],function(_0x15ba02){return{'model':db[_0x15ba02[_0x9749('0x1b')]],'as':_0x15ba02['as'],'attributes':_0x15ba02[_0x9749('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b240){logger[_0x9749('0x9')]('ShowDeskAccount',_0x32c6d8);logger[_0x9749('0xc')]('ShowDeskAccount',_0x32c6d8,JSON['stringify'](_0x33b240));_0x29f1cb(_0x33b240);})['catch'](function(_0x40e8fb){logger[_0x9749('0xf')](_0x9749('0x1d'),_0x40e8fb[_0x9749('0x10')],_0x32c6d8);_0xb773e(_0x3ba48d[_0x9749('0xf')](0x1f4,_0x40e8fb[_0x9749('0x10')]));});});}; \ No newline at end of file +var _0xdfab=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','model','map','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdfab,0x1d9));var _0xbdfa=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xdfab[_0x369151];return _0x4292d5;};'use strict';var _=require(_0xbdfa('0x0'));var util=require(_0xbdfa('0x1'));var moment=require(_0xbdfa('0x2'));var BPromise=require(_0xbdfa('0x3'));var rs=require(_0xbdfa('0x4'));var fs=require('fs');var Redis=require(_0xbdfa('0x5'));var db=require(_0xbdfa('0x6'))['db'];var utils=require(_0xbdfa('0x7'));var logger=require(_0xbdfa('0x8'))(_0xbdfa('0x9'));var config=require(_0xbdfa('0xa'));var jayson=require(_0xbdfa('0xb'));var client=jayson[_0xbdfa('0xc')][_0xbdfa('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a915c,_0x5d3b87,_0x2536ca){return new BPromise(function(_0x3ef91e,_0x2e0bbf){return client[_0xbdfa('0xe')](_0x1a915c,_0x2536ca)[_0xbdfa('0xf')](function(_0x59051b){logger[_0xbdfa('0x10')](_0xbdfa('0x11'),_0x5d3b87,_0xbdfa('0x12'));logger[_0xbdfa('0x13')](_0xbdfa('0x14'),_0x5d3b87,_0xbdfa('0x12'),JSON[_0xbdfa('0x15')](_0x59051b));if(_0x59051b[_0xbdfa('0x16')]){if(_0x59051b[_0xbdfa('0x16')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x5d3b87,_0x59051b['error'][_0xbdfa('0x17')]);return _0x2e0bbf(_0x59051b[_0xbdfa('0x16')][_0xbdfa('0x17')]);}logger[_0xbdfa('0x16')](_0xbdfa('0x11'),_0x5d3b87,_0x59051b['error'][_0xbdfa('0x17')]);return _0x3ef91e(_0x59051b[_0xbdfa('0x16')][_0xbdfa('0x17')]);}else{logger[_0xbdfa('0x10')]('DeskAccount,\x20%s,\x20%s',_0x5d3b87,'request\x20sent');_0x3ef91e(_0x59051b[_0xbdfa('0x18')][_0xbdfa('0x17')]);}})[_0xbdfa('0x19')](function(_0x5b0082){logger[_0xbdfa('0x16')](_0xbdfa('0x11'),_0x5d3b87,_0x5b0082);_0x2e0bbf(_0x5b0082);});});}exports[_0xbdfa('0x1a')]=function(_0x396fa9){var _0x14ffb7=this;return new Promise(function(_0x94c109,_0x2f0aa8){return db[_0xbdfa('0x1b')][_0xbdfa('0x1c')]({'raw':_0x396fa9[_0xbdfa('0x1d')]?_0x396fa9[_0xbdfa('0x1d')][_0xbdfa('0x1e')]===undefined?!![]:![]:!![],'where':_0x396fa9['options']?_0x396fa9[_0xbdfa('0x1d')][_0xbdfa('0x1f')]||null:null,'attributes':_0x396fa9[_0xbdfa('0x1d')]?_0x396fa9[_0xbdfa('0x1d')][_0xbdfa('0x20')]||null:null,'limit':_0x396fa9[_0xbdfa('0x1d')]?_0x396fa9[_0xbdfa('0x1d')]['limit']||null:null,'include':_0x396fa9[_0xbdfa('0x1d')]?_0x396fa9[_0xbdfa('0x1d')][_0xbdfa('0x21')]?_['map'](_0x396fa9[_0xbdfa('0x1d')]['include'],function(_0x16d1e6){return{'model':db[_0x16d1e6[_0xbdfa('0x22')]],'as':_0x16d1e6['as'],'attributes':_0x16d1e6[_0xbdfa('0x20')],'include':_0x16d1e6[_0xbdfa('0x21')]?_[_0xbdfa('0x23')](_0x16d1e6['include'],function(_0x52dc67){return{'model':db[_0x52dc67[_0xbdfa('0x22')]],'as':_0x52dc67['as'],'attributes':_0x52dc67[_0xbdfa('0x20')],'include':_0x52dc67[_0xbdfa('0x21')]?_[_0xbdfa('0x23')](_0x52dc67['include'],function(_0x4296bd){return{'model':db[_0x4296bd[_0xbdfa('0x22')]],'as':_0x4296bd['as'],'attributes':_0x4296bd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf9575a){logger[_0xbdfa('0x10')](_0xbdfa('0x1a'),_0x396fa9);logger['debug']('GetDeskAccount',_0x396fa9,JSON[_0xbdfa('0x15')](_0xf9575a));_0x94c109(_0xf9575a);})['catch'](function(_0x31dc95){logger['error'](_0xbdfa('0x1a'),_0x31dc95[_0xbdfa('0x17')],_0x396fa9);_0x2f0aa8(_0x14ffb7[_0xbdfa('0x16')](0x1f4,_0x31dc95[_0xbdfa('0x17')]));});});};exports[_0xbdfa('0x24')]=function(_0x27a782){var _0x3c9983=this;return new Promise(function(_0x3b6ebb,_0x11cc11){return db['DeskAccount']['find']({'raw':_0x27a782[_0xbdfa('0x1d')]?_0x27a782[_0xbdfa('0x1d')][_0xbdfa('0x1e')]===undefined?!![]:![]:!![],'where':_0x27a782[_0xbdfa('0x1d')]?_0x27a782['options'][_0xbdfa('0x1f')]||null:null,'attributes':_0x27a782[_0xbdfa('0x1d')]?_0x27a782[_0xbdfa('0x1d')][_0xbdfa('0x20')]||null:null,'include':_0x27a782['options']?_0x27a782[_0xbdfa('0x1d')]['include']?_[_0xbdfa('0x23')](_0x27a782[_0xbdfa('0x1d')][_0xbdfa('0x21')],function(_0x405a3d){return{'model':db[_0x405a3d[_0xbdfa('0x22')]],'as':_0x405a3d['as'],'attributes':_0x405a3d[_0xbdfa('0x20')],'include':_0x405a3d[_0xbdfa('0x21')]?_[_0xbdfa('0x23')](_0x405a3d[_0xbdfa('0x21')],function(_0xe60ba1){return{'model':db[_0xe60ba1['model']],'as':_0xe60ba1['as'],'attributes':_0xe60ba1[_0xbdfa('0x20')],'include':_0xe60ba1['include']?_[_0xbdfa('0x23')](_0xe60ba1[_0xbdfa('0x21')],function(_0x454d49){return{'model':db[_0x454d49[_0xbdfa('0x22')]],'as':_0x454d49['as'],'attributes':_0x454d49['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdfa('0xf')](function(_0x1c0b37){logger['info'](_0xbdfa('0x24'),_0x27a782);logger[_0xbdfa('0x13')](_0xbdfa('0x24'),_0x27a782,JSON[_0xbdfa('0x15')](_0x1c0b37));_0x3b6ebb(_0x1c0b37);})[_0xbdfa('0x19')](function(_0x4bbb1d){logger[_0xbdfa('0x16')]('ShowDeskAccount',_0x4bbb1d[_0xbdfa('0x17')],_0x27a782);_0x11cc11(_0x3c9983[_0xbdfa('0x16')](0x1f4,_0x4bbb1d['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 3ad0477..f493b04 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 _0xd301=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x374ea4,_0x4acee0){var _0x45887c=function(_0x1fafcf){while(--_0x1fafcf){_0x374ea4['push'](_0x374ea4['shift']());}};_0x45887c(++_0x4acee0);}(_0xd301,0x145));var _0x1d30=function(_0x141b55,_0x957882){_0x141b55=_0x141b55-0x0;var _0x375591=_0xd301[_0x141b55];return _0x375591;};'use strict';var multer=require(_0x1d30('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d30('0x1'));var router=express[_0x1d30('0x2')]();var auth=require(_0x1d30('0x3'));var interaction=require(_0x1d30('0x4'));var config=require(_0x1d30('0x5'));var controller=require(_0x1d30('0x6'));router[_0x1d30('0x7')]('/',auth[_0x1d30('0x8')](),controller[_0x1d30('0x9')]);router['get'](_0x1d30('0xa'),auth[_0x1d30('0x8')](),controller[_0x1d30('0xb')]);router['get'](_0x1d30('0xc'),auth[_0x1d30('0x8')](),controller[_0x1d30('0xd')]);router[_0x1d30('0x7')](_0x1d30('0xe'),auth[_0x1d30('0x8')](),controller[_0x1d30('0xf')]);router['get'](_0x1d30('0x10'),auth[_0x1d30('0x8')](),controller[_0x1d30('0x11')]);router['get'](_0x1d30('0x12'),auth[_0x1d30('0x8')](),controller[_0x1d30('0x13')]);router[_0x1d30('0x14')]('/',auth[_0x1d30('0x8')](),controller[_0x1d30('0x15')]);router[_0x1d30('0x14')](_0x1d30('0x12'),auth[_0x1d30('0x8')](),controller[_0x1d30('0x16')]);router[_0x1d30('0x17')](_0x1d30('0xa'),auth[_0x1d30('0x8')](),controller[_0x1d30('0x18')]);router[_0x1d30('0x19')]('/:id',auth[_0x1d30('0x8')](),controller[_0x1d30('0x1a')]);module[_0x1d30('0x1b')]=router; \ No newline at end of file +var _0x1fcc=['post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x45295e,_0x4f07d3){var _0x3e37fe=function(_0x3d8d04){while(--_0x3d8d04){_0x45295e['push'](_0x45295e['shift']());}};_0x3e37fe(++_0x4f07d3);}(_0x1fcc,0x125));var _0xc1fc=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0x1fcc[_0x29d6e6];return _0xc75ff0;};'use strict';var multer=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var path=require('path');var timeout=require(_0xc1fc('0x2'));var express=require(_0xc1fc('0x3'));var router=express[_0xc1fc('0x4')]();var auth=require(_0xc1fc('0x5'));var interaction=require(_0xc1fc('0x6'));var config=require(_0xc1fc('0x7'));var controller=require(_0xc1fc('0x8'));router['get']('/',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0xa')]);router[_0xc1fc('0xb')]('/:id',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0xc')]);router['get'](_0xc1fc('0xd'),auth[_0xc1fc('0x9')](),controller['getFields']);router[_0xc1fc('0xb')]('/:id/subjects',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0xe')]);router['get'](_0xc1fc('0xf'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x10')]);router[_0xc1fc('0xb')](_0xc1fc('0x11'),auth['isAuthenticated'](),controller[_0xc1fc('0x12')]);router[_0xc1fc('0x13')]('/',auth[_0xc1fc('0x9')](),controller['create']);router[_0xc1fc('0x13')](_0xc1fc('0x11'),auth[_0xc1fc('0x9')](),controller['setTags']);router[_0xc1fc('0x14')](_0xc1fc('0x15'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x16')]);router[_0xc1fc('0x17')](_0xc1fc('0x15'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x18')]);module[_0xc1fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4b402fd..3795821 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 _0x807a=['sequelize','STRING'];(function(_0x4dc608,_0x130941){var _0x3a2e73=function(_0x2a2672){while(--_0x2a2672){_0x4dc608['push'](_0x4dc608['shift']());}};_0x3a2e73(++_0x130941);}(_0x807a,0x1da));var _0xa807=function(_0x596752,_0x15996b){_0x596752=_0x596752-0x0;var _0x2592db=_0x807a[_0x596752];return _0x2592db;};'use strict';var Sequelize=require(_0xa807('0x0'));module['exports']={'name':{'type':Sequelize[_0xa807('0x1')]},'description':{'type':Sequelize[_0xa807('0x1')]}}; \ No newline at end of file +var _0xf22e=['sequelize','exports','STRING'];(function(_0x4365a1,_0x54aebc){var _0x33d0ff=function(_0x482470){while(--_0x482470){_0x4365a1['push'](_0x4365a1['shift']());}};_0x33d0ff(++_0x54aebc);}(_0xf22e,0x1d7));var _0xef22=function(_0x7c7c31,_0x35518b){_0x7c7c31=_0x7c7c31-0x0;var _0x3d5105=_0xf22e[_0x7c7c31];return _0x3d5105;};'use strict';var Sequelize=require(_0xef22('0x0'));module[_0xef22('0x1')]={'name':{'type':Sequelize[_0xef22('0x2')]},'description':{'type':Sequelize[_0xef22('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4ddf26e..1620015 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 _0x5ba0=['length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','destroy','getFields','findOne','DeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','save','update','stack','name','send','index','map','type','key','model','query','intersection','attributes','fields'];(function(_0x3758dd,_0x3608b9){var _0x16ba2f=function(_0x2c4d3b){while(--_0x2c4d3b){_0x3758dd['push'](_0x3758dd['shift']());}};_0x16ba2f(++_0x3608b9);}(_0x5ba0,0x7e));var _0x05ba=function(_0x59f744,_0x3aadf8){_0x59f744=_0x59f744-0x0;var _0xe4e0f8=_0x5ba0[_0x59f744];return _0xe4e0f8;};'use strict';var pdf=require(_0x05ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x05ba('0x1'));var zipdir=require(_0x05ba('0x2'));var jsonpatch=require(_0x05ba('0x3'));var rp=require(_0x05ba('0x4'));var moment=require(_0x05ba('0x5'));var BPromise=require(_0x05ba('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x05ba('0x7'));var sox=require(_0x05ba('0x8'));var csv=require(_0x05ba('0x9'));var ejs=require(_0x05ba('0xa'));var fs=require('fs');var _=require(_0x05ba('0xb'));var squel=require('squel');var crypto=require(_0x05ba('0xc'));var jsforce=require(_0x05ba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x05ba('0x9'));var querystring=require(_0x05ba('0xe'));var Papa=require(_0x05ba('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05ba('0x11'));var utils=require(_0x05ba('0x12'));var config=require(_0x05ba('0x13'));var licenseUtil=require(_0x05ba('0x14'));var db=require(_0x05ba('0x15'))['db'];var jayson=require(_0x05ba('0x16'));var client=jayson[_0x05ba('0x17')][_0x05ba('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4e6215,_0x8c2061,_0x26154c,_0x52cff9){return new BPromise(function(_0x5d7b48,_0x8d8dd5){var _0x13dd39=_0x52cff9||client;return _0x13dd39['request'](_0x4e6215,_0x26154c)[_0x05ba('0x19')](function(_0x1bc1a4){logger[_0x05ba('0x1a')](_0x05ba('0x1b'),_0x8c2061,_0x05ba('0x1c'));logger[_0x05ba('0x1d')](_0x05ba('0x1e'),_0x8c2061,_0x05ba('0x1c'),JSON[_0x05ba('0x1f')](_0x1bc1a4));if(_0x1bc1a4[_0x05ba('0x20')]){if(_0x1bc1a4['error'][_0x05ba('0x21')]===0x1f4){logger[_0x05ba('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x8c2061,_0x1bc1a4['error']['message']);return _0x8d8dd5(_0x1bc1a4[_0x05ba('0x20')][_0x05ba('0x22')]);}logger[_0x05ba('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x8c2061,_0x1bc1a4[_0x05ba('0x20')][_0x05ba('0x22')]);return _0x5d7b48(_0x1bc1a4[_0x05ba('0x20')][_0x05ba('0x22')]);}else{logger[_0x05ba('0x1a')](_0x05ba('0x1b'),_0x8c2061,_0x05ba('0x1c'));_0x5d7b48(_0x1bc1a4[_0x05ba('0x23')]['message']);}})[_0x05ba('0x24')](function(_0xa09dfd){logger[_0x05ba('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x8c2061,_0xa09dfd);_0x8d8dd5(_0xa09dfd);});});}function respondWithStatusCode(_0x49f403,_0x347069){_0x347069=_0x347069||0xcc;return function(_0x150d65){if(_0x150d65){return _0x49f403[_0x05ba('0x25')](_0x347069);}return _0x49f403['status'](_0x347069)[_0x05ba('0x26')]();};}function respondWithResult(_0x321b85,_0x9e23ac){_0x9e23ac=_0x9e23ac||0xc8;return function(_0x5caf7e){if(_0x5caf7e){return _0x321b85[_0x05ba('0x27')](_0x9e23ac)[_0x05ba('0x28')](_0x5caf7e);}};}function respondWithFilteredResult(_0x31d9eb,_0x2c3513){return function(_0x144b18){if(_0x144b18){var _0x2c5c53=_0x144b18['count'],_0x20da3b=_0x2c3513[_0x05ba('0x29')],_0x3ec4af=_0x2c3513[_0x05ba('0x29')]+_0x2c3513[_0x05ba('0x2a')],_0x10d0cc;if(_0x3ec4af>=_0x2c5c53){_0x3ec4af=_0x2c5c53;_0x10d0cc=0xc8;}else{_0x10d0cc=0xce;}_0x31d9eb[_0x05ba('0x27')](_0x10d0cc);return _0x31d9eb[_0x05ba('0x2b')]('Content-Range',_0x20da3b+'-'+_0x3ec4af+'/'+_0x2c5c53)[_0x05ba('0x28')](_0x144b18);}return null;};}function patchUpdates(_0x44605f){return function(_0x187248){try{jsonpatch['apply'](_0x187248,_0x44605f,!![]);}catch(_0x3a4e4e){return BPromise['reject'](_0x3a4e4e);}return _0x187248[_0x05ba('0x2c')]();};}function saveUpdates(_0x55b899,_0x97d812){return function(_0x33692c){if(_0x33692c){return _0x33692c[_0x05ba('0x2d')](_0x55b899)['then'](function(_0x3c2add){return _0x3c2add;});}return null;};}function removeEntity(_0x26792f,_0x431537){return function(_0x46aaab){if(_0x46aaab){return _0x46aaab['destroy']()[_0x05ba('0x19')](function(){_0x26792f['status'](0xcc)[_0x05ba('0x26')]();});}};}function handleEntityNotFound(_0xfc1b26,_0x50cff8){return function(_0x5d51cd){if(!_0x5d51cd){_0xfc1b26[_0x05ba('0x25')](0x194);}return _0x5d51cd;};}function handleError(_0x2fda52,_0x5c5dc9){_0x5c5dc9=_0x5c5dc9||0x1f4;return function(_0x53ccb2){logger[_0x05ba('0x20')](_0x53ccb2[_0x05ba('0x2e')]);if(_0x53ccb2[_0x05ba('0x2f')]){delete _0x53ccb2[_0x05ba('0x2f')];}_0x2fda52[_0x05ba('0x27')](_0x5c5dc9)[_0x05ba('0x30')](_0x53ccb2);};}exports[_0x05ba('0x31')]=function(_0x4f82aa,_0xe4e4de){var _0x13d6fb={},_0xa3e635={},_0x484019={'count':0x0,'rows':[]};var _0x502277=_[_0x05ba('0x32')](db['DeskConfiguration']['rawAttributes'],function(_0x2a5bee){return{'name':_0x2a5bee['fieldName'],'type':_0x2a5bee[_0x05ba('0x33')][_0x05ba('0x34')]};});_0xa3e635[_0x05ba('0x35')]=_[_0x05ba('0x32')](_0x502277,_0x05ba('0x2f'));_0xa3e635[_0x05ba('0x36')]=_['keys'](_0x4f82aa[_0x05ba('0x36')]);_0xa3e635['filters']=_[_0x05ba('0x37')](_0xa3e635[_0x05ba('0x35')],_0xa3e635['query']);_0x13d6fb[_0x05ba('0x38')]=_[_0x05ba('0x37')](_0xa3e635[_0x05ba('0x35')],qs[_0x05ba('0x39')](_0x4f82aa[_0x05ba('0x36')][_0x05ba('0x39')]));_0x13d6fb[_0x05ba('0x38')]=_0x13d6fb[_0x05ba('0x38')][_0x05ba('0x3a')]?_0x13d6fb[_0x05ba('0x38')]:_0xa3e635[_0x05ba('0x35')];if(!_0x4f82aa['query']['hasOwnProperty']('nolimit')){_0x13d6fb[_0x05ba('0x2a')]=qs['limit'](_0x4f82aa['query']['limit']);_0x13d6fb['offset']=qs[_0x05ba('0x29')](_0x4f82aa['query']['offset']);}_0x13d6fb[_0x05ba('0x3b')]=qs[_0x05ba('0x3c')](_0x4f82aa[_0x05ba('0x36')][_0x05ba('0x3c')]);_0x13d6fb[_0x05ba('0x3d')]=qs[_0x05ba('0x3e')](_[_0x05ba('0x3f')](_0x4f82aa[_0x05ba('0x36')],_0xa3e635[_0x05ba('0x3e')]),_0x502277);if(_0x4f82aa['query'][_0x05ba('0x40')]){_0x13d6fb[_0x05ba('0x3d')]=_[_0x05ba('0x41')](_0x13d6fb[_0x05ba('0x3d')],{'$or':_[_0x05ba('0x32')](_0x502277,function(_0x35b685){if(_0x35b685[_0x05ba('0x33')]!==_0x05ba('0x42')){var _0x5e6a05={};_0x5e6a05[_0x35b685['name']]={'$like':'%'+_0x4f82aa[_0x05ba('0x36')]['filter']+'%'};return _0x5e6a05;}})});}_0x13d6fb=_[_0x05ba('0x41')]({},_0x13d6fb,_0x4f82aa[_0x05ba('0x43')]);var _0x39c214={'where':_0x13d6fb[_0x05ba('0x3d')]};return db[_0x05ba('0x44')][_0x05ba('0x45')](_0x39c214)[_0x05ba('0x19')](function(_0xe5ba38){_0x484019[_0x05ba('0x45')]=_0xe5ba38;if(_0x4f82aa[_0x05ba('0x36')][_0x05ba('0x46')]){_0x13d6fb[_0x05ba('0x47')]=[{'all':!![]}];}return db[_0x05ba('0x44')]['findAll'](_0x13d6fb);})[_0x05ba('0x19')](function(_0x1ef65f){_0x484019[_0x05ba('0x48')]=_0x1ef65f;return _0x484019;})[_0x05ba('0x19')](respondWithFilteredResult(_0xe4e4de,_0x13d6fb))[_0x05ba('0x24')](handleError(_0xe4e4de,null));};exports[_0x05ba('0x49')]=function(_0x5a39eb,_0x4edb32){var _0x158d5d={'raw':![],'where':{'id':_0x5a39eb[_0x05ba('0x4a')]['id']}},_0x20a89e={};_0x20a89e[_0x05ba('0x35')]=_[_0x05ba('0x4b')](db[_0x05ba('0x44')][_0x05ba('0x4c')]);_0x20a89e['query']=_['keys'](_0x5a39eb['query']);_0x20a89e[_0x05ba('0x3e')]=_[_0x05ba('0x37')](_0x20a89e[_0x05ba('0x35')],_0x20a89e[_0x05ba('0x36')]);_0x158d5d['attributes']=_[_0x05ba('0x37')](_0x20a89e[_0x05ba('0x35')],qs[_0x05ba('0x39')](_0x5a39eb[_0x05ba('0x36')]['fields']));_0x158d5d[_0x05ba('0x38')]=_0x158d5d[_0x05ba('0x38')][_0x05ba('0x3a')]?_0x158d5d['attributes']:_0x20a89e[_0x05ba('0x35')];if(_0x5a39eb[_0x05ba('0x36')][_0x05ba('0x46')]){_0x158d5d['include']=[{'all':!![]}];}_0x158d5d=_[_0x05ba('0x41')]({},_0x158d5d,_0x5a39eb[_0x05ba('0x43')]);return db[_0x05ba('0x44')][_0x05ba('0x4d')](_0x158d5d)[_0x05ba('0x19')](handleEntityNotFound(_0x4edb32,null))[_0x05ba('0x19')](respondWithResult(_0x4edb32,null))['catch'](handleError(_0x4edb32,null));};exports[_0x05ba('0x4e')]=function(_0x5ecbe6,_0x773ef4){return db['DeskConfiguration'][_0x05ba('0x4e')](_0x5ecbe6[_0x05ba('0x4f')],{})['then'](respondWithResult(_0x773ef4,0xc9))['catch'](handleError(_0x773ef4,null));};exports[_0x05ba('0x2d')]=function(_0x57aa53,_0x59f506){if(_0x57aa53[_0x05ba('0x4f')]['id']){delete _0x57aa53['body']['id'];}return db[_0x05ba('0x44')][_0x05ba('0x4d')]({'where':{'id':_0x57aa53['params']['id']}})[_0x05ba('0x19')](handleEntityNotFound(_0x59f506,null))['then'](saveUpdates(_0x57aa53[_0x05ba('0x4f')],null))[_0x05ba('0x19')](respondWithResult(_0x59f506,null))[_0x05ba('0x24')](handleError(_0x59f506,null));};exports[_0x05ba('0x50')]=function(_0x240d02,_0x531843){return db[_0x05ba('0x44')][_0x05ba('0x4d')]({'where':{'id':_0x240d02[_0x05ba('0x4a')]['id']}})[_0x05ba('0x19')](handleEntityNotFound(_0x531843,null))[_0x05ba('0x19')](removeEntity(_0x531843,null))[_0x05ba('0x24')](handleError(_0x531843,null));};exports[_0x05ba('0x51')]=function(_0x5d1fc1,_0x2a2971,_0x15cfe2){var _0x8dfbd3={};var _0x1a4e52={};var _0x1d92a5;var _0x371aa5;return db['DeskConfiguration'][_0x05ba('0x52')]({'where':{'id':_0x5d1fc1[_0x05ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a2971,null))['then'](function(_0x498277){if(_0x498277){_0x1d92a5=_0x498277;_0x1a4e52['model']=_[_0x05ba('0x4b')](db[_0x05ba('0x53')]['rawAttributes']);_0x1a4e52[_0x05ba('0x36')]=_[_0x05ba('0x4b')](_0x5d1fc1['query']);_0x1a4e52['filters']=_['intersection'](_0x1a4e52['model'],_0x1a4e52['query']);_0x8dfbd3[_0x05ba('0x38')]=_['intersection'](_0x1a4e52[_0x05ba('0x35')],qs['fields'](_0x5d1fc1['query']['fields']));_0x8dfbd3[_0x05ba('0x38')]=_0x8dfbd3['attributes'][_0x05ba('0x3a')]?_0x8dfbd3['attributes']:_0x1a4e52['model'];_0x8dfbd3[_0x05ba('0x3b')]=qs[_0x05ba('0x3c')](_0x5d1fc1[_0x05ba('0x36')][_0x05ba('0x3c')]);_0x8dfbd3[_0x05ba('0x3d')]=qs[_0x05ba('0x3e')](_[_0x05ba('0x3f')](_0x5d1fc1[_0x05ba('0x36')],_0x1a4e52[_0x05ba('0x3e')]));if(_0x5d1fc1[_0x05ba('0x36')][_0x05ba('0x40')]){_0x8dfbd3[_0x05ba('0x3d')]=_[_0x05ba('0x41')](_0x8dfbd3['where'],{'$or':_[_0x05ba('0x32')](_0x8dfbd3[_0x05ba('0x38')],function(_0x4ba2b6){var _0x5af635={};_0x5af635[_0x4ba2b6]={'$like':'%'+_0x5d1fc1[_0x05ba('0x36')][_0x05ba('0x40')]+'%'};return _0x5af635;})});}_0x8dfbd3=_[_0x05ba('0x41')]({},_0x8dfbd3,_0x5d1fc1[_0x05ba('0x43')]);return _0x1d92a5['getFields'](_0x8dfbd3);}})[_0x05ba('0x19')](function(_0x1c1825){if(_0x1c1825){_0x371aa5=_0x1c1825[_0x05ba('0x3a')];if(!_0x5d1fc1['query'][_0x05ba('0x54')](_0x05ba('0x55'))){_0x8dfbd3[_0x05ba('0x2a')]=qs[_0x05ba('0x2a')](_0x5d1fc1[_0x05ba('0x36')][_0x05ba('0x2a')]);_0x8dfbd3[_0x05ba('0x29')]=qs[_0x05ba('0x29')](_0x5d1fc1[_0x05ba('0x36')][_0x05ba('0x29')]);}return _0x1d92a5[_0x05ba('0x51')](_0x8dfbd3);}})[_0x05ba('0x19')](function(_0x509edb){if(_0x509edb){return _0x509edb?{'count':_0x371aa5,'rows':_0x509edb}:null;}})[_0x05ba('0x19')](respondWithResult(_0x2a2971,null))[_0x05ba('0x24')](handleError(_0x2a2971,null));};exports[_0x05ba('0x56')]=function(_0x22941c,_0xa12f54,_0xa2767f){var _0x5de361={};var _0x465f3c={};var _0x126f4f;var _0x55c4d8;return db[_0x05ba('0x44')][_0x05ba('0x52')]({'where':{'id':_0x22941c[_0x05ba('0x4a')]['id']}})[_0x05ba('0x19')](handleEntityNotFound(_0xa12f54,null))[_0x05ba('0x19')](function(_0x2f11c9){if(_0x2f11c9){_0x126f4f=_0x2f11c9;_0x465f3c[_0x05ba('0x35')]=_[_0x05ba('0x4b')](db[_0x05ba('0x53')][_0x05ba('0x4c')]);_0x465f3c[_0x05ba('0x36')]=_['keys'](_0x22941c[_0x05ba('0x36')]);_0x465f3c[_0x05ba('0x3e')]=_[_0x05ba('0x37')](_0x465f3c[_0x05ba('0x35')],_0x465f3c[_0x05ba('0x36')]);_0x5de361[_0x05ba('0x38')]=_[_0x05ba('0x37')](_0x465f3c[_0x05ba('0x35')],qs[_0x05ba('0x39')](_0x22941c['query'][_0x05ba('0x39')]));_0x5de361[_0x05ba('0x38')]=_0x5de361[_0x05ba('0x38')][_0x05ba('0x3a')]?_0x5de361[_0x05ba('0x38')]:_0x465f3c[_0x05ba('0x35')];_0x5de361[_0x05ba('0x3b')]=qs[_0x05ba('0x3c')](_0x22941c[_0x05ba('0x36')][_0x05ba('0x3c')]);_0x5de361[_0x05ba('0x3d')]=qs['filters'](_['pick'](_0x22941c['query'],_0x465f3c['filters']));if(_0x22941c['query']['filter']){_0x5de361[_0x05ba('0x3d')]=_[_0x05ba('0x41')](_0x5de361['where'],{'$or':_['map'](_0x5de361[_0x05ba('0x38')],function(_0x55f451){var _0x314697={};_0x314697[_0x55f451]={'$like':'%'+_0x22941c[_0x05ba('0x36')][_0x05ba('0x40')]+'%'};return _0x314697;})});}_0x5de361=_['merge']({},_0x5de361,_0x22941c[_0x05ba('0x43')]);return _0x126f4f['getSubjects'](_0x5de361);}})[_0x05ba('0x19')](function(_0xa6219){if(_0xa6219){_0x55c4d8=_0xa6219[_0x05ba('0x3a')];if(!_0x22941c[_0x05ba('0x36')][_0x05ba('0x54')]('nolimit')){_0x5de361[_0x05ba('0x2a')]=qs[_0x05ba('0x2a')](_0x22941c[_0x05ba('0x36')][_0x05ba('0x2a')]);_0x5de361['offset']=qs['offset'](_0x22941c['query'][_0x05ba('0x29')]);}return _0x126f4f[_0x05ba('0x56')](_0x5de361);}})[_0x05ba('0x19')](function(_0x4e8ee9){if(_0x4e8ee9){return _0x4e8ee9?{'count':_0x55c4d8,'rows':_0x4e8ee9}:null;}})[_0x05ba('0x19')](respondWithResult(_0xa12f54,null))[_0x05ba('0x24')](handleError(_0xa12f54,null));};exports['getDescriptions']=function(_0x4ae077,_0x307845,_0x475898){var _0x597751={};var _0x176197={};var _0x31ef0c;var _0x317b4b;return db[_0x05ba('0x44')][_0x05ba('0x52')]({'where':{'id':_0x4ae077[_0x05ba('0x4a')]['id']}})[_0x05ba('0x19')](handleEntityNotFound(_0x307845,null))['then'](function(_0x46a9fa){if(_0x46a9fa){_0x31ef0c=_0x46a9fa;_0x176197['model']=_[_0x05ba('0x4b')](db['DeskField'][_0x05ba('0x4c')]);_0x176197[_0x05ba('0x36')]=_[_0x05ba('0x4b')](_0x4ae077['query']);_0x176197[_0x05ba('0x3e')]=_[_0x05ba('0x37')](_0x176197[_0x05ba('0x35')],_0x176197[_0x05ba('0x36')]);_0x597751['attributes']=_[_0x05ba('0x37')](_0x176197[_0x05ba('0x35')],qs[_0x05ba('0x39')](_0x4ae077[_0x05ba('0x36')]['fields']));_0x597751[_0x05ba('0x38')]=_0x597751[_0x05ba('0x38')][_0x05ba('0x3a')]?_0x597751[_0x05ba('0x38')]:_0x176197[_0x05ba('0x35')];_0x597751['order']=qs['sort'](_0x4ae077[_0x05ba('0x36')][_0x05ba('0x3c')]);_0x597751[_0x05ba('0x3d')]=qs['filters'](_[_0x05ba('0x3f')](_0x4ae077['query'],_0x176197['filters']));if(_0x4ae077[_0x05ba('0x36')][_0x05ba('0x40')]){_0x597751[_0x05ba('0x3d')]=_[_0x05ba('0x41')](_0x597751[_0x05ba('0x3d')],{'$or':_[_0x05ba('0x32')](_0x597751[_0x05ba('0x38')],function(_0x580db0){var _0x199faa={};_0x199faa[_0x580db0]={'$like':'%'+_0x4ae077['query'][_0x05ba('0x40')]+'%'};return _0x199faa;})});}_0x597751=_[_0x05ba('0x41')]({},_0x597751,_0x4ae077['options']);return _0x31ef0c['getDescriptions'](_0x597751);}})[_0x05ba('0x19')](function(_0x46cc12){if(_0x46cc12){_0x317b4b=_0x46cc12[_0x05ba('0x3a')];if(!_0x4ae077[_0x05ba('0x36')]['hasOwnProperty']('nolimit')){_0x597751['limit']=qs[_0x05ba('0x2a')](_0x4ae077[_0x05ba('0x36')]['limit']);_0x597751[_0x05ba('0x29')]=qs[_0x05ba('0x29')](_0x4ae077[_0x05ba('0x36')][_0x05ba('0x29')]);}return _0x31ef0c[_0x05ba('0x57')](_0x597751);}})[_0x05ba('0x19')](function(_0x2e9f68){if(_0x2e9f68){return _0x2e9f68?{'count':_0x317b4b,'rows':_0x2e9f68}:null;}})['then'](respondWithResult(_0x307845,null))['catch'](handleError(_0x307845,null));};exports[_0x05ba('0x58')]=function(_0x34b386,_0x1d6227,_0x23d8a3){var _0x2a35dc={};var _0x55edf2={};var _0x3b003f;var _0x282f71;return db[_0x05ba('0x44')][_0x05ba('0x52')]({'where':{'id':_0x34b386[_0x05ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d6227,null))[_0x05ba('0x19')](function(_0x4ee4a9){if(_0x4ee4a9){_0x3b003f=_0x4ee4a9;_0x55edf2[_0x05ba('0x35')]=_['keys'](db[_0x05ba('0x59')][_0x05ba('0x4c')]);_0x55edf2[_0x05ba('0x36')]=_[_0x05ba('0x4b')](_0x34b386[_0x05ba('0x36')]);_0x55edf2[_0x05ba('0x3e')]=_[_0x05ba('0x37')](_0x55edf2['model'],_0x55edf2['query']);_0x2a35dc[_0x05ba('0x38')]=_[_0x05ba('0x37')](_0x55edf2[_0x05ba('0x35')],qs['fields'](_0x34b386['query'][_0x05ba('0x39')]));_0x2a35dc['attributes']=_0x2a35dc['attributes'][_0x05ba('0x3a')]?_0x2a35dc['attributes']:_0x55edf2[_0x05ba('0x35')];_0x2a35dc[_0x05ba('0x3b')]=qs[_0x05ba('0x3c')](_0x34b386[_0x05ba('0x36')][_0x05ba('0x3c')]);_0x2a35dc['where']=qs[_0x05ba('0x3e')](_[_0x05ba('0x3f')](_0x34b386['query'],_0x55edf2[_0x05ba('0x3e')]));if(_0x34b386[_0x05ba('0x36')]['filter']){_0x2a35dc['where']=_['merge'](_0x2a35dc[_0x05ba('0x3d')],{'$or':_['map'](_0x2a35dc[_0x05ba('0x38')],function(_0x59bdaf){var _0x6224c2={};_0x6224c2[_0x59bdaf]={'$like':'%'+_0x34b386[_0x05ba('0x36')]['filter']+'%'};return _0x6224c2;})});}_0x2a35dc=_[_0x05ba('0x41')]({},_0x2a35dc,_0x34b386['options']);return _0x3b003f['getTags'](_0x2a35dc);}})[_0x05ba('0x19')](function(_0x4f34b5){if(_0x4f34b5){_0x282f71=_0x4f34b5[_0x05ba('0x3a')];if(!_0x34b386[_0x05ba('0x36')][_0x05ba('0x54')](_0x05ba('0x55'))){_0x2a35dc[_0x05ba('0x2a')]=qs[_0x05ba('0x2a')](_0x34b386[_0x05ba('0x36')][_0x05ba('0x2a')]);_0x2a35dc['offset']=qs[_0x05ba('0x29')](_0x34b386[_0x05ba('0x36')][_0x05ba('0x29')]);}return _0x3b003f[_0x05ba('0x58')](_0x2a35dc);}})[_0x05ba('0x19')](function(_0x5edfd5){if(_0x5edfd5){return _0x5edfd5?{'count':_0x282f71,'rows':_0x5edfd5}:null;}})[_0x05ba('0x19')](respondWithResult(_0x1d6227,null))[_0x05ba('0x24')](handleError(_0x1d6227,null));};exports[_0x05ba('0x5a')]=function(_0x6197fd,_0x5dc9b3,_0x53291f){if(_0x6197fd[_0x05ba('0x4f')]['id']){delete _0x6197fd['body']['id'];}return db[_0x05ba('0x44')]['findOne']({'where':{'id':_0x6197fd[_0x05ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5dc9b3,null))[_0x05ba('0x19')](function(_0x3baf1e){if(_0x3baf1e){return _0x3baf1e[_0x05ba('0x5a')](_0x6197fd[_0x05ba('0x4f')][_0x05ba('0x5b')]||[]);}return null;})[_0x05ba('0x19')](respondWithResult(_0x5dc9b3,null))['catch'](handleError(_0x5dc9b3,null));}; \ No newline at end of file +var _0xb2c5=['options','includeAll','findAll','show','rawAttributes','intersection','find','create','body','params','findOne','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','destroy','then','name','send','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge'];(function(_0x6a42f8,_0x1c0552){var _0x1f07ee=function(_0x4371a7){while(--_0x4371a7){_0x6a42f8['push'](_0x6a42f8['shift']());}};_0x1f07ee(++_0x1c0552);}(_0xb2c5,0x18e));var _0x5b2c=function(_0x3b95e2,_0x3d2dfb){_0x3b95e2=_0x3b95e2-0x0;var _0x1191c4=_0xb2c5[_0x3b95e2];return _0x1191c4;};'use strict';var pdf=require(_0x5b2c('0x0'));var emlformat=require(_0x5b2c('0x1'));var rimraf=require(_0x5b2c('0x2'));var zipdir=require(_0x5b2c('0x3'));var jsonpatch=require(_0x5b2c('0x4'));var rp=require(_0x5b2c('0x5'));var moment=require(_0x5b2c('0x6'));var BPromise=require(_0x5b2c('0x7'));var Mustache=require(_0x5b2c('0x8'));var util=require(_0x5b2c('0x9'));var path=require(_0x5b2c('0xa'));var sox=require(_0x5b2c('0xb'));var csv=require('to-csv');var ejs=require(_0x5b2c('0xc'));var fs=require('fs');var _=require(_0x5b2c('0xd'));var squel=require(_0x5b2c('0xe'));var crypto=require(_0x5b2c('0xf'));var jsforce=require(_0x5b2c('0x10'));var deskjs=require(_0x5b2c('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5b2c('0x12'));var Papa=require('papaparse');var Redis=require(_0x5b2c('0x13'));var authService=require(_0x5b2c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5b2c('0x15'));var hardwareService=require(_0x5b2c('0x16'));var logger=require('../../config/logger')(_0x5b2c('0x17'));var utils=require(_0x5b2c('0x18'));var config=require(_0x5b2c('0x19'));var licenseUtil=require(_0x5b2c('0x1a'));var db=require(_0x5b2c('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5b2c('0x1c')][_0x5b2c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xaae0a2,_0x3e679a,_0x298245,_0x5b92fa){return new BPromise(function(_0x2345ab,_0x95b47a){var _0x4e1291=_0x5b92fa||client;return _0x4e1291[_0x5b2c('0x1e')](_0xaae0a2,_0x298245)['then'](function(_0x19c186){logger[_0x5b2c('0x1f')](_0x5b2c('0x20'),_0x3e679a,_0x5b2c('0x21'));logger[_0x5b2c('0x22')](_0x5b2c('0x23'),_0x3e679a,_0x5b2c('0x21'),JSON['stringify'](_0x19c186));if(_0x19c186[_0x5b2c('0x24')]){if(_0x19c186[_0x5b2c('0x24')][_0x5b2c('0x25')]===0x1f4){logger['error'](_0x5b2c('0x20'),_0x3e679a,_0x19c186[_0x5b2c('0x24')][_0x5b2c('0x26')]);return _0x95b47a(_0x19c186[_0x5b2c('0x24')][_0x5b2c('0x26')]);}logger['error'](_0x5b2c('0x20'),_0x3e679a,_0x19c186[_0x5b2c('0x24')][_0x5b2c('0x26')]);return _0x2345ab(_0x19c186[_0x5b2c('0x24')]['message']);}else{logger[_0x5b2c('0x1f')](_0x5b2c('0x20'),_0x3e679a,'request\x20sent');_0x2345ab(_0x19c186[_0x5b2c('0x27')]['message']);}})[_0x5b2c('0x28')](function(_0x291944){logger[_0x5b2c('0x24')](_0x5b2c('0x20'),_0x3e679a,_0x291944);_0x95b47a(_0x291944);});});}function respondWithStatusCode(_0x1988dd,_0x54db29){_0x54db29=_0x54db29||0xcc;return function(_0x2ef05f){if(_0x2ef05f){return _0x1988dd[_0x5b2c('0x29')](_0x54db29);}return _0x1988dd[_0x5b2c('0x2a')](_0x54db29)[_0x5b2c('0x2b')]();};}function respondWithResult(_0x16ce84,_0x80560){_0x80560=_0x80560||0xc8;return function(_0x2b8beb){if(_0x2b8beb){return _0x16ce84['status'](_0x80560)[_0x5b2c('0x2c')](_0x2b8beb);}};}function respondWithFilteredResult(_0x4d3dd7,_0x4d547f){return function(_0x29672b){if(_0x29672b){var _0x5203e4=_0x29672b[_0x5b2c('0x2d')],_0x390eee=_0x4d547f['offset'],_0x1e3940=_0x4d547f['offset']+_0x4d547f[_0x5b2c('0x2e')],_0x2decdb;if(_0x1e3940>=_0x5203e4){_0x1e3940=_0x5203e4;_0x2decdb=0xc8;}else{_0x2decdb=0xce;}_0x4d3dd7['status'](_0x2decdb);return _0x4d3dd7[_0x5b2c('0x2f')](_0x5b2c('0x30'),_0x390eee+'-'+_0x1e3940+'/'+_0x5203e4)[_0x5b2c('0x2c')](_0x29672b);}return null;};}function patchUpdates(_0x1440af){return function(_0x47aefa){try{jsonpatch[_0x5b2c('0x31')](_0x47aefa,_0x1440af,!![]);}catch(_0x5a73fa){return BPromise[_0x5b2c('0x32')](_0x5a73fa);}return _0x47aefa['save']();};}function saveUpdates(_0x255048,_0x3d3ff1){return function(_0x52b616){if(_0x52b616){return _0x52b616[_0x5b2c('0x33')](_0x255048)['then'](function(_0x50ecb4){return _0x50ecb4;});}return null;};}function removeEntity(_0x2b1a37,_0x33a60b){return function(_0xa2238d){if(_0xa2238d){return _0xa2238d[_0x5b2c('0x34')]()[_0x5b2c('0x35')](function(){_0x2b1a37['status'](0xcc)[_0x5b2c('0x2b')]();});}};}function handleEntityNotFound(_0x59c87f,_0x50e04c){return function(_0x7fd10){if(!_0x7fd10){_0x59c87f[_0x5b2c('0x29')](0x194);}return _0x7fd10;};}function handleError(_0x4dec9e,_0x152800){_0x152800=_0x152800||0x1f4;return function(_0x3ec72c){logger['error'](_0x3ec72c['stack']);if(_0x3ec72c[_0x5b2c('0x36')]){delete _0x3ec72c[_0x5b2c('0x36')];}_0x4dec9e[_0x5b2c('0x2a')](_0x152800)[_0x5b2c('0x37')](_0x3ec72c);};}exports['index']=function(_0x380782,_0x430b6a){var _0x54eeb4={},_0x1d127a={},_0x54690e={'count':0x0,'rows':[]};var _0x7a37c6=_[_0x5b2c('0x38')](db[_0x5b2c('0x39')]['rawAttributes'],function(_0x39401c){return{'name':_0x39401c[_0x5b2c('0x3a')],'type':_0x39401c[_0x5b2c('0x3b')][_0x5b2c('0x3c')]};});_0x1d127a[_0x5b2c('0x3d')]=_[_0x5b2c('0x38')](_0x7a37c6,_0x5b2c('0x36'));_0x1d127a[_0x5b2c('0x3e')]=_[_0x5b2c('0x3f')](_0x380782[_0x5b2c('0x3e')]);_0x1d127a[_0x5b2c('0x40')]=_['intersection'](_0x1d127a[_0x5b2c('0x3d')],_0x1d127a[_0x5b2c('0x3e')]);_0x54eeb4['attributes']=_['intersection'](_0x1d127a[_0x5b2c('0x3d')],qs[_0x5b2c('0x41')](_0x380782[_0x5b2c('0x3e')]['fields']));_0x54eeb4[_0x5b2c('0x42')]=_0x54eeb4['attributes'][_0x5b2c('0x43')]?_0x54eeb4['attributes']:_0x1d127a[_0x5b2c('0x3d')];if(!_0x380782[_0x5b2c('0x3e')][_0x5b2c('0x44')](_0x5b2c('0x45'))){_0x54eeb4[_0x5b2c('0x2e')]=qs[_0x5b2c('0x2e')](_0x380782[_0x5b2c('0x3e')][_0x5b2c('0x2e')]);_0x54eeb4[_0x5b2c('0x46')]=qs[_0x5b2c('0x46')](_0x380782['query']['offset']);}_0x54eeb4[_0x5b2c('0x47')]=qs[_0x5b2c('0x48')](_0x380782[_0x5b2c('0x3e')]['sort']);_0x54eeb4[_0x5b2c('0x49')]=qs['filters'](_[_0x5b2c('0x4a')](_0x380782[_0x5b2c('0x3e')],_0x1d127a[_0x5b2c('0x40')]),_0x7a37c6);if(_0x380782['query'][_0x5b2c('0x4b')]){_0x54eeb4[_0x5b2c('0x49')]=_[_0x5b2c('0x4c')](_0x54eeb4[_0x5b2c('0x49')],{'$or':_[_0x5b2c('0x38')](_0x7a37c6,function(_0x23a59e){if(_0x23a59e[_0x5b2c('0x3b')]!=='VIRTUAL'){var _0x15223a={};_0x15223a[_0x23a59e[_0x5b2c('0x36')]]={'$like':'%'+_0x380782['query'][_0x5b2c('0x4b')]+'%'};return _0x15223a;}})});}_0x54eeb4=_['merge']({},_0x54eeb4,_0x380782[_0x5b2c('0x4d')]);var _0x598e0b={'where':_0x54eeb4[_0x5b2c('0x49')]};return db[_0x5b2c('0x39')][_0x5b2c('0x2d')](_0x598e0b)['then'](function(_0x1643a2){_0x54690e['count']=_0x1643a2;if(_0x380782[_0x5b2c('0x3e')][_0x5b2c('0x4e')]){_0x54eeb4['include']=[{'all':!![]}];}return db[_0x5b2c('0x39')][_0x5b2c('0x4f')](_0x54eeb4);})[_0x5b2c('0x35')](function(_0x257765){_0x54690e['rows']=_0x257765;return _0x54690e;})['then'](respondWithFilteredResult(_0x430b6a,_0x54eeb4))[_0x5b2c('0x28')](handleError(_0x430b6a,null));};exports[_0x5b2c('0x50')]=function(_0x11d1f6,_0x464591){var _0x1c9a85={'raw':![],'where':{'id':_0x11d1f6['params']['id']}},_0x467207={};_0x467207[_0x5b2c('0x3d')]=_['keys'](db[_0x5b2c('0x39')][_0x5b2c('0x51')]);_0x467207[_0x5b2c('0x3e')]=_['keys'](_0x11d1f6[_0x5b2c('0x3e')]);_0x467207['filters']=_[_0x5b2c('0x52')](_0x467207[_0x5b2c('0x3d')],_0x467207['query']);_0x1c9a85[_0x5b2c('0x42')]=_[_0x5b2c('0x52')](_0x467207[_0x5b2c('0x3d')],qs[_0x5b2c('0x41')](_0x11d1f6[_0x5b2c('0x3e')][_0x5b2c('0x41')]));_0x1c9a85[_0x5b2c('0x42')]=_0x1c9a85['attributes']['length']?_0x1c9a85['attributes']:_0x467207[_0x5b2c('0x3d')];if(_0x11d1f6[_0x5b2c('0x3e')][_0x5b2c('0x4e')]){_0x1c9a85['include']=[{'all':!![]}];}_0x1c9a85=_[_0x5b2c('0x4c')]({},_0x1c9a85,_0x11d1f6[_0x5b2c('0x4d')]);return db['DeskConfiguration'][_0x5b2c('0x53')](_0x1c9a85)[_0x5b2c('0x35')](handleEntityNotFound(_0x464591,null))['then'](respondWithResult(_0x464591,null))[_0x5b2c('0x28')](handleError(_0x464591,null));};exports[_0x5b2c('0x54')]=function(_0xc7441f,_0x5e5fcd){return db[_0x5b2c('0x39')][_0x5b2c('0x54')](_0xc7441f[_0x5b2c('0x55')],{})[_0x5b2c('0x35')](respondWithResult(_0x5e5fcd,0xc9))[_0x5b2c('0x28')](handleError(_0x5e5fcd,null));};exports[_0x5b2c('0x33')]=function(_0x1d2699,_0x1634f8){if(_0x1d2699[_0x5b2c('0x55')]['id']){delete _0x1d2699[_0x5b2c('0x55')]['id'];}return db['DeskConfiguration'][_0x5b2c('0x53')]({'where':{'id':_0x1d2699[_0x5b2c('0x56')]['id']}})[_0x5b2c('0x35')](handleEntityNotFound(_0x1634f8,null))[_0x5b2c('0x35')](saveUpdates(_0x1d2699['body'],null))[_0x5b2c('0x35')](respondWithResult(_0x1634f8,null))['catch'](handleError(_0x1634f8,null));};exports[_0x5b2c('0x34')]=function(_0x47f951,_0x469403){return db['DeskConfiguration']['find']({'where':{'id':_0x47f951[_0x5b2c('0x56')]['id']}})['then'](handleEntityNotFound(_0x469403,null))[_0x5b2c('0x35')](removeEntity(_0x469403,null))[_0x5b2c('0x28')](handleError(_0x469403,null));};exports['getFields']=function(_0x4c8411,_0x2f52f3,_0x2a3809){var _0x89fde6={};var _0x2b47e6={};var _0x2eb5be;var _0x1c75be;return db[_0x5b2c('0x39')][_0x5b2c('0x57')]({'where':{'id':_0x4c8411[_0x5b2c('0x56')]['id']}})[_0x5b2c('0x35')](handleEntityNotFound(_0x2f52f3,null))[_0x5b2c('0x35')](function(_0xa0f4d2){if(_0xa0f4d2){_0x2eb5be=_0xa0f4d2;_0x2b47e6[_0x5b2c('0x3d')]=_[_0x5b2c('0x3f')](db['DeskField']['rawAttributes']);_0x2b47e6[_0x5b2c('0x3e')]=_['keys'](_0x4c8411[_0x5b2c('0x3e')]);_0x2b47e6[_0x5b2c('0x40')]=_[_0x5b2c('0x52')](_0x2b47e6['model'],_0x2b47e6[_0x5b2c('0x3e')]);_0x89fde6['attributes']=_['intersection'](_0x2b47e6[_0x5b2c('0x3d')],qs['fields'](_0x4c8411[_0x5b2c('0x3e')][_0x5b2c('0x41')]));_0x89fde6[_0x5b2c('0x42')]=_0x89fde6['attributes']['length']?_0x89fde6[_0x5b2c('0x42')]:_0x2b47e6['model'];_0x89fde6[_0x5b2c('0x47')]=qs[_0x5b2c('0x48')](_0x4c8411[_0x5b2c('0x3e')]['sort']);_0x89fde6[_0x5b2c('0x49')]=qs[_0x5b2c('0x40')](_[_0x5b2c('0x4a')](_0x4c8411[_0x5b2c('0x3e')],_0x2b47e6[_0x5b2c('0x40')]));if(_0x4c8411[_0x5b2c('0x3e')][_0x5b2c('0x4b')]){_0x89fde6[_0x5b2c('0x49')]=_['merge'](_0x89fde6['where'],{'$or':_[_0x5b2c('0x38')](_0x89fde6[_0x5b2c('0x42')],function(_0x57e016){var _0x591ea2={};_0x591ea2[_0x57e016]={'$like':'%'+_0x4c8411['query'][_0x5b2c('0x4b')]+'%'};return _0x591ea2;})});}_0x89fde6=_['merge']({},_0x89fde6,_0x4c8411['options']);return _0x2eb5be[_0x5b2c('0x58')](_0x89fde6);}})['then'](function(_0x583346){if(_0x583346){_0x1c75be=_0x583346[_0x5b2c('0x43')];if(!_0x4c8411[_0x5b2c('0x3e')][_0x5b2c('0x44')]('nolimit')){_0x89fde6[_0x5b2c('0x2e')]=qs[_0x5b2c('0x2e')](_0x4c8411['query']['limit']);_0x89fde6[_0x5b2c('0x46')]=qs[_0x5b2c('0x46')](_0x4c8411[_0x5b2c('0x3e')][_0x5b2c('0x46')]);}return _0x2eb5be[_0x5b2c('0x58')](_0x89fde6);}})[_0x5b2c('0x35')](function(_0x226e2c){if(_0x226e2c){return _0x226e2c?{'count':_0x1c75be,'rows':_0x226e2c}:null;}})[_0x5b2c('0x35')](respondWithResult(_0x2f52f3,null))[_0x5b2c('0x28')](handleError(_0x2f52f3,null));};exports[_0x5b2c('0x59')]=function(_0x50f562,_0x3456c8,_0x32515e){var _0x48e9af={};var _0xe629c1={};var _0x5430c2;var _0x561f79;return db[_0x5b2c('0x39')]['findOne']({'where':{'id':_0x50f562['params']['id']}})[_0x5b2c('0x35')](handleEntityNotFound(_0x3456c8,null))[_0x5b2c('0x35')](function(_0x31dcf3){if(_0x31dcf3){_0x5430c2=_0x31dcf3;_0xe629c1[_0x5b2c('0x3d')]=_[_0x5b2c('0x3f')](db[_0x5b2c('0x5a')][_0x5b2c('0x51')]);_0xe629c1[_0x5b2c('0x3e')]=_['keys'](_0x50f562[_0x5b2c('0x3e')]);_0xe629c1[_0x5b2c('0x40')]=_[_0x5b2c('0x52')](_0xe629c1['model'],_0xe629c1[_0x5b2c('0x3e')]);_0x48e9af['attributes']=_[_0x5b2c('0x52')](_0xe629c1[_0x5b2c('0x3d')],qs[_0x5b2c('0x41')](_0x50f562[_0x5b2c('0x3e')]['fields']));_0x48e9af[_0x5b2c('0x42')]=_0x48e9af['attributes'][_0x5b2c('0x43')]?_0x48e9af[_0x5b2c('0x42')]:_0xe629c1[_0x5b2c('0x3d')];_0x48e9af['order']=qs['sort'](_0x50f562[_0x5b2c('0x3e')]['sort']);_0x48e9af[_0x5b2c('0x49')]=qs[_0x5b2c('0x40')](_[_0x5b2c('0x4a')](_0x50f562[_0x5b2c('0x3e')],_0xe629c1[_0x5b2c('0x40')]));if(_0x50f562['query'][_0x5b2c('0x4b')]){_0x48e9af[_0x5b2c('0x49')]=_[_0x5b2c('0x4c')](_0x48e9af['where'],{'$or':_[_0x5b2c('0x38')](_0x48e9af['attributes'],function(_0x18e384){var _0x2df112={};_0x2df112[_0x18e384]={'$like':'%'+_0x50f562[_0x5b2c('0x3e')]['filter']+'%'};return _0x2df112;})});}_0x48e9af=_[_0x5b2c('0x4c')]({},_0x48e9af,_0x50f562[_0x5b2c('0x4d')]);return _0x5430c2[_0x5b2c('0x59')](_0x48e9af);}})[_0x5b2c('0x35')](function(_0x3b73f3){if(_0x3b73f3){_0x561f79=_0x3b73f3[_0x5b2c('0x43')];if(!_0x50f562['query']['hasOwnProperty'](_0x5b2c('0x45'))){_0x48e9af[_0x5b2c('0x2e')]=qs[_0x5b2c('0x2e')](_0x50f562[_0x5b2c('0x3e')]['limit']);_0x48e9af[_0x5b2c('0x46')]=qs[_0x5b2c('0x46')](_0x50f562[_0x5b2c('0x3e')]['offset']);}return _0x5430c2['getSubjects'](_0x48e9af);}})[_0x5b2c('0x35')](function(_0x853027){if(_0x853027){return _0x853027?{'count':_0x561f79,'rows':_0x853027}:null;}})[_0x5b2c('0x35')](respondWithResult(_0x3456c8,null))[_0x5b2c('0x28')](handleError(_0x3456c8,null));};exports[_0x5b2c('0x5b')]=function(_0x216bc6,_0x2134fe,_0x56e9e0){var _0x28f199={};var _0x4baf87={};var _0x39dec9;var _0x17bd44;return db[_0x5b2c('0x39')][_0x5b2c('0x57')]({'where':{'id':_0x216bc6[_0x5b2c('0x56')]['id']}})[_0x5b2c('0x35')](handleEntityNotFound(_0x2134fe,null))[_0x5b2c('0x35')](function(_0x5c2904){if(_0x5c2904){_0x39dec9=_0x5c2904;_0x4baf87[_0x5b2c('0x3d')]=_['keys'](db[_0x5b2c('0x5a')]['rawAttributes']);_0x4baf87[_0x5b2c('0x3e')]=_['keys'](_0x216bc6[_0x5b2c('0x3e')]);_0x4baf87[_0x5b2c('0x40')]=_[_0x5b2c('0x52')](_0x4baf87[_0x5b2c('0x3d')],_0x4baf87[_0x5b2c('0x3e')]);_0x28f199[_0x5b2c('0x42')]=_['intersection'](_0x4baf87[_0x5b2c('0x3d')],qs[_0x5b2c('0x41')](_0x216bc6[_0x5b2c('0x3e')][_0x5b2c('0x41')]));_0x28f199[_0x5b2c('0x42')]=_0x28f199['attributes']['length']?_0x28f199['attributes']:_0x4baf87[_0x5b2c('0x3d')];_0x28f199['order']=qs[_0x5b2c('0x48')](_0x216bc6['query'][_0x5b2c('0x48')]);_0x28f199[_0x5b2c('0x49')]=qs[_0x5b2c('0x40')](_['pick'](_0x216bc6['query'],_0x4baf87['filters']));if(_0x216bc6['query'][_0x5b2c('0x4b')]){_0x28f199[_0x5b2c('0x49')]=_['merge'](_0x28f199[_0x5b2c('0x49')],{'$or':_[_0x5b2c('0x38')](_0x28f199['attributes'],function(_0x537831){var _0x18c0d6={};_0x18c0d6[_0x537831]={'$like':'%'+_0x216bc6[_0x5b2c('0x3e')][_0x5b2c('0x4b')]+'%'};return _0x18c0d6;})});}_0x28f199=_[_0x5b2c('0x4c')]({},_0x28f199,_0x216bc6[_0x5b2c('0x4d')]);return _0x39dec9['getDescriptions'](_0x28f199);}})[_0x5b2c('0x35')](function(_0x26d03e){if(_0x26d03e){_0x17bd44=_0x26d03e[_0x5b2c('0x43')];if(!_0x216bc6[_0x5b2c('0x3e')][_0x5b2c('0x44')](_0x5b2c('0x45'))){_0x28f199[_0x5b2c('0x2e')]=qs[_0x5b2c('0x2e')](_0x216bc6[_0x5b2c('0x3e')][_0x5b2c('0x2e')]);_0x28f199[_0x5b2c('0x46')]=qs[_0x5b2c('0x46')](_0x216bc6[_0x5b2c('0x3e')]['offset']);}return _0x39dec9[_0x5b2c('0x5b')](_0x28f199);}})[_0x5b2c('0x35')](function(_0x10e25d){if(_0x10e25d){return _0x10e25d?{'count':_0x17bd44,'rows':_0x10e25d}:null;}})[_0x5b2c('0x35')](respondWithResult(_0x2134fe,null))['catch'](handleError(_0x2134fe,null));};exports[_0x5b2c('0x5c')]=function(_0x1c1b28,_0x202731,_0x3c7ddb){var _0x374082={};var _0x568e68={};var _0x4a55de;var _0x874b2b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1c1b28['params']['id']}})['then'](handleEntityNotFound(_0x202731,null))['then'](function(_0x553fd8){if(_0x553fd8){_0x4a55de=_0x553fd8;_0x568e68['model']=_[_0x5b2c('0x3f')](db[_0x5b2c('0x5d')][_0x5b2c('0x51')]);_0x568e68['query']=_[_0x5b2c('0x3f')](_0x1c1b28[_0x5b2c('0x3e')]);_0x568e68['filters']=_[_0x5b2c('0x52')](_0x568e68[_0x5b2c('0x3d')],_0x568e68['query']);_0x374082[_0x5b2c('0x42')]=_[_0x5b2c('0x52')](_0x568e68['model'],qs[_0x5b2c('0x41')](_0x1c1b28[_0x5b2c('0x3e')][_0x5b2c('0x41')]));_0x374082[_0x5b2c('0x42')]=_0x374082[_0x5b2c('0x42')][_0x5b2c('0x43')]?_0x374082[_0x5b2c('0x42')]:_0x568e68[_0x5b2c('0x3d')];_0x374082[_0x5b2c('0x47')]=qs[_0x5b2c('0x48')](_0x1c1b28[_0x5b2c('0x3e')][_0x5b2c('0x48')]);_0x374082[_0x5b2c('0x49')]=qs[_0x5b2c('0x40')](_[_0x5b2c('0x4a')](_0x1c1b28[_0x5b2c('0x3e')],_0x568e68[_0x5b2c('0x40')]));if(_0x1c1b28[_0x5b2c('0x3e')][_0x5b2c('0x4b')]){_0x374082['where']=_[_0x5b2c('0x4c')](_0x374082[_0x5b2c('0x49')],{'$or':_['map'](_0x374082[_0x5b2c('0x42')],function(_0x1d6e7a){var _0x215046={};_0x215046[_0x1d6e7a]={'$like':'%'+_0x1c1b28[_0x5b2c('0x3e')][_0x5b2c('0x4b')]+'%'};return _0x215046;})});}_0x374082=_[_0x5b2c('0x4c')]({},_0x374082,_0x1c1b28[_0x5b2c('0x4d')]);return _0x4a55de[_0x5b2c('0x5c')](_0x374082);}})['then'](function(_0x24f15f){if(_0x24f15f){_0x874b2b=_0x24f15f[_0x5b2c('0x43')];if(!_0x1c1b28[_0x5b2c('0x3e')][_0x5b2c('0x44')]('nolimit')){_0x374082['limit']=qs[_0x5b2c('0x2e')](_0x1c1b28['query']['limit']);_0x374082[_0x5b2c('0x46')]=qs[_0x5b2c('0x46')](_0x1c1b28[_0x5b2c('0x3e')]['offset']);}return _0x4a55de[_0x5b2c('0x5c')](_0x374082);}})[_0x5b2c('0x35')](function(_0x37cd36){if(_0x37cd36){return _0x37cd36?{'count':_0x874b2b,'rows':_0x37cd36}:null;}})[_0x5b2c('0x35')](respondWithResult(_0x202731,null))[_0x5b2c('0x28')](handleError(_0x202731,null));};exports[_0x5b2c('0x5e')]=function(_0x50a6ed,_0x69f759,_0x46c31e){if(_0x50a6ed[_0x5b2c('0x55')]['id']){delete _0x50a6ed[_0x5b2c('0x55')]['id'];}return db[_0x5b2c('0x39')][_0x5b2c('0x57')]({'where':{'id':_0x50a6ed[_0x5b2c('0x56')]['id']}})[_0x5b2c('0x35')](handleEntityNotFound(_0x69f759,null))[_0x5b2c('0x35')](function(_0x32e1a6){if(_0x32e1a6){return _0x32e1a6[_0x5b2c('0x5e')](_0x50a6ed[_0x5b2c('0x55')]['ids']||[]);}return null;})[_0x5b2c('0x35')](respondWithResult(_0x69f759,null))[_0x5b2c('0x28')](handleError(_0x69f759,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2143e7f..70abcae 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 _0xf0d5=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x1532b0,_0x165b76){var _0x5f0489=function(_0xfd6930){while(--_0xfd6930){_0x1532b0['push'](_0x1532b0['shift']());}};_0x5f0489(++_0x165b76);}(_0xf0d5,0x119));var _0x5f0d=function(_0x5c2fc7,_0x5aae89){_0x5c2fc7=_0x5c2fc7-0x0;var _0x407405=_0xf0d5[_0x5c2fc7];return _0x407405;};'use strict';var _=require(_0x5f0d('0x0'));var util=require(_0x5f0d('0x1'));var logger=require(_0x5f0d('0x2'))(_0x5f0d('0x3'));var moment=require('moment');var BPromise=require(_0x5f0d('0x4'));var rp=require(_0x5f0d('0x5'));var fs=require('fs');var path=require(_0x5f0d('0x6'));var rimraf=require('rimraf');var config=require(_0x5f0d('0x7'));var attributes=require(_0x5f0d('0x8'));module['exports']=function(_0x52b7fc,_0x1f5bbc){return _0x52b7fc['define'](_0x5f0d('0x9'),attributes,{'tableName':_0x5f0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34b6=['request-promise','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment'];(function(_0x5a6187,_0x157b11){var _0x3bf9e1=function(_0x390478){while(--_0x390478){_0x5a6187['push'](_0x5a6187['shift']());}};_0x3bf9e1(++_0x157b11);}(_0x34b6,0xac));var _0x634b=function(_0x4c1ae7,_0x44532f){_0x4c1ae7=_0x4c1ae7-0x0;var _0x12f4c5=_0x34b6[_0x4c1ae7];return _0x12f4c5;};'use strict';var _=require(_0x634b('0x0'));var util=require('util');var logger=require(_0x634b('0x1'))(_0x634b('0x2'));var moment=require(_0x634b('0x3'));var BPromise=require('bluebird');var rp=require(_0x634b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x634b('0x5'));var attributes=require(_0x634b('0x6'));module[_0x634b('0x7')]=function(_0x29f333,_0x189ca4){return _0x29f333[_0x634b('0x8')](_0x634b('0x9'),attributes,{'tableName':_0x634b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 67526a2..5a06521 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 _0xf296=['DeskConfiguration,\x20%s,\x20%s','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0xf296,0x94));var _0x6f29=function(_0x582598,_0x311dc5){_0x582598=_0x582598-0x0;var _0x1de137=_0xf296[_0x582598];return _0x1de137;};'use strict';var _=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var moment=require('moment');var BPromise=require(_0x6f29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f29('0x3'))['db'];var utils=require(_0x6f29('0x4'));var logger=require('../../config/logger')(_0x6f29('0x5'));var config=require(_0x6f29('0x6'));var jayson=require(_0x6f29('0x7'));var client=jayson['client'][_0x6f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x295563,_0x584956,_0x8ea46){return new BPromise(function(_0x1f26a1,_0xabac60){return client[_0x6f29('0x9')](_0x295563,_0x8ea46)[_0x6f29('0xa')](function(_0x410855){logger[_0x6f29('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x584956,'request\x20sent');logger[_0x6f29('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x584956,'request\x20sent',JSON[_0x6f29('0xd')](_0x410855));if(_0x410855['error']){if(_0x410855[_0x6f29('0xe')][_0x6f29('0xf')]===0x1f4){logger[_0x6f29('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x584956,_0x410855[_0x6f29('0xe')][_0x6f29('0x10')]);return _0xabac60(_0x410855[_0x6f29('0xe')][_0x6f29('0x10')]);}logger[_0x6f29('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x584956,_0x410855[_0x6f29('0xe')][_0x6f29('0x10')]);return _0x1f26a1(_0x410855[_0x6f29('0xe')]['message']);}else{logger[_0x6f29('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x584956,_0x6f29('0x11'));_0x1f26a1(_0x410855[_0x6f29('0x12')][_0x6f29('0x10')]);}})[_0x6f29('0x13')](function(_0x58a65d){logger['error'](_0x6f29('0x14'),_0x584956,_0x58a65d);_0xabac60(_0x58a65d);});});} \ No newline at end of file +var _0x894f=['jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x16be59,_0x2a60e4){var _0x24a92f=function(_0x2f6e37){while(--_0x2f6e37){_0x16be59['push'](_0x16be59['shift']());}};_0x24a92f(++_0x2a60e4);}(_0x894f,0x14d));var _0xf894=function(_0x4be43b,_0x2714c0){_0x4be43b=_0x4be43b-0x0;var _0x12cea9=_0x894f[_0x4be43b];return _0x12cea9;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var moment=require(_0xf894('0x2'));var BPromise=require(_0xf894('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf894('0x4'))['db'];var utils=require(_0xf894('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf894('0x6'));var jayson=require(_0xf894('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a9fc,_0x371f86,_0x56d9d6){return new BPromise(function(_0x190cb1,_0x3d8f21){return client[_0xf894('0x8')](_0x23a9fc,_0x56d9d6)[_0xf894('0x9')](function(_0x10bb84){logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));logger[_0xf894('0xd')](_0xf894('0xe'),_0x371f86,_0xf894('0xc'),JSON[_0xf894('0xf')](_0x10bb84));if(_0x10bb84[_0xf894('0x10')]){if(_0x10bb84[_0xf894('0x10')][_0xf894('0x11')]===0x1f4){logger[_0xf894('0x10')](_0xf894('0xb'),_0x371f86,_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);return _0x3d8f21(_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);}logger[_0xf894('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x371f86,_0x10bb84[_0xf894('0x10')]['message']);return _0x190cb1(_0x10bb84['error'][_0xf894('0x12')]);}else{logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));_0x190cb1(_0x10bb84[_0xf894('0x13')]['message']);}})['catch'](function(_0x1865be){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x371f86,_0x1865be);_0x3d8f21(_0x1865be);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 99d6294..aa852ff 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 _0x7024=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','post','create','put','/:id','delete','multer','util'];(function(_0x22dbd1,_0x47e0bb){var _0x50a4fd=function(_0x5cadf4){while(--_0x5cadf4){_0x22dbd1['push'](_0x22dbd1['shift']());}};_0x50a4fd(++_0x47e0bb);}(_0x7024,0x1de));var _0x4702=function(_0x218fbd,_0x52e9d7){_0x218fbd=_0x218fbd-0x0;var _0x30cd37=_0x7024[_0x218fbd];return _0x30cd37;};'use strict';var multer=require(_0x4702('0x0'));var util=require(_0x4702('0x1'));var path=require(_0x4702('0x2'));var timeout=require(_0x4702('0x3'));var express=require(_0x4702('0x4'));var router=express[_0x4702('0x5')]();var auth=require(_0x4702('0x6'));var interaction=require(_0x4702('0x7'));var config=require('../../config/environment');var controller=require(_0x4702('0x8'));router[_0x4702('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4702('0x9')]('/:id',auth[_0x4702('0xa')](),controller['show']);router[_0x4702('0xb')]('/',auth[_0x4702('0xa')](),controller[_0x4702('0xc')]);router[_0x4702('0xd')](_0x4702('0xe'),auth[_0x4702('0xa')](),controller['update']);router[_0x4702('0xf')](_0x4702('0xe'),auth[_0x4702('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6add=['put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x45c6bb,_0x2e684b){var _0xbb6013=function(_0x3778c4){while(--_0x3778c4){_0x45c6bb['push'](_0x45c6bb['shift']());}};_0xbb6013(++_0x2e684b);}(_0x6add,0x76));var _0xd6ad=function(_0x51991f,_0x3e2f25){_0x51991f=_0x51991f-0x0;var _0x40c6f0=_0x6add[_0x51991f];return _0x40c6f0;};'use strict';var multer=require(_0xd6ad('0x0'));var util=require(_0xd6ad('0x1'));var path=require(_0xd6ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xd6ad('0x3'));var router=express[_0xd6ad('0x4')]();var auth=require(_0xd6ad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd6ad('0x6'));var controller=require(_0xd6ad('0x7'));router[_0xd6ad('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6ad('0x9')]);router[_0xd6ad('0x8')](_0xd6ad('0xa'),auth[_0xd6ad('0xb')](),controller[_0xd6ad('0xc')]);router[_0xd6ad('0xd')]('/',auth['isAuthenticated'](),controller[_0xd6ad('0xe')]);router[_0xd6ad('0xf')](_0xd6ad('0xa'),auth[_0xd6ad('0xb')](),controller[_0xd6ad('0x10')]);router['delete'](_0xd6ad('0xa'),auth['isAuthenticated'](),controller[_0xd6ad('0x11')]);module[_0xd6ad('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 e827807..d80a231 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 _0xc812=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x33fc15,_0x405a34){var _0x3c558c=function(_0x74bee1){while(--_0x74bee1){_0x33fc15['push'](_0x33fc15['shift']());}};_0x3c558c(++_0x405a34);}(_0xc812,0xdc));var _0x2c81=function(_0xdee874,_0x540979){_0xdee874=_0xdee874-0x0;var _0x2d769b=_0xc812[_0xdee874];return _0x2d769b;};'use strict';var Sequelize=require('sequelize');module[_0x2c81('0x0')]={'type':{'type':Sequelize[_0x2c81('0x1')](_0x2c81('0x2'),_0x2c81('0x3'),_0x2c81('0x4'),_0x2c81('0x5')),'defaultValue':_0x2c81('0x2')},'content':{'type':Sequelize[_0x2c81('0x6')]},'key':{'type':Sequelize[_0x2c81('0x6')]},'keyType':{'type':Sequelize[_0x2c81('0x1')](_0x2c81('0x2'),_0x2c81('0x3'),_0x2c81('0x4'))},'keyContent':{'type':Sequelize[_0x2c81('0x6')]},'idField':{'type':Sequelize[_0x2c81('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2c81('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x79d5=['exports','string','variable','keyValue','STRING','customVariable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79d5,0xae));var _0x579d=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x79d5[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require('sequelize');module[_0x579d('0x0')]={'type':{'type':Sequelize['ENUM'](_0x579d('0x1'),_0x579d('0x2'),'customVariable',_0x579d('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x579d('0x4')]},'key':{'type':Sequelize[_0x579d('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x579d('0x1'),_0x579d('0x2'),_0x579d('0x5'))},'keyContent':{'type':Sequelize[_0x579d('0x4')]},'idField':{'type':Sequelize[_0x579d('0x4')]},'nameField':{'type':Sequelize[_0x579d('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x579d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 194341d..0f48b4a 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 _0x7353=['stack','name','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x28a77f,_0x38ab5a){var _0x4b467f=function(_0x1b87ca){while(--_0x1b87ca){_0x28a77f['push'](_0x28a77f['shift']());}};_0x4b467f(++_0x38ab5a);}(_0x7353,0x18a));var _0x3735=function(_0x5533f6,_0x30af28){_0x5533f6=_0x5533f6-0x0;var _0x26f3f8=_0x7353[_0x5533f6];return _0x26f3f8;};'use strict';var pdf=require(_0x3735('0x0'));var emlformat=require(_0x3735('0x1'));var rimraf=require(_0x3735('0x2'));var zipdir=require(_0x3735('0x3'));var jsonpatch=require(_0x3735('0x4'));var rp=require(_0x3735('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3735('0x6'));var util=require('util');var path=require(_0x3735('0x7'));var sox=require(_0x3735('0x8'));var csv=require(_0x3735('0x9'));var ejs=require(_0x3735('0xa'));var fs=require('fs');var _=require(_0x3735('0xb'));var squel=require(_0x3735('0xc'));var crypto=require('crypto');var jsforce=require(_0x3735('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3735('0x9'));var querystring=require(_0x3735('0xe'));var Papa=require(_0x3735('0xf'));var Redis=require(_0x3735('0x10'));var authService=require(_0x3735('0x11'));var qs=require(_0x3735('0x12'));var as=require(_0x3735('0x13'));var hardwareService=require(_0x3735('0x14'));var logger=require(_0x3735('0x15'))('api');var utils=require(_0x3735('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3735('0x17'));var db=require(_0x3735('0x18'))['db'];function respondWithStatusCode(_0x373a57,_0x2381ee){_0x2381ee=_0x2381ee||0xcc;return function(_0x3526b3){if(_0x3526b3){return _0x373a57[_0x3735('0x19')](_0x2381ee);}return _0x373a57[_0x3735('0x1a')](_0x2381ee)[_0x3735('0x1b')]();};}function respondWithResult(_0x55365c,_0x3b947e){_0x3b947e=_0x3b947e||0xc8;return function(_0x338c0c){if(_0x338c0c){return _0x55365c['status'](_0x3b947e)[_0x3735('0x1c')](_0x338c0c);}};}function respondWithFilteredResult(_0x456504,_0x1551ea){return function(_0xb63ffd){if(_0xb63ffd){var _0x3a79d3=_0xb63ffd[_0x3735('0x1d')],_0x26bc90=_0x1551ea[_0x3735('0x1e')],_0x1434d9=_0x1551ea['offset']+_0x1551ea['limit'],_0x3e62ce;if(_0x1434d9>=_0x3a79d3){_0x1434d9=_0x3a79d3;_0x3e62ce=0xc8;}else{_0x3e62ce=0xce;}_0x456504['status'](_0x3e62ce);return _0x456504['set'](_0x3735('0x1f'),_0x26bc90+'-'+_0x1434d9+'/'+_0x3a79d3)[_0x3735('0x1c')](_0xb63ffd);}return null;};}function patchUpdates(_0x4c80c0){return function(_0x1df2c9){try{jsonpatch[_0x3735('0x20')](_0x1df2c9,_0x4c80c0,!![]);}catch(_0x56ace8){return BPromise[_0x3735('0x21')](_0x56ace8);}return _0x1df2c9['save']();};}function saveUpdates(_0x32f14b,_0x4eaa8b){return function(_0x4d7abb){if(_0x4d7abb){return _0x4d7abb[_0x3735('0x22')](_0x32f14b)[_0x3735('0x23')](function(_0x5a3764){return _0x5a3764;});}return null;};}function removeEntity(_0x398f79,_0x27fddf){return function(_0x59b9eb){if(_0x59b9eb){return _0x59b9eb[_0x3735('0x24')]()['then'](function(){_0x398f79[_0x3735('0x1a')](0xcc)[_0x3735('0x1b')]();});}};}function handleEntityNotFound(_0x44e890,_0x211f3f){return function(_0x165cc2){if(!_0x165cc2){_0x44e890[_0x3735('0x19')](0x194);}return _0x165cc2;};}function handleError(_0x314927,_0x2d6c21){_0x2d6c21=_0x2d6c21||0x1f4;return function(_0x5e3bca){logger[_0x3735('0x25')](_0x5e3bca[_0x3735('0x26')]);if(_0x5e3bca[_0x3735('0x27')]){delete _0x5e3bca[_0x3735('0x27')];}_0x314927[_0x3735('0x1a')](_0x2d6c21)['send'](_0x5e3bca);};}exports[_0x3735('0x28')]=function(_0x49e665,_0x11350){var _0x51f378={},_0x83a0a7={},_0x2fdc2d={'count':0x0,'rows':[]};var _0x317435=_[_0x3735('0x29')](db[_0x3735('0x2a')]['rawAttributes'],function(_0x45559c){return{'name':_0x45559c[_0x3735('0x2b')],'type':_0x45559c[_0x3735('0x2c')][_0x3735('0x2d')]};});_0x83a0a7[_0x3735('0x2e')]=_[_0x3735('0x29')](_0x317435,_0x3735('0x27'));_0x83a0a7[_0x3735('0x2f')]=_[_0x3735('0x30')](_0x49e665[_0x3735('0x2f')]);_0x83a0a7[_0x3735('0x31')]=_[_0x3735('0x32')](_0x83a0a7[_0x3735('0x2e')],_0x83a0a7[_0x3735('0x2f')]);_0x51f378[_0x3735('0x33')]=_[_0x3735('0x32')](_0x83a0a7[_0x3735('0x2e')],qs[_0x3735('0x34')](_0x49e665[_0x3735('0x2f')][_0x3735('0x34')]));_0x51f378[_0x3735('0x33')]=_0x51f378[_0x3735('0x33')]['length']?_0x51f378['attributes']:_0x83a0a7[_0x3735('0x2e')];if(!_0x49e665[_0x3735('0x2f')][_0x3735('0x35')]('nolimit')){_0x51f378['limit']=qs[_0x3735('0x36')](_0x49e665[_0x3735('0x2f')][_0x3735('0x36')]);_0x51f378[_0x3735('0x1e')]=qs['offset'](_0x49e665[_0x3735('0x2f')]['offset']);}_0x51f378[_0x3735('0x37')]=qs[_0x3735('0x38')](_0x49e665[_0x3735('0x2f')][_0x3735('0x38')]);_0x51f378[_0x3735('0x39')]=qs[_0x3735('0x31')](_[_0x3735('0x3a')](_0x49e665[_0x3735('0x2f')],_0x83a0a7[_0x3735('0x31')]),_0x317435);if(_0x49e665[_0x3735('0x2f')][_0x3735('0x3b')]){_0x51f378[_0x3735('0x39')]=_['merge'](_0x51f378[_0x3735('0x39')],{'$or':_[_0x3735('0x29')](_0x317435,function(_0x270f73){if(_0x270f73[_0x3735('0x2c')]!=='VIRTUAL'){var _0x10e8fb={};_0x10e8fb[_0x270f73[_0x3735('0x27')]]={'$like':'%'+_0x49e665[_0x3735('0x2f')][_0x3735('0x3b')]+'%'};return _0x10e8fb;}})});}_0x51f378=_[_0x3735('0x3c')]({},_0x51f378,_0x49e665[_0x3735('0x3d')]);var _0x4d8e50={'where':_0x51f378[_0x3735('0x39')]};return db['DeskField'][_0x3735('0x1d')](_0x4d8e50)[_0x3735('0x23')](function(_0x5f3685){_0x2fdc2d[_0x3735('0x1d')]=_0x5f3685;if(_0x49e665[_0x3735('0x2f')][_0x3735('0x3e')]){_0x51f378[_0x3735('0x3f')]=[{'all':!![]}];}return db[_0x3735('0x2a')]['findAll'](_0x51f378);})[_0x3735('0x23')](function(_0x3eb678){_0x2fdc2d[_0x3735('0x40')]=_0x3eb678;return _0x2fdc2d;})[_0x3735('0x23')](respondWithFilteredResult(_0x11350,_0x51f378))[_0x3735('0x41')](handleError(_0x11350,null));};exports[_0x3735('0x42')]=function(_0x2ff2aa,_0x2e2065){var _0x217636={'raw':!![],'where':{'id':_0x2ff2aa[_0x3735('0x43')]['id']}},_0xed712b={};_0xed712b[_0x3735('0x2e')]=_[_0x3735('0x30')](db[_0x3735('0x2a')][_0x3735('0x44')]);_0xed712b[_0x3735('0x2f')]=_['keys'](_0x2ff2aa[_0x3735('0x2f')]);_0xed712b[_0x3735('0x31')]=_[_0x3735('0x32')](_0xed712b[_0x3735('0x2e')],_0xed712b[_0x3735('0x2f')]);_0x217636[_0x3735('0x33')]=_[_0x3735('0x32')](_0xed712b[_0x3735('0x2e')],qs[_0x3735('0x34')](_0x2ff2aa[_0x3735('0x2f')][_0x3735('0x34')]));_0x217636[_0x3735('0x33')]=_0x217636[_0x3735('0x33')]['length']?_0x217636[_0x3735('0x33')]:_0xed712b[_0x3735('0x2e')];if(_0x2ff2aa[_0x3735('0x2f')][_0x3735('0x3e')]){_0x217636['include']=[{'all':!![]}];}_0x217636=_[_0x3735('0x3c')]({},_0x217636,_0x2ff2aa[_0x3735('0x3d')]);return db['DeskField']['find'](_0x217636)[_0x3735('0x23')](handleEntityNotFound(_0x2e2065,null))[_0x3735('0x23')](respondWithResult(_0x2e2065,null))[_0x3735('0x41')](handleError(_0x2e2065,null));};exports[_0x3735('0x45')]=function(_0x5904b7,_0x4d5186){return db[_0x3735('0x2a')]['create'](_0x5904b7[_0x3735('0x46')],{})[_0x3735('0x23')](respondWithResult(_0x4d5186,0xc9))[_0x3735('0x41')](handleError(_0x4d5186,null));};exports[_0x3735('0x22')]=function(_0x3dde5e,_0x5e5915){if(_0x3dde5e[_0x3735('0x46')]['id']){delete _0x3dde5e['body']['id'];}return db[_0x3735('0x2a')][_0x3735('0x47')]({'where':{'id':_0x3dde5e['params']['id']}})[_0x3735('0x23')](handleEntityNotFound(_0x5e5915,null))[_0x3735('0x23')](saveUpdates(_0x3dde5e[_0x3735('0x46')],null))[_0x3735('0x23')](respondWithResult(_0x5e5915,null))[_0x3735('0x41')](handleError(_0x5e5915,null));};exports[_0x3735('0x24')]=function(_0x2b54a9,_0xeb7ad9){return db['DeskField'][_0x3735('0x47')]({'where':{'id':_0x2b54a9[_0x3735('0x43')]['id']}})[_0x3735('0x23')](handleEntityNotFound(_0xeb7ad9,null))['then'](removeEntity(_0xeb7ad9,null))[_0x3735('0x41')](handleError(_0xeb7ad9,null));}; \ No newline at end of file +var _0x7883=['findAll','rows','catch','params','DeskField','length','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x13a229,_0x2ee763){var _0x53669e=function(_0x385b5e){while(--_0x385b5e){_0x13a229['push'](_0x13a229['shift']());}};_0x53669e(++_0x2ee763);}(_0x7883,0x132));var _0x3788=function(_0xe8930a,_0x2ec455){_0xe8930a=_0xe8930a-0x0;var _0x3cb071=_0x7883[_0xe8930a];return _0x3cb071;};'use strict';var pdf=require(_0x3788('0x0'));var emlformat=require(_0x3788('0x1'));var rimraf=require(_0x3788('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3788('0x3'));var rp=require(_0x3788('0x4'));var moment=require(_0x3788('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3788('0x6'));var path=require(_0x3788('0x7'));var sox=require(_0x3788('0x8'));var csv=require('to-csv');var ejs=require(_0x3788('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3788('0xa'));var crypto=require(_0x3788('0xb'));var jsforce=require(_0x3788('0xc'));var deskjs=require(_0x3788('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3788('0xe'));var Papa=require(_0x3788('0xf'));var Redis=require(_0x3788('0x10'));var authService=require(_0x3788('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3788('0x12'));var hardwareService=require(_0x3788('0x13'));var logger=require(_0x3788('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3788('0x15'));var licenseUtil=require(_0x3788('0x16'));var db=require(_0x3788('0x17'))['db'];function respondWithStatusCode(_0x315847,_0x172c65){_0x172c65=_0x172c65||0xcc;return function(_0x2b6853){if(_0x2b6853){return _0x315847['sendStatus'](_0x172c65);}return _0x315847[_0x3788('0x18')](_0x172c65)['end']();};}function respondWithResult(_0x8320a1,_0x3630d1){_0x3630d1=_0x3630d1||0xc8;return function(_0x390dbc){if(_0x390dbc){return _0x8320a1['status'](_0x3630d1)['json'](_0x390dbc);}};}function respondWithFilteredResult(_0x546cd9,_0x2b9510){return function(_0x223df2){if(_0x223df2){var _0xb582fc=_0x223df2[_0x3788('0x19')],_0x42744b=_0x2b9510[_0x3788('0x1a')],_0x128fb3=_0x2b9510['offset']+_0x2b9510[_0x3788('0x1b')],_0x2485ee;if(_0x128fb3>=_0xb582fc){_0x128fb3=_0xb582fc;_0x2485ee=0xc8;}else{_0x2485ee=0xce;}_0x546cd9['status'](_0x2485ee);return _0x546cd9[_0x3788('0x1c')](_0x3788('0x1d'),_0x42744b+'-'+_0x128fb3+'/'+_0xb582fc)[_0x3788('0x1e')](_0x223df2);}return null;};}function patchUpdates(_0x5644a8){return function(_0x56d0b4){try{jsonpatch[_0x3788('0x1f')](_0x56d0b4,_0x5644a8,!![]);}catch(_0x395e38){return BPromise[_0x3788('0x20')](_0x395e38);}return _0x56d0b4[_0x3788('0x21')]();};}function saveUpdates(_0x2c6535,_0x4bc01f){return function(_0x5eb802){if(_0x5eb802){return _0x5eb802['update'](_0x2c6535)[_0x3788('0x22')](function(_0x25f286){return _0x25f286;});}return null;};}function removeEntity(_0x4c682e,_0x3e52b5){return function(_0x5953c7){if(_0x5953c7){return _0x5953c7['destroy']()[_0x3788('0x22')](function(){_0x4c682e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x144dc1,_0x1dab8e){return function(_0x34443f){if(!_0x34443f){_0x144dc1[_0x3788('0x23')](0x194);}return _0x34443f;};}function handleError(_0x46ae8c,_0x1d0b88){_0x1d0b88=_0x1d0b88||0x1f4;return function(_0x4cc32f){logger[_0x3788('0x24')](_0x4cc32f[_0x3788('0x25')]);if(_0x4cc32f['name']){delete _0x4cc32f[_0x3788('0x26')];}_0x46ae8c[_0x3788('0x18')](_0x1d0b88)[_0x3788('0x27')](_0x4cc32f);};}exports[_0x3788('0x28')]=function(_0x346260,_0x247093){var _0x244670={},_0x5996da={},_0x4bba9b={'count':0x0,'rows':[]};var _0x58efe4=_[_0x3788('0x29')](db['DeskField'][_0x3788('0x2a')],function(_0x5b3904){return{'name':_0x5b3904[_0x3788('0x2b')],'type':_0x5b3904[_0x3788('0x2c')][_0x3788('0x2d')]};});_0x5996da[_0x3788('0x2e')]=_[_0x3788('0x29')](_0x58efe4,'name');_0x5996da[_0x3788('0x2f')]=_[_0x3788('0x30')](_0x346260['query']);_0x5996da[_0x3788('0x31')]=_[_0x3788('0x32')](_0x5996da[_0x3788('0x2e')],_0x5996da[_0x3788('0x2f')]);_0x244670[_0x3788('0x33')]=_[_0x3788('0x32')](_0x5996da[_0x3788('0x2e')],qs[_0x3788('0x34')](_0x346260['query'][_0x3788('0x34')]));_0x244670[_0x3788('0x33')]=_0x244670['attributes']['length']?_0x244670[_0x3788('0x33')]:_0x5996da[_0x3788('0x2e')];if(!_0x346260['query']['hasOwnProperty'](_0x3788('0x35'))){_0x244670[_0x3788('0x1b')]=qs[_0x3788('0x1b')](_0x346260['query'][_0x3788('0x1b')]);_0x244670['offset']=qs['offset'](_0x346260['query'][_0x3788('0x1a')]);}_0x244670[_0x3788('0x36')]=qs[_0x3788('0x37')](_0x346260[_0x3788('0x2f')][_0x3788('0x37')]);_0x244670[_0x3788('0x38')]=qs[_0x3788('0x31')](_[_0x3788('0x39')](_0x346260[_0x3788('0x2f')],_0x5996da[_0x3788('0x31')]),_0x58efe4);if(_0x346260['query'][_0x3788('0x3a')]){_0x244670[_0x3788('0x38')]=_[_0x3788('0x3b')](_0x244670[_0x3788('0x38')],{'$or':_['map'](_0x58efe4,function(_0x25fbf0){if(_0x25fbf0[_0x3788('0x2c')]!==_0x3788('0x3c')){var _0x56dcf5={};_0x56dcf5[_0x25fbf0[_0x3788('0x26')]]={'$like':'%'+_0x346260[_0x3788('0x2f')][_0x3788('0x3a')]+'%'};return _0x56dcf5;}})});}_0x244670=_[_0x3788('0x3b')]({},_0x244670,_0x346260[_0x3788('0x3d')]);var _0xdbc187={'where':_0x244670[_0x3788('0x38')]};return db['DeskField'][_0x3788('0x19')](_0xdbc187)[_0x3788('0x22')](function(_0x4d9c01){_0x4bba9b[_0x3788('0x19')]=_0x4d9c01;if(_0x346260[_0x3788('0x2f')][_0x3788('0x3e')]){_0x244670[_0x3788('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x3788('0x40')](_0x244670);})[_0x3788('0x22')](function(_0x1c75f7){_0x4bba9b[_0x3788('0x41')]=_0x1c75f7;return _0x4bba9b;})['then'](respondWithFilteredResult(_0x247093,_0x244670))[_0x3788('0x42')](handleError(_0x247093,null));};exports['show']=function(_0x35a644,_0x59d06b){var _0xa4bfe0={'raw':!![],'where':{'id':_0x35a644[_0x3788('0x43')]['id']}},_0x55e7d1={};_0x55e7d1[_0x3788('0x2e')]=_[_0x3788('0x30')](db[_0x3788('0x44')]['rawAttributes']);_0x55e7d1[_0x3788('0x2f')]=_[_0x3788('0x30')](_0x35a644['query']);_0x55e7d1[_0x3788('0x31')]=_['intersection'](_0x55e7d1[_0x3788('0x2e')],_0x55e7d1[_0x3788('0x2f')]);_0xa4bfe0[_0x3788('0x33')]=_['intersection'](_0x55e7d1[_0x3788('0x2e')],qs[_0x3788('0x34')](_0x35a644[_0x3788('0x2f')]['fields']));_0xa4bfe0[_0x3788('0x33')]=_0xa4bfe0[_0x3788('0x33')][_0x3788('0x45')]?_0xa4bfe0[_0x3788('0x33')]:_0x55e7d1[_0x3788('0x2e')];if(_0x35a644[_0x3788('0x2f')][_0x3788('0x3e')]){_0xa4bfe0[_0x3788('0x3f')]=[{'all':!![]}];}_0xa4bfe0=_['merge']({},_0xa4bfe0,_0x35a644[_0x3788('0x3d')]);return db[_0x3788('0x44')][_0x3788('0x46')](_0xa4bfe0)[_0x3788('0x22')](handleEntityNotFound(_0x59d06b,null))['then'](respondWithResult(_0x59d06b,null))[_0x3788('0x42')](handleError(_0x59d06b,null));};exports['create']=function(_0x1bb6ff,_0x3a85b8){return db[_0x3788('0x44')][_0x3788('0x47')](_0x1bb6ff[_0x3788('0x48')],{})['then'](respondWithResult(_0x3a85b8,0xc9))[_0x3788('0x42')](handleError(_0x3a85b8,null));};exports[_0x3788('0x49')]=function(_0x5066cf,_0x14a298){if(_0x5066cf[_0x3788('0x48')]['id']){delete _0x5066cf[_0x3788('0x48')]['id'];}return db[_0x3788('0x44')][_0x3788('0x46')]({'where':{'id':_0x5066cf[_0x3788('0x43')]['id']}})['then'](handleEntityNotFound(_0x14a298,null))[_0x3788('0x22')](saveUpdates(_0x5066cf[_0x3788('0x48')],null))['then'](respondWithResult(_0x14a298,null))['catch'](handleError(_0x14a298,null));};exports['destroy']=function(_0x147215,_0x163026){return db['DeskField'][_0x3788('0x46')]({'where':{'id':_0x147215[_0x3788('0x43')]['id']}})['then'](handleEntityNotFound(_0x163026,null))[_0x3788('0x22')](removeEntity(_0x163026,null))[_0x3788('0x42')](handleError(_0x163026,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c715ae6..d56cb6a 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 _0x1d45=['exports','int_desk_fields','FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dbf98,_0xb3d23a){var _0x6808ce=function(_0x1deed4){while(--_0x1deed4){_0x3dbf98['push'](_0x3dbf98['shift']());}};_0x6808ce(++_0xb3d23a);}(_0x1d45,0x14d));var _0x51d4=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x1d45[_0x5a79e2];return _0x266c45;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x51d4('0x0'));var moment=require(_0x51d4('0x1'));var BPromise=require(_0x51d4('0x2'));var rp=require(_0x51d4('0x3'));var fs=require('fs');var path=require(_0x51d4('0x4'));var rimraf=require(_0x51d4('0x5'));var config=require(_0x51d4('0x6'));var attributes=require('./intDeskField.attributes');module[_0x51d4('0x7')]=function(_0x477544,_0x4048be){return _0x477544['define']('DeskField',attributes,{'tableName':_0x51d4('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x51d4('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42e2=['int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42e2,0x1d7));var _0x242e=function(_0x480cdc,_0x26259c){_0x480cdc=_0x480cdc-0x0;var _0x13b778=_0x42e2[_0x480cdc];return _0x13b778;};'use strict';var _=require(_0x242e('0x0'));var util=require(_0x242e('0x1'));var logger=require(_0x242e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x242e('0x3'));var rp=require(_0x242e('0x4'));var fs=require('fs');var path=require(_0x242e('0x5'));var rimraf=require(_0x242e('0x6'));var config=require('../../config/environment');var attributes=require(_0x242e('0x7'));module[_0x242e('0x8')]=function(_0x376f0f,_0x1e37b){return _0x376f0f[_0x242e('0x9')]('DeskField',attributes,{'tableName':_0x242e('0xa'),'paranoid':![],'indexes':[{'name':_0x242e('0xb'),'fields':[_0x242e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 8e11c20..1c39831 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 _0x71c4=['error','DeskField,\x20%s,\x20%s','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c3ff4,_0x2bcadb){var _0x53c25d=function(_0x4e1568){while(--_0x4e1568){_0x2c3ff4['push'](_0x2c3ff4['shift']());}};_0x53c25d(++_0x2bcadb);}(_0x71c4,0x17f));var _0x471c=function(_0x1e7ea8,_0x3f67ce){_0x1e7ea8=_0x1e7ea8-0x0;var _0x15d204=_0x71c4[_0x1e7ea8];return _0x15d204;};'use strict';var _=require(_0x471c('0x0'));var util=require('util');var moment=require(_0x471c('0x1'));var BPromise=require('bluebird');var rs=require(_0x471c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x471c('0x3'))['db'];var utils=require(_0x471c('0x4'));var logger=require(_0x471c('0x5'))(_0x471c('0x6'));var config=require(_0x471c('0x7'));var jayson=require(_0x471c('0x8'));var client=jayson['client'][_0x471c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d2fcf,_0xebb201,_0x1108ea){return new BPromise(function(_0xebdc71,_0x4efab3){return client[_0x471c('0xa')](_0x3d2fcf,_0x1108ea)[_0x471c('0xb')](function(_0x6c9398){logger[_0x471c('0xc')]('DeskField,\x20%s,\x20%s',_0xebb201,_0x471c('0xd'));logger[_0x471c('0xe')](_0x471c('0xf'),_0xebb201,_0x471c('0xd'),JSON[_0x471c('0x10')](_0x6c9398));if(_0x6c9398[_0x471c('0x11')]){if(_0x6c9398[_0x471c('0x11')]['code']===0x1f4){logger[_0x471c('0x11')](_0x471c('0x12'),_0xebb201,_0x6c9398[_0x471c('0x11')][_0x471c('0x13')]);return _0x4efab3(_0x6c9398[_0x471c('0x11')][_0x471c('0x13')]);}logger['error'](_0x471c('0x12'),_0xebb201,_0x6c9398[_0x471c('0x11')][_0x471c('0x13')]);return _0xebdc71(_0x6c9398[_0x471c('0x11')][_0x471c('0x13')]);}else{logger[_0x471c('0xc')](_0x471c('0x12'),_0xebb201,_0x471c('0xd'));_0xebdc71(_0x6c9398['result'][_0x471c('0x13')]);}})['catch'](function(_0x1bab3b){logger[_0x471c('0x11')]('DeskField,\x20%s,\x20%s',_0xebb201,_0x1bab3b);_0x4efab3(_0x1bab3b);});});} \ No newline at end of file +var _0xb8e7=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','randomstring','ioredis'];(function(_0x24cd48,_0x166b25){var _0x2b8f1c=function(_0x12a002){while(--_0x12a002){_0x24cd48['push'](_0x24cd48['shift']());}};_0x2b8f1c(++_0x166b25);}(_0xb8e7,0x165));var _0x7b8e=function(_0x30fe45,_0x3e20c8){_0x30fe45=_0x30fe45-0x0;var _0x1f7420=_0xb8e7[_0x30fe45];return _0x1f7420;};'use strict';var _=require('lodash');var util=require(_0x7b8e('0x0'));var moment=require(_0x7b8e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b8e('0x2'));var fs=require('fs');var Redis=require(_0x7b8e('0x3'));var db=require(_0x7b8e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b8e('0x5'))(_0x7b8e('0x6'));var config=require(_0x7b8e('0x7'));var jayson=require(_0x7b8e('0x8'));var client=jayson[_0x7b8e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3af945,_0x1150c8,_0x26c0b5){return new BPromise(function(_0x3c3893,_0x269d84){return client[_0x7b8e('0xa')](_0x3af945,_0x26c0b5)['then'](function(_0x47a9a6){logger[_0x7b8e('0xb')](_0x7b8e('0xc'),_0x1150c8,_0x7b8e('0xd'));logger[_0x7b8e('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1150c8,'request\x20sent',JSON[_0x7b8e('0xf')](_0x47a9a6));if(_0x47a9a6['error']){if(_0x47a9a6['error']['code']===0x1f4){logger[_0x7b8e('0x10')](_0x7b8e('0xc'),_0x1150c8,_0x47a9a6[_0x7b8e('0x10')][_0x7b8e('0x11')]);return _0x269d84(_0x47a9a6[_0x7b8e('0x10')][_0x7b8e('0x11')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x1150c8,_0x47a9a6[_0x7b8e('0x10')][_0x7b8e('0x11')]);return _0x3c3893(_0x47a9a6[_0x7b8e('0x10')]['message']);}else{logger[_0x7b8e('0xb')]('DeskField,\x20%s,\x20%s',_0x1150c8,_0x7b8e('0xd'));_0x3c3893(_0x47a9a6[_0x7b8e('0x12')][_0x7b8e('0x11')]);}})['catch'](function(_0x7927e4){logger[_0x7b8e('0x10')]('DeskField,\x20%s,\x20%s',_0x1150c8,_0x7927e4);_0x269d84(_0x7927e4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 655fe01..3e07efa 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 _0xbaf0=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x5e4a6a,_0x287632){var _0xc8879f=function(_0x4a5f5a){while(--_0x4a5f5a){_0x5e4a6a['push'](_0x5e4a6a['shift']());}};_0xc8879f(++_0x287632);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['addConfiguration']);router['put'](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x13')]);router[_0x0baf('0x14')]('/:id',auth[_0x0baf('0x9')](),controller['destroy']);module[_0x0baf('0x15')]=router; \ No newline at end of file +var _0x0b0e=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x536256,_0x237fb5){_0x536256=_0x536256-0x0;var _0x1675f7=_0x0b0e[_0x536256];return _0x1675f7;};'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 auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getFields']);router[_0xe0b0('0xf')]('/',auth[_0xe0b0('0x9')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['addConfiguration']);router[_0xe0b0('0x10')](_0xe0b0('0xb'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x12')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x13')]);module[_0xe0b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d06f5e6..b28b647 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 _0x907a=['STRING','exports'];(function(_0xff63d8,_0xc4350b){var _0x36d60d=function(_0x32c4da){while(--_0x32c4da){_0xff63d8['push'](_0xff63d8['shift']());}};_0x36d60d(++_0xc4350b);}(_0x907a,0x179));var _0xa907=function(_0x1be833,_0x1a9d40){_0x1be833=_0x1be833-0x0;var _0x19dfda=_0x907a[_0x1be833];return _0x19dfda;};'use strict';var Sequelize=require('sequelize');module[_0xa907('0x0')]={'name':{'type':Sequelize[_0xa907('0x1')]},'username':{'type':Sequelize[_0xa907('0x1')]},'password':{'type':Sequelize[_0xa907('0x1')]},'remoteUri':{'type':Sequelize[_0xa907('0x1')]},'tenantId':{'type':Sequelize[_0xa907('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa907('0x1')]},'serverUrl':{'type':Sequelize[_0xa907('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa907('0x1')]}}; \ No newline at end of file +var _0x251c=['STRING','sequelize'];(function(_0x425ba5,_0x11e5c6){var _0x2adb40=function(_0x6acb12){while(--_0x6acb12){_0x425ba5['push'](_0x425ba5['shift']());}};_0x2adb40(++_0x11e5c6);}(_0x251c,0x69));var _0xc251=function(_0x100567,_0x43efb5){_0x100567=_0x100567-0x0;var _0xfd1b0d=_0x251c[_0x100567];return _0xfd1b0d;};'use strict';var Sequelize=require(_0xc251('0x0'));module['exports']={'name':{'type':Sequelize[_0xc251('0x1')]},'username':{'type':Sequelize[_0xc251('0x1')]},'password':{'type':Sequelize[_0xc251('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc251('0x1')]},'clientSecret':{'type':Sequelize[_0xc251('0x1')]},'serverUrl':{'type':Sequelize[_0xc251('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1fc4d55..aedcfe0 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 _0x9c5a=['push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','Dynamics365Account','findAll','rows','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','description','customerid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','responseby','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','PicklistAttributeMetadata'];(function(_0xbfe450,_0x32c49b){var _0x16aa8=function(_0x5a4f69){while(--_0x5a4f69){_0xbfe450['push'](_0xbfe450['shift']());}};_0x16aa8(++_0x32c49b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x632cce,_0x59afee){_0x632cce=_0x632cce-0x0;var _0x2093d0=_0x9c5a[_0x632cce];return _0x2093d0;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];var integrations=require(_0xa9c5('0x17'));var jayson=require(_0xa9c5('0x18'));var client=jayson[_0xa9c5('0x19')][_0xa9c5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5915ad,_0x390ca2,_0x1276d2,_0x7df76d){return new BPromise(function(_0x3806c4,_0x418ca5){var _0x1dad66=_0x7df76d||client;return _0x1dad66[_0xa9c5('0x1b')](_0x5915ad,_0x1276d2)[_0xa9c5('0x1c')](function(_0x19a43e){logger[_0xa9c5('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x390ca2,_0xa9c5('0x1e'));logger[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x390ca2,'request\x20sent',JSON[_0xa9c5('0x21')](_0x19a43e));if(_0x19a43e[_0xa9c5('0x22')]){if(_0x19a43e[_0xa9c5('0x22')][_0xa9c5('0x23')]===0x1f4){logger[_0xa9c5('0x22')](_0xa9c5('0x24'),_0x390ca2,_0x19a43e[_0xa9c5('0x22')][_0xa9c5('0x25')]);return _0x418ca5(_0x19a43e[_0xa9c5('0x22')][_0xa9c5('0x25')]);}logger[_0xa9c5('0x22')](_0xa9c5('0x24'),_0x390ca2,_0x19a43e['error'][_0xa9c5('0x25')]);return _0x3806c4(_0x19a43e[_0xa9c5('0x22')]['message']);}else{logger['info'](_0xa9c5('0x24'),_0x390ca2,_0xa9c5('0x1e'));_0x3806c4(_0x19a43e[_0xa9c5('0x26')][_0xa9c5('0x25')]);}})[_0xa9c5('0x27')](function(_0xd4b8a1){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x390ca2,_0xd4b8a1);_0x418ca5(_0xd4b8a1);});});}function respondWithStatusCode(_0x3d4e1b,_0x11d395){_0x11d395=_0x11d395||0xcc;return function(_0x4b0f05){if(_0x4b0f05){return _0x3d4e1b[_0xa9c5('0x28')](_0x11d395);}return _0x3d4e1b[_0xa9c5('0x29')](_0x11d395)[_0xa9c5('0x2a')]();};}function respondWithResult(_0x32fc7d,_0x4cbba1){_0x4cbba1=_0x4cbba1||0xc8;return function(_0x40f08b){if(_0x40f08b){return _0x32fc7d[_0xa9c5('0x29')](_0x4cbba1)['json'](_0x40f08b);}};}function respondWithFilteredResult(_0x4e8a7f,_0x242771){return function(_0x4cd5e6){if(_0x4cd5e6){var _0x1762ac=_0x4cd5e6[_0xa9c5('0x2b')],_0x830bad=_0x242771['offset'],_0x4caefa=_0x242771[_0xa9c5('0x2c')]+_0x242771[_0xa9c5('0x2d')],_0x11a723;if(_0x4caefa>=_0x1762ac){_0x4caefa=_0x1762ac;_0x11a723=0xc8;}else{_0x11a723=0xce;}_0x4e8a7f[_0xa9c5('0x29')](_0x11a723);return _0x4e8a7f[_0xa9c5('0x2e')](_0xa9c5('0x2f'),_0x830bad+'-'+_0x4caefa+'/'+_0x1762ac)['json'](_0x4cd5e6);}return null;};}function patchUpdates(_0x36f267){return function(_0x4cee90){try{jsonpatch[_0xa9c5('0x30')](_0x4cee90,_0x36f267,!![]);}catch(_0x1ef388){return BPromise[_0xa9c5('0x31')](_0x1ef388);}return _0x4cee90['save']();};}function saveUpdates(_0xc6d0c1,_0xbe29c5){return function(_0x5bc9bb){if(_0x5bc9bb){return _0x5bc9bb[_0xa9c5('0x32')](_0xc6d0c1)[_0xa9c5('0x1c')](function(_0x431e07){return _0x431e07;});}return null;};}function removeEntity(_0x378684,_0x22ee21){return function(_0x3392d0){if(_0x3392d0){return _0x3392d0[_0xa9c5('0x33')]()['then'](function(){_0x378684[_0xa9c5('0x29')](0xcc)[_0xa9c5('0x2a')]();});}};}function handleEntityNotFound(_0xf4a9f3,_0x1c01f9){return function(_0x1c617c){if(!_0x1c617c){_0xf4a9f3[_0xa9c5('0x28')](0x194);}return _0x1c617c;};}function handleError(_0x226427,_0x36b599){_0x36b599=_0x36b599||0x1f4;return function(_0x57ebb7){logger['error'](_0x57ebb7[_0xa9c5('0x34')]);if(_0x57ebb7[_0xa9c5('0x35')]){delete _0x57ebb7[_0xa9c5('0x35')];}_0x226427[_0xa9c5('0x29')](_0x36b599)[_0xa9c5('0x36')](_0x57ebb7);};}exports[_0xa9c5('0x37')]=function(_0x4dfdb5,_0x598920){var _0x517b9a={},_0x314010={},_0x27d614={'count':0x0,'rows':[]};var _0x5087e4=_[_0xa9c5('0x38')](db['Dynamics365Account'][_0xa9c5('0x39')],function(_0x1fc8bf){return{'name':_0x1fc8bf[_0xa9c5('0x3a')],'type':_0x1fc8bf[_0xa9c5('0x3b')]['key']};});_0x314010[_0xa9c5('0x3c')]=_[_0xa9c5('0x38')](_0x5087e4,_0xa9c5('0x35'));_0x314010[_0xa9c5('0x3d')]=_[_0xa9c5('0x3e')](_0x4dfdb5[_0xa9c5('0x3d')]);_0x314010[_0xa9c5('0x3f')]=_[_0xa9c5('0x40')](_0x314010['model'],_0x314010[_0xa9c5('0x3d')]);_0x517b9a[_0xa9c5('0x41')]=_[_0xa9c5('0x40')](_0x314010[_0xa9c5('0x3c')],qs[_0xa9c5('0x42')](_0x4dfdb5[_0xa9c5('0x3d')]['fields']));_0x517b9a[_0xa9c5('0x41')]=_0x517b9a['attributes'][_0xa9c5('0x43')]?_0x517b9a['attributes']:_0x314010[_0xa9c5('0x3c')];if(!_0x4dfdb5[_0xa9c5('0x3d')][_0xa9c5('0x44')]('nolimit')){_0x517b9a[_0xa9c5('0x2d')]=qs[_0xa9c5('0x2d')](_0x4dfdb5[_0xa9c5('0x3d')][_0xa9c5('0x2d')]);_0x517b9a['offset']=qs[_0xa9c5('0x2c')](_0x4dfdb5[_0xa9c5('0x3d')][_0xa9c5('0x2c')]);}_0x517b9a[_0xa9c5('0x45')]=qs[_0xa9c5('0x46')](_0x4dfdb5['query'][_0xa9c5('0x46')]);_0x517b9a['where']=qs[_0xa9c5('0x3f')](_[_0xa9c5('0x47')](_0x4dfdb5[_0xa9c5('0x3d')],_0x314010[_0xa9c5('0x3f')]),_0x5087e4);if(_0x4dfdb5[_0xa9c5('0x3d')][_0xa9c5('0x48')]){_0x517b9a[_0xa9c5('0x49')]=_[_0xa9c5('0x4a')](_0x517b9a[_0xa9c5('0x49')],{'$or':_[_0xa9c5('0x38')](_0x5087e4,function(_0x4aa4dd){if(_0x4aa4dd[_0xa9c5('0x3b')]!==_0xa9c5('0x4b')){var _0xc98cca={};_0xc98cca[_0x4aa4dd[_0xa9c5('0x35')]]={'$like':'%'+_0x4dfdb5[_0xa9c5('0x3d')][_0xa9c5('0x48')]+'%'};return _0xc98cca;}})});}_0x517b9a=_['merge']({},_0x517b9a,_0x4dfdb5[_0xa9c5('0x4c')]);var _0x2ba81e={'where':_0x517b9a['where']};return db['Dynamics365Account']['count'](_0x2ba81e)['then'](function(_0x4e97bf){_0x27d614[_0xa9c5('0x2b')]=_0x4e97bf;if(_0x4dfdb5[_0xa9c5('0x3d')][_0xa9c5('0x4d')]){_0x517b9a[_0xa9c5('0x4e')]=[{'all':!![]}];}return db[_0xa9c5('0x4f')][_0xa9c5('0x50')](_0x517b9a);})[_0xa9c5('0x1c')](function(_0x5b00a6){_0x27d614[_0xa9c5('0x51')]=_0x5b00a6;return _0x27d614;})[_0xa9c5('0x1c')](respondWithFilteredResult(_0x598920,_0x517b9a))[_0xa9c5('0x27')](handleError(_0x598920,null));};exports[_0xa9c5('0x52')]=function(_0x1c2ccf,_0x4bf8b4){var _0x1108f0={'raw':![],'where':{'id':_0x1c2ccf[_0xa9c5('0x53')]['id']}},_0x5e17f4={};_0x5e17f4[_0xa9c5('0x3c')]=_['keys'](db['Dynamics365Account'][_0xa9c5('0x39')]);_0x5e17f4[_0xa9c5('0x3d')]=_[_0xa9c5('0x3e')](_0x1c2ccf['query']);_0x5e17f4['filters']=_[_0xa9c5('0x40')](_0x5e17f4[_0xa9c5('0x3c')],_0x5e17f4['query']);_0x1108f0[_0xa9c5('0x41')]=_[_0xa9c5('0x40')](_0x5e17f4[_0xa9c5('0x3c')],qs[_0xa9c5('0x42')](_0x1c2ccf[_0xa9c5('0x3d')][_0xa9c5('0x42')]));_0x1108f0['attributes']=_0x1108f0['attributes']['length']?_0x1108f0[_0xa9c5('0x41')]:_0x5e17f4[_0xa9c5('0x3c')];if(_0x1c2ccf[_0xa9c5('0x3d')][_0xa9c5('0x4d')]){_0x1108f0[_0xa9c5('0x4e')]=[{'all':!![]}];}_0x1108f0=_[_0xa9c5('0x4a')]({},_0x1108f0,_0x1c2ccf['options']);return db[_0xa9c5('0x4f')][_0xa9c5('0x54')](_0x1108f0)[_0xa9c5('0x1c')](handleEntityNotFound(_0x4bf8b4,null))[_0xa9c5('0x1c')](respondWithResult(_0x4bf8b4,null))[_0xa9c5('0x27')](handleError(_0x4bf8b4,null));};exports[_0xa9c5('0x55')]=function(_0x547654,_0x4fcc44){return db[_0xa9c5('0x4f')]['create'](_0x547654[_0xa9c5('0x56')],{})['then'](respondWithResult(_0x4fcc44,0xc9))[_0xa9c5('0x27')](handleError(_0x4fcc44,null));};exports[_0xa9c5('0x32')]=function(_0x23abfc,_0x5c7d7c){if(_0x23abfc[_0xa9c5('0x56')]['id']){delete _0x23abfc[_0xa9c5('0x56')]['id'];}return db[_0xa9c5('0x4f')][_0xa9c5('0x54')]({'where':{'id':_0x23abfc['params']['id']}})['then'](handleEntityNotFound(_0x5c7d7c,null))[_0xa9c5('0x1c')](saveUpdates(_0x23abfc[_0xa9c5('0x56')],null))[_0xa9c5('0x1c')](respondWithResult(_0x5c7d7c,null))['catch'](handleError(_0x5c7d7c,null));};exports[_0xa9c5('0x33')]=function(_0x867922,_0x3d3c04){return db[_0xa9c5('0x4f')][_0xa9c5('0x54')]({'where':{'id':_0x867922[_0xa9c5('0x53')]['id']}})[_0xa9c5('0x1c')](handleEntityNotFound(_0x3d3c04,null))[_0xa9c5('0x1c')](removeEntity(_0x3d3c04,null))['catch'](handleError(_0x3d3c04,null));};exports[_0xa9c5('0x57')]=function(_0x5a9d4f,_0x1c5aab,_0x2b9d39){var _0x26bda1={};var _0x4dfe3a={};var _0x4d475a;var _0x1dd3b2;return db['Dynamics365Account'][_0xa9c5('0x58')]({'where':{'id':_0x5a9d4f[_0xa9c5('0x53')]['id']}})[_0xa9c5('0x1c')](handleEntityNotFound(_0x1c5aab,null))[_0xa9c5('0x1c')](function(_0x49f91c){if(_0x49f91c){_0x4d475a=_0x49f91c;_0x4dfe3a[_0xa9c5('0x3c')]=_[_0xa9c5('0x3e')](db[_0xa9c5('0x59')][_0xa9c5('0x39')]);_0x4dfe3a['query']=_['keys'](_0x5a9d4f[_0xa9c5('0x3d')]);_0x4dfe3a[_0xa9c5('0x3f')]=_[_0xa9c5('0x40')](_0x4dfe3a[_0xa9c5('0x3c')],_0x4dfe3a[_0xa9c5('0x3d')]);_0x26bda1[_0xa9c5('0x41')]=_['intersection'](_0x4dfe3a[_0xa9c5('0x3c')],qs[_0xa9c5('0x42')](_0x5a9d4f[_0xa9c5('0x3d')][_0xa9c5('0x42')]));_0x26bda1[_0xa9c5('0x41')]=_0x26bda1[_0xa9c5('0x41')][_0xa9c5('0x43')]?_0x26bda1[_0xa9c5('0x41')]:_0x4dfe3a[_0xa9c5('0x3c')];_0x26bda1[_0xa9c5('0x45')]=qs['sort'](_0x5a9d4f['query'][_0xa9c5('0x46')]);_0x26bda1[_0xa9c5('0x49')]=qs[_0xa9c5('0x3f')](_[_0xa9c5('0x47')](_0x5a9d4f['query'],_0x4dfe3a[_0xa9c5('0x3f')]));if(_0x5a9d4f['query'][_0xa9c5('0x48')]){_0x26bda1[_0xa9c5('0x49')]=_[_0xa9c5('0x4a')](_0x26bda1[_0xa9c5('0x49')],{'$or':_[_0xa9c5('0x38')](_0x26bda1[_0xa9c5('0x41')],function(_0xfd6ecf){var _0x3890b4={};_0x3890b4[_0xfd6ecf]={'$like':'%'+_0x5a9d4f[_0xa9c5('0x3d')][_0xa9c5('0x48')]+'%'};return _0x3890b4;})});}_0x26bda1=_[_0xa9c5('0x4a')]({},_0x26bda1,_0x5a9d4f[_0xa9c5('0x4c')]);return _0x4d475a['getConfigurations'](_0x26bda1);}})[_0xa9c5('0x1c')](function(_0x1a4aa7){if(_0x1a4aa7){_0x1dd3b2=_0x1a4aa7[_0xa9c5('0x43')];if(!_0x5a9d4f[_0xa9c5('0x3d')][_0xa9c5('0x44')](_0xa9c5('0x5a'))){_0x26bda1[_0xa9c5('0x2d')]=qs['limit'](_0x5a9d4f['query'][_0xa9c5('0x2d')]);_0x26bda1['offset']=qs[_0xa9c5('0x2c')](_0x5a9d4f[_0xa9c5('0x3d')]['offset']);}return _0x4d475a[_0xa9c5('0x57')](_0x26bda1);}})[_0xa9c5('0x1c')](function(_0x5c5e1c){if(_0x5c5e1c){return _0x5c5e1c?{'count':_0x1dd3b2,'rows':_0x5c5e1c}:null;}})['then'](respondWithResult(_0x1c5aab,null))[_0xa9c5('0x27')](handleError(_0x1c5aab,null));};exports[_0xa9c5('0x5b')]=function(_0x22af29,_0x514f3d,_0x4a2bce){if(_0x22af29[_0xa9c5('0x56')]['id']){delete _0x22af29[_0xa9c5('0x56')]['id'];}return db['Dynamics365Account'][_0xa9c5('0x58')]({'where':{'id':_0x22af29[_0xa9c5('0x53')]['id']}})[_0xa9c5('0x1c')](handleEntityNotFound(_0x514f3d,null))[_0xa9c5('0x1c')](function(_0x135791){if(_0x135791){_0x22af29[_0xa9c5('0x56')]['AccountId']=_0x135791['id'];_0x22af29[_0xa9c5('0x56')][_0xa9c5('0x5c')]=integrations[_0xa9c5('0x5d')](_0x22af29[_0xa9c5('0x56')]['channel'],_0x22af29[_0xa9c5('0x56')][_0xa9c5('0x3b')]);_0x22af29['body'][_0xa9c5('0x5e')]=integrations[_0xa9c5('0x5f')](_0x22af29[_0xa9c5('0x56')]['channel'],_0x22af29[_0xa9c5('0x56')][_0xa9c5('0x3b')]);return db[_0xa9c5('0x59')][_0xa9c5('0x55')](_0x22af29[_0xa9c5('0x56')],{'include':[{'model':db[_0xa9c5('0x60')],'as':_0xa9c5('0x5c')},{'model':db['Dynamics365Field'],'as':_0xa9c5('0x5e')}]});}return null;})[_0xa9c5('0x1c')](respondWithResult(_0x514f3d,null))[_0xa9c5('0x27')](handleError(_0x514f3d,null));};exports[_0xa9c5('0x61')]=function(_0x427817,_0x42b1d7,_0x39fae1){var _0x390d0b=_0x427817[_0xa9c5('0x3d')][_0xa9c5('0x62')];var _0x2f350e=_0x390d0b==='incident'?_0xa9c5('0x63'):_0xa9c5('0x64');var _0x573a67='';var _0x2a0a94='';var _0x28e7d6='';var _0x1dc6b6='';var _0x5844aa='';var _0x27bcc0='';var _0x282f84='';var _0x22dfd7='';var _0x30d747=['title',_0xa9c5('0x65'),_0xa9c5('0x66'),'ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];var _0x54c8f5=[_0xa9c5('0x67'),_0xa9c5('0x68'),_0xa9c5('0x69'),_0xa9c5('0x6a'),_0xa9c5('0x6b'),'contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname',_0xa9c5('0x6c'),_0xa9c5('0x6d'),_0xa9c5('0x6e'),_0xa9c5('0x6f'),'createdonbehalfbyname','createdonbehalfbyyominame',_0xa9c5('0x70'),_0xa9c5('0x71'),_0xa9c5('0x72'),_0xa9c5('0x73'),_0xa9c5('0x74'),'entityimage_timestamp',_0xa9c5('0x75'),_0xa9c5('0x76'),_0xa9c5('0x77'),'firstresponsebykpiidname',_0xa9c5('0x78'),_0xa9c5('0x79'),_0xa9c5('0x7a'),_0xa9c5('0x7b'),'lastonholdtime',_0xa9c5('0x7c'),_0xa9c5('0x7d'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xa9c5('0x7e'),'modifiedon','modifiedonbehalfbyname',_0xa9c5('0x7f'),_0xa9c5('0x80'),_0xa9c5('0x81'),_0xa9c5('0x82'),_0xa9c5('0x83'),'overriddencreatedon',_0xa9c5('0x84'),'owneridtype',_0xa9c5('0x85'),_0xa9c5('0x86'),_0xa9c5('0x87'),_0xa9c5('0x88'),'prioritycodename','productidname',_0xa9c5('0x89'),'resolveby','resolvebykpiidname',_0xa9c5('0x8a'),_0xa9c5('0x8b'),'responsiblecontactidyominame','sentimentvalue',_0xa9c5('0x8c'),_0xa9c5('0x8d'),_0xa9c5('0x8e'),_0xa9c5('0x8f'),'statuscode','subjectidname',_0xa9c5('0x90'),_0xa9c5('0x91'),_0xa9c5('0x92'),_0xa9c5('0x93'),_0xa9c5('0x94'),_0xa9c5('0x95')];var _0x3d4644=_0x30d747['concat'](_0x54c8f5);return db[_0xa9c5('0x4f')][_0xa9c5('0x58')]({'where':{'id':_0x427817['params']['id']},'attributes':['id',_0xa9c5('0x96'),_0xa9c5('0x97'),'remoteUri',_0xa9c5('0x98'),_0xa9c5('0x99'),_0xa9c5('0x9a')]})[_0xa9c5('0x1c')](handleEntityNotFound(_0x42b1d7,null))[_0xa9c5('0x1c')](function(_0x35a424){if(_0x35a424){_0x22dfd7=_0x35a424[_0xa9c5('0x9b')];var _0x13e233=_0x22dfd7[_0xa9c5('0x9c')](-0x1);if(_0x13e233==='/'){_0x22dfd7=_0x22dfd7[_0xa9c5('0x9d')](0x0,_0x22dfd7[_0xa9c5('0x9e')](_0x13e233));}_0x282f84=util[_0xa9c5('0x9f')](_0xa9c5('0xa0'),_0x22dfd7);var _0x18db93={'method':_0xa9c5('0xa1'),'uri':_0xa9c5('0xa2')+_0x35a424[_0xa9c5('0x98')]+'/oauth2/token','form':{'client_id':_0x35a424[_0xa9c5('0x99')],'resource':_0x22dfd7,'username':_0x35a424[_0xa9c5('0x96')],'password':_0x35a424[_0xa9c5('0x97')],'grant_type':'password','client_secret':_0x35a424[_0xa9c5('0x9a')]},'json':!![]};return rp(_0x18db93);}})[_0xa9c5('0x1c')](function(_0x498721){_0x27bcc0=_0x498721[_0xa9c5('0xa3')];var _0x3f09b7={'method':_0xa9c5('0xa4'),'uri':encodeURI(_0x282f84+_0xa9c5('0xa5')+_0x2f350e+'\x27'),'headers':{'Authorization':_0xa9c5('0xa6')+_0x27bcc0,'If-None-Match':null,'OData-Version':_0xa9c5('0xa7')},'json':!![]};return rp(_0x3f09b7);})[_0xa9c5('0x1c')](function(_0x2704e6){var _0xe30a70=_0x2704e6[_0xa9c5('0xa8')][0x0];var _0x559627=_0xe30a70[_0xa9c5('0xa9')];var _0xf8f816={'method':'GET','uri':_0x282f84+'EntityDefinitions('+_0x559627+_0xa9c5('0xaa'),'headers':{'Authorization':_0xa9c5('0xa6')+_0x27bcc0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf8f816);})[_0xa9c5('0x1c')](function(_0x358607){_0x573a67=_0x358607;_0x2a0a94=_0x573a67[_0xa9c5('0xab')];_0x2a0a94=_[_0xa9c5('0xac')](_0x2a0a94,function(_0x5d734d){return!_0x3d4644['includes'](_0x5d734d[_0xa9c5('0xad')]);});var _0x22c480=[];var _0x457158=[];_0x2a0a94['forEach'](function(_0x2de85d){if(_0x2de85d[_0xa9c5('0xae')]){var _0x254153=_0x2de85d['@odata.type'][_0xa9c5('0x9d')](_0x2de85d[_0xa9c5('0xae')][_0xa9c5('0x9e')]('.')+0x1);if(_0x254153===_0xa9c5('0xaf')){_0x22c480[_0xa9c5('0xb0')](getSelectList(_0x282f84,_0x390d0b,_0x457158,_0x573a67[_0xa9c5('0xa9')],_0x2de85d[_0xa9c5('0xa9')],_0x27bcc0));}}});return Promise[_0xa9c5('0xb1')](_0x22c480);})[_0xa9c5('0x1c')](function(_0x13ac1f){_0x28e7d6=_0x13ac1f[0x0];var _0x133a2c=[];var _0x39ae69=[];_0x2a0a94[_0xa9c5('0xb2')](function(_0xee5c9a){if(!_[_0xa9c5('0xb3')](_0xee5c9a['@odata.type'])){var _0x48baf5=_0xee5c9a['@odata.type'][_0xa9c5('0x9d')](_0xee5c9a[_0xa9c5('0xae')]['lastIndexOf']('.')+0x1);if(_0x48baf5===_0xa9c5('0xb4')){_0x133a2c[_0xa9c5('0xb0')](getBooleanList(_0x282f84,_0x390d0b,_0x39ae69,_0x573a67['MetadataId'],_0xee5c9a[_0xa9c5('0xa9')],_0x27bcc0));}}});return Promise[_0xa9c5('0xb1')](_0x133a2c);})[_0xa9c5('0x1c')](function(_0x318931){_0x1dc6b6=_0x318931[0x0];var _0x3f2897=[];var _0x4aa0ba=[];_0x2a0a94[_0xa9c5('0xb2')](function(_0xcd70eb){if(_0xcd70eb[_0xa9c5('0xae')]){var _0x3f15d4=_0xcd70eb[_0xa9c5('0xae')][_0xa9c5('0x9d')](_0xcd70eb[_0xa9c5('0xae')][_0xa9c5('0x9e')]('.')+0x1);if(_0x3f15d4===_0xa9c5('0xb5')||_0x3f15d4===_0xa9c5('0xb6')||_0x3f15d4===_0xa9c5('0xb7')||_0x3f15d4===_0xa9c5('0xb8')||_0x3f15d4===_0xa9c5('0xb9')||_0x3f15d4==='DateTimeAttributeMetadata'||_0x3f15d4==='StatusAttributeMetadata'||_0x3f15d4===_0xa9c5('0xba')||_0x3f15d4===_0xa9c5('0xbb')||_0x3f15d4===_0xa9c5('0xbc')){_0x3f2897[_0xa9c5('0xb0')](getInputList(_0x282f84,_0x390d0b,_0x3f15d4,_0x4aa0ba,_0x573a67['MetadataId'],_0xcd70eb[_0xa9c5('0xa9')],_0x27bcc0));}}});return Promise['all'](_0x3f2897);})['then'](function(_0x49e44e){_0x5844aa=_0x49e44e[0x0];var _0x171d12=_0x28e7d6[_0xa9c5('0xbd')](_0x1dc6b6)['concat'](_0x5844aa);var _0x2021d4={'count':_0x171d12[_0xa9c5('0x43')],'rows':_0x171d12};return _0x2021d4;})[_0xa9c5('0x1c')](respondWithResult(_0x42b1d7,null))[_0xa9c5('0x27')](function(_0x156f7a){var _0x3a98d=_0x427817[_0xa9c5('0x3d')]['test']?0x1f4:_0x156f7a[_0xa9c5('0xbe')]||0x1f4;logger['error'](_0x156f7a[_0xa9c5('0x34')]);delete _0x156f7a[_0xa9c5('0x35')];if(_0x3a98d===0x191){_0x3a98d=0x190;}_0x42b1d7[_0xa9c5('0x29')](_0x3a98d)[_0xa9c5('0x36')](_0x427817[_0xa9c5('0x3d')][_0xa9c5('0xbf')]?{'message':_0xa9c5('0xc0'),'statusCode':_0x156f7a[_0xa9c5('0xbe')]}:_0x156f7a);});};function getSelectList(_0x4b7ae9,_0x1d6d77,_0x517111,_0x4453b6,_0x5a6c2a,_0x3a357a){var _0x1629df={'method':_0xa9c5('0xa4'),'uri':_0x4b7ae9+_0xa9c5('0xc1')+_0x4453b6+_0xa9c5('0xc2')+_0x5a6c2a+_0xa9c5('0xc3')+_0xa9c5('0xc4'),'headers':{'Authorization':_0xa9c5('0xa6')+_0x3a357a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1629df)['then'](function(_0x3fd556){var _0x272510=[];var _0x33a649=_0x3fd556[_0xa9c5('0xc5')]['Options'];_0x33a649['forEach'](function(_0x214caa){_0x272510[_0xa9c5('0xb0')]({'name':_0x214caa[_0xa9c5('0xc6')][_0xa9c5('0xc7')][_0xa9c5('0xc6')],'value':String(_0x214caa[_0xa9c5('0xc8')])});});var _0x15394a={'id':_0x1d6d77+'_'+_0x3fd556[_0xa9c5('0xad')],'name':_0x3fd556[_0xa9c5('0xc9')]['UserLocalizedLabel'][_0xa9c5('0xc6')],'custom':![],'options':_0x272510};_0x517111[_0xa9c5('0xb0')](_0x15394a);return _0x517111;});}function getBooleanList(_0x1ae5c5,_0x351c4d,_0x83042,_0x71cb30,_0x27d7ca,_0x42e803){var _0xf77e11={'method':_0xa9c5('0xa4'),'uri':_0x1ae5c5+_0xa9c5('0xc1')+_0x71cb30+_0xa9c5('0xc2')+_0x27d7ca+_0xa9c5('0xca'),'headers':{'Authorization':_0xa9c5('0xa6')+_0x42e803,'If-None-Match':null,'OData-Version':_0xa9c5('0xa7')},'json':!![]};return rp(_0xf77e11)['then'](function(_0x8c1fa1){var _0x181698=[];_0x181698[_0xa9c5('0xb0')]({'name':_0x8c1fa1['OptionSet'][_0xa9c5('0xcb')]['Label'][_0xa9c5('0xc7')][_0xa9c5('0xc6')],'value':_0xa9c5('0xcc')},{'name':_0x8c1fa1[_0xa9c5('0xc5')][_0xa9c5('0xcd')][_0xa9c5('0xc6')][_0xa9c5('0xc7')][_0xa9c5('0xc6')],'value':_0xa9c5('0xce')});var _0x4dfb6c={'id':_0x351c4d+'_'+_0x8c1fa1[_0xa9c5('0xad')],'name':_0x8c1fa1[_0xa9c5('0xc9')][_0xa9c5('0xc7')][_0xa9c5('0xc6')],'custom':![],'options':_0x181698};_0x83042[_0xa9c5('0xb0')](_0x4dfb6c);return _0x83042;});}function getInputList(_0x5d07cd,_0x2b5403,_0x3c11df,_0x3ab370,_0x9b645b,_0x477a10,_0x49c4a3){var _0x35a369={'method':'GET','uri':_0x5d07cd+_0xa9c5('0xc1')+_0x9b645b+_0xa9c5('0xc2')+_0x477a10+_0xa9c5('0xcf')+_0x3c11df+_0xa9c5('0xd0'),'headers':{'Authorization':_0xa9c5('0xa6')+_0x49c4a3,'If-None-Match':null,'OData-Version':_0xa9c5('0xa7')},'json':!![]};return rp(_0x35a369)[_0xa9c5('0x1c')](function(_0x35b8c9){var _0x1fdc93={'id':_0x2b5403+'_'+_0x35b8c9[_0xa9c5('0xad')],'name':_0x35b8c9[_0xa9c5('0xc9')][_0xa9c5('0xc7')]?_0x35b8c9[_0xa9c5('0xc9')][_0xa9c5('0xc7')][_0xa9c5('0xc6')]:_0x35b8c9[_0xa9c5('0xad')],'custom':![],'options':[]};_0x3ab370[_0xa9c5('0xb0')](_0x1fdc93);return _0x3ab370;});} \ No newline at end of file +var _0xfcf0=['createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','tenantId','clientId','clientSecret','remoteUri','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','Bearer\x20','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','EntityDefinitions(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','map','fieldName','type','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Dynamics365Account','findAll','rows','show','keys','rawAttributes','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','title','description','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon'];(function(_0x526ab2,_0x4dcd7f){var _0x18f722=function(_0x46e277){while(--_0x46e277){_0x526ab2['push'](_0x526ab2['shift']());}};_0x18f722(++_0x4dcd7f);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0xfcf0[_0x1943d9];return _0x4b4f3f;};'use strict';var pdf=require(_0x0fcf('0x0'));var emlformat=require(_0x0fcf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0fcf('0x2'));var jsonpatch=require(_0x0fcf('0x3'));var rp=require(_0x0fcf('0x4'));var moment=require(_0x0fcf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0fcf('0x6'));var util=require(_0x0fcf('0x7'));var path=require(_0x0fcf('0x8'));var sox=require(_0x0fcf('0x9'));var csv=require(_0x0fcf('0xa'));var ejs=require(_0x0fcf('0xb'));var fs=require('fs');var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0xa'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];var integrations=require(_0x0fcf('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x0fcf('0x19')][_0x0fcf('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x160d2c,_0x26b169,_0x25fadc,_0x48bba6){return new BPromise(function(_0xa32692,_0x3701c9){var _0x1fcb47=_0x48bba6||client;return _0x1fcb47['request'](_0x160d2c,_0x25fadc)[_0x0fcf('0x1b')](function(_0x610106){logger[_0x0fcf('0x1c')](_0x0fcf('0x1d'),_0x26b169,'request\x20sent');logger[_0x0fcf('0x1e')](_0x0fcf('0x1f'),_0x26b169,_0x0fcf('0x20'),JSON[_0x0fcf('0x21')](_0x610106));if(_0x610106[_0x0fcf('0x22')]){if(_0x610106['error'][_0x0fcf('0x23')]===0x1f4){logger[_0x0fcf('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x26b169,_0x610106[_0x0fcf('0x22')][_0x0fcf('0x24')]);return _0x3701c9(_0x610106['error'][_0x0fcf('0x24')]);}logger['error'](_0x0fcf('0x1d'),_0x26b169,_0x610106[_0x0fcf('0x22')]['message']);return _0xa32692(_0x610106[_0x0fcf('0x22')][_0x0fcf('0x24')]);}else{logger[_0x0fcf('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x26b169,_0x0fcf('0x20'));_0xa32692(_0x610106[_0x0fcf('0x25')][_0x0fcf('0x24')]);}})[_0x0fcf('0x26')](function(_0x18af5c){logger[_0x0fcf('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x26b169,_0x18af5c);_0x3701c9(_0x18af5c);});});}function respondWithStatusCode(_0x2eef74,_0x253641){_0x253641=_0x253641||0xcc;return function(_0x6021b4){if(_0x6021b4){return _0x2eef74[_0x0fcf('0x27')](_0x253641);}return _0x2eef74[_0x0fcf('0x28')](_0x253641)[_0x0fcf('0x29')]();};}function respondWithResult(_0x2ce990,_0x18f269){_0x18f269=_0x18f269||0xc8;return function(_0x117510){if(_0x117510){return _0x2ce990['status'](_0x18f269)[_0x0fcf('0x2a')](_0x117510);}};}function respondWithFilteredResult(_0xc107a,_0x41b7a2){return function(_0x2f198b){if(_0x2f198b){var _0x3876ed=_0x2f198b[_0x0fcf('0x2b')],_0x38fe0e=_0x41b7a2[_0x0fcf('0x2c')],_0x2730b0=_0x41b7a2[_0x0fcf('0x2c')]+_0x41b7a2[_0x0fcf('0x2d')],_0x527d43;if(_0x2730b0>=_0x3876ed){_0x2730b0=_0x3876ed;_0x527d43=0xc8;}else{_0x527d43=0xce;}_0xc107a['status'](_0x527d43);return _0xc107a['set']('Content-Range',_0x38fe0e+'-'+_0x2730b0+'/'+_0x3876ed)[_0x0fcf('0x2a')](_0x2f198b);}return null;};}function patchUpdates(_0x50b7df){return function(_0x26c3bc){try{jsonpatch[_0x0fcf('0x2e')](_0x26c3bc,_0x50b7df,!![]);}catch(_0x56a416){return BPromise[_0x0fcf('0x2f')](_0x56a416);}return _0x26c3bc[_0x0fcf('0x30')]();};}function saveUpdates(_0xa52f52,_0x161496){return function(_0xc58b86){if(_0xc58b86){return _0xc58b86[_0x0fcf('0x31')](_0xa52f52)['then'](function(_0x2ab805){return _0x2ab805;});}return null;};}function removeEntity(_0x256e2b,_0x40e5ff){return function(_0x2ad226){if(_0x2ad226){return _0x2ad226[_0x0fcf('0x32')]()[_0x0fcf('0x1b')](function(){_0x256e2b['status'](0xcc)[_0x0fcf('0x29')]();});}};}function handleEntityNotFound(_0xe07780,_0x4591bf){return function(_0x37e7c8){if(!_0x37e7c8){_0xe07780[_0x0fcf('0x27')](0x194);}return _0x37e7c8;};}function handleError(_0x477c71,_0x260d6a){_0x260d6a=_0x260d6a||0x1f4;return function(_0x344957){logger[_0x0fcf('0x22')](_0x344957[_0x0fcf('0x33')]);if(_0x344957[_0x0fcf('0x34')]){delete _0x344957[_0x0fcf('0x34')];}_0x477c71[_0x0fcf('0x28')](_0x260d6a)[_0x0fcf('0x35')](_0x344957);};}exports['index']=function(_0x5eb497,_0x40101a){var _0x4ccbdf={},_0x54fe18={},_0x1a1e07={'count':0x0,'rows':[]};var _0x254d6a=_[_0x0fcf('0x36')](db['Dynamics365Account']['rawAttributes'],function(_0x1417ac){return{'name':_0x1417ac[_0x0fcf('0x37')],'type':_0x1417ac[_0x0fcf('0x38')]['key']};});_0x54fe18[_0x0fcf('0x39')]=_[_0x0fcf('0x36')](_0x254d6a,_0x0fcf('0x34'));_0x54fe18['query']=_['keys'](_0x5eb497['query']);_0x54fe18[_0x0fcf('0x3a')]=_[_0x0fcf('0x3b')](_0x54fe18[_0x0fcf('0x39')],_0x54fe18[_0x0fcf('0x3c')]);_0x4ccbdf[_0x0fcf('0x3d')]=_['intersection'](_0x54fe18[_0x0fcf('0x39')],qs[_0x0fcf('0x3e')](_0x5eb497[_0x0fcf('0x3c')]['fields']));_0x4ccbdf['attributes']=_0x4ccbdf[_0x0fcf('0x3d')][_0x0fcf('0x3f')]?_0x4ccbdf[_0x0fcf('0x3d')]:_0x54fe18[_0x0fcf('0x39')];if(!_0x5eb497[_0x0fcf('0x3c')]['hasOwnProperty'](_0x0fcf('0x40'))){_0x4ccbdf[_0x0fcf('0x2d')]=qs[_0x0fcf('0x2d')](_0x5eb497[_0x0fcf('0x3c')]['limit']);_0x4ccbdf['offset']=qs[_0x0fcf('0x2c')](_0x5eb497[_0x0fcf('0x3c')]['offset']);}_0x4ccbdf[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x5eb497['query'][_0x0fcf('0x42')]);_0x4ccbdf[_0x0fcf('0x43')]=qs[_0x0fcf('0x3a')](_[_0x0fcf('0x44')](_0x5eb497[_0x0fcf('0x3c')],_0x54fe18['filters']),_0x254d6a);if(_0x5eb497[_0x0fcf('0x3c')][_0x0fcf('0x45')]){_0x4ccbdf['where']=_['merge'](_0x4ccbdf[_0x0fcf('0x43')],{'$or':_['map'](_0x254d6a,function(_0x522148){if(_0x522148[_0x0fcf('0x38')]!==_0x0fcf('0x46')){var _0x2c1618={};_0x2c1618[_0x522148[_0x0fcf('0x34')]]={'$like':'%'+_0x5eb497[_0x0fcf('0x3c')][_0x0fcf('0x45')]+'%'};return _0x2c1618;}})});}_0x4ccbdf=_[_0x0fcf('0x47')]({},_0x4ccbdf,_0x5eb497[_0x0fcf('0x48')]);var _0x450b7b={'where':_0x4ccbdf[_0x0fcf('0x43')]};return db['Dynamics365Account'][_0x0fcf('0x2b')](_0x450b7b)[_0x0fcf('0x1b')](function(_0x3e24fc){_0x1a1e07['count']=_0x3e24fc;if(_0x5eb497['query'][_0x0fcf('0x49')]){_0x4ccbdf[_0x0fcf('0x4a')]=[{'all':!![]}];}return db[_0x0fcf('0x4b')][_0x0fcf('0x4c')](_0x4ccbdf);})['then'](function(_0x592bb4){_0x1a1e07[_0x0fcf('0x4d')]=_0x592bb4;return _0x1a1e07;})[_0x0fcf('0x1b')](respondWithFilteredResult(_0x40101a,_0x4ccbdf))[_0x0fcf('0x26')](handleError(_0x40101a,null));};exports[_0x0fcf('0x4e')]=function(_0x345188,_0x1a7475){var _0x2f6b5a={'raw':![],'where':{'id':_0x345188['params']['id']}},_0xc7ae={};_0xc7ae['model']=_[_0x0fcf('0x4f')](db[_0x0fcf('0x4b')][_0x0fcf('0x50')]);_0xc7ae[_0x0fcf('0x3c')]=_[_0x0fcf('0x4f')](_0x345188[_0x0fcf('0x3c')]);_0xc7ae['filters']=_[_0x0fcf('0x3b')](_0xc7ae[_0x0fcf('0x39')],_0xc7ae['query']);_0x2f6b5a[_0x0fcf('0x3d')]=_[_0x0fcf('0x3b')](_0xc7ae[_0x0fcf('0x39')],qs[_0x0fcf('0x3e')](_0x345188['query'][_0x0fcf('0x3e')]));_0x2f6b5a[_0x0fcf('0x3d')]=_0x2f6b5a[_0x0fcf('0x3d')][_0x0fcf('0x3f')]?_0x2f6b5a[_0x0fcf('0x3d')]:_0xc7ae[_0x0fcf('0x39')];if(_0x345188[_0x0fcf('0x3c')][_0x0fcf('0x49')]){_0x2f6b5a[_0x0fcf('0x4a')]=[{'all':!![]}];}_0x2f6b5a=_[_0x0fcf('0x47')]({},_0x2f6b5a,_0x345188[_0x0fcf('0x48')]);return db[_0x0fcf('0x4b')][_0x0fcf('0x51')](_0x2f6b5a)[_0x0fcf('0x1b')](handleEntityNotFound(_0x1a7475,null))['then'](respondWithResult(_0x1a7475,null))[_0x0fcf('0x26')](handleError(_0x1a7475,null));};exports['create']=function(_0x469fa3,_0x1ff91b){return db[_0x0fcf('0x4b')][_0x0fcf('0x52')](_0x469fa3[_0x0fcf('0x53')],{})['then'](respondWithResult(_0x1ff91b,0xc9))[_0x0fcf('0x26')](handleError(_0x1ff91b,null));};exports['update']=function(_0x48b60a,_0x2de3ef){if(_0x48b60a['body']['id']){delete _0x48b60a[_0x0fcf('0x53')]['id'];}return db[_0x0fcf('0x4b')]['find']({'where':{'id':_0x48b60a[_0x0fcf('0x54')]['id']}})[_0x0fcf('0x1b')](handleEntityNotFound(_0x2de3ef,null))[_0x0fcf('0x1b')](saveUpdates(_0x48b60a[_0x0fcf('0x53')],null))[_0x0fcf('0x1b')](respondWithResult(_0x2de3ef,null))['catch'](handleError(_0x2de3ef,null));};exports['destroy']=function(_0x5d3006,_0x50fc2c){return db[_0x0fcf('0x4b')][_0x0fcf('0x51')]({'where':{'id':_0x5d3006['params']['id']}})['then'](handleEntityNotFound(_0x50fc2c,null))[_0x0fcf('0x1b')](removeEntity(_0x50fc2c,null))[_0x0fcf('0x26')](handleError(_0x50fc2c,null));};exports[_0x0fcf('0x55')]=function(_0x5d8724,_0xbb8286,_0x4a5da0){var _0x2ed8d8={};var _0x386101={};var _0x2dff9d;var _0x4911dd;return db[_0x0fcf('0x4b')][_0x0fcf('0x56')]({'where':{'id':_0x5d8724[_0x0fcf('0x54')]['id']}})[_0x0fcf('0x1b')](handleEntityNotFound(_0xbb8286,null))[_0x0fcf('0x1b')](function(_0x381884){if(_0x381884){_0x2dff9d=_0x381884;_0x386101[_0x0fcf('0x39')]=_[_0x0fcf('0x4f')](db[_0x0fcf('0x57')][_0x0fcf('0x50')]);_0x386101[_0x0fcf('0x3c')]=_['keys'](_0x5d8724[_0x0fcf('0x3c')]);_0x386101[_0x0fcf('0x3a')]=_[_0x0fcf('0x3b')](_0x386101[_0x0fcf('0x39')],_0x386101[_0x0fcf('0x3c')]);_0x2ed8d8[_0x0fcf('0x3d')]=_[_0x0fcf('0x3b')](_0x386101['model'],qs['fields'](_0x5d8724[_0x0fcf('0x3c')][_0x0fcf('0x3e')]));_0x2ed8d8['attributes']=_0x2ed8d8[_0x0fcf('0x3d')][_0x0fcf('0x3f')]?_0x2ed8d8[_0x0fcf('0x3d')]:_0x386101[_0x0fcf('0x39')];_0x2ed8d8['order']=qs[_0x0fcf('0x42')](_0x5d8724[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x2ed8d8[_0x0fcf('0x43')]=qs[_0x0fcf('0x3a')](_[_0x0fcf('0x44')](_0x5d8724['query'],_0x386101[_0x0fcf('0x3a')]));if(_0x5d8724[_0x0fcf('0x3c')][_0x0fcf('0x45')]){_0x2ed8d8[_0x0fcf('0x43')]=_[_0x0fcf('0x47')](_0x2ed8d8['where'],{'$or':_['map'](_0x2ed8d8[_0x0fcf('0x3d')],function(_0x3ae07c){var _0x8c2777={};_0x8c2777[_0x3ae07c]={'$like':'%'+_0x5d8724[_0x0fcf('0x3c')][_0x0fcf('0x45')]+'%'};return _0x8c2777;})});}_0x2ed8d8=_[_0x0fcf('0x47')]({},_0x2ed8d8,_0x5d8724[_0x0fcf('0x48')]);return _0x2dff9d[_0x0fcf('0x55')](_0x2ed8d8);}})[_0x0fcf('0x1b')](function(_0x25d75a){if(_0x25d75a){_0x4911dd=_0x25d75a['length'];if(!_0x5d8724[_0x0fcf('0x3c')][_0x0fcf('0x58')](_0x0fcf('0x40'))){_0x2ed8d8[_0x0fcf('0x2d')]=qs[_0x0fcf('0x2d')](_0x5d8724[_0x0fcf('0x3c')][_0x0fcf('0x2d')]);_0x2ed8d8[_0x0fcf('0x2c')]=qs[_0x0fcf('0x2c')](_0x5d8724['query']['offset']);}return _0x2dff9d['getConfigurations'](_0x2ed8d8);}})['then'](function(_0x7c1c74){if(_0x7c1c74){return _0x7c1c74?{'count':_0x4911dd,'rows':_0x7c1c74}:null;}})['then'](respondWithResult(_0xbb8286,null))[_0x0fcf('0x26')](handleError(_0xbb8286,null));};exports[_0x0fcf('0x59')]=function(_0x3da414,_0x4cb1e5,_0x5ab5c6){if(_0x3da414[_0x0fcf('0x53')]['id']){delete _0x3da414[_0x0fcf('0x53')]['id'];}return db['Dynamics365Account'][_0x0fcf('0x56')]({'where':{'id':_0x3da414[_0x0fcf('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cb1e5,null))[_0x0fcf('0x1b')](function(_0x15f05c){if(_0x15f05c){_0x3da414[_0x0fcf('0x53')][_0x0fcf('0x5a')]=_0x15f05c['id'];_0x3da414[_0x0fcf('0x53')][_0x0fcf('0x5b')]=integrations[_0x0fcf('0x5c')](_0x3da414['body'][_0x0fcf('0x5d')],_0x3da414[_0x0fcf('0x53')][_0x0fcf('0x38')]);_0x3da414[_0x0fcf('0x53')][_0x0fcf('0x5e')]=integrations[_0x0fcf('0x5f')](_0x3da414['body']['channel'],_0x3da414[_0x0fcf('0x53')][_0x0fcf('0x38')]);return db[_0x0fcf('0x57')][_0x0fcf('0x52')](_0x3da414['body'],{'include':[{'model':db[_0x0fcf('0x60')],'as':_0x0fcf('0x5b')},{'model':db[_0x0fcf('0x60')],'as':_0x0fcf('0x5e')}]});}return null;})[_0x0fcf('0x1b')](respondWithResult(_0x4cb1e5,null))['catch'](handleError(_0x4cb1e5,null));};exports['getFields']=function(_0x2c28b0,_0x55e438,_0x18a675){var _0x47e8f2=_0x2c28b0[_0x0fcf('0x3c')][_0x0fcf('0x61')];var _0x3bd23e=_0x47e8f2===_0x0fcf('0x62')?_0x0fcf('0x63'):'PhoneCall';var _0x34e0f3='';var _0x209c52='';var _0x1bbaca='';var _0x296f4f='';var _0x4c7555='';var _0x376d26='';var _0x5ba384='';var _0x2a6084='';var _0x5cdde8=[_0x0fcf('0x64'),_0x0fcf('0x65'),'customerid',_0x0fcf('0x66'),_0x0fcf('0x67'),_0x0fcf('0x68'),'phonenumber','regardingobjectid','directioncode',_0x0fcf('0x69')];var _0x5b3f34=[_0x0fcf('0x6a'),_0x0fcf('0x6b'),_0x0fcf('0x6c'),_0x0fcf('0x6d'),_0x0fcf('0x6e'),_0x0fcf('0x6f'),_0x0fcf('0x70'),_0x0fcf('0x71'),_0x0fcf('0x72'),'createdbyexternalpartyyominame',_0x0fcf('0x73'),_0x0fcf('0x74'),_0x0fcf('0x75'),_0x0fcf('0x76'),_0x0fcf('0x77'),_0x0fcf('0x78'),_0x0fcf('0x79'),_0x0fcf('0x7a'),'emailaddress',_0x0fcf('0x7b'),_0x0fcf('0x7c'),_0x0fcf('0x7d'),_0x0fcf('0x7e'),_0x0fcf('0x7f'),_0x0fcf('0x80'),_0x0fcf('0x81'),'importsequencenumber',_0x0fcf('0x82'),'kbarticleidname',_0x0fcf('0x83'),_0x0fcf('0x84'),_0x0fcf('0x85'),'modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon',_0x0fcf('0x86'),_0x0fcf('0x87'),_0x0fcf('0x88'),_0x0fcf('0x89'),_0x0fcf('0x8a'),_0x0fcf('0x8b'),_0x0fcf('0x8c'),_0x0fcf('0x8d'),_0x0fcf('0x8e'),_0x0fcf('0x8f'),_0x0fcf('0x90'),'primarycontactidname',_0x0fcf('0x91'),_0x0fcf('0x92'),'productidname',_0x0fcf('0x93'),'resolveby',_0x0fcf('0x94'),_0x0fcf('0x95'),'responsiblecontactidname','responsiblecontactidyominame',_0x0fcf('0x96'),_0x0fcf('0x97'),'slaname',_0x0fcf('0x98'),_0x0fcf('0x99'),_0x0fcf('0x9a'),_0x0fcf('0x9b'),_0x0fcf('0x9c'),_0x0fcf('0x9d'),_0x0fcf('0x9e'),_0x0fcf('0x9f'),'utcconversiontimezonecode',_0x0fcf('0xa0')];var _0xc662e3=_0x5cdde8[_0x0fcf('0xa1')](_0x5b3f34);return db[_0x0fcf('0x4b')]['findOne']({'where':{'id':_0x2c28b0[_0x0fcf('0x54')]['id']},'attributes':['id','username','password','remoteUri',_0x0fcf('0xa2'),_0x0fcf('0xa3'),_0x0fcf('0xa4')]})[_0x0fcf('0x1b')](handleEntityNotFound(_0x55e438,null))[_0x0fcf('0x1b')](function(_0x777b71){if(_0x777b71){_0x2a6084=_0x777b71[_0x0fcf('0xa5')];var _0x31b008=_0x2a6084[_0x0fcf('0xa6')](-0x1);if(_0x31b008==='/'){_0x2a6084=_0x2a6084['substring'](0x0,_0x2a6084[_0x0fcf('0xa7')](_0x31b008));}_0x5ba384=util[_0x0fcf('0xa8')](_0x0fcf('0xa9'),_0x2a6084);var _0x339a46={'method':_0x0fcf('0xaa'),'uri':_0x0fcf('0xab')+_0x777b71[_0x0fcf('0xa2')]+_0x0fcf('0xac'),'form':{'client_id':_0x777b71[_0x0fcf('0xa3')],'resource':_0x2a6084,'username':_0x777b71['username'],'password':_0x777b71['password'],'grant_type':'password','client_secret':_0x777b71[_0x0fcf('0xa4')]},'json':!![]};return rp(_0x339a46);}})[_0x0fcf('0x1b')](function(_0x307181){_0x376d26=_0x307181[_0x0fcf('0xad')];var _0x52e2e6={'method':'GET','uri':encodeURI(_0x5ba384+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3bd23e+'\x27'),'headers':{'Authorization':_0x0fcf('0xae')+_0x376d26,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x52e2e6);})[_0x0fcf('0x1b')](function(_0x58a7d6){var _0xaadf5d=_0x58a7d6['value'][0x0];var _0x30edd0=_0xaadf5d['MetadataId'];var _0x4f729f={'method':_0x0fcf('0xaf'),'uri':_0x5ba384+'EntityDefinitions('+_0x30edd0+_0x0fcf('0xb0'),'headers':{'Authorization':_0x0fcf('0xae')+_0x376d26,'If-None-Match':null,'OData-Version':_0x0fcf('0xb1')},'json':!![]};return rp(_0x4f729f);})[_0x0fcf('0x1b')](function(_0x456099){_0x34e0f3=_0x456099;_0x209c52=_0x34e0f3[_0x0fcf('0xb2')];_0x209c52=_[_0x0fcf('0xb3')](_0x209c52,function(_0x512dbd){return!_0xc662e3[_0x0fcf('0xb4')](_0x512dbd[_0x0fcf('0xb5')]);});var _0xa90534=[];var _0x274aa9=[];_0x209c52[_0x0fcf('0xb6')](function(_0x57a1c0){if(_0x57a1c0[_0x0fcf('0xb7')]){var _0x3bc4a5=_0x57a1c0[_0x0fcf('0xb7')][_0x0fcf('0xb8')](_0x57a1c0[_0x0fcf('0xb7')][_0x0fcf('0xa7')]('.')+0x1);if(_0x3bc4a5===_0x0fcf('0xb9')){_0xa90534[_0x0fcf('0xba')](getSelectList(_0x5ba384,_0x47e8f2,_0x274aa9,_0x34e0f3[_0x0fcf('0xbb')],_0x57a1c0['MetadataId'],_0x376d26));}}});return Promise[_0x0fcf('0xbc')](_0xa90534);})[_0x0fcf('0x1b')](function(_0x26d31c){_0x1bbaca=_0x26d31c[0x0];var _0x319770=[];var _0x235e57=[];_0x209c52[_0x0fcf('0xb6')](function(_0x202097){if(!_[_0x0fcf('0xbd')](_0x202097[_0x0fcf('0xb7')])){var _0x1cac45=_0x202097[_0x0fcf('0xb7')][_0x0fcf('0xb8')](_0x202097[_0x0fcf('0xb7')]['lastIndexOf']('.')+0x1);if(_0x1cac45===_0x0fcf('0xbe')){_0x319770[_0x0fcf('0xba')](getBooleanList(_0x5ba384,_0x47e8f2,_0x235e57,_0x34e0f3['MetadataId'],_0x202097[_0x0fcf('0xbb')],_0x376d26));}}});return Promise[_0x0fcf('0xbc')](_0x319770);})[_0x0fcf('0x1b')](function(_0x2897c7){_0x296f4f=_0x2897c7[0x0];var _0x3ba088=[];var _0x5c6514=[];_0x209c52['forEach'](function(_0x58bb82){if(_0x58bb82[_0x0fcf('0xb7')]){var _0x4b0216=_0x58bb82[_0x0fcf('0xb7')][_0x0fcf('0xb8')](_0x58bb82['@odata.type'][_0x0fcf('0xa7')]('.')+0x1);if(_0x4b0216===_0x0fcf('0xbf')||_0x4b0216===_0x0fcf('0xc0')||_0x4b0216===_0x0fcf('0xc1')||_0x4b0216===_0x0fcf('0xc2')||_0x4b0216===_0x0fcf('0xc3')||_0x4b0216===_0x0fcf('0xc4')||_0x4b0216===_0x0fcf('0xc5')||_0x4b0216===_0x0fcf('0xc6')||_0x4b0216==='StateAttributeMetadata'||_0x4b0216===_0x0fcf('0xc7')){_0x3ba088[_0x0fcf('0xba')](getInputList(_0x5ba384,_0x47e8f2,_0x4b0216,_0x5c6514,_0x34e0f3[_0x0fcf('0xbb')],_0x58bb82['MetadataId'],_0x376d26));}}});return Promise[_0x0fcf('0xbc')](_0x3ba088);})[_0x0fcf('0x1b')](function(_0x352259){_0x4c7555=_0x352259[0x0];var _0x71ac37=_0x1bbaca[_0x0fcf('0xa1')](_0x296f4f)[_0x0fcf('0xa1')](_0x4c7555);var _0x201ff2={'count':_0x71ac37['length'],'rows':_0x71ac37};return _0x201ff2;})[_0x0fcf('0x1b')](respondWithResult(_0x55e438,null))[_0x0fcf('0x26')](function(_0x2a72c0){var _0x2f2e24=_0x2c28b0['query'][_0x0fcf('0xc8')]?0x1f4:_0x2a72c0['statusCode']||0x1f4;logger[_0x0fcf('0x22')](_0x2a72c0[_0x0fcf('0x33')]);delete _0x2a72c0['name'];if(_0x2f2e24===0x191){_0x2f2e24=0x190;}_0x55e438['status'](_0x2f2e24)[_0x0fcf('0x35')](_0x2c28b0[_0x0fcf('0x3c')][_0x0fcf('0xc8')]?{'message':_0x0fcf('0xc9'),'statusCode':_0x2a72c0[_0x0fcf('0xca')]}:_0x2a72c0);});};function getSelectList(_0x28f3b1,_0x25879a,_0x1a480e,_0x2a0ba3,_0x4048b6,_0x4dae4a){var _0x144354={'method':'GET','uri':_0x28f3b1+'EntityDefinitions('+_0x2a0ba3+_0x0fcf('0xcb')+_0x4048b6+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x4dae4a,'If-None-Match':null,'OData-Version':_0x0fcf('0xb1')},'json':!![]};return rp(_0x144354)[_0x0fcf('0x1b')](function(_0x3d7267){var _0x1e43af=[];var _0x1169f5=_0x3d7267[_0x0fcf('0xcc')][_0x0fcf('0xcd')];_0x1169f5[_0x0fcf('0xb6')](function(_0x5bc214){_0x1e43af['push']({'name':_0x5bc214[_0x0fcf('0xce')][_0x0fcf('0xcf')][_0x0fcf('0xce')],'value':String(_0x5bc214[_0x0fcf('0xd0')])});});var _0x20f471={'id':_0x25879a+'_'+_0x3d7267[_0x0fcf('0xb5')],'name':_0x3d7267['DisplayName'][_0x0fcf('0xcf')][_0x0fcf('0xce')],'custom':![],'options':_0x1e43af};_0x1a480e[_0x0fcf('0xba')](_0x20f471);return _0x1a480e;});}function getBooleanList(_0x1dbc41,_0x2c7a69,_0x4c7549,_0x2b348a,_0x2476e0,_0x1e259b){var _0x3465ee={'method':_0x0fcf('0xaf'),'uri':_0x1dbc41+'EntityDefinitions('+_0x2b348a+_0x0fcf('0xcb')+_0x2476e0+_0x0fcf('0xd1'),'headers':{'Authorization':_0x0fcf('0xae')+_0x1e259b,'If-None-Match':null,'OData-Version':_0x0fcf('0xb1')},'json':!![]};return rp(_0x3465ee)['then'](function(_0xa16e9f){var _0x21a27c=[];_0x21a27c[_0x0fcf('0xba')]({'name':_0xa16e9f['OptionSet']['TrueOption'][_0x0fcf('0xce')][_0x0fcf('0xcf')][_0x0fcf('0xce')],'value':_0x0fcf('0xd2')},{'name':_0xa16e9f[_0x0fcf('0xcc')]['FalseOption'][_0x0fcf('0xce')][_0x0fcf('0xcf')][_0x0fcf('0xce')],'value':'false'});var _0x45f4ab={'id':_0x2c7a69+'_'+_0xa16e9f[_0x0fcf('0xb5')],'name':_0xa16e9f['DisplayName'][_0x0fcf('0xcf')][_0x0fcf('0xce')],'custom':![],'options':_0x21a27c};_0x4c7549[_0x0fcf('0xba')](_0x45f4ab);return _0x4c7549;});}function getInputList(_0x449f55,_0x26f901,_0x5687a0,_0x322c3c,_0x492839,_0x1f2397,_0x5e2f90){var _0x5041c4={'method':_0x0fcf('0xaf'),'uri':_0x449f55+_0x0fcf('0xd3')+_0x492839+_0x0fcf('0xcb')+_0x1f2397+_0x0fcf('0xd4')+_0x5687a0+_0x0fcf('0xd5'),'headers':{'Authorization':_0x0fcf('0xae')+_0x5e2f90,'If-None-Match':null,'OData-Version':_0x0fcf('0xb1')},'json':!![]};return rp(_0x5041c4)[_0x0fcf('0x1b')](function(_0x15f22c){var _0x56dab8={'id':_0x26f901+'_'+_0x15f22c[_0x0fcf('0xb5')],'name':_0x15f22c[_0x0fcf('0xd6')][_0x0fcf('0xcf')]?_0x15f22c[_0x0fcf('0xd6')][_0x0fcf('0xcf')][_0x0fcf('0xce')]:_0x15f22c[_0x0fcf('0xb5')],'custom':![],'options':[]};_0x322c3c['push'](_0x56dab8);return _0x322c3c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e8bfd54..3090e45 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 _0xe7fb=['../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x51f437,_0x15a6d7){var _0x4ac599=function(_0x2b61b3){while(--_0x2b61b3){_0x51f437['push'](_0x51f437['shift']());}};_0x4ac599(++_0x15a6d7);}(_0xe7fb,0x93));var _0xbe7f=function(_0x26bfbb,_0x4ec22d){_0x26bfbb=_0x26bfbb-0x0;var _0x1884cf=_0xe7fb[_0x26bfbb];return _0x1884cf;};'use strict';var _=require(_0xbe7f('0x0'));var util=require(_0xbe7f('0x1'));var logger=require('../../config/logger')(_0xbe7f('0x2'));var moment=require(_0xbe7f('0x3'));var BPromise=require(_0xbe7f('0x4'));var rp=require(_0xbe7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe7f('0x6'));var config=require(_0xbe7f('0x7'));var attributes=require(_0xbe7f('0x8'));var integrations=require(_0xbe7f('0x9'));module['exports']=function(_0x3d550e,_0xe606a7){return _0x3d550e['define']('Dynamics365Account',attributes,{'tableName':_0xbe7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x329f=['exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x5c9aa4,_0x208119){var _0x90b9db=function(_0x1da504){while(--_0x1da504){_0x5c9aa4['push'](_0x5c9aa4['shift']());}};_0x90b9db(++_0x208119);}(_0x329f,0x88));var _0xf329=function(_0x449354,_0x297da4){_0x449354=_0x449354-0x0;var _0x514564=_0x329f[_0x449354];return _0x514564;};'use strict';var _=require(_0xf329('0x0'));var util=require(_0xf329('0x1'));var logger=require(_0xf329('0x2'))(_0xf329('0x3'));var moment=require(_0xf329('0x4'));var BPromise=require(_0xf329('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf329('0x6'));var config=require(_0xf329('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0xf329('0x8')]=function(_0x52768e,_0x2eacbe){return _0x52768e[_0xf329('0x9')](_0xf329('0xa'),attributes,{'tableName':_0xf329('0xb'),'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 cebee35..d26f45d 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 _0xb46f=['limit','include','map','model','then','GetDynamics365Account','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x43cce3,_0x2a24e2){var _0x22bb03=function(_0x5017a9){while(--_0x5017a9){_0x43cce3['push'](_0x43cce3['shift']());}};_0x22bb03(++_0x2a24e2);}(_0xb46f,0xb6));var _0xfb46=function(_0x593264,_0x842a81){_0x593264=_0x593264-0x0;var _0x24d179=_0xb46f[_0x593264];return _0x24d179;};'use strict';var _=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var moment=require('moment');var BPromise=require(_0xfb46('0x2'));var rs=require(_0xfb46('0x3'));var fs=require('fs');var Redis=require(_0xfb46('0x4'));var db=require(_0xfb46('0x5'))['db'];var utils=require(_0xfb46('0x6'));var logger=require('../../config/logger')(_0xfb46('0x7'));var config=require('../../config/environment');var jayson=require(_0xfb46('0x8'));var client=jayson[_0xfb46('0x9')][_0xfb46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1efd40,_0x35103d,_0x47c1a2){return new BPromise(function(_0x9871f5,_0x298a84){return client['request'](_0x1efd40,_0x47c1a2)['then'](function(_0x5bb51a){logger['info'](_0xfb46('0xb'),_0x35103d,'request\x20sent');logger[_0xfb46('0xc')](_0xfb46('0xd'),_0x35103d,_0xfb46('0xe'),JSON[_0xfb46('0xf')](_0x5bb51a));if(_0x5bb51a[_0xfb46('0x10')]){if(_0x5bb51a[_0xfb46('0x10')][_0xfb46('0x11')]===0x1f4){logger[_0xfb46('0x10')](_0xfb46('0xb'),_0x35103d,_0x5bb51a[_0xfb46('0x10')]['message']);return _0x298a84(_0x5bb51a['error'][_0xfb46('0x12')]);}logger['error'](_0xfb46('0xb'),_0x35103d,_0x5bb51a[_0xfb46('0x10')]['message']);return _0x9871f5(_0x5bb51a[_0xfb46('0x10')][_0xfb46('0x12')]);}else{logger[_0xfb46('0x13')](_0xfb46('0xb'),_0x35103d,'request\x20sent');_0x9871f5(_0x5bb51a[_0xfb46('0x14')][_0xfb46('0x12')]);}})[_0xfb46('0x15')](function(_0x4d3b3e){logger[_0xfb46('0x10')](_0xfb46('0xb'),_0x35103d,_0x4d3b3e);_0x298a84(_0x4d3b3e);});});}exports['GetDynamics365Account']=function(_0x523d15){var _0x1cead0=this;return new Promise(function(_0x473136,_0x161f0d){return db[_0xfb46('0x16')][_0xfb46('0x17')]({'raw':_0x523d15[_0xfb46('0x18')]?_0x523d15[_0xfb46('0x18')][_0xfb46('0x19')]===undefined?!![]:![]:!![],'where':_0x523d15[_0xfb46('0x18')]?_0x523d15[_0xfb46('0x18')][_0xfb46('0x1a')]||null:null,'attributes':_0x523d15[_0xfb46('0x18')]?_0x523d15['options'][_0xfb46('0x1b')]||null:null,'limit':_0x523d15[_0xfb46('0x18')]?_0x523d15[_0xfb46('0x18')][_0xfb46('0x1c')]||null:null,'include':_0x523d15[_0xfb46('0x18')]?_0x523d15[_0xfb46('0x18')][_0xfb46('0x1d')]?_[_0xfb46('0x1e')](_0x523d15[_0xfb46('0x18')]['include'],function(_0x36c00a){return{'model':db[_0x36c00a['model']],'as':_0x36c00a['as'],'attributes':_0x36c00a[_0xfb46('0x1b')],'include':_0x36c00a[_0xfb46('0x1d')]?_[_0xfb46('0x1e')](_0x36c00a[_0xfb46('0x1d')],function(_0xf9bbd1){return{'model':db[_0xf9bbd1[_0xfb46('0x1f')]],'as':_0xf9bbd1['as'],'attributes':_0xf9bbd1[_0xfb46('0x1b')],'include':_0xf9bbd1['include']?_[_0xfb46('0x1e')](_0xf9bbd1[_0xfb46('0x1d')],function(_0x309c7f){return{'model':db[_0x309c7f[_0xfb46('0x1f')]],'as':_0x309c7f['as'],'attributes':_0x309c7f[_0xfb46('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb46('0x20')](function(_0x16aea0){logger[_0xfb46('0x13')](_0xfb46('0x21'),_0x523d15);logger['debug'](_0xfb46('0x21'),_0x523d15,JSON[_0xfb46('0xf')](_0x16aea0));_0x473136(_0x16aea0);})[_0xfb46('0x15')](function(_0x1f1f3a){logger['error'](_0xfb46('0x21'),_0x1f1f3a[_0xfb46('0x12')],_0x523d15);_0x161f0d(_0x1cead0[_0xfb46('0x10')](0x1f4,_0x1f1f3a[_0xfb46('0x12')]));});});};exports[_0xfb46('0x22')]=function(_0x5aa6b4){var _0x38637a=this;return new Promise(function(_0x40717f,_0x5751d9){return db[_0xfb46('0x16')]['find']({'raw':_0x5aa6b4[_0xfb46('0x18')]?_0x5aa6b4['options'][_0xfb46('0x19')]===undefined?!![]:![]:!![],'where':_0x5aa6b4['options']?_0x5aa6b4[_0xfb46('0x18')][_0xfb46('0x1a')]||null:null,'attributes':_0x5aa6b4['options']?_0x5aa6b4[_0xfb46('0x18')][_0xfb46('0x1b')]||null:null,'include':_0x5aa6b4['options']?_0x5aa6b4[_0xfb46('0x18')][_0xfb46('0x1d')]?_['map'](_0x5aa6b4['options'][_0xfb46('0x1d')],function(_0x2d0216){return{'model':db[_0x2d0216[_0xfb46('0x1f')]],'as':_0x2d0216['as'],'attributes':_0x2d0216[_0xfb46('0x1b')],'include':_0x2d0216[_0xfb46('0x1d')]?_[_0xfb46('0x1e')](_0x2d0216[_0xfb46('0x1d')],function(_0x32edf6){return{'model':db[_0x32edf6[_0xfb46('0x1f')]],'as':_0x32edf6['as'],'attributes':_0x32edf6['attributes'],'include':_0x32edf6[_0xfb46('0x1d')]?_['map'](_0x32edf6['include'],function(_0x169fe9){return{'model':db[_0x169fe9[_0xfb46('0x1f')]],'as':_0x169fe9['as'],'attributes':_0x169fe9[_0xfb46('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb46('0x20')](function(_0x363bfb){logger[_0xfb46('0x13')](_0xfb46('0x22'),_0x5aa6b4);logger[_0xfb46('0xc')]('ShowDynamics365Account',_0x5aa6b4,JSON[_0xfb46('0xf')](_0x363bfb));_0x40717f(_0x363bfb);})[_0xfb46('0x15')](function(_0x3f67bc){logger[_0xfb46('0x10')]('ShowDynamics365Account',_0x3f67bc[_0xfb46('0x12')],_0x5aa6b4);_0x5751d9(_0x38637a[_0xfb46('0x10')](0x1f4,_0x3f67bc[_0xfb46('0x12')]));});});}; \ No newline at end of file +var _0x9300=['debug','stringify','error','message','request\x20sent','result','Dynamics365Account','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','raw','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Dynamics365Account,\x20%s,\x20%s'];(function(_0x1e097c,_0x6313a3){var _0x74ccb2=function(_0x313a94){while(--_0x313a94){_0x1e097c['push'](_0x1e097c['shift']());}};_0x74ccb2(++_0x6313a3);}(_0x9300,0x153));var _0x0930=function(_0xa650fb,_0x104a00){_0xa650fb=_0xa650fb-0x0;var _0x99f4de=_0x9300[_0xa650fb];return _0x99f4de;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0930('0x1'));var rs=require(_0x0930('0x2'));var fs=require('fs');var Redis=require(_0x0930('0x3'));var db=require(_0x0930('0x4'))['db'];var utils=require(_0x0930('0x5'));var logger=require('../../config/logger')(_0x0930('0x6'));var config=require(_0x0930('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0930('0x8')][_0x0930('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45705a,_0x34c693,_0x2c0f94){return new BPromise(function(_0x1ec24f,_0x5bc3df){return client['request'](_0x45705a,_0x2c0f94)[_0x0930('0xa')](function(_0x4b1994){logger[_0x0930('0xb')](_0x0930('0xc'),_0x34c693,'request\x20sent');logger[_0x0930('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x34c693,'request\x20sent',JSON[_0x0930('0xe')](_0x4b1994));if(_0x4b1994[_0x0930('0xf')]){if(_0x4b1994['error']['code']===0x1f4){logger[_0x0930('0xf')](_0x0930('0xc'),_0x34c693,_0x4b1994[_0x0930('0xf')][_0x0930('0x10')]);return _0x5bc3df(_0x4b1994[_0x0930('0xf')][_0x0930('0x10')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x34c693,_0x4b1994['error'][_0x0930('0x10')]);return _0x1ec24f(_0x4b1994['error'][_0x0930('0x10')]);}else{logger[_0x0930('0xb')](_0x0930('0xc'),_0x34c693,_0x0930('0x11'));_0x1ec24f(_0x4b1994[_0x0930('0x12')][_0x0930('0x10')]);}})['catch'](function(_0x3ec27b){logger[_0x0930('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x34c693,_0x3ec27b);_0x5bc3df(_0x3ec27b);});});}exports['GetDynamics365Account']=function(_0x87318c){var _0xc7059=this;return new Promise(function(_0x469be7,_0x231a4c){return db[_0x0930('0x13')]['findAll']({'raw':_0x87318c[_0x0930('0x14')]?_0x87318c[_0x0930('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x87318c[_0x0930('0x14')]?_0x87318c[_0x0930('0x14')][_0x0930('0x15')]||null:null,'attributes':_0x87318c[_0x0930('0x14')]?_0x87318c[_0x0930('0x14')][_0x0930('0x16')]||null:null,'limit':_0x87318c['options']?_0x87318c['options'][_0x0930('0x17')]||null:null,'include':_0x87318c['options']?_0x87318c[_0x0930('0x14')][_0x0930('0x18')]?_[_0x0930('0x19')](_0x87318c[_0x0930('0x14')][_0x0930('0x18')],function(_0x48bdf5){return{'model':db[_0x48bdf5[_0x0930('0x1a')]],'as':_0x48bdf5['as'],'attributes':_0x48bdf5[_0x0930('0x16')],'include':_0x48bdf5['include']?_['map'](_0x48bdf5[_0x0930('0x18')],function(_0x8f676a){return{'model':db[_0x8f676a[_0x0930('0x1a')]],'as':_0x8f676a['as'],'attributes':_0x8f676a[_0x0930('0x16')],'include':_0x8f676a[_0x0930('0x18')]?_[_0x0930('0x19')](_0x8f676a['include'],function(_0x191333){return{'model':db[_0x191333[_0x0930('0x1a')]],'as':_0x191333['as'],'attributes':_0x191333[_0x0930('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0930('0xa')](function(_0x367064){logger[_0x0930('0xb')](_0x0930('0x1b'),_0x87318c);logger[_0x0930('0xd')](_0x0930('0x1b'),_0x87318c,JSON[_0x0930('0xe')](_0x367064));_0x469be7(_0x367064);})['catch'](function(_0x2a47f2){logger['error'](_0x0930('0x1b'),_0x2a47f2[_0x0930('0x10')],_0x87318c);_0x231a4c(_0xc7059[_0x0930('0xf')](0x1f4,_0x2a47f2['message']));});});};exports[_0x0930('0x1c')]=function(_0x4cee01){var _0x4f3475=this;return new Promise(function(_0x2bf0bb,_0x5b0bfb){return db[_0x0930('0x13')][_0x0930('0x1d')]({'raw':_0x4cee01[_0x0930('0x14')]?_0x4cee01[_0x0930('0x14')][_0x0930('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cee01[_0x0930('0x14')]?_0x4cee01['options']['where']||null:null,'attributes':_0x4cee01[_0x0930('0x14')]?_0x4cee01[_0x0930('0x14')][_0x0930('0x16')]||null:null,'include':_0x4cee01[_0x0930('0x14')]?_0x4cee01[_0x0930('0x14')][_0x0930('0x18')]?_[_0x0930('0x19')](_0x4cee01[_0x0930('0x14')]['include'],function(_0x336f87){return{'model':db[_0x336f87[_0x0930('0x1a')]],'as':_0x336f87['as'],'attributes':_0x336f87[_0x0930('0x16')],'include':_0x336f87[_0x0930('0x18')]?_['map'](_0x336f87[_0x0930('0x18')],function(_0x1d0788){return{'model':db[_0x1d0788[_0x0930('0x1a')]],'as':_0x1d0788['as'],'attributes':_0x1d0788[_0x0930('0x16')],'include':_0x1d0788[_0x0930('0x18')]?_['map'](_0x1d0788['include'],function(_0xc121e5){return{'model':db[_0xc121e5[_0x0930('0x1a')]],'as':_0xc121e5['as'],'attributes':_0xc121e5[_0x0930('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0930('0xa')](function(_0x39ee2a){logger[_0x0930('0xb')](_0x0930('0x1c'),_0x4cee01);logger[_0x0930('0xd')](_0x0930('0x1c'),_0x4cee01,JSON['stringify'](_0x39ee2a));_0x2bf0bb(_0x39ee2a);})[_0x0930('0x1f')](function(_0x46b884){logger[_0x0930('0xf')](_0x0930('0x1c'),_0x46b884[_0x0930('0x10')],_0x4cee01);_0x5b0bfb(_0x4f3475[_0x0930('0xf')](0x1f4,_0x46b884[_0x0930('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 74d3faf..dc7d24c 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 _0xe018=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','show'];(function(_0x332d35,_0x3feb45){var _0x523e7c=function(_0x89eb99){while(--_0x89eb99){_0x332d35['push'](_0x332d35['shift']());}};_0x523e7c(++_0x3feb45);}(_0xe018,0x139));var _0x8e01=function(_0x369f2b,_0x4c7fe7){_0x369f2b=_0x369f2b-0x0;var _0xb8d5c9=_0xe018[_0x369f2b];return _0xb8d5c9;};'use strict';var multer=require(_0x8e01('0x0'));var util=require(_0x8e01('0x1'));var path=require(_0x8e01('0x2'));var timeout=require(_0x8e01('0x3'));var express=require('express');var router=express[_0x8e01('0x4')]();var auth=require(_0x8e01('0x5'));var interaction=require(_0x8e01('0x6'));var config=require(_0x8e01('0x7'));var controller=require(_0x8e01('0x8'));router[_0x8e01('0x9')]('/',auth[_0x8e01('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8e01('0xb')]);router[_0x8e01('0x9')](_0x8e01('0xc'),auth[_0x8e01('0xa')](),controller[_0x8e01('0xd')]);router[_0x8e01('0x9')](_0x8e01('0xe'),auth[_0x8e01('0xa')](),controller[_0x8e01('0xf')]);router[_0x8e01('0x9')](_0x8e01('0x10'),auth['isAuthenticated'](),controller[_0x8e01('0x11')]);router[_0x8e01('0x12')]('/',auth[_0x8e01('0xa')](),controller[_0x8e01('0x13')]);router[_0x8e01('0x14')](_0x8e01('0x15'),auth[_0x8e01('0xa')](),controller[_0x8e01('0x16')]);router[_0x8e01('0x17')](_0x8e01('0x15'),auth[_0x8e01('0xa')](),controller['destroy']);module[_0x8e01('0x18')]=router; \ No newline at end of file +var _0x0852=['get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','/:id','destroy','exports','util','path','connect-timeout','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x137214,_0x39ca8d){var _0xed88fa=function(_0x3a4c35){while(--_0x3a4c35){_0x137214['push'](_0x137214['shift']());}};_0xed88fa(++_0x39ca8d);}(_0x0852,0x1c7));var _0x2085=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0852[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x2085('0x0'));var path=require(_0x2085('0x1'));var timeout=require(_0x2085('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2085('0x3'));var config=require('../../config/environment');var controller=require(_0x2085('0x4'));router[_0x2085('0x5')]('/',auth[_0x2085('0x6')](),controller[_0x2085('0x7')]);router[_0x2085('0x5')]('/:id',auth[_0x2085('0x6')](),controller['show']);router[_0x2085('0x5')](_0x2085('0x8'),auth['isAuthenticated'](),controller[_0x2085('0x9')]);router[_0x2085('0x5')](_0x2085('0xa'),auth['isAuthenticated'](),controller[_0x2085('0xb')]);router[_0x2085('0x5')]('/:id/descriptions',auth[_0x2085('0x6')](),controller[_0x2085('0xc')]);router[_0x2085('0xd')]('/',auth[_0x2085('0x6')](),controller[_0x2085('0xe')]);router[_0x2085('0xf')]('/:id',auth[_0x2085('0x6')](),controller[_0x2085('0x10')]);router['delete'](_0x2085('0x11'),auth[_0x2085('0x6')](),controller[_0x2085('0x12')]);module[_0x2085('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 403f40b..6136072 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 _0x0340=['ENUM','incident','phonecall','exports','STRING'];(function(_0x2f33bf,_0x4ec2d5){var _0x14897c=function(_0x2b2d65){while(--_0x2b2d65){_0x2f33bf['push'](_0x2f33bf['shift']());}};_0x14897c(++_0x4ec2d5);}(_0x0340,0x166));var _0x0034=function(_0x3b66b4,_0xa8a08d){_0x3b66b4=_0x3b66b4-0x0;var _0x3b689c=_0x0340[_0x3b66b4];return _0x3b689c;};'use strict';var Sequelize=require('sequelize');module[_0x0034('0x0')]={'name':{'type':Sequelize[_0x0034('0x1')]},'description':{'type':Sequelize[_0x0034('0x1')]},'ticketType':{'type':Sequelize[_0x0034('0x2')](_0x0034('0x3'),_0x0034('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x50dd=['phonecall','exports','STRING','ENUM','incident'];(function(_0x917ad2,_0x57b612){var _0x4332d9=function(_0x25c2f9){while(--_0x25c2f9){_0x917ad2['push'](_0x917ad2['shift']());}};_0x4332d9(++_0x57b612);}(_0x50dd,0x8d));var _0xd50d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50dd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd50d('0x0')]={'name':{'type':Sequelize[_0xd50d('0x1')]},'description':{'type':Sequelize[_0xd50d('0x1')]},'ticketType':{'type':Sequelize[_0xd50d('0x2')](_0xd50d('0x3'),_0xd50d('0x4')),'defaultValue':_0xd50d('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 59f7561..8db230b 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 _0x19bf=['message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','update','destroy','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','filters','model','intersection','fields','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','options','find','create','body','getFields','hasOwnProperty','getSubjects','findOne','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x19bf,0x18f));var _0xf19b=function(_0x436c06,_0x3f56b5){_0x436c06=_0x436c06-0x0;var _0x227aea=_0x19bf[_0x436c06];return _0x227aea;};'use strict';var pdf=require(_0xf19b('0x0'));var emlformat=require(_0xf19b('0x1'));var rimraf=require(_0xf19b('0x2'));var zipdir=require(_0xf19b('0x3'));var jsonpatch=require(_0xf19b('0x4'));var rp=require(_0xf19b('0x5'));var moment=require(_0xf19b('0x6'));var BPromise=require(_0xf19b('0x7'));var Mustache=require(_0xf19b('0x8'));var util=require(_0xf19b('0x9'));var path=require(_0xf19b('0xa'));var sox=require(_0xf19b('0xb'));var csv=require(_0xf19b('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf19b('0xd'));var squel=require(_0xf19b('0xe'));var crypto=require('crypto');var jsforce=require(_0xf19b('0xf'));var deskjs=require(_0xf19b('0x10'));var toCsv=require(_0xf19b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf19b('0x11'));var authService=require(_0xf19b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf19b('0x13'));var hardwareService=require(_0xf19b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf19b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf19b('0x16'));var db=require(_0xf19b('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa237,_0x44614e,_0x3d935a,_0x549cd7){return new BPromise(function(_0x46dea7,_0x1f2a8e){var _0x4648bb=_0x549cd7||client;return _0x4648bb[_0xf19b('0x18')](_0x5aa237,_0x3d935a)[_0xf19b('0x19')](function(_0xe1a10c){logger['info'](_0xf19b('0x1a'),_0x44614e,_0xf19b('0x1b'));logger['debug'](_0xf19b('0x1c'),_0x44614e,_0xf19b('0x1b'),JSON['stringify'](_0xe1a10c));if(_0xe1a10c[_0xf19b('0x1d')]){if(_0xe1a10c[_0xf19b('0x1d')][_0xf19b('0x1e')]===0x1f4){logger['error'](_0xf19b('0x1a'),_0x44614e,_0xe1a10c[_0xf19b('0x1d')][_0xf19b('0x1f')]);return _0x1f2a8e(_0xe1a10c[_0xf19b('0x1d')][_0xf19b('0x1f')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x44614e,_0xe1a10c['error'][_0xf19b('0x1f')]);return _0x46dea7(_0xe1a10c[_0xf19b('0x1d')][_0xf19b('0x1f')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x44614e,_0xf19b('0x1b'));_0x46dea7(_0xe1a10c[_0xf19b('0x20')][_0xf19b('0x1f')]);}})[_0xf19b('0x21')](function(_0x22886a){logger[_0xf19b('0x1d')](_0xf19b('0x1a'),_0x44614e,_0x22886a);_0x1f2a8e(_0x22886a);});});}function respondWithStatusCode(_0x2cd119,_0x4841c5){_0x4841c5=_0x4841c5||0xcc;return function(_0x9df78d){if(_0x9df78d){return _0x2cd119[_0xf19b('0x22')](_0x4841c5);}return _0x2cd119[_0xf19b('0x23')](_0x4841c5)[_0xf19b('0x24')]();};}function respondWithResult(_0x49efb3,_0x35d795){_0x35d795=_0x35d795||0xc8;return function(_0x5f3419){if(_0x5f3419){return _0x49efb3[_0xf19b('0x23')](_0x35d795)['json'](_0x5f3419);}};}function respondWithFilteredResult(_0x5e01c9,_0x4cefb8){return function(_0x9fcaa8){if(_0x9fcaa8){var _0x54ebba=_0x9fcaa8['count'],_0x34ffdf=_0x4cefb8['offset'],_0x50fb13=_0x4cefb8[_0xf19b('0x25')]+_0x4cefb8[_0xf19b('0x26')],_0xba66bf;if(_0x50fb13>=_0x54ebba){_0x50fb13=_0x54ebba;_0xba66bf=0xc8;}else{_0xba66bf=0xce;}_0x5e01c9[_0xf19b('0x23')](_0xba66bf);return _0x5e01c9[_0xf19b('0x27')](_0xf19b('0x28'),_0x34ffdf+'-'+_0x50fb13+'/'+_0x54ebba)[_0xf19b('0x29')](_0x9fcaa8);}return null;};}function patchUpdates(_0x49fff2){return function(_0x345cdf){try{jsonpatch[_0xf19b('0x2a')](_0x345cdf,_0x49fff2,!![]);}catch(_0x53d7f8){return BPromise['reject'](_0x53d7f8);}return _0x345cdf['save']();};}function saveUpdates(_0x24266b,_0x24d3fe){return function(_0xcd07e5){if(_0xcd07e5){return _0xcd07e5[_0xf19b('0x2b')](_0x24266b)['then'](function(_0x885647){return _0x885647;});}return null;};}function removeEntity(_0x43e31c,_0x491f52){return function(_0x592131){if(_0x592131){return _0x592131[_0xf19b('0x2c')]()[_0xf19b('0x19')](function(){_0x43e31c[_0xf19b('0x23')](0xcc)[_0xf19b('0x24')]();});}};}function handleEntityNotFound(_0x14bcc8,_0x22ce4c){return function(_0x29700b){if(!_0x29700b){_0x14bcc8[_0xf19b('0x22')](0x194);}return _0x29700b;};}function handleError(_0x1aa015,_0x2e1ab8){_0x2e1ab8=_0x2e1ab8||0x1f4;return function(_0x281474){logger[_0xf19b('0x1d')](_0x281474[_0xf19b('0x2d')]);if(_0x281474['name']){delete _0x281474[_0xf19b('0x2e')];}_0x1aa015['status'](_0x2e1ab8)['send'](_0x281474);};}exports[_0xf19b('0x2f')]=function(_0x40e838,_0x50ad3f){var _0x28c471={},_0x2e5e14={},_0x589b6d={'count':0x0,'rows':[]};var _0x5ec87c=_[_0xf19b('0x30')](db[_0xf19b('0x31')][_0xf19b('0x32')],function(_0x366078){return{'name':_0x366078[_0xf19b('0x33')],'type':_0x366078[_0xf19b('0x34')][_0xf19b('0x35')]};});_0x2e5e14['model']=_[_0xf19b('0x30')](_0x5ec87c,_0xf19b('0x2e'));_0x2e5e14['query']=_[_0xf19b('0x36')](_0x40e838['query']);_0x2e5e14[_0xf19b('0x37')]=_['intersection'](_0x2e5e14[_0xf19b('0x38')],_0x2e5e14['query']);_0x28c471['attributes']=_[_0xf19b('0x39')](_0x2e5e14[_0xf19b('0x38')],qs[_0xf19b('0x3a')](_0x40e838[_0xf19b('0x3b')][_0xf19b('0x3a')]));_0x28c471[_0xf19b('0x3c')]=_0x28c471[_0xf19b('0x3c')][_0xf19b('0x3d')]?_0x28c471[_0xf19b('0x3c')]:_0x2e5e14[_0xf19b('0x38')];if(!_0x40e838[_0xf19b('0x3b')]['hasOwnProperty'](_0xf19b('0x3e'))){_0x28c471[_0xf19b('0x26')]=qs[_0xf19b('0x26')](_0x40e838['query'][_0xf19b('0x26')]);_0x28c471['offset']=qs[_0xf19b('0x25')](_0x40e838[_0xf19b('0x3b')]['offset']);}_0x28c471[_0xf19b('0x3f')]=qs[_0xf19b('0x40')](_0x40e838[_0xf19b('0x3b')][_0xf19b('0x40')]);_0x28c471[_0xf19b('0x41')]=qs[_0xf19b('0x37')](_[_0xf19b('0x42')](_0x40e838[_0xf19b('0x3b')],_0x2e5e14[_0xf19b('0x37')]),_0x5ec87c);if(_0x40e838[_0xf19b('0x3b')][_0xf19b('0x43')]){_0x28c471[_0xf19b('0x41')]=_[_0xf19b('0x44')](_0x28c471[_0xf19b('0x41')],{'$or':_[_0xf19b('0x30')](_0x5ec87c,function(_0x4d1906){if(_0x4d1906[_0xf19b('0x34')]!=='VIRTUAL'){var _0x478570={};_0x478570[_0x4d1906[_0xf19b('0x2e')]]={'$like':'%'+_0x40e838[_0xf19b('0x3b')][_0xf19b('0x43')]+'%'};return _0x478570;}})});}_0x28c471=_[_0xf19b('0x44')]({},_0x28c471,_0x40e838['options']);var _0x2a9260={'where':_0x28c471[_0xf19b('0x41')]};return db[_0xf19b('0x31')][_0xf19b('0x45')](_0x2a9260)[_0xf19b('0x19')](function(_0xd6b298){_0x589b6d['count']=_0xd6b298;if(_0x40e838[_0xf19b('0x3b')][_0xf19b('0x46')]){_0x28c471[_0xf19b('0x47')]=[{'all':!![]}];}return db[_0xf19b('0x31')][_0xf19b('0x48')](_0x28c471);})[_0xf19b('0x19')](function(_0x4ecb8e){_0x589b6d[_0xf19b('0x49')]=_0x4ecb8e;return _0x589b6d;})[_0xf19b('0x19')](respondWithFilteredResult(_0x50ad3f,_0x28c471))[_0xf19b('0x21')](handleError(_0x50ad3f,null));};exports[_0xf19b('0x4a')]=function(_0x4c64b7,_0x28ce68){var _0x3f7373={'raw':![],'where':{'id':_0x4c64b7[_0xf19b('0x4b')]['id']}},_0x9fab30={};_0x9fab30['model']=_[_0xf19b('0x36')](db[_0xf19b('0x31')][_0xf19b('0x32')]);_0x9fab30[_0xf19b('0x3b')]=_[_0xf19b('0x36')](_0x4c64b7['query']);_0x9fab30[_0xf19b('0x37')]=_['intersection'](_0x9fab30['model'],_0x9fab30[_0xf19b('0x3b')]);_0x3f7373['attributes']=_[_0xf19b('0x39')](_0x9fab30[_0xf19b('0x38')],qs[_0xf19b('0x3a')](_0x4c64b7[_0xf19b('0x3b')][_0xf19b('0x3a')]));_0x3f7373[_0xf19b('0x3c')]=_0x3f7373['attributes'][_0xf19b('0x3d')]?_0x3f7373[_0xf19b('0x3c')]:_0x9fab30[_0xf19b('0x38')];if(_0x4c64b7[_0xf19b('0x3b')][_0xf19b('0x46')]){_0x3f7373[_0xf19b('0x47')]=[{'all':!![]}];}_0x3f7373=_['merge']({},_0x3f7373,_0x4c64b7[_0xf19b('0x4c')]);return db[_0xf19b('0x31')][_0xf19b('0x4d')](_0x3f7373)[_0xf19b('0x19')](handleEntityNotFound(_0x28ce68,null))['then'](respondWithResult(_0x28ce68,null))[_0xf19b('0x21')](handleError(_0x28ce68,null));};exports['create']=function(_0x1f7f0e,_0x53abef){return db[_0xf19b('0x31')][_0xf19b('0x4e')](_0x1f7f0e[_0xf19b('0x4f')],{})[_0xf19b('0x19')](respondWithResult(_0x53abef,0xc9))[_0xf19b('0x21')](handleError(_0x53abef,null));};exports[_0xf19b('0x2b')]=function(_0x17f95b,_0x553616){if(_0x17f95b[_0xf19b('0x4f')]['id']){delete _0x17f95b[_0xf19b('0x4f')]['id'];}return db[_0xf19b('0x31')][_0xf19b('0x4d')]({'where':{'id':_0x17f95b[_0xf19b('0x4b')]['id']}})[_0xf19b('0x19')](handleEntityNotFound(_0x553616,null))[_0xf19b('0x19')](saveUpdates(_0x17f95b[_0xf19b('0x4f')],null))[_0xf19b('0x19')](respondWithResult(_0x553616,null))[_0xf19b('0x21')](handleError(_0x553616,null));};exports[_0xf19b('0x2c')]=function(_0x5e80b0,_0x457a28){return db[_0xf19b('0x31')][_0xf19b('0x4d')]({'where':{'id':_0x5e80b0[_0xf19b('0x4b')]['id']}})[_0xf19b('0x19')](handleEntityNotFound(_0x457a28,null))['then'](removeEntity(_0x457a28,null))[_0xf19b('0x21')](handleError(_0x457a28,null));};exports[_0xf19b('0x50')]=function(_0x55d9c9,_0x19f814,_0x13a445){var _0x431be1={};var _0x5b6103={};var _0x17c646;var _0x1a3894;return db[_0xf19b('0x31')]['findOne']({'where':{'id':_0x55d9c9['params']['id']}})[_0xf19b('0x19')](handleEntityNotFound(_0x19f814,null))[_0xf19b('0x19')](function(_0x28bca9){if(_0x28bca9){_0x17c646=_0x28bca9;_0x5b6103[_0xf19b('0x38')]=_[_0xf19b('0x36')](db['Dynamics365Field'][_0xf19b('0x32')]);_0x5b6103[_0xf19b('0x3b')]=_[_0xf19b('0x36')](_0x55d9c9[_0xf19b('0x3b')]);_0x5b6103[_0xf19b('0x37')]=_['intersection'](_0x5b6103[_0xf19b('0x38')],_0x5b6103[_0xf19b('0x3b')]);_0x431be1[_0xf19b('0x3c')]=_['intersection'](_0x5b6103[_0xf19b('0x38')],qs['fields'](_0x55d9c9[_0xf19b('0x3b')][_0xf19b('0x3a')]));_0x431be1['attributes']=_0x431be1[_0xf19b('0x3c')][_0xf19b('0x3d')]?_0x431be1[_0xf19b('0x3c')]:_0x5b6103['model'];_0x431be1['order']=qs[_0xf19b('0x40')](_0x55d9c9['query'][_0xf19b('0x40')]);_0x431be1[_0xf19b('0x41')]=qs[_0xf19b('0x37')](_[_0xf19b('0x42')](_0x55d9c9[_0xf19b('0x3b')],_0x5b6103[_0xf19b('0x37')]));if(_0x55d9c9[_0xf19b('0x3b')]['filter']){_0x431be1['where']=_['merge'](_0x431be1['where'],{'$or':_[_0xf19b('0x30')](_0x431be1[_0xf19b('0x3c')],function(_0x5a4227){var _0xc191ea={};_0xc191ea[_0x5a4227]={'$like':'%'+_0x55d9c9[_0xf19b('0x3b')][_0xf19b('0x43')]+'%'};return _0xc191ea;})});}_0x431be1=_[_0xf19b('0x44')]({},_0x431be1,_0x55d9c9[_0xf19b('0x4c')]);return _0x17c646['getFields'](_0x431be1);}})[_0xf19b('0x19')](function(_0x3b2ddb){if(_0x3b2ddb){_0x1a3894=_0x3b2ddb[_0xf19b('0x3d')];if(!_0x55d9c9[_0xf19b('0x3b')][_0xf19b('0x51')](_0xf19b('0x3e'))){_0x431be1['limit']=qs['limit'](_0x55d9c9['query'][_0xf19b('0x26')]);_0x431be1[_0xf19b('0x25')]=qs[_0xf19b('0x25')](_0x55d9c9[_0xf19b('0x3b')][_0xf19b('0x25')]);}return _0x17c646['getFields'](_0x431be1);}})[_0xf19b('0x19')](function(_0xeba3d0){if(_0xeba3d0){return _0xeba3d0?{'count':_0x1a3894,'rows':_0xeba3d0}:null;}})[_0xf19b('0x19')](respondWithResult(_0x19f814,null))[_0xf19b('0x21')](handleError(_0x19f814,null));};exports[_0xf19b('0x52')]=function(_0x834381,_0x4dc1fc,_0x525547){var _0x13cf87={};var _0x22a26f={};var _0x54a376;var _0x26dd07;return db[_0xf19b('0x31')][_0xf19b('0x53')]({'where':{'id':_0x834381[_0xf19b('0x4b')]['id']}})[_0xf19b('0x19')](handleEntityNotFound(_0x4dc1fc,null))[_0xf19b('0x19')](function(_0x23aad1){if(_0x23aad1){_0x54a376=_0x23aad1;_0x22a26f[_0xf19b('0x38')]=_[_0xf19b('0x36')](db[_0xf19b('0x54')][_0xf19b('0x32')]);_0x22a26f[_0xf19b('0x3b')]=_[_0xf19b('0x36')](_0x834381[_0xf19b('0x3b')]);_0x22a26f['filters']=_[_0xf19b('0x39')](_0x22a26f[_0xf19b('0x38')],_0x22a26f['query']);_0x13cf87[_0xf19b('0x3c')]=_[_0xf19b('0x39')](_0x22a26f[_0xf19b('0x38')],qs['fields'](_0x834381[_0xf19b('0x3b')][_0xf19b('0x3a')]));_0x13cf87[_0xf19b('0x3c')]=_0x13cf87['attributes'][_0xf19b('0x3d')]?_0x13cf87[_0xf19b('0x3c')]:_0x22a26f[_0xf19b('0x38')];_0x13cf87[_0xf19b('0x3f')]=qs[_0xf19b('0x40')](_0x834381['query'][_0xf19b('0x40')]);_0x13cf87[_0xf19b('0x41')]=qs[_0xf19b('0x37')](_[_0xf19b('0x42')](_0x834381['query'],_0x22a26f[_0xf19b('0x37')]));if(_0x834381[_0xf19b('0x3b')][_0xf19b('0x43')]){_0x13cf87[_0xf19b('0x41')]=_[_0xf19b('0x44')](_0x13cf87[_0xf19b('0x41')],{'$or':_['map'](_0x13cf87['attributes'],function(_0xfffd41){var _0x329da5={};_0x329da5[_0xfffd41]={'$like':'%'+_0x834381[_0xf19b('0x3b')]['filter']+'%'};return _0x329da5;})});}_0x13cf87=_[_0xf19b('0x44')]({},_0x13cf87,_0x834381['options']);return _0x54a376[_0xf19b('0x52')](_0x13cf87);}})[_0xf19b('0x19')](function(_0x7e870c){if(_0x7e870c){_0x26dd07=_0x7e870c[_0xf19b('0x3d')];if(!_0x834381['query']['hasOwnProperty'](_0xf19b('0x3e'))){_0x13cf87['limit']=qs[_0xf19b('0x26')](_0x834381[_0xf19b('0x3b')][_0xf19b('0x26')]);_0x13cf87[_0xf19b('0x25')]=qs['offset'](_0x834381[_0xf19b('0x3b')][_0xf19b('0x25')]);}return _0x54a376['getSubjects'](_0x13cf87);}})['then'](function(_0x4d2ff0){if(_0x4d2ff0){return _0x4d2ff0?{'count':_0x26dd07,'rows':_0x4d2ff0}:null;}})[_0xf19b('0x19')](respondWithResult(_0x4dc1fc,null))[_0xf19b('0x21')](handleError(_0x4dc1fc,null));};exports[_0xf19b('0x55')]=function(_0xad578b,_0x2e0a25,_0x32b914){var _0x84420d={};var _0x3714f8={};var _0x2aabe0;var _0x5b994d;return db[_0xf19b('0x31')]['findOne']({'where':{'id':_0xad578b[_0xf19b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e0a25,null))[_0xf19b('0x19')](function(_0x407e50){if(_0x407e50){_0x2aabe0=_0x407e50;_0x3714f8['model']=_['keys'](db[_0xf19b('0x54')][_0xf19b('0x32')]);_0x3714f8[_0xf19b('0x3b')]=_[_0xf19b('0x36')](_0xad578b[_0xf19b('0x3b')]);_0x3714f8[_0xf19b('0x37')]=_[_0xf19b('0x39')](_0x3714f8[_0xf19b('0x38')],_0x3714f8[_0xf19b('0x3b')]);_0x84420d[_0xf19b('0x3c')]=_[_0xf19b('0x39')](_0x3714f8[_0xf19b('0x38')],qs[_0xf19b('0x3a')](_0xad578b[_0xf19b('0x3b')][_0xf19b('0x3a')]));_0x84420d[_0xf19b('0x3c')]=_0x84420d[_0xf19b('0x3c')][_0xf19b('0x3d')]?_0x84420d['attributes']:_0x3714f8[_0xf19b('0x38')];_0x84420d[_0xf19b('0x3f')]=qs[_0xf19b('0x40')](_0xad578b[_0xf19b('0x3b')][_0xf19b('0x40')]);_0x84420d[_0xf19b('0x41')]=qs[_0xf19b('0x37')](_['pick'](_0xad578b[_0xf19b('0x3b')],_0x3714f8[_0xf19b('0x37')]));if(_0xad578b['query'][_0xf19b('0x43')]){_0x84420d[_0xf19b('0x41')]=_['merge'](_0x84420d[_0xf19b('0x41')],{'$or':_['map'](_0x84420d[_0xf19b('0x3c')],function(_0x15aa2e){var _0x2d1b1e={};_0x2d1b1e[_0x15aa2e]={'$like':'%'+_0xad578b[_0xf19b('0x3b')]['filter']+'%'};return _0x2d1b1e;})});}_0x84420d=_[_0xf19b('0x44')]({},_0x84420d,_0xad578b[_0xf19b('0x4c')]);return _0x2aabe0[_0xf19b('0x55')](_0x84420d);}})['then'](function(_0x4e587b){if(_0x4e587b){_0x5b994d=_0x4e587b['length'];if(!_0xad578b[_0xf19b('0x3b')][_0xf19b('0x51')](_0xf19b('0x3e'))){_0x84420d[_0xf19b('0x26')]=qs[_0xf19b('0x26')](_0xad578b[_0xf19b('0x3b')][_0xf19b('0x26')]);_0x84420d['offset']=qs[_0xf19b('0x25')](_0xad578b[_0xf19b('0x3b')][_0xf19b('0x25')]);}return _0x2aabe0[_0xf19b('0x55')](_0x84420d);}})[_0xf19b('0x19')](function(_0x1ed241){if(_0x1ed241){return _0x1ed241?{'count':_0x5b994d,'rows':_0x1ed241}:null;}})[_0xf19b('0x19')](respondWithResult(_0x2e0a25,null))[_0xf19b('0x21')](handleError(_0x2e0a25,null));}; \ No newline at end of file +var _0x16da=['http','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','Dynamics365Field','order','pick','getFields','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','client'];(function(_0xf925f2,_0x1fb6a0){var _0x181a50=function(_0x52c95d){while(--_0x52c95d){_0xf925f2['push'](_0xf925f2['shift']());}};_0x181a50(++_0x1fb6a0);}(_0x16da,0x1f2));var _0xa16d=function(_0x1550f2,_0x91e10d){_0x1550f2=_0x1550f2-0x0;var _0x29c690=_0x16da[_0x1550f2];return _0x29c690;};'use strict';var pdf=require(_0xa16d('0x0'));var emlformat=require(_0xa16d('0x1'));var rimraf=require(_0xa16d('0x2'));var zipdir=require(_0xa16d('0x3'));var jsonpatch=require(_0xa16d('0x4'));var rp=require(_0xa16d('0x5'));var moment=require('moment');var BPromise=require(_0xa16d('0x6'));var Mustache=require(_0xa16d('0x7'));var util=require('util');var path=require(_0xa16d('0x8'));var sox=require(_0xa16d('0x9'));var csv=require(_0xa16d('0xa'));var ejs=require(_0xa16d('0xb'));var fs=require('fs');var _=require(_0xa16d('0xc'));var squel=require(_0xa16d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa16d('0xe'));var toCsv=require(_0xa16d('0xa'));var querystring=require(_0xa16d('0xf'));var Papa=require('papaparse');var Redis=require(_0xa16d('0x10'));var authService=require(_0xa16d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa16d('0x12'));var hardwareService=require(_0xa16d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa16d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa16d('0x15'));var db=require(_0xa16d('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa16d('0x17')][_0xa16d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x446791,_0x5186c3,_0x453c5f,_0x5b06da){return new BPromise(function(_0x4345cb,_0x4f7908){var _0x4239ba=_0x5b06da||client;return _0x4239ba[_0xa16d('0x19')](_0x446791,_0x453c5f)[_0xa16d('0x1a')](function(_0x372991){logger[_0xa16d('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5186c3,_0xa16d('0x1c'));logger[_0xa16d('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5186c3,_0xa16d('0x1c'),JSON[_0xa16d('0x1e')](_0x372991));if(_0x372991[_0xa16d('0x1f')]){if(_0x372991['error'][_0xa16d('0x20')]===0x1f4){logger[_0xa16d('0x1f')](_0xa16d('0x21'),_0x5186c3,_0x372991['error'][_0xa16d('0x22')]);return _0x4f7908(_0x372991['error']['message']);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5186c3,_0x372991[_0xa16d('0x1f')][_0xa16d('0x22')]);return _0x4345cb(_0x372991[_0xa16d('0x1f')][_0xa16d('0x22')]);}else{logger[_0xa16d('0x1b')](_0xa16d('0x21'),_0x5186c3,_0xa16d('0x1c'));_0x4345cb(_0x372991['result'][_0xa16d('0x22')]);}})['catch'](function(_0x4241b6){logger[_0xa16d('0x1f')](_0xa16d('0x21'),_0x5186c3,_0x4241b6);_0x4f7908(_0x4241b6);});});}function respondWithStatusCode(_0x43988d,_0x2ca71c){_0x2ca71c=_0x2ca71c||0xcc;return function(_0x33636c){if(_0x33636c){return _0x43988d[_0xa16d('0x23')](_0x2ca71c);}return _0x43988d['status'](_0x2ca71c)[_0xa16d('0x24')]();};}function respondWithResult(_0x1e7be3,_0x5d63e9){_0x5d63e9=_0x5d63e9||0xc8;return function(_0x18ac8a){if(_0x18ac8a){return _0x1e7be3[_0xa16d('0x25')](_0x5d63e9)[_0xa16d('0x26')](_0x18ac8a);}};}function respondWithFilteredResult(_0x5a4b4d,_0x30182d){return function(_0x5abfc6){if(_0x5abfc6){var _0x22ab2d=_0x5abfc6[_0xa16d('0x27')],_0x3f47d3=_0x30182d[_0xa16d('0x28')],_0x5f0e77=_0x30182d['offset']+_0x30182d['limit'],_0x254a46;if(_0x5f0e77>=_0x22ab2d){_0x5f0e77=_0x22ab2d;_0x254a46=0xc8;}else{_0x254a46=0xce;}_0x5a4b4d[_0xa16d('0x25')](_0x254a46);return _0x5a4b4d['set'](_0xa16d('0x29'),_0x3f47d3+'-'+_0x5f0e77+'/'+_0x22ab2d)['json'](_0x5abfc6);}return null;};}function patchUpdates(_0x31a82e){return function(_0x1b485f){try{jsonpatch[_0xa16d('0x2a')](_0x1b485f,_0x31a82e,!![]);}catch(_0x4a1720){return BPromise[_0xa16d('0x2b')](_0x4a1720);}return _0x1b485f[_0xa16d('0x2c')]();};}function saveUpdates(_0x5d593,_0x1aa571){return function(_0x45f0bd){if(_0x45f0bd){return _0x45f0bd[_0xa16d('0x2d')](_0x5d593)[_0xa16d('0x1a')](function(_0x55c48e){return _0x55c48e;});}return null;};}function removeEntity(_0x12d502,_0x4e079a){return function(_0x36c438){if(_0x36c438){return _0x36c438[_0xa16d('0x2e')]()[_0xa16d('0x1a')](function(){_0x12d502[_0xa16d('0x25')](0xcc)[_0xa16d('0x24')]();});}};}function handleEntityNotFound(_0x482466,_0x465f7f){return function(_0x2afdd5){if(!_0x2afdd5){_0x482466[_0xa16d('0x23')](0x194);}return _0x2afdd5;};}function handleError(_0x68d16,_0x466bb7){_0x466bb7=_0x466bb7||0x1f4;return function(_0x1147a6){logger[_0xa16d('0x1f')](_0x1147a6[_0xa16d('0x2f')]);if(_0x1147a6[_0xa16d('0x30')]){delete _0x1147a6[_0xa16d('0x30')];}_0x68d16[_0xa16d('0x25')](_0x466bb7)[_0xa16d('0x31')](_0x1147a6);};}exports['index']=function(_0x52fe36,_0x2a8263){var _0x954bec={},_0x3344ef={},_0x46557a={'count':0x0,'rows':[]};var _0x45c8d8=_[_0xa16d('0x32')](db[_0xa16d('0x33')][_0xa16d('0x34')],function(_0x6a65ce){return{'name':_0x6a65ce[_0xa16d('0x35')],'type':_0x6a65ce[_0xa16d('0x36')]['key']};});_0x3344ef[_0xa16d('0x37')]=_[_0xa16d('0x32')](_0x45c8d8,_0xa16d('0x30'));_0x3344ef[_0xa16d('0x38')]=_[_0xa16d('0x39')](_0x52fe36[_0xa16d('0x38')]);_0x3344ef[_0xa16d('0x3a')]=_[_0xa16d('0x3b')](_0x3344ef[_0xa16d('0x37')],_0x3344ef[_0xa16d('0x38')]);_0x954bec[_0xa16d('0x3c')]=_[_0xa16d('0x3b')](_0x3344ef[_0xa16d('0x37')],qs['fields'](_0x52fe36['query'][_0xa16d('0x3d')]));_0x954bec['attributes']=_0x954bec[_0xa16d('0x3c')][_0xa16d('0x3e')]?_0x954bec[_0xa16d('0x3c')]:_0x3344ef[_0xa16d('0x37')];if(!_0x52fe36[_0xa16d('0x38')][_0xa16d('0x3f')](_0xa16d('0x40'))){_0x954bec[_0xa16d('0x41')]=qs[_0xa16d('0x41')](_0x52fe36['query'][_0xa16d('0x41')]);_0x954bec[_0xa16d('0x28')]=qs[_0xa16d('0x28')](_0x52fe36[_0xa16d('0x38')][_0xa16d('0x28')]);}_0x954bec['order']=qs[_0xa16d('0x42')](_0x52fe36[_0xa16d('0x38')][_0xa16d('0x42')]);_0x954bec[_0xa16d('0x43')]=qs[_0xa16d('0x3a')](_['pick'](_0x52fe36[_0xa16d('0x38')],_0x3344ef['filters']),_0x45c8d8);if(_0x52fe36[_0xa16d('0x38')][_0xa16d('0x44')]){_0x954bec[_0xa16d('0x43')]=_[_0xa16d('0x45')](_0x954bec[_0xa16d('0x43')],{'$or':_[_0xa16d('0x32')](_0x45c8d8,function(_0x1f9424){if(_0x1f9424[_0xa16d('0x36')]!=='VIRTUAL'){var _0xf1f188={};_0xf1f188[_0x1f9424[_0xa16d('0x30')]]={'$like':'%'+_0x52fe36[_0xa16d('0x38')][_0xa16d('0x44')]+'%'};return _0xf1f188;}})});}_0x954bec=_[_0xa16d('0x45')]({},_0x954bec,_0x52fe36[_0xa16d('0x46')]);var _0x3b3d63={'where':_0x954bec[_0xa16d('0x43')]};return db[_0xa16d('0x33')]['count'](_0x3b3d63)['then'](function(_0x668ec8){_0x46557a['count']=_0x668ec8;if(_0x52fe36['query'][_0xa16d('0x47')]){_0x954bec['include']=[{'all':!![]}];}return db[_0xa16d('0x33')][_0xa16d('0x48')](_0x954bec);})['then'](function(_0x4dbe23){_0x46557a[_0xa16d('0x49')]=_0x4dbe23;return _0x46557a;})[_0xa16d('0x1a')](respondWithFilteredResult(_0x2a8263,_0x954bec))[_0xa16d('0x4a')](handleError(_0x2a8263,null));};exports[_0xa16d('0x4b')]=function(_0x1f38c6,_0x4c7903){var _0x184e83={'raw':![],'where':{'id':_0x1f38c6[_0xa16d('0x4c')]['id']}},_0x30b647={};_0x30b647[_0xa16d('0x37')]=_[_0xa16d('0x39')](db[_0xa16d('0x33')][_0xa16d('0x34')]);_0x30b647[_0xa16d('0x38')]=_['keys'](_0x1f38c6[_0xa16d('0x38')]);_0x30b647['filters']=_[_0xa16d('0x3b')](_0x30b647['model'],_0x30b647[_0xa16d('0x38')]);_0x184e83['attributes']=_[_0xa16d('0x3b')](_0x30b647[_0xa16d('0x37')],qs[_0xa16d('0x3d')](_0x1f38c6['query'][_0xa16d('0x3d')]));_0x184e83['attributes']=_0x184e83['attributes'][_0xa16d('0x3e')]?_0x184e83[_0xa16d('0x3c')]:_0x30b647['model'];if(_0x1f38c6['query'][_0xa16d('0x47')]){_0x184e83[_0xa16d('0x4d')]=[{'all':!![]}];}_0x184e83=_[_0xa16d('0x45')]({},_0x184e83,_0x1f38c6['options']);return db[_0xa16d('0x33')][_0xa16d('0x4e')](_0x184e83)[_0xa16d('0x1a')](handleEntityNotFound(_0x4c7903,null))[_0xa16d('0x1a')](respondWithResult(_0x4c7903,null))['catch'](handleError(_0x4c7903,null));};exports['create']=function(_0x46e864,_0x1dc9be){return db['Dynamics365Configuration']['create'](_0x46e864['body'],{})[_0xa16d('0x1a')](respondWithResult(_0x1dc9be,0xc9))[_0xa16d('0x4a')](handleError(_0x1dc9be,null));};exports[_0xa16d('0x2d')]=function(_0x53a7d4,_0x301d00){if(_0x53a7d4[_0xa16d('0x4f')]['id']){delete _0x53a7d4[_0xa16d('0x4f')]['id'];}return db[_0xa16d('0x33')][_0xa16d('0x4e')]({'where':{'id':_0x53a7d4['params']['id']}})[_0xa16d('0x1a')](handleEntityNotFound(_0x301d00,null))['then'](saveUpdates(_0x53a7d4[_0xa16d('0x4f')],null))[_0xa16d('0x1a')](respondWithResult(_0x301d00,null))[_0xa16d('0x4a')](handleError(_0x301d00,null));};exports[_0xa16d('0x2e')]=function(_0x4c658e,_0x3559ce){return db['Dynamics365Configuration']['find']({'where':{'id':_0x4c658e[_0xa16d('0x4c')]['id']}})[_0xa16d('0x1a')](handleEntityNotFound(_0x3559ce,null))[_0xa16d('0x1a')](removeEntity(_0x3559ce,null))[_0xa16d('0x4a')](handleError(_0x3559ce,null));};exports['getFields']=function(_0x55d614,_0x42696f,_0x3d380a){var _0x3e8ff2={};var _0x2a5bae={};var _0x17903f;var _0x2de073;return db[_0xa16d('0x33')]['findOne']({'where':{'id':_0x55d614[_0xa16d('0x4c')]['id']}})[_0xa16d('0x1a')](handleEntityNotFound(_0x42696f,null))[_0xa16d('0x1a')](function(_0x38f16b){if(_0x38f16b){_0x17903f=_0x38f16b;_0x2a5bae[_0xa16d('0x37')]=_[_0xa16d('0x39')](db[_0xa16d('0x50')][_0xa16d('0x34')]);_0x2a5bae[_0xa16d('0x38')]=_[_0xa16d('0x39')](_0x55d614['query']);_0x2a5bae[_0xa16d('0x3a')]=_[_0xa16d('0x3b')](_0x2a5bae['model'],_0x2a5bae[_0xa16d('0x38')]);_0x3e8ff2[_0xa16d('0x3c')]=_[_0xa16d('0x3b')](_0x2a5bae['model'],qs[_0xa16d('0x3d')](_0x55d614[_0xa16d('0x38')]['fields']));_0x3e8ff2[_0xa16d('0x3c')]=_0x3e8ff2[_0xa16d('0x3c')][_0xa16d('0x3e')]?_0x3e8ff2[_0xa16d('0x3c')]:_0x2a5bae[_0xa16d('0x37')];_0x3e8ff2[_0xa16d('0x51')]=qs[_0xa16d('0x42')](_0x55d614[_0xa16d('0x38')][_0xa16d('0x42')]);_0x3e8ff2[_0xa16d('0x43')]=qs['filters'](_[_0xa16d('0x52')](_0x55d614[_0xa16d('0x38')],_0x2a5bae[_0xa16d('0x3a')]));if(_0x55d614['query'][_0xa16d('0x44')]){_0x3e8ff2[_0xa16d('0x43')]=_[_0xa16d('0x45')](_0x3e8ff2[_0xa16d('0x43')],{'$or':_[_0xa16d('0x32')](_0x3e8ff2[_0xa16d('0x3c')],function(_0x2a3096){var _0x456a5b={};_0x456a5b[_0x2a3096]={'$like':'%'+_0x55d614[_0xa16d('0x38')]['filter']+'%'};return _0x456a5b;})});}_0x3e8ff2=_['merge']({},_0x3e8ff2,_0x55d614[_0xa16d('0x46')]);return _0x17903f[_0xa16d('0x53')](_0x3e8ff2);}})['then'](function(_0x99605c){if(_0x99605c){_0x2de073=_0x99605c[_0xa16d('0x3e')];if(!_0x55d614[_0xa16d('0x38')][_0xa16d('0x3f')]('nolimit')){_0x3e8ff2[_0xa16d('0x41')]=qs['limit'](_0x55d614[_0xa16d('0x38')][_0xa16d('0x41')]);_0x3e8ff2[_0xa16d('0x28')]=qs[_0xa16d('0x28')](_0x55d614[_0xa16d('0x38')][_0xa16d('0x28')]);}return _0x17903f[_0xa16d('0x53')](_0x3e8ff2);}})[_0xa16d('0x1a')](function(_0x176835){if(_0x176835){return _0x176835?{'count':_0x2de073,'rows':_0x176835}:null;}})[_0xa16d('0x1a')](respondWithResult(_0x42696f,null))[_0xa16d('0x4a')](handleError(_0x42696f,null));};exports[_0xa16d('0x54')]=function(_0x423fd1,_0x41d182,_0x5bb29c){var _0x25fae5={};var _0x4e6c2f={};var _0xfbe2b0;var _0x2e79a5;return db[_0xa16d('0x33')][_0xa16d('0x55')]({'where':{'id':_0x423fd1['params']['id']}})[_0xa16d('0x1a')](handleEntityNotFound(_0x41d182,null))[_0xa16d('0x1a')](function(_0x4dbbc5){if(_0x4dbbc5){_0xfbe2b0=_0x4dbbc5;_0x4e6c2f[_0xa16d('0x37')]=_['keys'](db[_0xa16d('0x50')]['rawAttributes']);_0x4e6c2f[_0xa16d('0x38')]=_[_0xa16d('0x39')](_0x423fd1[_0xa16d('0x38')]);_0x4e6c2f[_0xa16d('0x3a')]=_[_0xa16d('0x3b')](_0x4e6c2f[_0xa16d('0x37')],_0x4e6c2f[_0xa16d('0x38')]);_0x25fae5['attributes']=_[_0xa16d('0x3b')](_0x4e6c2f['model'],qs[_0xa16d('0x3d')](_0x423fd1[_0xa16d('0x38')][_0xa16d('0x3d')]));_0x25fae5[_0xa16d('0x3c')]=_0x25fae5['attributes'][_0xa16d('0x3e')]?_0x25fae5['attributes']:_0x4e6c2f['model'];_0x25fae5[_0xa16d('0x51')]=qs['sort'](_0x423fd1[_0xa16d('0x38')]['sort']);_0x25fae5['where']=qs[_0xa16d('0x3a')](_[_0xa16d('0x52')](_0x423fd1[_0xa16d('0x38')],_0x4e6c2f[_0xa16d('0x3a')]));if(_0x423fd1[_0xa16d('0x38')]['filter']){_0x25fae5[_0xa16d('0x43')]=_['merge'](_0x25fae5[_0xa16d('0x43')],{'$or':_['map'](_0x25fae5['attributes'],function(_0x1a6006){var _0x3f9db1={};_0x3f9db1[_0x1a6006]={'$like':'%'+_0x423fd1[_0xa16d('0x38')][_0xa16d('0x44')]+'%'};return _0x3f9db1;})});}_0x25fae5=_[_0xa16d('0x45')]({},_0x25fae5,_0x423fd1[_0xa16d('0x46')]);return _0xfbe2b0[_0xa16d('0x54')](_0x25fae5);}})['then'](function(_0x29959b){if(_0x29959b){_0x2e79a5=_0x29959b[_0xa16d('0x3e')];if(!_0x423fd1[_0xa16d('0x38')][_0xa16d('0x3f')]('nolimit')){_0x25fae5[_0xa16d('0x41')]=qs[_0xa16d('0x41')](_0x423fd1[_0xa16d('0x38')][_0xa16d('0x41')]);_0x25fae5[_0xa16d('0x28')]=qs[_0xa16d('0x28')](_0x423fd1[_0xa16d('0x38')][_0xa16d('0x28')]);}return _0xfbe2b0[_0xa16d('0x54')](_0x25fae5);}})[_0xa16d('0x1a')](function(_0x40a086){if(_0x40a086){return _0x40a086?{'count':_0x2e79a5,'rows':_0x40a086}:null;}})[_0xa16d('0x1a')](respondWithResult(_0x41d182,null))[_0xa16d('0x4a')](handleError(_0x41d182,null));};exports[_0xa16d('0x56')]=function(_0x312e4c,_0x5d4cea,_0x5b6584){var _0x1c3c44={};var _0x2df316={};var _0x4d3c2e;var _0x5105fe;return db[_0xa16d('0x33')]['findOne']({'where':{'id':_0x312e4c[_0xa16d('0x4c')]['id']}})[_0xa16d('0x1a')](handleEntityNotFound(_0x5d4cea,null))[_0xa16d('0x1a')](function(_0x3e4703){if(_0x3e4703){_0x4d3c2e=_0x3e4703;_0x2df316[_0xa16d('0x37')]=_[_0xa16d('0x39')](db['Dynamics365Field']['rawAttributes']);_0x2df316[_0xa16d('0x38')]=_[_0xa16d('0x39')](_0x312e4c[_0xa16d('0x38')]);_0x2df316['filters']=_[_0xa16d('0x3b')](_0x2df316[_0xa16d('0x37')],_0x2df316[_0xa16d('0x38')]);_0x1c3c44[_0xa16d('0x3c')]=_[_0xa16d('0x3b')](_0x2df316['model'],qs[_0xa16d('0x3d')](_0x312e4c[_0xa16d('0x38')][_0xa16d('0x3d')]));_0x1c3c44[_0xa16d('0x3c')]=_0x1c3c44[_0xa16d('0x3c')][_0xa16d('0x3e')]?_0x1c3c44[_0xa16d('0x3c')]:_0x2df316[_0xa16d('0x37')];_0x1c3c44[_0xa16d('0x51')]=qs[_0xa16d('0x42')](_0x312e4c['query']['sort']);_0x1c3c44[_0xa16d('0x43')]=qs[_0xa16d('0x3a')](_[_0xa16d('0x52')](_0x312e4c['query'],_0x2df316[_0xa16d('0x3a')]));if(_0x312e4c[_0xa16d('0x38')]['filter']){_0x1c3c44[_0xa16d('0x43')]=_[_0xa16d('0x45')](_0x1c3c44['where'],{'$or':_['map'](_0x1c3c44[_0xa16d('0x3c')],function(_0x4b1f4b){var _0x5675e0={};_0x5675e0[_0x4b1f4b]={'$like':'%'+_0x312e4c['query'][_0xa16d('0x44')]+'%'};return _0x5675e0;})});}_0x1c3c44=_[_0xa16d('0x45')]({},_0x1c3c44,_0x312e4c[_0xa16d('0x46')]);return _0x4d3c2e[_0xa16d('0x56')](_0x1c3c44);}})['then'](function(_0x4770fc){if(_0x4770fc){_0x5105fe=_0x4770fc[_0xa16d('0x3e')];if(!_0x312e4c[_0xa16d('0x38')][_0xa16d('0x3f')](_0xa16d('0x40'))){_0x1c3c44[_0xa16d('0x41')]=qs[_0xa16d('0x41')](_0x312e4c['query'][_0xa16d('0x41')]);_0x1c3c44[_0xa16d('0x28')]=qs[_0xa16d('0x28')](_0x312e4c[_0xa16d('0x38')][_0xa16d('0x28')]);}return _0x4d3c2e[_0xa16d('0x56')](_0x1c3c44);}})[_0xa16d('0x1a')](function(_0x4ed24c){if(_0x4ed24c){return _0x4ed24c?{'count':_0x5105fe,'rows':_0x4ed24c}:null;}})[_0xa16d('0x1a')](respondWithResult(_0x5d4cea,null))[_0xa16d('0x4a')](handleError(_0x5d4cea,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index b31851e..c2766f8 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 _0xfdeb=['int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','Dynamics365Configuration'];(function(_0x313d3d,_0x3674ca){var _0xb5d40e=function(_0x5b6d4f){while(--_0x5b6d4f){_0x313d3d['push'](_0x313d3d['shift']());}};_0xb5d40e(++_0x3674ca);}(_0xfdeb,0x1b9));var _0xbfde=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0xfdeb[_0x22431e];return _0xd978e9;};'use strict';var _=require(_0xbfde('0x0'));var util=require(_0xbfde('0x1'));var logger=require(_0xbfde('0x2'))(_0xbfde('0x3'));var moment=require(_0xbfde('0x4'));var BPromise=require('bluebird');var rp=require(_0xbfde('0x5'));var fs=require('fs');var path=require(_0xbfde('0x6'));var rimraf=require('rimraf');var config=require(_0xbfde('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xbfde('0x8')]=function(_0x5b8e1a,_0x272cc8){return _0x5b8e1a['define'](_0xbfde('0x9'),attributes,{'tableName':_0xbfde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b18=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3526b1,_0x102f1c){var _0x29eeb5=function(_0x12b09a){while(--_0x12b09a){_0x3526b1['push'](_0x3526b1['shift']());}};_0x29eeb5(++_0x102f1c);}(_0x0b18,0x1b7));var _0x80b1=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0x0b18[_0x5ed54b];return _0x4b58c7;};'use strict';var _=require('lodash');var util=require(_0x80b1('0x0'));var logger=require(_0x80b1('0x1'))(_0x80b1('0x2'));var moment=require('moment');var BPromise=require(_0x80b1('0x3'));var rp=require(_0x80b1('0x4'));var fs=require('fs');var path=require(_0x80b1('0x5'));var rimraf=require(_0x80b1('0x6'));var config=require(_0x80b1('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x80b1('0x8')]=function(_0x29c411,_0x55135e){return _0x29c411[_0x80b1('0x9')](_0x80b1('0xa'),attributes,{'tableName':_0x80b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 8465560..b55b90f 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 _0x0d06=['message','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x17e57c,_0x10efcd){var _0x390a90=function(_0x1c6917){while(--_0x1c6917){_0x17e57c['push'](_0x17e57c['shift']());}};_0x390a90(++_0x10efcd);}(_0x0d06,0xa2));var _0x60d0=function(_0x4af8cf,_0x51a87c){_0x4af8cf=_0x4af8cf-0x0;var _0x1cb78d=_0x0d06[_0x4af8cf];return _0x1cb78d;};'use strict';var _=require(_0x60d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60d0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60d0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x60d0('0x3'))(_0x60d0('0x4'));var config=require('../../config/environment');var jayson=require(_0x60d0('0x5'));var client=jayson[_0x60d0('0x6')][_0x60d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3152df,_0x156254,_0x457e92){return new BPromise(function(_0x29df96,_0x1848a8){return client[_0x60d0('0x8')](_0x3152df,_0x457e92)[_0x60d0('0x9')](function(_0x5b2074){logger[_0x60d0('0xa')](_0x60d0('0xb'),_0x156254,'request\x20sent');logger[_0x60d0('0xc')](_0x60d0('0xd'),_0x156254,_0x60d0('0xe'),JSON[_0x60d0('0xf')](_0x5b2074));if(_0x5b2074['error']){if(_0x5b2074[_0x60d0('0x10')][_0x60d0('0x11')]===0x1f4){logger['error'](_0x60d0('0xb'),_0x156254,_0x5b2074[_0x60d0('0x10')][_0x60d0('0x12')]);return _0x1848a8(_0x5b2074[_0x60d0('0x10')][_0x60d0('0x12')]);}logger[_0x60d0('0x10')](_0x60d0('0xb'),_0x156254,_0x5b2074[_0x60d0('0x10')]['message']);return _0x29df96(_0x5b2074[_0x60d0('0x10')][_0x60d0('0x12')]);}else{logger[_0x60d0('0xa')](_0x60d0('0xb'),_0x156254,'request\x20sent');_0x29df96(_0x5b2074['result'][_0x60d0('0x12')]);}})[_0x60d0('0x13')](function(_0x510d15){logger[_0x60d0('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x156254,_0x510d15);_0x1848a8(_0x510d15);});});} \ No newline at end of file +var _0x5240=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5240,0x83));var _0x0524=function(_0x4d763d,_0x2e9bec){_0x4d763d=_0x4d763d-0x0;var _0x3e74b7=_0x5240[_0x4d763d];return _0x3e74b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0524('0x0'));var BPromise=require('bluebird');var rs=require(_0x0524('0x1'));var fs=require('fs');var Redis=require(_0x0524('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0524('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0524('0x4'));var jayson=require(_0x0524('0x5'));var client=jayson[_0x0524('0x6')][_0x0524('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f56d5,_0x51b8df,_0x2fc1ba){return new BPromise(function(_0x226bfb,_0x588203){return client['request'](_0x2f56d5,_0x2fc1ba)[_0x0524('0x8')](function(_0x4100bb){logger[_0x0524('0x9')](_0x0524('0xa'),_0x51b8df,_0x0524('0xb'));logger[_0x0524('0xc')](_0x0524('0xd'),_0x51b8df,_0x0524('0xb'),JSON[_0x0524('0xe')](_0x4100bb));if(_0x4100bb[_0x0524('0xf')]){if(_0x4100bb[_0x0524('0xf')][_0x0524('0x10')]===0x1f4){logger[_0x0524('0xf')](_0x0524('0xa'),_0x51b8df,_0x4100bb[_0x0524('0xf')][_0x0524('0x11')]);return _0x588203(_0x4100bb['error']['message']);}logger[_0x0524('0xf')](_0x0524('0xa'),_0x51b8df,_0x4100bb[_0x0524('0xf')][_0x0524('0x11')]);return _0x226bfb(_0x4100bb[_0x0524('0xf')][_0x0524('0x11')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x51b8df,'request\x20sent');_0x226bfb(_0x4100bb[_0x0524('0x12')][_0x0524('0x11')]);}})['catch'](function(_0xb8fad9){logger['error'](_0x0524('0xa'),_0x51b8df,_0xb8fad9);_0x588203(_0xb8fad9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 1df17db..fa6b017 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 _0x7d98=['get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x7d98,0xe7));var _0x87d9=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x7d98[_0xe3e0af];return _0x4828e9;};'use strict';var multer=require(_0x87d9('0x0'));var util=require('util');var path=require(_0x87d9('0x1'));var timeout=require(_0x87d9('0x2'));var express=require(_0x87d9('0x3'));var router=express[_0x87d9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x87d9('0x5'));var config=require(_0x87d9('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x87d9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x87d9('0x8'),auth[_0x87d9('0x9')](),controller[_0x87d9('0xa')]);router['post']('/',auth[_0x87d9('0x9')](),controller[_0x87d9('0xb')]);router[_0x87d9('0xc')]('/:id',auth[_0x87d9('0x9')](),controller[_0x87d9('0xd')]);router[_0x87d9('0xe')](_0x87d9('0x8'),auth[_0x87d9('0x9')](),controller[_0x87d9('0xf')]);module[_0x87d9('0x10')]=router; \ No newline at end of file +var _0x76dc=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','post','/:id','delete'];(function(_0x471866,_0x3439ee){var _0x3d7f56=function(_0x530d1d){while(--_0x530d1d){_0x471866['push'](_0x471866['shift']());}};_0x3d7f56(++_0x3439ee);}(_0x76dc,0x1f2));var _0xc76d=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x76dc[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var auth=require(_0xc76d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc76d('0x6'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xc76d('0x7')](),controller[_0xc76d('0x8')]);router[_0xc76d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc76d('0xa')]);router[_0xc76d('0xb')]('/',auth[_0xc76d('0x7')](),controller['create']);router['put'](_0xc76d('0xc'),auth[_0xc76d('0x7')](),controller['update']);router[_0xc76d('0xd')]('/:id',auth[_0xc76d('0x7')](),controller[_0xc76d('0xe')]);module[_0xc76d('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 bea4a76..dce2478 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 _0x4fd0=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x56e9ba,_0x21d718){var _0x47c7eb=function(_0x5a36ef){while(--_0x5a36ef){_0x56e9ba['push'](_0x56e9ba['shift']());}};_0x47c7eb(++_0x21d718);}(_0x4fd0,0x1d4));var _0x04fd=function(_0x4e8efd,_0x46bc20){_0x4e8efd=_0x4e8efd-0x0;var _0x31e442=_0x4fd0[_0x4e8efd];return _0x31e442;};'use strict';var Sequelize=require(_0x04fd('0x0'));module[_0x04fd('0x1')]={'type':{'type':Sequelize[_0x04fd('0x2')](_0x04fd('0x3'),'variable',_0x04fd('0x4'),_0x04fd('0x5')),'defaultValue':_0x04fd('0x3')},'content':{'type':Sequelize[_0x04fd('0x6')]},'key':{'type':Sequelize[_0x04fd('0x6')]},'keyType':{'type':Sequelize[_0x04fd('0x2')](_0x04fd('0x3'),_0x04fd('0x7'),_0x04fd('0x4'))},'keyContent':{'type':Sequelize[_0x04fd('0x6')]},'idField':{'type':Sequelize[_0x04fd('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x04fd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x04fd('0x6')]}}; \ No newline at end of file +var _0x0441=['sequelize','exports','ENUM','string','customVariable','STRING','variable'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x0441,0x8c));var _0x1044=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x0441[_0x1f71d8];return _0x10b045;};'use strict';var Sequelize=require(_0x1044('0x0'));module[_0x1044('0x1')]={'type':{'type':Sequelize[_0x1044('0x2')](_0x1044('0x3'),'variable',_0x1044('0x4'),'keyValue'),'defaultValue':_0x1044('0x3')},'content':{'type':Sequelize[_0x1044('0x5')]},'key':{'type':Sequelize[_0x1044('0x5')]},'keyType':{'type':Sequelize[_0x1044('0x2')](_0x1044('0x3'),_0x1044('0x6'),_0x1044('0x4'))},'keyContent':{'type':Sequelize[_0x1044('0x5')]},'idField':{'type':Sequelize[_0x1044('0x5')]},'nameField':{'type':Sequelize[_0x1044('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1044('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2585be7..e9e3008 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 _0x9e6d=['set','Content-Range','json','apply','save','update','then','stack','name','map','Dynamics365Field','rawAttributes','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9e6d,0x136));var _0xd9e6=function(_0x35b671,_0x1dfec2){_0x35b671=_0x35b671-0x0;var _0x56e928=_0x9e6d[_0x35b671];return _0x56e928;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd9e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9e6('0x1'));var rp=require(_0xd9e6('0x2'));var moment=require(_0xd9e6('0x3'));var BPromise=require(_0xd9e6('0x4'));var Mustache=require(_0xd9e6('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd9e6('0x6'));var csv=require(_0xd9e6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd9e6('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd9e6('0x9'));var toCsv=require('to-csv');var querystring=require(_0xd9e6('0xa'));var Papa=require(_0xd9e6('0xb'));var Redis=require(_0xd9e6('0xc'));var authService=require(_0xd9e6('0xd'));var qs=require(_0xd9e6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9e6('0xf'));var logger=require(_0xd9e6('0x10'))(_0xd9e6('0x11'));var utils=require(_0xd9e6('0x12'));var config=require(_0xd9e6('0x13'));var licenseUtil=require(_0xd9e6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58c6b6,_0x10b4a7){_0x10b4a7=_0x10b4a7||0xcc;return function(_0x143950){if(_0x143950){return _0x58c6b6[_0xd9e6('0x15')](_0x10b4a7);}return _0x58c6b6['status'](_0x10b4a7)[_0xd9e6('0x16')]();};}function respondWithResult(_0x2e9819,_0x5a5062){_0x5a5062=_0x5a5062||0xc8;return function(_0x54fb4f){if(_0x54fb4f){return _0x2e9819[_0xd9e6('0x17')](_0x5a5062)['json'](_0x54fb4f);}};}function respondWithFilteredResult(_0x2b2218,_0x12ce2e){return function(_0x158e1e){if(_0x158e1e){var _0x13f4a4=_0x158e1e['count'],_0x1330f8=_0x12ce2e['offset'],_0x4a04bf=_0x12ce2e[_0xd9e6('0x18')]+_0x12ce2e['limit'],_0x19c2bc;if(_0x4a04bf>=_0x13f4a4){_0x4a04bf=_0x13f4a4;_0x19c2bc=0xc8;}else{_0x19c2bc=0xce;}_0x2b2218[_0xd9e6('0x17')](_0x19c2bc);return _0x2b2218[_0xd9e6('0x19')](_0xd9e6('0x1a'),_0x1330f8+'-'+_0x4a04bf+'/'+_0x13f4a4)[_0xd9e6('0x1b')](_0x158e1e);}return null;};}function patchUpdates(_0x205e9f){return function(_0x318843){try{jsonpatch[_0xd9e6('0x1c')](_0x318843,_0x205e9f,!![]);}catch(_0x3d1ffa){return BPromise['reject'](_0x3d1ffa);}return _0x318843[_0xd9e6('0x1d')]();};}function saveUpdates(_0xad341d,_0x2c16fb){return function(_0x252b1b){if(_0x252b1b){return _0x252b1b[_0xd9e6('0x1e')](_0xad341d)['then'](function(_0x4e7fbc){return _0x4e7fbc;});}return null;};}function removeEntity(_0x54722c,_0x317d7b){return function(_0x107639){if(_0x107639){return _0x107639['destroy']()[_0xd9e6('0x1f')](function(){_0x54722c['status'](0xcc)[_0xd9e6('0x16')]();});}};}function handleEntityNotFound(_0x394972,_0x21331c){return function(_0x45da44){if(!_0x45da44){_0x394972[_0xd9e6('0x15')](0x194);}return _0x45da44;};}function handleError(_0x467fd1,_0x438452){_0x438452=_0x438452||0x1f4;return function(_0x41a936){logger['error'](_0x41a936[_0xd9e6('0x20')]);if(_0x41a936[_0xd9e6('0x21')]){delete _0x41a936[_0xd9e6('0x21')];}_0x467fd1[_0xd9e6('0x17')](_0x438452)['send'](_0x41a936);};}exports['index']=function(_0x39e082,_0x3c5e61){var _0x3efb02={},_0x364107={},_0x110015={'count':0x0,'rows':[]};var _0xdce13d=_[_0xd9e6('0x22')](db[_0xd9e6('0x23')][_0xd9e6('0x24')],function(_0x450c05){return{'name':_0x450c05[_0xd9e6('0x25')],'type':_0x450c05['type']['key']};});_0x364107[_0xd9e6('0x26')]=_[_0xd9e6('0x22')](_0xdce13d,_0xd9e6('0x21'));_0x364107[_0xd9e6('0x27')]=_[_0xd9e6('0x28')](_0x39e082['query']);_0x364107[_0xd9e6('0x29')]=_['intersection'](_0x364107[_0xd9e6('0x26')],_0x364107[_0xd9e6('0x27')]);_0x3efb02['attributes']=_['intersection'](_0x364107[_0xd9e6('0x26')],qs[_0xd9e6('0x2a')](_0x39e082[_0xd9e6('0x27')]['fields']));_0x3efb02[_0xd9e6('0x2b')]=_0x3efb02[_0xd9e6('0x2b')][_0xd9e6('0x2c')]?_0x3efb02[_0xd9e6('0x2b')]:_0x364107['model'];if(!_0x39e082[_0xd9e6('0x27')][_0xd9e6('0x2d')](_0xd9e6('0x2e'))){_0x3efb02[_0xd9e6('0x2f')]=qs[_0xd9e6('0x2f')](_0x39e082[_0xd9e6('0x27')][_0xd9e6('0x2f')]);_0x3efb02['offset']=qs[_0xd9e6('0x18')](_0x39e082[_0xd9e6('0x27')][_0xd9e6('0x18')]);}_0x3efb02[_0xd9e6('0x30')]=qs[_0xd9e6('0x31')](_0x39e082[_0xd9e6('0x27')][_0xd9e6('0x31')]);_0x3efb02[_0xd9e6('0x32')]=qs[_0xd9e6('0x29')](_[_0xd9e6('0x33')](_0x39e082[_0xd9e6('0x27')],_0x364107[_0xd9e6('0x29')]),_0xdce13d);if(_0x39e082[_0xd9e6('0x27')][_0xd9e6('0x34')]){_0x3efb02['where']=_['merge'](_0x3efb02[_0xd9e6('0x32')],{'$or':_['map'](_0xdce13d,function(_0x26e530){if(_0x26e530[_0xd9e6('0x35')]!=='VIRTUAL'){var _0x383973={};_0x383973[_0x26e530[_0xd9e6('0x21')]]={'$like':'%'+_0x39e082['query'][_0xd9e6('0x34')]+'%'};return _0x383973;}})});}_0x3efb02=_['merge']({},_0x3efb02,_0x39e082[_0xd9e6('0x36')]);var _0x1ebec1={'where':_0x3efb02[_0xd9e6('0x32')]};return db[_0xd9e6('0x23')][_0xd9e6('0x37')](_0x1ebec1)[_0xd9e6('0x1f')](function(_0x1cfa4d){_0x110015[_0xd9e6('0x37')]=_0x1cfa4d;if(_0x39e082[_0xd9e6('0x27')][_0xd9e6('0x38')]){_0x3efb02[_0xd9e6('0x39')]=[{'all':!![]}];}return db[_0xd9e6('0x23')][_0xd9e6('0x3a')](_0x3efb02);})['then'](function(_0x1be21b){_0x110015[_0xd9e6('0x3b')]=_0x1be21b;return _0x110015;})[_0xd9e6('0x1f')](respondWithFilteredResult(_0x3c5e61,_0x3efb02))[_0xd9e6('0x3c')](handleError(_0x3c5e61,null));};exports[_0xd9e6('0x3d')]=function(_0x53cc09,_0x44e997){var _0x9c95e2={'raw':!![],'where':{'id':_0x53cc09[_0xd9e6('0x3e')]['id']}},_0x1a0739={};_0x1a0739[_0xd9e6('0x26')]=_['keys'](db[_0xd9e6('0x23')][_0xd9e6('0x24')]);_0x1a0739[_0xd9e6('0x27')]=_[_0xd9e6('0x28')](_0x53cc09[_0xd9e6('0x27')]);_0x1a0739[_0xd9e6('0x29')]=_[_0xd9e6('0x3f')](_0x1a0739[_0xd9e6('0x26')],_0x1a0739[_0xd9e6('0x27')]);_0x9c95e2[_0xd9e6('0x2b')]=_['intersection'](_0x1a0739[_0xd9e6('0x26')],qs['fields'](_0x53cc09[_0xd9e6('0x27')]['fields']));_0x9c95e2['attributes']=_0x9c95e2[_0xd9e6('0x2b')][_0xd9e6('0x2c')]?_0x9c95e2[_0xd9e6('0x2b')]:_0x1a0739[_0xd9e6('0x26')];if(_0x53cc09[_0xd9e6('0x27')][_0xd9e6('0x38')]){_0x9c95e2[_0xd9e6('0x39')]=[{'all':!![]}];}_0x9c95e2=_['merge']({},_0x9c95e2,_0x53cc09[_0xd9e6('0x36')]);return db[_0xd9e6('0x23')][_0xd9e6('0x40')](_0x9c95e2)['then'](handleEntityNotFound(_0x44e997,null))[_0xd9e6('0x1f')](respondWithResult(_0x44e997,null))[_0xd9e6('0x3c')](handleError(_0x44e997,null));};exports[_0xd9e6('0x41')]=function(_0x1252d5,_0x1fd263){return db[_0xd9e6('0x23')]['create'](_0x1252d5['body'],{})[_0xd9e6('0x1f')](respondWithResult(_0x1fd263,0xc9))[_0xd9e6('0x3c')](handleError(_0x1fd263,null));};exports[_0xd9e6('0x1e')]=function(_0x4e6dd0,_0x17a092){if(_0x4e6dd0[_0xd9e6('0x42')]['id']){delete _0x4e6dd0[_0xd9e6('0x42')]['id'];}return db[_0xd9e6('0x23')][_0xd9e6('0x40')]({'where':{'id':_0x4e6dd0[_0xd9e6('0x3e')]['id']}})[_0xd9e6('0x1f')](handleEntityNotFound(_0x17a092,null))[_0xd9e6('0x1f')](saveUpdates(_0x4e6dd0['body'],null))[_0xd9e6('0x1f')](respondWithResult(_0x17a092,null))[_0xd9e6('0x3c')](handleError(_0x17a092,null));};exports['destroy']=function(_0x1ae0e3,_0x466863){return db[_0xd9e6('0x23')]['find']({'where':{'id':_0x1ae0e3['params']['id']}})['then'](handleEntityNotFound(_0x466863,null))[_0xd9e6('0x1f')](removeEntity(_0x466863,null))[_0xd9e6('0x3c')](handleError(_0x466863,null));}; \ No newline at end of file +var _0xd494=['reject','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','sort','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','catch','show','params','intersection','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xd494,0x1c3));var _0x4d49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd494[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x4d49('0x0'));var emlformat=require(_0x4d49('0x1'));var rimraf=require(_0x4d49('0x2'));var zipdir=require(_0x4d49('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d49('0x4'));var moment=require(_0x4d49('0x5'));var BPromise=require(_0x4d49('0x6'));var Mustache=require(_0x4d49('0x7'));var util=require(_0x4d49('0x8'));var path=require(_0x4d49('0x9'));var sox=require('sox');var csv=require(_0x4d49('0xa'));var ejs=require(_0x4d49('0xb'));var fs=require('fs');var _=require(_0x4d49('0xc'));var squel=require(_0x4d49('0xd'));var crypto=require('crypto');var jsforce=require(_0x4d49('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4d49('0xf'));var Papa=require(_0x4d49('0x10'));var Redis=require(_0x4d49('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4d49('0x12'));var as=require(_0x4d49('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d49('0x14'))(_0x4d49('0x15'));var utils=require(_0x4d49('0x16'));var config=require(_0x4d49('0x17'));var licenseUtil=require(_0x4d49('0x18'));var db=require(_0x4d49('0x19'))['db'];function respondWithStatusCode(_0x3c8b76,_0x5c5964){_0x5c5964=_0x5c5964||0xcc;return function(_0x28f2be){if(_0x28f2be){return _0x3c8b76[_0x4d49('0x1a')](_0x5c5964);}return _0x3c8b76[_0x4d49('0x1b')](_0x5c5964)[_0x4d49('0x1c')]();};}function respondWithResult(_0x258f28,_0x3dd150){_0x3dd150=_0x3dd150||0xc8;return function(_0x26a303){if(_0x26a303){return _0x258f28[_0x4d49('0x1b')](_0x3dd150)[_0x4d49('0x1d')](_0x26a303);}};}function respondWithFilteredResult(_0x346f56,_0x6b2153){return function(_0x1c73ff){if(_0x1c73ff){var _0x3f2a7b=_0x1c73ff[_0x4d49('0x1e')],_0x252486=_0x6b2153['offset'],_0x179d91=_0x6b2153[_0x4d49('0x1f')]+_0x6b2153['limit'],_0x52900f;if(_0x179d91>=_0x3f2a7b){_0x179d91=_0x3f2a7b;_0x52900f=0xc8;}else{_0x52900f=0xce;}_0x346f56[_0x4d49('0x1b')](_0x52900f);return _0x346f56['set']('Content-Range',_0x252486+'-'+_0x179d91+'/'+_0x3f2a7b)[_0x4d49('0x1d')](_0x1c73ff);}return null;};}function patchUpdates(_0x4b2347){return function(_0x2ef852){try{jsonpatch['apply'](_0x2ef852,_0x4b2347,!![]);}catch(_0x444c3a){return BPromise[_0x4d49('0x20')](_0x444c3a);}return _0x2ef852['save']();};}function saveUpdates(_0x5c2340,_0x2f1591){return function(_0x391495){if(_0x391495){return _0x391495['update'](_0x5c2340)[_0x4d49('0x21')](function(_0x3e7698){return _0x3e7698;});}return null;};}function removeEntity(_0x33239b,_0x2b208c){return function(_0x33781b){if(_0x33781b){return _0x33781b[_0x4d49('0x22')]()[_0x4d49('0x21')](function(){_0x33239b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff711,_0x529e83){return function(_0x205e6b){if(!_0x205e6b){_0x1ff711[_0x4d49('0x1a')](0x194);}return _0x205e6b;};}function handleError(_0x5122a5,_0x560dc6){_0x560dc6=_0x560dc6||0x1f4;return function(_0x359c82){logger[_0x4d49('0x23')](_0x359c82[_0x4d49('0x24')]);if(_0x359c82['name']){delete _0x359c82[_0x4d49('0x25')];}_0x5122a5[_0x4d49('0x1b')](_0x560dc6)['send'](_0x359c82);};}exports[_0x4d49('0x26')]=function(_0x185aaf,_0x329ce7){var _0x63492e={},_0x32cd33={},_0x4bc0f0={'count':0x0,'rows':[]};var _0x155842=_[_0x4d49('0x27')](db[_0x4d49('0x28')][_0x4d49('0x29')],function(_0x49df8b){return{'name':_0x49df8b['fieldName'],'type':_0x49df8b[_0x4d49('0x2a')]['key']};});_0x32cd33[_0x4d49('0x2b')]=_[_0x4d49('0x27')](_0x155842,_0x4d49('0x25'));_0x32cd33['query']=_[_0x4d49('0x2c')](_0x185aaf[_0x4d49('0x2d')]);_0x32cd33[_0x4d49('0x2e')]=_['intersection'](_0x32cd33[_0x4d49('0x2b')],_0x32cd33[_0x4d49('0x2d')]);_0x63492e[_0x4d49('0x2f')]=_['intersection'](_0x32cd33[_0x4d49('0x2b')],qs[_0x4d49('0x30')](_0x185aaf['query'][_0x4d49('0x30')]));_0x63492e[_0x4d49('0x2f')]=_0x63492e[_0x4d49('0x2f')][_0x4d49('0x31')]?_0x63492e[_0x4d49('0x2f')]:_0x32cd33[_0x4d49('0x2b')];if(!_0x185aaf[_0x4d49('0x2d')][_0x4d49('0x32')]('nolimit')){_0x63492e['limit']=qs[_0x4d49('0x33')](_0x185aaf[_0x4d49('0x2d')]['limit']);_0x63492e[_0x4d49('0x1f')]=qs[_0x4d49('0x1f')](_0x185aaf['query'][_0x4d49('0x1f')]);}_0x63492e['order']=qs[_0x4d49('0x34')](_0x185aaf[_0x4d49('0x2d')][_0x4d49('0x34')]);_0x63492e['where']=qs[_0x4d49('0x2e')](_['pick'](_0x185aaf['query'],_0x32cd33[_0x4d49('0x2e')]),_0x155842);if(_0x185aaf['query']['filter']){_0x63492e['where']=_[_0x4d49('0x35')](_0x63492e['where'],{'$or':_[_0x4d49('0x27')](_0x155842,function(_0xe1e2e8){if(_0xe1e2e8['type']!==_0x4d49('0x36')){var _0x36fd1d={};_0x36fd1d[_0xe1e2e8[_0x4d49('0x25')]]={'$like':'%'+_0x185aaf[_0x4d49('0x2d')][_0x4d49('0x37')]+'%'};return _0x36fd1d;}})});}_0x63492e=_[_0x4d49('0x35')]({},_0x63492e,_0x185aaf[_0x4d49('0x38')]);var _0x5d7ba2={'where':_0x63492e[_0x4d49('0x39')]};return db[_0x4d49('0x28')][_0x4d49('0x1e')](_0x5d7ba2)[_0x4d49('0x21')](function(_0x23ee6a){_0x4bc0f0[_0x4d49('0x1e')]=_0x23ee6a;if(_0x185aaf['query'][_0x4d49('0x3a')]){_0x63492e[_0x4d49('0x3b')]=[{'all':!![]}];}return db[_0x4d49('0x28')][_0x4d49('0x3c')](_0x63492e);})['then'](function(_0x5a5e40){_0x4bc0f0['rows']=_0x5a5e40;return _0x4bc0f0;})[_0x4d49('0x21')](respondWithFilteredResult(_0x329ce7,_0x63492e))[_0x4d49('0x3d')](handleError(_0x329ce7,null));};exports[_0x4d49('0x3e')]=function(_0x5afef3,_0x213053){var _0x1ec28e={'raw':!![],'where':{'id':_0x5afef3[_0x4d49('0x3f')]['id']}},_0x2aa197={};_0x2aa197['model']=_[_0x4d49('0x2c')](db[_0x4d49('0x28')][_0x4d49('0x29')]);_0x2aa197['query']=_['keys'](_0x5afef3[_0x4d49('0x2d')]);_0x2aa197[_0x4d49('0x2e')]=_[_0x4d49('0x40')](_0x2aa197[_0x4d49('0x2b')],_0x2aa197[_0x4d49('0x2d')]);_0x1ec28e[_0x4d49('0x2f')]=_[_0x4d49('0x40')](_0x2aa197[_0x4d49('0x2b')],qs[_0x4d49('0x30')](_0x5afef3[_0x4d49('0x2d')][_0x4d49('0x30')]));_0x1ec28e[_0x4d49('0x2f')]=_0x1ec28e[_0x4d49('0x2f')]['length']?_0x1ec28e[_0x4d49('0x2f')]:_0x2aa197[_0x4d49('0x2b')];if(_0x5afef3[_0x4d49('0x2d')][_0x4d49('0x3a')]){_0x1ec28e[_0x4d49('0x3b')]=[{'all':!![]}];}_0x1ec28e=_[_0x4d49('0x35')]({},_0x1ec28e,_0x5afef3[_0x4d49('0x38')]);return db[_0x4d49('0x28')][_0x4d49('0x41')](_0x1ec28e)[_0x4d49('0x21')](handleEntityNotFound(_0x213053,null))['then'](respondWithResult(_0x213053,null))[_0x4d49('0x3d')](handleError(_0x213053,null));};exports['create']=function(_0x2b8a10,_0x4fc6a0){return db[_0x4d49('0x28')][_0x4d49('0x42')](_0x2b8a10['body'],{})[_0x4d49('0x21')](respondWithResult(_0x4fc6a0,0xc9))[_0x4d49('0x3d')](handleError(_0x4fc6a0,null));};exports[_0x4d49('0x43')]=function(_0x4ae822,_0x5ae9cb){if(_0x4ae822[_0x4d49('0x44')]['id']){delete _0x4ae822[_0x4d49('0x44')]['id'];}return db[_0x4d49('0x28')][_0x4d49('0x41')]({'where':{'id':_0x4ae822[_0x4d49('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5ae9cb,null))[_0x4d49('0x21')](saveUpdates(_0x4ae822[_0x4d49('0x44')],null))[_0x4d49('0x21')](respondWithResult(_0x5ae9cb,null))[_0x4d49('0x3d')](handleError(_0x5ae9cb,null));};exports[_0x4d49('0x22')]=function(_0x2d30da,_0x6d374f){return db[_0x4d49('0x28')][_0x4d49('0x41')]({'where':{'id':_0x2d30da['params']['id']}})[_0x4d49('0x21')](handleEntityNotFound(_0x6d374f,null))['then'](removeEntity(_0x6d374f,null))['catch'](handleError(_0x6d374f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3147de2..77c2505 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 _0x6edb=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x45af11,_0x48f5e6){var _0x2b5a0f=function(_0x1660b9){while(--_0x1660b9){_0x45af11['push'](_0x45af11['shift']());}};_0x2b5a0f(++_0x48f5e6);}(_0x6edb,0x122));var _0xb6ed=function(_0x19fd2c,_0x4839d6){_0x19fd2c=_0x19fd2c-0x0;var _0x2621a7=_0x6edb[_0x19fd2c];return _0x2621a7;};'use strict';var _=require(_0xb6ed('0x0'));var util=require(_0xb6ed('0x1'));var logger=require(_0xb6ed('0x2'))(_0xb6ed('0x3'));var moment=require(_0xb6ed('0x4'));var BPromise=require(_0xb6ed('0x5'));var rp=require(_0xb6ed('0x6'));var fs=require('fs');var path=require(_0xb6ed('0x7'));var rimraf=require('rimraf');var config=require(_0xb6ed('0x8'));var attributes=require(_0xb6ed('0x9'));module[_0xb6ed('0xa')]=function(_0x364e81,_0x332892){return _0x364e81[_0xb6ed('0xb')]('Dynamics365Field',attributes,{'tableName':_0xb6ed('0xc'),'paranoid':![],'indexes':[{'name':_0xb6ed('0xd'),'fields':[_0xb6ed('0xe'),_0xb6ed('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9da=['./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6aac3d,_0x3e15b7){var _0x53cacb=function(_0x403053){while(--_0x403053){_0x6aac3d['push'](_0x6aac3d['shift']());}};_0x53cacb(++_0x3e15b7);}(_0xe9da,0x116));var _0xae9d=function(_0x1f5f1e,_0x54ab7a){_0x1f5f1e=_0x1f5f1e-0x0;var _0x543b19=_0xe9da[_0x1f5f1e];return _0x543b19;};'use strict';var _=require(_0xae9d('0x0'));var util=require(_0xae9d('0x1'));var logger=require(_0xae9d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae9d('0x3'));var rp=require(_0xae9d('0x4'));var fs=require('fs');var path=require(_0xae9d('0x5'));var rimraf=require(_0xae9d('0x6'));var config=require(_0xae9d('0x7'));var attributes=require(_0xae9d('0x8'));module[_0xae9d('0x9')]=function(_0x202411,_0x4265f0){return _0x202411[_0xae9d('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xae9d('0xb'),'fields':[_0xae9d('0xc'),'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 31c203c..be7a9bc 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 _0xb0df=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x6b6270,_0x57256a){var _0x148f8c=function(_0x4dad3b){while(--_0x4dad3b){_0x6b6270['push'](_0x6b6270['shift']());}};_0x148f8c(++_0x57256a);}(_0xb0df,0x85));var _0xfb0d=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xb0df[_0x52121d];return _0x448627;};'use strict';var _=require('lodash');var util=require(_0xfb0d('0x0'));var moment=require(_0xfb0d('0x1'));var BPromise=require(_0xfb0d('0x2'));var rs=require(_0xfb0d('0x3'));var fs=require('fs');var Redis=require(_0xfb0d('0x4'));var db=require(_0xfb0d('0x5'))['db'];var utils=require(_0xfb0d('0x6'));var logger=require(_0xfb0d('0x7'))(_0xfb0d('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb0d('0x9'));var client=jayson[_0xfb0d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7591,_0xd9beab,_0xee3329){return new BPromise(function(_0x5cf723,_0x57ab8c){return client[_0xfb0d('0xb')](_0x5b7591,_0xee3329)[_0xfb0d('0xc')](function(_0x501d4f){logger[_0xfb0d('0xd')](_0xfb0d('0xe'),_0xd9beab,_0xfb0d('0xf'));logger[_0xfb0d('0x10')](_0xfb0d('0x11'),_0xd9beab,_0xfb0d('0xf'),JSON['stringify'](_0x501d4f));if(_0x501d4f[_0xfb0d('0x12')]){if(_0x501d4f['error'][_0xfb0d('0x13')]===0x1f4){logger[_0xfb0d('0x12')](_0xfb0d('0xe'),_0xd9beab,_0x501d4f[_0xfb0d('0x12')][_0xfb0d('0x14')]);return _0x57ab8c(_0x501d4f[_0xfb0d('0x12')][_0xfb0d('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0xd9beab,_0x501d4f['error'][_0xfb0d('0x14')]);return _0x5cf723(_0x501d4f[_0xfb0d('0x12')][_0xfb0d('0x14')]);}else{logger[_0xfb0d('0xd')](_0xfb0d('0xe'),_0xd9beab,_0xfb0d('0xf'));_0x5cf723(_0x501d4f[_0xfb0d('0x15')]['message']);}})[_0xfb0d('0x16')](function(_0x116179){logger[_0xfb0d('0x12')](_0xfb0d('0xe'),_0xd9beab,_0x116179);_0x57ab8c(_0x116179);});});} \ No newline at end of file +var _0xdb8b=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5f4ca0,_0x54ab89){var _0x3f4253=function(_0x1cf1d7){while(--_0x1cf1d7){_0x5f4ca0['push'](_0x5f4ca0['shift']());}};_0x3f4253(++_0x54ab89);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x390b85,_0x1c0ac5){_0x390b85=_0x390b85-0x0;var _0x2b1232=_0xdb8b[_0x390b85];return _0x2b1232;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var moment=require(_0xbdb8('0x1'));var BPromise=require(_0xbdb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdb8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb8('0x4'))(_0xbdb8('0x5'));var config=require(_0xbdb8('0x6'));var jayson=require(_0xbdb8('0x7'));var client=jayson['client'][_0xbdb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x482c12,_0x387bb4,_0x2f2825){return new BPromise(function(_0x444d6,_0x227caa){return client[_0xbdb8('0x9')](_0x482c12,_0x2f2825)[_0xbdb8('0xa')](function(_0x50f80a){logger[_0xbdb8('0xb')](_0xbdb8('0xc'),_0x387bb4,_0xbdb8('0xd'));logger[_0xbdb8('0xe')](_0xbdb8('0xf'),_0x387bb4,_0xbdb8('0xd'),JSON[_0xbdb8('0x10')](_0x50f80a));if(_0x50f80a['error']){if(_0x50f80a['error'][_0xbdb8('0x11')]===0x1f4){logger['error'](_0xbdb8('0xc'),_0x387bb4,_0x50f80a['error'][_0xbdb8('0x12')]);return _0x227caa(_0x50f80a['error'][_0xbdb8('0x12')]);}logger[_0xbdb8('0x13')](_0xbdb8('0xc'),_0x387bb4,_0x50f80a[_0xbdb8('0x13')][_0xbdb8('0x12')]);return _0x444d6(_0x50f80a[_0xbdb8('0x13')][_0xbdb8('0x12')]);}else{logger[_0xbdb8('0xb')](_0xbdb8('0xc'),_0x387bb4,_0xbdb8('0xd'));_0x444d6(_0x50f80a[_0xbdb8('0x14')][_0xbdb8('0x12')]);}})[_0xbdb8('0x15')](function(_0x5438df){logger[_0xbdb8('0x13')](_0xbdb8('0xc'),_0x387bb4,_0x5438df);_0x227caa(_0x5438df);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index edeba30..ca98265 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 _0xd07a=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd07a,0x176));var _0xad07=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xd07a[_0x5a4400];return _0xf9b532;};'use strict';var multer=require(_0xad07('0x0'));var util=require(_0xad07('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad07('0x2'));var router=express[_0xad07('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xad07('0x4'));var config=require(_0xad07('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0xad07('0x6')]('/',auth[_0xad07('0x7')](),controller[_0xad07('0x8')]);router[_0xad07('0x6')](_0xad07('0x9'),auth[_0xad07('0x7')](),controller[_0xad07('0xa')]);router[_0xad07('0x6')](_0xad07('0xb'),auth[_0xad07('0x7')](),controller[_0xad07('0xc')]);router[_0xad07('0x6')](_0xad07('0xd'),auth[_0xad07('0x7')](),controller['getFields']);router[_0xad07('0xe')]('/',auth[_0xad07('0x7')](),controller[_0xad07('0xf')]);router[_0xad07('0xe')](_0xad07('0xb'),auth[_0xad07('0x7')](),controller['addConfiguration']);router[_0xad07('0x10')](_0xad07('0x9'),auth[_0xad07('0x7')](),controller['update']);router[_0xad07('0x11')](_0xad07('0x9'),auth['isAuthenticated'](),controller[_0xad07('0x12')]);module[_0xad07('0x13')]=router; \ No newline at end of file +var _0x05de=['getFields','post','addConfiguration','/:id','update','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations'];(function(_0x48bab9,_0x3e30f8){var _0x381ad1=function(_0x449dff){while(--_0x449dff){_0x48bab9['push'](_0x48bab9['shift']());}};_0x381ad1(++_0x3e30f8);}(_0x05de,0x85));var _0xe05d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x05de[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe05d('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe05d('0x1')]();var auth=require(_0xe05d('0x2'));var interaction=require(_0xe05d('0x3'));var config=require(_0xe05d('0x4'));var controller=require('./intFreshdeskAccount.controller');router[_0xe05d('0x5')]('/',auth[_0xe05d('0x6')](),controller[_0xe05d('0x7')]);router[_0xe05d('0x5')]('/:id',auth[_0xe05d('0x6')](),controller[_0xe05d('0x8')]);router['get'](_0xe05d('0x9'),auth[_0xe05d('0x6')](),controller[_0xe05d('0xa')]);router[_0xe05d('0x5')]('/:id/fields',auth[_0xe05d('0x6')](),controller[_0xe05d('0xb')]);router[_0xe05d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe05d('0xc')]('/:id/configurations',auth[_0xe05d('0x6')](),controller[_0xe05d('0xd')]);router['put'](_0xe05d('0xe'),auth[_0xe05d('0x6')](),controller[_0xe05d('0xf')]);router[_0xe05d('0x10')](_0xe05d('0xe'),auth['isAuthenticated'](),controller[_0xe05d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7ff515f..8ee70ca 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 _0xa451=['remoteUri','exports','STRING'];(function(_0x4dfc64,_0x3a1ef3){var _0x4b7fb4=function(_0xcfcbfe){while(--_0xcfcbfe){_0x4dfc64['push'](_0x4dfc64['shift']());}};_0x4b7fb4(++_0x3a1ef3);}(_0xa451,0x187));var _0x1a45=function(_0x35b646,_0x21670b){_0x35b646=_0x35b646-0x0;var _0x1ccfac=_0xa451[_0x35b646];return _0x1ccfac;};'use strict';var Sequelize=require('sequelize');module[_0x1a45('0x0')]={'name':{'type':Sequelize[_0x1a45('0x1')]},'description':{'type':Sequelize[_0x1a45('0x1')]},'username':{'type':Sequelize[_0x1a45('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x1a45('0x1')]},'remoteUri':{'type':Sequelize[_0x1a45('0x1')],'unique':_0x1a45('0x2')},'serverUrl':{'type':Sequelize[_0x1a45('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x977c=['STRING','username','remoteUri'];(function(_0x8a01a5,_0x1b0ef7){var _0x47e5d6=function(_0x23d0b1){while(--_0x23d0b1){_0x8a01a5['push'](_0x8a01a5['shift']());}};_0x47e5d6(++_0x1b0ef7);}(_0x977c,0x180));var _0xc977=function(_0x416e85,_0x4b862b){_0x416e85=_0x416e85-0x0;var _0x2d6325=_0x977c[_0x416e85];return _0x2d6325;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc977('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc977('0x0')],'unique':_0xc977('0x1')},'apiKey':{'type':Sequelize[_0xc977('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc977('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 26268a6..4524076 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 _0x6a27=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','offset','limit','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','FreshdeskAccount','count','includeAll','include','findAll','params','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','moment','mustache','util','to-csv','ejs','crypto','jsforce'];(function(_0x1865d4,_0x569a81){var _0x1f0e1c=function(_0x57887d){while(--_0x57887d){_0x1865d4['push'](_0x1865d4['shift']());}};_0x1f0e1c(++_0x569a81);}(_0x6a27,0x70));var _0x76a2=function(_0x168dab,_0x4abfce){_0x168dab=_0x168dab-0x0;var _0x166a20=_0x6a27[_0x168dab];return _0x166a20;};'use strict';var pdf=require(_0x76a2('0x0'));var emlformat=require(_0x76a2('0x1'));var rimraf=require(_0x76a2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x76a2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x76a2('0x4'));var util=require(_0x76a2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x76a2('0x6'));var ejs=require(_0x76a2('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x76a2('0x8'));var jsforce=require(_0x76a2('0x9'));var deskjs=require(_0x76a2('0xa'));var toCsv=require(_0x76a2('0x6'));var querystring=require(_0x76a2('0xb'));var Papa=require(_0x76a2('0xc'));var Redis=require(_0x76a2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x76a2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76a2('0xf'));var logger=require(_0x76a2('0x10'))('api');var utils=require(_0x76a2('0x11'));var config=require(_0x76a2('0x12'));var licenseUtil=require(_0x76a2('0x13'));var db=require(_0x76a2('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x76a2('0x15'));var client=jayson[_0x76a2('0x16')][_0x76a2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x490033,_0x615000,_0x65a29f,_0x18d566){return new BPromise(function(_0x13b364,_0x16ea01){var _0x44ea00=_0x18d566||client;return _0x44ea00[_0x76a2('0x18')](_0x490033,_0x65a29f)[_0x76a2('0x19')](function(_0x98b791){logger[_0x76a2('0x1a')](_0x76a2('0x1b'),_0x615000,_0x76a2('0x1c'));logger[_0x76a2('0x1d')](_0x76a2('0x1e'),_0x615000,_0x76a2('0x1c'),JSON['stringify'](_0x98b791));if(_0x98b791[_0x76a2('0x1f')]){if(_0x98b791[_0x76a2('0x1f')]['code']===0x1f4){logger[_0x76a2('0x1f')](_0x76a2('0x1b'),_0x615000,_0x98b791[_0x76a2('0x1f')][_0x76a2('0x20')]);return _0x16ea01(_0x98b791[_0x76a2('0x1f')][_0x76a2('0x20')]);}logger[_0x76a2('0x1f')](_0x76a2('0x1b'),_0x615000,_0x98b791['error'][_0x76a2('0x20')]);return _0x13b364(_0x98b791['error'][_0x76a2('0x20')]);}else{logger[_0x76a2('0x1a')]('FreshdeskAccount,\x20%s,\x20%s',_0x615000,_0x76a2('0x1c'));_0x13b364(_0x98b791[_0x76a2('0x21')][_0x76a2('0x20')]);}})[_0x76a2('0x22')](function(_0x2f886b){logger[_0x76a2('0x1f')](_0x76a2('0x1b'),_0x615000,_0x2f886b);_0x16ea01(_0x2f886b);});});}function respondWithStatusCode(_0x9a84d3,_0x3c5fb2){_0x3c5fb2=_0x3c5fb2||0xcc;return function(_0x14cb68){if(_0x14cb68){return _0x9a84d3[_0x76a2('0x23')](_0x3c5fb2);}return _0x9a84d3['status'](_0x3c5fb2)[_0x76a2('0x24')]();};}function respondWithResult(_0x38b432,_0x2c9a02){_0x2c9a02=_0x2c9a02||0xc8;return function(_0x48db52){if(_0x48db52){return _0x38b432[_0x76a2('0x25')](_0x2c9a02)[_0x76a2('0x26')](_0x48db52);}};}function respondWithFilteredResult(_0x16152a,_0xe7863e){return function(_0x43bc71){if(_0x43bc71){var _0x12210a=_0x43bc71['count'],_0x35fb9f=_0xe7863e[_0x76a2('0x27')],_0x267b41=_0xe7863e[_0x76a2('0x27')]+_0xe7863e[_0x76a2('0x28')],_0x15e1f8;if(_0x267b41>=_0x12210a){_0x267b41=_0x12210a;_0x15e1f8=0xc8;}else{_0x15e1f8=0xce;}_0x16152a[_0x76a2('0x25')](_0x15e1f8);return _0x16152a['set']('Content-Range',_0x35fb9f+'-'+_0x267b41+'/'+_0x12210a)['json'](_0x43bc71);}return null;};}function patchUpdates(_0x41da47){return function(_0x8f492){try{jsonpatch[_0x76a2('0x29')](_0x8f492,_0x41da47,!![]);}catch(_0x15104f){return BPromise[_0x76a2('0x2a')](_0x15104f);}return _0x8f492[_0x76a2('0x2b')]();};}function saveUpdates(_0x1a6b49,_0x177cb9){return function(_0x2282d9){if(_0x2282d9){return _0x2282d9[_0x76a2('0x2c')](_0x1a6b49)['then'](function(_0x10650b){return _0x10650b;});}return null;};}function removeEntity(_0xdbc58b,_0x38f271){return function(_0x8a785a){if(_0x8a785a){return _0x8a785a[_0x76a2('0x2d')]()['then'](function(){_0xdbc58b[_0x76a2('0x25')](0xcc)[_0x76a2('0x24')]();});}};}function handleEntityNotFound(_0x4e8d9c,_0x51e908){return function(_0xa08b85){if(!_0xa08b85){_0x4e8d9c[_0x76a2('0x23')](0x194);}return _0xa08b85;};}function handleError(_0x409272,_0x342fdd){_0x342fdd=_0x342fdd||0x1f4;return function(_0x386711){logger[_0x76a2('0x1f')](_0x386711[_0x76a2('0x2e')]);if(_0x386711[_0x76a2('0x2f')]){delete _0x386711[_0x76a2('0x2f')];}_0x409272[_0x76a2('0x25')](_0x342fdd)['send'](_0x386711);};}exports[_0x76a2('0x30')]=function(_0x226890,_0x32a032){var _0x4eaf9b={},_0x3d695f={},_0xd7c9b1={'count':0x0,'rows':[]};var _0x212b0a=_[_0x76a2('0x31')](db['FreshdeskAccount'][_0x76a2('0x32')],function(_0xe8fa68){return{'name':_0xe8fa68[_0x76a2('0x33')],'type':_0xe8fa68['type'][_0x76a2('0x34')]};});_0x3d695f[_0x76a2('0x35')]=_[_0x76a2('0x31')](_0x212b0a,'name');_0x3d695f[_0x76a2('0x36')]=_[_0x76a2('0x37')](_0x226890['query']);_0x3d695f[_0x76a2('0x38')]=_[_0x76a2('0x39')](_0x3d695f[_0x76a2('0x35')],_0x3d695f[_0x76a2('0x36')]);_0x4eaf9b[_0x76a2('0x3a')]=_[_0x76a2('0x39')](_0x3d695f['model'],qs[_0x76a2('0x3b')](_0x226890['query'][_0x76a2('0x3b')]));_0x4eaf9b['attributes']=_0x4eaf9b[_0x76a2('0x3a')][_0x76a2('0x3c')]?_0x4eaf9b[_0x76a2('0x3a')]:_0x3d695f[_0x76a2('0x35')];if(!_0x226890[_0x76a2('0x36')][_0x76a2('0x3d')](_0x76a2('0x3e'))){_0x4eaf9b[_0x76a2('0x28')]=qs[_0x76a2('0x28')](_0x226890[_0x76a2('0x36')][_0x76a2('0x28')]);_0x4eaf9b['offset']=qs[_0x76a2('0x27')](_0x226890['query'][_0x76a2('0x27')]);}_0x4eaf9b[_0x76a2('0x3f')]=qs[_0x76a2('0x40')](_0x226890[_0x76a2('0x36')][_0x76a2('0x40')]);_0x4eaf9b['where']=qs[_0x76a2('0x38')](_[_0x76a2('0x41')](_0x226890['query'],_0x3d695f[_0x76a2('0x38')]),_0x212b0a);if(_0x226890['query']['filter']){_0x4eaf9b[_0x76a2('0x42')]=_[_0x76a2('0x43')](_0x4eaf9b['where'],{'$or':_[_0x76a2('0x31')](_0x212b0a,function(_0x493a93){if(_0x493a93[_0x76a2('0x44')]!==_0x76a2('0x45')){var _0x31753c={};_0x31753c[_0x493a93['name']]={'$like':'%'+_0x226890[_0x76a2('0x36')][_0x76a2('0x46')]+'%'};return _0x31753c;}})});}_0x4eaf9b=_['merge']({},_0x4eaf9b,_0x226890[_0x76a2('0x47')]);var _0x1405bb={'where':_0x4eaf9b[_0x76a2('0x42')]};return db[_0x76a2('0x48')][_0x76a2('0x49')](_0x1405bb)[_0x76a2('0x19')](function(_0x443a97){_0xd7c9b1[_0x76a2('0x49')]=_0x443a97;if(_0x226890['query'][_0x76a2('0x4a')]){_0x4eaf9b[_0x76a2('0x4b')]=[{'all':!![]}];}return db[_0x76a2('0x48')][_0x76a2('0x4c')](_0x4eaf9b);})[_0x76a2('0x19')](function(_0x40edde){_0xd7c9b1['rows']=_0x40edde;return _0xd7c9b1;})[_0x76a2('0x19')](respondWithFilteredResult(_0x32a032,_0x4eaf9b))[_0x76a2('0x22')](handleError(_0x32a032,null));};exports['show']=function(_0x3c4a50,_0x52e1d4){var _0x2f2280={'raw':![],'where':{'id':_0x3c4a50[_0x76a2('0x4d')]['id']}},_0x133e79={};_0x133e79[_0x76a2('0x35')]=_[_0x76a2('0x37')](db['FreshdeskAccount'][_0x76a2('0x32')]);_0x133e79[_0x76a2('0x36')]=_[_0x76a2('0x37')](_0x3c4a50[_0x76a2('0x36')]);_0x133e79[_0x76a2('0x38')]=_[_0x76a2('0x39')](_0x133e79['model'],_0x133e79['query']);_0x2f2280[_0x76a2('0x3a')]=_['intersection'](_0x133e79[_0x76a2('0x35')],qs[_0x76a2('0x3b')](_0x3c4a50[_0x76a2('0x36')][_0x76a2('0x3b')]));_0x2f2280['attributes']=_0x2f2280[_0x76a2('0x3a')]['length']?_0x2f2280['attributes']:_0x133e79[_0x76a2('0x35')];if(_0x3c4a50['query'][_0x76a2('0x4a')]){_0x2f2280['include']=[{'all':!![]}];}_0x2f2280=_[_0x76a2('0x43')]({},_0x2f2280,_0x3c4a50[_0x76a2('0x47')]);return db[_0x76a2('0x48')][_0x76a2('0x4e')](_0x2f2280)[_0x76a2('0x19')](handleEntityNotFound(_0x52e1d4,null))[_0x76a2('0x19')](respondWithResult(_0x52e1d4,null))[_0x76a2('0x22')](handleError(_0x52e1d4,null));};exports[_0x76a2('0x4f')]=function(_0x5723bf,_0x8ebd13){return db[_0x76a2('0x48')][_0x76a2('0x4f')](_0x5723bf['body'],{})[_0x76a2('0x19')](respondWithResult(_0x8ebd13,0xc9))[_0x76a2('0x22')](handleError(_0x8ebd13,null));};exports[_0x76a2('0x2c')]=function(_0x35f8e6,_0x424b4a){if(_0x35f8e6[_0x76a2('0x50')]['id']){delete _0x35f8e6['body']['id'];}return db[_0x76a2('0x48')][_0x76a2('0x4e')]({'where':{'id':_0x35f8e6[_0x76a2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x424b4a,null))[_0x76a2('0x19')](saveUpdates(_0x35f8e6[_0x76a2('0x50')],null))['then'](respondWithResult(_0x424b4a,null))['catch'](handleError(_0x424b4a,null));};exports[_0x76a2('0x2d')]=function(_0x54d5bc,_0x95094d){return db[_0x76a2('0x48')][_0x76a2('0x4e')]({'where':{'id':_0x54d5bc[_0x76a2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x95094d,null))['then'](removeEntity(_0x95094d,null))['catch'](handleError(_0x95094d,null));};exports['getConfigurations']=function(_0x5bb370,_0x633627,_0x1b3b76){var _0x191c99={};var _0x363875={};var _0x32337e;var _0x18a76e;return db[_0x76a2('0x48')][_0x76a2('0x51')]({'where':{'id':_0x5bb370[_0x76a2('0x4d')]['id']}})[_0x76a2('0x19')](handleEntityNotFound(_0x633627,null))[_0x76a2('0x19')](function(_0x45871e){if(_0x45871e){_0x32337e=_0x45871e;_0x363875[_0x76a2('0x35')]=_['keys'](db[_0x76a2('0x52')][_0x76a2('0x32')]);_0x363875[_0x76a2('0x36')]=_[_0x76a2('0x37')](_0x5bb370[_0x76a2('0x36')]);_0x363875['filters']=_['intersection'](_0x363875['model'],_0x363875[_0x76a2('0x36')]);_0x191c99['attributes']=_['intersection'](_0x363875[_0x76a2('0x35')],qs[_0x76a2('0x3b')](_0x5bb370['query']['fields']));_0x191c99[_0x76a2('0x3a')]=_0x191c99[_0x76a2('0x3a')][_0x76a2('0x3c')]?_0x191c99[_0x76a2('0x3a')]:_0x363875[_0x76a2('0x35')];_0x191c99[_0x76a2('0x3f')]=qs[_0x76a2('0x40')](_0x5bb370[_0x76a2('0x36')][_0x76a2('0x40')]);_0x191c99[_0x76a2('0x42')]=qs['filters'](_[_0x76a2('0x41')](_0x5bb370[_0x76a2('0x36')],_0x363875[_0x76a2('0x38')]));if(_0x5bb370[_0x76a2('0x36')]['filter']){_0x191c99['where']=_[_0x76a2('0x43')](_0x191c99['where'],{'$or':_[_0x76a2('0x31')](_0x191c99['attributes'],function(_0x57a0b8){var _0x5e6783={};_0x5e6783[_0x57a0b8]={'$like':'%'+_0x5bb370['query']['filter']+'%'};return _0x5e6783;})});}_0x191c99=_[_0x76a2('0x43')]({},_0x191c99,_0x5bb370['options']);return _0x32337e[_0x76a2('0x53')](_0x191c99);}})[_0x76a2('0x19')](function(_0x57e8c0){if(_0x57e8c0){_0x18a76e=_0x57e8c0[_0x76a2('0x3c')];if(!_0x5bb370[_0x76a2('0x36')][_0x76a2('0x3d')](_0x76a2('0x3e'))){_0x191c99[_0x76a2('0x28')]=qs[_0x76a2('0x28')](_0x5bb370[_0x76a2('0x36')][_0x76a2('0x28')]);_0x191c99[_0x76a2('0x27')]=qs[_0x76a2('0x27')](_0x5bb370[_0x76a2('0x36')][_0x76a2('0x27')]);}return _0x32337e[_0x76a2('0x53')](_0x191c99);}})[_0x76a2('0x19')](function(_0x5709d2){if(_0x5709d2){return _0x5709d2?{'count':_0x18a76e,'rows':_0x5709d2}:null;}})[_0x76a2('0x19')](respondWithResult(_0x633627,null))[_0x76a2('0x22')](handleError(_0x633627,null));};exports['addConfiguration']=function(_0x4524e4,_0x311893,_0x2ab5fb){if(_0x4524e4[_0x76a2('0x50')]['id']){delete _0x4524e4[_0x76a2('0x50')]['id'];}return db[_0x76a2('0x48')][_0x76a2('0x51')]({'where':{'id':_0x4524e4[_0x76a2('0x4d')]['id']}})[_0x76a2('0x19')](handleEntityNotFound(_0x311893,null))[_0x76a2('0x19')](function(_0x28f684){if(_0x28f684){_0x4524e4[_0x76a2('0x50')][_0x76a2('0x54')]=_0x28f684['id'];_0x4524e4[_0x76a2('0x50')][_0x76a2('0x55')]=integrations[_0x76a2('0x56')](_0x4524e4[_0x76a2('0x50')][_0x76a2('0x57')],_0x4524e4[_0x76a2('0x50')]['type']);_0x4524e4[_0x76a2('0x50')][_0x76a2('0x58')]=integrations[_0x76a2('0x59')](_0x4524e4[_0x76a2('0x50')][_0x76a2('0x57')],_0x4524e4['body']['type']);return db[_0x76a2('0x52')][_0x76a2('0x4f')](_0x4524e4[_0x76a2('0x50')],{'include':[{'model':db[_0x76a2('0x5a')],'as':_0x76a2('0x55')},{'model':db[_0x76a2('0x5a')],'as':_0x76a2('0x58')}]});}return null;})['then'](respondWithResult(_0x311893,null))[_0x76a2('0x22')](handleError(_0x311893,null));};exports[_0x76a2('0x5b')]=function(_0x4d2f1f,_0x12676e,_0x4ab612){var _0x4ce30f='';return db[_0x76a2('0x48')]['findOne']({'where':{'id':_0x4d2f1f[_0x76a2('0x4d')]['id']},'attributes':['id',_0x76a2('0x5c'),_0x76a2('0x5d')]})[_0x76a2('0x19')](handleEntityNotFound(_0x12676e,null))[_0x76a2('0x19')](function(_0x54be83){if(_0x54be83){_0x4ce30f=_0x54be83[_0x76a2('0x5c')];var _0x4aec9c=_0x4ce30f[_0x76a2('0x5e')](-0x1);if(_0x4aec9c==='/'){_0x4ce30f=_0x4ce30f['substring'](0x0,_0x4ce30f[_0x76a2('0x5f')](_0x4aec9c));}return rp({'method':_0x76a2('0x60'),'uri':util['format'](_0x76a2('0x61'),_0x4ce30f,_0x76a2('0x62')),'headers':{'Authorization':util[_0x76a2('0x63')](_0x76a2('0x64'),new Buffer(util[_0x76a2('0x63')](_0x76a2('0x65'),_0x54be83[_0x76a2('0x5d')]))['toString'](_0x76a2('0x66')))},'json':!![]});}})['then'](function(_0x3a56b3){if(_0x3a56b3){var _0x3d8489=[_0x76a2('0x67'),_0x76a2('0x68'),_0x76a2('0x69'),'description',_0x76a2('0x25'),_0x76a2('0x6a'),_0x76a2('0x6b'),'source',_0x76a2('0x6c'),'group',_0x76a2('0x6d')];_[_0x76a2('0x6e')](_0x3a56b3,function(_0x4c897d){return _0x3d8489[_0x76a2('0x6f')](_0x4c897d[_0x76a2('0x2f')])||!_0x4c897d[_0x76a2('0x70')]&&_0x4c897d['type']!==_0x76a2('0x71')&&_0x4c897d[_0x76a2('0x44')]!==_0x76a2('0x72');});return{'count':_0x3a56b3[_0x76a2('0x3c')],'rows':_[_0x76a2('0x31')](_0x3a56b3,function(_0x526b75){return{'id':_0x526b75[_0x76a2('0x2f')],'name':_0x526b75[_0x76a2('0x73')],'custom':!_0x526b75[_0x76a2('0x70')],'options':_0x526b75['choices']?_['map'](_0x526b75[_0x76a2('0x74')],function(_0x379326){return{'name':_['capitalize'](_0x379326),'value':_0x379326};}):[]};})};}})[_0x76a2('0x19')](respondWithResult(_0x12676e,null))['catch'](function(_0x4bb29b){var _0x40b43b=_0x4d2f1f[_0x76a2('0x36')][_0x76a2('0x75')]?0x1f4:_0x4bb29b[_0x76a2('0x76')]||0x1f4;logger[_0x76a2('0x1f')](_0x76a2('0x77'),_0x76a2('0x5b'),_0x40b43b,JSON['stringify'](_0x4bb29b));delete _0x4bb29b[_0x76a2('0x2f')];if(_0x40b43b===0x191){_0x40b43b=0x190;}_0x12676e[_0x76a2('0x25')](_0x40b43b)[_0x76a2('0x78')](_0x4d2f1f[_0x76a2('0x36')][_0x76a2('0x75')]?{'message':_0x76a2('0x79'),'statusCode':_0x4bb29b['statusCode']}:_0x4bb29b);});}; \ No newline at end of file +var _0xf4ef=['jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','FreshdeskAccount','includeAll','include','show','params','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0xf4ef,0x71));var _0xff4e=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0xf4ef[_0xe2c95e];return _0x42ce6f;};'use strict';var pdf=require(_0xff4e('0x0'));var emlformat=require(_0xff4e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff4e('0x2'));var rp=require(_0xff4e('0x3'));var moment=require(_0xff4e('0x4'));var BPromise=require(_0xff4e('0x5'));var Mustache=require('mustache');var util=require(_0xff4e('0x6'));var path=require(_0xff4e('0x7'));var sox=require(_0xff4e('0x8'));var csv=require(_0xff4e('0x9'));var ejs=require(_0xff4e('0xa'));var fs=require('fs');var _=require(_0xff4e('0xb'));var squel=require(_0xff4e('0xc'));var crypto=require('crypto');var jsforce=require(_0xff4e('0xd'));var deskjs=require(_0xff4e('0xe'));var toCsv=require(_0xff4e('0x9'));var querystring=require(_0xff4e('0xf'));var Papa=require('papaparse');var Redis=require(_0xff4e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff4e('0x11'));var hardwareService=require(_0xff4e('0x12'));var logger=require('../../config/logger')(_0xff4e('0x13'));var utils=require(_0xff4e('0x14'));var config=require(_0xff4e('0x15'));var licenseUtil=require(_0xff4e('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xff4e('0x17'));var jayson=require(_0xff4e('0x18'));var client=jayson[_0xff4e('0x19')][_0xff4e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3a00d7,_0x59a9ff,_0x1db6e,_0x1ab30a){return new BPromise(function(_0x42159b,_0x5e7849){var _0x24712a=_0x1ab30a||client;return _0x24712a[_0xff4e('0x1b')](_0x3a00d7,_0x1db6e)[_0xff4e('0x1c')](function(_0x5bfb7f){logger['info'](_0xff4e('0x1d'),_0x59a9ff,'request\x20sent');logger[_0xff4e('0x1e')](_0xff4e('0x1f'),_0x59a9ff,_0xff4e('0x20'),JSON['stringify'](_0x5bfb7f));if(_0x5bfb7f[_0xff4e('0x21')]){if(_0x5bfb7f[_0xff4e('0x21')][_0xff4e('0x22')]===0x1f4){logger[_0xff4e('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x59a9ff,_0x5bfb7f[_0xff4e('0x21')][_0xff4e('0x23')]);return _0x5e7849(_0x5bfb7f[_0xff4e('0x21')][_0xff4e('0x23')]);}logger['error'](_0xff4e('0x1d'),_0x59a9ff,_0x5bfb7f[_0xff4e('0x21')][_0xff4e('0x23')]);return _0x42159b(_0x5bfb7f[_0xff4e('0x21')][_0xff4e('0x23')]);}else{logger[_0xff4e('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x59a9ff,_0xff4e('0x20'));_0x42159b(_0x5bfb7f[_0xff4e('0x25')][_0xff4e('0x23')]);}})[_0xff4e('0x26')](function(_0x1c2523){logger[_0xff4e('0x21')](_0xff4e('0x1d'),_0x59a9ff,_0x1c2523);_0x5e7849(_0x1c2523);});});}function respondWithStatusCode(_0x21393b,_0x4fa44d){_0x4fa44d=_0x4fa44d||0xcc;return function(_0x17430a){if(_0x17430a){return _0x21393b[_0xff4e('0x27')](_0x4fa44d);}return _0x21393b[_0xff4e('0x28')](_0x4fa44d)['end']();};}function respondWithResult(_0x48eb58,_0xf53886){_0xf53886=_0xf53886||0xc8;return function(_0x6b5076){if(_0x6b5076){return _0x48eb58['status'](_0xf53886)[_0xff4e('0x29')](_0x6b5076);}};}function respondWithFilteredResult(_0x3150c4,_0x1e2eab){return function(_0x1eb132){if(_0x1eb132){var _0x40fb04=_0x1eb132[_0xff4e('0x2a')],_0x52fca7=_0x1e2eab[_0xff4e('0x2b')],_0x31a701=_0x1e2eab[_0xff4e('0x2b')]+_0x1e2eab['limit'],_0x31c465;if(_0x31a701>=_0x40fb04){_0x31a701=_0x40fb04;_0x31c465=0xc8;}else{_0x31c465=0xce;}_0x3150c4[_0xff4e('0x28')](_0x31c465);return _0x3150c4[_0xff4e('0x2c')](_0xff4e('0x2d'),_0x52fca7+'-'+_0x31a701+'/'+_0x40fb04)[_0xff4e('0x29')](_0x1eb132);}return null;};}function patchUpdates(_0x384ae7){return function(_0x2343bd){try{jsonpatch['apply'](_0x2343bd,_0x384ae7,!![]);}catch(_0xfc5cd8){return BPromise[_0xff4e('0x2e')](_0xfc5cd8);}return _0x2343bd[_0xff4e('0x2f')]();};}function saveUpdates(_0x58f732,_0x5e4d41){return function(_0x3a7bee){if(_0x3a7bee){return _0x3a7bee['update'](_0x58f732)[_0xff4e('0x1c')](function(_0x47fc92){return _0x47fc92;});}return null;};}function removeEntity(_0x30da82,_0x3ea5e7){return function(_0x2f7816){if(_0x2f7816){return _0x2f7816[_0xff4e('0x30')]()[_0xff4e('0x1c')](function(){_0x30da82[_0xff4e('0x28')](0xcc)[_0xff4e('0x31')]();});}};}function handleEntityNotFound(_0x375c47,_0x456d09){return function(_0x5ccbf4){if(!_0x5ccbf4){_0x375c47[_0xff4e('0x27')](0x194);}return _0x5ccbf4;};}function handleError(_0x3bb96e,_0x4e3895){_0x4e3895=_0x4e3895||0x1f4;return function(_0x3b876c){logger[_0xff4e('0x21')](_0x3b876c[_0xff4e('0x32')]);if(_0x3b876c[_0xff4e('0x33')]){delete _0x3b876c[_0xff4e('0x33')];}_0x3bb96e['status'](_0x4e3895)[_0xff4e('0x34')](_0x3b876c);};}exports[_0xff4e('0x35')]=function(_0x2fec42,_0x2c4efb){var _0x4c8017={},_0x2c0fe8={},_0x19de3a={'count':0x0,'rows':[]};var _0xcf1b13=_[_0xff4e('0x36')](db['FreshdeskAccount'][_0xff4e('0x37')],function(_0x15c9d6){return{'name':_0x15c9d6[_0xff4e('0x38')],'type':_0x15c9d6[_0xff4e('0x39')][_0xff4e('0x3a')]};});_0x2c0fe8[_0xff4e('0x3b')]=_[_0xff4e('0x36')](_0xcf1b13,_0xff4e('0x33'));_0x2c0fe8[_0xff4e('0x3c')]=_[_0xff4e('0x3d')](_0x2fec42['query']);_0x2c0fe8[_0xff4e('0x3e')]=_[_0xff4e('0x3f')](_0x2c0fe8[_0xff4e('0x3b')],_0x2c0fe8[_0xff4e('0x3c')]);_0x4c8017[_0xff4e('0x40')]=_[_0xff4e('0x3f')](_0x2c0fe8['model'],qs['fields'](_0x2fec42[_0xff4e('0x3c')][_0xff4e('0x41')]));_0x4c8017[_0xff4e('0x40')]=_0x4c8017[_0xff4e('0x40')][_0xff4e('0x42')]?_0x4c8017['attributes']:_0x2c0fe8['model'];if(!_0x2fec42[_0xff4e('0x3c')][_0xff4e('0x43')](_0xff4e('0x44'))){_0x4c8017[_0xff4e('0x45')]=qs[_0xff4e('0x45')](_0x2fec42['query']['limit']);_0x4c8017[_0xff4e('0x2b')]=qs['offset'](_0x2fec42['query']['offset']);}_0x4c8017['order']=qs[_0xff4e('0x46')](_0x2fec42[_0xff4e('0x3c')][_0xff4e('0x46')]);_0x4c8017[_0xff4e('0x47')]=qs[_0xff4e('0x3e')](_[_0xff4e('0x48')](_0x2fec42['query'],_0x2c0fe8[_0xff4e('0x3e')]),_0xcf1b13);if(_0x2fec42[_0xff4e('0x3c')][_0xff4e('0x49')]){_0x4c8017[_0xff4e('0x47')]=_['merge'](_0x4c8017[_0xff4e('0x47')],{'$or':_[_0xff4e('0x36')](_0xcf1b13,function(_0x125964){if(_0x125964[_0xff4e('0x39')]!==_0xff4e('0x4a')){var _0x4e30b7={};_0x4e30b7[_0x125964[_0xff4e('0x33')]]={'$like':'%'+_0x2fec42['query']['filter']+'%'};return _0x4e30b7;}})});}_0x4c8017=_[_0xff4e('0x4b')]({},_0x4c8017,_0x2fec42[_0xff4e('0x4c')]);var _0x512e2e={'where':_0x4c8017['where']};return db[_0xff4e('0x4d')][_0xff4e('0x2a')](_0x512e2e)[_0xff4e('0x1c')](function(_0x2b1aa1){_0x19de3a[_0xff4e('0x2a')]=_0x2b1aa1;if(_0x2fec42[_0xff4e('0x3c')][_0xff4e('0x4e')]){_0x4c8017[_0xff4e('0x4f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x4c8017);})[_0xff4e('0x1c')](function(_0x342ba0){_0x19de3a['rows']=_0x342ba0;return _0x19de3a;})['then'](respondWithFilteredResult(_0x2c4efb,_0x4c8017))[_0xff4e('0x26')](handleError(_0x2c4efb,null));};exports[_0xff4e('0x50')]=function(_0x39c46e,_0x5e9051){var _0x8a084={'raw':![],'where':{'id':_0x39c46e[_0xff4e('0x51')]['id']}},_0x3e93da={};_0x3e93da[_0xff4e('0x3b')]=_[_0xff4e('0x3d')](db[_0xff4e('0x4d')][_0xff4e('0x37')]);_0x3e93da[_0xff4e('0x3c')]=_['keys'](_0x39c46e[_0xff4e('0x3c')]);_0x3e93da[_0xff4e('0x3e')]=_['intersection'](_0x3e93da['model'],_0x3e93da[_0xff4e('0x3c')]);_0x8a084[_0xff4e('0x40')]=_[_0xff4e('0x3f')](_0x3e93da[_0xff4e('0x3b')],qs[_0xff4e('0x41')](_0x39c46e[_0xff4e('0x3c')]['fields']));_0x8a084[_0xff4e('0x40')]=_0x8a084[_0xff4e('0x40')]['length']?_0x8a084[_0xff4e('0x40')]:_0x3e93da[_0xff4e('0x3b')];if(_0x39c46e[_0xff4e('0x3c')][_0xff4e('0x4e')]){_0x8a084['include']=[{'all':!![]}];}_0x8a084=_['merge']({},_0x8a084,_0x39c46e[_0xff4e('0x4c')]);return db['FreshdeskAccount'][_0xff4e('0x52')](_0x8a084)[_0xff4e('0x1c')](handleEntityNotFound(_0x5e9051,null))[_0xff4e('0x1c')](respondWithResult(_0x5e9051,null))[_0xff4e('0x26')](handleError(_0x5e9051,null));};exports[_0xff4e('0x53')]=function(_0x2e687b,_0x15a1b1){return db[_0xff4e('0x4d')][_0xff4e('0x53')](_0x2e687b[_0xff4e('0x54')],{})[_0xff4e('0x1c')](respondWithResult(_0x15a1b1,0xc9))[_0xff4e('0x26')](handleError(_0x15a1b1,null));};exports['update']=function(_0x43a165,_0x5d18af){if(_0x43a165[_0xff4e('0x54')]['id']){delete _0x43a165[_0xff4e('0x54')]['id'];}return db['FreshdeskAccount'][_0xff4e('0x52')]({'where':{'id':_0x43a165['params']['id']}})[_0xff4e('0x1c')](handleEntityNotFound(_0x5d18af,null))[_0xff4e('0x1c')](saveUpdates(_0x43a165['body'],null))['then'](respondWithResult(_0x5d18af,null))[_0xff4e('0x26')](handleError(_0x5d18af,null));};exports[_0xff4e('0x30')]=function(_0x5f572f,_0x28c915){return db[_0xff4e('0x4d')][_0xff4e('0x52')]({'where':{'id':_0x5f572f[_0xff4e('0x51')]['id']}})[_0xff4e('0x1c')](handleEntityNotFound(_0x28c915,null))['then'](removeEntity(_0x28c915,null))[_0xff4e('0x26')](handleError(_0x28c915,null));};exports[_0xff4e('0x55')]=function(_0x4d7325,_0x12ab2c,_0x2f0af1){var _0x5e4b84={};var _0x298787={};var _0x5005cb;var _0x3f87a8;return db[_0xff4e('0x4d')][_0xff4e('0x56')]({'where':{'id':_0x4d7325[_0xff4e('0x51')]['id']}})[_0xff4e('0x1c')](handleEntityNotFound(_0x12ab2c,null))[_0xff4e('0x1c')](function(_0x27ff45){if(_0x27ff45){_0x5005cb=_0x27ff45;_0x298787['model']=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x298787[_0xff4e('0x3c')]=_[_0xff4e('0x3d')](_0x4d7325[_0xff4e('0x3c')]);_0x298787[_0xff4e('0x3e')]=_[_0xff4e('0x3f')](_0x298787[_0xff4e('0x3b')],_0x298787['query']);_0x5e4b84[_0xff4e('0x40')]=_[_0xff4e('0x3f')](_0x298787[_0xff4e('0x3b')],qs[_0xff4e('0x41')](_0x4d7325[_0xff4e('0x3c')]['fields']));_0x5e4b84['attributes']=_0x5e4b84[_0xff4e('0x40')][_0xff4e('0x42')]?_0x5e4b84[_0xff4e('0x40')]:_0x298787[_0xff4e('0x3b')];_0x5e4b84[_0xff4e('0x57')]=qs[_0xff4e('0x46')](_0x4d7325['query']['sort']);_0x5e4b84[_0xff4e('0x47')]=qs['filters'](_[_0xff4e('0x48')](_0x4d7325[_0xff4e('0x3c')],_0x298787[_0xff4e('0x3e')]));if(_0x4d7325[_0xff4e('0x3c')][_0xff4e('0x49')]){_0x5e4b84[_0xff4e('0x47')]=_['merge'](_0x5e4b84[_0xff4e('0x47')],{'$or':_['map'](_0x5e4b84[_0xff4e('0x40')],function(_0x306a9e){var _0x4d41a0={};_0x4d41a0[_0x306a9e]={'$like':'%'+_0x4d7325['query']['filter']+'%'};return _0x4d41a0;})});}_0x5e4b84=_[_0xff4e('0x4b')]({},_0x5e4b84,_0x4d7325[_0xff4e('0x4c')]);return _0x5005cb[_0xff4e('0x55')](_0x5e4b84);}})[_0xff4e('0x1c')](function(_0x58ca0c){if(_0x58ca0c){_0x3f87a8=_0x58ca0c[_0xff4e('0x42')];if(!_0x4d7325['query'][_0xff4e('0x43')](_0xff4e('0x44'))){_0x5e4b84[_0xff4e('0x45')]=qs[_0xff4e('0x45')](_0x4d7325[_0xff4e('0x3c')][_0xff4e('0x45')]);_0x5e4b84['offset']=qs[_0xff4e('0x2b')](_0x4d7325[_0xff4e('0x3c')][_0xff4e('0x2b')]);}return _0x5005cb[_0xff4e('0x55')](_0x5e4b84);}})['then'](function(_0x57be9c){if(_0x57be9c){return _0x57be9c?{'count':_0x3f87a8,'rows':_0x57be9c}:null;}})[_0xff4e('0x1c')](respondWithResult(_0x12ab2c,null))[_0xff4e('0x26')](handleError(_0x12ab2c,null));};exports[_0xff4e('0x58')]=function(_0x2dc8a9,_0x419b9a,_0x15bd94){if(_0x2dc8a9[_0xff4e('0x54')]['id']){delete _0x2dc8a9[_0xff4e('0x54')]['id'];}return db[_0xff4e('0x4d')]['findOne']({'where':{'id':_0x2dc8a9[_0xff4e('0x51')]['id']}})[_0xff4e('0x1c')](handleEntityNotFound(_0x419b9a,null))[_0xff4e('0x1c')](function(_0x318690){if(_0x318690){_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x59')]=_0x318690['id'];_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x5a')]=integrations['getSubjects'](_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x5b')],_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x39')]);_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x5c')]=integrations[_0xff4e('0x5d')](_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x5b')],_0x2dc8a9[_0xff4e('0x54')][_0xff4e('0x39')]);return db[_0xff4e('0x5e')]['create'](_0x2dc8a9[_0xff4e('0x54')],{'include':[{'model':db[_0xff4e('0x5f')],'as':_0xff4e('0x5a')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xff4e('0x1c')](respondWithResult(_0x419b9a,null))['catch'](handleError(_0x419b9a,null));};exports[_0xff4e('0x60')]=function(_0x4f758a,_0x550981,_0x3b069e){var _0x5540a4='';return db[_0xff4e('0x4d')][_0xff4e('0x56')]({'where':{'id':_0x4f758a['params']['id']},'attributes':['id',_0xff4e('0x61'),_0xff4e('0x62')]})[_0xff4e('0x1c')](handleEntityNotFound(_0x550981,null))['then'](function(_0x563750){if(_0x563750){_0x5540a4=_0x563750[_0xff4e('0x61')];var _0x1c38d4=_0x5540a4['slice'](-0x1);if(_0x1c38d4==='/'){_0x5540a4=_0x5540a4[_0xff4e('0x63')](0x0,_0x5540a4['lastIndexOf'](_0x1c38d4));}return rp({'method':_0xff4e('0x64'),'uri':util[_0xff4e('0x65')](_0xff4e('0x66'),_0x5540a4,_0xff4e('0x67')),'headers':{'Authorization':util['format'](_0xff4e('0x68'),new Buffer(util[_0xff4e('0x65')](_0xff4e('0x69'),_0x563750['apiKey']))[_0xff4e('0x6a')]('base64'))},'json':!![]});}})[_0xff4e('0x1c')](function(_0x2d0bb5){if(_0x2d0bb5){var _0x3a35a2=[_0xff4e('0x6b'),_0xff4e('0x6c'),_0xff4e('0x6d'),_0xff4e('0x6e'),_0xff4e('0x28'),_0xff4e('0x6f'),_0xff4e('0x70'),_0xff4e('0x71'),_0xff4e('0x72'),_0xff4e('0x70'),_0xff4e('0x73')];_[_0xff4e('0x74')](_0x2d0bb5,function(_0x49cecc){return _0x3a35a2[_0xff4e('0x75')](_0x49cecc['name'])||!_0x49cecc[_0xff4e('0x76')]&&_0x49cecc[_0xff4e('0x39')]!==_0xff4e('0x77')&&_0x49cecc[_0xff4e('0x39')]!==_0xff4e('0x78');});return{'count':_0x2d0bb5['length'],'rows':_[_0xff4e('0x36')](_0x2d0bb5,function(_0x2b7199){return{'id':_0x2b7199['name'],'name':_0x2b7199[_0xff4e('0x79')],'custom':!_0x2b7199[_0xff4e('0x76')],'options':_0x2b7199['choices']?_[_0xff4e('0x36')](_0x2b7199['choices'],function(_0x3f67fd){return{'name':_[_0xff4e('0x7a')](_0x3f67fd),'value':_0x3f67fd};}):[]};})};}})[_0xff4e('0x1c')](respondWithResult(_0x550981,null))[_0xff4e('0x26')](function(_0x7027c0){var _0x307021=_0x4f758a[_0xff4e('0x3c')][_0xff4e('0x7b')]?0x1f4:_0x7027c0[_0xff4e('0x7c')]||0x1f4;logger[_0xff4e('0x21')](_0xff4e('0x7d'),_0xff4e('0x60'),_0x307021,JSON['stringify'](_0x7027c0));delete _0x7027c0[_0xff4e('0x33')];if(_0x307021===0x191){_0x307021=0x190;}_0x550981[_0xff4e('0x28')](_0x307021)['send'](_0x4f758a['query'][_0xff4e('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x7027c0[_0xff4e('0x7c')]}:_0x7027c0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ac4c515..7560e82 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 _0x92be=['path','rimraf','../../config/environment','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x1daf03,_0x8c1858){var _0x4de712=function(_0x95d6f8){while(--_0x95d6f8){_0x1daf03['push'](_0x1daf03['shift']());}};_0x4de712(++_0x8c1858);}(_0x92be,0x1ab));var _0xe92b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x92be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe92b('0x0'));var util=require(_0xe92b('0x1'));var logger=require('../../config/logger')(_0xe92b('0x2'));var moment=require(_0xe92b('0x3'));var BPromise=require(_0xe92b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe92b('0x5'));var rimraf=require(_0xe92b('0x6'));var config=require(_0xe92b('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe92b('0x8')]=function(_0x11a8cd,_0x486f71){return _0x11a8cd[_0xe92b('0x9')](_0xe92b('0xa'),attributes,{'tableName':_0xe92b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fa9=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','util','../../config/logger','moment'];(function(_0x329eda,_0x736191){var _0x561fc2=function(_0x30656f){while(--_0x30656f){_0x329eda['push'](_0x329eda['shift']());}};_0x561fc2(++_0x736191);}(_0x2fa9,0x105));var _0x92fa=function(_0x30ee8c,_0x5b70b5){_0x30ee8c=_0x30ee8c-0x0;var _0x30e2ce=_0x2fa9[_0x30ee8c];return _0x30e2ce;};'use strict';var _=require('lodash');var util=require(_0x92fa('0x0'));var logger=require(_0x92fa('0x1'))('api');var moment=require(_0x92fa('0x2'));var BPromise=require('bluebird');var rp=require(_0x92fa('0x3'));var fs=require('fs');var path=require(_0x92fa('0x4'));var rimraf=require(_0x92fa('0x5'));var config=require(_0x92fa('0x6'));var attributes=require(_0x92fa('0x7'));var integrations=require(_0x92fa('0x8'));module['exports']=function(_0x4db825,_0x2a77eb){return _0x4db825[_0x92fa('0x9')](_0x92fa('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 44dddbd..b4e3c33 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 _0x8e0c=['FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowFreshdeskAccount','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount'];(function(_0x52ea48,_0x14f622){var _0x1f8e44=function(_0x3ba21a){while(--_0x3ba21a){_0x52ea48['push'](_0x52ea48['shift']());}};_0x1f8e44(++_0x14f622);}(_0x8e0c,0x96));var _0xc8e0=function(_0x194b99,_0x2a20da){_0x194b99=_0x194b99-0x0;var _0x59eebf=_0x8e0c[_0x194b99];return _0x59eebf;};'use strict';var _=require(_0xc8e0('0x0'));var util=require(_0xc8e0('0x1'));var moment=require('moment');var BPromise=require(_0xc8e0('0x2'));var rs=require(_0xc8e0('0x3'));var fs=require('fs');var Redis=require(_0xc8e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8e0('0x5'));var logger=require(_0xc8e0('0x6'))('rpc');var config=require(_0xc8e0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc8e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b64db,_0x79020,_0x29dfa7){return new BPromise(function(_0x130a0f,_0x5e8f88){return client['request'](_0x9b64db,_0x29dfa7)[_0xc8e0('0x9')](function(_0x181618){logger[_0xc8e0('0xa')](_0xc8e0('0xb'),_0x79020,_0xc8e0('0xc'));logger['debug'](_0xc8e0('0xd'),_0x79020,'request\x20sent',JSON['stringify'](_0x181618));if(_0x181618[_0xc8e0('0xe')]){if(_0x181618['error'][_0xc8e0('0xf')]===0x1f4){logger[_0xc8e0('0xe')](_0xc8e0('0xb'),_0x79020,_0x181618[_0xc8e0('0xe')][_0xc8e0('0x10')]);return _0x5e8f88(_0x181618[_0xc8e0('0xe')]['message']);}logger[_0xc8e0('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x79020,_0x181618['error'][_0xc8e0('0x10')]);return _0x130a0f(_0x181618['error'][_0xc8e0('0x10')]);}else{logger[_0xc8e0('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x79020,_0xc8e0('0xc'));_0x130a0f(_0x181618[_0xc8e0('0x11')][_0xc8e0('0x10')]);}})[_0xc8e0('0x12')](function(_0x4b88be){logger[_0xc8e0('0xe')](_0xc8e0('0xb'),_0x79020,_0x4b88be);_0x5e8f88(_0x4b88be);});});}exports[_0xc8e0('0x13')]=function(_0xaa1d80){var _0x24d186=this;return new Promise(function(_0x5577d2,_0x4dd584){return db[_0xc8e0('0x14')][_0xc8e0('0x15')]({'raw':_0xaa1d80[_0xc8e0('0x16')]?_0xaa1d80[_0xc8e0('0x16')][_0xc8e0('0x17')]===undefined?!![]:![]:!![],'where':_0xaa1d80[_0xc8e0('0x16')]?_0xaa1d80[_0xc8e0('0x16')][_0xc8e0('0x18')]||null:null,'attributes':_0xaa1d80[_0xc8e0('0x16')]?_0xaa1d80[_0xc8e0('0x16')][_0xc8e0('0x19')]||null:null,'limit':_0xaa1d80[_0xc8e0('0x16')]?_0xaa1d80[_0xc8e0('0x16')][_0xc8e0('0x1a')]||null:null,'include':_0xaa1d80[_0xc8e0('0x16')]?_0xaa1d80['options'][_0xc8e0('0x1b')]?_['map'](_0xaa1d80[_0xc8e0('0x16')][_0xc8e0('0x1b')],function(_0x1165ce){return{'model':db[_0x1165ce[_0xc8e0('0x1c')]],'as':_0x1165ce['as'],'attributes':_0x1165ce[_0xc8e0('0x19')],'include':_0x1165ce[_0xc8e0('0x1b')]?_[_0xc8e0('0x1d')](_0x1165ce[_0xc8e0('0x1b')],function(_0x2284a7){return{'model':db[_0x2284a7[_0xc8e0('0x1c')]],'as':_0x2284a7['as'],'attributes':_0x2284a7['attributes'],'include':_0x2284a7[_0xc8e0('0x1b')]?_['map'](_0x2284a7['include'],function(_0x3aa915){return{'model':db[_0x3aa915[_0xc8e0('0x1c')]],'as':_0x3aa915['as'],'attributes':_0x3aa915['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8e0('0x9')](function(_0x184a6e){logger[_0xc8e0('0xa')]('GetFreshdeskAccount',_0xaa1d80);logger[_0xc8e0('0x1e')](_0xc8e0('0x13'),_0xaa1d80,JSON['stringify'](_0x184a6e));_0x5577d2(_0x184a6e);})['catch'](function(_0x4841d3){logger[_0xc8e0('0xe')](_0xc8e0('0x13'),_0x4841d3['message'],_0xaa1d80);_0x4dd584(_0x24d186[_0xc8e0('0xe')](0x1f4,_0x4841d3[_0xc8e0('0x10')]));});});};exports[_0xc8e0('0x1f')]=function(_0x45b4b0){var _0x208d5a=this;return new Promise(function(_0x3fa7bd,_0x32c689){return db[_0xc8e0('0x14')][_0xc8e0('0x20')]({'raw':_0x45b4b0[_0xc8e0('0x16')]?_0x45b4b0[_0xc8e0('0x16')][_0xc8e0('0x17')]===undefined?!![]:![]:!![],'where':_0x45b4b0[_0xc8e0('0x16')]?_0x45b4b0[_0xc8e0('0x16')][_0xc8e0('0x18')]||null:null,'attributes':_0x45b4b0[_0xc8e0('0x16')]?_0x45b4b0[_0xc8e0('0x16')][_0xc8e0('0x19')]||null:null,'include':_0x45b4b0[_0xc8e0('0x16')]?_0x45b4b0[_0xc8e0('0x16')][_0xc8e0('0x1b')]?_[_0xc8e0('0x1d')](_0x45b4b0[_0xc8e0('0x16')][_0xc8e0('0x1b')],function(_0xf5113b){return{'model':db[_0xf5113b['model']],'as':_0xf5113b['as'],'attributes':_0xf5113b['attributes'],'include':_0xf5113b[_0xc8e0('0x1b')]?_[_0xc8e0('0x1d')](_0xf5113b[_0xc8e0('0x1b')],function(_0x412aba){return{'model':db[_0x412aba[_0xc8e0('0x1c')]],'as':_0x412aba['as'],'attributes':_0x412aba[_0xc8e0('0x19')],'include':_0x412aba[_0xc8e0('0x1b')]?_[_0xc8e0('0x1d')](_0x412aba[_0xc8e0('0x1b')],function(_0x40ca06){return{'model':db[_0x40ca06[_0xc8e0('0x1c')]],'as':_0x40ca06['as'],'attributes':_0x40ca06[_0xc8e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc8e0('0x9')](function(_0x4c9fa2){logger[_0xc8e0('0xa')](_0xc8e0('0x1f'),_0x45b4b0);logger['debug'](_0xc8e0('0x1f'),_0x45b4b0,JSON[_0xc8e0('0x21')](_0x4c9fa2));_0x3fa7bd(_0x4c9fa2);})[_0xc8e0('0x12')](function(_0xb586c4){logger[_0xc8e0('0xe')]('ShowFreshdeskAccount',_0xb586c4[_0xc8e0('0x10')],_0x45b4b0);_0x32c689(_0x208d5a[_0xc8e0('0xe')](0x1f4,_0xb586c4[_0xc8e0('0x10')]));});});}; \ No newline at end of file +var _0xc3e9=['map','model','attributes','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshdeskAccount','findAll','options','limit','include'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc3e9,0x75));var _0x9c3e=function(_0x3dc824,_0x8f3407){_0x3dc824=_0x3dc824-0x0;var _0x81e08b=_0xc3e9[_0x3dc824];return _0x81e08b;};'use strict';var _=require(_0x9c3e('0x0'));var util=require(_0x9c3e('0x1'));var moment=require(_0x9c3e('0x2'));var BPromise=require(_0x9c3e('0x3'));var rs=require(_0x9c3e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c3e('0x5'))['db'];var utils=require(_0x9c3e('0x6'));var logger=require(_0x9c3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9c3e('0x8'));var client=jayson[_0x9c3e('0x9')][_0x9c3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x526592,_0x2795b8,_0x45832b){return new BPromise(function(_0x4aaf3f,_0x1fa131){return client[_0x9c3e('0xb')](_0x526592,_0x45832b)[_0x9c3e('0xc')](function(_0x1a61f6){logger[_0x9c3e('0xd')](_0x9c3e('0xe'),_0x2795b8,_0x9c3e('0xf'));logger[_0x9c3e('0x10')](_0x9c3e('0x11'),_0x2795b8,_0x9c3e('0xf'),JSON['stringify'](_0x1a61f6));if(_0x1a61f6[_0x9c3e('0x12')]){if(_0x1a61f6['error'][_0x9c3e('0x13')]===0x1f4){logger[_0x9c3e('0x12')](_0x9c3e('0xe'),_0x2795b8,_0x1a61f6[_0x9c3e('0x12')][_0x9c3e('0x14')]);return _0x1fa131(_0x1a61f6[_0x9c3e('0x12')]['message']);}logger[_0x9c3e('0x12')](_0x9c3e('0xe'),_0x2795b8,_0x1a61f6[_0x9c3e('0x12')][_0x9c3e('0x14')]);return _0x4aaf3f(_0x1a61f6[_0x9c3e('0x12')]['message']);}else{logger['info'](_0x9c3e('0xe'),_0x2795b8,_0x9c3e('0xf'));_0x4aaf3f(_0x1a61f6['result'][_0x9c3e('0x14')]);}})[_0x9c3e('0x15')](function(_0x31dbdb){logger['error'](_0x9c3e('0xe'),_0x2795b8,_0x31dbdb);_0x1fa131(_0x31dbdb);});});}exports[_0x9c3e('0x16')]=function(_0x49d31e){var _0x98b4bf=this;return new Promise(function(_0xf8bf5,_0x332bf2){return db['FreshdeskAccount'][_0x9c3e('0x17')]({'raw':_0x49d31e[_0x9c3e('0x18')]?_0x49d31e[_0x9c3e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49d31e[_0x9c3e('0x18')]?_0x49d31e[_0x9c3e('0x18')]['where']||null:null,'attributes':_0x49d31e[_0x9c3e('0x18')]?_0x49d31e[_0x9c3e('0x18')]['attributes']||null:null,'limit':_0x49d31e[_0x9c3e('0x18')]?_0x49d31e[_0x9c3e('0x18')][_0x9c3e('0x19')]||null:null,'include':_0x49d31e[_0x9c3e('0x18')]?_0x49d31e[_0x9c3e('0x18')][_0x9c3e('0x1a')]?_[_0x9c3e('0x1b')](_0x49d31e['options'][_0x9c3e('0x1a')],function(_0x410a2e){return{'model':db[_0x410a2e[_0x9c3e('0x1c')]],'as':_0x410a2e['as'],'attributes':_0x410a2e[_0x9c3e('0x1d')],'include':_0x410a2e[_0x9c3e('0x1a')]?_[_0x9c3e('0x1b')](_0x410a2e[_0x9c3e('0x1a')],function(_0x103131){return{'model':db[_0x103131['model']],'as':_0x103131['as'],'attributes':_0x103131[_0x9c3e('0x1d')],'include':_0x103131[_0x9c3e('0x1a')]?_[_0x9c3e('0x1b')](_0x103131['include'],function(_0xe5ccf7){return{'model':db[_0xe5ccf7['model']],'as':_0xe5ccf7['as'],'attributes':_0xe5ccf7[_0x9c3e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c3e('0xc')](function(_0x25f452){logger['info'](_0x9c3e('0x16'),_0x49d31e);logger['debug'](_0x9c3e('0x16'),_0x49d31e,JSON[_0x9c3e('0x1e')](_0x25f452));_0xf8bf5(_0x25f452);})[_0x9c3e('0x15')](function(_0x36f806){logger[_0x9c3e('0x12')](_0x9c3e('0x16'),_0x36f806[_0x9c3e('0x14')],_0x49d31e);_0x332bf2(_0x98b4bf[_0x9c3e('0x12')](0x1f4,_0x36f806[_0x9c3e('0x14')]));});});};exports[_0x9c3e('0x1f')]=function(_0x338cd6){var _0x1231ab=this;return new Promise(function(_0x39e378,_0x3dfb46){return db[_0x9c3e('0x20')][_0x9c3e('0x21')]({'raw':_0x338cd6[_0x9c3e('0x18')]?_0x338cd6[_0x9c3e('0x18')][_0x9c3e('0x22')]===undefined?!![]:![]:!![],'where':_0x338cd6[_0x9c3e('0x18')]?_0x338cd6[_0x9c3e('0x18')][_0x9c3e('0x23')]||null:null,'attributes':_0x338cd6['options']?_0x338cd6[_0x9c3e('0x18')][_0x9c3e('0x1d')]||null:null,'include':_0x338cd6[_0x9c3e('0x18')]?_0x338cd6['options'][_0x9c3e('0x1a')]?_['map'](_0x338cd6[_0x9c3e('0x18')][_0x9c3e('0x1a')],function(_0x41611b){return{'model':db[_0x41611b['model']],'as':_0x41611b['as'],'attributes':_0x41611b[_0x9c3e('0x1d')],'include':_0x41611b['include']?_[_0x9c3e('0x1b')](_0x41611b[_0x9c3e('0x1a')],function(_0x547bf2){return{'model':db[_0x547bf2[_0x9c3e('0x1c')]],'as':_0x547bf2['as'],'attributes':_0x547bf2[_0x9c3e('0x1d')],'include':_0x547bf2[_0x9c3e('0x1a')]?_[_0x9c3e('0x1b')](_0x547bf2[_0x9c3e('0x1a')],function(_0x48d428){return{'model':db[_0x48d428['model']],'as':_0x48d428['as'],'attributes':_0x48d428[_0x9c3e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c3e('0xc')](function(_0xf75733){logger[_0x9c3e('0xd')](_0x9c3e('0x1f'),_0x338cd6);logger['debug'](_0x9c3e('0x1f'),_0x338cd6,JSON[_0x9c3e('0x1e')](_0xf75733));_0x39e378(_0xf75733);})[_0x9c3e('0x15')](function(_0x5561eb){logger[_0x9c3e('0x12')](_0x9c3e('0x1f'),_0x5561eb[_0x9c3e('0x14')],_0x338cd6);_0x3dfb46(_0x1231ab['error'](0x1f4,_0x5561eb[_0x9c3e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f204d5d..b7b0da1 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 _0xcf9d=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0xe11306,_0x2664ce){var _0x1d2b9b=function(_0x45f08f){while(--_0x45f08f){_0xe11306['push'](_0xe11306['shift']());}};_0x1d2b9b(++_0x2664ce);}(_0xcf9d,0x1e5));var _0xdcf9=function(_0x5ddb25,_0x14273f){_0x5ddb25=_0x5ddb25-0x0;var _0x3db469=_0xcf9d[_0x5ddb25];return _0x3db469;};'use strict';var multer=require(_0xdcf9('0x0'));var util=require(_0xdcf9('0x1'));var path=require(_0xdcf9('0x2'));var timeout=require(_0xdcf9('0x3'));var express=require(_0xdcf9('0x4'));var router=express[_0xdcf9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdcf9('0x6'));var config=require(_0xdcf9('0x7'));var controller=require(_0xdcf9('0x8'));router[_0xdcf9('0x9')]('/',auth[_0xdcf9('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdcf9('0xb')]);router[_0xdcf9('0x9')](_0xdcf9('0xc'),auth['isAuthenticated'](),controller[_0xdcf9('0xd')]);router[_0xdcf9('0x9')]('/:id/subjects',auth[_0xdcf9('0xa')](),controller[_0xdcf9('0xe')]);router[_0xdcf9('0x9')](_0xdcf9('0xf'),auth[_0xdcf9('0xa')](),controller[_0xdcf9('0x10')]);router[_0xdcf9('0x9')](_0xdcf9('0x11'),auth[_0xdcf9('0xa')](),controller[_0xdcf9('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdcf9('0x13')]);router[_0xdcf9('0x14')]('/:id/tags',auth[_0xdcf9('0xa')](),controller['setTags']);router[_0xdcf9('0x15')](_0xdcf9('0x16'),auth[_0xdcf9('0xa')](),controller[_0xdcf9('0x17')]);router[_0xdcf9('0x18')]('/:id',auth[_0xdcf9('0xa')](),controller[_0xdcf9('0x19')]);module[_0xdcf9('0x1a')]=router; \ No newline at end of file +var _0x8a14=['/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x3d0903,_0x58f74f){var _0x1b06ad=function(_0x409d04){while(--_0x409d04){_0x3d0903['push'](_0x3d0903['shift']());}};_0x1b06ad(++_0x58f74f);}(_0x8a14,0x12e));var _0x48a1=function(_0x2e72f3,_0x14f5a7){_0x2e72f3=_0x2e72f3-0x0;var _0x32ad3f=_0x8a14[_0x2e72f3];return _0x32ad3f;};'use strict';var multer=require(_0x48a1('0x0'));var util=require('util');var path=require(_0x48a1('0x1'));var timeout=require(_0x48a1('0x2'));var express=require(_0x48a1('0x3'));var router=express['Router']();var auth=require(_0x48a1('0x4'));var interaction=require(_0x48a1('0x5'));var config=require(_0x48a1('0x6'));var controller=require(_0x48a1('0x7'));router[_0x48a1('0x8')]('/',auth[_0x48a1('0x9')](),controller['index']);router[_0x48a1('0x8')](_0x48a1('0xa'),auth[_0x48a1('0x9')](),controller[_0x48a1('0xb')]);router[_0x48a1('0x8')](_0x48a1('0xc'),auth[_0x48a1('0x9')](),controller['getFields']);router[_0x48a1('0x8')](_0x48a1('0xd'),auth[_0x48a1('0x9')](),controller[_0x48a1('0xe')]);router[_0x48a1('0x8')](_0x48a1('0xf'),auth[_0x48a1('0x9')](),controller[_0x48a1('0x10')]);router['get'](_0x48a1('0x11'),auth[_0x48a1('0x9')](),controller[_0x48a1('0x12')]);router[_0x48a1('0x13')]('/',auth[_0x48a1('0x9')](),controller[_0x48a1('0x14')]);router[_0x48a1('0x13')](_0x48a1('0x11'),auth['isAuthenticated'](),controller[_0x48a1('0x15')]);router[_0x48a1('0x16')](_0x48a1('0xa'),auth[_0x48a1('0x9')](),controller['update']);router[_0x48a1('0x17')](_0x48a1('0xa'),auth[_0x48a1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 948775e..4a85217 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 _0x9da7=['exports','STRING','sequelize'];(function(_0xd992a3,_0xe1732c){var _0x43c122=function(_0x17e63e){while(--_0x17e63e){_0xd992a3['push'](_0xd992a3['shift']());}};_0x43c122(++_0xe1732c);}(_0x9da7,0x1ca));var _0x79da=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0x9da7[_0x33d4a2];return _0x2c793f;};'use strict';var Sequelize=require(_0x79da('0x0'));module[_0x79da('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79da('0x2')]}}; \ No newline at end of file +var _0x09ac=['STRING','sequelize'];(function(_0x3e9f65,_0xa08549){var _0x254366=function(_0x2fd696){while(--_0x2fd696){_0x3e9f65['push'](_0x3e9f65['shift']());}};_0x254366(++_0xa08549);}(_0x09ac,0x1e5));var _0xc09a=function(_0x3435d7,_0x2a68ad){_0x3435d7=_0x3435d7-0x0;var _0x27519f=_0x09ac[_0x3435d7];return _0x27519f;};'use strict';var Sequelize=require(_0xc09a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc09a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index baff0fc..4f70273 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 _0x225d=['moment','bluebird','mustache','util','path','sox','to-csv','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','jayson/promise','client','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','reject','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','type','VIRTUAL','filter','merge','includeAll','include','rows','length','find','catch','create','body','params','getFields','findOne','FreshdeskField','pick','options','getSubjects','hasOwnProperty','getDescriptions','Tag','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x225d,0x178));var _0xd225=function(_0x234490,_0x2199b0){_0x234490=_0x234490-0x0;var _0x4e3750=_0x225d[_0x234490];return _0x4e3750;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd225('0x0'));var zipdir=require(_0xd225('0x1'));var jsonpatch=require(_0xd225('0x2'));var rp=require(_0xd225('0x3'));var moment=require(_0xd225('0x4'));var BPromise=require(_0xd225('0x5'));var Mustache=require(_0xd225('0x6'));var util=require(_0xd225('0x7'));var path=require(_0xd225('0x8'));var sox=require(_0xd225('0x9'));var csv=require(_0xd225('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd225('0xb'));var squel=require(_0xd225('0xc'));var crypto=require(_0xd225('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd225('0xe'));var toCsv=require(_0xd225('0xa'));var querystring=require(_0xd225('0xf'));var Papa=require(_0xd225('0x10'));var Redis=require(_0xd225('0x11'));var authService=require(_0xd225('0x12'));var qs=require(_0xd225('0x13'));var as=require(_0xd225('0x14'));var hardwareService=require(_0xd225('0x15'));var logger=require(_0xd225('0x16'))(_0xd225('0x17'));var utils=require(_0xd225('0x18'));var config=require(_0xd225('0x19'));var licenseUtil=require(_0xd225('0x1a'));var db=require(_0xd225('0x1b'))['db'];var jayson=require(_0xd225('0x1c'));var client=jayson[_0xd225('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45909b,_0x30810f,_0xe12331,_0x327752){return new BPromise(function(_0x3fd9b6,_0x32a752){var _0x7d5853=_0x327752||client;return _0x7d5853[_0xd225('0x1e')](_0x45909b,_0xe12331)[_0xd225('0x1f')](function(_0x514b22){logger[_0xd225('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30810f,'request\x20sent');logger[_0xd225('0x21')](_0xd225('0x22'),_0x30810f,'request\x20sent',JSON[_0xd225('0x23')](_0x514b22));if(_0x514b22[_0xd225('0x24')]){if(_0x514b22[_0xd225('0x24')][_0xd225('0x25')]===0x1f4){logger['error'](_0xd225('0x26'),_0x30810f,_0x514b22[_0xd225('0x24')][_0xd225('0x27')]);return _0x32a752(_0x514b22[_0xd225('0x24')][_0xd225('0x27')]);}logger[_0xd225('0x24')](_0xd225('0x26'),_0x30810f,_0x514b22[_0xd225('0x24')][_0xd225('0x27')]);return _0x3fd9b6(_0x514b22[_0xd225('0x24')]['message']);}else{logger[_0xd225('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30810f,'request\x20sent');_0x3fd9b6(_0x514b22['result']['message']);}})['catch'](function(_0x32899c){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x30810f,_0x32899c);_0x32a752(_0x32899c);});});}function respondWithStatusCode(_0x4b7580,_0x2e3c86){_0x2e3c86=_0x2e3c86||0xcc;return function(_0x134ea8){if(_0x134ea8){return _0x4b7580[_0xd225('0x28')](_0x2e3c86);}return _0x4b7580[_0xd225('0x29')](_0x2e3c86)[_0xd225('0x2a')]();};}function respondWithResult(_0x20c3dd,_0x12e6f5){_0x12e6f5=_0x12e6f5||0xc8;return function(_0x3dbee8){if(_0x3dbee8){return _0x20c3dd['status'](_0x12e6f5)[_0xd225('0x2b')](_0x3dbee8);}};}function respondWithFilteredResult(_0x2fdc41,_0x48b57b){return function(_0x2aa838){if(_0x2aa838){var _0x58b4b4=_0x2aa838[_0xd225('0x2c')],_0x2bdc63=_0x48b57b[_0xd225('0x2d')],_0x13219a=_0x48b57b[_0xd225('0x2d')]+_0x48b57b[_0xd225('0x2e')],_0x5df7e5;if(_0x13219a>=_0x58b4b4){_0x13219a=_0x58b4b4;_0x5df7e5=0xc8;}else{_0x5df7e5=0xce;}_0x2fdc41[_0xd225('0x29')](_0x5df7e5);return _0x2fdc41[_0xd225('0x2f')]('Content-Range',_0x2bdc63+'-'+_0x13219a+'/'+_0x58b4b4)[_0xd225('0x2b')](_0x2aa838);}return null;};}function patchUpdates(_0x40dcd4){return function(_0x44ec07){try{jsonpatch['apply'](_0x44ec07,_0x40dcd4,!![]);}catch(_0x79afee){return BPromise[_0xd225('0x30')](_0x79afee);}return _0x44ec07['save']();};}function saveUpdates(_0x3ebc62,_0x1fae3a){return function(_0x28144a){if(_0x28144a){return _0x28144a[_0xd225('0x31')](_0x3ebc62)[_0xd225('0x1f')](function(_0x293e4e){return _0x293e4e;});}return null;};}function removeEntity(_0x11378a,_0x46c0bd){return function(_0x8a58cf){if(_0x8a58cf){return _0x8a58cf[_0xd225('0x32')]()['then'](function(){_0x11378a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x539f0a,_0x5ee25d){return function(_0x117102){if(!_0x117102){_0x539f0a[_0xd225('0x28')](0x194);}return _0x117102;};}function handleError(_0x4cc79e,_0x4e806d){_0x4e806d=_0x4e806d||0x1f4;return function(_0x187130){logger[_0xd225('0x24')](_0x187130[_0xd225('0x33')]);if(_0x187130[_0xd225('0x34')]){delete _0x187130[_0xd225('0x34')];}_0x4cc79e['status'](_0x4e806d)[_0xd225('0x35')](_0x187130);};}exports[_0xd225('0x36')]=function(_0x1736a8,_0x1a3581){var _0x174bb1={},_0x1b3846={},_0x142b88={'count':0x0,'rows':[]};var _0x2b0138=_[_0xd225('0x37')](db[_0xd225('0x38')][_0xd225('0x39')],function(_0x7a2f8e){return{'name':_0x7a2f8e[_0xd225('0x3a')],'type':_0x7a2f8e['type'][_0xd225('0x3b')]};});_0x1b3846[_0xd225('0x3c')]=_[_0xd225('0x37')](_0x2b0138,_0xd225('0x34'));_0x1b3846[_0xd225('0x3d')]=_[_0xd225('0x3e')](_0x1736a8[_0xd225('0x3d')]);_0x1b3846[_0xd225('0x3f')]=_[_0xd225('0x40')](_0x1b3846['model'],_0x1b3846[_0xd225('0x3d')]);_0x174bb1[_0xd225('0x41')]=_[_0xd225('0x40')](_0x1b3846[_0xd225('0x3c')],qs[_0xd225('0x42')](_0x1736a8[_0xd225('0x3d')][_0xd225('0x42')]));_0x174bb1['attributes']=_0x174bb1[_0xd225('0x41')]['length']?_0x174bb1[_0xd225('0x41')]:_0x1b3846[_0xd225('0x3c')];if(!_0x1736a8[_0xd225('0x3d')]['hasOwnProperty'](_0xd225('0x43'))){_0x174bb1['limit']=qs[_0xd225('0x2e')](_0x1736a8['query'][_0xd225('0x2e')]);_0x174bb1[_0xd225('0x2d')]=qs[_0xd225('0x2d')](_0x1736a8['query'][_0xd225('0x2d')]);}_0x174bb1[_0xd225('0x44')]=qs[_0xd225('0x45')](_0x1736a8[_0xd225('0x3d')][_0xd225('0x45')]);_0x174bb1[_0xd225('0x46')]=qs[_0xd225('0x3f')](_['pick'](_0x1736a8[_0xd225('0x3d')],_0x1b3846[_0xd225('0x3f')]),_0x2b0138);if(_0x1736a8[_0xd225('0x3d')]['filter']){_0x174bb1[_0xd225('0x46')]=_['merge'](_0x174bb1['where'],{'$or':_['map'](_0x2b0138,function(_0xdee5a9){if(_0xdee5a9[_0xd225('0x47')]!==_0xd225('0x48')){var _0x518a1a={};_0x518a1a[_0xdee5a9[_0xd225('0x34')]]={'$like':'%'+_0x1736a8[_0xd225('0x3d')][_0xd225('0x49')]+'%'};return _0x518a1a;}})});}_0x174bb1=_[_0xd225('0x4a')]({},_0x174bb1,_0x1736a8['options']);var _0x252fef={'where':_0x174bb1[_0xd225('0x46')]};return db[_0xd225('0x38')][_0xd225('0x2c')](_0x252fef)[_0xd225('0x1f')](function(_0x47243c){_0x142b88[_0xd225('0x2c')]=_0x47243c;if(_0x1736a8[_0xd225('0x3d')][_0xd225('0x4b')]){_0x174bb1[_0xd225('0x4c')]=[{'all':!![]}];}return db[_0xd225('0x38')]['findAll'](_0x174bb1);})[_0xd225('0x1f')](function(_0x524c20){_0x142b88[_0xd225('0x4d')]=_0x524c20;return _0x142b88;})[_0xd225('0x1f')](respondWithFilteredResult(_0x1a3581,_0x174bb1))['catch'](handleError(_0x1a3581,null));};exports['show']=function(_0x4d07fa,_0x1684e7){var _0x5bba12={'raw':![],'where':{'id':_0x4d07fa['params']['id']}},_0x102ae1={};_0x102ae1[_0xd225('0x3c')]=_[_0xd225('0x3e')](db[_0xd225('0x38')][_0xd225('0x39')]);_0x102ae1['query']=_['keys'](_0x4d07fa['query']);_0x102ae1[_0xd225('0x3f')]=_[_0xd225('0x40')](_0x102ae1['model'],_0x102ae1[_0xd225('0x3d')]);_0x5bba12[_0xd225('0x41')]=_['intersection'](_0x102ae1[_0xd225('0x3c')],qs[_0xd225('0x42')](_0x4d07fa[_0xd225('0x3d')][_0xd225('0x42')]));_0x5bba12[_0xd225('0x41')]=_0x5bba12[_0xd225('0x41')][_0xd225('0x4e')]?_0x5bba12[_0xd225('0x41')]:_0x102ae1['model'];if(_0x4d07fa['query'][_0xd225('0x4b')]){_0x5bba12[_0xd225('0x4c')]=[{'all':!![]}];}_0x5bba12=_['merge']({},_0x5bba12,_0x4d07fa['options']);return db[_0xd225('0x38')][_0xd225('0x4f')](_0x5bba12)[_0xd225('0x1f')](handleEntityNotFound(_0x1684e7,null))['then'](respondWithResult(_0x1684e7,null))[_0xd225('0x50')](handleError(_0x1684e7,null));};exports[_0xd225('0x51')]=function(_0x307731,_0x478d4a){return db[_0xd225('0x38')][_0xd225('0x51')](_0x307731[_0xd225('0x52')],{})[_0xd225('0x1f')](respondWithResult(_0x478d4a,0xc9))['catch'](handleError(_0x478d4a,null));};exports[_0xd225('0x31')]=function(_0x2449ef,_0xc43530){if(_0x2449ef[_0xd225('0x52')]['id']){delete _0x2449ef['body']['id'];}return db['FreshdeskConfiguration'][_0xd225('0x4f')]({'where':{'id':_0x2449ef[_0xd225('0x53')]['id']}})[_0xd225('0x1f')](handleEntityNotFound(_0xc43530,null))['then'](saveUpdates(_0x2449ef[_0xd225('0x52')],null))[_0xd225('0x1f')](respondWithResult(_0xc43530,null))[_0xd225('0x50')](handleError(_0xc43530,null));};exports['destroy']=function(_0xab5705,_0x548611){return db[_0xd225('0x38')][_0xd225('0x4f')]({'where':{'id':_0xab5705[_0xd225('0x53')]['id']}})[_0xd225('0x1f')](handleEntityNotFound(_0x548611,null))[_0xd225('0x1f')](removeEntity(_0x548611,null))[_0xd225('0x50')](handleError(_0x548611,null));};exports[_0xd225('0x54')]=function(_0x48e640,_0x3c9575,_0x4e3243){var _0x26b23f={};var _0x447a6a={};var _0x5a223c;var _0x36043f;return db[_0xd225('0x38')][_0xd225('0x55')]({'where':{'id':_0x48e640['params']['id']}})[_0xd225('0x1f')](handleEntityNotFound(_0x3c9575,null))['then'](function(_0x1afc95){if(_0x1afc95){_0x5a223c=_0x1afc95;_0x447a6a['model']=_[_0xd225('0x3e')](db[_0xd225('0x56')]['rawAttributes']);_0x447a6a[_0xd225('0x3d')]=_['keys'](_0x48e640['query']);_0x447a6a['filters']=_[_0xd225('0x40')](_0x447a6a[_0xd225('0x3c')],_0x447a6a['query']);_0x26b23f[_0xd225('0x41')]=_[_0xd225('0x40')](_0x447a6a[_0xd225('0x3c')],qs[_0xd225('0x42')](_0x48e640[_0xd225('0x3d')][_0xd225('0x42')]));_0x26b23f[_0xd225('0x41')]=_0x26b23f[_0xd225('0x41')][_0xd225('0x4e')]?_0x26b23f[_0xd225('0x41')]:_0x447a6a['model'];_0x26b23f['order']=qs[_0xd225('0x45')](_0x48e640['query']['sort']);_0x26b23f[_0xd225('0x46')]=qs[_0xd225('0x3f')](_[_0xd225('0x57')](_0x48e640[_0xd225('0x3d')],_0x447a6a[_0xd225('0x3f')]));if(_0x48e640[_0xd225('0x3d')][_0xd225('0x49')]){_0x26b23f[_0xd225('0x46')]=_[_0xd225('0x4a')](_0x26b23f[_0xd225('0x46')],{'$or':_[_0xd225('0x37')](_0x26b23f[_0xd225('0x41')],function(_0x24f123){var _0x291fa2={};_0x291fa2[_0x24f123]={'$like':'%'+_0x48e640[_0xd225('0x3d')]['filter']+'%'};return _0x291fa2;})});}_0x26b23f=_[_0xd225('0x4a')]({},_0x26b23f,_0x48e640[_0xd225('0x58')]);return _0x5a223c[_0xd225('0x54')](_0x26b23f);}})[_0xd225('0x1f')](function(_0x3148de){if(_0x3148de){_0x36043f=_0x3148de[_0xd225('0x4e')];if(!_0x48e640[_0xd225('0x3d')]['hasOwnProperty']('nolimit')){_0x26b23f[_0xd225('0x2e')]=qs['limit'](_0x48e640[_0xd225('0x3d')][_0xd225('0x2e')]);_0x26b23f[_0xd225('0x2d')]=qs[_0xd225('0x2d')](_0x48e640[_0xd225('0x3d')]['offset']);}return _0x5a223c[_0xd225('0x54')](_0x26b23f);}})[_0xd225('0x1f')](function(_0x95124c){if(_0x95124c){return _0x95124c?{'count':_0x36043f,'rows':_0x95124c}:null;}})[_0xd225('0x1f')](respondWithResult(_0x3c9575,null))[_0xd225('0x50')](handleError(_0x3c9575,null));};exports[_0xd225('0x59')]=function(_0x304e9e,_0xfa89e9,_0x42f86c){var _0x27d2e1={};var _0x2f8315={};var _0x5beef0;var _0x347645;return db[_0xd225('0x38')]['findOne']({'where':{'id':_0x304e9e['params']['id']}})[_0xd225('0x1f')](handleEntityNotFound(_0xfa89e9,null))['then'](function(_0x3af0ba){if(_0x3af0ba){_0x5beef0=_0x3af0ba;_0x2f8315[_0xd225('0x3c')]=_[_0xd225('0x3e')](db['FreshdeskField'][_0xd225('0x39')]);_0x2f8315[_0xd225('0x3d')]=_['keys'](_0x304e9e['query']);_0x2f8315[_0xd225('0x3f')]=_['intersection'](_0x2f8315[_0xd225('0x3c')],_0x2f8315[_0xd225('0x3d')]);_0x27d2e1[_0xd225('0x41')]=_[_0xd225('0x40')](_0x2f8315['model'],qs[_0xd225('0x42')](_0x304e9e[_0xd225('0x3d')]['fields']));_0x27d2e1[_0xd225('0x41')]=_0x27d2e1[_0xd225('0x41')][_0xd225('0x4e')]?_0x27d2e1['attributes']:_0x2f8315[_0xd225('0x3c')];_0x27d2e1[_0xd225('0x44')]=qs['sort'](_0x304e9e[_0xd225('0x3d')][_0xd225('0x45')]);_0x27d2e1['where']=qs[_0xd225('0x3f')](_[_0xd225('0x57')](_0x304e9e[_0xd225('0x3d')],_0x2f8315[_0xd225('0x3f')]));if(_0x304e9e[_0xd225('0x3d')][_0xd225('0x49')]){_0x27d2e1[_0xd225('0x46')]=_['merge'](_0x27d2e1[_0xd225('0x46')],{'$or':_[_0xd225('0x37')](_0x27d2e1[_0xd225('0x41')],function(_0x51a6b2){var _0x2f1338={};_0x2f1338[_0x51a6b2]={'$like':'%'+_0x304e9e[_0xd225('0x3d')]['filter']+'%'};return _0x2f1338;})});}_0x27d2e1=_['merge']({},_0x27d2e1,_0x304e9e[_0xd225('0x58')]);return _0x5beef0['getSubjects'](_0x27d2e1);}})[_0xd225('0x1f')](function(_0x495048){if(_0x495048){_0x347645=_0x495048[_0xd225('0x4e')];if(!_0x304e9e[_0xd225('0x3d')][_0xd225('0x5a')](_0xd225('0x43'))){_0x27d2e1[_0xd225('0x2e')]=qs[_0xd225('0x2e')](_0x304e9e['query']['limit']);_0x27d2e1['offset']=qs[_0xd225('0x2d')](_0x304e9e[_0xd225('0x3d')]['offset']);}return _0x5beef0[_0xd225('0x59')](_0x27d2e1);}})[_0xd225('0x1f')](function(_0x55c2c4){if(_0x55c2c4){return _0x55c2c4?{'count':_0x347645,'rows':_0x55c2c4}:null;}})[_0xd225('0x1f')](respondWithResult(_0xfa89e9,null))[_0xd225('0x50')](handleError(_0xfa89e9,null));};exports[_0xd225('0x5b')]=function(_0x2d5446,_0x3b5395,_0x1a31d3){var _0x4b501f={};var _0x5a9f23={};var _0x427bf4;var _0x61100a;return db[_0xd225('0x38')][_0xd225('0x55')]({'where':{'id':_0x2d5446[_0xd225('0x53')]['id']}})[_0xd225('0x1f')](handleEntityNotFound(_0x3b5395,null))[_0xd225('0x1f')](function(_0x1dde19){if(_0x1dde19){_0x427bf4=_0x1dde19;_0x5a9f23[_0xd225('0x3c')]=_[_0xd225('0x3e')](db[_0xd225('0x56')][_0xd225('0x39')]);_0x5a9f23[_0xd225('0x3d')]=_[_0xd225('0x3e')](_0x2d5446[_0xd225('0x3d')]);_0x5a9f23[_0xd225('0x3f')]=_[_0xd225('0x40')](_0x5a9f23[_0xd225('0x3c')],_0x5a9f23[_0xd225('0x3d')]);_0x4b501f[_0xd225('0x41')]=_[_0xd225('0x40')](_0x5a9f23[_0xd225('0x3c')],qs[_0xd225('0x42')](_0x2d5446[_0xd225('0x3d')]['fields']));_0x4b501f[_0xd225('0x41')]=_0x4b501f[_0xd225('0x41')][_0xd225('0x4e')]?_0x4b501f[_0xd225('0x41')]:_0x5a9f23['model'];_0x4b501f[_0xd225('0x44')]=qs[_0xd225('0x45')](_0x2d5446[_0xd225('0x3d')]['sort']);_0x4b501f['where']=qs['filters'](_['pick'](_0x2d5446[_0xd225('0x3d')],_0x5a9f23[_0xd225('0x3f')]));if(_0x2d5446[_0xd225('0x3d')][_0xd225('0x49')]){_0x4b501f[_0xd225('0x46')]=_[_0xd225('0x4a')](_0x4b501f[_0xd225('0x46')],{'$or':_[_0xd225('0x37')](_0x4b501f[_0xd225('0x41')],function(_0x430ad7){var _0x235989={};_0x235989[_0x430ad7]={'$like':'%'+_0x2d5446['query'][_0xd225('0x49')]+'%'};return _0x235989;})});}_0x4b501f=_[_0xd225('0x4a')]({},_0x4b501f,_0x2d5446[_0xd225('0x58')]);return _0x427bf4['getDescriptions'](_0x4b501f);}})['then'](function(_0x24fc38){if(_0x24fc38){_0x61100a=_0x24fc38['length'];if(!_0x2d5446[_0xd225('0x3d')][_0xd225('0x5a')](_0xd225('0x43'))){_0x4b501f[_0xd225('0x2e')]=qs[_0xd225('0x2e')](_0x2d5446[_0xd225('0x3d')][_0xd225('0x2e')]);_0x4b501f[_0xd225('0x2d')]=qs[_0xd225('0x2d')](_0x2d5446[_0xd225('0x3d')][_0xd225('0x2d')]);}return _0x427bf4[_0xd225('0x5b')](_0x4b501f);}})[_0xd225('0x1f')](function(_0x53b23f){if(_0x53b23f){return _0x53b23f?{'count':_0x61100a,'rows':_0x53b23f}:null;}})[_0xd225('0x1f')](respondWithResult(_0x3b5395,null))[_0xd225('0x50')](handleError(_0x3b5395,null));};exports['getTags']=function(_0x5ad742,_0x2bd493,_0x198965){var _0x8b14c2={};var _0x200a54={};var _0x1d357e;var _0x3c3c58;return db[_0xd225('0x38')]['findOne']({'where':{'id':_0x5ad742['params']['id']}})[_0xd225('0x1f')](handleEntityNotFound(_0x2bd493,null))[_0xd225('0x1f')](function(_0x415ecd){if(_0x415ecd){_0x1d357e=_0x415ecd;_0x200a54[_0xd225('0x3c')]=_[_0xd225('0x3e')](db[_0xd225('0x5c')]['rawAttributes']);_0x200a54[_0xd225('0x3d')]=_[_0xd225('0x3e')](_0x5ad742[_0xd225('0x3d')]);_0x200a54['filters']=_[_0xd225('0x40')](_0x200a54[_0xd225('0x3c')],_0x200a54[_0xd225('0x3d')]);_0x8b14c2[_0xd225('0x41')]=_['intersection'](_0x200a54[_0xd225('0x3c')],qs[_0xd225('0x42')](_0x5ad742[_0xd225('0x3d')][_0xd225('0x42')]));_0x8b14c2[_0xd225('0x41')]=_0x8b14c2[_0xd225('0x41')]['length']?_0x8b14c2['attributes']:_0x200a54[_0xd225('0x3c')];_0x8b14c2['order']=qs['sort'](_0x5ad742[_0xd225('0x3d')][_0xd225('0x45')]);_0x8b14c2[_0xd225('0x46')]=qs[_0xd225('0x3f')](_[_0xd225('0x57')](_0x5ad742[_0xd225('0x3d')],_0x200a54['filters']));if(_0x5ad742['query'][_0xd225('0x49')]){_0x8b14c2[_0xd225('0x46')]=_[_0xd225('0x4a')](_0x8b14c2[_0xd225('0x46')],{'$or':_[_0xd225('0x37')](_0x8b14c2[_0xd225('0x41')],function(_0x4792df){var _0x4c831e={};_0x4c831e[_0x4792df]={'$like':'%'+_0x5ad742[_0xd225('0x3d')][_0xd225('0x49')]+'%'};return _0x4c831e;})});}_0x8b14c2=_[_0xd225('0x4a')]({},_0x8b14c2,_0x5ad742[_0xd225('0x58')]);return _0x1d357e[_0xd225('0x5d')](_0x8b14c2);}})[_0xd225('0x1f')](function(_0x584e78){if(_0x584e78){_0x3c3c58=_0x584e78[_0xd225('0x4e')];if(!_0x5ad742[_0xd225('0x3d')][_0xd225('0x5a')]('nolimit')){_0x8b14c2[_0xd225('0x2e')]=qs[_0xd225('0x2e')](_0x5ad742[_0xd225('0x3d')][_0xd225('0x2e')]);_0x8b14c2[_0xd225('0x2d')]=qs[_0xd225('0x2d')](_0x5ad742[_0xd225('0x3d')][_0xd225('0x2d')]);}return _0x1d357e[_0xd225('0x5d')](_0x8b14c2);}})[_0xd225('0x1f')](function(_0xf08721){if(_0xf08721){return _0xf08721?{'count':_0x3c3c58,'rows':_0xf08721}:null;}})[_0xd225('0x1f')](respondWithResult(_0x2bd493,null))[_0xd225('0x50')](handleError(_0x2bd493,null));};exports[_0xd225('0x5e')]=function(_0x2e5d6e,_0x1319a2,_0x11d3f0){if(_0x2e5d6e[_0xd225('0x52')]['id']){delete _0x2e5d6e[_0xd225('0x52')]['id'];}return db[_0xd225('0x38')][_0xd225('0x55')]({'where':{'id':_0x2e5d6e[_0xd225('0x53')]['id']}})['then'](handleEntityNotFound(_0x1319a2,null))[_0xd225('0x1f')](function(_0x49104d){if(_0x49104d){return _0x49104d[_0xd225('0x5e')](_0x2e5d6e[_0xd225('0x52')]['ids']||[]);}return null;})[_0xd225('0x1f')](respondWithResult(_0x1319a2,null))[_0xd225('0x50')](handleError(_0x1319a2,null));}; \ No newline at end of file +var _0xf112=['stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','FreshdeskConfiguration','count','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','find','create','body','findOne','FreshdeskField','sort','filters','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x532339,_0x23d0c3){var _0x4c6d6d=function(_0x1b5c22){while(--_0x1b5c22){_0x532339['push'](_0x532339['shift']());}};_0x4c6d6d(++_0x23d0c3);}(_0xf112,0x104));var _0x2f11=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0xf112[_0x2d36a6];return _0x59cec0;};'use strict';var pdf=require(_0x2f11('0x0'));var emlformat=require(_0x2f11('0x1'));var rimraf=require(_0x2f11('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f11('0x3'));var rp=require(_0x2f11('0x4'));var moment=require(_0x2f11('0x5'));var BPromise=require(_0x2f11('0x6'));var Mustache=require(_0x2f11('0x7'));var util=require(_0x2f11('0x8'));var path=require(_0x2f11('0x9'));var sox=require(_0x2f11('0xa'));var csv=require(_0x2f11('0xb'));var ejs=require(_0x2f11('0xc'));var fs=require('fs');var _=require(_0x2f11('0xd'));var squel=require(_0x2f11('0xe'));var crypto=require('crypto');var jsforce=require(_0x2f11('0xf'));var deskjs=require(_0x2f11('0x10'));var toCsv=require(_0x2f11('0xb'));var querystring=require('querystring');var Papa=require(_0x2f11('0x11'));var Redis=require(_0x2f11('0x12'));var authService=require(_0x2f11('0x13'));var qs=require(_0x2f11('0x14'));var as=require(_0x2f11('0x15'));var hardwareService=require(_0x2f11('0x16'));var logger=require('../../config/logger')(_0x2f11('0x17'));var utils=require(_0x2f11('0x18'));var config=require(_0x2f11('0x19'));var licenseUtil=require(_0x2f11('0x1a'));var db=require(_0x2f11('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2f11('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd9d0bc,_0x55b549,_0x5e8dc4,_0x4eec96){return new BPromise(function(_0x575dbe,_0x51be78){var _0x588b66=_0x4eec96||client;return _0x588b66[_0x2f11('0x1d')](_0xd9d0bc,_0x5e8dc4)[_0x2f11('0x1e')](function(_0x4366fa){logger[_0x2f11('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x55b549,'request\x20sent');logger['debug'](_0x2f11('0x20'),_0x55b549,_0x2f11('0x21'),JSON[_0x2f11('0x22')](_0x4366fa));if(_0x4366fa[_0x2f11('0x23')]){if(_0x4366fa[_0x2f11('0x23')]['code']===0x1f4){logger['error'](_0x2f11('0x24'),_0x55b549,_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);return _0x51be78(_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);}logger['error'](_0x2f11('0x24'),_0x55b549,_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);return _0x575dbe(_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);}else{logger['info'](_0x2f11('0x24'),_0x55b549,'request\x20sent');_0x575dbe(_0x4366fa[_0x2f11('0x26')][_0x2f11('0x25')]);}})['catch'](function(_0x5f2d7e){logger[_0x2f11('0x23')](_0x2f11('0x24'),_0x55b549,_0x5f2d7e);_0x51be78(_0x5f2d7e);});});}function respondWithStatusCode(_0x20241a,_0xb1c4a6){_0xb1c4a6=_0xb1c4a6||0xcc;return function(_0x485d0b){if(_0x485d0b){return _0x20241a[_0x2f11('0x27')](_0xb1c4a6);}return _0x20241a[_0x2f11('0x28')](_0xb1c4a6)[_0x2f11('0x29')]();};}function respondWithResult(_0x1250e4,_0x23ea68){_0x23ea68=_0x23ea68||0xc8;return function(_0x5748e1){if(_0x5748e1){return _0x1250e4['status'](_0x23ea68)[_0x2f11('0x2a')](_0x5748e1);}};}function respondWithFilteredResult(_0x4295c5,_0x4e4d7c){return function(_0x29fd78){if(_0x29fd78){var _0x3f0e7c=_0x29fd78['count'],_0x5b3b46=_0x4e4d7c['offset'],_0xeb51e6=_0x4e4d7c[_0x2f11('0x2b')]+_0x4e4d7c['limit'],_0x4cdea3;if(_0xeb51e6>=_0x3f0e7c){_0xeb51e6=_0x3f0e7c;_0x4cdea3=0xc8;}else{_0x4cdea3=0xce;}_0x4295c5[_0x2f11('0x28')](_0x4cdea3);return _0x4295c5[_0x2f11('0x2c')](_0x2f11('0x2d'),_0x5b3b46+'-'+_0xeb51e6+'/'+_0x3f0e7c)[_0x2f11('0x2a')](_0x29fd78);}return null;};}function patchUpdates(_0x58915f){return function(_0x4789f7){try{jsonpatch[_0x2f11('0x2e')](_0x4789f7,_0x58915f,!![]);}catch(_0x387b52){return BPromise[_0x2f11('0x2f')](_0x387b52);}return _0x4789f7[_0x2f11('0x30')]();};}function saveUpdates(_0x1fc51b,_0x5d0d3b){return function(_0x580b66){if(_0x580b66){return _0x580b66[_0x2f11('0x31')](_0x1fc51b)[_0x2f11('0x1e')](function(_0x44f6d8){return _0x44f6d8;});}return null;};}function removeEntity(_0x596596,_0x84978c){return function(_0x508f11){if(_0x508f11){return _0x508f11['destroy']()[_0x2f11('0x1e')](function(){_0x596596[_0x2f11('0x28')](0xcc)[_0x2f11('0x29')]();});}};}function handleEntityNotFound(_0x2129d7,_0x5a38b0){return function(_0x2385cd){if(!_0x2385cd){_0x2129d7['sendStatus'](0x194);}return _0x2385cd;};}function handleError(_0x1d4266,_0x369d2c){_0x369d2c=_0x369d2c||0x1f4;return function(_0x59824c){logger[_0x2f11('0x23')](_0x59824c[_0x2f11('0x32')]);if(_0x59824c[_0x2f11('0x33')]){delete _0x59824c[_0x2f11('0x33')];}_0x1d4266['status'](_0x369d2c)[_0x2f11('0x34')](_0x59824c);};}exports[_0x2f11('0x35')]=function(_0x1df4e0,_0x58fe7f){var _0x38aed3={},_0x350a2c={},_0x3f1124={'count':0x0,'rows':[]};var _0x595296=_[_0x2f11('0x36')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x29cd8a){return{'name':_0x29cd8a[_0x2f11('0x37')],'type':_0x29cd8a[_0x2f11('0x38')][_0x2f11('0x39')]};});_0x350a2c[_0x2f11('0x3a')]=_[_0x2f11('0x36')](_0x595296,'name');_0x350a2c[_0x2f11('0x3b')]=_[_0x2f11('0x3c')](_0x1df4e0['query']);_0x350a2c['filters']=_['intersection'](_0x350a2c[_0x2f11('0x3a')],_0x350a2c[_0x2f11('0x3b')]);_0x38aed3[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x350a2c[_0x2f11('0x3a')],qs['fields'](_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x38aed3[_0x2f11('0x3d')]=_0x38aed3[_0x2f11('0x3d')]['length']?_0x38aed3[_0x2f11('0x3d')]:_0x350a2c['model'];if(!_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x38aed3[_0x2f11('0x42')]=qs['limit'](_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x38aed3[_0x2f11('0x2b')]=qs[_0x2f11('0x2b')](_0x1df4e0[_0x2f11('0x3b')]['offset']);}_0x38aed3[_0x2f11('0x43')]=qs['sort'](_0x1df4e0[_0x2f11('0x3b')]['sort']);_0x38aed3[_0x2f11('0x44')]=qs['filters'](_[_0x2f11('0x45')](_0x1df4e0[_0x2f11('0x3b')],_0x350a2c['filters']),_0x595296);if(_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x46')]){_0x38aed3[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x38aed3[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x595296,function(_0xe4d6f3){if(_0xe4d6f3[_0x2f11('0x38')]!==_0x2f11('0x48')){var _0x3afdb5={};_0x3afdb5[_0xe4d6f3['name']]={'$like':'%'+_0x1df4e0[_0x2f11('0x3b')]['filter']+'%'};return _0x3afdb5;}})});}_0x38aed3=_[_0x2f11('0x47')]({},_0x38aed3,_0x1df4e0['options']);var _0x1961bb={'where':_0x38aed3[_0x2f11('0x44')]};return db[_0x2f11('0x49')][_0x2f11('0x4a')](_0x1961bb)[_0x2f11('0x1e')](function(_0x51897a){_0x3f1124['count']=_0x51897a;if(_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x4b')]){_0x38aed3['include']=[{'all':!![]}];}return db[_0x2f11('0x49')][_0x2f11('0x4c')](_0x38aed3);})[_0x2f11('0x1e')](function(_0x3a9cbc){_0x3f1124[_0x2f11('0x4d')]=_0x3a9cbc;return _0x3f1124;})[_0x2f11('0x1e')](respondWithFilteredResult(_0x58fe7f,_0x38aed3))[_0x2f11('0x4e')](handleError(_0x58fe7f,null));};exports[_0x2f11('0x4f')]=function(_0x18b78f,_0x36d517){var _0x39fbd3={'raw':![],'where':{'id':_0x18b78f[_0x2f11('0x50')]['id']}},_0x1de544={};_0x1de544[_0x2f11('0x3a')]=_[_0x2f11('0x3c')](db[_0x2f11('0x49')][_0x2f11('0x51')]);_0x1de544['query']=_[_0x2f11('0x3c')](_0x18b78f[_0x2f11('0x3b')]);_0x1de544['filters']=_[_0x2f11('0x3e')](_0x1de544['model'],_0x1de544[_0x2f11('0x3b')]);_0x39fbd3[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x1de544[_0x2f11('0x3a')],qs[_0x2f11('0x3f')](_0x18b78f[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x39fbd3[_0x2f11('0x3d')]=_0x39fbd3[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x39fbd3[_0x2f11('0x3d')]:_0x1de544['model'];if(_0x18b78f[_0x2f11('0x3b')][_0x2f11('0x4b')]){_0x39fbd3[_0x2f11('0x53')]=[{'all':!![]}];}_0x39fbd3=_[_0x2f11('0x47')]({},_0x39fbd3,_0x18b78f[_0x2f11('0x54')]);return db[_0x2f11('0x49')][_0x2f11('0x55')](_0x39fbd3)[_0x2f11('0x1e')](handleEntityNotFound(_0x36d517,null))[_0x2f11('0x1e')](respondWithResult(_0x36d517,null))[_0x2f11('0x4e')](handleError(_0x36d517,null));};exports[_0x2f11('0x56')]=function(_0x4a2396,_0x2738f3){return db['FreshdeskConfiguration'][_0x2f11('0x56')](_0x4a2396[_0x2f11('0x57')],{})[_0x2f11('0x1e')](respondWithResult(_0x2738f3,0xc9))[_0x2f11('0x4e')](handleError(_0x2738f3,null));};exports[_0x2f11('0x31')]=function(_0x580c58,_0x5de747){if(_0x580c58[_0x2f11('0x57')]['id']){delete _0x580c58[_0x2f11('0x57')]['id'];}return db[_0x2f11('0x49')][_0x2f11('0x55')]({'where':{'id':_0x580c58['params']['id']}})['then'](handleEntityNotFound(_0x5de747,null))[_0x2f11('0x1e')](saveUpdates(_0x580c58['body'],null))[_0x2f11('0x1e')](respondWithResult(_0x5de747,null))[_0x2f11('0x4e')](handleError(_0x5de747,null));};exports['destroy']=function(_0x1b8303,_0x2d13d6){return db[_0x2f11('0x49')][_0x2f11('0x55')]({'where':{'id':_0x1b8303[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x2d13d6,null))[_0x2f11('0x1e')](removeEntity(_0x2d13d6,null))[_0x2f11('0x4e')](handleError(_0x2d13d6,null));};exports['getFields']=function(_0x504959,_0x4eac35,_0x1911de){var _0x37f463={};var _0x9b609b={};var _0x4b5049;var _0x337a7c;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x504959[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x4eac35,null))[_0x2f11('0x1e')](function(_0x487cbc){if(_0x487cbc){_0x4b5049=_0x487cbc;_0x9b609b[_0x2f11('0x3a')]=_[_0x2f11('0x3c')](db[_0x2f11('0x59')][_0x2f11('0x51')]);_0x9b609b[_0x2f11('0x3b')]=_[_0x2f11('0x3c')](_0x504959[_0x2f11('0x3b')]);_0x9b609b['filters']=_[_0x2f11('0x3e')](_0x9b609b['model'],_0x9b609b['query']);_0x37f463[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x9b609b['model'],qs[_0x2f11('0x3f')](_0x504959[_0x2f11('0x3b')]['fields']));_0x37f463[_0x2f11('0x3d')]=_0x37f463[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x37f463[_0x2f11('0x3d')]:_0x9b609b[_0x2f11('0x3a')];_0x37f463['order']=qs['sort'](_0x504959['query'][_0x2f11('0x5a')]);_0x37f463[_0x2f11('0x44')]=qs[_0x2f11('0x5b')](_[_0x2f11('0x45')](_0x504959[_0x2f11('0x3b')],_0x9b609b[_0x2f11('0x5b')]));if(_0x504959[_0x2f11('0x3b')][_0x2f11('0x46')]){_0x37f463[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x37f463[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x37f463[_0x2f11('0x3d')],function(_0xd91a37){var _0x459e3c={};_0x459e3c[_0xd91a37]={'$like':'%'+_0x504959[_0x2f11('0x3b')][_0x2f11('0x46')]+'%'};return _0x459e3c;})});}_0x37f463=_[_0x2f11('0x47')]({},_0x37f463,_0x504959[_0x2f11('0x54')]);return _0x4b5049[_0x2f11('0x5c')](_0x37f463);}})[_0x2f11('0x1e')](function(_0x2ddfc2){if(_0x2ddfc2){_0x337a7c=_0x2ddfc2[_0x2f11('0x52')];if(!_0x504959[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x37f463[_0x2f11('0x42')]=qs[_0x2f11('0x42')](_0x504959[_0x2f11('0x3b')]['limit']);_0x37f463['offset']=qs[_0x2f11('0x2b')](_0x504959['query'][_0x2f11('0x2b')]);}return _0x4b5049['getFields'](_0x37f463);}})[_0x2f11('0x1e')](function(_0x59a15a){if(_0x59a15a){return _0x59a15a?{'count':_0x337a7c,'rows':_0x59a15a}:null;}})[_0x2f11('0x1e')](respondWithResult(_0x4eac35,null))['catch'](handleError(_0x4eac35,null));};exports['getSubjects']=function(_0x3dd825,_0x3ba62d,_0x55899f){var _0x5ea6ba={};var _0x5d95cc={};var _0x48648e;var _0x5eebf1;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x3dd825[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x3ba62d,null))['then'](function(_0x21386c){if(_0x21386c){_0x48648e=_0x21386c;_0x5d95cc[_0x2f11('0x3a')]=_['keys'](db[_0x2f11('0x59')][_0x2f11('0x51')]);_0x5d95cc[_0x2f11('0x3b')]=_['keys'](_0x3dd825[_0x2f11('0x3b')]);_0x5d95cc[_0x2f11('0x5b')]=_['intersection'](_0x5d95cc['model'],_0x5d95cc[_0x2f11('0x3b')]);_0x5ea6ba[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x5d95cc[_0x2f11('0x3a')],qs['fields'](_0x3dd825['query']['fields']));_0x5ea6ba[_0x2f11('0x3d')]=_0x5ea6ba[_0x2f11('0x3d')]['length']?_0x5ea6ba[_0x2f11('0x3d')]:_0x5d95cc[_0x2f11('0x3a')];_0x5ea6ba['order']=qs[_0x2f11('0x5a')](_0x3dd825['query'][_0x2f11('0x5a')]);_0x5ea6ba[_0x2f11('0x44')]=qs[_0x2f11('0x5b')](_[_0x2f11('0x45')](_0x3dd825[_0x2f11('0x3b')],_0x5d95cc['filters']));if(_0x3dd825[_0x2f11('0x3b')]['filter']){_0x5ea6ba[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x5ea6ba[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x5ea6ba[_0x2f11('0x3d')],function(_0x596152){var _0x3f60a1={};_0x3f60a1[_0x596152]={'$like':'%'+_0x3dd825['query']['filter']+'%'};return _0x3f60a1;})});}_0x5ea6ba=_[_0x2f11('0x47')]({},_0x5ea6ba,_0x3dd825[_0x2f11('0x54')]);return _0x48648e[_0x2f11('0x5d')](_0x5ea6ba);}})[_0x2f11('0x1e')](function(_0x3f64c7){if(_0x3f64c7){_0x5eebf1=_0x3f64c7[_0x2f11('0x52')];if(!_0x3dd825[_0x2f11('0x3b')][_0x2f11('0x40')]('nolimit')){_0x5ea6ba[_0x2f11('0x42')]=qs[_0x2f11('0x42')](_0x3dd825[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x5ea6ba['offset']=qs['offset'](_0x3dd825[_0x2f11('0x3b')][_0x2f11('0x2b')]);}return _0x48648e[_0x2f11('0x5d')](_0x5ea6ba);}})[_0x2f11('0x1e')](function(_0x423167){if(_0x423167){return _0x423167?{'count':_0x5eebf1,'rows':_0x423167}:null;}})[_0x2f11('0x1e')](respondWithResult(_0x3ba62d,null))[_0x2f11('0x4e')](handleError(_0x3ba62d,null));};exports['getDescriptions']=function(_0xa0cd17,_0x31bd68,_0x77a44f){var _0x3b6f07={};var _0x19d50a={};var _0x5b0a89;var _0x4a0397;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0xa0cd17['params']['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x31bd68,null))[_0x2f11('0x1e')](function(_0x5076e5){if(_0x5076e5){_0x5b0a89=_0x5076e5;_0x19d50a[_0x2f11('0x3a')]=_[_0x2f11('0x3c')](db[_0x2f11('0x59')][_0x2f11('0x51')]);_0x19d50a['query']=_[_0x2f11('0x3c')](_0xa0cd17['query']);_0x19d50a[_0x2f11('0x5b')]=_[_0x2f11('0x3e')](_0x19d50a['model'],_0x19d50a['query']);_0x3b6f07[_0x2f11('0x3d')]=_['intersection'](_0x19d50a[_0x2f11('0x3a')],qs[_0x2f11('0x3f')](_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x3b6f07[_0x2f11('0x3d')]=_0x3b6f07[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x3b6f07[_0x2f11('0x3d')]:_0x19d50a[_0x2f11('0x3a')];_0x3b6f07[_0x2f11('0x43')]=qs[_0x2f11('0x5a')](_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x5a')]);_0x3b6f07[_0x2f11('0x44')]=qs['filters'](_[_0x2f11('0x45')](_0xa0cd17['query'],_0x19d50a['filters']));if(_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x46')]){_0x3b6f07[_0x2f11('0x44')]=_['merge'](_0x3b6f07[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x3b6f07[_0x2f11('0x3d')],function(_0x467b25){var _0x414e0c={};_0x414e0c[_0x467b25]={'$like':'%'+_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x46')]+'%'};return _0x414e0c;})});}_0x3b6f07=_[_0x2f11('0x47')]({},_0x3b6f07,_0xa0cd17[_0x2f11('0x54')]);return _0x5b0a89[_0x2f11('0x5e')](_0x3b6f07);}})[_0x2f11('0x1e')](function(_0x2fce1f){if(_0x2fce1f){_0x4a0397=_0x2fce1f[_0x2f11('0x52')];if(!_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x3b6f07[_0x2f11('0x42')]=qs['limit'](_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x3b6f07['offset']=qs[_0x2f11('0x2b')](_0xa0cd17['query'][_0x2f11('0x2b')]);}return _0x5b0a89['getDescriptions'](_0x3b6f07);}})[_0x2f11('0x1e')](function(_0x46c589){if(_0x46c589){return _0x46c589?{'count':_0x4a0397,'rows':_0x46c589}:null;}})['then'](respondWithResult(_0x31bd68,null))[_0x2f11('0x4e')](handleError(_0x31bd68,null));};exports[_0x2f11('0x5f')]=function(_0x5a5f20,_0x3070e6,_0x522b7c){var _0x237fd8={};var _0x1f6ffe={};var _0x56e152;var _0x5ee177;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x5a5f20[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x3070e6,null))[_0x2f11('0x1e')](function(_0x1cd1da){if(_0x1cd1da){_0x56e152=_0x1cd1da;_0x1f6ffe[_0x2f11('0x3a')]=_['keys'](db[_0x2f11('0x60')][_0x2f11('0x51')]);_0x1f6ffe[_0x2f11('0x3b')]=_['keys'](_0x5a5f20[_0x2f11('0x3b')]);_0x1f6ffe[_0x2f11('0x5b')]=_[_0x2f11('0x3e')](_0x1f6ffe['model'],_0x1f6ffe[_0x2f11('0x3b')]);_0x237fd8[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x1f6ffe['model'],qs[_0x2f11('0x3f')](_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x237fd8[_0x2f11('0x3d')]=_0x237fd8[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x237fd8['attributes']:_0x1f6ffe[_0x2f11('0x3a')];_0x237fd8[_0x2f11('0x43')]=qs[_0x2f11('0x5a')](_0x5a5f20[_0x2f11('0x3b')]['sort']);_0x237fd8[_0x2f11('0x44')]=qs['filters'](_[_0x2f11('0x45')](_0x5a5f20[_0x2f11('0x3b')],_0x1f6ffe[_0x2f11('0x5b')]));if(_0x5a5f20['query']['filter']){_0x237fd8[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x237fd8[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x237fd8[_0x2f11('0x3d')],function(_0xeef2f7){var _0x357663={};_0x357663[_0xeef2f7]={'$like':'%'+_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x46')]+'%'};return _0x357663;})});}_0x237fd8=_[_0x2f11('0x47')]({},_0x237fd8,_0x5a5f20[_0x2f11('0x54')]);return _0x56e152[_0x2f11('0x5f')](_0x237fd8);}})[_0x2f11('0x1e')](function(_0x3d6258){if(_0x3d6258){_0x5ee177=_0x3d6258[_0x2f11('0x52')];if(!_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x237fd8[_0x2f11('0x42')]=qs[_0x2f11('0x42')](_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x237fd8['offset']=qs['offset'](_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x2b')]);}return _0x56e152[_0x2f11('0x5f')](_0x237fd8);}})[_0x2f11('0x1e')](function(_0x2df926){if(_0x2df926){return _0x2df926?{'count':_0x5ee177,'rows':_0x2df926}:null;}})[_0x2f11('0x1e')](respondWithResult(_0x3070e6,null))[_0x2f11('0x4e')](handleError(_0x3070e6,null));};exports[_0x2f11('0x61')]=function(_0x7cff20,_0x35cb6b,_0x3a26a0){if(_0x7cff20['body']['id']){delete _0x7cff20[_0x2f11('0x57')]['id'];}return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x7cff20[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x35cb6b,null))[_0x2f11('0x1e')](function(_0xc8f67e){if(_0xc8f67e){return _0xc8f67e[_0x2f11('0x61')](_0x7cff20[_0x2f11('0x57')]['ids']||[]);}return null;})[_0x2f11('0x1e')](respondWithResult(_0x35cb6b,null))[_0x2f11('0x4e')](handleError(_0x35cb6b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c404075..034b33e 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 _0xec69=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xec69,0x1c7));var _0x9ec6=function(_0x2683d4,_0x1148c2){_0x2683d4=_0x2683d4-0x0;var _0x493266=_0xec69[_0x2683d4];return _0x493266;};'use strict';var _=require(_0x9ec6('0x0'));var util=require(_0x9ec6('0x1'));var logger=require('../../config/logger')(_0x9ec6('0x2'));var moment=require(_0x9ec6('0x3'));var BPromise=require(_0x9ec6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ec6('0x5'));var rimraf=require(_0x9ec6('0x6'));var config=require(_0x9ec6('0x7'));var attributes=require(_0x9ec6('0x8'));module[_0x9ec6('0x9')]=function(_0x556e78,_0x223378){return _0x556e78[_0x9ec6('0xa')](_0x9ec6('0xb'),attributes,{'tableName':_0x9ec6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26dd=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','util'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x26dd,0xf9));var _0xd26d=function(_0x596e39,_0x2ed7a2){_0x596e39=_0x596e39-0x0;var _0x3a22a0=_0x26dd[_0x596e39];return _0x3a22a0;};'use strict';var _=require('lodash');var util=require(_0xd26d('0x0'));var logger=require(_0xd26d('0x1'))(_0xd26d('0x2'));var moment=require('moment');var BPromise=require(_0xd26d('0x3'));var rp=require(_0xd26d('0x4'));var fs=require('fs');var path=require(_0xd26d('0x5'));var rimraf=require(_0xd26d('0x6'));var config=require(_0xd26d('0x7'));var attributes=require(_0xd26d('0x8'));module[_0xd26d('0x9')]=function(_0x445eee,_0x40d124){return _0x445eee['define']('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index bef5632..624929b 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 _0x0513=['code','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc3fad4,_0x2d1141){var _0x4face7=function(_0x2096f8){while(--_0x2096f8){_0xc3fad4['push'](_0xc3fad4['shift']());}};_0x4face7(++_0x2d1141);}(_0x0513,0xf5));var _0x3051=function(_0x33b20f,_0x112bee){_0x33b20f=_0x33b20f-0x0;var _0x1724fa=_0x0513[_0x33b20f];return _0x1724fa;};'use strict';var _=require(_0x3051('0x0'));var util=require(_0x3051('0x1'));var moment=require(_0x3051('0x2'));var BPromise=require(_0x3051('0x3'));var rs=require(_0x3051('0x4'));var fs=require('fs');var Redis=require(_0x3051('0x5'));var db=require(_0x3051('0x6'))['db'];var utils=require(_0x3051('0x7'));var logger=require('../../config/logger')(_0x3051('0x8'));var config=require('../../config/environment');var jayson=require(_0x3051('0x9'));var client=jayson[_0x3051('0xa')][_0x3051('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24325e,_0x238ae4,_0x2e8532){return new BPromise(function(_0x406db9,_0x26f947){return client[_0x3051('0xc')](_0x24325e,_0x2e8532)[_0x3051('0xd')](function(_0x2320a3){logger[_0x3051('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x238ae4,_0x3051('0xf'));logger[_0x3051('0x10')](_0x3051('0x11'),_0x238ae4,'request\x20sent',JSON[_0x3051('0x12')](_0x2320a3));if(_0x2320a3['error']){if(_0x2320a3['error'][_0x3051('0x13')]===0x1f4){logger[_0x3051('0x14')](_0x3051('0x15'),_0x238ae4,_0x2320a3[_0x3051('0x14')][_0x3051('0x16')]);return _0x26f947(_0x2320a3['error'][_0x3051('0x16')]);}logger[_0x3051('0x14')](_0x3051('0x15'),_0x238ae4,_0x2320a3[_0x3051('0x14')]['message']);return _0x406db9(_0x2320a3['error'][_0x3051('0x16')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x238ae4,_0x3051('0xf'));_0x406db9(_0x2320a3[_0x3051('0x17')]['message']);}})['catch'](function(_0x286ee7){logger[_0x3051('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x238ae4,_0x286ee7);_0x26f947(_0x286ee7);});});} \ No newline at end of file +var _0x3a5c=['error','result','message','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3a5c,0x1e3));var _0xc3a5=function(_0x2a7379,_0x33cc90){_0x2a7379=_0x2a7379-0x0;var _0x438974=_0x3a5c[_0x2a7379];return _0x438974;};'use strict';var _=require(_0xc3a5('0x0'));var util=require(_0xc3a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3a5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3a5('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc3a5('0x4'));var client=jayson[_0xc3a5('0x5')][_0xc3a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2fb134,_0x59711f,_0x1aa052){return new BPromise(function(_0x1bafe1,_0x3f96d7){return client[_0xc3a5('0x7')](_0x2fb134,_0x1aa052)[_0xc3a5('0x8')](function(_0x28f90a){logger[_0xc3a5('0x9')](_0xc3a5('0xa'),_0x59711f,_0xc3a5('0xb'));logger[_0xc3a5('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x59711f,_0xc3a5('0xb'),JSON['stringify'](_0x28f90a));if(_0x28f90a[_0xc3a5('0xd')]){if(_0x28f90a[_0xc3a5('0xd')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x59711f,_0x28f90a[_0xc3a5('0xd')]['message']);return _0x3f96d7(_0x28f90a[_0xc3a5('0xd')]['message']);}logger[_0xc3a5('0xd')](_0xc3a5('0xa'),_0x59711f,_0x28f90a[_0xc3a5('0xd')]['message']);return _0x1bafe1(_0x28f90a[_0xc3a5('0xd')]['message']);}else{logger[_0xc3a5('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x59711f,_0xc3a5('0xb'));_0x1bafe1(_0x28f90a[_0xc3a5('0xe')][_0xc3a5('0xf')]);}})['catch'](function(_0x3c4a56){logger[_0xc3a5('0xd')](_0xc3a5('0xa'),_0x59711f,_0x3c4a56);_0x3f96d7(_0x3c4a56);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9441759..24215e4 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xcb91[_0xaa1b3e];return _0x454d7d;};'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 auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x34e8,0x12c));var _0x834e=function(_0xea6cbc,_0x32a7b4){_0xea6cbc=_0xea6cbc-0x0;var _0x573c9d=_0x34e8[_0xea6cbc];return _0x573c9d;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1327fb1..78b7925 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 _0x7c49=['BOOLEAN','sequelize','exports','variable','keyValue','string','ENUM','STRING'];(function(_0x25bc1e,_0x2cf8fe){var _0x215c81=function(_0x546b15){while(--_0x546b15){_0x25bc1e['push'](_0x25bc1e['shift']());}};_0x215c81(++_0x2cf8fe);}(_0x7c49,0x141));var _0x97c4=function(_0x18c618,_0x484959){_0x18c618=_0x18c618-0x0;var _0x4c1381=_0x7c49[_0x18c618];return _0x4c1381;};'use strict';var Sequelize=require(_0x97c4('0x0'));module[_0x97c4('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x97c4('0x2'),'customVariable',_0x97c4('0x3')),'defaultValue':_0x97c4('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x97c4('0x5')](_0x97c4('0x4'),_0x97c4('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x97c4('0x6')]},'idField':{'type':Sequelize[_0x97c4('0x6')]},'nameField':{'type':Sequelize[_0x97c4('0x6')]},'customField':{'type':Sequelize[_0x97c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x97c4('0x6')]}}; \ No newline at end of file +var _0x891b=['string','customVariable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x4a1bbd,_0x1d2de1){var _0x453bc0=function(_0x1b8722){while(--_0x1b8722){_0x4a1bbd['push'](_0x4a1bbd['shift']());}};_0x453bc0(++_0x1d2de1);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb891('0x0')](_0xb891('0x1'),'variable',_0xb891('0x2'),_0xb891('0x3')),'defaultValue':_0xb891('0x1')},'content':{'type':Sequelize[_0xb891('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb891('0x0')](_0xb891('0x1'),'variable',_0xb891('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb891('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb891('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index d766f91..0a35886 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 _0x2e35=['end','error','stack','name','send','index','FreshdeskField','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x2e35,0x101));var _0x52e3=function(_0x416ac7,_0x587517){_0x416ac7=_0x416ac7-0x0;var _0x5ed470=_0x2e35[_0x416ac7];return _0x5ed470;};'use strict';var pdf=require(_0x52e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x52e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52e3('0x2'));var rp=require(_0x52e3('0x3'));var moment=require(_0x52e3('0x4'));var BPromise=require(_0x52e3('0x5'));var Mustache=require('mustache');var util=require(_0x52e3('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x52e3('0x7'));var fs=require('fs');var _=require(_0x52e3('0x8'));var squel=require(_0x52e3('0x9'));var crypto=require(_0x52e3('0xa'));var jsforce=require(_0x52e3('0xb'));var deskjs=require(_0x52e3('0xc'));var toCsv=require(_0x52e3('0xd'));var querystring=require(_0x52e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x52e3('0xf'));var authService=require(_0x52e3('0x10'));var qs=require(_0x52e3('0x11'));var as=require(_0x52e3('0x12'));var hardwareService=require(_0x52e3('0x13'));var logger=require(_0x52e3('0x14'))(_0x52e3('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52e3('0x16'))['db'];function respondWithStatusCode(_0x16f46e,_0x353753){_0x353753=_0x353753||0xcc;return function(_0x5d1d5b){if(_0x5d1d5b){return _0x16f46e[_0x52e3('0x17')](_0x353753);}return _0x16f46e[_0x52e3('0x18')](_0x353753)['end']();};}function respondWithResult(_0x411cbd,_0x18f267){_0x18f267=_0x18f267||0xc8;return function(_0x50f418){if(_0x50f418){return _0x411cbd[_0x52e3('0x18')](_0x18f267)[_0x52e3('0x19')](_0x50f418);}};}function respondWithFilteredResult(_0x1629d7,_0x2db102){return function(_0x17f4a1){if(_0x17f4a1){var _0x3cf4f0=_0x17f4a1[_0x52e3('0x1a')],_0x13b320=_0x2db102['offset'],_0x3f753e=_0x2db102[_0x52e3('0x1b')]+_0x2db102[_0x52e3('0x1c')],_0x453b02;if(_0x3f753e>=_0x3cf4f0){_0x3f753e=_0x3cf4f0;_0x453b02=0xc8;}else{_0x453b02=0xce;}_0x1629d7[_0x52e3('0x18')](_0x453b02);return _0x1629d7[_0x52e3('0x1d')](_0x52e3('0x1e'),_0x13b320+'-'+_0x3f753e+'/'+_0x3cf4f0)[_0x52e3('0x19')](_0x17f4a1);}return null;};}function patchUpdates(_0x33eba3){return function(_0x3001dd){try{jsonpatch[_0x52e3('0x1f')](_0x3001dd,_0x33eba3,!![]);}catch(_0x1d15b3){return BPromise[_0x52e3('0x20')](_0x1d15b3);}return _0x3001dd['save']();};}function saveUpdates(_0x36ba74,_0x3b4aec){return function(_0x592941){if(_0x592941){return _0x592941['update'](_0x36ba74)[_0x52e3('0x21')](function(_0x3c0757){return _0x3c0757;});}return null;};}function removeEntity(_0x2fbaf7,_0x323d46){return function(_0x246343){if(_0x246343){return _0x246343[_0x52e3('0x22')]()[_0x52e3('0x21')](function(){_0x2fbaf7[_0x52e3('0x18')](0xcc)[_0x52e3('0x23')]();});}};}function handleEntityNotFound(_0x2ecbfe,_0x37ac72){return function(_0x3f5021){if(!_0x3f5021){_0x2ecbfe[_0x52e3('0x17')](0x194);}return _0x3f5021;};}function handleError(_0x3cd251,_0x101b54){_0x101b54=_0x101b54||0x1f4;return function(_0x51c5c3){logger[_0x52e3('0x24')](_0x51c5c3[_0x52e3('0x25')]);if(_0x51c5c3['name']){delete _0x51c5c3[_0x52e3('0x26')];}_0x3cd251[_0x52e3('0x18')](_0x101b54)[_0x52e3('0x27')](_0x51c5c3);};}exports[_0x52e3('0x28')]=function(_0x1fdc89,_0x2e07ef){var _0x2618ed={},_0x4b2b8a={},_0x3ca54f={'count':0x0,'rows':[]};var _0x31275a=_['map'](db[_0x52e3('0x29')]['rawAttributes'],function(_0x299c52){return{'name':_0x299c52[_0x52e3('0x2a')],'type':_0x299c52[_0x52e3('0x2b')]['key']};});_0x4b2b8a[_0x52e3('0x2c')]=_[_0x52e3('0x2d')](_0x31275a,_0x52e3('0x26'));_0x4b2b8a[_0x52e3('0x2e')]=_[_0x52e3('0x2f')](_0x1fdc89[_0x52e3('0x2e')]);_0x4b2b8a['filters']=_[_0x52e3('0x30')](_0x4b2b8a['model'],_0x4b2b8a[_0x52e3('0x2e')]);_0x2618ed[_0x52e3('0x31')]=_[_0x52e3('0x30')](_0x4b2b8a['model'],qs[_0x52e3('0x32')](_0x1fdc89['query'][_0x52e3('0x32')]));_0x2618ed[_0x52e3('0x31')]=_0x2618ed[_0x52e3('0x31')][_0x52e3('0x33')]?_0x2618ed[_0x52e3('0x31')]:_0x4b2b8a[_0x52e3('0x2c')];if(!_0x1fdc89['query'][_0x52e3('0x34')](_0x52e3('0x35'))){_0x2618ed[_0x52e3('0x1c')]=qs['limit'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x1c')]);_0x2618ed[_0x52e3('0x1b')]=qs['offset'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x1b')]);}_0x2618ed[_0x52e3('0x36')]=qs['sort'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x37')]);_0x2618ed[_0x52e3('0x38')]=qs[_0x52e3('0x39')](_['pick'](_0x1fdc89[_0x52e3('0x2e')],_0x4b2b8a['filters']),_0x31275a);if(_0x1fdc89[_0x52e3('0x2e')]['filter']){_0x2618ed['where']=_['merge'](_0x2618ed[_0x52e3('0x38')],{'$or':_['map'](_0x31275a,function(_0x249471){if(_0x249471[_0x52e3('0x2b')]!==_0x52e3('0x3a')){var _0x1f7a8a={};_0x1f7a8a[_0x249471[_0x52e3('0x26')]]={'$like':'%'+_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x3b')]+'%'};return _0x1f7a8a;}})});}_0x2618ed=_[_0x52e3('0x3c')]({},_0x2618ed,_0x1fdc89['options']);var _0x22de67={'where':_0x2618ed[_0x52e3('0x38')]};return db[_0x52e3('0x29')][_0x52e3('0x1a')](_0x22de67)['then'](function(_0x26b588){_0x3ca54f[_0x52e3('0x1a')]=_0x26b588;if(_0x1fdc89['query'][_0x52e3('0x3d')]){_0x2618ed['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x52e3('0x3e')](_0x2618ed);})['then'](function(_0x4de06f){_0x3ca54f[_0x52e3('0x3f')]=_0x4de06f;return _0x3ca54f;})[_0x52e3('0x21')](respondWithFilteredResult(_0x2e07ef,_0x2618ed))[_0x52e3('0x40')](handleError(_0x2e07ef,null));};exports[_0x52e3('0x41')]=function(_0x5a097c,_0x5792c7){var _0x1977a1={'raw':!![],'where':{'id':_0x5a097c['params']['id']}},_0x19b077={};_0x19b077[_0x52e3('0x2c')]=_[_0x52e3('0x2f')](db[_0x52e3('0x29')][_0x52e3('0x42')]);_0x19b077['query']=_[_0x52e3('0x2f')](_0x5a097c[_0x52e3('0x2e')]);_0x19b077[_0x52e3('0x39')]=_[_0x52e3('0x30')](_0x19b077[_0x52e3('0x2c')],_0x19b077[_0x52e3('0x2e')]);_0x1977a1[_0x52e3('0x31')]=_['intersection'](_0x19b077[_0x52e3('0x2c')],qs['fields'](_0x5a097c['query'][_0x52e3('0x32')]));_0x1977a1['attributes']=_0x1977a1['attributes'][_0x52e3('0x33')]?_0x1977a1[_0x52e3('0x31')]:_0x19b077['model'];if(_0x5a097c[_0x52e3('0x2e')][_0x52e3('0x3d')]){_0x1977a1[_0x52e3('0x43')]=[{'all':!![]}];}_0x1977a1=_['merge']({},_0x1977a1,_0x5a097c['options']);return db[_0x52e3('0x29')][_0x52e3('0x44')](_0x1977a1)[_0x52e3('0x21')](handleEntityNotFound(_0x5792c7,null))[_0x52e3('0x21')](respondWithResult(_0x5792c7,null))[_0x52e3('0x40')](handleError(_0x5792c7,null));};exports[_0x52e3('0x45')]=function(_0x3e591f,_0x2c6618){return db[_0x52e3('0x29')][_0x52e3('0x45')](_0x3e591f[_0x52e3('0x46')],{})[_0x52e3('0x21')](respondWithResult(_0x2c6618,0xc9))['catch'](handleError(_0x2c6618,null));};exports[_0x52e3('0x47')]=function(_0x4af63e,_0x3cf60b){if(_0x4af63e[_0x52e3('0x46')]['id']){delete _0x4af63e[_0x52e3('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4af63e[_0x52e3('0x48')]['id']}})[_0x52e3('0x21')](handleEntityNotFound(_0x3cf60b,null))[_0x52e3('0x21')](saveUpdates(_0x4af63e[_0x52e3('0x46')],null))[_0x52e3('0x21')](respondWithResult(_0x3cf60b,null))['catch'](handleError(_0x3cf60b,null));};exports[_0x52e3('0x22')]=function(_0x4f8349,_0x4f0953){return db[_0x52e3('0x29')][_0x52e3('0x44')]({'where':{'id':_0x4f8349[_0x52e3('0x48')]['id']}})[_0x52e3('0x21')](handleEntityNotFound(_0x4f0953,null))[_0x52e3('0x21')](removeEntity(_0x4f0953,null))[_0x52e3('0x40')](handleError(_0x4f0953,null));}; \ No newline at end of file +var _0x9957=['catch','show','create','body','params','destroy','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','end','error','stack','name','index','FreshdeskField','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','filter','map','merge','options','includeAll','include','findAll'];(function(_0x26e0a4,_0x41c372){var _0x209666=function(_0x36b672){while(--_0x36b672){_0x26e0a4['push'](_0x26e0a4['shift']());}};_0x209666(++_0x41c372);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x25')]();});}};}function handleEntityNotFound(_0x285437,_0x563799){return function(_0x13bc35){if(!_0x13bc35){_0x285437[_0x7995('0x1b')](0x194);}return _0x13bc35;};}function handleError(_0x472195,_0x59405a){_0x59405a=_0x59405a||0x1f4;return function(_0x39df42){logger[_0x7995('0x26')](_0x39df42[_0x7995('0x27')]);if(_0x39df42[_0x7995('0x28')]){delete _0x39df42[_0x7995('0x28')];}_0x472195[_0x7995('0x1c')](_0x59405a)['send'](_0x39df42);};}exports[_0x7995('0x29')]=function(_0x5911c3,_0x229742){var _0x49bc7e={},_0xf16cc2={},_0x132a42={'count':0x0,'rows':[]};var _0x11c1eb=_['map'](db[_0x7995('0x2a')]['rawAttributes'],function(_0x456a28){return{'name':_0x456a28[_0x7995('0x2b')],'type':_0x456a28[_0x7995('0x2c')]['key']};});_0xf16cc2['model']=_['map'](_0x11c1eb,_0x7995('0x28'));_0xf16cc2[_0x7995('0x2d')]=_[_0x7995('0x2e')](_0x5911c3[_0x7995('0x2d')]);_0xf16cc2[_0x7995('0x2f')]=_[_0x7995('0x30')](_0xf16cc2['model'],_0xf16cc2['query']);_0x49bc7e[_0x7995('0x31')]=_['intersection'](_0xf16cc2[_0x7995('0x32')],qs[_0x7995('0x33')](_0x5911c3[_0x7995('0x2d')][_0x7995('0x33')]));_0x49bc7e[_0x7995('0x31')]=_0x49bc7e['attributes'][_0x7995('0x34')]?_0x49bc7e[_0x7995('0x31')]:_0xf16cc2['model'];if(!_0x5911c3['query']['hasOwnProperty'](_0x7995('0x35'))){_0x49bc7e[_0x7995('0x20')]=qs['limit'](_0x5911c3[_0x7995('0x2d')]['limit']);_0x49bc7e[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x5911c3[_0x7995('0x2d')]['offset']);}_0x49bc7e['order']=qs[_0x7995('0x36')](_0x5911c3['query']['sort']);_0x49bc7e[_0x7995('0x37')]=qs[_0x7995('0x2f')](_['pick'](_0x5911c3[_0x7995('0x2d')],_0xf16cc2[_0x7995('0x2f')]),_0x11c1eb);if(_0x5911c3[_0x7995('0x2d')][_0x7995('0x38')]){_0x49bc7e[_0x7995('0x37')]=_['merge'](_0x49bc7e[_0x7995('0x37')],{'$or':_[_0x7995('0x39')](_0x11c1eb,function(_0xf612e6){if(_0xf612e6[_0x7995('0x2c')]!=='VIRTUAL'){var _0x2be2c0={};_0x2be2c0[_0xf612e6[_0x7995('0x28')]]={'$like':'%'+_0x5911c3[_0x7995('0x2d')][_0x7995('0x38')]+'%'};return _0x2be2c0;}})});}_0x49bc7e=_[_0x7995('0x3a')]({},_0x49bc7e,_0x5911c3[_0x7995('0x3b')]);var _0x5688a1={'where':_0x49bc7e[_0x7995('0x37')]};return db[_0x7995('0x2a')][_0x7995('0x1e')](_0x5688a1)[_0x7995('0x24')](function(_0x2e04cd){_0x132a42[_0x7995('0x1e')]=_0x2e04cd;if(_0x5911c3[_0x7995('0x2d')][_0x7995('0x3c')]){_0x49bc7e[_0x7995('0x3d')]=[{'all':!![]}];}return db[_0x7995('0x2a')][_0x7995('0x3e')](_0x49bc7e);})[_0x7995('0x24')](function(_0x7b4e67){_0x132a42['rows']=_0x7b4e67;return _0x132a42;})['then'](respondWithFilteredResult(_0x229742,_0x49bc7e))[_0x7995('0x3f')](handleError(_0x229742,null));};exports[_0x7995('0x40')]=function(_0x58523e,_0x4b0855){var _0x3f8522={'raw':!![],'where':{'id':_0x58523e['params']['id']}},_0x4a9fef={};_0x4a9fef[_0x7995('0x32')]=_[_0x7995('0x2e')](db[_0x7995('0x2a')]['rawAttributes']);_0x4a9fef[_0x7995('0x2d')]=_['keys'](_0x58523e[_0x7995('0x2d')]);_0x4a9fef['filters']=_['intersection'](_0x4a9fef[_0x7995('0x32')],_0x4a9fef[_0x7995('0x2d')]);_0x3f8522[_0x7995('0x31')]=_[_0x7995('0x30')](_0x4a9fef['model'],qs[_0x7995('0x33')](_0x58523e[_0x7995('0x2d')][_0x7995('0x33')]));_0x3f8522[_0x7995('0x31')]=_0x3f8522['attributes']['length']?_0x3f8522[_0x7995('0x31')]:_0x4a9fef['model'];if(_0x58523e[_0x7995('0x2d')]['includeAll']){_0x3f8522[_0x7995('0x3d')]=[{'all':!![]}];}_0x3f8522=_['merge']({},_0x3f8522,_0x58523e[_0x7995('0x3b')]);return db[_0x7995('0x2a')]['find'](_0x3f8522)[_0x7995('0x24')](handleEntityNotFound(_0x4b0855,null))[_0x7995('0x24')](respondWithResult(_0x4b0855,null))[_0x7995('0x3f')](handleError(_0x4b0855,null));};exports[_0x7995('0x41')]=function(_0x4c6837,_0x2458cb){return db[_0x7995('0x2a')][_0x7995('0x41')](_0x4c6837['body'],{})[_0x7995('0x24')](respondWithResult(_0x2458cb,0xc9))[_0x7995('0x3f')](handleError(_0x2458cb,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x42')]['id'];}return db[_0x7995('0x2a')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x43')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x42')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x3f')](handleError(_0x255313,null));};exports[_0x7995('0x44')]=function(_0x14b537,_0x1579b9){return db['FreshdeskField'][_0x7995('0x45')]({'where':{'id':_0x14b537[_0x7995('0x43')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x3f')](handleError(_0x1579b9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a8b3de8..64fca69 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 _0x3017=['define','FreshdeskField','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3017,0xab));var _0x7301=function(_0x5d3ce6,_0x354199){_0x5d3ce6=_0x5d3ce6-0x0;var _0x193b32=_0x3017[_0x5d3ce6];return _0x193b32;};'use strict';var _=require('lodash');var util=require(_0x7301('0x0'));var logger=require(_0x7301('0x1'))(_0x7301('0x2'));var moment=require(_0x7301('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7301('0x4'));var rimraf=require(_0x7301('0x5'));var config=require(_0x7301('0x6'));var attributes=require(_0x7301('0x7'));module[_0x7301('0x8')]=function(_0x4659bb,_0x5a8f5d){return _0x4659bb[_0x7301('0x9')](_0x7301('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x7301('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf619=['bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment'];(function(_0x308dfd,_0x287b83){var _0x35415e=function(_0x40ffc0){while(--_0x40ffc0){_0x308dfd['push'](_0x308dfd['shift']());}};_0x35415e(++_0x287b83);}(_0xf619,0x1dd));var _0x9f61=function(_0x24e9b6,_0xd553e9){_0x24e9b6=_0x24e9b6-0x0;var _0x1ac494=_0xf619[_0x24e9b6];return _0x1ac494;};'use strict';var _=require('lodash');var util=require(_0x9f61('0x0'));var logger=require(_0x9f61('0x1'))('api');var moment=require(_0x9f61('0x2'));var BPromise=require(_0x9f61('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f61('0x4'));var config=require(_0x9f61('0x5'));var attributes=require(_0x9f61('0x6'));module['exports']=function(_0x56f262,_0x2536c0){return _0x56f262[_0x9f61('0x7')]('FreshdeskField',attributes,{'tableName':_0x9f61('0x8'),'paranoid':![],'indexes':[{'name':_0x9f61('0x9'),'fields':[_0x9f61('0xa'),_0x9f61('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 e14dba9..bebafca 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 _0x7a54=['info','FreshdeskField,\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(_0x398a31,_0x4500ca){_0x398a31=_0x398a31-0x0;var _0x39bcd9=_0x7a54[_0x398a31];return _0x39bcd9;};'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')]('FreshdeskField,\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 _0x7a54=['info','FreshdeskField,\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(_0x449a09,_0x433122){_0x449a09=_0x449a09-0x0;var _0x554744=_0x7a54[_0x449a09];return _0x554744;};'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')]('FreshdeskField,\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/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index cc201a5..b2d741a 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 _0x9747=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x4f5320,_0x52303a){var _0x883ab7=function(_0x2bcc67){while(--_0x2bcc67){_0x4f5320['push'](_0x4f5320['shift']());}};_0x883ab7(++_0x52303a);}(_0x9747,0x15a));var _0x7974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9747[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x7974('0x0'));var path=require(_0x7974('0x1'));var timeout=require(_0x7974('0x2'));var express=require(_0x7974('0x3'));var router=express[_0x7974('0x4')]();var auth=require(_0x7974('0x5'));var interaction=require(_0x7974('0x6'));var config=require(_0x7974('0x7'));var controller=require(_0x7974('0x8'));router[_0x7974('0x9')]('/',auth[_0x7974('0xa')](),controller[_0x7974('0xb')]);router['get'](_0x7974('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7974('0x9')](_0x7974('0xd'),auth['isAuthenticated'](),controller[_0x7974('0xe')]);router[_0x7974('0x9')](_0x7974('0xf'),auth[_0x7974('0xa')](),controller[_0x7974('0x10')]);router[_0x7974('0x11')]('/',auth[_0x7974('0xa')](),controller[_0x7974('0x12')]);router[_0x7974('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7974('0x13')]);router[_0x7974('0x14')](_0x7974('0xc'),auth['isAuthenticated'](),controller[_0x7974('0x15')]);router[_0x7974('0x16')](_0x7974('0xc'),auth[_0x7974('0xa')](),controller['destroy']);module[_0x7974('0x17')]=router; \ No newline at end of file +var _0xa322=['getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','express','Router','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xdc3756,_0x12752e){var _0x3047ec=function(_0x1e8ab7){while(--_0x1e8ab7){_0xdc3756['push'](_0xdc3756['shift']());}};_0x3047ec(++_0x12752e);}(_0xa322,0xd0));var _0x2a32=function(_0x1b9ea2,_0x2f9094){_0x1b9ea2=_0x1b9ea2-0x0;var _0x5ac90f=_0xa322[_0x1b9ea2];return _0x5ac90f;};'use strict';var multer=require(_0x2a32('0x0'));var util=require(_0x2a32('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2a32('0x2'));var router=express[_0x2a32('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a32('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0x2a32('0x5')]('/',auth[_0x2a32('0x6')](),controller['index']);router[_0x2a32('0x5')](_0x2a32('0x7'),auth['isAuthenticated'](),controller[_0x2a32('0x8')]);router[_0x2a32('0x5')](_0x2a32('0x9'),auth[_0x2a32('0x6')](),controller[_0x2a32('0xa')]);router[_0x2a32('0x5')](_0x2a32('0xb'),auth['isAuthenticated'](),controller[_0x2a32('0xc')]);router[_0x2a32('0xd')]('/',auth['isAuthenticated'](),controller[_0x2a32('0xe')]);router['post'](_0x2a32('0x9'),auth[_0x2a32('0x6')](),controller[_0x2a32('0xf')]);router[_0x2a32('0x10')](_0x2a32('0x7'),auth['isAuthenticated'](),controller[_0x2a32('0x11')]);router[_0x2a32('0x12')](_0x2a32('0x7'),auth[_0x2a32('0x6')](),controller[_0x2a32('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 39b6a6b..25f06cd 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 _0x85a7=['exports','STRING','username','remoteUri','sequelize'];(function(_0x15e4b6,_0x5d4629){var _0x7f7727=function(_0x492dc1){while(--_0x492dc1){_0x15e4b6['push'](_0x15e4b6['shift']());}};_0x7f7727(++_0x5d4629);}(_0x85a7,0x12b));var _0x785a=function(_0x56048b,_0x1ffb6a){_0x56048b=_0x56048b-0x0;var _0xab8026=_0x85a7[_0x56048b];return _0xab8026;};'use strict';var Sequelize=require(_0x785a('0x0'));module[_0x785a('0x1')]={'name':{'type':Sequelize[_0x785a('0x2')]},'description':{'type':Sequelize[_0x785a('0x2')]},'username':{'type':Sequelize[_0x785a('0x2')],'unique':_0x785a('0x3')},'apiKey':{'type':Sequelize[_0x785a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x785a('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4402=['STRING','remoteUri','sequelize','exports'];(function(_0x31d4c3,_0x5d218b){var _0x28a508=function(_0x39b56c){while(--_0x39b56c){_0x31d4c3['push'](_0x31d4c3['shift']());}};_0x28a508(++_0x5d218b);}(_0x4402,0x10a));var _0x2440=function(_0x483d2a,_0x4bffba){_0x483d2a=_0x483d2a-0x0;var _0x5ba5d5=_0x4402[_0x483d2a];return _0x5ba5d5;};'use strict';var Sequelize=require(_0x2440('0x0'));module[_0x2440('0x1')]={'name':{'type':Sequelize[_0x2440('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2440('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2440('0x2')]},'remoteUri':{'type':Sequelize[_0x2440('0x2')],'unique':_0x2440('0x3')},'serverUrl':{'type':Sequelize[_0x2440('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 3e325d5..e731f28 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 _0xb58b=['model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','FreshsalesAccount','includeAll','include','findAll','rows','show','length','find','create','params','getConfigurations','FreshsalesConfiguration','addConfiguration','body','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','findOne','username','remoteUri','apiKey','slice','substring','GET','%s%s','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','info','FreshsalesAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xb58b,0x1f1));var _0xbb58=function(_0x17adc9,_0x129be8){_0x17adc9=_0x17adc9-0x0;var _0x5edaff=_0xb58b[_0x17adc9];return _0x5edaff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb58('0x0'));var rimraf=require(_0xbb58('0x1'));var zipdir=require(_0xbb58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb58('0x3'));var moment=require(_0xbb58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb58('0x5'));var util=require('util');var path=require(_0xbb58('0x6'));var sox=require(_0xbb58('0x7'));var csv=require(_0xbb58('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x8'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbb58('0x18'));var jayson=require(_0xbb58('0x19'));var client=jayson['client'][_0xbb58('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xdc68b9,_0x14106f,_0x3b9406,_0x19ceda){return new BPromise(function(_0x58245f,_0x110944){var _0x23fd15=_0x19ceda||client;return _0x23fd15['request'](_0xdc68b9,_0x3b9406)['then'](function(_0x33c20f){logger[_0xbb58('0x1b')](_0xbb58('0x1c'),_0x14106f,'request\x20sent');logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x14106f,'request\x20sent',JSON[_0xbb58('0x1d')](_0x33c20f));if(_0x33c20f[_0xbb58('0x1e')]){if(_0x33c20f['error'][_0xbb58('0x1f')]===0x1f4){logger['error'](_0xbb58('0x1c'),_0x14106f,_0x33c20f[_0xbb58('0x1e')][_0xbb58('0x20')]);return _0x110944(_0x33c20f[_0xbb58('0x1e')][_0xbb58('0x20')]);}logger[_0xbb58('0x1e')](_0xbb58('0x1c'),_0x14106f,_0x33c20f['error'][_0xbb58('0x20')]);return _0x58245f(_0x33c20f[_0xbb58('0x1e')][_0xbb58('0x20')]);}else{logger[_0xbb58('0x1b')](_0xbb58('0x1c'),_0x14106f,_0xbb58('0x21'));_0x58245f(_0x33c20f[_0xbb58('0x22')][_0xbb58('0x20')]);}})[_0xbb58('0x23')](function(_0x4f74a0){logger[_0xbb58('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x14106f,_0x4f74a0);_0x110944(_0x4f74a0);});});}function respondWithStatusCode(_0x21964d,_0x287822){_0x287822=_0x287822||0xcc;return function(_0x152f22){if(_0x152f22){return _0x21964d[_0xbb58('0x24')](_0x287822);}return _0x21964d[_0xbb58('0x25')](_0x287822)[_0xbb58('0x26')]();};}function respondWithResult(_0x2d556a,_0x15e4c5){_0x15e4c5=_0x15e4c5||0xc8;return function(_0x4e0303){if(_0x4e0303){return _0x2d556a[_0xbb58('0x25')](_0x15e4c5)[_0xbb58('0x27')](_0x4e0303);}};}function respondWithFilteredResult(_0x1be0ae,_0x129094){return function(_0x8e9ed9){if(_0x8e9ed9){var _0x521d0c=_0x8e9ed9[_0xbb58('0x28')],_0x3608dc=_0x129094[_0xbb58('0x29')],_0x2ce7c3=_0x129094[_0xbb58('0x29')]+_0x129094[_0xbb58('0x2a')],_0x16df29;if(_0x2ce7c3>=_0x521d0c){_0x2ce7c3=_0x521d0c;_0x16df29=0xc8;}else{_0x16df29=0xce;}_0x1be0ae[_0xbb58('0x25')](_0x16df29);return _0x1be0ae[_0xbb58('0x2b')]('Content-Range',_0x3608dc+'-'+_0x2ce7c3+'/'+_0x521d0c)[_0xbb58('0x27')](_0x8e9ed9);}return null;};}function patchUpdates(_0xe46bc1){return function(_0x12b3eb){try{jsonpatch[_0xbb58('0x2c')](_0x12b3eb,_0xe46bc1,!![]);}catch(_0x3304b9){return BPromise[_0xbb58('0x2d')](_0x3304b9);}return _0x12b3eb[_0xbb58('0x2e')]();};}function saveUpdates(_0x643e0e,_0x3f8db3){return function(_0x5ac926){if(_0x5ac926){return _0x5ac926[_0xbb58('0x2f')](_0x643e0e)[_0xbb58('0x30')](function(_0x3edc34){return _0x3edc34;});}return null;};}function removeEntity(_0x3a1e46,_0xdbbe7b){return function(_0x33f931){if(_0x33f931){return _0x33f931[_0xbb58('0x31')]()[_0xbb58('0x30')](function(){_0x3a1e46[_0xbb58('0x25')](0xcc)[_0xbb58('0x26')]();});}};}function handleEntityNotFound(_0x389187,_0x34583e){return function(_0x2f5967){if(!_0x2f5967){_0x389187['sendStatus'](0x194);}return _0x2f5967;};}function handleError(_0x51b69f,_0x5a4e76){_0x5a4e76=_0x5a4e76||0x1f4;return function(_0x1def9f){logger[_0xbb58('0x1e')](_0x1def9f[_0xbb58('0x32')]);if(_0x1def9f[_0xbb58('0x33')]){delete _0x1def9f[_0xbb58('0x33')];}_0x51b69f[_0xbb58('0x25')](_0x5a4e76)[_0xbb58('0x34')](_0x1def9f);};}exports[_0xbb58('0x35')]=function(_0x5db313,_0x2fbf90){var _0x230859={},_0x4c2a5b={},_0x33ec68={'count':0x0,'rows':[]};var _0x4da3ed=_[_0xbb58('0x36')](db['FreshsalesAccount'][_0xbb58('0x37')],function(_0x36c7b4){return{'name':_0x36c7b4['fieldName'],'type':_0x36c7b4[_0xbb58('0x38')][_0xbb58('0x39')]};});_0x4c2a5b[_0xbb58('0x3a')]=_[_0xbb58('0x36')](_0x4da3ed,_0xbb58('0x33'));_0x4c2a5b[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0x5db313[_0xbb58('0x3b')]);_0x4c2a5b['filters']=_[_0xbb58('0x3d')](_0x4c2a5b[_0xbb58('0x3a')],_0x4c2a5b[_0xbb58('0x3b')]);_0x230859['attributes']=_['intersection'](_0x4c2a5b[_0xbb58('0x3a')],qs['fields'](_0x5db313[_0xbb58('0x3b')][_0xbb58('0x3e')]));_0x230859[_0xbb58('0x3f')]=_0x230859['attributes']['length']?_0x230859[_0xbb58('0x3f')]:_0x4c2a5b[_0xbb58('0x3a')];if(!_0x5db313[_0xbb58('0x3b')][_0xbb58('0x40')](_0xbb58('0x41'))){_0x230859[_0xbb58('0x2a')]=qs['limit'](_0x5db313[_0xbb58('0x3b')][_0xbb58('0x2a')]);_0x230859[_0xbb58('0x29')]=qs[_0xbb58('0x29')](_0x5db313[_0xbb58('0x3b')][_0xbb58('0x29')]);}_0x230859['order']=qs[_0xbb58('0x42')](_0x5db313['query'][_0xbb58('0x42')]);_0x230859[_0xbb58('0x43')]=qs[_0xbb58('0x44')](_[_0xbb58('0x45')](_0x5db313['query'],_0x4c2a5b[_0xbb58('0x44')]),_0x4da3ed);if(_0x5db313[_0xbb58('0x3b')][_0xbb58('0x46')]){_0x230859[_0xbb58('0x43')]=_['merge'](_0x230859[_0xbb58('0x43')],{'$or':_['map'](_0x4da3ed,function(_0x2ffd8b){if(_0x2ffd8b[_0xbb58('0x38')]!==_0xbb58('0x47')){var _0x34c460={};_0x34c460[_0x2ffd8b[_0xbb58('0x33')]]={'$like':'%'+_0x5db313[_0xbb58('0x3b')][_0xbb58('0x46')]+'%'};return _0x34c460;}})});}_0x230859=_[_0xbb58('0x48')]({},_0x230859,_0x5db313[_0xbb58('0x49')]);var _0x444906={'where':_0x230859[_0xbb58('0x43')]};return db[_0xbb58('0x4a')][_0xbb58('0x28')](_0x444906)['then'](function(_0xc690d){_0x33ec68['count']=_0xc690d;if(_0x5db313['query'][_0xbb58('0x4b')]){_0x230859[_0xbb58('0x4c')]=[{'all':!![]}];}return db[_0xbb58('0x4a')][_0xbb58('0x4d')](_0x230859);})[_0xbb58('0x30')](function(_0x2ab2b6){_0x33ec68[_0xbb58('0x4e')]=_0x2ab2b6;return _0x33ec68;})[_0xbb58('0x30')](respondWithFilteredResult(_0x2fbf90,_0x230859))[_0xbb58('0x23')](handleError(_0x2fbf90,null));};exports[_0xbb58('0x4f')]=function(_0x440fb3,_0x59a8cf){var _0x2ec9be={'raw':![],'where':{'id':_0x440fb3['params']['id']}},_0x23871d={};_0x23871d[_0xbb58('0x3a')]=_[_0xbb58('0x3c')](db[_0xbb58('0x4a')][_0xbb58('0x37')]);_0x23871d['query']=_[_0xbb58('0x3c')](_0x440fb3['query']);_0x23871d[_0xbb58('0x44')]=_[_0xbb58('0x3d')](_0x23871d[_0xbb58('0x3a')],_0x23871d['query']);_0x2ec9be[_0xbb58('0x3f')]=_[_0xbb58('0x3d')](_0x23871d['model'],qs[_0xbb58('0x3e')](_0x440fb3['query'][_0xbb58('0x3e')]));_0x2ec9be[_0xbb58('0x3f')]=_0x2ec9be[_0xbb58('0x3f')][_0xbb58('0x50')]?_0x2ec9be[_0xbb58('0x3f')]:_0x23871d[_0xbb58('0x3a')];if(_0x440fb3[_0xbb58('0x3b')]['includeAll']){_0x2ec9be[_0xbb58('0x4c')]=[{'all':!![]}];}_0x2ec9be=_[_0xbb58('0x48')]({},_0x2ec9be,_0x440fb3['options']);return db[_0xbb58('0x4a')][_0xbb58('0x51')](_0x2ec9be)['then'](handleEntityNotFound(_0x59a8cf,null))[_0xbb58('0x30')](respondWithResult(_0x59a8cf,null))[_0xbb58('0x23')](handleError(_0x59a8cf,null));};exports[_0xbb58('0x52')]=function(_0x4e21e0,_0x376569){return db[_0xbb58('0x4a')][_0xbb58('0x52')](_0x4e21e0['body'],{})[_0xbb58('0x30')](respondWithResult(_0x376569,0xc9))['catch'](handleError(_0x376569,null));};exports[_0xbb58('0x2f')]=function(_0x278c43,_0x2395b1){if(_0x278c43['body']['id']){delete _0x278c43['body']['id'];}return db[_0xbb58('0x4a')][_0xbb58('0x51')]({'where':{'id':_0x278c43[_0xbb58('0x53')]['id']}})[_0xbb58('0x30')](handleEntityNotFound(_0x2395b1,null))[_0xbb58('0x30')](saveUpdates(_0x278c43['body'],null))[_0xbb58('0x30')](respondWithResult(_0x2395b1,null))[_0xbb58('0x23')](handleError(_0x2395b1,null));};exports[_0xbb58('0x31')]=function(_0x47cd33,_0x5ad867){return db[_0xbb58('0x4a')][_0xbb58('0x51')]({'where':{'id':_0x47cd33[_0xbb58('0x53')]['id']}})[_0xbb58('0x30')](handleEntityNotFound(_0x5ad867,null))['then'](removeEntity(_0x5ad867,null))[_0xbb58('0x23')](handleError(_0x5ad867,null));};exports[_0xbb58('0x54')]=function(_0x1553d6,_0x20dcaa,_0x445517){var _0x38b1ba={};var _0x85278c={};var _0x58ced2;var _0x55d5be;return db[_0xbb58('0x4a')]['findOne']({'where':{'id':_0x1553d6[_0xbb58('0x53')]['id']}})[_0xbb58('0x30')](handleEntityNotFound(_0x20dcaa,null))[_0xbb58('0x30')](function(_0x2a6963){if(_0x2a6963){_0x58ced2=_0x2a6963;_0x85278c[_0xbb58('0x3a')]=_[_0xbb58('0x3c')](db[_0xbb58('0x55')][_0xbb58('0x37')]);_0x85278c[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0x1553d6[_0xbb58('0x3b')]);_0x85278c['filters']=_[_0xbb58('0x3d')](_0x85278c[_0xbb58('0x3a')],_0x85278c[_0xbb58('0x3b')]);_0x38b1ba['attributes']=_[_0xbb58('0x3d')](_0x85278c['model'],qs[_0xbb58('0x3e')](_0x1553d6[_0xbb58('0x3b')]['fields']));_0x38b1ba[_0xbb58('0x3f')]=_0x38b1ba[_0xbb58('0x3f')][_0xbb58('0x50')]?_0x38b1ba[_0xbb58('0x3f')]:_0x85278c[_0xbb58('0x3a')];_0x38b1ba['order']=qs['sort'](_0x1553d6[_0xbb58('0x3b')][_0xbb58('0x42')]);_0x38b1ba[_0xbb58('0x43')]=qs['filters'](_[_0xbb58('0x45')](_0x1553d6[_0xbb58('0x3b')],_0x85278c['filters']));if(_0x1553d6[_0xbb58('0x3b')][_0xbb58('0x46')]){_0x38b1ba['where']=_[_0xbb58('0x48')](_0x38b1ba[_0xbb58('0x43')],{'$or':_[_0xbb58('0x36')](_0x38b1ba[_0xbb58('0x3f')],function(_0x3cface){var _0x5ceae0={};_0x5ceae0[_0x3cface]={'$like':'%'+_0x1553d6[_0xbb58('0x3b')][_0xbb58('0x46')]+'%'};return _0x5ceae0;})});}_0x38b1ba=_[_0xbb58('0x48')]({},_0x38b1ba,_0x1553d6[_0xbb58('0x49')]);return _0x58ced2[_0xbb58('0x54')](_0x38b1ba);}})['then'](function(_0x509d57){if(_0x509d57){_0x55d5be=_0x509d57[_0xbb58('0x50')];if(!_0x1553d6['query'][_0xbb58('0x40')](_0xbb58('0x41'))){_0x38b1ba[_0xbb58('0x2a')]=qs[_0xbb58('0x2a')](_0x1553d6[_0xbb58('0x3b')][_0xbb58('0x2a')]);_0x38b1ba[_0xbb58('0x29')]=qs[_0xbb58('0x29')](_0x1553d6[_0xbb58('0x3b')][_0xbb58('0x29')]);}return _0x58ced2['getConfigurations'](_0x38b1ba);}})[_0xbb58('0x30')](function(_0x30d4c8){if(_0x30d4c8){return _0x30d4c8?{'count':_0x55d5be,'rows':_0x30d4c8}:null;}})[_0xbb58('0x30')](respondWithResult(_0x20dcaa,null))['catch'](handleError(_0x20dcaa,null));};exports[_0xbb58('0x56')]=function(_0x4bdc30,_0x5e9319,_0x1e315e){if(_0x4bdc30[_0xbb58('0x57')]['id']){delete _0x4bdc30[_0xbb58('0x57')]['id'];}return db[_0xbb58('0x4a')]['findOne']({'where':{'id':_0x4bdc30['params']['id']}})[_0xbb58('0x30')](handleEntityNotFound(_0x5e9319,null))[_0xbb58('0x30')](function(_0x4d2091){if(_0x4d2091){_0x4bdc30[_0xbb58('0x57')][_0xbb58('0x58')]=_0x4d2091['id'];_0x4bdc30[_0xbb58('0x57')][_0xbb58('0x59')]=integrations[_0xbb58('0x5a')](_0x4bdc30['body'][_0xbb58('0x5b')],_0x4bdc30['body']['type']);_0x4bdc30[_0xbb58('0x57')][_0xbb58('0x5c')]=integrations[_0xbb58('0x5d')](_0x4bdc30['body'][_0xbb58('0x5b')],_0x4bdc30[_0xbb58('0x57')][_0xbb58('0x38')]);return db[_0xbb58('0x55')]['create'](_0x4bdc30[_0xbb58('0x57')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xbb58('0x5e')],'as':_0xbb58('0x5c')}]});}return null;})[_0xbb58('0x30')](respondWithResult(_0x5e9319,null))['catch'](handleError(_0x5e9319,null));};exports['getFields']=function(_0x31def4,_0xb299d7,_0x361d0e){var _0x2627a8='';var _0x171269='';return db[_0xbb58('0x4a')][_0xbb58('0x5f')]({'where':{'id':_0x31def4[_0xbb58('0x53')]['id']},'attributes':['id',_0xbb58('0x60'),_0xbb58('0x61'),_0xbb58('0x62')]})['then'](handleEntityNotFound(_0xb299d7,null))['then'](function(_0x36e2eb){if(_0x36e2eb){_0x171269=_0x36e2eb[_0xbb58('0x60')];_0x2627a8=_0x36e2eb[_0xbb58('0x61')];var _0x54cd7d=_0x36e2eb[_0xbb58('0x61')][_0xbb58('0x63')](-0x1);if(_0x54cd7d==='/'){_0x2627a8=_0x2627a8[_0xbb58('0x64')](0x0,_0x2627a8['lastIndexOf'](_0x54cd7d));}return rp({'method':_0xbb58('0x65'),'uri':util['format'](_0xbb58('0x66'),_0x2627a8,'/api/selector/owners'),'headers':{'Authorization':_0xbb58('0x67')+_0x36e2eb[_0xbb58('0x62')]},'json':!![]});}})[_0xbb58('0x30')](function(_0x1f1b74){if(_0x1f1b74){var _0x26c15a=_0x1f1b74[_0xbb58('0x68')];var _0x4f5cbb=![];var _0x5dc707=null;for(_0x5dc707=0x0;_0x5dc707<_0x26c15a[_0xbb58('0x50')];_0x5dc707++){if(_0x26c15a[_0x5dc707][_0xbb58('0x69')]===_0x171269){_0x4f5cbb=!![];}}if(_0x4f5cbb){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xbb58('0x30')](respondWithResult(_0xb299d7,null))[_0xbb58('0x23')](function(_0x43eb15){var _0x5604d1=_0x31def4[_0xbb58('0x3b')]['test']?0x1f4:_0x43eb15[_0xbb58('0x6a')]||0x1f4;logger[_0xbb58('0x1e')](_0xbb58('0x6b'),_0xbb58('0x6c'),_0x5604d1,JSON[_0xbb58('0x1d')](_0x43eb15));delete _0x43eb15[_0xbb58('0x33')];if(_0x5604d1===0x191){_0x5604d1=0x190;}_0xb299d7[_0xbb58('0x25')](_0x5604d1)['send'](_0x31def4[_0xbb58('0x3b')][_0xbb58('0x6d')]?{'message':_0xbb58('0x6e'),'statusCode':_0x43eb15['statusCode']}:_0x43eb15);});}; \ No newline at end of file +var _0x878f=['map','FreshsalesAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','params','create','body','find','getConfigurations','FreshsalesConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','apiKey','users','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x878f,0x173));var _0xf878=function(_0x462f38,_0x2c8054){_0x462f38=_0x462f38-0x0;var _0x3e7faf=_0x878f[_0x462f38];return _0x3e7faf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require(_0xf878('0x7'));var util=require(_0xf878('0x8'));var path=require(_0xf878('0x9'));var sox=require(_0xf878('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xe'));var authService=require(_0xf878('0xf'));var qs=require(_0xf878('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x11'));var logger=require(_0xf878('0x12'))('api');var utils=require(_0xf878('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x14'));var db=require(_0xf878('0x15'))['db'];var integrations=require(_0xf878('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xf878('0x17')][_0xf878('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x39b1bb,_0x570dcc,_0xe2c2de,_0x3902f7){return new BPromise(function(_0x119e9e,_0x492260){var _0x568a3a=_0x3902f7||client;return _0x568a3a[_0xf878('0x19')](_0x39b1bb,_0xe2c2de)[_0xf878('0x1a')](function(_0x31d888){logger[_0xf878('0x1b')](_0xf878('0x1c'),_0x570dcc,_0xf878('0x1d'));logger[_0xf878('0x1e')](_0xf878('0x1f'),_0x570dcc,_0xf878('0x1d'),JSON[_0xf878('0x20')](_0x31d888));if(_0x31d888[_0xf878('0x21')]){if(_0x31d888['error'][_0xf878('0x22')]===0x1f4){logger[_0xf878('0x21')](_0xf878('0x1c'),_0x570dcc,_0x31d888[_0xf878('0x21')][_0xf878('0x23')]);return _0x492260(_0x31d888[_0xf878('0x21')][_0xf878('0x23')]);}logger['error'](_0xf878('0x1c'),_0x570dcc,_0x31d888[_0xf878('0x21')][_0xf878('0x23')]);return _0x119e9e(_0x31d888['error'][_0xf878('0x23')]);}else{logger[_0xf878('0x1b')](_0xf878('0x1c'),_0x570dcc,_0xf878('0x1d'));_0x119e9e(_0x31d888[_0xf878('0x24')][_0xf878('0x23')]);}})[_0xf878('0x25')](function(_0x466c6b){logger[_0xf878('0x21')](_0xf878('0x1c'),_0x570dcc,_0x466c6b);_0x492260(_0x466c6b);});});}function respondWithStatusCode(_0x45e61f,_0x566995){_0x566995=_0x566995||0xcc;return function(_0x2ac38b){if(_0x2ac38b){return _0x45e61f['sendStatus'](_0x566995);}return _0x45e61f[_0xf878('0x26')](_0x566995)[_0xf878('0x27')]();};}function respondWithResult(_0x35b3b4,_0x280036){_0x280036=_0x280036||0xc8;return function(_0x20449e){if(_0x20449e){return _0x35b3b4['status'](_0x280036)['json'](_0x20449e);}};}function respondWithFilteredResult(_0x59ba7b,_0x242926){return function(_0x3baba4){if(_0x3baba4){var _0x38fa87=_0x3baba4[_0xf878('0x28')],_0x5af87f=_0x242926[_0xf878('0x29')],_0xfa3e11=_0x242926[_0xf878('0x29')]+_0x242926['limit'],_0x2e2256;if(_0xfa3e11>=_0x38fa87){_0xfa3e11=_0x38fa87;_0x2e2256=0xc8;}else{_0x2e2256=0xce;}_0x59ba7b['status'](_0x2e2256);return _0x59ba7b[_0xf878('0x2a')](_0xf878('0x2b'),_0x5af87f+'-'+_0xfa3e11+'/'+_0x38fa87)['json'](_0x3baba4);}return null;};}function patchUpdates(_0x31e2e1){return function(_0x52da83){try{jsonpatch[_0xf878('0x2c')](_0x52da83,_0x31e2e1,!![]);}catch(_0x51afaf){return BPromise[_0xf878('0x2d')](_0x51afaf);}return _0x52da83['save']();};}function saveUpdates(_0x2630fb,_0x48b151){return function(_0x20f0e6){if(_0x20f0e6){return _0x20f0e6[_0xf878('0x2e')](_0x2630fb)[_0xf878('0x1a')](function(_0x1f5331){return _0x1f5331;});}return null;};}function removeEntity(_0x27c53b,_0x716782){return function(_0x5aed48){if(_0x5aed48){return _0x5aed48[_0xf878('0x2f')]()[_0xf878('0x1a')](function(){_0x27c53b[_0xf878('0x26')](0xcc)[_0xf878('0x27')]();});}};}function handleEntityNotFound(_0xd11e68,_0x487e39){return function(_0x2288cb){if(!_0x2288cb){_0xd11e68[_0xf878('0x30')](0x194);}return _0x2288cb;};}function handleError(_0x56938d,_0x2e2d93){_0x2e2d93=_0x2e2d93||0x1f4;return function(_0xd1ad51){logger[_0xf878('0x21')](_0xd1ad51[_0xf878('0x31')]);if(_0xd1ad51[_0xf878('0x32')]){delete _0xd1ad51['name'];}_0x56938d[_0xf878('0x26')](_0x2e2d93)[_0xf878('0x33')](_0xd1ad51);};}exports[_0xf878('0x34')]=function(_0x129805,_0x579c91){var _0x25f18f={},_0x5a6330={},_0x4ce1e7={'count':0x0,'rows':[]};var _0x1e1174=_[_0xf878('0x35')](db[_0xf878('0x36')][_0xf878('0x37')],function(_0x20f415){return{'name':_0x20f415['fieldName'],'type':_0x20f415[_0xf878('0x38')]['key']};});_0x5a6330[_0xf878('0x39')]=_[_0xf878('0x35')](_0x1e1174,'name');_0x5a6330[_0xf878('0x3a')]=_[_0xf878('0x3b')](_0x129805['query']);_0x5a6330[_0xf878('0x3c')]=_[_0xf878('0x3d')](_0x5a6330['model'],_0x5a6330[_0xf878('0x3a')]);_0x25f18f[_0xf878('0x3e')]=_[_0xf878('0x3d')](_0x5a6330[_0xf878('0x39')],qs[_0xf878('0x3f')](_0x129805[_0xf878('0x3a')][_0xf878('0x3f')]));_0x25f18f['attributes']=_0x25f18f[_0xf878('0x3e')][_0xf878('0x40')]?_0x25f18f['attributes']:_0x5a6330[_0xf878('0x39')];if(!_0x129805['query']['hasOwnProperty'](_0xf878('0x41'))){_0x25f18f[_0xf878('0x42')]=qs[_0xf878('0x42')](_0x129805[_0xf878('0x3a')][_0xf878('0x42')]);_0x25f18f['offset']=qs[_0xf878('0x29')](_0x129805['query'][_0xf878('0x29')]);}_0x25f18f[_0xf878('0x43')]=qs['sort'](_0x129805['query'][_0xf878('0x44')]);_0x25f18f[_0xf878('0x45')]=qs[_0xf878('0x3c')](_[_0xf878('0x46')](_0x129805[_0xf878('0x3a')],_0x5a6330[_0xf878('0x3c')]),_0x1e1174);if(_0x129805[_0xf878('0x3a')][_0xf878('0x47')]){_0x25f18f[_0xf878('0x45')]=_['merge'](_0x25f18f[_0xf878('0x45')],{'$or':_[_0xf878('0x35')](_0x1e1174,function(_0xe2c096){if(_0xe2c096[_0xf878('0x38')]!==_0xf878('0x48')){var _0x319f29={};_0x319f29[_0xe2c096['name']]={'$like':'%'+_0x129805[_0xf878('0x3a')][_0xf878('0x47')]+'%'};return _0x319f29;}})});}_0x25f18f=_[_0xf878('0x49')]({},_0x25f18f,_0x129805[_0xf878('0x4a')]);var _0xe8b571={'where':_0x25f18f['where']};return db[_0xf878('0x36')][_0xf878('0x28')](_0xe8b571)[_0xf878('0x1a')](function(_0x1ec3aa){_0x4ce1e7['count']=_0x1ec3aa;if(_0x129805[_0xf878('0x3a')][_0xf878('0x4b')]){_0x25f18f[_0xf878('0x4c')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x25f18f);})[_0xf878('0x1a')](function(_0x5bf396){_0x4ce1e7['rows']=_0x5bf396;return _0x4ce1e7;})['then'](respondWithFilteredResult(_0x579c91,_0x25f18f))[_0xf878('0x25')](handleError(_0x579c91,null));};exports['show']=function(_0x156fdb,_0x450a10){var _0x1dcb19={'raw':![],'where':{'id':_0x156fdb[_0xf878('0x4d')]['id']}},_0x1ff60b={};_0x1ff60b[_0xf878('0x39')]=_[_0xf878('0x3b')](db['FreshsalesAccount'][_0xf878('0x37')]);_0x1ff60b[_0xf878('0x3a')]=_[_0xf878('0x3b')](_0x156fdb[_0xf878('0x3a')]);_0x1ff60b[_0xf878('0x3c')]=_['intersection'](_0x1ff60b['model'],_0x1ff60b[_0xf878('0x3a')]);_0x1dcb19[_0xf878('0x3e')]=_['intersection'](_0x1ff60b[_0xf878('0x39')],qs['fields'](_0x156fdb[_0xf878('0x3a')][_0xf878('0x3f')]));_0x1dcb19[_0xf878('0x3e')]=_0x1dcb19[_0xf878('0x3e')]['length']?_0x1dcb19[_0xf878('0x3e')]:_0x1ff60b[_0xf878('0x39')];if(_0x156fdb[_0xf878('0x3a')]['includeAll']){_0x1dcb19[_0xf878('0x4c')]=[{'all':!![]}];}_0x1dcb19=_[_0xf878('0x49')]({},_0x1dcb19,_0x156fdb[_0xf878('0x4a')]);return db[_0xf878('0x36')]['find'](_0x1dcb19)[_0xf878('0x1a')](handleEntityNotFound(_0x450a10,null))[_0xf878('0x1a')](respondWithResult(_0x450a10,null))[_0xf878('0x25')](handleError(_0x450a10,null));};exports['create']=function(_0x426b6e,_0xdfa29b){return db[_0xf878('0x36')][_0xf878('0x4e')](_0x426b6e['body'],{})['then'](respondWithResult(_0xdfa29b,0xc9))['catch'](handleError(_0xdfa29b,null));};exports[_0xf878('0x2e')]=function(_0x5e2b56,_0x516345){if(_0x5e2b56['body']['id']){delete _0x5e2b56[_0xf878('0x4f')]['id'];}return db[_0xf878('0x36')]['find']({'where':{'id':_0x5e2b56[_0xf878('0x4d')]['id']}})[_0xf878('0x1a')](handleEntityNotFound(_0x516345,null))[_0xf878('0x1a')](saveUpdates(_0x5e2b56['body'],null))['then'](respondWithResult(_0x516345,null))[_0xf878('0x25')](handleError(_0x516345,null));};exports['destroy']=function(_0x203ea6,_0x25e982){return db[_0xf878('0x36')][_0xf878('0x50')]({'where':{'id':_0x203ea6[_0xf878('0x4d')]['id']}})[_0xf878('0x1a')](handleEntityNotFound(_0x25e982,null))['then'](removeEntity(_0x25e982,null))[_0xf878('0x25')](handleError(_0x25e982,null));};exports[_0xf878('0x51')]=function(_0x566c49,_0x1e0824,_0xab7e4a){var _0x192abd={};var _0x282985={};var _0x263f26;var _0x36b000;return db[_0xf878('0x36')]['findOne']({'where':{'id':_0x566c49[_0xf878('0x4d')]['id']}})[_0xf878('0x1a')](handleEntityNotFound(_0x1e0824,null))[_0xf878('0x1a')](function(_0x52b94e){if(_0x52b94e){_0x263f26=_0x52b94e;_0x282985[_0xf878('0x39')]=_['keys'](db[_0xf878('0x52')][_0xf878('0x37')]);_0x282985[_0xf878('0x3a')]=_[_0xf878('0x3b')](_0x566c49[_0xf878('0x3a')]);_0x282985[_0xf878('0x3c')]=_[_0xf878('0x3d')](_0x282985[_0xf878('0x39')],_0x282985[_0xf878('0x3a')]);_0x192abd[_0xf878('0x3e')]=_['intersection'](_0x282985['model'],qs['fields'](_0x566c49[_0xf878('0x3a')]['fields']));_0x192abd[_0xf878('0x3e')]=_0x192abd[_0xf878('0x3e')]['length']?_0x192abd['attributes']:_0x282985[_0xf878('0x39')];_0x192abd[_0xf878('0x43')]=qs[_0xf878('0x44')](_0x566c49[_0xf878('0x3a')][_0xf878('0x44')]);_0x192abd[_0xf878('0x45')]=qs[_0xf878('0x3c')](_[_0xf878('0x46')](_0x566c49[_0xf878('0x3a')],_0x282985[_0xf878('0x3c')]));if(_0x566c49[_0xf878('0x3a')][_0xf878('0x47')]){_0x192abd[_0xf878('0x45')]=_[_0xf878('0x49')](_0x192abd[_0xf878('0x45')],{'$or':_[_0xf878('0x35')](_0x192abd[_0xf878('0x3e')],function(_0x76ad7a){var _0x5c0479={};_0x5c0479[_0x76ad7a]={'$like':'%'+_0x566c49[_0xf878('0x3a')]['filter']+'%'};return _0x5c0479;})});}_0x192abd=_[_0xf878('0x49')]({},_0x192abd,_0x566c49[_0xf878('0x4a')]);return _0x263f26[_0xf878('0x51')](_0x192abd);}})[_0xf878('0x1a')](function(_0x392177){if(_0x392177){_0x36b000=_0x392177[_0xf878('0x40')];if(!_0x566c49[_0xf878('0x3a')][_0xf878('0x53')](_0xf878('0x41'))){_0x192abd['limit']=qs[_0xf878('0x42')](_0x566c49[_0xf878('0x3a')][_0xf878('0x42')]);_0x192abd[_0xf878('0x29')]=qs['offset'](_0x566c49[_0xf878('0x3a')][_0xf878('0x29')]);}return _0x263f26[_0xf878('0x51')](_0x192abd);}})[_0xf878('0x1a')](function(_0x3befe1){if(_0x3befe1){return _0x3befe1?{'count':_0x36b000,'rows':_0x3befe1}:null;}})['then'](respondWithResult(_0x1e0824,null))['catch'](handleError(_0x1e0824,null));};exports[_0xf878('0x54')]=function(_0x1b0230,_0x193f6c,_0x251613){if(_0x1b0230[_0xf878('0x4f')]['id']){delete _0x1b0230[_0xf878('0x4f')]['id'];}return db[_0xf878('0x36')][_0xf878('0x55')]({'where':{'id':_0x1b0230[_0xf878('0x4d')]['id']}})[_0xf878('0x1a')](handleEntityNotFound(_0x193f6c,null))[_0xf878('0x1a')](function(_0x147059){if(_0x147059){_0x1b0230[_0xf878('0x4f')][_0xf878('0x56')]=_0x147059['id'];_0x1b0230[_0xf878('0x4f')][_0xf878('0x57')]=integrations[_0xf878('0x58')](_0x1b0230['body'][_0xf878('0x59')],_0x1b0230[_0xf878('0x4f')][_0xf878('0x38')]);_0x1b0230[_0xf878('0x4f')][_0xf878('0x5a')]=integrations[_0xf878('0x5b')](_0x1b0230[_0xf878('0x4f')][_0xf878('0x59')],_0x1b0230[_0xf878('0x4f')]['type']);return db[_0xf878('0x52')][_0xf878('0x4e')](_0x1b0230[_0xf878('0x4f')],{'include':[{'model':db[_0xf878('0x5c')],'as':_0xf878('0x57')},{'model':db[_0xf878('0x5c')],'as':_0xf878('0x5a')}]});}return null;})['then'](respondWithResult(_0x193f6c,null))['catch'](handleError(_0x193f6c,null));};exports[_0xf878('0x5d')]=function(_0x54ecdd,_0x338e77,_0x33b243){var _0x3a1862='';var _0x122091='';return db['FreshsalesAccount'][_0xf878('0x55')]({'where':{'id':_0x54ecdd[_0xf878('0x4d')]['id']},'attributes':['id',_0xf878('0x5e'),_0xf878('0x5f'),'apiKey']})[_0xf878('0x1a')](handleEntityNotFound(_0x338e77,null))['then'](function(_0x21537f){if(_0x21537f){_0x122091=_0x21537f[_0xf878('0x5e')];_0x3a1862=_0x21537f[_0xf878('0x5f')];var _0x1d7c1f=_0x21537f[_0xf878('0x5f')]['slice'](-0x1);if(_0x1d7c1f==='/'){_0x3a1862=_0x3a1862[_0xf878('0x60')](0x0,_0x3a1862[_0xf878('0x61')](_0x1d7c1f));}return rp({'method':_0xf878('0x62'),'uri':util[_0xf878('0x63')]('%s%s',_0x3a1862,_0xf878('0x64')),'headers':{'Authorization':'Token\x20token='+_0x21537f[_0xf878('0x65')]},'json':!![]});}})[_0xf878('0x1a')](function(_0x9c9850){if(_0x9c9850){var _0x334d6f=_0x9c9850[_0xf878('0x66')];var _0x200cb5=![];var _0x2871bf=null;for(_0x2871bf=0x0;_0x2871bf<_0x334d6f[_0xf878('0x40')];_0x2871bf++){if(_0x334d6f[_0x2871bf]['email']===_0x122091){_0x200cb5=!![];}}if(_0x200cb5){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x338e77,null))[_0xf878('0x25')](function(_0x1a9af7){var _0x497b7a=_0x54ecdd['query'][_0xf878('0x67')]?0x1f4:_0x1a9af7['statusCode']||0x1f4;logger[_0xf878('0x21')](_0xf878('0x68'),_0xf878('0x5d'),_0x497b7a,JSON[_0xf878('0x20')](_0x1a9af7));delete _0x1a9af7[_0xf878('0x32')];if(_0x497b7a===0x191){_0x497b7a=0x190;}_0x338e77[_0xf878('0x26')](_0x497b7a)[_0xf878('0x33')](_0x54ecdd[_0xf878('0x3a')][_0xf878('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x1a9af7[_0xf878('0x69')]}:_0x1a9af7);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 55174be..8e7bbd5 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 _0x07a5=['util','../../config/logger','moment','request-promise','rimraf','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x3d2dd0,_0x597166){var _0x3e82fa=function(_0x4f670d){while(--_0x4f670d){_0x3d2dd0['push'](_0x3d2dd0['shift']());}};_0x3e82fa(++_0x597166);}(_0x07a5,0x96));var _0x507a=function(_0x2f8b0f,_0x2654eb){_0x2f8b0f=_0x2f8b0f-0x0;var _0x384196=_0x07a5[_0x2f8b0f];return _0x384196;};'use strict';var _=require('lodash');var util=require(_0x507a('0x0'));var logger=require(_0x507a('0x1'))('api');var moment=require(_0x507a('0x2'));var BPromise=require('bluebird');var rp=require(_0x507a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x507a('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x507a('0x5'));module[_0x507a('0x6')]=function(_0x2b5550,_0x202fbe){return _0x2b5550[_0x507a('0x7')](_0x507a('0x8'),attributes,{'tableName':_0x507a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e92=['bluebird','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','moment'];(function(_0x2419e2,_0x3b053f){var _0x3645da=function(_0x13c170){while(--_0x13c170){_0x2419e2['push'](_0x2419e2['shift']());}};_0x3645da(++_0x3b053f);}(_0x9e92,0xac));var _0x29e9=function(_0x1cf2a2,_0x2a8d54){_0x1cf2a2=_0x1cf2a2-0x0;var _0x5f1d77=_0x9e92[_0x1cf2a2];return _0x5f1d77;};'use strict';var _=require(_0x29e9('0x0'));var util=require(_0x29e9('0x1'));var logger=require(_0x29e9('0x2'))('api');var moment=require(_0x29e9('0x3'));var BPromise=require(_0x29e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29e9('0x5'));var config=require(_0x29e9('0x6'));var attributes=require(_0x29e9('0x7'));var integrations=require(_0x29e9('0x8'));module[_0x29e9('0x9')]=function(_0x2ae133,_0x4686e7){return _0x2ae133[_0x29e9('0xa')]('FreshsalesAccount',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 79928a9..c1ee321 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 _0xd08d=['../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','map','model','include','find','ShowFreshsalesAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2dcbc0,_0x55d6ed){var _0x5da570=function(_0x1b4d03){while(--_0x1b4d03){_0x2dcbc0['push'](_0x2dcbc0['shift']());}};_0x5da570(++_0x55d6ed);}(_0xd08d,0x81));var _0xdd08=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xd08d[_0x45b034];return _0x509cb0;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var moment=require(_0xdd08('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd08('0x2'));var fs=require('fs');var Redis=require(_0xdd08('0x3'));var db=require(_0xdd08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd08('0x5'))(_0xdd08('0x6'));var config=require(_0xdd08('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd08('0x8')][_0xdd08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13999f,_0x28d59c,_0x147a23){return new BPromise(function(_0x54a5a3,_0x15416b){return client[_0xdd08('0xa')](_0x13999f,_0x147a23)[_0xdd08('0xb')](function(_0x51ce97){logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));logger[_0xdd08('0xf')](_0xdd08('0x10'),_0x28d59c,_0xdd08('0xe'),JSON[_0xdd08('0x11')](_0x51ce97));if(_0x51ce97[_0xdd08('0x12')]){if(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x13')]===0x1f4){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97['error'][_0xdd08('0x14')]);return _0x15416b(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);return _0x54a5a3(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}else{logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));_0x54a5a3(_0x51ce97[_0xdd08('0x15')][_0xdd08('0x14')]);}})[_0xdd08('0x16')](function(_0x278f5e){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x278f5e);_0x15416b(_0x278f5e);});});}exports[_0xdd08('0x17')]=function(_0x212100){var _0xb658ce=this;return new Promise(function(_0x562b83,_0x549297){return db[_0xdd08('0x18')][_0xdd08('0x19')]({'raw':_0x212100[_0xdd08('0x1a')]?_0x212100['options']['raw']===undefined?!![]:![]:!![],'where':_0x212100[_0xdd08('0x1a')]?_0x212100[_0xdd08('0x1a')][_0xdd08('0x1b')]||null:null,'attributes':_0x212100['options']?_0x212100[_0xdd08('0x1a')][_0xdd08('0x1c')]||null:null,'limit':_0x212100[_0xdd08('0x1a')]?_0x212100[_0xdd08('0x1a')]['limit']||null:null,'include':_0x212100['options']?_0x212100[_0xdd08('0x1a')]['include']?_[_0xdd08('0x1d')](_0x212100[_0xdd08('0x1a')]['include'],function(_0x4b1be1){return{'model':db[_0x4b1be1[_0xdd08('0x1e')]],'as':_0x4b1be1['as'],'attributes':_0x4b1be1[_0xdd08('0x1c')],'include':_0x4b1be1['include']?_[_0xdd08('0x1d')](_0x4b1be1['include'],function(_0x1e84d6){return{'model':db[_0x1e84d6[_0xdd08('0x1e')]],'as':_0x1e84d6['as'],'attributes':_0x1e84d6['attributes'],'include':_0x1e84d6[_0xdd08('0x1f')]?_[_0xdd08('0x1d')](_0x1e84d6[_0xdd08('0x1f')],function(_0x5a8a84){return{'model':db[_0x5a8a84['model']],'as':_0x5a8a84['as'],'attributes':_0x5a8a84[_0xdd08('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdd08('0xb')](function(_0x26cbf8){logger[_0xdd08('0xc')](_0xdd08('0x17'),_0x212100);logger[_0xdd08('0xf')]('GetFreshsalesAccount',_0x212100,JSON['stringify'](_0x26cbf8));_0x562b83(_0x26cbf8);})[_0xdd08('0x16')](function(_0xbed010){logger[_0xdd08('0x12')](_0xdd08('0x17'),_0xbed010[_0xdd08('0x14')],_0x212100);_0x549297(_0xb658ce[_0xdd08('0x12')](0x1f4,_0xbed010[_0xdd08('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x283266){var _0xa57f4f=this;return new Promise(function(_0x385480,_0x4163be){return db[_0xdd08('0x18')][_0xdd08('0x20')]({'raw':_0x283266[_0xdd08('0x1a')]?_0x283266[_0xdd08('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x283266['options']?_0x283266[_0xdd08('0x1a')][_0xdd08('0x1b')]||null:null,'attributes':_0x283266[_0xdd08('0x1a')]?_0x283266['options']['attributes']||null:null,'include':_0x283266[_0xdd08('0x1a')]?_0x283266[_0xdd08('0x1a')][_0xdd08('0x1f')]?_[_0xdd08('0x1d')](_0x283266[_0xdd08('0x1a')][_0xdd08('0x1f')],function(_0x7d5fbe){return{'model':db[_0x7d5fbe['model']],'as':_0x7d5fbe['as'],'attributes':_0x7d5fbe[_0xdd08('0x1c')],'include':_0x7d5fbe[_0xdd08('0x1f')]?_[_0xdd08('0x1d')](_0x7d5fbe[_0xdd08('0x1f')],function(_0xd7c4d7){return{'model':db[_0xd7c4d7[_0xdd08('0x1e')]],'as':_0xd7c4d7['as'],'attributes':_0xd7c4d7[_0xdd08('0x1c')],'include':_0xd7c4d7['include']?_[_0xdd08('0x1d')](_0xd7c4d7['include'],function(_0x4b1a39){return{'model':db[_0x4b1a39['model']],'as':_0x4b1a39['as'],'attributes':_0x4b1a39[_0xdd08('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23fc54){logger[_0xdd08('0xc')](_0xdd08('0x21'),_0x283266);logger['debug'](_0xdd08('0x21'),_0x283266,JSON['stringify'](_0x23fc54));_0x385480(_0x23fc54);})[_0xdd08('0x16')](function(_0x50ac2b){logger[_0xdd08('0x12')](_0xdd08('0x21'),_0x50ac2b[_0xdd08('0x14')],_0x283266);_0x4163be(_0xa57f4f[_0xdd08('0x12')](0x1f4,_0x50ac2b[_0xdd08('0x14')]));});});}; \ No newline at end of file +var _0xd98a=['GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x5106b9,_0x303320){var _0x1447f7=function(_0x1a637c){while(--_0x1a637c){_0x5106b9['push'](_0x5106b9['shift']());}};_0x1447f7(++_0x303320);}(_0xd98a,0xfc));var _0xad98=function(_0x5c026c,_0xcd5950){_0x5c026c=_0x5c026c-0x0;var _0x386790=_0xd98a[_0x5c026c];return _0x386790;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad98('0x1'));var rs=require(_0xad98('0x2'));var fs=require('fs');var Redis=require(_0xad98('0x3'));var db=require(_0xad98('0x4'))['db'];var utils=require(_0xad98('0x5'));var logger=require(_0xad98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad98('0x7'));var client=jayson[_0xad98('0x8')][_0xad98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cd316,_0x2bf76c,_0x480c93){return new BPromise(function(_0x20712b,_0x34eb2d){return client['request'](_0x2cd316,_0x480c93)[_0xad98('0xa')](function(_0x5016b4){logger[_0xad98('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bf76c,'request\x20sent');logger['debug'](_0xad98('0xc'),_0x2bf76c,_0xad98('0xd'),JSON[_0xad98('0xe')](_0x5016b4));if(_0x5016b4[_0xad98('0xf')]){if(_0x5016b4['error']['code']===0x1f4){logger[_0xad98('0xf')](_0xad98('0x10'),_0x2bf76c,_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);return _0x34eb2d(_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);}logger[_0xad98('0xf')](_0xad98('0x10'),_0x2bf76c,_0x5016b4[_0xad98('0xf')]['message']);return _0x20712b(_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);}else{logger[_0xad98('0xb')](_0xad98('0x10'),_0x2bf76c,_0xad98('0xd'));_0x20712b(_0x5016b4[_0xad98('0x12')][_0xad98('0x11')]);}})[_0xad98('0x13')](function(_0x1c98e7){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x2bf76c,_0x1c98e7);_0x34eb2d(_0x1c98e7);});});}exports[_0xad98('0x14')]=function(_0x5a3d09){var _0x19d355=this;return new Promise(function(_0x1df804,_0x234682){return db[_0xad98('0x15')][_0xad98('0x16')]({'raw':_0x5a3d09[_0xad98('0x17')]?_0x5a3d09[_0xad98('0x17')][_0xad98('0x18')]===undefined?!![]:![]:!![],'where':_0x5a3d09['options']?_0x5a3d09['options'][_0xad98('0x19')]||null:null,'attributes':_0x5a3d09['options']?_0x5a3d09[_0xad98('0x17')][_0xad98('0x1a')]||null:null,'limit':_0x5a3d09[_0xad98('0x17')]?_0x5a3d09[_0xad98('0x17')][_0xad98('0x1b')]||null:null,'include':_0x5a3d09[_0xad98('0x17')]?_0x5a3d09[_0xad98('0x17')][_0xad98('0x1c')]?_[_0xad98('0x1d')](_0x5a3d09[_0xad98('0x17')][_0xad98('0x1c')],function(_0x1c8fd7){return{'model':db[_0x1c8fd7[_0xad98('0x1e')]],'as':_0x1c8fd7['as'],'attributes':_0x1c8fd7['attributes'],'include':_0x1c8fd7[_0xad98('0x1c')]?_[_0xad98('0x1d')](_0x1c8fd7[_0xad98('0x1c')],function(_0xf48fe4){return{'model':db[_0xf48fe4['model']],'as':_0xf48fe4['as'],'attributes':_0xf48fe4[_0xad98('0x1a')],'include':_0xf48fe4[_0xad98('0x1c')]?_[_0xad98('0x1d')](_0xf48fe4[_0xad98('0x1c')],function(_0x135e6d){return{'model':db[_0x135e6d[_0xad98('0x1e')]],'as':_0x135e6d['as'],'attributes':_0x135e6d[_0xad98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xad98('0xa')](function(_0x53e5fc){logger[_0xad98('0xb')](_0xad98('0x14'),_0x5a3d09);logger[_0xad98('0x1f')](_0xad98('0x14'),_0x5a3d09,JSON[_0xad98('0xe')](_0x53e5fc));_0x1df804(_0x53e5fc);})[_0xad98('0x13')](function(_0xc32be4){logger[_0xad98('0xf')]('GetFreshsalesAccount',_0xc32be4[_0xad98('0x11')],_0x5a3d09);_0x234682(_0x19d355[_0xad98('0xf')](0x1f4,_0xc32be4[_0xad98('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x5f7aa6){var _0x2d04dd=this;return new Promise(function(_0x2e0601,_0x214aef){return db['FreshsalesAccount'][_0xad98('0x20')]({'raw':_0x5f7aa6[_0xad98('0x17')]?_0x5f7aa6[_0xad98('0x17')][_0xad98('0x18')]===undefined?!![]:![]:!![],'where':_0x5f7aa6['options']?_0x5f7aa6[_0xad98('0x17')][_0xad98('0x19')]||null:null,'attributes':_0x5f7aa6[_0xad98('0x17')]?_0x5f7aa6[_0xad98('0x17')]['attributes']||null:null,'include':_0x5f7aa6[_0xad98('0x17')]?_0x5f7aa6[_0xad98('0x17')][_0xad98('0x1c')]?_['map'](_0x5f7aa6[_0xad98('0x17')][_0xad98('0x1c')],function(_0x462d99){return{'model':db[_0x462d99[_0xad98('0x1e')]],'as':_0x462d99['as'],'attributes':_0x462d99['attributes'],'include':_0x462d99[_0xad98('0x1c')]?_[_0xad98('0x1d')](_0x462d99[_0xad98('0x1c')],function(_0x540f11){return{'model':db[_0x540f11[_0xad98('0x1e')]],'as':_0x540f11['as'],'attributes':_0x540f11[_0xad98('0x1a')],'include':_0x540f11[_0xad98('0x1c')]?_['map'](_0x540f11['include'],function(_0x2da3e0){return{'model':db[_0x2da3e0['model']],'as':_0x2da3e0['as'],'attributes':_0x2da3e0['attributes']};}):[]};}):[]};}):[]:[]})[_0xad98('0xa')](function(_0x51cc76){logger['info'](_0xad98('0x21'),_0x5f7aa6);logger[_0xad98('0x1f')](_0xad98('0x21'),_0x5f7aa6,JSON[_0xad98('0xe')](_0x51cc76));_0x2e0601(_0x51cc76);})[_0xad98('0x13')](function(_0x2967d4){logger['error'](_0xad98('0x21'),_0x2967d4[_0xad98('0x11')],_0x5f7aa6);_0x214aef(_0x2d04dd[_0xad98('0xf')](0x1f4,_0x2967d4[_0xad98('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7fd4e9f..cc84d81 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 _0x6796=['/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../config/environment','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','getSubjects','getFields','post','create'];(function(_0x36a1ca,_0x4314eb){var _0x371e91=function(_0x37cec2){while(--_0x37cec2){_0x36a1ca['push'](_0x36a1ca['shift']());}};_0x371e91(++_0x4314eb);}(_0x6796,0x1f2));var _0x6679=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x6796[_0x247fa1];return _0x244f35;};'use strict';var multer=require(_0x6679('0x0'));var util=require(_0x6679('0x1'));var path=require('path');var timeout=require(_0x6679('0x2'));var express=require(_0x6679('0x3'));var router=express[_0x6679('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6679('0x5'));var controller=require(_0x6679('0x6'));router[_0x6679('0x7')]('/',auth['isAuthenticated'](),controller[_0x6679('0x8')]);router['get']('/:id',auth[_0x6679('0x9')](),controller[_0x6679('0xa')]);router['get']('/:id/subjects',auth[_0x6679('0x9')](),controller[_0x6679('0xb')]);router['get']('/:id/descriptions',auth[_0x6679('0x9')](),controller['getDescriptions']);router[_0x6679('0x7')]('/:id/fields',auth[_0x6679('0x9')](),controller[_0x6679('0xc')]);router[_0x6679('0xd')]('/',auth[_0x6679('0x9')](),controller[_0x6679('0xe')]);router['put'](_0x6679('0xf'),auth['isAuthenticated'](),controller[_0x6679('0x10')]);router[_0x6679('0x11')](_0x6679('0xf'),auth[_0x6679('0x9')](),controller['destroy']);module[_0x6679('0x12')]=router; \ No newline at end of file +var _0x8d57=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','update','delete','destroy'];(function(_0x32955c,_0x65f3c4){var _0x56f488=function(_0xde0303){while(--_0xde0303){_0x32955c['push'](_0x32955c['shift']());}};_0x56f488(++_0x65f3c4);}(_0x8d57,0x126));var _0x78d5=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x8d57[_0x27e811];return _0x1627fa;};'use strict';var multer=require('multer');var util=require(_0x78d5('0x0'));var path=require(_0x78d5('0x1'));var timeout=require(_0x78d5('0x2'));var express=require(_0x78d5('0x3'));var router=express['Router']();var auth=require(_0x78d5('0x4'));var interaction=require(_0x78d5('0x5'));var config=require(_0x78d5('0x6'));var controller=require(_0x78d5('0x7'));router['get']('/',auth[_0x78d5('0x8')](),controller['index']);router['get'](_0x78d5('0x9'),auth[_0x78d5('0x8')](),controller[_0x78d5('0xa')]);router[_0x78d5('0xb')](_0x78d5('0xc'),auth[_0x78d5('0x8')](),controller[_0x78d5('0xd')]);router[_0x78d5('0xb')](_0x78d5('0xe'),auth[_0x78d5('0x8')](),controller[_0x78d5('0xf')]);router[_0x78d5('0xb')](_0x78d5('0x10'),auth[_0x78d5('0x8')](),controller['getFields']);router[_0x78d5('0x11')]('/',auth[_0x78d5('0x8')](),controller['create']);router['put'](_0x78d5('0x9'),auth[_0x78d5('0x8')](),controller[_0x78d5('0x12')]);router[_0x78d5('0x13')](_0x78d5('0x9'),auth['isAuthenticated'](),controller[_0x78d5('0x14')]);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 47eca66..1831f1f 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 _0xf7aa=['sequelize','STRING'];(function(_0x1a97e4,_0x267ba9){var _0x306530=function(_0x4c7158){while(--_0x4c7158){_0x1a97e4['push'](_0x1a97e4['shift']());}};_0x306530(++_0x267ba9);}(_0xf7aa,0x1ea));var _0xaf7a=function(_0x85c8a1,_0x36d7fa){_0x85c8a1=_0x85c8a1-0x0;var _0x590a08=_0xf7aa[_0x85c8a1];return _0x590a08;};'use strict';var Sequelize=require(_0xaf7a('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf7a('0x1')]},'description':{'type':Sequelize[_0xaf7a('0x1')]}}; \ No newline at end of file +var _0x46cf=['exports','STRING','sequelize'];(function(_0x3f906e,_0x1c917f){var _0x53364b=function(_0x1f2aa2){while(--_0x1f2aa2){_0x3f906e['push'](_0x3f906e['shift']());}};_0x53364b(++_0x1c917f);}(_0x46cf,0x155));var _0xf46c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x46cf[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xf46c('0x0'));module[_0xf46c('0x1')]={'name':{'type':Sequelize[_0xf46c('0x2')]},'description':{'type':Sequelize[_0xf46c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 17c4bef..95f1b10 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 _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x19d625,_0x22b7e0){var _0x51fa78=function(_0x2970ca){while(--_0x2970ca){_0x19d625['push'](_0x19d625['shift']());}};_0x51fa78(++_0x22b7e0);}(_0x53ec,0x192));var _0xc53e=function(_0x5da794,_0xf1cf6){_0x5da794=_0x5da794-0x0;var _0x2517ad=_0x53ec[_0x5da794];return _0x2517ad;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');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('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file +var _0xe14b=['stringify','error','code','message','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','findAll','catch','intersection','includeAll','include','find','create','body','params','destroy','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x292c31,_0x165fda){var _0x154ec4=function(_0x3083fc){while(--_0x3083fc){_0x292c31['push'](_0x292c31['shift']());}};_0x154ec4(++_0x165fda);}(_0xe14b,0x93));var _0xbe14=function(_0x517855,_0x1d7c7a){_0x517855=_0x517855-0x0;var _0x79ff53=_0xe14b[_0x517855];return _0x79ff53;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2850cb,_0x16893f,_0xa2cf72,_0x1e4826){return new BPromise(function(_0x33fd54,_0x813399){var _0x530538=_0x1e4826||client;return _0x530538['request'](_0x2850cb,_0xa2cf72)[_0xbe14('0x19')](function(_0x3dc4a9){logger[_0xbe14('0x1a')](_0xbe14('0x1b'),_0x16893f,'request\x20sent');logger[_0xbe14('0x1c')](_0xbe14('0x1d'),_0x16893f,_0xbe14('0x1e'),JSON[_0xbe14('0x1f')](_0x3dc4a9));if(_0x3dc4a9[_0xbe14('0x20')]){if(_0x3dc4a9[_0xbe14('0x20')][_0xbe14('0x21')]===0x1f4){logger['error'](_0xbe14('0x1b'),_0x16893f,_0x3dc4a9[_0xbe14('0x20')][_0xbe14('0x22')]);return _0x813399(_0x3dc4a9[_0xbe14('0x20')][_0xbe14('0x22')]);}logger[_0xbe14('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x16893f,_0x3dc4a9[_0xbe14('0x20')][_0xbe14('0x22')]);return _0x33fd54(_0x3dc4a9[_0xbe14('0x20')][_0xbe14('0x22')]);}else{logger[_0xbe14('0x1a')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x16893f,_0xbe14('0x1e'));_0x33fd54(_0x3dc4a9['result'][_0xbe14('0x22')]);}})['catch'](function(_0x32e8eb){logger['error'](_0xbe14('0x1b'),_0x16893f,_0x32e8eb);_0x813399(_0x32e8eb);});});}function respondWithStatusCode(_0x3d3608,_0x505dbd){_0x505dbd=_0x505dbd||0xcc;return function(_0x2da350){if(_0x2da350){return _0x3d3608['sendStatus'](_0x505dbd);}return _0x3d3608[_0xbe14('0x23')](_0x505dbd)['end']();};}function respondWithResult(_0x36a21e,_0x5fa043){_0x5fa043=_0x5fa043||0xc8;return function(_0x1ee9c1){if(_0x1ee9c1){return _0x36a21e[_0xbe14('0x23')](_0x5fa043)[_0xbe14('0x24')](_0x1ee9c1);}};}function respondWithFilteredResult(_0x2703f5,_0x55d001){return function(_0x1822e0){if(_0x1822e0){var _0x1ba46a=_0x1822e0[_0xbe14('0x25')],_0x391556=_0x55d001[_0xbe14('0x26')],_0x169369=_0x55d001['offset']+_0x55d001[_0xbe14('0x27')],_0x5dd475;if(_0x169369>=_0x1ba46a){_0x169369=_0x1ba46a;_0x5dd475=0xc8;}else{_0x5dd475=0xce;}_0x2703f5[_0xbe14('0x23')](_0x5dd475);return _0x2703f5[_0xbe14('0x28')](_0xbe14('0x29'),_0x391556+'-'+_0x169369+'/'+_0x1ba46a)[_0xbe14('0x24')](_0x1822e0);}return null;};}function patchUpdates(_0x36d4b2){return function(_0x31a664){try{jsonpatch[_0xbe14('0x2a')](_0x31a664,_0x36d4b2,!![]);}catch(_0x4168c8){return BPromise[_0xbe14('0x2b')](_0x4168c8);}return _0x31a664[_0xbe14('0x2c')]();};}function saveUpdates(_0x3bf43c,_0x39dc0a){return function(_0x10ae36){if(_0x10ae36){return _0x10ae36[_0xbe14('0x2d')](_0x3bf43c)[_0xbe14('0x19')](function(_0x6ba36c){return _0x6ba36c;});}return null;};}function removeEntity(_0x2ff48e,_0x29e76a){return function(_0x14e7c4){if(_0x14e7c4){return _0x14e7c4['destroy']()[_0xbe14('0x19')](function(){_0x2ff48e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(!_0x243524){_0x46c2d1[_0xbe14('0x2e')](0x194);}return _0x243524;};}function handleError(_0x52a25c,_0x50cb09){_0x50cb09=_0x50cb09||0x1f4;return function(_0x5798c7){logger[_0xbe14('0x20')](_0x5798c7[_0xbe14('0x2f')]);if(_0x5798c7['name']){delete _0x5798c7[_0xbe14('0x30')];}_0x52a25c[_0xbe14('0x23')](_0x50cb09)[_0xbe14('0x31')](_0x5798c7);};}exports[_0xbe14('0x32')]=function(_0x29c23e,_0x5ef1e5){var _0x591a36={},_0x15a997={},_0x52b24c={'count':0x0,'rows':[]};var _0x5dd7aa=_['map'](db[_0xbe14('0x33')][_0xbe14('0x34')],function(_0x2bb45){return{'name':_0x2bb45[_0xbe14('0x35')],'type':_0x2bb45[_0xbe14('0x36')][_0xbe14('0x37')]};});_0x15a997[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x5dd7aa,_0xbe14('0x30'));_0x15a997[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x29c23e[_0xbe14('0x3a')]);_0x15a997['filters']=_['intersection'](_0x15a997[_0xbe14('0x38')],_0x15a997[_0xbe14('0x3a')]);_0x591a36[_0xbe14('0x3c')]=_['intersection'](_0x15a997[_0xbe14('0x38')],qs[_0xbe14('0x3d')](_0x29c23e[_0xbe14('0x3a')][_0xbe14('0x3d')]));_0x591a36[_0xbe14('0x3c')]=_0x591a36[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x591a36[_0xbe14('0x3c')]:_0x15a997[_0xbe14('0x38')];if(!_0x29c23e['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x591a36[_0xbe14('0x27')]=qs[_0xbe14('0x27')](_0x29c23e[_0xbe14('0x3a')][_0xbe14('0x27')]);_0x591a36['offset']=qs[_0xbe14('0x26')](_0x29c23e[_0xbe14('0x3a')][_0xbe14('0x26')]);}_0x591a36[_0xbe14('0x41')]=qs['sort'](_0x29c23e['query'][_0xbe14('0x42')]);_0x591a36[_0xbe14('0x43')]=qs[_0xbe14('0x44')](_['pick'](_0x29c23e['query'],_0x15a997[_0xbe14('0x44')]),_0x5dd7aa);if(_0x29c23e['query']['filter']){_0x591a36[_0xbe14('0x43')]=_[_0xbe14('0x45')](_0x591a36[_0xbe14('0x43')],{'$or':_['map'](_0x5dd7aa,function(_0x558525){if(_0x558525['type']!==_0xbe14('0x46')){var _0x1eccf7={};_0x1eccf7[_0x558525[_0xbe14('0x30')]]={'$like':'%'+_0x29c23e['query'][_0xbe14('0x47')]+'%'};return _0x1eccf7;}})});}_0x591a36=_[_0xbe14('0x45')]({},_0x591a36,_0x29c23e[_0xbe14('0x48')]);var _0x3ab0f6={'where':_0x591a36['where']};return db['FreshsalesConfiguration'][_0xbe14('0x25')](_0x3ab0f6)[_0xbe14('0x19')](function(_0x24559b){_0x52b24c[_0xbe14('0x25')]=_0x24559b;if(_0x29c23e[_0xbe14('0x3a')]['includeAll']){_0x591a36['include']=[{'all':!![]}];}return db[_0xbe14('0x33')][_0xbe14('0x49')](_0x591a36);})[_0xbe14('0x19')](function(_0x2a3b35){_0x52b24c['rows']=_0x2a3b35;return _0x52b24c;})[_0xbe14('0x19')](respondWithFilteredResult(_0x5ef1e5,_0x591a36))[_0xbe14('0x4a')](handleError(_0x5ef1e5,null));};exports['show']=function(_0x396e40,_0x2a35e5){var _0x2d6ee8={'raw':![],'where':{'id':_0x396e40['params']['id']}},_0x36c20c={};_0x36c20c['model']=_[_0xbe14('0x3b')](db[_0xbe14('0x33')]['rawAttributes']);_0x36c20c['query']=_[_0xbe14('0x3b')](_0x396e40[_0xbe14('0x3a')]);_0x36c20c[_0xbe14('0x44')]=_[_0xbe14('0x4b')](_0x36c20c[_0xbe14('0x38')],_0x36c20c[_0xbe14('0x3a')]);_0x2d6ee8[_0xbe14('0x3c')]=_['intersection'](_0x36c20c[_0xbe14('0x38')],qs[_0xbe14('0x3d')](_0x396e40[_0xbe14('0x3a')][_0xbe14('0x3d')]));_0x2d6ee8[_0xbe14('0x3c')]=_0x2d6ee8['attributes'][_0xbe14('0x3e')]?_0x2d6ee8[_0xbe14('0x3c')]:_0x36c20c[_0xbe14('0x38')];if(_0x396e40[_0xbe14('0x3a')][_0xbe14('0x4c')]){_0x2d6ee8[_0xbe14('0x4d')]=[{'all':!![]}];}_0x2d6ee8=_['merge']({},_0x2d6ee8,_0x396e40['options']);return db[_0xbe14('0x33')][_0xbe14('0x4e')](_0x2d6ee8)[_0xbe14('0x19')](handleEntityNotFound(_0x2a35e5,null))['then'](respondWithResult(_0x2a35e5,null))['catch'](handleError(_0x2a35e5,null));};exports[_0xbe14('0x4f')]=function(_0x134878,_0x50d78f){return db[_0xbe14('0x33')][_0xbe14('0x4f')](_0x134878['body'],{})[_0xbe14('0x19')](respondWithResult(_0x50d78f,0xc9))['catch'](handleError(_0x50d78f,null));};exports[_0xbe14('0x2d')]=function(_0x410c59,_0x12a9de){if(_0x410c59['body']['id']){delete _0x410c59[_0xbe14('0x50')]['id'];}return db[_0xbe14('0x33')]['find']({'where':{'id':_0x410c59[_0xbe14('0x51')]['id']}})[_0xbe14('0x19')](handleEntityNotFound(_0x12a9de,null))[_0xbe14('0x19')](saveUpdates(_0x410c59[_0xbe14('0x50')],null))[_0xbe14('0x19')](respondWithResult(_0x12a9de,null))['catch'](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x34cd66,_0x3b7846){return db[_0xbe14('0x33')][_0xbe14('0x4e')]({'where':{'id':_0x34cd66[_0xbe14('0x51')]['id']}})[_0xbe14('0x19')](handleEntityNotFound(_0x3b7846,null))['then'](removeEntity(_0x3b7846,null))[_0xbe14('0x4a')](handleError(_0x3b7846,null));};exports[_0xbe14('0x53')]=function(_0x941ee2,_0x1201e2,_0x246ed5){var _0x2ed3fb={};var _0xd8f78f={};var _0x32df3c;var _0x285b6e;return db[_0xbe14('0x33')][_0xbe14('0x54')]({'where':{'id':_0x941ee2['params']['id']}})['then'](handleEntityNotFound(_0x1201e2,null))['then'](function(_0x10c0bc){if(_0x10c0bc){_0x32df3c=_0x10c0bc;_0xd8f78f[_0xbe14('0x38')]=_[_0xbe14('0x3b')](db[_0xbe14('0x55')][_0xbe14('0x34')]);_0xd8f78f[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x941ee2[_0xbe14('0x3a')]);_0xd8f78f[_0xbe14('0x44')]=_[_0xbe14('0x4b')](_0xd8f78f[_0xbe14('0x38')],_0xd8f78f[_0xbe14('0x3a')]);_0x2ed3fb[_0xbe14('0x3c')]=_[_0xbe14('0x4b')](_0xd8f78f[_0xbe14('0x38')],qs[_0xbe14('0x3d')](_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x3d')]));_0x2ed3fb[_0xbe14('0x3c')]=_0x2ed3fb[_0xbe14('0x3c')]['length']?_0x2ed3fb[_0xbe14('0x3c')]:_0xd8f78f[_0xbe14('0x38')];_0x2ed3fb[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x42')]);_0x2ed3fb[_0xbe14('0x43')]=qs[_0xbe14('0x44')](_[_0xbe14('0x56')](_0x941ee2[_0xbe14('0x3a')],_0xd8f78f['filters']));if(_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x47')]){_0x2ed3fb[_0xbe14('0x43')]=_[_0xbe14('0x45')](_0x2ed3fb[_0xbe14('0x43')],{'$or':_['map'](_0x2ed3fb[_0xbe14('0x3c')],function(_0x120077){var _0x3d186b={};_0x3d186b[_0x120077]={'$like':'%'+_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x47')]+'%'};return _0x3d186b;})});}_0x2ed3fb=_['merge']({},_0x2ed3fb,_0x941ee2[_0xbe14('0x48')]);return _0x32df3c[_0xbe14('0x53')](_0x2ed3fb);}})[_0xbe14('0x19')](function(_0x29bb26){if(_0x29bb26){_0x285b6e=_0x29bb26[_0xbe14('0x3e')];if(!_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x2ed3fb['limit']=qs[_0xbe14('0x27')](_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x27')]);_0x2ed3fb[_0xbe14('0x26')]=qs[_0xbe14('0x26')](_0x941ee2[_0xbe14('0x3a')][_0xbe14('0x26')]);}return _0x32df3c['getSubjects'](_0x2ed3fb);}})['then'](function(_0x12941d){if(_0x12941d){return _0x12941d?{'count':_0x285b6e,'rows':_0x12941d}:null;}})[_0xbe14('0x19')](respondWithResult(_0x1201e2,null))[_0xbe14('0x4a')](handleError(_0x1201e2,null));};exports[_0xbe14('0x57')]=function(_0x312504,_0x28cade,_0x23a32f){var _0x43511e={};var _0x50e644={};var _0x5ca835;var _0x1007e3;return db[_0xbe14('0x33')][_0xbe14('0x54')]({'where':{'id':_0x312504['params']['id']}})[_0xbe14('0x19')](handleEntityNotFound(_0x28cade,null))[_0xbe14('0x19')](function(_0x105be0){if(_0x105be0){_0x5ca835=_0x105be0;_0x50e644[_0xbe14('0x38')]=_[_0xbe14('0x3b')](db[_0xbe14('0x55')][_0xbe14('0x34')]);_0x50e644['query']=_[_0xbe14('0x3b')](_0x312504[_0xbe14('0x3a')]);_0x50e644[_0xbe14('0x44')]=_[_0xbe14('0x4b')](_0x50e644[_0xbe14('0x38')],_0x50e644[_0xbe14('0x3a')]);_0x43511e[_0xbe14('0x3c')]=_['intersection'](_0x50e644[_0xbe14('0x38')],qs[_0xbe14('0x3d')](_0x312504[_0xbe14('0x3a')][_0xbe14('0x3d')]));_0x43511e[_0xbe14('0x3c')]=_0x43511e[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x43511e[_0xbe14('0x3c')]:_0x50e644['model'];_0x43511e[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x312504[_0xbe14('0x3a')][_0xbe14('0x42')]);_0x43511e[_0xbe14('0x43')]=qs[_0xbe14('0x44')](_['pick'](_0x312504[_0xbe14('0x3a')],_0x50e644[_0xbe14('0x44')]));if(_0x312504[_0xbe14('0x3a')][_0xbe14('0x47')]){_0x43511e['where']=_[_0xbe14('0x45')](_0x43511e[_0xbe14('0x43')],{'$or':_[_0xbe14('0x39')](_0x43511e[_0xbe14('0x3c')],function(_0x80b6ec){var _0x3d54e4={};_0x3d54e4[_0x80b6ec]={'$like':'%'+_0x312504[_0xbe14('0x3a')]['filter']+'%'};return _0x3d54e4;})});}_0x43511e=_[_0xbe14('0x45')]({},_0x43511e,_0x312504['options']);return _0x5ca835[_0xbe14('0x57')](_0x43511e);}})['then'](function(_0x389822){if(_0x389822){_0x1007e3=_0x389822[_0xbe14('0x3e')];if(!_0x312504[_0xbe14('0x3a')]['hasOwnProperty'](_0xbe14('0x40'))){_0x43511e[_0xbe14('0x27')]=qs[_0xbe14('0x27')](_0x312504['query'][_0xbe14('0x27')]);_0x43511e[_0xbe14('0x26')]=qs[_0xbe14('0x26')](_0x312504[_0xbe14('0x3a')]['offset']);}return _0x5ca835[_0xbe14('0x57')](_0x43511e);}})[_0xbe14('0x19')](function(_0x34f90b){if(_0x34f90b){return _0x34f90b?{'count':_0x1007e3,'rows':_0x34f90b}:null;}})[_0xbe14('0x19')](respondWithResult(_0x28cade,null))[_0xbe14('0x4a')](handleError(_0x28cade,null));};exports[_0xbe14('0x58')]=function(_0x2737ba,_0x5ab298,_0x2ff94c){var _0x123f4f={};var _0x2137d5={};var _0x5c89a0;var _0x704c05;return db[_0xbe14('0x33')][_0xbe14('0x54')]({'where':{'id':_0x2737ba['params']['id']}})[_0xbe14('0x19')](handleEntityNotFound(_0x5ab298,null))[_0xbe14('0x19')](function(_0x47d7bb){if(_0x47d7bb){_0x5c89a0=_0x47d7bb;_0x2137d5[_0xbe14('0x38')]=_['keys'](db[_0xbe14('0x55')][_0xbe14('0x34')]);_0x2137d5['query']=_['keys'](_0x2737ba[_0xbe14('0x3a')]);_0x2137d5[_0xbe14('0x44')]=_[_0xbe14('0x4b')](_0x2137d5['model'],_0x2137d5[_0xbe14('0x3a')]);_0x123f4f[_0xbe14('0x3c')]=_[_0xbe14('0x4b')](_0x2137d5[_0xbe14('0x38')],qs['fields'](_0x2737ba['query'][_0xbe14('0x3d')]));_0x123f4f[_0xbe14('0x3c')]=_0x123f4f[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x123f4f[_0xbe14('0x3c')]:_0x2137d5[_0xbe14('0x38')];_0x123f4f[_0xbe14('0x41')]=qs['sort'](_0x2737ba[_0xbe14('0x3a')]['sort']);_0x123f4f[_0xbe14('0x43')]=qs[_0xbe14('0x44')](_[_0xbe14('0x56')](_0x2737ba[_0xbe14('0x3a')],_0x2137d5['filters']));if(_0x2737ba[_0xbe14('0x3a')][_0xbe14('0x47')]){_0x123f4f[_0xbe14('0x43')]=_['merge'](_0x123f4f[_0xbe14('0x43')],{'$or':_[_0xbe14('0x39')](_0x123f4f[_0xbe14('0x3c')],function(_0x34a277){var _0x26d3ae={};_0x26d3ae[_0x34a277]={'$like':'%'+_0x2737ba[_0xbe14('0x3a')][_0xbe14('0x47')]+'%'};return _0x26d3ae;})});}_0x123f4f=_[_0xbe14('0x45')]({},_0x123f4f,_0x2737ba[_0xbe14('0x48')]);return _0x5c89a0[_0xbe14('0x58')](_0x123f4f);}})[_0xbe14('0x19')](function(_0x49497e){if(_0x49497e){_0x704c05=_0x49497e[_0xbe14('0x3e')];if(!_0x2737ba[_0xbe14('0x3a')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x123f4f[_0xbe14('0x27')]=qs[_0xbe14('0x27')](_0x2737ba[_0xbe14('0x3a')][_0xbe14('0x27')]);_0x123f4f['offset']=qs[_0xbe14('0x26')](_0x2737ba['query'][_0xbe14('0x26')]);}return _0x5c89a0[_0xbe14('0x58')](_0x123f4f);}})[_0xbe14('0x19')](function(_0x3329b1){if(_0x3329b1){return _0x3329b1?{'count':_0x704c05,'rows':_0x3329b1}:null;}})[_0xbe14('0x19')](respondWithResult(_0x5ab298,null))['catch'](handleError(_0x5ab298,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e49ebeb..6cbd6b1 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 _0x1455=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1455,0x97));var _0x5145=function(_0x1a0dc1,_0x3a015d){_0x1a0dc1=_0x1a0dc1-0x0;var _0x184c9a=_0x1455[_0x1a0dc1];return _0x184c9a;};'use strict';var _=require(_0x5145('0x0'));var util=require(_0x5145('0x1'));var logger=require(_0x5145('0x2'))('api');var moment=require(_0x5145('0x3'));var BPromise=require(_0x5145('0x4'));var rp=require(_0x5145('0x5'));var fs=require('fs');var path=require(_0x5145('0x6'));var rimraf=require(_0x5145('0x7'));var config=require(_0x5145('0x8'));var attributes=require(_0x5145('0x9'));module['exports']=function(_0xfc8c30,_0x1d8905){return _0xfc8c30[_0x5145('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x5145('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bc=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','bluebird'];(function(_0x17d2e9,_0x593ca3){var _0x51b87e=function(_0x3f3713){while(--_0x3f3713){_0x17d2e9['push'](_0x17d2e9['shift']());}};_0x51b87e(++_0x593ca3);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'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 4319efe..f24335b 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 _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x16d2,0x123));var _0x216d=function(_0x248c97,_0x1d9091){_0x248c97=_0x248c97-0x0;var _0x23b211=_0x16d2[_0x248c97];return _0x23b211;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});} \ No newline at end of file +var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x4fc2,0x111));var _0x24fc=function(_0x1ca9a0,_0x17be2b){_0x1ca9a0=_0x1ca9a0-0x0;var _0x4a80d6=_0x4fc2[_0x1ca9a0];return _0x4a80d6;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 227ecd2..25d9d7f 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 _0x5e26=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x8cf0e4,_0x370d0e){var _0xd3f21d=function(_0x2a1b53){while(--_0x2a1b53){_0x8cf0e4['push'](_0x8cf0e4['shift']());}};_0xd3f21d(++_0x370d0e);}(_0x5e26,0xb7));var _0x65e2=function(_0x3c30a4,_0x152fd6){_0x3c30a4=_0x3c30a4-0x0;var _0x4f3e14=_0x5e26[_0x3c30a4];return _0x4f3e14;};'use strict';var multer=require('multer');var util=require(_0x65e2('0x0'));var path=require(_0x65e2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65e2('0x2')]();var auth=require(_0x65e2('0x3'));var interaction=require(_0x65e2('0x4'));var config=require(_0x65e2('0x5'));var controller=require(_0x65e2('0x6'));router['get']('/',auth[_0x65e2('0x7')](),controller[_0x65e2('0x8')]);router[_0x65e2('0x9')](_0x65e2('0xa'),auth['isAuthenticated'](),controller[_0x65e2('0xb')]);router[_0x65e2('0xc')]('/',auth[_0x65e2('0x7')](),controller[_0x65e2('0xd')]);router[_0x65e2('0xe')](_0x65e2('0xa'),auth[_0x65e2('0x7')](),controller[_0x65e2('0xf')]);router[_0x65e2('0x10')]('/:id',auth[_0x65e2('0x7')](),controller[_0x65e2('0x11')]);module[_0x65e2('0x12')]=router; \ No newline at end of file +var _0xdd4b=['show','post','create','put','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id'];(function(_0x11df80,_0x1b734f){var _0x406448=function(_0x3510af){while(--_0x3510af){_0x11df80['push'](_0x11df80['shift']());}};_0x406448(++_0x1b734f);}(_0xdd4b,0x164));var _0xbdd4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xdd4b[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0xbdd4('0x0'));var path=require(_0xbdd4('0x1'));var timeout=require(_0xbdd4('0x2'));var express=require(_0xbdd4('0x3'));var router=express[_0xbdd4('0x4')]();var auth=require(_0xbdd4('0x5'));var interaction=require(_0xbdd4('0x6'));var config=require(_0xbdd4('0x7'));var controller=require(_0xbdd4('0x8'));router[_0xbdd4('0x9')]('/',auth[_0xbdd4('0xa')](),controller['index']);router[_0xbdd4('0x9')](_0xbdd4('0xb'),auth['isAuthenticated'](),controller[_0xbdd4('0xc')]);router[_0xbdd4('0xd')]('/',auth[_0xbdd4('0xa')](),controller[_0xbdd4('0xe')]);router[_0xbdd4('0xf')](_0xbdd4('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbdd4('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 83cbb49..dfbec56 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 _0x6816=['exports','ENUM','variable','keyValue','string','STRING','customVariable','sequelize'];(function(_0x4a6537,_0x58965e){var _0x2b603f=function(_0x3ddb4f){while(--_0x3ddb4f){_0x4a6537['push'](_0x4a6537['shift']());}};_0x2b603f(++_0x58965e);}(_0x6816,0x16f));var _0x6681=function(_0x361ed9,_0x428f8c){_0x361ed9=_0x361ed9-0x0;var _0x4a5f4c=_0x6816[_0x361ed9];return _0x4a5f4c;};'use strict';var Sequelize=require(_0x6681('0x0'));module[_0x6681('0x1')]={'type':{'type':Sequelize[_0x6681('0x2')]('string',_0x6681('0x3'),'customVariable',_0x6681('0x4')),'defaultValue':_0x6681('0x5')},'content':{'type':Sequelize[_0x6681('0x6')]},'key':{'type':Sequelize[_0x6681('0x6')]},'keyType':{'type':Sequelize[_0x6681('0x2')](_0x6681('0x5'),_0x6681('0x3'),_0x6681('0x7'))},'keyContent':{'type':Sequelize[_0x6681('0x6')]},'idField':{'type':Sequelize[_0x6681('0x6')]},'nameField':{'type':Sequelize[_0x6681('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x066a=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x066a,0x9b));var _0xa066=function(_0x4a85af,_0x5d866f){_0x4a85af=_0x4a85af-0x0;var _0xc809ff=_0x066a[_0x4a85af];return _0xc809ff;};'use strict';var Sequelize=require(_0xa066('0x0'));module[_0xa066('0x1')]={'type':{'type':Sequelize[_0xa066('0x2')]('string',_0xa066('0x3'),_0xa066('0x4'),'keyValue'),'defaultValue':_0xa066('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa066('0x6')]},'keyType':{'type':Sequelize[_0xa066('0x2')](_0xa066('0x5'),'variable',_0xa066('0x4'))},'keyContent':{'type':Sequelize[_0xa066('0x6')]},'idField':{'type':Sequelize[_0xa066('0x6')]},'nameField':{'type':Sequelize[_0xa066('0x6')]},'customField':{'type':Sequelize[_0xa066('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 27cabb3..6bdc827 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 _0xf5d8=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','FreshsalesField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xf5d8,0x1d8));var _0x8f5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5d8[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8f5d('0x1'));var rp=require(_0x8f5d('0x2'));var moment=require('moment');var BPromise=require(_0x8f5d('0x3'));var Mustache=require(_0x8f5d('0x4'));var util=require(_0x8f5d('0x5'));var path=require(_0x8f5d('0x6'));var sox=require(_0x8f5d('0x7'));var csv=require(_0x8f5d('0x8'));var ejs=require(_0x8f5d('0x9'));var fs=require('fs');var _=require(_0x8f5d('0xa'));var squel=require(_0x8f5d('0xb'));var crypto=require(_0x8f5d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8f5d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f5d('0xe'));var Redis=require(_0x8f5d('0xf'));var authService=require(_0x8f5d('0x10'));var qs=require(_0x8f5d('0x11'));var as=require(_0x8f5d('0x12'));var hardwareService=require(_0x8f5d('0x13'));var logger=require(_0x8f5d('0x14'))(_0x8f5d('0x15'));var utils=require(_0x8f5d('0x16'));var config=require(_0x8f5d('0x17'));var licenseUtil=require(_0x8f5d('0x18'));var db=require(_0x8f5d('0x19'))['db'];function respondWithStatusCode(_0x395c1d,_0x474a4c){_0x474a4c=_0x474a4c||0xcc;return function(_0x11857e){if(_0x11857e){return _0x395c1d['sendStatus'](_0x474a4c);}return _0x395c1d['status'](_0x474a4c)[_0x8f5d('0x1a')]();};}function respondWithResult(_0x19eb54,_0x13428a){_0x13428a=_0x13428a||0xc8;return function(_0xb98b1c){if(_0xb98b1c){return _0x19eb54[_0x8f5d('0x1b')](_0x13428a)[_0x8f5d('0x1c')](_0xb98b1c);}};}function respondWithFilteredResult(_0x561006,_0x27587b){return function(_0x4a4db2){if(_0x4a4db2){var _0x2d8fac=_0x4a4db2[_0x8f5d('0x1d')],_0x5099df=_0x27587b[_0x8f5d('0x1e')],_0x156ed3=_0x27587b[_0x8f5d('0x1e')]+_0x27587b['limit'],_0x3d6eaf;if(_0x156ed3>=_0x2d8fac){_0x156ed3=_0x2d8fac;_0x3d6eaf=0xc8;}else{_0x3d6eaf=0xce;}_0x561006['status'](_0x3d6eaf);return _0x561006[_0x8f5d('0x1f')]('Content-Range',_0x5099df+'-'+_0x156ed3+'/'+_0x2d8fac)[_0x8f5d('0x1c')](_0x4a4db2);}return null;};}function patchUpdates(_0x58c93e){return function(_0xbb5289){try{jsonpatch[_0x8f5d('0x20')](_0xbb5289,_0x58c93e,!![]);}catch(_0x46c526){return BPromise[_0x8f5d('0x21')](_0x46c526);}return _0xbb5289[_0x8f5d('0x22')]();};}function saveUpdates(_0x5d2ace,_0x278364){return function(_0x5aa2fd){if(_0x5aa2fd){return _0x5aa2fd[_0x8f5d('0x23')](_0x5d2ace)[_0x8f5d('0x24')](function(_0x172801){return _0x172801;});}return null;};}function removeEntity(_0xb732c3,_0x27afc8){return function(_0x3ed9f0){if(_0x3ed9f0){return _0x3ed9f0[_0x8f5d('0x25')]()[_0x8f5d('0x24')](function(){_0xb732c3['status'](0xcc)[_0x8f5d('0x1a')]();});}};}function handleEntityNotFound(_0x3207eb,_0x53a4ac){return function(_0x553a52){if(!_0x553a52){_0x3207eb[_0x8f5d('0x26')](0x194);}return _0x553a52;};}function handleError(_0x41f4d1,_0x414953){_0x414953=_0x414953||0x1f4;return function(_0x18e6ec){logger[_0x8f5d('0x27')](_0x18e6ec[_0x8f5d('0x28')]);if(_0x18e6ec[_0x8f5d('0x29')]){delete _0x18e6ec['name'];}_0x41f4d1[_0x8f5d('0x1b')](_0x414953)['send'](_0x18e6ec);};}exports['index']=function(_0x4fc815,_0x4fd071){var _0x110444={},_0x43e91e={},_0x501849={'count':0x0,'rows':[]};var _0x3a0082=_[_0x8f5d('0x2a')](db[_0x8f5d('0x2b')][_0x8f5d('0x2c')],function(_0x3c3295){return{'name':_0x3c3295['fieldName'],'type':_0x3c3295['type'][_0x8f5d('0x2d')]};});_0x43e91e[_0x8f5d('0x2e')]=_['map'](_0x3a0082,_0x8f5d('0x29'));_0x43e91e[_0x8f5d('0x2f')]=_[_0x8f5d('0x30')](_0x4fc815[_0x8f5d('0x2f')]);_0x43e91e[_0x8f5d('0x31')]=_[_0x8f5d('0x32')](_0x43e91e[_0x8f5d('0x2e')],_0x43e91e[_0x8f5d('0x2f')]);_0x110444[_0x8f5d('0x33')]=_[_0x8f5d('0x32')](_0x43e91e[_0x8f5d('0x2e')],qs[_0x8f5d('0x34')](_0x4fc815['query'][_0x8f5d('0x34')]));_0x110444['attributes']=_0x110444[_0x8f5d('0x33')]['length']?_0x110444[_0x8f5d('0x33')]:_0x43e91e[_0x8f5d('0x2e')];if(!_0x4fc815[_0x8f5d('0x2f')][_0x8f5d('0x35')]('nolimit')){_0x110444[_0x8f5d('0x36')]=qs['limit'](_0x4fc815[_0x8f5d('0x2f')]['limit']);_0x110444[_0x8f5d('0x1e')]=qs['offset'](_0x4fc815[_0x8f5d('0x2f')][_0x8f5d('0x1e')]);}_0x110444['order']=qs['sort'](_0x4fc815[_0x8f5d('0x2f')]['sort']);_0x110444[_0x8f5d('0x37')]=qs['filters'](_['pick'](_0x4fc815[_0x8f5d('0x2f')],_0x43e91e[_0x8f5d('0x31')]),_0x3a0082);if(_0x4fc815['query'][_0x8f5d('0x38')]){_0x110444['where']=_[_0x8f5d('0x39')](_0x110444['where'],{'$or':_[_0x8f5d('0x2a')](_0x3a0082,function(_0x246607){if(_0x246607[_0x8f5d('0x3a')]!==_0x8f5d('0x3b')){var _0x208305={};_0x208305[_0x246607[_0x8f5d('0x29')]]={'$like':'%'+_0x4fc815[_0x8f5d('0x2f')]['filter']+'%'};return _0x208305;}})});}_0x110444=_[_0x8f5d('0x39')]({},_0x110444,_0x4fc815[_0x8f5d('0x3c')]);var _0x52fea1={'where':_0x110444['where']};return db[_0x8f5d('0x2b')][_0x8f5d('0x1d')](_0x52fea1)[_0x8f5d('0x24')](function(_0x3e68b4){_0x501849[_0x8f5d('0x1d')]=_0x3e68b4;if(_0x4fc815[_0x8f5d('0x2f')][_0x8f5d('0x3d')]){_0x110444[_0x8f5d('0x3e')]=[{'all':!![]}];}return db[_0x8f5d('0x2b')][_0x8f5d('0x3f')](_0x110444);})[_0x8f5d('0x24')](function(_0x34cc77){_0x501849[_0x8f5d('0x40')]=_0x34cc77;return _0x501849;})[_0x8f5d('0x24')](respondWithFilteredResult(_0x4fd071,_0x110444))['catch'](handleError(_0x4fd071,null));};exports['show']=function(_0x1746c8,_0x4e4add){var _0xfd2934={'raw':!![],'where':{'id':_0x1746c8[_0x8f5d('0x41')]['id']}},_0x2a68c0={};_0x2a68c0[_0x8f5d('0x2e')]=_['keys'](db[_0x8f5d('0x2b')][_0x8f5d('0x2c')]);_0x2a68c0[_0x8f5d('0x2f')]=_[_0x8f5d('0x30')](_0x1746c8[_0x8f5d('0x2f')]);_0x2a68c0[_0x8f5d('0x31')]=_[_0x8f5d('0x32')](_0x2a68c0[_0x8f5d('0x2e')],_0x2a68c0[_0x8f5d('0x2f')]);_0xfd2934[_0x8f5d('0x33')]=_[_0x8f5d('0x32')](_0x2a68c0[_0x8f5d('0x2e')],qs['fields'](_0x1746c8[_0x8f5d('0x2f')][_0x8f5d('0x34')]));_0xfd2934[_0x8f5d('0x33')]=_0xfd2934[_0x8f5d('0x33')]['length']?_0xfd2934['attributes']:_0x2a68c0['model'];if(_0x1746c8['query'][_0x8f5d('0x3d')]){_0xfd2934[_0x8f5d('0x3e')]=[{'all':!![]}];}_0xfd2934=_[_0x8f5d('0x39')]({},_0xfd2934,_0x1746c8['options']);return db['FreshsalesField'][_0x8f5d('0x42')](_0xfd2934)[_0x8f5d('0x24')](handleEntityNotFound(_0x4e4add,null))[_0x8f5d('0x24')](respondWithResult(_0x4e4add,null))[_0x8f5d('0x43')](handleError(_0x4e4add,null));};exports[_0x8f5d('0x44')]=function(_0x3a19c4,_0x331966){return db['FreshsalesField'][_0x8f5d('0x44')](_0x3a19c4[_0x8f5d('0x45')],{})[_0x8f5d('0x24')](respondWithResult(_0x331966,0xc9))[_0x8f5d('0x43')](handleError(_0x331966,null));};exports[_0x8f5d('0x23')]=function(_0x3681e9,_0x331c10){if(_0x3681e9[_0x8f5d('0x45')]['id']){delete _0x3681e9['body']['id'];}return db[_0x8f5d('0x2b')][_0x8f5d('0x42')]({'where':{'id':_0x3681e9[_0x8f5d('0x41')]['id']}})['then'](handleEntityNotFound(_0x331c10,null))[_0x8f5d('0x24')](saveUpdates(_0x3681e9[_0x8f5d('0x45')],null))['then'](respondWithResult(_0x331c10,null))[_0x8f5d('0x43')](handleError(_0x331c10,null));};exports[_0x8f5d('0x25')]=function(_0x276da4,_0x498b47){return db[_0x8f5d('0x2b')][_0x8f5d('0x42')]({'where':{'id':_0x276da4[_0x8f5d('0x41')]['id']}})['then'](handleEntityNotFound(_0x498b47,null))[_0x8f5d('0x24')](removeEntity(_0x498b47,null))['catch'](handleError(_0x498b47,null));}; \ No newline at end of file +var _0x5b5a=['pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','update','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','FreshsalesField','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x5d3e97,_0x17d8dd){var _0x3a8dbe=function(_0x28ed0a){while(--_0x28ed0a){_0x5d3e97['push'](_0x5d3e97['shift']());}};_0x3a8dbe(++_0x17d8dd);}(_0x5b5a,0x18a));var _0xa5b5=function(_0x1f8b97,_0x1e98f5){_0x1f8b97=_0x1f8b97-0x0;var _0x1e77d2=_0x5b5a[_0x1f8b97];return _0x1e77d2;};'use strict';var pdf=require(_0xa5b5('0x0'));var emlformat=require(_0xa5b5('0x1'));var rimraf=require(_0xa5b5('0x2'));var zipdir=require(_0xa5b5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5b5('0x4'));var BPromise=require(_0xa5b5('0x5'));var Mustache=require(_0xa5b5('0x6'));var util=require(_0xa5b5('0x7'));var path=require(_0xa5b5('0x8'));var sox=require(_0xa5b5('0x9'));var csv=require(_0xa5b5('0xa'));var ejs=require(_0xa5b5('0xb'));var fs=require('fs');var _=require(_0xa5b5('0xc'));var squel=require(_0xa5b5('0xd'));var crypto=require(_0xa5b5('0xe'));var jsforce=require(_0xa5b5('0xf'));var deskjs=require(_0xa5b5('0x10'));var toCsv=require(_0xa5b5('0xa'));var querystring=require(_0xa5b5('0x11'));var Papa=require(_0xa5b5('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa5b5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5b5('0x14'));var logger=require(_0xa5b5('0x15'))(_0xa5b5('0x16'));var utils=require(_0xa5b5('0x17'));var config=require(_0xa5b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5b5('0x19'))['db'];function respondWithStatusCode(_0x513a34,_0x2320f3){_0x2320f3=_0x2320f3||0xcc;return function(_0x1dd16a){if(_0x1dd16a){return _0x513a34['sendStatus'](_0x2320f3);}return _0x513a34[_0xa5b5('0x1a')](_0x2320f3)[_0xa5b5('0x1b')]();};}function respondWithResult(_0x2bc431,_0x5f1fab){_0x5f1fab=_0x5f1fab||0xc8;return function(_0x1150de){if(_0x1150de){return _0x2bc431['status'](_0x5f1fab)[_0xa5b5('0x1c')](_0x1150de);}};}function respondWithFilteredResult(_0x58124a,_0x48b012){return function(_0x4eb43a){if(_0x4eb43a){var _0x11c196=_0x4eb43a[_0xa5b5('0x1d')],_0x228a4c=_0x48b012['offset'],_0xd10176=_0x48b012[_0xa5b5('0x1e')]+_0x48b012[_0xa5b5('0x1f')],_0x388618;if(_0xd10176>=_0x11c196){_0xd10176=_0x11c196;_0x388618=0xc8;}else{_0x388618=0xce;}_0x58124a[_0xa5b5('0x1a')](_0x388618);return _0x58124a[_0xa5b5('0x20')](_0xa5b5('0x21'),_0x228a4c+'-'+_0xd10176+'/'+_0x11c196)['json'](_0x4eb43a);}return null;};}function patchUpdates(_0x57692d){return function(_0x5ab749){try{jsonpatch[_0xa5b5('0x22')](_0x5ab749,_0x57692d,!![]);}catch(_0x14e31d){return BPromise[_0xa5b5('0x23')](_0x14e31d);}return _0x5ab749['save']();};}function saveUpdates(_0x1b1075,_0x196ff3){return function(_0x404362){if(_0x404362){return _0x404362['update'](_0x1b1075)[_0xa5b5('0x24')](function(_0xc59905){return _0xc59905;});}return null;};}function removeEntity(_0x3f924b,_0x5ce8da){return function(_0x4f4038){if(_0x4f4038){return _0x4f4038['destroy']()[_0xa5b5('0x24')](function(){_0x3f924b[_0xa5b5('0x1a')](0xcc)[_0xa5b5('0x1b')]();});}};}function handleEntityNotFound(_0x545980,_0x6d8cb0){return function(_0x38f10d){if(!_0x38f10d){_0x545980[_0xa5b5('0x25')](0x194);}return _0x38f10d;};}function handleError(_0x403933,_0x187659){_0x187659=_0x187659||0x1f4;return function(_0x36d3b4){logger[_0xa5b5('0x26')](_0x36d3b4[_0xa5b5('0x27')]);if(_0x36d3b4[_0xa5b5('0x28')]){delete _0x36d3b4[_0xa5b5('0x28')];}_0x403933[_0xa5b5('0x1a')](_0x187659)[_0xa5b5('0x29')](_0x36d3b4);};}exports['index']=function(_0x401439,_0x123272){var _0x1d0867={},_0x6024f6={},_0x448831={'count':0x0,'rows':[]};var _0x5b9b85=_['map'](db[_0xa5b5('0x2a')]['rawAttributes'],function(_0x592e71){return{'name':_0x592e71['fieldName'],'type':_0x592e71[_0xa5b5('0x2b')]['key']};});_0x6024f6[_0xa5b5('0x2c')]=_[_0xa5b5('0x2d')](_0x5b9b85,_0xa5b5('0x28'));_0x6024f6[_0xa5b5('0x2e')]=_[_0xa5b5('0x2f')](_0x401439[_0xa5b5('0x2e')]);_0x6024f6[_0xa5b5('0x30')]=_[_0xa5b5('0x31')](_0x6024f6[_0xa5b5('0x2c')],_0x6024f6[_0xa5b5('0x2e')]);_0x1d0867['attributes']=_[_0xa5b5('0x31')](_0x6024f6[_0xa5b5('0x2c')],qs[_0xa5b5('0x32')](_0x401439[_0xa5b5('0x2e')][_0xa5b5('0x32')]));_0x1d0867[_0xa5b5('0x33')]=_0x1d0867[_0xa5b5('0x33')][_0xa5b5('0x34')]?_0x1d0867[_0xa5b5('0x33')]:_0x6024f6[_0xa5b5('0x2c')];if(!_0x401439[_0xa5b5('0x2e')][_0xa5b5('0x35')](_0xa5b5('0x36'))){_0x1d0867['limit']=qs['limit'](_0x401439[_0xa5b5('0x2e')]['limit']);_0x1d0867[_0xa5b5('0x1e')]=qs[_0xa5b5('0x1e')](_0x401439['query'][_0xa5b5('0x1e')]);}_0x1d0867['order']=qs[_0xa5b5('0x37')](_0x401439['query']['sort']);_0x1d0867['where']=qs[_0xa5b5('0x30')](_[_0xa5b5('0x38')](_0x401439[_0xa5b5('0x2e')],_0x6024f6[_0xa5b5('0x30')]),_0x5b9b85);if(_0x401439[_0xa5b5('0x2e')]['filter']){_0x1d0867[_0xa5b5('0x39')]=_[_0xa5b5('0x3a')](_0x1d0867[_0xa5b5('0x39')],{'$or':_[_0xa5b5('0x2d')](_0x5b9b85,function(_0x253954){if(_0x253954[_0xa5b5('0x2b')]!==_0xa5b5('0x3b')){var _0x3356d1={};_0x3356d1[_0x253954[_0xa5b5('0x28')]]={'$like':'%'+_0x401439[_0xa5b5('0x2e')][_0xa5b5('0x3c')]+'%'};return _0x3356d1;}})});}_0x1d0867=_[_0xa5b5('0x3a')]({},_0x1d0867,_0x401439[_0xa5b5('0x3d')]);var _0x34f55a={'where':_0x1d0867['where']};return db[_0xa5b5('0x2a')]['count'](_0x34f55a)[_0xa5b5('0x24')](function(_0x118dee){_0x448831[_0xa5b5('0x1d')]=_0x118dee;if(_0x401439[_0xa5b5('0x2e')][_0xa5b5('0x3e')]){_0x1d0867[_0xa5b5('0x3f')]=[{'all':!![]}];}return db[_0xa5b5('0x2a')][_0xa5b5('0x40')](_0x1d0867);})[_0xa5b5('0x24')](function(_0x379cbc){_0x448831[_0xa5b5('0x41')]=_0x379cbc;return _0x448831;})['then'](respondWithFilteredResult(_0x123272,_0x1d0867))[_0xa5b5('0x42')](handleError(_0x123272,null));};exports[_0xa5b5('0x43')]=function(_0x498f56,_0x39d0ce){var _0x599463={'raw':!![],'where':{'id':_0x498f56[_0xa5b5('0x44')]['id']}},_0x4f2050={};_0x4f2050[_0xa5b5('0x2c')]=_[_0xa5b5('0x2f')](db[_0xa5b5('0x2a')][_0xa5b5('0x45')]);_0x4f2050[_0xa5b5('0x2e')]=_['keys'](_0x498f56['query']);_0x4f2050[_0xa5b5('0x30')]=_[_0xa5b5('0x31')](_0x4f2050[_0xa5b5('0x2c')],_0x4f2050[_0xa5b5('0x2e')]);_0x599463[_0xa5b5('0x33')]=_[_0xa5b5('0x31')](_0x4f2050[_0xa5b5('0x2c')],qs[_0xa5b5('0x32')](_0x498f56[_0xa5b5('0x2e')][_0xa5b5('0x32')]));_0x599463[_0xa5b5('0x33')]=_0x599463[_0xa5b5('0x33')]['length']?_0x599463[_0xa5b5('0x33')]:_0x4f2050[_0xa5b5('0x2c')];if(_0x498f56[_0xa5b5('0x2e')][_0xa5b5('0x3e')]){_0x599463[_0xa5b5('0x3f')]=[{'all':!![]}];}_0x599463=_[_0xa5b5('0x3a')]({},_0x599463,_0x498f56[_0xa5b5('0x3d')]);return db['FreshsalesField']['find'](_0x599463)['then'](handleEntityNotFound(_0x39d0ce,null))[_0xa5b5('0x24')](respondWithResult(_0x39d0ce,null))[_0xa5b5('0x42')](handleError(_0x39d0ce,null));};exports[_0xa5b5('0x46')]=function(_0xd4caa1,_0x225592){return db['FreshsalesField']['create'](_0xd4caa1['body'],{})[_0xa5b5('0x24')](respondWithResult(_0x225592,0xc9))[_0xa5b5('0x42')](handleError(_0x225592,null));};exports[_0xa5b5('0x47')]=function(_0x4bd19c,_0x557aa3){if(_0x4bd19c[_0xa5b5('0x48')]['id']){delete _0x4bd19c[_0xa5b5('0x48')]['id'];}return db['FreshsalesField'][_0xa5b5('0x49')]({'where':{'id':_0x4bd19c[_0xa5b5('0x44')]['id']}})[_0xa5b5('0x24')](handleEntityNotFound(_0x557aa3,null))[_0xa5b5('0x24')](saveUpdates(_0x4bd19c['body'],null))[_0xa5b5('0x24')](respondWithResult(_0x557aa3,null))['catch'](handleError(_0x557aa3,null));};exports[_0xa5b5('0x4a')]=function(_0x3583ab,_0x8a2f2a){return db['FreshsalesField'][_0xa5b5('0x49')]({'where':{'id':_0x3583ab[_0xa5b5('0x44')]['id']}})['then'](handleEntityNotFound(_0x8a2f2a,null))[_0xa5b5('0x24')](removeEntity(_0x8a2f2a,null))[_0xa5b5('0x42')](handleError(_0x8a2f2a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5d5e29d..1f658ee 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 _0x02f7=['request-promise','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x35f93c,_0x4ad889){var _0x4b1e5b=function(_0x162df5){while(--_0x162df5){_0x35f93c['push'](_0x35f93c['shift']());}};_0x4b1e5b(++_0x4ad889);}(_0x02f7,0x1f3));var _0x702f=function(_0x16252d,_0xaad177){_0x16252d=_0x16252d-0x0;var _0xeb5dd5=_0x02f7[_0x16252d];return _0xeb5dd5;};'use strict';var _=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var logger=require('../../config/logger')(_0x702f('0x2'));var moment=require(_0x702f('0x3'));var BPromise=require(_0x702f('0x4'));var rp=require(_0x702f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x702f('0x6'));var attributes=require(_0x702f('0x7'));module[_0x702f('0x8')]=function(_0xb9b5ea,_0x3dec84){return _0xb9b5ea['define'](_0x702f('0x9'),attributes,{'tableName':_0x702f('0xa'),'paranoid':![],'indexes':[{'name':_0x702f('0xb'),'fields':[_0x702f('0xc'),_0x702f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1882=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x38d355,_0x2a85b4){var _0x424e97=function(_0x169c0a){while(--_0x169c0a){_0x38d355['push'](_0x38d355['shift']());}};_0x424e97(++_0x2a85b4);}(_0x1882,0x169));var _0x2188=function(_0x226c5e,_0xe022f0){_0x226c5e=_0x226c5e-0x0;var _0x541896=_0x1882[_0x226c5e];return _0x541896;};'use strict';var _=require(_0x2188('0x0'));var util=require(_0x2188('0x1'));var logger=require(_0x2188('0x2'))(_0x2188('0x3'));var moment=require(_0x2188('0x4'));var BPromise=require(_0x2188('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2188('0x6'));var rimraf=require(_0x2188('0x7'));var config=require(_0x2188('0x8'));var attributes=require(_0x2188('0x9'));module[_0x2188('0xa')]=function(_0x2a2147,_0x383df3){return _0x2a2147['define'](_0x2188('0xb'),attributes,{'tableName':_0x2188('0xc'),'paranoid':![],'indexes':[{'name':_0x2188('0xd'),'fields':[_0x2188('0xe'),_0x2188('0xf')],'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 a7ad0e9..efdd6ae 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 _0x4ab2=['FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x4ab2,0xbb));var _0x24ab=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4ab2[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0x24ab('0x0'));var moment=require(_0x24ab('0x1'));var BPromise=require(_0x24ab('0x2'));var rs=require(_0x24ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24ab('0x4'))['db'];var utils=require(_0x24ab('0x5'));var logger=require(_0x24ab('0x6'))(_0x24ab('0x7'));var config=require(_0x24ab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24ab('0x9')][_0x24ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2232bb,_0x4114fc,_0x46679f){return new BPromise(function(_0x3068da,_0x4b3cbe){return client['request'](_0x2232bb,_0x46679f)['then'](function(_0xf16eca){logger['info'](_0x24ab('0xb'),_0x4114fc,_0x24ab('0xc'));logger[_0x24ab('0xd')](_0x24ab('0xe'),_0x4114fc,_0x24ab('0xc'),JSON[_0x24ab('0xf')](_0xf16eca));if(_0xf16eca[_0x24ab('0x10')]){if(_0xf16eca[_0x24ab('0x10')][_0x24ab('0x11')]===0x1f4){logger[_0x24ab('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4114fc,_0xf16eca[_0x24ab('0x10')][_0x24ab('0x12')]);return _0x4b3cbe(_0xf16eca[_0x24ab('0x10')]['message']);}logger[_0x24ab('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4114fc,_0xf16eca[_0x24ab('0x10')][_0x24ab('0x12')]);return _0x3068da(_0xf16eca[_0x24ab('0x10')][_0x24ab('0x12')]);}else{logger[_0x24ab('0x13')](_0x24ab('0xb'),_0x4114fc,'request\x20sent');_0x3068da(_0xf16eca[_0x24ab('0x14')][_0x24ab('0x12')]);}})[_0x24ab('0x15')](function(_0xd804a0){logger[_0x24ab('0x10')](_0x24ab('0xb'),_0x4114fc,_0xd804a0);_0x4b3cbe(_0xd804a0);});});} \ No newline at end of file +var _0x4d15=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x4d15,0x137));var _0x54d1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4d15[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x54d1('0x0'));var util=require(_0x54d1('0x1'));var moment=require(_0x54d1('0x2'));var BPromise=require(_0x54d1('0x3'));var rs=require(_0x54d1('0x4'));var fs=require('fs');var Redis=require(_0x54d1('0x5'));var db=require(_0x54d1('0x6'))['db'];var utils=require(_0x54d1('0x7'));var logger=require('../../config/logger')(_0x54d1('0x8'));var config=require(_0x54d1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x54d1('0xa')][_0x54d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9bfb,_0x3d39cc,_0x52868f){return new BPromise(function(_0x11c117,_0x5cabdc){return client[_0x54d1('0xc')](_0x1f9bfb,_0x52868f)[_0x54d1('0xd')](function(_0x168877){logger[_0x54d1('0xe')](_0x54d1('0xf'),_0x3d39cc,_0x54d1('0x10'));logger['debug'](_0x54d1('0x11'),_0x3d39cc,'request\x20sent',JSON[_0x54d1('0x12')](_0x168877));if(_0x168877['error']){if(_0x168877['error'][_0x54d1('0x13')]===0x1f4){logger[_0x54d1('0x14')](_0x54d1('0xf'),_0x3d39cc,_0x168877[_0x54d1('0x14')][_0x54d1('0x15')]);return _0x5cabdc(_0x168877[_0x54d1('0x14')]['message']);}logger[_0x54d1('0x14')]('FreshsalesField,\x20%s,\x20%s',_0x3d39cc,_0x168877[_0x54d1('0x14')][_0x54d1('0x15')]);return _0x11c117(_0x168877[_0x54d1('0x14')]['message']);}else{logger[_0x54d1('0xe')](_0x54d1('0xf'),_0x3d39cc,_0x54d1('0x10'));_0x11c117(_0x168877[_0x54d1('0x16')][_0x54d1('0x15')]);}})[_0x54d1('0x17')](function(_0x1dcbfa){logger[_0x54d1('0x14')](_0x54d1('0xf'),_0x3d39cc,_0x1dcbfa);_0x5cabdc(_0x1dcbfa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 512da16..a00b3de 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 _0x130f=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getFields','post','create','addConfiguration','put'];(function(_0x41fdb2,_0x97b5eb){var _0x4644b6=function(_0x1b177b){while(--_0x1b177b){_0x41fdb2['push'](_0x41fdb2['shift']());}};_0x4644b6(++_0x97b5eb);}(_0x130f,0x10c));var _0xf130=function(_0x1eaa2e,_0xea2008){_0x1eaa2e=_0x1eaa2e-0x0;var _0x3a00ee=_0x130f[_0x1eaa2e];return _0x3a00ee;};'use strict';var multer=require(_0xf130('0x0'));var util=require('util');var path=require(_0xf130('0x1'));var timeout=require(_0xf130('0x2'));var express=require(_0xf130('0x3'));var router=express[_0xf130('0x4')]();var auth=require(_0xf130('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf130('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xf130('0x7')](),controller[_0xf130('0x8')]);router[_0xf130('0x9')](_0xf130('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf130('0x9')](_0xf130('0xb'),auth[_0xf130('0x7')](),controller['getConfigurations']);router[_0xf130('0x9')]('/:id/fields',auth[_0xf130('0x7')](),controller[_0xf130('0xc')]);router[_0xf130('0xd')]('/',auth[_0xf130('0x7')](),controller[_0xf130('0xe')]);router[_0xf130('0xd')](_0xf130('0xb'),auth[_0xf130('0x7')](),controller[_0xf130('0xf')]);router[_0xf130('0x10')]('/:id',auth[_0xf130('0x7')](),controller['update']);router[_0xf130('0x11')](_0xf130('0xa'),auth[_0xf130('0x7')](),controller['destroy']);module[_0xf130('0x12')]=router; \ No newline at end of file +var _0xdea2=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','show'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xdea2,0x1d8));var _0x2dea=function(_0x46ee6b,_0x7f3e6c){_0x46ee6b=_0x46ee6b-0x0;var _0x97d54b=_0xdea2[_0x46ee6b];return _0x97d54b;};'use strict';var multer=require(_0x2dea('0x0'));var util=require(_0x2dea('0x1'));var path=require(_0x2dea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2dea('0x3')]();var auth=require(_0x2dea('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2dea('0x5'));var controller=require(_0x2dea('0x6'));router[_0x2dea('0x7')]('/',auth[_0x2dea('0x8')](),controller[_0x2dea('0x9')]);router[_0x2dea('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2dea('0xa')]);router[_0x2dea('0x7')]('/:id/configurations',auth[_0x2dea('0x8')](),controller[_0x2dea('0xb')]);router[_0x2dea('0x7')](_0x2dea('0xc'),auth[_0x2dea('0x8')](),controller[_0x2dea('0xd')]);router[_0x2dea('0xe')]('/',auth[_0x2dea('0x8')](),controller[_0x2dea('0xf')]);router[_0x2dea('0xe')](_0x2dea('0x10'),auth[_0x2dea('0x8')](),controller[_0x2dea('0x11')]);router[_0x2dea('0x12')](_0x2dea('0x13'),auth[_0x2dea('0x8')](),controller[_0x2dea('0x14')]);router[_0x2dea('0x15')](_0x2dea('0x13'),auth[_0x2dea('0x8')](),controller['destroy']);module[_0x2dea('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f4df865..b8582f8 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 _0x5a7d=['newTab','sequelize','STRING','ENUM'];(function(_0x55a348,_0x15a153){var _0x2c28c7=function(_0x359f43){while(--_0x359f43){_0x55a348['push'](_0x55a348['shift']());}};_0x2c28c7(++_0x15a153);}(_0x5a7d,0x14d));var _0xd5a7=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x5a7d[_0x5734e1];return _0x22c784;};'use strict';var Sequelize=require(_0xd5a7('0x0'));module['exports']={'name':{'type':Sequelize[_0xd5a7('0x1')]},'description':{'type':Sequelize[_0xd5a7('0x1')]},'username':{'type':Sequelize[_0xd5a7('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xd5a7('0x1')]},'password':{'type':Sequelize[_0xd5a7('0x1')]},'clientId':{'type':Sequelize[_0xd5a7('0x1')]},'clientSecret':{'type':Sequelize[_0xd5a7('0x1')]},'securityToken':{'type':Sequelize[_0xd5a7('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd5a7('0x2')]('integrationTab',_0xd5a7('0x3')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4365=['ENUM','integrationTab','sequelize','STRING','username'];(function(_0x2745c2,_0x28dc24){var _0x51e80a=function(_0x4ebd6d){while(--_0x4ebd6d){_0x2745c2['push'](_0x2745c2['shift']());}};_0x51e80a(++_0x28dc24);}(_0x4365,0x183));var _0x5436=function(_0x5ca51d,_0xe86f27){_0x5ca51d=_0x5ca51d-0x0;var _0x5f3d85=_0x4365[_0x5ca51d];return _0x5f3d85;};'use strict';var Sequelize=require(_0x5436('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5436('0x1')],'unique':_0x5436('0x2')},'remoteUri':{'type':Sequelize[_0x5436('0x1')]},'password':{'type':Sequelize[_0x5436('0x1')]},'clientId':{'type':Sequelize[_0x5436('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5436('0x1')]},'serverUrl':{'type':Sequelize[_0x5436('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5436('0x3')]('integrationTab','newTab'),'defaultValue':_0x5436('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 902a12b..80287cc 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 _0x0972=['error','code','message','info','catch','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','map','SalesforceAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','rawAttributes','include','create','params','body','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','login','concat','isNil','ticketType','sobject','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','Case','Origin','Reason','SuppliedName','SuppliedCompany','remove','custom','includes','picklistValues','label','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c92e2,_0x1975b5){var _0x5719fa=function(_0x2c6382){while(--_0x2c6382){_0x2c92e2['push'](_0x2c92e2['shift']());}};_0x5719fa(++_0x1975b5);}(_0x0972,0x64));var _0x2097=function(_0x5eab1a,_0x4cc072){_0x5eab1a=_0x5eab1a-0x0;var _0x282c7e=_0x0972[_0x5eab1a];return _0x282c7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x8'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];var integrations=require(_0x2097('0x1a'));var jayson=require(_0x2097('0x1b'));var client=jayson[_0x2097('0x1c')][_0x2097('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3e3fdc,_0x185be8,_0x1c9ef9,_0x2c3e41){return new BPromise(function(_0x354387,_0x5d0a43){var _0x639c14=_0x2c3e41||client;return _0x639c14[_0x2097('0x1e')](_0x3e3fdc,_0x1c9ef9)['then'](function(_0x4eec05){logger['info'](_0x2097('0x1f'),_0x185be8,'request\x20sent');logger[_0x2097('0x20')](_0x2097('0x21'),_0x185be8,_0x2097('0x22'),JSON[_0x2097('0x23')](_0x4eec05));if(_0x4eec05[_0x2097('0x24')]){if(_0x4eec05['error'][_0x2097('0x25')]===0x1f4){logger[_0x2097('0x24')](_0x2097('0x1f'),_0x185be8,_0x4eec05[_0x2097('0x24')][_0x2097('0x26')]);return _0x5d0a43(_0x4eec05[_0x2097('0x24')][_0x2097('0x26')]);}logger[_0x2097('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x185be8,_0x4eec05['error'][_0x2097('0x26')]);return _0x354387(_0x4eec05['error'][_0x2097('0x26')]);}else{logger[_0x2097('0x27')]('SalesforceAccount,\x20%s,\x20%s',_0x185be8,_0x2097('0x22'));_0x354387(_0x4eec05['result'][_0x2097('0x26')]);}})[_0x2097('0x28')](function(_0x36189e){logger[_0x2097('0x24')](_0x2097('0x1f'),_0x185be8,_0x36189e);_0x5d0a43(_0x36189e);});});}function respondWithStatusCode(_0x35047b,_0x56390a){_0x56390a=_0x56390a||0xcc;return function(_0xae5f9){if(_0xae5f9){return _0x35047b['sendStatus'](_0x56390a);}return _0x35047b[_0x2097('0x29')](_0x56390a)[_0x2097('0x2a')]();};}function respondWithResult(_0x345875,_0x9f59bc){_0x9f59bc=_0x9f59bc||0xc8;return function(_0x499988){if(_0x499988){return _0x345875[_0x2097('0x29')](_0x9f59bc)[_0x2097('0x2b')](_0x499988);}};}function respondWithFilteredResult(_0x56af3b,_0x1229fc){return function(_0x5ed0fa){if(_0x5ed0fa){var _0x29b879=_0x5ed0fa[_0x2097('0x2c')],_0x48ae06=_0x1229fc[_0x2097('0x2d')],_0xbc0339=_0x1229fc[_0x2097('0x2d')]+_0x1229fc[_0x2097('0x2e')],_0x33e8d1;if(_0xbc0339>=_0x29b879){_0xbc0339=_0x29b879;_0x33e8d1=0xc8;}else{_0x33e8d1=0xce;}_0x56af3b[_0x2097('0x29')](_0x33e8d1);return _0x56af3b['set'](_0x2097('0x2f'),_0x48ae06+'-'+_0xbc0339+'/'+_0x29b879)[_0x2097('0x2b')](_0x5ed0fa);}return null;};}function patchUpdates(_0x5cce55){return function(_0x1398d0){try{jsonpatch[_0x2097('0x30')](_0x1398d0,_0x5cce55,!![]);}catch(_0x59fb84){return BPromise['reject'](_0x59fb84);}return _0x1398d0[_0x2097('0x31')]();};}function saveUpdates(_0x11b051,_0x1649c8){return function(_0x3589bb){if(_0x3589bb){return _0x3589bb[_0x2097('0x32')](_0x11b051)[_0x2097('0x33')](function(_0x56c538){return _0x56c538;});}return null;};}function removeEntity(_0xe1a381,_0x56bb42){return function(_0x193160){if(_0x193160){return _0x193160[_0x2097('0x34')]()[_0x2097('0x33')](function(){_0xe1a381[_0x2097('0x29')](0xcc)[_0x2097('0x2a')]();});}};}function handleEntityNotFound(_0x395d9f,_0x9bc312){return function(_0x455cf7){if(!_0x455cf7){_0x395d9f[_0x2097('0x35')](0x194);}return _0x455cf7;};}function handleError(_0x5c89ab,_0x192160){_0x192160=_0x192160||0x1f4;return function(_0x40baed){logger[_0x2097('0x24')](_0x40baed['stack']);if(_0x40baed[_0x2097('0x36')]){delete _0x40baed[_0x2097('0x36')];}_0x5c89ab[_0x2097('0x29')](_0x192160)[_0x2097('0x37')](_0x40baed);};}exports['index']=function(_0x50b101,_0x5689f6){var _0x3484ff={},_0x8f464d={},_0x4123b7={'count':0x0,'rows':[]};var _0x133c4c=_[_0x2097('0x38')](db[_0x2097('0x39')]['rawAttributes'],function(_0x379032){return{'name':_0x379032[_0x2097('0x3a')],'type':_0x379032[_0x2097('0x3b')][_0x2097('0x3c')]};});_0x8f464d[_0x2097('0x3d')]=_[_0x2097('0x38')](_0x133c4c,'name');_0x8f464d[_0x2097('0x3e')]=_[_0x2097('0x3f')](_0x50b101[_0x2097('0x3e')]);_0x8f464d['filters']=_['intersection'](_0x8f464d[_0x2097('0x3d')],_0x8f464d[_0x2097('0x3e')]);_0x3484ff[_0x2097('0x40')]=_[_0x2097('0x41')](_0x8f464d[_0x2097('0x3d')],qs[_0x2097('0x42')](_0x50b101[_0x2097('0x3e')][_0x2097('0x42')]));_0x3484ff[_0x2097('0x40')]=_0x3484ff[_0x2097('0x40')][_0x2097('0x43')]?_0x3484ff[_0x2097('0x40')]:_0x8f464d['model'];if(!_0x50b101[_0x2097('0x3e')][_0x2097('0x44')](_0x2097('0x45'))){_0x3484ff['limit']=qs[_0x2097('0x2e')](_0x50b101[_0x2097('0x3e')][_0x2097('0x2e')]);_0x3484ff[_0x2097('0x2d')]=qs[_0x2097('0x2d')](_0x50b101[_0x2097('0x3e')][_0x2097('0x2d')]);}_0x3484ff[_0x2097('0x46')]=qs['sort'](_0x50b101[_0x2097('0x3e')][_0x2097('0x47')]);_0x3484ff[_0x2097('0x48')]=qs[_0x2097('0x49')](_[_0x2097('0x4a')](_0x50b101[_0x2097('0x3e')],_0x8f464d[_0x2097('0x49')]),_0x133c4c);if(_0x50b101[_0x2097('0x3e')]['filter']){_0x3484ff[_0x2097('0x48')]=_['merge'](_0x3484ff[_0x2097('0x48')],{'$or':_[_0x2097('0x38')](_0x133c4c,function(_0x370cc6){if(_0x370cc6[_0x2097('0x3b')]!==_0x2097('0x4b')){var _0x4d0871={};_0x4d0871[_0x370cc6[_0x2097('0x36')]]={'$like':'%'+_0x50b101[_0x2097('0x3e')][_0x2097('0x4c')]+'%'};return _0x4d0871;}})});}_0x3484ff=_[_0x2097('0x4d')]({},_0x3484ff,_0x50b101[_0x2097('0x4e')]);var _0x58c7bd={'where':_0x3484ff[_0x2097('0x48')]};return db[_0x2097('0x39')][_0x2097('0x2c')](_0x58c7bd)[_0x2097('0x33')](function(_0xd90601){_0x4123b7[_0x2097('0x2c')]=_0xd90601;if(_0x50b101[_0x2097('0x3e')][_0x2097('0x4f')]){_0x3484ff['include']=[{'all':!![]}];}return db[_0x2097('0x39')][_0x2097('0x50')](_0x3484ff);})[_0x2097('0x33')](function(_0xfe13c8){_0x4123b7['rows']=_0xfe13c8;return _0x4123b7;})['then'](respondWithFilteredResult(_0x5689f6,_0x3484ff))['catch'](handleError(_0x5689f6,null));};exports[_0x2097('0x51')]=function(_0x396979,_0x4c4ef9){var _0x10577d={'raw':![],'where':{'id':_0x396979['params']['id']}},_0x3f3798={};_0x3f3798['model']=_[_0x2097('0x3f')](db[_0x2097('0x39')][_0x2097('0x52')]);_0x3f3798['query']=_[_0x2097('0x3f')](_0x396979[_0x2097('0x3e')]);_0x3f3798['filters']=_[_0x2097('0x41')](_0x3f3798[_0x2097('0x3d')],_0x3f3798[_0x2097('0x3e')]);_0x10577d[_0x2097('0x40')]=_[_0x2097('0x41')](_0x3f3798['model'],qs['fields'](_0x396979[_0x2097('0x3e')][_0x2097('0x42')]));_0x10577d[_0x2097('0x40')]=_0x10577d['attributes']['length']?_0x10577d[_0x2097('0x40')]:_0x3f3798[_0x2097('0x3d')];if(_0x396979['query'][_0x2097('0x4f')]){_0x10577d[_0x2097('0x53')]=[{'all':!![]}];}_0x10577d=_[_0x2097('0x4d')]({},_0x10577d,_0x396979[_0x2097('0x4e')]);return db[_0x2097('0x39')]['find'](_0x10577d)[_0x2097('0x33')](handleEntityNotFound(_0x4c4ef9,null))[_0x2097('0x33')](respondWithResult(_0x4c4ef9,null))[_0x2097('0x28')](handleError(_0x4c4ef9,null));};exports['create']=function(_0x4a25e2,_0xdf72c7){return db['SalesforceAccount'][_0x2097('0x54')](_0x4a25e2['body'],{})[_0x2097('0x33')](respondWithResult(_0xdf72c7,0xc9))['catch'](handleError(_0xdf72c7,null));};exports['update']=function(_0x5d4f35,_0x40cbe1){if(_0x5d4f35['body']['id']){delete _0x5d4f35['body']['id'];}return db[_0x2097('0x39')]['find']({'where':{'id':_0x5d4f35[_0x2097('0x55')]['id']}})[_0x2097('0x33')](handleEntityNotFound(_0x40cbe1,null))['then'](saveUpdates(_0x5d4f35[_0x2097('0x56')],null))[_0x2097('0x33')](respondWithResult(_0x40cbe1,null))[_0x2097('0x28')](handleError(_0x40cbe1,null));};exports[_0x2097('0x34')]=function(_0x306b71,_0x58d661){return db[_0x2097('0x39')]['find']({'where':{'id':_0x306b71[_0x2097('0x55')]['id']}})[_0x2097('0x33')](handleEntityNotFound(_0x58d661,null))[_0x2097('0x33')](removeEntity(_0x58d661,null))['catch'](handleError(_0x58d661,null));};exports[_0x2097('0x57')]=function(_0x17df41,_0x2f5016,_0x168a7d){var _0x3a93b8={};var _0x56cfbf={};var _0x5b9fa2;var _0x265eac;return db[_0x2097('0x39')]['findOne']({'where':{'id':_0x17df41['params']['id']}})['then'](handleEntityNotFound(_0x2f5016,null))['then'](function(_0x14b2d4){if(_0x14b2d4){_0x5b9fa2=_0x14b2d4;_0x56cfbf['model']=_[_0x2097('0x3f')](db[_0x2097('0x58')]['rawAttributes']);_0x56cfbf[_0x2097('0x3e')]=_[_0x2097('0x3f')](_0x17df41[_0x2097('0x3e')]);_0x56cfbf[_0x2097('0x49')]=_[_0x2097('0x41')](_0x56cfbf[_0x2097('0x3d')],_0x56cfbf[_0x2097('0x3e')]);_0x3a93b8[_0x2097('0x40')]=_[_0x2097('0x41')](_0x56cfbf['model'],qs[_0x2097('0x42')](_0x17df41[_0x2097('0x3e')][_0x2097('0x42')]));_0x3a93b8[_0x2097('0x40')]=_0x3a93b8[_0x2097('0x40')][_0x2097('0x43')]?_0x3a93b8['attributes']:_0x56cfbf[_0x2097('0x3d')];_0x3a93b8[_0x2097('0x46')]=qs[_0x2097('0x47')](_0x17df41[_0x2097('0x3e')][_0x2097('0x47')]);_0x3a93b8['where']=qs[_0x2097('0x49')](_[_0x2097('0x4a')](_0x17df41['query'],_0x56cfbf['filters']));if(_0x17df41['query'][_0x2097('0x4c')]){_0x3a93b8[_0x2097('0x48')]=_[_0x2097('0x4d')](_0x3a93b8[_0x2097('0x48')],{'$or':_[_0x2097('0x38')](_0x3a93b8[_0x2097('0x40')],function(_0x2e287b){var _0x2ce256={};_0x2ce256[_0x2e287b]={'$like':'%'+_0x17df41[_0x2097('0x3e')]['filter']+'%'};return _0x2ce256;})});}_0x3a93b8=_['merge']({},_0x3a93b8,_0x17df41[_0x2097('0x4e')]);return _0x5b9fa2[_0x2097('0x57')](_0x3a93b8);}})[_0x2097('0x33')](function(_0x2bdf29){if(_0x2bdf29){_0x265eac=_0x2bdf29[_0x2097('0x43')];if(!_0x17df41[_0x2097('0x3e')]['hasOwnProperty'](_0x2097('0x45'))){_0x3a93b8[_0x2097('0x2e')]=qs[_0x2097('0x2e')](_0x17df41[_0x2097('0x3e')]['limit']);_0x3a93b8['offset']=qs[_0x2097('0x2d')](_0x17df41[_0x2097('0x3e')]['offset']);}return _0x5b9fa2[_0x2097('0x57')](_0x3a93b8);}})[_0x2097('0x33')](function(_0x17551b){if(_0x17551b){return _0x17551b?{'count':_0x265eac,'rows':_0x17551b}:null;}})[_0x2097('0x33')](respondWithResult(_0x2f5016,null))[_0x2097('0x28')](handleError(_0x2f5016,null));};exports[_0x2097('0x59')]=function(_0x10f891,_0x2c6f24,_0x54159e){if(_0x10f891[_0x2097('0x56')]['id']){delete _0x10f891[_0x2097('0x56')]['id'];}return db['SalesforceAccount'][_0x2097('0x5a')]({'where':{'id':_0x10f891[_0x2097('0x55')]['id']}})[_0x2097('0x33')](handleEntityNotFound(_0x2c6f24,null))[_0x2097('0x33')](function(_0x307c43){if(_0x307c43){_0x10f891[_0x2097('0x56')][_0x2097('0x5b')]=_0x307c43['id'];_0x10f891[_0x2097('0x56')][_0x2097('0x5c')]=integrations[_0x2097('0x5d')](_0x10f891[_0x2097('0x56')]['channel'],_0x10f891[_0x2097('0x56')][_0x2097('0x3b')]);_0x10f891[_0x2097('0x56')][_0x2097('0x5e')]=integrations[_0x2097('0x5f')](_0x10f891['body'][_0x2097('0x60')],_0x10f891[_0x2097('0x56')][_0x2097('0x3b')]);return db['SalesforceConfiguration'][_0x2097('0x54')](_0x10f891['body'],{'include':[{'model':db[_0x2097('0x61')],'as':'Subjects'},{'model':db[_0x2097('0x61')],'as':'Descriptions'}]});}return null;})[_0x2097('0x33')](respondWithResult(_0x2c6f24,null))['catch'](handleError(_0x2c6f24,null));};exports[_0x2097('0x62')]=function(_0x3dba80,_0x18f796,_0x183f34){var _0x28d925;var _0x5deddb='';var _0x2c447e=_0x2097('0x63');return db[_0x2097('0x39')][_0x2097('0x5a')]({'where':{'id':_0x3dba80[_0x2097('0x55')]['id']},'attributes':['id',_0x2097('0x64'),_0x2097('0x65'),_0x2097('0x66'),_0x2097('0x67'),_0x2097('0x68'),_0x2097('0x69')]})[_0x2097('0x33')](handleEntityNotFound(_0x18f796,null))[_0x2097('0x33')](function(_0xa53114){if(_0xa53114){_0x5deddb=_0xa53114[_0x2097('0x64')];var _0xf3831c=_0x5deddb['slice'](-0x1);if(_0xf3831c==='/'){_0x5deddb=_0x5deddb[_0x2097('0x6a')](0x0,_0x5deddb['lastIndexOf'](_0xf3831c));}_0x28d925=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5deddb,'clientId':_0xa53114[_0x2097('0x65')],'clientSecret':_0xa53114[_0x2097('0x66')]}});return _0x28d925[_0x2097('0x6b')](_0xa53114['username'],_0xa53114[_0x2097('0x68')][_0x2097('0x6c')](_0xa53114[_0x2097('0x69')]));}})[_0x2097('0x33')](function(_0x568a15){if(_0x568a15){if(!_[_0x2097('0x6d')](_0x3dba80['query'][_0x2097('0x6e')])){_0x2c447e=_0x3dba80[_0x2097('0x3e')][_0x2097('0x6e')];}return _0x28d925[_0x2097('0x6f')](_0x2c447e)['describe']();}})[_0x2097('0x33')](function(_0x28a3bf){var _0x31ec19=['CallDisposition',_0x2097('0x70'),_0x2097('0x71'),_0x2097('0x72'),'IsArchived',_0x2097('0x73'),_0x2097('0x74'),_0x2097('0x75')];if(!_[_0x2097('0x6d')](_0x3dba80[_0x2097('0x3e')][_0x2097('0x6e')])&&_0x3dba80['query']['ticketType']===_0x2097('0x76')){_0x31ec19=[_0x2097('0x75'),_0x2097('0x77'),_0x2097('0x78'),_0x2097('0x74'),_0x2097('0x73'),'IsEscalated',_0x2097('0x79'),_0x2097('0x7a')];}if(_0x28a3bf){_[_0x2097('0x7b')](_0x28a3bf[_0x2097('0x42')],function(_0x9b0763){return _0x9b0763[_0x2097('0x7c')]===![]&&!_0x31ec19[_0x2097('0x7d')](_0x9b0763['name']);});return{'count':_0x28a3bf[_0x2097('0x42')][_0x2097('0x43')],'rows':_[_0x2097('0x38')](_0x28a3bf[_0x2097('0x42')],function(_0x414efa){return{'id':_0x414efa[_0x2097('0x36')],'name':_0x414efa['label'],'custom':_0x414efa['custom'],'options':_0x414efa[_0x2097('0x7e')]['length']>0x0?_['map'](_0x414efa[_0x2097('0x7e')],function(_0x146470){return{'name':_0x146470[_0x2097('0x7f')],'value':_0x146470[_0x2097('0x80')]};}):_0x414efa[_0x2097('0x3b')]==_0x2097('0x81')?[{'name':_0x2097('0x82'),'value':_0x2097('0x83')},{'name':'False','value':_0x2097('0x84')}]:[]};})};}})[_0x2097('0x33')](respondWithResult(_0x18f796,null))[_0x2097('0x28')](function(_0x3b988f){var _0x3155f6=_0x3dba80['query'][_0x2097('0x85')]?0x1f4:_0x3b988f[_0x2097('0x86')]||0x1f4;logger[_0x2097('0x24')](_0x2097('0x87'),_0x2097('0x62'),_0x3155f6,JSON[_0x2097('0x23')](_0x3b988f));delete _0x3b988f['name'];if(_0x3155f6===0x191){_0x3155f6=0x190;}_0x18f796[_0x2097('0x29')](_0x3155f6)[_0x2097('0x37')](_0x3dba80['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3b988f['statusCode']}:_0x3b988f);});}; \ No newline at end of file +var _0x0abf=['code','message','result','catch','end','json','offset','limit','status','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','SalesforceAccount','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Type','Case','Reason','IsEscalated','custom','includes','picklistValues','label','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0xf0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0ab('0x1'));var zipdir=require(_0xf0ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ab('0x4'));var util=require(_0xf0ab('0x5'));var path=require(_0xf0ab('0x6'));var sox=require(_0xf0ab('0x7'));var csv=require(_0xf0ab('0x8'));var ejs=require(_0xf0ab('0x9'));var fs=require('fs');var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];var integrations=require(_0xf0ab('0x17'));var jayson=require(_0xf0ab('0x18'));var client=jayson['client'][_0xf0ab('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2cc002,_0x1913fe,_0x35c75f,_0x1824ef){return new BPromise(function(_0x36cabe,_0x3d7129){var _0x1fb4e5=_0x1824ef||client;return _0x1fb4e5[_0xf0ab('0x1a')](_0x2cc002,_0x35c75f)[_0xf0ab('0x1b')](function(_0x20f453){logger[_0xf0ab('0x1c')](_0xf0ab('0x1d'),_0x1913fe,_0xf0ab('0x1e'));logger[_0xf0ab('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1913fe,_0xf0ab('0x1e'),JSON[_0xf0ab('0x20')](_0x20f453));if(_0x20f453[_0xf0ab('0x21')]){if(_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x22')]===0x1f4){logger[_0xf0ab('0x21')](_0xf0ab('0x1d'),_0x1913fe,_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x23')]);return _0x3d7129(_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x23')]);}logger[_0xf0ab('0x21')](_0xf0ab('0x1d'),_0x1913fe,_0x20f453[_0xf0ab('0x21')][_0xf0ab('0x23')]);return _0x36cabe(_0x20f453[_0xf0ab('0x21')]['message']);}else{logger[_0xf0ab('0x1c')](_0xf0ab('0x1d'),_0x1913fe,_0xf0ab('0x1e'));_0x36cabe(_0x20f453[_0xf0ab('0x24')][_0xf0ab('0x23')]);}})[_0xf0ab('0x25')](function(_0x250317){logger[_0xf0ab('0x21')](_0xf0ab('0x1d'),_0x1913fe,_0x250317);_0x3d7129(_0x250317);});});}function respondWithStatusCode(_0x18bb37,_0x43119f){_0x43119f=_0x43119f||0xcc;return function(_0x5645b2){if(_0x5645b2){return _0x18bb37['sendStatus'](_0x43119f);}return _0x18bb37['status'](_0x43119f)[_0xf0ab('0x26')]();};}function respondWithResult(_0x4f0caf,_0x3eca32){_0x3eca32=_0x3eca32||0xc8;return function(_0x16b979){if(_0x16b979){return _0x4f0caf['status'](_0x3eca32)[_0xf0ab('0x27')](_0x16b979);}};}function respondWithFilteredResult(_0x22671e,_0x10bf5f){return function(_0x38fb71){if(_0x38fb71){var _0x7d4ff9=_0x38fb71['count'],_0x502921=_0x10bf5f[_0xf0ab('0x28')],_0x2d0da7=_0x10bf5f[_0xf0ab('0x28')]+_0x10bf5f[_0xf0ab('0x29')],_0x574ce7;if(_0x2d0da7>=_0x7d4ff9){_0x2d0da7=_0x7d4ff9;_0x574ce7=0xc8;}else{_0x574ce7=0xce;}_0x22671e[_0xf0ab('0x2a')](_0x574ce7);return _0x22671e[_0xf0ab('0x2b')](_0xf0ab('0x2c'),_0x502921+'-'+_0x2d0da7+'/'+_0x7d4ff9)[_0xf0ab('0x27')](_0x38fb71);}return null;};}function patchUpdates(_0x14da9c){return function(_0x76a3f3){try{jsonpatch[_0xf0ab('0x2d')](_0x76a3f3,_0x14da9c,!![]);}catch(_0x21e8ac){return BPromise[_0xf0ab('0x2e')](_0x21e8ac);}return _0x76a3f3['save']();};}function saveUpdates(_0x1e1ffb,_0x35973a){return function(_0x5e073a){if(_0x5e073a){return _0x5e073a['update'](_0x1e1ffb)[_0xf0ab('0x1b')](function(_0x1dc84e){return _0x1dc84e;});}return null;};}function removeEntity(_0x43e500,_0x4dd5b7){return function(_0x58efce){if(_0x58efce){return _0x58efce[_0xf0ab('0x2f')]()['then'](function(){_0x43e500[_0xf0ab('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f66fa,_0x9b16fa){return function(_0x5074c9){if(!_0x5074c9){_0x3f66fa['sendStatus'](0x194);}return _0x5074c9;};}function handleError(_0x469f42,_0x27c6f9){_0x27c6f9=_0x27c6f9||0x1f4;return function(_0x2a3fac){logger[_0xf0ab('0x21')](_0x2a3fac[_0xf0ab('0x30')]);if(_0x2a3fac[_0xf0ab('0x31')]){delete _0x2a3fac[_0xf0ab('0x31')];}_0x469f42[_0xf0ab('0x2a')](_0x27c6f9)[_0xf0ab('0x32')](_0x2a3fac);};}exports[_0xf0ab('0x33')]=function(_0x2c88d0,_0x2ad3e2){var _0x22dcfe={},_0x437fdb={},_0x5d8443={'count':0x0,'rows':[]};var _0x391fc0=_[_0xf0ab('0x34')](db[_0xf0ab('0x35')]['rawAttributes'],function(_0x9e38af){return{'name':_0x9e38af[_0xf0ab('0x36')],'type':_0x9e38af[_0xf0ab('0x37')]['key']};});_0x437fdb[_0xf0ab('0x38')]=_['map'](_0x391fc0,_0xf0ab('0x31'));_0x437fdb['query']=_[_0xf0ab('0x39')](_0x2c88d0[_0xf0ab('0x3a')]);_0x437fdb[_0xf0ab('0x3b')]=_[_0xf0ab('0x3c')](_0x437fdb[_0xf0ab('0x38')],_0x437fdb[_0xf0ab('0x3a')]);_0x22dcfe['attributes']=_[_0xf0ab('0x3c')](_0x437fdb[_0xf0ab('0x38')],qs['fields'](_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x3d')]));_0x22dcfe[_0xf0ab('0x3e')]=_0x22dcfe[_0xf0ab('0x3e')][_0xf0ab('0x3f')]?_0x22dcfe[_0xf0ab('0x3e')]:_0x437fdb[_0xf0ab('0x38')];if(!_0x2c88d0['query'][_0xf0ab('0x40')](_0xf0ab('0x41'))){_0x22dcfe[_0xf0ab('0x29')]=qs['limit'](_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x29')]);_0x22dcfe[_0xf0ab('0x28')]=qs[_0xf0ab('0x28')](_0x2c88d0[_0xf0ab('0x3a')]['offset']);}_0x22dcfe[_0xf0ab('0x42')]=qs[_0xf0ab('0x43')](_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x43')]);_0x22dcfe[_0xf0ab('0x44')]=qs[_0xf0ab('0x3b')](_[_0xf0ab('0x45')](_0x2c88d0[_0xf0ab('0x3a')],_0x437fdb[_0xf0ab('0x3b')]),_0x391fc0);if(_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x46')]){_0x22dcfe[_0xf0ab('0x44')]=_[_0xf0ab('0x47')](_0x22dcfe['where'],{'$or':_['map'](_0x391fc0,function(_0x2fc677){if(_0x2fc677['type']!==_0xf0ab('0x48')){var _0x2d50c0={};_0x2d50c0[_0x2fc677['name']]={'$like':'%'+_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x46')]+'%'};return _0x2d50c0;}})});}_0x22dcfe=_['merge']({},_0x22dcfe,_0x2c88d0[_0xf0ab('0x49')]);var _0x29cc6a={'where':_0x22dcfe[_0xf0ab('0x44')]};return db[_0xf0ab('0x35')][_0xf0ab('0x4a')](_0x29cc6a)[_0xf0ab('0x1b')](function(_0x198cc3){_0x5d8443[_0xf0ab('0x4a')]=_0x198cc3;if(_0x2c88d0[_0xf0ab('0x3a')][_0xf0ab('0x4b')]){_0x22dcfe[_0xf0ab('0x4c')]=[{'all':!![]}];}return db[_0xf0ab('0x35')][_0xf0ab('0x4d')](_0x22dcfe);})[_0xf0ab('0x1b')](function(_0x58fea3){_0x5d8443['rows']=_0x58fea3;return _0x5d8443;})[_0xf0ab('0x1b')](respondWithFilteredResult(_0x2ad3e2,_0x22dcfe))['catch'](handleError(_0x2ad3e2,null));};exports['show']=function(_0x4e57d3,_0xc3b68d){var _0x45b32c={'raw':![],'where':{'id':_0x4e57d3[_0xf0ab('0x4e')]['id']}},_0x3d9e70={};_0x3d9e70[_0xf0ab('0x38')]=_[_0xf0ab('0x39')](db[_0xf0ab('0x35')][_0xf0ab('0x4f')]);_0x3d9e70[_0xf0ab('0x3a')]=_[_0xf0ab('0x39')](_0x4e57d3[_0xf0ab('0x3a')]);_0x3d9e70[_0xf0ab('0x3b')]=_['intersection'](_0x3d9e70[_0xf0ab('0x38')],_0x3d9e70[_0xf0ab('0x3a')]);_0x45b32c[_0xf0ab('0x3e')]=_[_0xf0ab('0x3c')](_0x3d9e70[_0xf0ab('0x38')],qs[_0xf0ab('0x3d')](_0x4e57d3[_0xf0ab('0x3a')][_0xf0ab('0x3d')]));_0x45b32c['attributes']=_0x45b32c['attributes']['length']?_0x45b32c[_0xf0ab('0x3e')]:_0x3d9e70[_0xf0ab('0x38')];if(_0x4e57d3['query'][_0xf0ab('0x4b')]){_0x45b32c[_0xf0ab('0x4c')]=[{'all':!![]}];}_0x45b32c=_['merge']({},_0x45b32c,_0x4e57d3[_0xf0ab('0x49')]);return db[_0xf0ab('0x35')][_0xf0ab('0x50')](_0x45b32c)[_0xf0ab('0x1b')](handleEntityNotFound(_0xc3b68d,null))[_0xf0ab('0x1b')](respondWithResult(_0xc3b68d,null))[_0xf0ab('0x25')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x51')]=function(_0x4d1606,_0x3be796){return db['SalesforceAccount'][_0xf0ab('0x51')](_0x4d1606['body'],{})[_0xf0ab('0x1b')](respondWithResult(_0x3be796,0xc9))['catch'](handleError(_0x3be796,null));};exports['update']=function(_0x1e3b91,_0x58ac39){if(_0x1e3b91[_0xf0ab('0x52')]['id']){delete _0x1e3b91['body']['id'];}return db[_0xf0ab('0x35')]['find']({'where':{'id':_0x1e3b91[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x58ac39,null))[_0xf0ab('0x1b')](saveUpdates(_0x1e3b91['body'],null))['then'](respondWithResult(_0x58ac39,null))['catch'](handleError(_0x58ac39,null));};exports[_0xf0ab('0x2f')]=function(_0x421d93,_0x57d6c3){return db['SalesforceAccount'][_0xf0ab('0x50')]({'where':{'id':_0x421d93[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x57d6c3,null))[_0xf0ab('0x1b')](removeEntity(_0x57d6c3,null))[_0xf0ab('0x25')](handleError(_0x57d6c3,null));};exports[_0xf0ab('0x53')]=function(_0x2d3aa8,_0x3bc749,_0x1d7616){var _0x1f180f={};var _0x1e6a4e={};var _0x4d80a6;var _0x41ed17;return db['SalesforceAccount'][_0xf0ab('0x54')]({'where':{'id':_0x2d3aa8[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x3bc749,null))[_0xf0ab('0x1b')](function(_0x3e1b85){if(_0x3e1b85){_0x4d80a6=_0x3e1b85;_0x1e6a4e[_0xf0ab('0x38')]=_[_0xf0ab('0x39')](db[_0xf0ab('0x55')][_0xf0ab('0x4f')]);_0x1e6a4e[_0xf0ab('0x3a')]=_['keys'](_0x2d3aa8[_0xf0ab('0x3a')]);_0x1e6a4e[_0xf0ab('0x3b')]=_[_0xf0ab('0x3c')](_0x1e6a4e[_0xf0ab('0x38')],_0x1e6a4e[_0xf0ab('0x3a')]);_0x1f180f[_0xf0ab('0x3e')]=_[_0xf0ab('0x3c')](_0x1e6a4e[_0xf0ab('0x38')],qs[_0xf0ab('0x3d')](_0x2d3aa8['query']['fields']));_0x1f180f[_0xf0ab('0x3e')]=_0x1f180f[_0xf0ab('0x3e')][_0xf0ab('0x3f')]?_0x1f180f['attributes']:_0x1e6a4e[_0xf0ab('0x38')];_0x1f180f[_0xf0ab('0x42')]=qs[_0xf0ab('0x43')](_0x2d3aa8['query'][_0xf0ab('0x43')]);_0x1f180f[_0xf0ab('0x44')]=qs[_0xf0ab('0x3b')](_[_0xf0ab('0x45')](_0x2d3aa8[_0xf0ab('0x3a')],_0x1e6a4e['filters']));if(_0x2d3aa8[_0xf0ab('0x3a')][_0xf0ab('0x46')]){_0x1f180f[_0xf0ab('0x44')]=_[_0xf0ab('0x47')](_0x1f180f[_0xf0ab('0x44')],{'$or':_[_0xf0ab('0x34')](_0x1f180f[_0xf0ab('0x3e')],function(_0x2b0b89){var _0x2d9194={};_0x2d9194[_0x2b0b89]={'$like':'%'+_0x2d3aa8[_0xf0ab('0x3a')][_0xf0ab('0x46')]+'%'};return _0x2d9194;})});}_0x1f180f=_[_0xf0ab('0x47')]({},_0x1f180f,_0x2d3aa8[_0xf0ab('0x49')]);return _0x4d80a6['getConfigurations'](_0x1f180f);}})['then'](function(_0x3e1f1e){if(_0x3e1f1e){_0x41ed17=_0x3e1f1e[_0xf0ab('0x3f')];if(!_0x2d3aa8[_0xf0ab('0x3a')]['hasOwnProperty'](_0xf0ab('0x41'))){_0x1f180f['limit']=qs[_0xf0ab('0x29')](_0x2d3aa8[_0xf0ab('0x3a')][_0xf0ab('0x29')]);_0x1f180f['offset']=qs[_0xf0ab('0x28')](_0x2d3aa8['query']['offset']);}return _0x4d80a6[_0xf0ab('0x53')](_0x1f180f);}})[_0xf0ab('0x1b')](function(_0x283426){if(_0x283426){return _0x283426?{'count':_0x41ed17,'rows':_0x283426}:null;}})['then'](respondWithResult(_0x3bc749,null))[_0xf0ab('0x25')](handleError(_0x3bc749,null));};exports[_0xf0ab('0x56')]=function(_0x1035b3,_0x122c41,_0x5b6923){if(_0x1035b3['body']['id']){delete _0x1035b3['body']['id'];}return db[_0xf0ab('0x35')][_0xf0ab('0x54')]({'where':{'id':_0x1035b3[_0xf0ab('0x4e')]['id']}})[_0xf0ab('0x1b')](handleEntityNotFound(_0x122c41,null))[_0xf0ab('0x1b')](function(_0x1c6163){if(_0x1c6163){_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x57')]=_0x1c6163['id'];_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x58')]=integrations[_0xf0ab('0x59')](_0x1035b3['body'][_0xf0ab('0x5a')],_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x37')]);_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x5b')]=integrations[_0xf0ab('0x5c')](_0x1035b3[_0xf0ab('0x52')][_0xf0ab('0x5a')],_0x1035b3['body'][_0xf0ab('0x37')]);return db[_0xf0ab('0x55')]['create'](_0x1035b3['body'],{'include':[{'model':db['SalesforceField'],'as':_0xf0ab('0x58')},{'model':db[_0xf0ab('0x5d')],'as':_0xf0ab('0x5b')}]});}return null;})[_0xf0ab('0x1b')](respondWithResult(_0x122c41,null))[_0xf0ab('0x25')](handleError(_0x122c41,null));};exports[_0xf0ab('0x5e')]=function(_0x4d011e,_0x1053c0,_0x5e7d84){var _0x208032;var _0x5d5bb0='';var _0x2978a9='Task';return db[_0xf0ab('0x35')]['findOne']({'where':{'id':_0x4d011e['params']['id']},'attributes':['id',_0xf0ab('0x5f'),_0xf0ab('0x60'),_0xf0ab('0x61'),_0xf0ab('0x62'),_0xf0ab('0x63'),_0xf0ab('0x64')]})[_0xf0ab('0x1b')](handleEntityNotFound(_0x1053c0,null))[_0xf0ab('0x1b')](function(_0x23ba05){if(_0x23ba05){_0x5d5bb0=_0x23ba05[_0xf0ab('0x5f')];var _0x1650c0=_0x5d5bb0[_0xf0ab('0x65')](-0x1);if(_0x1650c0==='/'){_0x5d5bb0=_0x5d5bb0[_0xf0ab('0x66')](0x0,_0x5d5bb0['lastIndexOf'](_0x1650c0));}_0x208032=new jsforce[(_0xf0ab('0x67'))]({'oauth2':{'loginUrl':_0x5d5bb0,'clientId':_0x23ba05[_0xf0ab('0x60')],'clientSecret':_0x23ba05[_0xf0ab('0x61')]}});return _0x208032[_0xf0ab('0x68')](_0x23ba05[_0xf0ab('0x62')],_0x23ba05[_0xf0ab('0x63')][_0xf0ab('0x69')](_0x23ba05[_0xf0ab('0x64')]));}})[_0xf0ab('0x1b')](function(_0x3c184d){if(_0x3c184d){if(!_[_0xf0ab('0x6a')](_0x4d011e[_0xf0ab('0x3a')]['ticketType'])){_0x2978a9=_0x4d011e[_0xf0ab('0x3a')][_0xf0ab('0x6b')];}return _0x208032[_0xf0ab('0x6c')](_0x2978a9)[_0xf0ab('0x6d')]();}})['then'](function(_0x1afade){var _0x177f79=[_0xf0ab('0x6e'),_0xf0ab('0x6f'),_0xf0ab('0x70'),'CallType',_0xf0ab('0x71'),_0xf0ab('0x72'),'Status',_0xf0ab('0x73')];if(!_['isNil'](_0x4d011e[_0xf0ab('0x3a')][_0xf0ab('0x6b')])&&_0x4d011e['query'][_0xf0ab('0x6b')]===_0xf0ab('0x74')){_0x177f79=['Type','Origin',_0xf0ab('0x75'),'Status',_0xf0ab('0x72'),_0xf0ab('0x76'),'SuppliedName','SuppliedCompany'];}if(_0x1afade){_['remove'](_0x1afade[_0xf0ab('0x3d')],function(_0x7e2b70){return _0x7e2b70[_0xf0ab('0x77')]===![]&&!_0x177f79[_0xf0ab('0x78')](_0x7e2b70['name']);});return{'count':_0x1afade[_0xf0ab('0x3d')][_0xf0ab('0x3f')],'rows':_[_0xf0ab('0x34')](_0x1afade[_0xf0ab('0x3d')],function(_0x1d6a63){return{'id':_0x1d6a63['name'],'name':_0x1d6a63['label'],'custom':_0x1d6a63[_0xf0ab('0x77')],'options':_0x1d6a63[_0xf0ab('0x79')]['length']>0x0?_['map'](_0x1d6a63[_0xf0ab('0x79')],function(_0x36ac93){return{'name':_0x36ac93[_0xf0ab('0x7a')],'value':_0x36ac93[_0xf0ab('0x7b')]};}):_0x1d6a63[_0xf0ab('0x37')]==_0xf0ab('0x7c')?[{'name':_0xf0ab('0x7d'),'value':_0xf0ab('0x7e')},{'name':_0xf0ab('0x7f'),'value':_0xf0ab('0x80')}]:[]};})};}})[_0xf0ab('0x1b')](respondWithResult(_0x1053c0,null))['catch'](function(_0x4c502c){var _0x19ff3c=_0x4d011e['query'][_0xf0ab('0x81')]?0x1f4:_0x4c502c[_0xf0ab('0x82')]||0x1f4;logger[_0xf0ab('0x21')](_0xf0ab('0x83'),'getFields',_0x19ff3c,JSON[_0xf0ab('0x20')](_0x4c502c));delete _0x4c502c[_0xf0ab('0x31')];if(_0x19ff3c===0x191){_0x19ff3c=0x190;}_0x1053c0[_0xf0ab('0x2a')](_0x19ff3c)[_0xf0ab('0x32')](_0x4d011e[_0xf0ab('0x3a')][_0xf0ab('0x81')]?{'message':_0xf0ab('0x84'),'statusCode':_0x4c502c[_0xf0ab('0x82')]}:_0x4c502c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fead95f..05a54c9 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 _0x605a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts'];(function(_0x34b6cb,_0x5936da){var _0x226d92=function(_0x531e18){while(--_0x531e18){_0x34b6cb['push'](_0x34b6cb['shift']());}};_0x226d92(++_0x5936da);}(_0x605a,0x126));var _0xa605=function(_0x172059,_0x4e4dfb){_0x172059=_0x172059-0x0;var _0x22f935=_0x605a[_0x172059];return _0x22f935;};'use strict';var _=require(_0xa605('0x0'));var util=require(_0xa605('0x1'));var logger=require(_0xa605('0x2'))(_0xa605('0x3'));var moment=require(_0xa605('0x4'));var BPromise=require(_0xa605('0x5'));var rp=require(_0xa605('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa605('0x7'));var config=require(_0xa605('0x8'));var attributes=require(_0xa605('0x9'));var integrations=require(_0xa605('0xa'));module[_0xa605('0xb')]=function(_0xb757f5,_0x35e9db){return _0xb757f5[_0xa605('0xc')]('SalesforceAccount',attributes,{'tableName':_0xa605('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d8b=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x2bbab7,_0x33ae63){var _0x127b26=function(_0x49a1ab){while(--_0x49a1ab){_0x2bbab7['push'](_0x2bbab7['shift']());}};_0x127b26(++_0x33ae63);}(_0x2d8b,0x91));var _0xb2d8=function(_0x19ee61,_0x19e985){_0x19ee61=_0x19ee61-0x0;var _0x3f97da=_0x2d8b[_0x19ee61];return _0x3f97da;};'use strict';var _=require(_0xb2d8('0x0'));var util=require(_0xb2d8('0x1'));var logger=require(_0xb2d8('0x2'))(_0xb2d8('0x3'));var moment=require(_0xb2d8('0x4'));var BPromise=require(_0xb2d8('0x5'));var rp=require(_0xb2d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2d8('0x7'));var config=require(_0xb2d8('0x8'));var attributes=require(_0xb2d8('0x9'));var integrations=require(_0xb2d8('0xa'));module[_0xb2d8('0xb')]=function(_0x548f8c,_0x1094f8){return _0x548f8c['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index c09a85b..40dd964 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 _0xe14d=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x562914,_0x5d1db2){var _0x5306ec=function(_0x3a7e87){while(--_0x3a7e87){_0x562914['push'](_0x562914['shift']());}};_0x5306ec(++_0x5d1db2);}(_0xe14d,0x1ee));var _0xde14=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe14d[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')]({'raw':_0x3cc317[_0xde14('0x1c')]?_0x3cc317['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cc317['options']?_0x3cc317[_0xde14('0x1c')]['where']||null:null,'attributes':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1e')]||null:null,'limit':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1f')]||null:null,'include':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')]?_[_0xde14('0x21')](_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')],function(_0x8f8033){return{'model':db[_0x8f8033['model']],'as':_0x8f8033['as'],'attributes':_0x8f8033[_0xde14('0x1e')],'include':_0x8f8033[_0xde14('0x20')]?_[_0xde14('0x21')](_0x8f8033[_0xde14('0x20')],function(_0x1bb7be){return{'model':db[_0x1bb7be[_0xde14('0x22')]],'as':_0x1bb7be['as'],'attributes':_0x1bb7be[_0xde14('0x1e')],'include':_0x1bb7be[_0xde14('0x20')]?_[_0xde14('0x21')](_0x1bb7be[_0xde14('0x20')],function(_0x4eff65){return{'model':db[_0x4eff65[_0xde14('0x22')]],'as':_0x4eff65['as'],'attributes':_0x4eff65[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0xf8279a){logger['info'](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON['stringify'](_0xf8279a));_0x590a8b(_0xf8279a);})[_0xde14('0x18')](function(_0x582537){logger[_0xde14('0x14')](_0xde14('0x19'),_0x582537[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x582537[_0xde14('0x16')]));});});};exports[_0xde14('0x23')]=function(_0xae9dca){var _0x464666=this;return new Promise(function(_0x4e7c5b,_0xbfc01b){return db[_0xde14('0x1a')]['find']({'raw':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0xae9dca[_0xde14('0x1c')]?_0xae9dca[_0xde14('0x1c')][_0xde14('0x24')]||null:null,'attributes':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1e')]||null:null,'include':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x20')]?_[_0xde14('0x21')](_0xae9dca[_0xde14('0x1c')][_0xde14('0x20')],function(_0x2713fb){return{'model':db[_0x2713fb[_0xde14('0x22')]],'as':_0x2713fb['as'],'attributes':_0x2713fb[_0xde14('0x1e')],'include':_0x2713fb[_0xde14('0x20')]?_[_0xde14('0x21')](_0x2713fb['include'],function(_0x50084f){return{'model':db[_0x50084f[_0xde14('0x22')]],'as':_0x50084f['as'],'attributes':_0x50084f[_0xde14('0x1e')],'include':_0x50084f[_0xde14('0x20')]?_[_0xde14('0x21')](_0x50084f[_0xde14('0x20')],function(_0x23813f){return{'model':db[_0x23813f[_0xde14('0x22')]],'as':_0x23813f['as'],'attributes':_0x23813f[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0x4e33e0){logger[_0xde14('0xe')]('ShowSalesforceAccount',_0xae9dca);logger['debug']('ShowSalesforceAccount',_0xae9dca,JSON[_0xde14('0x13')](_0x4e33e0));_0x4e7c5b(_0x4e33e0);})[_0xde14('0x18')](function(_0x398f63){logger[_0xde14('0x14')](_0xde14('0x23'),_0x398f63[_0xde14('0x16')],_0xae9dca);_0xbfc01b(_0x464666[_0xde14('0x14')](0x1f4,_0x398f63[_0xde14('0x16')]));});});}; \ No newline at end of file +var _0xb469=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','stringify','catch','ShowSalesforceAccount','SalesforceAccount','find','where'];(function(_0x42297e,_0x325958){var _0x149681=function(_0x96af11){while(--_0x96af11){_0x42297e['push'](_0x42297e['shift']());}};_0x149681(++_0x325958);}(_0xb469,0x13b));var _0x9b46=function(_0x31e0bb,_0x3a675d){_0x31e0bb=_0x31e0bb-0x0;var _0x31a01d=_0xb469[_0x31e0bb];return _0x31a01d;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});}exports[_0x9b46('0x14')]=function(_0x5c5cc9){var _0x5dd7bd=this;return new Promise(function(_0x3d9efa,_0x4ccfd0){return db['SalesforceAccount'][_0x9b46('0x15')]({'raw':_0x5c5cc9[_0x9b46('0x16')]?_0x5c5cc9['options'][_0x9b46('0x17')]===undefined?!![]:![]:!![],'where':_0x5c5cc9[_0x9b46('0x16')]?_0x5c5cc9['options']['where']||null:null,'attributes':_0x5c5cc9[_0x9b46('0x16')]?_0x5c5cc9[_0x9b46('0x16')][_0x9b46('0x18')]||null:null,'limit':_0x5c5cc9['options']?_0x5c5cc9['options'][_0x9b46('0x19')]||null:null,'include':_0x5c5cc9['options']?_0x5c5cc9[_0x9b46('0x16')][_0x9b46('0x1a')]?_['map'](_0x5c5cc9[_0x9b46('0x16')]['include'],function(_0x141cb6){return{'model':db[_0x141cb6[_0x9b46('0x1b')]],'as':_0x141cb6['as'],'attributes':_0x141cb6['attributes'],'include':_0x141cb6[_0x9b46('0x1a')]?_[_0x9b46('0x1c')](_0x141cb6[_0x9b46('0x1a')],function(_0x319930){return{'model':db[_0x319930[_0x9b46('0x1b')]],'as':_0x319930['as'],'attributes':_0x319930[_0x9b46('0x18')],'include':_0x319930[_0x9b46('0x1a')]?_['map'](_0x319930[_0x9b46('0x1a')],function(_0x3ac37e){return{'model':db[_0x3ac37e[_0x9b46('0x1b')]],'as':_0x3ac37e['as'],'attributes':_0x3ac37e[_0x9b46('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9b46('0xc')](function(_0x2a79a5){logger[_0x9b46('0x12')]('GetSalesforceAccount',_0x5c5cc9);logger[_0x9b46('0xe')](_0x9b46('0x14'),_0x5c5cc9,JSON[_0x9b46('0x1d')](_0x2a79a5));_0x3d9efa(_0x2a79a5);})[_0x9b46('0x1e')](function(_0x28b289){logger[_0x9b46('0x10')](_0x9b46('0x14'),_0x28b289[_0x9b46('0x11')],_0x5c5cc9);_0x4ccfd0(_0x5dd7bd[_0x9b46('0x10')](0x1f4,_0x28b289[_0x9b46('0x11')]));});});};exports[_0x9b46('0x1f')]=function(_0x5ab8b7){var _0x1f722d=this;return new Promise(function(_0x27f326,_0x807f2){return db[_0x9b46('0x20')][_0x9b46('0x21')]({'raw':_0x5ab8b7[_0x9b46('0x16')]?_0x5ab8b7[_0x9b46('0x16')][_0x9b46('0x17')]===undefined?!![]:![]:!![],'where':_0x5ab8b7[_0x9b46('0x16')]?_0x5ab8b7[_0x9b46('0x16')][_0x9b46('0x22')]||null:null,'attributes':_0x5ab8b7['options']?_0x5ab8b7[_0x9b46('0x16')]['attributes']||null:null,'include':_0x5ab8b7[_0x9b46('0x16')]?_0x5ab8b7[_0x9b46('0x16')][_0x9b46('0x1a')]?_['map'](_0x5ab8b7[_0x9b46('0x16')][_0x9b46('0x1a')],function(_0x37de29){return{'model':db[_0x37de29[_0x9b46('0x1b')]],'as':_0x37de29['as'],'attributes':_0x37de29[_0x9b46('0x18')],'include':_0x37de29['include']?_['map'](_0x37de29[_0x9b46('0x1a')],function(_0x33f3f7){return{'model':db[_0x33f3f7[_0x9b46('0x1b')]],'as':_0x33f3f7['as'],'attributes':_0x33f3f7[_0x9b46('0x18')],'include':_0x33f3f7['include']?_[_0x9b46('0x1c')](_0x33f3f7['include'],function(_0x1ebfd1){return{'model':db[_0x1ebfd1[_0x9b46('0x1b')]],'as':_0x1ebfd1['as'],'attributes':_0x1ebfd1[_0x9b46('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9b46('0xc')](function(_0x5645f2){logger[_0x9b46('0x12')]('ShowSalesforceAccount',_0x5ab8b7);logger[_0x9b46('0xe')](_0x9b46('0x1f'),_0x5ab8b7,JSON[_0x9b46('0x1d')](_0x5645f2));_0x27f326(_0x5645f2);})[_0x9b46('0x1e')](function(_0x94c802){logger[_0x9b46('0x10')](_0x9b46('0x1f'),_0x94c802[_0x9b46('0x11')],_0x5ab8b7);_0x807f2(_0x1f722d[_0x9b46('0x10')](0x1f4,_0x94c802[_0x9b46('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1705584..e26bd16 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 _0xd902=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x190367,_0x1cf9ca){var _0x3c3e3c=function(_0x550392){while(--_0x550392){_0x190367['push'](_0x190367['shift']());}};_0x3c3e3c(++_0x1cf9ca);}(_0xd902,0x95));var _0x2d90=function(_0x528b92,_0x2a3971){_0x528b92=_0x528b92-0x0;var _0x171eba=_0xd902[_0x528b92];return _0x171eba;};'use strict';var multer=require(_0x2d90('0x0'));var util=require('util');var path=require(_0x2d90('0x1'));var timeout=require(_0x2d90('0x2'));var express=require(_0x2d90('0x3'));var router=express[_0x2d90('0x4')]();var auth=require(_0x2d90('0x5'));var interaction=require(_0x2d90('0x6'));var config=require('../../config/environment');var controller=require(_0x2d90('0x7'));router[_0x2d90('0x8')]('/',auth[_0x2d90('0x9')](),controller[_0x2d90('0xa')]);router[_0x2d90('0x8')](_0x2d90('0xb'),auth['isAuthenticated'](),controller[_0x2d90('0xc')]);router[_0x2d90('0x8')]('/:id/fields',auth[_0x2d90('0x9')](),controller[_0x2d90('0xd')]);router['get'](_0x2d90('0xe'),auth['isAuthenticated'](),controller[_0x2d90('0xf')]);router[_0x2d90('0x8')](_0x2d90('0x10'),auth[_0x2d90('0x9')](),controller[_0x2d90('0x11')]);router[_0x2d90('0x12')]('/',auth[_0x2d90('0x9')](),controller[_0x2d90('0x13')]);router[_0x2d90('0x14')](_0x2d90('0xb'),auth[_0x2d90('0x9')](),controller['update']);router['delete'](_0x2d90('0xb'),auth[_0x2d90('0x9')](),controller[_0x2d90('0x15')]);module[_0x2d90('0x16')]=router; \ No newline at end of file +var _0x7388=['/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7388,0x1a7));var _0x8738=function(_0x44330c,_0x531446){_0x44330c=_0x44330c-0x0;var _0x3e94b1=_0x7388[_0x44330c];return _0x3e94b1;};'use strict';var multer=require(_0x8738('0x0'));var util=require(_0x8738('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8738('0x2'));var router=express['Router']();var auth=require(_0x8738('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8738('0x4'));var controller=require(_0x8738('0x5'));router[_0x8738('0x6')]('/',auth['isAuthenticated'](),controller[_0x8738('0x7')]);router['get']('/:id',auth[_0x8738('0x8')](),controller[_0x8738('0x9')]);router[_0x8738('0x6')](_0x8738('0xa'),auth[_0x8738('0x8')](),controller[_0x8738('0xb')]);router[_0x8738('0x6')](_0x8738('0xc'),auth[_0x8738('0x8')](),controller[_0x8738('0xd')]);router[_0x8738('0x6')](_0x8738('0xe'),auth[_0x8738('0x8')](),controller[_0x8738('0xf')]);router[_0x8738('0x10')]('/',auth[_0x8738('0x8')](),controller[_0x8738('0x11')]);router['put'](_0x8738('0x12'),auth[_0x8738('0x8')](),controller[_0x8738('0x13')]);router[_0x8738('0x14')](_0x8738('0x12'),auth['isAuthenticated'](),controller[_0x8738('0x15')]);module[_0x8738('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2a32bc3..9a63a6c 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 _0xf422=['nothing','exports','STRING','ENUM','Task','Case','contact_lead','lead'];(function(_0x41044b,_0x43aa46){var _0x42a745=function(_0x1d2505){while(--_0x1d2505){_0x41044b['push'](_0x41044b['shift']());}};_0x42a745(++_0x43aa46);}(_0xf422,0x129));var _0x2f42=function(_0x25f51e,_0x5f2a46){_0x25f51e=_0x25f51e-0x0;var _0x29c8ed=_0xf422[_0x25f51e];return _0x29c8ed;};'use strict';var Sequelize=require('sequelize');module[_0x2f42('0x0')]={'name':{'type':Sequelize[_0x2f42('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2f42('0x2')](_0x2f42('0x3'),_0x2f42('0x4')),'defaultValue':_0x2f42('0x3')},'moduleSearch':{'type':Sequelize[_0x2f42('0x2')](_0x2f42('0x5'),'contact',_0x2f42('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2f42('0x2')](_0x2f42('0x7'),'contact',_0x2f42('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x8f21=['nothing','contact','exports','STRING','ENUM','Task','Case','contact_lead','lead'];(function(_0xd1b086,_0x526d33){var _0x3ff0b1=function(_0x170d3f){while(--_0x170d3f){_0xd1b086['push'](_0xd1b086['shift']());}};_0x3ff0b1(++_0x526d33);}(_0x8f21,0x1d6));var _0x18f2=function(_0x50dc01,_0x20e95a){_0x50dc01=_0x50dc01-0x0;var _0x2f1895=_0x8f21[_0x50dc01];return _0x2f1895;};'use strict';var Sequelize=require('sequelize');module[_0x18f2('0x0')]={'name':{'type':Sequelize[_0x18f2('0x1')]},'description':{'type':Sequelize[_0x18f2('0x1')]},'ticketType':{'type':Sequelize[_0x18f2('0x2')](_0x18f2('0x3'),_0x18f2('0x4')),'defaultValue':_0x18f2('0x3')},'moduleSearch':{'type':Sequelize[_0x18f2('0x2')](_0x18f2('0x5'),'contact',_0x18f2('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x18f2('0x7'),_0x18f2('0x8'),_0x18f2('0x6')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 42eb2ed..558ab4c 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 _0x71c5=['end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','update','body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status'];(function(_0x18d35e,_0x1a23c5){var _0x313618=function(_0x5d98c7){while(--_0x5d98c7){_0x18d35e['push'](_0x18d35e['shift']());}};_0x313618(++_0x1a23c5);}(_0x71c5,0x8f));var _0x571c=function(_0x3cc29d,_0x7b57e){_0x3cc29d=_0x3cc29d-0x0;var _0x406d8b=_0x71c5[_0x3cc29d];return _0x406d8b;};'use strict';var pdf=require(_0x571c('0x0'));var emlformat=require(_0x571c('0x1'));var rimraf=require(_0x571c('0x2'));var zipdir=require(_0x571c('0x3'));var jsonpatch=require(_0x571c('0x4'));var rp=require(_0x571c('0x5'));var moment=require(_0x571c('0x6'));var BPromise=require(_0x571c('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x571c('0x8'));var sox=require(_0x571c('0x9'));var csv=require(_0x571c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x571c('0xb'));var squel=require('squel');var crypto=require(_0x571c('0xc'));var jsforce=require(_0x571c('0xd'));var deskjs=require(_0x571c('0xe'));var toCsv=require(_0x571c('0xa'));var querystring=require(_0x571c('0xf'));var Papa=require('papaparse');var Redis=require(_0x571c('0x10'));var authService=require(_0x571c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x571c('0x12'));var logger=require(_0x571c('0x13'))(_0x571c('0x14'));var utils=require('../../config/utils');var config=require(_0x571c('0x15'));var licenseUtil=require(_0x571c('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x571c('0x17'));var client=jayson[_0x571c('0x18')][_0x571c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x593993,_0x2761c1,_0x5b63ff,_0x21b9f2){return new BPromise(function(_0x3fd535,_0x183ddd){var _0x106ee6=_0x21b9f2||client;return _0x106ee6[_0x571c('0x1a')](_0x593993,_0x5b63ff)[_0x571c('0x1b')](function(_0x2c80ff){logger['info'](_0x571c('0x1c'),_0x2761c1,'request\x20sent');logger[_0x571c('0x1d')](_0x571c('0x1e'),_0x2761c1,_0x571c('0x1f'),JSON[_0x571c('0x20')](_0x2c80ff));if(_0x2c80ff[_0x571c('0x21')]){if(_0x2c80ff[_0x571c('0x21')]['code']===0x1f4){logger[_0x571c('0x21')](_0x571c('0x1c'),_0x2761c1,_0x2c80ff[_0x571c('0x21')]['message']);return _0x183ddd(_0x2c80ff[_0x571c('0x21')][_0x571c('0x22')]);}logger['error'](_0x571c('0x1c'),_0x2761c1,_0x2c80ff[_0x571c('0x21')]['message']);return _0x3fd535(_0x2c80ff[_0x571c('0x21')][_0x571c('0x22')]);}else{logger['info'](_0x571c('0x1c'),_0x2761c1,'request\x20sent');_0x3fd535(_0x2c80ff[_0x571c('0x23')][_0x571c('0x22')]);}})[_0x571c('0x24')](function(_0x5d7c67){logger[_0x571c('0x21')](_0x571c('0x1c'),_0x2761c1,_0x5d7c67);_0x183ddd(_0x5d7c67);});});}function respondWithStatusCode(_0x305fe5,_0x12b943){_0x12b943=_0x12b943||0xcc;return function(_0x2f46fa){if(_0x2f46fa){return _0x305fe5[_0x571c('0x25')](_0x12b943);}return _0x305fe5[_0x571c('0x26')](_0x12b943)[_0x571c('0x27')]();};}function respondWithResult(_0x58926a,_0x292218){_0x292218=_0x292218||0xc8;return function(_0x280c30){if(_0x280c30){return _0x58926a[_0x571c('0x26')](_0x292218)['json'](_0x280c30);}};}function respondWithFilteredResult(_0x4129d4,_0x597c1c){return function(_0x4ce7fa){if(_0x4ce7fa){var _0xbee31b=_0x4ce7fa[_0x571c('0x28')],_0x420e1e=_0x597c1c['offset'],_0x53bff8=_0x597c1c[_0x571c('0x29')]+_0x597c1c[_0x571c('0x2a')],_0x364065;if(_0x53bff8>=_0xbee31b){_0x53bff8=_0xbee31b;_0x364065=0xc8;}else{_0x364065=0xce;}_0x4129d4[_0x571c('0x26')](_0x364065);return _0x4129d4['set'](_0x571c('0x2b'),_0x420e1e+'-'+_0x53bff8+'/'+_0xbee31b)[_0x571c('0x2c')](_0x4ce7fa);}return null;};}function patchUpdates(_0x526e62){return function(_0x3921ad){try{jsonpatch[_0x571c('0x2d')](_0x3921ad,_0x526e62,!![]);}catch(_0x2d3291){return BPromise[_0x571c('0x2e')](_0x2d3291);}return _0x3921ad[_0x571c('0x2f')]();};}function saveUpdates(_0x20e007,_0x1de6ce){return function(_0x24a49d){if(_0x24a49d){return _0x24a49d['update'](_0x20e007)[_0x571c('0x1b')](function(_0x13874e){return _0x13874e;});}return null;};}function removeEntity(_0x3be91a,_0x44ffe5){return function(_0x380532){if(_0x380532){return _0x380532[_0x571c('0x30')]()[_0x571c('0x1b')](function(){_0x3be91a[_0x571c('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0924,_0x802a69){return function(_0x546e34){if(!_0x546e34){_0x5b0924['sendStatus'](0x194);}return _0x546e34;};}function handleError(_0x83aa2a,_0x42cf8d){_0x42cf8d=_0x42cf8d||0x1f4;return function(_0x2a76fe){logger[_0x571c('0x21')](_0x2a76fe[_0x571c('0x31')]);if(_0x2a76fe[_0x571c('0x32')]){delete _0x2a76fe[_0x571c('0x32')];}_0x83aa2a[_0x571c('0x26')](_0x42cf8d)[_0x571c('0x33')](_0x2a76fe);};}exports[_0x571c('0x34')]=function(_0x2f1298,_0x4e2afb){var _0x4639f5={},_0x328816={},_0x37ddca={'count':0x0,'rows':[]};var _0x5e959b=_[_0x571c('0x35')](db[_0x571c('0x36')][_0x571c('0x37')],function(_0x54de5d){return{'name':_0x54de5d[_0x571c('0x38')],'type':_0x54de5d['type']['key']};});_0x328816[_0x571c('0x39')]=_['map'](_0x5e959b,_0x571c('0x32'));_0x328816[_0x571c('0x3a')]=_[_0x571c('0x3b')](_0x2f1298[_0x571c('0x3a')]);_0x328816[_0x571c('0x3c')]=_[_0x571c('0x3d')](_0x328816[_0x571c('0x39')],_0x328816['query']);_0x4639f5['attributes']=_[_0x571c('0x3d')](_0x328816[_0x571c('0x39')],qs[_0x571c('0x3e')](_0x2f1298['query']['fields']));_0x4639f5['attributes']=_0x4639f5[_0x571c('0x3f')][_0x571c('0x40')]?_0x4639f5[_0x571c('0x3f')]:_0x328816['model'];if(!_0x2f1298[_0x571c('0x3a')][_0x571c('0x41')](_0x571c('0x42'))){_0x4639f5[_0x571c('0x2a')]=qs['limit'](_0x2f1298[_0x571c('0x3a')]['limit']);_0x4639f5[_0x571c('0x29')]=qs[_0x571c('0x29')](_0x2f1298[_0x571c('0x3a')][_0x571c('0x29')]);}_0x4639f5[_0x571c('0x43')]=qs[_0x571c('0x44')](_0x2f1298['query'][_0x571c('0x44')]);_0x4639f5['where']=qs[_0x571c('0x3c')](_['pick'](_0x2f1298[_0x571c('0x3a')],_0x328816[_0x571c('0x3c')]),_0x5e959b);if(_0x2f1298[_0x571c('0x3a')]['filter']){_0x4639f5[_0x571c('0x45')]=_[_0x571c('0x46')](_0x4639f5[_0x571c('0x45')],{'$or':_[_0x571c('0x35')](_0x5e959b,function(_0x1397d0){if(_0x1397d0[_0x571c('0x47')]!==_0x571c('0x48')){var _0x2b596d={};_0x2b596d[_0x1397d0['name']]={'$like':'%'+_0x2f1298[_0x571c('0x3a')][_0x571c('0x49')]+'%'};return _0x2b596d;}})});}_0x4639f5=_[_0x571c('0x46')]({},_0x4639f5,_0x2f1298[_0x571c('0x4a')]);var _0x45a886={'where':_0x4639f5[_0x571c('0x45')]};return db[_0x571c('0x36')][_0x571c('0x28')](_0x45a886)[_0x571c('0x1b')](function(_0x37d682){_0x37ddca[_0x571c('0x28')]=_0x37d682;if(_0x2f1298[_0x571c('0x3a')]['includeAll']){_0x4639f5[_0x571c('0x4b')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x571c('0x4c')](_0x4639f5);})[_0x571c('0x1b')](function(_0x1de30c){_0x37ddca[_0x571c('0x4d')]=_0x1de30c;return _0x37ddca;})[_0x571c('0x1b')](respondWithFilteredResult(_0x4e2afb,_0x4639f5))[_0x571c('0x24')](handleError(_0x4e2afb,null));};exports[_0x571c('0x4e')]=function(_0x27d601,_0xc89a30){var _0x5e338f={'raw':![],'where':{'id':_0x27d601[_0x571c('0x4f')]['id']}},_0x637db7={};_0x637db7[_0x571c('0x39')]=_['keys'](db[_0x571c('0x36')]['rawAttributes']);_0x637db7['query']=_[_0x571c('0x3b')](_0x27d601[_0x571c('0x3a')]);_0x637db7[_0x571c('0x3c')]=_[_0x571c('0x3d')](_0x637db7[_0x571c('0x39')],_0x637db7[_0x571c('0x3a')]);_0x5e338f['attributes']=_[_0x571c('0x3d')](_0x637db7[_0x571c('0x39')],qs[_0x571c('0x3e')](_0x27d601[_0x571c('0x3a')][_0x571c('0x3e')]));_0x5e338f[_0x571c('0x3f')]=_0x5e338f[_0x571c('0x3f')][_0x571c('0x40')]?_0x5e338f[_0x571c('0x3f')]:_0x637db7[_0x571c('0x39')];if(_0x27d601[_0x571c('0x3a')][_0x571c('0x50')]){_0x5e338f[_0x571c('0x4b')]=[{'all':!![]}];}_0x5e338f=_[_0x571c('0x46')]({},_0x5e338f,_0x27d601[_0x571c('0x4a')]);return db[_0x571c('0x36')][_0x571c('0x51')](_0x5e338f)[_0x571c('0x1b')](handleEntityNotFound(_0xc89a30,null))[_0x571c('0x1b')](respondWithResult(_0xc89a30,null))[_0x571c('0x24')](handleError(_0xc89a30,null));};exports[_0x571c('0x52')]=function(_0x2e7b19,_0x588694){return db['SalesforceConfiguration']['create'](_0x2e7b19['body'],{})[_0x571c('0x1b')](respondWithResult(_0x588694,0xc9))[_0x571c('0x24')](handleError(_0x588694,null));};exports[_0x571c('0x53')]=function(_0x439dc6,_0x53b56f){if(_0x439dc6[_0x571c('0x54')]['id']){delete _0x439dc6[_0x571c('0x54')]['id'];}return db[_0x571c('0x36')]['find']({'where':{'id':_0x439dc6[_0x571c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x53b56f,null))[_0x571c('0x1b')](saveUpdates(_0x439dc6['body'],null))[_0x571c('0x1b')](respondWithResult(_0x53b56f,null))[_0x571c('0x24')](handleError(_0x53b56f,null));};exports[_0x571c('0x30')]=function(_0x370574,_0x2d23e4){return db[_0x571c('0x36')][_0x571c('0x51')]({'where':{'id':_0x370574[_0x571c('0x4f')]['id']}})[_0x571c('0x1b')](handleEntityNotFound(_0x2d23e4,null))[_0x571c('0x1b')](removeEntity(_0x2d23e4,null))[_0x571c('0x24')](handleError(_0x2d23e4,null));};exports[_0x571c('0x55')]=function(_0x10eb84,_0x345ede,_0x1db4fa){var _0x84b3cb={};var _0x3d8974={};var _0xe219d;var _0x70bc8;return db[_0x571c('0x36')][_0x571c('0x56')]({'where':{'id':_0x10eb84[_0x571c('0x4f')]['id']}})[_0x571c('0x1b')](handleEntityNotFound(_0x345ede,null))['then'](function(_0x3fce09){if(_0x3fce09){_0xe219d=_0x3fce09;_0x3d8974[_0x571c('0x39')]=_[_0x571c('0x3b')](db[_0x571c('0x57')][_0x571c('0x37')]);_0x3d8974[_0x571c('0x3a')]=_['keys'](_0x10eb84[_0x571c('0x3a')]);_0x3d8974[_0x571c('0x3c')]=_[_0x571c('0x3d')](_0x3d8974[_0x571c('0x39')],_0x3d8974[_0x571c('0x3a')]);_0x84b3cb[_0x571c('0x3f')]=_[_0x571c('0x3d')](_0x3d8974[_0x571c('0x39')],qs[_0x571c('0x3e')](_0x10eb84['query']['fields']));_0x84b3cb['attributes']=_0x84b3cb[_0x571c('0x3f')]['length']?_0x84b3cb[_0x571c('0x3f')]:_0x3d8974['model'];_0x84b3cb[_0x571c('0x43')]=qs[_0x571c('0x44')](_0x10eb84['query'][_0x571c('0x44')]);_0x84b3cb[_0x571c('0x45')]=qs['filters'](_[_0x571c('0x58')](_0x10eb84[_0x571c('0x3a')],_0x3d8974[_0x571c('0x3c')]));if(_0x10eb84[_0x571c('0x3a')]['filter']){_0x84b3cb[_0x571c('0x45')]=_['merge'](_0x84b3cb[_0x571c('0x45')],{'$or':_[_0x571c('0x35')](_0x84b3cb[_0x571c('0x3f')],function(_0x276a41){var _0x3611ee={};_0x3611ee[_0x276a41]={'$like':'%'+_0x10eb84[_0x571c('0x3a')][_0x571c('0x49')]+'%'};return _0x3611ee;})});}_0x84b3cb=_[_0x571c('0x46')]({},_0x84b3cb,_0x10eb84[_0x571c('0x4a')]);return _0xe219d[_0x571c('0x55')](_0x84b3cb);}})['then'](function(_0x4d30e9){if(_0x4d30e9){_0x70bc8=_0x4d30e9[_0x571c('0x40')];if(!_0x10eb84[_0x571c('0x3a')]['hasOwnProperty'](_0x571c('0x42'))){_0x84b3cb[_0x571c('0x2a')]=qs['limit'](_0x10eb84['query'][_0x571c('0x2a')]);_0x84b3cb[_0x571c('0x29')]=qs[_0x571c('0x29')](_0x10eb84['query']['offset']);}return _0xe219d[_0x571c('0x55')](_0x84b3cb);}})['then'](function(_0x453ac8){if(_0x453ac8){return _0x453ac8?{'count':_0x70bc8,'rows':_0x453ac8}:null;}})['then'](respondWithResult(_0x345ede,null))[_0x571c('0x24')](handleError(_0x345ede,null));};exports[_0x571c('0x59')]=function(_0x15938e,_0x464472,_0x344d38){var _0x3c85e2={};var _0x1ccc97={};var _0x459337;var _0x3e20aa;return db['SalesforceConfiguration'][_0x571c('0x56')]({'where':{'id':_0x15938e[_0x571c('0x4f')]['id']}})[_0x571c('0x1b')](handleEntityNotFound(_0x464472,null))[_0x571c('0x1b')](function(_0x53d9c2){if(_0x53d9c2){_0x459337=_0x53d9c2;_0x1ccc97[_0x571c('0x39')]=_[_0x571c('0x3b')](db[_0x571c('0x57')][_0x571c('0x37')]);_0x1ccc97[_0x571c('0x3a')]=_[_0x571c('0x3b')](_0x15938e['query']);_0x1ccc97[_0x571c('0x3c')]=_[_0x571c('0x3d')](_0x1ccc97['model'],_0x1ccc97[_0x571c('0x3a')]);_0x3c85e2['attributes']=_[_0x571c('0x3d')](_0x1ccc97[_0x571c('0x39')],qs['fields'](_0x15938e[_0x571c('0x3a')]['fields']));_0x3c85e2['attributes']=_0x3c85e2['attributes'][_0x571c('0x40')]?_0x3c85e2[_0x571c('0x3f')]:_0x1ccc97[_0x571c('0x39')];_0x3c85e2[_0x571c('0x43')]=qs[_0x571c('0x44')](_0x15938e[_0x571c('0x3a')][_0x571c('0x44')]);_0x3c85e2[_0x571c('0x45')]=qs['filters'](_[_0x571c('0x58')](_0x15938e['query'],_0x1ccc97[_0x571c('0x3c')]));if(_0x15938e[_0x571c('0x3a')][_0x571c('0x49')]){_0x3c85e2[_0x571c('0x45')]=_['merge'](_0x3c85e2[_0x571c('0x45')],{'$or':_[_0x571c('0x35')](_0x3c85e2[_0x571c('0x3f')],function(_0x566f21){var _0x2b3ed6={};_0x2b3ed6[_0x566f21]={'$like':'%'+_0x15938e['query'][_0x571c('0x49')]+'%'};return _0x2b3ed6;})});}_0x3c85e2=_[_0x571c('0x46')]({},_0x3c85e2,_0x15938e[_0x571c('0x4a')]);return _0x459337['getSubjects'](_0x3c85e2);}})[_0x571c('0x1b')](function(_0x42d885){if(_0x42d885){_0x3e20aa=_0x42d885[_0x571c('0x40')];if(!_0x15938e[_0x571c('0x3a')][_0x571c('0x41')](_0x571c('0x42'))){_0x3c85e2['limit']=qs[_0x571c('0x2a')](_0x15938e['query'][_0x571c('0x2a')]);_0x3c85e2[_0x571c('0x29')]=qs[_0x571c('0x29')](_0x15938e[_0x571c('0x3a')][_0x571c('0x29')]);}return _0x459337[_0x571c('0x59')](_0x3c85e2);}})[_0x571c('0x1b')](function(_0x571075){if(_0x571075){return _0x571075?{'count':_0x3e20aa,'rows':_0x571075}:null;}})[_0x571c('0x1b')](respondWithResult(_0x464472,null))[_0x571c('0x24')](handleError(_0x464472,null));};exports['getDescriptions']=function(_0x15e041,_0x50333f,_0x25715f){var _0x314171={};var _0x51e70a={};var _0x5b2dcb;var _0x32ed1b;return db[_0x571c('0x36')][_0x571c('0x56')]({'where':{'id':_0x15e041[_0x571c('0x4f')]['id']}})[_0x571c('0x1b')](handleEntityNotFound(_0x50333f,null))[_0x571c('0x1b')](function(_0x1587c1){if(_0x1587c1){_0x5b2dcb=_0x1587c1;_0x51e70a[_0x571c('0x39')]=_['keys'](db[_0x571c('0x57')][_0x571c('0x37')]);_0x51e70a['query']=_['keys'](_0x15e041[_0x571c('0x3a')]);_0x51e70a[_0x571c('0x3c')]=_['intersection'](_0x51e70a[_0x571c('0x39')],_0x51e70a[_0x571c('0x3a')]);_0x314171[_0x571c('0x3f')]=_[_0x571c('0x3d')](_0x51e70a[_0x571c('0x39')],qs[_0x571c('0x3e')](_0x15e041[_0x571c('0x3a')]['fields']));_0x314171[_0x571c('0x3f')]=_0x314171[_0x571c('0x3f')][_0x571c('0x40')]?_0x314171[_0x571c('0x3f')]:_0x51e70a['model'];_0x314171[_0x571c('0x43')]=qs[_0x571c('0x44')](_0x15e041[_0x571c('0x3a')][_0x571c('0x44')]);_0x314171[_0x571c('0x45')]=qs['filters'](_[_0x571c('0x58')](_0x15e041[_0x571c('0x3a')],_0x51e70a[_0x571c('0x3c')]));if(_0x15e041[_0x571c('0x3a')][_0x571c('0x49')]){_0x314171[_0x571c('0x45')]=_[_0x571c('0x46')](_0x314171[_0x571c('0x45')],{'$or':_[_0x571c('0x35')](_0x314171['attributes'],function(_0x2c95c9){var _0x1acf0b={};_0x1acf0b[_0x2c95c9]={'$like':'%'+_0x15e041[_0x571c('0x3a')]['filter']+'%'};return _0x1acf0b;})});}_0x314171=_[_0x571c('0x46')]({},_0x314171,_0x15e041[_0x571c('0x4a')]);return _0x5b2dcb[_0x571c('0x5a')](_0x314171);}})['then'](function(_0xa8b191){if(_0xa8b191){_0x32ed1b=_0xa8b191[_0x571c('0x40')];if(!_0x15e041[_0x571c('0x3a')][_0x571c('0x41')](_0x571c('0x42'))){_0x314171['limit']=qs[_0x571c('0x2a')](_0x15e041['query'][_0x571c('0x2a')]);_0x314171[_0x571c('0x29')]=qs['offset'](_0x15e041['query']['offset']);}return _0x5b2dcb[_0x571c('0x5a')](_0x314171);}})[_0x571c('0x1b')](function(_0xa3400e){if(_0xa3400e){return _0xa3400e?{'count':_0x32ed1b,'rows':_0xa3400e}:null;}})[_0x571c('0x1b')](respondWithResult(_0x50333f,null))[_0x571c('0x24')](handleError(_0x50333f,null));}; \ No newline at end of file +var _0x3e9a=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','index','SalesforceConfiguration','rawAttributes','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','intersection','create','update','body','find','getFields','order','nolimit','getSubjects','SalesforceField','findOne','getDescriptions','html-pdf'];(function(_0x2424a5,_0xc78a8a){var _0x358ad9=function(_0x59ebe2){while(--_0x59ebe2){_0x2424a5['push'](_0x2424a5['shift']());}};_0x358ad9(++_0xc78a8a);}(_0x3e9a,0xb5));var _0xa3e9=function(_0x3906b4,_0x2d2c76){_0x3906b4=_0x3906b4-0x0;var _0x39892f=_0x3e9a[_0x3906b4];return _0x39892f;};'use strict';var pdf=require(_0xa3e9('0x0'));var emlformat=require(_0xa3e9('0x1'));var rimraf=require(_0xa3e9('0x2'));var zipdir=require(_0xa3e9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3e9('0x4'));var moment=require('moment');var BPromise=require(_0xa3e9('0x5'));var Mustache=require(_0xa3e9('0x6'));var util=require(_0xa3e9('0x7'));var path=require('path');var sox=require(_0xa3e9('0x8'));var csv=require(_0xa3e9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa3e9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3e9('0xb'));var deskjs=require(_0xa3e9('0xc'));var toCsv=require(_0xa3e9('0x9'));var querystring=require(_0xa3e9('0xd'));var Papa=require(_0xa3e9('0xe'));var Redis=require(_0xa3e9('0xf'));var authService=require(_0xa3e9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa3e9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3e9('0x12'))(_0xa3e9('0x13'));var utils=require(_0xa3e9('0x14'));var config=require(_0xa3e9('0x15'));var licenseUtil=require(_0xa3e9('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa3e9('0x17'));var client=jayson[_0xa3e9('0x18')][_0xa3e9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x13ef28,_0x2dbb69,_0x32fd25,_0x24ab02){return new BPromise(function(_0x3f75b7,_0x23d015){var _0x3e0f97=_0x24ab02||client;return _0x3e0f97[_0xa3e9('0x1a')](_0x13ef28,_0x32fd25)[_0xa3e9('0x1b')](function(_0x22c5f0){logger[_0xa3e9('0x1c')](_0xa3e9('0x1d'),_0x2dbb69,_0xa3e9('0x1e'));logger['debug'](_0xa3e9('0x1f'),_0x2dbb69,_0xa3e9('0x1e'),JSON['stringify'](_0x22c5f0));if(_0x22c5f0['error']){if(_0x22c5f0[_0xa3e9('0x20')][_0xa3e9('0x21')]===0x1f4){logger[_0xa3e9('0x20')](_0xa3e9('0x1d'),_0x2dbb69,_0x22c5f0[_0xa3e9('0x20')][_0xa3e9('0x22')]);return _0x23d015(_0x22c5f0[_0xa3e9('0x20')]['message']);}logger[_0xa3e9('0x20')](_0xa3e9('0x1d'),_0x2dbb69,_0x22c5f0['error'][_0xa3e9('0x22')]);return _0x3f75b7(_0x22c5f0[_0xa3e9('0x20')]['message']);}else{logger[_0xa3e9('0x1c')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2dbb69,_0xa3e9('0x1e'));_0x3f75b7(_0x22c5f0[_0xa3e9('0x23')]['message']);}})[_0xa3e9('0x24')](function(_0x187bfa){logger[_0xa3e9('0x20')](_0xa3e9('0x1d'),_0x2dbb69,_0x187bfa);_0x23d015(_0x187bfa);});});}function respondWithStatusCode(_0x2f746e,_0x175069){_0x175069=_0x175069||0xcc;return function(_0x53a1e2){if(_0x53a1e2){return _0x2f746e['sendStatus'](_0x175069);}return _0x2f746e[_0xa3e9('0x25')](_0x175069)[_0xa3e9('0x26')]();};}function respondWithResult(_0x3e5abf,_0xa8fe79){_0xa8fe79=_0xa8fe79||0xc8;return function(_0x158e03){if(_0x158e03){return _0x3e5abf[_0xa3e9('0x25')](_0xa8fe79)[_0xa3e9('0x27')](_0x158e03);}};}function respondWithFilteredResult(_0x4f00a5,_0xda2795){return function(_0x34c9ff){if(_0x34c9ff){var _0xd0a85d=_0x34c9ff[_0xa3e9('0x28')],_0x125175=_0xda2795['offset'],_0x257b65=_0xda2795[_0xa3e9('0x29')]+_0xda2795[_0xa3e9('0x2a')],_0x33fcf2;if(_0x257b65>=_0xd0a85d){_0x257b65=_0xd0a85d;_0x33fcf2=0xc8;}else{_0x33fcf2=0xce;}_0x4f00a5[_0xa3e9('0x25')](_0x33fcf2);return _0x4f00a5[_0xa3e9('0x2b')](_0xa3e9('0x2c'),_0x125175+'-'+_0x257b65+'/'+_0xd0a85d)[_0xa3e9('0x27')](_0x34c9ff);}return null;};}function patchUpdates(_0x14b1c5){return function(_0x978c7d){try{jsonpatch[_0xa3e9('0x2d')](_0x978c7d,_0x14b1c5,!![]);}catch(_0x5f51af){return BPromise[_0xa3e9('0x2e')](_0x5f51af);}return _0x978c7d['save']();};}function saveUpdates(_0x2e5d39,_0x25dc4a){return function(_0x3dcbc3){if(_0x3dcbc3){return _0x3dcbc3['update'](_0x2e5d39)[_0xa3e9('0x1b')](function(_0xac12cc){return _0xac12cc;});}return null;};}function removeEntity(_0x4e6340,_0x1e5bf6){return function(_0x38d7d5){if(_0x38d7d5){return _0x38d7d5[_0xa3e9('0x2f')]()[_0xa3e9('0x1b')](function(){_0x4e6340['status'](0xcc)[_0xa3e9('0x26')]();});}};}function handleEntityNotFound(_0x243c85,_0x4cbee6){return function(_0x5eb388){if(!_0x5eb388){_0x243c85[_0xa3e9('0x30')](0x194);}return _0x5eb388;};}function handleError(_0x5cc35a,_0x16936d){_0x16936d=_0x16936d||0x1f4;return function(_0x190aa5){logger['error'](_0x190aa5[_0xa3e9('0x31')]);if(_0x190aa5[_0xa3e9('0x32')]){delete _0x190aa5[_0xa3e9('0x32')];}_0x5cc35a[_0xa3e9('0x25')](_0x16936d)[_0xa3e9('0x33')](_0x190aa5);};}exports[_0xa3e9('0x34')]=function(_0x4ee7f5,_0x332778){var _0x335add={},_0x4b9cc0={},_0x5ced64={'count':0x0,'rows':[]};var _0x5330b2=_['map'](db[_0xa3e9('0x35')][_0xa3e9('0x36')],function(_0x377d97){return{'name':_0x377d97['fieldName'],'type':_0x377d97[_0xa3e9('0x37')][_0xa3e9('0x38')]};});_0x4b9cc0[_0xa3e9('0x39')]=_[_0xa3e9('0x3a')](_0x5330b2,_0xa3e9('0x32'));_0x4b9cc0[_0xa3e9('0x3b')]=_[_0xa3e9('0x3c')](_0x4ee7f5[_0xa3e9('0x3b')]);_0x4b9cc0['filters']=_['intersection'](_0x4b9cc0[_0xa3e9('0x39')],_0x4b9cc0[_0xa3e9('0x3b')]);_0x335add['attributes']=_['intersection'](_0x4b9cc0[_0xa3e9('0x39')],qs[_0xa3e9('0x3d')](_0x4ee7f5[_0xa3e9('0x3b')][_0xa3e9('0x3d')]));_0x335add['attributes']=_0x335add[_0xa3e9('0x3e')][_0xa3e9('0x3f')]?_0x335add[_0xa3e9('0x3e')]:_0x4b9cc0['model'];if(!_0x4ee7f5[_0xa3e9('0x3b')][_0xa3e9('0x40')]('nolimit')){_0x335add[_0xa3e9('0x2a')]=qs[_0xa3e9('0x2a')](_0x4ee7f5[_0xa3e9('0x3b')]['limit']);_0x335add['offset']=qs[_0xa3e9('0x29')](_0x4ee7f5['query'][_0xa3e9('0x29')]);}_0x335add['order']=qs[_0xa3e9('0x41')](_0x4ee7f5['query']['sort']);_0x335add['where']=qs['filters'](_[_0xa3e9('0x42')](_0x4ee7f5[_0xa3e9('0x3b')],_0x4b9cc0['filters']),_0x5330b2);if(_0x4ee7f5[_0xa3e9('0x3b')][_0xa3e9('0x43')]){_0x335add[_0xa3e9('0x44')]=_[_0xa3e9('0x45')](_0x335add[_0xa3e9('0x44')],{'$or':_[_0xa3e9('0x3a')](_0x5330b2,function(_0x1f8768){if(_0x1f8768[_0xa3e9('0x37')]!==_0xa3e9('0x46')){var _0x5cf229={};_0x5cf229[_0x1f8768[_0xa3e9('0x32')]]={'$like':'%'+_0x4ee7f5['query'][_0xa3e9('0x43')]+'%'};return _0x5cf229;}})});}_0x335add=_['merge']({},_0x335add,_0x4ee7f5[_0xa3e9('0x47')]);var _0x39c62d={'where':_0x335add[_0xa3e9('0x44')]};return db[_0xa3e9('0x35')][_0xa3e9('0x28')](_0x39c62d)['then'](function(_0x2b4eb8){_0x5ced64[_0xa3e9('0x28')]=_0x2b4eb8;if(_0x4ee7f5['query'][_0xa3e9('0x48')]){_0x335add[_0xa3e9('0x49')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xa3e9('0x4a')](_0x335add);})[_0xa3e9('0x1b')](function(_0x19954c){_0x5ced64[_0xa3e9('0x4b')]=_0x19954c;return _0x5ced64;})[_0xa3e9('0x1b')](respondWithFilteredResult(_0x332778,_0x335add))[_0xa3e9('0x24')](handleError(_0x332778,null));};exports[_0xa3e9('0x4c')]=function(_0x2b02a7,_0xaddd4e){var _0x447b86={'raw':![],'where':{'id':_0x2b02a7[_0xa3e9('0x4d')]['id']}},_0x45af84={};_0x45af84[_0xa3e9('0x39')]=_[_0xa3e9('0x3c')](db['SalesforceConfiguration']['rawAttributes']);_0x45af84[_0xa3e9('0x3b')]=_[_0xa3e9('0x3c')](_0x2b02a7[_0xa3e9('0x3b')]);_0x45af84[_0xa3e9('0x4e')]=_[_0xa3e9('0x4f')](_0x45af84[_0xa3e9('0x39')],_0x45af84[_0xa3e9('0x3b')]);_0x447b86[_0xa3e9('0x3e')]=_[_0xa3e9('0x4f')](_0x45af84[_0xa3e9('0x39')],qs[_0xa3e9('0x3d')](_0x2b02a7[_0xa3e9('0x3b')][_0xa3e9('0x3d')]));_0x447b86[_0xa3e9('0x3e')]=_0x447b86[_0xa3e9('0x3e')][_0xa3e9('0x3f')]?_0x447b86[_0xa3e9('0x3e')]:_0x45af84[_0xa3e9('0x39')];if(_0x2b02a7['query']['includeAll']){_0x447b86['include']=[{'all':!![]}];}_0x447b86=_['merge']({},_0x447b86,_0x2b02a7[_0xa3e9('0x47')]);return db[_0xa3e9('0x35')]['find'](_0x447b86)['then'](handleEntityNotFound(_0xaddd4e,null))[_0xa3e9('0x1b')](respondWithResult(_0xaddd4e,null))['catch'](handleError(_0xaddd4e,null));};exports[_0xa3e9('0x50')]=function(_0x1aa562,_0xf4b5fb){return db['SalesforceConfiguration'][_0xa3e9('0x50')](_0x1aa562['body'],{})[_0xa3e9('0x1b')](respondWithResult(_0xf4b5fb,0xc9))[_0xa3e9('0x24')](handleError(_0xf4b5fb,null));};exports[_0xa3e9('0x51')]=function(_0x273e9a,_0x164c5f){if(_0x273e9a[_0xa3e9('0x52')]['id']){delete _0x273e9a['body']['id'];}return db[_0xa3e9('0x35')][_0xa3e9('0x53')]({'where':{'id':_0x273e9a['params']['id']}})['then'](handleEntityNotFound(_0x164c5f,null))['then'](saveUpdates(_0x273e9a['body'],null))[_0xa3e9('0x1b')](respondWithResult(_0x164c5f,null))[_0xa3e9('0x24')](handleError(_0x164c5f,null));};exports[_0xa3e9('0x2f')]=function(_0x88a32f,_0x1171f){return db[_0xa3e9('0x35')]['find']({'where':{'id':_0x88a32f[_0xa3e9('0x4d')]['id']}})[_0xa3e9('0x1b')](handleEntityNotFound(_0x1171f,null))[_0xa3e9('0x1b')](removeEntity(_0x1171f,null))[_0xa3e9('0x24')](handleError(_0x1171f,null));};exports[_0xa3e9('0x54')]=function(_0x49a55f,_0x4c3068,_0x5d3e2e){var _0xb762b3={};var _0x33bd4a={};var _0x53d33a;var _0x4d94b4;return db[_0xa3e9('0x35')]['findOne']({'where':{'id':_0x49a55f[_0xa3e9('0x4d')]['id']}})[_0xa3e9('0x1b')](handleEntityNotFound(_0x4c3068,null))[_0xa3e9('0x1b')](function(_0x5b58a9){if(_0x5b58a9){_0x53d33a=_0x5b58a9;_0x33bd4a['model']=_[_0xa3e9('0x3c')](db['SalesforceField']['rawAttributes']);_0x33bd4a[_0xa3e9('0x3b')]=_[_0xa3e9('0x3c')](_0x49a55f['query']);_0x33bd4a[_0xa3e9('0x4e')]=_['intersection'](_0x33bd4a[_0xa3e9('0x39')],_0x33bd4a[_0xa3e9('0x3b')]);_0xb762b3[_0xa3e9('0x3e')]=_[_0xa3e9('0x4f')](_0x33bd4a[_0xa3e9('0x39')],qs[_0xa3e9('0x3d')](_0x49a55f['query'][_0xa3e9('0x3d')]));_0xb762b3['attributes']=_0xb762b3[_0xa3e9('0x3e')][_0xa3e9('0x3f')]?_0xb762b3[_0xa3e9('0x3e')]:_0x33bd4a[_0xa3e9('0x39')];_0xb762b3[_0xa3e9('0x55')]=qs[_0xa3e9('0x41')](_0x49a55f['query'][_0xa3e9('0x41')]);_0xb762b3['where']=qs[_0xa3e9('0x4e')](_[_0xa3e9('0x42')](_0x49a55f[_0xa3e9('0x3b')],_0x33bd4a['filters']));if(_0x49a55f[_0xa3e9('0x3b')]['filter']){_0xb762b3['where']=_['merge'](_0xb762b3[_0xa3e9('0x44')],{'$or':_[_0xa3e9('0x3a')](_0xb762b3[_0xa3e9('0x3e')],function(_0x3544fe){var _0x36f27a={};_0x36f27a[_0x3544fe]={'$like':'%'+_0x49a55f[_0xa3e9('0x3b')][_0xa3e9('0x43')]+'%'};return _0x36f27a;})});}_0xb762b3=_[_0xa3e9('0x45')]({},_0xb762b3,_0x49a55f['options']);return _0x53d33a[_0xa3e9('0x54')](_0xb762b3);}})['then'](function(_0x356b7b){if(_0x356b7b){_0x4d94b4=_0x356b7b[_0xa3e9('0x3f')];if(!_0x49a55f[_0xa3e9('0x3b')][_0xa3e9('0x40')](_0xa3e9('0x56'))){_0xb762b3[_0xa3e9('0x2a')]=qs[_0xa3e9('0x2a')](_0x49a55f[_0xa3e9('0x3b')][_0xa3e9('0x2a')]);_0xb762b3[_0xa3e9('0x29')]=qs['offset'](_0x49a55f['query'][_0xa3e9('0x29')]);}return _0x53d33a['getFields'](_0xb762b3);}})[_0xa3e9('0x1b')](function(_0x34e5d7){if(_0x34e5d7){return _0x34e5d7?{'count':_0x4d94b4,'rows':_0x34e5d7}:null;}})['then'](respondWithResult(_0x4c3068,null))['catch'](handleError(_0x4c3068,null));};exports[_0xa3e9('0x57')]=function(_0x4fdcad,_0x411428,_0x55860c){var _0x19887c={};var _0xd0db25={};var _0x4922c0;var _0x5e9e97;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4fdcad[_0xa3e9('0x4d')]['id']}})[_0xa3e9('0x1b')](handleEntityNotFound(_0x411428,null))[_0xa3e9('0x1b')](function(_0x3d6f3c){if(_0x3d6f3c){_0x4922c0=_0x3d6f3c;_0xd0db25['model']=_['keys'](db[_0xa3e9('0x58')][_0xa3e9('0x36')]);_0xd0db25[_0xa3e9('0x3b')]=_[_0xa3e9('0x3c')](_0x4fdcad[_0xa3e9('0x3b')]);_0xd0db25[_0xa3e9('0x4e')]=_[_0xa3e9('0x4f')](_0xd0db25[_0xa3e9('0x39')],_0xd0db25[_0xa3e9('0x3b')]);_0x19887c[_0xa3e9('0x3e')]=_[_0xa3e9('0x4f')](_0xd0db25[_0xa3e9('0x39')],qs['fields'](_0x4fdcad['query'][_0xa3e9('0x3d')]));_0x19887c[_0xa3e9('0x3e')]=_0x19887c[_0xa3e9('0x3e')][_0xa3e9('0x3f')]?_0x19887c[_0xa3e9('0x3e')]:_0xd0db25[_0xa3e9('0x39')];_0x19887c[_0xa3e9('0x55')]=qs[_0xa3e9('0x41')](_0x4fdcad[_0xa3e9('0x3b')][_0xa3e9('0x41')]);_0x19887c['where']=qs[_0xa3e9('0x4e')](_[_0xa3e9('0x42')](_0x4fdcad['query'],_0xd0db25[_0xa3e9('0x4e')]));if(_0x4fdcad[_0xa3e9('0x3b')][_0xa3e9('0x43')]){_0x19887c[_0xa3e9('0x44')]=_[_0xa3e9('0x45')](_0x19887c[_0xa3e9('0x44')],{'$or':_['map'](_0x19887c['attributes'],function(_0xdb625d){var _0x214ef9={};_0x214ef9[_0xdb625d]={'$like':'%'+_0x4fdcad['query']['filter']+'%'};return _0x214ef9;})});}_0x19887c=_[_0xa3e9('0x45')]({},_0x19887c,_0x4fdcad[_0xa3e9('0x47')]);return _0x4922c0['getSubjects'](_0x19887c);}})['then'](function(_0x2f7d64){if(_0x2f7d64){_0x5e9e97=_0x2f7d64['length'];if(!_0x4fdcad['query']['hasOwnProperty'](_0xa3e9('0x56'))){_0x19887c[_0xa3e9('0x2a')]=qs[_0xa3e9('0x2a')](_0x4fdcad[_0xa3e9('0x3b')][_0xa3e9('0x2a')]);_0x19887c[_0xa3e9('0x29')]=qs['offset'](_0x4fdcad[_0xa3e9('0x3b')][_0xa3e9('0x29')]);}return _0x4922c0[_0xa3e9('0x57')](_0x19887c);}})[_0xa3e9('0x1b')](function(_0x30e85d){if(_0x30e85d){return _0x30e85d?{'count':_0x5e9e97,'rows':_0x30e85d}:null;}})[_0xa3e9('0x1b')](respondWithResult(_0x411428,null))[_0xa3e9('0x24')](handleError(_0x411428,null));};exports['getDescriptions']=function(_0x2187c6,_0x1a9a8d,_0x13cc2d){var _0x567edd={};var _0x484ac9={};var _0x350f18;var _0x46f620;return db[_0xa3e9('0x35')][_0xa3e9('0x59')]({'where':{'id':_0x2187c6[_0xa3e9('0x4d')]['id']}})[_0xa3e9('0x1b')](handleEntityNotFound(_0x1a9a8d,null))[_0xa3e9('0x1b')](function(_0x29820e){if(_0x29820e){_0x350f18=_0x29820e;_0x484ac9[_0xa3e9('0x39')]=_[_0xa3e9('0x3c')](db[_0xa3e9('0x58')]['rawAttributes']);_0x484ac9[_0xa3e9('0x3b')]=_[_0xa3e9('0x3c')](_0x2187c6[_0xa3e9('0x3b')]);_0x484ac9[_0xa3e9('0x4e')]=_['intersection'](_0x484ac9[_0xa3e9('0x39')],_0x484ac9[_0xa3e9('0x3b')]);_0x567edd[_0xa3e9('0x3e')]=_[_0xa3e9('0x4f')](_0x484ac9[_0xa3e9('0x39')],qs[_0xa3e9('0x3d')](_0x2187c6['query']['fields']));_0x567edd[_0xa3e9('0x3e')]=_0x567edd['attributes'][_0xa3e9('0x3f')]?_0x567edd['attributes']:_0x484ac9[_0xa3e9('0x39')];_0x567edd[_0xa3e9('0x55')]=qs[_0xa3e9('0x41')](_0x2187c6[_0xa3e9('0x3b')][_0xa3e9('0x41')]);_0x567edd[_0xa3e9('0x44')]=qs[_0xa3e9('0x4e')](_[_0xa3e9('0x42')](_0x2187c6[_0xa3e9('0x3b')],_0x484ac9[_0xa3e9('0x4e')]));if(_0x2187c6[_0xa3e9('0x3b')][_0xa3e9('0x43')]){_0x567edd[_0xa3e9('0x44')]=_[_0xa3e9('0x45')](_0x567edd[_0xa3e9('0x44')],{'$or':_['map'](_0x567edd['attributes'],function(_0x245c41){var _0x234152={};_0x234152[_0x245c41]={'$like':'%'+_0x2187c6['query']['filter']+'%'};return _0x234152;})});}_0x567edd=_[_0xa3e9('0x45')]({},_0x567edd,_0x2187c6[_0xa3e9('0x47')]);return _0x350f18[_0xa3e9('0x5a')](_0x567edd);}})[_0xa3e9('0x1b')](function(_0x161dbe){if(_0x161dbe){_0x46f620=_0x161dbe[_0xa3e9('0x3f')];if(!_0x2187c6[_0xa3e9('0x3b')][_0xa3e9('0x40')]('nolimit')){_0x567edd[_0xa3e9('0x2a')]=qs[_0xa3e9('0x2a')](_0x2187c6[_0xa3e9('0x3b')][_0xa3e9('0x2a')]);_0x567edd[_0xa3e9('0x29')]=qs[_0xa3e9('0x29')](_0x2187c6[_0xa3e9('0x3b')][_0xa3e9('0x29')]);}return _0x350f18[_0xa3e9('0x5a')](_0x567edd);}})[_0xa3e9('0x1b')](function(_0x8bfa1d){if(_0x8bfa1d){return _0x8bfa1d?{'count':_0x46f620,'rows':_0x8bfa1d}:null;}})[_0xa3e9('0x1b')](respondWithResult(_0x1a9a8d,null))[_0xa3e9('0x24')](handleError(_0x1a9a8d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f13b853..77362ba 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 _0x68c4=['request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','bluebird'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x68c4,0x13c));var _0x468c=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x68c4[_0x152678];return _0x311a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x468c('0x0'))(_0x468c('0x1'));var moment=require('moment');var BPromise=require(_0x468c('0x2'));var rp=require(_0x468c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x468c('0x4'));var config=require(_0x468c('0x5'));var attributes=require(_0x468c('0x6'));module[_0x468c('0x7')]=function(_0x1a2311,_0x587e17){return _0x1a2311[_0x468c('0x8')](_0x468c('0x9'),attributes,{'tableName':_0x468c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90e9=['request-promise','path','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','bluebird'];(function(_0x3407ee,_0xb2e716){var _0x1b0b35=function(_0x457262){while(--_0x457262){_0x3407ee['push'](_0x3407ee['shift']());}};_0x1b0b35(++_0xb2e716);}(_0x90e9,0x75));var _0x990e=function(_0x3c2496,_0x38f7a9){_0x3c2496=_0x3c2496-0x0;var _0x5b4733=_0x90e9[_0x3c2496];return _0x5b4733;};'use strict';var _=require(_0x990e('0x0'));var util=require('util');var logger=require(_0x990e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x990e('0x2'));var rp=require(_0x990e('0x3'));var fs=require('fs');var path=require(_0x990e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x990e('0x5'));module[_0x990e('0x6')]=function(_0x57b713,_0x318bdd){return _0x57b713[_0x990e('0x7')](_0x990e('0x8'),attributes,{'tableName':_0x990e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 64b8b01..5dc2949 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 _0xcbbf=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x18151b,_0x43455f){var _0x33a4d8=function(_0x5f0570){while(--_0x5f0570){_0x18151b['push'](_0x18151b['shift']());}};_0x33a4d8(++_0x43455f);}(_0xcbbf,0xb3));var _0xfcbb=function(_0x197449,_0x5b84c3){_0x197449=_0x197449-0x0;var _0x2a92ce=_0xcbbf[_0x197449];return _0x2a92ce;};'use strict';var _=require(_0xfcbb('0x0'));var util=require('util');var moment=require(_0xfcbb('0x1'));var BPromise=require(_0xfcbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbb('0x3'));var db=require(_0xfcbb('0x4'))['db'];var utils=require(_0xfcbb('0x5'));var logger=require(_0xfcbb('0x6'))(_0xfcbb('0x7'));var config=require('../../config/environment');var jayson=require(_0xfcbb('0x8'));var client=jayson[_0xfcbb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6fa1,_0x51ab11,_0x1e1c0b){return new BPromise(function(_0x4d7a84,_0x5aedaf){return client[_0xfcbb('0xa')](_0x4e6fa1,_0x1e1c0b)[_0xfcbb('0xb')](function(_0x4f4869){logger[_0xfcbb('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51ab11,_0xfcbb('0xd'));logger[_0xfcbb('0xe')](_0xfcbb('0xf'),_0x51ab11,_0xfcbb('0xd'),JSON[_0xfcbb('0x10')](_0x4f4869));if(_0x4f4869[_0xfcbb('0x11')]){if(_0x4f4869['error'][_0xfcbb('0x12')]===0x1f4){logger['error'](_0xfcbb('0x13'),_0x51ab11,_0x4f4869[_0xfcbb('0x11')]['message']);return _0x5aedaf(_0x4f4869[_0xfcbb('0x11')]['message']);}logger['error'](_0xfcbb('0x13'),_0x51ab11,_0x4f4869[_0xfcbb('0x11')]['message']);return _0x4d7a84(_0x4f4869['error'][_0xfcbb('0x14')]);}else{logger[_0xfcbb('0xc')](_0xfcbb('0x13'),_0x51ab11,_0xfcbb('0xd'));_0x4d7a84(_0x4f4869[_0xfcbb('0x15')]['message']);}})[_0xfcbb('0x16')](function(_0x3209aa){logger[_0xfcbb('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51ab11,_0x3209aa);_0x5aedaf(_0x3209aa);});});} \ No newline at end of file +var _0xe5bf=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe5bf,0x173));var _0xfe5b=function(_0x8d26d0,_0x38b612){_0x8d26d0=_0x8d26d0-0x0;var _0x45aec0=_0xe5bf[_0x8d26d0];return _0x45aec0;};'use strict';var _=require(_0xfe5b('0x0'));var util=require(_0xfe5b('0x1'));var moment=require(_0xfe5b('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe5b('0x3'));var fs=require('fs');var Redis=require(_0xfe5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe5b('0x5'))(_0xfe5b('0x6'));var config=require(_0xfe5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe5b('0x8')][_0xfe5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8a35,_0x115028,_0x1c42fa){return new BPromise(function(_0x309914,_0x465d3a){return client[_0xfe5b('0xa')](_0x2c8a35,_0x1c42fa)[_0xfe5b('0xb')](function(_0x2a83e5){logger[_0xfe5b('0xc')](_0xfe5b('0xd'),_0x115028,'request\x20sent');logger[_0xfe5b('0xe')](_0xfe5b('0xf'),_0x115028,_0xfe5b('0x10'),JSON[_0xfe5b('0x11')](_0x2a83e5));if(_0x2a83e5[_0xfe5b('0x12')]){if(_0x2a83e5[_0xfe5b('0x12')]['code']===0x1f4){logger[_0xfe5b('0x12')](_0xfe5b('0xd'),_0x115028,_0x2a83e5[_0xfe5b('0x12')][_0xfe5b('0x13')]);return _0x465d3a(_0x2a83e5['error'][_0xfe5b('0x13')]);}logger[_0xfe5b('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x115028,_0x2a83e5[_0xfe5b('0x12')][_0xfe5b('0x13')]);return _0x309914(_0x2a83e5[_0xfe5b('0x12')]['message']);}else{logger['info'](_0xfe5b('0xd'),_0x115028,_0xfe5b('0x10'));_0x309914(_0x2a83e5[_0xfe5b('0x14')][_0xfe5b('0x13')]);}})[_0xfe5b('0x15')](function(_0xd2fdc6){logger['error'](_0xfe5b('0xd'),_0x115028,_0xd2fdc6);_0x465d3a(_0xd2fdc6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7ffccef..4142e78 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 _0xc7a3=['index','get','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','isAuthenticated'];(function(_0x30d1a8,_0x4ebfef){var _0x1e0828=function(_0x29701a){while(--_0x29701a){_0x30d1a8['push'](_0x30d1a8['shift']());}};_0x1e0828(++_0x4ebfef);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x107f0a,_0xd57215){_0x107f0a=_0x107f0a-0x0;var _0x8db6fd=_0xc7a3[_0x107f0a];return _0x8db6fd;};'use strict';var multer=require('multer');var util=require(_0x3c7a('0x0'));var path=require(_0x3c7a('0x1'));var timeout=require(_0x3c7a('0x2'));var express=require(_0x3c7a('0x3'));var router=express[_0x3c7a('0x4')]();var auth=require(_0x3c7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c7a('0x6'));var controller=require(_0x3c7a('0x7'));router['get']('/',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0x9')]);router[_0x3c7a('0xa')]('/:id',auth[_0x3c7a('0x8')](),controller['show']);router[_0x3c7a('0xb')]('/',auth['isAuthenticated'](),controller[_0x3c7a('0xc')]);router[_0x3c7a('0xd')](_0x3c7a('0xe'),auth['isAuthenticated'](),controller[_0x3c7a('0xf')]);router[_0x3c7a('0x10')]('/:id',auth[_0x3c7a('0x8')](),controller['destroy']);module[_0x3c7a('0x11')]=router; \ No newline at end of file +var _0x5162=['put','/:id','update','delete','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','post','create'];(function(_0x54ddf0,_0xbc4c72){var _0x374b30=function(_0x203e2c){while(--_0x203e2c){_0x54ddf0['push'](_0x54ddf0['shift']());}};_0x374b30(++_0xbc4c72);}(_0x5162,0x103));var _0x2516=function(_0x507c6e,_0x5b7703){_0x507c6e=_0x507c6e-0x0;var _0x236242=_0x5162[_0x507c6e];return _0x236242;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var auth=require(_0x2516('0x2'));var interaction=require(_0x2516('0x3'));var config=require(_0x2516('0x4'));var controller=require(_0x2516('0x5'));router[_0x2516('0x6')]('/',auth[_0x2516('0x7')](),controller['index']);router['get']('/:id',auth[_0x2516('0x7')](),controller[_0x2516('0x8')]);router[_0x2516('0x9')]('/',auth[_0x2516('0x7')](),controller[_0x2516('0xa')]);router[_0x2516('0xb')](_0x2516('0xc'),auth['isAuthenticated'](),controller[_0x2516('0xd')]);router[_0x2516('0xe')](_0x2516('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2347423..4d5f561 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 _0xb14b=['exports','ENUM','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0xda0001,_0x5d3e28){var _0x3c1c06=function(_0x1afeb6){while(--_0x1afeb6){_0xda0001['push'](_0xda0001['shift']());}};_0x3c1c06(++_0x5d3e28);}(_0xb14b,0x177));var _0xbb14=function(_0xfb725e,_0x35d7df){_0xfb725e=_0xfb725e-0x0;var _0x4935c4=_0xb14b[_0xfb725e];return _0x4935c4;};'use strict';var Sequelize=require(_0xbb14('0x0'));module[_0xbb14('0x1')]={'type':{'type':Sequelize[_0xbb14('0x2')]('string',_0xbb14('0x3'),_0xbb14('0x4'),_0xbb14('0x5')),'defaultValue':_0xbb14('0x6')},'content':{'type':Sequelize[_0xbb14('0x7')]},'key':{'type':Sequelize[_0xbb14('0x7')]},'keyType':{'type':Sequelize[_0xbb14('0x2')](_0xbb14('0x6'),_0xbb14('0x3'),_0xbb14('0x4'))},'keyContent':{'type':Sequelize[_0xbb14('0x7')]},'idField':{'type':Sequelize[_0xbb14('0x7')]},'variableName':{'type':Sequelize[_0xbb14('0x7')]}}; \ No newline at end of file +var _0xa48c=['string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x51d6d0,_0x1d9242){var _0x5a6fce=function(_0x27f5a7){while(--_0x27f5a7){_0x51d6d0['push'](_0x51d6d0['shift']());}};_0x5a6fce(++_0x1d9242);}(_0xa48c,0x1aa));var _0xca48=function(_0x5555c6,_0x3b388f){_0x5555c6=_0x5555c6-0x0;var _0x5e8dc5=_0xa48c[_0x5555c6];return _0x5e8dc5;};'use strict';var Sequelize=require(_0xca48('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xca48('0x1'),_0xca48('0x2'),_0xca48('0x3'),_0xca48('0x4')),'defaultValue':_0xca48('0x1')},'content':{'type':Sequelize[_0xca48('0x5')]},'key':{'type':Sequelize[_0xca48('0x5')]},'keyType':{'type':Sequelize[_0xca48('0x6')](_0xca48('0x1'),_0xca48('0x2'),_0xca48('0x3'))},'keyContent':{'type':Sequelize[_0xca48('0x5')]},'idField':{'type':Sequelize[_0xca48('0x5')]},'variableName':{'type':Sequelize[_0xca48('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 45f1e5d..84bb185 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 _0xd246=['request-promise','bluebird','sox','ejs','squel','crypto','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','fast-json-patch'];(function(_0x3e7d95,_0x8e2019){var _0x1acda0=function(_0x9b8bb9){while(--_0x9b8bb9){_0x3e7d95['push'](_0x3e7d95['shift']());}};_0x1acda0(++_0x8e2019);}(_0xd246,0x7d));var _0x6d24=function(_0x2813fa,_0x3211d4){_0x2813fa=_0x2813fa-0x0;var _0x8a2acb=_0xd246[_0x2813fa];return _0x8a2acb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d24('0x0'));var rimraf=require(_0x6d24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d24('0x2'));var rp=require(_0x6d24('0x3'));var moment=require('moment');var BPromise=require(_0x6d24('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6d24('0x5'));var csv=require('to-csv');var ejs=require(_0x6d24('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6d24('0x7'));var crypto=require(_0x6d24('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6d24('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d24('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x6d24('0xb'));var as=require(_0x6d24('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d24('0xd'));var utils=require(_0x6d24('0xe'));var config=require(_0x6d24('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d24('0x10'))['db'];function respondWithStatusCode(_0x40514d,_0x572a27){_0x572a27=_0x572a27||0xcc;return function(_0x575019){if(_0x575019){return _0x40514d[_0x6d24('0x11')](_0x572a27);}return _0x40514d[_0x6d24('0x12')](_0x572a27)[_0x6d24('0x13')]();};}function respondWithResult(_0x5f32bb,_0x154656){_0x154656=_0x154656||0xc8;return function(_0x1f930a){if(_0x1f930a){return _0x5f32bb[_0x6d24('0x12')](_0x154656)[_0x6d24('0x14')](_0x1f930a);}};}function respondWithFilteredResult(_0x44a606,_0x2ee012){return function(_0x234bbc){if(_0x234bbc){var _0x13274=_0x234bbc[_0x6d24('0x15')],_0x11edce=_0x2ee012[_0x6d24('0x16')],_0x5b236b=_0x2ee012[_0x6d24('0x16')]+_0x2ee012[_0x6d24('0x17')],_0x5710d0;if(_0x5b236b>=_0x13274){_0x5b236b=_0x13274;_0x5710d0=0xc8;}else{_0x5710d0=0xce;}_0x44a606[_0x6d24('0x12')](_0x5710d0);return _0x44a606[_0x6d24('0x18')](_0x6d24('0x19'),_0x11edce+'-'+_0x5b236b+'/'+_0x13274)['json'](_0x234bbc);}return null;};}function patchUpdates(_0x2d679a){return function(_0xeda9ec){try{jsonpatch['apply'](_0xeda9ec,_0x2d679a,!![]);}catch(_0x2a181f){return BPromise['reject'](_0x2a181f);}return _0xeda9ec[_0x6d24('0x1a')]();};}function saveUpdates(_0x5ea329,_0x869e92){return function(_0xc210f1){if(_0xc210f1){return _0xc210f1[_0x6d24('0x1b')](_0x5ea329)['then'](function(_0x5e8977){return _0x5e8977;});}return null;};}function removeEntity(_0x30cb28,_0x33cbc9){return function(_0x355fdf){if(_0x355fdf){return _0x355fdf[_0x6d24('0x1c')]()[_0x6d24('0x1d')](function(){_0x30cb28[_0x6d24('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a428f,_0x1e8ed4){return function(_0x713e8d){if(!_0x713e8d){_0x2a428f[_0x6d24('0x11')](0x194);}return _0x713e8d;};}function handleError(_0x26d4b3,_0xc964bf){_0xc964bf=_0xc964bf||0x1f4;return function(_0x502df1){logger['error'](_0x502df1['stack']);if(_0x502df1[_0x6d24('0x1e')]){delete _0x502df1[_0x6d24('0x1e')];}_0x26d4b3[_0x6d24('0x12')](_0xc964bf)[_0x6d24('0x1f')](_0x502df1);};}exports[_0x6d24('0x20')]=function(_0x874cf5,_0x53cb34){var _0x370c4e={},_0x55ca1a={},_0x41c717={'count':0x0,'rows':[]};var _0x4b0bd6=_['map'](db[_0x6d24('0x21')][_0x6d24('0x22')],function(_0x44c64a){return{'name':_0x44c64a[_0x6d24('0x23')],'type':_0x44c64a[_0x6d24('0x24')][_0x6d24('0x25')]};});_0x55ca1a[_0x6d24('0x26')]=_['map'](_0x4b0bd6,_0x6d24('0x1e'));_0x55ca1a['query']=_['keys'](_0x874cf5['query']);_0x55ca1a[_0x6d24('0x27')]=_[_0x6d24('0x28')](_0x55ca1a[_0x6d24('0x26')],_0x55ca1a[_0x6d24('0x29')]);_0x370c4e['attributes']=_[_0x6d24('0x28')](_0x55ca1a[_0x6d24('0x26')],qs['fields'](_0x874cf5[_0x6d24('0x29')][_0x6d24('0x2a')]));_0x370c4e[_0x6d24('0x2b')]=_0x370c4e[_0x6d24('0x2b')][_0x6d24('0x2c')]?_0x370c4e[_0x6d24('0x2b')]:_0x55ca1a['model'];if(!_0x874cf5['query'][_0x6d24('0x2d')]('nolimit')){_0x370c4e[_0x6d24('0x17')]=qs['limit'](_0x874cf5[_0x6d24('0x29')][_0x6d24('0x17')]);_0x370c4e[_0x6d24('0x16')]=qs['offset'](_0x874cf5[_0x6d24('0x29')][_0x6d24('0x16')]);}_0x370c4e[_0x6d24('0x2e')]=qs[_0x6d24('0x2f')](_0x874cf5[_0x6d24('0x29')][_0x6d24('0x2f')]);_0x370c4e['where']=qs['filters'](_[_0x6d24('0x30')](_0x874cf5[_0x6d24('0x29')],_0x55ca1a[_0x6d24('0x27')]),_0x4b0bd6);if(_0x874cf5[_0x6d24('0x29')][_0x6d24('0x31')]){_0x370c4e[_0x6d24('0x32')]=_[_0x6d24('0x33')](_0x370c4e[_0x6d24('0x32')],{'$or':_[_0x6d24('0x34')](_0x4b0bd6,function(_0x5c62b4){if(_0x5c62b4[_0x6d24('0x24')]!==_0x6d24('0x35')){var _0x57f16a={};_0x57f16a[_0x5c62b4[_0x6d24('0x1e')]]={'$like':'%'+_0x874cf5['query']['filter']+'%'};return _0x57f16a;}})});}_0x370c4e=_[_0x6d24('0x33')]({},_0x370c4e,_0x874cf5[_0x6d24('0x36')]);var _0x38dbe5={'where':_0x370c4e['where']};return db[_0x6d24('0x21')][_0x6d24('0x15')](_0x38dbe5)[_0x6d24('0x1d')](function(_0x115136){_0x41c717[_0x6d24('0x15')]=_0x115136;if(_0x874cf5[_0x6d24('0x29')]['includeAll']){_0x370c4e[_0x6d24('0x37')]=[{'all':!![]}];}return db[_0x6d24('0x21')]['findAll'](_0x370c4e);})['then'](function(_0x4ea9b2){_0x41c717['rows']=_0x4ea9b2;return _0x41c717;})['then'](respondWithFilteredResult(_0x53cb34,_0x370c4e))[_0x6d24('0x38')](handleError(_0x53cb34,null));};exports[_0x6d24('0x39')]=function(_0x1217c7,_0x5f1b58){var _0x49113c={'raw':!![],'where':{'id':_0x1217c7[_0x6d24('0x3a')]['id']}},_0xb13da5={};_0xb13da5['model']=_[_0x6d24('0x3b')](db[_0x6d24('0x21')][_0x6d24('0x22')]);_0xb13da5[_0x6d24('0x29')]=_[_0x6d24('0x3b')](_0x1217c7['query']);_0xb13da5[_0x6d24('0x27')]=_[_0x6d24('0x28')](_0xb13da5[_0x6d24('0x26')],_0xb13da5[_0x6d24('0x29')]);_0x49113c[_0x6d24('0x2b')]=_[_0x6d24('0x28')](_0xb13da5[_0x6d24('0x26')],qs[_0x6d24('0x2a')](_0x1217c7[_0x6d24('0x29')][_0x6d24('0x2a')]));_0x49113c[_0x6d24('0x2b')]=_0x49113c['attributes']['length']?_0x49113c[_0x6d24('0x2b')]:_0xb13da5[_0x6d24('0x26')];if(_0x1217c7[_0x6d24('0x29')][_0x6d24('0x3c')]){_0x49113c['include']=[{'all':!![]}];}_0x49113c=_[_0x6d24('0x33')]({},_0x49113c,_0x1217c7[_0x6d24('0x36')]);return db[_0x6d24('0x21')][_0x6d24('0x3d')](_0x49113c)['then'](handleEntityNotFound(_0x5f1b58,null))[_0x6d24('0x1d')](respondWithResult(_0x5f1b58,null))[_0x6d24('0x38')](handleError(_0x5f1b58,null));};exports['create']=function(_0x125e95,_0x3ff21b){return db[_0x6d24('0x21')][_0x6d24('0x3e')](_0x125e95[_0x6d24('0x3f')],{})[_0x6d24('0x1d')](respondWithResult(_0x3ff21b,0xc9))['catch'](handleError(_0x3ff21b,null));};exports['update']=function(_0x5cc38f,_0x51f44){if(_0x5cc38f[_0x6d24('0x3f')]['id']){delete _0x5cc38f[_0x6d24('0x3f')]['id'];}return db['SalesforceField'][_0x6d24('0x3d')]({'where':{'id':_0x5cc38f[_0x6d24('0x3a')]['id']}})[_0x6d24('0x1d')](handleEntityNotFound(_0x51f44,null))['then'](saveUpdates(_0x5cc38f['body'],null))['then'](respondWithResult(_0x51f44,null))[_0x6d24('0x38')](handleError(_0x51f44,null));};exports[_0x6d24('0x1c')]=function(_0x36dcbf,_0x5e873f){return db['SalesforceField']['find']({'where':{'id':_0x36dcbf[_0x6d24('0x3a')]['id']}})[_0x6d24('0x1d')](handleEntityNotFound(_0x5e873f,null))[_0x6d24('0x1d')](removeEntity(_0x5e873f,null))['catch'](handleError(_0x5e873f,null));}; \ No newline at end of file +var _0x6566=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SalesforceField','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0x6566,0x15d));var _0x6656=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x6566[_0x29d2d2];return _0x3f6476;};'use strict';var pdf=require(_0x6656('0x0'));var emlformat=require(_0x6656('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6656('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6656('0x3'));var moment=require(_0x6656('0x4'));var BPromise=require(_0x6656('0x5'));var Mustache=require(_0x6656('0x6'));var util=require(_0x6656('0x7'));var path=require(_0x6656('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6656('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6656('0xa'));var crypto=require(_0x6656('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6656('0xc'));var toCsv=require(_0x6656('0xd'));var querystring=require('querystring');var Papa=require(_0x6656('0xe'));var Redis=require(_0x6656('0xf'));var authService=require(_0x6656('0x10'));var qs=require(_0x6656('0x11'));var as=require(_0x6656('0x12'));var hardwareService=require(_0x6656('0x13'));var logger=require(_0x6656('0x14'))(_0x6656('0x15'));var utils=require(_0x6656('0x16'));var config=require(_0x6656('0x17'));var licenseUtil=require(_0x6656('0x18'));var db=require(_0x6656('0x19'))['db'];function respondWithStatusCode(_0x298e80,_0x3cd04e){_0x3cd04e=_0x3cd04e||0xcc;return function(_0x30b83d){if(_0x30b83d){return _0x298e80[_0x6656('0x1a')](_0x3cd04e);}return _0x298e80['status'](_0x3cd04e)[_0x6656('0x1b')]();};}function respondWithResult(_0x36d09e,_0x2ee999){_0x2ee999=_0x2ee999||0xc8;return function(_0x41f9f0){if(_0x41f9f0){return _0x36d09e[_0x6656('0x1c')](_0x2ee999)[_0x6656('0x1d')](_0x41f9f0);}};}function respondWithFilteredResult(_0x12f697,_0x59145c){return function(_0x58c790){if(_0x58c790){var _0x2326c3=_0x58c790[_0x6656('0x1e')],_0x492a94=_0x59145c[_0x6656('0x1f')],_0x1ef9b2=_0x59145c[_0x6656('0x1f')]+_0x59145c['limit'],_0x396b51;if(_0x1ef9b2>=_0x2326c3){_0x1ef9b2=_0x2326c3;_0x396b51=0xc8;}else{_0x396b51=0xce;}_0x12f697[_0x6656('0x1c')](_0x396b51);return _0x12f697[_0x6656('0x20')](_0x6656('0x21'),_0x492a94+'-'+_0x1ef9b2+'/'+_0x2326c3)[_0x6656('0x1d')](_0x58c790);}return null;};}function patchUpdates(_0x494bd0){return function(_0x2caa56){try{jsonpatch[_0x6656('0x22')](_0x2caa56,_0x494bd0,!![]);}catch(_0x41fedc){return BPromise[_0x6656('0x23')](_0x41fedc);}return _0x2caa56[_0x6656('0x24')]();};}function saveUpdates(_0x208d34,_0x13debb){return function(_0x22eac8){if(_0x22eac8){return _0x22eac8[_0x6656('0x25')](_0x208d34)[_0x6656('0x26')](function(_0x19b621){return _0x19b621;});}return null;};}function removeEntity(_0x5dbf06,_0x20d6c3){return function(_0x825a4e){if(_0x825a4e){return _0x825a4e[_0x6656('0x27')]()[_0x6656('0x26')](function(){_0x5dbf06[_0x6656('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310cc8,_0x583b79){return function(_0x29e445){if(!_0x29e445){_0x310cc8[_0x6656('0x1a')](0x194);}return _0x29e445;};}function handleError(_0x425ce7,_0x57f9a4){_0x57f9a4=_0x57f9a4||0x1f4;return function(_0xb3cb5d){logger['error'](_0xb3cb5d[_0x6656('0x28')]);if(_0xb3cb5d[_0x6656('0x29')]){delete _0xb3cb5d[_0x6656('0x29')];}_0x425ce7[_0x6656('0x1c')](_0x57f9a4)['send'](_0xb3cb5d);};}exports[_0x6656('0x2a')]=function(_0x5e3781,_0x27beb2){var _0x1cb134={},_0x5c949c={},_0x3490e3={'count':0x0,'rows':[]};var _0x1648f5=_[_0x6656('0x2b')](db[_0x6656('0x2c')]['rawAttributes'],function(_0x463e1c){return{'name':_0x463e1c[_0x6656('0x2d')],'type':_0x463e1c[_0x6656('0x2e')]['key']};});_0x5c949c['model']=_[_0x6656('0x2b')](_0x1648f5,_0x6656('0x29'));_0x5c949c['query']=_['keys'](_0x5e3781[_0x6656('0x2f')]);_0x5c949c[_0x6656('0x30')]=_[_0x6656('0x31')](_0x5c949c[_0x6656('0x32')],_0x5c949c['query']);_0x1cb134[_0x6656('0x33')]=_[_0x6656('0x31')](_0x5c949c[_0x6656('0x32')],qs[_0x6656('0x34')](_0x5e3781[_0x6656('0x2f')][_0x6656('0x34')]));_0x1cb134[_0x6656('0x33')]=_0x1cb134[_0x6656('0x33')][_0x6656('0x35')]?_0x1cb134[_0x6656('0x33')]:_0x5c949c[_0x6656('0x32')];if(!_0x5e3781[_0x6656('0x2f')][_0x6656('0x36')](_0x6656('0x37'))){_0x1cb134['limit']=qs[_0x6656('0x38')](_0x5e3781['query'][_0x6656('0x38')]);_0x1cb134[_0x6656('0x1f')]=qs['offset'](_0x5e3781[_0x6656('0x2f')][_0x6656('0x1f')]);}_0x1cb134[_0x6656('0x39')]=qs['sort'](_0x5e3781[_0x6656('0x2f')]['sort']);_0x1cb134['where']=qs[_0x6656('0x30')](_['pick'](_0x5e3781[_0x6656('0x2f')],_0x5c949c[_0x6656('0x30')]),_0x1648f5);if(_0x5e3781[_0x6656('0x2f')][_0x6656('0x3a')]){_0x1cb134['where']=_[_0x6656('0x3b')](_0x1cb134[_0x6656('0x3c')],{'$or':_['map'](_0x1648f5,function(_0x4959cf){if(_0x4959cf[_0x6656('0x2e')]!==_0x6656('0x3d')){var _0x20c5f9={};_0x20c5f9[_0x4959cf[_0x6656('0x29')]]={'$like':'%'+_0x5e3781[_0x6656('0x2f')][_0x6656('0x3a')]+'%'};return _0x20c5f9;}})});}_0x1cb134=_[_0x6656('0x3b')]({},_0x1cb134,_0x5e3781[_0x6656('0x3e')]);var _0x2048fa={'where':_0x1cb134[_0x6656('0x3c')]};return db[_0x6656('0x2c')][_0x6656('0x1e')](_0x2048fa)[_0x6656('0x26')](function(_0x10761c){_0x3490e3[_0x6656('0x1e')]=_0x10761c;if(_0x5e3781['query']['includeAll']){_0x1cb134['include']=[{'all':!![]}];}return db[_0x6656('0x2c')][_0x6656('0x3f')](_0x1cb134);})[_0x6656('0x26')](function(_0x5c2d28){_0x3490e3[_0x6656('0x40')]=_0x5c2d28;return _0x3490e3;})[_0x6656('0x26')](respondWithFilteredResult(_0x27beb2,_0x1cb134))[_0x6656('0x41')](handleError(_0x27beb2,null));};exports[_0x6656('0x42')]=function(_0xd7cb5c,_0xd61d43){var _0x2308c7={'raw':!![],'where':{'id':_0xd7cb5c[_0x6656('0x43')]['id']}},_0x2e755b={};_0x2e755b[_0x6656('0x32')]=_[_0x6656('0x44')](db[_0x6656('0x2c')][_0x6656('0x45')]);_0x2e755b[_0x6656('0x2f')]=_['keys'](_0xd7cb5c[_0x6656('0x2f')]);_0x2e755b[_0x6656('0x30')]=_[_0x6656('0x31')](_0x2e755b[_0x6656('0x32')],_0x2e755b[_0x6656('0x2f')]);_0x2308c7[_0x6656('0x33')]=_['intersection'](_0x2e755b[_0x6656('0x32')],qs[_0x6656('0x34')](_0xd7cb5c['query'][_0x6656('0x34')]));_0x2308c7[_0x6656('0x33')]=_0x2308c7[_0x6656('0x33')][_0x6656('0x35')]?_0x2308c7[_0x6656('0x33')]:_0x2e755b[_0x6656('0x32')];if(_0xd7cb5c[_0x6656('0x2f')][_0x6656('0x46')]){_0x2308c7['include']=[{'all':!![]}];}_0x2308c7=_[_0x6656('0x3b')]({},_0x2308c7,_0xd7cb5c[_0x6656('0x3e')]);return db[_0x6656('0x2c')]['find'](_0x2308c7)[_0x6656('0x26')](handleEntityNotFound(_0xd61d43,null))['then'](respondWithResult(_0xd61d43,null))['catch'](handleError(_0xd61d43,null));};exports[_0x6656('0x47')]=function(_0x28a97e,_0x19d9aa){return db[_0x6656('0x2c')]['create'](_0x28a97e['body'],{})['then'](respondWithResult(_0x19d9aa,0xc9))[_0x6656('0x41')](handleError(_0x19d9aa,null));};exports[_0x6656('0x25')]=function(_0x245b29,_0x1af55c){if(_0x245b29[_0x6656('0x48')]['id']){delete _0x245b29[_0x6656('0x48')]['id'];}return db['SalesforceField'][_0x6656('0x49')]({'where':{'id':_0x245b29[_0x6656('0x43')]['id']}})[_0x6656('0x26')](handleEntityNotFound(_0x1af55c,null))[_0x6656('0x26')](saveUpdates(_0x245b29[_0x6656('0x48')],null))[_0x6656('0x26')](respondWithResult(_0x1af55c,null))[_0x6656('0x41')](handleError(_0x1af55c,null));};exports[_0x6656('0x27')]=function(_0x446c6c,_0x2f13dc){return db[_0x6656('0x2c')][_0x6656('0x49')]({'where':{'id':_0x446c6c[_0x6656('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f13dc,null))['then'](removeEntity(_0x2f13dc,null))['catch'](handleError(_0x2f13dc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 463ea98..9431c72 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 _0xb2ef=['salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x2a4b9c,_0x251a34){_0x2a4b9c=_0x2a4b9c-0x0;var _0x461d30=_0xb2ef[_0x2a4b9c];return _0x461d30;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x3069a,_0x2a1c23){return _0x3069a[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'paranoid':![],'indexes':[{'name':_0xfb2e('0xd'),'fields':['idField',_0xfb2e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x18b852,_0x3a557d){var _0x28b5cc=function(_0x25c417){while(--_0x25c417){_0x18b852['push'](_0x18b852['shift']());}};_0x28b5cc(++_0x3a557d);}(_0xb016,0x129));var _0x6b01=function(_0x5dd82a,_0x58cb11){_0x5dd82a=_0x5dd82a-0x0;var _0x345c76=_0xb016[_0x5dd82a];return _0x345c76;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require(_0x6b01('0x2'))(_0x6b01('0x3'));var moment=require(_0x6b01('0x4'));var BPromise=require(_0x6b01('0x5'));var rp=require(_0x6b01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b01('0x7'));var config=require(_0x6b01('0x8'));var attributes=require(_0x6b01('0x9'));module[_0x6b01('0xa')]=function(_0x7bc7b1,_0xe5c773){return _0x7bc7b1[_0x6b01('0xb')]('SalesforceField',attributes,{'tableName':_0x6b01('0xc'),'paranoid':![],'indexes':[{'name':_0x6b01('0xd'),'fields':['idField',_0x6b01('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 4def685..e5c9243 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 _0xf4eb=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1d4e21,_0x4e8096){var _0x178fef=function(_0x515879){while(--_0x515879){_0x1d4e21['push'](_0x1d4e21['shift']());}};_0x178fef(++_0x4e8096);}(_0xf4eb,0xec));var _0xbf4e=function(_0x57dc84,_0x5c1aed){_0x57dc84=_0x57dc84-0x0;var _0x1b316c=_0xf4eb[_0x57dc84];return _0x1b316c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('SalesforceField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c988f,_0x2bfd64){var _0x52a66f=function(_0x1629f0){while(--_0x1629f0){_0x4c988f['push'](_0x4c988f['shift']());}};_0x52a66f(++_0x2bfd64);}(_0xe706,0xa3));var _0x6e70=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe706[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index adef4ff..9d9af82 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 _0x183e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x183e,0x193));var _0xe183=function(_0x9706d0,_0x2cb8b7){_0x9706d0=_0x9706d0-0x0;var _0x1d2cf5=_0x183e[_0x9706d0];return _0x1d2cf5;};'use strict';var multer=require(_0xe183('0x0'));var util=require(_0xe183('0x1'));var path=require(_0xe183('0x2'));var timeout=require('connect-timeout');var express=require(_0xe183('0x3'));var router=express[_0xe183('0x4')]();var auth=require(_0xe183('0x5'));var interaction=require(_0xe183('0x6'));var config=require(_0xe183('0x7'));var controller=require(_0xe183('0x8'));router['get']('/',auth[_0xe183('0x9')](),controller[_0xe183('0xa')]);router['get'](_0xe183('0xb'),auth[_0xe183('0x9')](),controller['show']);router[_0xe183('0xc')](_0xe183('0xd'),auth[_0xe183('0x9')](),controller[_0xe183('0xe')]);router[_0xe183('0xc')](_0xe183('0xf'),auth['isAuthenticated'](),controller[_0xe183('0x10')]);router[_0xe183('0x11')]('/',auth[_0xe183('0x9')](),controller[_0xe183('0x12')]);router[_0xe183('0x11')](_0xe183('0xd'),auth[_0xe183('0x9')](),controller[_0xe183('0x13')]);router[_0xe183('0x14')](_0xe183('0xb'),auth[_0xe183('0x9')](),controller['update']);router[_0xe183('0x15')](_0xe183('0xb'),auth[_0xe183('0x9')](),controller[_0xe183('0x16')]);module[_0xe183('0x17')]=router; \ No newline at end of file +var _0x191b=['util','path','connect-timeout','express','Router','isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','create','/:id/configurations','addConfiguration','put','exports'];(function(_0x2db9fc,_0x12ed7f){var _0x2b5a00=function(_0x57f392){while(--_0x57f392){_0x2db9fc['push'](_0x2db9fc['shift']());}};_0x2b5a00(++_0x12ed7f);}(_0x191b,0x100));var _0xb191=function(_0x867c76,_0x189595){_0x867c76=_0x867c76-0x0;var _0x2cf797=_0x191b[_0x867c76];return _0x2cf797;};'use strict';var multer=require('multer');var util=require(_0xb191('0x0'));var path=require(_0xb191('0x1'));var timeout=require(_0xb191('0x2'));var express=require(_0xb191('0x3'));var router=express[_0xb191('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xb191('0x5')](),controller[_0xb191('0x6')]);router[_0xb191('0x7')](_0xb191('0x8'),auth[_0xb191('0x5')](),controller['show']);router['get']('/:id/configurations',auth[_0xb191('0x5')](),controller[_0xb191('0x9')]);router['get'](_0xb191('0xa'),auth[_0xb191('0x5')](),controller['getFields']);router['post']('/',auth[_0xb191('0x5')](),controller[_0xb191('0xb')]);router['post'](_0xb191('0xc'),auth[_0xb191('0x5')](),controller[_0xb191('0xd')]);router[_0xb191('0xe')]('/:id',auth[_0xb191('0x5')](),controller['update']);router['delete'](_0xb191('0x8'),auth[_0xb191('0x5')](),controller['destroy']);module[_0xb191('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e862771..c4e4899 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 _0xe80e=['STRING','username','sequelize'];(function(_0x4f67f1,_0x3d02bf){var _0x52c611=function(_0x2ff881){while(--_0x2ff881){_0x4f67f1['push'](_0x4f67f1['shift']());}};_0x52c611(++_0x3d02bf);}(_0xe80e,0x1b8));var _0xee80=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xe80e[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0xee80('0x0'));module['exports']={'name':{'type':Sequelize[_0xee80('0x1')]},'description':{'type':Sequelize[_0xee80('0x1')]},'username':{'type':Sequelize[_0xee80('0x1')],'unique':_0xee80('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xee80('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x390a=['STRING','remoteUri','sequelize'];(function(_0x224e34,_0x2244e1){var _0x55135e=function(_0xb10c26){while(--_0xb10c26){_0x224e34['push'](_0x224e34['shift']());}};_0x55135e(++_0x2244e1);}(_0x390a,0xc8));var _0xa390=function(_0x26d945,_0x3e6366){_0x26d945=_0x26d945-0x0;var _0x58c2fb=_0x390a[_0x26d945];return _0x58c2fb;};'use strict';var Sequelize=require(_0xa390('0x0'));module['exports']={'name':{'type':Sequelize[_0xa390('0x1')]},'description':{'type':Sequelize[_0xa390('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa390('0x1')]},'remoteUri':{'type':Sequelize[_0xa390('0x1')],'unique':_0xa390('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7219a06..d6225c8 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 _0x0530=['nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','create','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','business_duration','work_end','reopened_time','resolved_at','caller_id','short_description','close_code','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','result','incident\x20table\x20objects','assign','remove','includes','label','push','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','inactive','false','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','end','status','offset','limit','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','find','body','getConfigurations','findOne'];(function(_0x39091d,_0x118adf){var _0x208b32=function(_0x2359ff){while(--_0x2359ff){_0x39091d['push'](_0x39091d['shift']());}};_0x208b32(++_0x118adf);}(_0x0530,0x1f3));var _0x0053=function(_0x297ef9,_0x1c8aed){_0x297ef9=_0x297ef9-0x0;var _0x2f4e66=_0x0530[_0x297ef9];return _0x2f4e66;};'use strict';var pdf=require(_0x0053('0x0'));var emlformat=require(_0x0053('0x1'));var rimraf=require(_0x0053('0x2'));var zipdir=require(_0x0053('0x3'));var jsonpatch=require(_0x0053('0x4'));var rp=require(_0x0053('0x5'));var moment=require(_0x0053('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0053('0x7'));var util=require(_0x0053('0x8'));var path=require(_0x0053('0x9'));var sox=require(_0x0053('0xa'));var csv=require(_0x0053('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0053('0xc'));var squel=require('squel');var crypto=require(_0x0053('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0053('0xe'));var toCsv=require(_0x0053('0xb'));var querystring=require(_0x0053('0xf'));var Papa=require(_0x0053('0x10'));var Redis=require(_0x0053('0x11'));var authService=require(_0x0053('0x12'));var qs=require(_0x0053('0x13'));var as=require(_0x0053('0x14'));var hardwareService=require(_0x0053('0x15'));var logger=require(_0x0053('0x16'))(_0x0053('0x17'));var utils=require(_0x0053('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0053('0x19'))['db'];var integrations=require(_0x0053('0x1a'));var jayson=require(_0x0053('0x1b'));var client=jayson['client'][_0x0053('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2aeb40,_0x1b777c,_0x561971,_0x5dad15){return new BPromise(function(_0x265e33,_0x211b7e){var _0x2afdfe=_0x5dad15||client;return _0x2afdfe[_0x0053('0x1d')](_0x2aeb40,_0x561971)[_0x0053('0x1e')](function(_0xa43539){logger[_0x0053('0x1f')](_0x0053('0x20'),_0x1b777c,_0x0053('0x21'));logger[_0x0053('0x22')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1b777c,'request\x20sent',JSON[_0x0053('0x23')](_0xa43539));if(_0xa43539[_0x0053('0x24')]){if(_0xa43539[_0x0053('0x24')][_0x0053('0x25')]===0x1f4){logger[_0x0053('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x1b777c,_0xa43539[_0x0053('0x24')]['message']);return _0x211b7e(_0xa43539[_0x0053('0x24')]['message']);}logger[_0x0053('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x1b777c,_0xa43539[_0x0053('0x24')][_0x0053('0x26')]);return _0x265e33(_0xa43539[_0x0053('0x24')][_0x0053('0x26')]);}else{logger['info'](_0x0053('0x20'),_0x1b777c,_0x0053('0x21'));_0x265e33(_0xa43539['result'][_0x0053('0x26')]);}})[_0x0053('0x27')](function(_0x2cf463){logger[_0x0053('0x24')](_0x0053('0x20'),_0x1b777c,_0x2cf463);_0x211b7e(_0x2cf463);});});}function respondWithStatusCode(_0x3ad434,_0x21ea83){_0x21ea83=_0x21ea83||0xcc;return function(_0x2a2afc){if(_0x2a2afc){return _0x3ad434['sendStatus'](_0x21ea83);}return _0x3ad434['status'](_0x21ea83)[_0x0053('0x28')]();};}function respondWithResult(_0x527f8c,_0x7c1e9c){_0x7c1e9c=_0x7c1e9c||0xc8;return function(_0x1a25df){if(_0x1a25df){return _0x527f8c[_0x0053('0x29')](_0x7c1e9c)['json'](_0x1a25df);}};}function respondWithFilteredResult(_0x4ed2ef,_0x9326f2){return function(_0x16eef7){if(_0x16eef7){var _0x44b010=_0x16eef7['count'],_0x33fab6=_0x9326f2[_0x0053('0x2a')],_0x302d74=_0x9326f2[_0x0053('0x2a')]+_0x9326f2[_0x0053('0x2b')],_0x55b1a7;if(_0x302d74>=_0x44b010){_0x302d74=_0x44b010;_0x55b1a7=0xc8;}else{_0x55b1a7=0xce;}_0x4ed2ef[_0x0053('0x29')](_0x55b1a7);return _0x4ed2ef['set'](_0x0053('0x2c'),_0x33fab6+'-'+_0x302d74+'/'+_0x44b010)[_0x0053('0x2d')](_0x16eef7);}return null;};}function patchUpdates(_0x3607da){return function(_0x1eeda4){try{jsonpatch[_0x0053('0x2e')](_0x1eeda4,_0x3607da,!![]);}catch(_0x503982){return BPromise[_0x0053('0x2f')](_0x503982);}return _0x1eeda4[_0x0053('0x30')]();};}function saveUpdates(_0x313194,_0x341e65){return function(_0x301150){if(_0x301150){return _0x301150[_0x0053('0x31')](_0x313194)[_0x0053('0x1e')](function(_0x284f65){return _0x284f65;});}return null;};}function removeEntity(_0x649ba2,_0x2eb285){return function(_0x57ffa5){if(_0x57ffa5){return _0x57ffa5[_0x0053('0x32')]()[_0x0053('0x1e')](function(){_0x649ba2['status'](0xcc)[_0x0053('0x28')]();});}};}function handleEntityNotFound(_0x39295e,_0x1dd787){return function(_0x49e448){if(!_0x49e448){_0x39295e[_0x0053('0x33')](0x194);}return _0x49e448;};}function handleError(_0x12987d,_0xa22552){_0xa22552=_0xa22552||0x1f4;return function(_0x5168db){logger['error'](_0x5168db[_0x0053('0x34')]);if(_0x5168db[_0x0053('0x35')]){delete _0x5168db[_0x0053('0x35')];}_0x12987d['status'](_0xa22552)[_0x0053('0x36')](_0x5168db);};}exports['index']=function(_0x4c1138,_0x2244cb){var _0x47be1b={},_0x1eaee4={},_0x15d70d={'count':0x0,'rows':[]};var _0x1564b2=_[_0x0053('0x37')](db[_0x0053('0x38')][_0x0053('0x39')],function(_0x1690b3){return{'name':_0x1690b3['fieldName'],'type':_0x1690b3[_0x0053('0x3a')]['key']};});_0x1eaee4[_0x0053('0x3b')]=_[_0x0053('0x37')](_0x1564b2,'name');_0x1eaee4[_0x0053('0x3c')]=_[_0x0053('0x3d')](_0x4c1138[_0x0053('0x3c')]);_0x1eaee4[_0x0053('0x3e')]=_[_0x0053('0x3f')](_0x1eaee4[_0x0053('0x3b')],_0x1eaee4[_0x0053('0x3c')]);_0x47be1b[_0x0053('0x40')]=_[_0x0053('0x3f')](_0x1eaee4[_0x0053('0x3b')],qs[_0x0053('0x41')](_0x4c1138[_0x0053('0x3c')][_0x0053('0x41')]));_0x47be1b[_0x0053('0x40')]=_0x47be1b[_0x0053('0x40')][_0x0053('0x42')]?_0x47be1b[_0x0053('0x40')]:_0x1eaee4['model'];if(!_0x4c1138[_0x0053('0x3c')][_0x0053('0x43')]('nolimit')){_0x47be1b['limit']=qs[_0x0053('0x2b')](_0x4c1138[_0x0053('0x3c')][_0x0053('0x2b')]);_0x47be1b['offset']=qs[_0x0053('0x2a')](_0x4c1138[_0x0053('0x3c')]['offset']);}_0x47be1b[_0x0053('0x44')]=qs[_0x0053('0x45')](_0x4c1138['query'][_0x0053('0x45')]);_0x47be1b[_0x0053('0x46')]=qs[_0x0053('0x3e')](_[_0x0053('0x47')](_0x4c1138[_0x0053('0x3c')],_0x1eaee4['filters']),_0x1564b2);if(_0x4c1138[_0x0053('0x3c')][_0x0053('0x48')]){_0x47be1b[_0x0053('0x46')]=_['merge'](_0x47be1b['where'],{'$or':_[_0x0053('0x37')](_0x1564b2,function(_0x11380a){if(_0x11380a[_0x0053('0x3a')]!=='VIRTUAL'){var _0x355259={};_0x355259[_0x11380a[_0x0053('0x35')]]={'$like':'%'+_0x4c1138['query'][_0x0053('0x48')]+'%'};return _0x355259;}})});}_0x47be1b=_[_0x0053('0x49')]({},_0x47be1b,_0x4c1138[_0x0053('0x4a')]);var _0x25be2e={'where':_0x47be1b[_0x0053('0x46')]};return db['ServicenowAccount']['count'](_0x25be2e)[_0x0053('0x1e')](function(_0x40b337){_0x15d70d[_0x0053('0x4b')]=_0x40b337;if(_0x4c1138[_0x0053('0x3c')][_0x0053('0x4c')]){_0x47be1b[_0x0053('0x4d')]=[{'all':!![]}];}return db[_0x0053('0x38')][_0x0053('0x4e')](_0x47be1b);})['then'](function(_0x53a7fd){_0x15d70d[_0x0053('0x4f')]=_0x53a7fd;return _0x15d70d;})[_0x0053('0x1e')](respondWithFilteredResult(_0x2244cb,_0x47be1b))[_0x0053('0x27')](handleError(_0x2244cb,null));};exports[_0x0053('0x50')]=function(_0x581763,_0x4e7b40){var _0x2b1da9={'raw':![],'where':{'id':_0x581763[_0x0053('0x51')]['id']}},_0x21f113={};_0x21f113[_0x0053('0x3b')]=_['keys'](db[_0x0053('0x38')][_0x0053('0x39')]);_0x21f113[_0x0053('0x3c')]=_[_0x0053('0x3d')](_0x581763[_0x0053('0x3c')]);_0x21f113[_0x0053('0x3e')]=_[_0x0053('0x3f')](_0x21f113[_0x0053('0x3b')],_0x21f113[_0x0053('0x3c')]);_0x2b1da9[_0x0053('0x40')]=_[_0x0053('0x3f')](_0x21f113['model'],qs[_0x0053('0x41')](_0x581763['query'][_0x0053('0x41')]));_0x2b1da9['attributes']=_0x2b1da9[_0x0053('0x40')]['length']?_0x2b1da9[_0x0053('0x40')]:_0x21f113['model'];if(_0x581763[_0x0053('0x3c')][_0x0053('0x4c')]){_0x2b1da9[_0x0053('0x4d')]=[{'all':!![]}];}_0x2b1da9=_[_0x0053('0x49')]({},_0x2b1da9,_0x581763[_0x0053('0x4a')]);return db[_0x0053('0x38')][_0x0053('0x52')](_0x2b1da9)[_0x0053('0x1e')](handleEntityNotFound(_0x4e7b40,null))[_0x0053('0x1e')](respondWithResult(_0x4e7b40,null))[_0x0053('0x27')](handleError(_0x4e7b40,null));};exports['create']=function(_0x18898f,_0x175a80){return db[_0x0053('0x38')]['create'](_0x18898f[_0x0053('0x53')],{})[_0x0053('0x1e')](respondWithResult(_0x175a80,0xc9))[_0x0053('0x27')](handleError(_0x175a80,null));};exports[_0x0053('0x31')]=function(_0x13c989,_0x556314){if(_0x13c989[_0x0053('0x53')]['id']){delete _0x13c989[_0x0053('0x53')]['id'];}return db[_0x0053('0x38')][_0x0053('0x52')]({'where':{'id':_0x13c989[_0x0053('0x51')]['id']}})[_0x0053('0x1e')](handleEntityNotFound(_0x556314,null))['then'](saveUpdates(_0x13c989['body'],null))[_0x0053('0x1e')](respondWithResult(_0x556314,null))[_0x0053('0x27')](handleError(_0x556314,null));};exports[_0x0053('0x32')]=function(_0x288a83,_0x548553){return db['ServicenowAccount'][_0x0053('0x52')]({'where':{'id':_0x288a83[_0x0053('0x51')]['id']}})['then'](handleEntityNotFound(_0x548553,null))[_0x0053('0x1e')](removeEntity(_0x548553,null))['catch'](handleError(_0x548553,null));};exports[_0x0053('0x54')]=function(_0x292ad7,_0x2c5210,_0x197ba0){var _0x43aa43={};var _0x5e537c={};var _0x14a200;var _0x11e5a7;return db[_0x0053('0x38')][_0x0053('0x55')]({'where':{'id':_0x292ad7[_0x0053('0x51')]['id']}})[_0x0053('0x1e')](handleEntityNotFound(_0x2c5210,null))[_0x0053('0x1e')](function(_0xc3fab5){if(_0xc3fab5){_0x14a200=_0xc3fab5;_0x5e537c[_0x0053('0x3b')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x5e537c['query']=_[_0x0053('0x3d')](_0x292ad7[_0x0053('0x3c')]);_0x5e537c[_0x0053('0x3e')]=_[_0x0053('0x3f')](_0x5e537c[_0x0053('0x3b')],_0x5e537c['query']);_0x43aa43[_0x0053('0x40')]=_[_0x0053('0x3f')](_0x5e537c['model'],qs[_0x0053('0x41')](_0x292ad7[_0x0053('0x3c')][_0x0053('0x41')]));_0x43aa43['attributes']=_0x43aa43[_0x0053('0x40')]['length']?_0x43aa43[_0x0053('0x40')]:_0x5e537c[_0x0053('0x3b')];_0x43aa43[_0x0053('0x44')]=qs[_0x0053('0x45')](_0x292ad7[_0x0053('0x3c')]['sort']);_0x43aa43[_0x0053('0x46')]=qs['filters'](_[_0x0053('0x47')](_0x292ad7[_0x0053('0x3c')],_0x5e537c['filters']));if(_0x292ad7['query'][_0x0053('0x48')]){_0x43aa43[_0x0053('0x46')]=_['merge'](_0x43aa43['where'],{'$or':_[_0x0053('0x37')](_0x43aa43['attributes'],function(_0xea7379){var _0x1d4c3d={};_0x1d4c3d[_0xea7379]={'$like':'%'+_0x292ad7[_0x0053('0x3c')][_0x0053('0x48')]+'%'};return _0x1d4c3d;})});}_0x43aa43=_['merge']({},_0x43aa43,_0x292ad7['options']);return _0x14a200[_0x0053('0x54')](_0x43aa43);}})[_0x0053('0x1e')](function(_0x15f4a0){if(_0x15f4a0){_0x11e5a7=_0x15f4a0[_0x0053('0x42')];if(!_0x292ad7['query']['hasOwnProperty'](_0x0053('0x56'))){_0x43aa43[_0x0053('0x2b')]=qs[_0x0053('0x2b')](_0x292ad7['query'][_0x0053('0x2b')]);_0x43aa43[_0x0053('0x2a')]=qs[_0x0053('0x2a')](_0x292ad7[_0x0053('0x3c')][_0x0053('0x2a')]);}return _0x14a200['getConfigurations'](_0x43aa43);}})[_0x0053('0x1e')](function(_0x4fa5ad){if(_0x4fa5ad){return _0x4fa5ad?{'count':_0x11e5a7,'rows':_0x4fa5ad}:null;}})['then'](respondWithResult(_0x2c5210,null))[_0x0053('0x27')](handleError(_0x2c5210,null));};exports['addConfiguration']=function(_0x31f6d2,_0x39303c,_0x4cd223){if(_0x31f6d2[_0x0053('0x53')]['id']){delete _0x31f6d2['body']['id'];}return db[_0x0053('0x38')]['findOne']({'where':{'id':_0x31f6d2[_0x0053('0x51')]['id']}})[_0x0053('0x1e')](handleEntityNotFound(_0x39303c,null))[_0x0053('0x1e')](function(_0x588d1c){if(_0x588d1c){_0x31f6d2[_0x0053('0x53')][_0x0053('0x57')]=_0x588d1c['id'];_0x31f6d2[_0x0053('0x53')][_0x0053('0x58')]=integrations[_0x0053('0x59')](_0x31f6d2[_0x0053('0x53')][_0x0053('0x5a')],_0x31f6d2[_0x0053('0x53')][_0x0053('0x3a')]);_0x31f6d2[_0x0053('0x53')]['Descriptions']=integrations[_0x0053('0x5b')](_0x31f6d2[_0x0053('0x53')][_0x0053('0x5a')],_0x31f6d2[_0x0053('0x53')][_0x0053('0x3a')]);return db['ServicenowConfiguration'][_0x0053('0x5c')](_0x31f6d2[_0x0053('0x53')],{'include':[{'model':db[_0x0053('0x5d')],'as':_0x0053('0x58')},{'model':db[_0x0053('0x5d')],'as':'Descriptions'}]});}return null;})[_0x0053('0x1e')](respondWithResult(_0x39303c,null))[_0x0053('0x27')](handleError(_0x39303c,null));};exports[_0x0053('0x5e')]=function(_0x4b6e6e,_0x2c765e,_0x575ed9){var _0x1f5121=[_0x0053('0x5f'),_0x0053('0x60'),_0x0053('0x61'),_0x0053('0x62'),'close_code',_0x0053('0x63'),_0x0053('0x64'),_0x0053('0x65'),_0x0053('0x66')];var _0x7ea617=[_0x0053('0x67'),_0x0053('0x5f'),_0x0053('0x68'),_0x0053('0x69'),_0x0053('0x6a'),_0x0053('0x6b'),_0x0053('0x6c'),_0x0053('0x60'),_0x0053('0x6d'),'number',_0x0053('0x6e'),_0x0053('0x6f'),_0x0053('0x70'),_0x0053('0x71'),_0x0053('0x72'),_0x0053('0x73'),_0x0053('0x74'),_0x0053('0x75'),_0x0053('0x61'),_0x0053('0x44'),'calendar_stc',_0x0053('0x76'),_0x0053('0x77'),_0x0053('0x78'),_0x0053('0x79'),'active',_0x0053('0x7a'),_0x0053('0x7b'),'priority',_0x0053('0x7c'),'rfc',_0x0053('0x7d'),_0x0053('0x7e'),'opened_at',_0x0053('0x7f'),'group_list',_0x0053('0x80'),_0x0053('0x81'),_0x0053('0x82'),_0x0053('0x83'),'approval_set',_0x0053('0x62'),'work_notes',_0x0053('0x84'),_0x0053('0x85'),_0x0053('0x86'),_0x0053('0x87'),'work_start',_0x0053('0x88'),_0x0053('0x89'),_0x0053('0x8a'),_0x0053('0x8b'),_0x0053('0x8c'),_0x0053('0x63'),_0x0053('0x8d'),_0x0053('0x8e'),_0x0053('0x8f'),'follow_up',_0x0053('0x90'),_0x0053('0x91'),'contact_type',_0x0053('0x92'),_0x0053('0x64'),_0x0053('0x93'),_0x0053('0x94'),_0x0053('0x95'),_0x0053('0x96'),'activity_due',_0x0053('0x97'),_0x0053('0x65'),_0x0053('0x98'),_0x0053('0x99'),_0x0053('0x9a'),_0x0053('0x9b'),_0x0053('0x9c'),_0x0053('0x9d'),_0x0053('0x9e'),'sys_tags',_0x0053('0x9f'),_0x0053('0xa0'),_0x0053('0xa1'),_0x0053('0xa2'),_0x0053('0x66')];var _0x2dcbac='';var _0x21e41a='';var _0x9287bb=[];var _0x436aa8='';var _0x18148f='';var _0x3c5547=[];var _0x38d62f='';var _0x1f300a='';var _0x29a18f={};var _0x20f789='';return db[_0x0053('0x38')][_0x0053('0x55')]({'where':{'id':_0x4b6e6e[_0x0053('0x51')]['id']},'attributes':['id','username','password',_0x0053('0xa3'),_0x0053('0xa4'),_0x0053('0xa5')]})[_0x0053('0x1e')](handleEntityNotFound(_0x2c765e,null))['then'](function(_0x3d40e6){if(_0x3d40e6){_0x20f789=_0x3d40e6[_0x0053('0xa4')];var _0x3a4e0a=_0x20f789[_0x0053('0xa6')](-0x1);if(_0x3a4e0a==='/'){_0x20f789=_0x20f789['substring'](0x0,_0x20f789['lastIndexOf'](_0x3a4e0a));}_0x1f300a=util[_0x0053('0xa7')](_0x0053('0xa8'),_0x20f789);_0x38d62f=util[_0x0053('0xa7')](_0x0053('0xa9'),_0x20f789);_0x29a18f={'user':_0x3d40e6[_0x0053('0xaa')],'pass':_0x3d40e6[_0x0053('0xab')]};var _0x5125b2={'method':_0x0053('0xac'),'uri':_0x1f300a+'incident?sysparm_display_value=all','auth':_0x29a18f,'json':!![]};return rp(_0x5125b2);}})[_0x0053('0x1e')](function(_0x117b26){if(_0x117b26[_0x0053('0xad')]['length']>0x0){_0x2dcbac=_0x117b26[_0x0053('0xad')];}console['log'](_0x0053('0xae'),_0x2dcbac);_0x3c5547=[];_0x21e41a=Object[_0x0053('0xaf')]([],_0x2dcbac);_[_0x0053('0xb0')](_0x21e41a,function(_0x4c283f){return!_0x1f5121[_0x0053('0xb1')](_0x4c283f[_0x0053('0x35')]);});_0x21e41a['forEach'](function(_0x1c3869){var _0x3ce63b=createFieldObject(_0x38d62f,_0x29a18f,_0x1c3869['internalType'],_0x1c3869[_0x0053('0x35')],_0x1c3869[_0x0053('0xb2')],![]);_0x3c5547[_0x0053('0xb3')](_0x3ce63b);});return Promise['all'](_0x3c5547);})[_0x0053('0x1e')](function(_0x5b8eb5){_0x9287bb=_0x5b8eb5;_0x436aa8=Object[_0x0053('0xaf')]([],_0x2dcbac);console['log'](_0x0053('0xb4'),_0x2dcbac);_[_0x0053('0xb0')](_0x436aa8,function(_0x14f8af){return _0x7ea617[_0x0053('0xb1')](_0x14f8af[_0x0053('0x35')]);});console[_0x0053('0xb5')](_0x0053('0xb6'),_0x436aa8);_0x3c5547=[];_0x436aa8[_0x0053('0xb7')](function(_0x1efc37){var _0x1aeb05=createFieldObject(_0x38d62f,_0x29a18f,_0x1efc37['internalType'],_0x1efc37[_0x0053('0x35')],_0x1efc37[_0x0053('0xb2')],!![]);_0x3c5547[_0x0053('0xb3')](_0x1aeb05);});return Promise['all'](_0x3c5547);})[_0x0053('0x1e')](function(_0x4951c1){_0x18148f=_0x4951c1;var _0x521f6c=_0x9287bb[_0x0053('0xb8')](_0x18148f);return{'count':_0x521f6c[_0x0053('0x42')],'rows':_0x521f6c};})[_0x0053('0x1e')](respondWithResult(_0x2c765e,null))[_0x0053('0x27')](function(_0xf21950){console[_0x0053('0xb5')]('ServiceNow\x20error:\x20'+_0xf21950);var _0x5bd3c2=_0x4b6e6e[_0x0053('0x3c')][_0x0053('0xb9')]?0x1f4:_0xf21950[_0x0053('0xba')]||0x1f4;logger['error'](_0xf21950[_0x0053('0x34')]);delete _0xf21950['name'];if(_0x5bd3c2===0x191){_0x5bd3c2=0x190;}_0x2c765e[_0x0053('0x29')](_0x5bd3c2)['send'](_0x4b6e6e[_0x0053('0x3c')][_0x0053('0xb9')]?{'message':_0x0053('0xbb'),'statusCode':_0xf21950[_0x0053('0xba')]}:_0xf21950);});};function createFieldObject(_0x59d4d7,_0x1a9d3d,_0x574bd9,_0x11a6a5,_0x58ab89,_0x48b65b){return new Promise(function(_0x3d8f2c,_0x3bd396){var _0x18c188={'id':_0x11a6a5,'name':_0x58ab89,'custom':_0x48b65b};if(_0x574bd9===_0x0053('0xbc')){_0x18c188[_0x0053('0x4a')]=[{'name':_0x0053('0xbd'),'value':_0x0053('0xbe')},{'name':_0x0053('0xbf'),'value':'false'}];_0x3d8f2c(_0x18c188);}else{var _0xd56db2={'method':'GET','uri':_0x59d4d7+'sys_choice?sysparm_query=name=incident^element='+_0x11a6a5,'auth':_0x1a9d3d,'json':!![]};return rp(_0xd56db2)[_0x0053('0x1e')](function(_0x9d4b03){var _0x1f5014=[];if(_0x9d4b03[_0x0053('0xad')][_0x0053('0x42')]>0x0){_0x9d4b03[_0x0053('0xad')]['forEach'](function(_0x28e82a){if(_0x28e82a[_0x0053('0xc0')]===_0x0053('0xc1')){var _0xe9a7c3={'name':_0x28e82a[_0x0053('0xb2')],'value':_0x28e82a[_0x0053('0xc2')]};_0x1f5014[_0x0053('0xb3')](_0xe9a7c3);}});}_0x18c188['options']=_0x1f5014;if(_0x18c188[_0x0053('0x4a')][_0x0053('0x42')]>0x0){_0x3d8f2c(_0x18c188);}else{if(_0x48b65b==![]){_0x3d8f2c();}else{_0x3d8f2c(_0x18c188);}}});}});} \ No newline at end of file +var _0xc847=['resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','approval','due_date','sys_mod_count','reopen_count','escalation','correlation_id','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','assign','forEach','push','all','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','test','statusCode','stack','send','Wrong\x20credentials','True','true','False','false','value','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','name','index','map','ServicenowAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','body','getConfigurations','findOne','params','ServicenowConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','close_code','notify','incident_state','parent','watch_list','upon_reject','child_incidents','number'];(function(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0xc847,0x115));var _0x7c84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc847[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7c84('0x0'));var emlformat=require(_0x7c84('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7c84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c84('0x3'));var moment=require(_0x7c84('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7c84('0x5'));var util=require(_0x7c84('0x6'));var path=require('path');var sox=require(_0x7c84('0x7'));var csv=require('to-csv');var ejs=require(_0x7c84('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7c84('0x9'));var crypto=require(_0x7c84('0xa'));var jsforce=require(_0x7c84('0xb'));var deskjs=require(_0x7c84('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7c84('0xd'));var Redis=require(_0x7c84('0xe'));var authService=require(_0x7c84('0xf'));var qs=require(_0x7c84('0x10'));var as=require(_0x7c84('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c84('0x12'));var utils=require(_0x7c84('0x13'));var config=require(_0x7c84('0x14'));var licenseUtil=require(_0x7c84('0x15'));var db=require(_0x7c84('0x16'))['db'];var integrations=require(_0x7c84('0x17'));var jayson=require(_0x7c84('0x18'));var client=jayson['client'][_0x7c84('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x21bbc9,_0x462557,_0x13ec3f,_0x18d08e){return new BPromise(function(_0x4534d0,_0xdbf1ce){var _0x24aacb=_0x18d08e||client;return _0x24aacb[_0x7c84('0x1a')](_0x21bbc9,_0x13ec3f)[_0x7c84('0x1b')](function(_0x5798ac){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x462557,_0x7c84('0x1c'));logger[_0x7c84('0x1d')](_0x7c84('0x1e'),_0x462557,_0x7c84('0x1c'),JSON[_0x7c84('0x1f')](_0x5798ac));if(_0x5798ac[_0x7c84('0x20')]){if(_0x5798ac[_0x7c84('0x20')][_0x7c84('0x21')]===0x1f4){logger[_0x7c84('0x20')](_0x7c84('0x22'),_0x462557,_0x5798ac[_0x7c84('0x20')][_0x7c84('0x23')]);return _0xdbf1ce(_0x5798ac[_0x7c84('0x20')][_0x7c84('0x23')]);}logger[_0x7c84('0x20')](_0x7c84('0x22'),_0x462557,_0x5798ac[_0x7c84('0x20')][_0x7c84('0x23')]);return _0x4534d0(_0x5798ac[_0x7c84('0x20')][_0x7c84('0x23')]);}else{logger[_0x7c84('0x24')](_0x7c84('0x22'),_0x462557,'request\x20sent');_0x4534d0(_0x5798ac['result'][_0x7c84('0x23')]);}})[_0x7c84('0x25')](function(_0x269213){logger[_0x7c84('0x20')](_0x7c84('0x22'),_0x462557,_0x269213);_0xdbf1ce(_0x269213);});});}function respondWithStatusCode(_0x2d02c6,_0x277573){_0x277573=_0x277573||0xcc;return function(_0x80a63){if(_0x80a63){return _0x2d02c6[_0x7c84('0x26')](_0x277573);}return _0x2d02c6[_0x7c84('0x27')](_0x277573)[_0x7c84('0x28')]();};}function respondWithResult(_0x3fd50d,_0x2a4159){_0x2a4159=_0x2a4159||0xc8;return function(_0x4daae6){if(_0x4daae6){return _0x3fd50d[_0x7c84('0x27')](_0x2a4159)[_0x7c84('0x29')](_0x4daae6);}};}function respondWithFilteredResult(_0x2c80d1,_0x4b69c0){return function(_0x2fc3a3){if(_0x2fc3a3){var _0x1bf252=_0x2fc3a3[_0x7c84('0x2a')],_0xd9c768=_0x4b69c0[_0x7c84('0x2b')],_0x20f456=_0x4b69c0['offset']+_0x4b69c0[_0x7c84('0x2c')],_0x11d468;if(_0x20f456>=_0x1bf252){_0x20f456=_0x1bf252;_0x11d468=0xc8;}else{_0x11d468=0xce;}_0x2c80d1[_0x7c84('0x27')](_0x11d468);return _0x2c80d1[_0x7c84('0x2d')]('Content-Range',_0xd9c768+'-'+_0x20f456+'/'+_0x1bf252)[_0x7c84('0x29')](_0x2fc3a3);}return null;};}function patchUpdates(_0x4ebdb6){return function(_0x1a0ba8){try{jsonpatch[_0x7c84('0x2e')](_0x1a0ba8,_0x4ebdb6,!![]);}catch(_0x28b736){return BPromise['reject'](_0x28b736);}return _0x1a0ba8[_0x7c84('0x2f')]();};}function saveUpdates(_0x592eef,_0x4565df){return function(_0x4b81fc){if(_0x4b81fc){return _0x4b81fc[_0x7c84('0x30')](_0x592eef)[_0x7c84('0x1b')](function(_0x73d1bc){return _0x73d1bc;});}return null;};}function removeEntity(_0x1f911b,_0x437b8b){return function(_0x12e174){if(_0x12e174){return _0x12e174['destroy']()['then'](function(){_0x1f911b['status'](0xcc)[_0x7c84('0x28')]();});}};}function handleEntityNotFound(_0x5324a9,_0x516178){return function(_0x2a98fc){if(!_0x2a98fc){_0x5324a9['sendStatus'](0x194);}return _0x2a98fc;};}function handleError(_0x4b17e8,_0x25dceb){_0x25dceb=_0x25dceb||0x1f4;return function(_0x96529d){logger[_0x7c84('0x20')](_0x96529d['stack']);if(_0x96529d[_0x7c84('0x31')]){delete _0x96529d['name'];}_0x4b17e8['status'](_0x25dceb)['send'](_0x96529d);};}exports[_0x7c84('0x32')]=function(_0x463771,_0x41670f){var _0x10acdc={},_0x45c6e6={},_0x488808={'count':0x0,'rows':[]};var _0x295bdc=_[_0x7c84('0x33')](db[_0x7c84('0x34')][_0x7c84('0x35')],function(_0x41da6e){return{'name':_0x41da6e['fieldName'],'type':_0x41da6e['type']['key']};});_0x45c6e6[_0x7c84('0x36')]=_[_0x7c84('0x33')](_0x295bdc,'name');_0x45c6e6['query']=_[_0x7c84('0x37')](_0x463771[_0x7c84('0x38')]);_0x45c6e6[_0x7c84('0x39')]=_[_0x7c84('0x3a')](_0x45c6e6['model'],_0x45c6e6['query']);_0x10acdc[_0x7c84('0x3b')]=_[_0x7c84('0x3a')](_0x45c6e6[_0x7c84('0x36')],qs[_0x7c84('0x3c')](_0x463771['query']['fields']));_0x10acdc['attributes']=_0x10acdc['attributes'][_0x7c84('0x3d')]?_0x10acdc[_0x7c84('0x3b')]:_0x45c6e6[_0x7c84('0x36')];if(!_0x463771[_0x7c84('0x38')][_0x7c84('0x3e')](_0x7c84('0x3f'))){_0x10acdc['limit']=qs['limit'](_0x463771['query']['limit']);_0x10acdc[_0x7c84('0x2b')]=qs['offset'](_0x463771[_0x7c84('0x38')][_0x7c84('0x2b')]);}_0x10acdc[_0x7c84('0x40')]=qs[_0x7c84('0x41')](_0x463771[_0x7c84('0x38')][_0x7c84('0x41')]);_0x10acdc[_0x7c84('0x42')]=qs['filters'](_[_0x7c84('0x43')](_0x463771[_0x7c84('0x38')],_0x45c6e6[_0x7c84('0x39')]),_0x295bdc);if(_0x463771[_0x7c84('0x38')][_0x7c84('0x44')]){_0x10acdc[_0x7c84('0x42')]=_['merge'](_0x10acdc[_0x7c84('0x42')],{'$or':_['map'](_0x295bdc,function(_0x21444f){if(_0x21444f[_0x7c84('0x45')]!==_0x7c84('0x46')){var _0x33ae1e={};_0x33ae1e[_0x21444f[_0x7c84('0x31')]]={'$like':'%'+_0x463771[_0x7c84('0x38')][_0x7c84('0x44')]+'%'};return _0x33ae1e;}})});}_0x10acdc=_[_0x7c84('0x47')]({},_0x10acdc,_0x463771[_0x7c84('0x48')]);var _0xdbff49={'where':_0x10acdc[_0x7c84('0x42')]};return db[_0x7c84('0x34')]['count'](_0xdbff49)['then'](function(_0x2fe477){_0x488808[_0x7c84('0x2a')]=_0x2fe477;if(_0x463771['query'][_0x7c84('0x49')]){_0x10acdc[_0x7c84('0x4a')]=[{'all':!![]}];}return db[_0x7c84('0x34')][_0x7c84('0x4b')](_0x10acdc);})[_0x7c84('0x1b')](function(_0x3951a0){_0x488808[_0x7c84('0x4c')]=_0x3951a0;return _0x488808;})[_0x7c84('0x1b')](respondWithFilteredResult(_0x41670f,_0x10acdc))[_0x7c84('0x25')](handleError(_0x41670f,null));};exports[_0x7c84('0x4d')]=function(_0x1d745d,_0x5c5c23){var _0x3880fb={'raw':![],'where':{'id':_0x1d745d['params']['id']}},_0x6a0f6={};_0x6a0f6[_0x7c84('0x36')]=_[_0x7c84('0x37')](db['ServicenowAccount'][_0x7c84('0x35')]);_0x6a0f6[_0x7c84('0x38')]=_[_0x7c84('0x37')](_0x1d745d[_0x7c84('0x38')]);_0x6a0f6[_0x7c84('0x39')]=_['intersection'](_0x6a0f6[_0x7c84('0x36')],_0x6a0f6[_0x7c84('0x38')]);_0x3880fb[_0x7c84('0x3b')]=_[_0x7c84('0x3a')](_0x6a0f6['model'],qs[_0x7c84('0x3c')](_0x1d745d['query'][_0x7c84('0x3c')]));_0x3880fb[_0x7c84('0x3b')]=_0x3880fb[_0x7c84('0x3b')][_0x7c84('0x3d')]?_0x3880fb[_0x7c84('0x3b')]:_0x6a0f6[_0x7c84('0x36')];if(_0x1d745d['query']['includeAll']){_0x3880fb[_0x7c84('0x4a')]=[{'all':!![]}];}_0x3880fb=_[_0x7c84('0x47')]({},_0x3880fb,_0x1d745d[_0x7c84('0x48')]);return db['ServicenowAccount'][_0x7c84('0x4e')](_0x3880fb)[_0x7c84('0x1b')](handleEntityNotFound(_0x5c5c23,null))['then'](respondWithResult(_0x5c5c23,null))['catch'](handleError(_0x5c5c23,null));};exports[_0x7c84('0x4f')]=function(_0x2df727,_0x2bca0a){return db['ServicenowAccount'][_0x7c84('0x4f')](_0x2df727[_0x7c84('0x50')],{})[_0x7c84('0x1b')](respondWithResult(_0x2bca0a,0xc9))['catch'](handleError(_0x2bca0a,null));};exports[_0x7c84('0x30')]=function(_0x1b9360,_0x2c2f8a){if(_0x1b9360[_0x7c84('0x50')]['id']){delete _0x1b9360[_0x7c84('0x50')]['id'];}return db[_0x7c84('0x34')][_0x7c84('0x4e')]({'where':{'id':_0x1b9360['params']['id']}})[_0x7c84('0x1b')](handleEntityNotFound(_0x2c2f8a,null))[_0x7c84('0x1b')](saveUpdates(_0x1b9360[_0x7c84('0x50')],null))[_0x7c84('0x1b')](respondWithResult(_0x2c2f8a,null))[_0x7c84('0x25')](handleError(_0x2c2f8a,null));};exports['destroy']=function(_0x902357,_0x3fc1ee){return db[_0x7c84('0x34')][_0x7c84('0x4e')]({'where':{'id':_0x902357['params']['id']}})[_0x7c84('0x1b')](handleEntityNotFound(_0x3fc1ee,null))['then'](removeEntity(_0x3fc1ee,null))[_0x7c84('0x25')](handleError(_0x3fc1ee,null));};exports[_0x7c84('0x51')]=function(_0x3d723c,_0x5dc933,_0x5f41d8){var _0x5cb278={};var _0xe8155b={};var _0x393de0;var _0xbe2bc8;return db['ServicenowAccount'][_0x7c84('0x52')]({'where':{'id':_0x3d723c[_0x7c84('0x53')]['id']}})[_0x7c84('0x1b')](handleEntityNotFound(_0x5dc933,null))['then'](function(_0x137ab5){if(_0x137ab5){_0x393de0=_0x137ab5;_0xe8155b[_0x7c84('0x36')]=_[_0x7c84('0x37')](db[_0x7c84('0x54')][_0x7c84('0x35')]);_0xe8155b[_0x7c84('0x38')]=_[_0x7c84('0x37')](_0x3d723c[_0x7c84('0x38')]);_0xe8155b[_0x7c84('0x39')]=_[_0x7c84('0x3a')](_0xe8155b['model'],_0xe8155b['query']);_0x5cb278[_0x7c84('0x3b')]=_['intersection'](_0xe8155b[_0x7c84('0x36')],qs[_0x7c84('0x3c')](_0x3d723c[_0x7c84('0x38')]['fields']));_0x5cb278[_0x7c84('0x3b')]=_0x5cb278['attributes'][_0x7c84('0x3d')]?_0x5cb278[_0x7c84('0x3b')]:_0xe8155b['model'];_0x5cb278[_0x7c84('0x40')]=qs[_0x7c84('0x41')](_0x3d723c['query'][_0x7c84('0x41')]);_0x5cb278[_0x7c84('0x42')]=qs[_0x7c84('0x39')](_[_0x7c84('0x43')](_0x3d723c[_0x7c84('0x38')],_0xe8155b[_0x7c84('0x39')]));if(_0x3d723c[_0x7c84('0x38')][_0x7c84('0x44')]){_0x5cb278[_0x7c84('0x42')]=_[_0x7c84('0x47')](_0x5cb278[_0x7c84('0x42')],{'$or':_[_0x7c84('0x33')](_0x5cb278['attributes'],function(_0x1bdbc1){var _0x1ae05e={};_0x1ae05e[_0x1bdbc1]={'$like':'%'+_0x3d723c[_0x7c84('0x38')]['filter']+'%'};return _0x1ae05e;})});}_0x5cb278=_['merge']({},_0x5cb278,_0x3d723c[_0x7c84('0x48')]);return _0x393de0[_0x7c84('0x51')](_0x5cb278);}})[_0x7c84('0x1b')](function(_0x130ef2){if(_0x130ef2){_0xbe2bc8=_0x130ef2[_0x7c84('0x3d')];if(!_0x3d723c[_0x7c84('0x38')][_0x7c84('0x3e')](_0x7c84('0x3f'))){_0x5cb278[_0x7c84('0x2c')]=qs[_0x7c84('0x2c')](_0x3d723c[_0x7c84('0x38')][_0x7c84('0x2c')]);_0x5cb278[_0x7c84('0x2b')]=qs['offset'](_0x3d723c[_0x7c84('0x38')][_0x7c84('0x2b')]);}return _0x393de0['getConfigurations'](_0x5cb278);}})[_0x7c84('0x1b')](function(_0x5169e5){if(_0x5169e5){return _0x5169e5?{'count':_0xbe2bc8,'rows':_0x5169e5}:null;}})['then'](respondWithResult(_0x5dc933,null))[_0x7c84('0x25')](handleError(_0x5dc933,null));};exports['addConfiguration']=function(_0x51a3d1,_0xcfffa6,_0x2c7a50){if(_0x51a3d1[_0x7c84('0x50')]['id']){delete _0x51a3d1[_0x7c84('0x50')]['id'];}return db[_0x7c84('0x34')][_0x7c84('0x52')]({'where':{'id':_0x51a3d1[_0x7c84('0x53')]['id']}})[_0x7c84('0x1b')](handleEntityNotFound(_0xcfffa6,null))[_0x7c84('0x1b')](function(_0x285935){if(_0x285935){_0x51a3d1[_0x7c84('0x50')][_0x7c84('0x55')]=_0x285935['id'];_0x51a3d1[_0x7c84('0x50')][_0x7c84('0x56')]=integrations[_0x7c84('0x57')](_0x51a3d1[_0x7c84('0x50')][_0x7c84('0x58')],_0x51a3d1['body'][_0x7c84('0x45')]);_0x51a3d1[_0x7c84('0x50')][_0x7c84('0x59')]=integrations[_0x7c84('0x5a')](_0x51a3d1[_0x7c84('0x50')][_0x7c84('0x58')],_0x51a3d1[_0x7c84('0x50')]['type']);return db[_0x7c84('0x54')][_0x7c84('0x4f')](_0x51a3d1[_0x7c84('0x50')],{'include':[{'model':db[_0x7c84('0x5b')],'as':_0x7c84('0x56')},{'model':db['ServicenowField'],'as':_0x7c84('0x59')}]});}return null;})[_0x7c84('0x1b')](respondWithResult(_0xcfffa6,null))['catch'](handleError(_0xcfffa6,null));};exports[_0x7c84('0x5c')]=function(_0x2536ea,_0x2f81a4,_0x1ccca4){var _0x33c4d9=[_0x7c84('0x5d'),_0x7c84('0x5e'),'knowledge','subcategory',_0x7c84('0x5f'),_0x7c84('0x60'),_0x7c84('0x61'),'severity','category'];var _0xecdf65=[_0x7c84('0x62'),_0x7c84('0x5d'),'caused_by',_0x7c84('0x63'),_0x7c84('0x64'),'sys_updated_on',_0x7c84('0x65'),'hold_reason','approval_history',_0x7c84('0x66'),_0x7c84('0x67'),_0x7c84('0x68'),'opened_by',_0x7c84('0x69'),_0x7c84('0x6a'),_0x7c84('0x6b'),_0x7c84('0x6c'),'sys_created_by',_0x7c84('0x6d'),'order',_0x7c84('0x6e'),_0x7c84('0x6f'),_0x7c84('0x70'),_0x7c84('0x71'),_0x7c84('0x72'),_0x7c84('0x73'),_0x7c84('0x74'),_0x7c84('0x75'),_0x7c84('0x76'),_0x7c84('0x77'),_0x7c84('0x78'),_0x7c84('0x79'),_0x7c84('0x7a'),_0x7c84('0x7b'),_0x7c84('0x7c'),_0x7c84('0x7d'),'work_end',_0x7c84('0x7e'),_0x7c84('0x7f'),_0x7c84('0x80'),_0x7c84('0x81'),_0x7c84('0x82'),_0x7c84('0x83'),_0x7c84('0x84'),_0x7c84('0x5f'),_0x7c84('0x85'),_0x7c84('0x86'),'work_start','assignment_group',_0x7c84('0x87'),'additional_assignee_list',_0x7c84('0x88'),_0x7c84('0x89'),'notify',_0x7c84('0x8a'),_0x7c84('0x8b'),'closed_by',_0x7c84('0x8c'),'parent_incident',_0x7c84('0x8d'),_0x7c84('0x8e'),'reopened_by',_0x7c84('0x61'),_0x7c84('0x8f'),_0x7c84('0x90'),_0x7c84('0x91'),_0x7c84('0x92'),_0x7c84('0x93'),_0x7c84('0x94'),_0x7c84('0x95'),'comments','sla_due',_0x7c84('0x96'),'comments_and_work_notes',_0x7c84('0x97'),_0x7c84('0x98'),_0x7c84('0x99'),'sys_tags',_0x7c84('0x9a'),'upon_approval',_0x7c84('0x9b'),'location',_0x7c84('0x9c')];var _0x5f38be='';var _0x32e305='';var _0x4c8227=[];var _0x979f45='';var _0x2a5d30='';var _0x1c3223=[];var _0x1fd462='';var _0x4a93d8='';var _0x2dbb1c={};var _0x19e87b='';return db[_0x7c84('0x34')]['findOne']({'where':{'id':_0x2536ea[_0x7c84('0x53')]['id']},'attributes':['id',_0x7c84('0x9d'),_0x7c84('0x9e'),_0x7c84('0x9f'),_0x7c84('0xa0'),_0x7c84('0xa1')]})['then'](handleEntityNotFound(_0x2f81a4,null))[_0x7c84('0x1b')](function(_0x4b535b){if(_0x4b535b){_0x19e87b=_0x4b535b[_0x7c84('0xa0')];var _0x1a209d=_0x19e87b[_0x7c84('0xa2')](-0x1);if(_0x1a209d==='/'){_0x19e87b=_0x19e87b[_0x7c84('0xa3')](0x0,_0x19e87b[_0x7c84('0xa4')](_0x1a209d));}_0x4a93d8=util[_0x7c84('0xa5')](_0x7c84('0xa6'),_0x19e87b);_0x1fd462=util['format']('%s/api/now/table/',_0x19e87b);_0x2dbb1c={'user':_0x4b535b[_0x7c84('0x9d')],'pass':_0x4b535b[_0x7c84('0x9e')]};var _0x547e90={'method':_0x7c84('0xa7'),'uri':_0x4a93d8+_0x7c84('0xa8'),'auth':_0x2dbb1c,'json':!![]};return rp(_0x547e90);}})[_0x7c84('0x1b')](function(_0x168753){if(_0x168753[_0x7c84('0xa9')][_0x7c84('0x3d')]>0x0){_0x5f38be=_0x168753[_0x7c84('0xa9')];}console[_0x7c84('0xaa')]('incident\x20table\x20objects',_0x5f38be);_0x1c3223=[];_0x32e305=Object[_0x7c84('0xab')]([],_0x5f38be);_['remove'](_0x32e305,function(_0x366f53){return!_0x33c4d9['includes'](_0x366f53[_0x7c84('0x31')]);});_0x32e305[_0x7c84('0xac')](function(_0x22b03e){var _0x272ee3=createFieldObject(_0x1fd462,_0x2dbb1c,_0x22b03e['internalType'],_0x22b03e[_0x7c84('0x31')],_0x22b03e['label'],![]);_0x1c3223[_0x7c84('0xad')](_0x272ee3);});return Promise[_0x7c84('0xae')](_0x1c3223);})[_0x7c84('0x1b')](function(_0x2fc287){_0x4c8227=_0x2fc287;_0x979f45=Object[_0x7c84('0xab')]([],_0x5f38be);console[_0x7c84('0xaa')]('TCL:\x20_object',_0x5f38be);_[_0x7c84('0xaf')](_0x979f45,function(_0x56b67f){return _0xecdf65[_0x7c84('0xb0')](_0x56b67f['name']);});console[_0x7c84('0xaa')](_0x7c84('0xb1'),_0x979f45);_0x1c3223=[];_0x979f45[_0x7c84('0xac')](function(_0xbb9424){var _0x5ef1eb=createFieldObject(_0x1fd462,_0x2dbb1c,_0xbb9424['internalType'],_0xbb9424[_0x7c84('0x31')],_0xbb9424[_0x7c84('0xb2')],!![]);_0x1c3223[_0x7c84('0xad')](_0x5ef1eb);});return Promise['all'](_0x1c3223);})[_0x7c84('0x1b')](function(_0x584fd9){_0x2a5d30=_0x584fd9;var _0x5176de=_0x4c8227[_0x7c84('0xb3')](_0x2a5d30);return{'count':_0x5176de[_0x7c84('0x3d')],'rows':_0x5176de};})['then'](respondWithResult(_0x2f81a4,null))[_0x7c84('0x25')](function(_0x512873){console[_0x7c84('0xaa')]('ServiceNow\x20error:\x20'+_0x512873);var _0xeab965=_0x2536ea[_0x7c84('0x38')][_0x7c84('0xb4')]?0x1f4:_0x512873[_0x7c84('0xb5')]||0x1f4;logger[_0x7c84('0x20')](_0x512873[_0x7c84('0xb6')]);delete _0x512873[_0x7c84('0x31')];if(_0xeab965===0x191){_0xeab965=0x190;}_0x2f81a4[_0x7c84('0x27')](_0xeab965)[_0x7c84('0xb7')](_0x2536ea[_0x7c84('0x38')][_0x7c84('0xb4')]?{'message':_0x7c84('0xb8'),'statusCode':_0x512873[_0x7c84('0xb5')]}:_0x512873);});};function createFieldObject(_0x1e63ce,_0x82f83e,_0x4d7d7d,_0x571865,_0x2f3e98,_0x38efcf){return new Promise(function(_0x451638,_0x173426){var _0x2f62f6={'id':_0x571865,'name':_0x2f3e98,'custom':_0x38efcf};if(_0x4d7d7d==='boolean'){_0x2f62f6[_0x7c84('0x48')]=[{'name':_0x7c84('0xb9'),'value':_0x7c84('0xba')},{'name':_0x7c84('0xbb'),'value':_0x7c84('0xbc')}];_0x451638(_0x2f62f6);}else{var _0x431c1f={'method':_0x7c84('0xa7'),'uri':_0x1e63ce+'sys_choice?sysparm_query=name=incident^element='+_0x571865,'auth':_0x82f83e,'json':!![]};return rp(_0x431c1f)[_0x7c84('0x1b')](function(_0x4f8d9e){var _0x2cb960=[];if(_0x4f8d9e[_0x7c84('0xa9')]['length']>0x0){_0x4f8d9e[_0x7c84('0xa9')][_0x7c84('0xac')](function(_0x13ddf4){if(_0x13ddf4['inactive']==='false'){var _0x3428c2={'name':_0x13ddf4[_0x7c84('0xb2')],'value':_0x13ddf4[_0x7c84('0xbd')]};_0x2cb960[_0x7c84('0xad')](_0x3428c2);}});}_0x2f62f6['options']=_0x2cb960;if(_0x2f62f6[_0x7c84('0x48')][_0x7c84('0x3d')]>0x0){_0x451638(_0x2f62f6);}else{if(_0x38efcf==![]){_0x451638();}else{_0x451638(_0x2f62f6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index a468ec3..7e37aff 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 _0xb4c7=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0xa1cb28,_0x101594){var _0x3a04cf=function(_0x418bcc){while(--_0x418bcc){_0xa1cb28['push'](_0xa1cb28['shift']());}};_0x3a04cf(++_0x101594);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x401590,_0x4ad175){_0x401590=_0x401590-0x0;var _0x4b07c3=_0xb4c7[_0x401590];return _0x4b07c3;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7b4c('0xa')]=function(_0x10e197,_0x2dd5c7){return _0x10e197['define'](_0x7b4c('0xb'),attributes,{'tableName':_0x7b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf873=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xf873,0xb2));var _0x3f87=function(_0x40c00b,_0x388e2b){_0x40c00b=_0x40c00b-0x0;var _0x43c976=_0xf873[_0x40c00b];return _0x43c976;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x3f87('0x9'));module[_0x3f87('0xa')]=function(_0x27c03e,_0x5a5e37){return _0x27c03e[_0x3f87('0xb')](_0x3f87('0xc'),attributes,{'tableName':_0x3f87('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 540c22f..239502a 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 _0x38f2=['code','message','result','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','catch','find','ShowServicenowAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x12d3d5,_0x20b170){var _0x3aa067=function(_0x51010b){while(--_0x51010b){_0x12d3d5['push'](_0x12d3d5['shift']());}};_0x3aa067(++_0x20b170);}(_0x38f2,0x1a7));var _0x238f=function(_0x10b679,_0x2ac40f){_0x10b679=_0x10b679-0x0;var _0x1cc71e=_0x38f2[_0x10b679];return _0x1cc71e;};'use strict';var _=require('lodash');var util=require(_0x238f('0x0'));var moment=require(_0x238f('0x1'));var BPromise=require(_0x238f('0x2'));var rs=require(_0x238f('0x3'));var fs=require('fs');var Redis=require(_0x238f('0x4'));var db=require(_0x238f('0x5'))['db'];var utils=require(_0x238f('0x6'));var logger=require(_0x238f('0x7'))(_0x238f('0x8'));var config=require(_0x238f('0x9'));var jayson=require(_0x238f('0xa'));var client=jayson[_0x238f('0xb')][_0x238f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dea93,_0x47dc02,_0x142dd0){return new BPromise(function(_0xed76df,_0x5d584e){return client[_0x238f('0xd')](_0x5dea93,_0x142dd0)['then'](function(_0x5e7e85){logger[_0x238f('0xe')](_0x238f('0xf'),_0x47dc02,'request\x20sent');logger[_0x238f('0x10')](_0x238f('0x11'),_0x47dc02,_0x238f('0x12'),JSON[_0x238f('0x13')](_0x5e7e85));if(_0x5e7e85[_0x238f('0x14')]){if(_0x5e7e85[_0x238f('0x14')][_0x238f('0x15')]===0x1f4){logger[_0x238f('0x14')](_0x238f('0xf'),_0x47dc02,_0x5e7e85[_0x238f('0x14')]['message']);return _0x5d584e(_0x5e7e85[_0x238f('0x14')]['message']);}logger[_0x238f('0x14')](_0x238f('0xf'),_0x47dc02,_0x5e7e85['error'][_0x238f('0x16')]);return _0xed76df(_0x5e7e85[_0x238f('0x14')]['message']);}else{logger[_0x238f('0xe')](_0x238f('0xf'),_0x47dc02,_0x238f('0x12'));_0xed76df(_0x5e7e85[_0x238f('0x17')][_0x238f('0x16')]);}})['catch'](function(_0x34bf05){logger[_0x238f('0x14')](_0x238f('0xf'),_0x47dc02,_0x34bf05);_0x5d584e(_0x34bf05);});});}exports[_0x238f('0x18')]=function(_0xc25099){var _0x4c84c2=this;return new Promise(function(_0xe3984d,_0x142dc4){return db[_0x238f('0x19')]['findAll']({'raw':_0xc25099[_0x238f('0x1a')]?_0xc25099['options'][_0x238f('0x1b')]===undefined?!![]:![]:!![],'where':_0xc25099['options']?_0xc25099[_0x238f('0x1a')][_0x238f('0x1c')]||null:null,'attributes':_0xc25099[_0x238f('0x1a')]?_0xc25099[_0x238f('0x1a')][_0x238f('0x1d')]||null:null,'limit':_0xc25099[_0x238f('0x1a')]?_0xc25099['options'][_0x238f('0x1e')]||null:null,'include':_0xc25099[_0x238f('0x1a')]?_0xc25099[_0x238f('0x1a')][_0x238f('0x1f')]?_[_0x238f('0x20')](_0xc25099[_0x238f('0x1a')]['include'],function(_0x25e91){return{'model':db[_0x25e91[_0x238f('0x21')]],'as':_0x25e91['as'],'attributes':_0x25e91[_0x238f('0x1d')],'include':_0x25e91['include']?_[_0x238f('0x20')](_0x25e91[_0x238f('0x1f')],function(_0x548caa){return{'model':db[_0x548caa[_0x238f('0x21')]],'as':_0x548caa['as'],'attributes':_0x548caa[_0x238f('0x1d')],'include':_0x548caa['include']?_['map'](_0x548caa[_0x238f('0x1f')],function(_0x4c9e62){return{'model':db[_0x4c9e62[_0x238f('0x21')]],'as':_0x4c9e62['as'],'attributes':_0x4c9e62['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f12fd){logger[_0x238f('0xe')](_0x238f('0x18'),_0xc25099);logger[_0x238f('0x10')]('GetServicenowAccount',_0xc25099,JSON['stringify'](_0x5f12fd));_0xe3984d(_0x5f12fd);})[_0x238f('0x22')](function(_0xa5c951){logger[_0x238f('0x14')](_0x238f('0x18'),_0xa5c951['message'],_0xc25099);_0x142dc4(_0x4c84c2[_0x238f('0x14')](0x1f4,_0xa5c951['message']));});});};exports['ShowServicenowAccount']=function(_0xf6bcd){var _0x2feb0b=this;return new Promise(function(_0x5c0b1b,_0x34f83c){return db['ServicenowAccount'][_0x238f('0x23')]({'raw':_0xf6bcd[_0x238f('0x1a')]?_0xf6bcd[_0x238f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xf6bcd['options']?_0xf6bcd[_0x238f('0x1a')]['where']||null:null,'attributes':_0xf6bcd['options']?_0xf6bcd[_0x238f('0x1a')]['attributes']||null:null,'include':_0xf6bcd['options']?_0xf6bcd[_0x238f('0x1a')][_0x238f('0x1f')]?_[_0x238f('0x20')](_0xf6bcd[_0x238f('0x1a')]['include'],function(_0x32e8a){return{'model':db[_0x32e8a['model']],'as':_0x32e8a['as'],'attributes':_0x32e8a[_0x238f('0x1d')],'include':_0x32e8a[_0x238f('0x1f')]?_[_0x238f('0x20')](_0x32e8a[_0x238f('0x1f')],function(_0x3e5e7f){return{'model':db[_0x3e5e7f['model']],'as':_0x3e5e7f['as'],'attributes':_0x3e5e7f[_0x238f('0x1d')],'include':_0x3e5e7f[_0x238f('0x1f')]?_[_0x238f('0x20')](_0x3e5e7f[_0x238f('0x1f')],function(_0x40e9fe){return{'model':db[_0x40e9fe[_0x238f('0x21')]],'as':_0x40e9fe['as'],'attributes':_0x40e9fe[_0x238f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5be3a5){logger['info'](_0x238f('0x24'),_0xf6bcd);logger[_0x238f('0x10')](_0x238f('0x24'),_0xf6bcd,JSON['stringify'](_0x5be3a5));_0x5c0b1b(_0x5be3a5);})[_0x238f('0x22')](function(_0x48c883){logger[_0x238f('0x14')](_0x238f('0x24'),_0x48c883[_0x238f('0x16')],_0xf6bcd);_0x34f83c(_0x2feb0b[_0x238f('0x14')](0x1f4,_0x48c883[_0x238f('0x16')]));});});}; \ No newline at end of file +var _0xa16f=['findAll','options','where','attributes','limit','map','include','model','catch','GetServicenowAccount','ShowServicenowAccount','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ServicenowAccount'];(function(_0x3d0580,_0x54679a){var _0x53d5c3=function(_0x18003a){while(--_0x18003a){_0x3d0580['push'](_0x3d0580['shift']());}};_0x53d5c3(++_0x54679a);}(_0xa16f,0x156));var _0xfa16=function(_0x1c0caa,_0x10755d){_0x1c0caa=_0x1c0caa-0x0;var _0x6a5029=_0xa16f[_0x1c0caa];return _0x6a5029;};'use strict';var _=require('lodash');var util=require(_0xfa16('0x0'));var moment=require(_0xfa16('0x1'));var BPromise=require(_0xfa16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa16('0x3'));var db=require(_0xfa16('0x4'))['db'];var utils=require(_0xfa16('0x5'));var logger=require(_0xfa16('0x6'))(_0xfa16('0x7'));var config=require(_0xfa16('0x8'));var jayson=require(_0xfa16('0x9'));var client=jayson['client'][_0xfa16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4035c1,_0x11d13a,_0x3f870e){return new BPromise(function(_0x271aeb,_0xb73ccb){return client['request'](_0x4035c1,_0x3f870e)[_0xfa16('0xb')](function(_0x21bfd6){logger[_0xfa16('0xc')](_0xfa16('0xd'),_0x11d13a,_0xfa16('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x11d13a,_0xfa16('0xe'),JSON[_0xfa16('0xf')](_0x21bfd6));if(_0x21bfd6[_0xfa16('0x10')]){if(_0x21bfd6[_0xfa16('0x10')][_0xfa16('0x11')]===0x1f4){logger[_0xfa16('0x10')](_0xfa16('0xd'),_0x11d13a,_0x21bfd6[_0xfa16('0x10')][_0xfa16('0x12')]);return _0xb73ccb(_0x21bfd6[_0xfa16('0x10')][_0xfa16('0x12')]);}logger[_0xfa16('0x10')](_0xfa16('0xd'),_0x11d13a,_0x21bfd6[_0xfa16('0x10')][_0xfa16('0x12')]);return _0x271aeb(_0x21bfd6[_0xfa16('0x10')][_0xfa16('0x12')]);}else{logger[_0xfa16('0xc')](_0xfa16('0xd'),_0x11d13a,'request\x20sent');_0x271aeb(_0x21bfd6[_0xfa16('0x13')][_0xfa16('0x12')]);}})['catch'](function(_0x4e58d0){logger['error'](_0xfa16('0xd'),_0x11d13a,_0x4e58d0);_0xb73ccb(_0x4e58d0);});});}exports['GetServicenowAccount']=function(_0x495591){var _0x401220=this;return new Promise(function(_0x1becbd,_0x14badd){return db[_0xfa16('0x14')][_0xfa16('0x15')]({'raw':_0x495591[_0xfa16('0x16')]?_0x495591[_0xfa16('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x495591[_0xfa16('0x16')]?_0x495591[_0xfa16('0x16')][_0xfa16('0x17')]||null:null,'attributes':_0x495591['options']?_0x495591['options'][_0xfa16('0x18')]||null:null,'limit':_0x495591[_0xfa16('0x16')]?_0x495591[_0xfa16('0x16')][_0xfa16('0x19')]||null:null,'include':_0x495591[_0xfa16('0x16')]?_0x495591['options']['include']?_[_0xfa16('0x1a')](_0x495591[_0xfa16('0x16')][_0xfa16('0x1b')],function(_0x446162){return{'model':db[_0x446162[_0xfa16('0x1c')]],'as':_0x446162['as'],'attributes':_0x446162[_0xfa16('0x18')],'include':_0x446162[_0xfa16('0x1b')]?_[_0xfa16('0x1a')](_0x446162[_0xfa16('0x1b')],function(_0x303e98){return{'model':db[_0x303e98[_0xfa16('0x1c')]],'as':_0x303e98['as'],'attributes':_0x303e98[_0xfa16('0x18')],'include':_0x303e98[_0xfa16('0x1b')]?_['map'](_0x303e98[_0xfa16('0x1b')],function(_0x4037b7){return{'model':db[_0x4037b7['model']],'as':_0x4037b7['as'],'attributes':_0x4037b7[_0xfa16('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfa16('0xb')](function(_0x80fc17){logger[_0xfa16('0xc')]('GetServicenowAccount',_0x495591);logger['debug']('GetServicenowAccount',_0x495591,JSON[_0xfa16('0xf')](_0x80fc17));_0x1becbd(_0x80fc17);})[_0xfa16('0x1d')](function(_0x12109c){logger[_0xfa16('0x10')](_0xfa16('0x1e'),_0x12109c[_0xfa16('0x12')],_0x495591);_0x14badd(_0x401220[_0xfa16('0x10')](0x1f4,_0x12109c[_0xfa16('0x12')]));});});};exports[_0xfa16('0x1f')]=function(_0x25da51){var _0x272bd9=this;return new Promise(function(_0x5a50a3,_0x444c37){return db[_0xfa16('0x14')]['find']({'raw':_0x25da51[_0xfa16('0x16')]?_0x25da51[_0xfa16('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x25da51[_0xfa16('0x16')]?_0x25da51['options']['where']||null:null,'attributes':_0x25da51['options']?_0x25da51['options'][_0xfa16('0x18')]||null:null,'include':_0x25da51[_0xfa16('0x16')]?_0x25da51['options']['include']?_[_0xfa16('0x1a')](_0x25da51[_0xfa16('0x16')][_0xfa16('0x1b')],function(_0x5e3b29){return{'model':db[_0x5e3b29[_0xfa16('0x1c')]],'as':_0x5e3b29['as'],'attributes':_0x5e3b29[_0xfa16('0x18')],'include':_0x5e3b29[_0xfa16('0x1b')]?_[_0xfa16('0x1a')](_0x5e3b29[_0xfa16('0x1b')],function(_0x5a03b3){return{'model':db[_0x5a03b3[_0xfa16('0x1c')]],'as':_0x5a03b3['as'],'attributes':_0x5a03b3[_0xfa16('0x18')],'include':_0x5a03b3[_0xfa16('0x1b')]?_[_0xfa16('0x1a')](_0x5a03b3['include'],function(_0x59f59e){return{'model':db[_0x59f59e[_0xfa16('0x1c')]],'as':_0x59f59e['as'],'attributes':_0x59f59e[_0xfa16('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e5906){logger['info']('ShowServicenowAccount',_0x25da51);logger[_0xfa16('0x20')](_0xfa16('0x1f'),_0x25da51,JSON[_0xfa16('0xf')](_0x2e5906));_0x5a50a3(_0x2e5906);})[_0xfa16('0x1d')](function(_0x366616){logger[_0xfa16('0x10')](_0xfa16('0x1f'),_0x366616[_0xfa16('0x12')],_0x25da51);_0x444c37(_0x272bd9[_0xfa16('0x10')](0x1f4,_0x366616['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 257581e..4d0bd25 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 _0xfb4f=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','./intServicenowConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x48200d,_0x572b91){var _0x2e82ce=function(_0x21eaf9){while(--_0x21eaf9){_0x48200d['push'](_0x48200d['shift']());}};_0x2e82ce(++_0x572b91);}(_0xfb4f,0x11c));var _0xffb4=function(_0x4396f7,_0x4b098c){_0x4396f7=_0x4396f7-0x0;var _0x3160cb=_0xfb4f[_0x4396f7];return _0x3160cb;};'use strict';var multer=require(_0xffb4('0x0'));var util=require(_0xffb4('0x1'));var path=require(_0xffb4('0x2'));var timeout=require(_0xffb4('0x3'));var express=require(_0xffb4('0x4'));var router=express[_0xffb4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xffb4('0x6'));router[_0xffb4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xffb4('0x7')](_0xffb4('0x8'),auth[_0xffb4('0x9')](),controller[_0xffb4('0xa')]);router[_0xffb4('0x7')](_0xffb4('0xb'),auth[_0xffb4('0x9')](),controller[_0xffb4('0xc')]);router[_0xffb4('0x7')](_0xffb4('0xd'),auth[_0xffb4('0x9')](),controller[_0xffb4('0xe')]);router[_0xffb4('0x7')](_0xffb4('0xf'),auth[_0xffb4('0x9')](),controller[_0xffb4('0x10')]);router['post']('/',auth[_0xffb4('0x9')](),controller[_0xffb4('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xffb4('0x12')]);router[_0xffb4('0x13')](_0xffb4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xffb4('0x14')]=router; \ No newline at end of file +var _0x0489=['/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index'];(function(_0xa6d7a,_0x1b9afc){var _0xbf0a0=function(_0x1f20dc){while(--_0x1f20dc){_0xa6d7a['push'](_0xa6d7a['shift']());}};_0xbf0a0(++_0x1b9afc);}(_0x0489,0x121));var _0x9048=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x0489[_0x15a8fa];return _0x1355c2;};'use strict';var multer=require('multer');var util=require(_0x9048('0x0'));var path=require(_0x9048('0x1'));var timeout=require(_0x9048('0x2'));var express=require(_0x9048('0x3'));var router=express[_0x9048('0x4')]();var auth=require(_0x9048('0x5'));var interaction=require(_0x9048('0x6'));var config=require(_0x9048('0x7'));var controller=require(_0x9048('0x8'));router[_0x9048('0x9')]('/',auth['isAuthenticated'](),controller[_0x9048('0xa')]);router[_0x9048('0x9')](_0x9048('0xb'),auth['isAuthenticated'](),controller[_0x9048('0xc')]);router[_0x9048('0x9')](_0x9048('0xd'),auth[_0x9048('0xe')](),controller[_0x9048('0xf')]);router[_0x9048('0x9')](_0x9048('0x10'),auth['isAuthenticated'](),controller[_0x9048('0x11')]);router[_0x9048('0x9')](_0x9048('0x12'),auth[_0x9048('0xe')](),controller['getDescriptions']);router[_0x9048('0x13')]('/',auth[_0x9048('0xe')](),controller[_0x9048('0x14')]);router[_0x9048('0x15')](_0x9048('0xb'),auth['isAuthenticated'](),controller[_0x9048('0x16')]);router[_0x9048('0x17')](_0x9048('0xb'),auth[_0x9048('0xe')](),controller[_0x9048('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f360226..14b9c79 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 _0x3b6f=['STRING','exports'];(function(_0x1e6645,_0x2473df){var _0x1525da=function(_0x2ba990){while(--_0x2ba990){_0x1e6645['push'](_0x1e6645['shift']());}};_0x1525da(++_0x2473df);}(_0x3b6f,0x99));var _0xf3b6=function(_0x28a265,_0x2b5711){_0x28a265=_0x28a265-0x0;var _0x48f96e=_0x3b6f[_0x28a265];return _0x48f96e;};'use strict';var Sequelize=require('sequelize');module[_0xf3b6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf3b6('0x1')]}}; \ No newline at end of file +var _0xe5cb=['STRING'];(function(_0x2eedc9,_0x4b723f){var _0x32244e=function(_0xfe6d7a){while(--_0xfe6d7a){_0x2eedc9['push'](_0x2eedc9['shift']());}};_0x32244e(++_0x4b723f);}(_0xe5cb,0xe9));var _0xbe5c=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xe5cb[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbe5c('0x0')]},'description':{'type':Sequelize[_0xbe5c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 40f4cdf..e99a428 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 _0x934d=['set','Content-Range','apply','reject','save','destroy','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','update','body','getFields','findOne','order','ServicenowField','getSubjects','getDescriptions','length','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x934d,0xe1));var _0xd934=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x934d[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0xd934('0x0'));var emlformat=require(_0xd934('0x1'));var rimraf=require(_0xd934('0x2'));var zipdir=require(_0xd934('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd934('0x4'));var moment=require('moment');var BPromise=require(_0xd934('0x5'));var Mustache=require('mustache');var util=require(_0xd934('0x6'));var path=require(_0xd934('0x7'));var sox=require(_0xd934('0x8'));var csv=require(_0xd934('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd934('0xa'));var squel=require(_0xd934('0xb'));var crypto=require(_0xd934('0xc'));var jsforce=require(_0xd934('0xd'));var deskjs=require(_0xd934('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd934('0xf'));var qs=require(_0xd934('0x10'));var as=require(_0xd934('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd934('0x12'));var utils=require('../../config/utils');var config=require(_0xd934('0x13'));var licenseUtil=require(_0xd934('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xd934('0x15')][_0xd934('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2ac45d,_0x49621a,_0x1126a0,_0xe7a495){return new BPromise(function(_0x2da733,_0x9ef0bc){var _0x37323e=_0xe7a495||client;return _0x37323e[_0xd934('0x17')](_0x2ac45d,_0x1126a0)[_0xd934('0x18')](function(_0x5362fb){logger[_0xd934('0x19')](_0xd934('0x1a'),_0x49621a,_0xd934('0x1b'));logger[_0xd934('0x1c')](_0xd934('0x1d'),_0x49621a,_0xd934('0x1b'),JSON[_0xd934('0x1e')](_0x5362fb));if(_0x5362fb[_0xd934('0x1f')]){if(_0x5362fb[_0xd934('0x1f')][_0xd934('0x20')]===0x1f4){logger[_0xd934('0x1f')](_0xd934('0x1a'),_0x49621a,_0x5362fb[_0xd934('0x1f')]['message']);return _0x9ef0bc(_0x5362fb[_0xd934('0x1f')][_0xd934('0x21')]);}logger[_0xd934('0x1f')](_0xd934('0x1a'),_0x49621a,_0x5362fb[_0xd934('0x1f')]['message']);return _0x2da733(_0x5362fb['error'][_0xd934('0x21')]);}else{logger[_0xd934('0x19')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49621a,_0xd934('0x1b'));_0x2da733(_0x5362fb[_0xd934('0x22')]['message']);}})['catch'](function(_0x41412f){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x49621a,_0x41412f);_0x9ef0bc(_0x41412f);});});}function respondWithStatusCode(_0x500f03,_0x39dae7){_0x39dae7=_0x39dae7||0xcc;return function(_0x2c68e5){if(_0x2c68e5){return _0x500f03[_0xd934('0x23')](_0x39dae7);}return _0x500f03['status'](_0x39dae7)[_0xd934('0x24')]();};}function respondWithResult(_0x16d3f0,_0x32c026){_0x32c026=_0x32c026||0xc8;return function(_0xd00622){if(_0xd00622){return _0x16d3f0[_0xd934('0x25')](_0x32c026)[_0xd934('0x26')](_0xd00622);}};}function respondWithFilteredResult(_0x387d7e,_0x199a40){return function(_0x33a6ee){if(_0x33a6ee){var _0xb4e1b8=_0x33a6ee[_0xd934('0x27')],_0x1335eb=_0x199a40[_0xd934('0x28')],_0x2a54a4=_0x199a40[_0xd934('0x28')]+_0x199a40[_0xd934('0x29')],_0x397150;if(_0x2a54a4>=_0xb4e1b8){_0x2a54a4=_0xb4e1b8;_0x397150=0xc8;}else{_0x397150=0xce;}_0x387d7e[_0xd934('0x25')](_0x397150);return _0x387d7e[_0xd934('0x2a')](_0xd934('0x2b'),_0x1335eb+'-'+_0x2a54a4+'/'+_0xb4e1b8)[_0xd934('0x26')](_0x33a6ee);}return null;};}function patchUpdates(_0x1959bc){return function(_0x4caabe){try{jsonpatch[_0xd934('0x2c')](_0x4caabe,_0x1959bc,!![]);}catch(_0x57acc3){return BPromise[_0xd934('0x2d')](_0x57acc3);}return _0x4caabe[_0xd934('0x2e')]();};}function saveUpdates(_0x42f078,_0x241250){return function(_0x268143){if(_0x268143){return _0x268143['update'](_0x42f078)[_0xd934('0x18')](function(_0x14378b){return _0x14378b;});}return null;};}function removeEntity(_0x6e6179,_0x5a6ccd){return function(_0x528006){if(_0x528006){return _0x528006[_0xd934('0x2f')]()[_0xd934('0x18')](function(){_0x6e6179[_0xd934('0x25')](0xcc)[_0xd934('0x24')]();});}};}function handleEntityNotFound(_0x3aca1e,_0x29031a){return function(_0x108bb2){if(!_0x108bb2){_0x3aca1e['sendStatus'](0x194);}return _0x108bb2;};}function handleError(_0x8afcdb,_0x545c98){_0x545c98=_0x545c98||0x1f4;return function(_0x5d87fd){logger[_0xd934('0x1f')](_0x5d87fd['stack']);if(_0x5d87fd[_0xd934('0x30')]){delete _0x5d87fd['name'];}_0x8afcdb['status'](_0x545c98)[_0xd934('0x31')](_0x5d87fd);};}exports[_0xd934('0x32')]=function(_0x18b3d3,_0x11306f){var _0x248ed5={},_0x18122a={},_0x332453={'count':0x0,'rows':[]};var _0x53a260=_['map'](db[_0xd934('0x33')][_0xd934('0x34')],function(_0x3d8a4e){return{'name':_0x3d8a4e[_0xd934('0x35')],'type':_0x3d8a4e[_0xd934('0x36')]['key']};});_0x18122a[_0xd934('0x37')]=_[_0xd934('0x38')](_0x53a260,_0xd934('0x30'));_0x18122a[_0xd934('0x39')]=_[_0xd934('0x3a')](_0x18b3d3[_0xd934('0x39')]);_0x18122a[_0xd934('0x3b')]=_[_0xd934('0x3c')](_0x18122a[_0xd934('0x37')],_0x18122a[_0xd934('0x39')]);_0x248ed5[_0xd934('0x3d')]=_['intersection'](_0x18122a[_0xd934('0x37')],qs['fields'](_0x18b3d3[_0xd934('0x39')]['fields']));_0x248ed5[_0xd934('0x3d')]=_0x248ed5[_0xd934('0x3d')]['length']?_0x248ed5[_0xd934('0x3d')]:_0x18122a[_0xd934('0x37')];if(!_0x18b3d3[_0xd934('0x39')][_0xd934('0x3e')](_0xd934('0x3f'))){_0x248ed5['limit']=qs[_0xd934('0x29')](_0x18b3d3[_0xd934('0x39')][_0xd934('0x29')]);_0x248ed5[_0xd934('0x28')]=qs[_0xd934('0x28')](_0x18b3d3['query'][_0xd934('0x28')]);}_0x248ed5['order']=qs['sort'](_0x18b3d3[_0xd934('0x39')][_0xd934('0x40')]);_0x248ed5[_0xd934('0x41')]=qs[_0xd934('0x3b')](_[_0xd934('0x42')](_0x18b3d3[_0xd934('0x39')],_0x18122a['filters']),_0x53a260);if(_0x18b3d3['query'][_0xd934('0x43')]){_0x248ed5['where']=_[_0xd934('0x44')](_0x248ed5[_0xd934('0x41')],{'$or':_[_0xd934('0x38')](_0x53a260,function(_0x5e2b74){if(_0x5e2b74['type']!=='VIRTUAL'){var _0x142d43={};_0x142d43[_0x5e2b74[_0xd934('0x30')]]={'$like':'%'+_0x18b3d3[_0xd934('0x39')][_0xd934('0x43')]+'%'};return _0x142d43;}})});}_0x248ed5=_[_0xd934('0x44')]({},_0x248ed5,_0x18b3d3['options']);var _0x2e5504={'where':_0x248ed5[_0xd934('0x41')]};return db[_0xd934('0x33')][_0xd934('0x27')](_0x2e5504)[_0xd934('0x18')](function(_0x116cf4){_0x332453[_0xd934('0x27')]=_0x116cf4;if(_0x18b3d3[_0xd934('0x39')][_0xd934('0x45')]){_0x248ed5[_0xd934('0x46')]=[{'all':!![]}];}return db[_0xd934('0x33')][_0xd934('0x47')](_0x248ed5);})['then'](function(_0x67c552){_0x332453[_0xd934('0x48')]=_0x67c552;return _0x332453;})[_0xd934('0x18')](respondWithFilteredResult(_0x11306f,_0x248ed5))[_0xd934('0x49')](handleError(_0x11306f,null));};exports[_0xd934('0x4a')]=function(_0x297332,_0x319a99){var _0x5a4001={'raw':![],'where':{'id':_0x297332[_0xd934('0x4b')]['id']}},_0x4c94a2={};_0x4c94a2['model']=_[_0xd934('0x3a')](db['ServicenowConfiguration'][_0xd934('0x34')]);_0x4c94a2[_0xd934('0x39')]=_[_0xd934('0x3a')](_0x297332[_0xd934('0x39')]);_0x4c94a2[_0xd934('0x3b')]=_[_0xd934('0x3c')](_0x4c94a2[_0xd934('0x37')],_0x4c94a2[_0xd934('0x39')]);_0x5a4001[_0xd934('0x3d')]=_[_0xd934('0x3c')](_0x4c94a2['model'],qs[_0xd934('0x4c')](_0x297332[_0xd934('0x39')][_0xd934('0x4c')]));_0x5a4001[_0xd934('0x3d')]=_0x5a4001[_0xd934('0x3d')]['length']?_0x5a4001[_0xd934('0x3d')]:_0x4c94a2[_0xd934('0x37')];if(_0x297332[_0xd934('0x39')][_0xd934('0x45')]){_0x5a4001[_0xd934('0x46')]=[{'all':!![]}];}_0x5a4001=_['merge']({},_0x5a4001,_0x297332[_0xd934('0x4d')]);return db[_0xd934('0x33')][_0xd934('0x4e')](_0x5a4001)[_0xd934('0x18')](handleEntityNotFound(_0x319a99,null))[_0xd934('0x18')](respondWithResult(_0x319a99,null))[_0xd934('0x49')](handleError(_0x319a99,null));};exports[_0xd934('0x4f')]=function(_0x4744a8,_0x3414f5){return db[_0xd934('0x33')][_0xd934('0x4f')](_0x4744a8['body'],{})[_0xd934('0x18')](respondWithResult(_0x3414f5,0xc9))[_0xd934('0x49')](handleError(_0x3414f5,null));};exports[_0xd934('0x50')]=function(_0x3b5ce9,_0x14bb91){if(_0x3b5ce9[_0xd934('0x51')]['id']){delete _0x3b5ce9[_0xd934('0x51')]['id'];}return db[_0xd934('0x33')][_0xd934('0x4e')]({'where':{'id':_0x3b5ce9[_0xd934('0x4b')]['id']}})[_0xd934('0x18')](handleEntityNotFound(_0x14bb91,null))['then'](saveUpdates(_0x3b5ce9['body'],null))[_0xd934('0x18')](respondWithResult(_0x14bb91,null))['catch'](handleError(_0x14bb91,null));};exports[_0xd934('0x2f')]=function(_0x27e479,_0x3ebe90){return db['ServicenowConfiguration'][_0xd934('0x4e')]({'where':{'id':_0x27e479[_0xd934('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ebe90,null))['then'](removeEntity(_0x3ebe90,null))[_0xd934('0x49')](handleError(_0x3ebe90,null));};exports[_0xd934('0x52')]=function(_0x15d9c7,_0x5b2aca,_0x1b6214){var _0x58f844={};var _0x460458={};var _0x41585c;var _0xf7ae4;return db['ServicenowConfiguration'][_0xd934('0x53')]({'where':{'id':_0x15d9c7[_0xd934('0x4b')]['id']}})[_0xd934('0x18')](handleEntityNotFound(_0x5b2aca,null))[_0xd934('0x18')](function(_0x4ea5c3){if(_0x4ea5c3){_0x41585c=_0x4ea5c3;_0x460458['model']=_[_0xd934('0x3a')](db['ServicenowField'][_0xd934('0x34')]);_0x460458['query']=_[_0xd934('0x3a')](_0x15d9c7[_0xd934('0x39')]);_0x460458[_0xd934('0x3b')]=_[_0xd934('0x3c')](_0x460458['model'],_0x460458[_0xd934('0x39')]);_0x58f844[_0xd934('0x3d')]=_['intersection'](_0x460458[_0xd934('0x37')],qs[_0xd934('0x4c')](_0x15d9c7['query'][_0xd934('0x4c')]));_0x58f844[_0xd934('0x3d')]=_0x58f844['attributes']['length']?_0x58f844[_0xd934('0x3d')]:_0x460458[_0xd934('0x37')];_0x58f844[_0xd934('0x54')]=qs[_0xd934('0x40')](_0x15d9c7[_0xd934('0x39')][_0xd934('0x40')]);_0x58f844['where']=qs[_0xd934('0x3b')](_[_0xd934('0x42')](_0x15d9c7[_0xd934('0x39')],_0x460458[_0xd934('0x3b')]));if(_0x15d9c7[_0xd934('0x39')][_0xd934('0x43')]){_0x58f844['where']=_[_0xd934('0x44')](_0x58f844[_0xd934('0x41')],{'$or':_['map'](_0x58f844[_0xd934('0x3d')],function(_0xefd973){var _0x30fa2d={};_0x30fa2d[_0xefd973]={'$like':'%'+_0x15d9c7['query']['filter']+'%'};return _0x30fa2d;})});}_0x58f844=_[_0xd934('0x44')]({},_0x58f844,_0x15d9c7[_0xd934('0x4d')]);return _0x41585c[_0xd934('0x52')](_0x58f844);}})[_0xd934('0x18')](function(_0x25616a){if(_0x25616a){_0xf7ae4=_0x25616a['length'];if(!_0x15d9c7['query'][_0xd934('0x3e')]('nolimit')){_0x58f844[_0xd934('0x29')]=qs[_0xd934('0x29')](_0x15d9c7[_0xd934('0x39')][_0xd934('0x29')]);_0x58f844['offset']=qs[_0xd934('0x28')](_0x15d9c7[_0xd934('0x39')]['offset']);}return _0x41585c['getFields'](_0x58f844);}})[_0xd934('0x18')](function(_0x37f164){if(_0x37f164){return _0x37f164?{'count':_0xf7ae4,'rows':_0x37f164}:null;}})[_0xd934('0x18')](respondWithResult(_0x5b2aca,null))[_0xd934('0x49')](handleError(_0x5b2aca,null));};exports['getSubjects']=function(_0x331a35,_0x41c4cd,_0xe870a2){var _0x4d234d={};var _0x3b83ba={};var _0x113692;var _0x1b41d2;return db['ServicenowConfiguration'][_0xd934('0x53')]({'where':{'id':_0x331a35[_0xd934('0x4b')]['id']}})[_0xd934('0x18')](handleEntityNotFound(_0x41c4cd,null))['then'](function(_0xfa82a6){if(_0xfa82a6){_0x113692=_0xfa82a6;_0x3b83ba[_0xd934('0x37')]=_[_0xd934('0x3a')](db[_0xd934('0x55')]['rawAttributes']);_0x3b83ba[_0xd934('0x39')]=_[_0xd934('0x3a')](_0x331a35[_0xd934('0x39')]);_0x3b83ba['filters']=_[_0xd934('0x3c')](_0x3b83ba['model'],_0x3b83ba['query']);_0x4d234d[_0xd934('0x3d')]=_[_0xd934('0x3c')](_0x3b83ba[_0xd934('0x37')],qs[_0xd934('0x4c')](_0x331a35['query']['fields']));_0x4d234d[_0xd934('0x3d')]=_0x4d234d[_0xd934('0x3d')]['length']?_0x4d234d[_0xd934('0x3d')]:_0x3b83ba['model'];_0x4d234d[_0xd934('0x54')]=qs[_0xd934('0x40')](_0x331a35[_0xd934('0x39')][_0xd934('0x40')]);_0x4d234d[_0xd934('0x41')]=qs[_0xd934('0x3b')](_[_0xd934('0x42')](_0x331a35[_0xd934('0x39')],_0x3b83ba[_0xd934('0x3b')]));if(_0x331a35[_0xd934('0x39')]['filter']){_0x4d234d[_0xd934('0x41')]=_[_0xd934('0x44')](_0x4d234d[_0xd934('0x41')],{'$or':_[_0xd934('0x38')](_0x4d234d[_0xd934('0x3d')],function(_0x5237dd){var _0x5f1729={};_0x5f1729[_0x5237dd]={'$like':'%'+_0x331a35[_0xd934('0x39')][_0xd934('0x43')]+'%'};return _0x5f1729;})});}_0x4d234d=_[_0xd934('0x44')]({},_0x4d234d,_0x331a35[_0xd934('0x4d')]);return _0x113692['getSubjects'](_0x4d234d);}})[_0xd934('0x18')](function(_0x8c6bf){if(_0x8c6bf){_0x1b41d2=_0x8c6bf['length'];if(!_0x331a35[_0xd934('0x39')][_0xd934('0x3e')](_0xd934('0x3f'))){_0x4d234d[_0xd934('0x29')]=qs[_0xd934('0x29')](_0x331a35[_0xd934('0x39')]['limit']);_0x4d234d['offset']=qs[_0xd934('0x28')](_0x331a35['query']['offset']);}return _0x113692[_0xd934('0x56')](_0x4d234d);}})[_0xd934('0x18')](function(_0x4adaad){if(_0x4adaad){return _0x4adaad?{'count':_0x1b41d2,'rows':_0x4adaad}:null;}})[_0xd934('0x18')](respondWithResult(_0x41c4cd,null))['catch'](handleError(_0x41c4cd,null));};exports[_0xd934('0x57')]=function(_0x4792fb,_0x56bf31,_0x211db3){var _0x3b8172={};var _0x2d2784={};var _0x45d0e6;var _0x39038c;return db['ServicenowConfiguration'][_0xd934('0x53')]({'where':{'id':_0x4792fb[_0xd934('0x4b')]['id']}})[_0xd934('0x18')](handleEntityNotFound(_0x56bf31,null))['then'](function(_0xebbaa2){if(_0xebbaa2){_0x45d0e6=_0xebbaa2;_0x2d2784[_0xd934('0x37')]=_[_0xd934('0x3a')](db[_0xd934('0x55')][_0xd934('0x34')]);_0x2d2784['query']=_[_0xd934('0x3a')](_0x4792fb['query']);_0x2d2784[_0xd934('0x3b')]=_[_0xd934('0x3c')](_0x2d2784[_0xd934('0x37')],_0x2d2784[_0xd934('0x39')]);_0x3b8172[_0xd934('0x3d')]=_['intersection'](_0x2d2784[_0xd934('0x37')],qs[_0xd934('0x4c')](_0x4792fb[_0xd934('0x39')][_0xd934('0x4c')]));_0x3b8172[_0xd934('0x3d')]=_0x3b8172[_0xd934('0x3d')][_0xd934('0x58')]?_0x3b8172['attributes']:_0x2d2784[_0xd934('0x37')];_0x3b8172[_0xd934('0x54')]=qs[_0xd934('0x40')](_0x4792fb[_0xd934('0x39')]['sort']);_0x3b8172[_0xd934('0x41')]=qs[_0xd934('0x3b')](_['pick'](_0x4792fb[_0xd934('0x39')],_0x2d2784[_0xd934('0x3b')]));if(_0x4792fb['query'][_0xd934('0x43')]){_0x3b8172['where']=_['merge'](_0x3b8172[_0xd934('0x41')],{'$or':_[_0xd934('0x38')](_0x3b8172[_0xd934('0x3d')],function(_0x103ebe){var _0x405d2a={};_0x405d2a[_0x103ebe]={'$like':'%'+_0x4792fb[_0xd934('0x39')][_0xd934('0x43')]+'%'};return _0x405d2a;})});}_0x3b8172=_[_0xd934('0x44')]({},_0x3b8172,_0x4792fb[_0xd934('0x4d')]);return _0x45d0e6[_0xd934('0x57')](_0x3b8172);}})[_0xd934('0x18')](function(_0x1352eb){if(_0x1352eb){_0x39038c=_0x1352eb[_0xd934('0x58')];if(!_0x4792fb['query'][_0xd934('0x3e')](_0xd934('0x3f'))){_0x3b8172[_0xd934('0x29')]=qs[_0xd934('0x29')](_0x4792fb[_0xd934('0x39')][_0xd934('0x29')]);_0x3b8172['offset']=qs[_0xd934('0x28')](_0x4792fb[_0xd934('0x39')][_0xd934('0x28')]);}return _0x45d0e6[_0xd934('0x57')](_0x3b8172);}})[_0xd934('0x18')](function(_0x1eb58f){if(_0x1eb58f){return _0x1eb58f?{'count':_0x39038c,'rows':_0x1eb58f}:null;}})['then'](respondWithResult(_0x56bf31,null))['catch'](handleError(_0x56bf31,null));}; \ No newline at end of file +var _0xbfd5=['stack','name','send','index','map','ServicenowConfiguration','type','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ServicenowField','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','status'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xbfd5,0xe0));var _0x5bfd=function(_0x3fac56,_0x323fbc){_0x3fac56=_0x3fac56-0x0;var _0x29e349=_0xbfd5[_0x3fac56];return _0x29e349;};'use strict';var pdf=require(_0x5bfd('0x0'));var emlformat=require(_0x5bfd('0x1'));var rimraf=require(_0x5bfd('0x2'));var zipdir=require(_0x5bfd('0x3'));var jsonpatch=require(_0x5bfd('0x4'));var rp=require(_0x5bfd('0x5'));var moment=require(_0x5bfd('0x6'));var BPromise=require(_0x5bfd('0x7'));var Mustache=require(_0x5bfd('0x8'));var util=require(_0x5bfd('0x9'));var path=require(_0x5bfd('0xa'));var sox=require('sox');var csv=require(_0x5bfd('0xb'));var ejs=require(_0x5bfd('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5bfd('0xd'));var crypto=require(_0x5bfd('0xe'));var jsforce=require(_0x5bfd('0xf'));var deskjs=require(_0x5bfd('0x10'));var toCsv=require(_0x5bfd('0xb'));var querystring=require('querystring');var Papa=require(_0x5bfd('0x11'));var Redis=require(_0x5bfd('0x12'));var authService=require(_0x5bfd('0x13'));var qs=require(_0x5bfd('0x14'));var as=require(_0x5bfd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bfd('0x16'))(_0x5bfd('0x17'));var utils=require('../../config/utils');var config=require(_0x5bfd('0x18'));var licenseUtil=require(_0x5bfd('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5bfd('0x1a'));var client=jayson[_0x5bfd('0x1b')][_0x5bfd('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x14349e,_0x1a21fe,_0x184e02,_0x12b9a3){return new BPromise(function(_0xda52ed,_0x1ce56f){var _0x575603=_0x12b9a3||client;return _0x575603[_0x5bfd('0x1d')](_0x14349e,_0x184e02)[_0x5bfd('0x1e')](function(_0x47a408){logger[_0x5bfd('0x1f')](_0x5bfd('0x20'),_0x1a21fe,_0x5bfd('0x21'));logger['debug'](_0x5bfd('0x22'),_0x1a21fe,_0x5bfd('0x21'),JSON[_0x5bfd('0x23')](_0x47a408));if(_0x47a408[_0x5bfd('0x24')]){if(_0x47a408[_0x5bfd('0x24')]['code']===0x1f4){logger[_0x5bfd('0x24')](_0x5bfd('0x20'),_0x1a21fe,_0x47a408['error'][_0x5bfd('0x25')]);return _0x1ce56f(_0x47a408[_0x5bfd('0x24')][_0x5bfd('0x25')]);}logger[_0x5bfd('0x24')](_0x5bfd('0x20'),_0x1a21fe,_0x47a408[_0x5bfd('0x24')][_0x5bfd('0x25')]);return _0xda52ed(_0x47a408[_0x5bfd('0x24')]['message']);}else{logger[_0x5bfd('0x1f')](_0x5bfd('0x20'),_0x1a21fe,_0x5bfd('0x21'));_0xda52ed(_0x47a408['result'][_0x5bfd('0x25')]);}})[_0x5bfd('0x26')](function(_0x2e3f36){logger['error'](_0x5bfd('0x20'),_0x1a21fe,_0x2e3f36);_0x1ce56f(_0x2e3f36);});});}function respondWithStatusCode(_0x1ec984,_0x3ceb80){_0x3ceb80=_0x3ceb80||0xcc;return function(_0x1ba31d){if(_0x1ba31d){return _0x1ec984[_0x5bfd('0x27')](_0x3ceb80);}return _0x1ec984['status'](_0x3ceb80)[_0x5bfd('0x28')]();};}function respondWithResult(_0x56fde3,_0x55e215){_0x55e215=_0x55e215||0xc8;return function(_0x393c81){if(_0x393c81){return _0x56fde3['status'](_0x55e215)[_0x5bfd('0x29')](_0x393c81);}};}function respondWithFilteredResult(_0x47a15b,_0x3cc48a){return function(_0x240b8e){if(_0x240b8e){var _0x1ad6a1=_0x240b8e[_0x5bfd('0x2a')],_0x9089e3=_0x3cc48a[_0x5bfd('0x2b')],_0x562fae=_0x3cc48a[_0x5bfd('0x2b')]+_0x3cc48a[_0x5bfd('0x2c')],_0x15ef20;if(_0x562fae>=_0x1ad6a1){_0x562fae=_0x1ad6a1;_0x15ef20=0xc8;}else{_0x15ef20=0xce;}_0x47a15b['status'](_0x15ef20);return _0x47a15b[_0x5bfd('0x2d')](_0x5bfd('0x2e'),_0x9089e3+'-'+_0x562fae+'/'+_0x1ad6a1)['json'](_0x240b8e);}return null;};}function patchUpdates(_0x43cb20){return function(_0x35ce99){try{jsonpatch[_0x5bfd('0x2f')](_0x35ce99,_0x43cb20,!![]);}catch(_0x3a781f){return BPromise[_0x5bfd('0x30')](_0x3a781f);}return _0x35ce99['save']();};}function saveUpdates(_0x2e7725,_0x5165e8){return function(_0x4750b4){if(_0x4750b4){return _0x4750b4[_0x5bfd('0x31')](_0x2e7725)[_0x5bfd('0x1e')](function(_0x564ff7){return _0x564ff7;});}return null;};}function removeEntity(_0x40604e,_0x3d6976){return function(_0x46fd48){if(_0x46fd48){return _0x46fd48[_0x5bfd('0x32')]()[_0x5bfd('0x1e')](function(){_0x40604e[_0x5bfd('0x33')](0xcc)[_0x5bfd('0x28')]();});}};}function handleEntityNotFound(_0x26707a,_0x4a35e2){return function(_0x1d64e6){if(!_0x1d64e6){_0x26707a[_0x5bfd('0x27')](0x194);}return _0x1d64e6;};}function handleError(_0xc6a2a5,_0x4c6d42){_0x4c6d42=_0x4c6d42||0x1f4;return function(_0x2c32f5){logger[_0x5bfd('0x24')](_0x2c32f5[_0x5bfd('0x34')]);if(_0x2c32f5['name']){delete _0x2c32f5[_0x5bfd('0x35')];}_0xc6a2a5['status'](_0x4c6d42)[_0x5bfd('0x36')](_0x2c32f5);};}exports[_0x5bfd('0x37')]=function(_0x5b0180,_0x4b8289){var _0x257a6d={},_0x93ff9a={},_0x2c5fd3={'count':0x0,'rows':[]};var _0xf1edb5=_[_0x5bfd('0x38')](db[_0x5bfd('0x39')]['rawAttributes'],function(_0x34e0e6){return{'name':_0x34e0e6['fieldName'],'type':_0x34e0e6[_0x5bfd('0x3a')]['key']};});_0x93ff9a['model']=_[_0x5bfd('0x38')](_0xf1edb5,_0x5bfd('0x35'));_0x93ff9a[_0x5bfd('0x3b')]=_[_0x5bfd('0x3c')](_0x5b0180[_0x5bfd('0x3b')]);_0x93ff9a['filters']=_['intersection'](_0x93ff9a[_0x5bfd('0x3d')],_0x93ff9a[_0x5bfd('0x3b')]);_0x257a6d[_0x5bfd('0x3e')]=_[_0x5bfd('0x3f')](_0x93ff9a[_0x5bfd('0x3d')],qs['fields'](_0x5b0180[_0x5bfd('0x3b')][_0x5bfd('0x40')]));_0x257a6d[_0x5bfd('0x3e')]=_0x257a6d[_0x5bfd('0x3e')][_0x5bfd('0x41')]?_0x257a6d['attributes']:_0x93ff9a['model'];if(!_0x5b0180[_0x5bfd('0x3b')]['hasOwnProperty'](_0x5bfd('0x42'))){_0x257a6d[_0x5bfd('0x2c')]=qs[_0x5bfd('0x2c')](_0x5b0180['query'][_0x5bfd('0x2c')]);_0x257a6d[_0x5bfd('0x2b')]=qs[_0x5bfd('0x2b')](_0x5b0180[_0x5bfd('0x3b')]['offset']);}_0x257a6d[_0x5bfd('0x43')]=qs['sort'](_0x5b0180['query'][_0x5bfd('0x44')]);_0x257a6d['where']=qs[_0x5bfd('0x45')](_[_0x5bfd('0x46')](_0x5b0180[_0x5bfd('0x3b')],_0x93ff9a[_0x5bfd('0x45')]),_0xf1edb5);if(_0x5b0180['query']['filter']){_0x257a6d[_0x5bfd('0x47')]=_[_0x5bfd('0x48')](_0x257a6d[_0x5bfd('0x47')],{'$or':_[_0x5bfd('0x38')](_0xf1edb5,function(_0x3645a6){if(_0x3645a6['type']!==_0x5bfd('0x49')){var _0x51ea99={};_0x51ea99[_0x3645a6['name']]={'$like':'%'+_0x5b0180['query'][_0x5bfd('0x4a')]+'%'};return _0x51ea99;}})});}_0x257a6d=_[_0x5bfd('0x48')]({},_0x257a6d,_0x5b0180[_0x5bfd('0x4b')]);var _0x56f1be={'where':_0x257a6d['where']};return db[_0x5bfd('0x39')][_0x5bfd('0x2a')](_0x56f1be)[_0x5bfd('0x1e')](function(_0xad804e){_0x2c5fd3[_0x5bfd('0x2a')]=_0xad804e;if(_0x5b0180[_0x5bfd('0x3b')][_0x5bfd('0x4c')]){_0x257a6d[_0x5bfd('0x4d')]=[{'all':!![]}];}return db[_0x5bfd('0x39')][_0x5bfd('0x4e')](_0x257a6d);})[_0x5bfd('0x1e')](function(_0x35a73d){_0x2c5fd3[_0x5bfd('0x4f')]=_0x35a73d;return _0x2c5fd3;})['then'](respondWithFilteredResult(_0x4b8289,_0x257a6d))[_0x5bfd('0x26')](handleError(_0x4b8289,null));};exports[_0x5bfd('0x50')]=function(_0x2eb937,_0x28ce37){var _0x54a17b={'raw':![],'where':{'id':_0x2eb937[_0x5bfd('0x51')]['id']}},_0x24d178={};_0x24d178[_0x5bfd('0x3d')]=_[_0x5bfd('0x3c')](db[_0x5bfd('0x39')][_0x5bfd('0x52')]);_0x24d178['query']=_[_0x5bfd('0x3c')](_0x2eb937[_0x5bfd('0x3b')]);_0x24d178[_0x5bfd('0x45')]=_[_0x5bfd('0x3f')](_0x24d178[_0x5bfd('0x3d')],_0x24d178[_0x5bfd('0x3b')]);_0x54a17b[_0x5bfd('0x3e')]=_['intersection'](_0x24d178[_0x5bfd('0x3d')],qs[_0x5bfd('0x40')](_0x2eb937[_0x5bfd('0x3b')][_0x5bfd('0x40')]));_0x54a17b[_0x5bfd('0x3e')]=_0x54a17b['attributes'][_0x5bfd('0x41')]?_0x54a17b['attributes']:_0x24d178[_0x5bfd('0x3d')];if(_0x2eb937[_0x5bfd('0x3b')][_0x5bfd('0x4c')]){_0x54a17b[_0x5bfd('0x4d')]=[{'all':!![]}];}_0x54a17b=_[_0x5bfd('0x48')]({},_0x54a17b,_0x2eb937[_0x5bfd('0x4b')]);return db['ServicenowConfiguration'][_0x5bfd('0x53')](_0x54a17b)[_0x5bfd('0x1e')](handleEntityNotFound(_0x28ce37,null))[_0x5bfd('0x1e')](respondWithResult(_0x28ce37,null))['catch'](handleError(_0x28ce37,null));};exports[_0x5bfd('0x54')]=function(_0x367e40,_0x1fc9ce){return db[_0x5bfd('0x39')][_0x5bfd('0x54')](_0x367e40[_0x5bfd('0x55')],{})[_0x5bfd('0x1e')](respondWithResult(_0x1fc9ce,0xc9))[_0x5bfd('0x26')](handleError(_0x1fc9ce,null));};exports[_0x5bfd('0x31')]=function(_0x58f8ac,_0x3bc578){if(_0x58f8ac['body']['id']){delete _0x58f8ac[_0x5bfd('0x55')]['id'];}return db['ServicenowConfiguration'][_0x5bfd('0x53')]({'where':{'id':_0x58f8ac[_0x5bfd('0x51')]['id']}})[_0x5bfd('0x1e')](handleEntityNotFound(_0x3bc578,null))[_0x5bfd('0x1e')](saveUpdates(_0x58f8ac[_0x5bfd('0x55')],null))['then'](respondWithResult(_0x3bc578,null))[_0x5bfd('0x26')](handleError(_0x3bc578,null));};exports[_0x5bfd('0x32')]=function(_0x650966,_0xeba8d4){return db[_0x5bfd('0x39')][_0x5bfd('0x53')]({'where':{'id':_0x650966['params']['id']}})[_0x5bfd('0x1e')](handleEntityNotFound(_0xeba8d4,null))['then'](removeEntity(_0xeba8d4,null))[_0x5bfd('0x26')](handleError(_0xeba8d4,null));};exports[_0x5bfd('0x56')]=function(_0x13befa,_0x4124c9,_0x1b7c84){var _0x485b80={};var _0x36bcd3={};var _0x59f101;var _0x2b0571;return db[_0x5bfd('0x39')][_0x5bfd('0x57')]({'where':{'id':_0x13befa[_0x5bfd('0x51')]['id']}})[_0x5bfd('0x1e')](handleEntityNotFound(_0x4124c9,null))[_0x5bfd('0x1e')](function(_0x34aa5c){if(_0x34aa5c){_0x59f101=_0x34aa5c;_0x36bcd3['model']=_[_0x5bfd('0x3c')](db['ServicenowField'][_0x5bfd('0x52')]);_0x36bcd3['query']=_['keys'](_0x13befa[_0x5bfd('0x3b')]);_0x36bcd3[_0x5bfd('0x45')]=_['intersection'](_0x36bcd3[_0x5bfd('0x3d')],_0x36bcd3[_0x5bfd('0x3b')]);_0x485b80['attributes']=_[_0x5bfd('0x3f')](_0x36bcd3[_0x5bfd('0x3d')],qs[_0x5bfd('0x40')](_0x13befa[_0x5bfd('0x3b')]['fields']));_0x485b80[_0x5bfd('0x3e')]=_0x485b80['attributes'][_0x5bfd('0x41')]?_0x485b80[_0x5bfd('0x3e')]:_0x36bcd3[_0x5bfd('0x3d')];_0x485b80[_0x5bfd('0x43')]=qs[_0x5bfd('0x44')](_0x13befa['query'][_0x5bfd('0x44')]);_0x485b80[_0x5bfd('0x47')]=qs[_0x5bfd('0x45')](_[_0x5bfd('0x46')](_0x13befa['query'],_0x36bcd3[_0x5bfd('0x45')]));if(_0x13befa['query'][_0x5bfd('0x4a')]){_0x485b80['where']=_[_0x5bfd('0x48')](_0x485b80[_0x5bfd('0x47')],{'$or':_['map'](_0x485b80[_0x5bfd('0x3e')],function(_0x56c05e){var _0x139ebd={};_0x139ebd[_0x56c05e]={'$like':'%'+_0x13befa['query'][_0x5bfd('0x4a')]+'%'};return _0x139ebd;})});}_0x485b80=_[_0x5bfd('0x48')]({},_0x485b80,_0x13befa[_0x5bfd('0x4b')]);return _0x59f101[_0x5bfd('0x56')](_0x485b80);}})[_0x5bfd('0x1e')](function(_0x25b224){if(_0x25b224){_0x2b0571=_0x25b224[_0x5bfd('0x41')];if(!_0x13befa[_0x5bfd('0x3b')]['hasOwnProperty'](_0x5bfd('0x42'))){_0x485b80[_0x5bfd('0x2c')]=qs[_0x5bfd('0x2c')](_0x13befa[_0x5bfd('0x3b')][_0x5bfd('0x2c')]);_0x485b80[_0x5bfd('0x2b')]=qs[_0x5bfd('0x2b')](_0x13befa[_0x5bfd('0x3b')][_0x5bfd('0x2b')]);}return _0x59f101[_0x5bfd('0x56')](_0x485b80);}})[_0x5bfd('0x1e')](function(_0x4684e1){if(_0x4684e1){return _0x4684e1?{'count':_0x2b0571,'rows':_0x4684e1}:null;}})[_0x5bfd('0x1e')](respondWithResult(_0x4124c9,null))[_0x5bfd('0x26')](handleError(_0x4124c9,null));};exports[_0x5bfd('0x58')]=function(_0x4765ca,_0x2231ad,_0x51a050){var _0x473a98={};var _0x5192be={};var _0x54fcaf;var _0x2c79c3;return db[_0x5bfd('0x39')][_0x5bfd('0x57')]({'where':{'id':_0x4765ca[_0x5bfd('0x51')]['id']}})[_0x5bfd('0x1e')](handleEntityNotFound(_0x2231ad,null))['then'](function(_0x278af9){if(_0x278af9){_0x54fcaf=_0x278af9;_0x5192be['model']=_['keys'](db[_0x5bfd('0x59')][_0x5bfd('0x52')]);_0x5192be[_0x5bfd('0x3b')]=_['keys'](_0x4765ca[_0x5bfd('0x3b')]);_0x5192be[_0x5bfd('0x45')]=_[_0x5bfd('0x3f')](_0x5192be[_0x5bfd('0x3d')],_0x5192be[_0x5bfd('0x3b')]);_0x473a98[_0x5bfd('0x3e')]=_['intersection'](_0x5192be[_0x5bfd('0x3d')],qs[_0x5bfd('0x40')](_0x4765ca[_0x5bfd('0x3b')]['fields']));_0x473a98['attributes']=_0x473a98[_0x5bfd('0x3e')][_0x5bfd('0x41')]?_0x473a98['attributes']:_0x5192be[_0x5bfd('0x3d')];_0x473a98[_0x5bfd('0x43')]=qs[_0x5bfd('0x44')](_0x4765ca[_0x5bfd('0x3b')]['sort']);_0x473a98['where']=qs[_0x5bfd('0x45')](_[_0x5bfd('0x46')](_0x4765ca['query'],_0x5192be['filters']));if(_0x4765ca[_0x5bfd('0x3b')][_0x5bfd('0x4a')]){_0x473a98[_0x5bfd('0x47')]=_[_0x5bfd('0x48')](_0x473a98[_0x5bfd('0x47')],{'$or':_['map'](_0x473a98[_0x5bfd('0x3e')],function(_0x4a7017){var _0x39a075={};_0x39a075[_0x4a7017]={'$like':'%'+_0x4765ca[_0x5bfd('0x3b')][_0x5bfd('0x4a')]+'%'};return _0x39a075;})});}_0x473a98=_['merge']({},_0x473a98,_0x4765ca[_0x5bfd('0x4b')]);return _0x54fcaf[_0x5bfd('0x58')](_0x473a98);}})[_0x5bfd('0x1e')](function(_0x18d8d7){if(_0x18d8d7){_0x2c79c3=_0x18d8d7[_0x5bfd('0x41')];if(!_0x4765ca[_0x5bfd('0x3b')][_0x5bfd('0x5a')]('nolimit')){_0x473a98[_0x5bfd('0x2c')]=qs['limit'](_0x4765ca[_0x5bfd('0x3b')]['limit']);_0x473a98[_0x5bfd('0x2b')]=qs['offset'](_0x4765ca['query'][_0x5bfd('0x2b')]);}return _0x54fcaf[_0x5bfd('0x58')](_0x473a98);}})[_0x5bfd('0x1e')](function(_0x210a3d){if(_0x210a3d){return _0x210a3d?{'count':_0x2c79c3,'rows':_0x210a3d}:null;}})[_0x5bfd('0x1e')](respondWithResult(_0x2231ad,null))[_0x5bfd('0x26')](handleError(_0x2231ad,null));};exports[_0x5bfd('0x5b')]=function(_0x1cbc11,_0x38fa0f,_0xec1a3d){var _0x341c00={};var _0x25a426={};var _0x3ba0eb;var _0x5c1f64;return db[_0x5bfd('0x39')]['findOne']({'where':{'id':_0x1cbc11[_0x5bfd('0x51')]['id']}})[_0x5bfd('0x1e')](handleEntityNotFound(_0x38fa0f,null))[_0x5bfd('0x1e')](function(_0x39b98c){if(_0x39b98c){_0x3ba0eb=_0x39b98c;_0x25a426[_0x5bfd('0x3d')]=_['keys'](db[_0x5bfd('0x59')][_0x5bfd('0x52')]);_0x25a426['query']=_[_0x5bfd('0x3c')](_0x1cbc11[_0x5bfd('0x3b')]);_0x25a426['filters']=_[_0x5bfd('0x3f')](_0x25a426[_0x5bfd('0x3d')],_0x25a426[_0x5bfd('0x3b')]);_0x341c00[_0x5bfd('0x3e')]=_['intersection'](_0x25a426[_0x5bfd('0x3d')],qs[_0x5bfd('0x40')](_0x1cbc11[_0x5bfd('0x3b')][_0x5bfd('0x40')]));_0x341c00['attributes']=_0x341c00[_0x5bfd('0x3e')][_0x5bfd('0x41')]?_0x341c00[_0x5bfd('0x3e')]:_0x25a426[_0x5bfd('0x3d')];_0x341c00[_0x5bfd('0x43')]=qs[_0x5bfd('0x44')](_0x1cbc11[_0x5bfd('0x3b')]['sort']);_0x341c00[_0x5bfd('0x47')]=qs[_0x5bfd('0x45')](_[_0x5bfd('0x46')](_0x1cbc11['query'],_0x25a426[_0x5bfd('0x45')]));if(_0x1cbc11[_0x5bfd('0x3b')]['filter']){_0x341c00[_0x5bfd('0x47')]=_[_0x5bfd('0x48')](_0x341c00[_0x5bfd('0x47')],{'$or':_[_0x5bfd('0x38')](_0x341c00['attributes'],function(_0x52a154){var _0x1b2385={};_0x1b2385[_0x52a154]={'$like':'%'+_0x1cbc11[_0x5bfd('0x3b')]['filter']+'%'};return _0x1b2385;})});}_0x341c00=_[_0x5bfd('0x48')]({},_0x341c00,_0x1cbc11[_0x5bfd('0x4b')]);return _0x3ba0eb[_0x5bfd('0x5b')](_0x341c00);}})[_0x5bfd('0x1e')](function(_0x2ac251){if(_0x2ac251){_0x5c1f64=_0x2ac251[_0x5bfd('0x41')];if(!_0x1cbc11[_0x5bfd('0x3b')][_0x5bfd('0x5a')]('nolimit')){_0x341c00[_0x5bfd('0x2c')]=qs[_0x5bfd('0x2c')](_0x1cbc11[_0x5bfd('0x3b')][_0x5bfd('0x2c')]);_0x341c00[_0x5bfd('0x2b')]=qs['offset'](_0x1cbc11[_0x5bfd('0x3b')]['offset']);}return _0x3ba0eb['getDescriptions'](_0x341c00);}})[_0x5bfd('0x1e')](function(_0x5cb79e){if(_0x5cb79e){return _0x5cb79e?{'count':_0x5c1f64,'rows':_0x5cb79e}:null;}})[_0x5bfd('0x1e')](respondWithResult(_0x38fa0f,null))[_0x5bfd('0x26')](handleError(_0x38fa0f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 21b8f75..65e6c59 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 _0x85d2=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0x85d2,0x8a));var _0x285d=function(_0xb51e3f,_0x3ecba5){_0xb51e3f=_0xb51e3f-0x0;var _0x340a25=_0x85d2[_0xb51e3f];return _0x340a25;};'use strict';var _=require(_0x285d('0x0'));var util=require(_0x285d('0x1'));var logger=require(_0x285d('0x2'))(_0x285d('0x3'));var moment=require(_0x285d('0x4'));var BPromise=require('bluebird');var rp=require(_0x285d('0x5'));var fs=require('fs');var path=require(_0x285d('0x6'));var rimraf=require(_0x285d('0x7'));var config=require(_0x285d('0x8'));var attributes=require(_0x285d('0x9'));module[_0x285d('0xa')]=function(_0x1d8ca8,_0x19b15f){return _0x1d8ca8[_0x285d('0xb')](_0x285d('0xc'),attributes,{'tableName':_0x285d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3afd=['define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3afd,0x1e3));var _0xd3af=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x3afd[_0x3fa7d3];return _0x4c51bd;};'use strict';var _=require(_0xd3af('0x0'));var util=require(_0xd3af('0x1'));var logger=require(_0xd3af('0x2'))(_0xd3af('0x3'));var moment=require(_0xd3af('0x4'));var BPromise=require(_0xd3af('0x5'));var rp=require(_0xd3af('0x6'));var fs=require('fs');var path=require(_0xd3af('0x7'));var rimraf=require('rimraf');var config=require(_0xd3af('0x8'));var attributes=require(_0xd3af('0x9'));module[_0xd3af('0xa')]=function(_0x5d944c,_0x1e8c71){return _0x5d944c[_0xd3af('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0xd3af('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 c3780f8..3274092 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 _0x228c=['http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x404b18,_0x884dfa){var _0x3f8d96=function(_0x16cce3){while(--_0x16cce3){_0x404b18['push'](_0x404b18['shift']());}};_0x3f8d96(++_0x884dfa);}(_0x228c,0x152));var _0xc228=function(_0x1ed935,_0x151a05){_0x1ed935=_0x1ed935-0x0;var _0x829d02=_0x228c[_0x1ed935];return _0x829d02;};'use strict';var _=require(_0xc228('0x0'));var util=require(_0xc228('0x1'));var moment=require(_0xc228('0x2'));var BPromise=require(_0xc228('0x3'));var rs=require(_0xc228('0x4'));var fs=require('fs');var Redis=require(_0xc228('0x5'));var db=require(_0xc228('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc228('0x7'))(_0xc228('0x8'));var config=require(_0xc228('0x9'));var jayson=require(_0xc228('0xa'));var client=jayson[_0xc228('0xb')][_0xc228('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a3337,_0x319d1c,_0x114fac){return new BPromise(function(_0x1a6a06,_0x56bade){return client[_0xc228('0xd')](_0x1a3337,_0x114fac)[_0xc228('0xe')](function(_0x210fcb){logger['info'](_0xc228('0xf'),_0x319d1c,_0xc228('0x10'));logger[_0xc228('0x11')](_0xc228('0x12'),_0x319d1c,_0xc228('0x10'),JSON[_0xc228('0x13')](_0x210fcb));if(_0x210fcb[_0xc228('0x14')]){if(_0x210fcb[_0xc228('0x14')][_0xc228('0x15')]===0x1f4){logger[_0xc228('0x14')](_0xc228('0xf'),_0x319d1c,_0x210fcb[_0xc228('0x14')][_0xc228('0x16')]);return _0x56bade(_0x210fcb[_0xc228('0x14')][_0xc228('0x16')]);}logger['error'](_0xc228('0xf'),_0x319d1c,_0x210fcb[_0xc228('0x14')][_0xc228('0x16')]);return _0x1a6a06(_0x210fcb[_0xc228('0x14')]['message']);}else{logger[_0xc228('0x17')](_0xc228('0xf'),_0x319d1c,_0xc228('0x10'));_0x1a6a06(_0x210fcb['result'][_0xc228('0x16')]);}})[_0xc228('0x18')](function(_0xcd4655){logger[_0xc228('0x14')](_0xc228('0xf'),_0x319d1c,_0xcd4655);_0x56bade(_0xcd4655);});});} \ No newline at end of file +var _0x529d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x529d,0x19f));var _0xd529=function(_0x570115,_0x575db2){_0x570115=_0x570115-0x0;var _0x29438e=_0x529d[_0x570115];return _0x29438e;};'use strict';var _=require('lodash');var util=require(_0xd529('0x0'));var moment=require(_0xd529('0x1'));var BPromise=require(_0xd529('0x2'));var rs=require(_0xd529('0x3'));var fs=require('fs');var Redis=require(_0xd529('0x4'));var db=require(_0xd529('0x5'))['db'];var utils=require(_0xd529('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd529('0x7'));var jayson=require(_0xd529('0x8'));var client=jayson['client'][_0xd529('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54ab8d,_0x111ab8,_0x42d0c2){return new BPromise(function(_0x33d04b,_0x30e8d1){return client[_0xd529('0xa')](_0x54ab8d,_0x42d0c2)[_0xd529('0xb')](function(_0x50ca0a){logger[_0xd529('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x111ab8,_0xd529('0xd'));logger[_0xd529('0xe')](_0xd529('0xf'),_0x111ab8,_0xd529('0xd'),JSON[_0xd529('0x10')](_0x50ca0a));if(_0x50ca0a[_0xd529('0x11')]){if(_0x50ca0a['error']['code']===0x1f4){logger[_0xd529('0x11')](_0xd529('0x12'),_0x111ab8,_0x50ca0a[_0xd529('0x11')]['message']);return _0x30e8d1(_0x50ca0a[_0xd529('0x11')][_0xd529('0x13')]);}logger[_0xd529('0x11')](_0xd529('0x12'),_0x111ab8,_0x50ca0a[_0xd529('0x11')][_0xd529('0x13')]);return _0x33d04b(_0x50ca0a[_0xd529('0x11')][_0xd529('0x13')]);}else{logger[_0xd529('0xc')](_0xd529('0x12'),_0x111ab8,_0xd529('0xd'));_0x33d04b(_0x50ca0a[_0xd529('0x14')]['message']);}})[_0xd529('0x15')](function(_0x3d9564){logger[_0xd529('0x11')](_0xd529('0x12'),_0x111ab8,_0x3d9564);_0x30e8d1(_0x3d9564);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2a983f2..4ef4b05 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 _0x2aa7=['put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x38abad,_0x406e7b){var _0x2e160c=function(_0x299bb5){while(--_0x299bb5){_0x38abad['push'](_0x38abad['shift']());}};_0x2e160c(++_0x406e7b);}(_0x2aa7,0x16c));var _0x72aa=function(_0x2d0b04,_0x5db0eb){_0x2d0b04=_0x2d0b04-0x0;var _0x26e3fc=_0x2aa7[_0x2d0b04];return _0x26e3fc;};'use strict';var multer=require(_0x72aa('0x0'));var util=require(_0x72aa('0x1'));var path=require(_0x72aa('0x2'));var timeout=require(_0x72aa('0x3'));var express=require(_0x72aa('0x4'));var router=express['Router']();var auth=require(_0x72aa('0x5'));var interaction=require(_0x72aa('0x6'));var config=require(_0x72aa('0x7'));var controller=require(_0x72aa('0x8'));router['get']('/',auth[_0x72aa('0x9')](),controller[_0x72aa('0xa')]);router[_0x72aa('0xb')](_0x72aa('0xc'),auth['isAuthenticated'](),controller[_0x72aa('0xd')]);router[_0x72aa('0xe')]('/',auth[_0x72aa('0x9')](),controller[_0x72aa('0xf')]);router[_0x72aa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x72aa('0x11')]);router[_0x72aa('0x12')](_0x72aa('0xc'),auth[_0x72aa('0x9')](),controller['destroy']);module[_0x72aa('0x13')]=router; \ No newline at end of file +var _0xe96c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1fef9a,_0x3981cc){var _0x5e19cd=function(_0x57e988){while(--_0x57e988){_0x1fef9a['push'](_0x1fef9a['shift']());}};_0x5e19cd(++_0x3981cc);}(_0xe96c,0x142));var _0xce96=function(_0xf5436b,_0x123a9f){_0xf5436b=_0xf5436b-0x0;var _0x47f31b=_0xe96c[_0xf5436b];return _0x47f31b;};'use strict';var multer=require(_0xce96('0x0'));var util=require('util');var path=require(_0xce96('0x1'));var timeout=require(_0xce96('0x2'));var express=require(_0xce96('0x3'));var router=express[_0xce96('0x4')]();var auth=require(_0xce96('0x5'));var interaction=require(_0xce96('0x6'));var config=require(_0xce96('0x7'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xce96('0x8')](),controller[_0xce96('0x9')]);router['get'](_0xce96('0xa'),auth[_0xce96('0x8')](),controller['show']);router[_0xce96('0xb')]('/',auth[_0xce96('0x8')](),controller[_0xce96('0xc')]);router[_0xce96('0xd')](_0xce96('0xa'),auth[_0xce96('0x8')](),controller[_0xce96('0xe')]);router[_0xce96('0xf')]('/:id',auth[_0xce96('0x8')](),controller[_0xce96('0x10')]);module[_0xce96('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 65506a5..b619f5e 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 _0xa20e=['customVariable','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x4275a8,_0x1646e3){var _0x2845ce=function(_0x4d3683){while(--_0x4d3683){_0x4275a8['push'](_0x4275a8['shift']());}};_0x2845ce(++_0x1646e3);}(_0xa20e,0x1ca));var _0xea20=function(_0x342548,_0x31c72e){_0x342548=_0x342548-0x0;var _0x107140=_0xa20e[_0x342548];return _0x107140;};'use strict';var Sequelize=require(_0xea20('0x0'));module['exports']={'type':{'type':Sequelize[_0xea20('0x1')](_0xea20('0x2'),_0xea20('0x3'),_0xea20('0x4'),'keyValue'),'defaultValue':_0xea20('0x2')},'content':{'type':Sequelize[_0xea20('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xea20('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xea20('0x5')]},'idField':{'type':Sequelize[_0xea20('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xea20('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xea20('0x5')]}}; \ No newline at end of file +var _0xaec9=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5b8dc8,_0x2ecefe){var _0x46f390=function(_0x33c7e0){while(--_0x33c7e0){_0x5b8dc8['push'](_0x5b8dc8['shift']());}};_0x46f390(++_0x2ecefe);}(_0xaec9,0x112));var _0x9aec=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xaec9[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');module[_0x9aec('0x0')]={'type':{'type':Sequelize[_0x9aec('0x1')](_0x9aec('0x2'),_0x9aec('0x3'),_0x9aec('0x4'),_0x9aec('0x5')),'defaultValue':_0x9aec('0x2')},'content':{'type':Sequelize[_0x9aec('0x6')]},'key':{'type':Sequelize[_0x9aec('0x6')]},'keyType':{'type':Sequelize[_0x9aec('0x1')](_0x9aec('0x2'),_0x9aec('0x3'),_0x9aec('0x4'))},'keyContent':{'type':Sequelize[_0x9aec('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9aec('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 28b31f9..a31d7f6 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 _0x2d6d=['query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','intersection','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','keys'];(function(_0x536f01,_0x5e3dac){var _0x4a595b=function(_0x4285db){while(--_0x4285db){_0x536f01['push'](_0x536f01['shift']());}};_0x4a595b(++_0x5e3dac);}(_0x2d6d,0x66));var _0xd2d6=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x2d6d[_0x366388];return _0x41c97e;};'use strict';var pdf=require(_0xd2d6('0x0'));var emlformat=require(_0xd2d6('0x1'));var rimraf=require(_0xd2d6('0x2'));var zipdir=require(_0xd2d6('0x3'));var jsonpatch=require(_0xd2d6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd2d6('0x5'));var Mustache=require(_0xd2d6('0x6'));var util=require(_0xd2d6('0x7'));var path=require(_0xd2d6('0x8'));var sox=require(_0xd2d6('0x9'));var csv=require(_0xd2d6('0xa'));var ejs=require(_0xd2d6('0xb'));var fs=require('fs');var _=require(_0xd2d6('0xc'));var squel=require(_0xd2d6('0xd'));var crypto=require('crypto');var jsforce=require(_0xd2d6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd2d6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd2d6('0xf'));var authService=require(_0xd2d6('0x10'));var qs=require(_0xd2d6('0x11'));var as=require(_0xd2d6('0x12'));var hardwareService=require(_0xd2d6('0x13'));var logger=require(_0xd2d6('0x14'))(_0xd2d6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd2d6('0x16'));var db=require(_0xd2d6('0x17'))['db'];function respondWithStatusCode(_0x43dbae,_0x199206){_0x199206=_0x199206||0xcc;return function(_0x38a8be){if(_0x38a8be){return _0x43dbae[_0xd2d6('0x18')](_0x199206);}return _0x43dbae['status'](_0x199206)[_0xd2d6('0x19')]();};}function respondWithResult(_0x1ed2e8,_0xb0a34){_0xb0a34=_0xb0a34||0xc8;return function(_0x439e3d){if(_0x439e3d){return _0x1ed2e8['status'](_0xb0a34)['json'](_0x439e3d);}};}function respondWithFilteredResult(_0x37a6bc,_0x352619){return function(_0x2a4b1a){if(_0x2a4b1a){var _0x8ba7fb=_0x2a4b1a[_0xd2d6('0x1a')],_0x474b95=_0x352619['offset'],_0xe56b48=_0x352619['offset']+_0x352619['limit'],_0x58e05f;if(_0xe56b48>=_0x8ba7fb){_0xe56b48=_0x8ba7fb;_0x58e05f=0xc8;}else{_0x58e05f=0xce;}_0x37a6bc[_0xd2d6('0x1b')](_0x58e05f);return _0x37a6bc[_0xd2d6('0x1c')](_0xd2d6('0x1d'),_0x474b95+'-'+_0xe56b48+'/'+_0x8ba7fb)[_0xd2d6('0x1e')](_0x2a4b1a);}return null;};}function patchUpdates(_0x56d771){return function(_0x2d3bcb){try{jsonpatch[_0xd2d6('0x1f')](_0x2d3bcb,_0x56d771,!![]);}catch(_0x56b27f){return BPromise[_0xd2d6('0x20')](_0x56b27f);}return _0x2d3bcb[_0xd2d6('0x21')]();};}function saveUpdates(_0x4313ae,_0x5666e9){return function(_0x1f0bd0){if(_0x1f0bd0){return _0x1f0bd0[_0xd2d6('0x22')](_0x4313ae)[_0xd2d6('0x23')](function(_0x5e397d){return _0x5e397d;});}return null;};}function removeEntity(_0x39d3f0,_0x2422c0){return function(_0x5d4f17){if(_0x5d4f17){return _0x5d4f17[_0xd2d6('0x24')]()[_0xd2d6('0x23')](function(){_0x39d3f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f296e,_0x50544a){return function(_0x31c721){if(!_0x31c721){_0x1f296e[_0xd2d6('0x18')](0x194);}return _0x31c721;};}function handleError(_0x1eb5b7,_0x3f15f4){_0x3f15f4=_0x3f15f4||0x1f4;return function(_0x4f52bb){logger[_0xd2d6('0x25')](_0x4f52bb[_0xd2d6('0x26')]);if(_0x4f52bb[_0xd2d6('0x27')]){delete _0x4f52bb[_0xd2d6('0x27')];}_0x1eb5b7['status'](_0x3f15f4)[_0xd2d6('0x28')](_0x4f52bb);};}exports[_0xd2d6('0x29')]=function(_0x1ffd00,_0xa7925f){var _0x5ee73e={},_0x2e5355={},_0x4999a5={'count':0x0,'rows':[]};var _0x381afa=_['map'](db[_0xd2d6('0x2a')][_0xd2d6('0x2b')],function(_0x3b3f81){return{'name':_0x3b3f81[_0xd2d6('0x2c')],'type':_0x3b3f81[_0xd2d6('0x2d')][_0xd2d6('0x2e')]};});_0x2e5355['model']=_['map'](_0x381afa,_0xd2d6('0x27'));_0x2e5355['query']=_[_0xd2d6('0x2f')](_0x1ffd00[_0xd2d6('0x30')]);_0x2e5355[_0xd2d6('0x31')]=_['intersection'](_0x2e5355['model'],_0x2e5355[_0xd2d6('0x30')]);_0x5ee73e[_0xd2d6('0x32')]=_['intersection'](_0x2e5355[_0xd2d6('0x33')],qs[_0xd2d6('0x34')](_0x1ffd00[_0xd2d6('0x30')]['fields']));_0x5ee73e['attributes']=_0x5ee73e['attributes'][_0xd2d6('0x35')]?_0x5ee73e[_0xd2d6('0x32')]:_0x2e5355['model'];if(!_0x1ffd00[_0xd2d6('0x30')][_0xd2d6('0x36')](_0xd2d6('0x37'))){_0x5ee73e[_0xd2d6('0x38')]=qs[_0xd2d6('0x38')](_0x1ffd00[_0xd2d6('0x30')][_0xd2d6('0x38')]);_0x5ee73e[_0xd2d6('0x39')]=qs[_0xd2d6('0x39')](_0x1ffd00[_0xd2d6('0x30')][_0xd2d6('0x39')]);}_0x5ee73e[_0xd2d6('0x3a')]=qs[_0xd2d6('0x3b')](_0x1ffd00[_0xd2d6('0x30')][_0xd2d6('0x3b')]);_0x5ee73e[_0xd2d6('0x3c')]=qs[_0xd2d6('0x31')](_[_0xd2d6('0x3d')](_0x1ffd00[_0xd2d6('0x30')],_0x2e5355[_0xd2d6('0x31')]),_0x381afa);if(_0x1ffd00[_0xd2d6('0x30')][_0xd2d6('0x3e')]){_0x5ee73e[_0xd2d6('0x3c')]=_['merge'](_0x5ee73e[_0xd2d6('0x3c')],{'$or':_['map'](_0x381afa,function(_0x31734f){if(_0x31734f[_0xd2d6('0x2d')]!==_0xd2d6('0x3f')){var _0x502e14={};_0x502e14[_0x31734f[_0xd2d6('0x27')]]={'$like':'%'+_0x1ffd00[_0xd2d6('0x30')][_0xd2d6('0x3e')]+'%'};return _0x502e14;}})});}_0x5ee73e=_[_0xd2d6('0x40')]({},_0x5ee73e,_0x1ffd00['options']);var _0x3d2414={'where':_0x5ee73e[_0xd2d6('0x3c')]};return db[_0xd2d6('0x2a')][_0xd2d6('0x1a')](_0x3d2414)[_0xd2d6('0x23')](function(_0x5c9cbf){_0x4999a5[_0xd2d6('0x1a')]=_0x5c9cbf;if(_0x1ffd00['query'][_0xd2d6('0x41')]){_0x5ee73e['include']=[{'all':!![]}];}return db['ServicenowField'][_0xd2d6('0x42')](_0x5ee73e);})[_0xd2d6('0x23')](function(_0x57be50){_0x4999a5[_0xd2d6('0x43')]=_0x57be50;return _0x4999a5;})[_0xd2d6('0x23')](respondWithFilteredResult(_0xa7925f,_0x5ee73e))[_0xd2d6('0x44')](handleError(_0xa7925f,null));};exports['show']=function(_0x21b844,_0x5baf88){var _0x2e8312={'raw':!![],'where':{'id':_0x21b844[_0xd2d6('0x45')]['id']}},_0x2015b2={};_0x2015b2[_0xd2d6('0x33')]=_['keys'](db['ServicenowField'][_0xd2d6('0x2b')]);_0x2015b2[_0xd2d6('0x30')]=_[_0xd2d6('0x2f')](_0x21b844['query']);_0x2015b2['filters']=_[_0xd2d6('0x46')](_0x2015b2[_0xd2d6('0x33')],_0x2015b2[_0xd2d6('0x30')]);_0x2e8312['attributes']=_['intersection'](_0x2015b2['model'],qs[_0xd2d6('0x34')](_0x21b844[_0xd2d6('0x30')]['fields']));_0x2e8312['attributes']=_0x2e8312[_0xd2d6('0x32')]['length']?_0x2e8312[_0xd2d6('0x32')]:_0x2015b2[_0xd2d6('0x33')];if(_0x21b844[_0xd2d6('0x30')][_0xd2d6('0x41')]){_0x2e8312[_0xd2d6('0x47')]=[{'all':!![]}];}_0x2e8312=_[_0xd2d6('0x40')]({},_0x2e8312,_0x21b844['options']);return db[_0xd2d6('0x2a')][_0xd2d6('0x48')](_0x2e8312)['then'](handleEntityNotFound(_0x5baf88,null))[_0xd2d6('0x23')](respondWithResult(_0x5baf88,null))[_0xd2d6('0x44')](handleError(_0x5baf88,null));};exports[_0xd2d6('0x49')]=function(_0xbd3527,_0x325671){return db[_0xd2d6('0x2a')][_0xd2d6('0x49')](_0xbd3527[_0xd2d6('0x4a')],{})[_0xd2d6('0x23')](respondWithResult(_0x325671,0xc9))['catch'](handleError(_0x325671,null));};exports[_0xd2d6('0x22')]=function(_0x4dfcaa,_0x523d52){if(_0x4dfcaa[_0xd2d6('0x4a')]['id']){delete _0x4dfcaa[_0xd2d6('0x4a')]['id'];}return db[_0xd2d6('0x2a')][_0xd2d6('0x48')]({'where':{'id':_0x4dfcaa[_0xd2d6('0x45')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x523d52,null))[_0xd2d6('0x23')](saveUpdates(_0x4dfcaa[_0xd2d6('0x4a')],null))[_0xd2d6('0x23')](respondWithResult(_0x523d52,null))[_0xd2d6('0x44')](handleError(_0x523d52,null));};exports[_0xd2d6('0x24')]=function(_0x2be7fc,_0x45691a){return db[_0xd2d6('0x2a')][_0xd2d6('0x48')]({'where':{'id':_0x2be7fc[_0xd2d6('0x45')]['id']}})['then'](handleEntityNotFound(_0x45691a,null))[_0xd2d6('0x23')](removeEntity(_0x45691a,null))[_0xd2d6('0x44')](handleError(_0x45691a,null));}; \ No newline at end of file +var _0x4e64=['create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','ServicenowField','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','include','find','catch'];(function(_0x44bfe8,_0x1d621e){var _0x4ae44f=function(_0x2ae0e4){while(--_0x2ae0e4){_0x44bfe8['push'](_0x44bfe8['shift']());}};_0x4ae44f(++_0x1d621e);}(_0x4e64,0x165));var _0x44e6=function(_0x570990,_0x483310){_0x570990=_0x570990-0x0;var _0x2ebad9=_0x4e64[_0x570990];return _0x2ebad9;};'use strict';var pdf=require(_0x44e6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44e6('0x1'));var zipdir=require(_0x44e6('0x2'));var jsonpatch=require(_0x44e6('0x3'));var rp=require(_0x44e6('0x4'));var moment=require(_0x44e6('0x5'));var BPromise=require(_0x44e6('0x6'));var Mustache=require(_0x44e6('0x7'));var util=require('util');var path=require(_0x44e6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44e6('0x9'));var fs=require('fs');var _=require(_0x44e6('0xa'));var squel=require('squel');var crypto=require(_0x44e6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x44e6('0xc'));var toCsv=require(_0x44e6('0xd'));var querystring=require(_0x44e6('0xe'));var Papa=require(_0x44e6('0xf'));var Redis=require(_0x44e6('0x10'));var authService=require(_0x44e6('0x11'));var qs=require(_0x44e6('0x12'));var as=require(_0x44e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44e6('0x14'))(_0x44e6('0x15'));var utils=require(_0x44e6('0x16'));var config=require(_0x44e6('0x17'));var licenseUtil=require(_0x44e6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dc571,_0x791b30){_0x791b30=_0x791b30||0xcc;return function(_0x2e05ac){if(_0x2e05ac){return _0x3dc571[_0x44e6('0x19')](_0x791b30);}return _0x3dc571['status'](_0x791b30)['end']();};}function respondWithResult(_0x4b3ca0,_0x33e026){_0x33e026=_0x33e026||0xc8;return function(_0x11046a){if(_0x11046a){return _0x4b3ca0[_0x44e6('0x1a')](_0x33e026)[_0x44e6('0x1b')](_0x11046a);}};}function respondWithFilteredResult(_0x56919b,_0x490306){return function(_0x3ce9c1){if(_0x3ce9c1){var _0x14c940=_0x3ce9c1[_0x44e6('0x1c')],_0x2caf36=_0x490306[_0x44e6('0x1d')],_0x476698=_0x490306[_0x44e6('0x1d')]+_0x490306[_0x44e6('0x1e')],_0xed1d89;if(_0x476698>=_0x14c940){_0x476698=_0x14c940;_0xed1d89=0xc8;}else{_0xed1d89=0xce;}_0x56919b['status'](_0xed1d89);return _0x56919b[_0x44e6('0x1f')](_0x44e6('0x20'),_0x2caf36+'-'+_0x476698+'/'+_0x14c940)[_0x44e6('0x1b')](_0x3ce9c1);}return null;};}function patchUpdates(_0x45826f){return function(_0x5391a3){try{jsonpatch['apply'](_0x5391a3,_0x45826f,!![]);}catch(_0x2115b0){return BPromise[_0x44e6('0x21')](_0x2115b0);}return _0x5391a3['save']();};}function saveUpdates(_0x19e73d,_0x1206e6){return function(_0x5af5f4){if(_0x5af5f4){return _0x5af5f4[_0x44e6('0x22')](_0x19e73d)[_0x44e6('0x23')](function(_0x124724){return _0x124724;});}return null;};}function removeEntity(_0x312f73,_0x4c6124){return function(_0x166a5f){if(_0x166a5f){return _0x166a5f[_0x44e6('0x24')]()[_0x44e6('0x23')](function(){_0x312f73[_0x44e6('0x1a')](0xcc)[_0x44e6('0x25')]();});}};}function handleEntityNotFound(_0x3bf377,_0x5698c7){return function(_0x10a076){if(!_0x10a076){_0x3bf377[_0x44e6('0x19')](0x194);}return _0x10a076;};}function handleError(_0x104a69,_0x4f832c){_0x4f832c=_0x4f832c||0x1f4;return function(_0x58bf5f){logger[_0x44e6('0x26')](_0x58bf5f[_0x44e6('0x27')]);if(_0x58bf5f[_0x44e6('0x28')]){delete _0x58bf5f[_0x44e6('0x28')];}_0x104a69['status'](_0x4f832c)[_0x44e6('0x29')](_0x58bf5f);};}exports[_0x44e6('0x2a')]=function(_0x38d1f3,_0x3a9694){var _0x57916b={},_0x30c66b={},_0x2a32a9={'count':0x0,'rows':[]};var _0x4dd3d7=_[_0x44e6('0x2b')](db[_0x44e6('0x2c')]['rawAttributes'],function(_0x149d0c){return{'name':_0x149d0c['fieldName'],'type':_0x149d0c[_0x44e6('0x2d')][_0x44e6('0x2e')]};});_0x30c66b[_0x44e6('0x2f')]=_[_0x44e6('0x2b')](_0x4dd3d7,_0x44e6('0x28'));_0x30c66b[_0x44e6('0x30')]=_['keys'](_0x38d1f3[_0x44e6('0x30')]);_0x30c66b[_0x44e6('0x31')]=_[_0x44e6('0x32')](_0x30c66b[_0x44e6('0x2f')],_0x30c66b[_0x44e6('0x30')]);_0x57916b['attributes']=_[_0x44e6('0x32')](_0x30c66b[_0x44e6('0x2f')],qs[_0x44e6('0x33')](_0x38d1f3[_0x44e6('0x30')][_0x44e6('0x33')]));_0x57916b[_0x44e6('0x34')]=_0x57916b[_0x44e6('0x34')][_0x44e6('0x35')]?_0x57916b[_0x44e6('0x34')]:_0x30c66b[_0x44e6('0x2f')];if(!_0x38d1f3['query'][_0x44e6('0x36')](_0x44e6('0x37'))){_0x57916b[_0x44e6('0x1e')]=qs['limit'](_0x38d1f3[_0x44e6('0x30')][_0x44e6('0x1e')]);_0x57916b[_0x44e6('0x1d')]=qs[_0x44e6('0x1d')](_0x38d1f3['query'][_0x44e6('0x1d')]);}_0x57916b['order']=qs[_0x44e6('0x38')](_0x38d1f3[_0x44e6('0x30')][_0x44e6('0x38')]);_0x57916b[_0x44e6('0x39')]=qs[_0x44e6('0x31')](_['pick'](_0x38d1f3['query'],_0x30c66b['filters']),_0x4dd3d7);if(_0x38d1f3[_0x44e6('0x30')][_0x44e6('0x3a')]){_0x57916b[_0x44e6('0x39')]=_['merge'](_0x57916b['where'],{'$or':_['map'](_0x4dd3d7,function(_0x4a6c05){if(_0x4a6c05[_0x44e6('0x2d')]!==_0x44e6('0x3b')){var _0x1c5c9c={};_0x1c5c9c[_0x4a6c05[_0x44e6('0x28')]]={'$like':'%'+_0x38d1f3[_0x44e6('0x30')][_0x44e6('0x3a')]+'%'};return _0x1c5c9c;}})});}_0x57916b=_[_0x44e6('0x3c')]({},_0x57916b,_0x38d1f3[_0x44e6('0x3d')]);var _0x16d48c={'where':_0x57916b['where']};return db[_0x44e6('0x2c')][_0x44e6('0x1c')](_0x16d48c)[_0x44e6('0x23')](function(_0x4f9e78){_0x2a32a9['count']=_0x4f9e78;if(_0x38d1f3[_0x44e6('0x30')][_0x44e6('0x3e')]){_0x57916b['include']=[{'all':!![]}];}return db[_0x44e6('0x2c')][_0x44e6('0x3f')](_0x57916b);})[_0x44e6('0x23')](function(_0x5c1345){_0x2a32a9['rows']=_0x5c1345;return _0x2a32a9;})[_0x44e6('0x23')](respondWithFilteredResult(_0x3a9694,_0x57916b))['catch'](handleError(_0x3a9694,null));};exports[_0x44e6('0x40')]=function(_0xc85dac,_0x3879f4){var _0x5abb18={'raw':!![],'where':{'id':_0xc85dac[_0x44e6('0x41')]['id']}},_0x2d4b38={};_0x2d4b38[_0x44e6('0x2f')]=_['keys'](db[_0x44e6('0x2c')]['rawAttributes']);_0x2d4b38['query']=_['keys'](_0xc85dac[_0x44e6('0x30')]);_0x2d4b38[_0x44e6('0x31')]=_['intersection'](_0x2d4b38['model'],_0x2d4b38[_0x44e6('0x30')]);_0x5abb18[_0x44e6('0x34')]=_[_0x44e6('0x32')](_0x2d4b38[_0x44e6('0x2f')],qs[_0x44e6('0x33')](_0xc85dac['query'][_0x44e6('0x33')]));_0x5abb18[_0x44e6('0x34')]=_0x5abb18[_0x44e6('0x34')]['length']?_0x5abb18[_0x44e6('0x34')]:_0x2d4b38[_0x44e6('0x2f')];if(_0xc85dac['query'][_0x44e6('0x3e')]){_0x5abb18[_0x44e6('0x42')]=[{'all':!![]}];}_0x5abb18=_[_0x44e6('0x3c')]({},_0x5abb18,_0xc85dac['options']);return db['ServicenowField'][_0x44e6('0x43')](_0x5abb18)['then'](handleEntityNotFound(_0x3879f4,null))[_0x44e6('0x23')](respondWithResult(_0x3879f4,null))[_0x44e6('0x44')](handleError(_0x3879f4,null));};exports['create']=function(_0x9c7a59,_0x19dc17){return db[_0x44e6('0x2c')][_0x44e6('0x45')](_0x9c7a59[_0x44e6('0x46')],{})[_0x44e6('0x23')](respondWithResult(_0x19dc17,0xc9))[_0x44e6('0x44')](handleError(_0x19dc17,null));};exports['update']=function(_0x5baf26,_0x3edaf9){if(_0x5baf26[_0x44e6('0x46')]['id']){delete _0x5baf26[_0x44e6('0x46')]['id'];}return db['ServicenowField'][_0x44e6('0x43')]({'where':{'id':_0x5baf26[_0x44e6('0x41')]['id']}})[_0x44e6('0x23')](handleEntityNotFound(_0x3edaf9,null))[_0x44e6('0x23')](saveUpdates(_0x5baf26['body'],null))[_0x44e6('0x23')](respondWithResult(_0x3edaf9,null))['catch'](handleError(_0x3edaf9,null));};exports[_0x44e6('0x24')]=function(_0x54ded5,_0xdcda05){return db['ServicenowField'][_0x44e6('0x43')]({'where':{'id':_0x54ded5[_0x44e6('0x41')]['id']}})[_0x44e6('0x23')](handleEntityNotFound(_0xdcda05,null))['then'](removeEntity(_0xdcda05,null))[_0x44e6('0x44')](handleError(_0xdcda05,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 06b5067..204fd03 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 _0x4cdc=['request-promise','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','moment','bluebird'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x4cdc,0xbf));var _0xc4cd=function(_0x58f2fb,_0x569d8a){_0x58f2fb=_0x58f2fb-0x0;var _0x3644ba=_0x4cdc[_0x58f2fb];return _0x3644ba;};'use strict';var _=require(_0xc4cd('0x0'));var util=require(_0xc4cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc4cd('0x2'));var BPromise=require(_0xc4cd('0x3'));var rp=require(_0xc4cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4cd('0x5'));var config=require(_0xc4cd('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xc4cd('0x7')]=function(_0x1bcb8f,_0x56119e){return _0x1bcb8f[_0xc4cd('0x8')](_0xc4cd('0x9'),attributes,{'tableName':_0xc4cd('0xa'),'paranoid':![],'indexes':[{'name':_0xc4cd('0xb'),'fields':['idField',_0xc4cd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e6b=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x3fbef5,_0x1b2d88){var _0x45caca=function(_0x509c54){while(--_0x509c54){_0x3fbef5['push'](_0x3fbef5['shift']());}};_0x45caca(++_0x1b2d88);}(_0x0e6b,0x69));var _0xb0e6=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x0e6b[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require(_0xb0e6('0x0'));var util=require(_0xb0e6('0x1'));var logger=require('../../config/logger')(_0xb0e6('0x2'));var moment=require(_0xb0e6('0x3'));var BPromise=require(_0xb0e6('0x4'));var rp=require(_0xb0e6('0x5'));var fs=require('fs');var path=require(_0xb0e6('0x6'));var rimraf=require(_0xb0e6('0x7'));var config=require(_0xb0e6('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xb0e6('0x9')]=function(_0x4ea75d,_0x16cb79){return _0x4ea75d[_0xb0e6('0xa')](_0xb0e6('0xb'),attributes,{'tableName':_0xb0e6('0xc'),'paranoid':![],'indexes':[{'name':_0xb0e6('0xd'),'fields':[_0xb0e6('0xe'),'FieldId'],'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 ddc18c2..42cac29 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 _0xd7f7=['request\x20sent','debug','stringify','error','code','message','info','ServicenowField,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x23d962,_0x413644){var _0x1c4217=function(_0x2d041d){while(--_0x2d041d){_0x23d962['push'](_0x23d962['shift']());}};_0x1c4217(++_0x413644);}(_0xd7f7,0x16f));var _0x7d7f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd7f7[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x7d7f('0x0'));var moment=require(_0x7d7f('0x1'));var BPromise=require(_0x7d7f('0x2'));var rs=require(_0x7d7f('0x3'));var fs=require('fs');var Redis=require(_0x7d7f('0x4'));var db=require(_0x7d7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d7f('0x6'))(_0x7d7f('0x7'));var config=require(_0x7d7f('0x8'));var jayson=require(_0x7d7f('0x9'));var client=jayson[_0x7d7f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5422d8,_0x1aba91,_0x412b58){return new BPromise(function(_0x34e1be,_0x326529){return client['request'](_0x5422d8,_0x412b58)['then'](function(_0x596150){logger['info']('ServicenowField,\x20%s,\x20%s',_0x1aba91,_0x7d7f('0xb'));logger[_0x7d7f('0xc')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x1aba91,'request\x20sent',JSON[_0x7d7f('0xd')](_0x596150));if(_0x596150[_0x7d7f('0xe')]){if(_0x596150['error'][_0x7d7f('0xf')]===0x1f4){logger[_0x7d7f('0xe')]('ServicenowField,\x20%s,\x20%s',_0x1aba91,_0x596150[_0x7d7f('0xe')][_0x7d7f('0x10')]);return _0x326529(_0x596150['error'][_0x7d7f('0x10')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x1aba91,_0x596150[_0x7d7f('0xe')]['message']);return _0x34e1be(_0x596150[_0x7d7f('0xe')][_0x7d7f('0x10')]);}else{logger[_0x7d7f('0x11')](_0x7d7f('0x12'),_0x1aba91,_0x7d7f('0xb'));_0x34e1be(_0x596150[_0x7d7f('0x13')][_0x7d7f('0x10')]);}})[_0x7d7f('0x14')](function(_0x2d92c1){logger[_0x7d7f('0xe')](_0x7d7f('0x12'),_0x1aba91,_0x2d92c1);_0x326529(_0x2d92c1);});});} \ No newline at end of file +var _0x6772=['error','message','result','catch','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d7ff2,_0x1fb820){var _0x24d17a=function(_0x1bbd0d){while(--_0x1bbd0d){_0x4d7ff2['push'](_0x4d7ff2['shift']());}};_0x24d17a(++_0x1fb820);}(_0x6772,0x10e));var _0x2677=function(_0x4d154f,_0x5c6d62){_0x4d154f=_0x4d154f-0x0;var _0x14ce18=_0x6772[_0x4d154f];return _0x14ce18;};'use strict';var _=require(_0x2677('0x0'));var util=require(_0x2677('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2677('0x2'));var logger=require(_0x2677('0x3'))(_0x2677('0x4'));var config=require(_0x2677('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2677('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40a90d,_0x1a4afe,_0x57f69e){return new BPromise(function(_0x250ccd,_0x2d5700){return client[_0x2677('0x7')](_0x40a90d,_0x57f69e)[_0x2677('0x8')](function(_0x6eb4a1){logger[_0x2677('0x9')](_0x2677('0xa'),_0x1a4afe,_0x2677('0xb'));logger[_0x2677('0xc')](_0x2677('0xd'),_0x1a4afe,_0x2677('0xb'),JSON[_0x2677('0xe')](_0x6eb4a1));if(_0x6eb4a1[_0x2677('0xf')]){if(_0x6eb4a1[_0x2677('0xf')]['code']===0x1f4){logger[_0x2677('0xf')](_0x2677('0xa'),_0x1a4afe,_0x6eb4a1[_0x2677('0xf')][_0x2677('0x10')]);return _0x2d5700(_0x6eb4a1[_0x2677('0xf')][_0x2677('0x10')]);}logger[_0x2677('0xf')]('ServicenowField,\x20%s,\x20%s',_0x1a4afe,_0x6eb4a1['error']['message']);return _0x250ccd(_0x6eb4a1[_0x2677('0xf')]['message']);}else{logger[_0x2677('0x9')](_0x2677('0xa'),_0x1a4afe,_0x2677('0xb'));_0x250ccd(_0x6eb4a1[_0x2677('0x11')][_0x2677('0x10')]);}})[_0x2677('0x12')](function(_0x3b289d){logger[_0x2677('0xf')](_0x2677('0xa'),_0x1a4afe,_0x3b289d);_0x2d5700(_0x3b289d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 862d1c1..b38bc5f 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 _0x8192=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x8192,0x82));var _0x2819=function(_0x55faf5,_0x1d4a78){_0x55faf5=_0x55faf5-0x0;var _0x1e9e61=_0x8192[_0x55faf5];return _0x1e9e61;};'use strict';var multer=require(_0x2819('0x0'));var util=require(_0x2819('0x1'));var path=require(_0x2819('0x2'));var timeout=require(_0x2819('0x3'));var express=require(_0x2819('0x4'));var router=express['Router']();var auth=require(_0x2819('0x5'));var interaction=require(_0x2819('0x6'));var config=require(_0x2819('0x7'));var controller=require(_0x2819('0x8'));router[_0x2819('0x9')]('/',auth[_0x2819('0xa')](),controller[_0x2819('0xb')]);router[_0x2819('0x9')]('/:id',auth[_0x2819('0xa')](),controller[_0x2819('0xc')]);router[_0x2819('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2819('0xd')]);router[_0x2819('0x9')](_0x2819('0xe'),auth[_0x2819('0xa')](),controller[_0x2819('0xf')]);router[_0x2819('0x10')]('/',auth[_0x2819('0xa')](),controller[_0x2819('0x11')]);router[_0x2819('0x10')](_0x2819('0x12'),auth[_0x2819('0xa')](),controller[_0x2819('0x13')]);router[_0x2819('0x14')](_0x2819('0x15'),auth[_0x2819('0xa')](),controller[_0x2819('0x16')]);router['delete'](_0x2819('0x15'),auth[_0x2819('0xa')](),controller[_0x2819('0x17')]);module[_0x2819('0x18')]=router; \ No newline at end of file +var _0x1edd=['getFields','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1edd,0xcd));var _0xd1ed=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x1edd[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var path=require(_0xd1ed('0x2'));var timeout=require(_0xd1ed('0x3'));var express=require(_0xd1ed('0x4'));var router=express[_0xd1ed('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd1ed('0x6'));var config=require(_0xd1ed('0x7'));var controller=require('./intSugarcrmAccount.controller');router[_0xd1ed('0x8')]('/',auth[_0xd1ed('0x9')](),controller['index']);router['get'](_0xd1ed('0xa'),auth[_0xd1ed('0x9')](),controller[_0xd1ed('0xb')]);router[_0xd1ed('0x8')](_0xd1ed('0xc'),auth['isAuthenticated'](),controller[_0xd1ed('0xd')]);router[_0xd1ed('0x8')](_0xd1ed('0xe'),auth[_0xd1ed('0x9')](),controller[_0xd1ed('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd1ed('0x10')]);router['post'](_0xd1ed('0xc'),auth['isAuthenticated'](),controller[_0xd1ed('0x11')]);router[_0xd1ed('0x12')]('/:id',auth[_0xd1ed('0x9')](),controller[_0xd1ed('0x13')]);router[_0xd1ed('0x14')](_0xd1ed('0xa'),auth[_0xd1ed('0x9')](),controller[_0xd1ed('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4fcef73..cc61474 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 _0xad8f=['remoteUri','exports','STRING','username'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xad8f,0x14d));var _0xfad8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xad8f[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0xfad8('0x0')]={'name':{'type':Sequelize[_0xfad8('0x1')]},'description':{'type':Sequelize[_0xfad8('0x1')]},'username':{'type':Sequelize[_0xfad8('0x1')],'unique':_0xfad8('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfad8('0x1')],'unique':_0xfad8('0x3')},'serverUrl':{'type':Sequelize[_0xfad8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9dd9=['exports','STRING','remoteUri','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9dd9,0x7b));var _0x99dd=function(_0x19ecee,_0x3fa383){_0x19ecee=_0x19ecee-0x0;var _0x4614c3=_0x9dd9[_0x19ecee];return _0x4614c3;};'use strict';var Sequelize=require(_0x99dd('0x0'));module[_0x99dd('0x1')]={'name':{'type':Sequelize[_0x99dd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x99dd('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x99dd('0x2')]},'remoteUri':{'type':Sequelize[_0x99dd('0x2')],'unique':_0x99dd('0x3')},'serverUrl':{'type':Sequelize[_0x99dd('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 d424820..f83cd4a 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 _0x3baa=['end','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','find','create','body','params','findOne','pick','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status'];(function(_0x1184e6,_0x567817){var _0x52052d=function(_0x178525){while(--_0x178525){_0x1184e6['push'](_0x1184e6['shift']());}};_0x52052d(++_0x567817);}(_0x3baa,0xe9));var _0xa3ba=function(_0x4bcfdf,_0x3c45bd){_0x4bcfdf=_0x4bcfdf-0x0;var _0x2d0a4d=_0x3baa[_0x4bcfdf];return _0x2d0a4d;};'use strict';var pdf=require(_0xa3ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ba('0x1'));var zipdir=require(_0xa3ba('0x2'));var jsonpatch=require(_0xa3ba('0x3'));var rp=require(_0xa3ba('0x4'));var moment=require(_0xa3ba('0x5'));var BPromise=require(_0xa3ba('0x6'));var Mustache=require(_0xa3ba('0x7'));var util=require(_0xa3ba('0x8'));var path=require(_0xa3ba('0x9'));var sox=require(_0xa3ba('0xa'));var csv=require(_0xa3ba('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa3ba('0xc'));var squel=require('squel');var crypto=require(_0xa3ba('0xd'));var jsforce=require(_0xa3ba('0xe'));var deskjs=require(_0xa3ba('0xf'));var toCsv=require(_0xa3ba('0xb'));var querystring=require(_0xa3ba('0x10'));var Papa=require(_0xa3ba('0x11'));var Redis=require(_0xa3ba('0x12'));var authService=require(_0xa3ba('0x13'));var qs=require(_0xa3ba('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ba('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa3ba('0x16'));var licenseUtil=require(_0xa3ba('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa3ba('0x18'));var jayson=require(_0xa3ba('0x19'));var client=jayson[_0xa3ba('0x1a')][_0xa3ba('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4b5821,_0x5a21f0,_0x55d2e6,_0x2b42b6){return new BPromise(function(_0x5c54b9,_0x3998bd){var _0x48caa0=_0x2b42b6||client;return _0x48caa0[_0xa3ba('0x1c')](_0x4b5821,_0x55d2e6)[_0xa3ba('0x1d')](function(_0x834d28){logger['info'](_0xa3ba('0x1e'),_0x5a21f0,_0xa3ba('0x1f'));logger[_0xa3ba('0x20')](_0xa3ba('0x21'),_0x5a21f0,'request\x20sent',JSON[_0xa3ba('0x22')](_0x834d28));if(_0x834d28[_0xa3ba('0x23')]){if(_0x834d28[_0xa3ba('0x23')][_0xa3ba('0x24')]===0x1f4){logger['error'](_0xa3ba('0x1e'),_0x5a21f0,_0x834d28['error'][_0xa3ba('0x25')]);return _0x3998bd(_0x834d28[_0xa3ba('0x23')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5a21f0,_0x834d28[_0xa3ba('0x23')][_0xa3ba('0x25')]);return _0x5c54b9(_0x834d28[_0xa3ba('0x23')][_0xa3ba('0x25')]);}else{logger['info'](_0xa3ba('0x1e'),_0x5a21f0,_0xa3ba('0x1f'));_0x5c54b9(_0x834d28[_0xa3ba('0x26')][_0xa3ba('0x25')]);}})[_0xa3ba('0x27')](function(_0x24dbbf){logger[_0xa3ba('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x5a21f0,_0x24dbbf);_0x3998bd(_0x24dbbf);});});}function respondWithStatusCode(_0x2b559f,_0x36b9da){_0x36b9da=_0x36b9da||0xcc;return function(_0x5cce81){if(_0x5cce81){return _0x2b559f['sendStatus'](_0x36b9da);}return _0x2b559f[_0xa3ba('0x28')](_0x36b9da)[_0xa3ba('0x29')]();};}function respondWithResult(_0x21a8bb,_0x19d49e){_0x19d49e=_0x19d49e||0xc8;return function(_0x4c7870){if(_0x4c7870){return _0x21a8bb[_0xa3ba('0x28')](_0x19d49e)[_0xa3ba('0x2a')](_0x4c7870);}};}function respondWithFilteredResult(_0xf145b0,_0x27377d){return function(_0x2cfe07){if(_0x2cfe07){var _0x314a32=_0x2cfe07[_0xa3ba('0x2b')],_0x57ac06=_0x27377d[_0xa3ba('0x2c')],_0x490eb3=_0x27377d['offset']+_0x27377d['limit'],_0x3244ab;if(_0x490eb3>=_0x314a32){_0x490eb3=_0x314a32;_0x3244ab=0xc8;}else{_0x3244ab=0xce;}_0xf145b0[_0xa3ba('0x28')](_0x3244ab);return _0xf145b0['set'](_0xa3ba('0x2d'),_0x57ac06+'-'+_0x490eb3+'/'+_0x314a32)[_0xa3ba('0x2a')](_0x2cfe07);}return null;};}function patchUpdates(_0x42615a){return function(_0x512563){try{jsonpatch[_0xa3ba('0x2e')](_0x512563,_0x42615a,!![]);}catch(_0x5bda08){return BPromise[_0xa3ba('0x2f')](_0x5bda08);}return _0x512563[_0xa3ba('0x30')]();};}function saveUpdates(_0x52340b,_0x471bae){return function(_0xe635c4){if(_0xe635c4){return _0xe635c4[_0xa3ba('0x31')](_0x52340b)['then'](function(_0x4223c8){return _0x4223c8;});}return null;};}function removeEntity(_0x36116e,_0x59df29){return function(_0x46bb0){if(_0x46bb0){return _0x46bb0[_0xa3ba('0x32')]()[_0xa3ba('0x1d')](function(){_0x36116e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2066ad,_0x4652ec){return function(_0x7a41d0){if(!_0x7a41d0){_0x2066ad[_0xa3ba('0x33')](0x194);}return _0x7a41d0;};}function handleError(_0x1715e3,_0x6431c3){_0x6431c3=_0x6431c3||0x1f4;return function(_0x149223){logger[_0xa3ba('0x23')](_0x149223[_0xa3ba('0x34')]);if(_0x149223['name']){delete _0x149223[_0xa3ba('0x35')];}_0x1715e3[_0xa3ba('0x28')](_0x6431c3)[_0xa3ba('0x36')](_0x149223);};}exports[_0xa3ba('0x37')]=function(_0x5edfab,_0x2e43a0){var _0x53c139={},_0x28f25e={},_0x30ef0d={'count':0x0,'rows':[]};var _0x541151=_[_0xa3ba('0x38')](db['SugarcrmAccount'][_0xa3ba('0x39')],function(_0x2dbbf5){return{'name':_0x2dbbf5[_0xa3ba('0x3a')],'type':_0x2dbbf5[_0xa3ba('0x3b')][_0xa3ba('0x3c')]};});_0x28f25e[_0xa3ba('0x3d')]=_['map'](_0x541151,'name');_0x28f25e[_0xa3ba('0x3e')]=_[_0xa3ba('0x3f')](_0x5edfab['query']);_0x28f25e['filters']=_[_0xa3ba('0x40')](_0x28f25e[_0xa3ba('0x3d')],_0x28f25e[_0xa3ba('0x3e')]);_0x53c139[_0xa3ba('0x41')]=_[_0xa3ba('0x40')](_0x28f25e[_0xa3ba('0x3d')],qs[_0xa3ba('0x42')](_0x5edfab[_0xa3ba('0x3e')][_0xa3ba('0x42')]));_0x53c139[_0xa3ba('0x41')]=_0x53c139[_0xa3ba('0x41')][_0xa3ba('0x43')]?_0x53c139[_0xa3ba('0x41')]:_0x28f25e[_0xa3ba('0x3d')];if(!_0x5edfab['query'][_0xa3ba('0x44')](_0xa3ba('0x45'))){_0x53c139[_0xa3ba('0x46')]=qs[_0xa3ba('0x46')](_0x5edfab[_0xa3ba('0x3e')][_0xa3ba('0x46')]);_0x53c139['offset']=qs[_0xa3ba('0x2c')](_0x5edfab[_0xa3ba('0x3e')][_0xa3ba('0x2c')]);}_0x53c139[_0xa3ba('0x47')]=qs['sort'](_0x5edfab[_0xa3ba('0x3e')][_0xa3ba('0x48')]);_0x53c139[_0xa3ba('0x49')]=qs[_0xa3ba('0x4a')](_['pick'](_0x5edfab[_0xa3ba('0x3e')],_0x28f25e['filters']),_0x541151);if(_0x5edfab[_0xa3ba('0x3e')][_0xa3ba('0x4b')]){_0x53c139[_0xa3ba('0x49')]=_['merge'](_0x53c139[_0xa3ba('0x49')],{'$or':_[_0xa3ba('0x38')](_0x541151,function(_0x341ffc){if(_0x341ffc[_0xa3ba('0x3b')]!==_0xa3ba('0x4c')){var _0x241636={};_0x241636[_0x341ffc[_0xa3ba('0x35')]]={'$like':'%'+_0x5edfab['query'][_0xa3ba('0x4b')]+'%'};return _0x241636;}})});}_0x53c139=_['merge']({},_0x53c139,_0x5edfab[_0xa3ba('0x4d')]);var _0x152d86={'where':_0x53c139[_0xa3ba('0x49')]};return db[_0xa3ba('0x4e')][_0xa3ba('0x2b')](_0x152d86)[_0xa3ba('0x1d')](function(_0x23bbbb){_0x30ef0d[_0xa3ba('0x2b')]=_0x23bbbb;if(_0x5edfab['query'][_0xa3ba('0x4f')]){_0x53c139[_0xa3ba('0x50')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xa3ba('0x51')](_0x53c139);})[_0xa3ba('0x1d')](function(_0x37151d){_0x30ef0d[_0xa3ba('0x52')]=_0x37151d;return _0x30ef0d;})[_0xa3ba('0x1d')](respondWithFilteredResult(_0x2e43a0,_0x53c139))[_0xa3ba('0x27')](handleError(_0x2e43a0,null));};exports[_0xa3ba('0x53')]=function(_0x525278,_0xb6b2f7){var _0x60a99={'raw':![],'where':{'id':_0x525278['params']['id']}},_0x59e14e={};_0x59e14e[_0xa3ba('0x3d')]=_['keys'](db['SugarcrmAccount'][_0xa3ba('0x39')]);_0x59e14e[_0xa3ba('0x3e')]=_[_0xa3ba('0x3f')](_0x525278['query']);_0x59e14e[_0xa3ba('0x4a')]=_[_0xa3ba('0x40')](_0x59e14e[_0xa3ba('0x3d')],_0x59e14e[_0xa3ba('0x3e')]);_0x60a99['attributes']=_['intersection'](_0x59e14e[_0xa3ba('0x3d')],qs[_0xa3ba('0x42')](_0x525278[_0xa3ba('0x3e')][_0xa3ba('0x42')]));_0x60a99['attributes']=_0x60a99[_0xa3ba('0x41')]['length']?_0x60a99[_0xa3ba('0x41')]:_0x59e14e[_0xa3ba('0x3d')];if(_0x525278[_0xa3ba('0x3e')][_0xa3ba('0x4f')]){_0x60a99[_0xa3ba('0x50')]=[{'all':!![]}];}_0x60a99=_['merge']({},_0x60a99,_0x525278[_0xa3ba('0x4d')]);return db[_0xa3ba('0x4e')][_0xa3ba('0x54')](_0x60a99)['then'](handleEntityNotFound(_0xb6b2f7,null))[_0xa3ba('0x1d')](respondWithResult(_0xb6b2f7,null))[_0xa3ba('0x27')](handleError(_0xb6b2f7,null));};exports[_0xa3ba('0x55')]=function(_0x24daa8,_0x2d1e4e){return db[_0xa3ba('0x4e')][_0xa3ba('0x55')](_0x24daa8[_0xa3ba('0x56')],{})['then'](respondWithResult(_0x2d1e4e,0xc9))[_0xa3ba('0x27')](handleError(_0x2d1e4e,null));};exports[_0xa3ba('0x31')]=function(_0x977e69,_0x4f4956){if(_0x977e69[_0xa3ba('0x56')]['id']){delete _0x977e69[_0xa3ba('0x56')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x977e69[_0xa3ba('0x57')]['id']}})[_0xa3ba('0x1d')](handleEntityNotFound(_0x4f4956,null))[_0xa3ba('0x1d')](saveUpdates(_0x977e69['body'],null))[_0xa3ba('0x1d')](respondWithResult(_0x4f4956,null))[_0xa3ba('0x27')](handleError(_0x4f4956,null));};exports[_0xa3ba('0x32')]=function(_0x241eaf,_0x54c245){return db['SugarcrmAccount'][_0xa3ba('0x54')]({'where':{'id':_0x241eaf['params']['id']}})[_0xa3ba('0x1d')](handleEntityNotFound(_0x54c245,null))[_0xa3ba('0x1d')](removeEntity(_0x54c245,null))[_0xa3ba('0x27')](handleError(_0x54c245,null));};exports['getConfigurations']=function(_0x368cda,_0x3b20b2,_0x2f3793){var _0x4f446f={};var _0x3185bb={};var _0x36398c;var _0x1c330d;return db['SugarcrmAccount'][_0xa3ba('0x58')]({'where':{'id':_0x368cda['params']['id']}})[_0xa3ba('0x1d')](handleEntityNotFound(_0x3b20b2,null))[_0xa3ba('0x1d')](function(_0x3fd662){if(_0x3fd662){_0x36398c=_0x3fd662;_0x3185bb[_0xa3ba('0x3d')]=_[_0xa3ba('0x3f')](db['SugarcrmConfiguration']['rawAttributes']);_0x3185bb['query']=_[_0xa3ba('0x3f')](_0x368cda[_0xa3ba('0x3e')]);_0x3185bb['filters']=_[_0xa3ba('0x40')](_0x3185bb[_0xa3ba('0x3d')],_0x3185bb['query']);_0x4f446f['attributes']=_['intersection'](_0x3185bb[_0xa3ba('0x3d')],qs[_0xa3ba('0x42')](_0x368cda[_0xa3ba('0x3e')][_0xa3ba('0x42')]));_0x4f446f['attributes']=_0x4f446f[_0xa3ba('0x41')]['length']?_0x4f446f[_0xa3ba('0x41')]:_0x3185bb[_0xa3ba('0x3d')];_0x4f446f[_0xa3ba('0x47')]=qs[_0xa3ba('0x48')](_0x368cda['query'][_0xa3ba('0x48')]);_0x4f446f[_0xa3ba('0x49')]=qs[_0xa3ba('0x4a')](_[_0xa3ba('0x59')](_0x368cda[_0xa3ba('0x3e')],_0x3185bb[_0xa3ba('0x4a')]));if(_0x368cda[_0xa3ba('0x3e')]['filter']){_0x4f446f[_0xa3ba('0x49')]=_[_0xa3ba('0x5a')](_0x4f446f[_0xa3ba('0x49')],{'$or':_[_0xa3ba('0x38')](_0x4f446f['attributes'],function(_0x392fb6){var _0x30192f={};_0x30192f[_0x392fb6]={'$like':'%'+_0x368cda[_0xa3ba('0x3e')][_0xa3ba('0x4b')]+'%'};return _0x30192f;})});}_0x4f446f=_['merge']({},_0x4f446f,_0x368cda[_0xa3ba('0x4d')]);return _0x36398c[_0xa3ba('0x5b')](_0x4f446f);}})[_0xa3ba('0x1d')](function(_0xfec237){if(_0xfec237){_0x1c330d=_0xfec237['length'];if(!_0x368cda[_0xa3ba('0x3e')][_0xa3ba('0x44')](_0xa3ba('0x45'))){_0x4f446f[_0xa3ba('0x46')]=qs[_0xa3ba('0x46')](_0x368cda[_0xa3ba('0x3e')]['limit']);_0x4f446f[_0xa3ba('0x2c')]=qs[_0xa3ba('0x2c')](_0x368cda[_0xa3ba('0x3e')][_0xa3ba('0x2c')]);}return _0x36398c[_0xa3ba('0x5b')](_0x4f446f);}})[_0xa3ba('0x1d')](function(_0x21c28d){if(_0x21c28d){return _0x21c28d?{'count':_0x1c330d,'rows':_0x21c28d}:null;}})[_0xa3ba('0x1d')](respondWithResult(_0x3b20b2,null))[_0xa3ba('0x27')](handleError(_0x3b20b2,null));};exports[_0xa3ba('0x5c')]=function(_0x4d7774,_0x516671,_0xbaf293){if(_0x4d7774['body']['id']){delete _0x4d7774[_0xa3ba('0x56')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4d7774[_0xa3ba('0x57')]['id']}})[_0xa3ba('0x1d')](handleEntityNotFound(_0x516671,null))['then'](function(_0x797ff2){if(_0x797ff2){_0x4d7774[_0xa3ba('0x56')][_0xa3ba('0x5d')]=_0x797ff2['id'];_0x4d7774[_0xa3ba('0x56')][_0xa3ba('0x5e')]=integrations[_0xa3ba('0x5f')](_0x4d7774['body'][_0xa3ba('0x60')],_0x4d7774[_0xa3ba('0x56')][_0xa3ba('0x3b')]);_0x4d7774[_0xa3ba('0x56')][_0xa3ba('0x61')]=integrations[_0xa3ba('0x62')](_0x4d7774[_0xa3ba('0x56')][_0xa3ba('0x60')],_0x4d7774[_0xa3ba('0x56')]['type']);return db[_0xa3ba('0x63')][_0xa3ba('0x55')](_0x4d7774[_0xa3ba('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0xa3ba('0x5e')},{'model':db[_0xa3ba('0x64')],'as':_0xa3ba('0x61')}]});}return null;})[_0xa3ba('0x1d')](respondWithResult(_0x516671,null))['catch'](handleError(_0x516671,null));};exports[_0xa3ba('0x65')]=function(_0x537cca,_0x1f4c40,_0x494fb7){var _0x3c1379='';var _0x8e2bb6=['id',_0xa3ba('0x35'),_0xa3ba('0x66'),_0xa3ba('0x67'),'description',_0xa3ba('0x68'),'duration_hours',_0xa3ba('0x69'),_0xa3ba('0x6a'),_0xa3ba('0x6b'),_0xa3ba('0x6c'),_0xa3ba('0x6d')];return db[_0xa3ba('0x4e')][_0xa3ba('0x58')]({'where':{'id':_0x537cca[_0xa3ba('0x57')]['id']},'attributes':['id',_0xa3ba('0x6e'),_0xa3ba('0x6f'),_0xa3ba('0x70')]})['then'](handleEntityNotFound(_0x1f4c40,null))[_0xa3ba('0x1d')](function(_0x4f7d6b){if(_0x4f7d6b){_0x3c1379=_0x4f7d6b['remoteUri'];var _0x32e018=_0x3c1379[_0xa3ba('0x71')](-0x1);if(_0x32e018==='/'){_0x3c1379=_0x3c1379[_0xa3ba('0x72')](0x0,_0x3c1379[_0xa3ba('0x73')](_0x32e018));}return rp({'method':_0xa3ba('0x74'),'uri':util[_0xa3ba('0x75')](_0xa3ba('0x76'),_0x3c1379,_0xa3ba('0x77')),'json':!![],'form':{'method':_0xa3ba('0x78'),'input_type':_0xa3ba('0x79'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4f7d6b[_0xa3ba('0x6e')],'password':_0x4f7d6b[_0xa3ba('0x6f')],'encryption':_0xa3ba('0x7a')},'application':_0xa3ba('0x7b')})}});}})[_0xa3ba('0x1d')](function(_0x5c0f35){if(_0x5c0f35&&_0x5c0f35[_0xa3ba('0x35')]!==_0xa3ba('0x7c')&&_0x5c0f35[_0xa3ba('0x35')]!==_0xa3ba('0x7d')){return rp({'method':_0xa3ba('0x74'),'uri':util[_0xa3ba('0x75')]('%s%s',_0x3c1379,_0xa3ba('0x77')),'json':!![],'form':{'method':_0xa3ba('0x7e'),'input_type':_0xa3ba('0x79'),'response_type':'JSON','rest_data':JSON[_0xa3ba('0x22')]({'session':_0x5c0f35['id'],'module_name':_0xa3ba('0x7f')})}})[_0xa3ba('0x1d')](function(_0x3dbda5){if(_0x3dbda5){var _0x1e6e29=_[_0xa3ba('0x80')](_0x3dbda5[_0xa3ba('0x81')]);_['remove'](_0x1e6e29,function(_0x1fd63f){return _0x8e2bb6[_0xa3ba('0x82')](_0x1fd63f[_0xa3ba('0x35')]);});return{'count':_0x1e6e29[_0xa3ba('0x43')],'rows':_[_0xa3ba('0x38')](_0x1e6e29,function(_0x2ed170){return{'id':_0x2ed170[_0xa3ba('0x35')],'name':_0x2ed170[_0xa3ba('0x83')],'custom':_[_0xa3ba('0x84')](_0x2ed170[_0xa3ba('0x35')],'_c')?!![]:![],'options':_0x2ed170['options']?_[_0xa3ba('0x38')](_['values'](_0x2ed170['options']),function(_0x373689){return{'name':_0x373689[_0xa3ba('0x85')],'value':_0x373689[_0xa3ba('0x35')]};}):[]};})};}})[_0xa3ba('0x1d')](respondWithResult(_0x1f4c40,null))[_0xa3ba('0x27')](function(_0xab8005){var _0x1d6e43=_0x537cca[_0xa3ba('0x3e')][_0xa3ba('0x86')]?0x1f4:_0xab8005['statusCode']||0x1f4;logger[_0xa3ba('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xa3ba('0x65'),_0x1d6e43,JSON[_0xa3ba('0x22')](_0xab8005));delete _0xab8005[_0xa3ba('0x35')];if(_0x1d6e43===0x191){_0x1d6e43=0x190;}_0x1f4c40['status'](_0x1d6e43)[_0xa3ba('0x36')](_0x537cca[_0xa3ba('0x3e')][_0xa3ba('0x86')]?{'message':_0xa3ba('0x87'),'statusCode':_0xab8005[_0xa3ba('0x88')]}:_0xab8005);});}else{var _0xcc1cc3=0x1f4;_0x1f4c40[_0xa3ba('0x28')](_0xcc1cc3)[_0xa3ba('0x36')]({'message':_0xa3ba('0x87'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x36bf=['SugarcrmConfiguration','nolimit','AccountId','channel','Descriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','substring','lastIndexOf','POST','format','login','JSON','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','/service/v4_1/rest.php','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','length','find','create','catch','body','getConfigurations','findOne'];(function(_0x44cd4b,_0x5398a7){var _0x1cfbe8=function(_0x35b5a8){while(--_0x35b5a8){_0x44cd4b['push'](_0x44cd4b['shift']());}};_0x1cfbe8(++_0x5398a7);}(_0x36bf,0x19c));var _0xf36b=function(_0x292bc1,_0x5ed2e9){_0x292bc1=_0x292bc1-0x0;var _0x1f8a8e=_0x36bf[_0x292bc1];return _0x1f8a8e;};'use strict';var pdf=require(_0xf36b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf36b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf36b('0x2'));var rp=require('request-promise');var moment=require(_0xf36b('0x3'));var BPromise=require(_0xf36b('0x4'));var Mustache=require(_0xf36b('0x5'));var util=require(_0xf36b('0x6'));var path=require(_0xf36b('0x7'));var sox=require(_0xf36b('0x8'));var csv=require(_0xf36b('0x9'));var ejs=require(_0xf36b('0xa'));var fs=require('fs');var _=require(_0xf36b('0xb'));var squel=require(_0xf36b('0xc'));var crypto=require(_0xf36b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf36b('0xe'));var toCsv=require(_0xf36b('0x9'));var querystring=require(_0xf36b('0xf'));var Papa=require(_0xf36b('0x10'));var Redis=require(_0xf36b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf36b('0x12'));var as=require(_0xf36b('0x13'));var hardwareService=require(_0xf36b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf36b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf36b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xf36b('0x17'));var client=jayson[_0xf36b('0x18')][_0xf36b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xf68bbd,_0x5cf1d6,_0x2fca68,_0x2713bb){return new BPromise(function(_0x4faab9,_0x44c1ff){var _0x42d757=_0x2713bb||client;return _0x42d757[_0xf36b('0x1a')](_0xf68bbd,_0x2fca68)[_0xf36b('0x1b')](function(_0x1dfc41){logger[_0xf36b('0x1c')](_0xf36b('0x1d'),_0x5cf1d6,_0xf36b('0x1e'));logger[_0xf36b('0x1f')](_0xf36b('0x20'),_0x5cf1d6,_0xf36b('0x1e'),JSON[_0xf36b('0x21')](_0x1dfc41));if(_0x1dfc41[_0xf36b('0x22')]){if(_0x1dfc41['error'][_0xf36b('0x23')]===0x1f4){logger[_0xf36b('0x22')](_0xf36b('0x1d'),_0x5cf1d6,_0x1dfc41[_0xf36b('0x22')][_0xf36b('0x24')]);return _0x44c1ff(_0x1dfc41[_0xf36b('0x22')][_0xf36b('0x24')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5cf1d6,_0x1dfc41[_0xf36b('0x22')][_0xf36b('0x24')]);return _0x4faab9(_0x1dfc41['error'][_0xf36b('0x24')]);}else{logger['info'](_0xf36b('0x1d'),_0x5cf1d6,_0xf36b('0x1e'));_0x4faab9(_0x1dfc41[_0xf36b('0x25')][_0xf36b('0x24')]);}})['catch'](function(_0x3974cd){logger[_0xf36b('0x22')](_0xf36b('0x1d'),_0x5cf1d6,_0x3974cd);_0x44c1ff(_0x3974cd);});});}function respondWithStatusCode(_0x40ba73,_0x5a5a89){_0x5a5a89=_0x5a5a89||0xcc;return function(_0x35923b){if(_0x35923b){return _0x40ba73[_0xf36b('0x26')](_0x5a5a89);}return _0x40ba73[_0xf36b('0x27')](_0x5a5a89)[_0xf36b('0x28')]();};}function respondWithResult(_0x1f5aa0,_0x535857){_0x535857=_0x535857||0xc8;return function(_0x445179){if(_0x445179){return _0x1f5aa0[_0xf36b('0x27')](_0x535857)[_0xf36b('0x29')](_0x445179);}};}function respondWithFilteredResult(_0x2637dc,_0x19f65a){return function(_0x1c1067){if(_0x1c1067){var _0x2a6347=_0x1c1067[_0xf36b('0x2a')],_0x259eee=_0x19f65a[_0xf36b('0x2b')],_0x1038f1=_0x19f65a[_0xf36b('0x2b')]+_0x19f65a[_0xf36b('0x2c')],_0x4af678;if(_0x1038f1>=_0x2a6347){_0x1038f1=_0x2a6347;_0x4af678=0xc8;}else{_0x4af678=0xce;}_0x2637dc[_0xf36b('0x27')](_0x4af678);return _0x2637dc[_0xf36b('0x2d')](_0xf36b('0x2e'),_0x259eee+'-'+_0x1038f1+'/'+_0x2a6347)[_0xf36b('0x29')](_0x1c1067);}return null;};}function patchUpdates(_0x543fe7){return function(_0x56d9e1){try{jsonpatch[_0xf36b('0x2f')](_0x56d9e1,_0x543fe7,!![]);}catch(_0x2c6124){return BPromise[_0xf36b('0x30')](_0x2c6124);}return _0x56d9e1[_0xf36b('0x31')]();};}function saveUpdates(_0x478aef,_0x390993){return function(_0x3cc346){if(_0x3cc346){return _0x3cc346[_0xf36b('0x32')](_0x478aef)[_0xf36b('0x1b')](function(_0x3e351e){return _0x3e351e;});}return null;};}function removeEntity(_0x29c9ae,_0x590071){return function(_0x5d5bea){if(_0x5d5bea){return _0x5d5bea[_0xf36b('0x33')]()[_0xf36b('0x1b')](function(){_0x29c9ae[_0xf36b('0x27')](0xcc)[_0xf36b('0x28')]();});}};}function handleEntityNotFound(_0x2f20cf,_0x5e1159){return function(_0x2096eb){if(!_0x2096eb){_0x2f20cf[_0xf36b('0x26')](0x194);}return _0x2096eb;};}function handleError(_0x50f9ee,_0x26b142){_0x26b142=_0x26b142||0x1f4;return function(_0xee70d8){logger[_0xf36b('0x22')](_0xee70d8[_0xf36b('0x34')]);if(_0xee70d8['name']){delete _0xee70d8['name'];}_0x50f9ee[_0xf36b('0x27')](_0x26b142)[_0xf36b('0x35')](_0xee70d8);};}exports[_0xf36b('0x36')]=function(_0x27da9e,_0x1b1fab){var _0x2c5608={},_0x18faf3={},_0x12d168={'count':0x0,'rows':[]};var _0x103f8c=_[_0xf36b('0x37')](db[_0xf36b('0x38')][_0xf36b('0x39')],function(_0x22ed12){return{'name':_0x22ed12[_0xf36b('0x3a')],'type':_0x22ed12[_0xf36b('0x3b')][_0xf36b('0x3c')]};});_0x18faf3[_0xf36b('0x3d')]=_[_0xf36b('0x37')](_0x103f8c,_0xf36b('0x3e'));_0x18faf3[_0xf36b('0x3f')]=_[_0xf36b('0x40')](_0x27da9e[_0xf36b('0x3f')]);_0x18faf3[_0xf36b('0x41')]=_[_0xf36b('0x42')](_0x18faf3[_0xf36b('0x3d')],_0x18faf3[_0xf36b('0x3f')]);_0x2c5608[_0xf36b('0x43')]=_[_0xf36b('0x42')](_0x18faf3[_0xf36b('0x3d')],qs['fields'](_0x27da9e[_0xf36b('0x3f')][_0xf36b('0x44')]));_0x2c5608[_0xf36b('0x43')]=_0x2c5608['attributes']['length']?_0x2c5608[_0xf36b('0x43')]:_0x18faf3[_0xf36b('0x3d')];if(!_0x27da9e['query'][_0xf36b('0x45')]('nolimit')){_0x2c5608[_0xf36b('0x2c')]=qs[_0xf36b('0x2c')](_0x27da9e[_0xf36b('0x3f')][_0xf36b('0x2c')]);_0x2c5608[_0xf36b('0x2b')]=qs[_0xf36b('0x2b')](_0x27da9e['query'][_0xf36b('0x2b')]);}_0x2c5608['order']=qs[_0xf36b('0x46')](_0x27da9e['query']['sort']);_0x2c5608[_0xf36b('0x47')]=qs[_0xf36b('0x41')](_[_0xf36b('0x48')](_0x27da9e[_0xf36b('0x3f')],_0x18faf3[_0xf36b('0x41')]),_0x103f8c);if(_0x27da9e[_0xf36b('0x3f')][_0xf36b('0x49')]){_0x2c5608[_0xf36b('0x47')]=_[_0xf36b('0x4a')](_0x2c5608[_0xf36b('0x47')],{'$or':_['map'](_0x103f8c,function(_0x418c39){if(_0x418c39[_0xf36b('0x3b')]!==_0xf36b('0x4b')){var _0xff8cb4={};_0xff8cb4[_0x418c39[_0xf36b('0x3e')]]={'$like':'%'+_0x27da9e[_0xf36b('0x3f')][_0xf36b('0x49')]+'%'};return _0xff8cb4;}})});}_0x2c5608=_[_0xf36b('0x4a')]({},_0x2c5608,_0x27da9e[_0xf36b('0x4c')]);var _0x122b98={'where':_0x2c5608[_0xf36b('0x47')]};return db['SugarcrmAccount'][_0xf36b('0x2a')](_0x122b98)[_0xf36b('0x1b')](function(_0x3830b5){_0x12d168[_0xf36b('0x2a')]=_0x3830b5;if(_0x27da9e[_0xf36b('0x3f')][_0xf36b('0x4d')]){_0x2c5608['include']=[{'all':!![]}];}return db[_0xf36b('0x38')]['findAll'](_0x2c5608);})[_0xf36b('0x1b')](function(_0x18aa44){_0x12d168[_0xf36b('0x4e')]=_0x18aa44;return _0x12d168;})[_0xf36b('0x1b')](respondWithFilteredResult(_0x1b1fab,_0x2c5608))['catch'](handleError(_0x1b1fab,null));};exports[_0xf36b('0x4f')]=function(_0x5806ed,_0x2b0e6a){var _0x494c51={'raw':![],'where':{'id':_0x5806ed[_0xf36b('0x50')]['id']}},_0x3e839f={};_0x3e839f['model']=_['keys'](db[_0xf36b('0x38')][_0xf36b('0x39')]);_0x3e839f[_0xf36b('0x3f')]=_['keys'](_0x5806ed[_0xf36b('0x3f')]);_0x3e839f[_0xf36b('0x41')]=_[_0xf36b('0x42')](_0x3e839f[_0xf36b('0x3d')],_0x3e839f['query']);_0x494c51[_0xf36b('0x43')]=_['intersection'](_0x3e839f[_0xf36b('0x3d')],qs[_0xf36b('0x44')](_0x5806ed['query']['fields']));_0x494c51['attributes']=_0x494c51[_0xf36b('0x43')][_0xf36b('0x51')]?_0x494c51[_0xf36b('0x43')]:_0x3e839f[_0xf36b('0x3d')];if(_0x5806ed[_0xf36b('0x3f')][_0xf36b('0x4d')]){_0x494c51['include']=[{'all':!![]}];}_0x494c51=_['merge']({},_0x494c51,_0x5806ed[_0xf36b('0x4c')]);return db[_0xf36b('0x38')][_0xf36b('0x52')](_0x494c51)[_0xf36b('0x1b')](handleEntityNotFound(_0x2b0e6a,null))[_0xf36b('0x1b')](respondWithResult(_0x2b0e6a,null))['catch'](handleError(_0x2b0e6a,null));};exports[_0xf36b('0x53')]=function(_0x53f366,_0x3f2ee8){return db[_0xf36b('0x38')]['create'](_0x53f366['body'],{})[_0xf36b('0x1b')](respondWithResult(_0x3f2ee8,0xc9))[_0xf36b('0x54')](handleError(_0x3f2ee8,null));};exports[_0xf36b('0x32')]=function(_0x1fbd65,_0x2ec2c2){if(_0x1fbd65[_0xf36b('0x55')]['id']){delete _0x1fbd65[_0xf36b('0x55')]['id'];}return db[_0xf36b('0x38')]['find']({'where':{'id':_0x1fbd65[_0xf36b('0x50')]['id']}})[_0xf36b('0x1b')](handleEntityNotFound(_0x2ec2c2,null))[_0xf36b('0x1b')](saveUpdates(_0x1fbd65[_0xf36b('0x55')],null))[_0xf36b('0x1b')](respondWithResult(_0x2ec2c2,null))[_0xf36b('0x54')](handleError(_0x2ec2c2,null));};exports[_0xf36b('0x33')]=function(_0x3cbb98,_0x3cb97a){return db[_0xf36b('0x38')][_0xf36b('0x52')]({'where':{'id':_0x3cbb98[_0xf36b('0x50')]['id']}})['then'](handleEntityNotFound(_0x3cb97a,null))[_0xf36b('0x1b')](removeEntity(_0x3cb97a,null))[_0xf36b('0x54')](handleError(_0x3cb97a,null));};exports[_0xf36b('0x56')]=function(_0x35e2ca,_0x5b6fc0,_0x54f26f){var _0x6c116e={};var _0x4d5f97={};var _0x1d7b97;var _0x47fe64;return db[_0xf36b('0x38')][_0xf36b('0x57')]({'where':{'id':_0x35e2ca['params']['id']}})[_0xf36b('0x1b')](handleEntityNotFound(_0x5b6fc0,null))[_0xf36b('0x1b')](function(_0x3759c9){if(_0x3759c9){_0x1d7b97=_0x3759c9;_0x4d5f97[_0xf36b('0x3d')]=_[_0xf36b('0x40')](db[_0xf36b('0x58')][_0xf36b('0x39')]);_0x4d5f97[_0xf36b('0x3f')]=_[_0xf36b('0x40')](_0x35e2ca['query']);_0x4d5f97[_0xf36b('0x41')]=_[_0xf36b('0x42')](_0x4d5f97[_0xf36b('0x3d')],_0x4d5f97[_0xf36b('0x3f')]);_0x6c116e[_0xf36b('0x43')]=_[_0xf36b('0x42')](_0x4d5f97[_0xf36b('0x3d')],qs[_0xf36b('0x44')](_0x35e2ca['query'][_0xf36b('0x44')]));_0x6c116e[_0xf36b('0x43')]=_0x6c116e['attributes']['length']?_0x6c116e[_0xf36b('0x43')]:_0x4d5f97[_0xf36b('0x3d')];_0x6c116e['order']=qs[_0xf36b('0x46')](_0x35e2ca[_0xf36b('0x3f')][_0xf36b('0x46')]);_0x6c116e[_0xf36b('0x47')]=qs[_0xf36b('0x41')](_[_0xf36b('0x48')](_0x35e2ca[_0xf36b('0x3f')],_0x4d5f97[_0xf36b('0x41')]));if(_0x35e2ca[_0xf36b('0x3f')][_0xf36b('0x49')]){_0x6c116e[_0xf36b('0x47')]=_[_0xf36b('0x4a')](_0x6c116e[_0xf36b('0x47')],{'$or':_[_0xf36b('0x37')](_0x6c116e[_0xf36b('0x43')],function(_0xcf9553){var _0x370c65={};_0x370c65[_0xcf9553]={'$like':'%'+_0x35e2ca[_0xf36b('0x3f')][_0xf36b('0x49')]+'%'};return _0x370c65;})});}_0x6c116e=_[_0xf36b('0x4a')]({},_0x6c116e,_0x35e2ca[_0xf36b('0x4c')]);return _0x1d7b97[_0xf36b('0x56')](_0x6c116e);}})[_0xf36b('0x1b')](function(_0x3f1540){if(_0x3f1540){_0x47fe64=_0x3f1540[_0xf36b('0x51')];if(!_0x35e2ca[_0xf36b('0x3f')][_0xf36b('0x45')](_0xf36b('0x59'))){_0x6c116e[_0xf36b('0x2c')]=qs[_0xf36b('0x2c')](_0x35e2ca['query'][_0xf36b('0x2c')]);_0x6c116e[_0xf36b('0x2b')]=qs[_0xf36b('0x2b')](_0x35e2ca[_0xf36b('0x3f')][_0xf36b('0x2b')]);}return _0x1d7b97[_0xf36b('0x56')](_0x6c116e);}})[_0xf36b('0x1b')](function(_0x21c709){if(_0x21c709){return _0x21c709?{'count':_0x47fe64,'rows':_0x21c709}:null;}})[_0xf36b('0x1b')](respondWithResult(_0x5b6fc0,null))[_0xf36b('0x54')](handleError(_0x5b6fc0,null));};exports['addConfiguration']=function(_0x554cc9,_0xe39be3,_0x16302a){if(_0x554cc9[_0xf36b('0x55')]['id']){delete _0x554cc9['body']['id'];}return db['SugarcrmAccount'][_0xf36b('0x57')]({'where':{'id':_0x554cc9[_0xf36b('0x50')]['id']}})[_0xf36b('0x1b')](handleEntityNotFound(_0xe39be3,null))['then'](function(_0x649d1c){if(_0x649d1c){_0x554cc9[_0xf36b('0x55')][_0xf36b('0x5a')]=_0x649d1c['id'];_0x554cc9[_0xf36b('0x55')]['Subjects']=integrations['getSubjects'](_0x554cc9['body'][_0xf36b('0x5b')],_0x554cc9[_0xf36b('0x55')]['type']);_0x554cc9[_0xf36b('0x55')][_0xf36b('0x5c')]=integrations['getDescriptions'](_0x554cc9[_0xf36b('0x55')]['channel'],_0x554cc9['body']['type']);return db[_0xf36b('0x58')]['create'](_0x554cc9[_0xf36b('0x55')],{'include':[{'model':db[_0xf36b('0x5d')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xf36b('0x5c')}]});}return null;})[_0xf36b('0x1b')](respondWithResult(_0xe39be3,null))['catch'](handleError(_0xe39be3,null));};exports[_0xf36b('0x5e')]=function(_0x119ece,_0x1d77cd,_0x4f3493){var _0x58317='';var _0x5dec6c=['id',_0xf36b('0x3e'),'assigned_user_id',_0xf36b('0x5f'),_0xf36b('0x60'),_0xf36b('0x61'),_0xf36b('0x62'),'duration_minutes',_0xf36b('0x63'),'parent_type',_0xf36b('0x64'),_0xf36b('0x65')];return db[_0xf36b('0x38')][_0xf36b('0x57')]({'where':{'id':_0x119ece[_0xf36b('0x50')]['id']},'attributes':['id',_0xf36b('0x66'),'password','remoteUri']})['then'](handleEntityNotFound(_0x1d77cd,null))[_0xf36b('0x1b')](function(_0x83df83){if(_0x83df83){_0x58317=_0x83df83['remoteUri'];var _0x4af72a=_0x58317['slice'](-0x1);if(_0x4af72a==='/'){_0x58317=_0x58317[_0xf36b('0x67')](0x0,_0x58317[_0xf36b('0x68')](_0x4af72a));}return rp({'method':_0xf36b('0x69'),'uri':util[_0xf36b('0x6a')]('%s%s',_0x58317,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf36b('0x6b'),'input_type':'JSON','response_type':_0xf36b('0x6c'),'rest_data':JSON[_0xf36b('0x21')]({'user_auth':{'user_name':_0x83df83['username'],'password':_0x83df83[_0xf36b('0x6d')],'encryption':'PLAIN'},'application':_0xf36b('0x6e')})}});}})[_0xf36b('0x1b')](function(_0x2d9f5f){if(_0x2d9f5f&&_0x2d9f5f[_0xf36b('0x3e')]!==_0xf36b('0x6f')&&_0x2d9f5f[_0xf36b('0x3e')]!==_0xf36b('0x70')){return rp({'method':_0xf36b('0x69'),'uri':util[_0xf36b('0x6a')](_0xf36b('0x71'),_0x58317,_0xf36b('0x72')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xf36b('0x6c'),'rest_data':JSON[_0xf36b('0x21')]({'session':_0x2d9f5f['id'],'module_name':'Calls'})}})[_0xf36b('0x1b')](function(_0x5ee707){if(_0x5ee707){var _0x4d6fca=_[_0xf36b('0x73')](_0x5ee707[_0xf36b('0x74')]);_['remove'](_0x4d6fca,function(_0x282acd){return _0x5dec6c[_0xf36b('0x75')](_0x282acd[_0xf36b('0x3e')]);});return{'count':_0x4d6fca['length'],'rows':_[_0xf36b('0x37')](_0x4d6fca,function(_0x3dfef5){return{'id':_0x3dfef5[_0xf36b('0x3e')],'name':_0x3dfef5[_0xf36b('0x76')],'custom':_[_0xf36b('0x77')](_0x3dfef5[_0xf36b('0x3e')],'_c')?!![]:![],'options':_0x3dfef5[_0xf36b('0x4c')]?_['map'](_[_0xf36b('0x73')](_0x3dfef5[_0xf36b('0x4c')]),function(_0x547a52){return{'name':_0x547a52[_0xf36b('0x78')],'value':_0x547a52[_0xf36b('0x3e')]};}):[]};})};}})[_0xf36b('0x1b')](respondWithResult(_0x1d77cd,null))[_0xf36b('0x54')](function(_0x3d617e){var _0x3d18ec=_0x119ece['query'][_0xf36b('0x79')]?0x1f4:_0x3d617e[_0xf36b('0x7a')]||0x1f4;logger[_0xf36b('0x22')](_0xf36b('0x7b'),_0xf36b('0x5e'),_0x3d18ec,JSON[_0xf36b('0x21')](_0x3d617e));delete _0x3d617e['name'];if(_0x3d18ec===0x191){_0x3d18ec=0x190;}_0x1d77cd[_0xf36b('0x27')](_0x3d18ec)[_0xf36b('0x35')](_0x119ece['query'][_0xf36b('0x79')]?{'message':_0xf36b('0x7c'),'statusCode':_0x3d617e[_0xf36b('0x7a')]}:_0x3d617e);});}else{var _0x5b4c33=0x1f4;_0x1d77cd[_0xf36b('0x27')](_0x5b4c33)[_0xf36b('0x35')]({'message':_0xf36b('0x7c'),'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 782ca74..8730cdc 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 _0xa82a=['api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x4f0bd5,_0x3b4bd1){var _0x2b69da=function(_0x350fa7){while(--_0x350fa7){_0x4f0bd5['push'](_0x4f0bd5['shift']());}};_0x2b69da(++_0x3b4bd1);}(_0xa82a,0xeb));var _0xaa82=function(_0x7b44f2,_0x87682a){_0x7b44f2=_0x7b44f2-0x0;var _0x387529=_0xa82a[_0x7b44f2];return _0x387529;};'use strict';var _=require(_0xaa82('0x0'));var util=require(_0xaa82('0x1'));var logger=require(_0xaa82('0x2'))(_0xaa82('0x3'));var moment=require(_0xaa82('0x4'));var BPromise=require(_0xaa82('0x5'));var rp=require(_0xaa82('0x6'));var fs=require('fs');var path=require(_0xaa82('0x7'));var rimraf=require('rimraf');var config=require(_0xaa82('0x8'));var attributes=require(_0xaa82('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xaa82('0xa')]=function(_0x4342ed,_0x27e776){return _0x4342ed[_0xaa82('0xb')](_0xaa82('0xc'),attributes,{'tableName':_0xaa82('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x058c=['SugarcrmAccount','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','define'];(function(_0x42d291,_0x4d3e85){var _0x1e2e19=function(_0x3f28b4){while(--_0x3f28b4){_0x42d291['push'](_0x42d291['shift']());}};_0x1e2e19(++_0x4d3e85);}(_0x058c,0x169));var _0xc058=function(_0x4113d5,_0x10e120){_0x4113d5=_0x4113d5-0x0;var _0x4cd0f4=_0x058c[_0x4113d5];return _0x4cd0f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc058('0x0'))(_0xc058('0x1'));var moment=require(_0xc058('0x2'));var BPromise=require(_0xc058('0x3'));var rp=require(_0xc058('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc058('0x5'));var attributes=require(_0xc058('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27dd6d,_0x550bc0){return _0x27dd6d[_0xc058('0x7')](_0xc058('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 8a241bb..5e7e2e6 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 _0xbed0=['model','then','debug','ShowSugarcrmAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','map','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbed0,0x91));var _0x0bed=function(_0x16f6dc,_0x552322){_0x16f6dc=_0x16f6dc-0x0;var _0x37ef07=_0xbed0[_0x16f6dc];return _0x37ef07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bed('0x0'));var BPromise=require(_0x0bed('0x1'));var rs=require(_0x0bed('0x2'));var fs=require('fs');var Redis=require(_0x0bed('0x3'));var db=require(_0x0bed('0x4'))['db'];var utils=require(_0x0bed('0x5'));var logger=require(_0x0bed('0x6'))(_0x0bed('0x7'));var config=require(_0x0bed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0bed('0x9')][_0x0bed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a9b9b,_0x3f8e8e,_0x7a7579){return new BPromise(function(_0x27d2b9,_0x5f57c1){return client[_0x0bed('0xb')](_0x3a9b9b,_0x7a7579)['then'](function(_0x50a3bb){logger[_0x0bed('0xc')](_0x0bed('0xd'),_0x3f8e8e,_0x0bed('0xe'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3f8e8e,_0x0bed('0xe'),JSON[_0x0bed('0xf')](_0x50a3bb));if(_0x50a3bb['error']){if(_0x50a3bb[_0x0bed('0x10')][_0x0bed('0x11')]===0x1f4){logger[_0x0bed('0x10')](_0x0bed('0xd'),_0x3f8e8e,_0x50a3bb[_0x0bed('0x10')][_0x0bed('0x12')]);return _0x5f57c1(_0x50a3bb[_0x0bed('0x10')][_0x0bed('0x12')]);}logger['error'](_0x0bed('0xd'),_0x3f8e8e,_0x50a3bb[_0x0bed('0x10')][_0x0bed('0x12')]);return _0x27d2b9(_0x50a3bb[_0x0bed('0x10')][_0x0bed('0x12')]);}else{logger['info'](_0x0bed('0xd'),_0x3f8e8e,_0x0bed('0xe'));_0x27d2b9(_0x50a3bb[_0x0bed('0x13')]['message']);}})[_0x0bed('0x14')](function(_0x2c738b){logger[_0x0bed('0x10')](_0x0bed('0xd'),_0x3f8e8e,_0x2c738b);_0x5f57c1(_0x2c738b);});});}exports[_0x0bed('0x15')]=function(_0x4674a6){var _0xe273c5=this;return new Promise(function(_0x5675dd,_0x191124){return db[_0x0bed('0x16')][_0x0bed('0x17')]({'raw':_0x4674a6[_0x0bed('0x18')]?_0x4674a6[_0x0bed('0x18')][_0x0bed('0x19')]===undefined?!![]:![]:!![],'where':_0x4674a6[_0x0bed('0x18')]?_0x4674a6[_0x0bed('0x18')]['where']||null:null,'attributes':_0x4674a6[_0x0bed('0x18')]?_0x4674a6['options'][_0x0bed('0x1a')]||null:null,'limit':_0x4674a6[_0x0bed('0x18')]?_0x4674a6[_0x0bed('0x18')][_0x0bed('0x1b')]||null:null,'include':_0x4674a6['options']?_0x4674a6[_0x0bed('0x18')]['include']?_[_0x0bed('0x1c')](_0x4674a6['options'][_0x0bed('0x1d')],function(_0x2a64c0){return{'model':db[_0x2a64c0['model']],'as':_0x2a64c0['as'],'attributes':_0x2a64c0[_0x0bed('0x1a')],'include':_0x2a64c0[_0x0bed('0x1d')]?_[_0x0bed('0x1c')](_0x2a64c0['include'],function(_0x42b763){return{'model':db[_0x42b763[_0x0bed('0x1e')]],'as':_0x42b763['as'],'attributes':_0x42b763['attributes'],'include':_0x42b763[_0x0bed('0x1d')]?_[_0x0bed('0x1c')](_0x42b763[_0x0bed('0x1d')],function(_0x3395f0){return{'model':db[_0x3395f0[_0x0bed('0x1e')]],'as':_0x3395f0['as'],'attributes':_0x3395f0[_0x0bed('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0bed('0x1f')](function(_0x4d2057){logger[_0x0bed('0xc')]('GetSugarcrmAccount',_0x4674a6);logger[_0x0bed('0x20')](_0x0bed('0x15'),_0x4674a6,JSON[_0x0bed('0xf')](_0x4d2057));_0x5675dd(_0x4d2057);})[_0x0bed('0x14')](function(_0x27a135){logger[_0x0bed('0x10')](_0x0bed('0x15'),_0x27a135[_0x0bed('0x12')],_0x4674a6);_0x191124(_0xe273c5['error'](0x1f4,_0x27a135[_0x0bed('0x12')]));});});};exports[_0x0bed('0x21')]=function(_0x1edd90){var _0x11aec2=this;return new Promise(function(_0x5b5d30,_0x515184){return db[_0x0bed('0x16')][_0x0bed('0x22')]({'raw':_0x1edd90[_0x0bed('0x18')]?_0x1edd90['options']['raw']===undefined?!![]:![]:!![],'where':_0x1edd90[_0x0bed('0x18')]?_0x1edd90[_0x0bed('0x18')]['where']||null:null,'attributes':_0x1edd90[_0x0bed('0x18')]?_0x1edd90[_0x0bed('0x18')][_0x0bed('0x1a')]||null:null,'include':_0x1edd90['options']?_0x1edd90[_0x0bed('0x18')][_0x0bed('0x1d')]?_['map'](_0x1edd90[_0x0bed('0x18')]['include'],function(_0x415b27){return{'model':db[_0x415b27[_0x0bed('0x1e')]],'as':_0x415b27['as'],'attributes':_0x415b27[_0x0bed('0x1a')],'include':_0x415b27['include']?_[_0x0bed('0x1c')](_0x415b27[_0x0bed('0x1d')],function(_0x5d5662){return{'model':db[_0x5d5662['model']],'as':_0x5d5662['as'],'attributes':_0x5d5662[_0x0bed('0x1a')],'include':_0x5d5662[_0x0bed('0x1d')]?_[_0x0bed('0x1c')](_0x5d5662['include'],function(_0x39d0d8){return{'model':db[_0x39d0d8[_0x0bed('0x1e')]],'as':_0x39d0d8['as'],'attributes':_0x39d0d8[_0x0bed('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0bed('0x1f')](function(_0x1fc9e7){logger[_0x0bed('0xc')]('ShowSugarcrmAccount',_0x1edd90);logger['debug'](_0x0bed('0x21'),_0x1edd90,JSON[_0x0bed('0xf')](_0x1fc9e7));_0x5b5d30(_0x1fc9e7);})[_0x0bed('0x14')](function(_0x4238ee){logger[_0x0bed('0x10')](_0x0bed('0x21'),_0x4238ee[_0x0bed('0x12')],_0x1edd90);_0x515184(_0x11aec2[_0x0bed('0x10')](0x1f4,_0x4238ee[_0x0bed('0x12')]));});});}; \ No newline at end of file +var _0xa2ae=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','options','raw','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find','lodash','moment'];(function(_0x56bda4,_0x5ba818){var _0x3f2edb=function(_0x4c0109){while(--_0x4c0109){_0x56bda4['push'](_0x56bda4['shift']());}};_0x3f2edb(++_0x5ba818);}(_0xa2ae,0x13e));var _0xea2a=function(_0x26447e,_0x2e9c94){_0x26447e=_0x26447e-0x0;var _0x38cc1a=_0xa2ae[_0x26447e];return _0x38cc1a;};'use strict';var _=require(_0xea2a('0x0'));var util=require('util');var moment=require(_0xea2a('0x1'));var BPromise=require(_0xea2a('0x2'));var rs=require(_0xea2a('0x3'));var fs=require('fs');var Redis=require(_0xea2a('0x4'));var db=require(_0xea2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea2a('0x6'));var config=require(_0xea2a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xea2a('0x8')][_0xea2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3069c8,_0x747c7a,_0x38af7f){return new BPromise(function(_0x58fc32,_0x9157be){return client['request'](_0x3069c8,_0x38af7f)[_0xea2a('0xa')](function(_0x5d02a8){logger['info'](_0xea2a('0xb'),_0x747c7a,_0xea2a('0xc'));logger[_0xea2a('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x747c7a,'request\x20sent',JSON[_0xea2a('0xe')](_0x5d02a8));if(_0x5d02a8[_0xea2a('0xf')]){if(_0x5d02a8[_0xea2a('0xf')][_0xea2a('0x10')]===0x1f4){logger['error'](_0xea2a('0xb'),_0x747c7a,_0x5d02a8[_0xea2a('0xf')]['message']);return _0x9157be(_0x5d02a8[_0xea2a('0xf')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x747c7a,_0x5d02a8[_0xea2a('0xf')][_0xea2a('0x11')]);return _0x58fc32(_0x5d02a8[_0xea2a('0xf')][_0xea2a('0x11')]);}else{logger[_0xea2a('0x12')](_0xea2a('0xb'),_0x747c7a,_0xea2a('0xc'));_0x58fc32(_0x5d02a8[_0xea2a('0x13')][_0xea2a('0x11')]);}})[_0xea2a('0x14')](function(_0x4016a3){logger[_0xea2a('0xf')](_0xea2a('0xb'),_0x747c7a,_0x4016a3);_0x9157be(_0x4016a3);});});}exports[_0xea2a('0x15')]=function(_0x2f55c2){var _0x572e69=this;return new Promise(function(_0x5d4440,_0x156585){return db['SugarcrmAccount']['findAll']({'raw':_0x2f55c2[_0xea2a('0x16')]?_0x2f55c2[_0xea2a('0x16')][_0xea2a('0x17')]===undefined?!![]:![]:!![],'where':_0x2f55c2[_0xea2a('0x16')]?_0x2f55c2['options'][_0xea2a('0x18')]||null:null,'attributes':_0x2f55c2[_0xea2a('0x16')]?_0x2f55c2['options'][_0xea2a('0x19')]||null:null,'limit':_0x2f55c2['options']?_0x2f55c2[_0xea2a('0x16')][_0xea2a('0x1a')]||null:null,'include':_0x2f55c2['options']?_0x2f55c2[_0xea2a('0x16')]['include']?_[_0xea2a('0x1b')](_0x2f55c2['options'][_0xea2a('0x1c')],function(_0x3d34f1){return{'model':db[_0x3d34f1[_0xea2a('0x1d')]],'as':_0x3d34f1['as'],'attributes':_0x3d34f1[_0xea2a('0x19')],'include':_0x3d34f1[_0xea2a('0x1c')]?_[_0xea2a('0x1b')](_0x3d34f1[_0xea2a('0x1c')],function(_0x26a349){return{'model':db[_0x26a349[_0xea2a('0x1d')]],'as':_0x26a349['as'],'attributes':_0x26a349[_0xea2a('0x19')],'include':_0x26a349['include']?_['map'](_0x26a349[_0xea2a('0x1c')],function(_0xc528da){return{'model':db[_0xc528da[_0xea2a('0x1d')]],'as':_0xc528da['as'],'attributes':_0xc528da[_0xea2a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xea2a('0xa')](function(_0x5501f4){logger[_0xea2a('0x12')](_0xea2a('0x15'),_0x2f55c2);logger[_0xea2a('0xd')](_0xea2a('0x15'),_0x2f55c2,JSON[_0xea2a('0xe')](_0x5501f4));_0x5d4440(_0x5501f4);})[_0xea2a('0x14')](function(_0xe42a3d){logger[_0xea2a('0xf')](_0xea2a('0x15'),_0xe42a3d[_0xea2a('0x11')],_0x2f55c2);_0x156585(_0x572e69[_0xea2a('0xf')](0x1f4,_0xe42a3d[_0xea2a('0x11')]));});});};exports[_0xea2a('0x1e')]=function(_0x2ad319){var _0x2e89f6=this;return new Promise(function(_0x2eca87,_0x21ea4a){return db['SugarcrmAccount'][_0xea2a('0x1f')]({'raw':_0x2ad319[_0xea2a('0x16')]?_0x2ad319[_0xea2a('0x16')][_0xea2a('0x17')]===undefined?!![]:![]:!![],'where':_0x2ad319[_0xea2a('0x16')]?_0x2ad319[_0xea2a('0x16')][_0xea2a('0x18')]||null:null,'attributes':_0x2ad319[_0xea2a('0x16')]?_0x2ad319[_0xea2a('0x16')][_0xea2a('0x19')]||null:null,'include':_0x2ad319[_0xea2a('0x16')]?_0x2ad319[_0xea2a('0x16')][_0xea2a('0x1c')]?_[_0xea2a('0x1b')](_0x2ad319[_0xea2a('0x16')][_0xea2a('0x1c')],function(_0x69df7c){return{'model':db[_0x69df7c[_0xea2a('0x1d')]],'as':_0x69df7c['as'],'attributes':_0x69df7c[_0xea2a('0x19')],'include':_0x69df7c['include']?_[_0xea2a('0x1b')](_0x69df7c['include'],function(_0x318aac){return{'model':db[_0x318aac[_0xea2a('0x1d')]],'as':_0x318aac['as'],'attributes':_0x318aac['attributes'],'include':_0x318aac[_0xea2a('0x1c')]?_[_0xea2a('0x1b')](_0x318aac[_0xea2a('0x1c')],function(_0x3e0a08){return{'model':db[_0x3e0a08[_0xea2a('0x1d')]],'as':_0x3e0a08['as'],'attributes':_0x3e0a08['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15e2bc){logger[_0xea2a('0x12')](_0xea2a('0x1e'),_0x2ad319);logger[_0xea2a('0xd')](_0xea2a('0x1e'),_0x2ad319,JSON[_0xea2a('0xe')](_0x15e2bc));_0x2eca87(_0x15e2bc);})['catch'](function(_0x14efdb){logger[_0xea2a('0xf')](_0xea2a('0x1e'),_0x14efdb[_0xea2a('0x11')],_0x2ad319);_0x21ea4a(_0x2e89f6[_0xea2a('0xf')](0x1f4,_0x14efdb['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 17fd79c..b21f867 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 _0x89c1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','get','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89c1,0x1f1));var _0x189c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x89c1[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x189c('0x0'));var util=require(_0x189c('0x1'));var path=require(_0x189c('0x2'));var timeout=require(_0x189c('0x3'));var express=require(_0x189c('0x4'));var router=express[_0x189c('0x5')]();var auth=require(_0x189c('0x6'));var interaction=require(_0x189c('0x7'));var config=require(_0x189c('0x8'));var controller=require(_0x189c('0x9'));router['get']('/',auth[_0x189c('0xa')](),controller['index']);router[_0x189c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x189c('0xc')]);router[_0x189c('0xb')]('/:id/fields',auth[_0x189c('0xa')](),controller[_0x189c('0xd')]);router[_0x189c('0xb')](_0x189c('0xe'),auth[_0x189c('0xa')](),controller[_0x189c('0xf')]);router[_0x189c('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x189c('0x10')]);router[_0x189c('0x11')]('/',auth[_0x189c('0xa')](),controller[_0x189c('0x12')]);router[_0x189c('0x13')](_0x189c('0x14'),auth[_0x189c('0xa')](),controller[_0x189c('0x15')]);router[_0x189c('0x16')](_0x189c('0x14'),auth['isAuthenticated'](),controller[_0x189c('0x17')]);module[_0x189c('0x18')]=router; \ No newline at end of file +var _0xe9fd=['/:id/subjects','getSubjects','/:id/descriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xe9fd,0x1c0));var _0xde9f=function(_0x327ba2,_0x1529db){_0x327ba2=_0x327ba2-0x0;var _0x5ccd3f=_0xe9fd[_0x327ba2];return _0x5ccd3f;};'use strict';var multer=require(_0xde9f('0x0'));var util=require(_0xde9f('0x1'));var path=require(_0xde9f('0x2'));var timeout=require(_0xde9f('0x3'));var express=require(_0xde9f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xde9f('0x5'));var config=require(_0xde9f('0x6'));var controller=require(_0xde9f('0x7'));router[_0xde9f('0x8')]('/',auth[_0xde9f('0x9')](),controller[_0xde9f('0xa')]);router[_0xde9f('0x8')](_0xde9f('0xb'),auth[_0xde9f('0x9')](),controller['show']);router[_0xde9f('0x8')](_0xde9f('0xc'),auth[_0xde9f('0x9')](),controller[_0xde9f('0xd')]);router['get'](_0xde9f('0xe'),auth[_0xde9f('0x9')](),controller[_0xde9f('0xf')]);router[_0xde9f('0x8')](_0xde9f('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xde9f('0x9')](),controller[_0xde9f('0x11')]);router[_0xde9f('0x12')](_0xde9f('0xb'),auth['isAuthenticated'](),controller[_0xde9f('0x13')]);router['delete'](_0xde9f('0xb'),auth['isAuthenticated'](),controller[_0xde9f('0x14')]);module[_0xde9f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9cfb2d5..c4fb0ba 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 _0x464c=['STRING','sequelize'];(function(_0x2cc2f7,_0x455045){var _0x3cce9e=function(_0x23a3aa){while(--_0x23a3aa){_0x2cc2f7['push'](_0x2cc2f7['shift']());}};_0x3cce9e(++_0x455045);}(_0x464c,0x181));var _0xc464=function(_0x517aba,_0x4814e5){_0x517aba=_0x517aba-0x0;var _0x246abe=_0x464c[_0x517aba];return _0x246abe;};'use strict';var Sequelize=require(_0xc464('0x0'));module['exports']={'name':{'type':Sequelize[_0xc464('0x1')]},'description':{'type':Sequelize[_0xc464('0x1')]}}; \ No newline at end of file +var _0x6baf=['sequelize','exports'];(function(_0x4f1d02,_0x4a4694){var _0x52fda1=function(_0x4091fe){while(--_0x4091fe){_0x4f1d02['push'](_0x4f1d02['shift']());}};_0x52fda1(++_0x4a4694);}(_0x6baf,0x1c0));var _0xf6ba=function(_0x4874d6,_0x301821){_0x4874d6=_0x4874d6-0x0;var _0x11d15d=_0x6baf[_0x4874d6];return _0x11d15d;};'use strict';var Sequelize=require(_0xf6ba('0x0'));module[_0xf6ba('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index e8205e8..a88a368 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 _0x3903=['body','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create'];(function(_0x44d845,_0x4fef15){var _0x12f48b=function(_0x1bf834){while(--_0x1bf834){_0x44d845['push'](_0x44d845['shift']());}};_0x12f48b(++_0x4fef15);}(_0x3903,0xc1));var _0x3390=function(_0x1b1546,_0x32c441){_0x1b1546=_0x1b1546-0x0;var _0x42382d=_0x3903[_0x1b1546];return _0x42382d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3390('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3390('0x1'));var jsonpatch=require(_0x3390('0x2'));var rp=require(_0x3390('0x3'));var moment=require(_0x3390('0x4'));var BPromise=require(_0x3390('0x5'));var Mustache=require(_0x3390('0x6'));var util=require(_0x3390('0x7'));var path=require(_0x3390('0x8'));var sox=require(_0x3390('0x9'));var csv=require('to-csv');var ejs=require(_0x3390('0xa'));var fs=require('fs');var _=require(_0x3390('0xb'));var squel=require(_0x3390('0xc'));var crypto=require(_0x3390('0xd'));var jsforce=require(_0x3390('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3390('0xf'));var querystring=require('querystring');var Papa=require(_0x3390('0x10'));var Redis=require(_0x3390('0x11'));var authService=require(_0x3390('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3390('0x13'));var hardwareService=require(_0x3390('0x14'));var logger=require(_0x3390('0x15'))(_0x3390('0x16'));var utils=require(_0x3390('0x17'));var config=require(_0x3390('0x18'));var licenseUtil=require(_0x3390('0x19'));var db=require(_0x3390('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3390('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3094ad,_0x5d59e7,_0x36577f,_0x5a1675){return new BPromise(function(_0x2d022e,_0x106c09){var _0x3b0a90=_0x5a1675||client;return _0x3b0a90['request'](_0x3094ad,_0x36577f)['then'](function(_0x4878bf){logger[_0x3390('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d59e7,'request\x20sent');logger[_0x3390('0x1d')](_0x3390('0x1e'),_0x5d59e7,'request\x20sent',JSON['stringify'](_0x4878bf));if(_0x4878bf[_0x3390('0x1f')]){if(_0x4878bf[_0x3390('0x1f')][_0x3390('0x20')]===0x1f4){logger['error'](_0x3390('0x21'),_0x5d59e7,_0x4878bf[_0x3390('0x1f')][_0x3390('0x22')]);return _0x106c09(_0x4878bf[_0x3390('0x1f')][_0x3390('0x22')]);}logger[_0x3390('0x1f')](_0x3390('0x21'),_0x5d59e7,_0x4878bf['error'][_0x3390('0x22')]);return _0x2d022e(_0x4878bf[_0x3390('0x1f')][_0x3390('0x22')]);}else{logger[_0x3390('0x1c')](_0x3390('0x21'),_0x5d59e7,_0x3390('0x23'));_0x2d022e(_0x4878bf[_0x3390('0x24')][_0x3390('0x22')]);}})[_0x3390('0x25')](function(_0x371fce){logger[_0x3390('0x1f')](_0x3390('0x21'),_0x5d59e7,_0x371fce);_0x106c09(_0x371fce);});});}function respondWithStatusCode(_0x44b5c7,_0x2e073e){_0x2e073e=_0x2e073e||0xcc;return function(_0x2e196c){if(_0x2e196c){return _0x44b5c7[_0x3390('0x26')](_0x2e073e);}return _0x44b5c7[_0x3390('0x27')](_0x2e073e)[_0x3390('0x28')]();};}function respondWithResult(_0x409745,_0x4a1700){_0x4a1700=_0x4a1700||0xc8;return function(_0x2183df){if(_0x2183df){return _0x409745['status'](_0x4a1700)[_0x3390('0x29')](_0x2183df);}};}function respondWithFilteredResult(_0x474f86,_0x2a39ec){return function(_0x25ba29){if(_0x25ba29){var _0x346ee5=_0x25ba29[_0x3390('0x2a')],_0x5a3c41=_0x2a39ec[_0x3390('0x2b')],_0x4e968a=_0x2a39ec[_0x3390('0x2b')]+_0x2a39ec[_0x3390('0x2c')],_0x40a2ab;if(_0x4e968a>=_0x346ee5){_0x4e968a=_0x346ee5;_0x40a2ab=0xc8;}else{_0x40a2ab=0xce;}_0x474f86['status'](_0x40a2ab);return _0x474f86[_0x3390('0x2d')](_0x3390('0x2e'),_0x5a3c41+'-'+_0x4e968a+'/'+_0x346ee5)[_0x3390('0x29')](_0x25ba29);}return null;};}function patchUpdates(_0x3ef39d){return function(_0x120bbc){try{jsonpatch[_0x3390('0x2f')](_0x120bbc,_0x3ef39d,!![]);}catch(_0x1697da){return BPromise[_0x3390('0x30')](_0x1697da);}return _0x120bbc[_0x3390('0x31')]();};}function saveUpdates(_0x169c8a,_0xaa7036){return function(_0x3e6f81){if(_0x3e6f81){return _0x3e6f81[_0x3390('0x32')](_0x169c8a)[_0x3390('0x33')](function(_0x4ad665){return _0x4ad665;});}return null;};}function removeEntity(_0x557c71,_0x4d9dac){return function(_0x1bcc0f){if(_0x1bcc0f){return _0x1bcc0f[_0x3390('0x34')]()[_0x3390('0x33')](function(){_0x557c71[_0x3390('0x27')](0xcc)[_0x3390('0x28')]();});}};}function handleEntityNotFound(_0x9bcf9e,_0xa13ff){return function(_0x21da6f){if(!_0x21da6f){_0x9bcf9e['sendStatus'](0x194);}return _0x21da6f;};}function handleError(_0x433583,_0x12d94c){_0x12d94c=_0x12d94c||0x1f4;return function(_0x40b3ba){logger[_0x3390('0x1f')](_0x40b3ba[_0x3390('0x35')]);if(_0x40b3ba[_0x3390('0x36')]){delete _0x40b3ba['name'];}_0x433583[_0x3390('0x27')](_0x12d94c)['send'](_0x40b3ba);};}exports[_0x3390('0x37')]=function(_0x343235,_0x1796bc){var _0x138413={},_0x66b792={},_0x89050c={'count':0x0,'rows':[]};var _0x47f309=_['map'](db[_0x3390('0x38')][_0x3390('0x39')],function(_0x51a7e4){return{'name':_0x51a7e4[_0x3390('0x3a')],'type':_0x51a7e4['type'][_0x3390('0x3b')]};});_0x66b792[_0x3390('0x3c')]=_[_0x3390('0x3d')](_0x47f309,_0x3390('0x36'));_0x66b792['query']=_[_0x3390('0x3e')](_0x343235[_0x3390('0x3f')]);_0x66b792[_0x3390('0x40')]=_[_0x3390('0x41')](_0x66b792[_0x3390('0x3c')],_0x66b792['query']);_0x138413['attributes']=_[_0x3390('0x41')](_0x66b792[_0x3390('0x3c')],qs[_0x3390('0x42')](_0x343235[_0x3390('0x3f')][_0x3390('0x42')]));_0x138413['attributes']=_0x138413[_0x3390('0x43')][_0x3390('0x44')]?_0x138413['attributes']:_0x66b792[_0x3390('0x3c')];if(!_0x343235[_0x3390('0x3f')][_0x3390('0x45')]('nolimit')){_0x138413[_0x3390('0x2c')]=qs['limit'](_0x343235[_0x3390('0x3f')][_0x3390('0x2c')]);_0x138413[_0x3390('0x2b')]=qs[_0x3390('0x2b')](_0x343235[_0x3390('0x3f')]['offset']);}_0x138413[_0x3390('0x46')]=qs[_0x3390('0x47')](_0x343235['query'][_0x3390('0x47')]);_0x138413['where']=qs['filters'](_[_0x3390('0x48')](_0x343235['query'],_0x66b792[_0x3390('0x40')]),_0x47f309);if(_0x343235[_0x3390('0x3f')][_0x3390('0x49')]){_0x138413['where']=_[_0x3390('0x4a')](_0x138413[_0x3390('0x4b')],{'$or':_[_0x3390('0x3d')](_0x47f309,function(_0x29721c){if(_0x29721c[_0x3390('0x4c')]!==_0x3390('0x4d')){var _0x564341={};_0x564341[_0x29721c[_0x3390('0x36')]]={'$like':'%'+_0x343235[_0x3390('0x3f')]['filter']+'%'};return _0x564341;}})});}_0x138413=_[_0x3390('0x4a')]({},_0x138413,_0x343235[_0x3390('0x4e')]);var _0x292431={'where':_0x138413[_0x3390('0x4b')]};return db[_0x3390('0x38')][_0x3390('0x2a')](_0x292431)['then'](function(_0x3f5dfd){_0x89050c[_0x3390('0x2a')]=_0x3f5dfd;if(_0x343235[_0x3390('0x3f')]['includeAll']){_0x138413[_0x3390('0x4f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x3390('0x50')](_0x138413);})[_0x3390('0x33')](function(_0x54d986){_0x89050c[_0x3390('0x51')]=_0x54d986;return _0x89050c;})[_0x3390('0x33')](respondWithFilteredResult(_0x1796bc,_0x138413))['catch'](handleError(_0x1796bc,null));};exports['show']=function(_0x4280bb,_0x49b875){var _0x3bb7f6={'raw':![],'where':{'id':_0x4280bb[_0x3390('0x52')]['id']}},_0x4b2f7e={};_0x4b2f7e[_0x3390('0x3c')]=_['keys'](db[_0x3390('0x38')][_0x3390('0x39')]);_0x4b2f7e[_0x3390('0x3f')]=_[_0x3390('0x3e')](_0x4280bb[_0x3390('0x3f')]);_0x4b2f7e[_0x3390('0x40')]=_[_0x3390('0x41')](_0x4b2f7e[_0x3390('0x3c')],_0x4b2f7e[_0x3390('0x3f')]);_0x3bb7f6[_0x3390('0x43')]=_[_0x3390('0x41')](_0x4b2f7e[_0x3390('0x3c')],qs['fields'](_0x4280bb['query'][_0x3390('0x42')]));_0x3bb7f6['attributes']=_0x3bb7f6['attributes'][_0x3390('0x44')]?_0x3bb7f6['attributes']:_0x4b2f7e[_0x3390('0x3c')];if(_0x4280bb[_0x3390('0x3f')][_0x3390('0x53')]){_0x3bb7f6[_0x3390('0x4f')]=[{'all':!![]}];}_0x3bb7f6=_[_0x3390('0x4a')]({},_0x3bb7f6,_0x4280bb[_0x3390('0x4e')]);return db['SugarcrmConfiguration'][_0x3390('0x54')](_0x3bb7f6)[_0x3390('0x33')](handleEntityNotFound(_0x49b875,null))[_0x3390('0x33')](respondWithResult(_0x49b875,null))[_0x3390('0x25')](handleError(_0x49b875,null));};exports['create']=function(_0x131e0b,_0x36a907){return db[_0x3390('0x38')][_0x3390('0x55')](_0x131e0b['body'],{})[_0x3390('0x33')](respondWithResult(_0x36a907,0xc9))[_0x3390('0x25')](handleError(_0x36a907,null));};exports[_0x3390('0x32')]=function(_0x329633,_0x40ea05){if(_0x329633[_0x3390('0x56')]['id']){delete _0x329633[_0x3390('0x56')]['id'];}return db[_0x3390('0x38')][_0x3390('0x54')]({'where':{'id':_0x329633[_0x3390('0x52')]['id']}})[_0x3390('0x33')](handleEntityNotFound(_0x40ea05,null))['then'](saveUpdates(_0x329633['body'],null))[_0x3390('0x33')](respondWithResult(_0x40ea05,null))[_0x3390('0x25')](handleError(_0x40ea05,null));};exports[_0x3390('0x34')]=function(_0x42a8f5,_0x3092f3){return db['SugarcrmConfiguration'][_0x3390('0x54')]({'where':{'id':_0x42a8f5[_0x3390('0x52')]['id']}})[_0x3390('0x33')](handleEntityNotFound(_0x3092f3,null))[_0x3390('0x33')](removeEntity(_0x3092f3,null))[_0x3390('0x25')](handleError(_0x3092f3,null));};exports[_0x3390('0x57')]=function(_0x408883,_0x4bf185,_0x45aea4){var _0x4ec2b7={};var _0x204664={};var _0xf9dc06;var _0x5269be;return db['SugarcrmConfiguration'][_0x3390('0x58')]({'where':{'id':_0x408883[_0x3390('0x52')]['id']}})[_0x3390('0x33')](handleEntityNotFound(_0x4bf185,null))['then'](function(_0xa691d2){if(_0xa691d2){_0xf9dc06=_0xa691d2;_0x204664[_0x3390('0x3c')]=_[_0x3390('0x3e')](db[_0x3390('0x59')][_0x3390('0x39')]);_0x204664['query']=_[_0x3390('0x3e')](_0x408883['query']);_0x204664['filters']=_[_0x3390('0x41')](_0x204664['model'],_0x204664[_0x3390('0x3f')]);_0x4ec2b7[_0x3390('0x43')]=_[_0x3390('0x41')](_0x204664[_0x3390('0x3c')],qs['fields'](_0x408883[_0x3390('0x3f')][_0x3390('0x42')]));_0x4ec2b7[_0x3390('0x43')]=_0x4ec2b7[_0x3390('0x43')][_0x3390('0x44')]?_0x4ec2b7[_0x3390('0x43')]:_0x204664[_0x3390('0x3c')];_0x4ec2b7[_0x3390('0x46')]=qs[_0x3390('0x47')](_0x408883[_0x3390('0x3f')][_0x3390('0x47')]);_0x4ec2b7[_0x3390('0x4b')]=qs[_0x3390('0x40')](_[_0x3390('0x48')](_0x408883[_0x3390('0x3f')],_0x204664[_0x3390('0x40')]));if(_0x408883[_0x3390('0x3f')][_0x3390('0x49')]){_0x4ec2b7[_0x3390('0x4b')]=_['merge'](_0x4ec2b7[_0x3390('0x4b')],{'$or':_[_0x3390('0x3d')](_0x4ec2b7[_0x3390('0x43')],function(_0x49ec0d){var _0x577603={};_0x577603[_0x49ec0d]={'$like':'%'+_0x408883[_0x3390('0x3f')]['filter']+'%'};return _0x577603;})});}_0x4ec2b7=_[_0x3390('0x4a')]({},_0x4ec2b7,_0x408883[_0x3390('0x4e')]);return _0xf9dc06[_0x3390('0x57')](_0x4ec2b7);}})['then'](function(_0x525ae5){if(_0x525ae5){_0x5269be=_0x525ae5['length'];if(!_0x408883[_0x3390('0x3f')]['hasOwnProperty'](_0x3390('0x5a'))){_0x4ec2b7[_0x3390('0x2c')]=qs['limit'](_0x408883[_0x3390('0x3f')][_0x3390('0x2c')]);_0x4ec2b7[_0x3390('0x2b')]=qs['offset'](_0x408883[_0x3390('0x3f')][_0x3390('0x2b')]);}return _0xf9dc06['getFields'](_0x4ec2b7);}})[_0x3390('0x33')](function(_0x3356cc){if(_0x3356cc){return _0x3356cc?{'count':_0x5269be,'rows':_0x3356cc}:null;}})[_0x3390('0x33')](respondWithResult(_0x4bf185,null))['catch'](handleError(_0x4bf185,null));};exports[_0x3390('0x5b')]=function(_0x2b4ff0,_0x5194a4,_0x53c997){var _0x398bd9={};var _0x263964={};var _0x54c649;var _0x24b264;return db['SugarcrmConfiguration'][_0x3390('0x58')]({'where':{'id':_0x2b4ff0[_0x3390('0x52')]['id']}})[_0x3390('0x33')](handleEntityNotFound(_0x5194a4,null))['then'](function(_0x2af56c){if(_0x2af56c){_0x54c649=_0x2af56c;_0x263964[_0x3390('0x3c')]=_[_0x3390('0x3e')](db[_0x3390('0x59')][_0x3390('0x39')]);_0x263964['query']=_[_0x3390('0x3e')](_0x2b4ff0[_0x3390('0x3f')]);_0x263964[_0x3390('0x40')]=_[_0x3390('0x41')](_0x263964['model'],_0x263964[_0x3390('0x3f')]);_0x398bd9['attributes']=_[_0x3390('0x41')](_0x263964[_0x3390('0x3c')],qs['fields'](_0x2b4ff0[_0x3390('0x3f')][_0x3390('0x42')]));_0x398bd9[_0x3390('0x43')]=_0x398bd9[_0x3390('0x43')][_0x3390('0x44')]?_0x398bd9['attributes']:_0x263964[_0x3390('0x3c')];_0x398bd9[_0x3390('0x46')]=qs[_0x3390('0x47')](_0x2b4ff0[_0x3390('0x3f')][_0x3390('0x47')]);_0x398bd9[_0x3390('0x4b')]=qs['filters'](_[_0x3390('0x48')](_0x2b4ff0[_0x3390('0x3f')],_0x263964['filters']));if(_0x2b4ff0['query'][_0x3390('0x49')]){_0x398bd9[_0x3390('0x4b')]=_[_0x3390('0x4a')](_0x398bd9['where'],{'$or':_[_0x3390('0x3d')](_0x398bd9[_0x3390('0x43')],function(_0x17d605){var _0x49e8ac={};_0x49e8ac[_0x17d605]={'$like':'%'+_0x2b4ff0[_0x3390('0x3f')][_0x3390('0x49')]+'%'};return _0x49e8ac;})});}_0x398bd9=_[_0x3390('0x4a')]({},_0x398bd9,_0x2b4ff0['options']);return _0x54c649[_0x3390('0x5b')](_0x398bd9);}})[_0x3390('0x33')](function(_0x2d4404){if(_0x2d4404){_0x24b264=_0x2d4404[_0x3390('0x44')];if(!_0x2b4ff0[_0x3390('0x3f')][_0x3390('0x45')](_0x3390('0x5a'))){_0x398bd9[_0x3390('0x2c')]=qs['limit'](_0x2b4ff0['query'][_0x3390('0x2c')]);_0x398bd9[_0x3390('0x2b')]=qs[_0x3390('0x2b')](_0x2b4ff0[_0x3390('0x3f')][_0x3390('0x2b')]);}return _0x54c649[_0x3390('0x5b')](_0x398bd9);}})['then'](function(_0x52133a){if(_0x52133a){return _0x52133a?{'count':_0x24b264,'rows':_0x52133a}:null;}})[_0x3390('0x33')](respondWithResult(_0x5194a4,null))[_0x3390('0x25')](handleError(_0x5194a4,null));};exports['getDescriptions']=function(_0x57e352,_0x135eca,_0x2f8101){var _0x4ce276={};var _0x4ad648={};var _0x27bf86;var _0x291570;return db['SugarcrmConfiguration'][_0x3390('0x58')]({'where':{'id':_0x57e352[_0x3390('0x52')]['id']}})['then'](handleEntityNotFound(_0x135eca,null))['then'](function(_0x23bafb){if(_0x23bafb){_0x27bf86=_0x23bafb;_0x4ad648['model']=_['keys'](db[_0x3390('0x59')][_0x3390('0x39')]);_0x4ad648[_0x3390('0x3f')]=_[_0x3390('0x3e')](_0x57e352[_0x3390('0x3f')]);_0x4ad648[_0x3390('0x40')]=_[_0x3390('0x41')](_0x4ad648[_0x3390('0x3c')],_0x4ad648[_0x3390('0x3f')]);_0x4ce276[_0x3390('0x43')]=_[_0x3390('0x41')](_0x4ad648[_0x3390('0x3c')],qs[_0x3390('0x42')](_0x57e352[_0x3390('0x3f')]['fields']));_0x4ce276[_0x3390('0x43')]=_0x4ce276[_0x3390('0x43')][_0x3390('0x44')]?_0x4ce276[_0x3390('0x43')]:_0x4ad648['model'];_0x4ce276[_0x3390('0x46')]=qs['sort'](_0x57e352[_0x3390('0x3f')][_0x3390('0x47')]);_0x4ce276[_0x3390('0x4b')]=qs[_0x3390('0x40')](_['pick'](_0x57e352['query'],_0x4ad648[_0x3390('0x40')]));if(_0x57e352[_0x3390('0x3f')][_0x3390('0x49')]){_0x4ce276[_0x3390('0x4b')]=_[_0x3390('0x4a')](_0x4ce276[_0x3390('0x4b')],{'$or':_['map'](_0x4ce276[_0x3390('0x43')],function(_0x3af6e5){var _0x3f97d0={};_0x3f97d0[_0x3af6e5]={'$like':'%'+_0x57e352[_0x3390('0x3f')][_0x3390('0x49')]+'%'};return _0x3f97d0;})});}_0x4ce276=_['merge']({},_0x4ce276,_0x57e352[_0x3390('0x4e')]);return _0x27bf86[_0x3390('0x5c')](_0x4ce276);}})['then'](function(_0x4b8ee4){if(_0x4b8ee4){_0x291570=_0x4b8ee4[_0x3390('0x44')];if(!_0x57e352[_0x3390('0x3f')]['hasOwnProperty'](_0x3390('0x5a'))){_0x4ce276[_0x3390('0x2c')]=qs['limit'](_0x57e352[_0x3390('0x3f')][_0x3390('0x2c')]);_0x4ce276[_0x3390('0x2b')]=qs[_0x3390('0x2b')](_0x57e352[_0x3390('0x3f')][_0x3390('0x2b')]);}return _0x27bf86[_0x3390('0x5c')](_0x4ce276);}})['then'](function(_0x17a38f){if(_0x17a38f){return _0x17a38f?{'count':_0x291570,'rows':_0x17a38f}:null;}})['then'](respondWithResult(_0x135eca,null))[_0x3390('0x25')](handleError(_0x135eca,null));}; \ No newline at end of file +var _0x89be=['index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','SugarcrmConfiguration','count','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','getFields','pick','nolimit','getSubjects','findOne','SugarcrmField','html-pdf','eml-format','fast-json-patch','request-promise','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','sendStatus','status','end','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0x89be,0x180));var _0xe89b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89be[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xe89b('0x0'));var emlformat=require(_0xe89b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe89b('0x2'));var rp=require(_0xe89b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe89b('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe89b('0x5'));var fs=require('fs');var _=require(_0xe89b('0x6'));var squel=require('squel');var crypto=require(_0xe89b('0x7'));var jsforce=require(_0xe89b('0x8'));var deskjs=require(_0xe89b('0x9'));var toCsv=require(_0xe89b('0xa'));var querystring=require('querystring');var Papa=require(_0xe89b('0xb'));var Redis=require('ioredis');var authService=require(_0xe89b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe89b('0xd'));var hardwareService=require(_0xe89b('0xe'));var logger=require('../../config/logger')(_0xe89b('0xf'));var utils=require(_0xe89b('0x10'));var config=require(_0xe89b('0x11'));var licenseUtil=require(_0xe89b('0x12'));var db=require(_0xe89b('0x13'))['db'];var jayson=require(_0xe89b('0x14'));var client=jayson[_0xe89b('0x15')][_0xe89b('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5db334,_0x124fcc,_0x494ee3,_0x5f06b9){return new BPromise(function(_0x521132,_0x19123a){var _0x16da97=_0x5f06b9||client;return _0x16da97[_0xe89b('0x17')](_0x5db334,_0x494ee3)['then'](function(_0x8fa2e8){logger[_0xe89b('0x18')](_0xe89b('0x19'),_0x124fcc,'request\x20sent');logger[_0xe89b('0x1a')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x124fcc,'request\x20sent',JSON['stringify'](_0x8fa2e8));if(_0x8fa2e8[_0xe89b('0x1b')]){if(_0x8fa2e8[_0xe89b('0x1b')][_0xe89b('0x1c')]===0x1f4){logger['error'](_0xe89b('0x19'),_0x124fcc,_0x8fa2e8[_0xe89b('0x1b')][_0xe89b('0x1d')]);return _0x19123a(_0x8fa2e8[_0xe89b('0x1b')][_0xe89b('0x1d')]);}logger[_0xe89b('0x1b')](_0xe89b('0x19'),_0x124fcc,_0x8fa2e8[_0xe89b('0x1b')][_0xe89b('0x1d')]);return _0x521132(_0x8fa2e8[_0xe89b('0x1b')][_0xe89b('0x1d')]);}else{logger[_0xe89b('0x18')](_0xe89b('0x19'),_0x124fcc,_0xe89b('0x1e'));_0x521132(_0x8fa2e8[_0xe89b('0x1f')][_0xe89b('0x1d')]);}})['catch'](function(_0x1d460b){logger[_0xe89b('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x124fcc,_0x1d460b);_0x19123a(_0x1d460b);});});}function respondWithStatusCode(_0x79c018,_0x7eec5b){_0x7eec5b=_0x7eec5b||0xcc;return function(_0x2d32fa){if(_0x2d32fa){return _0x79c018[_0xe89b('0x20')](_0x7eec5b);}return _0x79c018[_0xe89b('0x21')](_0x7eec5b)[_0xe89b('0x22')]();};}function respondWithResult(_0x4755bf,_0xa527cb){_0xa527cb=_0xa527cb||0xc8;return function(_0x47e99f){if(_0x47e99f){return _0x4755bf[_0xe89b('0x21')](_0xa527cb)['json'](_0x47e99f);}};}function respondWithFilteredResult(_0x3834bc,_0x162902){return function(_0x2a7e69){if(_0x2a7e69){var _0x38b4c2=_0x2a7e69['count'],_0x4e45d1=_0x162902['offset'],_0x136f57=_0x162902[_0xe89b('0x23')]+_0x162902[_0xe89b('0x24')],_0x280308;if(_0x136f57>=_0x38b4c2){_0x136f57=_0x38b4c2;_0x280308=0xc8;}else{_0x280308=0xce;}_0x3834bc[_0xe89b('0x21')](_0x280308);return _0x3834bc['set'](_0xe89b('0x25'),_0x4e45d1+'-'+_0x136f57+'/'+_0x38b4c2)['json'](_0x2a7e69);}return null;};}function patchUpdates(_0x5e2f65){return function(_0x52f725){try{jsonpatch[_0xe89b('0x26')](_0x52f725,_0x5e2f65,!![]);}catch(_0x13aa53){return BPromise['reject'](_0x13aa53);}return _0x52f725[_0xe89b('0x27')]();};}function saveUpdates(_0xad98c2,_0x4890ae){return function(_0x2d73a1){if(_0x2d73a1){return _0x2d73a1[_0xe89b('0x28')](_0xad98c2)[_0xe89b('0x29')](function(_0x16191f){return _0x16191f;});}return null;};}function removeEntity(_0x3d01c6,_0x54c0e6){return function(_0x35f18a){if(_0x35f18a){return _0x35f18a[_0xe89b('0x2a')]()[_0xe89b('0x29')](function(){_0x3d01c6[_0xe89b('0x21')](0xcc)[_0xe89b('0x22')]();});}};}function handleEntityNotFound(_0x45ef4f,_0x499fb3){return function(_0x4f2680){if(!_0x4f2680){_0x45ef4f[_0xe89b('0x20')](0x194);}return _0x4f2680;};}function handleError(_0x59861a,_0x571985){_0x571985=_0x571985||0x1f4;return function(_0x3ad173){logger['error'](_0x3ad173[_0xe89b('0x2b')]);if(_0x3ad173[_0xe89b('0x2c')]){delete _0x3ad173[_0xe89b('0x2c')];}_0x59861a['status'](_0x571985)[_0xe89b('0x2d')](_0x3ad173);};}exports[_0xe89b('0x2e')]=function(_0x2458a2,_0x430e41){var _0x5f5754={},_0x557128={},_0x3ef9f7={'count':0x0,'rows':[]};var _0x1cf832=_[_0xe89b('0x2f')](db['SugarcrmConfiguration'][_0xe89b('0x30')],function(_0x3a4332){return{'name':_0x3a4332[_0xe89b('0x31')],'type':_0x3a4332[_0xe89b('0x32')][_0xe89b('0x33')]};});_0x557128[_0xe89b('0x34')]=_[_0xe89b('0x2f')](_0x1cf832,_0xe89b('0x2c'));_0x557128[_0xe89b('0x35')]=_['keys'](_0x2458a2[_0xe89b('0x35')]);_0x557128[_0xe89b('0x36')]=_[_0xe89b('0x37')](_0x557128[_0xe89b('0x34')],_0x557128[_0xe89b('0x35')]);_0x5f5754[_0xe89b('0x38')]=_[_0xe89b('0x37')](_0x557128[_0xe89b('0x34')],qs[_0xe89b('0x39')](_0x2458a2[_0xe89b('0x35')][_0xe89b('0x39')]));_0x5f5754[_0xe89b('0x38')]=_0x5f5754[_0xe89b('0x38')][_0xe89b('0x3a')]?_0x5f5754['attributes']:_0x557128[_0xe89b('0x34')];if(!_0x2458a2['query'][_0xe89b('0x3b')]('nolimit')){_0x5f5754[_0xe89b('0x24')]=qs[_0xe89b('0x24')](_0x2458a2[_0xe89b('0x35')][_0xe89b('0x24')]);_0x5f5754[_0xe89b('0x23')]=qs[_0xe89b('0x23')](_0x2458a2[_0xe89b('0x35')][_0xe89b('0x23')]);}_0x5f5754[_0xe89b('0x3c')]=qs[_0xe89b('0x3d')](_0x2458a2[_0xe89b('0x35')][_0xe89b('0x3d')]);_0x5f5754['where']=qs[_0xe89b('0x36')](_['pick'](_0x2458a2[_0xe89b('0x35')],_0x557128[_0xe89b('0x36')]),_0x1cf832);if(_0x2458a2[_0xe89b('0x35')]['filter']){_0x5f5754[_0xe89b('0x3e')]=_[_0xe89b('0x3f')](_0x5f5754['where'],{'$or':_[_0xe89b('0x2f')](_0x1cf832,function(_0x503054){if(_0x503054[_0xe89b('0x32')]!==_0xe89b('0x40')){var _0x55e336={};_0x55e336[_0x503054[_0xe89b('0x2c')]]={'$like':'%'+_0x2458a2[_0xe89b('0x35')][_0xe89b('0x41')]+'%'};return _0x55e336;}})});}_0x5f5754=_[_0xe89b('0x3f')]({},_0x5f5754,_0x2458a2['options']);var _0x5c7e12={'where':_0x5f5754[_0xe89b('0x3e')]};return db[_0xe89b('0x42')][_0xe89b('0x43')](_0x5c7e12)[_0xe89b('0x29')](function(_0x475820){_0x3ef9f7[_0xe89b('0x43')]=_0x475820;if(_0x2458a2['query']['includeAll']){_0x5f5754[_0xe89b('0x44')]=[{'all':!![]}];}return db[_0xe89b('0x42')][_0xe89b('0x45')](_0x5f5754);})[_0xe89b('0x29')](function(_0x56b231){_0x3ef9f7[_0xe89b('0x46')]=_0x56b231;return _0x3ef9f7;})[_0xe89b('0x29')](respondWithFilteredResult(_0x430e41,_0x5f5754))[_0xe89b('0x47')](handleError(_0x430e41,null));};exports[_0xe89b('0x48')]=function(_0x32256d,_0x1b0258){var _0x50a45a={'raw':![],'where':{'id':_0x32256d[_0xe89b('0x49')]['id']}},_0x53dc4d={};_0x53dc4d[_0xe89b('0x34')]=_[_0xe89b('0x4a')](db[_0xe89b('0x42')][_0xe89b('0x30')]);_0x53dc4d['query']=_[_0xe89b('0x4a')](_0x32256d[_0xe89b('0x35')]);_0x53dc4d[_0xe89b('0x36')]=_['intersection'](_0x53dc4d[_0xe89b('0x34')],_0x53dc4d['query']);_0x50a45a['attributes']=_['intersection'](_0x53dc4d[_0xe89b('0x34')],qs['fields'](_0x32256d['query']['fields']));_0x50a45a[_0xe89b('0x38')]=_0x50a45a[_0xe89b('0x38')][_0xe89b('0x3a')]?_0x50a45a[_0xe89b('0x38')]:_0x53dc4d['model'];if(_0x32256d[_0xe89b('0x35')][_0xe89b('0x4b')]){_0x50a45a['include']=[{'all':!![]}];}_0x50a45a=_[_0xe89b('0x3f')]({},_0x50a45a,_0x32256d[_0xe89b('0x4c')]);return db[_0xe89b('0x42')]['find'](_0x50a45a)['then'](handleEntityNotFound(_0x1b0258,null))['then'](respondWithResult(_0x1b0258,null))[_0xe89b('0x47')](handleError(_0x1b0258,null));};exports[_0xe89b('0x4d')]=function(_0x59f73c,_0x4a0d65){return db[_0xe89b('0x42')][_0xe89b('0x4d')](_0x59f73c['body'],{})[_0xe89b('0x29')](respondWithResult(_0x4a0d65,0xc9))[_0xe89b('0x47')](handleError(_0x4a0d65,null));};exports[_0xe89b('0x28')]=function(_0x419cfb,_0x1e94f7){if(_0x419cfb[_0xe89b('0x4e')]['id']){delete _0x419cfb[_0xe89b('0x4e')]['id'];}return db[_0xe89b('0x42')][_0xe89b('0x4f')]({'where':{'id':_0x419cfb[_0xe89b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e94f7,null))[_0xe89b('0x29')](saveUpdates(_0x419cfb[_0xe89b('0x4e')],null))[_0xe89b('0x29')](respondWithResult(_0x1e94f7,null))[_0xe89b('0x47')](handleError(_0x1e94f7,null));};exports[_0xe89b('0x2a')]=function(_0x123f21,_0x344065){return db['SugarcrmConfiguration'][_0xe89b('0x4f')]({'where':{'id':_0x123f21[_0xe89b('0x49')]['id']}})[_0xe89b('0x29')](handleEntityNotFound(_0x344065,null))['then'](removeEntity(_0x344065,null))[_0xe89b('0x47')](handleError(_0x344065,null));};exports[_0xe89b('0x50')]=function(_0x10dd57,_0x16998d,_0x21878e){var _0x4ed83d={};var _0x5d3b13={};var _0x39d949;var _0x5e69ca;return db[_0xe89b('0x42')]['findOne']({'where':{'id':_0x10dd57[_0xe89b('0x49')]['id']}})['then'](handleEntityNotFound(_0x16998d,null))[_0xe89b('0x29')](function(_0x42128a){if(_0x42128a){_0x39d949=_0x42128a;_0x5d3b13[_0xe89b('0x34')]=_[_0xe89b('0x4a')](db['SugarcrmField'][_0xe89b('0x30')]);_0x5d3b13[_0xe89b('0x35')]=_['keys'](_0x10dd57[_0xe89b('0x35')]);_0x5d3b13['filters']=_[_0xe89b('0x37')](_0x5d3b13[_0xe89b('0x34')],_0x5d3b13['query']);_0x4ed83d[_0xe89b('0x38')]=_[_0xe89b('0x37')](_0x5d3b13['model'],qs['fields'](_0x10dd57['query'][_0xe89b('0x39')]));_0x4ed83d['attributes']=_0x4ed83d[_0xe89b('0x38')][_0xe89b('0x3a')]?_0x4ed83d[_0xe89b('0x38')]:_0x5d3b13[_0xe89b('0x34')];_0x4ed83d[_0xe89b('0x3c')]=qs[_0xe89b('0x3d')](_0x10dd57[_0xe89b('0x35')][_0xe89b('0x3d')]);_0x4ed83d[_0xe89b('0x3e')]=qs['filters'](_[_0xe89b('0x51')](_0x10dd57[_0xe89b('0x35')],_0x5d3b13[_0xe89b('0x36')]));if(_0x10dd57['query']['filter']){_0x4ed83d['where']=_[_0xe89b('0x3f')](_0x4ed83d[_0xe89b('0x3e')],{'$or':_['map'](_0x4ed83d[_0xe89b('0x38')],function(_0x1fdc43){var _0x1464a7={};_0x1464a7[_0x1fdc43]={'$like':'%'+_0x10dd57[_0xe89b('0x35')][_0xe89b('0x41')]+'%'};return _0x1464a7;})});}_0x4ed83d=_['merge']({},_0x4ed83d,_0x10dd57[_0xe89b('0x4c')]);return _0x39d949[_0xe89b('0x50')](_0x4ed83d);}})[_0xe89b('0x29')](function(_0x311ef7){if(_0x311ef7){_0x5e69ca=_0x311ef7['length'];if(!_0x10dd57['query'][_0xe89b('0x3b')](_0xe89b('0x52'))){_0x4ed83d[_0xe89b('0x24')]=qs[_0xe89b('0x24')](_0x10dd57[_0xe89b('0x35')][_0xe89b('0x24')]);_0x4ed83d[_0xe89b('0x23')]=qs['offset'](_0x10dd57[_0xe89b('0x35')]['offset']);}return _0x39d949[_0xe89b('0x50')](_0x4ed83d);}})[_0xe89b('0x29')](function(_0xf2c500){if(_0xf2c500){return _0xf2c500?{'count':_0x5e69ca,'rows':_0xf2c500}:null;}})[_0xe89b('0x29')](respondWithResult(_0x16998d,null))['catch'](handleError(_0x16998d,null));};exports[_0xe89b('0x53')]=function(_0x31363a,_0x2e26b8,_0x16c8d5){var _0x2c63ad={};var _0x323da7={};var _0x13c85e;var _0x4844ad;return db[_0xe89b('0x42')][_0xe89b('0x54')]({'where':{'id':_0x31363a['params']['id']}})[_0xe89b('0x29')](handleEntityNotFound(_0x2e26b8,null))[_0xe89b('0x29')](function(_0x479782){if(_0x479782){_0x13c85e=_0x479782;_0x323da7[_0xe89b('0x34')]=_[_0xe89b('0x4a')](db[_0xe89b('0x55')][_0xe89b('0x30')]);_0x323da7['query']=_['keys'](_0x31363a[_0xe89b('0x35')]);_0x323da7[_0xe89b('0x36')]=_[_0xe89b('0x37')](_0x323da7['model'],_0x323da7[_0xe89b('0x35')]);_0x2c63ad[_0xe89b('0x38')]=_['intersection'](_0x323da7['model'],qs[_0xe89b('0x39')](_0x31363a[_0xe89b('0x35')][_0xe89b('0x39')]));_0x2c63ad['attributes']=_0x2c63ad[_0xe89b('0x38')][_0xe89b('0x3a')]?_0x2c63ad[_0xe89b('0x38')]:_0x323da7['model'];_0x2c63ad['order']=qs['sort'](_0x31363a[_0xe89b('0x35')][_0xe89b('0x3d')]);_0x2c63ad[_0xe89b('0x3e')]=qs[_0xe89b('0x36')](_[_0xe89b('0x51')](_0x31363a[_0xe89b('0x35')],_0x323da7[_0xe89b('0x36')]));if(_0x31363a[_0xe89b('0x35')]['filter']){_0x2c63ad[_0xe89b('0x3e')]=_['merge'](_0x2c63ad['where'],{'$or':_[_0xe89b('0x2f')](_0x2c63ad['attributes'],function(_0x40690d){var _0x4367fa={};_0x4367fa[_0x40690d]={'$like':'%'+_0x31363a[_0xe89b('0x35')]['filter']+'%'};return _0x4367fa;})});}_0x2c63ad=_[_0xe89b('0x3f')]({},_0x2c63ad,_0x31363a[_0xe89b('0x4c')]);return _0x13c85e[_0xe89b('0x53')](_0x2c63ad);}})[_0xe89b('0x29')](function(_0x48a374){if(_0x48a374){_0x4844ad=_0x48a374['length'];if(!_0x31363a[_0xe89b('0x35')][_0xe89b('0x3b')]('nolimit')){_0x2c63ad[_0xe89b('0x24')]=qs[_0xe89b('0x24')](_0x31363a[_0xe89b('0x35')][_0xe89b('0x24')]);_0x2c63ad['offset']=qs[_0xe89b('0x23')](_0x31363a[_0xe89b('0x35')]['offset']);}return _0x13c85e['getSubjects'](_0x2c63ad);}})['then'](function(_0x5473a3){if(_0x5473a3){return _0x5473a3?{'count':_0x4844ad,'rows':_0x5473a3}:null;}})['then'](respondWithResult(_0x2e26b8,null))[_0xe89b('0x47')](handleError(_0x2e26b8,null));};exports['getDescriptions']=function(_0x296c91,_0x4a8c97,_0x4b3ec2){var _0x334c9c={};var _0x2da568={};var _0x2e4cbe;var _0x3f2d9e;return db[_0xe89b('0x42')]['findOne']({'where':{'id':_0x296c91['params']['id']}})[_0xe89b('0x29')](handleEntityNotFound(_0x4a8c97,null))[_0xe89b('0x29')](function(_0x8a7f36){if(_0x8a7f36){_0x2e4cbe=_0x8a7f36;_0x2da568['model']=_[_0xe89b('0x4a')](db[_0xe89b('0x55')][_0xe89b('0x30')]);_0x2da568[_0xe89b('0x35')]=_['keys'](_0x296c91[_0xe89b('0x35')]);_0x2da568[_0xe89b('0x36')]=_['intersection'](_0x2da568[_0xe89b('0x34')],_0x2da568[_0xe89b('0x35')]);_0x334c9c[_0xe89b('0x38')]=_['intersection'](_0x2da568[_0xe89b('0x34')],qs['fields'](_0x296c91[_0xe89b('0x35')][_0xe89b('0x39')]));_0x334c9c['attributes']=_0x334c9c[_0xe89b('0x38')][_0xe89b('0x3a')]?_0x334c9c[_0xe89b('0x38')]:_0x2da568[_0xe89b('0x34')];_0x334c9c[_0xe89b('0x3c')]=qs['sort'](_0x296c91['query'][_0xe89b('0x3d')]);_0x334c9c['where']=qs['filters'](_[_0xe89b('0x51')](_0x296c91['query'],_0x2da568['filters']));if(_0x296c91[_0xe89b('0x35')]['filter']){_0x334c9c[_0xe89b('0x3e')]=_[_0xe89b('0x3f')](_0x334c9c[_0xe89b('0x3e')],{'$or':_[_0xe89b('0x2f')](_0x334c9c[_0xe89b('0x38')],function(_0x1d350c){var _0x136d3d={};_0x136d3d[_0x1d350c]={'$like':'%'+_0x296c91[_0xe89b('0x35')][_0xe89b('0x41')]+'%'};return _0x136d3d;})});}_0x334c9c=_[_0xe89b('0x3f')]({},_0x334c9c,_0x296c91[_0xe89b('0x4c')]);return _0x2e4cbe['getDescriptions'](_0x334c9c);}})[_0xe89b('0x29')](function(_0x2ce5c7){if(_0x2ce5c7){_0x3f2d9e=_0x2ce5c7[_0xe89b('0x3a')];if(!_0x296c91[_0xe89b('0x35')][_0xe89b('0x3b')](_0xe89b('0x52'))){_0x334c9c[_0xe89b('0x24')]=qs[_0xe89b('0x24')](_0x296c91[_0xe89b('0x35')]['limit']);_0x334c9c[_0xe89b('0x23')]=qs[_0xe89b('0x23')](_0x296c91['query'][_0xe89b('0x23')]);}return _0x2e4cbe['getDescriptions'](_0x334c9c);}})[_0xe89b('0x29')](function(_0x38dd9c){if(_0x38dd9c){return _0x38dd9c?{'count':_0x3f2d9e,'rows':_0x38dd9c}:null;}})[_0xe89b('0x29')](respondWithResult(_0x4a8c97,null))['catch'](handleError(_0x4a8c97,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 333c6f1..7f6405c 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 _0x6f23=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x6f23,0x1cb));var _0x36f2=function(_0x12efdb,_0x16b714){_0x12efdb=_0x12efdb-0x0;var _0x31b7ec=_0x6f23[_0x12efdb];return _0x31b7ec;};'use strict';var _=require(_0x36f2('0x0'));var util=require(_0x36f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x36f2('0x2'));var BPromise=require(_0x36f2('0x3'));var rp=require(_0x36f2('0x4'));var fs=require('fs');var path=require(_0x36f2('0x5'));var rimraf=require(_0x36f2('0x6'));var config=require(_0x36f2('0x7'));var attributes=require(_0x36f2('0x8'));module[_0x36f2('0x9')]=function(_0x25435c,_0x4877e1){return _0x25435c[_0x36f2('0xa')](_0x36f2('0xb'),attributes,{'tableName':_0x36f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf9e=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x4726e8,_0x3047fb){var _0x7c4a4a=function(_0xf1ff82){while(--_0xf1ff82){_0x4726e8['push'](_0x4726e8['shift']());}};_0x7c4a4a(++_0x3047fb);}(_0xaf9e,0x14a));var _0xeaf9=function(_0x3bf41d,_0x27cdc7){_0x3bf41d=_0x3bf41d-0x0;var _0x680b6e=_0xaf9e[_0x3bf41d];return _0x680b6e;};'use strict';var _=require(_0xeaf9('0x0'));var util=require('util');var logger=require(_0xeaf9('0x1'))(_0xeaf9('0x2'));var moment=require(_0xeaf9('0x3'));var BPromise=require('bluebird');var rp=require(_0xeaf9('0x4'));var fs=require('fs');var path=require(_0xeaf9('0x5'));var rimraf=require(_0xeaf9('0x6'));var config=require(_0xeaf9('0x7'));var attributes=require(_0xeaf9('0x8'));module['exports']=function(_0x303bb3,_0x4b4ad4){return _0x303bb3[_0xeaf9('0x9')](_0xeaf9('0xa'),attributes,{'tableName':_0xeaf9('0xb'),'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 16c5f5f..e342ea0 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 _0x9e47=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e47,0xd6));var _0x79e4=function(_0x2c54db,_0x4decb4){_0x2c54db=_0x2c54db-0x0;var _0x40c4e4=_0x9e47[_0x2c54db];return _0x40c4e4;};'use strict';var _=require(_0x79e4('0x0'));var util=require(_0x79e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x79e4('0x2'));var fs=require('fs');var Redis=require(_0x79e4('0x3'));var db=require(_0x79e4('0x4'))['db'];var utils=require(_0x79e4('0x5'));var logger=require(_0x79e4('0x6'))(_0x79e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x79e4('0x8'));var client=jayson[_0x79e4('0x9')][_0x79e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47840c,_0x1fa1e2,_0x366235){return new BPromise(function(_0x490bb3,_0x32e9ec){return client[_0x79e4('0xb')](_0x47840c,_0x366235)[_0x79e4('0xc')](function(_0x231c17){logger[_0x79e4('0xd')](_0x79e4('0xe'),_0x1fa1e2,_0x79e4('0xf'));logger['debug'](_0x79e4('0x10'),_0x1fa1e2,_0x79e4('0xf'),JSON[_0x79e4('0x11')](_0x231c17));if(_0x231c17[_0x79e4('0x12')]){if(_0x231c17[_0x79e4('0x12')][_0x79e4('0x13')]===0x1f4){logger[_0x79e4('0x12')](_0x79e4('0xe'),_0x1fa1e2,_0x231c17['error']['message']);return _0x32e9ec(_0x231c17[_0x79e4('0x12')][_0x79e4('0x14')]);}logger[_0x79e4('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1fa1e2,_0x231c17[_0x79e4('0x12')][_0x79e4('0x14')]);return _0x490bb3(_0x231c17[_0x79e4('0x12')][_0x79e4('0x14')]);}else{logger[_0x79e4('0xd')](_0x79e4('0xe'),_0x1fa1e2,_0x79e4('0xf'));_0x490bb3(_0x231c17['result'][_0x79e4('0x14')]);}})[_0x79e4('0x15')](function(_0x5cdc12){logger[_0x79e4('0x12')](_0x79e4('0xe'),_0x1fa1e2,_0x5cdc12);_0x32e9ec(_0x5cdc12);});});} \ No newline at end of file +var _0xf304=['rpc','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xf304,0x104));var _0x4f30=function(_0x6490c4,_0x2b2190){_0x6490c4=_0x6490c4-0x0;var _0x1cccdc=_0xf304[_0x6490c4];return _0x1cccdc;};'use strict';var _=require(_0x4f30('0x0'));var util=require('util');var moment=require(_0x4f30('0x1'));var BPromise=require(_0x4f30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f30('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f30('0x4'));var logger=require(_0x4f30('0x5'))(_0x4f30('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f30('0x7'));var client=jayson[_0x4f30('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x75fd79,_0x396ae6,_0x45ff53){return new BPromise(function(_0x32ba0b,_0x42a09a){return client['request'](_0x75fd79,_0x45ff53)[_0x4f30('0x9')](function(_0x459636){logger[_0x4f30('0xa')](_0x4f30('0xb'),_0x396ae6,_0x4f30('0xc'));logger[_0x4f30('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x396ae6,_0x4f30('0xc'),JSON[_0x4f30('0xe')](_0x459636));if(_0x459636[_0x4f30('0xf')]){if(_0x459636['error']['code']===0x1f4){logger['error'](_0x4f30('0xb'),_0x396ae6,_0x459636[_0x4f30('0xf')]['message']);return _0x42a09a(_0x459636[_0x4f30('0xf')]['message']);}logger[_0x4f30('0xf')](_0x4f30('0xb'),_0x396ae6,_0x459636['error'][_0x4f30('0x10')]);return _0x32ba0b(_0x459636[_0x4f30('0xf')][_0x4f30('0x10')]);}else{logger[_0x4f30('0xa')](_0x4f30('0xb'),_0x396ae6,_0x4f30('0xc'));_0x32ba0b(_0x459636[_0x4f30('0x11')][_0x4f30('0x10')]);}})[_0x4f30('0x12')](function(_0x5280dc){logger[_0x4f30('0xf')](_0x4f30('0xb'),_0x396ae6,_0x5280dc);_0x42a09a(_0x5280dc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2bdaa1e..5ba0431 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 _0x6efb=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6efb,0x1f0));var _0xb6ef=function(_0x295090,_0x3f7cb3){_0x295090=_0x295090-0x0;var _0xb48186=_0x6efb[_0x295090];return _0xb48186;};'use strict';var multer=require('multer');var util=require(_0xb6ef('0x0'));var path=require(_0xb6ef('0x1'));var timeout=require(_0xb6ef('0x2'));var express=require('express');var router=express[_0xb6ef('0x3')]();var auth=require(_0xb6ef('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb6ef('0x5'));var controller=require('./intSugarcrmField.controller');router[_0xb6ef('0x6')]('/',auth[_0xb6ef('0x7')](),controller['index']);router['get'](_0xb6ef('0x8'),auth[_0xb6ef('0x7')](),controller[_0xb6ef('0x9')]);router[_0xb6ef('0xa')]('/',auth[_0xb6ef('0x7')](),controller['create']);router[_0xb6ef('0xb')](_0xb6ef('0x8'),auth[_0xb6ef('0x7')](),controller['update']);router[_0xb6ef('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb6ef('0xd')]);module[_0xb6ef('0xe')]=router; \ No newline at end of file +var _0x33fc=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x4a80f6,_0x3d43ad){var _0x5bc762=function(_0x1ad68a){while(--_0x1ad68a){_0x4a80f6['push'](_0x4a80f6['shift']());}};_0x5bc762(++_0x3d43ad);}(_0x33fc,0x8e));var _0xc33f=function(_0x558fe9,_0x1ca3f7){_0x558fe9=_0x558fe9-0x0;var _0x554d2a=_0x33fc[_0x558fe9];return _0x554d2a;};'use strict';var multer=require(_0xc33f('0x0'));var util=require('util');var path=require(_0xc33f('0x1'));var timeout=require(_0xc33f('0x2'));var express=require(_0xc33f('0x3'));var router=express[_0xc33f('0x4')]();var auth=require(_0xc33f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc33f('0x6'));var controller=require('./intSugarcrmField.controller');router[_0xc33f('0x7')]('/',auth[_0xc33f('0x8')](),controller['index']);router[_0xc33f('0x7')](_0xc33f('0x9'),auth['isAuthenticated'](),controller[_0xc33f('0xa')]);router['post']('/',auth[_0xc33f('0x8')](),controller[_0xc33f('0xb')]);router[_0xc33f('0xc')](_0xc33f('0x9'),auth['isAuthenticated'](),controller[_0xc33f('0xd')]);router[_0xc33f('0xe')](_0xc33f('0x9'),auth[_0xc33f('0x8')](),controller[_0xc33f('0xf')]);module[_0xc33f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a3b6527..388b967 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 _0x3074=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0x622c0e,_0x541c50){var _0x2e8fa6=function(_0x40d0bf){while(--_0x40d0bf){_0x622c0e['push'](_0x622c0e['shift']());}};_0x2e8fa6(++_0x541c50);}(_0x3074,0x1dd));var _0x4307=function(_0x37df15,_0x173345){_0x37df15=_0x37df15-0x0;var _0x355e0c=_0x3074[_0x37df15];return _0x355e0c;};'use strict';var Sequelize=require(_0x4307('0x0'));module['exports']={'type':{'type':Sequelize[_0x4307('0x1')](_0x4307('0x2'),_0x4307('0x3'),'customVariable',_0x4307('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4307('0x5')]},'key':{'type':Sequelize[_0x4307('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4307('0x2'),_0x4307('0x3'),_0x4307('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4307('0x5')]},'nameField':{'type':Sequelize[_0x4307('0x5')]},'customField':{'type':Sequelize[_0x4307('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4307('0x5')]}}; \ No newline at end of file +var _0x5096=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x23c706,_0x333b21){var _0x1064b2=function(_0x5ea5f8){while(--_0x5ea5f8){_0x23c706['push'](_0x23c706['shift']());}};_0x1064b2(++_0x333b21);}(_0x5096,0x6c));var _0x6509=function(_0x1f2dda,_0x539c5f){_0x1f2dda=_0x1f2dda-0x0;var _0x29b49e=_0x5096[_0x1f2dda];return _0x29b49e;};'use strict';var Sequelize=require(_0x6509('0x0'));module[_0x6509('0x1')]={'type':{'type':Sequelize[_0x6509('0x2')](_0x6509('0x3'),_0x6509('0x4'),'customVariable',_0x6509('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6509('0x6')]},'key':{'type':Sequelize[_0x6509('0x6')]},'keyType':{'type':Sequelize[_0x6509('0x2')](_0x6509('0x3'),_0x6509('0x4'),_0x6509('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6509('0x6')]},'nameField':{'type':Sequelize[_0x6509('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6509('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6d4e7a9..1c8f0de 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 _0x277c=['name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','SugarcrmField','count','include','findAll','rows','show','includeAll','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','apply','update','then','destroy','end','error','stack'];(function(_0x485aaf,_0x2f55a4){var _0x5c655f=function(_0x26efe4){while(--_0x26efe4){_0x485aaf['push'](_0x485aaf['shift']());}};_0x5c655f(++_0x2f55a4);}(_0x277c,0x153));var _0xc277=function(_0x24ccc4,_0x59822a){_0x24ccc4=_0x24ccc4-0x0;var _0x20afb0=_0x277c[_0x24ccc4];return _0x20afb0;};'use strict';var pdf=require(_0xc277('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc277('0x1'));var zipdir=require(_0xc277('0x2'));var jsonpatch=require(_0xc277('0x3'));var rp=require(_0xc277('0x4'));var moment=require(_0xc277('0x5'));var BPromise=require(_0xc277('0x6'));var Mustache=require(_0xc277('0x7'));var util=require(_0xc277('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc277('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc277('0xa'));var squel=require('squel');var crypto=require(_0xc277('0xb'));var jsforce=require(_0xc277('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc277('0x9'));var querystring=require(_0xc277('0xd'));var Papa=require(_0xc277('0xe'));var Redis=require(_0xc277('0xf'));var authService=require(_0xc277('0x10'));var qs=require(_0xc277('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc277('0x12'))(_0xc277('0x13'));var utils=require(_0xc277('0x14'));var config=require(_0xc277('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc277('0x16'))['db'];function respondWithStatusCode(_0x4a7700,_0xb6b933){_0xb6b933=_0xb6b933||0xcc;return function(_0x2bba87){if(_0x2bba87){return _0x4a7700[_0xc277('0x17')](_0xb6b933);}return _0x4a7700[_0xc277('0x18')](_0xb6b933)['end']();};}function respondWithResult(_0x222bc8,_0x182d35){_0x182d35=_0x182d35||0xc8;return function(_0x8895bd){if(_0x8895bd){return _0x222bc8['status'](_0x182d35)['json'](_0x8895bd);}};}function respondWithFilteredResult(_0x178e6d,_0x5c212c){return function(_0x46d20c){if(_0x46d20c){var _0x5d73f8=_0x46d20c['count'],_0x306046=_0x5c212c['offset'],_0x1162b9=_0x5c212c[_0xc277('0x19')]+_0x5c212c['limit'],_0x15f560;if(_0x1162b9>=_0x5d73f8){_0x1162b9=_0x5d73f8;_0x15f560=0xc8;}else{_0x15f560=0xce;}_0x178e6d['status'](_0x15f560);return _0x178e6d[_0xc277('0x1a')](_0xc277('0x1b'),_0x306046+'-'+_0x1162b9+'/'+_0x5d73f8)[_0xc277('0x1c')](_0x46d20c);}return null;};}function patchUpdates(_0x176dfb){return function(_0xe2b7c1){try{jsonpatch[_0xc277('0x1d')](_0xe2b7c1,_0x176dfb,!![]);}catch(_0x391cc3){return BPromise['reject'](_0x391cc3);}return _0xe2b7c1['save']();};}function saveUpdates(_0x697d6f,_0x28900e){return function(_0x2bdc25){if(_0x2bdc25){return _0x2bdc25[_0xc277('0x1e')](_0x697d6f)[_0xc277('0x1f')](function(_0xa3f62e){return _0xa3f62e;});}return null;};}function removeEntity(_0xb4685f,_0x42cb0b){return function(_0x1bc888){if(_0x1bc888){return _0x1bc888[_0xc277('0x20')]()[_0xc277('0x1f')](function(){_0xb4685f['status'](0xcc)[_0xc277('0x21')]();});}};}function handleEntityNotFound(_0x21af1b,_0x54b2e1){return function(_0x463fa6){if(!_0x463fa6){_0x21af1b['sendStatus'](0x194);}return _0x463fa6;};}function handleError(_0x48124d,_0x3292ab){_0x3292ab=_0x3292ab||0x1f4;return function(_0x57b03){logger[_0xc277('0x22')](_0x57b03[_0xc277('0x23')]);if(_0x57b03[_0xc277('0x24')]){delete _0x57b03[_0xc277('0x24')];}_0x48124d[_0xc277('0x18')](_0x3292ab)[_0xc277('0x25')](_0x57b03);};}exports[_0xc277('0x26')]=function(_0x3e04cb,_0x40d17a){var _0x5e480e={},_0x5f3933={},_0x31b6d4={'count':0x0,'rows':[]};var _0x4318f4=_['map'](db['SugarcrmField'][_0xc277('0x27')],function(_0x3bc773){return{'name':_0x3bc773[_0xc277('0x28')],'type':_0x3bc773[_0xc277('0x29')][_0xc277('0x2a')]};});_0x5f3933['model']=_[_0xc277('0x2b')](_0x4318f4,'name');_0x5f3933[_0xc277('0x2c')]=_[_0xc277('0x2d')](_0x3e04cb[_0xc277('0x2c')]);_0x5f3933[_0xc277('0x2e')]=_['intersection'](_0x5f3933[_0xc277('0x2f')],_0x5f3933['query']);_0x5e480e[_0xc277('0x30')]=_[_0xc277('0x31')](_0x5f3933[_0xc277('0x2f')],qs[_0xc277('0x32')](_0x3e04cb['query'][_0xc277('0x32')]));_0x5e480e[_0xc277('0x30')]=_0x5e480e['attributes'][_0xc277('0x33')]?_0x5e480e['attributes']:_0x5f3933[_0xc277('0x2f')];if(!_0x3e04cb[_0xc277('0x2c')][_0xc277('0x34')](_0xc277('0x35'))){_0x5e480e[_0xc277('0x36')]=qs[_0xc277('0x36')](_0x3e04cb[_0xc277('0x2c')][_0xc277('0x36')]);_0x5e480e[_0xc277('0x19')]=qs[_0xc277('0x19')](_0x3e04cb[_0xc277('0x2c')]['offset']);}_0x5e480e[_0xc277('0x37')]=qs[_0xc277('0x38')](_0x3e04cb[_0xc277('0x2c')]['sort']);_0x5e480e[_0xc277('0x39')]=qs[_0xc277('0x2e')](_[_0xc277('0x3a')](_0x3e04cb[_0xc277('0x2c')],_0x5f3933[_0xc277('0x2e')]),_0x4318f4);if(_0x3e04cb['query']['filter']){_0x5e480e[_0xc277('0x39')]=_['merge'](_0x5e480e[_0xc277('0x39')],{'$or':_[_0xc277('0x2b')](_0x4318f4,function(_0x112a89){if(_0x112a89[_0xc277('0x29')]!==_0xc277('0x3b')){var _0x3a2bbd={};_0x3a2bbd[_0x112a89[_0xc277('0x24')]]={'$like':'%'+_0x3e04cb[_0xc277('0x2c')][_0xc277('0x3c')]+'%'};return _0x3a2bbd;}})});}_0x5e480e=_[_0xc277('0x3d')]({},_0x5e480e,_0x3e04cb[_0xc277('0x3e')]);var _0x4eaa6c={'where':_0x5e480e[_0xc277('0x39')]};return db[_0xc277('0x3f')][_0xc277('0x40')](_0x4eaa6c)['then'](function(_0x1dcd88){_0x31b6d4[_0xc277('0x40')]=_0x1dcd88;if(_0x3e04cb['query']['includeAll']){_0x5e480e[_0xc277('0x41')]=[{'all':!![]}];}return db[_0xc277('0x3f')][_0xc277('0x42')](_0x5e480e);})[_0xc277('0x1f')](function(_0x114eec){_0x31b6d4[_0xc277('0x43')]=_0x114eec;return _0x31b6d4;})[_0xc277('0x1f')](respondWithFilteredResult(_0x40d17a,_0x5e480e))['catch'](handleError(_0x40d17a,null));};exports[_0xc277('0x44')]=function(_0x450842,_0x142ca6){var _0x5f4487={'raw':!![],'where':{'id':_0x450842['params']['id']}},_0x4d4c4a={};_0x4d4c4a['model']=_['keys'](db[_0xc277('0x3f')]['rawAttributes']);_0x4d4c4a[_0xc277('0x2c')]=_[_0xc277('0x2d')](_0x450842[_0xc277('0x2c')]);_0x4d4c4a['filters']=_[_0xc277('0x31')](_0x4d4c4a[_0xc277('0x2f')],_0x4d4c4a[_0xc277('0x2c')]);_0x5f4487[_0xc277('0x30')]=_['intersection'](_0x4d4c4a[_0xc277('0x2f')],qs[_0xc277('0x32')](_0x450842['query'][_0xc277('0x32')]));_0x5f4487[_0xc277('0x30')]=_0x5f4487[_0xc277('0x30')][_0xc277('0x33')]?_0x5f4487[_0xc277('0x30')]:_0x4d4c4a[_0xc277('0x2f')];if(_0x450842[_0xc277('0x2c')][_0xc277('0x45')]){_0x5f4487[_0xc277('0x41')]=[{'all':!![]}];}_0x5f4487=_[_0xc277('0x3d')]({},_0x5f4487,_0x450842[_0xc277('0x3e')]);return db['SugarcrmField'][_0xc277('0x46')](_0x5f4487)[_0xc277('0x1f')](handleEntityNotFound(_0x142ca6,null))[_0xc277('0x1f')](respondWithResult(_0x142ca6,null))[_0xc277('0x47')](handleError(_0x142ca6,null));};exports['create']=function(_0x401684,_0x4d7702){return db[_0xc277('0x3f')][_0xc277('0x48')](_0x401684[_0xc277('0x49')],{})[_0xc277('0x1f')](respondWithResult(_0x4d7702,0xc9))[_0xc277('0x47')](handleError(_0x4d7702,null));};exports['update']=function(_0x37fb3f,_0x40868b){if(_0x37fb3f[_0xc277('0x49')]['id']){delete _0x37fb3f[_0xc277('0x49')]['id'];}return db['SugarcrmField'][_0xc277('0x46')]({'where':{'id':_0x37fb3f[_0xc277('0x4a')]['id']}})[_0xc277('0x1f')](handleEntityNotFound(_0x40868b,null))['then'](saveUpdates(_0x37fb3f[_0xc277('0x49')],null))['then'](respondWithResult(_0x40868b,null))[_0xc277('0x47')](handleError(_0x40868b,null));};exports[_0xc277('0x20')]=function(_0x2265d3,_0x2df8dd){return db[_0xc277('0x3f')][_0xc277('0x46')]({'where':{'id':_0x2265d3[_0xc277('0x4a')]['id']}})[_0xc277('0x1f')](handleEntityNotFound(_0x2df8dd,null))[_0xc277('0x1f')](removeEntity(_0x2df8dd,null))[_0xc277('0x47')](handleError(_0x2df8dd,null));}; \ No newline at end of file +var _0xcd59=['where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xcd59,0x14b));var _0x9cd5=function(_0x44faf5,_0x1f0f92){_0x44faf5=_0x44faf5-0x0;var _0x4c0a90=_0xcd59[_0x44faf5];return _0x4c0a90;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require(_0x9cd5('0xb'));var ejs=require(_0x9cd5('0xc'));var fs=require('fs');var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xb'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9cf1,_0x172e29){_0x172e29=_0x172e29||0xcc;return function(_0x44518d){if(_0x44518d){return _0x2c9cf1[_0x9cd5('0x1b')](_0x172e29);}return _0x2c9cf1[_0x9cd5('0x1c')](_0x172e29)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x52698b,_0x15b639){_0x15b639=_0x15b639||0xc8;return function(_0x1445c0){if(_0x1445c0){return _0x52698b[_0x9cd5('0x1c')](_0x15b639)['json'](_0x1445c0);}};}function respondWithFilteredResult(_0x541cb8,_0x5c4f3d){return function(_0x258305){if(_0x258305){var _0x1ea3f7=_0x258305[_0x9cd5('0x1e')],_0x565db7=_0x5c4f3d['offset'],_0x24c233=_0x5c4f3d[_0x9cd5('0x1f')]+_0x5c4f3d[_0x9cd5('0x20')],_0x11a7d2;if(_0x24c233>=_0x1ea3f7){_0x24c233=_0x1ea3f7;_0x11a7d2=0xc8;}else{_0x11a7d2=0xce;}_0x541cb8[_0x9cd5('0x1c')](_0x11a7d2);return _0x541cb8[_0x9cd5('0x21')](_0x9cd5('0x22'),_0x565db7+'-'+_0x24c233+'/'+_0x1ea3f7)[_0x9cd5('0x23')](_0x258305);}return null;};}function patchUpdates(_0x5c1622){return function(_0x37ea13){try{jsonpatch[_0x9cd5('0x24')](_0x37ea13,_0x5c1622,!![]);}catch(_0x3661b0){return BPromise[_0x9cd5('0x25')](_0x3661b0);}return _0x37ea13[_0x9cd5('0x26')]();};}function saveUpdates(_0x4ed8b9,_0x16c4e9){return function(_0x271444){if(_0x271444){return _0x271444[_0x9cd5('0x27')](_0x4ed8b9)[_0x9cd5('0x28')](function(_0x2ce1ae){return _0x2ce1ae;});}return null;};}function removeEntity(_0x1185d7,_0x1cf603){return function(_0x2238ec){if(_0x2238ec){return _0x2238ec[_0x9cd5('0x29')]()['then'](function(){_0x1185d7[_0x9cd5('0x1c')](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0x1a88e3,_0x43f47d){return function(_0x56c05d){if(!_0x56c05d){_0x1a88e3[_0x9cd5('0x1b')](0x194);}return _0x56c05d;};}function handleError(_0x990c25,_0x211576){_0x211576=_0x211576||0x1f4;return function(_0xe36f86){logger[_0x9cd5('0x2a')](_0xe36f86[_0x9cd5('0x2b')]);if(_0xe36f86[_0x9cd5('0x2c')]){delete _0xe36f86['name'];}_0x990c25[_0x9cd5('0x1c')](_0x211576)[_0x9cd5('0x2d')](_0xe36f86);};}exports[_0x9cd5('0x2e')]=function(_0x4af6c8,_0x5c33e9){var _0x2e45a3={},_0x502257={},_0x52ef5d={'count':0x0,'rows':[]};var _0x1ab8d6=_[_0x9cd5('0x2f')](db[_0x9cd5('0x30')]['rawAttributes'],function(_0x40461a){return{'name':_0x40461a[_0x9cd5('0x31')],'type':_0x40461a[_0x9cd5('0x32')][_0x9cd5('0x33')]};});_0x502257[_0x9cd5('0x34')]=_[_0x9cd5('0x2f')](_0x1ab8d6,_0x9cd5('0x2c'));_0x502257[_0x9cd5('0x35')]=_[_0x9cd5('0x36')](_0x4af6c8[_0x9cd5('0x35')]);_0x502257[_0x9cd5('0x37')]=_[_0x9cd5('0x38')](_0x502257[_0x9cd5('0x34')],_0x502257[_0x9cd5('0x35')]);_0x2e45a3['attributes']=_[_0x9cd5('0x38')](_0x502257[_0x9cd5('0x34')],qs['fields'](_0x4af6c8['query'][_0x9cd5('0x39')]));_0x2e45a3[_0x9cd5('0x3a')]=_0x2e45a3['attributes'][_0x9cd5('0x3b')]?_0x2e45a3['attributes']:_0x502257['model'];if(!_0x4af6c8[_0x9cd5('0x35')][_0x9cd5('0x3c')](_0x9cd5('0x3d'))){_0x2e45a3[_0x9cd5('0x20')]=qs['limit'](_0x4af6c8[_0x9cd5('0x35')][_0x9cd5('0x20')]);_0x2e45a3[_0x9cd5('0x1f')]=qs['offset'](_0x4af6c8[_0x9cd5('0x35')][_0x9cd5('0x1f')]);}_0x2e45a3[_0x9cd5('0x3e')]=qs[_0x9cd5('0x3f')](_0x4af6c8[_0x9cd5('0x35')][_0x9cd5('0x3f')]);_0x2e45a3[_0x9cd5('0x40')]=qs[_0x9cd5('0x37')](_[_0x9cd5('0x41')](_0x4af6c8[_0x9cd5('0x35')],_0x502257[_0x9cd5('0x37')]),_0x1ab8d6);if(_0x4af6c8['query'][_0x9cd5('0x42')]){_0x2e45a3['where']=_['merge'](_0x2e45a3[_0x9cd5('0x40')],{'$or':_[_0x9cd5('0x2f')](_0x1ab8d6,function(_0x46b974){if(_0x46b974[_0x9cd5('0x32')]!=='VIRTUAL'){var _0x3972ec={};_0x3972ec[_0x46b974[_0x9cd5('0x2c')]]={'$like':'%'+_0x4af6c8[_0x9cd5('0x35')][_0x9cd5('0x42')]+'%'};return _0x3972ec;}})});}_0x2e45a3=_['merge']({},_0x2e45a3,_0x4af6c8[_0x9cd5('0x43')]);var _0x3f50de={'where':_0x2e45a3[_0x9cd5('0x40')]};return db[_0x9cd5('0x30')][_0x9cd5('0x1e')](_0x3f50de)[_0x9cd5('0x28')](function(_0x4a446c){_0x52ef5d[_0x9cd5('0x1e')]=_0x4a446c;if(_0x4af6c8[_0x9cd5('0x35')][_0x9cd5('0x44')]){_0x2e45a3[_0x9cd5('0x45')]=[{'all':!![]}];}return db[_0x9cd5('0x30')][_0x9cd5('0x46')](_0x2e45a3);})[_0x9cd5('0x28')](function(_0x1ee8a4){_0x52ef5d[_0x9cd5('0x47')]=_0x1ee8a4;return _0x52ef5d;})[_0x9cd5('0x28')](respondWithFilteredResult(_0x5c33e9,_0x2e45a3))[_0x9cd5('0x48')](handleError(_0x5c33e9,null));};exports[_0x9cd5('0x49')]=function(_0x7ad8ec,_0xa12319){var _0x3b316b={'raw':!![],'where':{'id':_0x7ad8ec[_0x9cd5('0x4a')]['id']}},_0x1c84a4={};_0x1c84a4[_0x9cd5('0x34')]=_['keys'](db[_0x9cd5('0x30')]['rawAttributes']);_0x1c84a4[_0x9cd5('0x35')]=_[_0x9cd5('0x36')](_0x7ad8ec[_0x9cd5('0x35')]);_0x1c84a4[_0x9cd5('0x37')]=_[_0x9cd5('0x38')](_0x1c84a4['model'],_0x1c84a4[_0x9cd5('0x35')]);_0x3b316b[_0x9cd5('0x3a')]=_[_0x9cd5('0x38')](_0x1c84a4['model'],qs[_0x9cd5('0x39')](_0x7ad8ec[_0x9cd5('0x35')][_0x9cd5('0x39')]));_0x3b316b[_0x9cd5('0x3a')]=_0x3b316b['attributes'][_0x9cd5('0x3b')]?_0x3b316b[_0x9cd5('0x3a')]:_0x1c84a4[_0x9cd5('0x34')];if(_0x7ad8ec[_0x9cd5('0x35')][_0x9cd5('0x44')]){_0x3b316b[_0x9cd5('0x45')]=[{'all':!![]}];}_0x3b316b=_[_0x9cd5('0x4b')]({},_0x3b316b,_0x7ad8ec[_0x9cd5('0x43')]);return db[_0x9cd5('0x30')][_0x9cd5('0x4c')](_0x3b316b)[_0x9cd5('0x28')](handleEntityNotFound(_0xa12319,null))[_0x9cd5('0x28')](respondWithResult(_0xa12319,null))[_0x9cd5('0x48')](handleError(_0xa12319,null));};exports[_0x9cd5('0x4d')]=function(_0x245f9e,_0xc1631b){return db[_0x9cd5('0x30')][_0x9cd5('0x4d')](_0x245f9e['body'],{})[_0x9cd5('0x28')](respondWithResult(_0xc1631b,0xc9))[_0x9cd5('0x48')](handleError(_0xc1631b,null));};exports[_0x9cd5('0x27')]=function(_0x2058a6,_0x5ae3a4){if(_0x2058a6[_0x9cd5('0x4e')]['id']){delete _0x2058a6[_0x9cd5('0x4e')]['id'];}return db['SugarcrmField'][_0x9cd5('0x4c')]({'where':{'id':_0x2058a6[_0x9cd5('0x4a')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x5ae3a4,null))[_0x9cd5('0x28')](saveUpdates(_0x2058a6[_0x9cd5('0x4e')],null))[_0x9cd5('0x28')](respondWithResult(_0x5ae3a4,null))[_0x9cd5('0x48')](handleError(_0x5ae3a4,null));};exports[_0x9cd5('0x29')]=function(_0x5b6c7d,_0x48be3a){return db[_0x9cd5('0x30')][_0x9cd5('0x4c')]({'where':{'id':_0x5b6c7d[_0x9cd5('0x4a')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x48be3a,null))['then'](removeEntity(_0x48be3a,null))[_0x9cd5('0x48')](handleError(_0x48be3a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4540d0e..37001d0 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 _0x6d33=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x5bf614,_0x26f2aa){var _0x1a50af=function(_0x4a1400){while(--_0x4a1400){_0x5bf614['push'](_0x5bf614['shift']());}};_0x1a50af(++_0x26f2aa);}(_0x6d33,0x6d));var _0x36d3=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x6d33[_0x271060];return _0x40540b;};'use strict';var _=require(_0x36d3('0x0'));var util=require(_0x36d3('0x1'));var logger=require(_0x36d3('0x2'))(_0x36d3('0x3'));var moment=require('moment');var BPromise=require(_0x36d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36d3('0x5'));var rimraf=require(_0x36d3('0x6'));var config=require(_0x36d3('0x7'));var attributes=require(_0x36d3('0x8'));module[_0x36d3('0x9')]=function(_0x59ec4e,_0x27f13d){return _0x59ec4e[_0x36d3('0xa')](_0x36d3('0xb'),attributes,{'tableName':_0x36d3('0xc'),'paranoid':![],'indexes':[{'name':_0x36d3('0xd'),'fields':['idField',_0x36d3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SugarcrmField','sugarcrm_unique_index','idField','lodash','util','../../config/logger'];(function(_0x25da40,_0x309607){var _0x1f139f=function(_0xb5c2be){while(--_0xb5c2be){_0x25da40['push'](_0x25da40['shift']());}};_0x1f139f(++_0x309607);}(_0xfbc0,0x6d));var _0x0fbc=function(_0x52aa4d,_0x32b334){_0x52aa4d=_0x52aa4d-0x0;var _0xb1f6ce=_0xfbc0[_0x52aa4d];return _0xb1f6ce;};'use strict';var _=require(_0x0fbc('0x0'));var util=require(_0x0fbc('0x1'));var logger=require(_0x0fbc('0x2'))(_0x0fbc('0x3'));var moment=require(_0x0fbc('0x4'));var BPromise=require(_0x0fbc('0x5'));var rp=require(_0x0fbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fbc('0x7'));var config=require(_0x0fbc('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x0fbc('0x9')]=function(_0x53014e,_0x4ce5fa){return _0x53014e[_0x0fbc('0xa')](_0x0fbc('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x0fbc('0xc'),'fields':[_0x0fbc('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 318ccef..7b64932 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 _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('SugarcrmField,\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 _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x0b0e[_0x35da42];return _0x370035;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6cb4551..afdfaf5 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 _0xb6ef=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0xb6ef,0x1b2));var _0xfb6e=function(_0x46966a,_0xfdadfc){_0x46966a=_0x46966a-0x0;var _0x24baf9=_0xb6ef[_0x46966a];return _0x24baf9;};'use strict';var multer=require('multer');var util=require(_0xfb6e('0x0'));var path=require(_0xfb6e('0x1'));var timeout=require(_0xfb6e('0x2'));var express=require(_0xfb6e('0x3'));var router=express[_0xfb6e('0x4')]();var auth=require(_0xfb6e('0x5'));var interaction=require(_0xfb6e('0x6'));var config=require(_0xfb6e('0x7'));var controller=require(_0xfb6e('0x8'));router[_0xfb6e('0x9')]('/',auth[_0xfb6e('0xa')](),controller[_0xfb6e('0xb')]);router['get']('/:id',auth[_0xfb6e('0xa')](),controller[_0xfb6e('0xc')]);router[_0xfb6e('0x9')](_0xfb6e('0xd'),auth[_0xfb6e('0xa')](),controller[_0xfb6e('0xe')]);router[_0xfb6e('0x9')]('/:id/fields',auth[_0xfb6e('0xa')](),controller[_0xfb6e('0xf')]);router[_0xfb6e('0x10')]('/',auth[_0xfb6e('0xa')](),controller[_0xfb6e('0x11')]);router[_0xfb6e('0x10')]('/:id/configurations',auth[_0xfb6e('0xa')](),controller[_0xfb6e('0x12')]);router[_0xfb6e('0x13')](_0xfb6e('0x14'),auth['isAuthenticated'](),controller[_0xfb6e('0x15')]);router['delete']('/:id',auth[_0xfb6e('0xa')](),controller[_0xfb6e('0x16')]);module[_0xfb6e('0x17')]=router; \ No newline at end of file +var _0x3cdd=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0xd3743c,_0x15dd67){var _0x3e985b=function(_0x4dea9b){while(--_0x4dea9b){_0xd3743c['push'](_0xd3743c['shift']());}};_0x3e985b(++_0x15dd67);}(_0x3cdd,0x95));var _0xd3cd=function(_0x528fb3,_0x49a869){_0x528fb3=_0x528fb3-0x0;var _0x21f530=_0x3cdd[_0x528fb3];return _0x21f530;};'use strict';var multer=require(_0xd3cd('0x0'));var util=require(_0xd3cd('0x1'));var path=require(_0xd3cd('0x2'));var timeout=require(_0xd3cd('0x3'));var express=require(_0xd3cd('0x4'));var router=express[_0xd3cd('0x5')]();var auth=require(_0xd3cd('0x6'));var interaction=require(_0xd3cd('0x7'));var config=require(_0xd3cd('0x8'));var controller=require(_0xd3cd('0x9'));router[_0xd3cd('0xa')]('/',auth[_0xd3cd('0xb')](),controller['index']);router['get'](_0xd3cd('0xc'),auth[_0xd3cd('0xb')](),controller[_0xd3cd('0xd')]);router['get'](_0xd3cd('0xe'),auth[_0xd3cd('0xb')](),controller[_0xd3cd('0xf')]);router[_0xd3cd('0xa')](_0xd3cd('0x10'),auth[_0xd3cd('0xb')](),controller[_0xd3cd('0x11')]);router[_0xd3cd('0x12')]('/',auth[_0xd3cd('0xb')](),controller['create']);router['post'](_0xd3cd('0xe'),auth[_0xd3cd('0xb')](),controller[_0xd3cd('0x13')]);router[_0xd3cd('0x14')](_0xd3cd('0xc'),auth['isAuthenticated'](),controller[_0xd3cd('0x15')]);router[_0xd3cd('0x16')](_0xd3cd('0xc'),auth[_0xd3cd('0xb')](),controller[_0xd3cd('0x17')]);module[_0xd3cd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a335cd9..0c2481c 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 _0x053f=['STRING','HelpDesk','exports'];(function(_0x50b896,_0x1aa0a9){var _0xb80900=function(_0x2ab794){while(--_0x2ab794){_0x50b896['push'](_0x50b896['shift']());}};_0xb80900(++_0x1aa0a9);}(_0x053f,0xbf));var _0xf053=function(_0x1db8a1,_0x1e7488){_0x1db8a1=_0x1db8a1-0x0;var _0x5f4485=_0x053f[_0x1db8a1];return _0x5f4485;};'use strict';var Sequelize=require('sequelize');module[_0xf053('0x0')]={'name':{'type':Sequelize[_0xf053('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf053('0x1')]},'username':{'type':Sequelize[_0xf053('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf053('0x1')],'allowNull':![],'defaultValue':_0xf053('0x2')},'remoteUri':{'type':Sequelize[_0xf053('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf053('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf053('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x010a=['STRING','HelpDesk','exports'];(function(_0x4699a4,_0x4d696d){var _0x51f448=function(_0x1b658e){while(--_0x1b658e){_0x4699a4['push'](_0x4699a4['shift']());}};_0x51f448(++_0x4d696d);}(_0x010a,0x1f4));var _0xa010=function(_0x1706da,_0x2decf5){_0x1706da=_0x1706da-0x0;var _0x102285=_0x010a[_0x1706da];return _0x102285;};'use strict';var Sequelize=require('sequelize');module[_0xa010('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa010('0x1')]},'username':{'type':Sequelize[_0xa010('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa010('0x2')},'remoteUri':{'type':Sequelize[_0xa010('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa010('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa010('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6894249..5b800eb 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 _0xfb50=['api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','findAll','show','params','includeAll','include','options','create','body','find','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','Subjects','Descriptions','getDescriptions','channel','VtigerField','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','describe','sessionName','reference','owner','remove','editable','startsWith','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xfb50,0x1ec));var _0x0fb5=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xfb50[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0x0fb5('0x0'));var emlformat=require(_0x0fb5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0fb5('0x2'));var rp=require(_0x0fb5('0x3'));var moment=require(_0x0fb5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0fb5('0x5'));var path=require(_0x0fb5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0fb5('0x7'));var fs=require('fs');var _=require(_0x0fb5('0x8'));var squel=require(_0x0fb5('0x9'));var crypto=require('crypto');var jsforce=require(_0x0fb5('0xa'));var deskjs=require(_0x0fb5('0xb'));var toCsv=require(_0x0fb5('0xc'));var querystring=require(_0x0fb5('0xd'));var Papa=require(_0x0fb5('0xe'));var Redis=require(_0x0fb5('0xf'));var authService=require(_0x0fb5('0x10'));var qs=require(_0x0fb5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fb5('0x12'));var logger=require(_0x0fb5('0x13'))(_0x0fb5('0x14'));var utils=require('../../config/utils');var config=require(_0x0fb5('0x15'));var licenseUtil=require(_0x0fb5('0x16'));var db=require(_0x0fb5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0fb5('0x18'));var client=jayson[_0x0fb5('0x19')][_0x0fb5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c5a98,_0xcd30d6,_0x2bbb4f,_0x413249){return new BPromise(function(_0x145527,_0x1324d7){var _0x5f50e8=_0x413249||client;return _0x5f50e8['request'](_0x4c5a98,_0x2bbb4f)['then'](function(_0x408f1e){logger[_0x0fb5('0x1b')](_0x0fb5('0x1c'),_0xcd30d6,_0x0fb5('0x1d'));logger[_0x0fb5('0x1e')](_0x0fb5('0x1f'),_0xcd30d6,_0x0fb5('0x1d'),JSON[_0x0fb5('0x20')](_0x408f1e));if(_0x408f1e[_0x0fb5('0x21')]){if(_0x408f1e['error'][_0x0fb5('0x22')]===0x1f4){logger[_0x0fb5('0x21')](_0x0fb5('0x1c'),_0xcd30d6,_0x408f1e['error']['message']);return _0x1324d7(_0x408f1e[_0x0fb5('0x21')][_0x0fb5('0x23')]);}logger[_0x0fb5('0x21')](_0x0fb5('0x1c'),_0xcd30d6,_0x408f1e['error'][_0x0fb5('0x23')]);return _0x145527(_0x408f1e['error'][_0x0fb5('0x23')]);}else{logger[_0x0fb5('0x1b')](_0x0fb5('0x1c'),_0xcd30d6,_0x0fb5('0x1d'));_0x145527(_0x408f1e[_0x0fb5('0x24')][_0x0fb5('0x23')]);}})[_0x0fb5('0x25')](function(_0x35d0ef){logger[_0x0fb5('0x21')](_0x0fb5('0x1c'),_0xcd30d6,_0x35d0ef);_0x1324d7(_0x35d0ef);});});}function respondWithStatusCode(_0x54563f,_0x44fd60){_0x44fd60=_0x44fd60||0xcc;return function(_0x2499e7){if(_0x2499e7){return _0x54563f['sendStatus'](_0x44fd60);}return _0x54563f[_0x0fb5('0x26')](_0x44fd60)[_0x0fb5('0x27')]();};}function respondWithResult(_0x651223,_0x5c630c){_0x5c630c=_0x5c630c||0xc8;return function(_0x17a3f9){if(_0x17a3f9){return _0x651223['status'](_0x5c630c)['json'](_0x17a3f9);}};}function respondWithFilteredResult(_0x1aee90,_0x4400ff){return function(_0x184989){if(_0x184989){var _0xa62cf4=_0x184989[_0x0fb5('0x28')],_0x5e525f=_0x4400ff[_0x0fb5('0x29')],_0x4b538f=_0x4400ff['offset']+_0x4400ff[_0x0fb5('0x2a')],_0x3d215e;if(_0x4b538f>=_0xa62cf4){_0x4b538f=_0xa62cf4;_0x3d215e=0xc8;}else{_0x3d215e=0xce;}_0x1aee90['status'](_0x3d215e);return _0x1aee90['set'](_0x0fb5('0x2b'),_0x5e525f+'-'+_0x4b538f+'/'+_0xa62cf4)[_0x0fb5('0x2c')](_0x184989);}return null;};}function patchUpdates(_0x40ee05){return function(_0x14a1e1){try{jsonpatch[_0x0fb5('0x2d')](_0x14a1e1,_0x40ee05,!![]);}catch(_0x3f0dfb){return BPromise[_0x0fb5('0x2e')](_0x3f0dfb);}return _0x14a1e1[_0x0fb5('0x2f')]();};}function saveUpdates(_0x5e6cb2,_0x55f06a){return function(_0xac39ce){if(_0xac39ce){return _0xac39ce[_0x0fb5('0x30')](_0x5e6cb2)[_0x0fb5('0x31')](function(_0x4cd798){return _0x4cd798;});}return null;};}function removeEntity(_0x6dad9d,_0x2c7ee1){return function(_0x40a00c){if(_0x40a00c){return _0x40a00c[_0x0fb5('0x32')]()[_0x0fb5('0x31')](function(){_0x6dad9d[_0x0fb5('0x26')](0xcc)[_0x0fb5('0x27')]();});}};}function handleEntityNotFound(_0x44cdec,_0x5906aa){return function(_0x1f0c76){if(!_0x1f0c76){_0x44cdec[_0x0fb5('0x33')](0x194);}return _0x1f0c76;};}function handleError(_0x16eef1,_0x1adf3c){_0x1adf3c=_0x1adf3c||0x1f4;return function(_0x201cbb){logger['error'](_0x201cbb[_0x0fb5('0x34')]);if(_0x201cbb[_0x0fb5('0x35')]){delete _0x201cbb[_0x0fb5('0x35')];}_0x16eef1[_0x0fb5('0x26')](_0x1adf3c)[_0x0fb5('0x36')](_0x201cbb);};}exports[_0x0fb5('0x37')]=function(_0x189e0a,_0x3ab2ec){var _0x39414c={},_0x555485={},_0x2ace1e={'count':0x0,'rows':[]};var _0x140924=_[_0x0fb5('0x38')](db[_0x0fb5('0x39')][_0x0fb5('0x3a')],function(_0x245ec5){return{'name':_0x245ec5[_0x0fb5('0x3b')],'type':_0x245ec5['type']['key']};});_0x555485[_0x0fb5('0x3c')]=_[_0x0fb5('0x38')](_0x140924,'name');_0x555485['query']=_[_0x0fb5('0x3d')](_0x189e0a['query']);_0x555485[_0x0fb5('0x3e')]=_[_0x0fb5('0x3f')](_0x555485[_0x0fb5('0x3c')],_0x555485[_0x0fb5('0x40')]);_0x39414c[_0x0fb5('0x41')]=_['intersection'](_0x555485['model'],qs[_0x0fb5('0x42')](_0x189e0a[_0x0fb5('0x40')]['fields']));_0x39414c[_0x0fb5('0x41')]=_0x39414c['attributes'][_0x0fb5('0x43')]?_0x39414c[_0x0fb5('0x41')]:_0x555485[_0x0fb5('0x3c')];if(!_0x189e0a[_0x0fb5('0x40')][_0x0fb5('0x44')]('nolimit')){_0x39414c['limit']=qs[_0x0fb5('0x2a')](_0x189e0a[_0x0fb5('0x40')][_0x0fb5('0x2a')]);_0x39414c[_0x0fb5('0x29')]=qs[_0x0fb5('0x29')](_0x189e0a['query'][_0x0fb5('0x29')]);}_0x39414c[_0x0fb5('0x45')]=qs[_0x0fb5('0x46')](_0x189e0a[_0x0fb5('0x40')]['sort']);_0x39414c[_0x0fb5('0x47')]=qs[_0x0fb5('0x3e')](_[_0x0fb5('0x48')](_0x189e0a[_0x0fb5('0x40')],_0x555485['filters']),_0x140924);if(_0x189e0a['query'][_0x0fb5('0x49')]){_0x39414c[_0x0fb5('0x47')]=_[_0x0fb5('0x4a')](_0x39414c[_0x0fb5('0x47')],{'$or':_['map'](_0x140924,function(_0x66023b){if(_0x66023b[_0x0fb5('0x4b')]!=='VIRTUAL'){var _0x5dd7a9={};_0x5dd7a9[_0x66023b[_0x0fb5('0x35')]]={'$like':'%'+_0x189e0a[_0x0fb5('0x40')]['filter']+'%'};return _0x5dd7a9;}})});}_0x39414c=_['merge']({},_0x39414c,_0x189e0a['options']);var _0x1a387a={'where':_0x39414c[_0x0fb5('0x47')]};return db['VtigerAccount'][_0x0fb5('0x28')](_0x1a387a)[_0x0fb5('0x31')](function(_0x1e4706){_0x2ace1e[_0x0fb5('0x28')]=_0x1e4706;if(_0x189e0a[_0x0fb5('0x40')]['includeAll']){_0x39414c['include']=[{'all':!![]}];}return db[_0x0fb5('0x39')][_0x0fb5('0x4c')](_0x39414c);})['then'](function(_0x310f98){_0x2ace1e['rows']=_0x310f98;return _0x2ace1e;})[_0x0fb5('0x31')](respondWithFilteredResult(_0x3ab2ec,_0x39414c))[_0x0fb5('0x25')](handleError(_0x3ab2ec,null));};exports[_0x0fb5('0x4d')]=function(_0x4cb514,_0x286fac){var _0x5876a1={'raw':![],'where':{'id':_0x4cb514[_0x0fb5('0x4e')]['id']}},_0x505531={};_0x505531['model']=_['keys'](db['VtigerAccount'][_0x0fb5('0x3a')]);_0x505531[_0x0fb5('0x40')]=_[_0x0fb5('0x3d')](_0x4cb514['query']);_0x505531[_0x0fb5('0x3e')]=_[_0x0fb5('0x3f')](_0x505531['model'],_0x505531[_0x0fb5('0x40')]);_0x5876a1[_0x0fb5('0x41')]=_['intersection'](_0x505531[_0x0fb5('0x3c')],qs[_0x0fb5('0x42')](_0x4cb514[_0x0fb5('0x40')]['fields']));_0x5876a1[_0x0fb5('0x41')]=_0x5876a1[_0x0fb5('0x41')]['length']?_0x5876a1[_0x0fb5('0x41')]:_0x505531[_0x0fb5('0x3c')];if(_0x4cb514[_0x0fb5('0x40')][_0x0fb5('0x4f')]){_0x5876a1[_0x0fb5('0x50')]=[{'all':!![]}];}_0x5876a1=_[_0x0fb5('0x4a')]({},_0x5876a1,_0x4cb514[_0x0fb5('0x51')]);return db[_0x0fb5('0x39')]['find'](_0x5876a1)[_0x0fb5('0x31')](handleEntityNotFound(_0x286fac,null))['then'](respondWithResult(_0x286fac,null))[_0x0fb5('0x25')](handleError(_0x286fac,null));};exports[_0x0fb5('0x52')]=function(_0x520de8,_0x32f1c9){return db[_0x0fb5('0x39')]['create'](_0x520de8[_0x0fb5('0x53')],{})[_0x0fb5('0x31')](respondWithResult(_0x32f1c9,0xc9))[_0x0fb5('0x25')](handleError(_0x32f1c9,null));};exports['update']=function(_0x40306b,_0x29bf75){if(_0x40306b[_0x0fb5('0x53')]['id']){delete _0x40306b[_0x0fb5('0x53')]['id'];}return db[_0x0fb5('0x39')][_0x0fb5('0x54')]({'where':{'id':_0x40306b[_0x0fb5('0x4e')]['id']}})[_0x0fb5('0x31')](handleEntityNotFound(_0x29bf75,null))['then'](saveUpdates(_0x40306b[_0x0fb5('0x53')],null))[_0x0fb5('0x31')](respondWithResult(_0x29bf75,null))['catch'](handleError(_0x29bf75,null));};exports[_0x0fb5('0x32')]=function(_0x23bbc9,_0x5f497c){return db[_0x0fb5('0x39')][_0x0fb5('0x54')]({'where':{'id':_0x23bbc9[_0x0fb5('0x4e')]['id']}})[_0x0fb5('0x31')](handleEntityNotFound(_0x5f497c,null))[_0x0fb5('0x31')](removeEntity(_0x5f497c,null))[_0x0fb5('0x25')](handleError(_0x5f497c,null));};exports[_0x0fb5('0x55')]=function(_0x3f78ee,_0x48c759,_0x254db1){var _0x44e331={};var _0x3f9116={};var _0x58bde1;var _0x1183a8;return db['VtigerAccount'][_0x0fb5('0x56')]({'where':{'id':_0x3f78ee['params']['id']}})[_0x0fb5('0x31')](handleEntityNotFound(_0x48c759,null))[_0x0fb5('0x31')](function(_0x251aa9){if(_0x251aa9){_0x58bde1=_0x251aa9;_0x3f9116['model']=_[_0x0fb5('0x3d')](db[_0x0fb5('0x57')]['rawAttributes']);_0x3f9116['query']=_['keys'](_0x3f78ee[_0x0fb5('0x40')]);_0x3f9116['filters']=_[_0x0fb5('0x3f')](_0x3f9116[_0x0fb5('0x3c')],_0x3f9116[_0x0fb5('0x40')]);_0x44e331['attributes']=_[_0x0fb5('0x3f')](_0x3f9116[_0x0fb5('0x3c')],qs[_0x0fb5('0x42')](_0x3f78ee[_0x0fb5('0x40')][_0x0fb5('0x42')]));_0x44e331[_0x0fb5('0x41')]=_0x44e331['attributes'][_0x0fb5('0x43')]?_0x44e331['attributes']:_0x3f9116[_0x0fb5('0x3c')];_0x44e331[_0x0fb5('0x45')]=qs[_0x0fb5('0x46')](_0x3f78ee[_0x0fb5('0x40')][_0x0fb5('0x46')]);_0x44e331[_0x0fb5('0x47')]=qs[_0x0fb5('0x3e')](_[_0x0fb5('0x48')](_0x3f78ee['query'],_0x3f9116[_0x0fb5('0x3e')]));if(_0x3f78ee[_0x0fb5('0x40')]['filter']){_0x44e331[_0x0fb5('0x47')]=_['merge'](_0x44e331['where'],{'$or':_[_0x0fb5('0x38')](_0x44e331['attributes'],function(_0x1bed6c){var _0x5c647c={};_0x5c647c[_0x1bed6c]={'$like':'%'+_0x3f78ee[_0x0fb5('0x40')][_0x0fb5('0x49')]+'%'};return _0x5c647c;})});}_0x44e331=_[_0x0fb5('0x4a')]({},_0x44e331,_0x3f78ee[_0x0fb5('0x51')]);return _0x58bde1['getConfigurations'](_0x44e331);}})[_0x0fb5('0x31')](function(_0x5c98db){if(_0x5c98db){_0x1183a8=_0x5c98db[_0x0fb5('0x43')];if(!_0x3f78ee[_0x0fb5('0x40')][_0x0fb5('0x44')](_0x0fb5('0x58'))){_0x44e331['limit']=qs['limit'](_0x3f78ee[_0x0fb5('0x40')][_0x0fb5('0x2a')]);_0x44e331[_0x0fb5('0x29')]=qs[_0x0fb5('0x29')](_0x3f78ee[_0x0fb5('0x40')][_0x0fb5('0x29')]);}return _0x58bde1['getConfigurations'](_0x44e331);}})[_0x0fb5('0x31')](function(_0x10b183){if(_0x10b183){return _0x10b183?{'count':_0x1183a8,'rows':_0x10b183}:null;}})[_0x0fb5('0x31')](respondWithResult(_0x48c759,null))[_0x0fb5('0x25')](handleError(_0x48c759,null));};exports[_0x0fb5('0x59')]=function(_0x1b1f25,_0x1c6431,_0x50f054){if(_0x1b1f25['body']['id']){delete _0x1b1f25[_0x0fb5('0x53')]['id'];}return db[_0x0fb5('0x39')]['findOne']({'where':{'id':_0x1b1f25[_0x0fb5('0x4e')]['id']}})[_0x0fb5('0x31')](handleEntityNotFound(_0x1c6431,null))['then'](function(_0x459110){if(_0x459110){_0x1b1f25['body']['AccountId']=_0x459110['id'];_0x1b1f25['body'][_0x0fb5('0x5a')]=integrations['getSubjects'](_0x1b1f25[_0x0fb5('0x53')]['channel'],_0x1b1f25[_0x0fb5('0x53')][_0x0fb5('0x4b')]);_0x1b1f25[_0x0fb5('0x53')][_0x0fb5('0x5b')]=integrations[_0x0fb5('0x5c')](_0x1b1f25['body'][_0x0fb5('0x5d')],_0x1b1f25[_0x0fb5('0x53')][_0x0fb5('0x4b')]);return db[_0x0fb5('0x57')][_0x0fb5('0x52')](_0x1b1f25[_0x0fb5('0x53')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x0fb5('0x5e')],'as':_0x0fb5('0x5b')}]});}return null;})[_0x0fb5('0x31')](respondWithResult(_0x1c6431,null))[_0x0fb5('0x25')](handleError(_0x1c6431,null));};var md5=require('md5');exports[_0x0fb5('0x5f')]=function(_0x1fd8cd,_0x3c83a1,_0x312af3){var _0x4e23a1=null;var _0x8d0f83=null;var _0x2530e0=null;var _0x16bd40=null;var _0x5833d7='';return db[_0x0fb5('0x39')][_0x0fb5('0x56')]({'where':{'id':_0x1fd8cd['params']['id']},'attributes':['id',_0x0fb5('0x35'),_0x0fb5('0x60'),_0x0fb5('0x61'),_0x0fb5('0x62'),'remoteUri','serverUrl','accessKey']})[_0x0fb5('0x31')](handleEntityNotFound(_0x3c83a1,null))[_0x0fb5('0x31')](function(_0x5d4d35){if(_0x5d4d35){_0x4e23a1=_0x5d4d35[_0x0fb5('0x60')];_0x8d0f83=_0x5d4d35[_0x0fb5('0x63')];_0x2530e0=_0x5d4d35[_0x0fb5('0x62')];_0x5833d7=_0x5d4d35[_0x0fb5('0x64')];var _0x482845=_0x5833d7[_0x0fb5('0x65')](-0x1);if(_0x482845==='/'){_0x5833d7=_0x5833d7[_0x0fb5('0x66')](0x0,_0x5833d7[_0x0fb5('0x67')](_0x482845));}_0x16bd40=util[_0x0fb5('0x68')](_0x0fb5('0x69'),_0x5833d7);var _0x3ddb6a={'method':_0x0fb5('0x6a'),'uri':_0x16bd40,'qs':{'operation':_0x0fb5('0x6b'),'username':_0x5d4d35['username']},'json':!![]};return rp(_0x3ddb6a);}})[_0x0fb5('0x31')](function(_0xc9f8cb){if(_0xc9f8cb[_0x0fb5('0x6c')]){var _0x5194b2={'method':_0x0fb5('0x6d'),'uri':_0x16bd40,'form':{'operation':_0x0fb5('0x6e'),'username':_0x4e23a1,'accessKey':md5(_0xc9f8cb[_0x0fb5('0x24')]['token']+_0x8d0f83)},'json':!![]};return rp(_0x5194b2);}})[_0x0fb5('0x31')](function(_0x1b1c18){if(_0x1b1c18[_0x0fb5('0x6c')]){var _0x2d6774={'method':_0x0fb5('0x6a'),'uri':_0x16bd40,'qs':{'operation':_0x0fb5('0x6f'),'username':_0x4e23a1,'sessionName':_0x1b1c18[_0x0fb5('0x24')][_0x0fb5('0x70')],'elementType':_0x2530e0},'json':!![]};return rp(_0x2d6774);}})['then'](function(_0x318b98){if(_0x318b98[_0x0fb5('0x6c')]){var _0x542487=['autogenerated',_0x0fb5('0x71'),_0x0fb5('0x72')];_[_0x0fb5('0x73')](_0x318b98[_0x0fb5('0x24')][_0x0fb5('0x42')],function(_0x113347){return _0x542487['includes'](_0x113347[_0x0fb5('0x4b')][_0x0fb5('0x35')]);});_[_0x0fb5('0x73')](_0x318b98['result']['fields'],function(_0xe42853){return _0xe42853[_0x0fb5('0x74')]==='false';});return{'count':_0x318b98['result'][_0x0fb5('0x42')][_0x0fb5('0x43')],'rows':_['map'](_0x318b98[_0x0fb5('0x24')][_0x0fb5('0x42')],function(_0x36cc63){return{'id':_0x36cc63['name'],'name':_0x36cc63['label'],'custom':_[_0x0fb5('0x75')](_0x36cc63[_0x0fb5('0x35')],'cf_')?!![]:![],'options':_0x36cc63[_0x0fb5('0x4b')]['name']===_0x0fb5('0x76')&&_0x36cc63['type'][_0x0fb5('0x77')][_0x0fb5('0x43')]>0x0?_[_0x0fb5('0x38')](_0x36cc63[_0x0fb5('0x4b')]['picklistValues'],function(_0xda3e92){return{'name':_0xda3e92[_0x0fb5('0x78')],'value':_0xda3e92[_0x0fb5('0x79')]};}):[]};})};}})[_0x0fb5('0x31')](respondWithResult(_0x3c83a1,null))['catch'](function(_0x578f51){console[_0x0fb5('0x7a')](_0x0fb5('0x7b')+_0x578f51);var _0x2a2791=_0x1fd8cd['query'][_0x0fb5('0x7c')]?0x1f4:_0x578f51[_0x0fb5('0x7d')]||0x1f4;logger[_0x0fb5('0x21')](_0x0fb5('0x7e'),_0x0fb5('0x5f'),_0x2a2791,JSON[_0x0fb5('0x20')](_0x578f51));delete _0x578f51[_0x0fb5('0x35')];if(_0x2a2791===0x191){_0x2a2791=0x190;}_0x3c83a1[_0x0fb5('0x26')](_0x2a2791)['send'](_0x1fd8cd['query']['test']?{'message':_0x0fb5('0x7f'),'statusCode':_0x578f51['statusCode']}:_0x578f51);});}; \ No newline at end of file +var _0xe891=['save','update','then','destroy','stack','name','send','index','map','VtigerAccount','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','count','include','findAll','rows','rawAttributes','intersection','includeAll','body','find','params','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','token','describe','sessionName','owner','remove','includes','editable','false','label','picklist','picklistValues','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','request','info','request\x20sent','stringify','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject'];(function(_0xf414f3,_0x51886d){var _0x54c5fd=function(_0x4d8bd2){while(--_0x4d8bd2){_0xf414f3['push'](_0xf414f3['shift']());}};_0x54c5fd(++_0x51886d);}(_0xe891,0xcf));var _0x1e89=function(_0x3d0f4b,_0x5f38c1){_0x3d0f4b=_0x3d0f4b-0x0;var _0x3e8016=_0xe891[_0x3d0f4b];return _0x3e8016;};'use strict';var pdf=require(_0x1e89('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e89('0x1'));var jsonpatch=require(_0x1e89('0x2'));var rp=require(_0x1e89('0x3'));var moment=require(_0x1e89('0x4'));var BPromise=require(_0x1e89('0x5'));var Mustache=require('mustache');var util=require(_0x1e89('0x6'));var path=require(_0x1e89('0x7'));var sox=require(_0x1e89('0x8'));var csv=require('to-csv');var ejs=require(_0x1e89('0x9'));var fs=require('fs');var _=require(_0x1e89('0xa'));var squel=require(_0x1e89('0xb'));var crypto=require(_0x1e89('0xc'));var jsforce=require(_0x1e89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1e89('0xe'));var querystring=require(_0x1e89('0xf'));var Papa=require(_0x1e89('0x10'));var Redis=require('ioredis');var authService=require(_0x1e89('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e89('0x12'));var logger=require(_0x1e89('0x13'))(_0x1e89('0x14'));var utils=require('../../config/utils');var config=require(_0x1e89('0x15'));var licenseUtil=require(_0x1e89('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1e89('0x17'));var client=jayson[_0x1e89('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e44e6,_0x51ba8d,_0x3860a5,_0x230b22){return new BPromise(function(_0x515961,_0x370a62){var _0x33a343=_0x230b22||client;return _0x33a343[_0x1e89('0x19')](_0x5e44e6,_0x3860a5)['then'](function(_0x3bc44d){logger[_0x1e89('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x51ba8d,_0x1e89('0x1b'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x51ba8d,'request\x20sent',JSON[_0x1e89('0x1c')](_0x3bc44d));if(_0x3bc44d['error']){if(_0x3bc44d['error']['code']===0x1f4){logger[_0x1e89('0x1d')]('VtigerAccount,\x20%s,\x20%s',_0x51ba8d,_0x3bc44d['error'][_0x1e89('0x1e')]);return _0x370a62(_0x3bc44d[_0x1e89('0x1d')][_0x1e89('0x1e')]);}logger['error'](_0x1e89('0x1f'),_0x51ba8d,_0x3bc44d[_0x1e89('0x1d')][_0x1e89('0x1e')]);return _0x515961(_0x3bc44d[_0x1e89('0x1d')][_0x1e89('0x1e')]);}else{logger[_0x1e89('0x1a')](_0x1e89('0x1f'),_0x51ba8d,_0x1e89('0x1b'));_0x515961(_0x3bc44d[_0x1e89('0x20')]['message']);}})[_0x1e89('0x21')](function(_0x2861ee){logger['error'](_0x1e89('0x1f'),_0x51ba8d,_0x2861ee);_0x370a62(_0x2861ee);});});}function respondWithStatusCode(_0x546707,_0x415bd0){_0x415bd0=_0x415bd0||0xcc;return function(_0x5d2382){if(_0x5d2382){return _0x546707[_0x1e89('0x22')](_0x415bd0);}return _0x546707['status'](_0x415bd0)[_0x1e89('0x23')]();};}function respondWithResult(_0x11316c,_0x2b7d75){_0x2b7d75=_0x2b7d75||0xc8;return function(_0x4b7aac){if(_0x4b7aac){return _0x11316c[_0x1e89('0x24')](_0x2b7d75)[_0x1e89('0x25')](_0x4b7aac);}};}function respondWithFilteredResult(_0x266c0b,_0x3e256b){return function(_0x1dc3ad){if(_0x1dc3ad){var _0x1f0032=_0x1dc3ad['count'],_0x1a3c47=_0x3e256b[_0x1e89('0x26')],_0x41d8e8=_0x3e256b[_0x1e89('0x26')]+_0x3e256b['limit'],_0x255f0c;if(_0x41d8e8>=_0x1f0032){_0x41d8e8=_0x1f0032;_0x255f0c=0xc8;}else{_0x255f0c=0xce;}_0x266c0b[_0x1e89('0x24')](_0x255f0c);return _0x266c0b[_0x1e89('0x27')](_0x1e89('0x28'),_0x1a3c47+'-'+_0x41d8e8+'/'+_0x1f0032)[_0x1e89('0x25')](_0x1dc3ad);}return null;};}function patchUpdates(_0x2e4c60){return function(_0x32bf8d){try{jsonpatch[_0x1e89('0x29')](_0x32bf8d,_0x2e4c60,!![]);}catch(_0x19326a){return BPromise[_0x1e89('0x2a')](_0x19326a);}return _0x32bf8d[_0x1e89('0x2b')]();};}function saveUpdates(_0x450cba,_0xe07801){return function(_0x59e1c1){if(_0x59e1c1){return _0x59e1c1[_0x1e89('0x2c')](_0x450cba)[_0x1e89('0x2d')](function(_0x1190da){return _0x1190da;});}return null;};}function removeEntity(_0x433909,_0x49b25d){return function(_0x10be5c){if(_0x10be5c){return _0x10be5c[_0x1e89('0x2e')]()[_0x1e89('0x2d')](function(){_0x433909[_0x1e89('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff012,_0x5bcea1){return function(_0xe14537){if(!_0xe14537){_0x4ff012[_0x1e89('0x22')](0x194);}return _0xe14537;};}function handleError(_0x29a348,_0x16fc31){_0x16fc31=_0x16fc31||0x1f4;return function(_0x26ebd6){logger[_0x1e89('0x1d')](_0x26ebd6[_0x1e89('0x2f')]);if(_0x26ebd6[_0x1e89('0x30')]){delete _0x26ebd6[_0x1e89('0x30')];}_0x29a348[_0x1e89('0x24')](_0x16fc31)[_0x1e89('0x31')](_0x26ebd6);};}exports[_0x1e89('0x32')]=function(_0x3024bc,_0x47cf38){var _0x4b5c90={},_0x152457={},_0x260b1e={'count':0x0,'rows':[]};var _0x493d5f=_[_0x1e89('0x33')](db[_0x1e89('0x34')]['rawAttributes'],function(_0x353c27){return{'name':_0x353c27['fieldName'],'type':_0x353c27[_0x1e89('0x35')][_0x1e89('0x36')]};});_0x152457[_0x1e89('0x37')]=_[_0x1e89('0x33')](_0x493d5f,_0x1e89('0x30'));_0x152457[_0x1e89('0x38')]=_[_0x1e89('0x39')](_0x3024bc[_0x1e89('0x38')]);_0x152457[_0x1e89('0x3a')]=_['intersection'](_0x152457[_0x1e89('0x37')],_0x152457['query']);_0x4b5c90[_0x1e89('0x3b')]=_['intersection'](_0x152457[_0x1e89('0x37')],qs[_0x1e89('0x3c')](_0x3024bc[_0x1e89('0x38')]['fields']));_0x4b5c90[_0x1e89('0x3b')]=_0x4b5c90[_0x1e89('0x3b')][_0x1e89('0x3d')]?_0x4b5c90['attributes']:_0x152457[_0x1e89('0x37')];if(!_0x3024bc[_0x1e89('0x38')][_0x1e89('0x3e')](_0x1e89('0x3f'))){_0x4b5c90['limit']=qs[_0x1e89('0x40')](_0x3024bc[_0x1e89('0x38')][_0x1e89('0x40')]);_0x4b5c90[_0x1e89('0x26')]=qs[_0x1e89('0x26')](_0x3024bc[_0x1e89('0x38')][_0x1e89('0x26')]);}_0x4b5c90[_0x1e89('0x41')]=qs[_0x1e89('0x42')](_0x3024bc['query']['sort']);_0x4b5c90['where']=qs[_0x1e89('0x3a')](_[_0x1e89('0x43')](_0x3024bc['query'],_0x152457[_0x1e89('0x3a')]),_0x493d5f);if(_0x3024bc[_0x1e89('0x38')][_0x1e89('0x44')]){_0x4b5c90[_0x1e89('0x45')]=_[_0x1e89('0x46')](_0x4b5c90[_0x1e89('0x45')],{'$or':_[_0x1e89('0x33')](_0x493d5f,function(_0x4a8d40){if(_0x4a8d40[_0x1e89('0x35')]!=='VIRTUAL'){var _0x563650={};_0x563650[_0x4a8d40[_0x1e89('0x30')]]={'$like':'%'+_0x3024bc[_0x1e89('0x38')][_0x1e89('0x44')]+'%'};return _0x563650;}})});}_0x4b5c90=_[_0x1e89('0x46')]({},_0x4b5c90,_0x3024bc[_0x1e89('0x47')]);var _0x2d0244={'where':_0x4b5c90[_0x1e89('0x45')]};return db['VtigerAccount'][_0x1e89('0x48')](_0x2d0244)['then'](function(_0x561066){_0x260b1e[_0x1e89('0x48')]=_0x561066;if(_0x3024bc[_0x1e89('0x38')]['includeAll']){_0x4b5c90[_0x1e89('0x49')]=[{'all':!![]}];}return db[_0x1e89('0x34')][_0x1e89('0x4a')](_0x4b5c90);})[_0x1e89('0x2d')](function(_0x53604c){_0x260b1e[_0x1e89('0x4b')]=_0x53604c;return _0x260b1e;})[_0x1e89('0x2d')](respondWithFilteredResult(_0x47cf38,_0x4b5c90))['catch'](handleError(_0x47cf38,null));};exports['show']=function(_0x144c94,_0x17f304){var _0x5e81f2={'raw':![],'where':{'id':_0x144c94['params']['id']}},_0x593d51={};_0x593d51['model']=_[_0x1e89('0x39')](db[_0x1e89('0x34')][_0x1e89('0x4c')]);_0x593d51[_0x1e89('0x38')]=_[_0x1e89('0x39')](_0x144c94[_0x1e89('0x38')]);_0x593d51['filters']=_['intersection'](_0x593d51[_0x1e89('0x37')],_0x593d51[_0x1e89('0x38')]);_0x5e81f2[_0x1e89('0x3b')]=_[_0x1e89('0x4d')](_0x593d51[_0x1e89('0x37')],qs[_0x1e89('0x3c')](_0x144c94['query'][_0x1e89('0x3c')]));_0x5e81f2['attributes']=_0x5e81f2[_0x1e89('0x3b')][_0x1e89('0x3d')]?_0x5e81f2[_0x1e89('0x3b')]:_0x593d51['model'];if(_0x144c94[_0x1e89('0x38')][_0x1e89('0x4e')]){_0x5e81f2[_0x1e89('0x49')]=[{'all':!![]}];}_0x5e81f2=_[_0x1e89('0x46')]({},_0x5e81f2,_0x144c94['options']);return db['VtigerAccount']['find'](_0x5e81f2)[_0x1e89('0x2d')](handleEntityNotFound(_0x17f304,null))[_0x1e89('0x2d')](respondWithResult(_0x17f304,null))['catch'](handleError(_0x17f304,null));};exports['create']=function(_0x53fcf0,_0x35cc56){return db[_0x1e89('0x34')]['create'](_0x53fcf0[_0x1e89('0x4f')],{})[_0x1e89('0x2d')](respondWithResult(_0x35cc56,0xc9))[_0x1e89('0x21')](handleError(_0x35cc56,null));};exports[_0x1e89('0x2c')]=function(_0x3cede3,_0xd632e3){if(_0x3cede3[_0x1e89('0x4f')]['id']){delete _0x3cede3[_0x1e89('0x4f')]['id'];}return db['VtigerAccount'][_0x1e89('0x50')]({'where':{'id':_0x3cede3[_0x1e89('0x51')]['id']}})[_0x1e89('0x2d')](handleEntityNotFound(_0xd632e3,null))[_0x1e89('0x2d')](saveUpdates(_0x3cede3[_0x1e89('0x4f')],null))[_0x1e89('0x2d')](respondWithResult(_0xd632e3,null))[_0x1e89('0x21')](handleError(_0xd632e3,null));};exports['destroy']=function(_0x17dde3,_0x411474){return db[_0x1e89('0x34')][_0x1e89('0x50')]({'where':{'id':_0x17dde3['params']['id']}})[_0x1e89('0x2d')](handleEntityNotFound(_0x411474,null))[_0x1e89('0x2d')](removeEntity(_0x411474,null))[_0x1e89('0x21')](handleError(_0x411474,null));};exports['getConfigurations']=function(_0x7f6185,_0x3fd843,_0x222cf6){var _0x4b289c={};var _0x59adc5={};var _0x535daa;var _0x48353e;return db[_0x1e89('0x34')][_0x1e89('0x52')]({'where':{'id':_0x7f6185['params']['id']}})[_0x1e89('0x2d')](handleEntityNotFound(_0x3fd843,null))['then'](function(_0x315120){if(_0x315120){_0x535daa=_0x315120;_0x59adc5['model']=_[_0x1e89('0x39')](db[_0x1e89('0x53')][_0x1e89('0x4c')]);_0x59adc5[_0x1e89('0x38')]=_[_0x1e89('0x39')](_0x7f6185[_0x1e89('0x38')]);_0x59adc5[_0x1e89('0x3a')]=_['intersection'](_0x59adc5[_0x1e89('0x37')],_0x59adc5['query']);_0x4b289c[_0x1e89('0x3b')]=_[_0x1e89('0x4d')](_0x59adc5[_0x1e89('0x37')],qs['fields'](_0x7f6185[_0x1e89('0x38')][_0x1e89('0x3c')]));_0x4b289c[_0x1e89('0x3b')]=_0x4b289c[_0x1e89('0x3b')][_0x1e89('0x3d')]?_0x4b289c['attributes']:_0x59adc5['model'];_0x4b289c['order']=qs[_0x1e89('0x42')](_0x7f6185[_0x1e89('0x38')][_0x1e89('0x42')]);_0x4b289c[_0x1e89('0x45')]=qs[_0x1e89('0x3a')](_[_0x1e89('0x43')](_0x7f6185[_0x1e89('0x38')],_0x59adc5[_0x1e89('0x3a')]));if(_0x7f6185[_0x1e89('0x38')][_0x1e89('0x44')]){_0x4b289c[_0x1e89('0x45')]=_['merge'](_0x4b289c['where'],{'$or':_[_0x1e89('0x33')](_0x4b289c[_0x1e89('0x3b')],function(_0x3386e4){var _0x40e371={};_0x40e371[_0x3386e4]={'$like':'%'+_0x7f6185['query']['filter']+'%'};return _0x40e371;})});}_0x4b289c=_[_0x1e89('0x46')]({},_0x4b289c,_0x7f6185[_0x1e89('0x47')]);return _0x535daa['getConfigurations'](_0x4b289c);}})['then'](function(_0x56b0e3){if(_0x56b0e3){_0x48353e=_0x56b0e3[_0x1e89('0x3d')];if(!_0x7f6185[_0x1e89('0x38')][_0x1e89('0x3e')](_0x1e89('0x3f'))){_0x4b289c[_0x1e89('0x40')]=qs[_0x1e89('0x40')](_0x7f6185[_0x1e89('0x38')][_0x1e89('0x40')]);_0x4b289c[_0x1e89('0x26')]=qs[_0x1e89('0x26')](_0x7f6185[_0x1e89('0x38')]['offset']);}return _0x535daa[_0x1e89('0x54')](_0x4b289c);}})[_0x1e89('0x2d')](function(_0x335799){if(_0x335799){return _0x335799?{'count':_0x48353e,'rows':_0x335799}:null;}})[_0x1e89('0x2d')](respondWithResult(_0x3fd843,null))[_0x1e89('0x21')](handleError(_0x3fd843,null));};exports[_0x1e89('0x55')]=function(_0x1f3c7a,_0xb4425a,_0x5570b4){if(_0x1f3c7a[_0x1e89('0x4f')]['id']){delete _0x1f3c7a[_0x1e89('0x4f')]['id'];}return db[_0x1e89('0x34')][_0x1e89('0x52')]({'where':{'id':_0x1f3c7a[_0x1e89('0x51')]['id']}})['then'](handleEntityNotFound(_0xb4425a,null))[_0x1e89('0x2d')](function(_0x288bcd){if(_0x288bcd){_0x1f3c7a[_0x1e89('0x4f')][_0x1e89('0x56')]=_0x288bcd['id'];_0x1f3c7a['body'][_0x1e89('0x57')]=integrations[_0x1e89('0x58')](_0x1f3c7a[_0x1e89('0x4f')]['channel'],_0x1f3c7a[_0x1e89('0x4f')][_0x1e89('0x35')]);_0x1f3c7a[_0x1e89('0x4f')][_0x1e89('0x59')]=integrations[_0x1e89('0x5a')](_0x1f3c7a[_0x1e89('0x4f')][_0x1e89('0x5b')],_0x1f3c7a['body'][_0x1e89('0x35')]);return db[_0x1e89('0x53')]['create'](_0x1f3c7a[_0x1e89('0x4f')],{'include':[{'model':db[_0x1e89('0x5c')],'as':_0x1e89('0x57')},{'model':db['VtigerField'],'as':_0x1e89('0x59')}]});}return null;})[_0x1e89('0x2d')](respondWithResult(_0xb4425a,null))[_0x1e89('0x21')](handleError(_0xb4425a,null));};var md5=require(_0x1e89('0x5d'));exports[_0x1e89('0x5e')]=function(_0x426e40,_0x21d760,_0x172eac){var _0x1eb3f1=null;var _0x2f5662=null;var _0x535cf2=null;var _0x5dd660=null;var _0x371cea='';return db['VtigerAccount']['findOne']({'where':{'id':_0x426e40[_0x1e89('0x51')]['id']},'attributes':['id',_0x1e89('0x30'),_0x1e89('0x5f'),_0x1e89('0x60'),_0x1e89('0x61'),_0x1e89('0x62'),_0x1e89('0x63'),_0x1e89('0x64')]})[_0x1e89('0x2d')](handleEntityNotFound(_0x21d760,null))[_0x1e89('0x2d')](function(_0x53a70e){if(_0x53a70e){_0x1eb3f1=_0x53a70e[_0x1e89('0x5f')];_0x2f5662=_0x53a70e[_0x1e89('0x64')];_0x535cf2=_0x53a70e[_0x1e89('0x61')];_0x371cea=_0x53a70e[_0x1e89('0x62')];var _0x19c04c=_0x371cea[_0x1e89('0x65')](-0x1);if(_0x19c04c==='/'){_0x371cea=_0x371cea[_0x1e89('0x66')](0x0,_0x371cea[_0x1e89('0x67')](_0x19c04c));}_0x5dd660=util[_0x1e89('0x68')](_0x1e89('0x69'),_0x371cea);var _0x291c85={'method':_0x1e89('0x6a'),'uri':_0x5dd660,'qs':{'operation':'getchallenge','username':_0x53a70e['username']},'json':!![]};return rp(_0x291c85);}})['then'](function(_0x1b0976){if(_0x1b0976[_0x1e89('0x6b')]){var _0x50f0d9={'method':_0x1e89('0x6c'),'uri':_0x5dd660,'form':{'operation':'login','username':_0x1eb3f1,'accessKey':md5(_0x1b0976[_0x1e89('0x20')][_0x1e89('0x6d')]+_0x2f5662)},'json':!![]};return rp(_0x50f0d9);}})[_0x1e89('0x2d')](function(_0x32ba4f){if(_0x32ba4f[_0x1e89('0x6b')]){var _0x1ad0ca={'method':_0x1e89('0x6a'),'uri':_0x5dd660,'qs':{'operation':_0x1e89('0x6e'),'username':_0x1eb3f1,'sessionName':_0x32ba4f[_0x1e89('0x20')][_0x1e89('0x6f')],'elementType':_0x535cf2},'json':!![]};return rp(_0x1ad0ca);}})[_0x1e89('0x2d')](function(_0xc0284e){if(_0xc0284e[_0x1e89('0x6b')]){var _0x5bbb05=['autogenerated','reference',_0x1e89('0x70')];_[_0x1e89('0x71')](_0xc0284e[_0x1e89('0x20')][_0x1e89('0x3c')],function(_0x5e4001){return _0x5bbb05[_0x1e89('0x72')](_0x5e4001[_0x1e89('0x35')][_0x1e89('0x30')]);});_[_0x1e89('0x71')](_0xc0284e[_0x1e89('0x20')]['fields'],function(_0x16f5fa){return _0x16f5fa[_0x1e89('0x73')]===_0x1e89('0x74');});return{'count':_0xc0284e[_0x1e89('0x20')]['fields']['length'],'rows':_[_0x1e89('0x33')](_0xc0284e[_0x1e89('0x20')][_0x1e89('0x3c')],function(_0x71ca98){return{'id':_0x71ca98[_0x1e89('0x30')],'name':_0x71ca98[_0x1e89('0x75')],'custom':_['startsWith'](_0x71ca98[_0x1e89('0x30')],'cf_')?!![]:![],'options':_0x71ca98['type'][_0x1e89('0x30')]===_0x1e89('0x76')&&_0x71ca98[_0x1e89('0x35')]['picklistValues'][_0x1e89('0x3d')]>0x0?_[_0x1e89('0x33')](_0x71ca98['type'][_0x1e89('0x77')],function(_0x5d4dcb){return{'name':_0x5d4dcb[_0x1e89('0x75')],'value':_0x5d4dcb['value']};}):[]};})};}})['then'](respondWithResult(_0x21d760,null))[_0x1e89('0x21')](function(_0x2ed7dc){console[_0x1e89('0x78')]('vTiger\x20error:\x20'+_0x2ed7dc);var _0x4829a4=_0x426e40['query'][_0x1e89('0x79')]?0x1f4:_0x2ed7dc[_0x1e89('0x7a')]||0x1f4;logger[_0x1e89('0x1d')](_0x1e89('0x7b'),'getFields',_0x4829a4,JSON[_0x1e89('0x1c')](_0x2ed7dc));delete _0x2ed7dc[_0x1e89('0x30')];if(_0x4829a4===0x191){_0x4829a4=0x190;}_0x21d760[_0x1e89('0x24')](_0x4829a4)[_0x1e89('0x31')](_0x426e40[_0x1e89('0x38')]['test']?{'message':_0x1e89('0x7c'),'statusCode':_0x2ed7dc[_0x1e89('0x7a')]}:_0x2ed7dc);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b38daa2..1498545 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 _0x883c=['rimraf','./intVtigerAccount.attributes','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x411bde,_0x55a5b3){var _0x3b8268=function(_0x1050ca){while(--_0x1050ca){_0x411bde['push'](_0x411bde['shift']());}};_0x3b8268(++_0x55a5b3);}(_0x883c,0x1a6));var _0xc883=function(_0x5c925d,_0x2e042a){_0x5c925d=_0x5c925d-0x0;var _0x45792e=_0x883c[_0x5c925d];return _0x45792e;};'use strict';var _=require(_0xc883('0x0'));var util=require(_0xc883('0x1'));var logger=require(_0xc883('0x2'))(_0xc883('0x3'));var moment=require('moment');var BPromise=require(_0xc883('0x4'));var rp=require(_0xc883('0x5'));var fs=require('fs');var path=require(_0xc883('0x6'));var rimraf=require(_0xc883('0x7'));var config=require('../../config/environment');var attributes=require(_0xc883('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1e44ae,_0x265193){return _0x1e44ae['define'](_0xc883('0x9'),attributes,{'tableName':_0xc883('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dac=['bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0dac,0xb1));var _0xc0da=function(_0x16fe57,_0x98b2c1){_0x16fe57=_0x16fe57-0x0;var _0x40178e=_0x0dac[_0x16fe57];return _0x40178e;};'use strict';var _=require(_0xc0da('0x0'));var util=require('util');var logger=require(_0xc0da('0x1'))(_0xc0da('0x2'));var moment=require('moment');var BPromise=require(_0xc0da('0x3'));var rp=require(_0xc0da('0x4'));var fs=require('fs');var path=require(_0xc0da('0x5'));var rimraf=require('rimraf');var config=require(_0xc0da('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc0da('0x7'));module[_0xc0da('0x8')]=function(_0x435569,_0x5f14a6){return _0x435569[_0xc0da('0x9')](_0xc0da('0xa'),attributes,{'tableName':_0xc0da('0xb'),'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 7cf1f2a..8f814d9 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 _0x1aee=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','include','model','map','then','catch','ShowVtigerAccount','where','lodash','bluebird','randomstring'];(function(_0x4c45a3,_0xb7e7c3){var _0x2c6675=function(_0x4881a2){while(--_0x4881a2){_0x4c45a3['push'](_0x4c45a3['shift']());}};_0x2c6675(++_0xb7e7c3);}(_0x1aee,0x89));var _0xe1ae=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x1aee[_0x27beea];return _0x122645;};'use strict';var _=require(_0xe1ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe1ae('0x1'));var rs=require(_0xe1ae('0x2'));var fs=require('fs');var Redis=require(_0xe1ae('0x3'));var db=require(_0xe1ae('0x4'))['db'];var utils=require(_0xe1ae('0x5'));var logger=require(_0xe1ae('0x6'))(_0xe1ae('0x7'));var config=require(_0xe1ae('0x8'));var jayson=require(_0xe1ae('0x9'));var client=jayson[_0xe1ae('0xa')][_0xe1ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dac19,_0x569f71,_0x16d8d7){return new BPromise(function(_0x178b6a,_0x19bad1){return client['request'](_0x1dac19,_0x16d8d7)['then'](function(_0x119e29){logger[_0xe1ae('0xc')](_0xe1ae('0xd'),_0x569f71,_0xe1ae('0xe'));logger[_0xe1ae('0xf')](_0xe1ae('0x10'),_0x569f71,'request\x20sent',JSON[_0xe1ae('0x11')](_0x119e29));if(_0x119e29[_0xe1ae('0x12')]){if(_0x119e29['error'][_0xe1ae('0x13')]===0x1f4){logger['error'](_0xe1ae('0xd'),_0x569f71,_0x119e29[_0xe1ae('0x12')]['message']);return _0x19bad1(_0x119e29[_0xe1ae('0x12')]['message']);}logger[_0xe1ae('0x12')](_0xe1ae('0xd'),_0x569f71,_0x119e29[_0xe1ae('0x12')][_0xe1ae('0x14')]);return _0x178b6a(_0x119e29[_0xe1ae('0x12')][_0xe1ae('0x14')]);}else{logger[_0xe1ae('0xc')](_0xe1ae('0xd'),_0x569f71,_0xe1ae('0xe'));_0x178b6a(_0x119e29[_0xe1ae('0x15')][_0xe1ae('0x14')]);}})['catch'](function(_0x47cecf){logger['error'](_0xe1ae('0xd'),_0x569f71,_0x47cecf);_0x19bad1(_0x47cecf);});});}exports[_0xe1ae('0x16')]=function(_0x2927d9){var _0x5f32fa=this;return new Promise(function(_0x1ac1d9,_0x1b5258){return db[_0xe1ae('0x17')]['findAll']({'raw':_0x2927d9[_0xe1ae('0x18')]?_0x2927d9[_0xe1ae('0x18')][_0xe1ae('0x19')]===undefined?!![]:![]:!![],'where':_0x2927d9[_0xe1ae('0x18')]?_0x2927d9[_0xe1ae('0x18')]['where']||null:null,'attributes':_0x2927d9[_0xe1ae('0x18')]?_0x2927d9[_0xe1ae('0x18')][_0xe1ae('0x1a')]||null:null,'limit':_0x2927d9[_0xe1ae('0x18')]?_0x2927d9['options'][_0xe1ae('0x1b')]||null:null,'include':_0x2927d9[_0xe1ae('0x18')]?_0x2927d9['options'][_0xe1ae('0x1c')]?_['map'](_0x2927d9[_0xe1ae('0x18')][_0xe1ae('0x1c')],function(_0x4cc9b9){return{'model':db[_0x4cc9b9[_0xe1ae('0x1d')]],'as':_0x4cc9b9['as'],'attributes':_0x4cc9b9[_0xe1ae('0x1a')],'include':_0x4cc9b9[_0xe1ae('0x1c')]?_[_0xe1ae('0x1e')](_0x4cc9b9[_0xe1ae('0x1c')],function(_0x379aff){return{'model':db[_0x379aff['model']],'as':_0x379aff['as'],'attributes':_0x379aff[_0xe1ae('0x1a')],'include':_0x379aff[_0xe1ae('0x1c')]?_[_0xe1ae('0x1e')](_0x379aff[_0xe1ae('0x1c')],function(_0x576ab8){return{'model':db[_0x576ab8['model']],'as':_0x576ab8['as'],'attributes':_0x576ab8[_0xe1ae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ae('0x1f')](function(_0x3e51f9){logger[_0xe1ae('0xc')](_0xe1ae('0x16'),_0x2927d9);logger[_0xe1ae('0xf')](_0xe1ae('0x16'),_0x2927d9,JSON['stringify'](_0x3e51f9));_0x1ac1d9(_0x3e51f9);})[_0xe1ae('0x20')](function(_0x42f184){logger['error'](_0xe1ae('0x16'),_0x42f184['message'],_0x2927d9);_0x1b5258(_0x5f32fa[_0xe1ae('0x12')](0x1f4,_0x42f184[_0xe1ae('0x14')]));});});};exports[_0xe1ae('0x21')]=function(_0x190c63){var _0x1dbd9d=this;return new Promise(function(_0x58fc31,_0x2b28a6){return db['VtigerAccount']['find']({'raw':_0x190c63['options']?_0x190c63[_0xe1ae('0x18')][_0xe1ae('0x19')]===undefined?!![]:![]:!![],'where':_0x190c63[_0xe1ae('0x18')]?_0x190c63['options'][_0xe1ae('0x22')]||null:null,'attributes':_0x190c63[_0xe1ae('0x18')]?_0x190c63[_0xe1ae('0x18')][_0xe1ae('0x1a')]||null:null,'include':_0x190c63[_0xe1ae('0x18')]?_0x190c63[_0xe1ae('0x18')][_0xe1ae('0x1c')]?_[_0xe1ae('0x1e')](_0x190c63['options'][_0xe1ae('0x1c')],function(_0xe009de){return{'model':db[_0xe009de[_0xe1ae('0x1d')]],'as':_0xe009de['as'],'attributes':_0xe009de[_0xe1ae('0x1a')],'include':_0xe009de[_0xe1ae('0x1c')]?_[_0xe1ae('0x1e')](_0xe009de['include'],function(_0x9a1776){return{'model':db[_0x9a1776[_0xe1ae('0x1d')]],'as':_0x9a1776['as'],'attributes':_0x9a1776[_0xe1ae('0x1a')],'include':_0x9a1776[_0xe1ae('0x1c')]?_[_0xe1ae('0x1e')](_0x9a1776['include'],function(_0xed430e){return{'model':db[_0xed430e['model']],'as':_0xed430e['as'],'attributes':_0xed430e[_0xe1ae('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6a9fbd){logger[_0xe1ae('0xc')](_0xe1ae('0x21'),_0x190c63);logger[_0xe1ae('0xf')]('ShowVtigerAccount',_0x190c63,JSON[_0xe1ae('0x11')](_0x6a9fbd));_0x58fc31(_0x6a9fbd);})[_0xe1ae('0x20')](function(_0x30edaf){logger[_0xe1ae('0x12')](_0xe1ae('0x21'),_0x30edaf[_0xe1ae('0x14')],_0x190c63);_0x2b28a6(_0x1dbd9d[_0xe1ae('0x12')](0x1f4,_0x30edaf[_0xe1ae('0x14')]));});});}; \ No newline at end of file +var _0x8221=['lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','attributes','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','where'];(function(_0x5c9bba,_0x1a26a6){var _0x512b92=function(_0x1c9e57){while(--_0x1c9e57){_0x5c9bba['push'](_0x5c9bba['shift']());}};_0x512b92(++_0x1a26a6);}(_0x8221,0xee));var _0x1822=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x8221[_0x406115];return _0xbbabdb;};'use strict';var _=require(_0x1822('0x0'));var util=require(_0x1822('0x1'));var moment=require('moment');var BPromise=require(_0x1822('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1822('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1822('0x4'));var logger=require(_0x1822('0x5'))(_0x1822('0x6'));var config=require(_0x1822('0x7'));var jayson=require(_0x1822('0x8'));var client=jayson[_0x1822('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35dfe6,_0x23bbef,_0x1afcef){return new BPromise(function(_0x352286,_0x58c971){return client[_0x1822('0xa')](_0x35dfe6,_0x1afcef)[_0x1822('0xb')](function(_0x2ac709){logger[_0x1822('0xc')](_0x1822('0xd'),_0x23bbef,_0x1822('0xe'));logger[_0x1822('0xf')](_0x1822('0x10'),_0x23bbef,'request\x20sent',JSON['stringify'](_0x2ac709));if(_0x2ac709[_0x1822('0x11')]){if(_0x2ac709[_0x1822('0x11')][_0x1822('0x12')]===0x1f4){logger[_0x1822('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x23bbef,_0x2ac709[_0x1822('0x11')][_0x1822('0x13')]);return _0x58c971(_0x2ac709[_0x1822('0x11')][_0x1822('0x13')]);}logger[_0x1822('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x23bbef,_0x2ac709['error'][_0x1822('0x13')]);return _0x352286(_0x2ac709['error'][_0x1822('0x13')]);}else{logger[_0x1822('0xc')](_0x1822('0xd'),_0x23bbef,_0x1822('0xe'));_0x352286(_0x2ac709[_0x1822('0x14')][_0x1822('0x13')]);}})[_0x1822('0x15')](function(_0x359b68){logger[_0x1822('0x11')](_0x1822('0xd'),_0x23bbef,_0x359b68);_0x58c971(_0x359b68);});});}exports[_0x1822('0x16')]=function(_0x1132c9){var _0x61f98e=this;return new Promise(function(_0x54b20e,_0x38fcd1){return db['VtigerAccount'][_0x1822('0x17')]({'raw':_0x1132c9[_0x1822('0x18')]?_0x1132c9['options'][_0x1822('0x19')]===undefined?!![]:![]:!![],'where':_0x1132c9['options']?_0x1132c9[_0x1822('0x18')]['where']||null:null,'attributes':_0x1132c9[_0x1822('0x18')]?_0x1132c9[_0x1822('0x18')][_0x1822('0x1a')]||null:null,'limit':_0x1132c9[_0x1822('0x18')]?_0x1132c9[_0x1822('0x18')]['limit']||null:null,'include':_0x1132c9[_0x1822('0x18')]?_0x1132c9[_0x1822('0x18')][_0x1822('0x1b')]?_['map'](_0x1132c9['options']['include'],function(_0x5546d4){return{'model':db[_0x5546d4[_0x1822('0x1c')]],'as':_0x5546d4['as'],'attributes':_0x5546d4['attributes'],'include':_0x5546d4['include']?_[_0x1822('0x1d')](_0x5546d4[_0x1822('0x1b')],function(_0x178bd8){return{'model':db[_0x178bd8[_0x1822('0x1c')]],'as':_0x178bd8['as'],'attributes':_0x178bd8['attributes'],'include':_0x178bd8[_0x1822('0x1b')]?_[_0x1822('0x1d')](_0x178bd8[_0x1822('0x1b')],function(_0x33d807){return{'model':db[_0x33d807[_0x1822('0x1c')]],'as':_0x33d807['as'],'attributes':_0x33d807[_0x1822('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1822('0xb')](function(_0x4576f6){logger[_0x1822('0xc')](_0x1822('0x16'),_0x1132c9);logger['debug'](_0x1822('0x16'),_0x1132c9,JSON[_0x1822('0x1e')](_0x4576f6));_0x54b20e(_0x4576f6);})[_0x1822('0x15')](function(_0x1ee847){logger[_0x1822('0x11')](_0x1822('0x16'),_0x1ee847[_0x1822('0x13')],_0x1132c9);_0x38fcd1(_0x61f98e[_0x1822('0x11')](0x1f4,_0x1ee847[_0x1822('0x13')]));});});};exports[_0x1822('0x1f')]=function(_0x170d8b){var _0xc06308=this;return new Promise(function(_0x5bda9a,_0x608563){return db[_0x1822('0x20')]['find']({'raw':_0x170d8b[_0x1822('0x18')]?_0x170d8b[_0x1822('0x18')][_0x1822('0x19')]===undefined?!![]:![]:!![],'where':_0x170d8b['options']?_0x170d8b[_0x1822('0x18')][_0x1822('0x21')]||null:null,'attributes':_0x170d8b[_0x1822('0x18')]?_0x170d8b[_0x1822('0x18')][_0x1822('0x1a')]||null:null,'include':_0x170d8b[_0x1822('0x18')]?_0x170d8b[_0x1822('0x18')][_0x1822('0x1b')]?_[_0x1822('0x1d')](_0x170d8b[_0x1822('0x18')][_0x1822('0x1b')],function(_0x5c22bd){return{'model':db[_0x5c22bd[_0x1822('0x1c')]],'as':_0x5c22bd['as'],'attributes':_0x5c22bd['attributes'],'include':_0x5c22bd[_0x1822('0x1b')]?_[_0x1822('0x1d')](_0x5c22bd[_0x1822('0x1b')],function(_0x319bad){return{'model':db[_0x319bad['model']],'as':_0x319bad['as'],'attributes':_0x319bad[_0x1822('0x1a')],'include':_0x319bad[_0x1822('0x1b')]?_['map'](_0x319bad[_0x1822('0x1b')],function(_0xa6a5b3){return{'model':db[_0xa6a5b3[_0x1822('0x1c')]],'as':_0xa6a5b3['as'],'attributes':_0xa6a5b3[_0x1822('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1822('0xb')](function(_0x256ada){logger[_0x1822('0xc')]('ShowVtigerAccount',_0x170d8b);logger['debug'](_0x1822('0x1f'),_0x170d8b,JSON['stringify'](_0x256ada));_0x5bda9a(_0x256ada);})[_0x1822('0x15')](function(_0x599d7c){logger['error'](_0x1822('0x1f'),_0x599d7c['message'],_0x170d8b);_0x608563(_0xc06308[_0x1822('0x11')](0x1f4,_0x599d7c['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6ecaffc..9f42169 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x3f8080,_0x6c4522){var _0x51e000=function(_0x38c50d){while(--_0x38c50d){_0x3f8080['push'](_0x3f8080['shift']());}};_0x51e000(++_0x6c4522);}(_0x5f2f,0x73));var _0xf5f2=function(_0x347d15,_0x177ed4){_0x347d15=_0x347d15-0x0;var _0x49c918=_0x5f2f[_0x347d15];return _0x49c918;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 13d05b8..e675ed7 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 _0x2e39=['sequelize','STRING'];(function(_0xcc24e8,_0x230fe5){var _0x279917=function(_0x5838ad){while(--_0x5838ad){_0xcc24e8['push'](_0xcc24e8['shift']());}};_0x279917(++_0x230fe5);}(_0x2e39,0xac));var _0x92e3=function(_0x372e3e,_0x2b05ff){_0x372e3e=_0x372e3e-0x0;var _0x132d93=_0x2e39[_0x372e3e];return _0x132d93;};'use strict';var Sequelize=require(_0x92e3('0x0'));module['exports']={'name':{'type':Sequelize[_0x92e3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x447a=['sequelize','exports','STRING'];(function(_0x298b53,_0x3f830d){var _0x370c14=function(_0x16a8d7){while(--_0x16a8d7){_0x298b53['push'](_0x298b53['shift']());}};_0x370c14(++_0x3f830d);}(_0x447a,0x1d4));var _0xa447=function(_0x159eab,_0x22d972){_0x159eab=_0x159eab-0x0;var _0x47e933=_0x447a[_0x159eab];return _0x47e933;};'use strict';var Sequelize=require(_0xa447('0x0'));module[_0xa447('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa447('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7757f87..3dc9c45 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 _0x1776=['catch','create','body','hasOwnProperty','limit','getFields','VtigerField','getSubjects','getDescriptions','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','status','json','count','offset','Content-Range','reject','update','destroy','then','end','stack','name','index','map','VtigerConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','length','includeAll','find'];(function(_0x51731f,_0x15b4ce){var _0x35d00b=function(_0x3031d2){while(--_0x3031d2){_0x51731f['push'](_0x51731f['shift']());}};_0x35d00b(++_0x15b4ce);}(_0x1776,0x15a));var _0x6177=function(_0x51ba20,_0x50bf39){_0x51ba20=_0x51ba20-0x0;var _0x773908=_0x1776[_0x51ba20];return _0x773908;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6177('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6177('0x1'));var rp=require(_0x6177('0x2'));var moment=require(_0x6177('0x3'));var BPromise=require(_0x6177('0x4'));var Mustache=require(_0x6177('0x5'));var util=require('util');var path=require(_0x6177('0x6'));var sox=require(_0x6177('0x7'));var csv=require(_0x6177('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6177('0x9'));var crypto=require(_0x6177('0xa'));var jsforce=require(_0x6177('0xb'));var deskjs=require(_0x6177('0xc'));var toCsv=require(_0x6177('0x8'));var querystring=require(_0x6177('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6177('0xe'));var as=require(_0x6177('0xf'));var hardwareService=require(_0x6177('0x10'));var logger=require(_0x6177('0x11'))(_0x6177('0x12'));var utils=require(_0x6177('0x13'));var config=require(_0x6177('0x14'));var licenseUtil=require(_0x6177('0x15'));var db=require(_0x6177('0x16'))['db'];var jayson=require(_0x6177('0x17'));var client=jayson[_0x6177('0x18')][_0x6177('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x380097,_0x97ee35,_0x497729,_0x1eed7c){return new BPromise(function(_0x5b7b45,_0x423e7e){var _0x365ad0=_0x1eed7c||client;return _0x365ad0[_0x6177('0x1a')](_0x380097,_0x497729)['then'](function(_0x1d144c){logger[_0x6177('0x1b')](_0x6177('0x1c'),_0x97ee35,_0x6177('0x1d'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x97ee35,_0x6177('0x1d'),JSON['stringify'](_0x1d144c));if(_0x1d144c[_0x6177('0x1e')]){if(_0x1d144c[_0x6177('0x1e')][_0x6177('0x1f')]===0x1f4){logger['error'](_0x6177('0x1c'),_0x97ee35,_0x1d144c[_0x6177('0x1e')]['message']);return _0x423e7e(_0x1d144c['error']['message']);}logger[_0x6177('0x1e')](_0x6177('0x1c'),_0x97ee35,_0x1d144c[_0x6177('0x1e')][_0x6177('0x20')]);return _0x5b7b45(_0x1d144c[_0x6177('0x1e')][_0x6177('0x20')]);}else{logger['info'](_0x6177('0x1c'),_0x97ee35,'request\x20sent');_0x5b7b45(_0x1d144c['result'][_0x6177('0x20')]);}})['catch'](function(_0x15342a){logger['error'](_0x6177('0x1c'),_0x97ee35,_0x15342a);_0x423e7e(_0x15342a);});});}function respondWithStatusCode(_0x4abb90,_0x237383){_0x237383=_0x237383||0xcc;return function(_0x2033ec){if(_0x2033ec){return _0x4abb90['sendStatus'](_0x237383);}return _0x4abb90[_0x6177('0x21')](_0x237383)['end']();};}function respondWithResult(_0x5c09b2,_0x41f2d1){_0x41f2d1=_0x41f2d1||0xc8;return function(_0x3a16d1){if(_0x3a16d1){return _0x5c09b2[_0x6177('0x21')](_0x41f2d1)[_0x6177('0x22')](_0x3a16d1);}};}function respondWithFilteredResult(_0x590167,_0x453fd8){return function(_0x572657){if(_0x572657){var _0x2f1de1=_0x572657[_0x6177('0x23')],_0x4233a1=_0x453fd8['offset'],_0x1567fb=_0x453fd8[_0x6177('0x24')]+_0x453fd8['limit'],_0x3748ee;if(_0x1567fb>=_0x2f1de1){_0x1567fb=_0x2f1de1;_0x3748ee=0xc8;}else{_0x3748ee=0xce;}_0x590167[_0x6177('0x21')](_0x3748ee);return _0x590167['set'](_0x6177('0x25'),_0x4233a1+'-'+_0x1567fb+'/'+_0x2f1de1)[_0x6177('0x22')](_0x572657);}return null;};}function patchUpdates(_0x42c33b){return function(_0x331749){try{jsonpatch['apply'](_0x331749,_0x42c33b,!![]);}catch(_0x4e25c6){return BPromise[_0x6177('0x26')](_0x4e25c6);}return _0x331749['save']();};}function saveUpdates(_0x15658f,_0x15e4d1){return function(_0x1000d6){if(_0x1000d6){return _0x1000d6[_0x6177('0x27')](_0x15658f)['then'](function(_0x4a4f2a){return _0x4a4f2a;});}return null;};}function removeEntity(_0xb4fc3d,_0x9d1a25){return function(_0x64314a){if(_0x64314a){return _0x64314a[_0x6177('0x28')]()[_0x6177('0x29')](function(){_0xb4fc3d[_0x6177('0x21')](0xcc)[_0x6177('0x2a')]();});}};}function handleEntityNotFound(_0x3da9fa,_0x5f5ee3){return function(_0x23cad5){if(!_0x23cad5){_0x3da9fa['sendStatus'](0x194);}return _0x23cad5;};}function handleError(_0x5601f7,_0x5f5120){_0x5f5120=_0x5f5120||0x1f4;return function(_0x341d22){logger[_0x6177('0x1e')](_0x341d22[_0x6177('0x2b')]);if(_0x341d22[_0x6177('0x2c')]){delete _0x341d22['name'];}_0x5601f7[_0x6177('0x21')](_0x5f5120)['send'](_0x341d22);};}exports[_0x6177('0x2d')]=function(_0x17ad12,_0xccafe7){var _0x3b3a39={},_0x26b4f2={},_0x43c665={'count':0x0,'rows':[]};var _0x2a0ac4=_[_0x6177('0x2e')](db[_0x6177('0x2f')]['rawAttributes'],function(_0x235368){return{'name':_0x235368[_0x6177('0x30')],'type':_0x235368[_0x6177('0x31')]['key']};});_0x26b4f2[_0x6177('0x32')]=_['map'](_0x2a0ac4,_0x6177('0x2c'));_0x26b4f2[_0x6177('0x33')]=_[_0x6177('0x34')](_0x17ad12['query']);_0x26b4f2[_0x6177('0x35')]=_['intersection'](_0x26b4f2[_0x6177('0x32')],_0x26b4f2[_0x6177('0x33')]);_0x3b3a39['attributes']=_[_0x6177('0x36')](_0x26b4f2[_0x6177('0x32')],qs[_0x6177('0x37')](_0x17ad12[_0x6177('0x33')]['fields']));_0x3b3a39['attributes']=_0x3b3a39[_0x6177('0x38')]['length']?_0x3b3a39['attributes']:_0x26b4f2[_0x6177('0x32')];if(!_0x17ad12['query']['hasOwnProperty'](_0x6177('0x39'))){_0x3b3a39['limit']=qs['limit'](_0x17ad12[_0x6177('0x33')]['limit']);_0x3b3a39['offset']=qs[_0x6177('0x24')](_0x17ad12[_0x6177('0x33')]['offset']);}_0x3b3a39[_0x6177('0x3a')]=qs['sort'](_0x17ad12[_0x6177('0x33')][_0x6177('0x3b')]);_0x3b3a39[_0x6177('0x3c')]=qs['filters'](_[_0x6177('0x3d')](_0x17ad12['query'],_0x26b4f2[_0x6177('0x35')]),_0x2a0ac4);if(_0x17ad12[_0x6177('0x33')]['filter']){_0x3b3a39[_0x6177('0x3c')]=_[_0x6177('0x3e')](_0x3b3a39['where'],{'$or':_[_0x6177('0x2e')](_0x2a0ac4,function(_0x34157e){if(_0x34157e[_0x6177('0x31')]!==_0x6177('0x3f')){var _0x1dda6c={};_0x1dda6c[_0x34157e[_0x6177('0x2c')]]={'$like':'%'+_0x17ad12[_0x6177('0x33')][_0x6177('0x40')]+'%'};return _0x1dda6c;}})});}_0x3b3a39=_['merge']({},_0x3b3a39,_0x17ad12[_0x6177('0x41')]);var _0x5b2cbf={'where':_0x3b3a39[_0x6177('0x3c')]};return db[_0x6177('0x2f')][_0x6177('0x23')](_0x5b2cbf)[_0x6177('0x29')](function(_0x4568c3){_0x43c665[_0x6177('0x23')]=_0x4568c3;if(_0x17ad12['query']['includeAll']){_0x3b3a39[_0x6177('0x42')]=[{'all':!![]}];}return db[_0x6177('0x2f')][_0x6177('0x43')](_0x3b3a39);})[_0x6177('0x29')](function(_0x1c53d0){_0x43c665[_0x6177('0x44')]=_0x1c53d0;return _0x43c665;})[_0x6177('0x29')](respondWithFilteredResult(_0xccafe7,_0x3b3a39))['catch'](handleError(_0xccafe7,null));};exports['show']=function(_0xebb0c0,_0x43b5bf){var _0x1e6e9c={'raw':![],'where':{'id':_0xebb0c0[_0x6177('0x45')]['id']}},_0x82194b={};_0x82194b[_0x6177('0x32')]=_[_0x6177('0x34')](db[_0x6177('0x2f')][_0x6177('0x46')]);_0x82194b[_0x6177('0x33')]=_[_0x6177('0x34')](_0xebb0c0[_0x6177('0x33')]);_0x82194b[_0x6177('0x35')]=_[_0x6177('0x36')](_0x82194b[_0x6177('0x32')],_0x82194b['query']);_0x1e6e9c[_0x6177('0x38')]=_['intersection'](_0x82194b[_0x6177('0x32')],qs['fields'](_0xebb0c0[_0x6177('0x33')][_0x6177('0x37')]));_0x1e6e9c[_0x6177('0x38')]=_0x1e6e9c['attributes'][_0x6177('0x47')]?_0x1e6e9c[_0x6177('0x38')]:_0x82194b[_0x6177('0x32')];if(_0xebb0c0[_0x6177('0x33')][_0x6177('0x48')]){_0x1e6e9c[_0x6177('0x42')]=[{'all':!![]}];}_0x1e6e9c=_[_0x6177('0x3e')]({},_0x1e6e9c,_0xebb0c0[_0x6177('0x41')]);return db[_0x6177('0x2f')][_0x6177('0x49')](_0x1e6e9c)['then'](handleEntityNotFound(_0x43b5bf,null))[_0x6177('0x29')](respondWithResult(_0x43b5bf,null))[_0x6177('0x4a')](handleError(_0x43b5bf,null));};exports[_0x6177('0x4b')]=function(_0x3545c1,_0x1639bb){return db[_0x6177('0x2f')][_0x6177('0x4b')](_0x3545c1[_0x6177('0x4c')],{})[_0x6177('0x29')](respondWithResult(_0x1639bb,0xc9))[_0x6177('0x4a')](handleError(_0x1639bb,null));};exports[_0x6177('0x27')]=function(_0xd94b03,_0x344b74){if(_0xd94b03[_0x6177('0x4c')]['id']){delete _0xd94b03[_0x6177('0x4c')]['id'];}return db['VtigerConfiguration'][_0x6177('0x49')]({'where':{'id':_0xd94b03['params']['id']}})[_0x6177('0x29')](handleEntityNotFound(_0x344b74,null))[_0x6177('0x29')](saveUpdates(_0xd94b03[_0x6177('0x4c')],null))[_0x6177('0x29')](respondWithResult(_0x344b74,null))[_0x6177('0x4a')](handleError(_0x344b74,null));};exports[_0x6177('0x28')]=function(_0x44302a,_0x5c7dd5){return db[_0x6177('0x2f')][_0x6177('0x49')]({'where':{'id':_0x44302a[_0x6177('0x45')]['id']}})[_0x6177('0x29')](handleEntityNotFound(_0x5c7dd5,null))[_0x6177('0x29')](removeEntity(_0x5c7dd5,null))['catch'](handleError(_0x5c7dd5,null));};exports['getFields']=function(_0x5e0bb7,_0xa45ecf,_0x421c8e){var _0x48932e={};var _0xab1c8d={};var _0x414ab4;var _0xa0aee;return db[_0x6177('0x2f')]['findOne']({'where':{'id':_0x5e0bb7['params']['id']}})[_0x6177('0x29')](handleEntityNotFound(_0xa45ecf,null))[_0x6177('0x29')](function(_0x4f89ff){if(_0x4f89ff){_0x414ab4=_0x4f89ff;_0xab1c8d[_0x6177('0x32')]=_['keys'](db['VtigerField'][_0x6177('0x46')]);_0xab1c8d[_0x6177('0x33')]=_[_0x6177('0x34')](_0x5e0bb7[_0x6177('0x33')]);_0xab1c8d[_0x6177('0x35')]=_['intersection'](_0xab1c8d[_0x6177('0x32')],_0xab1c8d[_0x6177('0x33')]);_0x48932e[_0x6177('0x38')]=_[_0x6177('0x36')](_0xab1c8d[_0x6177('0x32')],qs[_0x6177('0x37')](_0x5e0bb7['query'][_0x6177('0x37')]));_0x48932e[_0x6177('0x38')]=_0x48932e[_0x6177('0x38')]['length']?_0x48932e['attributes']:_0xab1c8d[_0x6177('0x32')];_0x48932e[_0x6177('0x3a')]=qs['sort'](_0x5e0bb7[_0x6177('0x33')]['sort']);_0x48932e[_0x6177('0x3c')]=qs[_0x6177('0x35')](_[_0x6177('0x3d')](_0x5e0bb7[_0x6177('0x33')],_0xab1c8d[_0x6177('0x35')]));if(_0x5e0bb7['query'][_0x6177('0x40')]){_0x48932e[_0x6177('0x3c')]=_['merge'](_0x48932e['where'],{'$or':_[_0x6177('0x2e')](_0x48932e[_0x6177('0x38')],function(_0x354f2b){var _0x4649ec={};_0x4649ec[_0x354f2b]={'$like':'%'+_0x5e0bb7[_0x6177('0x33')][_0x6177('0x40')]+'%'};return _0x4649ec;})});}_0x48932e=_[_0x6177('0x3e')]({},_0x48932e,_0x5e0bb7[_0x6177('0x41')]);return _0x414ab4['getFields'](_0x48932e);}})[_0x6177('0x29')](function(_0x353e83){if(_0x353e83){_0xa0aee=_0x353e83[_0x6177('0x47')];if(!_0x5e0bb7[_0x6177('0x33')][_0x6177('0x4d')](_0x6177('0x39'))){_0x48932e['limit']=qs[_0x6177('0x4e')](_0x5e0bb7['query']['limit']);_0x48932e['offset']=qs[_0x6177('0x24')](_0x5e0bb7['query']['offset']);}return _0x414ab4[_0x6177('0x4f')](_0x48932e);}})[_0x6177('0x29')](function(_0x38c036){if(_0x38c036){return _0x38c036?{'count':_0xa0aee,'rows':_0x38c036}:null;}})[_0x6177('0x29')](respondWithResult(_0xa45ecf,null))['catch'](handleError(_0xa45ecf,null));};exports['getSubjects']=function(_0x4aa4f9,_0x24768f,_0x14a6c2){var _0x5920cd={};var _0x2f4d89={};var _0x3cf4e2;var _0x530d30;return db[_0x6177('0x2f')]['findOne']({'where':{'id':_0x4aa4f9[_0x6177('0x45')]['id']}})[_0x6177('0x29')](handleEntityNotFound(_0x24768f,null))[_0x6177('0x29')](function(_0x105324){if(_0x105324){_0x3cf4e2=_0x105324;_0x2f4d89[_0x6177('0x32')]=_[_0x6177('0x34')](db[_0x6177('0x50')]['rawAttributes']);_0x2f4d89[_0x6177('0x33')]=_['keys'](_0x4aa4f9[_0x6177('0x33')]);_0x2f4d89['filters']=_[_0x6177('0x36')](_0x2f4d89[_0x6177('0x32')],_0x2f4d89[_0x6177('0x33')]);_0x5920cd[_0x6177('0x38')]=_[_0x6177('0x36')](_0x2f4d89[_0x6177('0x32')],qs['fields'](_0x4aa4f9[_0x6177('0x33')][_0x6177('0x37')]));_0x5920cd[_0x6177('0x38')]=_0x5920cd[_0x6177('0x38')][_0x6177('0x47')]?_0x5920cd[_0x6177('0x38')]:_0x2f4d89['model'];_0x5920cd[_0x6177('0x3a')]=qs[_0x6177('0x3b')](_0x4aa4f9['query'][_0x6177('0x3b')]);_0x5920cd[_0x6177('0x3c')]=qs[_0x6177('0x35')](_['pick'](_0x4aa4f9[_0x6177('0x33')],_0x2f4d89['filters']));if(_0x4aa4f9['query']['filter']){_0x5920cd[_0x6177('0x3c')]=_['merge'](_0x5920cd[_0x6177('0x3c')],{'$or':_['map'](_0x5920cd[_0x6177('0x38')],function(_0x66cb2f){var _0x1bc935={};_0x1bc935[_0x66cb2f]={'$like':'%'+_0x4aa4f9[_0x6177('0x33')][_0x6177('0x40')]+'%'};return _0x1bc935;})});}_0x5920cd=_[_0x6177('0x3e')]({},_0x5920cd,_0x4aa4f9['options']);return _0x3cf4e2[_0x6177('0x51')](_0x5920cd);}})[_0x6177('0x29')](function(_0x1053a6){if(_0x1053a6){_0x530d30=_0x1053a6[_0x6177('0x47')];if(!_0x4aa4f9['query'][_0x6177('0x4d')](_0x6177('0x39'))){_0x5920cd['limit']=qs[_0x6177('0x4e')](_0x4aa4f9[_0x6177('0x33')][_0x6177('0x4e')]);_0x5920cd[_0x6177('0x24')]=qs['offset'](_0x4aa4f9[_0x6177('0x33')][_0x6177('0x24')]);}return _0x3cf4e2[_0x6177('0x51')](_0x5920cd);}})['then'](function(_0x7c31bb){if(_0x7c31bb){return _0x7c31bb?{'count':_0x530d30,'rows':_0x7c31bb}:null;}})[_0x6177('0x29')](respondWithResult(_0x24768f,null))[_0x6177('0x4a')](handleError(_0x24768f,null));};exports[_0x6177('0x52')]=function(_0x289e1e,_0x2148a4,_0x25fb7f){var _0x2795e4={};var _0x11b63f={};var _0x54543b;var _0x1a361b;return db[_0x6177('0x2f')][_0x6177('0x53')]({'where':{'id':_0x289e1e[_0x6177('0x45')]['id']}})[_0x6177('0x29')](handleEntityNotFound(_0x2148a4,null))['then'](function(_0x468793){if(_0x468793){_0x54543b=_0x468793;_0x11b63f['model']=_['keys'](db[_0x6177('0x50')]['rawAttributes']);_0x11b63f[_0x6177('0x33')]=_[_0x6177('0x34')](_0x289e1e['query']);_0x11b63f[_0x6177('0x35')]=_[_0x6177('0x36')](_0x11b63f[_0x6177('0x32')],_0x11b63f['query']);_0x2795e4['attributes']=_[_0x6177('0x36')](_0x11b63f[_0x6177('0x32')],qs['fields'](_0x289e1e[_0x6177('0x33')][_0x6177('0x37')]));_0x2795e4[_0x6177('0x38')]=_0x2795e4[_0x6177('0x38')][_0x6177('0x47')]?_0x2795e4[_0x6177('0x38')]:_0x11b63f[_0x6177('0x32')];_0x2795e4['order']=qs[_0x6177('0x3b')](_0x289e1e['query'][_0x6177('0x3b')]);_0x2795e4['where']=qs[_0x6177('0x35')](_[_0x6177('0x3d')](_0x289e1e[_0x6177('0x33')],_0x11b63f[_0x6177('0x35')]));if(_0x289e1e[_0x6177('0x33')]['filter']){_0x2795e4[_0x6177('0x3c')]=_['merge'](_0x2795e4[_0x6177('0x3c')],{'$or':_[_0x6177('0x2e')](_0x2795e4[_0x6177('0x38')],function(_0xa5a7e3){var _0x40e07a={};_0x40e07a[_0xa5a7e3]={'$like':'%'+_0x289e1e[_0x6177('0x33')][_0x6177('0x40')]+'%'};return _0x40e07a;})});}_0x2795e4=_['merge']({},_0x2795e4,_0x289e1e['options']);return _0x54543b[_0x6177('0x52')](_0x2795e4);}})['then'](function(_0x303d72){if(_0x303d72){_0x1a361b=_0x303d72[_0x6177('0x47')];if(!_0x289e1e[_0x6177('0x33')][_0x6177('0x4d')](_0x6177('0x39'))){_0x2795e4[_0x6177('0x4e')]=qs['limit'](_0x289e1e['query']['limit']);_0x2795e4[_0x6177('0x24')]=qs['offset'](_0x289e1e['query'][_0x6177('0x24')]);}return _0x54543b[_0x6177('0x52')](_0x2795e4);}})[_0x6177('0x29')](function(_0x1720e0){if(_0x1720e0){return _0x1720e0?{'count':_0x1a361b,'rows':_0x1720e0}:null;}})[_0x6177('0x29')](respondWithResult(_0x2148a4,null))[_0x6177('0x4a')](handleError(_0x2148a4,null));}; \ No newline at end of file +var _0x22fd=['options','includeAll','include','findAll','rows','show','length','create','body','update','find','params','VtigerField','hasOwnProperty','getFields','getSubjects','findOne','getDescriptions','html-pdf','rimraf','request-promise','moment','bluebird','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','request','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x4211c7,_0x4db64e){var _0x1b6f33=function(_0x564a2f){while(--_0x564a2f){_0x4211c7['push'](_0x4211c7['shift']());}};_0x1b6f33(++_0x4db64e);}(_0x22fd,0x166));var _0xd22f=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x22fd[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require(_0xd22f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd22f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd22f('0x2'));var moment=require(_0xd22f('0x3'));var BPromise=require(_0xd22f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd22f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd22f('0x6'));var squel=require('squel');var crypto=require(_0xd22f('0x7'));var jsforce=require(_0xd22f('0x8'));var deskjs=require(_0xd22f('0x9'));var toCsv=require(_0xd22f('0xa'));var querystring=require(_0xd22f('0xb'));var Papa=require('papaparse');var Redis=require(_0xd22f('0xc'));var authService=require(_0xd22f('0xd'));var qs=require(_0xd22f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd22f('0xf'));var logger=require(_0xd22f('0x10'))(_0xd22f('0x11'));var utils=require(_0xd22f('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd22f('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd22f('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45c7d7,_0x81274e,_0x1c56fe,_0x80cec2){return new BPromise(function(_0x5a4787,_0x562598){var _0x52678d=_0x80cec2||client;return _0x52678d[_0xd22f('0x15')](_0x45c7d7,_0x1c56fe)['then'](function(_0x10f16b){logger['info'](_0xd22f('0x16'),_0x81274e,'request\x20sent');logger['debug'](_0xd22f('0x17'),_0x81274e,_0xd22f('0x18'),JSON['stringify'](_0x10f16b));if(_0x10f16b[_0xd22f('0x19')]){if(_0x10f16b[_0xd22f('0x19')][_0xd22f('0x1a')]===0x1f4){logger[_0xd22f('0x19')](_0xd22f('0x16'),_0x81274e,_0x10f16b[_0xd22f('0x19')][_0xd22f('0x1b')]);return _0x562598(_0x10f16b['error'][_0xd22f('0x1b')]);}logger[_0xd22f('0x19')](_0xd22f('0x16'),_0x81274e,_0x10f16b[_0xd22f('0x19')][_0xd22f('0x1b')]);return _0x5a4787(_0x10f16b[_0xd22f('0x19')]['message']);}else{logger[_0xd22f('0x1c')](_0xd22f('0x16'),_0x81274e,'request\x20sent');_0x5a4787(_0x10f16b['result'][_0xd22f('0x1b')]);}})[_0xd22f('0x1d')](function(_0x4d0cf2){logger[_0xd22f('0x19')](_0xd22f('0x16'),_0x81274e,_0x4d0cf2);_0x562598(_0x4d0cf2);});});}function respondWithStatusCode(_0x1aaf3d,_0x20bd97){_0x20bd97=_0x20bd97||0xcc;return function(_0x100ee3){if(_0x100ee3){return _0x1aaf3d[_0xd22f('0x1e')](_0x20bd97);}return _0x1aaf3d[_0xd22f('0x1f')](_0x20bd97)[_0xd22f('0x20')]();};}function respondWithResult(_0x5c458a,_0xee3fc6){_0xee3fc6=_0xee3fc6||0xc8;return function(_0xa124c3){if(_0xa124c3){return _0x5c458a[_0xd22f('0x1f')](_0xee3fc6)[_0xd22f('0x21')](_0xa124c3);}};}function respondWithFilteredResult(_0x33598a,_0x4a753f){return function(_0x13044f){if(_0x13044f){var _0x301f41=_0x13044f[_0xd22f('0x22')],_0x3269f5=_0x4a753f['offset'],_0x303084=_0x4a753f[_0xd22f('0x23')]+_0x4a753f[_0xd22f('0x24')],_0x3dc5bd;if(_0x303084>=_0x301f41){_0x303084=_0x301f41;_0x3dc5bd=0xc8;}else{_0x3dc5bd=0xce;}_0x33598a[_0xd22f('0x1f')](_0x3dc5bd);return _0x33598a[_0xd22f('0x25')]('Content-Range',_0x3269f5+'-'+_0x303084+'/'+_0x301f41)[_0xd22f('0x21')](_0x13044f);}return null;};}function patchUpdates(_0x3e2252){return function(_0x1a6054){try{jsonpatch[_0xd22f('0x26')](_0x1a6054,_0x3e2252,!![]);}catch(_0x548fbb){return BPromise[_0xd22f('0x27')](_0x548fbb);}return _0x1a6054[_0xd22f('0x28')]();};}function saveUpdates(_0x3ddf58,_0x3b5c36){return function(_0x37862f){if(_0x37862f){return _0x37862f['update'](_0x3ddf58)[_0xd22f('0x29')](function(_0x203499){return _0x203499;});}return null;};}function removeEntity(_0x51ea25,_0x31b159){return function(_0x2f7f93){if(_0x2f7f93){return _0x2f7f93[_0xd22f('0x2a')]()[_0xd22f('0x29')](function(){_0x51ea25[_0xd22f('0x1f')](0xcc)[_0xd22f('0x20')]();});}};}function handleEntityNotFound(_0x403add,_0x1126c2){return function(_0x346e51){if(!_0x346e51){_0x403add[_0xd22f('0x1e')](0x194);}return _0x346e51;};}function handleError(_0x2b7871,_0xddbcc1){_0xddbcc1=_0xddbcc1||0x1f4;return function(_0x160acf){logger['error'](_0x160acf[_0xd22f('0x2b')]);if(_0x160acf[_0xd22f('0x2c')]){delete _0x160acf[_0xd22f('0x2c')];}_0x2b7871[_0xd22f('0x1f')](_0xddbcc1)[_0xd22f('0x2d')](_0x160acf);};}exports[_0xd22f('0x2e')]=function(_0x17f80f,_0x415081){var _0x1b91d3={},_0x17ae8f={},_0x5eb17d={'count':0x0,'rows':[]};var _0x5652b8=_[_0xd22f('0x2f')](db[_0xd22f('0x30')][_0xd22f('0x31')],function(_0x58c64a){return{'name':_0x58c64a[_0xd22f('0x32')],'type':_0x58c64a['type'][_0xd22f('0x33')]};});_0x17ae8f[_0xd22f('0x34')]=_['map'](_0x5652b8,_0xd22f('0x2c'));_0x17ae8f[_0xd22f('0x35')]=_[_0xd22f('0x36')](_0x17f80f[_0xd22f('0x35')]);_0x17ae8f[_0xd22f('0x37')]=_[_0xd22f('0x38')](_0x17ae8f[_0xd22f('0x34')],_0x17ae8f['query']);_0x1b91d3[_0xd22f('0x39')]=_[_0xd22f('0x38')](_0x17ae8f[_0xd22f('0x34')],qs[_0xd22f('0x3a')](_0x17f80f['query'][_0xd22f('0x3a')]));_0x1b91d3[_0xd22f('0x39')]=_0x1b91d3[_0xd22f('0x39')]['length']?_0x1b91d3[_0xd22f('0x39')]:_0x17ae8f[_0xd22f('0x34')];if(!_0x17f80f[_0xd22f('0x35')]['hasOwnProperty'](_0xd22f('0x3b'))){_0x1b91d3[_0xd22f('0x24')]=qs[_0xd22f('0x24')](_0x17f80f[_0xd22f('0x35')][_0xd22f('0x24')]);_0x1b91d3['offset']=qs[_0xd22f('0x23')](_0x17f80f[_0xd22f('0x35')][_0xd22f('0x23')]);}_0x1b91d3[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0x17f80f[_0xd22f('0x35')][_0xd22f('0x3d')]);_0x1b91d3[_0xd22f('0x3e')]=qs[_0xd22f('0x37')](_[_0xd22f('0x3f')](_0x17f80f[_0xd22f('0x35')],_0x17ae8f[_0xd22f('0x37')]),_0x5652b8);if(_0x17f80f[_0xd22f('0x35')][_0xd22f('0x40')]){_0x1b91d3[_0xd22f('0x3e')]=_[_0xd22f('0x41')](_0x1b91d3[_0xd22f('0x3e')],{'$or':_[_0xd22f('0x2f')](_0x5652b8,function(_0x4c25de){if(_0x4c25de[_0xd22f('0x42')]!=='VIRTUAL'){var _0x21cab6={};_0x21cab6[_0x4c25de[_0xd22f('0x2c')]]={'$like':'%'+_0x17f80f[_0xd22f('0x35')][_0xd22f('0x40')]+'%'};return _0x21cab6;}})});}_0x1b91d3=_[_0xd22f('0x41')]({},_0x1b91d3,_0x17f80f[_0xd22f('0x43')]);var _0x2753e0={'where':_0x1b91d3[_0xd22f('0x3e')]};return db[_0xd22f('0x30')]['count'](_0x2753e0)[_0xd22f('0x29')](function(_0x52e5fd){_0x5eb17d[_0xd22f('0x22')]=_0x52e5fd;if(_0x17f80f[_0xd22f('0x35')][_0xd22f('0x44')]){_0x1b91d3[_0xd22f('0x45')]=[{'all':!![]}];}return db[_0xd22f('0x30')][_0xd22f('0x46')](_0x1b91d3);})[_0xd22f('0x29')](function(_0x38b5d3){_0x5eb17d[_0xd22f('0x47')]=_0x38b5d3;return _0x5eb17d;})[_0xd22f('0x29')](respondWithFilteredResult(_0x415081,_0x1b91d3))['catch'](handleError(_0x415081,null));};exports[_0xd22f('0x48')]=function(_0x5916e5,_0x16f6e){var _0x2dbe9e={'raw':![],'where':{'id':_0x5916e5['params']['id']}},_0x589953={};_0x589953[_0xd22f('0x34')]=_[_0xd22f('0x36')](db['VtigerConfiguration'][_0xd22f('0x31')]);_0x589953[_0xd22f('0x35')]=_[_0xd22f('0x36')](_0x5916e5[_0xd22f('0x35')]);_0x589953[_0xd22f('0x37')]=_[_0xd22f('0x38')](_0x589953[_0xd22f('0x34')],_0x589953[_0xd22f('0x35')]);_0x2dbe9e[_0xd22f('0x39')]=_[_0xd22f('0x38')](_0x589953['model'],qs[_0xd22f('0x3a')](_0x5916e5[_0xd22f('0x35')][_0xd22f('0x3a')]));_0x2dbe9e[_0xd22f('0x39')]=_0x2dbe9e[_0xd22f('0x39')][_0xd22f('0x49')]?_0x2dbe9e[_0xd22f('0x39')]:_0x589953[_0xd22f('0x34')];if(_0x5916e5[_0xd22f('0x35')]['includeAll']){_0x2dbe9e['include']=[{'all':!![]}];}_0x2dbe9e=_[_0xd22f('0x41')]({},_0x2dbe9e,_0x5916e5[_0xd22f('0x43')]);return db[_0xd22f('0x30')]['find'](_0x2dbe9e)[_0xd22f('0x29')](handleEntityNotFound(_0x16f6e,null))[_0xd22f('0x29')](respondWithResult(_0x16f6e,null))['catch'](handleError(_0x16f6e,null));};exports[_0xd22f('0x4a')]=function(_0x35a345,_0x379d5c){return db[_0xd22f('0x30')][_0xd22f('0x4a')](_0x35a345[_0xd22f('0x4b')],{})[_0xd22f('0x29')](respondWithResult(_0x379d5c,0xc9))[_0xd22f('0x1d')](handleError(_0x379d5c,null));};exports[_0xd22f('0x4c')]=function(_0x2c535f,_0x5f1297){if(_0x2c535f['body']['id']){delete _0x2c535f[_0xd22f('0x4b')]['id'];}return db[_0xd22f('0x30')][_0xd22f('0x4d')]({'where':{'id':_0x2c535f[_0xd22f('0x4e')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x5f1297,null))[_0xd22f('0x29')](saveUpdates(_0x2c535f['body'],null))[_0xd22f('0x29')](respondWithResult(_0x5f1297,null))[_0xd22f('0x1d')](handleError(_0x5f1297,null));};exports[_0xd22f('0x2a')]=function(_0x79cff,_0x18b98b){return db['VtigerConfiguration'][_0xd22f('0x4d')]({'where':{'id':_0x79cff[_0xd22f('0x4e')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x18b98b,null))[_0xd22f('0x29')](removeEntity(_0x18b98b,null))[_0xd22f('0x1d')](handleError(_0x18b98b,null));};exports['getFields']=function(_0x41228d,_0x279399,_0x2ffd81){var _0x3aacb5={};var _0x140e83={};var _0x8fa5d8;var _0x540a66;return db[_0xd22f('0x30')]['findOne']({'where':{'id':_0x41228d[_0xd22f('0x4e')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x279399,null))[_0xd22f('0x29')](function(_0x304703){if(_0x304703){_0x8fa5d8=_0x304703;_0x140e83['model']=_[_0xd22f('0x36')](db[_0xd22f('0x4f')][_0xd22f('0x31')]);_0x140e83[_0xd22f('0x35')]=_[_0xd22f('0x36')](_0x41228d[_0xd22f('0x35')]);_0x140e83[_0xd22f('0x37')]=_['intersection'](_0x140e83[_0xd22f('0x34')],_0x140e83['query']);_0x3aacb5['attributes']=_[_0xd22f('0x38')](_0x140e83['model'],qs[_0xd22f('0x3a')](_0x41228d[_0xd22f('0x35')][_0xd22f('0x3a')]));_0x3aacb5[_0xd22f('0x39')]=_0x3aacb5['attributes']['length']?_0x3aacb5[_0xd22f('0x39')]:_0x140e83[_0xd22f('0x34')];_0x3aacb5[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0x41228d[_0xd22f('0x35')][_0xd22f('0x3d')]);_0x3aacb5[_0xd22f('0x3e')]=qs[_0xd22f('0x37')](_['pick'](_0x41228d[_0xd22f('0x35')],_0x140e83[_0xd22f('0x37')]));if(_0x41228d[_0xd22f('0x35')][_0xd22f('0x40')]){_0x3aacb5[_0xd22f('0x3e')]=_[_0xd22f('0x41')](_0x3aacb5['where'],{'$or':_[_0xd22f('0x2f')](_0x3aacb5[_0xd22f('0x39')],function(_0x4a6ff5){var _0x1f0450={};_0x1f0450[_0x4a6ff5]={'$like':'%'+_0x41228d['query'][_0xd22f('0x40')]+'%'};return _0x1f0450;})});}_0x3aacb5=_['merge']({},_0x3aacb5,_0x41228d[_0xd22f('0x43')]);return _0x8fa5d8['getFields'](_0x3aacb5);}})[_0xd22f('0x29')](function(_0x389eab){if(_0x389eab){_0x540a66=_0x389eab[_0xd22f('0x49')];if(!_0x41228d[_0xd22f('0x35')][_0xd22f('0x50')](_0xd22f('0x3b'))){_0x3aacb5[_0xd22f('0x24')]=qs['limit'](_0x41228d[_0xd22f('0x35')]['limit']);_0x3aacb5[_0xd22f('0x23')]=qs['offset'](_0x41228d['query']['offset']);}return _0x8fa5d8[_0xd22f('0x51')](_0x3aacb5);}})['then'](function(_0x4b831f){if(_0x4b831f){return _0x4b831f?{'count':_0x540a66,'rows':_0x4b831f}:null;}})[_0xd22f('0x29')](respondWithResult(_0x279399,null))[_0xd22f('0x1d')](handleError(_0x279399,null));};exports[_0xd22f('0x52')]=function(_0x2a60d6,_0x5a4c71,_0x458fed){var _0x1bcb58={};var _0x4c5b8f={};var _0x6602;var _0x5ba5ad;return db['VtigerConfiguration'][_0xd22f('0x53')]({'where':{'id':_0x2a60d6[_0xd22f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a4c71,null))['then'](function(_0x1549a1){if(_0x1549a1){_0x6602=_0x1549a1;_0x4c5b8f[_0xd22f('0x34')]=_[_0xd22f('0x36')](db[_0xd22f('0x4f')][_0xd22f('0x31')]);_0x4c5b8f['query']=_[_0xd22f('0x36')](_0x2a60d6[_0xd22f('0x35')]);_0x4c5b8f[_0xd22f('0x37')]=_[_0xd22f('0x38')](_0x4c5b8f[_0xd22f('0x34')],_0x4c5b8f['query']);_0x1bcb58[_0xd22f('0x39')]=_[_0xd22f('0x38')](_0x4c5b8f[_0xd22f('0x34')],qs['fields'](_0x2a60d6['query'][_0xd22f('0x3a')]));_0x1bcb58[_0xd22f('0x39')]=_0x1bcb58[_0xd22f('0x39')][_0xd22f('0x49')]?_0x1bcb58[_0xd22f('0x39')]:_0x4c5b8f[_0xd22f('0x34')];_0x1bcb58[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0x2a60d6[_0xd22f('0x35')][_0xd22f('0x3d')]);_0x1bcb58[_0xd22f('0x3e')]=qs[_0xd22f('0x37')](_[_0xd22f('0x3f')](_0x2a60d6[_0xd22f('0x35')],_0x4c5b8f[_0xd22f('0x37')]));if(_0x2a60d6['query'][_0xd22f('0x40')]){_0x1bcb58[_0xd22f('0x3e')]=_[_0xd22f('0x41')](_0x1bcb58['where'],{'$or':_[_0xd22f('0x2f')](_0x1bcb58[_0xd22f('0x39')],function(_0x2ddbdf){var _0x1f9390={};_0x1f9390[_0x2ddbdf]={'$like':'%'+_0x2a60d6[_0xd22f('0x35')]['filter']+'%'};return _0x1f9390;})});}_0x1bcb58=_[_0xd22f('0x41')]({},_0x1bcb58,_0x2a60d6[_0xd22f('0x43')]);return _0x6602[_0xd22f('0x52')](_0x1bcb58);}})[_0xd22f('0x29')](function(_0xd93f24){if(_0xd93f24){_0x5ba5ad=_0xd93f24[_0xd22f('0x49')];if(!_0x2a60d6[_0xd22f('0x35')][_0xd22f('0x50')](_0xd22f('0x3b'))){_0x1bcb58[_0xd22f('0x24')]=qs[_0xd22f('0x24')](_0x2a60d6[_0xd22f('0x35')]['limit']);_0x1bcb58[_0xd22f('0x23')]=qs[_0xd22f('0x23')](_0x2a60d6[_0xd22f('0x35')][_0xd22f('0x23')]);}return _0x6602[_0xd22f('0x52')](_0x1bcb58);}})['then'](function(_0x22a064){if(_0x22a064){return _0x22a064?{'count':_0x5ba5ad,'rows':_0x22a064}:null;}})[_0xd22f('0x29')](respondWithResult(_0x5a4c71,null))['catch'](handleError(_0x5a4c71,null));};exports[_0xd22f('0x54')]=function(_0x324f80,_0x19d52e,_0x230ce2){var _0x1ec6e0={};var _0x30356b={};var _0x17eb1b;var _0x4a6517;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x324f80[_0xd22f('0x4e')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x19d52e,null))['then'](function(_0x18a61a){if(_0x18a61a){_0x17eb1b=_0x18a61a;_0x30356b['model']=_[_0xd22f('0x36')](db[_0xd22f('0x4f')][_0xd22f('0x31')]);_0x30356b[_0xd22f('0x35')]=_[_0xd22f('0x36')](_0x324f80[_0xd22f('0x35')]);_0x30356b[_0xd22f('0x37')]=_[_0xd22f('0x38')](_0x30356b['model'],_0x30356b[_0xd22f('0x35')]);_0x1ec6e0[_0xd22f('0x39')]=_['intersection'](_0x30356b[_0xd22f('0x34')],qs[_0xd22f('0x3a')](_0x324f80[_0xd22f('0x35')][_0xd22f('0x3a')]));_0x1ec6e0['attributes']=_0x1ec6e0[_0xd22f('0x39')]['length']?_0x1ec6e0[_0xd22f('0x39')]:_0x30356b['model'];_0x1ec6e0[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0x324f80[_0xd22f('0x35')][_0xd22f('0x3d')]);_0x1ec6e0[_0xd22f('0x3e')]=qs[_0xd22f('0x37')](_[_0xd22f('0x3f')](_0x324f80['query'],_0x30356b['filters']));if(_0x324f80[_0xd22f('0x35')]['filter']){_0x1ec6e0[_0xd22f('0x3e')]=_[_0xd22f('0x41')](_0x1ec6e0[_0xd22f('0x3e')],{'$or':_[_0xd22f('0x2f')](_0x1ec6e0[_0xd22f('0x39')],function(_0x41fd26){var _0x2a0b7c={};_0x2a0b7c[_0x41fd26]={'$like':'%'+_0x324f80[_0xd22f('0x35')][_0xd22f('0x40')]+'%'};return _0x2a0b7c;})});}_0x1ec6e0=_[_0xd22f('0x41')]({},_0x1ec6e0,_0x324f80[_0xd22f('0x43')]);return _0x17eb1b['getDescriptions'](_0x1ec6e0);}})['then'](function(_0xbfaa95){if(_0xbfaa95){_0x4a6517=_0xbfaa95[_0xd22f('0x49')];if(!_0x324f80[_0xd22f('0x35')]['hasOwnProperty'](_0xd22f('0x3b'))){_0x1ec6e0[_0xd22f('0x24')]=qs[_0xd22f('0x24')](_0x324f80[_0xd22f('0x35')][_0xd22f('0x24')]);_0x1ec6e0[_0xd22f('0x23')]=qs['offset'](_0x324f80[_0xd22f('0x35')][_0xd22f('0x23')]);}return _0x17eb1b['getDescriptions'](_0x1ec6e0);}})[_0xd22f('0x29')](function(_0x2e4754){if(_0x2e4754){return _0x2e4754?{'count':_0x4a6517,'rows':_0x2e4754}:null;}})['then'](respondWithResult(_0x19d52e,null))[_0xd22f('0x1d')](handleError(_0x19d52e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 42af6f6..6765fb0 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 _0xb566=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x3e0d81,_0x258d37){var _0x1fa8ca=function(_0x1997a2){while(--_0x1997a2){_0x3e0d81['push'](_0x3e0d81['shift']());}};_0x1fa8ca(++_0x258d37);}(_0xb566,0x1e8));var _0x6b56=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0xb566[_0xd39959];return _0x1ff69c;};'use strict';var _=require('lodash');var util=require(_0x6b56('0x0'));var logger=require(_0x6b56('0x1'))(_0x6b56('0x2'));var moment=require(_0x6b56('0x3'));var BPromise=require(_0x6b56('0x4'));var rp=require(_0x6b56('0x5'));var fs=require('fs');var path=require(_0x6b56('0x6'));var rimraf=require(_0x6b56('0x7'));var config=require(_0x6b56('0x8'));var attributes=require(_0x6b56('0x9'));module[_0x6b56('0xa')]=function(_0x5d7674,_0x42b9dd){return _0x5d7674[_0x6b56('0xb')](_0x6b56('0xc'),attributes,{'tableName':_0x6b56('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fb2=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment'];(function(_0x470c4c,_0x3a3cf2){var _0x50e81b=function(_0x41b94f){while(--_0x41b94f){_0x470c4c['push'](_0x470c4c['shift']());}};_0x50e81b(++_0x3a3cf2);}(_0x1fb2,0xad));var _0x21fb=function(_0x5d1c55,_0x6623c1){_0x5d1c55=_0x5d1c55-0x0;var _0x2f1e94=_0x1fb2[_0x5d1c55];return _0x2f1e94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x21fb('0x0'))(_0x21fb('0x1'));var moment=require(_0x21fb('0x2'));var BPromise=require(_0x21fb('0x3'));var rp=require(_0x21fb('0x4'));var fs=require('fs');var path=require(_0x21fb('0x5'));var rimraf=require(_0x21fb('0x6'));var config=require(_0x21fb('0x7'));var attributes=require(_0x21fb('0x8'));module['exports']=function(_0x2faa43,_0x483cc0){return _0x2faa43['define'](_0x21fb('0x9'),attributes,{'tableName':_0x21fb('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 ae6381e..a656dd0 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 _0x6534=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x21a13e,_0x47792c){var _0x5999f0=function(_0x2333b3){while(--_0x2333b3){_0x21a13e['push'](_0x21a13e['shift']());}};_0x5999f0(++_0x47792c);}(_0x6534,0x11f));var _0x4653=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6534[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4653('0x0'));var util=require(_0x4653('0x1'));var moment=require(_0x4653('0x2'));var BPromise=require(_0x4653('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4653('0x4'));var db=require(_0x4653('0x5'))['db'];var utils=require(_0x4653('0x6'));var logger=require('../../config/logger')(_0x4653('0x7'));var config=require(_0x4653('0x8'));var jayson=require(_0x4653('0x9'));var client=jayson[_0x4653('0xa')][_0x4653('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a8c52,_0x4c930c,_0x800330){return new BPromise(function(_0x2ed506,_0x2359e3){return client[_0x4653('0xc')](_0x2a8c52,_0x800330)[_0x4653('0xd')](function(_0x4331ad){logger[_0x4653('0xe')](_0x4653('0xf'),_0x4c930c,_0x4653('0x10'));logger['debug'](_0x4653('0x11'),_0x4c930c,_0x4653('0x10'),JSON['stringify'](_0x4331ad));if(_0x4331ad[_0x4653('0x12')]){if(_0x4331ad[_0x4653('0x12')][_0x4653('0x13')]===0x1f4){logger['error'](_0x4653('0xf'),_0x4c930c,_0x4331ad[_0x4653('0x12')][_0x4653('0x14')]);return _0x2359e3(_0x4331ad[_0x4653('0x12')]['message']);}logger[_0x4653('0x12')](_0x4653('0xf'),_0x4c930c,_0x4331ad['error']['message']);return _0x2ed506(_0x4331ad[_0x4653('0x12')][_0x4653('0x14')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x4c930c,_0x4653('0x10'));_0x2ed506(_0x4331ad[_0x4653('0x15')][_0x4653('0x14')]);}})[_0x4653('0x16')](function(_0x16f72c){logger[_0x4653('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x4c930c,_0x16f72c);_0x2359e3(_0x16f72c);});});} \ No newline at end of file +var _0x66d7=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x66d7,0x67));var _0x766d=function(_0x4ca1d8,_0x18a890){_0x4ca1d8=_0x4ca1d8-0x0;var _0x457762=_0x66d7[_0x4ca1d8];return _0x457762;};'use strict';var _=require(_0x766d('0x0'));var util=require('util');var moment=require(_0x766d('0x1'));var BPromise=require(_0x766d('0x2'));var rs=require(_0x766d('0x3'));var fs=require('fs');var Redis=require(_0x766d('0x4'));var db=require(_0x766d('0x5'))['db'];var utils=require(_0x766d('0x6'));var logger=require(_0x766d('0x7'))(_0x766d('0x8'));var config=require(_0x766d('0x9'));var jayson=require(_0x766d('0xa'));var client=jayson[_0x766d('0xb')][_0x766d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e3bb1,_0x17da4b,_0x1995f2){return new BPromise(function(_0x305ad9,_0x391ae1){return client[_0x766d('0xd')](_0x1e3bb1,_0x1995f2)['then'](function(_0x3867ef){logger['info'](_0x766d('0xe'),_0x17da4b,_0x766d('0xf'));logger[_0x766d('0x10')](_0x766d('0x11'),_0x17da4b,_0x766d('0xf'),JSON[_0x766d('0x12')](_0x3867ef));if(_0x3867ef[_0x766d('0x13')]){if(_0x3867ef['error']['code']===0x1f4){logger[_0x766d('0x13')](_0x766d('0xe'),_0x17da4b,_0x3867ef['error']['message']);return _0x391ae1(_0x3867ef[_0x766d('0x13')][_0x766d('0x14')]);}logger[_0x766d('0x13')](_0x766d('0xe'),_0x17da4b,_0x3867ef[_0x766d('0x13')][_0x766d('0x14')]);return _0x305ad9(_0x3867ef[_0x766d('0x13')][_0x766d('0x14')]);}else{logger[_0x766d('0x15')](_0x766d('0xe'),_0x17da4b,_0x766d('0xf'));_0x305ad9(_0x3867ef[_0x766d('0x16')][_0x766d('0x14')]);}})[_0x766d('0x17')](function(_0x1da3c8){logger['error'](_0x766d('0xe'),_0x17da4b,_0x1da3c8);_0x391ae1(_0x1da3c8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5401c7f..b7ae1f0 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 _0x5446=['./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x21fb55,_0x3cbbf9){var _0x44354c=function(_0x547497){while(--_0x547497){_0x21fb55['push'](_0x21fb55['shift']());}};_0x44354c(++_0x3cbbf9);}(_0x5446,0xab));var _0x6544=function(_0x2fd5ae,_0x247988){_0x2fd5ae=_0x2fd5ae-0x0;var _0x5a25e2=_0x5446[_0x2fd5ae];return _0x5a25e2;};'use strict';var multer=require(_0x6544('0x0'));var util=require('util');var path=require(_0x6544('0x1'));var timeout=require(_0x6544('0x2'));var express=require(_0x6544('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6544('0x4'));var config=require('../../config/environment');var controller=require(_0x6544('0x5'));router[_0x6544('0x6')]('/',auth[_0x6544('0x7')](),controller[_0x6544('0x8')]);router[_0x6544('0x6')](_0x6544('0x9'),auth[_0x6544('0x7')](),controller[_0x6544('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6544('0xb')]);router[_0x6544('0xc')]('/:id',auth[_0x6544('0x7')](),controller[_0x6544('0xd')]);router[_0x6544('0xe')](_0x6544('0x9'),auth[_0x6544('0x7')](),controller[_0x6544('0xf')]);module['exports']=router; \ No newline at end of file +var _0x82e9=['update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0x2c87ad,_0x2c2be0){var _0x5b4d8c=function(_0x33fcc1){while(--_0x33fcc1){_0x2c87ad['push'](_0x2c87ad['shift']());}};_0x5b4d8c(++_0x2c2be0);}(_0x82e9,0x1ac));var _0x982e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x82e9[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x982e('0x0'));var util=require(_0x982e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x982e('0x2'));var router=express[_0x982e('0x3')]();var auth=require(_0x982e('0x4'));var interaction=require(_0x982e('0x5'));var config=require('../../config/environment');var controller=require(_0x982e('0x6'));router[_0x982e('0x7')]('/',auth[_0x982e('0x8')](),controller[_0x982e('0x9')]);router[_0x982e('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x982e('0xa')]('/',auth[_0x982e('0x8')](),controller[_0x982e('0xb')]);router[_0x982e('0xc')](_0x982e('0xd'),auth[_0x982e('0x8')](),controller[_0x982e('0xe')]);router[_0x982e('0xf')](_0x982e('0xd'),auth[_0x982e('0x8')](),controller[_0x982e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9b72db7..95cb0ed 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 _0x3eca=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3eca,0x17e));var _0xa3ec=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x3eca[_0x59befa];return _0x1dd63d;};'use strict';var Sequelize=require(_0xa3ec('0x0'));module[_0xa3ec('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa3ec('0x2'),_0xa3ec('0x3'),_0xa3ec('0x4'),_0xa3ec('0x5')),'defaultValue':_0xa3ec('0x2')},'content':{'type':Sequelize[_0xa3ec('0x6')]},'key':{'type':Sequelize[_0xa3ec('0x6')]},'keyType':{'type':Sequelize[_0xa3ec('0x7')](_0xa3ec('0x2'),_0xa3ec('0x3'),_0xa3ec('0x4'))},'keyContent':{'type':Sequelize[_0xa3ec('0x6')]},'idField':{'type':Sequelize[_0xa3ec('0x6')]},'nameField':{'type':Sequelize[_0xa3ec('0x6')]},'customField':{'type':Sequelize[_0xa3ec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa3ec('0x6')]}}; \ No newline at end of file +var _0xd89f=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x3fddbf,_0x1476ad){var _0x3df1f4=function(_0x47982f){while(--_0x47982f){_0x3fddbf['push'](_0x3fddbf['shift']());}};_0x3df1f4(++_0x1476ad);}(_0xd89f,0x191));var _0xfd89=function(_0x246d61,_0x3a37de){_0x246d61=_0x246d61-0x0;var _0x34dc82=_0xd89f[_0x246d61];return _0x34dc82;};'use strict';var Sequelize=require(_0xfd89('0x0'));module[_0xfd89('0x1')]={'type':{'type':Sequelize[_0xfd89('0x2')]('string',_0xfd89('0x3'),_0xfd89('0x4'),_0xfd89('0x5')),'defaultValue':_0xfd89('0x6')},'content':{'type':Sequelize[_0xfd89('0x7')]},'key':{'type':Sequelize[_0xfd89('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xfd89('0x6'),_0xfd89('0x3'),_0xfd89('0x4'))},'keyContent':{'type':Sequelize[_0xfd89('0x7')]},'idField':{'type':Sequelize[_0xfd89('0x7')]},'nameField':{'type':Sequelize[_0xfd89('0x7')]},'customField':{'type':Sequelize[_0xfd89('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfd89('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cdbe63a..05e5be7 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 _0xbd51=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv'];(function(_0x37ae15,_0x4c17a7){var _0x267b93=function(_0x4f2259){while(--_0x4f2259){_0x37ae15['push'](_0x37ae15['shift']());}};_0x267b93(++_0x4c17a7);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1a1bee,_0x3a6fef){_0x1a1bee=_0x1a1bee-0x0;var _0x56feff=_0xbd51[_0x1a1bee];return _0x56feff;};'use strict';var pdf=require(_0x1bd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1bd5('0x1'));var zipdir=require(_0x1bd5('0x2'));var jsonpatch=require(_0x1bd5('0x3'));var rp=require(_0x1bd5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1bd5('0x5'));var sox=require(_0x1bd5('0x6'));var csv=require(_0x1bd5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=_0xa63190[_0x1bd5('0x1a')],_0x2b2c57=_0x5072c2[_0x1bd5('0x1b')],_0x4793dd=_0x5072c2[_0x1bd5('0x1b')]+_0x5072c2[_0x1bd5('0x1c')],_0x43ea3e;if(_0x4793dd>=_0xc7277e){_0x4793dd=_0xc7277e;_0x43ea3e=0xc8;}else{_0x43ea3e=0xce;}_0x48d048['status'](_0x43ea3e);return _0x48d048['set'](_0x1bd5('0x1d'),_0x2b2c57+'-'+_0x4793dd+'/'+_0xc7277e)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x476bd1){return function(_0xb95d4e){try{jsonpatch[_0x1bd5('0x1e')](_0xb95d4e,_0x476bd1,!![]);}catch(_0x2ff39a){return BPromise[_0x1bd5('0x1f')](_0x2ff39a);}return _0xb95d4e[_0x1bd5('0x20')]();};}function saveUpdates(_0x456051,_0xb1ac1e){return function(_0x34bd6a){if(_0x34bd6a){return _0x34bd6a[_0x1bd5('0x21')](_0x456051)[_0x1bd5('0x22')](function(_0x7ff933){return _0x7ff933;});}return null;};}function removeEntity(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')]()['then'](function(){_0x253d79[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18fd18,_0x1e534e){return function(_0x3b6eb8){if(!_0x3b6eb8){_0x18fd18['sendStatus'](0x194);}return _0x3b6eb8;};}function handleError(_0x3f4156,_0x4fa37c){_0x4fa37c=_0x4fa37c||0x1f4;return function(_0x2ed551){logger[_0x1bd5('0x24')](_0x2ed551[_0x1bd5('0x25')]);if(_0x2ed551[_0x1bd5('0x26')]){delete _0x2ed551['name'];}_0x3f4156[_0x1bd5('0x18')](_0x4fa37c)[_0x1bd5('0x27')](_0x2ed551);};}exports[_0x1bd5('0x28')]=function(_0x3b1090,_0x4cebd0){var _0xdba332={},_0x24d4d9={},_0x3595e9={'count':0x0,'rows':[]};var _0x369b88=_[_0x1bd5('0x29')](db[_0x1bd5('0x2a')]['rawAttributes'],function(_0x289097){return{'name':_0x289097[_0x1bd5('0x2b')],'type':_0x289097[_0x1bd5('0x2c')]['key']};});_0x24d4d9[_0x1bd5('0x2d')]=_[_0x1bd5('0x29')](_0x369b88,_0x1bd5('0x26'));_0x24d4d9[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x3b1090[_0x1bd5('0x2e')]);_0x24d4d9['filters']=_['intersection'](_0x24d4d9[_0x1bd5('0x2d')],_0x24d4d9[_0x1bd5('0x2e')]);_0xdba332['attributes']=_[_0x1bd5('0x30')](_0x24d4d9[_0x1bd5('0x2d')],qs[_0x1bd5('0x31')](_0x3b1090[_0x1bd5('0x2e')]['fields']));_0xdba332[_0x1bd5('0x32')]=_0xdba332[_0x1bd5('0x32')][_0x1bd5('0x33')]?_0xdba332[_0x1bd5('0x32')]:_0x24d4d9[_0x1bd5('0x2d')];if(!_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x34')](_0x1bd5('0x35'))){_0xdba332['limit']=qs[_0x1bd5('0x1c')](_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x1c')]);_0xdba332[_0x1bd5('0x1b')]=qs[_0x1bd5('0x1b')](_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x1b')]);}_0xdba332['order']=qs[_0x1bd5('0x36')](_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x36')]);_0xdba332[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_[_0x1bd5('0x39')](_0x3b1090[_0x1bd5('0x2e')],_0x24d4d9['filters']),_0x369b88);if(_0x3b1090['query'][_0x1bd5('0x3a')]){_0xdba332[_0x1bd5('0x37')]=_[_0x1bd5('0x3b')](_0xdba332['where'],{'$or':_[_0x1bd5('0x29')](_0x369b88,function(_0x5af974){if(_0x5af974[_0x1bd5('0x2c')]!==_0x1bd5('0x3c')){var _0x3ee243={};_0x3ee243[_0x5af974[_0x1bd5('0x26')]]={'$like':'%'+_0x3b1090[_0x1bd5('0x2e')][_0x1bd5('0x3a')]+'%'};return _0x3ee243;}})});}_0xdba332=_[_0x1bd5('0x3b')]({},_0xdba332,_0x3b1090[_0x1bd5('0x3d')]);var _0x4bbefc={'where':_0xdba332[_0x1bd5('0x37')]};return db[_0x1bd5('0x2a')]['count'](_0x4bbefc)[_0x1bd5('0x22')](function(_0x77ebcf){_0x3595e9[_0x1bd5('0x1a')]=_0x77ebcf;if(_0x3b1090['query'][_0x1bd5('0x3e')]){_0xdba332[_0x1bd5('0x3f')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')][_0x1bd5('0x40')](_0xdba332);})['then'](function(_0x305720){_0x3595e9[_0x1bd5('0x41')]=_0x305720;return _0x3595e9;})[_0x1bd5('0x22')](respondWithFilteredResult(_0x4cebd0,_0xdba332))[_0x1bd5('0x42')](handleError(_0x4cebd0,null));};exports['show']=function(_0x52cef9,_0x40eeff){var _0x35afc7={'raw':!![],'where':{'id':_0x52cef9['params']['id']}},_0x453544={};_0x453544[_0x1bd5('0x2d')]=_[_0x1bd5('0x2f')](db['VtigerField'][_0x1bd5('0x43')]);_0x453544['query']=_[_0x1bd5('0x2f')](_0x52cef9[_0x1bd5('0x2e')]);_0x453544['filters']=_[_0x1bd5('0x30')](_0x453544[_0x1bd5('0x2d')],_0x453544[_0x1bd5('0x2e')]);_0x35afc7[_0x1bd5('0x32')]=_[_0x1bd5('0x30')](_0x453544[_0x1bd5('0x2d')],qs[_0x1bd5('0x31')](_0x52cef9[_0x1bd5('0x2e')][_0x1bd5('0x31')]));_0x35afc7[_0x1bd5('0x32')]=_0x35afc7[_0x1bd5('0x32')][_0x1bd5('0x33')]?_0x35afc7['attributes']:_0x453544[_0x1bd5('0x2d')];if(_0x52cef9[_0x1bd5('0x2e')][_0x1bd5('0x3e')]){_0x35afc7['include']=[{'all':!![]}];}_0x35afc7=_[_0x1bd5('0x3b')]({},_0x35afc7,_0x52cef9[_0x1bd5('0x3d')]);return db['VtigerField'][_0x1bd5('0x44')](_0x35afc7)['then'](handleEntityNotFound(_0x40eeff,null))[_0x1bd5('0x22')](respondWithResult(_0x40eeff,null))['catch'](handleError(_0x40eeff,null));};exports[_0x1bd5('0x45')]=function(_0xdd6c1a,_0x4f0c20){return db[_0x1bd5('0x2a')]['create'](_0xdd6c1a[_0x1bd5('0x46')],{})[_0x1bd5('0x22')](respondWithResult(_0x4f0c20,0xc9))[_0x1bd5('0x42')](handleError(_0x4f0c20,null));};exports[_0x1bd5('0x21')]=function(_0x26f7d2,_0x2dc037){if(_0x26f7d2[_0x1bd5('0x46')]['id']){delete _0x26f7d2[_0x1bd5('0x46')]['id'];}return db['VtigerField'][_0x1bd5('0x44')]({'where':{'id':_0x26f7d2[_0x1bd5('0x47')]['id']}})[_0x1bd5('0x22')](handleEntityNotFound(_0x2dc037,null))[_0x1bd5('0x22')](saveUpdates(_0x26f7d2[_0x1bd5('0x46')],null))[_0x1bd5('0x22')](respondWithResult(_0x2dc037,null))['catch'](handleError(_0x2dc037,null));};exports[_0x1bd5('0x23')]=function(_0x121bfb,_0x3ae0d2){return db[_0x1bd5('0x2a')][_0x1bd5('0x44')]({'where':{'id':_0x121bfb[_0x1bd5('0x47')]['id']}})[_0x1bd5('0x22')](handleEntityNotFound(_0x3ae0d2,null))['then'](removeEntity(_0x3ae0d2,null))['catch'](handleError(_0x3ae0d2,null));}; \ No newline at end of file +var _0xee2c=['filter','merge','VIRTUAL','VtigerField','findAll','rows','catch','show','params','keys','intersection','includeAll','include','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1341fa,_0x3bf5d2){var _0x4c68b9=function(_0x142152){while(--_0x142152){_0x1341fa['push'](_0x1341fa['shift']());}};_0x4c68b9(++_0x3bf5d2);}(_0xee2c,0x1c7));var _0xcee2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xee2c[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0xcee2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcee2('0x1'));var zipdir=require(_0xcee2('0x2'));var jsonpatch=require(_0xcee2('0x3'));var rp=require(_0xcee2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcee2('0x5'));var util=require(_0xcee2('0x6'));var path=require('path');var sox=require(_0xcee2('0x7'));var csv=require(_0xcee2('0x8'));var ejs=require(_0xcee2('0x9'));var fs=require('fs');var _=require(_0xcee2('0xa'));var squel=require(_0xcee2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcee2('0xc'));var toCsv=require(_0xcee2('0x8'));var querystring=require(_0xcee2('0xd'));var Papa=require(_0xcee2('0xe'));var Redis=require(_0xcee2('0xf'));var authService=require(_0xcee2('0x10'));var qs=require(_0xcee2('0x11'));var as=require(_0xcee2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcee2('0x13'))(_0xcee2('0x14'));var utils=require(_0xcee2('0x15'));var config=require(_0xcee2('0x16'));var licenseUtil=require(_0xcee2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d11e,_0x4ca9ac){_0x4ca9ac=_0x4ca9ac||0xcc;return function(_0x50a306){if(_0x50a306){return _0x25d11e['sendStatus'](_0x4ca9ac);}return _0x25d11e[_0xcee2('0x18')](_0x4ca9ac)[_0xcee2('0x19')]();};}function respondWithResult(_0x2afc56,_0x347a97){_0x347a97=_0x347a97||0xc8;return function(_0x54a718){if(_0x54a718){return _0x2afc56[_0xcee2('0x18')](_0x347a97)[_0xcee2('0x1a')](_0x54a718);}};}function respondWithFilteredResult(_0x393761,_0x238da0){return function(_0x1787ec){if(_0x1787ec){var _0x21a182=_0x1787ec['count'],_0x25bdcf=_0x238da0[_0xcee2('0x1b')],_0x106c5e=_0x238da0['offset']+_0x238da0[_0xcee2('0x1c')],_0x45c680;if(_0x106c5e>=_0x21a182){_0x106c5e=_0x21a182;_0x45c680=0xc8;}else{_0x45c680=0xce;}_0x393761[_0xcee2('0x18')](_0x45c680);return _0x393761[_0xcee2('0x1d')](_0xcee2('0x1e'),_0x25bdcf+'-'+_0x106c5e+'/'+_0x21a182)['json'](_0x1787ec);}return null;};}function patchUpdates(_0x245811){return function(_0x317659){try{jsonpatch[_0xcee2('0x1f')](_0x317659,_0x245811,!![]);}catch(_0x36af7f){return BPromise[_0xcee2('0x20')](_0x36af7f);}return _0x317659[_0xcee2('0x21')]();};}function saveUpdates(_0x42e222,_0x198500){return function(_0x34f480){if(_0x34f480){return _0x34f480[_0xcee2('0x22')](_0x42e222)[_0xcee2('0x23')](function(_0x5d42aa){return _0x5d42aa;});}return null;};}function removeEntity(_0x3f4f92,_0x4864d7){return function(_0x4fdb88){if(_0x4fdb88){return _0x4fdb88['destroy']()[_0xcee2('0x23')](function(){_0x3f4f92['status'](0xcc)[_0xcee2('0x19')]();});}};}function handleEntityNotFound(_0x1a935a,_0x2edef5){return function(_0x53bd9f){if(!_0x53bd9f){_0x1a935a['sendStatus'](0x194);}return _0x53bd9f;};}function handleError(_0x20a6de,_0x2ccc9c){_0x2ccc9c=_0x2ccc9c||0x1f4;return function(_0x22789d){logger['error'](_0x22789d[_0xcee2('0x24')]);if(_0x22789d['name']){delete _0x22789d[_0xcee2('0x25')];}_0x20a6de[_0xcee2('0x18')](_0x2ccc9c)[_0xcee2('0x26')](_0x22789d);};}exports[_0xcee2('0x27')]=function(_0x84d7c,_0x31618c){var _0xbc2b2e={},_0x29be38={},_0x262954={'count':0x0,'rows':[]};var _0x104e18=_[_0xcee2('0x28')](db['VtigerField'][_0xcee2('0x29')],function(_0x3ccff6){return{'name':_0x3ccff6[_0xcee2('0x2a')],'type':_0x3ccff6['type'][_0xcee2('0x2b')]};});_0x29be38[_0xcee2('0x2c')]=_['map'](_0x104e18,_0xcee2('0x25'));_0x29be38[_0xcee2('0x2d')]=_['keys'](_0x84d7c['query']);_0x29be38[_0xcee2('0x2e')]=_['intersection'](_0x29be38['model'],_0x29be38[_0xcee2('0x2d')]);_0xbc2b2e[_0xcee2('0x2f')]=_['intersection'](_0x29be38[_0xcee2('0x2c')],qs[_0xcee2('0x30')](_0x84d7c[_0xcee2('0x2d')][_0xcee2('0x30')]));_0xbc2b2e[_0xcee2('0x2f')]=_0xbc2b2e[_0xcee2('0x2f')][_0xcee2('0x31')]?_0xbc2b2e[_0xcee2('0x2f')]:_0x29be38[_0xcee2('0x2c')];if(!_0x84d7c[_0xcee2('0x2d')][_0xcee2('0x32')](_0xcee2('0x33'))){_0xbc2b2e['limit']=qs[_0xcee2('0x1c')](_0x84d7c[_0xcee2('0x2d')]['limit']);_0xbc2b2e[_0xcee2('0x1b')]=qs[_0xcee2('0x1b')](_0x84d7c['query'][_0xcee2('0x1b')]);}_0xbc2b2e[_0xcee2('0x34')]=qs[_0xcee2('0x35')](_0x84d7c['query'][_0xcee2('0x35')]);_0xbc2b2e[_0xcee2('0x36')]=qs[_0xcee2('0x2e')](_[_0xcee2('0x37')](_0x84d7c[_0xcee2('0x2d')],_0x29be38[_0xcee2('0x2e')]),_0x104e18);if(_0x84d7c['query'][_0xcee2('0x38')]){_0xbc2b2e[_0xcee2('0x36')]=_[_0xcee2('0x39')](_0xbc2b2e['where'],{'$or':_[_0xcee2('0x28')](_0x104e18,function(_0x484955){if(_0x484955['type']!==_0xcee2('0x3a')){var _0x20e3ed={};_0x20e3ed[_0x484955[_0xcee2('0x25')]]={'$like':'%'+_0x84d7c[_0xcee2('0x2d')][_0xcee2('0x38')]+'%'};return _0x20e3ed;}})});}_0xbc2b2e=_[_0xcee2('0x39')]({},_0xbc2b2e,_0x84d7c['options']);var _0x572ebb={'where':_0xbc2b2e['where']};return db[_0xcee2('0x3b')]['count'](_0x572ebb)[_0xcee2('0x23')](function(_0x157220){_0x262954['count']=_0x157220;if(_0x84d7c[_0xcee2('0x2d')]['includeAll']){_0xbc2b2e['include']=[{'all':!![]}];}return db[_0xcee2('0x3b')][_0xcee2('0x3c')](_0xbc2b2e);})['then'](function(_0x480e54){_0x262954[_0xcee2('0x3d')]=_0x480e54;return _0x262954;})[_0xcee2('0x23')](respondWithFilteredResult(_0x31618c,_0xbc2b2e))[_0xcee2('0x3e')](handleError(_0x31618c,null));};exports[_0xcee2('0x3f')]=function(_0x3cb71f,_0x28bb5b){var _0x31824a={'raw':!![],'where':{'id':_0x3cb71f[_0xcee2('0x40')]['id']}},_0x4243d4={};_0x4243d4['model']=_[_0xcee2('0x41')](db[_0xcee2('0x3b')][_0xcee2('0x29')]);_0x4243d4[_0xcee2('0x2d')]=_['keys'](_0x3cb71f[_0xcee2('0x2d')]);_0x4243d4[_0xcee2('0x2e')]=_[_0xcee2('0x42')](_0x4243d4[_0xcee2('0x2c')],_0x4243d4[_0xcee2('0x2d')]);_0x31824a[_0xcee2('0x2f')]=_[_0xcee2('0x42')](_0x4243d4[_0xcee2('0x2c')],qs[_0xcee2('0x30')](_0x3cb71f['query'][_0xcee2('0x30')]));_0x31824a[_0xcee2('0x2f')]=_0x31824a[_0xcee2('0x2f')]['length']?_0x31824a[_0xcee2('0x2f')]:_0x4243d4[_0xcee2('0x2c')];if(_0x3cb71f[_0xcee2('0x2d')][_0xcee2('0x43')]){_0x31824a[_0xcee2('0x44')]=[{'all':!![]}];}_0x31824a=_[_0xcee2('0x39')]({},_0x31824a,_0x3cb71f[_0xcee2('0x45')]);return db[_0xcee2('0x3b')][_0xcee2('0x46')](_0x31824a)[_0xcee2('0x23')](handleEntityNotFound(_0x28bb5b,null))[_0xcee2('0x23')](respondWithResult(_0x28bb5b,null))[_0xcee2('0x3e')](handleError(_0x28bb5b,null));};exports[_0xcee2('0x47')]=function(_0xa98bc1,_0x48455e){return db[_0xcee2('0x3b')]['create'](_0xa98bc1['body'],{})[_0xcee2('0x23')](respondWithResult(_0x48455e,0xc9))[_0xcee2('0x3e')](handleError(_0x48455e,null));};exports[_0xcee2('0x22')]=function(_0x1f8b75,_0x295806){if(_0x1f8b75['body']['id']){delete _0x1f8b75[_0xcee2('0x48')]['id'];}return db['VtigerField'][_0xcee2('0x46')]({'where':{'id':_0x1f8b75[_0xcee2('0x40')]['id']}})[_0xcee2('0x23')](handleEntityNotFound(_0x295806,null))[_0xcee2('0x23')](saveUpdates(_0x1f8b75[_0xcee2('0x48')],null))[_0xcee2('0x23')](respondWithResult(_0x295806,null))[_0xcee2('0x3e')](handleError(_0x295806,null));};exports['destroy']=function(_0xfbd8d2,_0x19002c){return db[_0xcee2('0x3b')][_0xcee2('0x46')]({'where':{'id':_0xfbd8d2[_0xcee2('0x40')]['id']}})[_0xcee2('0x23')](handleEntityNotFound(_0x19002c,null))[_0xcee2('0x23')](removeEntity(_0x19002c,null))[_0xcee2('0x3e')](handleError(_0x19002c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0461d63..2730ff0 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x21ff9a,_0x44771b){var _0x211916=function(_0x13c300){while(--_0x13c300){_0x21ff9a['push'](_0x21ff9a['shift']());}};_0x211916(++_0x44771b);}(_0x7a54,0x106));var _0x47a5=function(_0x468eb5,_0x52686c){_0x468eb5=_0x468eb5-0x0;var _0x1b43b4=_0x7a54[_0x468eb5];return _0x1b43b4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x5a9399,_0x1ad6bb){var _0x7d0702=function(_0x1bfd08){while(--_0x1bfd08){_0x5a9399['push'](_0x5a9399['shift']());}};_0x7d0702(++_0x1ad6bb);}(_0x7a54,0x106));var _0x47a5=function(_0x1252be,_0x87e3e0){_0x1252be=_0x1252be-0x0;var _0x309171=_0x7a54[_0x1252be];return _0x309171;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index c17c183..4d06af3 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 _0x3c66=['jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x590cd0,_0x11bfd4){var _0x208eb0=function(_0x19d96f){while(--_0x19d96f){_0x590cd0['push'](_0x590cd0['shift']());}};_0x208eb0(++_0x11bfd4);}(_0x3c66,0x8b));var _0x63c6=function(_0x2d17e1,_0x358cea){_0x2d17e1=_0x2d17e1-0x0;var _0x2d2cfb=_0x3c66[_0x2d17e1];return _0x2d2cfb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63c6('0x0'));var rs=require(_0x63c6('0x1'));var fs=require('fs');var Redis=require(_0x63c6('0x2'));var db=require(_0x63c6('0x3'))['db'];var utils=require(_0x63c6('0x4'));var logger=require(_0x63c6('0x5'))(_0x63c6('0x6'));var config=require(_0x63c6('0x7'));var jayson=require(_0x63c6('0x8'));var client=jayson[_0x63c6('0x9')][_0x63c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b33e8,_0x47b438,_0x232099){return new BPromise(function(_0x50ff5c,_0x44e826){return client[_0x63c6('0xb')](_0x2b33e8,_0x232099)['then'](function(_0x386110){logger[_0x63c6('0xc')](_0x63c6('0xd'),_0x47b438,_0x63c6('0xe'));logger[_0x63c6('0xf')](_0x63c6('0x10'),_0x47b438,'request\x20sent',JSON[_0x63c6('0x11')](_0x386110));if(_0x386110[_0x63c6('0x12')]){if(_0x386110[_0x63c6('0x12')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x47b438,_0x386110['error']['message']);return _0x44e826(_0x386110['error'][_0x63c6('0x13')]);}logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x386110[_0x63c6('0x12')][_0x63c6('0x13')]);return _0x50ff5c(_0x386110['error'][_0x63c6('0x13')]);}else{logger[_0x63c6('0xc')]('VtigerField,\x20%s,\x20%s',_0x47b438,_0x63c6('0xe'));_0x50ff5c(_0x386110['result']['message']);}})[_0x63c6('0x14')](function(_0x571022){logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x571022);_0x44e826(_0x571022);});});} \ No newline at end of file +var _0x6215=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','VtigerField,\x20%s,\x20%s'];(function(_0xceeb3c,_0x2cd4cd){var _0x50b99d=function(_0x539816){while(--_0x539816){_0xceeb3c['push'](_0xceeb3c['shift']());}};_0x50b99d(++_0x2cd4cd);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x431e77,_0x13ed74,_0x2b7275){return new BPromise(function(_0x253c0b,_0x19427d){return client['request'](_0x431e77,_0x2b7275)[_0x5621('0x9')](function(_0x39b1c0){logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');logger[_0x5621('0xc')](_0x5621('0xd'),_0x13ed74,_0x5621('0xe'),JSON['stringify'](_0x39b1c0));if(_0x39b1c0[_0x5621('0xf')]){if(_0x39b1c0[_0x5621('0xf')][_0x5621('0x10')]===0x1f4){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x19427d(_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);}logger[_0x5621('0xf')]('VtigerField,\x20%s,\x20%s',_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x253c0b(_0x39b1c0[_0x5621('0xf')]['message']);}else{logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');_0x253c0b(_0x39b1c0[_0x5621('0x12')][_0x5621('0x11')]);}})[_0x5621('0x13')](function(_0x180926){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x180926);_0x19427d(_0x180926);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 24e69c4..81146a5 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 _0xebc5=['put','/:id','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x44950a,_0x21feaa){var _0x475c21=function(_0x387128){while(--_0x387128){_0x44950a['push'](_0x44950a['shift']());}};_0x475c21(++_0x21feaa);}(_0xebc5,0x11a));var _0x5ebc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xebc5[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0x5ebc('0x0'));var util=require('util');var path=require(_0x5ebc('0x1'));var timeout=require(_0x5ebc('0x2'));var express=require(_0x5ebc('0x3'));var router=express[_0x5ebc('0x4')]();var auth=require(_0x5ebc('0x5'));var interaction=require(_0x5ebc('0x6'));var config=require('../../config/environment');var controller=require(_0x5ebc('0x7'));router[_0x5ebc('0x8')]('/',auth[_0x5ebc('0x9')](),controller[_0x5ebc('0xa')]);router[_0x5ebc('0x8')]('/:id',auth[_0x5ebc('0x9')](),controller[_0x5ebc('0xb')]);router[_0x5ebc('0x8')]('/:id/configurations',auth[_0x5ebc('0x9')](),controller[_0x5ebc('0xc')]);router[_0x5ebc('0x8')]('/:id/fields',auth[_0x5ebc('0x9')](),controller[_0x5ebc('0xd')]);router[_0x5ebc('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ebc('0xf')]);router[_0x5ebc('0xe')](_0x5ebc('0x10'),auth['isAuthenticated'](),controller[_0x5ebc('0x11')]);router[_0x5ebc('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5ebc('0x13'),auth[_0x5ebc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1dc1=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get','/:id','show'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x1dc1,0x66));var _0x11dc=function(_0x321c17,_0x5ee557){_0x321c17=_0x321c17-0x0;var _0x4c90a6=_0x1dc1[_0x321c17];return _0x4c90a6;};'use strict';var multer=require(_0x11dc('0x0'));var util=require(_0x11dc('0x1'));var path=require('path');var timeout=require(_0x11dc('0x2'));var express=require(_0x11dc('0x3'));var router=express[_0x11dc('0x4')]();var auth=require(_0x11dc('0x5'));var interaction=require(_0x11dc('0x6'));var config=require(_0x11dc('0x7'));var controller=require(_0x11dc('0x8'));router['get']('/',auth[_0x11dc('0x9')](),controller['index']);router[_0x11dc('0xa')](_0x11dc('0xb'),auth[_0x11dc('0x9')](),controller[_0x11dc('0xc')]);router[_0x11dc('0xa')](_0x11dc('0xd'),auth[_0x11dc('0x9')](),controller[_0x11dc('0xe')]);router['get'](_0x11dc('0xf'),auth[_0x11dc('0x9')](),controller[_0x11dc('0x10')]);router['post']('/',auth[_0x11dc('0x9')](),controller['create']);router[_0x11dc('0x11')](_0x11dc('0xd'),auth['isAuthenticated'](),controller[_0x11dc('0x12')]);router['put']('/:id',auth[_0x11dc('0x9')](),controller[_0x11dc('0x13')]);router[_0x11dc('0x14')](_0x11dc('0xb'),auth[_0x11dc('0x9')](),controller[_0x11dc('0x15')]);module[_0x11dc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4fd2ea4..f6d2579 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 _0xb5b3=['exports','STRING','username','remoteUri','ENUM','password','token','newTab','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb5b3,0xb3));var _0x3b5b=function(_0x4094b7,_0x9ebb05){_0x4094b7=_0x4094b7-0x0;var _0x250fdf=_0xb5b3[_0x4094b7];return _0x250fdf;};'use strict';var Sequelize=require(_0x3b5b('0x0'));module[_0x3b5b('0x1')]={'name':{'type':Sequelize[_0x3b5b('0x2')]},'description':{'type':Sequelize[_0x3b5b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3b5b('0x3')},'password':{'type':Sequelize[_0x3b5b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3b5b('0x2')],'unique':_0x3b5b('0x4')},'authType':{'type':Sequelize[_0x3b5b('0x5')](_0x3b5b('0x6'),_0x3b5b('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3b5b('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x3b5b('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x0f74=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','token'];(function(_0x42f976,_0x1abe27){var _0x525cce=function(_0x282337){while(--_0x282337){_0x42f976['push'](_0x42f976['shift']());}};_0x525cce(++_0x1abe27);}(_0x0f74,0x113));var _0x40f7=function(_0x358d36,_0x264037){_0x358d36=_0x358d36-0x0;var _0x5bf949=_0x0f74[_0x358d36];return _0x5bf949;};'use strict';var Sequelize=require(_0x40f7('0x0'));module[_0x40f7('0x1')]={'name':{'type':Sequelize[_0x40f7('0x2')]},'description':{'type':Sequelize[_0x40f7('0x2')]},'username':{'type':Sequelize[_0x40f7('0x2')],'unique':_0x40f7('0x3')},'password':{'type':Sequelize[_0x40f7('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x40f7('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x40f7('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x40f7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x40f7('0x5')](_0x40f7('0x6'),_0x40f7('0x7')),'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 5f90f21..3e969ca 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b7=['format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options','custom_field_options','statusCode','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','ZendeskAccount','includeAll','include','rows','catch','options','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','filters','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','slice','lastIndexOf','GET'];(function(_0x59cf8a,_0x163bb9){var _0x22dde8=function(_0x59b38a){while(--_0x59b38a){_0x59cf8a['push'](_0x59cf8a['shift']());}};_0x22dde8(++_0x163bb9);}(_0x34b7,0x196));var _0x734b=function(_0x5f2668,_0x29630f){_0x5f2668=_0x5f2668-0x0;var _0x42df13=_0x34b7[_0x5f2668];return _0x42df13;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x734b('0x0'));var zipdir=require(_0x734b('0x1'));var jsonpatch=require(_0x734b('0x2'));var rp=require(_0x734b('0x3'));var moment=require(_0x734b('0x4'));var BPromise=require(_0x734b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x734b('0x6'));var sox=require(_0x734b('0x7'));var csv=require(_0x734b('0x8'));var ejs=require(_0x734b('0x9'));var fs=require('fs');var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];var integrations=require(_0x734b('0x18'));var jayson=require(_0x734b('0x19'));var client=jayson[_0x734b('0x1a')][_0x734b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1c893d,_0x5a5613,_0x18fc18,_0x252510){return new BPromise(function(_0x47791c,_0xd1ab2a){var _0x19f427=_0x252510||client;return _0x19f427[_0x734b('0x1c')](_0x1c893d,_0x18fc18)[_0x734b('0x1d')](function(_0x2c03bd){logger[_0x734b('0x1e')](_0x734b('0x1f'),_0x5a5613,_0x734b('0x20'));logger['debug'](_0x734b('0x21'),_0x5a5613,_0x734b('0x20'),JSON[_0x734b('0x22')](_0x2c03bd));if(_0x2c03bd[_0x734b('0x23')]){if(_0x2c03bd['error']['code']===0x1f4){logger[_0x734b('0x23')](_0x734b('0x1f'),_0x5a5613,_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);return _0xd1ab2a(_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);}logger[_0x734b('0x23')](_0x734b('0x1f'),_0x5a5613,_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);return _0x47791c(_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);}else{logger[_0x734b('0x1e')](_0x734b('0x1f'),_0x5a5613,'request\x20sent');_0x47791c(_0x2c03bd[_0x734b('0x25')][_0x734b('0x24')]);}})['catch'](function(_0x38154d){logger[_0x734b('0x23')](_0x734b('0x1f'),_0x5a5613,_0x38154d);_0xd1ab2a(_0x38154d);});});}function respondWithStatusCode(_0x11fb8e,_0x46d432){_0x46d432=_0x46d432||0xcc;return function(_0x26d118){if(_0x26d118){return _0x11fb8e[_0x734b('0x26')](_0x46d432);}return _0x11fb8e[_0x734b('0x27')](_0x46d432)[_0x734b('0x28')]();};}function respondWithResult(_0x3abbe6,_0x44ffa9){_0x44ffa9=_0x44ffa9||0xc8;return function(_0x148abe){if(_0x148abe){return _0x3abbe6[_0x734b('0x27')](_0x44ffa9)['json'](_0x148abe);}};}function respondWithFilteredResult(_0x49732b,_0x13cc5a){return function(_0x3680a0){if(_0x3680a0){var _0x47a0a9=_0x3680a0[_0x734b('0x29')],_0x32ea00=_0x13cc5a[_0x734b('0x2a')],_0x2dd51a=_0x13cc5a[_0x734b('0x2a')]+_0x13cc5a[_0x734b('0x2b')],_0x1d8e51;if(_0x2dd51a>=_0x47a0a9){_0x2dd51a=_0x47a0a9;_0x1d8e51=0xc8;}else{_0x1d8e51=0xce;}_0x49732b['status'](_0x1d8e51);return _0x49732b[_0x734b('0x2c')](_0x734b('0x2d'),_0x32ea00+'-'+_0x2dd51a+'/'+_0x47a0a9)[_0x734b('0x2e')](_0x3680a0);}return null;};}function patchUpdates(_0x241c89){return function(_0x729431){try{jsonpatch[_0x734b('0x2f')](_0x729431,_0x241c89,!![]);}catch(_0x1fed72){return BPromise[_0x734b('0x30')](_0x1fed72);}return _0x729431[_0x734b('0x31')]();};}function saveUpdates(_0x3065b0,_0x5dcabf){return function(_0xe999c5){if(_0xe999c5){return _0xe999c5[_0x734b('0x32')](_0x3065b0)['then'](function(_0xbbe037){return _0xbbe037;});}return null;};}function removeEntity(_0x3cfce2,_0xf4ef21){return function(_0x2fe7d5){if(_0x2fe7d5){return _0x2fe7d5[_0x734b('0x33')]()[_0x734b('0x1d')](function(){_0x3cfce2[_0x734b('0x27')](0xcc)[_0x734b('0x28')]();});}};}function handleEntityNotFound(_0x1e53fb,_0x17c6e0){return function(_0x24ef4f){if(!_0x24ef4f){_0x1e53fb[_0x734b('0x26')](0x194);}return _0x24ef4f;};}function handleError(_0xab8aa6,_0x34a851){_0x34a851=_0x34a851||0x1f4;return function(_0x4512fc){logger['error'](_0x4512fc[_0x734b('0x34')]);if(_0x4512fc['name']){delete _0x4512fc[_0x734b('0x35')];}_0xab8aa6[_0x734b('0x27')](_0x34a851)[_0x734b('0x36')](_0x4512fc);};}exports[_0x734b('0x37')]=function(_0x19f94d,_0x16ab66){var _0x55bd2e={},_0x5da77e={},_0x3460a0={'count':0x0,'rows':[]};var _0x5ee908=_[_0x734b('0x38')](db['ZendeskAccount'][_0x734b('0x39')],function(_0x4b30eb){return{'name':_0x4b30eb[_0x734b('0x3a')],'type':_0x4b30eb['type'][_0x734b('0x3b')]};});_0x5da77e[_0x734b('0x3c')]=_[_0x734b('0x38')](_0x5ee908,_0x734b('0x35'));_0x5da77e[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0x19f94d[_0x734b('0x3d')]);_0x5da77e['filters']=_[_0x734b('0x3f')](_0x5da77e[_0x734b('0x3c')],_0x5da77e['query']);_0x55bd2e[_0x734b('0x40')]=_[_0x734b('0x3f')](_0x5da77e[_0x734b('0x3c')],qs[_0x734b('0x41')](_0x19f94d['query'][_0x734b('0x41')]));_0x55bd2e[_0x734b('0x40')]=_0x55bd2e['attributes'][_0x734b('0x42')]?_0x55bd2e[_0x734b('0x40')]:_0x5da77e['model'];if(!_0x19f94d[_0x734b('0x3d')][_0x734b('0x43')](_0x734b('0x44'))){_0x55bd2e[_0x734b('0x2b')]=qs['limit'](_0x19f94d['query'][_0x734b('0x2b')]);_0x55bd2e['offset']=qs['offset'](_0x19f94d[_0x734b('0x3d')]['offset']);}_0x55bd2e[_0x734b('0x45')]=qs['sort'](_0x19f94d[_0x734b('0x3d')][_0x734b('0x46')]);_0x55bd2e[_0x734b('0x47')]=qs['filters'](_['pick'](_0x19f94d[_0x734b('0x3d')],_0x5da77e['filters']),_0x5ee908);if(_0x19f94d['query'][_0x734b('0x48')]){_0x55bd2e[_0x734b('0x47')]=_['merge'](_0x55bd2e[_0x734b('0x47')],{'$or':_['map'](_0x5ee908,function(_0x2e5208){if(_0x2e5208[_0x734b('0x49')]!==_0x734b('0x4a')){var _0x5430cf={};_0x5430cf[_0x2e5208[_0x734b('0x35')]]={'$like':'%'+_0x19f94d[_0x734b('0x3d')][_0x734b('0x48')]+'%'};return _0x5430cf;}})});}_0x55bd2e=_[_0x734b('0x4b')]({},_0x55bd2e,_0x19f94d['options']);var _0x5b84c8={'where':_0x55bd2e['where']};return db[_0x734b('0x4c')]['count'](_0x5b84c8)['then'](function(_0x1625ff){_0x3460a0['count']=_0x1625ff;if(_0x19f94d[_0x734b('0x3d')][_0x734b('0x4d')]){_0x55bd2e[_0x734b('0x4e')]=[{'all':!![]}];}return db[_0x734b('0x4c')]['findAll'](_0x55bd2e);})[_0x734b('0x1d')](function(_0x503a6b){_0x3460a0[_0x734b('0x4f')]=_0x503a6b;return _0x3460a0;})[_0x734b('0x1d')](respondWithFilteredResult(_0x16ab66,_0x55bd2e))[_0x734b('0x50')](handleError(_0x16ab66,null));};exports['show']=function(_0x370326,_0x4c3efb){var _0x357ae4={'raw':![],'where':{'id':_0x370326['params']['id']}},_0x331a87={};_0x331a87[_0x734b('0x3c')]=_[_0x734b('0x3e')](db[_0x734b('0x4c')][_0x734b('0x39')]);_0x331a87[_0x734b('0x3d')]=_['keys'](_0x370326[_0x734b('0x3d')]);_0x331a87['filters']=_[_0x734b('0x3f')](_0x331a87['model'],_0x331a87[_0x734b('0x3d')]);_0x357ae4[_0x734b('0x40')]=_[_0x734b('0x3f')](_0x331a87[_0x734b('0x3c')],qs[_0x734b('0x41')](_0x370326['query']['fields']));_0x357ae4['attributes']=_0x357ae4[_0x734b('0x40')][_0x734b('0x42')]?_0x357ae4['attributes']:_0x331a87[_0x734b('0x3c')];if(_0x370326[_0x734b('0x3d')]['includeAll']){_0x357ae4[_0x734b('0x4e')]=[{'all':!![]}];}_0x357ae4=_[_0x734b('0x4b')]({},_0x357ae4,_0x370326[_0x734b('0x51')]);return db['ZendeskAccount'][_0x734b('0x52')](_0x357ae4)[_0x734b('0x1d')](handleEntityNotFound(_0x4c3efb,null))[_0x734b('0x1d')](respondWithResult(_0x4c3efb,null))[_0x734b('0x50')](handleError(_0x4c3efb,null));};exports['create']=function(_0x44cc7d,_0x44e654){return db[_0x734b('0x4c')][_0x734b('0x53')](_0x44cc7d['body'],{})[_0x734b('0x1d')](respondWithResult(_0x44e654,0xc9))['catch'](handleError(_0x44e654,null));};exports[_0x734b('0x32')]=function(_0x3e3f98,_0x1f3594){if(_0x3e3f98[_0x734b('0x54')]['id']){delete _0x3e3f98['body']['id'];}return db[_0x734b('0x4c')][_0x734b('0x52')]({'where':{'id':_0x3e3f98['params']['id']}})['then'](handleEntityNotFound(_0x1f3594,null))[_0x734b('0x1d')](saveUpdates(_0x3e3f98['body'],null))[_0x734b('0x1d')](respondWithResult(_0x1f3594,null))[_0x734b('0x50')](handleError(_0x1f3594,null));};exports[_0x734b('0x33')]=function(_0x5eddd9,_0x1ad7f1){return db['ZendeskAccount'][_0x734b('0x52')]({'where':{'id':_0x5eddd9[_0x734b('0x55')]['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0x1ad7f1,null))[_0x734b('0x1d')](removeEntity(_0x1ad7f1,null))['catch'](handleError(_0x1ad7f1,null));};exports[_0x734b('0x56')]=function(_0x50224e,_0x6b198c,_0x415a52){var _0x52e45={};var _0x59b7d8={};var _0x18e187;var _0x55c699;return db[_0x734b('0x4c')][_0x734b('0x57')]({'where':{'id':_0x50224e[_0x734b('0x55')]['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0x6b198c,null))['then'](function(_0x35f742){if(_0x35f742){_0x18e187=_0x35f742;_0x59b7d8['model']=_[_0x734b('0x3e')](db[_0x734b('0x58')][_0x734b('0x39')]);_0x59b7d8['query']=_[_0x734b('0x3e')](_0x50224e[_0x734b('0x3d')]);_0x59b7d8[_0x734b('0x59')]=_[_0x734b('0x3f')](_0x59b7d8[_0x734b('0x3c')],_0x59b7d8[_0x734b('0x3d')]);_0x52e45[_0x734b('0x40')]=_['intersection'](_0x59b7d8[_0x734b('0x3c')],qs[_0x734b('0x41')](_0x50224e[_0x734b('0x3d')]['fields']));_0x52e45['attributes']=_0x52e45[_0x734b('0x40')][_0x734b('0x42')]?_0x52e45[_0x734b('0x40')]:_0x59b7d8[_0x734b('0x3c')];_0x52e45['order']=qs['sort'](_0x50224e['query'][_0x734b('0x46')]);_0x52e45[_0x734b('0x47')]=qs[_0x734b('0x59')](_[_0x734b('0x5a')](_0x50224e[_0x734b('0x3d')],_0x59b7d8[_0x734b('0x59')]));if(_0x50224e[_0x734b('0x3d')][_0x734b('0x48')]){_0x52e45[_0x734b('0x47')]=_[_0x734b('0x4b')](_0x52e45[_0x734b('0x47')],{'$or':_[_0x734b('0x38')](_0x52e45[_0x734b('0x40')],function(_0x467b1){var _0x35be77={};_0x35be77[_0x467b1]={'$like':'%'+_0x50224e[_0x734b('0x3d')][_0x734b('0x48')]+'%'};return _0x35be77;})});}_0x52e45=_[_0x734b('0x4b')]({},_0x52e45,_0x50224e[_0x734b('0x51')]);return _0x18e187[_0x734b('0x56')](_0x52e45);}})[_0x734b('0x1d')](function(_0x591d5e){if(_0x591d5e){_0x55c699=_0x591d5e[_0x734b('0x42')];if(!_0x50224e[_0x734b('0x3d')][_0x734b('0x43')](_0x734b('0x44'))){_0x52e45[_0x734b('0x2b')]=qs['limit'](_0x50224e[_0x734b('0x3d')][_0x734b('0x2b')]);_0x52e45[_0x734b('0x2a')]=qs[_0x734b('0x2a')](_0x50224e[_0x734b('0x3d')][_0x734b('0x2a')]);}return _0x18e187['getConfigurations'](_0x52e45);}})['then'](function(_0x48645f){if(_0x48645f){return _0x48645f?{'count':_0x55c699,'rows':_0x48645f}:null;}})['then'](respondWithResult(_0x6b198c,null))['catch'](handleError(_0x6b198c,null));};exports[_0x734b('0x5b')]=function(_0x30ffea,_0x16c9d2,_0xb23b61){if(_0x30ffea['body']['id']){delete _0x30ffea['body']['id'];}return db[_0x734b('0x4c')][_0x734b('0x57')]({'where':{'id':_0x30ffea[_0x734b('0x55')]['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0x16c9d2,null))['then'](function(_0x3b364c){if(_0x3b364c){_0x30ffea[_0x734b('0x54')][_0x734b('0x5c')]=_0x3b364c['id'];_0x30ffea[_0x734b('0x54')]['Subjects']=integrations[_0x734b('0x5d')](_0x30ffea['body'][_0x734b('0x5e')],_0x30ffea[_0x734b('0x54')][_0x734b('0x49')]);_0x30ffea[_0x734b('0x54')][_0x734b('0x5f')]=integrations['getDescriptions'](_0x30ffea[_0x734b('0x54')][_0x734b('0x5e')],_0x30ffea[_0x734b('0x54')][_0x734b('0x49')]);return db[_0x734b('0x58')]['create'](_0x30ffea[_0x734b('0x54')],{'include':[{'model':db[_0x734b('0x60')],'as':_0x734b('0x61')},{'model':db[_0x734b('0x60')],'as':'Descriptions'}]});}return null;})[_0x734b('0x1d')](respondWithResult(_0x16c9d2,null))[_0x734b('0x50')](handleError(_0x16c9d2,null));};exports[_0x734b('0x62')]=function(_0x407006,_0x2182fd,_0x5c2222){var _0x3303c2='';return db['ZendeskAccount'][_0x734b('0x57')]({'where':{'id':_0x407006[_0x734b('0x55')]['id']},'attributes':['id',_0x734b('0x63'),_0x734b('0x64'),_0x734b('0x65'),_0x734b('0x66'),'remoteUri']})['then'](handleEntityNotFound(_0x2182fd,null))['then'](function(_0x470938){if(_0x470938){_0x3303c2=_0x470938['remoteUri'];var _0x2efbe1=_0x3303c2[_0x734b('0x67')](-0x1);if(_0x2efbe1==='/'){_0x3303c2=_0x3303c2['substring'](0x0,_0x3303c2[_0x734b('0x68')](_0x2efbe1));}var _0x3ec9e1={'method':_0x734b('0x69'),'uri':util[_0x734b('0x6a')](_0x734b('0x6b'),_0x3303c2,_0x734b('0x6c')),'json':!![]};switch(_0x470938[_0x734b('0x66')]){case _0x734b('0x64'):_0x3ec9e1[_0x734b('0x6d')]={'Authorization':util[_0x734b('0x6a')]('Basic\x20%s',new Buffer(util[_0x734b('0x6a')](_0x734b('0x6e'),_0x470938[_0x734b('0x63')],_0x470938['password']))[_0x734b('0x6f')](_0x734b('0x70')))};break;case _0x734b('0x65'):_0x3ec9e1[_0x734b('0x6d')]={'Authorization':util[_0x734b('0x6a')](_0x734b('0x71'),new Buffer(util[_0x734b('0x6a')](_0x734b('0x72'),_0x470938['username'],_0x470938[_0x734b('0x65')]))[_0x734b('0x6f')](_0x734b('0x70')))};break;default:throw new db[(_0x734b('0x73'))][(_0x734b('0x74'))](_0x734b('0x75'));}return rp(_0x3ec9e1);}})[_0x734b('0x1d')](function(_0x9106c9){if(_0x9106c9){var _0x599a20=['subject',_0x734b('0x76'),_0x734b('0x77'),_0x734b('0x78')];_['remove'](_0x9106c9[_0x734b('0x6c')],function(_0x2fde66){return _0x599a20[_0x734b('0x79')](_0x2fde66[_0x734b('0x49')]);});return{'count':_0x9106c9[_0x734b('0x6c')][_0x734b('0x42')],'rows':_['map'](_0x9106c9[_0x734b('0x6c')],function(_0x55f880){return{'id':_0x55f880['id'],'name':_0x55f880['position']>0x7?_0x55f880['title']:_0x55f880['type'],'custom':_0x55f880[_0x734b('0x7a')]>0x7?!![]:![],'options':_0x55f880[_0x734b('0x7b')]?_0x55f880[_0x734b('0x7b')]:_0x55f880[_0x734b('0x7c')]?_0x55f880['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2182fd,null))[_0x734b('0x50')](function(_0x4c5b70){var _0x3243f7=_0x407006[_0x734b('0x3d')]['test']?0x1f4:_0x4c5b70[_0x734b('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3243f7,JSON[_0x734b('0x22')](_0x4c5b70));delete _0x4c5b70[_0x734b('0x35')];if(_0x3243f7===0x191){_0x3243f7=0x190;}_0x2182fd[_0x734b('0x27')](_0x3243f7)[_0x734b('0x36')](_0x407006['query'][_0x734b('0x7e')]?{'message':_0x734b('0x7f'),'statusCode':_0x4c5b70['statusCode']}:_0x4c5b70);});}; \ No newline at end of file +var _0xfa20=['filters','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','create','body','findOne','ZendeskConfiguration','filter','getConfigurations','AccountId','Subjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','update','destroy','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xa98ade,_0x54d54e){var _0x47d977=function(_0x6ebb8b){while(--_0x6ebb8b){_0xa98ade['push'](_0xa98ade['shift']());}};_0x47d977(++_0x54d54e);}(_0xfa20,0x141));var _0x0fa2=function(_0x39eff9,_0x3a57a4){_0x39eff9=_0x39eff9-0x0;var _0x356d78=_0xfa20[_0x39eff9];return _0x356d78;};'use strict';var pdf=require(_0x0fa2('0x0'));var emlformat=require(_0x0fa2('0x1'));var rimraf=require(_0x0fa2('0x2'));var zipdir=require(_0x0fa2('0x3'));var jsonpatch=require(_0x0fa2('0x4'));var rp=require(_0x0fa2('0x5'));var moment=require(_0x0fa2('0x6'));var BPromise=require(_0x0fa2('0x7'));var Mustache=require(_0x0fa2('0x8'));var util=require(_0x0fa2('0x9'));var path=require(_0x0fa2('0xa'));var sox=require('sox');var csv=require(_0x0fa2('0xb'));var ejs=require(_0x0fa2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0fa2('0xd'));var crypto=require(_0x0fa2('0xe'));var jsforce=require(_0x0fa2('0xf'));var deskjs=require(_0x0fa2('0x10'));var toCsv=require(_0x0fa2('0xb'));var querystring=require(_0x0fa2('0x11'));var Papa=require(_0x0fa2('0x12'));var Redis=require(_0x0fa2('0x13'));var authService=require(_0x0fa2('0x14'));var qs=require(_0x0fa2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa2('0x16'));var logger=require(_0x0fa2('0x17'))(_0x0fa2('0x18'));var utils=require(_0x0fa2('0x19'));var config=require(_0x0fa2('0x1a'));var licenseUtil=require(_0x0fa2('0x1b'));var db=require(_0x0fa2('0x1c'))['db'];var integrations=require(_0x0fa2('0x1d'));var jayson=require('jayson/promise');var client=jayson[_0x0fa2('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4ff1,_0x51b0c8,_0x539b6b,_0x4a5ba2){return new BPromise(function(_0x2d4c9d,_0x10dfed){var _0x192e79=_0x4a5ba2||client;return _0x192e79[_0x0fa2('0x1f')](_0x1a4ff1,_0x539b6b)[_0x0fa2('0x20')](function(_0x46e317){logger[_0x0fa2('0x21')](_0x0fa2('0x22'),_0x51b0c8,'request\x20sent');logger[_0x0fa2('0x23')](_0x0fa2('0x24'),_0x51b0c8,_0x0fa2('0x25'),JSON[_0x0fa2('0x26')](_0x46e317));if(_0x46e317[_0x0fa2('0x27')]){if(_0x46e317[_0x0fa2('0x27')][_0x0fa2('0x28')]===0x1f4){logger[_0x0fa2('0x27')](_0x0fa2('0x22'),_0x51b0c8,_0x46e317[_0x0fa2('0x27')]['message']);return _0x10dfed(_0x46e317['error'][_0x0fa2('0x29')]);}logger[_0x0fa2('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x51b0c8,_0x46e317[_0x0fa2('0x27')][_0x0fa2('0x29')]);return _0x2d4c9d(_0x46e317[_0x0fa2('0x27')]['message']);}else{logger[_0x0fa2('0x21')](_0x0fa2('0x22'),_0x51b0c8,'request\x20sent');_0x2d4c9d(_0x46e317[_0x0fa2('0x2a')]['message']);}})[_0x0fa2('0x2b')](function(_0x12d48b){logger[_0x0fa2('0x27')](_0x0fa2('0x22'),_0x51b0c8,_0x12d48b);_0x10dfed(_0x12d48b);});});}function respondWithStatusCode(_0x7f6eb,_0x4d921b){_0x4d921b=_0x4d921b||0xcc;return function(_0x4744ca){if(_0x4744ca){return _0x7f6eb[_0x0fa2('0x2c')](_0x4d921b);}return _0x7f6eb[_0x0fa2('0x2d')](_0x4d921b)[_0x0fa2('0x2e')]();};}function respondWithResult(_0x16b313,_0x40d425){_0x40d425=_0x40d425||0xc8;return function(_0x38a2c4){if(_0x38a2c4){return _0x16b313['status'](_0x40d425)[_0x0fa2('0x2f')](_0x38a2c4);}};}function respondWithFilteredResult(_0x5180d1,_0x3611ca){return function(_0x59423d){if(_0x59423d){var _0x1a8832=_0x59423d[_0x0fa2('0x30')],_0x3c47f5=_0x3611ca[_0x0fa2('0x31')],_0x24f649=_0x3611ca['offset']+_0x3611ca[_0x0fa2('0x32')],_0x2bf67d;if(_0x24f649>=_0x1a8832){_0x24f649=_0x1a8832;_0x2bf67d=0xc8;}else{_0x2bf67d=0xce;}_0x5180d1['status'](_0x2bf67d);return _0x5180d1['set'](_0x0fa2('0x33'),_0x3c47f5+'-'+_0x24f649+'/'+_0x1a8832)[_0x0fa2('0x2f')](_0x59423d);}return null;};}function patchUpdates(_0x1f6a4c){return function(_0x4817db){try{jsonpatch['apply'](_0x4817db,_0x1f6a4c,!![]);}catch(_0x480c4e){return BPromise['reject'](_0x480c4e);}return _0x4817db['save']();};}function saveUpdates(_0x7b6c2a,_0x2fb295){return function(_0x37e0d9){if(_0x37e0d9){return _0x37e0d9[_0x0fa2('0x34')](_0x7b6c2a)['then'](function(_0x5e2578){return _0x5e2578;});}return null;};}function removeEntity(_0x47af3a,_0x107d8e){return function(_0x59bfbb){if(_0x59bfbb){return _0x59bfbb[_0x0fa2('0x35')]()[_0x0fa2('0x20')](function(){_0x47af3a[_0x0fa2('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b69f,_0x1fadb3){return function(_0x42c168){if(!_0x42c168){_0x49b69f[_0x0fa2('0x2c')](0x194);}return _0x42c168;};}function handleError(_0x3383cf,_0x3bde86){_0x3bde86=_0x3bde86||0x1f4;return function(_0xf76d7){logger[_0x0fa2('0x27')](_0xf76d7[_0x0fa2('0x36')]);if(_0xf76d7[_0x0fa2('0x37')]){delete _0xf76d7[_0x0fa2('0x37')];}_0x3383cf[_0x0fa2('0x2d')](_0x3bde86)[_0x0fa2('0x38')](_0xf76d7);};}exports[_0x0fa2('0x39')]=function(_0x2a6317,_0x2a255b){var _0x2e7ee6={},_0x340365={},_0x27434d={'count':0x0,'rows':[]};var _0x4f7c07=_['map'](db[_0x0fa2('0x3a')][_0x0fa2('0x3b')],function(_0x15ec32){return{'name':_0x15ec32[_0x0fa2('0x3c')],'type':_0x15ec32[_0x0fa2('0x3d')][_0x0fa2('0x3e')]};});_0x340365['model']=_[_0x0fa2('0x3f')](_0x4f7c07,_0x0fa2('0x37'));_0x340365[_0x0fa2('0x40')]=_[_0x0fa2('0x41')](_0x2a6317[_0x0fa2('0x40')]);_0x340365['filters']=_[_0x0fa2('0x42')](_0x340365[_0x0fa2('0x43')],_0x340365['query']);_0x2e7ee6[_0x0fa2('0x44')]=_[_0x0fa2('0x42')](_0x340365[_0x0fa2('0x43')],qs['fields'](_0x2a6317['query']['fields']));_0x2e7ee6['attributes']=_0x2e7ee6[_0x0fa2('0x44')][_0x0fa2('0x45')]?_0x2e7ee6[_0x0fa2('0x44')]:_0x340365['model'];if(!_0x2a6317['query'][_0x0fa2('0x46')](_0x0fa2('0x47'))){_0x2e7ee6[_0x0fa2('0x32')]=qs['limit'](_0x2a6317[_0x0fa2('0x40')][_0x0fa2('0x32')]);_0x2e7ee6[_0x0fa2('0x31')]=qs['offset'](_0x2a6317[_0x0fa2('0x40')]['offset']);}_0x2e7ee6[_0x0fa2('0x48')]=qs['sort'](_0x2a6317['query'][_0x0fa2('0x49')]);_0x2e7ee6[_0x0fa2('0x4a')]=qs[_0x0fa2('0x4b')](_[_0x0fa2('0x4c')](_0x2a6317['query'],_0x340365['filters']),_0x4f7c07);if(_0x2a6317[_0x0fa2('0x40')]['filter']){_0x2e7ee6[_0x0fa2('0x4a')]=_[_0x0fa2('0x4d')](_0x2e7ee6['where'],{'$or':_[_0x0fa2('0x3f')](_0x4f7c07,function(_0xd448c2){if(_0xd448c2[_0x0fa2('0x3d')]!==_0x0fa2('0x4e')){var _0x5f137e={};_0x5f137e[_0xd448c2['name']]={'$like':'%'+_0x2a6317[_0x0fa2('0x40')]['filter']+'%'};return _0x5f137e;}})});}_0x2e7ee6=_[_0x0fa2('0x4d')]({},_0x2e7ee6,_0x2a6317[_0x0fa2('0x4f')]);var _0x1406b1={'where':_0x2e7ee6['where']};return db[_0x0fa2('0x3a')][_0x0fa2('0x30')](_0x1406b1)[_0x0fa2('0x20')](function(_0x3c4592){_0x27434d[_0x0fa2('0x30')]=_0x3c4592;if(_0x2a6317[_0x0fa2('0x40')][_0x0fa2('0x50')]){_0x2e7ee6[_0x0fa2('0x51')]=[{'all':!![]}];}return db[_0x0fa2('0x3a')]['findAll'](_0x2e7ee6);})[_0x0fa2('0x20')](function(_0x2fdfa6){_0x27434d[_0x0fa2('0x52')]=_0x2fdfa6;return _0x27434d;})['then'](respondWithFilteredResult(_0x2a255b,_0x2e7ee6))[_0x0fa2('0x2b')](handleError(_0x2a255b,null));};exports[_0x0fa2('0x53')]=function(_0x49c0b1,_0xc0ff7b){var _0x531c55={'raw':![],'where':{'id':_0x49c0b1[_0x0fa2('0x54')]['id']}},_0x2ed220={};_0x2ed220[_0x0fa2('0x43')]=_[_0x0fa2('0x41')](db[_0x0fa2('0x3a')][_0x0fa2('0x3b')]);_0x2ed220[_0x0fa2('0x40')]=_[_0x0fa2('0x41')](_0x49c0b1[_0x0fa2('0x40')]);_0x2ed220['filters']=_[_0x0fa2('0x42')](_0x2ed220['model'],_0x2ed220[_0x0fa2('0x40')]);_0x531c55[_0x0fa2('0x44')]=_[_0x0fa2('0x42')](_0x2ed220[_0x0fa2('0x43')],qs[_0x0fa2('0x55')](_0x49c0b1['query']['fields']));_0x531c55['attributes']=_0x531c55[_0x0fa2('0x44')][_0x0fa2('0x45')]?_0x531c55['attributes']:_0x2ed220['model'];if(_0x49c0b1[_0x0fa2('0x40')]['includeAll']){_0x531c55[_0x0fa2('0x51')]=[{'all':!![]}];}_0x531c55=_[_0x0fa2('0x4d')]({},_0x531c55,_0x49c0b1['options']);return db[_0x0fa2('0x3a')][_0x0fa2('0x56')](_0x531c55)[_0x0fa2('0x20')](handleEntityNotFound(_0xc0ff7b,null))[_0x0fa2('0x20')](respondWithResult(_0xc0ff7b,null))[_0x0fa2('0x2b')](handleError(_0xc0ff7b,null));};exports[_0x0fa2('0x57')]=function(_0x1858c3,_0x175d00){return db[_0x0fa2('0x3a')][_0x0fa2('0x57')](_0x1858c3['body'],{})[_0x0fa2('0x20')](respondWithResult(_0x175d00,0xc9))[_0x0fa2('0x2b')](handleError(_0x175d00,null));};exports[_0x0fa2('0x34')]=function(_0x231eb5,_0x8dfbe5){if(_0x231eb5[_0x0fa2('0x58')]['id']){delete _0x231eb5[_0x0fa2('0x58')]['id'];}return db[_0x0fa2('0x3a')]['find']({'where':{'id':_0x231eb5[_0x0fa2('0x54')]['id']}})['then'](handleEntityNotFound(_0x8dfbe5,null))[_0x0fa2('0x20')](saveUpdates(_0x231eb5[_0x0fa2('0x58')],null))[_0x0fa2('0x20')](respondWithResult(_0x8dfbe5,null))[_0x0fa2('0x2b')](handleError(_0x8dfbe5,null));};exports[_0x0fa2('0x35')]=function(_0x5f0f54,_0x2483cc){return db['ZendeskAccount'][_0x0fa2('0x56')]({'where':{'id':_0x5f0f54[_0x0fa2('0x54')]['id']}})[_0x0fa2('0x20')](handleEntityNotFound(_0x2483cc,null))[_0x0fa2('0x20')](removeEntity(_0x2483cc,null))[_0x0fa2('0x2b')](handleError(_0x2483cc,null));};exports['getConfigurations']=function(_0x1e0967,_0x322477,_0x19cdbd){var _0x30bf05={};var _0x23b86b={};var _0x3857b3;var _0x55f5b1;return db[_0x0fa2('0x3a')][_0x0fa2('0x59')]({'where':{'id':_0x1e0967[_0x0fa2('0x54')]['id']}})[_0x0fa2('0x20')](handleEntityNotFound(_0x322477,null))[_0x0fa2('0x20')](function(_0x1535dc){if(_0x1535dc){_0x3857b3=_0x1535dc;_0x23b86b[_0x0fa2('0x43')]=_[_0x0fa2('0x41')](db[_0x0fa2('0x5a')][_0x0fa2('0x3b')]);_0x23b86b[_0x0fa2('0x40')]=_['keys'](_0x1e0967['query']);_0x23b86b[_0x0fa2('0x4b')]=_[_0x0fa2('0x42')](_0x23b86b[_0x0fa2('0x43')],_0x23b86b['query']);_0x30bf05[_0x0fa2('0x44')]=_[_0x0fa2('0x42')](_0x23b86b[_0x0fa2('0x43')],qs['fields'](_0x1e0967[_0x0fa2('0x40')]['fields']));_0x30bf05['attributes']=_0x30bf05['attributes'][_0x0fa2('0x45')]?_0x30bf05[_0x0fa2('0x44')]:_0x23b86b[_0x0fa2('0x43')];_0x30bf05[_0x0fa2('0x48')]=qs['sort'](_0x1e0967[_0x0fa2('0x40')][_0x0fa2('0x49')]);_0x30bf05[_0x0fa2('0x4a')]=qs[_0x0fa2('0x4b')](_['pick'](_0x1e0967[_0x0fa2('0x40')],_0x23b86b[_0x0fa2('0x4b')]));if(_0x1e0967[_0x0fa2('0x40')][_0x0fa2('0x5b')]){_0x30bf05['where']=_[_0x0fa2('0x4d')](_0x30bf05[_0x0fa2('0x4a')],{'$or':_[_0x0fa2('0x3f')](_0x30bf05['attributes'],function(_0x11cc18){var _0x24ee38={};_0x24ee38[_0x11cc18]={'$like':'%'+_0x1e0967[_0x0fa2('0x40')][_0x0fa2('0x5b')]+'%'};return _0x24ee38;})});}_0x30bf05=_[_0x0fa2('0x4d')]({},_0x30bf05,_0x1e0967[_0x0fa2('0x4f')]);return _0x3857b3[_0x0fa2('0x5c')](_0x30bf05);}})[_0x0fa2('0x20')](function(_0x464254){if(_0x464254){_0x55f5b1=_0x464254['length'];if(!_0x1e0967['query'][_0x0fa2('0x46')](_0x0fa2('0x47'))){_0x30bf05['limit']=qs[_0x0fa2('0x32')](_0x1e0967[_0x0fa2('0x40')][_0x0fa2('0x32')]);_0x30bf05['offset']=qs[_0x0fa2('0x31')](_0x1e0967[_0x0fa2('0x40')][_0x0fa2('0x31')]);}return _0x3857b3['getConfigurations'](_0x30bf05);}})['then'](function(_0x5ca331){if(_0x5ca331){return _0x5ca331?{'count':_0x55f5b1,'rows':_0x5ca331}:null;}})['then'](respondWithResult(_0x322477,null))[_0x0fa2('0x2b')](handleError(_0x322477,null));};exports['addConfiguration']=function(_0xb521f3,_0x42a627,_0x421e07){if(_0xb521f3[_0x0fa2('0x58')]['id']){delete _0xb521f3[_0x0fa2('0x58')]['id'];}return db['ZendeskAccount'][_0x0fa2('0x59')]({'where':{'id':_0xb521f3[_0x0fa2('0x54')]['id']}})['then'](handleEntityNotFound(_0x42a627,null))['then'](function(_0x1be0bb){if(_0x1be0bb){_0xb521f3['body'][_0x0fa2('0x5d')]=_0x1be0bb['id'];_0xb521f3[_0x0fa2('0x58')][_0x0fa2('0x5e')]=integrations['getSubjects'](_0xb521f3[_0x0fa2('0x58')][_0x0fa2('0x5f')],_0xb521f3[_0x0fa2('0x58')][_0x0fa2('0x3d')]);_0xb521f3['body'][_0x0fa2('0x60')]=integrations['getDescriptions'](_0xb521f3['body'][_0x0fa2('0x5f')],_0xb521f3['body'][_0x0fa2('0x3d')]);return db[_0x0fa2('0x5a')][_0x0fa2('0x57')](_0xb521f3['body'],{'include':[{'model':db[_0x0fa2('0x61')],'as':_0x0fa2('0x5e')},{'model':db[_0x0fa2('0x61')],'as':_0x0fa2('0x60')}]});}return null;})[_0x0fa2('0x20')](respondWithResult(_0x42a627,null))[_0x0fa2('0x2b')](handleError(_0x42a627,null));};exports[_0x0fa2('0x62')]=function(_0x1d14c0,_0x4f0e54,_0x1b9ae5){var _0x3d6915='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x1d14c0[_0x0fa2('0x54')]['id']},'attributes':['id',_0x0fa2('0x63'),_0x0fa2('0x64'),_0x0fa2('0x65'),_0x0fa2('0x66'),_0x0fa2('0x67')]})[_0x0fa2('0x20')](handleEntityNotFound(_0x4f0e54,null))[_0x0fa2('0x20')](function(_0x20bce0){if(_0x20bce0){_0x3d6915=_0x20bce0[_0x0fa2('0x67')];var _0xd2140=_0x3d6915[_0x0fa2('0x68')](-0x1);if(_0xd2140==='/'){_0x3d6915=_0x3d6915[_0x0fa2('0x69')](0x0,_0x3d6915[_0x0fa2('0x6a')](_0xd2140));}var _0x43b2c0={'method':_0x0fa2('0x6b'),'uri':util['format'](_0x0fa2('0x6c'),_0x3d6915,_0x0fa2('0x6d')),'json':!![]};switch(_0x20bce0['authType']){case _0x0fa2('0x64'):_0x43b2c0[_0x0fa2('0x6e')]={'Authorization':util[_0x0fa2('0x6f')](_0x0fa2('0x70'),new Buffer(util[_0x0fa2('0x6f')](_0x0fa2('0x71'),_0x20bce0[_0x0fa2('0x63')],_0x20bce0[_0x0fa2('0x64')]))[_0x0fa2('0x72')]('base64'))};break;case _0x0fa2('0x65'):_0x43b2c0['headers']={'Authorization':util['format'](_0x0fa2('0x70'),new Buffer(util['format'](_0x0fa2('0x73'),_0x20bce0[_0x0fa2('0x63')],_0x20bce0[_0x0fa2('0x65')]))[_0x0fa2('0x72')](_0x0fa2('0x74')))};break;default:throw new db['Sequelize'][(_0x0fa2('0x75'))](_0x0fa2('0x76'));}return rp(_0x43b2c0);}})['then'](function(_0x189be8){if(_0x189be8){var _0x44c70d=[_0x0fa2('0x77'),_0x0fa2('0x78'),'group',_0x0fa2('0x79')];_[_0x0fa2('0x7a')](_0x189be8[_0x0fa2('0x6d')],function(_0x20360e){return _0x44c70d[_0x0fa2('0x7b')](_0x20360e[_0x0fa2('0x3d')]);});return{'count':_0x189be8[_0x0fa2('0x6d')][_0x0fa2('0x45')],'rows':_['map'](_0x189be8[_0x0fa2('0x6d')],function(_0x278436){return{'id':_0x278436['id'],'name':_0x278436[_0x0fa2('0x7c')]>0x7?_0x278436[_0x0fa2('0x7d')]:_0x278436[_0x0fa2('0x3d')],'custom':_0x278436[_0x0fa2('0x7c')]>0x7?!![]:![],'options':_0x278436['system_field_options']?_0x278436[_0x0fa2('0x7e')]:_0x278436[_0x0fa2('0x7f')]?_0x278436['custom_field_options']:[]};})};}})[_0x0fa2('0x20')](respondWithResult(_0x4f0e54,null))['catch'](function(_0x605c92){var _0x444a48=_0x1d14c0[_0x0fa2('0x40')][_0x0fa2('0x80')]?0x1f4:_0x605c92[_0x0fa2('0x81')]||0x1f4;logger['error'](_0x0fa2('0x82'),_0x0fa2('0x62'),_0x444a48,JSON[_0x0fa2('0x26')](_0x605c92));delete _0x605c92[_0x0fa2('0x37')];if(_0x444a48===0x191){_0x444a48=0x190;}_0x4f0e54[_0x0fa2('0x2d')](_0x444a48)['send'](_0x1d14c0[_0x0fa2('0x40')][_0x0fa2('0x80')]?{'message':_0x0fa2('0x83'),'statusCode':_0x605c92['statusCode']}:_0x605c92);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 9e0b0c8..d34a255 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 _0xe980=['exports','define','ZendeskAccount','util','api','moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x268a91,_0x5b628f){var _0x47a6f4=function(_0x958781){while(--_0x958781){_0x268a91['push'](_0x268a91['shift']());}};_0x47a6f4(++_0x5b628f);}(_0xe980,0x17f));var _0x0e98=function(_0x5cc9b9,_0xd0e7ac){_0x5cc9b9=_0x5cc9b9-0x0;var _0x2e75a5=_0xe980[_0x5cc9b9];return _0x2e75a5;};'use strict';var _=require('lodash');var util=require(_0x0e98('0x0'));var logger=require('../../config/logger')(_0x0e98('0x1'));var moment=require(_0x0e98('0x2'));var BPromise=require('bluebird');var rp=require(_0x0e98('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e98('0x4'));var config=require(_0x0e98('0x5'));var attributes=require(_0x0e98('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x0e98('0x7')]=function(_0x2877f2,_0x539fec){return _0x2877f2[_0x0e98('0x8')](_0x0e98('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x841b=['../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','api','moment','bluebird','rimraf','./intZendeskAccount.attributes'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0x841b,0x186));var _0xb841=function(_0x27b49f,_0x5609d2){_0x27b49f=_0x27b49f-0x0;var _0x1b75c2=_0x841b[_0x27b49f];return _0x1b75c2;};'use strict';var _=require(_0xb841('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb841('0x1'));var moment=require(_0xb841('0x2'));var BPromise=require(_0xb841('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb841('0x4'));var config=require('../../config/environment');var attributes=require(_0xb841('0x5'));var integrations=require(_0xb841('0x6'));module['exports']=function(_0x7576da,_0x65f97d){return _0x7576da['define'](_0xb841('0x7'),attributes,{'tableName':_0xb841('0x8'),'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 81335ab..337c8c0 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x50582c,_0x271787){var _0x4e0874=function(_0x12e857){while(--_0x12e857){_0x50582c['push'](_0x50582c['shift']());}};_0x4e0874(++_0x271787);}(_0xe706,0xa3));var _0x6e70=function(_0xaf8f29,_0x5754cf){_0xaf8f29=_0xaf8f29-0x0;var _0x391fed=_0xe706[_0xaf8f29];return _0x391fed;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x5bb608,_0x43ad8a){var _0x1f6eba=function(_0x1f0671){while(--_0x1f0671){_0x5bb608['push'](_0x5bb608['shift']());}};_0x1f6eba(++_0x43ad8a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index faa348b..4bb60a5 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 _0x30b8=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5d3a05,_0x4add38){var _0x12141a=function(_0x388eec){while(--_0x388eec){_0x5d3a05['push'](_0x5d3a05['shift']());}};_0x12141a(++_0x4add38);}(_0x30b8,0x165));var _0x830b=function(_0x4c09b7,_0x884a4f){_0x4c09b7=_0x4c09b7-0x0;var _0x10f1a8=_0x30b8[_0x4c09b7];return _0x10f1a8;};'use strict';var multer=require(_0x830b('0x0'));var util=require('util');var path=require(_0x830b('0x1'));var timeout=require(_0x830b('0x2'));var express=require(_0x830b('0x3'));var router=express[_0x830b('0x4')]();var auth=require(_0x830b('0x5'));var interaction=require(_0x830b('0x6'));var config=require(_0x830b('0x7'));var controller=require(_0x830b('0x8'));router[_0x830b('0x9')]('/',auth[_0x830b('0xa')](),controller[_0x830b('0xb')]);router[_0x830b('0x9')](_0x830b('0xc'),auth['isAuthenticated'](),controller[_0x830b('0xd')]);router[_0x830b('0x9')]('/:id/fields',auth[_0x830b('0xa')](),controller['getFields']);router['get'](_0x830b('0xe'),auth[_0x830b('0xa')](),controller[_0x830b('0xf')]);router[_0x830b('0x9')](_0x830b('0x10'),auth[_0x830b('0xa')](),controller[_0x830b('0x11')]);router[_0x830b('0x9')](_0x830b('0x12'),auth[_0x830b('0xa')](),controller[_0x830b('0x13')]);router[_0x830b('0x14')]('/',auth[_0x830b('0xa')](),controller[_0x830b('0x15')]);router[_0x830b('0x14')](_0x830b('0x12'),auth[_0x830b('0xa')](),controller[_0x830b('0x16')]);router[_0x830b('0x17')](_0x830b('0xc'),auth[_0x830b('0xa')](),controller[_0x830b('0x18')]);router[_0x830b('0x19')]('/:id',auth[_0x830b('0xa')](),controller[_0x830b('0x1a')]);module[_0x830b('0x1b')]=router; \ No newline at end of file +var _0x2799=['isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x208189,_0x2f2899){var _0x3454c7=function(_0x2af1b6){while(--_0x2af1b6){_0x208189['push'](_0x208189['shift']());}};_0x3454c7(++_0x2f2899);}(_0x2799,0x1c4));var _0x9279=function(_0xad9fe8,_0x35a1c7){_0xad9fe8=_0xad9fe8-0x0;var _0x229354=_0x2799[_0xad9fe8];return _0x229354;};'use strict';var multer=require(_0x9279('0x0'));var util=require(_0x9279('0x1'));var path=require(_0x9279('0x2'));var timeout=require(_0x9279('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9279('0x4'));var interaction=require(_0x9279('0x5'));var config=require(_0x9279('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x9279('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9279('0x7')]('/:id',auth[_0x9279('0x8')](),controller[_0x9279('0x9')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x9279('0xa')]);router[_0x9279('0x7')](_0x9279('0xb'),auth[_0x9279('0x8')](),controller[_0x9279('0xc')]);router['get'](_0x9279('0xd'),auth[_0x9279('0x8')](),controller['getDescriptions']);router[_0x9279('0x7')](_0x9279('0xe'),auth[_0x9279('0x8')](),controller['getTags']);router[_0x9279('0xf')]('/',auth[_0x9279('0x8')](),controller[_0x9279('0x10')]);router[_0x9279('0xf')](_0x9279('0xe'),auth['isAuthenticated'](),controller[_0x9279('0x11')]);router[_0x9279('0x12')](_0x9279('0x13'),auth['isAuthenticated'](),controller[_0x9279('0x14')]);router[_0x9279('0x15')](_0x9279('0x13'),auth[_0x9279('0x8')](),controller[_0x9279('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d255637..860058f 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 _0xa9c0=['STRING','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa9c0,0x13c));var _0x0a9c=function(_0x3834f5,_0x17715d){_0x3834f5=_0x3834f5-0x0;var _0xa50949=_0xa9c0[_0x3834f5];return _0xa50949;};'use strict';var Sequelize=require(_0x0a9c('0x0'));module[_0x0a9c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0a9c('0x2')]}}; \ No newline at end of file +var _0xe2cb=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2cb,0x1a5));var _0xbe2c=function(_0xfce7c1,_0x21d35d){_0xfce7c1=_0xfce7c1-0x0;var _0x5a12a2=_0xe2cb[_0xfce7c1];return _0x5a12a2;};'use strict';var Sequelize=require(_0xbe2c('0x0'));module[_0xbe2c('0x1')]={'name':{'type':Sequelize[_0xbe2c('0x2')]},'description':{'type':Sequelize[_0xbe2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index eb3d3b4..4dcb2b9 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 _0x2e7b=['error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','length','create','body','find','getFields','findOne','ZendeskField','options','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3efe9b,_0x5b41a8){var _0x132073=function(_0x34459e){while(--_0x34459e){_0x3efe9b['push'](_0x3efe9b['shift']());}};_0x132073(++_0x5b41a8);}(_0x2e7b,0xfd));var _0xb2e7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2e7b[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2e7('0x1'));var jsonpatch=require(_0xb2e7('0x2'));var rp=require(_0xb2e7('0x3'));var moment=require(_0xb2e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb2e7('0x5'));var util=require(_0xb2e7('0x6'));var path=require(_0xb2e7('0x7'));var sox=require(_0xb2e7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2e7('0x9'));var squel=require('squel');var crypto=require(_0xb2e7('0xa'));var jsforce=require(_0xb2e7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb2e7('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2e7('0xd'));var authService=require(_0xb2e7('0xe'));var qs=require(_0xb2e7('0xf'));var as=require(_0xb2e7('0x10'));var hardwareService=require(_0xb2e7('0x11'));var logger=require(_0xb2e7('0x12'))(_0xb2e7('0x13'));var utils=require(_0xb2e7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb2e7('0x15'));var db=require(_0xb2e7('0x16'))['db'];var jayson=require(_0xb2e7('0x17'));var client=jayson[_0xb2e7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eb8a4,_0x3d1640,_0x2b0699,_0x585457){return new BPromise(function(_0x28b865,_0x49c7e1){var _0x231e3d=_0x585457||client;return _0x231e3d[_0xb2e7('0x19')](_0x4eb8a4,_0x2b0699)[_0xb2e7('0x1a')](function(_0x5b1040){logger[_0xb2e7('0x1b')](_0xb2e7('0x1c'),_0x3d1640,_0xb2e7('0x1d'));logger['debug'](_0xb2e7('0x1e'),_0x3d1640,_0xb2e7('0x1d'),JSON[_0xb2e7('0x1f')](_0x5b1040));if(_0x5b1040[_0xb2e7('0x20')]){if(_0x5b1040[_0xb2e7('0x20')][_0xb2e7('0x21')]===0x1f4){logger[_0xb2e7('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3d1640,_0x5b1040[_0xb2e7('0x20')][_0xb2e7('0x22')]);return _0x49c7e1(_0x5b1040[_0xb2e7('0x20')][_0xb2e7('0x22')]);}logger[_0xb2e7('0x20')](_0xb2e7('0x1c'),_0x3d1640,_0x5b1040[_0xb2e7('0x20')]['message']);return _0x28b865(_0x5b1040[_0xb2e7('0x20')]['message']);}else{logger[_0xb2e7('0x1b')](_0xb2e7('0x1c'),_0x3d1640,_0xb2e7('0x1d'));_0x28b865(_0x5b1040[_0xb2e7('0x23')][_0xb2e7('0x22')]);}})['catch'](function(_0x6b7ff9){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3d1640,_0x6b7ff9);_0x49c7e1(_0x6b7ff9);});});}function respondWithStatusCode(_0x18afcd,_0x34e44a){_0x34e44a=_0x34e44a||0xcc;return function(_0x444a80){if(_0x444a80){return _0x18afcd[_0xb2e7('0x24')](_0x34e44a);}return _0x18afcd[_0xb2e7('0x25')](_0x34e44a)['end']();};}function respondWithResult(_0xb9091e,_0xbb9dd1){_0xbb9dd1=_0xbb9dd1||0xc8;return function(_0x4afb20){if(_0x4afb20){return _0xb9091e[_0xb2e7('0x25')](_0xbb9dd1)['json'](_0x4afb20);}};}function respondWithFilteredResult(_0xa33769,_0x34abf6){return function(_0x5a28c3){if(_0x5a28c3){var _0x3520c0=_0x5a28c3[_0xb2e7('0x26')],_0x232d85=_0x34abf6[_0xb2e7('0x27')],_0x54a0f5=_0x34abf6[_0xb2e7('0x27')]+_0x34abf6[_0xb2e7('0x28')],_0x2bd16e;if(_0x54a0f5>=_0x3520c0){_0x54a0f5=_0x3520c0;_0x2bd16e=0xc8;}else{_0x2bd16e=0xce;}_0xa33769[_0xb2e7('0x25')](_0x2bd16e);return _0xa33769[_0xb2e7('0x29')](_0xb2e7('0x2a'),_0x232d85+'-'+_0x54a0f5+'/'+_0x3520c0)[_0xb2e7('0x2b')](_0x5a28c3);}return null;};}function patchUpdates(_0x37745e){return function(_0x275ee0){try{jsonpatch[_0xb2e7('0x2c')](_0x275ee0,_0x37745e,!![]);}catch(_0x36f000){return BPromise['reject'](_0x36f000);}return _0x275ee0[_0xb2e7('0x2d')]();};}function saveUpdates(_0x218390,_0x1f2a07){return function(_0x273282){if(_0x273282){return _0x273282[_0xb2e7('0x2e')](_0x218390)[_0xb2e7('0x1a')](function(_0x376f80){return _0x376f80;});}return null;};}function removeEntity(_0x1fc759,_0x5c5a9b){return function(_0x3da1ae){if(_0x3da1ae){return _0x3da1ae[_0xb2e7('0x2f')]()[_0xb2e7('0x1a')](function(){_0x1fc759[_0xb2e7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d194,_0x5a3c0f){return function(_0x5980a6){if(!_0x5980a6){_0x56d194[_0xb2e7('0x24')](0x194);}return _0x5980a6;};}function handleError(_0x26614b,_0x57cdde){_0x57cdde=_0x57cdde||0x1f4;return function(_0x527037){logger[_0xb2e7('0x20')](_0x527037[_0xb2e7('0x30')]);if(_0x527037[_0xb2e7('0x31')]){delete _0x527037[_0xb2e7('0x31')];}_0x26614b[_0xb2e7('0x25')](_0x57cdde)[_0xb2e7('0x32')](_0x527037);};}exports[_0xb2e7('0x33')]=function(_0x16677e,_0x569a45){var _0x19f6fc={},_0x16b9b1={},_0x791370={'count':0x0,'rows':[]};var _0x4c1b76=_[_0xb2e7('0x34')](db['ZendeskConfiguration'][_0xb2e7('0x35')],function(_0x45b3ec){return{'name':_0x45b3ec[_0xb2e7('0x36')],'type':_0x45b3ec[_0xb2e7('0x37')][_0xb2e7('0x38')]};});_0x16b9b1['model']=_[_0xb2e7('0x34')](_0x4c1b76,_0xb2e7('0x31'));_0x16b9b1[_0xb2e7('0x39')]=_[_0xb2e7('0x3a')](_0x16677e['query']);_0x16b9b1[_0xb2e7('0x3b')]=_[_0xb2e7('0x3c')](_0x16b9b1[_0xb2e7('0x3d')],_0x16b9b1[_0xb2e7('0x39')]);_0x19f6fc['attributes']=_[_0xb2e7('0x3c')](_0x16b9b1[_0xb2e7('0x3d')],qs['fields'](_0x16677e[_0xb2e7('0x39')][_0xb2e7('0x3e')]));_0x19f6fc[_0xb2e7('0x3f')]=_0x19f6fc['attributes']['length']?_0x19f6fc[_0xb2e7('0x3f')]:_0x16b9b1[_0xb2e7('0x3d')];if(!_0x16677e[_0xb2e7('0x39')][_0xb2e7('0x40')](_0xb2e7('0x41'))){_0x19f6fc[_0xb2e7('0x28')]=qs[_0xb2e7('0x28')](_0x16677e['query'][_0xb2e7('0x28')]);_0x19f6fc[_0xb2e7('0x27')]=qs[_0xb2e7('0x27')](_0x16677e[_0xb2e7('0x39')][_0xb2e7('0x27')]);}_0x19f6fc[_0xb2e7('0x42')]=qs[_0xb2e7('0x43')](_0x16677e[_0xb2e7('0x39')]['sort']);_0x19f6fc[_0xb2e7('0x44')]=qs[_0xb2e7('0x3b')](_[_0xb2e7('0x45')](_0x16677e[_0xb2e7('0x39')],_0x16b9b1[_0xb2e7('0x3b')]),_0x4c1b76);if(_0x16677e[_0xb2e7('0x39')][_0xb2e7('0x46')]){_0x19f6fc[_0xb2e7('0x44')]=_[_0xb2e7('0x47')](_0x19f6fc['where'],{'$or':_[_0xb2e7('0x34')](_0x4c1b76,function(_0x3d474b){if(_0x3d474b[_0xb2e7('0x37')]!==_0xb2e7('0x48')){var _0x855da6={};_0x855da6[_0x3d474b[_0xb2e7('0x31')]]={'$like':'%'+_0x16677e[_0xb2e7('0x39')][_0xb2e7('0x46')]+'%'};return _0x855da6;}})});}_0x19f6fc=_['merge']({},_0x19f6fc,_0x16677e['options']);var _0x3e8392={'where':_0x19f6fc[_0xb2e7('0x44')]};return db['ZendeskConfiguration'][_0xb2e7('0x26')](_0x3e8392)[_0xb2e7('0x1a')](function(_0x5532d7){_0x791370[_0xb2e7('0x26')]=_0x5532d7;if(_0x16677e['query'][_0xb2e7('0x49')]){_0x19f6fc[_0xb2e7('0x4a')]=[{'all':!![]}];}return db[_0xb2e7('0x4b')][_0xb2e7('0x4c')](_0x19f6fc);})['then'](function(_0x6453c9){_0x791370[_0xb2e7('0x4d')]=_0x6453c9;return _0x791370;})['then'](respondWithFilteredResult(_0x569a45,_0x19f6fc))[_0xb2e7('0x4e')](handleError(_0x569a45,null));};exports[_0xb2e7('0x4f')]=function(_0x4d3294,_0x2a92a5){var _0x381b4d={'raw':![],'where':{'id':_0x4d3294[_0xb2e7('0x50')]['id']}},_0x3475bb={};_0x3475bb[_0xb2e7('0x3d')]=_[_0xb2e7('0x3a')](db['ZendeskConfiguration'][_0xb2e7('0x35')]);_0x3475bb[_0xb2e7('0x39')]=_[_0xb2e7('0x3a')](_0x4d3294[_0xb2e7('0x39')]);_0x3475bb[_0xb2e7('0x3b')]=_[_0xb2e7('0x3c')](_0x3475bb['model'],_0x3475bb[_0xb2e7('0x39')]);_0x381b4d['attributes']=_['intersection'](_0x3475bb[_0xb2e7('0x3d')],qs['fields'](_0x4d3294[_0xb2e7('0x39')]['fields']));_0x381b4d['attributes']=_0x381b4d[_0xb2e7('0x3f')][_0xb2e7('0x51')]?_0x381b4d['attributes']:_0x3475bb['model'];if(_0x4d3294[_0xb2e7('0x39')][_0xb2e7('0x49')]){_0x381b4d[_0xb2e7('0x4a')]=[{'all':!![]}];}_0x381b4d=_[_0xb2e7('0x47')]({},_0x381b4d,_0x4d3294['options']);return db[_0xb2e7('0x4b')]['find'](_0x381b4d)[_0xb2e7('0x1a')](handleEntityNotFound(_0x2a92a5,null))[_0xb2e7('0x1a')](respondWithResult(_0x2a92a5,null))[_0xb2e7('0x4e')](handleError(_0x2a92a5,null));};exports[_0xb2e7('0x52')]=function(_0x1f363f,_0x170be1){return db[_0xb2e7('0x4b')]['create'](_0x1f363f[_0xb2e7('0x53')],{})[_0xb2e7('0x1a')](respondWithResult(_0x170be1,0xc9))[_0xb2e7('0x4e')](handleError(_0x170be1,null));};exports[_0xb2e7('0x2e')]=function(_0x3176c0,_0x2a1f64){if(_0x3176c0[_0xb2e7('0x53')]['id']){delete _0x3176c0[_0xb2e7('0x53')]['id'];}return db['ZendeskConfiguration'][_0xb2e7('0x54')]({'where':{'id':_0x3176c0['params']['id']}})[_0xb2e7('0x1a')](handleEntityNotFound(_0x2a1f64,null))[_0xb2e7('0x1a')](saveUpdates(_0x3176c0[_0xb2e7('0x53')],null))[_0xb2e7('0x1a')](respondWithResult(_0x2a1f64,null))[_0xb2e7('0x4e')](handleError(_0x2a1f64,null));};exports[_0xb2e7('0x2f')]=function(_0xb47843,_0x21256d){return db[_0xb2e7('0x4b')]['find']({'where':{'id':_0xb47843['params']['id']}})[_0xb2e7('0x1a')](handleEntityNotFound(_0x21256d,null))[_0xb2e7('0x1a')](removeEntity(_0x21256d,null))[_0xb2e7('0x4e')](handleError(_0x21256d,null));};exports[_0xb2e7('0x55')]=function(_0x393918,_0x61b5f5,_0x34c493){var _0x11c991={};var _0x3e9930={};var _0x2551fa;var _0xa1cf3e;return db['ZendeskConfiguration'][_0xb2e7('0x56')]({'where':{'id':_0x393918[_0xb2e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x61b5f5,null))[_0xb2e7('0x1a')](function(_0x186068){if(_0x186068){_0x2551fa=_0x186068;_0x3e9930[_0xb2e7('0x3d')]=_[_0xb2e7('0x3a')](db[_0xb2e7('0x57')][_0xb2e7('0x35')]);_0x3e9930['query']=_['keys'](_0x393918['query']);_0x3e9930[_0xb2e7('0x3b')]=_['intersection'](_0x3e9930[_0xb2e7('0x3d')],_0x3e9930[_0xb2e7('0x39')]);_0x11c991[_0xb2e7('0x3f')]=_[_0xb2e7('0x3c')](_0x3e9930[_0xb2e7('0x3d')],qs[_0xb2e7('0x3e')](_0x393918['query'][_0xb2e7('0x3e')]));_0x11c991[_0xb2e7('0x3f')]=_0x11c991['attributes'][_0xb2e7('0x51')]?_0x11c991[_0xb2e7('0x3f')]:_0x3e9930[_0xb2e7('0x3d')];_0x11c991[_0xb2e7('0x42')]=qs[_0xb2e7('0x43')](_0x393918[_0xb2e7('0x39')][_0xb2e7('0x43')]);_0x11c991[_0xb2e7('0x44')]=qs[_0xb2e7('0x3b')](_[_0xb2e7('0x45')](_0x393918[_0xb2e7('0x39')],_0x3e9930['filters']));if(_0x393918[_0xb2e7('0x39')][_0xb2e7('0x46')]){_0x11c991[_0xb2e7('0x44')]=_[_0xb2e7('0x47')](_0x11c991[_0xb2e7('0x44')],{'$or':_['map'](_0x11c991[_0xb2e7('0x3f')],function(_0x12185f){var _0x1b86d5={};_0x1b86d5[_0x12185f]={'$like':'%'+_0x393918[_0xb2e7('0x39')][_0xb2e7('0x46')]+'%'};return _0x1b86d5;})});}_0x11c991=_[_0xb2e7('0x47')]({},_0x11c991,_0x393918[_0xb2e7('0x58')]);return _0x2551fa[_0xb2e7('0x55')](_0x11c991);}})[_0xb2e7('0x1a')](function(_0xd2dec3){if(_0xd2dec3){_0xa1cf3e=_0xd2dec3[_0xb2e7('0x51')];if(!_0x393918[_0xb2e7('0x39')][_0xb2e7('0x40')](_0xb2e7('0x41'))){_0x11c991[_0xb2e7('0x28')]=qs['limit'](_0x393918['query'][_0xb2e7('0x28')]);_0x11c991[_0xb2e7('0x27')]=qs[_0xb2e7('0x27')](_0x393918[_0xb2e7('0x39')]['offset']);}return _0x2551fa[_0xb2e7('0x55')](_0x11c991);}})[_0xb2e7('0x1a')](function(_0x3b1ebc){if(_0x3b1ebc){return _0x3b1ebc?{'count':_0xa1cf3e,'rows':_0x3b1ebc}:null;}})[_0xb2e7('0x1a')](respondWithResult(_0x61b5f5,null))[_0xb2e7('0x4e')](handleError(_0x61b5f5,null));};exports[_0xb2e7('0x59')]=function(_0x5d4eb5,_0x13dcf0,_0xf82d4f){var _0x1d7991={};var _0x5c68b3={};var _0x1ce2f0;var _0x55309c;return db[_0xb2e7('0x4b')][_0xb2e7('0x56')]({'where':{'id':_0x5d4eb5[_0xb2e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x13dcf0,null))[_0xb2e7('0x1a')](function(_0x370cde){if(_0x370cde){_0x1ce2f0=_0x370cde;_0x5c68b3['model']=_[_0xb2e7('0x3a')](db['ZendeskField'][_0xb2e7('0x35')]);_0x5c68b3[_0xb2e7('0x39')]=_[_0xb2e7('0x3a')](_0x5d4eb5[_0xb2e7('0x39')]);_0x5c68b3[_0xb2e7('0x3b')]=_[_0xb2e7('0x3c')](_0x5c68b3['model'],_0x5c68b3[_0xb2e7('0x39')]);_0x1d7991[_0xb2e7('0x3f')]=_[_0xb2e7('0x3c')](_0x5c68b3['model'],qs[_0xb2e7('0x3e')](_0x5d4eb5[_0xb2e7('0x39')][_0xb2e7('0x3e')]));_0x1d7991[_0xb2e7('0x3f')]=_0x1d7991[_0xb2e7('0x3f')][_0xb2e7('0x51')]?_0x1d7991['attributes']:_0x5c68b3[_0xb2e7('0x3d')];_0x1d7991[_0xb2e7('0x42')]=qs['sort'](_0x5d4eb5['query'][_0xb2e7('0x43')]);_0x1d7991[_0xb2e7('0x44')]=qs[_0xb2e7('0x3b')](_[_0xb2e7('0x45')](_0x5d4eb5[_0xb2e7('0x39')],_0x5c68b3[_0xb2e7('0x3b')]));if(_0x5d4eb5[_0xb2e7('0x39')][_0xb2e7('0x46')]){_0x1d7991[_0xb2e7('0x44')]=_['merge'](_0x1d7991[_0xb2e7('0x44')],{'$or':_['map'](_0x1d7991['attributes'],function(_0x475f2d){var _0xba2e7b={};_0xba2e7b[_0x475f2d]={'$like':'%'+_0x5d4eb5[_0xb2e7('0x39')][_0xb2e7('0x46')]+'%'};return _0xba2e7b;})});}_0x1d7991=_['merge']({},_0x1d7991,_0x5d4eb5[_0xb2e7('0x58')]);return _0x1ce2f0[_0xb2e7('0x59')](_0x1d7991);}})['then'](function(_0x3e8938){if(_0x3e8938){_0x55309c=_0x3e8938['length'];if(!_0x5d4eb5[_0xb2e7('0x39')][_0xb2e7('0x40')](_0xb2e7('0x41'))){_0x1d7991['limit']=qs[_0xb2e7('0x28')](_0x5d4eb5[_0xb2e7('0x39')][_0xb2e7('0x28')]);_0x1d7991['offset']=qs[_0xb2e7('0x27')](_0x5d4eb5[_0xb2e7('0x39')]['offset']);}return _0x1ce2f0[_0xb2e7('0x59')](_0x1d7991);}})['then'](function(_0x24e2ce){if(_0x24e2ce){return _0x24e2ce?{'count':_0x55309c,'rows':_0x24e2ce}:null;}})[_0xb2e7('0x1a')](respondWithResult(_0x13dcf0,null))[_0xb2e7('0x4e')](handleError(_0x13dcf0,null));};exports['getDescriptions']=function(_0x3dcabb,_0x5e951b,_0x1c1c50){var _0x47b966={};var _0x5433c9={};var _0x4b4bb7;var _0x58cdd0;return db[_0xb2e7('0x4b')][_0xb2e7('0x56')]({'where':{'id':_0x3dcabb[_0xb2e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e951b,null))[_0xb2e7('0x1a')](function(_0x231385){if(_0x231385){_0x4b4bb7=_0x231385;_0x5433c9[_0xb2e7('0x3d')]=_[_0xb2e7('0x3a')](db[_0xb2e7('0x57')][_0xb2e7('0x35')]);_0x5433c9[_0xb2e7('0x39')]=_[_0xb2e7('0x3a')](_0x3dcabb[_0xb2e7('0x39')]);_0x5433c9[_0xb2e7('0x3b')]=_[_0xb2e7('0x3c')](_0x5433c9[_0xb2e7('0x3d')],_0x5433c9[_0xb2e7('0x39')]);_0x47b966[_0xb2e7('0x3f')]=_[_0xb2e7('0x3c')](_0x5433c9[_0xb2e7('0x3d')],qs['fields'](_0x3dcabb[_0xb2e7('0x39')]['fields']));_0x47b966[_0xb2e7('0x3f')]=_0x47b966['attributes'][_0xb2e7('0x51')]?_0x47b966[_0xb2e7('0x3f')]:_0x5433c9['model'];_0x47b966['order']=qs['sort'](_0x3dcabb[_0xb2e7('0x39')][_0xb2e7('0x43')]);_0x47b966[_0xb2e7('0x44')]=qs[_0xb2e7('0x3b')](_[_0xb2e7('0x45')](_0x3dcabb[_0xb2e7('0x39')],_0x5433c9[_0xb2e7('0x3b')]));if(_0x3dcabb[_0xb2e7('0x39')][_0xb2e7('0x46')]){_0x47b966[_0xb2e7('0x44')]=_['merge'](_0x47b966[_0xb2e7('0x44')],{'$or':_[_0xb2e7('0x34')](_0x47b966[_0xb2e7('0x3f')],function(_0xcddab0){var _0x2e0eb1={};_0x2e0eb1[_0xcddab0]={'$like':'%'+_0x3dcabb[_0xb2e7('0x39')][_0xb2e7('0x46')]+'%'};return _0x2e0eb1;})});}_0x47b966=_[_0xb2e7('0x47')]({},_0x47b966,_0x3dcabb[_0xb2e7('0x58')]);return _0x4b4bb7['getDescriptions'](_0x47b966);}})[_0xb2e7('0x1a')](function(_0xf763fc){if(_0xf763fc){_0x58cdd0=_0xf763fc[_0xb2e7('0x51')];if(!_0x3dcabb[_0xb2e7('0x39')]['hasOwnProperty'](_0xb2e7('0x41'))){_0x47b966['limit']=qs['limit'](_0x3dcabb[_0xb2e7('0x39')][_0xb2e7('0x28')]);_0x47b966[_0xb2e7('0x27')]=qs[_0xb2e7('0x27')](_0x3dcabb['query'][_0xb2e7('0x27')]);}return _0x4b4bb7[_0xb2e7('0x5a')](_0x47b966);}})[_0xb2e7('0x1a')](function(_0x4327c3){if(_0x4327c3){return _0x4327c3?{'count':_0x58cdd0,'rows':_0x4327c3}:null;}})[_0xb2e7('0x1a')](respondWithResult(_0x5e951b,null))[_0xb2e7('0x4e')](handleError(_0x5e951b,null));};exports[_0xb2e7('0x5b')]=function(_0x11aaa3,_0x5212ff,_0xd37321){var _0x21cf30={};var _0x16da90={};var _0x411bd7;var _0x4d48bc;return db[_0xb2e7('0x4b')][_0xb2e7('0x56')]({'where':{'id':_0x11aaa3[_0xb2e7('0x50')]['id']}})[_0xb2e7('0x1a')](handleEntityNotFound(_0x5212ff,null))[_0xb2e7('0x1a')](function(_0x558d59){if(_0x558d59){_0x411bd7=_0x558d59;_0x16da90['model']=_[_0xb2e7('0x3a')](db[_0xb2e7('0x5c')][_0xb2e7('0x35')]);_0x16da90[_0xb2e7('0x39')]=_[_0xb2e7('0x3a')](_0x11aaa3[_0xb2e7('0x39')]);_0x16da90[_0xb2e7('0x3b')]=_['intersection'](_0x16da90[_0xb2e7('0x3d')],_0x16da90[_0xb2e7('0x39')]);_0x21cf30['attributes']=_[_0xb2e7('0x3c')](_0x16da90[_0xb2e7('0x3d')],qs['fields'](_0x11aaa3[_0xb2e7('0x39')][_0xb2e7('0x3e')]));_0x21cf30[_0xb2e7('0x3f')]=_0x21cf30[_0xb2e7('0x3f')]['length']?_0x21cf30[_0xb2e7('0x3f')]:_0x16da90['model'];_0x21cf30[_0xb2e7('0x42')]=qs[_0xb2e7('0x43')](_0x11aaa3[_0xb2e7('0x39')]['sort']);_0x21cf30[_0xb2e7('0x44')]=qs[_0xb2e7('0x3b')](_[_0xb2e7('0x45')](_0x11aaa3[_0xb2e7('0x39')],_0x16da90['filters']));if(_0x11aaa3[_0xb2e7('0x39')][_0xb2e7('0x46')]){_0x21cf30[_0xb2e7('0x44')]=_[_0xb2e7('0x47')](_0x21cf30[_0xb2e7('0x44')],{'$or':_[_0xb2e7('0x34')](_0x21cf30[_0xb2e7('0x3f')],function(_0x3af5ac){var _0x3e2489={};_0x3e2489[_0x3af5ac]={'$like':'%'+_0x11aaa3[_0xb2e7('0x39')][_0xb2e7('0x46')]+'%'};return _0x3e2489;})});}_0x21cf30=_[_0xb2e7('0x47')]({},_0x21cf30,_0x11aaa3['options']);return _0x411bd7[_0xb2e7('0x5b')](_0x21cf30);}})['then'](function(_0x47c491){if(_0x47c491){_0x4d48bc=_0x47c491[_0xb2e7('0x51')];if(!_0x11aaa3[_0xb2e7('0x39')][_0xb2e7('0x40')]('nolimit')){_0x21cf30[_0xb2e7('0x28')]=qs['limit'](_0x11aaa3[_0xb2e7('0x39')]['limit']);_0x21cf30['offset']=qs[_0xb2e7('0x27')](_0x11aaa3[_0xb2e7('0x39')][_0xb2e7('0x27')]);}return _0x411bd7[_0xb2e7('0x5b')](_0x21cf30);}})[_0xb2e7('0x1a')](function(_0x202398){if(_0x202398){return _0x202398?{'count':_0x4d48bc,'rows':_0x202398}:null;}})[_0xb2e7('0x1a')](respondWithResult(_0x5212ff,null))[_0xb2e7('0x4e')](handleError(_0x5212ff,null));};exports[_0xb2e7('0x5d')]=function(_0x71544,_0x482ce8,_0x4d16e0){if(_0x71544[_0xb2e7('0x53')]['id']){delete _0x71544[_0xb2e7('0x53')]['id'];}return db[_0xb2e7('0x4b')][_0xb2e7('0x56')]({'where':{'id':_0x71544[_0xb2e7('0x50')]['id']}})[_0xb2e7('0x1a')](handleEntityNotFound(_0x482ce8,null))[_0xb2e7('0x1a')](function(_0x3fc053){if(_0x3fc053){return _0x3fc053[_0xb2e7('0x5d')](_0x71544[_0xb2e7('0x53')][_0xb2e7('0x5e')]||[]);}return null;})['then'](respondWithResult(_0x482ce8,null))['catch'](handleError(_0x482ce8,null));}; \ No newline at end of file +var _0x8299=['body','destroy','getFields','findOne','ZendeskField','sort','pick','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','create'];(function(_0x40139f,_0x5bddba){var _0xd951db=function(_0x430d38){while(--_0x430d38){_0x40139f['push'](_0x40139f['shift']());}};_0xd951db(++_0x5bddba);}(_0x8299,0x1e7));var _0x9829=function(_0x2046dd,_0x40a9ab){_0x2046dd=_0x2046dd-0x0;var _0x2eb055=_0x8299[_0x2046dd];return _0x2eb055;};'use strict';var pdf=require(_0x9829('0x0'));var emlformat=require(_0x9829('0x1'));var rimraf=require(_0x9829('0x2'));var zipdir=require(_0x9829('0x3'));var jsonpatch=require(_0x9829('0x4'));var rp=require(_0x9829('0x5'));var moment=require('moment');var BPromise=require(_0x9829('0x6'));var Mustache=require(_0x9829('0x7'));var util=require(_0x9829('0x8'));var path=require(_0x9829('0x9'));var sox=require('sox');var csv=require(_0x9829('0xa'));var ejs=require(_0x9829('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9829('0xc'));var crypto=require(_0x9829('0xd'));var jsforce=require(_0x9829('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9829('0xa'));var querystring=require(_0x9829('0xf'));var Papa=require(_0x9829('0x10'));var Redis=require(_0x9829('0x11'));var authService=require(_0x9829('0x12'));var qs=require(_0x9829('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9829('0x14'))(_0x9829('0x15'));var utils=require('../../config/utils');var config=require(_0x9829('0x16'));var licenseUtil=require(_0x9829('0x17'));var db=require(_0x9829('0x18'))['db'];var jayson=require(_0x9829('0x19'));var client=jayson[_0x9829('0x1a')][_0x9829('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4f8507,_0x58edf0,_0x42d208,_0x18c333){return new BPromise(function(_0xeb605c,_0x24386b){var _0xfdc698=_0x18c333||client;return _0xfdc698[_0x9829('0x1c')](_0x4f8507,_0x42d208)[_0x9829('0x1d')](function(_0x1f432b){logger[_0x9829('0x1e')](_0x9829('0x1f'),_0x58edf0,_0x9829('0x20'));logger['debug'](_0x9829('0x21'),_0x58edf0,_0x9829('0x20'),JSON[_0x9829('0x22')](_0x1f432b));if(_0x1f432b[_0x9829('0x23')]){if(_0x1f432b[_0x9829('0x23')][_0x9829('0x24')]===0x1f4){logger[_0x9829('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x58edf0,_0x1f432b[_0x9829('0x23')][_0x9829('0x25')]);return _0x24386b(_0x1f432b[_0x9829('0x23')][_0x9829('0x25')]);}logger[_0x9829('0x23')](_0x9829('0x1f'),_0x58edf0,_0x1f432b[_0x9829('0x23')][_0x9829('0x25')]);return _0xeb605c(_0x1f432b[_0x9829('0x23')][_0x9829('0x25')]);}else{logger[_0x9829('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s',_0x58edf0,_0x9829('0x20'));_0xeb605c(_0x1f432b[_0x9829('0x26')][_0x9829('0x25')]);}})[_0x9829('0x27')](function(_0xaf323e){logger[_0x9829('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x58edf0,_0xaf323e);_0x24386b(_0xaf323e);});});}function respondWithStatusCode(_0x43590a,_0x54b5fa){_0x54b5fa=_0x54b5fa||0xcc;return function(_0x4b4163){if(_0x4b4163){return _0x43590a['sendStatus'](_0x54b5fa);}return _0x43590a['status'](_0x54b5fa)[_0x9829('0x28')]();};}function respondWithResult(_0x3209c6,_0x2d7eeb){_0x2d7eeb=_0x2d7eeb||0xc8;return function(_0x1dbcd8){if(_0x1dbcd8){return _0x3209c6[_0x9829('0x29')](_0x2d7eeb)[_0x9829('0x2a')](_0x1dbcd8);}};}function respondWithFilteredResult(_0x4ac50e,_0x291410){return function(_0xbdfc7){if(_0xbdfc7){var _0x283b67=_0xbdfc7[_0x9829('0x2b')],_0x19e6e7=_0x291410[_0x9829('0x2c')],_0x22c854=_0x291410[_0x9829('0x2c')]+_0x291410[_0x9829('0x2d')],_0x273842;if(_0x22c854>=_0x283b67){_0x22c854=_0x283b67;_0x273842=0xc8;}else{_0x273842=0xce;}_0x4ac50e[_0x9829('0x29')](_0x273842);return _0x4ac50e[_0x9829('0x2e')](_0x9829('0x2f'),_0x19e6e7+'-'+_0x22c854+'/'+_0x283b67)[_0x9829('0x2a')](_0xbdfc7);}return null;};}function patchUpdates(_0x3f0df2){return function(_0x331934){try{jsonpatch[_0x9829('0x30')](_0x331934,_0x3f0df2,!![]);}catch(_0x33c2f0){return BPromise['reject'](_0x33c2f0);}return _0x331934[_0x9829('0x31')]();};}function saveUpdates(_0x28a3d2,_0x3fe6b7){return function(_0x47f102){if(_0x47f102){return _0x47f102[_0x9829('0x32')](_0x28a3d2)[_0x9829('0x1d')](function(_0xca1866){return _0xca1866;});}return null;};}function removeEntity(_0x3314b7,_0x3101a4){return function(_0x187acc){if(_0x187acc){return _0x187acc['destroy']()[_0x9829('0x1d')](function(){_0x3314b7[_0x9829('0x29')](0xcc)[_0x9829('0x28')]();});}};}function handleEntityNotFound(_0xb08748,_0x423a2d){return function(_0x52a5cf){if(!_0x52a5cf){_0xb08748['sendStatus'](0x194);}return _0x52a5cf;};}function handleError(_0x3126e6,_0x1026b1){_0x1026b1=_0x1026b1||0x1f4;return function(_0x5a51dc){logger[_0x9829('0x23')](_0x5a51dc[_0x9829('0x33')]);if(_0x5a51dc[_0x9829('0x34')]){delete _0x5a51dc[_0x9829('0x34')];}_0x3126e6[_0x9829('0x29')](_0x1026b1)[_0x9829('0x35')](_0x5a51dc);};}exports['index']=function(_0x3a399a,_0x1e317f){var _0x3bc672={},_0x142c4a={},_0x5b561b={'count':0x0,'rows':[]};var _0x425cd2=_[_0x9829('0x36')](db[_0x9829('0x37')][_0x9829('0x38')],function(_0x4886c6){return{'name':_0x4886c6[_0x9829('0x39')],'type':_0x4886c6[_0x9829('0x3a')][_0x9829('0x3b')]};});_0x142c4a['model']=_[_0x9829('0x36')](_0x425cd2,_0x9829('0x34'));_0x142c4a[_0x9829('0x3c')]=_[_0x9829('0x3d')](_0x3a399a[_0x9829('0x3c')]);_0x142c4a[_0x9829('0x3e')]=_[_0x9829('0x3f')](_0x142c4a[_0x9829('0x40')],_0x142c4a[_0x9829('0x3c')]);_0x3bc672[_0x9829('0x41')]=_[_0x9829('0x3f')](_0x142c4a[_0x9829('0x40')],qs[_0x9829('0x42')](_0x3a399a['query'][_0x9829('0x42')]));_0x3bc672['attributes']=_0x3bc672[_0x9829('0x41')][_0x9829('0x43')]?_0x3bc672[_0x9829('0x41')]:_0x142c4a[_0x9829('0x40')];if(!_0x3a399a['query'][_0x9829('0x44')](_0x9829('0x45'))){_0x3bc672['limit']=qs[_0x9829('0x2d')](_0x3a399a[_0x9829('0x3c')][_0x9829('0x2d')]);_0x3bc672['offset']=qs[_0x9829('0x2c')](_0x3a399a[_0x9829('0x3c')][_0x9829('0x2c')]);}_0x3bc672[_0x9829('0x46')]=qs['sort'](_0x3a399a['query']['sort']);_0x3bc672[_0x9829('0x47')]=qs[_0x9829('0x3e')](_['pick'](_0x3a399a[_0x9829('0x3c')],_0x142c4a[_0x9829('0x3e')]),_0x425cd2);if(_0x3a399a[_0x9829('0x3c')][_0x9829('0x48')]){_0x3bc672['where']=_['merge'](_0x3bc672['where'],{'$or':_['map'](_0x425cd2,function(_0x54cd18){if(_0x54cd18['type']!==_0x9829('0x49')){var _0x380381={};_0x380381[_0x54cd18[_0x9829('0x34')]]={'$like':'%'+_0x3a399a[_0x9829('0x3c')][_0x9829('0x48')]+'%'};return _0x380381;}})});}_0x3bc672=_[_0x9829('0x4a')]({},_0x3bc672,_0x3a399a['options']);var _0x2ebb90={'where':_0x3bc672[_0x9829('0x47')]};return db[_0x9829('0x37')]['count'](_0x2ebb90)['then'](function(_0xb8065b){_0x5b561b['count']=_0xb8065b;if(_0x3a399a[_0x9829('0x3c')][_0x9829('0x4b')]){_0x3bc672[_0x9829('0x4c')]=[{'all':!![]}];}return db[_0x9829('0x37')]['findAll'](_0x3bc672);})[_0x9829('0x1d')](function(_0x225c77){_0x5b561b[_0x9829('0x4d')]=_0x225c77;return _0x5b561b;})['then'](respondWithFilteredResult(_0x1e317f,_0x3bc672))['catch'](handleError(_0x1e317f,null));};exports[_0x9829('0x4e')]=function(_0x3dc977,_0x14b08f){var _0x2c06b5={'raw':![],'where':{'id':_0x3dc977[_0x9829('0x4f')]['id']}},_0x49ef08={};_0x49ef08['model']=_[_0x9829('0x3d')](db[_0x9829('0x37')]['rawAttributes']);_0x49ef08[_0x9829('0x3c')]=_[_0x9829('0x3d')](_0x3dc977['query']);_0x49ef08[_0x9829('0x3e')]=_[_0x9829('0x3f')](_0x49ef08[_0x9829('0x40')],_0x49ef08[_0x9829('0x3c')]);_0x2c06b5[_0x9829('0x41')]=_[_0x9829('0x3f')](_0x49ef08['model'],qs[_0x9829('0x42')](_0x3dc977['query'][_0x9829('0x42')]));_0x2c06b5[_0x9829('0x41')]=_0x2c06b5[_0x9829('0x41')][_0x9829('0x43')]?_0x2c06b5[_0x9829('0x41')]:_0x49ef08['model'];if(_0x3dc977[_0x9829('0x3c')]['includeAll']){_0x2c06b5['include']=[{'all':!![]}];}_0x2c06b5=_[_0x9829('0x4a')]({},_0x2c06b5,_0x3dc977[_0x9829('0x50')]);return db[_0x9829('0x37')][_0x9829('0x51')](_0x2c06b5)[_0x9829('0x1d')](handleEntityNotFound(_0x14b08f,null))[_0x9829('0x1d')](respondWithResult(_0x14b08f,null))[_0x9829('0x27')](handleError(_0x14b08f,null));};exports[_0x9829('0x52')]=function(_0x4775ee,_0x1b2d4e){return db['ZendeskConfiguration'][_0x9829('0x52')](_0x4775ee[_0x9829('0x53')],{})['then'](respondWithResult(_0x1b2d4e,0xc9))[_0x9829('0x27')](handleError(_0x1b2d4e,null));};exports[_0x9829('0x32')]=function(_0x476f67,_0x167c0f){if(_0x476f67['body']['id']){delete _0x476f67[_0x9829('0x53')]['id'];}return db[_0x9829('0x37')]['find']({'where':{'id':_0x476f67[_0x9829('0x4f')]['id']}})[_0x9829('0x1d')](handleEntityNotFound(_0x167c0f,null))['then'](saveUpdates(_0x476f67[_0x9829('0x53')],null))[_0x9829('0x1d')](respondWithResult(_0x167c0f,null))[_0x9829('0x27')](handleError(_0x167c0f,null));};exports[_0x9829('0x54')]=function(_0x5c576a,_0x139b5d){return db[_0x9829('0x37')][_0x9829('0x51')]({'where':{'id':_0x5c576a['params']['id']}})[_0x9829('0x1d')](handleEntityNotFound(_0x139b5d,null))[_0x9829('0x1d')](removeEntity(_0x139b5d,null))[_0x9829('0x27')](handleError(_0x139b5d,null));};exports[_0x9829('0x55')]=function(_0x4a8bfd,_0x57b872,_0x88f802){var _0x49caf1={};var _0x15dda7={};var _0x14015e;var _0x38f13f;return db[_0x9829('0x37')][_0x9829('0x56')]({'where':{'id':_0x4a8bfd[_0x9829('0x4f')]['id']}})[_0x9829('0x1d')](handleEntityNotFound(_0x57b872,null))['then'](function(_0x2f6d64){if(_0x2f6d64){_0x14015e=_0x2f6d64;_0x15dda7[_0x9829('0x40')]=_[_0x9829('0x3d')](db[_0x9829('0x57')]['rawAttributes']);_0x15dda7[_0x9829('0x3c')]=_[_0x9829('0x3d')](_0x4a8bfd[_0x9829('0x3c')]);_0x15dda7[_0x9829('0x3e')]=_['intersection'](_0x15dda7[_0x9829('0x40')],_0x15dda7[_0x9829('0x3c')]);_0x49caf1[_0x9829('0x41')]=_[_0x9829('0x3f')](_0x15dda7[_0x9829('0x40')],qs[_0x9829('0x42')](_0x4a8bfd[_0x9829('0x3c')][_0x9829('0x42')]));_0x49caf1[_0x9829('0x41')]=_0x49caf1[_0x9829('0x41')]['length']?_0x49caf1[_0x9829('0x41')]:_0x15dda7['model'];_0x49caf1[_0x9829('0x46')]=qs[_0x9829('0x58')](_0x4a8bfd['query'][_0x9829('0x58')]);_0x49caf1['where']=qs[_0x9829('0x3e')](_[_0x9829('0x59')](_0x4a8bfd['query'],_0x15dda7[_0x9829('0x3e')]));if(_0x4a8bfd[_0x9829('0x3c')][_0x9829('0x48')]){_0x49caf1['where']=_['merge'](_0x49caf1[_0x9829('0x47')],{'$or':_[_0x9829('0x36')](_0x49caf1['attributes'],function(_0x318989){var _0xa5eea6={};_0xa5eea6[_0x318989]={'$like':'%'+_0x4a8bfd[_0x9829('0x3c')][_0x9829('0x48')]+'%'};return _0xa5eea6;})});}_0x49caf1=_[_0x9829('0x4a')]({},_0x49caf1,_0x4a8bfd['options']);return _0x14015e['getFields'](_0x49caf1);}})[_0x9829('0x1d')](function(_0x5c646a){if(_0x5c646a){_0x38f13f=_0x5c646a[_0x9829('0x43')];if(!_0x4a8bfd[_0x9829('0x3c')][_0x9829('0x44')](_0x9829('0x45'))){_0x49caf1[_0x9829('0x2d')]=qs['limit'](_0x4a8bfd[_0x9829('0x3c')]['limit']);_0x49caf1[_0x9829('0x2c')]=qs[_0x9829('0x2c')](_0x4a8bfd[_0x9829('0x3c')]['offset']);}return _0x14015e[_0x9829('0x55')](_0x49caf1);}})[_0x9829('0x1d')](function(_0x2a805b){if(_0x2a805b){return _0x2a805b?{'count':_0x38f13f,'rows':_0x2a805b}:null;}})[_0x9829('0x1d')](respondWithResult(_0x57b872,null))[_0x9829('0x27')](handleError(_0x57b872,null));};exports['getSubjects']=function(_0x1c9d98,_0x286020,_0x51001a){var _0xa63d12={};var _0x5b5728={};var _0x412f20;var _0x1bc8f7;return db[_0x9829('0x37')][_0x9829('0x56')]({'where':{'id':_0x1c9d98[_0x9829('0x4f')]['id']}})[_0x9829('0x1d')](handleEntityNotFound(_0x286020,null))['then'](function(_0x2d4015){if(_0x2d4015){_0x412f20=_0x2d4015;_0x5b5728[_0x9829('0x40')]=_[_0x9829('0x3d')](db[_0x9829('0x57')][_0x9829('0x38')]);_0x5b5728[_0x9829('0x3c')]=_[_0x9829('0x3d')](_0x1c9d98[_0x9829('0x3c')]);_0x5b5728[_0x9829('0x3e')]=_['intersection'](_0x5b5728[_0x9829('0x40')],_0x5b5728[_0x9829('0x3c')]);_0xa63d12[_0x9829('0x41')]=_[_0x9829('0x3f')](_0x5b5728[_0x9829('0x40')],qs[_0x9829('0x42')](_0x1c9d98[_0x9829('0x3c')]['fields']));_0xa63d12['attributes']=_0xa63d12[_0x9829('0x41')][_0x9829('0x43')]?_0xa63d12[_0x9829('0x41')]:_0x5b5728[_0x9829('0x40')];_0xa63d12[_0x9829('0x46')]=qs['sort'](_0x1c9d98[_0x9829('0x3c')][_0x9829('0x58')]);_0xa63d12[_0x9829('0x47')]=qs[_0x9829('0x3e')](_[_0x9829('0x59')](_0x1c9d98[_0x9829('0x3c')],_0x5b5728[_0x9829('0x3e')]));if(_0x1c9d98[_0x9829('0x3c')][_0x9829('0x48')]){_0xa63d12[_0x9829('0x47')]=_['merge'](_0xa63d12[_0x9829('0x47')],{'$or':_[_0x9829('0x36')](_0xa63d12['attributes'],function(_0x3301d6){var _0x1ed4b7={};_0x1ed4b7[_0x3301d6]={'$like':'%'+_0x1c9d98['query'][_0x9829('0x48')]+'%'};return _0x1ed4b7;})});}_0xa63d12=_[_0x9829('0x4a')]({},_0xa63d12,_0x1c9d98[_0x9829('0x50')]);return _0x412f20['getSubjects'](_0xa63d12);}})[_0x9829('0x1d')](function(_0x5638c4){if(_0x5638c4){_0x1bc8f7=_0x5638c4[_0x9829('0x43')];if(!_0x1c9d98[_0x9829('0x3c')][_0x9829('0x44')](_0x9829('0x45'))){_0xa63d12['limit']=qs[_0x9829('0x2d')](_0x1c9d98['query'][_0x9829('0x2d')]);_0xa63d12[_0x9829('0x2c')]=qs['offset'](_0x1c9d98[_0x9829('0x3c')][_0x9829('0x2c')]);}return _0x412f20['getSubjects'](_0xa63d12);}})[_0x9829('0x1d')](function(_0x434c34){if(_0x434c34){return _0x434c34?{'count':_0x1bc8f7,'rows':_0x434c34}:null;}})['then'](respondWithResult(_0x286020,null))[_0x9829('0x27')](handleError(_0x286020,null));};exports[_0x9829('0x5a')]=function(_0x289d53,_0x435739,_0x5475b6){var _0x151f3a={};var _0x459f39={};var _0x3d7ab4;var _0x3f3993;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x289d53[_0x9829('0x4f')]['id']}})['then'](handleEntityNotFound(_0x435739,null))[_0x9829('0x1d')](function(_0x1ab295){if(_0x1ab295){_0x3d7ab4=_0x1ab295;_0x459f39[_0x9829('0x40')]=_['keys'](db[_0x9829('0x57')][_0x9829('0x38')]);_0x459f39[_0x9829('0x3c')]=_[_0x9829('0x3d')](_0x289d53[_0x9829('0x3c')]);_0x459f39[_0x9829('0x3e')]=_[_0x9829('0x3f')](_0x459f39[_0x9829('0x40')],_0x459f39[_0x9829('0x3c')]);_0x151f3a[_0x9829('0x41')]=_[_0x9829('0x3f')](_0x459f39[_0x9829('0x40')],qs[_0x9829('0x42')](_0x289d53[_0x9829('0x3c')][_0x9829('0x42')]));_0x151f3a['attributes']=_0x151f3a[_0x9829('0x41')][_0x9829('0x43')]?_0x151f3a['attributes']:_0x459f39['model'];_0x151f3a['order']=qs['sort'](_0x289d53[_0x9829('0x3c')]['sort']);_0x151f3a[_0x9829('0x47')]=qs[_0x9829('0x3e')](_[_0x9829('0x59')](_0x289d53[_0x9829('0x3c')],_0x459f39[_0x9829('0x3e')]));if(_0x289d53[_0x9829('0x3c')][_0x9829('0x48')]){_0x151f3a[_0x9829('0x47')]=_[_0x9829('0x4a')](_0x151f3a[_0x9829('0x47')],{'$or':_[_0x9829('0x36')](_0x151f3a[_0x9829('0x41')],function(_0x2a525b){var _0x41ec71={};_0x41ec71[_0x2a525b]={'$like':'%'+_0x289d53[_0x9829('0x3c')][_0x9829('0x48')]+'%'};return _0x41ec71;})});}_0x151f3a=_[_0x9829('0x4a')]({},_0x151f3a,_0x289d53[_0x9829('0x50')]);return _0x3d7ab4[_0x9829('0x5a')](_0x151f3a);}})[_0x9829('0x1d')](function(_0x531e89){if(_0x531e89){_0x3f3993=_0x531e89[_0x9829('0x43')];if(!_0x289d53['query']['hasOwnProperty'](_0x9829('0x45'))){_0x151f3a[_0x9829('0x2d')]=qs[_0x9829('0x2d')](_0x289d53[_0x9829('0x3c')][_0x9829('0x2d')]);_0x151f3a[_0x9829('0x2c')]=qs[_0x9829('0x2c')](_0x289d53[_0x9829('0x3c')]['offset']);}return _0x3d7ab4[_0x9829('0x5a')](_0x151f3a);}})[_0x9829('0x1d')](function(_0x5cd333){if(_0x5cd333){return _0x5cd333?{'count':_0x3f3993,'rows':_0x5cd333}:null;}})[_0x9829('0x1d')](respondWithResult(_0x435739,null))[_0x9829('0x27')](handleError(_0x435739,null));};exports[_0x9829('0x5b')]=function(_0xf79cf2,_0x2ea13d,_0x49ff6c){var _0x47f25e={};var _0x29a526={};var _0x1e5c43;var _0x49a51e;return db[_0x9829('0x37')]['findOne']({'where':{'id':_0xf79cf2[_0x9829('0x4f')]['id']}})[_0x9829('0x1d')](handleEntityNotFound(_0x2ea13d,null))[_0x9829('0x1d')](function(_0x16db6c){if(_0x16db6c){_0x1e5c43=_0x16db6c;_0x29a526[_0x9829('0x40')]=_[_0x9829('0x3d')](db[_0x9829('0x5c')][_0x9829('0x38')]);_0x29a526['query']=_[_0x9829('0x3d')](_0xf79cf2[_0x9829('0x3c')]);_0x29a526[_0x9829('0x3e')]=_['intersection'](_0x29a526[_0x9829('0x40')],_0x29a526[_0x9829('0x3c')]);_0x47f25e[_0x9829('0x41')]=_[_0x9829('0x3f')](_0x29a526['model'],qs[_0x9829('0x42')](_0xf79cf2[_0x9829('0x3c')][_0x9829('0x42')]));_0x47f25e[_0x9829('0x41')]=_0x47f25e[_0x9829('0x41')][_0x9829('0x43')]?_0x47f25e[_0x9829('0x41')]:_0x29a526[_0x9829('0x40')];_0x47f25e[_0x9829('0x46')]=qs['sort'](_0xf79cf2['query'][_0x9829('0x58')]);_0x47f25e[_0x9829('0x47')]=qs[_0x9829('0x3e')](_['pick'](_0xf79cf2[_0x9829('0x3c')],_0x29a526[_0x9829('0x3e')]));if(_0xf79cf2['query']['filter']){_0x47f25e['where']=_['merge'](_0x47f25e[_0x9829('0x47')],{'$or':_[_0x9829('0x36')](_0x47f25e['attributes'],function(_0x5cfac5){var _0x1d6a96={};_0x1d6a96[_0x5cfac5]={'$like':'%'+_0xf79cf2[_0x9829('0x3c')][_0x9829('0x48')]+'%'};return _0x1d6a96;})});}_0x47f25e=_[_0x9829('0x4a')]({},_0x47f25e,_0xf79cf2['options']);return _0x1e5c43[_0x9829('0x5b')](_0x47f25e);}})['then'](function(_0x5028c6){if(_0x5028c6){_0x49a51e=_0x5028c6['length'];if(!_0xf79cf2[_0x9829('0x3c')][_0x9829('0x44')](_0x9829('0x45'))){_0x47f25e['limit']=qs[_0x9829('0x2d')](_0xf79cf2[_0x9829('0x3c')]['limit']);_0x47f25e['offset']=qs[_0x9829('0x2c')](_0xf79cf2[_0x9829('0x3c')][_0x9829('0x2c')]);}return _0x1e5c43[_0x9829('0x5b')](_0x47f25e);}})[_0x9829('0x1d')](function(_0xdf834f){if(_0xdf834f){return _0xdf834f?{'count':_0x49a51e,'rows':_0xdf834f}:null;}})[_0x9829('0x1d')](respondWithResult(_0x2ea13d,null))[_0x9829('0x27')](handleError(_0x2ea13d,null));};exports[_0x9829('0x5d')]=function(_0x569afc,_0x37b340,_0xca0b3f){if(_0x569afc['body']['id']){delete _0x569afc[_0x9829('0x53')]['id'];}return db['ZendeskConfiguration'][_0x9829('0x56')]({'where':{'id':_0x569afc['params']['id']}})['then'](handleEntityNotFound(_0x37b340,null))[_0x9829('0x1d')](function(_0x2914b3){if(_0x2914b3){return _0x2914b3['setTags'](_0x569afc[_0x9829('0x53')][_0x9829('0x5e')]||[]);}return null;})[_0x9829('0x1d')](respondWithResult(_0x37b340,null))[_0x9829('0x27')](handleError(_0x37b340,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0540e46..988b4c1 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 _0x9050=['define','ZendeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xb8d37c,_0x10a6a4){var _0x400f4b=function(_0x479ae1){while(--_0x479ae1){_0xb8d37c['push'](_0xb8d37c['shift']());}};_0x400f4b(++_0x10a6a4);}(_0x9050,0x195));var _0x0905=function(_0x5c1b27,_0x5d810b){_0x5c1b27=_0x5c1b27-0x0;var _0x3033e7=_0x9050[_0x5c1b27];return _0x3033e7;};'use strict';var _=require(_0x0905('0x0'));var util=require(_0x0905('0x1'));var logger=require(_0x0905('0x2'))(_0x0905('0x3'));var moment=require(_0x0905('0x4'));var BPromise=require(_0x0905('0x5'));var rp=require(_0x0905('0x6'));var fs=require('fs');var path=require(_0x0905('0x7'));var rimraf=require(_0x0905('0x8'));var config=require(_0x0905('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0905('0xa')]=function(_0x2b5a05,_0x2c56fb){return _0x2b5a05[_0x0905('0xb')](_0x0905('0xc'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc013=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x434f33,_0x58357f){var _0x12a3c9=function(_0x281e35){while(--_0x281e35){_0x434f33['push'](_0x434f33['shift']());}};_0x12a3c9(++_0x58357f);}(_0xc013,0x1c8));var _0x3c01=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0xc013[_0x508685];return _0x976a76;};'use strict';var _=require('lodash');var util=require(_0x3c01('0x0'));var logger=require(_0x3c01('0x1'))(_0x3c01('0x2'));var moment=require(_0x3c01('0x3'));var BPromise=require(_0x3c01('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c01('0x5'));var rimraf=require(_0x3c01('0x6'));var config=require(_0x3c01('0x7'));var attributes=require(_0x3c01('0x8'));module[_0x3c01('0x9')]=function(_0x5ec843,_0x1af621){return _0x5ec843[_0x3c01('0xa')](_0x3c01('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 6490eca..870f9b1 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 _0xf568=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1277a3,_0xfa0e66){var _0x3c6822=function(_0x367b65){while(--_0x367b65){_0x1277a3['push'](_0x1277a3['shift']());}};_0x3c6822(++_0xfa0e66);}(_0xf568,0xec));var _0x8f56=function(_0x1aefa2,_0x1b503a){_0x1aefa2=_0x1aefa2-0x0;var _0x389788=_0xf568[_0x1aefa2];return _0x389788;};'use strict';var _=require(_0x8f56('0x0'));var util=require(_0x8f56('0x1'));var moment=require('moment');var BPromise=require(_0x8f56('0x2'));var rs=require(_0x8f56('0x3'));var fs=require('fs');var Redis=require(_0x8f56('0x4'));var db=require(_0x8f56('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f56('0x6'))('rpc');var config=require(_0x8f56('0x7'));var jayson=require(_0x8f56('0x8'));var client=jayson[_0x8f56('0x9')][_0x8f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fd467,_0x15c70d,_0x854ea5){return new BPromise(function(_0x148fc1,_0x59cd77){return client[_0x8f56('0xb')](_0x1fd467,_0x854ea5)[_0x8f56('0xc')](function(_0x3d17e1){logger[_0x8f56('0xd')](_0x8f56('0xe'),_0x15c70d,'request\x20sent');logger[_0x8f56('0xf')](_0x8f56('0x10'),_0x15c70d,_0x8f56('0x11'),JSON[_0x8f56('0x12')](_0x3d17e1));if(_0x3d17e1[_0x8f56('0x13')]){if(_0x3d17e1[_0x8f56('0x13')][_0x8f56('0x14')]===0x1f4){logger['error'](_0x8f56('0xe'),_0x15c70d,_0x3d17e1['error'][_0x8f56('0x15')]);return _0x59cd77(_0x3d17e1[_0x8f56('0x13')][_0x8f56('0x15')]);}logger[_0x8f56('0x13')](_0x8f56('0xe'),_0x15c70d,_0x3d17e1['error'][_0x8f56('0x15')]);return _0x148fc1(_0x3d17e1['error']['message']);}else{logger[_0x8f56('0xd')](_0x8f56('0xe'),_0x15c70d,_0x8f56('0x11'));_0x148fc1(_0x3d17e1['result'][_0x8f56('0x15')]);}})['catch'](function(_0x84d73e){logger[_0x8f56('0x13')](_0x8f56('0xe'),_0x15c70d,_0x84d73e);_0x59cd77(_0x84d73e);});});} \ No newline at end of file +var _0x36d4=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x47f371,_0x20501e){var _0x28f538=function(_0x3fff02){while(--_0x3fff02){_0x47f371['push'](_0x47f371['shift']());}};_0x28f538(++_0x20501e);}(_0x36d4,0x13a));var _0x436d=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x36d4[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0x436d('0x0'));var util=require(_0x436d('0x1'));var moment=require(_0x436d('0x2'));var BPromise=require(_0x436d('0x3'));var rs=require(_0x436d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x436d('0x5'))['db'];var utils=require(_0x436d('0x6'));var logger=require(_0x436d('0x7'))(_0x436d('0x8'));var config=require(_0x436d('0x9'));var jayson=require(_0x436d('0xa'));var client=jayson[_0x436d('0xb')][_0x436d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dae33,_0x7a1790,_0x55e647){return new BPromise(function(_0x1e9968,_0x5c8a4c){return client['request'](_0x3dae33,_0x55e647)[_0x436d('0xd')](function(_0x1a1087){logger[_0x436d('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7a1790,_0x436d('0xf'));logger[_0x436d('0x10')](_0x436d('0x11'),_0x7a1790,_0x436d('0xf'),JSON[_0x436d('0x12')](_0x1a1087));if(_0x1a1087['error']){if(_0x1a1087[_0x436d('0x13')][_0x436d('0x14')]===0x1f4){logger[_0x436d('0x13')](_0x436d('0x15'),_0x7a1790,_0x1a1087[_0x436d('0x13')][_0x436d('0x16')]);return _0x5c8a4c(_0x1a1087[_0x436d('0x13')]['message']);}logger[_0x436d('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7a1790,_0x1a1087['error'][_0x436d('0x16')]);return _0x1e9968(_0x1a1087[_0x436d('0x13')]['message']);}else{logger[_0x436d('0xe')](_0x436d('0x15'),_0x7a1790,'request\x20sent');_0x1e9968(_0x1a1087['result'][_0x436d('0x16')]);}})[_0x436d('0x17')](function(_0x214be7){logger['error'](_0x436d('0x15'),_0x7a1790,_0x214be7);_0x5c8a4c(_0x214be7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0187f45..7812434 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 _0x9df1=['destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','show','delete'];(function(_0x3fc59a,_0x5c0c1d){var _0x2af724=function(_0xa23f3e){while(--_0xa23f3e){_0x3fc59a['push'](_0x3fc59a['shift']());}};_0x2af724(++_0x5c0c1d);}(_0x9df1,0xcd));var _0x19df=function(_0x15d8dd,_0x58ad74){_0x15d8dd=_0x15d8dd-0x0;var _0x37147c=_0x9df1[_0x15d8dd];return _0x37147c;};'use strict';var multer=require(_0x19df('0x0'));var util=require(_0x19df('0x1'));var path=require(_0x19df('0x2'));var timeout=require(_0x19df('0x3'));var express=require(_0x19df('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x19df('0x5'));var config=require('../../config/environment');var controller=require(_0x19df('0x6'));router[_0x19df('0x7')]('/',auth[_0x19df('0x8')](),controller['index']);router[_0x19df('0x7')]('/:id',auth[_0x19df('0x8')](),controller[_0x19df('0x9')]);router['post']('/',auth[_0x19df('0x8')](),controller['create']);router['put']('/:id',auth[_0x19df('0x8')](),controller['update']);router[_0x19df('0xa')]('/:id',auth[_0x19df('0x8')](),controller[_0x19df('0xb')]);module['exports']=router; \ No newline at end of file +var _0xdcd5=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdcd5,0x1a9));var _0x5dcd=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0xdcd5[_0x3cd91d];return _0x3b4fab;};'use strict';var multer=require(_0x5dcd('0x0'));var util=require('util');var path=require(_0x5dcd('0x1'));var timeout=require(_0x5dcd('0x2'));var express=require(_0x5dcd('0x3'));var router=express['Router']();var auth=require(_0x5dcd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5dcd('0x5'));var controller=require(_0x5dcd('0x6'));router['get']('/',auth[_0x5dcd('0x7')](),controller[_0x5dcd('0x8')]);router[_0x5dcd('0x9')](_0x5dcd('0xa'),auth[_0x5dcd('0x7')](),controller[_0x5dcd('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5dcd('0xc')]);router['put'](_0x5dcd('0xa'),auth[_0x5dcd('0x7')](),controller[_0x5dcd('0xd')]);router[_0x5dcd('0xe')]('/:id',auth[_0x5dcd('0x7')](),controller[_0x5dcd('0xf')]);module[_0x5dcd('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 80751f8..6ea7579 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 _0x40c2=['STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3ba51f,_0x477efe){var _0x4eb778=function(_0x33a670){while(--_0x33a670){_0x3ba51f['push'](_0x3ba51f['shift']());}};_0x4eb778(++_0x477efe);}(_0x40c2,0x10d));var _0x240c=function(_0x17a33d,_0x1867d5){_0x17a33d=_0x17a33d-0x0;var _0x30dba2=_0x40c2[_0x17a33d];return _0x30dba2;};'use strict';var Sequelize=require('sequelize');module[_0x240c('0x0')]={'type':{'type':Sequelize[_0x240c('0x1')](_0x240c('0x2'),_0x240c('0x3'),'customVariable','keyValue'),'defaultValue':_0x240c('0x2')},'content':{'type':Sequelize[_0x240c('0x4')]},'key':{'type':Sequelize[_0x240c('0x4')]},'keyType':{'type':Sequelize[_0x240c('0x1')](_0x240c('0x2'),_0x240c('0x3'),_0x240c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x240c('0x4')]},'nameField':{'type':Sequelize[_0x240c('0x4')]},'customField':{'type':Sequelize[_0x240c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x240c('0x4')]}}; \ No newline at end of file +var _0x9933=['STRING','sequelize','exports','string','customVariable','keyValue'];(function(_0x3427b6,_0x3567e6){var _0x3dcf63=function(_0x44fa77){while(--_0x44fa77){_0x3427b6['push'](_0x3427b6['shift']());}};_0x3dcf63(++_0x3567e6);}(_0x9933,0xe5));var _0x3993=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9933[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3993('0x0'));module[_0x3993('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3993('0x2'),'variable',_0x3993('0x3'),_0x3993('0x4')),'defaultValue':_0x3993('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x3993('0x2'),'variable',_0x3993('0x3'))},'keyContent':{'type':Sequelize[_0x3993('0x5')]},'idField':{'type':Sequelize[_0x3993('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3993('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ba4b3c7..969a5e1 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 _0x0295=['error','name','send','ZendeskField','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','update','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','save','destroy','then'];(function(_0x2d623d,_0x1580cf){var _0x47ee75=function(_0x472ba2){while(--_0x472ba2){_0x2d623d['push'](_0x2d623d['shift']());}};_0x47ee75(++_0x1580cf);}(_0x0295,0x1f0));var _0x5029=function(_0x159c68,_0xc544c9){_0x159c68=_0x159c68-0x0;var _0x32792f=_0x0295[_0x159c68];return _0x32792f;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=_0x10bf55[_0x5029('0x18')],_0x457c73=_0x317c20[_0x5029('0x19')],_0x353cba=_0x317c20['offset']+_0x317c20[_0x5029('0x1a')],_0x3786b5;if(_0x353cba>=_0x326923){_0x353cba=_0x326923;_0x3786b5=0xc8;}else{_0x3786b5=0xce;}_0xe278b7[_0x5029('0x16')](_0x3786b5);return _0xe278b7[_0x5029('0x1b')](_0x5029('0x1c'),_0x457c73+'-'+_0x353cba+'/'+_0x326923)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x5e115f){return function(_0xaba461){try{jsonpatch['apply'](_0xaba461,_0x5e115f,!![]);}catch(_0x226a5c){return BPromise['reject'](_0x226a5c);}return _0xaba461[_0x5029('0x1d')]();};}function saveUpdates(_0x8a414c,_0x2710aa){return function(_0x3cf0fb){if(_0x3cf0fb){return _0x3cf0fb['update'](_0x8a414c)['then'](function(_0x4c9184){return _0x4c9184;});}return null;};}function removeEntity(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1e')]()[_0x5029('0x1f')](function(){_0x4a49b6[_0x5029('0x16')](0xcc)[_0x5029('0x15')]();});}};}function handleEntityNotFound(_0x125c26,_0x356dac){return function(_0x3e857d){if(!_0x3e857d){_0x125c26['sendStatus'](0x194);}return _0x3e857d;};}function handleError(_0x564866,_0x49f347){_0x49f347=_0x49f347||0x1f4;return function(_0x588d90){logger[_0x5029('0x20')](_0x588d90['stack']);if(_0x588d90['name']){delete _0x588d90[_0x5029('0x21')];}_0x564866[_0x5029('0x16')](_0x49f347)[_0x5029('0x22')](_0x588d90);};}exports['index']=function(_0x2c501f,_0xb14bc){var _0x5e45c4={},_0x2b6d99={},_0x31f0a0={'count':0x0,'rows':[]};var _0x16ad8b=_['map'](db[_0x5029('0x23')][_0x5029('0x24')],function(_0xe5313e){return{'name':_0xe5313e['fieldName'],'type':_0xe5313e[_0x5029('0x25')][_0x5029('0x26')]};});_0x2b6d99['model']=_[_0x5029('0x27')](_0x16ad8b,_0x5029('0x21'));_0x2b6d99[_0x5029('0x28')]=_[_0x5029('0x29')](_0x2c501f[_0x5029('0x28')]);_0x2b6d99[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x2b6d99[_0x5029('0x2c')],_0x2b6d99[_0x5029('0x28')]);_0x5e45c4[_0x5029('0x2d')]=_[_0x5029('0x2b')](_0x2b6d99[_0x5029('0x2c')],qs['fields'](_0x2c501f[_0x5029('0x28')]['fields']));_0x5e45c4[_0x5029('0x2d')]=_0x5e45c4['attributes']['length']?_0x5e45c4[_0x5029('0x2d')]:_0x2b6d99[_0x5029('0x2c')];if(!_0x2c501f[_0x5029('0x28')]['hasOwnProperty'](_0x5029('0x2e'))){_0x5e45c4[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x2c501f[_0x5029('0x28')][_0x5029('0x1a')]);_0x5e45c4[_0x5029('0x19')]=qs[_0x5029('0x19')](_0x2c501f[_0x5029('0x28')][_0x5029('0x19')]);}_0x5e45c4['order']=qs[_0x5029('0x2f')](_0x2c501f[_0x5029('0x28')][_0x5029('0x2f')]);_0x5e45c4[_0x5029('0x30')]=qs['filters'](_[_0x5029('0x31')](_0x2c501f[_0x5029('0x28')],_0x2b6d99[_0x5029('0x2a')]),_0x16ad8b);if(_0x2c501f['query']['filter']){_0x5e45c4[_0x5029('0x30')]=_[_0x5029('0x32')](_0x5e45c4['where'],{'$or':_['map'](_0x16ad8b,function(_0x9656f2){if(_0x9656f2[_0x5029('0x25')]!==_0x5029('0x33')){var _0x3210cb={};_0x3210cb[_0x9656f2[_0x5029('0x21')]]={'$like':'%'+_0x2c501f[_0x5029('0x28')][_0x5029('0x34')]+'%'};return _0x3210cb;}})});}_0x5e45c4=_[_0x5029('0x32')]({},_0x5e45c4,_0x2c501f[_0x5029('0x35')]);var _0x3effa4={'where':_0x5e45c4[_0x5029('0x30')]};return db[_0x5029('0x23')][_0x5029('0x18')](_0x3effa4)[_0x5029('0x1f')](function(_0x5c547e){_0x31f0a0['count']=_0x5c547e;if(_0x2c501f[_0x5029('0x28')][_0x5029('0x36')]){_0x5e45c4[_0x5029('0x37')]=[{'all':!![]}];}return db['ZendeskField'][_0x5029('0x38')](_0x5e45c4);})[_0x5029('0x1f')](function(_0x52572a){_0x31f0a0[_0x5029('0x39')]=_0x52572a;return _0x31f0a0;})['then'](respondWithFilteredResult(_0xb14bc,_0x5e45c4))[_0x5029('0x3a')](handleError(_0xb14bc,null));};exports['show']=function(_0x2a6286,_0x359838){var _0x24a18d={'raw':!![],'where':{'id':_0x2a6286[_0x5029('0x3b')]['id']}},_0x78768={};_0x78768[_0x5029('0x2c')]=_[_0x5029('0x29')](db[_0x5029('0x23')][_0x5029('0x24')]);_0x78768['query']=_[_0x5029('0x29')](_0x2a6286[_0x5029('0x28')]);_0x78768[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x78768[_0x5029('0x2c')],_0x78768[_0x5029('0x28')]);_0x24a18d['attributes']=_[_0x5029('0x2b')](_0x78768[_0x5029('0x2c')],qs[_0x5029('0x3c')](_0x2a6286[_0x5029('0x28')][_0x5029('0x3c')]));_0x24a18d['attributes']=_0x24a18d[_0x5029('0x2d')][_0x5029('0x3d')]?_0x24a18d[_0x5029('0x2d')]:_0x78768[_0x5029('0x2c')];if(_0x2a6286[_0x5029('0x28')][_0x5029('0x36')]){_0x24a18d[_0x5029('0x37')]=[{'all':!![]}];}_0x24a18d=_[_0x5029('0x32')]({},_0x24a18d,_0x2a6286[_0x5029('0x35')]);return db['ZendeskField'][_0x5029('0x3e')](_0x24a18d)[_0x5029('0x1f')](handleEntityNotFound(_0x359838,null))[_0x5029('0x1f')](respondWithResult(_0x359838,null))[_0x5029('0x3a')](handleError(_0x359838,null));};exports['create']=function(_0x50d7c2,_0x17a515){return db[_0x5029('0x23')][_0x5029('0x3f')](_0x50d7c2[_0x5029('0x40')],{})[_0x5029('0x1f')](respondWithResult(_0x17a515,0xc9))[_0x5029('0x3a')](handleError(_0x17a515,null));};exports[_0x5029('0x41')]=function(_0x19a6ca,_0x1257a4){if(_0x19a6ca[_0x5029('0x40')]['id']){delete _0x19a6ca[_0x5029('0x40')]['id'];}return db[_0x5029('0x23')][_0x5029('0x3e')]({'where':{'id':_0x19a6ca[_0x5029('0x3b')]['id']}})[_0x5029('0x1f')](handleEntityNotFound(_0x1257a4,null))[_0x5029('0x1f')](saveUpdates(_0x19a6ca[_0x5029('0x40')],null))[_0x5029('0x1f')](respondWithResult(_0x1257a4,null))[_0x5029('0x3a')](handleError(_0x1257a4,null));};exports[_0x5029('0x1e')]=function(_0x1d0a38,_0x489457){return db[_0x5029('0x23')]['find']({'where':{'id':_0x1d0a38[_0x5029('0x3b')]['id']}})[_0x5029('0x1f')](handleEntityNotFound(_0x489457,null))['then'](removeEntity(_0x489457,null))['catch'](handleError(_0x489457,null));}; \ No newline at end of file +var _0x2da6=['hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','ZendeskField','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2da6,0x1dd));var _0x62da=function(_0x4fc148,_0x445cbe){_0x4fc148=_0x4fc148-0x0;var _0x225ecf=_0x2da6[_0x4fc148];return _0x225ecf;};'use strict';var pdf=require(_0x62da('0x0'));var emlformat=require(_0x62da('0x1'));var rimraf=require(_0x62da('0x2'));var zipdir=require(_0x62da('0x3'));var jsonpatch=require(_0x62da('0x4'));var rp=require(_0x62da('0x5'));var moment=require(_0x62da('0x6'));var BPromise=require(_0x62da('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x62da('0x8'));var sox=require(_0x62da('0x9'));var csv=require(_0x62da('0xa'));var ejs=require(_0x62da('0xb'));var fs=require('fs');var _=require(_0x62da('0xc'));var squel=require(_0x62da('0xd'));var crypto=require(_0x62da('0xe'));var jsforce=require(_0x62da('0xf'));var deskjs=require(_0x62da('0x10'));var toCsv=require('to-csv');var querystring=require(_0x62da('0x11'));var Papa=require(_0x62da('0x12'));var Redis=require(_0x62da('0x13'));var authService=require(_0x62da('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x62da('0x15'));var hardwareService=require(_0x62da('0x16'));var logger=require(_0x62da('0x17'))(_0x62da('0x18'));var utils=require(_0x62da('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x62da('0x1a'));var db=require(_0x62da('0x1b'))['db'];function respondWithStatusCode(_0xd27693,_0x362eeb){_0x362eeb=_0x362eeb||0xcc;return function(_0x37ba2e){if(_0x37ba2e){return _0xd27693['sendStatus'](_0x362eeb);}return _0xd27693['status'](_0x362eeb)[_0x62da('0x1c')]();};}function respondWithResult(_0x27a000,_0x1bd7f9){_0x1bd7f9=_0x1bd7f9||0xc8;return function(_0x191ed5){if(_0x191ed5){return _0x27a000[_0x62da('0x1d')](_0x1bd7f9)[_0x62da('0x1e')](_0x191ed5);}};}function respondWithFilteredResult(_0x3c6498,_0x624a1c){return function(_0x2cbdf6){if(_0x2cbdf6){var _0xcc1a25=_0x2cbdf6[_0x62da('0x1f')],_0x33ec53=_0x624a1c['offset'],_0x27ab5f=_0x624a1c['offset']+_0x624a1c[_0x62da('0x20')],_0x1f6bc8;if(_0x27ab5f>=_0xcc1a25){_0x27ab5f=_0xcc1a25;_0x1f6bc8=0xc8;}else{_0x1f6bc8=0xce;}_0x3c6498['status'](_0x1f6bc8);return _0x3c6498[_0x62da('0x21')](_0x62da('0x22'),_0x33ec53+'-'+_0x27ab5f+'/'+_0xcc1a25)[_0x62da('0x1e')](_0x2cbdf6);}return null;};}function patchUpdates(_0x4feaec){return function(_0x29191b){try{jsonpatch['apply'](_0x29191b,_0x4feaec,!![]);}catch(_0x2e6b7e){return BPromise[_0x62da('0x23')](_0x2e6b7e);}return _0x29191b[_0x62da('0x24')]();};}function saveUpdates(_0x2f7b01,_0x3d015f){return function(_0x267cef){if(_0x267cef){return _0x267cef[_0x62da('0x25')](_0x2f7b01)[_0x62da('0x26')](function(_0x1cb647){return _0x1cb647;});}return null;};}function removeEntity(_0x583fc0,_0x13bf6d){return function(_0x866a76){if(_0x866a76){return _0x866a76[_0x62da('0x27')]()[_0x62da('0x26')](function(){_0x583fc0[_0x62da('0x1d')](0xcc)[_0x62da('0x1c')]();});}};}function handleEntityNotFound(_0x24298a,_0x50ed6b){return function(_0x55fd3b){if(!_0x55fd3b){_0x24298a['sendStatus'](0x194);}return _0x55fd3b;};}function handleError(_0x292535,_0x1d1ef3){_0x1d1ef3=_0x1d1ef3||0x1f4;return function(_0x14897c){logger[_0x62da('0x28')](_0x14897c['stack']);if(_0x14897c[_0x62da('0x29')]){delete _0x14897c[_0x62da('0x29')];}_0x292535['status'](_0x1d1ef3)[_0x62da('0x2a')](_0x14897c);};}exports[_0x62da('0x2b')]=function(_0x1775ea,_0x5b7d26){var _0x41de3a={},_0x87f92b={},_0x438aa5={'count':0x0,'rows':[]};var _0x54da45=_['map'](db[_0x62da('0x2c')][_0x62da('0x2d')],function(_0x220ffc){return{'name':_0x220ffc['fieldName'],'type':_0x220ffc[_0x62da('0x2e')][_0x62da('0x2f')]};});_0x87f92b[_0x62da('0x30')]=_[_0x62da('0x31')](_0x54da45,_0x62da('0x29'));_0x87f92b[_0x62da('0x32')]=_['keys'](_0x1775ea[_0x62da('0x32')]);_0x87f92b['filters']=_[_0x62da('0x33')](_0x87f92b[_0x62da('0x30')],_0x87f92b[_0x62da('0x32')]);_0x41de3a[_0x62da('0x34')]=_[_0x62da('0x33')](_0x87f92b[_0x62da('0x30')],qs['fields'](_0x1775ea[_0x62da('0x32')][_0x62da('0x35')]));_0x41de3a[_0x62da('0x34')]=_0x41de3a['attributes'][_0x62da('0x36')]?_0x41de3a[_0x62da('0x34')]:_0x87f92b[_0x62da('0x30')];if(!_0x1775ea['query'][_0x62da('0x37')](_0x62da('0x38'))){_0x41de3a['limit']=qs[_0x62da('0x20')](_0x1775ea[_0x62da('0x32')]['limit']);_0x41de3a[_0x62da('0x39')]=qs[_0x62da('0x39')](_0x1775ea[_0x62da('0x32')][_0x62da('0x39')]);}_0x41de3a[_0x62da('0x3a')]=qs[_0x62da('0x3b')](_0x1775ea[_0x62da('0x32')][_0x62da('0x3b')]);_0x41de3a[_0x62da('0x3c')]=qs[_0x62da('0x3d')](_[_0x62da('0x3e')](_0x1775ea[_0x62da('0x32')],_0x87f92b[_0x62da('0x3d')]),_0x54da45);if(_0x1775ea[_0x62da('0x32')][_0x62da('0x3f')]){_0x41de3a[_0x62da('0x3c')]=_[_0x62da('0x40')](_0x41de3a['where'],{'$or':_[_0x62da('0x31')](_0x54da45,function(_0x5e9295){if(_0x5e9295[_0x62da('0x2e')]!==_0x62da('0x41')){var _0x30c908={};_0x30c908[_0x5e9295['name']]={'$like':'%'+_0x1775ea[_0x62da('0x32')][_0x62da('0x3f')]+'%'};return _0x30c908;}})});}_0x41de3a=_[_0x62da('0x40')]({},_0x41de3a,_0x1775ea[_0x62da('0x42')]);var _0x5093c1={'where':_0x41de3a[_0x62da('0x3c')]};return db[_0x62da('0x2c')][_0x62da('0x1f')](_0x5093c1)[_0x62da('0x26')](function(_0x160ac5){_0x438aa5[_0x62da('0x1f')]=_0x160ac5;if(_0x1775ea[_0x62da('0x32')][_0x62da('0x43')]){_0x41de3a[_0x62da('0x44')]=[{'all':!![]}];}return db['ZendeskField'][_0x62da('0x45')](_0x41de3a);})[_0x62da('0x26')](function(_0x584a82){_0x438aa5[_0x62da('0x46')]=_0x584a82;return _0x438aa5;})[_0x62da('0x26')](respondWithFilteredResult(_0x5b7d26,_0x41de3a))[_0x62da('0x47')](handleError(_0x5b7d26,null));};exports[_0x62da('0x48')]=function(_0x420291,_0xde827d){var _0x473e5c={'raw':!![],'where':{'id':_0x420291['params']['id']}},_0x4020f0={};_0x4020f0['model']=_['keys'](db[_0x62da('0x2c')]['rawAttributes']);_0x4020f0[_0x62da('0x32')]=_['keys'](_0x420291['query']);_0x4020f0['filters']=_[_0x62da('0x33')](_0x4020f0[_0x62da('0x30')],_0x4020f0['query']);_0x473e5c[_0x62da('0x34')]=_['intersection'](_0x4020f0[_0x62da('0x30')],qs['fields'](_0x420291['query'][_0x62da('0x35')]));_0x473e5c[_0x62da('0x34')]=_0x473e5c[_0x62da('0x34')]['length']?_0x473e5c[_0x62da('0x34')]:_0x4020f0[_0x62da('0x30')];if(_0x420291[_0x62da('0x32')][_0x62da('0x43')]){_0x473e5c[_0x62da('0x44')]=[{'all':!![]}];}_0x473e5c=_['merge']({},_0x473e5c,_0x420291['options']);return db[_0x62da('0x2c')][_0x62da('0x49')](_0x473e5c)[_0x62da('0x26')](handleEntityNotFound(_0xde827d,null))[_0x62da('0x26')](respondWithResult(_0xde827d,null))[_0x62da('0x47')](handleError(_0xde827d,null));};exports['create']=function(_0x47c679,_0x1de958){return db[_0x62da('0x2c')]['create'](_0x47c679[_0x62da('0x4a')],{})[_0x62da('0x26')](respondWithResult(_0x1de958,0xc9))[_0x62da('0x47')](handleError(_0x1de958,null));};exports[_0x62da('0x25')]=function(_0xb9b8d1,_0x4f5cb4){if(_0xb9b8d1[_0x62da('0x4a')]['id']){delete _0xb9b8d1[_0x62da('0x4a')]['id'];}return db[_0x62da('0x2c')][_0x62da('0x49')]({'where':{'id':_0xb9b8d1[_0x62da('0x4b')]['id']}})[_0x62da('0x26')](handleEntityNotFound(_0x4f5cb4,null))[_0x62da('0x26')](saveUpdates(_0xb9b8d1[_0x62da('0x4a')],null))[_0x62da('0x26')](respondWithResult(_0x4f5cb4,null))['catch'](handleError(_0x4f5cb4,null));};exports[_0x62da('0x27')]=function(_0x169560,_0x48ca2e){return db['ZendeskField']['find']({'where':{'id':_0x169560[_0x62da('0x4b')]['id']}})[_0x62da('0x26')](handleEntityNotFound(_0x48ca2e,null))[_0x62da('0x26')](removeEntity(_0x48ca2e,null))['catch'](handleError(_0x48ca2e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 76c3500..16ed886 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 _0x8f59=['./intZendeskField.attributes','define','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f59,0x11d));var _0x98f5=function(_0x522a17,_0xda5277){_0x522a17=_0x522a17-0x0;var _0xafaa0c=_0x8f59[_0x522a17];return _0xafaa0c;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x98f5('0xb'),'fields':[_0x98f5('0xc'),_0x98f5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbe1=['util','request-promise','path','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0xcbe1[_0x44ca6e];return _0x2edab2;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cbe('0x1'));var fs=require('fs');var path=require(_0x1cbe('0x2'));var rimraf=require('rimraf');var config=require(_0x1cbe('0x3'));var attributes=require('./intZendeskField.attributes');module[_0x1cbe('0x4')]=function(_0x168121,_0x5603f7){return _0x168121[_0x1cbe('0x5')](_0x1cbe('0x6'),attributes,{'tableName':_0x1cbe('0x7'),'paranoid':![],'indexes':[{'name':_0x1cbe('0x8'),'fields':[_0x1cbe('0x9'),_0x1cbe('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 7c97053..69535cc 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 _0xab0c=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0xab0c,0xad));var _0xcab0=function(_0x23504f,_0x364976){_0x23504f=_0x23504f-0x0;var _0x2ad5e1=_0xab0c[_0x23504f];return _0x2ad5e1;};'use strict';var _=require(_0xcab0('0x0'));var util=require(_0xcab0('0x1'));var moment=require(_0xcab0('0x2'));var BPromise=require('bluebird');var rs=require(_0xcab0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcab0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcab0('0x5'))(_0xcab0('0x6'));var config=require(_0xcab0('0x7'));var jayson=require(_0xcab0('0x8'));var client=jayson[_0xcab0('0x9')][_0xcab0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x344d82,_0x5aa25b,_0x1c6ac0){return new BPromise(function(_0x4de327,_0x38a6ea){return client[_0xcab0('0xb')](_0x344d82,_0x1c6ac0)[_0xcab0('0xc')](function(_0x145de8){logger[_0xcab0('0xd')](_0xcab0('0xe'),_0x5aa25b,_0xcab0('0xf'));logger[_0xcab0('0x10')](_0xcab0('0x11'),_0x5aa25b,_0xcab0('0xf'),JSON['stringify'](_0x145de8));if(_0x145de8[_0xcab0('0x12')]){if(_0x145de8['error'][_0xcab0('0x13')]===0x1f4){logger[_0xcab0('0x12')]('ZendeskField,\x20%s,\x20%s',_0x5aa25b,_0x145de8[_0xcab0('0x12')]['message']);return _0x38a6ea(_0x145de8[_0xcab0('0x12')][_0xcab0('0x14')]);}logger[_0xcab0('0x12')](_0xcab0('0xe'),_0x5aa25b,_0x145de8[_0xcab0('0x12')]['message']);return _0x4de327(_0x145de8[_0xcab0('0x12')][_0xcab0('0x14')]);}else{logger[_0xcab0('0xd')](_0xcab0('0xe'),_0x5aa25b,_0xcab0('0xf'));_0x4de327(_0x145de8[_0xcab0('0x15')][_0xcab0('0x14')]);}})[_0xcab0('0x16')](function(_0x57975){logger['error'](_0xcab0('0xe'),_0x5aa25b,_0x57975);_0x38a6ea(_0x57975);});});} \ No newline at end of file +var _0x69b6=['http','then','request\x20sent','stringify','error','ZendeskField,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x69b6,0x1ca));var _0x669b=function(_0x2ecffe,_0x187a1c){_0x2ecffe=_0x2ecffe-0x0;var _0x37f8c4=_0x69b6[_0x2ecffe];return _0x37f8c4;};'use strict';var _=require(_0x669b('0x0'));var util=require(_0x669b('0x1'));var moment=require(_0x669b('0x2'));var BPromise=require(_0x669b('0x3'));var rs=require(_0x669b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x669b('0x5'))['db'];var utils=require(_0x669b('0x6'));var logger=require(_0x669b('0x7'))(_0x669b('0x8'));var config=require('../../config/environment');var jayson=require(_0x669b('0x9'));var client=jayson['client'][_0x669b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58441a,_0x51baf5,_0x56c876){return new BPromise(function(_0x201d67,_0x4239f8){return client['request'](_0x58441a,_0x56c876)[_0x669b('0xb')](function(_0x4d0a04){logger['info']('ZendeskField,\x20%s,\x20%s',_0x51baf5,_0x669b('0xc'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x51baf5,_0x669b('0xc'),JSON[_0x669b('0xd')](_0x4d0a04));if(_0x4d0a04[_0x669b('0xe')]){if(_0x4d0a04[_0x669b('0xe')]['code']===0x1f4){logger['error'](_0x669b('0xf'),_0x51baf5,_0x4d0a04[_0x669b('0xe')]['message']);return _0x4239f8(_0x4d0a04[_0x669b('0xe')][_0x669b('0x10')]);}logger[_0x669b('0xe')](_0x669b('0xf'),_0x51baf5,_0x4d0a04[_0x669b('0xe')][_0x669b('0x10')]);return _0x201d67(_0x4d0a04['error'][_0x669b('0x10')]);}else{logger[_0x669b('0x11')](_0x669b('0xf'),_0x51baf5,_0x669b('0xc'));_0x201d67(_0x4d0a04['result'][_0x669b('0x10')]);}})['catch'](function(_0x193ad){logger[_0x669b('0xe')](_0x669b('0xf'),_0x51baf5,_0x193ad);_0x4239f8(_0x193ad);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 710804b..bd27d01 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 _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x4a7505,_0x342477){var _0x89cc2f=function(_0x234c93){while(--_0x234c93){_0x4a7505['push'](_0x4a7505['shift']());}};_0x89cc2f(++_0x342477);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x49625a,_0x386475){var _0x45b0e1=function(_0x3ee859){while(--_0x3ee859){_0x49625a['push'](_0x49625a['shift']());}};_0x45b0e1(++_0x386475);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a2d2b6c..679e64f 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 _0x45ce=['STRING'];(function(_0x3e44ae,_0x113c52){var _0x7cb300=function(_0x1800e4){while(--_0x1800e4){_0x3e44ae['push'](_0x3e44ae['shift']());}};_0x7cb300(++_0x113c52);}(_0x45ce,0xfd));var _0xe45c=function(_0x178a08,_0x282a73){_0x178a08=_0x178a08-0x0;var _0x1e945e=_0x45ce[_0x178a08];return _0x1e945e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe45c('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xe45c('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe45c('0x0')]},'serverUrl':{'type':Sequelize[_0xe45c('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0xe45c('0x0')]},'refreshToken':{'type':Sequelize[_0xe45c('0x0')]}}; \ No newline at end of file +var _0x9f33=['sequelize','exports','STRING'];(function(_0x350ae1,_0x209dfe){var _0x52f9fb=function(_0x3afa84){while(--_0x3afa84){_0x350ae1['push'](_0x350ae1['shift']());}};_0x52f9fb(++_0x209dfe);}(_0x9f33,0xd8));var _0x39f3=function(_0x71a175,_0x35e09c){_0x71a175=_0x71a175-0x0;var _0x974718=_0x9f33[_0x71a175];return _0x974718;};'use strict';var Sequelize=require(_0x39f3('0x0'));module[_0x39f3('0x1')]={'name':{'type':Sequelize[_0x39f3('0x2')]},'description':{'type':Sequelize[_0x39f3('0x2')]},'host':{'type':Sequelize[_0x39f3('0x2')]},'zone':{'type':Sequelize[_0x39f3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x39f3('0x2')]},'serverUrl':{'type':Sequelize[_0x39f3('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x39f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 57d1f42..eccaf7b 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 _0xf7f7=['WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','custom_field','data_type','pick_list_values','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ZohoAccount','count','includeAll','include','catch','params','keys','length','create','body','find','getConfigurations','ZohoConfiguration','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','Owner','Subject','Description'];(function(_0x25d767,_0x5dd365){var _0x5ad645=function(_0x372ab5){while(--_0x372ab5){_0x25d767['push'](_0x25d767['shift']());}};_0x5ad645(++_0x5dd365);}(_0xf7f7,0x192));var _0x7f7f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xf7f7[_0x2f3848];return _0x102668;};'use strict';var pdf=require(_0x7f7f('0x0'));var emlformat=require(_0x7f7f('0x1'));var rimraf=require(_0x7f7f('0x2'));var zipdir=require(_0x7f7f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f7f('0x4'));var BPromise=require(_0x7f7f('0x5'));var Mustache=require(_0x7f7f('0x6'));var util=require(_0x7f7f('0x7'));var path=require('path');var sox=require(_0x7f7f('0x8'));var csv=require(_0x7f7f('0x9'));var ejs=require(_0x7f7f('0xa'));var fs=require('fs');var _=require(_0x7f7f('0xb'));var squel=require('squel');var crypto=require(_0x7f7f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f7f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f7f('0xe'));var Papa=require('papaparse');var Redis=require(_0x7f7f('0xf'));var authService=require(_0x7f7f('0x10'));var qs=require(_0x7f7f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f7f('0x12'));var logger=require(_0x7f7f('0x13'))(_0x7f7f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7f7f('0x15'))['db'];var integrations=require(_0x7f7f('0x16'));var jayson=require(_0x7f7f('0x17'));var client=jayson[_0x7f7f('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56ec93,_0x35d690,_0xd54f98,_0xe4c7b1){return new BPromise(function(_0x1f0b3a,_0xfb6777){var _0x131ed1=_0xe4c7b1||client;return _0x131ed1[_0x7f7f('0x19')](_0x56ec93,_0xd54f98)[_0x7f7f('0x1a')](function(_0x329e81){logger[_0x7f7f('0x1b')](_0x7f7f('0x1c'),_0x35d690,_0x7f7f('0x1d'));logger[_0x7f7f('0x1e')](_0x7f7f('0x1f'),_0x35d690,_0x7f7f('0x1d'),JSON[_0x7f7f('0x20')](_0x329e81));if(_0x329e81[_0x7f7f('0x21')]){if(_0x329e81[_0x7f7f('0x21')][_0x7f7f('0x22')]===0x1f4){logger[_0x7f7f('0x21')](_0x7f7f('0x1c'),_0x35d690,_0x329e81['error'][_0x7f7f('0x23')]);return _0xfb6777(_0x329e81[_0x7f7f('0x21')][_0x7f7f('0x23')]);}logger['error'](_0x7f7f('0x1c'),_0x35d690,_0x329e81['error'][_0x7f7f('0x23')]);return _0x1f0b3a(_0x329e81[_0x7f7f('0x21')][_0x7f7f('0x23')]);}else{logger[_0x7f7f('0x1b')]('ZohoAccount,\x20%s,\x20%s',_0x35d690,_0x7f7f('0x1d'));_0x1f0b3a(_0x329e81[_0x7f7f('0x24')][_0x7f7f('0x23')]);}})['catch'](function(_0x2db644){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x35d690,_0x2db644);_0xfb6777(_0x2db644);});});}function respondWithStatusCode(_0x597be6,_0x3dae62){_0x3dae62=_0x3dae62||0xcc;return function(_0x47dcad){if(_0x47dcad){return _0x597be6[_0x7f7f('0x25')](_0x3dae62);}return _0x597be6['status'](_0x3dae62)[_0x7f7f('0x26')]();};}function respondWithResult(_0x158df8,_0x57f72a){_0x57f72a=_0x57f72a||0xc8;return function(_0x7968ed){if(_0x7968ed){return _0x158df8[_0x7f7f('0x27')](_0x57f72a)[_0x7f7f('0x28')](_0x7968ed);}};}function respondWithFilteredResult(_0x2d7ea6,_0x373cc3){return function(_0x43b0fd){if(_0x43b0fd){var _0x15522e=_0x43b0fd['count'],_0x3ec563=_0x373cc3[_0x7f7f('0x29')],_0x46a5d7=_0x373cc3[_0x7f7f('0x29')]+_0x373cc3[_0x7f7f('0x2a')],_0x4ab519;if(_0x46a5d7>=_0x15522e){_0x46a5d7=_0x15522e;_0x4ab519=0xc8;}else{_0x4ab519=0xce;}_0x2d7ea6['status'](_0x4ab519);return _0x2d7ea6[_0x7f7f('0x2b')](_0x7f7f('0x2c'),_0x3ec563+'-'+_0x46a5d7+'/'+_0x15522e)[_0x7f7f('0x28')](_0x43b0fd);}return null;};}function patchUpdates(_0x595877){return function(_0x508650){try{jsonpatch['apply'](_0x508650,_0x595877,!![]);}catch(_0x2c78b2){return BPromise[_0x7f7f('0x2d')](_0x2c78b2);}return _0x508650[_0x7f7f('0x2e')]();};}function saveUpdates(_0x24a1e2,_0x89dd20){return function(_0x2fe56a){if(_0x2fe56a){return _0x2fe56a[_0x7f7f('0x2f')](_0x24a1e2)[_0x7f7f('0x1a')](function(_0x1915e1){return _0x1915e1;});}return null;};}function removeEntity(_0x37d89b,_0xc29bc7){return function(_0x39501e){if(_0x39501e){return _0x39501e[_0x7f7f('0x30')]()[_0x7f7f('0x1a')](function(){_0x37d89b[_0x7f7f('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228e91,_0x4bfa7e){return function(_0x435aa5){if(!_0x435aa5){_0x228e91[_0x7f7f('0x25')](0x194);}return _0x435aa5;};}function handleError(_0x28cf6f,_0x296b9e){_0x296b9e=_0x296b9e||0x1f4;return function(_0x395f60){logger['error'](_0x395f60[_0x7f7f('0x31')]);if(_0x395f60['name']){delete _0x395f60[_0x7f7f('0x32')];}_0x28cf6f['status'](_0x296b9e)[_0x7f7f('0x33')](_0x395f60);};}exports['index']=function(_0x30512f,_0x5c25cb){var _0x3a3f0d={},_0x4824ce={},_0x4af190={'count':0x0,'rows':[]};var _0x3e3fe9=_['map'](db['ZohoAccount'][_0x7f7f('0x34')],function(_0x1fe526){return{'name':_0x1fe526[_0x7f7f('0x35')],'type':_0x1fe526['type'][_0x7f7f('0x36')]};});_0x4824ce[_0x7f7f('0x37')]=_[_0x7f7f('0x38')](_0x3e3fe9,_0x7f7f('0x32'));_0x4824ce[_0x7f7f('0x39')]=_['keys'](_0x30512f['query']);_0x4824ce[_0x7f7f('0x3a')]=_['intersection'](_0x4824ce['model'],_0x4824ce[_0x7f7f('0x39')]);_0x3a3f0d[_0x7f7f('0x3b')]=_[_0x7f7f('0x3c')](_0x4824ce[_0x7f7f('0x37')],qs['fields'](_0x30512f[_0x7f7f('0x39')][_0x7f7f('0x3d')]));_0x3a3f0d[_0x7f7f('0x3b')]=_0x3a3f0d[_0x7f7f('0x3b')]['length']?_0x3a3f0d[_0x7f7f('0x3b')]:_0x4824ce['model'];if(!_0x30512f['query']['hasOwnProperty'](_0x7f7f('0x3e'))){_0x3a3f0d[_0x7f7f('0x2a')]=qs[_0x7f7f('0x2a')](_0x30512f[_0x7f7f('0x39')]['limit']);_0x3a3f0d['offset']=qs[_0x7f7f('0x29')](_0x30512f['query'][_0x7f7f('0x29')]);}_0x3a3f0d[_0x7f7f('0x3f')]=qs[_0x7f7f('0x40')](_0x30512f['query'][_0x7f7f('0x40')]);_0x3a3f0d['where']=qs['filters'](_[_0x7f7f('0x41')](_0x30512f['query'],_0x4824ce['filters']),_0x3e3fe9);if(_0x30512f[_0x7f7f('0x39')][_0x7f7f('0x42')]){_0x3a3f0d[_0x7f7f('0x43')]=_[_0x7f7f('0x44')](_0x3a3f0d['where'],{'$or':_[_0x7f7f('0x38')](_0x3e3fe9,function(_0x4ef332){if(_0x4ef332[_0x7f7f('0x45')]!==_0x7f7f('0x46')){var _0x192b39={};_0x192b39[_0x4ef332[_0x7f7f('0x32')]]={'$like':'%'+_0x30512f[_0x7f7f('0x39')][_0x7f7f('0x42')]+'%'};return _0x192b39;}})});}_0x3a3f0d=_[_0x7f7f('0x44')]({},_0x3a3f0d,_0x30512f[_0x7f7f('0x47')]);var _0x4767f4={'where':_0x3a3f0d['where']};return db[_0x7f7f('0x48')][_0x7f7f('0x49')](_0x4767f4)['then'](function(_0x58e1b7){_0x4af190['count']=_0x58e1b7;if(_0x30512f[_0x7f7f('0x39')][_0x7f7f('0x4a')]){_0x3a3f0d[_0x7f7f('0x4b')]=[{'all':!![]}];}return db[_0x7f7f('0x48')]['findAll'](_0x3a3f0d);})[_0x7f7f('0x1a')](function(_0x53fd52){_0x4af190['rows']=_0x53fd52;return _0x4af190;})[_0x7f7f('0x1a')](respondWithFilteredResult(_0x5c25cb,_0x3a3f0d))[_0x7f7f('0x4c')](handleError(_0x5c25cb,null));};exports['show']=function(_0x96549e,_0x414316){var _0x2c87e3={'raw':![],'where':{'id':_0x96549e[_0x7f7f('0x4d')]['id']}},_0x3998f2={};_0x3998f2[_0x7f7f('0x37')]=_[_0x7f7f('0x4e')](db[_0x7f7f('0x48')][_0x7f7f('0x34')]);_0x3998f2[_0x7f7f('0x39')]=_['keys'](_0x96549e['query']);_0x3998f2['filters']=_[_0x7f7f('0x3c')](_0x3998f2[_0x7f7f('0x37')],_0x3998f2[_0x7f7f('0x39')]);_0x2c87e3[_0x7f7f('0x3b')]=_[_0x7f7f('0x3c')](_0x3998f2['model'],qs[_0x7f7f('0x3d')](_0x96549e[_0x7f7f('0x39')][_0x7f7f('0x3d')]));_0x2c87e3[_0x7f7f('0x3b')]=_0x2c87e3['attributes'][_0x7f7f('0x4f')]?_0x2c87e3[_0x7f7f('0x3b')]:_0x3998f2[_0x7f7f('0x37')];if(_0x96549e[_0x7f7f('0x39')][_0x7f7f('0x4a')]){_0x2c87e3['include']=[{'all':!![]}];}_0x2c87e3=_[_0x7f7f('0x44')]({},_0x2c87e3,_0x96549e['options']);return db[_0x7f7f('0x48')]['find'](_0x2c87e3)[_0x7f7f('0x1a')](handleEntityNotFound(_0x414316,null))['then'](respondWithResult(_0x414316,null))[_0x7f7f('0x4c')](handleError(_0x414316,null));};exports[_0x7f7f('0x50')]=function(_0x5ee1d1,_0x4e4b25){return db[_0x7f7f('0x48')]['create'](_0x5ee1d1[_0x7f7f('0x51')],{})[_0x7f7f('0x1a')](respondWithResult(_0x4e4b25,0xc9))['catch'](handleError(_0x4e4b25,null));};exports[_0x7f7f('0x2f')]=function(_0x5cf147,_0x4f0999){if(_0x5cf147[_0x7f7f('0x51')]['id']){delete _0x5cf147[_0x7f7f('0x51')]['id'];}return db[_0x7f7f('0x48')][_0x7f7f('0x52')]({'where':{'id':_0x5cf147['params']['id']}})['then'](handleEntityNotFound(_0x4f0999,null))[_0x7f7f('0x1a')](saveUpdates(_0x5cf147[_0x7f7f('0x51')],null))['then'](respondWithResult(_0x4f0999,null))[_0x7f7f('0x4c')](handleError(_0x4f0999,null));};exports[_0x7f7f('0x30')]=function(_0x5b5918,_0x12a08d){return db[_0x7f7f('0x48')][_0x7f7f('0x52')]({'where':{'id':_0x5b5918[_0x7f7f('0x4d')]['id']}})[_0x7f7f('0x1a')](handleEntityNotFound(_0x12a08d,null))[_0x7f7f('0x1a')](removeEntity(_0x12a08d,null))[_0x7f7f('0x4c')](handleError(_0x12a08d,null));};exports[_0x7f7f('0x53')]=function(_0x1c22cf,_0x483b03,_0x1132b9){var _0x3bfbd8={};var _0xd2b9c6={};var _0x96606c;var _0x26f6a5;return db[_0x7f7f('0x48')]['findOne']({'where':{'id':_0x1c22cf[_0x7f7f('0x4d')]['id']}})[_0x7f7f('0x1a')](handleEntityNotFound(_0x483b03,null))[_0x7f7f('0x1a')](function(_0x14eca8){if(_0x14eca8){_0x96606c=_0x14eca8;_0xd2b9c6[_0x7f7f('0x37')]=_['keys'](db[_0x7f7f('0x54')][_0x7f7f('0x34')]);_0xd2b9c6[_0x7f7f('0x39')]=_[_0x7f7f('0x4e')](_0x1c22cf[_0x7f7f('0x39')]);_0xd2b9c6[_0x7f7f('0x3a')]=_[_0x7f7f('0x3c')](_0xd2b9c6[_0x7f7f('0x37')],_0xd2b9c6[_0x7f7f('0x39')]);_0x3bfbd8[_0x7f7f('0x3b')]=_[_0x7f7f('0x3c')](_0xd2b9c6[_0x7f7f('0x37')],qs[_0x7f7f('0x3d')](_0x1c22cf[_0x7f7f('0x39')][_0x7f7f('0x3d')]));_0x3bfbd8[_0x7f7f('0x3b')]=_0x3bfbd8[_0x7f7f('0x3b')]['length']?_0x3bfbd8['attributes']:_0xd2b9c6[_0x7f7f('0x37')];_0x3bfbd8[_0x7f7f('0x3f')]=qs['sort'](_0x1c22cf[_0x7f7f('0x39')][_0x7f7f('0x40')]);_0x3bfbd8[_0x7f7f('0x43')]=qs[_0x7f7f('0x3a')](_[_0x7f7f('0x41')](_0x1c22cf[_0x7f7f('0x39')],_0xd2b9c6[_0x7f7f('0x3a')]));if(_0x1c22cf['query'][_0x7f7f('0x42')]){_0x3bfbd8['where']=_[_0x7f7f('0x44')](_0x3bfbd8[_0x7f7f('0x43')],{'$or':_['map'](_0x3bfbd8[_0x7f7f('0x3b')],function(_0x4dd259){var _0x5012ab={};_0x5012ab[_0x4dd259]={'$like':'%'+_0x1c22cf[_0x7f7f('0x39')][_0x7f7f('0x42')]+'%'};return _0x5012ab;})});}_0x3bfbd8=_[_0x7f7f('0x44')]({},_0x3bfbd8,_0x1c22cf['options']);return _0x96606c[_0x7f7f('0x53')](_0x3bfbd8);}})[_0x7f7f('0x1a')](function(_0x150b3a){if(_0x150b3a){_0x26f6a5=_0x150b3a[_0x7f7f('0x4f')];if(!_0x1c22cf['query'][_0x7f7f('0x55')](_0x7f7f('0x3e'))){_0x3bfbd8[_0x7f7f('0x2a')]=qs['limit'](_0x1c22cf[_0x7f7f('0x39')][_0x7f7f('0x2a')]);_0x3bfbd8[_0x7f7f('0x29')]=qs[_0x7f7f('0x29')](_0x1c22cf[_0x7f7f('0x39')][_0x7f7f('0x29')]);}return _0x96606c[_0x7f7f('0x53')](_0x3bfbd8);}})[_0x7f7f('0x1a')](function(_0xab8278){if(_0xab8278){return _0xab8278?{'count':_0x26f6a5,'rows':_0xab8278}:null;}})[_0x7f7f('0x1a')](respondWithResult(_0x483b03,null))['catch'](handleError(_0x483b03,null));};exports['addConfiguration']=function(_0x41992c,_0x1ec98e,_0x4f1f37){if(_0x41992c['body']['id']){delete _0x41992c['body']['id'];}return db[_0x7f7f('0x48')][_0x7f7f('0x56')]({'where':{'id':_0x41992c[_0x7f7f('0x4d')]['id']}})[_0x7f7f('0x1a')](handleEntityNotFound(_0x1ec98e,null))[_0x7f7f('0x1a')](function(_0x5120d2){if(_0x5120d2){_0x41992c[_0x7f7f('0x51')][_0x7f7f('0x57')]=_0x5120d2['id'];_0x41992c['body'][_0x7f7f('0x58')]=integrations[_0x7f7f('0x59')](_0x41992c[_0x7f7f('0x51')][_0x7f7f('0x5a')],_0x41992c['body'][_0x7f7f('0x45')]);_0x41992c[_0x7f7f('0x51')][_0x7f7f('0x5b')]=integrations['getDescriptions'](_0x41992c[_0x7f7f('0x51')][_0x7f7f('0x5a')],_0x41992c[_0x7f7f('0x51')]['type']);return db[_0x7f7f('0x54')]['create'](_0x41992c[_0x7f7f('0x51')],{'include':[{'model':db[_0x7f7f('0x5c')],'as':_0x7f7f('0x58')},{'model':db[_0x7f7f('0x5c')],'as':'Descriptions'}]});}return null;})[_0x7f7f('0x1a')](respondWithResult(_0x1ec98e,null))[_0x7f7f('0x4c')](handleError(_0x1ec98e,null));};function getAccessToken(_0x103764){return new Promise(function(_0x22f804,_0x317751){var _0x4f9037;switch(_0x103764[_0x7f7f('0x5d')]){case'US':_0x4f9037='https://accounts.zoho.com';break;case'AU':_0x4f9037=_0x7f7f('0x5e');break;case'EU':_0x4f9037=_0x7f7f('0x5f');break;case'IN':_0x4f9037=_0x7f7f('0x60');break;case'CN':_0x4f9037='https://accounts.zoho.com.cn';break;default:_0x4f9037=_0x7f7f('0x5f');break;}var _0x4652ff={'method':'POST','uri':_0x4f9037+'/oauth/v2/token','qs':{'refresh_token':_0x103764[_0x7f7f('0x61')],'client_id':_0x103764[_0x7f7f('0x62')],'client_secret':_0x103764[_0x7f7f('0x63')],'grant_type':_0x7f7f('0x64')},'json':!![]};return rp(_0x4652ff)[_0x7f7f('0x1a')](function(_0x10c71c){if(_0x10c71c['access_token']){_0x22f804(_0x10c71c[_0x7f7f('0x65')]);}else{_0x317751(_0x7f7f('0x66'));}})[_0x7f7f('0x4c')](function(_0x35fced){_0x317751(_0x35fced);});});}exports[_0x7f7f('0x67')]=function(_0x85ecaf,_0x5bd385,_0x34cd7a){var _0x472abd,_0x3a2cc6,_0x10ebc0,_0x2e4b96,_0x5c9d19;return db[_0x7f7f('0x48')]['findOne']({'where':{'id':_0x85ecaf['params']['id']},'attributes':['id',_0x7f7f('0x68'),_0x7f7f('0x5d'),_0x7f7f('0x62'),'clientSecret','serverUrl',_0x7f7f('0x22'),_0x7f7f('0x61')]})['then'](handleEntityNotFound(_0x5bd385,null))[_0x7f7f('0x1a')](function(_0x1e3e22){_0x5c9d19=_0x1e3e22;_0x472abd=_0x5c9d19[_0x7f7f('0x68')];_0x3a2cc6=_0x472abd===_0x7f7f('0x69')?'eu':_0x7f7f('0x6a');_0x10ebc0=_0x5c9d19[_0x7f7f('0x6b')];var _0x1a7da7=_0x10ebc0[_0x7f7f('0x6c')](-0x1);if(_0x1a7da7==='/'||_0x1a7da7==='\x5c'||_0x1a7da7===':'){_0x10ebc0=_0x10ebc0['substring'](0x0,_0x10ebc0[_0x7f7f('0x6d')](_0x1a7da7));}if(!_0x5c9d19[_0x7f7f('0x61')]){throw new Error(_0x7f7f('0x6e'));}return getAccessToken(_0x5c9d19);})[_0x7f7f('0x1a')](function(_0x12bdc1){if(_0x12bdc1){return rp({'method':_0x7f7f('0x6f'),'uri':util[_0x7f7f('0x70')](_0x7f7f('0x71'),_0x3a2cc6),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12bdc1},'json':!![]});}})[_0x7f7f('0x1a')](function(_0x1a5f1d){if(_0x1a5f1d){if(_0x1a5f1d[_0x7f7f('0x72')]&&_0x1a5f1d['response'][_0x7f7f('0x21')]){throw new Error(_0x1a5f1d[_0x7f7f('0x72')]['error']['message']);}var _0x481e90=[];var _0x4e6596=[];var _0x176c2e=[_0x7f7f('0x73'),_0x7f7f('0x74'),_0x7f7f('0x75'),_0x7f7f('0x76'),'Call_Duration',_0x7f7f('0x77'),_0x7f7f('0x78'),'Call_Type'];_0x4e6596=_[_0x7f7f('0x79')](_0x1a5f1d[_0x7f7f('0x3d')],function(_0x2ad5c0){return _0x176c2e[_0x7f7f('0x7a')](_0x2ad5c0[_0x7f7f('0x7b')]);});for(var _0x5c9589=0x0;_0x5c9589<_0x4e6596[_0x7f7f('0x4f')];_0x5c9589++){if(_0x4e6596[_0x5c9589][_0x7f7f('0x7c')]===![]){_0x481e90['push']({'id':_0x4e6596[_0x5c9589]['id'],'name':_0x4e6596[_0x5c9589]['display_label'],'custom':_0x4e6596[_0x5c9589][_0x7f7f('0x7d')],'options':_0x4e6596[_0x5c9589][_0x7f7f('0x7e')]==='picklist'&&_0x4e6596[_0x5c9589][_0x7f7f('0x7f')][_0x7f7f('0x4f')]>-0x1?_['map'](_0x4e6596[_0x5c9589][_0x7f7f('0x7f')],function(_0x19015f){return{'name':_0x19015f,'value':_0x19015f};}):[]});}}return{'count':_0x481e90['length'],'rows':_0x481e90};}else{return{'count':0x0,'rows':[]};}})[_0x7f7f('0x1a')](respondWithResult(_0x5bd385,null))[_0x7f7f('0x4c')](function(_0x50585a){var _0x38ebe5=_0x85ecaf[_0x7f7f('0x39')][_0x7f7f('0x80')]?0x1f4:_0x50585a['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x38ebe5,JSON['stringify'](_0x50585a));delete _0x50585a[_0x7f7f('0x32')];if(_0x38ebe5===0x191){_0x38ebe5=0x190;}_0x5bd385[_0x7f7f('0x27')](_0x38ebe5)['send'](_0x85ecaf['query']['test']?{'message':_0x7f7f('0x81'),'statusCode':_0x50585a['statusCode']}:_0x50585a);});}; \ No newline at end of file +var _0xf777=['rawAttributes','find','body','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','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','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','offset','limit','set','Content-Range','json','reject','save','update','destroy','sendStatus','stack','name','send','index','map','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','ZohoAccount','count','includeAll','rows','show','params'];(function(_0x5e8f1b,_0x443b1f){var _0x28a2c8=function(_0x589596){while(--_0x589596){_0x5e8f1b['push'](_0x5e8f1b['shift']());}};_0x28a2c8(++_0x443b1f);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7f77('0x0'));var emlformat=require(_0x7f77('0x1'));var rimraf=require(_0x7f77('0x2'));var zipdir=require(_0x7f77('0x3'));var jsonpatch=require(_0x7f77('0x4'));var rp=require(_0x7f77('0x5'));var moment=require(_0x7f77('0x6'));var BPromise=require(_0x7f77('0x7'));var Mustache=require(_0x7f77('0x8'));var util=require('util');var path=require(_0x7f77('0x9'));var sox=require(_0x7f77('0xa'));var csv=require('to-csv');var ejs=require(_0x7f77('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f77('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f77('0xd'));var deskjs=require(_0x7f77('0xe'));var toCsv=require(_0x7f77('0xf'));var querystring=require(_0x7f77('0x10'));var Papa=require(_0x7f77('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f77('0x12'));var as=require(_0x7f77('0x13'));var hardwareService=require(_0x7f77('0x14'));var logger=require(_0x7f77('0x15'))(_0x7f77('0x16'));var utils=require('../../config/utils');var config=require(_0x7f77('0x17'));var licenseUtil=require(_0x7f77('0x18'));var db=require(_0x7f77('0x19'))['db'];var integrations=require(_0x7f77('0x1a'));var jayson=require(_0x7f77('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c275e,_0x18f698,_0x3f7a60,_0x3f99e2){return new BPromise(function(_0xe15bf7,_0x194b15){var _0x1f0729=_0x3f99e2||client;return _0x1f0729[_0x7f77('0x1c')](_0x1c275e,_0x3f7a60)[_0x7f77('0x1d')](function(_0x3d8a45){logger[_0x7f77('0x1e')](_0x7f77('0x1f'),_0x18f698,_0x7f77('0x20'));logger[_0x7f77('0x21')](_0x7f77('0x22'),_0x18f698,_0x7f77('0x20'),JSON['stringify'](_0x3d8a45));if(_0x3d8a45['error']){if(_0x3d8a45[_0x7f77('0x23')]['code']===0x1f4){logger[_0x7f77('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x18f698,_0x3d8a45[_0x7f77('0x23')][_0x7f77('0x24')]);return _0x194b15(_0x3d8a45[_0x7f77('0x23')]['message']);}logger[_0x7f77('0x23')](_0x7f77('0x1f'),_0x18f698,_0x3d8a45['error'][_0x7f77('0x24')]);return _0xe15bf7(_0x3d8a45[_0x7f77('0x23')][_0x7f77('0x24')]);}else{logger['info'](_0x7f77('0x1f'),_0x18f698,'request\x20sent');_0xe15bf7(_0x3d8a45['result'][_0x7f77('0x24')]);}})[_0x7f77('0x25')](function(_0x583faf){logger['error'](_0x7f77('0x1f'),_0x18f698,_0x583faf);_0x194b15(_0x583faf);});});}function respondWithStatusCode(_0x87e6b6,_0x1d8fe3){_0x1d8fe3=_0x1d8fe3||0xcc;return function(_0x596139){if(_0x596139){return _0x87e6b6['sendStatus'](_0x1d8fe3);}return _0x87e6b6[_0x7f77('0x26')](_0x1d8fe3)[_0x7f77('0x27')]();};}function respondWithResult(_0x303043,_0x3d66d5){_0x3d66d5=_0x3d66d5||0xc8;return function(_0xd78c83){if(_0xd78c83){return _0x303043[_0x7f77('0x26')](_0x3d66d5)['json'](_0xd78c83);}};}function respondWithFilteredResult(_0x106ce3,_0x4e38e4){return function(_0x3c2ece){if(_0x3c2ece){var _0x29f31b=_0x3c2ece['count'],_0x5e119f=_0x4e38e4[_0x7f77('0x28')],_0x2bd7e0=_0x4e38e4['offset']+_0x4e38e4[_0x7f77('0x29')],_0x386842;if(_0x2bd7e0>=_0x29f31b){_0x2bd7e0=_0x29f31b;_0x386842=0xc8;}else{_0x386842=0xce;}_0x106ce3[_0x7f77('0x26')](_0x386842);return _0x106ce3[_0x7f77('0x2a')](_0x7f77('0x2b'),_0x5e119f+'-'+_0x2bd7e0+'/'+_0x29f31b)[_0x7f77('0x2c')](_0x3c2ece);}return null;};}function patchUpdates(_0xed30ce){return function(_0x92493e){try{jsonpatch['apply'](_0x92493e,_0xed30ce,!![]);}catch(_0x268c18){return BPromise[_0x7f77('0x2d')](_0x268c18);}return _0x92493e[_0x7f77('0x2e')]();};}function saveUpdates(_0x41be46,_0x473c5f){return function(_0x429729){if(_0x429729){return _0x429729[_0x7f77('0x2f')](_0x41be46)['then'](function(_0x57c638){return _0x57c638;});}return null;};}function removeEntity(_0x558a16,_0x11723e){return function(_0x1d6c28){if(_0x1d6c28){return _0x1d6c28[_0x7f77('0x30')]()[_0x7f77('0x1d')](function(){_0x558a16[_0x7f77('0x26')](0xcc)[_0x7f77('0x27')]();});}};}function handleEntityNotFound(_0x39161e,_0x3a9b6c){return function(_0x32f06b){if(!_0x32f06b){_0x39161e[_0x7f77('0x31')](0x194);}return _0x32f06b;};}function handleError(_0x3ec5bc,_0x5028d7){_0x5028d7=_0x5028d7||0x1f4;return function(_0x2a96f2){logger[_0x7f77('0x23')](_0x2a96f2[_0x7f77('0x32')]);if(_0x2a96f2[_0x7f77('0x33')]){delete _0x2a96f2[_0x7f77('0x33')];}_0x3ec5bc[_0x7f77('0x26')](_0x5028d7)[_0x7f77('0x34')](_0x2a96f2);};}exports[_0x7f77('0x35')]=function(_0x35f4d0,_0x1cf59a){var _0x4b1941={},_0x49332={},_0x57173c={'count':0x0,'rows':[]};var _0x35aa29=_[_0x7f77('0x36')](db['ZohoAccount']['rawAttributes'],function(_0x4437a8){return{'name':_0x4437a8[_0x7f77('0x37')],'type':_0x4437a8['type'][_0x7f77('0x38')]};});_0x49332['model']=_[_0x7f77('0x36')](_0x35aa29,_0x7f77('0x33'));_0x49332['query']=_[_0x7f77('0x39')](_0x35f4d0[_0x7f77('0x3a')]);_0x49332[_0x7f77('0x3b')]=_[_0x7f77('0x3c')](_0x49332[_0x7f77('0x3d')],_0x49332[_0x7f77('0x3a')]);_0x4b1941[_0x7f77('0x3e')]=_[_0x7f77('0x3c')](_0x49332[_0x7f77('0x3d')],qs['fields'](_0x35f4d0[_0x7f77('0x3a')][_0x7f77('0x3f')]));_0x4b1941[_0x7f77('0x3e')]=_0x4b1941[_0x7f77('0x3e')][_0x7f77('0x40')]?_0x4b1941[_0x7f77('0x3e')]:_0x49332['model'];if(!_0x35f4d0[_0x7f77('0x3a')]['hasOwnProperty'](_0x7f77('0x41'))){_0x4b1941[_0x7f77('0x29')]=qs['limit'](_0x35f4d0[_0x7f77('0x3a')]['limit']);_0x4b1941[_0x7f77('0x28')]=qs[_0x7f77('0x28')](_0x35f4d0[_0x7f77('0x3a')][_0x7f77('0x28')]);}_0x4b1941[_0x7f77('0x42')]=qs['sort'](_0x35f4d0[_0x7f77('0x3a')][_0x7f77('0x43')]);_0x4b1941[_0x7f77('0x44')]=qs[_0x7f77('0x3b')](_['pick'](_0x35f4d0[_0x7f77('0x3a')],_0x49332[_0x7f77('0x3b')]),_0x35aa29);if(_0x35f4d0[_0x7f77('0x3a')]['filter']){_0x4b1941[_0x7f77('0x44')]=_[_0x7f77('0x45')](_0x4b1941['where'],{'$or':_[_0x7f77('0x36')](_0x35aa29,function(_0x53c93d){if(_0x53c93d['type']!==_0x7f77('0x46')){var _0x451898={};_0x451898[_0x53c93d['name']]={'$like':'%'+_0x35f4d0[_0x7f77('0x3a')][_0x7f77('0x47')]+'%'};return _0x451898;}})});}_0x4b1941=_[_0x7f77('0x45')]({},_0x4b1941,_0x35f4d0[_0x7f77('0x48')]);var _0x47bfd7={'where':_0x4b1941[_0x7f77('0x44')]};return db[_0x7f77('0x49')][_0x7f77('0x4a')](_0x47bfd7)[_0x7f77('0x1d')](function(_0x504c9b){_0x57173c[_0x7f77('0x4a')]=_0x504c9b;if(_0x35f4d0[_0x7f77('0x3a')][_0x7f77('0x4b')]){_0x4b1941['include']=[{'all':!![]}];}return db[_0x7f77('0x49')]['findAll'](_0x4b1941);})[_0x7f77('0x1d')](function(_0x28ad07){_0x57173c[_0x7f77('0x4c')]=_0x28ad07;return _0x57173c;})['then'](respondWithFilteredResult(_0x1cf59a,_0x4b1941))['catch'](handleError(_0x1cf59a,null));};exports[_0x7f77('0x4d')]=function(_0x296152,_0x390c64){var _0x3b19fc={'raw':![],'where':{'id':_0x296152[_0x7f77('0x4e')]['id']}},_0x372a60={};_0x372a60[_0x7f77('0x3d')]=_[_0x7f77('0x39')](db[_0x7f77('0x49')][_0x7f77('0x4f')]);_0x372a60[_0x7f77('0x3a')]=_[_0x7f77('0x39')](_0x296152['query']);_0x372a60[_0x7f77('0x3b')]=_[_0x7f77('0x3c')](_0x372a60[_0x7f77('0x3d')],_0x372a60[_0x7f77('0x3a')]);_0x3b19fc[_0x7f77('0x3e')]=_[_0x7f77('0x3c')](_0x372a60[_0x7f77('0x3d')],qs[_0x7f77('0x3f')](_0x296152[_0x7f77('0x3a')][_0x7f77('0x3f')]));_0x3b19fc[_0x7f77('0x3e')]=_0x3b19fc['attributes'][_0x7f77('0x40')]?_0x3b19fc[_0x7f77('0x3e')]:_0x372a60[_0x7f77('0x3d')];if(_0x296152[_0x7f77('0x3a')][_0x7f77('0x4b')]){_0x3b19fc['include']=[{'all':!![]}];}_0x3b19fc=_[_0x7f77('0x45')]({},_0x3b19fc,_0x296152['options']);return db[_0x7f77('0x49')][_0x7f77('0x50')](_0x3b19fc)[_0x7f77('0x1d')](handleEntityNotFound(_0x390c64,null))[_0x7f77('0x1d')](respondWithResult(_0x390c64,null))[_0x7f77('0x25')](handleError(_0x390c64,null));};exports['create']=function(_0x11b484,_0x4a9650){return db[_0x7f77('0x49')]['create'](_0x11b484[_0x7f77('0x51')],{})[_0x7f77('0x1d')](respondWithResult(_0x4a9650,0xc9))[_0x7f77('0x25')](handleError(_0x4a9650,null));};exports[_0x7f77('0x2f')]=function(_0x413ea2,_0x55ec4c){if(_0x413ea2['body']['id']){delete _0x413ea2[_0x7f77('0x51')]['id'];}return db[_0x7f77('0x49')]['find']({'where':{'id':_0x413ea2[_0x7f77('0x4e')]['id']}})[_0x7f77('0x1d')](handleEntityNotFound(_0x55ec4c,null))['then'](saveUpdates(_0x413ea2[_0x7f77('0x51')],null))[_0x7f77('0x1d')](respondWithResult(_0x55ec4c,null))[_0x7f77('0x25')](handleError(_0x55ec4c,null));};exports[_0x7f77('0x30')]=function(_0x468ded,_0x401394){return db[_0x7f77('0x49')]['find']({'where':{'id':_0x468ded[_0x7f77('0x4e')]['id']}})[_0x7f77('0x1d')](handleEntityNotFound(_0x401394,null))[_0x7f77('0x1d')](removeEntity(_0x401394,null))['catch'](handleError(_0x401394,null));};exports[_0x7f77('0x52')]=function(_0x2ad58b,_0x3e4a5e,_0x1a5a68){var _0x51ad1a={};var _0xfb129b={};var _0x354a0d;var _0x1dcaf7;return db['ZohoAccount'][_0x7f77('0x53')]({'where':{'id':_0x2ad58b[_0x7f77('0x4e')]['id']}})[_0x7f77('0x1d')](handleEntityNotFound(_0x3e4a5e,null))[_0x7f77('0x1d')](function(_0x28e630){if(_0x28e630){_0x354a0d=_0x28e630;_0xfb129b['model']=_[_0x7f77('0x39')](db['ZohoConfiguration']['rawAttributes']);_0xfb129b[_0x7f77('0x3a')]=_[_0x7f77('0x39')](_0x2ad58b[_0x7f77('0x3a')]);_0xfb129b[_0x7f77('0x3b')]=_[_0x7f77('0x3c')](_0xfb129b[_0x7f77('0x3d')],_0xfb129b['query']);_0x51ad1a['attributes']=_[_0x7f77('0x3c')](_0xfb129b['model'],qs[_0x7f77('0x3f')](_0x2ad58b[_0x7f77('0x3a')][_0x7f77('0x3f')]));_0x51ad1a[_0x7f77('0x3e')]=_0x51ad1a[_0x7f77('0x3e')][_0x7f77('0x40')]?_0x51ad1a[_0x7f77('0x3e')]:_0xfb129b[_0x7f77('0x3d')];_0x51ad1a[_0x7f77('0x42')]=qs[_0x7f77('0x43')](_0x2ad58b['query'][_0x7f77('0x43')]);_0x51ad1a[_0x7f77('0x44')]=qs[_0x7f77('0x3b')](_[_0x7f77('0x54')](_0x2ad58b[_0x7f77('0x3a')],_0xfb129b[_0x7f77('0x3b')]));if(_0x2ad58b['query'][_0x7f77('0x47')]){_0x51ad1a[_0x7f77('0x44')]=_[_0x7f77('0x45')](_0x51ad1a[_0x7f77('0x44')],{'$or':_[_0x7f77('0x36')](_0x51ad1a[_0x7f77('0x3e')],function(_0x511b5c){var _0x420b01={};_0x420b01[_0x511b5c]={'$like':'%'+_0x2ad58b[_0x7f77('0x3a')][_0x7f77('0x47')]+'%'};return _0x420b01;})});}_0x51ad1a=_[_0x7f77('0x45')]({},_0x51ad1a,_0x2ad58b[_0x7f77('0x48')]);return _0x354a0d[_0x7f77('0x52')](_0x51ad1a);}})[_0x7f77('0x1d')](function(_0x19b0e3){if(_0x19b0e3){_0x1dcaf7=_0x19b0e3[_0x7f77('0x40')];if(!_0x2ad58b[_0x7f77('0x3a')][_0x7f77('0x55')](_0x7f77('0x41'))){_0x51ad1a[_0x7f77('0x29')]=qs[_0x7f77('0x29')](_0x2ad58b[_0x7f77('0x3a')][_0x7f77('0x29')]);_0x51ad1a[_0x7f77('0x28')]=qs[_0x7f77('0x28')](_0x2ad58b[_0x7f77('0x3a')]['offset']);}return _0x354a0d['getConfigurations'](_0x51ad1a);}})[_0x7f77('0x1d')](function(_0xec1a14){if(_0xec1a14){return _0xec1a14?{'count':_0x1dcaf7,'rows':_0xec1a14}:null;}})[_0x7f77('0x1d')](respondWithResult(_0x3e4a5e,null))['catch'](handleError(_0x3e4a5e,null));};exports[_0x7f77('0x56')]=function(_0x5c95ea,_0x4020e8,_0x55f4d3){if(_0x5c95ea[_0x7f77('0x51')]['id']){delete _0x5c95ea[_0x7f77('0x51')]['id'];}return db[_0x7f77('0x49')]['findOne']({'where':{'id':_0x5c95ea[_0x7f77('0x4e')]['id']}})[_0x7f77('0x1d')](handleEntityNotFound(_0x4020e8,null))[_0x7f77('0x1d')](function(_0x181958){if(_0x181958){_0x5c95ea[_0x7f77('0x51')][_0x7f77('0x57')]=_0x181958['id'];_0x5c95ea[_0x7f77('0x51')][_0x7f77('0x58')]=integrations[_0x7f77('0x59')](_0x5c95ea[_0x7f77('0x51')][_0x7f77('0x5a')],_0x5c95ea['body'][_0x7f77('0x5b')]);_0x5c95ea[_0x7f77('0x51')][_0x7f77('0x5c')]=integrations[_0x7f77('0x5d')](_0x5c95ea[_0x7f77('0x51')][_0x7f77('0x5a')],_0x5c95ea[_0x7f77('0x51')]['type']);return db['ZohoConfiguration'][_0x7f77('0x5e')](_0x5c95ea[_0x7f77('0x51')],{'include':[{'model':db['ZohoField'],'as':_0x7f77('0x58')},{'model':db[_0x7f77('0x5f')],'as':_0x7f77('0x5c')}]});}return null;})['then'](respondWithResult(_0x4020e8,null))['catch'](handleError(_0x4020e8,null));};function getAccessToken(_0x204220){return new Promise(function(_0x366a4c,_0x2a120b){var _0x15e882;switch(_0x204220[_0x7f77('0x60')]){case'US':_0x15e882=_0x7f77('0x61');break;case'AU':_0x15e882='https://accounts.zoho.com.au';break;case'EU':_0x15e882=_0x7f77('0x62');break;case'IN':_0x15e882='https://accounts.zoho.in';break;case'CN':_0x15e882='https://accounts.zoho.com.cn';break;default:_0x15e882=_0x7f77('0x62');break;}var _0x1e2a1c={'method':_0x7f77('0x63'),'uri':_0x15e882+_0x7f77('0x64'),'qs':{'refresh_token':_0x204220['refreshToken'],'client_id':_0x204220[_0x7f77('0x65')],'client_secret':_0x204220[_0x7f77('0x66')],'grant_type':_0x7f77('0x67')},'json':!![]};return rp(_0x1e2a1c)[_0x7f77('0x1d')](function(_0xe5500a){if(_0xe5500a[_0x7f77('0x68')]){_0x366a4c(_0xe5500a[_0x7f77('0x68')]);}else{_0x2a120b(_0x7f77('0x69'));}})[_0x7f77('0x25')](function(_0x580a47){_0x2a120b(_0x580a47);});});}exports[_0x7f77('0x6a')]=function(_0x2a97ef,_0x23456e,_0x1cc8e3){var _0x2ded91,_0x5f01b3,_0x28e8f2,_0x2aa99c,_0x51ab0c;return db['ZohoAccount']['findOne']({'where':{'id':_0x2a97ef['params']['id']},'attributes':['id',_0x7f77('0x6b'),_0x7f77('0x60'),'clientId',_0x7f77('0x66'),_0x7f77('0x6c'),'code','refreshToken']})['then'](handleEntityNotFound(_0x23456e,null))[_0x7f77('0x1d')](function(_0x32005e){_0x51ab0c=_0x32005e;_0x2ded91=_0x51ab0c[_0x7f77('0x6b')];_0x5f01b3=_0x2ded91===_0x7f77('0x6d')?'eu':_0x7f77('0x6e');_0x28e8f2=_0x51ab0c[_0x7f77('0x6c')];var _0x149853=_0x28e8f2[_0x7f77('0x6f')](-0x1);if(_0x149853==='/'||_0x149853==='\x5c'||_0x149853===':'){_0x28e8f2=_0x28e8f2[_0x7f77('0x70')](0x0,_0x28e8f2[_0x7f77('0x71')](_0x149853));}if(!_0x51ab0c[_0x7f77('0x72')]){throw new Error(_0x7f77('0x73'));}return getAccessToken(_0x51ab0c);})['then'](function(_0x55c628){if(_0x55c628){return rp({'method':_0x7f77('0x74'),'uri':util[_0x7f77('0x75')](_0x7f77('0x76'),_0x5f01b3),'qs':{'module':_0x7f77('0x77')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x55c628},'json':!![]});}})[_0x7f77('0x1d')](function(_0x42ccb0){if(_0x42ccb0){if(_0x42ccb0[_0x7f77('0x78')]&&_0x42ccb0[_0x7f77('0x78')][_0x7f77('0x23')]){throw new Error(_0x42ccb0[_0x7f77('0x78')][_0x7f77('0x23')][_0x7f77('0x24')]);}var _0x179607=[];var _0x20c952=[];var _0x37acf2=[_0x7f77('0x79'),_0x7f77('0x7a'),_0x7f77('0x7b'),_0x7f77('0x7c'),_0x7f77('0x7d'),_0x7f77('0x7e'),_0x7f77('0x7f'),_0x7f77('0x80')];_0x20c952=_[_0x7f77('0x81')](_0x42ccb0[_0x7f77('0x3f')],function(_0x24705b){return _0x37acf2[_0x7f77('0x82')](_0x24705b[_0x7f77('0x83')]);});for(var _0xcf5d14=0x0;_0xcf5d14<_0x20c952[_0x7f77('0x40')];_0xcf5d14++){if(_0x20c952[_0xcf5d14][_0x7f77('0x84')]===![]){_0x179607['push']({'id':_0x20c952[_0xcf5d14]['id'],'name':_0x20c952[_0xcf5d14][_0x7f77('0x85')],'custom':_0x20c952[_0xcf5d14][_0x7f77('0x86')],'options':_0x20c952[_0xcf5d14][_0x7f77('0x87')]===_0x7f77('0x88')&&_0x20c952[_0xcf5d14][_0x7f77('0x89')][_0x7f77('0x40')]>-0x1?_[_0x7f77('0x36')](_0x20c952[_0xcf5d14][_0x7f77('0x89')],function(_0x1bf1d2){return{'name':_0x1bf1d2,'value':_0x1bf1d2};}):[]});}}return{'count':_0x179607[_0x7f77('0x40')],'rows':_0x179607};}else{return{'count':0x0,'rows':[]};}})[_0x7f77('0x1d')](respondWithResult(_0x23456e,null))[_0x7f77('0x25')](function(_0x13150f){var _0x5e03fa=_0x2a97ef[_0x7f77('0x3a')][_0x7f77('0x8a')]?0x1f4:_0x13150f[_0x7f77('0x8b')]||0x1f4;logger[_0x7f77('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x7f77('0x6a'),_0x5e03fa,JSON[_0x7f77('0x8c')](_0x13150f));delete _0x13150f[_0x7f77('0x33')];if(_0x5e03fa===0x191){_0x5e03fa=0x190;}_0x23456e['status'](_0x5e03fa)[_0x7f77('0x34')](_0x2a97ef['query']['test']?{'message':_0x7f77('0x8d'),'statusCode':_0x13150f[_0x7f77('0x8b')]}:_0x13150f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e5c62cc..375ead7 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 _0x46a7=['exports','define','ZohoAccount','int_zoho_accounts','serverUrl','clientId','changed','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','info','util','moment','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x386708,_0x836dc4){var _0x2fcc4a=function(_0x2ad7e){while(--_0x2ad7e){_0x386708['push'](_0x386708['shift']());}};_0x2fcc4a(++_0x836dc4);}(_0x46a7,0x18a));var _0x746a=function(_0x2c0866,_0x326fb7){_0x2c0866=_0x2c0866-0x0;var _0x1e69f2=_0x46a7[_0x2c0866];return _0x1e69f2;};'use strict';var _=require('lodash');var util=require(_0x746a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x746a('0x1'));var BPromise=require('bluebird');var rp=require(_0x746a('0x2'));var fs=require('fs');var path=require(_0x746a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x746a('0x4'));var integrations=require(_0x746a('0x5'));module[_0x746a('0x6')]=function(_0x4dac71,_0x29cbd6){return _0x4dac71[_0x746a('0x7')](_0x746a('0x8'),attributes,{'tableName':_0x746a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7e8371,_0x3407ea,_0x146183){if(_0x7e8371['changed']('zone')||_0x7e8371['changed'](_0x746a('0xa'))||_0x7e8371['changed'](_0x746a('0xb'))||_0x7e8371[_0x746a('0xc')](_0x746a('0xd'))||_0x7e8371[_0x746a('0xc')](_0x746a('0xe'))||_0x7e8371[_0x746a('0xc')](_0x746a('0xf'))){var _0x740ecc,_0x25b85a;_0x740ecc=_0x7e8371[_0x746a('0xa')];var _0x435e55=_0x740ecc[_0x746a('0x10')](-0x1);if(_0x435e55==='/'||_0x435e55==='\x5c'||_0x435e55===':'){_0x740ecc=_0x740ecc[_0x746a('0x11')](0x0,_0x740ecc[_0x746a('0x12')](_0x435e55));}switch(_0x7e8371[_0x746a('0x13')]){case'US':_0x25b85a=_0x746a('0x14');break;case'AU':_0x25b85a=_0x746a('0x15');break;case'IN':_0x25b85a=_0x746a('0x16');break;case'CN':_0x25b85a='https://accounts.zoho.com.cn';break;default:_0x25b85a=_0x746a('0x17');break;}var _0x2338e7={'method':_0x746a('0x18'),'uri':_0x25b85a+_0x746a('0x19'),'form':{'grant_type':_0x746a('0x1a'),'client_id':_0x7e8371[_0x746a('0xb')],'client_secret':_0x7e8371[_0x746a('0xd')],'redirect_uri':_0x7e8371[_0x746a('0xa')],'code':_0x7e8371[_0x746a('0xe')]},'headers':{'Content-Type':_0x746a('0x1b')}};return rp(_0x2338e7)[_0x746a('0x1c')](function(_0x911730){var _0x31274a=JSON[_0x746a('0x1d')](_0x911730);if(_0x31274a[_0x746a('0x1e')]){_0x7e8371[_0x746a('0x1f')]=_0x31274a[_0x746a('0x1e')];logger['info'](util[_0x746a('0x20')](_0x746a('0x21'),_0x7e8371[_0x746a('0x22')],_0x7e8371['id']));}else{logger[_0x746a('0x23')](util[_0x746a('0x20')](_0x746a('0x24'),_0x7e8371['name'],_0x7e8371['id']),util[_0x746a('0x25')](_0x31274a,{'showHidden':![],'depth':null}));}return _0x146183(null,_0x3407ea);})[_0x746a('0x26')](function(_0x249012){logger[_0x746a('0x23')](util[_0x746a('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7e8371[_0x746a('0x22')],_0x7e8371['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x146183(_0x249012);});}else{return _0x146183(null,_0x3407ea);}},'beforeUpdate':function(_0x2b4421,_0x5c7a2d,_0x34dcff){if(_0x2b4421['changed']('zone')||_0x2b4421['changed'](_0x746a('0xa'))||_0x2b4421[_0x746a('0xc')](_0x746a('0xb'))||_0x2b4421[_0x746a('0xc')](_0x746a('0xd'))||_0x2b4421[_0x746a('0xc')](_0x746a('0xe'))||_0x2b4421[_0x746a('0xc')](_0x746a('0xf'))){var _0x1d9730,_0x59b4d8;_0x1d9730=_0x2b4421[_0x746a('0xa')];var _0x2b9e7c=_0x1d9730[_0x746a('0x10')](-0x1);if(_0x2b9e7c==='/'||_0x2b9e7c==='\x5c'||_0x2b9e7c===':'){_0x1d9730=_0x1d9730[_0x746a('0x11')](0x0,_0x1d9730[_0x746a('0x12')](_0x2b9e7c));}switch(_0x2b4421['zone']){case'US':_0x59b4d8=_0x746a('0x14');break;case'AU':_0x59b4d8=_0x746a('0x15');break;case'IN':_0x59b4d8='https://accounts.zoho.in';break;case'CN':_0x59b4d8='https://accounts.zoho.com.cn';break;default:_0x59b4d8=_0x746a('0x17');break;}var _0x45e8d5={'method':_0x746a('0x18'),'uri':_0x59b4d8+_0x746a('0x19'),'form':{'grant_type':_0x746a('0x1a'),'client_id':_0x2b4421[_0x746a('0xb')],'client_secret':_0x2b4421['clientSecret'],'redirect_uri':_0x2b4421[_0x746a('0xa')],'code':_0x2b4421[_0x746a('0xe')]},'headers':{'Content-Type':_0x746a('0x1b')}};return rp(_0x45e8d5)['then'](function(_0x5b9f1f){var _0x55a877=JSON[_0x746a('0x1d')](_0x5b9f1f);if(_0x55a877[_0x746a('0x1e')]){_0x2b4421['refreshToken']=_0x55a877[_0x746a('0x1e')];logger[_0x746a('0x27')](util[_0x746a('0x20')](_0x746a('0x21'),_0x2b4421[_0x746a('0x22')],_0x2b4421['id']));}else{logger[_0x746a('0x23')](util[_0x746a('0x20')](_0x746a('0x24'),_0x2b4421['name'],_0x2b4421['id']),util[_0x746a('0x25')](_0x55a877,{'showHidden':![],'depth':null}));}return _0x34dcff(null,_0x5c7a2d);})[_0x746a('0x26')](function(_0x274a74){logger[_0x746a('0x23')](util['format'](_0x746a('0x24'),_0x2b4421[_0x746a('0x22')],_0x2b4421['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x34dcff(_0x274a74);});}else{return _0x34dcff(null,_0x5c7a2d);}}}});}; \ No newline at end of file +var _0x59f2=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','slice','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','host','substring','https://accounts.zoho.com','POST','then','info','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x399f4b,_0x3834d2){var _0x407c19=function(_0x3eed17){while(--_0x3eed17){_0x399f4b['push'](_0x399f4b['shift']());}};_0x407c19(++_0x3834d2);}(_0x59f2,0x1bd));var _0x259f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x59f2[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x259f('0x0'));var logger=require(_0x259f('0x1'))(_0x259f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x259f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x259f('0x4'));var config=require(_0x259f('0x5'));var attributes=require(_0x259f('0x6'));var integrations=require(_0x259f('0x7'));module[_0x259f('0x8')]=function(_0x27df15,_0x36ea9f){return _0x27df15[_0x259f('0x9')](_0x259f('0xa'),attributes,{'tableName':_0x259f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4de0f4,_0x532adb,_0x4ba759){if(_0x4de0f4['changed'](_0x259f('0xc'))||_0x4de0f4[_0x259f('0xd')](_0x259f('0xe'))||_0x4de0f4['changed'](_0x259f('0xf'))||_0x4de0f4[_0x259f('0xd')]('clientSecret')||_0x4de0f4[_0x259f('0xd')]('code')||_0x4de0f4['changed']('host')){var _0x3fb382,_0x35f625;_0x3fb382=_0x4de0f4['serverUrl'];var _0x55142d=_0x3fb382[_0x259f('0x10')](-0x1);if(_0x55142d==='/'||_0x55142d==='\x5c'||_0x55142d===':'){_0x3fb382=_0x3fb382['substring'](0x0,_0x3fb382['lastIndexOf'](_0x55142d));}switch(_0x4de0f4['zone']){case'US':_0x35f625='https://accounts.zoho.com';break;case'AU':_0x35f625=_0x259f('0x11');break;case'IN':_0x35f625=_0x259f('0x12');break;case'CN':_0x35f625=_0x259f('0x13');break;default:_0x35f625=_0x259f('0x14');break;}var _0x1b01e0={'method':'POST','uri':_0x35f625+_0x259f('0x15'),'form':{'grant_type':_0x259f('0x16'),'client_id':_0x4de0f4[_0x259f('0xf')],'client_secret':_0x4de0f4[_0x259f('0x17')],'redirect_uri':_0x4de0f4[_0x259f('0xe')],'code':_0x4de0f4[_0x259f('0x18')]},'headers':{'Content-Type':_0x259f('0x19')}};return rp(_0x1b01e0)['then'](function(_0x1e791f){var _0x1c0c43=JSON[_0x259f('0x1a')](_0x1e791f);if(_0x1c0c43[_0x259f('0x1b')]){_0x4de0f4['refreshToken']=_0x1c0c43[_0x259f('0x1b')];logger['info'](util[_0x259f('0x1c')](_0x259f('0x1d'),_0x4de0f4[_0x259f('0x1e')],_0x4de0f4['id']));}else{logger['error'](util[_0x259f('0x1c')](_0x259f('0x1f'),_0x4de0f4[_0x259f('0x1e')],_0x4de0f4['id']),util[_0x259f('0x20')](_0x1c0c43,{'showHidden':![],'depth':null}));}return _0x4ba759(null,_0x532adb);})[_0x259f('0x21')](function(_0x3fe6c7){logger[_0x259f('0x22')](util[_0x259f('0x1c')](_0x259f('0x1f'),_0x4de0f4['name'],_0x4de0f4['id']),util[_0x259f('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ba759(_0x3fe6c7);});}else{return _0x4ba759(null,_0x532adb);}},'beforeUpdate':function(_0x1a012e,_0x2f2905,_0x4817d5){if(_0x1a012e[_0x259f('0xd')](_0x259f('0xc'))||_0x1a012e[_0x259f('0xd')](_0x259f('0xe'))||_0x1a012e['changed'](_0x259f('0xf'))||_0x1a012e['changed'](_0x259f('0x17'))||_0x1a012e[_0x259f('0xd')](_0x259f('0x18'))||_0x1a012e['changed'](_0x259f('0x23'))){var _0x30f7af,_0x28fbfc;_0x30f7af=_0x1a012e['serverUrl'];var _0x308fd9=_0x30f7af[_0x259f('0x10')](-0x1);if(_0x308fd9==='/'||_0x308fd9==='\x5c'||_0x308fd9===':'){_0x30f7af=_0x30f7af[_0x259f('0x24')](0x0,_0x30f7af['lastIndexOf'](_0x308fd9));}switch(_0x1a012e[_0x259f('0xc')]){case'US':_0x28fbfc=_0x259f('0x25');break;case'AU':_0x28fbfc='https://accounts.zoho.com.au';break;case'IN':_0x28fbfc=_0x259f('0x12');break;case'CN':_0x28fbfc=_0x259f('0x13');break;default:_0x28fbfc=_0x259f('0x14');break;}var _0x5a4399={'method':_0x259f('0x26'),'uri':_0x28fbfc+_0x259f('0x15'),'form':{'grant_type':'authorization_code','client_id':_0x1a012e[_0x259f('0xf')],'client_secret':_0x1a012e[_0x259f('0x17')],'redirect_uri':_0x1a012e[_0x259f('0xe')],'code':_0x1a012e[_0x259f('0x18')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5a4399)[_0x259f('0x27')](function(_0x880a24){var _0x4fcff6=JSON[_0x259f('0x1a')](_0x880a24);if(_0x4fcff6['refresh_token']){_0x1a012e['refreshToken']=_0x4fcff6['refresh_token'];logger[_0x259f('0x28')](util[_0x259f('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a012e['name'],_0x1a012e['id']));}else{logger['error'](util[_0x259f('0x1c')](_0x259f('0x1f'),_0x1a012e['name'],_0x1a012e['id']),util[_0x259f('0x20')](_0x4fcff6,{'showHidden':![],'depth':null}));}return _0x4817d5(null,_0x2f2905);})['catch'](function(_0x369cff){logger['error'](util[_0x259f('0x1c')](_0x259f('0x1f'),_0x1a012e['name'],_0x1a012e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4817d5(_0x369cff);});}else{return _0x4817d5(null,_0x2f2905);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3658517..3f5d979 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 _0x2256=['include','model','then','info','find','ShowZohoAccount','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','map'];(function(_0x401d4e,_0x2f6357){var _0x382ee1=function(_0x46190b){while(--_0x46190b){_0x401d4e['push'](_0x401d4e['shift']());}};_0x382ee1(++_0x2f6357);}(_0x2256,0x166));var _0x6225=function(_0x197548,_0x4ad31d){_0x197548=_0x197548-0x0;var _0x3b7b36=_0x2256[_0x197548];return _0x3b7b36;};'use strict';var _=require(_0x6225('0x0'));var util=require('util');var moment=require(_0x6225('0x1'));var BPromise=require(_0x6225('0x2'));var rs=require(_0x6225('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6225('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6225('0x5'));var config=require(_0x6225('0x6'));var jayson=require(_0x6225('0x7'));var client=jayson[_0x6225('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0fe4,_0x48cada,_0x131ff8){return new BPromise(function(_0x42336e,_0x21949e){return client['request'](_0x5e0fe4,_0x131ff8)['then'](function(_0x2fe29e){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x48cada,_0x6225('0x9'));logger[_0x6225('0xa')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x48cada,_0x6225('0x9'),JSON[_0x6225('0xb')](_0x2fe29e));if(_0x2fe29e[_0x6225('0xc')]){if(_0x2fe29e[_0x6225('0xc')][_0x6225('0xd')]===0x1f4){logger['error'](_0x6225('0xe'),_0x48cada,_0x2fe29e[_0x6225('0xc')][_0x6225('0xf')]);return _0x21949e(_0x2fe29e[_0x6225('0xc')]['message']);}logger[_0x6225('0xc')](_0x6225('0xe'),_0x48cada,_0x2fe29e[_0x6225('0xc')][_0x6225('0xf')]);return _0x42336e(_0x2fe29e[_0x6225('0xc')][_0x6225('0xf')]);}else{logger['info'](_0x6225('0xe'),_0x48cada,_0x6225('0x9'));_0x42336e(_0x2fe29e[_0x6225('0x10')][_0x6225('0xf')]);}})[_0x6225('0x11')](function(_0x3dca74){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x48cada,_0x3dca74);_0x21949e(_0x3dca74);});});}exports[_0x6225('0x12')]=function(_0x3a53ba){var _0x1518a9=this;return new Promise(function(_0x4f3b12,_0x1edaf8){return db[_0x6225('0x13')][_0x6225('0x14')]({'raw':_0x3a53ba[_0x6225('0x15')]?_0x3a53ba[_0x6225('0x15')][_0x6225('0x16')]===undefined?!![]:![]:!![],'where':_0x3a53ba[_0x6225('0x15')]?_0x3a53ba['options'][_0x6225('0x17')]||null:null,'attributes':_0x3a53ba[_0x6225('0x15')]?_0x3a53ba['options'][_0x6225('0x18')]||null:null,'limit':_0x3a53ba[_0x6225('0x15')]?_0x3a53ba[_0x6225('0x15')]['limit']||null:null,'include':_0x3a53ba['options']?_0x3a53ba[_0x6225('0x15')]['include']?_[_0x6225('0x19')](_0x3a53ba['options'][_0x6225('0x1a')],function(_0x58f3fa){return{'model':db[_0x58f3fa['model']],'as':_0x58f3fa['as'],'attributes':_0x58f3fa['attributes'],'include':_0x58f3fa[_0x6225('0x1a')]?_[_0x6225('0x19')](_0x58f3fa[_0x6225('0x1a')],function(_0x4568c1){return{'model':db[_0x4568c1[_0x6225('0x1b')]],'as':_0x4568c1['as'],'attributes':_0x4568c1['attributes'],'include':_0x4568c1[_0x6225('0x1a')]?_['map'](_0x4568c1[_0x6225('0x1a')],function(_0x2e1c0e){return{'model':db[_0x2e1c0e[_0x6225('0x1b')]],'as':_0x2e1c0e['as'],'attributes':_0x2e1c0e[_0x6225('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6225('0x1c')](function(_0x1372f3){logger[_0x6225('0x1d')]('GetZohoAccount',_0x3a53ba);logger[_0x6225('0xa')](_0x6225('0x12'),_0x3a53ba,JSON['stringify'](_0x1372f3));_0x4f3b12(_0x1372f3);})[_0x6225('0x11')](function(_0x28ea8c){logger['error']('GetZohoAccount',_0x28ea8c[_0x6225('0xf')],_0x3a53ba);_0x1edaf8(_0x1518a9[_0x6225('0xc')](0x1f4,_0x28ea8c['message']));});});};exports['ShowZohoAccount']=function(_0x5078a0){var _0x410291=this;return new Promise(function(_0xe9ecbe,_0x156f59){return db[_0x6225('0x13')][_0x6225('0x1e')]({'raw':_0x5078a0[_0x6225('0x15')]?_0x5078a0[_0x6225('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5078a0[_0x6225('0x15')]?_0x5078a0[_0x6225('0x15')][_0x6225('0x17')]||null:null,'attributes':_0x5078a0[_0x6225('0x15')]?_0x5078a0['options'][_0x6225('0x18')]||null:null,'include':_0x5078a0['options']?_0x5078a0[_0x6225('0x15')][_0x6225('0x1a')]?_[_0x6225('0x19')](_0x5078a0[_0x6225('0x15')][_0x6225('0x1a')],function(_0x2d66d4){return{'model':db[_0x2d66d4[_0x6225('0x1b')]],'as':_0x2d66d4['as'],'attributes':_0x2d66d4[_0x6225('0x18')],'include':_0x2d66d4[_0x6225('0x1a')]?_[_0x6225('0x19')](_0x2d66d4[_0x6225('0x1a')],function(_0x50d0fe){return{'model':db[_0x50d0fe[_0x6225('0x1b')]],'as':_0x50d0fe['as'],'attributes':_0x50d0fe[_0x6225('0x18')],'include':_0x50d0fe['include']?_[_0x6225('0x19')](_0x50d0fe['include'],function(_0x5a50bf){return{'model':db[_0x5a50bf[_0x6225('0x1b')]],'as':_0x5a50bf['as'],'attributes':_0x5a50bf[_0x6225('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6225('0x1c')](function(_0x54e02f){logger['info']('ShowZohoAccount',_0x5078a0);logger[_0x6225('0xa')](_0x6225('0x1f'),_0x5078a0,JSON['stringify'](_0x54e02f));_0xe9ecbe(_0x54e02f);})[_0x6225('0x11')](function(_0x1bfd36){logger[_0x6225('0xc')](_0x6225('0x1f'),_0x1bfd36[_0x6225('0xf')],_0x5078a0);_0x156f59(_0x410291[_0x6225('0xc')](0x1f4,_0x1bfd36['message']));});});}; \ No newline at end of file +var _0x51db=['where','attributes','limit','include','map','model','then','GetZohoAccount','ShowZohoAccount','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ZohoAccount','findAll','options','raw'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x51db,0xb5));var _0xb51d=function(_0x32e6d3,_0x22a43c){_0x32e6d3=_0x32e6d3-0x0;var _0xb71ca=_0x51db[_0x32e6d3];return _0xb71ca;};'use strict';var _=require(_0xb51d('0x0'));var util=require(_0xb51d('0x1'));var moment=require(_0xb51d('0x2'));var BPromise=require(_0xb51d('0x3'));var rs=require(_0xb51d('0x4'));var fs=require('fs');var Redis=require(_0xb51d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb51d('0x6'))(_0xb51d('0x7'));var config=require(_0xb51d('0x8'));var jayson=require(_0xb51d('0x9'));var client=jayson[_0xb51d('0xa')][_0xb51d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ea181,_0x518cab,_0x408d5e){return new BPromise(function(_0x1e1e03,_0x19bc9c){return client['request'](_0x1ea181,_0x408d5e)['then'](function(_0x3e9a98){logger['info'](_0xb51d('0xc'),_0x518cab,_0xb51d('0xd'));logger[_0xb51d('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x518cab,'request\x20sent',JSON[_0xb51d('0xf')](_0x3e9a98));if(_0x3e9a98[_0xb51d('0x10')]){if(_0x3e9a98[_0xb51d('0x10')]['code']===0x1f4){logger[_0xb51d('0x10')](_0xb51d('0xc'),_0x518cab,_0x3e9a98['error']['message']);return _0x19bc9c(_0x3e9a98[_0xb51d('0x10')][_0xb51d('0x11')]);}logger[_0xb51d('0x10')](_0xb51d('0xc'),_0x518cab,_0x3e9a98['error'][_0xb51d('0x11')]);return _0x1e1e03(_0x3e9a98[_0xb51d('0x10')]['message']);}else{logger['info'](_0xb51d('0xc'),_0x518cab,_0xb51d('0xd'));_0x1e1e03(_0x3e9a98[_0xb51d('0x12')][_0xb51d('0x11')]);}})['catch'](function(_0x1400b6){logger[_0xb51d('0x10')](_0xb51d('0xc'),_0x518cab,_0x1400b6);_0x19bc9c(_0x1400b6);});});}exports['GetZohoAccount']=function(_0x103b2a){var _0x3e9a5b=this;return new Promise(function(_0x1c2195,_0x172c4f){return db[_0xb51d('0x13')][_0xb51d('0x14')]({'raw':_0x103b2a[_0xb51d('0x15')]?_0x103b2a[_0xb51d('0x15')][_0xb51d('0x16')]===undefined?!![]:![]:!![],'where':_0x103b2a['options']?_0x103b2a[_0xb51d('0x15')][_0xb51d('0x17')]||null:null,'attributes':_0x103b2a[_0xb51d('0x15')]?_0x103b2a['options'][_0xb51d('0x18')]||null:null,'limit':_0x103b2a['options']?_0x103b2a[_0xb51d('0x15')][_0xb51d('0x19')]||null:null,'include':_0x103b2a[_0xb51d('0x15')]?_0x103b2a['options'][_0xb51d('0x1a')]?_[_0xb51d('0x1b')](_0x103b2a['options'][_0xb51d('0x1a')],function(_0x72ba2a){return{'model':db[_0x72ba2a[_0xb51d('0x1c')]],'as':_0x72ba2a['as'],'attributes':_0x72ba2a[_0xb51d('0x18')],'include':_0x72ba2a['include']?_[_0xb51d('0x1b')](_0x72ba2a[_0xb51d('0x1a')],function(_0x2c272c){return{'model':db[_0x2c272c[_0xb51d('0x1c')]],'as':_0x2c272c['as'],'attributes':_0x2c272c[_0xb51d('0x18')],'include':_0x2c272c['include']?_['map'](_0x2c272c['include'],function(_0x40b5bb){return{'model':db[_0x40b5bb[_0xb51d('0x1c')]],'as':_0x40b5bb['as'],'attributes':_0x40b5bb[_0xb51d('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb51d('0x1d')](function(_0x14a445){logger['info'](_0xb51d('0x1e'),_0x103b2a);logger[_0xb51d('0xe')](_0xb51d('0x1e'),_0x103b2a,JSON[_0xb51d('0xf')](_0x14a445));_0x1c2195(_0x14a445);})['catch'](function(_0x484f51){logger[_0xb51d('0x10')](_0xb51d('0x1e'),_0x484f51[_0xb51d('0x11')],_0x103b2a);_0x172c4f(_0x3e9a5b[_0xb51d('0x10')](0x1f4,_0x484f51[_0xb51d('0x11')]));});});};exports[_0xb51d('0x1f')]=function(_0x5e84c8){var _0xbe02d=this;return new Promise(function(_0x304516,_0x5c3db6){return db[_0xb51d('0x13')]['find']({'raw':_0x5e84c8[_0xb51d('0x15')]?_0x5e84c8[_0xb51d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5e84c8[_0xb51d('0x15')]?_0x5e84c8[_0xb51d('0x15')][_0xb51d('0x17')]||null:null,'attributes':_0x5e84c8[_0xb51d('0x15')]?_0x5e84c8['options'][_0xb51d('0x18')]||null:null,'include':_0x5e84c8[_0xb51d('0x15')]?_0x5e84c8[_0xb51d('0x15')][_0xb51d('0x1a')]?_['map'](_0x5e84c8[_0xb51d('0x15')][_0xb51d('0x1a')],function(_0x549320){return{'model':db[_0x549320[_0xb51d('0x1c')]],'as':_0x549320['as'],'attributes':_0x549320[_0xb51d('0x18')],'include':_0x549320[_0xb51d('0x1a')]?_[_0xb51d('0x1b')](_0x549320[_0xb51d('0x1a')],function(_0x34c48e){return{'model':db[_0x34c48e[_0xb51d('0x1c')]],'as':_0x34c48e['as'],'attributes':_0x34c48e[_0xb51d('0x18')],'include':_0x34c48e[_0xb51d('0x1a')]?_[_0xb51d('0x1b')](_0x34c48e['include'],function(_0x19db6e){return{'model':db[_0x19db6e[_0xb51d('0x1c')]],'as':_0x19db6e['as'],'attributes':_0x19db6e[_0xb51d('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb51d('0x1d')](function(_0x34831b){logger[_0xb51d('0x20')]('ShowZohoAccount',_0x5e84c8);logger['debug'](_0xb51d('0x1f'),_0x5e84c8,JSON['stringify'](_0x34831b));_0x304516(_0x34831b);})[_0xb51d('0x21')](function(_0x52530a){logger[_0xb51d('0x10')](_0xb51d('0x1f'),_0x52530a[_0xb51d('0x11')],_0x5e84c8);_0x5c3db6(_0xbe02d[_0xb51d('0x10')](0x1f4,_0x52530a[_0xb51d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1d45e32..1940ee0 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 _0x2547=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','/:id','destroy','exports','util'];(function(_0x4feeff,_0x45e354){var _0x5ba7af=function(_0x2b44a4){while(--_0x2b44a4){_0x4feeff['push'](_0x4feeff['shift']());}};_0x5ba7af(++_0x45e354);}(_0x2547,0x1cd));var _0x7254=function(_0x1a0435,_0x3196ad){_0x1a0435=_0x1a0435-0x0;var _0x4188fa=_0x2547[_0x1a0435];return _0x4188fa;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id/fields',auth[_0x7254('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x7254('0x9')](),controller[_0x7254('0xc')]);router[_0x7254('0x8')](_0x7254('0xd'),auth[_0x7254('0x9')](),controller[_0x7254('0xe')]);router['post']('/',auth[_0x7254('0x9')](),controller['create']);router[_0x7254('0xf')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')](_0x7254('0x12'),auth[_0x7254('0x9')](),controller[_0x7254('0x13')]);module[_0x7254('0x14')]=router; \ No newline at end of file +var _0x2d93=['/:id/descriptions','getDescriptions','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2d93,0xf3));var _0x32d9=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x2d93[_0x55c1f0];return _0x1530fa;};'use strict';var multer=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var path=require(_0x32d9('0x2'));var timeout=require(_0x32d9('0x3'));var express=require(_0x32d9('0x4'));var router=express[_0x32d9('0x5')]();var auth=require(_0x32d9('0x6'));var interaction=require(_0x32d9('0x7'));var config=require(_0x32d9('0x8'));var controller=require(_0x32d9('0x9'));router[_0x32d9('0xa')]('/',auth[_0x32d9('0xb')](),controller[_0x32d9('0xc')]);router[_0x32d9('0xa')]('/:id',auth[_0x32d9('0xb')](),controller[_0x32d9('0xd')]);router[_0x32d9('0xa')](_0x32d9('0xe'),auth[_0x32d9('0xb')](),controller['getFields']);router[_0x32d9('0xa')](_0x32d9('0xf'),auth[_0x32d9('0xb')](),controller[_0x32d9('0x10')]);router[_0x32d9('0xa')](_0x32d9('0x11'),auth[_0x32d9('0xb')](),controller[_0x32d9('0x12')]);router[_0x32d9('0x13')]('/',auth[_0x32d9('0xb')](),controller[_0x32d9('0x14')]);router['put']('/:id',auth[_0x32d9('0xb')](),controller[_0x32d9('0x15')]);router[_0x32d9('0x16')](_0x32d9('0x17'),auth[_0x32d9('0xb')](),controller[_0x32d9('0x18')]);module[_0x32d9('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index a6bcb0f..8d6abe5 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 _0x6a7a=['contact_lead','lead','sequelize','exports','STRING','ENUM','contact'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x6a7a,0xb1));var _0xa6a7=function(_0x29e2e4,_0x3e3918){_0x29e2e4=_0x29e2e4-0x0;var _0x337fa7=_0x6a7a[_0x29e2e4];return _0x337fa7;};'use strict';var Sequelize=require(_0xa6a7('0x0'));module[_0xa6a7('0x1')]={'name':{'type':Sequelize[_0xa6a7('0x2')]},'moduleCreate':{'type':Sequelize[_0xa6a7('0x3')]('lead',_0xa6a7('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa6a7('0x3')](_0xa6a7('0x5'),_0xa6a7('0x4'),_0xa6a7('0x6')),'defaultValue':_0xa6a7('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x086c=['lead','contact','nothing','ENUM','contact_lead','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x086c,0x1e1));var _0xc086=function(_0x2eaedf,_0x481885){_0x2eaedf=_0x2eaedf-0x0;var _0x4b0bf8=_0x086c[_0x2eaedf];return _0x4b0bf8;};'use strict';var Sequelize=require('sequelize');module[_0xc086('0x0')]={'name':{'type':Sequelize[_0xc086('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc086('0x2'),_0xc086('0x3'),_0xc086('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xc086('0x5')](_0xc086('0x6'),_0xc086('0x3'),_0xc086('0x2')),'defaultValue':_0xc086('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index de3c9f1..ccd1a1d 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 _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b2873ca..95086e4 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 _0xc950=['request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration','lodash','util','api','moment','bluebird'];(function(_0x20236e,_0x4bc21a){var _0x22016e=function(_0x1263f2){while(--_0x1263f2){_0x20236e['push'](_0x20236e['shift']());}};_0x22016e(++_0x4bc21a);}(_0xc950,0xeb));var _0x0c95=function(_0x419d71,_0x221db9){_0x419d71=_0x419d71-0x0;var _0x35f514=_0xc950[_0x419d71];return _0x35f514;};'use strict';var _=require(_0x0c95('0x0'));var util=require(_0x0c95('0x1'));var logger=require('../../config/logger')(_0x0c95('0x2'));var moment=require(_0x0c95('0x3'));var BPromise=require(_0x0c95('0x4'));var rp=require(_0x0c95('0x5'));var fs=require('fs');var path=require(_0x0c95('0x6'));var rimraf=require(_0x0c95('0x7'));var config=require(_0x0c95('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x0c95('0x9')]=function(_0x20ae19,_0x448611){return _0x20ae19[_0x0c95('0xa')](_0x0c95('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83cb=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0xbe809,_0x1cf5da){var _0x5b6ef0=function(_0x1e568a){while(--_0x1e568a){_0xbe809['push'](_0xbe809['shift']());}};_0x5b6ef0(++_0x1cf5da);}(_0x83cb,0x111));var _0xb83c=function(_0x4f0fc1,_0x521e45){_0x4f0fc1=_0x4f0fc1-0x0;var _0x182520=_0x83cb[_0x4f0fc1];return _0x182520;};'use strict';var _=require(_0xb83c('0x0'));var util=require(_0xb83c('0x1'));var logger=require(_0xb83c('0x2'))('api');var moment=require(_0xb83c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb83c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb83c('0x5'));var config=require(_0xb83c('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x58a316,_0x5a9464){return _0x58a316[_0xb83c('0x7')](_0xb83c('0x8'),attributes,{'tableName':_0xb83c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index ca3778c..dc5b939 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 _0x285b=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','request\x20sent'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x285b,0x10d));var _0xb285=function(_0xdac179,_0x2bd97c){_0xdac179=_0xdac179-0x0;var _0x5d18cf=_0x285b[_0xdac179];return _0x5d18cf;};'use strict';var _=require('lodash');var util=require(_0xb285('0x0'));var moment=require(_0xb285('0x1'));var BPromise=require('bluebird');var rs=require(_0xb285('0x2'));var fs=require('fs');var Redis=require(_0xb285('0x3'));var db=require(_0xb285('0x4'))['db'];var utils=require(_0xb285('0x5'));var logger=require(_0xb285('0x6'))(_0xb285('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1345d5,_0x9ecef,_0x5035df){return new BPromise(function(_0x434561,_0x5606ac){return client[_0xb285('0x8')](_0x1345d5,_0x5035df)['then'](function(_0x2edd7c){logger[_0xb285('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0x9ecef,_0xb285('0xa'));logger[_0xb285('0xb')](_0xb285('0xc'),_0x9ecef,_0xb285('0xa'),JSON[_0xb285('0xd')](_0x2edd7c));if(_0x2edd7c[_0xb285('0xe')]){if(_0x2edd7c[_0xb285('0xe')][_0xb285('0xf')]===0x1f4){logger[_0xb285('0xe')](_0xb285('0x10'),_0x9ecef,_0x2edd7c[_0xb285('0xe')][_0xb285('0x11')]);return _0x5606ac(_0x2edd7c[_0xb285('0xe')][_0xb285('0x11')]);}logger[_0xb285('0xe')](_0xb285('0x10'),_0x9ecef,_0x2edd7c[_0xb285('0xe')][_0xb285('0x11')]);return _0x434561(_0x2edd7c[_0xb285('0xe')]['message']);}else{logger['info'](_0xb285('0x10'),_0x9ecef,'request\x20sent');_0x434561(_0x2edd7c[_0xb285('0x12')][_0xb285('0x11')]);}})[_0xb285('0x13')](function(_0xe16c84){logger[_0xb285('0xe')](_0xb285('0x10'),_0x9ecef,_0xe16c84);_0x5606ac(_0xe16c84);});});} \ No newline at end of file +var _0xbe46=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x2a568e,_0x4788b1){var _0xe1df87=function(_0x493678){while(--_0x493678){_0x2a568e['push'](_0x2a568e['shift']());}};_0xe1df87(++_0x4788b1);}(_0xbe46,0xd3));var _0x6be4=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xbe46[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6be4('0x0'));var fs=require('fs');var Redis=require(_0x6be4('0x1'));var db=require(_0x6be4('0x2'))['db'];var utils=require(_0x6be4('0x3'));var logger=require(_0x6be4('0x4'))(_0x6be4('0x5'));var config=require(_0x6be4('0x6'));var jayson=require(_0x6be4('0x7'));var client=jayson['client'][_0x6be4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b26c4,_0x6e5093,_0x2642ca){return new BPromise(function(_0x595b8c,_0x54d3e9){return client['request'](_0x5b26c4,_0x2642ca)['then'](function(_0x2d227d){logger[_0x6be4('0x9')](_0x6be4('0xa'),_0x6e5093,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x6e5093,_0x6be4('0xb'),JSON[_0x6be4('0xc')](_0x2d227d));if(_0x2d227d['error']){if(_0x2d227d[_0x6be4('0xd')][_0x6be4('0xe')]===0x1f4){logger[_0x6be4('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x6e5093,_0x2d227d[_0x6be4('0xd')][_0x6be4('0xf')]);return _0x54d3e9(_0x2d227d[_0x6be4('0xd')][_0x6be4('0xf')]);}logger[_0x6be4('0xd')](_0x6be4('0xa'),_0x6e5093,_0x2d227d['error'][_0x6be4('0xf')]);return _0x595b8c(_0x2d227d[_0x6be4('0xd')][_0x6be4('0xf')]);}else{logger['info'](_0x6be4('0xa'),_0x6e5093,_0x6be4('0xb'));_0x595b8c(_0x2d227d['result'][_0x6be4('0xf')]);}})[_0x6be4('0x10')](function(_0x560ffb){logger[_0x6be4('0xd')](_0x6be4('0xa'),_0x6e5093,_0x560ffb);_0x54d3e9(_0x560ffb);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e8e99fa..218e34d 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 _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x1f1da9,_0x557450){var _0x57f9e8=function(_0x34eef0){while(--_0x34eef0){_0x1f1da9['push'](_0x1f1da9['shift']());}};_0x57f9e8(++_0x557450);}(_0x1967,0x173));var _0x7196=function(_0x1a99d5,_0x2c41ff){_0x1a99d5=_0x1a99d5-0x0;var _0x5bd222=_0x1967[_0x1a99d5];return _0x5bd222;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file +var _0xb44a=['update','exports','path','express','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x58c2f7,_0x30828a){var _0x585139=function(_0x41b96f){while(--_0x41b96f){_0x58c2f7['push'](_0x58c2f7['shift']());}};_0x585139(++_0x30828a);}(_0xb44a,0x1c2));var _0xab44=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xb44a[_0x158f01];return _0x5ef74e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xab44('0x2'));var config=require('../../config/environment');var controller=require(_0xab44('0x3'));router[_0xab44('0x4')]('/',auth[_0xab44('0x5')](),controller[_0xab44('0x6')]);router[_0xab44('0x4')](_0xab44('0x7'),auth[_0xab44('0x5')](),controller[_0xab44('0x8')]);router[_0xab44('0x9')]('/',auth[_0xab44('0x5')](),controller[_0xab44('0xa')]);router[_0xab44('0xb')](_0xab44('0x7'),auth['isAuthenticated'](),controller[_0xab44('0xc')]);router['delete'](_0xab44('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xab44('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d886b0b..948f889 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 _0xd0a2=['keyValue','STRING','ENUM','string','variable','customVariable'];(function(_0x4da78e,_0x13cb84){var _0x4463b1=function(_0x41aaf1){while(--_0x41aaf1){_0x4da78e['push'](_0x4da78e['shift']());}};_0x4463b1(++_0x13cb84);}(_0xd0a2,0x128));var _0x2d0a=function(_0x95a28c,_0x4ba797){_0x95a28c=_0x95a28c-0x0;var _0x1f7c7b=_0xd0a2[_0x95a28c];return _0x1f7c7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2d0a('0x0')](_0x2d0a('0x1'),_0x2d0a('0x2'),_0x2d0a('0x3'),_0x2d0a('0x4')),'defaultValue':_0x2d0a('0x1')},'content':{'type':Sequelize[_0x2d0a('0x5')]},'key':{'type':Sequelize[_0x2d0a('0x5')]},'keyType':{'type':Sequelize[_0x2d0a('0x0')](_0x2d0a('0x1'),_0x2d0a('0x2'),_0x2d0a('0x3'))},'keyContent':{'type':Sequelize[_0x2d0a('0x5')]},'idField':{'type':Sequelize[_0x2d0a('0x5')]},'nameField':{'type':Sequelize[_0x2d0a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d0a('0x5')]}}; \ No newline at end of file +var _0xf808=['string','variable','keyValue','STRING','customVariable','ENUM'];(function(_0x4686a3,_0x27c2de){var _0x485941=function(_0x4e4441){while(--_0x4e4441){_0x4686a3['push'](_0x4686a3['shift']());}};_0x485941(++_0x27c2de);}(_0xf808,0x83));var _0x8f80=function(_0x1e685d,_0x33e5ef){_0x1e685d=_0x1e685d-0x0;var _0x1f65b1=_0xf808[_0x1e685d];return _0x1f65b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8f80('0x0')](_0x8f80('0x1'),_0x8f80('0x2'),'customVariable',_0x8f80('0x3')),'defaultValue':_0x8f80('0x1')},'content':{'type':Sequelize[_0x8f80('0x4')]},'key':{'type':Sequelize[_0x8f80('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x8f80('0x1'),'variable',_0x8f80('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8f80('0x4')]},'nameField':{'type':Sequelize[_0x8f80('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f80('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4b45c30..8b56a0b 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 _0x6d83=['includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ZohoField','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x3d351d,_0x4eac13){var _0x1fb813=function(_0x41ce5b){while(--_0x41ce5b){_0x3d351d['push'](_0x3d351d['shift']());}};_0x1fb813(++_0x4eac13);}(_0x6d83,0x137));var _0x36d8=function(_0x34990e,_0x6b0647){_0x34990e=_0x34990e-0x0;var _0x2740b5=_0x6d83[_0x34990e];return _0x2740b5;};'use strict';var pdf=require(_0x36d8('0x0'));var emlformat=require(_0x36d8('0x1'));var rimraf=require(_0x36d8('0x2'));var zipdir=require(_0x36d8('0x3'));var jsonpatch=require(_0x36d8('0x4'));var rp=require(_0x36d8('0x5'));var moment=require(_0x36d8('0x6'));var BPromise=require(_0x36d8('0x7'));var Mustache=require('mustache');var util=require(_0x36d8('0x8'));var path=require('path');var sox=require(_0x36d8('0x9'));var csv=require(_0x36d8('0xa'));var ejs=require(_0x36d8('0xb'));var fs=require('fs');var _=require(_0x36d8('0xc'));var squel=require('squel');var crypto=require(_0x36d8('0xd'));var jsforce=require(_0x36d8('0xe'));var deskjs=require(_0x36d8('0xf'));var toCsv=require(_0x36d8('0xa'));var querystring=require(_0x36d8('0x10'));var Papa=require(_0x36d8('0x11'));var Redis=require(_0x36d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x36d8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36d8('0x14'));var logger=require(_0x36d8('0x15'))(_0x36d8('0x16'));var utils=require(_0x36d8('0x17'));var config=require(_0x36d8('0x18'));var licenseUtil=require(_0x36d8('0x19'));var db=require(_0x36d8('0x1a'))['db'];function respondWithStatusCode(_0x4bd2f0,_0x4c4c71){_0x4c4c71=_0x4c4c71||0xcc;return function(_0x382876){if(_0x382876){return _0x4bd2f0[_0x36d8('0x1b')](_0x4c4c71);}return _0x4bd2f0[_0x36d8('0x1c')](_0x4c4c71)[_0x36d8('0x1d')]();};}function respondWithResult(_0x28e9d1,_0x5ce99b){_0x5ce99b=_0x5ce99b||0xc8;return function(_0x476d43){if(_0x476d43){return _0x28e9d1[_0x36d8('0x1c')](_0x5ce99b)[_0x36d8('0x1e')](_0x476d43);}};}function respondWithFilteredResult(_0x5569b9,_0x138aaa){return function(_0x223955){if(_0x223955){var _0x50d441=_0x223955[_0x36d8('0x1f')],_0x32142c=_0x138aaa[_0x36d8('0x20')],_0x30d237=_0x138aaa[_0x36d8('0x20')]+_0x138aaa[_0x36d8('0x21')],_0x53386d;if(_0x30d237>=_0x50d441){_0x30d237=_0x50d441;_0x53386d=0xc8;}else{_0x53386d=0xce;}_0x5569b9['status'](_0x53386d);return _0x5569b9['set'](_0x36d8('0x22'),_0x32142c+'-'+_0x30d237+'/'+_0x50d441)[_0x36d8('0x1e')](_0x223955);}return null;};}function patchUpdates(_0x3e7924){return function(_0x433620){try{jsonpatch[_0x36d8('0x23')](_0x433620,_0x3e7924,!![]);}catch(_0x357fb9){return BPromise[_0x36d8('0x24')](_0x357fb9);}return _0x433620[_0x36d8('0x25')]();};}function saveUpdates(_0x5a1981,_0x5b648f){return function(_0x49d21c){if(_0x49d21c){return _0x49d21c[_0x36d8('0x26')](_0x5a1981)[_0x36d8('0x27')](function(_0x1b80cd){return _0x1b80cd;});}return null;};}function removeEntity(_0x5a3646,_0x4a25d3){return function(_0x391588){if(_0x391588){return _0x391588[_0x36d8('0x28')]()[_0x36d8('0x27')](function(){_0x5a3646['status'](0xcc)[_0x36d8('0x1d')]();});}};}function handleEntityNotFound(_0x53af45,_0x26ea66){return function(_0x75fe7e){if(!_0x75fe7e){_0x53af45[_0x36d8('0x1b')](0x194);}return _0x75fe7e;};}function handleError(_0x335c3f,_0x1ab917){_0x1ab917=_0x1ab917||0x1f4;return function(_0x3521b4){logger[_0x36d8('0x29')](_0x3521b4[_0x36d8('0x2a')]);if(_0x3521b4[_0x36d8('0x2b')]){delete _0x3521b4[_0x36d8('0x2b')];}_0x335c3f[_0x36d8('0x1c')](_0x1ab917)[_0x36d8('0x2c')](_0x3521b4);};}exports['index']=function(_0xebdec2,_0x5d169d){var _0x352ad1={},_0x713a03={},_0x4b4c7c={'count':0x0,'rows':[]};var _0x20fe90=_['map'](db[_0x36d8('0x2d')][_0x36d8('0x2e')],function(_0x2468e9){return{'name':_0x2468e9[_0x36d8('0x2f')],'type':_0x2468e9[_0x36d8('0x30')]['key']};});_0x713a03[_0x36d8('0x31')]=_[_0x36d8('0x32')](_0x20fe90,_0x36d8('0x2b'));_0x713a03[_0x36d8('0x33')]=_['keys'](_0xebdec2[_0x36d8('0x33')]);_0x713a03[_0x36d8('0x34')]=_[_0x36d8('0x35')](_0x713a03[_0x36d8('0x31')],_0x713a03[_0x36d8('0x33')]);_0x352ad1[_0x36d8('0x36')]=_[_0x36d8('0x35')](_0x713a03[_0x36d8('0x31')],qs[_0x36d8('0x37')](_0xebdec2[_0x36d8('0x33')]['fields']));_0x352ad1[_0x36d8('0x36')]=_0x352ad1[_0x36d8('0x36')][_0x36d8('0x38')]?_0x352ad1[_0x36d8('0x36')]:_0x713a03[_0x36d8('0x31')];if(!_0xebdec2[_0x36d8('0x33')]['hasOwnProperty']('nolimit')){_0x352ad1[_0x36d8('0x21')]=qs[_0x36d8('0x21')](_0xebdec2[_0x36d8('0x33')][_0x36d8('0x21')]);_0x352ad1['offset']=qs[_0x36d8('0x20')](_0xebdec2[_0x36d8('0x33')]['offset']);}_0x352ad1[_0x36d8('0x39')]=qs[_0x36d8('0x3a')](_0xebdec2[_0x36d8('0x33')][_0x36d8('0x3a')]);_0x352ad1[_0x36d8('0x3b')]=qs[_0x36d8('0x34')](_[_0x36d8('0x3c')](_0xebdec2[_0x36d8('0x33')],_0x713a03[_0x36d8('0x34')]),_0x20fe90);if(_0xebdec2['query']['filter']){_0x352ad1[_0x36d8('0x3b')]=_[_0x36d8('0x3d')](_0x352ad1[_0x36d8('0x3b')],{'$or':_[_0x36d8('0x32')](_0x20fe90,function(_0x2e7636){if(_0x2e7636[_0x36d8('0x30')]!==_0x36d8('0x3e')){var _0x4d1b4d={};_0x4d1b4d[_0x2e7636[_0x36d8('0x2b')]]={'$like':'%'+_0xebdec2[_0x36d8('0x33')][_0x36d8('0x3f')]+'%'};return _0x4d1b4d;}})});}_0x352ad1=_[_0x36d8('0x3d')]({},_0x352ad1,_0xebdec2['options']);var _0x1e5cdf={'where':_0x352ad1[_0x36d8('0x3b')]};return db['ZohoField'][_0x36d8('0x1f')](_0x1e5cdf)[_0x36d8('0x27')](function(_0x525d17){_0x4b4c7c[_0x36d8('0x1f')]=_0x525d17;if(_0xebdec2['query'][_0x36d8('0x40')]){_0x352ad1[_0x36d8('0x41')]=[{'all':!![]}];}return db[_0x36d8('0x2d')][_0x36d8('0x42')](_0x352ad1);})[_0x36d8('0x27')](function(_0x396048){_0x4b4c7c[_0x36d8('0x43')]=_0x396048;return _0x4b4c7c;})[_0x36d8('0x27')](respondWithFilteredResult(_0x5d169d,_0x352ad1))['catch'](handleError(_0x5d169d,null));};exports[_0x36d8('0x44')]=function(_0x3a034b,_0xde6a77){var _0x568809={'raw':!![],'where':{'id':_0x3a034b[_0x36d8('0x45')]['id']}},_0x55d758={};_0x55d758[_0x36d8('0x31')]=_[_0x36d8('0x46')](db[_0x36d8('0x2d')]['rawAttributes']);_0x55d758['query']=_['keys'](_0x3a034b['query']);_0x55d758[_0x36d8('0x34')]=_[_0x36d8('0x35')](_0x55d758[_0x36d8('0x31')],_0x55d758[_0x36d8('0x33')]);_0x568809[_0x36d8('0x36')]=_[_0x36d8('0x35')](_0x55d758[_0x36d8('0x31')],qs[_0x36d8('0x37')](_0x3a034b[_0x36d8('0x33')][_0x36d8('0x37')]));_0x568809['attributes']=_0x568809[_0x36d8('0x36')]['length']?_0x568809[_0x36d8('0x36')]:_0x55d758['model'];if(_0x3a034b['query']['includeAll']){_0x568809[_0x36d8('0x41')]=[{'all':!![]}];}_0x568809=_['merge']({},_0x568809,_0x3a034b['options']);return db[_0x36d8('0x2d')][_0x36d8('0x47')](_0x568809)[_0x36d8('0x27')](handleEntityNotFound(_0xde6a77,null))['then'](respondWithResult(_0xde6a77,null))[_0x36d8('0x48')](handleError(_0xde6a77,null));};exports['create']=function(_0x2dad36,_0x47bb98){return db[_0x36d8('0x2d')][_0x36d8('0x49')](_0x2dad36['body'],{})['then'](respondWithResult(_0x47bb98,0xc9))[_0x36d8('0x48')](handleError(_0x47bb98,null));};exports[_0x36d8('0x26')]=function(_0x32d97c,_0x1674d8){if(_0x32d97c['body']['id']){delete _0x32d97c[_0x36d8('0x4a')]['id'];}return db[_0x36d8('0x2d')]['find']({'where':{'id':_0x32d97c[_0x36d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1674d8,null))['then'](saveUpdates(_0x32d97c[_0x36d8('0x4a')],null))[_0x36d8('0x27')](respondWithResult(_0x1674d8,null))[_0x36d8('0x48')](handleError(_0x1674d8,null));};exports[_0x36d8('0x28')]=function(_0x3881fc,_0x11ae28){return db[_0x36d8('0x2d')]['find']({'where':{'id':_0x3881fc[_0x36d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x11ae28,null))[_0x36d8('0x27')](removeEntity(_0x11ae28,null))[_0x36d8('0x48')](handleError(_0x11ae28,null));}; \ No newline at end of file +var _0x6f8b=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys'];(function(_0x121737,_0x329846){var _0x2e6722=function(_0x3eed79){while(--_0x3eed79){_0x121737['push'](_0x121737['shift']());}};_0x2e6722(++_0x329846);}(_0x6f8b,0x1cb));var _0xb6f8=function(_0x14c308,_0x5689d6){_0x14c308=_0x14c308-0x0;var _0x267a4a=_0x6f8b[_0x14c308];return _0x267a4a;};'use strict';var pdf=require(_0xb6f8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6f8('0x1'));var jsonpatch=require(_0xb6f8('0x2'));var rp=require(_0xb6f8('0x3'));var moment=require(_0xb6f8('0x4'));var BPromise=require(_0xb6f8('0x5'));var Mustache=require(_0xb6f8('0x6'));var util=require(_0xb6f8('0x7'));var path=require('path');var sox=require(_0xb6f8('0x8'));var csv=require(_0xb6f8('0x9'));var ejs=require(_0xb6f8('0xa'));var fs=require('fs');var _=require(_0xb6f8('0xb'));var squel=require(_0xb6f8('0xc'));var crypto=require(_0xb6f8('0xd'));var jsforce=require(_0xb6f8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb6f8('0xf'));var Papa=require(_0xb6f8('0x10'));var Redis=require(_0xb6f8('0x11'));var authService=require(_0xb6f8('0x12'));var qs=require(_0xb6f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6f8('0x14'));var logger=require(_0xb6f8('0x15'))(_0xb6f8('0x16'));var utils=require(_0xb6f8('0x17'));var config=require(_0xb6f8('0x18'));var licenseUtil=require(_0xb6f8('0x19'));var db=require(_0xb6f8('0x1a'))['db'];function respondWithStatusCode(_0x4f17a5,_0x205ac6){_0x205ac6=_0x205ac6||0xcc;return function(_0x329384){if(_0x329384){return _0x4f17a5[_0xb6f8('0x1b')](_0x205ac6);}return _0x4f17a5[_0xb6f8('0x1c')](_0x205ac6)[_0xb6f8('0x1d')]();};}function respondWithResult(_0x592b5f,_0x538093){_0x538093=_0x538093||0xc8;return function(_0x39f2da){if(_0x39f2da){return _0x592b5f[_0xb6f8('0x1c')](_0x538093)[_0xb6f8('0x1e')](_0x39f2da);}};}function respondWithFilteredResult(_0x1ac96f,_0x2b9501){return function(_0x45626e){if(_0x45626e){var _0x2c6d84=_0x45626e[_0xb6f8('0x1f')],_0x931274=_0x2b9501[_0xb6f8('0x20')],_0x20f09c=_0x2b9501[_0xb6f8('0x20')]+_0x2b9501[_0xb6f8('0x21')],_0xb50745;if(_0x20f09c>=_0x2c6d84){_0x20f09c=_0x2c6d84;_0xb50745=0xc8;}else{_0xb50745=0xce;}_0x1ac96f[_0xb6f8('0x1c')](_0xb50745);return _0x1ac96f[_0xb6f8('0x22')](_0xb6f8('0x23'),_0x931274+'-'+_0x20f09c+'/'+_0x2c6d84)[_0xb6f8('0x1e')](_0x45626e);}return null;};}function patchUpdates(_0x4e5688){return function(_0x239c82){try{jsonpatch[_0xb6f8('0x24')](_0x239c82,_0x4e5688,!![]);}catch(_0x459b0f){return BPromise['reject'](_0x459b0f);}return _0x239c82[_0xb6f8('0x25')]();};}function saveUpdates(_0x582e01,_0x1f2656){return function(_0x400af0){if(_0x400af0){return _0x400af0[_0xb6f8('0x26')](_0x582e01)[_0xb6f8('0x27')](function(_0xe8c04d){return _0xe8c04d;});}return null;};}function removeEntity(_0x1dc746,_0x5f1309){return function(_0x274bc9){if(_0x274bc9){return _0x274bc9[_0xb6f8('0x28')]()[_0xb6f8('0x27')](function(){_0x1dc746[_0xb6f8('0x1c')](0xcc)[_0xb6f8('0x1d')]();});}};}function handleEntityNotFound(_0x369ca1,_0x552ec9){return function(_0x21e1a8){if(!_0x21e1a8){_0x369ca1['sendStatus'](0x194);}return _0x21e1a8;};}function handleError(_0x42c0ee,_0x1654f5){_0x1654f5=_0x1654f5||0x1f4;return function(_0x3ebf2b){logger['error'](_0x3ebf2b['stack']);if(_0x3ebf2b[_0xb6f8('0x29')]){delete _0x3ebf2b['name'];}_0x42c0ee[_0xb6f8('0x1c')](_0x1654f5)[_0xb6f8('0x2a')](_0x3ebf2b);};}exports[_0xb6f8('0x2b')]=function(_0x499f43,_0x2e2af5){var _0xc57d85={},_0x3d0fb0={},_0xa61b69={'count':0x0,'rows':[]};var _0x46e869=_[_0xb6f8('0x2c')](db[_0xb6f8('0x2d')][_0xb6f8('0x2e')],function(_0x98602c){return{'name':_0x98602c['fieldName'],'type':_0x98602c[_0xb6f8('0x2f')][_0xb6f8('0x30')]};});_0x3d0fb0[_0xb6f8('0x31')]=_['map'](_0x46e869,_0xb6f8('0x29'));_0x3d0fb0[_0xb6f8('0x32')]=_[_0xb6f8('0x33')](_0x499f43[_0xb6f8('0x32')]);_0x3d0fb0[_0xb6f8('0x34')]=_[_0xb6f8('0x35')](_0x3d0fb0['model'],_0x3d0fb0[_0xb6f8('0x32')]);_0xc57d85[_0xb6f8('0x36')]=_[_0xb6f8('0x35')](_0x3d0fb0[_0xb6f8('0x31')],qs[_0xb6f8('0x37')](_0x499f43[_0xb6f8('0x32')]['fields']));_0xc57d85[_0xb6f8('0x36')]=_0xc57d85['attributes'][_0xb6f8('0x38')]?_0xc57d85[_0xb6f8('0x36')]:_0x3d0fb0[_0xb6f8('0x31')];if(!_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x39')]('nolimit')){_0xc57d85[_0xb6f8('0x21')]=qs['limit'](_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x21')]);_0xc57d85[_0xb6f8('0x20')]=qs[_0xb6f8('0x20')](_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x20')]);}_0xc57d85[_0xb6f8('0x3a')]=qs[_0xb6f8('0x3b')](_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x3b')]);_0xc57d85[_0xb6f8('0x3c')]=qs[_0xb6f8('0x34')](_['pick'](_0x499f43[_0xb6f8('0x32')],_0x3d0fb0[_0xb6f8('0x34')]),_0x46e869);if(_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x3d')]){_0xc57d85['where']=_[_0xb6f8('0x3e')](_0xc57d85['where'],{'$or':_[_0xb6f8('0x2c')](_0x46e869,function(_0x11648f){if(_0x11648f[_0xb6f8('0x2f')]!==_0xb6f8('0x3f')){var _0x1fdd27={};_0x1fdd27[_0x11648f[_0xb6f8('0x29')]]={'$like':'%'+_0x499f43['query'][_0xb6f8('0x3d')]+'%'};return _0x1fdd27;}})});}_0xc57d85=_[_0xb6f8('0x3e')]({},_0xc57d85,_0x499f43['options']);var _0x51d1c7={'where':_0xc57d85[_0xb6f8('0x3c')]};return db['ZohoField']['count'](_0x51d1c7)[_0xb6f8('0x27')](function(_0x5c97fa){_0xa61b69[_0xb6f8('0x1f')]=_0x5c97fa;if(_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x40')]){_0xc57d85[_0xb6f8('0x41')]=[{'all':!![]}];}return db[_0xb6f8('0x2d')][_0xb6f8('0x42')](_0xc57d85);})[_0xb6f8('0x27')](function(_0x38c9a1){_0xa61b69[_0xb6f8('0x43')]=_0x38c9a1;return _0xa61b69;})[_0xb6f8('0x27')](respondWithFilteredResult(_0x2e2af5,_0xc57d85))[_0xb6f8('0x44')](handleError(_0x2e2af5,null));};exports['show']=function(_0x4935c1,_0x26af61){var _0x175b80={'raw':!![],'where':{'id':_0x4935c1[_0xb6f8('0x45')]['id']}},_0x5451c0={};_0x5451c0[_0xb6f8('0x31')]=_[_0xb6f8('0x33')](db[_0xb6f8('0x2d')][_0xb6f8('0x2e')]);_0x5451c0[_0xb6f8('0x32')]=_[_0xb6f8('0x33')](_0x4935c1[_0xb6f8('0x32')]);_0x5451c0[_0xb6f8('0x34')]=_[_0xb6f8('0x35')](_0x5451c0[_0xb6f8('0x31')],_0x5451c0[_0xb6f8('0x32')]);_0x175b80[_0xb6f8('0x36')]=_[_0xb6f8('0x35')](_0x5451c0[_0xb6f8('0x31')],qs[_0xb6f8('0x37')](_0x4935c1['query']['fields']));_0x175b80['attributes']=_0x175b80[_0xb6f8('0x36')]['length']?_0x175b80[_0xb6f8('0x36')]:_0x5451c0[_0xb6f8('0x31')];if(_0x4935c1[_0xb6f8('0x32')][_0xb6f8('0x40')]){_0x175b80['include']=[{'all':!![]}];}_0x175b80=_[_0xb6f8('0x3e')]({},_0x175b80,_0x4935c1['options']);return db[_0xb6f8('0x2d')][_0xb6f8('0x46')](_0x175b80)['then'](handleEntityNotFound(_0x26af61,null))[_0xb6f8('0x27')](respondWithResult(_0x26af61,null))['catch'](handleError(_0x26af61,null));};exports['create']=function(_0xf73d70,_0x3a52b2){return db[_0xb6f8('0x2d')][_0xb6f8('0x47')](_0xf73d70[_0xb6f8('0x48')],{})[_0xb6f8('0x27')](respondWithResult(_0x3a52b2,0xc9))[_0xb6f8('0x44')](handleError(_0x3a52b2,null));};exports['update']=function(_0x2b70d3,_0x278365){if(_0x2b70d3['body']['id']){delete _0x2b70d3[_0xb6f8('0x48')]['id'];}return db[_0xb6f8('0x2d')][_0xb6f8('0x46')]({'where':{'id':_0x2b70d3[_0xb6f8('0x45')]['id']}})[_0xb6f8('0x27')](handleEntityNotFound(_0x278365,null))[_0xb6f8('0x27')](saveUpdates(_0x2b70d3[_0xb6f8('0x48')],null))[_0xb6f8('0x27')](respondWithResult(_0x278365,null))[_0xb6f8('0x44')](handleError(_0x278365,null));};exports[_0xb6f8('0x28')]=function(_0x51b42d,_0x64fda1){return db[_0xb6f8('0x2d')][_0xb6f8('0x46')]({'where':{'id':_0x51b42d[_0xb6f8('0x45')]['id']}})[_0xb6f8('0x27')](handleEntityNotFound(_0x64fda1,null))[_0xb6f8('0x27')](removeEntity(_0x64fda1,null))[_0xb6f8('0x44')](handleError(_0x64fda1,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1a73bb8..515ecca 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 _0x5bf1=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId'];(function(_0x2fb8a8,_0x25fd34){var _0x4c182c=function(_0xe180fd){while(--_0xe180fd){_0x2fb8a8['push'](_0x2fb8a8['shift']());}};_0x4c182c(++_0x25fd34);}(_0x5bf1,0xdd));var _0x15bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bf1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x15bf('0x0'));var util=require('util');var logger=require(_0x15bf('0x1'))('api');var moment=require(_0x15bf('0x2'));var BPromise=require(_0x15bf('0x3'));var rp=require(_0x15bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15bf('0x5'));var config=require('../../config/environment');var attributes=require(_0x15bf('0x6'));module[_0x15bf('0x7')]=function(_0x3eac59,_0x947681){return _0x3eac59[_0x15bf('0x8')](_0x15bf('0x9'),attributes,{'tableName':_0x15bf('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x15bf('0xb'),_0x15bf('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ec3=['define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','moment','request-promise','path','../../config/environment','./intZohoField.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9ec3,0x119));var _0x39ec=function(_0x336874,_0x164ec5){_0x336874=_0x336874-0x0;var _0x47da18=_0x9ec3[_0x336874];return _0x47da18;};'use strict';var _=require(_0x39ec('0x0'));var util=require(_0x39ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x39ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x39ec('0x3'));var fs=require('fs');var path=require(_0x39ec('0x4'));var rimraf=require('rimraf');var config=require(_0x39ec('0x5'));var attributes=require(_0x39ec('0x6'));module['exports']=function(_0x4043b8,_0x1f3ade){return _0x4043b8[_0x39ec('0x7')](_0x39ec('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x39ec('0x9'),'fields':[_0x39ec('0xa'),_0x39ec('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index c8ac901..e2f4382 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x1d0244,_0x5f1061){var _0x5e350b=function(_0x1f40a6){while(--_0x1f40a6){_0x1d0244['push'](_0x1d0244['shift']());}};_0x5e350b(++_0x5f1061);}(_0x4b84,0x1cc));var _0x44b8=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4b84[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('ZohoField,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('ZohoField,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x470cd9,_0x5e8df5){var _0xe18ab=function(_0x2a698a){while(--_0x2a698a){_0x470cd9['push'](_0x470cd9['shift']());}};_0xe18ab(++_0x5e8df5);}(_0xe14b,0x93));var _0xbe14=function(_0x146852,_0x36a168){_0x146852=_0x146852-0x0;var _0x5181eb=_0xe14b[_0x146852];return _0x5181eb;};'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/integration/index.js b/server/api/integration/index.js index 9f5df2e..9ce4537 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 _0x639e=['../../config/environment','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x130256,_0x273744){var _0x17d0fe=function(_0x4898f3){while(--_0x4898f3){_0x130256['push'](_0x130256['shift']());}};_0x17d0fe(++_0x273744);}(_0x639e,0x189));var _0xe639=function(_0xee40b0,_0x1270b8){_0xee40b0=_0xee40b0-0x0;var _0x55e4c1=_0x639e[_0xee40b0];return _0x55e4c1;};'use strict';var multer=require(_0xe639('0x0'));var util=require(_0xe639('0x1'));var path=require('path');var timeout=require(_0xe639('0x2'));var express=require(_0xe639('0x3'));var router=express[_0xe639('0x4')]();var auth=require(_0xe639('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe639('0x6'));module['exports']=router; \ No newline at end of file +var _0xb980=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x7b614,_0x2d2a70){var _0x277475=function(_0x3d3ac4){while(--_0x3d3ac4){_0x7b614['push'](_0x7b614['shift']());}};_0x277475(++_0x2d2a70);}(_0xb980,0xf9));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0b98('0x0'));var util=require(_0x0b98('0x1'));var path=require('path');var timeout=require(_0x0b98('0x2'));var express=require(_0x0b98('0x3'));var router=express[_0x0b98('0x4')]();var auth=require(_0x0b98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b98('0x6'));module[_0x0b98('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 700e699..7b1d3d4 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 _0x00c4=['exports','STRING','unique_name_and_version','app.js','BOOLEAN','state'];(function(_0x305f84,_0x23d12a){var _0x1bd9fb=function(_0xf8b717){while(--_0xf8b717){_0x305f84['push'](_0x305f84['shift']());}};_0x1bd9fb(++_0x23d12a);}(_0x00c4,0x84));var _0x400c=function(_0x1d2b4b,_0x1b8974){_0x1d2b4b=_0x1d2b4b-0x0;var _0x54d25f=_0x00c4[_0x1d2b4b];return _0x54d25f;};'use strict';var Sequelize=require('sequelize');module[_0x400c('0x0')]={'name':{'type':Sequelize[_0x400c('0x1')],'allowNull':![],'unique':_0x400c('0x2')},'version':{'type':Sequelize[_0x400c('0x1')],'allowNull':![],'unique':_0x400c('0x2')},'main':{'type':Sequelize[_0x400c('0x1')],'defaultValue':_0x400c('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x400c('0x1')]},'type':{'type':Sequelize[_0x400c('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x400c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x400c('0x1')]},'logo':{'type':Sequelize[_0x400c('0x1')]},'state':{'type':Sequelize[_0x400c('0x1')],'unique':_0x400c('0x5')},'description':{'type':Sequelize[_0x400c('0x1')]},'title':{'type':Sequelize[_0x400c('0x1')]},'remoteUri':{'type':Sequelize[_0x400c('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x90e8=['STRING','app.js','INTEGER','state','sequelize','unique_name_and_version'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90e8,0x14e));var _0x890e=function(_0x27745e,_0x1aa2e9){_0x27745e=_0x27745e-0x0;var _0x518662=_0x90e8[_0x27745e];return _0x518662;};'use strict';var Sequelize=require(_0x890e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x890e('0x1')},'version':{'type':Sequelize[_0x890e('0x2')],'allowNull':![],'unique':_0x890e('0x1')},'main':{'type':Sequelize[_0x890e('0x2')],'defaultValue':_0x890e('0x3')},'filename':{'type':Sequelize[_0x890e('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x890e('0x2')]},'size':{'type':Sequelize[_0x890e('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x890e('0x2')]},'state':{'type':Sequelize[_0x890e('0x2')],'unique':_0x890e('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x890e('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c99d446..fce7756 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 _0x37b8=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','findAll','rows','catch','show','intersection','includeAll','include','options','create','body','find','params','html-pdf','eml-format','rimraf'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0x37b8,0x12d));var _0x837b=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x37b8[_0x6cf19c];return _0xce14f3;};'use strict';var pdf=require(_0x837b('0x0'));var emlformat=require(_0x837b('0x1'));var rimraf=require(_0x837b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x837b('0x3'));var rp=require(_0x837b('0x4'));var moment=require(_0x837b('0x5'));var BPromise=require(_0x837b('0x6'));var Mustache=require(_0x837b('0x7'));var util=require(_0x837b('0x8'));var path=require(_0x837b('0x9'));var sox=require(_0x837b('0xa'));var csv=require(_0x837b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x837b('0xc'));var squel=require(_0x837b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x837b('0xe'));var toCsv=require(_0x837b('0xb'));var querystring=require(_0x837b('0xf'));var Papa=require('papaparse');var Redis=require(_0x837b('0x10'));var authService=require(_0x837b('0x11'));var qs=require(_0x837b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x837b('0x13'));var logger=require('../../config/logger')(_0x837b('0x14'));var utils=require(_0x837b('0x15'));var config=require(_0x837b('0x16'));var licenseUtil=require(_0x837b('0x17'));var db=require(_0x837b('0x18'))['db'];function respondWithStatusCode(_0x1dd282,_0x4b6a59){_0x4b6a59=_0x4b6a59||0xcc;return function(_0x15e654){if(_0x15e654){return _0x1dd282[_0x837b('0x19')](_0x4b6a59);}return _0x1dd282[_0x837b('0x1a')](_0x4b6a59)[_0x837b('0x1b')]();};}function respondWithResult(_0x54dfee,_0x28f359){_0x28f359=_0x28f359||0xc8;return function(_0x492c63){if(_0x492c63){return _0x54dfee[_0x837b('0x1a')](_0x28f359)[_0x837b('0x1c')](_0x492c63);}};}function respondWithFilteredResult(_0x2f564f,_0x3f11ce){return function(_0x5a7e4f){if(_0x5a7e4f){var _0xeb4aa6=_0x5a7e4f['count'],_0x16afa5=_0x3f11ce['offset'],_0x2a2508=_0x3f11ce[_0x837b('0x1d')]+_0x3f11ce[_0x837b('0x1e')],_0x176742;if(_0x2a2508>=_0xeb4aa6){_0x2a2508=_0xeb4aa6;_0x176742=0xc8;}else{_0x176742=0xce;}_0x2f564f[_0x837b('0x1a')](_0x176742);return _0x2f564f[_0x837b('0x1f')]('Content-Range',_0x16afa5+'-'+_0x2a2508+'/'+_0xeb4aa6)[_0x837b('0x1c')](_0x5a7e4f);}return null;};}function patchUpdates(_0x2558c1){return function(_0x56ecbc){try{jsonpatch[_0x837b('0x20')](_0x56ecbc,_0x2558c1,!![]);}catch(_0x40ac5a){return BPromise['reject'](_0x40ac5a);}return _0x56ecbc['save']();};}function saveUpdates(_0x31ebff,_0x264f4d){return function(_0x510687){if(_0x510687){return _0x510687[_0x837b('0x21')](_0x31ebff)[_0x837b('0x22')](function(_0x42fba3){return _0x42fba3;});}return null;};}function removeEntity(_0x238132,_0x31ba62){return function(_0x3ac6eb){if(_0x3ac6eb){return _0x3ac6eb[_0x837b('0x23')]()[_0x837b('0x22')](function(){_0x238132[_0x837b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b05e,_0x28c8c6){return function(_0xa9e21c){if(!_0xa9e21c){_0x14b05e[_0x837b('0x19')](0x194);}return _0xa9e21c;};}function handleError(_0x50b183,_0x2d42dd){_0x2d42dd=_0x2d42dd||0x1f4;return function(_0xe4a389){logger[_0x837b('0x24')](_0xe4a389[_0x837b('0x25')]);if(_0xe4a389['name']){delete _0xe4a389[_0x837b('0x26')];}_0x50b183[_0x837b('0x1a')](_0x2d42dd)[_0x837b('0x27')](_0xe4a389);};}exports[_0x837b('0x28')]=function(_0x4b8b97,_0x106101){var _0x2a33b6={},_0x2531d9={},_0x4b770b={'count':0x0,'rows':[]};var _0x463ab1=_[_0x837b('0x29')](db[_0x837b('0x2a')][_0x837b('0x2b')],function(_0x5dc3f6){return{'name':_0x5dc3f6[_0x837b('0x2c')],'type':_0x5dc3f6['type'][_0x837b('0x2d')]};});_0x2531d9[_0x837b('0x2e')]=_[_0x837b('0x29')](_0x463ab1,_0x837b('0x26'));_0x2531d9[_0x837b('0x2f')]=_[_0x837b('0x30')](_0x4b8b97['query']);_0x2531d9[_0x837b('0x31')]=_['intersection'](_0x2531d9[_0x837b('0x2e')],_0x2531d9[_0x837b('0x2f')]);_0x2a33b6[_0x837b('0x32')]=_['intersection'](_0x2531d9[_0x837b('0x2e')],qs[_0x837b('0x33')](_0x4b8b97[_0x837b('0x2f')][_0x837b('0x33')]));_0x2a33b6[_0x837b('0x32')]=_0x2a33b6[_0x837b('0x32')][_0x837b('0x34')]?_0x2a33b6[_0x837b('0x32')]:_0x2531d9[_0x837b('0x2e')];if(!_0x4b8b97[_0x837b('0x2f')][_0x837b('0x35')](_0x837b('0x36'))){_0x2a33b6[_0x837b('0x1e')]=qs[_0x837b('0x1e')](_0x4b8b97[_0x837b('0x2f')][_0x837b('0x1e')]);_0x2a33b6[_0x837b('0x1d')]=qs[_0x837b('0x1d')](_0x4b8b97['query'][_0x837b('0x1d')]);}_0x2a33b6[_0x837b('0x37')]=qs[_0x837b('0x38')](_0x4b8b97[_0x837b('0x2f')][_0x837b('0x38')]);_0x2a33b6[_0x837b('0x39')]=qs[_0x837b('0x31')](_[_0x837b('0x3a')](_0x4b8b97[_0x837b('0x2f')],_0x2531d9[_0x837b('0x31')]),_0x463ab1);if(_0x4b8b97[_0x837b('0x2f')]['filter']){_0x2a33b6[_0x837b('0x39')]=_[_0x837b('0x3b')](_0x2a33b6[_0x837b('0x39')],{'$or':_[_0x837b('0x29')](_0x463ab1,function(_0x29299a){if(_0x29299a[_0x837b('0x3c')]!==_0x837b('0x3d')){var _0x213867={};_0x213867[_0x29299a[_0x837b('0x26')]]={'$like':'%'+_0x4b8b97[_0x837b('0x2f')][_0x837b('0x3e')]+'%'};return _0x213867;}})});}_0x2a33b6=_['merge']({},_0x2a33b6,_0x4b8b97['options']);var _0x2fb790={'where':_0x2a33b6[_0x837b('0x39')]};return db['Integration'][_0x837b('0x3f')](_0x2fb790)['then'](function(_0x5e7ef6){_0x4b770b[_0x837b('0x3f')]=_0x5e7ef6;if(_0x4b8b97[_0x837b('0x2f')]['includeAll']){_0x2a33b6['include']=[{'all':!![]}];}return db[_0x837b('0x2a')][_0x837b('0x40')](_0x2a33b6);})[_0x837b('0x22')](function(_0x10d08d){_0x4b770b[_0x837b('0x41')]=_0x10d08d;return _0x4b770b;})['then'](respondWithFilteredResult(_0x106101,_0x2a33b6))[_0x837b('0x42')](handleError(_0x106101,null));};exports[_0x837b('0x43')]=function(_0x3fec06,_0x645ced){var _0x12fc22={'raw':![],'where':{'id':_0x3fec06['params']['id']}},_0x1359cf={};_0x1359cf[_0x837b('0x2e')]=_[_0x837b('0x30')](db[_0x837b('0x2a')][_0x837b('0x2b')]);_0x1359cf['query']=_[_0x837b('0x30')](_0x3fec06[_0x837b('0x2f')]);_0x1359cf[_0x837b('0x31')]=_[_0x837b('0x44')](_0x1359cf[_0x837b('0x2e')],_0x1359cf[_0x837b('0x2f')]);_0x12fc22[_0x837b('0x32')]=_[_0x837b('0x44')](_0x1359cf['model'],qs[_0x837b('0x33')](_0x3fec06[_0x837b('0x2f')]['fields']));_0x12fc22['attributes']=_0x12fc22[_0x837b('0x32')][_0x837b('0x34')]?_0x12fc22[_0x837b('0x32')]:_0x1359cf[_0x837b('0x2e')];if(_0x3fec06[_0x837b('0x2f')][_0x837b('0x45')]){_0x12fc22[_0x837b('0x46')]=[{'all':!![]}];}_0x12fc22=_[_0x837b('0x3b')]({},_0x12fc22,_0x3fec06[_0x837b('0x47')]);return db[_0x837b('0x2a')]['find'](_0x12fc22)['then'](handleEntityNotFound(_0x645ced,null))['then'](respondWithResult(_0x645ced,null))[_0x837b('0x42')](handleError(_0x645ced,null));};exports[_0x837b('0x48')]=function(_0x56f97a,_0x23c034){return db[_0x837b('0x2a')][_0x837b('0x48')](_0x56f97a['body'],{})['then'](respondWithResult(_0x23c034,0xc9))[_0x837b('0x42')](handleError(_0x23c034,null));};exports['update']=function(_0x2021d7,_0x3b2b56){if(_0x2021d7[_0x837b('0x49')]['id']){delete _0x2021d7[_0x837b('0x49')]['id'];}return db['Integration'][_0x837b('0x4a')]({'where':{'id':_0x2021d7['params']['id']}})[_0x837b('0x22')](handleEntityNotFound(_0x3b2b56,null))[_0x837b('0x22')](saveUpdates(_0x2021d7['body'],null))[_0x837b('0x22')](respondWithResult(_0x3b2b56,null))['catch'](handleError(_0x3b2b56,null));};exports[_0x837b('0x23')]=function(_0x17344d,_0x274cf2){return db['Integration'][_0x837b('0x4a')]({'where':{'id':_0x17344d[_0x837b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x274cf2,null))[_0x837b('0x22')](removeEntity(_0x274cf2,null))['catch'](handleError(_0x274cf2,null));}; \ No newline at end of file +var _0x0b94=['find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','reject','save','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','create','body','params'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0b94,0x91));var _0x40b9=function(_0x4d6e6b,_0x4b2221){_0x4d6e6b=_0x4d6e6b-0x0;var _0x35e41e=_0x0b94[_0x4d6e6b];return _0x35e41e;};'use strict';var pdf=require(_0x40b9('0x0'));var emlformat=require(_0x40b9('0x1'));var rimraf=require(_0x40b9('0x2'));var zipdir=require(_0x40b9('0x3'));var jsonpatch=require(_0x40b9('0x4'));var rp=require(_0x40b9('0x5'));var moment=require('moment');var BPromise=require(_0x40b9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x40b9('0x7'));var sox=require(_0x40b9('0x8'));var csv=require('to-csv');var ejs=require(_0x40b9('0x9'));var fs=require('fs');var _=require(_0x40b9('0xa'));var squel=require(_0x40b9('0xb'));var crypto=require(_0x40b9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x40b9('0xd'));var toCsv=require(_0x40b9('0xe'));var querystring=require(_0x40b9('0xf'));var Papa=require(_0x40b9('0x10'));var Redis=require(_0x40b9('0x11'));var authService=require(_0x40b9('0x12'));var qs=require(_0x40b9('0x13'));var as=require(_0x40b9('0x14'));var hardwareService=require(_0x40b9('0x15'));var logger=require(_0x40b9('0x16'))(_0x40b9('0x17'));var utils=require('../../config/utils');var config=require(_0x40b9('0x18'));var licenseUtil=require(_0x40b9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x99f787,_0x1d00a0){_0x1d00a0=_0x1d00a0||0xcc;return function(_0x170718){if(_0x170718){return _0x99f787[_0x40b9('0x1a')](_0x1d00a0);}return _0x99f787[_0x40b9('0x1b')](_0x1d00a0)[_0x40b9('0x1c')]();};}function respondWithResult(_0x898d4f,_0x4aa118){_0x4aa118=_0x4aa118||0xc8;return function(_0x58fa25){if(_0x58fa25){return _0x898d4f[_0x40b9('0x1b')](_0x4aa118)['json'](_0x58fa25);}};}function respondWithFilteredResult(_0x49c47a,_0x471160){return function(_0x4b4d17){if(_0x4b4d17){var _0x40f966=_0x4b4d17[_0x40b9('0x1d')],_0x3c7a6b=_0x471160[_0x40b9('0x1e')],_0x4be5a1=_0x471160[_0x40b9('0x1e')]+_0x471160[_0x40b9('0x1f')],_0x14d685;if(_0x4be5a1>=_0x40f966){_0x4be5a1=_0x40f966;_0x14d685=0xc8;}else{_0x14d685=0xce;}_0x49c47a['status'](_0x14d685);return _0x49c47a['set']('Content-Range',_0x3c7a6b+'-'+_0x4be5a1+'/'+_0x40f966)['json'](_0x4b4d17);}return null;};}function patchUpdates(_0x248fcb){return function(_0x15f1b8){try{jsonpatch['apply'](_0x15f1b8,_0x248fcb,!![]);}catch(_0x21c998){return BPromise[_0x40b9('0x20')](_0x21c998);}return _0x15f1b8[_0x40b9('0x21')]();};}function saveUpdates(_0x19c840,_0x21bacc){return function(_0x5b3e8a){if(_0x5b3e8a){return _0x5b3e8a[_0x40b9('0x22')](_0x19c840)[_0x40b9('0x23')](function(_0x539dfe){return _0x539dfe;});}return null;};}function removeEntity(_0x5084b4,_0x927cae){return function(_0x492fe5){if(_0x492fe5){return _0x492fe5[_0x40b9('0x24')]()[_0x40b9('0x23')](function(){_0x5084b4[_0x40b9('0x1b')](0xcc)[_0x40b9('0x1c')]();});}};}function handleEntityNotFound(_0x6d287c,_0x59fcfc){return function(_0x53b4eb){if(!_0x53b4eb){_0x6d287c[_0x40b9('0x1a')](0x194);}return _0x53b4eb;};}function handleError(_0x220741,_0x107d98){_0x107d98=_0x107d98||0x1f4;return function(_0x57a864){logger[_0x40b9('0x25')](_0x57a864[_0x40b9('0x26')]);if(_0x57a864['name']){delete _0x57a864[_0x40b9('0x27')];}_0x220741['status'](_0x107d98)[_0x40b9('0x28')](_0x57a864);};}exports[_0x40b9('0x29')]=function(_0x13a9cf,_0x4e5175){var _0x54cd58={},_0x21aa3c={},_0x575c0c={'count':0x0,'rows':[]};var _0x135871=_[_0x40b9('0x2a')](db[_0x40b9('0x2b')][_0x40b9('0x2c')],function(_0x99b183){return{'name':_0x99b183[_0x40b9('0x2d')],'type':_0x99b183[_0x40b9('0x2e')][_0x40b9('0x2f')]};});_0x21aa3c[_0x40b9('0x30')]=_['map'](_0x135871,_0x40b9('0x27'));_0x21aa3c[_0x40b9('0x31')]=_[_0x40b9('0x32')](_0x13a9cf[_0x40b9('0x31')]);_0x21aa3c[_0x40b9('0x33')]=_[_0x40b9('0x34')](_0x21aa3c['model'],_0x21aa3c[_0x40b9('0x31')]);_0x54cd58['attributes']=_[_0x40b9('0x34')](_0x21aa3c['model'],qs['fields'](_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x35')]));_0x54cd58[_0x40b9('0x36')]=_0x54cd58[_0x40b9('0x36')][_0x40b9('0x37')]?_0x54cd58[_0x40b9('0x36')]:_0x21aa3c['model'];if(!_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x38')]('nolimit')){_0x54cd58[_0x40b9('0x1f')]=qs['limit'](_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x1f')]);_0x54cd58[_0x40b9('0x1e')]=qs['offset'](_0x13a9cf[_0x40b9('0x31')]['offset']);}_0x54cd58[_0x40b9('0x39')]=qs['sort'](_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x3a')]);_0x54cd58[_0x40b9('0x3b')]=qs[_0x40b9('0x33')](_[_0x40b9('0x3c')](_0x13a9cf['query'],_0x21aa3c[_0x40b9('0x33')]),_0x135871);if(_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x3d')]){_0x54cd58[_0x40b9('0x3b')]=_[_0x40b9('0x3e')](_0x54cd58[_0x40b9('0x3b')],{'$or':_[_0x40b9('0x2a')](_0x135871,function(_0x2a44ea){if(_0x2a44ea[_0x40b9('0x2e')]!==_0x40b9('0x3f')){var _0x2618f1={};_0x2618f1[_0x2a44ea[_0x40b9('0x27')]]={'$like':'%'+_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x3d')]+'%'};return _0x2618f1;}})});}_0x54cd58=_['merge']({},_0x54cd58,_0x13a9cf['options']);var _0xf7251c={'where':_0x54cd58[_0x40b9('0x3b')]};return db[_0x40b9('0x2b')][_0x40b9('0x1d')](_0xf7251c)[_0x40b9('0x23')](function(_0x43a0cc){_0x575c0c[_0x40b9('0x1d')]=_0x43a0cc;if(_0x13a9cf[_0x40b9('0x31')][_0x40b9('0x40')]){_0x54cd58[_0x40b9('0x41')]=[{'all':!![]}];}return db[_0x40b9('0x2b')]['findAll'](_0x54cd58);})[_0x40b9('0x23')](function(_0x54f3f9){_0x575c0c['rows']=_0x54f3f9;return _0x575c0c;})[_0x40b9('0x23')](respondWithFilteredResult(_0x4e5175,_0x54cd58))[_0x40b9('0x42')](handleError(_0x4e5175,null));};exports[_0x40b9('0x43')]=function(_0x26e881,_0x521c41){var _0x281fde={'raw':![],'where':{'id':_0x26e881['params']['id']}},_0x520811={};_0x520811['model']=_[_0x40b9('0x32')](db[_0x40b9('0x2b')][_0x40b9('0x2c')]);_0x520811[_0x40b9('0x31')]=_[_0x40b9('0x32')](_0x26e881['query']);_0x520811[_0x40b9('0x33')]=_['intersection'](_0x520811['model'],_0x520811[_0x40b9('0x31')]);_0x281fde[_0x40b9('0x36')]=_['intersection'](_0x520811[_0x40b9('0x30')],qs['fields'](_0x26e881[_0x40b9('0x31')][_0x40b9('0x35')]));_0x281fde[_0x40b9('0x36')]=_0x281fde[_0x40b9('0x36')][_0x40b9('0x37')]?_0x281fde[_0x40b9('0x36')]:_0x520811[_0x40b9('0x30')];if(_0x26e881[_0x40b9('0x31')][_0x40b9('0x40')]){_0x281fde[_0x40b9('0x41')]=[{'all':!![]}];}_0x281fde=_[_0x40b9('0x3e')]({},_0x281fde,_0x26e881['options']);return db[_0x40b9('0x2b')]['find'](_0x281fde)['then'](handleEntityNotFound(_0x521c41,null))[_0x40b9('0x23')](respondWithResult(_0x521c41,null))['catch'](handleError(_0x521c41,null));};exports[_0x40b9('0x44')]=function(_0x303595,_0x97ebd0){return db[_0x40b9('0x2b')][_0x40b9('0x44')](_0x303595[_0x40b9('0x45')],{})[_0x40b9('0x23')](respondWithResult(_0x97ebd0,0xc9))[_0x40b9('0x42')](handleError(_0x97ebd0,null));};exports[_0x40b9('0x22')]=function(_0x39a8e2,_0x335e1d){if(_0x39a8e2[_0x40b9('0x45')]['id']){delete _0x39a8e2[_0x40b9('0x45')]['id'];}return db[_0x40b9('0x2b')]['find']({'where':{'id':_0x39a8e2[_0x40b9('0x46')]['id']}})[_0x40b9('0x23')](handleEntityNotFound(_0x335e1d,null))['then'](saveUpdates(_0x39a8e2[_0x40b9('0x45')],null))[_0x40b9('0x23')](respondWithResult(_0x335e1d,null))[_0x40b9('0x42')](handleError(_0x335e1d,null));};exports[_0x40b9('0x24')]=function(_0x8b6f65,_0x184d10){return db[_0x40b9('0x2b')][_0x40b9('0x47')]({'where':{'id':_0x8b6f65[_0x40b9('0x46')]['id']}})[_0x40b9('0x23')](handleEntityNotFound(_0x184d10,null))[_0x40b9('0x23')](removeEntity(_0x184d10,null))[_0x40b9('0x42')](handleError(_0x184d10,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0b9c5ab..089991c 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 _0x215f=['bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','moment'];(function(_0x2a3234,_0x442c61){var _0x3b6730=function(_0x1d1683){while(--_0x1d1683){_0x2a3234['push'](_0x2a3234['shift']());}};_0x3b6730(++_0x442c61);}(_0x215f,0x81));var _0xf215=function(_0x958f81,_0x18f637){_0x958f81=_0x958f81-0x0;var _0x2d502a=_0x215f[_0x958f81];return _0x2d502a;};'use strict';var _=require('lodash');var util=require(_0xf215('0x0'));var logger=require(_0xf215('0x1'))('api');var moment=require(_0xf215('0x2'));var BPromise=require(_0xf215('0x3'));var rp=require(_0xf215('0x4'));var fs=require('fs');var path=require(_0xf215('0x5'));var rimraf=require('rimraf');var config=require(_0xf215('0x6'));var attributes=require(_0xf215('0x7'));module[_0xf215('0x8')]=function(_0x112800,_0x9ddd90){return _0x112800[_0xf215('0x9')](_0xf215('0xa'),attributes,{'tableName':_0xf215('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e56=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations'];(function(_0x125dea,_0xb160c1){var _0x3f612a=function(_0x307677){while(--_0x307677){_0x125dea['push'](_0x125dea['shift']());}};_0x3f612a(++_0xb160c1);}(_0x0e56,0x18c));var _0x60e5=function(_0xeead8a,_0x3d2400){_0xeead8a=_0xeead8a-0x0;var _0x24742c=_0x0e56[_0xeead8a];return _0x24742c;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require(_0x60e5('0x2'))('api');var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module['exports']=function(_0x5a6e4e,_0x40ef55){return _0x5a6e4e[_0x60e5('0x9')](_0x60e5('0xa'),attributes,{'tableName':_0x60e5('0xb'),'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 b737113..2031fa6 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 _0x177a=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3c2efd,_0x405f28){var _0x433b01=function(_0xd9f231){while(--_0xd9f231){_0x3c2efd['push'](_0x3c2efd['shift']());}};_0x433b01(++_0x405f28);}(_0x177a,0xdd));var _0xa177=function(_0x2e4362,_0x39c31b){_0x2e4362=_0x2e4362-0x0;var _0x500526=_0x177a[_0x2e4362];return _0x500526;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa177('0x1'));var rs=require(_0xa177('0x2'));var fs=require('fs');var Redis=require(_0xa177('0x3'));var db=require(_0xa177('0x4'))['db'];var utils=require(_0xa177('0x5'));var logger=require(_0xa177('0x6'))('rpc');var config=require(_0xa177('0x7'));var jayson=require(_0xa177('0x8'));var client=jayson[_0xa177('0x9')][_0xa177('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34b6a7,_0xb27b2,_0x331b53){return new BPromise(function(_0x11a535,_0x55bf0f){return client[_0xa177('0xb')](_0x34b6a7,_0x331b53)['then'](function(_0x2a8a12){logger[_0xa177('0xc')](_0xa177('0xd'),_0xb27b2,_0xa177('0xe'));logger[_0xa177('0xf')](_0xa177('0x10'),_0xb27b2,_0xa177('0xe'),JSON['stringify'](_0x2a8a12));if(_0x2a8a12[_0xa177('0x11')]){if(_0x2a8a12[_0xa177('0x11')][_0xa177('0x12')]===0x1f4){logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);return _0x55bf0f(_0x2a8a12['error']['message']);}logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);return _0x11a535(_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);}else{logger[_0xa177('0xc')](_0xa177('0xd'),_0xb27b2,_0xa177('0xe'));_0x11a535(_0x2a8a12[_0xa177('0x14')][_0xa177('0x13')]);}})[_0xa177('0x15')](function(_0x5445da){logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x5445da);_0x55bf0f(_0x5445da);});});} \ No newline at end of file +var _0xaa9d=['../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','Integration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','rpc'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x68abf8,_0x3ebdff){_0x68abf8=_0x68abf8-0x0;var _0x1051f8=_0xaa9d[_0x68abf8];return _0x1051f8;};'use strict';var _=require(_0xdaa9('0x0'));var util=require(_0xdaa9('0x1'));var moment=require(_0xdaa9('0x2'));var BPromise=require(_0xdaa9('0x3'));var rs=require(_0xdaa9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdaa9('0x5'));var config=require(_0xdaa9('0x6'));var jayson=require(_0xdaa9('0x7'));var client=jayson[_0xdaa9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x548aee,_0x1a77bd,_0x389004){return new BPromise(function(_0x394817,_0x194c11){return client['request'](_0x548aee,_0x389004)[_0xdaa9('0x9')](function(_0x5317f8){logger[_0xdaa9('0xa')]('Integration,\x20%s,\x20%s',_0x1a77bd,_0xdaa9('0xb'));logger[_0xdaa9('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x1a77bd,_0xdaa9('0xb'),JSON[_0xdaa9('0xd')](_0x5317f8));if(_0x5317f8[_0xdaa9('0xe')]){if(_0x5317f8[_0xdaa9('0xe')]['code']===0x1f4){logger['error'](_0xdaa9('0xf'),_0x1a77bd,_0x5317f8[_0xdaa9('0xe')][_0xdaa9('0x10')]);return _0x194c11(_0x5317f8[_0xdaa9('0xe')][_0xdaa9('0x10')]);}logger[_0xdaa9('0xe')](_0xdaa9('0xf'),_0x1a77bd,_0x5317f8[_0xdaa9('0xe')]['message']);return _0x394817(_0x5317f8['error'][_0xdaa9('0x10')]);}else{logger[_0xdaa9('0xa')](_0xdaa9('0xf'),_0x1a77bd,_0xdaa9('0xb'));_0x394817(_0x5317f8['result']['message']);}})[_0xdaa9('0x11')](function(_0x582447){logger['error']('Integration,\x20%s,\x20%s',_0x1a77bd,_0x582447);_0x194c11(_0x582447);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 51561b6..5de8bb0 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 _0x9018=['create','put','/:id','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x1cd327,_0x231dcd){var _0x1056c7=function(_0x5aff5e){while(--_0x5aff5e){_0x1cd327['push'](_0x1cd327['shift']());}};_0x1056c7(++_0x231dcd);}(_0x9018,0xc2));var _0x8901=function(_0x11c160,_0x68b858){_0x11c160=_0x11c160-0x0;var _0x4d5159=_0x9018[_0x11c160];return _0x4d5159;};'use strict';var multer=require(_0x8901('0x0'));var util=require(_0x8901('0x1'));var path=require(_0x8901('0x2'));var timeout=require(_0x8901('0x3'));var express=require(_0x8901('0x4'));var router=express['Router']();var auth=require(_0x8901('0x5'));var interaction=require(_0x8901('0x6'));var config=require(_0x8901('0x7'));var controller=require(_0x8901('0x8'));router[_0x8901('0x9')]('/',auth[_0x8901('0xa')](),controller[_0x8901('0xb')]);router['get'](_0x8901('0xc'),auth[_0x8901('0xa')](),controller[_0x8901('0xd')]);router[_0x8901('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8901('0xe')]('/',auth['isAuthenticated'](),controller[_0x8901('0xf')]);router[_0x8901('0x10')]('/:id',auth[_0x8901('0xa')](),controller['update']);router['delete'](_0x8901('0x11'),auth[_0x8901('0xa')](),controller['destroy']);module[_0x8901('0x12')]=router; \ No newline at end of file +var _0x848a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','path'];(function(_0x1cd1b7,_0x1f68f7){var _0x15ef49=function(_0x308693){while(--_0x308693){_0x1cd1b7['push'](_0x1cd1b7['shift']());}};_0x15ef49(++_0x1f68f7);}(_0x848a,0x1b6));var _0xa848=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x848a[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0xa848('0x0'));var util=require('util');var path=require(_0xa848('0x1'));var timeout=require(_0xa848('0x2'));var express=require(_0xa848('0x3'));var router=express[_0xa848('0x4')]();var auth=require(_0xa848('0x5'));var interaction=require(_0xa848('0x6'));var config=require('../../config/environment');var controller=require(_0xa848('0x7'));router[_0xa848('0x8')]('/',auth[_0xa848('0x9')](),controller[_0xa848('0xa')]);router[_0xa848('0x8')](_0xa848('0xb'),auth[_0xa848('0x9')](),controller[_0xa848('0xc')]);router[_0xa848('0x8')](_0xa848('0xd'),auth[_0xa848('0x9')](),controller[_0xa848('0xe')]);router[_0xa848('0xf')]('/',auth['isAuthenticated'](),controller[_0xa848('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa848('0x11')](_0xa848('0xd'),auth[_0xa848('0x9')](),controller[_0xa848('0x12')]);module[_0xa848('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index fbd6dd3..0ce4663 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 _0x76a0=['BOOLEAN','TEXT','ENUM','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x579f88,_0xb8632d){var _0xcff854=function(_0x5ed35e){while(--_0x5ed35e){_0x579f88['push'](_0x579f88['shift']());}};_0xcff854(++_0xb8632d);}(_0x76a0,0x67));var _0x076a=function(_0x7ecd61,_0x28c775){_0x7ecd61=_0x7ecd61-0x0;var _0x67d35d=_0x76a0[_0x7ecd61];return _0x67d35d;};'use strict';var Sequelize=require(_0x076a('0x0'));module[_0x076a('0x1')]={'integration':{'type':Sequelize[_0x076a('0x2')]},'eventChannel':{'type':Sequelize[_0x076a('0x2')]},'exitStatus':{'type':Sequelize[_0x076a('0x2')]},'ticketId':{'type':Sequelize[_0x076a('0x2')]},'integrationId':{'type':Sequelize[_0x076a('0x3')]},'contacts':{'type':Sequelize[_0x076a('0x2')]},'uniqueid':{'type':Sequelize[_0x076a('0x2')]},'calleridnum':{'type':Sequelize[_0x076a('0x2')]},'calleridname':{'type':Sequelize[_0x076a('0x2')]},'queue':{'type':Sequelize[_0x076a('0x2')]},'interface':{'type':Sequelize[_0x076a('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x076a('0x4')]},'agentconnectAt':{'type':Sequelize[_0x076a('0x4')]},'holdtime':{'type':Sequelize[_0x076a('0x3')]},'agentcomplete':{'type':Sequelize[_0x076a('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x076a('0x4')]},'talktime':{'type':Sequelize[_0x076a('0x3')]},'agentacw':{'type':Sequelize[_0x076a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x076a('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x076a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x076a('0x4')]},'agentdump':{'type':Sequelize[_0x076a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x076a('0x4')]},'lastevent':{'type':Sequelize[_0x076a('0x2')]},'channel':{'type':Sequelize[_0x076a('0x2')]},'channelstate':{'type':Sequelize[_0x076a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x076a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x076a('0x2')]},'connectedlinename':{'type':Sequelize[_0x076a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x076a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x076a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x076a('0x2')]},'destcalleridname':{'type':Sequelize[_0x076a('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x076a('0x2')]},'destlanguage':{'type':Sequelize[_0x076a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x076a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x076a('0x2')]},'inReplyTo':{'type':Sequelize[_0x076a('0x2')]},'subject':{'type':Sequelize[_0x076a('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x076a('0x2')]},'cc':{'type':Sequelize[_0x076a('0x2')]},'attachment':{'type':Sequelize[_0x076a('0x6')]},'html':{'type':Sequelize[_0x076a('0x6')]},'text':{'type':Sequelize[_0x076a('0x6')]},'status':{'type':Sequelize[_0x076a('0x7')]('SENT','SENDING','RECEIVED',_0x076a('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x076a('0x2')]},'appdata':{'type':Sequelize[_0x076a('0x2')]},'projectId':{'type':Sequelize[_0x076a('0x3')]}}; \ No newline at end of file +var _0x4aa2=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','sequelize','exports','STRING'];(function(_0x1ac8fe,_0xc0578f){var _0x4c6db2=function(_0x8f635e){while(--_0x8f635e){_0x1ac8fe['push'](_0x1ac8fe['shift']());}};_0x4c6db2(++_0xc0578f);}(_0x4aa2,0xd9));var _0x24aa=function(_0x4f85c5,_0x517e60){_0x4f85c5=_0x4f85c5-0x0;var _0x46fc5b=_0x4aa2[_0x4f85c5];return _0x46fc5b;};'use strict';var Sequelize=require(_0x24aa('0x0'));module[_0x24aa('0x1')]={'integration':{'type':Sequelize[_0x24aa('0x2')]},'eventChannel':{'type':Sequelize[_0x24aa('0x2')]},'exitStatus':{'type':Sequelize[_0x24aa('0x2')]},'ticketId':{'type':Sequelize[_0x24aa('0x2')]},'integrationId':{'type':Sequelize[_0x24aa('0x3')]},'contacts':{'type':Sequelize[_0x24aa('0x2')]},'uniqueid':{'type':Sequelize[_0x24aa('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x24aa('0x2')]},'queue':{'type':Sequelize[_0x24aa('0x2')]},'interface':{'type':Sequelize[_0x24aa('0x2')]},'membername':{'type':Sequelize[_0x24aa('0x2')]},'agentcalledAt':{'type':Sequelize[_0x24aa('0x4')]},'agentconnectAt':{'type':Sequelize[_0x24aa('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x24aa('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x24aa('0x4')]},'talktime':{'type':Sequelize[_0x24aa('0x3')]},'agentacw':{'type':Sequelize[_0x24aa('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x24aa('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x24aa('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x24aa('0x4')]},'lastevent':{'type':Sequelize[_0x24aa('0x2')]},'channel':{'type':Sequelize[_0x24aa('0x2')]},'channelstate':{'type':Sequelize[_0x24aa('0x3')]},'channelstatedesc':{'type':Sequelize[_0x24aa('0x2')]},'connectedlinenum':{'type':Sequelize[_0x24aa('0x2')]},'connectedlinename':{'type':Sequelize[_0x24aa('0x2')]},'language':{'type':Sequelize[_0x24aa('0x2')]},'accountcode':{'type':Sequelize[_0x24aa('0x2')]},'context':{'type':Sequelize[_0x24aa('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x24aa('0x2')]},'destchannelstate':{'type':Sequelize[_0x24aa('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x24aa('0x2')]},'destcalleridnum':{'type':Sequelize[_0x24aa('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x24aa('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x24aa('0x2')]},'destcontext':{'type':Sequelize[_0x24aa('0x2')]},'destexten':{'type':Sequelize[_0x24aa('0x2')]},'destpriority':{'type':Sequelize[_0x24aa('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x24aa('0x2')]},'inReplyTo':{'type':Sequelize[_0x24aa('0x2')]},'subject':{'type':Sequelize[_0x24aa('0x2')]},'from':{'type':Sequelize[_0x24aa('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x24aa('0x2')]},'attachment':{'type':Sequelize[_0x24aa('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x24aa('0x6')]},'status':{'type':Sequelize['ENUM'](_0x24aa('0x7'),_0x24aa('0x8'),_0x24aa('0x9'),'FAILED')},'url':{'type':Sequelize[_0x24aa('0x2')]},'app':{'type':Sequelize[_0x24aa('0x2')]},'appdata':{'type':Sequelize[_0x24aa('0x2')]},'projectId':{'type':Sequelize[_0x24aa('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 703be23..5b92a5d 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 _0x741d=['name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','count','rows','catch','show','params','keys','includeAll','merge','find','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x741d,0x14b));var _0xd741=function(_0x11279c,_0x37b77d){_0x11279c=_0x11279c-0x0;var _0x127940=_0x741d[_0x11279c];return _0x127940;};'use strict';var pdf=require(_0xd741('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd741('0x1'));var rp=require(_0xd741('0x2'));var moment=require(_0xd741('0x3'));var BPromise=require(_0xd741('0x4'));var Mustache=require(_0xd741('0x5'));var util=require(_0xd741('0x6'));var path=require(_0xd741('0x7'));var sox=require(_0xd741('0x8'));var csv=require(_0xd741('0x9'));var ejs=require(_0xd741('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd741('0xb'));var crypto=require(_0xd741('0xc'));var jsforce=require(_0xd741('0xd'));var deskjs=require(_0xd741('0xe'));var toCsv=require(_0xd741('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd741('0xf'));var authService=require(_0xd741('0x10'));var qs=require(_0xd741('0x11'));var as=require(_0xd741('0x12'));var hardwareService=require(_0xd741('0x13'));var logger=require(_0xd741('0x14'))('api');var utils=require(_0xd741('0x15'));var config=require(_0xd741('0x16'));var licenseUtil=require(_0xd741('0x17'));var db=require(_0xd741('0x18'))['db'];function respondWithStatusCode(_0x1a5ce7,_0x52e911){_0x52e911=_0x52e911||0xcc;return function(_0x367b20){if(_0x367b20){return _0x1a5ce7['sendStatus'](_0x52e911);}return _0x1a5ce7['status'](_0x52e911)['end']();};}function respondWithResult(_0x32bc3f,_0x5b490b){_0x5b490b=_0x5b490b||0xc8;return function(_0x1f40ad){if(_0x1f40ad){return _0x32bc3f[_0xd741('0x19')](_0x5b490b)[_0xd741('0x1a')](_0x1f40ad);}};}function respondWithFilteredResult(_0x47ea5e,_0x49e491){return function(_0x54ea35){if(_0x54ea35){var _0x594cb8=_0x54ea35['count'],_0x21311c=_0x49e491['offset'],_0x143430=_0x49e491[_0xd741('0x1b')]+_0x49e491[_0xd741('0x1c')],_0x121078;if(_0x143430>=_0x594cb8){_0x143430=_0x594cb8;_0x121078=0xc8;}else{_0x121078=0xce;}_0x47ea5e[_0xd741('0x19')](_0x121078);return _0x47ea5e['set'](_0xd741('0x1d'),_0x21311c+'-'+_0x143430+'/'+_0x594cb8)[_0xd741('0x1a')](_0x54ea35);}return null;};}function patchUpdates(_0x74a53b){return function(_0x2f88b6){try{jsonpatch[_0xd741('0x1e')](_0x2f88b6,_0x74a53b,!![]);}catch(_0x416519){return BPromise['reject'](_0x416519);}return _0x2f88b6[_0xd741('0x1f')]();};}function saveUpdates(_0x702326,_0xaa91df){return function(_0xab27af){if(_0xab27af){return _0xab27af[_0xd741('0x20')](_0x702326)[_0xd741('0x21')](function(_0x4c3258){return _0x4c3258;});}return null;};}function removeEntity(_0x3f38ba,_0x141682){return function(_0x5d1543){if(_0x5d1543){return _0x5d1543[_0xd741('0x22')]()[_0xd741('0x21')](function(){_0x3f38ba['status'](0xcc)[_0xd741('0x23')]();});}};}function handleEntityNotFound(_0xb681f2,_0x298964){return function(_0x21cef0){if(!_0x21cef0){_0xb681f2[_0xd741('0x24')](0x194);}return _0x21cef0;};}function handleError(_0x564915,_0xd224a6){_0xd224a6=_0xd224a6||0x1f4;return function(_0x46a9e0){logger[_0xd741('0x25')](_0x46a9e0[_0xd741('0x26')]);if(_0x46a9e0[_0xd741('0x27')]){delete _0x46a9e0['name'];}_0x564915[_0xd741('0x19')](_0xd224a6)[_0xd741('0x28')](_0x46a9e0);};}exports[_0xd741('0x29')]=function(_0x135ef2,_0x1e91ea){var _0x16a149={},_0x2e4136={},_0x3f3f39={'count':0x0,'rows':[]};var _0x46909f=_[_0xd741('0x2a')](db[_0xd741('0x2b')][_0xd741('0x2c')],function(_0x43c13d){return{'name':_0x43c13d[_0xd741('0x2d')],'type':_0x43c13d[_0xd741('0x2e')]['key']};});_0x2e4136[_0xd741('0x2f')]=_['map'](_0x46909f,_0xd741('0x27'));_0x2e4136['query']=_['keys'](_0x135ef2['query']);_0x2e4136[_0xd741('0x30')]=_[_0xd741('0x31')](_0x2e4136[_0xd741('0x2f')],_0x2e4136[_0xd741('0x32')]);_0x16a149['attributes']=_[_0xd741('0x31')](_0x2e4136[_0xd741('0x2f')],qs[_0xd741('0x33')](_0x135ef2[_0xd741('0x32')][_0xd741('0x33')]));_0x16a149[_0xd741('0x34')]=_0x16a149['attributes'][_0xd741('0x35')]?_0x16a149['attributes']:_0x2e4136[_0xd741('0x2f')];if(!_0x135ef2[_0xd741('0x32')][_0xd741('0x36')]('nolimit')){_0x16a149[_0xd741('0x1c')]=qs[_0xd741('0x1c')](_0x135ef2[_0xd741('0x32')]['limit']);_0x16a149[_0xd741('0x1b')]=qs[_0xd741('0x1b')](_0x135ef2[_0xd741('0x32')][_0xd741('0x1b')]);}_0x16a149[_0xd741('0x37')]=qs['sort'](_0x135ef2[_0xd741('0x32')][_0xd741('0x38')]);_0x16a149[_0xd741('0x39')]=qs[_0xd741('0x30')](_[_0xd741('0x3a')](_0x135ef2['query'],_0x2e4136[_0xd741('0x30')]),_0x46909f);if(_0x135ef2[_0xd741('0x32')][_0xd741('0x3b')]){_0x16a149[_0xd741('0x39')]=_['merge'](_0x16a149['where'],{'$or':_[_0xd741('0x2a')](_0x46909f,function(_0x3f97a8){if(_0x3f97a8['type']!==_0xd741('0x3c')){var _0x4e76ce={};_0x4e76ce[_0x3f97a8[_0xd741('0x27')]]={'$like':'%'+_0x135ef2[_0xd741('0x32')]['filter']+'%'};return _0x4e76ce;}})});}_0x16a149=_['merge']({},_0x16a149,_0x135ef2[_0xd741('0x3d')]);var _0x4f564c={'where':_0x16a149['where']};return db[_0xd741('0x2b')][_0xd741('0x3e')](_0x4f564c)[_0xd741('0x21')](function(_0x4571ce){_0x3f3f39[_0xd741('0x3e')]=_0x4571ce;if(_0x135ef2['query']['includeAll']){_0x16a149['include']=[{'all':!![]}];}return db[_0xd741('0x2b')]['findAll'](_0x16a149);})[_0xd741('0x21')](function(_0x221fc4){_0x3f3f39[_0xd741('0x3f')]=_0x221fc4;return _0x3f3f39;})[_0xd741('0x21')](respondWithFilteredResult(_0x1e91ea,_0x16a149))[_0xd741('0x40')](handleError(_0x1e91ea,null));};exports[_0xd741('0x41')]=function(_0x46ef0f,_0x14d755){var _0x3e7a1a={'raw':![],'where':{'id':_0x46ef0f[_0xd741('0x42')]['id']}},_0x21a516={};_0x21a516['model']=_[_0xd741('0x43')](db[_0xd741('0x2b')][_0xd741('0x2c')]);_0x21a516[_0xd741('0x32')]=_[_0xd741('0x43')](_0x46ef0f['query']);_0x21a516[_0xd741('0x30')]=_[_0xd741('0x31')](_0x21a516[_0xd741('0x2f')],_0x21a516[_0xd741('0x32')]);_0x3e7a1a['attributes']=_['intersection'](_0x21a516[_0xd741('0x2f')],qs[_0xd741('0x33')](_0x46ef0f[_0xd741('0x32')][_0xd741('0x33')]));_0x3e7a1a[_0xd741('0x34')]=_0x3e7a1a['attributes'][_0xd741('0x35')]?_0x3e7a1a['attributes']:_0x21a516[_0xd741('0x2f')];if(_0x46ef0f[_0xd741('0x32')][_0xd741('0x44')]){_0x3e7a1a['include']=[{'all':!![]}];}_0x3e7a1a=_[_0xd741('0x45')]({},_0x3e7a1a,_0x46ef0f[_0xd741('0x3d')]);return db['IntegrationReport'][_0xd741('0x46')](_0x3e7a1a)[_0xd741('0x21')](handleEntityNotFound(_0x14d755,null))[_0xd741('0x21')](respondWithResult(_0x14d755,null))[_0xd741('0x40')](handleError(_0x14d755,null));};exports['create']=function(_0x40c5cc,_0x1e994d){return db[_0xd741('0x2b')][_0xd741('0x47')](_0x40c5cc[_0xd741('0x48')],{})['then'](respondWithResult(_0x1e994d,0xc9))[_0xd741('0x40')](handleError(_0x1e994d,null));};exports[_0xd741('0x20')]=function(_0x100fce,_0x2fc4f6){if(_0x100fce['body']['id']){delete _0x100fce['body']['id'];}return db[_0xd741('0x2b')]['find']({'where':{'id':_0x100fce[_0xd741('0x42')]['id']}})[_0xd741('0x21')](handleEntityNotFound(_0x2fc4f6,null))[_0xd741('0x21')](saveUpdates(_0x100fce[_0xd741('0x48')],null))['then'](respondWithResult(_0x2fc4f6,null))[_0xd741('0x40')](handleError(_0x2fc4f6,null));};exports['destroy']=function(_0x59114a,_0x4a553d){return db['IntegrationReport'][_0xd741('0x46')]({'where':{'id':_0x59114a[_0xd741('0x42')]['id']}})[_0xd741('0x21')](handleEntityNotFound(_0x4a553d,null))[_0xd741('0x21')](removeEntity(_0x4a553d,null))[_0xd741('0x40')](handleError(_0x4a553d,null));};exports[_0xd741('0x49')]=function(_0x56e98c,_0x1040d9){return db[_0xd741('0x2b')][_0xd741('0x49')]()[_0xd741('0x21')](respondWithResult(_0x1040d9,null))[_0xd741('0x40')](handleError(_0x1040d9,null));}; \ No newline at end of file +var _0xfa3c=['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','json','offset','apply','reject','update','then','end','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','order','where','pick','filter','VIRTUAL','count','findAll','rows','catch','show','intersection','includeAll','include','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xfa3c,0x85));var _0xcfa3=function(_0x169996,_0x4b59b5){_0x169996=_0x169996-0x0;var _0x28d7e6=_0xfa3c[_0x169996];return _0x28d7e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcfa3('0x0'));var rimraf=require(_0xcfa3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfa3('0x2'));var rp=require(_0xcfa3('0x3'));var moment=require(_0xcfa3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfa3('0x5'));var path=require('path');var sox=require(_0xcfa3('0x6'));var csv=require(_0xcfa3('0x7'));var ejs=require(_0xcfa3('0x8'));var fs=require('fs');var _=require(_0xcfa3('0x9'));var squel=require(_0xcfa3('0xa'));var crypto=require(_0xcfa3('0xb'));var jsforce=require(_0xcfa3('0xc'));var deskjs=require(_0xcfa3('0xd'));var toCsv=require(_0xcfa3('0x7'));var querystring=require(_0xcfa3('0xe'));var Papa=require(_0xcfa3('0xf'));var Redis=require(_0xcfa3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcfa3('0x11'));var as=require(_0xcfa3('0x12'));var hardwareService=require(_0xcfa3('0x13'));var logger=require(_0xcfa3('0x14'))(_0xcfa3('0x15'));var utils=require(_0xcfa3('0x16'));var config=require(_0xcfa3('0x17'));var licenseUtil=require(_0xcfa3('0x18'));var db=require(_0xcfa3('0x19'))['db'];function respondWithStatusCode(_0x48463e,_0x3ec7ad){_0x3ec7ad=_0x3ec7ad||0xcc;return function(_0x5e2511){if(_0x5e2511){return _0x48463e[_0xcfa3('0x1a')](_0x3ec7ad);}return _0x48463e[_0xcfa3('0x1b')](_0x3ec7ad)['end']();};}function respondWithResult(_0x5b16f1,_0x407426){_0x407426=_0x407426||0xc8;return function(_0x4d12c8){if(_0x4d12c8){return _0x5b16f1[_0xcfa3('0x1b')](_0x407426)[_0xcfa3('0x1c')](_0x4d12c8);}};}function respondWithFilteredResult(_0x261749,_0x2f9a17){return function(_0x33270d){if(_0x33270d){var _0x396e47=_0x33270d['count'],_0x4ba7af=_0x2f9a17[_0xcfa3('0x1d')],_0x26cdd3=_0x2f9a17[_0xcfa3('0x1d')]+_0x2f9a17['limit'],_0x373342;if(_0x26cdd3>=_0x396e47){_0x26cdd3=_0x396e47;_0x373342=0xc8;}else{_0x373342=0xce;}_0x261749['status'](_0x373342);return _0x261749['set']('Content-Range',_0x4ba7af+'-'+_0x26cdd3+'/'+_0x396e47)[_0xcfa3('0x1c')](_0x33270d);}return null;};}function patchUpdates(_0x44d828){return function(_0x22d9a3){try{jsonpatch[_0xcfa3('0x1e')](_0x22d9a3,_0x44d828,!![]);}catch(_0x1f24b1){return BPromise[_0xcfa3('0x1f')](_0x1f24b1);}return _0x22d9a3['save']();};}function saveUpdates(_0x4b8b96,_0x4d69cc){return function(_0xf131ac){if(_0xf131ac){return _0xf131ac[_0xcfa3('0x20')](_0x4b8b96)[_0xcfa3('0x21')](function(_0x1b3bcb){return _0x1b3bcb;});}return null;};}function removeEntity(_0x30e5a1,_0xcfeca9){return function(_0x4b411c){if(_0x4b411c){return _0x4b411c['destroy']()[_0xcfa3('0x21')](function(){_0x30e5a1[_0xcfa3('0x1b')](0xcc)[_0xcfa3('0x22')]();});}};}function handleEntityNotFound(_0x59e954,_0x23438b){return function(_0x1ca547){if(!_0x1ca547){_0x59e954['sendStatus'](0x194);}return _0x1ca547;};}function handleError(_0x32a690,_0x214668){_0x214668=_0x214668||0x1f4;return function(_0x5b2389){logger['error'](_0x5b2389[_0xcfa3('0x23')]);if(_0x5b2389[_0xcfa3('0x24')]){delete _0x5b2389[_0xcfa3('0x24')];}_0x32a690['status'](_0x214668)[_0xcfa3('0x25')](_0x5b2389);};}exports[_0xcfa3('0x26')]=function(_0x384cb1,_0x123daa){var _0x26bc9f={},_0x331724={},_0x3d0f68={'count':0x0,'rows':[]};var _0x958cb=_[_0xcfa3('0x27')](db[_0xcfa3('0x28')][_0xcfa3('0x29')],function(_0x4ccae1){return{'name':_0x4ccae1[_0xcfa3('0x2a')],'type':_0x4ccae1['type']['key']};});_0x331724[_0xcfa3('0x2b')]=_['map'](_0x958cb,_0xcfa3('0x24'));_0x331724['query']=_[_0xcfa3('0x2c')](_0x384cb1[_0xcfa3('0x2d')]);_0x331724[_0xcfa3('0x2e')]=_['intersection'](_0x331724[_0xcfa3('0x2b')],_0x331724['query']);_0x26bc9f[_0xcfa3('0x2f')]=_['intersection'](_0x331724['model'],qs['fields'](_0x384cb1[_0xcfa3('0x2d')][_0xcfa3('0x30')]));_0x26bc9f['attributes']=_0x26bc9f[_0xcfa3('0x2f')][_0xcfa3('0x31')]?_0x26bc9f[_0xcfa3('0x2f')]:_0x331724[_0xcfa3('0x2b')];if(!_0x384cb1[_0xcfa3('0x2d')][_0xcfa3('0x32')]('nolimit')){_0x26bc9f[_0xcfa3('0x33')]=qs[_0xcfa3('0x33')](_0x384cb1['query'][_0xcfa3('0x33')]);_0x26bc9f[_0xcfa3('0x1d')]=qs[_0xcfa3('0x1d')](_0x384cb1['query'][_0xcfa3('0x1d')]);}_0x26bc9f[_0xcfa3('0x34')]=qs['sort'](_0x384cb1[_0xcfa3('0x2d')]['sort']);_0x26bc9f[_0xcfa3('0x35')]=qs['filters'](_[_0xcfa3('0x36')](_0x384cb1[_0xcfa3('0x2d')],_0x331724['filters']),_0x958cb);if(_0x384cb1[_0xcfa3('0x2d')][_0xcfa3('0x37')]){_0x26bc9f[_0xcfa3('0x35')]=_['merge'](_0x26bc9f[_0xcfa3('0x35')],{'$or':_[_0xcfa3('0x27')](_0x958cb,function(_0x346894){if(_0x346894['type']!==_0xcfa3('0x38')){var _0x47bf95={};_0x47bf95[_0x346894[_0xcfa3('0x24')]]={'$like':'%'+_0x384cb1[_0xcfa3('0x2d')][_0xcfa3('0x37')]+'%'};return _0x47bf95;}})});}_0x26bc9f=_['merge']({},_0x26bc9f,_0x384cb1['options']);var _0x2d016e={'where':_0x26bc9f[_0xcfa3('0x35')]};return db[_0xcfa3('0x28')][_0xcfa3('0x39')](_0x2d016e)['then'](function(_0x15e535){_0x3d0f68['count']=_0x15e535;if(_0x384cb1[_0xcfa3('0x2d')]['includeAll']){_0x26bc9f['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xcfa3('0x3a')](_0x26bc9f);})['then'](function(_0x3d6571){_0x3d0f68[_0xcfa3('0x3b')]=_0x3d6571;return _0x3d0f68;})[_0xcfa3('0x21')](respondWithFilteredResult(_0x123daa,_0x26bc9f))[_0xcfa3('0x3c')](handleError(_0x123daa,null));};exports[_0xcfa3('0x3d')]=function(_0x5ba3eb,_0x29eff2){var _0x530583={'raw':![],'where':{'id':_0x5ba3eb['params']['id']}},_0x3687d3={};_0x3687d3['model']=_['keys'](db[_0xcfa3('0x28')][_0xcfa3('0x29')]);_0x3687d3[_0xcfa3('0x2d')]=_[_0xcfa3('0x2c')](_0x5ba3eb[_0xcfa3('0x2d')]);_0x3687d3['filters']=_[_0xcfa3('0x3e')](_0x3687d3[_0xcfa3('0x2b')],_0x3687d3[_0xcfa3('0x2d')]);_0x530583['attributes']=_[_0xcfa3('0x3e')](_0x3687d3['model'],qs[_0xcfa3('0x30')](_0x5ba3eb[_0xcfa3('0x2d')][_0xcfa3('0x30')]));_0x530583[_0xcfa3('0x2f')]=_0x530583[_0xcfa3('0x2f')][_0xcfa3('0x31')]?_0x530583[_0xcfa3('0x2f')]:_0x3687d3[_0xcfa3('0x2b')];if(_0x5ba3eb[_0xcfa3('0x2d')][_0xcfa3('0x3f')]){_0x530583[_0xcfa3('0x40')]=[{'all':!![]}];}_0x530583=_['merge']({},_0x530583,_0x5ba3eb['options']);return db[_0xcfa3('0x28')][_0xcfa3('0x41')](_0x530583)[_0xcfa3('0x21')](handleEntityNotFound(_0x29eff2,null))['then'](respondWithResult(_0x29eff2,null))['catch'](handleError(_0x29eff2,null));};exports[_0xcfa3('0x42')]=function(_0x3602d5,_0x192cea){return db[_0xcfa3('0x28')]['create'](_0x3602d5[_0xcfa3('0x43')],{})[_0xcfa3('0x21')](respondWithResult(_0x192cea,0xc9))[_0xcfa3('0x3c')](handleError(_0x192cea,null));};exports[_0xcfa3('0x20')]=function(_0x33dad2,_0x208f85){if(_0x33dad2[_0xcfa3('0x43')]['id']){delete _0x33dad2['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x33dad2[_0xcfa3('0x44')]['id']}})[_0xcfa3('0x21')](handleEntityNotFound(_0x208f85,null))[_0xcfa3('0x21')](saveUpdates(_0x33dad2[_0xcfa3('0x43')],null))['then'](respondWithResult(_0x208f85,null))[_0xcfa3('0x3c')](handleError(_0x208f85,null));};exports[_0xcfa3('0x45')]=function(_0x3d47df,_0x189783){return db[_0xcfa3('0x28')][_0xcfa3('0x41')]({'where':{'id':_0x3d47df[_0xcfa3('0x44')]['id']}})[_0xcfa3('0x21')](handleEntityNotFound(_0x189783,null))[_0xcfa3('0x21')](removeEntity(_0x189783,null))['catch'](handleError(_0x189783,null));};exports[_0xcfa3('0x46')]=function(_0x16eb5b,_0x1eaa1c){return db[_0xcfa3('0x28')]['describe']()[_0xcfa3('0x21')](respondWithResult(_0x1eaa1c,null))[_0xcfa3('0x3c')](handleError(_0x1eaa1c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 27d5ab6..3d619d2 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 _0x68f2=['request-promise','path','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x68f2,0x10f));var _0x268f=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x68f2[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x268f('0x0'));var util=require(_0x268f('0x1'));var logger=require(_0x268f('0x2'))('api');var moment=require(_0x268f('0x3'));var BPromise=require(_0x268f('0x4'));var rp=require(_0x268f('0x5'));var fs=require('fs');var path=require(_0x268f('0x6'));var rimraf=require('rimraf');var config=require(_0x268f('0x7'));var attributes=require(_0x268f('0x8'));module['exports']=function(_0x586094,_0x324289){return _0x586094[_0x268f('0x9')](_0x268f('0xa'),attributes,{'tableName':_0x268f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35db=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','util','../../config/logger','api'];(function(_0x360ef6,_0x3ea364){var _0x452bf3=function(_0x487a64){while(--_0x487a64){_0x360ef6['push'](_0x360ef6['shift']());}};_0x452bf3(++_0x3ea364);}(_0x35db,0x14f));var _0xb35d=function(_0x1bd204,_0x229dc7){_0x1bd204=_0x1bd204-0x0;var _0x1a3c96=_0x35db[_0x1bd204];return _0x1a3c96;};'use strict';var _=require('lodash');var util=require(_0xb35d('0x0'));var logger=require(_0xb35d('0x1'))(_0xb35d('0x2'));var moment=require(_0xb35d('0x3'));var BPromise=require(_0xb35d('0x4'));var rp=require(_0xb35d('0x5'));var fs=require('fs');var path=require(_0xb35d('0x6'));var rimraf=require(_0xb35d('0x7'));var config=require(_0xb35d('0x8'));var attributes=require(_0xb35d('0x9'));module[_0xb35d('0xa')]=function(_0x1561fa,_0x59d5a9){return _0x1561fa[_0xb35d('0xb')]('IntegrationReport',attributes,{'tableName':_0xb35d('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 e7915d4..11fd6b3 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 _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x36bc39,_0x10f411){_0x36bc39=_0x36bc39-0x0;var _0x5b2c41=_0xac4a[_0x36bc39];return _0x5b2c41;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8603,0x190));var _0x3860=function(_0x28193e,_0x5427ec){_0x28193e=_0x28193e-0x0;var _0x49764e=_0x8603[_0x28193e];return _0x49764e;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a55195a..d1a7be3 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 _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x3bbb66,_0x350afb){var _0x362682=function(_0x19e244){while(--_0x19e244){_0x3bbb66['push'](_0x3bbb66['shift']());}};_0x362682(++_0x350afb);}(_0xedd9,0xfc));var _0x9edd=function(_0x336672,_0x5ea14b){_0x336672=_0x336672-0x0;var _0x126dbf=_0xedd9[_0x336672];return _0x126dbf;};'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 auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3d68aed..970af66 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 _0x5f08=['exports','STRING','sequelize'];(function(_0x4572c7,_0x49785c){var _0x573aa1=function(_0x35c846){while(--_0x35c846){_0x4572c7['push'](_0x4572c7['shift']());}};_0x573aa1(++_0x49785c);}(_0x5f08,0xce));var _0x85f0=function(_0x53502f,_0x5bfc94){_0x53502f=_0x53502f-0x0;var _0xd045d2=_0x5f08[_0x53502f];return _0xd045d2;};'use strict';var Sequelize=require(_0x85f0('0x0'));module[_0x85f0('0x1')]={'name':{'type':Sequelize[_0x85f0('0x2')]},'description':{'type':Sequelize[_0x85f0('0x2')]},'interval':{'type':Sequelize[_0x85f0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc07a=['STRING','sequelize'];(function(_0xea6c20,_0x5a0de8){var _0x458655=function(_0x4afe96){while(--_0x4afe96){_0xea6c20['push'](_0xea6c20['shift']());}};_0x458655(++_0x5a0de8);}(_0xc07a,0x17b));var _0xac07=function(_0xe46818,_0x5125b5){_0xe46818=_0xe46818-0x0;var _0xd2fb1e=_0xc07a[_0xe46818];return _0xd2fb1e;};'use strict';var Sequelize=require(_0xac07('0x0'));module['exports']={'name':{'type':Sequelize[_0xac07('0x1')]},'description':{'type':Sequelize[_0xac07('0x1')]},'interval':{'type':Sequelize[_0xac07('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 8e5bacb..ec51828 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 _0x9d67=['filter','VIRTUAL','options','includeAll','include','findAll','catch','show','length','merge','create','body','user','Intervals','UserProfileSection','find','userProfileId','autoAssociation','params','IntervalId','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','count','offset','limit','set','json','reject','update','then','destroy','get','UserProfileResource','name','send','index','map','Interval','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x54b953,_0x2ecafb){var _0x116f72=function(_0x9aac97){while(--_0x9aac97){_0x54b953['push'](_0x54b953['shift']());}};_0x116f72(++_0x2ecafb);}(_0x9d67,0x10c));var _0x79d6=function(_0x3b8543,_0xf89559){_0x3b8543=_0x3b8543-0x0;var _0x24a816=_0x9d67[_0x3b8543];return _0x24a816;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x79d6('0x0'));var rimraf=require(_0x79d6('0x1'));var zipdir=require(_0x79d6('0x2'));var jsonpatch=require(_0x79d6('0x3'));var rp=require(_0x79d6('0x4'));var moment=require(_0x79d6('0x5'));var BPromise=require(_0x79d6('0x6'));var Mustache=require(_0x79d6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x79d6('0x8'));var ejs=require(_0x79d6('0x9'));var fs=require('fs');var _=require(_0x79d6('0xa'));var squel=require(_0x79d6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x79d6('0x8'));var querystring=require(_0x79d6('0xc'));var Papa=require(_0x79d6('0xd'));var Redis=require(_0x79d6('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x79d6('0xf'));var hardwareService=require(_0x79d6('0x10'));var logger=require(_0x79d6('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x79d6('0x12'));var licenseUtil=require(_0x79d6('0x13'));var db=require(_0x79d6('0x14'))['db'];var extensions=require(_0x79d6('0x15'));function respondWithStatusCode(_0x13d3e6,_0x19bbb0){_0x19bbb0=_0x19bbb0||0xcc;return function(_0x79bfa5){if(_0x79bfa5){return _0x13d3e6[_0x79d6('0x16')](_0x19bbb0);}return _0x13d3e6['status'](_0x19bbb0)[_0x79d6('0x17')]();};}function respondWithResult(_0x2df4ac,_0x307823){_0x307823=_0x307823||0xc8;return function(_0x264b64){if(_0x264b64){return _0x2df4ac[_0x79d6('0x18')](_0x307823)['json'](_0x264b64);}};}function respondWithFilteredResult(_0x5e3084,_0x54c6e4){return function(_0x5423d1){if(_0x5423d1){var _0x11c877=_0x5423d1[_0x79d6('0x19')],_0x57548a=_0x54c6e4[_0x79d6('0x1a')],_0x2a4523=_0x54c6e4[_0x79d6('0x1a')]+_0x54c6e4[_0x79d6('0x1b')],_0x27d8b9;if(_0x2a4523>=_0x11c877){_0x2a4523=_0x11c877;_0x27d8b9=0xc8;}else{_0x27d8b9=0xce;}_0x5e3084['status'](_0x27d8b9);return _0x5e3084[_0x79d6('0x1c')]('Content-Range',_0x57548a+'-'+_0x2a4523+'/'+_0x11c877)[_0x79d6('0x1d')](_0x5423d1);}return null;};}function patchUpdates(_0x17eb46){return function(_0x5bab50){try{jsonpatch['apply'](_0x5bab50,_0x17eb46,!![]);}catch(_0x321551){return BPromise[_0x79d6('0x1e')](_0x321551);}return _0x5bab50['save']();};}function saveUpdates(_0x270bc0,_0x11fd14){return function(_0x120535){if(_0x120535){return _0x120535[_0x79d6('0x1f')](_0x270bc0)[_0x79d6('0x20')](function(_0x4fcc1d){return _0x4fcc1d;});}return null;};}function removeEntity(_0x536f61,_0x15cf9f){return function(_0x2eb96c){if(_0x2eb96c){return _0x2eb96c[_0x79d6('0x21')]()[_0x79d6('0x20')](function(){var _0xa68fc5=_0x2eb96c[_0x79d6('0x22')]({'plain':!![]});var _0x118a1e='Intervals';return db[_0x79d6('0x23')][_0x79d6('0x21')]({'where':{'type':_0x118a1e,'resourceId':_0xa68fc5['id']}})[_0x79d6('0x20')](function(){return _0x2eb96c;});})[_0x79d6('0x20')](function(){_0x536f61[_0x79d6('0x18')](0xcc)[_0x79d6('0x17')]();});}};}function handleEntityNotFound(_0x305855,_0x29ddaa){return function(_0x5a406f){if(!_0x5a406f){_0x305855[_0x79d6('0x16')](0x194);}return _0x5a406f;};}function handleError(_0xe92bb2,_0x43865a){_0x43865a=_0x43865a||0x1f4;return function(_0x4d742e){logger['error'](_0x4d742e['stack']);if(_0x4d742e[_0x79d6('0x24')]){delete _0x4d742e[_0x79d6('0x24')];}_0xe92bb2[_0x79d6('0x18')](_0x43865a)[_0x79d6('0x25')](_0x4d742e);};}exports[_0x79d6('0x26')]=function(_0x3b8160,_0x4d7ce0){var _0x5979ef={},_0x805904={},_0x119375={'count':0x0,'rows':[]};var _0x5e9864=_[_0x79d6('0x27')](db[_0x79d6('0x28')][_0x79d6('0x29')],function(_0x157ef1){return{'name':_0x157ef1['fieldName'],'type':_0x157ef1[_0x79d6('0x2a')]['key']};});_0x805904[_0x79d6('0x2b')]=_[_0x79d6('0x27')](_0x5e9864,_0x79d6('0x24'));_0x805904[_0x79d6('0x2c')]=_[_0x79d6('0x2d')](_0x3b8160['query']);_0x805904['filters']=_[_0x79d6('0x2e')](_0x805904[_0x79d6('0x2b')],_0x805904[_0x79d6('0x2c')]);_0x5979ef[_0x79d6('0x2f')]=_[_0x79d6('0x2e')](_0x805904[_0x79d6('0x2b')],qs[_0x79d6('0x30')](_0x3b8160[_0x79d6('0x2c')]['fields']));_0x5979ef['attributes']=_0x5979ef[_0x79d6('0x2f')]['length']?_0x5979ef[_0x79d6('0x2f')]:_0x805904[_0x79d6('0x2b')];if(!_0x3b8160[_0x79d6('0x2c')][_0x79d6('0x31')](_0x79d6('0x32'))){_0x5979ef['limit']=qs[_0x79d6('0x1b')](_0x3b8160[_0x79d6('0x2c')][_0x79d6('0x1b')]);_0x5979ef[_0x79d6('0x1a')]=qs[_0x79d6('0x1a')](_0x3b8160[_0x79d6('0x2c')][_0x79d6('0x1a')]);}_0x5979ef[_0x79d6('0x33')]=qs[_0x79d6('0x34')](_0x3b8160['query'][_0x79d6('0x34')]);_0x5979ef[_0x79d6('0x35')]=qs[_0x79d6('0x36')](_[_0x79d6('0x37')](_0x3b8160['query'],_0x805904[_0x79d6('0x36')]),_0x5e9864);if(_0x3b8160[_0x79d6('0x2c')][_0x79d6('0x38')]){_0x5979ef[_0x79d6('0x35')]=_['merge'](_0x5979ef[_0x79d6('0x35')],{'$or':_[_0x79d6('0x27')](_0x5e9864,function(_0x393181){if(_0x393181[_0x79d6('0x2a')]!==_0x79d6('0x39')){var _0x54da76={};_0x54da76[_0x393181[_0x79d6('0x24')]]={'$like':'%'+_0x3b8160[_0x79d6('0x2c')][_0x79d6('0x38')]+'%'};return _0x54da76;}})});}_0x5979ef=_['merge']({},_0x5979ef,_0x3b8160[_0x79d6('0x3a')]);var _0x211804={'where':_0x5979ef[_0x79d6('0x35')]};return db[_0x79d6('0x28')]['count'](_0x211804)[_0x79d6('0x20')](function(_0x177d88){_0x119375['count']=_0x177d88;if(_0x3b8160[_0x79d6('0x2c')][_0x79d6('0x3b')]){_0x5979ef[_0x79d6('0x3c')]=[{'all':!![]}];}return db[_0x79d6('0x28')][_0x79d6('0x3d')](_0x5979ef);})['then'](function(_0x2291b0){_0x119375['rows']=_0x2291b0;return _0x119375;})[_0x79d6('0x20')](respondWithFilteredResult(_0x4d7ce0,_0x5979ef))[_0x79d6('0x3e')](handleError(_0x4d7ce0,null));};exports[_0x79d6('0x3f')]=function(_0xab1b8c,_0x2c3dd3){var _0x1c920d={'raw':!![],'where':{'id':_0xab1b8c['params']['id']}},_0x20e611={};_0x20e611[_0x79d6('0x2b')]=_[_0x79d6('0x2d')](db[_0x79d6('0x28')][_0x79d6('0x29')]);_0x20e611[_0x79d6('0x2c')]=_['keys'](_0xab1b8c[_0x79d6('0x2c')]);_0x20e611[_0x79d6('0x36')]=_[_0x79d6('0x2e')](_0x20e611[_0x79d6('0x2b')],_0x20e611['query']);_0x1c920d[_0x79d6('0x2f')]=_[_0x79d6('0x2e')](_0x20e611['model'],qs[_0x79d6('0x30')](_0xab1b8c['query'][_0x79d6('0x30')]));_0x1c920d[_0x79d6('0x2f')]=_0x1c920d[_0x79d6('0x2f')][_0x79d6('0x40')]?_0x1c920d[_0x79d6('0x2f')]:_0x20e611[_0x79d6('0x2b')];if(_0xab1b8c['query']['includeAll']){_0x1c920d[_0x79d6('0x3c')]=[{'all':!![]}];}_0x1c920d=_[_0x79d6('0x41')]({},_0x1c920d,_0xab1b8c[_0x79d6('0x3a')]);return db['Interval']['find'](_0x1c920d)['then'](handleEntityNotFound(_0x2c3dd3,null))[_0x79d6('0x20')](respondWithResult(_0x2c3dd3,null))['catch'](handleError(_0x2c3dd3,null));};exports[_0x79d6('0x42')]=function(_0x1d6bca,_0x113d61){return db[_0x79d6('0x28')][_0x79d6('0x42')](_0x1d6bca[_0x79d6('0x43')],{})[_0x79d6('0x20')](function(_0x125a0f){var _0x1173fa=_0x1d6bca[_0x79d6('0x44')]['get']({'plain':!![]});if(!_0x1173fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1173fa['role']===_0x79d6('0x44')){var _0x4165d4=_0x125a0f[_0x79d6('0x22')]({'plain':!![]});var _0x2e316b=_0x79d6('0x45');return db[_0x79d6('0x46')][_0x79d6('0x47')]({'where':{'name':_0x2e316b,'userProfileId':_0x1173fa[_0x79d6('0x48')]},'raw':!![]})[_0x79d6('0x20')](function(_0x361d5a){if(_0x361d5a&&_0x361d5a[_0x79d6('0x49')]===0x0){return db[_0x79d6('0x23')]['create']({'name':_0x4165d4['name'],'resourceId':_0x4165d4['id'],'type':_0x361d5a[_0x79d6('0x24')],'sectionId':_0x361d5a['id']},{})['then'](function(){return _0x125a0f;});}else{return _0x125a0f;}})[_0x79d6('0x3e')](function(_0xc45cf8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc45cf8);throw _0xc45cf8;});}return _0x125a0f;})['then'](respondWithResult(_0x113d61,0xc9))[_0x79d6('0x3e')](handleError(_0x113d61,null));};exports[_0x79d6('0x1f')]=function(_0x2d9e8a,_0x359fd6){if(_0x2d9e8a[_0x79d6('0x43')]['id']){delete _0x2d9e8a['body']['id'];}return db[_0x79d6('0x28')][_0x79d6('0x47')]({'where':{'id':_0x2d9e8a[_0x79d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x359fd6,null))['then'](saveUpdates(_0x2d9e8a[_0x79d6('0x43')],null))[_0x79d6('0x20')](respondWithResult(_0x359fd6,null))[_0x79d6('0x3e')](handleError(_0x359fd6,null));};exports['destroy']=function(_0x1419d4,_0x21d426){return db['Interval'][_0x79d6('0x47')]({'where':{'id':_0x1419d4[_0x79d6('0x4a')]['id']}})[_0x79d6('0x20')](handleEntityNotFound(_0x21d426,null))['then'](removeEntity(_0x21d426,null))[_0x79d6('0x3e')](handleError(_0x21d426,null));};exports['addInterval']=function(_0x190a26,_0xdd28b4,_0x5b605b){if(_0x190a26[_0x79d6('0x43')]['id']){delete _0x190a26['body']['id'];}return db['Interval'][_0x79d6('0x47')]({'where':{'id':_0x190a26['params']['id']}})[_0x79d6('0x20')](handleEntityNotFound(_0xdd28b4,null))[_0x79d6('0x20')](function(_0x27b4b5){if(_0x27b4b5){_0x190a26[_0x79d6('0x43')][_0x79d6('0x4b')]=_0x27b4b5['id'];return db[_0x79d6('0x28')]['create'](_0x190a26[_0x79d6('0x43')]);}})[_0x79d6('0x20')](respondWithResult(_0xdd28b4,null))[_0x79d6('0x3e')](handleError(_0xdd28b4,null));};exports['getIntervals']=function(_0x294159,_0x1554a5,_0x40774d){var _0x10ec7c={};var _0x1e16ed={};var _0x46ab76;var _0x452a46;return db[_0x79d6('0x28')]['findOne']({'where':{'id':_0x294159['params']['id']}})['then'](handleEntityNotFound(_0x1554a5,null))[_0x79d6('0x20')](function(_0x1854fc){if(_0x1854fc){_0x46ab76=_0x1854fc;_0x1e16ed[_0x79d6('0x2b')]=_[_0x79d6('0x2d')](db['Interval'][_0x79d6('0x29')]);_0x1e16ed[_0x79d6('0x2c')]=_['keys'](_0x294159['query']);_0x1e16ed[_0x79d6('0x36')]=_['intersection'](_0x1e16ed[_0x79d6('0x2b')],_0x1e16ed['query']);_0x10ec7c[_0x79d6('0x2f')]=_['intersection'](_0x1e16ed[_0x79d6('0x2b')],qs[_0x79d6('0x30')](_0x294159[_0x79d6('0x2c')][_0x79d6('0x30')]));_0x10ec7c[_0x79d6('0x2f')]=_0x10ec7c['attributes'][_0x79d6('0x40')]?_0x10ec7c[_0x79d6('0x2f')]:_0x1e16ed['model'];_0x10ec7c['order']=qs['sort'](_0x294159[_0x79d6('0x2c')][_0x79d6('0x34')]);_0x10ec7c[_0x79d6('0x35')]=qs[_0x79d6('0x36')](_[_0x79d6('0x37')](_0x294159[_0x79d6('0x2c')],_0x1e16ed[_0x79d6('0x36')]));if(_0x294159['query'][_0x79d6('0x38')]){_0x10ec7c['where']=_[_0x79d6('0x41')](_0x10ec7c[_0x79d6('0x35')],{'$or':_['map'](_0x10ec7c[_0x79d6('0x2f')],function(_0x50e4ec){var _0x36cdd7={};_0x36cdd7[_0x50e4ec]={'$like':'%'+_0x294159[_0x79d6('0x2c')][_0x79d6('0x38')]+'%'};return _0x36cdd7;})});}_0x10ec7c=_['merge']({},_0x10ec7c,_0x294159[_0x79d6('0x3a')]);return _0x46ab76['getIntervals'](_0x10ec7c);}})['then'](function(_0x4be633){if(_0x4be633){_0x452a46=_0x4be633[_0x79d6('0x40')];if(!_0x294159[_0x79d6('0x2c')][_0x79d6('0x31')](_0x79d6('0x32'))){_0x10ec7c[_0x79d6('0x1b')]=qs[_0x79d6('0x1b')](_0x294159[_0x79d6('0x2c')][_0x79d6('0x1b')]);_0x10ec7c[_0x79d6('0x1a')]=qs['offset'](_0x294159[_0x79d6('0x2c')][_0x79d6('0x1a')]);}return _0x46ab76[_0x79d6('0x4c')](_0x10ec7c);}})[_0x79d6('0x20')](function(_0x88d274){if(_0x88d274){return _0x88d274?{'count':_0x452a46,'rows':_0x88d274}:null;}})['then'](respondWithResult(_0x1554a5,null))[_0x79d6('0x3e')](handleError(_0x1554a5,null));};exports[_0x79d6('0x4d')]=function(_0x131cc9,_0x5a0d36,_0xf9bd3){return db[_0x79d6('0x28')]['findOne']({'where':{'id':_0x131cc9[_0x79d6('0x4a')]['id']}})[_0x79d6('0x20')](handleEntityNotFound(_0x5a0d36,null))[_0x79d6('0x20')](function(_0xb8b424){if(_0xb8b424){return db[_0x79d6('0x4e')][_0x79d6('0x4f')](function(_0xd7299){return db[_0x79d6('0x28')]['destroy']({'where':{'IntervalId':_0x131cc9['params']['id']},'transaction':_0xd7299})[_0x79d6('0x20')](function(_0x288a79){var _0x134529=_[_0x79d6('0x27')](_0x131cc9[_0x79d6('0x43')],function(_0x3d1d9d){delete _0x3d1d9d['id'];_0x3d1d9d[_0x79d6('0x4b')]=_0x131cc9['params']['id'];return _0x3d1d9d;});return db[_0x79d6('0x28')][_0x79d6('0x50')](_0x134529,{'transaction':_0xd7299});});})[_0x79d6('0x20')](function(){return db[_0x79d6('0x28')][_0x79d6('0x3d')]({'where':{'IntervalId':_0x131cc9[_0x79d6('0x4a')]['id']}});});}})[_0x79d6('0x20')](respondWithResult(_0x5a0d36,null))[_0x79d6('0x3e')](handleError(_0x5a0d36,null));}; \ No newline at end of file +var _0xd0aa=['IntervalId','getIntervals','findOne','pick','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','json','count','offset','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xb47ef4,_0x5ab58d){var _0x3e7cb7=function(_0x26263f){while(--_0x26263f){_0xb47ef4['push'](_0xb47ef4['shift']());}};_0x3e7cb7(++_0x5ab58d);}(_0xd0aa,0x11a));var _0xad0a=function(_0x42c7df,_0x23bd1f){_0x42c7df=_0x42c7df-0x0;var _0x248542=_0xd0aa[_0x42c7df];return _0x248542;};'use strict';var pdf=require(_0xad0a('0x0'));var emlformat=require(_0xad0a('0x1'));var rimraf=require(_0xad0a('0x2'));var zipdir=require(_0xad0a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad0a('0x4'));var moment=require('moment');var BPromise=require(_0xad0a('0x5'));var Mustache=require(_0xad0a('0x6'));var util=require(_0xad0a('0x7'));var path=require(_0xad0a('0x8'));var sox=require(_0xad0a('0x9'));var csv=require(_0xad0a('0xa'));var ejs=require(_0xad0a('0xb'));var fs=require('fs');var _=require(_0xad0a('0xc'));var squel=require(_0xad0a('0xd'));var crypto=require('crypto');var jsforce=require(_0xad0a('0xe'));var deskjs=require(_0xad0a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad0a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad0a('0x11'));var as=require(_0xad0a('0x12'));var hardwareService=require(_0xad0a('0x13'));var logger=require(_0xad0a('0x14'))(_0xad0a('0x15'));var utils=require(_0xad0a('0x16'));var config=require(_0xad0a('0x17'));var licenseUtil=require(_0xad0a('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0xad0a('0x19'));function respondWithStatusCode(_0x4f1bf4,_0xb60043){_0xb60043=_0xb60043||0xcc;return function(_0x2905e1){if(_0x2905e1){return _0x4f1bf4['sendStatus'](_0xb60043);}return _0x4f1bf4[_0xad0a('0x1a')](_0xb60043)['end']();};}function respondWithResult(_0x3ddf1f,_0x452bb8){_0x452bb8=_0x452bb8||0xc8;return function(_0xbfe4cc){if(_0xbfe4cc){return _0x3ddf1f['status'](_0x452bb8)[_0xad0a('0x1b')](_0xbfe4cc);}};}function respondWithFilteredResult(_0x453bc1,_0x1b5942){return function(_0x4ea548){if(_0x4ea548){var _0x412a36=_0x4ea548[_0xad0a('0x1c')],_0x564aa4=_0x1b5942[_0xad0a('0x1d')],_0x39f670=_0x1b5942[_0xad0a('0x1d')]+_0x1b5942['limit'],_0x146766;if(_0x39f670>=_0x412a36){_0x39f670=_0x412a36;_0x146766=0xc8;}else{_0x146766=0xce;}_0x453bc1[_0xad0a('0x1a')](_0x146766);return _0x453bc1['set'](_0xad0a('0x1e'),_0x564aa4+'-'+_0x39f670+'/'+_0x412a36)[_0xad0a('0x1b')](_0x4ea548);}return null;};}function patchUpdates(_0x4c49c0){return function(_0x557243){try{jsonpatch[_0xad0a('0x1f')](_0x557243,_0x4c49c0,!![]);}catch(_0x165724){return BPromise[_0xad0a('0x20')](_0x165724);}return _0x557243[_0xad0a('0x21')]();};}function saveUpdates(_0x58a334,_0x1f173b){return function(_0x55b9df){if(_0x55b9df){return _0x55b9df[_0xad0a('0x22')](_0x58a334)['then'](function(_0x4e90f7){return _0x4e90f7;});}return null;};}function removeEntity(_0x500158,_0x1af1a1){return function(_0x1d590c){if(_0x1d590c){return _0x1d590c['destroy']()[_0xad0a('0x23')](function(){var _0xaf0d7=_0x1d590c['get']({'plain':!![]});var _0x3179d3=_0xad0a('0x24');return db[_0xad0a('0x25')][_0xad0a('0x26')]({'where':{'type':_0x3179d3,'resourceId':_0xaf0d7['id']}})[_0xad0a('0x23')](function(){return _0x1d590c;});})[_0xad0a('0x23')](function(){_0x500158[_0xad0a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf2a328,_0x1c3ca1){return function(_0x581692){if(!_0x581692){_0xf2a328['sendStatus'](0x194);}return _0x581692;};}function handleError(_0x26d71d,_0x23b863){_0x23b863=_0x23b863||0x1f4;return function(_0x310294){logger[_0xad0a('0x27')](_0x310294[_0xad0a('0x28')]);if(_0x310294['name']){delete _0x310294[_0xad0a('0x29')];}_0x26d71d['status'](_0x23b863)[_0xad0a('0x2a')](_0x310294);};}exports[_0xad0a('0x2b')]=function(_0x17e16d,_0x58c1a6){var _0x41635f={},_0x211168={},_0x527f68={'count':0x0,'rows':[]};var _0x4b839d=_[_0xad0a('0x2c')](db[_0xad0a('0x2d')][_0xad0a('0x2e')],function(_0x44e574){return{'name':_0x44e574['fieldName'],'type':_0x44e574[_0xad0a('0x2f')][_0xad0a('0x30')]};});_0x211168[_0xad0a('0x31')]=_[_0xad0a('0x2c')](_0x4b839d,_0xad0a('0x29'));_0x211168[_0xad0a('0x32')]=_['keys'](_0x17e16d[_0xad0a('0x32')]);_0x211168[_0xad0a('0x33')]=_['intersection'](_0x211168[_0xad0a('0x31')],_0x211168[_0xad0a('0x32')]);_0x41635f['attributes']=_[_0xad0a('0x34')](_0x211168[_0xad0a('0x31')],qs[_0xad0a('0x35')](_0x17e16d[_0xad0a('0x32')][_0xad0a('0x35')]));_0x41635f['attributes']=_0x41635f[_0xad0a('0x36')]['length']?_0x41635f[_0xad0a('0x36')]:_0x211168['model'];if(!_0x17e16d['query']['hasOwnProperty'](_0xad0a('0x37'))){_0x41635f[_0xad0a('0x38')]=qs[_0xad0a('0x38')](_0x17e16d[_0xad0a('0x32')][_0xad0a('0x38')]);_0x41635f[_0xad0a('0x1d')]=qs['offset'](_0x17e16d[_0xad0a('0x32')][_0xad0a('0x1d')]);}_0x41635f[_0xad0a('0x39')]=qs['sort'](_0x17e16d['query'][_0xad0a('0x3a')]);_0x41635f[_0xad0a('0x3b')]=qs[_0xad0a('0x33')](_['pick'](_0x17e16d[_0xad0a('0x32')],_0x211168[_0xad0a('0x33')]),_0x4b839d);if(_0x17e16d[_0xad0a('0x32')][_0xad0a('0x3c')]){_0x41635f[_0xad0a('0x3b')]=_[_0xad0a('0x3d')](_0x41635f[_0xad0a('0x3b')],{'$or':_[_0xad0a('0x2c')](_0x4b839d,function(_0x4015f3){if(_0x4015f3[_0xad0a('0x2f')]!==_0xad0a('0x3e')){var _0x2487bc={};_0x2487bc[_0x4015f3[_0xad0a('0x29')]]={'$like':'%'+_0x17e16d[_0xad0a('0x32')][_0xad0a('0x3c')]+'%'};return _0x2487bc;}})});}_0x41635f=_[_0xad0a('0x3d')]({},_0x41635f,_0x17e16d[_0xad0a('0x3f')]);var _0x9942d9={'where':_0x41635f['where']};return db[_0xad0a('0x2d')][_0xad0a('0x1c')](_0x9942d9)['then'](function(_0x37af1b){_0x527f68[_0xad0a('0x1c')]=_0x37af1b;if(_0x17e16d[_0xad0a('0x32')][_0xad0a('0x40')]){_0x41635f[_0xad0a('0x41')]=[{'all':!![]}];}return db[_0xad0a('0x2d')][_0xad0a('0x42')](_0x41635f);})[_0xad0a('0x23')](function(_0x24ee61){_0x527f68[_0xad0a('0x43')]=_0x24ee61;return _0x527f68;})[_0xad0a('0x23')](respondWithFilteredResult(_0x58c1a6,_0x41635f))[_0xad0a('0x44')](handleError(_0x58c1a6,null));};exports['show']=function(_0x2ca027,_0x3e7ab4){var _0x2f7499={'raw':!![],'where':{'id':_0x2ca027[_0xad0a('0x45')]['id']}},_0x373568={};_0x373568[_0xad0a('0x31')]=_['keys'](db[_0xad0a('0x2d')][_0xad0a('0x2e')]);_0x373568[_0xad0a('0x32')]=_[_0xad0a('0x46')](_0x2ca027['query']);_0x373568[_0xad0a('0x33')]=_[_0xad0a('0x34')](_0x373568['model'],_0x373568[_0xad0a('0x32')]);_0x2f7499[_0xad0a('0x36')]=_[_0xad0a('0x34')](_0x373568['model'],qs[_0xad0a('0x35')](_0x2ca027['query']['fields']));_0x2f7499[_0xad0a('0x36')]=_0x2f7499['attributes'][_0xad0a('0x47')]?_0x2f7499[_0xad0a('0x36')]:_0x373568['model'];if(_0x2ca027['query'][_0xad0a('0x40')]){_0x2f7499['include']=[{'all':!![]}];}_0x2f7499=_[_0xad0a('0x3d')]({},_0x2f7499,_0x2ca027['options']);return db['Interval'][_0xad0a('0x48')](_0x2f7499)[_0xad0a('0x23')](handleEntityNotFound(_0x3e7ab4,null))[_0xad0a('0x23')](respondWithResult(_0x3e7ab4,null))['catch'](handleError(_0x3e7ab4,null));};exports[_0xad0a('0x49')]=function(_0x21b489,_0x52c3ff){return db[_0xad0a('0x2d')][_0xad0a('0x49')](_0x21b489[_0xad0a('0x4a')],{})[_0xad0a('0x23')](function(_0x1911ee){var _0x2e0ed1=_0x21b489[_0xad0a('0x4b')]['get']({'plain':!![]});if(!_0x2e0ed1)throw new Error(_0xad0a('0x4c'));if(_0x2e0ed1[_0xad0a('0x4d')]==='user'){var _0x4367f1=_0x1911ee[_0xad0a('0x4e')]({'plain':!![]});var _0x4e826b=_0xad0a('0x24');return db[_0xad0a('0x4f')][_0xad0a('0x48')]({'where':{'name':_0x4e826b,'userProfileId':_0x2e0ed1[_0xad0a('0x50')]},'raw':!![]})['then'](function(_0x5184fa){if(_0x5184fa&&_0x5184fa['autoAssociation']===0x0){return db[_0xad0a('0x25')][_0xad0a('0x49')]({'name':_0x4367f1[_0xad0a('0x29')],'resourceId':_0x4367f1['id'],'type':_0x5184fa[_0xad0a('0x29')],'sectionId':_0x5184fa['id']},{})[_0xad0a('0x23')](function(){return _0x1911ee;});}else{return _0x1911ee;}})['catch'](function(_0x5a0ae6){logger[_0xad0a('0x27')](_0xad0a('0x51'),_0x5a0ae6);throw _0x5a0ae6;});}return _0x1911ee;})[_0xad0a('0x23')](respondWithResult(_0x52c3ff,0xc9))[_0xad0a('0x44')](handleError(_0x52c3ff,null));};exports[_0xad0a('0x22')]=function(_0x383934,_0x5b94ce){if(_0x383934[_0xad0a('0x4a')]['id']){delete _0x383934[_0xad0a('0x4a')]['id'];}return db[_0xad0a('0x2d')][_0xad0a('0x48')]({'where':{'id':_0x383934[_0xad0a('0x45')]['id']}})[_0xad0a('0x23')](handleEntityNotFound(_0x5b94ce,null))[_0xad0a('0x23')](saveUpdates(_0x383934[_0xad0a('0x4a')],null))[_0xad0a('0x23')](respondWithResult(_0x5b94ce,null))['catch'](handleError(_0x5b94ce,null));};exports[_0xad0a('0x26')]=function(_0x416bde,_0x1807f7){return db['Interval'][_0xad0a('0x48')]({'where':{'id':_0x416bde[_0xad0a('0x45')]['id']}})[_0xad0a('0x23')](handleEntityNotFound(_0x1807f7,null))[_0xad0a('0x23')](removeEntity(_0x1807f7,null))['catch'](handleError(_0x1807f7,null));};exports['addInterval']=function(_0x407b83,_0x226194,_0x1abdfb){if(_0x407b83[_0xad0a('0x4a')]['id']){delete _0x407b83['body']['id'];}return db[_0xad0a('0x2d')][_0xad0a('0x48')]({'where':{'id':_0x407b83[_0xad0a('0x45')]['id']}})[_0xad0a('0x23')](handleEntityNotFound(_0x226194,null))[_0xad0a('0x23')](function(_0x1e8bda){if(_0x1e8bda){_0x407b83[_0xad0a('0x4a')][_0xad0a('0x52')]=_0x1e8bda['id'];return db[_0xad0a('0x2d')]['create'](_0x407b83[_0xad0a('0x4a')]);}})['then'](respondWithResult(_0x226194,null))[_0xad0a('0x44')](handleError(_0x226194,null));};exports[_0xad0a('0x53')]=function(_0x16ebd8,_0x34d4d2,_0x5ea01f){var _0x12df35={};var _0x396db1={};var _0x4a8638;var _0x5ab3d9;return db[_0xad0a('0x2d')][_0xad0a('0x54')]({'where':{'id':_0x16ebd8['params']['id']}})[_0xad0a('0x23')](handleEntityNotFound(_0x34d4d2,null))[_0xad0a('0x23')](function(_0x145ba1){if(_0x145ba1){_0x4a8638=_0x145ba1;_0x396db1[_0xad0a('0x31')]=_[_0xad0a('0x46')](db[_0xad0a('0x2d')]['rawAttributes']);_0x396db1[_0xad0a('0x32')]=_[_0xad0a('0x46')](_0x16ebd8[_0xad0a('0x32')]);_0x396db1[_0xad0a('0x33')]=_[_0xad0a('0x34')](_0x396db1['model'],_0x396db1['query']);_0x12df35['attributes']=_[_0xad0a('0x34')](_0x396db1[_0xad0a('0x31')],qs[_0xad0a('0x35')](_0x16ebd8[_0xad0a('0x32')]['fields']));_0x12df35[_0xad0a('0x36')]=_0x12df35[_0xad0a('0x36')][_0xad0a('0x47')]?_0x12df35[_0xad0a('0x36')]:_0x396db1[_0xad0a('0x31')];_0x12df35[_0xad0a('0x39')]=qs['sort'](_0x16ebd8[_0xad0a('0x32')][_0xad0a('0x3a')]);_0x12df35[_0xad0a('0x3b')]=qs[_0xad0a('0x33')](_[_0xad0a('0x55')](_0x16ebd8['query'],_0x396db1[_0xad0a('0x33')]));if(_0x16ebd8['query']['filter']){_0x12df35[_0xad0a('0x3b')]=_[_0xad0a('0x3d')](_0x12df35['where'],{'$or':_[_0xad0a('0x2c')](_0x12df35[_0xad0a('0x36')],function(_0x9014a3){var _0x43c872={};_0x43c872[_0x9014a3]={'$like':'%'+_0x16ebd8['query'][_0xad0a('0x3c')]+'%'};return _0x43c872;})});}_0x12df35=_[_0xad0a('0x3d')]({},_0x12df35,_0x16ebd8[_0xad0a('0x3f')]);return _0x4a8638['getIntervals'](_0x12df35);}})[_0xad0a('0x23')](function(_0x4283aa){if(_0x4283aa){_0x5ab3d9=_0x4283aa[_0xad0a('0x47')];if(!_0x16ebd8[_0xad0a('0x32')][_0xad0a('0x56')](_0xad0a('0x37'))){_0x12df35[_0xad0a('0x38')]=qs[_0xad0a('0x38')](_0x16ebd8[_0xad0a('0x32')][_0xad0a('0x38')]);_0x12df35[_0xad0a('0x1d')]=qs['offset'](_0x16ebd8[_0xad0a('0x32')][_0xad0a('0x1d')]);}return _0x4a8638[_0xad0a('0x53')](_0x12df35);}})[_0xad0a('0x23')](function(_0x200656){if(_0x200656){return _0x200656?{'count':_0x5ab3d9,'rows':_0x200656}:null;}})['then'](respondWithResult(_0x34d4d2,null))[_0xad0a('0x44')](handleError(_0x34d4d2,null));};exports[_0xad0a('0x57')]=function(_0x40b369,_0x3aa494,_0x4b4480){return db[_0xad0a('0x2d')][_0xad0a('0x54')]({'where':{'id':_0x40b369[_0xad0a('0x45')]['id']}})[_0xad0a('0x23')](handleEntityNotFound(_0x3aa494,null))[_0xad0a('0x23')](function(_0x459468){if(_0x459468){return db[_0xad0a('0x58')][_0xad0a('0x59')](function(_0x1e2f71){return db[_0xad0a('0x2d')][_0xad0a('0x26')]({'where':{'IntervalId':_0x40b369['params']['id']},'transaction':_0x1e2f71})[_0xad0a('0x23')](function(_0x56e292){var _0x569e8b=_[_0xad0a('0x2c')](_0x40b369[_0xad0a('0x4a')],function(_0x3b0b69){delete _0x3b0b69['id'];_0x3b0b69['IntervalId']=_0x40b369[_0xad0a('0x45')]['id'];return _0x3b0b69;});return db['Interval'][_0xad0a('0x5a')](_0x569e8b,{'transaction':_0x1e2f71});});})['then'](function(){return db[_0xad0a('0x2d')][_0xad0a('0x42')]({'where':{'IntervalId':_0x40b369['params']['id']}});});}})[_0xad0a('0x23')](respondWithResult(_0x3aa494,null))[_0xad0a('0x44')](handleError(_0x3aa494,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 18a5335..bbcbd7e 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 _0x4fd9=['rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x9b8282,_0xf57681){var _0x399fc9=function(_0x383615){while(--_0x383615){_0x9b8282['push'](_0x9b8282['shift']());}};_0x399fc9(++_0xf57681);}(_0x4fd9,0xf1));var _0x94fd=function(_0x597ef6,_0x3c76fa){_0x597ef6=_0x597ef6-0x0;var _0x541b74=_0x4fd9[_0x597ef6];return _0x541b74;};'use strict';var _=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));var logger=require(_0x94fd('0x2'))(_0x94fd('0x3'));var moment=require('moment');var BPromise=require(_0x94fd('0x4'));var rp=require(_0x94fd('0x5'));var fs=require('fs');var path=require(_0x94fd('0x6'));var rimraf=require(_0x94fd('0x7'));var config=require(_0x94fd('0x8'));var attributes=require(_0x94fd('0x9'));var extensions=require(_0x94fd('0xa'));module[_0x94fd('0xb')]=function(_0x38413f,_0x347e0b){return _0x38413f[_0x94fd('0xc')](_0x94fd('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x51ccfc,_0x28115b){extensions['rewrite'](_0x38413f,_0x51ccfc);},'afterBulkCreate':function(_0x275b82,_0x57ea90,_0x36a3c7){_0x36a3c7();extensions['rewrite'](_0x38413f,_0x275b82[0x0]);},'afterUpdate':function(_0x3a5a89,_0x315600){extensions['rewrite'](_0x38413f,_0x3a5a89);},'afterDestroy':function(_0x32ecee,_0x406d5a){extensions[_0x94fd('0xe')](_0x38413f,_0x32ecee);}}});}; \ No newline at end of file +var _0x160b=['define','tools_intervals','rewrite','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x160b,0xff));var _0xb160=function(_0x5b59f5,_0x1d6efb){_0x5b59f5=_0x5b59f5-0x0;var _0x48b7ab=_0x160b[_0x5b59f5];return _0x48b7ab;};'use strict';var _=require(_0xb160('0x0'));var util=require(_0xb160('0x1'));var logger=require(_0xb160('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb160('0x3'));var rp=require(_0xb160('0x4'));var fs=require('fs');var path=require(_0xb160('0x5'));var rimraf=require(_0xb160('0x6'));var config=require(_0xb160('0x7'));var attributes=require(_0xb160('0x8'));var extensions=require(_0xb160('0x9'));module[_0xb160('0xa')]=function(_0x29248e,_0x17d37e){return _0x29248e[_0xb160('0xb')]('Interval',attributes,{'tableName':_0xb160('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13e33b,_0x322bb2){extensions[_0xb160('0xd')](_0x29248e,_0x13e33b);},'afterBulkCreate':function(_0x2e79c3,_0x4b6a4a,_0x397add){_0x397add();extensions[_0xb160('0xd')](_0x29248e,_0x2e79c3[0x0]);},'afterUpdate':function(_0x9f6c2f,_0x4340ee){extensions[_0xb160('0xd')](_0x29248e,_0x9f6c2f);},'afterDestroy':function(_0x3fa2a6,_0x3e5eda){extensions[_0xb160('0xd')](_0x29248e,_0x3fa2a6);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8ceaf7a..ea86c38 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 _0xf5c3=['raw','where','attributes','limit','include','map','model','Interval','ShowInterval','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetInterval','findAll','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf5c3,0x1ba));var _0x3f5c=function(_0x78ba87,_0xfea440){_0x78ba87=_0x78ba87-0x0;var _0x17239c=_0xf5c3[_0x78ba87];return _0x17239c;};'use strict';var _=require(_0x3f5c('0x0'));var util=require(_0x3f5c('0x1'));var moment=require(_0x3f5c('0x2'));var BPromise=require(_0x3f5c('0x3'));var rs=require(_0x3f5c('0x4'));var fs=require('fs');var Redis=require(_0x3f5c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f5c('0x6'));var logger=require(_0x3f5c('0x7'))(_0x3f5c('0x8'));var config=require(_0x3f5c('0x9'));var jayson=require(_0x3f5c('0xa'));var client=jayson['client'][_0x3f5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5513a5,_0x50be1f,_0x403c34){return new BPromise(function(_0xb755b3,_0x26852e){return client['request'](_0x5513a5,_0x403c34)[_0x3f5c('0xc')](function(_0x42c648){logger[_0x3f5c('0xd')](_0x3f5c('0xe'),_0x50be1f,'request\x20sent');logger[_0x3f5c('0xf')](_0x3f5c('0x10'),_0x50be1f,_0x3f5c('0x11'),JSON['stringify'](_0x42c648));if(_0x42c648['error']){if(_0x42c648['error'][_0x3f5c('0x12')]===0x1f4){logger['error'](_0x3f5c('0xe'),_0x50be1f,_0x42c648[_0x3f5c('0x13')][_0x3f5c('0x14')]);return _0x26852e(_0x42c648[_0x3f5c('0x13')][_0x3f5c('0x14')]);}logger[_0x3f5c('0x13')]('Interval,\x20%s,\x20%s',_0x50be1f,_0x42c648[_0x3f5c('0x13')][_0x3f5c('0x14')]);return _0xb755b3(_0x42c648[_0x3f5c('0x13')][_0x3f5c('0x14')]);}else{logger['info'](_0x3f5c('0xe'),_0x50be1f,_0x3f5c('0x11'));_0xb755b3(_0x42c648[_0x3f5c('0x15')][_0x3f5c('0x14')]);}})[_0x3f5c('0x16')](function(_0x5d5a65){logger[_0x3f5c('0x13')]('Interval,\x20%s,\x20%s',_0x50be1f,_0x5d5a65);_0x26852e(_0x5d5a65);});});}exports[_0x3f5c('0x17')]=function(_0x1548fe){var _0x216426=this;return new Promise(function(_0x44ea6c,_0x2416c5){return db['Interval'][_0x3f5c('0x18')]({'raw':_0x1548fe[_0x3f5c('0x19')]?_0x1548fe[_0x3f5c('0x19')][_0x3f5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1548fe[_0x3f5c('0x19')]?_0x1548fe['options'][_0x3f5c('0x1b')]||null:null,'attributes':_0x1548fe['options']?_0x1548fe[_0x3f5c('0x19')][_0x3f5c('0x1c')]||null:null,'limit':_0x1548fe['options']?_0x1548fe[_0x3f5c('0x19')][_0x3f5c('0x1d')]||null:null,'include':_0x1548fe[_0x3f5c('0x19')]?_0x1548fe[_0x3f5c('0x19')][_0x3f5c('0x1e')]?_[_0x3f5c('0x1f')](_0x1548fe[_0x3f5c('0x19')][_0x3f5c('0x1e')],function(_0x1309cf){return{'model':db[_0x1309cf[_0x3f5c('0x20')]],'as':_0x1309cf['as'],'attributes':_0x1309cf[_0x3f5c('0x1c')],'include':_0x1309cf[_0x3f5c('0x1e')]?_[_0x3f5c('0x1f')](_0x1309cf[_0x3f5c('0x1e')],function(_0xb277fa){return{'model':db[_0xb277fa[_0x3f5c('0x20')]],'as':_0xb277fa['as'],'attributes':_0xb277fa['attributes'],'include':_0xb277fa[_0x3f5c('0x1e')]?_[_0x3f5c('0x1f')](_0xb277fa['include'],function(_0x46de2f){return{'model':db[_0x46de2f[_0x3f5c('0x20')]],'as':_0x46de2f['as'],'attributes':_0x46de2f[_0x3f5c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcad079){logger['info'](_0x3f5c('0x17'),_0x1548fe);logger[_0x3f5c('0xf')]('GetInterval',_0x1548fe,JSON['stringify'](_0xcad079));_0x44ea6c(_0xcad079);})[_0x3f5c('0x16')](function(_0xe24ccb){logger[_0x3f5c('0x13')](_0x3f5c('0x17'),_0xe24ccb['message'],_0x1548fe);_0x2416c5(_0x216426[_0x3f5c('0x13')](0x1f4,_0xe24ccb[_0x3f5c('0x14')]));});});};exports['ShowInterval']=function(_0xf6046f){var _0x18795a=this;return new Promise(function(_0x5375c4,_0x1f1201){return db[_0x3f5c('0x21')]['find']({'raw':_0xf6046f['options']?_0xf6046f[_0x3f5c('0x19')][_0x3f5c('0x1a')]===undefined?!![]:![]:!![],'where':_0xf6046f[_0x3f5c('0x19')]?_0xf6046f[_0x3f5c('0x19')][_0x3f5c('0x1b')]||null:null,'attributes':_0xf6046f[_0x3f5c('0x19')]?_0xf6046f[_0x3f5c('0x19')][_0x3f5c('0x1c')]||null:null,'include':_0xf6046f['options']?_0xf6046f[_0x3f5c('0x19')][_0x3f5c('0x1e')]?_[_0x3f5c('0x1f')](_0xf6046f['options'][_0x3f5c('0x1e')],function(_0x15ca58){return{'model':db[_0x15ca58['model']],'as':_0x15ca58['as'],'attributes':_0x15ca58[_0x3f5c('0x1c')],'include':_0x15ca58[_0x3f5c('0x1e')]?_[_0x3f5c('0x1f')](_0x15ca58[_0x3f5c('0x1e')],function(_0x30410a){return{'model':db[_0x30410a[_0x3f5c('0x20')]],'as':_0x30410a['as'],'attributes':_0x30410a['attributes'],'include':_0x30410a[_0x3f5c('0x1e')]?_[_0x3f5c('0x1f')](_0x30410a['include'],function(_0x8989c6){return{'model':db[_0x8989c6[_0x3f5c('0x20')]],'as':_0x8989c6['as'],'attributes':_0x8989c6[_0x3f5c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3f5c('0xc')](function(_0x41974a){logger[_0x3f5c('0xd')]('ShowInterval',_0xf6046f);logger[_0x3f5c('0xf')](_0x3f5c('0x22'),_0xf6046f,JSON[_0x3f5c('0x23')](_0x41974a));_0x5375c4(_0x41974a);})[_0x3f5c('0x16')](function(_0x28f1f2){logger[_0x3f5c('0x13')](_0x3f5c('0x22'),_0x28f1f2['message'],_0xf6046f);_0x1f1201(_0x18795a[_0x3f5c('0x13')](0x1f4,_0x28f1f2[_0x3f5c('0x14')]));});});}; \ No newline at end of file +var _0x35bf=['code','Interval,\x20%s,\x20%s','message','info','result','Interval','options','where','include','model','attributes','map','then','GetInterval','stringify','catch','ShowInterval','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error'];(function(_0xf0f09e,_0x25c464){var _0x13063d=function(_0x1a4f7c){while(--_0x1a4f7c){_0xf0f09e['push'](_0xf0f09e['shift']());}};_0x13063d(++_0x25c464);}(_0x35bf,0x10a));var _0xf35b=function(_0x412b18,_0x5bfef3){_0x412b18=_0x412b18-0x0;var _0x3c9fb1=_0x35bf[_0x412b18];return _0x3c9fb1;};'use strict';var _=require('lodash');var util=require(_0xf35b('0x0'));var moment=require('moment');var BPromise=require(_0xf35b('0x1'));var rs=require(_0xf35b('0x2'));var fs=require('fs');var Redis=require(_0xf35b('0x3'));var db=require(_0xf35b('0x4'))['db'];var utils=require(_0xf35b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf35b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf35b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x409f83,_0x22dc08,_0x573a9e){return new BPromise(function(_0xdaecbd,_0x3afa51){return client[_0xf35b('0x8')](_0x409f83,_0x573a9e)['then'](function(_0x2caa9c){logger['info']('Interval,\x20%s,\x20%s',_0x22dc08,_0xf35b('0x9'));logger[_0xf35b('0xa')](_0xf35b('0xb'),_0x22dc08,_0xf35b('0x9'),JSON['stringify'](_0x2caa9c));if(_0x2caa9c['error']){if(_0x2caa9c[_0xf35b('0xc')][_0xf35b('0xd')]===0x1f4){logger['error'](_0xf35b('0xe'),_0x22dc08,_0x2caa9c[_0xf35b('0xc')]['message']);return _0x3afa51(_0x2caa9c[_0xf35b('0xc')][_0xf35b('0xf')]);}logger[_0xf35b('0xc')](_0xf35b('0xe'),_0x22dc08,_0x2caa9c[_0xf35b('0xc')][_0xf35b('0xf')]);return _0xdaecbd(_0x2caa9c[_0xf35b('0xc')][_0xf35b('0xf')]);}else{logger[_0xf35b('0x10')](_0xf35b('0xe'),_0x22dc08,'request\x20sent');_0xdaecbd(_0x2caa9c[_0xf35b('0x11')][_0xf35b('0xf')]);}})['catch'](function(_0x9f761f){logger['error']('Interval,\x20%s,\x20%s',_0x22dc08,_0x9f761f);_0x3afa51(_0x9f761f);});});}exports['GetInterval']=function(_0x3789ef){var _0x163666=this;return new Promise(function(_0x54bedb,_0x57e8fa){return db[_0xf35b('0x12')]['findAll']({'raw':_0x3789ef[_0xf35b('0x13')]?_0x3789ef[_0xf35b('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3789ef[_0xf35b('0x13')]?_0x3789ef[_0xf35b('0x13')][_0xf35b('0x14')]||null:null,'attributes':_0x3789ef[_0xf35b('0x13')]?_0x3789ef[_0xf35b('0x13')]['attributes']||null:null,'limit':_0x3789ef[_0xf35b('0x13')]?_0x3789ef[_0xf35b('0x13')]['limit']||null:null,'include':_0x3789ef[_0xf35b('0x13')]?_0x3789ef[_0xf35b('0x13')][_0xf35b('0x15')]?_['map'](_0x3789ef[_0xf35b('0x13')][_0xf35b('0x15')],function(_0x3de941){return{'model':db[_0x3de941[_0xf35b('0x16')]],'as':_0x3de941['as'],'attributes':_0x3de941[_0xf35b('0x17')],'include':_0x3de941[_0xf35b('0x15')]?_[_0xf35b('0x18')](_0x3de941[_0xf35b('0x15')],function(_0xdf0879){return{'model':db[_0xdf0879[_0xf35b('0x16')]],'as':_0xdf0879['as'],'attributes':_0xdf0879['attributes'],'include':_0xdf0879[_0xf35b('0x15')]?_[_0xf35b('0x18')](_0xdf0879['include'],function(_0x2d32f9){return{'model':db[_0x2d32f9['model']],'as':_0x2d32f9['as'],'attributes':_0x2d32f9[_0xf35b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf35b('0x19')](function(_0x9ceea4){logger['info'](_0xf35b('0x1a'),_0x3789ef);logger['debug']('GetInterval',_0x3789ef,JSON[_0xf35b('0x1b')](_0x9ceea4));_0x54bedb(_0x9ceea4);})[_0xf35b('0x1c')](function(_0x6a6a66){logger['error'](_0xf35b('0x1a'),_0x6a6a66['message'],_0x3789ef);_0x57e8fa(_0x163666[_0xf35b('0xc')](0x1f4,_0x6a6a66['message']));});});};exports[_0xf35b('0x1d')]=function(_0x2714e4){var _0x202736=this;return new Promise(function(_0x4f4155,_0x2c1225){return db[_0xf35b('0x12')]['find']({'raw':_0x2714e4[_0xf35b('0x13')]?_0x2714e4[_0xf35b('0x13')][_0xf35b('0x1e')]===undefined?!![]:![]:!![],'where':_0x2714e4['options']?_0x2714e4[_0xf35b('0x13')][_0xf35b('0x14')]||null:null,'attributes':_0x2714e4[_0xf35b('0x13')]?_0x2714e4['options'][_0xf35b('0x17')]||null:null,'include':_0x2714e4['options']?_0x2714e4[_0xf35b('0x13')][_0xf35b('0x15')]?_[_0xf35b('0x18')](_0x2714e4[_0xf35b('0x13')]['include'],function(_0x4c285f){return{'model':db[_0x4c285f[_0xf35b('0x16')]],'as':_0x4c285f['as'],'attributes':_0x4c285f[_0xf35b('0x17')],'include':_0x4c285f[_0xf35b('0x15')]?_['map'](_0x4c285f[_0xf35b('0x15')],function(_0x549b88){return{'model':db[_0x549b88[_0xf35b('0x16')]],'as':_0x549b88['as'],'attributes':_0x549b88['attributes'],'include':_0x549b88[_0xf35b('0x15')]?_[_0xf35b('0x18')](_0x549b88[_0xf35b('0x15')],function(_0x124b52){return{'model':db[_0x124b52[_0xf35b('0x16')]],'as':_0x124b52['as'],'attributes':_0x124b52[_0xf35b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf35b('0x19')](function(_0x4a19e2){logger['info'](_0xf35b('0x1d'),_0x2714e4);logger[_0xf35b('0xa')](_0xf35b('0x1d'),_0x2714e4,JSON[_0xf35b('0x1b')](_0x4a19e2));_0x4f4155(_0x4a19e2);})['catch'](function(_0x4bc0aa){logger[_0xf35b('0xc')](_0xf35b('0x1d'),_0x4bc0aa['message'],_0x2714e4);_0x2c1225(_0x202736[_0xf35b('0xc')](0x1f4,_0x4bc0aa[_0xf35b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ee9a679..fe5e64d 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 _0xd2d6=['exports','express','Router','../../components/auth/service','post','isAuthenticated'];(function(_0x3d8d0f,_0x2ddd56){var _0x1e4d6d=function(_0x40b42b){while(--_0x40b42b){_0x3d8d0f['push'](_0x3d8d0f['shift']());}};_0x1e4d6d(++_0x2ddd56);}(_0xd2d6,0xa3));var _0x6d2d=function(_0x227d72,_0x18bc7b){_0x227d72=_0x227d72-0x0;var _0x72af8a=_0xd2d6[_0x227d72];return _0x72af8a;};'use strict';var express=require(_0x6d2d('0x0'));var router=express[_0x6d2d('0x1')]();var auth=require(_0x6d2d('0x2'));var controller=require('./jira.controller');router[_0x6d2d('0x3')]('/',auth[_0x6d2d('0x4')](),controller['send']);module[_0x6d2d('0x5')]=router; \ No newline at end of file +var _0x7497=['send','express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated'];(function(_0x1af250,_0x24aa28){var _0x700fcc=function(_0x1b96e6){while(--_0x1b96e6){_0x1af250['push'](_0x1af250['shift']());}};_0x700fcc(++_0x24aa28);}(_0x7497,0xef));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x7749('0x0'));var router=express[_0x7749('0x1')]();var auth=require(_0x7749('0x2'));var controller=require(_0x7749('0x3'));router[_0x7749('0x4')]('/',auth[_0x7749('0x5')](),controller[_0x7749('0x6')]);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 38f8533..6c50e97 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 _0x3c1c=['oldToken','newToken','customfield_11503','customfield_11504','reason','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','remoteAddress','socket','https','api','support','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','fields','customfield_11500','email','customfield_11501'];(function(_0x1c24c6,_0x5c26ed){var _0x26949a=function(_0x3298db){while(--_0x3298db){_0x1c24c6['push'](_0x1c24c6['shift']());}};_0x26949a(++_0x5c26ed);}(_0x3c1c,0x132));var _0xc3c1=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x3c1c[_0x31e29a];return _0x32d892;};'use strict';var BPromise=require('bluebird');var https=require(_0xc3c1('0x0'));var logger=require('../../config/logger')(_0xc3c1('0x1'));var USERNAME=_0xc3c1('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2e31f1,_0x3e9479){var _0xc8849a={'fields':{'project':{'key':_0x2e31f1[_0xc3c1('0x3')]||_0xc3c1('0x4')},'summary':(_0x2e31f1[_0xc3c1('0x5')]||_0xc3c1('0x6'))+_0xc3c1('0x7')+_0x2e31f1['ip'],'description':_0x2e31f1['description']||JSON[_0xc3c1('0x8')](_0x2e31f1),'issuetype':{'name':_0x2e31f1[_0xc3c1('0x9')]||'Bug'}}};_0xc8849a[_0xc3c1('0xa')][_0xc3c1('0xb')]=_0x2e31f1[_0xc3c1('0xc')];_0xc8849a[_0xc3c1('0xa')][_0xc3c1('0xd')]=_0x2e31f1[_0xc3c1('0xe')];_0xc8849a[_0xc3c1('0xa')]['customfield_11502']=_0x2e31f1[_0xc3c1('0xf')];_0xc8849a['fields'][_0xc3c1('0x10')]=_0x2e31f1['name'];_0xc8849a[_0xc3c1('0xa')][_0xc3c1('0x11')]=_0x2e31f1[_0xc3c1('0x12')];_0xc8849a[_0xc3c1('0xa')]['customfield_10102']=_0x2e31f1['ip'];var _0x230265={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xc3c1('0x13'),'method':_0xc3c1('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xc3c1('0x15'),'Authorization':_0xc3c1('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xc3c1('0x17'))}};var _0x3b44e5=JSON[_0xc3c1('0x8')](_0xc8849a);var _0x4d877f=https[_0xc3c1('0x18')](_0x230265,function(_0x5af84f){_0x5af84f[_0xc3c1('0x19')](_0xc3c1('0x1a'));var _0x2dc858='';_0x5af84f['on']('data',function(_0x12fb46){_0x2dc858+=_0x12fb46;});_0x5af84f['on'](_0xc3c1('0x1b'),function(){if(_0x3e9479){return _0x3e9479[_0xc3c1('0x1c')](_0x5af84f[_0xc3c1('0x1d')])[_0xc3c1('0x1e')](JSON['parse'](_0x2dc858));}});});_0x4d877f['on'](_0xc3c1('0x1f'),function(_0x5dc7a5){if(_0x3e9479){return _0x3e9479[_0xc3c1('0x1c')](0x1f4)[_0xc3c1('0x1e')]({'errors':[{'message':_0xc3c1('0x20'),'type':'api.jira'}]});}});_0x4d877f[_0xc3c1('0x21')](_0x3b44e5);_0x4d877f['end']();}exports[_0xc3c1('0x22')]=openIssue;exports[_0xc3c1('0x23')]=function(_0x1e0541,_0x561626){_0x1e0541[_0xc3c1('0x24')]['ip']=_0x1e0541[_0xc3c1('0x25')]['x-forwarded-for']||_0x1e0541['connection'][_0xc3c1('0x26')]||_0x1e0541[_0xc3c1('0x27')][_0xc3c1('0x26')]||_0x1e0541['connection']['socket'][_0xc3c1('0x26')];return openIssue(_0x1e0541[_0xc3c1('0x24')],_0x561626);}; \ No newline at end of file +var _0x8cf0=['request','utf8','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64'];(function(_0x167490,_0x7e39b){var _0x2fd0ef=function(_0x3466c6){while(--_0x3466c6){_0x167490['push'](_0x167490['shift']());}};_0x2fd0ef(++_0x7e39b);}(_0x8cf0,0xf1));var _0x08cf=function(_0x564276,_0x54284a){_0x564276=_0x564276-0x0;var _0x12a1f0=_0x8cf0[_0x564276];return _0x12a1f0;};'use strict';var BPromise=require(_0x08cf('0x0'));var https=require(_0x08cf('0x1'));var logger=require(_0x08cf('0x2'))(_0x08cf('0x3'));var USERNAME='support';var PASSWORD=_0x08cf('0x4');function openIssue(_0x1764b9,_0x34219b){var _0x4a528e={'fields':{'project':{'key':_0x1764b9[_0x08cf('0x5')]||'MOTGUI'},'summary':(_0x1764b9[_0x08cf('0x6')]||_0x08cf('0x7'))+_0x08cf('0x8')+_0x1764b9['ip'],'description':_0x1764b9[_0x08cf('0x9')]||JSON[_0x08cf('0xa')](_0x1764b9),'issuetype':{'name':_0x1764b9['issuetype']||_0x08cf('0xb')}}};_0x4a528e[_0x08cf('0xc')][_0x08cf('0xd')]=_0x1764b9[_0x08cf('0xe')];_0x4a528e[_0x08cf('0xc')]['customfield_11501']=_0x1764b9[_0x08cf('0xf')];_0x4a528e[_0x08cf('0xc')]['customfield_11502']=_0x1764b9[_0x08cf('0x10')];_0x4a528e[_0x08cf('0xc')][_0x08cf('0x11')]=_0x1764b9[_0x08cf('0x12')];_0x4a528e[_0x08cf('0xc')][_0x08cf('0x13')]=_0x1764b9[_0x08cf('0x14')];_0x4a528e[_0x08cf('0xc')][_0x08cf('0x15')]=_0x1764b9['ip'];var _0x5c149a={'host':_0x08cf('0x16'),'port':0x1bb,'path':_0x08cf('0x17'),'method':_0x08cf('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x08cf('0x19'),'Authorization':_0x08cf('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x08cf('0x1b')](_0x08cf('0x1c'))}};var _0x2fd46e=JSON[_0x08cf('0xa')](_0x4a528e);var _0x115c41=https[_0x08cf('0x1d')](_0x5c149a,function(_0x514306){_0x514306['setEncoding'](_0x08cf('0x1e'));var _0x4d68bc='';_0x514306['on']('data',function(_0x104266){_0x4d68bc+=_0x104266;});_0x514306['on'](_0x08cf('0x1f'),function(){if(_0x34219b){return _0x34219b[_0x08cf('0x20')](_0x514306[_0x08cf('0x21')])[_0x08cf('0x22')](JSON['parse'](_0x4d68bc));}});});_0x115c41['on'](_0x08cf('0x23'),function(_0x3e481e){if(_0x34219b){return _0x34219b['status'](0x1f4)['json']({'errors':[{'message':_0x08cf('0x24'),'type':_0x08cf('0x25')}]});}});_0x115c41[_0x08cf('0x26')](_0x2fd46e);_0x115c41[_0x08cf('0x1f')]();}exports['openIssue']=openIssue;exports[_0x08cf('0x27')]=function(_0x60b36a,_0x40ded4){_0x60b36a[_0x08cf('0x28')]['ip']=_0x60b36a['headers'][_0x08cf('0x29')]||_0x60b36a[_0x08cf('0x2a')][_0x08cf('0x2b')]||_0x60b36a[_0x08cf('0x2c')][_0x08cf('0x2b')]||_0x60b36a[_0x08cf('0x2a')][_0x08cf('0x2c')][_0x08cf('0x2b')];return openIssue(_0x60b36a['body'],_0x40ded4);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 56562b5..46c97d3 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 _0xc500=['/describe','describe','/:id','show','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc500,0xaa));var _0x0c50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc500[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c50('0x0'));var util=require('util');var path=require(_0x0c50('0x1'));var timeout=require(_0x0c50('0x2'));var express=require(_0x0c50('0x3'));var router=express[_0x0c50('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0c50('0x5'));var config=require('../../config/environment');var controller=require(_0x0c50('0x6'));router[_0x0c50('0x7')]('/',auth[_0x0c50('0x8')](),controller[_0x0c50('0x9')]);router[_0x0c50('0x7')](_0x0c50('0xa'),auth[_0x0c50('0x8')](),controller[_0x0c50('0xb')]);router[_0x0c50('0x7')](_0x0c50('0xc'),auth['isAuthenticated'](),controller[_0x0c50('0xd')]);router['post']('/',auth[_0x0c50('0x8')](),controller[_0x0c50('0xe')]);router['put'](_0x0c50('0xc'),auth[_0x0c50('0x8')](),controller['update']);router[_0x0c50('0xf')]('/:id',auth[_0x0c50('0x8')](),controller[_0x0c50('0x10')]);module[_0x0c50('0x11')]=router; \ No newline at end of file +var _0x1c22=['isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x596ff1,_0x348a3b){var _0x488509=function(_0x54bb32){while(--_0x54bb32){_0x596ff1['push'](_0x596ff1['shift']());}};_0x488509(++_0x348a3b);}(_0x1c22,0x8f));var _0x21c2=function(_0x343d45,_0x350bb1){_0x343d45=_0x343d45-0x0;var _0x2ae23a=_0x1c22[_0x343d45];return _0x2ae23a;};'use strict';var multer=require(_0x21c2('0x0'));var util=require(_0x21c2('0x1'));var path=require(_0x21c2('0x2'));var timeout=require(_0x21c2('0x3'));var express=require('express');var router=express[_0x21c2('0x4')]();var auth=require(_0x21c2('0x5'));var interaction=require(_0x21c2('0x6'));var config=require(_0x21c2('0x7'));var controller=require(_0x21c2('0x8'));router['get']('/',auth[_0x21c2('0x9')](),controller[_0x21c2('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x21c2('0xb')](_0x21c2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x21c2('0xd')]('/',auth[_0x21c2('0x9')](),controller[_0x21c2('0xe')]);router[_0x21c2('0xf')](_0x21c2('0xc'),auth[_0x21c2('0x9')](),controller[_0x21c2('0x10')]);router[_0x21c2('0x11')](_0x21c2('0xc'),auth[_0x21c2('0x9')](),controller[_0x21c2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 274d1ad..3f497de 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 _0xdab7=['exports','STRING','TEXT','long','sequelize'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xdab7,0x199));var _0x7dab=function(_0x110423,_0x38fd32){_0x110423=_0x110423-0x0;var _0x3cf854=_0xdab7[_0x110423];return _0x3cf854;};'use strict';var Sequelize=require(_0x7dab('0x0'));module[_0x7dab('0x1')]={'question':{'type':Sequelize[_0x7dab('0x2')]},'answer':{'type':Sequelize[_0x7dab('0x3')](_0x7dab('0x4'))},'membername':{'type':Sequelize[_0x7dab('0x2')]},'projectname':{'type':Sequelize[_0x7dab('0x2')]},'queue':{'type':Sequelize[_0x7dab('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7dab('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d62=['long','STRING','sequelize','exports','TEXT'];(function(_0x545f90,_0x32e58a){var _0xd70fe8=function(_0x44983f){while(--_0x44983f){_0x545f90['push'](_0x545f90['shift']());}};_0xd70fe8(++_0x32e58a);}(_0x9d62,0x183));var _0x29d6=function(_0x5fa153,_0x4dbdc3){_0x5fa153=_0x5fa153-0x0;var _0x11bfe0=_0x9d62[_0x5fa153];return _0x11bfe0;};'use strict';var Sequelize=require(_0x29d6('0x0'));module[_0x29d6('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x29d6('0x2')](_0x29d6('0x3'))},'membername':{'type':Sequelize[_0x29d6('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x29d6('0x4')]},'uniqueid':{'type':Sequelize[_0x29d6('0x4')]},'calleridname':{'type':Sequelize[_0x29d6('0x4')]},'calleridnum':{'type':Sequelize[_0x29d6('0x4')]},'questionId':{'type':Sequelize[_0x29d6('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d37368a..20679bf 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 _0xef34=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','send','map','JscriptyAnswerReport','fieldName','type','key','name','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format'];(function(_0x532850,_0x3a100a){var _0x4ea53f=function(_0x243531){while(--_0x243531){_0x532850['push'](_0x532850['shift']());}};_0x4ea53f(++_0x3a100a);}(_0xef34,0x9c));var _0x4ef3=function(_0x3723c1,_0x570f1f){_0x3723c1=_0x3723c1-0x0;var _0x22bd8a=_0xef34[_0x3723c1];return _0x22bd8a;};'use strict';var pdf=require(_0x4ef3('0x0'));var emlformat=require(_0x4ef3('0x1'));var rimraf=require(_0x4ef3('0x2'));var zipdir=require(_0x4ef3('0x3'));var jsonpatch=require(_0x4ef3('0x4'));var rp=require(_0x4ef3('0x5'));var moment=require('moment');var BPromise=require(_0x4ef3('0x6'));var Mustache=require(_0x4ef3('0x7'));var util=require(_0x4ef3('0x8'));var path=require(_0x4ef3('0x9'));var sox=require(_0x4ef3('0xa'));var csv=require(_0x4ef3('0xb'));var ejs=require(_0x4ef3('0xc'));var fs=require('fs');var _=require(_0x4ef3('0xd'));var squel=require('squel');var crypto=require(_0x4ef3('0xe'));var jsforce=require(_0x4ef3('0xf'));var deskjs=require(_0x4ef3('0x10'));var toCsv=require(_0x4ef3('0xb'));var querystring=require(_0x4ef3('0x11'));var Papa=require(_0x4ef3('0x12'));var Redis=require(_0x4ef3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4ef3('0x14'));var as=require(_0x4ef3('0x15'));var hardwareService=require(_0x4ef3('0x16'));var logger=require(_0x4ef3('0x17'))(_0x4ef3('0x18'));var utils=require(_0x4ef3('0x19'));var config=require(_0x4ef3('0x1a'));var licenseUtil=require(_0x4ef3('0x1b'));var db=require(_0x4ef3('0x1c'))['db'];function respondWithStatusCode(_0x40b09a,_0x5f2b89){_0x5f2b89=_0x5f2b89||0xcc;return function(_0x111b1b){if(_0x111b1b){return _0x40b09a[_0x4ef3('0x1d')](_0x5f2b89);}return _0x40b09a[_0x4ef3('0x1e')](_0x5f2b89)[_0x4ef3('0x1f')]();};}function respondWithResult(_0x5c7f11,_0x5954c2){_0x5954c2=_0x5954c2||0xc8;return function(_0x34c0a5){if(_0x34c0a5){return _0x5c7f11[_0x4ef3('0x1e')](_0x5954c2)[_0x4ef3('0x20')](_0x34c0a5);}};}function respondWithFilteredResult(_0x49d2da,_0x3d28ea){return function(_0x3a8b4c){if(_0x3a8b4c){var _0x4c14ec=_0x3a8b4c[_0x4ef3('0x21')],_0x5512f3=_0x3d28ea[_0x4ef3('0x22')],_0x3f8134=_0x3d28ea[_0x4ef3('0x22')]+_0x3d28ea['limit'],_0x3e99ff;if(_0x3f8134>=_0x4c14ec){_0x3f8134=_0x4c14ec;_0x3e99ff=0xc8;}else{_0x3e99ff=0xce;}_0x49d2da[_0x4ef3('0x1e')](_0x3e99ff);return _0x49d2da[_0x4ef3('0x23')](_0x4ef3('0x24'),_0x5512f3+'-'+_0x3f8134+'/'+_0x4c14ec)['json'](_0x3a8b4c);}return null;};}function patchUpdates(_0x41b662){return function(_0xbafedf){try{jsonpatch[_0x4ef3('0x25')](_0xbafedf,_0x41b662,!![]);}catch(_0x5f418b){return BPromise[_0x4ef3('0x26')](_0x5f418b);}return _0xbafedf['save']();};}function saveUpdates(_0x1759c7,_0x23f388){return function(_0x2cdb7e){if(_0x2cdb7e){return _0x2cdb7e[_0x4ef3('0x27')](_0x1759c7)['then'](function(_0x32a9b8){return _0x32a9b8;});}return null;};}function removeEntity(_0x194150,_0x47baa4){return function(_0x3c0ffc){if(_0x3c0ffc){return _0x3c0ffc[_0x4ef3('0x28')]()[_0x4ef3('0x29')](function(){_0x194150[_0x4ef3('0x1e')](0xcc)[_0x4ef3('0x1f')]();});}};}function handleEntityNotFound(_0x27c795,_0x50bbfb){return function(_0xc43038){if(!_0xc43038){_0x27c795['sendStatus'](0x194);}return _0xc43038;};}function handleError(_0x28e3bb,_0xa18bc8){_0xa18bc8=_0xa18bc8||0x1f4;return function(_0x483167){logger[_0x4ef3('0x2a')](_0x483167[_0x4ef3('0x2b')]);if(_0x483167['name']){delete _0x483167['name'];}_0x28e3bb[_0x4ef3('0x1e')](_0xa18bc8)[_0x4ef3('0x2c')](_0x483167);};}exports['index']=function(_0x2f1e9d,_0x34b424){var _0x2189ac={},_0x603917={},_0x2ade46={'count':0x0,'rows':[]};var _0x368fc9=_[_0x4ef3('0x2d')](db[_0x4ef3('0x2e')]['rawAttributes'],function(_0x5cc82a){return{'name':_0x5cc82a[_0x4ef3('0x2f')],'type':_0x5cc82a[_0x4ef3('0x30')][_0x4ef3('0x31')]};});_0x603917['model']=_['map'](_0x368fc9,_0x4ef3('0x32'));_0x603917[_0x4ef3('0x33')]=_[_0x4ef3('0x34')](_0x2f1e9d['query']);_0x603917[_0x4ef3('0x35')]=_['intersection'](_0x603917[_0x4ef3('0x36')],_0x603917['query']);_0x2189ac['attributes']=_[_0x4ef3('0x37')](_0x603917[_0x4ef3('0x36')],qs[_0x4ef3('0x38')](_0x2f1e9d['query']['fields']));_0x2189ac[_0x4ef3('0x39')]=_0x2189ac['attributes'][_0x4ef3('0x3a')]?_0x2189ac[_0x4ef3('0x39')]:_0x603917[_0x4ef3('0x36')];if(!_0x2f1e9d[_0x4ef3('0x33')][_0x4ef3('0x3b')]('nolimit')){_0x2189ac['limit']=qs[_0x4ef3('0x3c')](_0x2f1e9d[_0x4ef3('0x33')][_0x4ef3('0x3c')]);_0x2189ac['offset']=qs[_0x4ef3('0x22')](_0x2f1e9d['query'][_0x4ef3('0x22')]);}_0x2189ac['order']=qs[_0x4ef3('0x3d')](_0x2f1e9d[_0x4ef3('0x33')][_0x4ef3('0x3d')]);_0x2189ac['where']=qs[_0x4ef3('0x35')](_['pick'](_0x2f1e9d['query'],_0x603917[_0x4ef3('0x35')]),_0x368fc9);if(_0x2f1e9d[_0x4ef3('0x33')][_0x4ef3('0x3e')]){_0x2189ac[_0x4ef3('0x3f')]=_[_0x4ef3('0x40')](_0x2189ac[_0x4ef3('0x3f')],{'$or':_[_0x4ef3('0x2d')](_0x368fc9,function(_0xfbe2aa){if(_0xfbe2aa[_0x4ef3('0x30')]!==_0x4ef3('0x41')){var _0x267ce0={};_0x267ce0[_0xfbe2aa[_0x4ef3('0x32')]]={'$like':'%'+_0x2f1e9d[_0x4ef3('0x33')]['filter']+'%'};return _0x267ce0;}})});}_0x2189ac=_[_0x4ef3('0x40')]({},_0x2189ac,_0x2f1e9d[_0x4ef3('0x42')]);var _0x2a98af={'where':_0x2189ac[_0x4ef3('0x3f')]};return db[_0x4ef3('0x2e')]['count'](_0x2a98af)[_0x4ef3('0x29')](function(_0x366a8b){_0x2ade46[_0x4ef3('0x21')]=_0x366a8b;if(_0x2f1e9d[_0x4ef3('0x33')][_0x4ef3('0x43')]){_0x2189ac[_0x4ef3('0x44')]=[{'all':!![]}];}return db[_0x4ef3('0x2e')][_0x4ef3('0x45')](_0x2189ac);})['then'](function(_0x58da69){_0x2ade46[_0x4ef3('0x46')]=_0x58da69;return _0x2ade46;})[_0x4ef3('0x29')](respondWithFilteredResult(_0x34b424,_0x2189ac))[_0x4ef3('0x47')](handleError(_0x34b424,null));};exports[_0x4ef3('0x48')]=function(_0x3d0dfe,_0xd746ae){var _0x22d7c2={'raw':!![],'where':{'id':_0x3d0dfe[_0x4ef3('0x49')]['id']}},_0x1dd21d={};_0x1dd21d['model']=_[_0x4ef3('0x34')](db[_0x4ef3('0x2e')][_0x4ef3('0x4a')]);_0x1dd21d[_0x4ef3('0x33')]=_[_0x4ef3('0x34')](_0x3d0dfe[_0x4ef3('0x33')]);_0x1dd21d[_0x4ef3('0x35')]=_[_0x4ef3('0x37')](_0x1dd21d[_0x4ef3('0x36')],_0x1dd21d[_0x4ef3('0x33')]);_0x22d7c2[_0x4ef3('0x39')]=_[_0x4ef3('0x37')](_0x1dd21d[_0x4ef3('0x36')],qs[_0x4ef3('0x38')](_0x3d0dfe[_0x4ef3('0x33')][_0x4ef3('0x38')]));_0x22d7c2[_0x4ef3('0x39')]=_0x22d7c2[_0x4ef3('0x39')][_0x4ef3('0x3a')]?_0x22d7c2[_0x4ef3('0x39')]:_0x1dd21d['model'];if(_0x3d0dfe['query'][_0x4ef3('0x43')]){_0x22d7c2[_0x4ef3('0x44')]=[{'all':!![]}];}_0x22d7c2=_[_0x4ef3('0x40')]({},_0x22d7c2,_0x3d0dfe[_0x4ef3('0x42')]);return db[_0x4ef3('0x2e')][_0x4ef3('0x4b')](_0x22d7c2)['then'](handleEntityNotFound(_0xd746ae,null))[_0x4ef3('0x29')](respondWithResult(_0xd746ae,null))[_0x4ef3('0x47')](handleError(_0xd746ae,null));};exports[_0x4ef3('0x4c')]=function(_0x93a2be,_0x5836e2){return db[_0x4ef3('0x2e')][_0x4ef3('0x4c')](_0x93a2be[_0x4ef3('0x4d')],{})[_0x4ef3('0x29')](respondWithResult(_0x5836e2,0xc9))[_0x4ef3('0x47')](handleError(_0x5836e2,null));};exports['update']=function(_0x4cdd4b,_0x6e11aa){if(_0x4cdd4b[_0x4ef3('0x4d')]['id']){delete _0x4cdd4b['body']['id'];}return db[_0x4ef3('0x2e')][_0x4ef3('0x4b')]({'where':{'id':_0x4cdd4b[_0x4ef3('0x49')]['id']}})[_0x4ef3('0x29')](handleEntityNotFound(_0x6e11aa,null))[_0x4ef3('0x29')](saveUpdates(_0x4cdd4b[_0x4ef3('0x4d')],null))[_0x4ef3('0x29')](respondWithResult(_0x6e11aa,null))[_0x4ef3('0x47')](handleError(_0x6e11aa,null));};exports[_0x4ef3('0x28')]=function(_0x338626,_0x56d883){return db[_0x4ef3('0x2e')][_0x4ef3('0x4b')]({'where':{'id':_0x338626['params']['id']}})[_0x4ef3('0x29')](handleEntityNotFound(_0x56d883,null))[_0x4ef3('0x29')](removeEntity(_0x56d883,null))[_0x4ef3('0x47')](handleError(_0x56d883,null));};exports[_0x4ef3('0x4e')]=function(_0x9c3242,_0x3bdf71){return db[_0x4ef3('0x2e')][_0x4ef3('0x4e')]()[_0x4ef3('0x29')](respondWithResult(_0x3bdf71,null))[_0x4ef3('0x47')](handleError(_0x3bdf71,null));}; \ No newline at end of file +var _0x646e=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','find','catch','create','params','body','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x5aa992,_0x559ebb){var _0x2e2d59=function(_0x1e2e35){while(--_0x1e2e35){_0x5aa992['push'](_0x5aa992['shift']());}};_0x2e2d59(++_0x559ebb);}(_0x646e,0x110));var _0xe646=function(_0x4da647,_0x29743c){_0x4da647=_0x4da647-0x0;var _0x5259e3=_0x646e[_0x4da647];return _0x5259e3;};'use strict';var pdf=require(_0xe646('0x0'));var emlformat=require(_0xe646('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe646('0x2'));var moment=require(_0xe646('0x3'));var BPromise=require(_0xe646('0x4'));var Mustache=require(_0xe646('0x5'));var util=require(_0xe646('0x6'));var path=require(_0xe646('0x7'));var sox=require('sox');var csv=require(_0xe646('0x8'));var ejs=require(_0xe646('0x9'));var fs=require('fs');var _=require(_0xe646('0xa'));var squel=require('squel');var crypto=require(_0xe646('0xb'));var jsforce=require(_0xe646('0xc'));var deskjs=require(_0xe646('0xd'));var toCsv=require(_0xe646('0x8'));var querystring=require(_0xe646('0xe'));var Papa=require('papaparse');var Redis=require(_0xe646('0xf'));var authService=require(_0xe646('0x10'));var qs=require(_0xe646('0x11'));var as=require(_0xe646('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe646('0x13'))('api');var utils=require(_0xe646('0x14'));var config=require(_0xe646('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe646('0x16'))['db'];function respondWithStatusCode(_0x63d9a1,_0x49b342){_0x49b342=_0x49b342||0xcc;return function(_0xfa49a2){if(_0xfa49a2){return _0x63d9a1[_0xe646('0x17')](_0x49b342);}return _0x63d9a1[_0xe646('0x18')](_0x49b342)[_0xe646('0x19')]();};}function respondWithResult(_0x4f5065,_0x3fc8d8){_0x3fc8d8=_0x3fc8d8||0xc8;return function(_0x1fc951){if(_0x1fc951){return _0x4f5065[_0xe646('0x18')](_0x3fc8d8)[_0xe646('0x1a')](_0x1fc951);}};}function respondWithFilteredResult(_0x271181,_0x15bac8){return function(_0x206c1f){if(_0x206c1f){var _0x4ec4f2=_0x206c1f['count'],_0x1725db=_0x15bac8[_0xe646('0x1b')],_0x2a4074=_0x15bac8['offset']+_0x15bac8['limit'],_0x15a2ba;if(_0x2a4074>=_0x4ec4f2){_0x2a4074=_0x4ec4f2;_0x15a2ba=0xc8;}else{_0x15a2ba=0xce;}_0x271181[_0xe646('0x18')](_0x15a2ba);return _0x271181[_0xe646('0x1c')](_0xe646('0x1d'),_0x1725db+'-'+_0x2a4074+'/'+_0x4ec4f2)[_0xe646('0x1a')](_0x206c1f);}return null;};}function patchUpdates(_0x801a02){return function(_0x1e0432){try{jsonpatch[_0xe646('0x1e')](_0x1e0432,_0x801a02,!![]);}catch(_0x201244){return BPromise[_0xe646('0x1f')](_0x201244);}return _0x1e0432[_0xe646('0x20')]();};}function saveUpdates(_0x515f2c,_0x1a63d4){return function(_0x4cd646){if(_0x4cd646){return _0x4cd646[_0xe646('0x21')](_0x515f2c)[_0xe646('0x22')](function(_0x349622){return _0x349622;});}return null;};}function removeEntity(_0xcac8ed,_0x300802){return function(_0x127691){if(_0x127691){return _0x127691['destroy']()[_0xe646('0x22')](function(){_0xcac8ed[_0xe646('0x18')](0xcc)[_0xe646('0x19')]();});}};}function handleEntityNotFound(_0x41f051,_0x4aabf4){return function(_0xb65040){if(!_0xb65040){_0x41f051[_0xe646('0x17')](0x194);}return _0xb65040;};}function handleError(_0x3bf3e3,_0x4b2bc7){_0x4b2bc7=_0x4b2bc7||0x1f4;return function(_0xb4ca7){logger[_0xe646('0x23')](_0xb4ca7['stack']);if(_0xb4ca7[_0xe646('0x24')]){delete _0xb4ca7[_0xe646('0x24')];}_0x3bf3e3['status'](_0x4b2bc7)['send'](_0xb4ca7);};}exports[_0xe646('0x25')]=function(_0x43feaa,_0x2ccde7){var _0x1b6370={},_0x2ac7bb={},_0x1d9dba={'count':0x0,'rows':[]};var _0x3b58d9=_[_0xe646('0x26')](db[_0xe646('0x27')][_0xe646('0x28')],function(_0x28f8dd){return{'name':_0x28f8dd[_0xe646('0x29')],'type':_0x28f8dd[_0xe646('0x2a')][_0xe646('0x2b')]};});_0x2ac7bb[_0xe646('0x2c')]=_[_0xe646('0x26')](_0x3b58d9,_0xe646('0x24'));_0x2ac7bb[_0xe646('0x2d')]=_[_0xe646('0x2e')](_0x43feaa[_0xe646('0x2d')]);_0x2ac7bb[_0xe646('0x2f')]=_['intersection'](_0x2ac7bb['model'],_0x2ac7bb[_0xe646('0x2d')]);_0x1b6370[_0xe646('0x30')]=_[_0xe646('0x31')](_0x2ac7bb[_0xe646('0x2c')],qs[_0xe646('0x32')](_0x43feaa[_0xe646('0x2d')]['fields']));_0x1b6370['attributes']=_0x1b6370['attributes'][_0xe646('0x33')]?_0x1b6370[_0xe646('0x30')]:_0x2ac7bb[_0xe646('0x2c')];if(!_0x43feaa['query']['hasOwnProperty'](_0xe646('0x34'))){_0x1b6370[_0xe646('0x35')]=qs[_0xe646('0x35')](_0x43feaa[_0xe646('0x2d')][_0xe646('0x35')]);_0x1b6370[_0xe646('0x1b')]=qs[_0xe646('0x1b')](_0x43feaa[_0xe646('0x2d')][_0xe646('0x1b')]);}_0x1b6370[_0xe646('0x36')]=qs[_0xe646('0x37')](_0x43feaa['query']['sort']);_0x1b6370[_0xe646('0x38')]=qs[_0xe646('0x2f')](_['pick'](_0x43feaa[_0xe646('0x2d')],_0x2ac7bb[_0xe646('0x2f')]),_0x3b58d9);if(_0x43feaa[_0xe646('0x2d')][_0xe646('0x39')]){_0x1b6370['where']=_['merge'](_0x1b6370[_0xe646('0x38')],{'$or':_['map'](_0x3b58d9,function(_0x27c30e){if(_0x27c30e[_0xe646('0x2a')]!==_0xe646('0x3a')){var _0x45cc04={};_0x45cc04[_0x27c30e[_0xe646('0x24')]]={'$like':'%'+_0x43feaa[_0xe646('0x2d')][_0xe646('0x39')]+'%'};return _0x45cc04;}})});}_0x1b6370=_[_0xe646('0x3b')]({},_0x1b6370,_0x43feaa[_0xe646('0x3c')]);var _0x350b51={'where':_0x1b6370[_0xe646('0x38')]};return db[_0xe646('0x27')]['count'](_0x350b51)[_0xe646('0x22')](function(_0x3d1375){_0x1d9dba[_0xe646('0x3d')]=_0x3d1375;if(_0x43feaa[_0xe646('0x2d')][_0xe646('0x3e')]){_0x1b6370[_0xe646('0x3f')]=[{'all':!![]}];}return db[_0xe646('0x27')][_0xe646('0x40')](_0x1b6370);})['then'](function(_0x54c74e){_0x1d9dba[_0xe646('0x41')]=_0x54c74e;return _0x1d9dba;})['then'](respondWithFilteredResult(_0x2ccde7,_0x1b6370))['catch'](handleError(_0x2ccde7,null));};exports[_0xe646('0x42')]=function(_0x3bdb67,_0x3a3b03){var _0x3aa2d4={'raw':!![],'where':{'id':_0x3bdb67['params']['id']}},_0x11df9f={};_0x11df9f[_0xe646('0x2c')]=_[_0xe646('0x2e')](db[_0xe646('0x27')][_0xe646('0x28')]);_0x11df9f[_0xe646('0x2d')]=_[_0xe646('0x2e')](_0x3bdb67[_0xe646('0x2d')]);_0x11df9f[_0xe646('0x2f')]=_['intersection'](_0x11df9f[_0xe646('0x2c')],_0x11df9f[_0xe646('0x2d')]);_0x3aa2d4[_0xe646('0x30')]=_['intersection'](_0x11df9f['model'],qs[_0xe646('0x32')](_0x3bdb67['query'][_0xe646('0x32')]));_0x3aa2d4['attributes']=_0x3aa2d4[_0xe646('0x30')][_0xe646('0x33')]?_0x3aa2d4[_0xe646('0x30')]:_0x11df9f[_0xe646('0x2c')];if(_0x3bdb67[_0xe646('0x2d')][_0xe646('0x3e')]){_0x3aa2d4[_0xe646('0x3f')]=[{'all':!![]}];}_0x3aa2d4=_[_0xe646('0x3b')]({},_0x3aa2d4,_0x3bdb67[_0xe646('0x3c')]);return db[_0xe646('0x27')][_0xe646('0x43')](_0x3aa2d4)['then'](handleEntityNotFound(_0x3a3b03,null))[_0xe646('0x22')](respondWithResult(_0x3a3b03,null))[_0xe646('0x44')](handleError(_0x3a3b03,null));};exports[_0xe646('0x45')]=function(_0x156169,_0x2498a8){return db[_0xe646('0x27')][_0xe646('0x45')](_0x156169['body'],{})['then'](respondWithResult(_0x2498a8,0xc9))[_0xe646('0x44')](handleError(_0x2498a8,null));};exports[_0xe646('0x21')]=function(_0x48e79d,_0x4b0983){if(_0x48e79d['body']['id']){delete _0x48e79d['body']['id'];}return db[_0xe646('0x27')][_0xe646('0x43')]({'where':{'id':_0x48e79d[_0xe646('0x46')]['id']}})[_0xe646('0x22')](handleEntityNotFound(_0x4b0983,null))['then'](saveUpdates(_0x48e79d[_0xe646('0x47')],null))['then'](respondWithResult(_0x4b0983,null))[_0xe646('0x44')](handleError(_0x4b0983,null));};exports['destroy']=function(_0x1904dd,_0x5853ae){return db[_0xe646('0x27')][_0xe646('0x43')]({'where':{'id':_0x1904dd[_0xe646('0x46')]['id']}})[_0xe646('0x22')](handleEntityNotFound(_0x5853ae,null))[_0xe646('0x22')](removeEntity(_0x5853ae,null))[_0xe646('0x44')](handleError(_0x5853ae,null));};exports['describe']=function(_0x3f3f16,_0x40761e){return db[_0xe646('0x27')][_0xe646('0x48')]()['then'](respondWithResult(_0x40761e,null))['catch'](handleError(_0x40761e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9acdd98..02dbbfd 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 _0x43c8=['exports','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x6072c0,_0x4f8970){var _0x5041e7=function(_0x405958){while(--_0x405958){_0x6072c0['push'](_0x6072c0['shift']());}};_0x5041e7(++_0x4f8970);}(_0x43c8,0x1d6));var _0x843c=function(_0x3646ae,_0x17d092){_0x3646ae=_0x3646ae-0x0;var _0x25976b=_0x43c8[_0x3646ae];return _0x25976b;};'use strict';var _=require(_0x843c('0x0'));var util=require(_0x843c('0x1'));var logger=require(_0x843c('0x2'))(_0x843c('0x3'));var moment=require(_0x843c('0x4'));var BPromise=require(_0x843c('0x5'));var rp=require(_0x843c('0x6'));var fs=require('fs');var path=require(_0x843c('0x7'));var rimraf=require('rimraf');var config=require(_0x843c('0x8'));var attributes=require(_0x843c('0x9'));module[_0x843c('0xa')]=function(_0x417f03,_0x1060e2){return _0x417f03['define'](_0x843c('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1916=['bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyAnswerReport','lodash','util','api'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x1916,0x165));var _0x6191=function(_0x1b2b1e,_0x19b3be){_0x1b2b1e=_0x1b2b1e-0x0;var _0x3cc510=_0x1916[_0x1b2b1e];return _0x3cc510;};'use strict';var _=require(_0x6191('0x0'));var util=require(_0x6191('0x1'));var logger=require('../../config/logger')(_0x6191('0x2'));var moment=require('moment');var BPromise=require(_0x6191('0x3'));var rp=require(_0x6191('0x4'));var fs=require('fs');var path=require(_0x6191('0x5'));var rimraf=require(_0x6191('0x6'));var config=require(_0x6191('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x6191('0x8')]=function(_0x9f822c,_0xef2e86){return _0x9f822c['define'](_0x6191('0x9'),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 26206ae..7e18c72 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 _0xc26b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc26b,0x160));var _0xbc26=function(_0x393793,_0x17fd09){_0x393793=_0x393793-0x0;var _0xadbb72=_0xc26b[_0x393793];return _0xadbb72;};'use strict';var _=require(_0xbc26('0x0'));var util=require(_0xbc26('0x1'));var moment=require(_0xbc26('0x2'));var BPromise=require(_0xbc26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc26('0x4'));var db=require(_0xbc26('0x5'))['db'];var utils=require(_0xbc26('0x6'));var logger=require(_0xbc26('0x7'))(_0xbc26('0x8'));var config=require(_0xbc26('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3610a0,_0x23e930,_0x1c4c33){return new BPromise(function(_0x4731a4,_0x122254){return client['request'](_0x3610a0,_0x1c4c33)[_0xbc26('0xa')](function(_0x2c01a2){logger['info'](_0xbc26('0xb'),_0x23e930,_0xbc26('0xc'));logger['debug'](_0xbc26('0xd'),_0x23e930,_0xbc26('0xc'),JSON['stringify'](_0x2c01a2));if(_0x2c01a2['error']){if(_0x2c01a2[_0xbc26('0xe')]['code']===0x1f4){logger[_0xbc26('0xe')](_0xbc26('0xb'),_0x23e930,_0x2c01a2[_0xbc26('0xe')][_0xbc26('0xf')]);return _0x122254(_0x2c01a2[_0xbc26('0xe')][_0xbc26('0xf')]);}logger['error'](_0xbc26('0xb'),_0x23e930,_0x2c01a2[_0xbc26('0xe')][_0xbc26('0xf')]);return _0x4731a4(_0x2c01a2['error'][_0xbc26('0xf')]);}else{logger['info'](_0xbc26('0xb'),_0x23e930,_0xbc26('0xc'));_0x4731a4(_0x2c01a2['result'][_0xbc26('0xf')]);}})[_0xbc26('0x10')](function(_0x515137){logger[_0xbc26('0xe')](_0xbc26('0xb'),_0x23e930,_0x515137);_0x122254(_0x515137);});});} \ No newline at end of file +var _0x6ea8=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x42c4a1,_0xa270a0){var _0x12c702=function(_0x2e7c49){while(--_0x2e7c49){_0x42c4a1['push'](_0x42c4a1['shift']());}};_0x12c702(++_0xa270a0);}(_0x6ea8,0x85));var _0x86ea=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x6ea8[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x86ea('0x0'));var util=require(_0x86ea('0x1'));var moment=require(_0x86ea('0x2'));var BPromise=require(_0x86ea('0x3'));var rs=require(_0x86ea('0x4'));var fs=require('fs');var Redis=require(_0x86ea('0x5'));var db=require(_0x86ea('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x86ea('0x7'))(_0x86ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x86ea('0x9'));var client=jayson[_0x86ea('0xa')][_0x86ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47b18,_0x5b3628,_0x4dc175){return new BPromise(function(_0x36fff9,_0x1969b8){return client['request'](_0x47b18,_0x4dc175)[_0x86ea('0xc')](function(_0x3961a5){logger[_0x86ea('0xd')](_0x86ea('0xe'),_0x5b3628,_0x86ea('0xf'));logger['debug'](_0x86ea('0x10'),_0x5b3628,_0x86ea('0xf'),JSON['stringify'](_0x3961a5));if(_0x3961a5[_0x86ea('0x11')]){if(_0x3961a5['error'][_0x86ea('0x12')]===0x1f4){logger['error'](_0x86ea('0xe'),_0x5b3628,_0x3961a5['error'][_0x86ea('0x13')]);return _0x1969b8(_0x3961a5[_0x86ea('0x11')][_0x86ea('0x13')]);}logger[_0x86ea('0x11')](_0x86ea('0xe'),_0x5b3628,_0x3961a5[_0x86ea('0x11')]['message']);return _0x36fff9(_0x3961a5[_0x86ea('0x11')]['message']);}else{logger[_0x86ea('0xd')](_0x86ea('0xe'),_0x5b3628,_0x86ea('0xf'));_0x36fff9(_0x3961a5['result']['message']);}})[_0x86ea('0x14')](function(_0x215bbc){logger[_0x86ea('0x11')](_0x86ea('0xe'),_0x5b3628,_0x215bbc);_0x1969b8(_0x215bbc);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f848e8a..15be6f4 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 _0x979b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','destroy','exports'];(function(_0x5a7c7f,_0x589d92){var _0x3e4d35=function(_0x5ba791){while(--_0x5ba791){_0x5a7c7f['push'](_0x5a7c7f['shift']());}};_0x3e4d35(++_0x589d92);}(_0x979b,0x134));var _0xb979=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x979b[_0x46428c];return _0x16a677;};'use strict';var multer=require(_0xb979('0x0'));var util=require(_0xb979('0x1'));var path=require(_0xb979('0x2'));var timeout=require(_0xb979('0x3'));var express=require(_0xb979('0x4'));var router=express[_0xb979('0x5')]();var auth=require(_0xb979('0x6'));var interaction=require(_0xb979('0x7'));var config=require(_0xb979('0x8'));var controller=require(_0xb979('0x9'));router[_0xb979('0xa')]('/',auth[_0xb979('0xb')](),controller[_0xb979('0xc')]);router[_0xb979('0xa')](_0xb979('0xd'),auth['isAuthenticated'](),controller[_0xb979('0xe')]);router[_0xb979('0xa')]('/:id/sessions',auth[_0xb979('0xb')](),controller['getSessions']);router['get'](_0xb979('0xf'),auth['isAuthenticated'](),controller[_0xb979('0x10')]);router['get'](_0xb979('0x11'),auth[_0xb979('0xb')](),timeout(_0xb979('0x12')),controller[_0xb979('0x13')]);router[_0xb979('0x14')]('/',auth[_0xb979('0xb')](),controller[_0xb979('0x15')]);router['post'](_0xb979('0x16'),auth[_0xb979('0xb')](),controller[_0xb979('0x17')]);router[_0xb979('0x18')](_0xb979('0xd'),auth[_0xb979('0xb')](),controller[_0xb979('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb979('0x1a')]);module[_0xb979('0x1b')]=router; \ No newline at end of file +var _0xa1e2=['clone','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post'];(function(_0x5426bc,_0x44d471){var _0x92e0d7=function(_0x375761){while(--_0x375761){_0x5426bc['push'](_0x5426bc['shift']());}};_0x92e0d7(++_0x44d471);}(_0xa1e2,0xae));var _0x2a1e=function(_0x4f8052,_0x291cdc){_0x4f8052=_0x4f8052-0x0;var _0x45179d=_0xa1e2[_0x4f8052];return _0x45179d;};'use strict';var multer=require(_0x2a1e('0x0'));var util=require('util');var path=require(_0x2a1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a1e('0x2'));var router=express[_0x2a1e('0x3')]();var auth=require(_0x2a1e('0x4'));var interaction=require(_0x2a1e('0x5'));var config=require(_0x2a1e('0x6'));var controller=require(_0x2a1e('0x7'));router[_0x2a1e('0x8')]('/',auth[_0x2a1e('0x9')](),controller[_0x2a1e('0xa')]);router[_0x2a1e('0x8')](_0x2a1e('0xb'),auth[_0x2a1e('0x9')](),controller[_0x2a1e('0xc')]);router[_0x2a1e('0x8')](_0x2a1e('0xd'),auth['isAuthenticated'](),controller[_0x2a1e('0xe')]);router[_0x2a1e('0x8')](_0x2a1e('0xf'),auth[_0x2a1e('0x9')](),controller[_0x2a1e('0x10')]);router[_0x2a1e('0x8')](_0x2a1e('0x11'),auth[_0x2a1e('0x9')](),timeout(_0x2a1e('0x12')),controller[_0x2a1e('0x13')]);router['post']('/',auth[_0x2a1e('0x9')](),controller[_0x2a1e('0x14')]);router[_0x2a1e('0x15')]('/:id/clone',auth[_0x2a1e('0x9')](),controller[_0x2a1e('0x16')]);router[_0x2a1e('0x17')](_0x2a1e('0xb'),auth['isAuthenticated'](),controller[_0x2a1e('0x18')]);router[_0x2a1e('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x2a1e('0x1a')]);module[_0x2a1e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9adedf5..6e66809 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 _0xd89c=['BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd89c,0xbc));var _0xcd89=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd89c[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xcd89('0x0'));var _=require(_0xcd89('0x1'));var util=require(_0xcd89('0x2'));module[_0xcd89('0x3')]={'name':{'type':Sequelize[_0xcd89('0x4')],'unique':_0xcd89('0x5')},'description':{'type':Sequelize[_0xcd89('0x4')]},'formData':{'type':Sequelize[_0xcd89('0x6')](_0xcd89('0x7')),'set':function(_0x4ac1c1){if(_[_0xcd89('0x8')](_0x4ac1c1)){this[_0xcd89('0x9')]('formData',JSON[_0xcd89('0xa')](_0x4ac1c1));}else if(_[_0xcd89('0xb')](_0x4ac1c1)){this['setDataValue'](_0xcd89('0xc'),_0x4ac1c1);}else{this['setDataValue'](_0xcd89('0xc'),util[_0xcd89('0xd')](_0xcd89('0xe'),this['getDataValue'](_0xcd89('0x5'))||'',this['getDataValue'](_0xcd89('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcd89('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcd89('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c80=['isObjectLike','formData','stringify','isString','setDataValue','format','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x3c80,0x1d5));var _0x03c8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3c80[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x03c8('0x0'));var _=require(_0x03c8('0x1'));var util=require(_0x03c8('0x2'));module[_0x03c8('0x3')]={'name':{'type':Sequelize[_0x03c8('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x03c8('0x4')]},'formData':{'type':Sequelize[_0x03c8('0x5')](_0x03c8('0x6')),'set':function(_0x2db786){if(_[_0x03c8('0x7')](_0x2db786)){this['setDataValue'](_0x03c8('0x8'),JSON[_0x03c8('0x9')](_0x2db786));}else if(_[_0x03c8('0xa')](_0x2db786)){this['setDataValue']('formData',_0x2db786);}else{this[_0x03c8('0xb')](_0x03c8('0x8'),util[_0x03c8('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x03c8('0xd')](_0x03c8('0xe'))||'',this[_0x03c8('0xd')](_0x03c8('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x03c8('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 98309f7..b3313e2 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 _0x2e3e=['map','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','length','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','JscriptyProject','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','UserProfileSection','error','getSessions','findOne','hasOwnProperty','nolimit','ProjectId','JscriptySessionReport','getAnswers','pick','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','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','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','stack','index'];(function(_0x34558b,_0x1c7753){var _0x3fbca7=function(_0x3c557c){while(--_0x3c557c){_0x34558b['push'](_0x34558b['shift']());}};_0x3fbca7(++_0x1c7753);}(_0x2e3e,0x140));var _0xe2e3=function(_0x347b6e,_0x4c885){_0x347b6e=_0x347b6e-0x0;var _0x1b6dfc=_0x2e3e[_0x347b6e];return _0x1b6dfc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2e3('0x0'));var rimraf=require(_0xe2e3('0x1'));var zipdir=require(_0xe2e3('0x2'));var jsonpatch=require(_0xe2e3('0x3'));var rp=require(_0xe2e3('0x4'));var moment=require('moment');var BPromise=require(_0xe2e3('0x5'));var Mustache=require(_0xe2e3('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe2e3('0x7'));var ejs=require(_0xe2e3('0x8'));var fs=require('fs');var _=require(_0xe2e3('0x9'));var squel=require(_0xe2e3('0xa'));var crypto=require(_0xe2e3('0xb'));var jsforce=require(_0xe2e3('0xc'));var deskjs=require(_0xe2e3('0xd'));var toCsv=require(_0xe2e3('0x7'));var querystring=require(_0xe2e3('0xe'));var Papa=require(_0xe2e3('0xf'));var Redis=require(_0xe2e3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe2e3('0x11'));var as=require(_0xe2e3('0x12'));var hardwareService=require(_0xe2e3('0x13'));var logger=require(_0xe2e3('0x14'))(_0xe2e3('0x15'));var utils=require(_0xe2e3('0x16'));var config=require(_0xe2e3('0x17'));var licenseUtil=require(_0xe2e3('0x18'));var db=require(_0xe2e3('0x19'))['db'];function respondWithStatusCode(_0x40fd97,_0x24b64a){_0x24b64a=_0x24b64a||0xcc;return function(_0x5422ab){if(_0x5422ab){return _0x40fd97[_0xe2e3('0x1a')](_0x24b64a);}return _0x40fd97[_0xe2e3('0x1b')](_0x24b64a)['end']();};}function respondWithResult(_0x10b652,_0x14cd39){_0x14cd39=_0x14cd39||0xc8;return function(_0x3459e2){if(_0x3459e2){return _0x10b652[_0xe2e3('0x1b')](_0x14cd39)[_0xe2e3('0x1c')](_0x3459e2);}};}function respondWithFilteredResult(_0x5b0b43,_0x4afa58){return function(_0x3b1154){if(_0x3b1154){var _0x520fe2=_0x3b1154[_0xe2e3('0x1d')],_0x2e7b5b=_0x4afa58[_0xe2e3('0x1e')],_0x57b11f=_0x4afa58['offset']+_0x4afa58['limit'],_0x597c22;if(_0x57b11f>=_0x520fe2){_0x57b11f=_0x520fe2;_0x597c22=0xc8;}else{_0x597c22=0xce;}_0x5b0b43[_0xe2e3('0x1b')](_0x597c22);return _0x5b0b43[_0xe2e3('0x1f')](_0xe2e3('0x20'),_0x2e7b5b+'-'+_0x57b11f+'/'+_0x520fe2)[_0xe2e3('0x1c')](_0x3b1154);}return null;};}function patchUpdates(_0x33cdaa){return function(_0x34c445){try{jsonpatch[_0xe2e3('0x21')](_0x34c445,_0x33cdaa,!![]);}catch(_0x521227){return BPromise[_0xe2e3('0x22')](_0x521227);}return _0x34c445[_0xe2e3('0x23')]();};}function saveUpdates(_0x4890c7,_0x1316c1){return function(_0x21530e){if(_0x21530e){return _0x21530e[_0xe2e3('0x24')](_0x4890c7)[_0xe2e3('0x25')](function(_0x4b93b2){return _0x4b93b2;});}return null;};}function removeEntity(_0x221689,_0x10e0b4){return function(_0x116867){if(_0x116867){return _0x116867[_0xe2e3('0x26')]()['then'](function(){var _0x4b4865=_0x116867['get']({'plain':!![]});var _0xb327e1=_0xe2e3('0x27');return db[_0xe2e3('0x28')][_0xe2e3('0x26')]({'where':{'type':_0xb327e1,'resourceId':_0x4b4865['id']}})[_0xe2e3('0x25')](function(){return _0x116867;});})['then'](function(){_0x221689[_0xe2e3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351c3c,_0x3e6444){return function(_0x1aa0e8){if(!_0x1aa0e8){_0x351c3c[_0xe2e3('0x1a')](0x194);}return _0x1aa0e8;};}function handleError(_0x28d853,_0x2f69ef){_0x2f69ef=_0x2f69ef||0x1f4;return function(_0x86a9cc){logger['error'](_0x86a9cc[_0xe2e3('0x29')]);if(_0x86a9cc['name']){delete _0x86a9cc['name'];}_0x28d853['status'](_0x2f69ef)['send'](_0x86a9cc);};}exports[_0xe2e3('0x2a')]=function(_0x536556,_0x1280eb){var _0x40f49d={},_0x3c5608={},_0x3ec6c3={'count':0x0,'rows':[]};var _0x3c93ca=_[_0xe2e3('0x2b')](db['JscriptyProject'][_0xe2e3('0x2c')],function(_0x3cddc1){return{'name':_0x3cddc1[_0xe2e3('0x2d')],'type':_0x3cddc1[_0xe2e3('0x2e')][_0xe2e3('0x2f')]};});_0x3c5608['model']=_[_0xe2e3('0x2b')](_0x3c93ca,_0xe2e3('0x30'));_0x3c5608[_0xe2e3('0x31')]=_[_0xe2e3('0x32')](_0x536556[_0xe2e3('0x31')]);_0x3c5608[_0xe2e3('0x33')]=_['intersection'](_0x3c5608[_0xe2e3('0x34')],_0x3c5608[_0xe2e3('0x31')]);_0x40f49d[_0xe2e3('0x35')]=_[_0xe2e3('0x36')](_0x3c5608[_0xe2e3('0x34')],qs['fields'](_0x536556[_0xe2e3('0x31')]['fields']));_0x40f49d['attributes']=_0x40f49d['attributes'][_0xe2e3('0x37')]?_0x40f49d['attributes']:_0x3c5608['model'];if(!_0x536556['query']['hasOwnProperty']('nolimit')){_0x40f49d['limit']=qs[_0xe2e3('0x38')](_0x536556[_0xe2e3('0x31')][_0xe2e3('0x38')]);_0x40f49d[_0xe2e3('0x1e')]=qs['offset'](_0x536556[_0xe2e3('0x31')]['offset']);}_0x40f49d[_0xe2e3('0x39')]=qs[_0xe2e3('0x3a')](_0x536556[_0xe2e3('0x31')]['sort']);_0x40f49d[_0xe2e3('0x3b')]=qs['filters'](_['pick'](_0x536556[_0xe2e3('0x31')],_0x3c5608[_0xe2e3('0x33')]),_0x3c93ca);if(_0x536556[_0xe2e3('0x31')][_0xe2e3('0x3c')]){_0x40f49d[_0xe2e3('0x3b')]=_[_0xe2e3('0x3d')](_0x40f49d['where'],{'$or':_['map'](_0x3c93ca,function(_0x11bc50){if(_0x11bc50['type']!==_0xe2e3('0x3e')){var _0x3ea30f={};_0x3ea30f[_0x11bc50[_0xe2e3('0x30')]]={'$like':'%'+_0x536556[_0xe2e3('0x31')][_0xe2e3('0x3c')]+'%'};return _0x3ea30f;}})});}_0x40f49d=_[_0xe2e3('0x3d')]({},_0x40f49d,_0x536556[_0xe2e3('0x3f')]);var _0x1b9633={'where':_0x40f49d[_0xe2e3('0x3b')]};return db['JscriptyProject']['count'](_0x1b9633)[_0xe2e3('0x25')](function(_0x57218b){_0x3ec6c3[_0xe2e3('0x1d')]=_0x57218b;if(_0x536556[_0xe2e3('0x31')][_0xe2e3('0x40')]){_0x40f49d[_0xe2e3('0x41')]=[{'all':!![]}];}return db['JscriptyProject'][_0xe2e3('0x42')](_0x40f49d);})[_0xe2e3('0x25')](function(_0x3316b8){_0x3ec6c3[_0xe2e3('0x43')]=_0x3316b8;return _0x3ec6c3;})[_0xe2e3('0x25')](respondWithFilteredResult(_0x1280eb,_0x40f49d))[_0xe2e3('0x44')](handleError(_0x1280eb,null));};exports[_0xe2e3('0x45')]=function(_0x66b92a,_0x3a23ac){var _0xc40f74={'raw':![],'where':{'id':_0x66b92a[_0xe2e3('0x46')]['id']}},_0x44babe={};_0x44babe[_0xe2e3('0x34')]=_[_0xe2e3('0x32')](db['JscriptyProject']['rawAttributes']);_0x44babe[_0xe2e3('0x31')]=_[_0xe2e3('0x32')](_0x66b92a[_0xe2e3('0x31')]);_0x44babe[_0xe2e3('0x33')]=_[_0xe2e3('0x36')](_0x44babe[_0xe2e3('0x34')],_0x44babe[_0xe2e3('0x31')]);_0xc40f74[_0xe2e3('0x35')]=_[_0xe2e3('0x36')](_0x44babe[_0xe2e3('0x34')],qs['fields'](_0x66b92a[_0xe2e3('0x31')][_0xe2e3('0x47')]));_0xc40f74[_0xe2e3('0x35')]=_0xc40f74[_0xe2e3('0x35')][_0xe2e3('0x37')]?_0xc40f74[_0xe2e3('0x35')]:_0x44babe[_0xe2e3('0x34')];if(_0x66b92a[_0xe2e3('0x31')][_0xe2e3('0x40')]){_0xc40f74[_0xe2e3('0x41')]=[{'all':!![]}];}_0xc40f74=_['merge']({},_0xc40f74,_0x66b92a[_0xe2e3('0x3f')]);return db[_0xe2e3('0x48')][_0xe2e3('0x49')](_0xc40f74)[_0xe2e3('0x25')](handleEntityNotFound(_0x3a23ac,null))[_0xe2e3('0x25')](respondWithResult(_0x3a23ac,null))[_0xe2e3('0x44')](handleError(_0x3a23ac,null));};exports['create']=function(_0x46d078,_0x168fc0){return db['JscriptyProject'][_0xe2e3('0x4a')](_0x46d078[_0xe2e3('0x4b')],{})[_0xe2e3('0x25')](function(_0x249c2b){var _0xbc7fa7=_0x46d078[_0xe2e3('0x4c')][_0xe2e3('0x4d')]({'plain':!![]});if(!_0xbc7fa7)throw new Error(_0xe2e3('0x4e'));if(_0xbc7fa7[_0xe2e3('0x4f')]===_0xe2e3('0x4c')){var _0xb32a26=_0x249c2b[_0xe2e3('0x4d')]({'plain':!![]});var _0x3eb4e1=_0xe2e3('0x27');return db['UserProfileSection'][_0xe2e3('0x49')]({'where':{'name':_0x3eb4e1,'userProfileId':_0xbc7fa7[_0xe2e3('0x50')]},'raw':!![]})['then'](function(_0x20fd57){if(_0x20fd57&&_0x20fd57['autoAssociation']===0x0){return db[_0xe2e3('0x28')][_0xe2e3('0x4a')]({'name':_0xb32a26[_0xe2e3('0x30')],'resourceId':_0xb32a26['id'],'type':_0x20fd57[_0xe2e3('0x30')],'sectionId':_0x20fd57['id']},{})[_0xe2e3('0x25')](function(){return _0x249c2b;});}else{return _0x249c2b;}})[_0xe2e3('0x44')](function(_0x586270){logger['error'](_0xe2e3('0x51'),_0x586270);throw _0x586270;});}return _0x249c2b;})['then'](respondWithResult(_0x168fc0,0xc9))[_0xe2e3('0x44')](handleError(_0x168fc0,null));};exports['clone']=function(_0xfe1e79,_0x2e880d){var _0x3abfea={'where':{'id':_0xfe1e79[_0xe2e3('0x46')]['id']}},_0x425c4f={};_0x425c4f['model']=_['keys'](db[_0xe2e3('0x48')][_0xe2e3('0x2c')]);_0x3abfea[_0xe2e3('0x35')]=_[_0xe2e3('0x36')](_0x425c4f[_0xe2e3('0x34')],qs['fields'](_0xfe1e79['query'][_0xe2e3('0x47')]));_0x3abfea[_0xe2e3('0x35')]=_0x3abfea[_0xe2e3('0x35')][_0xe2e3('0x37')]?_0x3abfea[_0xe2e3('0x35')]:_0x425c4f[_0xe2e3('0x34')];if(_0xfe1e79[_0xe2e3('0x31')][_0xe2e3('0x40')]){_0x3abfea['include']=[{'all':!![]}];}_0x3abfea=_[_0xe2e3('0x3d')]({},_0x3abfea,_0xfe1e79[_0xe2e3('0x3f')]);return db['JscriptyProject'][_0xe2e3('0x49')](_0x3abfea)[_0xe2e3('0x25')](handleEntityNotFound(_0x2e880d,null))[_0xe2e3('0x25')](function(_0x7a67f5){if(_0x7a67f5){var _0x5816b9=_0x7a67f5[_0xe2e3('0x4d')]({'plain':!![]});_0x5816b9=qs['omit'](_0x5816b9,['id',_0xe2e3('0x52'),_0xe2e3('0x53')]);_0xfe1e79[_0xe2e3('0x4b')]=_['omit'](_0xfe1e79['body'],['id',_0xe2e3('0x52'),_0xe2e3('0x53')]);return db[_0xe2e3('0x48')][_0xe2e3('0x4a')](_[_0xe2e3('0x3d')](_0x5816b9,_0xfe1e79[_0xe2e3('0x4b')]),{'include':_0xfe1e79['query'][_0xe2e3('0x40')]?[{'all':!![]}]:undefined})[_0xe2e3('0x25')](function(_0x42ee87){var _0x563cc3=_0xfe1e79[_0xe2e3('0x4c')][_0xe2e3('0x4d')]({'plain':!![]});if(!_0x563cc3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x563cc3[_0xe2e3('0x4f')]===_0xe2e3('0x4c')){var _0x35a876=_0x42ee87[_0xe2e3('0x4d')]({'plain':!![]});var _0x167ee5=_0xe2e3('0x27');return db[_0xe2e3('0x54')][_0xe2e3('0x49')]({'where':{'name':_0x167ee5,'userProfileId':_0x563cc3['userProfileId']},'raw':!![]})[_0xe2e3('0x25')](function(_0xd80964){if(_0xd80964&&_0xd80964['autoAssociation']===0x0){return db[_0xe2e3('0x28')][_0xe2e3('0x4a')]({'name':_0x35a876[_0xe2e3('0x30')],'resourceId':_0x35a876['id'],'type':_0xd80964[_0xe2e3('0x30')],'sectionId':_0xd80964['id']},{})[_0xe2e3('0x25')](function(){return _0x42ee87;});}else{return _0x42ee87;}})['catch'](function(_0x527bbc){logger[_0xe2e3('0x55')](_0xe2e3('0x51'),_0x527bbc);throw _0x527bbc;});}return _0x42ee87;});}})[_0xe2e3('0x25')](respondWithResult(_0x2e880d,0xc9))[_0xe2e3('0x44')](handleError(_0x2e880d,null));};exports[_0xe2e3('0x24')]=function(_0x7b1c48,_0x199f73){if(_0x7b1c48[_0xe2e3('0x4b')]['id']){delete _0x7b1c48[_0xe2e3('0x4b')]['id'];}return db[_0xe2e3('0x48')][_0xe2e3('0x49')]({'where':{'id':_0x7b1c48['params']['id']}})[_0xe2e3('0x25')](handleEntityNotFound(_0x199f73,null))[_0xe2e3('0x25')](saveUpdates(_0x7b1c48['body'],null))['then'](respondWithResult(_0x199f73,null))[_0xe2e3('0x44')](handleError(_0x199f73,null));};exports[_0xe2e3('0x26')]=function(_0xbfbb9e,_0x3af8b8){return db[_0xe2e3('0x48')][_0xe2e3('0x49')]({'where':{'id':_0xbfbb9e[_0xe2e3('0x46')]['id']}})[_0xe2e3('0x25')](handleEntityNotFound(_0x3af8b8,null))[_0xe2e3('0x25')](removeEntity(_0x3af8b8,null))[_0xe2e3('0x44')](handleError(_0x3af8b8,null));};exports[_0xe2e3('0x56')]=function(_0xb44ed9,_0x33b405,_0x1d9af5){var _0x4b3585={'raw':!![],'where':{}};var _0x5d3b7a={};var _0x112b01={'count':0x0,'rows':[]};return db[_0xe2e3('0x48')][_0xe2e3('0x57')]({'where':{'id':_0xb44ed9[_0xe2e3('0x46')]['id']}})[_0xe2e3('0x25')](handleEntityNotFound(_0x33b405,null))[_0xe2e3('0x25')](function(_0xb9e62f){if(_0xb9e62f){_0x5d3b7a[_0xe2e3('0x34')]=_['keys'](db['JscriptySessionReport'][_0xe2e3('0x2c')]);_0x5d3b7a[_0xe2e3('0x31')]=_[_0xe2e3('0x32')](_0xb44ed9[_0xe2e3('0x31')]);_0x5d3b7a[_0xe2e3('0x33')]=_['intersection'](_0x5d3b7a[_0xe2e3('0x34')],_0x5d3b7a[_0xe2e3('0x31')]);_0x4b3585[_0xe2e3('0x35')]=_[_0xe2e3('0x36')](_0x5d3b7a[_0xe2e3('0x34')],qs[_0xe2e3('0x47')](_0xb44ed9[_0xe2e3('0x31')][_0xe2e3('0x47')]));_0x4b3585['attributes']=_0x4b3585[_0xe2e3('0x35')]['length']?_0x4b3585[_0xe2e3('0x35')]:_0x5d3b7a[_0xe2e3('0x34')];if(!_0xb44ed9[_0xe2e3('0x31')][_0xe2e3('0x58')](_0xe2e3('0x59'))){_0x4b3585[_0xe2e3('0x38')]=qs['limit'](_0xb44ed9[_0xe2e3('0x31')]['limit']);_0x4b3585['offset']=qs[_0xe2e3('0x1e')](_0xb44ed9[_0xe2e3('0x31')][_0xe2e3('0x1e')]);}_0x4b3585[_0xe2e3('0x39')]=qs[_0xe2e3('0x3a')](_0xb44ed9[_0xe2e3('0x31')][_0xe2e3('0x3a')]);_0x4b3585[_0xe2e3('0x3b')]=qs[_0xe2e3('0x33')](_['pick'](_0xb44ed9['query'],_0x5d3b7a['filters']));_0x4b3585[_0xe2e3('0x3b')][_0xe2e3('0x5a')]=_0xb9e62f['id'];if(_0xb44ed9[_0xe2e3('0x31')][_0xe2e3('0x3c')]){_0x4b3585[_0xe2e3('0x3b')]=_[_0xe2e3('0x3d')](_0x4b3585[_0xe2e3('0x3b')],{'$or':_[_0xe2e3('0x2b')](_0x4b3585[_0xe2e3('0x35')],function(_0x30a30d){var _0x3b4316={};_0x3b4316[_0x30a30d]={'$like':'%'+_0xb44ed9[_0xe2e3('0x31')]['filter']+'%'};return _0x3b4316;})});}_0x4b3585=_[_0xe2e3('0x3d')]({},_0x4b3585,_0xb44ed9[_0xe2e3('0x3f')]);return db[_0xe2e3('0x5b')][_0xe2e3('0x1d')]({'where':_0x4b3585[_0xe2e3('0x3b')]})[_0xe2e3('0x25')](function(_0x57a835){_0x112b01[_0xe2e3('0x1d')]=_0x57a835;if(_0xb44ed9[_0xe2e3('0x31')]['includeAll']){_0x4b3585[_0xe2e3('0x41')]=[{'all':!![]}];}return db[_0xe2e3('0x5b')][_0xe2e3('0x42')](_0x4b3585);})[_0xe2e3('0x25')](function(_0x471089){_0x112b01[_0xe2e3('0x43')]=_0x471089;return _0x112b01;});}})[_0xe2e3('0x25')](respondWithFilteredResult(_0x33b405,_0x4b3585))[_0xe2e3('0x44')](handleError(_0x33b405,null));};exports[_0xe2e3('0x5c')]=function(_0x26313c,_0x172abf,_0x2b1d28){var _0x1832d4={'raw':!![],'where':{}};var _0x1fc0c2={};var _0x592c46={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe2e3('0x57')]({'where':{'id':_0x26313c[_0xe2e3('0x46')]['id']}})[_0xe2e3('0x25')](handleEntityNotFound(_0x172abf,null))[_0xe2e3('0x25')](function(_0x3816cf){if(_0x3816cf){_0x1fc0c2['model']=_[_0xe2e3('0x32')](db['JscriptyAnswerReport'][_0xe2e3('0x2c')]);_0x1fc0c2[_0xe2e3('0x31')]=_[_0xe2e3('0x32')](_0x26313c[_0xe2e3('0x31')]);_0x1fc0c2[_0xe2e3('0x33')]=_['intersection'](_0x1fc0c2[_0xe2e3('0x34')],_0x1fc0c2[_0xe2e3('0x31')]);_0x1832d4[_0xe2e3('0x35')]=_[_0xe2e3('0x36')](_0x1fc0c2[_0xe2e3('0x34')],qs[_0xe2e3('0x47')](_0x26313c[_0xe2e3('0x31')][_0xe2e3('0x47')]));_0x1832d4['attributes']=_0x1832d4[_0xe2e3('0x35')][_0xe2e3('0x37')]?_0x1832d4['attributes']:_0x1fc0c2['model'];if(!_0x26313c[_0xe2e3('0x31')][_0xe2e3('0x58')](_0xe2e3('0x59'))){_0x1832d4[_0xe2e3('0x38')]=qs['limit'](_0x26313c[_0xe2e3('0x31')][_0xe2e3('0x38')]);_0x1832d4['offset']=qs[_0xe2e3('0x1e')](_0x26313c[_0xe2e3('0x31')][_0xe2e3('0x1e')]);}_0x1832d4[_0xe2e3('0x39')]=qs[_0xe2e3('0x3a')](_0x26313c[_0xe2e3('0x31')][_0xe2e3('0x3a')]);_0x1832d4[_0xe2e3('0x3b')]=qs[_0xe2e3('0x33')](_[_0xe2e3('0x5d')](_0x26313c[_0xe2e3('0x31')],_0x1fc0c2[_0xe2e3('0x33')]));_0x1832d4['where']['ProjectId']=_0x3816cf['id'];if(_0x26313c['query']['filter']){_0x1832d4[_0xe2e3('0x3b')]=_[_0xe2e3('0x3d')](_0x1832d4[_0xe2e3('0x3b')],{'$or':_[_0xe2e3('0x2b')](_0x1832d4['attributes'],function(_0xa5baf7){var _0x4de283={};_0x4de283[_0xa5baf7]={'$like':'%'+_0x26313c[_0xe2e3('0x31')]['filter']+'%'};return _0x4de283;})});}_0x1832d4=_[_0xe2e3('0x3d')]({},_0x1832d4,_0x26313c[_0xe2e3('0x3f')]);return db['JscriptyAnswerReport'][_0xe2e3('0x1d')]({'where':_0x1832d4[_0xe2e3('0x3b')]})['then'](function(_0x45602e){_0x592c46[_0xe2e3('0x1d')]=_0x45602e;if(_0x26313c['query'][_0xe2e3('0x40')]){_0x1832d4[_0xe2e3('0x41')]=[{'all':!![]}];}return db[_0xe2e3('0x5e')][_0xe2e3('0x42')](_0x1832d4);})[_0xe2e3('0x25')](function(_0x366b5d){_0x592c46['rows']=_0x366b5d;return _0x592c46;});}})[_0xe2e3('0x25')](respondWithFilteredResult(_0x172abf,_0x1832d4))[_0xe2e3('0x44')](handleError(_0x172abf,null));};function char(_0x376ba2){return'number'===typeof _0x376ba2?String[_0xe2e3('0x5f')][_0xe2e3('0x21')](null,arguments):_0x376ba2;}function needsEncapsulation(_0x2db18a){return!!_0x2db18a&&(_0x2db18a[_0xe2e3('0x60')]()['indexOf'](char(0xd))>=0x0||_0x2db18a[_0xe2e3('0x60')]()['indexOf'](char(0xa))>=0x0||_0x2db18a[_0xe2e3('0x60')]()[_0xe2e3('0x61')](char(0x2c))>=0x0||_0x2db18a[_0xe2e3('0x60')]()[_0xe2e3('0x61')](char(0x22))>=0x0);}function encapsulate(_0x2e54e){var _0x41726e=char(0x22),_0x512628='\x5c'+char(0x22),_0x3f18b8=_0x2e54e['toString']()[_0xe2e3('0x62')](new RegExp(_0x41726e,'g'),_0x512628);return _0x41726e+_0x3f18b8+_0x41726e;}exports[_0xe2e3('0x63')]=function(_0x169818,_0x52e784,_0x1df784){var _0x3354e8,_0xa61a9e;var _0x7cd34b={'where':{'ProjectId':_0x169818['params']['id']}};if(_0x169818[_0xe2e3('0x31')]['startTime']){_0x7cd34b[_0xe2e3('0x3b')]['starttime']=JSON[_0xe2e3('0x64')](_0x169818[_0xe2e3('0x31')][_0xe2e3('0x65')]);}return db[_0xe2e3('0x5b')][_0xe2e3('0x42')](_0x7cd34b)[_0xe2e3('0x25')](handleEntityNotFound(_0x52e784,null))[_0xe2e3('0x25')](function(_0x38365d){if(_0x38365d){_0x3354e8=_0x38365d;return db['JscriptyQuestionReport'][_0xe2e3('0x42')]({'where':{'SessionId':{'$in':_[_0xe2e3('0x2b')](_0x3354e8,'id')},'ProjectId':_0x169818[_0xe2e3('0x46')]['id']},'order':_0xe2e3('0x66')});}})[_0xe2e3('0x25')](handleEntityNotFound(_0x52e784,null))[_0xe2e3('0x25')](function(_0x3b79a4){if(_0x3b79a4){_0xa61a9e=_0x3b79a4;var _0x11efea={};for(var _0x2d9612=0x0,_0x120a95=_0xa61a9e[_0xe2e3('0x37')];_0x2d9612<_0x120a95;_0x2d9612++){if(!_0x11efea[_0xe2e3('0x58')](_0xa61a9e[_0x2d9612][_0xe2e3('0x67')])){_0x11efea[_0xa61a9e[_0x2d9612][_0xe2e3('0x67')]]=needsEncapsulation(_0xa61a9e[_0x2d9612][_0xe2e3('0x68')])?encapsulate(_0xa61a9e[_0x2d9612][_0xe2e3('0x68')]):_0xa61a9e[_0x2d9612][_0xe2e3('0x68')];}}var _0x25ea2f=[],_0x55ac4c={};for(var _0x5c6015=0x0,_0x2fe13f=_0x3354e8[_0xe2e3('0x37')];_0x5c6015<_0x2fe13f;_0x5c6015++){_0x55ac4c={'ProjectId':_0x169818[_0xe2e3('0x46')]['id'],'SessionId':_0x3354e8[_0x5c6015]['id'],'StartTime':moment(_0x3354e8[_0x5c6015][_0xe2e3('0x69')])[_0xe2e3('0x6a')](_0xe2e3('0x6b'))};for(var _0x1134c7=0x0,_0x576a54=_0xa61a9e[_0xe2e3('0x37')];_0x1134c7<_0x576a54;_0x1134c7++){if(_0xa61a9e[_0x1134c7][_0xe2e3('0x6c')]==_0x3354e8[_0x5c6015]['id']&&_0x11efea[_0xe2e3('0x58')](_0xa61a9e[_0x1134c7][_0xe2e3('0x67')])){_0x55ac4c[_0x11efea[_0xa61a9e[_0x1134c7]['questionId']]]=_0xa61a9e[_0x1134c7][_0xe2e3('0x6d')];}}for(var _0x47e286 in _0x11efea){if(!_0x55ac4c[_0xe2e3('0x58')](_0x11efea[_0x47e286])){_0x55ac4c[_0x11efea[_0x47e286]]=null;}}_0x25ea2f[_0xe2e3('0x6e')](_0x55ac4c);}return _0x25ea2f;}})[_0xe2e3('0x25')](function(_0xad7b9c){if(!_[_0xe2e3('0x6f')](_0xad7b9c)){var _0x22883e=toCsv(_0xad7b9c);var _0x44a7fe=Date[_0xe2e3('0x70')]();fs[_0xe2e3('0x71')](util[_0xe2e3('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x169818[_0xe2e3('0x46')]['id'],_0x44a7fe),_0x22883e);_0x52e784['setHeader'](_0xe2e3('0x72'),_0xe2e3('0x73')+util['format'](_0xe2e3('0x74'),_0x169818['params']['id'],_0x44a7fe));_0x52e784[_0xe2e3('0x75')](_0xe2e3('0x76'),_0xe2e3('0x77'));return _0x52e784['download'](util[_0xe2e3('0x6a')](_0xe2e3('0x78'),_0x169818[_0xe2e3('0x46')]['id'],_0x44a7fe));}else{return _0x52e784['sendStatus'](0xcc);}})[_0xe2e3('0x44')](handleError(_0x52e784,null));}; \ No newline at end of file +var _0x0d63=['questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','get','UserProfileResource','error','stack','index','map','JscriptyProject','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','updatedAt','body','UserProfileSection','destroy','getSessions','findOne','JscriptySessionReport','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt'];(function(_0xbbcdf6,_0x4ee2d8){var _0x1abc46=function(_0x4002fa){while(--_0x4002fa){_0xbbcdf6['push'](_0xbbcdf6['shift']());}};_0x1abc46(++_0x4ee2d8);}(_0x0d63,0x1e3));var _0x30d6=function(_0x14329a,_0x388b7a){_0x14329a=_0x14329a-0x0;var _0x2f8e3d=_0x0d63[_0x14329a];return _0x2f8e3d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x30d6('0x0'));var rimraf=require(_0x30d6('0x1'));var zipdir=require(_0x30d6('0x2'));var jsonpatch=require(_0x30d6('0x3'));var rp=require(_0x30d6('0x4'));var moment=require(_0x30d6('0x5'));var BPromise=require(_0x30d6('0x6'));var Mustache=require(_0x30d6('0x7'));var util=require(_0x30d6('0x8'));var path=require('path');var sox=require(_0x30d6('0x9'));var csv=require('to-csv');var ejs=require(_0x30d6('0xa'));var fs=require('fs');var _=require(_0x30d6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30d6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x30d6('0xd'));var Papa=require(_0x30d6('0xe'));var Redis=require(_0x30d6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x30d6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30d6('0x11'));var logger=require(_0x30d6('0x12'))(_0x30d6('0x13'));var utils=require(_0x30d6('0x14'));var config=require(_0x30d6('0x15'));var licenseUtil=require(_0x30d6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c3877,_0x1c4fa9){_0x1c4fa9=_0x1c4fa9||0xcc;return function(_0x2966a1){if(_0x2966a1){return _0x1c3877[_0x30d6('0x17')](_0x1c4fa9);}return _0x1c3877['status'](_0x1c4fa9)[_0x30d6('0x18')]();};}function respondWithResult(_0x116e70,_0x1e42d3){_0x1e42d3=_0x1e42d3||0xc8;return function(_0x25b2b9){if(_0x25b2b9){return _0x116e70['status'](_0x1e42d3)[_0x30d6('0x19')](_0x25b2b9);}};}function respondWithFilteredResult(_0x34b19c,_0x2ef849){return function(_0x5d4b42){if(_0x5d4b42){var _0x5ca3ef=_0x5d4b42[_0x30d6('0x1a')],_0x17ba06=_0x2ef849[_0x30d6('0x1b')],_0x8b4cdf=_0x2ef849[_0x30d6('0x1b')]+_0x2ef849[_0x30d6('0x1c')],_0x538c39;if(_0x8b4cdf>=_0x5ca3ef){_0x8b4cdf=_0x5ca3ef;_0x538c39=0xc8;}else{_0x538c39=0xce;}_0x34b19c[_0x30d6('0x1d')](_0x538c39);return _0x34b19c[_0x30d6('0x1e')](_0x30d6('0x1f'),_0x17ba06+'-'+_0x8b4cdf+'/'+_0x5ca3ef)[_0x30d6('0x19')](_0x5d4b42);}return null;};}function patchUpdates(_0x156c4d){return function(_0x4f246f){try{jsonpatch[_0x30d6('0x20')](_0x4f246f,_0x156c4d,!![]);}catch(_0x33297b){return BPromise[_0x30d6('0x21')](_0x33297b);}return _0x4f246f['save']();};}function saveUpdates(_0x4ba1c4,_0x172cc2){return function(_0x38220f){if(_0x38220f){return _0x38220f[_0x30d6('0x22')](_0x4ba1c4)[_0x30d6('0x23')](function(_0x46feaa){return _0x46feaa;});}return null;};}function removeEntity(_0x4eccef,_0x32a5a7){return function(_0xb4fba2){if(_0xb4fba2){return _0xb4fba2['destroy']()[_0x30d6('0x23')](function(){var _0x39d671=_0xb4fba2[_0x30d6('0x24')]({'plain':!![]});var _0x24b44f='Projects';return db[_0x30d6('0x25')]['destroy']({'where':{'type':_0x24b44f,'resourceId':_0x39d671['id']}})[_0x30d6('0x23')](function(){return _0xb4fba2;});})[_0x30d6('0x23')](function(){_0x4eccef[_0x30d6('0x1d')](0xcc)[_0x30d6('0x18')]();});}};}function handleEntityNotFound(_0x93be22,_0x44cb19){return function(_0xdf2717){if(!_0xdf2717){_0x93be22[_0x30d6('0x17')](0x194);}return _0xdf2717;};}function handleError(_0x44631c,_0x36f915){_0x36f915=_0x36f915||0x1f4;return function(_0x2c96bd){logger[_0x30d6('0x26')](_0x2c96bd[_0x30d6('0x27')]);if(_0x2c96bd['name']){delete _0x2c96bd['name'];}_0x44631c['status'](_0x36f915)['send'](_0x2c96bd);};}exports[_0x30d6('0x28')]=function(_0x4b7c78,_0x4644da){var _0x328caa={},_0x16dba2={},_0x4a7093={'count':0x0,'rows':[]};var _0x50eb95=_[_0x30d6('0x29')](db[_0x30d6('0x2a')]['rawAttributes'],function(_0x35b97d){return{'name':_0x35b97d[_0x30d6('0x2b')],'type':_0x35b97d['type']['key']};});_0x16dba2[_0x30d6('0x2c')]=_['map'](_0x50eb95,_0x30d6('0x2d'));_0x16dba2[_0x30d6('0x2e')]=_[_0x30d6('0x2f')](_0x4b7c78[_0x30d6('0x2e')]);_0x16dba2[_0x30d6('0x30')]=_[_0x30d6('0x31')](_0x16dba2[_0x30d6('0x2c')],_0x16dba2[_0x30d6('0x2e')]);_0x328caa['attributes']=_[_0x30d6('0x31')](_0x16dba2[_0x30d6('0x2c')],qs[_0x30d6('0x32')](_0x4b7c78[_0x30d6('0x2e')][_0x30d6('0x32')]));_0x328caa[_0x30d6('0x33')]=_0x328caa[_0x30d6('0x33')][_0x30d6('0x34')]?_0x328caa['attributes']:_0x16dba2['model'];if(!_0x4b7c78[_0x30d6('0x2e')][_0x30d6('0x35')](_0x30d6('0x36'))){_0x328caa['limit']=qs[_0x30d6('0x1c')](_0x4b7c78[_0x30d6('0x2e')]['limit']);_0x328caa[_0x30d6('0x1b')]=qs['offset'](_0x4b7c78['query'][_0x30d6('0x1b')]);}_0x328caa['order']=qs[_0x30d6('0x37')](_0x4b7c78['query'][_0x30d6('0x37')]);_0x328caa[_0x30d6('0x38')]=qs[_0x30d6('0x30')](_[_0x30d6('0x39')](_0x4b7c78[_0x30d6('0x2e')],_0x16dba2['filters']),_0x50eb95);if(_0x4b7c78['query'][_0x30d6('0x3a')]){_0x328caa[_0x30d6('0x38')]=_[_0x30d6('0x3b')](_0x328caa[_0x30d6('0x38')],{'$or':_[_0x30d6('0x29')](_0x50eb95,function(_0x2c11c7){if(_0x2c11c7[_0x30d6('0x3c')]!==_0x30d6('0x3d')){var _0x1c5086={};_0x1c5086[_0x2c11c7[_0x30d6('0x2d')]]={'$like':'%'+_0x4b7c78[_0x30d6('0x2e')][_0x30d6('0x3a')]+'%'};return _0x1c5086;}})});}_0x328caa=_['merge']({},_0x328caa,_0x4b7c78[_0x30d6('0x3e')]);var _0x31430b={'where':_0x328caa[_0x30d6('0x38')]};return db[_0x30d6('0x2a')][_0x30d6('0x1a')](_0x31430b)[_0x30d6('0x23')](function(_0x432467){_0x4a7093[_0x30d6('0x1a')]=_0x432467;if(_0x4b7c78[_0x30d6('0x2e')][_0x30d6('0x3f')]){_0x328caa[_0x30d6('0x40')]=[{'all':!![]}];}return db[_0x30d6('0x2a')][_0x30d6('0x41')](_0x328caa);})['then'](function(_0x71b3ab){_0x4a7093['rows']=_0x71b3ab;return _0x4a7093;})[_0x30d6('0x23')](respondWithFilteredResult(_0x4644da,_0x328caa))[_0x30d6('0x42')](handleError(_0x4644da,null));};exports[_0x30d6('0x43')]=function(_0x2b8ffe,_0xc3a0d6){var _0x4ab904={'raw':![],'where':{'id':_0x2b8ffe[_0x30d6('0x44')]['id']}},_0x1d68b8={};_0x1d68b8['model']=_[_0x30d6('0x2f')](db[_0x30d6('0x2a')][_0x30d6('0x45')]);_0x1d68b8[_0x30d6('0x2e')]=_[_0x30d6('0x2f')](_0x2b8ffe[_0x30d6('0x2e')]);_0x1d68b8[_0x30d6('0x30')]=_[_0x30d6('0x31')](_0x1d68b8[_0x30d6('0x2c')],_0x1d68b8[_0x30d6('0x2e')]);_0x4ab904[_0x30d6('0x33')]=_[_0x30d6('0x31')](_0x1d68b8[_0x30d6('0x2c')],qs[_0x30d6('0x32')](_0x2b8ffe[_0x30d6('0x2e')]['fields']));_0x4ab904[_0x30d6('0x33')]=_0x4ab904[_0x30d6('0x33')][_0x30d6('0x34')]?_0x4ab904[_0x30d6('0x33')]:_0x1d68b8[_0x30d6('0x2c')];if(_0x2b8ffe[_0x30d6('0x2e')][_0x30d6('0x3f')]){_0x4ab904[_0x30d6('0x40')]=[{'all':!![]}];}_0x4ab904=_[_0x30d6('0x3b')]({},_0x4ab904,_0x2b8ffe[_0x30d6('0x3e')]);return db[_0x30d6('0x2a')][_0x30d6('0x46')](_0x4ab904)[_0x30d6('0x23')](handleEntityNotFound(_0xc3a0d6,null))[_0x30d6('0x23')](respondWithResult(_0xc3a0d6,null))[_0x30d6('0x42')](handleError(_0xc3a0d6,null));};exports[_0x30d6('0x47')]=function(_0x2532fc,_0x4e1eff){return db['JscriptyProject'][_0x30d6('0x47')](_0x2532fc['body'],{})[_0x30d6('0x23')](function(_0x312365){var _0x22926d=_0x2532fc['user'][_0x30d6('0x24')]({'plain':!![]});if(!_0x22926d)throw new Error(_0x30d6('0x48'));if(_0x22926d[_0x30d6('0x49')]===_0x30d6('0x4a')){var _0x3d22b1=_0x312365[_0x30d6('0x24')]({'plain':!![]});var _0x4b1721=_0x30d6('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x4b1721,'userProfileId':_0x22926d[_0x30d6('0x4c')]},'raw':!![]})[_0x30d6('0x23')](function(_0x404879){if(_0x404879&&_0x404879[_0x30d6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x3d22b1['name'],'resourceId':_0x3d22b1['id'],'type':_0x404879[_0x30d6('0x2d')],'sectionId':_0x404879['id']},{})['then'](function(){return _0x312365;});}else{return _0x312365;}})[_0x30d6('0x42')](function(_0x221527){logger[_0x30d6('0x26')](_0x30d6('0x4e'),_0x221527);throw _0x221527;});}return _0x312365;})[_0x30d6('0x23')](respondWithResult(_0x4e1eff,0xc9))['catch'](handleError(_0x4e1eff,null));};exports['clone']=function(_0x7cb310,_0x19b5b){var _0x251a25={'where':{'id':_0x7cb310[_0x30d6('0x44')]['id']}},_0xcdc8a4={};_0xcdc8a4[_0x30d6('0x2c')]=_[_0x30d6('0x2f')](db[_0x30d6('0x2a')][_0x30d6('0x45')]);_0x251a25[_0x30d6('0x33')]=_['intersection'](_0xcdc8a4[_0x30d6('0x2c')],qs[_0x30d6('0x32')](_0x7cb310[_0x30d6('0x2e')][_0x30d6('0x32')]));_0x251a25['attributes']=_0x251a25['attributes']['length']?_0x251a25[_0x30d6('0x33')]:_0xcdc8a4[_0x30d6('0x2c')];if(_0x7cb310[_0x30d6('0x2e')][_0x30d6('0x3f')]){_0x251a25[_0x30d6('0x40')]=[{'all':!![]}];}_0x251a25=_[_0x30d6('0x3b')]({},_0x251a25,_0x7cb310['options']);return db[_0x30d6('0x2a')][_0x30d6('0x46')](_0x251a25)['then'](handleEntityNotFound(_0x19b5b,null))[_0x30d6('0x23')](function(_0x6b4f53){if(_0x6b4f53){var _0x50bf9b=_0x6b4f53[_0x30d6('0x24')]({'plain':!![]});_0x50bf9b=qs['omit'](_0x50bf9b,['id','createdAt',_0x30d6('0x4f')]);_0x7cb310['body']=_['omit'](_0x7cb310[_0x30d6('0x50')],['id','createdAt',_0x30d6('0x4f')]);return db[_0x30d6('0x2a')]['create'](_[_0x30d6('0x3b')](_0x50bf9b,_0x7cb310[_0x30d6('0x50')]),{'include':_0x7cb310[_0x30d6('0x2e')][_0x30d6('0x3f')]?[{'all':!![]}]:undefined})[_0x30d6('0x23')](function(_0xe1dd71){var _0x5c9d32=_0x7cb310[_0x30d6('0x4a')][_0x30d6('0x24')]({'plain':!![]});if(!_0x5c9d32)throw new Error(_0x30d6('0x48'));if(_0x5c9d32[_0x30d6('0x49')]===_0x30d6('0x4a')){var _0x53ded2=_0xe1dd71['get']({'plain':!![]});var _0x18c52f=_0x30d6('0x4b');return db[_0x30d6('0x51')][_0x30d6('0x46')]({'where':{'name':_0x18c52f,'userProfileId':_0x5c9d32[_0x30d6('0x4c')]},'raw':!![]})[_0x30d6('0x23')](function(_0x2226ce){if(_0x2226ce&&_0x2226ce['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x53ded2['name'],'resourceId':_0x53ded2['id'],'type':_0x2226ce[_0x30d6('0x2d')],'sectionId':_0x2226ce['id']},{})[_0x30d6('0x23')](function(){return _0xe1dd71;});}else{return _0xe1dd71;}})[_0x30d6('0x42')](function(_0x1f3d98){logger['error'](_0x30d6('0x4e'),_0x1f3d98);throw _0x1f3d98;});}return _0xe1dd71;});}})[_0x30d6('0x23')](respondWithResult(_0x19b5b,0xc9))[_0x30d6('0x42')](handleError(_0x19b5b,null));};exports[_0x30d6('0x22')]=function(_0x441aed,_0x16b7e3){if(_0x441aed['body']['id']){delete _0x441aed[_0x30d6('0x50')]['id'];}return db['JscriptyProject'][_0x30d6('0x46')]({'where':{'id':_0x441aed[_0x30d6('0x44')]['id']}})[_0x30d6('0x23')](handleEntityNotFound(_0x16b7e3,null))[_0x30d6('0x23')](saveUpdates(_0x441aed[_0x30d6('0x50')],null))['then'](respondWithResult(_0x16b7e3,null))[_0x30d6('0x42')](handleError(_0x16b7e3,null));};exports[_0x30d6('0x52')]=function(_0x38c9df,_0x442ec3){return db['JscriptyProject']['find']({'where':{'id':_0x38c9df[_0x30d6('0x44')]['id']}})[_0x30d6('0x23')](handleEntityNotFound(_0x442ec3,null))['then'](removeEntity(_0x442ec3,null))['catch'](handleError(_0x442ec3,null));};exports[_0x30d6('0x53')]=function(_0x319878,_0x35fb1f,_0x50f124){var _0x1f1fca={'raw':!![],'where':{}};var _0x1a6b0d={};var _0x33865b={'count':0x0,'rows':[]};return db[_0x30d6('0x2a')][_0x30d6('0x54')]({'where':{'id':_0x319878[_0x30d6('0x44')]['id']}})[_0x30d6('0x23')](handleEntityNotFound(_0x35fb1f,null))['then'](function(_0x9282d9){if(_0x9282d9){_0x1a6b0d[_0x30d6('0x2c')]=_[_0x30d6('0x2f')](db[_0x30d6('0x55')][_0x30d6('0x45')]);_0x1a6b0d[_0x30d6('0x2e')]=_['keys'](_0x319878[_0x30d6('0x2e')]);_0x1a6b0d[_0x30d6('0x30')]=_['intersection'](_0x1a6b0d[_0x30d6('0x2c')],_0x1a6b0d[_0x30d6('0x2e')]);_0x1f1fca[_0x30d6('0x33')]=_[_0x30d6('0x31')](_0x1a6b0d[_0x30d6('0x2c')],qs[_0x30d6('0x32')](_0x319878[_0x30d6('0x2e')][_0x30d6('0x32')]));_0x1f1fca[_0x30d6('0x33')]=_0x1f1fca[_0x30d6('0x33')][_0x30d6('0x34')]?_0x1f1fca[_0x30d6('0x33')]:_0x1a6b0d[_0x30d6('0x2c')];if(!_0x319878[_0x30d6('0x2e')]['hasOwnProperty']('nolimit')){_0x1f1fca[_0x30d6('0x1c')]=qs[_0x30d6('0x1c')](_0x319878[_0x30d6('0x2e')]['limit']);_0x1f1fca[_0x30d6('0x1b')]=qs['offset'](_0x319878[_0x30d6('0x2e')][_0x30d6('0x1b')]);}_0x1f1fca[_0x30d6('0x56')]=qs[_0x30d6('0x37')](_0x319878[_0x30d6('0x2e')]['sort']);_0x1f1fca['where']=qs[_0x30d6('0x30')](_['pick'](_0x319878['query'],_0x1a6b0d[_0x30d6('0x30')]));_0x1f1fca['where'][_0x30d6('0x57')]=_0x9282d9['id'];if(_0x319878[_0x30d6('0x2e')][_0x30d6('0x3a')]){_0x1f1fca['where']=_['merge'](_0x1f1fca['where'],{'$or':_[_0x30d6('0x29')](_0x1f1fca[_0x30d6('0x33')],function(_0x4fce04){var _0x4e3d46={};_0x4e3d46[_0x4fce04]={'$like':'%'+_0x319878[_0x30d6('0x2e')][_0x30d6('0x3a')]+'%'};return _0x4e3d46;})});}_0x1f1fca=_['merge']({},_0x1f1fca,_0x319878[_0x30d6('0x3e')]);return db[_0x30d6('0x55')]['count']({'where':_0x1f1fca['where']})[_0x30d6('0x23')](function(_0x55ac8a){_0x33865b[_0x30d6('0x1a')]=_0x55ac8a;if(_0x319878[_0x30d6('0x2e')][_0x30d6('0x3f')]){_0x1f1fca[_0x30d6('0x40')]=[{'all':!![]}];}return db[_0x30d6('0x55')][_0x30d6('0x41')](_0x1f1fca);})[_0x30d6('0x23')](function(_0x1f0b69){_0x33865b[_0x30d6('0x58')]=_0x1f0b69;return _0x33865b;});}})[_0x30d6('0x23')](respondWithFilteredResult(_0x35fb1f,_0x1f1fca))[_0x30d6('0x42')](handleError(_0x35fb1f,null));};exports[_0x30d6('0x59')]=function(_0x4180c8,_0x368f93,_0x16d2d2){var _0x2ebf87={'raw':!![],'where':{}};var _0x5ce1e5={};var _0x3e7420={'count':0x0,'rows':[]};return db[_0x30d6('0x2a')][_0x30d6('0x54')]({'where':{'id':_0x4180c8[_0x30d6('0x44')]['id']}})[_0x30d6('0x23')](handleEntityNotFound(_0x368f93,null))['then'](function(_0x5b8466){if(_0x5b8466){_0x5ce1e5[_0x30d6('0x2c')]=_[_0x30d6('0x2f')](db[_0x30d6('0x5a')][_0x30d6('0x45')]);_0x5ce1e5['query']=_[_0x30d6('0x2f')](_0x4180c8['query']);_0x5ce1e5['filters']=_[_0x30d6('0x31')](_0x5ce1e5[_0x30d6('0x2c')],_0x5ce1e5[_0x30d6('0x2e')]);_0x2ebf87[_0x30d6('0x33')]=_['intersection'](_0x5ce1e5[_0x30d6('0x2c')],qs[_0x30d6('0x32')](_0x4180c8[_0x30d6('0x2e')]['fields']));_0x2ebf87['attributes']=_0x2ebf87['attributes']['length']?_0x2ebf87[_0x30d6('0x33')]:_0x5ce1e5[_0x30d6('0x2c')];if(!_0x4180c8[_0x30d6('0x2e')]['hasOwnProperty'](_0x30d6('0x36'))){_0x2ebf87[_0x30d6('0x1c')]=qs['limit'](_0x4180c8[_0x30d6('0x2e')][_0x30d6('0x1c')]);_0x2ebf87['offset']=qs[_0x30d6('0x1b')](_0x4180c8[_0x30d6('0x2e')][_0x30d6('0x1b')]);}_0x2ebf87[_0x30d6('0x56')]=qs[_0x30d6('0x37')](_0x4180c8['query'][_0x30d6('0x37')]);_0x2ebf87[_0x30d6('0x38')]=qs[_0x30d6('0x30')](_[_0x30d6('0x39')](_0x4180c8['query'],_0x5ce1e5[_0x30d6('0x30')]));_0x2ebf87[_0x30d6('0x38')]['ProjectId']=_0x5b8466['id'];if(_0x4180c8[_0x30d6('0x2e')][_0x30d6('0x3a')]){_0x2ebf87[_0x30d6('0x38')]=_[_0x30d6('0x3b')](_0x2ebf87[_0x30d6('0x38')],{'$or':_[_0x30d6('0x29')](_0x2ebf87[_0x30d6('0x33')],function(_0x471585){var _0x4db3fa={};_0x4db3fa[_0x471585]={'$like':'%'+_0x4180c8['query'][_0x30d6('0x3a')]+'%'};return _0x4db3fa;})});}_0x2ebf87=_[_0x30d6('0x3b')]({},_0x2ebf87,_0x4180c8[_0x30d6('0x3e')]);return db[_0x30d6('0x5a')][_0x30d6('0x1a')]({'where':_0x2ebf87[_0x30d6('0x38')]})[_0x30d6('0x23')](function(_0x11fd82){_0x3e7420[_0x30d6('0x1a')]=_0x11fd82;if(_0x4180c8[_0x30d6('0x2e')][_0x30d6('0x3f')]){_0x2ebf87[_0x30d6('0x40')]=[{'all':!![]}];}return db[_0x30d6('0x5a')][_0x30d6('0x41')](_0x2ebf87);})['then'](function(_0x1babc6){_0x3e7420[_0x30d6('0x58')]=_0x1babc6;return _0x3e7420;});}})[_0x30d6('0x23')](respondWithFilteredResult(_0x368f93,_0x2ebf87))[_0x30d6('0x42')](handleError(_0x368f93,null));};function char(_0xd73c0a){return _0x30d6('0x5b')===typeof _0xd73c0a?String[_0x30d6('0x5c')]['apply'](null,arguments):_0xd73c0a;}function needsEncapsulation(_0x441718){return!!_0x441718&&(_0x441718[_0x30d6('0x5d')]()[_0x30d6('0x5e')](char(0xd))>=0x0||_0x441718[_0x30d6('0x5d')]()[_0x30d6('0x5e')](char(0xa))>=0x0||_0x441718['toString']()['indexOf'](char(0x2c))>=0x0||_0x441718[_0x30d6('0x5d')]()[_0x30d6('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x342a15){var _0x4ca834=char(0x22),_0x51a05e='\x5c'+char(0x22),_0x4b8a40=_0x342a15['toString']()[_0x30d6('0x5f')](new RegExp(_0x4ca834,'g'),_0x51a05e);return _0x4ca834+_0x4b8a40+_0x4ca834;}exports[_0x30d6('0x60')]=function(_0x2ab9bf,_0xf0191e,_0x36f49b){var _0x557b2a,_0xef3aa7;var _0x54b315={'where':{'ProjectId':_0x2ab9bf['params']['id']}};if(_0x2ab9bf['query'][_0x30d6('0x61')]){_0x54b315[_0x30d6('0x38')][_0x30d6('0x62')]=JSON[_0x30d6('0x63')](_0x2ab9bf['query']['startTime']);}return db[_0x30d6('0x55')][_0x30d6('0x41')](_0x54b315)[_0x30d6('0x23')](handleEntityNotFound(_0xf0191e,null))[_0x30d6('0x23')](function(_0x498933){if(_0x498933){_0x557b2a=_0x498933;return db[_0x30d6('0x64')][_0x30d6('0x41')]({'where':{'SessionId':{'$in':_[_0x30d6('0x29')](_0x557b2a,'id')},'ProjectId':_0x2ab9bf['params']['id']},'order':_0x30d6('0x65')});}})[_0x30d6('0x23')](handleEntityNotFound(_0xf0191e,null))[_0x30d6('0x23')](function(_0x848916){if(_0x848916){_0xef3aa7=_0x848916;var _0x24f147={};for(var _0x4a74c6=0x0,_0x454d28=_0xef3aa7['length'];_0x4a74c6<_0x454d28;_0x4a74c6++){if(!_0x24f147[_0x30d6('0x35')](_0xef3aa7[_0x4a74c6][_0x30d6('0x66')])){_0x24f147[_0xef3aa7[_0x4a74c6]['questionId']]=needsEncapsulation(_0xef3aa7[_0x4a74c6][_0x30d6('0x67')])?encapsulate(_0xef3aa7[_0x4a74c6][_0x30d6('0x67')]):_0xef3aa7[_0x4a74c6][_0x30d6('0x67')];}}var _0xa56616=[],_0x5efd59={};for(var _0x1dcd8c=0x0,_0x2ece66=_0x557b2a['length'];_0x1dcd8c<_0x2ece66;_0x1dcd8c++){_0x5efd59={'ProjectId':_0x2ab9bf['params']['id'],'SessionId':_0x557b2a[_0x1dcd8c]['id'],'StartTime':moment(_0x557b2a[_0x1dcd8c][_0x30d6('0x62')])[_0x30d6('0x68')](_0x30d6('0x69'))};for(var _0x6b7c37=0x0,_0x3bdb61=_0xef3aa7[_0x30d6('0x34')];_0x6b7c37<_0x3bdb61;_0x6b7c37++){if(_0xef3aa7[_0x6b7c37][_0x30d6('0x6a')]==_0x557b2a[_0x1dcd8c]['id']&&_0x24f147[_0x30d6('0x35')](_0xef3aa7[_0x6b7c37][_0x30d6('0x66')])){_0x5efd59[_0x24f147[_0xef3aa7[_0x6b7c37][_0x30d6('0x66')]]]=_0xef3aa7[_0x6b7c37][_0x30d6('0x6b')];}}for(var _0x576ef2 in _0x24f147){if(!_0x5efd59[_0x30d6('0x35')](_0x24f147[_0x576ef2])){_0x5efd59[_0x24f147[_0x576ef2]]=null;}}_0xa56616[_0x30d6('0x6c')](_0x5efd59);}return _0xa56616;}})[_0x30d6('0x23')](function(_0x3bc528){if(!_['isEmpty'](_0x3bc528)){var _0x1bad85=toCsv(_0x3bc528);var _0x1f5811=Date['now']();fs['writeFileSync'](util[_0x30d6('0x68')](_0x30d6('0x6d'),_0x2ab9bf[_0x30d6('0x44')]['id'],_0x1f5811),_0x1bad85);_0xf0191e['setHeader'](_0x30d6('0x6e'),_0x30d6('0x6f')+util['format'](_0x30d6('0x70'),_0x2ab9bf[_0x30d6('0x44')]['id'],_0x1f5811));_0xf0191e[_0x30d6('0x71')](_0x30d6('0x72'),_0x30d6('0x73'));return _0xf0191e[_0x30d6('0x74')](util[_0x30d6('0x68')](_0x30d6('0x6d'),_0x2ab9bf[_0x30d6('0x44')]['id'],_0x1f5811));}else{return _0xf0191e[_0x30d6('0x17')](0xcc);}})['catch'](handleError(_0xf0191e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 463187a..6dc6b1e 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 _0x5e59=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5e59,0xc6));var _0x95e5=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x5e59[_0x13e300];return _0x5a3eea;};'use strict';var _=require(_0x95e5('0x0'));var util=require('util');var logger=require(_0x95e5('0x1'))(_0x95e5('0x2'));var moment=require(_0x95e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x95e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95e5('0x5'));var config=require(_0x95e5('0x6'));var attributes=require(_0x95e5('0x7'));module[_0x95e5('0x8')]=function(_0x3fe8a3,_0x1566ed){return _0x3fe8a3[_0x95e5('0x9')](_0x95e5('0xa'),attributes,{'tableName':_0x95e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2752=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects'];(function(_0x427d0b,_0x41fa01){var _0x3b83a1=function(_0x3e5ad7){while(--_0x3e5ad7){_0x427d0b['push'](_0x427d0b['shift']());}};_0x3b83a1(++_0x41fa01);}(_0x2752,0xa8));var _0x2275=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2752[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2275('0x0'))(_0x2275('0x1'));var moment=require(_0x2275('0x2'));var BPromise=require(_0x2275('0x3'));var rp=require(_0x2275('0x4'));var fs=require('fs');var path=require(_0x2275('0x5'));var rimraf=require(_0x2275('0x6'));var config=require(_0x2275('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x2275('0x8')]=function(_0x15bdc0,_0x2d9280){return _0x15bdc0[_0x2275('0x9')](_0x2275('0xa'),attributes,{'tableName':_0x2275('0xb'),'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 bda24a6..e77d80c 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 _0x10eb=['JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58d0fa,_0x408310){var _0x3fca62=function(_0x2ab067){while(--_0x2ab067){_0x58d0fa['push'](_0x58d0fa['shift']());}};_0x3fca62(++_0x408310);}(_0x10eb,0x7f));var _0xb10e=function(_0x4b6339,_0x49c545){_0x4b6339=_0x4b6339-0x0;var _0x353978=_0x10eb[_0x4b6339];return _0x353978;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb10e('0x0'));var BPromise=require(_0xb10e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb10e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb10e('0x3'));var logger=require(_0xb10e('0x4'))(_0xb10e('0x5'));var config=require(_0xb10e('0x6'));var jayson=require(_0xb10e('0x7'));var client=jayson['client'][_0xb10e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x291b5f,_0x4528ac,_0x5f5d7a){return new BPromise(function(_0x2fd7a6,_0xa2753c){return client[_0xb10e('0x9')](_0x291b5f,_0x5f5d7a)['then'](function(_0x2ae5d4){logger['info'](_0xb10e('0xa'),_0x4528ac,_0xb10e('0xb'));logger[_0xb10e('0xc')](_0xb10e('0xd'),_0x4528ac,'request\x20sent',JSON[_0xb10e('0xe')](_0x2ae5d4));if(_0x2ae5d4[_0xb10e('0xf')]){if(_0x2ae5d4[_0xb10e('0xf')][_0xb10e('0x10')]===0x1f4){logger[_0xb10e('0xf')](_0xb10e('0xa'),_0x4528ac,_0x2ae5d4[_0xb10e('0xf')][_0xb10e('0x11')]);return _0xa2753c(_0x2ae5d4[_0xb10e('0xf')][_0xb10e('0x11')]);}logger[_0xb10e('0xf')](_0xb10e('0xa'),_0x4528ac,_0x2ae5d4[_0xb10e('0xf')][_0xb10e('0x11')]);return _0x2fd7a6(_0x2ae5d4[_0xb10e('0xf')][_0xb10e('0x11')]);}else{logger[_0xb10e('0x12')](_0xb10e('0xa'),_0x4528ac,_0xb10e('0xb'));_0x2fd7a6(_0x2ae5d4[_0xb10e('0x13')][_0xb10e('0x11')]);}})['catch'](function(_0x458b51){logger[_0xb10e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4528ac,_0x458b51);_0xa2753c(_0x458b51);});});} \ No newline at end of file +var _0xe14f=['info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x4a1066,_0x4f349d){var _0x40fbc5=function(_0x4f68e6){while(--_0x4f68e6){_0x4a1066['push'](_0x4a1066['shift']());}};_0x40fbc5(++_0x4f349d);}(_0xe14f,0xcb));var _0xfe14=function(_0x42a360,_0x205a2c){_0x42a360=_0x42a360-0x0;var _0x54270c=_0xe14f[_0x42a360];return _0x54270c;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var moment=require(_0xfe14('0x2'));var BPromise=require(_0xfe14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe14('0x4'));var db=require(_0xfe14('0x5'))['db'];var utils=require(_0xfe14('0x6'));var logger=require('../../config/logger')(_0xfe14('0x7'));var config=require(_0xfe14('0x8'));var jayson=require(_0xfe14('0x9'));var client=jayson[_0xfe14('0xa')][_0xfe14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x569f26,_0x29c7bd,_0x1ed83a){return new BPromise(function(_0x313932,_0x11db1c){return client['request'](_0x569f26,_0x1ed83a)[_0xfe14('0xc')](function(_0x1671d2){logger[_0xfe14('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x29c7bd,_0xfe14('0xe'));logger[_0xfe14('0xf')](_0xfe14('0x10'),_0x29c7bd,_0xfe14('0xe'),JSON[_0xfe14('0x11')](_0x1671d2));if(_0x1671d2[_0xfe14('0x12')]){if(_0x1671d2[_0xfe14('0x12')][_0xfe14('0x13')]===0x1f4){logger[_0xfe14('0x12')](_0xfe14('0x14'),_0x29c7bd,_0x1671d2[_0xfe14('0x12')][_0xfe14('0x15')]);return _0x11db1c(_0x1671d2[_0xfe14('0x12')][_0xfe14('0x15')]);}logger[_0xfe14('0x12')](_0xfe14('0x14'),_0x29c7bd,_0x1671d2[_0xfe14('0x12')][_0xfe14('0x15')]);return _0x313932(_0x1671d2['error'][_0xfe14('0x15')]);}else{logger[_0xfe14('0xd')](_0xfe14('0x14'),_0x29c7bd,_0xfe14('0xe'));_0x313932(_0x1671d2[_0xfe14('0x16')][_0xfe14('0x15')]);}})[_0xfe14('0x17')](function(_0x571ab9){logger[_0xfe14('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x29c7bd,_0x571ab9);_0x11db1c(_0x571ab9);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e7c4e49..47f4c86 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 _0xc894=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x57c7db,_0x3e73d1){var _0xcd192b=function(_0x1aadb8){while(--_0x1aadb8){_0x57c7db['push'](_0x57c7db['shift']());}};_0xcd192b(++_0x3e73d1);}(_0xc894,0x168));var _0x4c89=function(_0x493dc5,_0xdf45b7){_0x493dc5=_0x493dc5-0x0;var _0x14dfc9=_0xc894[_0x493dc5];return _0x14dfc9;};'use strict';var multer=require(_0x4c89('0x0'));var util=require('util');var path=require(_0x4c89('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c89('0x2'));var router=express['Router']();var auth=require(_0x4c89('0x3'));var interaction=require(_0x4c89('0x4'));var config=require(_0x4c89('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x4c89('0x6')]('/',auth['isAuthenticated'](),controller[_0x4c89('0x7')]);router[_0x4c89('0x6')](_0x4c89('0x8'),auth[_0x4c89('0x9')](),controller[_0x4c89('0xa')]);router[_0x4c89('0x6')](_0x4c89('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4c89('0xc')]('/',auth[_0x4c89('0x9')](),controller[_0x4c89('0xd')]);router[_0x4c89('0xe')](_0x4c89('0xb'),auth[_0x4c89('0x9')](),controller[_0x4c89('0xf')]);router[_0x4c89('0x10')](_0x4c89('0xb'),auth[_0x4c89('0x9')](),controller[_0x4c89('0x11')]);module[_0x4c89('0x12')]=router; \ No newline at end of file +var _0xda09=['create','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','/:id','show'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xda09,0x1b7));var _0x9da0=function(_0x383429,_0x4b9f3b){_0x383429=_0x383429-0x0;var _0x2b2b43=_0xda09[_0x383429];return _0x2b2b43;};'use strict';var multer=require('multer');var util=require(_0x9da0('0x0'));var path=require(_0x9da0('0x1'));var timeout=require(_0x9da0('0x2'));var express=require(_0x9da0('0x3'));var router=express['Router']();var auth=require(_0x9da0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9da0('0x5'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x9da0('0x6')](),controller[_0x9da0('0x7')]);router['get'](_0x9da0('0x8'),auth[_0x9da0('0x6')](),controller['describe']);router['get'](_0x9da0('0x9'),auth[_0x9da0('0x6')](),controller[_0x9da0('0xa')]);router['post']('/',auth[_0x9da0('0x6')](),controller[_0x9da0('0xb')]);router[_0x9da0('0xc')](_0x9da0('0x9'),auth[_0x9da0('0x6')](),controller['update']);router[_0x9da0('0xd')](_0x9da0('0x9'),auth[_0x9da0('0x6')](),controller['destroy']);module[_0x9da0('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b262678..4ce43c7 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 _0x153a=['long','STRING'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x153a,0x131));var _0xa153=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x153a[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0xa153('0x0')]},'answer':{'type':Sequelize['TEXT'](_0xa153('0x1'))},'membername':{'type':Sequelize[_0xa153('0x0')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa153('0x0')]},'uniqueid':{'type':Sequelize[_0xa153('0x0')]},'calleridname':{'type':Sequelize[_0xa153('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x96de=['TEXT','long','sequelize','STRING'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x96de,0x72));var _0xe96d=function(_0xe4134d,_0x58cc13){_0xe4134d=_0xe4134d-0x0;var _0x269805=_0x96de[_0xe4134d];return _0x269805;};'use strict';var Sequelize=require(_0xe96d('0x0'));module['exports']={'question':{'type':Sequelize[_0xe96d('0x1')]},'answer':{'type':Sequelize[_0xe96d('0x2')](_0xe96d('0x3'))},'membername':{'type':Sequelize[_0xe96d('0x1')]},'projectname':{'type':Sequelize[_0xe96d('0x1')]},'queue':{'type':Sequelize[_0xe96d('0x1')]},'uniqueid':{'type':Sequelize[_0xe96d('0x1')]},'calleridname':{'type':Sequelize[_0xe96d('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xe96d('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 895f6a7..3f4c9fd 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 _0x41ff=['hasOwnProperty','nolimit','order','sort','where','filter','merge','options','JscriptyQuestionReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','fieldName','key','map','query','filters','attributes','intersection','model','fields','length'];(function(_0x5546aa,_0x44fdaa){var _0x1f11b2=function(_0x5be4b4){while(--_0x5be4b4){_0x5546aa['push'](_0x5546aa['shift']());}};_0x1f11b2(++_0x44fdaa);}(_0x41ff,0x181));var _0xf41f=function(_0x5976ed,_0x2e1bb7){_0x5976ed=_0x5976ed-0x0;var _0x31b613=_0x41ff[_0x5976ed];return _0x31b613;};'use strict';var pdf=require(_0xf41f('0x0'));var emlformat=require(_0xf41f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf41f('0x2'));var rp=require('request-promise');var moment=require(_0xf41f('0x3'));var BPromise=require(_0xf41f('0x4'));var Mustache=require(_0xf41f('0x5'));var util=require(_0xf41f('0x6'));var path=require(_0xf41f('0x7'));var sox=require('sox');var csv=require(_0xf41f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf41f('0x9'));var crypto=require(_0xf41f('0xa'));var jsforce=require(_0xf41f('0xb'));var deskjs=require(_0xf41f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf41f('0xd'));var Papa=require(_0xf41f('0xe'));var Redis=require(_0xf41f('0xf'));var authService=require(_0xf41f('0x10'));var qs=require(_0xf41f('0x11'));var as=require(_0xf41f('0x12'));var hardwareService=require(_0xf41f('0x13'));var logger=require(_0xf41f('0x14'))(_0xf41f('0x15'));var utils=require(_0xf41f('0x16'));var config=require(_0xf41f('0x17'));var licenseUtil=require(_0xf41f('0x18'));var db=require(_0xf41f('0x19'))['db'];function respondWithStatusCode(_0x1777cb,_0x3936c1){_0x3936c1=_0x3936c1||0xcc;return function(_0x4ab512){if(_0x4ab512){return _0x1777cb[_0xf41f('0x1a')](_0x3936c1);}return _0x1777cb[_0xf41f('0x1b')](_0x3936c1)[_0xf41f('0x1c')]();};}function respondWithResult(_0x5c181f,_0x58b871){_0x58b871=_0x58b871||0xc8;return function(_0x3ede8b){if(_0x3ede8b){return _0x5c181f[_0xf41f('0x1b')](_0x58b871)[_0xf41f('0x1d')](_0x3ede8b);}};}function respondWithFilteredResult(_0x575e36,_0x6b2704){return function(_0x2b04ca){if(_0x2b04ca){var _0x44923d=_0x2b04ca[_0xf41f('0x1e')],_0x3876a9=_0x6b2704['offset'],_0x303c24=_0x6b2704[_0xf41f('0x1f')]+_0x6b2704[_0xf41f('0x20')],_0x5a555f;if(_0x303c24>=_0x44923d){_0x303c24=_0x44923d;_0x5a555f=0xc8;}else{_0x5a555f=0xce;}_0x575e36['status'](_0x5a555f);return _0x575e36[_0xf41f('0x21')](_0xf41f('0x22'),_0x3876a9+'-'+_0x303c24+'/'+_0x44923d)['json'](_0x2b04ca);}return null;};}function patchUpdates(_0x3d7e9d){return function(_0xf85c8b){try{jsonpatch[_0xf41f('0x23')](_0xf85c8b,_0x3d7e9d,!![]);}catch(_0x26c55d){return BPromise['reject'](_0x26c55d);}return _0xf85c8b[_0xf41f('0x24')]();};}function saveUpdates(_0x56a41e,_0x499486){return function(_0x482a9d){if(_0x482a9d){return _0x482a9d[_0xf41f('0x25')](_0x56a41e)[_0xf41f('0x26')](function(_0x1f638b){return _0x1f638b;});}return null;};}function removeEntity(_0x10584d,_0x32e36d){return function(_0x2a85b3){if(_0x2a85b3){return _0x2a85b3[_0xf41f('0x27')]()[_0xf41f('0x26')](function(){_0x10584d[_0xf41f('0x1b')](0xcc)[_0xf41f('0x1c')]();});}};}function handleEntityNotFound(_0x1956f2,_0x3d7567){return function(_0x4bf3de){if(!_0x4bf3de){_0x1956f2[_0xf41f('0x1a')](0x194);}return _0x4bf3de;};}function handleError(_0x176c2c,_0x43102c){_0x43102c=_0x43102c||0x1f4;return function(_0x597971){logger[_0xf41f('0x28')](_0x597971['stack']);if(_0x597971[_0xf41f('0x29')]){delete _0x597971[_0xf41f('0x29')];}_0x176c2c[_0xf41f('0x1b')](_0x43102c)[_0xf41f('0x2a')](_0x597971);};}exports['index']=function(_0x466f34,_0x5de415){var _0x23de05={},_0x4b0af1={},_0x512c6c={'count':0x0,'rows':[]};var _0x2c1825=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x12d887){return{'name':_0x12d887[_0xf41f('0x2b')],'type':_0x12d887['type'][_0xf41f('0x2c')]};});_0x4b0af1['model']=_[_0xf41f('0x2d')](_0x2c1825,_0xf41f('0x29'));_0x4b0af1[_0xf41f('0x2e')]=_['keys'](_0x466f34['query']);_0x4b0af1[_0xf41f('0x2f')]=_['intersection'](_0x4b0af1['model'],_0x4b0af1[_0xf41f('0x2e')]);_0x23de05[_0xf41f('0x30')]=_[_0xf41f('0x31')](_0x4b0af1[_0xf41f('0x32')],qs[_0xf41f('0x33')](_0x466f34[_0xf41f('0x2e')][_0xf41f('0x33')]));_0x23de05[_0xf41f('0x30')]=_0x23de05[_0xf41f('0x30')][_0xf41f('0x34')]?_0x23de05[_0xf41f('0x30')]:_0x4b0af1['model'];if(!_0x466f34[_0xf41f('0x2e')][_0xf41f('0x35')](_0xf41f('0x36'))){_0x23de05[_0xf41f('0x20')]=qs['limit'](_0x466f34[_0xf41f('0x2e')][_0xf41f('0x20')]);_0x23de05[_0xf41f('0x1f')]=qs['offset'](_0x466f34[_0xf41f('0x2e')]['offset']);}_0x23de05[_0xf41f('0x37')]=qs[_0xf41f('0x38')](_0x466f34[_0xf41f('0x2e')][_0xf41f('0x38')]);_0x23de05[_0xf41f('0x39')]=qs[_0xf41f('0x2f')](_['pick'](_0x466f34[_0xf41f('0x2e')],_0x4b0af1[_0xf41f('0x2f')]),_0x2c1825);if(_0x466f34[_0xf41f('0x2e')][_0xf41f('0x3a')]){_0x23de05[_0xf41f('0x39')]=_[_0xf41f('0x3b')](_0x23de05['where'],{'$or':_[_0xf41f('0x2d')](_0x2c1825,function(_0x5666a1){if(_0x5666a1['type']!=='VIRTUAL'){var _0x427752={};_0x427752[_0x5666a1[_0xf41f('0x29')]]={'$like':'%'+_0x466f34[_0xf41f('0x2e')][_0xf41f('0x3a')]+'%'};return _0x427752;}})});}_0x23de05=_[_0xf41f('0x3b')]({},_0x23de05,_0x466f34[_0xf41f('0x3c')]);var _0xe505f3={'where':_0x23de05['where']};return db[_0xf41f('0x3d')]['count'](_0xe505f3)['then'](function(_0x276285){_0x512c6c[_0xf41f('0x1e')]=_0x276285;if(_0x466f34['query'][_0xf41f('0x3e')]){_0x23de05[_0xf41f('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xf41f('0x40')](_0x23de05);})[_0xf41f('0x26')](function(_0x5d8dc1){_0x512c6c[_0xf41f('0x41')]=_0x5d8dc1;return _0x512c6c;})[_0xf41f('0x26')](respondWithFilteredResult(_0x5de415,_0x23de05))['catch'](handleError(_0x5de415,null));};exports[_0xf41f('0x42')]=function(_0x594110,_0x5cec47){var _0x1a0f3d={'raw':!![],'where':{'id':_0x594110[_0xf41f('0x43')]['id']}},_0x1f3ee3={};_0x1f3ee3[_0xf41f('0x32')]=_['keys'](db[_0xf41f('0x3d')]['rawAttributes']);_0x1f3ee3[_0xf41f('0x2e')]=_['keys'](_0x594110['query']);_0x1f3ee3['filters']=_['intersection'](_0x1f3ee3[_0xf41f('0x32')],_0x1f3ee3[_0xf41f('0x2e')]);_0x1a0f3d[_0xf41f('0x30')]=_[_0xf41f('0x31')](_0x1f3ee3[_0xf41f('0x32')],qs[_0xf41f('0x33')](_0x594110[_0xf41f('0x2e')][_0xf41f('0x33')]));_0x1a0f3d[_0xf41f('0x30')]=_0x1a0f3d[_0xf41f('0x30')][_0xf41f('0x34')]?_0x1a0f3d[_0xf41f('0x30')]:_0x1f3ee3[_0xf41f('0x32')];if(_0x594110[_0xf41f('0x2e')][_0xf41f('0x3e')]){_0x1a0f3d['include']=[{'all':!![]}];}_0x1a0f3d=_['merge']({},_0x1a0f3d,_0x594110[_0xf41f('0x3c')]);return db[_0xf41f('0x3d')][_0xf41f('0x44')](_0x1a0f3d)['then'](handleEntityNotFound(_0x5cec47,null))[_0xf41f('0x26')](respondWithResult(_0x5cec47,null))[_0xf41f('0x45')](handleError(_0x5cec47,null));};exports[_0xf41f('0x46')]=function(_0x3a8bfd,_0x1a9168){return db[_0xf41f('0x3d')][_0xf41f('0x46')](_0x3a8bfd['body'],{})['then'](respondWithResult(_0x1a9168,0xc9))[_0xf41f('0x45')](handleError(_0x1a9168,null));};exports['update']=function(_0x382330,_0x3837b8){if(_0x382330['body']['id']){delete _0x382330[_0xf41f('0x47')]['id'];}return db['JscriptyQuestionReport'][_0xf41f('0x44')]({'where':{'id':_0x382330[_0xf41f('0x43')]['id']}})[_0xf41f('0x26')](handleEntityNotFound(_0x3837b8,null))[_0xf41f('0x26')](saveUpdates(_0x382330['body'],null))[_0xf41f('0x26')](respondWithResult(_0x3837b8,null))['catch'](handleError(_0x3837b8,null));};exports[_0xf41f('0x27')]=function(_0x2032ae,_0x2f3c17){return db[_0xf41f('0x3d')][_0xf41f('0x44')]({'where':{'id':_0x2032ae['params']['id']}})[_0xf41f('0x26')](handleEntityNotFound(_0x2f3c17,null))['then'](removeEntity(_0x2f3c17,null))['catch'](handleError(_0x2f3c17,null));};exports['describe']=function(_0xf98422,_0x59fcc8){return db[_0xf41f('0x3d')][_0xf41f('0x48')]()[_0xf41f('0x26')](respondWithResult(_0x59fcc8,null))[_0xf41f('0x45')](handleError(_0x59fcc8,null));}; \ No newline at end of file +var _0x9949=['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','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x9949,0x172));var _0x9994=function(_0x14f7c8,_0x1a5c99){_0x14f7c8=_0x14f7c8-0x0;var _0x4805cf=_0x9949[_0x14f7c8];return _0x4805cf;};'use strict';var pdf=require(_0x9994('0x0'));var emlformat=require(_0x9994('0x1'));var rimraf=require(_0x9994('0x2'));var zipdir=require(_0x9994('0x3'));var jsonpatch=require(_0x9994('0x4'));var rp=require(_0x9994('0x5'));var moment=require(_0x9994('0x6'));var BPromise=require(_0x9994('0x7'));var Mustache=require(_0x9994('0x8'));var util=require('util');var path=require(_0x9994('0x9'));var sox=require(_0x9994('0xa'));var csv=require(_0x9994('0xb'));var ejs=require(_0x9994('0xc'));var fs=require('fs');var _=require(_0x9994('0xd'));var squel=require(_0x9994('0xe'));var crypto=require(_0x9994('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9994('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9994('0x11'));var Papa=require(_0x9994('0x12'));var Redis=require(_0x9994('0x13'));var authService=require(_0x9994('0x14'));var qs=require(_0x9994('0x15'));var as=require(_0x9994('0x16'));var hardwareService=require(_0x9994('0x17'));var logger=require(_0x9994('0x18'))(_0x9994('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9994('0x1a'));var db=require(_0x9994('0x1b'))['db'];function respondWithStatusCode(_0x5500cb,_0x578231){_0x578231=_0x578231||0xcc;return function(_0x33f1c5){if(_0x33f1c5){return _0x5500cb[_0x9994('0x1c')](_0x578231);}return _0x5500cb[_0x9994('0x1d')](_0x578231)[_0x9994('0x1e')]();};}function respondWithResult(_0x10df3e,_0x264a03){_0x264a03=_0x264a03||0xc8;return function(_0x1a98f2){if(_0x1a98f2){return _0x10df3e['status'](_0x264a03)['json'](_0x1a98f2);}};}function respondWithFilteredResult(_0x49157c,_0x568f22){return function(_0x22fe95){if(_0x22fe95){var _0x57e221=_0x22fe95[_0x9994('0x1f')],_0x30985d=_0x568f22[_0x9994('0x20')],_0x15737d=_0x568f22[_0x9994('0x20')]+_0x568f22[_0x9994('0x21')],_0x91ba96;if(_0x15737d>=_0x57e221){_0x15737d=_0x57e221;_0x91ba96=0xc8;}else{_0x91ba96=0xce;}_0x49157c[_0x9994('0x1d')](_0x91ba96);return _0x49157c[_0x9994('0x22')](_0x9994('0x23'),_0x30985d+'-'+_0x15737d+'/'+_0x57e221)[_0x9994('0x24')](_0x22fe95);}return null;};}function patchUpdates(_0x542bf7){return function(_0x460fda){try{jsonpatch[_0x9994('0x25')](_0x460fda,_0x542bf7,!![]);}catch(_0x4f2888){return BPromise['reject'](_0x4f2888);}return _0x460fda[_0x9994('0x26')]();};}function saveUpdates(_0x219359,_0x1a3c58){return function(_0x10d75c){if(_0x10d75c){return _0x10d75c[_0x9994('0x27')](_0x219359)[_0x9994('0x28')](function(_0x24fd98){return _0x24fd98;});}return null;};}function removeEntity(_0x2f9f5e,_0xcb248b){return function(_0x351967){if(_0x351967){return _0x351967[_0x9994('0x29')]()[_0x9994('0x28')](function(){_0x2f9f5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7c83,_0x493bf1){return function(_0x13621a){if(!_0x13621a){_0x5c7c83[_0x9994('0x1c')](0x194);}return _0x13621a;};}function handleError(_0x44722f,_0x39175d){_0x39175d=_0x39175d||0x1f4;return function(_0x5c1f03){logger[_0x9994('0x2a')](_0x5c1f03[_0x9994('0x2b')]);if(_0x5c1f03['name']){delete _0x5c1f03[_0x9994('0x2c')];}_0x44722f[_0x9994('0x1d')](_0x39175d)[_0x9994('0x2d')](_0x5c1f03);};}exports[_0x9994('0x2e')]=function(_0x2c7779,_0x1dc561){var _0xae8fe4={},_0x12eba5={},_0x2b267b={'count':0x0,'rows':[]};var _0x132596=_[_0x9994('0x2f')](db[_0x9994('0x30')][_0x9994('0x31')],function(_0x2cb8d7){return{'name':_0x2cb8d7[_0x9994('0x32')],'type':_0x2cb8d7[_0x9994('0x33')][_0x9994('0x34')]};});_0x12eba5[_0x9994('0x35')]=_[_0x9994('0x2f')](_0x132596,_0x9994('0x2c'));_0x12eba5[_0x9994('0x36')]=_['keys'](_0x2c7779['query']);_0x12eba5[_0x9994('0x37')]=_[_0x9994('0x38')](_0x12eba5[_0x9994('0x35')],_0x12eba5[_0x9994('0x36')]);_0xae8fe4['attributes']=_['intersection'](_0x12eba5[_0x9994('0x35')],qs[_0x9994('0x39')](_0x2c7779[_0x9994('0x36')][_0x9994('0x39')]));_0xae8fe4[_0x9994('0x3a')]=_0xae8fe4[_0x9994('0x3a')]['length']?_0xae8fe4[_0x9994('0x3a')]:_0x12eba5['model'];if(!_0x2c7779['query']['hasOwnProperty'](_0x9994('0x3b'))){_0xae8fe4['limit']=qs[_0x9994('0x21')](_0x2c7779['query'][_0x9994('0x21')]);_0xae8fe4['offset']=qs[_0x9994('0x20')](_0x2c7779[_0x9994('0x36')][_0x9994('0x20')]);}_0xae8fe4[_0x9994('0x3c')]=qs[_0x9994('0x3d')](_0x2c7779[_0x9994('0x36')][_0x9994('0x3d')]);_0xae8fe4[_0x9994('0x3e')]=qs[_0x9994('0x37')](_['pick'](_0x2c7779[_0x9994('0x36')],_0x12eba5[_0x9994('0x37')]),_0x132596);if(_0x2c7779['query'][_0x9994('0x3f')]){_0xae8fe4[_0x9994('0x3e')]=_[_0x9994('0x40')](_0xae8fe4[_0x9994('0x3e')],{'$or':_[_0x9994('0x2f')](_0x132596,function(_0x83143e){if(_0x83143e[_0x9994('0x33')]!=='VIRTUAL'){var _0x1859dc={};_0x1859dc[_0x83143e[_0x9994('0x2c')]]={'$like':'%'+_0x2c7779[_0x9994('0x36')]['filter']+'%'};return _0x1859dc;}})});}_0xae8fe4=_[_0x9994('0x40')]({},_0xae8fe4,_0x2c7779[_0x9994('0x41')]);var _0x3feddc={'where':_0xae8fe4[_0x9994('0x3e')]};return db['JscriptyQuestionReport']['count'](_0x3feddc)['then'](function(_0x47f975){_0x2b267b[_0x9994('0x1f')]=_0x47f975;if(_0x2c7779[_0x9994('0x36')][_0x9994('0x42')]){_0xae8fe4[_0x9994('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0xae8fe4);})[_0x9994('0x28')](function(_0xdc8d52){_0x2b267b['rows']=_0xdc8d52;return _0x2b267b;})[_0x9994('0x28')](respondWithFilteredResult(_0x1dc561,_0xae8fe4))[_0x9994('0x44')](handleError(_0x1dc561,null));};exports[_0x9994('0x45')]=function(_0x50e95c,_0x4ef643){var _0x1278c2={'raw':!![],'where':{'id':_0x50e95c[_0x9994('0x46')]['id']}},_0x15cf93={};_0x15cf93[_0x9994('0x35')]=_['keys'](db[_0x9994('0x30')]['rawAttributes']);_0x15cf93['query']=_[_0x9994('0x47')](_0x50e95c[_0x9994('0x36')]);_0x15cf93['filters']=_[_0x9994('0x38')](_0x15cf93[_0x9994('0x35')],_0x15cf93[_0x9994('0x36')]);_0x1278c2['attributes']=_['intersection'](_0x15cf93['model'],qs[_0x9994('0x39')](_0x50e95c['query'][_0x9994('0x39')]));_0x1278c2[_0x9994('0x3a')]=_0x1278c2[_0x9994('0x3a')][_0x9994('0x48')]?_0x1278c2[_0x9994('0x3a')]:_0x15cf93['model'];if(_0x50e95c[_0x9994('0x36')][_0x9994('0x42')]){_0x1278c2[_0x9994('0x43')]=[{'all':!![]}];}_0x1278c2=_[_0x9994('0x40')]({},_0x1278c2,_0x50e95c[_0x9994('0x41')]);return db[_0x9994('0x30')][_0x9994('0x49')](_0x1278c2)[_0x9994('0x28')](handleEntityNotFound(_0x4ef643,null))['then'](respondWithResult(_0x4ef643,null))[_0x9994('0x44')](handleError(_0x4ef643,null));};exports['create']=function(_0x634143,_0x48b3c2){return db['JscriptyQuestionReport'][_0x9994('0x4a')](_0x634143[_0x9994('0x4b')],{})[_0x9994('0x28')](respondWithResult(_0x48b3c2,0xc9))[_0x9994('0x44')](handleError(_0x48b3c2,null));};exports[_0x9994('0x27')]=function(_0xde58f1,_0x4b9e25){if(_0xde58f1[_0x9994('0x4b')]['id']){delete _0xde58f1['body']['id'];}return db[_0x9994('0x30')][_0x9994('0x49')]({'where':{'id':_0xde58f1[_0x9994('0x46')]['id']}})[_0x9994('0x28')](handleEntityNotFound(_0x4b9e25,null))[_0x9994('0x28')](saveUpdates(_0xde58f1[_0x9994('0x4b')],null))[_0x9994('0x28')](respondWithResult(_0x4b9e25,null))[_0x9994('0x44')](handleError(_0x4b9e25,null));};exports['destroy']=function(_0x4f8e24,_0x4b2bdd){return db[_0x9994('0x30')]['find']({'where':{'id':_0x4f8e24[_0x9994('0x46')]['id']}})[_0x9994('0x28')](handleEntityNotFound(_0x4b2bdd,null))['then'](removeEntity(_0x4b2bdd,null))[_0x9994('0x44')](handleError(_0x4b2bdd,null));};exports[_0x9994('0x4c')]=function(_0x253f1c,_0x2ef490){return db[_0x9994('0x30')][_0x9994('0x4c')]()[_0x9994('0x28')](respondWithResult(_0x2ef490,null))[_0x9994('0x44')](handleError(_0x2ef490,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5a8fe80..0d97a71 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 _0x9d58=['rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','api','moment','request-promise','path'];(function(_0x3ee0cb,_0x4fd0){var _0x4ad485=function(_0x4ae599){while(--_0x4ae599){_0x3ee0cb['push'](_0x3ee0cb['shift']());}};_0x4ad485(++_0x4fd0);}(_0x9d58,0x194));var _0x89d5=function(_0x1e1b18,_0x5d471b){_0x1e1b18=_0x1e1b18-0x0;var _0x3da8f2=_0x9d58[_0x1e1b18];return _0x3da8f2;};'use strict';var _=require(_0x89d5('0x0'));var util=require(_0x89d5('0x1'));var logger=require('../../config/logger')(_0x89d5('0x2'));var moment=require(_0x89d5('0x3'));var BPromise=require('bluebird');var rp=require(_0x89d5('0x4'));var fs=require('fs');var path=require(_0x89d5('0x5'));var rimraf=require(_0x89d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x89d5('0x7'));module['exports']=function(_0x4d9aa2,_0x30125d){return _0x4d9aa2[_0x89d5('0x8')](_0x89d5('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ad4=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x2ad4,0x1bd));var _0x42ad=function(_0x65ca71,_0x126845){_0x65ca71=_0x65ca71-0x0;var _0x5cb16e=_0x2ad4[_0x65ca71];return _0x5cb16e;};'use strict';var _=require('lodash');var util=require(_0x42ad('0x0'));var logger=require(_0x42ad('0x1'))(_0x42ad('0x2'));var moment=require(_0x42ad('0x3'));var BPromise=require(_0x42ad('0x4'));var rp=require(_0x42ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42ad('0x6'));var config=require(_0x42ad('0x7'));var attributes=require(_0x42ad('0x8'));module['exports']=function(_0x16de0d,_0x2d2579){return _0x16de0d[_0x42ad('0x9')](_0x42ad('0xa'),attributes,{'tableName':'report_jscripty_questions','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 6e95503..dce0929 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 _0xf4f4=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf4f4,0x160));var _0x4f4f=function(_0x497571,_0x3c0386){_0x497571=_0x497571-0x0;var _0x579c0b=_0xf4f4[_0x497571];return _0x579c0b;};'use strict';var _=require('lodash');var util=require(_0x4f4f('0x0'));var moment=require(_0x4f4f('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f4f('0x2'));var fs=require('fs');var Redis=require(_0x4f4f('0x3'));var db=require(_0x4f4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f4f('0x5'))(_0x4f4f('0x6'));var config=require(_0x4f4f('0x7'));var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39bf00,_0x1a333a,_0x2d598a){return new BPromise(function(_0x93a84c,_0x355845){return client[_0x4f4f('0xb')](_0x39bf00,_0x2d598a)[_0x4f4f('0xc')](function(_0xf1aaee){logger[_0x4f4f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a333a,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x1a333a,_0x4f4f('0xe'),JSON[_0x4f4f('0x11')](_0xf1aaee));if(_0xf1aaee[_0x4f4f('0x12')]){if(_0xf1aaee['error'][_0x4f4f('0x13')]===0x1f4){logger[_0x4f4f('0x12')](_0x4f4f('0x14'),_0x1a333a,_0xf1aaee['error'][_0x4f4f('0x15')]);return _0x355845(_0xf1aaee[_0x4f4f('0x12')][_0x4f4f('0x15')]);}logger[_0x4f4f('0x12')](_0x4f4f('0x14'),_0x1a333a,_0xf1aaee['error'][_0x4f4f('0x15')]);return _0x93a84c(_0xf1aaee[_0x4f4f('0x12')][_0x4f4f('0x15')]);}else{logger[_0x4f4f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a333a,_0x4f4f('0xe'));_0x93a84c(_0xf1aaee['result'][_0x4f4f('0x15')]);}})[_0x4f4f('0x16')](function(_0xbab07b){logger[_0x4f4f('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a333a,_0xbab07b);_0x355845(_0xbab07b);});});} \ No newline at end of file +var _0xbcf1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','lodash','util','bluebird'];(function(_0x2ed7e2,_0x205d25){var _0x3dc889=function(_0x4404f7){while(--_0x4404f7){_0x2ed7e2['push'](_0x2ed7e2['shift']());}};_0x3dc889(++_0x205d25);}(_0xbcf1,0xbb));var _0x1bcf=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0xbcf1[_0x495b3d];return _0x4cb329;};'use strict';var _=require(_0x1bcf('0x0'));var util=require(_0x1bcf('0x1'));var moment=require('moment');var BPromise=require(_0x1bcf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bcf('0x3'));var db=require(_0x1bcf('0x4'))['db'];var utils=require(_0x1bcf('0x5'));var logger=require(_0x1bcf('0x6'))('rpc');var config=require(_0x1bcf('0x7'));var jayson=require(_0x1bcf('0x8'));var client=jayson['client'][_0x1bcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22a21f,_0x491bc8,_0x41a73e){return new BPromise(function(_0x37835a,_0xe9c18){return client[_0x1bcf('0xa')](_0x22a21f,_0x41a73e)[_0x1bcf('0xb')](function(_0x4434d4){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x491bc8,_0x1bcf('0xc'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x491bc8,_0x1bcf('0xc'),JSON['stringify'](_0x4434d4));if(_0x4434d4[_0x1bcf('0xd')]){if(_0x4434d4[_0x1bcf('0xd')][_0x1bcf('0xe')]===0x1f4){logger[_0x1bcf('0xd')](_0x1bcf('0xf'),_0x491bc8,_0x4434d4[_0x1bcf('0xd')][_0x1bcf('0x10')]);return _0xe9c18(_0x4434d4[_0x1bcf('0xd')][_0x1bcf('0x10')]);}logger[_0x1bcf('0xd')](_0x1bcf('0xf'),_0x491bc8,_0x4434d4[_0x1bcf('0xd')][_0x1bcf('0x10')]);return _0x37835a(_0x4434d4[_0x1bcf('0xd')]['message']);}else{logger[_0x1bcf('0x11')](_0x1bcf('0xf'),_0x491bc8,'request\x20sent');_0x37835a(_0x4434d4[_0x1bcf('0x12')][_0x1bcf('0x10')]);}})['catch'](function(_0x32db73){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x491bc8,_0x32db73);_0xe9c18(_0x32db73);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 55d0f53..3ac183e 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 _0x7a08=['get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','post','create','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x7a08,0x11e));var _0x87a0=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0x7a08[_0x29a08d];return _0x10fc1a;};'use strict';var multer=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x87a0('0x2'));var router=express[_0x87a0('0x3')]();var auth=require(_0x87a0('0x4'));var interaction=require(_0x87a0('0x5'));var config=require(_0x87a0('0x6'));var controller=require(_0x87a0('0x7'));router[_0x87a0('0x8')]('/',auth[_0x87a0('0x9')](),controller[_0x87a0('0xa')]);router[_0x87a0('0x8')](_0x87a0('0xb'),auth['isAuthenticated'](),controller[_0x87a0('0xc')]);router[_0x87a0('0x8')](_0x87a0('0xd'),auth[_0x87a0('0x9')](),controller[_0x87a0('0xe')]);router['get']('/:id/questions',auth[_0x87a0('0x9')](),controller[_0x87a0('0xf')]);router[_0x87a0('0x10')]('/',auth[_0x87a0('0x9')](),controller[_0x87a0('0x11')]);router['put'](_0x87a0('0xd'),auth[_0x87a0('0x9')](),controller[_0x87a0('0x12')]);router['delete'](_0x87a0('0xd'),auth[_0x87a0('0x9')](),controller[_0x87a0('0x13')]);module[_0x87a0('0x14')]=router; \ No newline at end of file +var _0x2ce1=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/:id','/:id/questions','getQuestions','put','update'];(function(_0x5ec94f,_0x5581c8){var _0x39c511=function(_0x144fc4){while(--_0x144fc4){_0x5ec94f['push'](_0x5ec94f['shift']());}};_0x39c511(++_0x5581c8);}(_0x2ce1,0x8b));var _0x12ce=function(_0x43e204,_0x170c00){_0x43e204=_0x43e204-0x0;var _0x470361=_0x2ce1[_0x43e204];return _0x470361;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x12ce('0x0'));var express=require(_0x12ce('0x1'));var router=express[_0x12ce('0x2')]();var auth=require(_0x12ce('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x12ce('0x4'));var controller=require(_0x12ce('0x5'));router['get']('/',auth[_0x12ce('0x6')](),controller[_0x12ce('0x7')]);router[_0x12ce('0x8')]('/describe',auth[_0x12ce('0x6')](),controller['describe']);router[_0x12ce('0x8')](_0x12ce('0x9'),auth[_0x12ce('0x6')](),controller['show']);router[_0x12ce('0x8')](_0x12ce('0xa'),auth[_0x12ce('0x6')](),controller[_0x12ce('0xb')]);router['post']('/',auth[_0x12ce('0x6')](),controller['create']);router[_0x12ce('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x12ce('0xd')]);router[_0x12ce('0xe')](_0x12ce('0x9'),auth[_0x12ce('0x6')](),controller[_0x12ce('0xf')]);module[_0x12ce('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e7eccba..9804e2e 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 _0xfce5=['setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','exports','DATE'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfce5,0xed));var _0x5fce=function(_0xc9cd47,_0x35a546){_0xc9cd47=_0xc9cd47-0x0;var _0x26827e=_0xfce5[_0xc9cd47];return _0x26827e;};'use strict';var moment=require(_0x5fce('0x0'));var Sequelize=require('sequelize');module[_0x5fce('0x1')]={'starttime':{'type':Sequelize[_0x5fce('0x2')],'set':function(_0x130f40){this[_0x5fce('0x3')](_0x5fce('0x4'),_0x130f40);this[_0x5fce('0x3')](_0x5fce('0x5'),moment()['format'](_0x5fce('0x6')));}},'endtime':{'type':Sequelize[_0x5fce('0x2')]},'membername':{'type':Sequelize[_0x5fce('0x7')]},'projectname':{'type':Sequelize[_0x5fce('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5fce('0x7')]},'calleridnum':{'type':Sequelize[_0x5fce('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x71d4=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x71d4,0x123));var _0x471d=function(_0x7c823b,_0x52e363){_0x7c823b=_0x7c823b-0x0;var _0x1bba04=_0x71d4[_0x7c823b];return _0x1bba04;};'use strict';var moment=require(_0x471d('0x0'));var Sequelize=require(_0x471d('0x1'));module[_0x471d('0x2')]={'starttime':{'type':Sequelize[_0x471d('0x3')],'set':function(_0x1618e0){this[_0x471d('0x4')](_0x471d('0x5'),_0x1618e0);this[_0x471d('0x4')](_0x471d('0x6'),moment()[_0x471d('0x7')](_0x471d('0x8')));}},'endtime':{'type':Sequelize[_0x471d('0x3')]},'membername':{'type':Sequelize[_0x471d('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x471d('0x9')]},'uniqueid':{'type':Sequelize[_0x471d('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x471d('0x9')]},'completed':{'type':Sequelize[_0x471d('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ccde96d..b849afb 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 _0xa9e0=['mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','getQuestions','findOne','pick','JscriptyQuestionReport','html-pdf','eml-format','rimraf','request-promise','bluebird'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':!![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['JscriptySessionReport'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b){return db['JscriptySessionReport'][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports[_0x0a9e('0x46')]=function(_0x61bb17,_0x30decb,_0x2e5165){var _0x375c18={'raw':!![],'where':{}};var _0x5d38ae={};var _0x4b1b9f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0a9e('0x47')]({'where':{'id':_0x61bb17[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))['then'](function(_0x2b69d9){if(_0x2b69d9){_0x5d38ae[_0x0a9e('0x2a')]=_['keys'](db['JscriptyQuestionReport'][_0x0a9e('0x27')]);_0x5d38ae['query']=_[_0x0a9e('0x3f')](_0x61bb17['query']);_0x5d38ae[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5d38ae[_0x0a9e('0x2a')],_0x5d38ae['query']);_0x375c18[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5d38ae['model'],qs['fields'](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x375c18['attributes']=_0x375c18[_0x0a9e('0x2e')]['length']?_0x375c18[_0x0a9e('0x2e')]:_0x5d38ae['model'];if(!_0x61bb17[_0x0a9e('0x2b')]['hasOwnProperty']('nolimit')){_0x375c18['limit']=qs[_0x0a9e('0x1a')](_0x61bb17['query'][_0x0a9e('0x1a')]);_0x375c18[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}_0x375c18[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x61bb17[_0x0a9e('0x2b')]['sort']);_0x375c18[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x48')](_0x61bb17[_0x0a9e('0x2b')],_0x5d38ae[_0x0a9e('0x2c')]));_0x375c18[_0x0a9e('0x34')]['SessionId']=_0x2b69d9['id'];if(_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x375c18['where']=_[_0x0a9e('0x37')](_0x375c18['where'],{'$or':_[_0x0a9e('0x25')](_0x375c18['attributes'],function(_0x4b3c1a){var _0x5674ee={};_0x5674ee[_0x4b3c1a]={'$like':'%'+_0x61bb17[_0x0a9e('0x2b')]['filter']+'%'};return _0x5674ee;})});}_0x375c18=_[_0x0a9e('0x37')]({},_0x375c18,_0x61bb17[_0x0a9e('0x40')]);return db[_0x0a9e('0x49')][_0x0a9e('0x38')]({'where':_0x375c18[_0x0a9e('0x34')]})[_0x0a9e('0x22')](function(_0x49eed0){_0x4b1b9f[_0x0a9e('0x38')]=_0x49eed0;if(_0x61bb17['query'][_0x0a9e('0x39')]){_0x375c18[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x49')]['findAll'](_0x375c18);})[_0x0a9e('0x22')](function(_0x156f1c){_0x4b1b9f[_0x0a9e('0x3c')]=_0x156f1c;return _0x4b1b9f;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x30decb,_0x375c18))['catch'](handleError(_0x30decb,null));}; \ No newline at end of file +var _0x70e0=['SessionId','options','count','rows','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','set','apply','update','destroy','then','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','params','includeAll','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','nolimit','filters'];(function(_0x1734ab,_0x254bb2){var _0x41008e=function(_0x131727){while(--_0x131727){_0x1734ab['push'](_0x1734ab['shift']());}};_0x41008e(++_0x254bb2);}(_0x70e0,0x17b));var _0x070e=function(_0x569b86,_0xd097b6){_0x569b86=_0x569b86-0x0;var _0x2fb3d4=_0x70e0[_0x569b86];return _0x2fb3d4;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');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('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var licenseUtil=require(_0x070e('0x15'));var db=require(_0x070e('0x16'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x17')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x18')](_0x4a33d2)[_0x070e('0x19')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=_0x373d86['count'],_0x180897=_0x5d3a38[_0x070e('0x1a')],_0x19d9da=_0x5d3a38[_0x070e('0x1a')]+_0x5d3a38[_0x070e('0x1b')],_0x5bc71e;if(_0x19d9da>=_0xeae1a5){_0x19d9da=_0xeae1a5;_0x5bc71e=0xc8;}else{_0x5bc71e=0xce;}_0x51d14d[_0x070e('0x18')](_0x5bc71e);return _0x51d14d[_0x070e('0x1c')]('Content-Range',_0x180897+'-'+_0x19d9da+'/'+_0xeae1a5)[_0x070e('0x19')](_0x373d86);}return null;};}function patchUpdates(_0x168dc6){return function(_0x1ad3de){try{jsonpatch[_0x070e('0x1d')](_0x1ad3de,_0x168dc6,!![]);}catch(_0x259893){return BPromise['reject'](_0x259893);}return _0x1ad3de['save']();};}function saveUpdates(_0x4e958f,_0x9907cf){return function(_0x3004f0){if(_0x3004f0){return _0x3004f0[_0x070e('0x1e')](_0x4e958f)['then'](function(_0x5b184){return _0x5b184;});}return null;};}function removeEntity(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x1f')]()[_0x070e('0x20')](function(){_0x5dc5d2[_0x070e('0x18')](0xcc)[_0x070e('0x17')]();});}};}function handleEntityNotFound(_0xe405e,_0x164cdf){return function(_0x595c7e){if(!_0x595c7e){_0xe405e[_0x070e('0x21')](0x194);}return _0x595c7e;};}function handleError(_0x270061,_0x4790eb){_0x4790eb=_0x4790eb||0x1f4;return function(_0x503f4d){logger[_0x070e('0x22')](_0x503f4d['stack']);if(_0x503f4d['name']){delete _0x503f4d[_0x070e('0x23')];}_0x270061[_0x070e('0x18')](_0x4790eb)[_0x070e('0x24')](_0x503f4d);};}exports[_0x070e('0x25')]=function(_0x4763c6,_0x497f58){var _0x374c54={},_0x219e48={},_0x1d72d6={'count':0x0,'rows':[]};var _0x1d2a34=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x26373b){return{'name':_0x26373b['fieldName'],'type':_0x26373b[_0x070e('0x29')][_0x070e('0x2a')]};});_0x219e48[_0x070e('0x2b')]=_['map'](_0x1d2a34,'name');_0x219e48[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x4763c6[_0x070e('0x2c')]);_0x219e48['filters']=_[_0x070e('0x2e')](_0x219e48[_0x070e('0x2b')],_0x219e48[_0x070e('0x2c')]);_0x374c54[_0x070e('0x2f')]=_['intersection'](_0x219e48['model'],qs['fields'](_0x4763c6['query'][_0x070e('0x30')]));_0x374c54['attributes']=_0x374c54[_0x070e('0x2f')][_0x070e('0x31')]?_0x374c54['attributes']:_0x219e48['model'];if(!_0x4763c6[_0x070e('0x2c')][_0x070e('0x32')]('nolimit')){_0x374c54['limit']=qs[_0x070e('0x1b')](_0x4763c6[_0x070e('0x2c')][_0x070e('0x1b')]);_0x374c54[_0x070e('0x1a')]=qs[_0x070e('0x1a')](_0x4763c6['query']['offset']);}_0x374c54[_0x070e('0x33')]=qs[_0x070e('0x34')](_0x4763c6[_0x070e('0x2c')][_0x070e('0x34')]);_0x374c54[_0x070e('0x35')]=qs['filters'](_[_0x070e('0x36')](_0x4763c6[_0x070e('0x2c')],_0x219e48['filters']),_0x1d2a34);if(_0x4763c6[_0x070e('0x2c')][_0x070e('0x37')]){_0x374c54['where']=_['merge'](_0x374c54['where'],{'$or':_[_0x070e('0x26')](_0x1d2a34,function(_0x3dfbf7){if(_0x3dfbf7[_0x070e('0x29')]!==_0x070e('0x38')){var _0x33c5f8={};_0x33c5f8[_0x3dfbf7['name']]={'$like':'%'+_0x4763c6[_0x070e('0x2c')][_0x070e('0x37')]+'%'};return _0x33c5f8;}})});}_0x374c54=_[_0x070e('0x39')]({},_0x374c54,_0x4763c6['options']);var _0x268c5d={'where':_0x374c54[_0x070e('0x35')]};return db[_0x070e('0x27')]['count'](_0x268c5d)[_0x070e('0x20')](function(_0x348092){_0x1d72d6['count']=_0x348092;if(_0x4763c6[_0x070e('0x2c')]['includeAll']){_0x374c54[_0x070e('0x3a')]=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3b')](_0x374c54);})[_0x070e('0x20')](function(_0xd03404){_0x1d72d6['rows']=_0xd03404;return _0x1d72d6;})[_0x070e('0x20')](respondWithFilteredResult(_0x497f58,_0x374c54))['catch'](handleError(_0x497f58,null));};exports['show']=function(_0x398168,_0x42c448){var _0x38879f={'raw':!![],'where':{'id':_0x398168[_0x070e('0x3c')]['id']}},_0x4d52ff={};_0x4d52ff[_0x070e('0x2b')]=_[_0x070e('0x2d')](db[_0x070e('0x27')]['rawAttributes']);_0x4d52ff[_0x070e('0x2c')]=_['keys'](_0x398168['query']);_0x4d52ff['filters']=_[_0x070e('0x2e')](_0x4d52ff[_0x070e('0x2b')],_0x4d52ff[_0x070e('0x2c')]);_0x38879f[_0x070e('0x2f')]=_[_0x070e('0x2e')](_0x4d52ff['model'],qs[_0x070e('0x30')](_0x398168['query'][_0x070e('0x30')]));_0x38879f[_0x070e('0x2f')]=_0x38879f[_0x070e('0x2f')]['length']?_0x38879f['attributes']:_0x4d52ff[_0x070e('0x2b')];if(_0x398168['query'][_0x070e('0x3d')]){_0x38879f[_0x070e('0x3a')]=[{'all':!![]}];}_0x38879f=_[_0x070e('0x39')]({},_0x38879f,_0x398168['options']);return db[_0x070e('0x27')][_0x070e('0x3e')](_0x38879f)['then'](handleEntityNotFound(_0x42c448,null))['then'](respondWithResult(_0x42c448,null))[_0x070e('0x3f')](handleError(_0x42c448,null));};exports[_0x070e('0x40')]=function(_0x2d43ce,_0x1fc7c4){return db[_0x070e('0x27')]['create'](_0x2d43ce[_0x070e('0x41')],{})[_0x070e('0x20')](respondWithResult(_0x1fc7c4,0xc9))[_0x070e('0x3f')](handleError(_0x1fc7c4,null));};exports[_0x070e('0x1e')]=function(_0x79eaa0,_0xcd1c61){if(_0x79eaa0[_0x070e('0x41')]['id']){delete _0x79eaa0[_0x070e('0x41')]['id'];}return db[_0x070e('0x27')][_0x070e('0x3e')]({'where':{'id':_0x79eaa0[_0x070e('0x3c')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xcd1c61,null))[_0x070e('0x20')](saveUpdates(_0x79eaa0[_0x070e('0x41')],null))[_0x070e('0x20')](respondWithResult(_0xcd1c61,null))['catch'](handleError(_0xcd1c61,null));};exports[_0x070e('0x1f')]=function(_0xa7a41b,_0x40298a){return db[_0x070e('0x27')][_0x070e('0x3e')]({'where':{'id':_0xa7a41b[_0x070e('0x3c')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x40298a,null))[_0x070e('0x20')](removeEntity(_0x40298a,null))[_0x070e('0x3f')](handleError(_0x40298a,null));};exports['describe']=function(_0x251696,_0x4c22da){return db[_0x070e('0x27')][_0x070e('0x42')]()['then'](respondWithResult(_0x4c22da,null))[_0x070e('0x3f')](handleError(_0x4c22da,null));};exports[_0x070e('0x43')]=function(_0x25466f,_0xa74805,_0x2b8e51){var _0x1e8a4f={'raw':!![],'where':{}};var _0x83f21e={};var _0x5694fa={'count':0x0,'rows':[]};return db[_0x070e('0x27')]['findOne']({'where':{'id':_0x25466f['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa74805,null))[_0x070e('0x20')](function(_0x208bb7){if(_0x208bb7){_0x83f21e[_0x070e('0x2b')]=_[_0x070e('0x2d')](db[_0x070e('0x44')][_0x070e('0x28')]);_0x83f21e[_0x070e('0x2c')]=_['keys'](_0x25466f[_0x070e('0x2c')]);_0x83f21e['filters']=_['intersection'](_0x83f21e[_0x070e('0x2b')],_0x83f21e[_0x070e('0x2c')]);_0x1e8a4f['attributes']=_[_0x070e('0x2e')](_0x83f21e[_0x070e('0x2b')],qs[_0x070e('0x30')](_0x25466f[_0x070e('0x2c')][_0x070e('0x30')]));_0x1e8a4f[_0x070e('0x2f')]=_0x1e8a4f[_0x070e('0x2f')]['length']?_0x1e8a4f['attributes']:_0x83f21e['model'];if(!_0x25466f[_0x070e('0x2c')][_0x070e('0x32')](_0x070e('0x45'))){_0x1e8a4f[_0x070e('0x1b')]=qs['limit'](_0x25466f[_0x070e('0x2c')]['limit']);_0x1e8a4f[_0x070e('0x1a')]=qs[_0x070e('0x1a')](_0x25466f[_0x070e('0x2c')][_0x070e('0x1a')]);}_0x1e8a4f[_0x070e('0x33')]=qs[_0x070e('0x34')](_0x25466f['query'][_0x070e('0x34')]);_0x1e8a4f[_0x070e('0x35')]=qs[_0x070e('0x46')](_['pick'](_0x25466f[_0x070e('0x2c')],_0x83f21e[_0x070e('0x46')]));_0x1e8a4f['where'][_0x070e('0x47')]=_0x208bb7['id'];if(_0x25466f['query'][_0x070e('0x37')]){_0x1e8a4f['where']=_['merge'](_0x1e8a4f['where'],{'$or':_[_0x070e('0x26')](_0x1e8a4f[_0x070e('0x2f')],function(_0x1100d8){var _0x122198={};_0x122198[_0x1100d8]={'$like':'%'+_0x25466f[_0x070e('0x2c')][_0x070e('0x37')]+'%'};return _0x122198;})});}_0x1e8a4f=_['merge']({},_0x1e8a4f,_0x25466f[_0x070e('0x48')]);return db['JscriptyQuestionReport'][_0x070e('0x49')]({'where':_0x1e8a4f['where']})[_0x070e('0x20')](function(_0x34f410){_0x5694fa['count']=_0x34f410;if(_0x25466f[_0x070e('0x2c')]['includeAll']){_0x1e8a4f[_0x070e('0x3a')]=[{'all':!![]}];}return db[_0x070e('0x44')][_0x070e('0x3b')](_0x1e8a4f);})[_0x070e('0x20')](function(_0x764b06){_0x5694fa[_0x070e('0x4a')]=_0x764b06;return _0x5694fa;});}})[_0x070e('0x20')](respondWithFilteredResult(_0xa74805,_0x1e8a4f))[_0x070e('0x3f')](handleError(_0xa74805,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 223ccc9..973fb9a 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 _0xab69=['api','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab69,0x6d));var _0x9ab6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xab69[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x9ab6('0x0'));var logger=require('../../config/logger')(_0x9ab6('0x1'));var moment=require('moment');var BPromise=require(_0x9ab6('0x2'));var rp=require(_0x9ab6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ab6('0x4'));var config=require(_0x9ab6('0x5'));var attributes=require(_0x9ab6('0x6'));module[_0x9ab6('0x7')]=function(_0x40da32,_0x39704b){return _0x40da32[_0x9ab6('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x9ab6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x051a=['define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x5bec6f,_0x26e692){var _0x35b36d=function(_0xedfdcb){while(--_0xedfdcb){_0x5bec6f['push'](_0x5bec6f['shift']());}};_0x35b36d(++_0x26e692);}(_0x051a,0x1b2));var _0xa051=function(_0x175d1e,_0x5a4592){_0x175d1e=_0x175d1e-0x0;var _0x1dc660=_0x051a[_0x175d1e];return _0x1dc660;};'use strict';var _=require(_0xa051('0x0'));var util=require('util');var logger=require(_0xa051('0x1'))(_0xa051('0x2'));var moment=require(_0xa051('0x3'));var BPromise=require(_0xa051('0x4'));var rp=require(_0xa051('0x5'));var fs=require('fs');var path=require(_0xa051('0x6'));var rimraf=require('rimraf');var config=require(_0xa051('0x7'));var attributes=require(_0xa051('0x8'));module[_0xa051('0x9')]=function(_0x312deb,_0x5a9d52){return _0x312deb[_0xa051('0xa')](_0xa051('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 283c3da..e2cdd0f 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 _0x542d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1f29a7,_0x108ee9){var _0x1b5260=function(_0x1f4138){while(--_0x1f4138){_0x1f29a7['push'](_0x1f29a7['shift']());}};_0x1b5260(++_0x108ee9);}(_0x542d,0xf7));var _0xd542=function(_0x4c3e9f,_0x57d56b){_0x4c3e9f=_0x4c3e9f-0x0;var _0xd8bc64=_0x542d[_0x4c3e9f];return _0xd8bc64;};'use strict';var _=require(_0xd542('0x0'));var util=require(_0xd542('0x1'));var moment=require(_0xd542('0x2'));var BPromise=require(_0xd542('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd542('0x4'));var db=require(_0xd542('0x5'))['db'];var utils=require(_0xd542('0x6'));var logger=require('../../config/logger')(_0xd542('0x7'));var config=require(_0xd542('0x8'));var jayson=require(_0xd542('0x9'));var client=jayson[_0xd542('0xa')][_0xd542('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15928a,_0x314ee2,_0x5676aa){return new BPromise(function(_0x5cc4d6,_0x277a0a){return client[_0xd542('0xc')](_0x15928a,_0x5676aa)[_0xd542('0xd')](function(_0x16df1a){logger[_0xd542('0xe')](_0xd542('0xf'),_0x314ee2,'request\x20sent');logger[_0xd542('0x10')](_0xd542('0x11'),_0x314ee2,_0xd542('0x12'),JSON['stringify'](_0x16df1a));if(_0x16df1a[_0xd542('0x13')]){if(_0x16df1a[_0xd542('0x13')]['code']===0x1f4){logger[_0xd542('0x13')](_0xd542('0xf'),_0x314ee2,_0x16df1a[_0xd542('0x13')]['message']);return _0x277a0a(_0x16df1a[_0xd542('0x13')]['message']);}logger[_0xd542('0x13')](_0xd542('0xf'),_0x314ee2,_0x16df1a[_0xd542('0x13')]['message']);return _0x5cc4d6(_0x16df1a['error'][_0xd542('0x14')]);}else{logger[_0xd542('0xe')](_0xd542('0xf'),_0x314ee2,_0xd542('0x12'));_0x5cc4d6(_0x16df1a[_0xd542('0x15')][_0xd542('0x14')]);}})[_0xd542('0x16')](function(_0x956d0a){logger['error'](_0xd542('0xf'),_0x314ee2,_0x956d0a);_0x277a0a(_0x956d0a);});});} \ No newline at end of file +var _0x5a21=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc12990,_0x469f2f){var _0x4aaeac=function(_0x352f73){while(--_0x352f73){_0xc12990['push'](_0xc12990['shift']());}};_0x4aaeac(++_0x469f2f);}(_0x5a21,0xcd));var _0x15a2=function(_0x4c9535,_0x2c0468){_0x4c9535=_0x4c9535-0x0;var _0x4c57b8=_0x5a21[_0x4c9535];return _0x4c57b8;};'use strict';var _=require(_0x15a2('0x0'));var util=require(_0x15a2('0x1'));var moment=require(_0x15a2('0x2'));var BPromise=require(_0x15a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15a2('0x4'))['db'];var utils=require(_0x15a2('0x5'));var logger=require(_0x15a2('0x6'))('rpc');var config=require(_0x15a2('0x7'));var jayson=require(_0x15a2('0x8'));var client=jayson['client'][_0x15a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34570a,_0x45d21d,_0x529a80){return new BPromise(function(_0xda41a,_0x5f0397){return client[_0x15a2('0xa')](_0x34570a,_0x529a80)['then'](function(_0x172934){logger[_0x15a2('0xb')](_0x15a2('0xc'),_0x45d21d,_0x15a2('0xd'));logger[_0x15a2('0xe')](_0x15a2('0xf'),_0x45d21d,_0x15a2('0xd'),JSON[_0x15a2('0x10')](_0x172934));if(_0x172934['error']){if(_0x172934['error'][_0x15a2('0x11')]===0x1f4){logger[_0x15a2('0x12')](_0x15a2('0xc'),_0x45d21d,_0x172934[_0x15a2('0x12')]['message']);return _0x5f0397(_0x172934[_0x15a2('0x12')]['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x45d21d,_0x172934[_0x15a2('0x12')][_0x15a2('0x13')]);return _0xda41a(_0x172934[_0x15a2('0x12')][_0x15a2('0x13')]);}else{logger[_0x15a2('0xb')](_0x15a2('0xc'),_0x45d21d,_0x15a2('0xd'));_0xda41a(_0x172934[_0x15a2('0x14')][_0x15a2('0x13')]);}})[_0x15a2('0x15')](function(_0x4d528d){logger['error'](_0x15a2('0xc'),_0x45d21d,_0x4d528d);_0x5f0397(_0x4d528d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f732037..a55d3dc 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 _0x35e0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','put','/:id','isAuthenticated','multer','path'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0x35e0,0x112));var _0x035e=function(_0x5d863b,_0x2f911e){_0x5d863b=_0x5d863b-0x0;var _0x48bef6=_0x35e0[_0x5d863b];return _0x48bef6;};'use strict';var multer=require(_0x035e('0x0'));var util=require('util');var path=require(_0x035e('0x1'));var timeout=require(_0x035e('0x2'));var express=require(_0x035e('0x3'));var router=express[_0x035e('0x4')]();var auth=require(_0x035e('0x5'));var interaction=require(_0x035e('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x035e('0x7')]('/',controller[_0x035e('0x8')]);router[_0x035e('0x9')](_0x035e('0xa'),auth[_0x035e('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xee81=['express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','update','exports','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee81,0x15d));var _0x1ee8=function(_0x156098,_0x3bf5e4){_0x156098=_0x156098-0x0;var _0x146fae=_0xee81[_0x156098];return _0x146fae;};'use strict';var multer=require('multer');var util=require(_0x1ee8('0x0'));var path=require('path');var timeout=require(_0x1ee8('0x1'));var express=require(_0x1ee8('0x2'));var router=express[_0x1ee8('0x3')]();var auth=require(_0x1ee8('0x4'));var interaction=require(_0x1ee8('0x5'));var config=require('../../config/environment');var controller=require(_0x1ee8('0x6'));router[_0x1ee8('0x7')]('/',controller[_0x1ee8('0x8')]);router[_0x1ee8('0x9')](_0x1ee8('0xa'),auth['isAuthenticated'](),controller[_0x1ee8('0xb')]);module[_0x1ee8('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2b77ea6..b6d2e30 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 _0xc4aa=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x438903,_0x4d2598){var _0x5cfe29=function(_0x42fdbd){while(--_0x42fdbd){_0x438903['push'](_0x438903['shift']());}};_0x5cfe29(++_0x4d2598);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'license':{'type':Sequelize[_0xac4a('0x2')]},'data1':{'type':Sequelize[_0xac4a('0x3')]},'data2':{'type':Sequelize[_0xac4a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf494=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x41cf5e,_0x5586dd){var _0x23ae0c=function(_0x2b9da9){while(--_0x2b9da9){_0x41cf5e['push'](_0x41cf5e['shift']());}};_0x23ae0c(++_0x5586dd);}(_0xf494,0x1c6));var _0x4f49=function(_0x482d07,_0x3422ed){_0x482d07=_0x482d07-0x0;var _0x48054c=_0xf494[_0x482d07];return _0x48054c;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'license':{'type':Sequelize[_0x4f49('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x4f49('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x4f49('0x4')],'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 ba8cbcf..a093d36 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 _0xd8b1=['fast-json-patch','moment','bluebird','util','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','model','License','rawAttributes','query','keys','intersection','attributes','fields','length','merge','options','body','find','get','checkLicense','key','catch','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x421d1f,_0x103891){var _0x4228bf=function(_0x4e30fc){while(--_0x4e30fc){_0x421d1f['push'](_0x421d1f['shift']());}};_0x4228bf(++_0x103891);}(_0xd8b1,0x105));var _0x1d8b=function(_0x20d4ef,_0x4cdc0f){_0x20d4ef=_0x20d4ef-0x0;var _0x135b81=_0xd8b1[_0x20d4ef];return _0x135b81;};'use strict';var pdf=require(_0x1d8b('0x0'));var emlformat=require(_0x1d8b('0x1'));var rimraf=require(_0x1d8b('0x2'));var zipdir=require(_0x1d8b('0x3'));var jsonpatch=require(_0x1d8b('0x4'));var rp=require('request-promise');var moment=require(_0x1d8b('0x5'));var BPromise=require(_0x1d8b('0x6'));var Mustache=require('mustache');var util=require(_0x1d8b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1d8b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d8b('0x9'));var crypto=require(_0x1d8b('0xa'));var jsforce=require(_0x1d8b('0xb'));var deskjs=require(_0x1d8b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d8b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d8b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d8b('0xf'));var logger=require('../../config/logger')(_0x1d8b('0x10'));var utils=require(_0x1d8b('0x11'));var config=require(_0x1d8b('0x12'));var licenseUtil=require(_0x1d8b('0x13'));var db=require(_0x1d8b('0x14'))['db'];function respondWithStatusCode(_0xfd985b,_0x4f506a){_0x4f506a=_0x4f506a||0xcc;return function(_0xec0671){if(_0xec0671){return _0xfd985b[_0x1d8b('0x15')](_0x4f506a);}return _0xfd985b[_0x1d8b('0x16')](_0x4f506a)[_0x1d8b('0x17')]();};}function respondWithResult(_0x4486a8,_0x3a23d0){_0x3a23d0=_0x3a23d0||0xc8;return function(_0x46bd8c){if(_0x46bd8c){return _0x4486a8[_0x1d8b('0x16')](_0x3a23d0)['json'](_0x46bd8c);}};}function respondWithFilteredResult(_0x50c75f,_0x3d54d3){return function(_0x3f31a4){if(_0x3f31a4){var _0x44ebbe=_0x3f31a4['count'],_0x3bebce=_0x3d54d3['offset'],_0x334824=_0x3d54d3[_0x1d8b('0x18')]+_0x3d54d3[_0x1d8b('0x19')],_0x144556;if(_0x334824>=_0x44ebbe){_0x334824=_0x44ebbe;_0x144556=0xc8;}else{_0x144556=0xce;}_0x50c75f[_0x1d8b('0x16')](_0x144556);return _0x50c75f[_0x1d8b('0x1a')](_0x1d8b('0x1b'),_0x3bebce+'-'+_0x334824+'/'+_0x44ebbe)['json'](_0x3f31a4);}return null;};}function patchUpdates(_0x40cf64){return function(_0x57c63a){try{jsonpatch['apply'](_0x57c63a,_0x40cf64,!![]);}catch(_0x2d03e2){return BPromise[_0x1d8b('0x1c')](_0x2d03e2);}return _0x57c63a[_0x1d8b('0x1d')]();};}function saveUpdates(_0x4f3342,_0x2274c5){return function(_0x444831){if(_0x444831){return _0x444831[_0x1d8b('0x1e')](_0x4f3342)[_0x1d8b('0x1f')](function(_0x2f9f64){return _0x2f9f64;});}return null;};}function removeEntity(_0x130c00,_0x3c2c78){return function(_0x4d5ea8){if(_0x4d5ea8){return _0x4d5ea8[_0x1d8b('0x20')]()[_0x1d8b('0x1f')](function(){_0x130c00[_0x1d8b('0x16')](0xcc)[_0x1d8b('0x17')]();});}};}function handleEntityNotFound(_0x5235b6,_0x5bee29){return function(_0x41ddd6){if(!_0x41ddd6){_0x5235b6[_0x1d8b('0x15')](0x194);}return _0x41ddd6;};}function handleError(_0x49cc58,_0x1dd052){_0x1dd052=_0x1dd052||0x1f4;return function(_0x461405){logger['error'](_0x461405['stack']);if(_0x461405[_0x1d8b('0x21')]){delete _0x461405[_0x1d8b('0x21')];}_0x49cc58[_0x1d8b('0x16')](_0x1dd052)[_0x1d8b('0x22')](_0x461405);};}var utilLicense=require(_0x1d8b('0x13'));exports[_0x1d8b('0x23')]=function(_0x1d525f,_0x59d3bf){var _0x27371d={'raw':!![],'where':{'id':0x1}},_0x4e03da={};_0x4e03da[_0x1d8b('0x24')]=_['keys'](db[_0x1d8b('0x25')][_0x1d8b('0x26')]);_0x4e03da[_0x1d8b('0x27')]=_[_0x1d8b('0x28')](_0x1d525f['query']);_0x4e03da['filters']=_[_0x1d8b('0x29')](_0x4e03da[_0x1d8b('0x24')],_0x4e03da[_0x1d8b('0x27')]);_0x27371d[_0x1d8b('0x2a')]=_[_0x1d8b('0x29')](_0x4e03da[_0x1d8b('0x24')],qs['fields'](_0x1d525f[_0x1d8b('0x27')][_0x1d8b('0x2b')]));_0x27371d[_0x1d8b('0x2a')]=_0x27371d[_0x1d8b('0x2a')][_0x1d8b('0x2c')]?_0x27371d[_0x1d8b('0x2a')]:_0x4e03da[_0x1d8b('0x24')];_0x27371d=_[_0x1d8b('0x2d')]({},_0x27371d,_0x1d525f[_0x1d8b('0x2e')]);return utilLicense['getLicense'](_0x27371d)[_0x1d8b('0x1f')](respondWithResult(_0x59d3bf,null))['catch'](handleError(_0x59d3bf,null));};exports['update']=function(_0x5d844a,_0x25a4db){if(_0x5d844a[_0x1d8b('0x2f')]['id']){delete _0x5d844a[_0x1d8b('0x2f')]['id'];}return db[_0x1d8b('0x25')][_0x1d8b('0x30')]({'where':{'id':_0x5d844a['params']['id']}})[_0x1d8b('0x1f')](handleEntityNotFound(_0x25a4db,null))[_0x1d8b('0x1f')](function(_0x1bb100){var _0xd18d69=_0x1bb100[_0x1d8b('0x31')]({'plain':!![]});return utilLicense[_0x1d8b('0x32')](_0xd18d69,_0x5d844a[_0x1d8b('0x2f')][_0x1d8b('0x33')]);})['then'](function(_0x45517f){if(!_0x45517f['demo']){return saveUpdates(_0x5d844a[_0x1d8b('0x2f')],null);}return _0x45517f;})['then'](respondWithResult(_0x25a4db,null))[_0x1d8b('0x34')](handleError(_0x25a4db,null));}; \ No newline at end of file +var _0x60c2=['update','then','destroy','error','name','index','keys','License','rawAttributes','query','filters','model','attributes','intersection','fields','length','catch','body','find','get','checkLicense','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject'];(function(_0xd1b9bd,_0xfc2a60){var _0x316a27=function(_0x465dd9){while(--_0x465dd9){_0xd1b9bd['push'](_0xd1b9bd['shift']());}};_0x316a27(++_0xfc2a60);}(_0x60c2,0x8f));var _0x260c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60c2[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x260c('0x0'));var rimraf=require(_0x260c('0x1'));var zipdir=require(_0x260c('0x2'));var jsonpatch=require(_0x260c('0x3'));var rp=require(_0x260c('0x4'));var moment=require(_0x260c('0x5'));var BPromise=require(_0x260c('0x6'));var Mustache=require(_0x260c('0x7'));var util=require(_0x260c('0x8'));var path=require(_0x260c('0x9'));var sox=require(_0x260c('0xa'));var csv=require(_0x260c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x260c('0xc'));var squel=require(_0x260c('0xd'));var crypto=require(_0x260c('0xe'));var jsforce=require(_0x260c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x260c('0xb'));var querystring=require(_0x260c('0x10'));var Papa=require(_0x260c('0x11'));var Redis=require(_0x260c('0x12'));var authService=require(_0x260c('0x13'));var qs=require(_0x260c('0x14'));var as=require(_0x260c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x16'))(_0x260c('0x17'));var utils=require(_0x260c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x19'));var db=require(_0x260c('0x1a'))['db'];function respondWithStatusCode(_0x191490,_0x5aed37){_0x5aed37=_0x5aed37||0xcc;return function(_0xc44e8d){if(_0xc44e8d){return _0x191490[_0x260c('0x1b')](_0x5aed37);}return _0x191490[_0x260c('0x1c')](_0x5aed37)[_0x260c('0x1d')]();};}function respondWithResult(_0x1d3775,_0x53df53){_0x53df53=_0x53df53||0xc8;return function(_0x3930b6){if(_0x3930b6){return _0x1d3775['status'](_0x53df53)[_0x260c('0x1e')](_0x3930b6);}};}function respondWithFilteredResult(_0x5a021c,_0x47edc1){return function(_0xd8b310){if(_0xd8b310){var _0x5299a4=_0xd8b310[_0x260c('0x1f')],_0x1a9b2a=_0x47edc1[_0x260c('0x20')],_0x27e864=_0x47edc1[_0x260c('0x20')]+_0x47edc1[_0x260c('0x21')],_0x411970;if(_0x27e864>=_0x5299a4){_0x27e864=_0x5299a4;_0x411970=0xc8;}else{_0x411970=0xce;}_0x5a021c[_0x260c('0x1c')](_0x411970);return _0x5a021c[_0x260c('0x22')](_0x260c('0x23'),_0x1a9b2a+'-'+_0x27e864+'/'+_0x5299a4)[_0x260c('0x1e')](_0xd8b310);}return null;};}function patchUpdates(_0x5a8a76){return function(_0xd977b){try{jsonpatch['apply'](_0xd977b,_0x5a8a76,!![]);}catch(_0xc79076){return BPromise[_0x260c('0x24')](_0xc79076);}return _0xd977b['save']();};}function saveUpdates(_0x1ccf81,_0xe824db){return function(_0x3cd55f){if(_0x3cd55f){return _0x3cd55f[_0x260c('0x25')](_0x1ccf81)[_0x260c('0x26')](function(_0x156f2b){return _0x156f2b;});}return null;};}function removeEntity(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x27')]()[_0x260c('0x26')](function(){_0x4b5b7a['status'](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x304961,_0x461c8a){return function(_0x30eca9){if(!_0x30eca9){_0x304961['sendStatus'](0x194);}return _0x30eca9;};}function handleError(_0x3b111a,_0x4eb56f){_0x4eb56f=_0x4eb56f||0x1f4;return function(_0x3bdfce){logger[_0x260c('0x28')](_0x3bdfce['stack']);if(_0x3bdfce[_0x260c('0x29')]){delete _0x3bdfce[_0x260c('0x29')];}_0x3b111a['status'](_0x4eb56f)['send'](_0x3bdfce);};}var utilLicense=require(_0x260c('0x19'));exports[_0x260c('0x2a')]=function(_0x43a894,_0x21dc90){var _0x357790={'raw':!![],'where':{'id':0x1}},_0x3f70ec={};_0x3f70ec['model']=_[_0x260c('0x2b')](db[_0x260c('0x2c')][_0x260c('0x2d')]);_0x3f70ec[_0x260c('0x2e')]=_['keys'](_0x43a894[_0x260c('0x2e')]);_0x3f70ec[_0x260c('0x2f')]=_['intersection'](_0x3f70ec[_0x260c('0x30')],_0x3f70ec[_0x260c('0x2e')]);_0x357790[_0x260c('0x31')]=_[_0x260c('0x32')](_0x3f70ec[_0x260c('0x30')],qs[_0x260c('0x33')](_0x43a894[_0x260c('0x2e')][_0x260c('0x33')]));_0x357790['attributes']=_0x357790[_0x260c('0x31')][_0x260c('0x34')]?_0x357790['attributes']:_0x3f70ec[_0x260c('0x30')];_0x357790=_['merge']({},_0x357790,_0x43a894['options']);return utilLicense['getLicense'](_0x357790)[_0x260c('0x26')](respondWithResult(_0x21dc90,null))[_0x260c('0x35')](handleError(_0x21dc90,null));};exports['update']=function(_0x329279,_0x2b3cd9){if(_0x329279[_0x260c('0x36')]['id']){delete _0x329279[_0x260c('0x36')]['id'];}return db[_0x260c('0x2c')][_0x260c('0x37')]({'where':{'id':_0x329279['params']['id']}})[_0x260c('0x26')](handleEntityNotFound(_0x2b3cd9,null))[_0x260c('0x26')](function(_0x117c15){var _0x26ab6e=_0x117c15[_0x260c('0x38')]({'plain':!![]});return utilLicense[_0x260c('0x39')](_0x26ab6e,_0x329279[_0x260c('0x36')][_0x260c('0x3a')]);})[_0x260c('0x26')](function(_0x5554a5){if(!_0x5554a5[_0x260c('0x3b')]){return saveUpdates(_0x329279['body'],null);}return _0x5554a5;})['then'](respondWithResult(_0x2b3cd9,null))['catch'](handleError(_0x2b3cd9,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 9e85122..eded284 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 _0xdec1=['moment','request-promise','path','rimraf','./license.attributes','exports','define','license','lodash','../../config/logger','api'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0xdec1,0x105));var _0x1dec=function(_0x25fd84,_0x5d88cd){_0x25fd84=_0x25fd84-0x0;var _0xa4f9cc=_0xdec1[_0x25fd84];return _0xa4f9cc;};'use strict';var _=require(_0x1dec('0x0'));var util=require('util');var logger=require(_0x1dec('0x1'))(_0x1dec('0x2'));var moment=require(_0x1dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x1dec('0x4'));var fs=require('fs');var path=require(_0x1dec('0x5'));var rimraf=require(_0x1dec('0x6'));var config=require('../../config/environment');var attributes=require(_0x1dec('0x7'));module[_0x1dec('0x8')]=function(_0x5b842b,_0x345cab){return _0x5b842b[_0x1dec('0x9')]('License',attributes,{'tableName':_0x1dec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b40=['rimraf','./license.attributes','define','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b40,0x7c));var _0x07b4=function(_0x4074a3,_0x1323f1){_0x4074a3=_0x4074a3-0x0;var _0x47b978=_0x7b40[_0x4074a3];return _0x47b978;};'use strict';var _=require(_0x07b4('0x0'));var util=require(_0x07b4('0x1'));var logger=require(_0x07b4('0x2'))(_0x07b4('0x3'));var moment=require(_0x07b4('0x4'));var BPromise=require(_0x07b4('0x5'));var rp=require(_0x07b4('0x6'));var fs=require('fs');var path=require(_0x07b4('0x7'));var rimraf=require(_0x07b4('0x8'));var config=require('../../config/environment');var attributes=require(_0x07b4('0x9'));module['exports']=function(_0x2e7f47,_0xd45f4d){return _0x2e7f47[_0x07b4('0xa')]('License',attributes,{'tableName':_0x07b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 8ed06fa..fd60802 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 _0xb9a7=['request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','License,\x20%s,\x20%s'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0xb9a7,0x112));var _0x7b9a=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xb9a7[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('License,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('License,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file +var _0xef38=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb'];(function(_0x378487,_0x1fdc2c){var _0x3bb63b=function(_0x38c2e0){while(--_0x38c2e0){_0x378487['push'](_0x378487['shift']());}};_0x3bb63b(++_0x1fdc2c);}(_0xef38,0x122));var _0x8ef3=function(_0x1ae0a5,_0x4da654){_0x1ae0a5=_0x1ae0a5-0x0;var _0x3a4c82=_0xef38[_0x1ae0a5];return _0x3a4c82;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var moment=require(_0x8ef3('0x1'));var BPromise=require(_0x8ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef3('0x3'))['db'];var utils=require(_0x8ef3('0x4'));var logger=require(_0x8ef3('0x5'))(_0x8ef3('0x6'));var config=require(_0x8ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef3('0x8')][_0x8ef3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ee13,_0x2c9ccd,_0x26107d){return new BPromise(function(_0x217874,_0x12b6c0){return client[_0x8ef3('0xa')](_0x50ee13,_0x26107d)[_0x8ef3('0xb')](function(_0xc4b3b3){logger['info'](_0x8ef3('0xc'),_0x2c9ccd,_0x8ef3('0xd'));logger[_0x8ef3('0xe')](_0x8ef3('0xf'),_0x2c9ccd,_0x8ef3('0xd'),JSON[_0x8ef3('0x10')](_0xc4b3b3));if(_0xc4b3b3[_0x8ef3('0x11')]){if(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x12')]===0x1f4){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x12b6c0(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);}logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x217874(_0xc4b3b3['error'][_0x8ef3('0x13')]);}else{logger['info'](_0x8ef3('0xc'),_0x2c9ccd,'request\x20sent');_0x217874(_0xc4b3b3[_0x8ef3('0x14')][_0x8ef3('0x13')]);}})['catch'](function(_0x56884c){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0x56884c);_0x12b6c0(_0x56884c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e3c80eb..25950d2 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 _0x65f9=['post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','addAgents','put','/:id','update','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users'];(function(_0x4df7a7,_0x357bb5){var _0x17528d=function(_0x55fc38){while(--_0x55fc38){_0x4df7a7['push'](_0x4df7a7['shift']());}};_0x17528d(++_0x357bb5);}(_0x65f9,0x19d));var _0x965f=function(_0x1cee3a,_0x5ec759){_0x1cee3a=_0x1cee3a-0x0;var _0x51d81b=_0x65f9[_0x1cee3a];return _0x51d81b;};'use strict';var multer=require(_0x965f('0x0'));var util=require(_0x965f('0x1'));var path=require(_0x965f('0x2'));var timeout=require(_0x965f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x965f('0x4'));var interaction=require(_0x965f('0x5'));var config=require(_0x965f('0x6'));var controller=require(_0x965f('0x7'));router[_0x965f('0x8')]('/',auth[_0x965f('0x9')](),controller[_0x965f('0xa')]);router[_0x965f('0x8')](_0x965f('0xb'),auth[_0x965f('0x9')](),controller[_0x965f('0xc')]);router[_0x965f('0x8')]('/:id',auth[_0x965f('0x9')](),controller[_0x965f('0xd')]);router[_0x965f('0x8')](_0x965f('0xe'),auth['isAuthenticated'](),controller[_0x965f('0xf')]);router[_0x965f('0x8')](_0x965f('0x10'),auth[_0x965f('0x9')](),controller[_0x965f('0x11')]);router[_0x965f('0x8')](_0x965f('0x12'),auth[_0x965f('0x9')](),controller[_0x965f('0x13')]);router[_0x965f('0x8')](_0x965f('0x14'),auth[_0x965f('0x9')](),controller['getSmtp']);router[_0x965f('0x8')]('/:id/interactions',auth[_0x965f('0x9')](),controller[_0x965f('0x15')]);router[_0x965f('0x8')](_0x965f('0x16'),auth[_0x965f('0x9')](),controller[_0x965f('0x17')]);router['get'](_0x965f('0x18'),auth[_0x965f('0x9')](),controller[_0x965f('0x19')]);router[_0x965f('0x8')]('/:id/verify',auth[_0x965f('0x9')](),controller['verifySmtp']);router[_0x965f('0x8')](_0x965f('0x1a'),auth[_0x965f('0x9')](),controller['getAgents']);router[_0x965f('0x1b')](_0x965f('0xe'),auth[_0x965f('0x9')](),controller['addDisposition']);router['post'](_0x965f('0x10'),auth[_0x965f('0x9')](),controller[_0x965f('0x1c')]);router[_0x965f('0x1b')]('/',auth['isAuthenticated'](),controller[_0x965f('0x1d')]);router[_0x965f('0x1b')](_0x965f('0x12'),auth[_0x965f('0x9')](),controller[_0x965f('0x1e')]);router[_0x965f('0x1b')](_0x965f('0x14'),auth['isAuthenticated'](),controller[_0x965f('0x1f')]);router[_0x965f('0x1b')]('/:id/interactions',auth[_0x965f('0x9')](),controller[_0x965f('0x20')]);router[_0x965f('0x1b')]('/:id/applications',auth[_0x965f('0x9')](),controller[_0x965f('0x21')]);router[_0x965f('0x1b')]('/:id/send',auth['isAuthenticated'](),controller['send']);router['post'](_0x965f('0x1a'),auth[_0x965f('0x9')](),controller[_0x965f('0x22')]);router[_0x965f('0x23')](_0x965f('0x24'),auth[_0x965f('0x9')](),controller[_0x965f('0x25')]);router['delete'](_0x965f('0xe'),auth[_0x965f('0x9')](),controller[_0x965f('0x26')]);router[_0x965f('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x965f('0x28')]);router[_0x965f('0x27')](_0x965f('0x12'),auth['isAuthenticated'](),controller['removeImap']);router[_0x965f('0x27')](_0x965f('0x14'),auth['isAuthenticated'](),controller[_0x965f('0x29')]);router['delete'](_0x965f('0x24'),auth[_0x965f('0x9')](),controller[_0x965f('0x2a')]);router['delete'](_0x965f('0x1a'),auth[_0x965f('0x9')](),controller[_0x965f('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xc13c=['verifySmtp','/:id/users','post','addDisposition','addImap','addSmtp','/:id/applications','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','express','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','/describe','get','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/messages','/:id/verify'];(function(_0x121100,_0x1beeca){var _0x31cf3b=function(_0x8185af){while(--_0x8185af){_0x121100['push'](_0x121100['shift']());}};_0x31cf3b(++_0x1beeca);}(_0xc13c,0x15c));var _0xcc13=function(_0x484212,_0x3a5876){_0x484212=_0x484212-0x0;var _0x52cfb4=_0xc13c[_0x484212];return _0x52cfb4;};'use strict';var multer=require('multer');var util=require(_0xcc13('0x0'));var path=require(_0xcc13('0x1'));var timeout=require('connect-timeout');var express=require(_0xcc13('0x2'));var router=express['Router']();var auth=require(_0xcc13('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcc13('0x4'));var controller=require(_0xcc13('0x5'));router['get']('/',auth[_0xcc13('0x6')](),controller[_0xcc13('0x7')]);router['get'](_0xcc13('0x8'),auth[_0xcc13('0x6')](),controller['describe']);router[_0xcc13('0x9')](_0xcc13('0xa'),auth[_0xcc13('0x6')](),controller['show']);router[_0xcc13('0x9')](_0xcc13('0xb'),auth[_0xcc13('0x6')](),controller['getDispositions']);router[_0xcc13('0x9')](_0xcc13('0xc'),auth[_0xcc13('0x6')](),controller[_0xcc13('0xd')]);router[_0xcc13('0x9')](_0xcc13('0xe'),auth[_0xcc13('0x6')](),controller[_0xcc13('0xf')]);router['get'](_0xcc13('0x10'),auth[_0xcc13('0x6')](),controller['getSmtp']);router[_0xcc13('0x9')](_0xcc13('0x11'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x12')]);router['get']('/:id/applications',auth[_0xcc13('0x6')](),controller['getApplications']);router[_0xcc13('0x9')](_0xcc13('0x13'),auth[_0xcc13('0x6')](),controller['getMessages']);router[_0xcc13('0x9')](_0xcc13('0x14'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x15')]);router['get'](_0xcc13('0x16'),auth[_0xcc13('0x6')](),controller['getAgents']);router[_0xcc13('0x17')]('/:id/dispositions',auth[_0xcc13('0x6')](),controller[_0xcc13('0x18')]);router[_0xcc13('0x17')]('/:id/canned_answers',auth[_0xcc13('0x6')](),controller['addAnswer']);router[_0xcc13('0x17')]('/',auth[_0xcc13('0x6')](),controller['create']);router['post'](_0xcc13('0xe'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x19')]);router['post'](_0xcc13('0x10'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x1a')]);router[_0xcc13('0x17')](_0xcc13('0x11'),auth[_0xcc13('0x6')](),controller['addInteraction']);router[_0xcc13('0x17')](_0xcc13('0x1b'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x1c')]);router[_0xcc13('0x17')](_0xcc13('0x1d'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x1e')]);router[_0xcc13('0x17')](_0xcc13('0x16'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x1f')]);router[_0xcc13('0x20')](_0xcc13('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xcc13('0x21')]('/:id/dispositions',auth[_0xcc13('0x6')](),controller[_0xcc13('0x22')]);router[_0xcc13('0x21')](_0xcc13('0xc'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x23')]);router['delete'](_0xcc13('0xe'),auth['isAuthenticated'](),controller[_0xcc13('0x24')]);router[_0xcc13('0x21')](_0xcc13('0x10'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x25')]);router['delete']('/:id',auth[_0xcc13('0x6')](),controller[_0xcc13('0x26')]);router['delete'](_0xcc13('0x16'),auth[_0xcc13('0x6')](),controller[_0xcc13('0x27')]);module[_0xcc13('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b142913..d963bec 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 _0x4573=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','BOOLEAN'];(function(_0x414a73,_0xd0e5ab){var _0x585bc8=function(_0x35b078){while(--_0x35b078){_0x414a73['push'](_0x414a73['shift']());}};_0x585bc8(++_0xd0e5ab);}(_0x4573,0x64));var _0x3457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4573[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3457('0x0'));module[_0x3457('0x1')]={'description':{'type':Sequelize[_0x3457('0x2')]},'name':{'type':Sequelize[_0x3457('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x3457('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3457('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3457('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x3457('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x3457('0x4')]},'markAsUnread':{'type':Sequelize[_0x3457('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3457('0x5')},'fontSize':{'type':Sequelize[_0x3457('0x6')](0x2)[_0x3457('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3457('0x4')],'defaultValue':function(){return _0x3457('0x8');}},'notificationSound':{'type':Sequelize[_0x3457('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3457('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3457('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3457('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3457('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3457('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x3457('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3457('0xa'),'set':function(_0x35436b){if(!_0x35436b)this[_0x3457('0xb')](_0x3457('0xc'),null);this[_0x3457('0xb')]('mandatoryDisposition',_0x35436b);}}}; \ No newline at end of file +var _0x320c=['Arial,Helvetica,sans-serif','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x320c,0xec));var _0xc320=function(_0x509a86,_0x10a3a6){_0x509a86=_0x509a86-0x0;var _0x3730b6=_0x320c[_0x509a86];return _0x3730b6;};'use strict';var Sequelize=require(_0xc320('0x0'));module[_0xc320('0x1')]={'description':{'type':Sequelize[_0xc320('0x2')]},'name':{'type':Sequelize[_0xc320('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc320('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc320('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xc320('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc320('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc320('0x2')],'allowNull':![],'defaultValue':_0xc320('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc320('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xc320('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc320('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc320('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc320('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc320('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc320('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc320('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc320('0x8'),'set':function(_0x7ae06b){if(!_0x7ae06b)this[_0xc320('0x9')](_0xc320('0xa'),null);this[_0xc320('0x9')](_0xc320('0xb'),_0x7ae06b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c14e367..b08317c 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 _0xa097=['Imap','MailServerOut','Pause','includeAll','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','pass','cpassword','authentication','host','port','service','password','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','MailApplication','bulkCreate','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','split','CmList','CmContact','Contacts','updatedAt','from','attachments','join','root','server/files/attachments','basename','auth','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','secure','Sequelize','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','end','name','index','MailServerIn','Smtp','mandatoryDispositionPause','MailAccount','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','include','rows','show','params'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xa097,0x1e8));var _0x7a09=function(_0x40f5d4,_0x5c7478){_0x40f5d4=_0x40f5d4-0x0;var _0x4408b9=_0xa097[_0x40f5d4];return _0x4408b9;};'use strict';var pdf=require(_0x7a09('0x0'));var emlformat=require(_0x7a09('0x1'));var rimraf=require(_0x7a09('0x2'));var zipdir=require(_0x7a09('0x3'));var jsonpatch=require(_0x7a09('0x4'));var rp=require(_0x7a09('0x5'));var moment=require(_0x7a09('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7a09('0x7'));var util=require(_0x7a09('0x8'));var path=require(_0x7a09('0x9'));var sox=require(_0x7a09('0xa'));var csv=require(_0x7a09('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a09('0xc'));var squel=require(_0x7a09('0xd'));var crypto=require(_0x7a09('0xe'));var jsforce=require(_0x7a09('0xf'));var deskjs=require(_0x7a09('0x10'));var toCsv=require(_0x7a09('0xb'));var querystring=require('querystring');var Papa=require(_0x7a09('0x11'));var Redis=require(_0x7a09('0x12'));var authService=require(_0x7a09('0x13'));var qs=require(_0x7a09('0x14'));var as=require(_0x7a09('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7a09('0x16'));var config=require(_0x7a09('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a09('0x18'))['db'];config[_0x7a09('0x19')]=_[_0x7a09('0x1a')](config['redis'],{'host':_0x7a09('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a09('0x1c'))['register'](socket);var jayson=require(_0x7a09('0x1d'));var client=jayson[_0x7a09('0x1e')]['http']({'port':0x232b});function respondWithRpcPromise(_0xffd2e1,_0x59e821,_0x2f76d8,_0x530f6e){return new BPromise(function(_0x481080,_0x5411be){var _0x58888c=_0x530f6e||client;return _0x58888c[_0x7a09('0x1f')](_0xffd2e1,_0x2f76d8)['then'](function(_0x4106c1){logger[_0x7a09('0x20')](_0x7a09('0x21'),_0x59e821,'request\x20sent');logger[_0x7a09('0x22')](_0x7a09('0x23'),_0x59e821,_0x7a09('0x24'),JSON[_0x7a09('0x25')](_0x4106c1));if(_0x4106c1[_0x7a09('0x26')]){if(_0x4106c1[_0x7a09('0x26')][_0x7a09('0x27')]===0x1f4){logger[_0x7a09('0x26')]('MailAccount,\x20%s,\x20%s',_0x59e821,_0x4106c1[_0x7a09('0x26')][_0x7a09('0x28')]);return _0x5411be(_0x4106c1[_0x7a09('0x26')][_0x7a09('0x28')]);}logger[_0x7a09('0x26')](_0x7a09('0x21'),_0x59e821,_0x4106c1[_0x7a09('0x26')][_0x7a09('0x28')]);return _0x481080(_0x4106c1[_0x7a09('0x26')][_0x7a09('0x28')]);}else{logger[_0x7a09('0x20')](_0x7a09('0x21'),_0x59e821,_0x7a09('0x24'));_0x481080(_0x4106c1['result'][_0x7a09('0x28')]);}})[_0x7a09('0x29')](function(_0x394282){logger['error'](_0x7a09('0x21'),_0x59e821,_0x394282);_0x5411be(_0x394282);});});}function respondWithStatusCode(_0x58e07d,_0x23a1c2){_0x23a1c2=_0x23a1c2||0xcc;return function(_0x18cbbd){if(_0x18cbbd){return _0x58e07d[_0x7a09('0x2a')](_0x23a1c2);}return _0x58e07d[_0x7a09('0x2b')](_0x23a1c2)['end']();};}function respondWithResult(_0x561364,_0xca3097){_0xca3097=_0xca3097||0xc8;return function(_0x3b8da2){if(_0x3b8da2){return _0x561364['status'](_0xca3097)[_0x7a09('0x2c')](_0x3b8da2);}};}function respondWithFilteredResult(_0x545e6b,_0x4d8935){return function(_0x4f017e){if(_0x4f017e){var _0x537c0a=_0x4f017e['count'],_0x115b7b=_0x4d8935['offset'],_0xcc4902=_0x4d8935[_0x7a09('0x2d')]+_0x4d8935[_0x7a09('0x2e')],_0x291b77;if(_0xcc4902>=_0x537c0a){_0xcc4902=_0x537c0a;_0x291b77=0xc8;}else{_0x291b77=0xce;}_0x545e6b[_0x7a09('0x2b')](_0x291b77);return _0x545e6b[_0x7a09('0x2f')](_0x7a09('0x30'),_0x115b7b+'-'+_0xcc4902+'/'+_0x537c0a)['json'](_0x4f017e);}return null;};}function patchUpdates(_0x227344){return function(_0x3a247c){try{jsonpatch[_0x7a09('0x31')](_0x3a247c,_0x227344,!![]);}catch(_0x2c1eb5){return BPromise[_0x7a09('0x32')](_0x2c1eb5);}return _0x3a247c['save']();};}function saveUpdates(_0x4d823c,_0xb2a4b2){return function(_0x4aa925){if(_0x4aa925){return _0x4aa925[_0x7a09('0x33')](_0x4d823c)[_0x7a09('0x34')](function(_0x52c202){return _0x52c202;});}return null;};}function removeEntity(_0xe0e573,_0x5a8184){return function(_0x56b73a){if(_0x56b73a){return _0x56b73a['destroy']()['then'](function(){var _0x1dc492=_0x56b73a[_0x7a09('0x35')]({'plain':!![]});var _0x230a06='MailAccounts';return db[_0x7a09('0x36')][_0x7a09('0x37')]({'where':{'type':_0x230a06,'resourceId':_0x1dc492['id']}})[_0x7a09('0x34')](function(){return _0x56b73a;});})['then'](function(){_0xe0e573[_0x7a09('0x2b')](0xcc)[_0x7a09('0x38')]();});}};}function handleEntityNotFound(_0x10570a,_0x50e87d){return function(_0x2fcb26){if(!_0x2fcb26){_0x10570a['sendStatus'](0x194);}return _0x2fcb26;};}function handleError(_0x50c14f,_0x16bb6a){_0x16bb6a=_0x16bb6a||0x1f4;return function(_0x3d4877){logger[_0x7a09('0x26')](_0x3d4877['stack']);if(_0x3d4877[_0x7a09('0x39')]){delete _0x3d4877[_0x7a09('0x39')];}_0x50c14f[_0x7a09('0x2b')](_0x16bb6a)['send'](_0x3d4877);};}exports[_0x7a09('0x3a')]=function(_0x15b488,_0x373dad){var _0x5a7826={'include':[{'model':db[_0x7a09('0x3b')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x7a09('0x3c')},{'model':db['Pause'],'as':_0x7a09('0x3d')}]},_0x1feb24={},_0x17ff09={'count':0x0,'rows':[]};var _0xb01f84=_['map'](db[_0x7a09('0x3e')]['rawAttributes'],function(_0xcdbf37){return{'name':_0xcdbf37[_0x7a09('0x3f')],'type':_0xcdbf37[_0x7a09('0x40')]['key']};});_0x1feb24[_0x7a09('0x41')]=_[_0x7a09('0x42')](_0xb01f84,_0x7a09('0x39'));_0x1feb24[_0x7a09('0x43')]=_[_0x7a09('0x44')](_0x15b488['query']);_0x1feb24[_0x7a09('0x45')]=_[_0x7a09('0x46')](_0x1feb24['model'],_0x1feb24[_0x7a09('0x43')]);_0x5a7826['attributes']=_[_0x7a09('0x46')](_0x1feb24[_0x7a09('0x41')],qs[_0x7a09('0x47')](_0x15b488[_0x7a09('0x43')][_0x7a09('0x47')]));_0x5a7826[_0x7a09('0x48')]=_0x5a7826[_0x7a09('0x48')][_0x7a09('0x49')]?_0x5a7826[_0x7a09('0x48')]:_0x1feb24[_0x7a09('0x41')];if(!_0x15b488[_0x7a09('0x43')][_0x7a09('0x4a')](_0x7a09('0x4b'))){_0x5a7826[_0x7a09('0x2e')]=qs[_0x7a09('0x2e')](_0x15b488['query'][_0x7a09('0x2e')]);_0x5a7826[_0x7a09('0x2d')]=qs['offset'](_0x15b488[_0x7a09('0x43')][_0x7a09('0x2d')]);}_0x5a7826[_0x7a09('0x4c')]=qs[_0x7a09('0x4d')](_0x15b488['query']['sort']);_0x5a7826['where']=qs['filters'](_['pick'](_0x15b488[_0x7a09('0x43')],_0x1feb24[_0x7a09('0x45')]),_0xb01f84);if(_0x15b488[_0x7a09('0x43')][_0x7a09('0x4e')]){_0x5a7826[_0x7a09('0x4f')]=_[_0x7a09('0x50')](_0x5a7826[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0xb01f84,function(_0x44756a){if(_0x44756a[_0x7a09('0x40')]!==_0x7a09('0x51')){var _0xe681c2={};_0xe681c2[_0x44756a[_0x7a09('0x39')]]={'$like':'%'+_0x15b488[_0x7a09('0x43')]['filter']+'%'};return _0xe681c2;}})});}_0x5a7826=_[_0x7a09('0x50')]({},_0x5a7826,_0x15b488[_0x7a09('0x52')]);var _0x36252e={'where':_0x5a7826[_0x7a09('0x4f')]};return db['MailAccount'][_0x7a09('0x53')](_0x36252e)['then'](function(_0x7d2c50){_0x17ff09[_0x7a09('0x53')]=_0x7d2c50;if(_0x15b488['query']['includeAll']){_0x5a7826[_0x7a09('0x54')]=[{'all':!![]}];}return db[_0x7a09('0x3e')]['findAll'](_0x5a7826);})[_0x7a09('0x34')](function(_0x46469f){_0x17ff09[_0x7a09('0x55')]=_0x46469f;return _0x17ff09;})['then'](respondWithFilteredResult(_0x373dad,_0x5a7826))[_0x7a09('0x29')](handleError(_0x373dad,null));};exports[_0x7a09('0x56')]=function(_0x1e180b,_0x5f63a0){var _0x17e14f={'raw':![],'where':{'id':_0x1e180b[_0x7a09('0x57')]['id']},'include':[{'model':db[_0x7a09('0x3b')],'as':_0x7a09('0x58')},{'model':db[_0x7a09('0x59')],'as':'Smtp'},{'model':db[_0x7a09('0x5a')],'as':'mandatoryDispositionPause'}]},_0x1bd180={};_0x1bd180['model']=_[_0x7a09('0x44')](db[_0x7a09('0x3e')]['rawAttributes']);_0x1bd180[_0x7a09('0x43')]=_[_0x7a09('0x44')](_0x1e180b[_0x7a09('0x43')]);_0x1bd180[_0x7a09('0x45')]=_[_0x7a09('0x46')](_0x1bd180['model'],_0x1bd180[_0x7a09('0x43')]);_0x17e14f[_0x7a09('0x48')]=_[_0x7a09('0x46')](_0x1bd180[_0x7a09('0x41')],qs[_0x7a09('0x47')](_0x1e180b['query'][_0x7a09('0x47')]));_0x17e14f[_0x7a09('0x48')]=_0x17e14f['attributes'][_0x7a09('0x49')]?_0x17e14f['attributes']:_0x1bd180[_0x7a09('0x41')];if(_0x1e180b[_0x7a09('0x43')][_0x7a09('0x5b')]){_0x17e14f[_0x7a09('0x54')]=[{'all':!![]}];}_0x17e14f=_['merge']({},_0x17e14f,_0x1e180b['options']);return db[_0x7a09('0x3e')][_0x7a09('0x5c')](_0x17e14f)[_0x7a09('0x34')](handleEntityNotFound(_0x5f63a0,null))[_0x7a09('0x34')](respondWithResult(_0x5f63a0,null))[_0x7a09('0x29')](handleError(_0x5f63a0,null));};exports['update']=function(_0x41e39b,_0x2c6f99){if(_0x41e39b[_0x7a09('0x5d')]['id']){delete _0x41e39b[_0x7a09('0x5d')]['id'];}return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x41e39b[_0x7a09('0x57')]['id']},'include':[{'model':db[_0x7a09('0x3b')],'as':_0x7a09('0x58')},{'model':db['MailServerOut'],'as':_0x7a09('0x3c')},{'model':db[_0x7a09('0x5a')],'as':_0x7a09('0x3d')}]})[_0x7a09('0x34')](handleEntityNotFound(_0x2c6f99,null))[_0x7a09('0x34')](saveUpdates(_0x41e39b[_0x7a09('0x5d')],null))['then'](function(_0xf26409){if(_0xf26409&&_0x41e39b['body'][_0x7a09('0x58')]){return db[_0x7a09('0x3b')][_0x7a09('0x33')](_0x41e39b['body'][_0x7a09('0x58')],{'where':{'MailAccountId':_0xf26409['id']}})[_0x7a09('0x34')](function(){return _0xf26409;});}return _0xf26409;})[_0x7a09('0x34')](function(_0x1c867a){if(_0x1c867a&&_0x41e39b[_0x7a09('0x5d')]['Smtp']){return db[_0x7a09('0x59')][_0x7a09('0x33')](_0x41e39b['body'][_0x7a09('0x3c')],{'where':{'MailAccountId':_0x1c867a['id']}})['then'](function(){return _0x1c867a;});}return _0x1c867a;})['then'](respondWithResult(_0x2c6f99,null))[_0x7a09('0x29')](handleError(_0x2c6f99,null));};exports[_0x7a09('0x5e')]=function(_0x2e05f2,_0x1ebfb2){return db[_0x7a09('0x3e')][_0x7a09('0x5e')]()[_0x7a09('0x34')](respondWithResult(_0x1ebfb2,null))['catch'](handleError(_0x1ebfb2,null));};exports[_0x7a09('0x5f')]=function(_0x1b87f1,_0x565736,_0xa1c10c){if(_0x1b87f1['body']['id']){delete _0x1b87f1[_0x7a09('0x5d')]['id'];}return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x1b87f1[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x565736,null))[_0x7a09('0x34')](function(_0xe262e9){if(_0xe262e9){_0x1b87f1[_0x7a09('0x5d')][_0x7a09('0x60')]=_0xe262e9['id'];return db[_0x7a09('0x61')][_0x7a09('0x62')](_0x1b87f1['body']);}})['then'](respondWithResult(_0x565736,null))['catch'](handleError(_0x565736,null));};exports[_0x7a09('0x63')]=function(_0x19e640,_0x4042c2,_0x5ae424){var _0x29d0b0={'raw':![],'where':{}};var _0x3795b7={};var _0x34c76a={'count':0x0,'rows':[]};return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x19e640[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x4042c2,null))['then'](function(_0x2bff9e){if(_0x2bff9e){_0x3795b7['model']=_[_0x7a09('0x44')](db[_0x7a09('0x61')][_0x7a09('0x65')]);_0x3795b7[_0x7a09('0x43')]=_[_0x7a09('0x44')](_0x19e640[_0x7a09('0x43')]);_0x3795b7['filters']=_[_0x7a09('0x46')](_0x3795b7[_0x7a09('0x41')],_0x3795b7[_0x7a09('0x43')]);_0x29d0b0['attributes']=_[_0x7a09('0x46')](_0x3795b7[_0x7a09('0x41')],qs[_0x7a09('0x47')](_0x19e640['query'][_0x7a09('0x47')]));_0x29d0b0[_0x7a09('0x48')]=_0x29d0b0[_0x7a09('0x48')][_0x7a09('0x49')]?_0x29d0b0[_0x7a09('0x48')]:_0x3795b7[_0x7a09('0x41')];if(!_0x19e640[_0x7a09('0x43')][_0x7a09('0x4a')](_0x7a09('0x4b'))){_0x29d0b0[_0x7a09('0x2e')]=qs[_0x7a09('0x2e')](_0x19e640['query'][_0x7a09('0x2e')]);_0x29d0b0['offset']=qs['offset'](_0x19e640[_0x7a09('0x43')][_0x7a09('0x2d')]);}_0x29d0b0['order']=qs[_0x7a09('0x4d')](_0x19e640[_0x7a09('0x43')][_0x7a09('0x4d')]);_0x29d0b0[_0x7a09('0x4f')]=qs['filters'](_[_0x7a09('0x66')](_0x19e640[_0x7a09('0x43')],_0x3795b7[_0x7a09('0x45')]));_0x29d0b0[_0x7a09('0x4f')][_0x7a09('0x60')]=_0x2bff9e['id'];if(_0x19e640['query'][_0x7a09('0x4e')]){_0x29d0b0[_0x7a09('0x4f')]=_['merge'](_0x29d0b0[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0x29d0b0[_0x7a09('0x48')],function(_0x2609d3){var _0x30b7a2={};_0x30b7a2[_0x2609d3]={'$like':'%'+_0x19e640[_0x7a09('0x43')][_0x7a09('0x4e')]+'%'};return _0x30b7a2;})});}_0x29d0b0=_[_0x7a09('0x50')]({},_0x29d0b0,_0x19e640['options']);return db[_0x7a09('0x61')][_0x7a09('0x53')]({'where':_0x29d0b0[_0x7a09('0x4f')]})[_0x7a09('0x34')](function(_0x4c6718){_0x34c76a[_0x7a09('0x53')]=_0x4c6718;if(_0x19e640['query'][_0x7a09('0x5b')]){_0x29d0b0[_0x7a09('0x54')]=[{'all':!![]}];}return db[_0x7a09('0x61')][_0x7a09('0x67')](_0x29d0b0);})[_0x7a09('0x34')](function(_0x5f52ce){_0x34c76a[_0x7a09('0x55')]=_0x5f52ce;return _0x34c76a;});}})['then'](respondWithFilteredResult(_0x4042c2,_0x29d0b0))['catch'](handleError(_0x4042c2,null));};exports['removeDispositions']=function(_0x5a6917,_0x214896,_0x5bdbfa){return db[_0x7a09('0x3e')]['find']({'where':{'id':_0x5a6917[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x214896,null))[_0x7a09('0x34')](function(_0x7ed9cc){if(_0x7ed9cc){return _0x7ed9cc[_0x7a09('0x68')](_0x5a6917[_0x7a09('0x43')][_0x7a09('0x69')]);}})['then'](respondWithStatusCode(_0x214896,null))[_0x7a09('0x29')](handleError(_0x214896,null));};exports[_0x7a09('0x6a')]=function(_0x50c587,_0x58f58b,_0x36759a){if(_0x50c587[_0x7a09('0x5d')]['id']){delete _0x50c587[_0x7a09('0x5d')]['id'];}return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x50c587[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x58f58b,null))[_0x7a09('0x34')](function(_0xcc363d){if(_0xcc363d){_0x50c587[_0x7a09('0x5d')][_0x7a09('0x60')]=_0xcc363d['id'];return db[_0x7a09('0x6b')]['create'](_0x50c587[_0x7a09('0x5d')]);}})[_0x7a09('0x34')](respondWithResult(_0x58f58b,null))[_0x7a09('0x29')](handleError(_0x58f58b,null));};exports['getAnswers']=function(_0xd31396,_0x884542,_0x413865){var _0x4350ad={'raw':![],'where':{}};var _0x5ca189={};var _0x2001a8={'count':0x0,'rows':[]};return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0xd31396[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x884542,null))['then'](function(_0x1a7dc1){if(_0x1a7dc1){_0x5ca189['model']=_['keys'](db[_0x7a09('0x6b')][_0x7a09('0x65')]);_0x5ca189['query']=_[_0x7a09('0x44')](_0xd31396['query']);_0x5ca189[_0x7a09('0x45')]=_[_0x7a09('0x46')](_0x5ca189[_0x7a09('0x41')],_0x5ca189[_0x7a09('0x43')]);_0x4350ad[_0x7a09('0x48')]=_[_0x7a09('0x46')](_0x5ca189[_0x7a09('0x41')],qs[_0x7a09('0x47')](_0xd31396[_0x7a09('0x43')][_0x7a09('0x47')]));_0x4350ad[_0x7a09('0x48')]=_0x4350ad[_0x7a09('0x48')]['length']?_0x4350ad[_0x7a09('0x48')]:_0x5ca189[_0x7a09('0x41')];if(!_0xd31396[_0x7a09('0x43')][_0x7a09('0x4a')]('nolimit')){_0x4350ad['limit']=qs['limit'](_0xd31396['query'][_0x7a09('0x2e')]);_0x4350ad[_0x7a09('0x2d')]=qs[_0x7a09('0x2d')](_0xd31396['query'][_0x7a09('0x2d')]);}_0x4350ad[_0x7a09('0x4c')]=qs[_0x7a09('0x4d')](_0xd31396[_0x7a09('0x43')][_0x7a09('0x4d')]);_0x4350ad[_0x7a09('0x4f')]=qs[_0x7a09('0x45')](_[_0x7a09('0x66')](_0xd31396[_0x7a09('0x43')],_0x5ca189['filters']));_0x4350ad[_0x7a09('0x4f')][_0x7a09('0x60')]=_0x1a7dc1['id'];if(_0xd31396[_0x7a09('0x43')][_0x7a09('0x4e')]){_0x4350ad['where']=_[_0x7a09('0x50')](_0x4350ad[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0x4350ad[_0x7a09('0x48')],function(_0x41d5d4){var _0x5c07ee={};_0x5c07ee[_0x41d5d4]={'$like':'%'+_0xd31396[_0x7a09('0x43')][_0x7a09('0x4e')]+'%'};return _0x5c07ee;})});}_0x4350ad=_[_0x7a09('0x50')]({},_0x4350ad,_0xd31396[_0x7a09('0x52')]);return db[_0x7a09('0x6b')][_0x7a09('0x53')]({'where':_0x4350ad['where']})[_0x7a09('0x34')](function(_0x42ea72){_0x2001a8[_0x7a09('0x53')]=_0x42ea72;if(_0xd31396[_0x7a09('0x43')][_0x7a09('0x5b')]){_0x4350ad['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x7a09('0x67')](_0x4350ad);})[_0x7a09('0x34')](function(_0x150a4d){_0x2001a8[_0x7a09('0x55')]=_0x150a4d;return _0x2001a8;});}})['then'](respondWithFilteredResult(_0x884542,_0x4350ad))[_0x7a09('0x29')](handleError(_0x884542,null));};exports[_0x7a09('0x6c')]=function(_0xf9f1b3,_0x2363ca,_0x24b06f){return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0xf9f1b3[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x2363ca,null))[_0x7a09('0x34')](function(_0x1b7ed1){if(_0x1b7ed1){return _0x1b7ed1[_0x7a09('0x6c')](_0xf9f1b3[_0x7a09('0x43')][_0x7a09('0x69')]);}})['then'](respondWithStatusCode(_0x2363ca,null))[_0x7a09('0x29')](handleError(_0x2363ca,null));};exports[_0x7a09('0x62')]=function(_0x3cac4e,_0x244ef1){var _0x1c96e8={'name':_0x3cac4e[_0x7a09('0x5d')]['name'],'key':_0x3cac4e[_0x7a09('0x5d')]['key'],'email':_0x3cac4e[_0x7a09('0x5d')][_0x7a09('0x6d')],'ListId':_0x3cac4e['body'][_0x7a09('0x6e')],'active':!_[_0x7a09('0x6f')](_0x3cac4e[_0x7a09('0x5d')]['active'])?_0x3cac4e['body'][_0x7a09('0x70')]:!![],'description':_0x3cac4e['body'][_0x7a09('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x7a09('0x6f')](_0x3cac4e['body'][_0x7a09('0x72')])){if(_0x3cac4e['body']['cauthentication']){_0x1c96e8[_0x7a09('0x58')][_0x7a09('0x73')]=_0x1c96e8[_0x7a09('0x3c')]['user']=_0x3cac4e[_0x7a09('0x5d')][_0x7a09('0x74')];_0x1c96e8[_0x7a09('0x58')]['password']=_0x1c96e8[_0x7a09('0x3c')][_0x7a09('0x75')]=_0x3cac4e[_0x7a09('0x5d')][_0x7a09('0x76')];}else{_0x1c96e8['Imap'][_0x7a09('0x77')]=_0x1c96e8[_0x7a09('0x3c')][_0x7a09('0x77')]=![];}_0x1c96e8[_0x7a09('0x58')][_0x7a09('0x78')]=_0x3cac4e[_0x7a09('0x5d')][_0x7a09('0x58')]['host'];_0x1c96e8['Imap'][_0x7a09('0x79')]=_0x3cac4e[_0x7a09('0x5d')]['Imap'][_0x7a09('0x79')];_0x1c96e8[_0x7a09('0x3c')][_0x7a09('0x78')]=_0x3cac4e['body']['Smtp'][_0x7a09('0x78')];_0x1c96e8[_0x7a09('0x3c')][_0x7a09('0x79')]=_0x3cac4e['body'][_0x7a09('0x3c')]['port'];}else{_0x1c96e8['Imap'][_0x7a09('0x7a')]=_0x1c96e8[_0x7a09('0x3c')][_0x7a09('0x7a')]=_0x3cac4e['body'][_0x7a09('0x72')];_0x1c96e8[_0x7a09('0x58')]['user']=_0x1c96e8['Smtp'][_0x7a09('0x73')]=_0x3cac4e['body']['cuser'];_0x1c96e8[_0x7a09('0x58')][_0x7a09('0x7b')]=_0x1c96e8[_0x7a09('0x3c')][_0x7a09('0x75')]=_0x3cac4e[_0x7a09('0x5d')][_0x7a09('0x76')];}return db['MailAccount'][_0x7a09('0x62')](_0x1c96e8,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x7a09('0x58')}]})[_0x7a09('0x34')](function(_0x32008e){var _0x2c84aa=_0x3cac4e['user']['get']({'plain':!![]});if(!_0x2c84aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c84aa['role']===_0x7a09('0x73')){var _0x2ae59d=_0x32008e['get']({'plain':!![]});return db[_0x7a09('0x7c')][_0x7a09('0x5c')]({'where':{'name':_0x7a09('0x7d'),'userProfileId':_0x2c84aa[_0x7a09('0x7e')]},'raw':!![]})['then'](function(_0x5bd1bf){if(_0x5bd1bf&&_0x5bd1bf[_0x7a09('0x7f')]===0x0){return db[_0x7a09('0x36')][_0x7a09('0x62')]({'name':_0x2ae59d[_0x7a09('0x39')],'resourceId':_0x2ae59d['id'],'type':_0x5bd1bf[_0x7a09('0x39')],'sectionId':_0x5bd1bf['id']},{})[_0x7a09('0x34')](function(){return _0x32008e;});}else{return _0x32008e;}})[_0x7a09('0x29')](function(_0x580707){logger[_0x7a09('0x26')](_0x7a09('0x80'),_0x580707);throw _0x580707;});}return _0x32008e;})[_0x7a09('0x34')](respondWithResult(_0x244ef1,0xc9))['catch'](handleError(_0x244ef1,null));};exports[_0x7a09('0x81')]=function(_0x53258d,_0x231070,_0x1d9187){return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x53258d[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x231070,null))[_0x7a09('0x34')](function(_0x51acd7){if(_0x51acd7){return _0x51acd7[_0x7a09('0x81')]();}return null;})[_0x7a09('0x34')](respondWithResult(_0x231070,null))['catch'](handleError(_0x231070,null));};exports[_0x7a09('0x82')]=function(_0x4e44f6,_0x1a485a,_0x530e0b){if(_0x4e44f6['body']['id']){delete _0x4e44f6[_0x7a09('0x5d')]['id'];}return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x4e44f6[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a485a,null))[_0x7a09('0x34')](function(_0x1ccc2a){if(_0x1ccc2a){_0x4e44f6[_0x7a09('0x5d')][_0x7a09('0x60')]=_0x1ccc2a['id'];return db[_0x7a09('0x3b')][_0x7a09('0x62')](_0x4e44f6[_0x7a09('0x5d')]);}})['then'](respondWithResult(_0x1a485a,null))['catch'](handleError(_0x1a485a,null));};exports[_0x7a09('0x83')]=function(_0x402501,_0x2704ca,_0xd9602f){return db[_0x7a09('0x3e')]['findOne']({'where':{'id':_0x402501[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x2704ca,null))[_0x7a09('0x34')](function(_0x4ce327){if(_0x4ce327){return _0x4ce327[_0x7a09('0x84')](null);}return null;})[_0x7a09('0x34')](respondWithStatusCode(_0x2704ca,null))[_0x7a09('0x29')](handleError(_0x2704ca,null));};exports['getSmtp']=function(_0x374f3b,_0x3df90d,_0x3ea599){return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x374f3b[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x3df90d,null))[_0x7a09('0x34')](function(_0x3a29ca){if(_0x3a29ca){return _0x3a29ca['getSmtp']();}return null;})['then'](respondWithResult(_0x3df90d,null))[_0x7a09('0x29')](handleError(_0x3df90d,null));};exports[_0x7a09('0x85')]=function(_0x474160,_0x22709e,_0x23427a){if(_0x474160[_0x7a09('0x5d')]['id']){delete _0x474160[_0x7a09('0x5d')]['id'];}return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x474160['params']['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x22709e,null))[_0x7a09('0x34')](function(_0x25131f){if(_0x25131f){_0x474160[_0x7a09('0x5d')][_0x7a09('0x60')]=_0x25131f['id'];return db['MailServerOut'][_0x7a09('0x62')](_0x474160['body']);}})[_0x7a09('0x34')](respondWithResult(_0x22709e,null))[_0x7a09('0x29')](handleError(_0x22709e,null));};exports[_0x7a09('0x86')]=function(_0x2bd266,_0x164491,_0x464bd7){return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x2bd266[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x164491,null))[_0x7a09('0x34')](function(_0x267922){if(_0x267922){return _0x267922[_0x7a09('0x87')](null);}return null;})[_0x7a09('0x34')](respondWithStatusCode(_0x164491,null))['catch'](handleError(_0x164491,null));};exports['addInteraction']=function(_0x3cadc0,_0x17a4bf,_0x19551a){return db[_0x7a09('0x88')][_0x7a09('0x5c')]({'where':{'id':_0x3cadc0[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x17a4bf,null))[_0x7a09('0x34')](function(_0x5e922c){if(_0x5e922c){return _0x5e922c[_0x7a09('0x89')](_0x3cadc0[_0x7a09('0x5d')][_0x7a09('0x69')],_['omit'](_0x3cadc0[_0x7a09('0x5d')],[_0x7a09('0x69'),'id'])||{});}})[_0x7a09('0x34')](respondWithResult(_0x17a4bf,null))[_0x7a09('0x29')](handleError(_0x17a4bf,null));};exports[_0x7a09('0x8a')]=function(_0x1ebdc0,_0x9b7a9d,_0x304886){var _0x570e2e={'raw':![],'where':{}};var _0x1c3b10={};var _0x2d8310={'count':0x0,'rows':[]};return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x1ebdc0['params']['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x9b7a9d,null))[_0x7a09('0x34')](function(_0xc5a1a){if(_0xc5a1a){_0x1c3b10[_0x7a09('0x41')]=_[_0x7a09('0x44')](db['MailInteraction'][_0x7a09('0x65')]);_0x1c3b10[_0x7a09('0x43')]=_[_0x7a09('0x44')](_0x1ebdc0[_0x7a09('0x43')]);_0x1c3b10[_0x7a09('0x45')]=_['intersection'](_0x1c3b10['model'],_0x1c3b10[_0x7a09('0x43')]);_0x570e2e[_0x7a09('0x48')]=_[_0x7a09('0x46')](_0x1c3b10['model'],qs[_0x7a09('0x47')](_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x47')]));_0x570e2e['attributes']=_0x570e2e[_0x7a09('0x48')][_0x7a09('0x49')]?_0x570e2e[_0x7a09('0x48')]:_0x1c3b10[_0x7a09('0x41')];if(!_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x4a')](_0x7a09('0x4b'))){_0x570e2e['limit']=qs[_0x7a09('0x2e')](_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x2e')]);_0x570e2e[_0x7a09('0x2d')]=qs['offset'](_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x2d')]);}_0x570e2e['order']=qs[_0x7a09('0x4d')](_0x1ebdc0[_0x7a09('0x43')]['sort']);_0x570e2e[_0x7a09('0x4f')]=qs['filters'](_[_0x7a09('0x66')](_0x1ebdc0[_0x7a09('0x43')],_0x1c3b10[_0x7a09('0x45')]));_0x570e2e[_0x7a09('0x4f')]['MailAccountId']=_0xc5a1a['id'];if(_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x4e')]){_0x570e2e[_0x7a09('0x4f')]=_[_0x7a09('0x50')](_0x570e2e[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0x570e2e[_0x7a09('0x48')],function(_0x3bfdcd){var _0x55001d={};_0x55001d[_0x3bfdcd]={'$like':'%'+_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x4e')]+'%'};return _0x55001d;})});}_0x570e2e=_['merge']({},_0x570e2e,_0x1ebdc0[_0x7a09('0x52')]);return db[_0x7a09('0x88')][_0x7a09('0x53')]({'where':_0x570e2e['where']})['then'](function(_0x3ae637){_0x2d8310[_0x7a09('0x53')]=_0x3ae637;if(_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x5b')]){_0x570e2e[_0x7a09('0x54')]=[{'model':db['CmContact'],'as':_0x7a09('0x8b'),'required':![]},{'model':db['User'],'as':_0x7a09('0x8c'),'attributes':['name',_0x7a09('0x8d'),_0x7a09('0x8e')],'required':![]},{'model':db[_0x7a09('0x8f')],'as':'Tags','attributes':['id',_0x7a09('0x39'),_0x7a09('0x90')],'where':_0x1ebdc0[_0x7a09('0x43')]['tag']?{'id':_0x1ebdc0[_0x7a09('0x43')][_0x7a09('0x91')]}:undefined,'required':_0x1ebdc0[_0x7a09('0x43')]['tag']?!![]:![]}];}return db[_0x7a09('0x88')][_0x7a09('0x67')](_0x570e2e);})[_0x7a09('0x34')](function(_0x3b3a2f){_0x2d8310[_0x7a09('0x55')]=_0x3b3a2f;return _0x2d8310;});}})[_0x7a09('0x34')](respondWithFilteredResult(_0x9b7a9d,_0x570e2e))[_0x7a09('0x29')](handleError(_0x9b7a9d,null));};exports[_0x7a09('0x92')]=function(_0x3931ed,_0x20ddba,_0x7f74bd){return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x3931ed[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x20ddba,null))[_0x7a09('0x34')](function(_0x3a57ed){if(_0x3a57ed){return db['sequelize'][_0x7a09('0x93')](function(_0x220870){return db[_0x7a09('0x94')][_0x7a09('0x37')]({'where':{'MailAccountId':_0x3931ed[_0x7a09('0x57')]['id']},'transaction':_0x220870})['then'](function(_0x38af77){var _0x40cf3e=_[_0x7a09('0x42')](_0x3931ed[_0x7a09('0x5d')],function(_0x2f320b){_0x2f320b[_0x7a09('0x60')]=_0x3931ed['params']['id'];return _0x2f320b;});return db[_0x7a09('0x94')][_0x7a09('0x95')](_0x40cf3e,{'transaction':_0x220870});});})[_0x7a09('0x34')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x3931ed[_0x7a09('0x57')]['id']},'order':'priority'});});}})[_0x7a09('0x34')](respondWithResult(_0x20ddba,null))['catch'](handleError(_0x20ddba,null));};exports[_0x7a09('0x96')]=function(_0x3f87e0,_0xe3192a,_0x3a7bb8){var _0x9d593e={};var _0x3a33f8={};var _0x3334a8;var _0x3bb38d;return db[_0x7a09('0x3e')][_0x7a09('0x64')]({'where':{'id':_0x3f87e0[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0xe3192a,null))['then'](function(_0x5ba363){if(_0x5ba363){_0x3334a8=_0x5ba363;_0x3a33f8[_0x7a09('0x41')]=_['keys'](db[_0x7a09('0x94')][_0x7a09('0x65')]);_0x3a33f8['query']=_[_0x7a09('0x44')](_0x3f87e0[_0x7a09('0x43')]);_0x3a33f8['filters']=_[_0x7a09('0x46')](_0x3a33f8[_0x7a09('0x41')],_0x3a33f8[_0x7a09('0x43')]);_0x9d593e[_0x7a09('0x48')]=_[_0x7a09('0x46')](_0x3a33f8[_0x7a09('0x41')],qs[_0x7a09('0x47')](_0x3f87e0[_0x7a09('0x43')][_0x7a09('0x47')]));_0x9d593e[_0x7a09('0x48')]=_0x9d593e[_0x7a09('0x48')]['length']?_0x9d593e[_0x7a09('0x48')]:_0x3a33f8[_0x7a09('0x41')];_0x9d593e['order']=qs[_0x7a09('0x4d')](_0x3f87e0[_0x7a09('0x43')]['sort']);_0x9d593e[_0x7a09('0x4f')]=qs[_0x7a09('0x45')](_[_0x7a09('0x66')](_0x3f87e0['query'],_0x3a33f8[_0x7a09('0x45')]));if(_0x3f87e0[_0x7a09('0x43')][_0x7a09('0x4e')]){_0x9d593e['where']=_['merge'](_0x9d593e[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0x9d593e['attributes'],function(_0x49a8b9){var _0xdbd9c9={};_0xdbd9c9[_0x49a8b9]={'$like':'%'+_0x3f87e0[_0x7a09('0x43')]['filter']+'%'};return _0xdbd9c9;})});}_0x9d593e=_[_0x7a09('0x50')]({},_0x9d593e,_0x3f87e0[_0x7a09('0x52')]);return _0x3334a8[_0x7a09('0x96')](_0x9d593e);}})['then'](function(_0x13218c){if(_0x13218c){_0x3bb38d=_0x13218c[_0x7a09('0x49')];if(!_0x3f87e0[_0x7a09('0x43')]['hasOwnProperty'](_0x7a09('0x4b'))){_0x9d593e[_0x7a09('0x2e')]=qs[_0x7a09('0x2e')](_0x3f87e0['query'][_0x7a09('0x2e')]);_0x9d593e['offset']=qs[_0x7a09('0x2d')](_0x3f87e0[_0x7a09('0x43')][_0x7a09('0x2d')]);}return _0x3334a8[_0x7a09('0x96')](_0x9d593e);}})['then'](function(_0x285add){if(_0x285add){return _0x285add?{'count':_0x3bb38d,'rows':_0x285add}:null;}})[_0x7a09('0x34')](respondWithResult(_0xe3192a,null))[_0x7a09('0x29')](handleError(_0xe3192a,null));};exports['getMessages']=function(_0x1fe36a,_0x102f88,_0x18539f){var _0x22c9db={'raw':!![],'where':{}};var _0x3c0dc8={};var _0x34da1c={'count':0x0,'rows':[]};return db['MailAccount'][_0x7a09('0x64')]({'where':{'id':_0x1fe36a['params']['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x102f88,null))[_0x7a09('0x34')](function(_0x57d043){if(_0x57d043){_0x3c0dc8[_0x7a09('0x41')]=_[_0x7a09('0x44')](db[_0x7a09('0x97')][_0x7a09('0x65')]);_0x3c0dc8[_0x7a09('0x43')]=_[_0x7a09('0x44')](_0x1fe36a['query']);_0x3c0dc8[_0x7a09('0x45')]=_['intersection'](_0x3c0dc8[_0x7a09('0x41')],_0x3c0dc8[_0x7a09('0x43')]);_0x22c9db['attributes']=_[_0x7a09('0x46')](_0x3c0dc8[_0x7a09('0x41')],qs[_0x7a09('0x47')](_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x47')]));_0x22c9db['attributes']=_0x22c9db['attributes'][_0x7a09('0x49')]?_0x22c9db[_0x7a09('0x48')]:_0x3c0dc8[_0x7a09('0x41')];if(!_0x1fe36a[_0x7a09('0x43')]['hasOwnProperty'](_0x7a09('0x4b'))){_0x22c9db[_0x7a09('0x2e')]=qs['limit'](_0x1fe36a['query']['limit']);_0x22c9db[_0x7a09('0x2d')]=qs['offset'](_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x2d')]);}_0x22c9db['order']=qs[_0x7a09('0x4d')](_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x4d')]);_0x22c9db['where']=qs['filters'](_[_0x7a09('0x66')](_0x1fe36a[_0x7a09('0x43')],_0x3c0dc8[_0x7a09('0x45')]));_0x22c9db[_0x7a09('0x4f')][_0x7a09('0x60')]=_0x57d043['id'];if(_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x4e')]){_0x22c9db['where']=_['merge'](_0x22c9db[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0x22c9db[_0x7a09('0x48')],function(_0x5c3809){var _0x1569f4={};_0x1569f4[_0x5c3809]={'$like':'%'+_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x4e')]+'%'};return _0x1569f4;})});}if(_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x98')]){var _0x19b19a=_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x98')]['split'](',');var _0x416ae0={};_0x416ae0[_0x19b19a[0x0]]={'$gte':moment(_0x19b19a[0x1])[_0x7a09('0x99')](_0x7a09('0x9a'))};_0x22c9db['where']=_[_0x7a09('0x50')](_0x22c9db[_0x7a09('0x4f')],_0x416ae0);}_0x22c9db=_[_0x7a09('0x50')]({},_0x22c9db,_0x1fe36a[_0x7a09('0x52')]);return db['MailMessage']['count']({'where':_0x22c9db[_0x7a09('0x4f')]})[_0x7a09('0x34')](function(_0x5ac1e6){_0x34da1c[_0x7a09('0x53')]=_0x5ac1e6;if(_0x1fe36a[_0x7a09('0x43')][_0x7a09('0x5b')]){_0x22c9db[_0x7a09('0x54')]=[{'all':!![]}];}return db[_0x7a09('0x97')][_0x7a09('0x67')](_0x22c9db);})[_0x7a09('0x34')](function(_0x132d88){_0x34da1c[_0x7a09('0x55')]=_0x132d88;return _0x34da1c;});}})[_0x7a09('0x34')](respondWithFilteredResult(_0x102f88,_0x22c9db))[_0x7a09('0x29')](handleError(_0x102f88,null));};exports[_0x7a09('0x9b')]=function(_0x10dbb7,_0x1666b8,_0x4e8ac8){var _0x4a5b44,_0x3c385b={},_0xc052ad;if(_0x10dbb7[_0x7a09('0x5d')]['to']){_0xc052ad=_0x10dbb7[_0x7a09('0x5d')]['to'][_0x7a09('0x9c')](',')[0x0];}return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x10dbb7[_0x7a09('0x57')]['id']},'include':[{'model':db[_0x7a09('0x9d')],'as':'List','include':[{'model':db[_0x7a09('0x9e')],'as':_0x7a09('0x9f'),'where':{'email':_0xc052ad},'limit':0x1,'order':[[_0x7a09('0xa0'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x7a09('0x3c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1666b8,null))[_0x7a09('0x34')](function(_0x2d3aa9){if(_0x2d3aa9){_0x4a5b44=_0x2d3aa9;if(_0x2d3aa9['Smtp']){if(_[_0x7a09('0x6f')](_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xa1')])){_0x10dbb7['body'][_0x7a09('0xa1')]=util[_0x7a09('0x99')]('%s\x20<%s>',_0x2d3aa9[_0x7a09('0x39')],_0x2d3aa9['email']||_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x73')]);}if(_0x10dbb7[_0x7a09('0x5d')]['attachments']&&_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xa2')][_0x7a09('0x49')]){for(var _0x4ad30e=0x0;_0x4ad30e<_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xa2')][_0x7a09('0x49')];_0x4ad30e+=0x1){_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xa2')][_0x4ad30e]={'filename':_0x10dbb7['body']['attachments'][_0x4ad30e]['name'],'path':path[_0x7a09('0xa3')](config[_0x7a09('0xa4')],_0x7a09('0xa5'),_0x10dbb7[_0x7a09('0x5d')]['attachments'][_0x4ad30e][_0x7a09('0xa6')])};}}var _0x2b96f8={'tls':{'rejectUnauthorized':![]}};if(_[_0x7a09('0x6f')](_0x2d3aa9['Smtp'][_0x7a09('0x7a')])){if(_0x2d3aa9['Smtp'][_0x7a09('0x77')]){_0x2b96f8[_0x7a09('0xa7')]={'user':_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x73')],'pass':_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x75')]};}_0x2b96f8[_0x7a09('0x78')]=_0x2d3aa9[_0x7a09('0x3c')]['host'];_0x2b96f8['port']=_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x79')];_0x2b96f8['secure']=_0x2d3aa9[_0x7a09('0x3c')]['secure'];}else{_0x2b96f8[_0x7a09('0x7a')]=_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x7a')];_0x2b96f8[_0x7a09('0xa7')]={'user':_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x73')],'pass':_0x2d3aa9[_0x7a09('0x3c')][_0x7a09('0x75')]};}return respondWithRpcPromise(_0x7a09('0xa8'),_0x7a09('0xa9'),{'account':_0x2b96f8,'message':_0x10dbb7[_0x7a09('0x5d')]});}else{throw new Error('List\x20not\x20found');}}})[_0x7a09('0x34')](function(_0x1c2d7b){if(_0x1c2d7b){_0x3c385b=_0x1c2d7b;if(_0x4a5b44[_0x7a09('0xaa')]){if(_0x4a5b44[_0x7a09('0xaa')]['Contacts']['length']){return _0x4a5b44[_0x7a09('0xaa')][_0x7a09('0x9f')][0x0];}else{return db[_0x7a09('0x9e')]['create'](_[_0x7a09('0x1a')](_0x10dbb7[_0x7a09('0x5d')],{'firstName':_0x10dbb7[_0x7a09('0x5d')]['to'],'email':_0x10dbb7[_0x7a09('0x5d')]['to'],'phone':_0x10dbb7[_0x7a09('0x5d')]['to'],'ListId':_0x4a5b44[_0x7a09('0x6e')]}));}}else{throw new Error(_0x7a09('0xab'));}}})[_0x7a09('0x34')](function(_0x3f4bc9){if(_0x3f4bc9){var _0x567971={'UserId':_0x10dbb7['user']['id'],'ContactId':_0x3f4bc9['id'],'MailAccountId':_0x4a5b44['id'],'inReplyTo':_0x3c385b[_0x7a09('0xac')],'to':_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xa1')],'cc':_0x10dbb7[_0x7a09('0x5d')]['cc'],'subject':_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xad')],'attach':_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xae')],'firstMsgDirection':_0x7a09('0xaf'),'lastMsgAt':moment()[_0x7a09('0x99')](_0x7a09('0x9a')),'lastMsgDirection':_0x7a09('0xaf'),'lastMsgBody':_0x10dbb7['body'][_0x7a09('0x5d')],'Messages':[_['merge'](_0x10dbb7['body'],{'messageId':_0x3c385b['messageId'],'sentAt':moment()[_0x7a09('0x99')](_0x7a09('0x9a')),'read':!![],'MailAccountId':_0x4a5b44['id'],'UserId':_0x10dbb7[_0x7a09('0x73')]['id'],'ContactId':_0x3f4bc9['id']})]};if(_0x10dbb7[_0x7a09('0x5d')]['Interaction']){_0x567971=_[_0x7a09('0x50')](_0x567971,_0x10dbb7[_0x7a09('0x5d')][_0x7a09('0xb0')]);}return db[_0x7a09('0x88')][_0x7a09('0x62')](_0x567971,{'include':[{'model':db['MailMessage'],'as':_0x7a09('0xb1')}]});}})['then'](respondWithResult(_0x1666b8,null))[_0x7a09('0x29')](handleError(_0x1666b8,null));};exports[_0x7a09('0xb2')]=function(_0x536dce,_0x53f274,_0x3c16b9){return db['MailAccount'][_0x7a09('0x5c')]({'where':{'id':_0x536dce[_0x7a09('0x57')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x7a09('0x3c'),'raw':!![]}]})[_0x7a09('0x34')](handleEntityNotFound(_0x53f274,null))[_0x7a09('0x34')](function(_0x197380){if(_0x197380&&_0x197380[_0x7a09('0x3c')]){var _0x5526f1={'id':_0x197380['id'],'tls':{'rejectUnauthorized':![]}};if(_0x197380['Smtp'][_0x7a09('0x7a')]){_0x5526f1[_0x7a09('0x7a')]=_0x197380[_0x7a09('0x3c')][_0x7a09('0x7a')];}else{_0x5526f1[_0x7a09('0x78')]=_0x197380['Smtp']['host'];_0x5526f1[_0x7a09('0x79')]=_0x197380[_0x7a09('0x3c')]['port'];_0x5526f1[_0x7a09('0xb3')]=_0x197380[_0x7a09('0x3c')][_0x7a09('0xb3')];}if(_0x197380[_0x7a09('0x3c')]['authentication']){_0x5526f1[_0x7a09('0xa7')]={'user':_0x197380[_0x7a09('0x3c')]['user'],'pass':_0x197380[_0x7a09('0x3c')][_0x7a09('0x75')]};}return respondWithRpcPromise('VerifySmtp',_0x7a09('0xb2'),{'account':_0x5526f1});}})[_0x7a09('0x34')](respondWithResult(_0x53f274,null))['catch'](handleError(_0x53f274,null));};exports[_0x7a09('0x37')]=function(_0x48c59d,_0x40c452){return db[_0x7a09('0x3e')]['find']({'where':{'id':_0x48c59d[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x40c452,null))[_0x7a09('0x34')](function(_0x1f6c5a){if(_0x1f6c5a&&_0x1f6c5a[_0x7a09('0x7a')]){throw new db[(_0x7a09('0xb4'))][(_0x7a09('0xb5'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1f6c5a;})[_0x7a09('0x34')](removeEntity(_0x40c452,null))[_0x7a09('0x29')](handleError(_0x40c452,null));};exports[_0x7a09('0xb6')]=function(_0x28c2c6,_0x1a0506,_0x391342){return db[_0x7a09('0x3e')][_0x7a09('0x5c')]({'where':{'id':_0x28c2c6[_0x7a09('0x57')]['id']}})[_0x7a09('0x34')](handleEntityNotFound(_0x1a0506,null))[_0x7a09('0x34')](function(_0x5fae79){if(_0x5fae79){return _0x5fae79[_0x7a09('0xb6')](_0x28c2c6['body'][_0x7a09('0x69')],_[_0x7a09('0xb7')](_0x28c2c6['body'],['ids','id'])||{})[_0x7a09('0xb8')](function(_0x5c51ff){for(var _0x30cfbe=0x0;_0x30cfbe<_0x28c2c6['body'][_0x7a09('0x69')][_0x7a09('0x49')];_0x30cfbe+=0x1){socket[_0x7a09('0xb9')](_0x7a09('0xba'),{'UserId':_0x28c2c6['body'][_0x7a09('0x69')][_0x30cfbe],'MailAccountId':_0x28c2c6['params']['id']});}return _0x5c51ff;});}})[_0x7a09('0x34')](respondWithResult(_0x1a0506,null))[_0x7a09('0x29')](handleError(_0x1a0506,null));};exports[_0x7a09('0xbb')]=function(_0x519906,_0x270e33,_0x25dc30){return db['MailAccount'][_0x7a09('0x5c')]({'where':{'id':_0x519906['params']['id']}})['then'](handleEntityNotFound(_0x270e33,null))[_0x7a09('0x34')](function(_0x2a76cf){if(_0x2a76cf){return _0x2a76cf[_0x7a09('0xbb')](_0x519906[_0x7a09('0x43')][_0x7a09('0x69')])[_0x7a09('0x34')](function(){if(_[_0x7a09('0xbc')](_0x519906['query'][_0x7a09('0x69')])){for(var _0x2852e7=0x0;_0x2852e7<_0x519906['query']['ids']['length'];_0x2852e7+=0x1){socket[_0x7a09('0xb9')](_0x7a09('0xbd'),{'UserId':Number(_0x519906[_0x7a09('0x43')][_0x7a09('0x69')][_0x2852e7]),'MailAccountId':Number(_0x519906[_0x7a09('0x57')]['id'])});}}else{socket[_0x7a09('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x519906['query'][_0x7a09('0x69')]),'MailAccountId':Number(_0x519906[_0x7a09('0x57')]['id'])});}});}})[_0x7a09('0x34')](respondWithStatusCode(_0x270e33,null))[_0x7a09('0x29')](handleError(_0x270e33,null));};exports['getAgents']=function(_0x47b7ee,_0x3aaab0,_0x5eefb1){var _0x1a950b={};var _0xa64efa={};var _0x3a8b62;var _0x595fcd;return db[_0x7a09('0x3e')]['findOne']({'where':{'id':_0x47b7ee[_0x7a09('0x57')]['id']}})['then'](handleEntityNotFound(_0x3aaab0,null))[_0x7a09('0x34')](function(_0x3a2404){if(_0x3a2404){_0x3a8b62=_0x3a2404;_0xa64efa[_0x7a09('0x41')]=_[_0x7a09('0x44')](db[_0x7a09('0xbe')][_0x7a09('0x65')]);_0xa64efa[_0x7a09('0x43')]=_['keys'](_0x47b7ee[_0x7a09('0x43')]);_0xa64efa[_0x7a09('0x45')]=_[_0x7a09('0x46')](_0xa64efa['model'],_0xa64efa[_0x7a09('0x43')]);_0x1a950b['attributes']=_[_0x7a09('0x46')](_0xa64efa[_0x7a09('0x41')],qs['fields'](_0x47b7ee[_0x7a09('0x43')][_0x7a09('0x47')]));_0x1a950b[_0x7a09('0x48')]=_0x1a950b['attributes']['length']?_0x1a950b[_0x7a09('0x48')]:_0xa64efa[_0x7a09('0x41')];_0x1a950b[_0x7a09('0x4c')]=qs[_0x7a09('0x4d')](_0x47b7ee[_0x7a09('0x43')][_0x7a09('0x4d')]);_0x1a950b[_0x7a09('0x4f')]=qs['filters'](_[_0x7a09('0x66')](_0x47b7ee['query'],_0xa64efa['filters']));if(_0x47b7ee[_0x7a09('0x43')]['filter']){_0x1a950b[_0x7a09('0x4f')]=_['merge'](_0x1a950b[_0x7a09('0x4f')],{'$or':_[_0x7a09('0x42')](_0x1a950b['attributes'],function(_0x1ace5d){var _0x965be8={};_0x965be8[_0x1ace5d]={'$like':'%'+_0x47b7ee[_0x7a09('0x43')][_0x7a09('0x4e')]+'%'};return _0x965be8;})});}_0x1a950b=_[_0x7a09('0x50')]({},_0x1a950b,_0x47b7ee[_0x7a09('0x52')]);return _0x3a8b62[_0x7a09('0xbf')](_0x1a950b);}})['then'](function(_0x400486){if(_0x400486){_0x595fcd=_0x400486[_0x7a09('0x49')];if(!_0x47b7ee[_0x7a09('0x43')]['hasOwnProperty'](_0x7a09('0x4b'))){_0x1a950b[_0x7a09('0x2e')]=qs[_0x7a09('0x2e')](_0x47b7ee['query'][_0x7a09('0x2e')]);_0x1a950b['offset']=qs[_0x7a09('0x2d')](_0x47b7ee[_0x7a09('0x43')][_0x7a09('0x2d')]);}return _0x3a8b62[_0x7a09('0xbf')](_0x1a950b);}})['then'](function(_0x2af9e0){if(_0x2af9e0){return _0x2af9e0?{'count':_0x595fcd,'rows':_0x2af9e0}:null;}})[_0x7a09('0x34')](respondWithResult(_0x3aaab0,null))[_0x7a09('0x29')](handleError(_0x3aaab0,null));}; \ No newline at end of file +var _0x1257=['basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','User','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','status','end','offset','limit','set','json','apply','reject','save','MailAccounts','UserProfileResource','destroy','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','MailAccount','rows','catch','params','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','includeAll','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','key','email','ListId','isNil','active','description','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','findOne','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','List','updatedAt','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments'];(function(_0x25e3c2,_0x2ba8fb){var _0x13ce09=function(_0x10f346){while(--_0x10f346){_0x25e3c2['push'](_0x25e3c2['shift']());}};_0x13ce09(++_0x2ba8fb);}(_0x1257,0xd6));var _0x7125=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1257[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x7125('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7125('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7125('0x2'));var rp=require(_0x7125('0x3'));var moment=require(_0x7125('0x4'));var BPromise=require(_0x7125('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7125('0x6'));var sox=require(_0x7125('0x7'));var csv=require(_0x7125('0x8'));var ejs=require(_0x7125('0x9'));var fs=require('fs');var _=require(_0x7125('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7125('0xb'));var deskjs=require(_0x7125('0xc'));var toCsv=require(_0x7125('0x8'));var querystring=require(_0x7125('0xd'));var Papa=require(_0x7125('0xe'));var Redis=require(_0x7125('0xf'));var authService=require(_0x7125('0x10'));var qs=require(_0x7125('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7125('0x12'));var logger=require(_0x7125('0x13'))('api');var utils=require(_0x7125('0x14'));var config=require(_0x7125('0x15'));var licenseUtil=require(_0x7125('0x16'));var db=require(_0x7125('0x17'))['db'];config[_0x7125('0x18')]=_[_0x7125('0x19')](config[_0x7125('0x18')],{'host':_0x7125('0x1a'),'port':0x18eb});var socket=require(_0x7125('0x1b'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x7125('0x1c')](socket);var jayson=require(_0x7125('0x1d'));var client=jayson[_0x7125('0x1e')][_0x7125('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x54c354,_0x47a8e7,_0x4efbd8,_0x35a831){return new BPromise(function(_0x558b68,_0x415fbc){var _0x5159ac=_0x35a831||client;return _0x5159ac[_0x7125('0x20')](_0x54c354,_0x4efbd8)[_0x7125('0x21')](function(_0x2bc377){logger['info'](_0x7125('0x22'),_0x47a8e7,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x47a8e7,_0x7125('0x23'),JSON['stringify'](_0x2bc377));if(_0x2bc377[_0x7125('0x24')]){if(_0x2bc377[_0x7125('0x24')][_0x7125('0x25')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x47a8e7,_0x2bc377[_0x7125('0x24')]['message']);return _0x415fbc(_0x2bc377['error'][_0x7125('0x26')]);}logger[_0x7125('0x24')](_0x7125('0x22'),_0x47a8e7,_0x2bc377['error'][_0x7125('0x26')]);return _0x558b68(_0x2bc377['error'][_0x7125('0x26')]);}else{logger[_0x7125('0x27')](_0x7125('0x22'),_0x47a8e7,'request\x20sent');_0x558b68(_0x2bc377['result']['message']);}})['catch'](function(_0x4e20ee){logger[_0x7125('0x24')](_0x7125('0x22'),_0x47a8e7,_0x4e20ee);_0x415fbc(_0x4e20ee);});});}function respondWithStatusCode(_0x45fe8c,_0x54680d){_0x54680d=_0x54680d||0xcc;return function(_0x48cefb){if(_0x48cefb){return _0x45fe8c[_0x7125('0x28')](_0x54680d);}return _0x45fe8c[_0x7125('0x29')](_0x54680d)[_0x7125('0x2a')]();};}function respondWithResult(_0xe8e74d,_0x5ebc73){_0x5ebc73=_0x5ebc73||0xc8;return function(_0x555212){if(_0x555212){return _0xe8e74d[_0x7125('0x29')](_0x5ebc73)['json'](_0x555212);}};}function respondWithFilteredResult(_0x240479,_0x535991){return function(_0x60bf6e){if(_0x60bf6e){var _0x53a373=_0x60bf6e['count'],_0x269325=_0x535991[_0x7125('0x2b')],_0x556d38=_0x535991[_0x7125('0x2b')]+_0x535991[_0x7125('0x2c')],_0x3dfa64;if(_0x556d38>=_0x53a373){_0x556d38=_0x53a373;_0x3dfa64=0xc8;}else{_0x3dfa64=0xce;}_0x240479[_0x7125('0x29')](_0x3dfa64);return _0x240479[_0x7125('0x2d')]('Content-Range',_0x269325+'-'+_0x556d38+'/'+_0x53a373)[_0x7125('0x2e')](_0x60bf6e);}return null;};}function patchUpdates(_0xda4ec9){return function(_0x5dac22){try{jsonpatch[_0x7125('0x2f')](_0x5dac22,_0xda4ec9,!![]);}catch(_0xb49bc6){return BPromise[_0x7125('0x30')](_0xb49bc6);}return _0x5dac22[_0x7125('0x31')]();};}function saveUpdates(_0x5508ac,_0x324340){return function(_0x119c32){if(_0x119c32){return _0x119c32['update'](_0x5508ac)[_0x7125('0x21')](function(_0x520d5c){return _0x520d5c;});}return null;};}function removeEntity(_0x18b086,_0x1b7fa2){return function(_0x459a8c){if(_0x459a8c){return _0x459a8c['destroy']()['then'](function(){var _0x17cf17=_0x459a8c['get']({'plain':!![]});var _0x124551=_0x7125('0x32');return db[_0x7125('0x33')][_0x7125('0x34')]({'where':{'type':_0x124551,'resourceId':_0x17cf17['id']}})[_0x7125('0x21')](function(){return _0x459a8c;});})[_0x7125('0x21')](function(){_0x18b086['status'](0xcc)[_0x7125('0x2a')]();});}};}function handleEntityNotFound(_0x5a6b51,_0x184de9){return function(_0x27ed9b){if(!_0x27ed9b){_0x5a6b51['sendStatus'](0x194);}return _0x27ed9b;};}function handleError(_0x4c94f8,_0x45cfd9){_0x45cfd9=_0x45cfd9||0x1f4;return function(_0x1f102f){logger[_0x7125('0x24')](_0x1f102f[_0x7125('0x35')]);if(_0x1f102f[_0x7125('0x36')]){delete _0x1f102f[_0x7125('0x36')];}_0x4c94f8[_0x7125('0x29')](_0x45cfd9)['send'](_0x1f102f);};}exports[_0x7125('0x37')]=function(_0xeac26,_0xa5a2f0){var _0x441ff7={'include':[{'model':db[_0x7125('0x38')],'as':_0x7125('0x39')},{'model':db[_0x7125('0x3a')],'as':_0x7125('0x3b')},{'model':db[_0x7125('0x3c')],'as':_0x7125('0x3d')}]},_0x328a0f={},_0x3daf3b={'count':0x0,'rows':[]};var _0x2c0812=_[_0x7125('0x3e')](db['MailAccount'][_0x7125('0x3f')],function(_0x4ac619){return{'name':_0x4ac619[_0x7125('0x40')],'type':_0x4ac619[_0x7125('0x41')]['key']};});_0x328a0f[_0x7125('0x42')]=_['map'](_0x2c0812,_0x7125('0x36'));_0x328a0f[_0x7125('0x43')]=_[_0x7125('0x44')](_0xeac26[_0x7125('0x43')]);_0x328a0f[_0x7125('0x45')]=_[_0x7125('0x46')](_0x328a0f[_0x7125('0x42')],_0x328a0f['query']);_0x441ff7[_0x7125('0x47')]=_[_0x7125('0x46')](_0x328a0f['model'],qs['fields'](_0xeac26[_0x7125('0x43')][_0x7125('0x48')]));_0x441ff7[_0x7125('0x47')]=_0x441ff7[_0x7125('0x47')][_0x7125('0x49')]?_0x441ff7['attributes']:_0x328a0f[_0x7125('0x42')];if(!_0xeac26[_0x7125('0x43')][_0x7125('0x4a')](_0x7125('0x4b'))){_0x441ff7['limit']=qs[_0x7125('0x2c')](_0xeac26[_0x7125('0x43')][_0x7125('0x2c')]);_0x441ff7[_0x7125('0x2b')]=qs['offset'](_0xeac26[_0x7125('0x43')][_0x7125('0x2b')]);}_0x441ff7[_0x7125('0x4c')]=qs[_0x7125('0x4d')](_0xeac26['query'][_0x7125('0x4d')]);_0x441ff7[_0x7125('0x4e')]=qs['filters'](_[_0x7125('0x4f')](_0xeac26['query'],_0x328a0f['filters']),_0x2c0812);if(_0xeac26[_0x7125('0x43')][_0x7125('0x50')]){_0x441ff7[_0x7125('0x4e')]=_[_0x7125('0x51')](_0x441ff7[_0x7125('0x4e')],{'$or':_[_0x7125('0x3e')](_0x2c0812,function(_0x3e53bc){if(_0x3e53bc[_0x7125('0x41')]!=='VIRTUAL'){var _0x2baad1={};_0x2baad1[_0x3e53bc['name']]={'$like':'%'+_0xeac26[_0x7125('0x43')][_0x7125('0x50')]+'%'};return _0x2baad1;}})});}_0x441ff7=_[_0x7125('0x51')]({},_0x441ff7,_0xeac26[_0x7125('0x52')]);var _0x5f887={'where':_0x441ff7[_0x7125('0x4e')]};return db['MailAccount'][_0x7125('0x53')](_0x5f887)[_0x7125('0x21')](function(_0x4b6632){_0x3daf3b[_0x7125('0x53')]=_0x4b6632;if(_0xeac26['query']['includeAll']){_0x441ff7[_0x7125('0x54')]=[{'all':!![]}];}return db[_0x7125('0x55')]['findAll'](_0x441ff7);})[_0x7125('0x21')](function(_0x2785f4){_0x3daf3b[_0x7125('0x56')]=_0x2785f4;return _0x3daf3b;})['then'](respondWithFilteredResult(_0xa5a2f0,_0x441ff7))[_0x7125('0x57')](handleError(_0xa5a2f0,null));};exports['show']=function(_0x5b2aa4,_0x42d8e4){var _0x54b940={'raw':![],'where':{'id':_0x5b2aa4[_0x7125('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x7125('0x3a')],'as':_0x7125('0x3b')},{'model':db[_0x7125('0x3c')],'as':_0x7125('0x3d')}]},_0x551e68={};_0x551e68['model']=_['keys'](db[_0x7125('0x55')][_0x7125('0x3f')]);_0x551e68[_0x7125('0x43')]=_[_0x7125('0x44')](_0x5b2aa4[_0x7125('0x43')]);_0x551e68['filters']=_[_0x7125('0x46')](_0x551e68[_0x7125('0x42')],_0x551e68['query']);_0x54b940['attributes']=_[_0x7125('0x46')](_0x551e68[_0x7125('0x42')],qs[_0x7125('0x48')](_0x5b2aa4[_0x7125('0x43')][_0x7125('0x48')]));_0x54b940[_0x7125('0x47')]=_0x54b940[_0x7125('0x47')]['length']?_0x54b940['attributes']:_0x551e68[_0x7125('0x42')];if(_0x5b2aa4[_0x7125('0x43')]['includeAll']){_0x54b940[_0x7125('0x54')]=[{'all':!![]}];}_0x54b940=_[_0x7125('0x51')]({},_0x54b940,_0x5b2aa4['options']);return db['MailAccount'][_0x7125('0x59')](_0x54b940)[_0x7125('0x21')](handleEntityNotFound(_0x42d8e4,null))[_0x7125('0x21')](respondWithResult(_0x42d8e4,null))[_0x7125('0x57')](handleError(_0x42d8e4,null));};exports[_0x7125('0x5a')]=function(_0x3459b,_0x36bc78){if(_0x3459b[_0x7125('0x5b')]['id']){delete _0x3459b['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x3459b[_0x7125('0x58')]['id']},'include':[{'model':db[_0x7125('0x38')],'as':_0x7125('0x39')},{'model':db[_0x7125('0x3a')],'as':_0x7125('0x3b')},{'model':db[_0x7125('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x7125('0x21')](handleEntityNotFound(_0x36bc78,null))[_0x7125('0x21')](saveUpdates(_0x3459b[_0x7125('0x5b')],null))[_0x7125('0x21')](function(_0x4e47cb){if(_0x4e47cb&&_0x3459b['body'][_0x7125('0x39')]){return db['MailServerIn']['update'](_0x3459b[_0x7125('0x5b')][_0x7125('0x39')],{'where':{'MailAccountId':_0x4e47cb['id']}})['then'](function(){return _0x4e47cb;});}return _0x4e47cb;})['then'](function(_0x6a20a9){if(_0x6a20a9&&_0x3459b[_0x7125('0x5b')]['Smtp']){return db[_0x7125('0x3a')][_0x7125('0x5a')](_0x3459b['body']['Smtp'],{'where':{'MailAccountId':_0x6a20a9['id']}})[_0x7125('0x21')](function(){return _0x6a20a9;});}return _0x6a20a9;})[_0x7125('0x21')](respondWithResult(_0x36bc78,null))['catch'](handleError(_0x36bc78,null));};exports['describe']=function(_0x3b22bb,_0x126ff5){return db[_0x7125('0x55')][_0x7125('0x5c')]()[_0x7125('0x21')](respondWithResult(_0x126ff5,null))[_0x7125('0x57')](handleError(_0x126ff5,null));};exports[_0x7125('0x5d')]=function(_0x326734,_0x32ae5b,_0x23edd7){if(_0x326734[_0x7125('0x5b')]['id']){delete _0x326734[_0x7125('0x5b')]['id'];}return db[_0x7125('0x55')][_0x7125('0x59')]({'where':{'id':_0x326734[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x32ae5b,null))['then'](function(_0x29016b){if(_0x29016b){_0x326734['body'][_0x7125('0x5e')]=_0x29016b['id'];return db[_0x7125('0x5f')][_0x7125('0x60')](_0x326734[_0x7125('0x5b')]);}})[_0x7125('0x21')](respondWithResult(_0x32ae5b,null))['catch'](handleError(_0x32ae5b,null));};exports[_0x7125('0x61')]=function(_0x2c9034,_0x5943f9,_0x3423c6){var _0x3b1b3d={'raw':![],'where':{}};var _0x17448c={};var _0x21527f={'count':0x0,'rows':[]};return db[_0x7125('0x55')]['findOne']({'where':{'id':_0x2c9034['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x5943f9,null))[_0x7125('0x21')](function(_0x2a0069){if(_0x2a0069){_0x17448c['model']=_[_0x7125('0x44')](db['Disposition'][_0x7125('0x3f')]);_0x17448c['query']=_[_0x7125('0x44')](_0x2c9034[_0x7125('0x43')]);_0x17448c[_0x7125('0x45')]=_['intersection'](_0x17448c['model'],_0x17448c[_0x7125('0x43')]);_0x3b1b3d[_0x7125('0x47')]=_[_0x7125('0x46')](_0x17448c['model'],qs[_0x7125('0x48')](_0x2c9034[_0x7125('0x43')][_0x7125('0x48')]));_0x3b1b3d[_0x7125('0x47')]=_0x3b1b3d[_0x7125('0x47')]['length']?_0x3b1b3d[_0x7125('0x47')]:_0x17448c[_0x7125('0x42')];if(!_0x2c9034[_0x7125('0x43')][_0x7125('0x4a')](_0x7125('0x4b'))){_0x3b1b3d[_0x7125('0x2c')]=qs['limit'](_0x2c9034[_0x7125('0x43')][_0x7125('0x2c')]);_0x3b1b3d[_0x7125('0x2b')]=qs[_0x7125('0x2b')](_0x2c9034[_0x7125('0x43')][_0x7125('0x2b')]);}_0x3b1b3d[_0x7125('0x4c')]=qs[_0x7125('0x4d')](_0x2c9034[_0x7125('0x43')]['sort']);_0x3b1b3d[_0x7125('0x4e')]=qs[_0x7125('0x45')](_['pick'](_0x2c9034[_0x7125('0x43')],_0x17448c[_0x7125('0x45')]));_0x3b1b3d[_0x7125('0x4e')][_0x7125('0x5e')]=_0x2a0069['id'];if(_0x2c9034['query'][_0x7125('0x50')]){_0x3b1b3d['where']=_[_0x7125('0x51')](_0x3b1b3d[_0x7125('0x4e')],{'$or':_[_0x7125('0x3e')](_0x3b1b3d[_0x7125('0x47')],function(_0x395927){var _0x2085c2={};_0x2085c2[_0x395927]={'$like':'%'+_0x2c9034[_0x7125('0x43')]['filter']+'%'};return _0x2085c2;})});}_0x3b1b3d=_['merge']({},_0x3b1b3d,_0x2c9034[_0x7125('0x52')]);return db[_0x7125('0x5f')][_0x7125('0x53')]({'where':_0x3b1b3d['where']})[_0x7125('0x21')](function(_0xa722dd){_0x21527f[_0x7125('0x53')]=_0xa722dd;if(_0x2c9034['query'][_0x7125('0x62')]){_0x3b1b3d[_0x7125('0x54')]=[{'all':!![]}];}return db[_0x7125('0x5f')][_0x7125('0x63')](_0x3b1b3d);})['then'](function(_0x2afeb6){_0x21527f['rows']=_0x2afeb6;return _0x21527f;});}})[_0x7125('0x21')](respondWithFilteredResult(_0x5943f9,_0x3b1b3d))['catch'](handleError(_0x5943f9,null));};exports['removeDispositions']=function(_0x5f1bd8,_0x18c2c5,_0x40db7b){return db[_0x7125('0x55')]['find']({'where':{'id':_0x5f1bd8['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x18c2c5,null))[_0x7125('0x21')](function(_0x351e47){if(_0x351e47){return _0x351e47[_0x7125('0x64')](_0x5f1bd8[_0x7125('0x43')]['ids']);}})[_0x7125('0x21')](respondWithStatusCode(_0x18c2c5,null))['catch'](handleError(_0x18c2c5,null));};exports[_0x7125('0x65')]=function(_0xf80597,_0x5568d9,_0x5415bc){if(_0xf80597[_0x7125('0x5b')]['id']){delete _0xf80597[_0x7125('0x5b')]['id'];}return db[_0x7125('0x55')][_0x7125('0x59')]({'where':{'id':_0xf80597['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x5568d9,null))['then'](function(_0x46fbd2){if(_0x46fbd2){_0xf80597[_0x7125('0x5b')][_0x7125('0x5e')]=_0x46fbd2['id'];return db[_0x7125('0x66')][_0x7125('0x60')](_0xf80597[_0x7125('0x5b')]);}})['then'](respondWithResult(_0x5568d9,null))['catch'](handleError(_0x5568d9,null));};exports[_0x7125('0x67')]=function(_0x117e68,_0x194539,_0x47cc8f){var _0x352c27={'raw':![],'where':{}};var _0x348641={};var _0x396f22={'count':0x0,'rows':[]};return db[_0x7125('0x55')]['findOne']({'where':{'id':_0x117e68[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x194539,null))[_0x7125('0x21')](function(_0xe0d2b1){if(_0xe0d2b1){_0x348641[_0x7125('0x42')]=_[_0x7125('0x44')](db['CannedAnswer'][_0x7125('0x3f')]);_0x348641[_0x7125('0x43')]=_['keys'](_0x117e68[_0x7125('0x43')]);_0x348641[_0x7125('0x45')]=_[_0x7125('0x46')](_0x348641[_0x7125('0x42')],_0x348641[_0x7125('0x43')]);_0x352c27[_0x7125('0x47')]=_[_0x7125('0x46')](_0x348641[_0x7125('0x42')],qs[_0x7125('0x48')](_0x117e68[_0x7125('0x43')][_0x7125('0x48')]));_0x352c27[_0x7125('0x47')]=_0x352c27[_0x7125('0x47')]['length']?_0x352c27['attributes']:_0x348641[_0x7125('0x42')];if(!_0x117e68['query'][_0x7125('0x4a')]('nolimit')){_0x352c27[_0x7125('0x2c')]=qs[_0x7125('0x2c')](_0x117e68[_0x7125('0x43')][_0x7125('0x2c')]);_0x352c27[_0x7125('0x2b')]=qs[_0x7125('0x2b')](_0x117e68[_0x7125('0x43')]['offset']);}_0x352c27[_0x7125('0x4c')]=qs[_0x7125('0x4d')](_0x117e68[_0x7125('0x43')]['sort']);_0x352c27[_0x7125('0x4e')]=qs[_0x7125('0x45')](_['pick'](_0x117e68[_0x7125('0x43')],_0x348641[_0x7125('0x45')]));_0x352c27['where'][_0x7125('0x5e')]=_0xe0d2b1['id'];if(_0x117e68[_0x7125('0x43')][_0x7125('0x50')]){_0x352c27[_0x7125('0x4e')]=_['merge'](_0x352c27[_0x7125('0x4e')],{'$or':_[_0x7125('0x3e')](_0x352c27['attributes'],function(_0x59cf8f){var _0x1d93ec={};_0x1d93ec[_0x59cf8f]={'$like':'%'+_0x117e68['query']['filter']+'%'};return _0x1d93ec;})});}_0x352c27=_[_0x7125('0x51')]({},_0x352c27,_0x117e68[_0x7125('0x52')]);return db[_0x7125('0x66')][_0x7125('0x53')]({'where':_0x352c27[_0x7125('0x4e')]})['then'](function(_0x5d10f3){_0x396f22[_0x7125('0x53')]=_0x5d10f3;if(_0x117e68[_0x7125('0x43')][_0x7125('0x62')]){_0x352c27[_0x7125('0x54')]=[{'all':!![]}];}return db[_0x7125('0x66')][_0x7125('0x63')](_0x352c27);})[_0x7125('0x21')](function(_0x587488){_0x396f22[_0x7125('0x56')]=_0x587488;return _0x396f22;});}})[_0x7125('0x21')](respondWithFilteredResult(_0x194539,_0x352c27))[_0x7125('0x57')](handleError(_0x194539,null));};exports['removeAnswers']=function(_0x4ec445,_0x28b99f,_0x53bb74){return db[_0x7125('0x55')][_0x7125('0x59')]({'where':{'id':_0x4ec445[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x28b99f,null))['then'](function(_0xca7b9e){if(_0xca7b9e){return _0xca7b9e[_0x7125('0x68')](_0x4ec445[_0x7125('0x43')][_0x7125('0x69')]);}})[_0x7125('0x21')](respondWithStatusCode(_0x28b99f,null))['catch'](handleError(_0x28b99f,null));};exports[_0x7125('0x60')]=function(_0x118bfe,_0x1da5c7){var _0x20c380={'name':_0x118bfe[_0x7125('0x5b')][_0x7125('0x36')],'key':_0x118bfe[_0x7125('0x5b')][_0x7125('0x6a')],'email':_0x118bfe[_0x7125('0x5b')][_0x7125('0x6b')],'ListId':_0x118bfe[_0x7125('0x5b')][_0x7125('0x6c')],'active':!_[_0x7125('0x6d')](_0x118bfe['body'][_0x7125('0x6e')])?_0x118bfe['body'][_0x7125('0x6e')]:!![],'description':_0x118bfe['body'][_0x7125('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x7125('0x6d')](_0x118bfe['body']['cservice'])){if(_0x118bfe[_0x7125('0x5b')][_0x7125('0x70')]){_0x20c380[_0x7125('0x39')][_0x7125('0x71')]=_0x20c380[_0x7125('0x3b')][_0x7125('0x71')]=_0x118bfe[_0x7125('0x5b')][_0x7125('0x72')];_0x20c380[_0x7125('0x39')][_0x7125('0x73')]=_0x20c380['Smtp']['pass']=_0x118bfe['body'][_0x7125('0x74')];}else{_0x20c380[_0x7125('0x39')][_0x7125('0x75')]=_0x20c380['Smtp'][_0x7125('0x75')]=![];}_0x20c380[_0x7125('0x39')]['host']=_0x118bfe[_0x7125('0x5b')][_0x7125('0x39')][_0x7125('0x76')];_0x20c380[_0x7125('0x39')][_0x7125('0x77')]=_0x118bfe[_0x7125('0x5b')][_0x7125('0x39')][_0x7125('0x77')];_0x20c380[_0x7125('0x3b')][_0x7125('0x76')]=_0x118bfe[_0x7125('0x5b')][_0x7125('0x3b')][_0x7125('0x76')];_0x20c380['Smtp']['port']=_0x118bfe['body'][_0x7125('0x3b')]['port'];}else{_0x20c380[_0x7125('0x39')][_0x7125('0x78')]=_0x20c380[_0x7125('0x3b')][_0x7125('0x78')]=_0x118bfe[_0x7125('0x5b')]['cservice'];_0x20c380[_0x7125('0x39')][_0x7125('0x71')]=_0x20c380[_0x7125('0x3b')][_0x7125('0x71')]=_0x118bfe[_0x7125('0x5b')][_0x7125('0x72')];_0x20c380[_0x7125('0x39')][_0x7125('0x73')]=_0x20c380[_0x7125('0x3b')][_0x7125('0x79')]=_0x118bfe['body'][_0x7125('0x74')];}return db[_0x7125('0x55')][_0x7125('0x60')](_0x20c380,{'include':[{'model':db[_0x7125('0x3a')],'as':_0x7125('0x3b')},{'model':db[_0x7125('0x38')],'as':'Imap'}]})[_0x7125('0x21')](function(_0x163119){var _0x1f5c8d=_0x118bfe[_0x7125('0x71')]['get']({'plain':!![]});if(!_0x1f5c8d)throw new Error(_0x7125('0x7a'));if(_0x1f5c8d['role']===_0x7125('0x71')){var _0xd2334f=_0x163119['get']({'plain':!![]});return db['UserProfileSection'][_0x7125('0x59')]({'where':{'name':_0x7125('0x32'),'userProfileId':_0x1f5c8d['userProfileId']},'raw':!![]})['then'](function(_0x5d0aac){if(_0x5d0aac&&_0x5d0aac[_0x7125('0x7b')]===0x0){return db[_0x7125('0x33')]['create']({'name':_0xd2334f[_0x7125('0x36')],'resourceId':_0xd2334f['id'],'type':_0x5d0aac[_0x7125('0x36')],'sectionId':_0x5d0aac['id']},{})[_0x7125('0x21')](function(){return _0x163119;});}else{return _0x163119;}})['catch'](function(_0x22a9ce){logger[_0x7125('0x24')](_0x7125('0x7c'),_0x22a9ce);throw _0x22a9ce;});}return _0x163119;})['then'](respondWithResult(_0x1da5c7,0xc9))[_0x7125('0x57')](handleError(_0x1da5c7,null));};exports[_0x7125('0x7d')]=function(_0x402b51,_0x5d6faa,_0x4a61d6){return db[_0x7125('0x55')]['findOne']({'where':{'id':_0x402b51[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x5d6faa,null))['then'](function(_0x5f0b2d){if(_0x5f0b2d){return _0x5f0b2d[_0x7125('0x7d')]();}return null;})[_0x7125('0x21')](respondWithResult(_0x5d6faa,null))[_0x7125('0x57')](handleError(_0x5d6faa,null));};exports[_0x7125('0x7e')]=function(_0x9e946a,_0x327031,_0x1ec98d){if(_0x9e946a[_0x7125('0x5b')]['id']){delete _0x9e946a[_0x7125('0x5b')]['id'];}return db[_0x7125('0x55')]['find']({'where':{'id':_0x9e946a[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x327031,null))['then'](function(_0x22b898){if(_0x22b898){_0x9e946a[_0x7125('0x5b')]['MailAccountId']=_0x22b898['id'];return db[_0x7125('0x38')][_0x7125('0x60')](_0x9e946a[_0x7125('0x5b')]);}})[_0x7125('0x21')](respondWithResult(_0x327031,null))[_0x7125('0x57')](handleError(_0x327031,null));};exports[_0x7125('0x7f')]=function(_0x4d104b,_0x24ef7b,_0x1626d0){return db['MailAccount'][_0x7125('0x80')]({'where':{'id':_0x4d104b[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x24ef7b,null))['then'](function(_0x22c733){if(_0x22c733){return _0x22c733[_0x7125('0x81')](null);}return null;})[_0x7125('0x21')](respondWithStatusCode(_0x24ef7b,null))['catch'](handleError(_0x24ef7b,null));};exports[_0x7125('0x82')]=function(_0x46ac98,_0xa183e,_0x117458){return db[_0x7125('0x55')]['findOne']({'where':{'id':_0x46ac98[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0xa183e,null))[_0x7125('0x21')](function(_0x3c6821){if(_0x3c6821){return _0x3c6821[_0x7125('0x82')]();}return null;})[_0x7125('0x21')](respondWithResult(_0xa183e,null))[_0x7125('0x57')](handleError(_0xa183e,null));};exports[_0x7125('0x83')]=function(_0xfc7686,_0x2b423d,_0x348fa9){if(_0xfc7686[_0x7125('0x5b')]['id']){delete _0xfc7686[_0x7125('0x5b')]['id'];}return db[_0x7125('0x55')][_0x7125('0x59')]({'where':{'id':_0xfc7686[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x2b423d,null))['then'](function(_0x54e670){if(_0x54e670){_0xfc7686[_0x7125('0x5b')]['MailAccountId']=_0x54e670['id'];return db[_0x7125('0x3a')][_0x7125('0x60')](_0xfc7686['body']);}})[_0x7125('0x21')](respondWithResult(_0x2b423d,null))[_0x7125('0x57')](handleError(_0x2b423d,null));};exports[_0x7125('0x84')]=function(_0x3ac781,_0x450b6d,_0x33193e){return db[_0x7125('0x55')]['findOne']({'where':{'id':_0x3ac781['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x450b6d,null))['then'](function(_0x572280){if(_0x572280){return _0x572280[_0x7125('0x85')](null);}return null;})[_0x7125('0x21')](respondWithStatusCode(_0x450b6d,null))[_0x7125('0x57')](handleError(_0x450b6d,null));};exports[_0x7125('0x86')]=function(_0x5e8fba,_0x55129c,_0x341cdb){return db[_0x7125('0x87')][_0x7125('0x59')]({'where':{'id':_0x5e8fba['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x55129c,null))[_0x7125('0x21')](function(_0x3a1671){if(_0x3a1671){return _0x3a1671['addInteraction'](_0x5e8fba[_0x7125('0x5b')][_0x7125('0x69')],_[_0x7125('0x88')](_0x5e8fba[_0x7125('0x5b')],[_0x7125('0x69'),'id'])||{});}})[_0x7125('0x21')](respondWithResult(_0x55129c,null))['catch'](handleError(_0x55129c,null));};exports[_0x7125('0x89')]=function(_0x430a05,_0x509437,_0x589eb3){var _0x17ace1={'raw':![],'where':{}};var _0x15d2b3={};var _0x2f33b7={'count':0x0,'rows':[]};return db['MailAccount'][_0x7125('0x80')]({'where':{'id':_0x430a05[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x509437,null))[_0x7125('0x21')](function(_0x5039e0){if(_0x5039e0){_0x15d2b3[_0x7125('0x42')]=_[_0x7125('0x44')](db[_0x7125('0x87')]['rawAttributes']);_0x15d2b3[_0x7125('0x43')]=_[_0x7125('0x44')](_0x430a05['query']);_0x15d2b3[_0x7125('0x45')]=_[_0x7125('0x46')](_0x15d2b3[_0x7125('0x42')],_0x15d2b3['query']);_0x17ace1[_0x7125('0x47')]=_[_0x7125('0x46')](_0x15d2b3['model'],qs[_0x7125('0x48')](_0x430a05['query'][_0x7125('0x48')]));_0x17ace1['attributes']=_0x17ace1[_0x7125('0x47')]['length']?_0x17ace1[_0x7125('0x47')]:_0x15d2b3[_0x7125('0x42')];if(!_0x430a05[_0x7125('0x43')][_0x7125('0x4a')](_0x7125('0x4b'))){_0x17ace1[_0x7125('0x2c')]=qs['limit'](_0x430a05[_0x7125('0x43')]['limit']);_0x17ace1['offset']=qs[_0x7125('0x2b')](_0x430a05[_0x7125('0x43')][_0x7125('0x2b')]);}_0x17ace1[_0x7125('0x4c')]=qs['sort'](_0x430a05['query'][_0x7125('0x4d')]);_0x17ace1[_0x7125('0x4e')]=qs['filters'](_[_0x7125('0x4f')](_0x430a05['query'],_0x15d2b3[_0x7125('0x45')]));_0x17ace1['where'][_0x7125('0x5e')]=_0x5039e0['id'];if(_0x430a05[_0x7125('0x43')][_0x7125('0x50')]){_0x17ace1['where']=_[_0x7125('0x51')](_0x17ace1['where'],{'$or':_['map'](_0x17ace1[_0x7125('0x47')],function(_0x550020){var _0x3ec101={};_0x3ec101[_0x550020]={'$like':'%'+_0x430a05['query']['filter']+'%'};return _0x3ec101;})});}_0x17ace1=_[_0x7125('0x51')]({},_0x17ace1,_0x430a05['options']);return db['MailInteraction']['count']({'where':_0x17ace1[_0x7125('0x4e')]})[_0x7125('0x21')](function(_0x547f54){_0x2f33b7[_0x7125('0x53')]=_0x547f54;if(_0x430a05[_0x7125('0x43')][_0x7125('0x62')]){_0x17ace1[_0x7125('0x54')]=[{'model':db[_0x7125('0x8a')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x7125('0x8b'),'attributes':[_0x7125('0x36'),_0x7125('0x8c'),_0x7125('0x8d')],'required':![]},{'model':db[_0x7125('0x8e')],'as':_0x7125('0x8f'),'attributes':['id','name','color'],'where':_0x430a05[_0x7125('0x43')]['tag']?{'id':_0x430a05[_0x7125('0x43')][_0x7125('0x90')]}:undefined,'required':_0x430a05['query'][_0x7125('0x90')]?!![]:![]}];}return db[_0x7125('0x87')]['findAll'](_0x17ace1);})[_0x7125('0x21')](function(_0x12b52e){_0x2f33b7['rows']=_0x12b52e;return _0x2f33b7;});}})[_0x7125('0x21')](respondWithFilteredResult(_0x509437,_0x17ace1))[_0x7125('0x57')](handleError(_0x509437,null));};exports[_0x7125('0x91')]=function(_0x5eb3a0,_0x50b432,_0x5ee197){return db[_0x7125('0x55')]['findOne']({'where':{'id':_0x5eb3a0['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x50b432,null))['then'](function(_0x402350){if(_0x402350){return db[_0x7125('0x92')][_0x7125('0x93')](function(_0x4f48f5){return db[_0x7125('0x94')][_0x7125('0x34')]({'where':{'MailAccountId':_0x5eb3a0[_0x7125('0x58')]['id']},'transaction':_0x4f48f5})[_0x7125('0x21')](function(_0xe9da99){var _0xf2b5e4=_['map'](_0x5eb3a0['body'],function(_0x452fa7){_0x452fa7[_0x7125('0x5e')]=_0x5eb3a0[_0x7125('0x58')]['id'];return _0x452fa7;});return db[_0x7125('0x94')][_0x7125('0x95')](_0xf2b5e4,{'transaction':_0x4f48f5});});})[_0x7125('0x21')](function(){return db['MailApplication'][_0x7125('0x96')]({'where':{'MailAccountId':_0x5eb3a0[_0x7125('0x58')]['id']},'order':_0x7125('0x97')});});}})['then'](respondWithResult(_0x50b432,null))[_0x7125('0x57')](handleError(_0x50b432,null));};exports['getApplications']=function(_0x32a9d6,_0x4aeb79,_0x15a695){var _0x5e6b51={};var _0x5a2128={};var _0x2acdf3;var _0x878f02;return db[_0x7125('0x55')][_0x7125('0x80')]({'where':{'id':_0x32a9d6['params']['id']}})['then'](handleEntityNotFound(_0x4aeb79,null))[_0x7125('0x21')](function(_0x5e3dfd){if(_0x5e3dfd){_0x2acdf3=_0x5e3dfd;_0x5a2128['model']=_['keys'](db[_0x7125('0x94')][_0x7125('0x3f')]);_0x5a2128[_0x7125('0x43')]=_[_0x7125('0x44')](_0x32a9d6[_0x7125('0x43')]);_0x5a2128['filters']=_['intersection'](_0x5a2128[_0x7125('0x42')],_0x5a2128['query']);_0x5e6b51[_0x7125('0x47')]=_[_0x7125('0x46')](_0x5a2128[_0x7125('0x42')],qs[_0x7125('0x48')](_0x32a9d6[_0x7125('0x43')][_0x7125('0x48')]));_0x5e6b51[_0x7125('0x47')]=_0x5e6b51[_0x7125('0x47')][_0x7125('0x49')]?_0x5e6b51[_0x7125('0x47')]:_0x5a2128['model'];_0x5e6b51[_0x7125('0x4c')]=qs['sort'](_0x32a9d6[_0x7125('0x43')][_0x7125('0x4d')]);_0x5e6b51[_0x7125('0x4e')]=qs[_0x7125('0x45')](_[_0x7125('0x4f')](_0x32a9d6[_0x7125('0x43')],_0x5a2128[_0x7125('0x45')]));if(_0x32a9d6[_0x7125('0x43')][_0x7125('0x50')]){_0x5e6b51[_0x7125('0x4e')]=_['merge'](_0x5e6b51[_0x7125('0x4e')],{'$or':_[_0x7125('0x3e')](_0x5e6b51['attributes'],function(_0x5c6dd8){var _0x381729={};_0x381729[_0x5c6dd8]={'$like':'%'+_0x32a9d6[_0x7125('0x43')]['filter']+'%'};return _0x381729;})});}_0x5e6b51=_['merge']({},_0x5e6b51,_0x32a9d6['options']);return _0x2acdf3[_0x7125('0x98')](_0x5e6b51);}})[_0x7125('0x21')](function(_0x1d6274){if(_0x1d6274){_0x878f02=_0x1d6274[_0x7125('0x49')];if(!_0x32a9d6[_0x7125('0x43')][_0x7125('0x4a')]('nolimit')){_0x5e6b51[_0x7125('0x2c')]=qs['limit'](_0x32a9d6[_0x7125('0x43')][_0x7125('0x2c')]);_0x5e6b51[_0x7125('0x2b')]=qs[_0x7125('0x2b')](_0x32a9d6[_0x7125('0x43')][_0x7125('0x2b')]);}return _0x2acdf3['getApplications'](_0x5e6b51);}})[_0x7125('0x21')](function(_0x20409e){if(_0x20409e){return _0x20409e?{'count':_0x878f02,'rows':_0x20409e}:null;}})['then'](respondWithResult(_0x4aeb79,null))[_0x7125('0x57')](handleError(_0x4aeb79,null));};exports[_0x7125('0x99')]=function(_0x25f7de,_0x16dff4,_0x1e2173){var _0x30d82e={'raw':!![],'where':{}};var _0x5650ad={};var _0x428111={'count':0x0,'rows':[]};return db['MailAccount'][_0x7125('0x80')]({'where':{'id':_0x25f7de[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x16dff4,null))[_0x7125('0x21')](function(_0xa957e8){if(_0xa957e8){_0x5650ad[_0x7125('0x42')]=_[_0x7125('0x44')](db[_0x7125('0x9a')][_0x7125('0x3f')]);_0x5650ad[_0x7125('0x43')]=_['keys'](_0x25f7de['query']);_0x5650ad[_0x7125('0x45')]=_['intersection'](_0x5650ad[_0x7125('0x42')],_0x5650ad['query']);_0x30d82e[_0x7125('0x47')]=_[_0x7125('0x46')](_0x5650ad['model'],qs[_0x7125('0x48')](_0x25f7de[_0x7125('0x43')][_0x7125('0x48')]));_0x30d82e[_0x7125('0x47')]=_0x30d82e[_0x7125('0x47')][_0x7125('0x49')]?_0x30d82e[_0x7125('0x47')]:_0x5650ad[_0x7125('0x42')];if(!_0x25f7de[_0x7125('0x43')][_0x7125('0x4a')](_0x7125('0x4b'))){_0x30d82e[_0x7125('0x2c')]=qs[_0x7125('0x2c')](_0x25f7de[_0x7125('0x43')][_0x7125('0x2c')]);_0x30d82e[_0x7125('0x2b')]=qs[_0x7125('0x2b')](_0x25f7de['query'][_0x7125('0x2b')]);}_0x30d82e[_0x7125('0x4c')]=qs['sort'](_0x25f7de[_0x7125('0x43')]['sort']);_0x30d82e['where']=qs[_0x7125('0x45')](_['pick'](_0x25f7de[_0x7125('0x43')],_0x5650ad[_0x7125('0x45')]));_0x30d82e[_0x7125('0x4e')][_0x7125('0x5e')]=_0xa957e8['id'];if(_0x25f7de[_0x7125('0x43')][_0x7125('0x50')]){_0x30d82e[_0x7125('0x4e')]=_[_0x7125('0x51')](_0x30d82e[_0x7125('0x4e')],{'$or':_[_0x7125('0x3e')](_0x30d82e['attributes'],function(_0xd939cd){var _0x265eb3={};_0x265eb3[_0xd939cd]={'$like':'%'+_0x25f7de[_0x7125('0x43')]['filter']+'%'};return _0x265eb3;})});}if(_0x25f7de[_0x7125('0x43')][_0x7125('0x9b')]){var _0x24fa63=_0x25f7de[_0x7125('0x43')][_0x7125('0x9b')][_0x7125('0x9c')](',');var _0x2d9438={};_0x2d9438[_0x24fa63[0x0]]={'$gte':moment(_0x24fa63[0x1])['format'](_0x7125('0x9d'))};_0x30d82e[_0x7125('0x4e')]=_[_0x7125('0x51')](_0x30d82e[_0x7125('0x4e')],_0x2d9438);}_0x30d82e=_[_0x7125('0x51')]({},_0x30d82e,_0x25f7de['options']);return db[_0x7125('0x9a')][_0x7125('0x53')]({'where':_0x30d82e[_0x7125('0x4e')]})[_0x7125('0x21')](function(_0x16a31e){_0x428111[_0x7125('0x53')]=_0x16a31e;if(_0x25f7de[_0x7125('0x43')][_0x7125('0x62')]){_0x30d82e['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x30d82e);})[_0x7125('0x21')](function(_0x46d921){_0x428111[_0x7125('0x56')]=_0x46d921;return _0x428111;});}})[_0x7125('0x21')](respondWithFilteredResult(_0x16dff4,_0x30d82e))[_0x7125('0x57')](handleError(_0x16dff4,null));};exports[_0x7125('0x9e')]=function(_0x4ab6f0,_0x2f5f9e,_0x5663cf){var _0x3504c1,_0x339d66={},_0x59ce45;if(_0x4ab6f0['body']['to']){_0x59ce45=_0x4ab6f0[_0x7125('0x5b')]['to'][_0x7125('0x9c')](',')[0x0];}return db[_0x7125('0x55')][_0x7125('0x59')]({'where':{'id':_0x4ab6f0[_0x7125('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x7125('0x9f'),'include':[{'model':db[_0x7125('0x8a')],'as':'Contacts','where':{'email':_0x59ce45},'limit':0x1,'order':[[_0x7125('0xa0'),'DESC']]}]},{'model':db[_0x7125('0x3a')],'as':'Smtp','raw':!![]}]})[_0x7125('0x21')](handleEntityNotFound(_0x2f5f9e,null))[_0x7125('0x21')](function(_0x301d51){if(_0x301d51){_0x3504c1=_0x301d51;if(_0x301d51[_0x7125('0x3b')]){if(_['isNil'](_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xa1')])){_0x4ab6f0[_0x7125('0x5b')]['from']=util[_0x7125('0xa2')](_0x7125('0xa3'),_0x301d51['name'],_0x301d51[_0x7125('0x6b')]||_0x301d51[_0x7125('0x3b')][_0x7125('0x71')]);}if(_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xa4')]&&_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xa4')]['length']){for(var _0x495c2a=0x0;_0x495c2a<_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xa4')][_0x7125('0x49')];_0x495c2a+=0x1){_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xa4')][_0x495c2a]={'filename':_0x4ab6f0['body'][_0x7125('0xa4')][_0x495c2a][_0x7125('0x36')],'path':path[_0x7125('0xa5')](config[_0x7125('0xa6')],_0x7125('0xa7'),_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xa4')][_0x495c2a][_0x7125('0xa8')])};}}var _0x528a4c={'tls':{'rejectUnauthorized':![]}};if(_[_0x7125('0x6d')](_0x301d51[_0x7125('0x3b')][_0x7125('0x78')])){if(_0x301d51['Smtp'][_0x7125('0x75')]){_0x528a4c[_0x7125('0xa9')]={'user':_0x301d51[_0x7125('0x3b')]['user'],'pass':_0x301d51['Smtp'][_0x7125('0x79')]};}_0x528a4c[_0x7125('0x76')]=_0x301d51['Smtp'][_0x7125('0x76')];_0x528a4c[_0x7125('0x77')]=_0x301d51[_0x7125('0x3b')][_0x7125('0x77')];_0x528a4c[_0x7125('0xaa')]=_0x301d51['Smtp'][_0x7125('0xaa')];}else{_0x528a4c[_0x7125('0x78')]=_0x301d51[_0x7125('0x3b')][_0x7125('0x78')];_0x528a4c['auth']={'user':_0x301d51['Smtp']['user'],'pass':_0x301d51[_0x7125('0x3b')]['pass']};}return respondWithRpcPromise(_0x7125('0xab'),_0x7125('0xac'),{'account':_0x528a4c,'message':_0x4ab6f0[_0x7125('0x5b')]});}else{throw new Error(_0x7125('0xad'));}}})[_0x7125('0x21')](function(_0x598f6f){if(_0x598f6f){_0x339d66=_0x598f6f;if(_0x3504c1[_0x7125('0x9f')]){if(_0x3504c1[_0x7125('0x9f')][_0x7125('0xae')]['length']){return _0x3504c1[_0x7125('0x9f')][_0x7125('0xae')][0x0];}else{return db['CmContact']['create'](_[_0x7125('0x19')](_0x4ab6f0[_0x7125('0x5b')],{'firstName':_0x4ab6f0[_0x7125('0x5b')]['to'],'email':_0x4ab6f0[_0x7125('0x5b')]['to'],'phone':_0x4ab6f0[_0x7125('0x5b')]['to'],'ListId':_0x3504c1[_0x7125('0x6c')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x7125('0x21')](function(_0x2d440d){if(_0x2d440d){var _0x281c0f={'UserId':_0x4ab6f0[_0x7125('0x71')]['id'],'ContactId':_0x2d440d['id'],'MailAccountId':_0x3504c1['id'],'inReplyTo':_0x339d66[_0x7125('0xaf')],'to':_0x4ab6f0['body'][_0x7125('0xa1')],'cc':_0x4ab6f0[_0x7125('0x5b')]['cc'],'subject':_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xb0')],'attach':_0x4ab6f0['body'][_0x7125('0xb1')],'firstMsgDirection':_0x7125('0xb2'),'lastMsgAt':moment()[_0x7125('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x7125('0xb2'),'lastMsgBody':_0x4ab6f0[_0x7125('0x5b')][_0x7125('0x5b')],'Messages':[_['merge'](_0x4ab6f0[_0x7125('0x5b')],{'messageId':_0x339d66[_0x7125('0xaf')],'sentAt':moment()[_0x7125('0xa2')](_0x7125('0x9d')),'read':!![],'MailAccountId':_0x3504c1['id'],'UserId':_0x4ab6f0['user']['id'],'ContactId':_0x2d440d['id']})]};if(_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xb3')]){_0x281c0f=_[_0x7125('0x51')](_0x281c0f,_0x4ab6f0[_0x7125('0x5b')][_0x7125('0xb3')]);}return db['MailInteraction'][_0x7125('0x60')](_0x281c0f,{'include':[{'model':db[_0x7125('0x9a')],'as':_0x7125('0xb4')}]});}})[_0x7125('0x21')](respondWithResult(_0x2f5f9e,null))['catch'](handleError(_0x2f5f9e,null));};exports[_0x7125('0xb5')]=function(_0x3108c7,_0x7dd4c7,_0x6951ed){return db['MailAccount']['find']({'where':{'id':_0x3108c7[_0x7125('0x58')]['id']},'include':[{'model':db[_0x7125('0x3a')],'as':'Smtp','raw':!![]}]})[_0x7125('0x21')](handleEntityNotFound(_0x7dd4c7,null))[_0x7125('0x21')](function(_0x36016e){if(_0x36016e&&_0x36016e[_0x7125('0x3b')]){var _0x240f27={'id':_0x36016e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x36016e[_0x7125('0x3b')]['service']){_0x240f27[_0x7125('0x78')]=_0x36016e[_0x7125('0x3b')][_0x7125('0x78')];}else{_0x240f27['host']=_0x36016e[_0x7125('0x3b')][_0x7125('0x76')];_0x240f27['port']=_0x36016e[_0x7125('0x3b')][_0x7125('0x77')];_0x240f27['secure']=_0x36016e['Smtp'][_0x7125('0xaa')];}if(_0x36016e[_0x7125('0x3b')][_0x7125('0x75')]){_0x240f27[_0x7125('0xa9')]={'user':_0x36016e['Smtp'][_0x7125('0x71')],'pass':_0x36016e[_0x7125('0x3b')][_0x7125('0x79')]};}return respondWithRpcPromise(_0x7125('0xb6'),_0x7125('0xb5'),{'account':_0x240f27});}})['then'](respondWithResult(_0x7dd4c7,null))[_0x7125('0x57')](handleError(_0x7dd4c7,null));};exports[_0x7125('0x34')]=function(_0x3e79d8,_0x458e43){return db['MailAccount'][_0x7125('0x59')]({'where':{'id':_0x3e79d8[_0x7125('0x58')]['id']}})['then'](handleEntityNotFound(_0x458e43,null))[_0x7125('0x21')](function(_0x1564e6){if(_0x1564e6&&_0x1564e6[_0x7125('0x78')]){throw new db[(_0x7125('0xb7'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1564e6;})['then'](removeEntity(_0x458e43,null))['catch'](handleError(_0x458e43,null));};exports[_0x7125('0xb8')]=function(_0x424e07,_0x2ffb72,_0x4e12ce){return db[_0x7125('0x55')][_0x7125('0x59')]({'where':{'id':_0x424e07['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x2ffb72,null))[_0x7125('0x21')](function(_0x53163e){if(_0x53163e){return _0x53163e[_0x7125('0xb8')](_0x424e07[_0x7125('0x5b')][_0x7125('0x69')],_[_0x7125('0x88')](_0x424e07[_0x7125('0x5b')],['ids','id'])||{})[_0x7125('0xb9')](function(_0x4ec162){for(var _0x401b04=0x0;_0x401b04<_0x424e07['body'][_0x7125('0x69')][_0x7125('0x49')];_0x401b04+=0x1){socket[_0x7125('0xba')]('userMailAccount:save',{'UserId':_0x424e07[_0x7125('0x5b')][_0x7125('0x69')][_0x401b04],'MailAccountId':_0x424e07[_0x7125('0x58')]['id']});}return _0x4ec162;});}})[_0x7125('0x21')](respondWithResult(_0x2ffb72,null))[_0x7125('0x57')](handleError(_0x2ffb72,null));};exports[_0x7125('0xbb')]=function(_0xffb3e9,_0x50d746,_0x309ed9){return db[_0x7125('0x55')]['find']({'where':{'id':_0xffb3e9[_0x7125('0x58')]['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x50d746,null))[_0x7125('0x21')](function(_0x2347a3){if(_0x2347a3){return _0x2347a3[_0x7125('0xbb')](_0xffb3e9[_0x7125('0x43')][_0x7125('0x69')])[_0x7125('0x21')](function(){if(_['isArray'](_0xffb3e9['query'][_0x7125('0x69')])){for(var _0x222174=0x0;_0x222174<_0xffb3e9['query']['ids']['length'];_0x222174+=0x1){socket[_0x7125('0xba')](_0x7125('0xbc'),{'UserId':Number(_0xffb3e9[_0x7125('0x43')][_0x7125('0x69')][_0x222174]),'MailAccountId':Number(_0xffb3e9[_0x7125('0x58')]['id'])});}}else{socket[_0x7125('0xba')]('userMailAccount:remove',{'UserId':Number(_0xffb3e9[_0x7125('0x43')][_0x7125('0x69')]),'MailAccountId':Number(_0xffb3e9[_0x7125('0x58')]['id'])});}});}})[_0x7125('0x21')](respondWithStatusCode(_0x50d746,null))['catch'](handleError(_0x50d746,null));};exports[_0x7125('0xbd')]=function(_0xe8c9db,_0x3c7fc4,_0x35b7e2){var _0x3b81c3={};var _0x14ed09={};var _0x4f298a;var _0x198cc1;return db[_0x7125('0x55')][_0x7125('0x80')]({'where':{'id':_0xe8c9db['params']['id']}})[_0x7125('0x21')](handleEntityNotFound(_0x3c7fc4,null))[_0x7125('0x21')](function(_0x3c761a){if(_0x3c761a){_0x4f298a=_0x3c761a;_0x14ed09[_0x7125('0x42')]=_[_0x7125('0x44')](db[_0x7125('0xbe')][_0x7125('0x3f')]);_0x14ed09[_0x7125('0x43')]=_[_0x7125('0x44')](_0xe8c9db[_0x7125('0x43')]);_0x14ed09[_0x7125('0x45')]=_[_0x7125('0x46')](_0x14ed09[_0x7125('0x42')],_0x14ed09[_0x7125('0x43')]);_0x3b81c3['attributes']=_['intersection'](_0x14ed09[_0x7125('0x42')],qs['fields'](_0xe8c9db[_0x7125('0x43')]['fields']));_0x3b81c3[_0x7125('0x47')]=_0x3b81c3[_0x7125('0x47')][_0x7125('0x49')]?_0x3b81c3['attributes']:_0x14ed09['model'];_0x3b81c3[_0x7125('0x4c')]=qs['sort'](_0xe8c9db['query'][_0x7125('0x4d')]);_0x3b81c3[_0x7125('0x4e')]=qs['filters'](_['pick'](_0xe8c9db['query'],_0x14ed09[_0x7125('0x45')]));if(_0xe8c9db[_0x7125('0x43')]['filter']){_0x3b81c3[_0x7125('0x4e')]=_[_0x7125('0x51')](_0x3b81c3['where'],{'$or':_['map'](_0x3b81c3[_0x7125('0x47')],function(_0x12e5cd){var _0x57a196={};_0x57a196[_0x12e5cd]={'$like':'%'+_0xe8c9db[_0x7125('0x43')][_0x7125('0x50')]+'%'};return _0x57a196;})});}_0x3b81c3=_[_0x7125('0x51')]({},_0x3b81c3,_0xe8c9db[_0x7125('0x52')]);return _0x4f298a[_0x7125('0xbd')](_0x3b81c3);}})[_0x7125('0x21')](function(_0xeda504){if(_0xeda504){_0x198cc1=_0xeda504[_0x7125('0x49')];if(!_0xe8c9db[_0x7125('0x43')]['hasOwnProperty'](_0x7125('0x4b'))){_0x3b81c3[_0x7125('0x2c')]=qs['limit'](_0xe8c9db[_0x7125('0x43')][_0x7125('0x2c')]);_0x3b81c3[_0x7125('0x2b')]=qs['offset'](_0xe8c9db[_0x7125('0x43')]['offset']);}return _0x4f298a[_0x7125('0xbd')](_0x3b81c3);}})[_0x7125('0x21')](function(_0x3ee45d){if(_0x3ee45d){return _0x3ee45d?{'count':_0x198cc1,'rows':_0x3ee45d}:null;}})[_0x7125('0x21')](respondWithResult(_0x3c7fc4,null))['catch'](handleError(_0x3c7fc4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3854bd6..3f1d4b8 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 _0x659a=['setMaxListeners','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x659a,0x1df));var _0xa659=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x659a[_0x2ab76b];return _0x201126;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xa659('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa659('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa659('0x2')};function emitEvent(_0x445608){return function(_0x169eb4,_0x5a3186,_0x2eeb1d){MailAccountEvents[_0xa659('0x3')](_0x445608+':'+_0x169eb4['id'],_0x169eb4);MailAccountEvents[_0xa659('0x3')](_0x445608,_0x169eb4);_0x2eeb1d(null);};}for(var e in events){if(events[_0xa659('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xa659('0x5')]=MailAccountEvents; \ No newline at end of file +var _0xf28b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf28b,0x1f4));var _0xbf28=function(_0x4dde18,_0x931f57){_0x4dde18=_0x4dde18-0x0;var _0x4fd6f2=_0xf28b[_0x4dde18];return _0x4fd6f2;};'use strict';var EventEmitter=require(_0xbf28('0x0'));var MailAccount=require(_0xbf28('0x1'))['db'][_0xbf28('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xbf28('0x3')](0x0);var events={'afterCreate':_0xbf28('0x4'),'afterUpdate':_0xbf28('0x5'),'afterDestroy':_0xbf28('0x6')};function emitEvent(_0x5e4d8d){return function(_0x447efd,_0x480d5b,_0x52a1ad){MailAccountEvents[_0xbf28('0x7')](_0x5e4d8d+':'+_0x447efd['id'],_0x447efd);MailAccountEvents[_0xbf28('0x7')](_0x5e4d8d,_0x447efd);_0x52a1ad(null);};}for(var e in events){if(events[_0xbf28('0x8')](e)){var event=events[e];MailAccount[_0xbf28('0x9')](e,emitEvent(event));}}module[_0xbf28('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1ccd31a..149319c 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 _0x441c=['../../config/logger','moment','request-promise','../../config/environment','exports'];(function(_0x5b44c6,_0x86d79f){var _0x20c5c6=function(_0x8bb1f8){while(--_0x8bb1f8){_0x5b44c6['push'](_0x5b44c6['shift']());}};_0x20c5c6(++_0x86d79f);}(_0x441c,0x14f));var _0xc441=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x441c[_0x903228];return _0xcec81d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc441('0x0'))('api');var moment=require(_0xc441('0x1'));var BPromise=require('bluebird');var rp=require(_0xc441('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc441('0x3'));var attributes=require('./mailAccount.attributes');module[_0xc441('0x4')]=function(_0x49a93d,_0x18c390){return _0x49a93d['define']('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef17=['define','MailAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef17,0x1be));var _0x7ef1=function(_0x219cff,_0x8204ba){_0x219cff=_0x219cff-0x0;var _0x62b70=_0xef17[_0x219cff];return _0x62b70;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))('api');var moment=require(_0x7ef1('0x3'));var BPromise=require(_0x7ef1('0x4'));var rp=require(_0x7ef1('0x5'));var fs=require('fs');var path=require(_0x7ef1('0x6'));var rimraf=require(_0x7ef1('0x7'));var config=require(_0x7ef1('0x8'));var attributes=require('./mailAccount.attributes');module[_0x7ef1('0x9')]=function(_0x59b413,_0x1f8634){return _0x59b413[_0x7ef1('0xa')](_0x7ef1('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 951aab2..94515ac 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 _0xfb30=['asc','account','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','get','created','bcc','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','MailApplication','Applications','MailServerOut','omit','applications','priority'];(function(_0x455bbf,_0x487eb1){var _0x31cc6a=function(_0x510dd8){while(--_0x510dd8){_0x455bbf['push'](_0x455bbf['shift']());}};_0x31cc6a(++_0x487eb1);}(_0xfb30,0x88));var _0x0fb3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb30[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0fb3('0x0'));var util=require(_0x0fb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fb3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fb3('0x3'))['db'];var utils=require(_0x0fb3('0x4'));var logger=require(_0x0fb3('0x5'))(_0x0fb3('0x6'));var config=require(_0x0fb3('0x7'));var jayson=require(_0x0fb3('0x8'));var client=jayson[_0x0fb3('0x9')][_0x0fb3('0xa')]({'port':0x232c});config[_0x0fb3('0xb')]=_[_0x0fb3('0xc')](config[_0x0fb3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fb3('0xd'))(new Redis(config['redis']));require(_0x0fb3('0xe'))[_0x0fb3('0xf')](socket);function respondWithRpcPromise(_0x3b5f43,_0x3e89c0,_0x30ad73){return new BPromise(function(_0x5d58f3,_0x5db95f){return client[_0x0fb3('0x10')](_0x3b5f43,_0x30ad73)[_0x0fb3('0x11')](function(_0x182943){logger[_0x0fb3('0x12')]('MailAccount,\x20%s,\x20%s',_0x3e89c0,_0x0fb3('0x13'));logger[_0x0fb3('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3e89c0,_0x0fb3('0x13'),JSON[_0x0fb3('0x15')](_0x182943));if(_0x182943[_0x0fb3('0x16')]){if(_0x182943[_0x0fb3('0x16')][_0x0fb3('0x17')]===0x1f4){logger[_0x0fb3('0x16')](_0x0fb3('0x18'),_0x3e89c0,_0x182943[_0x0fb3('0x16')]['message']);return _0x5db95f(_0x182943[_0x0fb3('0x16')][_0x0fb3('0x19')]);}logger[_0x0fb3('0x16')](_0x0fb3('0x18'),_0x3e89c0,_0x182943[_0x0fb3('0x16')][_0x0fb3('0x19')]);return _0x5d58f3(_0x182943[_0x0fb3('0x16')][_0x0fb3('0x19')]);}else{logger['info'](_0x0fb3('0x18'),_0x3e89c0,'request\x20sent');_0x5d58f3(_0x182943['result']['message']);}})[_0x0fb3('0x1a')](function(_0x398678){logger[_0x0fb3('0x16')]('MailAccount,\x20%s,\x20%s',_0x3e89c0,_0x398678);_0x5db95f(_0x398678);});});}exports[_0x0fb3('0x1b')]=function(_0x1f7f32){var _0x9fb63d=this;return new Promise(function(_0x230a44,_0x40ddf6){return db[_0x0fb3('0x1c')][_0x0fb3('0x1d')]({'raw':_0x1f7f32['options']?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x20')]||null:null,'attributes':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32['options'][_0x0fb3('0x21')]||null:null,'limit':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x22')]||null:null,'include':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x23')]?_[_0x0fb3('0x24')](_0x1f7f32[_0x0fb3('0x1e')]['include'],function(_0x20b79e){return{'model':db[_0x20b79e['model']],'as':_0x20b79e['as'],'attributes':_0x20b79e[_0x0fb3('0x21')],'include':_0x20b79e['include']?_[_0x0fb3('0x24')](_0x20b79e[_0x0fb3('0x23')],function(_0xa3db94){return{'model':db[_0xa3db94[_0x0fb3('0x25')]],'as':_0xa3db94['as'],'attributes':_0xa3db94['attributes'],'include':_0xa3db94['include']?_[_0x0fb3('0x24')](_0xa3db94['include'],function(_0xbf2629){return{'model':db[_0xbf2629[_0x0fb3('0x25')]],'as':_0xbf2629['as'],'attributes':_0xbf2629[_0x0fb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fb3('0x11')](function(_0x2708ef){logger[_0x0fb3('0x12')](_0x0fb3('0x1b'),_0x1f7f32);logger[_0x0fb3('0x14')](_0x0fb3('0x1b'),_0x1f7f32,JSON[_0x0fb3('0x15')](_0x2708ef));_0x230a44(_0x2708ef);})[_0x0fb3('0x1a')](function(_0x1f4032){logger[_0x0fb3('0x16')](_0x0fb3('0x1b'),_0x1f4032[_0x0fb3('0x19')],_0x1f7f32);_0x40ddf6(_0x9fb63d[_0x0fb3('0x16')](0x1f4,_0x1f4032[_0x0fb3('0x19')]));});});};exports[_0x0fb3('0x26')]=function(_0xf7817c){var _0x48ce1b=this;return new Promise(function(_0x1507ef,_0x3391e7){return db['MailAccount'][_0x0fb3('0x27')]({'raw':_0xf7817c[_0x0fb3('0x1e')]?_0xf7817c['options'][_0x0fb3('0x1f')]===undefined?!![]:![]:!![],'where':_0xf7817c['options']?_0xf7817c[_0x0fb3('0x1e')][_0x0fb3('0x20')]||null:null,'attributes':_0xf7817c['options']?_0xf7817c[_0x0fb3('0x1e')][_0x0fb3('0x21')]||null:null,'include':_0xf7817c['options']?_0xf7817c[_0x0fb3('0x1e')]['include']?_[_0x0fb3('0x24')](_0xf7817c[_0x0fb3('0x1e')][_0x0fb3('0x23')],function(_0x3bfac2){return{'model':db[_0x3bfac2[_0x0fb3('0x25')]],'as':_0x3bfac2['as'],'attributes':_0x3bfac2[_0x0fb3('0x21')],'include':_0x3bfac2[_0x0fb3('0x23')]?_['map'](_0x3bfac2[_0x0fb3('0x23')],function(_0xa9a764){return{'model':db[_0xa9a764[_0x0fb3('0x25')]],'as':_0xa9a764['as'],'attributes':_0xa9a764[_0x0fb3('0x21')],'include':_0xa9a764[_0x0fb3('0x23')]?_[_0x0fb3('0x24')](_0xa9a764[_0x0fb3('0x23')],function(_0x54b86a){return{'model':db[_0x54b86a[_0x0fb3('0x25')]],'as':_0x54b86a['as'],'attributes':_0x54b86a[_0x0fb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fb3('0x11')](function(_0x44c46b){logger['info'](_0x0fb3('0x26'),_0xf7817c);logger['debug'](_0x0fb3('0x26'),_0xf7817c,JSON['stringify'](_0x44c46b));_0x1507ef(_0x44c46b);})[_0x0fb3('0x1a')](function(_0x247d39){logger[_0x0fb3('0x16')](_0x0fb3('0x26'),_0x247d39['message'],_0xf7817c);_0x3391e7(_0x48ce1b[_0x0fb3('0x16')](0x1f4,_0x247d39[_0x0fb3('0x19')]));});});};exports[_0x0fb3('0x28')]=function(_0x10ea57){var _0x219997=this;return new Promise(function(_0x20e4c3,_0xbcb722){var _0x11f44b={'body':_0x10ea57[_0x0fb3('0x29')],'channel':_0x0fb3('0x2a')};var _0x19a98d=_['difference'](_[_0x0fb3('0x2b')](db[_0x0fb3('0x2c')][_0x0fb3('0x2d')]),['createdAt',_0x0fb3('0x2e'),_0x0fb3('0x2f'),_0x0fb3('0x30')]);var _0x19384f=![];if(_0x10ea57[_0x0fb3('0x29')]['id']){delete _0x10ea57['body']['id'];}if(_[_0x0fb3('0x31')](_0x10ea57['body'][_0x0fb3('0x32')])){return _0xbcb722(_0x219997['error'](0x1f4,_0x0fb3('0x33')));}if(_[_0x0fb3('0x31')](_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x29')])||_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x29')]===''){return _0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,_0x0fb3('0x34')));}if(_[_0x0fb3('0x31')](_0x10ea57[_0x0fb3('0x29')]['mapKey'])){return _0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19a98d));}if(!_[_0x0fb3('0x35')](_0x19a98d,_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x36')])){return _0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,_0x0fb3('0x37')+_0x19a98d));}var _0x35eacb={};_0x35eacb[_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x36')]]=_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x32')];return db[_0x0fb3('0x1c')][_0x0fb3('0x27')]({'where':{'id':_0x10ea57['account']['id']},'include':[{'model':db[_0x0fb3('0x38')],'as':_0x0fb3('0x39'),'include':[{'model':db[_0x0fb3('0x2c')],'as':'Contacts','where':_0x35eacb,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x0fb3('0x3a')],'as':_0x0fb3('0x3b')},{'model':db[_0x0fb3('0x3c')],'as':'Smtp'}]})[_0x0fb3('0x11')](function(_0x9c5837){if(_0x9c5837&&_0x9c5837[_0x0fb3('0x39')]){var _0x4c6153=_0x9c5837['get']({'plain':!![]});_0x11f44b['account']=_[_0x0fb3('0x3d')](_0x4c6153,[_0x0fb3('0x3b'),_0x0fb3('0x39')]);_0x11f44b[_0x0fb3('0x3e')]=_0x4c6153[_0x0fb3('0x3b')];_0x11f44b['list']=_0x4c6153[_0x0fb3('0x39')];_0x11f44b[_0x0fb3('0x3e')]=_['orderBy'](_0x11f44b[_0x0fb3('0x3e')],[_0x0fb3('0x3f')],[_0x0fb3('0x40')]);if(_0x11f44b[_0x0fb3('0x41')]&&_0x11f44b[_0x0fb3('0x41')][_0x0fb3('0x42')]){_0x11f44b[_0x0fb3('0x3e')][_0x0fb3('0x43')]({'id':0x0,'priority':_0x11f44b[_0x0fb3('0x3e')][_0x0fb3('0x44')]+0x1,'app':_0x0fb3('0x45'),'appdata':_0x0fb3('0x42'),'interval':_0x0fb3('0x46')});}if(_0x11f44b[_0x0fb3('0x41')]['Applications']){delete _0x11f44b[_0x0fb3('0x41')][_0x0fb3('0x3b')];}if(_0x11f44b[_0x0fb3('0x41')]['List']){delete _0x11f44b[_0x0fb3('0x41')]['List'];}if(_0x4c6153[_0x0fb3('0x39')][_0x0fb3('0x47')][_0x0fb3('0x44')]){return _0x4c6153[_0x0fb3('0x39')][_0x0fb3('0x47')][0x0];}var _0x394e6b=_[_0x0fb3('0xc')](_0x10ea57[_0x0fb3('0x29')],{'firstName':_0x10ea57[_0x0fb3('0x29')]['from'],'ListId':_0x4c6153['ListId']});_0x394e6b[_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x36')]]=_0x10ea57['body'][_0x0fb3('0x32')];return db['CmContact'][_0x0fb3('0x48')](_0x394e6b);}else{throw new Error(_0x0fb3('0x49'));}})['then'](function(_0x36f24f){_0x11f44b[_0x0fb3('0x4a')]=_0x36f24f;if(_0x36f24f){if(!_0x10ea57[_0x0fb3('0x29')]['message'][_0x0fb3('0x4b')]){_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4b')]=rs['generate']()+'\x20'+_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x32')];}var _0x3c4e89={'ContactId':_0x36f24f['id'],'MailAccountId':_0x10ea57[_0x0fb3('0x41')]['id'],'inReplyTo':_0x10ea57[_0x0fb3('0x29')]['message'][_0x0fb3('0x4b')],'to':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x32')],'cc':_0x10ea57[_0x0fb3('0x29')]['message']['cc'],'subject':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4c')],'attach':_0x10ea57[_0x0fb3('0x29')]['message'][_0x0fb3('0x4d')],'lastMsgAt':moment()[_0x0fb3('0x4e')](_0x0fb3('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x29')]};return db['MailInteraction'][_0x0fb3('0x27')]({'where':{'closed':![],'MailAccountId':_0x10ea57[_0x0fb3('0x41')]['id']},'include':[{'model':db[_0x0fb3('0x50')],'as':_0x0fb3('0x51'),'attributes':[_0x0fb3('0x4b')],'where':{'messageId':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x52')]}}]})[_0x0fb3('0x11')](function(_0x4b3d39){if(_0x4b3d39){return[_0x4b3d39,![]];}return db[_0x0fb3('0x53')][_0x0fb3('0x48')](_0x3c4e89)[_0x0fb3('0x11')](function(_0x952ed2){return[_0x952ed2,!![]];});});}else{throw new Error(_0x0fb3('0x54'));}})[_0x0fb3('0x55')](function(_0xa3713f,_0x592e98){if(_0xa3713f){_0x19384f=_0x592e98;if(!_0x592e98){return _0xa3713f[_0x0fb3('0x56')]({'inReplyTo':_0x10ea57['body']['message'][_0x0fb3('0x4b')],'to':_0x10ea57['body']['message'][_0x0fb3('0x32')],'cc':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['cc'],'subject':_0x10ea57['body'][_0x0fb3('0x19')][_0x0fb3('0x4c')],'attach':_0xa3713f[_0x0fb3('0x4d')]?_0xa3713f[_0x0fb3('0x4d')]:_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4d')],'substatus':null,'substatusAt':moment()[_0x0fb3('0x4e')](_0x0fb3('0x4f')),'lastMsgAt':moment()['format'](_0x0fb3('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x10ea57[_0x0fb3('0x29')]['body']});}else{return _0xa3713f;}}})['then'](function(_0x4e4e73){_0x11f44b[_0x0fb3('0x57')]=_0x4e4e73[_0x0fb3('0x58')]({'plain':!![]});_0x11f44b[_0x0fb3('0x57')][_0x0fb3('0x59')]=_0x19384f;return db['MailMessage'][_0x0fb3('0x48')]({'body':_0x10ea57['body'][_0x0fb3('0x29')],'MailAccountId':_0x10ea57[_0x0fb3('0x41')]['id'],'MailInteractionId':_0x4e4e73['id'],'direction':'in','ContactId':_0x11f44b[_0x0fb3('0x4a')]['id'],'messageId':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4b')],'from':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x32')],'to':_0x10ea57['body']['message']['to'],'cc':_0x10ea57['body'][_0x0fb3('0x19')]['cc'],'subject':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4c')],'attach':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4d')],'Attachments':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['attachments'],'originTo':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['originTo'],'originCc':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['originCc'],'bcc':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x5a')]},{'include':[{'model':db[_0x0fb3('0x5b')],'as':_0x0fb3('0x5c')}]});})[_0x0fb3('0x11')](function(_0x5cf0e8){_0x11f44b[_0x0fb3('0x19')]=_0x5cf0e8;if(_0x11f44b[_0x0fb3('0x57')][_0x0fb3('0x5d')]){return db[_0x0fb3('0x5e')][_0x0fb3('0x27')]({'attributes':['id',_0x0fb3('0x5f')],'where':{'id':_0x11f44b[_0x0fb3('0x57')][_0x0fb3('0x5d')]}})[_0x0fb3('0x11')](function(_0x250a8c){if(_0x250a8c){_0x11f44b['applications'][_0x0fb3('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x250a8c['name']+','+(_0x11f44b[_0x0fb3('0x41')][_0x0fb3('0x61')]||0xa),'interval':_0x0fb3('0x46')});}return respondWithRpcPromise(_0x0fb3('0x62'),_0x0fb3('0x63'),_0x11f44b);});}return respondWithRpcPromise(_0x0fb3('0x62'),_0x0fb3('0x63'),_0x11f44b);})['then'](function(_0x1043d5){_0x20e4c3(_0x1043d5);})['catch'](function(_0x4f9907){_0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,_0x4f9907[_0x0fb3('0x19')]));});});}; \ No newline at end of file +var _0x3b59=['updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','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','account','CmList','CmContact','MailApplication','Applications','MailServerOut','Smtp','List','get','omit','applications','orderBy','asc','length','close','autoclose','*,*,*,*','Contacts','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','create','update','attach','interaction','created','subject','originTo','bcc','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','find','ShowMailAccount','NotifyMailAccount','mail','difference','keys','rawAttributes','createdAt'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x3b59,0x9c));var _0x93b5=function(_0x33c8ef,_0x5c5f9b){_0x33c8ef=_0x33c8ef-0x0;var _0x3cb4d1=_0x3b59[_0x33c8ef];return _0x3cb4d1;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var Redis=require(_0x93b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93b5('0x6'));var logger=require('../../config/logger')(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var jayson=require(_0x93b5('0x9'));var client=jayson[_0x93b5('0xa')]['http']({'port':0x232c});config[_0x93b5('0xb')]=_[_0x93b5('0xc')](config[_0x93b5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x93b5('0xd'))(new Redis(config[_0x93b5('0xb')]));require(_0x93b5('0xe'))[_0x93b5('0xf')](socket);function respondWithRpcPromise(_0x2a49bb,_0x490b0d,_0x576916){return new BPromise(function(_0x13ebc9,_0x7787e5){return client[_0x93b5('0x10')](_0x2a49bb,_0x576916)[_0x93b5('0x11')](function(_0x47c236){logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');logger[_0x93b5('0x14')](_0x93b5('0x15'),_0x490b0d,_0x93b5('0x16'),JSON[_0x93b5('0x17')](_0x47c236));if(_0x47c236[_0x93b5('0x18')]){if(_0x47c236['error'][_0x93b5('0x19')]===0x1f4){logger[_0x93b5('0x18')]('MailAccount,\x20%s,\x20%s',_0x490b0d,_0x47c236[_0x93b5('0x18')][_0x93b5('0x1a')]);return _0x7787e5(_0x47c236[_0x93b5('0x18')]['message']);}logger[_0x93b5('0x18')]('MailAccount,\x20%s,\x20%s',_0x490b0d,_0x47c236['error'][_0x93b5('0x1a')]);return _0x13ebc9(_0x47c236['error'][_0x93b5('0x1a')]);}else{logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');_0x13ebc9(_0x47c236['result']['message']);}})[_0x93b5('0x1b')](function(_0x28f5cc){logger[_0x93b5('0x18')](_0x93b5('0x13'),_0x490b0d,_0x28f5cc);_0x7787e5(_0x28f5cc);});});}exports[_0x93b5('0x1c')]=function(_0x1f0196){var _0x2dd622=this;return new Promise(function(_0x2bd21b,_0x352cbe){return db[_0x93b5('0x1d')]['findAll']({'raw':_0x1f0196['options']?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f0196['options']?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x20')]||null:null,'attributes':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x21')]||null:null,'limit':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x22')]||null:null,'include':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x23')]?_[_0x93b5('0x24')](_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x23')],function(_0x3494f){return{'model':db[_0x3494f[_0x93b5('0x25')]],'as':_0x3494f['as'],'attributes':_0x3494f[_0x93b5('0x21')],'include':_0x3494f[_0x93b5('0x23')]?_['map'](_0x3494f[_0x93b5('0x23')],function(_0x2ed60b){return{'model':db[_0x2ed60b[_0x93b5('0x25')]],'as':_0x2ed60b['as'],'attributes':_0x2ed60b[_0x93b5('0x21')],'include':_0x2ed60b[_0x93b5('0x23')]?_[_0x93b5('0x24')](_0x2ed60b[_0x93b5('0x23')],function(_0x2905a8){return{'model':db[_0x2905a8['model']],'as':_0x2905a8['as'],'attributes':_0x2905a8[_0x93b5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x93b5('0x11')](function(_0x54bc50){logger[_0x93b5('0x12')]('GetMailAccount',_0x1f0196);logger[_0x93b5('0x14')](_0x93b5('0x1c'),_0x1f0196,JSON[_0x93b5('0x17')](_0x54bc50));_0x2bd21b(_0x54bc50);})[_0x93b5('0x1b')](function(_0x207b04){logger[_0x93b5('0x18')](_0x93b5('0x1c'),_0x207b04[_0x93b5('0x1a')],_0x1f0196);_0x352cbe(_0x2dd622[_0x93b5('0x18')](0x1f4,_0x207b04[_0x93b5('0x1a')]));});});};exports['ShowMailAccount']=function(_0x5c2c92){var _0x4e1818=this;return new Promise(function(_0x50614b,_0x4b9421){return db['MailAccount'][_0x93b5('0x26')]({'raw':_0x5c2c92[_0x93b5('0x1e')]?_0x5c2c92[_0x93b5('0x1e')][_0x93b5('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c2c92[_0x93b5('0x1e')]?_0x5c2c92[_0x93b5('0x1e')][_0x93b5('0x20')]||null:null,'attributes':_0x5c2c92[_0x93b5('0x1e')]?_0x5c2c92[_0x93b5('0x1e')][_0x93b5('0x21')]||null:null,'include':_0x5c2c92[_0x93b5('0x1e')]?_0x5c2c92['options']['include']?_[_0x93b5('0x24')](_0x5c2c92[_0x93b5('0x1e')][_0x93b5('0x23')],function(_0x382ccf){return{'model':db[_0x382ccf[_0x93b5('0x25')]],'as':_0x382ccf['as'],'attributes':_0x382ccf[_0x93b5('0x21')],'include':_0x382ccf['include']?_['map'](_0x382ccf['include'],function(_0x59081b){return{'model':db[_0x59081b['model']],'as':_0x59081b['as'],'attributes':_0x59081b[_0x93b5('0x21')],'include':_0x59081b[_0x93b5('0x23')]?_[_0x93b5('0x24')](_0x59081b[_0x93b5('0x23')],function(_0x34896a){return{'model':db[_0x34896a[_0x93b5('0x25')]],'as':_0x34896a['as'],'attributes':_0x34896a[_0x93b5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x93b5('0x11')](function(_0x1f71dc){logger[_0x93b5('0x12')]('ShowMailAccount',_0x5c2c92);logger['debug']('ShowMailAccount',_0x5c2c92,JSON[_0x93b5('0x17')](_0x1f71dc));_0x50614b(_0x1f71dc);})[_0x93b5('0x1b')](function(_0x1a6d5b){logger[_0x93b5('0x18')](_0x93b5('0x27'),_0x1a6d5b[_0x93b5('0x1a')],_0x5c2c92);_0x4b9421(_0x4e1818['error'](0x1f4,_0x1a6d5b[_0x93b5('0x1a')]));});});};exports[_0x93b5('0x28')]=function(_0x392005){var _0x5d5134=this;return new Promise(function(_0x1cf514,_0x426403){var _0x4a99e8={'body':_0x392005['body'],'channel':_0x93b5('0x29')};var _0x2d50b3=_[_0x93b5('0x2a')](_[_0x93b5('0x2b')](db['CmContact'][_0x93b5('0x2c')]),[_0x93b5('0x2d'),_0x93b5('0x2e'),_0x93b5('0x2f'),_0x93b5('0x30')]);var _0x43b068=![];if(_0x392005[_0x93b5('0x31')]['id']){delete _0x392005[_0x93b5('0x31')]['id'];}if(_['isNil'](_0x392005['body'][_0x93b5('0x32')])){return _0x426403(_0x5d5134[_0x93b5('0x18')](0x1f4,_0x93b5('0x33')));}if(_[_0x93b5('0x34')](_0x392005[_0x93b5('0x31')][_0x93b5('0x31')])||_0x392005[_0x93b5('0x31')][_0x93b5('0x31')]===''){return _0x426403(_0x5d5134[_0x93b5('0x18')](0x1f4,_0x93b5('0x35')));}if(_['isNil'](_0x392005[_0x93b5('0x31')]['mapKey'])){return _0x426403(_0x5d5134[_0x93b5('0x18')](0x1f4,_0x93b5('0x36')+_0x2d50b3));}if(!_[_0x93b5('0x37')](_0x2d50b3,_0x392005['body'][_0x93b5('0x38')])){return _0x426403(_0x5d5134[_0x93b5('0x18')](0x1f4,_0x93b5('0x39')+_0x2d50b3));}var _0x47024f={};_0x47024f[_0x392005[_0x93b5('0x31')][_0x93b5('0x38')]]=_0x392005[_0x93b5('0x31')]['from'];return db[_0x93b5('0x1d')][_0x93b5('0x26')]({'where':{'id':_0x392005[_0x93b5('0x3a')]['id']},'include':[{'model':db[_0x93b5('0x3b')],'as':'List','include':[{'model':db[_0x93b5('0x3c')],'as':'Contacts','where':_0x47024f,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x93b5('0x3d')],'as':_0x93b5('0x3e')},{'model':db[_0x93b5('0x3f')],'as':_0x93b5('0x40')}]})[_0x93b5('0x11')](function(_0x22c0fb){if(_0x22c0fb&&_0x22c0fb[_0x93b5('0x41')]){var _0x565e00=_0x22c0fb[_0x93b5('0x42')]({'plain':!![]});_0x4a99e8[_0x93b5('0x3a')]=_[_0x93b5('0x43')](_0x565e00,['Applications',_0x93b5('0x41')]);_0x4a99e8[_0x93b5('0x44')]=_0x565e00[_0x93b5('0x3e')];_0x4a99e8['list']=_0x565e00['List'];_0x4a99e8['applications']=_[_0x93b5('0x45')](_0x4a99e8['applications'],['priority'],[_0x93b5('0x46')]);if(_0x4a99e8['account']&&_0x4a99e8[_0x93b5('0x3a')]['autoclose']){_0x4a99e8[_0x93b5('0x44')]['push']({'id':0x0,'priority':_0x4a99e8['applications'][_0x93b5('0x47')]+0x1,'app':_0x93b5('0x48'),'appdata':_0x93b5('0x49'),'interval':_0x93b5('0x4a')});}if(_0x4a99e8[_0x93b5('0x3a')]['Applications']){delete _0x4a99e8['account']['Applications'];}if(_0x4a99e8[_0x93b5('0x3a')][_0x93b5('0x41')]){delete _0x4a99e8[_0x93b5('0x3a')][_0x93b5('0x41')];}if(_0x565e00['List']['Contacts'][_0x93b5('0x47')]){return _0x565e00['List'][_0x93b5('0x4b')][0x0];}var _0x3a18e6=_[_0x93b5('0xc')](_0x392005['body'],{'firstName':_0x392005[_0x93b5('0x31')]['from'],'ListId':_0x565e00[_0x93b5('0x30')]});_0x3a18e6[_0x392005[_0x93b5('0x31')][_0x93b5('0x38')]]=_0x392005[_0x93b5('0x31')][_0x93b5('0x32')];return db['CmContact']['create'](_0x3a18e6);}else{throw new Error(_0x93b5('0x4c'));}})['then'](function(_0x48f796){_0x4a99e8[_0x93b5('0x4d')]=_0x48f796;if(_0x48f796){if(!_0x392005[_0x93b5('0x31')]['message'][_0x93b5('0x4e')]){_0x392005['body'][_0x93b5('0x1a')]['messageId']=rs[_0x93b5('0x4f')]()+'\x20'+_0x392005['body'][_0x93b5('0x1a')][_0x93b5('0x32')];}var _0x563fc5={'ContactId':_0x48f796['id'],'MailAccountId':_0x392005['account']['id'],'inReplyTo':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')][_0x93b5('0x4e')],'to':_0x392005['body'][_0x93b5('0x1a')][_0x93b5('0x32')],'cc':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['cc'],'subject':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['subject'],'attach':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['attach'],'lastMsgAt':moment()[_0x93b5('0x50')](_0x93b5('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x392005[_0x93b5('0x31')][_0x93b5('0x31')]};return db[_0x93b5('0x52')][_0x93b5('0x26')]({'where':{'closed':![],'MailAccountId':_0x392005[_0x93b5('0x3a')]['id']},'include':[{'model':db[_0x93b5('0x53')],'as':_0x93b5('0x54'),'attributes':[_0x93b5('0x4e')],'where':{'messageId':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['inReplyTo']}}]})[_0x93b5('0x11')](function(_0x4ccde1){if(_0x4ccde1){return[_0x4ccde1,![]];}return db[_0x93b5('0x52')][_0x93b5('0x55')](_0x563fc5)[_0x93b5('0x11')](function(_0x356d31){return[_0x356d31,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x319a37,_0x3ae9ba){if(_0x319a37){_0x43b068=_0x3ae9ba;if(!_0x3ae9ba){return _0x319a37[_0x93b5('0x56')]({'inReplyTo':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')][_0x93b5('0x4e')],'to':_0x392005[_0x93b5('0x31')]['message'][_0x93b5('0x32')],'cc':_0x392005['body'][_0x93b5('0x1a')]['cc'],'subject':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['subject'],'attach':_0x319a37[_0x93b5('0x57')]?_0x319a37[_0x93b5('0x57')]:_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x93b5('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x93b5('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x392005[_0x93b5('0x31')][_0x93b5('0x31')]});}else{return _0x319a37;}}})[_0x93b5('0x11')](function(_0x4880d3){_0x4a99e8[_0x93b5('0x58')]=_0x4880d3['get']({'plain':!![]});_0x4a99e8['interaction'][_0x93b5('0x59')]=_0x43b068;return db[_0x93b5('0x53')]['create']({'body':_0x392005[_0x93b5('0x31')]['body'],'MailAccountId':_0x392005[_0x93b5('0x3a')]['id'],'MailInteractionId':_0x4880d3['id'],'direction':'in','ContactId':_0x4a99e8['contact']['id'],'messageId':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['messageId'],'from':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')][_0x93b5('0x32')],'to':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['to'],'cc':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['cc'],'subject':_0x392005['body'][_0x93b5('0x1a')][_0x93b5('0x5a')],'attach':_0x392005[_0x93b5('0x31')]['message'][_0x93b5('0x57')],'Attachments':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['attachments'],'originTo':_0x392005['body'][_0x93b5('0x1a')][_0x93b5('0x5b')],'originCc':_0x392005[_0x93b5('0x31')][_0x93b5('0x1a')]['originCc'],'bcc':_0x392005[_0x93b5('0x31')]['message'][_0x93b5('0x5c')]},{'include':[{'model':db[_0x93b5('0x5d')],'as':'Attachments'}]});})[_0x93b5('0x11')](function(_0x4acd54){_0x4a99e8[_0x93b5('0x1a')]=_0x4acd54;if(_0x4a99e8['interaction'][_0x93b5('0x5e')]){return db[_0x93b5('0x5f')]['find']({'attributes':['id',_0x93b5('0x60')],'where':{'id':_0x4a99e8['interaction'][_0x93b5('0x5e')]}})[_0x93b5('0x11')](function(_0x2b36af){if(_0x2b36af){_0x4a99e8[_0x93b5('0x44')][_0x93b5('0x61')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b36af['name']+','+(_0x4a99e8[_0x93b5('0x3a')][_0x93b5('0x62')]||0xa),'interval':_0x93b5('0x4a')});}return respondWithRpcPromise(_0x93b5('0x63'),_0x93b5('0x64'),_0x4a99e8);});}return respondWithRpcPromise(_0x93b5('0x63'),_0x93b5('0x64'),_0x4a99e8);})[_0x93b5('0x11')](function(_0xbde0e8){_0x1cf514(_0xbde0e8);})[_0x93b5('0x1b')](function(_0x50ce80){_0x426403(_0x5d5134['error'](0x1f4,_0x50ce80[_0x93b5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 241d6b7..7ec8813 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 _0xb194=['remove','update','register','length','./mailAccount.events'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb194,0x1b2));var _0x4b19=function(_0x14afeb,_0x1d2903){_0x14afeb=_0x14afeb-0x0;var _0x7c708a=_0xb194[_0x14afeb];return _0x7c708a;};'use strict';var MailAccountEvents=require(_0x4b19('0x0'));var events=['save',_0x4b19('0x1'),_0x4b19('0x2')];function createListener(_0x10bd69,_0x2e77f6){return function(_0x3ba6e4){_0x2e77f6['emit'](_0x10bd69,_0x3ba6e4);};}function removeListener(_0x46faa3,_0x3a4700){return function(){MailAccountEvents['removeListener'](_0x46faa3,_0x3a4700);};}exports[_0x4b19('0x3')]=function(_0x570374){for(var _0x22033b=0x0,_0x5070da=events[_0x4b19('0x4')];_0x22033b<_0x5070da;_0x22033b++){var _0x3fb52e=events[_0x22033b];var _0x1dae50=createListener('mailAccount:'+_0x3fb52e,_0x570374);MailAccountEvents['on'](_0x3fb52e,_0x1dae50);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./mailAccount.events','save'];(function(_0x49bfdc,_0x4fe364){var _0x34f254=function(_0x471e3c){while(--_0x471e3c){_0x49bfdc['push'](_0x49bfdc['shift']());}};_0x34f254(++_0x4fe364);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var MailAccountEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){MailAccountEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('mailAccount:'+_0x10525b,_0x215f39);MailAccountEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a15d254..5eea0d4 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 _0x0fd9=['./mailApplication.controller','get','/:id','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x28953a,_0x262ebe){var _0x19e2c6=function(_0x426953){while(--_0x426953){_0x28953a['push'](_0x28953a['shift']());}};_0x19e2c6(++_0x262ebe);}(_0x0fd9,0xa3));var _0x90fd=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x0fd9[_0xe1b5f6];return _0x44636e;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x90fd('0x4'));var config=require(_0x90fd('0x5'));var controller=require(_0x90fd('0x6'));router[_0x90fd('0x7')](_0x90fd('0x8'),auth[_0x90fd('0x9')](),controller['show']);router['put'](_0x90fd('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x90fd('0xa')](_0x90fd('0x8'),auth['isAuthenticated'](),controller[_0x90fd('0xb')]);module[_0x90fd('0xc')]=router; \ No newline at end of file +var _0x97c1=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','isAuthenticated','destroy','exports','multer'];(function(_0x2a351b,_0x2f9f7f){var _0x8e3a1=function(_0x2d05a5){while(--_0x2d05a5){_0x2a351b['push'](_0x2a351b['shift']());}};_0x8e3a1(++_0x2f9f7f);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x197c('0x3'));var interaction=require(_0x197c('0x4'));var config=require(_0x197c('0x5'));var controller=require(_0x197c('0x6'));router[_0x197c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router['delete'](_0x197c('0xa'),auth['isAuthenticated'](),controller[_0x197c('0xc')]);module[_0x197c('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 ad8248f..776d440 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 _0xddd0=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5b81a1,_0x43e559){var _0x4f1e10=function(_0x5c7bec){while(--_0x5c7bec){_0x5b81a1['push'](_0x5b81a1['shift']());}};_0x4f1e10(++_0x43e559);}(_0xddd0,0xe0));var _0x0ddd=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xddd0[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0x0ddd('0x0'));module[_0x0ddd('0x1')]={'priority':{'type':Sequelize[_0x0ddd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0ddd('0x3')],'allowNull':![],'defaultValue':_0x0ddd('0x4')},'appdata':{'type':Sequelize[_0x0ddd('0x5')]()},'description':{'type':Sequelize[_0x0ddd('0x3')]},'interval':{'type':Sequelize[_0x0ddd('0x3')],'defaultValue':_0x0ddd('0x6')}}; \ No newline at end of file +var _0x007d=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4dde74,_0x47dd94){var _0x5cecae=function(_0x17b5e1){while(--_0x17b5e1){_0x4dde74['push'](_0x4dde74['shift']());}};_0x5cecae(++_0x47dd94);}(_0x007d,0x7e));var _0xd007=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x007d[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xd007('0x0'));module[_0xd007('0x1')]={'priority':{'type':Sequelize[_0xd007('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd007('0x3')],'allowNull':![],'defaultValue':_0xd007('0x4')},'appdata':{'type':Sequelize[_0xd007('0x5')]()},'description':{'type':Sequelize[_0xd007('0x3')]},'interval':{'type':Sequelize[_0xd007('0x3')],'defaultValue':_0xd007('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 82967dd..7885c59 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 _0xcda0=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','find','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x390df7,_0x430611){var _0xac2128=function(_0x313a8a){while(--_0x313a8a){_0x390df7['push'](_0x390df7['shift']());}};_0xac2128(++_0x430611);}(_0xcda0,0x1d8));var _0x0cda=function(_0x59f1dd,_0x5c48d8){_0x59f1dd=_0x59f1dd-0x0;var _0x217ed3=_0xcda0[_0x59f1dd];return _0x217ed3;};'use strict';var pdf=require(_0x0cda('0x0'));var emlformat=require(_0x0cda('0x1'));var rimraf=require(_0x0cda('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cda('0x3'));var rp=require(_0x0cda('0x4'));var moment=require(_0x0cda('0x5'));var BPromise=require(_0x0cda('0x6'));var Mustache=require(_0x0cda('0x7'));var util=require(_0x0cda('0x8'));var path=require(_0x0cda('0x9'));var sox=require(_0x0cda('0xa'));var csv=require(_0x0cda('0xb'));var ejs=require(_0x0cda('0xc'));var fs=require('fs');var _=require(_0x0cda('0xd'));var squel=require(_0x0cda('0xe'));var crypto=require(_0x0cda('0xf'));var jsforce=require(_0x0cda('0x10'));var deskjs=require(_0x0cda('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0cda('0x12'));var Papa=require(_0x0cda('0x13'));var Redis=require('ioredis');var authService=require(_0x0cda('0x14'));var qs=require(_0x0cda('0x15'));var as=require(_0x0cda('0x16'));var hardwareService=require(_0x0cda('0x17'));var logger=require('../../config/logger')(_0x0cda('0x18'));var utils=require(_0x0cda('0x19'));var config=require(_0x0cda('0x1a'));var licenseUtil=require(_0x0cda('0x1b'));var db=require(_0x0cda('0x1c'))['db'];function respondWithStatusCode(_0x39ae19,_0x14dc7c){_0x14dc7c=_0x14dc7c||0xcc;return function(_0x405f0f){if(_0x405f0f){return _0x39ae19[_0x0cda('0x1d')](_0x14dc7c);}return _0x39ae19['status'](_0x14dc7c)[_0x0cda('0x1e')]();};}function respondWithResult(_0x195ac1,_0x452868){_0x452868=_0x452868||0xc8;return function(_0x36b2a3){if(_0x36b2a3){return _0x195ac1[_0x0cda('0x1f')](_0x452868)[_0x0cda('0x20')](_0x36b2a3);}};}function respondWithFilteredResult(_0x45d546,_0xaeb7f0){return function(_0x467412){if(_0x467412){var _0x2357cd=_0x467412[_0x0cda('0x21')],_0x30aebf=_0xaeb7f0[_0x0cda('0x22')],_0xff5a23=_0xaeb7f0[_0x0cda('0x22')]+_0xaeb7f0[_0x0cda('0x23')],_0x1748be;if(_0xff5a23>=_0x2357cd){_0xff5a23=_0x2357cd;_0x1748be=0xc8;}else{_0x1748be=0xce;}_0x45d546[_0x0cda('0x1f')](_0x1748be);return _0x45d546['set'](_0x0cda('0x24'),_0x30aebf+'-'+_0xff5a23+'/'+_0x2357cd)['json'](_0x467412);}return null;};}function patchUpdates(_0x5bb2c1){return function(_0x2c85c1){try{jsonpatch[_0x0cda('0x25')](_0x2c85c1,_0x5bb2c1,!![]);}catch(_0x4f963e){return BPromise[_0x0cda('0x26')](_0x4f963e);}return _0x2c85c1['save']();};}function saveUpdates(_0x2f767f,_0x70b267){return function(_0x391e49){if(_0x391e49){return _0x391e49[_0x0cda('0x27')](_0x2f767f)[_0x0cda('0x28')](function(_0xab530d){return _0xab530d;});}return null;};}function removeEntity(_0xac4ec5,_0x2301ea){return function(_0x3efa24){if(_0x3efa24){return _0x3efa24[_0x0cda('0x29')]()['then'](function(){_0xac4ec5[_0x0cda('0x1f')](0xcc)[_0x0cda('0x1e')]();});}};}function handleEntityNotFound(_0x20ba9f,_0x40d8e7){return function(_0x5a03c0){if(!_0x5a03c0){_0x20ba9f[_0x0cda('0x1d')](0x194);}return _0x5a03c0;};}function handleError(_0x4241fe,_0x53d4a4){_0x53d4a4=_0x53d4a4||0x1f4;return function(_0x98d0f){logger['error'](_0x98d0f[_0x0cda('0x2a')]);if(_0x98d0f[_0x0cda('0x2b')]){delete _0x98d0f[_0x0cda('0x2b')];}_0x4241fe['status'](_0x53d4a4)[_0x0cda('0x2c')](_0x98d0f);};}exports[_0x0cda('0x2d')]=function(_0x4b47e9,_0x177c5a){var _0xa90baa={'raw':!![],'where':{'id':_0x4b47e9[_0x0cda('0x2e')]['id']}},_0x2163da={};_0x2163da[_0x0cda('0x2f')]=_[_0x0cda('0x30')](db[_0x0cda('0x31')][_0x0cda('0x32')]);_0x2163da[_0x0cda('0x33')]=_['keys'](_0x4b47e9[_0x0cda('0x33')]);_0x2163da[_0x0cda('0x34')]=_['intersection'](_0x2163da[_0x0cda('0x2f')],_0x2163da[_0x0cda('0x33')]);_0xa90baa[_0x0cda('0x35')]=_['intersection'](_0x2163da['model'],qs[_0x0cda('0x36')](_0x4b47e9[_0x0cda('0x33')]['fields']));_0xa90baa[_0x0cda('0x35')]=_0xa90baa['attributes'][_0x0cda('0x37')]?_0xa90baa['attributes']:_0x2163da[_0x0cda('0x2f')];if(_0x4b47e9[_0x0cda('0x33')][_0x0cda('0x38')]){_0xa90baa[_0x0cda('0x39')]=[{'all':!![]}];}_0xa90baa=_[_0x0cda('0x3a')]({},_0xa90baa,_0x4b47e9['options']);return db['MailApplication'][_0x0cda('0x3b')](_0xa90baa)[_0x0cda('0x28')](handleEntityNotFound(_0x177c5a,null))[_0x0cda('0x28')](respondWithResult(_0x177c5a,null))['catch'](handleError(_0x177c5a,null));};exports[_0x0cda('0x27')]=function(_0x333bb8,_0x585dd5){if(_0x333bb8[_0x0cda('0x3c')]['id']){delete _0x333bb8[_0x0cda('0x3c')]['id'];}return db[_0x0cda('0x31')][_0x0cda('0x3b')]({'where':{'id':_0x333bb8[_0x0cda('0x2e')]['id']}})[_0x0cda('0x28')](handleEntityNotFound(_0x585dd5,null))[_0x0cda('0x28')](saveUpdates(_0x333bb8[_0x0cda('0x3c')],null))[_0x0cda('0x28')](respondWithResult(_0x585dd5,null))['catch'](handleError(_0x585dd5,null));};exports['destroy']=function(_0x431c0c,_0xb71c6f){return db['MailApplication'][_0x0cda('0x3b')]({'where':{'id':_0x431c0c['params']['id']}})['then'](handleEntityNotFound(_0xb71c6f,null))[_0x0cda('0x28')](removeEntity(_0xb71c6f,null))[_0x0cda('0x3d')](handleError(_0xb71c6f,null));}; \ No newline at end of file +var _0xc001=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3e10ea,_0x327c4f){var _0x48644d=function(_0x2216bf){while(--_0x2216bf){_0x3e10ea['push'](_0x3e10ea['shift']());}};_0x48644d(++_0x327c4f);}(_0xc001,0x15b));var _0x1c00=function(_0x3f8e78,_0x41c641){_0x3f8e78=_0x3f8e78-0x0;var _0x444902=_0xc001[_0x3f8e78];return _0x444902;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1c00('0x0'));var rimraf=require(_0x1c00('0x1'));var zipdir=require(_0x1c00('0x2'));var jsonpatch=require(_0x1c00('0x3'));var rp=require(_0x1c00('0x4'));var moment=require('moment');var BPromise=require(_0x1c00('0x5'));var Mustache=require(_0x1c00('0x6'));var util=require(_0x1c00('0x7'));var path=require(_0x1c00('0x8'));var sox=require(_0x1c00('0x9'));var csv=require(_0x1c00('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c00('0xb'));var squel=require(_0x1c00('0xc'));var crypto=require(_0x1c00('0xd'));var jsforce=require(_0x1c00('0xe'));var deskjs=require(_0x1c00('0xf'));var toCsv=require(_0x1c00('0xa'));var querystring=require('querystring');var Papa=require(_0x1c00('0x10'));var Redis=require(_0x1c00('0x11'));var authService=require(_0x1c00('0x12'));var qs=require(_0x1c00('0x13'));var as=require(_0x1c00('0x14'));var hardwareService=require(_0x1c00('0x15'));var logger=require('../../config/logger')(_0x1c00('0x16'));var utils=require(_0x1c00('0x17'));var config=require(_0x1c00('0x18'));var licenseUtil=require(_0x1c00('0x19'));var db=require(_0x1c00('0x1a'))['db'];function respondWithStatusCode(_0x102c85,_0x5cfd3e){_0x5cfd3e=_0x5cfd3e||0xcc;return function(_0x5308ec){if(_0x5308ec){return _0x102c85[_0x1c00('0x1b')](_0x5cfd3e);}return _0x102c85[_0x1c00('0x1c')](_0x5cfd3e)['end']();};}function respondWithResult(_0x18e0ec,_0x4a5e36){_0x4a5e36=_0x4a5e36||0xc8;return function(_0x1bf7f2){if(_0x1bf7f2){return _0x18e0ec[_0x1c00('0x1c')](_0x4a5e36)['json'](_0x1bf7f2);}};}function respondWithFilteredResult(_0x3c71a4,_0x57973e){return function(_0x4d276b){if(_0x4d276b){var _0x56ad28=_0x4d276b[_0x1c00('0x1d')],_0x3e1e58=_0x57973e['offset'],_0x2b838e=_0x57973e['offset']+_0x57973e[_0x1c00('0x1e')],_0x1165dd;if(_0x2b838e>=_0x56ad28){_0x2b838e=_0x56ad28;_0x1165dd=0xc8;}else{_0x1165dd=0xce;}_0x3c71a4[_0x1c00('0x1c')](_0x1165dd);return _0x3c71a4['set'](_0x1c00('0x1f'),_0x3e1e58+'-'+_0x2b838e+'/'+_0x56ad28)[_0x1c00('0x20')](_0x4d276b);}return null;};}function patchUpdates(_0x1f26ea){return function(_0x314f67){try{jsonpatch[_0x1c00('0x21')](_0x314f67,_0x1f26ea,!![]);}catch(_0x1e137b){return BPromise[_0x1c00('0x22')](_0x1e137b);}return _0x314f67[_0x1c00('0x23')]();};}function saveUpdates(_0x1e331d,_0x498c15){return function(_0x556f1c){if(_0x556f1c){return _0x556f1c[_0x1c00('0x24')](_0x1e331d)[_0x1c00('0x25')](function(_0x3e6f09){return _0x3e6f09;});}return null;};}function removeEntity(_0x5d669c,_0x3e4b1e){return function(_0x587276){if(_0x587276){return _0x587276[_0x1c00('0x26')]()[_0x1c00('0x25')](function(){_0x5d669c['status'](0xcc)[_0x1c00('0x27')]();});}};}function handleEntityNotFound(_0x2907a8,_0x51799a){return function(_0x350f1f){if(!_0x350f1f){_0x2907a8[_0x1c00('0x1b')](0x194);}return _0x350f1f;};}function handleError(_0x19caa1,_0xf2bfcc){_0xf2bfcc=_0xf2bfcc||0x1f4;return function(_0x13b11a){logger['error'](_0x13b11a['stack']);if(_0x13b11a[_0x1c00('0x28')]){delete _0x13b11a[_0x1c00('0x28')];}_0x19caa1[_0x1c00('0x1c')](_0xf2bfcc)[_0x1c00('0x29')](_0x13b11a);};}exports[_0x1c00('0x2a')]=function(_0x496f9a,_0x2829a7){var _0x32bb41={'raw':!![],'where':{'id':_0x496f9a[_0x1c00('0x2b')]['id']}},_0x5ef435={};_0x5ef435[_0x1c00('0x2c')]=_[_0x1c00('0x2d')](db[_0x1c00('0x2e')][_0x1c00('0x2f')]);_0x5ef435[_0x1c00('0x30')]=_[_0x1c00('0x2d')](_0x496f9a[_0x1c00('0x30')]);_0x5ef435[_0x1c00('0x31')]=_[_0x1c00('0x32')](_0x5ef435[_0x1c00('0x2c')],_0x5ef435['query']);_0x32bb41['attributes']=_[_0x1c00('0x32')](_0x5ef435[_0x1c00('0x2c')],qs[_0x1c00('0x33')](_0x496f9a[_0x1c00('0x30')]['fields']));_0x32bb41[_0x1c00('0x34')]=_0x32bb41[_0x1c00('0x34')][_0x1c00('0x35')]?_0x32bb41[_0x1c00('0x34')]:_0x5ef435[_0x1c00('0x2c')];if(_0x496f9a[_0x1c00('0x30')]['includeAll']){_0x32bb41['include']=[{'all':!![]}];}_0x32bb41=_[_0x1c00('0x36')]({},_0x32bb41,_0x496f9a[_0x1c00('0x37')]);return db['MailApplication']['find'](_0x32bb41)[_0x1c00('0x25')](handleEntityNotFound(_0x2829a7,null))[_0x1c00('0x25')](respondWithResult(_0x2829a7,null))[_0x1c00('0x38')](handleError(_0x2829a7,null));};exports['update']=function(_0x2e9f36,_0x376936){if(_0x2e9f36[_0x1c00('0x39')]['id']){delete _0x2e9f36[_0x1c00('0x39')]['id'];}return db[_0x1c00('0x2e')][_0x1c00('0x3a')]({'where':{'id':_0x2e9f36['params']['id']}})[_0x1c00('0x25')](handleEntityNotFound(_0x376936,null))['then'](saveUpdates(_0x2e9f36[_0x1c00('0x39')],null))[_0x1c00('0x25')](respondWithResult(_0x376936,null))[_0x1c00('0x38')](handleError(_0x376936,null));};exports[_0x1c00('0x26')]=function(_0x180335,_0x2c6f6a){return db[_0x1c00('0x2e')][_0x1c00('0x3a')]({'where':{'id':_0x180335['params']['id']}})[_0x1c00('0x25')](handleEntityNotFound(_0x2c6f6a,null))[_0x1c00('0x25')](removeEntity(_0x2c6f6a,null))['catch'](handleError(_0x2c6f6a,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3d70ce7..1fe1d50 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 _0x25e7=['request-promise','path','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0x25e7,0x1d6));var _0x725e=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0x25e7[_0x2dfd0e];return _0x343af6;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x2497a5,_0x480945){return _0x2497a5['define'](_0x725e('0xa'),attributes,{'tableName':_0x725e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x725e('0xc'),'collate':_0x725e('0xd')});}; \ No newline at end of file +var _0xf0f4=['utf8mb4','util','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x2e77b3,_0x2eff24){var _0x55cce0=function(_0x3c4fdf){while(--_0x3c4fdf){_0x2e77b3['push'](_0x2e77b3['shift']());}};_0x55cce0(++_0x2eff24);}(_0xf0f4,0x182));var _0x4f0f=function(_0x4925cc,_0x108092){_0x4925cc=_0x4925cc-0x0;var _0x344c3a=_0xf0f4[_0x4925cc];return _0x344c3a;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4f0f('0x1'));var BPromise=require(_0x4f0f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f0f('0x3'));var rimraf=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var attributes=require(_0x4f0f('0x6'));module[_0x4f0f('0x7')]=function(_0x15e6cd,_0x3285cd){return _0x15e6cd['define'](_0x4f0f('0x8'),attributes,{'tableName':_0x4f0f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f0f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index f2e363f..60babbc 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 _0xc35e=['client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','then','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4c7892,_0x1c2cb0){var _0x2a79c8=function(_0x523690){while(--_0x523690){_0x4c7892['push'](_0x4c7892['shift']());}};_0x2a79c8(++_0x1c2cb0);}(_0xc35e,0x74));var _0xec35=function(_0x1ca22a,_0x43a262){_0x1ca22a=_0x1ca22a-0x0;var _0x2796a3=_0xc35e[_0x1ca22a];return _0x2796a3;};'use strict';var _=require(_0xec35('0x0'));var util=require(_0xec35('0x1'));var moment=require('moment');var BPromise=require(_0xec35('0x2'));var rs=require(_0xec35('0x3'));var fs=require('fs');var Redis=require(_0xec35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec35('0x5'));var logger=require(_0xec35('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xec35('0x7'));var client=jayson[_0xec35('0x8')][_0xec35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dc9a8,_0x2e4497,_0x4e7279){return new BPromise(function(_0x48dbb8,_0x65ca0){return client[_0xec35('0xa')](_0x2dc9a8,_0x4e7279)['then'](function(_0x209572){logger[_0xec35('0xb')](_0xec35('0xc'),_0x2e4497,_0xec35('0xd'));logger['debug'](_0xec35('0xe'),_0x2e4497,_0xec35('0xd'),JSON[_0xec35('0xf')](_0x209572));if(_0x209572['error']){if(_0x209572[_0xec35('0x10')]['code']===0x1f4){logger[_0xec35('0x10')]('MailApplication,\x20%s,\x20%s',_0x2e4497,_0x209572[_0xec35('0x10')][_0xec35('0x11')]);return _0x65ca0(_0x209572[_0xec35('0x10')][_0xec35('0x11')]);}logger[_0xec35('0x10')](_0xec35('0xc'),_0x2e4497,_0x209572[_0xec35('0x10')]['message']);return _0x48dbb8(_0x209572[_0xec35('0x10')][_0xec35('0x11')]);}else{logger[_0xec35('0xb')](_0xec35('0xc'),_0x2e4497,_0xec35('0xd'));_0x48dbb8(_0x209572[_0xec35('0x12')][_0xec35('0x11')]);}})[_0xec35('0x13')](function(_0x17a25e){logger[_0xec35('0x10')]('MailApplication,\x20%s,\x20%s',_0x2e4497,_0x17a25e);_0x65ca0(_0x17a25e);});});}exports[_0xec35('0x14')]=function(_0x3e0e21){var _0x2c7f08=this;return new Promise(function(_0x4e5a1a,_0x59e4c2){return db[_0xec35('0x15')][_0xec35('0x16')](_0x3e0e21[_0xec35('0x17')],{'raw':_0x3e0e21[_0xec35('0x18')]?_0x3e0e21[_0xec35('0x18')][_0xec35('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0e21[_0xec35('0x18')]?_0x3e0e21[_0xec35('0x18')][_0xec35('0x1a')]||null:null,'attributes':_0x3e0e21[_0xec35('0x18')]?_0x3e0e21[_0xec35('0x18')][_0xec35('0x1b')]||null:null,'limit':_0x3e0e21[_0xec35('0x18')]?_0x3e0e21[_0xec35('0x18')][_0xec35('0x1c')]||null:null})[_0xec35('0x1d')](function(_0x12aa32){logger[_0xec35('0xb')](_0xec35('0x14'),_0x3e0e21);logger[_0xec35('0x1e')]('UpdateMailApplication',_0x3e0e21,JSON[_0xec35('0xf')](_0x12aa32));_0x4e5a1a(_0x12aa32);})[_0xec35('0x13')](function(_0x524dec){logger[_0xec35('0x10')](_0xec35('0x14'),_0x524dec[_0xec35('0x11')],_0x3e0e21);_0x59e4c2(_0x2c7f08[_0xec35('0x10')](0x1f4,_0x524dec[_0xec35('0x11')]));});});}; \ No newline at end of file +var _0x89f1=['raw','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','UpdateMailApplication','update','body','options'];(function(_0x3bb21a,_0x353b56){var _0x5f3983=function(_0x334b13){while(--_0x334b13){_0x3bb21a['push'](_0x3bb21a['shift']());}};_0x5f3983(++_0x353b56);}(_0x89f1,0x11a));var _0x189f=function(_0x50d94a,_0x4bb055){_0x50d94a=_0x50d94a-0x0;var _0x4b88ec=_0x89f1[_0x50d94a];return _0x4b88ec;};'use strict';var _=require(_0x189f('0x0'));var util=require(_0x189f('0x1'));var moment=require(_0x189f('0x2'));var BPromise=require('bluebird');var rs=require(_0x189f('0x3'));var fs=require('fs');var Redis=require(_0x189f('0x4'));var db=require(_0x189f('0x5'))['db'];var utils=require(_0x189f('0x6'));var logger=require(_0x189f('0x7'))(_0x189f('0x8'));var config=require(_0x189f('0x9'));var jayson=require(_0x189f('0xa'));var client=jayson[_0x189f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c85e,_0x3561dd,_0x1cb083){return new BPromise(function(_0x40252c,_0x30d015){return client[_0x189f('0xc')](_0x42c85e,_0x1cb083)[_0x189f('0xd')](function(_0x16c81c){logger['info'](_0x189f('0xe'),_0x3561dd,'request\x20sent');logger[_0x189f('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3561dd,'request\x20sent',JSON[_0x189f('0x10')](_0x16c81c));if(_0x16c81c['error']){if(_0x16c81c[_0x189f('0x11')][_0x189f('0x12')]===0x1f4){logger[_0x189f('0x11')](_0x189f('0xe'),_0x3561dd,_0x16c81c[_0x189f('0x11')][_0x189f('0x13')]);return _0x30d015(_0x16c81c[_0x189f('0x11')][_0x189f('0x13')]);}logger[_0x189f('0x11')](_0x189f('0xe'),_0x3561dd,_0x16c81c[_0x189f('0x11')][_0x189f('0x13')]);return _0x40252c(_0x16c81c['error'][_0x189f('0x13')]);}else{logger[_0x189f('0x14')](_0x189f('0xe'),_0x3561dd,_0x189f('0x15'));_0x40252c(_0x16c81c[_0x189f('0x16')][_0x189f('0x13')]);}})[_0x189f('0x17')](function(_0x309524){logger[_0x189f('0x11')](_0x189f('0xe'),_0x3561dd,_0x309524);_0x30d015(_0x309524);});});}exports[_0x189f('0x18')]=function(_0x14141e){var _0x55f688=this;return new Promise(function(_0x2928c6,_0x2bb153){return db['MailApplication'][_0x189f('0x19')](_0x14141e[_0x189f('0x1a')],{'raw':_0x14141e['options']?_0x14141e[_0x189f('0x1b')][_0x189f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14141e[_0x189f('0x1b')]?_0x14141e[_0x189f('0x1b')][_0x189f('0x1d')]||null:null,'attributes':_0x14141e[_0x189f('0x1b')]?_0x14141e[_0x189f('0x1b')]['attributes']||null:null,'limit':_0x14141e[_0x189f('0x1b')]?_0x14141e[_0x189f('0x1b')][_0x189f('0x1e')]||null:null})['then'](function(_0x5c520f){logger['info']('UpdateMailApplication',_0x14141e);logger[_0x189f('0xf')](_0x189f('0x18'),_0x14141e,JSON['stringify'](_0x5c520f));_0x2928c6(_0x5c520f);})[_0x189f('0x17')](function(_0x178064){logger[_0x189f('0x11')](_0x189f('0x18'),_0x178064[_0x189f('0x13')],_0x14141e);_0x2bb153(_0x55f688[_0x189f('0x11')](0x1f4,_0x178064[_0x189f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3d02ad5..60413d4 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 _0x4ea3=['Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','multer','util','path','connect-timeout'];(function(_0xf3e00f,_0x448e9a){var _0x3f2da2=function(_0x2d4950){while(--_0x2d4950){_0xf3e00f['push'](_0xf3e00f['shift']());}};_0x3f2da2(++_0x448e9a);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x34ea('0x5'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x34ea('0x6')]('/',auth[_0x34ea('0x7')](),controller[_0x34ea('0x8')]);router[_0x34ea('0x6')](_0x34ea('0x9'),auth[_0x34ea('0x7')](),controller[_0x34ea('0xa')]);router['get'](_0x34ea('0xb'),auth[_0x34ea('0x7')](),controller[_0x34ea('0xc')]);router['get'](_0x34ea('0xd'),auth[_0x34ea('0x7')](),controller['getMessages']);router['get'](_0x34ea('0xe'),auth[_0x34ea('0x7')](),controller[_0x34ea('0xf')]);router['post']('/',auth[_0x34ea('0x7')](),controller[_0x34ea('0x10')]);router[_0x34ea('0x11')](_0x34ea('0xd'),auth[_0x34ea('0x7')](),controller[_0x34ea('0x12')]);router[_0x34ea('0x11')](_0x34ea('0x13'),auth[_0x34ea('0x7')](),interaction[_0x34ea('0x14')](_0x34ea('0x15'),'mailinteraction:addtags'),controller[_0x34ea('0x16')]);router[_0x34ea('0x17')](_0x34ea('0xb'),auth[_0x34ea('0x7')](),interaction[_0x34ea('0x14')]('mail',_0x34ea('0x18')),controller[_0x34ea('0x19')]);router[_0x34ea('0x1a')](_0x34ea('0xb'),auth['isAuthenticated'](),interaction[_0x34ea('0x14')](_0x34ea('0x15'),_0x34ea('0x1b')),controller['destroy']);router[_0x34ea('0x1a')](_0x34ea('0x13'),auth[_0x34ea('0x7')](),controller[_0x34ea('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x25ad=['tracked','mail','addTags','update','delete','mailinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','create','post','addMessage'];(function(_0x561ac0,_0x2ffaf7){var _0x3190a3=function(_0x2640d1){while(--_0x2640d1){_0x561ac0['push'](_0x561ac0['shift']());}};_0x3190a3(++_0x2ffaf7);}(_0x25ad,0x1b1));var _0xd25a=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x25ad[_0x5cb97e];return _0x1714b4;};'use strict';var multer=require(_0xd25a('0x0'));var util=require('util');var path=require(_0xd25a('0x1'));var timeout=require(_0xd25a('0x2'));var express=require(_0xd25a('0x3'));var router=express['Router']();var auth=require(_0xd25a('0x4'));var interaction=require(_0xd25a('0x5'));var config=require(_0xd25a('0x6'));var controller=require(_0xd25a('0x7'));router[_0xd25a('0x8')]('/',auth[_0xd25a('0x9')](),controller['index']);router['get'](_0xd25a('0xa'),auth[_0xd25a('0x9')](),controller['describe']);router[_0xd25a('0x8')](_0xd25a('0xb'),auth[_0xd25a('0x9')](),controller[_0xd25a('0xc')]);router[_0xd25a('0x8')](_0xd25a('0xd'),auth[_0xd25a('0x9')](),controller['getMessages']);router[_0xd25a('0x8')]('/:id/download',auth[_0xd25a('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xd25a('0xe')]);router[_0xd25a('0xf')](_0xd25a('0xd'),auth[_0xd25a('0x9')](),controller[_0xd25a('0x10')]);router[_0xd25a('0xf')]('/:id/tags',auth[_0xd25a('0x9')](),interaction[_0xd25a('0x11')](_0xd25a('0x12'),'mailinteraction:addtags'),controller[_0xd25a('0x13')]);router['put'](_0xd25a('0xb'),auth[_0xd25a('0x9')](),interaction[_0xd25a('0x11')](_0xd25a('0x12'),'mailinteraction:update'),controller[_0xd25a('0x14')]);router[_0xd25a('0x15')]('/:id',auth[_0xd25a('0x9')](),interaction[_0xd25a('0x11')](_0xd25a('0x12'),_0xd25a('0x16')),controller[_0xd25a('0x17')]);router[_0xd25a('0x15')]('/:id/tags',auth[_0xd25a('0x9')](),controller['removeTags']);module[_0xd25a('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6f7f0da..58870ae 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 _0xaa30=['long','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x38a345,_0x3a0f4e){var _0x5107a8=function(_0xe425ab){while(--_0xe425ab){_0x38a345['push'](_0x38a345['shift']());}};_0x5107a8(++_0x3a0f4e);}(_0xaa30,0x19f));var _0x0aa3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xaa30[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0aa3('0x0'));var iconv=require(_0x0aa3('0x1'));module['exports']={'closed':{'type':Sequelize[_0x0aa3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0aa3('0x3')]},'disposition':{'type':Sequelize[_0x0aa3('0x4')]},'secondDisposition':{'type':Sequelize[_0x0aa3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0aa3('0x4')]},'inReplyTo':{'type':Sequelize[_0x0aa3('0x4')](0x1fe)},'to':{'type':Sequelize[_0x0aa3('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x0aa3('0x5')]()},'attach':{'type':Sequelize[_0x0aa3('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0aa3('0x3')]},'substatus':{'type':Sequelize[_0x0aa3('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0aa3('0x6')]('in',_0x0aa3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0aa3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0aa3('0x6')]('in',_0x0aa3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x0aa3('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x0aa3('0x5')](_0x0aa3('0x8'))}}; \ No newline at end of file +var _0xc7d6=['sequelize','exports','STRING','long','TEXT','BOOLEAN','DATE','ENUM','out'];(function(_0x10c7eb,_0x175dea){var _0x1a0362=function(_0x2eb028){while(--_0x2eb028){_0x10c7eb['push'](_0x10c7eb['shift']());}};_0x1a0362(++_0x175dea);}(_0xc7d6,0xcf));var _0x6c7d=function(_0x1434f6,_0x10f80b){_0x1434f6=_0x1434f6-0x0;var _0x5a9b4a=_0xc7d6[_0x1434f6];return _0x5a9b4a;};'use strict';var Sequelize=require(_0x6c7d('0x0'));var iconv=require('iconv');module[_0x6c7d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6c7d('0x2')]},'secondDisposition':{'type':Sequelize[_0x6c7d('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6c7d('0x2')]},'note':{'type':Sequelize[_0x6c7d('0x2')]},'inReplyTo':{'type':Sequelize[_0x6c7d('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x6c7d('0x3'))},'subject':{'type':Sequelize[_0x6c7d('0x4')]()},'attach':{'type':Sequelize[_0x6c7d('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6c7d('0x6')]},'substatus':{'type':Sequelize[_0x6c7d('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x6c7d('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x6c7d('0x7')]('in',_0x6c7d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6c7d('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x6c7d('0x7')]('in',_0x6c7d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x6c7d('0x4')]('long')},'lastMsgText':{'type':Sequelize[_0x6c7d('0x4')](_0x6c7d('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index da237d2..acc631d 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 _0x1939=['attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.fullname','ui.MailInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','text','some','i.MailAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','MailAccountId','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','c.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','show','params','includeAll','include','merge','options','create','body','describe','addMessage','omit','ids','getMessages','MailMessage','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','query','keys','filters'];(function(_0x19c1f3,_0x164d69){var _0x490920=function(_0x1fe22e){while(--_0x1fe22e){_0x19c1f3['push'](_0x19c1f3['shift']());}};_0x490920(++_0x164d69);}(_0x1939,0x1a7));var _0x9193=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x1939[_0x4605dc];return _0x5d3e81;};'use strict';var pdf=require(_0x9193('0x0'));var emlformat=require(_0x9193('0x1'));var rimraf=require(_0x9193('0x2'));var zipdir=require(_0x9193('0x3'));var jsonpatch=require(_0x9193('0x4'));var rp=require(_0x9193('0x5'));var moment=require(_0x9193('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9193('0x7'));var util=require('util');var path=require(_0x9193('0x8'));var sox=require('sox');var csv=require(_0x9193('0x9'));var ejs=require(_0x9193('0xa'));var fs=require('fs');var _=require(_0x9193('0xb'));var squel=require(_0x9193('0xc'));var crypto=require(_0x9193('0xd'));var jsforce=require(_0x9193('0xe'));var deskjs=require(_0x9193('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9193('0x10'));var Papa=require('papaparse');var htmlToText=require(_0x9193('0x11'));var Redis=require(_0x9193('0x12'));var authService=require(_0x9193('0x13'));var qs=require(_0x9193('0x14'));var as=require(_0x9193('0x15'));var hardwareService=require(_0x9193('0x16'));var logger=require(_0x9193('0x17'))(_0x9193('0x18'));var utils=require(_0x9193('0x19'));var config=require(_0x9193('0x1a'));var licenseUtil=require(_0x9193('0x1b'));var db=require(_0x9193('0x1c'))['db'];config[_0x9193('0x1d')]=_[_0x9193('0x1e')](config[_0x9193('0x1d')],{'host':_0x9193('0x1f'),'port':0x18eb});var socket=require(_0x9193('0x20'))(new Redis(config[_0x9193('0x1d')]));require(_0x9193('0x21'))[_0x9193('0x22')](socket);function respondWithStatusCode(_0x407f13,_0x1ac624){_0x1ac624=_0x1ac624||0xcc;return function(_0x12c954){if(_0x12c954){return _0x407f13[_0x9193('0x23')](_0x1ac624);}return _0x407f13[_0x9193('0x24')](_0x1ac624)['end']();};}function respondWithResult(_0x28cd8b,_0x3f9738){_0x3f9738=_0x3f9738||0xc8;return function(_0x1272b1){if(_0x1272b1){return _0x28cd8b[_0x9193('0x24')](_0x3f9738)[_0x9193('0x25')](_0x1272b1);}};}function respondWithFilteredResult(_0x3c6994,_0x46d2b9){return function(_0x541c14){if(_0x541c14){var _0x29a3d3=_0x541c14[_0x9193('0x26')],_0x25199a=_0x46d2b9['offset'],_0x10f359=_0x46d2b9[_0x9193('0x27')]+_0x46d2b9['limit'],_0x1510db;if(_0x10f359>=_0x29a3d3){_0x10f359=_0x29a3d3;_0x1510db=0xc8;}else{_0x1510db=0xce;}_0x3c6994[_0x9193('0x24')](_0x1510db);return _0x3c6994[_0x9193('0x28')](_0x9193('0x29'),_0x25199a+'-'+_0x10f359+'/'+_0x29a3d3)[_0x9193('0x25')](_0x541c14);}return null;};}function patchUpdates(_0x3a4ec3){return function(_0x3a42ad){try{jsonpatch[_0x9193('0x2a')](_0x3a42ad,_0x3a4ec3,!![]);}catch(_0x37ef13){return BPromise[_0x9193('0x2b')](_0x37ef13);}return _0x3a42ad['save']();};}function saveUpdates(_0x14ea2e,_0x12a7bc){return function(_0x1aeda0){if(_0x1aeda0){return _0x1aeda0[_0x9193('0x2c')](_0x14ea2e)['then'](function(_0x5b2452){return _0x5b2452;});}return null;};}function removeEntity(_0xa744af,_0x1561d1){return function(_0x370243){if(_0x370243){return _0x370243[_0x9193('0x2d')]()[_0x9193('0x2e')](function(){_0xa744af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x384837,_0x4f4986){return function(_0x2cb035){if(!_0x2cb035){_0x384837[_0x9193('0x23')](0x194);}return _0x2cb035;};}function handleError(_0x4c5fff,_0x512659){_0x512659=_0x512659||0x1f4;return function(_0x3b801c){logger[_0x9193('0x2f')](_0x3b801c[_0x9193('0x30')]);if(_0x3b801c[_0x9193('0x31')]){delete _0x3b801c[_0x9193('0x31')];}_0x4c5fff[_0x9193('0x24')](_0x512659)[_0x9193('0x32')](_0x3b801c);};}function getInteractionUsers(_0x19c3c0,_0x351291){return new BPromise(function(_0x30322d,_0x3df74d){try{if(_0x351291[_0x19c3c0['id']]){_0x19c3c0[_0x9193('0x33')]=_[_0x9193('0x34')](_0x351291[_0x19c3c0['id']],function(_0x51cb7c){return{'id':_0x51cb7c['id'],'fullname':_0x51cb7c['fullname']};});}}catch(_0x550652){_0x3df74d(_0x550652);}_0x30322d(_0x19c3c0);});}function getInteractionTags(_0x3771d7,_0x41de30){return new BPromise(function(_0x17f725,_0x26577b){try{if(_0x3771d7[_0x9193('0x35')]){_0x3771d7[_0x9193('0x36')]=[];_0x3771d7['TagIds'][_0x9193('0x37')](',')[_0x9193('0x38')](function(_0x48334d){_0x3771d7[_0x9193('0x36')][_0x9193('0x39')](_0x41de30[_0x48334d]);});}delete _0x3771d7[_0x9193('0x35')];}catch(_0x483d85){_0x26577b(_0x483d85);}_0x17f725(_0x3771d7);});}function getLastMessageText(_0x29604c){return new BPromise(function(_0x5e4cf9,_0x4f37c0){return db[_0x9193('0x3a')][_0x9193('0x3b')]({'where':{'id':_0x29604c['id']},'attributes':[_0x9193('0x3c'),'lastMsgText'],'raw':!![]})[_0x9193('0x2e')](function(_0xca6aa){if(!_0xca6aa[_0x9193('0x3d')]){_0x29604c[_0x9193('0x3d')]=_[_0x9193('0x3e')](htmlToText[_0x9193('0x3f')](_0xca6aa[_0x9193('0x3c')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x29604c[_0x9193('0x3d')]=_0xca6aa[_0x9193('0x3d')];}_0x5e4cf9(_0x29604c);})[_0x9193('0x40')](function(_0x168258){_0x4f37c0(_0x168258);});});}function updateMailInteraction(_0x1d75b3,_0x411647,_0x5770f2,_0x23bc40){return new BPromise(function(_0x1d3def,_0x266c2b){return getInteractionUsers(_0x1d75b3,_0x5770f2)[_0x9193('0x2e')](function(_0x236444){return getInteractionTags(_0x236444,_0x411647);})[_0x9193('0x2e')](function(_0x4a8b57){if(_0x23bc40){_0x1d3def(getLastMessageText(_0x4a8b57));}else{_0x1d3def(_0x4a8b57);}})[_0x9193('0x40')](function(_0x17aeb9){_0x266c2b(_0x17aeb9);});});}exports[_0x9193('0x41')]=function(_0x35a6f7,_0x5595fe){var _0x43407b={},_0x2f5b32={},_0x218428={'count':0x0,'rows':[]};var _0x572aed=_[_0x9193('0x34')](db[_0x9193('0x3a')][_0x9193('0x42')],function(_0x42355f){return{'name':_0x42355f[_0x9193('0x43')],'type':_0x42355f['type']['key']};});_0x2f5b32['model']=_[_0x9193('0x34')](_0x572aed,_0x9193('0x31'));_0x2f5b32[_0x9193('0x44')]=_[_0x9193('0x45')](_0x35a6f7[_0x9193('0x44')]);_0x2f5b32[_0x9193('0x46')]=_['intersection'](_0x2f5b32['model'],_0x2f5b32[_0x9193('0x44')]);_0x43407b[_0x9193('0x47')]=_[_0x9193('0x48')](_0x2f5b32[_0x9193('0x49')],qs[_0x9193('0x4a')](_0x35a6f7[_0x9193('0x44')][_0x9193('0x4a')]));_0x43407b['attributes']=_0x43407b[_0x9193('0x47')][_0x9193('0x4b')]?_0x43407b[_0x9193('0x47')]:_0x2f5b32[_0x9193('0x49')];if(!_0x35a6f7[_0x9193('0x44')][_0x9193('0x4c')]('nolimit')){_0x43407b[_0x9193('0x4d')]=qs[_0x9193('0x4d')](_0x35a6f7[_0x9193('0x44')]['limit']);_0x43407b[_0x9193('0x27')]=qs['offset'](_0x35a6f7[_0x9193('0x44')][_0x9193('0x27')]);}_0x43407b[_0x9193('0x4e')]=qs[_0x9193('0x4f')](_0x35a6f7[_0x9193('0x44')]['sort']);_0x43407b[_0x9193('0x50')]=qs[_0x9193('0x46')](_[_0x9193('0x51')](_0x35a6f7[_0x9193('0x44')],_0x2f5b32[_0x9193('0x46')]),_0x572aed);var _0x4da113=[];var _0x43c8ff=squel['select']()[_0x9193('0x52')]('id')[_0x9193('0x52')](_0x9193('0x31'))['field'](_0x9193('0x53'))[_0x9193('0x54')](_0x9193('0x55'));var _0xcbeff2=squel[_0x9193('0x56')]()['field']('u.id')[_0x9193('0x52')](_0x9193('0x57'))[_0x9193('0x52')](_0x9193('0x58'))['from']('user_has_mail_interactions','ui')['left_join'](_0x9193('0x59'),'u',_0x9193('0x5a'));var _0x3d78ba=squel[_0x9193('0x56')]()[_0x9193('0x54')]('mail_interactions','i')[_0x9193('0x5b')](_0x9193('0x5c'),'c',_0x9193('0x5d'))[_0x9193('0x5b')](_0x9193('0x59'),'o',_0x9193('0x5e'))[_0x9193('0x5b')](_0x9193('0x5f'),'a',_0x9193('0x60'))[_0x9193('0x5b')]('mail_messages','me',_0x9193('0x61'))[_0x9193('0x5b')](_0x9193('0x62'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x9193('0x55'),'t','t.id\x20=\x20it.TagId');var _0x4b16af=squel['expr']();var _0x30b611=[];var _0x4768ce=squel[_0x9193('0x63')]();var _0x1de72d;if(_0x35a6f7['query'][_0x9193('0x64')]){_0x1de72d=as[_0x9193('0x65')](_0x35a6f7[_0x9193('0x44')][_0x9193('0x64')]);var _0x372cdf=_0x1de72d[_0x9193('0x66')];for(var _0x593fc=0x0;_0x593fc<_0x1de72d['conditions'][_0x9193('0x4b')];_0x593fc++){var _0x4b3671=_0x1de72d[_0x9193('0x67')][_0x593fc];var _0x1252c3='i';var _0x245cd8=_[_0x9193('0x68')](_0x572aed,[_0x9193('0x31'),_0x4b3671[_0x9193('0x52')]]);if(!_0x245cd8){switch(_0x4b3671[_0x9193('0x52')]){case'unreadMessages':if(_0x4b3671[_0x9193('0x69')]==0x1){_0x3d78ba[_0x9193('0x6a')]('`'+_0x4b3671['field']+_0x9193('0x6b'));}else{_0x3d78ba[_0x9193('0x6a')]('`'+_0x4b3671[_0x9193('0x52')]+_0x9193('0x6c'));}break;case _0x9193('0x6d'):if(_0x4b3671[_0x9193('0x6e')]===_0x9193('0x6f')){if(_0x4b3671['value']['split']('\x20')[_0x9193('0x4b')]>0x1){_0x4b16af[_0x372cdf](_0x9193('0x70'),qs[_0x9193('0x71')](_0x4b3671['value']),null);}else{var _0x32053d='%'+_0x4b3671[_0x9193('0x69')]+'%';_0x4b16af[_0x372cdf](_0x9193('0x72'),_0x32053d,_0x32053d,_0x32053d);}}else{_0x245cd8=_['find'](_0x572aed,[_0x9193('0x31'),'ContactId']);_0x4b3671[_0x9193('0x52')]=_0x9193('0x73');_0x3f4a27=as[_0x9193('0x74')](_0x1252c3,_0x245cd8[_0x9193('0x75')],_0x4b3671);_0x4b16af[_0x372cdf](_0x3f4a27['text'],_0x3f4a27[_0x9193('0x69')][_0x9193('0x76')],_0x3f4a27['value'][_0x9193('0x77')]);}break;case'Tag':var _0x568b00=_0x4b3671['value'][_0x9193('0x37')](',')[_0x9193('0x34')](function(_0x46f061){return Number(_0x46f061);});_0x568b00[_0x9193('0x38')](function(_0x16ef65){_0x4768ce['or'](_0x9193('0x78'),'%,'+_0x16ef65+',%');});_0x30b611=_['union'](_0x30b611,_0x568b00);break;case'User':if(_0x4b3671[_0x9193('0x6e')]===_0x9193('0x6f')){_0x4b16af[_0x372cdf](_0x9193('0x79'),'%'+_0x4b3671[_0x9193('0x69')]+'%',null);}else{_0x245cd8=_[_0x9193('0x68')](_0x572aed,['name',_0x9193('0x7a')]);_0x4b3671[_0x9193('0x52')]='UserId';_0x3f4a27=as[_0x9193('0x74')](_0x1252c3,_0x245cd8['type'],_0x4b3671);_0x4b16af[_0x372cdf](_0x3f4a27['text'],_0x3f4a27[_0x9193('0x69')][_0x9193('0x76')],_0x3f4a27[_0x9193('0x69')]['end']);}break;case _0x9193('0x7b'):_0x3f4a27=as['buildExpression']('me',null,_0x4b3671);_0x4b16af[_0x372cdf](_0x3f4a27[_0x9193('0x7c')],_0x3f4a27[_0x9193('0x69')]['start'],_0x3f4a27[_0x9193('0x69')][_0x9193('0x77')]);break;}}else{var _0x3f4a27=as[_0x9193('0x74')](_0x1252c3,_0x245cd8[_0x9193('0x75')],_0x4b3671);_0x4b16af[_0x372cdf](_0x3f4a27[_0x9193('0x7c')],_0x3f4a27[_0x9193('0x69')][_0x9193('0x76')],_0x3f4a27['value'][_0x9193('0x77')]);}}}else{var _0x41edc7=_(_0x35a6f7[_0x9193('0x44')])[_0x9193('0x45')]()[_0x9193('0x34')](function(_0x4fba3e){return _[_0x9193('0x7d')](_0x572aed,[_0x9193('0x31'),_0x4fba3e])?_0x4fba3e:undefined;})['compact']()[_0x9193('0x69')]();if(!_['isEmpty'](_0x41edc7)){_0x41edc7['forEach'](function(_0x3a7a9b){if(_0x3a7a9b==='MailAccountId'){_0x3d78ba['where'](_0x9193('0x7e'),[][_0x9193('0x7f')](_0x35a6f7[_0x9193('0x44')][_0x3a7a9b]));}else if(_0x3a7a9b==='createdAt'){var _0x4735b0=JSON[_0x9193('0x80')](_0x35a6f7[_0x9193('0x44')][_0x3a7a9b])['$gte'];var _0x5bfdc0=JSON[_0x9193('0x80')](_0x35a6f7[_0x9193('0x44')][_0x3a7a9b])[_0x9193('0x81')];_0x3d78ba[_0x9193('0x50')](_0x9193('0x82'),_0x4735b0,_0x5bfdc0);}else{if(_0x35a6f7[_0x9193('0x44')][_0x3a7a9b]==='null'){_0x3d78ba[_0x9193('0x50')]('i.'+_0x3a7a9b+_0x9193('0x83'));}else{_0x3d78ba['where']('i.'+_0x3a7a9b+_0x9193('0x84'),_0x35a6f7['query'][_0x3a7a9b]);}}});}if(_0x35a6f7[_0x9193('0x44')][_0x9193('0x85')]){if(_0x35a6f7['query']['read']==0x1){_0x3d78ba[_0x9193('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x3d78ba[_0x9193('0x6a')](_0x9193('0x86'));}}if(_0x35a6f7[_0x9193('0x44')][_0x9193('0x87')]){_0x30b611=_[_0x9193('0x88')](_0x35a6f7['query'][_0x9193('0x87')])?_0x35a6f7[_0x9193('0x44')][_0x9193('0x87')]:new Array(_0x35a6f7[_0x9193('0x44')][_0x9193('0x87')]);_0x30b611['forEach'](function(_0x5da183){_0x4768ce['or'](_0x9193('0x78'),'%,'+_0x5da183+',%');});}if(_0x35a6f7['query'][_0x9193('0x89')]){var _0x401ffd=_0x35a6f7['query'][_0x9193('0x89')][_0x9193('0x8a')]('\x5c','\x5c\x5c')[_0x9193('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x401ffd)){_0x4b16af['or']('i.id\x20LIKE\x20?',_0x401ffd+'%');}else if(qs['isEmail'](_0x401ffd)){_0x4b16af['or']('c.email\x20LIKE\x20?',_0x401ffd+'%');}else{_0x4b16af['or'](_0x9193('0x8b'),qs['getFullTextValue'](_0x401ffd))['or'](_0x9193('0x8c'),qs[_0x9193('0x71')](_0x401ffd));}}}_0x3d78ba[_0x9193('0x50')](_0x4b16af);_0x3d78ba[_0x9193('0x8d')](_0x9193('0x8e'));var _0x4e6512={'type':db[_0x9193('0x8f')][_0x9193('0x90')][_0x9193('0x91')],'raw':!![]};var _0x2350a9=_0x3d78ba[_0x9193('0x92')]();_0x2350a9[_0x9193('0x52')](_0x9193('0x8e'));_0x2350a9[_0x9193('0x52')](_0x9193('0x93'),_0x9193('0x94'));if(_0x43407b[_0x9193('0x4e')]){_0x43407b['order'][_0x9193('0x38')](function(_0x11cadb){var _0x36365a=_0x11cadb[0x0]==='contactName'?_0x11cadb[0x0]:'i.'+_0x11cadb[0x0];_0x3d78ba[_0x9193('0x4e')](_0x36365a,_0x11cadb[0x1]===_0x9193('0x95')?![]:!![]);});}if(!_[_0x9193('0x96')](_0x30b611)){_0x3d78ba[_0x9193('0x6a')](_0x4768ce);_0x2350a9[_0x9193('0x50')](_0x9193('0x97'),_0x30b611);}BPromise[_0x9193('0x98')]()[_0x9193('0x2e')](function(){if(!_0x1de72d){if(_0x35a6f7[_0x9193('0x44')]['MailAccountId'])return;_0x2350a9[_0x9193('0x50')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3d78ba[_0x9193('0x50')](_0x9193('0x99'));return;}if(_0x35a6f7['user'][_0x9193('0x9a')]!==_0x9193('0x9b'))return;return _0x35a6f7[_0x9193('0x9c')][_0x9193('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f7f1d){if(_['isEmpty'](_0x2f7f1d)){_0x2350a9['where'](_0x9193('0x9e'));_0x3d78ba[_0x9193('0x50')](_0x9193('0x9e'));}else{_0x2350a9[_0x9193('0x50')](_0x9193('0x7e'),_['map'](_0x2f7f1d,'id'));_0x3d78ba[_0x9193('0x50')](_0x9193('0x7e'),_[_0x9193('0x34')](_0x2f7f1d,'id'));}});})['then'](function(){if(_0x35a6f7[_0x9193('0x9c')]['role']===_0x9193('0x9b')&&!_0x1de72d&&!_0x35a6f7[_0x9193('0x44')][_0x9193('0x9f')])return[];return db[_0x9193('0xa0')]['query'](_0x2350a9[_0x9193('0xa1')](),_0x4e6512);})[_0x9193('0x2e')](function(_0x5bfdd7){_0x218428[_0x9193('0x26')]=_0x5bfdd7[_0x9193('0x4b')];if(_0x218428['count']===0x0)return[];return db['sequelize'][_0x9193('0x44')](_0x43c8ff[_0x9193('0xa1')](),_0x4e6512)[_0x9193('0x2e')](function(_0x5cef12){_0x4da113=_[_0x9193('0xa2')](_0x5cef12,'id');_0x4e6512=_['merge'](_0x4e6512,{'model':db[_0x9193('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35a6f7['query'][_0x9193('0x4a')]){_0x43407b['attributes'][_0x9193('0x38')](function(_0x19dcee){_0x3d78ba[_0x9193('0x52')]('i.'+_0x19dcee);});}else{_0x3d78ba[_0x9193('0x52')](_0x9193('0x93'),'unreadMessages');_0x3d78ba[_0x9193('0x52')](_0x9193('0xa3'),_0x9193('0xa4'));_0x3d78ba[_0x9193('0x52')]('a.mandatoryDisposition',_0x9193('0xa5'));_0x3d78ba['field'](_0x9193('0xa6'),_0x9193('0xa7'));_0x3d78ba[_0x9193('0x52')](_0x9193('0x8e'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xa8'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xa9'));_0x3d78ba[_0x9193('0x52')]('i.closed');_0x3d78ba[_0x9193('0x52')](_0x9193('0xaa'));_0x3d78ba['field'](_0x9193('0xab'));_0x3d78ba['field'](_0x9193('0xac'));_0x3d78ba['field'](_0x9193('0xad'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xae'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xaf'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xb0'));_0x3d78ba[_0x9193('0x52')]('i.thirdDisposition');_0x3d78ba[_0x9193('0x52')](_0x9193('0xb1'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xb2'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xb3'));_0x3d78ba[_0x9193('0x52')]('i.MailAccountId');_0x3d78ba[_0x9193('0x52')]('i.UserId');_0x3d78ba[_0x9193('0x52')](_0x9193('0xb4'),'Contact.firstName');_0x3d78ba[_0x9193('0x52')]('c.lastName','Contact.lastName');_0x3d78ba[_0x9193('0x52')](_0x9193('0xb5'),_0x9193('0xb6'));_0x3d78ba['field'](_0x9193('0xb7'),_0x9193('0xb8'));_0x3d78ba['field'](_0x9193('0xb9'),'Contact.mobile');_0x3d78ba[_0x9193('0x52')](_0x9193('0xba'),_0x9193('0xbb'));_0x3d78ba[_0x9193('0x52')]('o.fullname',_0x9193('0xbc'));_0x3d78ba[_0x9193('0x52')](_0x9193('0xbd'),'Owner.internal');_0x3d78ba[_0x9193('0x52')](_0x9193('0xbe'),_0x9193('0x35'));}if(_0x43407b[_0x9193('0x4d')])_0x3d78ba['limit'](_0x43407b[_0x9193('0x4d')]);if(_0x43407b['offset'])_0x3d78ba[_0x9193('0x27')](_0x43407b[_0x9193('0x27')]);return db[_0x9193('0xa0')]['query'](_0x3d78ba[_0x9193('0xa1')](),_0x4e6512);})['then'](function(_0x59fef4){_0xcbeff2[_0x9193('0x50')](_0x9193('0xbf'),_[_0x9193('0x34')](_0x59fef4,'id'));return db[_0x9193('0xa0')][_0x9193('0x44')](_0xcbeff2['toString'](),_0x4e6512)[_0x9193('0x2e')](function(_0x38b5cd){var _0x23235d=_[_0x9193('0xc0')](_0x38b5cd,_0x9193('0xc1'));var _0x47efb3=[];return db['Setting'][_0x9193('0x3b')]({'attributes':[_0x9193('0xc2')],'raw':!![]})[_0x9193('0x2e')](function(_0x2aa887){var _0x45925b=_0x2aa887[_0x9193('0xc2')];_0x59fef4['forEach'](function(_0x22700c){_0x47efb3[_0x9193('0x39')](updateMailInteraction(_0x22700c,_0x4da113,_0x23235d,_0x45925b));});return BPromise[_0x9193('0xc3')](_0x47efb3);});});});})[_0x9193('0x2e')](function(_0x344459){_0x218428['rows']=_0x344459;return _0x218428;})[_0x9193('0x2e')](respondWithFilteredResult(_0x5595fe,_0x43407b))[_0x9193('0x40')](handleError(_0x5595fe,null));};exports[_0x9193('0xc4')]=function(_0x24dd89,_0x3f1156){var _0x586c63={'raw':![],'where':{'id':_0x24dd89[_0x9193('0xc5')]['id']}},_0x5a6302={};_0x5a6302[_0x9193('0x49')]=_['keys'](db[_0x9193('0x3a')][_0x9193('0x42')]);_0x5a6302['query']=_[_0x9193('0x45')](_0x24dd89['query']);_0x5a6302[_0x9193('0x46')]=_[_0x9193('0x48')](_0x5a6302['model'],_0x5a6302[_0x9193('0x44')]);_0x586c63[_0x9193('0x47')]=_['intersection'](_0x5a6302[_0x9193('0x49')],qs[_0x9193('0x4a')](_0x24dd89['query'][_0x9193('0x4a')]));_0x586c63[_0x9193('0x47')]=_0x586c63[_0x9193('0x47')][_0x9193('0x4b')]?_0x586c63[_0x9193('0x47')]:_0x5a6302[_0x9193('0x49')];if(_0x24dd89[_0x9193('0x44')][_0x9193('0xc6')]){_0x586c63[_0x9193('0xc7')]=[{'all':!![]}];}_0x586c63=_[_0x9193('0xc8')]({},_0x586c63,_0x24dd89[_0x9193('0xc9')]);return db[_0x9193('0x3a')][_0x9193('0x68')](_0x586c63)[_0x9193('0x2e')](handleEntityNotFound(_0x3f1156,null))[_0x9193('0x2e')](respondWithResult(_0x3f1156,null))[_0x9193('0x40')](handleError(_0x3f1156,null));};exports[_0x9193('0xca')]=function(_0x1c2f2d,_0x8f60b5){return db[_0x9193('0x3a')][_0x9193('0xca')](_0x1c2f2d[_0x9193('0xcb')],{})[_0x9193('0x2e')](respondWithResult(_0x8f60b5,0xc9))[_0x9193('0x40')](handleError(_0x8f60b5,null));};exports[_0x9193('0x2c')]=function(_0x1d6e14,_0x39b9d7){if(_0x1d6e14[_0x9193('0xcb')]['id']){delete _0x1d6e14[_0x9193('0xcb')]['id'];}return db[_0x9193('0x3a')][_0x9193('0x68')]({'where':{'id':_0x1d6e14[_0x9193('0xc5')]['id']}})['then'](handleEntityNotFound(_0x39b9d7,null))['then'](saveUpdates(_0x1d6e14['body'],null))[_0x9193('0x2e')](respondWithResult(_0x39b9d7,null))['catch'](handleError(_0x39b9d7,null));};exports[_0x9193('0x2d')]=function(_0x294740,_0x2fda2c){return db[_0x9193('0x3a')][_0x9193('0x68')]({'where':{'id':_0x294740['params']['id']}})[_0x9193('0x2e')](handleEntityNotFound(_0x2fda2c,null))[_0x9193('0x2e')](removeEntity(_0x2fda2c,null))[_0x9193('0x40')](handleError(_0x2fda2c,null));};exports[_0x9193('0xcc')]=function(_0x1d11af,_0xfc9b62){return db[_0x9193('0x3a')][_0x9193('0xcc')]()[_0x9193('0x2e')](respondWithResult(_0xfc9b62,null))[_0x9193('0x40')](handleError(_0xfc9b62,null));};exports[_0x9193('0xcd')]=function(_0x267742,_0x358561,_0x501c45){return db['MailMessage']['find']({'where':{'id':_0x267742[_0x9193('0xc5')]['id']}})[_0x9193('0x2e')](handleEntityNotFound(_0x358561,null))[_0x9193('0x2e')](function(_0x49d238){if(_0x49d238){return _0x49d238['addMessage'](_0x267742[_0x9193('0xcb')]['ids'],_[_0x9193('0xce')](_0x267742[_0x9193('0xcb')],[_0x9193('0xcf'),'id'])||{});}})[_0x9193('0x2e')](respondWithResult(_0x358561,null))[_0x9193('0x40')](handleError(_0x358561,null));};exports[_0x9193('0xd0')]=function(_0x5cbf7b,_0x2a4267,_0x4a3544){var _0xacfe45={'raw':![],'where':{}};var _0xb50d52={};var _0x5f43e={'count':0x0,'rows':[]};return db[_0x9193('0x3a')]['findOne']({'where':{'id':_0x5cbf7b[_0x9193('0xc5')]['id']}})[_0x9193('0x2e')](handleEntityNotFound(_0x2a4267,null))[_0x9193('0x2e')](function(_0x13152e){if(_0x13152e){_0xb50d52[_0x9193('0x49')]=_['keys'](db[_0x9193('0xd1')]['rawAttributes']);_0xb50d52[_0x9193('0x44')]=_[_0x9193('0x45')](_0x5cbf7b[_0x9193('0x44')]);_0xb50d52[_0x9193('0x46')]=_[_0x9193('0x48')](_0xb50d52[_0x9193('0x49')],_0xb50d52[_0x9193('0x44')]);_0xacfe45['attributes']=_[_0x9193('0x48')](_0xb50d52[_0x9193('0x49')],qs['fields'](_0x5cbf7b[_0x9193('0x44')]['fields']));_0xacfe45[_0x9193('0x47')]=_0xacfe45[_0x9193('0x47')][_0x9193('0x4b')]?_0xacfe45['attributes']:_0xb50d52[_0x9193('0x49')];if(!_0x5cbf7b[_0x9193('0x44')][_0x9193('0x4c')](_0x9193('0xd2'))){_0xacfe45[_0x9193('0x4d')]=qs[_0x9193('0x4d')](_0x5cbf7b[_0x9193('0x44')][_0x9193('0x4d')]);_0xacfe45[_0x9193('0x27')]=qs[_0x9193('0x27')](_0x5cbf7b[_0x9193('0x44')][_0x9193('0x27')]);}_0xacfe45[_0x9193('0x4e')]=qs['sort'](_0x5cbf7b[_0x9193('0x44')][_0x9193('0x4f')]);_0xacfe45[_0x9193('0x50')]=qs[_0x9193('0x46')](_[_0x9193('0x51')](_0x5cbf7b[_0x9193('0x44')],_0xb50d52['filters']));_0xacfe45['where']['MailInteractionId']=_0x13152e['id'];if(_0x5cbf7b[_0x9193('0x44')]['filter']){_0xacfe45[_0x9193('0x50')]=_[_0x9193('0xc8')](_0xacfe45['where'],{'$or':_['map'](_0xacfe45[_0x9193('0x47')],function(_0x490529){var _0x4223f4={};_0x4223f4[_0x490529]={'$like':'%'+_0x5cbf7b['query'][_0x9193('0x89')]+'%'};return _0x4223f4;})});}if(_0x5cbf7b[_0x9193('0x44')][_0x9193('0xd3')]){var _0x7883c0=_0x5cbf7b[_0x9193('0x44')][_0x9193('0xd3')][_0x9193('0x37')](',');var _0x1a1847={};_0x1a1847[_0x7883c0[0x0]]={'$gte':moment(_0x7883c0[0x1])['format'](_0x9193('0xd4'))};_0xacfe45['where']=_[_0x9193('0xc8')](_0xacfe45[_0x9193('0x50')],_0x1a1847);}_0xacfe45=_[_0x9193('0xc8')]({},_0xacfe45,_0x5cbf7b[_0x9193('0xc9')]);return db[_0x9193('0xd1')][_0x9193('0x26')]({'where':_0xacfe45['where']})['then'](function(_0x241810){_0x5f43e[_0x9193('0x26')]=_0x241810;if(_0x5cbf7b[_0x9193('0x44')][_0x9193('0xc6')]){_0xacfe45['include']=[{'all':!![]}];}return db['MailMessage'][_0x9193('0xd5')](_0xacfe45);})[_0x9193('0x2e')](function(_0x5343f4){_0x5f43e['rows']=_0x5343f4;return _0x5f43e;});}})[_0x9193('0x2e')](respondWithFilteredResult(_0x2a4267,_0xacfe45))['catch'](handleError(_0x2a4267,null));};exports['addTags']=function(_0x538aad,_0x575771,_0x397e75){return db[_0x9193('0x3a')][_0x9193('0x68')]({'where':{'id':_0x538aad['params']['id']}})['then'](handleEntityNotFound(_0x575771,null))[_0x9193('0x2e')](function(_0x591cde){if(_0x591cde){return _0x591cde[_0x9193('0xd6')](_0x538aad[_0x9193('0xcb')]['ids'],_['omit'](_0x538aad['body'],['ids','id'])||{})['spread'](function(){return db[_0x9193('0xd7')][_0x9193('0xd5')]({'attributes':['id',_0x9193('0x31'),'color'],'where':{'id':_0x538aad[_0x9193('0xcb')]['ids']}});})[_0x9193('0x2e')](function(_0x47158f){socket[_0x9193('0xd8')](_0x9193('0xd9'),{'id':Number(_0x538aad[_0x9193('0xc5')]['id']),'tags':_0x47158f||[]});return{'id':Number(_0x538aad[_0x9193('0xc5')]['id']),'tags':_0x47158f||[]};});}})[_0x9193('0x2e')](respondWithResult(_0x575771,null))[_0x9193('0x40')](handleError(_0x575771,null));};exports[_0x9193('0xda')]=function(_0x4f05de,_0x34632c,_0x2c76d7){return db[_0x9193('0x3a')][_0x9193('0x68')]({'where':{'id':_0x4f05de[_0x9193('0xc5')]['id']}})[_0x9193('0x2e')](handleEntityNotFound(_0x34632c,null))[_0x9193('0x2e')](function(_0x2fe21a){if(_0x2fe21a){return _0x2fe21a[_0x9193('0xda')](_0x4f05de[_0x9193('0x44')][_0x9193('0xcf')]);}})[_0x9193('0x2e')](respondWithStatusCode(_0x34632c,null))[_0x9193('0x40')](handleError(_0x34632c,null));};exports[_0x9193('0xdb')]=function(_0x5a6414,_0x31ba24){var _0x3a1c86=moment()[_0x9193('0xdc')]()[_0x9193('0xa1')]();var _0x52bda0=path[_0x9193('0xdd')](config[_0x9193('0xde')],_0x9193('0xdf'),_0x9193('0xe0'),_0x9193('0xe1'));var _0x116485=path[_0x9193('0xdd')](config[_0x9193('0xde')],_0x9193('0xdf'),'files','attachments');var _0x2aa1f6=path['join'](_0x52bda0,_0x3a1c86);var _0x4b79a4=util[_0x9193('0xe2')](_0x9193('0xe3'),_0x5a6414[_0x9193('0xc5')]['id'],_0x3a1c86);var _0x35c22e=path[_0x9193('0xdd')](_0x52bda0,_0x4b79a4);var _0x7b5257=[];if(_0x5a6414['query'][_0x9193('0xe4')]){_0x7b5257[_0x9193('0x39')]({'model':db[_0x9193('0xe5')],'as':_0x9193('0xe6'),'raw':!![]});}var _0x2b18e4=[{'model':db['MailMessage'],'as':_0x9193('0xe7'),'attributes':['id',_0x9193('0xcb'),_0x9193('0x54'),'to','cc',_0x9193('0xe8'),_0x9193('0xe9'),_0x9193('0xea')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x7b5257}];return db[_0x9193('0x3a')][_0x9193('0x68')]({'where':{'id':_0x5a6414[_0x9193('0xc5')]['id']},'include':_0x2b18e4})[_0x9193('0x2e')](handleEntityNotFound(_0x31ba24,null))[_0x9193('0x2e')](function(_0x58f5c0){if(_0x58f5c0&&_0x58f5c0[_0x9193('0xe7')]){var _0x11e20b=_0x58f5c0[_0x9193('0xeb')]({'plain':!![]});fs[_0x9193('0xec')](_0x2aa1f6);return BPromise[_0x9193('0xed')](_0x11e20b[_0x9193('0xe7')],function(_0x20ec33,_0x3ddfcd){var _0xc79472={'from':_0x20ec33[_0x9193('0x54')],'to':_0x20ec33['to'],'subject':_0x20ec33[_0x9193('0xe9')],'html':_0x20ec33[_0x9193('0xcb')],'headers':{'Date':moment(_0x20ec33[_0x9193('0xea')])[_0x9193('0xe2')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x20ec33['cc']){_0xc79472[_0x9193('0xee')]['Cc']=_0x20ec33['cc'];}if(_0x20ec33['bcc']){_0xc79472['headers'][_0x9193('0xef')]=_0x20ec33[_0x9193('0xe8')];}return new BPromise(function(_0x357ac6,_0x3f4288){if(_0x20ec33['Attachments']){for(var _0x1e913d=0x0;_0x1e913d<_0x20ec33[_0x9193('0xe6')][_0x9193('0x4b')];_0x1e913d++){var _0x25fd9b=_0x20ec33[_0x9193('0xe6')][_0x1e913d];var _0x105b54=path[_0x9193('0xdd')](_0x116485,_0x25fd9b[_0x9193('0xf0')]);if(fs[_0x9193('0xf1')](_0x105b54)){_0xc79472[_0x9193('0xe4')]['push']({'name':_0x25fd9b[_0x9193('0x31')],'contentType':_0x25fd9b[_0x9193('0x75')],'data':fs[_0x9193('0xf2')](_0x105b54)});}}}emlformat[_0x9193('0xf3')](_0xc79472,function(_0x552726,_0x3b5ac9){if(_0x552726)return _0x3f4288(_0x552726);fs[_0x9193('0xf4')](path['join'](_0x2aa1f6,util[_0x9193('0xe2')](_0x9193('0xf5'),_0x3ddfcd)),_0x3b5ac9);return _0x357ac6(_0x3b5ac9);});});})[_0x9193('0x2e')](function(){return new BPromise(function(_0x2d7c82,_0x5d7fa7){zipdir(_0x2aa1f6,{'saveTo':_0x35c22e},function(_0xeba3c9,_0x349fec){if(_0xeba3c9)return _0x5d7fa7(_0xeba3c9);return _0x2d7c82(_0x349fec);});})[_0x9193('0x2e')](function(){return new BPromise(function(_0x592ca9,_0x5cfa76){rimraf(_0x2aa1f6,function(_0x46097c){if(_0x46097c)_0x5cfa76(_0x46097c);return _0x592ca9();});});})[_0x9193('0x2e')](function(){return _0x31ba24[_0x9193('0xdb')](_0x35c22e,_0x4b79a4,function(_0x558709){if(_0x558709){console[_0x9193('0xf6')]('err',_0x558709);}else{fs['unlinkSync'](_0x35c22e);}});});});}else{return _0x31ba24['sendStatus'](0xc8);}})[_0x9193('0x40')](handleError(_0x31ba24,null));}; \ No newline at end of file +var _0xb144=['reject','save','update','then','destroy','error','name','send','Users','Tags','forEach','push','TagIds','MailInteraction','lastMsgBody','lastMsgText','trimStart','catch','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','having','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','findOne','enableEmailPreview','rows','show','rawAttributes','includeAll','include','options','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','mkdirSync','each','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','readFileSync','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailInteraction.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xb144,0x1be));var _0x4b14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb144[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x4b14('0x0'));var emlformat=require(_0x4b14('0x1'));var rimraf=require(_0x4b14('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b14('0x3'));var rp=require(_0x4b14('0x4'));var moment=require('moment');var BPromise=require(_0x4b14('0x5'));var Mustache=require('mustache');var util=require(_0x4b14('0x6'));var path=require(_0x4b14('0x7'));var sox=require(_0x4b14('0x8'));var csv=require(_0x4b14('0x9'));var ejs=require(_0x4b14('0xa'));var fs=require('fs');var _=require(_0x4b14('0xb'));var squel=require(_0x4b14('0xc'));var crypto=require(_0x4b14('0xd'));var jsforce=require(_0x4b14('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4b14('0x9'));var querystring=require('querystring');var Papa=require(_0x4b14('0xf'));var htmlToText=require(_0x4b14('0x10'));var Redis=require(_0x4b14('0x11'));var authService=require(_0x4b14('0x12'));var qs=require(_0x4b14('0x13'));var as=require(_0x4b14('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b14('0x15'))(_0x4b14('0x16'));var utils=require('../../config/utils');var config=require(_0x4b14('0x17'));var licenseUtil=require(_0x4b14('0x18'));var db=require(_0x4b14('0x19'))['db'];config[_0x4b14('0x1a')]=_[_0x4b14('0x1b')](config[_0x4b14('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b14('0x1a')]));require(_0x4b14('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d4c5a,_0x4058f4){_0x4058f4=_0x4058f4||0xcc;return function(_0x64c281){if(_0x64c281){return _0x5d4c5a[_0x4b14('0x1d')](_0x4058f4);}return _0x5d4c5a[_0x4b14('0x1e')](_0x4058f4)[_0x4b14('0x1f')]();};}function respondWithResult(_0x5abd8d,_0x1ca4ef){_0x1ca4ef=_0x1ca4ef||0xc8;return function(_0x131430){if(_0x131430){return _0x5abd8d['status'](_0x1ca4ef)[_0x4b14('0x20')](_0x131430);}};}function respondWithFilteredResult(_0x2b2315,_0x3df8f8){return function(_0x139c48){if(_0x139c48){var _0x63dcb4=_0x139c48[_0x4b14('0x21')],_0x3371b8=_0x3df8f8[_0x4b14('0x22')],_0x2a84c0=_0x3df8f8['offset']+_0x3df8f8['limit'],_0x379025;if(_0x2a84c0>=_0x63dcb4){_0x2a84c0=_0x63dcb4;_0x379025=0xc8;}else{_0x379025=0xce;}_0x2b2315[_0x4b14('0x1e')](_0x379025);return _0x2b2315[_0x4b14('0x23')](_0x4b14('0x24'),_0x3371b8+'-'+_0x2a84c0+'/'+_0x63dcb4)['json'](_0x139c48);}return null;};}function patchUpdates(_0x2b5473){return function(_0x1d22ab){try{jsonpatch[_0x4b14('0x25')](_0x1d22ab,_0x2b5473,!![]);}catch(_0x1988c0){return BPromise[_0x4b14('0x26')](_0x1988c0);}return _0x1d22ab[_0x4b14('0x27')]();};}function saveUpdates(_0xbe80ae,_0x702160){return function(_0x2485d7){if(_0x2485d7){return _0x2485d7[_0x4b14('0x28')](_0xbe80ae)[_0x4b14('0x29')](function(_0x10c564){return _0x10c564;});}return null;};}function removeEntity(_0x1b7826,_0x202a75){return function(_0x59c895){if(_0x59c895){return _0x59c895[_0x4b14('0x2a')]()[_0x4b14('0x29')](function(){_0x1b7826[_0x4b14('0x1e')](0xcc)[_0x4b14('0x1f')]();});}};}function handleEntityNotFound(_0x2c4f96,_0x54d773){return function(_0x261f3d){if(!_0x261f3d){_0x2c4f96[_0x4b14('0x1d')](0x194);}return _0x261f3d;};}function handleError(_0x174ba6,_0x2ddf8c){_0x2ddf8c=_0x2ddf8c||0x1f4;return function(_0x35f62e){logger[_0x4b14('0x2b')](_0x35f62e['stack']);if(_0x35f62e[_0x4b14('0x2c')]){delete _0x35f62e[_0x4b14('0x2c')];}_0x174ba6[_0x4b14('0x1e')](_0x2ddf8c)[_0x4b14('0x2d')](_0x35f62e);};}function getInteractionUsers(_0x3cd67f,_0x4adbbb){return new BPromise(function(_0x506b45,_0x248bf7){try{if(_0x4adbbb[_0x3cd67f['id']]){_0x3cd67f[_0x4b14('0x2e')]=_['map'](_0x4adbbb[_0x3cd67f['id']],function(_0x51f7c9){return{'id':_0x51f7c9['id'],'fullname':_0x51f7c9['fullname']};});}}catch(_0x1b1576){_0x248bf7(_0x1b1576);}_0x506b45(_0x3cd67f);});}function getInteractionTags(_0x2398ce,_0x4e369b){return new BPromise(function(_0x4979f1,_0x3b4ccb){try{if(_0x2398ce['TagIds']){_0x2398ce[_0x4b14('0x2f')]=[];_0x2398ce['TagIds']['split'](',')[_0x4b14('0x30')](function(_0x467a0a){_0x2398ce[_0x4b14('0x2f')][_0x4b14('0x31')](_0x4e369b[_0x467a0a]);});}delete _0x2398ce[_0x4b14('0x32')];}catch(_0x4a9bc0){_0x3b4ccb(_0x4a9bc0);}_0x4979f1(_0x2398ce);});}function getLastMessageText(_0x3b3e4e){return new BPromise(function(_0x1d8176,_0x5872fe){return db[_0x4b14('0x33')]['findOne']({'where':{'id':_0x3b3e4e['id']},'attributes':[_0x4b14('0x34'),_0x4b14('0x35')],'raw':!![]})[_0x4b14('0x29')](function(_0x5f0e7c){if(!_0x5f0e7c[_0x4b14('0x35')]){_0x3b3e4e[_0x4b14('0x35')]=_[_0x4b14('0x36')](htmlToText['fromString'](_0x5f0e7c[_0x4b14('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3b3e4e['lastMsgText']=_0x5f0e7c['lastMsgText'];}_0x1d8176(_0x3b3e4e);})[_0x4b14('0x37')](function(_0x558705){_0x5872fe(_0x558705);});});}function updateMailInteraction(_0x1a87bc,_0x10ca9c,_0x483fe9,_0x5dc121){return new BPromise(function(_0x112a69,_0x5d4389){return getInteractionUsers(_0x1a87bc,_0x483fe9)['then'](function(_0x8c3dd8){return getInteractionTags(_0x8c3dd8,_0x10ca9c);})[_0x4b14('0x29')](function(_0x340b47){if(_0x5dc121){_0x112a69(getLastMessageText(_0x340b47));}else{_0x112a69(_0x340b47);}})[_0x4b14('0x37')](function(_0x1bcc81){_0x5d4389(_0x1bcc81);});});}exports['index']=function(_0x342e4f,_0x26a6e5){var _0x296509={},_0x2b120e={},_0x36b367={'count':0x0,'rows':[]};var _0x519681=_[_0x4b14('0x38')](db[_0x4b14('0x33')]['rawAttributes'],function(_0xcb74c1){return{'name':_0xcb74c1[_0x4b14('0x39')],'type':_0xcb74c1[_0x4b14('0x3a')]['key']};});_0x2b120e[_0x4b14('0x3b')]=_[_0x4b14('0x38')](_0x519681,'name');_0x2b120e[_0x4b14('0x3c')]=_[_0x4b14('0x3d')](_0x342e4f[_0x4b14('0x3c')]);_0x2b120e[_0x4b14('0x3e')]=_[_0x4b14('0x3f')](_0x2b120e[_0x4b14('0x3b')],_0x2b120e[_0x4b14('0x3c')]);_0x296509[_0x4b14('0x40')]=_[_0x4b14('0x3f')](_0x2b120e['model'],qs[_0x4b14('0x41')](_0x342e4f[_0x4b14('0x3c')]['fields']));_0x296509[_0x4b14('0x40')]=_0x296509[_0x4b14('0x40')][_0x4b14('0x42')]?_0x296509[_0x4b14('0x40')]:_0x2b120e[_0x4b14('0x3b')];if(!_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x43')](_0x4b14('0x44'))){_0x296509[_0x4b14('0x45')]=qs['limit'](_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x45')]);_0x296509[_0x4b14('0x22')]=qs[_0x4b14('0x22')](_0x342e4f['query'][_0x4b14('0x22')]);}_0x296509[_0x4b14('0x46')]=qs[_0x4b14('0x47')](_0x342e4f[_0x4b14('0x3c')]['sort']);_0x296509[_0x4b14('0x48')]=qs[_0x4b14('0x3e')](_[_0x4b14('0x49')](_0x342e4f['query'],_0x2b120e[_0x4b14('0x3e')]),_0x519681);var _0xbfe7b1=[];var _0x5caa6d=squel[_0x4b14('0x4a')]()[_0x4b14('0x4b')]('id')[_0x4b14('0x4b')](_0x4b14('0x2c'))['field'](_0x4b14('0x4c'))['from'](_0x4b14('0x4d'));var _0x59fc79=squel[_0x4b14('0x4a')]()[_0x4b14('0x4b')](_0x4b14('0x4e'))[_0x4b14('0x4b')]('u.fullname')['field'](_0x4b14('0x4f'))[_0x4b14('0x50')](_0x4b14('0x51'),'ui')[_0x4b14('0x52')]('users','u','u.id\x20=\x20ui.UserId');var _0x354947=squel['select']()[_0x4b14('0x50')](_0x4b14('0x53'),'i')[_0x4b14('0x52')](_0x4b14('0x54'),'c',_0x4b14('0x55'))['left_join'](_0x4b14('0x56'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x4b14('0x57'),'a',_0x4b14('0x58'))['left_join'](_0x4b14('0x59'),'me',_0x4b14('0x5a'))[_0x4b14('0x52')](_0x4b14('0x5b'),'it',_0x4b14('0x5c'))[_0x4b14('0x52')]('tools_tags','t',_0x4b14('0x5d'));var _0x3ede45=squel[_0x4b14('0x5e')]();var _0x34f622=[];var _0x4baeb4=squel[_0x4b14('0x5e')]();var _0x5f34e4;if(_0x342e4f['query']['search']){_0x5f34e4=as[_0x4b14('0x5f')](_0x342e4f['query']['search']);var _0x194c4a=_0x5f34e4['sqlOperator'];for(var _0x54dbe9=0x0;_0x54dbe9<_0x5f34e4[_0x4b14('0x60')][_0x4b14('0x42')];_0x54dbe9++){var _0x491b33=_0x5f34e4[_0x4b14('0x60')][_0x54dbe9];var _0xfcc5f4='i';var _0x54b102=_['find'](_0x519681,['name',_0x491b33[_0x4b14('0x4b')]]);if(!_0x54b102){switch(_0x491b33[_0x4b14('0x4b')]){case'unreadMessages':if(_0x491b33[_0x4b14('0x61')]==0x1){_0x354947['having']('`'+_0x491b33[_0x4b14('0x4b')]+_0x4b14('0x62'));}else{_0x354947['having']('`'+_0x491b33[_0x4b14('0x4b')]+_0x4b14('0x63'));}break;case _0x4b14('0x64'):if(_0x491b33[_0x4b14('0x65')]===_0x4b14('0x66')){if(_0x491b33[_0x4b14('0x61')]['split']('\x20')[_0x4b14('0x42')]>0x1){_0x3ede45[_0x194c4a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x491b33[_0x4b14('0x61')]),null);}else{var _0x21865a='%'+_0x491b33[_0x4b14('0x61')]+'%';_0x3ede45[_0x194c4a](_0x4b14('0x67'),_0x21865a,_0x21865a,_0x21865a);}}else{_0x54b102=_[_0x4b14('0x68')](_0x519681,['name',_0x4b14('0x69')]);_0x491b33['field']='ContactId';_0x521b1f=as[_0x4b14('0x6a')](_0xfcc5f4,_0x54b102[_0x4b14('0x3a')],_0x491b33);_0x3ede45[_0x194c4a](_0x521b1f[_0x4b14('0x6b')],_0x521b1f[_0x4b14('0x61')][_0x4b14('0x6c')],_0x521b1f['value']['end']);}break;case _0x4b14('0x6d'):var _0xf29274=_0x491b33[_0x4b14('0x61')][_0x4b14('0x6e')](',')[_0x4b14('0x38')](function(_0x387d8b){return Number(_0x387d8b);});_0xf29274['forEach'](function(_0xe9f708){_0x4baeb4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe9f708+',%');});_0x34f622=_[_0x4b14('0x6f')](_0x34f622,_0xf29274);break;case _0x4b14('0x70'):if(_0x491b33[_0x4b14('0x65')]==='$substring'){_0x3ede45[_0x194c4a](_0x4b14('0x71'),'%'+_0x491b33[_0x4b14('0x61')]+'%',null);}else{_0x54b102=_['find'](_0x519681,[_0x4b14('0x2c'),'UserId']);_0x491b33[_0x4b14('0x4b')]=_0x4b14('0x72');_0x521b1f=as[_0x4b14('0x6a')](_0xfcc5f4,_0x54b102[_0x4b14('0x3a')],_0x491b33);_0x3ede45[_0x194c4a](_0x521b1f[_0x4b14('0x6b')],_0x521b1f[_0x4b14('0x61')]['start'],_0x521b1f['value'][_0x4b14('0x1f')]);}break;case _0x4b14('0x73'):_0x521b1f=as[_0x4b14('0x6a')]('me',null,_0x491b33);_0x3ede45[_0x194c4a](_0x521b1f['text'],_0x521b1f[_0x4b14('0x61')][_0x4b14('0x6c')],_0x521b1f[_0x4b14('0x61')][_0x4b14('0x1f')]);break;}}else{var _0x521b1f=as[_0x4b14('0x6a')](_0xfcc5f4,_0x54b102['type'],_0x491b33);_0x3ede45[_0x194c4a](_0x521b1f[_0x4b14('0x6b')],_0x521b1f['value'][_0x4b14('0x6c')],_0x521b1f[_0x4b14('0x61')]['end']);}}}else{var _0x5d7e0d=_(_0x342e4f['query'])[_0x4b14('0x3d')]()[_0x4b14('0x38')](function(_0x12ba5a){return _[_0x4b14('0x74')](_0x519681,[_0x4b14('0x2c'),_0x12ba5a])?_0x12ba5a:undefined;})[_0x4b14('0x75')]()[_0x4b14('0x61')]();if(!_[_0x4b14('0x76')](_0x5d7e0d)){_0x5d7e0d[_0x4b14('0x30')](function(_0x4cf618){if(_0x4cf618===_0x4b14('0x77')){_0x354947['where'](_0x4b14('0x78'),[][_0x4b14('0x79')](_0x342e4f[_0x4b14('0x3c')][_0x4cf618]));}else if(_0x4cf618===_0x4b14('0x7a')){var _0x23ae79=JSON[_0x4b14('0x7b')](_0x342e4f['query'][_0x4cf618])[_0x4b14('0x7c')];var _0x2beb97=JSON[_0x4b14('0x7b')](_0x342e4f[_0x4b14('0x3c')][_0x4cf618])[_0x4b14('0x7d')];_0x354947[_0x4b14('0x48')](_0x4b14('0x7e'),_0x23ae79,_0x2beb97);}else{if(_0x342e4f[_0x4b14('0x3c')][_0x4cf618]==='null'){_0x354947[_0x4b14('0x48')]('i.'+_0x4cf618+_0x4b14('0x7f'));}else{_0x354947[_0x4b14('0x48')]('i.'+_0x4cf618+_0x4b14('0x80'),_0x342e4f[_0x4b14('0x3c')][_0x4cf618]);}}});}if(_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x81')]){if(_0x342e4f[_0x4b14('0x3c')]['read']==0x1){_0x354947['having'](_0x4b14('0x82'));}else{_0x354947['having'](_0x4b14('0x83'));}}if(_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x84')]){_0x34f622=_[_0x4b14('0x85')](_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x84')])?_0x342e4f['query'][_0x4b14('0x84')]:new Array(_0x342e4f[_0x4b14('0x3c')]['tag']);_0x34f622[_0x4b14('0x30')](function(_0x379aeb){_0x4baeb4['or'](_0x4b14('0x86'),'%,'+_0x379aeb+',%');});}if(_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x87')]){var _0xd52574=_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x87')]['replace']('\x5c','\x5c\x5c')[_0x4b14('0x88')](/'/g,'\x27\x27');if(qs[_0x4b14('0x89')](_0xd52574)){_0x3ede45['or'](_0x4b14('0x8a'),_0xd52574+'%');}else if(qs[_0x4b14('0x8b')](_0xd52574)){_0x3ede45['or'](_0x4b14('0x8c'),_0xd52574+'%');}else{_0x3ede45['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b14('0x8d')](_0xd52574))['or'](_0x4b14('0x8e'),qs[_0x4b14('0x8d')](_0xd52574));}}}_0x354947[_0x4b14('0x48')](_0x3ede45);_0x354947[_0x4b14('0x8f')]('i.id');var _0x2eada6={'type':db[_0x4b14('0x90')]['QueryTypes'][_0x4b14('0x91')],'raw':!![]};var _0x576223=_0x354947['clone']();_0x576223[_0x4b14('0x4b')](_0x4b14('0x92'));_0x576223[_0x4b14('0x4b')](_0x4b14('0x93'),_0x4b14('0x94'));if(_0x296509[_0x4b14('0x46')]){_0x296509[_0x4b14('0x46')][_0x4b14('0x30')](function(_0x158f31){var _0x2a8828=_0x158f31[0x0]===_0x4b14('0x95')?_0x158f31[0x0]:'i.'+_0x158f31[0x0];_0x354947['order'](_0x2a8828,_0x158f31[0x1]===_0x4b14('0x96')?![]:!![]);});}if(!_[_0x4b14('0x76')](_0x34f622)){_0x354947[_0x4b14('0x97')](_0x4baeb4);_0x576223['where']('t.id\x20IN\x20?',_0x34f622);}BPromise[_0x4b14('0x98')]()[_0x4b14('0x29')](function(){if(!_0x5f34e4){if(_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x77')])return;_0x576223['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x354947[_0x4b14('0x48')](_0x4b14('0x99'));return;}if(_0x342e4f[_0x4b14('0x9a')]['role']!==_0x4b14('0x9b'))return;return _0x342e4f[_0x4b14('0x9a')][_0x4b14('0x9c')]({'attributes':['id'],'raw':!![]})[_0x4b14('0x29')](function(_0x5d522f){if(_[_0x4b14('0x76')](_0x5d522f)){_0x576223['where'](_0x4b14('0x9d'));_0x354947['where'](_0x4b14('0x9d'));}else{_0x576223[_0x4b14('0x48')](_0x4b14('0x78'),_[_0x4b14('0x38')](_0x5d522f,'id'));_0x354947[_0x4b14('0x48')](_0x4b14('0x78'),_[_0x4b14('0x38')](_0x5d522f,'id'));}});})[_0x4b14('0x29')](function(){if(_0x342e4f[_0x4b14('0x9a')][_0x4b14('0x9e')]==='agent'&&!_0x5f34e4&&!_0x342e4f[_0x4b14('0x3c')]['MailAccountId'])return[];return db[_0x4b14('0x9f')][_0x4b14('0x3c')](_0x576223[_0x4b14('0xa0')](),_0x2eada6);})[_0x4b14('0x29')](function(_0x30ec15){_0x36b367[_0x4b14('0x21')]=_0x30ec15[_0x4b14('0x42')];if(_0x36b367['count']===0x0)return[];return db[_0x4b14('0x9f')][_0x4b14('0x3c')](_0x5caa6d[_0x4b14('0xa0')](),_0x2eada6)['then'](function(_0x480921){_0xbfe7b1=_[_0x4b14('0xa1')](_0x480921,'id');_0x2eada6=_[_0x4b14('0xa2')](_0x2eada6,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x342e4f[_0x4b14('0x3c')][_0x4b14('0x41')]){_0x296509[_0x4b14('0x40')][_0x4b14('0x30')](function(_0x834a09){_0x354947[_0x4b14('0x4b')]('i.'+_0x834a09);});}else{_0x354947['field'](_0x4b14('0x93'),'unreadMessages');_0x354947['field'](_0x4b14('0xa3'),'Account.key');_0x354947[_0x4b14('0x4b')](_0x4b14('0xa4'),_0x4b14('0xa5'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xa6'),'contactName');_0x354947['field']('i.id');_0x354947['field'](_0x4b14('0xa7'));_0x354947[_0x4b14('0x4b')]('i.updatedAt');_0x354947[_0x4b14('0x4b')]('i.closed');_0x354947[_0x4b14('0x4b')](_0x4b14('0xa8'));_0x354947['field'](_0x4b14('0xa9'));_0x354947[_0x4b14('0x4b')]('i.lastMsgAt');_0x354947[_0x4b14('0x4b')](_0x4b14('0xaa'));_0x354947[_0x4b14('0x4b')]('i.subject');_0x354947['field'](_0x4b14('0xab'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xac'));_0x354947[_0x4b14('0x4b')]('i.thirdDisposition');_0x354947['field'](_0x4b14('0xad'));_0x354947['field'](_0x4b14('0xae'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xaf'));_0x354947['field'](_0x4b14('0xb0'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xb1'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xb2'),_0x4b14('0xb3'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xb4'),_0x4b14('0xb5'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xb6'),_0x4b14('0xb7'));_0x354947['field']('c.phone',_0x4b14('0xb8'));_0x354947['field'](_0x4b14('0xb9'),_0x4b14('0xba'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xbb'),_0x4b14('0xbc'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xbd'),_0x4b14('0xbe'));_0x354947[_0x4b14('0x4b')](_0x4b14('0xbf'),'Owner.internal');_0x354947[_0x4b14('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4b14('0x32'));}if(_0x296509[_0x4b14('0x45')])_0x354947[_0x4b14('0x45')](_0x296509[_0x4b14('0x45')]);if(_0x296509[_0x4b14('0x22')])_0x354947['offset'](_0x296509[_0x4b14('0x22')]);return db[_0x4b14('0x9f')]['query'](_0x354947[_0x4b14('0xa0')](),_0x2eada6);})['then'](function(_0x390fe5){_0x59fc79[_0x4b14('0x48')](_0x4b14('0xc0'),_[_0x4b14('0x38')](_0x390fe5,'id'));return db[_0x4b14('0x9f')][_0x4b14('0x3c')](_0x59fc79[_0x4b14('0xa0')](),_0x2eada6)[_0x4b14('0x29')](function(_0xad9669){var _0x7dbda5=_[_0x4b14('0xc1')](_0xad9669,_0x4b14('0xc2'));var _0x483595=[];return db['Setting'][_0x4b14('0xc3')]({'attributes':[_0x4b14('0xc4')],'raw':!![]})['then'](function(_0x4aef86){var _0x5d7e20=_0x4aef86[_0x4b14('0xc4')];_0x390fe5[_0x4b14('0x30')](function(_0x29962b){_0x483595[_0x4b14('0x31')](updateMailInteraction(_0x29962b,_0xbfe7b1,_0x7dbda5,_0x5d7e20));});return BPromise['all'](_0x483595);});});});})[_0x4b14('0x29')](function(_0x8155f4){_0x36b367[_0x4b14('0xc5')]=_0x8155f4;return _0x36b367;})[_0x4b14('0x29')](respondWithFilteredResult(_0x26a6e5,_0x296509))[_0x4b14('0x37')](handleError(_0x26a6e5,null));};exports[_0x4b14('0xc6')]=function(_0x5d39b4,_0x8a93d0){var _0x253588={'raw':![],'where':{'id':_0x5d39b4['params']['id']}},_0x41efc9={};_0x41efc9[_0x4b14('0x3b')]=_[_0x4b14('0x3d')](db[_0x4b14('0x33')][_0x4b14('0xc7')]);_0x41efc9[_0x4b14('0x3c')]=_['keys'](_0x5d39b4[_0x4b14('0x3c')]);_0x41efc9['filters']=_['intersection'](_0x41efc9[_0x4b14('0x3b')],_0x41efc9[_0x4b14('0x3c')]);_0x253588[_0x4b14('0x40')]=_[_0x4b14('0x3f')](_0x41efc9[_0x4b14('0x3b')],qs[_0x4b14('0x41')](_0x5d39b4[_0x4b14('0x3c')][_0x4b14('0x41')]));_0x253588['attributes']=_0x253588[_0x4b14('0x40')]['length']?_0x253588['attributes']:_0x41efc9[_0x4b14('0x3b')];if(_0x5d39b4[_0x4b14('0x3c')][_0x4b14('0xc8')]){_0x253588[_0x4b14('0xc9')]=[{'all':!![]}];}_0x253588=_[_0x4b14('0xa2')]({},_0x253588,_0x5d39b4[_0x4b14('0xca')]);return db[_0x4b14('0x33')][_0x4b14('0x68')](_0x253588)[_0x4b14('0x29')](handleEntityNotFound(_0x8a93d0,null))[_0x4b14('0x29')](respondWithResult(_0x8a93d0,null))['catch'](handleError(_0x8a93d0,null));};exports[_0x4b14('0xcb')]=function(_0x44b252,_0x536b92){return db[_0x4b14('0x33')][_0x4b14('0xcb')](_0x44b252[_0x4b14('0xcc')],{})['then'](respondWithResult(_0x536b92,0xc9))[_0x4b14('0x37')](handleError(_0x536b92,null));};exports[_0x4b14('0x28')]=function(_0x2e62e0,_0x1cc4a0){if(_0x2e62e0[_0x4b14('0xcc')]['id']){delete _0x2e62e0[_0x4b14('0xcc')]['id'];}return db[_0x4b14('0x33')]['find']({'where':{'id':_0x2e62e0[_0x4b14('0xcd')]['id']}})[_0x4b14('0x29')](handleEntityNotFound(_0x1cc4a0,null))[_0x4b14('0x29')](saveUpdates(_0x2e62e0[_0x4b14('0xcc')],null))[_0x4b14('0x29')](respondWithResult(_0x1cc4a0,null))['catch'](handleError(_0x1cc4a0,null));};exports[_0x4b14('0x2a')]=function(_0x8edabf,_0x5a117d){return db[_0x4b14('0x33')][_0x4b14('0x68')]({'where':{'id':_0x8edabf[_0x4b14('0xcd')]['id']}})['then'](handleEntityNotFound(_0x5a117d,null))[_0x4b14('0x29')](removeEntity(_0x5a117d,null))[_0x4b14('0x37')](handleError(_0x5a117d,null));};exports['describe']=function(_0x49a528,_0x498d94){return db['MailInteraction'][_0x4b14('0xce')]()[_0x4b14('0x29')](respondWithResult(_0x498d94,null))[_0x4b14('0x37')](handleError(_0x498d94,null));};exports[_0x4b14('0xcf')]=function(_0x4a6616,_0x4a7749,_0x589829){return db[_0x4b14('0xd0')]['find']({'where':{'id':_0x4a6616[_0x4b14('0xcd')]['id']}})['then'](handleEntityNotFound(_0x4a7749,null))[_0x4b14('0x29')](function(_0x5889f5){if(_0x5889f5){return _0x5889f5[_0x4b14('0xcf')](_0x4a6616[_0x4b14('0xcc')][_0x4b14('0xd1')],_[_0x4b14('0xd2')](_0x4a6616[_0x4b14('0xcc')],[_0x4b14('0xd1'),'id'])||{});}})[_0x4b14('0x29')](respondWithResult(_0x4a7749,null))[_0x4b14('0x37')](handleError(_0x4a7749,null));};exports[_0x4b14('0xd3')]=function(_0x6f20ed,_0x174f56,_0x1f9abf){var _0x488bdc={'raw':![],'where':{}};var _0x17aa63={};var _0x366077={'count':0x0,'rows':[]};return db[_0x4b14('0x33')][_0x4b14('0xc3')]({'where':{'id':_0x6f20ed[_0x4b14('0xcd')]['id']}})[_0x4b14('0x29')](handleEntityNotFound(_0x174f56,null))[_0x4b14('0x29')](function(_0x2153fa){if(_0x2153fa){_0x17aa63[_0x4b14('0x3b')]=_[_0x4b14('0x3d')](db[_0x4b14('0xd0')]['rawAttributes']);_0x17aa63['query']=_[_0x4b14('0x3d')](_0x6f20ed[_0x4b14('0x3c')]);_0x17aa63['filters']=_[_0x4b14('0x3f')](_0x17aa63[_0x4b14('0x3b')],_0x17aa63['query']);_0x488bdc[_0x4b14('0x40')]=_[_0x4b14('0x3f')](_0x17aa63[_0x4b14('0x3b')],qs[_0x4b14('0x41')](_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0x41')]));_0x488bdc['attributes']=_0x488bdc[_0x4b14('0x40')][_0x4b14('0x42')]?_0x488bdc[_0x4b14('0x40')]:_0x17aa63[_0x4b14('0x3b')];if(!_0x6f20ed[_0x4b14('0x3c')]['hasOwnProperty']('nolimit')){_0x488bdc['limit']=qs['limit'](_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0x45')]);_0x488bdc[_0x4b14('0x22')]=qs['offset'](_0x6f20ed[_0x4b14('0x3c')]['offset']);}_0x488bdc[_0x4b14('0x46')]=qs[_0x4b14('0x47')](_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0x47')]);_0x488bdc[_0x4b14('0x48')]=qs['filters'](_[_0x4b14('0x49')](_0x6f20ed[_0x4b14('0x3c')],_0x17aa63['filters']));_0x488bdc['where'][_0x4b14('0xc2')]=_0x2153fa['id'];if(_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0x87')]){_0x488bdc[_0x4b14('0x48')]=_[_0x4b14('0xa2')](_0x488bdc[_0x4b14('0x48')],{'$or':_[_0x4b14('0x38')](_0x488bdc[_0x4b14('0x40')],function(_0x5efa90){var _0x46db77={};_0x46db77[_0x5efa90]={'$like':'%'+_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0x87')]+'%'};return _0x46db77;})});}if(_0x6f20ed['query'][_0x4b14('0x7c')]){var _0x193ce5=_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0x7c')]['split'](',');var _0x42affc={};_0x42affc[_0x193ce5[0x0]]={'$gte':moment(_0x193ce5[0x1])['format'](_0x4b14('0xd4'))};_0x488bdc['where']=_['merge'](_0x488bdc['where'],_0x42affc);}_0x488bdc=_[_0x4b14('0xa2')]({},_0x488bdc,_0x6f20ed['options']);return db['MailMessage']['count']({'where':_0x488bdc['where']})[_0x4b14('0x29')](function(_0x2a6db6){_0x366077['count']=_0x2a6db6;if(_0x6f20ed[_0x4b14('0x3c')][_0x4b14('0xc8')]){_0x488bdc[_0x4b14('0xc9')]=[{'all':!![]}];}return db[_0x4b14('0xd0')]['findAll'](_0x488bdc);})[_0x4b14('0x29')](function(_0x23400a){_0x366077['rows']=_0x23400a;return _0x366077;});}})[_0x4b14('0x29')](respondWithFilteredResult(_0x174f56,_0x488bdc))['catch'](handleError(_0x174f56,null));};exports[_0x4b14('0xd5')]=function(_0x53d6c4,_0x10fda4,_0xd46477){return db[_0x4b14('0x33')][_0x4b14('0x68')]({'where':{'id':_0x53d6c4[_0x4b14('0xcd')]['id']}})['then'](handleEntityNotFound(_0x10fda4,null))['then'](function(_0x4c247e){if(_0x4c247e){return _0x4c247e[_0x4b14('0xd6')](_0x53d6c4[_0x4b14('0xcc')]['ids'],_[_0x4b14('0xd2')](_0x53d6c4[_0x4b14('0xcc')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x4b14('0xd7')]({'attributes':['id',_0x4b14('0x2c'),_0x4b14('0x4c')],'where':{'id':_0x53d6c4['body'][_0x4b14('0xd1')]}});})['then'](function(_0x46cade){socket['emit'](_0x4b14('0xd8'),{'id':Number(_0x53d6c4['params']['id']),'tags':_0x46cade||[]});return{'id':Number(_0x53d6c4[_0x4b14('0xcd')]['id']),'tags':_0x46cade||[]};});}})[_0x4b14('0x29')](respondWithResult(_0x10fda4,null))[_0x4b14('0x37')](handleError(_0x10fda4,null));};exports['removeTags']=function(_0x3b501b,_0x278502,_0x199a9b){return db[_0x4b14('0x33')][_0x4b14('0x68')]({'where':{'id':_0x3b501b['params']['id']}})[_0x4b14('0x29')](handleEntityNotFound(_0x278502,null))['then'](function(_0xc03d18){if(_0xc03d18){return _0xc03d18[_0x4b14('0xd9')](_0x3b501b[_0x4b14('0x3c')]['ids']);}})[_0x4b14('0x29')](respondWithStatusCode(_0x278502,null))['catch'](handleError(_0x278502,null));};exports[_0x4b14('0xda')]=function(_0x3b8408,_0x1a14ce){var _0x18e17e=moment()[_0x4b14('0xdb')]()[_0x4b14('0xa0')]();var _0x1f6938=path[_0x4b14('0xdc')](config['root'],_0x4b14('0xdd'),_0x4b14('0xde'),_0x4b14('0xdf'));var _0x23eba8=path['join'](config[_0x4b14('0xe0')],'server',_0x4b14('0xde'),_0x4b14('0xe1'));var _0x2f7080=path[_0x4b14('0xdc')](_0x1f6938,_0x18e17e);var _0x33c580=util['format'](_0x4b14('0xe2'),_0x3b8408[_0x4b14('0xcd')]['id'],_0x18e17e);var _0x362727=path[_0x4b14('0xdc')](_0x1f6938,_0x33c580);var _0x4b600d=[];if(_0x3b8408[_0x4b14('0x3c')][_0x4b14('0xe1')]){_0x4b600d[_0x4b14('0x31')]({'model':db[_0x4b14('0xe3')],'as':'Attachments','raw':!![]});}var _0x3c1ed3=[{'model':db['MailMessage'],'as':_0x4b14('0xe4'),'attributes':['id',_0x4b14('0xcc'),_0x4b14('0x50'),'to','cc',_0x4b14('0xe5'),_0x4b14('0xe6'),_0x4b14('0x7a')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4b600d}];return db[_0x4b14('0x33')][_0x4b14('0x68')]({'where':{'id':_0x3b8408[_0x4b14('0xcd')]['id']},'include':_0x3c1ed3})[_0x4b14('0x29')](handleEntityNotFound(_0x1a14ce,null))[_0x4b14('0x29')](function(_0xef3639){if(_0xef3639&&_0xef3639[_0x4b14('0xe4')]){var _0x25abd6=_0xef3639['get']({'plain':!![]});fs[_0x4b14('0xe7')](_0x2f7080);return BPromise[_0x4b14('0xe8')](_0x25abd6[_0x4b14('0xe4')],function(_0x49eb3d,_0x999f5a){var _0x5c4b83={'from':_0x49eb3d[_0x4b14('0x50')],'to':_0x49eb3d['to'],'subject':_0x49eb3d[_0x4b14('0xe6')],'html':_0x49eb3d[_0x4b14('0xcc')],'headers':{'Date':moment(_0x49eb3d['createdAt'])[_0x4b14('0xe9')](_0x4b14('0xea'))},'attachments':[]};if(_0x49eb3d['cc']){_0x5c4b83['headers']['Cc']=_0x49eb3d['cc'];}if(_0x49eb3d[_0x4b14('0xe5')]){_0x5c4b83[_0x4b14('0xeb')][_0x4b14('0xec')]=_0x49eb3d['bcc'];}return new BPromise(function(_0x1887c3,_0x1cc870){if(_0x49eb3d[_0x4b14('0xed')]){for(var _0x174f2e=0x0;_0x174f2e<_0x49eb3d['Attachments'][_0x4b14('0x42')];_0x174f2e++){var _0x1a0aa9=_0x49eb3d[_0x4b14('0xed')][_0x174f2e];var _0x124cfc=path[_0x4b14('0xdc')](_0x23eba8,_0x1a0aa9[_0x4b14('0xee')]);if(fs['existsSync'](_0x124cfc)){_0x5c4b83[_0x4b14('0xe1')][_0x4b14('0x31')]({'name':_0x1a0aa9[_0x4b14('0x2c')],'contentType':_0x1a0aa9[_0x4b14('0x3a')],'data':fs[_0x4b14('0xef')](_0x124cfc)});}}}emlformat['build'](_0x5c4b83,function(_0x3461dd,_0x1cd4a9){if(_0x3461dd)return _0x1cc870(_0x3461dd);fs['writeFileSync'](path[_0x4b14('0xdc')](_0x2f7080,util['format']('message%d.eml',_0x999f5a)),_0x1cd4a9);return _0x1887c3(_0x1cd4a9);});});})[_0x4b14('0x29')](function(){return new BPromise(function(_0x3a6f76,_0x192bc6){zipdir(_0x2f7080,{'saveTo':_0x362727},function(_0x4508a4,_0xcd8955){if(_0x4508a4)return _0x192bc6(_0x4508a4);return _0x3a6f76(_0xcd8955);});})['then'](function(){return new BPromise(function(_0xb2e061,_0x30719d){rimraf(_0x2f7080,function(_0x2b1c3b){if(_0x2b1c3b)_0x30719d(_0x2b1c3b);return _0xb2e061();});});})[_0x4b14('0x29')](function(){return _0x1a14ce[_0x4b14('0xda')](_0x362727,_0x33c580,function(_0x4f360f){if(_0x4f360f){console[_0x4b14('0xf0')](_0x4b14('0xf1'),_0x4f360f);}else{fs['unlinkSync'](_0x362727);}});});});}else{return _0x1a14ce['sendStatus'](0xc8);}})[_0x4b14('0x37')](handleError(_0x1a14ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index fe9ef40..d3a4105 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 _0x6ad1=['emit','catch','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length'];(function(_0x239b16,_0x51ce2b){var _0x5547e7=function(_0x4a5ef5){while(--_0x4a5ef5){_0x239b16['push'](_0x239b16['shift']());}};_0x5547e7(++_0x51ce2b);}(_0x6ad1,0x1e0));var _0x16ad=function(_0x3e9329,_0x2bc7d6){_0x3e9329=_0x3e9329-0x0;var _0xd2035=_0x6ad1[_0x3e9329];return _0xd2035;};'use strict';var EventEmitter=require(_0x16ad('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x16ad('0x1')];var MailMessage=require(_0x16ad('0x2'))['db'][_0x16ad('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16ad('0x4'),'afterUpdate':_0x16ad('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4b8561){return function(_0x2ea0b2,_0x1ca4df,_0x29fb74){_0x2ea0b2[_0x16ad('0x6')]({'attributes':['id'],'raw':!![]})[_0x16ad('0x7')](function(_0x52a7da){_0x2ea0b2[_0x16ad('0x8')](_0x16ad('0x9'),_0x52a7da['map'](function(_0x214b2d){return{'id':_0x214b2d['id']};}));return MailMessage[_0x16ad('0xa')]({'where':{'MailInteractionId':_0x2ea0b2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16ad('0x7')](function(_0x1a4ae3){_0x2ea0b2[_0x16ad('0x8')](_0x16ad('0xb'),_0x1a4ae3[_0x16ad('0xc')]);MailInteractionEvents[_0x16ad('0xd')](_0x4b8561+':'+_0x2ea0b2['id'],_0x2ea0b2);MailInteractionEvents[_0x16ad('0xd')](_0x4b8561,_0x2ea0b2);_0x29fb74(null);})[_0x16ad('0xe')](_0x29fb74(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x16ad('0xf')](e,emitEvent(event));}}module[_0x16ad('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xbf91=['length','emit','catch','exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','remove','getUsers','map','findAll'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0xbf91,0x1e4));var _0x1bf9=function(_0x27a9c3,_0x57829c){_0x27a9c3=_0x27a9c3-0x0;var _0x464765=_0xbf91[_0x27a9c3];return _0x464765;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x1bf9('0x0')];var MailMessage=require(_0x1bf9('0x1'))['db'][_0x1bf9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1bf9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1bf9('0x4')};function emitEvent(_0x5f3d24){return function(_0x9e18a4,_0x2ad565,_0x299c11){_0x9e18a4[_0x1bf9('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10764d){_0x9e18a4['setDataValue']('Users',_0x10764d[_0x1bf9('0x6')](function(_0x27cf1f){return{'id':_0x27cf1f['id']};}));return MailMessage[_0x1bf9('0x7')]({'where':{'MailInteractionId':_0x9e18a4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x9914e0){_0x9e18a4['setDataValue']('unreadMessages',_0x9914e0[_0x1bf9('0x8')]);MailInteractionEvents[_0x1bf9('0x9')](_0x5f3d24+':'+_0x9e18a4['id'],_0x9e18a4);MailInteractionEvents[_0x1bf9('0x9')](_0x5f3d24,_0x9e18a4);_0x299c11(null);})[_0x1bf9('0xa')](_0x299c11(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x1bf9('0xb')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a9d50cf..d4804ba 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 _0xc343=['../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x1eb72a,_0xd506ef){var _0x582a78=function(_0x123e51){while(--_0x123e51){_0x1eb72a['push'](_0x1eb72a['shift']());}};_0x582a78(++_0xd506ef);}(_0xc343,0x173));var _0x3c34=function(_0x49cc18,_0x46bdbe){_0x49cc18=_0x49cc18-0x0;var _0x39a844=_0xc343[_0x49cc18];return _0x39a844;};'use strict';var _=require(_0x3c34('0x0'));var util=require('util');var logger=require(_0x3c34('0x1'))(_0x3c34('0x2'));var moment=require(_0x3c34('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c34('0x4'));var rimraf=require(_0x3c34('0x5'));var config=require(_0x3c34('0x6'));var attributes=require(_0x3c34('0x7'));module[_0x3c34('0x8')]=function(_0x37ddf8,_0x401457){return _0x37ddf8[_0x3c34('0x9')](_0x3c34('0xa'),attributes,{'tableName':_0x3c34('0xb'),'paranoid':![],'indexes':[{'name':_0x3c34('0xc'),'fields':[_0x3c34('0xd'),'to'],'type':_0x3c34('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4da2f3,_0x182f43,_0x589bc3){if(_0x4da2f3[_0x3c34('0xf')]){_0x4da2f3['substatusAt']=moment()[_0x3c34('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4da2f3[_0x3c34('0x11')]){_0x4da2f3[_0x3c34('0x12')]=moment()[_0x3c34('0x10')](_0x3c34('0x13'));}_0x589bc3(null,_0x182f43);},'beforeUpdate':function(_0x58a87f,_0x4c3828,_0xaf9a20){if(_0x58a87f[_0x3c34('0x14')]('substatus')){_0x58a87f[_0x3c34('0x15')]=_0x58a87f[_0x3c34('0xf')]?moment()['format'](_0x3c34('0x13')):null;}if(_0x58a87f[_0x3c34('0x14')](_0x3c34('0x11'))){_0x58a87f[_0x3c34('0x12')]=moment()[_0x3c34('0x10')](_0x3c34('0x13'));_0x58a87f[_0x3c34('0xf')]=null;_0x58a87f['substatusAt']=null;}_0xaf9a20(null,_0x58a87f);},'afterUpdate':function(_0x429029,_0x2a3f6c,_0x206a7a){var _0x2b01ad=_0x37ddf8['models'];var _0x33c473=_0x429029[_0x3c34('0x16')]({'plain':!![]});if(_0x33c473[_0x3c34('0x11')]){return _0x2b01ad[_0x3c34('0x17')][_0x3c34('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x33c473['id']}})[_0x3c34('0x19')](function(){_0x206a7a();})[_0x3c34('0x1a')](function(_0x4dfb41){_0x206a7a(_0x4dfb41);});}else{_0x206a7a();}}},'charset':_0x3c34('0x1b'),'collate':_0x3c34('0x1c')});}; \ No newline at end of file +var _0x4ea3=['substatusAt','format','models','get','MailMessage','then','catch','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed'];(function(_0x15eeed,_0x395a8c){var _0x1284f9=function(_0x2989ca){while(--_0x2989ca){_0x15eeed['push'](_0x15eeed['shift']());}};_0x1284f9(++_0x395a8c);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x34ea('0xb'),'to'],'type':_0x34ea('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x368646,_0x5132c4,_0x301b98){if(_0x368646[_0x34ea('0xd')]){_0x368646['substatusAt']=moment()['format'](_0x34ea('0xe'));}if(_0x368646[_0x34ea('0xf')]){_0x368646[_0x34ea('0x10')]=moment()['format'](_0x34ea('0xe'));}_0x301b98(null,_0x5132c4);},'beforeUpdate':function(_0x29a5c8,_0x10135f,_0x233b11){if(_0x29a5c8[_0x34ea('0x11')](_0x34ea('0xd'))){_0x29a5c8[_0x34ea('0x12')]=_0x29a5c8[_0x34ea('0xd')]?moment()[_0x34ea('0x13')](_0x34ea('0xe')):null;}if(_0x29a5c8[_0x34ea('0x11')]('closed')){_0x29a5c8[_0x34ea('0x10')]=moment()[_0x34ea('0x13')](_0x34ea('0xe'));_0x29a5c8[_0x34ea('0xd')]=null;_0x29a5c8[_0x34ea('0x12')]=null;}_0x233b11(null,_0x29a5c8);},'afterUpdate':function(_0x56b2d7,_0x6a84a7,_0x18c013){var _0x3fa3b0=_0x962596[_0x34ea('0x14')];var _0x5f420f=_0x56b2d7[_0x34ea('0x15')]({'plain':!![]});if(_0x5f420f[_0x34ea('0xf')]){return _0x3fa3b0[_0x34ea('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x5f420f['id']}})[_0x34ea('0x17')](function(){_0x18c013();})[_0x34ea('0x18')](function(_0x33afb2){_0x18c013(_0x33afb2);});}else{_0x18c013();}}},'charset':_0x34ea('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d161a5b..3753404 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 _0x8721=['where','limit','AddTagsToMailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateMailInteraction','update','body','options','raw'];(function(_0x3a742d,_0x28b044){var _0x55c254=function(_0x152a54){while(--_0x152a54){_0x3a742d['push'](_0x3a742d['shift']());}};_0x55c254(++_0x28b044);}(_0x8721,0xd9));var _0x1872=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x8721[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x1872('0x0'));var util=require(_0x1872('0x1'));var moment=require(_0x1872('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1872('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1872('0x4'));var config=require(_0x1872('0x5'));var jayson=require(_0x1872('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1872('0x7')]=_[_0x1872('0x8')](config[_0x1872('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1872('0x9'))(new Redis(config[_0x1872('0x7')]));require(_0x1872('0xa'))[_0x1872('0xb')](socket);function respondWithRpcPromise(_0x1f43c6,_0x1b057e,_0x120590){return new BPromise(function(_0x1c18fc,_0x406daf){return client[_0x1872('0xc')](_0x1f43c6,_0x120590)[_0x1872('0xd')](function(_0x4d93ae){logger[_0x1872('0xe')](_0x1872('0xf'),_0x1b057e,_0x1872('0x10'));logger[_0x1872('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1b057e,_0x1872('0x10'),JSON[_0x1872('0x12')](_0x4d93ae));if(_0x4d93ae[_0x1872('0x13')]){if(_0x4d93ae[_0x1872('0x13')]['code']===0x1f4){logger['error'](_0x1872('0xf'),_0x1b057e,_0x4d93ae[_0x1872('0x13')][_0x1872('0x14')]);return _0x406daf(_0x4d93ae[_0x1872('0x13')][_0x1872('0x14')]);}logger[_0x1872('0x13')]('MailInteraction,\x20%s,\x20%s',_0x1b057e,_0x4d93ae['error'][_0x1872('0x14')]);return _0x1c18fc(_0x4d93ae[_0x1872('0x13')][_0x1872('0x14')]);}else{logger['info'](_0x1872('0xf'),_0x1b057e,'request\x20sent');_0x1c18fc(_0x4d93ae[_0x1872('0x15')][_0x1872('0x14')]);}})[_0x1872('0x16')](function(_0x4d1f11){logger[_0x1872('0x13')]('MailInteraction,\x20%s,\x20%s',_0x1b057e,_0x4d1f11);_0x406daf(_0x4d1f11);});});}exports[_0x1872('0x17')]=function(_0x2b2ffb){var _0x2fabcb=this;return new Promise(function(_0x183267,_0x15dbbc){return db['MailInteraction'][_0x1872('0x18')](_0x2b2ffb[_0x1872('0x19')],{'raw':_0x2b2ffb[_0x1872('0x1a')]?_0x2b2ffb[_0x1872('0x1a')][_0x1872('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b2ffb[_0x1872('0x1a')]?_0x2b2ffb[_0x1872('0x1a')][_0x1872('0x1c')]||null:null,'attributes':_0x2b2ffb[_0x1872('0x1a')]?_0x2b2ffb['options']['attributes']||null:null,'limit':_0x2b2ffb['options']?_0x2b2ffb[_0x1872('0x1a')][_0x1872('0x1d')]||null:null})[_0x1872('0xd')](function(_0x32499a){logger['info'](_0x1872('0x17'),_0x2b2ffb);logger[_0x1872('0x11')](_0x1872('0x17'),_0x2b2ffb,JSON['stringify'](_0x32499a));_0x183267(_0x32499a);})[_0x1872('0x16')](function(_0x576efa){logger[_0x1872('0x13')](_0x1872('0x17'),_0x576efa[_0x1872('0x14')],_0x2b2ffb);_0x15dbbc(_0x2fabcb['error'](0x1f4,_0x576efa[_0x1872('0x14')]));});});};exports[_0x1872('0x1e')]=function(_0x57c3c2){return new Promise(function(_0x4dca12,_0x33448e){return db['MailInteraction']['find']({'where':_0x57c3c2[_0x1872('0x1a')]?_0x57c3c2['options'][_0x1872('0x1c')]||null:null})[_0x1872('0xd')](function(_0x4f9457){if(_0x4f9457){return _0x4f9457[_0x1872('0x1f')](_0x57c3c2[_0x1872('0x19')][_0x1872('0x20')],_['omit'](_0x57c3c2[_0x1872('0x19')],[_0x1872('0x20'),'id'])||{});}})[_0x1872('0x21')](function(_0x2380c6){logger[_0x1872('0xe')]('AddTags',_0x57c3c2);logger[_0x1872('0x11')](_0x1872('0x22'),_0x57c3c2,JSON[_0x1872('0x12')](_0x2380c6));_0x4dca12(_0x2380c6);})[_0x1872('0x16')](function(_0x3d620c){logger[_0x1872('0x13')]('AddTags',_0x3d620c[_0x1872('0x14')],_0x57c3c2);_0x33448e(_this[_0x1872('0x13')](0x1f4,_0x3d620c[_0x1872('0x14')]));});});}; \ No newline at end of file +var _0x5eb1=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','catch','MailInteraction','update','options','raw','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','debug','AddTags','util','moment','bluebird','randomstring','ioredis'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x5eb1,0x7c));var _0x15eb=function(_0x2abd62,_0x36911e){_0x2abd62=_0x2abd62-0x0;var _0x1c41af=_0x5eb1[_0x2abd62];return _0x1c41af;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var moment=require(_0x15eb('0x1'));var BPromise=require(_0x15eb('0x2'));var rs=require(_0x15eb('0x3'));var fs=require('fs');var Redis=require(_0x15eb('0x4'));var db=require(_0x15eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15eb('0x6'))(_0x15eb('0x7'));var config=require(_0x15eb('0x8'));var jayson=require(_0x15eb('0x9'));var client=jayson['client'][_0x15eb('0xa')]({'port':0x232a});config[_0x15eb('0xb')]=_['defaults'](config[_0x15eb('0xb')],{'host':_0x15eb('0xc'),'port':0x18eb});var socket=require(_0x15eb('0xd'))(new Redis(config[_0x15eb('0xb')]));require(_0x15eb('0xe'))[_0x15eb('0xf')](socket);function respondWithRpcPromise(_0x412db6,_0x1481ae,_0x295e45){return new BPromise(function(_0x31e040,_0x3f08c1){return client[_0x15eb('0x10')](_0x412db6,_0x295e45)[_0x15eb('0x11')](function(_0x56c25c){logger[_0x15eb('0x12')]('MailInteraction,\x20%s,\x20%s',_0x1481ae,'request\x20sent');logger['debug'](_0x15eb('0x13'),_0x1481ae,_0x15eb('0x14'),JSON[_0x15eb('0x15')](_0x56c25c));if(_0x56c25c[_0x15eb('0x16')]){if(_0x56c25c['error'][_0x15eb('0x17')]===0x1f4){logger[_0x15eb('0x16')](_0x15eb('0x18'),_0x1481ae,_0x56c25c[_0x15eb('0x16')]['message']);return _0x3f08c1(_0x56c25c['error']['message']);}logger['error'](_0x15eb('0x18'),_0x1481ae,_0x56c25c['error']['message']);return _0x31e040(_0x56c25c[_0x15eb('0x16')]['message']);}else{logger[_0x15eb('0x12')]('MailInteraction,\x20%s,\x20%s',_0x1481ae,_0x15eb('0x14'));_0x31e040(_0x56c25c['result'][_0x15eb('0x19')]);}})[_0x15eb('0x1a')](function(_0x5cc4b1){logger[_0x15eb('0x16')](_0x15eb('0x18'),_0x1481ae,_0x5cc4b1);_0x3f08c1(_0x5cc4b1);});});}exports['UpdateMailInteraction']=function(_0x12f52d){var _0x42c659=this;return new Promise(function(_0x205cd5,_0x149332){return db[_0x15eb('0x1b')][_0x15eb('0x1c')](_0x12f52d['body'],{'raw':_0x12f52d[_0x15eb('0x1d')]?_0x12f52d['options'][_0x15eb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12f52d['options']?_0x12f52d[_0x15eb('0x1d')]['where']||null:null,'attributes':_0x12f52d[_0x15eb('0x1d')]?_0x12f52d[_0x15eb('0x1d')][_0x15eb('0x1f')]||null:null,'limit':_0x12f52d[_0x15eb('0x1d')]?_0x12f52d[_0x15eb('0x1d')][_0x15eb('0x20')]||null:null})[_0x15eb('0x11')](function(_0x44207c){logger[_0x15eb('0x12')](_0x15eb('0x21'),_0x12f52d);logger['debug'](_0x15eb('0x21'),_0x12f52d,JSON[_0x15eb('0x15')](_0x44207c));_0x205cd5(_0x44207c);})[_0x15eb('0x1a')](function(_0x3f655b){logger[_0x15eb('0x16')](_0x15eb('0x21'),_0x3f655b[_0x15eb('0x19')],_0x12f52d);_0x149332(_0x42c659['error'](0x1f4,_0x3f655b['message']));});});};exports[_0x15eb('0x22')]=function(_0x1def52){return new Promise(function(_0x62c8ff,_0xa1ea61){return db['MailInteraction'][_0x15eb('0x23')]({'where':_0x1def52['options']?_0x1def52[_0x15eb('0x1d')]['where']||null:null})[_0x15eb('0x11')](function(_0x6447d){if(_0x6447d){return _0x6447d[_0x15eb('0x24')](_0x1def52[_0x15eb('0x25')][_0x15eb('0x26')],_[_0x15eb('0x27')](_0x1def52['body'],[_0x15eb('0x26'),'id'])||{});}})[_0x15eb('0x28')](function(_0x43f00d){logger['info']('AddTags',_0x1def52);logger[_0x15eb('0x29')](_0x15eb('0x2a'),_0x1def52,JSON['stringify'](_0x43f00d));_0x62c8ff(_0x43f00d);})['catch'](function(_0x4fdcfb){logger[_0x15eb('0x16')]('AddTags',_0x4fdcfb[_0x15eb('0x19')],_0x1def52);_0xa1ea61(_this[_0x15eb('0x16')](0x1f4,_0x4fdcfb['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 008d001..1ef78ce 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 _0xc37d=['removeListener','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x3df5e1,_0x382296){var _0x124ada=function(_0x407a54){while(--_0x407a54){_0x3df5e1['push'](_0x3df5e1['shift']());}};_0x124ada(++_0x382296);}(_0xc37d,0xa4));var _0xdc37=function(_0x25b301,_0x34048c){_0x25b301=_0x25b301-0x0;var _0x14f0ec=_0xc37d[_0x25b301];return _0x14f0ec;};'use strict';var MailInteractionEvents=require(_0xdc37('0x0'));var events=[_0xdc37('0x1'),_0xdc37('0x2'),'update'];function createListener(_0x20a9b6,_0x1c2766){return function(_0x16fb1e){_0x1c2766[_0xdc37('0x3')](_0x20a9b6,_0x16fb1e);};}function removeListener(_0x376b18,_0x3df0e4){return function(){MailInteractionEvents[_0xdc37('0x4')](_0x376b18,_0x3df0e4);};}exports['register']=function(_0x370ece){for(var _0x2e465c=0x0,_0x2d4ef6=events[_0xdc37('0x5')];_0x2e465c<_0x2d4ef6;_0x2e465c++){var _0x5b8e97=events[_0x2e465c];var _0x1c8ccf=createListener(_0xdc37('0x6')+_0x5b8e97,_0x370ece);MailInteractionEvents['on'](_0x5b8e97,_0x1c8ccf);}}; \ No newline at end of file +var _0x822a=['mailInteraction:','save','remove','update','removeListener'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x822a,0xc9));var _0xa822=function(_0x3b6d58,_0xb29c70){_0x3b6d58=_0x3b6d58-0x0;var _0x64d7dc=_0x822a[_0x3b6d58];return _0x64d7dc;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa822('0x0'),_0xa822('0x1'),_0xa822('0x2')];function createListener(_0x5cab74,_0x2d4f40){return function(_0x4a8c9d){_0x2d4f40['emit'](_0x5cab74,_0x4a8c9d);};}function removeListener(_0x32daff,_0xe60fb0){return function(){MailInteractionEvents[_0xa822('0x3')](_0x32daff,_0xe60fb0);};}exports['register']=function(_0x29a0b9){for(var _0x4b2d8a=0x0,_0x4bf30e=events['length'];_0x4b2d8a<_0x4bf30e;_0x4b2d8a++){var _0x51c915=events[_0x4b2d8a];var _0x28ed02=createListener(_0xa822('0x4')+_0x51c915,_0x29a0b9);MailInteractionEvents['on'](_0x51c915,_0x28ed02);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6d20c97..fc4351d 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 _0x55ca=['get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x24020c,_0x5b647e){var _0x36a522=function(_0x5c5e92){while(--_0x5c5e92){_0x24020c['push'](_0x24020c['shift']());}};_0x36a522(++_0x5b647e);}(_0x55ca,0x126));var _0xa55c=function(_0x514846,_0x34ac8d){_0x514846=_0x514846-0x0;var _0x2627a8=_0x55ca[_0x514846];return _0x2627a8;};'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 auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/download',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),interaction[_0xa55c('0xe')](_0xa55c('0xf'),_0xa55c('0x10')),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xa55c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xa55c('0x12')](_0xa55c('0x14'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0x13'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);module[_0xa55c('0x18')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x46a6ef,_0x4aba4e){var _0xf92c60=function(_0x49d803){while(--_0x49d803){_0x46a6ef['push'](_0x46a6ef['shift']());}};_0xf92c60(++_0x4aba4e);}(_0x3e74,0x175));var _0x43e7=function(_0x5c004a,_0x4ed594){_0x5c004a=_0x5c004a-0x0;var _0x2b4bbe=_0x3e74[_0x5c004a];return _0x2b4bbe;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 412d079..4a848fb 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 _0x2f68=['exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash'];(function(_0x5e933d,_0x265e64){var _0x31f8a8=function(_0x2e56da){while(--_0x2e56da){_0x5e933d['push'](_0x5e933d['shift']());}};_0x31f8a8(++_0x265e64);}(_0x2f68,0x12b));var _0x82f6=function(_0x41a291,_0x34def2){_0x41a291=_0x41a291-0x0;var _0x585e1b=_0x2f68[_0x41a291];return _0x585e1b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x82f6('0x0'));module[_0x82f6('0x1')]={'body':{'type':Sequelize[_0x82f6('0x2')](_0x82f6('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x82f6('0x2')]('medium')},'read':{'type':Sequelize[_0x82f6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x82f6('0x5')]('in',_0x82f6('0x6')),'defaultValue':_0x82f6('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x82f6('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x82f6('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x82f6('0x3'))},'bcc':{'type':Sequelize[_0x82f6('0x2')](_0x82f6('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x82f6('0x8')]},'attach':{'type':Sequelize[_0x82f6('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x82f6('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x82f6('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x82f6('0x3'))},'originCc':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file +var _0x0adf=['ENUM','out','STRING','DATE','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN'];(function(_0x2e592f,_0x3cc4e7){var _0x4de189=function(_0x12e44f){while(--_0x12e44f){_0x2e592f['push'](_0x2e592f['shift']());}};_0x4de189(++_0x3cc4e7);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x2a9afd,_0x4c0d40){_0x2a9afd=_0x2a9afd-0x0;var _0x59d3fa=_0x0adf[_0x2a9afd];return _0x59d3fa;};'use strict';var Sequelize=require(_0xf0ad('0x0'));var _=require(_0xf0ad('0x1'));module[_0xf0ad('0x2')]={'body':{'type':Sequelize['TEXT'](_0xf0ad('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf0ad('0x4')](_0xf0ad('0x5'))},'read':{'type':Sequelize[_0xf0ad('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf0ad('0x7')]('in',_0xf0ad('0x8')),'defaultValue':_0xf0ad('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xf0ad('0x9')]},'to':{'type':Sequelize['TEXT'](_0xf0ad('0x3'))},'cc':{'type':Sequelize[_0xf0ad('0x4')](_0xf0ad('0x3'))},'bcc':{'type':Sequelize[_0xf0ad('0x4')](_0xf0ad('0x3'))},'subject':{'type':Sequelize[_0xf0ad('0x4')]},'sentAt':{'type':Sequelize[_0xf0ad('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf0ad('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xf0ad('0x4')](_0xf0ad('0x3'))},'originCc':{'type':Sequelize[_0xf0ad('0x4')](_0xf0ad('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f78aa39..415b97c 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 _0x751e=['rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','download','log','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','ejs','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','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','apply','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','MailMessage','rows','catch','show','params','find','update','body','describe','create','direction','out','split','MailAccount','findOne','CmList','List','CmContact','DESC','MailServerOut','Smtp','isNil','port','secure','authentication','auth','user','pass','service','attachments','join','root','basename','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','mail','read','readAt','Contact','get','MailInteractionId','UserId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject'];(function(_0x201f31,_0x4357bb){var _0x1f38bd=function(_0x5945b0){while(--_0x5945b0){_0x201f31['push'](_0x201f31['shift']());}};_0x1f38bd(++_0x4357bb);}(_0x751e,0x174));var _0xe751=function(_0x45f2c6,_0x145cdc){_0x45f2c6=_0x45f2c6-0x0;var _0x3e6dcd=_0x751e[_0x45f2c6];return _0x3e6dcd;};'use strict';var pdf=require(_0xe751('0x0'));var emlformat=require(_0xe751('0x1'));var rimraf=require(_0xe751('0x2'));var zipdir=require(_0xe751('0x3'));var jsonpatch=require(_0xe751('0x4'));var rp=require(_0xe751('0x5'));var moment=require(_0xe751('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe751('0x7'));var fs=require('fs');var _=require(_0xe751('0x8'));var squel=require(_0xe751('0x9'));var crypto=require(_0xe751('0xa'));var jsforce=require(_0xe751('0xb'));var deskjs=require(_0xe751('0xc'));var toCsv=require(_0xe751('0xd'));var querystring=require(_0xe751('0xe'));var Papa=require(_0xe751('0xf'));var Redis=require(_0xe751('0x10'));var authService=require(_0xe751('0x11'));var qs=require(_0xe751('0x12'));var as=require(_0xe751('0x13'));var hardwareService=require(_0xe751('0x14'));var logger=require('../../config/logger')(_0xe751('0x15'));var utils=require(_0xe751('0x16'));var config=require(_0xe751('0x17'));var licenseUtil=require(_0xe751('0x18'));var db=require(_0xe751('0x19'))['db'];config[_0xe751('0x1a')]=_[_0xe751('0x1b')](config[_0xe751('0x1a')],{'host':_0xe751('0x1c'),'port':0x18eb});var socket=require(_0xe751('0x1d'))(new Redis(config[_0xe751('0x1a')]));require(_0xe751('0x1e'))[_0xe751('0x1f')](socket);var jayson=require(_0xe751('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xe751('0x21')][_0xe751('0x22')]({'port':0x232b});var client9002=jayson['client'][_0xe751('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3e9648,_0x5116b8,_0x1c1bae,_0x4517fd){return new BPromise(function(_0x3812d2,_0xd0ea61){var _0x2b6c4b=_0x4517fd||client;return _0x2b6c4b[_0xe751('0x23')](_0x3e9648,_0x1c1bae)[_0xe751('0x24')](function(_0x595864){logger[_0xe751('0x25')](_0xe751('0x26'),_0x5116b8,_0xe751('0x27'));logger['debug'](_0xe751('0x28'),_0x5116b8,_0xe751('0x27'),JSON[_0xe751('0x29')](_0x595864));if(_0x595864[_0xe751('0x2a')]){if(_0x595864[_0xe751('0x2a')][_0xe751('0x2b')]===0x1f4){logger['error'](_0xe751('0x26'),_0x5116b8,_0x595864[_0xe751('0x2a')][_0xe751('0x2c')]);return _0xd0ea61(_0x595864[_0xe751('0x2a')][_0xe751('0x2c')]);}logger['error'](_0xe751('0x26'),_0x5116b8,_0x595864[_0xe751('0x2a')]['message']);return _0x3812d2(_0x595864[_0xe751('0x2a')][_0xe751('0x2c')]);}else{logger[_0xe751('0x25')](_0xe751('0x26'),_0x5116b8,_0xe751('0x27'));_0x3812d2(_0x595864['result'][_0xe751('0x2c')]);}})['catch'](function(_0x4d6994){logger['error'](_0xe751('0x26'),_0x5116b8,_0x4d6994);_0xd0ea61(_0x4d6994);});});}function respondWithStatusCode(_0x154b63,_0x46db8b){_0x46db8b=_0x46db8b||0xcc;return function(_0x32de7f){if(_0x32de7f){return _0x154b63[_0xe751('0x2d')](_0x46db8b);}return _0x154b63[_0xe751('0x2e')](_0x46db8b)[_0xe751('0x2f')]();};}function respondWithResult(_0x1841b6,_0x15e175){_0x15e175=_0x15e175||0xc8;return function(_0x184da8){if(_0x184da8){return _0x1841b6[_0xe751('0x2e')](_0x15e175)[_0xe751('0x30')](_0x184da8);}};}function respondWithFilteredResult(_0x353927,_0x45596f){return function(_0x972a89){if(_0x972a89){var _0x330fac=_0x972a89[_0xe751('0x31')],_0x1a6288=_0x45596f[_0xe751('0x32')],_0x5b7a7f=_0x45596f['offset']+_0x45596f[_0xe751('0x33')],_0x272c3c;if(_0x5b7a7f>=_0x330fac){_0x5b7a7f=_0x330fac;_0x272c3c=0xc8;}else{_0x272c3c=0xce;}_0x353927['status'](_0x272c3c);return _0x353927[_0xe751('0x34')]('Content-Range',_0x1a6288+'-'+_0x5b7a7f+'/'+_0x330fac)['json'](_0x972a89);}return null;};}function patchUpdates(_0x39c9c1){return function(_0x1735f9){try{jsonpatch[_0xe751('0x35')](_0x1735f9,_0x39c9c1,!![]);}catch(_0x111a05){return BPromise['reject'](_0x111a05);}return _0x1735f9['save']();};}function saveUpdates(_0x2bc845,_0x7638ca){return function(_0x2b8ff5){if(_0x2b8ff5){return _0x2b8ff5['update'](_0x2bc845)['then'](function(_0x2d7adb){return _0x2d7adb;});}return null;};}function removeEntity(_0x23c955,_0x4124aa){return function(_0x84360b){if(_0x84360b){return _0x84360b[_0xe751('0x36')]()[_0xe751('0x24')](function(){_0x23c955[_0xe751('0x2e')](0xcc)[_0xe751('0x2f')]();});}};}function handleEntityNotFound(_0x3db491,_0x1d1c87){return function(_0x12763e){if(!_0x12763e){_0x3db491['sendStatus'](0x194);}return _0x12763e;};}function handleError(_0x5936e1,_0x44b638){_0x44b638=_0x44b638||0x1f4;return function(_0x394892){logger[_0xe751('0x2a')](_0x394892[_0xe751('0x37')]);if(_0x394892[_0xe751('0x38')]){delete _0x394892['name'];}_0x5936e1[_0xe751('0x2e')](_0x44b638)[_0xe751('0x39')](_0x394892);};}exports[_0xe751('0x3a')]=function(_0x139954,_0x1ab04f){var _0x25f052={},_0x43d369={},_0x1c0a50={'count':0x0,'rows':[]};var _0x5648f4=_['map'](db['MailMessage'][_0xe751('0x3b')],function(_0x2a5a29){return{'name':_0x2a5a29[_0xe751('0x3c')],'type':_0x2a5a29['type'][_0xe751('0x3d')]};});_0x43d369[_0xe751('0x3e')]=_[_0xe751('0x3f')](_0x5648f4,'name');_0x43d369[_0xe751('0x40')]=_[_0xe751('0x41')](_0x139954[_0xe751('0x40')]);_0x43d369[_0xe751('0x42')]=_[_0xe751('0x43')](_0x43d369['model'],_0x43d369[_0xe751('0x40')]);_0x25f052[_0xe751('0x44')]=_[_0xe751('0x43')](_0x43d369[_0xe751('0x3e')],qs[_0xe751('0x45')](_0x139954[_0xe751('0x40')]['fields']));_0x25f052['attributes']=_0x25f052[_0xe751('0x44')][_0xe751('0x46')]?_0x25f052[_0xe751('0x44')]:_0x43d369['model'];if(!_0x139954['query'][_0xe751('0x47')](_0xe751('0x48'))){_0x25f052[_0xe751('0x33')]=qs['limit'](_0x139954[_0xe751('0x40')]['limit']);_0x25f052['offset']=qs[_0xe751('0x32')](_0x139954[_0xe751('0x40')][_0xe751('0x32')]);}_0x25f052[_0xe751('0x49')]=qs[_0xe751('0x4a')](_0x139954[_0xe751('0x40')][_0xe751('0x4a')]);_0x25f052[_0xe751('0x4b')]=qs[_0xe751('0x42')](_[_0xe751('0x4c')](_0x139954[_0xe751('0x40')],_0x43d369[_0xe751('0x42')]),_0x5648f4);if(_0x139954['query'][_0xe751('0x4d')]){_0x25f052['where']=_[_0xe751('0x4e')](_0x25f052['where'],{'$or':_[_0xe751('0x3f')](_0x5648f4,function(_0x315cea){if(_0x315cea[_0xe751('0x4f')]!==_0xe751('0x50')){var _0x2d92b7={};_0x2d92b7[_0x315cea[_0xe751('0x38')]]={'$like':'%'+_0x139954[_0xe751('0x40')][_0xe751('0x4d')]+'%'};return _0x2d92b7;}})});}_0x25f052=_[_0xe751('0x4e')]({},_0x25f052,_0x139954[_0xe751('0x51')]);var _0x542b6d={'where':_0x25f052['where']};return db['MailMessage'][_0xe751('0x31')](_0x542b6d)[_0xe751('0x24')](function(_0x51c7a7){_0x1c0a50[_0xe751('0x31')]=_0x51c7a7;if(_0x139954[_0xe751('0x40')][_0xe751('0x52')]){_0x25f052[_0xe751('0x53')]=[{'all':!![]}];}return db[_0xe751('0x54')]['findAll'](_0x25f052);})['then'](function(_0x2def78){_0x1c0a50[_0xe751('0x55')]=_0x2def78;return _0x1c0a50;})[_0xe751('0x24')](respondWithFilteredResult(_0x1ab04f,_0x25f052))[_0xe751('0x56')](handleError(_0x1ab04f,null));};exports[_0xe751('0x57')]=function(_0x20e09f,_0x3e03b6){var _0x58c242={'raw':!![],'where':{'id':_0x20e09f[_0xe751('0x58')]['id']}},_0x5b327a={};_0x5b327a['model']=_['keys'](db[_0xe751('0x54')][_0xe751('0x3b')]);_0x5b327a[_0xe751('0x40')]=_['keys'](_0x20e09f[_0xe751('0x40')]);_0x5b327a['filters']=_['intersection'](_0x5b327a['model'],_0x5b327a[_0xe751('0x40')]);_0x58c242[_0xe751('0x44')]=_[_0xe751('0x43')](_0x5b327a[_0xe751('0x3e')],qs[_0xe751('0x45')](_0x20e09f[_0xe751('0x40')][_0xe751('0x45')]));_0x58c242[_0xe751('0x44')]=_0x58c242[_0xe751('0x44')][_0xe751('0x46')]?_0x58c242[_0xe751('0x44')]:_0x5b327a[_0xe751('0x3e')];if(_0x20e09f[_0xe751('0x40')][_0xe751('0x52')]){_0x58c242[_0xe751('0x53')]=[{'all':!![]}];}_0x58c242=_[_0xe751('0x4e')]({},_0x58c242,_0x20e09f[_0xe751('0x51')]);return db[_0xe751('0x54')][_0xe751('0x59')](_0x58c242)[_0xe751('0x24')](handleEntityNotFound(_0x3e03b6,null))[_0xe751('0x24')](respondWithResult(_0x3e03b6,null))[_0xe751('0x56')](handleError(_0x3e03b6,null));};exports[_0xe751('0x5a')]=function(_0x3b20c0,_0x5a60a4){if(_0x3b20c0['body']['id']){delete _0x3b20c0[_0xe751('0x5b')]['id'];}return db['MailMessage'][_0xe751('0x59')]({'where':{'id':_0x3b20c0[_0xe751('0x58')]['id']}})[_0xe751('0x24')](handleEntityNotFound(_0x5a60a4,null))['then'](saveUpdates(_0x3b20c0[_0xe751('0x5b')],null))[_0xe751('0x24')](respondWithResult(_0x5a60a4,null))[_0xe751('0x56')](handleError(_0x5a60a4,null));};exports[_0xe751('0x36')]=function(_0x58c5a2,_0x46eb4e){return db[_0xe751('0x54')][_0xe751('0x59')]({'where':{'id':_0x58c5a2[_0xe751('0x58')]['id']}})[_0xe751('0x24')](handleEntityNotFound(_0x46eb4e,null))['then'](removeEntity(_0x46eb4e,null))['catch'](handleError(_0x46eb4e,null));};exports[_0xe751('0x5c')]=function(_0x799a59,_0x3fe627){return db[_0xe751('0x54')][_0xe751('0x5c')]()[_0xe751('0x24')](respondWithResult(_0x3fe627,null))[_0xe751('0x56')](handleError(_0x3fe627,null));};exports[_0xe751('0x5d')]=function(_0x516fb9,_0x156c23){return db['MailMessage'][_0xe751('0x5d')](_0x516fb9[_0xe751('0x5b')])['then'](function(_0x5c352b){if(_0x5c352b){if(_0x5c352b[_0xe751('0x5e')]===_0xe751('0x5f')&&!_0x5c352b['secret']){var _0x58510f,_0x5224d1,_0x24c1b8;if(_0x516fb9['body']['to']){_0x5224d1=_0x516fb9[_0xe751('0x5b')]['to'][_0xe751('0x60')](',')[0x0];}return db[_0xe751('0x61')][_0xe751('0x62')]({'where':{'id':_0x5c352b['MailAccountId']},'include':[{'model':db[_0xe751('0x63')],'as':_0xe751('0x64'),'include':[{'model':db[_0xe751('0x65')],'as':'Contacts','where':{'email':_0x5224d1},'limit':0x1,'order':[['updatedAt',_0xe751('0x66')]]}]},{'model':db[_0xe751('0x67')],'as':_0xe751('0x68'),'raw':!![]}]})[_0xe751('0x24')](function(_0x202184){_0x58510f=_0x202184;if(_0x58510f&&_0x58510f[_0xe751('0x68')]){var _0x450155={'tls':{'rejectUnauthorized':![]}};if(_[_0xe751('0x69')](_0x58510f[_0xe751('0x68')]['service'])){_0x450155['host']=_0x58510f[_0xe751('0x68')]['host'];_0x450155[_0xe751('0x6a')]=_0x58510f[_0xe751('0x68')][_0xe751('0x6a')];_0x450155[_0xe751('0x6b')]=_0x58510f[_0xe751('0x68')]['secure'];if(_0x58510f[_0xe751('0x68')][_0xe751('0x6c')]){_0x450155[_0xe751('0x6d')]={'user':_0x58510f[_0xe751('0x68')][_0xe751('0x6e')],'pass':_0x58510f[_0xe751('0x68')][_0xe751('0x6f')]};}}else{_0x450155[_0xe751('0x70')]=_0x58510f[_0xe751('0x68')]['service'];_0x450155[_0xe751('0x6d')]={'user':_0x58510f[_0xe751('0x68')][_0xe751('0x6e')],'pass':_0x58510f[_0xe751('0x68')][_0xe751('0x6f')]};_0x450155['secure']=_0x58510f[_0xe751('0x68')][_0xe751('0x6b')];}if(_0x516fb9[_0xe751('0x5b')]['attachments']&&_0x516fb9[_0xe751('0x5b')][_0xe751('0x71')][_0xe751('0x46')]){for(var _0x1298aa=0x0;_0x1298aa<_0x516fb9[_0xe751('0x5b')]['attachments'][_0xe751('0x46')];_0x1298aa+=0x1){_0x516fb9['body'][_0xe751('0x71')][_0x1298aa]={'filename':_0x516fb9['body']['attachments'][_0x1298aa]['name'],'path':path[_0xe751('0x72')](config[_0xe751('0x73')],'server/files/attachments',_0x516fb9[_0xe751('0x5b')][_0xe751('0x71')][_0x1298aa][_0xe751('0x74')])};}}_0x24c1b8={'account':_0x450155,'message':_0x516fb9[_0xe751('0x5b')]};return;}})[_0xe751('0x24')](function(){if(_0x58510f[_0xe751('0x64')]){if(_0x58510f[_0xe751('0x64')]['Contacts'][_0xe751('0x46')]){return _0x58510f['List'][_0xe751('0x75')][0x0];}else{return db[_0xe751('0x65')]['create'](_[_0xe751('0x1b')](_0x516fb9[_0xe751('0x5b')],{'firstName':_0x516fb9[_0xe751('0x5b')]['to'],'email':_0x516fb9[_0xe751('0x5b')]['to'],'phone':_0x516fb9[_0xe751('0x5b')]['to'],'ListId':_0x58510f[_0xe751('0x76')]}));}}else{throw new Error(_0xe751('0x77'));}})['then'](function(){if(_0x24c1b8){return respondWithRpcPromise('SendMail',_0xe751('0x78'),_0x24c1b8,client9003)[_0xe751('0x24')](function(_0x1b04ee){return _0x5c352b[_0xe751('0x5a')]({'read':!![],'messageId':_0x1b04ee[_0xe751('0x79')],'sentAt':moment()[_0xe751('0x7a')](_0xe751('0x7b'))});})[_0xe751('0x56')](function(_0x2d6396){logger[_0xe751('0x2a')]('%s',JSON[_0xe751('0x29')](_0x2d6396));return _0x5c352b;});}return _0x5c352b;});}return _0x5c352b;}})[_0xe751('0x24')](respondWithResult(_0x156c23,0xc9))[_0xe751('0x56')](handleError(_0x156c23,null));};var interaction_log=require(_0xe751('0x7c'))(_0xe751('0x7d'));exports['accept']=function(_0x48040d,_0x57c631,_0x3eaec2){var _0x2a94b6={'channel':_0xe751('0x7e')};if(_0x48040d[_0xe751('0x5b')]['id']){delete _0x48040d['body']['id'];}_0x48040d[_0xe751('0x5b')][_0xe751('0x7f')]=!![];_0x48040d[_0xe751('0x5b')][_0xe751('0x80')]=moment()[_0xe751('0x7a')](_0xe751('0x7b'));_0x48040d['body']['UserId']=_0x48040d[_0xe751('0x5b')]['UserId']||_0x48040d['user']['id'];return db[_0xe751('0x54')][_0xe751('0x59')]({'where':{'id':_0x48040d['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xe751('0x81')}]})[_0xe751('0x24')](handleEntityNotFound(_0x57c631,null))[_0xe751('0x24')](saveUpdates(_0x48040d[_0xe751('0x5b')],null))[_0xe751('0x24')](function(_0x3d3bf3){if(_0x3d3bf3){_0x2a94b6[_0xe751('0x2c')]=_0x3d3bf3[_0xe751('0x82')]({'plain':!![]});return db['MailInteraction'][_0xe751('0x59')]({'where':{'id':_0x3d3bf3[_0xe751('0x83')]}});}return null;})[_0xe751('0x24')](handleEntityNotFound(_0x57c631,null))[_0xe751('0x24')](function(_0x34f2d9){if(_0x34f2d9){return _0x34f2d9[_0xe751('0x5a')]({'UserId':_0x48040d[_0xe751('0x5b')][_0xe751('0x84')],'read1stAt':_[_0xe751('0x69')](_0x34f2d9[_0xe751('0x85')])?moment()['format'](_0xe751('0x7b')):undefined});}return null;})[_0xe751('0x24')](function(_0x3a5936){if(_0x3a5936){_0x2a94b6[_0xe751('0x86')]=_0x3a5936[_0xe751('0x82')]({'plain':!![]});interaction_log[_0xe751('0x25')](_0xe751('0x87'),_0x48040d['user']['id'],_0x48040d[_0xe751('0x6e')][_0xe751('0x38')],_0x48040d[_0xe751('0x6e')][_0xe751('0x88')],_0x2a94b6[_0xe751('0x86')]['id'],_0x48040d[_0xe751('0x5b')]?JSON[_0xe751('0x29')](_0x48040d['body']):_0xe751('0x89'));return respondWithRpcPromise(_0xe751('0x8a'),_0xe751('0x8b'),_0x2a94b6);}return null;})[_0xe751('0x24')](function(_0x5bef81){if(_0x5bef81){if(_0x48040d['body'][_0xe751('0x8c')]){_0x2a94b6[_0xe751('0x2c')][_0xe751('0x8d')]=util[_0xe751('0x7a')](_0xe751('0x8e'),_0x48040d[_0xe751('0x6e')]['name']);_0x2a94b6['message'][_0xe751('0x8f')]=_0x2a94b6['channel'];_0x2a94b6[_0xe751('0x2c')][_0xe751('0x90')]=_0xe751('0x91');return respondWithRpcPromise('EventManager',_0xe751('0x92'),{'event':_0xe751('0x93'),'message':_0x2a94b6[_0xe751('0x2c')]},client9002)[_0xe751('0x24')](function(){return _0x2a94b6;});}return _0x2a94b6;}return null;})[_0xe751('0x24')](respondWithResult(_0x57c631,null))[_0xe751('0x56')](handleError(_0x57c631,null));};var interaction_log=require(_0xe751('0x7c'))('mail-interactions');exports['reject']=function(_0x1735c5,_0xa57b3d,_0x4d2fd8){var _0x319e16={'agent':{},'channel':'mail'};if(_0x1735c5[_0xe751('0x5b')]['id']){delete _0x1735c5[_0xe751('0x5b')]['id'];}_0x1735c5[_0xe751('0x5b')][_0xe751('0x84')]=_0x1735c5[_0xe751('0x5b')][_0xe751('0x84')]||_0x1735c5[_0xe751('0x6e')]['id'];_0x319e16['agent']['id']=_0x1735c5[_0xe751('0x5b')][_0xe751('0x84')];return db[_0xe751('0x54')][_0xe751('0x59')]({'where':{'id':_0x1735c5[_0xe751('0x58')]['id'],'UserId':null}})[_0xe751('0x24')](handleEntityNotFound(_0xa57b3d,null))[_0xe751('0x24')](function(_0x31d67d){if(_0x31d67d){_0x319e16[_0xe751('0x2c')]=_0x31d67d['get']({'plain':!![]});return db[_0xe751('0x94')][_0xe751('0x59')]({'where':{'id':_0x31d67d[_0xe751('0x83')]}});}return null;})[_0xe751('0x24')](handleEntityNotFound(_0xa57b3d,null))[_0xe751('0x24')](function(_0x2f5e43){if(_0x2f5e43){_0x319e16[_0xe751('0x86')]=_0x2f5e43[_0xe751('0x82')]({'plain':!![]});interaction_log[_0xe751('0x25')](_0xe751('0x95'),_0x1735c5[_0xe751('0x6e')]['id'],_0x1735c5[_0xe751('0x6e')][_0xe751('0x38')],_0x1735c5[_0xe751('0x6e')][_0xe751('0x88')],_0x319e16[_0xe751('0x86')]['id'],_0x1735c5[_0xe751('0x5b')]?JSON['stringify'](_0x1735c5[_0xe751('0x5b')]):'null');return respondWithRpcPromise(_0xe751('0x96'),_0xe751('0x97'),_0x319e16);}return null;})[_0xe751('0x24')](function(_0x452572){if(_0x452572){_0x452572[_0xe751('0x2c')][_0xe751('0x8d')]=util[_0xe751('0x7a')](_0xe751('0x8e'),_0x1735c5['user'][_0xe751('0x38')]);_0x452572[_0xe751('0x2c')][_0xe751('0x8f')]=_0x319e16[_0xe751('0x8f')];_0x452572['message'][_0xe751('0x90')]=_0xe751('0x98');respondWithRpcPromise('EventManager','EventManager',{'event':_0xe751('0x99'),'message':_0x452572['message']},client9002);return _0x319e16;}return null;})[_0xe751('0x24')](respondWithResult(_0xa57b3d,null))['catch'](handleError(_0xa57b3d,null));};exports['download']=function(_0x30bb3c,_0x10a2ed){var _0x555dab=moment()[_0xe751('0x9a')]()[_0xe751('0x9b')]();var _0x495d2f=path['join'](config[_0xe751('0x73')],_0xe751('0x9c'),_0xe751('0x9d'),_0xe751('0x9e'));var _0x1d90ce=path[_0xe751('0x72')](config[_0xe751('0x73')],_0xe751('0x9c'),'files',_0xe751('0x71'));var _0x19d716=util[_0xe751('0x7a')](_0xe751('0x9f'),_0x555dab);return db[_0xe751('0x54')][_0xe751('0x59')]({'where':{'id':_0x30bb3c[_0xe751('0x58')]['id']},'attributes':['id',_0xe751('0x5b'),_0xe751('0xa0'),'to','cc',_0xe751('0xa1'),'subject',_0xe751('0xa2')],'include':_0x30bb3c[_0xe751('0x40')][_0xe751('0x71')]?[{'model':db[_0xe751('0xa3')],'as':_0xe751('0xa4')}]:undefined})[_0xe751('0x24')](handleEntityNotFound(_0x10a2ed,null))[_0xe751('0x24')](function(_0x361567){if(_0x361567){var _0x1d28fa=_0x361567;var _0xe08727={'from':_0x1d28fa[_0xe751('0xa0')],'to':_0x1d28fa['to'],'subject':_0x1d28fa[_0xe751('0xa5')],'html':_0x1d28fa[_0xe751('0x5b')],'headers':{'Date':moment(_0x1d28fa[_0xe751('0xa2')])[_0xe751('0x7a')](_0xe751('0xa6'))},'attachments':[]};if(_0x361567['cc']){_0xe08727[_0xe751('0xa7')]['Cc']=_0x361567['cc'];}if(_0x361567['bcc']){_0xe08727[_0xe751('0xa7')][_0xe751('0xa8')]=_0x361567['bcc'];}return new BPromise(function(_0x1126b5,_0x281993){if(_0x361567[_0xe751('0xa4')]){for(var _0x30b7ca=0x0;_0x30b7ca<_0x361567[_0xe751('0xa4')][_0xe751('0x46')];_0x30b7ca++){var _0x41dd2a=_0x361567[_0xe751('0xa4')][_0x30b7ca];var _0x171ddc=path['join'](_0x1d90ce,_0x41dd2a[_0xe751('0x74')]);if(fs[_0xe751('0xa9')](_0x171ddc)){_0xe08727[_0xe751('0x71')]['push']({'name':_0x41dd2a['name'],'contentType':_0x41dd2a['type'],'data':fs[_0xe751('0xaa')](_0x171ddc)});}}}emlformat[_0xe751('0xab')](_0xe08727,function(_0x248ae3,_0x2639d8){if(_0x248ae3)return _0x281993(_0x248ae3);fs[_0xe751('0xac')](path[_0xe751('0x72')](_0x495d2f,_0x19d716),_0x2639d8);return _0x1126b5(_0x2639d8);});});}})[_0xe751('0x24')](function(_0x48a588){if(_0x48a588){return _0x10a2ed[_0xe751('0xad')](path[_0xe751('0x72')](_0x495d2f,_0x19d716),_0x19d716,function(_0x78dcfe){if(_0x78dcfe){console[_0xe751('0xae')]('err',_0x78dcfe);}else{fs['unlinkSync'](path[_0xe751('0x72')](_0x495d2f,_0x19d716));}});}})[_0xe751('0x56')](handleError(_0x10a2ed,null));}; \ No newline at end of file +var _0xc9a8=['service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','UserId','Contact','MailInteraction','MailInteractionId','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','interface','SIP/%s','channel','event','accept','EventManager','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','server','tmp','files','message-%s.eml','bcc','subject','createdAt','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','sendStatus','end','status','json','count','offset','limit','set','reject','save','stack','name','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','map','merge','options','MailMessage','includeAll','catch','show','params','include','find','update','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc9a8,0xe5));var _0x8c9a=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0xc9a8[_0x364cf8];return _0x6a59ee;};'use strict';var pdf=require(_0x8c9a('0x0'));var emlformat=require(_0x8c9a('0x1'));var rimraf=require(_0x8c9a('0x2'));var zipdir=require(_0x8c9a('0x3'));var jsonpatch=require(_0x8c9a('0x4'));var rp=require(_0x8c9a('0x5'));var moment=require(_0x8c9a('0x6'));var BPromise=require(_0x8c9a('0x7'));var Mustache=require(_0x8c9a('0x8'));var util=require(_0x8c9a('0x9'));var path=require(_0x8c9a('0xa'));var sox=require(_0x8c9a('0xb'));var csv=require(_0x8c9a('0xc'));var ejs=require(_0x8c9a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8c9a('0xe'));var crypto=require(_0x8c9a('0xf'));var jsforce=require(_0x8c9a('0x10'));var deskjs=require(_0x8c9a('0x11'));var toCsv=require(_0x8c9a('0xc'));var querystring=require(_0x8c9a('0x12'));var Papa=require(_0x8c9a('0x13'));var Redis=require(_0x8c9a('0x14'));var authService=require(_0x8c9a('0x15'));var qs=require(_0x8c9a('0x16'));var as=require(_0x8c9a('0x17'));var hardwareService=require(_0x8c9a('0x18'));var logger=require(_0x8c9a('0x19'))(_0x8c9a('0x1a'));var utils=require(_0x8c9a('0x1b'));var config=require(_0x8c9a('0x1c'));var licenseUtil=require(_0x8c9a('0x1d'));var db=require(_0x8c9a('0x1e'))['db'];config['redis']=_[_0x8c9a('0x1f')](config[_0x8c9a('0x20')],{'host':_0x8c9a('0x21'),'port':0x18eb});var socket=require(_0x8c9a('0x22'))(new Redis(config[_0x8c9a('0x20')]));require(_0x8c9a('0x23'))[_0x8c9a('0x24')](socket);var jayson=require(_0x8c9a('0x25'));var client=jayson[_0x8c9a('0x26')][_0x8c9a('0x27')]({'port':0x232c});var client9003=jayson['client'][_0x8c9a('0x27')]({'port':0x232b});var client9002=jayson[_0x8c9a('0x26')][_0x8c9a('0x27')]({'port':0x232a});function respondWithRpcPromise(_0x12f3a0,_0x5237a7,_0x2e09e3,_0x3e40c5){return new BPromise(function(_0x1aed5b,_0xecb186){var _0x11a2d2=_0x3e40c5||client;return _0x11a2d2['request'](_0x12f3a0,_0x2e09e3)[_0x8c9a('0x28')](function(_0x53dd93){logger[_0x8c9a('0x29')](_0x8c9a('0x2a'),_0x5237a7,'request\x20sent');logger[_0x8c9a('0x2b')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5237a7,'request\x20sent',JSON[_0x8c9a('0x2c')](_0x53dd93));if(_0x53dd93[_0x8c9a('0x2d')]){if(_0x53dd93['error']['code']===0x1f4){logger[_0x8c9a('0x2d')](_0x8c9a('0x2a'),_0x5237a7,_0x53dd93[_0x8c9a('0x2d')][_0x8c9a('0x2e')]);return _0xecb186(_0x53dd93[_0x8c9a('0x2d')][_0x8c9a('0x2e')]);}logger['error'](_0x8c9a('0x2a'),_0x5237a7,_0x53dd93['error'][_0x8c9a('0x2e')]);return _0x1aed5b(_0x53dd93['error'][_0x8c9a('0x2e')]);}else{logger[_0x8c9a('0x29')](_0x8c9a('0x2a'),_0x5237a7,_0x8c9a('0x2f'));_0x1aed5b(_0x53dd93[_0x8c9a('0x30')][_0x8c9a('0x2e')]);}})['catch'](function(_0x376ab1){logger[_0x8c9a('0x2d')](_0x8c9a('0x2a'),_0x5237a7,_0x376ab1);_0xecb186(_0x376ab1);});});}function respondWithStatusCode(_0x2efd24,_0x1baa26){_0x1baa26=_0x1baa26||0xcc;return function(_0x13a792){if(_0x13a792){return _0x2efd24[_0x8c9a('0x31')](_0x1baa26);}return _0x2efd24['status'](_0x1baa26)[_0x8c9a('0x32')]();};}function respondWithResult(_0x4e8677,_0x5c4254){_0x5c4254=_0x5c4254||0xc8;return function(_0x3ca6da){if(_0x3ca6da){return _0x4e8677[_0x8c9a('0x33')](_0x5c4254)[_0x8c9a('0x34')](_0x3ca6da);}};}function respondWithFilteredResult(_0xcd10da,_0x4b1a07){return function(_0x61bf79){if(_0x61bf79){var _0x1af252=_0x61bf79[_0x8c9a('0x35')],_0x368856=_0x4b1a07[_0x8c9a('0x36')],_0x16faca=_0x4b1a07[_0x8c9a('0x36')]+_0x4b1a07[_0x8c9a('0x37')],_0x40002b;if(_0x16faca>=_0x1af252){_0x16faca=_0x1af252;_0x40002b=0xc8;}else{_0x40002b=0xce;}_0xcd10da[_0x8c9a('0x33')](_0x40002b);return _0xcd10da[_0x8c9a('0x38')]('Content-Range',_0x368856+'-'+_0x16faca+'/'+_0x1af252)['json'](_0x61bf79);}return null;};}function patchUpdates(_0x485820){return function(_0x162afa){try{jsonpatch['apply'](_0x162afa,_0x485820,!![]);}catch(_0x3ca7bf){return BPromise[_0x8c9a('0x39')](_0x3ca7bf);}return _0x162afa[_0x8c9a('0x3a')]();};}function saveUpdates(_0x5620bc,_0x54d96e){return function(_0x5ad6e3){if(_0x5ad6e3){return _0x5ad6e3['update'](_0x5620bc)[_0x8c9a('0x28')](function(_0x446391){return _0x446391;});}return null;};}function removeEntity(_0x14f3d2,_0x11ebd1){return function(_0x11a528){if(_0x11a528){return _0x11a528['destroy']()[_0x8c9a('0x28')](function(){_0x14f3d2[_0x8c9a('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25c8e1,_0x942c8c){return function(_0x4443c5){if(!_0x4443c5){_0x25c8e1['sendStatus'](0x194);}return _0x4443c5;};}function handleError(_0x1aff00,_0x1d4cc8){_0x1d4cc8=_0x1d4cc8||0x1f4;return function(_0x4ebc08){logger[_0x8c9a('0x2d')](_0x4ebc08[_0x8c9a('0x3b')]);if(_0x4ebc08[_0x8c9a('0x3c')]){delete _0x4ebc08['name'];}_0x1aff00[_0x8c9a('0x33')](_0x1d4cc8)['send'](_0x4ebc08);};}exports['index']=function(_0x4046ca,_0x334708){var _0x57cbfd={},_0x54c27b={},_0x3b2b6b={'count':0x0,'rows':[]};var _0x53f01f=_['map'](db['MailMessage'][_0x8c9a('0x3d')],function(_0x1c5ccc){return{'name':_0x1c5ccc['fieldName'],'type':_0x1c5ccc[_0x8c9a('0x3e')]['key']};});_0x54c27b[_0x8c9a('0x3f')]=_['map'](_0x53f01f,_0x8c9a('0x3c'));_0x54c27b[_0x8c9a('0x40')]=_[_0x8c9a('0x41')](_0x4046ca['query']);_0x54c27b[_0x8c9a('0x42')]=_[_0x8c9a('0x43')](_0x54c27b[_0x8c9a('0x3f')],_0x54c27b[_0x8c9a('0x40')]);_0x57cbfd[_0x8c9a('0x44')]=_[_0x8c9a('0x43')](_0x54c27b[_0x8c9a('0x3f')],qs['fields'](_0x4046ca[_0x8c9a('0x40')][_0x8c9a('0x45')]));_0x57cbfd[_0x8c9a('0x44')]=_0x57cbfd[_0x8c9a('0x44')][_0x8c9a('0x46')]?_0x57cbfd[_0x8c9a('0x44')]:_0x54c27b[_0x8c9a('0x3f')];if(!_0x4046ca[_0x8c9a('0x40')]['hasOwnProperty']('nolimit')){_0x57cbfd[_0x8c9a('0x37')]=qs['limit'](_0x4046ca[_0x8c9a('0x40')][_0x8c9a('0x37')]);_0x57cbfd[_0x8c9a('0x36')]=qs[_0x8c9a('0x36')](_0x4046ca['query']['offset']);}_0x57cbfd[_0x8c9a('0x47')]=qs[_0x8c9a('0x48')](_0x4046ca[_0x8c9a('0x40')][_0x8c9a('0x48')]);_0x57cbfd[_0x8c9a('0x49')]=qs[_0x8c9a('0x42')](_['pick'](_0x4046ca['query'],_0x54c27b[_0x8c9a('0x42')]),_0x53f01f);if(_0x4046ca[_0x8c9a('0x40')][_0x8c9a('0x4a')]){_0x57cbfd['where']=_['merge'](_0x57cbfd[_0x8c9a('0x49')],{'$or':_[_0x8c9a('0x4b')](_0x53f01f,function(_0xe4c229){if(_0xe4c229[_0x8c9a('0x3e')]!=='VIRTUAL'){var _0x19103e={};_0x19103e[_0xe4c229[_0x8c9a('0x3c')]]={'$like':'%'+_0x4046ca[_0x8c9a('0x40')][_0x8c9a('0x4a')]+'%'};return _0x19103e;}})});}_0x57cbfd=_[_0x8c9a('0x4c')]({},_0x57cbfd,_0x4046ca[_0x8c9a('0x4d')]);var _0xb9cc84={'where':_0x57cbfd[_0x8c9a('0x49')]};return db[_0x8c9a('0x4e')][_0x8c9a('0x35')](_0xb9cc84)['then'](function(_0xc8912a){_0x3b2b6b[_0x8c9a('0x35')]=_0xc8912a;if(_0x4046ca['query'][_0x8c9a('0x4f')]){_0x57cbfd['include']=[{'all':!![]}];}return db[_0x8c9a('0x4e')]['findAll'](_0x57cbfd);})['then'](function(_0x53efe6){_0x3b2b6b['rows']=_0x53efe6;return _0x3b2b6b;})[_0x8c9a('0x28')](respondWithFilteredResult(_0x334708,_0x57cbfd))[_0x8c9a('0x50')](handleError(_0x334708,null));};exports[_0x8c9a('0x51')]=function(_0x37b324,_0x5bfc31){var _0xedce1={'raw':!![],'where':{'id':_0x37b324[_0x8c9a('0x52')]['id']}},_0x4e6422={};_0x4e6422[_0x8c9a('0x3f')]=_[_0x8c9a('0x41')](db[_0x8c9a('0x4e')]['rawAttributes']);_0x4e6422['query']=_[_0x8c9a('0x41')](_0x37b324[_0x8c9a('0x40')]);_0x4e6422[_0x8c9a('0x42')]=_[_0x8c9a('0x43')](_0x4e6422[_0x8c9a('0x3f')],_0x4e6422[_0x8c9a('0x40')]);_0xedce1['attributes']=_[_0x8c9a('0x43')](_0x4e6422['model'],qs[_0x8c9a('0x45')](_0x37b324[_0x8c9a('0x40')]['fields']));_0xedce1[_0x8c9a('0x44')]=_0xedce1[_0x8c9a('0x44')]['length']?_0xedce1[_0x8c9a('0x44')]:_0x4e6422['model'];if(_0x37b324[_0x8c9a('0x40')]['includeAll']){_0xedce1[_0x8c9a('0x53')]=[{'all':!![]}];}_0xedce1=_[_0x8c9a('0x4c')]({},_0xedce1,_0x37b324[_0x8c9a('0x4d')]);return db[_0x8c9a('0x4e')][_0x8c9a('0x54')](_0xedce1)[_0x8c9a('0x28')](handleEntityNotFound(_0x5bfc31,null))[_0x8c9a('0x28')](respondWithResult(_0x5bfc31,null))[_0x8c9a('0x50')](handleError(_0x5bfc31,null));};exports[_0x8c9a('0x55')]=function(_0x528a68,_0x413966){if(_0x528a68[_0x8c9a('0x56')]['id']){delete _0x528a68[_0x8c9a('0x56')]['id'];}return db[_0x8c9a('0x4e')][_0x8c9a('0x54')]({'where':{'id':_0x528a68[_0x8c9a('0x52')]['id']}})[_0x8c9a('0x28')](handleEntityNotFound(_0x413966,null))[_0x8c9a('0x28')](saveUpdates(_0x528a68[_0x8c9a('0x56')],null))['then'](respondWithResult(_0x413966,null))[_0x8c9a('0x50')](handleError(_0x413966,null));};exports['destroy']=function(_0x581764,_0x2f4cdc){return db[_0x8c9a('0x4e')][_0x8c9a('0x54')]({'where':{'id':_0x581764[_0x8c9a('0x52')]['id']}})[_0x8c9a('0x28')](handleEntityNotFound(_0x2f4cdc,null))[_0x8c9a('0x28')](removeEntity(_0x2f4cdc,null))['catch'](handleError(_0x2f4cdc,null));};exports[_0x8c9a('0x57')]=function(_0x57ba6e,_0x4e751e){return db[_0x8c9a('0x4e')][_0x8c9a('0x57')]()[_0x8c9a('0x28')](respondWithResult(_0x4e751e,null))[_0x8c9a('0x50')](handleError(_0x4e751e,null));};exports['create']=function(_0x57a136,_0x2dce53){return db[_0x8c9a('0x4e')][_0x8c9a('0x58')](_0x57a136[_0x8c9a('0x56')])[_0x8c9a('0x28')](function(_0x453dcb){if(_0x453dcb){if(_0x453dcb[_0x8c9a('0x59')]===_0x8c9a('0x5a')&&!_0x453dcb[_0x8c9a('0x5b')]){var _0x4988f2,_0x5ebfe9,_0x31cf11;if(_0x57a136[_0x8c9a('0x56')]['to']){_0x5ebfe9=_0x57a136[_0x8c9a('0x56')]['to'][_0x8c9a('0x5c')](',')[0x0];}return db['MailAccount'][_0x8c9a('0x5d')]({'where':{'id':_0x453dcb[_0x8c9a('0x5e')]},'include':[{'model':db[_0x8c9a('0x5f')],'as':_0x8c9a('0x60'),'include':[{'model':db['CmContact'],'as':_0x8c9a('0x61'),'where':{'email':_0x5ebfe9},'limit':0x1,'order':[['updatedAt',_0x8c9a('0x62')]]}]},{'model':db[_0x8c9a('0x63')],'as':_0x8c9a('0x64'),'raw':!![]}]})['then'](function(_0x35af29){_0x4988f2=_0x35af29;if(_0x4988f2&&_0x4988f2['Smtp']){var _0x104d5a={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x65')])){_0x104d5a[_0x8c9a('0x66')]=_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x66')];_0x104d5a['port']=_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x67')];_0x104d5a[_0x8c9a('0x68')]=_0x4988f2[_0x8c9a('0x64')]['secure'];if(_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x69')]){_0x104d5a[_0x8c9a('0x6a')]={'user':_0x4988f2['Smtp'][_0x8c9a('0x6b')],'pass':_0x4988f2['Smtp'][_0x8c9a('0x6c')]};}}else{_0x104d5a[_0x8c9a('0x65')]=_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x65')];_0x104d5a[_0x8c9a('0x6a')]={'user':_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x6b')],'pass':_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x6c')]};_0x104d5a[_0x8c9a('0x68')]=_0x4988f2[_0x8c9a('0x64')][_0x8c9a('0x68')];}if(_0x57a136[_0x8c9a('0x56')][_0x8c9a('0x6d')]&&_0x57a136[_0x8c9a('0x56')][_0x8c9a('0x6d')]['length']){for(var _0x1dc78f=0x0;_0x1dc78f<_0x57a136[_0x8c9a('0x56')][_0x8c9a('0x6d')][_0x8c9a('0x46')];_0x1dc78f+=0x1){_0x57a136[_0x8c9a('0x56')]['attachments'][_0x1dc78f]={'filename':_0x57a136[_0x8c9a('0x56')][_0x8c9a('0x6d')][_0x1dc78f][_0x8c9a('0x3c')],'path':path[_0x8c9a('0x6e')](config[_0x8c9a('0x6f')],_0x8c9a('0x70'),_0x57a136[_0x8c9a('0x56')][_0x8c9a('0x6d')][_0x1dc78f][_0x8c9a('0x71')])};}}_0x31cf11={'account':_0x104d5a,'message':_0x57a136[_0x8c9a('0x56')]};return;}})[_0x8c9a('0x28')](function(){if(_0x4988f2[_0x8c9a('0x60')]){if(_0x4988f2[_0x8c9a('0x60')]['Contacts'][_0x8c9a('0x46')]){return _0x4988f2[_0x8c9a('0x60')][_0x8c9a('0x61')][0x0];}else{return db[_0x8c9a('0x72')][_0x8c9a('0x58')](_['defaults'](_0x57a136[_0x8c9a('0x56')],{'firstName':_0x57a136[_0x8c9a('0x56')]['to'],'email':_0x57a136[_0x8c9a('0x56')]['to'],'phone':_0x57a136[_0x8c9a('0x56')]['to'],'ListId':_0x4988f2[_0x8c9a('0x73')]}));}}else{throw new Error(_0x8c9a('0x74'));}})[_0x8c9a('0x28')](function(){if(_0x31cf11){return respondWithRpcPromise('SendMail',_0x8c9a('0x75'),_0x31cf11,client9003)['then'](function(_0x5cac06){return _0x453dcb[_0x8c9a('0x55')]({'read':!![],'messageId':_0x5cac06[_0x8c9a('0x76')],'sentAt':moment()[_0x8c9a('0x77')](_0x8c9a('0x78'))});})[_0x8c9a('0x50')](function(_0x357134){logger[_0x8c9a('0x2d')]('%s',JSON[_0x8c9a('0x2c')](_0x357134));return _0x453dcb;});}return _0x453dcb;});}return _0x453dcb;}})[_0x8c9a('0x28')](respondWithResult(_0x2dce53,0xc9))[_0x8c9a('0x50')](handleError(_0x2dce53,null));};var interaction_log=require(_0x8c9a('0x19'))(_0x8c9a('0x79'));exports['accept']=function(_0xdd9ba7,_0x4a7cfd,_0x37ef81){var _0x11fc05={'channel':_0x8c9a('0x7a')};if(_0xdd9ba7[_0x8c9a('0x56')]['id']){delete _0xdd9ba7[_0x8c9a('0x56')]['id'];}_0xdd9ba7[_0x8c9a('0x56')][_0x8c9a('0x7b')]=!![];_0xdd9ba7[_0x8c9a('0x56')]['readAt']=moment()['format'](_0x8c9a('0x78'));_0xdd9ba7[_0x8c9a('0x56')][_0x8c9a('0x7c')]=_0xdd9ba7[_0x8c9a('0x56')][_0x8c9a('0x7c')]||_0xdd9ba7[_0x8c9a('0x6b')]['id'];return db['MailMessage'][_0x8c9a('0x54')]({'where':{'id':_0xdd9ba7[_0x8c9a('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x8c9a('0x72')],'as':_0x8c9a('0x7d')}]})[_0x8c9a('0x28')](handleEntityNotFound(_0x4a7cfd,null))['then'](saveUpdates(_0xdd9ba7[_0x8c9a('0x56')],null))[_0x8c9a('0x28')](function(_0x855a60){if(_0x855a60){_0x11fc05[_0x8c9a('0x2e')]=_0x855a60['get']({'plain':!![]});return db[_0x8c9a('0x7e')][_0x8c9a('0x54')]({'where':{'id':_0x855a60[_0x8c9a('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x4a7cfd,null))[_0x8c9a('0x28')](function(_0x2e8252){if(_0x2e8252){return _0x2e8252['update']({'UserId':_0xdd9ba7['body'][_0x8c9a('0x7c')],'read1stAt':_[_0x8c9a('0x80')](_0x2e8252[_0x8c9a('0x81')])?moment()[_0x8c9a('0x77')](_0x8c9a('0x78')):undefined});}return null;})[_0x8c9a('0x28')](function(_0x437905){if(_0x437905){_0x11fc05['interaction']=_0x437905[_0x8c9a('0x82')]({'plain':!![]});interaction_log['info'](_0x8c9a('0x83'),_0xdd9ba7['user']['id'],_0xdd9ba7[_0x8c9a('0x6b')][_0x8c9a('0x3c')],_0xdd9ba7[_0x8c9a('0x6b')]['role'],_0x11fc05[_0x8c9a('0x84')]['id'],_0xdd9ba7[_0x8c9a('0x56')]?JSON[_0x8c9a('0x2c')](_0xdd9ba7[_0x8c9a('0x56')]):_0x8c9a('0x85'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x11fc05);}return null;})['then'](function(_0x296446){if(_0x296446){if(_0xdd9ba7[_0x8c9a('0x56')]['manual']){_0x11fc05[_0x8c9a('0x2e')][_0x8c9a('0x86')]=util[_0x8c9a('0x77')](_0x8c9a('0x87'),_0xdd9ba7['user'][_0x8c9a('0x3c')]);_0x11fc05[_0x8c9a('0x2e')][_0x8c9a('0x88')]=_0x11fc05[_0x8c9a('0x88')];_0x11fc05['message'][_0x8c9a('0x89')]=_0x8c9a('0x8a');return respondWithRpcPromise('EventManager',_0x8c9a('0x8b'),{'event':'acceptmessage','message':_0x11fc05[_0x8c9a('0x2e')]},client9002)[_0x8c9a('0x28')](function(){return _0x11fc05;});}return _0x11fc05;}return null;})[_0x8c9a('0x28')](respondWithResult(_0x4a7cfd,null))[_0x8c9a('0x50')](handleError(_0x4a7cfd,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x8c9a('0x39')]=function(_0x1e5341,_0x409a77,_0x391f09){var _0x2284bc={'agent':{},'channel':_0x8c9a('0x7a')};if(_0x1e5341[_0x8c9a('0x56')]['id']){delete _0x1e5341[_0x8c9a('0x56')]['id'];}_0x1e5341[_0x8c9a('0x56')][_0x8c9a('0x7c')]=_0x1e5341['body'][_0x8c9a('0x7c')]||_0x1e5341[_0x8c9a('0x6b')]['id'];_0x2284bc[_0x8c9a('0x8c')]['id']=_0x1e5341['body']['UserId'];return db[_0x8c9a('0x4e')]['find']({'where':{'id':_0x1e5341[_0x8c9a('0x52')]['id'],'UserId':null}})[_0x8c9a('0x28')](handleEntityNotFound(_0x409a77,null))[_0x8c9a('0x28')](function(_0x57fdae){if(_0x57fdae){_0x2284bc[_0x8c9a('0x2e')]=_0x57fdae[_0x8c9a('0x82')]({'plain':!![]});return db[_0x8c9a('0x7e')][_0x8c9a('0x54')]({'where':{'id':_0x57fdae['MailInteractionId']}});}return null;})[_0x8c9a('0x28')](handleEntityNotFound(_0x409a77,null))[_0x8c9a('0x28')](function(_0xa7894d){if(_0xa7894d){_0x2284bc['interaction']=_0xa7894d[_0x8c9a('0x82')]({'plain':!![]});interaction_log[_0x8c9a('0x29')](_0x8c9a('0x8d'),_0x1e5341[_0x8c9a('0x6b')]['id'],_0x1e5341[_0x8c9a('0x6b')]['name'],_0x1e5341[_0x8c9a('0x6b')]['role'],_0x2284bc['interaction']['id'],_0x1e5341[_0x8c9a('0x56')]?JSON['stringify'](_0x1e5341['body']):_0x8c9a('0x85'));return respondWithRpcPromise(_0x8c9a('0x8e'),_0x8c9a('0x8f'),_0x2284bc);}return null;})[_0x8c9a('0x28')](function(_0xbe03e6){if(_0xbe03e6){_0xbe03e6[_0x8c9a('0x2e')]['interface']=util[_0x8c9a('0x77')](_0x8c9a('0x87'),_0x1e5341[_0x8c9a('0x6b')][_0x8c9a('0x3c')]);_0xbe03e6[_0x8c9a('0x2e')][_0x8c9a('0x88')]=_0x2284bc['channel'];_0xbe03e6['message']['event']='reject';respondWithRpcPromise(_0x8c9a('0x8b'),_0x8c9a('0x8b'),{'event':_0x8c9a('0x90'),'message':_0xbe03e6[_0x8c9a('0x2e')]},client9002);return _0x2284bc;}return null;})[_0x8c9a('0x28')](respondWithResult(_0x409a77,null))[_0x8c9a('0x50')](handleError(_0x409a77,null));};exports[_0x8c9a('0x91')]=function(_0x371ffa,_0x13f3d1){var _0x486031=moment()[_0x8c9a('0x92')]()['toString']();var _0x277b0f=path[_0x8c9a('0x6e')](config['root'],_0x8c9a('0x93'),'files',_0x8c9a('0x94'));var _0x306dd5=path[_0x8c9a('0x6e')](config['root'],'server',_0x8c9a('0x95'),_0x8c9a('0x6d'));var _0x381266=util[_0x8c9a('0x77')](_0x8c9a('0x96'),_0x486031);return db['MailMessage'][_0x8c9a('0x54')]({'where':{'id':_0x371ffa[_0x8c9a('0x52')]['id']},'attributes':['id',_0x8c9a('0x56'),'from','to','cc',_0x8c9a('0x97'),_0x8c9a('0x98'),_0x8c9a('0x99')],'include':_0x371ffa[_0x8c9a('0x40')][_0x8c9a('0x6d')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x8c9a('0x28')](handleEntityNotFound(_0x13f3d1,null))[_0x8c9a('0x28')](function(_0x4cacde){if(_0x4cacde){var _0x5cd5a3=_0x4cacde;var _0x44c69d={'from':_0x5cd5a3[_0x8c9a('0x9a')],'to':_0x5cd5a3['to'],'subject':_0x5cd5a3[_0x8c9a('0x98')],'html':_0x5cd5a3[_0x8c9a('0x56')],'headers':{'Date':moment(_0x5cd5a3[_0x8c9a('0x99')])[_0x8c9a('0x77')](_0x8c9a('0x9b'))},'attachments':[]};if(_0x4cacde['cc']){_0x44c69d[_0x8c9a('0x9c')]['Cc']=_0x4cacde['cc'];}if(_0x4cacde[_0x8c9a('0x97')]){_0x44c69d[_0x8c9a('0x9c')][_0x8c9a('0x9d')]=_0x4cacde['bcc'];}return new BPromise(function(_0x59ff2b,_0x8cd94d){if(_0x4cacde[_0x8c9a('0x9e')]){for(var _0x131a31=0x0;_0x131a31<_0x4cacde[_0x8c9a('0x9e')][_0x8c9a('0x46')];_0x131a31++){var _0x32bd47=_0x4cacde[_0x8c9a('0x9e')][_0x131a31];var _0x4af18c=path[_0x8c9a('0x6e')](_0x306dd5,_0x32bd47[_0x8c9a('0x71')]);if(fs[_0x8c9a('0x9f')](_0x4af18c)){_0x44c69d[_0x8c9a('0x6d')][_0x8c9a('0xa0')]({'name':_0x32bd47[_0x8c9a('0x3c')],'contentType':_0x32bd47['type'],'data':fs[_0x8c9a('0xa1')](_0x4af18c)});}}}emlformat[_0x8c9a('0xa2')](_0x44c69d,function(_0x88329c,_0x1caefb){if(_0x88329c)return _0x8cd94d(_0x88329c);fs['writeFileSync'](path[_0x8c9a('0x6e')](_0x277b0f,_0x381266),_0x1caefb);return _0x59ff2b(_0x1caefb);});});}})[_0x8c9a('0x28')](function(_0x4b8094){if(_0x4b8094){return _0x13f3d1[_0x8c9a('0x91')](path[_0x8c9a('0x6e')](_0x277b0f,_0x381266),_0x381266,function(_0x2ccecf){if(_0x2ccecf){console[_0x8c9a('0xa3')]('err',_0x2ccecf);}else{fs[_0x8c9a('0xa4')](path[_0x8c9a('0x6e')](_0x277b0f,_0x381266));}});}})[_0x8c9a('0x50')](handleError(_0x13f3d1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fb4beb7..f42f947 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 _0x03cc=['MailMessage','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0x03cc,0xda));var _0xc03c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x03cc[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require(_0xc03c('0x0'));var MailMessage=require(_0xc03c('0x1'))['db'][_0xc03c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc03c('0x3')](0x0);var events={'afterCreate':_0xc03c('0x4'),'afterUpdate':_0xc03c('0x5'),'afterDestroy':_0xc03c('0x6')};function emitEvent(_0xe4b6fc){return function(_0x170283,_0x342174,_0x58578b){MailMessageEvents[_0xc03c('0x7')](_0xe4b6fc+':'+_0x170283['id'],_0x170283);MailMessageEvents[_0xc03c('0x7')](_0xe4b6fc,_0x170283);_0x58578b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xc03c('0x8')](e,emitEvent(event));}}module[_0xc03c('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xb18c=['update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0x267621,_0xb64691){var _0x1180e3=function(_0x157ae3){while(--_0x157ae3){_0x267621['push'](_0x267621['shift']());}};_0x1180e3(++_0xb64691);}(_0xb18c,0xf6));var _0xcb18=function(_0x35ee50,_0xf759c6){_0x35ee50=_0x35ee50-0x0;var _0x49e07c=_0xb18c[_0x35ee50];return _0x49e07c;};'use strict';var EventEmitter=require(_0xcb18('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xcb18('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcb18('0x2')](0x0);var events={'afterCreate':_0xcb18('0x3'),'afterUpdate':_0xcb18('0x4'),'afterDestroy':_0xcb18('0x5')};function emitEvent(_0x2d87ab){return function(_0x1a0427,_0x5d7e64,_0x4ed5e8){MailMessageEvents[_0xcb18('0x6')](_0x2d87ab+':'+_0x1a0427['id'],_0x1a0427);MailMessageEvents[_0xcb18('0x6')](_0x2d87ab,_0x1a0427);_0x4ed5e8(null);};}for(var e in events){if(events[_0xcb18('0x7')](e)){var event=events[e];MailMessage[_0xcb18('0x8')](e,emitEvent(event));}}module[_0xcb18('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8732391..c961a0d 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 _0xc5d9=['MailInteraction','MailInteractionId','then','createdAt','body','catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','fromString','direction','toLowerCase','out','isNil','UserId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc5d9,0x104));var _0x9c5d=function(_0x9d6672,_0x158fd6){_0x9d6672=_0x9d6672-0x0;var _0x5a40fd=_0xc5d9[_0x9d6672];return _0x5a40fd;};'use strict';var _=require(_0x9c5d('0x0'));var util=require('util');var logger=require(_0x9c5d('0x1'))(_0x9c5d('0x2'));var moment=require(_0x9c5d('0x3'));var BPromise=require(_0x9c5d('0x4'));var rp=require('request-promise');var htmlToText=require(_0x9c5d('0x5'));var fs=require('fs');var path=require(_0x9c5d('0x6'));var rimraf=require(_0x9c5d('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module['exports']=function(_0x40ed2f,_0x4d52f2){return _0x40ed2f[_0x9c5d('0x8')](_0x9c5d('0x9'),attributes,{'tableName':_0x9c5d('0xa'),'paranoid':![],'indexes':[{'name':_0x9c5d('0xb'),'fields':[_0x9c5d('0xb')]},{'name':'fti_mail_messages','fields':[_0x9c5d('0xc'),'subject'],'type':_0x9c5d('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x388736,_0x57fc4b,_0xed6f5c){if(_0x388736['body']){_0x388736[_0x9c5d('0xc')]=htmlToText[_0x9c5d('0xe')](_0x388736['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xed6f5c(null,_0x57fc4b);},'afterCreate':function(_0x4895f6,_0x272484,_0x39f0ce){var _0x521744=_0x40ed2f['models'];var _0x561c2f=_0x4895f6['get']({'plain':!![]});if(_0x561c2f[_0x9c5d('0xf')][_0x9c5d('0x10')]()==='in'||_0x561c2f[_0x9c5d('0xf')]['toLowerCase']()===_0x9c5d('0x11')&&!_0x561c2f['secret']&&!_[_0x9c5d('0x12')](_0x561c2f[_0x9c5d('0x13')])){_0x521744[_0x9c5d('0x14')]['findOne']({'where':{'id':_0x561c2f[_0x9c5d('0x15')]}})[_0x9c5d('0x16')](function(_0x5906cb){if(_0x5906cb){_0x5906cb['update']({'lastMsgAt':_0x561c2f[_0x9c5d('0x17')],'lastMsgDirection':_0x561c2f[_0x9c5d('0xf')][_0x9c5d('0x10')](),'lastMsgBody':_0x561c2f[_0x9c5d('0x18')]});}})[_0x9c5d('0x19')](function(_0x350b9c){console[_0x9c5d('0x1a')](_0x350b9c);});}_0x39f0ce();}},'charset':_0x9c5d('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x75f0=['FULLTEXT','body','plainBody','fromString','models','get','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject'];(function(_0x523dda,_0x282705){var _0x2db386=function(_0x28fa52){while(--_0x28fa52){_0x523dda['push'](_0x523dda['shift']());}};_0x2db386(++_0x282705);}(_0x75f0,0x1f0));var _0x075f=function(_0x465e84,_0x2ad6f8){_0x465e84=_0x465e84-0x0;var _0x29c6df=_0x75f0[_0x465e84];return _0x29c6df;};'use strict';var _=require(_0x075f('0x0'));var util=require('util');var logger=require(_0x075f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x075f('0x2'));var htmlToText=require(_0x075f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x075f('0x4'));var config=require(_0x075f('0x5'));var attributes=require(_0x075f('0x6'));module[_0x075f('0x7')]=function(_0x461ee8,_0x11830f){return _0x461ee8[_0x075f('0x8')](_0x075f('0x9'),attributes,{'tableName':_0x075f('0xa'),'paranoid':![],'indexes':[{'name':_0x075f('0xb'),'fields':['messageId']},{'name':_0x075f('0xc'),'fields':['plainBody',_0x075f('0xd')],'type':_0x075f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32d32f,_0x558534,_0x15c2ab){if(_0x32d32f[_0x075f('0xf')]){_0x32d32f[_0x075f('0x10')]=htmlToText[_0x075f('0x11')](_0x32d32f[_0x075f('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x15c2ab(null,_0x558534);},'afterCreate':function(_0x1cb8c0,_0x56889f,_0x183650){var _0x5ca485=_0x461ee8[_0x075f('0x12')];var _0x3ec0b9=_0x1cb8c0[_0x075f('0x13')]({'plain':!![]});if(_0x3ec0b9['direction'][_0x075f('0x14')]()==='in'||_0x3ec0b9['direction']['toLowerCase']()===_0x075f('0x15')&&!_0x3ec0b9[_0x075f('0x16')]&&!_['isNil'](_0x3ec0b9[_0x075f('0x17')])){_0x5ca485[_0x075f('0x18')][_0x075f('0x19')]({'where':{'id':_0x3ec0b9[_0x075f('0x1a')]}})[_0x075f('0x1b')](function(_0x430db7){if(_0x430db7){_0x430db7[_0x075f('0x1c')]({'lastMsgAt':_0x3ec0b9[_0x075f('0x1d')],'lastMsgDirection':_0x3ec0b9[_0x075f('0x1e')][_0x075f('0x14')](),'lastMsgBody':_0x3ec0b9['body']});}})['catch'](function(_0x4fb8c4){console[_0x075f('0x1f')](_0x4fb8c4);});}_0x183650();}},'charset':_0x075f('0x20'),'collate':_0x075f('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1e615c4..3193199 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 _0x4385=['error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23baf1,_0x1ffe8e){var _0x3c2bac=function(_0x3ae0cc){while(--_0x3ae0cc){_0x23baf1['push'](_0x23baf1['shift']());}};_0x3c2bac(++_0x1ffe8e);}(_0x4385,0x168));var _0x5438=function(_0x485735,_0x5b2e56){_0x485735=_0x485735-0x0;var _0x3cff81=_0x4385[_0x485735];return _0x3cff81;};'use strict';var _=require(_0x5438('0x0'));var util=require(_0x5438('0x1'));var moment=require(_0x5438('0x2'));var BPromise=require(_0x5438('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5438('0x4'));var db=require(_0x5438('0x5'))['db'];var utils=require(_0x5438('0x6'));var logger=require(_0x5438('0x7'))(_0x5438('0x8'));var config=require(_0x5438('0x9'));var jayson=require(_0x5438('0xa'));var client=jayson[_0x5438('0xb')][_0x5438('0xc')]({'port':0x232a});config[_0x5438('0xd')]=_[_0x5438('0xe')](config[_0x5438('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5438('0xf'))(new Redis(config[_0x5438('0xd')]));require(_0x5438('0x10'))[_0x5438('0x11')](socket);function respondWithRpcPromise(_0x4e3c45,_0x1c11b8,_0x51c7a8){return new BPromise(function(_0x21805b,_0xac3f79){return client[_0x5438('0x12')](_0x4e3c45,_0x51c7a8)['then'](function(_0xb3050){logger[_0x5438('0x13')](_0x5438('0x14'),_0x1c11b8,_0x5438('0x15'));logger[_0x5438('0x16')](_0x5438('0x17'),_0x1c11b8,_0x5438('0x15'),JSON[_0x5438('0x18')](_0xb3050));if(_0xb3050[_0x5438('0x19')]){if(_0xb3050[_0x5438('0x19')][_0x5438('0x1a')]===0x1f4){logger[_0x5438('0x19')]('MailMessage,\x20%s,\x20%s',_0x1c11b8,_0xb3050[_0x5438('0x19')]['message']);return _0xac3f79(_0xb3050[_0x5438('0x19')][_0x5438('0x1b')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x1c11b8,_0xb3050[_0x5438('0x19')]['message']);return _0x21805b(_0xb3050[_0x5438('0x19')]['message']);}else{logger[_0x5438('0x13')](_0x5438('0x14'),_0x1c11b8,_0x5438('0x15'));_0x21805b(_0xb3050[_0x5438('0x1c')][_0x5438('0x1b')]);}})[_0x5438('0x1d')](function(_0x70532a){logger[_0x5438('0x19')](_0x5438('0x14'),_0x1c11b8,_0x70532a);_0xac3f79(_0x70532a);});});}exports[_0x5438('0x1e')]=function(_0x4bb5f4){var _0xcd2391=this;return new Promise(function(_0xe6845c,_0x9c322){return db[_0x5438('0x1f')][_0x5438('0x20')](_0x4bb5f4['body'],{'raw':_0x4bb5f4[_0x5438('0x21')]?_0x4bb5f4[_0x5438('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x5438('0x22')](function(_0x2bf7dd){logger[_0x5438('0x13')]('CreateMailMessage',_0x4bb5f4);logger[_0x5438('0x16')]('CreateMailMessage',_0x4bb5f4,JSON[_0x5438('0x18')](_0x2bf7dd));_0xe6845c(_0x2bf7dd);})[_0x5438('0x1d')](function(_0xe8a3dd){logger[_0x5438('0x19')]('CreateMailMessage',_0xe8a3dd[_0x5438('0x1b')],_0x4bb5f4);_0x9c322(_0xcd2391[_0x5438('0x19')](0x1f4,_0xe8a3dd[_0x5438('0x1b')]));});});}; \ No newline at end of file +var _0x61b2=['../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateMailMessage','MailMessage','create','body','options','raw','catch','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2688f0,_0x35989d){var _0x4b595f=function(_0x1dbedf){while(--_0x1dbedf){_0x2688f0['push'](_0x2688f0['shift']());}};_0x4b595f(++_0x35989d);}(_0x61b2,0x1eb));var _0x261b=function(_0x4e3026,_0x2e0d58){_0x4e3026=_0x4e3026-0x0;var _0x1591bb=_0x61b2[_0x4e3026];return _0x1591bb;};'use strict';var _=require('lodash');var util=require(_0x261b('0x0'));var moment=require('moment');var BPromise=require(_0x261b('0x1'));var rs=require(_0x261b('0x2'));var fs=require('fs');var Redis=require(_0x261b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x261b('0x4'));var logger=require(_0x261b('0x5'))(_0x261b('0x6'));var config=require(_0x261b('0x7'));var jayson=require(_0x261b('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x261b('0x9')](config[_0x261b('0xa')],{'host':_0x261b('0xb'),'port':0x18eb});var socket=require(_0x261b('0xc'))(new Redis(config[_0x261b('0xa')]));require('./mailMessage.socket')[_0x261b('0xd')](socket);function respondWithRpcPromise(_0x4e89af,_0x466c5f,_0x324afd){return new BPromise(function(_0x16b99f,_0x2aead1){return client['request'](_0x4e89af,_0x324afd)[_0x261b('0xe')](function(_0x302470){logger['info'](_0x261b('0xf'),_0x466c5f,_0x261b('0x10'));logger[_0x261b('0x11')](_0x261b('0x12'),_0x466c5f,_0x261b('0x10'),JSON['stringify'](_0x302470));if(_0x302470['error']){if(_0x302470[_0x261b('0x13')][_0x261b('0x14')]===0x1f4){logger[_0x261b('0x13')](_0x261b('0xf'),_0x466c5f,_0x302470['error'][_0x261b('0x15')]);return _0x2aead1(_0x302470[_0x261b('0x13')][_0x261b('0x15')]);}logger[_0x261b('0x13')](_0x261b('0xf'),_0x466c5f,_0x302470[_0x261b('0x13')]['message']);return _0x16b99f(_0x302470[_0x261b('0x13')][_0x261b('0x15')]);}else{logger[_0x261b('0x16')](_0x261b('0xf'),_0x466c5f,_0x261b('0x10'));_0x16b99f(_0x302470[_0x261b('0x17')][_0x261b('0x15')]);}})['catch'](function(_0x345617){logger[_0x261b('0x13')](_0x261b('0xf'),_0x466c5f,_0x345617);_0x2aead1(_0x345617);});});}exports[_0x261b('0x18')]=function(_0x4f2374){var _0x40f65f=this;return new Promise(function(_0x117152,_0x438e53){return db[_0x261b('0x19')][_0x261b('0x1a')](_0x4f2374[_0x261b('0x1b')],{'raw':_0x4f2374[_0x261b('0x1c')]?_0x4f2374[_0x261b('0x1c')][_0x261b('0x1d')]===undefined?!![]:![]:!![]})[_0x261b('0xe')](function(_0x47e99f){logger[_0x261b('0x16')](_0x261b('0x18'),_0x4f2374);logger[_0x261b('0x11')](_0x261b('0x18'),_0x4f2374,JSON['stringify'](_0x47e99f));_0x117152(_0x47e99f);})[_0x261b('0x1e')](function(_0x55d311){logger['error'](_0x261b('0x18'),_0x55d311[_0x261b('0x15')],_0x4f2374);_0x438e53(_0x40f65f['error'](0x1f4,_0x55d311['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 02ce6ac..57b9044 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 _0x854a=['register','mailMessage:','./mailMessage.events','save','update','removeListener'];(function(_0x29a196,_0xd6a313){var _0x308b31=function(_0x5a2fb2){while(--_0x5a2fb2){_0x29a196['push'](_0x29a196['shift']());}};_0x308b31(++_0xd6a313);}(_0x854a,0x1e8));var _0xa854=function(_0x168845,_0xd47622){_0x168845=_0x168845-0x0;var _0x5f41c7=_0x854a[_0x168845];return _0x5f41c7;};'use strict';var MailMessageEvents=require(_0xa854('0x0'));var events=[_0xa854('0x1'),'remove',_0xa854('0x2')];function createListener(_0xefccb6,_0x4c3191){return function(_0x506d4e){_0x4c3191['emit'](_0xefccb6,_0x506d4e);};}function removeListener(_0x4c912f,_0x540564){return function(){MailMessageEvents[_0xa854('0x3')](_0x4c912f,_0x540564);};}exports[_0xa854('0x4')]=function(_0x10050d){for(var _0x3456f2=0x0,_0x3e26f6=events['length'];_0x3456f2<_0x3e26f6;_0x3456f2++){var _0x55a0cb=events[_0x3456f2];var _0x5150fc=createListener(_0xa854('0x5')+_0x55a0cb,_0x10050d);MailMessageEvents['on'](_0x55a0cb,_0x5150fc);}}; \ No newline at end of file +var _0xe18c=['update','emit','length','mailMessage:','./mailMessage.events','save'];(function(_0x182cbd,_0x3b513a){var _0x48ade4=function(_0x544b8b){while(--_0x544b8b){_0x182cbd['push'](_0x182cbd['shift']());}};_0x48ade4(++_0x3b513a);}(_0xe18c,0x178));var _0xce18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe18c[_0x321bb2];return _0x9c12ed;};'use strict';var MailMessageEvents=require(_0xce18('0x0'));var events=[_0xce18('0x1'),'remove',_0xce18('0x2')];function createListener(_0x3ea3cd,_0x5f24d4){return function(_0x3fc1b6){_0x5f24d4[_0xce18('0x3')](_0x3ea3cd,_0x3fc1b6);};}function removeListener(_0x211a9e,_0x4ec30d){return function(){MailMessageEvents['removeListener'](_0x211a9e,_0x4ec30d);};}exports['register']=function(_0x40cbbe){for(var _0x444180=0x0,_0xb09964=events[_0xce18('0x4')];_0x444180<_0xb09964;_0x444180++){var _0x38d2c6=events[_0x444180];var _0x9e9d64=createListener(_0xce18('0x5')+_0x38d2c6,_0x40cbbe);MailMessageEvents['on'](_0x38d2c6,_0x9e9d64);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 81628d4..165c7e7 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 _0x8603=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8603,0xe0));var _0x3860=function(_0x5e4256,_0x595a98){_0x5e4256=_0x5e4256-0x0;var _0x395afe=_0x8603[_0x5e4256];return _0x395afe;};'use strict';var multer=require(_0x3860('0x0'));var util=require(_0x3860('0x1'));var path=require(_0x3860('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3860('0x3')]();var auth=require(_0x3860('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3860('0x5'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0x3860('0x6')](),controller['index']);router[_0x3860('0x7')](_0x3860('0x8'),auth['isAuthenticated'](),controller[_0x3860('0x9')]);router[_0x3860('0x7')](_0x3860('0xa'),auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0x7')](_0x3860('0xc'),auth[_0x3860('0x6')](),controller[_0x3860('0xd')]);router[_0x3860('0x7')](_0x3860('0xe'),auth[_0x3860('0x6')](),controller[_0x3860('0xf')]);router[_0x3860('0x7')](_0x3860('0x10'),auth[_0x3860('0x6')](),controller[_0x3860('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3860('0x12')](_0x3860('0xe'),auth['isAuthenticated'](),controller[_0x3860('0x13')]);router['post'](_0x3860('0x10'),auth[_0x3860('0x6')](),controller[_0x3860('0x14')]);router[_0x3860('0x15')]('/:id',auth[_0x3860('0x6')](),controller[_0x3860('0x16')]);router[_0x3860('0x17')](_0x3860('0xa'),auth[_0x3860('0x6')](),controller[_0x3860('0x18')]);router['delete'](_0x3860('0xe'),auth[_0x3860('0x6')](),controller['removeTeams']);router[_0x3860('0x17')](_0x3860('0x10'),auth[_0x3860('0x6')](),controller[_0x3860('0x19')]);module['exports']=router; \ No newline at end of file +var _0x48f3=['getMembers','/:id/teams','getTeams','/:id/users','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members'];(function(_0x275e58,_0x5ed75e){var _0x36b2a2=function(_0x3a86fa){while(--_0x3a86fa){_0x275e58['push'](_0x275e58['shift']());}};_0x36b2a2(++_0x5ed75e);}(_0x48f3,0x186));var _0x348f=function(_0x189364,_0x5c3657){_0x189364=_0x189364-0x0;var _0x25fb94=_0x48f3[_0x189364];return _0x25fb94;};'use strict';var multer=require('multer');var util=require(_0x348f('0x0'));var path=require(_0x348f('0x1'));var timeout=require(_0x348f('0x2'));var express=require(_0x348f('0x3'));var router=express[_0x348f('0x4')]();var auth=require(_0x348f('0x5'));var interaction=require(_0x348f('0x6'));var config=require('../../config/environment');var controller=require(_0x348f('0x7'));router['get']('/',auth[_0x348f('0x8')](),controller[_0x348f('0x9')]);router[_0x348f('0xa')](_0x348f('0xb'),auth['isAuthenticated'](),controller[_0x348f('0xc')]);router[_0x348f('0xa')](_0x348f('0xd'),auth[_0x348f('0x8')](),controller[_0x348f('0xe')]);router[_0x348f('0xa')](_0x348f('0xf'),auth[_0x348f('0x8')](),controller[_0x348f('0x10')]);router[_0x348f('0xa')](_0x348f('0x11'),auth[_0x348f('0x8')](),controller[_0x348f('0x12')]);router[_0x348f('0xa')](_0x348f('0x13'),auth[_0x348f('0x8')](),controller['getAgents']);router['post']('/',auth[_0x348f('0x8')](),controller[_0x348f('0x14')]);router['post']('/:id/teams',auth[_0x348f('0x8')](),controller[_0x348f('0x15')]);router['post'](_0x348f('0x13'),auth[_0x348f('0x8')](),controller[_0x348f('0x16')]);router[_0x348f('0x17')](_0x348f('0xd'),auth[_0x348f('0x8')](),controller[_0x348f('0x18')]);router[_0x348f('0x19')]('/:id',auth[_0x348f('0x8')](),controller[_0x348f('0x1a')]);router['delete'](_0x348f('0x11'),auth[_0x348f('0x8')](),controller[_0x348f('0x1b')]);router[_0x348f('0x19')](_0x348f('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x348f('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 d45c995..2a0265f 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 _0xe6e9=['beepall','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6e9,0x182));var _0x9e6e=function(_0xcf99c1,_0x59b578){_0xcf99c1=_0xcf99c1-0x0;var _0x4df38c=_0xe6e9[_0xcf99c1];return _0x4df38c;};'use strict';var Sequelize=require(_0x9e6e('0x0'));module[_0x9e6e('0x1')]={'name':{'type':Sequelize[_0x9e6e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e6e('0x2')]},'timeout':{'type':Sequelize[_0x9e6e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9e6e('0x4')](_0x9e6e('0x5'),_0x9e6e('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x0348=['name','STRING','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0348,0x1e9));var _0x8034=function(_0x45564a,_0x160043){_0x45564a=_0x45564a-0x0;var _0x1184c7=_0x0348[_0x45564a];return _0x1184c7;};'use strict';var Sequelize=require('sequelize');module[_0x8034('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8034('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8034('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8034('0x3')](_0x8034('0x4'),_0x8034('0x5'),_0x8034('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index fa141ac..92c24de 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 _0x135b=['ids','Agents','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','emit','userMailQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','get','MailQueues','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','online','voicePause','interface','flatMap','sequelize','each','forEach','removeTeams'];(function(_0x27de74,_0x2dc8d8){var _0x3b3828=function(_0x1287ce){while(--_0x1287ce){_0x27de74['push'](_0x27de74['shift']());}};_0x3b3828(++_0x2dc8d8);}(_0x135b,0xaf));var _0xb135=function(_0x447ac9,_0x71e5d6){_0x447ac9=_0x447ac9-0x0;var _0x565b54=_0x135b[_0x447ac9];return _0x565b54;};'use strict';var pdf=require(_0xb135('0x0'));var emlformat=require(_0xb135('0x1'));var rimraf=require(_0xb135('0x2'));var zipdir=require(_0xb135('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb135('0x4'));var moment=require(_0xb135('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb135('0x6'));var util=require(_0xb135('0x7'));var path=require(_0xb135('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb135('0x9'));var squel=require(_0xb135('0xa'));var crypto=require(_0xb135('0xb'));var jsforce=require(_0xb135('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb135('0xd'));var querystring=require(_0xb135('0xe'));var Papa=require(_0xb135('0xf'));var Redis=require(_0xb135('0x10'));var authService=require(_0xb135('0x11'));var qs=require(_0xb135('0x12'));var as=require(_0xb135('0x13'));var hardwareService=require(_0xb135('0x14'));var logger=require(_0xb135('0x15'))(_0xb135('0x16'));var utils=require(_0xb135('0x17'));var config=require(_0xb135('0x18'));var licenseUtil=require(_0xb135('0x19'));var db=require(_0xb135('0x1a'))['db'];config[_0xb135('0x1b')]=_[_0xb135('0x1c')](config[_0xb135('0x1b')],{'host':_0xb135('0x1d'),'port':0x18eb});var socket=require(_0xb135('0x1e'))(new Redis(config['redis']));require(_0xb135('0x1f'))['register'](socket);function respondWithStatusCode(_0x10770e,_0xd1f2f1){_0xd1f2f1=_0xd1f2f1||0xcc;return function(_0x1c6b86){if(_0x1c6b86){return _0x10770e[_0xb135('0x20')](_0xd1f2f1);}return _0x10770e[_0xb135('0x21')](_0xd1f2f1)[_0xb135('0x22')]();};}function respondWithResult(_0x385704,_0x35950d){_0x35950d=_0x35950d||0xc8;return function(_0x345287){if(_0x345287){return _0x385704['status'](_0x35950d)[_0xb135('0x23')](_0x345287);}};}function respondWithFilteredResult(_0x29e2de,_0x45c4ae){return function(_0x51b18f){if(_0x51b18f){var _0x5d9010=_0x51b18f[_0xb135('0x24')],_0x2975bf=_0x45c4ae[_0xb135('0x25')],_0x47d9ef=_0x45c4ae[_0xb135('0x25')]+_0x45c4ae[_0xb135('0x26')],_0x9530ac;if(_0x47d9ef>=_0x5d9010){_0x47d9ef=_0x5d9010;_0x9530ac=0xc8;}else{_0x9530ac=0xce;}_0x29e2de[_0xb135('0x21')](_0x9530ac);return _0x29e2de[_0xb135('0x27')](_0xb135('0x28'),_0x2975bf+'-'+_0x47d9ef+'/'+_0x5d9010)[_0xb135('0x23')](_0x51b18f);}return null;};}function patchUpdates(_0x42c960){return function(_0x5465a5){try{jsonpatch[_0xb135('0x29')](_0x5465a5,_0x42c960,!![]);}catch(_0x4eb37b){return BPromise[_0xb135('0x2a')](_0x4eb37b);}return _0x5465a5['save']();};}function saveUpdates(_0x36b7a4,_0x5017a1){return function(_0x53f7a7){if(_0x53f7a7){return _0x53f7a7['update'](_0x36b7a4)['then'](function(_0x5ba018){return _0x5ba018;});}return null;};}function removeEntity(_0x47e22f,_0x489fb9){return function(_0x2e54c7){if(_0x2e54c7){return _0x2e54c7['destroy']()[_0xb135('0x2b')](function(){var _0x53c4b2=_0x2e54c7['get']({'plain':!![]});var _0x3dd506='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x3dd506,'resourceId':_0x53c4b2['id']}})['then'](function(){return _0x2e54c7;});})[_0xb135('0x2b')](function(){_0x47e22f[_0xb135('0x21')](0xcc)[_0xb135('0x22')]();});}};}function handleEntityNotFound(_0x2d1389,_0x11d086){return function(_0x1da1f3){if(!_0x1da1f3){_0x2d1389[_0xb135('0x20')](0x194);}return _0x1da1f3;};}function handleError(_0x1a0274,_0x3426eb){_0x3426eb=_0x3426eb||0x1f4;return function(_0x565e84){logger['error'](_0x565e84[_0xb135('0x2c')]);if(_0x565e84[_0xb135('0x2d')]){delete _0x565e84[_0xb135('0x2d')];}_0x1a0274[_0xb135('0x21')](_0x3426eb)[_0xb135('0x2e')](_0x565e84);};}exports[_0xb135('0x2f')]=function(_0x2d521c,_0x30fc67){var _0x4f88c1={},_0x28eed8={},_0x124f58={'count':0x0,'rows':[]};var _0x46c11e=_['map'](db['MailQueue'][_0xb135('0x30')],function(_0x32b60a){return{'name':_0x32b60a[_0xb135('0x31')],'type':_0x32b60a[_0xb135('0x32')]['key']};});_0x28eed8[_0xb135('0x33')]=_[_0xb135('0x34')](_0x46c11e,_0xb135('0x2d'));_0x28eed8[_0xb135('0x35')]=_['keys'](_0x2d521c[_0xb135('0x35')]);_0x28eed8[_0xb135('0x36')]=_[_0xb135('0x37')](_0x28eed8[_0xb135('0x33')],_0x28eed8['query']);_0x4f88c1['attributes']=_[_0xb135('0x37')](_0x28eed8[_0xb135('0x33')],qs[_0xb135('0x38')](_0x2d521c[_0xb135('0x35')][_0xb135('0x38')]));_0x4f88c1[_0xb135('0x39')]=_0x4f88c1[_0xb135('0x39')][_0xb135('0x3a')]?_0x4f88c1['attributes']:_0x28eed8['model'];if(!_0x2d521c[_0xb135('0x35')][_0xb135('0x3b')]('nolimit')){_0x4f88c1[_0xb135('0x26')]=qs[_0xb135('0x26')](_0x2d521c['query'][_0xb135('0x26')]);_0x4f88c1[_0xb135('0x25')]=qs[_0xb135('0x25')](_0x2d521c[_0xb135('0x35')][_0xb135('0x25')]);}_0x4f88c1[_0xb135('0x3c')]=qs['sort'](_0x2d521c['query'][_0xb135('0x3d')]);_0x4f88c1[_0xb135('0x3e')]=qs[_0xb135('0x36')](_[_0xb135('0x3f')](_0x2d521c[_0xb135('0x35')],_0x28eed8[_0xb135('0x36')]),_0x46c11e);if(_0x2d521c[_0xb135('0x35')][_0xb135('0x40')]){_0x4f88c1['where']=_[_0xb135('0x41')](_0x4f88c1['where'],{'$or':_[_0xb135('0x34')](_0x46c11e,function(_0x32f7d8){if(_0x32f7d8[_0xb135('0x32')]!==_0xb135('0x42')){var _0x2877b7={};_0x2877b7[_0x32f7d8[_0xb135('0x2d')]]={'$like':'%'+_0x2d521c['query'][_0xb135('0x40')]+'%'};return _0x2877b7;}})});}_0x4f88c1=_[_0xb135('0x41')]({},_0x4f88c1,_0x2d521c[_0xb135('0x43')]);var _0x16a010={'where':_0x4f88c1[_0xb135('0x3e')]};return db[_0xb135('0x44')][_0xb135('0x24')](_0x16a010)[_0xb135('0x2b')](function(_0xe7fc80){_0x124f58['count']=_0xe7fc80;if(_0x2d521c[_0xb135('0x35')]['includeAll']){_0x4f88c1[_0xb135('0x45')]=[{'all':!![]}];}return db[_0xb135('0x44')][_0xb135('0x46')](_0x4f88c1);})['then'](function(_0x125bca){_0x124f58[_0xb135('0x47')]=_0x125bca;return _0x124f58;})['then'](respondWithFilteredResult(_0x30fc67,_0x4f88c1))[_0xb135('0x48')](handleError(_0x30fc67,null));};exports[_0xb135('0x49')]=function(_0x24e368,_0x54983c){var _0x5169a1={'raw':!![],'where':{'id':_0x24e368[_0xb135('0x4a')]['id']}},_0x5400d9={};_0x5400d9[_0xb135('0x33')]=_[_0xb135('0x4b')](db[_0xb135('0x44')][_0xb135('0x30')]);_0x5400d9[_0xb135('0x35')]=_[_0xb135('0x4b')](_0x24e368[_0xb135('0x35')]);_0x5400d9['filters']=_[_0xb135('0x37')](_0x5400d9[_0xb135('0x33')],_0x5400d9[_0xb135('0x35')]);_0x5169a1[_0xb135('0x39')]=_['intersection'](_0x5400d9[_0xb135('0x33')],qs[_0xb135('0x38')](_0x24e368['query']['fields']));_0x5169a1[_0xb135('0x39')]=_0x5169a1[_0xb135('0x39')][_0xb135('0x3a')]?_0x5169a1[_0xb135('0x39')]:_0x5400d9[_0xb135('0x33')];if(_0x24e368[_0xb135('0x35')][_0xb135('0x4c')]){_0x5169a1[_0xb135('0x45')]=[{'all':!![]}];}_0x5169a1=_[_0xb135('0x41')]({},_0x5169a1,_0x24e368[_0xb135('0x43')]);return db[_0xb135('0x44')][_0xb135('0x4d')](_0x5169a1)[_0xb135('0x2b')](handleEntityNotFound(_0x54983c,null))[_0xb135('0x2b')](respondWithResult(_0x54983c,null))[_0xb135('0x48')](handleError(_0x54983c,null));};exports[_0xb135('0x4e')]=function(_0x3f85f2,_0x45db74){return db[_0xb135('0x44')][_0xb135('0x4e')](_0x3f85f2[_0xb135('0x4f')],{})[_0xb135('0x2b')](function(_0x5d0768){var _0x3b2105=_0x3f85f2[_0xb135('0x50')][_0xb135('0x51')]({'plain':!![]});if(!_0x3b2105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b2105['role']===_0xb135('0x50')){var _0x3d422e=_0x5d0768['get']({'plain':!![]});var _0xa29062=_0xb135('0x52');return db[_0xb135('0x53')][_0xb135('0x4d')]({'where':{'name':_0xa29062,'userProfileId':_0x3b2105[_0xb135('0x54')]},'raw':!![]})[_0xb135('0x2b')](function(_0x273f91){if(_0x273f91&&_0x273f91['autoAssociation']===0x0){return db[_0xb135('0x55')][_0xb135('0x4e')]({'name':_0x3d422e[_0xb135('0x2d')],'resourceId':_0x3d422e['id'],'type':_0x273f91[_0xb135('0x2d')],'sectionId':_0x273f91['id']},{})['then'](function(){return _0x5d0768;});}else{return _0x5d0768;}})[_0xb135('0x48')](function(_0x2ff74c){logger[_0xb135('0x56')](_0xb135('0x57'),_0x2ff74c);throw _0x2ff74c;});}return _0x5d0768;})[_0xb135('0x2b')](respondWithResult(_0x45db74,0xc9))[_0xb135('0x48')](handleError(_0x45db74,null));};exports[_0xb135('0x58')]=function(_0x586711,_0x3a034c){if(_0x586711[_0xb135('0x4f')]['id']){delete _0x586711[_0xb135('0x4f')]['id'];}return db[_0xb135('0x44')][_0xb135('0x4d')]({'where':{'id':_0x586711[_0xb135('0x4a')]['id']}})[_0xb135('0x2b')](handleEntityNotFound(_0x3a034c,null))[_0xb135('0x2b')](saveUpdates(_0x586711[_0xb135('0x4f')],null))[_0xb135('0x2b')](respondWithResult(_0x3a034c,null))[_0xb135('0x48')](handleError(_0x3a034c,null));};exports[_0xb135('0x59')]=function(_0x2fcbcb,_0x441d0d){return db[_0xb135('0x44')][_0xb135('0x4d')]({'where':{'id':_0x2fcbcb[_0xb135('0x4a')]['id']}})['then'](handleEntityNotFound(_0x441d0d,null))['then'](removeEntity(_0x441d0d,null))[_0xb135('0x48')](handleError(_0x441d0d,null));};exports[_0xb135('0x5a')]=function(_0xd38639,_0x317f7d){return db['MailQueue'][_0xb135('0x5a')]()[_0xb135('0x2b')](respondWithResult(_0x317f7d,null))[_0xb135('0x48')](handleError(_0x317f7d,null));};exports[_0xb135('0x5b')]=function(_0x2943a2,_0x493840,_0x4526d5){var _0xb66fe5={'raw':!![],'where':{}},_0x465dfa={},_0x6685ee;return db[_0xb135('0x44')]['findOne']({'where':{'id':_0x2943a2[_0xb135('0x4a')]['id']}})[_0xb135('0x2b')](handleEntityNotFound(_0x493840,null))[_0xb135('0x2b')](function(_0x15f7e7){if(_0x15f7e7){_0x6685ee=_0x15f7e7[_0xb135('0x51')]({'plain':!![]});_0x465dfa[_0xb135('0x33')]=_[_0xb135('0x4b')](db[_0xb135('0x5c')]['rawAttributes']);_0x465dfa[_0xb135('0x35')]=_[_0xb135('0x4b')](_0x2943a2[_0xb135('0x35')]);_0x465dfa[_0xb135('0x36')]=_[_0xb135('0x37')](_0x465dfa['model'],_0x465dfa[_0xb135('0x35')]);_0xb66fe5[_0xb135('0x39')]=_[_0xb135('0x37')](_0x465dfa[_0xb135('0x33')],qs[_0xb135('0x38')](_0x2943a2['query'][_0xb135('0x38')]));_0xb66fe5['attributes']=_0xb66fe5[_0xb135('0x39')][_0xb135('0x3a')]?_0xb66fe5[_0xb135('0x39')]:_0x465dfa[_0xb135('0x33')];if(!_0x2943a2[_0xb135('0x35')]['hasOwnProperty'](_0xb135('0x5d'))){_0xb66fe5[_0xb135('0x26')]=qs[_0xb135('0x26')](_0x2943a2[_0xb135('0x35')][_0xb135('0x26')]);_0xb66fe5['offset']=qs[_0xb135('0x25')](_0x2943a2[_0xb135('0x35')]['offset']);}_0xb66fe5[_0xb135('0x3c')]=qs[_0xb135('0x3d')](_0x2943a2[_0xb135('0x35')][_0xb135('0x3d')]);_0xb66fe5[_0xb135('0x3e')]=qs[_0xb135('0x36')](_[_0xb135('0x3f')](_0x2943a2[_0xb135('0x35')],_0x465dfa['filters']));_0xb66fe5[_0xb135('0x3e')][_0xb135('0x5e')]=_0x15f7e7['id'];if(_0x2943a2[_0xb135('0x35')]['filter']){_0xb66fe5[_0xb135('0x3e')]=_[_0xb135('0x41')](_0xb66fe5[_0xb135('0x3e')],{'$or':_[_0xb135('0x34')](_0xb66fe5[_0xb135('0x39')],function(_0x55045c){var _0x1f9f79={};_0x1f9f79[_0x55045c]={'$like':'%'+_0x2943a2[_0xb135('0x35')][_0xb135('0x40')]+'%'};return _0x1f9f79;})});}_0xb66fe5=_[_0xb135('0x41')]({},_0xb66fe5,_0x2943a2[_0xb135('0x43')]);return db[_0xb135('0x5c')][_0xb135('0x46')](_0xb66fe5);}})[_0xb135('0x2b')](function(_0x649abf){if(_0x649abf){return db[_0xb135('0x5f')][_0xb135('0x60')]({'where':{'id':_[_0xb135('0x34')](_0x649abf,_0xb135('0x61')),'role':_0xb135('0x62')},'attributes':['id','name',_0xb135('0x63'),_0xb135('0x64'),_0xb135('0x65')]});}})['then'](function(_0x2d4501){if(_0x2d4501){return{'count':_0x2d4501[_0xb135('0x24')],'rows':_[_0xb135('0x34')](_0x2d4501['rows'],function(_0x117f36){return{'membername':_0x117f36['name'],'UserId':_0x117f36['id'],'queue_name':_0x6685ee[_0xb135('0x2d')],'MailQueueId':_0x6685ee['id'],'interface':util[_0xb135('0x66')]('%s/%s',_0xb135('0x67'),_0x117f36[_0xb135('0x2d')]),'penalty':0x0,'paused':_0x117f36[_0xb135('0x63')],'createdAt':_0x117f36[_0xb135('0x65')],'updatedAt':_0x117f36['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb135('0x2b')](respondWithFilteredResult(_0x493840,_0xb66fe5))[_0xb135('0x48')](handleError(_0x493840,null));};exports[_0xb135('0x68')]=function(_0x583b53,_0x5a495d,_0x2d820b){var _0x349bde={};var _0x3bb94f={};var _0x373738;var _0x2ff001;return db[_0xb135('0x44')][_0xb135('0x69')]({'where':{'id':_0x583b53[_0xb135('0x4a')]['id']}})[_0xb135('0x2b')](handleEntityNotFound(_0x5a495d,null))[_0xb135('0x2b')](function(_0x412be0){if(_0x412be0){_0x373738=_0x412be0;_0x3bb94f[_0xb135('0x33')]=_[_0xb135('0x4b')](db[_0xb135('0x6a')][_0xb135('0x30')]);_0x3bb94f[_0xb135('0x35')]=_['keys'](_0x583b53[_0xb135('0x35')]);_0x3bb94f[_0xb135('0x36')]=_[_0xb135('0x37')](_0x3bb94f[_0xb135('0x33')],_0x3bb94f[_0xb135('0x35')]);_0x349bde[_0xb135('0x39')]=_[_0xb135('0x37')](_0x3bb94f[_0xb135('0x33')],qs['fields'](_0x583b53[_0xb135('0x35')][_0xb135('0x38')]));_0x349bde[_0xb135('0x39')]=_0x349bde['attributes'][_0xb135('0x3a')]?_0x349bde[_0xb135('0x39')]:_0x3bb94f['model'];_0x349bde[_0xb135('0x3c')]=qs['sort'](_0x583b53[_0xb135('0x35')][_0xb135('0x3d')]);_0x349bde['where']=qs[_0xb135('0x36')](_[_0xb135('0x3f')](_0x583b53[_0xb135('0x35')],_0x3bb94f['filters']));if(_0x583b53['query'][_0xb135('0x40')]){_0x349bde[_0xb135('0x3e')]=_[_0xb135('0x41')](_0x349bde[_0xb135('0x3e')],{'$or':_[_0xb135('0x34')](_0x349bde[_0xb135('0x39')],function(_0x5e1615){var _0x1e603f={};_0x1e603f[_0x5e1615]={'$like':'%'+_0x583b53[_0xb135('0x35')][_0xb135('0x40')]+'%'};return _0x1e603f;})});}_0x349bde=_[_0xb135('0x41')]({},_0x349bde,_0x583b53[_0xb135('0x43')]);return _0x373738[_0xb135('0x68')](_0x349bde);}})[_0xb135('0x2b')](function(_0x5bb325){if(_0x5bb325){_0x2ff001=_0x5bb325[_0xb135('0x3a')];if(!_0x583b53[_0xb135('0x35')][_0xb135('0x3b')](_0xb135('0x5d'))){_0x349bde[_0xb135('0x26')]=qs[_0xb135('0x26')](_0x583b53[_0xb135('0x35')][_0xb135('0x26')]);_0x349bde[_0xb135('0x25')]=qs[_0xb135('0x25')](_0x583b53[_0xb135('0x35')]['offset']);}return _0x373738[_0xb135('0x68')](_0x349bde);}})[_0xb135('0x2b')](function(_0x2348fb){if(_0x2348fb){return _0x2348fb?{'count':_0x2ff001,'rows':_0x2348fb}:null;}})['then'](respondWithResult(_0x5a495d,null))['catch'](handleError(_0x5a495d,null));};exports['addTeams']=function(_0x1e4bbc,_0x4cc2c9,_0x25fa8d){var _0x2bfa11=_0x1e4bbc[_0xb135('0x4f')]['ids'];return db['Team'][_0xb135('0x46')]({'where':{'id':_0x2bfa11},'attributes':['id'],'include':[{'model':db[_0xb135('0x5f')],'as':'Agents','attributes':['id',_0xb135('0x2d'),_0xb135('0x6b'),_0xb135('0x6c'),_0xb135('0x6d')],'raw':!![]}]})[_0xb135('0x2b')](function(_0x486737){if(_0x486737){var _0x11b5e5=_[_0xb135('0x6e')](_0x486737,function(_0x5b226c){var _0x47e351=_0x5b226c[_0xb135('0x51')]({'plain':!![]});return _0x47e351['Agents'];});return db[_0xb135('0x44')][_0xb135('0x4d')]({'where':{'id':_0x1e4bbc[_0xb135('0x4a')]['id']}})[_0xb135('0x2b')](function(_0x286fd2){return db[_0xb135('0x6f')]['transaction'](function(_0x3d5eb1){return _0x286fd2['addTeams'](_0x2bfa11,{'transaction':_0x3d5eb1})[_0xb135('0x2b')](function(){return BPromise[_0xb135('0x70')](_0x11b5e5,function(_0x3469ae){return db[_0xb135('0x5c')]['findOrCreate']({'where':{'UserId':_0x3469ae['id'],'MailQueueId':_0x1e4bbc[_0xb135('0x4a')]['id']},'transaction':_0x3d5eb1});});})[_0xb135('0x2b')](function(){_0x11b5e5[_0xb135('0x71')](function(_0x91c2f4){socket['emit']('userMailQueue:save',{'UserId':_0x91c2f4['id'],'MailQueueId':_0x286fd2['id']});});});});});}})[_0xb135('0x2b')](respondWithStatusCode(_0x4cc2c9,null))[_0xb135('0x48')](handleError(_0x4cc2c9,null));};exports[_0xb135('0x72')]=function(_0x1ed926,_0x4cbe5c,_0x5c8186){return db['Team'][_0xb135('0x46')]({'where':{'id':_0x1ed926[_0xb135('0x35')][_0xb135('0x73')]},'attributes':['id'],'include':[{'model':db[_0xb135('0x5f')],'as':_0xb135('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb135('0x2b')](handleEntityNotFound(_0x4cbe5c,null))['then'](function(_0x4da16e){var _0xc6284d=_[_0xb135('0x34')](_0x4da16e,'id');var _0x1a9cc2=[];var _0x1279d1=[];var _0x2206ea=squel['select']();_0x2206ea[_0xb135('0x75')]('tq.TeamId')[_0xb135('0x76')](_0xb135('0x77'),'tq')[_0xb135('0x78')](_0xb135('0x79'),'ut',_0xb135('0x7a'))[_0xb135('0x3e')](_0xb135('0x7b'),_0x1ed926[_0xb135('0x4a')]['id']);for(var _0x1ea4cd=0x0;_0x1ea4cd<_0x4da16e[_0xb135('0x3a')];_0x1ea4cd+=0x1){let _0x1186ad=_0x4da16e[_0x1ea4cd];for(var _0x27ff77=0x0;_0x27ff77<_0x1186ad[_0xb135('0x74')][_0xb135('0x3a')];_0x27ff77+=0x1){let _0x1835b8=_0x1186ad[_0xb135('0x74')][_0x27ff77];var _0xe3a2a8=_0x2206ea[_0xb135('0x7c')]();_0xe3a2a8['where'](_0xb135('0x7d'),_0x1835b8['id']);_0x1279d1[_0xb135('0x7e')](db[_0xb135('0x6f')][_0xb135('0x35')](_0xe3a2a8[_0xb135('0x7f')](),{'type':db[_0xb135('0x6f')]['QueryTypes'][_0xb135('0x80')]})[_0xb135('0x2b')](function(_0x536c40){if(_0x536c40['length']===0x1){return _0x1835b8['id'];}else{var _0x5319f0=_[_0xb135('0x81')](_[_0xb135('0x34')](_0x536c40,'TeamId'),function(_0x36444c){return _[_0xb135('0x82')](_0xc6284d,_0x36444c);});if(_0x5319f0){return _0x1835b8['id'];}}}));}}return BPromise[_0xb135('0x83')](_0x1279d1)[_0xb135('0x2b')](function(_0x2339b7){_0x1a9cc2=_(_0x1a9cc2)[_0xb135('0x84')](_0x2339b7)[_0xb135('0x85')]()[_0xb135('0x86')]();return db[_0xb135('0x44')][_0xb135('0x4d')]({'where':{'id':_0x1ed926[_0xb135('0x4a')]['id']}})[_0xb135('0x2b')](function(_0x1e9292){return db[_0xb135('0x6f')][_0xb135('0x87')](function(_0x1b8bce){return _0x1e9292[_0xb135('0x72')](_0x1ed926[_0xb135('0x35')][_0xb135('0x73')],{'transaction':_0x1b8bce})[_0xb135('0x2b')](function(){if(!_[_0xb135('0x88')](_0x1a9cc2)){return _0x1e9292[_0xb135('0x89')](_0x1a9cc2,{'transaction':_0x1b8bce});}})[_0xb135('0x2b')](function(){_0x1a9cc2[_0xb135('0x71')](function(_0xa42356){socket['emit'](_0xb135('0x8a'),{'UserId':_0xa42356,'MailQueueId':_0x1e9292['id']});});});});});});})[_0xb135('0x2b')](respondWithStatusCode(_0x4cbe5c,null))[_0xb135('0x48')](handleError(_0x4cbe5c,null));};exports[_0xb135('0x8b')]=function(_0x2a4ebc,_0x46ff36,_0x58d17f){return db['MailQueue']['find']({'where':{'id':_0x2a4ebc[_0xb135('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46ff36,null))[_0xb135('0x2b')](function(_0x39c2ce){if(_0x39c2ce){return _0x39c2ce[_0xb135('0x8b')](_0x2a4ebc[_0xb135('0x4f')][_0xb135('0x73')],_['omit'](_0x2a4ebc[_0xb135('0x4f')],[_0xb135('0x73'),'id'])||{})[_0xb135('0x8c')](function(_0x5d9f66){for(var _0x3c0aa4=0x0;_0x3c0aa4<_0x2a4ebc['body'][_0xb135('0x73')][_0xb135('0x3a')];_0x3c0aa4+=0x1){socket[_0xb135('0x8d')](_0xb135('0x8e'),{'UserId':_0x2a4ebc[_0xb135('0x4f')][_0xb135('0x73')][_0x3c0aa4],'MailQueueId':_0x2a4ebc[_0xb135('0x4a')]['id']});}return _0x5d9f66;});}})[_0xb135('0x2b')](respondWithResult(_0x46ff36,null))[_0xb135('0x48')](handleError(_0x46ff36,null));};exports[_0xb135('0x89')]=function(_0x1bf43c,_0x400438,_0x57c2d9){return db[_0xb135('0x44')][_0xb135('0x4d')]({'where':{'id':_0x1bf43c['params']['id']}})[_0xb135('0x2b')](handleEntityNotFound(_0x400438,null))['then'](function(_0x47464b){if(_0x47464b){return _0x47464b[_0xb135('0x89')](_0x1bf43c[_0xb135('0x35')][_0xb135('0x73')])[_0xb135('0x2b')](function(){if(_[_0xb135('0x8f')](_0x1bf43c[_0xb135('0x35')][_0xb135('0x73')])){for(var _0x3d550e=0x0;_0x3d550e<_0x1bf43c[_0xb135('0x35')]['ids']['length'];_0x3d550e+=0x1){socket[_0xb135('0x8d')](_0xb135('0x8a'),{'UserId':Number(_0x1bf43c['query']['ids'][_0x3d550e]),'MailQueueId':Number(_0x1bf43c['params']['id'])});}}else{socket['emit'](_0xb135('0x8a'),{'UserId':Number(_0x1bf43c['query'][_0xb135('0x73')]),'MailQueueId':Number(_0x1bf43c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x400438,null))[_0xb135('0x48')](handleError(_0x400438,null));};exports[_0xb135('0x90')]=function(_0x483122,_0x4cbf05,_0x4d8427){var _0x16777b={};var _0x442d29={};var _0x47c182;var _0x24543e;return db[_0xb135('0x44')][_0xb135('0x69')]({'where':{'id':_0x483122[_0xb135('0x4a')]['id']}})[_0xb135('0x2b')](handleEntityNotFound(_0x4cbf05,null))[_0xb135('0x2b')](function(_0x4a2617){if(_0x4a2617){_0x47c182=_0x4a2617;_0x442d29[_0xb135('0x33')]=_[_0xb135('0x4b')](db[_0xb135('0x5f')][_0xb135('0x30')]);_0x442d29[_0xb135('0x35')]=_['keys'](_0x483122[_0xb135('0x35')]);_0x442d29[_0xb135('0x36')]=_[_0xb135('0x37')](_0x442d29[_0xb135('0x33')],_0x442d29[_0xb135('0x35')]);_0x16777b['attributes']=_[_0xb135('0x37')](_0x442d29[_0xb135('0x33')],qs[_0xb135('0x38')](_0x483122[_0xb135('0x35')][_0xb135('0x38')]));_0x16777b[_0xb135('0x39')]=_0x16777b[_0xb135('0x39')][_0xb135('0x3a')]?_0x16777b[_0xb135('0x39')]:_0x442d29[_0xb135('0x33')];_0x16777b[_0xb135('0x3c')]=qs[_0xb135('0x3d')](_0x483122['query'][_0xb135('0x3d')]);_0x16777b[_0xb135('0x3e')]=qs[_0xb135('0x36')](_['pick'](_0x483122[_0xb135('0x35')],_0x442d29[_0xb135('0x36')]));if(_0x483122[_0xb135('0x35')]['filter']){_0x16777b['where']=_[_0xb135('0x41')](_0x16777b[_0xb135('0x3e')],{'$or':_[_0xb135('0x34')](_0x16777b[_0xb135('0x39')],function(_0x472aca){var _0x2ed2af={};_0x2ed2af[_0x472aca]={'$like':'%'+_0x483122[_0xb135('0x35')][_0xb135('0x40')]+'%'};return _0x2ed2af;})});}_0x16777b=_[_0xb135('0x41')]({},_0x16777b,_0x483122[_0xb135('0x43')]);return _0x47c182[_0xb135('0x90')](_0x16777b);}})[_0xb135('0x2b')](function(_0x4d1aaa){if(_0x4d1aaa){_0x24543e=_0x4d1aaa[_0xb135('0x3a')];if(!_0x483122[_0xb135('0x35')][_0xb135('0x3b')]('nolimit')){_0x16777b[_0xb135('0x26')]=qs[_0xb135('0x26')](_0x483122['query'][_0xb135('0x26')]);_0x16777b['offset']=qs[_0xb135('0x25')](_0x483122[_0xb135('0x35')]['offset']);}return _0x47c182[_0xb135('0x90')](_0x16777b);}})[_0xb135('0x2b')](function(_0x15ba01){if(_0x15ba01){return _0x15ba01?{'count':_0x24543e,'rows':_0x15ba01}:null;}})['then'](respondWithResult(_0x4cbf05,null))['catch'](handleError(_0x4cbf05,null));}; \ No newline at end of file +var _0xa596=['../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','send','map','MailQueue','rawAttributes','fieldName','type','model','name','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','intersection','MailQueueId','UserId','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','pick','addTeams','Team','User','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xd486bf,_0x54549b){var _0x30be17=function(_0x343cd9){while(--_0x343cd9){_0xd486bf['push'](_0xd486bf['shift']());}};_0x30be17(++_0x54549b);}(_0xa596,0x7b));var _0x6a59=function(_0x211002,_0x385a27){_0x211002=_0x211002-0x0;var _0x5a9485=_0xa596[_0x211002];return _0x5a9485;};'use strict';var pdf=require(_0x6a59('0x0'));var emlformat=require(_0x6a59('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a59('0x2'));var jsonpatch=require(_0x6a59('0x3'));var rp=require(_0x6a59('0x4'));var moment=require(_0x6a59('0x5'));var BPromise=require(_0x6a59('0x6'));var Mustache=require(_0x6a59('0x7'));var util=require(_0x6a59('0x8'));var path=require(_0x6a59('0x9'));var sox=require('sox');var csv=require(_0x6a59('0xa'));var ejs=require(_0x6a59('0xb'));var fs=require('fs');var _=require(_0x6a59('0xc'));var squel=require(_0x6a59('0xd'));var crypto=require(_0x6a59('0xe'));var jsforce=require(_0x6a59('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6a59('0xa'));var querystring=require('querystring');var Papa=require(_0x6a59('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6a59('0x11'));var as=require(_0x6a59('0x12'));var hardwareService=require(_0x6a59('0x13'));var logger=require('../../config/logger')(_0x6a59('0x14'));var utils=require(_0x6a59('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6a59('0x16'));var db=require('../../mysqldb')['db'];config[_0x6a59('0x17')]=_[_0x6a59('0x18')](config[_0x6a59('0x17')],{'host':_0x6a59('0x19'),'port':0x18eb});var socket=require(_0x6a59('0x1a'))(new Redis(config[_0x6a59('0x17')]));require(_0x6a59('0x1b'))[_0x6a59('0x1c')](socket);function respondWithStatusCode(_0x3f8e6a,_0x2c450f){_0x2c450f=_0x2c450f||0xcc;return function(_0x3bef82){if(_0x3bef82){return _0x3f8e6a['sendStatus'](_0x2c450f);}return _0x3f8e6a[_0x6a59('0x1d')](_0x2c450f)[_0x6a59('0x1e')]();};}function respondWithResult(_0x416613,_0x2cd31a){_0x2cd31a=_0x2cd31a||0xc8;return function(_0x258441){if(_0x258441){return _0x416613[_0x6a59('0x1d')](_0x2cd31a)['json'](_0x258441);}};}function respondWithFilteredResult(_0x344ed4,_0xab9a1){return function(_0x3cb568){if(_0x3cb568){var _0x45b286=_0x3cb568[_0x6a59('0x1f')],_0x209319=_0xab9a1[_0x6a59('0x20')],_0x2b15b0=_0xab9a1[_0x6a59('0x20')]+_0xab9a1[_0x6a59('0x21')],_0x4988e2;if(_0x2b15b0>=_0x45b286){_0x2b15b0=_0x45b286;_0x4988e2=0xc8;}else{_0x4988e2=0xce;}_0x344ed4[_0x6a59('0x1d')](_0x4988e2);return _0x344ed4[_0x6a59('0x22')](_0x6a59('0x23'),_0x209319+'-'+_0x2b15b0+'/'+_0x45b286)[_0x6a59('0x24')](_0x3cb568);}return null;};}function patchUpdates(_0x2ae2ce){return function(_0x3af7a7){try{jsonpatch['apply'](_0x3af7a7,_0x2ae2ce,!![]);}catch(_0x31689a){return BPromise[_0x6a59('0x25')](_0x31689a);}return _0x3af7a7[_0x6a59('0x26')]();};}function saveUpdates(_0x4764e7,_0x5d7e84){return function(_0x580267){if(_0x580267){return _0x580267[_0x6a59('0x27')](_0x4764e7)[_0x6a59('0x28')](function(_0x2b04a5){return _0x2b04a5;});}return null;};}function removeEntity(_0x3d3bdc,_0x56dab5){return function(_0x530de7){if(_0x530de7){return _0x530de7[_0x6a59('0x29')]()[_0x6a59('0x28')](function(){var _0x5e1275=_0x530de7[_0x6a59('0x2a')]({'plain':!![]});var _0x5ee827=_0x6a59('0x2b');return db[_0x6a59('0x2c')]['destroy']({'where':{'type':_0x5ee827,'resourceId':_0x5e1275['id']}})[_0x6a59('0x28')](function(){return _0x530de7;});})['then'](function(){_0x3d3bdc[_0x6a59('0x1d')](0xcc)[_0x6a59('0x1e')]();});}};}function handleEntityNotFound(_0x4a183e,_0x199317){return function(_0x54136b){if(!_0x54136b){_0x4a183e[_0x6a59('0x2d')](0x194);}return _0x54136b;};}function handleError(_0x1eb305,_0x205b4d){_0x205b4d=_0x205b4d||0x1f4;return function(_0x294e8a){logger[_0x6a59('0x2e')](_0x294e8a[_0x6a59('0x2f')]);if(_0x294e8a['name']){delete _0x294e8a['name'];}_0x1eb305[_0x6a59('0x1d')](_0x205b4d)[_0x6a59('0x30')](_0x294e8a);};}exports['index']=function(_0x1c7016,_0x4ced19){var _0x3f0a4f={},_0x20b44d={},_0x25a046={'count':0x0,'rows':[]};var _0x47e7fb=_[_0x6a59('0x31')](db[_0x6a59('0x32')][_0x6a59('0x33')],function(_0x4e1c6d){return{'name':_0x4e1c6d[_0x6a59('0x34')],'type':_0x4e1c6d[_0x6a59('0x35')]['key']};});_0x20b44d[_0x6a59('0x36')]=_['map'](_0x47e7fb,_0x6a59('0x37'));_0x20b44d[_0x6a59('0x38')]=_['keys'](_0x1c7016[_0x6a59('0x38')]);_0x20b44d[_0x6a59('0x39')]=_['intersection'](_0x20b44d['model'],_0x20b44d['query']);_0x3f0a4f['attributes']=_['intersection'](_0x20b44d[_0x6a59('0x36')],qs[_0x6a59('0x3a')](_0x1c7016[_0x6a59('0x38')]['fields']));_0x3f0a4f[_0x6a59('0x3b')]=_0x3f0a4f[_0x6a59('0x3b')]['length']?_0x3f0a4f['attributes']:_0x20b44d[_0x6a59('0x36')];if(!_0x1c7016['query'][_0x6a59('0x3c')](_0x6a59('0x3d'))){_0x3f0a4f[_0x6a59('0x21')]=qs[_0x6a59('0x21')](_0x1c7016[_0x6a59('0x38')][_0x6a59('0x21')]);_0x3f0a4f[_0x6a59('0x20')]=qs[_0x6a59('0x20')](_0x1c7016[_0x6a59('0x38')][_0x6a59('0x20')]);}_0x3f0a4f[_0x6a59('0x3e')]=qs[_0x6a59('0x3f')](_0x1c7016[_0x6a59('0x38')][_0x6a59('0x3f')]);_0x3f0a4f[_0x6a59('0x40')]=qs[_0x6a59('0x39')](_['pick'](_0x1c7016[_0x6a59('0x38')],_0x20b44d['filters']),_0x47e7fb);if(_0x1c7016[_0x6a59('0x38')][_0x6a59('0x41')]){_0x3f0a4f[_0x6a59('0x40')]=_[_0x6a59('0x42')](_0x3f0a4f[_0x6a59('0x40')],{'$or':_[_0x6a59('0x31')](_0x47e7fb,function(_0x2c5e8e){if(_0x2c5e8e[_0x6a59('0x35')]!==_0x6a59('0x43')){var _0x5a8625={};_0x5a8625[_0x2c5e8e[_0x6a59('0x37')]]={'$like':'%'+_0x1c7016[_0x6a59('0x38')][_0x6a59('0x41')]+'%'};return _0x5a8625;}})});}_0x3f0a4f=_['merge']({},_0x3f0a4f,_0x1c7016['options']);var _0x26b5d5={'where':_0x3f0a4f[_0x6a59('0x40')]};return db[_0x6a59('0x32')]['count'](_0x26b5d5)[_0x6a59('0x28')](function(_0x3480d0){_0x25a046[_0x6a59('0x1f')]=_0x3480d0;if(_0x1c7016['query']['includeAll']){_0x3f0a4f[_0x6a59('0x44')]=[{'all':!![]}];}return db[_0x6a59('0x32')][_0x6a59('0x45')](_0x3f0a4f);})[_0x6a59('0x28')](function(_0xfd5bd0){_0x25a046[_0x6a59('0x46')]=_0xfd5bd0;return _0x25a046;})['then'](respondWithFilteredResult(_0x4ced19,_0x3f0a4f))['catch'](handleError(_0x4ced19,null));};exports[_0x6a59('0x47')]=function(_0x4b345e,_0x18bc0b){var _0x1c3855={'raw':!![],'where':{'id':_0x4b345e[_0x6a59('0x48')]['id']}},_0x5af817={};_0x5af817[_0x6a59('0x36')]=_[_0x6a59('0x49')](db[_0x6a59('0x32')][_0x6a59('0x33')]);_0x5af817['query']=_[_0x6a59('0x49')](_0x4b345e['query']);_0x5af817['filters']=_['intersection'](_0x5af817[_0x6a59('0x36')],_0x5af817[_0x6a59('0x38')]);_0x1c3855[_0x6a59('0x3b')]=_['intersection'](_0x5af817[_0x6a59('0x36')],qs[_0x6a59('0x3a')](_0x4b345e[_0x6a59('0x38')]['fields']));_0x1c3855['attributes']=_0x1c3855['attributes'][_0x6a59('0x4a')]?_0x1c3855['attributes']:_0x5af817[_0x6a59('0x36')];if(_0x4b345e[_0x6a59('0x38')]['includeAll']){_0x1c3855['include']=[{'all':!![]}];}_0x1c3855=_['merge']({},_0x1c3855,_0x4b345e[_0x6a59('0x4b')]);return db[_0x6a59('0x32')][_0x6a59('0x4c')](_0x1c3855)[_0x6a59('0x28')](handleEntityNotFound(_0x18bc0b,null))[_0x6a59('0x28')](respondWithResult(_0x18bc0b,null))[_0x6a59('0x4d')](handleError(_0x18bc0b,null));};exports[_0x6a59('0x4e')]=function(_0x5778a6,_0x3c0dc7){return db[_0x6a59('0x32')][_0x6a59('0x4e')](_0x5778a6[_0x6a59('0x4f')],{})[_0x6a59('0x28')](function(_0x555783){var _0x3099e5=_0x5778a6[_0x6a59('0x50')][_0x6a59('0x2a')]({'plain':!![]});if(!_0x3099e5)throw new Error(_0x6a59('0x51'));if(_0x3099e5[_0x6a59('0x52')]===_0x6a59('0x50')){var _0x5023c2=_0x555783[_0x6a59('0x2a')]({'plain':!![]});var _0x49e279=_0x6a59('0x2b');return db[_0x6a59('0x53')][_0x6a59('0x4c')]({'where':{'name':_0x49e279,'userProfileId':_0x3099e5['userProfileId']},'raw':!![]})['then'](function(_0x5a4a3c){if(_0x5a4a3c&&_0x5a4a3c[_0x6a59('0x54')]===0x0){return db[_0x6a59('0x2c')]['create']({'name':_0x5023c2[_0x6a59('0x37')],'resourceId':_0x5023c2['id'],'type':_0x5a4a3c[_0x6a59('0x37')],'sectionId':_0x5a4a3c['id']},{})[_0x6a59('0x28')](function(){return _0x555783;});}else{return _0x555783;}})[_0x6a59('0x4d')](function(_0x4f155e){logger['error'](_0x6a59('0x55'),_0x4f155e);throw _0x4f155e;});}return _0x555783;})[_0x6a59('0x28')](respondWithResult(_0x3c0dc7,0xc9))[_0x6a59('0x4d')](handleError(_0x3c0dc7,null));};exports[_0x6a59('0x27')]=function(_0x3dd71f,_0x574c24){if(_0x3dd71f['body']['id']){delete _0x3dd71f[_0x6a59('0x4f')]['id'];}return db[_0x6a59('0x32')][_0x6a59('0x4c')]({'where':{'id':_0x3dd71f['params']['id']}})[_0x6a59('0x28')](handleEntityNotFound(_0x574c24,null))['then'](saveUpdates(_0x3dd71f[_0x6a59('0x4f')],null))[_0x6a59('0x28')](respondWithResult(_0x574c24,null))['catch'](handleError(_0x574c24,null));};exports[_0x6a59('0x29')]=function(_0x3e9ede,_0x737ebf){return db[_0x6a59('0x32')]['find']({'where':{'id':_0x3e9ede[_0x6a59('0x48')]['id']}})[_0x6a59('0x28')](handleEntityNotFound(_0x737ebf,null))[_0x6a59('0x28')](removeEntity(_0x737ebf,null))[_0x6a59('0x4d')](handleError(_0x737ebf,null));};exports[_0x6a59('0x56')]=function(_0x81a9e0,_0x5c7cb7){return db[_0x6a59('0x32')][_0x6a59('0x56')]()[_0x6a59('0x28')](respondWithResult(_0x5c7cb7,null))[_0x6a59('0x4d')](handleError(_0x5c7cb7,null));};exports['getMembers']=function(_0x354672,_0x46dd4a,_0x558431){var _0x19c5c0={'raw':!![],'where':{}},_0x56f144={},_0x984188;return db['MailQueue'][_0x6a59('0x57')]({'where':{'id':_0x354672[_0x6a59('0x48')]['id']}})[_0x6a59('0x28')](handleEntityNotFound(_0x46dd4a,null))[_0x6a59('0x28')](function(_0x1b8132){if(_0x1b8132){_0x984188=_0x1b8132[_0x6a59('0x2a')]({'plain':!![]});_0x56f144[_0x6a59('0x36')]=_[_0x6a59('0x49')](db[_0x6a59('0x58')][_0x6a59('0x33')]);_0x56f144[_0x6a59('0x38')]=_[_0x6a59('0x49')](_0x354672[_0x6a59('0x38')]);_0x56f144['filters']=_[_0x6a59('0x59')](_0x56f144['model'],_0x56f144['query']);_0x19c5c0[_0x6a59('0x3b')]=_[_0x6a59('0x59')](_0x56f144['model'],qs['fields'](_0x354672['query'][_0x6a59('0x3a')]));_0x19c5c0['attributes']=_0x19c5c0[_0x6a59('0x3b')][_0x6a59('0x4a')]?_0x19c5c0[_0x6a59('0x3b')]:_0x56f144[_0x6a59('0x36')];if(!_0x354672[_0x6a59('0x38')][_0x6a59('0x3c')]('nolimit')){_0x19c5c0[_0x6a59('0x21')]=qs[_0x6a59('0x21')](_0x354672[_0x6a59('0x38')][_0x6a59('0x21')]);_0x19c5c0[_0x6a59('0x20')]=qs['offset'](_0x354672[_0x6a59('0x38')][_0x6a59('0x20')]);}_0x19c5c0[_0x6a59('0x3e')]=qs[_0x6a59('0x3f')](_0x354672[_0x6a59('0x38')][_0x6a59('0x3f')]);_0x19c5c0['where']=qs[_0x6a59('0x39')](_['pick'](_0x354672['query'],_0x56f144[_0x6a59('0x39')]));_0x19c5c0[_0x6a59('0x40')][_0x6a59('0x5a')]=_0x1b8132['id'];if(_0x354672['query'][_0x6a59('0x41')]){_0x19c5c0[_0x6a59('0x40')]=_['merge'](_0x19c5c0[_0x6a59('0x40')],{'$or':_[_0x6a59('0x31')](_0x19c5c0['attributes'],function(_0x4348bd){var _0xa146c5={};_0xa146c5[_0x4348bd]={'$like':'%'+_0x354672['query'][_0x6a59('0x41')]+'%'};return _0xa146c5;})});}_0x19c5c0=_['merge']({},_0x19c5c0,_0x354672[_0x6a59('0x4b')]);return db[_0x6a59('0x58')][_0x6a59('0x45')](_0x19c5c0);}})[_0x6a59('0x28')](function(_0x109bdf){if(_0x109bdf){return db['User']['findAndCountAll']({'where':{'id':_[_0x6a59('0x31')](_0x109bdf,_0x6a59('0x5b')),'role':'agent'},'attributes':['id','name',_0x6a59('0x5c'),'updatedAt','createdAt']});}})['then'](function(_0x25febc){if(_0x25febc){return{'count':_0x25febc[_0x6a59('0x1f')],'rows':_['map'](_0x25febc[_0x6a59('0x46')],function(_0x395f35){return{'membername':_0x395f35[_0x6a59('0x37')],'UserId':_0x395f35['id'],'queue_name':_0x984188['name'],'MailQueueId':_0x984188['id'],'interface':util[_0x6a59('0x5d')](_0x6a59('0x5e'),_0x6a59('0x5f'),_0x395f35[_0x6a59('0x37')]),'penalty':0x0,'paused':_0x395f35[_0x6a59('0x5c')],'createdAt':_0x395f35[_0x6a59('0x60')],'updatedAt':_0x395f35[_0x6a59('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x46dd4a,_0x19c5c0))[_0x6a59('0x4d')](handleError(_0x46dd4a,null));};exports[_0x6a59('0x62')]=function(_0x476ad1,_0x147056,_0x183dd1){var _0x66d456={};var _0x24380c={};var _0x4c236d;var _0x52bd1e;return db[_0x6a59('0x32')][_0x6a59('0x57')]({'where':{'id':_0x476ad1[_0x6a59('0x48')]['id']}})[_0x6a59('0x28')](handleEntityNotFound(_0x147056,null))[_0x6a59('0x28')](function(_0x3a3dc6){if(_0x3a3dc6){_0x4c236d=_0x3a3dc6;_0x24380c['model']=_[_0x6a59('0x49')](db['Team'][_0x6a59('0x33')]);_0x24380c[_0x6a59('0x38')]=_[_0x6a59('0x49')](_0x476ad1[_0x6a59('0x38')]);_0x24380c[_0x6a59('0x39')]=_[_0x6a59('0x59')](_0x24380c[_0x6a59('0x36')],_0x24380c['query']);_0x66d456[_0x6a59('0x3b')]=_[_0x6a59('0x59')](_0x24380c[_0x6a59('0x36')],qs[_0x6a59('0x3a')](_0x476ad1[_0x6a59('0x38')]['fields']));_0x66d456[_0x6a59('0x3b')]=_0x66d456[_0x6a59('0x3b')][_0x6a59('0x4a')]?_0x66d456[_0x6a59('0x3b')]:_0x24380c[_0x6a59('0x36')];_0x66d456[_0x6a59('0x3e')]=qs[_0x6a59('0x3f')](_0x476ad1[_0x6a59('0x38')]['sort']);_0x66d456[_0x6a59('0x40')]=qs[_0x6a59('0x39')](_[_0x6a59('0x63')](_0x476ad1[_0x6a59('0x38')],_0x24380c['filters']));if(_0x476ad1[_0x6a59('0x38')]['filter']){_0x66d456['where']=_['merge'](_0x66d456['where'],{'$or':_[_0x6a59('0x31')](_0x66d456['attributes'],function(_0x424023){var _0x1cbbc={};_0x1cbbc[_0x424023]={'$like':'%'+_0x476ad1[_0x6a59('0x38')][_0x6a59('0x41')]+'%'};return _0x1cbbc;})});}_0x66d456=_[_0x6a59('0x42')]({},_0x66d456,_0x476ad1[_0x6a59('0x4b')]);return _0x4c236d[_0x6a59('0x62')](_0x66d456);}})[_0x6a59('0x28')](function(_0x35a65e){if(_0x35a65e){_0x52bd1e=_0x35a65e[_0x6a59('0x4a')];if(!_0x476ad1['query']['hasOwnProperty']('nolimit')){_0x66d456['limit']=qs[_0x6a59('0x21')](_0x476ad1['query'][_0x6a59('0x21')]);_0x66d456['offset']=qs['offset'](_0x476ad1[_0x6a59('0x38')][_0x6a59('0x20')]);}return _0x4c236d[_0x6a59('0x62')](_0x66d456);}})[_0x6a59('0x28')](function(_0x388d1c){if(_0x388d1c){return _0x388d1c?{'count':_0x52bd1e,'rows':_0x388d1c}:null;}})[_0x6a59('0x28')](respondWithResult(_0x147056,null))['catch'](handleError(_0x147056,null));};exports[_0x6a59('0x64')]=function(_0x4012c6,_0x464e20,_0x330fb6){var _0x3377a5=_0x4012c6['body']['ids'];return db[_0x6a59('0x65')][_0x6a59('0x45')]({'where':{'id':_0x3377a5},'attributes':['id'],'include':[{'model':db[_0x6a59('0x66')],'as':'Agents','attributes':['id','name',_0x6a59('0x67'),_0x6a59('0x68'),_0x6a59('0x69')],'raw':!![]}]})[_0x6a59('0x28')](function(_0x2c748e){if(_0x2c748e){var _0x102ec3=_[_0x6a59('0x6a')](_0x2c748e,function(_0x131891){var _0x2947aa=_0x131891['get']({'plain':!![]});return _0x2947aa[_0x6a59('0x6b')];});return db[_0x6a59('0x32')][_0x6a59('0x4c')]({'where':{'id':_0x4012c6[_0x6a59('0x48')]['id']}})['then'](function(_0x475983){return db['sequelize'][_0x6a59('0x6c')](function(_0x4dc087){return _0x475983['addTeams'](_0x3377a5,{'transaction':_0x4dc087})[_0x6a59('0x28')](function(){return BPromise[_0x6a59('0x6d')](_0x102ec3,function(_0x956a1a){return db[_0x6a59('0x58')][_0x6a59('0x6e')]({'where':{'UserId':_0x956a1a['id'],'MailQueueId':_0x4012c6[_0x6a59('0x48')]['id']},'transaction':_0x4dc087});});})[_0x6a59('0x28')](function(){_0x102ec3[_0x6a59('0x6f')](function(_0x5a04a6){socket[_0x6a59('0x70')](_0x6a59('0x71'),{'UserId':_0x5a04a6['id'],'MailQueueId':_0x475983['id']});});});});});}})[_0x6a59('0x28')](respondWithStatusCode(_0x464e20,null))[_0x6a59('0x4d')](handleError(_0x464e20,null));};exports[_0x6a59('0x72')]=function(_0x10c270,_0x10e983,_0x47f031){return db[_0x6a59('0x65')][_0x6a59('0x45')]({'where':{'id':_0x10c270[_0x6a59('0x38')][_0x6a59('0x73')]},'attributes':['id'],'include':[{'model':db[_0x6a59('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6a59('0x28')](handleEntityNotFound(_0x10e983,null))[_0x6a59('0x28')](function(_0x3d438c){var _0x847b9b=_[_0x6a59('0x31')](_0x3d438c,'id');var _0x1392c9=[];var _0x2353c9=[];var _0x1a2ac6=squel[_0x6a59('0x74')]();_0x1a2ac6['field'](_0x6a59('0x75'))[_0x6a59('0x76')](_0x6a59('0x77'),'tq')[_0x6a59('0x78')](_0x6a59('0x79'),'ut',_0x6a59('0x7a'))[_0x6a59('0x40')]('MailQueueId\x20=\x20?',_0x10c270[_0x6a59('0x48')]['id']);for(var _0x22831a=0x0;_0x22831a<_0x3d438c[_0x6a59('0x4a')];_0x22831a+=0x1){let _0x510ea5=_0x3d438c[_0x22831a];for(var _0x599b71=0x0;_0x599b71<_0x510ea5['Agents'][_0x6a59('0x4a')];_0x599b71+=0x1){let _0xa6f96a=_0x510ea5[_0x6a59('0x6b')][_0x599b71];var _0x528178=_0x1a2ac6[_0x6a59('0x7b')]();_0x528178['where'](_0x6a59('0x7c'),_0xa6f96a['id']);_0x2353c9[_0x6a59('0x7d')](db['sequelize'][_0x6a59('0x38')](_0x528178[_0x6a59('0x7e')](),{'type':db[_0x6a59('0x7f')][_0x6a59('0x80')][_0x6a59('0x81')]})[_0x6a59('0x28')](function(_0x3b1a03){if(_0x3b1a03[_0x6a59('0x4a')]===0x1){return _0xa6f96a['id'];}else{var _0x458724=_[_0x6a59('0x82')](_[_0x6a59('0x31')](_0x3b1a03,'TeamId'),function(_0x1d7ac1){return _[_0x6a59('0x83')](_0x847b9b,_0x1d7ac1);});if(_0x458724){return _0xa6f96a['id'];}}}));}}return BPromise['all'](_0x2353c9)['then'](function(_0x333170){_0x1392c9=_(_0x1392c9)['union'](_0x333170)[_0x6a59('0x84')]()[_0x6a59('0x85')]();return db[_0x6a59('0x32')]['find']({'where':{'id':_0x10c270[_0x6a59('0x48')]['id']}})[_0x6a59('0x28')](function(_0x2a8fed){return db[_0x6a59('0x7f')][_0x6a59('0x6c')](function(_0x4de037){return _0x2a8fed[_0x6a59('0x72')](_0x10c270[_0x6a59('0x38')][_0x6a59('0x73')],{'transaction':_0x4de037})[_0x6a59('0x28')](function(){if(!_[_0x6a59('0x86')](_0x1392c9)){return _0x2a8fed['removeAgents'](_0x1392c9,{'transaction':_0x4de037});}})['then'](function(){_0x1392c9[_0x6a59('0x6f')](function(_0x483858){socket[_0x6a59('0x70')](_0x6a59('0x87'),{'UserId':_0x483858,'MailQueueId':_0x2a8fed['id']});});});});});});})[_0x6a59('0x28')](respondWithStatusCode(_0x10e983,null))[_0x6a59('0x4d')](handleError(_0x10e983,null));};exports['addAgents']=function(_0x494280,_0x4bd740,_0x190241){return db[_0x6a59('0x32')]['find']({'where':{'id':_0x494280[_0x6a59('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bd740,null))[_0x6a59('0x28')](function(_0xac4f3e){if(_0xac4f3e){return _0xac4f3e[_0x6a59('0x88')](_0x494280[_0x6a59('0x4f')][_0x6a59('0x73')],_[_0x6a59('0x89')](_0x494280[_0x6a59('0x4f')],[_0x6a59('0x73'),'id'])||{})[_0x6a59('0x8a')](function(_0x202c9e){for(var _0x90092d=0x0;_0x90092d<_0x494280['body'][_0x6a59('0x73')]['length'];_0x90092d+=0x1){socket[_0x6a59('0x70')]('userMailQueue:save',{'UserId':_0x494280[_0x6a59('0x4f')][_0x6a59('0x73')][_0x90092d],'MailQueueId':_0x494280[_0x6a59('0x48')]['id']});}return _0x202c9e;});}})[_0x6a59('0x28')](respondWithResult(_0x4bd740,null))[_0x6a59('0x4d')](handleError(_0x4bd740,null));};exports[_0x6a59('0x8b')]=function(_0x3d099a,_0x4986b9,_0x5c2159){return db[_0x6a59('0x32')][_0x6a59('0x4c')]({'where':{'id':_0x3d099a[_0x6a59('0x48')]['id']}})['then'](handleEntityNotFound(_0x4986b9,null))['then'](function(_0x5112d4){if(_0x5112d4){return _0x5112d4[_0x6a59('0x8b')](_0x3d099a[_0x6a59('0x38')][_0x6a59('0x73')])[_0x6a59('0x28')](function(){if(_[_0x6a59('0x8c')](_0x3d099a[_0x6a59('0x38')][_0x6a59('0x73')])){for(var _0x319dff=0x0;_0x319dff<_0x3d099a['query'][_0x6a59('0x73')][_0x6a59('0x4a')];_0x319dff+=0x1){socket[_0x6a59('0x70')](_0x6a59('0x87'),{'UserId':Number(_0x3d099a[_0x6a59('0x38')]['ids'][_0x319dff]),'MailQueueId':Number(_0x3d099a[_0x6a59('0x48')]['id'])});}}else{socket[_0x6a59('0x70')](_0x6a59('0x87'),{'UserId':Number(_0x3d099a[_0x6a59('0x38')][_0x6a59('0x73')]),'MailQueueId':Number(_0x3d099a[_0x6a59('0x48')]['id'])});}});}})[_0x6a59('0x28')](respondWithStatusCode(_0x4986b9,null))[_0x6a59('0x4d')](handleError(_0x4986b9,null));};exports[_0x6a59('0x8d')]=function(_0x539380,_0xadff7b,_0xe769e6){var _0x5585b0={};var _0x5e096f={};var _0x32fedd;var _0x3ff478;return db['MailQueue'][_0x6a59('0x57')]({'where':{'id':_0x539380[_0x6a59('0x48')]['id']}})['then'](handleEntityNotFound(_0xadff7b,null))['then'](function(_0x4039b0){if(_0x4039b0){_0x32fedd=_0x4039b0;_0x5e096f['model']=_[_0x6a59('0x49')](db[_0x6a59('0x66')][_0x6a59('0x33')]);_0x5e096f['query']=_[_0x6a59('0x49')](_0x539380[_0x6a59('0x38')]);_0x5e096f['filters']=_[_0x6a59('0x59')](_0x5e096f[_0x6a59('0x36')],_0x5e096f[_0x6a59('0x38')]);_0x5585b0[_0x6a59('0x3b')]=_[_0x6a59('0x59')](_0x5e096f[_0x6a59('0x36')],qs['fields'](_0x539380['query'][_0x6a59('0x3a')]));_0x5585b0[_0x6a59('0x3b')]=_0x5585b0['attributes'][_0x6a59('0x4a')]?_0x5585b0[_0x6a59('0x3b')]:_0x5e096f[_0x6a59('0x36')];_0x5585b0[_0x6a59('0x3e')]=qs[_0x6a59('0x3f')](_0x539380[_0x6a59('0x38')][_0x6a59('0x3f')]);_0x5585b0[_0x6a59('0x40')]=qs['filters'](_[_0x6a59('0x63')](_0x539380[_0x6a59('0x38')],_0x5e096f[_0x6a59('0x39')]));if(_0x539380['query'][_0x6a59('0x41')]){_0x5585b0[_0x6a59('0x40')]=_['merge'](_0x5585b0[_0x6a59('0x40')],{'$or':_[_0x6a59('0x31')](_0x5585b0[_0x6a59('0x3b')],function(_0x59d107){var _0x50cea3={};_0x50cea3[_0x59d107]={'$like':'%'+_0x539380[_0x6a59('0x38')][_0x6a59('0x41')]+'%'};return _0x50cea3;})});}_0x5585b0=_['merge']({},_0x5585b0,_0x539380[_0x6a59('0x4b')]);return _0x32fedd[_0x6a59('0x8d')](_0x5585b0);}})['then'](function(_0x31f3d7){if(_0x31f3d7){_0x3ff478=_0x31f3d7[_0x6a59('0x4a')];if(!_0x539380[_0x6a59('0x38')][_0x6a59('0x3c')](_0x6a59('0x3d'))){_0x5585b0[_0x6a59('0x21')]=qs[_0x6a59('0x21')](_0x539380[_0x6a59('0x38')]['limit']);_0x5585b0[_0x6a59('0x20')]=qs['offset'](_0x539380[_0x6a59('0x38')]['offset']);}return _0x32fedd['getAgents'](_0x5585b0);}})['then'](function(_0x2209cf){if(_0x2209cf){return _0x2209cf?{'count':_0x3ff478,'rows':_0x2209cf}:null;}})[_0x6a59('0x28')](respondWithResult(_0xadff7b,null))['catch'](handleError(_0xadff7b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index cec88e7..a525cfa 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 _0x06eb=['hook','events','MailQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x558eb1,_0x502908){var _0x2f0b9e=function(_0x1e01f1){while(--_0x1e01f1){_0x558eb1['push'](_0x558eb1['shift']());}};_0x2f0b9e(++_0x502908);}(_0x06eb,0x101));var _0xb06e=function(_0x142568,_0x26c5e8){_0x142568=_0x142568-0x0;var _0x342129=_0x06eb[_0x142568];return _0x342129;};'use strict';var EventEmitter=require(_0xb06e('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xb06e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb06e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb06e('0x3'),'afterDestroy':_0xb06e('0x4')};function emitEvent(_0x9da98b){return function(_0x4803f2,_0x3d98cb,_0x70560f){MailQueueEvents['emit'](_0x9da98b+':'+_0x4803f2['id'],_0x4803f2);MailQueueEvents[_0xb06e('0x5')](_0x9da98b,_0x4803f2);_0x70560f(null);};}for(var e in events){if(events[_0xb06e('0x6')](e)){var event=events[e];MailQueue[_0xb06e('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x4ca4=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x11c9d4,_0x3d4daa){var _0x44e9a6=function(_0x532b90){while(--_0x532b90){_0x11c9d4['push'](_0x11c9d4['shift']());}};_0x44e9a6(++_0x3d4daa);}(_0x4ca4,0x17c));var _0x44ca=function(_0x5ace90,_0x2fc112){_0x5ace90=_0x5ace90-0x0;var _0x64e38c=_0x4ca4[_0x5ace90];return _0x64e38c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x44ca('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x44ca('0x1')](0x0);var events={'afterCreate':_0x44ca('0x2'),'afterUpdate':_0x44ca('0x3'),'afterDestroy':_0x44ca('0x4')};function emitEvent(_0x431217){return function(_0x435ffd,_0x473da7,_0x1e64c5){MailQueueEvents[_0x44ca('0x5')](_0x431217+':'+_0x435ffd['id'],_0x435ffd);MailQueueEvents['emit'](_0x431217,_0x435ffd);_0x1e64c5(null);};}for(var e in events){if(events[_0x44ca('0x6')](e)){var event=events[e];MailQueue[_0x44ca('0x7')](e,emitEvent(event));}}module[_0x44ca('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 18a9ae1..7d48f6c 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 _0x4788=['bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','lodash','api','moment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4788,0x1aa));var _0x8478=function(_0x67b1e1,_0x15079f){_0x67b1e1=_0x67b1e1-0x0;var _0x3825eb=_0x4788[_0x67b1e1];return _0x3825eb;};'use strict';var _=require(_0x8478('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8478('0x1'));var moment=require(_0x8478('0x2'));var BPromise=require(_0x8478('0x3'));var rp=require(_0x8478('0x4'));var fs=require('fs');var path=require(_0x8478('0x5'));var rimraf=require('rimraf');var config=require(_0x8478('0x6'));var attributes=require(_0x8478('0x7'));module[_0x8478('0x8')]=function(_0x5266e2,_0x18637d){return _0x5266e2[_0x8478('0x9')](_0x8478('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c6a=['define','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xc24df3,_0x4946ba){var _0x3041f4=function(_0x2b0c35){while(--_0x2b0c35){_0xc24df3['push'](_0xc24df3['shift']());}};_0x3041f4(++_0x4946ba);}(_0x1c6a,0x6f));var _0xa1c6=function(_0x5ef296,_0x27c9d7){_0x5ef296=_0x5ef296-0x0;var _0x1bf8c0=_0x1c6a[_0x5ef296];return _0x1bf8c0;};'use strict';var _=require(_0xa1c6('0x0'));var util=require(_0xa1c6('0x1'));var logger=require(_0xa1c6('0x2'))(_0xa1c6('0x3'));var moment=require('moment');var BPromise=require(_0xa1c6('0x4'));var rp=require(_0xa1c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c6('0x6'));var config=require(_0xa1c6('0x7'));var attributes=require('./mailQueue.attributes');module[_0xa1c6('0x8')]=function(_0x175abe,_0x323f09){return _0x175abe[_0xa1c6('0x9')](_0xa1c6('0xa'),attributes,{'tableName':_0xa1c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 75e44a2..b929fc2 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 _0xcf0e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetMailQueue','MailQueue','find','ShowMailQueue','util','moment','bluebird'];(function(_0x5ba23e,_0x4c651d){var _0x362586=function(_0x4a8a83){while(--_0x4a8a83){_0x5ba23e['push'](_0x5ba23e['shift']());}};_0x362586(++_0x4c651d);}(_0xcf0e,0x1b5));var _0xecf0=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xcf0e[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0xecf0('0x0'));var moment=require(_0xecf0('0x1'));var BPromise=require(_0xecf0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecf0('0x3'));var db=require(_0xecf0('0x4'))['db'];var utils=require(_0xecf0('0x5'));var logger=require(_0xecf0('0x6'))(_0xecf0('0x7'));var config=require(_0xecf0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecf0('0x9')]({'port':0x232a});config[_0xecf0('0xa')]=_[_0xecf0('0xb')](config[_0xecf0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xecf0('0xc'))(new Redis(config['redis']));require(_0xecf0('0xd'))[_0xecf0('0xe')](socket);function respondWithRpcPromise(_0x317018,_0x23b8f5,_0x20d51c){return new BPromise(function(_0x1be3ca,_0x552354){return client[_0xecf0('0xf')](_0x317018,_0x20d51c)[_0xecf0('0x10')](function(_0x4acf51){logger[_0xecf0('0x11')]('MailQueue,\x20%s,\x20%s',_0x23b8f5,'request\x20sent');logger[_0xecf0('0x12')](_0xecf0('0x13'),_0x23b8f5,_0xecf0('0x14'),JSON[_0xecf0('0x15')](_0x4acf51));if(_0x4acf51[_0xecf0('0x16')]){if(_0x4acf51[_0xecf0('0x16')][_0xecf0('0x17')]===0x1f4){logger[_0xecf0('0x16')](_0xecf0('0x18'),_0x23b8f5,_0x4acf51[_0xecf0('0x16')][_0xecf0('0x19')]);return _0x552354(_0x4acf51[_0xecf0('0x16')]['message']);}logger['error'](_0xecf0('0x18'),_0x23b8f5,_0x4acf51['error']['message']);return _0x1be3ca(_0x4acf51[_0xecf0('0x16')][_0xecf0('0x19')]);}else{logger[_0xecf0('0x11')](_0xecf0('0x18'),_0x23b8f5,_0xecf0('0x14'));_0x1be3ca(_0x4acf51[_0xecf0('0x1a')][_0xecf0('0x19')]);}})[_0xecf0('0x1b')](function(_0x279d46){logger[_0xecf0('0x16')](_0xecf0('0x18'),_0x23b8f5,_0x279d46);_0x552354(_0x279d46);});});}exports['GetMailQueue']=function(_0x4ae1f9){var _0x1311c6=this;return new Promise(function(_0x922b00,_0x99047f){return db['MailQueue']['findAll']({'raw':_0x4ae1f9[_0xecf0('0x1c')]?_0x4ae1f9[_0xecf0('0x1c')][_0xecf0('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ae1f9[_0xecf0('0x1c')]?_0x4ae1f9['options'][_0xecf0('0x1e')]||null:null,'attributes':_0x4ae1f9[_0xecf0('0x1c')]?_0x4ae1f9[_0xecf0('0x1c')][_0xecf0('0x1f')]||null:null,'limit':_0x4ae1f9[_0xecf0('0x1c')]?_0x4ae1f9[_0xecf0('0x1c')][_0xecf0('0x20')]||null:null,'include':_0x4ae1f9['options']?_0x4ae1f9[_0xecf0('0x1c')][_0xecf0('0x21')]?_[_0xecf0('0x22')](_0x4ae1f9[_0xecf0('0x1c')]['include'],function(_0x172949){return{'model':db[_0x172949[_0xecf0('0x23')]],'as':_0x172949['as'],'attributes':_0x172949[_0xecf0('0x1f')],'include':_0x172949['include']?_[_0xecf0('0x22')](_0x172949[_0xecf0('0x21')],function(_0x430e0b){return{'model':db[_0x430e0b[_0xecf0('0x23')]],'as':_0x430e0b['as'],'attributes':_0x430e0b[_0xecf0('0x1f')],'include':_0x430e0b[_0xecf0('0x21')]?_['map'](_0x430e0b[_0xecf0('0x21')],function(_0x3afd1e){return{'model':db[_0x3afd1e[_0xecf0('0x23')]],'as':_0x3afd1e['as'],'attributes':_0x3afd1e[_0xecf0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xecf0('0x10')](function(_0x362627){logger[_0xecf0('0x11')](_0xecf0('0x24'),_0x4ae1f9);logger[_0xecf0('0x12')](_0xecf0('0x24'),_0x4ae1f9,JSON['stringify'](_0x362627));_0x922b00(_0x362627);})['catch'](function(_0x525c7b){logger['error']('GetMailQueue',_0x525c7b[_0xecf0('0x19')],_0x4ae1f9);_0x99047f(_0x1311c6['error'](0x1f4,_0x525c7b[_0xecf0('0x19')]));});});};exports['ShowMailQueue']=function(_0x1a3f4e){var _0x18dec3=this;return new Promise(function(_0x3948e7,_0x2665e9){return db[_0xecf0('0x25')][_0xecf0('0x26')]({'raw':_0x1a3f4e['options']?_0x1a3f4e[_0xecf0('0x1c')][_0xecf0('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a3f4e[_0xecf0('0x1c')]?_0x1a3f4e['options'][_0xecf0('0x1e')]||null:null,'attributes':_0x1a3f4e['options']?_0x1a3f4e[_0xecf0('0x1c')][_0xecf0('0x1f')]||null:null,'include':_0x1a3f4e[_0xecf0('0x1c')]?_0x1a3f4e[_0xecf0('0x1c')][_0xecf0('0x21')]?_[_0xecf0('0x22')](_0x1a3f4e[_0xecf0('0x1c')][_0xecf0('0x21')],function(_0x5735de){return{'model':db[_0x5735de[_0xecf0('0x23')]],'as':_0x5735de['as'],'attributes':_0x5735de[_0xecf0('0x1f')],'include':_0x5735de['include']?_[_0xecf0('0x22')](_0x5735de['include'],function(_0x2fc194){return{'model':db[_0x2fc194[_0xecf0('0x23')]],'as':_0x2fc194['as'],'attributes':_0x2fc194[_0xecf0('0x1f')],'include':_0x2fc194['include']?_[_0xecf0('0x22')](_0x2fc194[_0xecf0('0x21')],function(_0x28c22a){return{'model':db[_0x28c22a[_0xecf0('0x23')]],'as':_0x28c22a['as'],'attributes':_0x28c22a[_0xecf0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x379b39){logger[_0xecf0('0x11')](_0xecf0('0x27'),_0x1a3f4e);logger[_0xecf0('0x12')](_0xecf0('0x27'),_0x1a3f4e,JSON[_0xecf0('0x15')](_0x379b39));_0x3948e7(_0x379b39);})[_0xecf0('0x1b')](function(_0x586bee){logger[_0xecf0('0x16')]('ShowMailQueue',_0x586bee[_0xecf0('0x19')],_0x1a3f4e);_0x2665e9(_0x18dec3[_0xecf0('0x16')](0x1f4,_0x586bee[_0xecf0('0x19')]));});});}; \ No newline at end of file +var _0xf705=['defaults','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue','find','ShowMailQueue','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xf705,0x168));var _0x5f70=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf705[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x5f70('0x0'));var util=require('util');var moment=require(_0x5f70('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f70('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f70('0x3'));var logger=require(_0x5f70('0x4'))(_0x5f70('0x5'));var config=require('../../config/environment');var jayson=require(_0x5f70('0x6'));var client=jayson[_0x5f70('0x7')][_0x5f70('0x8')]({'port':0x232a});config[_0x5f70('0x9')]=_[_0x5f70('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f70('0xb'))(new Redis(config['redis']));require(_0x5f70('0xc'))['register'](socket);function respondWithRpcPromise(_0x1cd78b,_0x3404c9,_0x1f8e7e){return new BPromise(function(_0x621a98,_0x504a41){return client[_0x5f70('0xd')](_0x1cd78b,_0x1f8e7e)[_0x5f70('0xe')](function(_0x3dcf2e){logger[_0x5f70('0xf')](_0x5f70('0x10'),_0x3404c9,'request\x20sent');logger[_0x5f70('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x3404c9,'request\x20sent',JSON[_0x5f70('0x12')](_0x3dcf2e));if(_0x3dcf2e[_0x5f70('0x13')]){if(_0x3dcf2e[_0x5f70('0x13')]['code']===0x1f4){logger[_0x5f70('0x13')](_0x5f70('0x10'),_0x3404c9,_0x3dcf2e['error'][_0x5f70('0x14')]);return _0x504a41(_0x3dcf2e[_0x5f70('0x13')][_0x5f70('0x14')]);}logger[_0x5f70('0x13')]('MailQueue,\x20%s,\x20%s',_0x3404c9,_0x3dcf2e[_0x5f70('0x13')][_0x5f70('0x14')]);return _0x621a98(_0x3dcf2e['error']['message']);}else{logger[_0x5f70('0xf')]('MailQueue,\x20%s,\x20%s',_0x3404c9,_0x5f70('0x15'));_0x621a98(_0x3dcf2e[_0x5f70('0x16')][_0x5f70('0x14')]);}})['catch'](function(_0x52b751){logger['error'](_0x5f70('0x10'),_0x3404c9,_0x52b751);_0x504a41(_0x52b751);});});}exports['GetMailQueue']=function(_0x98e095){var _0x168b9f=this;return new Promise(function(_0x38835a,_0x215ce3){return db[_0x5f70('0x17')][_0x5f70('0x18')]({'raw':_0x98e095[_0x5f70('0x19')]?_0x98e095['options'][_0x5f70('0x1a')]===undefined?!![]:![]:!![],'where':_0x98e095['options']?_0x98e095[_0x5f70('0x19')][_0x5f70('0x1b')]||null:null,'attributes':_0x98e095[_0x5f70('0x19')]?_0x98e095[_0x5f70('0x19')][_0x5f70('0x1c')]||null:null,'limit':_0x98e095[_0x5f70('0x19')]?_0x98e095[_0x5f70('0x19')][_0x5f70('0x1d')]||null:null,'include':_0x98e095[_0x5f70('0x19')]?_0x98e095[_0x5f70('0x19')]['include']?_[_0x5f70('0x1e')](_0x98e095[_0x5f70('0x19')][_0x5f70('0x1f')],function(_0x527929){return{'model':db[_0x527929[_0x5f70('0x20')]],'as':_0x527929['as'],'attributes':_0x527929[_0x5f70('0x1c')],'include':_0x527929[_0x5f70('0x1f')]?_[_0x5f70('0x1e')](_0x527929[_0x5f70('0x1f')],function(_0x17850d){return{'model':db[_0x17850d[_0x5f70('0x20')]],'as':_0x17850d['as'],'attributes':_0x17850d[_0x5f70('0x1c')],'include':_0x17850d[_0x5f70('0x1f')]?_[_0x5f70('0x1e')](_0x17850d['include'],function(_0x5cd90a){return{'model':db[_0x5cd90a[_0x5f70('0x20')]],'as':_0x5cd90a['as'],'attributes':_0x5cd90a[_0x5f70('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5f70('0xe')](function(_0x9526d2){logger[_0x5f70('0xf')]('GetMailQueue',_0x98e095);logger[_0x5f70('0x11')](_0x5f70('0x21'),_0x98e095,JSON[_0x5f70('0x12')](_0x9526d2));_0x38835a(_0x9526d2);})['catch'](function(_0xdc18a1){logger['error'](_0x5f70('0x21'),_0xdc18a1['message'],_0x98e095);_0x215ce3(_0x168b9f[_0x5f70('0x13')](0x1f4,_0xdc18a1[_0x5f70('0x14')]));});});};exports['ShowMailQueue']=function(_0x305d08){var _0x428b7f=this;return new Promise(function(_0x547e79,_0x3efe32){return db['MailQueue'][_0x5f70('0x22')]({'raw':_0x305d08['options']?_0x305d08[_0x5f70('0x19')][_0x5f70('0x1a')]===undefined?!![]:![]:!![],'where':_0x305d08[_0x5f70('0x19')]?_0x305d08[_0x5f70('0x19')][_0x5f70('0x1b')]||null:null,'attributes':_0x305d08[_0x5f70('0x19')]?_0x305d08[_0x5f70('0x19')][_0x5f70('0x1c')]||null:null,'include':_0x305d08['options']?_0x305d08['options'][_0x5f70('0x1f')]?_[_0x5f70('0x1e')](_0x305d08[_0x5f70('0x19')]['include'],function(_0xb7c07c){return{'model':db[_0xb7c07c[_0x5f70('0x20')]],'as':_0xb7c07c['as'],'attributes':_0xb7c07c[_0x5f70('0x1c')],'include':_0xb7c07c[_0x5f70('0x1f')]?_[_0x5f70('0x1e')](_0xb7c07c[_0x5f70('0x1f')],function(_0x1d3170){return{'model':db[_0x1d3170[_0x5f70('0x20')]],'as':_0x1d3170['as'],'attributes':_0x1d3170[_0x5f70('0x1c')],'include':_0x1d3170['include']?_[_0x5f70('0x1e')](_0x1d3170[_0x5f70('0x1f')],function(_0xe29ccb){return{'model':db[_0xe29ccb['model']],'as':_0xe29ccb['as'],'attributes':_0xe29ccb['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f70('0xe')](function(_0x5e089a){logger[_0x5f70('0xf')]('ShowMailQueue',_0x305d08);logger[_0x5f70('0x11')](_0x5f70('0x23'),_0x305d08,JSON[_0x5f70('0x12')](_0x5e089a));_0x547e79(_0x5e089a);})[_0x5f70('0x24')](function(_0x3b91bc){logger['error']('ShowMailQueue',_0x3b91bc[_0x5f70('0x14')],_0x305d08);_0x3efe32(_0x428b7f[_0x5f70('0x13')](0x1f4,_0x3b91bc[_0x5f70('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9f40383..28d5ab4 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 _0x865d=['removeListener','register','length','./mailQueue.events','save','remove','update','emit'];(function(_0x528511,_0x815fd3){var _0xd1b2b7=function(_0x3bf131){while(--_0x3bf131){_0x528511['push'](_0x528511['shift']());}};_0xd1b2b7(++_0x815fd3);}(_0x865d,0xbb));var _0xd865=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x865d[_0x2235bf];return _0x4c3a64;};'use strict';var MailQueueEvents=require(_0xd865('0x0'));var events=[_0xd865('0x1'),_0xd865('0x2'),_0xd865('0x3')];function createListener(_0x2d51a2,_0x4ebf96){return function(_0x1f4081){_0x4ebf96[_0xd865('0x4')](_0x2d51a2,_0x1f4081);};}function removeListener(_0x323024,_0x45502b){return function(){MailQueueEvents[_0xd865('0x5')](_0x323024,_0x45502b);};}exports[_0xd865('0x6')]=function(_0x24305b){for(var _0x286b4a=0x0,_0x2194b7=events[_0xd865('0x7')];_0x286b4a<_0x2194b7;_0x286b4a++){var _0x4f2e44=events[_0x286b4a];var _0x4891df=createListener('mailQueue:'+_0x4f2e44,_0x24305b);MailQueueEvents['on'](_0x4f2e44,_0x4891df);}}; \ No newline at end of file +var _0x6aba=['register','length','./mailQueue.events','update','removeListener'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6aba,0x75));var _0xa6ab=function(_0x3f03c7,_0x11df23){_0x3f03c7=_0x3f03c7-0x0;var _0x336de8=_0x6aba[_0x3f03c7];return _0x336de8;};'use strict';var MailQueueEvents=require(_0xa6ab('0x0'));var events=['save','remove',_0xa6ab('0x1')];function createListener(_0x3b30b5,_0x3a5e03){return function(_0x256414){_0x3a5e03['emit'](_0x3b30b5,_0x256414);};}function removeListener(_0x55e7b4,_0x1e34e3){return function(){MailQueueEvents[_0xa6ab('0x2')](_0x55e7b4,_0x1e34e3);};}exports[_0xa6ab('0x3')]=function(_0x102a20){for(var _0x4463a6=0x0,_0x3064b5=events[_0xa6ab('0x4')];_0x4463a6<_0x3064b5;_0x4463a6++){var _0x1e895e=events[_0x4463a6];var _0x21b005=createListener('mailQueue:'+_0x1e895e,_0x102a20);MailQueueEvents['on'](_0x1e895e,_0x21b005);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5143a07..ac0c292 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 _0xd7cb=['path','connect-timeout','Router','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','/:id','update','exports','multer','util'];(function(_0x88c710,_0x468230){var _0x2794f7=function(_0x284ba2){while(--_0x284ba2){_0x88c710['push'](_0x88c710['shift']());}};_0x2794f7(++_0x468230);}(_0xd7cb,0xb9));var _0xbd7c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd7cb[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xbd7c('0x0'));var util=require(_0xbd7c('0x1'));var path=require(_0xbd7c('0x2'));var timeout=require(_0xbd7c('0x3'));var express=require('express');var router=express[_0xbd7c('0x4')]();var auth=require(_0xbd7c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbd7c('0x6'));router[_0xbd7c('0x7')]('/',auth[_0xbd7c('0x8')](),controller[_0xbd7c('0x9')]);router[_0xbd7c('0x7')](_0xbd7c('0xa'),auth[_0xbd7c('0x8')](),controller[_0xbd7c('0xb')]);router[_0xbd7c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xbd7c('0xc')]);router['post']('/',auth[_0xbd7c('0x8')](),controller[_0xbd7c('0xd')]);router['put'](_0xbd7c('0xe'),auth[_0xbd7c('0x8')](),controller[_0xbd7c('0xf')]);router['delete'](_0xbd7c('0xe'),auth[_0xbd7c('0x8')](),controller['destroy']);module[_0xbd7c('0x10')]=router; \ No newline at end of file +var _0xbb10=['destroy','exports','util','path','connect-timeout','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete'];(function(_0xaa0e63,_0x565934){var _0x122c76=function(_0x539dc4){while(--_0x539dc4){_0xaa0e63['push'](_0xaa0e63['shift']());}};_0x122c76(++_0x565934);}(_0xbb10,0x19a));var _0x0bb1=function(_0x56ce21,_0x5d766c){_0x56ce21=_0x56ce21-0x0;var _0x2ae675=_0xbb10[_0x56ce21];return _0x2ae675;};'use strict';var multer=require('multer');var util=require(_0x0bb1('0x0'));var path=require(_0x0bb1('0x1'));var timeout=require(_0x0bb1('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0bb1('0x3'));var config=require('../../config/environment');var controller=require(_0x0bb1('0x4'));router[_0x0bb1('0x5')]('/',auth['isAuthenticated'](),controller[_0x0bb1('0x6')]);router[_0x0bb1('0x5')](_0x0bb1('0x7'),auth[_0x0bb1('0x8')](),controller[_0x0bb1('0x9')]);router[_0x0bb1('0x5')](_0x0bb1('0xa'),auth[_0x0bb1('0x8')](),controller['show']);router[_0x0bb1('0xb')]('/',auth[_0x0bb1('0x8')](),controller[_0x0bb1('0xc')]);router['put'](_0x0bb1('0xa'),auth[_0x0bb1('0x8')](),controller[_0x0bb1('0xd')]);router[_0x0bb1('0xe')](_0x0bb1('0xa'),auth[_0x0bb1('0x8')](),controller[_0x0bb1('0xf')]);module[_0x0bb1('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 03a3809..d47c1e2 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 _0x51a6=['DATE','moment','sequelize','exports','STRING'];(function(_0x17aea3,_0x5045ff){var _0x4d1e9b=function(_0x3eee23){while(--_0x3eee23){_0x17aea3['push'](_0x17aea3['shift']());}};_0x4d1e9b(++_0x5045ff);}(_0x51a6,0x11e));var _0x651a=function(_0x90d801,_0x5e10e5){_0x90d801=_0x90d801-0x0;var _0x136d39=_0x51a6[_0x90d801];return _0x136d39;};'use strict';var moment=require(_0x651a('0x0'));var Sequelize=require(_0x651a('0x1'));module[_0x651a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x651a('0x3')]},'joinAt':{'type':Sequelize[_0x651a('0x4')]},'leaveAt':{'type':Sequelize[_0x651a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x651a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e0c=['DATE','sequelize','exports','STRING'];(function(_0x3187a0,_0x42ffe1){var _0x19d7e5=function(_0x3a0458){while(--_0x3a0458){_0x3187a0['push'](_0x3187a0['shift']());}};_0x19d7e5(++_0x42ffe1);}(_0x0e0c,0xfd));var _0xc0e0=function(_0x43cf36,_0x333e47){_0x43cf36=_0x43cf36-0x0;var _0x306a6e=_0x0e0c[_0x43cf36];return _0x306a6e;};'use strict';var moment=require('moment');var Sequelize=require(_0xc0e0('0x0'));module[_0xc0e0('0x1')]={'uniqueid':{'type':Sequelize[_0xc0e0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc0e0('0x3')]},'leaveAt':{'type':Sequelize[_0xc0e0('0x3')]},'acceptAt':{'type':Sequelize[_0xc0e0('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc0e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ab73108..a56ba27 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 _0xa859=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','MailQueueReport','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xa859,0x11c));var _0x9a85=function(_0x3daf89,_0x479b76){_0x3daf89=_0x3daf89-0x0;var _0x293ed0=_0xa859[_0x3daf89];return _0x293ed0;};'use strict';var pdf=require(_0x9a85('0x0'));var emlformat=require(_0x9a85('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9a85('0x2'));var jsonpatch=require(_0x9a85('0x3'));var rp=require(_0x9a85('0x4'));var moment=require(_0x9a85('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a85('0x6'));var util=require(_0x9a85('0x7'));var path=require('path');var sox=require(_0x9a85('0x8'));var csv=require(_0x9a85('0x9'));var ejs=require(_0x9a85('0xa'));var fs=require('fs');var _=require(_0x9a85('0xb'));var squel=require(_0x9a85('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a85('0xd'));var deskjs=require(_0x9a85('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9a85('0xf'));var Papa=require(_0x9a85('0x10'));var Redis=require(_0x9a85('0x11'));var authService=require(_0x9a85('0x12'));var qs=require(_0x9a85('0x13'));var as=require(_0x9a85('0x14'));var hardwareService=require(_0x9a85('0x15'));var logger=require(_0x9a85('0x16'))(_0x9a85('0x17'));var utils=require('../../config/utils');var config=require(_0x9a85('0x18'));var licenseUtil=require(_0x9a85('0x19'));var db=require(_0x9a85('0x1a'))['db'];function respondWithStatusCode(_0x31d181,_0x29b886){_0x29b886=_0x29b886||0xcc;return function(_0x384be8){if(_0x384be8){return _0x31d181['sendStatus'](_0x29b886);}return _0x31d181[_0x9a85('0x1b')](_0x29b886)[_0x9a85('0x1c')]();};}function respondWithResult(_0x378fb0,_0x257507){_0x257507=_0x257507||0xc8;return function(_0x546d37){if(_0x546d37){return _0x378fb0[_0x9a85('0x1b')](_0x257507)[_0x9a85('0x1d')](_0x546d37);}};}function respondWithFilteredResult(_0xd260d8,_0x4ecf8f){return function(_0xe5d5ff){if(_0xe5d5ff){var _0x5a5391=_0xe5d5ff[_0x9a85('0x1e')],_0x5f06b1=_0x4ecf8f['offset'],_0x1a8408=_0x4ecf8f[_0x9a85('0x1f')]+_0x4ecf8f[_0x9a85('0x20')],_0x52df69;if(_0x1a8408>=_0x5a5391){_0x1a8408=_0x5a5391;_0x52df69=0xc8;}else{_0x52df69=0xce;}_0xd260d8[_0x9a85('0x1b')](_0x52df69);return _0xd260d8['set']('Content-Range',_0x5f06b1+'-'+_0x1a8408+'/'+_0x5a5391)[_0x9a85('0x1d')](_0xe5d5ff);}return null;};}function patchUpdates(_0x73479c){return function(_0x311164){try{jsonpatch[_0x9a85('0x21')](_0x311164,_0x73479c,!![]);}catch(_0x39b0d2){return BPromise[_0x9a85('0x22')](_0x39b0d2);}return _0x311164['save']();};}function saveUpdates(_0x102ea8,_0x2f8f21){return function(_0x273c7b){if(_0x273c7b){return _0x273c7b[_0x9a85('0x23')](_0x102ea8)['then'](function(_0x3a408a){return _0x3a408a;});}return null;};}function removeEntity(_0x16e402,_0x2ddcb8){return function(_0x12e882){if(_0x12e882){return _0x12e882[_0x9a85('0x24')]()[_0x9a85('0x25')](function(){_0x16e402[_0x9a85('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ee790,_0x34d59a){return function(_0x23f369){if(!_0x23f369){_0x5ee790[_0x9a85('0x26')](0x194);}return _0x23f369;};}function handleError(_0x29715d,_0x5704e0){_0x5704e0=_0x5704e0||0x1f4;return function(_0x43da51){logger[_0x9a85('0x27')](_0x43da51[_0x9a85('0x28')]);if(_0x43da51[_0x9a85('0x29')]){delete _0x43da51[_0x9a85('0x29')];}_0x29715d['status'](_0x5704e0)[_0x9a85('0x2a')](_0x43da51);};}exports[_0x9a85('0x2b')]=function(_0x2a45fd,_0x3c91c5){var _0x3b94cc={},_0x2588a6={},_0x20e899={'count':0x0,'rows':[]};var _0x1b1b17=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x15b556){return{'name':_0x15b556[_0x9a85('0x2c')],'type':_0x15b556['type'][_0x9a85('0x2d')]};});_0x2588a6[_0x9a85('0x2e')]=_['map'](_0x1b1b17,_0x9a85('0x29'));_0x2588a6['query']=_[_0x9a85('0x2f')](_0x2a45fd[_0x9a85('0x30')]);_0x2588a6[_0x9a85('0x31')]=_[_0x9a85('0x32')](_0x2588a6[_0x9a85('0x2e')],_0x2588a6[_0x9a85('0x30')]);_0x3b94cc[_0x9a85('0x33')]=_[_0x9a85('0x32')](_0x2588a6[_0x9a85('0x2e')],qs[_0x9a85('0x34')](_0x2a45fd['query'][_0x9a85('0x34')]));_0x3b94cc[_0x9a85('0x33')]=_0x3b94cc[_0x9a85('0x33')][_0x9a85('0x35')]?_0x3b94cc[_0x9a85('0x33')]:_0x2588a6['model'];if(!_0x2a45fd['query']['hasOwnProperty']('nolimit')){_0x3b94cc[_0x9a85('0x20')]=qs[_0x9a85('0x20')](_0x2a45fd[_0x9a85('0x30')]['limit']);_0x3b94cc[_0x9a85('0x1f')]=qs['offset'](_0x2a45fd['query']['offset']);}_0x3b94cc[_0x9a85('0x36')]=qs['sort'](_0x2a45fd['query'][_0x9a85('0x37')]);_0x3b94cc[_0x9a85('0x38')]=qs[_0x9a85('0x31')](_[_0x9a85('0x39')](_0x2a45fd[_0x9a85('0x30')],_0x2588a6[_0x9a85('0x31')]),_0x1b1b17);if(_0x2a45fd['query']['filter']){_0x3b94cc[_0x9a85('0x38')]=_[_0x9a85('0x3a')](_0x3b94cc[_0x9a85('0x38')],{'$or':_['map'](_0x1b1b17,function(_0x5574a5){if(_0x5574a5[_0x9a85('0x3b')]!==_0x9a85('0x3c')){var _0x268626={};_0x268626[_0x5574a5[_0x9a85('0x29')]]={'$like':'%'+_0x2a45fd['query'][_0x9a85('0x3d')]+'%'};return _0x268626;}})});}_0x3b94cc=_['merge']({},_0x3b94cc,_0x2a45fd[_0x9a85('0x3e')]);var _0x1c53cc={'where':_0x3b94cc[_0x9a85('0x38')]};return db[_0x9a85('0x3f')]['count'](_0x1c53cc)[_0x9a85('0x25')](function(_0x58f96c){_0x20e899['count']=_0x58f96c;if(_0x2a45fd['query']['includeAll']){_0x3b94cc['include']=[{'all':!![]}];}return db[_0x9a85('0x3f')][_0x9a85('0x40')](_0x3b94cc);})[_0x9a85('0x25')](function(_0x5e9548){_0x20e899[_0x9a85('0x41')]=_0x5e9548;return _0x20e899;})[_0x9a85('0x25')](respondWithFilteredResult(_0x3c91c5,_0x3b94cc))[_0x9a85('0x42')](handleError(_0x3c91c5,null));};exports[_0x9a85('0x43')]=function(_0x323209,_0x3b32f4){var _0xd61c40={'raw':!![],'where':{'id':_0x323209[_0x9a85('0x44')]['id']}},_0x5e7c59={};_0x5e7c59[_0x9a85('0x2e')]=_[_0x9a85('0x2f')](db[_0x9a85('0x3f')]['rawAttributes']);_0x5e7c59[_0x9a85('0x30')]=_[_0x9a85('0x2f')](_0x323209[_0x9a85('0x30')]);_0x5e7c59['filters']=_['intersection'](_0x5e7c59[_0x9a85('0x2e')],_0x5e7c59[_0x9a85('0x30')]);_0xd61c40[_0x9a85('0x33')]=_[_0x9a85('0x32')](_0x5e7c59['model'],qs[_0x9a85('0x34')](_0x323209[_0x9a85('0x30')][_0x9a85('0x34')]));_0xd61c40[_0x9a85('0x33')]=_0xd61c40[_0x9a85('0x33')][_0x9a85('0x35')]?_0xd61c40['attributes']:_0x5e7c59['model'];if(_0x323209['query']['includeAll']){_0xd61c40[_0x9a85('0x45')]=[{'all':!![]}];}_0xd61c40=_[_0x9a85('0x3a')]({},_0xd61c40,_0x323209[_0x9a85('0x3e')]);return db[_0x9a85('0x3f')][_0x9a85('0x46')](_0xd61c40)['then'](handleEntityNotFound(_0x3b32f4,null))[_0x9a85('0x25')](respondWithResult(_0x3b32f4,null))[_0x9a85('0x42')](handleError(_0x3b32f4,null));};exports[_0x9a85('0x47')]=function(_0x3e035b,_0x1f7959){return db['MailQueueReport']['create'](_0x3e035b[_0x9a85('0x48')],{})[_0x9a85('0x25')](respondWithResult(_0x1f7959,0xc9))[_0x9a85('0x42')](handleError(_0x1f7959,null));};exports[_0x9a85('0x23')]=function(_0x340236,_0x2dd91d){if(_0x340236[_0x9a85('0x48')]['id']){delete _0x340236['body']['id'];}return db[_0x9a85('0x3f')][_0x9a85('0x46')]({'where':{'id':_0x340236[_0x9a85('0x44')]['id']}})[_0x9a85('0x25')](handleEntityNotFound(_0x2dd91d,null))['then'](saveUpdates(_0x340236[_0x9a85('0x48')],null))['then'](respondWithResult(_0x2dd91d,null))['catch'](handleError(_0x2dd91d,null));};exports[_0x9a85('0x24')]=function(_0x3afeaa,_0x2bee41){return db[_0x9a85('0x3f')][_0x9a85('0x46')]({'where':{'id':_0x3afeaa[_0x9a85('0x44')]['id']}})[_0x9a85('0x25')](handleEntityNotFound(_0x2bee41,null))['then'](removeEntity(_0x2bee41,null))[_0x9a85('0x42')](handleError(_0x2bee41,null));};exports[_0x9a85('0x49')]=function(_0x5a695d,_0xc2b07f){return db[_0x9a85('0x3f')][_0x9a85('0x49')]()[_0x9a85('0x25')](respondWithResult(_0xc2b07f,null))[_0x9a85('0x42')](handleError(_0xc2b07f,null));}; \ No newline at end of file +var _0xe0ab=['offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','MailQueueReport','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','rawAttributes','include','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x355478,_0x3081cf){var _0xe01cdc=function(_0x5e6984){while(--_0x5e6984){_0x355478['push'](_0x355478['shift']());}};_0xe01cdc(++_0x3081cf);}(_0xe0ab,0x148));var _0xbe0a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe0ab[_0x4243a3];return _0x1b2a33;};'use strict';var pdf=require(_0xbe0a('0x0'));var emlformat=require(_0xbe0a('0x1'));var rimraf=require(_0xbe0a('0x2'));var zipdir=require(_0xbe0a('0x3'));var jsonpatch=require(_0xbe0a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe0a('0x5'));var Mustache=require(_0xbe0a('0x6'));var util=require(_0xbe0a('0x7'));var path=require('path');var sox=require(_0xbe0a('0x8'));var csv=require(_0xbe0a('0x9'));var ejs=require(_0xbe0a('0xa'));var fs=require('fs');var _=require(_0xbe0a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe0a('0xc'));var deskjs=require(_0xbe0a('0xd'));var toCsv=require(_0xbe0a('0x9'));var querystring=require(_0xbe0a('0xe'));var Papa=require('papaparse');var Redis=require(_0xbe0a('0xf'));var authService=require(_0xbe0a('0x10'));var qs=require(_0xbe0a('0x11'));var as=require(_0xbe0a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe0a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbe0a('0x14'));var db=require(_0xbe0a('0x15'))['db'];function respondWithStatusCode(_0x315477,_0x146e53){_0x146e53=_0x146e53||0xcc;return function(_0x124428){if(_0x124428){return _0x315477[_0xbe0a('0x16')](_0x146e53);}return _0x315477[_0xbe0a('0x17')](_0x146e53)[_0xbe0a('0x18')]();};}function respondWithResult(_0x97ce61,_0x33c885){_0x33c885=_0x33c885||0xc8;return function(_0x49a9b8){if(_0x49a9b8){return _0x97ce61[_0xbe0a('0x17')](_0x33c885)[_0xbe0a('0x19')](_0x49a9b8);}};}function respondWithFilteredResult(_0x16f6b0,_0x10e80d){return function(_0xe20c4c){if(_0xe20c4c){var _0x387eff=_0xe20c4c[_0xbe0a('0x1a')],_0x3f01cd=_0x10e80d['offset'],_0x536db3=_0x10e80d[_0xbe0a('0x1b')]+_0x10e80d[_0xbe0a('0x1c')],_0x50a738;if(_0x536db3>=_0x387eff){_0x536db3=_0x387eff;_0x50a738=0xc8;}else{_0x50a738=0xce;}_0x16f6b0[_0xbe0a('0x17')](_0x50a738);return _0x16f6b0[_0xbe0a('0x1d')](_0xbe0a('0x1e'),_0x3f01cd+'-'+_0x536db3+'/'+_0x387eff)[_0xbe0a('0x19')](_0xe20c4c);}return null;};}function patchUpdates(_0x259e43){return function(_0x5e4634){try{jsonpatch[_0xbe0a('0x1f')](_0x5e4634,_0x259e43,!![]);}catch(_0x47c619){return BPromise[_0xbe0a('0x20')](_0x47c619);}return _0x5e4634['save']();};}function saveUpdates(_0x3f0714,_0x48442f){return function(_0x39586e){if(_0x39586e){return _0x39586e['update'](_0x3f0714)[_0xbe0a('0x21')](function(_0x181fd8){return _0x181fd8;});}return null;};}function removeEntity(_0x33115b,_0x1da622){return function(_0x4270e4){if(_0x4270e4){return _0x4270e4[_0xbe0a('0x22')]()[_0xbe0a('0x21')](function(){_0x33115b['status'](0xcc)[_0xbe0a('0x18')]();});}};}function handleEntityNotFound(_0x449eb2,_0x70ece5){return function(_0x196465){if(!_0x196465){_0x449eb2['sendStatus'](0x194);}return _0x196465;};}function handleError(_0x1b28a0,_0x185a4a){_0x185a4a=_0x185a4a||0x1f4;return function(_0x21089c){logger[_0xbe0a('0x23')](_0x21089c[_0xbe0a('0x24')]);if(_0x21089c[_0xbe0a('0x25')]){delete _0x21089c[_0xbe0a('0x25')];}_0x1b28a0[_0xbe0a('0x17')](_0x185a4a)[_0xbe0a('0x26')](_0x21089c);};}exports[_0xbe0a('0x27')]=function(_0x2b1187,_0x344813){var _0x1eb7d7={},_0x5cd474={},_0x3a9de5={'count':0x0,'rows':[]};var _0x9d559f=_['map'](db[_0xbe0a('0x28')]['rawAttributes'],function(_0x1963ed){return{'name':_0x1963ed['fieldName'],'type':_0x1963ed[_0xbe0a('0x29')]['key']};});_0x5cd474['model']=_[_0xbe0a('0x2a')](_0x9d559f,_0xbe0a('0x25'));_0x5cd474[_0xbe0a('0x2b')]=_[_0xbe0a('0x2c')](_0x2b1187[_0xbe0a('0x2b')]);_0x5cd474[_0xbe0a('0x2d')]=_[_0xbe0a('0x2e')](_0x5cd474[_0xbe0a('0x2f')],_0x5cd474[_0xbe0a('0x2b')]);_0x1eb7d7[_0xbe0a('0x30')]=_['intersection'](_0x5cd474[_0xbe0a('0x2f')],qs[_0xbe0a('0x31')](_0x2b1187[_0xbe0a('0x2b')][_0xbe0a('0x31')]));_0x1eb7d7[_0xbe0a('0x30')]=_0x1eb7d7[_0xbe0a('0x30')][_0xbe0a('0x32')]?_0x1eb7d7[_0xbe0a('0x30')]:_0x5cd474[_0xbe0a('0x2f')];if(!_0x2b1187[_0xbe0a('0x2b')][_0xbe0a('0x33')](_0xbe0a('0x34'))){_0x1eb7d7[_0xbe0a('0x1c')]=qs[_0xbe0a('0x1c')](_0x2b1187['query'][_0xbe0a('0x1c')]);_0x1eb7d7[_0xbe0a('0x1b')]=qs['offset'](_0x2b1187[_0xbe0a('0x2b')][_0xbe0a('0x1b')]);}_0x1eb7d7[_0xbe0a('0x35')]=qs[_0xbe0a('0x36')](_0x2b1187['query']['sort']);_0x1eb7d7[_0xbe0a('0x37')]=qs[_0xbe0a('0x2d')](_[_0xbe0a('0x38')](_0x2b1187[_0xbe0a('0x2b')],_0x5cd474[_0xbe0a('0x2d')]),_0x9d559f);if(_0x2b1187[_0xbe0a('0x2b')]['filter']){_0x1eb7d7[_0xbe0a('0x37')]=_['merge'](_0x1eb7d7[_0xbe0a('0x37')],{'$or':_['map'](_0x9d559f,function(_0x27dfd7){if(_0x27dfd7[_0xbe0a('0x29')]!=='VIRTUAL'){var _0x24cd35={};_0x24cd35[_0x27dfd7['name']]={'$like':'%'+_0x2b1187[_0xbe0a('0x2b')][_0xbe0a('0x39')]+'%'};return _0x24cd35;}})});}_0x1eb7d7=_[_0xbe0a('0x3a')]({},_0x1eb7d7,_0x2b1187[_0xbe0a('0x3b')]);var _0x4e200b={'where':_0x1eb7d7[_0xbe0a('0x37')]};return db[_0xbe0a('0x28')]['count'](_0x4e200b)[_0xbe0a('0x21')](function(_0x532e37){_0x3a9de5['count']=_0x532e37;if(_0x2b1187['query']['includeAll']){_0x1eb7d7['include']=[{'all':!![]}];}return db[_0xbe0a('0x28')][_0xbe0a('0x3c')](_0x1eb7d7);})[_0xbe0a('0x21')](function(_0x30d615){_0x3a9de5['rows']=_0x30d615;return _0x3a9de5;})[_0xbe0a('0x21')](respondWithFilteredResult(_0x344813,_0x1eb7d7))[_0xbe0a('0x3d')](handleError(_0x344813,null));};exports[_0xbe0a('0x3e')]=function(_0x5b2189,_0x2eb033){var _0x350e28={'raw':!![],'where':{'id':_0x5b2189[_0xbe0a('0x3f')]['id']}},_0x5bacd7={};_0x5bacd7[_0xbe0a('0x2f')]=_[_0xbe0a('0x2c')](db[_0xbe0a('0x28')][_0xbe0a('0x40')]);_0x5bacd7['query']=_[_0xbe0a('0x2c')](_0x5b2189['query']);_0x5bacd7[_0xbe0a('0x2d')]=_[_0xbe0a('0x2e')](_0x5bacd7[_0xbe0a('0x2f')],_0x5bacd7[_0xbe0a('0x2b')]);_0x350e28[_0xbe0a('0x30')]=_[_0xbe0a('0x2e')](_0x5bacd7[_0xbe0a('0x2f')],qs[_0xbe0a('0x31')](_0x5b2189['query']['fields']));_0x350e28['attributes']=_0x350e28[_0xbe0a('0x30')]['length']?_0x350e28[_0xbe0a('0x30')]:_0x5bacd7[_0xbe0a('0x2f')];if(_0x5b2189[_0xbe0a('0x2b')]['includeAll']){_0x350e28[_0xbe0a('0x41')]=[{'all':!![]}];}_0x350e28=_[_0xbe0a('0x3a')]({},_0x350e28,_0x5b2189[_0xbe0a('0x3b')]);return db['MailQueueReport'][_0xbe0a('0x42')](_0x350e28)['then'](handleEntityNotFound(_0x2eb033,null))[_0xbe0a('0x21')](respondWithResult(_0x2eb033,null))[_0xbe0a('0x3d')](handleError(_0x2eb033,null));};exports[_0xbe0a('0x43')]=function(_0x4ba270,_0x47d5c5){return db[_0xbe0a('0x28')][_0xbe0a('0x43')](_0x4ba270['body'],{})[_0xbe0a('0x21')](respondWithResult(_0x47d5c5,0xc9))[_0xbe0a('0x3d')](handleError(_0x47d5c5,null));};exports[_0xbe0a('0x44')]=function(_0x43b450,_0x1d3c88){if(_0x43b450['body']['id']){delete _0x43b450[_0xbe0a('0x45')]['id'];}return db[_0xbe0a('0x28')]['find']({'where':{'id':_0x43b450[_0xbe0a('0x3f')]['id']}})[_0xbe0a('0x21')](handleEntityNotFound(_0x1d3c88,null))[_0xbe0a('0x21')](saveUpdates(_0x43b450[_0xbe0a('0x45')],null))[_0xbe0a('0x21')](respondWithResult(_0x1d3c88,null))[_0xbe0a('0x3d')](handleError(_0x1d3c88,null));};exports['destroy']=function(_0x11cff9,_0x1e7cb5){return db[_0xbe0a('0x28')]['find']({'where':{'id':_0x11cff9[_0xbe0a('0x3f')]['id']}})[_0xbe0a('0x21')](handleEntityNotFound(_0x1e7cb5,null))[_0xbe0a('0x21')](removeEntity(_0x1e7cb5,null))[_0xbe0a('0x3d')](handleError(_0x1e7cb5,null));};exports[_0xbe0a('0x46')]=function(_0x230fac,_0x684f86){return db[_0xbe0a('0x28')]['describe']()[_0xbe0a('0x21')](respondWithResult(_0x684f86,null))[_0xbe0a('0x3d')](handleError(_0x684f86,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2ad54d0..21cec83 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 _0x4bdc=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x227d67,_0xc9913){var _0x3549fc=function(_0x547234){while(--_0x547234){_0x227d67['push'](_0x227d67['shift']());}};_0x3549fc(++_0xc9913);}(_0x4bdc,0x155));var _0xc4bd=function(_0x3a5419,_0x42ca81){_0x3a5419=_0x3a5419-0x0;var _0x54e221=_0x4bdc[_0x3a5419];return _0x54e221;};'use strict';var _=require(_0xc4bd('0x0'));var util=require(_0xc4bd('0x1'));var logger=require(_0xc4bd('0x2'))(_0xc4bd('0x3'));var moment=require('moment');var BPromise=require(_0xc4bd('0x4'));var rp=require(_0xc4bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4bd('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xc4bd('0x7')]=function(_0x56a526,_0xe6011d){return _0x56a526[_0xc4bd('0x8')](_0xc4bd('0x9'),attributes,{'tableName':_0xc4bd('0xa'),'paranoid':![],'indexes':[{'name':_0xc4bd('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xde0f=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xe01a38,_0x2bac36){var _0x20bf91=function(_0x4517d9){while(--_0x4517d9){_0xe01a38['push'](_0xe01a38['shift']());}};_0x20bf91(++_0x2bac36);}(_0xde0f,0xa2));var _0xfde0=function(_0x3e3de0,_0x41e42c){_0x3e3de0=_0x3e3de0-0x0;var _0x3606f6=_0xde0f[_0x3e3de0];return _0x3606f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfde0('0x0'))(_0xfde0('0x1'));var moment=require(_0xfde0('0x2'));var BPromise=require(_0xfde0('0x3'));var rp=require(_0xfde0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfde0('0x5'));var config=require(_0xfde0('0x6'));var attributes=require(_0xfde0('0x7'));module[_0xfde0('0x8')]=function(_0xb6f608,_0x2c17d6){return _0xb6f608[_0xfde0('0x9')](_0xfde0('0xa'),attributes,{'tableName':_0xfde0('0xb'),'paranoid':![],'indexes':[{'name':_0xfde0('0xc'),'fields':[_0xfde0('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 2d716be..e42872b 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 _0x767a=['bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','MailQueueReport','update','where','limit','lodash','moment'];(function(_0x559e2a,_0x5800f4){var _0x21fe19=function(_0x504ade){while(--_0x504ade){_0x559e2a['push'](_0x559e2a['shift']());}};_0x21fe19(++_0x5800f4);}(_0x767a,0x1de));var _0xa767=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x767a[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xa767('0x0'));var util=require('util');var moment=require(_0xa767('0x1'));var BPromise=require(_0xa767('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa767('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa767('0x4'));var config=require(_0xa767('0x5'));var jayson=require(_0xa767('0x6'));var client=jayson[_0xa767('0x7')][_0xa767('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41346c,_0x1218ea,_0x38df45){return new BPromise(function(_0x39ff80,_0x4d0ed2){return client['request'](_0x41346c,_0x38df45)[_0xa767('0x9')](function(_0x4a826d){logger[_0xa767('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x1218ea,'request\x20sent');logger[_0xa767('0xb')](_0xa767('0xc'),_0x1218ea,_0xa767('0xd'),JSON[_0xa767('0xe')](_0x4a826d));if(_0x4a826d[_0xa767('0xf')]){if(_0x4a826d[_0xa767('0xf')]['code']===0x1f4){logger['error'](_0xa767('0x10'),_0x1218ea,_0x4a826d[_0xa767('0xf')][_0xa767('0x11')]);return _0x4d0ed2(_0x4a826d[_0xa767('0xf')][_0xa767('0x11')]);}logger[_0xa767('0xf')](_0xa767('0x10'),_0x1218ea,_0x4a826d[_0xa767('0xf')]['message']);return _0x39ff80(_0x4a826d[_0xa767('0xf')][_0xa767('0x11')]);}else{logger[_0xa767('0xa')](_0xa767('0x10'),_0x1218ea,_0xa767('0xd'));_0x39ff80(_0x4a826d[_0xa767('0x12')]['message']);}})[_0xa767('0x13')](function(_0x251702){logger[_0xa767('0xf')](_0xa767('0x10'),_0x1218ea,_0x251702);_0x4d0ed2(_0x251702);});});}exports[_0xa767('0x14')]=function(_0x1c8de6){var _0x57a18a=this;return new Promise(function(_0x1d2e7e,_0x4c44ce){return db['MailQueueReport'][_0xa767('0x15')](_0x1c8de6[_0xa767('0x16')],{'raw':_0x1c8de6[_0xa767('0x17')]?_0x1c8de6[_0xa767('0x17')][_0xa767('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x7e41fb){logger['info'](_0xa767('0x14'),_0x1c8de6);logger[_0xa767('0xb')]('CreateMailQueueReport',_0x1c8de6,JSON[_0xa767('0xe')](_0x7e41fb));_0x1d2e7e(_0x7e41fb);})[_0xa767('0x13')](function(_0x1fe99f){logger[_0xa767('0xf')](_0xa767('0x14'),_0x1fe99f[_0xa767('0x11')],_0x1c8de6);_0x4c44ce(_0x57a18a[_0xa767('0xf')](0x1f4,_0x1fe99f[_0xa767('0x11')]));});});};exports[_0xa767('0x19')]=function(_0x4cf574){var _0x31f3cf=this;return new Promise(function(_0x1c09f4,_0x2932e9){return db[_0xa767('0x1a')][_0xa767('0x1b')](_0x4cf574['body'],{'raw':_0x4cf574[_0xa767('0x17')]?_0x4cf574['options'][_0xa767('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf574[_0xa767('0x17')]?_0x4cf574[_0xa767('0x17')][_0xa767('0x1c')]||null:null,'attributes':_0x4cf574[_0xa767('0x17')]?_0x4cf574['options']['attributes']||null:null,'limit':_0x4cf574[_0xa767('0x17')]?_0x4cf574[_0xa767('0x17')][_0xa767('0x1d')]||null:null})[_0xa767('0x9')](function(_0x2cdae9){logger[_0xa767('0xa')]('UpdateMailQueueReport',_0x4cf574);logger['debug'](_0xa767('0x19'),_0x4cf574,JSON['stringify'](_0x2cdae9));_0x1c09f4(_0x2cdae9);})[_0xa767('0x13')](function(_0x45938f){logger['error']('UpdateMailQueueReport',_0x45938f[_0xa767('0x11')],_0x4cf574);_0x2932e9(_0x31f3cf[_0xa767('0xf')](0x1f4,_0x45938f[_0xa767('0x11')]));});});}; \ No newline at end of file +var _0x94ac=['MailQueueReport','body','options','raw','UpdateMailQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateMailQueueReport'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x94ac,0x1a1));var _0xc94a=function(_0x2a3d4d,_0x2663c3){_0x2a3d4d=_0x2a3d4d-0x0;var _0xa7aead=_0x94ac[_0x2a3d4d];return _0xa7aead;};'use strict';var _=require(_0xc94a('0x0'));var util=require(_0xc94a('0x1'));var moment=require(_0xc94a('0x2'));var BPromise=require(_0xc94a('0x3'));var rs=require(_0xc94a('0x4'));var fs=require('fs');var Redis=require(_0xc94a('0x5'));var db=require(_0xc94a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94a('0x7'))(_0xc94a('0x8'));var config=require(_0xc94a('0x9'));var jayson=require(_0xc94a('0xa'));var client=jayson['client'][_0xc94a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b0ff,_0x169ba8,_0x518662){return new BPromise(function(_0x43cbb4,_0x21d360){return client[_0xc94a('0xc')](_0x10b0ff,_0x518662)[_0xc94a('0xd')](function(_0x464dfc){logger['info'](_0xc94a('0xe'),_0x169ba8,_0xc94a('0xf'));logger[_0xc94a('0x10')](_0xc94a('0x11'),_0x169ba8,_0xc94a('0xf'),JSON[_0xc94a('0x12')](_0x464dfc));if(_0x464dfc[_0xc94a('0x13')]){if(_0x464dfc[_0xc94a('0x13')][_0xc94a('0x14')]===0x1f4){logger['error'](_0xc94a('0xe'),_0x169ba8,_0x464dfc[_0xc94a('0x13')][_0xc94a('0x15')]);return _0x21d360(_0x464dfc['error'][_0xc94a('0x15')]);}logger[_0xc94a('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x169ba8,_0x464dfc[_0xc94a('0x13')]['message']);return _0x43cbb4(_0x464dfc[_0xc94a('0x13')][_0xc94a('0x15')]);}else{logger[_0xc94a('0x16')](_0xc94a('0xe'),_0x169ba8,'request\x20sent');_0x43cbb4(_0x464dfc['result'][_0xc94a('0x15')]);}})[_0xc94a('0x17')](function(_0x15028c){logger[_0xc94a('0x13')](_0xc94a('0xe'),_0x169ba8,_0x15028c);_0x21d360(_0x15028c);});});}exports[_0xc94a('0x18')]=function(_0x299a19){var _0x100859=this;return new Promise(function(_0x2b59cc,_0x5aefa4){return db[_0xc94a('0x19')]['create'](_0x299a19[_0xc94a('0x1a')],{'raw':_0x299a19[_0xc94a('0x1b')]?_0x299a19[_0xc94a('0x1b')][_0xc94a('0x1c')]===undefined?!![]:![]:!![]})[_0xc94a('0xd')](function(_0x4762b1){logger[_0xc94a('0x16')](_0xc94a('0x18'),_0x299a19);logger[_0xc94a('0x10')](_0xc94a('0x18'),_0x299a19,JSON[_0xc94a('0x12')](_0x4762b1));_0x2b59cc(_0x4762b1);})[_0xc94a('0x17')](function(_0x4d55b1){logger[_0xc94a('0x13')](_0xc94a('0x18'),_0x4d55b1['message'],_0x299a19);_0x5aefa4(_0x100859[_0xc94a('0x13')](0x1f4,_0x4d55b1['message']));});});};exports[_0xc94a('0x1d')]=function(_0xb0bf73){var _0x3a1453=this;return new Promise(function(_0x4ee607,_0x4a5a41){return db[_0xc94a('0x19')][_0xc94a('0x1e')](_0xb0bf73['body'],{'raw':_0xb0bf73[_0xc94a('0x1b')]?_0xb0bf73['options'][_0xc94a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb0bf73[_0xc94a('0x1b')]?_0xb0bf73[_0xc94a('0x1b')][_0xc94a('0x1f')]||null:null,'attributes':_0xb0bf73[_0xc94a('0x1b')]?_0xb0bf73['options'][_0xc94a('0x20')]||null:null,'limit':_0xb0bf73[_0xc94a('0x1b')]?_0xb0bf73['options'][_0xc94a('0x21')]||null:null})['then'](function(_0x4bd0a8){logger[_0xc94a('0x16')]('UpdateMailQueueReport',_0xb0bf73);logger[_0xc94a('0x10')](_0xc94a('0x1d'),_0xb0bf73,JSON[_0xc94a('0x12')](_0x4bd0a8));_0x4ee607(_0x4bd0a8);})[_0xc94a('0x17')](function(_0x24537f){logger[_0xc94a('0x13')](_0xc94a('0x1d'),_0x24537f['message'],_0xb0bf73);_0x4a5a41(_0x3a1453['error'](0x1f4,_0x24537f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ab92029..638a364 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 _0xad3d=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x285203,_0x3a7a49){var _0x50280a=function(_0x157e9d){while(--_0x157e9d){_0x285203['push'](_0x285203['shift']());}};_0x50280a(++_0x3a7a49);}(_0xad3d,0xb7));var _0xdad3=function(_0x12eb89,_0x35a1ed){_0x12eb89=_0x12eb89-0x0;var _0x57ed75=_0xad3d[_0x12eb89];return _0x57ed75;};'use strict';var multer=require(_0xdad3('0x0'));var util=require(_0xdad3('0x1'));var path=require(_0xdad3('0x2'));var timeout=require(_0xdad3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xdad3('0x4'));var interaction=require(_0xdad3('0x5'));var config=require('../../config/environment');module[_0xdad3('0x6')]=router; \ No newline at end of file +var _0xd420=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x40adf2,_0x5a5f06){var _0x1600db=function(_0x504b5b){while(--_0x504b5b){_0x40adf2['push'](_0x40adf2['shift']());}};_0x1600db(++_0x5a5f06);}(_0xd420,0xed));var _0x0d42=function(_0x4eb07c,_0x3dac3a){_0x4eb07c=_0x4eb07c-0x0;var _0x4df39f=_0xd420[_0x4eb07c];return _0x4df39f;};'use strict';var multer=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var path=require(_0x0d42('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d42('0x3'));var router=express[_0x0d42('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d42('0x5'));var config=require(_0x0d42('0x6'));module[_0x0d42('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index cc4192d..80a518b 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 _0xc5f7=['exports','STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x455d0c,_0x13f4a0){var _0x533421=function(_0x5b2f18){while(--_0x5b2f18){_0x455d0c['push'](_0x455d0c['shift']());}};_0x533421(++_0x13f4a0);}(_0xc5f7,0x109));var _0x7c5f=function(_0x5720c4,_0x474ec5){_0x5720c4=_0x5720c4-0x0;var _0x1ee45b=_0xc5f7[_0x5720c4];return _0x1ee45b;};'use strict';var Sequelize=require(_0x7c5f('0x0'));module[_0x7c5f('0x1')]={'description':{'type':Sequelize[_0x7c5f('0x2')]},'host':{'type':Sequelize[_0x7c5f('0x2')]},'authentication':{'type':Sequelize[_0x7c5f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7c5f('0x2')],'unique':_0x7c5f('0x4')},'password':{'type':Sequelize[_0x7c5f('0x2')]},'port':{'type':Sequelize[_0x7c5f('0x5')]},'tls':{'type':Sequelize[_0x7c5f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7c5f('0x2')],'defaultValue':_0x7c5f('0x6')},'connTimeout':{'type':Sequelize[_0x7c5f('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7c5f('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a3a=['INTEGER','sequelize','STRING','BOOLEAN','INBOX'];(function(_0x41551d,_0x37f99a){var _0x5e9278=function(_0x2bb641){while(--_0x2bb641){_0x41551d['push'](_0x41551d['shift']());}};_0x5e9278(++_0x37f99a);}(_0x9a3a,0x1af));var _0xa9a3=function(_0x4cd814,_0x5b045a){_0x4cd814=_0x4cd814-0x0;var _0x5c7f7e=_0x9a3a[_0x4cd814];return _0x5c7f7e;};'use strict';var Sequelize=require(_0xa9a3('0x0'));module['exports']={'description':{'type':Sequelize[_0xa9a3('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa9a3('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa9a3('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xa9a3('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xa9a3('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa9a3('0x3')},'connTimeout':{'type':Sequelize[_0xa9a3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa9a3('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa9a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0493e6c..c098ed5 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 _0xf7b4=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','api','moment'];(function(_0x23001b,_0x13cc18){var _0x58d068=function(_0x667eb9){while(--_0x667eb9){_0x23001b['push'](_0x23001b['shift']());}};_0x58d068(++_0x13cc18);}(_0xf7b4,0x152));var _0x4f7b=function(_0xfb3b3,_0x10db7a){_0xfb3b3=_0xfb3b3-0x0;var _0x36cae7=_0xf7b4[_0xfb3b3];return _0x36cae7;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['mail_servers_in','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x30e40f,_0x18e381){var _0x377fc0=function(_0xa8d578){while(--_0xa8d578){_0x30e40f['push'](_0x30e40f['shift']());}};_0x377fc0(++_0x18e381);}(_0x2032,0xd9));var _0x2203=function(_0x522f41,_0x2805d5){_0x522f41=_0x522f41-0x0;var _0x20a953=_0x2032[_0x522f41];return _0x20a953;};'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/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 1f34f72..22c292f 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 _0x47d7=['model','attributes','GetMailServerIn','catch','lodash','util','bluebird','randomstring','../../config/logger','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn','findAll','options','raw','where','limit','include','map'];(function(_0x5c183e,_0x281786){var _0xb26da=function(_0x5b4df2){while(--_0x5b4df2){_0x5c183e['push'](_0x5c183e['shift']());}};_0xb26da(++_0x281786);}(_0x47d7,0x9a));var _0x747d=function(_0x3dcc07,_0x3aba6b){_0x3dcc07=_0x3dcc07-0x0;var _0x1967d2=_0x47d7[_0x3dcc07];return _0x1967d2;};'use strict';var _=require(_0x747d('0x0'));var util=require(_0x747d('0x1'));var moment=require('moment');var BPromise=require(_0x747d('0x2'));var rs=require(_0x747d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x747d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x747d('0x5'));var client=jayson[_0x747d('0x6')][_0x747d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cad42,_0x374c07,_0x34c95f){return new BPromise(function(_0x5ee956,_0x53af3b){return client['request'](_0x5cad42,_0x34c95f)[_0x747d('0x8')](function(_0x1156a3){logger[_0x747d('0x9')](_0x747d('0xa'),_0x374c07,_0x747d('0xb'));logger[_0x747d('0xc')](_0x747d('0xd'),_0x374c07,'request\x20sent',JSON[_0x747d('0xe')](_0x1156a3));if(_0x1156a3[_0x747d('0xf')]){if(_0x1156a3[_0x747d('0xf')][_0x747d('0x10')]===0x1f4){logger[_0x747d('0xf')]('MailServerIn,\x20%s,\x20%s',_0x374c07,_0x1156a3[_0x747d('0xf')][_0x747d('0x11')]);return _0x53af3b(_0x1156a3[_0x747d('0xf')][_0x747d('0x11')]);}logger['error'](_0x747d('0xa'),_0x374c07,_0x1156a3[_0x747d('0xf')][_0x747d('0x11')]);return _0x5ee956(_0x1156a3[_0x747d('0xf')][_0x747d('0x11')]);}else{logger[_0x747d('0x9')](_0x747d('0xa'),_0x374c07,_0x747d('0xb'));_0x5ee956(_0x1156a3['result'][_0x747d('0x11')]);}})['catch'](function(_0x190540){logger[_0x747d('0xf')](_0x747d('0xa'),_0x374c07,_0x190540);_0x53af3b(_0x190540);});});}exports['GetMailServerIn']=function(_0x58abe0){var _0x37f5d4=this;return new Promise(function(_0x17e107,_0x90c2fd){return db[_0x747d('0x12')][_0x747d('0x13')]({'raw':_0x58abe0[_0x747d('0x14')]?_0x58abe0[_0x747d('0x14')][_0x747d('0x15')]===undefined?!![]:![]:!![],'where':_0x58abe0[_0x747d('0x14')]?_0x58abe0[_0x747d('0x14')][_0x747d('0x16')]||null:null,'attributes':_0x58abe0[_0x747d('0x14')]?_0x58abe0['options']['attributes']||null:null,'limit':_0x58abe0[_0x747d('0x14')]?_0x58abe0[_0x747d('0x14')][_0x747d('0x17')]||null:null,'include':_0x58abe0['options']?_0x58abe0[_0x747d('0x14')][_0x747d('0x18')]?_[_0x747d('0x19')](_0x58abe0[_0x747d('0x14')][_0x747d('0x18')],function(_0x373d02){return{'model':db[_0x373d02[_0x747d('0x1a')]],'as':_0x373d02['as'],'attributes':_0x373d02['attributes'],'include':_0x373d02['include']?_[_0x747d('0x19')](_0x373d02[_0x747d('0x18')],function(_0x410171){return{'model':db[_0x410171[_0x747d('0x1a')]],'as':_0x410171['as'],'attributes':_0x410171['attributes'],'include':_0x410171[_0x747d('0x18')]?_['map'](_0x410171[_0x747d('0x18')],function(_0x55213b){return{'model':db[_0x55213b[_0x747d('0x1a')]],'as':_0x55213b['as'],'attributes':_0x55213b[_0x747d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x747d('0x8')](function(_0x2c1171){logger['info'](_0x747d('0x1c'),_0x58abe0);logger[_0x747d('0xc')]('GetMailServerIn',_0x58abe0,JSON[_0x747d('0xe')](_0x2c1171));_0x17e107(_0x2c1171);})[_0x747d('0x1d')](function(_0x54ed54){logger[_0x747d('0xf')](_0x747d('0x1c'),_0x54ed54['message'],_0x58abe0);_0x90c2fd(_0x37f5d4[_0x747d('0xf')](0x1f4,_0x54ed54[_0x747d('0x11')]));});});}; \ No newline at end of file +var _0xbf79=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailServerIn','findAll','raw','options','attributes','limit','include','model','map','GetMailServerIn','util','bluebird','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x55e748,_0x29b6a4){var _0x412bd1=function(_0x1f9c62){while(--_0x1f9c62){_0x55e748['push'](_0x55e748['shift']());}};_0x412bd1(++_0x29b6a4);}(_0xbf79,0x10e));var _0x9bf7=function(_0x151bb8,_0x3f4e15){_0x151bb8=_0x151bb8-0x0;var _0x114eed=_0xbf79[_0x151bb8];return _0x114eed;};'use strict';var _=require('lodash');var util=require(_0x9bf7('0x0'));var moment=require('moment');var BPromise=require(_0x9bf7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9bf7('0x2'));var logger=require(_0x9bf7('0x3'))('rpc');var config=require(_0x9bf7('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9bf7('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x7faf6b,_0xaa8022,_0x460205){return new BPromise(function(_0x57ea38,_0x18abb6){return client[_0x9bf7('0x6')](_0x7faf6b,_0x460205)[_0x9bf7('0x7')](function(_0x2e121e){logger[_0x9bf7('0x8')](_0x9bf7('0x9'),_0xaa8022,_0x9bf7('0xa'));logger[_0x9bf7('0xb')](_0x9bf7('0xc'),_0xaa8022,_0x9bf7('0xa'),JSON[_0x9bf7('0xd')](_0x2e121e));if(_0x2e121e['error']){if(_0x2e121e[_0x9bf7('0xe')][_0x9bf7('0xf')]===0x1f4){logger[_0x9bf7('0xe')](_0x9bf7('0x9'),_0xaa8022,_0x2e121e[_0x9bf7('0xe')][_0x9bf7('0x10')]);return _0x18abb6(_0x2e121e[_0x9bf7('0xe')][_0x9bf7('0x10')]);}logger[_0x9bf7('0xe')](_0x9bf7('0x9'),_0xaa8022,_0x2e121e[_0x9bf7('0xe')][_0x9bf7('0x10')]);return _0x57ea38(_0x2e121e[_0x9bf7('0xe')]['message']);}else{logger[_0x9bf7('0x8')]('MailServerIn,\x20%s,\x20%s',_0xaa8022,'request\x20sent');_0x57ea38(_0x2e121e['result'][_0x9bf7('0x10')]);}})[_0x9bf7('0x11')](function(_0x3a4945){logger['error']('MailServerIn,\x20%s,\x20%s',_0xaa8022,_0x3a4945);_0x18abb6(_0x3a4945);});});}exports['GetMailServerIn']=function(_0x22d1d7){var _0xec27b=this;return new Promise(function(_0x5e1003,_0x695845){return db[_0x9bf7('0x12')][_0x9bf7('0x13')]({'raw':_0x22d1d7['options']?_0x22d1d7['options'][_0x9bf7('0x14')]===undefined?!![]:![]:!![],'where':_0x22d1d7['options']?_0x22d1d7[_0x9bf7('0x15')]['where']||null:null,'attributes':_0x22d1d7['options']?_0x22d1d7[_0x9bf7('0x15')][_0x9bf7('0x16')]||null:null,'limit':_0x22d1d7[_0x9bf7('0x15')]?_0x22d1d7['options'][_0x9bf7('0x17')]||null:null,'include':_0x22d1d7[_0x9bf7('0x15')]?_0x22d1d7['options'][_0x9bf7('0x18')]?_['map'](_0x22d1d7['options'][_0x9bf7('0x18')],function(_0x33db22){return{'model':db[_0x33db22[_0x9bf7('0x19')]],'as':_0x33db22['as'],'attributes':_0x33db22['attributes'],'include':_0x33db22[_0x9bf7('0x18')]?_[_0x9bf7('0x1a')](_0x33db22['include'],function(_0xa06f0e){return{'model':db[_0xa06f0e[_0x9bf7('0x19')]],'as':_0xa06f0e['as'],'attributes':_0xa06f0e[_0x9bf7('0x16')],'include':_0xa06f0e[_0x9bf7('0x18')]?_[_0x9bf7('0x1a')](_0xa06f0e[_0x9bf7('0x18')],function(_0x44a170){return{'model':db[_0x44a170[_0x9bf7('0x19')]],'as':_0x44a170['as'],'attributes':_0x44a170[_0x9bf7('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9bf7('0x7')](function(_0x2f275d){logger[_0x9bf7('0x8')](_0x9bf7('0x1b'),_0x22d1d7);logger[_0x9bf7('0xb')]('GetMailServerIn',_0x22d1d7,JSON['stringify'](_0x2f275d));_0x5e1003(_0x2f275d);})[_0x9bf7('0x11')](function(_0x1bdcd6){logger[_0x9bf7('0xe')](_0x9bf7('0x1b'),_0x1bdcd6[_0x9bf7('0x10')],_0x22d1d7);_0x695845(_0xec27b[_0x9bf7('0xe')](0x1f4,_0x1bdcd6[_0x9bf7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8297970..fc10867 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 _0x78d2=['create','put','/:id','update','delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','post'];(function(_0x277261,_0x8615f6){var _0x51aa0=function(_0x25384a){while(--_0x25384a){_0x277261['push'](_0x277261['shift']());}};_0x51aa0(++_0x8615f6);}(_0x78d2,0xac));var _0x278d=function(_0x1bc715,_0x3d9c84){_0x1bc715=_0x1bc715-0x0;var _0x58c9e4=_0x78d2[_0x1bc715];return _0x58c9e4;};'use strict';var multer=require('multer');var util=require(_0x278d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x278d('0x1'));var router=express['Router']();var auth=require(_0x278d('0x2'));var interaction=require(_0x278d('0x3'));var config=require('../../config/environment');var controller=require(_0x278d('0x4'));router[_0x278d('0x5')]('/',auth[_0x278d('0x6')](),controller['index']);router[_0x278d('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x278d('0x7')]('/',auth[_0x278d('0x6')](),controller[_0x278d('0x8')]);router[_0x278d('0x9')](_0x278d('0xa'),auth[_0x278d('0x6')](),controller[_0x278d('0xb')]);router[_0x278d('0xc')](_0x278d('0xa'),auth[_0x278d('0x6')](),controller[_0x278d('0xd')]);module[_0x278d('0xe')]=router; \ No newline at end of file +var _0x067f=['isAuthenticated','index','/:id','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x331b01,_0x2290b1){var _0x287f12=function(_0x165787){while(--_0x165787){_0x331b01['push'](_0x331b01['shift']());}};_0x287f12(++_0x2290b1);}(_0x067f,0x1dc));var _0xf067=function(_0x2371e3,_0x543449){_0x2371e3=_0x2371e3-0x0;var _0x14e44a=_0x067f[_0x2371e3];return _0x14e44a;};'use strict';var multer=require('multer');var util=require(_0xf067('0x0'));var path=require(_0xf067('0x1'));var timeout=require(_0xf067('0x2'));var express=require(_0xf067('0x3'));var router=express[_0xf067('0x4')]();var auth=require(_0xf067('0x5'));var interaction=require(_0xf067('0x6'));var config=require(_0xf067('0x7'));var controller=require(_0xf067('0x8'));router[_0xf067('0x9')]('/',auth[_0xf067('0xa')](),controller[_0xf067('0xb')]);router[_0xf067('0x9')](_0xf067('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf067('0xd')]);router[_0xf067('0xe')](_0xf067('0xc'),auth[_0xf067('0xa')](),controller['update']);router[_0xf067('0xf')]('/:id',auth[_0xf067('0xa')](),controller[_0xf067('0x10')]);module[_0xf067('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0af2fa5..086dd68 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 _0x3974=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x3974,0xbc));var _0x4397=function(_0x13d2cb,_0x451660){_0x13d2cb=_0x13d2cb-0x0;var _0x42c0c3=_0x3974[_0x13d2cb];return _0x42c0c3;};'use strict';var Sequelize=require(_0x4397('0x0'));module[_0x4397('0x1')]={'description':{'type':Sequelize[_0x4397('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4397('0x2')]},'port':{'type':Sequelize[_0x4397('0x3')]},'secure':{'type':Sequelize[_0x4397('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4397('0x2')]},'authentication':{'type':Sequelize[_0x4397('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb5dd=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0xf72ecc,_0x5976f4){var _0x4e360a=function(_0x109379){while(--_0x109379){_0xf72ecc['push'](_0xf72ecc['shift']());}};_0x4e360a(++_0x5976f4);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb5dd[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xdb5d('0x0'));module[_0xdb5d('0x1')]={'description':{'type':Sequelize[_0xdb5d('0x2')]},'host':{'type':Sequelize[_0xdb5d('0x2')]},'user':{'type':Sequelize[_0xdb5d('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdb5d('0x3')]},'secure':{'type':Sequelize[_0xdb5d('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xdb5d('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 650fde5..57469c9 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 _0x821d=['mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','error','stack','name','send','index','MailServerOut','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','destroy','html-pdf','rimraf','request-promise','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x821d,0x8c));var _0xd821=function(_0x417f63,_0x33b548){_0x417f63=_0x417f63-0x0;var _0x4c5281=_0x821d[_0x417f63];return _0x4c5281;};'use strict';var pdf=require(_0xd821('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd821('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd821('0x2'));var moment=require(_0xd821('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd821('0x4'));var util=require(_0xd821('0x5'));var path=require(_0xd821('0x6'));var sox=require(_0xd821('0x7'));var csv=require('to-csv');var ejs=require(_0xd821('0x8'));var fs=require('fs');var _=require(_0xd821('0x9'));var squel=require(_0xd821('0xa'));var crypto=require(_0xd821('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd821('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd821('0xd'));var Redis=require(_0xd821('0xe'));var authService=require(_0xd821('0xf'));var qs=require(_0xd821('0x10'));var as=require(_0xd821('0x11'));var hardwareService=require(_0xd821('0x12'));var logger=require(_0xd821('0x13'))(_0xd821('0x14'));var utils=require('../../config/utils');var config=require(_0xd821('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd821('0x16'))['db'];function respondWithStatusCode(_0x4d01ed,_0x1d705f){_0x1d705f=_0x1d705f||0xcc;return function(_0x185617){if(_0x185617){return _0x4d01ed[_0xd821('0x17')](_0x1d705f);}return _0x4d01ed[_0xd821('0x18')](_0x1d705f)[_0xd821('0x19')]();};}function respondWithResult(_0x63efa8,_0xe65428){_0xe65428=_0xe65428||0xc8;return function(_0x231bb5){if(_0x231bb5){return _0x63efa8[_0xd821('0x18')](_0xe65428)[_0xd821('0x1a')](_0x231bb5);}};}function respondWithFilteredResult(_0x5bf70d,_0x36593c){return function(_0x2df9f7){if(_0x2df9f7){var _0x1fe0d1=_0x2df9f7[_0xd821('0x1b')],_0xb4434e=_0x36593c[_0xd821('0x1c')],_0x12dfda=_0x36593c[_0xd821('0x1c')]+_0x36593c[_0xd821('0x1d')],_0x3b6943;if(_0x12dfda>=_0x1fe0d1){_0x12dfda=_0x1fe0d1;_0x3b6943=0xc8;}else{_0x3b6943=0xce;}_0x5bf70d[_0xd821('0x18')](_0x3b6943);return _0x5bf70d['set']('Content-Range',_0xb4434e+'-'+_0x12dfda+'/'+_0x1fe0d1)[_0xd821('0x1a')](_0x2df9f7);}return null;};}function patchUpdates(_0xd52988){return function(_0xe5e0d9){try{jsonpatch[_0xd821('0x1e')](_0xe5e0d9,_0xd52988,!![]);}catch(_0x3af842){return BPromise[_0xd821('0x1f')](_0x3af842);}return _0xe5e0d9[_0xd821('0x20')]();};}function saveUpdates(_0x1c9ec8,_0x211db2){return function(_0x23b18){if(_0x23b18){return _0x23b18[_0xd821('0x21')](_0x1c9ec8)['then'](function(_0x3d50f8){return _0x3d50f8;});}return null;};}function removeEntity(_0x1d5d74,_0x296260){return function(_0x4701d1){if(_0x4701d1){return _0x4701d1['destroy']()['then'](function(){_0x1d5d74[_0xd821('0x18')](0xcc)[_0xd821('0x19')]();});}};}function handleEntityNotFound(_0x1e5de0,_0x16809a){return function(_0x111a9b){if(!_0x111a9b){_0x1e5de0[_0xd821('0x17')](0x194);}return _0x111a9b;};}function handleError(_0x59c6a3,_0x3d0b48){_0x3d0b48=_0x3d0b48||0x1f4;return function(_0x54c3fd){logger[_0xd821('0x22')](_0x54c3fd[_0xd821('0x23')]);if(_0x54c3fd[_0xd821('0x24')]){delete _0x54c3fd[_0xd821('0x24')];}_0x59c6a3[_0xd821('0x18')](_0x3d0b48)[_0xd821('0x25')](_0x54c3fd);};}exports[_0xd821('0x26')]=function(_0x29f470,_0x55081a){var _0x599a61={},_0xc7c14f={},_0x2f8784={'count':0x0,'rows':[]};var _0x495cf9=_['map'](db[_0xd821('0x27')]['rawAttributes'],function(_0x2fad8a){return{'name':_0x2fad8a[_0xd821('0x28')],'type':_0x2fad8a[_0xd821('0x29')][_0xd821('0x2a')]};});_0xc7c14f['model']=_[_0xd821('0x2b')](_0x495cf9,_0xd821('0x24'));_0xc7c14f['query']=_['keys'](_0x29f470[_0xd821('0x2c')]);_0xc7c14f[_0xd821('0x2d')]=_[_0xd821('0x2e')](_0xc7c14f[_0xd821('0x2f')],_0xc7c14f[_0xd821('0x2c')]);_0x599a61[_0xd821('0x30')]=_[_0xd821('0x2e')](_0xc7c14f[_0xd821('0x2f')],qs[_0xd821('0x31')](_0x29f470[_0xd821('0x2c')][_0xd821('0x31')]));_0x599a61[_0xd821('0x30')]=_0x599a61[_0xd821('0x30')][_0xd821('0x32')]?_0x599a61[_0xd821('0x30')]:_0xc7c14f[_0xd821('0x2f')];if(!_0x29f470[_0xd821('0x2c')]['hasOwnProperty'](_0xd821('0x33'))){_0x599a61[_0xd821('0x1d')]=qs['limit'](_0x29f470[_0xd821('0x2c')][_0xd821('0x1d')]);_0x599a61[_0xd821('0x1c')]=qs['offset'](_0x29f470['query']['offset']);}_0x599a61[_0xd821('0x34')]=qs[_0xd821('0x35')](_0x29f470[_0xd821('0x2c')][_0xd821('0x35')]);_0x599a61[_0xd821('0x36')]=qs['filters'](_['pick'](_0x29f470[_0xd821('0x2c')],_0xc7c14f[_0xd821('0x2d')]),_0x495cf9);if(_0x29f470[_0xd821('0x2c')][_0xd821('0x37')]){_0x599a61[_0xd821('0x36')]=_[_0xd821('0x38')](_0x599a61['where'],{'$or':_['map'](_0x495cf9,function(_0x895818){if(_0x895818[_0xd821('0x29')]!==_0xd821('0x39')){var _0x18843e={};_0x18843e[_0x895818[_0xd821('0x24')]]={'$like':'%'+_0x29f470[_0xd821('0x2c')][_0xd821('0x37')]+'%'};return _0x18843e;}})});}_0x599a61=_[_0xd821('0x38')]({},_0x599a61,_0x29f470[_0xd821('0x3a')]);var _0x350a8c={'where':_0x599a61[_0xd821('0x36')]};return db[_0xd821('0x27')][_0xd821('0x1b')](_0x350a8c)[_0xd821('0x3b')](function(_0x2581fd){_0x2f8784[_0xd821('0x1b')]=_0x2581fd;if(_0x29f470['query'][_0xd821('0x3c')]){_0x599a61[_0xd821('0x3d')]=[{'all':!![]}];}return db[_0xd821('0x27')][_0xd821('0x3e')](_0x599a61);})[_0xd821('0x3b')](function(_0x43a67e){_0x2f8784['rows']=_0x43a67e;return _0x2f8784;})['then'](respondWithFilteredResult(_0x55081a,_0x599a61))[_0xd821('0x3f')](handleError(_0x55081a,null));};exports[_0xd821('0x40')]=function(_0xb42403,_0x519380){var _0x1ce892={'raw':!![],'where':{'id':_0xb42403[_0xd821('0x41')]['id']}},_0x2dd9b1={};_0x2dd9b1[_0xd821('0x2f')]=_[_0xd821('0x42')](db[_0xd821('0x27')][_0xd821('0x43')]);_0x2dd9b1[_0xd821('0x2c')]=_[_0xd821('0x42')](_0xb42403[_0xd821('0x2c')]);_0x2dd9b1['filters']=_[_0xd821('0x2e')](_0x2dd9b1[_0xd821('0x2f')],_0x2dd9b1[_0xd821('0x2c')]);_0x1ce892[_0xd821('0x30')]=_[_0xd821('0x2e')](_0x2dd9b1[_0xd821('0x2f')],qs['fields'](_0xb42403[_0xd821('0x2c')]['fields']));_0x1ce892['attributes']=_0x1ce892['attributes'][_0xd821('0x32')]?_0x1ce892[_0xd821('0x30')]:_0x2dd9b1[_0xd821('0x2f')];if(_0xb42403[_0xd821('0x2c')][_0xd821('0x3c')]){_0x1ce892['include']=[{'all':!![]}];}_0x1ce892=_[_0xd821('0x38')]({},_0x1ce892,_0xb42403[_0xd821('0x3a')]);return db[_0xd821('0x27')][_0xd821('0x44')](_0x1ce892)[_0xd821('0x3b')](handleEntityNotFound(_0x519380,null))[_0xd821('0x3b')](respondWithResult(_0x519380,null))[_0xd821('0x3f')](handleError(_0x519380,null));};exports[_0xd821('0x45')]=function(_0x44d3a1,_0x1025c9){return db[_0xd821('0x27')][_0xd821('0x45')](_0x44d3a1[_0xd821('0x46')],{})[_0xd821('0x3b')](respondWithResult(_0x1025c9,0xc9))[_0xd821('0x3f')](handleError(_0x1025c9,null));};exports[_0xd821('0x21')]=function(_0x4cb541,_0x478a57){if(_0x4cb541[_0xd821('0x46')]['id']){delete _0x4cb541['body']['id'];}return db[_0xd821('0x27')][_0xd821('0x44')]({'where':{'id':_0x4cb541[_0xd821('0x41')]['id']}})[_0xd821('0x3b')](handleEntityNotFound(_0x478a57,null))[_0xd821('0x3b')](saveUpdates(_0x4cb541[_0xd821('0x46')],null))[_0xd821('0x3b')](respondWithResult(_0x478a57,null))['catch'](handleError(_0x478a57,null));};exports[_0xd821('0x47')]=function(_0x42664f,_0x19b68e){return db['MailServerOut']['find']({'where':{'id':_0x42664f[_0xd821('0x41')]['id']}})[_0xd821('0x3b')](handleEntityNotFound(_0x19b68e,null))[_0xd821('0x3b')](removeEntity(_0x19b68e,null))[_0xd821('0x3f')](handleError(_0x19b68e,null));}; \ No newline at end of file +var _0x7f7f=['options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL'];(function(_0x35887c,_0x5ae247){var _0x2a5458=function(_0x27a21e){while(--_0x27a21e){_0x35887c['push'](_0x35887c['shift']());}};_0x2a5458(++_0x5ae247);}(_0x7f7f,0x1c2));var _0xf7f7=function(_0x393cf4,_0x5902d8){_0x393cf4=_0x393cf4-0x0;var _0x36ffce=_0x7f7f[_0x393cf4];return _0x36ffce;};'use strict';var pdf=require(_0xf7f7('0x0'));var emlformat=require(_0xf7f7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf7f7('0x2'));var rp=require(_0xf7f7('0x3'));var moment=require(_0xf7f7('0x4'));var BPromise=require(_0xf7f7('0x5'));var Mustache=require(_0xf7f7('0x6'));var util=require(_0xf7f7('0x7'));var path=require(_0xf7f7('0x8'));var sox=require(_0xf7f7('0x9'));var csv=require('to-csv');var ejs=require(_0xf7f7('0xa'));var fs=require('fs');var _=require(_0xf7f7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf7f7('0xc'));var deskjs=require(_0xf7f7('0xd'));var toCsv=require(_0xf7f7('0xe'));var querystring=require(_0xf7f7('0xf'));var Papa=require(_0xf7f7('0x10'));var Redis=require(_0xf7f7('0x11'));var authService=require(_0xf7f7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf7f7('0x13'));var hardwareService=require(_0xf7f7('0x14'));var logger=require(_0xf7f7('0x15'))('api');var utils=require(_0xf7f7('0x16'));var config=require(_0xf7f7('0x17'));var licenseUtil=require(_0xf7f7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f8ca3,_0x4174ee){_0x4174ee=_0x4174ee||0xcc;return function(_0x1ebce7){if(_0x1ebce7){return _0x4f8ca3[_0xf7f7('0x19')](_0x4174ee);}return _0x4f8ca3[_0xf7f7('0x1a')](_0x4174ee)[_0xf7f7('0x1b')]();};}function respondWithResult(_0x2bf712,_0x14d571){_0x14d571=_0x14d571||0xc8;return function(_0x24d75a){if(_0x24d75a){return _0x2bf712[_0xf7f7('0x1a')](_0x14d571)[_0xf7f7('0x1c')](_0x24d75a);}};}function respondWithFilteredResult(_0x389918,_0x200e0f){return function(_0xecc55d){if(_0xecc55d){var _0x1852e7=_0xecc55d['count'],_0x2c0f06=_0x200e0f[_0xf7f7('0x1d')],_0x4bc8d9=_0x200e0f[_0xf7f7('0x1d')]+_0x200e0f['limit'],_0x2f8a0e;if(_0x4bc8d9>=_0x1852e7){_0x4bc8d9=_0x1852e7;_0x2f8a0e=0xc8;}else{_0x2f8a0e=0xce;}_0x389918[_0xf7f7('0x1a')](_0x2f8a0e);return _0x389918[_0xf7f7('0x1e')](_0xf7f7('0x1f'),_0x2c0f06+'-'+_0x4bc8d9+'/'+_0x1852e7)[_0xf7f7('0x1c')](_0xecc55d);}return null;};}function patchUpdates(_0x3e6712){return function(_0x14caf7){try{jsonpatch['apply'](_0x14caf7,_0x3e6712,!![]);}catch(_0x288d8b){return BPromise['reject'](_0x288d8b);}return _0x14caf7[_0xf7f7('0x20')]();};}function saveUpdates(_0x4839e8,_0x5a2b49){return function(_0x912948){if(_0x912948){return _0x912948[_0xf7f7('0x21')](_0x4839e8)[_0xf7f7('0x22')](function(_0x584a7c){return _0x584a7c;});}return null;};}function removeEntity(_0x3ceec0,_0x389ef1){return function(_0x13ebe4){if(_0x13ebe4){return _0x13ebe4[_0xf7f7('0x23')]()['then'](function(){_0x3ceec0[_0xf7f7('0x1a')](0xcc)[_0xf7f7('0x1b')]();});}};}function handleEntityNotFound(_0x24a53e,_0x1493e0){return function(_0x388d4b){if(!_0x388d4b){_0x24a53e[_0xf7f7('0x19')](0x194);}return _0x388d4b;};}function handleError(_0x42b539,_0x398640){_0x398640=_0x398640||0x1f4;return function(_0x561013){logger[_0xf7f7('0x24')](_0x561013['stack']);if(_0x561013[_0xf7f7('0x25')]){delete _0x561013[_0xf7f7('0x25')];}_0x42b539['status'](_0x398640)[_0xf7f7('0x26')](_0x561013);};}exports[_0xf7f7('0x27')]=function(_0x336463,_0x262706){var _0x1f124c={},_0x5ccc0c={},_0x9166df={'count':0x0,'rows':[]};var _0x4eb256=_[_0xf7f7('0x28')](db[_0xf7f7('0x29')]['rawAttributes'],function(_0x5e6612){return{'name':_0x5e6612[_0xf7f7('0x2a')],'type':_0x5e6612[_0xf7f7('0x2b')][_0xf7f7('0x2c')]};});_0x5ccc0c[_0xf7f7('0x2d')]=_[_0xf7f7('0x28')](_0x4eb256,_0xf7f7('0x25'));_0x5ccc0c[_0xf7f7('0x2e')]=_[_0xf7f7('0x2f')](_0x336463['query']);_0x5ccc0c[_0xf7f7('0x30')]=_[_0xf7f7('0x31')](_0x5ccc0c[_0xf7f7('0x2d')],_0x5ccc0c['query']);_0x1f124c[_0xf7f7('0x32')]=_[_0xf7f7('0x31')](_0x5ccc0c['model'],qs[_0xf7f7('0x33')](_0x336463[_0xf7f7('0x2e')][_0xf7f7('0x33')]));_0x1f124c[_0xf7f7('0x32')]=_0x1f124c[_0xf7f7('0x32')][_0xf7f7('0x34')]?_0x1f124c['attributes']:_0x5ccc0c[_0xf7f7('0x2d')];if(!_0x336463[_0xf7f7('0x2e')][_0xf7f7('0x35')](_0xf7f7('0x36'))){_0x1f124c[_0xf7f7('0x37')]=qs[_0xf7f7('0x37')](_0x336463['query'][_0xf7f7('0x37')]);_0x1f124c[_0xf7f7('0x1d')]=qs[_0xf7f7('0x1d')](_0x336463[_0xf7f7('0x2e')][_0xf7f7('0x1d')]);}_0x1f124c['order']=qs[_0xf7f7('0x38')](_0x336463['query'][_0xf7f7('0x38')]);_0x1f124c[_0xf7f7('0x39')]=qs['filters'](_['pick'](_0x336463[_0xf7f7('0x2e')],_0x5ccc0c[_0xf7f7('0x30')]),_0x4eb256);if(_0x336463['query'][_0xf7f7('0x3a')]){_0x1f124c[_0xf7f7('0x39')]=_[_0xf7f7('0x3b')](_0x1f124c['where'],{'$or':_[_0xf7f7('0x28')](_0x4eb256,function(_0x36925f){if(_0x36925f[_0xf7f7('0x2b')]!==_0xf7f7('0x3c')){var _0x3f3e54={};_0x3f3e54[_0x36925f[_0xf7f7('0x25')]]={'$like':'%'+_0x336463[_0xf7f7('0x2e')][_0xf7f7('0x3a')]+'%'};return _0x3f3e54;}})});}_0x1f124c=_[_0xf7f7('0x3b')]({},_0x1f124c,_0x336463[_0xf7f7('0x3d')]);var _0x32c32b={'where':_0x1f124c[_0xf7f7('0x39')]};return db[_0xf7f7('0x29')][_0xf7f7('0x3e')](_0x32c32b)[_0xf7f7('0x22')](function(_0x13fcfa){_0x9166df[_0xf7f7('0x3e')]=_0x13fcfa;if(_0x336463['query'][_0xf7f7('0x3f')]){_0x1f124c[_0xf7f7('0x40')]=[{'all':!![]}];}return db[_0xf7f7('0x29')][_0xf7f7('0x41')](_0x1f124c);})[_0xf7f7('0x22')](function(_0x53d688){_0x9166df[_0xf7f7('0x42')]=_0x53d688;return _0x9166df;})['then'](respondWithFilteredResult(_0x262706,_0x1f124c))[_0xf7f7('0x43')](handleError(_0x262706,null));};exports[_0xf7f7('0x44')]=function(_0x16fab7,_0x2f1554){var _0x413551={'raw':!![],'where':{'id':_0x16fab7[_0xf7f7('0x45')]['id']}},_0x1dbb06={};_0x1dbb06[_0xf7f7('0x2d')]=_[_0xf7f7('0x2f')](db[_0xf7f7('0x29')]['rawAttributes']);_0x1dbb06[_0xf7f7('0x2e')]=_[_0xf7f7('0x2f')](_0x16fab7['query']);_0x1dbb06['filters']=_[_0xf7f7('0x31')](_0x1dbb06['model'],_0x1dbb06[_0xf7f7('0x2e')]);_0x413551[_0xf7f7('0x32')]=_[_0xf7f7('0x31')](_0x1dbb06[_0xf7f7('0x2d')],qs[_0xf7f7('0x33')](_0x16fab7['query']['fields']));_0x413551[_0xf7f7('0x32')]=_0x413551['attributes'][_0xf7f7('0x34')]?_0x413551[_0xf7f7('0x32')]:_0x1dbb06[_0xf7f7('0x2d')];if(_0x16fab7[_0xf7f7('0x2e')][_0xf7f7('0x3f')]){_0x413551['include']=[{'all':!![]}];}_0x413551=_[_0xf7f7('0x3b')]({},_0x413551,_0x16fab7[_0xf7f7('0x3d')]);return db[_0xf7f7('0x29')]['find'](_0x413551)[_0xf7f7('0x22')](handleEntityNotFound(_0x2f1554,null))['then'](respondWithResult(_0x2f1554,null))[_0xf7f7('0x43')](handleError(_0x2f1554,null));};exports['create']=function(_0x597e25,_0x34fe77){return db[_0xf7f7('0x29')][_0xf7f7('0x46')](_0x597e25[_0xf7f7('0x47')],{})['then'](respondWithResult(_0x34fe77,0xc9))[_0xf7f7('0x43')](handleError(_0x34fe77,null));};exports['update']=function(_0x7c84b,_0x5970df){if(_0x7c84b['body']['id']){delete _0x7c84b[_0xf7f7('0x47')]['id'];}return db[_0xf7f7('0x29')][_0xf7f7('0x48')]({'where':{'id':_0x7c84b[_0xf7f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x5970df,null))[_0xf7f7('0x22')](saveUpdates(_0x7c84b[_0xf7f7('0x47')],null))[_0xf7f7('0x22')](respondWithResult(_0x5970df,null))[_0xf7f7('0x43')](handleError(_0x5970df,null));};exports[_0xf7f7('0x23')]=function(_0x31a402,_0x471298){return db[_0xf7f7('0x29')]['find']({'where':{'id':_0x31a402[_0xf7f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x471298,null))[_0xf7f7('0x22')](removeEntity(_0x471298,null))[_0xf7f7('0x43')](handleError(_0x471298,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 75c54ab..d5e08ab 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 _0x24ca=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x5d995d,_0x12fed7){var _0xa0ebbe=function(_0x39a231){while(--_0x39a231){_0x5d995d['push'](_0x5d995d['shift']());}};_0xa0ebbe(++_0x12fed7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x24ca[_0x462fe4];return _0x82b23a;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['path','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x40ff4e,_0x50a4a3){var _0x2ea887=function(_0x3a177b){while(--_0x3a177b){_0x40ff4e['push'](_0x40ff4e['shift']());}};_0x2ea887(++_0x50a4a3);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5b0afe,_0x3edd78){_0x5b0afe=_0x5b0afe-0x0;var _0x27c4d2=_0xdc97[_0x5b0afe];return _0x27c4d2;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c417061..739fb13 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 _0x3290=['error','code','MailServerOut,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x99f838,_0xe376e2){var _0x432cd7=function(_0x2cd5dc){while(--_0x2cd5dc){_0x99f838['push'](_0x99f838['shift']());}};_0x432cd7(++_0xe376e2);}(_0x3290,0x130));var _0x0329=function(_0x25aad1,_0x4dcf28){_0x25aad1=_0x25aad1-0x0;var _0x3e79f1=_0x3290[_0x25aad1];return _0x3e79f1;};'use strict';var _=require(_0x0329('0x0'));var util=require(_0x0329('0x1'));var moment=require('moment');var BPromise=require(_0x0329('0x2'));var rs=require(_0x0329('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0329('0x4'))['db'];var utils=require(_0x0329('0x5'));var logger=require(_0x0329('0x6'))(_0x0329('0x7'));var config=require(_0x0329('0x8'));var jayson=require(_0x0329('0x9'));var client=jayson['client'][_0x0329('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x532082,_0x5b7e8e,_0x48494b){return new BPromise(function(_0x265875,_0x50df82){return client[_0x0329('0xb')](_0x532082,_0x48494b)[_0x0329('0xc')](function(_0x43d923){logger[_0x0329('0xd')]('MailServerOut,\x20%s,\x20%s',_0x5b7e8e,'request\x20sent');logger[_0x0329('0xe')](_0x0329('0xf'),_0x5b7e8e,_0x0329('0x10'),JSON[_0x0329('0x11')](_0x43d923));if(_0x43d923[_0x0329('0x12')]){if(_0x43d923['error'][_0x0329('0x13')]===0x1f4){logger['error'](_0x0329('0x14'),_0x5b7e8e,_0x43d923[_0x0329('0x12')][_0x0329('0x15')]);return _0x50df82(_0x43d923['error'][_0x0329('0x15')]);}logger['error'](_0x0329('0x14'),_0x5b7e8e,_0x43d923[_0x0329('0x12')][_0x0329('0x15')]);return _0x265875(_0x43d923[_0x0329('0x12')][_0x0329('0x15')]);}else{logger['info'](_0x0329('0x14'),_0x5b7e8e,'request\x20sent');_0x265875(_0x43d923[_0x0329('0x16')][_0x0329('0x15')]);}})['catch'](function(_0x53d156){logger[_0x0329('0x12')](_0x0329('0x14'),_0x5b7e8e,_0x53d156);_0x50df82(_0x53d156);});});} \ No newline at end of file +var _0x8f9b=['request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5c7c2f,_0x58786b){var _0x2b4ad0=function(_0x5c5e69){while(--_0x5c5e69){_0x5c7c2f['push'](_0x5c7c2f['shift']());}};_0x2b4ad0(++_0x58786b);}(_0x8f9b,0x89));var _0xb8f9=function(_0x507d30,_0xad22e2){_0x507d30=_0x507d30-0x0;var _0x483d4f=_0x8f9b[_0x507d30];return _0x483d4f;};'use strict';var _=require(_0xb8f9('0x0'));var util=require(_0xb8f9('0x1'));var moment=require('moment');var BPromise=require(_0xb8f9('0x2'));var rs=require(_0xb8f9('0x3'));var fs=require('fs');var Redis=require(_0xb8f9('0x4'));var db=require(_0xb8f9('0x5'))['db'];var utils=require(_0xb8f9('0x6'));var logger=require('../../config/logger')(_0xb8f9('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8f9('0x8'));var client=jayson[_0xb8f9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xeb2e4c,_0x30d569,_0x3eeb67){return new BPromise(function(_0x4c3bf2,_0x3a6d09){return client[_0xb8f9('0xa')](_0xeb2e4c,_0x3eeb67)[_0xb8f9('0xb')](function(_0x387d75){logger[_0xb8f9('0xc')](_0xb8f9('0xd'),_0x30d569,_0xb8f9('0xe'));logger['debug'](_0xb8f9('0xf'),_0x30d569,'request\x20sent',JSON[_0xb8f9('0x10')](_0x387d75));if(_0x387d75[_0xb8f9('0x11')]){if(_0x387d75[_0xb8f9('0x11')][_0xb8f9('0x12')]===0x1f4){logger[_0xb8f9('0x11')]('MailServerOut,\x20%s,\x20%s',_0x30d569,_0x387d75[_0xb8f9('0x11')][_0xb8f9('0x13')]);return _0x3a6d09(_0x387d75[_0xb8f9('0x11')][_0xb8f9('0x13')]);}logger[_0xb8f9('0x11')](_0xb8f9('0xd'),_0x30d569,_0x387d75[_0xb8f9('0x11')][_0xb8f9('0x13')]);return _0x4c3bf2(_0x387d75[_0xb8f9('0x11')]['message']);}else{logger[_0xb8f9('0xc')](_0xb8f9('0xd'),_0x30d569,_0xb8f9('0xe'));_0x4c3bf2(_0x387d75[_0xb8f9('0x14')][_0xb8f9('0x13')]);}})['catch'](function(_0x3261da){logger[_0xb8f9('0x11')](_0xb8f9('0xd'),_0x30d569,_0x3261da);_0x3a6d09(_0x3261da);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e716a71..c8d6cd4 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 _0x61e7=['/:id','show','post','create','put','update','multer','util','path','connect-timeout','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','isAuthenticated'];(function(_0x1e8756,_0x431463){var _0x41a0f4=function(_0x1a82a3){while(--_0x1a82a3){_0x1e8756['push'](_0x1e8756['shift']());}};_0x41a0f4(++_0x431463);}(_0x61e7,0x66));var _0x761e=function(_0x3fa09e,_0x240a12){_0x3fa09e=_0x3fa09e-0x0;var _0xc1d9b=_0x61e7[_0x3fa09e];return _0xc1d9b;};'use strict';var multer=require(_0x761e('0x0'));var util=require(_0x761e('0x1'));var path=require(_0x761e('0x2'));var timeout=require(_0x761e('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x761e('0x4'));var config=require('../../config/environment');var controller=require(_0x761e('0x5'));router[_0x761e('0x6')]('/',auth['isAuthenticated'](),controller[_0x761e('0x7')]);router[_0x761e('0x6')](_0x761e('0x8'),auth[_0x761e('0x9')](),controller['describe']);router[_0x761e('0x6')](_0x761e('0xa'),auth['isAuthenticated'](),controller[_0x761e('0xb')]);router[_0x761e('0xc')]('/',auth[_0x761e('0x9')](),controller[_0x761e('0xd')]);router[_0x761e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x761e('0xf')]);router['delete'](_0x761e('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa6f2=['describe','/:id','show','post','put','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x1357e0,_0x274a2c){var _0x34182f=function(_0x8897e1){while(--_0x8897e1){_0x1357e0['push'](_0x1357e0['shift']());}};_0x34182f(++_0x274a2c);}(_0xa6f2,0x115));var _0x2a6f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa6f2[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x2a6f('0x0'));var util=require('util');var path=require(_0x2a6f('0x1'));var timeout=require(_0x2a6f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2a6f('0x3'));var interaction=require(_0x2a6f('0x4'));var config=require(_0x2a6f('0x5'));var controller=require(_0x2a6f('0x6'));router[_0x2a6f('0x7')]('/',auth[_0x2a6f('0x8')](),controller[_0x2a6f('0x9')]);router[_0x2a6f('0x7')](_0x2a6f('0xa'),auth[_0x2a6f('0x8')](),controller[_0x2a6f('0xb')]);router[_0x2a6f('0x7')](_0x2a6f('0xc'),auth[_0x2a6f('0x8')](),controller[_0x2a6f('0xd')]);router[_0x2a6f('0xe')]('/',auth[_0x2a6f('0x8')](),controller['create']);router[_0x2a6f('0xf')]('/:id',auth[_0x2a6f('0x8')](),controller['update']);router[_0x2a6f('0x10')](_0x2a6f('0xc'),auth[_0x2a6f('0x8')](),controller['destroy']);module[_0x2a6f('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9a03d8a..82ec2ea 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 _0xbe2c=['sequelize','exports','name'];(function(_0x4a1446,_0x170e92){var _0xc1876e=function(_0x53c9de){while(--_0x53c9de){_0x4a1446['push'](_0x4a1446['shift']());}};_0xc1876e(++_0x170e92);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x434243,_0x6038bf){_0x434243=_0x434243-0x0;var _0x156e7e=_0xbe2c[_0x434243];return _0x156e7e;};'use strict';var Sequelize=require(_0xcbe2('0x0'));module[_0xcbe2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcbe2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4137=['sequelize','exports','STRING','name'];(function(_0x7cae26,_0x198217){var _0xb0010f=function(_0x5a5071){while(--_0x5a5071){_0x7cae26['push'](_0x7cae26['shift']());}};_0xb0010f(++_0x198217);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7413('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 474f8ce..2692f48 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 _0xedb9=['rawAttributes','type','model','query','intersection','fields','attributes','limit','order','sort','pick','filters','filter','where','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','catch','keys','length','merge','find','create','body','params','describe','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xedb9,0x1c8));var _0x9edb=function(_0x430c02,_0x2c2f58){_0x430c02=_0x430c02-0x0;var _0xb6cba5=_0xedb9[_0x430c02];return _0xb6cba5;};'use strict';var pdf=require(_0x9edb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9edb('0x1'));var zipdir=require(_0x9edb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9edb('0x3'));var moment=require(_0x9edb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9edb('0x5'));var util=require(_0x9edb('0x6'));var path=require('path');var sox=require(_0x9edb('0x7'));var csv=require(_0x9edb('0x8'));var ejs=require(_0x9edb('0x9'));var fs=require('fs');var _=require(_0x9edb('0xa'));var squel=require(_0x9edb('0xb'));var crypto=require(_0x9edb('0xc'));var jsforce=require(_0x9edb('0xd'));var deskjs=require(_0x9edb('0xe'));var toCsv=require(_0x9edb('0x8'));var querystring=require(_0x9edb('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9edb('0x11'));var hardwareService=require(_0x9edb('0x12'));var logger=require(_0x9edb('0x13'))(_0x9edb('0x14'));var utils=require(_0x9edb('0x15'));var config=require(_0x9edb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9edb('0x17'))['db'];function respondWithStatusCode(_0x3baa25,_0x85243e){_0x85243e=_0x85243e||0xcc;return function(_0x126423){if(_0x126423){return _0x3baa25[_0x9edb('0x18')](_0x85243e);}return _0x3baa25[_0x9edb('0x19')](_0x85243e)[_0x9edb('0x1a')]();};}function respondWithResult(_0x18304c,_0x19c4b3){_0x19c4b3=_0x19c4b3||0xc8;return function(_0x1cb279){if(_0x1cb279){return _0x18304c['status'](_0x19c4b3)[_0x9edb('0x1b')](_0x1cb279);}};}function respondWithFilteredResult(_0x333746,_0x45650d){return function(_0x344ba5){if(_0x344ba5){var _0x3f1be4=_0x344ba5[_0x9edb('0x1c')],_0x246a9b=_0x45650d[_0x9edb('0x1d')],_0xd775f8=_0x45650d['offset']+_0x45650d['limit'],_0x5a812a;if(_0xd775f8>=_0x3f1be4){_0xd775f8=_0x3f1be4;_0x5a812a=0xc8;}else{_0x5a812a=0xce;}_0x333746[_0x9edb('0x19')](_0x5a812a);return _0x333746[_0x9edb('0x1e')]('Content-Range',_0x246a9b+'-'+_0xd775f8+'/'+_0x3f1be4)['json'](_0x344ba5);}return null;};}function patchUpdates(_0x127987){return function(_0x3959d0){try{jsonpatch['apply'](_0x3959d0,_0x127987,!![]);}catch(_0x38a64f){return BPromise['reject'](_0x38a64f);}return _0x3959d0[_0x9edb('0x1f')]();};}function saveUpdates(_0x23a5a6,_0x360285){return function(_0x5128ba){if(_0x5128ba){return _0x5128ba[_0x9edb('0x20')](_0x23a5a6)[_0x9edb('0x21')](function(_0xfe65fb){return _0xfe65fb;});}return null;};}function removeEntity(_0x2a69ca,_0x2e6cf4){return function(_0xeb3492){if(_0xeb3492){return _0xeb3492[_0x9edb('0x22')]()[_0x9edb('0x21')](function(){_0x2a69ca[_0x9edb('0x19')](0xcc)[_0x9edb('0x1a')]();});}};}function handleEntityNotFound(_0x4c0464,_0x5a8207){return function(_0x24c8d0){if(!_0x24c8d0){_0x4c0464[_0x9edb('0x18')](0x194);}return _0x24c8d0;};}function handleError(_0x150c16,_0x5ec3f6){_0x5ec3f6=_0x5ec3f6||0x1f4;return function(_0x51e57d){logger[_0x9edb('0x23')](_0x51e57d[_0x9edb('0x24')]);if(_0x51e57d[_0x9edb('0x25')]){delete _0x51e57d[_0x9edb('0x25')];}_0x150c16[_0x9edb('0x19')](_0x5ec3f6)[_0x9edb('0x26')](_0x51e57d);};}exports[_0x9edb('0x27')]=function(_0x5c4531,_0x29735c){var _0x3bc8e4={},_0x4a5e72={},_0xd41d23={'count':0x0,'rows':[]};var _0x36ebad=_[_0x9edb('0x28')](db['MailSubstatus'][_0x9edb('0x29')],function(_0x29d083){return{'name':_0x29d083['fieldName'],'type':_0x29d083[_0x9edb('0x2a')]['key']};});_0x4a5e72[_0x9edb('0x2b')]=_['map'](_0x36ebad,'name');_0x4a5e72[_0x9edb('0x2c')]=_['keys'](_0x5c4531[_0x9edb('0x2c')]);_0x4a5e72['filters']=_['intersection'](_0x4a5e72[_0x9edb('0x2b')],_0x4a5e72[_0x9edb('0x2c')]);_0x3bc8e4['attributes']=_[_0x9edb('0x2d')](_0x4a5e72[_0x9edb('0x2b')],qs['fields'](_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x2e')]));_0x3bc8e4[_0x9edb('0x2f')]=_0x3bc8e4[_0x9edb('0x2f')]['length']?_0x3bc8e4[_0x9edb('0x2f')]:_0x4a5e72[_0x9edb('0x2b')];if(!_0x5c4531[_0x9edb('0x2c')]['hasOwnProperty']('nolimit')){_0x3bc8e4[_0x9edb('0x30')]=qs[_0x9edb('0x30')](_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x30')]);_0x3bc8e4[_0x9edb('0x1d')]=qs[_0x9edb('0x1d')](_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x1d')]);}_0x3bc8e4[_0x9edb('0x31')]=qs['sort'](_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x32')]);_0x3bc8e4['where']=qs['filters'](_[_0x9edb('0x33')](_0x5c4531[_0x9edb('0x2c')],_0x4a5e72[_0x9edb('0x34')]),_0x36ebad);if(_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x35')]){_0x3bc8e4[_0x9edb('0x36')]=_['merge'](_0x3bc8e4[_0x9edb('0x36')],{'$or':_['map'](_0x36ebad,function(_0x4aa962){if(_0x4aa962[_0x9edb('0x2a')]!==_0x9edb('0x37')){var _0x33acac={};_0x33acac[_0x4aa962[_0x9edb('0x25')]]={'$like':'%'+_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x35')]+'%'};return _0x33acac;}})});}_0x3bc8e4=_['merge']({},_0x3bc8e4,_0x5c4531[_0x9edb('0x38')]);var _0x58973b={'where':_0x3bc8e4[_0x9edb('0x36')]};return db[_0x9edb('0x39')]['count'](_0x58973b)['then'](function(_0x4fde7f){_0xd41d23[_0x9edb('0x1c')]=_0x4fde7f;if(_0x5c4531[_0x9edb('0x2c')][_0x9edb('0x3a')]){_0x3bc8e4[_0x9edb('0x3b')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9edb('0x3c')](_0x3bc8e4);})['then'](function(_0x257c8d){_0xd41d23[_0x9edb('0x3d')]=_0x257c8d;return _0xd41d23;})[_0x9edb('0x21')](respondWithFilteredResult(_0x29735c,_0x3bc8e4))[_0x9edb('0x3e')](handleError(_0x29735c,null));};exports['show']=function(_0x54f1a2,_0x40ac4f){var _0x4ac431={'raw':!![],'where':{'id':_0x54f1a2['params']['id']}},_0x53f69d={};_0x53f69d['model']=_[_0x9edb('0x3f')](db[_0x9edb('0x39')]['rawAttributes']);_0x53f69d['query']=_['keys'](_0x54f1a2[_0x9edb('0x2c')]);_0x53f69d['filters']=_[_0x9edb('0x2d')](_0x53f69d[_0x9edb('0x2b')],_0x53f69d[_0x9edb('0x2c')]);_0x4ac431[_0x9edb('0x2f')]=_[_0x9edb('0x2d')](_0x53f69d[_0x9edb('0x2b')],qs[_0x9edb('0x2e')](_0x54f1a2[_0x9edb('0x2c')]['fields']));_0x4ac431['attributes']=_0x4ac431[_0x9edb('0x2f')][_0x9edb('0x40')]?_0x4ac431[_0x9edb('0x2f')]:_0x53f69d[_0x9edb('0x2b')];if(_0x54f1a2[_0x9edb('0x2c')][_0x9edb('0x3a')]){_0x4ac431[_0x9edb('0x3b')]=[{'all':!![]}];}_0x4ac431=_[_0x9edb('0x41')]({},_0x4ac431,_0x54f1a2[_0x9edb('0x38')]);return db[_0x9edb('0x39')][_0x9edb('0x42')](_0x4ac431)[_0x9edb('0x21')](handleEntityNotFound(_0x40ac4f,null))[_0x9edb('0x21')](respondWithResult(_0x40ac4f,null))['catch'](handleError(_0x40ac4f,null));};exports[_0x9edb('0x43')]=function(_0x446e83,_0x3426e5){return db[_0x9edb('0x39')][_0x9edb('0x43')](_0x446e83['body'],{})[_0x9edb('0x21')](respondWithResult(_0x3426e5,0xc9))[_0x9edb('0x3e')](handleError(_0x3426e5,null));};exports['update']=function(_0xb605b8,_0x4f943d){if(_0xb605b8[_0x9edb('0x44')]['id']){delete _0xb605b8[_0x9edb('0x44')]['id'];}return db[_0x9edb('0x39')][_0x9edb('0x42')]({'where':{'id':_0xb605b8[_0x9edb('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f943d,null))[_0x9edb('0x21')](saveUpdates(_0xb605b8[_0x9edb('0x44')],null))[_0x9edb('0x21')](respondWithResult(_0x4f943d,null))[_0x9edb('0x3e')](handleError(_0x4f943d,null));};exports[_0x9edb('0x22')]=function(_0x1c2ea1,_0x43fdb3){return db['MailSubstatus'][_0x9edb('0x42')]({'where':{'id':_0x1c2ea1[_0x9edb('0x45')]['id']}})[_0x9edb('0x21')](handleEntityNotFound(_0x43fdb3,null))[_0x9edb('0x21')](removeEntity(_0x43fdb3,null))[_0x9edb('0x3e')](handleError(_0x43fdb3,null));};exports['describe']=function(_0x1a2e6f,_0x7fc939){return db[_0x9edb('0x39')][_0x9edb('0x46')]()[_0x9edb('0x21')](respondWithResult(_0x7fc939,null))[_0x9edb('0x3e')](handleError(_0x7fc939,null));}; \ No newline at end of file +var _0xb1d9=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','limit','Content-Range','json','apply','save','update','destroy','sendStatus','error','stack','name','index','MailSubstatus','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','then','catch','show','params','includeAll','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x547985,_0x17ba9e){var _0x4645b5=function(_0x2beb20){while(--_0x2beb20){_0x547985['push'](_0x547985['shift']());}};_0x4645b5(++_0x17ba9e);}(_0xb1d9,0x87));var _0x9b1d=function(_0x1c4fa8,_0x10c2cd){_0x1c4fa8=_0x1c4fa8-0x0;var _0x5502cc=_0xb1d9[_0x1c4fa8];return _0x5502cc;};'use strict';var pdf=require(_0x9b1d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9b1d('0x1'));var zipdir=require(_0x9b1d('0x2'));var jsonpatch=require(_0x9b1d('0x3'));var rp=require(_0x9b1d('0x4'));var moment=require(_0x9b1d('0x5'));var BPromise=require(_0x9b1d('0x6'));var Mustache=require(_0x9b1d('0x7'));var util=require(_0x9b1d('0x8'));var path=require(_0x9b1d('0x9'));var sox=require(_0x9b1d('0xa'));var csv=require(_0x9b1d('0xb'));var ejs=require(_0x9b1d('0xc'));var fs=require('fs');var _=require(_0x9b1d('0xd'));var squel=require(_0x9b1d('0xe'));var crypto=require(_0x9b1d('0xf'));var jsforce=require(_0x9b1d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9b1d('0xb'));var querystring=require(_0x9b1d('0x11'));var Papa=require(_0x9b1d('0x12'));var Redis=require(_0x9b1d('0x13'));var authService=require(_0x9b1d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9b1d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b1d('0x16'))(_0x9b1d('0x17'));var utils=require(_0x9b1d('0x18'));var config=require(_0x9b1d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b1d('0x1a'))['db'];function respondWithStatusCode(_0x2ad738,_0x2e63f9){_0x2e63f9=_0x2e63f9||0xcc;return function(_0x5b3f56){if(_0x5b3f56){return _0x2ad738['sendStatus'](_0x2e63f9);}return _0x2ad738[_0x9b1d('0x1b')](_0x2e63f9)[_0x9b1d('0x1c')]();};}function respondWithResult(_0x58711a,_0x5a2d7a){_0x5a2d7a=_0x5a2d7a||0xc8;return function(_0x48ae6d){if(_0x48ae6d){return _0x58711a[_0x9b1d('0x1b')](_0x5a2d7a)['json'](_0x48ae6d);}};}function respondWithFilteredResult(_0x1949d3,_0x582033){return function(_0x4cc6ec){if(_0x4cc6ec){var _0x564964=_0x4cc6ec[_0x9b1d('0x1d')],_0x5542ac=_0x582033['offset'],_0x144876=_0x582033['offset']+_0x582033[_0x9b1d('0x1e')],_0x5398f1;if(_0x144876>=_0x564964){_0x144876=_0x564964;_0x5398f1=0xc8;}else{_0x5398f1=0xce;}_0x1949d3[_0x9b1d('0x1b')](_0x5398f1);return _0x1949d3['set'](_0x9b1d('0x1f'),_0x5542ac+'-'+_0x144876+'/'+_0x564964)[_0x9b1d('0x20')](_0x4cc6ec);}return null;};}function patchUpdates(_0x16fe4d){return function(_0x71389f){try{jsonpatch[_0x9b1d('0x21')](_0x71389f,_0x16fe4d,!![]);}catch(_0x5539d1){return BPromise['reject'](_0x5539d1);}return _0x71389f[_0x9b1d('0x22')]();};}function saveUpdates(_0x5cc620,_0x159a07){return function(_0x54d1d4){if(_0x54d1d4){return _0x54d1d4[_0x9b1d('0x23')](_0x5cc620)['then'](function(_0x239c04){return _0x239c04;});}return null;};}function removeEntity(_0x50d314,_0x452538){return function(_0x1189ae){if(_0x1189ae){return _0x1189ae[_0x9b1d('0x24')]()['then'](function(){_0x50d314['status'](0xcc)[_0x9b1d('0x1c')]();});}};}function handleEntityNotFound(_0x22fc53,_0x3b6acd){return function(_0x45f834){if(!_0x45f834){_0x22fc53[_0x9b1d('0x25')](0x194);}return _0x45f834;};}function handleError(_0x2d6b72,_0x206ae8){_0x206ae8=_0x206ae8||0x1f4;return function(_0x55d74e){logger[_0x9b1d('0x26')](_0x55d74e[_0x9b1d('0x27')]);if(_0x55d74e[_0x9b1d('0x28')]){delete _0x55d74e['name'];}_0x2d6b72[_0x9b1d('0x1b')](_0x206ae8)['send'](_0x55d74e);};}exports[_0x9b1d('0x29')]=function(_0xbc359c,_0x56df6d){var _0x3fa50a={},_0x113d3e={},_0x381cb7={'count':0x0,'rows':[]};var _0x4e9539=_['map'](db[_0x9b1d('0x2a')]['rawAttributes'],function(_0x1528b8){return{'name':_0x1528b8[_0x9b1d('0x2b')],'type':_0x1528b8[_0x9b1d('0x2c')][_0x9b1d('0x2d')]};});_0x113d3e[_0x9b1d('0x2e')]=_[_0x9b1d('0x2f')](_0x4e9539,_0x9b1d('0x28'));_0x113d3e[_0x9b1d('0x30')]=_[_0x9b1d('0x31')](_0xbc359c[_0x9b1d('0x30')]);_0x113d3e[_0x9b1d('0x32')]=_[_0x9b1d('0x33')](_0x113d3e[_0x9b1d('0x2e')],_0x113d3e['query']);_0x3fa50a[_0x9b1d('0x34')]=_[_0x9b1d('0x33')](_0x113d3e[_0x9b1d('0x2e')],qs[_0x9b1d('0x35')](_0xbc359c['query'][_0x9b1d('0x35')]));_0x3fa50a['attributes']=_0x3fa50a[_0x9b1d('0x34')][_0x9b1d('0x36')]?_0x3fa50a[_0x9b1d('0x34')]:_0x113d3e[_0x9b1d('0x2e')];if(!_0xbc359c[_0x9b1d('0x30')][_0x9b1d('0x37')](_0x9b1d('0x38'))){_0x3fa50a[_0x9b1d('0x1e')]=qs['limit'](_0xbc359c[_0x9b1d('0x30')][_0x9b1d('0x1e')]);_0x3fa50a[_0x9b1d('0x39')]=qs[_0x9b1d('0x39')](_0xbc359c[_0x9b1d('0x30')][_0x9b1d('0x39')]);}_0x3fa50a[_0x9b1d('0x3a')]=qs[_0x9b1d('0x3b')](_0xbc359c[_0x9b1d('0x30')][_0x9b1d('0x3b')]);_0x3fa50a[_0x9b1d('0x3c')]=qs[_0x9b1d('0x32')](_['pick'](_0xbc359c[_0x9b1d('0x30')],_0x113d3e[_0x9b1d('0x32')]),_0x4e9539);if(_0xbc359c[_0x9b1d('0x30')][_0x9b1d('0x3d')]){_0x3fa50a['where']=_[_0x9b1d('0x3e')](_0x3fa50a[_0x9b1d('0x3c')],{'$or':_['map'](_0x4e9539,function(_0x511f7a){if(_0x511f7a[_0x9b1d('0x2c')]!==_0x9b1d('0x3f')){var _0x45339e={};_0x45339e[_0x511f7a[_0x9b1d('0x28')]]={'$like':'%'+_0xbc359c[_0x9b1d('0x30')][_0x9b1d('0x3d')]+'%'};return _0x45339e;}})});}_0x3fa50a=_[_0x9b1d('0x3e')]({},_0x3fa50a,_0xbc359c['options']);var _0x3efca9={'where':_0x3fa50a[_0x9b1d('0x3c')]};return db[_0x9b1d('0x2a')]['count'](_0x3efca9)['then'](function(_0x2a6c3e){_0x381cb7[_0x9b1d('0x1d')]=_0x2a6c3e;if(_0xbc359c['query']['includeAll']){_0x3fa50a['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x3fa50a);})[_0x9b1d('0x40')](function(_0x5edba7){_0x381cb7['rows']=_0x5edba7;return _0x381cb7;})[_0x9b1d('0x40')](respondWithFilteredResult(_0x56df6d,_0x3fa50a))[_0x9b1d('0x41')](handleError(_0x56df6d,null));};exports[_0x9b1d('0x42')]=function(_0x2bf6ef,_0x2434fb){var _0x553ab8={'raw':!![],'where':{'id':_0x2bf6ef[_0x9b1d('0x43')]['id']}},_0x5b660c={};_0x5b660c['model']=_['keys'](db[_0x9b1d('0x2a')]['rawAttributes']);_0x5b660c[_0x9b1d('0x30')]=_['keys'](_0x2bf6ef['query']);_0x5b660c['filters']=_[_0x9b1d('0x33')](_0x5b660c[_0x9b1d('0x2e')],_0x5b660c[_0x9b1d('0x30')]);_0x553ab8[_0x9b1d('0x34')]=_[_0x9b1d('0x33')](_0x5b660c[_0x9b1d('0x2e')],qs[_0x9b1d('0x35')](_0x2bf6ef[_0x9b1d('0x30')][_0x9b1d('0x35')]));_0x553ab8[_0x9b1d('0x34')]=_0x553ab8[_0x9b1d('0x34')]['length']?_0x553ab8[_0x9b1d('0x34')]:_0x5b660c[_0x9b1d('0x2e')];if(_0x2bf6ef[_0x9b1d('0x30')][_0x9b1d('0x44')]){_0x553ab8['include']=[{'all':!![]}];}_0x553ab8=_[_0x9b1d('0x3e')]({},_0x553ab8,_0x2bf6ef[_0x9b1d('0x45')]);return db[_0x9b1d('0x2a')][_0x9b1d('0x46')](_0x553ab8)[_0x9b1d('0x40')](handleEntityNotFound(_0x2434fb,null))[_0x9b1d('0x40')](respondWithResult(_0x2434fb,null))[_0x9b1d('0x41')](handleError(_0x2434fb,null));};exports[_0x9b1d('0x47')]=function(_0x43ab32,_0x1a3978){return db[_0x9b1d('0x2a')][_0x9b1d('0x47')](_0x43ab32['body'],{})[_0x9b1d('0x40')](respondWithResult(_0x1a3978,0xc9))[_0x9b1d('0x41')](handleError(_0x1a3978,null));};exports[_0x9b1d('0x23')]=function(_0x17a453,_0x26d13b){if(_0x17a453[_0x9b1d('0x48')]['id']){delete _0x17a453[_0x9b1d('0x48')]['id'];}return db[_0x9b1d('0x2a')]['find']({'where':{'id':_0x17a453[_0x9b1d('0x43')]['id']}})['then'](handleEntityNotFound(_0x26d13b,null))[_0x9b1d('0x40')](saveUpdates(_0x17a453['body'],null))[_0x9b1d('0x40')](respondWithResult(_0x26d13b,null))[_0x9b1d('0x41')](handleError(_0x26d13b,null));};exports[_0x9b1d('0x24')]=function(_0x41dac5,_0x4e80e0){return db[_0x9b1d('0x2a')][_0x9b1d('0x46')]({'where':{'id':_0x41dac5[_0x9b1d('0x43')]['id']}})[_0x9b1d('0x40')](handleEntityNotFound(_0x4e80e0,null))[_0x9b1d('0x40')](removeEntity(_0x4e80e0,null))[_0x9b1d('0x41')](handleError(_0x4e80e0,null));};exports['describe']=function(_0x1cf2ac,_0x13fe65){return db[_0x9b1d('0x2a')][_0x9b1d('0x49')]()[_0x9b1d('0x40')](respondWithResult(_0x13fe65,null))[_0x9b1d('0x41')](handleError(_0x13fe65,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bec6a7a..10f198b 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 _0x253d=['exports','define','MailSubstatus','lodash','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x253d,0x1b3));var _0xd253=function(_0x3367b0,_0x242a35){_0x3367b0=_0x3367b0-0x0;var _0x36cc60=_0x253d[_0x3367b0];return _0x36cc60;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd253('0x1'));var rp=require(_0xd253('0x2'));var fs=require('fs');var path=require(_0xd253('0x3'));var rimraf=require(_0xd253('0x4'));var config=require(_0xd253('0x5'));var attributes=require('./mailSubstatus.attributes');module[_0xd253('0x6')]=function(_0x42d36c,_0x3dca3d){return _0x42d36c[_0xd253('0x7')](_0xd253('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1619=['mail_substatuses','../../config/logger','moment','bluebird','request-promise','rimraf','./mailSubstatus.attributes','define'];(function(_0x2f55cc,_0x45ae97){var _0x2873aa=function(_0x262bc2){while(--_0x262bc2){_0x2f55cc['push'](_0x2f55cc['shift']());}};_0x2873aa(++_0x45ae97);}(_0x1619,0x189));var _0x9161=function(_0x4f3863,_0x25a7f0){_0x4f3863=_0x4f3863-0x0;var _0x266407=_0x1619[_0x4f3863];return _0x266407;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9161('0x0'))('api');var moment=require(_0x9161('0x1'));var BPromise=require(_0x9161('0x2'));var rp=require(_0x9161('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9161('0x4'));var config=require('../../config/environment');var attributes=require(_0x9161('0x5'));module['exports']=function(_0x50ed78,_0x1b006d){return _0x50ed78[_0x9161('0x6')]('MailSubstatus',attributes,{'tableName':_0x9161('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4a325e7..9df242f 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 _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2a529f,_0x894f17){_0x2a529f=_0x2a529f-0x0;var _0x37e820=_0xee5b[_0x2a529f];return _0x37e820;};'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')]('MailSubstatus,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file +var _0x4522=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x116fb4,_0x415018){var _0x4b209e=function(_0x3081eb){while(--_0x3081eb){_0x116fb4['push'](_0x116fb4['shift']());}};_0x4b209e(++_0x415018);}(_0x4522,0x1a0));var _0x2452=function(_0x5985d6,_0x2ea394){_0x5985d6=_0x5985d6-0x0;var _0x566493=_0x4522[_0x5985d6];return _0x566493;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6fa5284..bcdf61c 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 _0x9f31=['./mailTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1eecf2,_0x5eddc2){var _0x3e3d86=function(_0x1d839b){while(--_0x1d839b){_0x1eecf2['push'](_0x1eecf2['shift']());}};_0x3e3d86(++_0x5eddc2);}(_0x9f31,0x19b));var _0x19f3=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x9f31[_0x29d623];return _0x242e59;};'use strict';var multer=require(_0x19f3('0x0'));var util=require(_0x19f3('0x1'));var path=require(_0x19f3('0x2'));var timeout=require(_0x19f3('0x3'));var express=require(_0x19f3('0x4'));var router=express[_0x19f3('0x5')]();var auth=require(_0x19f3('0x6'));var interaction=require(_0x19f3('0x7'));var config=require(_0x19f3('0x8'));var controller=require(_0x19f3('0x9'));router[_0x19f3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x19f3('0xa')](_0x19f3('0xb'),auth['isAuthenticated'](),controller[_0x19f3('0xc')]);router[_0x19f3('0xa')](_0x19f3('0xd'),auth[_0x19f3('0xe')](),controller['show']);router[_0x19f3('0xf')]('/',auth[_0x19f3('0xe')](),controller[_0x19f3('0x10')]);router[_0x19f3('0x11')](_0x19f3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x19f3('0x12')]('/:id',auth[_0x19f3('0xe')](),controller[_0x19f3('0x13')]);module[_0x19f3('0x14')]=router; \ No newline at end of file +var _0x79ba=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x79ba,0xf9));var _0xa79b=function(_0x5bc18d,_0x4a1372){_0x5bc18d=_0x5bc18d-0x0;var _0x32a08e=_0x79ba[_0x5bc18d];return _0x32a08e;};'use strict';var multer=require(_0xa79b('0x0'));var util=require('util');var path=require(_0xa79b('0x1'));var timeout=require(_0xa79b('0x2'));var express=require(_0xa79b('0x3'));var router=express[_0xa79b('0x4')]();var auth=require(_0xa79b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xa79b('0x6')]('/',auth[_0xa79b('0x7')](),controller[_0xa79b('0x8')]);router['get'](_0xa79b('0x9'),auth[_0xa79b('0x7')](),controller[_0xa79b('0xa')]);router[_0xa79b('0x6')](_0xa79b('0xb'),auth[_0xa79b('0x7')](),controller[_0xa79b('0xc')]);router[_0xa79b('0xd')]('/',auth[_0xa79b('0x7')](),controller['create']);router[_0xa79b('0xe')](_0xa79b('0xb'),auth['isAuthenticated'](),controller[_0xa79b('0xf')]);router[_0xa79b('0x10')]('/:id',auth[_0xa79b('0x7')](),controller[_0xa79b('0x11')]);module[_0xa79b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f09d285..9df784c 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 _0x71c3=['queue','DATE','NOW','STRING','account','agent'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x71c3,0xb7));var _0x371c=function(_0x2d226b,_0x3524cc){_0x2d226b=_0x2d226b-0x0;var _0x8b6ec2=_0x71c3[_0x2d226b];return _0x8b6ec2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x371c('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x371c('0x1'),_0x371c('0x2'),'queue'),'allowNull':![],'defaultValue':_0x371c('0x3')},'transferredAt':{'type':Sequelize[_0x371c('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x371c('0x5')]}}; \ No newline at end of file +var _0x1e2b=['exports','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0xa946a1,_0x3c74b7){var _0x5a6fe9=function(_0x1cba7e){while(--_0x1cba7e){_0xa946a1['push'](_0xa946a1['shift']());}};_0x5a6fe9(++_0x3c74b7);}(_0x1e2b,0x197));var _0xb1e2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1e2b[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0xb1e2('0x0'));var Sequelize=require('sequelize');module[_0xb1e2('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb1e2('0x2')](_0xb1e2('0x3'),_0xb1e2('0x4'),_0xb1e2('0x5')),'allowNull':![],'defaultValue':_0xb1e2('0x5')},'transferredAt':{'type':Sequelize[_0xb1e2('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb1e2('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f224e55..211e0ef 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 _0x59ee=['squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','MailTransferReport','includeAll','rows','catch','show','length','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x59ee,0x165));var _0xe59e=function(_0x375e04,_0x27dad6){_0x375e04=_0x375e04-0x0;var _0x250b96=_0x59ee[_0x375e04];return _0x250b96;};'use strict';var pdf=require(_0xe59e('0x0'));var emlformat=require(_0xe59e('0x1'));var rimraf=require(_0xe59e('0x2'));var zipdir=require(_0xe59e('0x3'));var jsonpatch=require(_0xe59e('0x4'));var rp=require('request-promise');var moment=require(_0xe59e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe59e('0x6'));var util=require(_0xe59e('0x7'));var path=require(_0xe59e('0x8'));var sox=require(_0xe59e('0x9'));var csv=require(_0xe59e('0xa'));var ejs=require(_0xe59e('0xb'));var fs=require('fs');var _=require(_0xe59e('0xc'));var squel=require(_0xe59e('0xd'));var crypto=require(_0xe59e('0xe'));var jsforce=require(_0xe59e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe59e('0x10'));var Papa=require(_0xe59e('0x11'));var Redis=require('ioredis');var authService=require(_0xe59e('0x12'));var qs=require(_0xe59e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe59e('0x14'));var logger=require(_0xe59e('0x15'))(_0xe59e('0x16'));var utils=require(_0xe59e('0x17'));var config=require(_0xe59e('0x18'));var licenseUtil=require(_0xe59e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x195c06,_0x5d8ab4){_0x5d8ab4=_0x5d8ab4||0xcc;return function(_0x45c1d2){if(_0x45c1d2){return _0x195c06[_0xe59e('0x1a')](_0x5d8ab4);}return _0x195c06['status'](_0x5d8ab4)[_0xe59e('0x1b')]();};}function respondWithResult(_0x5393d5,_0x301bc9){_0x301bc9=_0x301bc9||0xc8;return function(_0xe7decb){if(_0xe7decb){return _0x5393d5['status'](_0x301bc9)[_0xe59e('0x1c')](_0xe7decb);}};}function respondWithFilteredResult(_0x321015,_0x21b84e){return function(_0x4e6de0){if(_0x4e6de0){var _0x12ef38=_0x4e6de0[_0xe59e('0x1d')],_0x49e04d=_0x21b84e[_0xe59e('0x1e')],_0x1dc63e=_0x21b84e[_0xe59e('0x1e')]+_0x21b84e[_0xe59e('0x1f')],_0x45e72d;if(_0x1dc63e>=_0x12ef38){_0x1dc63e=_0x12ef38;_0x45e72d=0xc8;}else{_0x45e72d=0xce;}_0x321015[_0xe59e('0x20')](_0x45e72d);return _0x321015[_0xe59e('0x21')](_0xe59e('0x22'),_0x49e04d+'-'+_0x1dc63e+'/'+_0x12ef38)[_0xe59e('0x1c')](_0x4e6de0);}return null;};}function patchUpdates(_0x3d74a3){return function(_0x243a39){try{jsonpatch[_0xe59e('0x23')](_0x243a39,_0x3d74a3,!![]);}catch(_0x4c3348){return BPromise[_0xe59e('0x24')](_0x4c3348);}return _0x243a39[_0xe59e('0x25')]();};}function saveUpdates(_0x39c41d,_0x267a58){return function(_0x211373){if(_0x211373){return _0x211373['update'](_0x39c41d)['then'](function(_0x34489b){return _0x34489b;});}return null;};}function removeEntity(_0x3101db,_0x2f3b07){return function(_0x4690db){if(_0x4690db){return _0x4690db['destroy']()[_0xe59e('0x26')](function(){_0x3101db[_0xe59e('0x20')](0xcc)[_0xe59e('0x1b')]();});}};}function handleEntityNotFound(_0x9d9a12,_0x322f4b){return function(_0x450ff5){if(!_0x450ff5){_0x9d9a12['sendStatus'](0x194);}return _0x450ff5;};}function handleError(_0xdae060,_0x56aeb2){_0x56aeb2=_0x56aeb2||0x1f4;return function(_0x1dfb83){logger[_0xe59e('0x27')](_0x1dfb83[_0xe59e('0x28')]);if(_0x1dfb83[_0xe59e('0x29')]){delete _0x1dfb83[_0xe59e('0x29')];}_0xdae060['status'](_0x56aeb2)[_0xe59e('0x2a')](_0x1dfb83);};}exports[_0xe59e('0x2b')]=function(_0x53fb4c,_0x37aa5e){var _0x1d0019={},_0x2bdd5b={},_0x5e433c={'count':0x0,'rows':[]};var _0x2de0ac=_[_0xe59e('0x2c')](db['MailTransferReport'][_0xe59e('0x2d')],function(_0x5a89bc){return{'name':_0x5a89bc[_0xe59e('0x2e')],'type':_0x5a89bc['type']['key']};});_0x2bdd5b[_0xe59e('0x2f')]=_[_0xe59e('0x2c')](_0x2de0ac,'name');_0x2bdd5b[_0xe59e('0x30')]=_[_0xe59e('0x31')](_0x53fb4c[_0xe59e('0x30')]);_0x2bdd5b[_0xe59e('0x32')]=_[_0xe59e('0x33')](_0x2bdd5b[_0xe59e('0x2f')],_0x2bdd5b[_0xe59e('0x30')]);_0x1d0019['attributes']=_[_0xe59e('0x33')](_0x2bdd5b[_0xe59e('0x2f')],qs['fields'](_0x53fb4c['query'][_0xe59e('0x34')]));_0x1d0019[_0xe59e('0x35')]=_0x1d0019[_0xe59e('0x35')]['length']?_0x1d0019[_0xe59e('0x35')]:_0x2bdd5b[_0xe59e('0x2f')];if(!_0x53fb4c[_0xe59e('0x30')][_0xe59e('0x36')](_0xe59e('0x37'))){_0x1d0019['limit']=qs[_0xe59e('0x1f')](_0x53fb4c['query']['limit']);_0x1d0019[_0xe59e('0x1e')]=qs['offset'](_0x53fb4c[_0xe59e('0x30')][_0xe59e('0x1e')]);}_0x1d0019['order']=qs[_0xe59e('0x38')](_0x53fb4c[_0xe59e('0x30')][_0xe59e('0x38')]);_0x1d0019['where']=qs['filters'](_['pick'](_0x53fb4c['query'],_0x2bdd5b[_0xe59e('0x32')]),_0x2de0ac);if(_0x53fb4c[_0xe59e('0x30')][_0xe59e('0x39')]){_0x1d0019['where']=_[_0xe59e('0x3a')](_0x1d0019['where'],{'$or':_[_0xe59e('0x2c')](_0x2de0ac,function(_0x5ac15a){if(_0x5ac15a['type']!==_0xe59e('0x3b')){var _0x3d1d35={};_0x3d1d35[_0x5ac15a[_0xe59e('0x29')]]={'$like':'%'+_0x53fb4c[_0xe59e('0x30')][_0xe59e('0x39')]+'%'};return _0x3d1d35;}})});}_0x1d0019=_[_0xe59e('0x3a')]({},_0x1d0019,_0x53fb4c[_0xe59e('0x3c')]);var _0x18962b={'where':_0x1d0019[_0xe59e('0x3d')]};return db[_0xe59e('0x3e')][_0xe59e('0x1d')](_0x18962b)[_0xe59e('0x26')](function(_0x531a31){_0x5e433c[_0xe59e('0x1d')]=_0x531a31;if(_0x53fb4c[_0xe59e('0x30')][_0xe59e('0x3f')]){_0x1d0019['include']=[{'all':!![]}];}return db[_0xe59e('0x3e')]['findAll'](_0x1d0019);})[_0xe59e('0x26')](function(_0x228bc9){_0x5e433c[_0xe59e('0x40')]=_0x228bc9;return _0x5e433c;})[_0xe59e('0x26')](respondWithFilteredResult(_0x37aa5e,_0x1d0019))[_0xe59e('0x41')](handleError(_0x37aa5e,null));};exports[_0xe59e('0x42')]=function(_0x4b0215,_0x547975){var _0x5beb94={'raw':!![],'where':{'id':_0x4b0215['params']['id']}},_0x40a793={};_0x40a793[_0xe59e('0x2f')]=_[_0xe59e('0x31')](db[_0xe59e('0x3e')][_0xe59e('0x2d')]);_0x40a793[_0xe59e('0x30')]=_[_0xe59e('0x31')](_0x4b0215[_0xe59e('0x30')]);_0x40a793['filters']=_['intersection'](_0x40a793[_0xe59e('0x2f')],_0x40a793[_0xe59e('0x30')]);_0x5beb94[_0xe59e('0x35')]=_['intersection'](_0x40a793[_0xe59e('0x2f')],qs[_0xe59e('0x34')](_0x4b0215[_0xe59e('0x30')]['fields']));_0x5beb94[_0xe59e('0x35')]=_0x5beb94['attributes'][_0xe59e('0x43')]?_0x5beb94[_0xe59e('0x35')]:_0x40a793[_0xe59e('0x2f')];if(_0x4b0215[_0xe59e('0x30')][_0xe59e('0x3f')]){_0x5beb94['include']=[{'all':!![]}];}_0x5beb94=_[_0xe59e('0x3a')]({},_0x5beb94,_0x4b0215[_0xe59e('0x3c')]);return db[_0xe59e('0x3e')][_0xe59e('0x44')](_0x5beb94)['then'](handleEntityNotFound(_0x547975,null))[_0xe59e('0x26')](respondWithResult(_0x547975,null))[_0xe59e('0x41')](handleError(_0x547975,null));};exports[_0xe59e('0x45')]=function(_0x4799b2,_0x2e70af){return db[_0xe59e('0x3e')]['create'](_0x4799b2[_0xe59e('0x46')],{})[_0xe59e('0x26')](respondWithResult(_0x2e70af,0xc9))['catch'](handleError(_0x2e70af,null));};exports['update']=function(_0x203417,_0x1c6f14){if(_0x203417[_0xe59e('0x46')]['id']){delete _0x203417[_0xe59e('0x46')]['id'];}return db[_0xe59e('0x3e')]['find']({'where':{'id':_0x203417[_0xe59e('0x47')]['id']}})[_0xe59e('0x26')](handleEntityNotFound(_0x1c6f14,null))[_0xe59e('0x26')](saveUpdates(_0x203417[_0xe59e('0x46')],null))['then'](respondWithResult(_0x1c6f14,null))['catch'](handleError(_0x1c6f14,null));};exports[_0xe59e('0x48')]=function(_0x570d1a,_0x8be623){return db[_0xe59e('0x3e')][_0xe59e('0x44')]({'where':{'id':_0x570d1a['params']['id']}})[_0xe59e('0x26')](handleEntityNotFound(_0x8be623,null))[_0xe59e('0x26')](removeEntity(_0x8be623,null))[_0xe59e('0x41')](handleError(_0x8be623,null));};exports[_0xe59e('0x49')]=function(_0x50890b,_0x2c3fff){return db[_0xe59e('0x3e')]['describe']()[_0xe59e('0x26')](respondWithResult(_0x2c3fff,null))[_0xe59e('0x41')](handleError(_0x2c3fff,null));}; \ No newline at end of file +var _0xcb03=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','reject','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','VIRTUAL','merge','options','MailTransferReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','zip-dir','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x3d0b8d,_0x20179c){var _0x6c2348=function(_0x175310){while(--_0x175310){_0x3d0b8d['push'](_0x3d0b8d['shift']());}};_0x6c2348(++_0x20179c);}(_0xcb03,0x19f));var _0x3cb0=function(_0x184773,_0x3ff9e1){_0x184773=_0x184773-0x0;var _0xe54850=_0xcb03[_0x184773];return _0xe54850;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3cb0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3cb0('0x1'));var Mustache=require('mustache');var util=require(_0x3cb0('0x2'));var path=require('path');var sox=require(_0x3cb0('0x3'));var csv=require(_0x3cb0('0x4'));var ejs=require(_0x3cb0('0x5'));var fs=require('fs');var _=require(_0x3cb0('0x6'));var squel=require('squel');var crypto=require(_0x3cb0('0x7'));var jsforce=require(_0x3cb0('0x8'));var deskjs=require(_0x3cb0('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3cb0('0xa'));var Redis=require(_0x3cb0('0xb'));var authService=require(_0x3cb0('0xc'));var qs=require(_0x3cb0('0xd'));var as=require(_0x3cb0('0xe'));var hardwareService=require(_0x3cb0('0xf'));var logger=require(_0x3cb0('0x10'))(_0x3cb0('0x11'));var utils=require(_0x3cb0('0x12'));var config=require(_0x3cb0('0x13'));var licenseUtil=require(_0x3cb0('0x14'));var db=require(_0x3cb0('0x15'))['db'];function respondWithStatusCode(_0x54fd95,_0x4dfa75){_0x4dfa75=_0x4dfa75||0xcc;return function(_0x56222f){if(_0x56222f){return _0x54fd95['sendStatus'](_0x4dfa75);}return _0x54fd95['status'](_0x4dfa75)[_0x3cb0('0x16')]();};}function respondWithResult(_0x214850,_0x33a056){_0x33a056=_0x33a056||0xc8;return function(_0x2ce621){if(_0x2ce621){return _0x214850[_0x3cb0('0x17')](_0x33a056)[_0x3cb0('0x18')](_0x2ce621);}};}function respondWithFilteredResult(_0x19ac0a,_0x203961){return function(_0x2eca85){if(_0x2eca85){var _0x326733=_0x2eca85[_0x3cb0('0x19')],_0x3c3998=_0x203961[_0x3cb0('0x1a')],_0x8c9901=_0x203961[_0x3cb0('0x1a')]+_0x203961[_0x3cb0('0x1b')],_0x3f6148;if(_0x8c9901>=_0x326733){_0x8c9901=_0x326733;_0x3f6148=0xc8;}else{_0x3f6148=0xce;}_0x19ac0a[_0x3cb0('0x17')](_0x3f6148);return _0x19ac0a[_0x3cb0('0x1c')]('Content-Range',_0x3c3998+'-'+_0x8c9901+'/'+_0x326733)[_0x3cb0('0x18')](_0x2eca85);}return null;};}function patchUpdates(_0x1da395){return function(_0x388409){try{jsonpatch['apply'](_0x388409,_0x1da395,!![]);}catch(_0x277c26){return BPromise[_0x3cb0('0x1d')](_0x277c26);}return _0x388409['save']();};}function saveUpdates(_0x19713e,_0x2dc407){return function(_0xaa232){if(_0xaa232){return _0xaa232[_0x3cb0('0x1e')](_0x19713e)[_0x3cb0('0x1f')](function(_0x461045){return _0x461045;});}return null;};}function removeEntity(_0x32a515,_0x30d9b3){return function(_0x41349f){if(_0x41349f){return _0x41349f[_0x3cb0('0x20')]()[_0x3cb0('0x1f')](function(){_0x32a515[_0x3cb0('0x17')](0xcc)[_0x3cb0('0x16')]();});}};}function handleEntityNotFound(_0x26c423,_0x19abe1){return function(_0x7dad71){if(!_0x7dad71){_0x26c423[_0x3cb0('0x21')](0x194);}return _0x7dad71;};}function handleError(_0x3555d5,_0x2cf018){_0x2cf018=_0x2cf018||0x1f4;return function(_0x50063a){logger[_0x3cb0('0x22')](_0x50063a['stack']);if(_0x50063a['name']){delete _0x50063a[_0x3cb0('0x23')];}_0x3555d5[_0x3cb0('0x17')](_0x2cf018)[_0x3cb0('0x24')](_0x50063a);};}exports[_0x3cb0('0x25')]=function(_0x338580,_0x4285b2){var _0x2457ac={},_0x4fbfe9={},_0x2a4c8e={'count':0x0,'rows':[]};var _0x592e03=_[_0x3cb0('0x26')](db['MailTransferReport'][_0x3cb0('0x27')],function(_0xdeb7ed){return{'name':_0xdeb7ed[_0x3cb0('0x28')],'type':_0xdeb7ed[_0x3cb0('0x29')][_0x3cb0('0x2a')]};});_0x4fbfe9[_0x3cb0('0x2b')]=_[_0x3cb0('0x26')](_0x592e03,_0x3cb0('0x23'));_0x4fbfe9['query']=_[_0x3cb0('0x2c')](_0x338580[_0x3cb0('0x2d')]);_0x4fbfe9[_0x3cb0('0x2e')]=_[_0x3cb0('0x2f')](_0x4fbfe9[_0x3cb0('0x2b')],_0x4fbfe9['query']);_0x2457ac['attributes']=_[_0x3cb0('0x2f')](_0x4fbfe9[_0x3cb0('0x2b')],qs['fields'](_0x338580[_0x3cb0('0x2d')][_0x3cb0('0x30')]));_0x2457ac[_0x3cb0('0x31')]=_0x2457ac[_0x3cb0('0x31')]['length']?_0x2457ac[_0x3cb0('0x31')]:_0x4fbfe9[_0x3cb0('0x2b')];if(!_0x338580[_0x3cb0('0x2d')]['hasOwnProperty'](_0x3cb0('0x32'))){_0x2457ac[_0x3cb0('0x1b')]=qs[_0x3cb0('0x1b')](_0x338580['query'][_0x3cb0('0x1b')]);_0x2457ac[_0x3cb0('0x1a')]=qs[_0x3cb0('0x1a')](_0x338580['query'][_0x3cb0('0x1a')]);}_0x2457ac[_0x3cb0('0x33')]=qs[_0x3cb0('0x34')](_0x338580[_0x3cb0('0x2d')]['sort']);_0x2457ac[_0x3cb0('0x35')]=qs['filters'](_[_0x3cb0('0x36')](_0x338580[_0x3cb0('0x2d')],_0x4fbfe9[_0x3cb0('0x2e')]),_0x592e03);if(_0x338580[_0x3cb0('0x2d')]['filter']){_0x2457ac[_0x3cb0('0x35')]=_['merge'](_0x2457ac['where'],{'$or':_['map'](_0x592e03,function(_0x125d59){if(_0x125d59['type']!==_0x3cb0('0x37')){var _0x8d092f={};_0x8d092f[_0x125d59[_0x3cb0('0x23')]]={'$like':'%'+_0x338580[_0x3cb0('0x2d')]['filter']+'%'};return _0x8d092f;}})});}_0x2457ac=_[_0x3cb0('0x38')]({},_0x2457ac,_0x338580[_0x3cb0('0x39')]);var _0x1fc858={'where':_0x2457ac[_0x3cb0('0x35')]};return db[_0x3cb0('0x3a')][_0x3cb0('0x19')](_0x1fc858)[_0x3cb0('0x1f')](function(_0x338c6b){_0x2a4c8e[_0x3cb0('0x19')]=_0x338c6b;if(_0x338580[_0x3cb0('0x2d')][_0x3cb0('0x3b')]){_0x2457ac[_0x3cb0('0x3c')]=[{'all':!![]}];}return db[_0x3cb0('0x3a')][_0x3cb0('0x3d')](_0x2457ac);})[_0x3cb0('0x1f')](function(_0x33de2b){_0x2a4c8e[_0x3cb0('0x3e')]=_0x33de2b;return _0x2a4c8e;})[_0x3cb0('0x1f')](respondWithFilteredResult(_0x4285b2,_0x2457ac))['catch'](handleError(_0x4285b2,null));};exports[_0x3cb0('0x3f')]=function(_0x54a9e6,_0x1f4066){var _0x3f97de={'raw':!![],'where':{'id':_0x54a9e6[_0x3cb0('0x40')]['id']}},_0x3348e0={};_0x3348e0['model']=_[_0x3cb0('0x2c')](db[_0x3cb0('0x3a')][_0x3cb0('0x27')]);_0x3348e0[_0x3cb0('0x2d')]=_['keys'](_0x54a9e6['query']);_0x3348e0[_0x3cb0('0x2e')]=_[_0x3cb0('0x2f')](_0x3348e0[_0x3cb0('0x2b')],_0x3348e0[_0x3cb0('0x2d')]);_0x3f97de['attributes']=_[_0x3cb0('0x2f')](_0x3348e0[_0x3cb0('0x2b')],qs[_0x3cb0('0x30')](_0x54a9e6[_0x3cb0('0x2d')][_0x3cb0('0x30')]));_0x3f97de['attributes']=_0x3f97de[_0x3cb0('0x31')][_0x3cb0('0x41')]?_0x3f97de[_0x3cb0('0x31')]:_0x3348e0['model'];if(_0x54a9e6[_0x3cb0('0x2d')][_0x3cb0('0x3b')]){_0x3f97de[_0x3cb0('0x3c')]=[{'all':!![]}];}_0x3f97de=_[_0x3cb0('0x38')]({},_0x3f97de,_0x54a9e6['options']);return db[_0x3cb0('0x3a')][_0x3cb0('0x42')](_0x3f97de)[_0x3cb0('0x1f')](handleEntityNotFound(_0x1f4066,null))['then'](respondWithResult(_0x1f4066,null))[_0x3cb0('0x43')](handleError(_0x1f4066,null));};exports[_0x3cb0('0x44')]=function(_0x30905b,_0x594a42){return db[_0x3cb0('0x3a')][_0x3cb0('0x44')](_0x30905b[_0x3cb0('0x45')],{})[_0x3cb0('0x1f')](respondWithResult(_0x594a42,0xc9))['catch'](handleError(_0x594a42,null));};exports[_0x3cb0('0x1e')]=function(_0x1a2fc9,_0x775e8d){if(_0x1a2fc9[_0x3cb0('0x45')]['id']){delete _0x1a2fc9[_0x3cb0('0x45')]['id'];}return db[_0x3cb0('0x3a')][_0x3cb0('0x42')]({'where':{'id':_0x1a2fc9[_0x3cb0('0x40')]['id']}})['then'](handleEntityNotFound(_0x775e8d,null))['then'](saveUpdates(_0x1a2fc9[_0x3cb0('0x45')],null))[_0x3cb0('0x1f')](respondWithResult(_0x775e8d,null))[_0x3cb0('0x43')](handleError(_0x775e8d,null));};exports[_0x3cb0('0x20')]=function(_0xb78f68,_0xb023de){return db[_0x3cb0('0x3a')][_0x3cb0('0x42')]({'where':{'id':_0xb78f68[_0x3cb0('0x40')]['id']}})['then'](handleEntityNotFound(_0xb023de,null))['then'](removeEntity(_0xb023de,null))['catch'](handleError(_0xb023de,null));};exports[_0x3cb0('0x46')]=function(_0x201066,_0x3c42f5){return db['MailTransferReport']['describe']()[_0x3cb0('0x1f')](respondWithResult(_0x3c42f5,null))['catch'](handleError(_0x3c42f5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ee12441..3524dfe 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 _0x59e6=['moment','path','../../config/environment','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2cf384,_0x50ce36){var _0x5d7346=function(_0x148176){while(--_0x148176){_0x2cf384['push'](_0x2cf384['shift']());}};_0x5d7346(++_0x50ce36);}(_0x59e6,0x17d));var _0x659e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x59e6[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x659e('0x0'));var util=require(_0x659e('0x1'));var logger=require(_0x659e('0x2'))(_0x659e('0x3'));var moment=require(_0x659e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x659e('0x5'));var rimraf=require('rimraf');var config=require(_0x659e('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x659e('0x7')]=function(_0x3f2392,_0x221a26){return _0x3f2392['define'](_0x659e('0x8'),attributes,{'tableName':_0x659e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x659e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c97=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x3c97,0x1b2));var _0x73c9=function(_0x504483,_0x58f86a){_0x504483=_0x504483-0x0;var _0x538395=_0x3c97[_0x504483];return _0x538395;};'use strict';var _=require(_0x73c9('0x0'));var util=require(_0x73c9('0x1'));var logger=require('../../config/logger')(_0x73c9('0x2'));var moment=require(_0x73c9('0x3'));var BPromise=require(_0x73c9('0x4'));var rp=require(_0x73c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73c9('0x6'));var config=require(_0x73c9('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x73c9('0x8')]=function(_0x2963ce,_0x436c1d){return _0x2963ce[_0x73c9('0x9')](_0x73c9('0xa'),attributes,{'tableName':_0x73c9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x73c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ccf2912..edbddc9 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 _0x9c4d=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xcd2b10,_0x11055d){var _0xda7b73=function(_0x5e1ef9){while(--_0x5e1ef9){_0xcd2b10['push'](_0xcd2b10['shift']());}};_0xda7b73(++_0x11055d);}(_0x9c4d,0x82));var _0xd9c4=function(_0x408d55,_0x1d290c){_0x408d55=_0x408d55-0x0;var _0x34e695=_0x9c4d[_0x408d55];return _0x34e695;};'use strict';var _=require(_0xd9c4('0x0'));var util=require(_0xd9c4('0x1'));var moment=require(_0xd9c4('0x2'));var BPromise=require(_0xd9c4('0x3'));var rs=require(_0xd9c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9c4('0x5'));var logger=require(_0xd9c4('0x6'))(_0xd9c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9c4('0x8'));var client=jayson[_0xd9c4('0x9')][_0xd9c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x338f8a,_0x285966,_0x503e7c){return new BPromise(function(_0x30a452,_0x1a9b83){return client['request'](_0x338f8a,_0x503e7c)[_0xd9c4('0xb')](function(_0xb5a560){logger['info'](_0xd9c4('0xc'),_0x285966,_0xd9c4('0xd'));logger[_0xd9c4('0xe')](_0xd9c4('0xf'),_0x285966,_0xd9c4('0xd'),JSON['stringify'](_0xb5a560));if(_0xb5a560[_0xd9c4('0x10')]){if(_0xb5a560[_0xd9c4('0x10')]['code']===0x1f4){logger['error'](_0xd9c4('0xc'),_0x285966,_0xb5a560[_0xd9c4('0x10')][_0xd9c4('0x11')]);return _0x1a9b83(_0xb5a560[_0xd9c4('0x10')][_0xd9c4('0x11')]);}logger[_0xd9c4('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x285966,_0xb5a560['error'][_0xd9c4('0x11')]);return _0x30a452(_0xb5a560[_0xd9c4('0x10')][_0xd9c4('0x11')]);}else{logger[_0xd9c4('0x12')](_0xd9c4('0xc'),_0x285966,_0xd9c4('0xd'));_0x30a452(_0xb5a560[_0xd9c4('0x13')][_0xd9c4('0x11')]);}})[_0xd9c4('0x14')](function(_0x280cdd){logger[_0xd9c4('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x285966,_0x280cdd);_0x1a9b83(_0x280cdd);});});} \ No newline at end of file +var _0x85e7=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment'];(function(_0x7870ff,_0x21c985){var _0x5d66d6=function(_0x411e71){while(--_0x411e71){_0x7870ff['push'](_0x7870ff['shift']());}};_0x5d66d6(++_0x21c985);}(_0x85e7,0x11c));var _0x785e=function(_0x5101b6,_0x589f89){_0x5101b6=_0x5101b6-0x0;var _0x5aa8e8=_0x85e7[_0x5101b6];return _0x5aa8e8;};'use strict';var _=require(_0x785e('0x0'));var util=require('util');var moment=require(_0x785e('0x1'));var BPromise=require(_0x785e('0x2'));var rs=require(_0x785e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x785e('0x4'));var logger=require(_0x785e('0x5'))('rpc');var config=require(_0x785e('0x6'));var jayson=require(_0x785e('0x7'));var client=jayson[_0x785e('0x8')][_0x785e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x122180,_0x28e909,_0x3e6193){return new BPromise(function(_0x2edb57,_0x157227){return client[_0x785e('0xa')](_0x122180,_0x3e6193)[_0x785e('0xb')](function(_0xe1c25e){logger[_0x785e('0xc')](_0x785e('0xd'),_0x28e909,'request\x20sent');logger[_0x785e('0xe')](_0x785e('0xf'),_0x28e909,_0x785e('0x10'),JSON[_0x785e('0x11')](_0xe1c25e));if(_0xe1c25e['error']){if(_0xe1c25e[_0x785e('0x12')][_0x785e('0x13')]===0x1f4){logger[_0x785e('0x12')](_0x785e('0xd'),_0x28e909,_0xe1c25e[_0x785e('0x12')][_0x785e('0x14')]);return _0x157227(_0xe1c25e[_0x785e('0x12')][_0x785e('0x14')]);}logger[_0x785e('0x12')](_0x785e('0xd'),_0x28e909,_0xe1c25e[_0x785e('0x12')]['message']);return _0x2edb57(_0xe1c25e['error']['message']);}else{logger['info'](_0x785e('0xd'),_0x28e909,_0x785e('0x10'));_0x2edb57(_0xe1c25e[_0x785e('0x15')][_0x785e('0x14')]);}})['catch'](function(_0x2757dd){logger[_0x785e('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x28e909,_0x2757dd);_0x157227(_0x2757dd);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ed293be..906297b 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 _0x7007=['get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller'];(function(_0x342184,_0x5ab1e4){var _0x1833ed=function(_0x1fcdbf){while(--_0x1fcdbf){_0x342184['push'](_0x342184['shift']());}};_0x1833ed(++_0x5ab1e4);}(_0x7007,0xa3));var _0x7700=function(_0x3b1567,_0x24e7d4){_0x3b1567=_0x3b1567-0x0;var _0x595e8b=_0x7007[_0x3b1567];return _0x595e8b;};'use strict';var multer=require(_0x7700('0x0'));var util=require('util');var path=require(_0x7700('0x1'));var timeout=require(_0x7700('0x2'));var express=require('express');var router=express[_0x7700('0x3')]();var auth=require(_0x7700('0x4'));var interaction=require(_0x7700('0x5'));var config=require('../../config/environment');var controller=require(_0x7700('0x6'));router[_0x7700('0x7')]('/',auth[_0x7700('0x8')](),controller[_0x7700('0x9')]);router[_0x7700('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x7700('0x8')](),controller[_0x7700('0xa')]);router[_0x7700('0xb')]('/',auth[_0x7700('0x8')](),controller[_0x7700('0xc')]);router[_0x7700('0xd')](_0x7700('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7700('0xe'),auth[_0x7700('0x8')](),controller[_0x7700('0xf')]);module[_0x7700('0x10')]=router; \ No newline at end of file +var _0x6c74=['isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x3c6402,_0x7d2a68){var _0x48ee69=function(_0x574dda){while(--_0x574dda){_0x3c6402['push'](_0x3c6402['shift']());}};_0x48ee69(++_0x7d2a68);}(_0x6c74,0x9c));var _0x46c7=function(_0x5b7a89,_0x2d7bd6){_0x5b7a89=_0x5b7a89-0x0;var _0x3cd70a=_0x6c74[_0x5b7a89];return _0x3cd70a;};'use strict';var multer=require(_0x46c7('0x0'));var util=require(_0x46c7('0x1'));var path=require(_0x46c7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x46c7('0x3'));var config=require(_0x46c7('0x4'));var controller=require(_0x46c7('0x5'));router['get']('/',auth[_0x46c7('0x6')](),controller[_0x46c7('0x7')]);router[_0x46c7('0x8')](_0x46c7('0x9'),auth['isAuthenticated'](),controller[_0x46c7('0xa')]);router[_0x46c7('0x8')](_0x46c7('0xb'),auth[_0x46c7('0x6')](),controller[_0x46c7('0xc')]);router[_0x46c7('0xd')]('/',auth[_0x46c7('0x6')](),controller['create']);router['put'](_0x46c7('0xb'),auth[_0x46c7('0x6')](),controller[_0x46c7('0xe')]);router[_0x46c7('0xf')](_0x46c7('0xb'),auth[_0x46c7('0x6')](),controller[_0x46c7('0x10')]);module[_0x46c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9492bad..154daab 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 _0x58fc=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x445d39,_0x64bb6){var _0x4423d3=function(_0x2191d6){while(--_0x2191d6){_0x445d39['push'](_0x445d39['shift']());}};_0x4423d3(++_0x64bb6);}(_0x58fc,0x17a));var _0xc58f=function(_0x2b459e,_0x3ee155){_0x2b459e=_0x2b459e-0x0;var _0x51ca44=_0x58fc[_0x2b459e];return _0x51ca44;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc58f('0x0')]={'channel':{'type':Sequelize[_0xc58f('0x1')]},'membername':{'type':Sequelize[_0xc58f('0x1')]},'interface':{'type':Sequelize[_0xc58f('0x1')]},'type':{'type':Sequelize[_0xc58f('0x1')],'defaultValue':_0xc58f('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xc58f('0x3')]},'enterAt':{'type':Sequelize[_0xc58f('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x982f4b){var _0x1b0428=moment(_0x982f4b);var _0x4b0fee=moment(this[_0xc58f('0x5')](_0xc58f('0x6')));var _0xf03923=_0x1b0428[_0xc58f('0x7')](_0x4b0fee,_0xc58f('0x8'));this['setDataValue'](_0xc58f('0x9'),_0x982f4b);this[_0xc58f('0xa')](_0xc58f('0xb'),_0xf03923||null);}},'data1':{'type':Sequelize[_0xc58f('0x1')],'comment':_0xc58f('0xc')},'data2':{'type':Sequelize[_0xc58f('0x1')],'comment':_0xc58f('0xd')},'data3':{'type':Sequelize[_0xc58f('0x1')],'comment':_0xc58f('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0xc58f('0xf')},'data5':{'type':Sequelize[_0xc58f('0x1')],'comment':_0xc58f('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc58f('0x1')]}}; \ No newline at end of file +var _0x0baa=['DATE','getDataValue','seconds','setDataValue','duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x1cdaa5,_0x55d0ea){var _0x14175b=function(_0x4e24f1){while(--_0x4e24f1){_0x1cdaa5['push'](_0x1cdaa5['shift']());}};_0x14175b(++_0x55d0ea);}(_0x0baa,0xcc));var _0xa0ba=function(_0xfd5c71,_0x8bd14d){_0xfd5c71=_0xfd5c71-0x0;var _0x1ebb7a=_0x0baa[_0xfd5c71];return _0x1ebb7a;};'use strict';var Sequelize=require(_0xa0ba('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xa0ba('0x1')]},'membername':{'type':Sequelize[_0xa0ba('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa0ba('0x1')],'defaultValue':_0xa0ba('0x2'),'comment':_0xa0ba('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xa0ba('0x4')]},'exitAt':{'type':Sequelize[_0xa0ba('0x4')],'set':function(_0x378fbc){var _0x424302=moment(_0x378fbc);var _0x50e777=moment(this[_0xa0ba('0x5')]('enterAt'));var _0x4b9907=_0x424302['diff'](_0x50e777,_0xa0ba('0x6'));this[_0xa0ba('0x7')]('exitAt',_0x378fbc);this[_0xa0ba('0x7')](_0xa0ba('0x8'),_0x4b9907||null);}},'data1':{'type':Sequelize[_0xa0ba('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xa0ba('0x1')],'comment':_0xa0ba('0x9')},'data3':{'type':Sequelize[_0xa0ba('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xa0ba('0x1')],'comment':_0xa0ba('0xa')},'data5':{'type':Sequelize[_0xa0ba('0x1')],'comment':_0xa0ba('0xb')},'role':{'type':Sequelize[_0xa0ba('0x1')]},'internal':{'type':Sequelize[_0xa0ba('0xc')]},'uniqueid':{'type':Sequelize[_0xa0ba('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 6d21144..e5cdd7c 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 _0x8618=['html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','then','status','error','stack','name','send','index','map','MemberReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','update','find','params','describe'];(function(_0x59c683,_0x209444){var _0x47251b=function(_0x4db046){while(--_0x4db046){_0x59c683['push'](_0x59c683['shift']());}};_0x47251b(++_0x209444);}(_0x8618,0x138));var _0x8861=function(_0xfd2d90,_0x33db0d){_0xfd2d90=_0xfd2d90-0x0;var _0x34689b=_0x8618[_0xfd2d90];return _0x34689b;};'use strict';var pdf=require(_0x8861('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8861('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8861('0x2'));var rp=require(_0x8861('0x3'));var moment=require(_0x8861('0x4'));var BPromise=require(_0x8861('0x5'));var Mustache=require(_0x8861('0x6'));var util=require(_0x8861('0x7'));var path=require(_0x8861('0x8'));var sox=require(_0x8861('0x9'));var csv=require(_0x8861('0xa'));var ejs=require(_0x8861('0xb'));var fs=require('fs');var _=require(_0x8861('0xc'));var squel=require(_0x8861('0xd'));var crypto=require(_0x8861('0xe'));var jsforce=require(_0x8861('0xf'));var deskjs=require(_0x8861('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8861('0x11'));var Redis=require(_0x8861('0x12'));var authService=require(_0x8861('0x13'));var qs=require(_0x8861('0x14'));var as=require(_0x8861('0x15'));var hardwareService=require(_0x8861('0x16'));var logger=require(_0x8861('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x8861('0x18'));var licenseUtil=require(_0x8861('0x19'));var db=require(_0x8861('0x1a'))['db'];function respondWithStatusCode(_0x3e2a13,_0x3b3545){_0x3b3545=_0x3b3545||0xcc;return function(_0x2bacb4){if(_0x2bacb4){return _0x3e2a13[_0x8861('0x1b')](_0x3b3545);}return _0x3e2a13['status'](_0x3b3545)[_0x8861('0x1c')]();};}function respondWithResult(_0x479146,_0x494853){_0x494853=_0x494853||0xc8;return function(_0x5382f8){if(_0x5382f8){return _0x479146['status'](_0x494853)[_0x8861('0x1d')](_0x5382f8);}};}function respondWithFilteredResult(_0x16858d,_0x333acf){return function(_0x38d317){if(_0x38d317){var _0x5f4615=_0x38d317[_0x8861('0x1e')],_0x327153=_0x333acf[_0x8861('0x1f')],_0x4168d9=_0x333acf[_0x8861('0x1f')]+_0x333acf[_0x8861('0x20')],_0x3cfb1a;if(_0x4168d9>=_0x5f4615){_0x4168d9=_0x5f4615;_0x3cfb1a=0xc8;}else{_0x3cfb1a=0xce;}_0x16858d['status'](_0x3cfb1a);return _0x16858d[_0x8861('0x21')](_0x8861('0x22'),_0x327153+'-'+_0x4168d9+'/'+_0x5f4615)[_0x8861('0x1d')](_0x38d317);}return null;};}function patchUpdates(_0x2191ae){return function(_0x22451b){try{jsonpatch[_0x8861('0x23')](_0x22451b,_0x2191ae,!![]);}catch(_0x89a070){return BPromise[_0x8861('0x24')](_0x89a070);}return _0x22451b['save']();};}function saveUpdates(_0x193159,_0x5aeac4){return function(_0x1d859d){if(_0x1d859d){return _0x1d859d['update'](_0x193159)[_0x8861('0x25')](function(_0x4ab812){return _0x4ab812;});}return null;};}function removeEntity(_0x596fb8,_0x1804a2){return function(_0x2415c1){if(_0x2415c1){return _0x2415c1['destroy']()[_0x8861('0x25')](function(){_0x596fb8[_0x8861('0x26')](0xcc)[_0x8861('0x1c')]();});}};}function handleEntityNotFound(_0x17a746,_0x44b166){return function(_0x48118a){if(!_0x48118a){_0x17a746[_0x8861('0x1b')](0x194);}return _0x48118a;};}function handleError(_0x2e2ce3,_0x12ef0b){_0x12ef0b=_0x12ef0b||0x1f4;return function(_0xec0d93){logger[_0x8861('0x27')](_0xec0d93[_0x8861('0x28')]);if(_0xec0d93[_0x8861('0x29')]){delete _0xec0d93[_0x8861('0x29')];}_0x2e2ce3[_0x8861('0x26')](_0x12ef0b)[_0x8861('0x2a')](_0xec0d93);};}exports[_0x8861('0x2b')]=function(_0x4f2fa4,_0x4a7403){var _0x399161={},_0x579324={},_0x1200db={'count':0x0,'rows':[]};var _0x4f6bad=_[_0x8861('0x2c')](db[_0x8861('0x2d')]['rawAttributes'],function(_0x5581d2){return{'name':_0x5581d2[_0x8861('0x2e')],'type':_0x5581d2[_0x8861('0x2f')][_0x8861('0x30')]};});_0x579324[_0x8861('0x31')]=_[_0x8861('0x2c')](_0x4f6bad,_0x8861('0x29'));_0x579324['query']=_[_0x8861('0x32')](_0x4f2fa4[_0x8861('0x33')]);_0x579324['filters']=_[_0x8861('0x34')](_0x579324[_0x8861('0x31')],_0x579324[_0x8861('0x33')]);_0x399161[_0x8861('0x35')]=_[_0x8861('0x34')](_0x579324[_0x8861('0x31')],qs[_0x8861('0x36')](_0x4f2fa4[_0x8861('0x33')][_0x8861('0x36')]));_0x399161[_0x8861('0x35')]=_0x399161[_0x8861('0x35')][_0x8861('0x37')]?_0x399161[_0x8861('0x35')]:_0x579324[_0x8861('0x31')];if(!_0x4f2fa4[_0x8861('0x33')][_0x8861('0x38')]('nolimit')){_0x399161['limit']=qs['limit'](_0x4f2fa4[_0x8861('0x33')]['limit']);_0x399161[_0x8861('0x1f')]=qs['offset'](_0x4f2fa4[_0x8861('0x33')][_0x8861('0x1f')]);}_0x399161[_0x8861('0x39')]=qs['sort'](_0x4f2fa4['query']['sort']);_0x399161[_0x8861('0x3a')]=qs[_0x8861('0x3b')](_[_0x8861('0x3c')](_0x4f2fa4['query'],_0x579324[_0x8861('0x3b')]),_0x4f6bad);if(_0x4f2fa4[_0x8861('0x33')][_0x8861('0x3d')]){_0x399161[_0x8861('0x3a')]=_[_0x8861('0x3e')](_0x399161[_0x8861('0x3a')],{'$or':_[_0x8861('0x2c')](_0x4f6bad,function(_0x5c688f){if(_0x5c688f[_0x8861('0x2f')]!==_0x8861('0x3f')){var _0x9f1de8={};_0x9f1de8[_0x5c688f[_0x8861('0x29')]]={'$like':'%'+_0x4f2fa4['query'][_0x8861('0x3d')]+'%'};return _0x9f1de8;}})});}_0x399161=_[_0x8861('0x3e')]({},_0x399161,_0x4f2fa4[_0x8861('0x40')]);var _0x5b5beb={'where':_0x399161[_0x8861('0x3a')]};return db[_0x8861('0x2d')][_0x8861('0x1e')](_0x5b5beb)['then'](function(_0x4f64f6){_0x1200db['count']=_0x4f64f6;if(_0x4f2fa4['query'][_0x8861('0x41')]){_0x399161['include']=[{'all':!![]}];}return db[_0x8861('0x2d')][_0x8861('0x42')](_0x399161);})[_0x8861('0x25')](function(_0x261d4a){_0x1200db[_0x8861('0x43')]=_0x261d4a;return _0x1200db;})[_0x8861('0x25')](respondWithFilteredResult(_0x4a7403,_0x399161))[_0x8861('0x44')](handleError(_0x4a7403,null));};exports[_0x8861('0x45')]=function(_0x17b394,_0x4084b8){var _0xe3c8ee={'raw':!![],'where':{'id':_0x17b394['params']['id']}},_0x2334cc={};_0x2334cc[_0x8861('0x31')]=_[_0x8861('0x32')](db[_0x8861('0x2d')][_0x8861('0x46')]);_0x2334cc[_0x8861('0x33')]=_[_0x8861('0x32')](_0x17b394['query']);_0x2334cc[_0x8861('0x3b')]=_[_0x8861('0x34')](_0x2334cc['model'],_0x2334cc[_0x8861('0x33')]);_0xe3c8ee['attributes']=_[_0x8861('0x34')](_0x2334cc[_0x8861('0x31')],qs[_0x8861('0x36')](_0x17b394[_0x8861('0x33')][_0x8861('0x36')]));_0xe3c8ee[_0x8861('0x35')]=_0xe3c8ee['attributes'][_0x8861('0x37')]?_0xe3c8ee[_0x8861('0x35')]:_0x2334cc[_0x8861('0x31')];if(_0x17b394['query'][_0x8861('0x41')]){_0xe3c8ee[_0x8861('0x47')]=[{'all':!![]}];}_0xe3c8ee=_[_0x8861('0x3e')]({},_0xe3c8ee,_0x17b394['options']);return db[_0x8861('0x2d')]['find'](_0xe3c8ee)[_0x8861('0x25')](handleEntityNotFound(_0x4084b8,null))[_0x8861('0x25')](respondWithResult(_0x4084b8,null))['catch'](handleError(_0x4084b8,null));};exports['create']=function(_0x34b689,_0x94d58b){return db[_0x8861('0x2d')][_0x8861('0x48')](_0x34b689[_0x8861('0x49')],{})[_0x8861('0x25')](respondWithResult(_0x94d58b,0xc9))[_0x8861('0x44')](handleError(_0x94d58b,null));};exports[_0x8861('0x4a')]=function(_0x56ecb5,_0x32864f){if(_0x56ecb5[_0x8861('0x49')]['id']){delete _0x56ecb5[_0x8861('0x49')]['id'];}return db['MemberReport'][_0x8861('0x4b')]({'where':{'id':_0x56ecb5[_0x8861('0x4c')]['id']}})[_0x8861('0x25')](handleEntityNotFound(_0x32864f,null))[_0x8861('0x25')](saveUpdates(_0x56ecb5[_0x8861('0x49')],null))[_0x8861('0x25')](respondWithResult(_0x32864f,null))[_0x8861('0x44')](handleError(_0x32864f,null));};exports['destroy']=function(_0x3f4a78,_0x161f74){return db['MemberReport']['find']({'where':{'id':_0x3f4a78[_0x8861('0x4c')]['id']}})[_0x8861('0x25')](handleEntityNotFound(_0x161f74,null))[_0x8861('0x25')](removeEntity(_0x161f74,null))[_0x8861('0x44')](handleError(_0x161f74,null));};exports[_0x8861('0x4d')]=function(_0x20a8bf,_0x2aa16d){return db[_0x8861('0x2d')]['describe']()['then'](respondWithResult(_0x2aa16d,null))[_0x8861('0x44')](handleError(_0x2aa16d,null));}; \ No newline at end of file +var _0x48c9=['name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','update','describe','eml-format','rimraf','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x3cfb38,_0x4e8697){var _0x5c0c91=function(_0x3c6b50){while(--_0x3c6b50){_0x3cfb38['push'](_0x3cfb38['shift']());}};_0x5c0c91(++_0x4e8697);}(_0x48c9,0xc5));var _0x948c=function(_0x213065,_0x3afd09){_0x213065=_0x213065-0x0;var _0x50a790=_0x48c9[_0x213065];return _0x50a790;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x948c('0x0'));var rimraf=require(_0x948c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x948c('0x2'));var moment=require(_0x948c('0x3'));var BPromise=require(_0x948c('0x4'));var Mustache=require(_0x948c('0x5'));var util=require(_0x948c('0x6'));var path=require(_0x948c('0x7'));var sox=require(_0x948c('0x8'));var csv=require(_0x948c('0x9'));var ejs=require(_0x948c('0xa'));var fs=require('fs');var _=require(_0x948c('0xb'));var squel=require('squel');var crypto=require(_0x948c('0xc'));var jsforce=require(_0x948c('0xd'));var deskjs=require(_0x948c('0xe'));var toCsv=require(_0x948c('0x9'));var querystring=require(_0x948c('0xf'));var Papa=require(_0x948c('0x10'));var Redis=require(_0x948c('0x11'));var authService=require(_0x948c('0x12'));var qs=require(_0x948c('0x13'));var as=require(_0x948c('0x14'));var hardwareService=require(_0x948c('0x15'));var logger=require(_0x948c('0x16'))(_0x948c('0x17'));var utils=require(_0x948c('0x18'));var config=require(_0x948c('0x19'));var licenseUtil=require(_0x948c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b6be,_0x119898){_0x119898=_0x119898||0xcc;return function(_0x366452){if(_0x366452){return _0x54b6be[_0x948c('0x1b')](_0x119898);}return _0x54b6be[_0x948c('0x1c')](_0x119898)[_0x948c('0x1d')]();};}function respondWithResult(_0x384e59,_0x316d53){_0x316d53=_0x316d53||0xc8;return function(_0x2d0424){if(_0x2d0424){return _0x384e59[_0x948c('0x1c')](_0x316d53)[_0x948c('0x1e')](_0x2d0424);}};}function respondWithFilteredResult(_0x26806b,_0x2d89d5){return function(_0x113fd1){if(_0x113fd1){var _0x4596bf=_0x113fd1[_0x948c('0x1f')],_0x277225=_0x2d89d5[_0x948c('0x20')],_0x348397=_0x2d89d5[_0x948c('0x20')]+_0x2d89d5[_0x948c('0x21')],_0x573be4;if(_0x348397>=_0x4596bf){_0x348397=_0x4596bf;_0x573be4=0xc8;}else{_0x573be4=0xce;}_0x26806b[_0x948c('0x1c')](_0x573be4);return _0x26806b[_0x948c('0x22')](_0x948c('0x23'),_0x277225+'-'+_0x348397+'/'+_0x4596bf)[_0x948c('0x1e')](_0x113fd1);}return null;};}function patchUpdates(_0x3a3b82){return function(_0x474dd7){try{jsonpatch[_0x948c('0x24')](_0x474dd7,_0x3a3b82,!![]);}catch(_0x3ceba9){return BPromise[_0x948c('0x25')](_0x3ceba9);}return _0x474dd7[_0x948c('0x26')]();};}function saveUpdates(_0x150c92,_0x22fa9e){return function(_0x1411c6){if(_0x1411c6){return _0x1411c6['update'](_0x150c92)[_0x948c('0x27')](function(_0x393fa4){return _0x393fa4;});}return null;};}function removeEntity(_0x25d993,_0x1fe4c0){return function(_0x8984b1){if(_0x8984b1){return _0x8984b1[_0x948c('0x28')]()[_0x948c('0x27')](function(){_0x25d993[_0x948c('0x1c')](0xcc)[_0x948c('0x1d')]();});}};}function handleEntityNotFound(_0x698389,_0x5cdf47){return function(_0x5edd0c){if(!_0x5edd0c){_0x698389[_0x948c('0x1b')](0x194);}return _0x5edd0c;};}function handleError(_0x4a2e28,_0x31d464){_0x31d464=_0x31d464||0x1f4;return function(_0x48e70c){logger[_0x948c('0x29')](_0x48e70c[_0x948c('0x2a')]);if(_0x48e70c[_0x948c('0x2b')]){delete _0x48e70c[_0x948c('0x2b')];}_0x4a2e28['status'](_0x31d464)[_0x948c('0x2c')](_0x48e70c);};}exports[_0x948c('0x2d')]=function(_0x399fc0,_0x49a328){var _0x546f29={},_0x4762b8={},_0x3810ae={'count':0x0,'rows':[]};var _0x5d1e89=_[_0x948c('0x2e')](db[_0x948c('0x2f')][_0x948c('0x30')],function(_0xa5c5a7){return{'name':_0xa5c5a7[_0x948c('0x31')],'type':_0xa5c5a7[_0x948c('0x32')]['key']};});_0x4762b8['model']=_[_0x948c('0x2e')](_0x5d1e89,_0x948c('0x2b'));_0x4762b8[_0x948c('0x33')]=_[_0x948c('0x34')](_0x399fc0[_0x948c('0x33')]);_0x4762b8['filters']=_[_0x948c('0x35')](_0x4762b8[_0x948c('0x36')],_0x4762b8[_0x948c('0x33')]);_0x546f29[_0x948c('0x37')]=_[_0x948c('0x35')](_0x4762b8[_0x948c('0x36')],qs[_0x948c('0x38')](_0x399fc0[_0x948c('0x33')]['fields']));_0x546f29[_0x948c('0x37')]=_0x546f29[_0x948c('0x37')]['length']?_0x546f29[_0x948c('0x37')]:_0x4762b8[_0x948c('0x36')];if(!_0x399fc0['query'][_0x948c('0x39')](_0x948c('0x3a'))){_0x546f29[_0x948c('0x21')]=qs[_0x948c('0x21')](_0x399fc0['query']['limit']);_0x546f29['offset']=qs[_0x948c('0x20')](_0x399fc0[_0x948c('0x33')][_0x948c('0x20')]);}_0x546f29[_0x948c('0x3b')]=qs[_0x948c('0x3c')](_0x399fc0['query'][_0x948c('0x3c')]);_0x546f29['where']=qs[_0x948c('0x3d')](_['pick'](_0x399fc0['query'],_0x4762b8[_0x948c('0x3d')]),_0x5d1e89);if(_0x399fc0['query'][_0x948c('0x3e')]){_0x546f29[_0x948c('0x3f')]=_[_0x948c('0x40')](_0x546f29[_0x948c('0x3f')],{'$or':_[_0x948c('0x2e')](_0x5d1e89,function(_0x3db2f0){if(_0x3db2f0[_0x948c('0x32')]!==_0x948c('0x41')){var _0x261d1e={};_0x261d1e[_0x3db2f0[_0x948c('0x2b')]]={'$like':'%'+_0x399fc0[_0x948c('0x33')][_0x948c('0x3e')]+'%'};return _0x261d1e;}})});}_0x546f29=_[_0x948c('0x40')]({},_0x546f29,_0x399fc0['options']);var _0x17f181={'where':_0x546f29[_0x948c('0x3f')]};return db['MemberReport']['count'](_0x17f181)[_0x948c('0x27')](function(_0x3fbd03){_0x3810ae[_0x948c('0x1f')]=_0x3fbd03;if(_0x399fc0[_0x948c('0x33')][_0x948c('0x42')]){_0x546f29[_0x948c('0x43')]=[{'all':!![]}];}return db[_0x948c('0x2f')][_0x948c('0x44')](_0x546f29);})[_0x948c('0x27')](function(_0x82f457){_0x3810ae[_0x948c('0x45')]=_0x82f457;return _0x3810ae;})[_0x948c('0x27')](respondWithFilteredResult(_0x49a328,_0x546f29))[_0x948c('0x46')](handleError(_0x49a328,null));};exports[_0x948c('0x47')]=function(_0x48351d,_0x33a197){var _0x24fc6f={'raw':!![],'where':{'id':_0x48351d[_0x948c('0x48')]['id']}},_0xf768e9={};_0xf768e9[_0x948c('0x36')]=_[_0x948c('0x34')](db[_0x948c('0x2f')][_0x948c('0x30')]);_0xf768e9[_0x948c('0x33')]=_[_0x948c('0x34')](_0x48351d['query']);_0xf768e9[_0x948c('0x3d')]=_[_0x948c('0x35')](_0xf768e9['model'],_0xf768e9[_0x948c('0x33')]);_0x24fc6f[_0x948c('0x37')]=_['intersection'](_0xf768e9['model'],qs[_0x948c('0x38')](_0x48351d[_0x948c('0x33')][_0x948c('0x38')]));_0x24fc6f[_0x948c('0x37')]=_0x24fc6f[_0x948c('0x37')][_0x948c('0x49')]?_0x24fc6f[_0x948c('0x37')]:_0xf768e9[_0x948c('0x36')];if(_0x48351d[_0x948c('0x33')]['includeAll']){_0x24fc6f['include']=[{'all':!![]}];}_0x24fc6f=_[_0x948c('0x40')]({},_0x24fc6f,_0x48351d[_0x948c('0x4a')]);return db[_0x948c('0x2f')][_0x948c('0x4b')](_0x24fc6f)[_0x948c('0x27')](handleEntityNotFound(_0x33a197,null))['then'](respondWithResult(_0x33a197,null))[_0x948c('0x46')](handleError(_0x33a197,null));};exports[_0x948c('0x4c')]=function(_0x21e364,_0x39bb35){return db['MemberReport'][_0x948c('0x4c')](_0x21e364[_0x948c('0x4d')],{})['then'](respondWithResult(_0x39bb35,0xc9))[_0x948c('0x46')](handleError(_0x39bb35,null));};exports[_0x948c('0x4e')]=function(_0x2a99dd,_0x589f68){if(_0x2a99dd['body']['id']){delete _0x2a99dd['body']['id'];}return db[_0x948c('0x2f')][_0x948c('0x4b')]({'where':{'id':_0x2a99dd[_0x948c('0x48')]['id']}})[_0x948c('0x27')](handleEntityNotFound(_0x589f68,null))[_0x948c('0x27')](saveUpdates(_0x2a99dd['body'],null))[_0x948c('0x27')](respondWithResult(_0x589f68,null))[_0x948c('0x46')](handleError(_0x589f68,null));};exports[_0x948c('0x28')]=function(_0x290c63,_0x50c6a7){return db[_0x948c('0x2f')]['find']({'where':{'id':_0x290c63[_0x948c('0x48')]['id']}})[_0x948c('0x27')](handleEntityNotFound(_0x50c6a7,null))['then'](removeEntity(_0x50c6a7,null))[_0x948c('0x46')](handleError(_0x50c6a7,null));};exports[_0x948c('0x4f')]=function(_0x97fbc,_0x50c6e9){return db['MemberReport'][_0x948c('0x4f')]()[_0x948c('0x27')](respondWithResult(_0x50c6e9,null))[_0x948c('0x46')](handleError(_0x50c6e9,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 0c37526..5ac74ae 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 _0xcb50=['define','MemberReport','report_member','membername_interface','membername','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1898b1,_0x85ad5d){var _0x3d2c7f=function(_0x965acf){while(--_0x965acf){_0x1898b1['push'](_0x1898b1['shift']());}};_0x3d2c7f(++_0x85ad5d);}(_0xcb50,0x1a9));var _0x0cb5=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xcb50[_0x511b76];return _0x5424ff;};'use strict';var _=require(_0x0cb5('0x0'));var util=require(_0x0cb5('0x1'));var logger=require(_0x0cb5('0x2'))(_0x0cb5('0x3'));var moment=require('moment');var BPromise=require(_0x0cb5('0x4'));var rp=require(_0x0cb5('0x5'));var fs=require('fs');var path=require(_0x0cb5('0x6'));var rimraf=require(_0x0cb5('0x7'));var config=require(_0x0cb5('0x8'));var attributes=require('./memberReport.attributes');module[_0x0cb5('0x9')]=function(_0xaa8b17,_0x4c9854){return _0xaa8b17[_0x0cb5('0xa')](_0x0cb5('0xb'),attributes,{'tableName':_0x0cb5('0xc'),'paranoid':![],'indexes':[{'name':_0x0cb5('0xd'),'fields':[_0x0cb5('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeed2=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername'];(function(_0x1dd121,_0xb7da38){var _0xd1e9aa=function(_0x413977){while(--_0x413977){_0x1dd121['push'](_0x1dd121['shift']());}};_0xd1e9aa(++_0xb7da38);}(_0xeed2,0xdd));var _0x2eed=function(_0x3b4629,_0x43f70a){_0x3b4629=_0x3b4629-0x0;var _0x4a97cf=_0xeed2[_0x3b4629];return _0x4a97cf;};'use strict';var _=require(_0x2eed('0x0'));var util=require('util');var logger=require(_0x2eed('0x1'))(_0x2eed('0x2'));var moment=require('moment');var BPromise=require(_0x2eed('0x3'));var rp=require(_0x2eed('0x4'));var fs=require('fs');var path=require(_0x2eed('0x5'));var rimraf=require('rimraf');var config=require(_0x2eed('0x6'));var attributes=require('./memberReport.attributes');module[_0x2eed('0x7')]=function(_0x4c6928,_0xe1c249){return _0x4c6928[_0x2eed('0x8')](_0x2eed('0x9'),attributes,{'tableName':_0x2eed('0xa'),'paranoid':![],'indexes':[{'name':_0x2eed('0xb'),'fields':[_0x2eed('0xc'),'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 bff35b1..9b55d29 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 _0xf5e4=['MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMemberReport','findAll','options','raw','attributes','limit','map','include','model','stringify','CreateMemberReport','MemberReport','create','body','update','where','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1302d4,_0x4a3b83){var _0x5694c1=function(_0x3b14fa){while(--_0x3b14fa){_0x1302d4['push'](_0x1302d4['shift']());}};_0x5694c1(++_0x4a3b83);}(_0xf5e4,0x187));var _0x4f5e=function(_0x1612f9,_0x516e36){_0x1612f9=_0x1612f9-0x0;var _0x433985=_0xf5e4[_0x1612f9];return _0x433985;};'use strict';var _=require(_0x4f5e('0x0'));var util=require(_0x4f5e('0x1'));var moment=require(_0x4f5e('0x2'));var BPromise=require(_0x4f5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f5e('0x4'));var db=require(_0x4f5e('0x5'))['db'];var utils=require(_0x4f5e('0x6'));var logger=require(_0x4f5e('0x7'))(_0x4f5e('0x8'));var config=require(_0x4f5e('0x9'));var jayson=require(_0x4f5e('0xa'));var client=jayson[_0x4f5e('0xb')][_0x4f5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f1a81,_0x2b3737,_0x13a44b){return new BPromise(function(_0x5d1961,_0x200603){return client[_0x4f5e('0xd')](_0x3f1a81,_0x13a44b)[_0x4f5e('0xe')](function(_0x3acae8){logger[_0x4f5e('0xf')](_0x4f5e('0x10'),_0x2b3737,_0x4f5e('0x11'));logger[_0x4f5e('0x12')](_0x4f5e('0x13'),_0x2b3737,'request\x20sent',JSON['stringify'](_0x3acae8));if(_0x3acae8[_0x4f5e('0x14')]){if(_0x3acae8['error']['code']===0x1f4){logger[_0x4f5e('0x14')]('MemberReport,\x20%s,\x20%s',_0x2b3737,_0x3acae8[_0x4f5e('0x14')][_0x4f5e('0x15')]);return _0x200603(_0x3acae8[_0x4f5e('0x14')]['message']);}logger[_0x4f5e('0x14')]('MemberReport,\x20%s,\x20%s',_0x2b3737,_0x3acae8['error'][_0x4f5e('0x15')]);return _0x5d1961(_0x3acae8['error'][_0x4f5e('0x15')]);}else{logger[_0x4f5e('0xf')](_0x4f5e('0x10'),_0x2b3737,'request\x20sent');_0x5d1961(_0x3acae8[_0x4f5e('0x16')]['message']);}})[_0x4f5e('0x17')](function(_0x714e4f){logger[_0x4f5e('0x14')](_0x4f5e('0x10'),_0x2b3737,_0x714e4f);_0x200603(_0x714e4f);});});}exports[_0x4f5e('0x18')]=function(_0x381a81){var _0x3e328d=this;return new Promise(function(_0x20a53f,_0x378695){return db['MemberReport'][_0x4f5e('0x19')]({'raw':_0x381a81[_0x4f5e('0x1a')]?_0x381a81[_0x4f5e('0x1a')][_0x4f5e('0x1b')]===undefined?!![]:![]:!![],'where':_0x381a81['options']?_0x381a81[_0x4f5e('0x1a')]['where']||null:null,'attributes':_0x381a81[_0x4f5e('0x1a')]?_0x381a81[_0x4f5e('0x1a')][_0x4f5e('0x1c')]||null:null,'limit':_0x381a81[_0x4f5e('0x1a')]?_0x381a81['options'][_0x4f5e('0x1d')]||null:null,'include':_0x381a81[_0x4f5e('0x1a')]?_0x381a81['options']['include']?_[_0x4f5e('0x1e')](_0x381a81[_0x4f5e('0x1a')][_0x4f5e('0x1f')],function(_0x3805fd){return{'model':db[_0x3805fd[_0x4f5e('0x20')]],'as':_0x3805fd['as'],'attributes':_0x3805fd['attributes'],'include':_0x3805fd[_0x4f5e('0x1f')]?_[_0x4f5e('0x1e')](_0x3805fd[_0x4f5e('0x1f')],function(_0x3249c8){return{'model':db[_0x3249c8[_0x4f5e('0x20')]],'as':_0x3249c8['as'],'attributes':_0x3249c8['attributes'],'include':_0x3249c8[_0x4f5e('0x1f')]?_[_0x4f5e('0x1e')](_0x3249c8[_0x4f5e('0x1f')],function(_0x2cc146){return{'model':db[_0x2cc146[_0x4f5e('0x20')]],'as':_0x2cc146['as'],'attributes':_0x2cc146['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f5e('0xe')](function(_0x367786){logger[_0x4f5e('0xf')](_0x4f5e('0x18'),_0x381a81);logger[_0x4f5e('0x12')](_0x4f5e('0x18'),_0x381a81,JSON[_0x4f5e('0x21')](_0x367786));_0x20a53f(_0x367786);})[_0x4f5e('0x17')](function(_0x4d3355){logger[_0x4f5e('0x14')](_0x4f5e('0x18'),_0x4d3355[_0x4f5e('0x15')],_0x381a81);_0x378695(_0x3e328d['error'](0x1f4,_0x4d3355[_0x4f5e('0x15')]));});});};exports[_0x4f5e('0x22')]=function(_0x5a448c){var _0x5f25e4=this;return new Promise(function(_0x412d07,_0x4cdaae){return db[_0x4f5e('0x23')][_0x4f5e('0x24')](_0x5a448c[_0x4f5e('0x25')],{'raw':_0x5a448c[_0x4f5e('0x1a')]?_0x5a448c[_0x4f5e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x4f5e('0xe')](function(_0x436498){logger[_0x4f5e('0xf')]('CreateMemberReport',_0x5a448c);logger['debug'](_0x4f5e('0x22'),_0x5a448c,JSON[_0x4f5e('0x21')](_0x436498));_0x412d07(_0x436498);})[_0x4f5e('0x17')](function(_0xf94643){logger['error']('CreateMemberReport',_0xf94643[_0x4f5e('0x15')],_0x5a448c);_0x4cdaae(_0x5f25e4[_0x4f5e('0x14')](0x1f4,_0xf94643[_0x4f5e('0x15')]));});});};exports['UpdateMemberReport']=function(_0x2e53d7){var _0x332093=this;return new Promise(function(_0x37885f,_0x1499f7){return db[_0x4f5e('0x23')][_0x4f5e('0x26')](_0x2e53d7['body'],{'raw':_0x2e53d7[_0x4f5e('0x1a')]?_0x2e53d7[_0x4f5e('0x1a')][_0x4f5e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e53d7[_0x4f5e('0x1a')]?_0x2e53d7[_0x4f5e('0x1a')][_0x4f5e('0x27')]||null:null,'attributes':_0x2e53d7['options']?_0x2e53d7[_0x4f5e('0x1a')][_0x4f5e('0x1c')]||null:null,'limit':_0x2e53d7[_0x4f5e('0x1a')]?_0x2e53d7[_0x4f5e('0x1a')][_0x4f5e('0x1d')]||null:null})[_0x4f5e('0xe')](function(_0x42cc76){logger[_0x4f5e('0xf')](_0x4f5e('0x28'),_0x2e53d7);logger[_0x4f5e('0x12')](_0x4f5e('0x28'),_0x2e53d7,JSON[_0x4f5e('0x21')](_0x42cc76));_0x37885f(_0x42cc76);})['catch'](function(_0x1965d6){logger[_0x4f5e('0x14')]('UpdateMemberReport',_0x1965d6[_0x4f5e('0x15')],_0x2e53d7);_0x1499f7(_0x332093[_0x4f5e('0x14')](0x1f4,_0x1965d6[_0x4f5e('0x15')]));});});}; \ No newline at end of file +var _0x18f6=['findAll','options','raw','where','attributes','include','map','model','GetMemberReport','stringify','create','body','CreateMemberReport','update','UpdateMemberReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','MemberReport'];(function(_0x429d9e,_0x35a02f){var _0x4ced0d=function(_0x5a7868){while(--_0x5a7868){_0x429d9e['push'](_0x429d9e['shift']());}};_0x4ced0d(++_0x35a02f);}(_0x18f6,0xc3));var _0x618f=function(_0x4385cb,_0x18b0e1){_0x4385cb=_0x4385cb-0x0;var _0x50ee42=_0x18f6[_0x4385cb];return _0x50ee42;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x618f('0x0'));var BPromise=require(_0x618f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x618f('0x2'));var db=require(_0x618f('0x3'))['db'];var utils=require(_0x618f('0x4'));var logger=require(_0x618f('0x5'))(_0x618f('0x6'));var config=require(_0x618f('0x7'));var jayson=require(_0x618f('0x8'));var client=jayson['client'][_0x618f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da1cc,_0x38dc35,_0x1330d8){return new BPromise(function(_0x3b9881,_0x35f07a){return client[_0x618f('0xa')](_0x3da1cc,_0x1330d8)[_0x618f('0xb')](function(_0x436bac){logger[_0x618f('0xc')]('MemberReport,\x20%s,\x20%s',_0x38dc35,_0x618f('0xd'));logger[_0x618f('0xe')](_0x618f('0xf'),_0x38dc35,'request\x20sent',JSON['stringify'](_0x436bac));if(_0x436bac[_0x618f('0x10')]){if(_0x436bac[_0x618f('0x10')]['code']===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x38dc35,_0x436bac[_0x618f('0x10')]['message']);return _0x35f07a(_0x436bac[_0x618f('0x10')][_0x618f('0x11')]);}logger[_0x618f('0x10')]('MemberReport,\x20%s,\x20%s',_0x38dc35,_0x436bac[_0x618f('0x10')][_0x618f('0x11')]);return _0x3b9881(_0x436bac[_0x618f('0x10')]['message']);}else{logger[_0x618f('0xc')]('MemberReport,\x20%s,\x20%s',_0x38dc35,_0x618f('0xd'));_0x3b9881(_0x436bac[_0x618f('0x12')]['message']);}})[_0x618f('0x13')](function(_0x2a2fc7){logger[_0x618f('0x10')]('MemberReport,\x20%s,\x20%s',_0x38dc35,_0x2a2fc7);_0x35f07a(_0x2a2fc7);});});}exports['GetMemberReport']=function(_0x2f01f){var _0x1686ba=this;return new Promise(function(_0x13af10,_0x31333d){return db[_0x618f('0x14')][_0x618f('0x15')]({'raw':_0x2f01f['options']?_0x2f01f[_0x618f('0x16')][_0x618f('0x17')]===undefined?!![]:![]:!![],'where':_0x2f01f[_0x618f('0x16')]?_0x2f01f['options'][_0x618f('0x18')]||null:null,'attributes':_0x2f01f[_0x618f('0x16')]?_0x2f01f['options'][_0x618f('0x19')]||null:null,'limit':_0x2f01f[_0x618f('0x16')]?_0x2f01f[_0x618f('0x16')]['limit']||null:null,'include':_0x2f01f['options']?_0x2f01f[_0x618f('0x16')][_0x618f('0x1a')]?_[_0x618f('0x1b')](_0x2f01f[_0x618f('0x16')]['include'],function(_0x5330c5){return{'model':db[_0x5330c5[_0x618f('0x1c')]],'as':_0x5330c5['as'],'attributes':_0x5330c5['attributes'],'include':_0x5330c5[_0x618f('0x1a')]?_[_0x618f('0x1b')](_0x5330c5[_0x618f('0x1a')],function(_0x30ac6f){return{'model':db[_0x30ac6f[_0x618f('0x1c')]],'as':_0x30ac6f['as'],'attributes':_0x30ac6f[_0x618f('0x19')],'include':_0x30ac6f[_0x618f('0x1a')]?_[_0x618f('0x1b')](_0x30ac6f['include'],function(_0x1494e4){return{'model':db[_0x1494e4[_0x618f('0x1c')]],'as':_0x1494e4['as'],'attributes':_0x1494e4[_0x618f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17295b){logger[_0x618f('0xc')]('GetMemberReport',_0x2f01f);logger[_0x618f('0xe')](_0x618f('0x1d'),_0x2f01f,JSON[_0x618f('0x1e')](_0x17295b));_0x13af10(_0x17295b);})[_0x618f('0x13')](function(_0x32c975){logger[_0x618f('0x10')](_0x618f('0x1d'),_0x32c975['message'],_0x2f01f);_0x31333d(_0x1686ba[_0x618f('0x10')](0x1f4,_0x32c975[_0x618f('0x11')]));});});};exports['CreateMemberReport']=function(_0x245295){var _0x191d09=this;return new Promise(function(_0x51dc08,_0x525afd){return db[_0x618f('0x14')][_0x618f('0x1f')](_0x245295[_0x618f('0x20')],{'raw':_0x245295['options']?_0x245295[_0x618f('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x618f('0xb')](function(_0xb1f4b0){logger[_0x618f('0xc')](_0x618f('0x21'),_0x245295);logger[_0x618f('0xe')](_0x618f('0x21'),_0x245295,JSON[_0x618f('0x1e')](_0xb1f4b0));_0x51dc08(_0xb1f4b0);})['catch'](function(_0x25f75e){logger['error'](_0x618f('0x21'),_0x25f75e[_0x618f('0x11')],_0x245295);_0x525afd(_0x191d09[_0x618f('0x10')](0x1f4,_0x25f75e[_0x618f('0x11')]));});});};exports['UpdateMemberReport']=function(_0x55eb29){var _0xfddc5a=this;return new Promise(function(_0x5c81fb,_0x4a4824){return db['MemberReport'][_0x618f('0x22')](_0x55eb29['body'],{'raw':_0x55eb29[_0x618f('0x16')]?_0x55eb29[_0x618f('0x16')][_0x618f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55eb29[_0x618f('0x16')]?_0x55eb29[_0x618f('0x16')]['where']||null:null,'attributes':_0x55eb29[_0x618f('0x16')]?_0x55eb29[_0x618f('0x16')][_0x618f('0x19')]||null:null,'limit':_0x55eb29[_0x618f('0x16')]?_0x55eb29['options']['limit']||null:null})['then'](function(_0x3589ee){logger[_0x618f('0xc')](_0x618f('0x23'),_0x55eb29);logger[_0x618f('0xe')](_0x618f('0x23'),_0x55eb29,JSON[_0x618f('0x1e')](_0x3589ee));_0x5c81fb(_0x3589ee);})[_0x618f('0x13')](function(_0x5d9d67){logger[_0x618f('0x10')](_0x618f('0x23'),_0x5d9d67[_0x618f('0x11')],_0x55eb29);_0x4a4824(_0xfddc5a[_0x618f('0x10')](0x1f4,_0x5d9d67[_0x618f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b0a0a7d..63df18b 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 _0x087b=['index','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x14e69e,_0x387b10){var _0x338339=function(_0x348bb0){while(--_0x348bb0){_0x14e69e['push'](_0x14e69e['shift']());}};_0x338339(++_0x387b10);}(_0x087b,0x11a));var _0xb087=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x087b[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var auth=require(_0xb087('0x3'));var interaction=require(_0xb087('0x4'));var config=require(_0xb087('0x5'));var controller=require(_0xb087('0x6'));router[_0xb087('0x7')]('/',controller[_0xb087('0x8')]);module[_0xb087('0x9')]=router; \ No newline at end of file +var _0xc788=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','path','Router'];(function(_0x49a5c6,_0x1758e4){var _0x3f8dc2=function(_0x1ab3c4){while(--_0x1ab3c4){_0x49a5c6['push'](_0x49a5c6['shift']());}};_0x3f8dc2(++_0x1758e4);}(_0xc788,0xc4));var _0x8c78=function(_0x116482,_0x35ddae){_0x116482=_0x116482-0x0;var _0x56db37=_0xc788[_0x116482];return _0x56db37;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get']('/',controller[_0x8c78('0x8')]);module[_0x8c78('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 958909a..30f0188 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 _0x355e=['sequelize','exports','STRING','version'];(function(_0x4d0128,_0x35e2cf){var _0xcb657e=function(_0x277b19){while(--_0x277b19){_0x4d0128['push'](_0x4d0128['shift']());}};_0xcb657e(++_0x35e2cf);}(_0x355e,0x184));var _0xe355=function(_0x2c6f03,_0x3ca413){_0x2c6f03=_0x2c6f03-0x0;var _0x4b1114=_0x355e[_0x2c6f03];return _0x4b1114;};'use strict';var Sequelize=require(_0xe355('0x0'));module[_0xe355('0x1')]={'version':{'type':Sequelize[_0xe355('0x2')],'unique':_0xe355('0x3')}}; \ No newline at end of file +var _0xd6ea=['exports','version'];(function(_0xb2301d,_0x2f5df7){var _0x2b333a=function(_0x4ecd58){while(--_0x4ecd58){_0xb2301d['push'](_0xb2301d['shift']());}};_0x2b333a(++_0x2f5df7);}(_0xd6ea,0x1aa));var _0xad6e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd6ea[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require('sequelize');module[_0xad6e('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xad6e('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index aba9d45..153c514 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 _0x488e=['options','count','includeAll','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','then','end','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x488e,0x18b));var _0xe488=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x488e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe488('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe488('0x1'));var zipdir=require(_0xe488('0x2'));var jsonpatch=require(_0xe488('0x3'));var rp=require('request-promise');var moment=require(_0xe488('0x4'));var BPromise=require(_0xe488('0x5'));var Mustache=require(_0xe488('0x6'));var util=require(_0xe488('0x7'));var path=require(_0xe488('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe488('0x9'));var squel=require(_0xe488('0xa'));var crypto=require(_0xe488('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe488('0xc'));var querystring=require(_0xe488('0xd'));var Papa=require(_0xe488('0xe'));var Redis=require(_0xe488('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe488('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe488('0x11'));var logger=require(_0xe488('0x12'))('api');var utils=require(_0xe488('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe488('0x14'));var db=require(_0xe488('0x15'))['db'];function respondWithStatusCode(_0x4c5f93,_0x581faf){_0x581faf=_0x581faf||0xcc;return function(_0x3514ad){if(_0x3514ad){return _0x4c5f93['sendStatus'](_0x581faf);}return _0x4c5f93[_0xe488('0x16')](_0x581faf)['end']();};}function respondWithResult(_0x389866,_0x23f085){_0x23f085=_0x23f085||0xc8;return function(_0x592892){if(_0x592892){return _0x389866[_0xe488('0x16')](_0x23f085)[_0xe488('0x17')](_0x592892);}};}function respondWithFilteredResult(_0x2895dc,_0x5b0c3b){return function(_0x18c047){if(_0x18c047){var _0x479aa8=_0x18c047['count'],_0xa67d6d=_0x5b0c3b[_0xe488('0x18')],_0x539815=_0x5b0c3b[_0xe488('0x18')]+_0x5b0c3b[_0xe488('0x19')],_0x1fea65;if(_0x539815>=_0x479aa8){_0x539815=_0x479aa8;_0x1fea65=0xc8;}else{_0x1fea65=0xce;}_0x2895dc['status'](_0x1fea65);return _0x2895dc[_0xe488('0x1a')](_0xe488('0x1b'),_0xa67d6d+'-'+_0x539815+'/'+_0x479aa8)[_0xe488('0x17')](_0x18c047);}return null;};}function patchUpdates(_0x2a2d2f){return function(_0x2575b8){try{jsonpatch['apply'](_0x2575b8,_0x2a2d2f,!![]);}catch(_0x14112a){return BPromise[_0xe488('0x1c')](_0x14112a);}return _0x2575b8['save']();};}function saveUpdates(_0x252dca,_0x262e9d){return function(_0x437621){if(_0x437621){return _0x437621['update'](_0x252dca)[_0xe488('0x1d')](function(_0x35c469){return _0x35c469;});}return null;};}function removeEntity(_0x3cbc13,_0x24f02c){return function(_0x5edbe7){if(_0x5edbe7){return _0x5edbe7['destroy']()[_0xe488('0x1d')](function(){_0x3cbc13[_0xe488('0x16')](0xcc)[_0xe488('0x1e')]();});}};}function handleEntityNotFound(_0x5d78a2,_0x33ddce){return function(_0xb35276){if(!_0xb35276){_0x5d78a2[_0xe488('0x1f')](0x194);}return _0xb35276;};}function handleError(_0x528fb4,_0x5bf6e5){_0x5bf6e5=_0x5bf6e5||0x1f4;return function(_0x3a140b){logger[_0xe488('0x20')](_0x3a140b[_0xe488('0x21')]);if(_0x3a140b[_0xe488('0x22')]){delete _0x3a140b['name'];}_0x528fb4[_0xe488('0x16')](_0x5bf6e5)[_0xe488('0x23')](_0x3a140b);};}exports[_0xe488('0x24')]=function(_0x1b8c45,_0x23dac3){var _0x557878={},_0x269bc9={},_0x284118={'count':0x0,'rows':[]};var _0x37a562=_[_0xe488('0x25')](db[_0xe488('0x26')][_0xe488('0x27')],function(_0x46db7d){return{'name':_0x46db7d[_0xe488('0x28')],'type':_0x46db7d[_0xe488('0x29')][_0xe488('0x2a')]};});_0x269bc9[_0xe488('0x2b')]=_[_0xe488('0x25')](_0x37a562,_0xe488('0x22'));_0x269bc9['query']=_[_0xe488('0x2c')](_0x1b8c45[_0xe488('0x2d')]);_0x269bc9['filters']=_[_0xe488('0x2e')](_0x269bc9[_0xe488('0x2b')],_0x269bc9[_0xe488('0x2d')]);_0x557878[_0xe488('0x2f')]=_['intersection'](_0x269bc9['model'],qs[_0xe488('0x30')](_0x1b8c45[_0xe488('0x2d')]['fields']));_0x557878['attributes']=_0x557878[_0xe488('0x2f')][_0xe488('0x31')]?_0x557878[_0xe488('0x2f')]:_0x269bc9['model'];if(!_0x1b8c45['query'][_0xe488('0x32')](_0xe488('0x33'))){_0x557878[_0xe488('0x19')]=qs[_0xe488('0x19')](_0x1b8c45[_0xe488('0x2d')][_0xe488('0x19')]);_0x557878[_0xe488('0x18')]=qs[_0xe488('0x18')](_0x1b8c45['query'][_0xe488('0x18')]);}_0x557878[_0xe488('0x34')]=qs['sort'](_0x1b8c45['query'][_0xe488('0x35')]);_0x557878[_0xe488('0x36')]=qs[_0xe488('0x37')](_[_0xe488('0x38')](_0x1b8c45[_0xe488('0x2d')],_0x269bc9['filters']),_0x37a562);if(_0x1b8c45[_0xe488('0x2d')]['filter']){_0x557878[_0xe488('0x36')]=_['merge'](_0x557878[_0xe488('0x36')],{'$or':_['map'](_0x37a562,function(_0x4e32da){if(_0x4e32da[_0xe488('0x29')]!==_0xe488('0x39')){var _0x465430={};_0x465430[_0x4e32da[_0xe488('0x22')]]={'$like':'%'+_0x1b8c45[_0xe488('0x2d')][_0xe488('0x3a')]+'%'};return _0x465430;}})});}_0x557878=_[_0xe488('0x3b')]({},_0x557878,_0x1b8c45[_0xe488('0x3c')]);var _0x53d200={'where':_0x557878['where']};return db[_0xe488('0x26')][_0xe488('0x3d')](_0x53d200)['then'](function(_0x16f47b){_0x284118[_0xe488('0x3d')]=_0x16f47b;if(_0x1b8c45[_0xe488('0x2d')][_0xe488('0x3e')]){_0x557878['include']=[{'all':!![]}];}return db[_0xe488('0x26')]['findAll'](_0x557878);})[_0xe488('0x1d')](function(_0x305316){_0x284118[_0xe488('0x3f')]=_0x305316;return _0x284118;})[_0xe488('0x1d')](respondWithFilteredResult(_0x23dac3,_0x557878))[_0xe488('0x40')](handleError(_0x23dac3,null));}; \ No newline at end of file +var _0x30f6=['stack','name','send','index','map','Migration','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end'];(function(_0x2a5e73,_0x3ae6de){var _0x5f2152=function(_0x35b1f6){while(--_0x35b1f6){_0x2a5e73['push'](_0x2a5e73['shift']());}};_0x5f2152(++_0x3ae6de);}(_0x30f6,0x160));var _0x630f=function(_0x595e57,_0x476362){_0x595e57=_0x595e57-0x0;var _0xd7a8a8=_0x30f6[_0x595e57];return _0xd7a8a8;};'use strict';var pdf=require(_0x630f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x630f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x630f('0x2'));var moment=require(_0x630f('0x3'));var BPromise=require(_0x630f('0x4'));var Mustache=require(_0x630f('0x5'));var util=require(_0x630f('0x6'));var path=require(_0x630f('0x7'));var sox=require(_0x630f('0x8'));var csv=require(_0x630f('0x9'));var ejs=require(_0x630f('0xa'));var fs=require('fs');var _=require(_0x630f('0xb'));var squel=require(_0x630f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x630f('0xd'));var toCsv=require(_0x630f('0x9'));var querystring=require(_0x630f('0xe'));var Papa=require(_0x630f('0xf'));var Redis=require(_0x630f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x630f('0x11'));var as=require(_0x630f('0x12'));var hardwareService=require(_0x630f('0x13'));var logger=require(_0x630f('0x14'))('api');var utils=require(_0x630f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x630f('0x16'));var db=require(_0x630f('0x17'))['db'];function respondWithStatusCode(_0x32c16e,_0x5e02ce){_0x5e02ce=_0x5e02ce||0xcc;return function(_0xfb4066){if(_0xfb4066){return _0x32c16e[_0x630f('0x18')](_0x5e02ce);}return _0x32c16e[_0x630f('0x19')](_0x5e02ce)['end']();};}function respondWithResult(_0x210cda,_0x379a74){_0x379a74=_0x379a74||0xc8;return function(_0x274566){if(_0x274566){return _0x210cda[_0x630f('0x19')](_0x379a74)[_0x630f('0x1a')](_0x274566);}};}function respondWithFilteredResult(_0x256d00,_0x2dfff7){return function(_0x5b0d8e){if(_0x5b0d8e){var _0x4e39f1=_0x5b0d8e[_0x630f('0x1b')],_0xf771d4=_0x2dfff7[_0x630f('0x1c')],_0x2584bd=_0x2dfff7['offset']+_0x2dfff7[_0x630f('0x1d')],_0x55427b;if(_0x2584bd>=_0x4e39f1){_0x2584bd=_0x4e39f1;_0x55427b=0xc8;}else{_0x55427b=0xce;}_0x256d00[_0x630f('0x19')](_0x55427b);return _0x256d00[_0x630f('0x1e')](_0x630f('0x1f'),_0xf771d4+'-'+_0x2584bd+'/'+_0x4e39f1)[_0x630f('0x1a')](_0x5b0d8e);}return null;};}function patchUpdates(_0x1a616d){return function(_0x31c138){try{jsonpatch[_0x630f('0x20')](_0x31c138,_0x1a616d,!![]);}catch(_0x89dfae){return BPromise['reject'](_0x89dfae);}return _0x31c138[_0x630f('0x21')]();};}function saveUpdates(_0x21a9e2,_0x4fefd2){return function(_0x1542c5){if(_0x1542c5){return _0x1542c5[_0x630f('0x22')](_0x21a9e2)[_0x630f('0x23')](function(_0xc106fc){return _0xc106fc;});}return null;};}function removeEntity(_0x1ac59d,_0xd00bfc){return function(_0x1e9e56){if(_0x1e9e56){return _0x1e9e56[_0x630f('0x24')]()[_0x630f('0x23')](function(){_0x1ac59d[_0x630f('0x19')](0xcc)[_0x630f('0x25')]();});}};}function handleEntityNotFound(_0x16b159,_0x5c1de5){return function(_0x59519d){if(!_0x59519d){_0x16b159[_0x630f('0x18')](0x194);}return _0x59519d;};}function handleError(_0x566fd4,_0x586c22){_0x586c22=_0x586c22||0x1f4;return function(_0x347116){logger['error'](_0x347116[_0x630f('0x26')]);if(_0x347116['name']){delete _0x347116[_0x630f('0x27')];}_0x566fd4[_0x630f('0x19')](_0x586c22)[_0x630f('0x28')](_0x347116);};}exports[_0x630f('0x29')]=function(_0x33c550,_0x487073){var _0x4ae8e8={},_0x13d4c1={},_0x144d63={'count':0x0,'rows':[]};var _0x185560=_[_0x630f('0x2a')](db[_0x630f('0x2b')]['rawAttributes'],function(_0x482dfa){return{'name':_0x482dfa[_0x630f('0x2c')],'type':_0x482dfa['type'][_0x630f('0x2d')]};});_0x13d4c1[_0x630f('0x2e')]=_['map'](_0x185560,'name');_0x13d4c1[_0x630f('0x2f')]=_[_0x630f('0x30')](_0x33c550[_0x630f('0x2f')]);_0x13d4c1['filters']=_['intersection'](_0x13d4c1[_0x630f('0x2e')],_0x13d4c1['query']);_0x4ae8e8[_0x630f('0x31')]=_[_0x630f('0x32')](_0x13d4c1[_0x630f('0x2e')],qs[_0x630f('0x33')](_0x33c550[_0x630f('0x2f')][_0x630f('0x33')]));_0x4ae8e8['attributes']=_0x4ae8e8[_0x630f('0x31')][_0x630f('0x34')]?_0x4ae8e8['attributes']:_0x13d4c1[_0x630f('0x2e')];if(!_0x33c550[_0x630f('0x2f')][_0x630f('0x35')](_0x630f('0x36'))){_0x4ae8e8[_0x630f('0x1d')]=qs[_0x630f('0x1d')](_0x33c550['query'][_0x630f('0x1d')]);_0x4ae8e8[_0x630f('0x1c')]=qs[_0x630f('0x1c')](_0x33c550[_0x630f('0x2f')][_0x630f('0x1c')]);}_0x4ae8e8['order']=qs[_0x630f('0x37')](_0x33c550['query']['sort']);_0x4ae8e8['where']=qs[_0x630f('0x38')](_['pick'](_0x33c550[_0x630f('0x2f')],_0x13d4c1[_0x630f('0x38')]),_0x185560);if(_0x33c550[_0x630f('0x2f')]['filter']){_0x4ae8e8[_0x630f('0x39')]=_['merge'](_0x4ae8e8['where'],{'$or':_['map'](_0x185560,function(_0xb7c412){if(_0xb7c412['type']!==_0x630f('0x3a')){var _0x46d54d={};_0x46d54d[_0xb7c412['name']]={'$like':'%'+_0x33c550['query'][_0x630f('0x3b')]+'%'};return _0x46d54d;}})});}_0x4ae8e8=_['merge']({},_0x4ae8e8,_0x33c550[_0x630f('0x3c')]);var _0xb2f811={'where':_0x4ae8e8[_0x630f('0x39')]};return db['Migration'][_0x630f('0x1b')](_0xb2f811)[_0x630f('0x23')](function(_0x2f93a2){_0x144d63[_0x630f('0x1b')]=_0x2f93a2;if(_0x33c550['query'][_0x630f('0x3d')]){_0x4ae8e8['include']=[{'all':!![]}];}return db[_0x630f('0x2b')][_0x630f('0x3e')](_0x4ae8e8);})[_0x630f('0x23')](function(_0x2fa7d1){_0x144d63[_0x630f('0x3f')]=_0x2fa7d1;return _0x144d63;})[_0x630f('0x23')](respondWithFilteredResult(_0x487073,_0x4ae8e8))[_0x630f('0x40')](handleError(_0x487073,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 05e53c4..df58816 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 _0x03d5=['api','bluebird','request-promise','path','../../config/environment','exports','define','Migration','lodash','util'];(function(_0x28a0f3,_0x90f4c2){var _0x2559dc=function(_0x1aebea){while(--_0x1aebea){_0x28a0f3['push'](_0x28a0f3['shift']());}};_0x2559dc(++_0x90f4c2);}(_0x03d5,0x6c));var _0x503d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x503d('0x0'));var util=require(_0x503d('0x1'));var logger=require('../../config/logger')(_0x503d('0x2'));var moment=require('moment');var BPromise=require(_0x503d('0x3'));var rp=require(_0x503d('0x4'));var fs=require('fs');var path=require(_0x503d('0x5'));var rimraf=require('rimraf');var config=require(_0x503d('0x6'));var attributes=require('./migration.attributes');module[_0x503d('0x7')]=function(_0x4ae581,_0xeb372e){return _0x4ae581[_0x503d('0x8')](_0x503d('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9caa=['./migration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5cdcde,_0xb001a9){var _0x5202ba=function(_0x295037){while(--_0x295037){_0x5cdcde['push'](_0x5cdcde['shift']());}};_0x5202ba(++_0xb001a9);}(_0x9caa,0xbd));var _0xa9ca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9caa[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa9ca('0x0'));var util=require(_0xa9ca('0x1'));var logger=require(_0xa9ca('0x2'))(_0xa9ca('0x3'));var moment=require(_0xa9ca('0x4'));var BPromise=require(_0xa9ca('0x5'));var rp=require(_0xa9ca('0x6'));var fs=require('fs');var path=require(_0xa9ca('0x7'));var rimraf=require('rimraf');var config=require(_0xa9ca('0x8'));var attributes=require(_0xa9ca('0x9'));module['exports']=function(_0x52a502,_0x3aaf8c){return _0x52a502[_0xa9ca('0xa')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e60d0a7..2b1d163 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 _0xd900=['result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x28dea7,_0x457a03){var _0x55f794=function(_0x660219){while(--_0x660219){_0x28dea7['push'](_0x28dea7['shift']());}};_0x55f794(++_0x457a03);}(_0xd900,0x1d0));var _0x0d90=function(_0x128a73,_0x26c676){_0x128a73=_0x128a73-0x0;var _0x210caa=_0xd900[_0x128a73];return _0x210caa;};'use strict';var _=require(_0x0d90('0x0'));var util=require(_0x0d90('0x1'));var moment=require(_0x0d90('0x2'));var BPromise=require(_0x0d90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d90('0x4'));var logger=require(_0x0d90('0x5'))(_0x0d90('0x6'));var config=require(_0x0d90('0x7'));var jayson=require(_0x0d90('0x8'));var client=jayson[_0x0d90('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484c78,_0x4908a4,_0x50a71d){return new BPromise(function(_0x237257,_0x4c6121){return client[_0x0d90('0xa')](_0x484c78,_0x50a71d)[_0x0d90('0xb')](function(_0x524323){logger[_0x0d90('0xc')](_0x0d90('0xd'),_0x4908a4,_0x0d90('0xe'));logger['debug'](_0x0d90('0xf'),_0x4908a4,_0x0d90('0xe'),JSON[_0x0d90('0x10')](_0x524323));if(_0x524323[_0x0d90('0x11')]){if(_0x524323[_0x0d90('0x11')][_0x0d90('0x12')]===0x1f4){logger[_0x0d90('0x11')](_0x0d90('0xd'),_0x4908a4,_0x524323['error'][_0x0d90('0x13')]);return _0x4c6121(_0x524323[_0x0d90('0x11')][_0x0d90('0x13')]);}logger[_0x0d90('0x11')](_0x0d90('0xd'),_0x4908a4,_0x524323['error'][_0x0d90('0x13')]);return _0x237257(_0x524323[_0x0d90('0x11')][_0x0d90('0x13')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x4908a4,_0x0d90('0xe'));_0x237257(_0x524323[_0x0d90('0x14')][_0x0d90('0x13')]);}})[_0x0d90('0x15')](function(_0x4b56bc){logger[_0x0d90('0x11')]('Migration,\x20%s,\x20%s',_0x4908a4,_0x4b56bc);_0x4c6121(_0x4b56bc);});});} \ No newline at end of file +var _0x34d7=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','request\x20sent','debug','error','code','Migration,\x20%s,\x20%s','message','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x34d7,0x13c));var _0x734d=function(_0x3b8c27,_0x3a1693){_0x3b8c27=_0x3b8c27-0x0;var _0x1e1f16=_0x34d7[_0x3b8c27];return _0x1e1f16;};'use strict';var _=require(_0x734d('0x0'));var util=require(_0x734d('0x1'));var moment=require(_0x734d('0x2'));var BPromise=require(_0x734d('0x3'));var rs=require(_0x734d('0x4'));var fs=require('fs');var Redis=require(_0x734d('0x5'));var db=require(_0x734d('0x6'))['db'];var utils=require(_0x734d('0x7'));var logger=require(_0x734d('0x8'))(_0x734d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x734d('0xa')][_0x734d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fa2e9,_0x3cf815,_0x4d7313){return new BPromise(function(_0x1c07f0,_0x2cb371){return client[_0x734d('0xc')](_0x1fa2e9,_0x4d7313)['then'](function(_0x20595a){logger['info']('Migration,\x20%s,\x20%s',_0x3cf815,_0x734d('0xd'));logger[_0x734d('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x3cf815,_0x734d('0xd'),JSON['stringify'](_0x20595a));if(_0x20595a[_0x734d('0xf')]){if(_0x20595a[_0x734d('0xf')][_0x734d('0x10')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x3cf815,_0x20595a[_0x734d('0xf')]['message']);return _0x2cb371(_0x20595a[_0x734d('0xf')]['message']);}logger[_0x734d('0xf')](_0x734d('0x11'),_0x3cf815,_0x20595a[_0x734d('0xf')][_0x734d('0x12')]);return _0x1c07f0(_0x20595a[_0x734d('0xf')][_0x734d('0x12')]);}else{logger['info'](_0x734d('0x11'),_0x3cf815,_0x734d('0xd'));_0x1c07f0(_0x20595a[_0x734d('0x13')]['message']);}})[_0x734d('0x14')](function(_0x192822){logger[_0x734d('0xf')]('Migration,\x20%s,\x20%s',_0x3cf815,_0x192822);_0x2cb371(_0x192822);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5f0d5a1..713f5c1 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 _0xf569=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','util','path'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xf569,0x86));var _0x9f56=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xf569[_0x58e469];return _0x4c01c5;};'use strict';var multer=require('multer');var util=require(_0x9f56('0x0'));var path=require(_0x9f56('0x1'));var timeout=require(_0x9f56('0x2'));var express=require(_0x9f56('0x3'));var router=express[_0x9f56('0x4')]();var auth=require(_0x9f56('0x5'));var interaction=require(_0x9f56('0x6'));var config=require('../../config/environment');var controller=require(_0x9f56('0x7'));router[_0x9f56('0x8')]('/',auth[_0x9f56('0x9')](),controller[_0x9f56('0xa')]);router[_0x9f56('0x8')](_0x9f56('0xb'),auth[_0x9f56('0x9')](),controller[_0x9f56('0xc')]);router['post']('/',auth[_0x9f56('0x9')](),controller[_0x9f56('0xd')]);router['put'](_0x9f56('0xb'),auth[_0x9f56('0x9')](),controller[_0x9f56('0xe')]);router['delete']('/:id',auth[_0x9f56('0x9')](),controller[_0x9f56('0xf')]);module[_0x9f56('0x10')]=router; \ No newline at end of file +var _0x5bb0=['/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x52b8f0,_0x31bd01){var _0x55aa91=function(_0x45beba){while(--_0x45beba){_0x52b8f0['push'](_0x52b8f0['shift']());}};_0x55aa91(++_0x31bd01);}(_0x5bb0,0xf3));var _0x05bb=function(_0xc3fa46,_0x1ccaee){_0xc3fa46=_0xc3fa46-0x0;var _0x1d627a=_0x5bb0[_0xc3fa46];return _0x1d627a;};'use strict';var multer=require(_0x05bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05bb('0x1'));var express=require('express');var router=express[_0x05bb('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x05bb('0x3'));var config=require(_0x05bb('0x4'));var controller=require(_0x05bb('0x5'));router[_0x05bb('0x6')]('/',auth[_0x05bb('0x7')](),controller[_0x05bb('0x8')]);router[_0x05bb('0x6')](_0x05bb('0x9'),auth[_0x05bb('0x7')](),controller[_0x05bb('0xa')]);router[_0x05bb('0xb')]('/',auth[_0x05bb('0x7')](),controller[_0x05bb('0xc')]);router[_0x05bb('0xd')](_0x05bb('0x9'),auth[_0x05bb('0x7')](),controller[_0x05bb('0xe')]);router[_0x05bb('0xf')](_0x05bb('0x9'),auth[_0x05bb('0x7')](),controller[_0x05bb('0x10')]);module[_0x05bb('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 a82917f..7c0f9c9 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x336b21,_0x344adf){var _0x35c696=function(_0x35a4cf){while(--_0x35a4cf){_0x336b21['push'](_0x336b21['shift']());}};_0x35c696(++_0x344adf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x59caad,_0x17a4df){var _0x1e4239=function(_0x4f7826){while(--_0x4f7826){_0x59caad['push'](_0x59caad['shift']());}};_0x1e4239(++_0x17a4df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c0cec50..c0c8098 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 _0x6b9c=['rows','show','params','keys','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','create','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','transaction','res_stun_monitor.so','find','server/files/templates/turn_multiple.ejs','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x6b9c,0x8a));var _0xc6b9=function(_0x29914a,_0x380e39){_0x29914a=_0x29914a-0x0;var _0x37fb65=_0x6b9c[_0x29914a];return _0x37fb65;};'use strict';var pdf=require(_0xc6b9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc6b9('0x1'));var jsonpatch=require(_0xc6b9('0x2'));var rp=require(_0xc6b9('0x3'));var moment=require(_0xc6b9('0x4'));var BPromise=require(_0xc6b9('0x5'));var Mustache=require(_0xc6b9('0x6'));var util=require(_0xc6b9('0x7'));var path=require(_0xc6b9('0x8'));var sox=require('sox');var csv=require(_0xc6b9('0x9'));var ejs=require(_0xc6b9('0xa'));var fs=require('fs');var _=require(_0xc6b9('0xb'));var squel=require(_0xc6b9('0xc'));var crypto=require(_0xc6b9('0xd'));var jsforce=require(_0xc6b9('0xe'));var deskjs=require(_0xc6b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc6b9('0x10'));var Papa=require(_0xc6b9('0x11'));var Redis=require(_0xc6b9('0x12'));var authService=require(_0xc6b9('0x13'));var qs=require(_0xc6b9('0x14'));var as=require(_0xc6b9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6b9('0x16'))('api');var utils=require(_0xc6b9('0x17'));var config=require(_0xc6b9('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xc6b9('0x19'));var client=jayson[_0xc6b9('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x275984,_0x2a0206,_0xfe23f3,_0x5ab07b){return new BPromise(function(_0x5842c5,_0x134c5e){var _0x4175e7=_0x5ab07b||client;return _0x4175e7[_0xc6b9('0x1b')](_0x275984,_0xfe23f3)[_0xc6b9('0x1c')](function(_0x5ef14c){logger[_0xc6b9('0x1d')](_0xc6b9('0x1e'),_0x2a0206,'request\x20sent');logger[_0xc6b9('0x1f')](_0xc6b9('0x20'),_0x2a0206,'request\x20sent',JSON[_0xc6b9('0x21')](_0x5ef14c));if(_0x5ef14c[_0xc6b9('0x22')]){if(_0x5ef14c[_0xc6b9('0x22')]['code']===0x1f4){logger[_0xc6b9('0x22')]('Network,\x20%s,\x20%s',_0x2a0206,_0x5ef14c[_0xc6b9('0x22')]['message']);return _0x134c5e(_0x5ef14c['error'][_0xc6b9('0x23')]);}logger[_0xc6b9('0x22')]('Network,\x20%s,\x20%s',_0x2a0206,_0x5ef14c['error'][_0xc6b9('0x23')]);return _0x5842c5(_0x5ef14c[_0xc6b9('0x22')]['message']);}else{logger[_0xc6b9('0x1d')](_0xc6b9('0x1e'),_0x2a0206,'request\x20sent');_0x5842c5(_0x5ef14c[_0xc6b9('0x24')][_0xc6b9('0x23')]);}})[_0xc6b9('0x25')](function(_0x52f001){logger[_0xc6b9('0x22')](_0xc6b9('0x1e'),_0x2a0206,_0x52f001);_0x134c5e(_0x52f001);});});}function respondWithStatusCode(_0x1d1dbd,_0x428236){_0x428236=_0x428236||0xcc;return function(_0x315000){if(_0x315000){return _0x1d1dbd['sendStatus'](_0x428236);}return _0x1d1dbd[_0xc6b9('0x26')](_0x428236)[_0xc6b9('0x27')]();};}function respondWithResult(_0x5b6e7a,_0x150e01){_0x150e01=_0x150e01||0xc8;return function(_0xf37760){if(_0xf37760){return _0x5b6e7a['status'](_0x150e01)[_0xc6b9('0x28')](_0xf37760);}};}function respondWithFilteredResult(_0x1898b8,_0x4ed301){return function(_0x3fd499){if(_0x3fd499){var _0xe61ff0=_0x3fd499[_0xc6b9('0x29')],_0x1b285a=_0x4ed301[_0xc6b9('0x2a')],_0x265eec=_0x4ed301['offset']+_0x4ed301[_0xc6b9('0x2b')],_0x2ce824;if(_0x265eec>=_0xe61ff0){_0x265eec=_0xe61ff0;_0x2ce824=0xc8;}else{_0x2ce824=0xce;}_0x1898b8[_0xc6b9('0x26')](_0x2ce824);return _0x1898b8[_0xc6b9('0x2c')](_0xc6b9('0x2d'),_0x1b285a+'-'+_0x265eec+'/'+_0xe61ff0)[_0xc6b9('0x28')](_0x3fd499);}return null;};}function patchUpdates(_0x2455fc){return function(_0x4dc729){try{jsonpatch[_0xc6b9('0x2e')](_0x4dc729,_0x2455fc,!![]);}catch(_0x2d09fb){return BPromise[_0xc6b9('0x2f')](_0x2d09fb);}return _0x4dc729['save']();};}function saveUpdates(_0x5a1489,_0x25e970){return function(_0x1ea0ae){if(_0x1ea0ae){return _0x1ea0ae[_0xc6b9('0x30')](_0x5a1489)[_0xc6b9('0x1c')](function(_0xd067fc){return _0xd067fc;});}return null;};}function removeEntity(_0x3f2676,_0x76b715){return function(_0x2c7ba7){if(_0x2c7ba7){return _0x2c7ba7[_0xc6b9('0x31')]()[_0xc6b9('0x1c')](function(){_0x3f2676['status'](0xcc)[_0xc6b9('0x27')]();});}};}function handleEntityNotFound(_0x1a8dbe,_0x5af41d){return function(_0xe258da){if(!_0xe258da){_0x1a8dbe[_0xc6b9('0x32')](0x194);}return _0xe258da;};}function handleError(_0x31f176,_0x36ee05){_0x36ee05=_0x36ee05||0x1f4;return function(_0x1edf2b){logger[_0xc6b9('0x22')](_0x1edf2b[_0xc6b9('0x33')]);if(_0x1edf2b[_0xc6b9('0x34')]){delete _0x1edf2b[_0xc6b9('0x34')];}_0x31f176[_0xc6b9('0x26')](_0x36ee05)[_0xc6b9('0x35')](_0x1edf2b);};}exports[_0xc6b9('0x36')]=function(_0xde6137,_0x31c533){var _0x4b24d6={},_0x2ba7e6={},_0x5e6173={'count':0x0,'rows':[]};var _0x3c0aa2=_['map'](db[_0xc6b9('0x37')][_0xc6b9('0x38')],function(_0x2bb48d){return{'name':_0x2bb48d[_0xc6b9('0x39')],'type':_0x2bb48d[_0xc6b9('0x3a')][_0xc6b9('0x3b')]};});_0x2ba7e6[_0xc6b9('0x3c')]=_[_0xc6b9('0x3d')](_0x3c0aa2,_0xc6b9('0x34'));_0x2ba7e6[_0xc6b9('0x3e')]=_['keys'](_0xde6137[_0xc6b9('0x3e')]);_0x2ba7e6[_0xc6b9('0x3f')]=_[_0xc6b9('0x40')](_0x2ba7e6['model'],_0x2ba7e6[_0xc6b9('0x3e')]);_0x4b24d6['attributes']=_[_0xc6b9('0x40')](_0x2ba7e6['model'],qs[_0xc6b9('0x41')](_0xde6137[_0xc6b9('0x3e')][_0xc6b9('0x41')]));_0x4b24d6['attributes']=_0x4b24d6[_0xc6b9('0x42')][_0xc6b9('0x43')]?_0x4b24d6[_0xc6b9('0x42')]:_0x2ba7e6[_0xc6b9('0x3c')];if(!_0xde6137[_0xc6b9('0x3e')]['hasOwnProperty'](_0xc6b9('0x44'))){_0x4b24d6[_0xc6b9('0x2b')]=qs['limit'](_0xde6137['query']['limit']);_0x4b24d6[_0xc6b9('0x2a')]=qs['offset'](_0xde6137[_0xc6b9('0x3e')][_0xc6b9('0x2a')]);}_0x4b24d6[_0xc6b9('0x45')]=qs[_0xc6b9('0x46')](_0xde6137[_0xc6b9('0x3e')][_0xc6b9('0x46')]);_0x4b24d6['where']=qs[_0xc6b9('0x3f')](_[_0xc6b9('0x47')](_0xde6137[_0xc6b9('0x3e')],_0x2ba7e6[_0xc6b9('0x3f')]),_0x3c0aa2);if(_0xde6137[_0xc6b9('0x3e')][_0xc6b9('0x48')]){_0x4b24d6[_0xc6b9('0x49')]=_[_0xc6b9('0x4a')](_0x4b24d6[_0xc6b9('0x49')],{'$or':_[_0xc6b9('0x3d')](_0x3c0aa2,function(_0x1b1da4){if(_0x1b1da4['type']!==_0xc6b9('0x4b')){var _0x1f95aa={};_0x1f95aa[_0x1b1da4[_0xc6b9('0x34')]]={'$like':'%'+_0xde6137[_0xc6b9('0x3e')]['filter']+'%'};return _0x1f95aa;}})});}_0x4b24d6=_[_0xc6b9('0x4a')]({},_0x4b24d6,_0xde6137[_0xc6b9('0x4c')]);var _0x1659e6={'where':_0x4b24d6[_0xc6b9('0x49')]};return db[_0xc6b9('0x37')]['count'](_0x1659e6)[_0xc6b9('0x1c')](function(_0x1896f2){_0x5e6173[_0xc6b9('0x29')]=_0x1896f2;if(_0xde6137[_0xc6b9('0x3e')][_0xc6b9('0x4d')]){_0x4b24d6[_0xc6b9('0x4e')]=[{'all':!![]}];}return db[_0xc6b9('0x37')][_0xc6b9('0x4f')](_0x4b24d6);})[_0xc6b9('0x1c')](function(_0xfb6bdf){_0x5e6173[_0xc6b9('0x50')]=_0xfb6bdf;return _0x5e6173;})['then'](respondWithFilteredResult(_0x31c533,_0x4b24d6))[_0xc6b9('0x25')](handleError(_0x31c533,null));};exports[_0xc6b9('0x51')]=function(_0x13e189,_0x15744b){var _0x156490={'raw':!![],'where':{'id':_0x13e189[_0xc6b9('0x52')]['id']}},_0x18d3d6={};_0x18d3d6[_0xc6b9('0x3c')]=_[_0xc6b9('0x53')](db[_0xc6b9('0x37')][_0xc6b9('0x38')]);_0x18d3d6[_0xc6b9('0x3e')]=_[_0xc6b9('0x53')](_0x13e189[_0xc6b9('0x3e')]);_0x18d3d6[_0xc6b9('0x3f')]=_[_0xc6b9('0x40')](_0x18d3d6[_0xc6b9('0x3c')],_0x18d3d6[_0xc6b9('0x3e')]);_0x156490['attributes']=_[_0xc6b9('0x40')](_0x18d3d6['model'],qs[_0xc6b9('0x41')](_0x13e189[_0xc6b9('0x3e')][_0xc6b9('0x41')]));_0x156490[_0xc6b9('0x42')]=_0x156490[_0xc6b9('0x42')]['length']?_0x156490[_0xc6b9('0x42')]:_0x18d3d6[_0xc6b9('0x3c')];if(_0x13e189[_0xc6b9('0x3e')][_0xc6b9('0x4d')]){_0x156490[_0xc6b9('0x4e')]=[{'all':!![]}];}_0x156490=_['merge']({},_0x156490,_0x13e189[_0xc6b9('0x4c')]);return db[_0xc6b9('0x37')]['find'](_0x156490)[_0xc6b9('0x1c')](handleEntityNotFound(_0x15744b,null))[_0xc6b9('0x1c')](respondWithResult(_0x15744b,null))[_0xc6b9('0x25')](handleError(_0x15744b,null));};exports['create']=function(_0x3f537b,_0x2edc28,_0x4b9c12){var _0xf993e7;return db['sequelize']['transaction'](function(_0x135acb){return db[_0xc6b9('0x37')]['create'](_0x3f537b[_0xc6b9('0x54')],{'raw':!![]})[_0xc6b9('0x1c')](function(_0x2fe623){_0xf993e7=_0x2fe623;return db[_0xc6b9('0x37')][_0xc6b9('0x4f')]({'where':{'type':_0x3f537b['body']['type']},'raw':!![]});})['then'](function(_0x7966d8){if(_0xf993e7['type'][_0xc6b9('0x55')]()==_0xc6b9('0x56')){var _0x2a3204=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config[_0xc6b9('0x59')],_0xc6b9('0x5a')),_0xc6b9('0x5b'));var _0x3ac368=ejs[_0xc6b9('0x5c')](_0x2a3204,{'networks':_0x7966d8||[]});fs[_0xc6b9('0x5d')](_0xc6b9('0x5e'),_0x3ac368);return respondWithRpcPromise(_0xc6b9('0x5f'),_0xc6b9('0x60'),{'module':'res_stun_monitor.so'});}else if(_0xf993e7[_0xc6b9('0x3a')][_0xc6b9('0x55')]()==_0xc6b9('0x61')){var _0x1976f6=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config[_0xc6b9('0x59')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x28ec02=ejs['render'](_0x1976f6,{'networks':_0x7966d8||[]});fs[_0xc6b9('0x5d')](_0xc6b9('0x62'),_0x28ec02);return respondWithRpcPromise(_0xc6b9('0x5f'),_0xc6b9('0x60'),{'module':'res_stun_monitor.so'});}else{var _0x15f830=fs['readFileSync'](path['join'](config['root'],_0xc6b9('0x63')),_0xc6b9('0x5b'));var _0x286f0c=ejs['render'](_0x15f830,{'networks':_0x7966d8||[]});fs[_0xc6b9('0x5d')](util[_0xc6b9('0x64')](_0xc6b9('0x65'),_0x3f537b[_0xc6b9('0x54')][_0xc6b9('0x3a')][_0xc6b9('0x66')]()),_0x286f0c);return respondWithRpcPromise(_0xc6b9('0x5f'),_0xc6b9('0x60'),{'module':_0xc6b9('0x67')});}return null;})[_0xc6b9('0x1c')](function(){return _0xf993e7;});})[_0xc6b9('0x1c')](respondWithResult(_0x2edc28,0xc9))[_0xc6b9('0x25')](handleError(_0x2edc28,null));};exports[_0xc6b9('0x30')]=function(_0x31b4f7,_0x35fd8d,_0x47f2b0){var _0x30ba34;return db[_0xc6b9('0x68')][_0xc6b9('0x69')](function(_0x362b56){return db[_0xc6b9('0x37')]['find']({'where':{'id':_0x31b4f7[_0xc6b9('0x52')]['id']}})[_0xc6b9('0x1c')](handleEntityNotFound(_0x35fd8d,null))[_0xc6b9('0x1c')](saveUpdates(_0x31b4f7[_0xc6b9('0x54')],null))[_0xc6b9('0x1c')](function(_0x508e37){if(_0x508e37){_0x30ba34=_0x508e37;return db['Network'][_0xc6b9('0x4f')]({'where':{'type':_0x30ba34['type']},'raw':!![]});}return null;})[_0xc6b9('0x1c')](function(_0x5e1ef1){if(_0x30ba34[_0xc6b9('0x3a')][_0xc6b9('0x55')]()=='STUN'){var _0x2f3a6e=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config[_0xc6b9('0x59')],_0xc6b9('0x5a')),_0xc6b9('0x5b'));var _0x5c4895=ejs[_0xc6b9('0x5c')](_0x2f3a6e,{'networks':_0x5e1ef1||[]});fs[_0xc6b9('0x5d')](_0xc6b9('0x5e'),_0x5c4895);return respondWithRpcPromise(_0xc6b9('0x5f'),_0xc6b9('0x30'),{'module':_0xc6b9('0x6a')});}else if(_0x30ba34[_0xc6b9('0x3a')][_0xc6b9('0x55')]()==_0xc6b9('0x61')){var _0x5d0ea5=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xc6b9('0x5b'));var _0x31b603=ejs[_0xc6b9('0x5c')](_0x5d0ea5,{'networks':_0x5e1ef1||[]});fs[_0xc6b9('0x5d')](_0xc6b9('0x62'),_0x31b603);return respondWithRpcPromise(_0xc6b9('0x5f'),_0xc6b9('0x30'),{'module':_0xc6b9('0x6a')});}else{var _0x1bbb5d=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config[_0xc6b9('0x59')],_0xc6b9('0x63')),'utf8');var _0x155f83=ejs['render'](_0x1bbb5d,{'networks':_0x5e1ef1||[]});fs[_0xc6b9('0x5d')](util[_0xc6b9('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x31b4f7[_0xc6b9('0x54')][_0xc6b9('0x3a')][_0xc6b9('0x66')]()),_0x155f83);return respondWithRpcPromise(_0xc6b9('0x5f'),'update',{'module':_0xc6b9('0x67')});}return null;})[_0xc6b9('0x1c')](function(_0xff46b7){if(_0xff46b7){return _0x30ba34;}return null;});})['then'](respondWithResult(_0x35fd8d,null))[_0xc6b9('0x25')](handleError(_0x35fd8d,null));};exports['destroy']=function(_0x523c2c,_0x24a409,_0x1c9063){var _0x3294a3;return db[_0xc6b9('0x37')][_0xc6b9('0x6b')]({'where':{'id':_0x523c2c[_0xc6b9('0x52')]['id']}})[_0xc6b9('0x1c')](function(_0x27ed0d){_0x3294a3=_0x27ed0d;return _0x27ed0d;})[_0xc6b9('0x1c')](handleEntityNotFound(_0x24a409,null))[_0xc6b9('0x1c')](removeEntity(_0x24a409,null))[_0xc6b9('0x1c')](function(){if(_0x3294a3){return db[_0xc6b9('0x37')]['findAll']({'where':{'type':_0x3294a3[_0xc6b9('0x3a')]},'raw':!![]});}})[_0xc6b9('0x1c')](function(_0x5af899){if(_0x3294a3[_0xc6b9('0x3a')]['toUpperCase']()==_0xc6b9('0x56')){var _0x108774=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config[_0xc6b9('0x59')],_0xc6b9('0x5a')),_0xc6b9('0x5b'));var _0x1672b8=ejs[_0xc6b9('0x5c')](_0x108774,{'networks':_0x5af899||[]});fs[_0xc6b9('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x1672b8);return respondWithRpcPromise(_0xc6b9('0x5f'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x3294a3[_0xc6b9('0x3a')][_0xc6b9('0x55')]()==_0xc6b9('0x61')){var _0x5807cc=fs[_0xc6b9('0x57')](path[_0xc6b9('0x58')](config['root'],_0xc6b9('0x6c')),_0xc6b9('0x5b'));var _0x2ff3e2=ejs['render'](_0x5807cc,{'networks':_0x5af899||[]});fs[_0xc6b9('0x5d')]('/etc/asterisk/turn_xcally.conf',_0x2ff3e2);return respondWithRpcPromise(_0xc6b9('0x5f'),_0xc6b9('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x1d16e8=fs['readFileSync'](path[_0xc6b9('0x58')](config[_0xc6b9('0x59')],'server/files/templates/network.ejs'),_0xc6b9('0x5b'));var _0x376002=ejs[_0xc6b9('0x5c')](_0x1d16e8,{'networks':_0x5af899||[]});fs[_0xc6b9('0x5d')](util[_0xc6b9('0x64')](_0xc6b9('0x65'),_0x523c2c[_0xc6b9('0x54')][_0xc6b9('0x3a')][_0xc6b9('0x66')]()),_0x376002);return respondWithRpcPromise('Reload',_0xc6b9('0x31'),{'module':_0xc6b9('0x67')});}return null;})[_0xc6b9('0x25')](handleError(_0x24a409,null));}; \ No newline at end of file +var _0x0a45=['join','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','STUN','server/files/templates/stun_multiple.ejs','chan_sip.so','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','count','includeAll','show','params','include','catch','create','sequelize','findAll','body','toUpperCase','readFileSync','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0a45,0x78));var _0x50a4=function(_0x15771c,_0x3ced9d){_0x15771c=_0x15771c-0x0;var _0x31e026=_0x0a45[_0x15771c];return _0x31e026;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x50a4('0x0'));var zipdir=require(_0x50a4('0x1'));var jsonpatch=require(_0x50a4('0x2'));var rp=require(_0x50a4('0x3'));var moment=require(_0x50a4('0x4'));var BPromise=require(_0x50a4('0x5'));var Mustache=require(_0x50a4('0x6'));var util=require(_0x50a4('0x7'));var path=require(_0x50a4('0x8'));var sox=require(_0x50a4('0x9'));var csv=require(_0x50a4('0xa'));var ejs=require(_0x50a4('0xb'));var fs=require('fs');var _=require(_0x50a4('0xc'));var squel=require(_0x50a4('0xd'));var crypto=require(_0x50a4('0xe'));var jsforce=require(_0x50a4('0xf'));var deskjs=require(_0x50a4('0x10'));var toCsv=require(_0x50a4('0xa'));var querystring=require(_0x50a4('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x50a4('0x12'));var qs=require(_0x50a4('0x13'));var as=require(_0x50a4('0x14'));var hardwareService=require(_0x50a4('0x15'));var logger=require(_0x50a4('0x16'))(_0x50a4('0x17'));var utils=require(_0x50a4('0x18'));var config=require(_0x50a4('0x19'));var licenseUtil=require(_0x50a4('0x1a'));var db=require(_0x50a4('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x50a4('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100c6e,_0x4c4e0a,_0x4061f3,_0x300caf){return new BPromise(function(_0x1c0c9e,_0x3fffbf){var _0x420afa=_0x300caf||client;return _0x420afa[_0x50a4('0x1d')](_0x100c6e,_0x4061f3)[_0x50a4('0x1e')](function(_0x5dfea1){logger[_0x50a4('0x1f')](_0x50a4('0x20'),_0x4c4e0a,_0x50a4('0x21'));logger['debug'](_0x50a4('0x22'),_0x4c4e0a,_0x50a4('0x21'),JSON['stringify'](_0x5dfea1));if(_0x5dfea1[_0x50a4('0x23')]){if(_0x5dfea1[_0x50a4('0x23')][_0x50a4('0x24')]===0x1f4){logger[_0x50a4('0x23')](_0x50a4('0x20'),_0x4c4e0a,_0x5dfea1['error'][_0x50a4('0x25')]);return _0x3fffbf(_0x5dfea1[_0x50a4('0x23')][_0x50a4('0x25')]);}logger[_0x50a4('0x23')](_0x50a4('0x20'),_0x4c4e0a,_0x5dfea1[_0x50a4('0x23')]['message']);return _0x1c0c9e(_0x5dfea1[_0x50a4('0x23')]['message']);}else{logger[_0x50a4('0x1f')]('Network,\x20%s,\x20%s',_0x4c4e0a,_0x50a4('0x21'));_0x1c0c9e(_0x5dfea1[_0x50a4('0x26')]['message']);}})['catch'](function(_0x3ee570){logger[_0x50a4('0x23')](_0x50a4('0x20'),_0x4c4e0a,_0x3ee570);_0x3fffbf(_0x3ee570);});});}function respondWithStatusCode(_0x111773,_0x50628b){_0x50628b=_0x50628b||0xcc;return function(_0x183815){if(_0x183815){return _0x111773[_0x50a4('0x27')](_0x50628b);}return _0x111773[_0x50a4('0x28')](_0x50628b)[_0x50a4('0x29')]();};}function respondWithResult(_0x10eba1,_0x4341e5){_0x4341e5=_0x4341e5||0xc8;return function(_0x46f89a){if(_0x46f89a){return _0x10eba1[_0x50a4('0x28')](_0x4341e5)[_0x50a4('0x2a')](_0x46f89a);}};}function respondWithFilteredResult(_0x3f591e,_0x4d29a0){return function(_0x23c693){if(_0x23c693){var _0xa7a2ba=_0x23c693['count'],_0xdbb9d7=_0x4d29a0['offset'],_0x207e2c=_0x4d29a0['offset']+_0x4d29a0[_0x50a4('0x2b')],_0x5574ac;if(_0x207e2c>=_0xa7a2ba){_0x207e2c=_0xa7a2ba;_0x5574ac=0xc8;}else{_0x5574ac=0xce;}_0x3f591e[_0x50a4('0x28')](_0x5574ac);return _0x3f591e[_0x50a4('0x2c')]('Content-Range',_0xdbb9d7+'-'+_0x207e2c+'/'+_0xa7a2ba)[_0x50a4('0x2a')](_0x23c693);}return null;};}function patchUpdates(_0x4b91f7){return function(_0x49ea9f){try{jsonpatch[_0x50a4('0x2d')](_0x49ea9f,_0x4b91f7,!![]);}catch(_0x3db06a){return BPromise[_0x50a4('0x2e')](_0x3db06a);}return _0x49ea9f[_0x50a4('0x2f')]();};}function saveUpdates(_0x1302b2,_0x545b77){return function(_0x6e5b71){if(_0x6e5b71){return _0x6e5b71[_0x50a4('0x30')](_0x1302b2)[_0x50a4('0x1e')](function(_0x2eaa9c){return _0x2eaa9c;});}return null;};}function removeEntity(_0x2cfc28,_0x218e56){return function(_0x4b51b1){if(_0x4b51b1){return _0x4b51b1[_0x50a4('0x31')]()[_0x50a4('0x1e')](function(){_0x2cfc28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x292dfc,_0x3ca20a){return function(_0x1d7bc9){if(!_0x1d7bc9){_0x292dfc[_0x50a4('0x27')](0x194);}return _0x1d7bc9;};}function handleError(_0x17016a,_0x6aa9b9){_0x6aa9b9=_0x6aa9b9||0x1f4;return function(_0xd68bfa){logger['error'](_0xd68bfa[_0x50a4('0x32')]);if(_0xd68bfa[_0x50a4('0x33')]){delete _0xd68bfa[_0x50a4('0x33')];}_0x17016a['status'](_0x6aa9b9)[_0x50a4('0x34')](_0xd68bfa);};}exports[_0x50a4('0x35')]=function(_0x74bc62,_0x5c026e){var _0x151198={},_0x1c0705={},_0x31eeac={'count':0x0,'rows':[]};var _0x365a2d=_[_0x50a4('0x36')](db[_0x50a4('0x37')][_0x50a4('0x38')],function(_0x31f133){return{'name':_0x31f133[_0x50a4('0x39')],'type':_0x31f133[_0x50a4('0x3a')][_0x50a4('0x3b')]};});_0x1c0705[_0x50a4('0x3c')]=_[_0x50a4('0x36')](_0x365a2d,_0x50a4('0x33'));_0x1c0705[_0x50a4('0x3d')]=_[_0x50a4('0x3e')](_0x74bc62[_0x50a4('0x3d')]);_0x1c0705[_0x50a4('0x3f')]=_[_0x50a4('0x40')](_0x1c0705[_0x50a4('0x3c')],_0x1c0705[_0x50a4('0x3d')]);_0x151198[_0x50a4('0x41')]=_[_0x50a4('0x40')](_0x1c0705['model'],qs['fields'](_0x74bc62[_0x50a4('0x3d')][_0x50a4('0x42')]));_0x151198['attributes']=_0x151198[_0x50a4('0x41')][_0x50a4('0x43')]?_0x151198[_0x50a4('0x41')]:_0x1c0705['model'];if(!_0x74bc62[_0x50a4('0x3d')][_0x50a4('0x44')](_0x50a4('0x45'))){_0x151198[_0x50a4('0x2b')]=qs['limit'](_0x74bc62[_0x50a4('0x3d')]['limit']);_0x151198['offset']=qs['offset'](_0x74bc62['query'][_0x50a4('0x46')]);}_0x151198['order']=qs[_0x50a4('0x47')](_0x74bc62[_0x50a4('0x3d')][_0x50a4('0x47')]);_0x151198[_0x50a4('0x48')]=qs[_0x50a4('0x3f')](_['pick'](_0x74bc62[_0x50a4('0x3d')],_0x1c0705[_0x50a4('0x3f')]),_0x365a2d);if(_0x74bc62['query'][_0x50a4('0x49')]){_0x151198[_0x50a4('0x48')]=_[_0x50a4('0x4a')](_0x151198[_0x50a4('0x48')],{'$or':_['map'](_0x365a2d,function(_0x4a6070){if(_0x4a6070[_0x50a4('0x3a')]!=='VIRTUAL'){var _0x4e544a={};_0x4e544a[_0x4a6070[_0x50a4('0x33')]]={'$like':'%'+_0x74bc62[_0x50a4('0x3d')]['filter']+'%'};return _0x4e544a;}})});}_0x151198=_[_0x50a4('0x4a')]({},_0x151198,_0x74bc62[_0x50a4('0x4b')]);var _0x5e01da={'where':_0x151198['where']};return db[_0x50a4('0x37')][_0x50a4('0x4c')](_0x5e01da)['then'](function(_0x50ded1){_0x31eeac[_0x50a4('0x4c')]=_0x50ded1;if(_0x74bc62['query'][_0x50a4('0x4d')]){_0x151198['include']=[{'all':!![]}];}return db['Network']['findAll'](_0x151198);})[_0x50a4('0x1e')](function(_0xd33bf9){_0x31eeac['rows']=_0xd33bf9;return _0x31eeac;})[_0x50a4('0x1e')](respondWithFilteredResult(_0x5c026e,_0x151198))['catch'](handleError(_0x5c026e,null));};exports[_0x50a4('0x4e')]=function(_0x1dd6db,_0x41c09a){var _0x4fc275={'raw':!![],'where':{'id':_0x1dd6db[_0x50a4('0x4f')]['id']}},_0xcdfee3={};_0xcdfee3[_0x50a4('0x3c')]=_[_0x50a4('0x3e')](db[_0x50a4('0x37')][_0x50a4('0x38')]);_0xcdfee3[_0x50a4('0x3d')]=_[_0x50a4('0x3e')](_0x1dd6db[_0x50a4('0x3d')]);_0xcdfee3['filters']=_[_0x50a4('0x40')](_0xcdfee3[_0x50a4('0x3c')],_0xcdfee3[_0x50a4('0x3d')]);_0x4fc275[_0x50a4('0x41')]=_[_0x50a4('0x40')](_0xcdfee3[_0x50a4('0x3c')],qs[_0x50a4('0x42')](_0x1dd6db[_0x50a4('0x3d')][_0x50a4('0x42')]));_0x4fc275[_0x50a4('0x41')]=_0x4fc275[_0x50a4('0x41')][_0x50a4('0x43')]?_0x4fc275['attributes']:_0xcdfee3['model'];if(_0x1dd6db[_0x50a4('0x3d')][_0x50a4('0x4d')]){_0x4fc275[_0x50a4('0x50')]=[{'all':!![]}];}_0x4fc275=_[_0x50a4('0x4a')]({},_0x4fc275,_0x1dd6db[_0x50a4('0x4b')]);return db['Network']['find'](_0x4fc275)[_0x50a4('0x1e')](handleEntityNotFound(_0x41c09a,null))[_0x50a4('0x1e')](respondWithResult(_0x41c09a,null))[_0x50a4('0x51')](handleError(_0x41c09a,null));};exports[_0x50a4('0x52')]=function(_0x3b145a,_0x176a23,_0x3baa7d){var _0x37d928;return db[_0x50a4('0x53')]['transaction'](function(_0x386dde){return db[_0x50a4('0x37')]['create'](_0x3b145a['body'],{'raw':!![]})[_0x50a4('0x1e')](function(_0x1a71a7){_0x37d928=_0x1a71a7;return db[_0x50a4('0x37')][_0x50a4('0x54')]({'where':{'type':_0x3b145a[_0x50a4('0x55')][_0x50a4('0x3a')]},'raw':!![]});})['then'](function(_0x1d9c34){if(_0x37d928[_0x50a4('0x3a')][_0x50a4('0x56')]()=='STUN'){var _0x40a57a=fs[_0x50a4('0x57')](path['join'](config[_0x50a4('0x58')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x35f1ad=ejs[_0x50a4('0x59')](_0x40a57a,{'networks':_0x1d9c34||[]});fs[_0x50a4('0x5a')](_0x50a4('0x5b'),_0x35f1ad);return respondWithRpcPromise('Reload',_0x50a4('0x52'),{'module':_0x50a4('0x5c')});}else if(_0x37d928['type'][_0x50a4('0x56')]()==_0x50a4('0x5d')){var _0x2def2e=fs[_0x50a4('0x57')](path[_0x50a4('0x5e')](config['root'],_0x50a4('0x5f')),_0x50a4('0x60'));var _0x28623f=ejs[_0x50a4('0x59')](_0x2def2e,{'networks':_0x1d9c34||[]});fs[_0x50a4('0x5a')](_0x50a4('0x61'),_0x28623f);return respondWithRpcPromise(_0x50a4('0x62'),'create',{'module':_0x50a4('0x5c')});}else{var _0x1f76be=fs[_0x50a4('0x57')](path[_0x50a4('0x5e')](config[_0x50a4('0x58')],_0x50a4('0x63')),_0x50a4('0x60'));var _0x438212=ejs['render'](_0x1f76be,{'networks':_0x1d9c34||[]});fs[_0x50a4('0x5a')](util[_0x50a4('0x64')](_0x50a4('0x65'),_0x3b145a['body'][_0x50a4('0x3a')][_0x50a4('0x66')]()),_0x438212);return respondWithRpcPromise(_0x50a4('0x62'),_0x50a4('0x52'),{'module':'chan_sip.so'});}return null;})[_0x50a4('0x1e')](function(){return _0x37d928;});})[_0x50a4('0x1e')](respondWithResult(_0x176a23,0xc9))['catch'](handleError(_0x176a23,null));};exports['update']=function(_0x14ed87,_0x20c713,_0x49a9ce){var _0x25ad1d;return db['sequelize']['transaction'](function(_0x5d4b65){return db[_0x50a4('0x37')]['find']({'where':{'id':_0x14ed87[_0x50a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20c713,null))[_0x50a4('0x1e')](saveUpdates(_0x14ed87['body'],null))['then'](function(_0x538824){if(_0x538824){_0x25ad1d=_0x538824;return db['Network'][_0x50a4('0x54')]({'where':{'type':_0x25ad1d[_0x50a4('0x3a')]},'raw':!![]});}return null;})[_0x50a4('0x1e')](function(_0x2a1334){if(_0x25ad1d[_0x50a4('0x3a')][_0x50a4('0x56')]()==_0x50a4('0x67')){var _0x57df1c=fs[_0x50a4('0x57')](path[_0x50a4('0x5e')](config[_0x50a4('0x58')],_0x50a4('0x68')),_0x50a4('0x60'));var _0x21f4df=ejs[_0x50a4('0x59')](_0x57df1c,{'networks':_0x2a1334||[]});fs[_0x50a4('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x21f4df);return respondWithRpcPromise('Reload',_0x50a4('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x25ad1d['type'][_0x50a4('0x56')]()=='TURN'){var _0x91bfad=fs[_0x50a4('0x57')](path[_0x50a4('0x5e')](config[_0x50a4('0x58')],'server/files/templates/turn_multiple.ejs'),_0x50a4('0x60'));var _0x469e14=ejs[_0x50a4('0x59')](_0x91bfad,{'networks':_0x2a1334||[]});fs['writeFileSync'](_0x50a4('0x61'),_0x469e14);return respondWithRpcPromise(_0x50a4('0x62'),_0x50a4('0x30'),{'module':_0x50a4('0x5c')});}else{var _0x136c74=fs[_0x50a4('0x57')](path[_0x50a4('0x5e')](config[_0x50a4('0x58')],_0x50a4('0x63')),_0x50a4('0x60'));var _0x583743=ejs[_0x50a4('0x59')](_0x136c74,{'networks':_0x2a1334||[]});fs['writeFileSync'](util[_0x50a4('0x64')](_0x50a4('0x65'),_0x14ed87[_0x50a4('0x55')][_0x50a4('0x3a')][_0x50a4('0x66')]()),_0x583743);return respondWithRpcPromise('Reload',_0x50a4('0x30'),{'module':_0x50a4('0x69')});}return null;})[_0x50a4('0x1e')](function(_0x44ecac){if(_0x44ecac){return _0x25ad1d;}return null;});})[_0x50a4('0x1e')](respondWithResult(_0x20c713,null))['catch'](handleError(_0x20c713,null));};exports[_0x50a4('0x31')]=function(_0x274020,_0x510edd,_0x1ec5d9){var _0x5e0937;return db[_0x50a4('0x37')][_0x50a4('0x6a')]({'where':{'id':_0x274020[_0x50a4('0x4f')]['id']}})[_0x50a4('0x1e')](function(_0x32311a){_0x5e0937=_0x32311a;return _0x32311a;})[_0x50a4('0x1e')](handleEntityNotFound(_0x510edd,null))[_0x50a4('0x1e')](removeEntity(_0x510edd,null))[_0x50a4('0x1e')](function(){if(_0x5e0937){return db[_0x50a4('0x37')][_0x50a4('0x54')]({'where':{'type':_0x5e0937[_0x50a4('0x3a')]},'raw':!![]});}})[_0x50a4('0x1e')](function(_0x35d3a7){if(_0x5e0937[_0x50a4('0x3a')]['toUpperCase']()==_0x50a4('0x67')){var _0x5d65e3=fs[_0x50a4('0x57')](path['join'](config[_0x50a4('0x58')],_0x50a4('0x68')),'utf8');var _0x2338c4=ejs[_0x50a4('0x59')](_0x5d65e3,{'networks':_0x35d3a7||[]});fs[_0x50a4('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x2338c4);return respondWithRpcPromise(_0x50a4('0x62'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x5e0937[_0x50a4('0x3a')][_0x50a4('0x56')]()==_0x50a4('0x5d')){var _0x5705ff=fs['readFileSync'](path[_0x50a4('0x5e')](config[_0x50a4('0x58')],_0x50a4('0x5f')),_0x50a4('0x60'));var _0x14d893=ejs[_0x50a4('0x59')](_0x5705ff,{'networks':_0x35d3a7||[]});fs[_0x50a4('0x5a')](_0x50a4('0x61'),_0x14d893);return respondWithRpcPromise('Reload',_0x50a4('0x31'),{'module':_0x50a4('0x5c')});}else{var _0x23fb7a=fs[_0x50a4('0x57')](path[_0x50a4('0x5e')](config[_0x50a4('0x58')],_0x50a4('0x63')),_0x50a4('0x60'));var _0x56beb2=ejs[_0x50a4('0x59')](_0x23fb7a,{'networks':_0x35d3a7||[]});fs['writeFileSync'](util['format'](_0x50a4('0x65'),_0x274020[_0x50a4('0x55')]['type'][_0x50a4('0x66')]()),_0x56beb2);return respondWithRpcPromise(_0x50a4('0x62'),_0x50a4('0x31'),{'module':_0x50a4('0x69')});}return null;})['catch'](handleError(_0x510edd,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 17bee93..60b19aa 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 _0x3707=['network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','define'];(function(_0x53d7a8,_0x42bd72){var _0x4caee1=function(_0x11fda6){while(--_0x11fda6){_0x53d7a8['push'](_0x53d7a8['shift']());}};_0x4caee1(++_0x42bd72);}(_0x3707,0x6d));var _0x7370=function(_0x209739,_0x31a212){_0x209739=_0x209739-0x0;var _0x2903c5=_0x3707[_0x209739];return _0x2903c5;};'use strict';var _=require(_0x7370('0x0'));var util=require(_0x7370('0x1'));var logger=require(_0x7370('0x2'))(_0x7370('0x3'));var moment=require(_0x7370('0x4'));var BPromise=require('bluebird');var rp=require(_0x7370('0x5'));var fs=require('fs');var path=require(_0x7370('0x6'));var rimraf=require(_0x7370('0x7'));var config=require(_0x7370('0x8'));var attributes=require(_0x7370('0x9'));module['exports']=function(_0x1f8030,_0x599d93){return _0x1f8030[_0x7370('0xa')]('Network',attributes,{'tableName':_0x7370('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36be=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','Network','network'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x36be,0xea));var _0xe36b=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x36be[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36b('0x0'))('api');var moment=require(_0xe36b('0x1'));var BPromise=require(_0xe36b('0x2'));var rp=require(_0xe36b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe36b('0x4'));var config=require(_0xe36b('0x5'));var attributes=require('./network.attributes');module['exports']=function(_0x38f2ac,_0xbf4e56){return _0x38f2ac[_0xe36b('0x6')](_0xe36b('0x7'),attributes,{'tableName':_0xe36b('0x8'),'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 6f6ada3..2bea57c 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 _0x4c65=['catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','result'];(function(_0xa12fe7,_0x170f78){var _0x49c20b=function(_0x3aeb26){while(--_0x3aeb26){_0xa12fe7['push'](_0xa12fe7['shift']());}};_0x49c20b(++_0x170f78);}(_0x4c65,0x119));var _0x54c6=function(_0x25c877,_0x1e47ff){_0x25c877=_0x25c877-0x0;var _0x45e3cf=_0x4c65[_0x25c877];return _0x45e3cf;};'use strict';var _=require('lodash');var util=require(_0x54c6('0x0'));var moment=require(_0x54c6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54c6('0x2'));var db=require(_0x54c6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x54c6('0x4'))(_0x54c6('0x5'));var config=require(_0x54c6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x54c6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x79b57c,_0x2a5172,_0x2825d3){return new BPromise(function(_0x5ea732,_0x112b8f){return client[_0x54c6('0x8')](_0x79b57c,_0x2825d3)[_0x54c6('0x9')](function(_0xa4a1e7){logger[_0x54c6('0xa')]('Network,\x20%s,\x20%s',_0x2a5172,_0x54c6('0xb'));logger[_0x54c6('0xc')](_0x54c6('0xd'),_0x2a5172,_0x54c6('0xb'),JSON[_0x54c6('0xe')](_0xa4a1e7));if(_0xa4a1e7[_0x54c6('0xf')]){if(_0xa4a1e7[_0x54c6('0xf')]['code']===0x1f4){logger['error'](_0x54c6('0x10'),_0x2a5172,_0xa4a1e7[_0x54c6('0xf')]['message']);return _0x112b8f(_0xa4a1e7[_0x54c6('0xf')]['message']);}logger[_0x54c6('0xf')](_0x54c6('0x10'),_0x2a5172,_0xa4a1e7[_0x54c6('0xf')]['message']);return _0x5ea732(_0xa4a1e7[_0x54c6('0xf')][_0x54c6('0x11')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x2a5172,'request\x20sent');_0x5ea732(_0xa4a1e7[_0x54c6('0x12')][_0x54c6('0x11')]);}})[_0x54c6('0x13')](function(_0x37d3b0){logger['error'](_0x54c6('0x10'),_0x2a5172,_0x37d3b0);_0x112b8f(_0x37d3b0);});});} \ No newline at end of file +var _0x1653=['stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s'];(function(_0x5530ea,_0x2488e3){var _0x4a230b=function(_0x4ca128){while(--_0x4ca128){_0x5530ea['push'](_0x5530ea['shift']());}};_0x4a230b(++_0x2488e3);}(_0x1653,0xad));var _0x3165=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x1653[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0x3165('0x0'));var util=require(_0x3165('0x1'));var moment=require(_0x3165('0x2'));var BPromise=require(_0x3165('0x3'));var rs=require(_0x3165('0x4'));var fs=require('fs');var Redis=require(_0x3165('0x5'));var db=require(_0x3165('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3165('0x7'));var config=require(_0x3165('0x8'));var jayson=require(_0x3165('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x690289,_0x566ad6,_0x20141f){return new BPromise(function(_0x57330b,_0xb9e097){return client[_0x3165('0xa')](_0x690289,_0x20141f)['then'](function(_0x115d3e){logger['info'](_0x3165('0xb'),_0x566ad6,_0x3165('0xc'));logger['debug'](_0x3165('0xd'),_0x566ad6,_0x3165('0xc'),JSON[_0x3165('0xe')](_0x115d3e));if(_0x115d3e[_0x3165('0xf')]){if(_0x115d3e[_0x3165('0xf')]['code']===0x1f4){logger['error'](_0x3165('0xb'),_0x566ad6,_0x115d3e[_0x3165('0xf')][_0x3165('0x10')]);return _0xb9e097(_0x115d3e['error'][_0x3165('0x10')]);}logger[_0x3165('0xf')](_0x3165('0xb'),_0x566ad6,_0x115d3e[_0x3165('0xf')]['message']);return _0x57330b(_0x115d3e['error'][_0x3165('0x10')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x566ad6,_0x3165('0xc'));_0x57330b(_0x115d3e['result'][_0x3165('0x10')]);}})['catch'](function(_0x41c690){logger[_0x3165('0xf')](_0x3165('0xb'),_0x566ad6,_0x41c690);_0xb9e097(_0x41c690);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 55d618f..55ea7c4 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddc0=['path','Router','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','exports','multer'];(function(_0x5108ff,_0x8fd00b){var _0x52426e=function(_0x3e052c){while(--_0x3e052c){_0x5108ff['push'](_0x5108ff['shift']());}};_0x52426e(++_0x8fd00b);}(_0xddc0,0xa1));var _0x0ddc=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0xddc0[_0x3e0dc4];return _0x586111;};'use strict';var multer=require(_0x0ddc('0x0'));var util=require('util');var path=require(_0x0ddc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ddc('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0ddc('0x3'));var config=require(_0x0ddc('0x4'));var controller=require('./notification.controller');router[_0x0ddc('0x5')]('/',auth[_0x0ddc('0x6')](),controller[_0x0ddc('0x7')]);module[_0x0ddc('0x8')]=router; \ No newline at end of file +var _0x9e0f=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','exports'];(function(_0x112917,_0x1e38f7){var _0x3ee017=function(_0x215b58){while(--_0x215b58){_0x112917['push'](_0x112917['shift']());}};_0x3ee017(++_0x1e38f7);}(_0x9e0f,0x174));var _0xf9e0=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x9e0f[_0x99868f];return _0x27a71b;};'use strict';var multer=require(_0xf9e0('0x0'));var util=require(_0xf9e0('0x1'));var path=require(_0xf9e0('0x2'));var timeout=require('connect-timeout');var express=require(_0xf9e0('0x3'));var router=express[_0xf9e0('0x4')]();var auth=require(_0xf9e0('0x5'));var interaction=require(_0xf9e0('0x6'));var config=require(_0xf9e0('0x7'));var controller=require('./notification.controller');router[_0xf9e0('0x8')]('/',auth[_0xf9e0('0x9')](),controller[_0xf9e0('0xa')]);module[_0xf9e0('0xb')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index f5297be..24ad1be 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ef6=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1aca75,_0x1ee883){var _0x598b65=function(_0x2fec61){while(--_0x2fec61){_0x1aca75['push'](_0x1aca75['shift']());}};_0x598b65(++_0x1ee883);}(_0x6ef6,0x64));var _0x66ef=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x6ef6[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module[_0x66ef('0x0')]={'body':{'type':Sequelize[_0x66ef('0x1')]},'senderName':{'type':Sequelize[_0x66ef('0x2')]},'recipientsId':{'type':Sequelize[_0x66ef('0x1')]},'recipientsDescription':{'type':Sequelize[_0x66ef('0x2')]},'beep':{'type':Sequelize[_0x66ef('0x3')]}}; \ No newline at end of file +var _0x1d3f=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1d3f,0x1b4));var _0xf1d3=function(_0x1c3f8e,_0x2f7794){_0x1c3f8e=_0x1c3f8e-0x0;var _0x40b720=_0x1d3f[_0x1c3f8e];return _0x40b720;};'use strict';var Sequelize=require(_0xf1d3('0x0'));module[_0xf1d3('0x1')]={'body':{'type':Sequelize[_0xf1d3('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xf1d3('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf1d3('0x3')]},'beep':{'type':Sequelize[_0xf1d3('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index a1368e1..71cad13 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf97=['request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./notification.socket','register','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','sendNotification','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','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','forEach','notification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','union','queue','push','getAgents','eml-format','rimraf','zip-dir'];(function(_0x3a310a,_0x4c14ec){var _0x1a65d3=function(_0x3a9f9b){while(--_0x3a9f9b){_0x3a310a['push'](_0x3a310a['shift']());}};_0x1a65d3(++_0x4c14ec);}(_0xdf97,0x1ce));var _0x7df9=function(_0x4f746c,_0x2046c3){_0x4f746c=_0x4f746c-0x0;var _0x223d37=_0xdf97[_0x4f746c];return _0x223d37;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7df9('0x0'));var rimraf=require(_0x7df9('0x1'));var zipdir=require(_0x7df9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7df9('0x3'));var moment=require(_0x7df9('0x4'));var BPromise=require(_0x7df9('0x5'));var Mustache=require('mustache');var util=require(_0x7df9('0x6'));var path=require('path');var sox=require(_0x7df9('0x7'));var csv=require('to-csv');var ejs=require(_0x7df9('0x8'));var fs=require('fs');var _=require(_0x7df9('0x9'));var squel=require(_0x7df9('0xa'));var crypto=require(_0x7df9('0xb'));var jsforce=require(_0x7df9('0xc'));var deskjs=require(_0x7df9('0xd'));var toCsv=require(_0x7df9('0xe'));var querystring=require(_0x7df9('0xf'));var Papa=require(_0x7df9('0x10'));var Redis=require(_0x7df9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7df9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7df9('0x13'))('api');var utils=require(_0x7df9('0x14'));var config=require(_0x7df9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7df9('0x16')]=_[_0x7df9('0x17')](config[_0x7df9('0x16')],{'host':_0x7df9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7df9('0x19'))[_0x7df9('0x1a')](socket);function respondWithStatusCode(_0x571c65,_0x4348cd){_0x4348cd=_0x4348cd||0xcc;return function(_0x17352c){if(_0x17352c){return _0x571c65['sendStatus'](_0x4348cd);}return _0x571c65[_0x7df9('0x1b')](_0x4348cd)[_0x7df9('0x1c')]();};}function respondWithResult(_0x2a8d93,_0x35a236){_0x35a236=_0x35a236||0xc8;return function(_0x5782f7){if(_0x5782f7){return _0x2a8d93[_0x7df9('0x1b')](_0x35a236)['json'](_0x5782f7);}};}function respondWithFilteredResult(_0x29e6ca,_0xec1f46){return function(_0xddf7eb){if(_0xddf7eb){var _0x1d25d1=_0xddf7eb['count'],_0x1c2b7b=_0xec1f46['offset'],_0x4da8e1=_0xec1f46[_0x7df9('0x1d')]+_0xec1f46['limit'],_0x58912b;if(_0x4da8e1>=_0x1d25d1){_0x4da8e1=_0x1d25d1;_0x58912b=0xc8;}else{_0x58912b=0xce;}_0x29e6ca[_0x7df9('0x1b')](_0x58912b);return _0x29e6ca[_0x7df9('0x1e')](_0x7df9('0x1f'),_0x1c2b7b+'-'+_0x4da8e1+'/'+_0x1d25d1)['json'](_0xddf7eb);}return null;};}function patchUpdates(_0x36d01f){return function(_0x870892){try{jsonpatch[_0x7df9('0x20')](_0x870892,_0x36d01f,!![]);}catch(_0x52f18f){return BPromise[_0x7df9('0x21')](_0x52f18f);}return _0x870892[_0x7df9('0x22')]();};}function saveUpdates(_0x4a1a83,_0x5c2b2b){return function(_0x441f4a){if(_0x441f4a){return _0x441f4a[_0x7df9('0x23')](_0x4a1a83)[_0x7df9('0x24')](function(_0x3b1fa3){return _0x3b1fa3;});}return null;};}function removeEntity(_0x17a894,_0xfb34a0){return function(_0x2b96d0){if(_0x2b96d0){return _0x2b96d0[_0x7df9('0x25')]()['then'](function(){_0x17a894['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c23b2,_0x246139){return function(_0x20b5b0){if(!_0x20b5b0){_0x3c23b2[_0x7df9('0x26')](0x194);}return _0x20b5b0;};}function handleError(_0x34bb37,_0x77c441){_0x77c441=_0x77c441||0x1f4;return function(_0x865fcd){logger[_0x7df9('0x27')](_0x865fcd[_0x7df9('0x28')]);if(_0x865fcd['name']){delete _0x865fcd['name'];}_0x34bb37[_0x7df9('0x1b')](_0x77c441)[_0x7df9('0x29')](_0x865fcd);};}exports[_0x7df9('0x2a')]=function(_0x2688ce,_0x53eae4,_0x28b77e){if(!_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x2c')](_0x7df9('0x2d'))&&!_0x2688ce['body'][_0x7df9('0x2c')](_0x7df9('0x2e'))){throw new db[(_0x7df9('0x2f'))][(_0x7df9('0x30'))](_0x7df9('0x31'));}else{if(_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x2c')](_0x7df9('0x2e'))&&!_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x2c')]('view')){throw new db[(_0x7df9('0x2f'))][(_0x7df9('0x30'))](_0x7df9('0x32'));}if(!_0x2688ce[_0x7df9('0x2b')]['hasOwnProperty'](_0x7df9('0x33'))){throw new db[(_0x7df9('0x2f'))][(_0x7df9('0x30'))](_0x7df9('0x34'));}else{try{var _0x5d4d65=JSON[_0x7df9('0x35')](_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x33')]);}catch(_0x2255cf){logger[_0x7df9('0x27')](_0x2255cf);throw new db[(_0x7df9('0x2f'))][(_0x7df9('0x30'))](_0x7df9('0x36'));}var _0x465dc9=[_0x7df9('0x37'),_0x7df9('0x38'),_0x7df9('0x39'),_0x7df9('0x3a'),_0x7df9('0x3b'),'voicequeue',_0x7df9('0x3c'),'team',_0x7df9('0x3d')];if(_[_0x7df9('0x3e')](_0x5d4d65,function(_0xd16eae){return!_[_0x7df9('0x3f')](_0x465dc9,_0xd16eae[_0x7df9('0x40')][_0x7df9('0x41')]());})){throw new db[(_0x7df9('0x2f'))]['ValidationError'](_0x7df9('0x42'));}}}var _0x35bf53={};_0x35bf53[_0x7df9('0x43')]=_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x2c')](_0x7df9('0x43'))?_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x43')]:_0x2688ce[_0x7df9('0x3d')][_0x7df9('0x44')];_0x35bf53['recipientsDescription']=_[_0x7df9('0x45')](_0x2688ce[_0x7df9('0x2b')][_0x7df9('0x46')])?null:_0x2688ce[_0x7df9('0x2b')]['recipientsDescription'];_0x35bf53[_0x7df9('0x47')]=_0x2688ce['body'][_0x7df9('0x47')]||![];_0x35bf53[_0x7df9('0x48')]=_0x2688ce[_0x7df9('0x3d')]['id'];return getContent(_0x2688ce['body'])[_0x7df9('0x24')](function(_0x3edc8b){_0x35bf53[_0x7df9('0x2b')]=_0x3edc8b;return getRecipients(_0x5d4d65);})[_0x7df9('0x24')](function(_0x3d3571){_0x35bf53[_0x7df9('0x49')]=_[_0x7df9('0x4a')](_0x3d3571)[_0x7df9('0x4b')](',');return db[_0x7df9('0x4c')][_0x7df9('0x4d')](function(_0x3c216a){return db[_0x7df9('0x4e')]['create'](_0x35bf53,{'raw':!![],'transaction':_0x3c216a})[_0x7df9('0x24')](function(_0x2b7652){var _0x189527={'sender':_0x35bf53[_0x7df9('0x43')],'description':_0x35bf53['recipientsDescription'],'content':_0x35bf53['body'],'beep':_0x35bf53['beep']};_0x3d3571[_0x7df9('0x4f')](function(_0x1c37dd){_0x189527['recipient']=_0x1c37dd;socket['emit'](_0x7df9('0x50'),_0x189527);});return _0x2b7652;});});})['then'](respondWithResult(_0x53eae4,0xc9))[_0x7df9('0x51')](handleError(_0x53eae4,null));};function getContent(_0x279588){return new BPromise(function(_0x19e447,_0x3e7777){if(_0x279588['text']){_0x19e447(_0x279588[_0x7df9('0x2d')]);return;}return db[_0x7df9('0x52')][_0x7df9('0x53')]({'attributes':['html'],'where':{'id':_0x279588['TemplateId']},'raw':!![]})[_0x7df9('0x24')](function(_0x334571){if(!_0x334571)throw new db[(_0x7df9('0x2f'))][(_0x7df9('0x30'))](_0x7df9('0x54'));var _0x16d77c=Mustache[_0x7df9('0x55')](_0x334571[_0x7df9('0x56')],_0x279588[_0x7df9('0x57')]);_0x19e447(_0x16d77c);})[_0x7df9('0x51')](function(_0x5ee382){_0x3e7777(_0x5ee382);});});}function getRecipients(_0x472e7b){return new BPromise(function(_0x44f134,_0x4d2a33){var _0x6d470=[];var _0x532de7=[];_0x472e7b['forEach'](function(_0x1df63f){var _0x1dc850=_[_0x7df9('0x58')](_0x1df63f[_0x7df9('0x40')][_0x7df9('0x41')]());if(_0x1dc850==='User'){_0x6d470=_[_0x7df9('0x59')](_0x6d470,_0x1df63f['ids']);}else{if(_['includes'](_0x1dc850,_0x7df9('0x5a')))_0x1dc850=_0x1dc850['replace'](_0x7df9('0x5a'),'Queue');_0x1df63f['ids'][_0x7df9('0x4f')](function(_0x50e11d){_0x532de7[_0x7df9('0x5b')](getAgents(_0x1dc850,_0x50e11d));});}});return BPromise['all'](_0x532de7)[_0x7df9('0x24')](function(_0x4147f2){_0x6d470=_[_0x7df9('0x59')](_0x6d470,_['flatten'](_0x4147f2));_0x44f134(_0x6d470);})[_0x7df9('0x51')](function(_0x546e6d){_0x4d2a33(_0x546e6d);});});}function getAgents(_0x1aa304,_0x21119d){return new BPromise(function(_0x4c3d8e,_0x55c24f){return db[_0x1aa304][_0x7df9('0x53')]({'where':{'id':_0x21119d}})[_0x7df9('0x24')](function(_0x19f0c3){return _0x19f0c3[_0x7df9('0x5c')]({'attributes':['id'],'raw':!![]})[_0x7df9('0x24')](function(_0x51a0f9){var _0x69a20b=_['map'](_0x51a0f9,'id');_0x4c3d8e(_0x69a20b);});})[_0x7df9('0x51')](function(_0x1d7e61){_0x55c24f(_0x1d7e61);});});} \ No newline at end of file +var _0x4f7c=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','whatsappqueue','team','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','user','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','Template','findOne','render','html','User','union','ids','queue','Queue','push','all','flatten','map','eml-format','rimraf','zip-dir'];(function(_0x16ccc7,_0x4ae5e7){var _0x880e9e=function(_0x43cd46){while(--_0x43cd46){_0x16ccc7['push'](_0x16ccc7['shift']());}};_0x880e9e(++_0x4ae5e7);}(_0x4f7c,0x185));var _0xc4f7=function(_0x1e5c8c,_0x5a7382){_0x1e5c8c=_0x1e5c8c-0x0;var _0xe5b1d5=_0x4f7c[_0x1e5c8c];return _0xe5b1d5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc4f7('0x0'));var rimraf=require(_0xc4f7('0x1'));var zipdir=require(_0xc4f7('0x2'));var jsonpatch=require(_0xc4f7('0x3'));var rp=require(_0xc4f7('0x4'));var moment=require(_0xc4f7('0x5'));var BPromise=require(_0xc4f7('0x6'));var Mustache=require(_0xc4f7('0x7'));var util=require(_0xc4f7('0x8'));var path=require(_0xc4f7('0x9'));var sox=require(_0xc4f7('0xa'));var csv=require('to-csv');var ejs=require(_0xc4f7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc4f7('0xc'));var deskjs=require(_0xc4f7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc4f7('0xe'));var Papa=require(_0xc4f7('0xf'));var Redis=require(_0xc4f7('0x10'));var authService=require(_0xc4f7('0x11'));var qs=require(_0xc4f7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4f7('0x13'));var logger=require('../../config/logger')(_0xc4f7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4f7('0x15'));var db=require(_0xc4f7('0x16'))['db'];config[_0xc4f7('0x17')]=_[_0xc4f7('0x18')](config[_0xc4f7('0x17')],{'host':_0xc4f7('0x19'),'port':0x18eb});var socket=require(_0xc4f7('0x1a'))(new Redis(config[_0xc4f7('0x17')]));require(_0xc4f7('0x1b'))[_0xc4f7('0x1c')](socket);function respondWithStatusCode(_0x3781dd,_0x615174){_0x615174=_0x615174||0xcc;return function(_0x267975){if(_0x267975){return _0x3781dd[_0xc4f7('0x1d')](_0x615174);}return _0x3781dd['status'](_0x615174)['end']();};}function respondWithResult(_0x1f629c,_0x58cd60){_0x58cd60=_0x58cd60||0xc8;return function(_0xd66ede){if(_0xd66ede){return _0x1f629c['status'](_0x58cd60)[_0xc4f7('0x1e')](_0xd66ede);}};}function respondWithFilteredResult(_0x3f76dd,_0x129bd9){return function(_0x2eccda){if(_0x2eccda){var _0x2ad358=_0x2eccda[_0xc4f7('0x1f')],_0x1f835c=_0x129bd9[_0xc4f7('0x20')],_0x133548=_0x129bd9['offset']+_0x129bd9['limit'],_0xa45f54;if(_0x133548>=_0x2ad358){_0x133548=_0x2ad358;_0xa45f54=0xc8;}else{_0xa45f54=0xce;}_0x3f76dd[_0xc4f7('0x21')](_0xa45f54);return _0x3f76dd[_0xc4f7('0x22')](_0xc4f7('0x23'),_0x1f835c+'-'+_0x133548+'/'+_0x2ad358)[_0xc4f7('0x1e')](_0x2eccda);}return null;};}function patchUpdates(_0x6c9d19){return function(_0x276875){try{jsonpatch[_0xc4f7('0x24')](_0x276875,_0x6c9d19,!![]);}catch(_0x4d2021){return BPromise[_0xc4f7('0x25')](_0x4d2021);}return _0x276875['save']();};}function saveUpdates(_0x466e7b,_0x2021c0){return function(_0x4d85dd){if(_0x4d85dd){return _0x4d85dd[_0xc4f7('0x26')](_0x466e7b)[_0xc4f7('0x27')](function(_0x4b9588){return _0x4b9588;});}return null;};}function removeEntity(_0x564f08,_0x33810a){return function(_0x3762b5){if(_0x3762b5){return _0x3762b5[_0xc4f7('0x28')]()[_0xc4f7('0x27')](function(){_0x564f08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34171a,_0x223ae3){return function(_0x41d37b){if(!_0x41d37b){_0x34171a[_0xc4f7('0x1d')](0x194);}return _0x41d37b;};}function handleError(_0x3d2ee0,_0x2679ca){_0x2679ca=_0x2679ca||0x1f4;return function(_0x3bb185){logger[_0xc4f7('0x29')](_0x3bb185[_0xc4f7('0x2a')]);if(_0x3bb185[_0xc4f7('0x2b')]){delete _0x3bb185[_0xc4f7('0x2b')];}_0x3d2ee0['status'](_0x2679ca)[_0xc4f7('0x2c')](_0x3bb185);};}exports['sendNotification']=function(_0x3bfda5,_0x12b7d5,_0x29f290){if(!_0x3bfda5[_0xc4f7('0x2d')][_0xc4f7('0x2e')](_0xc4f7('0x2f'))&&!_0x3bfda5['body'][_0xc4f7('0x2e')](_0xc4f7('0x30'))){throw new db['Sequelize']['ValidationError'](_0xc4f7('0x31'));}else{if(_0x3bfda5[_0xc4f7('0x2d')]['hasOwnProperty'](_0xc4f7('0x30'))&&!_0x3bfda5[_0xc4f7('0x2d')][_0xc4f7('0x2e')](_0xc4f7('0x32'))){throw new db[(_0xc4f7('0x33'))][(_0xc4f7('0x34'))](_0xc4f7('0x35'));}if(!_0x3bfda5['body'][_0xc4f7('0x2e')](_0xc4f7('0x36'))){throw new db[(_0xc4f7('0x33'))][(_0xc4f7('0x34'))](_0xc4f7('0x37'));}else{try{var _0x3c7ae1=JSON[_0xc4f7('0x38')](_0x3bfda5['body'][_0xc4f7('0x36')]);}catch(_0x101d17){logger[_0xc4f7('0x29')](_0x101d17);throw new db[(_0xc4f7('0x33'))]['ValidationError'](_0xc4f7('0x39'));}var _0x1b6e03=[_0xc4f7('0x3a'),_0xc4f7('0x3b'),_0xc4f7('0x3c'),'openchannelqueue',_0xc4f7('0x3d'),'voicequeue',_0xc4f7('0x3e'),_0xc4f7('0x3f'),'user'];if(_['some'](_0x3c7ae1,function(_0x31ec85){return!_[_0xc4f7('0x40')](_0x1b6e03,_0x31ec85[_0xc4f7('0x41')][_0xc4f7('0x42')]());})){throw new db['Sequelize'][(_0xc4f7('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5a2195={};_0x5a2195['senderName']=_0x3bfda5[_0xc4f7('0x2d')][_0xc4f7('0x2e')](_0xc4f7('0x43'))?_0x3bfda5[_0xc4f7('0x2d')]['senderName']:_0x3bfda5['user'][_0xc4f7('0x44')];_0x5a2195[_0xc4f7('0x45')]=_[_0xc4f7('0x46')](_0x3bfda5[_0xc4f7('0x2d')]['recipientsDescription'])?null:_0x3bfda5[_0xc4f7('0x2d')]['recipientsDescription'];_0x5a2195['beep']=_0x3bfda5['body'][_0xc4f7('0x47')]||![];_0x5a2195[_0xc4f7('0x48')]=_0x3bfda5[_0xc4f7('0x49')]['id'];return getContent(_0x3bfda5[_0xc4f7('0x2d')])[_0xc4f7('0x27')](function(_0x123ded){_0x5a2195['body']=_0x123ded;return getRecipients(_0x3c7ae1);})[_0xc4f7('0x27')](function(_0x2efeb1){_0x5a2195['recipientsId']=_[_0xc4f7('0x4a')](_0x2efeb1)[_0xc4f7('0x4b')](',');return db[_0xc4f7('0x4c')][_0xc4f7('0x4d')](function(_0x4d872a){return db[_0xc4f7('0x4e')][_0xc4f7('0x4f')](_0x5a2195,{'raw':!![],'transaction':_0x4d872a})[_0xc4f7('0x27')](function(_0x30f8a4){var _0x22da3f={'sender':_0x5a2195[_0xc4f7('0x43')],'description':_0x5a2195[_0xc4f7('0x45')],'content':_0x5a2195['body'],'beep':_0x5a2195[_0xc4f7('0x47')]};_0x2efeb1[_0xc4f7('0x50')](function(_0x473276){_0x22da3f[_0xc4f7('0x51')]=_0x473276;socket[_0xc4f7('0x52')](_0xc4f7('0x53'),_0x22da3f);});return _0x30f8a4;});});})[_0xc4f7('0x27')](respondWithResult(_0x12b7d5,0xc9))[_0xc4f7('0x54')](handleError(_0x12b7d5,null));};function getContent(_0x397c50){return new BPromise(function(_0x25366a,_0x3fb328){if(_0x397c50[_0xc4f7('0x2f')]){_0x25366a(_0x397c50[_0xc4f7('0x2f')]);return;}return db[_0xc4f7('0x55')][_0xc4f7('0x56')]({'attributes':['html'],'where':{'id':_0x397c50[_0xc4f7('0x30')]},'raw':!![]})['then'](function(_0x2f717e){if(!_0x2f717e)throw new db[(_0xc4f7('0x33'))][(_0xc4f7('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x459a04=Mustache[_0xc4f7('0x57')](_0x2f717e[_0xc4f7('0x58')],_0x397c50[_0xc4f7('0x32')]);_0x25366a(_0x459a04);})[_0xc4f7('0x54')](function(_0x276bda){_0x3fb328(_0x276bda);});});}function getRecipients(_0x86c4df){return new BPromise(function(_0x1fbaeb,_0x31380d){var _0xba5f81=[];var _0x4f2041=[];_0x86c4df[_0xc4f7('0x50')](function(_0x63b3b){var _0x1f4c70=_['startCase'](_0x63b3b[_0xc4f7('0x41')]['toLowerCase']());if(_0x1f4c70===_0xc4f7('0x59')){_0xba5f81=_[_0xc4f7('0x5a')](_0xba5f81,_0x63b3b[_0xc4f7('0x5b')]);}else{if(_[_0xc4f7('0x40')](_0x1f4c70,_0xc4f7('0x5c')))_0x1f4c70=_0x1f4c70['replace']('queue',_0xc4f7('0x5d'));_0x63b3b['ids']['forEach'](function(_0x31d83e){_0x4f2041[_0xc4f7('0x5e')](getAgents(_0x1f4c70,_0x31d83e));});}});return BPromise[_0xc4f7('0x5f')](_0x4f2041)[_0xc4f7('0x27')](function(_0x1f6ab8){_0xba5f81=_[_0xc4f7('0x5a')](_0xba5f81,_[_0xc4f7('0x60')](_0x1f6ab8));_0x1fbaeb(_0xba5f81);})[_0xc4f7('0x54')](function(_0x1a0934){_0x31380d(_0x1a0934);});});}function getAgents(_0x56816a,_0x371eb8){return new BPromise(function(_0x4fd1a0,_0x96bb94){return db[_0x56816a]['findOne']({'where':{'id':_0x371eb8}})[_0xc4f7('0x27')](function(_0x2682aa){return _0x2682aa['getAgents']({'attributes':['id'],'raw':!![]})[_0xc4f7('0x27')](function(_0x17533c){var _0x4c2a75=_[_0xc4f7('0x61')](_0x17533c,'id');_0x4fd1a0(_0x4c2a75);});})[_0xc4f7('0x54')](function(_0x3a8a07){_0x96bb94(_0x3a8a07);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 4daf0e7..026a93a 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x200313,_0x264ecf){var _0x4a251d=function(_0x283dc7){while(--_0x283dc7){_0x200313['push'](_0x200313['shift']());}};_0x4a251d(++_0x264ecf);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ad6e4,_0x103161){_0x4ad6e4=_0x4ad6e4-0x0;var _0x11e62a=_0xb10b[_0x4ad6e4];return _0x11e62a;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2032,0xd9));var _0x2203=function(_0xea9abc,_0x4501ae){_0xea9abc=_0xea9abc-0x0;var _0xd09347=_0x2032[_0xea9abc];return _0xd09347;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 7b74e77..0ce5ee8 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd579=['utf8mb4','../../config/logger','api','moment','bluebird','rimraf','./notification.attributes','exports','define','notifications'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xd579,0x137));var _0x9d57=function(_0x3a08d9,_0x220ac0){_0x3a08d9=_0x3a08d9-0x0;var _0x557081=_0xd579[_0x3a08d9];return _0x557081;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d57('0x0'))(_0x9d57('0x1'));var moment=require(_0x9d57('0x2'));var BPromise=require(_0x9d57('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d57('0x4'));var config=require('../../config/environment');var attributes=require(_0x9d57('0x5'));module[_0x9d57('0x6')]=function(_0x62cb8b,_0x51fd7d){return _0x62cb8b[_0x9d57('0x7')]('Notification',attributes,{'tableName':_0x9d57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d57('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2d8d=['moment','bluebird','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2d8d,0x10d));var _0xd2d8=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x2d8d[_0x386525];return _0x14d015;};'use strict';var _=require(_0xd2d8('0x0'));var util=require(_0xd2d8('0x1'));var logger=require(_0xd2d8('0x2'))(_0xd2d8('0x3'));var moment=require(_0xd2d8('0x4'));var BPromise=require(_0xd2d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd2d8('0x6'));var config=require(_0xd2d8('0x7'));var attributes=require(_0xd2d8('0x8'));module[_0xd2d8('0x9')]=function(_0xed97d5,_0x53d5c9){return _0xed97d5[_0xd2d8('0xa')](_0xd2d8('0xb'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd2d8('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 827a78e..7564297 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ccf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','request','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0x0ccf,0x1d2));var _0xf0cc=function(_0x3e80e5,_0x5ba461){_0x3e80e5=_0x3e80e5-0x0;var _0x43a128=_0x0ccf[_0x3e80e5];return _0x43a128;};'use strict';var _=require(_0xf0cc('0x0'));var util=require(_0xf0cc('0x1'));var moment=require(_0xf0cc('0x2'));var BPromise=require(_0xf0cc('0x3'));var rs=require(_0xf0cc('0x4'));var fs=require('fs');var Redis=require(_0xf0cc('0x5'));var db=require(_0xf0cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0cc('0x7'))(_0xf0cc('0x8'));var config=require(_0xf0cc('0x9'));var jayson=require(_0xf0cc('0xa'));var client=jayson['client'][_0xf0cc('0xb')]({'port':0x232a});config[_0xf0cc('0xc')]=_[_0xf0cc('0xd')](config[_0xf0cc('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0cc('0xc')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x14f988,_0x5dc0e8,_0x43336b){return new BPromise(function(_0xcc3773,_0x145f98){return client[_0xf0cc('0xe')](_0x14f988,_0x43336b)['then'](function(_0x498c64){logger['info'](_0xf0cc('0xf'),_0x5dc0e8,'request\x20sent');logger[_0xf0cc('0x10')](_0xf0cc('0x11'),_0x5dc0e8,_0xf0cc('0x12'),JSON[_0xf0cc('0x13')](_0x498c64));if(_0x498c64[_0xf0cc('0x14')]){if(_0x498c64[_0xf0cc('0x14')][_0xf0cc('0x15')]===0x1f4){logger[_0xf0cc('0x14')]('Notification,\x20%s,\x20%s',_0x5dc0e8,_0x498c64[_0xf0cc('0x14')]['message']);return _0x145f98(_0x498c64[_0xf0cc('0x14')][_0xf0cc('0x16')]);}logger['error'](_0xf0cc('0xf'),_0x5dc0e8,_0x498c64[_0xf0cc('0x14')][_0xf0cc('0x16')]);return _0xcc3773(_0x498c64[_0xf0cc('0x14')]['message']);}else{logger[_0xf0cc('0x17')](_0xf0cc('0xf'),_0x5dc0e8,_0xf0cc('0x12'));_0xcc3773(_0x498c64[_0xf0cc('0x18')][_0xf0cc('0x16')]);}})[_0xf0cc('0x19')](function(_0x50b867){logger[_0xf0cc('0x14')]('Notification,\x20%s,\x20%s',_0x5dc0e8,_0x50b867);_0x145f98(_0x50b867);});});} \ No newline at end of file +var _0xe25b=['../../mysqldb','../../config/utils','../../config/environment','client','http','redis','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2d8ddc,_0x35b941){var _0x5c7a4a=function(_0x3f339e){while(--_0x3f339e){_0x2d8ddc['push'](_0x2d8ddc['shift']());}};_0x5c7a4a(++_0x35b941);}(_0xe25b,0x1b0));var _0xbe25=function(_0x20228e,_0x3f84a4){_0x20228e=_0x20228e-0x0;var _0x39040c=_0xe25b[_0x20228e];return _0x39040c;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var moment=require(_0xbe25('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe25('0x3'));var fs=require('fs');var Redis=require(_0xbe25('0x4'));var db=require(_0xbe25('0x5'))['db'];var utils=require(_0xbe25('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe25('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbe25('0x8')][_0xbe25('0x9')]({'port':0x232a});config[_0xbe25('0xa')]=_['defaults'](config[_0xbe25('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe25('0xa')]));require(_0xbe25('0xb'))[_0xbe25('0xc')](socket);function respondWithRpcPromise(_0x4e246c,_0x1a3468,_0x4b62bb){return new BPromise(function(_0x55a746,_0x56091d){return client[_0xbe25('0xd')](_0x4e246c,_0x4b62bb)[_0xbe25('0xe')](function(_0x3db09e){logger[_0xbe25('0xf')](_0xbe25('0x10'),_0x1a3468,_0xbe25('0x11'));logger['debug'](_0xbe25('0x12'),_0x1a3468,_0xbe25('0x11'),JSON[_0xbe25('0x13')](_0x3db09e));if(_0x3db09e[_0xbe25('0x14')]){if(_0x3db09e['error']['code']===0x1f4){logger[_0xbe25('0x14')]('Notification,\x20%s,\x20%s',_0x1a3468,_0x3db09e[_0xbe25('0x14')]['message']);return _0x56091d(_0x3db09e['error'][_0xbe25('0x15')]);}logger[_0xbe25('0x14')](_0xbe25('0x10'),_0x1a3468,_0x3db09e[_0xbe25('0x14')][_0xbe25('0x15')]);return _0x55a746(_0x3db09e[_0xbe25('0x14')][_0xbe25('0x15')]);}else{logger['info'](_0xbe25('0x10'),_0x1a3468,_0xbe25('0x11'));_0x55a746(_0x3db09e['result'][_0xbe25('0x15')]);}})[_0xbe25('0x16')](function(_0xe4b23d){logger[_0xbe25('0x14')]('Notification,\x20%s,\x20%s',_0x1a3468,_0xe4b23d);_0x56091d(_0xe4b23d);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index b0428df..db44cfc 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e15=['register','length','notification:','update','removeListener'];(function(_0xc91338,_0x4cc17b){var _0x2524ba=function(_0x4a21a1){while(--_0x4a21a1){_0xc91338['push'](_0xc91338['shift']());}};_0x2524ba(++_0x4cc17b);}(_0x4e15,0xb7));var _0x54e1=function(_0x41d8cb,_0x35e7d9){_0x41d8cb=_0x41d8cb-0x0;var _0x2684b5=_0x4e15[_0x41d8cb];return _0x2684b5;};'use strict';var NotificationEvents=require('./notification.events');var events=['save','remove',_0x54e1('0x0')];function createListener(_0x202fe1,_0xbab06a){return function(_0x48a49f){_0xbab06a['emit'](_0x202fe1,_0x48a49f);};}function removeListener(_0x3d2e6b,_0x292aef){return function(){NotificationEvents[_0x54e1('0x1')](_0x3d2e6b,_0x292aef);};}exports[_0x54e1('0x2')]=function(_0x500338){for(var _0x432db1=0x0,_0x499a0c=events[_0x54e1('0x3')];_0x432db1<_0x499a0c;_0x432db1++){var _0x156701=events[_0x432db1];var _0x2f3ce6=createListener(_0x54e1('0x4')+_0x156701,_0x500338);NotificationEvents['on'](_0x156701,_0x2f3ce6);}}; \ No newline at end of file +var _0xfc65=['removeListener','register','length','notification:','remove','update'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xfc65,0x17e));var _0x5fc6=function(_0x2ffeb7,_0x50ef17){_0x2ffeb7=_0x2ffeb7-0x0;var _0x505f0f=_0xfc65[_0x2ffeb7];return _0x505f0f;};'use strict';var NotificationEvents=require('./notification.events');var events=['save',_0x5fc6('0x0'),_0x5fc6('0x1')];function createListener(_0x223b14,_0x5896a4){return function(_0x366688){_0x5896a4['emit'](_0x223b14,_0x366688);};}function removeListener(_0x3fa3d9,_0x44d8ea){return function(){NotificationEvents[_0x5fc6('0x2')](_0x3fa3d9,_0x44d8ea);};}exports[_0x5fc6('0x3')]=function(_0x2ca141){for(var _0x33112e=0x0,_0x473654=events[_0x5fc6('0x4')];_0x33112e<_0x473654;_0x33112e++){var _0x110e02=events[_0x33112e];var _0x30c51b=createListener(_0x5fc6('0x5')+_0x110e02,_0x2ca141);NotificationEvents['on'](_0x110e02,_0x30c51b);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2722a40..8aa622e 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 _0x77c5=['getInteractions','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x77c5,0xf1));var _0x577c=function(_0x1feb5a,_0x2e19d8){_0x1feb5a=_0x1feb5a-0x0;var _0x4e6ed1=_0x77c5[_0x1feb5a];return _0x4e6ed1;};'use strict';var multer=require('multer');var util=require(_0x577c('0x0'));var path=require('path');var timeout=require(_0x577c('0x1'));var express=require('express');var router=express[_0x577c('0x2')]();var auth=require(_0x577c('0x3'));var interaction=require(_0x577c('0x4'));var config=require(_0x577c('0x5'));var controller=require(_0x577c('0x6'));router[_0x577c('0x7')]('/',auth[_0x577c('0x8')](),controller[_0x577c('0x9')]);router['get'](_0x577c('0xa'),auth[_0x577c('0x8')](),controller[_0x577c('0xb')]);router['get']('/:id',auth[_0x577c('0x8')](),controller[_0x577c('0xc')]);router[_0x577c('0x7')](_0x577c('0xd'),auth[_0x577c('0x8')](),controller['getDispositions']);router[_0x577c('0x7')](_0x577c('0xe'),auth[_0x577c('0x8')](),controller[_0x577c('0xf')]);router[_0x577c('0x7')](_0x577c('0x10'),auth[_0x577c('0x8')](),controller['getApplications']);router[_0x577c('0x7')](_0x577c('0x11'),auth[_0x577c('0x8')](),controller[_0x577c('0x12')]);router[_0x577c('0x7')]('/:id/users',auth[_0x577c('0x8')](),controller[_0x577c('0x13')]);router[_0x577c('0x14')]('/',auth[_0x577c('0x8')](),controller[_0x577c('0x15')]);router['post'](_0x577c('0xd'),auth[_0x577c('0x8')](),controller['addDisposition']);router[_0x577c('0x14')](_0x577c('0xe'),auth[_0x577c('0x8')](),controller[_0x577c('0x16')]);router[_0x577c('0x14')](_0x577c('0x17'),controller[_0x577c('0x18')]);router['post'](_0x577c('0x10'),auth[_0x577c('0x8')](),controller[_0x577c('0x19')]);router[_0x577c('0x14')](_0x577c('0x1a'),auth[_0x577c('0x8')](),controller[_0x577c('0x1b')]);router['post'](_0x577c('0x1c'),auth[_0x577c('0x8')](),controller[_0x577c('0x1d')]);router[_0x577c('0x1e')](_0x577c('0x1f'),auth[_0x577c('0x8')](),controller[_0x577c('0x20')]);router[_0x577c('0x21')](_0x577c('0x1f'),auth[_0x577c('0x8')](),controller['destroy']);router[_0x577c('0x21')](_0x577c('0xd'),auth[_0x577c('0x8')](),controller['removeDispositions']);router[_0x577c('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x577c('0x22')]);router[_0x577c('0x21')](_0x577c('0x1a'),auth[_0x577c('0x8')](),controller[_0x577c('0x23')]);module[_0x577c('0x24')]=router; \ No newline at end of file +var _0x5f07=['notify','send','put','/:id','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify'];(function(_0x16c1be,_0x2866a0){var _0x2c6395=function(_0xf3d40c){while(--_0xf3d40c){_0x16c1be['push'](_0x16c1be['shift']());}};_0x2c6395(++_0x2866a0);}(_0x5f07,0x139));var _0x75f0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f07[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x75f0('0x0'));var util=require(_0x75f0('0x1'));var path=require('path');var timeout=require(_0x75f0('0x2'));var express=require(_0x75f0('0x3'));var router=express[_0x75f0('0x4')]();var auth=require(_0x75f0('0x5'));var interaction=require(_0x75f0('0x6'));var config=require(_0x75f0('0x7'));var controller=require('./openchannelAccount.controller');router[_0x75f0('0x8')]('/',auth[_0x75f0('0x9')](),controller[_0x75f0('0xa')]);router[_0x75f0('0x8')](_0x75f0('0xb'),auth[_0x75f0('0x9')](),controller[_0x75f0('0xc')]);router['get']('/:id',auth[_0x75f0('0x9')](),controller[_0x75f0('0xd')]);router[_0x75f0('0x8')](_0x75f0('0xe'),auth[_0x75f0('0x9')](),controller[_0x75f0('0xf')]);router[_0x75f0('0x8')](_0x75f0('0x10'),auth[_0x75f0('0x9')](),controller[_0x75f0('0x11')]);router[_0x75f0('0x8')](_0x75f0('0x12'),auth[_0x75f0('0x9')](),controller[_0x75f0('0x13')]);router['get'](_0x75f0('0x14'),auth[_0x75f0('0x9')](),controller[_0x75f0('0x15')]);router['get'](_0x75f0('0x16'),auth[_0x75f0('0x9')](),controller[_0x75f0('0x17')]);router[_0x75f0('0x18')]('/',auth[_0x75f0('0x9')](),controller[_0x75f0('0x19')]);router['post'](_0x75f0('0xe'),auth[_0x75f0('0x9')](),controller[_0x75f0('0x1a')]);router['post'](_0x75f0('0x10'),auth['isAuthenticated'](),controller[_0x75f0('0x1b')]);router[_0x75f0('0x18')](_0x75f0('0x1c'),controller[_0x75f0('0x1d')]);router[_0x75f0('0x18')](_0x75f0('0x12'),auth[_0x75f0('0x9')](),controller['addApplications']);router[_0x75f0('0x18')](_0x75f0('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x75f0('0x1e')]);router[_0x75f0('0x1f')](_0x75f0('0x20'),auth[_0x75f0('0x9')](),controller['update']);router['delete'](_0x75f0('0x20'),auth['isAuthenticated'](),controller[_0x75f0('0x21')]);router[_0x75f0('0x22')](_0x75f0('0xe'),auth[_0x75f0('0x9')](),controller[_0x75f0('0x23')]);router[_0x75f0('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x75f0('0x24')]);router[_0x75f0('0x22')]('/:id/users',auth[_0x75f0('0x9')](),controller['removeAgents']);module[_0x75f0('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 01aa2fd..4915153 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 _0xf0ac=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x54c5ed,_0x27ca67){var _0x4cb286=function(_0x2cbc6b){while(--_0x2cbc6b){_0x54c5ed['push'](_0x54c5ed['shift']());}};_0x4cb286(++_0x27ca67);}(_0xf0ac,0x72));var _0xcf0a=function(_0x37a71f,_0x3a4e11){_0x37a71f=_0x37a71f-0x0;var _0x1ab1ed=_0xf0ac[_0x37a71f];return _0x1ab1ed;};'use strict';var Sequelize=require(_0xcf0a('0x0'));var rs=require('randomstring');module[_0xcf0a('0x1')]={'name':{'type':Sequelize[_0xcf0a('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xcf0a('0x2')]},'token':{'type':Sequelize[_0xcf0a('0x2')],'defaultValue':function(){return rs[_0xcf0a('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcf0a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf0a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcf0a('0x2')]},'queueTransfer':{'type':Sequelize[_0xcf0a('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf0a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf0a('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf0a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf0a('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xcf0a('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xcf0a('0x5')],'defaultValue':![],'comment':_0xcf0a('0x7'),'set':function(_0x38c9f0){if(!_0x38c9f0)this[_0xcf0a('0x8')](_0xcf0a('0x9'),null);this[_0xcf0a('0x8')](_0xcf0a('0xa'),_0x38c9f0);}}}; \ No newline at end of file +var _0x54ea=['exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x54ea,0x185));var _0xa54e=function(_0x17b057,_0x31532b){_0x17b057=_0x17b057-0x0;var _0x431798=_0x54ea[_0x17b057];return _0x431798;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa54e('0x0'));module[_0xa54e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa54e('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa54e('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xa54e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa54e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa54e('0x4')],'defaultValue':function(){return _0xa54e('0x5');}},'notificationSound':{'type':Sequelize[_0xa54e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa54e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa54e('0x3')]},'queueTransfer':{'type':Sequelize[_0xa54e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa54e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa54e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa54e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa54e('0x6')],'defaultValue':![],'comment':_0xa54e('0x9'),'set':function(_0x9d3796){if(!_0x9d3796)this[_0xa54e('0xa')](_0xa54e('0xb'),null);this[_0xa54e('0xa')](_0xa54e('0xc'),_0x9d3796);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 50a3fde..adf931d 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 _0x5fab=['to-csv','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','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','account','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','EventManager','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','send','out','Messages','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x24f571,_0x2fd7d4){var _0x296e1c=function(_0x328466){while(--_0x328466){_0x24f571['push'](_0x24f571['shift']());}};_0x296e1c(++_0x2fd7d4);}(_0x5fab,0x177));var _0xb5fa=function(_0xddb860,_0x344918){_0xddb860=_0xddb860-0x0;var _0x255df9=_0x5fab[_0xddb860];return _0x255df9;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');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('0xb'));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'];config['redis']=_[_0xb5fa('0x1a')](config[_0xb5fa('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb5fa('0x1c'))(new Redis(config['redis']));require(_0xb5fa('0x1d'))[_0xb5fa('0x1e')](socket);var jayson=require(_0xb5fa('0x1f'));var client=jayson[_0xb5fa('0x20')][_0xb5fa('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38e964,_0x587043,_0x31f252,_0x27c8f7){return new BPromise(function(_0x56fe10,_0x4fabcc){var _0x451a55=_0x27c8f7||client;return _0x451a55[_0xb5fa('0x22')](_0x38e964,_0x31f252)[_0xb5fa('0x23')](function(_0x46eef0){logger[_0xb5fa('0x24')](_0xb5fa('0x25'),_0x587043,_0xb5fa('0x26'));logger[_0xb5fa('0x27')](_0xb5fa('0x28'),_0x587043,_0xb5fa('0x26'),JSON[_0xb5fa('0x29')](_0x46eef0));if(_0x46eef0[_0xb5fa('0x2a')]){if(_0x46eef0['error'][_0xb5fa('0x2b')]===0x1f4){logger['error'](_0xb5fa('0x25'),_0x587043,_0x46eef0['error'][_0xb5fa('0x2c')]);return _0x4fabcc(_0x46eef0[_0xb5fa('0x2a')]['message']);}logger[_0xb5fa('0x2a')](_0xb5fa('0x25'),_0x587043,_0x46eef0[_0xb5fa('0x2a')]['message']);return _0x56fe10(_0x46eef0[_0xb5fa('0x2a')][_0xb5fa('0x2c')]);}else{logger[_0xb5fa('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x587043,_0xb5fa('0x26'));_0x56fe10(_0x46eef0['result'][_0xb5fa('0x2c')]);}})[_0xb5fa('0x2d')](function(_0x11053a){logger[_0xb5fa('0x2a')](_0xb5fa('0x25'),_0x587043,_0x11053a);_0x4fabcc(_0x11053a);});});}function respondWithStatusCode(_0x3f61cd,_0x6a455c){_0x6a455c=_0x6a455c||0xcc;return function(_0x20d649){if(_0x20d649){return _0x3f61cd['sendStatus'](_0x6a455c);}return _0x3f61cd['status'](_0x6a455c)['end']();};}function respondWithResult(_0x5a1c39,_0x28a350){_0x28a350=_0x28a350||0xc8;return function(_0x460b54){if(_0x460b54){return _0x5a1c39[_0xb5fa('0x2e')](_0x28a350)[_0xb5fa('0x2f')](_0x460b54);}};}function respondWithFilteredResult(_0x534884,_0x3506a4){return function(_0x358549){if(_0x358549){var _0x353314=_0x358549[_0xb5fa('0x30')],_0x409af9=_0x3506a4[_0xb5fa('0x31')],_0x2a5690=_0x3506a4[_0xb5fa('0x31')]+_0x3506a4[_0xb5fa('0x32')],_0x142bfa;if(_0x2a5690>=_0x353314){_0x2a5690=_0x353314;_0x142bfa=0xc8;}else{_0x142bfa=0xce;}_0x534884[_0xb5fa('0x2e')](_0x142bfa);return _0x534884[_0xb5fa('0x33')](_0xb5fa('0x34'),_0x409af9+'-'+_0x2a5690+'/'+_0x353314)[_0xb5fa('0x2f')](_0x358549);}return null;};}function patchUpdates(_0x319c48){return function(_0x291938){try{jsonpatch[_0xb5fa('0x35')](_0x291938,_0x319c48,!![]);}catch(_0x10fb43){return BPromise[_0xb5fa('0x36')](_0x10fb43);}return _0x291938['save']();};}function saveUpdates(_0x2cc6cb,_0x4d056c){return function(_0x5c7fdd){if(_0x5c7fdd){return _0x5c7fdd['update'](_0x2cc6cb)[_0xb5fa('0x23')](function(_0x502d57){return _0x502d57;});}return null;};}function removeEntity(_0x3bb4de,_0x5876f1){return function(_0x5518b1){if(_0x5518b1){return _0x5518b1[_0xb5fa('0x37')]()[_0xb5fa('0x23')](function(){var _0x4a4bff=_0x5518b1['get']({'plain':!![]});var _0x3d73c2=_0xb5fa('0x38');return db[_0xb5fa('0x39')]['destroy']({'where':{'type':_0x3d73c2,'resourceId':_0x4a4bff['id']}})[_0xb5fa('0x23')](function(){return _0x5518b1;});})[_0xb5fa('0x23')](function(){_0x3bb4de['status'](0xcc)[_0xb5fa('0x3a')]();});}};}function handleEntityNotFound(_0x2056de,_0x204d6b){return function(_0x5580f0){if(!_0x5580f0){_0x2056de[_0xb5fa('0x3b')](0x194);}return _0x5580f0;};}function handleError(_0x2c950e,_0x24ef11){_0x24ef11=_0x24ef11||0x1f4;return function(_0x55bdb7){logger[_0xb5fa('0x2a')](_0x55bdb7[_0xb5fa('0x3c')]);if(_0x55bdb7[_0xb5fa('0x3d')]){delete _0x55bdb7[_0xb5fa('0x3d')];}_0x2c950e['status'](_0x24ef11)['send'](_0x55bdb7);};}exports['index']=function(_0x49e786,_0x5989e1){var _0x4dff5d={'include':[{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')}]},_0x908bc8={},_0x4c0a4d={'count':0x0,'rows':[]};var _0x36db1a=_[_0xb5fa('0x40')](db[_0xb5fa('0x41')][_0xb5fa('0x42')],function(_0x4b4c4c){return{'name':_0x4b4c4c['fieldName'],'type':_0x4b4c4c['type'][_0xb5fa('0x43')]};});_0x908bc8['model']=_[_0xb5fa('0x40')](_0x36db1a,'name');_0x908bc8['query']=_[_0xb5fa('0x44')](_0x49e786[_0xb5fa('0x45')]);_0x908bc8[_0xb5fa('0x46')]=_[_0xb5fa('0x47')](_0x908bc8[_0xb5fa('0x48')],_0x908bc8[_0xb5fa('0x45')]);_0x4dff5d[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x908bc8[_0xb5fa('0x48')],qs[_0xb5fa('0x4a')](_0x49e786['query'][_0xb5fa('0x4a')]));_0x4dff5d['attributes']=_0x4dff5d[_0xb5fa('0x49')][_0xb5fa('0x4b')]?_0x4dff5d[_0xb5fa('0x49')]:_0x908bc8[_0xb5fa('0x48')];if(!_0x49e786[_0xb5fa('0x45')][_0xb5fa('0x4c')](_0xb5fa('0x4d'))){_0x4dff5d[_0xb5fa('0x32')]=qs['limit'](_0x49e786[_0xb5fa('0x45')][_0xb5fa('0x32')]);_0x4dff5d['offset']=qs[_0xb5fa('0x31')](_0x49e786['query'][_0xb5fa('0x31')]);}_0x4dff5d[_0xb5fa('0x4e')]=qs['sort'](_0x49e786['query'][_0xb5fa('0x4f')]);_0x4dff5d[_0xb5fa('0x50')]=qs[_0xb5fa('0x46')](_[_0xb5fa('0x51')](_0x49e786[_0xb5fa('0x45')],_0x908bc8[_0xb5fa('0x46')]),_0x36db1a);if(_0x49e786[_0xb5fa('0x45')][_0xb5fa('0x52')]){_0x4dff5d['where']=_[_0xb5fa('0x53')](_0x4dff5d[_0xb5fa('0x50')],{'$or':_['map'](_0x36db1a,function(_0xee6baa){if(_0xee6baa[_0xb5fa('0x54')]!==_0xb5fa('0x55')){var _0x43b056={};_0x43b056[_0xee6baa[_0xb5fa('0x3d')]]={'$like':'%'+_0x49e786[_0xb5fa('0x45')][_0xb5fa('0x52')]+'%'};return _0x43b056;}})});}_0x4dff5d=_[_0xb5fa('0x53')]({},_0x4dff5d,_0x49e786[_0xb5fa('0x56')]);var _0x464e36={'where':_0x4dff5d[_0xb5fa('0x50')]};return db[_0xb5fa('0x41')][_0xb5fa('0x30')](_0x464e36)[_0xb5fa('0x23')](function(_0x42a359){_0x4c0a4d[_0xb5fa('0x30')]=_0x42a359;if(_0x49e786['query']['includeAll']){_0x4dff5d[_0xb5fa('0x57')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xb5fa('0x58')](_0x4dff5d);})[_0xb5fa('0x23')](function(_0x5404f6){_0x4c0a4d[_0xb5fa('0x59')]=_0x5404f6;return _0x4c0a4d;})[_0xb5fa('0x23')](respondWithFilteredResult(_0x5989e1,_0x4dff5d))[_0xb5fa('0x2d')](handleError(_0x5989e1,null));};exports[_0xb5fa('0x5a')]=function(_0x471517,_0x3ffee0){var _0x51d5f7={'raw':![],'where':{'id':_0x471517['params']['id']},'include':[{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')}]},_0x27a651={};_0x27a651[_0xb5fa('0x48')]=_['keys'](db[_0xb5fa('0x41')][_0xb5fa('0x42')]);_0x27a651['query']=_['keys'](_0x471517[_0xb5fa('0x45')]);_0x27a651[_0xb5fa('0x46')]=_[_0xb5fa('0x47')](_0x27a651[_0xb5fa('0x48')],_0x27a651[_0xb5fa('0x45')]);_0x51d5f7[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x27a651[_0xb5fa('0x48')],qs[_0xb5fa('0x4a')](_0x471517[_0xb5fa('0x45')][_0xb5fa('0x4a')]));_0x51d5f7[_0xb5fa('0x49')]=_0x51d5f7[_0xb5fa('0x49')][_0xb5fa('0x4b')]?_0x51d5f7[_0xb5fa('0x49')]:_0x27a651[_0xb5fa('0x48')];if(_0x471517[_0xb5fa('0x45')][_0xb5fa('0x5b')]){_0x51d5f7['include']=[{'all':!![]}];}_0x51d5f7=_[_0xb5fa('0x53')]({},_0x51d5f7,_0x471517[_0xb5fa('0x56')]);return db[_0xb5fa('0x41')][_0xb5fa('0x5c')](_0x51d5f7)[_0xb5fa('0x23')](handleEntityNotFound(_0x3ffee0,null))[_0xb5fa('0x23')](respondWithResult(_0x3ffee0,null))[_0xb5fa('0x2d')](handleError(_0x3ffee0,null));};exports[_0xb5fa('0x5d')]=function(_0x1cb39e,_0x1e0547){return db['OpenchannelAccount']['create'](_0x1cb39e[_0xb5fa('0x5e')],{})[_0xb5fa('0x23')](function(_0x1e78cb){var _0x5caf84=_0x1cb39e[_0xb5fa('0x5f')][_0xb5fa('0x60')]({'plain':!![]});if(!_0x5caf84)throw new Error(_0xb5fa('0x61'));if(_0x5caf84[_0xb5fa('0x62')]===_0xb5fa('0x5f')){var _0x9d12f1=_0x1e78cb[_0xb5fa('0x60')]({'plain':!![]});var _0x4f82f0=_0xb5fa('0x38');return db[_0xb5fa('0x63')]['find']({'where':{'name':_0x4f82f0,'userProfileId':_0x5caf84[_0xb5fa('0x64')]},'raw':!![]})[_0xb5fa('0x23')](function(_0x540295){if(_0x540295&&_0x540295[_0xb5fa('0x65')]===0x0){return db[_0xb5fa('0x39')][_0xb5fa('0x5d')]({'name':_0x9d12f1[_0xb5fa('0x3d')],'resourceId':_0x9d12f1['id'],'type':_0x540295[_0xb5fa('0x3d')],'sectionId':_0x540295['id']},{})[_0xb5fa('0x23')](function(){return _0x1e78cb;});}else{return _0x1e78cb;}})[_0xb5fa('0x2d')](function(_0x40d7d5){logger[_0xb5fa('0x2a')](_0xb5fa('0x66'),_0x40d7d5);throw _0x40d7d5;});}return _0x1e78cb;})[_0xb5fa('0x23')](respondWithResult(_0x1e0547,0xc9))[_0xb5fa('0x2d')](handleError(_0x1e0547,null));};exports[_0xb5fa('0x67')]=function(_0x29ffb7,_0x1d6840){if(_0x29ffb7[_0xb5fa('0x5e')]['id']){delete _0x29ffb7[_0xb5fa('0x5e')]['id'];}return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x29ffb7[_0xb5fa('0x68')]['id']},'include':[{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')}]})['then'](handleEntityNotFound(_0x1d6840,null))[_0xb5fa('0x23')](saveUpdates(_0x29ffb7[_0xb5fa('0x5e')],null))[_0xb5fa('0x23')](respondWithResult(_0x1d6840,null))['catch'](handleError(_0x1d6840,null));};exports[_0xb5fa('0x37')]=function(_0x2d786e,_0x58d394){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x2d786e[_0xb5fa('0x68')]['id']}})['then'](handleEntityNotFound(_0x58d394,null))['then'](removeEntity(_0x58d394,null))[_0xb5fa('0x2d')](handleError(_0x58d394,null));};exports[_0xb5fa('0x69')]=function(_0x432f04,_0x57d8b7){return db[_0xb5fa('0x41')][_0xb5fa('0x69')]()[_0xb5fa('0x23')](respondWithResult(_0x57d8b7,null))[_0xb5fa('0x2d')](handleError(_0x57d8b7,null));};exports['addDisposition']=function(_0x55000b,_0x5cec07,_0x2cbaba){if(_0x55000b[_0xb5fa('0x5e')]['id']){delete _0x55000b[_0xb5fa('0x5e')]['id'];}return db['OpenchannelAccount'][_0xb5fa('0x5c')]({'where':{'id':_0x55000b[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x5cec07,null))[_0xb5fa('0x23')](function(_0x2a1872){if(_0x2a1872){_0x55000b[_0xb5fa('0x5e')][_0xb5fa('0x6a')]=_0x2a1872['id'];return db[_0xb5fa('0x6b')][_0xb5fa('0x5d')](_0x55000b[_0xb5fa('0x5e')]);}})[_0xb5fa('0x23')](respondWithResult(_0x5cec07,null))[_0xb5fa('0x2d')](handleError(_0x5cec07,null));};exports[_0xb5fa('0x6c')]=function(_0x38faa6,_0x41127a,_0x5eeaa1){var _0xf173e4={'raw':![],'where':{}};var _0x5a6f74={};var _0x47193c={'count':0x0,'rows':[]};return db[_0xb5fa('0x41')][_0xb5fa('0x6d')]({'where':{'id':_0x38faa6[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x41127a,null))['then'](function(_0x1585cd){if(_0x1585cd){_0x5a6f74['model']=_[_0xb5fa('0x44')](db[_0xb5fa('0x6b')][_0xb5fa('0x42')]);_0x5a6f74[_0xb5fa('0x45')]=_['keys'](_0x38faa6['query']);_0x5a6f74['filters']=_[_0xb5fa('0x47')](_0x5a6f74[_0xb5fa('0x48')],_0x5a6f74[_0xb5fa('0x45')]);_0xf173e4[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x5a6f74[_0xb5fa('0x48')],qs['fields'](_0x38faa6[_0xb5fa('0x45')]['fields']));_0xf173e4['attributes']=_0xf173e4[_0xb5fa('0x49')]['length']?_0xf173e4['attributes']:_0x5a6f74['model'];if(!_0x38faa6[_0xb5fa('0x45')]['hasOwnProperty'](_0xb5fa('0x4d'))){_0xf173e4[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x38faa6['query']['limit']);_0xf173e4[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x38faa6['query'][_0xb5fa('0x31')]);}_0xf173e4[_0xb5fa('0x4e')]=qs[_0xb5fa('0x4f')](_0x38faa6[_0xb5fa('0x45')]['sort']);_0xf173e4[_0xb5fa('0x50')]=qs[_0xb5fa('0x46')](_[_0xb5fa('0x51')](_0x38faa6[_0xb5fa('0x45')],_0x5a6f74[_0xb5fa('0x46')]));_0xf173e4[_0xb5fa('0x50')][_0xb5fa('0x6a')]=_0x1585cd['id'];if(_0x38faa6['query'][_0xb5fa('0x52')]){_0xf173e4['where']=_[_0xb5fa('0x53')](_0xf173e4[_0xb5fa('0x50')],{'$or':_['map'](_0xf173e4[_0xb5fa('0x49')],function(_0x212d4e){var _0xdc4fe4={};_0xdc4fe4[_0x212d4e]={'$like':'%'+_0x38faa6[_0xb5fa('0x45')][_0xb5fa('0x52')]+'%'};return _0xdc4fe4;})});}_0xf173e4=_[_0xb5fa('0x53')]({},_0xf173e4,_0x38faa6[_0xb5fa('0x56')]);return db[_0xb5fa('0x6b')]['count']({'where':_0xf173e4[_0xb5fa('0x50')]})[_0xb5fa('0x23')](function(_0x2c5357){_0x47193c[_0xb5fa('0x30')]=_0x2c5357;if(_0x38faa6['query']['includeAll']){_0xf173e4['include']=[{'all':!![]}];}return db['Disposition'][_0xb5fa('0x58')](_0xf173e4);})[_0xb5fa('0x23')](function(_0xff504d){_0x47193c[_0xb5fa('0x59')]=_0xff504d;return _0x47193c;});}})['then'](respondWithFilteredResult(_0x41127a,_0xf173e4))['catch'](handleError(_0x41127a,null));};exports[_0xb5fa('0x6e')]=function(_0x55098c,_0x32eebd,_0x35df3c){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x55098c['params']['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x32eebd,null))['then'](function(_0x46b0a8){if(_0x46b0a8){return _0x46b0a8[_0xb5fa('0x6e')](_0x55098c['query']['ids']);}})[_0xb5fa('0x23')](respondWithStatusCode(_0x32eebd,null))[_0xb5fa('0x2d')](handleError(_0x32eebd,null));};exports[_0xb5fa('0x6f')]=function(_0x1bcca7,_0x20d6b5,_0xa7fd3b){if(_0x1bcca7[_0xb5fa('0x5e')]['id']){delete _0x1bcca7[_0xb5fa('0x5e')]['id'];}return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x1bcca7[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x20d6b5,null))[_0xb5fa('0x23')](function(_0x53c7b5){if(_0x53c7b5){_0x1bcca7['body'][_0xb5fa('0x6a')]=_0x53c7b5['id'];return db['CannedAnswer'][_0xb5fa('0x5d')](_0x1bcca7[_0xb5fa('0x5e')]);}})['then'](respondWithResult(_0x20d6b5,null))[_0xb5fa('0x2d')](handleError(_0x20d6b5,null));};exports[_0xb5fa('0x70')]=function(_0x4c2414,_0x45afeb,_0x3ba1d0){var _0x4b9d03={'raw':![],'where':{}};var _0x138c60={};var _0x3a59ed={'count':0x0,'rows':[]};return db[_0xb5fa('0x41')]['findOne']({'where':{'id':_0x4c2414['params']['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x45afeb,null))[_0xb5fa('0x23')](function(_0x3b5e1d){if(_0x3b5e1d){_0x138c60[_0xb5fa('0x48')]=_[_0xb5fa('0x44')](db[_0xb5fa('0x71')][_0xb5fa('0x42')]);_0x138c60[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x4c2414[_0xb5fa('0x45')]);_0x138c60['filters']=_['intersection'](_0x138c60[_0xb5fa('0x48')],_0x138c60[_0xb5fa('0x45')]);_0x4b9d03[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x138c60['model'],qs[_0xb5fa('0x4a')](_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x4a')]));_0x4b9d03['attributes']=_0x4b9d03[_0xb5fa('0x49')][_0xb5fa('0x4b')]?_0x4b9d03[_0xb5fa('0x49')]:_0x138c60[_0xb5fa('0x48')];if(!_0x4c2414['query'][_0xb5fa('0x4c')](_0xb5fa('0x4d'))){_0x4b9d03[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x32')]);_0x4b9d03[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x31')]);}_0x4b9d03[_0xb5fa('0x4e')]=qs[_0xb5fa('0x4f')](_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x4f')]);_0x4b9d03[_0xb5fa('0x50')]=qs['filters'](_[_0xb5fa('0x51')](_0x4c2414[_0xb5fa('0x45')],_0x138c60[_0xb5fa('0x46')]));_0x4b9d03[_0xb5fa('0x50')][_0xb5fa('0x6a')]=_0x3b5e1d['id'];if(_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x52')]){_0x4b9d03[_0xb5fa('0x50')]=_['merge'](_0x4b9d03['where'],{'$or':_[_0xb5fa('0x40')](_0x4b9d03['attributes'],function(_0x5d0ca8){var _0x3b24fb={};_0x3b24fb[_0x5d0ca8]={'$like':'%'+_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x52')]+'%'};return _0x3b24fb;})});}_0x4b9d03=_['merge']({},_0x4b9d03,_0x4c2414[_0xb5fa('0x56')]);return db[_0xb5fa('0x71')][_0xb5fa('0x30')]({'where':_0x4b9d03['where']})[_0xb5fa('0x23')](function(_0x6cc978){_0x3a59ed['count']=_0x6cc978;if(_0x4c2414[_0xb5fa('0x45')][_0xb5fa('0x5b')]){_0x4b9d03[_0xb5fa('0x57')]=[{'all':!![]}];}return db[_0xb5fa('0x71')][_0xb5fa('0x58')](_0x4b9d03);})[_0xb5fa('0x23')](function(_0x5fe2fc){_0x3a59ed['rows']=_0x5fe2fc;return _0x3a59ed;});}})[_0xb5fa('0x23')](respondWithFilteredResult(_0x45afeb,_0x4b9d03))[_0xb5fa('0x2d')](handleError(_0x45afeb,null));};exports[_0xb5fa('0x72')]=function(_0x320eda,_0x4c1586,_0x48f335){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x320eda[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x4c1586,null))['then'](function(_0x4ee36b){if(_0x4ee36b){return _0x4ee36b['removeAnswers'](_0x320eda['query'][_0xb5fa('0x73')]);}})[_0xb5fa('0x23')](respondWithStatusCode(_0x4c1586,null))[_0xb5fa('0x2d')](handleError(_0x4c1586,null));};exports[_0xb5fa('0x74')]=function(_0x13deb3,_0x1a19ec,_0x3c36a8){var _0x10502a={'body':_0x13deb3[_0xb5fa('0x5e')],'channel':_0xb5fa('0x75')};var _0x4581ed=[];var _0x5ce5d7=[];var _0x427d61={};var _0x2a6f66=![];return db['CmContact'][_0xb5fa('0x69')]()[_0xb5fa('0x23')](function(_0x5b7d7e){if(!_0x5b7d7e){throw new db[(_0xb5fa('0x76'))][(_0xb5fa('0x77'))](_0xb5fa('0x78'));}_0x4581ed=_[_0xb5fa('0x79')](_[_0xb5fa('0x44')](_0x5b7d7e),[_0xb5fa('0x7a'),_0xb5fa('0x7b')]);_0x5ce5d7=_[_0xb5fa('0x79')](_[_0xb5fa('0x44')](_0x5b7d7e),['createdAt',_0xb5fa('0x7b'),_0xb5fa('0x7c'),_0xb5fa('0x7d')]);if(_0x13deb3[_0xb5fa('0x5e')]['id']){delete _0x13deb3[_0xb5fa('0x5e')]['id'];}if(_[_0xb5fa('0x7e')](_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x7f')])){throw new db['Sequelize'][(_0xb5fa('0x77'))]('from\x20is\x20mandatory');}if(_[_0xb5fa('0x7e')](_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')])||_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')]===''){throw new db[(_0xb5fa('0x76'))][(_0xb5fa('0x77'))](_0xb5fa('0x80'));}if(_[_0xb5fa('0x7e')](_0x13deb3['body']['mapKey'])){throw new db[(_0xb5fa('0x76'))][(_0xb5fa('0x77'))](_0xb5fa('0x81')+_0x5ce5d7);}if(!_[_0xb5fa('0x82')](_0x5ce5d7,_0x13deb3['body'][_0xb5fa('0x83')])){throw new db['Sequelize'][(_0xb5fa('0x77'))](_0xb5fa('0x84')+_0x5ce5d7);}_0x427d61[_0x13deb3['body'][_0xb5fa('0x83')]]=_0x13deb3['body'][_0xb5fa('0x7f')];})['then'](function(){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x13deb3[_0xb5fa('0x68')]['id']},'include':[{'model':db[_0xb5fa('0x85')],'as':_0xb5fa('0x86'),'include':[{'model':db[_0xb5fa('0x87')],'as':_0xb5fa('0x88'),'where':_0x427d61,'limit':0x1,'order':[[_0xb5fa('0x7b'),_0xb5fa('0x89')]]}]},{'model':db[_0xb5fa('0x8a')],'as':_0xb5fa('0x8b')}]});})['then'](handleEntityNotFound(_0x1a19ec,null))[_0xb5fa('0x23')](function(_0x284b34){if(_0x284b34&&_0x284b34[_0xb5fa('0x86')]){_0x10502a['account']=_0x284b34;_0x10502a[_0xb5fa('0x8c')]=_0x284b34[_0xb5fa('0x8b')];_0x10502a[_0xb5fa('0x8d')]=_0x284b34[_0xb5fa('0x86')];_0x10502a[_0xb5fa('0x8c')]=_[_0xb5fa('0x8e')](_0x10502a[_0xb5fa('0x8c')],[_0xb5fa('0x8f')],['asc']);if(_0x10502a[_0xb5fa('0x90')]['Applications']){delete _0x10502a[_0xb5fa('0x90')][_0xb5fa('0x8b')];}if(_0x10502a[_0xb5fa('0x90')][_0xb5fa('0x86')]&&_0x10502a[_0xb5fa('0x90')][_0xb5fa('0x86')][_0xb5fa('0x88')][_0xb5fa('0x4b')]){return _0x10502a[_0xb5fa('0x90')][_0xb5fa('0x86')][_0xb5fa('0x88')][0x0];}var _0x46f1d3=_[_0xb5fa('0x1a')](_0x13deb3[_0xb5fa('0x5e')],{'firstName':_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x7f')],'ListId':_0x284b34[_0xb5fa('0x7d')]});_0x46f1d3[_0x13deb3['body'][_0xb5fa('0x83')]]=_0x13deb3[_0xb5fa('0x5e')]['from'];return db[_0xb5fa('0x87')][_0xb5fa('0x5d')](_0x46f1d3,{'fields':_0x4581ed,'raw':!![]});}})['then'](handleEntityNotFound(_0x1a19ec,null))['then'](function(_0x486f43){_0x10502a[_0xb5fa('0x91')]=_0x486f43;if(_0x486f43){var _0x5e40be={'ContactId':_0x486f43['id'],'OpenchannelAccountId':_0x13deb3[_0xb5fa('0x68')]['id'],'from':(_0x486f43[_0xb5fa('0x92')]||'')+'\x20'+(_0x486f43[_0xb5fa('0x93')]||'')};var _0x33b3c9={'OpenchannelAccountId':_0x13deb3[_0xb5fa('0x68')]['id'],'closed':![]};if(_0x13deb3['body']['threadId']){_0x33b3c9['threadId']=_0x13deb3[_0xb5fa('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0xb5fa('0x5c')]({'where':_0x33b3c9})['then'](function(_0x8b9718){if(_0x8b9718){return[_0x8b9718,![]];}_0x5e40be[_0xb5fa('0x94')]=_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x94')];_0x5e40be[_0xb5fa('0x95')]=_0x13deb3['body'][_0xb5fa('0x95')];return db[_0xb5fa('0x96')][_0xb5fa('0x5d')](_0x5e40be)[_0xb5fa('0x23')](function(_0x23b70f){return[_0x23b70f,!![]];});});}else{_0x33b3c9['threadId']=null;}_0x33b3c9[_0xb5fa('0x97')]=_0x486f43['id'];return db[_0xb5fa('0x96')][_0xb5fa('0x5c')]({'where':_0x33b3c9})[_0xb5fa('0x23')](function(_0x5364ce){if(_0x5364ce){return[_0x5364ce,![]];}return db[_0xb5fa('0x96')]['create'](_0x5e40be)[_0xb5fa('0x23')](function(_0x390043){return[_0x390043,!![]];});});}})[_0xb5fa('0x98')](function(_0xc6d275,_0x32c191){if(_0xc6d275){_0x2a6f66=_0x32c191;if(!_0x32c191){var _0x802cc0={'from':(_0x10502a[_0xb5fa('0x91')][_0xb5fa('0x92')]||'')+'\x20'+(_0x10502a[_0xb5fa('0x91')][_0xb5fa('0x93')]||'')};if(_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x94')]&&_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x99')]&&_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x94')]!=_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x99')]){_0x802cc0[_0xb5fa('0x94')]=_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x99')];}return _0xc6d275[_0xb5fa('0x67')](_0x802cc0);}else{return _0xc6d275;}}})['then'](function(_0x4cfa95){_0x10502a[_0xb5fa('0x9a')]=_0x4cfa95[_0xb5fa('0x60')]({'plain':!![]});_0x10502a[_0xb5fa('0x9a')][_0xb5fa('0x9b')]=_0x2a6f66;if(_0x10502a[_0xb5fa('0x9a')][_0xb5fa('0x9b')]){if(_0x10502a['account']['autoclose']){_0x10502a['applications'][_0xb5fa('0x9c')]({'id':0x0,'priority':_0x10502a[_0xb5fa('0x8c')]['length']+0x1,'app':_0xb5fa('0x9d'),'appdata':_0xb5fa('0x9e'),'interval':'*,*,*,*'});}}return db[_0xb5fa('0x9f')][_0xb5fa('0x5d')]({'body':_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')],'OpenchannelAccountId':_0x13deb3[_0xb5fa('0x68')]['id'],'OpenchannelInteractionId':_0x4cfa95['id'],'direction':'in','ContactId':_0x10502a[_0xb5fa('0x91')]['id'],'AttachmentId':_0x13deb3[_0xb5fa('0x5e')][_0xb5fa('0xa0')]});})['then'](function(_0x24a86){_0x10502a['message']=_0x24a86;if(_0x10502a[_0xb5fa('0x9a')][_0xb5fa('0xa1')]){return db[_0xb5fa('0xa2')][_0xb5fa('0x5c')]({'attributes':['id','name'],'where':{'id':_0x10502a[_0xb5fa('0x9a')][_0xb5fa('0xa1')]}})[_0xb5fa('0x23')](function(_0x207a38){if(_0x207a38){_0x10502a['applications'][_0xb5fa('0xa3')]({'id':0x0,'priority':0x0,'app':_0xb5fa('0xa4'),'appdata':_0x207a38[_0xb5fa('0x3d')]+','+(_0x10502a[_0xb5fa('0x90')][_0xb5fa('0xa5')]||0xa),'interval':_0xb5fa('0xa6')});_0x10502a[_0xb5fa('0xa7')]=![];}return respondWithRpcPromise('Start',_0xb5fa('0xa8'),_0x10502a);});}return respondWithRpcPromise('Start',_0xb5fa('0xa8'),_0x10502a);})[_0xb5fa('0x23')](function(_0x412dd1){respondWithRpcPromise(_0xb5fa('0xa9'),_0xb5fa('0xa9'),{'event':_0xb5fa('0x74'),'message':_0x412dd1},client9002);return _0x412dd1;})[_0xb5fa('0x23')](respondWithResult(_0x1a19ec,null))['catch'](handleError(_0x1a19ec,null));};exports['addApplications']=function(_0x331ff8,_0x3d9563,_0x419034){return db[_0xb5fa('0x41')][_0xb5fa('0x6d')]({'where':{'id':_0x331ff8[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x3d9563,null))[_0xb5fa('0x23')](function(_0x5b9897){if(_0x5b9897){return db[_0xb5fa('0xaa')][_0xb5fa('0xab')](function(_0x270cda){return db[_0xb5fa('0x8a')][_0xb5fa('0x37')]({'where':{'OpenchannelAccountId':_0x331ff8[_0xb5fa('0x68')]['id']},'transaction':_0x270cda})[_0xb5fa('0x23')](function(_0x2182b3){var _0x330d32=_['map'](_0x331ff8[_0xb5fa('0x5e')],function(_0x5996d6){_0x5996d6[_0xb5fa('0x6a')]=_0x331ff8[_0xb5fa('0x68')]['id'];return _0x5996d6;});return db[_0xb5fa('0x8a')][_0xb5fa('0xac')](_0x330d32,{'transaction':_0x270cda});});})[_0xb5fa('0x23')](function(){return db[_0xb5fa('0x8a')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x331ff8[_0xb5fa('0x68')]['id']},'order':_0xb5fa('0x8f')});});}})[_0xb5fa('0x23')](respondWithResult(_0x3d9563,null))[_0xb5fa('0x2d')](handleError(_0x3d9563,null));};exports[_0xb5fa('0xad')]=function(_0x21951e,_0x4444da,_0x55ec26){var _0x5d0e21={};var _0x405677={};var _0x3a8dad;var _0x2254fa;return db[_0xb5fa('0x41')][_0xb5fa('0x6d')]({'where':{'id':_0x21951e[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x4444da,null))[_0xb5fa('0x23')](function(_0x31c103){if(_0x31c103){_0x3a8dad=_0x31c103;_0x405677[_0xb5fa('0x48')]=_['keys'](db[_0xb5fa('0x8a')][_0xb5fa('0x42')]);_0x405677[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x21951e[_0xb5fa('0x45')]);_0x405677[_0xb5fa('0x46')]=_[_0xb5fa('0x47')](_0x405677[_0xb5fa('0x48')],_0x405677[_0xb5fa('0x45')]);_0x5d0e21[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x405677[_0xb5fa('0x48')],qs[_0xb5fa('0x4a')](_0x21951e[_0xb5fa('0x45')]['fields']));_0x5d0e21['attributes']=_0x5d0e21[_0xb5fa('0x49')][_0xb5fa('0x4b')]?_0x5d0e21['attributes']:_0x405677[_0xb5fa('0x48')];_0x5d0e21[_0xb5fa('0x4e')]=qs[_0xb5fa('0x4f')](_0x21951e['query'][_0xb5fa('0x4f')]);_0x5d0e21[_0xb5fa('0x50')]=qs[_0xb5fa('0x46')](_[_0xb5fa('0x51')](_0x21951e[_0xb5fa('0x45')],_0x405677[_0xb5fa('0x46')]));if(_0x21951e[_0xb5fa('0x45')][_0xb5fa('0x52')]){_0x5d0e21['where']=_[_0xb5fa('0x53')](_0x5d0e21[_0xb5fa('0x50')],{'$or':_['map'](_0x5d0e21[_0xb5fa('0x49')],function(_0xafec2d){var _0x567ad1={};_0x567ad1[_0xafec2d]={'$like':'%'+_0x21951e[_0xb5fa('0x45')][_0xb5fa('0x52')]+'%'};return _0x567ad1;})});}_0x5d0e21=_[_0xb5fa('0x53')]({},_0x5d0e21,_0x21951e[_0xb5fa('0x56')]);return _0x3a8dad[_0xb5fa('0xad')](_0x5d0e21);}})[_0xb5fa('0x23')](function(_0x192c76){if(_0x192c76){_0x2254fa=_0x192c76[_0xb5fa('0x4b')];if(!_0x21951e['query'][_0xb5fa('0x4c')](_0xb5fa('0x4d'))){_0x5d0e21[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x21951e[_0xb5fa('0x45')]['limit']);_0x5d0e21[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x21951e[_0xb5fa('0x45')]['offset']);}return _0x3a8dad[_0xb5fa('0xad')](_0x5d0e21);}})[_0xb5fa('0x23')](function(_0x3c5c67){if(_0x3c5c67){return _0x3c5c67?{'count':_0x2254fa,'rows':_0x3c5c67}:null;}})['then'](respondWithResult(_0x4444da,null))[_0xb5fa('0x2d')](handleError(_0x4444da,null));};exports[_0xb5fa('0xae')]=function(_0x14f4b9,_0x2c1eb6,_0xbe63f8){var _0xc21f50={'raw':![],'where':{}};var _0x266eff={};var _0xae1424={'count':0x0,'rows':[]};return db[_0xb5fa('0x41')]['findOne']({'where':{'id':_0x14f4b9[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x2c1eb6,null))[_0xb5fa('0x23')](function(_0x4e65cc){if(_0x4e65cc){_0x266eff['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x266eff[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x14f4b9[_0xb5fa('0x45')]);_0x266eff[_0xb5fa('0x46')]=_[_0xb5fa('0x47')](_0x266eff[_0xb5fa('0x48')],_0x266eff[_0xb5fa('0x45')]);_0xc21f50[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x266eff[_0xb5fa('0x48')],qs['fields'](_0x14f4b9['query'][_0xb5fa('0x4a')]));_0xc21f50[_0xb5fa('0x49')]=_0xc21f50[_0xb5fa('0x49')]['length']?_0xc21f50['attributes']:_0x266eff[_0xb5fa('0x48')];if(!_0x14f4b9[_0xb5fa('0x45')][_0xb5fa('0x4c')](_0xb5fa('0x4d'))){_0xc21f50[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x14f4b9[_0xb5fa('0x45')][_0xb5fa('0x32')]);_0xc21f50[_0xb5fa('0x31')]=qs['offset'](_0x14f4b9[_0xb5fa('0x45')][_0xb5fa('0x31')]);}_0xc21f50[_0xb5fa('0x4e')]=qs[_0xb5fa('0x4f')](_0x14f4b9[_0xb5fa('0x45')][_0xb5fa('0x4f')]);_0xc21f50[_0xb5fa('0x50')]=qs[_0xb5fa('0x46')](_['pick'](_0x14f4b9[_0xb5fa('0x45')],_0x266eff[_0xb5fa('0x46')]));_0xc21f50['where']['OpenchannelAccountId']=_0x4e65cc['id'];if(_0x14f4b9[_0xb5fa('0x45')]['filter']){_0xc21f50[_0xb5fa('0x50')]=_[_0xb5fa('0x53')](_0xc21f50[_0xb5fa('0x50')],{'$or':_[_0xb5fa('0x40')](_0xc21f50[_0xb5fa('0x49')],function(_0x283367){var _0xa3b3d7={};_0xa3b3d7[_0x283367]={'$like':'%'+_0x14f4b9[_0xb5fa('0x45')]['filter']+'%'};return _0xa3b3d7;})});}_0xc21f50=_[_0xb5fa('0x53')]({},_0xc21f50,_0x14f4b9[_0xb5fa('0x56')]);return db[_0xb5fa('0x96')][_0xb5fa('0x30')]({'where':_0xc21f50['where']})[_0xb5fa('0x23')](function(_0x12733b){_0xae1424['count']=_0x12733b;if(_0x14f4b9[_0xb5fa('0x45')][_0xb5fa('0x5b')]){_0xc21f50['include']=[{'model':db[_0xb5fa('0x87')],'as':_0xb5fa('0xaf'),'required':![]},{'model':db['User'],'as':_0xb5fa('0xb0'),'attributes':['name','fullname',_0xb5fa('0xb1')],'required':![]},{'model':db[_0xb5fa('0xb2')],'as':_0xb5fa('0xb3'),'attributes':['id',_0xb5fa('0x3d'),_0xb5fa('0xb4')],'where':_0x14f4b9[_0xb5fa('0x45')][_0xb5fa('0xb5')]?{'id':_0x14f4b9['query'][_0xb5fa('0xb5')]}:undefined,'required':_0x14f4b9[_0xb5fa('0x45')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xb5fa('0x58')](_0xc21f50);})[_0xb5fa('0x23')](function(_0x689653){_0xae1424['rows']=_0x689653;return _0xae1424;});}})[_0xb5fa('0x23')](respondWithFilteredResult(_0x2c1eb6,_0xc21f50))['catch'](handleError(_0x2c1eb6,null));};exports[_0xb5fa('0xb6')]=function(_0x48d5b9,_0x4051b0,_0x229823){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x48d5b9[_0xb5fa('0x68')]['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x4051b0,null))[_0xb5fa('0x23')](function(_0x52fb1e){if(_0x52fb1e){return _0x52fb1e[_0xb5fa('0xb6')](_0x48d5b9[_0xb5fa('0x5e')]['ids'],_[_0xb5fa('0xb7')](_0x48d5b9['body'],[_0xb5fa('0x73'),'id'])||{})[_0xb5fa('0x98')](function(_0x477274){for(var _0x165b0a=0x0;_0x165b0a<_0x48d5b9['body'][_0xb5fa('0x73')]['length'];_0x165b0a+=0x1){socket[_0xb5fa('0xb8')](_0xb5fa('0xb9'),{'UserId':_0x48d5b9['body'][_0xb5fa('0x73')][_0x165b0a],'OpenchannelAccountId':_0x48d5b9[_0xb5fa('0x68')]['id']});}return _0x477274;});}})[_0xb5fa('0x23')](respondWithResult(_0x4051b0,null))[_0xb5fa('0x2d')](handleError(_0x4051b0,null));};exports[_0xb5fa('0xba')]=function(_0x5313ef,_0x45e2a1,_0x5217a1){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x5313ef['params']['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x45e2a1,null))[_0xb5fa('0x23')](function(_0x4d58d3){if(_0x4d58d3){return _0x4d58d3['removeAgents'](_0x5313ef[_0xb5fa('0x45')][_0xb5fa('0x73')])[_0xb5fa('0x23')](function(){if(_[_0xb5fa('0xbb')](_0x5313ef[_0xb5fa('0x45')][_0xb5fa('0x73')])){for(var _0x257d8a=0x0;_0x257d8a<_0x5313ef[_0xb5fa('0x45')][_0xb5fa('0x73')][_0xb5fa('0x4b')];_0x257d8a+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5313ef['query'][_0xb5fa('0x73')][_0x257d8a]),'OpenchannelAccountId':Number(_0x5313ef[_0xb5fa('0x68')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5313ef['query']['ids']),'OpenchannelAccountId':Number(_0x5313ef[_0xb5fa('0x68')]['id'])});}});}})['then'](respondWithStatusCode(_0x45e2a1,null))[_0xb5fa('0x2d')](handleError(_0x45e2a1,null));};exports[_0xb5fa('0xbc')]=function(_0x189e6b,_0x56414f,_0xec1ba4){var _0x775934={};var _0x5c8311={};var _0x31e2a1;var _0xcf6d4d;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x189e6b['params']['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x56414f,null))[_0xb5fa('0x23')](function(_0x207c1e){if(_0x207c1e){_0x31e2a1=_0x207c1e;_0x5c8311['model']=_[_0xb5fa('0x44')](db[_0xb5fa('0xa2')][_0xb5fa('0x42')]);_0x5c8311[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x189e6b['query']);_0x5c8311[_0xb5fa('0x46')]=_['intersection'](_0x5c8311[_0xb5fa('0x48')],_0x5c8311[_0xb5fa('0x45')]);_0x775934[_0xb5fa('0x49')]=_[_0xb5fa('0x47')](_0x5c8311[_0xb5fa('0x48')],qs[_0xb5fa('0x4a')](_0x189e6b[_0xb5fa('0x45')][_0xb5fa('0x4a')]));_0x775934[_0xb5fa('0x49')]=_0x775934['attributes']['length']?_0x775934[_0xb5fa('0x49')]:_0x5c8311[_0xb5fa('0x48')];_0x775934['order']=qs[_0xb5fa('0x4f')](_0x189e6b[_0xb5fa('0x45')]['sort']);_0x775934[_0xb5fa('0x50')]=qs[_0xb5fa('0x46')](_[_0xb5fa('0x51')](_0x189e6b['query'],_0x5c8311[_0xb5fa('0x46')]));if(_0x189e6b[_0xb5fa('0x45')][_0xb5fa('0x52')]){_0x775934[_0xb5fa('0x50')]=_[_0xb5fa('0x53')](_0x775934['where'],{'$or':_[_0xb5fa('0x40')](_0x775934[_0xb5fa('0x49')],function(_0x3e1cc3){var _0x268214={};_0x268214[_0x3e1cc3]={'$like':'%'+_0x189e6b[_0xb5fa('0x45')]['filter']+'%'};return _0x268214;})});}_0x775934=_['merge']({},_0x775934,_0x189e6b[_0xb5fa('0x56')]);return _0x31e2a1[_0xb5fa('0xbc')](_0x775934);}})[_0xb5fa('0x23')](function(_0x34e4a1){if(_0x34e4a1){_0xcf6d4d=_0x34e4a1[_0xb5fa('0x4b')];if(!_0x189e6b['query']['hasOwnProperty']('nolimit')){_0x775934[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x189e6b['query'][_0xb5fa('0x32')]);_0x775934[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x189e6b[_0xb5fa('0x45')][_0xb5fa('0x31')]);}return _0x31e2a1['getAgents'](_0x775934);}})[_0xb5fa('0x23')](function(_0x4fe897){if(_0x4fe897){return _0x4fe897?{'count':_0xcf6d4d,'rows':_0x4fe897}:null;}})[_0xb5fa('0x23')](respondWithResult(_0x56414f,null))[_0xb5fa('0x2d')](handleError(_0x56414f,null));};exports[_0xb5fa('0xbd')]=function(_0x30ebb3,_0x1db92b,_0x70575a){var _0x29717c,_0xdfea60,_0x42a3e9;if(_['isNil'](_0x30ebb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')])||_0x30ebb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')]===''){throw new db['Sequelize'][(_0xb5fa('0x77'))](_0xb5fa('0x80'));}if(_['isNil'](_0x30ebb3['body']['to'])){}_0x29717c=_0x30ebb3[_0xb5fa('0x5e')]['to'];return db[_0xb5fa('0x41')]['findOne']({'where':{'id':_0x30ebb3['params']['id']}})[_0xb5fa('0x23')](handleEntityNotFound(_0x1db92b,null))[_0xb5fa('0x23')](function(_0x274a31){if(_0x274a31){return db[_0xb5fa('0x41')][_0xb5fa('0x5c')]({'where':{'id':_0x274a31['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb5fa('0x87')],'as':'Contacts','where':{[_0x274a31[_0xb5fa('0x83')]]:_0x29717c},'limit':0x1,'order':[['updatedAt',_0xb5fa('0x89')]]}]}]})[_0xb5fa('0x23')](handleEntityNotFound(_0x1db92b,null))['then'](function(_0x4e2ee3){if(_0x4e2ee3&&_0x4e2ee3[_0xb5fa('0x86')]){_0xdfea60=_0x4e2ee3['get']({'plain':!![]});if(_0xdfea60[_0xb5fa('0x86')]&&_0xdfea60[_0xb5fa('0x86')]['Contacts'][_0xb5fa('0x4b')]){return _0xdfea60[_0xb5fa('0x86')][_0xb5fa('0x88')][0x0];}return db['CmContact'][_0xb5fa('0x5d')](_[_0xb5fa('0x1a')](_0x30ebb3['body'],{'firstName':_0x29717c,[_0x4e2ee3[_0xb5fa('0x83')]]:_0x29717c,'phone':_0x29717c,'ListId':_0xdfea60[_0xb5fa('0x7d')]}));}})[_0xb5fa('0x23')](handleEntityNotFound(_0x1db92b,null))[_0xb5fa('0x23')](function(_0x1fd50){if(_0x1fd50){_0x42a3e9=_0x1fd50;return db[_0xb5fa('0x96')][_0xb5fa('0x5c')]({'where':{'ContactId':_0x42a3e9['id'],'closed':![],'OpenchannelAccountId':_0xdfea60['id']}})[_0xb5fa('0x23')](function(_0xf2f3d0){if(_0xf2f3d0){return[_0xf2f3d0,![]];}return db[_0xb5fa('0x96')][_0xb5fa('0x5d')]({'UserId':_0x30ebb3[_0xb5fa('0x5f')]['id'],'ContactId':_0x42a3e9['id'],'OpenchannelAccountId':_0xdfea60['id'],'lastMsgDirection':_0xb5fa('0xbe'),'Messages':[_[_0xb5fa('0x53')](_0x30ebb3[_0xb5fa('0x5e')],{'read':![],'body':_0x30ebb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')],'OpenchannelAccountId':_0xdfea60['id'],'UserId':_0x30ebb3[_0xb5fa('0x5f')]['id'],'ContactId':_0x42a3e9['id']})]},{'include':[{'model':db[_0xb5fa('0x9f')],'as':_0xb5fa('0xbf')}]})[_0xb5fa('0x23')](function(_0x2bc5c5){return[_0x2bc5c5,!![]];});});}})[_0xb5fa('0x98')](function(_0x39621f,_0x58907b){if(_0x58907b){return _0x39621f;}return db[_0xb5fa('0x9f')][_0xb5fa('0x5d')](_[_0xb5fa('0x53')](_0x30ebb3[_0xb5fa('0x5e')],{'read':![],'body':_0x30ebb3[_0xb5fa('0x5e')][_0xb5fa('0x5e')],'OpenchannelAccountId':_0xdfea60['id'],'OpenchannelInteractionId':_0x39621f['id'],'UserId':_0x30ebb3['user']['id'],'ContactId':_0x42a3e9['id']}))[_0xb5fa('0x23')](function(_0x40a0d7){_0x39621f[_0xb5fa('0xc0')][_0xb5fa('0xbf')]=[];_0x39621f[_0xb5fa('0xc0')][_0xb5fa('0xbf')][_0xb5fa('0x9c')](_0x40a0d7[_0xb5fa('0xc0')]);return _0x39621f;});});}})[_0xb5fa('0x23')](respondWithResult(_0x1db92b,null))[_0xb5fa('0x2d')](handleError(_0x1db92b,null));}; \ No newline at end of file +var _0xeec6=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','priority','asc','from','ListId','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','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','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length'];(function(_0x160cc9,_0xe6e4c9){var _0x5370f1=function(_0x4f9ccd){while(--_0x4f9ccd){_0x160cc9['push'](_0x160cc9['shift']());}};_0x5370f1(++_0xe6e4c9);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0xeec6[_0x3c5e54];return _0x3ae1f3;};'use strict';var pdf=require(_0x6eec('0x0'));var emlformat=require(_0x6eec('0x1'));var rimraf=require(_0x6eec('0x2'));var zipdir=require(_0x6eec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6eec('0x4'));var moment=require(_0x6eec('0x5'));var BPromise=require(_0x6eec('0x6'));var Mustache=require(_0x6eec('0x7'));var util=require(_0x6eec('0x8'));var path=require(_0x6eec('0x9'));var sox=require('sox');var csv=require(_0x6eec('0xa'));var ejs=require(_0x6eec('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];config[_0x6eec('0x17')]=_[_0x6eec('0x18')](config[_0x6eec('0x17')],{'host':_0x6eec('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6eec('0x17')]));require(_0x6eec('0x1a'))[_0x6eec('0x1b')](socket);var jayson=require(_0x6eec('0x1c'));var client=jayson[_0x6eec('0x1d')][_0x6eec('0x1e')]({'port':0x232c});var client9002=jayson[_0x6eec('0x1d')][_0x6eec('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x34a7fc,_0x2ac797,_0x5e2a9b,_0x3c0c1b){return new BPromise(function(_0x5f1f33,_0x38c9a4){var _0x45aa3f=_0x3c0c1b||client;return _0x45aa3f['request'](_0x34a7fc,_0x5e2a9b)[_0x6eec('0x1f')](function(_0x80736b){logger[_0x6eec('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x2ac797,_0x6eec('0x21'));logger[_0x6eec('0x22')](_0x6eec('0x23'),_0x2ac797,_0x6eec('0x21'),JSON[_0x6eec('0x24')](_0x80736b));if(_0x80736b[_0x6eec('0x25')]){if(_0x80736b['error'][_0x6eec('0x26')]===0x1f4){logger[_0x6eec('0x25')](_0x6eec('0x27'),_0x2ac797,_0x80736b[_0x6eec('0x25')][_0x6eec('0x28')]);return _0x38c9a4(_0x80736b[_0x6eec('0x25')]['message']);}logger[_0x6eec('0x25')](_0x6eec('0x27'),_0x2ac797,_0x80736b[_0x6eec('0x25')][_0x6eec('0x28')]);return _0x5f1f33(_0x80736b[_0x6eec('0x25')][_0x6eec('0x28')]);}else{logger['info'](_0x6eec('0x27'),_0x2ac797,_0x6eec('0x21'));_0x5f1f33(_0x80736b[_0x6eec('0x29')][_0x6eec('0x28')]);}})[_0x6eec('0x2a')](function(_0x1f386c){logger[_0x6eec('0x25')](_0x6eec('0x27'),_0x2ac797,_0x1f386c);_0x38c9a4(_0x1f386c);});});}function respondWithStatusCode(_0x316317,_0x58f95c){_0x58f95c=_0x58f95c||0xcc;return function(_0x1d750c){if(_0x1d750c){return _0x316317[_0x6eec('0x2b')](_0x58f95c);}return _0x316317[_0x6eec('0x2c')](_0x58f95c)[_0x6eec('0x2d')]();};}function respondWithResult(_0x4f507e,_0x23432d){_0x23432d=_0x23432d||0xc8;return function(_0x3b9b9f){if(_0x3b9b9f){return _0x4f507e['status'](_0x23432d)['json'](_0x3b9b9f);}};}function respondWithFilteredResult(_0x3240c3,_0x47ed95){return function(_0x20a130){if(_0x20a130){var _0xede270=_0x20a130[_0x6eec('0x2e')],_0x3bbdf8=_0x47ed95[_0x6eec('0x2f')],_0x34bdea=_0x47ed95[_0x6eec('0x2f')]+_0x47ed95[_0x6eec('0x30')],_0x15e936;if(_0x34bdea>=_0xede270){_0x34bdea=_0xede270;_0x15e936=0xc8;}else{_0x15e936=0xce;}_0x3240c3[_0x6eec('0x2c')](_0x15e936);return _0x3240c3['set'](_0x6eec('0x31'),_0x3bbdf8+'-'+_0x34bdea+'/'+_0xede270)['json'](_0x20a130);}return null;};}function patchUpdates(_0x26f838){return function(_0x125bfc){try{jsonpatch[_0x6eec('0x32')](_0x125bfc,_0x26f838,!![]);}catch(_0x487de8){return BPromise['reject'](_0x487de8);}return _0x125bfc['save']();};}function saveUpdates(_0x183ce3,_0x26b0da){return function(_0x20f850){if(_0x20f850){return _0x20f850[_0x6eec('0x33')](_0x183ce3)[_0x6eec('0x1f')](function(_0x23547d){return _0x23547d;});}return null;};}function removeEntity(_0x22e0cb,_0x167c8d){return function(_0x2bc106){if(_0x2bc106){return _0x2bc106[_0x6eec('0x34')]()[_0x6eec('0x1f')](function(){var _0x4382df=_0x2bc106['get']({'plain':!![]});var _0xd77dd3=_0x6eec('0x35');return db[_0x6eec('0x36')]['destroy']({'where':{'type':_0xd77dd3,'resourceId':_0x4382df['id']}})[_0x6eec('0x1f')](function(){return _0x2bc106;});})[_0x6eec('0x1f')](function(){_0x22e0cb[_0x6eec('0x2c')](0xcc)[_0x6eec('0x2d')]();});}};}function handleEntityNotFound(_0x34d6ba,_0x34d3b1){return function(_0x4a7699){if(!_0x4a7699){_0x34d6ba[_0x6eec('0x2b')](0x194);}return _0x4a7699;};}function handleError(_0x1f10ff,_0x2f18e9){_0x2f18e9=_0x2f18e9||0x1f4;return function(_0x5128ac){logger['error'](_0x5128ac[_0x6eec('0x37')]);if(_0x5128ac[_0x6eec('0x38')]){delete _0x5128ac[_0x6eec('0x38')];}_0x1f10ff[_0x6eec('0x2c')](_0x2f18e9)[_0x6eec('0x39')](_0x5128ac);};}exports['index']=function(_0x223dfa,_0x2c3b14){var _0x44118c={'include':[{'model':db[_0x6eec('0x3a')],'as':_0x6eec('0x3b')}]},_0x2bf388={},_0x15918c={'count':0x0,'rows':[]};var _0x1deed2=_['map'](db[_0x6eec('0x3c')][_0x6eec('0x3d')],function(_0x4d30c9){return{'name':_0x4d30c9['fieldName'],'type':_0x4d30c9[_0x6eec('0x3e')][_0x6eec('0x3f')]};});_0x2bf388[_0x6eec('0x40')]=_[_0x6eec('0x41')](_0x1deed2,'name');_0x2bf388['query']=_[_0x6eec('0x42')](_0x223dfa['query']);_0x2bf388['filters']=_[_0x6eec('0x43')](_0x2bf388[_0x6eec('0x40')],_0x2bf388[_0x6eec('0x44')]);_0x44118c[_0x6eec('0x45')]=_[_0x6eec('0x43')](_0x2bf388['model'],qs[_0x6eec('0x46')](_0x223dfa[_0x6eec('0x44')]['fields']));_0x44118c[_0x6eec('0x45')]=_0x44118c[_0x6eec('0x45')]['length']?_0x44118c[_0x6eec('0x45')]:_0x2bf388[_0x6eec('0x40')];if(!_0x223dfa['query'][_0x6eec('0x47')](_0x6eec('0x48'))){_0x44118c[_0x6eec('0x30')]=qs[_0x6eec('0x30')](_0x223dfa['query'][_0x6eec('0x30')]);_0x44118c[_0x6eec('0x2f')]=qs[_0x6eec('0x2f')](_0x223dfa[_0x6eec('0x44')][_0x6eec('0x2f')]);}_0x44118c['order']=qs['sort'](_0x223dfa[_0x6eec('0x44')][_0x6eec('0x49')]);_0x44118c[_0x6eec('0x4a')]=qs[_0x6eec('0x4b')](_[_0x6eec('0x4c')](_0x223dfa['query'],_0x2bf388[_0x6eec('0x4b')]),_0x1deed2);if(_0x223dfa['query'][_0x6eec('0x4d')]){_0x44118c[_0x6eec('0x4a')]=_[_0x6eec('0x4e')](_0x44118c['where'],{'$or':_[_0x6eec('0x41')](_0x1deed2,function(_0x35a4a5){if(_0x35a4a5[_0x6eec('0x3e')]!==_0x6eec('0x4f')){var _0x2417e6={};_0x2417e6[_0x35a4a5['name']]={'$like':'%'+_0x223dfa[_0x6eec('0x44')]['filter']+'%'};return _0x2417e6;}})});}_0x44118c=_['merge']({},_0x44118c,_0x223dfa[_0x6eec('0x50')]);var _0x535d96={'where':_0x44118c[_0x6eec('0x4a')]};return db[_0x6eec('0x3c')][_0x6eec('0x2e')](_0x535d96)['then'](function(_0x4b4223){_0x15918c[_0x6eec('0x2e')]=_0x4b4223;if(_0x223dfa[_0x6eec('0x44')][_0x6eec('0x51')]){_0x44118c[_0x6eec('0x52')]=[{'all':!![]}];}return db[_0x6eec('0x3c')][_0x6eec('0x53')](_0x44118c);})[_0x6eec('0x1f')](function(_0x442bca){_0x15918c[_0x6eec('0x54')]=_0x442bca;return _0x15918c;})[_0x6eec('0x1f')](respondWithFilteredResult(_0x2c3b14,_0x44118c))['catch'](handleError(_0x2c3b14,null));};exports['show']=function(_0x1a8cf6,_0x2270ce){var _0x38e836={'raw':![],'where':{'id':_0x1a8cf6[_0x6eec('0x55')]['id']},'include':[{'model':db[_0x6eec('0x3a')],'as':_0x6eec('0x3b')}]},_0x577fb6={};_0x577fb6[_0x6eec('0x40')]=_[_0x6eec('0x42')](db[_0x6eec('0x3c')][_0x6eec('0x3d')]);_0x577fb6[_0x6eec('0x44')]=_['keys'](_0x1a8cf6[_0x6eec('0x44')]);_0x577fb6[_0x6eec('0x4b')]=_[_0x6eec('0x43')](_0x577fb6[_0x6eec('0x40')],_0x577fb6['query']);_0x38e836['attributes']=_['intersection'](_0x577fb6[_0x6eec('0x40')],qs[_0x6eec('0x46')](_0x1a8cf6[_0x6eec('0x44')][_0x6eec('0x46')]));_0x38e836['attributes']=_0x38e836['attributes'][_0x6eec('0x56')]?_0x38e836[_0x6eec('0x45')]:_0x577fb6[_0x6eec('0x40')];if(_0x1a8cf6['query'][_0x6eec('0x51')]){_0x38e836[_0x6eec('0x52')]=[{'all':!![]}];}_0x38e836=_[_0x6eec('0x4e')]({},_0x38e836,_0x1a8cf6[_0x6eec('0x50')]);return db[_0x6eec('0x3c')][_0x6eec('0x57')](_0x38e836)[_0x6eec('0x1f')](handleEntityNotFound(_0x2270ce,null))[_0x6eec('0x1f')](respondWithResult(_0x2270ce,null))[_0x6eec('0x2a')](handleError(_0x2270ce,null));};exports['create']=function(_0x22cf6c,_0x5e51c9){return db[_0x6eec('0x3c')][_0x6eec('0x58')](_0x22cf6c[_0x6eec('0x59')],{})[_0x6eec('0x1f')](function(_0x248d76){var _0x360176=_0x22cf6c[_0x6eec('0x5a')]['get']({'plain':!![]});if(!_0x360176)throw new Error(_0x6eec('0x5b'));if(_0x360176['role']===_0x6eec('0x5a')){var _0x5c905f=_0x248d76[_0x6eec('0x5c')]({'plain':!![]});var _0xd7e19b=_0x6eec('0x35');return db[_0x6eec('0x5d')][_0x6eec('0x57')]({'where':{'name':_0xd7e19b,'userProfileId':_0x360176[_0x6eec('0x5e')]},'raw':!![]})[_0x6eec('0x1f')](function(_0x2982a8){if(_0x2982a8&&_0x2982a8[_0x6eec('0x5f')]===0x0){return db[_0x6eec('0x36')]['create']({'name':_0x5c905f['name'],'resourceId':_0x5c905f['id'],'type':_0x2982a8[_0x6eec('0x38')],'sectionId':_0x2982a8['id']},{})[_0x6eec('0x1f')](function(){return _0x248d76;});}else{return _0x248d76;}})[_0x6eec('0x2a')](function(_0x2c0644){logger[_0x6eec('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c0644);throw _0x2c0644;});}return _0x248d76;})[_0x6eec('0x1f')](respondWithResult(_0x5e51c9,0xc9))[_0x6eec('0x2a')](handleError(_0x5e51c9,null));};exports['update']=function(_0x5dc4d1,_0x5dc8b3){if(_0x5dc4d1[_0x6eec('0x59')]['id']){delete _0x5dc4d1[_0x6eec('0x59')]['id'];}return db['OpenchannelAccount'][_0x6eec('0x57')]({'where':{'id':_0x5dc4d1[_0x6eec('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x6eec('0x3b')}]})[_0x6eec('0x1f')](handleEntityNotFound(_0x5dc8b3,null))[_0x6eec('0x1f')](saveUpdates(_0x5dc4d1[_0x6eec('0x59')],null))['then'](respondWithResult(_0x5dc8b3,null))['catch'](handleError(_0x5dc8b3,null));};exports[_0x6eec('0x34')]=function(_0x1230fc,_0x460488){return db[_0x6eec('0x3c')][_0x6eec('0x57')]({'where':{'id':_0x1230fc[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x460488,null))[_0x6eec('0x1f')](removeEntity(_0x460488,null))[_0x6eec('0x2a')](handleError(_0x460488,null));};exports[_0x6eec('0x60')]=function(_0x42f435,_0x9819f6){return db[_0x6eec('0x3c')][_0x6eec('0x60')]()[_0x6eec('0x1f')](respondWithResult(_0x9819f6,null))[_0x6eec('0x2a')](handleError(_0x9819f6,null));};exports[_0x6eec('0x61')]=function(_0x4dac02,_0x2ef374,_0x2236f7){if(_0x4dac02['body']['id']){delete _0x4dac02[_0x6eec('0x59')]['id'];}return db[_0x6eec('0x3c')]['find']({'where':{'id':_0x4dac02[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x2ef374,null))[_0x6eec('0x1f')](function(_0x394aaf){if(_0x394aaf){_0x4dac02['body'][_0x6eec('0x62')]=_0x394aaf['id'];return db[_0x6eec('0x63')][_0x6eec('0x58')](_0x4dac02[_0x6eec('0x59')]);}})[_0x6eec('0x1f')](respondWithResult(_0x2ef374,null))[_0x6eec('0x2a')](handleError(_0x2ef374,null));};exports['getDispositions']=function(_0x1ed47e,_0x4abeae,_0x471d55){var _0x19927d={'raw':![],'where':{}};var _0x261021={};var _0x12f429={'count':0x0,'rows':[]};return db[_0x6eec('0x3c')][_0x6eec('0x64')]({'where':{'id':_0x1ed47e[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x4abeae,null))[_0x6eec('0x1f')](function(_0x5a7aa4){if(_0x5a7aa4){_0x261021[_0x6eec('0x40')]=_[_0x6eec('0x42')](db[_0x6eec('0x63')]['rawAttributes']);_0x261021[_0x6eec('0x44')]=_[_0x6eec('0x42')](_0x1ed47e['query']);_0x261021[_0x6eec('0x4b')]=_[_0x6eec('0x43')](_0x261021[_0x6eec('0x40')],_0x261021[_0x6eec('0x44')]);_0x19927d[_0x6eec('0x45')]=_['intersection'](_0x261021[_0x6eec('0x40')],qs[_0x6eec('0x46')](_0x1ed47e[_0x6eec('0x44')][_0x6eec('0x46')]));_0x19927d[_0x6eec('0x45')]=_0x19927d['attributes'][_0x6eec('0x56')]?_0x19927d[_0x6eec('0x45')]:_0x261021[_0x6eec('0x40')];if(!_0x1ed47e[_0x6eec('0x44')][_0x6eec('0x47')](_0x6eec('0x48'))){_0x19927d[_0x6eec('0x30')]=qs[_0x6eec('0x30')](_0x1ed47e['query'][_0x6eec('0x30')]);_0x19927d['offset']=qs[_0x6eec('0x2f')](_0x1ed47e[_0x6eec('0x44')][_0x6eec('0x2f')]);}_0x19927d[_0x6eec('0x65')]=qs['sort'](_0x1ed47e[_0x6eec('0x44')]['sort']);_0x19927d[_0x6eec('0x4a')]=qs[_0x6eec('0x4b')](_[_0x6eec('0x4c')](_0x1ed47e[_0x6eec('0x44')],_0x261021['filters']));_0x19927d['where']['OpenchannelAccountId']=_0x5a7aa4['id'];if(_0x1ed47e[_0x6eec('0x44')][_0x6eec('0x4d')]){_0x19927d[_0x6eec('0x4a')]=_[_0x6eec('0x4e')](_0x19927d['where'],{'$or':_[_0x6eec('0x41')](_0x19927d['attributes'],function(_0x297109){var _0x152250={};_0x152250[_0x297109]={'$like':'%'+_0x1ed47e['query'][_0x6eec('0x4d')]+'%'};return _0x152250;})});}_0x19927d=_[_0x6eec('0x4e')]({},_0x19927d,_0x1ed47e[_0x6eec('0x50')]);return db[_0x6eec('0x63')][_0x6eec('0x2e')]({'where':_0x19927d[_0x6eec('0x4a')]})['then'](function(_0x1d2aaa){_0x12f429['count']=_0x1d2aaa;if(_0x1ed47e[_0x6eec('0x44')][_0x6eec('0x51')]){_0x19927d['include']=[{'all':!![]}];}return db[_0x6eec('0x63')]['findAll'](_0x19927d);})[_0x6eec('0x1f')](function(_0x1d1683){_0x12f429[_0x6eec('0x54')]=_0x1d1683;return _0x12f429;});}})[_0x6eec('0x1f')](respondWithFilteredResult(_0x4abeae,_0x19927d))['catch'](handleError(_0x4abeae,null));};exports[_0x6eec('0x66')]=function(_0x566ccf,_0x3f04a0,_0x2c0a85){return db['OpenchannelAccount'][_0x6eec('0x57')]({'where':{'id':_0x566ccf[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x3f04a0,null))[_0x6eec('0x1f')](function(_0x15c9a3){if(_0x15c9a3){return _0x15c9a3['removeDispositions'](_0x566ccf[_0x6eec('0x44')][_0x6eec('0x67')]);}})[_0x6eec('0x1f')](respondWithStatusCode(_0x3f04a0,null))[_0x6eec('0x2a')](handleError(_0x3f04a0,null));};exports[_0x6eec('0x68')]=function(_0x471e01,_0x485d04,_0x4a3af3){if(_0x471e01[_0x6eec('0x59')]['id']){delete _0x471e01[_0x6eec('0x59')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x471e01[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x485d04,null))['then'](function(_0x2c7853){if(_0x2c7853){_0x471e01[_0x6eec('0x59')][_0x6eec('0x62')]=_0x2c7853['id'];return db['CannedAnswer'][_0x6eec('0x58')](_0x471e01['body']);}})[_0x6eec('0x1f')](respondWithResult(_0x485d04,null))[_0x6eec('0x2a')](handleError(_0x485d04,null));};exports['getAnswers']=function(_0x3a6c48,_0x395bda,_0x4215f0){var _0x4a7a37={'raw':![],'where':{}};var _0xf4f91={};var _0xc4e3bc={'count':0x0,'rows':[]};return db[_0x6eec('0x3c')][_0x6eec('0x64')]({'where':{'id':_0x3a6c48[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x395bda,null))['then'](function(_0x4be9a7){if(_0x4be9a7){_0xf4f91[_0x6eec('0x40')]=_[_0x6eec('0x42')](db[_0x6eec('0x69')][_0x6eec('0x3d')]);_0xf4f91[_0x6eec('0x44')]=_[_0x6eec('0x42')](_0x3a6c48[_0x6eec('0x44')]);_0xf4f91[_0x6eec('0x4b')]=_[_0x6eec('0x43')](_0xf4f91[_0x6eec('0x40')],_0xf4f91[_0x6eec('0x44')]);_0x4a7a37['attributes']=_[_0x6eec('0x43')](_0xf4f91[_0x6eec('0x40')],qs[_0x6eec('0x46')](_0x3a6c48[_0x6eec('0x44')][_0x6eec('0x46')]));_0x4a7a37[_0x6eec('0x45')]=_0x4a7a37[_0x6eec('0x45')][_0x6eec('0x56')]?_0x4a7a37[_0x6eec('0x45')]:_0xf4f91[_0x6eec('0x40')];if(!_0x3a6c48[_0x6eec('0x44')][_0x6eec('0x47')](_0x6eec('0x48'))){_0x4a7a37[_0x6eec('0x30')]=qs[_0x6eec('0x30')](_0x3a6c48['query'][_0x6eec('0x30')]);_0x4a7a37['offset']=qs[_0x6eec('0x2f')](_0x3a6c48[_0x6eec('0x44')][_0x6eec('0x2f')]);}_0x4a7a37[_0x6eec('0x65')]=qs['sort'](_0x3a6c48[_0x6eec('0x44')]['sort']);_0x4a7a37[_0x6eec('0x4a')]=qs[_0x6eec('0x4b')](_[_0x6eec('0x4c')](_0x3a6c48[_0x6eec('0x44')],_0xf4f91[_0x6eec('0x4b')]));_0x4a7a37[_0x6eec('0x4a')]['OpenchannelAccountId']=_0x4be9a7['id'];if(_0x3a6c48[_0x6eec('0x44')][_0x6eec('0x4d')]){_0x4a7a37[_0x6eec('0x4a')]=_[_0x6eec('0x4e')](_0x4a7a37['where'],{'$or':_['map'](_0x4a7a37[_0x6eec('0x45')],function(_0x2eb5ed){var _0x52771a={};_0x52771a[_0x2eb5ed]={'$like':'%'+_0x3a6c48['query'][_0x6eec('0x4d')]+'%'};return _0x52771a;})});}_0x4a7a37=_[_0x6eec('0x4e')]({},_0x4a7a37,_0x3a6c48['options']);return db[_0x6eec('0x69')][_0x6eec('0x2e')]({'where':_0x4a7a37['where']})[_0x6eec('0x1f')](function(_0x3cc039){_0xc4e3bc[_0x6eec('0x2e')]=_0x3cc039;if(_0x3a6c48['query']['includeAll']){_0x4a7a37['include']=[{'all':!![]}];}return db[_0x6eec('0x69')]['findAll'](_0x4a7a37);})['then'](function(_0x41d777){_0xc4e3bc['rows']=_0x41d777;return _0xc4e3bc;});}})[_0x6eec('0x1f')](respondWithFilteredResult(_0x395bda,_0x4a7a37))[_0x6eec('0x2a')](handleError(_0x395bda,null));};exports[_0x6eec('0x6a')]=function(_0x5e0f6a,_0x31248a,_0xae96c9){return db['OpenchannelAccount']['find']({'where':{'id':_0x5e0f6a['params']['id']}})['then'](handleEntityNotFound(_0x31248a,null))['then'](function(_0x188346){if(_0x188346){return _0x188346[_0x6eec('0x6a')](_0x5e0f6a[_0x6eec('0x44')][_0x6eec('0x67')]);}})['then'](respondWithStatusCode(_0x31248a,null))['catch'](handleError(_0x31248a,null));};exports[_0x6eec('0x6b')]=function(_0x5bad60,_0x12c845,_0x5dcd38){var _0x1eb3c6={'body':_0x5bad60[_0x6eec('0x59')],'channel':'openchannel'};var _0x5b47d2=[];var _0x1fada6=[];var _0xd4919e={};var _0x4e3e03=![];return db[_0x6eec('0x6c')][_0x6eec('0x60')]()[_0x6eec('0x1f')](function(_0x1403b4){if(!_0x1403b4){throw new db[(_0x6eec('0x6d'))][(_0x6eec('0x6e'))]('no\x20available\x20attributes');}_0x5b47d2=_[_0x6eec('0x6f')](_[_0x6eec('0x42')](_0x1403b4),[_0x6eec('0x70'),_0x6eec('0x71')]);_0x1fada6=_['difference'](_[_0x6eec('0x42')](_0x1403b4),[_0x6eec('0x70'),_0x6eec('0x71'),_0x6eec('0x72'),'ListId']);if(_0x5bad60[_0x6eec('0x59')]['id']){delete _0x5bad60[_0x6eec('0x59')]['id'];}if(_[_0x6eec('0x73')](_0x5bad60[_0x6eec('0x59')]['from'])){throw new db['Sequelize'][(_0x6eec('0x6e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5bad60['body'][_0x6eec('0x59')])||_0x5bad60['body'][_0x6eec('0x59')]===''){throw new db[(_0x6eec('0x6d'))][(_0x6eec('0x6e'))](_0x6eec('0x74'));}if(_[_0x6eec('0x73')](_0x5bad60[_0x6eec('0x59')][_0x6eec('0x75')])){throw new db[(_0x6eec('0x6d'))]['ValidationError'](_0x6eec('0x76')+_0x1fada6);}if(!_[_0x6eec('0x77')](_0x1fada6,_0x5bad60[_0x6eec('0x59')][_0x6eec('0x75')])){throw new db[(_0x6eec('0x6d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1fada6);}_0xd4919e[_0x5bad60['body'][_0x6eec('0x75')]]=_0x5bad60[_0x6eec('0x59')]['from'];})[_0x6eec('0x1f')](function(){return db['OpenchannelAccount'][_0x6eec('0x57')]({'where':{'id':_0x5bad60['params']['id']},'include':[{'model':db[_0x6eec('0x78')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6eec('0x79'),'where':_0xd4919e,'limit':0x1,'order':[[_0x6eec('0x71'),_0x6eec('0x7a')]]}]},{'model':db[_0x6eec('0x7b')],'as':_0x6eec('0x7c')}]});})[_0x6eec('0x1f')](handleEntityNotFound(_0x12c845,null))['then'](function(_0x4dfef5){if(_0x4dfef5&&_0x4dfef5[_0x6eec('0x7d')]){_0x1eb3c6[_0x6eec('0x7e')]=_0x4dfef5;_0x1eb3c6['applications']=_0x4dfef5[_0x6eec('0x7c')];_0x1eb3c6['list']=_0x4dfef5[_0x6eec('0x7d')];_0x1eb3c6[_0x6eec('0x7f')]=_[_0x6eec('0x80')](_0x1eb3c6['applications'],[_0x6eec('0x81')],[_0x6eec('0x82')]);if(_0x1eb3c6[_0x6eec('0x7e')]['Applications']){delete _0x1eb3c6[_0x6eec('0x7e')][_0x6eec('0x7c')];}if(_0x1eb3c6['account'][_0x6eec('0x7d')]&&_0x1eb3c6['account'][_0x6eec('0x7d')]['Contacts'][_0x6eec('0x56')]){return _0x1eb3c6[_0x6eec('0x7e')][_0x6eec('0x7d')][_0x6eec('0x79')][0x0];}var _0x1416cf=_[_0x6eec('0x18')](_0x5bad60[_0x6eec('0x59')],{'firstName':_0x5bad60[_0x6eec('0x59')][_0x6eec('0x83')],'ListId':_0x4dfef5[_0x6eec('0x84')]});_0x1416cf[_0x5bad60[_0x6eec('0x59')][_0x6eec('0x75')]]=_0x5bad60[_0x6eec('0x59')][_0x6eec('0x83')];return db[_0x6eec('0x6c')][_0x6eec('0x58')](_0x1416cf,{'fields':_0x5b47d2,'raw':!![]});}})[_0x6eec('0x1f')](handleEntityNotFound(_0x12c845,null))[_0x6eec('0x1f')](function(_0x29343e){_0x1eb3c6['contact']=_0x29343e;if(_0x29343e){var _0x451a1f={'ContactId':_0x29343e['id'],'OpenchannelAccountId':_0x5bad60[_0x6eec('0x55')]['id'],'from':(_0x29343e[_0x6eec('0x85')]||'')+'\x20'+(_0x29343e['lastName']||'')};var _0x111115={'OpenchannelAccountId':_0x5bad60[_0x6eec('0x55')]['id'],'closed':![]};if(_0x5bad60[_0x6eec('0x59')]['threadId']){_0x111115[_0x6eec('0x86')]=_0x5bad60[_0x6eec('0x59')][_0x6eec('0x86')];return db['OpenchannelInteraction'][_0x6eec('0x57')]({'where':_0x111115})[_0x6eec('0x1f')](function(_0x60d39f){if(_0x60d39f){return[_0x60d39f,![]];}_0x451a1f[_0x6eec('0x86')]=_0x5bad60[_0x6eec('0x59')][_0x6eec('0x86')];_0x451a1f['externalUrl']=_0x5bad60[_0x6eec('0x59')][_0x6eec('0x87')];return db[_0x6eec('0x88')][_0x6eec('0x58')](_0x451a1f)[_0x6eec('0x1f')](function(_0xa19adc){return[_0xa19adc,!![]];});});}else{_0x111115['threadId']=null;}_0x111115[_0x6eec('0x89')]=_0x29343e['id'];return db[_0x6eec('0x88')][_0x6eec('0x57')]({'where':_0x111115})[_0x6eec('0x1f')](function(_0x414320){if(_0x414320){return[_0x414320,![]];}return db['OpenchannelInteraction'][_0x6eec('0x58')](_0x451a1f)[_0x6eec('0x1f')](function(_0x416241){return[_0x416241,!![]];});});}})[_0x6eec('0x8a')](function(_0x8d62d4,_0x551826){if(_0x8d62d4){_0x4e3e03=_0x551826;if(!_0x551826){var _0x2b4e61={'from':(_0x1eb3c6[_0x6eec('0x8b')][_0x6eec('0x85')]||'')+'\x20'+(_0x1eb3c6['contact']['lastName']||'')};if(_0x5bad60[_0x6eec('0x59')][_0x6eec('0x86')]&&_0x5bad60[_0x6eec('0x59')]['messageId']&&_0x5bad60['body']['threadId']!=_0x5bad60[_0x6eec('0x59')][_0x6eec('0x8c')]){_0x2b4e61['threadId']=_0x5bad60['body'][_0x6eec('0x8c')];}return _0x8d62d4['update'](_0x2b4e61);}else{return _0x8d62d4;}}})[_0x6eec('0x1f')](function(_0x447d4d){_0x1eb3c6['interaction']=_0x447d4d[_0x6eec('0x5c')]({'plain':!![]});_0x1eb3c6[_0x6eec('0x8d')][_0x6eec('0x8e')]=_0x4e3e03;if(_0x1eb3c6[_0x6eec('0x8d')][_0x6eec('0x8e')]){if(_0x1eb3c6['account'][_0x6eec('0x8f')]){_0x1eb3c6[_0x6eec('0x7f')]['push']({'id':0x0,'priority':_0x1eb3c6['applications']['length']+0x1,'app':_0x6eec('0x90'),'appdata':_0x6eec('0x91'),'interval':_0x6eec('0x92')});}}return db[_0x6eec('0x93')][_0x6eec('0x58')]({'body':_0x5bad60[_0x6eec('0x59')][_0x6eec('0x59')],'OpenchannelAccountId':_0x5bad60[_0x6eec('0x55')]['id'],'OpenchannelInteractionId':_0x447d4d['id'],'direction':'in','ContactId':_0x1eb3c6[_0x6eec('0x8b')]['id'],'AttachmentId':_0x5bad60['body'][_0x6eec('0x94')]});})['then'](function(_0x21f5be){_0x1eb3c6[_0x6eec('0x28')]=_0x21f5be;if(_0x1eb3c6[_0x6eec('0x8d')][_0x6eec('0x95')]){return db[_0x6eec('0x96')][_0x6eec('0x57')]({'attributes':['id',_0x6eec('0x38')],'where':{'id':_0x1eb3c6[_0x6eec('0x8d')][_0x6eec('0x95')]}})['then'](function(_0xee3d4e){if(_0xee3d4e){_0x1eb3c6['applications'][_0x6eec('0x97')]({'id':0x0,'priority':0x0,'app':_0x6eec('0x98'),'appdata':_0xee3d4e[_0x6eec('0x38')]+','+(_0x1eb3c6[_0x6eec('0x7e')][_0x6eec('0x99')]||0xa),'interval':'*,*,*,*'});_0x1eb3c6[_0x6eec('0x9a')]=![];}return respondWithRpcPromise(_0x6eec('0x9b'),'startRouting',_0x1eb3c6);});}return respondWithRpcPromise(_0x6eec('0x9b'),_0x6eec('0x9c'),_0x1eb3c6);})['then'](function(_0x24bc75){respondWithRpcPromise(_0x6eec('0x9d'),_0x6eec('0x9d'),{'event':_0x6eec('0x6b'),'message':_0x24bc75},client9002);return _0x24bc75;})['then'](respondWithResult(_0x12c845,null))[_0x6eec('0x2a')](handleError(_0x12c845,null));};exports[_0x6eec('0x9e')]=function(_0x5ec371,_0x1ccd02,_0x9c1520){return db[_0x6eec('0x3c')][_0x6eec('0x64')]({'where':{'id':_0x5ec371[_0x6eec('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ccd02,null))[_0x6eec('0x1f')](function(_0x5d3f6b){if(_0x5d3f6b){return db['sequelize'][_0x6eec('0x9f')](function(_0x17a4e4){return db[_0x6eec('0x7b')][_0x6eec('0x34')]({'where':{'OpenchannelAccountId':_0x5ec371[_0x6eec('0x55')]['id']},'transaction':_0x17a4e4})[_0x6eec('0x1f')](function(_0x84c86a){var _0x3d55b2=_[_0x6eec('0x41')](_0x5ec371['body'],function(_0x31cc05){_0x31cc05[_0x6eec('0x62')]=_0x5ec371[_0x6eec('0x55')]['id'];return _0x31cc05;});return db[_0x6eec('0x7b')][_0x6eec('0xa0')](_0x3d55b2,{'transaction':_0x17a4e4});});})['then'](function(){return db[_0x6eec('0x7b')][_0x6eec('0xa1')]({'where':{'OpenchannelAccountId':_0x5ec371[_0x6eec('0x55')]['id']},'order':'priority'});});}})[_0x6eec('0x1f')](respondWithResult(_0x1ccd02,null))[_0x6eec('0x2a')](handleError(_0x1ccd02,null));};exports[_0x6eec('0xa2')]=function(_0x57c596,_0x152680,_0x17868f){var _0x45a029={};var _0x5c37fe={};var _0x2d6411;var _0x19335e;return db['OpenchannelAccount'][_0x6eec('0x64')]({'where':{'id':_0x57c596[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x152680,null))['then'](function(_0x4591f1){if(_0x4591f1){_0x2d6411=_0x4591f1;_0x5c37fe[_0x6eec('0x40')]=_[_0x6eec('0x42')](db[_0x6eec('0x7b')][_0x6eec('0x3d')]);_0x5c37fe['query']=_[_0x6eec('0x42')](_0x57c596[_0x6eec('0x44')]);_0x5c37fe[_0x6eec('0x4b')]=_[_0x6eec('0x43')](_0x5c37fe['model'],_0x5c37fe['query']);_0x45a029[_0x6eec('0x45')]=_[_0x6eec('0x43')](_0x5c37fe['model'],qs[_0x6eec('0x46')](_0x57c596[_0x6eec('0x44')][_0x6eec('0x46')]));_0x45a029[_0x6eec('0x45')]=_0x45a029[_0x6eec('0x45')][_0x6eec('0x56')]?_0x45a029[_0x6eec('0x45')]:_0x5c37fe['model'];_0x45a029['order']=qs[_0x6eec('0x49')](_0x57c596[_0x6eec('0x44')][_0x6eec('0x49')]);_0x45a029[_0x6eec('0x4a')]=qs['filters'](_['pick'](_0x57c596[_0x6eec('0x44')],_0x5c37fe[_0x6eec('0x4b')]));if(_0x57c596[_0x6eec('0x44')][_0x6eec('0x4d')]){_0x45a029[_0x6eec('0x4a')]=_[_0x6eec('0x4e')](_0x45a029[_0x6eec('0x4a')],{'$or':_[_0x6eec('0x41')](_0x45a029[_0x6eec('0x45')],function(_0x411a51){var _0x3f81a1={};_0x3f81a1[_0x411a51]={'$like':'%'+_0x57c596[_0x6eec('0x44')][_0x6eec('0x4d')]+'%'};return _0x3f81a1;})});}_0x45a029=_[_0x6eec('0x4e')]({},_0x45a029,_0x57c596[_0x6eec('0x50')]);return _0x2d6411[_0x6eec('0xa2')](_0x45a029);}})[_0x6eec('0x1f')](function(_0x139fe5){if(_0x139fe5){_0x19335e=_0x139fe5[_0x6eec('0x56')];if(!_0x57c596[_0x6eec('0x44')][_0x6eec('0x47')](_0x6eec('0x48'))){_0x45a029[_0x6eec('0x30')]=qs[_0x6eec('0x30')](_0x57c596['query'][_0x6eec('0x30')]);_0x45a029[_0x6eec('0x2f')]=qs[_0x6eec('0x2f')](_0x57c596[_0x6eec('0x44')][_0x6eec('0x2f')]);}return _0x2d6411[_0x6eec('0xa2')](_0x45a029);}})[_0x6eec('0x1f')](function(_0x5663ef){if(_0x5663ef){return _0x5663ef?{'count':_0x19335e,'rows':_0x5663ef}:null;}})[_0x6eec('0x1f')](respondWithResult(_0x152680,null))['catch'](handleError(_0x152680,null));};exports[_0x6eec('0xa3')]=function(_0x40ef2b,_0x54de03,_0x3f4c88){var _0x50c99d={'raw':![],'where':{}};var _0x41ed3f={};var _0x51a303={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x40ef2b[_0x6eec('0x55')]['id']}})['then'](handleEntityNotFound(_0x54de03,null))[_0x6eec('0x1f')](function(_0x13ec21){if(_0x13ec21){_0x41ed3f['model']=_[_0x6eec('0x42')](db[_0x6eec('0x88')]['rawAttributes']);_0x41ed3f[_0x6eec('0x44')]=_[_0x6eec('0x42')](_0x40ef2b[_0x6eec('0x44')]);_0x41ed3f['filters']=_[_0x6eec('0x43')](_0x41ed3f['model'],_0x41ed3f[_0x6eec('0x44')]);_0x50c99d[_0x6eec('0x45')]=_['intersection'](_0x41ed3f['model'],qs[_0x6eec('0x46')](_0x40ef2b['query'][_0x6eec('0x46')]));_0x50c99d[_0x6eec('0x45')]=_0x50c99d[_0x6eec('0x45')][_0x6eec('0x56')]?_0x50c99d['attributes']:_0x41ed3f[_0x6eec('0x40')];if(!_0x40ef2b[_0x6eec('0x44')][_0x6eec('0x47')](_0x6eec('0x48'))){_0x50c99d[_0x6eec('0x30')]=qs[_0x6eec('0x30')](_0x40ef2b[_0x6eec('0x44')][_0x6eec('0x30')]);_0x50c99d[_0x6eec('0x2f')]=qs[_0x6eec('0x2f')](_0x40ef2b[_0x6eec('0x44')]['offset']);}_0x50c99d[_0x6eec('0x65')]=qs['sort'](_0x40ef2b['query'][_0x6eec('0x49')]);_0x50c99d[_0x6eec('0x4a')]=qs[_0x6eec('0x4b')](_['pick'](_0x40ef2b['query'],_0x41ed3f['filters']));_0x50c99d['where']['OpenchannelAccountId']=_0x13ec21['id'];if(_0x40ef2b[_0x6eec('0x44')][_0x6eec('0x4d')]){_0x50c99d[_0x6eec('0x4a')]=_[_0x6eec('0x4e')](_0x50c99d[_0x6eec('0x4a')],{'$or':_[_0x6eec('0x41')](_0x50c99d[_0x6eec('0x45')],function(_0x335d70){var _0x360638={};_0x360638[_0x335d70]={'$like':'%'+_0x40ef2b[_0x6eec('0x44')][_0x6eec('0x4d')]+'%'};return _0x360638;})});}_0x50c99d=_[_0x6eec('0x4e')]({},_0x50c99d,_0x40ef2b[_0x6eec('0x50')]);return db[_0x6eec('0x88')][_0x6eec('0x2e')]({'where':_0x50c99d[_0x6eec('0x4a')]})[_0x6eec('0x1f')](function(_0x3be645){_0x51a303[_0x6eec('0x2e')]=_0x3be645;if(_0x40ef2b[_0x6eec('0x44')]['includeAll']){_0x50c99d[_0x6eec('0x52')]=[{'model':db[_0x6eec('0x6c')],'as':_0x6eec('0xa4'),'required':![]},{'model':db[_0x6eec('0x96')],'as':_0x6eec('0xa5'),'attributes':['name',_0x6eec('0xa6'),_0x6eec('0xa7')],'required':![]},{'model':db['Tag'],'as':_0x6eec('0xa8'),'attributes':['id','name','color'],'where':_0x40ef2b[_0x6eec('0x44')][_0x6eec('0xa9')]?{'id':_0x40ef2b[_0x6eec('0x44')][_0x6eec('0xa9')]}:undefined,'required':_0x40ef2b['query']['tag']?!![]:![]}];}return db[_0x6eec('0x88')][_0x6eec('0x53')](_0x50c99d);})['then'](function(_0x10a920){_0x51a303[_0x6eec('0x54')]=_0x10a920;return _0x51a303;});}})[_0x6eec('0x1f')](respondWithFilteredResult(_0x54de03,_0x50c99d))[_0x6eec('0x2a')](handleError(_0x54de03,null));};exports[_0x6eec('0xaa')]=function(_0x33eabf,_0x38a87a,_0x502a21){return db['OpenchannelAccount'][_0x6eec('0x57')]({'where':{'id':_0x33eabf[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x38a87a,null))['then'](function(_0x4d2a2e){if(_0x4d2a2e){return _0x4d2a2e['addAgents'](_0x33eabf['body']['ids'],_[_0x6eec('0xab')](_0x33eabf[_0x6eec('0x59')],[_0x6eec('0x67'),'id'])||{})['spread'](function(_0x200f9c){for(var _0x8d792f=0x0;_0x8d792f<_0x33eabf[_0x6eec('0x59')][_0x6eec('0x67')][_0x6eec('0x56')];_0x8d792f+=0x1){socket[_0x6eec('0xac')](_0x6eec('0xad'),{'UserId':_0x33eabf[_0x6eec('0x59')][_0x6eec('0x67')][_0x8d792f],'OpenchannelAccountId':_0x33eabf[_0x6eec('0x55')]['id']});}return _0x200f9c;});}})[_0x6eec('0x1f')](respondWithResult(_0x38a87a,null))[_0x6eec('0x2a')](handleError(_0x38a87a,null));};exports['removeAgents']=function(_0x334d6d,_0x2b1f6c,_0x2fe5d3){return db['OpenchannelAccount'][_0x6eec('0x57')]({'where':{'id':_0x334d6d['params']['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x2b1f6c,null))[_0x6eec('0x1f')](function(_0x2c109b){if(_0x2c109b){return _0x2c109b['removeAgents'](_0x334d6d[_0x6eec('0x44')][_0x6eec('0x67')])['then'](function(){if(_[_0x6eec('0xae')](_0x334d6d[_0x6eec('0x44')][_0x6eec('0x67')])){for(var _0x1eb705=0x0;_0x1eb705<_0x334d6d['query']['ids'][_0x6eec('0x56')];_0x1eb705+=0x1){socket[_0x6eec('0xac')](_0x6eec('0xaf'),{'UserId':Number(_0x334d6d[_0x6eec('0x44')][_0x6eec('0x67')][_0x1eb705]),'OpenchannelAccountId':Number(_0x334d6d[_0x6eec('0x55')]['id'])});}}else{socket[_0x6eec('0xac')](_0x6eec('0xaf'),{'UserId':Number(_0x334d6d[_0x6eec('0x44')]['ids']),'OpenchannelAccountId':Number(_0x334d6d[_0x6eec('0x55')]['id'])});}});}})[_0x6eec('0x1f')](respondWithStatusCode(_0x2b1f6c,null))['catch'](handleError(_0x2b1f6c,null));};exports[_0x6eec('0xb0')]=function(_0x100947,_0x23fb36,_0x1d9a0f){var _0x559ac0={};var _0x3511e8={};var _0x2cd1ba;var _0x4a84ff;return db[_0x6eec('0x3c')][_0x6eec('0x64')]({'where':{'id':_0x100947[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x23fb36,null))[_0x6eec('0x1f')](function(_0x58b36b){if(_0x58b36b){_0x2cd1ba=_0x58b36b;_0x3511e8['model']=_[_0x6eec('0x42')](db[_0x6eec('0x96')]['rawAttributes']);_0x3511e8[_0x6eec('0x44')]=_['keys'](_0x100947['query']);_0x3511e8[_0x6eec('0x4b')]=_[_0x6eec('0x43')](_0x3511e8[_0x6eec('0x40')],_0x3511e8[_0x6eec('0x44')]);_0x559ac0[_0x6eec('0x45')]=_[_0x6eec('0x43')](_0x3511e8['model'],qs['fields'](_0x100947[_0x6eec('0x44')][_0x6eec('0x46')]));_0x559ac0['attributes']=_0x559ac0[_0x6eec('0x45')]['length']?_0x559ac0['attributes']:_0x3511e8[_0x6eec('0x40')];_0x559ac0['order']=qs[_0x6eec('0x49')](_0x100947[_0x6eec('0x44')][_0x6eec('0x49')]);_0x559ac0[_0x6eec('0x4a')]=qs[_0x6eec('0x4b')](_[_0x6eec('0x4c')](_0x100947[_0x6eec('0x44')],_0x3511e8['filters']));if(_0x100947[_0x6eec('0x44')]['filter']){_0x559ac0[_0x6eec('0x4a')]=_['merge'](_0x559ac0['where'],{'$or':_[_0x6eec('0x41')](_0x559ac0['attributes'],function(_0x5e5e7d){var _0x2252e1={};_0x2252e1[_0x5e5e7d]={'$like':'%'+_0x100947[_0x6eec('0x44')][_0x6eec('0x4d')]+'%'};return _0x2252e1;})});}_0x559ac0=_[_0x6eec('0x4e')]({},_0x559ac0,_0x100947[_0x6eec('0x50')]);return _0x2cd1ba[_0x6eec('0xb0')](_0x559ac0);}})['then'](function(_0x194ec8){if(_0x194ec8){_0x4a84ff=_0x194ec8['length'];if(!_0x100947[_0x6eec('0x44')]['hasOwnProperty']('nolimit')){_0x559ac0[_0x6eec('0x30')]=qs[_0x6eec('0x30')](_0x100947[_0x6eec('0x44')][_0x6eec('0x30')]);_0x559ac0['offset']=qs[_0x6eec('0x2f')](_0x100947[_0x6eec('0x44')][_0x6eec('0x2f')]);}return _0x2cd1ba[_0x6eec('0xb0')](_0x559ac0);}})[_0x6eec('0x1f')](function(_0x5047b3){if(_0x5047b3){return _0x5047b3?{'count':_0x4a84ff,'rows':_0x5047b3}:null;}})[_0x6eec('0x1f')](respondWithResult(_0x23fb36,null))[_0x6eec('0x2a')](handleError(_0x23fb36,null));};exports[_0x6eec('0x39')]=function(_0x337602,_0x178a19,_0x28e1ee){var _0x36b8ac,_0x460821,_0x3ea97f;if(_[_0x6eec('0x73')](_0x337602[_0x6eec('0x59')]['body'])||_0x337602[_0x6eec('0x59')][_0x6eec('0x59')]===''){throw new db[(_0x6eec('0x6d'))]['ValidationError'](_0x6eec('0x74'));}if(_[_0x6eec('0x73')](_0x337602['body']['to'])){}_0x36b8ac=_0x337602[_0x6eec('0x59')]['to'];return db['OpenchannelAccount'][_0x6eec('0x64')]({'where':{'id':_0x337602[_0x6eec('0x55')]['id']}})[_0x6eec('0x1f')](handleEntityNotFound(_0x178a19,null))[_0x6eec('0x1f')](function(_0x21e29e){if(_0x21e29e){return db[_0x6eec('0x3c')]['find']({'where':{'id':_0x21e29e['id']},'include':[{'model':db[_0x6eec('0x78')],'as':_0x6eec('0x7d'),'include':[{'model':db['CmContact'],'as':_0x6eec('0x79'),'where':{[_0x21e29e[_0x6eec('0x75')]]:_0x36b8ac},'limit':0x1,'order':[['updatedAt',_0x6eec('0x7a')]]}]}]})['then'](handleEntityNotFound(_0x178a19,null))[_0x6eec('0x1f')](function(_0x5e350c){if(_0x5e350c&&_0x5e350c[_0x6eec('0x7d')]){_0x460821=_0x5e350c[_0x6eec('0x5c')]({'plain':!![]});if(_0x460821['List']&&_0x460821[_0x6eec('0x7d')][_0x6eec('0x79')][_0x6eec('0x56')]){return _0x460821[_0x6eec('0x7d')][_0x6eec('0x79')][0x0];}return db[_0x6eec('0x6c')][_0x6eec('0x58')](_['defaults'](_0x337602[_0x6eec('0x59')],{'firstName':_0x36b8ac,[_0x5e350c[_0x6eec('0x75')]]:_0x36b8ac,'phone':_0x36b8ac,'ListId':_0x460821[_0x6eec('0x84')]}));}})[_0x6eec('0x1f')](handleEntityNotFound(_0x178a19,null))[_0x6eec('0x1f')](function(_0x41ab79){if(_0x41ab79){_0x3ea97f=_0x41ab79;return db['OpenchannelInteraction'][_0x6eec('0x57')]({'where':{'ContactId':_0x3ea97f['id'],'closed':![],'OpenchannelAccountId':_0x460821['id']}})[_0x6eec('0x1f')](function(_0x4a5ed7){if(_0x4a5ed7){return[_0x4a5ed7,![]];}return db[_0x6eec('0x88')][_0x6eec('0x58')]({'UserId':_0x337602[_0x6eec('0x5a')]['id'],'ContactId':_0x3ea97f['id'],'OpenchannelAccountId':_0x460821['id'],'lastMsgDirection':'out','Messages':[_[_0x6eec('0x4e')](_0x337602[_0x6eec('0x59')],{'read':![],'body':_0x337602[_0x6eec('0x59')][_0x6eec('0x59')],'OpenchannelAccountId':_0x460821['id'],'UserId':_0x337602[_0x6eec('0x5a')]['id'],'ContactId':_0x3ea97f['id']})]},{'include':[{'model':db[_0x6eec('0x93')],'as':_0x6eec('0xb1')}]})[_0x6eec('0x1f')](function(_0x2241c0){return[_0x2241c0,!![]];});});}})[_0x6eec('0x8a')](function(_0x488a86,_0x3f76da){if(_0x3f76da){return _0x488a86;}return db[_0x6eec('0x93')]['create'](_[_0x6eec('0x4e')](_0x337602[_0x6eec('0x59')],{'read':![],'body':_0x337602[_0x6eec('0x59')][_0x6eec('0x59')],'OpenchannelAccountId':_0x460821['id'],'OpenchannelInteractionId':_0x488a86['id'],'UserId':_0x337602[_0x6eec('0x5a')]['id'],'ContactId':_0x3ea97f['id']}))[_0x6eec('0x1f')](function(_0x1825ff){_0x488a86['dataValues'][_0x6eec('0xb1')]=[];_0x488a86['dataValues'][_0x6eec('0xb1')]['push'](_0x1825ff[_0x6eec('0xb2')]);return _0x488a86;});});}})[_0x6eec('0x1f')](respondWithResult(_0x178a19,null))['catch'](handleError(_0x178a19,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 16c6732..65a1beb 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 _0xa304=['save','update','hook','events','../../mysqldb','setMaxListeners'];(function(_0x13cd99,_0x50bd8d){var _0x1d42c7=function(_0x1fa433){while(--_0x1fa433){_0x13cd99['push'](_0x13cd99['shift']());}};_0x1d42c7(++_0x50bd8d);}(_0xa304,0x183));var _0x4a30=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0xa304[_0x2bcddb];return _0x12a9e8;};'use strict';var EventEmitter=require(_0x4a30('0x0'));var OpenchannelAccount=require(_0x4a30('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4a30('0x2')](0x0);var events={'afterCreate':_0x4a30('0x3'),'afterUpdate':_0x4a30('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25f525){return function(_0x419c4f,_0x7e807a,_0x1c3e6e){OpenchannelAccountEvents['emit'](_0x25f525+':'+_0x419c4f['id'],_0x419c4f);OpenchannelAccountEvents['emit'](_0x25f525,_0x419c4f);_0x1c3e6e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x4a30('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x8e3e=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4d4a06,_0x30289a){var _0x1dbcd8=function(_0x30ed6e){while(--_0x30ed6e){_0x4d4a06['push'](_0x4d4a06['shift']());}};_0x1dbcd8(++_0x30289a);}(_0x8e3e,0x1a9));var _0xe8e3=function(_0x11ea68,_0x25ca59){_0x11ea68=_0x11ea68-0x0;var _0x4377ac=_0x8e3e[_0x11ea68];return _0x4377ac;};'use strict';var EventEmitter=require(_0xe8e3('0x0'));var OpenchannelAccount=require(_0xe8e3('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8e3('0x2'),'afterUpdate':_0xe8e3('0x3'),'afterDestroy':_0xe8e3('0x4')};function emitEvent(_0x5a1b71){return function(_0x16d804,_0x29f49d,_0x22b200){OpenchannelAccountEvents['emit'](_0x5a1b71+':'+_0x16d804['id'],_0x16d804);OpenchannelAccountEvents[_0xe8e3('0x5')](_0x5a1b71,_0x16d804);_0x22b200(null);};}for(var e in events){if(events[_0xe8e3('0x6')](e)){var event=events[e];OpenchannelAccount[_0xe8e3('0x7')](e,emitEvent(event));}}module[_0xe8e3('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 c1658da..5165345 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 _0x058f=['lodash','util','api','moment','request-promise','path','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts'];(function(_0x2a3306,_0x27fd5b){var _0x3c3859=function(_0x392054){while(--_0x392054){_0x2a3306['push'](_0x2a3306['shift']());}};_0x3c3859(++_0x27fd5b);}(_0x058f,0xc6));var _0xf058=function(_0x4816a6,_0x116b86){_0x4816a6=_0x4816a6-0x0;var _0x70d171=_0x058f[_0x4816a6];return _0x70d171;};'use strict';var _=require(_0xf058('0x0'));var util=require(_0xf058('0x1'));var logger=require('../../config/logger')(_0xf058('0x2'));var moment=require(_0xf058('0x3'));var BPromise=require('bluebird');var rp=require(_0xf058('0x4'));var fs=require('fs');var path=require(_0xf058('0x5'));var rimraf=require('rimraf');var config=require(_0xf058('0x6'));var attributes=require(_0xf058('0x7'));module[_0xf058('0x8')]=function(_0x25ecbe,_0x1e2c41){return _0x25ecbe[_0xf058('0x9')]('OpenchannelAccount',attributes,{'tableName':_0xf058('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1257=['openchannel_accounts','../../config/logger','path','rimraf','../../config/environment'];(function(_0x46eefa,_0x171736){var _0xf061d2=function(_0xd64b5d){while(--_0xd64b5d){_0x46eefa['push'](_0x46eefa['shift']());}};_0xf061d2(++_0x171736);}(_0x1257,0x17d));var _0x7125=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1257[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7125('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7125('0x1'));var rimraf=require(_0x7125('0x2'));var config=require(_0x7125('0x3'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x553065,_0x1077da){return _0x553065['define']('OpenchannelAccount',attributes,{'tableName':_0x7125('0x4'),'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 c58a29e..3e28474 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 _0x3fc3=['info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelAccount.socket','register','request','then'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3fc3,0xa4));var _0x33fc=function(_0x9ffeaf,_0x9dfd4d){_0x9ffeaf=_0x9ffeaf-0x0;var _0xce393b=_0x3fc3[_0x9ffeaf];return _0xce393b;};'use strict';var _=require(_0x33fc('0x0'));var util=require(_0x33fc('0x1'));var moment=require(_0x33fc('0x2'));var BPromise=require(_0x33fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33fc('0x4'));var db=require(_0x33fc('0x5'))['db'];var utils=require(_0x33fc('0x6'));var logger=require('../../config/logger')(_0x33fc('0x7'));var config=require(_0x33fc('0x8'));var jayson=require(_0x33fc('0x9'));var client=jayson[_0x33fc('0xa')]['http']({'port':0x232a});config[_0x33fc('0xb')]=_[_0x33fc('0xc')](config[_0x33fc('0xb')],{'host':_0x33fc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33fc('0xb')]));require(_0x33fc('0xe'))[_0x33fc('0xf')](socket);function respondWithRpcPromise(_0x1e0c47,_0x277e0c,_0x13235f){return new BPromise(function(_0x1af8f2,_0x5b6042){return client[_0x33fc('0x10')](_0x1e0c47,_0x13235f)[_0x33fc('0x11')](function(_0x52a7c4){logger[_0x33fc('0x12')](_0x33fc('0x13'),_0x277e0c,_0x33fc('0x14'));logger[_0x33fc('0x15')](_0x33fc('0x16'),_0x277e0c,_0x33fc('0x14'),JSON['stringify'](_0x52a7c4));if(_0x52a7c4[_0x33fc('0x17')]){if(_0x52a7c4[_0x33fc('0x17')]['code']===0x1f4){logger[_0x33fc('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x277e0c,_0x52a7c4['error'][_0x33fc('0x18')]);return _0x5b6042(_0x52a7c4['error'][_0x33fc('0x18')]);}logger[_0x33fc('0x17')](_0x33fc('0x13'),_0x277e0c,_0x52a7c4[_0x33fc('0x17')]['message']);return _0x1af8f2(_0x52a7c4[_0x33fc('0x17')][_0x33fc('0x18')]);}else{logger[_0x33fc('0x12')](_0x33fc('0x13'),_0x277e0c,_0x33fc('0x14'));_0x1af8f2(_0x52a7c4[_0x33fc('0x19')][_0x33fc('0x18')]);}})['catch'](function(_0x59c445){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x277e0c,_0x59c445);_0x5b6042(_0x59c445);});});} \ No newline at end of file +var _0x234c=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','debug'];(function(_0x2359a0,_0x51ab9c){var _0x269f47=function(_0x5ed79d){while(--_0x5ed79d){_0x2359a0['push'](_0x2359a0['shift']());}};_0x269f47(++_0x51ab9c);}(_0x234c,0x17f));var _0xc234=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x234c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc234('0x0'));var util=require(_0xc234('0x1'));var moment=require(_0xc234('0x2'));var BPromise=require(_0xc234('0x3'));var rs=require(_0xc234('0x4'));var fs=require('fs');var Redis=require(_0xc234('0x5'));var db=require(_0xc234('0x6'))['db'];var utils=require(_0xc234('0x7'));var logger=require(_0xc234('0x8'))(_0xc234('0x9'));var config=require(_0xc234('0xa'));var jayson=require(_0xc234('0xb'));var client=jayson[_0xc234('0xc')][_0xc234('0xd')]({'port':0x232a});config['redis']=_[_0xc234('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc234('0xf'))(new Redis(config[_0xc234('0x10')]));require(_0xc234('0x11'))['register'](socket);function respondWithRpcPromise(_0x4240eb,_0x44535d,_0x2cef90){return new BPromise(function(_0x49ec69,_0x3d53ed){return client['request'](_0x4240eb,_0x2cef90)[_0xc234('0x12')](function(_0x515379){logger[_0xc234('0x13')](_0xc234('0x14'),_0x44535d,'request\x20sent');logger[_0xc234('0x15')](_0xc234('0x16'),_0x44535d,_0xc234('0x17'),JSON['stringify'](_0x515379));if(_0x515379[_0xc234('0x18')]){if(_0x515379[_0xc234('0x18')][_0xc234('0x19')]===0x1f4){logger['error'](_0xc234('0x14'),_0x44535d,_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);return _0x3d53ed(_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);}logger[_0xc234('0x18')](_0xc234('0x14'),_0x44535d,_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);return _0x49ec69(_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);}else{logger[_0xc234('0x13')](_0xc234('0x14'),_0x44535d,_0xc234('0x17'));_0x49ec69(_0x515379['result'][_0xc234('0x1a')]);}})['catch'](function(_0x4373b6){logger[_0xc234('0x18')](_0xc234('0x14'),_0x44535d,_0x4373b6);_0x3d53ed(_0x4373b6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e6ca5d9..d78b994 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 _0x8c69=['openchannelAccount:','./openchannelAccount.events','update','removeListener','register','length'];(function(_0x40d411,_0x4642f1){var _0x51fd22=function(_0x1031c5){while(--_0x1031c5){_0x40d411['push'](_0x40d411['shift']());}};_0x51fd22(++_0x4642f1);}(_0x8c69,0x163));var _0x98c6=function(_0x471360,_0x34bd0b){_0x471360=_0x471360-0x0;var _0x4feb29=_0x8c69[_0x471360];return _0x4feb29;};'use strict';var OpenchannelAccountEvents=require(_0x98c6('0x0'));var events=['save','remove',_0x98c6('0x1')];function createListener(_0x28d429,_0x70b973){return function(_0x317c23){_0x70b973['emit'](_0x28d429,_0x317c23);};}function removeListener(_0x245481,_0x3cabb1){return function(){OpenchannelAccountEvents[_0x98c6('0x2')](_0x245481,_0x3cabb1);};}exports[_0x98c6('0x3')]=function(_0x452f87){for(var _0x5554a1=0x0,_0x27ef9a=events[_0x98c6('0x4')];_0x5554a1<_0x27ef9a;_0x5554a1++){var _0x319592=events[_0x5554a1];var _0xacb59b=createListener(_0x98c6('0x5')+_0x319592,_0x452f87);OpenchannelAccountEvents['on'](_0x319592,_0xacb59b);}}; \ No newline at end of file +var _0xa1c4=['save','remove','emit','removeListener','register','length'];(function(_0x531cd4,_0x1ecf97){var _0x450b20=function(_0x5e99e8){while(--_0x5e99e8){_0x531cd4['push'](_0x531cd4['shift']());}};_0x450b20(++_0x1ecf97);}(_0xa1c4,0x108));var _0x4a1c=function(_0x16ba74,_0x2ebcfa){_0x16ba74=_0x16ba74-0x0;var _0x4333a6=_0xa1c4[_0x16ba74];return _0x4333a6;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x4a1c('0x0'),_0x4a1c('0x1'),'update'];function createListener(_0x1b0d8c,_0x10743a){return function(_0x457a44){_0x10743a[_0x4a1c('0x2')](_0x1b0d8c,_0x457a44);};}function removeListener(_0x158d76,_0x54f1c8){return function(){OpenchannelAccountEvents[_0x4a1c('0x3')](_0x158d76,_0x54f1c8);};}exports[_0x4a1c('0x4')]=function(_0x394bc6){for(var _0x48a49f=0x0,_0x504d49=events[_0x4a1c('0x5')];_0x48a49f<_0x504d49;_0x48a49f++){var _0x294c4d=events[_0x48a49f];var _0x2bb0d2=createListener('openchannelAccount:'+_0x294c4d,_0x394bc6);OpenchannelAccountEvents['on'](_0x294c4d,_0x2bb0d2);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 46d0296..dc48d58 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 _0xe7ef=['express','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe7ef,0x162));var _0xfe7e=function(_0x4a03bf,_0x4c4993){_0x4a03bf=_0x4a03bf-0x0;var _0xec5184=_0xe7ef[_0x4a03bf];return _0xec5184;};'use strict';var multer=require(_0xfe7e('0x0'));var util=require(_0xfe7e('0x1'));var path=require(_0xfe7e('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe7e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfe7e('0x4'));var config=require('../../config/environment');var controller=require(_0xfe7e('0x5'));router[_0xfe7e('0x6')]('/',auth[_0xfe7e('0x7')](),controller['index']);router[_0xfe7e('0x6')](_0xfe7e('0x8'),auth['isAuthenticated'](),controller[_0xfe7e('0x9')]);router[_0xfe7e('0xa')]('/',auth[_0xfe7e('0x7')](),controller[_0xfe7e('0xb')]);router[_0xfe7e('0xc')]('/:id',auth[_0xfe7e('0x7')](),controller[_0xfe7e('0xd')]);router[_0xfe7e('0xe')](_0xfe7e('0x8'),auth[_0xfe7e('0x7')](),controller[_0xfe7e('0xf')]);module[_0xfe7e('0x10')]=router; \ No newline at end of file +var _0x4b69=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','delete'];(function(_0x208e1c,_0x1b3339){var _0x2e7927=function(_0x503ff8){while(--_0x503ff8){_0x208e1c['push'](_0x208e1c['shift']());}};_0x2e7927(++_0x1b3339);}(_0x4b69,0x1de));var _0x94b6=function(_0x44bbac,_0x5299a4){_0x44bbac=_0x44bbac-0x0;var _0x32216b=_0x4b69[_0x44bbac];return _0x32216b;};'use strict';var multer=require('multer');var util=require(_0x94b6('0x0'));var path=require(_0x94b6('0x1'));var timeout=require(_0x94b6('0x2'));var express=require(_0x94b6('0x3'));var router=express[_0x94b6('0x4')]();var auth=require(_0x94b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x94b6('0x6'));var controller=require(_0x94b6('0x7'));router[_0x94b6('0x8')]('/',auth[_0x94b6('0x9')](),controller[_0x94b6('0xa')]);router[_0x94b6('0x8')](_0x94b6('0xb'),auth[_0x94b6('0x9')](),controller['show']);router[_0x94b6('0xc')]('/',auth['isAuthenticated'](),controller[_0x94b6('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x94b6('0xe')](_0x94b6('0xb'),auth[_0x94b6('0x9')](),controller[_0x94b6('0xf')]);module[_0x94b6('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index affbb34..75c8a16 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 _0xe229=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x198ad4,_0x1e668c){var _0x2c6f47=function(_0x2d3e63){while(--_0x2d3e63){_0x198ad4['push'](_0x198ad4['shift']());}};_0x2c6f47(++_0x1e668c);}(_0xe229,0x15e));var _0x9e22=function(_0x4757f5,_0x16939c){_0x4757f5=_0x4757f5-0x0;var _0x88f633=_0xe229[_0x4757f5];return _0x88f633;};'use strict';var Sequelize=require(_0x9e22('0x0'));module[_0x9e22('0x1')]={'priority':{'type':Sequelize[_0x9e22('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9e22('0x3')],'allowNull':![],'defaultValue':_0x9e22('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9e22('0x3')]},'interval':{'type':Sequelize[_0x9e22('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x01bc=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0xa4add2,_0x407e7f){var _0x461167=function(_0x7064d){while(--_0x7064d){_0xa4add2['push'](_0xa4add2['shift']());}};_0x461167(++_0x407e7f);}(_0x01bc,0x19c));var _0xc01b=function(_0x2b0a11,_0x2ef4e3){_0x2b0a11=_0x2b0a11-0x0;var _0xdcbb9e=_0x01bc[_0x2b0a11];return _0xdcbb9e;};'use strict';var Sequelize=require(_0xc01b('0x0'));module[_0xc01b('0x1')]={'priority':{'type':Sequelize[_0xc01b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc01b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc01b('0x4')]},'interval':{'type':Sequelize[_0xc01b('0x4')],'defaultValue':_0xc01b('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9be73c5..f93b219 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 _0x5156=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key'];(function(_0x469d74,_0x11ad2b){var _0x3f14c7=function(_0x40456d){while(--_0x40456d){_0x469d74['push'](_0x469d74['shift']());}};_0x3f14c7(++_0x11ad2b);}(_0x5156,0xb4));var _0x6515=function(_0xdb50e1,_0x112a80){_0xdb50e1=_0xdb50e1-0x0;var _0x2a50fc=_0x5156[_0xdb50e1];return _0x2a50fc;};'use strict';var pdf=require(_0x6515('0x0'));var emlformat=require(_0x6515('0x1'));var rimraf=require(_0x6515('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6515('0x3'));var rp=require(_0x6515('0x4'));var moment=require('moment');var BPromise=require(_0x6515('0x5'));var Mustache=require(_0x6515('0x6'));var util=require(_0x6515('0x7'));var path=require(_0x6515('0x8'));var sox=require('sox');var csv=require(_0x6515('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6515('0xa'));var squel=require(_0x6515('0xb'));var crypto=require(_0x6515('0xc'));var jsforce=require(_0x6515('0xd'));var deskjs=require(_0x6515('0xe'));var toCsv=require(_0x6515('0x9'));var querystring=require(_0x6515('0xf'));var Papa=require(_0x6515('0x10'));var Redis=require('ioredis');var authService=require(_0x6515('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6515('0x12'));var hardwareService=require(_0x6515('0x13'));var logger=require(_0x6515('0x14'))(_0x6515('0x15'));var utils=require(_0x6515('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6515('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x111075,_0x517ca6){_0x517ca6=_0x517ca6||0xcc;return function(_0x2ca2b8){if(_0x2ca2b8){return _0x111075[_0x6515('0x18')](_0x517ca6);}return _0x111075['status'](_0x517ca6)['end']();};}function respondWithResult(_0xf55c40,_0x141a7a){_0x141a7a=_0x141a7a||0xc8;return function(_0x10d619){if(_0x10d619){return _0xf55c40[_0x6515('0x19')](_0x141a7a)[_0x6515('0x1a')](_0x10d619);}};}function respondWithFilteredResult(_0x8fbef0,_0xee15db){return function(_0x4c2643){if(_0x4c2643){var _0x15ec7d=_0x4c2643[_0x6515('0x1b')],_0x29f424=_0xee15db[_0x6515('0x1c')],_0x5717af=_0xee15db['offset']+_0xee15db[_0x6515('0x1d')],_0x4febdd;if(_0x5717af>=_0x15ec7d){_0x5717af=_0x15ec7d;_0x4febdd=0xc8;}else{_0x4febdd=0xce;}_0x8fbef0[_0x6515('0x19')](_0x4febdd);return _0x8fbef0[_0x6515('0x1e')](_0x6515('0x1f'),_0x29f424+'-'+_0x5717af+'/'+_0x15ec7d)[_0x6515('0x1a')](_0x4c2643);}return null;};}function patchUpdates(_0x12e58c){return function(_0x16608a){try{jsonpatch[_0x6515('0x20')](_0x16608a,_0x12e58c,!![]);}catch(_0x1ce013){return BPromise['reject'](_0x1ce013);}return _0x16608a[_0x6515('0x21')]();};}function saveUpdates(_0x16781f,_0x54a7bf){return function(_0x2290f7){if(_0x2290f7){return _0x2290f7['update'](_0x16781f)[_0x6515('0x22')](function(_0x3310d1){return _0x3310d1;});}return null;};}function removeEntity(_0x471190,_0x357539){return function(_0x55ba78){if(_0x55ba78){return _0x55ba78[_0x6515('0x23')]()['then'](function(){_0x471190[_0x6515('0x19')](0xcc)[_0x6515('0x24')]();});}};}function handleEntityNotFound(_0x1190ec,_0x1ecaec){return function(_0x29ff46){if(!_0x29ff46){_0x1190ec['sendStatus'](0x194);}return _0x29ff46;};}function handleError(_0x2a346a,_0xa0ff1e){_0xa0ff1e=_0xa0ff1e||0x1f4;return function(_0x4e2b7e){logger[_0x6515('0x25')](_0x4e2b7e[_0x6515('0x26')]);if(_0x4e2b7e['name']){delete _0x4e2b7e[_0x6515('0x27')];}_0x2a346a[_0x6515('0x19')](_0xa0ff1e)[_0x6515('0x28')](_0x4e2b7e);};}exports[_0x6515('0x29')]=function(_0x30c5be,_0x40a9ca){var _0x1916cd={},_0x415af7={},_0x498aad={'count':0x0,'rows':[]};var _0x12db11=_[_0x6515('0x2a')](db[_0x6515('0x2b')][_0x6515('0x2c')],function(_0x28d044){return{'name':_0x28d044[_0x6515('0x2d')],'type':_0x28d044[_0x6515('0x2e')][_0x6515('0x2f')]};});_0x415af7[_0x6515('0x30')]=_[_0x6515('0x2a')](_0x12db11,_0x6515('0x27'));_0x415af7['query']=_[_0x6515('0x31')](_0x30c5be[_0x6515('0x32')]);_0x415af7[_0x6515('0x33')]=_[_0x6515('0x34')](_0x415af7[_0x6515('0x30')],_0x415af7[_0x6515('0x32')]);_0x1916cd[_0x6515('0x35')]=_[_0x6515('0x34')](_0x415af7[_0x6515('0x30')],qs[_0x6515('0x36')](_0x30c5be[_0x6515('0x32')][_0x6515('0x36')]));_0x1916cd['attributes']=_0x1916cd[_0x6515('0x35')][_0x6515('0x37')]?_0x1916cd['attributes']:_0x415af7[_0x6515('0x30')];if(!_0x30c5be[_0x6515('0x32')][_0x6515('0x38')](_0x6515('0x39'))){_0x1916cd[_0x6515('0x1d')]=qs[_0x6515('0x1d')](_0x30c5be[_0x6515('0x32')][_0x6515('0x1d')]);_0x1916cd['offset']=qs['offset'](_0x30c5be[_0x6515('0x32')][_0x6515('0x1c')]);}_0x1916cd[_0x6515('0x3a')]=qs[_0x6515('0x3b')](_0x30c5be['query'][_0x6515('0x3b')]);_0x1916cd[_0x6515('0x3c')]=qs[_0x6515('0x33')](_[_0x6515('0x3d')](_0x30c5be[_0x6515('0x32')],_0x415af7[_0x6515('0x33')]),_0x12db11);if(_0x30c5be[_0x6515('0x32')][_0x6515('0x3e')]){_0x1916cd[_0x6515('0x3c')]=_[_0x6515('0x3f')](_0x1916cd[_0x6515('0x3c')],{'$or':_[_0x6515('0x2a')](_0x12db11,function(_0x1379b4){if(_0x1379b4[_0x6515('0x2e')]!==_0x6515('0x40')){var _0x2c29e8={};_0x2c29e8[_0x1379b4[_0x6515('0x27')]]={'$like':'%'+_0x30c5be[_0x6515('0x32')][_0x6515('0x3e')]+'%'};return _0x2c29e8;}})});}_0x1916cd=_[_0x6515('0x3f')]({},_0x1916cd,_0x30c5be['options']);var _0x20c2a7={'where':_0x1916cd[_0x6515('0x3c')]};return db[_0x6515('0x2b')][_0x6515('0x1b')](_0x20c2a7)[_0x6515('0x22')](function(_0x305744){_0x498aad[_0x6515('0x1b')]=_0x305744;if(_0x30c5be['query'][_0x6515('0x41')]){_0x1916cd[_0x6515('0x42')]=[{'all':!![]}];}return db[_0x6515('0x2b')][_0x6515('0x43')](_0x1916cd);})[_0x6515('0x22')](function(_0x56c69a){_0x498aad['rows']=_0x56c69a;return _0x498aad;})[_0x6515('0x22')](respondWithFilteredResult(_0x40a9ca,_0x1916cd))[_0x6515('0x44')](handleError(_0x40a9ca,null));};exports[_0x6515('0x45')]=function(_0x36907c,_0x5510e9){var _0x8477f3={'raw':!![],'where':{'id':_0x36907c['params']['id']}},_0x173400={};_0x173400[_0x6515('0x30')]=_[_0x6515('0x31')](db[_0x6515('0x2b')][_0x6515('0x2c')]);_0x173400[_0x6515('0x32')]=_[_0x6515('0x31')](_0x36907c[_0x6515('0x32')]);_0x173400['filters']=_[_0x6515('0x34')](_0x173400['model'],_0x173400[_0x6515('0x32')]);_0x8477f3[_0x6515('0x35')]=_[_0x6515('0x34')](_0x173400[_0x6515('0x30')],qs[_0x6515('0x36')](_0x36907c[_0x6515('0x32')]['fields']));_0x8477f3[_0x6515('0x35')]=_0x8477f3['attributes'][_0x6515('0x37')]?_0x8477f3['attributes']:_0x173400[_0x6515('0x30')];if(_0x36907c[_0x6515('0x32')][_0x6515('0x41')]){_0x8477f3[_0x6515('0x42')]=[{'all':!![]}];}_0x8477f3=_[_0x6515('0x3f')]({},_0x8477f3,_0x36907c[_0x6515('0x46')]);return db['OpenchannelApplication'][_0x6515('0x47')](_0x8477f3)['then'](handleEntityNotFound(_0x5510e9,null))[_0x6515('0x22')](respondWithResult(_0x5510e9,null))[_0x6515('0x44')](handleError(_0x5510e9,null));};exports['create']=function(_0x3cd9df,_0x409197){return db[_0x6515('0x2b')][_0x6515('0x48')](_0x3cd9df[_0x6515('0x49')],{})[_0x6515('0x22')](respondWithResult(_0x409197,0xc9))[_0x6515('0x44')](handleError(_0x409197,null));};exports[_0x6515('0x4a')]=function(_0xb531c8,_0x1e0ff7){if(_0xb531c8[_0x6515('0x49')]['id']){delete _0xb531c8[_0x6515('0x49')]['id'];}return db[_0x6515('0x2b')][_0x6515('0x47')]({'where':{'id':_0xb531c8[_0x6515('0x4b')]['id']}})[_0x6515('0x22')](handleEntityNotFound(_0x1e0ff7,null))['then'](saveUpdates(_0xb531c8['body'],null))[_0x6515('0x22')](respondWithResult(_0x1e0ff7,null))['catch'](handleError(_0x1e0ff7,null));};exports[_0x6515('0x23')]=function(_0x481d49,_0x35eedc){return db[_0x6515('0x2b')]['find']({'where':{'id':_0x481d49[_0x6515('0x4b')]['id']}})['then'](handleEntityNotFound(_0x35eedc,null))['then'](removeEntity(_0x35eedc,null))[_0x6515('0x44')](handleError(_0x35eedc,null));}; \ No newline at end of file +var _0x75c0=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','OpenchannelApplication','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','merge','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x51b888,_0x1cae84){var _0x31dacc=function(_0x10c4e9){while(--_0x10c4e9){_0x51b888['push'](_0x51b888['shift']());}};_0x31dacc(++_0x1cae84);}(_0x75c0,0x1ee));var _0x075c=function(_0x484671,_0x35bc7e){_0x484671=_0x484671-0x0;var _0xdf3c2a=_0x75c0[_0x484671];return _0xdf3c2a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x075c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x075c('0x1'));var jsonpatch=require(_0x075c('0x2'));var rp=require(_0x075c('0x3'));var moment=require('moment');var BPromise=require(_0x075c('0x4'));var Mustache=require('mustache');var util=require(_0x075c('0x5'));var path=require(_0x075c('0x6'));var sox=require(_0x075c('0x7'));var csv=require('to-csv');var ejs=require(_0x075c('0x8'));var fs=require('fs');var _=require(_0x075c('0x9'));var squel=require(_0x075c('0xa'));var crypto=require(_0x075c('0xb'));var jsforce=require(_0x075c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x075c('0xd'));var querystring=require(_0x075c('0xe'));var Papa=require(_0x075c('0xf'));var Redis=require(_0x075c('0x10'));var authService=require(_0x075c('0x11'));var qs=require(_0x075c('0x12'));var as=require(_0x075c('0x13'));var hardwareService=require(_0x075c('0x14'));var logger=require(_0x075c('0x15'))(_0x075c('0x16'));var utils=require(_0x075c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x075c('0x18'))['db'];function respondWithStatusCode(_0xb24091,_0x3fc948){_0x3fc948=_0x3fc948||0xcc;return function(_0x64334f){if(_0x64334f){return _0xb24091[_0x075c('0x19')](_0x3fc948);}return _0xb24091[_0x075c('0x1a')](_0x3fc948)['end']();};}function respondWithResult(_0x25a090,_0x4b46c7){_0x4b46c7=_0x4b46c7||0xc8;return function(_0x287b8b){if(_0x287b8b){return _0x25a090[_0x075c('0x1a')](_0x4b46c7)[_0x075c('0x1b')](_0x287b8b);}};}function respondWithFilteredResult(_0x2bc379,_0x12b0a0){return function(_0x298670){if(_0x298670){var _0x369aba=_0x298670[_0x075c('0x1c')],_0x57859c=_0x12b0a0[_0x075c('0x1d')],_0x101204=_0x12b0a0['offset']+_0x12b0a0[_0x075c('0x1e')],_0x48f688;if(_0x101204>=_0x369aba){_0x101204=_0x369aba;_0x48f688=0xc8;}else{_0x48f688=0xce;}_0x2bc379[_0x075c('0x1a')](_0x48f688);return _0x2bc379[_0x075c('0x1f')]('Content-Range',_0x57859c+'-'+_0x101204+'/'+_0x369aba)[_0x075c('0x1b')](_0x298670);}return null;};}function patchUpdates(_0x50ba8a){return function(_0x428fff){try{jsonpatch[_0x075c('0x20')](_0x428fff,_0x50ba8a,!![]);}catch(_0x4e8cef){return BPromise[_0x075c('0x21')](_0x4e8cef);}return _0x428fff[_0x075c('0x22')]();};}function saveUpdates(_0x51f588,_0x42f203){return function(_0x55d70b){if(_0x55d70b){return _0x55d70b[_0x075c('0x23')](_0x51f588)[_0x075c('0x24')](function(_0x14de1a){return _0x14de1a;});}return null;};}function removeEntity(_0xa7a7fd,_0x2e70d9){return function(_0xad73d5){if(_0xad73d5){return _0xad73d5[_0x075c('0x25')]()[_0x075c('0x24')](function(){_0xa7a7fd[_0x075c('0x1a')](0xcc)[_0x075c('0x26')]();});}};}function handleEntityNotFound(_0x33c206,_0x27ed56){return function(_0x483411){if(!_0x483411){_0x33c206[_0x075c('0x19')](0x194);}return _0x483411;};}function handleError(_0x759194,_0x36b804){_0x36b804=_0x36b804||0x1f4;return function(_0x38d3d7){logger[_0x075c('0x27')](_0x38d3d7[_0x075c('0x28')]);if(_0x38d3d7['name']){delete _0x38d3d7[_0x075c('0x29')];}_0x759194[_0x075c('0x1a')](_0x36b804)[_0x075c('0x2a')](_0x38d3d7);};}exports['index']=function(_0x5a2dba,_0x51fd9d){var _0xb273b9={},_0x3aab11={},_0x525fd2={'count':0x0,'rows':[]};var _0x399aed=_[_0x075c('0x2b')](db[_0x075c('0x2c')]['rawAttributes'],function(_0x3d935c){return{'name':_0x3d935c[_0x075c('0x2d')],'type':_0x3d935c[_0x075c('0x2e')][_0x075c('0x2f')]};});_0x3aab11['model']=_[_0x075c('0x2b')](_0x399aed,_0x075c('0x29'));_0x3aab11[_0x075c('0x30')]=_['keys'](_0x5a2dba[_0x075c('0x30')]);_0x3aab11['filters']=_[_0x075c('0x31')](_0x3aab11[_0x075c('0x32')],_0x3aab11['query']);_0xb273b9[_0x075c('0x33')]=_[_0x075c('0x31')](_0x3aab11[_0x075c('0x32')],qs[_0x075c('0x34')](_0x5a2dba[_0x075c('0x30')][_0x075c('0x34')]));_0xb273b9[_0x075c('0x33')]=_0xb273b9['attributes'][_0x075c('0x35')]?_0xb273b9[_0x075c('0x33')]:_0x3aab11['model'];if(!_0x5a2dba[_0x075c('0x30')][_0x075c('0x36')](_0x075c('0x37'))){_0xb273b9[_0x075c('0x1e')]=qs['limit'](_0x5a2dba['query'][_0x075c('0x1e')]);_0xb273b9[_0x075c('0x1d')]=qs[_0x075c('0x1d')](_0x5a2dba['query']['offset']);}_0xb273b9[_0x075c('0x38')]=qs[_0x075c('0x39')](_0x5a2dba[_0x075c('0x30')][_0x075c('0x39')]);_0xb273b9[_0x075c('0x3a')]=qs[_0x075c('0x3b')](_['pick'](_0x5a2dba[_0x075c('0x30')],_0x3aab11[_0x075c('0x3b')]),_0x399aed);if(_0x5a2dba[_0x075c('0x30')][_0x075c('0x3c')]){_0xb273b9[_0x075c('0x3a')]=_['merge'](_0xb273b9[_0x075c('0x3a')],{'$or':_[_0x075c('0x2b')](_0x399aed,function(_0x4a5ae8){if(_0x4a5ae8['type']!==_0x075c('0x3d')){var _0x12d882={};_0x12d882[_0x4a5ae8[_0x075c('0x29')]]={'$like':'%'+_0x5a2dba['query']['filter']+'%'};return _0x12d882;}})});}_0xb273b9=_['merge']({},_0xb273b9,_0x5a2dba[_0x075c('0x3e')]);var _0x4a86cd={'where':_0xb273b9[_0x075c('0x3a')]};return db['OpenchannelApplication'][_0x075c('0x1c')](_0x4a86cd)[_0x075c('0x24')](function(_0x5246de){_0x525fd2[_0x075c('0x1c')]=_0x5246de;if(_0x5a2dba[_0x075c('0x30')]['includeAll']){_0xb273b9[_0x075c('0x3f')]=[{'all':!![]}];}return db[_0x075c('0x2c')][_0x075c('0x40')](_0xb273b9);})[_0x075c('0x24')](function(_0x325a70){_0x525fd2[_0x075c('0x41')]=_0x325a70;return _0x525fd2;})[_0x075c('0x24')](respondWithFilteredResult(_0x51fd9d,_0xb273b9))[_0x075c('0x42')](handleError(_0x51fd9d,null));};exports['show']=function(_0x309387,_0x183b1e){var _0x37febe={'raw':!![],'where':{'id':_0x309387[_0x075c('0x43')]['id']}},_0xad18ec={};_0xad18ec['model']=_[_0x075c('0x44')](db['OpenchannelApplication']['rawAttributes']);_0xad18ec[_0x075c('0x30')]=_[_0x075c('0x44')](_0x309387[_0x075c('0x30')]);_0xad18ec[_0x075c('0x3b')]=_[_0x075c('0x31')](_0xad18ec['model'],_0xad18ec['query']);_0x37febe[_0x075c('0x33')]=_[_0x075c('0x31')](_0xad18ec[_0x075c('0x32')],qs['fields'](_0x309387['query'][_0x075c('0x34')]));_0x37febe[_0x075c('0x33')]=_0x37febe[_0x075c('0x33')][_0x075c('0x35')]?_0x37febe[_0x075c('0x33')]:_0xad18ec[_0x075c('0x32')];if(_0x309387[_0x075c('0x30')][_0x075c('0x45')]){_0x37febe[_0x075c('0x3f')]=[{'all':!![]}];}_0x37febe=_[_0x075c('0x46')]({},_0x37febe,_0x309387[_0x075c('0x3e')]);return db[_0x075c('0x2c')]['find'](_0x37febe)['then'](handleEntityNotFound(_0x183b1e,null))['then'](respondWithResult(_0x183b1e,null))['catch'](handleError(_0x183b1e,null));};exports[_0x075c('0x47')]=function(_0x3b11e5,_0x54a6af){return db[_0x075c('0x2c')][_0x075c('0x47')](_0x3b11e5[_0x075c('0x48')],{})[_0x075c('0x24')](respondWithResult(_0x54a6af,0xc9))[_0x075c('0x42')](handleError(_0x54a6af,null));};exports['update']=function(_0x3b8922,_0x3aed6d){if(_0x3b8922[_0x075c('0x48')]['id']){delete _0x3b8922[_0x075c('0x48')]['id'];}return db[_0x075c('0x2c')][_0x075c('0x49')]({'where':{'id':_0x3b8922[_0x075c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3aed6d,null))['then'](saveUpdates(_0x3b8922[_0x075c('0x48')],null))[_0x075c('0x24')](respondWithResult(_0x3aed6d,null))[_0x075c('0x42')](handleError(_0x3aed6d,null));};exports[_0x075c('0x25')]=function(_0x51689a,_0x33bb54){return db[_0x075c('0x2c')][_0x075c('0x49')]({'where':{'id':_0x51689a[_0x075c('0x43')]['id']}})['then'](handleEntityNotFound(_0x33bb54,null))[_0x075c('0x24')](removeEntity(_0x33bb54,null))[_0x075c('0x42')](handleError(_0x33bb54,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b5b14e6..e2d0419 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 _0xe36f=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x4a4ebd,_0x16921d){var _0x31687f=function(_0x37b283){while(--_0x37b283){_0x4a4ebd['push'](_0x4a4ebd['shift']());}};_0x31687f(++_0x16921d);}(_0xe36f,0x11d));var _0xfe36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe36f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe36('0x0'));var util=require('util');var logger=require(_0xfe36('0x1'))(_0xfe36('0x2'));var moment=require(_0xfe36('0x3'));var BPromise=require(_0xfe36('0x4'));var rp=require(_0xfe36('0x5'));var fs=require('fs');var path=require(_0xfe36('0x6'));var rimraf=require(_0xfe36('0x7'));var config=require(_0xfe36('0x8'));var attributes=require(_0xfe36('0x9'));module[_0xfe36('0xa')]=function(_0x5475fa,_0x1691a6){return _0x5475fa[_0xfe36('0xb')](_0xfe36('0xc'),attributes,{'tableName':_0xfe36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfe36('0xe')});}; \ No newline at end of file +var _0xd1e7=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications'];(function(_0x1964a7,_0x424061){var _0x11570a=function(_0x18c6e5){while(--_0x18c6e5){_0x1964a7['push'](_0x1964a7['shift']());}};_0x11570a(++_0x424061);}(_0xd1e7,0xf2));var _0x7d1e=function(_0x4c1c3a,_0x23ba5b){_0x4c1c3a=_0x4c1c3a-0x0;var _0x5534d5=_0xd1e7[_0x4c1c3a];return _0x5534d5;};'use strict';var _=require('lodash');var util=require(_0x7d1e('0x0'));var logger=require(_0x7d1e('0x1'))(_0x7d1e('0x2'));var moment=require(_0x7d1e('0x3'));var BPromise=require(_0x7d1e('0x4'));var rp=require(_0x7d1e('0x5'));var fs=require('fs');var path=require(_0x7d1e('0x6'));var rimraf=require(_0x7d1e('0x7'));var config=require(_0x7d1e('0x8'));var attributes=require(_0x7d1e('0x9'));module['exports']=function(_0x24d9a1,_0x486899){return _0x24d9a1[_0x7d1e('0xa')](_0x7d1e('0xb'),attributes,{'tableName':_0x7d1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d1e('0xd'),'collate':_0x7d1e('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e80a93e..66ab3bd 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x1ff804,_0x263135){var _0x3454b8=function(_0x5a95ec){while(--_0x5a95ec){_0x1ff804['push'](_0x1ff804['shift']());}};_0x3454b8(++_0x263135);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17f89e,_0x3d7847){_0x17f89e=_0x17f89e-0x0;var _0x309a2e=_0x5f2f[_0x17f89e];return _0x309a2e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x215cd8,_0x186835){var _0x52685b=function(_0x3c3117){while(--_0x3c3117){_0x215cd8['push'](_0x215cd8['shift']());}};_0x52685b(++_0x186835);}(_0xb10b,0x12a));var _0xbb10=function(_0x34a459,_0x136cd9){_0x34a459=_0x34a459-0x0;var _0x500f8b=_0xb10b[_0x34a459];return _0x500f8b;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3cd662b..fc3136d 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 _0x07dd=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','/:id','openchannelinteraction:update','update','delete','removeTags','exports'];(function(_0x51a40a,_0x1a777f){var _0x350d8c=function(_0x538c33){while(--_0x538c33){_0x51a40a['push'](_0x51a40a['shift']());}};_0x350d8c(++_0x1a777f);}(_0x07dd,0x1d1));var _0xd07d=function(_0x449d7e,_0x58eb85){_0x449d7e=_0x449d7e-0x0;var _0x3a1a26=_0x07dd[_0x449d7e];return _0x3a1a26;};'use strict';var multer=require(_0xd07d('0x0'));var util=require(_0xd07d('0x1'));var path=require(_0xd07d('0x2'));var timeout=require(_0xd07d('0x3'));var express=require(_0xd07d('0x4'));var router=express[_0xd07d('0x5')]();var auth=require(_0xd07d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd07d('0x7'));var controller=require(_0xd07d('0x8'));router[_0xd07d('0x9')]('/',auth[_0xd07d('0xa')](),controller[_0xd07d('0xb')]);router['get'](_0xd07d('0xc'),auth[_0xd07d('0xa')](),controller[_0xd07d('0xd')]);router[_0xd07d('0x9')]('/:id',auth[_0xd07d('0xa')](),controller[_0xd07d('0xe')]);router[_0xd07d('0x9')](_0xd07d('0xf'),auth['isAuthenticated'](),controller[_0xd07d('0x10')]);router['get'](_0xd07d('0x11'),auth[_0xd07d('0xa')](),controller[_0xd07d('0x12')]);router[_0xd07d('0x13')]('/',auth['isAuthenticated'](),controller[_0xd07d('0x14')]);router['post'](_0xd07d('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xd07d('0x15'),auth[_0xd07d('0xa')](),interaction[_0xd07d('0x16')](_0xd07d('0x17'),_0xd07d('0x18')),controller['addTags']);router['put'](_0xd07d('0x19'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xd07d('0x1a')),controller[_0xd07d('0x1b')]);router[_0xd07d('0x1c')]('/:id',auth[_0xd07d('0xa')](),interaction[_0xd07d('0x16')](_0xd07d('0x17'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xd07d('0x1c')](_0xd07d('0x15'),auth[_0xd07d('0xa')](),controller[_0xd07d('0x1d')]);module[_0xd07d('0x1e')]=router; \ No newline at end of file +var _0xaa63=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','index','get','/describe','isAuthenticated'];(function(_0x48197d,_0x4e7553){var _0x48d433=function(_0x28b414){while(--_0x28b414){_0x48197d['push'](_0x48197d['shift']());}};_0x48d433(++_0x4e7553);}(_0xaa63,0x148));var _0x3aa6=function(_0x4522b6,_0x5a9f00){_0x4522b6=_0x4522b6-0x0;var _0x2103cc=_0xaa63[_0x4522b6];return _0x2103cc;};'use strict';var multer=require(_0x3aa6('0x0'));var util=require(_0x3aa6('0x1'));var path=require(_0x3aa6('0x2'));var timeout=require(_0x3aa6('0x3'));var express=require('express');var router=express[_0x3aa6('0x4')]();var auth=require(_0x3aa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3aa6('0x6'));var controller=require(_0x3aa6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3aa6('0x8')]);router[_0x3aa6('0x9')](_0x3aa6('0xa'),auth[_0x3aa6('0xb')](),controller[_0x3aa6('0xc')]);router[_0x3aa6('0x9')](_0x3aa6('0xd'),auth[_0x3aa6('0xb')](),controller[_0x3aa6('0xe')]);router[_0x3aa6('0x9')](_0x3aa6('0xf'),auth['isAuthenticated'](),controller[_0x3aa6('0x10')]);router[_0x3aa6('0x9')](_0x3aa6('0x11'),auth[_0x3aa6('0xb')](),controller[_0x3aa6('0x12')]);router[_0x3aa6('0x13')]('/',auth['isAuthenticated'](),controller[_0x3aa6('0x14')]);router[_0x3aa6('0x13')]('/:id/messages',auth[_0x3aa6('0xb')](),controller[_0x3aa6('0x15')]);router[_0x3aa6('0x13')]('/:id/tags',auth[_0x3aa6('0xb')](),interaction[_0x3aa6('0x16')](_0x3aa6('0x17'),_0x3aa6('0x18')),controller[_0x3aa6('0x19')]);router[_0x3aa6('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x3aa6('0x16')](_0x3aa6('0x17'),_0x3aa6('0x1b')),controller[_0x3aa6('0x1c')]);router[_0x3aa6('0x1d')]('/:id',auth[_0x3aa6('0xb')](),interaction['tracked']('openchannel',_0x3aa6('0x1e')),controller[_0x3aa6('0x1f')]);router[_0x3aa6('0x1d')](_0x3aa6('0x20'),auth[_0x3aa6('0xb')](),controller[_0x3aa6('0x21')]);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 38ba87d..1efc4f0 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 _0x3b31=['sequelize','exports','STRING','DATE'];(function(_0x154522,_0x455fcd){var _0x2db040=function(_0x378998){while(--_0x378998){_0x154522['push'](_0x154522['shift']());}};_0x2db040(++_0x455fcd);}(_0x3b31,0x64));var _0x13b3=function(_0x140022,_0x579707){_0x140022=_0x140022-0x0;var _0xfe63df=_0x3b31[_0x140022];return _0xfe63df;};'use strict';var Sequelize=require(_0x13b3('0x0'));module[_0x13b3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x13b3('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x13b3('0x2')]},'read1stAt':{'type':Sequelize[_0x13b3('0x3')]},'threadId':{'type':Sequelize[_0x13b3('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x13b3('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x13b3('0x2')]}}; \ No newline at end of file +var _0x6fd3=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x468e61,_0xca964f){var _0xede777=function(_0x3c8d44){while(--_0x3c8d44){_0x468e61['push'](_0x468e61['shift']());}};_0xede777(++_0xca964f);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x20aa01,_0xe191bb){_0x20aa01=_0x20aa01-0x0;var _0x27a792=_0x6fd3[_0x20aa01];return _0x27a792;};'use strict';var Sequelize=require(_0x36fd('0x0'));module[_0x36fd('0x1')]={'closed':{'type':Sequelize[_0x36fd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x36fd('0x3')]},'disposition':{'type':Sequelize[_0x36fd('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x36fd('0x4')]},'note':{'type':Sequelize[_0x36fd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x36fd('0x4')]},'externalUrl':{'type':Sequelize[_0x36fd('0x4')]},'lastMsgAt':{'type':Sequelize[_0x36fd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x36fd('0x5')]('in',_0x36fd('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x36fd('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 4b897fe..6f1139d 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 _0x326f=['status','end','json','limit','apply','update','then','error','stack','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','OpenchannelAccountId','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','OpenchannelInteraction','rawAttributes','includeAll','include','options','create','params','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','secret','read','OpenchannelAccount','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','Owner','closed','closedAt','threadId','Private','pipe','createWriteStream','Attachment','basename','direction','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus'];(function(_0x20d0b9,_0x2f67c4){var _0xf4cdcc=function(_0xb80c85){while(--_0xb80c85){_0x20d0b9['push'](_0x20d0b9['shift']());}};_0xf4cdcc(++_0x2f67c4);}(_0x326f,0xd1));var _0xf326=function(_0x5dc2ba,_0x30a7c8){_0x5dc2ba=_0x5dc2ba-0x0;var _0x4636ad=_0x326f[_0x5dc2ba];return _0x4636ad;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];config[_0xf326('0x17')]=_[_0xf326('0x18')](config['redis'],{'host':_0xf326('0x19'),'port':0x18eb});var socket=require(_0xf326('0x1a'))(new Redis(config[_0xf326('0x17')]));require(_0xf326('0x1b'))['register'](socket);function respondWithStatusCode(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xcc;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1c')](_0x5204ee);}return _0x45c1b6[_0xf326('0x1d')](_0x5204ee)[_0xf326('0x1e')]();};}function respondWithResult(_0xa63d1a,_0x292f4b){_0x292f4b=_0x292f4b||0xc8;return function(_0x287a2a){if(_0x287a2a){return _0xa63d1a[_0xf326('0x1d')](_0x292f4b)[_0xf326('0x1f')](_0x287a2a);}};}function respondWithFilteredResult(_0x5a682a,_0x3ad7da){return function(_0x453100){if(_0x453100){var _0x18bee3=_0x453100['count'],_0x31ffb9=_0x3ad7da['offset'],_0xcef2b5=_0x3ad7da['offset']+_0x3ad7da[_0xf326('0x20')],_0x311af0;if(_0xcef2b5>=_0x18bee3){_0xcef2b5=_0x18bee3;_0x311af0=0xc8;}else{_0x311af0=0xce;}_0x5a682a[_0xf326('0x1d')](_0x311af0);return _0x5a682a['set']('Content-Range',_0x31ffb9+'-'+_0xcef2b5+'/'+_0x18bee3)[_0xf326('0x1f')](_0x453100);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x21')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x22')](_0x19b8ba)[_0xf326('0x23')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){_0x295752['status'](0xcc)[_0xf326('0x1e')]();});}};}function handleEntityNotFound(_0x1a2c4e,_0x2cd45a){return function(_0x1ff2b5){if(!_0x1ff2b5){_0x1a2c4e[_0xf326('0x1c')](0x194);}return _0x1ff2b5;};}function handleError(_0x410237,_0x5217d4){_0x5217d4=_0x5217d4||0x1f4;return function(_0x201d28){logger[_0xf326('0x24')](_0x201d28[_0xf326('0x25')]);if(_0x201d28['name']){delete _0x201d28[_0xf326('0x26')];}_0x410237['status'](_0x5217d4)['send'](_0x201d28);};}function getInteractionUsers(_0x6a8e89,_0x1ae23a){return new BPromise(function(_0x2fa28e,_0x5dbe63){try{if(_0x1ae23a[_0x6a8e89['id']]){_0x6a8e89[_0xf326('0x27')]=_[_0xf326('0x28')](_0x1ae23a[_0x6a8e89['id']],function(_0x55790d){return{'id':_0x55790d['id'],'fullname':_0x55790d[_0xf326('0x29')]};});}}catch(_0x119ab8){_0x5dbe63(_0x119ab8);}_0x2fa28e(_0x6a8e89);});}function getInteractionTags(_0xd77aba,_0x18d110){return new BPromise(function(_0xa80156,_0x269be9){try{if(_0xd77aba[_0xf326('0x2a')]){_0xd77aba[_0xf326('0x2b')]=[];_0xd77aba[_0xf326('0x2a')][_0xf326('0x2c')](',')['forEach'](function(_0x1035ed){_0xd77aba[_0xf326('0x2b')][_0xf326('0x2d')](_0x18d110[_0x1035ed]);});}delete _0xd77aba['TagIds'];}catch(_0x2c0cac){_0x269be9(_0x2c0cac);}_0xa80156(_0xd77aba);});}function updateOpenchannelInteraction(_0x1721fd,_0x303dc6,_0x4df451){return new BPromise(function(_0x5b101d,_0x2b8b31){return getInteractionUsers(_0x1721fd,_0x4df451)[_0xf326('0x23')](function(_0x9c3039){return getInteractionTags(_0x9c3039,_0x303dc6);})[_0xf326('0x23')](function(_0x30694f){_0x5b101d(_0x30694f);})[_0xf326('0x2e')](function(_0x62585a){_0x2b8b31(_0x62585a);});});}exports[_0xf326('0x2f')]=function(_0x580374,_0x461e93){var _0x1981bc={},_0x51207a={},_0x4083a2={'count':0x0,'rows':[]};var _0x4e5d7c=_[_0xf326('0x28')](db['OpenchannelInteraction']['rawAttributes'],function(_0xadb020){return{'name':_0xadb020['fieldName'],'type':_0xadb020[_0xf326('0x30')]['key']};});_0x51207a[_0xf326('0x31')]=_[_0xf326('0x28')](_0x4e5d7c,_0xf326('0x26'));_0x51207a['query']=_[_0xf326('0x32')](_0x580374[_0xf326('0x33')]);_0x51207a['filters']=_[_0xf326('0x34')](_0x51207a[_0xf326('0x31')],_0x51207a[_0xf326('0x33')]);_0x1981bc[_0xf326('0x35')]=_['intersection'](_0x51207a[_0xf326('0x31')],qs[_0xf326('0x36')](_0x580374[_0xf326('0x33')][_0xf326('0x36')]));_0x1981bc[_0xf326('0x35')]=_0x1981bc['attributes'][_0xf326('0x37')]?_0x1981bc[_0xf326('0x35')]:_0x51207a['model'];if(!_0x580374['query'][_0xf326('0x38')]('nolimit')){_0x1981bc['limit']=qs[_0xf326('0x20')](_0x580374['query'][_0xf326('0x20')]);_0x1981bc[_0xf326('0x39')]=qs[_0xf326('0x39')](_0x580374[_0xf326('0x33')]['offset']);}_0x1981bc[_0xf326('0x3a')]=qs[_0xf326('0x3b')](_0x580374[_0xf326('0x33')][_0xf326('0x3b')]);_0x1981bc[_0xf326('0x3c')]=qs[_0xf326('0x3d')](_[_0xf326('0x3e')](_0x580374[_0xf326('0x33')],_0x51207a[_0xf326('0x3d')]),_0x4e5d7c);var _0x1227d3=[];var _0x361776=squel[_0xf326('0x3f')]()['field']('id')[_0xf326('0x40')](_0xf326('0x26'))[_0xf326('0x40')](_0xf326('0x41'))[_0xf326('0x42')](_0xf326('0x43'));var _0x4f4c51=squel[_0xf326('0x3f')]()[_0xf326('0x40')]('u.id')[_0xf326('0x40')](_0xf326('0x44'))[_0xf326('0x40')](_0xf326('0x45'))[_0xf326('0x42')]('user_has_openchannel_interactions','ui')['left_join'](_0xf326('0x46'),'u',_0xf326('0x47'));var _0x5ed62e=squel['select']()[_0xf326('0x42')](_0xf326('0x48'),'i')[_0xf326('0x49')]('cm_contacts','c',_0xf326('0x4a'))[_0xf326('0x49')](_0xf326('0x46'),'o',_0xf326('0x4b'))[_0xf326('0x49')](_0xf326('0x4c'),'a',_0xf326('0x4d'))[_0xf326('0x49')](_0xf326('0x4e'),'me',_0xf326('0x4f'))[_0xf326('0x49')](_0xf326('0x50'),'it',_0xf326('0x51'))[_0xf326('0x49')](_0xf326('0x43'),'t','t.id\x20=\x20it.TagId');var _0x199f8b=squel[_0xf326('0x52')]();var _0x6c55a0=[];var _0x28dde6=squel['expr']();var _0x10f437;if(_0x580374[_0xf326('0x33')][_0xf326('0x53')]){_0x10f437=as[_0xf326('0x54')](_0x580374['query'][_0xf326('0x53')]);var _0x1967ab=_0x10f437[_0xf326('0x55')];for(var _0x451ac7=0x0;_0x451ac7<_0x10f437[_0xf326('0x56')]['length'];_0x451ac7++){var _0x5d312d=_0x10f437[_0xf326('0x56')][_0x451ac7];var _0x38ff64='i';var _0x2ff126=_['find'](_0x4e5d7c,[_0xf326('0x26'),_0x5d312d[_0xf326('0x40')]]);if(!_0x2ff126){switch(_0x5d312d[_0xf326('0x40')]){case'unreadMessages':if(_0x5d312d['value']==0x1){_0x5ed62e[_0xf326('0x57')]('`'+_0x5d312d['field']+_0xf326('0x58'));}else{_0x5ed62e['having']('`'+_0x5d312d[_0xf326('0x40')]+_0xf326('0x59'));}break;case _0xf326('0x5a'):if(_0x5d312d[_0xf326('0x5b')]===_0xf326('0x5c')){if(_0x5d312d[_0xf326('0x5d')][_0xf326('0x2c')]('\x20')['length']>0x1){_0x199f8b[_0x1967ab](_0xf326('0x5e'),qs[_0xf326('0x5f')](_0x5d312d[_0xf326('0x5d')]),null);}else{var _0x4b0d8e='%'+_0x5d312d[_0xf326('0x5d')]+'%';_0x199f8b[_0x1967ab](_0xf326('0x60'),_0x4b0d8e,_0x4b0d8e,_0x4b0d8e);}}else{_0x2ff126=_[_0xf326('0x61')](_0x4e5d7c,[_0xf326('0x26'),_0xf326('0x62')]);_0x5d312d['field']=_0xf326('0x62');_0x3aeb20=as[_0xf326('0x63')](_0x38ff64,_0x2ff126[_0xf326('0x30')],_0x5d312d);_0x199f8b[_0x1967ab](_0x3aeb20[_0xf326('0x64')],_0x3aeb20['value'][_0xf326('0x65')],_0x3aeb20[_0xf326('0x5d')][_0xf326('0x1e')]);}break;case _0xf326('0x66'):var _0x4d3b9e=_0x5d312d['value'][_0xf326('0x2c')](',')[_0xf326('0x28')](function(_0x55ca96){return Number(_0x55ca96);});_0x4d3b9e[_0xf326('0x67')](function(_0x29de71){_0x28dde6['or'](_0xf326('0x68'),'%,'+_0x29de71+',%');});_0x6c55a0=_[_0xf326('0x69')](_0x6c55a0,_0x4d3b9e);break;case'User':if(_0x5d312d[_0xf326('0x5b')]==='$substring'){_0x199f8b[_0x1967ab]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5d312d[_0xf326('0x5d')]+'%',null);}else{_0x2ff126=_['find'](_0x4e5d7c,[_0xf326('0x26'),_0xf326('0x6a')]);_0x5d312d[_0xf326('0x40')]='UserId';_0x3aeb20=as['buildExpression'](_0x38ff64,_0x2ff126[_0xf326('0x30')],_0x5d312d);_0x199f8b[_0x1967ab](_0x3aeb20[_0xf326('0x64')],_0x3aeb20[_0xf326('0x5d')]['start'],_0x3aeb20[_0xf326('0x5d')]['end']);}break;case _0xf326('0x6b'):_0x3aeb20=as[_0xf326('0x63')]('me',null,_0x5d312d);_0x199f8b[_0x1967ab](_0x3aeb20[_0xf326('0x64')],_0x3aeb20[_0xf326('0x5d')][_0xf326('0x65')],_0x3aeb20[_0xf326('0x5d')][_0xf326('0x1e')]);break;}}else{var _0x3aeb20=as[_0xf326('0x63')](_0x38ff64,_0x2ff126[_0xf326('0x30')],_0x5d312d);_0x199f8b[_0x1967ab](_0x3aeb20[_0xf326('0x64')],_0x3aeb20[_0xf326('0x5d')][_0xf326('0x65')],_0x3aeb20['value'][_0xf326('0x1e')]);}}}else{var _0x5ae666=_(_0x580374[_0xf326('0x33')])[_0xf326('0x32')]()['map'](function(_0x2b770c){return _['some'](_0x4e5d7c,[_0xf326('0x26'),_0x2b770c])?_0x2b770c:undefined;})[_0xf326('0x6c')]()[_0xf326('0x5d')]();if(!_[_0xf326('0x6d')](_0x5ae666)){_0x5ae666[_0xf326('0x67')](function(_0x51ff5e){if(_0x51ff5e==='OpenchannelAccountId'){_0x5ed62e[_0xf326('0x3c')](_0xf326('0x6e'),[][_0xf326('0x6f')](_0x580374[_0xf326('0x33')][_0x51ff5e]));}else if(_0x51ff5e===_0xf326('0x70')){var _0x579d2c=JSON[_0xf326('0x71')](_0x580374[_0xf326('0x33')][_0x51ff5e])['$gte'];var _0x50319a=JSON['parse'](_0x580374[_0xf326('0x33')][_0x51ff5e])[_0xf326('0x72')];_0x5ed62e[_0xf326('0x3c')](_0xf326('0x73'),_0x579d2c,_0x50319a);}else{if(_0x580374[_0xf326('0x33')][_0x51ff5e]===_0xf326('0x74')){_0x5ed62e[_0xf326('0x3c')]('i.'+_0x51ff5e+'\x20IS\x20NULL');}else{_0x5ed62e[_0xf326('0x3c')]('i.'+_0x51ff5e+_0xf326('0x75'),_0x580374[_0xf326('0x33')][_0x51ff5e]);}}});}if(_0x580374[_0xf326('0x33')]['read']){if(_0x580374[_0xf326('0x33')]['read']==0x1){_0x5ed62e['having'](_0xf326('0x76'));}else{_0x5ed62e['having'](_0xf326('0x77'));}}if(_0x580374[_0xf326('0x33')][_0xf326('0x78')]){_0x6c55a0=_[_0xf326('0x79')](_0x580374[_0xf326('0x33')]['tag'])?_0x580374['query']['tag']:new Array(_0x580374[_0xf326('0x33')][_0xf326('0x78')]);_0x6c55a0[_0xf326('0x67')](function(_0x180616){_0x28dde6['or'](_0xf326('0x68'),'%,'+_0x180616+',%');});}if(_0x580374['query'][_0xf326('0x7a')]){var _0x372dc8=_0x580374[_0xf326('0x33')]['filter']['replace']('\x5c','\x5c\x5c')[_0xf326('0x7b')](/'/g,'\x27\x27');if(qs[_0xf326('0x7c')](_0x372dc8)){_0x199f8b['or']('i.id\x20LIKE\x20?',_0x372dc8+'%');}else{_0x199f8b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf326('0x5f')](_0x372dc8))['or']('i.from\x20LIKE\x20?',_0x372dc8+'%')['or'](_0xf326('0x7d'),_0x372dc8+'%');}}}_0x5ed62e['where'](_0x199f8b);_0x5ed62e['group']('i.id');var _0x1bb63e={'type':db[_0xf326('0x7e')][_0xf326('0x7f')]['SELECT'],'raw':!![]};var _0x1cf9a8=_0x5ed62e[_0xf326('0x80')]();_0x1cf9a8[_0xf326('0x40')](_0xf326('0x81'));_0x1cf9a8[_0xf326('0x40')](_0xf326('0x82'),_0xf326('0x83'));if(_0x1981bc[_0xf326('0x3a')]){_0x1981bc[_0xf326('0x3a')]['forEach'](function(_0x34c3cf){var _0x5b1494=_0x34c3cf[0x0]===_0xf326('0x84')?_0x34c3cf[0x0]:'i.'+_0x34c3cf[0x0];_0x5ed62e[_0xf326('0x3a')](_0x5b1494,_0x34c3cf[0x1]===_0xf326('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x6c55a0)){_0x5ed62e[_0xf326('0x57')](_0x28dde6);_0x1cf9a8[_0xf326('0x3c')](_0xf326('0x86'),_0x6c55a0);}BPromise['resolve']()[_0xf326('0x23')](function(){if(!_0x10f437){if(_0x580374[_0xf326('0x33')][_0xf326('0x87')])return;_0x1cf9a8[_0xf326('0x3c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x5ed62e[_0xf326('0x3c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x580374['user'][_0xf326('0x88')]!==_0xf326('0x89'))return;return _0x580374['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2bd990){if(_['isEmpty'](_0x2bd990)){_0x1cf9a8[_0xf326('0x3c')](_0xf326('0x8a'));_0x5ed62e[_0xf326('0x3c')](_0xf326('0x8a'));}else{_0x1cf9a8[_0xf326('0x3c')](_0xf326('0x6e'),_['map'](_0x2bd990,'id'));_0x5ed62e[_0xf326('0x3c')](_0xf326('0x6e'),_['map'](_0x2bd990,'id'));}});})['then'](function(){if(_0x580374[_0xf326('0x8b')]['role']===_0xf326('0x89')&&!_0x10f437&&!_0x580374[_0xf326('0x33')][_0xf326('0x87')])return[];return db[_0xf326('0x8c')][_0xf326('0x33')](_0x1cf9a8[_0xf326('0x8d')](),_0x1bb63e);})[_0xf326('0x23')](function(_0x8ca46f){_0x4083a2[_0xf326('0x8e')]=_0x8ca46f['length'];if(_0x4083a2[_0xf326('0x8e')]===0x0)return[];return db[_0xf326('0x8c')]['query'](_0x361776[_0xf326('0x8d')](),_0x1bb63e)['then'](function(_0x28763a){_0x1227d3=_[_0xf326('0x8f')](_0x28763a,'id');_0x1bb63e=_[_0xf326('0x90')](_0x1bb63e,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x580374[_0xf326('0x33')][_0xf326('0x36')]){_0x1981bc[_0xf326('0x35')][_0xf326('0x67')](function(_0x30e096){_0x5ed62e[_0xf326('0x40')]('i.'+_0x30e096);});}else{_0x5ed62e[_0xf326('0x40')](_0xf326('0x82'),_0xf326('0x83'));_0x5ed62e[_0xf326('0x40')](_0xf326('0x91'),_0xf326('0x92'));_0x5ed62e[_0xf326('0x40')](_0xf326('0x93'),_0xf326('0x94'));_0x5ed62e['field'](_0xf326('0x95'),_0xf326('0x84'));_0x5ed62e['field'](_0xf326('0x96'));_0x5ed62e[_0xf326('0x40')]('c.firstName',_0xf326('0x97'));_0x5ed62e[_0xf326('0x40')](_0xf326('0x98'),_0xf326('0x99'));_0x5ed62e[_0xf326('0x40')](_0xf326('0x9a'),_0xf326('0x9b'));_0x5ed62e['field'](_0xf326('0x9c'),_0xf326('0x9d'));_0x5ed62e[_0xf326('0x40')](_0xf326('0x9e'),_0xf326('0x9f'));_0x5ed62e[_0xf326('0x40')](_0xf326('0xa0'),_0xf326('0xa1'));_0x5ed62e['field'](_0xf326('0xa2'),_0xf326('0xa3'));_0x5ed62e['field'](_0xf326('0xa4'),'Owner.internal');_0x5ed62e[_0xf326('0x40')](_0xf326('0xa5'),_0xf326('0x2a'));}if(_0x1981bc[_0xf326('0x20')])_0x5ed62e[_0xf326('0x20')](_0x1981bc[_0xf326('0x20')]);if(_0x1981bc[_0xf326('0x39')])_0x5ed62e[_0xf326('0x39')](_0x1981bc[_0xf326('0x39')]);return db[_0xf326('0x8c')][_0xf326('0x33')](_0x5ed62e[_0xf326('0x8d')](),_0x1bb63e);})[_0xf326('0x23')](function(_0x274ad0){_0x4f4c51['where'](_0xf326('0xa6'),_[_0xf326('0x28')](_0x274ad0,'id'));return db[_0xf326('0x8c')][_0xf326('0x33')](_0x4f4c51[_0xf326('0x8d')](),_0x1bb63e)['then'](function(_0x1ec128){var _0x1b6a15=_[_0xf326('0xa7')](_0x1ec128,_0xf326('0xa8'));var _0x127be1=[];_0x274ad0['forEach'](function(_0x4b6ec0){_0x127be1[_0xf326('0x2d')](updateOpenchannelInteraction(_0x4b6ec0,_0x1227d3,_0x1b6a15));});return BPromise['all'](_0x127be1);});});})[_0xf326('0x23')](function(_0x143965){_0x4083a2[_0xf326('0xa9')]=_0x143965;return _0x4083a2;})['then'](respondWithFilteredResult(_0x461e93,_0x1981bc))['catch'](handleError(_0x461e93,null));};exports[_0xf326('0xaa')]=function(_0x2d92e4,_0x167ac9){var _0x34870c={};if(_0x2d92e4[_0xf326('0x33')]['type']&&_0x2d92e4[_0xf326('0x33')][_0xf326('0x30')]===_0xf326('0x42')){_0x34870c['from']=_0x2d92e4['params']['id'];}else{_0x34870c['id']=_0x2d92e4['params']['id'];}var _0x9afd56={'raw':![],'where':_0x34870c},_0x17c96c={};_0x17c96c[_0xf326('0x31')]=_[_0xf326('0x32')](db[_0xf326('0xab')][_0xf326('0xac')]);_0x17c96c[_0xf326('0x33')]=_['keys'](_0x2d92e4['query']);_0x17c96c[_0xf326('0x3d')]=_[_0xf326('0x34')](_0x17c96c[_0xf326('0x31')],_0x17c96c['query']);_0x9afd56[_0xf326('0x35')]=_[_0xf326('0x34')](_0x17c96c[_0xf326('0x31')],qs['fields'](_0x2d92e4[_0xf326('0x33')][_0xf326('0x36')]));_0x9afd56[_0xf326('0x35')]=_0x9afd56[_0xf326('0x35')]['length']?_0x9afd56['attributes']:_0x17c96c['model'];if(_0x2d92e4[_0xf326('0x33')][_0xf326('0xad')]){_0x9afd56[_0xf326('0xae')]=[{'all':!![]}];}_0x9afd56=_['merge']({},_0x9afd56,_0x2d92e4[_0xf326('0xaf')]);return db[_0xf326('0xab')][_0xf326('0x61')](_0x9afd56)['then'](handleEntityNotFound(_0x167ac9,null))[_0xf326('0x23')](respondWithResult(_0x167ac9,null))[_0xf326('0x2e')](handleError(_0x167ac9,null));};exports[_0xf326('0xb0')]=function(_0x218553,_0x500011){return db[_0xf326('0xab')]['create'](_0x218553[_0xf326('0x6b')],{})[_0xf326('0x23')](respondWithResult(_0x500011,0xc9))[_0xf326('0x2e')](handleError(_0x500011,null));};exports[_0xf326('0x22')]=function(_0x547fe9,_0x2e2f70){if(_0x547fe9['body']['id']){delete _0x547fe9[_0xf326('0x6b')]['id'];}return db[_0xf326('0xab')][_0xf326('0x61')]({'where':{'id':_0x547fe9[_0xf326('0xb1')]['id']}})[_0xf326('0x23')](handleEntityNotFound(_0x2e2f70,null))['then'](saveUpdates(_0x547fe9['body'],null))[_0xf326('0x23')](respondWithResult(_0x2e2f70,null))[_0xf326('0x2e')](handleError(_0x2e2f70,null));};exports[_0xf326('0xb2')]=function(_0xc67315,_0x55c2f8){return db[_0xf326('0xab')]['find']({'where':{'id':_0xc67315[_0xf326('0xb1')]['id']}})[_0xf326('0x23')](handleEntityNotFound(_0x55c2f8,null))[_0xf326('0x23')](removeEntity(_0x55c2f8,null))['catch'](handleError(_0x55c2f8,null));};exports[_0xf326('0xb3')]=function(_0x42bbd7,_0x866c2){return db[_0xf326('0xab')][_0xf326('0xb3')]()['then'](respondWithResult(_0x866c2,null))[_0xf326('0x2e')](handleError(_0x866c2,null));};exports[_0xf326('0xb4')]=function(_0x53348c,_0x40cea4,_0x2ecb04){return db[_0xf326('0xb5')][_0xf326('0x61')]({'where':{'id':_0x53348c['params']['id']}})['then'](handleEntityNotFound(_0x40cea4,null))[_0xf326('0x23')](function(_0x40e683){if(_0x40e683){return _0x40e683['addMessage'](_0x53348c[_0xf326('0x6b')]['ids'],_['omit'](_0x53348c[_0xf326('0x6b')],[_0xf326('0xb6'),'id'])||{});}})[_0xf326('0x23')](respondWithResult(_0x40cea4,null))[_0xf326('0x2e')](handleError(_0x40cea4,null));};exports[_0xf326('0xb7')]=function(_0xdfae35,_0xf5440,_0x467563){var _0xc9dead={'raw':![],'where':{}};var _0x5c6179={};var _0x28a0d1={'count':0x0,'rows':[]};return db[_0xf326('0xab')][_0xf326('0xb8')]({'where':{'id':_0xdfae35[_0xf326('0xb1')]['id']}})['then'](handleEntityNotFound(_0xf5440,null))[_0xf326('0x23')](function(_0x20020c){if(_0x20020c){_0x5c6179[_0xf326('0x31')]=_[_0xf326('0x32')](db[_0xf326('0xb5')]['rawAttributes']);_0x5c6179[_0xf326('0x33')]=_['keys'](_0xdfae35[_0xf326('0x33')]);_0x5c6179[_0xf326('0x3d')]=_[_0xf326('0x34')](_0x5c6179[_0xf326('0x31')],_0x5c6179['query']);_0xc9dead[_0xf326('0x35')]=_[_0xf326('0x34')](_0x5c6179[_0xf326('0x31')],qs['fields'](_0xdfae35[_0xf326('0x33')][_0xf326('0x36')]));_0xc9dead[_0xf326('0x35')]=_0xc9dead[_0xf326('0x35')]['length']?_0xc9dead[_0xf326('0x35')]:_0x5c6179[_0xf326('0x31')];if(!_0xdfae35[_0xf326('0x33')][_0xf326('0x38')]('nolimit')){_0xc9dead[_0xf326('0x20')]=qs[_0xf326('0x20')](_0xdfae35[_0xf326('0x33')]['limit']);_0xc9dead[_0xf326('0x39')]=qs[_0xf326('0x39')](_0xdfae35['query'][_0xf326('0x39')]);}_0xc9dead[_0xf326('0x3a')]=qs[_0xf326('0x3b')](_0xdfae35[_0xf326('0x33')][_0xf326('0x3b')]);_0xc9dead[_0xf326('0x3c')]=qs['filters'](_['pick'](_0xdfae35[_0xf326('0x33')],_0x5c6179[_0xf326('0x3d')]));_0xc9dead[_0xf326('0x3c')][_0xf326('0xa8')]=_0x20020c['id'];if(_0xdfae35[_0xf326('0x33')][_0xf326('0x7a')]){_0xc9dead['where']=_[_0xf326('0x90')](_0xc9dead[_0xf326('0x3c')],{'$or':_[_0xf326('0x28')](_0xc9dead[_0xf326('0x35')],function(_0x50d506){var _0x204077={};_0x204077[_0x50d506]={'$like':'%'+_0xdfae35[_0xf326('0x33')][_0xf326('0x7a')]+'%'};return _0x204077;})});}if(_0xdfae35[_0xf326('0x33')]['$gte']){var _0x3ca75e=_0xdfae35['query']['$gte'][_0xf326('0x2c')](',');var _0x549a1f={};_0x549a1f[_0x3ca75e[0x0]]={'$gte':moment(_0x3ca75e[0x1])[_0xf326('0xb9')](_0xf326('0xba'))};_0xc9dead[_0xf326('0x3c')]=_[_0xf326('0x90')](_0xc9dead[_0xf326('0x3c')],_0x549a1f);}_0xc9dead=_[_0xf326('0x90')]({},_0xc9dead,_0xdfae35[_0xf326('0xaf')]);return db[_0xf326('0xb5')][_0xf326('0x8e')]({'where':_0xc9dead[_0xf326('0x3c')]})[_0xf326('0x23')](function(_0x4371f7){_0x28a0d1['count']=_0x4371f7;if(_0xdfae35[_0xf326('0x33')][_0xf326('0xad')]){_0xc9dead[_0xf326('0xae')]=[{'all':!![]}];}return db[_0xf326('0xb5')][_0xf326('0xbb')](_0xc9dead);})[_0xf326('0x23')](function(_0x1ba5a4){_0x28a0d1['rows']=_0x1ba5a4;return _0x28a0d1;});}})[_0xf326('0x23')](respondWithFilteredResult(_0xf5440,_0xc9dead))[_0xf326('0x2e')](handleError(_0xf5440,null));};exports[_0xf326('0xbc')]=function(_0x316877,_0x79faa1,_0x14259b){return db[_0xf326('0xab')]['find']({'where':{'id':_0x316877[_0xf326('0xb1')]['id']}})[_0xf326('0x23')](handleEntityNotFound(_0x79faa1,null))[_0xf326('0x23')](function(_0x9a0455){if(_0x9a0455){return _0x9a0455[_0xf326('0xbd')](_0x316877[_0xf326('0x6b')][_0xf326('0xb6')],_[_0xf326('0xbe')](_0x316877[_0xf326('0x6b')],[_0xf326('0xb6'),'id'])||{})[_0xf326('0xbf')](function(){return db[_0xf326('0x66')]['findAll']({'attributes':['id',_0xf326('0x26'),_0xf326('0x41')],'where':{'id':_0x316877[_0xf326('0x6b')]['ids']}});})['then'](function(_0x354338){socket[_0xf326('0xc0')](_0xf326('0xc1'),{'id':Number(_0x316877[_0xf326('0xb1')]['id']),'tags':_0x354338||[]});return{'id':Number(_0x316877['params']['id']),'tags':_0x354338||[]};});}})[_0xf326('0x23')](respondWithResult(_0x79faa1,null))[_0xf326('0x2e')](handleError(_0x79faa1,null));};exports[_0xf326('0xc2')]=function(_0x5a7164,_0x48bc4d,_0x510b4b){return db[_0xf326('0xab')][_0xf326('0x61')]({'where':{'id':_0x5a7164[_0xf326('0xb1')]['id']}})['then'](handleEntityNotFound(_0x48bc4d,null))[_0xf326('0x23')](function(_0x513fd8){if(_0x513fd8){return _0x513fd8[_0xf326('0xc2')](_0x5a7164['query'][_0xf326('0xb6')]);}})[_0xf326('0x23')](respondWithStatusCode(_0x48bc4d,null))[_0xf326('0x2e')](handleError(_0x48bc4d,null));};exports[_0xf326('0xc3')]=function(_0x435692,_0x3dcaf9){var _0x1f05a2=moment()[_0xf326('0xc4')]()[_0xf326('0x8d')]();var _0x21c576=path[_0xf326('0xc5')](config[_0xf326('0xc6')],_0xf326('0xc7'),_0xf326('0xc8'),'tmp');var _0x2e3517=path[_0xf326('0xc5')](config[_0xf326('0xc6')],'server','files','attachments');var _0x3fc996=path[_0xf326('0xc5')](_0x21c576,_0x1f05a2);var _0x29f0bc=util[_0xf326('0xb9')](_0xf326('0xc9'),_0x435692[_0xf326('0xb1')]['id'],_0x1f05a2);var _0x4fa367=path[_0xf326('0xc5')](_0x21c576,_0x29f0bc);var _0x13b421=[];_0x13b421[_0xf326('0x2d')]({'model':db[_0xf326('0xca')],'as':_0xf326('0xca'),'attributes':['id','fullname'],'raw':!![]});_0x13b421[_0xf326('0x2d')]({'model':db[_0xf326('0xcb')],'as':_0xf326('0x5a'),'attributes':['id',_0xf326('0xcc'),_0xf326('0xcd')],'raw':!![]});if(_0x435692['query']['attachments']){_0x13b421[_0xf326('0x2d')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x78e7b0=[{'model':db[_0xf326('0xb5')],'as':_0xf326('0xce'),'attributes':['id',_0xf326('0x6b'),_0xf326('0x70'),'direction',_0xf326('0xcf'),_0xf326('0xd0')],'include':_0x13b421}];_0x78e7b0[_0xf326('0x2d')]({'model':db[_0xf326('0xd1')],'as':'Account','attributes':['id',_0xf326('0x26')]});_0x78e7b0['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xf326('0x29')]});return db[_0xf326('0xab')][_0xf326('0x61')]({'where':{'id':_0x435692[_0xf326('0xb1')]['id']},'include':_0x78e7b0})[_0xf326('0x23')](handleEntityNotFound(_0x3dcaf9,null))[_0xf326('0x23')](function(_0x3bca4e){if(_0x3bca4e){var _0x3833f9=_0x3bca4e[_0xf326('0xd2')]({'plain':!![]});fs[_0xf326('0xd3')](_0x3fc996);var _0xb4b180={'format':'A4','border':'10px','header':{'height':_0xf326('0xd4'),'contents':{'first':_0xf326('0xd5')}},'footer':{'height':_0xf326('0xd6'),'contents':{'default':util[_0xf326('0xb9')](_0xf326('0xd7'),util[_0xf326('0xb9')](_0xf326('0xd8'),_0xf326('0xd9'),_0x3833f9['id']),moment()[_0xf326('0xb9')]('YYYY-MM-DD')[_0xf326('0x8d')]())}}};var _0x3c7e4a={'channel':_0xf326('0xd9'),'account':_0x3833f9['Account']['name'],'agent':_0x3833f9[_0xf326('0xda')]?_0x3833f9[_0xf326('0xda')]['fullname']:'N.A.','createdAt':moment(_0x3833f9[_0xf326('0x70')])['format'](_0xf326('0xba'))['toString'](),'closedAt':_0x3833f9[_0xf326('0xdb')]?moment(_0x3833f9[_0xf326('0xdc')])[_0xf326('0xb9')](_0xf326('0xba'))[_0xf326('0x8d')]():'','disposition':_0x3833f9['disposition'],'visibility':_0x3833f9[_0xf326('0xdd')]?'Public':_0xf326('0xde'),'messages':_(_0x3833f9[_0xf326('0xce')])[_0xf326('0x7a')]({'secret':![]})[_0xf326('0x28')](function(_0x76ad63){if(_0x76ad63['Attachment']){var _0x4ecacc=path[_0xf326('0xc5')](_0x2e3517,_0x76ad63['Attachment']['basename']);if(fs['existsSync'](_0x4ecacc)){fs['createReadStream'](_0x4ecacc)[_0xf326('0xdf')](fs[_0xf326('0xe0')](path[_0xf326('0xc5')](_0x3fc996,_0x76ad63[_0xf326('0xe1')][_0xf326('0xe2')])));}}return{'date':moment(_0x76ad63[_0xf326('0x70')])[_0xf326('0xb9')](_0xf326('0xba'))[_0xf326('0x8d')](),'sender':_0x76ad63[_0xf326('0xe3')]===_0xf326('0xe4')?_0x76ad63['User']?_0x76ad63[_0xf326('0xca')][_0xf326('0x29')]:_0xf326('0xe5'):_0x76ad63[_0xf326('0x5a')][_0xf326('0xcc')]+(_0x76ad63[_0xf326('0x5a')][_0xf326('0xcd')]?'\x20'+_0x76ad63[_0xf326('0x5a')][_0xf326('0xcd')]:''),'body':_0x76ad63['Attachment']?_0x76ad63[_0xf326('0xe1')]['basename']:_0x76ad63[_0xf326('0x6b')],'direction':_0x76ad63['direction']==='out'?'A':'C','secret':_0x76ad63[_0xf326('0xcf')],'read':_0x76ad63['read'],'attachment':_0x76ad63[_0xf326('0xe1')]};})[_0xf326('0x5d')]()};return ejs[_0xf326('0xe6')](path[_0xf326('0xc5')](config['root'],_0xf326('0xc7'),_0xf326('0xe7'),_0xf326('0xe8')),{'interaction':_0x3c7e4a})[_0xf326('0x23')](function(_0x517b1c){return new BPromise(function(_0x50e35f,_0x24bef0){pdf[_0xf326('0xb0')](_0x517b1c,_0xb4b180)[_0xf326('0xe9')](path[_0xf326('0xc5')](_0x3fc996,_0xf326('0xea')+_0x3833f9['id']+'-'+_0x1f05a2+_0xf326('0xeb')),function(_0x7e238b,_0x3faa73){if(_0x7e238b)return _0x24bef0(_0x7e238b);_0x50e35f(_0x3faa73);});});})[_0xf326('0x23')](function(){return new BPromise(function(_0xa5963a,_0x51e50d){zipdir(_0x3fc996,{'saveTo':_0x4fa367},function(_0x4e9000,_0x129595){if(_0x4e9000)return _0x51e50d(_0x4e9000);return _0xa5963a(_0x129595);});})[_0xf326('0x23')](function(){return new BPromise(function(_0x41f7a7,_0x5419cc){rimraf(_0x3fc996,function(_0x38390d){if(_0x38390d)_0x5419cc(_0x38390d);return _0x41f7a7();});});})['then'](function(){return _0x3dcaf9[_0xf326('0xc3')](_0x4fa367,_0x29f0bc,function(_0x761ccb){if(_0x761ccb){console['log'](_0xf326('0xec'),_0x761ccb);}else{fs[_0xf326('0xed')](_0x4fa367);}});});});}else{return _0x3dcaf9[_0xf326('0x1c')](0xc8);}})[_0xf326('0x2e')](handleError(_0x3dcaf9,null));}; \ No newline at end of file +var _0xc2c7=['show','params','includeAll','include','create','describe','addMessage','OpenchannelMessage','body','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','closed','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','basename','out','System','Contact','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','then','catch','index','OpenchannelInteraction','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.fullname','from','user_has_openchannel_interactions','users','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','conditions','find','unreadMessages','having','`\x20>\x200','operator','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows'];(function(_0x5348a7,_0x1c5759){var _0x14eec4=function(_0x3f91d8){while(--_0x3f91d8){_0x5348a7['push'](_0x5348a7['shift']());}};_0x14eec4(++_0x1c5759);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4e4ce6,_0x1cf9ba){_0x4e4ce6=_0x4e4ce6-0x0;var _0x4789df=_0xc2c7[_0x4e4ce6];return _0x4789df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c2c('0x0'));var rimraf=require(_0x7c2c('0x1'));var zipdir=require(_0x7c2c('0x2'));var jsonpatch=require(_0x7c2c('0x3'));var rp=require(_0x7c2c('0x4'));var moment=require(_0x7c2c('0x5'));var BPromise=require(_0x7c2c('0x6'));var Mustache=require(_0x7c2c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7c2c('0x8'));var csv=require(_0x7c2c('0x9'));var ejs=require(_0x7c2c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x9'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];config[_0x7c2c('0x19')]=_[_0x7c2c('0x1a')](config[_0x7c2c('0x19')],{'host':_0x7c2c('0x1b'),'port':0x18eb});var socket=require(_0x7c2c('0x1c'))(new Redis(config[_0x7c2c('0x19')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x102778,_0xd1a3db){_0xd1a3db=_0xd1a3db||0xcc;return function(_0x4678a8){if(_0x4678a8){return _0x102778['sendStatus'](_0xd1a3db);}return _0x102778[_0x7c2c('0x1d')](_0xd1a3db)[_0x7c2c('0x1e')]();};}function respondWithResult(_0x5e55e0,_0x88f54b){_0x88f54b=_0x88f54b||0xc8;return function(_0x5a5fe2){if(_0x5a5fe2){return _0x5e55e0[_0x7c2c('0x1d')](_0x88f54b)['json'](_0x5a5fe2);}};}function respondWithFilteredResult(_0x342ea2,_0x3c948a){return function(_0x14453f){if(_0x14453f){var _0x2a9539=_0x14453f[_0x7c2c('0x1f')],_0x17df4a=_0x3c948a[_0x7c2c('0x20')],_0x26be0f=_0x3c948a[_0x7c2c('0x20')]+_0x3c948a[_0x7c2c('0x21')],_0x2c1378;if(_0x26be0f>=_0x2a9539){_0x26be0f=_0x2a9539;_0x2c1378=0xc8;}else{_0x2c1378=0xce;}_0x342ea2[_0x7c2c('0x1d')](_0x2c1378);return _0x342ea2['set'](_0x7c2c('0x22'),_0x17df4a+'-'+_0x26be0f+'/'+_0x2a9539)['json'](_0x14453f);}return null;};}function patchUpdates(_0x506d47){return function(_0x15ae33){try{jsonpatch[_0x7c2c('0x23')](_0x15ae33,_0x506d47,!![]);}catch(_0x2a9ae2){return BPromise[_0x7c2c('0x24')](_0x2a9ae2);}return _0x15ae33[_0x7c2c('0x25')]();};}function saveUpdates(_0x1883b5,_0xa84620){return function(_0x541368){if(_0x541368){return _0x541368[_0x7c2c('0x26')](_0x1883b5)['then'](function(_0x302c93){return _0x302c93;});}return null;};}function removeEntity(_0x57f510,_0x3d4387){return function(_0x274c3b){if(_0x274c3b){return _0x274c3b[_0x7c2c('0x27')]()['then'](function(){_0x57f510['status'](0xcc)[_0x7c2c('0x1e')]();});}};}function handleEntityNotFound(_0x30c53e,_0x3d2b8d){return function(_0x150690){if(!_0x150690){_0x30c53e[_0x7c2c('0x28')](0x194);}return _0x150690;};}function handleError(_0xa8e145,_0x3f4618){_0x3f4618=_0x3f4618||0x1f4;return function(_0x4b1dd0){logger[_0x7c2c('0x29')](_0x4b1dd0[_0x7c2c('0x2a')]);if(_0x4b1dd0[_0x7c2c('0x2b')]){delete _0x4b1dd0[_0x7c2c('0x2b')];}_0xa8e145[_0x7c2c('0x1d')](_0x3f4618)[_0x7c2c('0x2c')](_0x4b1dd0);};}function getInteractionUsers(_0xf2bfd1,_0x26f472){return new BPromise(function(_0xa040ff,_0x5769ec){try{if(_0x26f472[_0xf2bfd1['id']]){_0xf2bfd1[_0x7c2c('0x2d')]=_[_0x7c2c('0x2e')](_0x26f472[_0xf2bfd1['id']],function(_0x2343f4){return{'id':_0x2343f4['id'],'fullname':_0x2343f4[_0x7c2c('0x2f')]};});}}catch(_0x53ad23){_0x5769ec(_0x53ad23);}_0xa040ff(_0xf2bfd1);});}function getInteractionTags(_0xcb98ba,_0x30dd1c){return new BPromise(function(_0x4192c8,_0x1ef88b){try{if(_0xcb98ba[_0x7c2c('0x30')]){_0xcb98ba[_0x7c2c('0x31')]=[];_0xcb98ba[_0x7c2c('0x30')]['split'](',')[_0x7c2c('0x32')](function(_0x1acf75){_0xcb98ba[_0x7c2c('0x31')][_0x7c2c('0x33')](_0x30dd1c[_0x1acf75]);});}delete _0xcb98ba[_0x7c2c('0x30')];}catch(_0x5147c1){_0x1ef88b(_0x5147c1);}_0x4192c8(_0xcb98ba);});}function updateOpenchannelInteraction(_0x47ef3c,_0x7f0e97,_0x5f302e){return new BPromise(function(_0x4b97bb,_0x15ee13){return getInteractionUsers(_0x47ef3c,_0x5f302e)[_0x7c2c('0x34')](function(_0x199b13){return getInteractionTags(_0x199b13,_0x7f0e97);})[_0x7c2c('0x34')](function(_0x536dcf){_0x4b97bb(_0x536dcf);})[_0x7c2c('0x35')](function(_0x38a937){_0x15ee13(_0x38a937);});});}exports[_0x7c2c('0x36')]=function(_0x19783d,_0x204968){var _0x6ef8c4={},_0x18795b={},_0xab5072={'count':0x0,'rows':[]};var _0x5c248e=_[_0x7c2c('0x2e')](db[_0x7c2c('0x37')][_0x7c2c('0x38')],function(_0x2b6a7d){return{'name':_0x2b6a7d['fieldName'],'type':_0x2b6a7d['type'][_0x7c2c('0x39')]};});_0x18795b['model']=_['map'](_0x5c248e,'name');_0x18795b[_0x7c2c('0x3a')]=_[_0x7c2c('0x3b')](_0x19783d[_0x7c2c('0x3a')]);_0x18795b[_0x7c2c('0x3c')]=_[_0x7c2c('0x3d')](_0x18795b[_0x7c2c('0x3e')],_0x18795b[_0x7c2c('0x3a')]);_0x6ef8c4[_0x7c2c('0x3f')]=_[_0x7c2c('0x3d')](_0x18795b[_0x7c2c('0x3e')],qs[_0x7c2c('0x40')](_0x19783d['query']['fields']));_0x6ef8c4[_0x7c2c('0x3f')]=_0x6ef8c4[_0x7c2c('0x3f')][_0x7c2c('0x41')]?_0x6ef8c4[_0x7c2c('0x3f')]:_0x18795b['model'];if(!_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x42')](_0x7c2c('0x43'))){_0x6ef8c4[_0x7c2c('0x21')]=qs[_0x7c2c('0x21')](_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x21')]);_0x6ef8c4[_0x7c2c('0x20')]=qs[_0x7c2c('0x20')](_0x19783d['query'][_0x7c2c('0x20')]);}_0x6ef8c4['order']=qs[_0x7c2c('0x44')](_0x19783d[_0x7c2c('0x3a')]['sort']);_0x6ef8c4[_0x7c2c('0x45')]=qs['filters'](_[_0x7c2c('0x46')](_0x19783d[_0x7c2c('0x3a')],_0x18795b[_0x7c2c('0x3c')]),_0x5c248e);var _0x26351e=[];var _0x4f3948=squel[_0x7c2c('0x47')]()['field']('id')['field'](_0x7c2c('0x2b'))[_0x7c2c('0x48')](_0x7c2c('0x49'))['from'](_0x7c2c('0x4a'));var _0x75c0ab=squel['select']()[_0x7c2c('0x48')]('u.id')[_0x7c2c('0x48')](_0x7c2c('0x4b'))['field']('ui.OpenchannelInteractionId')[_0x7c2c('0x4c')](_0x7c2c('0x4d'),'ui')['left_join'](_0x7c2c('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x51e3b7=squel[_0x7c2c('0x47')]()[_0x7c2c('0x4c')](_0x7c2c('0x4f'),'i')[_0x7c2c('0x50')](_0x7c2c('0x51'),'c',_0x7c2c('0x52'))[_0x7c2c('0x50')](_0x7c2c('0x4e'),'o',_0x7c2c('0x53'))['left_join']('openchannel_accounts','a',_0x7c2c('0x54'))[_0x7c2c('0x50')](_0x7c2c('0x55'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x7c2c('0x56'),'it',_0x7c2c('0x57'))[_0x7c2c('0x50')](_0x7c2c('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x4f958d=squel['expr']();var _0xd71ef8=[];var _0x36184a=squel[_0x7c2c('0x58')]();var _0x27a096;if(_0x19783d[_0x7c2c('0x3a')]['search']){_0x27a096=as[_0x7c2c('0x59')](_0x19783d[_0x7c2c('0x3a')]['search']);var _0x19621a=_0x27a096['sqlOperator'];for(var _0xfba6a7=0x0;_0xfba6a7<_0x27a096[_0x7c2c('0x5a')][_0x7c2c('0x41')];_0xfba6a7++){var _0x55e123=_0x27a096['conditions'][_0xfba6a7];var _0x327f3a='i';var _0x5e4bc3=_[_0x7c2c('0x5b')](_0x5c248e,[_0x7c2c('0x2b'),_0x55e123['field']]);if(!_0x5e4bc3){switch(_0x55e123[_0x7c2c('0x48')]){case _0x7c2c('0x5c'):if(_0x55e123['value']==0x1){_0x51e3b7[_0x7c2c('0x5d')]('`'+_0x55e123[_0x7c2c('0x48')]+'`\x20=\x200');}else{_0x51e3b7[_0x7c2c('0x5d')]('`'+_0x55e123[_0x7c2c('0x48')]+_0x7c2c('0x5e'));}break;case'Contact':if(_0x55e123[_0x7c2c('0x5f')]==='$substring'){if(_0x55e123[_0x7c2c('0x60')][_0x7c2c('0x61')]('\x20')['length']>0x1){_0x4f958d[_0x19621a](_0x7c2c('0x62'),qs[_0x7c2c('0x63')](_0x55e123[_0x7c2c('0x60')]),null);}else{var _0x33681b='%'+_0x55e123['value']+'%';_0x4f958d[_0x19621a](_0x7c2c('0x64'),_0x33681b,_0x33681b,_0x33681b);}}else{_0x5e4bc3=_[_0x7c2c('0x5b')](_0x5c248e,['name',_0x7c2c('0x65')]);_0x55e123['field']=_0x7c2c('0x65');_0xb1d1ad=as[_0x7c2c('0x66')](_0x327f3a,_0x5e4bc3[_0x7c2c('0x67')],_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad[_0x7c2c('0x60')]['start'],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x1e')]);}break;case'Tag':var _0x53025a=_0x55e123['value'][_0x7c2c('0x61')](',')['map'](function(_0x1e61fe){return Number(_0x1e61fe);});_0x53025a['forEach'](function(_0x469515){_0x36184a['or'](_0x7c2c('0x69'),'%,'+_0x469515+',%');});_0xd71ef8=_[_0x7c2c('0x6a')](_0xd71ef8,_0x53025a);break;case _0x7c2c('0x6b'):if(_0x55e123[_0x7c2c('0x5f')]===_0x7c2c('0x6c')){_0x4f958d[_0x19621a](_0x7c2c('0x6d'),'%'+_0x55e123[_0x7c2c('0x60')]+'%',null);}else{_0x5e4bc3=_['find'](_0x5c248e,['name','UserId']);_0x55e123[_0x7c2c('0x48')]=_0x7c2c('0x6e');_0xb1d1ad=as[_0x7c2c('0x66')](_0x327f3a,_0x5e4bc3[_0x7c2c('0x67')],_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x6f')],_0xb1d1ad[_0x7c2c('0x60')]['end']);}break;case'body':_0xb1d1ad=as[_0x7c2c('0x66')]('me',null,_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad['value'][_0x7c2c('0x6f')],_0xb1d1ad['value']['end']);break;}}else{var _0xb1d1ad=as[_0x7c2c('0x66')](_0x327f3a,_0x5e4bc3[_0x7c2c('0x67')],_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x6f')],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x1e')]);}}}else{var _0xf06cd1=_(_0x19783d[_0x7c2c('0x3a')])[_0x7c2c('0x3b')]()[_0x7c2c('0x2e')](function(_0xbe0568){return _[_0x7c2c('0x70')](_0x5c248e,['name',_0xbe0568])?_0xbe0568:undefined;})[_0x7c2c('0x71')]()['value']();if(!_['isEmpty'](_0xf06cd1)){_0xf06cd1['forEach'](function(_0x4c0d0f){if(_0x4c0d0f===_0x7c2c('0x72')){_0x51e3b7[_0x7c2c('0x45')](_0x7c2c('0x73'),[][_0x7c2c('0x74')](_0x19783d[_0x7c2c('0x3a')][_0x4c0d0f]));}else if(_0x4c0d0f===_0x7c2c('0x75')){var _0x59e46d=JSON[_0x7c2c('0x76')](_0x19783d[_0x7c2c('0x3a')][_0x4c0d0f])[_0x7c2c('0x77')];var _0x21c5ff=JSON[_0x7c2c('0x76')](_0x19783d[_0x7c2c('0x3a')][_0x4c0d0f])['$lte'];_0x51e3b7[_0x7c2c('0x45')](_0x7c2c('0x78'),_0x59e46d,_0x21c5ff);}else{if(_0x19783d['query'][_0x4c0d0f]===_0x7c2c('0x79')){_0x51e3b7[_0x7c2c('0x45')]('i.'+_0x4c0d0f+'\x20IS\x20NULL');}else{_0x51e3b7[_0x7c2c('0x45')]('i.'+_0x4c0d0f+_0x7c2c('0x7a'),_0x19783d['query'][_0x4c0d0f]);}}});}if(_0x19783d['query'][_0x7c2c('0x7b')]){if(_0x19783d['query'][_0x7c2c('0x7b')]==0x1){_0x51e3b7['having'](_0x7c2c('0x7c'));}else{_0x51e3b7[_0x7c2c('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x19783d[_0x7c2c('0x3a')]['tag']){_0xd71ef8=_[_0x7c2c('0x7d')](_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7e')])?_0x19783d['query'][_0x7c2c('0x7e')]:new Array(_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7e')]);_0xd71ef8[_0x7c2c('0x32')](function(_0x5a636c){_0x36184a['or'](_0x7c2c('0x69'),'%,'+_0x5a636c+',%');});}if(_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7f')]){var _0x1d75ba=_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7f')][_0x7c2c('0x80')]('\x5c','\x5c\x5c')[_0x7c2c('0x80')](/'/g,'\x27\x27');if(qs[_0x7c2c('0x81')](_0x1d75ba)){_0x4f958d['or']('i.id\x20LIKE\x20?',_0x1d75ba+'%');}else{_0x4f958d['or'](_0x7c2c('0x82'),qs[_0x7c2c('0x63')](_0x1d75ba))['or']('i.from\x20LIKE\x20?',_0x1d75ba+'%')['or'](_0x7c2c('0x83'),_0x1d75ba+'%');}}}_0x51e3b7['where'](_0x4f958d);_0x51e3b7['group'](_0x7c2c('0x84'));var _0x40fc73={'type':db[_0x7c2c('0x85')]['QueryTypes'][_0x7c2c('0x86')],'raw':!![]};var _0x4e672=_0x51e3b7[_0x7c2c('0x87')]();_0x4e672['field'](_0x7c2c('0x84'));_0x4e672[_0x7c2c('0x48')](_0x7c2c('0x88'),_0x7c2c('0x5c'));if(_0x6ef8c4['order']){_0x6ef8c4[_0x7c2c('0x89')]['forEach'](function(_0x412ad9){var _0x4ee339=_0x412ad9[0x0]===_0x7c2c('0x8a')?_0x412ad9[0x0]:'i.'+_0x412ad9[0x0];_0x51e3b7[_0x7c2c('0x89')](_0x4ee339,_0x412ad9[0x1]===_0x7c2c('0x8b')?![]:!![]);});}if(!_[_0x7c2c('0x8c')](_0xd71ef8)){_0x51e3b7[_0x7c2c('0x5d')](_0x36184a);_0x4e672[_0x7c2c('0x45')](_0x7c2c('0x8d'),_0xd71ef8);}BPromise['resolve']()[_0x7c2c('0x34')](function(){if(!_0x27a096){if(_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x72')])return;_0x4e672[_0x7c2c('0x45')](_0x7c2c('0x8e'));_0x51e3b7[_0x7c2c('0x45')](_0x7c2c('0x8e'));return;}if(_0x19783d[_0x7c2c('0x8f')]['role']!==_0x7c2c('0x90'))return;return _0x19783d[_0x7c2c('0x8f')][_0x7c2c('0x91')]({'attributes':['id'],'raw':!![]})[_0x7c2c('0x34')](function(_0x11e00d){if(_['isEmpty'](_0x11e00d)){_0x4e672[_0x7c2c('0x45')](_0x7c2c('0x92'));_0x51e3b7['where'](_0x7c2c('0x92'));}else{_0x4e672[_0x7c2c('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7c2c('0x2e')](_0x11e00d,'id'));_0x51e3b7['where'](_0x7c2c('0x73'),_[_0x7c2c('0x2e')](_0x11e00d,'id'));}});})[_0x7c2c('0x34')](function(){if(_0x19783d[_0x7c2c('0x8f')][_0x7c2c('0x93')]===_0x7c2c('0x90')&&!_0x27a096&&!_0x19783d[_0x7c2c('0x3a')]['OpenchannelAccountId'])return[];return db[_0x7c2c('0x94')][_0x7c2c('0x3a')](_0x4e672['toString'](),_0x40fc73);})[_0x7c2c('0x34')](function(_0x333a76){_0xab5072[_0x7c2c('0x1f')]=_0x333a76[_0x7c2c('0x41')];if(_0xab5072[_0x7c2c('0x1f')]===0x0)return[];return db[_0x7c2c('0x94')][_0x7c2c('0x3a')](_0x4f3948[_0x7c2c('0x95')](),_0x40fc73)[_0x7c2c('0x34')](function(_0x2f5cb0){_0x26351e=_[_0x7c2c('0x96')](_0x2f5cb0,'id');_0x40fc73=_[_0x7c2c('0x97')](_0x40fc73,{'model':db[_0x7c2c('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19783d[_0x7c2c('0x3a')]['fields']){_0x6ef8c4[_0x7c2c('0x3f')][_0x7c2c('0x32')](function(_0x551c44){_0x51e3b7[_0x7c2c('0x48')]('i.'+_0x551c44);});}else{_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0x88'),_0x7c2c('0x5c'));_0x51e3b7[_0x7c2c('0x48')]('a.key',_0x7c2c('0x98'));_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0x99'),'Account.mandatoryDisposition');_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0x9a'),_0x7c2c('0x8a'));_0x51e3b7['field'](_0x7c2c('0x9b'));_0x51e3b7['field'](_0x7c2c('0x9c'),'Contact.firstName');_0x51e3b7['field'](_0x7c2c('0x9d'),_0x7c2c('0x9e'));_0x51e3b7[_0x7c2c('0x48')]('c.email',_0x7c2c('0x9f'));_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0xa0'),_0x7c2c('0xa1'));_0x51e3b7['field'](_0x7c2c('0xa2'),'Contact.mobile');_0x51e3b7['field']('c.fax','Contact.fax');_0x51e3b7['field'](_0x7c2c('0xa3'),_0x7c2c('0xa4'));_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0xa5'),_0x7c2c('0xa6'));_0x51e3b7['field'](_0x7c2c('0xa7'),_0x7c2c('0x30'));}if(_0x6ef8c4[_0x7c2c('0x21')])_0x51e3b7[_0x7c2c('0x21')](_0x6ef8c4[_0x7c2c('0x21')]);if(_0x6ef8c4[_0x7c2c('0x20')])_0x51e3b7['offset'](_0x6ef8c4['offset']);return db[_0x7c2c('0x94')][_0x7c2c('0x3a')](_0x51e3b7[_0x7c2c('0x95')](),_0x40fc73);})[_0x7c2c('0x34')](function(_0x587e5a){_0x75c0ab[_0x7c2c('0x45')](_0x7c2c('0xa8'),_[_0x7c2c('0x2e')](_0x587e5a,'id'));return db[_0x7c2c('0x94')][_0x7c2c('0x3a')](_0x75c0ab[_0x7c2c('0x95')](),_0x40fc73)[_0x7c2c('0x34')](function(_0x11057b){var _0x490f01=_['groupBy'](_0x11057b,_0x7c2c('0xa9'));var _0x1abb54=[];_0x587e5a['forEach'](function(_0x34ed53){_0x1abb54['push'](updateOpenchannelInteraction(_0x34ed53,_0x26351e,_0x490f01));});return BPromise[_0x7c2c('0xaa')](_0x1abb54);});});})['then'](function(_0x40a620){_0xab5072[_0x7c2c('0xab')]=_0x40a620;return _0xab5072;})[_0x7c2c('0x34')](respondWithFilteredResult(_0x204968,_0x6ef8c4))[_0x7c2c('0x35')](handleError(_0x204968,null));};exports[_0x7c2c('0xac')]=function(_0x309051,_0x3f8683){var _0x1eeb00={};if(_0x309051[_0x7c2c('0x3a')]['type']&&_0x309051[_0x7c2c('0x3a')][_0x7c2c('0x67')]===_0x7c2c('0x4c')){_0x1eeb00['from']=_0x309051[_0x7c2c('0xad')]['id'];}else{_0x1eeb00['id']=_0x309051[_0x7c2c('0xad')]['id'];}var _0x56460e={'raw':![],'where':_0x1eeb00},_0x1ad55a={};_0x1ad55a['model']=_[_0x7c2c('0x3b')](db['OpenchannelInteraction'][_0x7c2c('0x38')]);_0x1ad55a[_0x7c2c('0x3a')]=_[_0x7c2c('0x3b')](_0x309051[_0x7c2c('0x3a')]);_0x1ad55a['filters']=_[_0x7c2c('0x3d')](_0x1ad55a[_0x7c2c('0x3e')],_0x1ad55a[_0x7c2c('0x3a')]);_0x56460e[_0x7c2c('0x3f')]=_[_0x7c2c('0x3d')](_0x1ad55a[_0x7c2c('0x3e')],qs['fields'](_0x309051[_0x7c2c('0x3a')]['fields']));_0x56460e[_0x7c2c('0x3f')]=_0x56460e[_0x7c2c('0x3f')]['length']?_0x56460e[_0x7c2c('0x3f')]:_0x1ad55a[_0x7c2c('0x3e')];if(_0x309051[_0x7c2c('0x3a')][_0x7c2c('0xae')]){_0x56460e[_0x7c2c('0xaf')]=[{'all':!![]}];}_0x56460e=_[_0x7c2c('0x97')]({},_0x56460e,_0x309051['options']);return db['OpenchannelInteraction'][_0x7c2c('0x5b')](_0x56460e)[_0x7c2c('0x34')](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x34')](respondWithResult(_0x3f8683,null))[_0x7c2c('0x35')](handleError(_0x3f8683,null));};exports[_0x7c2c('0xb0')]=function(_0x35b914,_0xa3a57e){return db['OpenchannelInteraction'][_0x7c2c('0xb0')](_0x35b914['body'],{})['then'](respondWithResult(_0xa3a57e,0xc9))[_0x7c2c('0x35')](handleError(_0xa3a57e,null));};exports[_0x7c2c('0x26')]=function(_0x421f7c,_0x4746c1){if(_0x421f7c['body']['id']){delete _0x421f7c['body']['id'];}return db[_0x7c2c('0x37')][_0x7c2c('0x5b')]({'where':{'id':_0x421f7c['params']['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x4746c1,null))['then'](saveUpdates(_0x421f7c['body'],null))[_0x7c2c('0x34')](respondWithResult(_0x4746c1,null))[_0x7c2c('0x35')](handleError(_0x4746c1,null));};exports['destroy']=function(_0x3b1690,_0xa485db){return db['OpenchannelInteraction'][_0x7c2c('0x5b')]({'where':{'id':_0x3b1690['params']['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0xa485db,null))[_0x7c2c('0x34')](removeEntity(_0xa485db,null))[_0x7c2c('0x35')](handleError(_0xa485db,null));};exports[_0x7c2c('0xb1')]=function(_0xa285d5,_0xd97e2){return db[_0x7c2c('0x37')]['describe']()[_0x7c2c('0x34')](respondWithResult(_0xd97e2,null))['catch'](handleError(_0xd97e2,null));};exports[_0x7c2c('0xb2')]=function(_0x36bf36,_0x1ee486,_0x362719){return db[_0x7c2c('0xb3')]['find']({'where':{'id':_0x36bf36[_0x7c2c('0xad')]['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x1ee486,null))['then'](function(_0x166b3d){if(_0x166b3d){return _0x166b3d['addMessage'](_0x36bf36[_0x7c2c('0xb4')][_0x7c2c('0xb5')],_[_0x7c2c('0xb6')](_0x36bf36['body'],[_0x7c2c('0xb5'),'id'])||{});}})[_0x7c2c('0x34')](respondWithResult(_0x1ee486,null))[_0x7c2c('0x35')](handleError(_0x1ee486,null));};exports['getMessages']=function(_0xe393e9,_0x5818d3,_0x3e70c5){var _0x334736={'raw':![],'where':{}};var _0x2d26fd={};var _0x2c4714={'count':0x0,'rows':[]};return db[_0x7c2c('0x37')][_0x7c2c('0xb7')]({'where':{'id':_0xe393e9['params']['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x5818d3,null))[_0x7c2c('0x34')](function(_0x4d5d8e){if(_0x4d5d8e){_0x2d26fd[_0x7c2c('0x3e')]=_[_0x7c2c('0x3b')](db[_0x7c2c('0xb3')][_0x7c2c('0x38')]);_0x2d26fd['query']=_['keys'](_0xe393e9[_0x7c2c('0x3a')]);_0x2d26fd['filters']=_['intersection'](_0x2d26fd[_0x7c2c('0x3e')],_0x2d26fd[_0x7c2c('0x3a')]);_0x334736['attributes']=_['intersection'](_0x2d26fd['model'],qs[_0x7c2c('0x40')](_0xe393e9['query']['fields']));_0x334736[_0x7c2c('0x3f')]=_0x334736['attributes'][_0x7c2c('0x41')]?_0x334736[_0x7c2c('0x3f')]:_0x2d26fd[_0x7c2c('0x3e')];if(!_0xe393e9[_0x7c2c('0x3a')][_0x7c2c('0x42')]('nolimit')){_0x334736[_0x7c2c('0x21')]=qs['limit'](_0xe393e9[_0x7c2c('0x3a')][_0x7c2c('0x21')]);_0x334736[_0x7c2c('0x20')]=qs[_0x7c2c('0x20')](_0xe393e9[_0x7c2c('0x3a')]['offset']);}_0x334736['order']=qs['sort'](_0xe393e9['query'][_0x7c2c('0x44')]);_0x334736[_0x7c2c('0x45')]=qs[_0x7c2c('0x3c')](_[_0x7c2c('0x46')](_0xe393e9[_0x7c2c('0x3a')],_0x2d26fd[_0x7c2c('0x3c')]));_0x334736[_0x7c2c('0x45')][_0x7c2c('0xa9')]=_0x4d5d8e['id'];if(_0xe393e9[_0x7c2c('0x3a')]['filter']){_0x334736[_0x7c2c('0x45')]=_[_0x7c2c('0x97')](_0x334736[_0x7c2c('0x45')],{'$or':_[_0x7c2c('0x2e')](_0x334736[_0x7c2c('0x3f')],function(_0x17e4b9){var _0x3ab9a6={};_0x3ab9a6[_0x17e4b9]={'$like':'%'+_0xe393e9['query'][_0x7c2c('0x7f')]+'%'};return _0x3ab9a6;})});}if(_0xe393e9['query']['$gte']){var _0x28cea=_0xe393e9[_0x7c2c('0x3a')]['$gte'][_0x7c2c('0x61')](',');var _0x2e29b9={};_0x2e29b9[_0x28cea[0x0]]={'$gte':moment(_0x28cea[0x1])[_0x7c2c('0xb8')](_0x7c2c('0xb9'))};_0x334736[_0x7c2c('0x45')]=_[_0x7c2c('0x97')](_0x334736['where'],_0x2e29b9);}_0x334736=_[_0x7c2c('0x97')]({},_0x334736,_0xe393e9[_0x7c2c('0xba')]);return db[_0x7c2c('0xb3')][_0x7c2c('0x1f')]({'where':_0x334736[_0x7c2c('0x45')]})[_0x7c2c('0x34')](function(_0x46448b){_0x2c4714['count']=_0x46448b;if(_0xe393e9[_0x7c2c('0x3a')][_0x7c2c('0xae')]){_0x334736[_0x7c2c('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7c2c('0xbb')](_0x334736);})[_0x7c2c('0x34')](function(_0x275010){_0x2c4714[_0x7c2c('0xab')]=_0x275010;return _0x2c4714;});}})[_0x7c2c('0x34')](respondWithFilteredResult(_0x5818d3,_0x334736))[_0x7c2c('0x35')](handleError(_0x5818d3,null));};exports[_0x7c2c('0xbc')]=function(_0x450016,_0x3389a0,_0x16dc25){return db[_0x7c2c('0x37')][_0x7c2c('0x5b')]({'where':{'id':_0x450016[_0x7c2c('0xad')]['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x3389a0,null))[_0x7c2c('0x34')](function(_0x59b699){if(_0x59b699){return _0x59b699[_0x7c2c('0xbd')](_0x450016['body'][_0x7c2c('0xb5')],_[_0x7c2c('0xb6')](_0x450016['body'],[_0x7c2c('0xb5'),'id'])||{})[_0x7c2c('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0x7c2c('0x2b'),_0x7c2c('0x49')],'where':{'id':_0x450016[_0x7c2c('0xb4')][_0x7c2c('0xb5')]}});})['then'](function(_0x5749a6){socket[_0x7c2c('0xbf')](_0x7c2c('0xc0'),{'id':Number(_0x450016[_0x7c2c('0xad')]['id']),'tags':_0x5749a6||[]});return{'id':Number(_0x450016[_0x7c2c('0xad')]['id']),'tags':_0x5749a6||[]};});}})['then'](respondWithResult(_0x3389a0,null))[_0x7c2c('0x35')](handleError(_0x3389a0,null));};exports[_0x7c2c('0xc1')]=function(_0x317445,_0x2ffe58,_0x40a278){return db['OpenchannelInteraction'][_0x7c2c('0x5b')]({'where':{'id':_0x317445[_0x7c2c('0xad')]['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x2ffe58,null))[_0x7c2c('0x34')](function(_0x53acb1){if(_0x53acb1){return _0x53acb1[_0x7c2c('0xc1')](_0x317445[_0x7c2c('0x3a')][_0x7c2c('0xb5')]);}})['then'](respondWithStatusCode(_0x2ffe58,null))['catch'](handleError(_0x2ffe58,null));};exports[_0x7c2c('0xc2')]=function(_0x3a62f5,_0x4f40a0){var _0x2d1397=moment()[_0x7c2c('0xc3')]()[_0x7c2c('0x95')]();var _0x437f8f=path['join'](config[_0x7c2c('0xc4')],_0x7c2c('0xc5'),_0x7c2c('0xc6'),_0x7c2c('0xc7'));var _0xf5234a=path[_0x7c2c('0xc8')](config[_0x7c2c('0xc4')],_0x7c2c('0xc5'),'files',_0x7c2c('0xc9'));var _0x3ab89b=path[_0x7c2c('0xc8')](_0x437f8f,_0x2d1397);var _0xac2e9b=util[_0x7c2c('0xb8')](_0x7c2c('0xca'),_0x3a62f5[_0x7c2c('0xad')]['id'],_0x2d1397);var _0x4ce131=path[_0x7c2c('0xc8')](_0x437f8f,_0xac2e9b);var _0x1692cd=[];_0x1692cd[_0x7c2c('0x33')]({'model':db['User'],'as':_0x7c2c('0x6b'),'attributes':['id',_0x7c2c('0x2f')],'raw':!![]});_0x1692cd[_0x7c2c('0x33')]({'model':db[_0x7c2c('0xcb')],'as':'Contact','attributes':['id',_0x7c2c('0xcc'),'lastName'],'raw':!![]});if(_0x3a62f5[_0x7c2c('0x3a')]['attachments']){_0x1692cd[_0x7c2c('0x33')]({'model':db[_0x7c2c('0xcd')],'as':_0x7c2c('0xcd'),'raw':!![]});}var _0x41f9d6=[{'model':db['OpenchannelMessage'],'as':_0x7c2c('0xce'),'attributes':['id','body',_0x7c2c('0x75'),_0x7c2c('0xcf'),'secret',_0x7c2c('0x7b')],'include':_0x1692cd}];_0x41f9d6['push']({'model':db['OpenchannelAccount'],'as':_0x7c2c('0xd0'),'attributes':['id','name']});_0x41f9d6[_0x7c2c('0x33')]({'model':db[_0x7c2c('0x6b')],'as':_0x7c2c('0xd1'),'attributes':['id',_0x7c2c('0x2f')]});return db[_0x7c2c('0x37')]['find']({'where':{'id':_0x3a62f5[_0x7c2c('0xad')]['id']},'include':_0x41f9d6})[_0x7c2c('0x34')](handleEntityNotFound(_0x4f40a0,null))[_0x7c2c('0x34')](function(_0x4e0078){if(_0x4e0078){var _0x24695e=_0x4e0078[_0x7c2c('0xd2')]({'plain':!![]});fs[_0x7c2c('0xd3')](_0x3ab89b);var _0x4dd372={'format':'A4','border':_0x7c2c('0xd4'),'header':{'height':_0x7c2c('0xd5'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x7c2c('0xd6'),'contents':{'default':util[_0x7c2c('0xb8')](_0x7c2c('0xd7'),util[_0x7c2c('0xb8')]('%s\x20#%d',_0x7c2c('0xd8'),_0x24695e['id']),moment()[_0x7c2c('0xb8')](_0x7c2c('0xd9'))['toString']())}}};var _0xa623a={'channel':_0x7c2c('0xd8'),'account':_0x24695e['Account'][_0x7c2c('0x2b')],'agent':_0x24695e['Owner']?_0x24695e[_0x7c2c('0xd1')][_0x7c2c('0x2f')]:'N.A.','createdAt':moment(_0x24695e[_0x7c2c('0x75')])[_0x7c2c('0xb8')](_0x7c2c('0xb9'))[_0x7c2c('0x95')](),'closedAt':_0x24695e[_0x7c2c('0xda')]?moment(_0x24695e[_0x7c2c('0xdb')])['format'](_0x7c2c('0xb9'))[_0x7c2c('0x95')]():'','disposition':_0x24695e[_0x7c2c('0xdc')],'visibility':_0x24695e[_0x7c2c('0xdd')]?_0x7c2c('0xde'):_0x7c2c('0xdf'),'messages':_(_0x24695e['Messages'])[_0x7c2c('0x7f')]({'secret':![]})[_0x7c2c('0x2e')](function(_0x38b9f1){if(_0x38b9f1[_0x7c2c('0xcd')]){var _0x30156e=path[_0x7c2c('0xc8')](_0xf5234a,_0x38b9f1[_0x7c2c('0xcd')]['basename']);if(fs[_0x7c2c('0xe0')](_0x30156e)){fs[_0x7c2c('0xe1')](_0x30156e)[_0x7c2c('0xe2')](fs['createWriteStream'](path[_0x7c2c('0xc8')](_0x3ab89b,_0x38b9f1[_0x7c2c('0xcd')][_0x7c2c('0xe3')])));}}return{'date':moment(_0x38b9f1[_0x7c2c('0x75')])[_0x7c2c('0xb8')](_0x7c2c('0xb9'))[_0x7c2c('0x95')](),'sender':_0x38b9f1[_0x7c2c('0xcf')]===_0x7c2c('0xe4')?_0x38b9f1[_0x7c2c('0x6b')]?_0x38b9f1[_0x7c2c('0x6b')][_0x7c2c('0x2f')]:_0x7c2c('0xe5'):_0x38b9f1[_0x7c2c('0xe6')]['firstName']+(_0x38b9f1[_0x7c2c('0xe6')][_0x7c2c('0xe7')]?'\x20'+_0x38b9f1[_0x7c2c('0xe6')][_0x7c2c('0xe7')]:''),'body':_0x38b9f1[_0x7c2c('0xcd')]?_0x38b9f1[_0x7c2c('0xcd')][_0x7c2c('0xe3')]:_0x38b9f1[_0x7c2c('0xb4')],'direction':_0x38b9f1['direction']===_0x7c2c('0xe4')?'A':'C','secret':_0x38b9f1['secret'],'read':_0x38b9f1[_0x7c2c('0x7b')],'attachment':_0x38b9f1[_0x7c2c('0xcd')]};})[_0x7c2c('0x60')]()};return ejs[_0x7c2c('0xe8')](path['join'](config[_0x7c2c('0xc4')],_0x7c2c('0xc5'),_0x7c2c('0xe9'),_0x7c2c('0xea')),{'interaction':_0xa623a})[_0x7c2c('0x34')](function(_0x4a4a2f){return new BPromise(function(_0x2354e9,_0xf60ff2){pdf[_0x7c2c('0xb0')](_0x4a4a2f,_0x4dd372)[_0x7c2c('0xeb')](path[_0x7c2c('0xc8')](_0x3ab89b,'transcript-'+_0x24695e['id']+'-'+_0x2d1397+_0x7c2c('0xec')),function(_0x13a414,_0x26ee02){if(_0x13a414)return _0xf60ff2(_0x13a414);_0x2354e9(_0x26ee02);});});})[_0x7c2c('0x34')](function(){return new BPromise(function(_0x52ba60,_0x10d10b){zipdir(_0x3ab89b,{'saveTo':_0x4ce131},function(_0x5982af,_0x300f8b){if(_0x5982af)return _0x10d10b(_0x5982af);return _0x52ba60(_0x300f8b);});})[_0x7c2c('0x34')](function(){return new BPromise(function(_0x4877e7,_0x132e70){rimraf(_0x3ab89b,function(_0x3d2004){if(_0x3d2004)_0x132e70(_0x3d2004);return _0x4877e7();});});})['then'](function(){return _0x4f40a0[_0x7c2c('0xc2')](_0x4ce131,_0xac2e9b,function(_0x455b03){if(_0x455b03){console[_0x7c2c('0xed')](_0x7c2c('0xee'),_0x455b03);}else{fs[_0x7c2c('0xef')](_0x4ce131);}});});});}else{return _0x4f40a0[_0x7c2c('0x28')](0xc8);}})['catch'](handleError(_0x4f40a0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 661c04a..18e2f55 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 _0x734f=['map','findAll','length','catch','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','getUsers','setDataValue'];(function(_0x37bf8d,_0x43bce8){var _0x580ada=function(_0x43df13){while(--_0x43df13){_0x37bf8d['push'](_0x37bf8d['shift']());}};_0x580ada(++_0x43bce8);}(_0x734f,0x1d9));var _0xf734=function(_0x42e84c,_0x43e767){_0x42e84c=_0x42e84c-0x0;var _0x2a149a=_0x734f[_0x42e84c];return _0x2a149a;};'use strict';var EventEmitter=require(_0xf734('0x0'));var OpenchannelInteraction=require(_0xf734('0x1'))['db'][_0xf734('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf734('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf734('0x4'),'afterDestroy':'remove'};function emitEvent(_0x406b77){return function(_0x5324d5,_0x2c1ce8,_0x3ed542){_0x5324d5[_0xf734('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c3e7c){_0x5324d5[_0xf734('0x6')]('Users',_0x5c3e7c[_0xf734('0x7')](function(_0x594b66){return{'id':_0x594b66['id']};}));return OpenchannelMessage[_0xf734('0x8')]({'where':{'OpenchannelInteractionId':_0x5324d5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1af276){_0x5324d5[_0xf734('0x6')]('unreadMessages',_0x1af276[_0xf734('0x9')]);OpenchannelInteractionEvents['emit'](_0x406b77+':'+_0x5324d5['id'],_0x5324d5);OpenchannelInteractionEvents['emit'](_0x406b77,_0x5324d5);_0x3ed542(null);})[_0xf734('0xa')](_0x3ed542(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf734('0xb')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9caf=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue'];(function(_0x5978e1,_0x11d16f){var _0xe1dd68=function(_0x2e8888){while(--_0x2e8888){_0x5978e1['push'](_0x5978e1['shift']());}};_0xe1dd68(++_0x11d16f);}(_0x9caf,0x1c9));var _0xf9ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9caf[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xf9ca('0x0'))['db'][_0xf9ca('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf9ca('0x2')](0x0);var events={'afterCreate':_0xf9ca('0x3'),'afterUpdate':_0xf9ca('0x4'),'afterDestroy':_0xf9ca('0x5')};function emitEvent(_0x176426){return function(_0x267893,_0x5575f7,_0x1a0984){_0x267893['getUsers']({'attributes':['id'],'raw':!![]})[_0xf9ca('0x6')](function(_0x5ac129){_0x267893['setDataValue'](_0xf9ca('0x7'),_0x5ac129[_0xf9ca('0x8')](function(_0x3dab10){return{'id':_0x3dab10['id']};}));return OpenchannelMessage[_0xf9ca('0x9')]({'where':{'OpenchannelInteractionId':_0x267893['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf9ca('0x6')](function(_0x2d91bd){_0x267893[_0xf9ca('0xa')](_0xf9ca('0xb'),_0x2d91bd[_0xf9ca('0xc')]);OpenchannelInteractionEvents[_0xf9ca('0xd')](_0x176426+':'+_0x267893['id'],_0x267893);OpenchannelInteractionEvents[_0xf9ca('0xd')](_0x176426,_0x267893);_0x1a0984(null);})[_0xf9ca('0xe')](_0x1a0984(null));};}for(var e in events){if(events[_0xf9ca('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xf9ca('0x10')](e,emitEvent(event));}}module[_0xf9ca('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0b142b7..c66fbeb 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 _0x85d0=['OpenchannelInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3acd2d,_0x388d83){var _0x12cc72=function(_0x106d5a){while(--_0x106d5a){_0x3acd2d['push'](_0x3acd2d['shift']());}};_0x12cc72(++_0x388d83);}(_0x85d0,0x164));var _0x085d=function(_0x286be5,_0x50fea4){_0x286be5=_0x286be5-0x0;var _0xc5bb8e=_0x85d0[_0x286be5];return _0xc5bb8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x085d('0x0'));var BPromise=require(_0x085d('0x1'));var rp=require(_0x085d('0x2'));var fs=require('fs');var path=require(_0x085d('0x3'));var rimraf=require(_0x085d('0x4'));var config=require(_0x085d('0x5'));var attributes=require('./openchannelInteraction.attributes');module[_0x085d('0x6')]=function(_0x5c917f,_0x364f09){return _0x5c917f[_0x085d('0x7')](_0x085d('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf65d01,_0xa94124,_0x210aa0){if(_0xf65d01[_0x085d('0x9')](_0x085d('0xa'))){_0xf65d01[_0x085d('0xb')]=moment()[_0x085d('0xc')](_0x085d('0xd'));}_0x210aa0(null,_0xf65d01);}}});}; \ No newline at end of file +var _0x33c5=['exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x33c5,0xe6));var _0x533c=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x33c5[_0x146a97];return _0x259d5c;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36d74e,_0x2c297c,_0x1b929b){if(_0x36d74e[_0x533c('0xc')](_0x533c('0xd'))){_0x36d74e[_0x533c('0xe')]=moment()[_0x533c('0xf')](_0x533c('0x10'));}_0x1b929b(null,_0x36d74e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 275e85f..3a79bdb 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 _0xba1f=['OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','ids','omit','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateOpenchannelInteraction'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xba1f,0x8f));var _0xfba1=function(_0x5e674c,_0xc65cc5){_0x5e674c=_0x5e674c-0x0;var _0x224e27=_0xba1f[_0x5e674c];return _0x224e27;};'use strict';var _=require(_0xfba1('0x0'));var util=require(_0xfba1('0x1'));var moment=require(_0xfba1('0x2'));var BPromise=require(_0xfba1('0x3'));var rs=require(_0xfba1('0x4'));var fs=require('fs');var Redis=require(_0xfba1('0x5'));var db=require(_0xfba1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfba1('0x7'))('rpc');var config=require(_0xfba1('0x8'));var jayson=require(_0xfba1('0x9'));var client=jayson[_0xfba1('0xa')][_0xfba1('0xb')]({'port':0x232a});config['redis']=_[_0xfba1('0xc')](config[_0xfba1('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xfba1('0xe'))(new Redis(config[_0xfba1('0xd')]));require(_0xfba1('0xf'))[_0xfba1('0x10')](socket);function respondWithRpcPromise(_0x524ab8,_0x116b04,_0xa731b4){return new BPromise(function(_0x37a000,_0x235190){return client[_0xfba1('0x11')](_0x524ab8,_0xa731b4)[_0xfba1('0x12')](function(_0x5d725e){logger[_0xfba1('0x13')](_0xfba1('0x14'),_0x116b04,_0xfba1('0x15'));logger[_0xfba1('0x16')](_0xfba1('0x17'),_0x116b04,'request\x20sent',JSON[_0xfba1('0x18')](_0x5d725e));if(_0x5d725e[_0xfba1('0x19')]){if(_0x5d725e[_0xfba1('0x19')][_0xfba1('0x1a')]===0x1f4){logger[_0xfba1('0x19')](_0xfba1('0x14'),_0x116b04,_0x5d725e[_0xfba1('0x19')][_0xfba1('0x1b')]);return _0x235190(_0x5d725e['error'][_0xfba1('0x1b')]);}logger[_0xfba1('0x19')](_0xfba1('0x14'),_0x116b04,_0x5d725e[_0xfba1('0x19')][_0xfba1('0x1b')]);return _0x37a000(_0x5d725e[_0xfba1('0x19')][_0xfba1('0x1b')]);}else{logger[_0xfba1('0x13')](_0xfba1('0x14'),_0x116b04,_0xfba1('0x15'));_0x37a000(_0x5d725e['result'][_0xfba1('0x1b')]);}})['catch'](function(_0x42796d){logger[_0xfba1('0x19')](_0xfba1('0x14'),_0x116b04,_0x42796d);_0x235190(_0x42796d);});});}exports[_0xfba1('0x1c')]=function(_0x1b8072){var _0x1468c5=this;return new Promise(function(_0x5e8138,_0x1b488d){return db[_0xfba1('0x1d')][_0xfba1('0x1e')](_0x1b8072[_0xfba1('0x1f')],{'raw':_0x1b8072[_0xfba1('0x20')]?_0x1b8072[_0xfba1('0x20')][_0xfba1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8072[_0xfba1('0x20')]?_0x1b8072[_0xfba1('0x20')][_0xfba1('0x22')]||null:null,'attributes':_0x1b8072[_0xfba1('0x20')]?_0x1b8072[_0xfba1('0x20')][_0xfba1('0x23')]||null:null,'limit':_0x1b8072[_0xfba1('0x20')]?_0x1b8072[_0xfba1('0x20')][_0xfba1('0x24')]||null:null})[_0xfba1('0x12')](function(_0x335177){logger[_0xfba1('0x13')](_0xfba1('0x1c'),_0x1b8072);logger['debug'](_0xfba1('0x1c'),_0x1b8072,JSON[_0xfba1('0x18')](_0x335177));_0x5e8138(_0x335177);})['catch'](function(_0x20a3da){logger[_0xfba1('0x19')](_0xfba1('0x1c'),_0x20a3da['message'],_0x1b8072);_0x1b488d(_0x1468c5[_0xfba1('0x19')](0x1f4,_0x20a3da[_0xfba1('0x1b')]));});});};exports[_0xfba1('0x25')]=function(_0x4eb9aa){return new Promise(function(_0x188c1f,_0x12c293){return db[_0xfba1('0x1d')][_0xfba1('0x26')]({'where':_0x4eb9aa[_0xfba1('0x20')]?_0x4eb9aa[_0xfba1('0x20')][_0xfba1('0x22')]||null:null})[_0xfba1('0x12')](function(_0xeb887e){if(_0xeb887e){return _0xeb887e['addTags'](_0x4eb9aa[_0xfba1('0x1f')][_0xfba1('0x27')],_[_0xfba1('0x28')](_0x4eb9aa['body'],['ids','id'])||{});}})['spread'](function(_0xa8e73b){logger[_0xfba1('0x13')](_0xfba1('0x29'),_0x4eb9aa);logger[_0xfba1('0x16')](_0xfba1('0x29'),_0x4eb9aa,JSON[_0xfba1('0x18')](_0xa8e73b));_0x188c1f(_0xa8e73b);})[_0xfba1('0x2a')](function(_0x1c5d5d){logger[_0xfba1('0x19')]('AddTags',_0x1c5d5d[_0xfba1('0x1b')],_0x4eb9aa);_0x12c293(_this['error'](0x1f4,_0x1c5d5d[_0xfba1('0x1b')]));});});}; \ No newline at end of file +var _0x76ea=['request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x30deae,_0x2dbed1){var _0x3730aa=function(_0x51ced3){while(--_0x51ced3){_0x30deae['push'](_0x30deae['shift']());}};_0x3730aa(++_0x2dbed1);}(_0x76ea,0x1bb));var _0xa76e=function(_0x21afaa,_0x1ed6e2){_0x21afaa=_0x21afaa-0x0;var _0x293c46=_0x76ea[_0x21afaa];return _0x293c46;};'use strict';var _=require('lodash');var util=require(_0xa76e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa76e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa76e('0x2'))['db'];var utils=require(_0xa76e('0x3'));var logger=require(_0xa76e('0x4'))(_0xa76e('0x5'));var config=require(_0xa76e('0x6'));var jayson=require(_0xa76e('0x7'));var client=jayson[_0xa76e('0x8')][_0xa76e('0x9')]({'port':0x232a});config[_0xa76e('0xa')]=_[_0xa76e('0xb')](config[_0xa76e('0xa')],{'host':_0xa76e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa76e('0xa')]));require(_0xa76e('0xd'))[_0xa76e('0xe')](socket);function respondWithRpcPromise(_0x30e006,_0xc41717,_0x413de7){return new BPromise(function(_0x4ae5d8,_0x567550){return client[_0xa76e('0xf')](_0x30e006,_0x413de7)[_0xa76e('0x10')](function(_0x254c61){logger[_0xa76e('0x11')](_0xa76e('0x12'),_0xc41717,_0xa76e('0x13'));logger[_0xa76e('0x14')](_0xa76e('0x15'),_0xc41717,_0xa76e('0x13'),JSON[_0xa76e('0x16')](_0x254c61));if(_0x254c61[_0xa76e('0x17')]){if(_0x254c61['error'][_0xa76e('0x18')]===0x1f4){logger[_0xa76e('0x17')](_0xa76e('0x12'),_0xc41717,_0x254c61['error'][_0xa76e('0x19')]);return _0x567550(_0x254c61[_0xa76e('0x17')]['message']);}logger['error'](_0xa76e('0x12'),_0xc41717,_0x254c61[_0xa76e('0x17')][_0xa76e('0x19')]);return _0x4ae5d8(_0x254c61[_0xa76e('0x17')][_0xa76e('0x19')]);}else{logger[_0xa76e('0x11')](_0xa76e('0x12'),_0xc41717,_0xa76e('0x13'));_0x4ae5d8(_0x254c61[_0xa76e('0x1a')][_0xa76e('0x19')]);}})['catch'](function(_0x248c5a){logger['error'](_0xa76e('0x12'),_0xc41717,_0x248c5a);_0x567550(_0x248c5a);});});}exports[_0xa76e('0x1b')]=function(_0x5c69af){var _0x26a753=this;return new Promise(function(_0x4e6fde,_0x558db8){return db[_0xa76e('0x1c')]['update'](_0x5c69af[_0xa76e('0x1d')],{'raw':_0x5c69af[_0xa76e('0x1e')]?_0x5c69af['options'][_0xa76e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c69af[_0xa76e('0x1e')]?_0x5c69af[_0xa76e('0x1e')]['where']||null:null,'attributes':_0x5c69af['options']?_0x5c69af[_0xa76e('0x1e')][_0xa76e('0x20')]||null:null,'limit':_0x5c69af[_0xa76e('0x1e')]?_0x5c69af[_0xa76e('0x1e')][_0xa76e('0x21')]||null:null})[_0xa76e('0x10')](function(_0x42bd8c){logger[_0xa76e('0x11')](_0xa76e('0x1b'),_0x5c69af);logger[_0xa76e('0x14')](_0xa76e('0x1b'),_0x5c69af,JSON[_0xa76e('0x16')](_0x42bd8c));_0x4e6fde(_0x42bd8c);})[_0xa76e('0x22')](function(_0x1c5c06){logger[_0xa76e('0x17')](_0xa76e('0x1b'),_0x1c5c06['message'],_0x5c69af);_0x558db8(_0x26a753[_0xa76e('0x17')](0x1f4,_0x1c5c06[_0xa76e('0x19')]));});});};exports[_0xa76e('0x23')]=function(_0x54409d){return new Promise(function(_0x509bb2,_0x51750e){return db[_0xa76e('0x1c')][_0xa76e('0x24')]({'where':_0x54409d[_0xa76e('0x1e')]?_0x54409d[_0xa76e('0x1e')]['where']||null:null})[_0xa76e('0x10')](function(_0x27bb0a){if(_0x27bb0a){return _0x27bb0a[_0xa76e('0x25')](_0x54409d['body'][_0xa76e('0x26')],_[_0xa76e('0x27')](_0x54409d[_0xa76e('0x1d')],[_0xa76e('0x26'),'id'])||{});}})[_0xa76e('0x28')](function(_0x466c69){logger['info']('AddTags',_0x54409d);logger[_0xa76e('0x14')](_0xa76e('0x29'),_0x54409d,JSON[_0xa76e('0x16')](_0x466c69));_0x509bb2(_0x466c69);})['catch'](function(_0x209bec){logger['error'](_0xa76e('0x29'),_0x209bec[_0xa76e('0x19')],_0x54409d);_0x51750e(_this['error'](0x1f4,_0x209bec[_0xa76e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 59f5961..8fd3335 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 _0xd177=['emit','register','length','save','remove','update'];(function(_0x58ac9b,_0x35dc04){var _0x12a47d=function(_0x2af5ce){while(--_0x2af5ce){_0x58ac9b['push'](_0x58ac9b['shift']());}};_0x12a47d(++_0x35dc04);}(_0xd177,0xed));var _0x7d17=function(_0x503ac0,_0x2eafd5){_0x503ac0=_0x503ac0-0x0;var _0xd4d227=_0xd177[_0x503ac0];return _0xd4d227;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7d17('0x0'),_0x7d17('0x1'),_0x7d17('0x2')];function createListener(_0x2eafa0,_0x1cc56c){return function(_0x1c248d){_0x1cc56c[_0x7d17('0x3')](_0x2eafa0,_0x1c248d);};}function removeListener(_0x54240f,_0x21cc5f){return function(){OpenchannelInteractionEvents['removeListener'](_0x54240f,_0x21cc5f);};}exports[_0x7d17('0x4')]=function(_0xbf1012){for(var _0x1f2f84=0x0,_0xd280e8=events[_0x7d17('0x5')];_0x1f2f84<_0xd280e8;_0x1f2f84++){var _0x2dfb97=events[_0x1f2f84];var _0x1b39f9=createListener('openchannelInteraction:'+_0x2dfb97,_0xbf1012);OpenchannelInteractionEvents['on'](_0x2dfb97,_0x1b39f9);}}; \ No newline at end of file +var _0x442e=['register','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0x58d0bc,_0x48c016){var _0x28cfcc=function(_0x5ecfc5){while(--_0x5ecfc5){_0x58d0bc['push'](_0x58d0bc['shift']());}};_0x28cfcc(++_0x48c016);}(_0x442e,0x11b));var _0xe442=function(_0x2a7bdb,_0x564b64){_0x2a7bdb=_0x2a7bdb-0x0;var _0x284acc=_0x442e[_0x2a7bdb];return _0x284acc;};'use strict';var OpenchannelInteractionEvents=require(_0xe442('0x0'));var events=[_0xe442('0x1'),_0xe442('0x2'),'update'];function createListener(_0x2d7985,_0x35e233){return function(_0x2c19c8){_0x35e233[_0xe442('0x3')](_0x2d7985,_0x2c19c8);};}function removeListener(_0x547e15,_0x58e691){return function(){OpenchannelInteractionEvents[_0xe442('0x4')](_0x547e15,_0x58e691);};}exports[_0xe442('0x5')]=function(_0x7f7d25){for(var _0x3fdd78=0x0,_0x4966d1=events['length'];_0x3fdd78<_0x4966d1;_0x3fdd78++){var _0xb2270b=events[_0x3fdd78];var _0x4cc0ff=createListener('openchannelInteraction:'+_0xb2270b,_0x7f7d25);OpenchannelInteractionEvents['on'](_0xb2270b,_0x4cc0ff);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6c525d5..cfbd4be 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 _0x32d4=['/describe','describe','/:id','show','tracked','openchannelmessage:create','update','put','accept','reject','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated'];(function(_0x1023a2,_0x3ff10b){var _0x4c0356=function(_0x85d740){while(--_0x85d740){_0x1023a2['push'](_0x1023a2['shift']());}};_0x4c0356(++_0x3ff10b);}(_0x32d4,0x1d9));var _0x432d=function(_0x9df7be,_0x1f8254){_0x9df7be=_0x9df7be-0x0;var _0x35d233=_0x32d4[_0x9df7be];return _0x35d233;};'use strict';var multer=require(_0x432d('0x0'));var util=require(_0x432d('0x1'));var path=require(_0x432d('0x2'));var timeout=require(_0x432d('0x3'));var express=require('express');var router=express[_0x432d('0x4')]();var auth=require(_0x432d('0x5'));var interaction=require(_0x432d('0x6'));var config=require(_0x432d('0x7'));var controller=require(_0x432d('0x8'));router[_0x432d('0x9')]('/',auth[_0x432d('0xa')](),controller['index']);router['get'](_0x432d('0xb'),auth[_0x432d('0xa')](),controller[_0x432d('0xc')]);router['get'](_0x432d('0xd'),auth[_0x432d('0xa')](),controller[_0x432d('0xe')]);router['post']('/',auth[_0x432d('0xa')](),interaction[_0x432d('0xf')]('openchannel',_0x432d('0x10')),controller['create']);router['put'](_0x432d('0xd'),auth[_0x432d('0xa')](),controller[_0x432d('0x11')]);router[_0x432d('0x12')]('/:id/accept',auth[_0x432d('0xa')](),controller[_0x432d('0x13')]);router[_0x432d('0x12')]('/:id/reject',auth[_0x432d('0xa')](),controller[_0x432d('0x14')]);router[_0x432d('0x15')](_0x432d('0xd'),auth[_0x432d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1a83=['/describe','describe','/:id','show','tracked','openchannel','openchannelmessage:create','put','accept','reject','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index'];(function(_0x3cbe6b,_0x27f63c){var _0x2db0aa=function(_0x5547bb){while(--_0x5547bb){_0x3cbe6b['push'](_0x3cbe6b['shift']());}};_0x2db0aa(++_0x27f63c);}(_0x1a83,0x1c4));var _0x31a8=function(_0x146cb8,_0x36dad5){_0x146cb8=_0x146cb8-0x0;var _0x5388ba=_0x1a83[_0x146cb8];return _0x5388ba;};'use strict';var multer=require('multer');var util=require(_0x31a8('0x0'));var path=require('path');var timeout=require(_0x31a8('0x1'));var express=require('express');var router=express[_0x31a8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x31a8('0x3'));var config=require('../../config/environment');var controller=require(_0x31a8('0x4'));router[_0x31a8('0x5')]('/',auth[_0x31a8('0x6')](),controller[_0x31a8('0x7')]);router[_0x31a8('0x5')](_0x31a8('0x8'),auth[_0x31a8('0x6')](),controller[_0x31a8('0x9')]);router[_0x31a8('0x5')](_0x31a8('0xa'),auth[_0x31a8('0x6')](),controller[_0x31a8('0xb')]);router['post']('/',auth[_0x31a8('0x6')](),interaction[_0x31a8('0xc')](_0x31a8('0xd'),_0x31a8('0xe')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x31a8('0xf')]('/:id/accept',auth['isAuthenticated'](),controller[_0x31a8('0x10')]);router['put']('/:id/reject',auth[_0x31a8('0x6')](),controller[_0x31a8('0x11')]);router['delete'](_0x31a8('0xa'),auth[_0x31a8('0x6')](),controller[_0x31a8('0x12')]);module[_0x31a8('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 60b5af9..df80012 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 _0xa1d0=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x315861,_0x735b4){var _0x3e2b76=function(_0x436457){while(--_0x436457){_0x315861['push'](_0x315861['shift']());}};_0x3e2b76(++_0x735b4);}(_0xa1d0,0x127));var _0x0a1d=function(_0x251124,_0x54d2af){_0x251124=_0x251124-0x0;var _0x351162=_0xa1d0[_0x251124];return _0x351162;};'use strict';var Sequelize=require(_0x0a1d('0x0'));module[_0x0a1d('0x1')]={'body':{'type':Sequelize[_0x0a1d('0x2')](_0x0a1d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0a1d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0a1d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0a1d('0x5')]('in',_0x0a1d('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0a1d('0x7')]},'providerName':{'type':Sequelize[_0x0a1d('0x8')]},'providerResponse':{'type':Sequelize[_0x0a1d('0x2')]}}; \ No newline at end of file +var _0x2deb=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x24c2e5,_0x141176){var _0x359ba4=function(_0x5cdf52){while(--_0x5cdf52){_0x24c2e5['push'](_0x24c2e5['shift']());}};_0x359ba4(++_0x141176);}(_0x2deb,0xa7));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb2de('0x0'));module[_0xb2de('0x1')]={'body':{'type':Sequelize[_0xb2de('0x2')](_0xb2de('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb2de('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb2de('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb2de('0x5')]('in','out'),'defaultValue':_0xb2de('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb2de('0x7')]},'providerResponse':{'type':Sequelize[_0xb2de('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 269a642..4e713b9 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 _0x0439=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','status','count','offset','limit','Content-Range','json','apply','reject','then','destroy','end','sendStatus','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','update','describe','../../config/logger','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','event','EventManager','acceptmessage','openchannel-interactions','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','channel','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0439,0xdd));var _0x9043=function(_0x522df5,_0x3364ae){_0x522df5=_0x522df5-0x0;var _0x3fffd4=_0x0439[_0x522df5];return _0x3fffd4;};'use strict';var pdf=require(_0x9043('0x0'));var emlformat=require(_0x9043('0x1'));var rimraf=require(_0x9043('0x2'));var zipdir=require(_0x9043('0x3'));var jsonpatch=require(_0x9043('0x4'));var rp=require(_0x9043('0x5'));var moment=require(_0x9043('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9043('0x7'));var util=require(_0x9043('0x8'));var path=require(_0x9043('0x9'));var sox=require('sox');var csv=require(_0x9043('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9043('0xb'));var crypto=require(_0x9043('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9043('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9043('0xe'));var Papa=require(_0x9043('0xf'));var Redis=require('ioredis');var authService=require(_0x9043('0x10'));var qs=require(_0x9043('0x11'));var as=require(_0x9043('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9043('0x13'));var utils=require(_0x9043('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9043('0x15'));var db=require(_0x9043('0x16'))['db'];config[_0x9043('0x17')]=_[_0x9043('0x18')](config[_0x9043('0x17')],{'host':_0x9043('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9043('0x17')]));require(_0x9043('0x1a'))['register'](socket);var jayson=require(_0x9043('0x1b'));var client=jayson[_0x9043('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x9043('0x1c')][_0x9043('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3aaee1,_0x2b3c2d,_0x1691e9,_0x2bd42e){return new BPromise(function(_0x13b613,_0x112f40){var _0x21f330=_0x2bd42e||client;return _0x21f330[_0x9043('0x1e')](_0x3aaee1,_0x1691e9)['then'](function(_0x584fd9){logger['info'](_0x9043('0x1f'),_0x2b3c2d,_0x9043('0x20'));logger[_0x9043('0x21')](_0x9043('0x22'),_0x2b3c2d,'request\x20sent',JSON[_0x9043('0x23')](_0x584fd9));if(_0x584fd9['error']){if(_0x584fd9['error'][_0x9043('0x24')]===0x1f4){logger[_0x9043('0x25')](_0x9043('0x1f'),_0x2b3c2d,_0x584fd9[_0x9043('0x25')][_0x9043('0x26')]);return _0x112f40(_0x584fd9[_0x9043('0x25')][_0x9043('0x26')]);}logger[_0x9043('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2b3c2d,_0x584fd9[_0x9043('0x25')][_0x9043('0x26')]);return _0x13b613(_0x584fd9[_0x9043('0x25')]['message']);}else{logger[_0x9043('0x27')](_0x9043('0x1f'),_0x2b3c2d,_0x9043('0x20'));_0x13b613(_0x584fd9[_0x9043('0x28')][_0x9043('0x26')]);}})['catch'](function(_0x16caf2){logger[_0x9043('0x25')](_0x9043('0x1f'),_0x2b3c2d,_0x16caf2);_0x112f40(_0x16caf2);});});}function respondWithStatusCode(_0x342d5e,_0x2003c3){_0x2003c3=_0x2003c3||0xcc;return function(_0x13e8dd){if(_0x13e8dd){return _0x342d5e['sendStatus'](_0x2003c3);}return _0x342d5e[_0x9043('0x29')](_0x2003c3)['end']();};}function respondWithResult(_0x45bec7,_0x2bcf73){_0x2bcf73=_0x2bcf73||0xc8;return function(_0x3a0ffd){if(_0x3a0ffd){return _0x45bec7[_0x9043('0x29')](_0x2bcf73)['json'](_0x3a0ffd);}};}function respondWithFilteredResult(_0xc92d75,_0x2e12b1){return function(_0x14cf80){if(_0x14cf80){var _0x228d7f=_0x14cf80[_0x9043('0x2a')],_0x37ecc2=_0x2e12b1[_0x9043('0x2b')],_0x590357=_0x2e12b1['offset']+_0x2e12b1[_0x9043('0x2c')],_0x352934;if(_0x590357>=_0x228d7f){_0x590357=_0x228d7f;_0x352934=0xc8;}else{_0x352934=0xce;}_0xc92d75[_0x9043('0x29')](_0x352934);return _0xc92d75['set'](_0x9043('0x2d'),_0x37ecc2+'-'+_0x590357+'/'+_0x228d7f)[_0x9043('0x2e')](_0x14cf80);}return null;};}function patchUpdates(_0x54e86d){return function(_0x21eb3d){try{jsonpatch[_0x9043('0x2f')](_0x21eb3d,_0x54e86d,!![]);}catch(_0x414320){return BPromise[_0x9043('0x30')](_0x414320);}return _0x21eb3d['save']();};}function saveUpdates(_0x307e5a,_0x321b9a){return function(_0x4913c5){if(_0x4913c5){return _0x4913c5['update'](_0x307e5a)[_0x9043('0x31')](function(_0x579277){return _0x579277;});}return null;};}function removeEntity(_0x1ef93a,_0x11a1be){return function(_0xb7aa24){if(_0xb7aa24){return _0xb7aa24[_0x9043('0x32')]()['then'](function(){_0x1ef93a['status'](0xcc)[_0x9043('0x33')]();});}};}function handleEntityNotFound(_0x446956,_0x391a82){return function(_0x119133){if(!_0x119133){_0x446956[_0x9043('0x34')](0x194);}return _0x119133;};}function handleError(_0x12a037,_0x2e3aeb){_0x2e3aeb=_0x2e3aeb||0x1f4;return function(_0x545727){logger[_0x9043('0x25')](_0x545727['stack']);if(_0x545727[_0x9043('0x35')]){delete _0x545727['name'];}_0x12a037[_0x9043('0x29')](_0x2e3aeb)[_0x9043('0x36')](_0x545727);};}exports['index']=function(_0x4eefe0,_0x20e145){var _0x2c8697={},_0x307bf0={},_0x22e07b={'count':0x0,'rows':[]};var _0x39ab02=_[_0x9043('0x37')](db[_0x9043('0x38')][_0x9043('0x39')],function(_0x27e4ec){return{'name':_0x27e4ec[_0x9043('0x3a')],'type':_0x27e4ec[_0x9043('0x3b')][_0x9043('0x3c')]};});_0x307bf0['model']=_[_0x9043('0x37')](_0x39ab02,'name');_0x307bf0[_0x9043('0x3d')]=_[_0x9043('0x3e')](_0x4eefe0['query']);_0x307bf0[_0x9043('0x3f')]=_[_0x9043('0x40')](_0x307bf0[_0x9043('0x41')],_0x307bf0['query']);_0x2c8697[_0x9043('0x42')]=_[_0x9043('0x40')](_0x307bf0[_0x9043('0x41')],qs[_0x9043('0x43')](_0x4eefe0[_0x9043('0x3d')][_0x9043('0x43')]));_0x2c8697[_0x9043('0x42')]=_0x2c8697[_0x9043('0x42')]['length']?_0x2c8697[_0x9043('0x42')]:_0x307bf0['model'];if(!_0x4eefe0['query'][_0x9043('0x44')]('nolimit')){_0x2c8697[_0x9043('0x2c')]=qs['limit'](_0x4eefe0[_0x9043('0x3d')][_0x9043('0x2c')]);_0x2c8697[_0x9043('0x2b')]=qs[_0x9043('0x2b')](_0x4eefe0[_0x9043('0x3d')][_0x9043('0x2b')]);}_0x2c8697['order']=qs[_0x9043('0x45')](_0x4eefe0[_0x9043('0x3d')][_0x9043('0x45')]);_0x2c8697['where']=qs[_0x9043('0x3f')](_[_0x9043('0x46')](_0x4eefe0['query'],_0x307bf0[_0x9043('0x3f')]),_0x39ab02);if(_0x4eefe0['query'][_0x9043('0x47')]){_0x2c8697[_0x9043('0x48')]=_['merge'](_0x2c8697['where'],{'$or':_[_0x9043('0x37')](_0x39ab02,function(_0x222a57){if(_0x222a57[_0x9043('0x3b')]!==_0x9043('0x49')){var _0x5e797b={};_0x5e797b[_0x222a57[_0x9043('0x35')]]={'$like':'%'+_0x4eefe0[_0x9043('0x3d')]['filter']+'%'};return _0x5e797b;}})});}_0x2c8697=_['merge']({},_0x2c8697,_0x4eefe0[_0x9043('0x4a')]);var _0x1748df={'where':_0x2c8697['where']};return db[_0x9043('0x38')][_0x9043('0x2a')](_0x1748df)[_0x9043('0x31')](function(_0x1c725f){_0x22e07b['count']=_0x1c725f;if(_0x4eefe0[_0x9043('0x3d')][_0x9043('0x4b')]){_0x2c8697['include']=[{'all':!![]}];}return db[_0x9043('0x38')][_0x9043('0x4c')](_0x2c8697);})[_0x9043('0x31')](function(_0x115c66){_0x22e07b[_0x9043('0x4d')]=_0x115c66;return _0x22e07b;})[_0x9043('0x31')](respondWithFilteredResult(_0x20e145,_0x2c8697))[_0x9043('0x4e')](handleError(_0x20e145,null));};exports[_0x9043('0x4f')]=function(_0x3d7c69,_0x45c3d3){var _0x123875={'raw':!![],'where':{'id':_0x3d7c69[_0x9043('0x50')]['id']}},_0x1619b1={};_0x1619b1[_0x9043('0x41')]=_['keys'](db[_0x9043('0x38')][_0x9043('0x39')]);_0x1619b1['query']=_[_0x9043('0x3e')](_0x3d7c69[_0x9043('0x3d')]);_0x1619b1[_0x9043('0x3f')]=_['intersection'](_0x1619b1['model'],_0x1619b1[_0x9043('0x3d')]);_0x123875[_0x9043('0x42')]=_[_0x9043('0x40')](_0x1619b1[_0x9043('0x41')],qs['fields'](_0x3d7c69[_0x9043('0x3d')][_0x9043('0x43')]));_0x123875[_0x9043('0x42')]=_0x123875[_0x9043('0x42')]['length']?_0x123875[_0x9043('0x42')]:_0x1619b1['model'];if(_0x3d7c69['query'][_0x9043('0x4b')]){_0x123875[_0x9043('0x51')]=[{'all':!![]}];}_0x123875=_[_0x9043('0x52')]({},_0x123875,_0x3d7c69[_0x9043('0x4a')]);return db[_0x9043('0x38')][_0x9043('0x53')](_0x123875)[_0x9043('0x31')](handleEntityNotFound(_0x45c3d3,null))[_0x9043('0x31')](respondWithResult(_0x45c3d3,null))[_0x9043('0x4e')](handleError(_0x45c3d3,null));};exports[_0x9043('0x54')]=function(_0x156a6d,_0x2f3b6a){return db[_0x9043('0x38')][_0x9043('0x54')](_0x156a6d[_0x9043('0x55')],{})['then'](respondWithResult(_0x2f3b6a,0xc9))['catch'](handleError(_0x2f3b6a,null));};exports[_0x9043('0x56')]=function(_0x3070f5,_0x4d99c3){if(_0x3070f5[_0x9043('0x55')]['id']){delete _0x3070f5['body']['id'];}return db[_0x9043('0x38')][_0x9043('0x53')]({'where':{'id':_0x3070f5[_0x9043('0x50')]['id']}})[_0x9043('0x31')](handleEntityNotFound(_0x4d99c3,null))[_0x9043('0x31')](saveUpdates(_0x3070f5[_0x9043('0x55')],null))[_0x9043('0x31')](respondWithResult(_0x4d99c3,null))[_0x9043('0x4e')](handleError(_0x4d99c3,null));};exports[_0x9043('0x32')]=function(_0xdf54bd,_0x29b510){return db['OpenchannelMessage'][_0x9043('0x53')]({'where':{'id':_0xdf54bd[_0x9043('0x50')]['id']}})[_0x9043('0x31')](handleEntityNotFound(_0x29b510,null))[_0x9043('0x31')](removeEntity(_0x29b510,null))['catch'](handleError(_0x29b510,null));};exports[_0x9043('0x57')]=function(_0x265a32,_0x459b8b){return db[_0x9043('0x38')][_0x9043('0x57')]()['then'](respondWithResult(_0x459b8b,null))[_0x9043('0x4e')](handleError(_0x459b8b,null));};var interaction_log=require(_0x9043('0x58'))('openchannel-interactions');exports[_0x9043('0x59')]=function(_0x22de5a,_0x2d999d,_0x1996ce){var _0x32a29e={'channel':_0x9043('0x5a')};if(_0x22de5a['body']['id']){delete _0x22de5a['body']['id'];}_0x22de5a['body']['read']=!![];_0x22de5a[_0x9043('0x55')]['readAt']=moment()[_0x9043('0x5b')](_0x9043('0x5c'));_0x22de5a[_0x9043('0x55')]['UserId']=_0x22de5a[_0x9043('0x55')][_0x9043('0x5d')]||_0x22de5a[_0x9043('0x5e')]['id'];return db[_0x9043('0x38')][_0x9043('0x53')]({'where':{'id':_0x22de5a[_0x9043('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x9043('0x5f')],'as':_0x9043('0x60')}]})[_0x9043('0x31')](handleEntityNotFound(_0x2d999d,null))['then'](saveUpdates(_0x22de5a[_0x9043('0x55')],null))[_0x9043('0x31')](function(_0x349669){if(_0x349669){_0x32a29e[_0x9043('0x26')]=_0x349669[_0x9043('0x61')]({'plain':!![]});return db[_0x9043('0x62')][_0x9043('0x53')]({'where':{'id':_0x349669[_0x9043('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2d999d,null))[_0x9043('0x31')](function(_0x4b9158){if(_0x4b9158){return _0x4b9158[_0x9043('0x56')]({'UserId':_0x22de5a[_0x9043('0x55')]['UserId'],'read1stAt':_['isNil'](_0x4b9158['read1stAt'])?moment()[_0x9043('0x5b')](_0x9043('0x5c')):undefined});}return null;})['then'](function(_0x11856a){if(_0x11856a){_0x32a29e[_0x9043('0x64')]=_0x11856a['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22de5a[_0x9043('0x5e')]['id'],_0x22de5a[_0x9043('0x5e')]['name'],_0x22de5a['user'][_0x9043('0x65')],_0x32a29e[_0x9043('0x64')]['id'],_0x22de5a[_0x9043('0x55')]?JSON[_0x9043('0x23')](_0x22de5a[_0x9043('0x55')]):_0x9043('0x66'));return respondWithRpcPromise(_0x9043('0x67'),_0x9043('0x68'),_0x32a29e);}return null;})[_0x9043('0x31')](function(_0x1696bc){if(_0x1696bc){if(_0x22de5a['body'][_0x9043('0x69')]){_0x32a29e[_0x9043('0x26')][_0x9043('0x6a')]=util['format']('SIP/%s',_0x22de5a[_0x9043('0x5e')][_0x9043('0x35')]);_0x32a29e[_0x9043('0x26')]['channel']=_0x32a29e['channel'];_0x32a29e[_0x9043('0x26')][_0x9043('0x6b')]='accept';return respondWithRpcPromise(_0x9043('0x6c'),_0x9043('0x6c'),{'event':_0x9043('0x6d'),'message':_0x32a29e[_0x9043('0x26')]},client9002)[_0x9043('0x31')](function(){return _0x32a29e;});}return _0x32a29e;}return null;})['then'](respondWithResult(_0x2d999d,null))[_0x9043('0x4e')](handleError(_0x2d999d,null));};var interaction_log=require(_0x9043('0x58'))(_0x9043('0x6e'));exports['reject']=function(_0xf300d8,_0x3f5449,_0x69aea){var _0x2a2229={'agent':{},'channel':'openchannel'};if(_0xf300d8[_0x9043('0x55')]['id']){delete _0xf300d8[_0x9043('0x55')]['id'];}_0xf300d8['body'][_0x9043('0x5d')]=_0xf300d8[_0x9043('0x55')][_0x9043('0x5d')]||_0xf300d8[_0x9043('0x5e')]['id'];_0x2a2229[_0x9043('0x6f')]['id']=_0xf300d8['body'][_0x9043('0x5d')];return db[_0x9043('0x38')][_0x9043('0x53')]({'where':{'id':_0xf300d8['params']['id'],'UserId':null}})[_0x9043('0x31')](handleEntityNotFound(_0x3f5449,null))['then'](function(_0x9dae43){if(_0x9dae43){_0x2a2229['message']=_0x9dae43[_0x9043('0x61')]({'plain':!![]});return db[_0x9043('0x62')][_0x9043('0x53')]({'where':{'id':_0x9dae43[_0x9043('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3f5449,null))[_0x9043('0x31')](function(_0x5675a6){if(_0x5675a6){_0x2a2229[_0x9043('0x64')]=_0x5675a6[_0x9043('0x61')]({'plain':!![]});interaction_log[_0x9043('0x27')](_0x9043('0x70'),_0xf300d8['user']['id'],_0xf300d8[_0x9043('0x5e')][_0x9043('0x35')],_0xf300d8[_0x9043('0x5e')][_0x9043('0x65')],_0x2a2229[_0x9043('0x64')]['id'],_0xf300d8[_0x9043('0x55')]?JSON['stringify'](_0xf300d8[_0x9043('0x55')]):_0x9043('0x66'));return respondWithRpcPromise(_0x9043('0x71'),'rejectMessage',_0x2a2229);}return null;})[_0x9043('0x31')](function(_0x120c02){if(_0x120c02){_0x120c02[_0x9043('0x26')][_0x9043('0x6a')]=util[_0x9043('0x5b')](_0x9043('0x72'),_0xf300d8[_0x9043('0x5e')]['name']);_0x120c02['message'][_0x9043('0x73')]=_0x2a2229[_0x9043('0x73')];_0x120c02[_0x9043('0x26')][_0x9043('0x6b')]=_0x9043('0x30');respondWithRpcPromise(_0x9043('0x6c'),_0x9043('0x6c'),{'event':_0x9043('0x74'),'message':_0x120c02[_0x9043('0x26')]},client9002);return _0x2a2229;}return null;})['then'](respondWithResult(_0x3f5449,null))[_0x9043('0x4e')](handleError(_0x3f5449,null));}; \ No newline at end of file +var _0x9d02=['includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','user','interaction','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','openchannel-interactions','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','map','OpenchannelMessage','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d02,0x118));var _0x29d0=function(_0x1a0c8c,_0x531752){_0x1a0c8c=_0x1a0c8c-0x0;var _0x1fb71a=_0x9d02[_0x1a0c8c];return _0x1fb71a;};'use strict';var pdf=require(_0x29d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x29d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29d0('0x2'));var rp=require('request-promise');var moment=require(_0x29d0('0x3'));var BPromise=require(_0x29d0('0x4'));var Mustache=require('mustache');var util=require(_0x29d0('0x5'));var path=require(_0x29d0('0x6'));var sox=require(_0x29d0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x29d0('0x8'));var crypto=require(_0x29d0('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x29d0('0xa'));var toCsv=require(_0x29d0('0xb'));var querystring=require('querystring');var Papa=require(_0x29d0('0xc'));var Redis=require(_0x29d0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x29d0('0xe'));var as=require(_0x29d0('0xf'));var hardwareService=require(_0x29d0('0x10'));var logger=require(_0x29d0('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x29d0('0x12'));var licenseUtil=require(_0x29d0('0x13'));var db=require(_0x29d0('0x14'))['db'];config[_0x29d0('0x15')]=_[_0x29d0('0x16')](config[_0x29d0('0x15')],{'host':_0x29d0('0x17'),'port':0x18eb});var socket=require(_0x29d0('0x18'))(new Redis(config[_0x29d0('0x15')]));require('./openchannelMessage.socket')[_0x29d0('0x19')](socket);var jayson=require(_0x29d0('0x1a'));var client=jayson[_0x29d0('0x1b')][_0x29d0('0x1c')]({'port':0x232c});var client9002=jayson[_0x29d0('0x1b')][_0x29d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x55ba12,_0x24562f,_0x1826d0,_0x75a016){return new BPromise(function(_0x49e919,_0x2f30a5){var _0x6964fa=_0x75a016||client;return _0x6964fa[_0x29d0('0x1d')](_0x55ba12,_0x1826d0)[_0x29d0('0x1e')](function(_0x2b83e7){logger[_0x29d0('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x24562f,_0x29d0('0x20'));logger[_0x29d0('0x21')](_0x29d0('0x22'),_0x24562f,_0x29d0('0x20'),JSON[_0x29d0('0x23')](_0x2b83e7));if(_0x2b83e7[_0x29d0('0x24')]){if(_0x2b83e7['error'][_0x29d0('0x25')]===0x1f4){logger[_0x29d0('0x24')](_0x29d0('0x26'),_0x24562f,_0x2b83e7['error'][_0x29d0('0x27')]);return _0x2f30a5(_0x2b83e7[_0x29d0('0x24')][_0x29d0('0x27')]);}logger[_0x29d0('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x24562f,_0x2b83e7[_0x29d0('0x24')][_0x29d0('0x27')]);return _0x49e919(_0x2b83e7[_0x29d0('0x24')]['message']);}else{logger[_0x29d0('0x1f')](_0x29d0('0x26'),_0x24562f,_0x29d0('0x20'));_0x49e919(_0x2b83e7[_0x29d0('0x28')][_0x29d0('0x27')]);}})[_0x29d0('0x29')](function(_0x39037a){logger['error'](_0x29d0('0x26'),_0x24562f,_0x39037a);_0x2f30a5(_0x39037a);});});}function respondWithStatusCode(_0x109b77,_0x15b166){_0x15b166=_0x15b166||0xcc;return function(_0x110472){if(_0x110472){return _0x109b77[_0x29d0('0x2a')](_0x15b166);}return _0x109b77[_0x29d0('0x2b')](_0x15b166)['end']();};}function respondWithResult(_0x342a0d,_0x4b6012){_0x4b6012=_0x4b6012||0xc8;return function(_0x435918){if(_0x435918){return _0x342a0d['status'](_0x4b6012)[_0x29d0('0x2c')](_0x435918);}};}function respondWithFilteredResult(_0x275f80,_0x3b5174){return function(_0x27de66){if(_0x27de66){var _0x9573ff=_0x27de66[_0x29d0('0x2d')],_0x2732da=_0x3b5174[_0x29d0('0x2e')],_0x43f981=_0x3b5174[_0x29d0('0x2e')]+_0x3b5174['limit'],_0x1d2735;if(_0x43f981>=_0x9573ff){_0x43f981=_0x9573ff;_0x1d2735=0xc8;}else{_0x1d2735=0xce;}_0x275f80[_0x29d0('0x2b')](_0x1d2735);return _0x275f80[_0x29d0('0x2f')](_0x29d0('0x30'),_0x2732da+'-'+_0x43f981+'/'+_0x9573ff)['json'](_0x27de66);}return null;};}function patchUpdates(_0x340a8e){return function(_0x557be7){try{jsonpatch[_0x29d0('0x31')](_0x557be7,_0x340a8e,!![]);}catch(_0x52619a){return BPromise[_0x29d0('0x32')](_0x52619a);}return _0x557be7['save']();};}function saveUpdates(_0x3be5dd,_0x5cd7a3){return function(_0x370d0f){if(_0x370d0f){return _0x370d0f[_0x29d0('0x33')](_0x3be5dd)[_0x29d0('0x1e')](function(_0x321771){return _0x321771;});}return null;};}function removeEntity(_0x3cfbe4,_0x5054d4){return function(_0x266701){if(_0x266701){return _0x266701[_0x29d0('0x34')]()['then'](function(){_0x3cfbe4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57f049,_0x3c126a){return function(_0x50f98e){if(!_0x50f98e){_0x57f049[_0x29d0('0x2a')](0x194);}return _0x50f98e;};}function handleError(_0x279264,_0x2f992c){_0x2f992c=_0x2f992c||0x1f4;return function(_0x3f4305){logger['error'](_0x3f4305[_0x29d0('0x35')]);if(_0x3f4305[_0x29d0('0x36')]){delete _0x3f4305[_0x29d0('0x36')];}_0x279264['status'](_0x2f992c)['send'](_0x3f4305);};}exports['index']=function(_0x4bd1cf,_0x4576a8){var _0x26d731={},_0xa5ee11={},_0x44c558={'count':0x0,'rows':[]};var _0x13f8dd=_[_0x29d0('0x37')](db[_0x29d0('0x38')]['rawAttributes'],function(_0x3e7198){return{'name':_0x3e7198[_0x29d0('0x39')],'type':_0x3e7198[_0x29d0('0x3a')]['key']};});_0xa5ee11[_0x29d0('0x3b')]=_['map'](_0x13f8dd,_0x29d0('0x36'));_0xa5ee11['query']=_['keys'](_0x4bd1cf[_0x29d0('0x3c')]);_0xa5ee11[_0x29d0('0x3d')]=_[_0x29d0('0x3e')](_0xa5ee11['model'],_0xa5ee11[_0x29d0('0x3c')]);_0x26d731[_0x29d0('0x3f')]=_[_0x29d0('0x3e')](_0xa5ee11[_0x29d0('0x3b')],qs[_0x29d0('0x40')](_0x4bd1cf[_0x29d0('0x3c')][_0x29d0('0x40')]));_0x26d731['attributes']=_0x26d731['attributes'][_0x29d0('0x41')]?_0x26d731['attributes']:_0xa5ee11[_0x29d0('0x3b')];if(!_0x4bd1cf[_0x29d0('0x3c')][_0x29d0('0x42')](_0x29d0('0x43'))){_0x26d731[_0x29d0('0x44')]=qs['limit'](_0x4bd1cf[_0x29d0('0x3c')][_0x29d0('0x44')]);_0x26d731[_0x29d0('0x2e')]=qs[_0x29d0('0x2e')](_0x4bd1cf['query'][_0x29d0('0x2e')]);}_0x26d731[_0x29d0('0x45')]=qs[_0x29d0('0x46')](_0x4bd1cf[_0x29d0('0x3c')][_0x29d0('0x46')]);_0x26d731[_0x29d0('0x47')]=qs[_0x29d0('0x3d')](_[_0x29d0('0x48')](_0x4bd1cf[_0x29d0('0x3c')],_0xa5ee11[_0x29d0('0x3d')]),_0x13f8dd);if(_0x4bd1cf[_0x29d0('0x3c')][_0x29d0('0x49')]){_0x26d731[_0x29d0('0x47')]=_[_0x29d0('0x4a')](_0x26d731['where'],{'$or':_[_0x29d0('0x37')](_0x13f8dd,function(_0x51c475){if(_0x51c475[_0x29d0('0x3a')]!==_0x29d0('0x4b')){var _0x2c9fc0={};_0x2c9fc0[_0x51c475['name']]={'$like':'%'+_0x4bd1cf['query'][_0x29d0('0x49')]+'%'};return _0x2c9fc0;}})});}_0x26d731=_[_0x29d0('0x4a')]({},_0x26d731,_0x4bd1cf[_0x29d0('0x4c')]);var _0xef5756={'where':_0x26d731['where']};return db[_0x29d0('0x38')][_0x29d0('0x2d')](_0xef5756)[_0x29d0('0x1e')](function(_0x1b7a59){_0x44c558[_0x29d0('0x2d')]=_0x1b7a59;if(_0x4bd1cf[_0x29d0('0x3c')][_0x29d0('0x4d')]){_0x26d731['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x29d0('0x4e')](_0x26d731);})[_0x29d0('0x1e')](function(_0x53af44){_0x44c558[_0x29d0('0x4f')]=_0x53af44;return _0x44c558;})['then'](respondWithFilteredResult(_0x4576a8,_0x26d731))[_0x29d0('0x29')](handleError(_0x4576a8,null));};exports[_0x29d0('0x50')]=function(_0x387c66,_0x47d66d){var _0x4dab1e={'raw':!![],'where':{'id':_0x387c66[_0x29d0('0x51')]['id']}},_0x355890={};_0x355890[_0x29d0('0x3b')]=_['keys'](db['OpenchannelMessage'][_0x29d0('0x52')]);_0x355890['query']=_[_0x29d0('0x53')](_0x387c66[_0x29d0('0x3c')]);_0x355890['filters']=_[_0x29d0('0x3e')](_0x355890[_0x29d0('0x3b')],_0x355890[_0x29d0('0x3c')]);_0x4dab1e[_0x29d0('0x3f')]=_['intersection'](_0x355890[_0x29d0('0x3b')],qs[_0x29d0('0x40')](_0x387c66[_0x29d0('0x3c')][_0x29d0('0x40')]));_0x4dab1e['attributes']=_0x4dab1e['attributes'][_0x29d0('0x41')]?_0x4dab1e[_0x29d0('0x3f')]:_0x355890[_0x29d0('0x3b')];if(_0x387c66[_0x29d0('0x3c')][_0x29d0('0x4d')]){_0x4dab1e[_0x29d0('0x54')]=[{'all':!![]}];}_0x4dab1e=_[_0x29d0('0x4a')]({},_0x4dab1e,_0x387c66[_0x29d0('0x4c')]);return db['OpenchannelMessage'][_0x29d0('0x55')](_0x4dab1e)[_0x29d0('0x1e')](handleEntityNotFound(_0x47d66d,null))['then'](respondWithResult(_0x47d66d,null))[_0x29d0('0x29')](handleError(_0x47d66d,null));};exports[_0x29d0('0x56')]=function(_0x344891,_0x4f2605){return db['OpenchannelMessage'][_0x29d0('0x56')](_0x344891[_0x29d0('0x57')],{})[_0x29d0('0x1e')](respondWithResult(_0x4f2605,0xc9))[_0x29d0('0x29')](handleError(_0x4f2605,null));};exports['update']=function(_0x2f3566,_0x31b1b8){if(_0x2f3566[_0x29d0('0x57')]['id']){delete _0x2f3566['body']['id'];}return db[_0x29d0('0x38')][_0x29d0('0x55')]({'where':{'id':_0x2f3566['params']['id']}})[_0x29d0('0x1e')](handleEntityNotFound(_0x31b1b8,null))[_0x29d0('0x1e')](saveUpdates(_0x2f3566[_0x29d0('0x57')],null))['then'](respondWithResult(_0x31b1b8,null))['catch'](handleError(_0x31b1b8,null));};exports[_0x29d0('0x34')]=function(_0x2afdf3,_0x4b73a2){return db[_0x29d0('0x38')][_0x29d0('0x55')]({'where':{'id':_0x2afdf3[_0x29d0('0x51')]['id']}})[_0x29d0('0x1e')](handleEntityNotFound(_0x4b73a2,null))['then'](removeEntity(_0x4b73a2,null))[_0x29d0('0x29')](handleError(_0x4b73a2,null));};exports[_0x29d0('0x58')]=function(_0x483571,_0x2ba1ce){return db[_0x29d0('0x38')][_0x29d0('0x58')]()['then'](respondWithResult(_0x2ba1ce,null))['catch'](handleError(_0x2ba1ce,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x29d0('0x59')]=function(_0x5c94dc,_0x1980cc,_0x3a583a){var _0x27874f={'channel':_0x29d0('0x5a')};if(_0x5c94dc[_0x29d0('0x57')]['id']){delete _0x5c94dc[_0x29d0('0x57')]['id'];}_0x5c94dc[_0x29d0('0x57')][_0x29d0('0x5b')]=!![];_0x5c94dc[_0x29d0('0x57')][_0x29d0('0x5c')]=moment()[_0x29d0('0x5d')](_0x29d0('0x5e'));_0x5c94dc['body'][_0x29d0('0x5f')]=_0x5c94dc[_0x29d0('0x57')][_0x29d0('0x5f')]||_0x5c94dc['user']['id'];return db[_0x29d0('0x38')]['find']({'where':{'id':_0x5c94dc[_0x29d0('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x29d0('0x60')],'as':_0x29d0('0x61')}]})[_0x29d0('0x1e')](handleEntityNotFound(_0x1980cc,null))['then'](saveUpdates(_0x5c94dc[_0x29d0('0x57')],null))['then'](function(_0x524918){if(_0x524918){_0x27874f['message']=_0x524918[_0x29d0('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x29d0('0x55')]({'where':{'id':_0x524918[_0x29d0('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x1980cc,null))[_0x29d0('0x1e')](function(_0x164e19){if(_0x164e19){return _0x164e19[_0x29d0('0x33')]({'UserId':_0x5c94dc[_0x29d0('0x57')][_0x29d0('0x5f')],'read1stAt':_[_0x29d0('0x64')](_0x164e19[_0x29d0('0x65')])?moment()[_0x29d0('0x5d')](_0x29d0('0x5e')):undefined});}return null;})[_0x29d0('0x1e')](function(_0x205874){if(_0x205874){_0x27874f['interaction']=_0x205874[_0x29d0('0x62')]({'plain':!![]});interaction_log[_0x29d0('0x1f')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c94dc[_0x29d0('0x66')]['id'],_0x5c94dc['user'][_0x29d0('0x36')],_0x5c94dc['user']['role'],_0x27874f[_0x29d0('0x67')]['id'],_0x5c94dc[_0x29d0('0x57')]?JSON[_0x29d0('0x23')](_0x5c94dc[_0x29d0('0x57')]):_0x29d0('0x68'));return respondWithRpcPromise(_0x29d0('0x69'),_0x29d0('0x6a'),_0x27874f);}return null;})[_0x29d0('0x1e')](function(_0x17564d){if(_0x17564d){if(_0x5c94dc[_0x29d0('0x57')][_0x29d0('0x6b')]){_0x27874f[_0x29d0('0x27')][_0x29d0('0x6c')]=util[_0x29d0('0x5d')]('SIP/%s',_0x5c94dc[_0x29d0('0x66')]['name']);_0x27874f[_0x29d0('0x27')][_0x29d0('0x6d')]=_0x27874f['channel'];_0x27874f[_0x29d0('0x27')][_0x29d0('0x6e')]='accept';return respondWithRpcPromise(_0x29d0('0x6f'),_0x29d0('0x6f'),{'event':_0x29d0('0x70'),'message':_0x27874f[_0x29d0('0x27')]},client9002)[_0x29d0('0x1e')](function(){return _0x27874f;});}return _0x27874f;}return null;})[_0x29d0('0x1e')](respondWithResult(_0x1980cc,null))[_0x29d0('0x29')](handleError(_0x1980cc,null));};var interaction_log=require(_0x29d0('0x11'))(_0x29d0('0x71'));exports[_0x29d0('0x32')]=function(_0x4868d5,_0x186034,_0x3122cd){var _0x531fe7={'agent':{},'channel':_0x29d0('0x5a')};if(_0x4868d5['body']['id']){delete _0x4868d5['body']['id'];}_0x4868d5[_0x29d0('0x57')][_0x29d0('0x5f')]=_0x4868d5[_0x29d0('0x57')][_0x29d0('0x5f')]||_0x4868d5[_0x29d0('0x66')]['id'];_0x531fe7[_0x29d0('0x72')]['id']=_0x4868d5['body'][_0x29d0('0x5f')];return db[_0x29d0('0x38')]['find']({'where':{'id':_0x4868d5[_0x29d0('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x186034,null))[_0x29d0('0x1e')](function(_0x24bc33){if(_0x24bc33){_0x531fe7[_0x29d0('0x27')]=_0x24bc33[_0x29d0('0x62')]({'plain':!![]});return db[_0x29d0('0x73')][_0x29d0('0x55')]({'where':{'id':_0x24bc33[_0x29d0('0x63')]}});}return null;})[_0x29d0('0x1e')](handleEntityNotFound(_0x186034,null))[_0x29d0('0x1e')](function(_0x5f44fd){if(_0x5f44fd){_0x531fe7[_0x29d0('0x67')]=_0x5f44fd['get']({'plain':!![]});interaction_log['info'](_0x29d0('0x74'),_0x4868d5[_0x29d0('0x66')]['id'],_0x4868d5[_0x29d0('0x66')][_0x29d0('0x36')],_0x4868d5[_0x29d0('0x66')][_0x29d0('0x75')],_0x531fe7[_0x29d0('0x67')]['id'],_0x4868d5[_0x29d0('0x57')]?JSON[_0x29d0('0x23')](_0x4868d5['body']):_0x29d0('0x68'));return respondWithRpcPromise('RejectMessage',_0x29d0('0x76'),_0x531fe7);}return null;})['then'](function(_0x575927){if(_0x575927){_0x575927[_0x29d0('0x27')][_0x29d0('0x6c')]=util[_0x29d0('0x5d')]('SIP/%s',_0x4868d5[_0x29d0('0x66')][_0x29d0('0x36')]);_0x575927[_0x29d0('0x27')][_0x29d0('0x6d')]=_0x531fe7['channel'];_0x575927['message']['event']=_0x29d0('0x32');respondWithRpcPromise(_0x29d0('0x6f'),_0x29d0('0x6f'),{'event':'rejectmessage','message':_0x575927[_0x29d0('0x27')]},client9002);return _0x531fe7;}return null;})[_0x29d0('0x1e')](respondWithResult(_0x186034,null))['catch'](handleError(_0x186034,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 56143dd..efdb33e 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 _0xb737=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x43d123,_0x10780c){var _0x5dfbea=function(_0x3f0c0c){while(--_0x3f0c0c){_0x43d123['push'](_0x43d123['shift']());}};_0x5dfbea(++_0x10780c);}(_0xb737,0x131));var _0x7b73=function(_0x501d0f,_0x4adf25){_0x501d0f=_0x501d0f-0x0;var _0x50cea4=_0xb737[_0x501d0f];return _0x50cea4;};'use strict';var EventEmitter=require(_0x7b73('0x0'));var OpenchannelMessage=require(_0x7b73('0x1'))['db'][_0x7b73('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b73('0x3'),'afterUpdate':_0x7b73('0x4'),'afterDestroy':_0x7b73('0x5')};function emitEvent(_0x4be9a1){return function(_0x381885,_0x5ec2d8,_0x1a809a){OpenchannelMessageEvents[_0x7b73('0x6')](_0x4be9a1+':'+_0x381885['id'],_0x381885);OpenchannelMessageEvents[_0x7b73('0x6')](_0x4be9a1,_0x381885);_0x1a809a(null);};}for(var e in events){if(events[_0x7b73('0x7')](e)){var event=events[e];OpenchannelMessage[_0x7b73('0x8')](e,emitEvent(event));}}module[_0x7b73('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6a66=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x10dc94,_0x2fed4f){var _0x4a462d=function(_0x5181bd){while(--_0x5181bd){_0x10dc94['push'](_0x10dc94['shift']());}};_0x4a462d(++_0x2fed4f);}(_0x6a66,0xb3));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x66a6('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x66a6('0x1')](0x0);var events={'afterCreate':_0x66a6('0x2'),'afterUpdate':_0x66a6('0x3'),'afterDestroy':_0x66a6('0x4')};function emitEvent(_0x12f79b){return function(_0x53cc9b,_0x5117c6,_0xda59d5){OpenchannelMessageEvents[_0x66a6('0x5')](_0x12f79b+':'+_0x53cc9b['id'],_0x53cc9b);OpenchannelMessageEvents['emit'](_0x12f79b,_0x53cc9b);_0xda59d5(null);};}for(var e in events){if(events[_0x66a6('0x6')](e)){var event=events[e];OpenchannelMessage[_0x66a6('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index fff7d87..b9dd62a 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 _0xc4e4=['createdAt','catch','out','describe','OpenchannelAccount','find','Interactions','CmContact','Contact','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','OpenchannelMessage,\x20%s,\x20%s','threadId','OpenchannelInteraction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','OpenchannelInteractionId','then','update'];(function(_0x4adea6,_0x207522){var _0x31232b=function(_0x1c2910){while(--_0x1c2910){_0x4adea6['push'](_0x4adea6['shift']());}};_0x31232b(++_0x207522);}(_0xc4e4,0x141));var _0x4c4e=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4e4[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x4c4e('0x0'));var logger=require(_0x4c4e('0x1'))(_0x4c4e('0x2'));var moment=require('moment');var BPromise=require(_0x4c4e('0x3'));var rp=require(_0x4c4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c4e('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x4c4e('0x6')]=function(_0x2864da,_0x158dc1){return _0x2864da[_0x4c4e('0x7')](_0x4c4e('0x8'),attributes,{'tableName':_0x4c4e('0x9'),'paranoid':![],'indexes':[{'name':_0x4c4e('0xa'),'fields':[_0x4c4e('0xb')],'type':_0x4c4e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcdd187,_0x1ac23e,_0x547708){var _0x17f626=_0x2864da[_0x4c4e('0xd')];var _0x1731e9=_0xcdd187[_0x4c4e('0xe')]({'plain':!![]});if(_0x1731e9['direction'][_0x4c4e('0xf')]()==='in'||_0x1731e9[_0x4c4e('0x10')][_0x4c4e('0xf')]()==='out'&&!_0x1731e9[_0x4c4e('0x11')]&&!_[_0x4c4e('0x12')](_0x1731e9['UserId'])){_0x17f626['OpenchannelInteraction']['findOne']({'where':{'id':_0x1731e9[_0x4c4e('0x13')]}})[_0x4c4e('0x14')](function(_0x3b6e2a){if(_0x3b6e2a){_0x3b6e2a[_0x4c4e('0x15')]({'lastMsgAt':_0x1731e9[_0x4c4e('0x16')],'lastMsgDirection':_0x1731e9[_0x4c4e('0x10')][_0x4c4e('0xf')]()});}})[_0x4c4e('0x17')](function(_0x497e71){console['error'](_0x497e71);});}if(_0x1731e9[_0x4c4e('0x10')]===_0x4c4e('0x18')&&!_0x1731e9[_0x4c4e('0x11')]){var _0x17335b;_0x17f626['CmContact'][_0x4c4e('0x19')]()[_0x4c4e('0x14')](function(_0x103cb5){return _0x17f626[_0x4c4e('0x1a')][_0x4c4e('0x1b')]({'where':{'id':_0x1731e9['OpenchannelAccountId']},'include':[{'model':_0x17f626['OpenchannelInteraction'],'as':_0x4c4e('0x1c'),'where':{'id':_0x1731e9[_0x4c4e('0x13')]},'limit':0x1,'include':[{'model':_0x17f626[_0x4c4e('0x1d')],'as':_0x4c4e('0x1e'),'attributes':_[_0x4c4e('0x1f')](_0x103cb5)}]}]});})[_0x4c4e('0x14')](function(_0x4a8fcf){_0x17335b=_0x4a8fcf[_0x4c4e('0xe')]({'plain':!![]});if(_0x17335b&&_0x17335b[_0x4c4e('0x20')]){logger[_0x4c4e('0x21')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x4c4e('0x22')](_0x4c4e('0x23'),_0x1731e9['id'],_0x17335b[_0x4c4e('0x20')]));if(_0x17335b[_0x4c4e('0x1c')]&&_0x17335b[_0x4c4e('0x1c')][_0x4c4e('0x24')]){_0x1731e9[_0x4c4e('0x25')]=_[_0x4c4e('0x26')](_0x17335b[_0x4c4e('0x1c')][0x0],_0x4c4e('0x1e'));_0x1731e9[_0x4c4e('0x1e')]=_0x17335b[_0x4c4e('0x1c')][0x0][_0x4c4e('0x1e')];}var _0x1ac23e={'method':'POST','uri':encodeURI(_0x17335b[_0x4c4e('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1ac23e[_0x4c4e('0x27')]){case _0x4c4e('0x28'):_0x1ac23e['qs']=_0x1731e9;break;case'POST':_0x1ac23e['body']=_0x1731e9;break;}return rp(_0x1ac23e)[_0x4c4e('0x14')](function(_0x55a9db){logger[_0x4c4e('0x21')](_0x4c4e('0x29'),'afterCreate',util[_0x4c4e('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1731e9['id'],_0x17335b[_0x4c4e('0x20')]));if(_0x55a9db[_0x4c4e('0xb')][_0x4c4e('0x2a')]&&_0x55a9db[_0x4c4e('0xb')][_0x4c4e('0x2a')]!=_0x1731e9[_0x4c4e('0x25')][_0x4c4e('0x2a')]){return _0x17f626[_0x4c4e('0x2b')]['update']({'threadId':_0x55a9db[_0x4c4e('0xb')][_0x4c4e('0x2a')]},{'logging':!![],'where':{'id':_0x1731e9[_0x4c4e('0x25')]['id']}});}else{return;}})['then'](function(){return _0xcdd187[_0x4c4e('0x15')]({'read':!![]});})['catch'](function(_0x4dc4d6){logger[_0x4c4e('0x2c')](_0x4c4e('0x29'),'afterCreate',util[_0x4c4e('0x2d')](_0x4dc4d6,{'showHidden':![],'depth':null}));_0x547708();});}else{_0x547708();}})[_0x4c4e('0x2e')](function(){_0x547708();});}else{_0x547708();}}},'charset':_0x4c4e('0x2f'),'collate':_0x4c4e('0x30')});}; \ No newline at end of file +var _0xa239=['OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','omit','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact'];(function(_0x33bdbd,_0x3eac1c){var _0xba62a8=function(_0x15ebe2){while(--_0x15ebe2){_0x33bdbd['push'](_0x33bdbd['shift']());}};_0xba62a8(++_0x3eac1c);}(_0xa239,0xe3));var _0x9a23=function(_0x3f5eaf,_0x644c76){_0x3f5eaf=_0x3f5eaf-0x0;var _0x3df3a1=_0xa239[_0x3f5eaf];return _0x3df3a1;};'use strict';var _=require(_0x9a23('0x0'));var util=require('util');var logger=require(_0x9a23('0x1'))('api');var moment=require(_0x9a23('0x2'));var BPromise=require(_0x9a23('0x3'));var rp=require(_0x9a23('0x4'));var fs=require('fs');var path=require(_0x9a23('0x5'));var rimraf=require(_0x9a23('0x6'));var config=require('../../config/environment');var attributes=require(_0x9a23('0x7'));module[_0x9a23('0x8')]=function(_0x375ab5,_0x2af33c){return _0x375ab5['define'](_0x9a23('0x9'),attributes,{'tableName':_0x9a23('0xa'),'paranoid':![],'indexes':[{'name':_0x9a23('0xb'),'fields':[_0x9a23('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x273107,_0x19907d,_0x5d43dc){var _0x468906=_0x375ab5[_0x9a23('0xd')];var _0x513667=_0x273107['get']({'plain':!![]});if(_0x513667[_0x9a23('0xe')]['toLowerCase']()==='in'||_0x513667[_0x9a23('0xe')][_0x9a23('0xf')]()===_0x9a23('0x10')&&!_0x513667[_0x9a23('0x11')]&&!_[_0x9a23('0x12')](_0x513667[_0x9a23('0x13')])){_0x468906['OpenchannelInteraction'][_0x9a23('0x14')]({'where':{'id':_0x513667[_0x9a23('0x15')]}})[_0x9a23('0x16')](function(_0x20fcfc){if(_0x20fcfc){_0x20fcfc[_0x9a23('0x17')]({'lastMsgAt':_0x513667[_0x9a23('0x18')],'lastMsgDirection':_0x513667[_0x9a23('0xe')][_0x9a23('0xf')]()});}})[_0x9a23('0x19')](function(_0x918fb5){console[_0x9a23('0x1a')](_0x918fb5);});}if(_0x513667[_0x9a23('0xe')]===_0x9a23('0x10')&&!_0x513667['secret']){var _0x160260;_0x468906[_0x9a23('0x1b')]['describe']()[_0x9a23('0x16')](function(_0x110138){return _0x468906[_0x9a23('0x1c')][_0x9a23('0x1d')]({'where':{'id':_0x513667[_0x9a23('0x1e')]},'include':[{'model':_0x468906[_0x9a23('0x1f')],'as':_0x9a23('0x20'),'where':{'id':_0x513667[_0x9a23('0x15')]},'limit':0x1,'include':[{'model':_0x468906['CmContact'],'as':_0x9a23('0x21'),'attributes':_[_0x9a23('0x22')](_0x110138)}]}]});})['then'](function(_0x2f727d){_0x160260=_0x2f727d[_0x9a23('0x23')]({'plain':!![]});if(_0x160260&&_0x160260[_0x9a23('0x24')]){logger[_0x9a23('0x25')](_0x9a23('0x26'),'afterCreate',util[_0x9a23('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x513667['id'],_0x160260['replyUri']));if(_0x160260['Interactions']&&_0x160260[_0x9a23('0x20')][_0x9a23('0x28')]){_0x513667[_0x9a23('0x29')]=_[_0x9a23('0x2a')](_0x160260[_0x9a23('0x20')][0x0],_0x9a23('0x21'));_0x513667[_0x9a23('0x21')]=_0x160260[_0x9a23('0x20')][0x0][_0x9a23('0x21')];}var _0x19907d={'method':'POST','uri':encodeURI(_0x160260[_0x9a23('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x19907d[_0x9a23('0x2b')]){case _0x9a23('0x2c'):_0x19907d['qs']=_0x513667;break;case'POST':_0x19907d[_0x9a23('0xc')]=_0x513667;break;}return rp(_0x19907d)['then'](function(_0x5a697a){logger[_0x9a23('0x25')](_0x9a23('0x26'),_0x9a23('0x2d'),util[_0x9a23('0x27')](_0x9a23('0x2e'),_0x513667['id'],_0x160260[_0x9a23('0x24')]));if(_0x5a697a[_0x9a23('0xc')][_0x9a23('0x2f')]&&_0x5a697a['body']['threadId']!=_0x513667[_0x9a23('0x29')][_0x9a23('0x2f')]){return _0x468906[_0x9a23('0x1f')][_0x9a23('0x17')]({'threadId':_0x5a697a[_0x9a23('0xc')][_0x9a23('0x2f')]},{'logging':!![],'where':{'id':_0x513667[_0x9a23('0x29')]['id']}});}else{return;}})['then'](function(){return _0x273107['update']({'read':!![]});})[_0x9a23('0x19')](function(_0x58f481){logger['error'](_0x9a23('0x26'),_0x9a23('0x2d'),util[_0x9a23('0x30')](_0x58f481,{'showHidden':![],'depth':null}));_0x5d43dc();});}else{_0x5d43dc();}})['finally'](function(){_0x5d43dc();});}else{_0x5d43dc();}}},'charset':_0x9a23('0x31'),'collate':_0x9a23('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d0e21fa..1a27189 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 _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x309cca,_0x342169){var _0x2e8f15=function(_0x53fac5){while(--_0x53fac5){_0x309cca['push'](_0x309cca['shift']());}};_0x2e8f15(++_0x342169);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x34518e,_0x512ff7){var _0x5d7bed=function(_0x5af3e4){while(--_0x5af3e4){_0x34518e['push'](_0x34518e['shift']());}};_0x5d7bed(++_0x512ff7);}(_0xb10b,0x12a));var _0xbb10=function(_0x113a1a,_0x22a2c9){_0x113a1a=_0x113a1a-0x0;var _0x14d16e=_0xb10b[_0x113a1a];return _0x14d16e;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index bde5a39..0f1ed85 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 _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x50f710,_0x3d55ef){var _0x59b991=function(_0x10474f){while(--_0x10474f){_0x50f710['push'](_0x50f710['shift']());}};_0x59b991(++_0x3d55ef);}(_0xaa88,0x137));var _0x8aa8=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xaa88[_0x37e886];return _0x57c5cd;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file +var _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0xe706,0xa3));var _0x6e70=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xe706[_0x5bf420];return _0x1c5255;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d0f9e0f..de9aeb7 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 _0x4250=['Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0xace707,_0x463d96){var _0xcc05ea=function(_0x3cf285){while(--_0x3cf285){_0xace707['push'](_0xace707['shift']());}};_0xcc05ea(++_0x463d96);}(_0x4250,0x146));var _0x0425=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x4250[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var path=require(_0x0425('0x2'));var timeout=require(_0x0425('0x3'));var express=require('express');var router=express[_0x0425('0x4')]();var auth=require(_0x0425('0x5'));var interaction=require(_0x0425('0x6'));var config=require('../../config/environment');var controller=require(_0x0425('0x7'));router[_0x0425('0x8')]('/',auth[_0x0425('0x9')](),controller[_0x0425('0xa')]);router[_0x0425('0x8')](_0x0425('0xb'),auth[_0x0425('0x9')](),controller[_0x0425('0xc')]);router[_0x0425('0x8')](_0x0425('0xd'),auth[_0x0425('0x9')](),controller[_0x0425('0xe')]);router[_0x0425('0x8')](_0x0425('0xf'),auth[_0x0425('0x9')](),controller[_0x0425('0x10')]);router[_0x0425('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0425('0x11')]);router['get'](_0x0425('0x12'),auth[_0x0425('0x9')](),controller['getAgents']);router[_0x0425('0x13')]('/',auth[_0x0425('0x9')](),controller[_0x0425('0x14')]);router[_0x0425('0x13')]('/:id/teams',auth[_0x0425('0x9')](),controller[_0x0425('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x0425('0x16')]);router[_0x0425('0x17')](_0x0425('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0425('0x18')](_0x0425('0xd'),auth[_0x0425('0x9')](),controller[_0x0425('0x19')]);router[_0x0425('0x18')](_0x0425('0x1a'),auth[_0x0425('0x9')](),controller[_0x0425('0x1b')]);router[_0x0425('0x18')](_0x0425('0x12'),auth['isAuthenticated'](),controller[_0x0425('0x1c')]);module[_0x0425('0x1d')]=router; \ No newline at end of file +var _0xd6d2=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','update','removeTeams','delete','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x299a18,_0x154bc4){var _0x405dba=function(_0x5f55d4){while(--_0x5f55d4){_0x299a18['push'](_0x299a18['shift']());}};_0x405dba(++_0x154bc4);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x20d851,_0x5a1dcd){_0x20d851=_0x20d851-0x0;var _0x47fbb1=_0xd6d2[_0x20d851];return _0x47fbb1;};'use strict';var multer=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var path=require('path');var timeout=require(_0x2d6d('0x2'));var express=require(_0x2d6d('0x3'));var router=express['Router']();var auth=require(_0x2d6d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2d6d('0x5'));var controller=require(_0x2d6d('0x6'));router[_0x2d6d('0x7')]('/',auth['isAuthenticated'](),controller[_0x2d6d('0x8')]);router[_0x2d6d('0x7')](_0x2d6d('0x9'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0xb')]);router[_0x2d6d('0x7')](_0x2d6d('0xc'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0xd')]);router[_0x2d6d('0x7')](_0x2d6d('0xe'),auth['isAuthenticated'](),controller[_0x2d6d('0xf')]);router[_0x2d6d('0x7')](_0x2d6d('0x10'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0x11')]);router['get'](_0x2d6d('0x12'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0x13')]);router[_0x2d6d('0x14')]('/',auth[_0x2d6d('0xa')](),controller['create']);router[_0x2d6d('0x14')](_0x2d6d('0x10'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0x15')]);router['post'](_0x2d6d('0x12'),auth[_0x2d6d('0xa')](),controller['addAgents']);router['put'](_0x2d6d('0xc'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0x16')]);router['delete'](_0x2d6d('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x2d6d('0x10'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0x17')]);router[_0x2d6d('0x18')](_0x2d6d('0x12'),auth[_0x2d6d('0xa')](),controller[_0x2d6d('0x19')]);module[_0x2d6d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1548c09..9eeb47e 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 _0x5f66=['ENUM','rrmemory','roundrobin','exports','name','STRING','INTEGER'];(function(_0x1abed3,_0x407d04){var _0x2482d9=function(_0x3c8c5d){while(--_0x3c8c5d){_0x1abed3['push'](_0x1abed3['shift']());}};_0x2482d9(++_0x407d04);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x65f6('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x65f6('0x2')]},'timeout':{'type':Sequelize[_0x65f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x65f6('0x4')](_0x65f6('0x5'),'beepall',_0x65f6('0x6'))}}; \ No newline at end of file +var _0xc585=['rrmemory','beepall','roundrobin','name','INTEGER','ENUM'];(function(_0x512821,_0xf2f571){var _0x4c499d=function(_0x4db959){while(--_0x4db959){_0x512821['push'](_0x512821['shift']());}};_0x4c499d(++_0xf2f571);}(_0xc585,0x129));var _0x5c58=function(_0x3e944c,_0x3be025){_0x3e944c=_0x3e944c-0x0;var _0x1eb9f8=_0xc585[_0x3e944c];return _0x1eb9f8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5c58('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5c58('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c58('0x2')](_0x5c58('0x3'),_0x5c58('0x4'),_0x5c58('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6f9b9f2..5e1b9a6 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 _0x19ca=['OpenchannelQueue','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','nolimit','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','interface','flatMap','Agents','sequelize','transaction','addTeams','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','map','VIRTUAL','merge','options'];(function(_0x26778e,_0x4650c8){var _0x554699=function(_0x21a7b9){while(--_0x21a7b9){_0x26778e['push'](_0x26778e['shift']());}};_0x554699(++_0x4650c8);}(_0x19ca,0xd6));var _0xa19c=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x19ca[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require(_0xa19c('0x0'));var emlformat=require(_0xa19c('0x1'));var rimraf=require(_0xa19c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa19c('0x3'));var rp=require('request-promise');var moment=require(_0xa19c('0x4'));var BPromise=require(_0xa19c('0x5'));var Mustache=require(_0xa19c('0x6'));var util=require('util');var path=require(_0xa19c('0x7'));var sox=require(_0xa19c('0x8'));var csv=require(_0xa19c('0x9'));var ejs=require(_0xa19c('0xa'));var fs=require('fs');var _=require(_0xa19c('0xb'));var squel=require(_0xa19c('0xc'));var crypto=require(_0xa19c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa19c('0xe'));var Redis=require(_0xa19c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa19c('0x10'));var as=require(_0xa19c('0x11'));var hardwareService=require(_0xa19c('0x12'));var logger=require(_0xa19c('0x13'))(_0xa19c('0x14'));var utils=require('../../config/utils');var config=require(_0xa19c('0x15'));var licenseUtil=require(_0xa19c('0x16'));var db=require('../../mysqldb')['db'];config[_0xa19c('0x17')]=_[_0xa19c('0x18')](config[_0xa19c('0x17')],{'host':_0xa19c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa19c('0x1a'))[_0xa19c('0x1b')](socket);function respondWithStatusCode(_0x4f41d3,_0x1ddb1c){_0x1ddb1c=_0x1ddb1c||0xcc;return function(_0xf3fc04){if(_0xf3fc04){return _0x4f41d3[_0xa19c('0x1c')](_0x1ddb1c);}return _0x4f41d3[_0xa19c('0x1d')](_0x1ddb1c)['end']();};}function respondWithResult(_0x38e1e3,_0x4c336d){_0x4c336d=_0x4c336d||0xc8;return function(_0x55217e){if(_0x55217e){return _0x38e1e3['status'](_0x4c336d)[_0xa19c('0x1e')](_0x55217e);}};}function respondWithFilteredResult(_0x3924ce,_0x2d80a3){return function(_0x53669e){if(_0x53669e){var _0x37fd82=_0x53669e[_0xa19c('0x1f')],_0x10963a=_0x2d80a3[_0xa19c('0x20')],_0xe9358b=_0x2d80a3['offset']+_0x2d80a3[_0xa19c('0x21')],_0x33eaed;if(_0xe9358b>=_0x37fd82){_0xe9358b=_0x37fd82;_0x33eaed=0xc8;}else{_0x33eaed=0xce;}_0x3924ce['status'](_0x33eaed);return _0x3924ce[_0xa19c('0x22')]('Content-Range',_0x10963a+'-'+_0xe9358b+'/'+_0x37fd82)[_0xa19c('0x1e')](_0x53669e);}return null;};}function patchUpdates(_0x473412){return function(_0xe6879){try{jsonpatch[_0xa19c('0x23')](_0xe6879,_0x473412,!![]);}catch(_0x5e26cc){return BPromise[_0xa19c('0x24')](_0x5e26cc);}return _0xe6879[_0xa19c('0x25')]();};}function saveUpdates(_0x1eed4a,_0x3a3174){return function(_0x3b3b88){if(_0x3b3b88){return _0x3b3b88[_0xa19c('0x26')](_0x1eed4a)[_0xa19c('0x27')](function(_0x31c325){return _0x31c325;});}return null;};}function removeEntity(_0x3e4cc4,_0x571797){return function(_0x32b436){if(_0x32b436){return _0x32b436[_0xa19c('0x28')]()[_0xa19c('0x27')](function(){var _0x3e2274=_0x32b436[_0xa19c('0x29')]({'plain':!![]});var _0x1c5f46=_0xa19c('0x2a');return db[_0xa19c('0x2b')]['destroy']({'where':{'type':_0x1c5f46,'resourceId':_0x3e2274['id']}})['then'](function(){return _0x32b436;});})[_0xa19c('0x27')](function(){_0x3e4cc4[_0xa19c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d0be1,_0x31dab9){return function(_0x143b18){if(!_0x143b18){_0x6d0be1['sendStatus'](0x194);}return _0x143b18;};}function handleError(_0xada9b3,_0x18daf3){_0x18daf3=_0x18daf3||0x1f4;return function(_0x2dccab){logger[_0xa19c('0x2c')](_0x2dccab['stack']);if(_0x2dccab[_0xa19c('0x2d')]){delete _0x2dccab[_0xa19c('0x2d')];}_0xada9b3[_0xa19c('0x1d')](_0x18daf3)[_0xa19c('0x2e')](_0x2dccab);};}exports[_0xa19c('0x2f')]=function(_0x28f0ec,_0x14b446){var _0x2ac328={},_0x1ff9d7={},_0x5824d4={'count':0x0,'rows':[]};var _0xf3f3c2=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x45bb2f){return{'name':_0x45bb2f[_0xa19c('0x30')],'type':_0x45bb2f[_0xa19c('0x31')][_0xa19c('0x32')]};});_0x1ff9d7[_0xa19c('0x33')]=_['map'](_0xf3f3c2,_0xa19c('0x2d'));_0x1ff9d7[_0xa19c('0x34')]=_[_0xa19c('0x35')](_0x28f0ec[_0xa19c('0x34')]);_0x1ff9d7['filters']=_[_0xa19c('0x36')](_0x1ff9d7[_0xa19c('0x33')],_0x1ff9d7['query']);_0x2ac328[_0xa19c('0x37')]=_[_0xa19c('0x36')](_0x1ff9d7[_0xa19c('0x33')],qs[_0xa19c('0x38')](_0x28f0ec['query']['fields']));_0x2ac328[_0xa19c('0x37')]=_0x2ac328[_0xa19c('0x37')][_0xa19c('0x39')]?_0x2ac328[_0xa19c('0x37')]:_0x1ff9d7[_0xa19c('0x33')];if(!_0x28f0ec['query'][_0xa19c('0x3a')]('nolimit')){_0x2ac328[_0xa19c('0x21')]=qs[_0xa19c('0x21')](_0x28f0ec['query'][_0xa19c('0x21')]);_0x2ac328[_0xa19c('0x20')]=qs[_0xa19c('0x20')](_0x28f0ec[_0xa19c('0x34')][_0xa19c('0x20')]);}_0x2ac328['order']=qs[_0xa19c('0x3b')](_0x28f0ec[_0xa19c('0x34')][_0xa19c('0x3b')]);_0x2ac328[_0xa19c('0x3c')]=qs[_0xa19c('0x3d')](_[_0xa19c('0x3e')](_0x28f0ec[_0xa19c('0x34')],_0x1ff9d7['filters']),_0xf3f3c2);if(_0x28f0ec[_0xa19c('0x34')][_0xa19c('0x3f')]){_0x2ac328[_0xa19c('0x3c')]=_['merge'](_0x2ac328[_0xa19c('0x3c')],{'$or':_[_0xa19c('0x40')](_0xf3f3c2,function(_0x3203d9){if(_0x3203d9[_0xa19c('0x31')]!==_0xa19c('0x41')){var _0x66227a={};_0x66227a[_0x3203d9[_0xa19c('0x2d')]]={'$like':'%'+_0x28f0ec[_0xa19c('0x34')][_0xa19c('0x3f')]+'%'};return _0x66227a;}})});}_0x2ac328=_[_0xa19c('0x42')]({},_0x2ac328,_0x28f0ec[_0xa19c('0x43')]);var _0x356b9e={'where':_0x2ac328[_0xa19c('0x3c')]};return db[_0xa19c('0x44')][_0xa19c('0x1f')](_0x356b9e)[_0xa19c('0x27')](function(_0x1e58e6){_0x5824d4['count']=_0x1e58e6;if(_0x28f0ec[_0xa19c('0x34')]['includeAll']){_0x2ac328[_0xa19c('0x45')]=[{'all':!![]}];}return db[_0xa19c('0x44')][_0xa19c('0x46')](_0x2ac328);})[_0xa19c('0x27')](function(_0x308b9f){_0x5824d4[_0xa19c('0x47')]=_0x308b9f;return _0x5824d4;})['then'](respondWithFilteredResult(_0x14b446,_0x2ac328))[_0xa19c('0x48')](handleError(_0x14b446,null));};exports[_0xa19c('0x49')]=function(_0x4c94c0,_0x2839e7){var _0xdadcad={'raw':!![],'where':{'id':_0x4c94c0[_0xa19c('0x4a')]['id']}},_0x1102ae={};_0x1102ae[_0xa19c('0x33')]=_[_0xa19c('0x35')](db['OpenchannelQueue']['rawAttributes']);_0x1102ae[_0xa19c('0x34')]=_[_0xa19c('0x35')](_0x4c94c0['query']);_0x1102ae[_0xa19c('0x3d')]=_[_0xa19c('0x36')](_0x1102ae[_0xa19c('0x33')],_0x1102ae[_0xa19c('0x34')]);_0xdadcad[_0xa19c('0x37')]=_[_0xa19c('0x36')](_0x1102ae[_0xa19c('0x33')],qs[_0xa19c('0x38')](_0x4c94c0['query'][_0xa19c('0x38')]));_0xdadcad[_0xa19c('0x37')]=_0xdadcad[_0xa19c('0x37')][_0xa19c('0x39')]?_0xdadcad[_0xa19c('0x37')]:_0x1102ae[_0xa19c('0x33')];if(_0x4c94c0[_0xa19c('0x34')]['includeAll']){_0xdadcad[_0xa19c('0x45')]=[{'all':!![]}];}_0xdadcad=_[_0xa19c('0x42')]({},_0xdadcad,_0x4c94c0[_0xa19c('0x43')]);return db[_0xa19c('0x44')]['find'](_0xdadcad)[_0xa19c('0x27')](handleEntityNotFound(_0x2839e7,null))[_0xa19c('0x27')](respondWithResult(_0x2839e7,null))[_0xa19c('0x48')](handleError(_0x2839e7,null));};exports[_0xa19c('0x4b')]=function(_0x3439ba,_0xd597c9){return db[_0xa19c('0x44')][_0xa19c('0x4b')](_0x3439ba['body'],{})['then'](function(_0x4ed7f2){var _0x354d00=_0x3439ba[_0xa19c('0x4c')]['get']({'plain':!![]});if(!_0x354d00)throw new Error(_0xa19c('0x4d'));if(_0x354d00[_0xa19c('0x4e')]==='user'){var _0x3fdb2d=_0x4ed7f2[_0xa19c('0x29')]({'plain':!![]});var _0x542efc=_0xa19c('0x2a');return db[_0xa19c('0x4f')][_0xa19c('0x50')]({'where':{'name':_0x542efc,'userProfileId':_0x354d00['userProfileId']},'raw':!![]})['then'](function(_0x14abd7){if(_0x14abd7&&_0x14abd7[_0xa19c('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fdb2d[_0xa19c('0x2d')],'resourceId':_0x3fdb2d['id'],'type':_0x14abd7[_0xa19c('0x2d')],'sectionId':_0x14abd7['id']},{})[_0xa19c('0x27')](function(){return _0x4ed7f2;});}else{return _0x4ed7f2;}})[_0xa19c('0x48')](function(_0x45caf2){logger[_0xa19c('0x2c')](_0xa19c('0x52'),_0x45caf2);throw _0x45caf2;});}return _0x4ed7f2;})[_0xa19c('0x27')](respondWithResult(_0xd597c9,0xc9))[_0xa19c('0x48')](handleError(_0xd597c9,null));};exports[_0xa19c('0x26')]=function(_0x4940f9,_0x1e15b4){if(_0x4940f9['body']['id']){delete _0x4940f9[_0xa19c('0x53')]['id'];}return db[_0xa19c('0x44')][_0xa19c('0x50')]({'where':{'id':_0x4940f9[_0xa19c('0x4a')]['id']}})[_0xa19c('0x27')](handleEntityNotFound(_0x1e15b4,null))[_0xa19c('0x27')](saveUpdates(_0x4940f9['body'],null))[_0xa19c('0x27')](respondWithResult(_0x1e15b4,null))['catch'](handleError(_0x1e15b4,null));};exports['destroy']=function(_0x167e92,_0x5e3139){return db[_0xa19c('0x44')]['find']({'where':{'id':_0x167e92[_0xa19c('0x4a')]['id']}})[_0xa19c('0x27')](handleEntityNotFound(_0x5e3139,null))['then'](removeEntity(_0x5e3139,null))[_0xa19c('0x48')](handleError(_0x5e3139,null));};exports[_0xa19c('0x54')]=function(_0x5366d4,_0x4e1c7f){return db[_0xa19c('0x44')][_0xa19c('0x54')]()[_0xa19c('0x27')](respondWithResult(_0x4e1c7f,null))[_0xa19c('0x48')](handleError(_0x4e1c7f,null));};exports[_0xa19c('0x55')]=function(_0x508400,_0x238d76,_0x1dfe23){var _0x1e7da6={'raw':!![],'where':{}},_0x12c627={},_0x35bb67;return db[_0xa19c('0x44')][_0xa19c('0x56')]({'where':{'id':_0x508400['params']['id']}})[_0xa19c('0x27')](handleEntityNotFound(_0x238d76,null))['then'](function(_0x4302b4){if(_0x4302b4){_0x35bb67=_0x4302b4[_0xa19c('0x29')]({'plain':!![]});_0x12c627[_0xa19c('0x33')]=_[_0xa19c('0x35')](db[_0xa19c('0x57')][_0xa19c('0x58')]);_0x12c627['query']=_[_0xa19c('0x35')](_0x508400['query']);_0x12c627['filters']=_['intersection'](_0x12c627[_0xa19c('0x33')],_0x12c627[_0xa19c('0x34')]);_0x1e7da6[_0xa19c('0x37')]=_['intersection'](_0x12c627[_0xa19c('0x33')],qs[_0xa19c('0x38')](_0x508400[_0xa19c('0x34')][_0xa19c('0x38')]));_0x1e7da6[_0xa19c('0x37')]=_0x1e7da6[_0xa19c('0x37')][_0xa19c('0x39')]?_0x1e7da6[_0xa19c('0x37')]:_0x12c627['model'];if(!_0x508400['query'][_0xa19c('0x3a')](_0xa19c('0x59'))){_0x1e7da6[_0xa19c('0x21')]=qs['limit'](_0x508400['query'][_0xa19c('0x21')]);_0x1e7da6[_0xa19c('0x20')]=qs['offset'](_0x508400[_0xa19c('0x34')][_0xa19c('0x20')]);}_0x1e7da6[_0xa19c('0x5a')]=qs[_0xa19c('0x3b')](_0x508400['query'][_0xa19c('0x3b')]);_0x1e7da6[_0xa19c('0x3c')]=qs[_0xa19c('0x3d')](_['pick'](_0x508400['query'],_0x12c627[_0xa19c('0x3d')]));_0x1e7da6[_0xa19c('0x3c')][_0xa19c('0x5b')]=_0x4302b4['id'];if(_0x508400[_0xa19c('0x34')][_0xa19c('0x3f')]){_0x1e7da6['where']=_[_0xa19c('0x42')](_0x1e7da6[_0xa19c('0x3c')],{'$or':_[_0xa19c('0x40')](_0x1e7da6[_0xa19c('0x37')],function(_0x797c3c){var _0x24d412={};_0x24d412[_0x797c3c]={'$like':'%'+_0x508400[_0xa19c('0x34')][_0xa19c('0x3f')]+'%'};return _0x24d412;})});}_0x1e7da6=_[_0xa19c('0x42')]({},_0x1e7da6,_0x508400['options']);return db[_0xa19c('0x57')][_0xa19c('0x46')](_0x1e7da6);}})['then'](function(_0x5442fc){if(_0x5442fc){return db[_0xa19c('0x5c')][_0xa19c('0x5d')]({'where':{'id':_['map'](_0x5442fc,_0xa19c('0x5e')),'role':_0xa19c('0x5f')},'attributes':['id',_0xa19c('0x2d'),_0xa19c('0x60'),_0xa19c('0x61'),_0xa19c('0x62')]});}})[_0xa19c('0x27')](function(_0x236a66){if(_0x236a66){return{'count':_0x236a66[_0xa19c('0x1f')],'rows':_[_0xa19c('0x40')](_0x236a66[_0xa19c('0x47')],function(_0x369d6d){return{'membername':_0x369d6d[_0xa19c('0x2d')],'UserId':_0x369d6d['id'],'queue_name':_0x35bb67[_0xa19c('0x2d')],'OpenchannelQueueId':_0x35bb67['id'],'interface':util['format'](_0xa19c('0x63'),_0xa19c('0x64'),_0x369d6d[_0xa19c('0x2d')]),'penalty':0x0,'paused':_0x369d6d[_0xa19c('0x60')],'createdAt':_0x369d6d[_0xa19c('0x62')],'updatedAt':_0x369d6d[_0xa19c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa19c('0x27')](respondWithFilteredResult(_0x238d76,_0x1e7da6))[_0xa19c('0x48')](handleError(_0x238d76,null));};exports[_0xa19c('0x65')]=function(_0x619ecd,_0x25dd2f,_0x2ab255){var _0x266a7d={};var _0x384d9c={};var _0x28ad94;var _0x5462dd;return db[_0xa19c('0x44')][_0xa19c('0x56')]({'where':{'id':_0x619ecd[_0xa19c('0x4a')]['id']}})[_0xa19c('0x27')](handleEntityNotFound(_0x25dd2f,null))[_0xa19c('0x27')](function(_0x47a4fe){if(_0x47a4fe){_0x28ad94=_0x47a4fe;_0x384d9c[_0xa19c('0x33')]=_['keys'](db['Team'][_0xa19c('0x58')]);_0x384d9c[_0xa19c('0x34')]=_[_0xa19c('0x35')](_0x619ecd[_0xa19c('0x34')]);_0x384d9c[_0xa19c('0x3d')]=_[_0xa19c('0x36')](_0x384d9c[_0xa19c('0x33')],_0x384d9c[_0xa19c('0x34')]);_0x266a7d[_0xa19c('0x37')]=_[_0xa19c('0x36')](_0x384d9c[_0xa19c('0x33')],qs[_0xa19c('0x38')](_0x619ecd[_0xa19c('0x34')][_0xa19c('0x38')]));_0x266a7d[_0xa19c('0x37')]=_0x266a7d[_0xa19c('0x37')][_0xa19c('0x39')]?_0x266a7d[_0xa19c('0x37')]:_0x384d9c['model'];_0x266a7d[_0xa19c('0x5a')]=qs['sort'](_0x619ecd['query'][_0xa19c('0x3b')]);_0x266a7d[_0xa19c('0x3c')]=qs['filters'](_[_0xa19c('0x3e')](_0x619ecd['query'],_0x384d9c[_0xa19c('0x3d')]));if(_0x619ecd['query'][_0xa19c('0x3f')]){_0x266a7d[_0xa19c('0x3c')]=_['merge'](_0x266a7d[_0xa19c('0x3c')],{'$or':_[_0xa19c('0x40')](_0x266a7d[_0xa19c('0x37')],function(_0x1416d8){var _0x2b0784={};_0x2b0784[_0x1416d8]={'$like':'%'+_0x619ecd[_0xa19c('0x34')]['filter']+'%'};return _0x2b0784;})});}_0x266a7d=_[_0xa19c('0x42')]({},_0x266a7d,_0x619ecd[_0xa19c('0x43')]);return _0x28ad94[_0xa19c('0x65')](_0x266a7d);}})[_0xa19c('0x27')](function(_0x3413c7){if(_0x3413c7){_0x5462dd=_0x3413c7[_0xa19c('0x39')];if(!_0x619ecd[_0xa19c('0x34')][_0xa19c('0x3a')](_0xa19c('0x59'))){_0x266a7d[_0xa19c('0x21')]=qs[_0xa19c('0x21')](_0x619ecd[_0xa19c('0x34')][_0xa19c('0x21')]);_0x266a7d[_0xa19c('0x20')]=qs['offset'](_0x619ecd[_0xa19c('0x34')][_0xa19c('0x20')]);}return _0x28ad94['getTeams'](_0x266a7d);}})[_0xa19c('0x27')](function(_0x3bd1bd){if(_0x3bd1bd){return _0x3bd1bd?{'count':_0x5462dd,'rows':_0x3bd1bd}:null;}})[_0xa19c('0x27')](respondWithResult(_0x25dd2f,null))['catch'](handleError(_0x25dd2f,null));};exports['addTeams']=function(_0x52f383,_0x232622,_0x186c67){var _0xfaa941=_0x52f383['body'][_0xa19c('0x66')];return db[_0xa19c('0x67')][_0xa19c('0x46')]({'where':{'id':_0xfaa941},'attributes':['id'],'include':[{'model':db[_0xa19c('0x5c')],'as':'Agents','attributes':['id',_0xa19c('0x2d'),'online','voicePause',_0xa19c('0x68')],'raw':!![]}]})['then'](function(_0x202c4a){if(_0x202c4a){var _0x254fdd=_[_0xa19c('0x69')](_0x202c4a,function(_0x39e82c){var _0x429dad=_0x39e82c[_0xa19c('0x29')]({'plain':!![]});return _0x429dad[_0xa19c('0x6a')];});return db[_0xa19c('0x44')][_0xa19c('0x50')]({'where':{'id':_0x52f383['params']['id']}})[_0xa19c('0x27')](function(_0x374a22){return db[_0xa19c('0x6b')][_0xa19c('0x6c')](function(_0x3f9cd6){return _0x374a22[_0xa19c('0x6d')](_0xfaa941,{'transaction':_0x3f9cd6})[_0xa19c('0x27')](function(){return BPromise[_0xa19c('0x6e')](_0x254fdd,function(_0x12efd2){return db[_0xa19c('0x57')]['findOrCreate']({'where':{'UserId':_0x12efd2['id'],'OpenchannelQueueId':_0x52f383[_0xa19c('0x4a')]['id']},'transaction':_0x3f9cd6});});})['then'](function(){_0x254fdd[_0xa19c('0x6f')](function(_0x52f207){socket[_0xa19c('0x70')]('userOpenchannelQueue:save',{'UserId':_0x52f207['id'],'OpenchannelQueueId':_0x374a22['id']});});});});});}})[_0xa19c('0x27')](respondWithStatusCode(_0x232622,null))[_0xa19c('0x48')](handleError(_0x232622,null));};exports[_0xa19c('0x71')]=function(_0x50c046,_0x43f95f,_0x2afd36){return db['Team'][_0xa19c('0x46')]({'where':{'id':_0x50c046[_0xa19c('0x34')][_0xa19c('0x66')]},'attributes':['id'],'include':[{'model':db[_0xa19c('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x43f95f,null))[_0xa19c('0x27')](function(_0x1c399c){var _0x1edefd=_[_0xa19c('0x40')](_0x1c399c,'id');var _0x43323b=[];var _0x3a7eb8=[];var _0x4136b0=squel[_0xa19c('0x72')]();_0x4136b0[_0xa19c('0x73')](_0xa19c('0x74'))[_0xa19c('0x75')](_0xa19c('0x76'),'tq')['join'](_0xa19c('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa19c('0x3c')](_0xa19c('0x78'),_0x50c046[_0xa19c('0x4a')]['id']);for(var _0x349fc1=0x0;_0x349fc1<_0x1c399c[_0xa19c('0x39')];_0x349fc1+=0x1){let _0x11d222=_0x1c399c[_0x349fc1];for(var _0x3a8bac=0x0;_0x3a8bac<_0x11d222[_0xa19c('0x6a')]['length'];_0x3a8bac+=0x1){let _0xf8f157=_0x11d222['Agents'][_0x3a8bac];var _0x547dd0=_0x4136b0[_0xa19c('0x79')]();_0x547dd0['where'](_0xa19c('0x7a'),_0xf8f157['id']);_0x3a7eb8[_0xa19c('0x7b')](db['sequelize'][_0xa19c('0x34')](_0x547dd0[_0xa19c('0x7c')](),{'type':db[_0xa19c('0x6b')][_0xa19c('0x7d')][_0xa19c('0x7e')]})[_0xa19c('0x27')](function(_0x1d5132){if(_0x1d5132[_0xa19c('0x39')]===0x1){return _0xf8f157['id'];}else{var _0x304fe5=_[_0xa19c('0x7f')](_[_0xa19c('0x40')](_0x1d5132,_0xa19c('0x80')),function(_0x156c11){return _[_0xa19c('0x81')](_0x1edefd,_0x156c11);});if(_0x304fe5){return _0xf8f157['id'];}}}));}}return BPromise[_0xa19c('0x82')](_0x3a7eb8)[_0xa19c('0x27')](function(_0x10a666){_0x43323b=_(_0x43323b)[_0xa19c('0x83')](_0x10a666)[_0xa19c('0x84')]()[_0xa19c('0x85')]();return db[_0xa19c('0x44')][_0xa19c('0x50')]({'where':{'id':_0x50c046['params']['id']}})[_0xa19c('0x27')](function(_0x48a047){return db['sequelize'][_0xa19c('0x6c')](function(_0x55af16){return _0x48a047['removeTeams'](_0x50c046[_0xa19c('0x34')]['ids'],{'transaction':_0x55af16})[_0xa19c('0x27')](function(){if(!_[_0xa19c('0x86')](_0x43323b)){return _0x48a047[_0xa19c('0x87')](_0x43323b,{'transaction':_0x55af16});}})[_0xa19c('0x27')](function(){_0x43323b['forEach'](function(_0x5d052a){socket[_0xa19c('0x70')](_0xa19c('0x88'),{'UserId':_0x5d052a,'OpenchannelQueueId':_0x48a047['id']});});});});});});})[_0xa19c('0x27')](respondWithStatusCode(_0x43f95f,null))[_0xa19c('0x48')](handleError(_0x43f95f,null));};exports[_0xa19c('0x89')]=function(_0x1151fe,_0x58fd3f,_0x4fad2e){return db['OpenchannelQueue'][_0xa19c('0x50')]({'where':{'id':_0x1151fe[_0xa19c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58fd3f,null))[_0xa19c('0x27')](function(_0x49ca66){if(_0x49ca66){return _0x49ca66['addAgents'](_0x1151fe[_0xa19c('0x53')][_0xa19c('0x66')],_[_0xa19c('0x8a')](_0x1151fe[_0xa19c('0x53')],[_0xa19c('0x66'),'id'])||{})[_0xa19c('0x8b')](function(_0xaae99b){for(var _0x49f578=0x0;_0x49f578<_0x1151fe[_0xa19c('0x53')]['ids'][_0xa19c('0x39')];_0x49f578+=0x1){socket[_0xa19c('0x70')]('userOpenchannelQueue:save',{'UserId':_0x1151fe[_0xa19c('0x53')][_0xa19c('0x66')][_0x49f578],'OpenchannelQueueId':_0x1151fe[_0xa19c('0x4a')]['id']});}return _0xaae99b;});}})[_0xa19c('0x27')](respondWithResult(_0x58fd3f,null))[_0xa19c('0x48')](handleError(_0x58fd3f,null));};exports['removeAgents']=function(_0x3cf5a4,_0x335aab,_0x1760e0){return db[_0xa19c('0x44')][_0xa19c('0x50')]({'where':{'id':_0x3cf5a4[_0xa19c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x335aab,null))['then'](function(_0x441cdd){if(_0x441cdd){return _0x441cdd[_0xa19c('0x87')](_0x3cf5a4[_0xa19c('0x34')][_0xa19c('0x66')])['then'](function(){if(_['isArray'](_0x3cf5a4[_0xa19c('0x34')][_0xa19c('0x66')])){for(var _0x5c6b0e=0x0;_0x5c6b0e<_0x3cf5a4['query'][_0xa19c('0x66')][_0xa19c('0x39')];_0x5c6b0e+=0x1){socket[_0xa19c('0x70')](_0xa19c('0x88'),{'UserId':Number(_0x3cf5a4['query']['ids'][_0x5c6b0e]),'OpenchannelQueueId':Number(_0x3cf5a4[_0xa19c('0x4a')]['id'])});}}else{socket[_0xa19c('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3cf5a4['query'][_0xa19c('0x66')]),'OpenchannelQueueId':Number(_0x3cf5a4[_0xa19c('0x4a')]['id'])});}});}})[_0xa19c('0x27')](respondWithStatusCode(_0x335aab,null))['catch'](handleError(_0x335aab,null));};exports[_0xa19c('0x8c')]=function(_0x2f1949,_0x4a182b,_0x5d2df5){var _0xef3b67={};var _0x26b77a={};var _0x521332;var _0x58e4cd;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2f1949[_0xa19c('0x4a')]['id']}})[_0xa19c('0x27')](handleEntityNotFound(_0x4a182b,null))['then'](function(_0x5a0db1){if(_0x5a0db1){_0x521332=_0x5a0db1;_0x26b77a[_0xa19c('0x33')]=_[_0xa19c('0x35')](db[_0xa19c('0x5c')][_0xa19c('0x58')]);_0x26b77a[_0xa19c('0x34')]=_[_0xa19c('0x35')](_0x2f1949[_0xa19c('0x34')]);_0x26b77a[_0xa19c('0x3d')]=_[_0xa19c('0x36')](_0x26b77a[_0xa19c('0x33')],_0x26b77a[_0xa19c('0x34')]);_0xef3b67[_0xa19c('0x37')]=_[_0xa19c('0x36')](_0x26b77a[_0xa19c('0x33')],qs['fields'](_0x2f1949[_0xa19c('0x34')][_0xa19c('0x38')]));_0xef3b67[_0xa19c('0x37')]=_0xef3b67[_0xa19c('0x37')][_0xa19c('0x39')]?_0xef3b67['attributes']:_0x26b77a[_0xa19c('0x33')];_0xef3b67['order']=qs[_0xa19c('0x3b')](_0x2f1949['query']['sort']);_0xef3b67[_0xa19c('0x3c')]=qs[_0xa19c('0x3d')](_[_0xa19c('0x3e')](_0x2f1949[_0xa19c('0x34')],_0x26b77a[_0xa19c('0x3d')]));if(_0x2f1949[_0xa19c('0x34')][_0xa19c('0x3f')]){_0xef3b67[_0xa19c('0x3c')]=_[_0xa19c('0x42')](_0xef3b67[_0xa19c('0x3c')],{'$or':_[_0xa19c('0x40')](_0xef3b67['attributes'],function(_0x142943){var _0x808260={};_0x808260[_0x142943]={'$like':'%'+_0x2f1949[_0xa19c('0x34')]['filter']+'%'};return _0x808260;})});}_0xef3b67=_['merge']({},_0xef3b67,_0x2f1949[_0xa19c('0x43')]);return _0x521332[_0xa19c('0x8c')](_0xef3b67);}})[_0xa19c('0x27')](function(_0x1a6b4c){if(_0x1a6b4c){_0x58e4cd=_0x1a6b4c[_0xa19c('0x39')];if(!_0x2f1949[_0xa19c('0x34')]['hasOwnProperty'](_0xa19c('0x59'))){_0xef3b67[_0xa19c('0x21')]=qs[_0xa19c('0x21')](_0x2f1949[_0xa19c('0x34')][_0xa19c('0x21')]);_0xef3b67[_0xa19c('0x20')]=qs[_0xa19c('0x20')](_0x2f1949['query'][_0xa19c('0x20')]);}return _0x521332[_0xa19c('0x8c')](_0xef3b67);}})[_0xa19c('0x27')](function(_0x30eb7c){if(_0x30eb7c){return _0x30eb7c?{'count':_0x58e4cd,'rows':_0x30eb7c}:null;}})[_0xa19c('0x27')](respondWithResult(_0x4a182b,null))['catch'](handleError(_0x4a182b,null));}; \ No newline at end of file +var _0xdb9e=['VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','format','%s/%s','createdAt','updatedAt','getTeams','Team','nolimit','addTeams','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','field','tq.TeamId','from','team_has_openchannel_queues','join','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','union','compact','removeAgents','userOpenchannelQueue:remove','addAgents','ids','omit','spread','getAgents','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xdb9e,0x1e4));var _0xedb9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdb9e[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedb9('0x1'));var jsonpatch=require(_0xedb9('0x2'));var rp=require(_0xedb9('0x3'));var moment=require(_0xedb9('0x4'));var BPromise=require(_0xedb9('0x5'));var Mustache=require('mustache');var util=require(_0xedb9('0x6'));var path=require(_0xedb9('0x7'));var sox=require('sox');var csv=require(_0xedb9('0x8'));var ejs=require(_0xedb9('0x9'));var fs=require('fs');var _=require(_0xedb9('0xa'));var squel=require('squel');var crypto=require(_0xedb9('0xb'));var jsforce=require(_0xedb9('0xc'));var deskjs=require(_0xedb9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xedb9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xedb9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedb9('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xedb9('0x11'));var licenseUtil=require(_0xedb9('0x12'));var db=require('../../mysqldb')['db'];config[_0xedb9('0x13')]=_[_0xedb9('0x14')](config[_0xedb9('0x13')],{'host':_0xedb9('0x15'),'port':0x18eb});var socket=require(_0xedb9('0x16'))(new Redis(config['redis']));require(_0xedb9('0x17'))[_0xedb9('0x18')](socket);function respondWithStatusCode(_0x34a0ae,_0x52ce5a){_0x52ce5a=_0x52ce5a||0xcc;return function(_0x518668){if(_0x518668){return _0x34a0ae[_0xedb9('0x19')](_0x52ce5a);}return _0x34a0ae[_0xedb9('0x1a')](_0x52ce5a)[_0xedb9('0x1b')]();};}function respondWithResult(_0x33a620,_0x42a876){_0x42a876=_0x42a876||0xc8;return function(_0x5e76eb){if(_0x5e76eb){return _0x33a620[_0xedb9('0x1a')](_0x42a876)[_0xedb9('0x1c')](_0x5e76eb);}};}function respondWithFilteredResult(_0x3e09b5,_0x2f6da5){return function(_0x4554e5){if(_0x4554e5){var _0xc3c7ba=_0x4554e5['count'],_0x285381=_0x2f6da5[_0xedb9('0x1d')],_0x4d8eb1=_0x2f6da5[_0xedb9('0x1d')]+_0x2f6da5['limit'],_0x204d68;if(_0x4d8eb1>=_0xc3c7ba){_0x4d8eb1=_0xc3c7ba;_0x204d68=0xc8;}else{_0x204d68=0xce;}_0x3e09b5[_0xedb9('0x1a')](_0x204d68);return _0x3e09b5[_0xedb9('0x1e')](_0xedb9('0x1f'),_0x285381+'-'+_0x4d8eb1+'/'+_0xc3c7ba)[_0xedb9('0x1c')](_0x4554e5);}return null;};}function patchUpdates(_0x2c5b75){return function(_0x7da373){try{jsonpatch[_0xedb9('0x20')](_0x7da373,_0x2c5b75,!![]);}catch(_0xe362f6){return BPromise[_0xedb9('0x21')](_0xe362f6);}return _0x7da373[_0xedb9('0x22')]();};}function saveUpdates(_0xbbf1b3,_0x4890d8){return function(_0x2e65b3){if(_0x2e65b3){return _0x2e65b3[_0xedb9('0x23')](_0xbbf1b3)[_0xedb9('0x24')](function(_0x2510b4){return _0x2510b4;});}return null;};}function removeEntity(_0x5f5c2f,_0x3d05ec){return function(_0x5d9915){if(_0x5d9915){return _0x5d9915[_0xedb9('0x25')]()[_0xedb9('0x24')](function(){var _0x328fb5=_0x5d9915['get']({'plain':!![]});var _0x512552='OpenchannelQueues';return db[_0xedb9('0x26')][_0xedb9('0x25')]({'where':{'type':_0x512552,'resourceId':_0x328fb5['id']}})[_0xedb9('0x24')](function(){return _0x5d9915;});})['then'](function(){_0x5f5c2f[_0xedb9('0x1a')](0xcc)[_0xedb9('0x1b')]();});}};}function handleEntityNotFound(_0x4db68a,_0x430863){return function(_0x51db1b){if(!_0x51db1b){_0x4db68a[_0xedb9('0x19')](0x194);}return _0x51db1b;};}function handleError(_0x23ae18,_0x1e88e7){_0x1e88e7=_0x1e88e7||0x1f4;return function(_0x3afab9){logger[_0xedb9('0x27')](_0x3afab9[_0xedb9('0x28')]);if(_0x3afab9[_0xedb9('0x29')]){delete _0x3afab9[_0xedb9('0x29')];}_0x23ae18[_0xedb9('0x1a')](_0x1e88e7)['send'](_0x3afab9);};}exports[_0xedb9('0x2a')]=function(_0x2a3115,_0x2695c2){var _0x5035d6={},_0x1f6b42={},_0x2ef842={'count':0x0,'rows':[]};var _0x2bf6ab=_['map'](db[_0xedb9('0x2b')][_0xedb9('0x2c')],function(_0xb8d667){return{'name':_0xb8d667[_0xedb9('0x2d')],'type':_0xb8d667[_0xedb9('0x2e')][_0xedb9('0x2f')]};});_0x1f6b42[_0xedb9('0x30')]=_[_0xedb9('0x31')](_0x2bf6ab,_0xedb9('0x29'));_0x1f6b42[_0xedb9('0x32')]=_[_0xedb9('0x33')](_0x2a3115[_0xedb9('0x32')]);_0x1f6b42[_0xedb9('0x34')]=_[_0xedb9('0x35')](_0x1f6b42[_0xedb9('0x30')],_0x1f6b42['query']);_0x5035d6[_0xedb9('0x36')]=_['intersection'](_0x1f6b42[_0xedb9('0x30')],qs[_0xedb9('0x37')](_0x2a3115[_0xedb9('0x32')][_0xedb9('0x37')]));_0x5035d6[_0xedb9('0x36')]=_0x5035d6[_0xedb9('0x36')][_0xedb9('0x38')]?_0x5035d6[_0xedb9('0x36')]:_0x1f6b42['model'];if(!_0x2a3115[_0xedb9('0x32')][_0xedb9('0x39')]('nolimit')){_0x5035d6[_0xedb9('0x3a')]=qs[_0xedb9('0x3a')](_0x2a3115[_0xedb9('0x32')][_0xedb9('0x3a')]);_0x5035d6['offset']=qs['offset'](_0x2a3115[_0xedb9('0x32')]['offset']);}_0x5035d6[_0xedb9('0x3b')]=qs[_0xedb9('0x3c')](_0x2a3115[_0xedb9('0x32')][_0xedb9('0x3c')]);_0x5035d6[_0xedb9('0x3d')]=qs[_0xedb9('0x34')](_['pick'](_0x2a3115[_0xedb9('0x32')],_0x1f6b42[_0xedb9('0x34')]),_0x2bf6ab);if(_0x2a3115['query'][_0xedb9('0x3e')]){_0x5035d6['where']=_[_0xedb9('0x3f')](_0x5035d6[_0xedb9('0x3d')],{'$or':_[_0xedb9('0x31')](_0x2bf6ab,function(_0x3064ad){if(_0x3064ad[_0xedb9('0x2e')]!==_0xedb9('0x40')){var _0x5382d={};_0x5382d[_0x3064ad[_0xedb9('0x29')]]={'$like':'%'+_0x2a3115[_0xedb9('0x32')][_0xedb9('0x3e')]+'%'};return _0x5382d;}})});}_0x5035d6=_['merge']({},_0x5035d6,_0x2a3115[_0xedb9('0x41')]);var _0x2cf44f={'where':_0x5035d6[_0xedb9('0x3d')]};return db[_0xedb9('0x2b')]['count'](_0x2cf44f)[_0xedb9('0x24')](function(_0x4f6919){_0x2ef842[_0xedb9('0x42')]=_0x4f6919;if(_0x2a3115['query'][_0xedb9('0x43')]){_0x5035d6[_0xedb9('0x44')]=[{'all':!![]}];}return db[_0xedb9('0x2b')][_0xedb9('0x45')](_0x5035d6);})[_0xedb9('0x24')](function(_0x21ce43){_0x2ef842[_0xedb9('0x46')]=_0x21ce43;return _0x2ef842;})[_0xedb9('0x24')](respondWithFilteredResult(_0x2695c2,_0x5035d6))['catch'](handleError(_0x2695c2,null));};exports[_0xedb9('0x47')]=function(_0x490269,_0xaa6f82){var _0x1a681e={'raw':!![],'where':{'id':_0x490269[_0xedb9('0x48')]['id']}},_0x16d635={};_0x16d635['model']=_['keys'](db[_0xedb9('0x2b')]['rawAttributes']);_0x16d635[_0xedb9('0x32')]=_['keys'](_0x490269['query']);_0x16d635[_0xedb9('0x34')]=_[_0xedb9('0x35')](_0x16d635[_0xedb9('0x30')],_0x16d635[_0xedb9('0x32')]);_0x1a681e[_0xedb9('0x36')]=_[_0xedb9('0x35')](_0x16d635[_0xedb9('0x30')],qs[_0xedb9('0x37')](_0x490269[_0xedb9('0x32')][_0xedb9('0x37')]));_0x1a681e[_0xedb9('0x36')]=_0x1a681e['attributes'][_0xedb9('0x38')]?_0x1a681e[_0xedb9('0x36')]:_0x16d635[_0xedb9('0x30')];if(_0x490269[_0xedb9('0x32')]['includeAll']){_0x1a681e[_0xedb9('0x44')]=[{'all':!![]}];}_0x1a681e=_[_0xedb9('0x3f')]({},_0x1a681e,_0x490269['options']);return db['OpenchannelQueue'][_0xedb9('0x49')](_0x1a681e)[_0xedb9('0x24')](handleEntityNotFound(_0xaa6f82,null))['then'](respondWithResult(_0xaa6f82,null))[_0xedb9('0x4a')](handleError(_0xaa6f82,null));};exports[_0xedb9('0x4b')]=function(_0x59c7eb,_0x1afccf){return db[_0xedb9('0x2b')]['create'](_0x59c7eb[_0xedb9('0x4c')],{})[_0xedb9('0x24')](function(_0x21058f){var _0x8b4ff=_0x59c7eb[_0xedb9('0x4d')][_0xedb9('0x4e')]({'plain':!![]});if(!_0x8b4ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8b4ff[_0xedb9('0x4f')]===_0xedb9('0x4d')){var _0x17d5bb=_0x21058f[_0xedb9('0x4e')]({'plain':!![]});var _0x488ecb=_0xedb9('0x50');return db[_0xedb9('0x51')][_0xedb9('0x49')]({'where':{'name':_0x488ecb,'userProfileId':_0x8b4ff[_0xedb9('0x52')]},'raw':!![]})[_0xedb9('0x24')](function(_0x3fec9a){if(_0x3fec9a&&_0x3fec9a[_0xedb9('0x53')]===0x0){return db[_0xedb9('0x26')][_0xedb9('0x4b')]({'name':_0x17d5bb[_0xedb9('0x29')],'resourceId':_0x17d5bb['id'],'type':_0x3fec9a[_0xedb9('0x29')],'sectionId':_0x3fec9a['id']},{})[_0xedb9('0x24')](function(){return _0x21058f;});}else{return _0x21058f;}})[_0xedb9('0x4a')](function(_0xcdd22b){logger[_0xedb9('0x27')](_0xedb9('0x54'),_0xcdd22b);throw _0xcdd22b;});}return _0x21058f;})['then'](respondWithResult(_0x1afccf,0xc9))[_0xedb9('0x4a')](handleError(_0x1afccf,null));};exports[_0xedb9('0x23')]=function(_0x429312,_0x361363){if(_0x429312[_0xedb9('0x4c')]['id']){delete _0x429312[_0xedb9('0x4c')]['id'];}return db[_0xedb9('0x2b')][_0xedb9('0x49')]({'where':{'id':_0x429312[_0xedb9('0x48')]['id']}})['then'](handleEntityNotFound(_0x361363,null))[_0xedb9('0x24')](saveUpdates(_0x429312[_0xedb9('0x4c')],null))[_0xedb9('0x24')](respondWithResult(_0x361363,null))[_0xedb9('0x4a')](handleError(_0x361363,null));};exports[_0xedb9('0x25')]=function(_0x56593f,_0x11c9dd){return db[_0xedb9('0x2b')][_0xedb9('0x49')]({'where':{'id':_0x56593f[_0xedb9('0x48')]['id']}})[_0xedb9('0x24')](handleEntityNotFound(_0x11c9dd,null))['then'](removeEntity(_0x11c9dd,null))['catch'](handleError(_0x11c9dd,null));};exports[_0xedb9('0x55')]=function(_0x1bae0e,_0x5d45db){return db[_0xedb9('0x2b')][_0xedb9('0x55')]()[_0xedb9('0x24')](respondWithResult(_0x5d45db,null))[_0xedb9('0x4a')](handleError(_0x5d45db,null));};exports[_0xedb9('0x56')]=function(_0x37b5d7,_0x2b2739,_0x204a3b){var _0x9bb556={'raw':!![],'where':{}},_0x24715b={},_0x5c7c8e;return db[_0xedb9('0x2b')][_0xedb9('0x57')]({'where':{'id':_0x37b5d7[_0xedb9('0x48')]['id']}})[_0xedb9('0x24')](handleEntityNotFound(_0x2b2739,null))['then'](function(_0x5cc743){if(_0x5cc743){_0x5c7c8e=_0x5cc743[_0xedb9('0x4e')]({'plain':!![]});_0x24715b[_0xedb9('0x30')]=_[_0xedb9('0x33')](db[_0xedb9('0x58')]['rawAttributes']);_0x24715b[_0xedb9('0x32')]=_['keys'](_0x37b5d7[_0xedb9('0x32')]);_0x24715b[_0xedb9('0x34')]=_[_0xedb9('0x35')](_0x24715b[_0xedb9('0x30')],_0x24715b[_0xedb9('0x32')]);_0x9bb556['attributes']=_[_0xedb9('0x35')](_0x24715b[_0xedb9('0x30')],qs[_0xedb9('0x37')](_0x37b5d7[_0xedb9('0x32')][_0xedb9('0x37')]));_0x9bb556[_0xedb9('0x36')]=_0x9bb556[_0xedb9('0x36')][_0xedb9('0x38')]?_0x9bb556[_0xedb9('0x36')]:_0x24715b[_0xedb9('0x30')];if(!_0x37b5d7[_0xedb9('0x32')][_0xedb9('0x39')]('nolimit')){_0x9bb556['limit']=qs[_0xedb9('0x3a')](_0x37b5d7[_0xedb9('0x32')]['limit']);_0x9bb556['offset']=qs[_0xedb9('0x1d')](_0x37b5d7[_0xedb9('0x32')][_0xedb9('0x1d')]);}_0x9bb556[_0xedb9('0x3b')]=qs[_0xedb9('0x3c')](_0x37b5d7['query'][_0xedb9('0x3c')]);_0x9bb556[_0xedb9('0x3d')]=qs[_0xedb9('0x34')](_['pick'](_0x37b5d7[_0xedb9('0x32')],_0x24715b[_0xedb9('0x34')]));_0x9bb556[_0xedb9('0x3d')][_0xedb9('0x59')]=_0x5cc743['id'];if(_0x37b5d7[_0xedb9('0x32')]['filter']){_0x9bb556[_0xedb9('0x3d')]=_['merge'](_0x9bb556[_0xedb9('0x3d')],{'$or':_[_0xedb9('0x31')](_0x9bb556['attributes'],function(_0xe05583){var _0x1d91b7={};_0x1d91b7[_0xe05583]={'$like':'%'+_0x37b5d7['query'][_0xedb9('0x3e')]+'%'};return _0x1d91b7;})});}_0x9bb556=_[_0xedb9('0x3f')]({},_0x9bb556,_0x37b5d7[_0xedb9('0x41')]);return db['UserOpenchannelQueue'][_0xedb9('0x45')](_0x9bb556);}})[_0xedb9('0x24')](function(_0x7f9261){if(_0x7f9261){return db[_0xedb9('0x5a')][_0xedb9('0x5b')]({'where':{'id':_[_0xedb9('0x31')](_0x7f9261,_0xedb9('0x5c')),'role':_0xedb9('0x5d')},'attributes':['id','name',_0xedb9('0x5e'),'updatedAt','createdAt']});}})[_0xedb9('0x24')](function(_0x402a0d){if(_0x402a0d){return{'count':_0x402a0d[_0xedb9('0x42')],'rows':_[_0xedb9('0x31')](_0x402a0d[_0xedb9('0x46')],function(_0x4bb9b9){return{'membername':_0x4bb9b9[_0xedb9('0x29')],'UserId':_0x4bb9b9['id'],'queue_name':_0x5c7c8e[_0xedb9('0x29')],'OpenchannelQueueId':_0x5c7c8e['id'],'interface':util[_0xedb9('0x5f')](_0xedb9('0x60'),'SIP',_0x4bb9b9[_0xedb9('0x29')]),'penalty':0x0,'paused':_0x4bb9b9[_0xedb9('0x5e')],'createdAt':_0x4bb9b9[_0xedb9('0x61')],'updatedAt':_0x4bb9b9[_0xedb9('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xedb9('0x24')](respondWithFilteredResult(_0x2b2739,_0x9bb556))[_0xedb9('0x4a')](handleError(_0x2b2739,null));};exports[_0xedb9('0x63')]=function(_0x966da1,_0x4fa0ec,_0xca68f6){var _0x28dea7={};var _0x187e14={};var _0x391704;var _0x57c32c;return db[_0xedb9('0x2b')]['findOne']({'where':{'id':_0x966da1[_0xedb9('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fa0ec,null))[_0xedb9('0x24')](function(_0xf60e97){if(_0xf60e97){_0x391704=_0xf60e97;_0x187e14[_0xedb9('0x30')]=_[_0xedb9('0x33')](db[_0xedb9('0x64')][_0xedb9('0x2c')]);_0x187e14[_0xedb9('0x32')]=_[_0xedb9('0x33')](_0x966da1[_0xedb9('0x32')]);_0x187e14['filters']=_['intersection'](_0x187e14[_0xedb9('0x30')],_0x187e14[_0xedb9('0x32')]);_0x28dea7[_0xedb9('0x36')]=_['intersection'](_0x187e14[_0xedb9('0x30')],qs[_0xedb9('0x37')](_0x966da1['query'][_0xedb9('0x37')]));_0x28dea7[_0xedb9('0x36')]=_0x28dea7[_0xedb9('0x36')][_0xedb9('0x38')]?_0x28dea7[_0xedb9('0x36')]:_0x187e14[_0xedb9('0x30')];_0x28dea7[_0xedb9('0x3b')]=qs[_0xedb9('0x3c')](_0x966da1[_0xedb9('0x32')][_0xedb9('0x3c')]);_0x28dea7['where']=qs['filters'](_['pick'](_0x966da1[_0xedb9('0x32')],_0x187e14[_0xedb9('0x34')]));if(_0x966da1['query'][_0xedb9('0x3e')]){_0x28dea7['where']=_[_0xedb9('0x3f')](_0x28dea7[_0xedb9('0x3d')],{'$or':_[_0xedb9('0x31')](_0x28dea7[_0xedb9('0x36')],function(_0x71c315){var _0x151637={};_0x151637[_0x71c315]={'$like':'%'+_0x966da1[_0xedb9('0x32')][_0xedb9('0x3e')]+'%'};return _0x151637;})});}_0x28dea7=_[_0xedb9('0x3f')]({},_0x28dea7,_0x966da1[_0xedb9('0x41')]);return _0x391704['getTeams'](_0x28dea7);}})[_0xedb9('0x24')](function(_0x44c610){if(_0x44c610){_0x57c32c=_0x44c610['length'];if(!_0x966da1[_0xedb9('0x32')][_0xedb9('0x39')](_0xedb9('0x65'))){_0x28dea7['limit']=qs[_0xedb9('0x3a')](_0x966da1[_0xedb9('0x32')][_0xedb9('0x3a')]);_0x28dea7[_0xedb9('0x1d')]=qs[_0xedb9('0x1d')](_0x966da1[_0xedb9('0x32')][_0xedb9('0x1d')]);}return _0x391704['getTeams'](_0x28dea7);}})['then'](function(_0x178a71){if(_0x178a71){return _0x178a71?{'count':_0x57c32c,'rows':_0x178a71}:null;}})['then'](respondWithResult(_0x4fa0ec,null))[_0xedb9('0x4a')](handleError(_0x4fa0ec,null));};exports[_0xedb9('0x66')]=function(_0x10767a,_0x38686e,_0x4c3602){var _0x454985=_0x10767a[_0xedb9('0x4c')]['ids'];return db[_0xedb9('0x64')][_0xedb9('0x45')]({'where':{'id':_0x454985},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xedb9('0x29'),'online',_0xedb9('0x67'),_0xedb9('0x68')],'raw':!![]}]})[_0xedb9('0x24')](function(_0x1109f5){if(_0x1109f5){var _0xc479d5=_[_0xedb9('0x69')](_0x1109f5,function(_0x1fdb52){var _0x131066=_0x1fdb52[_0xedb9('0x4e')]({'plain':!![]});return _0x131066['Agents'];});return db[_0xedb9('0x2b')][_0xedb9('0x49')]({'where':{'id':_0x10767a[_0xedb9('0x48')]['id']}})[_0xedb9('0x24')](function(_0x5af119){return db[_0xedb9('0x6a')][_0xedb9('0x6b')](function(_0x11cb61){return _0x5af119['addTeams'](_0x454985,{'transaction':_0x11cb61})[_0xedb9('0x24')](function(){return BPromise[_0xedb9('0x6c')](_0xc479d5,function(_0x31fd7e){return db['UserOpenchannelQueue'][_0xedb9('0x6d')]({'where':{'UserId':_0x31fd7e['id'],'OpenchannelQueueId':_0x10767a[_0xedb9('0x48')]['id']},'transaction':_0x11cb61});});})[_0xedb9('0x24')](function(){_0xc479d5[_0xedb9('0x6e')](function(_0x157122){socket[_0xedb9('0x6f')](_0xedb9('0x70'),{'UserId':_0x157122['id'],'OpenchannelQueueId':_0x5af119['id']});});});});});}})[_0xedb9('0x24')](respondWithStatusCode(_0x38686e,null))[_0xedb9('0x4a')](handleError(_0x38686e,null));};exports[_0xedb9('0x71')]=function(_0xc40b55,_0x46d5c6,_0x4d9736){return db[_0xedb9('0x64')][_0xedb9('0x45')]({'where':{'id':_0xc40b55[_0xedb9('0x32')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xedb9('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x46d5c6,null))[_0xedb9('0x24')](function(_0x35eac0){var _0x486ca9=_['map'](_0x35eac0,'id');var _0x9d4e0b=[];var _0x49e84d=[];var _0x385ee0=squel['select']();_0x385ee0[_0xedb9('0x73')](_0xedb9('0x74'))[_0xedb9('0x75')](_0xedb9('0x76'),'tq')[_0xedb9('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xedb9('0x3d')]('OpenchannelQueueId\x20=\x20?',_0xc40b55[_0xedb9('0x48')]['id']);for(var _0x360356=0x0;_0x360356<_0x35eac0[_0xedb9('0x38')];_0x360356+=0x1){let _0x3319b1=_0x35eac0[_0x360356];for(var _0x129644=0x0;_0x129644<_0x3319b1[_0xedb9('0x72')]['length'];_0x129644+=0x1){let _0x56191f=_0x3319b1[_0xedb9('0x72')][_0x129644];var _0x594d71=_0x385ee0[_0xedb9('0x78')]();_0x594d71[_0xedb9('0x3d')](_0xedb9('0x79'),_0x56191f['id']);_0x49e84d['push'](db[_0xedb9('0x6a')][_0xedb9('0x32')](_0x594d71[_0xedb9('0x7a')](),{'type':db[_0xedb9('0x6a')]['QueryTypes'][_0xedb9('0x7b')]})[_0xedb9('0x24')](function(_0x23e8ed){if(_0x23e8ed[_0xedb9('0x38')]===0x1){return _0x56191f['id'];}else{var _0x47843f=_[_0xedb9('0x7c')](_['map'](_0x23e8ed,_0xedb9('0x7d')),function(_0x427bb5){return _[_0xedb9('0x7e')](_0x486ca9,_0x427bb5);});if(_0x47843f){return _0x56191f['id'];}}}));}}return BPromise['all'](_0x49e84d)[_0xedb9('0x24')](function(_0x22ca61){_0x9d4e0b=_(_0x9d4e0b)[_0xedb9('0x7f')](_0x22ca61)[_0xedb9('0x80')]()['value']();return db[_0xedb9('0x2b')]['find']({'where':{'id':_0xc40b55['params']['id']}})[_0xedb9('0x24')](function(_0x5b69a3){return db[_0xedb9('0x6a')][_0xedb9('0x6b')](function(_0x59d466){return _0x5b69a3[_0xedb9('0x71')](_0xc40b55[_0xedb9('0x32')]['ids'],{'transaction':_0x59d466})[_0xedb9('0x24')](function(){if(!_['isEmpty'](_0x9d4e0b)){return _0x5b69a3[_0xedb9('0x81')](_0x9d4e0b,{'transaction':_0x59d466});}})[_0xedb9('0x24')](function(){_0x9d4e0b[_0xedb9('0x6e')](function(_0x152126){socket['emit'](_0xedb9('0x82'),{'UserId':_0x152126,'OpenchannelQueueId':_0x5b69a3['id']});});});});});});})['then'](respondWithStatusCode(_0x46d5c6,null))[_0xedb9('0x4a')](handleError(_0x46d5c6,null));};exports[_0xedb9('0x83')]=function(_0x446972,_0x57ffeb,_0x79c2cb){return db[_0xedb9('0x2b')][_0xedb9('0x49')]({'where':{'id':_0x446972[_0xedb9('0x48')]['id']}})[_0xedb9('0x24')](handleEntityNotFound(_0x57ffeb,null))['then'](function(_0x20b223){if(_0x20b223){return _0x20b223['addAgents'](_0x446972['body'][_0xedb9('0x84')],_[_0xedb9('0x85')](_0x446972[_0xedb9('0x4c')],[_0xedb9('0x84'),'id'])||{})[_0xedb9('0x86')](function(_0x4b9914){for(var _0x1ad85c=0x0;_0x1ad85c<_0x446972[_0xedb9('0x4c')][_0xedb9('0x84')]['length'];_0x1ad85c+=0x1){socket[_0xedb9('0x6f')](_0xedb9('0x70'),{'UserId':_0x446972[_0xedb9('0x4c')]['ids'][_0x1ad85c],'OpenchannelQueueId':_0x446972['params']['id']});}return _0x4b9914;});}})['then'](respondWithResult(_0x57ffeb,null))[_0xedb9('0x4a')](handleError(_0x57ffeb,null));};exports[_0xedb9('0x81')]=function(_0x48f74d,_0x3cd228,_0x44b5d5){return db[_0xedb9('0x2b')][_0xedb9('0x49')]({'where':{'id':_0x48f74d[_0xedb9('0x48')]['id']}})[_0xedb9('0x24')](handleEntityNotFound(_0x3cd228,null))[_0xedb9('0x24')](function(_0xb46ad0){if(_0xb46ad0){return _0xb46ad0['removeAgents'](_0x48f74d[_0xedb9('0x32')][_0xedb9('0x84')])[_0xedb9('0x24')](function(){if(_['isArray'](_0x48f74d[_0xedb9('0x32')]['ids'])){for(var _0x3f3e95=0x0;_0x3f3e95<_0x48f74d[_0xedb9('0x32')][_0xedb9('0x84')][_0xedb9('0x38')];_0x3f3e95+=0x1){socket[_0xedb9('0x6f')](_0xedb9('0x82'),{'UserId':Number(_0x48f74d['query'][_0xedb9('0x84')][_0x3f3e95]),'OpenchannelQueueId':Number(_0x48f74d[_0xedb9('0x48')]['id'])});}}else{socket[_0xedb9('0x6f')](_0xedb9('0x82'),{'UserId':Number(_0x48f74d['query'][_0xedb9('0x84')]),'OpenchannelQueueId':Number(_0x48f74d[_0xedb9('0x48')]['id'])});}});}})[_0xedb9('0x24')](respondWithStatusCode(_0x3cd228,null))['catch'](handleError(_0x3cd228,null));};exports[_0xedb9('0x87')]=function(_0x1cf58e,_0x13e86e,_0x3eee76){var _0x1c3b06={};var _0x22e790={};var _0x207029;var _0x4d5d53;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1cf58e[_0xedb9('0x48')]['id']}})[_0xedb9('0x24')](handleEntityNotFound(_0x13e86e,null))[_0xedb9('0x24')](function(_0x1ff115){if(_0x1ff115){_0x207029=_0x1ff115;_0x22e790[_0xedb9('0x30')]=_[_0xedb9('0x33')](db['User'][_0xedb9('0x2c')]);_0x22e790['query']=_[_0xedb9('0x33')](_0x1cf58e[_0xedb9('0x32')]);_0x22e790[_0xedb9('0x34')]=_[_0xedb9('0x35')](_0x22e790[_0xedb9('0x30')],_0x22e790[_0xedb9('0x32')]);_0x1c3b06[_0xedb9('0x36')]=_[_0xedb9('0x35')](_0x22e790['model'],qs[_0xedb9('0x37')](_0x1cf58e['query'][_0xedb9('0x37')]));_0x1c3b06[_0xedb9('0x36')]=_0x1c3b06[_0xedb9('0x36')]['length']?_0x1c3b06['attributes']:_0x22e790[_0xedb9('0x30')];_0x1c3b06[_0xedb9('0x3b')]=qs['sort'](_0x1cf58e['query']['sort']);_0x1c3b06[_0xedb9('0x3d')]=qs[_0xedb9('0x34')](_[_0xedb9('0x88')](_0x1cf58e[_0xedb9('0x32')],_0x22e790[_0xedb9('0x34')]));if(_0x1cf58e[_0xedb9('0x32')]['filter']){_0x1c3b06[_0xedb9('0x3d')]=_[_0xedb9('0x3f')](_0x1c3b06[_0xedb9('0x3d')],{'$or':_[_0xedb9('0x31')](_0x1c3b06[_0xedb9('0x36')],function(_0x530675){var _0x8a1f8f={};_0x8a1f8f[_0x530675]={'$like':'%'+_0x1cf58e['query'][_0xedb9('0x3e')]+'%'};return _0x8a1f8f;})});}_0x1c3b06=_[_0xedb9('0x3f')]({},_0x1c3b06,_0x1cf58e[_0xedb9('0x41')]);return _0x207029[_0xedb9('0x87')](_0x1c3b06);}})[_0xedb9('0x24')](function(_0x255a7c){if(_0x255a7c){_0x4d5d53=_0x255a7c[_0xedb9('0x38')];if(!_0x1cf58e[_0xedb9('0x32')]['hasOwnProperty'](_0xedb9('0x65'))){_0x1c3b06[_0xedb9('0x3a')]=qs[_0xedb9('0x3a')](_0x1cf58e[_0xedb9('0x32')][_0xedb9('0x3a')]);_0x1c3b06[_0xedb9('0x1d')]=qs[_0xedb9('0x1d')](_0x1cf58e['query'][_0xedb9('0x1d')]);}return _0x207029['getAgents'](_0x1c3b06);}})[_0xedb9('0x24')](function(_0x227f6f){if(_0x227f6f){return _0x227f6f?{'count':_0x4d5d53,'rows':_0x227f6f}:null;}})[_0xedb9('0x24')](respondWithResult(_0x13e86e,null))[_0xedb9('0x4a')](handleError(_0x13e86e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3bad873..531eb48 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 _0xfcd5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x270df1,_0x30030f){var _0x561060=function(_0x17977f){while(--_0x17977f){_0x270df1['push'](_0x270df1['shift']());}};_0x561060(++_0x30030f);}(_0xfcd5,0xef));var _0x5fcd=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xfcd5[_0x57add2];return _0x4e3670;};'use strict';var EventEmitter=require(_0x5fcd('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5fcd('0x1')](0x0);var events={'afterCreate':_0x5fcd('0x2'),'afterUpdate':_0x5fcd('0x3'),'afterDestroy':_0x5fcd('0x4')};function emitEvent(_0x55efaa){return function(_0x12cfec,_0x1afbe8,_0x559fb3){OpenchannelQueueEvents[_0x5fcd('0x5')](_0x55efaa+':'+_0x12cfec['id'],_0x12cfec);OpenchannelQueueEvents[_0x5fcd('0x5')](_0x55efaa,_0x12cfec);_0x559fb3(null);};}for(var e in events){if(events[_0x5fcd('0x6')](e)){var event=events[e];OpenchannelQueue[_0x5fcd('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x37b0=['OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4d67c1,_0x24b806){var _0x3eac03=function(_0x58dea2){while(--_0x58dea2){_0x4d67c1['push'](_0x4d67c1['shift']());}};_0x3eac03(++_0x24b806);}(_0x37b0,0x1ac));var _0x037b=function(_0x3f5395,_0x5189ef){_0x3f5395=_0x3f5395-0x0;var _0x1bb11e=_0x37b0[_0x3f5395];return _0x1bb11e;};'use strict';var EventEmitter=require(_0x037b('0x0'));var OpenchannelQueue=require(_0x037b('0x1'))['db'][_0x037b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x037b('0x3'),'afterUpdate':_0x037b('0x4'),'afterDestroy':_0x037b('0x5')};function emitEvent(_0x2b9bca){return function(_0x34834a,_0x4ef969,_0x265c96){OpenchannelQueueEvents[_0x037b('0x6')](_0x2b9bca+':'+_0x34834a['id'],_0x34834a);OpenchannelQueueEvents[_0x037b('0x6')](_0x2b9bca,_0x34834a);_0x265c96(null);};}for(var e in events){if(events[_0x037b('0x7')](e)){var event=events[e];OpenchannelQueue[_0x037b('0x8')](e,emitEvent(event));}}module[_0x037b('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c5e3a8f..5c8ed4c 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 _0x9ed4=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x1ce244,_0x520863){var _0x505cd4=function(_0x1844aa){while(--_0x1844aa){_0x1ce244['push'](_0x1ce244['shift']());}};_0x505cd4(++_0x520863);}(_0x9ed4,0x1a7));var _0x49ed=function(_0xf3e4b,_0x415f36){_0xf3e4b=_0xf3e4b-0x0;var _0x18ca92=_0x9ed4[_0xf3e4b];return _0x18ca92;};'use strict';var _=require(_0x49ed('0x0'));var util=require(_0x49ed('0x1'));var logger=require(_0x49ed('0x2'))(_0x49ed('0x3'));var moment=require(_0x49ed('0x4'));var BPromise=require(_0x49ed('0x5'));var rp=require(_0x49ed('0x6'));var fs=require('fs');var path=require(_0x49ed('0x7'));var rimraf=require(_0x49ed('0x8'));var config=require(_0x49ed('0x9'));var attributes=require(_0x49ed('0xa'));module['exports']=function(_0x7a3460,_0x298ebb){return _0x7a3460[_0x49ed('0xb')](_0x49ed('0xc'),attributes,{'tableName':_0x49ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb3e=['moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','util','api'];(function(_0x397e2a,_0x221955){var _0x30d38b=function(_0x291873){while(--_0x291873){_0x397e2a['push'](_0x397e2a['shift']());}};_0x30d38b(++_0x221955);}(_0xdb3e,0x1e2));var _0xedb3=function(_0x12baf3,_0xc240ae){_0x12baf3=_0x12baf3-0x0;var _0x3206dd=_0xdb3e[_0x12baf3];return _0x3206dd;};'use strict';var _=require('lodash');var util=require(_0xedb3('0x0'));var logger=require('../../config/logger')(_0xedb3('0x1'));var moment=require(_0xedb3('0x2'));var BPromise=require(_0xedb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedb3('0x4'));var rimraf=require(_0xedb3('0x5'));var config=require(_0xedb3('0x6'));var attributes=require(_0xedb3('0x7'));module[_0xedb3('0x8')]=function(_0x38cc0f,_0x39a058){return _0x38cc0f[_0xedb3('0x9')](_0xedb3('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e94126f..6b05380 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 _0x1694=['model','attributes','then','find','ShowOpenchannelQueue','util','moment','bluebird','randomstring','rpc','client','http','redis','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','include','map'];(function(_0x8ade42,_0x2a68fb){var _0x256329=function(_0x89baae){while(--_0x89baae){_0x8ade42['push'](_0x8ade42['shift']());}};_0x256329(++_0x2a68fb);}(_0x1694,0x140));var _0x4169=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x1694[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0x4169('0x0'));var moment=require(_0x4169('0x1'));var BPromise=require(_0x4169('0x2'));var rs=require(_0x4169('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4169('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4169('0x5')][_0x4169('0x6')]({'port':0x232a});config[_0x4169('0x7')]=_['defaults'](config[_0x4169('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4169('0x8'))(new Redis(config['redis']));require(_0x4169('0x9'))['register'](socket);function respondWithRpcPromise(_0x55dc48,_0x232cdd,_0x577f78){return new BPromise(function(_0x5c1261,_0x1d661d){return client[_0x4169('0xa')](_0x55dc48,_0x577f78)['then'](function(_0x3e3252){logger[_0x4169('0xb')](_0x4169('0xc'),_0x232cdd,_0x4169('0xd'));logger[_0x4169('0xe')](_0x4169('0xf'),_0x232cdd,_0x4169('0xd'),JSON[_0x4169('0x10')](_0x3e3252));if(_0x3e3252['error']){if(_0x3e3252['error'][_0x4169('0x11')]===0x1f4){logger[_0x4169('0x12')](_0x4169('0xc'),_0x232cdd,_0x3e3252[_0x4169('0x12')][_0x4169('0x13')]);return _0x1d661d(_0x3e3252[_0x4169('0x12')][_0x4169('0x13')]);}logger[_0x4169('0x12')](_0x4169('0xc'),_0x232cdd,_0x3e3252[_0x4169('0x12')][_0x4169('0x13')]);return _0x5c1261(_0x3e3252[_0x4169('0x12')]['message']);}else{logger[_0x4169('0xb')](_0x4169('0xc'),_0x232cdd,_0x4169('0xd'));_0x5c1261(_0x3e3252[_0x4169('0x14')][_0x4169('0x13')]);}})[_0x4169('0x15')](function(_0x2a368f){logger[_0x4169('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x232cdd,_0x2a368f);_0x1d661d(_0x2a368f);});});}exports[_0x4169('0x16')]=function(_0x49a64b){var _0x3b8b91=this;return new Promise(function(_0x513e1e,_0x104b90){return db[_0x4169('0x17')][_0x4169('0x18')]({'raw':_0x49a64b[_0x4169('0x19')]?_0x49a64b[_0x4169('0x19')][_0x4169('0x1a')]===undefined?!![]:![]:!![],'where':_0x49a64b[_0x4169('0x19')]?_0x49a64b['options'][_0x4169('0x1b')]||null:null,'attributes':_0x49a64b[_0x4169('0x19')]?_0x49a64b[_0x4169('0x19')]['attributes']||null:null,'limit':_0x49a64b[_0x4169('0x19')]?_0x49a64b[_0x4169('0x19')]['limit']||null:null,'include':_0x49a64b[_0x4169('0x19')]?_0x49a64b[_0x4169('0x19')][_0x4169('0x1c')]?_[_0x4169('0x1d')](_0x49a64b[_0x4169('0x19')]['include'],function(_0x20b2b7){return{'model':db[_0x20b2b7[_0x4169('0x1e')]],'as':_0x20b2b7['as'],'attributes':_0x20b2b7['attributes'],'include':_0x20b2b7[_0x4169('0x1c')]?_[_0x4169('0x1d')](_0x20b2b7[_0x4169('0x1c')],function(_0x39ac07){return{'model':db[_0x39ac07[_0x4169('0x1e')]],'as':_0x39ac07['as'],'attributes':_0x39ac07[_0x4169('0x1f')],'include':_0x39ac07[_0x4169('0x1c')]?_[_0x4169('0x1d')](_0x39ac07['include'],function(_0x41914e){return{'model':db[_0x41914e['model']],'as':_0x41914e['as'],'attributes':_0x41914e[_0x4169('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4169('0x20')](function(_0x5a58c1){logger[_0x4169('0xb')](_0x4169('0x16'),_0x49a64b);logger[_0x4169('0xe')](_0x4169('0x16'),_0x49a64b,JSON[_0x4169('0x10')](_0x5a58c1));_0x513e1e(_0x5a58c1);})['catch'](function(_0x3a5be0){logger['error'](_0x4169('0x16'),_0x3a5be0[_0x4169('0x13')],_0x49a64b);_0x104b90(_0x3b8b91[_0x4169('0x12')](0x1f4,_0x3a5be0['message']));});});};exports['ShowOpenchannelQueue']=function(_0x199473){var _0x571fd1=this;return new Promise(function(_0x3d0edb,_0x43379b){return db[_0x4169('0x17')][_0x4169('0x21')]({'raw':_0x199473[_0x4169('0x19')]?_0x199473[_0x4169('0x19')][_0x4169('0x1a')]===undefined?!![]:![]:!![],'where':_0x199473[_0x4169('0x19')]?_0x199473[_0x4169('0x19')]['where']||null:null,'attributes':_0x199473[_0x4169('0x19')]?_0x199473[_0x4169('0x19')][_0x4169('0x1f')]||null:null,'include':_0x199473[_0x4169('0x19')]?_0x199473[_0x4169('0x19')][_0x4169('0x1c')]?_[_0x4169('0x1d')](_0x199473['options'][_0x4169('0x1c')],function(_0x16660c){return{'model':db[_0x16660c[_0x4169('0x1e')]],'as':_0x16660c['as'],'attributes':_0x16660c['attributes'],'include':_0x16660c[_0x4169('0x1c')]?_[_0x4169('0x1d')](_0x16660c[_0x4169('0x1c')],function(_0x3004bc){return{'model':db[_0x3004bc[_0x4169('0x1e')]],'as':_0x3004bc['as'],'attributes':_0x3004bc[_0x4169('0x1f')],'include':_0x3004bc[_0x4169('0x1c')]?_[_0x4169('0x1d')](_0x3004bc[_0x4169('0x1c')],function(_0x10ddd3){return{'model':db[_0x10ddd3['model']],'as':_0x10ddd3['as'],'attributes':_0x10ddd3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4169('0x20')](function(_0x58026a){logger[_0x4169('0xb')](_0x4169('0x22'),_0x199473);logger[_0x4169('0xe')](_0x4169('0x22'),_0x199473,JSON['stringify'](_0x58026a));_0x3d0edb(_0x58026a);})[_0x4169('0x15')](function(_0x485ed1){logger['error'](_0x4169('0x22'),_0x485ed1[_0x4169('0x13')],_0x199473);_0x43379b(_0x571fd1[_0x4169('0x12')](0x1f4,_0x485ed1['message']));});});}; \ No newline at end of file +var _0x254e=['message','result','catch','GetOpenchannelQueue','options','raw','where','attributes','limit','include','map','model','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3d3c68,_0x555997){var _0x3a2837=function(_0x15c300){while(--_0x15c300){_0x3d3c68['push'](_0x3d3c68['shift']());}};_0x3a2837(++_0x555997);}(_0x254e,0xa7));var _0xe254=function(_0x393403,_0x2525a2){_0x393403=_0x393403-0x0;var _0x83f689=_0x254e[_0x393403];return _0x83f689;};'use strict';var _=require(_0xe254('0x0'));var util=require('util');var moment=require(_0xe254('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe254('0x2'));var db=require(_0xe254('0x3'))['db'];var utils=require(_0xe254('0x4'));var logger=require('../../config/logger')(_0xe254('0x5'));var config=require(_0xe254('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe254('0x7')]['http']({'port':0x232a});config['redis']=_[_0xe254('0x8')](config[_0xe254('0x9')],{'host':_0xe254('0xa'),'port':0x18eb});var socket=require(_0xe254('0xb'))(new Redis(config[_0xe254('0x9')]));require(_0xe254('0xc'))[_0xe254('0xd')](socket);function respondWithRpcPromise(_0x4945f7,_0x16fec6,_0x505571){return new BPromise(function(_0x4708a4,_0x41b033){return client[_0xe254('0xe')](_0x4945f7,_0x505571)[_0xe254('0xf')](function(_0x3be036){logger[_0xe254('0x10')](_0xe254('0x11'),_0x16fec6,_0xe254('0x12'));logger[_0xe254('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x16fec6,_0xe254('0x12'),JSON[_0xe254('0x14')](_0x3be036));if(_0x3be036[_0xe254('0x15')]){if(_0x3be036[_0xe254('0x15')][_0xe254('0x16')]===0x1f4){logger[_0xe254('0x15')](_0xe254('0x11'),_0x16fec6,_0x3be036[_0xe254('0x15')]['message']);return _0x41b033(_0x3be036[_0xe254('0x15')][_0xe254('0x17')]);}logger['error'](_0xe254('0x11'),_0x16fec6,_0x3be036[_0xe254('0x15')][_0xe254('0x17')]);return _0x4708a4(_0x3be036[_0xe254('0x15')]['message']);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x16fec6,_0xe254('0x12'));_0x4708a4(_0x3be036[_0xe254('0x18')][_0xe254('0x17')]);}})[_0xe254('0x19')](function(_0x354bfe){logger[_0xe254('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x16fec6,_0x354bfe);_0x41b033(_0x354bfe);});});}exports[_0xe254('0x1a')]=function(_0x59350b){var _0x4f1b84=this;return new Promise(function(_0x33c344,_0x1c8e5){return db['OpenchannelQueue']['findAll']({'raw':_0x59350b[_0xe254('0x1b')]?_0x59350b[_0xe254('0x1b')][_0xe254('0x1c')]===undefined?!![]:![]:!![],'where':_0x59350b[_0xe254('0x1b')]?_0x59350b[_0xe254('0x1b')][_0xe254('0x1d')]||null:null,'attributes':_0x59350b['options']?_0x59350b[_0xe254('0x1b')][_0xe254('0x1e')]||null:null,'limit':_0x59350b[_0xe254('0x1b')]?_0x59350b[_0xe254('0x1b')][_0xe254('0x1f')]||null:null,'include':_0x59350b[_0xe254('0x1b')]?_0x59350b[_0xe254('0x1b')][_0xe254('0x20')]?_[_0xe254('0x21')](_0x59350b['options'][_0xe254('0x20')],function(_0x46382b){return{'model':db[_0x46382b[_0xe254('0x22')]],'as':_0x46382b['as'],'attributes':_0x46382b['attributes'],'include':_0x46382b[_0xe254('0x20')]?_[_0xe254('0x21')](_0x46382b[_0xe254('0x20')],function(_0x29a1a4){return{'model':db[_0x29a1a4['model']],'as':_0x29a1a4['as'],'attributes':_0x29a1a4[_0xe254('0x1e')],'include':_0x29a1a4[_0xe254('0x20')]?_[_0xe254('0x21')](_0x29a1a4[_0xe254('0x20')],function(_0x82871a){return{'model':db[_0x82871a['model']],'as':_0x82871a['as'],'attributes':_0x82871a[_0xe254('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe254('0xf')](function(_0x58cc8a){logger[_0xe254('0x10')]('GetOpenchannelQueue',_0x59350b);logger['debug'](_0xe254('0x1a'),_0x59350b,JSON['stringify'](_0x58cc8a));_0x33c344(_0x58cc8a);})['catch'](function(_0x516a0b){logger[_0xe254('0x15')](_0xe254('0x1a'),_0x516a0b[_0xe254('0x17')],_0x59350b);_0x1c8e5(_0x4f1b84[_0xe254('0x15')](0x1f4,_0x516a0b[_0xe254('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x4a0e1b){var _0x24fc44=this;return new Promise(function(_0x4be807,_0xe2be54){return db[_0xe254('0x23')][_0xe254('0x24')]({'raw':_0x4a0e1b['options']?_0x4a0e1b[_0xe254('0x1b')][_0xe254('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a0e1b['options']?_0x4a0e1b['options']['where']||null:null,'attributes':_0x4a0e1b[_0xe254('0x1b')]?_0x4a0e1b[_0xe254('0x1b')][_0xe254('0x1e')]||null:null,'include':_0x4a0e1b[_0xe254('0x1b')]?_0x4a0e1b[_0xe254('0x1b')][_0xe254('0x20')]?_[_0xe254('0x21')](_0x4a0e1b[_0xe254('0x1b')][_0xe254('0x20')],function(_0x15600a){return{'model':db[_0x15600a[_0xe254('0x22')]],'as':_0x15600a['as'],'attributes':_0x15600a[_0xe254('0x1e')],'include':_0x15600a['include']?_[_0xe254('0x21')](_0x15600a[_0xe254('0x20')],function(_0x5eb532){return{'model':db[_0x5eb532[_0xe254('0x22')]],'as':_0x5eb532['as'],'attributes':_0x5eb532[_0xe254('0x1e')],'include':_0x5eb532[_0xe254('0x20')]?_['map'](_0x5eb532[_0xe254('0x20')],function(_0x790f9e){return{'model':db[_0x790f9e[_0xe254('0x22')]],'as':_0x790f9e['as'],'attributes':_0x790f9e[_0xe254('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe254('0xf')](function(_0x5d1ccf){logger['info']('ShowOpenchannelQueue',_0x4a0e1b);logger[_0xe254('0x13')](_0xe254('0x25'),_0x4a0e1b,JSON['stringify'](_0x5d1ccf));_0x4be807(_0x5d1ccf);})[_0xe254('0x19')](function(_0x496e56){logger[_0xe254('0x15')](_0xe254('0x25'),_0x496e56[_0xe254('0x17')],_0x4a0e1b);_0xe2be54(_0x24fc44[_0xe254('0x15')](0x1f4,_0x496e56[_0xe254('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 40f7c65..0fdff0e 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 _0x7fb0=['emit','removeListener','register','length','update'];(function(_0x48f8dd,_0x341534){var _0x1aa231=function(_0x3134e4){while(--_0x3134e4){_0x48f8dd['push'](_0x48f8dd['shift']());}};_0x1aa231(++_0x341534);}(_0x7fb0,0xbd));var _0x07fb=function(_0x5752c8,_0x6576c5){_0x5752c8=_0x5752c8-0x0;var _0x2784d7=_0x7fb0[_0x5752c8];return _0x2784d7;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0x07fb('0x0')];function createListener(_0x4542c8,_0x54b4d2){return function(_0x59c141){_0x54b4d2[_0x07fb('0x1')](_0x4542c8,_0x59c141);};}function removeListener(_0xab115b,_0x813d0b){return function(){OpenchannelQueueEvents[_0x07fb('0x2')](_0xab115b,_0x813d0b);};}exports[_0x07fb('0x3')]=function(_0x452ead){for(var _0xbc77b0=0x0,_0x5c0e5d=events[_0x07fb('0x4')];_0xbc77b0<_0x5c0e5d;_0xbc77b0++){var _0x2360b5=events[_0xbc77b0];var _0x20683e=createListener('openchannelQueue:'+_0x2360b5,_0x452ead);OpenchannelQueueEvents['on'](_0x2360b5,_0x20683e);}}; \ No newline at end of file +var _0x55b8=['save','remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3f9a6e,_0x17f592){var _0x1f7ddc=function(_0x157a09){while(--_0x157a09){_0x3f9a6e['push'](_0x3f9a6e['shift']());}};_0x1f7ddc(++_0x17f592);}(_0x55b8,0xf7));var _0x855b=function(_0xc0b49f,_0x4eb31f){_0xc0b49f=_0xc0b49f-0x0;var _0x17bf09=_0x55b8[_0xc0b49f];return _0x17bf09;};'use strict';var OpenchannelQueueEvents=require(_0x855b('0x0'));var events=[_0x855b('0x1'),_0x855b('0x2'),_0x855b('0x3')];function createListener(_0x382956,_0x4093be){return function(_0x6018a3){_0x4093be[_0x855b('0x4')](_0x382956,_0x6018a3);};}function removeListener(_0x4ea0b3,_0x2b7cea){return function(){OpenchannelQueueEvents[_0x855b('0x5')](_0x4ea0b3,_0x2b7cea);};}exports[_0x855b('0x6')]=function(_0x857fe4){for(var _0x45fa03=0x0,_0x535526=events['length'];_0x45fa03<_0x535526;_0x45fa03++){var _0xb3ae36=events[_0x45fa03];var _0x475aae=createListener(_0x855b('0x7')+_0xb3ae36,_0x857fe4);OpenchannelQueueEvents['on'](_0xb3ae36,_0x475aae);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d98fc26..00a2ae2 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 _0xa5ab=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3505e9,_0x1864e0){var _0x3318b9=function(_0x2d1019){while(--_0x2d1019){_0x3505e9['push'](_0x3505e9['shift']());}};_0x3318b9(++_0x1864e0);}(_0xa5ab,0x15a));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xba5a('0x0'));var util=require(_0xba5a('0x1'));var path=require(_0xba5a('0x2'));var timeout=require(_0xba5a('0x3'));var express=require(_0xba5a('0x4'));var router=express[_0xba5a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xba5a('0x6'));var config=require(_0xba5a('0x7'));var controller=require(_0xba5a('0x8'));router[_0xba5a('0x9')]('/',auth['isAuthenticated'](),controller[_0xba5a('0xa')]);router[_0xba5a('0x9')]('/describe',auth[_0xba5a('0xb')](),controller[_0xba5a('0xc')]);router[_0xba5a('0x9')](_0xba5a('0xd'),auth['isAuthenticated'](),controller[_0xba5a('0xe')]);router[_0xba5a('0xf')]('/',auth[_0xba5a('0xb')](),controller[_0xba5a('0x10')]);router[_0xba5a('0x11')]('/:id',auth[_0xba5a('0xb')](),controller[_0xba5a('0x12')]);router[_0xba5a('0x13')]('/:id',auth[_0xba5a('0xb')](),controller[_0xba5a('0x14')]);module[_0xba5a('0x15')]=router; \ No newline at end of file +var _0x54c8=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x54c8,0xc1));var _0x854c=function(_0x2fecd4,_0x389845){_0x2fecd4=_0x2fecd4-0x0;var _0x4c9217=_0x54c8[_0x2fecd4];return _0x4c9217;};'use strict';var multer=require(_0x854c('0x0'));var util=require(_0x854c('0x1'));var path=require(_0x854c('0x2'));var timeout=require(_0x854c('0x3'));var express=require(_0x854c('0x4'));var router=express['Router']();var auth=require(_0x854c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x854c('0x6'));var controller=require(_0x854c('0x7'));router[_0x854c('0x8')]('/',auth[_0x854c('0x9')](),controller[_0x854c('0xa')]);router['get'](_0x854c('0xb'),auth[_0x854c('0x9')](),controller[_0x854c('0xc')]);router[_0x854c('0x8')]('/:id',auth[_0x854c('0x9')](),controller[_0x854c('0xd')]);router['post']('/',auth[_0x854c('0x9')](),controller[_0x854c('0xe')]);router[_0x854c('0xf')](_0x854c('0x10'),auth['isAuthenticated'](),controller[_0x854c('0x11')]);router[_0x854c('0x12')](_0x854c('0x10'),auth[_0x854c('0x9')](),controller['destroy']);module[_0x854c('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 074037b..7e18a41 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 _0x3fcb=['STRING','DATE','moment','exports'];(function(_0x71d36,_0x527131){var _0x18e416=function(_0x3d1873){while(--_0x3d1873){_0x71d36['push'](_0x71d36['shift']());}};_0x18e416(++_0x527131);}(_0x3fcb,0x17a));var _0xb3fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3fcb[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0xb3fc('0x0'));var Sequelize=require('sequelize');module[_0xb3fc('0x1')]={'uniqueid':{'type':Sequelize[_0xb3fc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb3fc('0x2')]},'joinAt':{'type':Sequelize[_0xb3fc('0x3')]},'leaveAt':{'type':Sequelize[_0xb3fc('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb3fc('0x2')]}}; \ No newline at end of file +var _0xd6ab=['DATE','moment','sequelize','exports','STRING'];(function(_0x538a22,_0x51738a){var _0x2d1f1b=function(_0xb741b1){while(--_0xb741b1){_0x538a22['push'](_0x538a22['shift']());}};_0x2d1f1b(++_0x51738a);}(_0xd6ab,0x1be));var _0xbd6a=function(_0x90229a,_0x36acd3){_0x90229a=_0x90229a-0x0;var _0xcdbea2=_0xd6ab[_0x90229a];return _0xcdbea2;};'use strict';var moment=require(_0xbd6a('0x0'));var Sequelize=require(_0xbd6a('0x1'));module[_0xbd6a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbd6a('0x3')]},'joinAt':{'type':Sequelize[_0xbd6a('0x4')]},'leaveAt':{'type':Sequelize[_0xbd6a('0x4')]},'acceptAt':{'type':Sequelize[_0xbd6a('0x4')]},'exitAt':{'type':Sequelize[_0xbd6a('0x4')]},'reason':{'type':Sequelize[_0xbd6a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 18bfe39..64301b0 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 _0x2060=['hasOwnProperty','limit','order','where','pick','merge','type','VIRTUAL','options','count','includeAll','rows','catch','params','rawAttributes','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','set','Content-Range','apply','reject','save','update','then','status','error','name','send','index','map','OpenchannelQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x2060,0x1be));var _0x0206=function(_0xfc4566,_0x4635e9){_0xfc4566=_0xfc4566-0x0;var _0x133923=_0x2060[_0xfc4566];return _0x133923;};'use strict';var pdf=require(_0x0206('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0206('0x1'));var zipdir=require(_0x0206('0x2'));var jsonpatch=require(_0x0206('0x3'));var rp=require(_0x0206('0x4'));var moment=require('moment');var BPromise=require(_0x0206('0x5'));var Mustache=require(_0x0206('0x6'));var util=require('util');var path=require(_0x0206('0x7'));var sox=require('sox');var csv=require(_0x0206('0x8'));var ejs=require(_0x0206('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0206('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0206('0xb'));var toCsv=require(_0x0206('0x8'));var querystring=require(_0x0206('0xc'));var Papa=require(_0x0206('0xd'));var Redis=require(_0x0206('0xe'));var authService=require(_0x0206('0xf'));var qs=require(_0x0206('0x10'));var as=require(_0x0206('0x11'));var hardwareService=require(_0x0206('0x12'));var logger=require(_0x0206('0x13'))(_0x0206('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0206('0x15'));var db=require(_0x0206('0x16'))['db'];function respondWithStatusCode(_0x58cef1,_0x3e7cc1){_0x3e7cc1=_0x3e7cc1||0xcc;return function(_0x3d4bb6){if(_0x3d4bb6){return _0x58cef1[_0x0206('0x17')](_0x3e7cc1);}return _0x58cef1['status'](_0x3e7cc1)[_0x0206('0x18')]();};}function respondWithResult(_0x430327,_0x1838e0){_0x1838e0=_0x1838e0||0xc8;return function(_0x46acdb){if(_0x46acdb){return _0x430327['status'](_0x1838e0)[_0x0206('0x19')](_0x46acdb);}};}function respondWithFilteredResult(_0x4bedf9,_0x1370bd){return function(_0x1ac4b0){if(_0x1ac4b0){var _0x41a062=_0x1ac4b0['count'],_0x11bc7f=_0x1370bd['offset'],_0x1c1771=_0x1370bd[_0x0206('0x1a')]+_0x1370bd['limit'],_0x26c261;if(_0x1c1771>=_0x41a062){_0x1c1771=_0x41a062;_0x26c261=0xc8;}else{_0x26c261=0xce;}_0x4bedf9['status'](_0x26c261);return _0x4bedf9[_0x0206('0x1b')](_0x0206('0x1c'),_0x11bc7f+'-'+_0x1c1771+'/'+_0x41a062)[_0x0206('0x19')](_0x1ac4b0);}return null;};}function patchUpdates(_0x1bed63){return function(_0x5540e4){try{jsonpatch[_0x0206('0x1d')](_0x5540e4,_0x1bed63,!![]);}catch(_0x43ad08){return BPromise[_0x0206('0x1e')](_0x43ad08);}return _0x5540e4[_0x0206('0x1f')]();};}function saveUpdates(_0x3c189c,_0x41aa22){return function(_0x7ee5a2){if(_0x7ee5a2){return _0x7ee5a2[_0x0206('0x20')](_0x3c189c)['then'](function(_0x5ea4f){return _0x5ea4f;});}return null;};}function removeEntity(_0x5da8a4,_0x5cc687){return function(_0x2a37c7){if(_0x2a37c7){return _0x2a37c7['destroy']()[_0x0206('0x21')](function(){_0x5da8a4[_0x0206('0x22')](0xcc)[_0x0206('0x18')]();});}};}function handleEntityNotFound(_0x4c5452,_0x399f38){return function(_0x1c8ee9){if(!_0x1c8ee9){_0x4c5452[_0x0206('0x17')](0x194);}return _0x1c8ee9;};}function handleError(_0x4c5027,_0x487019){_0x487019=_0x487019||0x1f4;return function(_0x3b9890){logger[_0x0206('0x23')](_0x3b9890['stack']);if(_0x3b9890[_0x0206('0x24')]){delete _0x3b9890[_0x0206('0x24')];}_0x4c5027[_0x0206('0x22')](_0x487019)[_0x0206('0x25')](_0x3b9890);};}exports[_0x0206('0x26')]=function(_0x519a0a,_0x847866){var _0x18513c={},_0xe29e8d={},_0x5ec89c={'count':0x0,'rows':[]};var _0x29405f=_[_0x0206('0x27')](db[_0x0206('0x28')]['rawAttributes'],function(_0xe6320c){return{'name':_0xe6320c[_0x0206('0x29')],'type':_0xe6320c['type'][_0x0206('0x2a')]};});_0xe29e8d[_0x0206('0x2b')]=_[_0x0206('0x27')](_0x29405f,'name');_0xe29e8d[_0x0206('0x2c')]=_[_0x0206('0x2d')](_0x519a0a[_0x0206('0x2c')]);_0xe29e8d[_0x0206('0x2e')]=_[_0x0206('0x2f')](_0xe29e8d[_0x0206('0x2b')],_0xe29e8d[_0x0206('0x2c')]);_0x18513c[_0x0206('0x30')]=_[_0x0206('0x2f')](_0xe29e8d[_0x0206('0x2b')],qs[_0x0206('0x31')](_0x519a0a['query']['fields']));_0x18513c[_0x0206('0x30')]=_0x18513c[_0x0206('0x30')][_0x0206('0x32')]?_0x18513c[_0x0206('0x30')]:_0xe29e8d[_0x0206('0x2b')];if(!_0x519a0a[_0x0206('0x2c')][_0x0206('0x33')]('nolimit')){_0x18513c[_0x0206('0x34')]=qs[_0x0206('0x34')](_0x519a0a[_0x0206('0x2c')][_0x0206('0x34')]);_0x18513c[_0x0206('0x1a')]=qs['offset'](_0x519a0a[_0x0206('0x2c')][_0x0206('0x1a')]);}_0x18513c[_0x0206('0x35')]=qs['sort'](_0x519a0a[_0x0206('0x2c')]['sort']);_0x18513c[_0x0206('0x36')]=qs[_0x0206('0x2e')](_[_0x0206('0x37')](_0x519a0a['query'],_0xe29e8d[_0x0206('0x2e')]),_0x29405f);if(_0x519a0a[_0x0206('0x2c')]['filter']){_0x18513c['where']=_[_0x0206('0x38')](_0x18513c[_0x0206('0x36')],{'$or':_[_0x0206('0x27')](_0x29405f,function(_0x34944c){if(_0x34944c[_0x0206('0x39')]!==_0x0206('0x3a')){var _0x4faa92={};_0x4faa92[_0x34944c[_0x0206('0x24')]]={'$like':'%'+_0x519a0a[_0x0206('0x2c')]['filter']+'%'};return _0x4faa92;}})});}_0x18513c=_['merge']({},_0x18513c,_0x519a0a[_0x0206('0x3b')]);var _0x28c8dc={'where':_0x18513c[_0x0206('0x36')]};return db[_0x0206('0x28')][_0x0206('0x3c')](_0x28c8dc)[_0x0206('0x21')](function(_0x41601e){_0x5ec89c[_0x0206('0x3c')]=_0x41601e;if(_0x519a0a['query'][_0x0206('0x3d')]){_0x18513c['include']=[{'all':!![]}];}return db[_0x0206('0x28')]['findAll'](_0x18513c);})[_0x0206('0x21')](function(_0x3297e7){_0x5ec89c[_0x0206('0x3e')]=_0x3297e7;return _0x5ec89c;})[_0x0206('0x21')](respondWithFilteredResult(_0x847866,_0x18513c))[_0x0206('0x3f')](handleError(_0x847866,null));};exports['show']=function(_0x3d70ae,_0x25c382){var _0x5574e5={'raw':!![],'where':{'id':_0x3d70ae[_0x0206('0x40')]['id']}},_0x1afd1f={};_0x1afd1f[_0x0206('0x2b')]=_[_0x0206('0x2d')](db[_0x0206('0x28')][_0x0206('0x41')]);_0x1afd1f[_0x0206('0x2c')]=_[_0x0206('0x2d')](_0x3d70ae[_0x0206('0x2c')]);_0x1afd1f[_0x0206('0x2e')]=_['intersection'](_0x1afd1f[_0x0206('0x2b')],_0x1afd1f[_0x0206('0x2c')]);_0x5574e5[_0x0206('0x30')]=_[_0x0206('0x2f')](_0x1afd1f[_0x0206('0x2b')],qs[_0x0206('0x31')](_0x3d70ae['query'][_0x0206('0x31')]));_0x5574e5[_0x0206('0x30')]=_0x5574e5[_0x0206('0x30')][_0x0206('0x32')]?_0x5574e5[_0x0206('0x30')]:_0x1afd1f[_0x0206('0x2b')];if(_0x3d70ae['query']['includeAll']){_0x5574e5['include']=[{'all':!![]}];}_0x5574e5=_[_0x0206('0x38')]({},_0x5574e5,_0x3d70ae[_0x0206('0x3b')]);return db[_0x0206('0x28')][_0x0206('0x42')](_0x5574e5)[_0x0206('0x21')](handleEntityNotFound(_0x25c382,null))[_0x0206('0x21')](respondWithResult(_0x25c382,null))[_0x0206('0x3f')](handleError(_0x25c382,null));};exports[_0x0206('0x43')]=function(_0x41bdf2,_0x174d40){return db[_0x0206('0x28')]['create'](_0x41bdf2[_0x0206('0x44')],{})[_0x0206('0x21')](respondWithResult(_0x174d40,0xc9))['catch'](handleError(_0x174d40,null));};exports[_0x0206('0x20')]=function(_0xb17d9f,_0x37f389){if(_0xb17d9f['body']['id']){delete _0xb17d9f['body']['id'];}return db[_0x0206('0x28')][_0x0206('0x42')]({'where':{'id':_0xb17d9f[_0x0206('0x40')]['id']}})[_0x0206('0x21')](handleEntityNotFound(_0x37f389,null))['then'](saveUpdates(_0xb17d9f[_0x0206('0x44')],null))[_0x0206('0x21')](respondWithResult(_0x37f389,null))[_0x0206('0x3f')](handleError(_0x37f389,null));};exports[_0x0206('0x45')]=function(_0xd7176a,_0x1c4ee2){return db[_0x0206('0x28')][_0x0206('0x42')]({'where':{'id':_0xd7176a[_0x0206('0x40')]['id']}})[_0x0206('0x21')](handleEntityNotFound(_0x1c4ee2,null))['then'](removeEntity(_0x1c4ee2,null))[_0x0206('0x3f')](handleError(_0x1c4ee2,null));};exports[_0x0206('0x46')]=function(_0x272996,_0xa4dc5a){return db[_0x0206('0x28')][_0x0206('0x46')]()[_0x0206('0x21')](respondWithResult(_0xa4dc5a,null))['catch'](handleError(_0xa4dc5a,null));}; \ No newline at end of file +var _0x50b9=['mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','include','rows','show','length','includeAll','find','catch','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x235cb0,_0x197da3){var _0x18302d=function(_0x5f3b78){while(--_0x5f3b78){_0x235cb0['push'](_0x235cb0['shift']());}};_0x18302d(++_0x197da3);}(_0x50b9,0x171));var _0x950b=function(_0x4a3168,_0x494f38){_0x4a3168=_0x4a3168-0x0;var _0x35c154=_0x50b9[_0x4a3168];return _0x35c154;};'use strict';var pdf=require(_0x950b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x950b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x950b('0x2'));var rp=require(_0x950b('0x3'));var moment=require(_0x950b('0x4'));var BPromise=require(_0x950b('0x5'));var Mustache=require(_0x950b('0x6'));var util=require(_0x950b('0x7'));var path=require(_0x950b('0x8'));var sox=require(_0x950b('0x9'));var csv=require(_0x950b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x950b('0xb'));var squel=require(_0x950b('0xc'));var crypto=require(_0x950b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x950b('0xe'));var Papa=require(_0x950b('0xf'));var Redis=require(_0x950b('0x10'));var authService=require(_0x950b('0x11'));var qs=require(_0x950b('0x12'));var as=require(_0x950b('0x13'));var hardwareService=require(_0x950b('0x14'));var logger=require('../../config/logger')(_0x950b('0x15'));var utils=require(_0x950b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x950b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x571cd1,_0x27392f){_0x27392f=_0x27392f||0xcc;return function(_0x30ccbf){if(_0x30ccbf){return _0x571cd1[_0x950b('0x18')](_0x27392f);}return _0x571cd1[_0x950b('0x19')](_0x27392f)[_0x950b('0x1a')]();};}function respondWithResult(_0x2c74f1,_0x2c5dea){_0x2c5dea=_0x2c5dea||0xc8;return function(_0x2b8ca0){if(_0x2b8ca0){return _0x2c74f1[_0x950b('0x19')](_0x2c5dea)[_0x950b('0x1b')](_0x2b8ca0);}};}function respondWithFilteredResult(_0x3e6335,_0x254bbe){return function(_0x24de12){if(_0x24de12){var _0x2a99bf=_0x24de12[_0x950b('0x1c')],_0x468ea2=_0x254bbe['offset'],_0x1cc2d=_0x254bbe[_0x950b('0x1d')]+_0x254bbe['limit'],_0x14cb6b;if(_0x1cc2d>=_0x2a99bf){_0x1cc2d=_0x2a99bf;_0x14cb6b=0xc8;}else{_0x14cb6b=0xce;}_0x3e6335[_0x950b('0x19')](_0x14cb6b);return _0x3e6335[_0x950b('0x1e')](_0x950b('0x1f'),_0x468ea2+'-'+_0x1cc2d+'/'+_0x2a99bf)[_0x950b('0x1b')](_0x24de12);}return null;};}function patchUpdates(_0x10fc68){return function(_0x27e201){try{jsonpatch[_0x950b('0x20')](_0x27e201,_0x10fc68,!![]);}catch(_0x45c650){return BPromise[_0x950b('0x21')](_0x45c650);}return _0x27e201[_0x950b('0x22')]();};}function saveUpdates(_0x270dc9,_0x2d96bb){return function(_0x474782){if(_0x474782){return _0x474782[_0x950b('0x23')](_0x270dc9)[_0x950b('0x24')](function(_0x25e072){return _0x25e072;});}return null;};}function removeEntity(_0x2220e8,_0x1b31e3){return function(_0x3ddb35){if(_0x3ddb35){return _0x3ddb35[_0x950b('0x25')]()[_0x950b('0x24')](function(){_0x2220e8[_0x950b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a77b,_0x434c72){return function(_0xf9ca00){if(!_0xf9ca00){_0x33a77b[_0x950b('0x18')](0x194);}return _0xf9ca00;};}function handleError(_0x16f6bc,_0x499ed5){_0x499ed5=_0x499ed5||0x1f4;return function(_0x466ec8){logger[_0x950b('0x26')](_0x466ec8[_0x950b('0x27')]);if(_0x466ec8[_0x950b('0x28')]){delete _0x466ec8[_0x950b('0x28')];}_0x16f6bc['status'](_0x499ed5)['send'](_0x466ec8);};}exports[_0x950b('0x29')]=function(_0x40caf2,_0x2b7477){var _0x362c94={},_0x49fa6a={},_0xfe455f={'count':0x0,'rows':[]};var _0x19f18d=_[_0x950b('0x2a')](db[_0x950b('0x2b')][_0x950b('0x2c')],function(_0x4039ac){return{'name':_0x4039ac[_0x950b('0x2d')],'type':_0x4039ac[_0x950b('0x2e')]['key']};});_0x49fa6a[_0x950b('0x2f')]=_[_0x950b('0x2a')](_0x19f18d,_0x950b('0x28'));_0x49fa6a[_0x950b('0x30')]=_[_0x950b('0x31')](_0x40caf2[_0x950b('0x30')]);_0x49fa6a[_0x950b('0x32')]=_[_0x950b('0x33')](_0x49fa6a['model'],_0x49fa6a[_0x950b('0x30')]);_0x362c94[_0x950b('0x34')]=_[_0x950b('0x33')](_0x49fa6a[_0x950b('0x2f')],qs[_0x950b('0x35')](_0x40caf2['query'][_0x950b('0x35')]));_0x362c94[_0x950b('0x34')]=_0x362c94[_0x950b('0x34')]['length']?_0x362c94['attributes']:_0x49fa6a[_0x950b('0x2f')];if(!_0x40caf2[_0x950b('0x30')][_0x950b('0x36')](_0x950b('0x37'))){_0x362c94[_0x950b('0x38')]=qs['limit'](_0x40caf2['query'][_0x950b('0x38')]);_0x362c94[_0x950b('0x1d')]=qs[_0x950b('0x1d')](_0x40caf2[_0x950b('0x30')][_0x950b('0x1d')]);}_0x362c94[_0x950b('0x39')]=qs[_0x950b('0x3a')](_0x40caf2[_0x950b('0x30')][_0x950b('0x3a')]);_0x362c94['where']=qs['filters'](_[_0x950b('0x3b')](_0x40caf2[_0x950b('0x30')],_0x49fa6a[_0x950b('0x32')]),_0x19f18d);if(_0x40caf2[_0x950b('0x30')][_0x950b('0x3c')]){_0x362c94[_0x950b('0x3d')]=_[_0x950b('0x3e')](_0x362c94[_0x950b('0x3d')],{'$or':_[_0x950b('0x2a')](_0x19f18d,function(_0x31f62a){if(_0x31f62a[_0x950b('0x2e')]!=='VIRTUAL'){var _0x3efd99={};_0x3efd99[_0x31f62a[_0x950b('0x28')]]={'$like':'%'+_0x40caf2[_0x950b('0x30')][_0x950b('0x3c')]+'%'};return _0x3efd99;}})});}_0x362c94=_['merge']({},_0x362c94,_0x40caf2[_0x950b('0x3f')]);var _0x5461da={'where':_0x362c94['where']};return db['OpenchannelQueueReport'][_0x950b('0x1c')](_0x5461da)[_0x950b('0x24')](function(_0x81113d){_0xfe455f[_0x950b('0x1c')]=_0x81113d;if(_0x40caf2[_0x950b('0x30')]['includeAll']){_0x362c94[_0x950b('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x362c94);})[_0x950b('0x24')](function(_0x3de4e9){_0xfe455f[_0x950b('0x41')]=_0x3de4e9;return _0xfe455f;})[_0x950b('0x24')](respondWithFilteredResult(_0x2b7477,_0x362c94))['catch'](handleError(_0x2b7477,null));};exports[_0x950b('0x42')]=function(_0x2e263d,_0x381855){var _0x4722c4={'raw':!![],'where':{'id':_0x2e263d['params']['id']}},_0x49c5d5={};_0x49c5d5[_0x950b('0x2f')]=_['keys'](db[_0x950b('0x2b')][_0x950b('0x2c')]);_0x49c5d5['query']=_[_0x950b('0x31')](_0x2e263d[_0x950b('0x30')]);_0x49c5d5[_0x950b('0x32')]=_[_0x950b('0x33')](_0x49c5d5[_0x950b('0x2f')],_0x49c5d5['query']);_0x4722c4['attributes']=_['intersection'](_0x49c5d5['model'],qs[_0x950b('0x35')](_0x2e263d[_0x950b('0x30')][_0x950b('0x35')]));_0x4722c4[_0x950b('0x34')]=_0x4722c4['attributes'][_0x950b('0x43')]?_0x4722c4[_0x950b('0x34')]:_0x49c5d5['model'];if(_0x2e263d[_0x950b('0x30')][_0x950b('0x44')]){_0x4722c4['include']=[{'all':!![]}];}_0x4722c4=_[_0x950b('0x3e')]({},_0x4722c4,_0x2e263d[_0x950b('0x3f')]);return db[_0x950b('0x2b')][_0x950b('0x45')](_0x4722c4)[_0x950b('0x24')](handleEntityNotFound(_0x381855,null))['then'](respondWithResult(_0x381855,null))[_0x950b('0x46')](handleError(_0x381855,null));};exports[_0x950b('0x47')]=function(_0x45fc27,_0x162401){return db[_0x950b('0x2b')][_0x950b('0x47')](_0x45fc27[_0x950b('0x48')],{})[_0x950b('0x24')](respondWithResult(_0x162401,0xc9))[_0x950b('0x46')](handleError(_0x162401,null));};exports[_0x950b('0x23')]=function(_0xa827a1,_0x14f94f){if(_0xa827a1[_0x950b('0x48')]['id']){delete _0xa827a1[_0x950b('0x48')]['id'];}return db[_0x950b('0x2b')]['find']({'where':{'id':_0xa827a1[_0x950b('0x49')]['id']}})[_0x950b('0x24')](handleEntityNotFound(_0x14f94f,null))['then'](saveUpdates(_0xa827a1['body'],null))['then'](respondWithResult(_0x14f94f,null))[_0x950b('0x46')](handleError(_0x14f94f,null));};exports[_0x950b('0x25')]=function(_0x1c3b0b,_0x4a97d8){return db['OpenchannelQueueReport'][_0x950b('0x45')]({'where':{'id':_0x1c3b0b[_0x950b('0x49')]['id']}})[_0x950b('0x24')](handleEntityNotFound(_0x4a97d8,null))[_0x950b('0x24')](removeEntity(_0x4a97d8,null))[_0x950b('0x46')](handleError(_0x4a97d8,null));};exports[_0x950b('0x4a')]=function(_0x320763,_0x24619b){return db[_0x950b('0x2b')]['describe']()['then'](respondWithResult(_0x24619b,null))[_0x950b('0x46')](handleError(_0x24619b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 185abdc..5d64797 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 _0x12dc=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x4d642b,_0x49c928){var _0x2c92f1=function(_0x40b09f){while(--_0x40b09f){_0x4d642b['push'](_0x4d642b['shift']());}};_0x2c92f1(++_0x49c928);}(_0x12dc,0xb4));var _0xc12d=function(_0xbd70a6,_0x50c7bd){_0xbd70a6=_0xbd70a6-0x0;var _0x4314a7=_0x12dc[_0xbd70a6];return _0x4314a7;};'use strict';var _=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var logger=require('../../config/logger')(_0xc12d('0x2'));var moment=require(_0xc12d('0x3'));var BPromise=require(_0xc12d('0x4'));var rp=require(_0xc12d('0x5'));var fs=require('fs');var path=require(_0xc12d('0x6'));var rimraf=require(_0xc12d('0x7'));var config=require(_0xc12d('0x8'));var attributes=require(_0xc12d('0x9'));module[_0xc12d('0xa')]=function(_0x5383da,_0x3148cf){return _0x5383da[_0xc12d('0xb')](_0xc12d('0xc'),attributes,{'tableName':_0xc12d('0xd'),'paranoid':![],'indexes':[{'name':_0xc12d('0xe'),'fields':[_0xc12d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1b3=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport'];(function(_0x539eda,_0x5b4a00){var _0xa4a00=function(_0x4d6887){while(--_0x4d6887){_0x539eda['push'](_0x539eda['shift']());}};_0xa4a00(++_0x5b4a00);}(_0xd1b3,0xec));var _0x3d1b=function(_0x5d2f7d,_0x2d41d4){_0x5d2f7d=_0x5d2f7d-0x0;var _0x389835=_0xd1b3[_0x5d2f7d];return _0x389835;};'use strict';var _=require(_0x3d1b('0x0'));var util=require(_0x3d1b('0x1'));var logger=require(_0x3d1b('0x2'))(_0x3d1b('0x3'));var moment=require(_0x3d1b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d1b('0x5'));var config=require(_0x3d1b('0x6'));var attributes=require(_0x3d1b('0x7'));module[_0x3d1b('0x8')]=function(_0x1c409e,_0x45bd2b){return _0x1c409e[_0x3d1b('0x9')](_0x3d1b('0xa'),attributes,{'tableName':_0x3d1b('0xb'),'paranoid':![],'indexes':[{'name':_0x3d1b('0xc'),'fields':[_0x3d1b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1b9a299..6917205 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 _0x307a=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','body','attributes','limit','lodash'];(function(_0x2405cb,_0x42f57c){var _0x4245b4=function(_0x52095b){while(--_0x52095b){_0x2405cb['push'](_0x2405cb['shift']());}};_0x4245b4(++_0x42f57c);}(_0x307a,0x19f));var _0xa307=function(_0x244328,_0x331c97){_0x244328=_0x244328-0x0;var _0x468a32=_0x307a[_0x244328];return _0x468a32;};'use strict';var _=require(_0xa307('0x0'));var util=require(_0xa307('0x1'));var moment=require('moment');var BPromise=require(_0xa307('0x2'));var rs=require(_0xa307('0x3'));var fs=require('fs');var Redis=require(_0xa307('0x4'));var db=require(_0xa307('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa307('0x6'))(_0xa307('0x7'));var config=require('../../config/environment');var jayson=require(_0xa307('0x8'));var client=jayson[_0xa307('0x9')][_0xa307('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c27f9,_0x597af4,_0x54a1df){return new BPromise(function(_0x51144b,_0x18b57d){return client['request'](_0x2c27f9,_0x54a1df)[_0xa307('0xb')](function(_0x100d8a){logger['info'](_0xa307('0xc'),_0x597af4,_0xa307('0xd'));logger[_0xa307('0xe')](_0xa307('0xf'),_0x597af4,'request\x20sent',JSON[_0xa307('0x10')](_0x100d8a));if(_0x100d8a[_0xa307('0x11')]){if(_0x100d8a['error'][_0xa307('0x12')]===0x1f4){logger[_0xa307('0x11')](_0xa307('0xc'),_0x597af4,_0x100d8a[_0xa307('0x11')][_0xa307('0x13')]);return _0x18b57d(_0x100d8a[_0xa307('0x11')][_0xa307('0x13')]);}logger[_0xa307('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x597af4,_0x100d8a['error'][_0xa307('0x13')]);return _0x51144b(_0x100d8a[_0xa307('0x11')][_0xa307('0x13')]);}else{logger[_0xa307('0x14')](_0xa307('0xc'),_0x597af4,_0xa307('0xd'));_0x51144b(_0x100d8a[_0xa307('0x15')][_0xa307('0x13')]);}})[_0xa307('0x16')](function(_0xf79f54){logger[_0xa307('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x597af4,_0xf79f54);_0x18b57d(_0xf79f54);});});}exports[_0xa307('0x17')]=function(_0x2dd1e2){var _0x10bff3=this;return new Promise(function(_0x26780b,_0x189f8d){return db[_0xa307('0x18')][_0xa307('0x19')](_0x2dd1e2['body'],{'raw':_0x2dd1e2['options']?_0x2dd1e2[_0xa307('0x1a')][_0xa307('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xaa3f9e){logger[_0xa307('0x14')]('CreateOpenchannelQueueReport',_0x2dd1e2);logger[_0xa307('0xe')](_0xa307('0x17'),_0x2dd1e2,JSON['stringify'](_0xaa3f9e));_0x26780b(_0xaa3f9e);})['catch'](function(_0x45958d){logger[_0xa307('0x11')](_0xa307('0x17'),_0x45958d[_0xa307('0x13')],_0x2dd1e2);_0x189f8d(_0x10bff3['error'](0x1f4,_0x45958d[_0xa307('0x13')]));});});};exports[_0xa307('0x1c')]=function(_0x478beb){var _0x125a79=this;return new Promise(function(_0x25618b,_0x546adc){return db[_0xa307('0x18')]['update'](_0x478beb[_0xa307('0x1d')],{'raw':_0x478beb[_0xa307('0x1a')]?_0x478beb['options'][_0xa307('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x478beb[_0xa307('0x1a')]?_0x478beb[_0xa307('0x1a')]['where']||null:null,'attributes':_0x478beb[_0xa307('0x1a')]?_0x478beb[_0xa307('0x1a')][_0xa307('0x1e')]||null:null,'limit':_0x478beb[_0xa307('0x1a')]?_0x478beb[_0xa307('0x1a')][_0xa307('0x1f')]||null:null})[_0xa307('0xb')](function(_0x39780f){logger[_0xa307('0x14')]('UpdateOpenchannelQueueReport',_0x478beb);logger[_0xa307('0xe')](_0xa307('0x1c'),_0x478beb,JSON[_0xa307('0x10')](_0x39780f));_0x25618b(_0x39780f);})['catch'](function(_0x49aa64){logger[_0xa307('0x11')](_0xa307('0x1c'),_0x49aa64[_0xa307('0x13')],_0x478beb);_0x546adc(_0x125a79[_0xa307('0x11')](0x1f4,_0x49aa64[_0xa307('0x13')]));});});}; \ No newline at end of file +var _0x20be=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','info','UpdateOpenchannelQueueReport','update','where','attributes','limit','stringify','lodash','util'];(function(_0x367a16,_0x81efb2){var _0x5e9a07=function(_0x27b4d8){while(--_0x27b4d8){_0x367a16['push'](_0x367a16['shift']());}};_0x5e9a07(++_0x81efb2);}(_0x20be,0x148));var _0xe20b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x20be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe20b('0x0'));var util=require(_0xe20b('0x1'));var moment=require('moment');var BPromise=require(_0xe20b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe20b('0x3'));var db=require(_0xe20b('0x4'))['db'];var utils=require(_0xe20b('0x5'));var logger=require(_0xe20b('0x6'))('rpc');var config=require(_0xe20b('0x7'));var jayson=require(_0xe20b('0x8'));var client=jayson[_0xe20b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421509,_0x4c1aad,_0x296fc6){return new BPromise(function(_0x9ce466,_0x546b45){return client['request'](_0x421509,_0x296fc6)[_0xe20b('0xa')](function(_0x5817d0){logger['info'](_0xe20b('0xb'),_0x4c1aad,_0xe20b('0xc'));logger[_0xe20b('0xd')](_0xe20b('0xe'),_0x4c1aad,_0xe20b('0xc'),JSON['stringify'](_0x5817d0));if(_0x5817d0['error']){if(_0x5817d0[_0xe20b('0xf')][_0xe20b('0x10')]===0x1f4){logger['error'](_0xe20b('0xb'),_0x4c1aad,_0x5817d0[_0xe20b('0xf')][_0xe20b('0x11')]);return _0x546b45(_0x5817d0['error']['message']);}logger[_0xe20b('0xf')](_0xe20b('0xb'),_0x4c1aad,_0x5817d0['error']['message']);return _0x9ce466(_0x5817d0['error'][_0xe20b('0x11')]);}else{logger['info'](_0xe20b('0xb'),_0x4c1aad,_0xe20b('0xc'));_0x9ce466(_0x5817d0[_0xe20b('0x12')]['message']);}})[_0xe20b('0x13')](function(_0x3fc7ea){logger[_0xe20b('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c1aad,_0x3fc7ea);_0x546b45(_0x3fc7ea);});});}exports[_0xe20b('0x14')]=function(_0x36c2ec){var _0x57925f=this;return new Promise(function(_0x4ef03f,_0x4297a1){return db[_0xe20b('0x15')][_0xe20b('0x16')](_0x36c2ec[_0xe20b('0x17')],{'raw':_0x36c2ec[_0xe20b('0x18')]?_0x36c2ec[_0xe20b('0x18')][_0xe20b('0x19')]===undefined?!![]:![]:!![]})[_0xe20b('0xa')](function(_0x196e47){logger[_0xe20b('0x1a')]('CreateOpenchannelQueueReport',_0x36c2ec);logger['debug'](_0xe20b('0x14'),_0x36c2ec,JSON['stringify'](_0x196e47));_0x4ef03f(_0x196e47);})[_0xe20b('0x13')](function(_0x5581d0){logger[_0xe20b('0xf')]('CreateOpenchannelQueueReport',_0x5581d0['message'],_0x36c2ec);_0x4297a1(_0x57925f[_0xe20b('0xf')](0x1f4,_0x5581d0['message']));});});};exports[_0xe20b('0x1b')]=function(_0x5bf7a8){var _0x6ea49e=this;return new Promise(function(_0x136034,_0x3ff91b){return db[_0xe20b('0x15')][_0xe20b('0x1c')](_0x5bf7a8['body'],{'raw':_0x5bf7a8[_0xe20b('0x18')]?_0x5bf7a8[_0xe20b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf7a8[_0xe20b('0x18')]?_0x5bf7a8[_0xe20b('0x18')][_0xe20b('0x1d')]||null:null,'attributes':_0x5bf7a8[_0xe20b('0x18')]?_0x5bf7a8[_0xe20b('0x18')][_0xe20b('0x1e')]||null:null,'limit':_0x5bf7a8[_0xe20b('0x18')]?_0x5bf7a8[_0xe20b('0x18')][_0xe20b('0x1f')]||null:null})[_0xe20b('0xa')](function(_0x295b08){logger['info'](_0xe20b('0x1b'),_0x5bf7a8);logger['debug']('UpdateOpenchannelQueueReport',_0x5bf7a8,JSON[_0xe20b('0x20')](_0x295b08));_0x136034(_0x295b08);})[_0xe20b('0x13')](function(_0x1a7992){logger[_0xe20b('0xf')](_0xe20b('0x1b'),_0x1a7992['message'],_0x5bf7a8);_0x3ff91b(_0x6ea49e[_0xe20b('0xf')](0x1f4,_0x1a7992[_0xe20b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0497d91..f35032f 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1e95b5f..159dd15 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 _0x5f78=['ENUM','queue','NOW','moment','sequelize'];(function(_0x2826d9,_0x28f60f){var _0x96122b=function(_0x59c6e0){while(--_0x59c6e0){_0x2826d9['push'](_0x2826d9['shift']());}};_0x96122b(++_0x28f60f);}(_0x5f78,0x94));var _0x85f7=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x5f78[_0x5f0501];return _0x3c2c45;};'use strict';var moment=require(_0x85f7('0x0'));var Sequelize=require(_0x85f7('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85f7('0x2')]('account','agent','queue'),'allowNull':![],'defaultValue':_0x85f7('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x85f7('0x4')]}}; \ No newline at end of file +var _0x8ec9=['agent','queue','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x35e17d,_0x417a6b){var _0x347349=function(_0x170546){while(--_0x170546){_0x35e17d['push'](_0x35e17d['shift']());}};_0x347349(++_0x417a6b);}(_0x8ec9,0x1f3));var _0x98ec=function(_0x2e2b22,_0xf579a6){_0x2e2b22=_0x2e2b22-0x0;var _0x58c163=_0x8ec9[_0x2e2b22];return _0x58c163;};'use strict';var moment=require(_0x98ec('0x0'));var Sequelize=require(_0x98ec('0x1'));module[_0x98ec('0x2')]={'uniqueid':{'type':Sequelize[_0x98ec('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x98ec('0x4')]('account',_0x98ec('0x5'),_0x98ec('0x6')),'allowNull':![],'defaultValue':_0x98ec('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x98ec('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 812dd39..0e6c126 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 _0x8488=['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','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','order','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','count','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x8488,0x160));var _0x8848=function(_0xc4a6fe,_0x1f050a){_0xc4a6fe=_0xc4a6fe-0x0;var _0x7cab52=_0x8488[_0xc4a6fe];return _0x7cab52;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8848('0x0'));var zipdir=require(_0x8848('0x1'));var jsonpatch=require(_0x8848('0x2'));var rp=require(_0x8848('0x3'));var moment=require(_0x8848('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8848('0x5'));var path=require('path');var sox=require(_0x8848('0x6'));var csv=require(_0x8848('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8848('0x8'));var squel=require(_0x8848('0x9'));var crypto=require(_0x8848('0xa'));var jsforce=require(_0x8848('0xb'));var deskjs=require(_0x8848('0xc'));var toCsv=require(_0x8848('0x7'));var querystring=require('querystring');var Papa=require(_0x8848('0xd'));var Redis=require(_0x8848('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8848('0xf'));var as=require(_0x8848('0x10'));var hardwareService=require(_0x8848('0x11'));var logger=require(_0x8848('0x12'))(_0x8848('0x13'));var utils=require(_0x8848('0x14'));var config=require(_0x8848('0x15'));var licenseUtil=require(_0x8848('0x16'));var db=require(_0x8848('0x17'))['db'];function respondWithStatusCode(_0x298108,_0x4ba6a5){_0x4ba6a5=_0x4ba6a5||0xcc;return function(_0x54c719){if(_0x54c719){return _0x298108[_0x8848('0x18')](_0x4ba6a5);}return _0x298108[_0x8848('0x19')](_0x4ba6a5)[_0x8848('0x1a')]();};}function respondWithResult(_0x1cf50e,_0x361c9b){_0x361c9b=_0x361c9b||0xc8;return function(_0x16634c){if(_0x16634c){return _0x1cf50e[_0x8848('0x19')](_0x361c9b)[_0x8848('0x1b')](_0x16634c);}};}function respondWithFilteredResult(_0x409ad5,_0x42413d){return function(_0x4265c5){if(_0x4265c5){var _0x3b30b0=_0x4265c5['count'],_0x22011f=_0x42413d[_0x8848('0x1c')],_0x320449=_0x42413d[_0x8848('0x1c')]+_0x42413d[_0x8848('0x1d')],_0x134bd3;if(_0x320449>=_0x3b30b0){_0x320449=_0x3b30b0;_0x134bd3=0xc8;}else{_0x134bd3=0xce;}_0x409ad5[_0x8848('0x19')](_0x134bd3);return _0x409ad5[_0x8848('0x1e')](_0x8848('0x1f'),_0x22011f+'-'+_0x320449+'/'+_0x3b30b0)[_0x8848('0x1b')](_0x4265c5);}return null;};}function patchUpdates(_0x3aa318){return function(_0x12433f){try{jsonpatch[_0x8848('0x20')](_0x12433f,_0x3aa318,!![]);}catch(_0x578c81){return BPromise['reject'](_0x578c81);}return _0x12433f[_0x8848('0x21')]();};}function saveUpdates(_0x425ac6,_0x362951){return function(_0x57a877){if(_0x57a877){return _0x57a877[_0x8848('0x22')](_0x425ac6)[_0x8848('0x23')](function(_0x97be0f){return _0x97be0f;});}return null;};}function removeEntity(_0x5a4886,_0x37d429){return function(_0x53ae55){if(_0x53ae55){return _0x53ae55['destroy']()[_0x8848('0x23')](function(){_0x5a4886['status'](0xcc)[_0x8848('0x1a')]();});}};}function handleEntityNotFound(_0x288fab,_0x3c5298){return function(_0x5ae862){if(!_0x5ae862){_0x288fab[_0x8848('0x18')](0x194);}return _0x5ae862;};}function handleError(_0x5e1464,_0xfb6e16){_0xfb6e16=_0xfb6e16||0x1f4;return function(_0x3171fd){logger[_0x8848('0x24')](_0x3171fd['stack']);if(_0x3171fd['name']){delete _0x3171fd[_0x8848('0x25')];}_0x5e1464['status'](_0xfb6e16)[_0x8848('0x26')](_0x3171fd);};}exports[_0x8848('0x27')]=function(_0x18e13c,_0x3fc86d){var _0x51026d={},_0x61dfb6={},_0x5612b2={'count':0x0,'rows':[]};var _0x467873=_[_0x8848('0x28')](db['OpenchannelTransferReport'][_0x8848('0x29')],function(_0x4a111d){return{'name':_0x4a111d['fieldName'],'type':_0x4a111d[_0x8848('0x2a')]['key']};});_0x61dfb6['model']=_[_0x8848('0x28')](_0x467873,_0x8848('0x25'));_0x61dfb6[_0x8848('0x2b')]=_['keys'](_0x18e13c[_0x8848('0x2b')]);_0x61dfb6[_0x8848('0x2c')]=_[_0x8848('0x2d')](_0x61dfb6[_0x8848('0x2e')],_0x61dfb6['query']);_0x51026d['attributes']=_['intersection'](_0x61dfb6[_0x8848('0x2e')],qs[_0x8848('0x2f')](_0x18e13c[_0x8848('0x2b')]['fields']));_0x51026d[_0x8848('0x30')]=_0x51026d[_0x8848('0x30')][_0x8848('0x31')]?_0x51026d[_0x8848('0x30')]:_0x61dfb6[_0x8848('0x2e')];if(!_0x18e13c['query']['hasOwnProperty']('nolimit')){_0x51026d['limit']=qs[_0x8848('0x1d')](_0x18e13c[_0x8848('0x2b')][_0x8848('0x1d')]);_0x51026d[_0x8848('0x1c')]=qs[_0x8848('0x1c')](_0x18e13c['query'][_0x8848('0x1c')]);}_0x51026d[_0x8848('0x32')]=qs['sort'](_0x18e13c[_0x8848('0x2b')]['sort']);_0x51026d[_0x8848('0x33')]=qs['filters'](_[_0x8848('0x34')](_0x18e13c[_0x8848('0x2b')],_0x61dfb6[_0x8848('0x2c')]),_0x467873);if(_0x18e13c[_0x8848('0x2b')][_0x8848('0x35')]){_0x51026d[_0x8848('0x33')]=_[_0x8848('0x36')](_0x51026d['where'],{'$or':_['map'](_0x467873,function(_0x5138fc){if(_0x5138fc[_0x8848('0x2a')]!==_0x8848('0x37')){var _0x26b03d={};_0x26b03d[_0x5138fc[_0x8848('0x25')]]={'$like':'%'+_0x18e13c[_0x8848('0x2b')][_0x8848('0x35')]+'%'};return _0x26b03d;}})});}_0x51026d=_[_0x8848('0x36')]({},_0x51026d,_0x18e13c[_0x8848('0x38')]);var _0x1b5726={'where':_0x51026d[_0x8848('0x33')]};return db[_0x8848('0x39')][_0x8848('0x3a')](_0x1b5726)[_0x8848('0x23')](function(_0x30f2b0){_0x5612b2['count']=_0x30f2b0;if(_0x18e13c['query'][_0x8848('0x3b')]){_0x51026d[_0x8848('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x8848('0x3d')](_0x51026d);})[_0x8848('0x23')](function(_0x19d52d){_0x5612b2[_0x8848('0x3e')]=_0x19d52d;return _0x5612b2;})[_0x8848('0x23')](respondWithFilteredResult(_0x3fc86d,_0x51026d))['catch'](handleError(_0x3fc86d,null));};exports[_0x8848('0x3f')]=function(_0x20fed2,_0x5e0c96){var _0x57085b={'raw':!![],'where':{'id':_0x20fed2['params']['id']}},_0x1bc174={};_0x1bc174['model']=_[_0x8848('0x40')](db[_0x8848('0x39')]['rawAttributes']);_0x1bc174[_0x8848('0x2b')]=_[_0x8848('0x40')](_0x20fed2['query']);_0x1bc174[_0x8848('0x2c')]=_[_0x8848('0x2d')](_0x1bc174[_0x8848('0x2e')],_0x1bc174[_0x8848('0x2b')]);_0x57085b[_0x8848('0x30')]=_[_0x8848('0x2d')](_0x1bc174[_0x8848('0x2e')],qs[_0x8848('0x2f')](_0x20fed2['query']['fields']));_0x57085b['attributes']=_0x57085b['attributes'][_0x8848('0x31')]?_0x57085b[_0x8848('0x30')]:_0x1bc174[_0x8848('0x2e')];if(_0x20fed2[_0x8848('0x2b')][_0x8848('0x3b')]){_0x57085b[_0x8848('0x3c')]=[{'all':!![]}];}_0x57085b=_[_0x8848('0x36')]({},_0x57085b,_0x20fed2[_0x8848('0x38')]);return db['OpenchannelTransferReport'][_0x8848('0x41')](_0x57085b)['then'](handleEntityNotFound(_0x5e0c96,null))[_0x8848('0x23')](respondWithResult(_0x5e0c96,null))[_0x8848('0x42')](handleError(_0x5e0c96,null));};exports[_0x8848('0x43')]=function(_0x140027,_0x11f477){return db[_0x8848('0x39')][_0x8848('0x43')](_0x140027[_0x8848('0x44')],{})[_0x8848('0x23')](respondWithResult(_0x11f477,0xc9))['catch'](handleError(_0x11f477,null));};exports['update']=function(_0x1463d4,_0x32dc20){if(_0x1463d4[_0x8848('0x44')]['id']){delete _0x1463d4[_0x8848('0x44')]['id'];}return db[_0x8848('0x39')]['find']({'where':{'id':_0x1463d4[_0x8848('0x45')]['id']}})[_0x8848('0x23')](handleEntityNotFound(_0x32dc20,null))[_0x8848('0x23')](saveUpdates(_0x1463d4[_0x8848('0x44')],null))[_0x8848('0x23')](respondWithResult(_0x32dc20,null))[_0x8848('0x42')](handleError(_0x32dc20,null));};exports[_0x8848('0x46')]=function(_0x254099,_0x9883b9){return db[_0x8848('0x39')]['find']({'where':{'id':_0x254099[_0x8848('0x45')]['id']}})[_0x8848('0x23')](handleEntityNotFound(_0x9883b9,null))[_0x8848('0x23')](removeEntity(_0x9883b9,null))[_0x8848('0x42')](handleError(_0x9883b9,null));};exports[_0x8848('0x47')]=function(_0x127e62,_0x231687){return db['OpenchannelTransferReport'][_0x8848('0x47')]()[_0x8848('0x23')](respondWithResult(_0x231687,null))[_0x8848('0x42')](handleError(_0x231687,null));}; \ No newline at end of file +var _0x05ac=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','OpenchannelTransferReport','count','include','findAll','rows','catch','keys','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0x05ac,0x1a6));var _0xc05a=function(_0x357b8c,_0x2ec9f7){_0x357b8c=_0x357b8c-0x0;var _0x1c6f04=_0x05ac[_0x357b8c];return _0x1c6f04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc05a('0x0'));var rimraf=require(_0xc05a('0x1'));var zipdir=require(_0xc05a('0x2'));var jsonpatch=require(_0xc05a('0x3'));var rp=require(_0xc05a('0x4'));var moment=require(_0xc05a('0x5'));var BPromise=require(_0xc05a('0x6'));var Mustache=require('mustache');var util=require(_0xc05a('0x7'));var path=require(_0xc05a('0x8'));var sox=require('sox');var csv=require(_0xc05a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc05a('0xa'));var squel=require('squel');var crypto=require(_0xc05a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc05a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc05a('0xd'));var Papa=require(_0xc05a('0xe'));var Redis=require(_0xc05a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc05a('0x10'));var as=require(_0xc05a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc05a('0x12'))(_0xc05a('0x13'));var utils=require(_0xc05a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc05a('0x15'))['db'];function respondWithStatusCode(_0x3724bb,_0x2fd634){_0x2fd634=_0x2fd634||0xcc;return function(_0x1b38ec){if(_0x1b38ec){return _0x3724bb['sendStatus'](_0x2fd634);}return _0x3724bb[_0xc05a('0x16')](_0x2fd634)[_0xc05a('0x17')]();};}function respondWithResult(_0x7a3185,_0x440072){_0x440072=_0x440072||0xc8;return function(_0x1b0292){if(_0x1b0292){return _0x7a3185[_0xc05a('0x16')](_0x440072)[_0xc05a('0x18')](_0x1b0292);}};}function respondWithFilteredResult(_0x282dd0,_0xead024){return function(_0xc39e7f){if(_0xc39e7f){var _0x1d16f0=_0xc39e7f['count'],_0x4260d6=_0xead024[_0xc05a('0x19')],_0x3387dc=_0xead024[_0xc05a('0x19')]+_0xead024['limit'],_0x450520;if(_0x3387dc>=_0x1d16f0){_0x3387dc=_0x1d16f0;_0x450520=0xc8;}else{_0x450520=0xce;}_0x282dd0[_0xc05a('0x16')](_0x450520);return _0x282dd0[_0xc05a('0x1a')](_0xc05a('0x1b'),_0x4260d6+'-'+_0x3387dc+'/'+_0x1d16f0)['json'](_0xc39e7f);}return null;};}function patchUpdates(_0x432aff){return function(_0x4e11bf){try{jsonpatch[_0xc05a('0x1c')](_0x4e11bf,_0x432aff,!![]);}catch(_0x3bdd79){return BPromise['reject'](_0x3bdd79);}return _0x4e11bf[_0xc05a('0x1d')]();};}function saveUpdates(_0x40e043,_0x42e58a){return function(_0x26fbcc){if(_0x26fbcc){return _0x26fbcc[_0xc05a('0x1e')](_0x40e043)[_0xc05a('0x1f')](function(_0x499287){return _0x499287;});}return null;};}function removeEntity(_0x20a1b7,_0x3de8c6){return function(_0x1e8a83){if(_0x1e8a83){return _0x1e8a83[_0xc05a('0x20')]()[_0xc05a('0x1f')](function(){_0x20a1b7['status'](0xcc)[_0xc05a('0x17')]();});}};}function handleEntityNotFound(_0x2c892a,_0x59b6bc){return function(_0x356d60){if(!_0x356d60){_0x2c892a['sendStatus'](0x194);}return _0x356d60;};}function handleError(_0x1b1706,_0x4e5223){_0x4e5223=_0x4e5223||0x1f4;return function(_0x1e539b){logger['error'](_0x1e539b[_0xc05a('0x21')]);if(_0x1e539b[_0xc05a('0x22')]){delete _0x1e539b[_0xc05a('0x22')];}_0x1b1706[_0xc05a('0x16')](_0x4e5223)[_0xc05a('0x23')](_0x1e539b);};}exports['index']=function(_0x5baf65,_0x395aa1){var _0x73e20f={},_0x1aea63={},_0x41b00b={'count':0x0,'rows':[]};var _0x3fbb19=_[_0xc05a('0x24')](db['OpenchannelTransferReport'][_0xc05a('0x25')],function(_0x4e85ef){return{'name':_0x4e85ef[_0xc05a('0x26')],'type':_0x4e85ef['type'][_0xc05a('0x27')]};});_0x1aea63[_0xc05a('0x28')]=_[_0xc05a('0x24')](_0x3fbb19,_0xc05a('0x22'));_0x1aea63[_0xc05a('0x29')]=_['keys'](_0x5baf65[_0xc05a('0x29')]);_0x1aea63['filters']=_['intersection'](_0x1aea63[_0xc05a('0x28')],_0x1aea63[_0xc05a('0x29')]);_0x73e20f[_0xc05a('0x2a')]=_[_0xc05a('0x2b')](_0x1aea63[_0xc05a('0x28')],qs[_0xc05a('0x2c')](_0x5baf65[_0xc05a('0x29')]['fields']));_0x73e20f['attributes']=_0x73e20f[_0xc05a('0x2a')][_0xc05a('0x2d')]?_0x73e20f[_0xc05a('0x2a')]:_0x1aea63[_0xc05a('0x28')];if(!_0x5baf65[_0xc05a('0x29')][_0xc05a('0x2e')](_0xc05a('0x2f'))){_0x73e20f['limit']=qs[_0xc05a('0x30')](_0x5baf65[_0xc05a('0x29')]['limit']);_0x73e20f['offset']=qs['offset'](_0x5baf65['query']['offset']);}_0x73e20f[_0xc05a('0x31')]=qs[_0xc05a('0x32')](_0x5baf65[_0xc05a('0x29')][_0xc05a('0x32')]);_0x73e20f[_0xc05a('0x33')]=qs['filters'](_[_0xc05a('0x34')](_0x5baf65['query'],_0x1aea63[_0xc05a('0x35')]),_0x3fbb19);if(_0x5baf65[_0xc05a('0x29')][_0xc05a('0x36')]){_0x73e20f[_0xc05a('0x33')]=_[_0xc05a('0x37')](_0x73e20f['where'],{'$or':_[_0xc05a('0x24')](_0x3fbb19,function(_0x35332f){if(_0x35332f[_0xc05a('0x38')]!==_0xc05a('0x39')){var _0x17b59d={};_0x17b59d[_0x35332f[_0xc05a('0x22')]]={'$like':'%'+_0x5baf65['query'][_0xc05a('0x36')]+'%'};return _0x17b59d;}})});}_0x73e20f=_[_0xc05a('0x37')]({},_0x73e20f,_0x5baf65[_0xc05a('0x3a')]);var _0x382656={'where':_0x73e20f[_0xc05a('0x33')]};return db[_0xc05a('0x3b')][_0xc05a('0x3c')](_0x382656)['then'](function(_0x374e03){_0x41b00b[_0xc05a('0x3c')]=_0x374e03;if(_0x5baf65[_0xc05a('0x29')]['includeAll']){_0x73e20f[_0xc05a('0x3d')]=[{'all':!![]}];}return db[_0xc05a('0x3b')][_0xc05a('0x3e')](_0x73e20f);})[_0xc05a('0x1f')](function(_0x44dd94){_0x41b00b[_0xc05a('0x3f')]=_0x44dd94;return _0x41b00b;})['then'](respondWithFilteredResult(_0x395aa1,_0x73e20f))[_0xc05a('0x40')](handleError(_0x395aa1,null));};exports['show']=function(_0x5b6d5b,_0x5ab8b5){var _0x838ff7={'raw':!![],'where':{'id':_0x5b6d5b['params']['id']}},_0x276976={};_0x276976['model']=_['keys'](db[_0xc05a('0x3b')][_0xc05a('0x25')]);_0x276976[_0xc05a('0x29')]=_[_0xc05a('0x41')](_0x5b6d5b['query']);_0x276976[_0xc05a('0x35')]=_['intersection'](_0x276976[_0xc05a('0x28')],_0x276976[_0xc05a('0x29')]);_0x838ff7[_0xc05a('0x2a')]=_[_0xc05a('0x2b')](_0x276976[_0xc05a('0x28')],qs['fields'](_0x5b6d5b[_0xc05a('0x29')]['fields']));_0x838ff7['attributes']=_0x838ff7[_0xc05a('0x2a')][_0xc05a('0x2d')]?_0x838ff7['attributes']:_0x276976['model'];if(_0x5b6d5b[_0xc05a('0x29')][_0xc05a('0x42')]){_0x838ff7[_0xc05a('0x3d')]=[{'all':!![]}];}_0x838ff7=_['merge']({},_0x838ff7,_0x5b6d5b[_0xc05a('0x3a')]);return db[_0xc05a('0x3b')][_0xc05a('0x43')](_0x838ff7)[_0xc05a('0x1f')](handleEntityNotFound(_0x5ab8b5,null))['then'](respondWithResult(_0x5ab8b5,null))['catch'](handleError(_0x5ab8b5,null));};exports[_0xc05a('0x44')]=function(_0x2beb4c,_0x4b24c0){return db['OpenchannelTransferReport']['create'](_0x2beb4c[_0xc05a('0x45')],{})[_0xc05a('0x1f')](respondWithResult(_0x4b24c0,0xc9))[_0xc05a('0x40')](handleError(_0x4b24c0,null));};exports[_0xc05a('0x1e')]=function(_0xfe0c95,_0x3101b0){if(_0xfe0c95[_0xc05a('0x45')]['id']){delete _0xfe0c95[_0xc05a('0x45')]['id'];}return db[_0xc05a('0x3b')][_0xc05a('0x43')]({'where':{'id':_0xfe0c95[_0xc05a('0x46')]['id']}})[_0xc05a('0x1f')](handleEntityNotFound(_0x3101b0,null))[_0xc05a('0x1f')](saveUpdates(_0xfe0c95[_0xc05a('0x45')],null))[_0xc05a('0x1f')](respondWithResult(_0x3101b0,null))[_0xc05a('0x40')](handleError(_0x3101b0,null));};exports[_0xc05a('0x20')]=function(_0x11bdc3,_0x12ee4d){return db['OpenchannelTransferReport'][_0xc05a('0x43')]({'where':{'id':_0x11bdc3[_0xc05a('0x46')]['id']}})['then'](handleEntityNotFound(_0x12ee4d,null))['then'](removeEntity(_0x12ee4d,null))['catch'](handleError(_0x12ee4d,null));};exports[_0xc05a('0x47')]=function(_0x58a7df,_0x5150f7){return db[_0xc05a('0x3b')][_0xc05a('0x47')]()[_0xc05a('0x1f')](respondWithResult(_0x5150f7,null))[_0xc05a('0x40')](handleError(_0x5150f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3477266..a8f108e 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 _0xe836=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x4b0b1d,_0x55b209){var _0xf6dbce=function(_0xbe4818){while(--_0xbe4818){_0x4b0b1d['push'](_0x4b0b1d['shift']());}};_0xf6dbce(++_0x55b209);}(_0xe836,0x106));var _0x6e83=function(_0x2b85c4,_0x460406){_0x2b85c4=_0x2b85c4-0x0;var _0x137aa6=_0xe836[_0x2b85c4];return _0x137aa6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e83('0x0'))(_0x6e83('0x1'));var moment=require(_0x6e83('0x2'));var BPromise=require(_0x6e83('0x3'));var rp=require(_0x6e83('0x4'));var fs=require('fs');var path=require(_0x6e83('0x5'));var rimraf=require(_0x6e83('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x6e83('0x7')]=function(_0x10344c,_0x2aeba1){return _0x10344c['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6e83('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16fc=['path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd3aa8b,_0x31fb6d){var _0x1bcf66=function(_0x1c27dd){while(--_0x1c27dd){_0xd3aa8b['push'](_0xd3aa8b['shift']());}};_0x1bcf66(++_0x31fb6d);}(_0x16fc,0x134));var _0xc16f=function(_0x34747e,_0x3e17ba){_0x34747e=_0x34747e-0x0;var _0x191182=_0x16fc[_0x34747e];return _0x191182;};'use strict';var _=require(_0xc16f('0x0'));var util=require(_0xc16f('0x1'));var logger=require(_0xc16f('0x2'))(_0xc16f('0x3'));var moment=require(_0xc16f('0x4'));var BPromise=require(_0xc16f('0x5'));var rp=require(_0xc16f('0x6'));var fs=require('fs');var path=require(_0xc16f('0x7'));var rimraf=require(_0xc16f('0x8'));var config=require('../../config/environment');var attributes=require(_0xc16f('0x9'));module[_0xc16f('0xa')]=function(_0x214aea,_0x404cc8){return _0x214aea[_0xc16f('0xb')](_0xc16f('0xc'),attributes,{'tableName':_0xc16f('0xd'),'paranoid':![],'indexes':[{'name':_0xc16f('0xe'),'fields':[_0xc16f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a3fe34e..e6cfdf8 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 _0xc130=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xc130,0x7c));var _0x0c13=function(_0x57df66,_0xf7a1eb){_0x57df66=_0x57df66-0x0;var _0x52baae=_0xc130[_0x57df66];return _0x52baae;};'use strict';var _=require(_0x0c13('0x0'));var util=require(_0x0c13('0x1'));var moment=require(_0x0c13('0x2'));var BPromise=require(_0x0c13('0x3'));var rs=require(_0x0c13('0x4'));var fs=require('fs');var Redis=require(_0x0c13('0x5'));var db=require(_0x0c13('0x6'))['db'];var utils=require(_0x0c13('0x7'));var logger=require(_0x0c13('0x8'))(_0x0c13('0x9'));var config=require(_0x0c13('0xa'));var jayson=require(_0x0c13('0xb'));var client=jayson[_0x0c13('0xc')][_0x0c13('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2eaff3,_0x14bc49,_0x36104f){return new BPromise(function(_0x400c1f,_0x4ba593){return client[_0x0c13('0xe')](_0x2eaff3,_0x36104f)[_0x0c13('0xf')](function(_0x582c1f){logger[_0x0c13('0x10')](_0x0c13('0x11'),_0x14bc49,_0x0c13('0x12'));logger['debug'](_0x0c13('0x13'),_0x14bc49,'request\x20sent',JSON[_0x0c13('0x14')](_0x582c1f));if(_0x582c1f[_0x0c13('0x15')]){if(_0x582c1f[_0x0c13('0x15')][_0x0c13('0x16')]===0x1f4){logger[_0x0c13('0x15')](_0x0c13('0x11'),_0x14bc49,_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);return _0x4ba593(_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x14bc49,_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);return _0x400c1f(_0x582c1f[_0x0c13('0x15')]['message']);}else{logger[_0x0c13('0x10')](_0x0c13('0x11'),_0x14bc49,_0x0c13('0x12'));_0x400c1f(_0x582c1f['result'][_0x0c13('0x17')]);}})[_0x0c13('0x18')](function(_0x2e5791){logger[_0x0c13('0x15')](_0x0c13('0x11'),_0x14bc49,_0x2e5791);_0x4ba593(_0x2e5791);});});} \ No newline at end of file +var _0xd417=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x1573d5,_0x556954){var _0x3a5538=function(_0x1e05b0){while(--_0x1e05b0){_0x1573d5['push'](_0x1573d5['shift']());}};_0x3a5538(++_0x556954);}(_0xd417,0x130));var _0x7d41=function(_0xec3c8b,_0x113424){_0xec3c8b=_0xec3c8b-0x0;var _0x367dd9=_0xd417[_0xec3c8b];return _0x367dd9;};'use strict';var _=require('lodash');var util=require(_0x7d41('0x0'));var moment=require(_0x7d41('0x1'));var BPromise=require(_0x7d41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d41('0x3'));var db=require(_0x7d41('0x4'))['db'];var utils=require(_0x7d41('0x5'));var logger=require('../../config/logger')(_0x7d41('0x6'));var config=require(_0x7d41('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7d41('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43109a,_0x5554b5,_0x71f5e5){return new BPromise(function(_0x39555e,_0x12c2ab){return client[_0x7d41('0x9')](_0x43109a,_0x71f5e5)['then'](function(_0x426b73){logger[_0x7d41('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5554b5,_0x7d41('0xb'));logger['debug'](_0x7d41('0xc'),_0x5554b5,_0x7d41('0xb'),JSON[_0x7d41('0xd')](_0x426b73));if(_0x426b73[_0x7d41('0xe')]){if(_0x426b73['error']['code']===0x1f4){logger[_0x7d41('0xe')](_0x7d41('0xf'),_0x5554b5,_0x426b73[_0x7d41('0xe')]['message']);return _0x12c2ab(_0x426b73['error'][_0x7d41('0x10')]);}logger[_0x7d41('0xe')](_0x7d41('0xf'),_0x5554b5,_0x426b73[_0x7d41('0xe')][_0x7d41('0x10')]);return _0x39555e(_0x426b73[_0x7d41('0xe')][_0x7d41('0x10')]);}else{logger[_0x7d41('0xa')](_0x7d41('0xf'),_0x5554b5,_0x7d41('0xb'));_0x39555e(_0x426b73['result']['message']);}})[_0x7d41('0x11')](function(_0x33c0ec){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x5554b5,_0x33c0ec);_0x12c2ab(_0x33c0ec);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bc0a241..0d31b46 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 _0xffea=['create','put','/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','./pause.controller','get','index','show','post','isAuthenticated'];(function(_0x39f7e2,_0x57d23b){var _0xdcdc85=function(_0x27b586){while(--_0x27b586){_0x39f7e2['push'](_0x39f7e2['shift']());}};_0xdcdc85(++_0x57d23b);}(_0xffea,0x1af));var _0xaffe=function(_0xec0a3f,_0x5468a9){_0xec0a3f=_0xec0a3f-0x0;var _0x4c73cc=_0xffea[_0xec0a3f];return _0x4c73cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaffe('0x0'));var timeout=require(_0xaffe('0x1'));var express=require(_0xaffe('0x2'));var router=express[_0xaffe('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xaffe('0x4'));var config=require('../../config/environment');var controller=require(_0xaffe('0x5'));router[_0xaffe('0x6')]('/',auth['isAuthenticated'](),controller[_0xaffe('0x7')]);router[_0xaffe('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xaffe('0x8')]);router[_0xaffe('0x9')]('/',auth[_0xaffe('0xa')](),controller[_0xaffe('0xb')]);router[_0xaffe('0xc')](_0xaffe('0xd'),auth[_0xaffe('0xa')](),controller[_0xaffe('0xe')]);router[_0xaffe('0xf')]('/:id',auth[_0xaffe('0xa')](),controller['destroy']);module[_0xaffe('0x10')]=router; \ No newline at end of file +var _0x3f91=['Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','express'];(function(_0x31330c,_0x5dfce3){var _0x50472b=function(_0x50506e){while(--_0x50506e){_0x31330c['push'](_0x31330c['shift']());}};_0x50472b(++_0x5dfce3);}(_0x3f91,0x9e));var _0x13f9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3f91[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x13f9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x13f9('0x1'));var router=express[_0x13f9('0x2')]();var auth=require(_0x13f9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x13f9('0x4'));var controller=require('./pause.controller');router[_0x13f9('0x5')]('/',auth['isAuthenticated'](),controller[_0x13f9('0x6')]);router[_0x13f9('0x5')]('/:id',auth[_0x13f9('0x7')](),controller['show']);router[_0x13f9('0x8')]('/',auth[_0x13f9('0x7')](),controller[_0x13f9('0x9')]);router[_0x13f9('0xa')](_0x13f9('0xb'),auth[_0x13f9('0x7')](),controller[_0x13f9('0xc')]);router[_0x13f9('0xd')](_0x13f9('0xb'),auth[_0x13f9('0x7')](),controller[_0x13f9('0xe')]);module[_0x13f9('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 46a0444..6c3701d 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 _0x06d1=['sequelize','exports','STRING','name'];(function(_0x24d70e,_0x276071){var _0x2512ec=function(_0x434d81){while(--_0x434d81){_0x24d70e['push'](_0x24d70e['shift']());}};_0x2512ec(++_0x276071);}(_0x06d1,0x1a4));var _0x106d=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x06d1[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x106d('0x0'));module[_0x106d('0x1')]={'name':{'type':Sequelize[_0x106d('0x2')],'unique':_0x106d('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c77=['exports','STRING'];(function(_0x19a187,_0x2541e0){var _0x4093e=function(_0x44bf11){while(--_0x44bf11){_0x19a187['push'](_0x19a187['shift']());}};_0x4093e(++_0x2541e0);}(_0x3c77,0x14a));var _0x73c7=function(_0x139594,_0x426d46){_0x139594=_0x139594-0x0;var _0x3b37ad=_0x3c77[_0x139594];return _0x3b37ad;};'use strict';var Sequelize=require('sequelize');module[_0x73c7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x73c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 12253d0..e002462 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 _0x7124=['querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','then','destroy','Pauses','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Pause','includeAll','include','findAll','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x2849be,_0x3113fe){var _0x22fb5a=function(_0x255a05){while(--_0x255a05){_0x2849be['push'](_0x2849be['shift']());}};_0x22fb5a(++_0x3113fe);}(_0x7124,0x91));var _0x4712=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x7124[_0x154983];return _0x3d1243;};'use strict';var pdf=require(_0x4712('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4712('0x1'));var zipdir=require(_0x4712('0x2'));var jsonpatch=require(_0x4712('0x3'));var rp=require('request-promise');var moment=require(_0x4712('0x4'));var BPromise=require(_0x4712('0x5'));var Mustache=require(_0x4712('0x6'));var util=require(_0x4712('0x7'));var path=require(_0x4712('0x8'));var sox=require(_0x4712('0x9'));var csv=require('to-csv');var ejs=require(_0x4712('0xa'));var fs=require('fs');var _=require(_0x4712('0xb'));var squel=require(_0x4712('0xc'));var crypto=require(_0x4712('0xd'));var jsforce=require(_0x4712('0xe'));var deskjs=require(_0x4712('0xf'));var toCsv=require(_0x4712('0x10'));var querystring=require(_0x4712('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4712('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4712('0x13'));var utils=require(_0x4712('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4712('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb66675,_0x129efe){_0x129efe=_0x129efe||0xcc;return function(_0x3c3653){if(_0x3c3653){return _0xb66675[_0x4712('0x16')](_0x129efe);}return _0xb66675[_0x4712('0x17')](_0x129efe)['end']();};}function respondWithResult(_0x38e323,_0x46e30d){_0x46e30d=_0x46e30d||0xc8;return function(_0x482d14){if(_0x482d14){return _0x38e323[_0x4712('0x17')](_0x46e30d)[_0x4712('0x18')](_0x482d14);}};}function respondWithFilteredResult(_0x4079fe,_0x5077d5){return function(_0x52ff6f){if(_0x52ff6f){var _0xaf4a08=_0x52ff6f[_0x4712('0x19')],_0x2b39cc=_0x5077d5['offset'],_0xdc070e=_0x5077d5['offset']+_0x5077d5[_0x4712('0x1a')],_0x15ebee;if(_0xdc070e>=_0xaf4a08){_0xdc070e=_0xaf4a08;_0x15ebee=0xc8;}else{_0x15ebee=0xce;}_0x4079fe[_0x4712('0x17')](_0x15ebee);return _0x4079fe[_0x4712('0x1b')](_0x4712('0x1c'),_0x2b39cc+'-'+_0xdc070e+'/'+_0xaf4a08)['json'](_0x52ff6f);}return null;};}function patchUpdates(_0x5d450d){return function(_0x2d6326){try{jsonpatch[_0x4712('0x1d')](_0x2d6326,_0x5d450d,!![]);}catch(_0x3d5bb8){return BPromise[_0x4712('0x1e')](_0x3d5bb8);}return _0x2d6326['save']();};}function saveUpdates(_0xfc041b,_0x7e0491){return function(_0x38e522){if(_0x38e522){return _0x38e522['update'](_0xfc041b)[_0x4712('0x1f')](function(_0x6174cc){return _0x6174cc;});}return null;};}function removeEntity(_0x693b13,_0x3539dd){return function(_0x5c08f6){if(_0x5c08f6){return _0x5c08f6[_0x4712('0x20')]()[_0x4712('0x1f')](function(){var _0x3163e3=_0x5c08f6['get']({'plain':!![]});var _0x31a3c5=_0x4712('0x21');return db[_0x4712('0x22')]['destroy']({'where':{'type':_0x31a3c5,'resourceId':_0x3163e3['id']}})[_0x4712('0x1f')](function(){return _0x5c08f6;});})[_0x4712('0x1f')](function(){_0x693b13[_0x4712('0x17')](0xcc)[_0x4712('0x23')]();});}};}function handleEntityNotFound(_0xa7d6c2,_0x4ba210){return function(_0x140770){if(!_0x140770){_0xa7d6c2['sendStatus'](0x194);}return _0x140770;};}function handleError(_0x2318ea,_0x13fd5e){_0x13fd5e=_0x13fd5e||0x1f4;return function(_0x7ecf44){logger[_0x4712('0x24')](_0x7ecf44[_0x4712('0x25')]);if(_0x7ecf44[_0x4712('0x26')]){delete _0x7ecf44['name'];}_0x2318ea['status'](_0x13fd5e)[_0x4712('0x27')](_0x7ecf44);};}exports[_0x4712('0x28')]=function(_0x597914,_0x592d28){var _0x323105={},_0x303afe={},_0x243247={'count':0x0,'rows':[]};var _0x1b9de6=_[_0x4712('0x29')](db['Pause'][_0x4712('0x2a')],function(_0x3b7802){return{'name':_0x3b7802[_0x4712('0x2b')],'type':_0x3b7802['type'][_0x4712('0x2c')]};});_0x303afe[_0x4712('0x2d')]=_[_0x4712('0x29')](_0x1b9de6,_0x4712('0x26'));_0x303afe['query']=_[_0x4712('0x2e')](_0x597914['query']);_0x303afe[_0x4712('0x2f')]=_[_0x4712('0x30')](_0x303afe['model'],_0x303afe[_0x4712('0x31')]);_0x323105[_0x4712('0x32')]=_[_0x4712('0x30')](_0x303afe[_0x4712('0x2d')],qs[_0x4712('0x33')](_0x597914[_0x4712('0x31')][_0x4712('0x33')]));_0x323105[_0x4712('0x32')]=_0x323105[_0x4712('0x32')][_0x4712('0x34')]?_0x323105[_0x4712('0x32')]:_0x303afe[_0x4712('0x2d')];if(!_0x597914[_0x4712('0x31')]['hasOwnProperty'](_0x4712('0x35'))){_0x323105[_0x4712('0x1a')]=qs[_0x4712('0x1a')](_0x597914[_0x4712('0x31')][_0x4712('0x1a')]);_0x323105[_0x4712('0x36')]=qs[_0x4712('0x36')](_0x597914[_0x4712('0x31')][_0x4712('0x36')]);}_0x323105[_0x4712('0x37')]=qs[_0x4712('0x38')](_0x597914[_0x4712('0x31')][_0x4712('0x38')]);_0x323105[_0x4712('0x39')]=qs[_0x4712('0x2f')](_[_0x4712('0x3a')](_0x597914[_0x4712('0x31')],_0x303afe[_0x4712('0x2f')]),_0x1b9de6);if(_0x597914[_0x4712('0x31')][_0x4712('0x3b')]){_0x323105['where']=_[_0x4712('0x3c')](_0x323105[_0x4712('0x39')],{'$or':_[_0x4712('0x29')](_0x1b9de6,function(_0x384315){if(_0x384315[_0x4712('0x3d')]!==_0x4712('0x3e')){var _0x40ba5d={};_0x40ba5d[_0x384315[_0x4712('0x26')]]={'$like':'%'+_0x597914[_0x4712('0x31')][_0x4712('0x3b')]+'%'};return _0x40ba5d;}})});}_0x323105=_[_0x4712('0x3c')]({},_0x323105,_0x597914[_0x4712('0x3f')]);var _0x553785={'where':_0x323105[_0x4712('0x39')]};return db[_0x4712('0x40')][_0x4712('0x19')](_0x553785)[_0x4712('0x1f')](function(_0x482620){_0x243247[_0x4712('0x19')]=_0x482620;if(_0x597914[_0x4712('0x31')][_0x4712('0x41')]){_0x323105[_0x4712('0x42')]=[{'all':!![]}];}return db[_0x4712('0x40')][_0x4712('0x43')](_0x323105);})[_0x4712('0x1f')](function(_0x143cbd){_0x243247['rows']=_0x143cbd;return _0x243247;})[_0x4712('0x1f')](respondWithFilteredResult(_0x592d28,_0x323105))[_0x4712('0x44')](handleError(_0x592d28,null));};exports[_0x4712('0x45')]=function(_0x39b68e,_0x449a3e){var _0x4f5dbd={'raw':!![],'where':{'id':_0x39b68e[_0x4712('0x46')]['id']}},_0x5b27ba={};_0x5b27ba[_0x4712('0x2d')]=_['keys'](db[_0x4712('0x40')]['rawAttributes']);_0x5b27ba['query']=_[_0x4712('0x2e')](_0x39b68e[_0x4712('0x31')]);_0x5b27ba[_0x4712('0x2f')]=_['intersection'](_0x5b27ba[_0x4712('0x2d')],_0x5b27ba[_0x4712('0x31')]);_0x4f5dbd[_0x4712('0x32')]=_[_0x4712('0x30')](_0x5b27ba[_0x4712('0x2d')],qs[_0x4712('0x33')](_0x39b68e['query'][_0x4712('0x33')]));_0x4f5dbd[_0x4712('0x32')]=_0x4f5dbd[_0x4712('0x32')][_0x4712('0x34')]?_0x4f5dbd['attributes']:_0x5b27ba[_0x4712('0x2d')];if(_0x39b68e[_0x4712('0x31')][_0x4712('0x41')]){_0x4f5dbd[_0x4712('0x42')]=[{'all':!![]}];}_0x4f5dbd=_[_0x4712('0x3c')]({},_0x4f5dbd,_0x39b68e[_0x4712('0x3f')]);return db[_0x4712('0x40')][_0x4712('0x47')](_0x4f5dbd)[_0x4712('0x1f')](handleEntityNotFound(_0x449a3e,null))[_0x4712('0x1f')](respondWithResult(_0x449a3e,null))['catch'](handleError(_0x449a3e,null));};exports[_0x4712('0x48')]=function(_0x294585,_0x3804c8){return db['Pause']['create'](_0x294585['body'],{})['then'](function(_0x448baa){var _0xea4848=_0x294585[_0x4712('0x49')][_0x4712('0x4a')]({'plain':!![]});if(!_0xea4848)throw new Error(_0x4712('0x4b'));if(_0xea4848[_0x4712('0x4c')]==='user'){var _0x125b18=_0x448baa[_0x4712('0x4a')]({'plain':!![]});var _0x458deb=_0x4712('0x21');return db[_0x4712('0x4d')]['find']({'where':{'name':_0x458deb,'userProfileId':_0xea4848[_0x4712('0x4e')]},'raw':!![]})[_0x4712('0x1f')](function(_0x96163f){if(_0x96163f&&_0x96163f['autoAssociation']===0x0){return db['UserProfileResource'][_0x4712('0x48')]({'name':_0x125b18[_0x4712('0x26')],'resourceId':_0x125b18['id'],'type':_0x96163f[_0x4712('0x26')],'sectionId':_0x96163f['id']},{})[_0x4712('0x1f')](function(){return _0x448baa;});}else{return _0x448baa;}})['catch'](function(_0x369837){logger[_0x4712('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x369837);throw _0x369837;});}return _0x448baa;})[_0x4712('0x1f')](respondWithResult(_0x3804c8,0xc9))[_0x4712('0x44')](handleError(_0x3804c8,null));};exports[_0x4712('0x4f')]=function(_0x5dc1cf,_0xc986da){if(_0x5dc1cf[_0x4712('0x50')]['id']){delete _0x5dc1cf[_0x4712('0x50')]['id'];}return db[_0x4712('0x40')]['find']({'where':{'id':_0x5dc1cf[_0x4712('0x46')]['id']}})[_0x4712('0x1f')](handleEntityNotFound(_0xc986da,null))[_0x4712('0x1f')](saveUpdates(_0x5dc1cf['body'],null))[_0x4712('0x1f')](respondWithResult(_0xc986da,null))[_0x4712('0x44')](handleError(_0xc986da,null));};exports[_0x4712('0x20')]=function(_0x418c6c,_0xc429d7){return db[_0x4712('0x40')][_0x4712('0x47')]({'where':{'id':_0x418c6c[_0x4712('0x46')]['id']}})['then'](handleEntityNotFound(_0xc429d7,null))[_0x4712('0x1f')](removeEntity(_0xc429d7,null))[_0x4712('0x44')](handleError(_0xc429d7,null));}; \ No newline at end of file +var _0x0319=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','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','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x53db6f,_0x3b0fc1){var _0x386a7f=function(_0x24a595){while(--_0x24a595){_0x53db6f['push'](_0x53db6f['shift']());}};_0x386a7f(++_0x3b0fc1);}(_0x0319,0x109));var _0x9031=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0319[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9031('0x0'));var rimraf=require(_0x9031('0x1'));var zipdir=require(_0x9031('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9031('0x3'));var moment=require('moment');var BPromise=require(_0x9031('0x4'));var Mustache=require('mustache');var util=require(_0x9031('0x5'));var path=require(_0x9031('0x6'));var sox=require(_0x9031('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9031('0x8'));var squel=require(_0x9031('0x9'));var crypto=require(_0x9031('0xa'));var jsforce=require(_0x9031('0xb'));var deskjs=require(_0x9031('0xc'));var toCsv=require(_0x9031('0xd'));var querystring=require('querystring');var Papa=require(_0x9031('0xe'));var Redis=require(_0x9031('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9031('0x10'));var as=require(_0x9031('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9031('0x12'));var licenseUtil=require(_0x9031('0x13'));var db=require(_0x9031('0x14'))['db'];function respondWithStatusCode(_0x365813,_0x2bb520){_0x2bb520=_0x2bb520||0xcc;return function(_0x429f1e){if(_0x429f1e){return _0x365813[_0x9031('0x15')](_0x2bb520);}return _0x365813['status'](_0x2bb520)['end']();};}function respondWithResult(_0x1d0f56,_0x3b7d8b){_0x3b7d8b=_0x3b7d8b||0xc8;return function(_0x284aec){if(_0x284aec){return _0x1d0f56[_0x9031('0x16')](_0x3b7d8b)[_0x9031('0x17')](_0x284aec);}};}function respondWithFilteredResult(_0x2c7b54,_0x547365){return function(_0x4aa4fc){if(_0x4aa4fc){var _0x2934d9=_0x4aa4fc[_0x9031('0x18')],_0x30aa2d=_0x547365['offset'],_0x450be0=_0x547365[_0x9031('0x19')]+_0x547365[_0x9031('0x1a')],_0x24dc0b;if(_0x450be0>=_0x2934d9){_0x450be0=_0x2934d9;_0x24dc0b=0xc8;}else{_0x24dc0b=0xce;}_0x2c7b54[_0x9031('0x16')](_0x24dc0b);return _0x2c7b54['set'](_0x9031('0x1b'),_0x30aa2d+'-'+_0x450be0+'/'+_0x2934d9)[_0x9031('0x17')](_0x4aa4fc);}return null;};}function patchUpdates(_0x4eaf4f){return function(_0x26a7a7){try{jsonpatch[_0x9031('0x1c')](_0x26a7a7,_0x4eaf4f,!![]);}catch(_0x29d96e){return BPromise[_0x9031('0x1d')](_0x29d96e);}return _0x26a7a7[_0x9031('0x1e')]();};}function saveUpdates(_0x27f1b5,_0x1d69d9){return function(_0x52bf25){if(_0x52bf25){return _0x52bf25[_0x9031('0x1f')](_0x27f1b5)[_0x9031('0x20')](function(_0x34ab15){return _0x34ab15;});}return null;};}function removeEntity(_0x24f26a,_0x3fa46d){return function(_0x213e47){if(_0x213e47){return _0x213e47['destroy']()[_0x9031('0x20')](function(){var _0xa38d51=_0x213e47['get']({'plain':!![]});var _0x21b72c=_0x9031('0x21');return db[_0x9031('0x22')]['destroy']({'where':{'type':_0x21b72c,'resourceId':_0xa38d51['id']}})['then'](function(){return _0x213e47;});})[_0x9031('0x20')](function(){_0x24f26a[_0x9031('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7f8b,_0x2dbeab){return function(_0x564b26){if(!_0x564b26){_0x3b7f8b['sendStatus'](0x194);}return _0x564b26;};}function handleError(_0x21e379,_0x1f35de){_0x1f35de=_0x1f35de||0x1f4;return function(_0x4f60ff){logger[_0x9031('0x23')](_0x4f60ff[_0x9031('0x24')]);if(_0x4f60ff[_0x9031('0x25')]){delete _0x4f60ff[_0x9031('0x25')];}_0x21e379['status'](_0x1f35de)[_0x9031('0x26')](_0x4f60ff);};}exports[_0x9031('0x27')]=function(_0x48f20b,_0x5ef7de){var _0x47528a={},_0x56ee5d={},_0x77210a={'count':0x0,'rows':[]};var _0x239de4=_[_0x9031('0x28')](db[_0x9031('0x29')][_0x9031('0x2a')],function(_0x5f51a1){return{'name':_0x5f51a1['fieldName'],'type':_0x5f51a1[_0x9031('0x2b')][_0x9031('0x2c')]};});_0x56ee5d[_0x9031('0x2d')]=_[_0x9031('0x28')](_0x239de4,_0x9031('0x25'));_0x56ee5d[_0x9031('0x2e')]=_[_0x9031('0x2f')](_0x48f20b[_0x9031('0x2e')]);_0x56ee5d[_0x9031('0x30')]=_[_0x9031('0x31')](_0x56ee5d[_0x9031('0x2d')],_0x56ee5d[_0x9031('0x2e')]);_0x47528a[_0x9031('0x32')]=_[_0x9031('0x31')](_0x56ee5d[_0x9031('0x2d')],qs[_0x9031('0x33')](_0x48f20b['query'][_0x9031('0x33')]));_0x47528a[_0x9031('0x32')]=_0x47528a['attributes'][_0x9031('0x34')]?_0x47528a[_0x9031('0x32')]:_0x56ee5d[_0x9031('0x2d')];if(!_0x48f20b[_0x9031('0x2e')][_0x9031('0x35')](_0x9031('0x36'))){_0x47528a[_0x9031('0x1a')]=qs[_0x9031('0x1a')](_0x48f20b[_0x9031('0x2e')][_0x9031('0x1a')]);_0x47528a['offset']=qs['offset'](_0x48f20b[_0x9031('0x2e')][_0x9031('0x19')]);}_0x47528a[_0x9031('0x37')]=qs[_0x9031('0x38')](_0x48f20b['query'][_0x9031('0x38')]);_0x47528a[_0x9031('0x39')]=qs['filters'](_[_0x9031('0x3a')](_0x48f20b[_0x9031('0x2e')],_0x56ee5d[_0x9031('0x30')]),_0x239de4);if(_0x48f20b[_0x9031('0x2e')][_0x9031('0x3b')]){_0x47528a[_0x9031('0x39')]=_[_0x9031('0x3c')](_0x47528a[_0x9031('0x39')],{'$or':_[_0x9031('0x28')](_0x239de4,function(_0x26a1e3){if(_0x26a1e3[_0x9031('0x2b')]!==_0x9031('0x3d')){var _0x333f08={};_0x333f08[_0x26a1e3['name']]={'$like':'%'+_0x48f20b[_0x9031('0x2e')]['filter']+'%'};return _0x333f08;}})});}_0x47528a=_[_0x9031('0x3c')]({},_0x47528a,_0x48f20b[_0x9031('0x3e')]);var _0x30bea9={'where':_0x47528a[_0x9031('0x39')]};return db[_0x9031('0x29')]['count'](_0x30bea9)[_0x9031('0x20')](function(_0x3cd059){_0x77210a['count']=_0x3cd059;if(_0x48f20b[_0x9031('0x2e')][_0x9031('0x3f')]){_0x47528a['include']=[{'all':!![]}];}return db[_0x9031('0x29')][_0x9031('0x40')](_0x47528a);})['then'](function(_0x47410f){_0x77210a[_0x9031('0x41')]=_0x47410f;return _0x77210a;})[_0x9031('0x20')](respondWithFilteredResult(_0x5ef7de,_0x47528a))[_0x9031('0x42')](handleError(_0x5ef7de,null));};exports[_0x9031('0x43')]=function(_0x41a796,_0x323c46){var _0x5bf6e3={'raw':!![],'where':{'id':_0x41a796['params']['id']}},_0x561462={};_0x561462[_0x9031('0x2d')]=_['keys'](db[_0x9031('0x29')]['rawAttributes']);_0x561462[_0x9031('0x2e')]=_[_0x9031('0x2f')](_0x41a796[_0x9031('0x2e')]);_0x561462[_0x9031('0x30')]=_['intersection'](_0x561462['model'],_0x561462[_0x9031('0x2e')]);_0x5bf6e3[_0x9031('0x32')]=_[_0x9031('0x31')](_0x561462[_0x9031('0x2d')],qs['fields'](_0x41a796[_0x9031('0x2e')][_0x9031('0x33')]));_0x5bf6e3[_0x9031('0x32')]=_0x5bf6e3[_0x9031('0x32')][_0x9031('0x34')]?_0x5bf6e3[_0x9031('0x32')]:_0x561462[_0x9031('0x2d')];if(_0x41a796[_0x9031('0x2e')][_0x9031('0x3f')]){_0x5bf6e3['include']=[{'all':!![]}];}_0x5bf6e3=_[_0x9031('0x3c')]({},_0x5bf6e3,_0x41a796['options']);return db[_0x9031('0x29')][_0x9031('0x44')](_0x5bf6e3)[_0x9031('0x20')](handleEntityNotFound(_0x323c46,null))[_0x9031('0x20')](respondWithResult(_0x323c46,null))[_0x9031('0x42')](handleError(_0x323c46,null));};exports[_0x9031('0x45')]=function(_0x183479,_0x1da20d){return db[_0x9031('0x29')]['create'](_0x183479[_0x9031('0x46')],{})[_0x9031('0x20')](function(_0x484b22){var _0x39459c=_0x183479[_0x9031('0x47')][_0x9031('0x48')]({'plain':!![]});if(!_0x39459c)throw new Error(_0x9031('0x49'));if(_0x39459c[_0x9031('0x4a')]===_0x9031('0x47')){var _0x58ee88=_0x484b22[_0x9031('0x48')]({'plain':!![]});var _0x5d2202=_0x9031('0x21');return db[_0x9031('0x4b')][_0x9031('0x44')]({'where':{'name':_0x5d2202,'userProfileId':_0x39459c[_0x9031('0x4c')]},'raw':!![]})[_0x9031('0x20')](function(_0x2be802){if(_0x2be802&&_0x2be802[_0x9031('0x4d')]===0x0){return db[_0x9031('0x22')][_0x9031('0x45')]({'name':_0x58ee88[_0x9031('0x25')],'resourceId':_0x58ee88['id'],'type':_0x2be802[_0x9031('0x25')],'sectionId':_0x2be802['id']},{})[_0x9031('0x20')](function(){return _0x484b22;});}else{return _0x484b22;}})[_0x9031('0x42')](function(_0x474b9b){logger['error'](_0x9031('0x4e'),_0x474b9b);throw _0x474b9b;});}return _0x484b22;})[_0x9031('0x20')](respondWithResult(_0x1da20d,0xc9))['catch'](handleError(_0x1da20d,null));};exports[_0x9031('0x1f')]=function(_0x5e7212,_0x53d989){if(_0x5e7212['body']['id']){delete _0x5e7212[_0x9031('0x46')]['id'];}return db[_0x9031('0x29')]['find']({'where':{'id':_0x5e7212[_0x9031('0x4f')]['id']}})[_0x9031('0x20')](handleEntityNotFound(_0x53d989,null))[_0x9031('0x20')](saveUpdates(_0x5e7212[_0x9031('0x46')],null))[_0x9031('0x20')](respondWithResult(_0x53d989,null))[_0x9031('0x42')](handleError(_0x53d989,null));};exports['destroy']=function(_0x11acd9,_0x2fb36b){return db[_0x9031('0x29')]['find']({'where':{'id':_0x11acd9[_0x9031('0x4f')]['id']}})[_0x9031('0x20')](handleEntityNotFound(_0x2fb36b,null))[_0x9031('0x20')](removeEntity(_0x2fb36b,null))['catch'](handleError(_0x2fb36b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3e73158..53b04e3 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 _0x530f=['path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','util','moment','bluebird','request-promise'];(function(_0x186b0e,_0x57b796){var _0x1f69b1=function(_0x184936){while(--_0x184936){_0x186b0e['push'](_0x186b0e['shift']());}};_0x1f69b1(++_0x57b796);}(_0x530f,0x167));var _0xf530=function(_0x55c307,_0x22b2ce){_0x55c307=_0x55c307-0x0;var _0xcca0a9=_0x530f[_0x55c307];return _0xcca0a9;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26b2=['define','tools_pauses','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x131b94,_0x2b855f){var _0x1e0d4d=function(_0x2d643e){while(--_0x2d643e){_0x131b94['push'](_0x131b94['shift']());}};_0x1e0d4d(++_0x2b855f);}(_0x26b2,0xc5));var _0x226b=function(_0x1863d1,_0x75b58c){_0x1863d1=_0x1863d1-0x0;var _0x58e543=_0x26b2[_0x1863d1];return _0x58e543;};'use strict';var _=require(_0x226b('0x0'));var util=require(_0x226b('0x1'));var logger=require(_0x226b('0x2'))('api');var moment=require(_0x226b('0x3'));var BPromise=require(_0x226b('0x4'));var rp=require(_0x226b('0x5'));var fs=require('fs');var path=require(_0x226b('0x6'));var rimraf=require(_0x226b('0x7'));var config=require(_0x226b('0x8'));var attributes=require(_0x226b('0x9'));module[_0x226b('0xa')]=function(_0x36bf2b,_0x4a9348){return _0x36bf2b[_0x226b('0xb')]('Pause',attributes,{'tableName':_0x226b('0xc'),'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 790e7bd..44adfb4 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 _0x4567=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','error','code','Pause,\x20%s,\x20%s','message','result','catch','Pause','find','options','raw','where','include','map','model','attributes','debug','ShowPause','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4567,0x14e));var _0x7456=function(_0x551fd2,_0x39c449){_0x551fd2=_0x551fd2-0x0;var _0xd75687=_0x4567[_0x551fd2];return _0xd75687;};'use strict';var _=require(_0x7456('0x0'));var util=require(_0x7456('0x1'));var moment=require(_0x7456('0x2'));var BPromise=require('bluebird');var rs=require(_0x7456('0x3'));var fs=require('fs');var Redis=require(_0x7456('0x4'));var db=require(_0x7456('0x5'))['db'];var utils=require(_0x7456('0x6'));var logger=require(_0x7456('0x7'))(_0x7456('0x8'));var config=require(_0x7456('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7456('0xa')][_0x7456('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa5bad9,_0x489690,_0x417d1c){return new BPromise(function(_0x4cfc2b,_0x15a2c5){return client[_0x7456('0xc')](_0xa5bad9,_0x417d1c)[_0x7456('0xd')](function(_0x29a68c){logger[_0x7456('0xe')]('Pause,\x20%s,\x20%s',_0x489690,_0x7456('0xf'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x489690,'request\x20sent',JSON['stringify'](_0x29a68c));if(_0x29a68c[_0x7456('0x10')]){if(_0x29a68c[_0x7456('0x10')][_0x7456('0x11')]===0x1f4){logger['error'](_0x7456('0x12'),_0x489690,_0x29a68c['error'][_0x7456('0x13')]);return _0x15a2c5(_0x29a68c[_0x7456('0x10')][_0x7456('0x13')]);}logger[_0x7456('0x10')](_0x7456('0x12'),_0x489690,_0x29a68c[_0x7456('0x10')]['message']);return _0x4cfc2b(_0x29a68c[_0x7456('0x10')]['message']);}else{logger['info']('Pause,\x20%s,\x20%s',_0x489690,'request\x20sent');_0x4cfc2b(_0x29a68c[_0x7456('0x14')][_0x7456('0x13')]);}})[_0x7456('0x15')](function(_0x3d66ed){logger['error']('Pause,\x20%s,\x20%s',_0x489690,_0x3d66ed);_0x15a2c5(_0x3d66ed);});});}exports['ShowPause']=function(_0x2015ef){var _0x2d5d68=this;return new Promise(function(_0x468115,_0x2379b0){return db[_0x7456('0x16')][_0x7456('0x17')]({'raw':_0x2015ef[_0x7456('0x18')]?_0x2015ef[_0x7456('0x18')][_0x7456('0x19')]===undefined?!![]:![]:!![],'where':_0x2015ef['options']?_0x2015ef[_0x7456('0x18')][_0x7456('0x1a')]||null:null,'attributes':_0x2015ef[_0x7456('0x18')]?_0x2015ef[_0x7456('0x18')]['attributes']||null:null,'include':_0x2015ef[_0x7456('0x18')]?_0x2015ef[_0x7456('0x18')][_0x7456('0x1b')]?_[_0x7456('0x1c')](_0x2015ef[_0x7456('0x18')][_0x7456('0x1b')],function(_0x54ed25){return{'model':db[_0x54ed25[_0x7456('0x1d')]],'as':_0x54ed25['as'],'attributes':_0x54ed25[_0x7456('0x1e')],'include':_0x54ed25[_0x7456('0x1b')]?_[_0x7456('0x1c')](_0x54ed25[_0x7456('0x1b')],function(_0x43373d){return{'model':db[_0x43373d[_0x7456('0x1d')]],'as':_0x43373d['as'],'attributes':_0x43373d[_0x7456('0x1e')],'include':_0x43373d[_0x7456('0x1b')]?_[_0x7456('0x1c')](_0x43373d[_0x7456('0x1b')],function(_0x3e328f){return{'model':db[_0x3e328f[_0x7456('0x1d')]],'as':_0x3e328f['as'],'attributes':_0x3e328f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7456('0xd')](function(_0x590ee0){logger[_0x7456('0xe')]('ShowPause',_0x2015ef);logger[_0x7456('0x1f')](_0x7456('0x20'),_0x2015ef,JSON[_0x7456('0x21')](_0x590ee0));_0x468115(_0x590ee0);})[_0x7456('0x15')](function(_0x2951a9){logger[_0x7456('0x10')](_0x7456('0x20'),_0x2951a9['message'],_0x2015ef);_0x2379b0(_0x2d5d68[_0x7456('0x10')](0x1f4,_0x2951a9[_0x7456('0x13')]));});});}; \ No newline at end of file +var _0x03a6=['ShowPause','Pause','find','raw','options','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x03a6,0x1af));var _0x603a=function(_0x45c149,_0x138852){_0x45c149=_0x45c149-0x0;var _0x1c56c5=_0x03a6[_0x45c149];return _0x1c56c5;};'use strict';var _=require(_0x603a('0x0'));var util=require(_0x603a('0x1'));var moment=require(_0x603a('0x2'));var BPromise=require(_0x603a('0x3'));var rs=require(_0x603a('0x4'));var fs=require('fs');var Redis=require(_0x603a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x603a('0x6'));var logger=require('../../config/logger')(_0x603a('0x7'));var config=require(_0x603a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x603a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32674e,_0x62500d,_0x19aacf){return new BPromise(function(_0x3fb550,_0x424287){return client['request'](_0x32674e,_0x19aacf)['then'](function(_0x2ff00b){logger['info'](_0x603a('0xa'),_0x62500d,_0x603a('0xb'));logger[_0x603a('0xc')](_0x603a('0xd'),_0x62500d,_0x603a('0xb'),JSON['stringify'](_0x2ff00b));if(_0x2ff00b[_0x603a('0xe')]){if(_0x2ff00b[_0x603a('0xe')]['code']===0x1f4){logger['error'](_0x603a('0xa'),_0x62500d,_0x2ff00b[_0x603a('0xe')][_0x603a('0xf')]);return _0x424287(_0x2ff00b['error'][_0x603a('0xf')]);}logger[_0x603a('0xe')](_0x603a('0xa'),_0x62500d,_0x2ff00b[_0x603a('0xe')][_0x603a('0xf')]);return _0x3fb550(_0x2ff00b['error'][_0x603a('0xf')]);}else{logger[_0x603a('0x10')]('Pause,\x20%s,\x20%s',_0x62500d,_0x603a('0xb'));_0x3fb550(_0x2ff00b[_0x603a('0x11')][_0x603a('0xf')]);}})[_0x603a('0x12')](function(_0x1fbf2c){logger[_0x603a('0xe')](_0x603a('0xa'),_0x62500d,_0x1fbf2c);_0x424287(_0x1fbf2c);});});}exports[_0x603a('0x13')]=function(_0x5e7460){var _0x1edd87=this;return new Promise(function(_0x23f700,_0x1cd8ec){return db[_0x603a('0x14')][_0x603a('0x15')]({'raw':_0x5e7460['options']?_0x5e7460['options'][_0x603a('0x16')]===undefined?!![]:![]:!![],'where':_0x5e7460[_0x603a('0x17')]?_0x5e7460[_0x603a('0x17')][_0x603a('0x18')]||null:null,'attributes':_0x5e7460[_0x603a('0x17')]?_0x5e7460['options'][_0x603a('0x19')]||null:null,'include':_0x5e7460['options']?_0x5e7460[_0x603a('0x17')][_0x603a('0x1a')]?_[_0x603a('0x1b')](_0x5e7460[_0x603a('0x17')][_0x603a('0x1a')],function(_0x298458){return{'model':db[_0x298458[_0x603a('0x1c')]],'as':_0x298458['as'],'attributes':_0x298458[_0x603a('0x19')],'include':_0x298458[_0x603a('0x1a')]?_[_0x603a('0x1b')](_0x298458[_0x603a('0x1a')],function(_0x483031){return{'model':db[_0x483031[_0x603a('0x1c')]],'as':_0x483031['as'],'attributes':_0x483031[_0x603a('0x19')],'include':_0x483031[_0x603a('0x1a')]?_[_0x603a('0x1b')](_0x483031[_0x603a('0x1a')],function(_0x5a2794){return{'model':db[_0x5a2794[_0x603a('0x1c')]],'as':_0x5a2794['as'],'attributes':_0x5a2794[_0x603a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xae563b){logger[_0x603a('0x10')](_0x603a('0x13'),_0x5e7460);logger[_0x603a('0xc')](_0x603a('0x13'),_0x5e7460,JSON[_0x603a('0x1d')](_0xae563b));_0x23f700(_0xae563b);})[_0x603a('0x12')](function(_0x40df62){logger[_0x603a('0xe')](_0x603a('0x13'),_0x40df62[_0x603a('0xf')],_0x5e7460);_0x1cd8ec(_0x1edd87[_0x603a('0xe')](0x1f4,_0x40df62[_0x603a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 34b0f07..fe37bf7 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 _0x29e4=['download','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','extname','now','post','single','webhookPost','put','update','delete','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show'];(function(_0x273938,_0x1c28d5){var _0x20c34d=function(_0x39d260){while(--_0x39d260){_0x273938['push'](_0x273938['shift']());}};_0x20c34d(++_0x1c28d5);}(_0x29e4,0x14e));var _0x429e=function(_0x589081,_0x54d794){_0x589081=_0x589081-0x0;var _0x4b7e8c=_0x29e4[_0x589081];return _0x4b7e8c;};'use strict';var multer=require(_0x429e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x429e('0x1'));var express=require(_0x429e('0x2'));var router=express[_0x429e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x429e('0x4'));var config=require(_0x429e('0x5'));var controller=require(_0x429e('0x6'));router[_0x429e('0x7')]('/',auth[_0x429e('0x8')](),controller[_0x429e('0x9')]);router[_0x429e('0x7')](_0x429e('0xa'),controller[_0x429e('0xb')]);router[_0x429e('0x7')](_0x429e('0xc'),auth['isAuthenticated'](),controller[_0x429e('0xd')]);router[_0x429e('0x7')]('/:id/download',auth[_0x429e('0x8')](),controller[_0x429e('0xe')]);var upload=multer({'storage':multer[_0x429e('0xf')]({'destination':function(_0x5deb9,_0x417c55,_0x17cb05){_0x17cb05(null,path['join'](config[_0x429e('0x10')],_0x429e('0x11')));},'filename':function(_0x2b68b2,_0x4312af,_0x3a53ba){_0x4312af[_0x429e('0x12')]=_0x4312af[_0x429e('0x12')][_0x429e('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a53ba(null,util['format'](_0x429e('0x14'),path['basename'](_0x4312af[_0x429e('0x12')],path[_0x429e('0x15')](_0x4312af['originalname'])),Date[_0x429e('0x16')](),path[_0x429e('0x15')](_0x4312af[_0x429e('0x12')])));}})});router[_0x429e('0x17')]('/',upload[_0x429e('0x18')]('file'),controller['upload']);router[_0x429e('0x17')](_0x429e('0xa'),controller[_0x429e('0x19')]);router[_0x429e('0x1a')](_0x429e('0xc'),auth['isAuthenticated'](),controller[_0x429e('0x1b')]);router[_0x429e('0x1c')](_0x429e('0xc'),auth[_0x429e('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xa7ff=['%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','format'];(function(_0x455b12,_0x10ab4a){var _0x4ded00=function(_0x30b35a){while(--_0x30b35a){_0x455b12['push'](_0x455b12['shift']());}};_0x4ded00(++_0x10ab4a);}(_0xa7ff,0x182));var _0xfa7f=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa7ff[_0x3070dc];return _0x431489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa7f('0x0'));var timeout=require(_0xfa7f('0x1'));var express=require(_0xfa7f('0x2'));var router=express[_0xfa7f('0x3')]();var auth=require(_0xfa7f('0x4'));var interaction=require(_0xfa7f('0x5'));var config=require('../../config/environment');var controller=require(_0xfa7f('0x6'));router[_0xfa7f('0x7')]('/',auth[_0xfa7f('0x8')](),controller[_0xfa7f('0x9')]);router[_0xfa7f('0x7')](_0xfa7f('0xa'),controller[_0xfa7f('0xb')]);router[_0xfa7f('0x7')](_0xfa7f('0xc'),auth[_0xfa7f('0x8')](),controller[_0xfa7f('0xd')]);router[_0xfa7f('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xfa7f('0xe')]);var upload=multer({'storage':multer[_0xfa7f('0xf')]({'destination':function(_0x46b71c,_0x5c9eb7,_0x39e083){_0x39e083(null,path[_0xfa7f('0x10')](config[_0xfa7f('0x11')],_0xfa7f('0x12')));},'filename':function(_0x1605d5,_0x15124a,_0x3c450d){_0x15124a[_0xfa7f('0x13')]=_0x15124a[_0xfa7f('0x13')][_0xfa7f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c450d(null,util[_0xfa7f('0x15')](_0xfa7f('0x16'),path[_0xfa7f('0x17')](_0x15124a['originalname'],path[_0xfa7f('0x18')](_0x15124a[_0xfa7f('0x13')])),Date[_0xfa7f('0x19')](),path[_0xfa7f('0x18')](_0x15124a[_0xfa7f('0x13')])));}})});router[_0xfa7f('0x1a')]('/',upload[_0xfa7f('0x1b')](_0xfa7f('0x1c')),controller[_0xfa7f('0x1d')]);router[_0xfa7f('0x1a')]('/webhook',controller[_0xfa7f('0x1e')]);router[_0xfa7f('0x1f')](_0xfa7f('0xc'),auth[_0xfa7f('0x8')](),controller['update']);router[_0xfa7f('0x20')](_0xfa7f('0xc'),auth['isAuthenticated'](),controller['delete']);module[_0xfa7f('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 97e41f7..bc64af9 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 _0xcf90=['TEXT','BOOLEAN','ENUM','adminOnly','always','never','sequelize','exports','STRING'];(function(_0x37a242,_0x380853){var _0x32867e=function(_0x5544cb){while(--_0x5544cb){_0x37a242['push'](_0x37a242['shift']());}};_0x32867e(++_0x380853);}(_0xcf90,0x1e3));var _0x0cf9=function(_0x6c4951,_0x33301b){_0x6c4951=_0x6c4951-0x0;var _0x1a2685=_0xcf90[_0x6c4951];return _0x1a2685;};'use strict';var Sequelize=require(_0x0cf9('0x0'));module[_0x0cf9('0x1')]={'name':{'type':Sequelize[_0x0cf9('0x2')]},'type':{'type':Sequelize['ENUM']('html','script')},'description':{'type':Sequelize[_0x0cf9('0x3')]},'version':{'type':Sequelize[_0x0cf9('0x3')]},'path':{'type':Sequelize[_0x0cf9('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x0cf9('0x4')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0cf9('0x5')](_0x0cf9('0x6'),'agentOnly',_0x0cf9('0x7'),_0x0cf9('0x8')),'defaultValue':_0x0cf9('0x7'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x0cf9('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x0cf9('0x2')]},'scriptName':{'type':Sequelize[_0x0cf9('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4071=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x5d14db,_0x11e7dc){var _0x29af20=function(_0x14a309){while(--_0x14a309){_0x5d14db['push'](_0x5d14db['shift']());}};_0x29af20(++_0x11e7dc);}(_0x4071,0x1b3));var _0x1407=function(_0x342039,_0x5352eb){_0x342039=_0x342039-0x0;var _0x279048=_0x4071[_0x342039];return _0x279048;};'use strict';var Sequelize=require('sequelize');module[_0x1407('0x0')]={'name':{'type':Sequelize[_0x1407('0x1')]},'type':{'type':Sequelize[_0x1407('0x2')]('html',_0x1407('0x3'))},'description':{'type':Sequelize[_0x1407('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x1407('0x1')],'comment':_0x1407('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1407('0x6')},'sidebar':{'type':Sequelize[_0x1407('0x2')](_0x1407('0x7'),_0x1407('0x8'),_0x1407('0x9'),_0x1407('0xa')),'defaultValue':'always','comment':_0x1407('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x1407('0x1')]},'scriptName':{'type':Sequelize[_0x1407('0x1')]},'scriptPath':{'type':Sequelize[_0x1407('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dff538a..89b69ac 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 _0x4be6=['parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','type','html','views','admin','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','send','Extracted\x20folder\x20removed','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','method','%s%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','name','map','Plugin','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','download','find','join','root','server/files/plugins','format','%s.zip','basename','path','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','0777','lstatSync','Invalid\x20plugin\x20structure','Plugin\x20manifest\x20missing','readFileSync','manifest.json'];(function(_0x44443,_0x3c82ec){var _0x3d7f15=function(_0x253a2d){while(--_0x253a2d){_0x44443['push'](_0x44443['shift']());}};_0x3d7f15(++_0x3c82ec);}(_0x4be6,0xe1));var _0x64be=function(_0x431807,_0x187385){_0x431807=_0x431807-0x0;var _0x51d062=_0x4be6[_0x431807];return _0x51d062;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x64be('0x0'));var rimraf=require(_0x64be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64be('0x2'));var rp=require(_0x64be('0x3'));var moment=require(_0x64be('0x4'));var BPromise=require(_0x64be('0x5'));var Mustache=require(_0x64be('0x6'));var util=require(_0x64be('0x7'));var path=require('path');var sox=require(_0x64be('0x8'));var csv=require(_0x64be('0x9'));var ejs=require(_0x64be('0xa'));var fs=require('fs');var _=require(_0x64be('0xb'));var squel=require(_0x64be('0xc'));var crypto=require('crypto');var jsforce=require(_0x64be('0xd'));var deskjs=require(_0x64be('0xe'));var toCsv=require(_0x64be('0x9'));var querystring=require(_0x64be('0xf'));var Papa=require(_0x64be('0x10'));var extract=require(_0x64be('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x64be('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x64be('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x64be('0x14'));var config=require(_0x64be('0x15'));var licenseUtil=require(_0x64be('0x16'));var db=require(_0x64be('0x17'))['db'];config['redis']=_[_0x64be('0x18')](config[_0x64be('0x19')],{'host':_0x64be('0x1a'),'port':0x18eb});var socket=require(_0x64be('0x1b'))(new Redis(config[_0x64be('0x19')]));require(_0x64be('0x1c'))[_0x64be('0x1d')](socket);function respondWithStatusCode(_0x5767d9,_0x12dd42){_0x12dd42=_0x12dd42||0xcc;return function(_0x4fcca2){if(_0x4fcca2){return _0x5767d9[_0x64be('0x1e')](_0x12dd42);}return _0x5767d9[_0x64be('0x1f')](_0x12dd42)[_0x64be('0x20')]();};}function respondWithResult(_0x1ecc08,_0x2fbac2){_0x2fbac2=_0x2fbac2||0xc8;return function(_0x23d714){if(_0x23d714){return _0x1ecc08['status'](_0x2fbac2)[_0x64be('0x21')](_0x23d714);}};}function respondWithFilteredResult(_0x241fc7,_0x447a71){return function(_0x2b4f96){if(_0x2b4f96){var _0x5251f3=_0x2b4f96['count'],_0x4e580b=_0x447a71['offset'],_0x182782=_0x447a71['offset']+_0x447a71[_0x64be('0x22')],_0x3ee73e;if(_0x182782>=_0x5251f3){_0x182782=_0x5251f3;_0x3ee73e=0xc8;}else{_0x3ee73e=0xce;}_0x241fc7['status'](_0x3ee73e);return _0x241fc7['set'](_0x64be('0x23'),_0x4e580b+'-'+_0x182782+'/'+_0x5251f3)['json'](_0x2b4f96);}return null;};}function patchUpdates(_0x5f0845){return function(_0x8e8563){try{jsonpatch[_0x64be('0x24')](_0x8e8563,_0x5f0845,!![]);}catch(_0x4a6ad4){return BPromise[_0x64be('0x25')](_0x4a6ad4);}return _0x8e8563[_0x64be('0x26')]();};}function saveUpdates(_0x380b09,_0x2ef559){return function(_0xe6693){if(_0xe6693){return _0xe6693['update'](_0x380b09)[_0x64be('0x27')](function(_0xc67e1){return _0xc67e1;});}return null;};}function removeEntity(_0x5af8cc,_0x32f7e6){return function(_0x156be9){if(_0x156be9){return _0x156be9[_0x64be('0x28')]()[_0x64be('0x27')](function(){var _0x264eb6=_0x156be9[_0x64be('0x29')]({'plain':!![]});var _0x2da750=_0x64be('0x2a');return db[_0x64be('0x2b')][_0x64be('0x28')]({'where':{'type':_0x2da750,'resourceId':_0x264eb6['id']}})['then'](function(){return _0x156be9;});})[_0x64be('0x27')](function(){_0x5af8cc[_0x64be('0x1f')](0xcc)[_0x64be('0x20')]();});}};}function handleEntityNotFound(_0x5417af,_0x2c07ea){return function(_0x38b0ea){if(!_0x38b0ea){_0x5417af[_0x64be('0x1e')](0x194);}return _0x38b0ea;};}function handleError(_0x3f244c,_0x104d09){_0x104d09=_0x104d09||0x1f4;return function(_0x5be1b7){logger['error'](_0x5be1b7['stack']);if(_0x5be1b7[_0x64be('0x2c')]){delete _0x5be1b7[_0x64be('0x2c')];}_0x3f244c[_0x64be('0x1f')](_0x104d09)['send'](_0x5be1b7);};}exports['index']=function(_0x4c651b,_0x32e246){var _0x101613={},_0x2299df={},_0x6bad77={'count':0x0,'rows':[]};var _0xb6447a=_[_0x64be('0x2d')](db[_0x64be('0x2e')]['rawAttributes'],function(_0x192a8b){return{'name':_0x192a8b[_0x64be('0x2f')],'type':_0x192a8b['type'][_0x64be('0x30')]};});_0x2299df['model']=_[_0x64be('0x2d')](_0xb6447a,'name');_0x2299df[_0x64be('0x31')]=_['keys'](_0x4c651b[_0x64be('0x31')]);_0x2299df[_0x64be('0x32')]=_[_0x64be('0x33')](_0x2299df[_0x64be('0x34')],_0x2299df[_0x64be('0x31')]);_0x101613['attributes']=_[_0x64be('0x33')](_0x2299df[_0x64be('0x34')],qs[_0x64be('0x35')](_0x4c651b['query']['fields']));_0x101613[_0x64be('0x36')]=_0x101613[_0x64be('0x36')][_0x64be('0x37')]?_0x101613[_0x64be('0x36')]:_0x2299df[_0x64be('0x34')];if(!_0x4c651b[_0x64be('0x31')][_0x64be('0x38')](_0x64be('0x39'))){_0x101613['limit']=qs['limit'](_0x4c651b[_0x64be('0x31')][_0x64be('0x22')]);_0x101613['offset']=qs[_0x64be('0x3a')](_0x4c651b[_0x64be('0x31')]['offset']);}_0x101613[_0x64be('0x3b')]=qs[_0x64be('0x3c')](_0x4c651b[_0x64be('0x31')]['sort']);_0x101613[_0x64be('0x3d')]=qs[_0x64be('0x32')](_[_0x64be('0x3e')](_0x4c651b['query'],_0x2299df[_0x64be('0x32')]),_0xb6447a);if(_0x4c651b[_0x64be('0x31')]['filter']){_0x101613[_0x64be('0x3d')]=_[_0x64be('0x3f')](_0x101613[_0x64be('0x3d')],{'$or':_['map'](_0xb6447a,function(_0x1be5cb){if(_0x1be5cb['type']!==_0x64be('0x40')){var _0x343f8b={};_0x343f8b[_0x1be5cb[_0x64be('0x2c')]]={'$like':'%'+_0x4c651b[_0x64be('0x31')][_0x64be('0x41')]+'%'};return _0x343f8b;}})});}_0x101613=_[_0x64be('0x3f')]({},_0x101613,_0x4c651b[_0x64be('0x42')]);var _0x184908={'where':_0x101613[_0x64be('0x3d')]};return db[_0x64be('0x2e')][_0x64be('0x43')](_0x184908)[_0x64be('0x27')](function(_0x11084c){_0x6bad77['count']=_0x11084c;if(_0x4c651b[_0x64be('0x31')]['includeAll']){_0x101613[_0x64be('0x44')]=[{'all':!![]}];}return db[_0x64be('0x2e')][_0x64be('0x45')](_0x101613);})[_0x64be('0x27')](function(_0x475fac){_0x6bad77[_0x64be('0x46')]=_0x475fac;return _0x6bad77;})[_0x64be('0x27')](respondWithFilteredResult(_0x32e246,_0x101613))[_0x64be('0x47')](handleError(_0x32e246,null));};exports[_0x64be('0x48')]=function(_0x4691d7,_0x13266c){var _0x4ad010={'raw':!![],'where':{'id':_0x4691d7[_0x64be('0x49')]['id']}},_0x327c51={};_0x327c51[_0x64be('0x34')]=_[_0x64be('0x4a')](db[_0x64be('0x2e')][_0x64be('0x4b')]);_0x327c51['query']=_['keys'](_0x4691d7[_0x64be('0x31')]);_0x327c51[_0x64be('0x32')]=_['intersection'](_0x327c51[_0x64be('0x34')],_0x327c51[_0x64be('0x31')]);_0x4ad010['attributes']=_[_0x64be('0x33')](_0x327c51[_0x64be('0x34')],qs[_0x64be('0x35')](_0x4691d7[_0x64be('0x31')]['fields']));_0x4ad010['attributes']=_0x4ad010[_0x64be('0x36')][_0x64be('0x37')]?_0x4ad010['attributes']:_0x327c51[_0x64be('0x34')];if(_0x4691d7[_0x64be('0x31')][_0x64be('0x4c')]){_0x4ad010[_0x64be('0x44')]=[{'all':!![]}];}_0x4ad010=_[_0x64be('0x3f')]({},_0x4ad010,_0x4691d7[_0x64be('0x42')]);return db[_0x64be('0x2e')]['find'](_0x4ad010)[_0x64be('0x27')](handleEntityNotFound(_0x13266c,null))[_0x64be('0x27')](respondWithResult(_0x13266c,null))[_0x64be('0x47')](handleError(_0x13266c,null));};exports[_0x64be('0x4d')]=function(_0x475e9e,_0x215c16,_0x5ec2fb){return db[_0x64be('0x2e')][_0x64be('0x4e')]({'where':{'id':_0x475e9e[_0x64be('0x49')]['id']},'attributes':[_0x64be('0x2c'),'path'],'raw':!![]})[_0x64be('0x27')](handleEntityNotFound(_0x215c16,null))[_0x64be('0x27')](function(_0x24dbe8){if(_0x24dbe8){var _0x5170fa=path[_0x64be('0x4f')](config[_0x64be('0x50')],_0x64be('0x51'),util[_0x64be('0x52')](_0x64be('0x53'),path[_0x64be('0x54')](_0x24dbe8[_0x64be('0x55')])));var _0xb9f2b5=fs[_0x64be('0x56')](_0x5170fa);var _0x1e1032=archiver(_0x64be('0x57'),{'zlib':{'level':0x9}});_0x1e1032['on'](_0x64be('0x58'),function(_0x1c2a2c){if(_0x1c2a2c[_0x64be('0x59')]==='ENOENT'){logger[_0x64be('0x5a')](_0x1c2a2c);}else{throw new db[(_0x64be('0x5b'))][(_0x64be('0x5c'))](_0x64be('0x5d'));}});_0x1e1032['on'](_0x64be('0x5a'),function(_0x347daa){throw new db[(_0x64be('0x5b'))][(_0x64be('0x5c'))](_0x64be('0x5d'));});_0x1e1032[_0x64be('0x5e')](_0xb9f2b5);_0x1e1032[_0x64be('0x5f')](_0x64be('0x60'),{'cwd':path[_0x64be('0x4f')](config[_0x64be('0x50')],'server/files/plugins',path['dirname'](_0x24dbe8[_0x64be('0x55')])),'ignore':[path[_0x64be('0x4f')](path['basename'](_0x24dbe8['path']),_0x64be('0x61')),path['join'](path[_0x64be('0x54')](_0x24dbe8['path']),_0x64be('0x62'))],'nodir':!![]})[_0x64be('0x63')]();_0xb9f2b5['on']('close',function(){if(!fs[_0x64be('0x64')](_0x5170fa)){throw new db[(_0x64be('0x5b'))][(_0x64be('0x5c'))](_0x64be('0x65'));}return _0x215c16[_0x64be('0x4d')](_0x5170fa,util['format'](_0x64be('0x53'),path[_0x64be('0x54')](_0x24dbe8[_0x64be('0x55')])),function(_0x54fe25){if(_0x54fe25){throw new db[(_0x64be('0x5b'))][(_0x64be('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x64be('0x66')](_0x5170fa);logger[_0x64be('0x67')](_0x64be('0x68'));logger['info'](_0x64be('0x69'));});});}return null;})[_0x64be('0x47')](handleError(_0x215c16,null));};exports[_0x64be('0x6a')]=function(_0x3b8085,_0x4083f1,_0x4a207f){var _0x5dd3f5=path['basename'](_0x3b8085['file']['filename'],path[_0x64be('0x6b')](_0x3b8085[_0x64be('0x6c')][_0x64be('0x6d')]));var _0x47564a=path[_0x64be('0x4f')](config[_0x64be('0x50')],_0x64be('0x51'),_0x3b8085['file'][_0x64be('0x6d')]);var _0x173755=path[_0x64be('0x4f')](config[_0x64be('0x50')],_0x64be('0x51'),_0x5dd3f5);logger['info'](_0x64be('0x6e'),_0x47564a);logger[_0x64be('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x173755);try{fs['chmodSync'](_0x47564a,parseInt(_0x64be('0x6f'),0x8));extract(_0x47564a,{'dir':_0x173755},function(_0x3b2905){if(_0x3b2905){logger[_0x64be('0x5a')](_0x3b2905);handleError(_0x3b2905,!![]);};var _0x1e8cb8=fs['readdirSync'](_0x173755);if(_0x1e8cb8['length']>0x1){removeReferences(_0x47564a,_0x173755);logger[_0x64be('0x5a')]('Invalid\x20plugin\x20structure');return _0x4a207f(new Error('Invalid\x20plugin\x20structure'));}var _0x43cd4f=fs[_0x64be('0x70')](path[_0x64be('0x4f')](_0x173755,_0x1e8cb8[0x0]));if(_0x43cd4f['isFile']()){removeReferences(_0x47564a,_0x173755);logger['error']('Invalid\x20plugin\x20structure');return _0x4a207f(new Error('Invalid\x20plugin\x20structure'));}if(_0x43cd4f['isDirectory']()){var _0x2ee0d9=fs['readdirSync'](path[_0x64be('0x4f')](_0x173755,_0x1e8cb8[0x0]));if(_0x2ee0d9['length']===0x0){removeReferences(_0x47564a,_0x173755);logger['error'](_0x64be('0x71'));return _0x4a207f(new Error(_0x64be('0x71')));}var _0x31745e=_0x2ee0d9['some'](function(_0x38d985){return _0x38d985==='manifest.json';});if(!_0x31745e){return _0x4a207f(new Error(_0x64be('0x72')));}var _0x6706=fs[_0x64be('0x73')](path['join'](_0x173755,_0x1e8cb8[0x0],_0x64be('0x74')));var _0x7e9e13=JSON[_0x64be('0x75')](_0x6706);if(_0x64be('0x76')==typeof _0x7e9e13[_0x64be('0x2c')]){return _0x4a207f(new Error(_0x64be('0x77')));}if(_0x64be('0x76')==typeof _0x7e9e13['type']){return _0x4a207f(new Error(_0x64be('0x78')));}if(_0x64be('0x76')==typeof _0x7e9e13[_0x64be('0x79')]){return _0x4a207f(new Error(_0x64be('0x7a')));}if(_0x64be('0x76')==typeof _0x7e9e13['parameters']){return _0x4a207f(new Error(_0x64be('0x7b')));}if(_0x7e9e13[_0x64be('0x7c')]===_0x64be('0x7d')){if(_0x64be('0x76')==typeof _0x7e9e13['parameters'][_0x64be('0x7e')]){return _0x4a207f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x64be('0x76')==typeof _0x7e9e13['parameters'][_0x64be('0x7e')][_0x64be('0x7f')]&&_0x64be('0x76')==typeof _0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')][_0x64be('0x81')]){return _0x4a207f(new Error(_0x64be('0x82')));}}else if(_0x7e9e13[_0x64be('0x7c')]===_0x64be('0x83')){if('undefined'==typeof _0x7e9e13[_0x64be('0x80')][_0x64be('0x84')]){return _0x4a207f(new Error(_0x64be('0x85')));}if(_0x64be('0x76')==typeof _0x7e9e13['parameters'][_0x64be('0x86')]){return _0x4a207f(new Error(_0x64be('0x87')));}}else{return _0x4a207f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x22b2e9=_0x7e9e13['name'];var _0x3c9a69=_0x7e9e13['description'];var _0x24048c=_0x7e9e13[_0x64be('0x7c')];var _0x36b9e6=_0x7e9e13[_0x64be('0x88')]?_0x7e9e13[_0x64be('0x88')]:_0x64be('0x89');var _0x56003f=_0x7e9e13[_0x64be('0x8a')]?_0x7e9e13['icon']:_0x64be('0x8b');var _0x12634d='';var _0x4c3a04='';var _0x195b50='';var _0x4bba79='';var _0x26905d=_0x7e9e13[_0x64be('0x79')];if(_0x24048c===_0x64be('0x7d')){if(_0x64be('0x76')!=typeof _0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')]['admin']){var _0x55dc97=_0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x64be('0x8c')](_0x55dc97)){_0x12634d=path[_0x64be('0x4f')](_0x64be('0x8d'),_0x5dd3f5,_0x1e8cb8[0x0],_0x55dc97);}else{_0x12634d=_0x55dc97;}}else{logger[_0x64be('0x67')](_0x64be('0x8e'));}if(_0x64be('0x76')!=typeof _0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')][_0x64be('0x81')]){var _0x487e93=_0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x64be('0x8c')](_0x487e93)){_0x4c3a04=path[_0x64be('0x4f')](_0x64be('0x8d'),_0x5dd3f5,_0x1e8cb8[0x0],_0x487e93);}else{_0x4c3a04=_0x487e93;}}else{logger['info'](_0x64be('0x8f'));}}else if(_0x24048c===_0x64be('0x83')){_0x195b50=_0x7e9e13[_0x64be('0x80')][_0x64be('0x84')];_0x4bba79=_0x7e9e13['parameters'][_0x64be('0x86')];if('undefined'!=typeof _0x7e9e13['parameters'][_0x64be('0x7e')]){if(_0x64be('0x76')!=typeof _0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')][_0x64be('0x7f')]){var _0x55dc97=_0x7e9e13[_0x64be('0x80')][_0x64be('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x64be('0x8c')](_0x55dc97)){_0x12634d=path[_0x64be('0x4f')](_0x64be('0x8d'),_0x5dd3f5,_0x1e8cb8[0x0],_0x55dc97);}else{_0x12634d=_0x55dc97;}}if('undefined'!=typeof _0x7e9e13['parameters']['views'][_0x64be('0x81')]){var _0x487e93=_0x7e9e13['parameters'][_0x64be('0x7e')][_0x64be('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x64be('0x8c')](_0x487e93)){_0x4c3a04=path[_0x64be('0x4f')](_0x64be('0x8d'),_0x5dd3f5,_0x1e8cb8[0x0],_0x487e93);}else{_0x4c3a04=_0x487e93;}}}}var _0x1a40ba={'name':_0x22b2e9,'description':_0x3c9a69,'path':path[_0x64be('0x4f')](_0x5dd3f5,_0x1e8cb8[0x0]),'type':_0x24048c,'sidebar':_0x36b9e6,'icon':_0x56003f,'adminUrl':_0x12634d,'agentUrl':_0x4c3a04,'scriptName':_0x195b50,'scriptPath':_0x4bba79,'version':_0x26905d};removeReferences(_0x47564a,null);return db[_0x64be('0x2e')]['create'](_0x1a40ba)[_0x64be('0x27')](function(_0x213666){var _0x2fb5c8={'role':_0x3b8085[_0x64be('0x90')]['role'],'userProfileId':_0x3b8085[_0x64be('0x90')][_0x64be('0x91')]};if(!_0x2fb5c8)throw new Error(_0x64be('0x92'));if(_0x2fb5c8[_0x64be('0x93')]===_0x64be('0x94')){var _0x44e562=_0x213666['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x64be('0x2a'),'userProfileId':_0x2fb5c8[_0x64be('0x91')]},'raw':!![]})[_0x64be('0x27')](function(_0x480e6c){if(_0x480e6c&&_0x480e6c[_0x64be('0x95')]===0x0){return db[_0x64be('0x2b')]['create']({'name':_0x44e562[_0x64be('0x2c')],'resourceId':_0x44e562['id'],'type':_0x480e6c[_0x64be('0x2c')],'sectionId':_0x480e6c['id']},{})[_0x64be('0x27')](function(){return _0x213666;});}else{return _0x213666;}})[_0x64be('0x47')](function(_0x5365a9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5365a9);throw _0x5365a9;});}return _0x213666;})[_0x64be('0x27')](respondWithResult(_0x4083f1,null))[_0x64be('0x47')](handleError(_0x4083f1,null));}});}catch(_0x3b8482){_0x4083f1[_0x64be('0x1f')](0x1f4)[_0x64be('0x96')](_0x3b8482);}};function removeReferences(_0x4110d9,_0x446ec3){try{if(_0x4110d9){fs['unlinkSync'](_0x4110d9);logger['info']('Zip\x20archive\x20removed');}if(_0x446ec3){rimraf(_0x446ec3,function(){});logger[_0x64be('0x67')](_0x64be('0x97'));}}catch(_0x1c888b){logger[_0x64be('0x5a')](_0x1c888b);}}exports['update']=function(_0x4d60c1,_0x1363af,_0x2e0dcb){return db[_0x64be('0x2e')][_0x64be('0x4e')]({'where':{'id':_0x4d60c1[_0x64be('0x49')]['id']}})[_0x64be('0x27')](handleEntityNotFound(_0x1363af,null))['then'](saveUpdates(_0x4d60c1[_0x64be('0x90')],null))[_0x64be('0x27')](respondWithResult(_0x1363af,null))[_0x64be('0x47')](handleError(_0x1363af,null));};exports[_0x64be('0x98')]=function(_0xd8582b,_0xe99495,_0x59160b){return db[_0x64be('0x2e')]['find']({'where':{'id':_0xd8582b[_0x64be('0x49')]['id']}})[_0x64be('0x27')](function(_0x26225e){if(_0x26225e){return _0x26225e['destroy']();}})[_0x64be('0x27')](function(_0x5d81d3){rimraf(path['join'](config[_0x64be('0x50')],'server/files/plugins',path[_0x64be('0x99')](_0x5d81d3[_0x64be('0x55')])),function(){});return _0x5d81d3;})[_0x64be('0x27')](handleEntityNotFound(_0xe99495,null))[_0x64be('0x27')](respondWithStatusCode(_0xe99495,null))[_0x64be('0x47')](handleError(_0xe99495,null));};exports[_0x64be('0x9a')]=function(_0x42446d,_0x229826,_0x1aa0b7){return BPromise['resolve']()[_0x64be('0x27')](function(){if(!_0x42446d['query'][_0x64be('0x55')]){throw new Error(_0x64be('0x9b'));}if(!_0x42446d[_0x64be('0x31')][_0x64be('0x9c')]){throw new Error(_0x64be('0x9d'));}var _0x45f239=_0x42446d['query'][_0x64be('0x9e')]?_0x42446d[_0x64be('0x31')][_0x64be('0x9e')]+':'+_0x42446d[_0x64be('0x31')][_0x64be('0x9c')]:_0x64be('0x9f')+_0x42446d[_0x64be('0x31')]['port'];var _0x4364b1=_0x42446d['query'][_0x64be('0x21')]?_0x42446d[_0x64be('0x31')]['json']:!![];var _0xa2015a=_0x42446d[_0x64be('0x31')][_0x64be('0xa0')]?_0x42446d[_0x64be('0x31')][_0x64be('0xa0')]:null;var _0x780a90={'method':_0x42446d['method'],'uri':util[_0x64be('0x52')]('%s%s',_0x45f239,_0x42446d[_0x64be('0x31')]['path']),'json':_0x4364b1,'resolveWithFullResponse':!![],'encoding':_0xa2015a,'qs':_0x42446d[_0x64be('0x31')]};if(_0x42446d[_0x64be('0xa1')]){_0x780a90[_0x64be('0xa1')]=_0x42446d[_0x64be('0xa1')];if(_0x780a90['headers']['content-length']){delete _0x780a90['headers'][_0x64be('0xa2')];}}if(_0x780a90[_0x64be('0xa1')]['content-type']){delete _0x780a90[_0x64be('0xa1')][_0x64be('0xa3')];}return rp(_0x780a90);})[_0x64be('0x27')](function(_0x248ada){if(_0x248ada){_0x229826[_0x64be('0xa4')](_0x248ada[_0x64be('0xa1')]);logger[_0x64be('0x67')](_0x248ada[_0x64be('0x90')]);if(_[_0x64be('0xa5')](_0x42446d[_0x64be('0x31')][_0x64be('0x55')],_0x64be('0x4d'))&&_0x248ada[_0x64be('0xa6')]==0x1f4){return _0x229826['sendStatus'](_0x248ada[_0x64be('0xa6')]);}else{return _0x229826[_0x64be('0x1f')](_0x248ada[_0x64be('0xa6')])[_0x64be('0x96')](_0x248ada['body']);}}else{return _0x229826[_0x64be('0x1e')](0xc8);}})[_0x64be('0x47')](handleError(_0x229826,null));};exports[_0x64be('0xa7')]=function(_0x1db004,_0x34f568,_0x5349ab){return BPromise[_0x64be('0xa8')]()[_0x64be('0x27')](function(){if(!_0x1db004['query'][_0x64be('0x55')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1db004[_0x64be('0x31')][_0x64be('0x9c')]){throw new Error(_0x64be('0x9d'));}var _0x462032=_0x1db004['query'][_0x64be('0x9e')]?_0x1db004[_0x64be('0x31')][_0x64be('0x9e')]+':'+_0x1db004['query'][_0x64be('0x9c')]:'http://localhost:'+_0x1db004['query'][_0x64be('0x9c')];var _0x59f85b=_0x1db004[_0x64be('0x31')]['json']?_0x1db004[_0x64be('0x31')]['json']:!![];var _0x12b4d2=_0x1db004[_0x64be('0x31')][_0x64be('0xa0')]?_0x1db004['query']['encoding']:null;var _0x1382b5={'method':_0x1db004[_0x64be('0xa9')],'uri':util[_0x64be('0x52')](_0x64be('0xaa'),_0x462032,_0x1db004[_0x64be('0x31')][_0x64be('0x55')]),'json':_0x59f85b,'resolveWithFullResponse':!![],'encoding':_0x12b4d2,'body':_0x1db004['body']};if(_0x1db004[_0x64be('0xa1')]){_0x1382b5[_0x64be('0xa1')]=_0x1db004['headers'];if(_0x1382b5[_0x64be('0xa1')][_0x64be('0xa2')]){delete _0x1382b5['headers'][_0x64be('0xa2')];}}if(_0x1382b5[_0x64be('0xa1')]['content-type']){delete _0x1382b5[_0x64be('0xa1')][_0x64be('0xa3')];}return rp(_0x1382b5);})[_0x64be('0x27')](function(_0x13f8ed){if(_0x13f8ed){_0x34f568[_0x64be('0xa4')](_0x13f8ed[_0x64be('0xa1')]);logger['info'](_0x13f8ed['body']);return _0x34f568['status'](_0x13f8ed[_0x64be('0xa6')])[_0x64be('0x96')](_0x13f8ed['body']);}else{return _0x34f568[_0x64be('0x1e')](0xc8);}})[_0x64be('0x47')](handleError(_0x34f568,null));}; \ No newline at end of file +var _0x8d39=['webhookPost','method','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','params','join','root','format','basename','createWriteStream','zip','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','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','download','statusCode'];(function(_0x105e01,_0x199717){var _0x421f22=function(_0x5b1103){while(--_0x5b1103){_0x105e01['push'](_0x105e01['shift']());}};_0x421f22(++_0x199717);}(_0x8d39,0x16c));var _0x98d3=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x8d39[_0x1e4150];return _0x1ce3ee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x98d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98d3('0x1'));var jsonpatch=require(_0x98d3('0x2'));var rp=require(_0x98d3('0x3'));var moment=require(_0x98d3('0x4'));var BPromise=require(_0x98d3('0x5'));var Mustache=require(_0x98d3('0x6'));var util=require('util');var path=require(_0x98d3('0x7'));var sox=require(_0x98d3('0x8'));var csv=require('to-csv');var ejs=require(_0x98d3('0x9'));var fs=require('fs');var _=require(_0x98d3('0xa'));var squel=require(_0x98d3('0xb'));var crypto=require(_0x98d3('0xc'));var jsforce=require(_0x98d3('0xd'));var deskjs=require(_0x98d3('0xe'));var toCsv=require(_0x98d3('0xf'));var querystring=require(_0x98d3('0x10'));var Papa=require(_0x98d3('0x11'));var extract=require(_0x98d3('0x12'));var rimraf=require('rimraf');var archiver=require(_0x98d3('0x13'));var Redis=require(_0x98d3('0x14'));var authService=require(_0x98d3('0x15'));var qs=require(_0x98d3('0x16'));var as=require(_0x98d3('0x17'));var hardwareService=require(_0x98d3('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x98d3('0x19'));var config=require(_0x98d3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x98d3('0x1b'))['db'];config[_0x98d3('0x1c')]=_[_0x98d3('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x98d3('0x1e'))(new Redis(config[_0x98d3('0x1c')]));require(_0x98d3('0x1f'))[_0x98d3('0x20')](socket);function respondWithStatusCode(_0x2c1ecc,_0x4a5ce6){_0x4a5ce6=_0x4a5ce6||0xcc;return function(_0x5f3f20){if(_0x5f3f20){return _0x2c1ecc[_0x98d3('0x21')](_0x4a5ce6);}return _0x2c1ecc[_0x98d3('0x22')](_0x4a5ce6)[_0x98d3('0x23')]();};}function respondWithResult(_0x5e5e87,_0x19663f){_0x19663f=_0x19663f||0xc8;return function(_0x367309){if(_0x367309){return _0x5e5e87[_0x98d3('0x22')](_0x19663f)[_0x98d3('0x24')](_0x367309);}};}function respondWithFilteredResult(_0x37b390,_0x1147df){return function(_0x5dfeab){if(_0x5dfeab){var _0x2d0fea=_0x5dfeab[_0x98d3('0x25')],_0x2a3f56=_0x1147df[_0x98d3('0x26')],_0xf47da8=_0x1147df[_0x98d3('0x26')]+_0x1147df[_0x98d3('0x27')],_0x11fcb2;if(_0xf47da8>=_0x2d0fea){_0xf47da8=_0x2d0fea;_0x11fcb2=0xc8;}else{_0x11fcb2=0xce;}_0x37b390[_0x98d3('0x22')](_0x11fcb2);return _0x37b390['set'](_0x98d3('0x28'),_0x2a3f56+'-'+_0xf47da8+'/'+_0x2d0fea)[_0x98d3('0x24')](_0x5dfeab);}return null;};}function patchUpdates(_0x2dd379){return function(_0x1d54b2){try{jsonpatch[_0x98d3('0x29')](_0x1d54b2,_0x2dd379,!![]);}catch(_0x50138c){return BPromise[_0x98d3('0x2a')](_0x50138c);}return _0x1d54b2[_0x98d3('0x2b')]();};}function saveUpdates(_0x269f7b,_0x592269){return function(_0x289dd1){if(_0x289dd1){return _0x289dd1[_0x98d3('0x2c')](_0x269f7b)['then'](function(_0x35a527){return _0x35a527;});}return null;};}function removeEntity(_0x5c49e1,_0x1ad9a9){return function(_0xc410cd){if(_0xc410cd){return _0xc410cd[_0x98d3('0x2d')]()[_0x98d3('0x2e')](function(){var _0x3812b0=_0xc410cd[_0x98d3('0x2f')]({'plain':!![]});var _0x581706='Plugins';return db['UserProfileResource'][_0x98d3('0x2d')]({'where':{'type':_0x581706,'resourceId':_0x3812b0['id']}})[_0x98d3('0x2e')](function(){return _0xc410cd;});})[_0x98d3('0x2e')](function(){_0x5c49e1[_0x98d3('0x22')](0xcc)[_0x98d3('0x23')]();});}};}function handleEntityNotFound(_0x44996a,_0x56c85b){return function(_0x5e8e13){if(!_0x5e8e13){_0x44996a[_0x98d3('0x21')](0x194);}return _0x5e8e13;};}function handleError(_0x5e3af6,_0x5f520d){_0x5f520d=_0x5f520d||0x1f4;return function(_0x2df9c0){logger[_0x98d3('0x30')](_0x2df9c0[_0x98d3('0x31')]);if(_0x2df9c0[_0x98d3('0x32')]){delete _0x2df9c0[_0x98d3('0x32')];}_0x5e3af6[_0x98d3('0x22')](_0x5f520d)[_0x98d3('0x33')](_0x2df9c0);};}exports[_0x98d3('0x34')]=function(_0x5c14cf,_0x3e4b0e){var _0x2fbedc={},_0x188358={},_0x1685ce={'count':0x0,'rows':[]};var _0x5e21bd=_[_0x98d3('0x35')](db[_0x98d3('0x36')][_0x98d3('0x37')],function(_0x50c18b){return{'name':_0x50c18b[_0x98d3('0x38')],'type':_0x50c18b[_0x98d3('0x39')][_0x98d3('0x3a')]};});_0x188358['model']=_[_0x98d3('0x35')](_0x5e21bd,_0x98d3('0x32'));_0x188358['query']=_[_0x98d3('0x3b')](_0x5c14cf['query']);_0x188358[_0x98d3('0x3c')]=_[_0x98d3('0x3d')](_0x188358[_0x98d3('0x3e')],_0x188358[_0x98d3('0x3f')]);_0x2fbedc[_0x98d3('0x40')]=_[_0x98d3('0x3d')](_0x188358[_0x98d3('0x3e')],qs['fields'](_0x5c14cf[_0x98d3('0x3f')][_0x98d3('0x41')]));_0x2fbedc[_0x98d3('0x40')]=_0x2fbedc['attributes'][_0x98d3('0x42')]?_0x2fbedc[_0x98d3('0x40')]:_0x188358[_0x98d3('0x3e')];if(!_0x5c14cf['query'][_0x98d3('0x43')]('nolimit')){_0x2fbedc['limit']=qs['limit'](_0x5c14cf[_0x98d3('0x3f')][_0x98d3('0x27')]);_0x2fbedc[_0x98d3('0x26')]=qs[_0x98d3('0x26')](_0x5c14cf[_0x98d3('0x3f')]['offset']);}_0x2fbedc[_0x98d3('0x44')]=qs['sort'](_0x5c14cf[_0x98d3('0x3f')]['sort']);_0x2fbedc[_0x98d3('0x45')]=qs[_0x98d3('0x3c')](_[_0x98d3('0x46')](_0x5c14cf['query'],_0x188358[_0x98d3('0x3c')]),_0x5e21bd);if(_0x5c14cf[_0x98d3('0x3f')][_0x98d3('0x47')]){_0x2fbedc['where']=_[_0x98d3('0x48')](_0x2fbedc[_0x98d3('0x45')],{'$or':_[_0x98d3('0x35')](_0x5e21bd,function(_0x2bb6b7){if(_0x2bb6b7[_0x98d3('0x39')]!=='VIRTUAL'){var _0x1b3d73={};_0x1b3d73[_0x2bb6b7['name']]={'$like':'%'+_0x5c14cf[_0x98d3('0x3f')]['filter']+'%'};return _0x1b3d73;}})});}_0x2fbedc=_[_0x98d3('0x48')]({},_0x2fbedc,_0x5c14cf[_0x98d3('0x49')]);var _0x179786={'where':_0x2fbedc[_0x98d3('0x45')]};return db['Plugin'][_0x98d3('0x25')](_0x179786)[_0x98d3('0x2e')](function(_0x17d3bc){_0x1685ce[_0x98d3('0x25')]=_0x17d3bc;if(_0x5c14cf[_0x98d3('0x3f')][_0x98d3('0x4a')]){_0x2fbedc[_0x98d3('0x4b')]=[{'all':!![]}];}return db[_0x98d3('0x36')][_0x98d3('0x4c')](_0x2fbedc);})[_0x98d3('0x2e')](function(_0x25bcaa){_0x1685ce[_0x98d3('0x4d')]=_0x25bcaa;return _0x1685ce;})[_0x98d3('0x2e')](respondWithFilteredResult(_0x3e4b0e,_0x2fbedc))[_0x98d3('0x4e')](handleError(_0x3e4b0e,null));};exports['show']=function(_0x2c95df,_0x2d10cf){var _0x379417={'raw':!![],'where':{'id':_0x2c95df['params']['id']}},_0x36ebaf={};_0x36ebaf[_0x98d3('0x3e')]=_[_0x98d3('0x3b')](db['Plugin'][_0x98d3('0x37')]);_0x36ebaf[_0x98d3('0x3f')]=_[_0x98d3('0x3b')](_0x2c95df[_0x98d3('0x3f')]);_0x36ebaf['filters']=_[_0x98d3('0x3d')](_0x36ebaf[_0x98d3('0x3e')],_0x36ebaf[_0x98d3('0x3f')]);_0x379417[_0x98d3('0x40')]=_[_0x98d3('0x3d')](_0x36ebaf[_0x98d3('0x3e')],qs['fields'](_0x2c95df[_0x98d3('0x3f')][_0x98d3('0x41')]));_0x379417[_0x98d3('0x40')]=_0x379417[_0x98d3('0x40')][_0x98d3('0x42')]?_0x379417[_0x98d3('0x40')]:_0x36ebaf[_0x98d3('0x3e')];if(_0x2c95df[_0x98d3('0x3f')]['includeAll']){_0x379417[_0x98d3('0x4b')]=[{'all':!![]}];}_0x379417=_[_0x98d3('0x48')]({},_0x379417,_0x2c95df[_0x98d3('0x49')]);return db['Plugin'][_0x98d3('0x4f')](_0x379417)[_0x98d3('0x2e')](handleEntityNotFound(_0x2d10cf,null))[_0x98d3('0x2e')](respondWithResult(_0x2d10cf,null))[_0x98d3('0x4e')](handleError(_0x2d10cf,null));};exports['download']=function(_0x28483f,_0x59552f,_0x3a7305){return db[_0x98d3('0x36')][_0x98d3('0x4f')]({'where':{'id':_0x28483f[_0x98d3('0x50')]['id']},'attributes':[_0x98d3('0x32'),_0x98d3('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x59552f,null))['then'](function(_0x134e4a){if(_0x134e4a){var _0x422115=path[_0x98d3('0x51')](config[_0x98d3('0x52')],'server/files/plugins',util[_0x98d3('0x53')]('%s.zip',path[_0x98d3('0x54')](_0x134e4a[_0x98d3('0x7')])));var _0x551aa8=fs[_0x98d3('0x55')](_0x422115);var _0xb8f294=archiver(_0x98d3('0x56'),{'zlib':{'level':0x9}});_0xb8f294['on'](_0x98d3('0x57'),function(_0x2f0ca6){if(_0x2f0ca6[_0x98d3('0x58')]===_0x98d3('0x59')){logger[_0x98d3('0x30')](_0x2f0ca6);}else{throw new db[(_0x98d3('0x5a'))][(_0x98d3('0x5b'))](_0x98d3('0x5c'));}});_0xb8f294['on'](_0x98d3('0x30'),function(_0x97ee10){throw new db[(_0x98d3('0x5a'))][(_0x98d3('0x5b'))](_0x98d3('0x5c'));});_0xb8f294[_0x98d3('0x5d')](_0x551aa8);_0xb8f294[_0x98d3('0x5e')](_0x98d3('0x5f'),{'cwd':path[_0x98d3('0x51')](config[_0x98d3('0x52')],_0x98d3('0x60'),path[_0x98d3('0x61')](_0x134e4a[_0x98d3('0x7')])),'ignore':[path[_0x98d3('0x51')](path[_0x98d3('0x54')](_0x134e4a[_0x98d3('0x7')]),_0x98d3('0x62')),path[_0x98d3('0x51')](path[_0x98d3('0x54')](_0x134e4a[_0x98d3('0x7')]),_0x98d3('0x63'))],'nodir':!![]})[_0x98d3('0x64')]();_0x551aa8['on'](_0x98d3('0x65'),function(){if(!fs[_0x98d3('0x66')](_0x422115)){throw new db[(_0x98d3('0x5a'))]['Error'](_0x98d3('0x67'));}return _0x59552f['download'](_0x422115,util[_0x98d3('0x53')](_0x98d3('0x68'),path[_0x98d3('0x54')](_0x134e4a[_0x98d3('0x7')])),function(_0x2fdcca){if(_0x2fdcca){throw new db[(_0x98d3('0x5a'))][(_0x98d3('0x5b'))](_0x98d3('0x69'));}fs[_0x98d3('0x6a')](_0x422115);logger[_0x98d3('0x6b')]('Download\x20completed');logger[_0x98d3('0x6b')](_0x98d3('0x6c'));});});}return null;})[_0x98d3('0x4e')](handleError(_0x59552f,null));};exports[_0x98d3('0x6d')]=function(_0x2b0c4e,_0x515609,_0x2edb06){var _0x5c65a3=path[_0x98d3('0x54')](_0x2b0c4e[_0x98d3('0x6e')][_0x98d3('0x6f')],path[_0x98d3('0x70')](_0x2b0c4e['file'][_0x98d3('0x6f')]));var _0x2a35e5=path[_0x98d3('0x51')](config[_0x98d3('0x52')],'server/files/plugins',_0x2b0c4e[_0x98d3('0x6e')]['filename']);var _0x43cea3=path[_0x98d3('0x51')](config[_0x98d3('0x52')],_0x98d3('0x60'),_0x5c65a3);logger[_0x98d3('0x6b')](_0x98d3('0x71'),_0x2a35e5);logger['info'](_0x98d3('0x72'),_0x43cea3);try{fs[_0x98d3('0x73')](_0x2a35e5,parseInt(_0x98d3('0x74'),0x8));extract(_0x2a35e5,{'dir':_0x43cea3},function(_0x335b63){if(_0x335b63){logger['error'](_0x335b63);handleError(_0x335b63,!![]);};var _0x267b7a=fs['readdirSync'](_0x43cea3);if(_0x267b7a[_0x98d3('0x42')]>0x1){removeReferences(_0x2a35e5,_0x43cea3);logger[_0x98d3('0x30')]('Invalid\x20plugin\x20structure');return _0x2edb06(new Error(_0x98d3('0x75')));}var _0x5d9069=fs[_0x98d3('0x76')](path[_0x98d3('0x51')](_0x43cea3,_0x267b7a[0x0]));if(_0x5d9069[_0x98d3('0x77')]()){removeReferences(_0x2a35e5,_0x43cea3);logger['error'](_0x98d3('0x75'));return _0x2edb06(new Error(_0x98d3('0x75')));}if(_0x5d9069[_0x98d3('0x78')]()){var _0xd66774=fs['readdirSync'](path['join'](_0x43cea3,_0x267b7a[0x0]));if(_0xd66774[_0x98d3('0x42')]===0x0){removeReferences(_0x2a35e5,_0x43cea3);logger[_0x98d3('0x30')](_0x98d3('0x75'));return _0x2edb06(new Error(_0x98d3('0x75')));}var _0x470c86=_0xd66774['some'](function(_0x3c6fbf){return _0x3c6fbf==='manifest.json';});if(!_0x470c86){return _0x2edb06(new Error(_0x98d3('0x79')));}var _0x1749bf=fs[_0x98d3('0x7a')](path[_0x98d3('0x51')](_0x43cea3,_0x267b7a[0x0],_0x98d3('0x7b')));var _0xd48f6e=JSON['parse'](_0x1749bf);if(_0x98d3('0x7c')==typeof _0xd48f6e[_0x98d3('0x32')]){return _0x2edb06(new Error(_0x98d3('0x7d')));}if('undefined'==typeof _0xd48f6e[_0x98d3('0x39')]){return _0x2edb06(new Error(_0x98d3('0x7e')));}if(_0x98d3('0x7c')==typeof _0xd48f6e['version']){return _0x2edb06(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x98d3('0x7c')==typeof _0xd48f6e['parameters']){return _0x2edb06(new Error(_0x98d3('0x7f')));}if(_0xd48f6e[_0x98d3('0x39')]===_0x98d3('0x80')){if(_0x98d3('0x7c')==typeof _0xd48f6e[_0x98d3('0x81')][_0x98d3('0x82')]){return _0x2edb06(new Error(_0x98d3('0x83')));}if('undefined'==typeof _0xd48f6e[_0x98d3('0x81')][_0x98d3('0x82')][_0x98d3('0x84')]&&_0x98d3('0x7c')==typeof _0xd48f6e['parameters'][_0x98d3('0x82')][_0x98d3('0x85')]){return _0x2edb06(new Error(_0x98d3('0x86')));}}else if(_0xd48f6e[_0x98d3('0x39')]===_0x98d3('0x87')){if(_0x98d3('0x7c')==typeof _0xd48f6e[_0x98d3('0x81')][_0x98d3('0x88')]){return _0x2edb06(new Error(_0x98d3('0x89')));}if(_0x98d3('0x7c')==typeof _0xd48f6e['parameters']['scriptPath']){return _0x2edb06(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2edb06(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x9d949e=_0xd48f6e[_0x98d3('0x32')];var _0x49138d=_0xd48f6e[_0x98d3('0x8a')];var _0x3a8c6a=_0xd48f6e['type'];var _0x7fe9f6=_0xd48f6e[_0x98d3('0x8b')]?_0xd48f6e[_0x98d3('0x8b')]:_0x98d3('0x8c');var _0x30f254=_0xd48f6e['icon']?_0xd48f6e[_0x98d3('0x8d')]:_0x98d3('0x8e');var _0x290060='';var _0x5e13c3='';var _0x4e65ab='';var _0x3c8063='';var _0x56f33e=_0xd48f6e[_0x98d3('0x8f')];if(_0x3a8c6a===_0x98d3('0x80')){if(_0x98d3('0x7c')!=typeof _0xd48f6e[_0x98d3('0x81')][_0x98d3('0x82')][_0x98d3('0x84')]){var _0xf29fd3=_0xd48f6e['parameters'][_0x98d3('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x98d3('0x90')](_0xf29fd3)){_0x290060=path[_0x98d3('0x51')](_0x98d3('0x91'),_0x5c65a3,_0x267b7a[0x0],_0xf29fd3);}else{_0x290060=_0xf29fd3;}}else{logger[_0x98d3('0x6b')](_0x98d3('0x92'));}if(_0x98d3('0x7c')!=typeof _0xd48f6e['parameters'][_0x98d3('0x82')][_0x98d3('0x85')]){var _0x2933cb=_0xd48f6e[_0x98d3('0x81')]['views'][_0x98d3('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x98d3('0x90')](_0x2933cb)){_0x5e13c3=path['join'](_0x98d3('0x91'),_0x5c65a3,_0x267b7a[0x0],_0x2933cb);}else{_0x5e13c3=_0x2933cb;}}else{logger[_0x98d3('0x6b')](_0x98d3('0x93'));}}else if(_0x3a8c6a==='script'){_0x4e65ab=_0xd48f6e[_0x98d3('0x81')]['scriptName'];_0x3c8063=_0xd48f6e['parameters'][_0x98d3('0x94')];if(_0x98d3('0x7c')!=typeof _0xd48f6e[_0x98d3('0x81')]['views']){if(_0x98d3('0x7c')!=typeof _0xd48f6e[_0x98d3('0x81')][_0x98d3('0x82')][_0x98d3('0x84')]){var _0xf29fd3=_0xd48f6e[_0x98d3('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x98d3('0x90')](_0xf29fd3)){_0x290060=path[_0x98d3('0x51')](_0x98d3('0x91'),_0x5c65a3,_0x267b7a[0x0],_0xf29fd3);}else{_0x290060=_0xf29fd3;}}if('undefined'!=typeof _0xd48f6e['parameters']['views']['agent']){var _0x2933cb=_0xd48f6e['parameters'][_0x98d3('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x98d3('0x90')](_0x2933cb)){_0x5e13c3=path[_0x98d3('0x51')]('plugins',_0x5c65a3,_0x267b7a[0x0],_0x2933cb);}else{_0x5e13c3=_0x2933cb;}}}}var _0x355a99={'name':_0x9d949e,'description':_0x49138d,'path':path['join'](_0x5c65a3,_0x267b7a[0x0]),'type':_0x3a8c6a,'sidebar':_0x7fe9f6,'icon':_0x30f254,'adminUrl':_0x290060,'agentUrl':_0x5e13c3,'scriptName':_0x4e65ab,'scriptPath':_0x3c8063,'version':_0x56f33e};removeReferences(_0x2a35e5,null);return db['Plugin'][_0x98d3('0x95')](_0x355a99)['then'](function(_0x2462c0){var _0x57df0b={'role':_0x2b0c4e[_0x98d3('0x96')][_0x98d3('0x97')],'userProfileId':_0x2b0c4e['body'][_0x98d3('0x98')]};if(!_0x57df0b)throw new Error(_0x98d3('0x99'));if(_0x57df0b[_0x98d3('0x97')]===_0x98d3('0x9a')){var _0x28f2e4=_0x2462c0[_0x98d3('0x2f')]({'plain':!![]});return db[_0x98d3('0x9b')][_0x98d3('0x4f')]({'where':{'name':_0x98d3('0x9c'),'userProfileId':_0x57df0b[_0x98d3('0x98')]},'raw':!![]})['then'](function(_0x38864a){if(_0x38864a&&_0x38864a[_0x98d3('0x9d')]===0x0){return db[_0x98d3('0x9e')]['create']({'name':_0x28f2e4[_0x98d3('0x32')],'resourceId':_0x28f2e4['id'],'type':_0x38864a[_0x98d3('0x32')],'sectionId':_0x38864a['id']},{})[_0x98d3('0x2e')](function(){return _0x2462c0;});}else{return _0x2462c0;}})[_0x98d3('0x4e')](function(_0xe9099e){logger[_0x98d3('0x30')](_0x98d3('0x9f'),_0xe9099e);throw _0xe9099e;});}return _0x2462c0;})[_0x98d3('0x2e')](respondWithResult(_0x515609,null))[_0x98d3('0x4e')](handleError(_0x515609,null));}});}catch(_0x4bfe91){_0x515609[_0x98d3('0x22')](0x1f4)[_0x98d3('0x33')](_0x4bfe91);}};function removeReferences(_0x133a51,_0xa3f2bc){try{if(_0x133a51){fs[_0x98d3('0x6a')](_0x133a51);logger[_0x98d3('0x6b')](_0x98d3('0xa0'));}if(_0xa3f2bc){rimraf(_0xa3f2bc,function(){});logger[_0x98d3('0x6b')](_0x98d3('0xa1'));}}catch(_0xb55803){logger[_0x98d3('0x30')](_0xb55803);}}exports[_0x98d3('0x2c')]=function(_0x4ee48c,_0x326a9e,_0x14d909){return db['Plugin']['find']({'where':{'id':_0x4ee48c[_0x98d3('0x50')]['id']}})['then'](handleEntityNotFound(_0x326a9e,null))[_0x98d3('0x2e')](saveUpdates(_0x4ee48c[_0x98d3('0x96')],null))[_0x98d3('0x2e')](respondWithResult(_0x326a9e,null))[_0x98d3('0x4e')](handleError(_0x326a9e,null));};exports[_0x98d3('0xa2')]=function(_0x519a7c,_0x3e5237,_0x4ec78f){return db[_0x98d3('0x36')]['find']({'where':{'id':_0x519a7c['params']['id']}})[_0x98d3('0x2e')](function(_0x26b184){if(_0x26b184){return _0x26b184[_0x98d3('0x2d')]();}})[_0x98d3('0x2e')](function(_0x18fec0){rimraf(path[_0x98d3('0x51')](config[_0x98d3('0x52')],_0x98d3('0x60'),path[_0x98d3('0x61')](_0x18fec0[_0x98d3('0x7')])),function(){});return _0x18fec0;})['then'](handleEntityNotFound(_0x3e5237,null))['then'](respondWithStatusCode(_0x3e5237,null))[_0x98d3('0x4e')](handleError(_0x3e5237,null));};exports[_0x98d3('0xa3')]=function(_0x4b0bbb,_0x306f6d,_0x18f99d){return BPromise[_0x98d3('0xa4')]()[_0x98d3('0x2e')](function(){if(!_0x4b0bbb[_0x98d3('0x3f')][_0x98d3('0x7')]){throw new Error(_0x98d3('0xa5'));}if(!_0x4b0bbb['query'][_0x98d3('0xa6')]){throw new Error(_0x98d3('0xa7'));}var _0x511dbf=_0x4b0bbb[_0x98d3('0x3f')]['hostname']?_0x4b0bbb[_0x98d3('0x3f')][_0x98d3('0xa8')]+':'+_0x4b0bbb[_0x98d3('0x3f')]['port']:_0x98d3('0xa9')+_0x4b0bbb['query']['port'];var _0x1e801b=_0x4b0bbb['query'][_0x98d3('0x24')]?_0x4b0bbb[_0x98d3('0x3f')]['json']:!![];var _0x453709=_0x4b0bbb[_0x98d3('0x3f')][_0x98d3('0xaa')]?_0x4b0bbb[_0x98d3('0x3f')]['encoding']:null;var _0x2c80d1={'method':_0x4b0bbb['method'],'uri':util[_0x98d3('0x53')](_0x98d3('0xab'),_0x511dbf,_0x4b0bbb[_0x98d3('0x3f')]['path']),'json':_0x1e801b,'resolveWithFullResponse':!![],'encoding':_0x453709,'qs':_0x4b0bbb[_0x98d3('0x3f')]};if(_0x4b0bbb[_0x98d3('0xac')]){_0x2c80d1['headers']=_0x4b0bbb[_0x98d3('0xac')];if(_0x2c80d1[_0x98d3('0xac')][_0x98d3('0xad')]){delete _0x2c80d1['headers'][_0x98d3('0xad')];}}if(_0x2c80d1[_0x98d3('0xac')]['content-type']){delete _0x2c80d1['headers'][_0x98d3('0xae')];}return rp(_0x2c80d1);})[_0x98d3('0x2e')](function(_0x1111e4){if(_0x1111e4){_0x306f6d[_0x98d3('0xaf')](_0x1111e4[_0x98d3('0xac')]);logger[_0x98d3('0x6b')](_0x1111e4[_0x98d3('0x96')]);if(_[_0x98d3('0xb0')](_0x4b0bbb[_0x98d3('0x3f')][_0x98d3('0x7')],_0x98d3('0xb1'))&&_0x1111e4['statusCode']==0x1f4){return _0x306f6d[_0x98d3('0x21')](_0x1111e4[_0x98d3('0xb2')]);}else{return _0x306f6d[_0x98d3('0x22')](_0x1111e4['statusCode'])[_0x98d3('0x33')](_0x1111e4[_0x98d3('0x96')]);}}else{return _0x306f6d[_0x98d3('0x21')](0xc8);}})['catch'](handleError(_0x306f6d,null));};exports[_0x98d3('0xb3')]=function(_0x153fc3,_0x23b2fa,_0x5dffbf){return BPromise['resolve']()[_0x98d3('0x2e')](function(){if(!_0x153fc3['query'][_0x98d3('0x7')]){throw new Error(_0x98d3('0xa5'));}if(!_0x153fc3[_0x98d3('0x3f')][_0x98d3('0xa6')]){throw new Error(_0x98d3('0xa7'));}var _0x4cb2dd=_0x153fc3[_0x98d3('0x3f')]['hostname']?_0x153fc3['query'][_0x98d3('0xa8')]+':'+_0x153fc3[_0x98d3('0x3f')][_0x98d3('0xa6')]:_0x98d3('0xa9')+_0x153fc3[_0x98d3('0x3f')][_0x98d3('0xa6')];var _0x8383fd=_0x153fc3[_0x98d3('0x3f')]['json']?_0x153fc3['query'][_0x98d3('0x24')]:!![];var _0x54bf8e=_0x153fc3[_0x98d3('0x3f')][_0x98d3('0xaa')]?_0x153fc3[_0x98d3('0x3f')]['encoding']:null;var _0x1b919f={'method':_0x153fc3[_0x98d3('0xb4')],'uri':util['format'](_0x98d3('0xab'),_0x4cb2dd,_0x153fc3[_0x98d3('0x3f')][_0x98d3('0x7')]),'json':_0x8383fd,'resolveWithFullResponse':!![],'encoding':_0x54bf8e,'body':_0x153fc3[_0x98d3('0x96')]};if(_0x153fc3[_0x98d3('0xac')]){_0x1b919f[_0x98d3('0xac')]=_0x153fc3[_0x98d3('0xac')];if(_0x1b919f[_0x98d3('0xac')][_0x98d3('0xad')]){delete _0x1b919f['headers']['content-length'];}}if(_0x1b919f[_0x98d3('0xac')][_0x98d3('0xae')]){delete _0x1b919f['headers']['content-type'];}return rp(_0x1b919f);})[_0x98d3('0x2e')](function(_0x49980e){if(_0x49980e){_0x23b2fa[_0x98d3('0xaf')](_0x49980e[_0x98d3('0xac')]);logger[_0x98d3('0x6b')](_0x49980e[_0x98d3('0x96')]);return _0x23b2fa[_0x98d3('0x22')](_0x49980e[_0x98d3('0xb2')])[_0x98d3('0x33')](_0x49980e['body']);}else{return _0x23b2fa[_0x98d3('0x21')](0xc8);}})[_0x98d3('0x4e')](handleError(_0x23b2fa,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 85b70f5..e23749a 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 _0x0598=['emit','exports','events','../../mysqldb','setMaxListeners','remove'];(function(_0x4f8afb,_0x96ee23){var _0x515ac9=function(_0x4d48f1){while(--_0x4d48f1){_0x4f8afb['push'](_0x4f8afb['shift']());}};_0x515ac9(++_0x96ee23);}(_0x0598,0x92));var _0x8059=function(_0x18eda7,_0x59ebe8){_0x18eda7=_0x18eda7-0x0;var _0xa4360e=_0x0598[_0x18eda7];return _0xa4360e;};'use strict';var EventEmitter=require(_0x8059('0x0'));var Plugin=require(_0x8059('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x8059('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8059('0x3')};function emitEvent(_0x236234){return function(_0x54b9a2,_0x54f42f,_0x555fb5){PluginEvents[_0x8059('0x4')](_0x236234+':'+_0x54b9a2['id'],_0x54b9a2);PluginEvents[_0x8059('0x4')](_0x236234,_0x54b9a2);_0x555fb5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8059('0x5')]=PluginEvents; \ No newline at end of file +var _0x5fdc=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5fdc,0x127));var _0xc5fd=function(_0x486bd8,_0x4ea3e2){_0x486bd8=_0x486bd8-0x0;var _0x25c667=_0x5fdc[_0x486bd8];return _0x25c667;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var Plugin=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xc5fd('0x3')](0x0);var events={'afterCreate':_0xc5fd('0x4'),'afterUpdate':_0xc5fd('0x5'),'afterDestroy':_0xc5fd('0x6')};function emitEvent(_0x4d015c){return function(_0xfdf928,_0x1b6205,_0xca27a0){PluginEvents[_0xc5fd('0x7')](_0x4d015c+':'+_0xfdf928['id'],_0xfdf928);PluginEvents[_0xc5fd('0x7')](_0x4d015c,_0xfdf928);_0xca27a0(null);};}for(var e in events){if(events[_0xc5fd('0x8')](e)){var event=events[e];Plugin[_0xc5fd('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ebb339a..5c01834 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 _0xeec6=['path','rimraf','../../config/environment','./plugin.attributes','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x26720f,_0x3527b5){var _0x4ecf15=function(_0x9bd1b0){while(--_0x9bd1b0){_0x26720f['push'](_0x26720f['shift']());}};_0x4ecf15(++_0x3527b5);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0xeec6[_0x3b87f4];return _0x63d16e;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0xd69b6c,_0x4c6242){_0xd69b6c=_0xd69b6c-0x0;var _0x52574e=_0x6aa7[_0xd69b6c];return _0x52574e;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 27341b1..3172f2f 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 _0x0469=['socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0469,0x75));var _0x9046=function(_0x19a4a5,_0x405e18){_0x19a4a5=_0x19a4a5-0x0;var _0x1196b3=_0x0469[_0x19a4a5];return _0x1196b3;};'use strict';var _=require(_0x9046('0x0'));var util=require('util');var moment=require(_0x9046('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9046('0x2'));var db=require(_0x9046('0x3'))['db'];var utils=require(_0x9046('0x4'));var logger=require(_0x9046('0x5'))('rpc');var config=require(_0x9046('0x6'));var jayson=require(_0x9046('0x7'));var client=jayson['client'][_0x9046('0x8')]({'port':0x232a});config[_0x9046('0x9')]=_['defaults'](config[_0x9046('0x9')],{'host':_0x9046('0xa'),'port':0x18eb});var socket=require(_0x9046('0xb'))(new Redis(config[_0x9046('0x9')]));require(_0x9046('0xc'))[_0x9046('0xd')](socket);function respondWithRpcPromise(_0x75fc0e,_0x5b284b,_0x25574a){return new BPromise(function(_0x4a7771,_0x27cef3){return client[_0x9046('0xe')](_0x75fc0e,_0x25574a)[_0x9046('0xf')](function(_0x4a15fe){logger[_0x9046('0x10')](_0x9046('0x11'),_0x5b284b,_0x9046('0x12'));logger[_0x9046('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5b284b,_0x9046('0x12'),JSON[_0x9046('0x14')](_0x4a15fe));if(_0x4a15fe[_0x9046('0x15')]){if(_0x4a15fe[_0x9046('0x15')][_0x9046('0x16')]===0x1f4){logger[_0x9046('0x15')](_0x9046('0x11'),_0x5b284b,_0x4a15fe[_0x9046('0x15')][_0x9046('0x17')]);return _0x27cef3(_0x4a15fe[_0x9046('0x15')]['message']);}logger[_0x9046('0x15')](_0x9046('0x11'),_0x5b284b,_0x4a15fe[_0x9046('0x15')][_0x9046('0x17')]);return _0x4a7771(_0x4a15fe[_0x9046('0x15')][_0x9046('0x17')]);}else{logger[_0x9046('0x10')]('Plugin,\x20%s,\x20%s',_0x5b284b,'request\x20sent');_0x4a7771(_0x4a15fe[_0x9046('0x18')][_0x9046('0x17')]);}})[_0x9046('0x19')](function(_0x12926e){logger[_0x9046('0x15')](_0x9046('0x11'),_0x5b284b,_0x12926e);_0x27cef3(_0x12926e);});});}exports[_0x9046('0x1a')]=function(_0x22f3f5){var _0x4ac8e5=this;return new Promise(function(_0x2b1e9,_0x27028d){return db[_0x9046('0x1b')][_0x9046('0x1c')](_0x22f3f5[_0x9046('0x1d')],{'raw':_0x22f3f5[_0x9046('0x1e')]?_0x22f3f5['options'][_0x9046('0x1f')]===undefined?!![]:![]:!![]})[_0x9046('0xf')](function(_0x2aef8a){logger[_0x9046('0x10')](_0x9046('0x1a'),_0x22f3f5);logger[_0x9046('0x13')](_0x9046('0x1a'),_0x22f3f5,JSON[_0x9046('0x14')](_0x2aef8a));_0x2b1e9(_0x2aef8a);})[_0x9046('0x19')](function(_0x233014){logger[_0x9046('0x15')](_0x9046('0x1a'),_0x233014[_0x9046('0x17')],_0x22f3f5);_0x27028d(_0x4ac8e5[_0x9046('0x15')](0x1f4,_0x233014[_0x9046('0x17')]));});});}; \ No newline at end of file +var _0x8765=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreatePlugin','create','body','options','raw','then','lodash'];(function(_0x52dd90,_0x132712){var _0x2e16bb=function(_0x176552){while(--_0x176552){_0x52dd90['push'](_0x52dd90['shift']());}};_0x2e16bb(++_0x132712);}(_0x8765,0x128));var _0x5876=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8765[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x5876('0x0'));var util=require('util');var moment=require(_0x5876('0x1'));var BPromise=require(_0x5876('0x2'));var rs=require(_0x5876('0x3'));var fs=require('fs');var Redis=require(_0x5876('0x4'));var db=require(_0x5876('0x5'))['db'];var utils=require(_0x5876('0x6'));var logger=require(_0x5876('0x7'))('rpc');var config=require(_0x5876('0x8'));var jayson=require(_0x5876('0x9'));var client=jayson[_0x5876('0xa')][_0x5876('0xb')]({'port':0x232a});config[_0x5876('0xc')]=_[_0x5876('0xd')](config[_0x5876('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5876('0xe'))(new Redis(config['redis']));require(_0x5876('0xf'))[_0x5876('0x10')](socket);function respondWithRpcPromise(_0x3a4458,_0x2c28d7,_0x169ee7){return new BPromise(function(_0x7e90b3,_0x1308f4){return client['request'](_0x3a4458,_0x169ee7)['then'](function(_0x290d61){logger['info'](_0x5876('0x11'),_0x2c28d7,_0x5876('0x12'));logger[_0x5876('0x13')](_0x5876('0x14'),_0x2c28d7,_0x5876('0x12'),JSON[_0x5876('0x15')](_0x290d61));if(_0x290d61[_0x5876('0x16')]){if(_0x290d61[_0x5876('0x16')]['code']===0x1f4){logger['error'](_0x5876('0x11'),_0x2c28d7,_0x290d61[_0x5876('0x16')][_0x5876('0x17')]);return _0x1308f4(_0x290d61['error'][_0x5876('0x17')]);}logger['error'](_0x5876('0x11'),_0x2c28d7,_0x290d61[_0x5876('0x16')][_0x5876('0x17')]);return _0x7e90b3(_0x290d61[_0x5876('0x16')][_0x5876('0x17')]);}else{logger[_0x5876('0x18')](_0x5876('0x11'),_0x2c28d7,_0x5876('0x12'));_0x7e90b3(_0x290d61[_0x5876('0x19')][_0x5876('0x17')]);}})[_0x5876('0x1a')](function(_0x3f779a){logger[_0x5876('0x16')](_0x5876('0x11'),_0x2c28d7,_0x3f779a);_0x1308f4(_0x3f779a);});});}exports[_0x5876('0x1b')]=function(_0x58b25e){var _0xe826fb=this;return new Promise(function(_0x44989a,_0xa581be){return db['Plugin'][_0x5876('0x1c')](_0x58b25e[_0x5876('0x1d')],{'raw':_0x58b25e[_0x5876('0x1e')]?_0x58b25e[_0x5876('0x1e')][_0x5876('0x1f')]===undefined?!![]:![]:!![]})[_0x5876('0x20')](function(_0x2d9e37){logger[_0x5876('0x18')](_0x5876('0x1b'),_0x58b25e);logger[_0x5876('0x13')](_0x5876('0x1b'),_0x58b25e,JSON[_0x5876('0x15')](_0x2d9e37));_0x44989a(_0x2d9e37);})['catch'](function(_0x532ea6){logger[_0x5876('0x16')](_0x5876('0x1b'),_0x532ea6[_0x5876('0x17')],_0x58b25e);_0xa581be(_0xe826fb['error'](0x1f4,_0x532ea6[_0x5876('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 50b192b..e4ab0df 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 _0xb24d=['removeListener','register','length','plugin:','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb24d,0x1b4));var _0xdb24=function(_0xaf9190,_0x2f3d93){_0xaf9190=_0xaf9190-0x0;var _0x345243=_0xb24d[_0xaf9190];return _0x345243;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xdb24('0x0'),_0xdb24('0x1'),_0xdb24('0x2')];function createListener(_0x218475,_0x4af515){return function(_0xe870b){_0x4af515[_0xdb24('0x3')](_0x218475,_0xe870b);};}function removeListener(_0x3efec1,_0x1a2b46){return function(){PluginEvents[_0xdb24('0x4')](_0x3efec1,_0x1a2b46);};}exports[_0xdb24('0x5')]=function(_0x997566){for(var _0x3e343e=0x0,_0x43e143=events[_0xdb24('0x6')];_0x3e343e<_0x43e143;_0x3e343e++){var _0x3e3e2f=events[_0x3e343e];var _0x58551f=createListener(_0xdb24('0x7')+_0x3e3e2f,_0x997566);PluginEvents['on'](_0x3e3e2f,_0x58551f);}}; \ No newline at end of file +var _0x41fa=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x5cd51d,_0x20d4fa){var _0x444608=function(_0x32a9dc){while(--_0x32a9dc){_0x5cd51d['push'](_0x5cd51d['shift']());}};_0x444608(++_0x20d4fa);}(_0x41fa,0x1f1));var _0xa41f=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x41fa[_0x2786ea];return _0x5c38e5;};'use strict';var PluginEvents=require(_0xa41f('0x0'));var events=[_0xa41f('0x1'),_0xa41f('0x2'),_0xa41f('0x3')];function createListener(_0x322296,_0x4f0eec){return function(_0x55e729){_0x4f0eec[_0xa41f('0x4')](_0x322296,_0x55e729);};}function removeListener(_0xd074d2,_0x1fedea){return function(){PluginEvents[_0xa41f('0x5')](_0xd074d2,_0x1fedea);};}exports[_0xa41f('0x6')]=function(_0x52f5d0){for(var _0x5d6def=0x0,_0x41db12=events[_0xa41f('0x7')];_0x5d6def<_0x41db12;_0x5d6def++){var _0xe34a11=events[_0x5d6def];var _0x5c9834=createListener(_0xa41f('0x8')+_0xe34a11,_0x52f5d0);PluginEvents['on'](_0xe34a11,_0x5c9834);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0562211..b1b4b9b 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 _0x73ad=['exports','express','Router','../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x32b2d1,_0xa0b952){var _0x32a019=function(_0x3b2600){while(--_0x3b2600){_0x32b2d1['push'](_0x32b2d1['shift']());}};_0x32a019(++_0xa0b952);}(_0x73ad,0x1eb));var _0xd73a=function(_0x3aa808,_0x7b5343){_0x3aa808=_0x3aa808-0x0;var _0x58b883=_0x73ad[_0x3aa808];return _0x58b883;};'use strict';var express=require(_0xd73a('0x0'));var router=express[_0xd73a('0x1')]();var auth=require(_0xd73a('0x2'));var controller=require('./pm2.controller');router[_0xd73a('0x3')]('/',auth[_0xd73a('0x4')](),controller['index']);router[_0xd73a('0x3')](_0xd73a('0x5'),auth[_0xd73a('0x4')](),controller[_0xd73a('0x6')]);router[_0xd73a('0x7')]('/',auth[_0xd73a('0x4')](),controller[_0xd73a('0x8')]);router[_0xd73a('0x9')](_0xd73a('0x5'),auth[_0xd73a('0x4')](),controller[_0xd73a('0xa')]);router[_0xd73a('0xb')](_0xd73a('0x5'),auth['isAuthenticated'](),controller[_0xd73a('0xc')]);module[_0xd73a('0xd')]=router; \ No newline at end of file +var _0xedf0=['exports','Router','./pm2.controller','get','isAuthenticated','/:id','post','create','update','destroy'];(function(_0x1526a9,_0x48fb64){var _0x9f4049=function(_0x13271a){while(--_0x13271a){_0x1526a9['push'](_0x1526a9['shift']());}};_0x9f4049(++_0x48fb64);}(_0xedf0,0xf1));var _0x0edf=function(_0x37fa4f,_0x379eb2){_0x37fa4f=_0x37fa4f-0x0;var _0x17133f=_0xedf0[_0x37fa4f];return _0x17133f;};'use strict';var express=require('express');var router=express[_0x0edf('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x0edf('0x1'));router[_0x0edf('0x2')]('/',auth[_0x0edf('0x3')](),controller['index']);router[_0x0edf('0x2')](_0x0edf('0x4'),auth[_0x0edf('0x3')](),controller['show']);router[_0x0edf('0x5')]('/',auth[_0x0edf('0x3')](),controller[_0x0edf('0x6')]);router['put'](_0x0edf('0x4'),auth[_0x0edf('0x3')](),controller[_0x0edf('0x7')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0edf('0x8')]);module[_0x0edf('0x9')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index ed5c67d..a4ff7b1 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 _0xf903=['express','motion2','length','catch','show','describe','create','body','join','../../files/plugins','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','json','error','stack','name','status','info','index','list','then','reject'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf903,0x194));var _0x3f90=function(_0x23dad9,_0x5dc8f2){_0x23dad9=_0x23dad9-0x0;var _0x527967=_0xf903[_0x23dad9];return _0x527967;};'use strict';var _=require(_0x3f90('0x0'));var pm2=require(_0x3f90('0x1'));var logger=require(_0x3f90('0x2'))(_0x3f90('0x3'));var path=require(_0x3f90('0x4'));var exec=require('child_process')[_0x3f90('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x45c02d,_0x597e3b){return function(_0x56052c){if(!_0x56052c){_0x45c02d['sendStatus'](0x194);;}return _0x56052c;};}function respondWithResult(_0x1d6eb2,_0x42b081){_0x42b081=_0x42b081||0xc8;return function(_0x945b0a){if(_0x945b0a){return _0x1d6eb2['status'](_0x42b081)[_0x3f90('0x6')](_0x945b0a);}return null;};}function handleError(_0x1e90a2,_0x79fe01){_0x79fe01=_0x79fe01||0x1f4;return function(_0x255362){logger[_0x3f90('0x7')](_0x255362[_0x3f90('0x8')]);if(_0x255362[_0x3f90('0x9')]){delete _0x255362['name'];}_0x1e90a2[_0x3f90('0xa')](_0x79fe01)['send'](_0x255362);};}function execChildProcess(){return new BPromise(function(_0x31c87c,_0x110b04){exec('npm\x20install',function(_0x80594,_0x23ea61,_0x913aa2){logger[_0x3f90('0xb')](_0x23ea61);logger[_0x3f90('0xb')](_0x913aa2);if(_0x80594){logger[_0x3f90('0x7')](_0x80594);return _0x110b04(_0x80594);}return _0x31c87c(_0x23ea61);});});}exports[_0x3f90('0xc')]=function(_0x310112,_0x143665){return pm2[_0x3f90('0xd')]()[_0x3f90('0xe')](function(_0x263a3c){if(_0x263a3c){var _0x30686f=_[_0x3f90('0xf')](_0x263a3c,function(_0x83ba67){return _0x83ba67[_0x3f90('0x9')]===_0x3f90('0x10')||_0x83ba67[_0x3f90('0x9')]===_0x3f90('0x11');});return{'rows':_0x30686f,'count':_0x30686f[_0x3f90('0x12')]};}return null;})[_0x3f90('0xe')](respondWithResult(_0x143665,null))[_0x3f90('0x13')](handleError(_0x143665,null));};exports[_0x3f90('0x14')]=function(_0x242cd1,_0x574184){return pm2[_0x3f90('0x15')](_0x242cd1['params']['id'])[_0x3f90('0xe')](respondWithResult(_0x574184,null))[_0x3f90('0xe')](handleEntityNotFound(_0x574184,null))[_0x3f90('0x13')](handleError(_0x574184,null));};exports[_0x3f90('0x16')]=function(_0x1cf4be,_0x3f99f4){if(_0x1cf4be['body']['name']&&_0x1cf4be[_0x3f90('0x17')]['script']){var _0x2faee1=path[_0x3f90('0x18')](__dirname,_0x3f90('0x19'),_0x1cf4be[_0x3f90('0x17')]['script']);var _0x4a9ea5=process[_0x3f90('0x1a')]();process[_0x3f90('0x1b')](path[_0x3f90('0x1c')](_0x2faee1));return execChildProcess()[_0x3f90('0xe')](function(_0x30f0db){process[_0x3f90('0x1b')](_0x4a9ea5);return pm2[_0x3f90('0x1d')]({'name':_0x1cf4be[_0x3f90('0x17')][_0x3f90('0x9')],'script':_0x2faee1});})[_0x3f90('0xe')](function(_0x119fd7){pm2[_0x3f90('0x1e')]();return _0x119fd7[0x0];})[_0x3f90('0xe')](respondWithResult(_0x3f99f4,0xc9))[_0x3f90('0x13')](handleError(_0x3f99f4,null));}else{return _0x3f99f4[_0x3f90('0xa')](0x1f4)[_0x3f90('0x1f')]({'message':_0x3f90('0x20')});}};exports[_0x3f90('0x21')]=function(_0x124e73,_0x56021b){if(_0x124e73[_0x3f90('0x17')]['id']){delete _0x124e73[_0x3f90('0x17')]['id'];}var _0x48c815={'online':_0x3f90('0x22'),'stopped':_0x3f90('0x23')};if(_0x48c815[_0x3f90('0x24')](_0x124e73[_0x3f90('0x17')][_0x3f90('0xa')])){return pm2[_0x48c815[_0x124e73[_0x3f90('0x17')]['status']]](_0x124e73[_0x3f90('0x25')]['id'])[_0x3f90('0xe')](respondWithResult(_0x56021b,0xc8))[_0x3f90('0x13')](handleError(_0x56021b,null));}else{return _0x56021b[_0x3f90('0xa')](0x1f4)[_0x3f90('0x1f')]({'message':_0x3f90('0x26')});}};exports[_0x3f90('0x27')]=function(_0x477f84,_0x1db044){if(_0x477f84[_0x3f90('0x17')]['id']){delete _0x477f84['body']['id'];}if(_0x477f84[_0x3f90('0x25')]['id']){return pm2[_0x3f90('0x28')](_0x477f84[_0x3f90('0x25')]['id'])[_0x3f90('0xe')](function(_0x30d85b){pm2[_0x3f90('0x1e')]();return _0x30d85b[0x0];})['then'](respondWithResult(_0x1db044,null))['catch'](handleError(_0x1db044,null));}else{return _0x1db044[_0x3f90('0xa')](0x1f4)[_0x3f90('0x1f')]({'message':_0x3f90('0x29')});}}; \ No newline at end of file +var _0x6909=['describe','params','then','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','info','index','list','reject','express','motion2','catch','show'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6909,0x185));var _0x9690=function(_0x1a3e68,_0x2b2942){_0x1a3e68=_0x1a3e68-0x0;var _0x52a808=_0x6909[_0x1a3e68];return _0x52a808;};'use strict';var _=require(_0x9690('0x0'));var pm2=require(_0x9690('0x1'));var logger=require(_0x9690('0x2'))(_0x9690('0x3'));var path=require(_0x9690('0x4'));var exec=require('child_process')[_0x9690('0x5')];var BPromise=require(_0x9690('0x6'));function handleEntityNotFound(_0x3c9726,_0xd5c74f){return function(_0x47f4c0){if(!_0x47f4c0){_0x3c9726[_0x9690('0x7')](0x194);;}return _0x47f4c0;};}function respondWithResult(_0x3d3953,_0x1055c9){_0x1055c9=_0x1055c9||0xc8;return function(_0x1a26fa){if(_0x1a26fa){return _0x3d3953[_0x9690('0x8')](_0x1055c9)[_0x9690('0x9')](_0x1a26fa);}return null;};}function handleError(_0x21296b,_0x2f0013){_0x2f0013=_0x2f0013||0x1f4;return function(_0x3edb52){logger[_0x9690('0xa')](_0x3edb52[_0x9690('0xb')]);if(_0x3edb52[_0x9690('0xc')]){delete _0x3edb52[_0x9690('0xc')];}_0x21296b[_0x9690('0x8')](_0x2f0013)['send'](_0x3edb52);};}function execChildProcess(){return new BPromise(function(_0x5944e9,_0x2813b8){exec('npm\x20install',function(_0x1e8a30,_0x4f33fc,_0x1b48a3){logger['info'](_0x4f33fc);logger[_0x9690('0xd')](_0x1b48a3);if(_0x1e8a30){logger[_0x9690('0xa')](_0x1e8a30);return _0x2813b8(_0x1e8a30);}return _0x5944e9(_0x4f33fc);});});}exports[_0x9690('0xe')]=function(_0x43fd55,_0x4b3f87){return pm2[_0x9690('0xf')]()['then'](function(_0x1fb126){if(_0x1fb126){var _0x7d769a=_[_0x9690('0x10')](_0x1fb126,function(_0x1b357b){return _0x1b357b[_0x9690('0xc')]===_0x9690('0x11')||_0x1b357b[_0x9690('0xc')]===_0x9690('0x12');});return{'rows':_0x7d769a,'count':_0x7d769a['length']};}return null;})['then'](respondWithResult(_0x4b3f87,null))[_0x9690('0x13')](handleError(_0x4b3f87,null));};exports[_0x9690('0x14')]=function(_0x35efa3,_0x5af047){return pm2[_0x9690('0x15')](_0x35efa3[_0x9690('0x16')]['id'])['then'](respondWithResult(_0x5af047,null))[_0x9690('0x17')](handleEntityNotFound(_0x5af047,null))[_0x9690('0x13')](handleError(_0x5af047,null));};exports[_0x9690('0x18')]=function(_0xa454dd,_0x3fbbf3){if(_0xa454dd[_0x9690('0x19')][_0x9690('0xc')]&&_0xa454dd[_0x9690('0x19')][_0x9690('0x1a')]){var _0x31e22b=path['join'](__dirname,_0x9690('0x1b'),_0xa454dd[_0x9690('0x19')]['script']);var _0x14524c=process[_0x9690('0x1c')]();process[_0x9690('0x1d')](path[_0x9690('0x1e')](_0x31e22b));return execChildProcess()[_0x9690('0x17')](function(_0x5391cb){process['chdir'](_0x14524c);return pm2['start']({'name':_0xa454dd['body'][_0x9690('0xc')],'script':_0x31e22b});})[_0x9690('0x17')](function(_0x2276e6){pm2[_0x9690('0x1f')]();return _0x2276e6[0x0];})[_0x9690('0x17')](respondWithResult(_0x3fbbf3,0xc9))[_0x9690('0x13')](handleError(_0x3fbbf3,null));}else{return _0x3fbbf3[_0x9690('0x8')](0x1f4)['send']({'message':_0x9690('0x20')});}};exports[_0x9690('0x21')]=function(_0x117de0,_0x27c30c){if(_0x117de0[_0x9690('0x19')]['id']){delete _0x117de0[_0x9690('0x19')]['id'];}var _0x42242f={'online':_0x9690('0x22'),'stopped':'stop'};if(_0x42242f[_0x9690('0x23')](_0x117de0[_0x9690('0x19')][_0x9690('0x8')])){return pm2[_0x42242f[_0x117de0[_0x9690('0x19')][_0x9690('0x8')]]](_0x117de0[_0x9690('0x16')]['id'])[_0x9690('0x17')](respondWithResult(_0x27c30c,0xc8))[_0x9690('0x13')](handleError(_0x27c30c,null));}else{return _0x27c30c[_0x9690('0x8')](0x1f4)[_0x9690('0x24')]({'message':_0x9690('0x25')});}};exports[_0x9690('0x26')]=function(_0x7fc446,_0x45ba75){if(_0x7fc446[_0x9690('0x19')]['id']){delete _0x7fc446[_0x9690('0x19')]['id'];}if(_0x7fc446['params']['id']){return pm2[_0x9690('0x27')](_0x7fc446[_0x9690('0x16')]['id'])['then'](function(_0x20933e){pm2[_0x9690('0x1f')]();return _0x20933e[0x0];})[_0x9690('0x17')](respondWithResult(_0x45ba75,null))[_0x9690('0x13')](handleError(_0x45ba75,null));}else{return _0x45ba75[_0x9690('0x8')](0x1f4)[_0x9690('0x24')]({'message':_0x9690('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b6e7ddf..853918f 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 _0xb5d3=['express','Router','../../components/auth/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x542a15,_0x4a5b96){var _0x22a65d=function(_0x3a0b47){while(--_0x3a0b47){_0x542a15['push'](_0x542a15['shift']());}};_0x22a65d(++_0x4a5b96);}(_0xb5d3,0x1cc));var _0x3b5d=function(_0x317497,_0x2d6cf7){_0x317497=_0x317497-0x0;var _0x3445b0=_0xb5d3[_0x317497];return _0x3445b0;};'use strict';var multer=require(_0x3b5d('0x0'));var util=require(_0x3b5d('0x1'));var path=require(_0x3b5d('0x2'));var timeout=require(_0x3b5d('0x3'));var express=require(_0x3b5d('0x4'));var router=express[_0x3b5d('0x5')]();var auth=require(_0x3b5d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b5d('0x7'));module['exports']=router; \ No newline at end of file +var _0xcea7=['express','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0xef6fe2,_0x43e02c){var _0x4f9988=function(_0x206e29){while(--_0x206e29){_0xef6fe2['push'](_0xef6fe2['shift']());}};_0x4f9988(++_0x43e02c);}(_0xcea7,0x13c));var _0x7cea=function(_0x435812,_0x2bf0df){_0x435812=_0x435812-0x0;var _0x3c64c5=_0xcea7[_0x435812];return _0x3c64c5;};'use strict';var multer=require(_0x7cea('0x0'));var util=require(_0x7cea('0x1'));var path=require(_0x7cea('0x2'));var timeout=require(_0x7cea('0x3'));var express=require(_0x7cea('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7cea('0x5'));var config=require(_0x7cea('0x6'));module[_0x7cea('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 afb5066..684ac96 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 _0x609e=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0xfa09a6,_0x295e32){var _0x5033e7=function(_0x436925){while(--_0x436925){_0xfa09a6['push'](_0xfa09a6['shift']());}};_0x5033e7(++_0x295e32);}(_0x609e,0x13e));var _0xe609=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x609e[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xe609('0x0'));module[_0xe609('0x1')]={'state':{'type':Sequelize[_0xe609('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe609('0x3')]},'scheduledat':{'type':Sequelize[_0xe609('0x4')]},'uniqueid':{'type':Sequelize[_0xe609('0x3')]},'starttime':{'type':Sequelize[_0xe609('0x4')]},'responsetime':{'type':Sequelize[_0xe609('0x4')]},'ringtime':{'type':Sequelize[_0xe609('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe609('0x3')]},'campaigntype':{'type':Sequelize[_0xe609('0x3')]},'membername':{'type':Sequelize[_0xe609('0x3')]}}; \ No newline at end of file +var _0x844c=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x844c,0x17a));var _0xc844=function(_0x23c651,_0x143982){_0x23c651=_0x23c651-0x0;var _0xbe7bdb=_0x844c[_0x23c651];return _0xbe7bdb;};'use strict';var Sequelize=require(_0xc844('0x0'));module[_0xc844('0x1')]={'state':{'type':Sequelize[_0xc844('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc844('0x3')]},'scheduledat':{'type':Sequelize[_0xc844('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc844('0x4')]},'responsetime':{'type':Sequelize[_0xc844('0x4')]},'ringtime':{'type':Sequelize[_0xc844('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc844('0x3')]},'campaigntype':{'type':Sequelize[_0xc844('0x3')]},'membername':{'type':Sequelize[_0xc844('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 87dbf01..f4fbd84 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 _0xc396=['exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0xd89fde,_0x4d2417){var _0xe67f58=function(_0x4b21f9){while(--_0x4b21f9){_0xd89fde['push'](_0xd89fde['shift']());}};_0xe67f58(++_0x4d2417);}(_0xc396,0x148));var _0x6c39=function(_0x2c70e5,_0x1ca216){_0x2c70e5=_0x2c70e5-0x0;var _0x3307af=_0xc396[_0x2c70e5];return _0x3307af;};'use strict';var _=require(_0x6c39('0x0'));var util=require(_0x6c39('0x1'));var logger=require(_0x6c39('0x2'))(_0x6c39('0x3'));var moment=require(_0x6c39('0x4'));var BPromise=require('bluebird');var rp=require(_0x6c39('0x5'));var fs=require('fs');var path=require(_0x6c39('0x6'));var rimraf=require(_0x6c39('0x7'));var config=require(_0x6c39('0x8'));var attributes=require(_0x6c39('0x9'));module[_0x6c39('0xa')]=function(_0x4fbbaa,_0x40db4b){return _0x4fbbaa['define'](_0x6c39('0xb'),attributes,{'tableName':_0x6c39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x318c=['path','./reportAgentPreview.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16c5ab,_0x489396){var _0x5ad9b8=function(_0x522742){while(--_0x522742){_0x16c5ab['push'](_0x16c5ab['shift']());}};_0x5ad9b8(++_0x489396);}(_0x318c,0x1c6));var _0xc318=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x318c[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xc318('0x0'));var logger=require(_0xc318('0x1'))(_0xc318('0x2'));var moment=require(_0xc318('0x3'));var BPromise=require(_0xc318('0x4'));var rp=require(_0xc318('0x5'));var fs=require('fs');var path=require(_0xc318('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc318('0x7'));module[_0xc318('0x8')]=function(_0x218bb9,_0x23d847){return _0x218bb9[_0xc318('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 7787341..985602b 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 _0x065c=['then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xd11826,_0x1c301d){var _0x4a024d=function(_0xea70bd){while(--_0xea70bd){_0xd11826['push'](_0xd11826['shift']());}};_0x4a024d(++_0x1c301d);}(_0x065c,0x1d3));var _0xc065=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x065c[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0xc065('0x0'));var util=require('util');var moment=require(_0xc065('0x1'));var BPromise=require(_0xc065('0x2'));var rs=require(_0xc065('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc065('0x4'))['db'];var utils=require(_0xc065('0x5'));var logger=require(_0xc065('0x6'))(_0xc065('0x7'));var config=require(_0xc065('0x8'));var jayson=require(_0xc065('0x9'));var client=jayson[_0xc065('0xa')][_0xc065('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50ffe3,_0x1e1631,_0x18121a){return new BPromise(function(_0x567063,_0x138109){return client[_0xc065('0xc')](_0x50ffe3,_0x18121a)[_0xc065('0xd')](function(_0x2cef3e){logger[_0xc065('0xe')](_0xc065('0xf'),_0x1e1631,_0xc065('0x10'));logger[_0xc065('0x11')](_0xc065('0x12'),_0x1e1631,_0xc065('0x10'),JSON[_0xc065('0x13')](_0x2cef3e));if(_0x2cef3e['error']){if(_0x2cef3e[_0xc065('0x14')][_0xc065('0x15')]===0x1f4){logger[_0xc065('0x14')](_0xc065('0xf'),_0x1e1631,_0x2cef3e[_0xc065('0x14')][_0xc065('0x16')]);return _0x138109(_0x2cef3e['error'][_0xc065('0x16')]);}logger[_0xc065('0x14')](_0xc065('0xf'),_0x1e1631,_0x2cef3e[_0xc065('0x14')]['message']);return _0x567063(_0x2cef3e[_0xc065('0x14')][_0xc065('0x16')]);}else{logger[_0xc065('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1e1631,_0xc065('0x10'));_0x567063(_0x2cef3e[_0xc065('0x17')][_0xc065('0x16')]);}})[_0xc065('0x18')](function(_0xb25085){logger[_0xc065('0x14')](_0xc065('0xf'),_0x1e1631,_0xb25085);_0x138109(_0xb25085);});});}exports['CreateReportAgentPreview']=function(_0x569e5b){var _0x50c3df=this;return new Promise(function(_0xd4ab3a,_0x2fb3c9){return db[_0xc065('0x19')]['create'](_0x569e5b[_0xc065('0x1a')],{'raw':_0x569e5b['options']?_0x569e5b[_0xc065('0x1b')][_0xc065('0x1c')]===undefined?!![]:![]:!![]})[_0xc065('0xd')](function(_0x2d1952){logger[_0xc065('0xe')]('CreateReportAgentPreview',_0x569e5b);logger[_0xc065('0x11')](_0xc065('0x1d'),_0x569e5b,JSON[_0xc065('0x13')](_0x2d1952));_0xd4ab3a(_0x2d1952);})[_0xc065('0x18')](function(_0x280142){logger[_0xc065('0x14')]('CreateReportAgentPreview',_0x280142[_0xc065('0x16')],_0x569e5b);_0x2fb3c9(_0x50c3df[_0xc065('0x14')](0x1f4,_0x280142[_0xc065('0x16')]));});});}; \ No newline at end of file +var _0x5e77=['options','raw','then','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateReportAgentPreview','create','body'];(function(_0x36a8b8,_0x59d96c){var _0x539463=function(_0x11209d){while(--_0x11209d){_0x36a8b8['push'](_0x36a8b8['shift']());}};_0x539463(++_0x59d96c);}(_0x5e77,0x100));var _0x75e7=function(_0x49225d,_0x312d6c){_0x49225d=_0x49225d-0x0;var _0x2c228f=_0x5e77[_0x49225d];return _0x2c228f;};'use strict';var _=require(_0x75e7('0x0'));var util=require(_0x75e7('0x1'));var moment=require(_0x75e7('0x2'));var BPromise=require(_0x75e7('0x3'));var rs=require(_0x75e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75e7('0x5'))('rpc');var config=require(_0x75e7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x75e7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x412366,_0x36113b,_0x40bb35){return new BPromise(function(_0xbf8d7f,_0x59ea15){return client['request'](_0x412366,_0x40bb35)['then'](function(_0x463643){logger[_0x75e7('0x8')](_0x75e7('0x9'),_0x36113b,_0x75e7('0xa'));logger[_0x75e7('0xb')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x36113b,'request\x20sent',JSON[_0x75e7('0xc')](_0x463643));if(_0x463643[_0x75e7('0xd')]){if(_0x463643[_0x75e7('0xd')][_0x75e7('0xe')]===0x1f4){logger[_0x75e7('0xd')](_0x75e7('0x9'),_0x36113b,_0x463643[_0x75e7('0xd')]['message']);return _0x59ea15(_0x463643[_0x75e7('0xd')][_0x75e7('0xf')]);}logger[_0x75e7('0xd')](_0x75e7('0x9'),_0x36113b,_0x463643['error'][_0x75e7('0xf')]);return _0xbf8d7f(_0x463643[_0x75e7('0xd')]['message']);}else{logger[_0x75e7('0x8')]('ReportAgentPreview,\x20%s,\x20%s',_0x36113b,_0x75e7('0xa'));_0xbf8d7f(_0x463643['result'][_0x75e7('0xf')]);}})[_0x75e7('0x10')](function(_0x191b2c){logger['error'](_0x75e7('0x9'),_0x36113b,_0x191b2c);_0x59ea15(_0x191b2c);});});}exports[_0x75e7('0x11')]=function(_0x4a5d93){var _0x339fc2=this;return new Promise(function(_0x3453a7,_0x103162){return db['ReportAgentPreview'][_0x75e7('0x12')](_0x4a5d93[_0x75e7('0x13')],{'raw':_0x4a5d93['options']?_0x4a5d93[_0x75e7('0x14')][_0x75e7('0x15')]===undefined?!![]:![]:!![]})[_0x75e7('0x16')](function(_0x41c24c){logger[_0x75e7('0x8')](_0x75e7('0x11'),_0x4a5d93);logger['debug']('CreateReportAgentPreview',_0x4a5d93,JSON[_0x75e7('0xc')](_0x41c24c));_0x3453a7(_0x41c24c);})[_0x75e7('0x10')](function(_0xd24bd4){logger[_0x75e7('0xd')](_0x75e7('0x11'),_0xd24bd4[_0x75e7('0xf')],_0x4a5d93);_0x103162(_0x339fc2['error'](0x1f4,_0xd24bd4[_0x75e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 084effd..16dffd1 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 _0x19cd=['faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts'];(function(_0x3f09bc,_0x379988){var _0x29adb3=function(_0x51e56e){while(--_0x51e56e){_0x3f09bc['push'](_0x3f09bc['shift']());}};_0x29adb3(++_0x379988);}(_0x19cd,0x6f));var _0xd19c=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x19cd[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0xd19c('0x0'));var util=require(_0xd19c('0x1'));var path=require(_0xd19c('0x2'));var express=require(_0xd19c('0x3'));var router=express[_0xd19c('0x4')]();var auth=require(_0xd19c('0x5'));var controller=require(_0xd19c('0x6'));router[_0xd19c('0x7')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xd19c('0x8'),auth[_0xd19c('0x9')](),controller[_0xd19c('0xa')]);router[_0xd19c('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xd19c('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0xd19c('0x7')]('/voice/queues',auth['isAuthenticated'](),controller[_0xd19c('0xb')]);router[_0xd19c('0x7')](_0xd19c('0xc'),auth[_0xd19c('0x9')](),controller[_0xd19c('0xd')]);router[_0xd19c('0x7')]('/mail/queues',auth[_0xd19c('0x9')](),controller[_0xd19c('0xe')]);router[_0xd19c('0x7')](_0xd19c('0xf'),auth['isAuthenticated'](),controller[_0xd19c('0x10')]);router[_0xd19c('0x7')](_0xd19c('0x11'),auth['isAuthenticated'](),controller[_0xd19c('0x12')]);router[_0xd19c('0x7')](_0xd19c('0x13'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x14')]);router[_0xd19c('0x7')](_0xd19c('0x15'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x16')]);router['get'](_0xd19c('0x17'),auth[_0xd19c('0x9')](),controller['faxQueues']);router[_0xd19c('0x7')](_0xd19c('0x18'),auth[_0xd19c('0x9')](),controller['voiceQueuesPreview']);router[_0xd19c('0x7')]('/voice/queues/channels',auth[_0xd19c('0x9')](),controller[_0xd19c('0x19')]);router[_0xd19c('0x7')](_0xd19c('0x1a'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x1b')]);router[_0xd19c('0x7')](_0xd19c('0x1c'),auth[_0xd19c('0x9')](),controller['voiceQueuesChannelHangup']);router[_0xd19c('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xd19c('0x9')](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth[_0xd19c('0x9')](),controller[_0xd19c('0x1d')]);router[_0xd19c('0x7')](_0xd19c('0x1e'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x1f')]);router[_0xd19c('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xd19c('0x20')]);router['get'](_0xd19c('0x21'),auth['isAuthenticated'](),controller[_0xd19c('0x22')]);router[_0xd19c('0x23')](_0xd19c('0x24'),auth[_0xd19c('0x9')](),controller['agentCapacity']);router['get'](_0xd19c('0x25'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0xd19c('0x26'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x27')]);router['get'](_0xd19c('0x28'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x29')]);router[_0xd19c('0x7')](_0xd19c('0x2a'),auth['isAuthenticated'](),controller[_0xd19c('0x2b')]);router[_0xd19c('0x7')](_0xd19c('0x2c'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xd19c('0x7')](_0xd19c('0x2d'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x2e')]);router[_0xd19c('0x7')]('/openchannel/queues/waitinginteractions',auth[_0xd19c('0x9')](),controller[_0xd19c('0x2f')]);router['get'](_0xd19c('0x30'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x31')]);router['get'](_0xd19c('0x32'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x33')]);router[_0xd19c('0x7')](_0xd19c('0x34'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x35')]);router[_0xd19c('0x7')](_0xd19c('0x36'),auth[_0xd19c('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xd19c('0x37')](_0xd19c('0x38'),auth['isAuthenticated'](),controller['queueNotify'](_0xd19c('0x39')));router[_0xd19c('0x7')](_0xd19c('0x3a'),auth[_0xd19c('0x9')](),controller['showMailQueues']);router['post'](_0xd19c('0x3b'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x3c')]('chat'));router[_0xd19c('0x7')]('/chat/queues/:id',auth[_0xd19c('0x9')](),controller[_0xd19c('0x3d')]);router[_0xd19c('0x37')]('/fax/queues/:id/notify',auth[_0xd19c('0x9')](),controller[_0xd19c('0x3c')](_0xd19c('0x3e')));router['get'](_0xd19c('0x3f'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x40')]);router[_0xd19c('0x37')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0xd19c('0x3c')]('openchannel'));router[_0xd19c('0x7')](_0xd19c('0x41'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x42')]);router[_0xd19c('0x37')](_0xd19c('0x43'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x3c')](_0xd19c('0x44')));router[_0xd19c('0x37')](_0xd19c('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0xd19c('0x46')));router[_0xd19c('0x7')](_0xd19c('0x47'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x48')]);router['get'](_0xd19c('0x49'),auth[_0xd19c('0x9')](),controller['showWhatsappQueues']);router['post'](_0xd19c('0x4a'),auth[_0xd19c('0x9')](),controller[_0xd19c('0x4b')]);module[_0xd19c('0x4c')]=router; \ No newline at end of file +var _0x927c=['/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','queueNotify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','whatsapp'];(function(_0x84ea31,_0x23c55e){var _0xc9ae08=function(_0x3609d9){while(--_0x3609d9){_0x84ea31['push'](_0x84ea31['shift']());}};_0xc9ae08(++_0x23c55e);}(_0x927c,0xef));var _0xc927=function(_0xb21680,_0x5efdc4){_0xb21680=_0xb21680-0x0;var _0x9b9519=_0x927c[_0xb21680];return _0x9b9519;};'use strict';var multer=require(_0xc927('0x0'));var util=require('util');var path=require(_0xc927('0x1'));var express=require('express');var router=express[_0xc927('0x2')]();var auth=require(_0xc927('0x3'));var controller=require(_0xc927('0x4'));router[_0xc927('0x5')](_0xc927('0x6'),auth[_0xc927('0x7')](),controller[_0xc927('0x8')]);router[_0xc927('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xc927('0x7')](),controller[_0xc927('0x9')]);router[_0xc927('0x5')](_0xc927('0xa'),auth[_0xc927('0x7')](),controller[_0xc927('0xb')]);router[_0xc927('0x5')](_0xc927('0xc'),auth[_0xc927('0x7')](),controller[_0xc927('0xd')]);router[_0xc927('0x5')](_0xc927('0xe'),auth[_0xc927('0x7')](),controller[_0xc927('0xf')]);router[_0xc927('0x5')](_0xc927('0x10'),auth[_0xc927('0x7')](),controller[_0xc927('0x11')]);router[_0xc927('0x5')](_0xc927('0x12'),auth[_0xc927('0x7')](),controller[_0xc927('0x13')]);router[_0xc927('0x5')](_0xc927('0x14'),auth[_0xc927('0x7')](),controller['openchannelQueues']);router[_0xc927('0x5')](_0xc927('0x15'),auth[_0xc927('0x7')](),controller[_0xc927('0x16')]);router[_0xc927('0x5')](_0xc927('0x17'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xc927('0x5')]('/fax/queues',auth[_0xc927('0x7')](),controller[_0xc927('0x18')]);router['get'](_0xc927('0x19'),auth['isAuthenticated'](),controller[_0xc927('0x1a')]);router['get'](_0xc927('0x1b'),auth[_0xc927('0x7')](),controller[_0xc927('0x1c')]);router[_0xc927('0x5')](_0xc927('0x1d'),auth['isAuthenticated'](),controller[_0xc927('0x1e')]);router[_0xc927('0x5')](_0xc927('0x1f'),auth[_0xc927('0x7')](),controller[_0xc927('0x20')]);router[_0xc927('0x5')](_0xc927('0x21'),auth[_0xc927('0x7')](),controller[_0xc927('0x22')]);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xc927('0x5')](_0xc927('0x23'),auth[_0xc927('0x7')](),controller[_0xc927('0x24')]);router[_0xc927('0x5')]('/outbound/channels',auth[_0xc927('0x7')](),controller[_0xc927('0x25')]);router[_0xc927('0x5')](_0xc927('0x26'),auth[_0xc927('0x7')](),controller[_0xc927('0x27')]);router[_0xc927('0x28')](_0xc927('0x29'),auth['isAuthenticated'](),controller[_0xc927('0x2a')]);router['get'](_0xc927('0x2b'),auth[_0xc927('0x7')](),controller[_0xc927('0x2c')]);router[_0xc927('0x5')]('/trunks',auth[_0xc927('0x7')](),controller['trunks']);router[_0xc927('0x5')](_0xc927('0x2d'),auth['isAuthenticated'](),controller[_0xc927('0x2e')]);router[_0xc927('0x5')]('/fax/accounts',auth[_0xc927('0x7')](),controller[_0xc927('0x2f')]);router['get'](_0xc927('0x30'),auth[_0xc927('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xc927('0x5')](_0xc927('0x31'),auth[_0xc927('0x7')](),controller[_0xc927('0x32')]);router[_0xc927('0x5')](_0xc927('0x33'),auth[_0xc927('0x7')](),controller[_0xc927('0x34')]);router[_0xc927('0x5')](_0xc927('0x35'),auth[_0xc927('0x7')](),controller[_0xc927('0x36')]);router['get']('/sms/queues/waitinginteractions',auth[_0xc927('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0xc927('0x5')](_0xc927('0x37'),auth[_0xc927('0x7')](),controller[_0xc927('0x38')]);router[_0xc927('0x5')](_0xc927('0x39'),auth[_0xc927('0x7')](),controller[_0xc927('0x3a')]);router[_0xc927('0x3b')](_0xc927('0x3c'),auth[_0xc927('0x7')](),controller['queueNotify'](_0xc927('0x3d')));router[_0xc927('0x5')]('/mail/queues/:id',auth[_0xc927('0x7')](),controller['showMailQueues']);router[_0xc927('0x3b')](_0xc927('0x3e'),auth[_0xc927('0x7')](),controller['queueNotify']('chat'));router[_0xc927('0x5')](_0xc927('0x3f'),auth[_0xc927('0x7')](),controller[_0xc927('0x40')]);router[_0xc927('0x3b')](_0xc927('0x41'),auth['isAuthenticated'](),controller[_0xc927('0x42')](_0xc927('0x43')));router[_0xc927('0x5')]('/fax/queues/:id',auth[_0xc927('0x7')](),controller[_0xc927('0x44')]);router[_0xc927('0x3b')](_0xc927('0x45'),auth[_0xc927('0x7')](),controller[_0xc927('0x42')](_0xc927('0x46')));router[_0xc927('0x5')]('/openchannel/queues/:id',auth[_0xc927('0x7')](),controller[_0xc927('0x47')]);router[_0xc927('0x3b')]('/sms/queues/:id/notify',auth[_0xc927('0x7')](),controller[_0xc927('0x42')]('sms'));router[_0xc927('0x3b')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xc927('0x48')));router['get'](_0xc927('0x49'),auth['isAuthenticated'](),controller[_0xc927('0x4a')]);router['get'](_0xc927('0x4b'),auth[_0xc927('0x7')](),controller[_0xc927('0x4c')]);router[_0xc927('0x3b')]('/agents/:id/notify',auth[_0xc927('0x7')](),controller['agentNotify']);module[_0xc927('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a1b58cf..e96c756 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 _0xff14=['VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','From','Account','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Website','User','agent','Agent\x20not\x20found','queue','MessageId','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','api','http','client','request','error','code','message','status','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','then','catch','VoiceChannelMixMonitor','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','params','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel'];(function(_0x16a3dd,_0x593521){var _0x33705c=function(_0x478b2a){while(--_0x478b2a){_0x16a3dd['push'](_0x16a3dd['shift']());}};_0x33705c(++_0x593521);}(_0xff14,0x1cf));var _0x4ff1=function(_0xb1e279,_0x338e4a){_0xb1e279=_0xb1e279-0x0;var _0x39e55b=_0xff14[_0xb1e279];return _0x39e55b;};'use strict';var BPromise=require(_0x4ff1('0x0'));var moment=require(_0x4ff1('0x1'));var _=require(_0x4ff1('0x2'));var util=require(_0x4ff1('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x4ff1('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x4ff1('0x5')]({'port':0x232a});var mailClient=jayson[_0x4ff1('0x6')][_0x4ff1('0x5')]({'port':0x232b});var routingClient=jayson[_0x4ff1('0x6')][_0x4ff1('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x584d8d,_0x5425a4,_0x672a6){return new BPromise(function(_0x26c9b0,_0x37dc08){var _0x1900bb=_0x672a6?_0x672a6:amiClient;return _0x1900bb[_0x4ff1('0x7')](_0x584d8d,_0x5425a4)['then'](function(_0x1e3fe2){if(_0x1e3fe2[_0x4ff1('0x8')]){if(_0x1e3fe2[_0x4ff1('0x8')][_0x4ff1('0x9')]===0x1f4){return _0x37dc08(_0x1e3fe2['error'][_0x4ff1('0xa')]);}return _0x26c9b0(_0x1e3fe2[_0x4ff1('0x8')][_0x4ff1('0xa')]);}else{_0x26c9b0(_0x1e3fe2['result']);}})['catch'](function(_0x13b5da){_0x37dc08(_0x13b5da);});});}function respondWithResult(_0x3d1452,_0x46db9d){_0x46db9d=_0x46db9d||0xc8;return function(_0xb4f61c){if(_0xb4f61c){return _0x3d1452[_0x4ff1('0xb')](_0x46db9d)['json'](_0xb4f61c);}return _0x3d1452[_0x4ff1('0xc')](0x194);};}function handleError(_0x17ac68,_0x41b773){_0x41b773=_0x41b773||0x1f4;return function(_0x33f644){logger[_0x4ff1('0x8')](_0x33f644[_0x4ff1('0xd')]);if(_0x33f644['name']){delete _0x33f644[_0x4ff1('0xe')];}_0x17ac68['status'](_0x41b773)[_0x4ff1('0xf')](_0x33f644);};}function findById(_0x147072){return function(_0x3df231){if(!_['isNil'](_0x147072)&&!_[_0x4ff1('0x10')](_0x3df231)&&!_[_0x4ff1('0x10')](_0x3df231[_0x4ff1('0x11')])){return _[_0x4ff1('0x12')](_0x3df231[_0x4ff1('0x11')],function(_0x255390){return _0x255390['id']==_0x147072;});}return null;};}exports['voiceChannels']=function(_0x4f833c,_0x194987){return respondWithRpcPromise(_0x4ff1('0x13'),_0x4f833c['query'])[_0x4ff1('0x14')](respondWithResult(_0x194987,null))[_0x4ff1('0x15')](handleError(_0x194987,null));};exports['voiceChannelMixMonitor']=function(_0x1432fc,_0x6abee4){return respondWithRpcPromise(_0x4ff1('0x16'),_['merge'](_0x1432fc[_0x4ff1('0x17')],_0x1432fc['params']))[_0x4ff1('0x14')](respondWithResult(_0x6abee4,null))[_0x4ff1('0x15')](handleError(_0x6abee4,null));};exports[_0x4ff1('0x18')]=function(_0x58624d,_0x2357e6){return respondWithRpcPromise(_0x4ff1('0x19'),_[_0x4ff1('0x1a')](_0x58624d['query'],_0x58624d['params']))[_0x4ff1('0x14')](respondWithResult(_0x2357e6,null))['catch'](handleError(_0x2357e6,null));};exports[_0x4ff1('0x1b')]=function(_0x4261b1,_0x7a90fc){return respondWithRpcPromise(_0x4ff1('0x1c'),_0x4261b1[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x7a90fc,null))['catch'](handleError(_0x7a90fc,null));};exports[_0x4ff1('0x1d')]=function(_0x1c87cf,_0x6a82cb){return respondWithRpcPromise(_0x4ff1('0x1c'),_0x1c87cf[_0x4ff1('0x17')])[_0x4ff1('0x14')](findById(_0x1c87cf[_0x4ff1('0x1e')]['id']))['then'](respondWithResult(_0x6a82cb,null))[_0x4ff1('0x15')](handleError(_0x6a82cb,null));};exports[_0x4ff1('0x1f')]=function(_0x385e20,_0x3bf3ad){return respondWithRpcPromise(_0x4ff1('0x20'),_[_0x4ff1('0x1a')](_0x385e20[_0x4ff1('0x17')],_0x385e20[_0x4ff1('0x1e')]))['then'](respondWithResult(_0x3bf3ad,null))[_0x4ff1('0x15')](handleError(_0x3bf3ad,null));};exports[_0x4ff1('0x21')]=function(_0x1bebf3,_0x23da0c){return respondWithRpcPromise(_0x4ff1('0x22'),_0x1bebf3[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x23da0c,null))['catch'](handleError(_0x23da0c,null));};exports[_0x4ff1('0x23')]=function(_0x28712e,_0x44bff8){return respondWithRpcPromise(_0x4ff1('0x24'),_[_0x4ff1('0x1a')](_0x28712e['query'],_0x28712e[_0x4ff1('0x1e')]))['then'](respondWithResult(_0x44bff8,null))[_0x4ff1('0x15')](handleError(_0x44bff8,null));};exports['voiceQueuesChannelHangup']=function(_0xb1d607,_0x2485fb){return respondWithRpcPromise(_0x4ff1('0x25'),_[_0x4ff1('0x1a')](_0xb1d607[_0x4ff1('0x17')],_0xb1d607[_0x4ff1('0x1e')]))[_0x4ff1('0x14')](respondWithResult(_0x2485fb,null))[_0x4ff1('0x15')](handleError(_0x2485fb,null));};exports[_0x4ff1('0x26')]=function(_0x54fb9f,_0x3ce00f){return respondWithRpcPromise(_0x4ff1('0x27'),_[_0x4ff1('0x1a')](_0x54fb9f[_0x4ff1('0x17')],_0x54fb9f[_0x4ff1('0x1e')]))[_0x4ff1('0x14')](respondWithResult(_0x3ce00f,null))[_0x4ff1('0x15')](handleError(_0x3ce00f,null));};exports['outbound']=function(_0x81ea3f,_0x44d740){return respondWithRpcPromise(_0x4ff1('0x28'),_0x81ea3f[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x44d740,null))[_0x4ff1('0x15')](handleError(_0x44d740,null));};exports[_0x4ff1('0x29')]=function(_0x3e9249,_0x260cf0){return respondWithRpcPromise('OutboundChannels',_0x3e9249[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x260cf0,null))['catch'](handleError(_0x260cf0,null));};exports['agents']=function(_0x2712e2,_0x51ee07){var _0x307a98;return respondWithRpcPromise(_0x4ff1('0x2a'),_0x2712e2[_0x4ff1('0x17')])['then'](function(_0x459441){_0x307a98=_0x459441;return respondWithRpcPromise(_0x4ff1('0x2a'),_0x2712e2[_0x4ff1('0x17')],routingClient);})[_0x4ff1('0x14')](function(_0x5f4eb9){return _['merge']({},_0x5f4eb9,_0x307a98);})[_0x4ff1('0x14')](respondWithResult(_0x51ee07,null))[_0x4ff1('0x15')](handleError(_0x51ee07,null));};exports[_0x4ff1('0x2b')]=function(_0x1dbc7f,_0x49b7f7){if(_0x1dbc7f[_0x4ff1('0x2c')]&&_0x1dbc7f[_0x4ff1('0x2c')][_0x4ff1('0x2d')]&&_0x1dbc7f[_0x4ff1('0x2e')]&&_0x1dbc7f[_0x4ff1('0x2e')][_0x4ff1('0xe')]){for(var _0x1eb944 in _0x1dbc7f[_0x4ff1('0x2c')]['interaction']){if(_0x1dbc7f[_0x4ff1('0x2c')][_0x4ff1('0x2d')]['hasOwnProperty'](_0x1eb944)){db[_0x4ff1('0x2f')]['findAll']({'where':{'channel':_0x1eb944,'membername':_0x1dbc7f['user']['name'],'type':_0x4ff1('0x30'),'exitAt':null,'uniqueid':_0x1dbc7f['body'][_0x4ff1('0x2d')][_0x1eb944]&&_0x1dbc7f['body'][_0x4ff1('0x2d')][_0x1eb944][_0x4ff1('0x31')]?{'$notIn':_0x1dbc7f[_0x4ff1('0x2c')]['interaction'][_0x1eb944]}:{'$ne':null}}})['then'](function(_0x225dc9){var _0x5d0416=moment()[_0x4ff1('0x32')](_0x4ff1('0x33'));for(var _0x598f91=0x0,_0x4cf547=_0x225dc9['length'];_0x598f91<_0x4cf547;_0x598f91+=0x1){_0x225dc9[_0x598f91][_0x4ff1('0x34')]({'exitAt':_0x5d0416});}});for(var _0x2a33b8=0x0;_0x2a33b8<_0x1dbc7f[_0x4ff1('0x2c')][_0x4ff1('0x2d')][_0x1eb944]['length'];_0x2a33b8+=0x1){db['MemberReport'][_0x4ff1('0x35')]({'where':{'channel':_0x1eb944,'membername':_0x1dbc7f[_0x4ff1('0x2e')][_0x4ff1('0xe')],'type':_0x4ff1('0x30'),'uniqueid':_0x1dbc7f[_0x4ff1('0x2c')][_0x4ff1('0x2d')][_0x1eb944][_0x2a33b8],'exitAt':null},'defaults':{'channel':_0x1eb944,'membername':_0x1dbc7f[_0x4ff1('0x2e')]['name'],'interface':_[_0x4ff1('0x10')](_0x1dbc7f[_0x4ff1('0x2e')][_0x4ff1('0x36')])?util['format']('SIP/%s',_0x1dbc7f[_0x4ff1('0x2e')][_0x4ff1('0xe')]):_0x1dbc7f[_0x4ff1('0x2e')]['interface'],'type':'INTERACTION','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x1dbc7f['user'][_0x4ff1('0x37')],'uniqueid':_0x1dbc7f[_0x4ff1('0x2c')][_0x4ff1('0x2d')][_0x1eb944][_0x2a33b8]}});}}}}return respondWithRpcPromise(_0x4ff1('0x38'),{'id':_0x1dbc7f[_0x4ff1('0x1e')]['id'],'capacity':_0x1dbc7f[_0x4ff1('0x2c')][_0x4ff1('0x39')]},routingClient)[_0x4ff1('0x14')](respondWithResult(_0x49b7f7,null))[_0x4ff1('0x15')](handleError(_0x49b7f7,null));};exports[_0x4ff1('0x3a')]=function(_0x594b0,_0x514799){return respondWithRpcPromise(_0x4ff1('0x3b'),_0x594b0[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x514799,null))[_0x4ff1('0x15')](handleError(_0x514799,null));};exports['trunks']=function(_0x51c09b,_0x4c4e78){return respondWithRpcPromise('Trunks',_0x51c09b[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x4c4e78,null))[_0x4ff1('0x15')](handleError(_0x4c4e78,null));};exports[_0x4ff1('0x3c')]=function(_0x10261b,_0x2e7be1){return respondWithRpcPromise(_0x4ff1('0x3d'),_0x10261b[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x2e7be1,null))['catch'](handleError(_0x2e7be1,null));};exports[_0x4ff1('0x3e')]=function(_0x133185,_0x19e738){return respondWithRpcPromise(_0x4ff1('0x3f'),_0x133185['query'],routingClient)['then'](respondWithResult(_0x19e738,null))[_0x4ff1('0x15')](handleError(_0x19e738,null));};exports['showChatQueues']=function(_0xe161f7,_0x36dee4){return respondWithRpcPromise(_0x4ff1('0x3f'),_0xe161f7[_0x4ff1('0x17')],routingClient)['then'](findById(_0xe161f7['params']['id']))[_0x4ff1('0x14')](respondWithResult(_0x36dee4,null))['catch'](handleError(_0x36dee4,null));};exports[_0x4ff1('0x40')]=function(_0x2997a5,_0x4090b3){return respondWithRpcPromise(_0x4ff1('0x41'),_0x2997a5[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x4090b3,null))[_0x4ff1('0x15')](handleError(_0x4090b3,null));};exports[_0x4ff1('0x42')]=function(_0x332754,_0x448f58){return respondWithRpcPromise(_0x4ff1('0x41'),_0x332754[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](findById(_0x332754[_0x4ff1('0x1e')]['id']))['then'](respondWithResult(_0x448f58,null))[_0x4ff1('0x15')](handleError(_0x448f58,null));};exports[_0x4ff1('0x43')]=function(_0x1a5a57,_0x2082fd){return respondWithRpcPromise('MailAccounts',_0x1a5a57[_0x4ff1('0x17')],mailClient)[_0x4ff1('0x14')](respondWithResult(_0x2082fd,null))['catch'](handleError(_0x2082fd,null));};exports[_0x4ff1('0x44')]=function(_0x18fa4f,_0x4261be){return respondWithRpcPromise(_0x4ff1('0x45'),_0x18fa4f['query'],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x4261be,null))[_0x4ff1('0x15')](handleError(_0x4261be,null));};exports[_0x4ff1('0x46')]=function(_0x252144,_0x4ff4ec){return respondWithRpcPromise(_0x4ff1('0x45'),_0x252144['query'],routingClient)[_0x4ff1('0x14')](findById(_0x252144[_0x4ff1('0x1e')]['id']))[_0x4ff1('0x14')](respondWithResult(_0x4ff4ec,null))['catch'](handleError(_0x4ff4ec,null));};exports[_0x4ff1('0x47')]=function(_0x2a6e08,_0x5a936c){return respondWithRpcPromise('SmsQueues',_0x2a6e08[_0x4ff1('0x17')],routingClient)['then'](respondWithResult(_0x5a936c,null))[_0x4ff1('0x15')](handleError(_0x5a936c,null));};exports[_0x4ff1('0x48')]=function(_0x20fd1b,_0x318e3d){return respondWithRpcPromise(_0x4ff1('0x49'),_0x20fd1b[_0x4ff1('0x17')],routingClient)['then'](findById(_0x20fd1b[_0x4ff1('0x1e')]['id']))[_0x4ff1('0x14')](respondWithResult(_0x318e3d,null))['catch'](handleError(_0x318e3d,null));};exports[_0x4ff1('0x4a')]=function(_0x5b2238,_0xecdbac){return respondWithRpcPromise('WhatsappQueues',_0x5b2238[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](respondWithResult(_0xecdbac,null))[_0x4ff1('0x15')](handleError(_0xecdbac,null));};exports[_0x4ff1('0x4b')]=function(_0x321393,_0x2cdb52){return respondWithRpcPromise('WhatsappQueues',_0x321393[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](findById(_0x321393[_0x4ff1('0x1e')]['id']))[_0x4ff1('0x14')](respondWithResult(_0x2cdb52,null))[_0x4ff1('0x15')](handleError(_0x2cdb52,null));};exports['faxQueues']=function(_0x2a865d,_0x46005c){return respondWithRpcPromise('FaxQueues',_0x2a865d[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x46005c,null))['catch'](handleError(_0x46005c,null));};exports['showFaxQueues']=function(_0x3336dc,_0x4ef0ce){return respondWithRpcPromise(_0x4ff1('0x4c'),_0x3336dc[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](findById(_0x3336dc[_0x4ff1('0x1e')]['id']))[_0x4ff1('0x14')](respondWithResult(_0x4ef0ce,null))[_0x4ff1('0x15')](handleError(_0x4ef0ce,null));};exports[_0x4ff1('0x4d')]=function(_0x4a1910,_0x1234d0){return respondWithRpcPromise('FaxAccounts',_0x4a1910[_0x4ff1('0x17')])[_0x4ff1('0x14')](respondWithResult(_0x1234d0,null))[_0x4ff1('0x15')](handleError(_0x1234d0,null));};exports[_0x4ff1('0x4e')]=function(_0x239342,_0x5e5cef){return respondWithRpcPromise(_0x4ff1('0x4f'),_0x239342[_0x4ff1('0x17')],routingClient)['then'](respondWithResult(_0x5e5cef,null))[_0x4ff1('0x15')](handleError(_0x5e5cef,null));};exports[_0x4ff1('0x50')]=function(_0x113fef,_0x25fc95){return respondWithRpcPromise(_0x4ff1('0x51'),_0x113fef['query'],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x25fc95,null))[_0x4ff1('0x15')](handleError(_0x25fc95,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4c7ae4,_0x67efe3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4c7ae4[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x67efe3,null))['catch'](handleError(_0x67efe3,null));};exports[_0x4ff1('0x52')]=function(_0x4917b5,_0x55578c){return respondWithRpcPromise(_0x4ff1('0x53'),_0x4917b5[_0x4ff1('0x17')],routingClient)['then'](function(_0x33ef0f){if(_0x4917b5[_0x4ff1('0x17')][_0x4ff1('0x54')]!==undefined){var _0x2ac741=_(_0x33ef0f[_0x4ff1('0x11')])[_0x4ff1('0x55')]([_0x4917b5[_0x4ff1('0x17')]['type'],_0x4917b5[_0x4ff1('0x1e')]['id']])[_0x4ff1('0x56')](_0x4ff1('0x57'))[_0x4ff1('0x58')]()[_0x4ff1('0x59')]();return _0x33ef0f[_0x4ff1('0x11')][_0x4ff1('0x55')](function(_0x268f13){return _0x2ac741[_0x4ff1('0x5a')](_0x268f13[_0x4ff1('0x57')])>-0x1;});}else{return _0x33ef0f[_0x4ff1('0x11')][_0x4ff1('0x55')](function(_0x2cfa97){return _0x2cfa97[_0x4ff1('0x57')]===parseInt(_0x4917b5[_0x4ff1('0x1e')]['id']);});}})[_0x4ff1('0x14')](respondWithResult(_0x55578c,null))[_0x4ff1('0x15')](handleError(_0x55578c,null));};exports[_0x4ff1('0x5b')]=function(_0x36c60a,_0x487996){return respondWithRpcPromise(_0x4ff1('0x5c'),_0x36c60a['query'],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x487996,null))[_0x4ff1('0x15')](handleError(_0x487996,null));};exports[_0x4ff1('0x5d')]=function(_0x303c0b,_0xb886f1){return respondWithRpcPromise(_0x4ff1('0x5e'),_0x303c0b['query'],routingClient)[_0x4ff1('0x14')](respondWithResult(_0xb886f1,null))[_0x4ff1('0x15')](handleError(_0xb886f1,null));};exports['faxQueuesWaitingInteractions']=function(_0x24113b,_0x35598b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x24113b[_0x4ff1('0x17')],routingClient)[_0x4ff1('0x14')](respondWithResult(_0x35598b,null))['catch'](handleError(_0x35598b,null));};exports[_0x4ff1('0x5f')]=function(_0x6bf756){return function(_0x537ac4,_0x27edaa){var _0x2e474b,_0x5138b9;var _0x203898=_[_0x4ff1('0x60')](_0x6bf756);var _0x3dfd98=_0x6bf756===_0x4ff1('0x61')?'Website':'Account';return db[_0x203898+_0x4ff1('0x62')][_0x4ff1('0x63')]({'raw':!![],'where':{'id':_0x537ac4[_0x4ff1('0x1e')]['id']}})[_0x4ff1('0x14')](function(_0x2ff36b){if(_[_0x4ff1('0x10')](_0x2ff36b)){throw new Error(_0x203898+_0x4ff1('0x64'));}_0x2e474b=_0x2ff36b;return db[_0x203898+_0x4ff1('0x65')][_0x4ff1('0x63')]({'where':{'id':_0x537ac4[_0x4ff1('0x2c')][_0x4ff1('0x66')]},'include':[{'model':db[_0x203898+'Interaction'],'as':_0x4ff1('0x67')},{'model':db[_0x203898+_0x3dfd98],'as':'Account'}]});})[_0x4ff1('0x14')](function(_0x31acd9){if(_[_0x4ff1('0x10')](_0x31acd9)){throw new Error(_0x203898+_0x4ff1('0x68'));}_0x5138b9=_0x31acd9;return _0x31acd9[_0x4ff1('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ff1('0x14')](function(){var _0x47e9b7={'uniqueid':_0x6bf756+'.'+_0x5138b9['id']+'.'+_0x5138b9[_0x4ff1('0x67')]['id'],'FromUserId':_0x537ac4[_0x4ff1('0x2e')]['id'],'type':'queue'};_0x47e9b7[_0x203898+'MessageId']=_0x5138b9['id'];_0x47e9b7[_0x203898+_0x4ff1('0x6a')]=_0x5138b9[_0x4ff1('0x67')]['id'];_0x47e9b7[_0x4ff1('0x6b')+_0x203898+_0x3dfd98+'Id']=_0x5138b9[_0x4ff1('0x6c')]['id'];_0x47e9b7['To'+_0x203898+_0x4ff1('0x6d')]=_0x2e474b['id'];return db[_0x203898+'TransferReport'][_0x4ff1('0x6e')](_0x47e9b7);})['then'](function(){return respondWithRpcPromise(_0x4ff1('0x6f'),{'channel':_0x6bf756,'interaction':_0x5138b9[_0x4ff1('0x67')],'message':_0x5138b9,'account':_0x5138b9['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2e474b[_0x4ff1('0xe')]+','+(_0x5138b9[_0x4ff1('0x6c')][_0x4ff1('0x70')]||0x12c),'interval':_0x4ff1('0x71')}]},routingClient);})[_0x4ff1('0x14')](respondWithResult(_0x27edaa,null))[_0x4ff1('0x15')](handleError(_0x27edaa,null));};};exports[_0x4ff1('0x72')]=function(_0x1eae72,_0x3ceb0a){var _0xa38ca,_0x19a124;if(_[_0x4ff1('0x10')](_0x1eae72[_0x4ff1('0x2c')]['channel'])){throw new Error(_0x4ff1('0x73'));}var _0x1214ad=_0x1eae72[_0x4ff1('0x2c')][_0x4ff1('0x74')];var _0x248cd5=_[_0x4ff1('0x60')](_0x1214ad);var _0x36aeb9=_0x1214ad===_0x4ff1('0x61')?_0x4ff1('0x75'):_0x4ff1('0x6c');return db[_0x4ff1('0x76')]['findOne']({'raw':!![],'where':{'id':_0x1eae72[_0x4ff1('0x1e')]['id'],'role':_0x4ff1('0x77')}})['then'](function(_0x345022){if(_['isNil'](_0x345022)){throw new Error(_0x4ff1('0x78'));}_0xa38ca=_0x345022;return db[_0x248cd5+_0x4ff1('0x65')][_0x4ff1('0x63')]({'where':{'id':_0x1eae72['body'][_0x4ff1('0x66')]},'include':[{'model':db[_0x248cd5+'Interaction'],'as':_0x4ff1('0x67')},{'model':db[_0x248cd5+_0x36aeb9],'as':_0x4ff1('0x6c')}]});})[_0x4ff1('0x14')](function(_0x5bfbd3){if(_[_0x4ff1('0x10')](_0x5bfbd3)){throw new Error(_0x248cd5+_0x4ff1('0x68'));}_0x19a124=_0x5bfbd3;return _0x5bfbd3[_0x4ff1('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ff1('0x14')](function(){var _0x143cd6={'uniqueid':_0x1214ad+'.'+_0x19a124['id']+'.'+_0x19a124['Interaction']['id'],'FromUserId':_0x1eae72['user']['id'],'type':_0x4ff1('0x79'),'ToUserId':_0xa38ca['id']};_0x143cd6[_0x248cd5+_0x4ff1('0x7a')]=_0x19a124['id'];_0x143cd6[_0x248cd5+_0x4ff1('0x6a')]=_0x19a124[_0x4ff1('0x67')]['id'];_0x143cd6['From'+_0x248cd5+_0x36aeb9+'Id']=_0x19a124[_0x4ff1('0x6c')]['id'];return db[_0x248cd5+_0x4ff1('0x7b')][_0x4ff1('0x6e')](_0x143cd6);})[_0x4ff1('0x14')](function(){return respondWithRpcPromise(_0x4ff1('0x6f'),{'channel':_0x1214ad,'interaction':_0x19a124[_0x4ff1('0x67')],'message':_0x19a124,'account':_0x19a124[_0x4ff1('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ff1('0x77'),'appdata':_0xa38ca['name']+','+(_0x19a124[_0x4ff1('0x6c')][_0x4ff1('0x7c')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4ff1('0x14')](respondWithResult(_0x3ceb0a,null))['catch'](handleError(_0x3ceb0a,null));}; \ No newline at end of file +var _0x3c85=['code','message','result','catch','json','sendStatus','stack','name','status','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','uniq','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','InteractionId','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','MessageId','From','Start','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c85,0x78));var _0x53c8=function(_0x329825,_0x16e7f3){_0x329825=_0x329825-0x0;var _0x200e2c=_0x3c85[_0x329825];return _0x200e2c;};'use strict';var BPromise=require(_0x53c8('0x0'));var moment=require(_0x53c8('0x1'));var _=require(_0x53c8('0x2'));var util=require(_0x53c8('0x3'));var db=require(_0x53c8('0x4'))['db'];var logger=require('../../config/logger')(_0x53c8('0x5'));var jayson=require(_0x53c8('0x6'));var amiClient=jayson[_0x53c8('0x7')][_0x53c8('0x8')]({'port':0x232a});var mailClient=jayson[_0x53c8('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x53c8('0x7')][_0x53c8('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x158d78,_0x91aa15,_0x14a9b6){return new BPromise(function(_0x1197a9,_0x17b862){var _0x47d292=_0x14a9b6?_0x14a9b6:amiClient;return _0x47d292['request'](_0x158d78,_0x91aa15)[_0x53c8('0x9')](function(_0x2b764b){if(_0x2b764b['error']){if(_0x2b764b[_0x53c8('0xa')][_0x53c8('0xb')]===0x1f4){return _0x17b862(_0x2b764b[_0x53c8('0xa')][_0x53c8('0xc')]);}return _0x1197a9(_0x2b764b[_0x53c8('0xa')][_0x53c8('0xc')]);}else{_0x1197a9(_0x2b764b[_0x53c8('0xd')]);}})[_0x53c8('0xe')](function(_0x26ebd4){_0x17b862(_0x26ebd4);});});}function respondWithResult(_0x23a44c,_0x245564){_0x245564=_0x245564||0xc8;return function(_0x141f8b){if(_0x141f8b){return _0x23a44c['status'](_0x245564)[_0x53c8('0xf')](_0x141f8b);}return _0x23a44c[_0x53c8('0x10')](0x194);};}function handleError(_0xb546d1,_0x537fca){_0x537fca=_0x537fca||0x1f4;return function(_0x5e958){logger['error'](_0x5e958[_0x53c8('0x11')]);if(_0x5e958[_0x53c8('0x12')]){delete _0x5e958[_0x53c8('0x12')];}_0xb546d1[_0x53c8('0x13')](_0x537fca)['send'](_0x5e958);};}function findById(_0x25e8db){return function(_0x55ec32){if(!_[_0x53c8('0x14')](_0x25e8db)&&!_[_0x53c8('0x14')](_0x55ec32)&&!_['isNil'](_0x55ec32[_0x53c8('0x15')])){return _[_0x53c8('0x16')](_0x55ec32[_0x53c8('0x15')],function(_0x50479c){return _0x50479c['id']==_0x25e8db;});}return null;};}exports[_0x53c8('0x17')]=function(_0x137baa,_0x28fa48){return respondWithRpcPromise(_0x53c8('0x18'),_0x137baa['query'])[_0x53c8('0x9')](respondWithResult(_0x28fa48,null))[_0x53c8('0xe')](handleError(_0x28fa48,null));};exports[_0x53c8('0x19')]=function(_0x5a51a3,_0x4dbeef){return respondWithRpcPromise(_0x53c8('0x1a'),_[_0x53c8('0x1b')](_0x5a51a3[_0x53c8('0x1c')],_0x5a51a3[_0x53c8('0x1d')]))[_0x53c8('0x9')](respondWithResult(_0x4dbeef,null))[_0x53c8('0xe')](handleError(_0x4dbeef,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a6015,_0x48de25){return respondWithRpcPromise(_0x53c8('0x1e'),_[_0x53c8('0x1b')](_0x1a6015['query'],_0x1a6015[_0x53c8('0x1d')]))[_0x53c8('0x9')](respondWithResult(_0x48de25,null))['catch'](handleError(_0x48de25,null));};exports[_0x53c8('0x1f')]=function(_0x207b64,_0x4e08cf){return respondWithRpcPromise(_0x53c8('0x20'),_0x207b64[_0x53c8('0x1c')])[_0x53c8('0x9')](respondWithResult(_0x4e08cf,null))[_0x53c8('0xe')](handleError(_0x4e08cf,null));};exports[_0x53c8('0x21')]=function(_0x48c6b4,_0x278590){return respondWithRpcPromise(_0x53c8('0x20'),_0x48c6b4['query'])[_0x53c8('0x9')](findById(_0x48c6b4[_0x53c8('0x1d')]['id']))['then'](respondWithResult(_0x278590,null))[_0x53c8('0xe')](handleError(_0x278590,null));};exports['voiceQueuesPreview']=function(_0x3251a9,_0x3c6c7d){return respondWithRpcPromise(_0x53c8('0x22'),_['merge'](_0x3251a9['query'],_0x3251a9['params']))[_0x53c8('0x9')](respondWithResult(_0x3c6c7d,null))[_0x53c8('0xe')](handleError(_0x3c6c7d,null));};exports[_0x53c8('0x23')]=function(_0x125d2c,_0x31f3c6){return respondWithRpcPromise(_0x53c8('0x24'),_0x125d2c[_0x53c8('0x1c')])[_0x53c8('0x9')](respondWithResult(_0x31f3c6,null))[_0x53c8('0xe')](handleError(_0x31f3c6,null));};exports[_0x53c8('0x25')]=function(_0x134bd9,_0x1b4204){return respondWithRpcPromise(_0x53c8('0x26'),_[_0x53c8('0x1b')](_0x134bd9[_0x53c8('0x1c')],_0x134bd9['params']))[_0x53c8('0x9')](respondWithResult(_0x1b4204,null))[_0x53c8('0xe')](handleError(_0x1b4204,null));};exports[_0x53c8('0x27')]=function(_0x3c7b70,_0x1fb20f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x3c7b70[_0x53c8('0x1c')],_0x3c7b70['params']))[_0x53c8('0x9')](respondWithResult(_0x1fb20f,null))[_0x53c8('0xe')](handleError(_0x1fb20f,null));};exports[_0x53c8('0x28')]=function(_0x3eb5b9,_0x40ba27){return respondWithRpcPromise(_0x53c8('0x29'),_[_0x53c8('0x1b')](_0x3eb5b9['query'],_0x3eb5b9[_0x53c8('0x1d')]))['then'](respondWithResult(_0x40ba27,null))[_0x53c8('0xe')](handleError(_0x40ba27,null));};exports['outbound']=function(_0x403e6a,_0x188cb4){return respondWithRpcPromise('Outbound',_0x403e6a['query'])['then'](respondWithResult(_0x188cb4,null))[_0x53c8('0xe')](handleError(_0x188cb4,null));};exports[_0x53c8('0x2a')]=function(_0x59e1d0,_0x7546d0){return respondWithRpcPromise(_0x53c8('0x2b'),_0x59e1d0[_0x53c8('0x1c')])[_0x53c8('0x9')](respondWithResult(_0x7546d0,null))[_0x53c8('0xe')](handleError(_0x7546d0,null));};exports['agents']=function(_0x186d42,_0x1d5df1){var _0x10d249;return respondWithRpcPromise(_0x53c8('0x2c'),_0x186d42[_0x53c8('0x1c')])[_0x53c8('0x9')](function(_0x221b36){_0x10d249=_0x221b36;return respondWithRpcPromise(_0x53c8('0x2c'),_0x186d42[_0x53c8('0x1c')],routingClient);})[_0x53c8('0x9')](function(_0x377828){return _['merge']({},_0x377828,_0x10d249);})[_0x53c8('0x9')](respondWithResult(_0x1d5df1,null))[_0x53c8('0xe')](handleError(_0x1d5df1,null));};exports[_0x53c8('0x2d')]=function(_0x206a04,_0x3c7dc1){if(_0x206a04[_0x53c8('0x2e')]&&_0x206a04[_0x53c8('0x2e')][_0x53c8('0x2f')]&&_0x206a04[_0x53c8('0x30')]&&_0x206a04[_0x53c8('0x30')]['name']){for(var _0x4cd77f in _0x206a04[_0x53c8('0x2e')]['interaction']){if(_0x206a04[_0x53c8('0x2e')]['interaction'][_0x53c8('0x31')](_0x4cd77f)){db[_0x53c8('0x32')][_0x53c8('0x33')]({'where':{'channel':_0x4cd77f,'membername':_0x206a04['user']['name'],'type':_0x53c8('0x34'),'exitAt':null,'uniqueid':_0x206a04['body'][_0x53c8('0x2f')][_0x4cd77f]&&_0x206a04[_0x53c8('0x2e')][_0x53c8('0x2f')][_0x4cd77f][_0x53c8('0x35')]?{'$notIn':_0x206a04[_0x53c8('0x2e')][_0x53c8('0x2f')][_0x4cd77f]}:{'$ne':null}}})['then'](function(_0x20ab22){var _0x3fa18e=moment()[_0x53c8('0x36')](_0x53c8('0x37'));for(var _0x56c971=0x0,_0x3f76db=_0x20ab22['length'];_0x56c971<_0x3f76db;_0x56c971+=0x1){_0x20ab22[_0x56c971][_0x53c8('0x38')]({'exitAt':_0x3fa18e});}});for(var _0x36da92=0x0;_0x36da92<_0x206a04[_0x53c8('0x2e')][_0x53c8('0x2f')][_0x4cd77f][_0x53c8('0x35')];_0x36da92+=0x1){db[_0x53c8('0x32')][_0x53c8('0x39')]({'where':{'channel':_0x4cd77f,'membername':_0x206a04['user'][_0x53c8('0x12')],'type':'INTERACTION','uniqueid':_0x206a04['body']['interaction'][_0x4cd77f][_0x36da92],'exitAt':null},'defaults':{'channel':_0x4cd77f,'membername':_0x206a04[_0x53c8('0x30')]['name'],'interface':_[_0x53c8('0x14')](_0x206a04[_0x53c8('0x30')]['interface'])?util[_0x53c8('0x36')](_0x53c8('0x3a'),_0x206a04[_0x53c8('0x30')]['name']):_0x206a04[_0x53c8('0x30')][_0x53c8('0x3b')],'type':'INTERACTION','enterAt':moment()[_0x53c8('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x53c8('0x3c'),'internal':_0x206a04[_0x53c8('0x30')][_0x53c8('0x3d')],'uniqueid':_0x206a04['body']['interaction'][_0x4cd77f][_0x36da92]}});}}}}return respondWithRpcPromise(_0x53c8('0x3e'),{'id':_0x206a04['params']['id'],'capacity':_0x206a04[_0x53c8('0x2e')][_0x53c8('0x3f')]},routingClient)[_0x53c8('0x9')](respondWithResult(_0x3c7dc1,null))[_0x53c8('0xe')](handleError(_0x3c7dc1,null));};exports[_0x53c8('0x40')]=function(_0x32f9b8,_0x1664b2){return respondWithRpcPromise(_0x53c8('0x41'),_0x32f9b8[_0x53c8('0x1c')])['then'](respondWithResult(_0x1664b2,null))[_0x53c8('0xe')](handleError(_0x1664b2,null));};exports[_0x53c8('0x42')]=function(_0x374a89,_0x479f72){return respondWithRpcPromise(_0x53c8('0x43'),_0x374a89['query'])[_0x53c8('0x9')](respondWithResult(_0x479f72,null))['catch'](handleError(_0x479f72,null));};exports[_0x53c8('0x44')]=function(_0x5aa649,_0x4b4989){return respondWithRpcPromise(_0x53c8('0x45'),_0x5aa649['query'])[_0x53c8('0x9')](respondWithResult(_0x4b4989,null))[_0x53c8('0xe')](handleError(_0x4b4989,null));};exports[_0x53c8('0x46')]=function(_0x5dac29,_0x22e39c){return respondWithRpcPromise(_0x53c8('0x47'),_0x5dac29['query'],routingClient)[_0x53c8('0x9')](respondWithResult(_0x22e39c,null))[_0x53c8('0xe')](handleError(_0x22e39c,null));};exports['showChatQueues']=function(_0x11b183,_0x6d7739){return respondWithRpcPromise(_0x53c8('0x47'),_0x11b183[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](findById(_0x11b183[_0x53c8('0x1d')]['id']))[_0x53c8('0x9')](respondWithResult(_0x6d7739,null))['catch'](handleError(_0x6d7739,null));};exports[_0x53c8('0x48')]=function(_0x363642,_0x2beceb){return respondWithRpcPromise(_0x53c8('0x49'),_0x363642[_0x53c8('0x1c')],routingClient)['then'](respondWithResult(_0x2beceb,null))[_0x53c8('0xe')](handleError(_0x2beceb,null));};exports[_0x53c8('0x4a')]=function(_0x2ffc58,_0x57bbc9){return respondWithRpcPromise(_0x53c8('0x49'),_0x2ffc58[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](findById(_0x2ffc58[_0x53c8('0x1d')]['id']))['then'](respondWithResult(_0x57bbc9,null))[_0x53c8('0xe')](handleError(_0x57bbc9,null));};exports[_0x53c8('0x4b')]=function(_0x5db147,_0x534344){return respondWithRpcPromise(_0x53c8('0x4c'),_0x5db147['query'],mailClient)[_0x53c8('0x9')](respondWithResult(_0x534344,null))[_0x53c8('0xe')](handleError(_0x534344,null));};exports[_0x53c8('0x4d')]=function(_0x13aa56,_0x16a02d){return respondWithRpcPromise(_0x53c8('0x4e'),_0x13aa56[_0x53c8('0x1c')],routingClient)['then'](respondWithResult(_0x16a02d,null))[_0x53c8('0xe')](handleError(_0x16a02d,null));};exports[_0x53c8('0x4f')]=function(_0x234937,_0x3399d8){return respondWithRpcPromise(_0x53c8('0x4e'),_0x234937[_0x53c8('0x1c')],routingClient)['then'](findById(_0x234937['params']['id']))[_0x53c8('0x9')](respondWithResult(_0x3399d8,null))['catch'](handleError(_0x3399d8,null));};exports['smsQueues']=function(_0x4de7ab,_0x55fef4){return respondWithRpcPromise(_0x53c8('0x50'),_0x4de7ab[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x55fef4,null))[_0x53c8('0xe')](handleError(_0x55fef4,null));};exports['showSmsQueues']=function(_0x4f2f60,_0x11ca18){return respondWithRpcPromise('SmsQueues',_0x4f2f60[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](findById(_0x4f2f60['params']['id']))[_0x53c8('0x9')](respondWithResult(_0x11ca18,null))[_0x53c8('0xe')](handleError(_0x11ca18,null));};exports[_0x53c8('0x51')]=function(_0x1af5c6,_0x3b7b48){return respondWithRpcPromise(_0x53c8('0x52'),_0x1af5c6[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x3b7b48,null))['catch'](handleError(_0x3b7b48,null));};exports[_0x53c8('0x53')]=function(_0x55ac0a,_0xaf47c){return respondWithRpcPromise(_0x53c8('0x52'),_0x55ac0a['query'],routingClient)['then'](findById(_0x55ac0a[_0x53c8('0x1d')]['id']))[_0x53c8('0x9')](respondWithResult(_0xaf47c,null))['catch'](handleError(_0xaf47c,null));};exports['faxQueues']=function(_0x3cd098,_0x474aaf){return respondWithRpcPromise(_0x53c8('0x54'),_0x3cd098[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x474aaf,null))[_0x53c8('0xe')](handleError(_0x474aaf,null));};exports[_0x53c8('0x55')]=function(_0x1cfeae,_0x322794){return respondWithRpcPromise('FaxQueues',_0x1cfeae[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](findById(_0x1cfeae[_0x53c8('0x1d')]['id']))['then'](respondWithResult(_0x322794,null))[_0x53c8('0xe')](handleError(_0x322794,null));};exports[_0x53c8('0x56')]=function(_0x1cb2a6,_0x4aedb8){return respondWithRpcPromise(_0x53c8('0x57'),_0x1cb2a6[_0x53c8('0x1c')])[_0x53c8('0x9')](respondWithResult(_0x4aedb8,null))['catch'](handleError(_0x4aedb8,null));};exports[_0x53c8('0x58')]=function(_0x435d7a,_0x5de8b6){return respondWithRpcPromise(_0x53c8('0x59'),_0x435d7a['query'],routingClient)[_0x53c8('0x9')](respondWithResult(_0x5de8b6,null))['catch'](handleError(_0x5de8b6,null));};exports[_0x53c8('0x5a')]=function(_0x57bf2f,_0x1a003b){return respondWithRpcPromise(_0x53c8('0x5b'),_0x57bf2f[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x1a003b,null))[_0x53c8('0xe')](handleError(_0x1a003b,null));};exports[_0x53c8('0x5c')]=function(_0x5e2d80,_0x222224){return respondWithRpcPromise(_0x53c8('0x5d'),_0x5e2d80[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x222224,null))[_0x53c8('0xe')](handleError(_0x222224,null));};exports[_0x53c8('0x5e')]=function(_0x3506b5,_0x569a93){return respondWithRpcPromise(_0x53c8('0x5d'),_0x3506b5['query'],routingClient)[_0x53c8('0x9')](function(_0x497818){if(_0x3506b5[_0x53c8('0x1c')][_0x53c8('0x5f')]!==undefined){var _0x5e9b5d=_(_0x497818[_0x53c8('0x15')])['filter']([_0x3506b5[_0x53c8('0x1c')][_0x53c8('0x5f')],_0x3506b5[_0x53c8('0x1d')]['id']])[_0x53c8('0x60')]('queue_id')[_0x53c8('0x61')]()['value']();return _0x497818[_0x53c8('0x15')]['filter'](function(_0x5bef8e){return _0x5e9b5d[_0x53c8('0x62')](_0x5bef8e[_0x53c8('0x63')])>-0x1;});}else{return _0x497818['rows']['filter'](function(_0x1a42ff){return _0x1a42ff[_0x53c8('0x63')]===parseInt(_0x3506b5[_0x53c8('0x1d')]['id']);});}})[_0x53c8('0x9')](respondWithResult(_0x569a93,null))[_0x53c8('0xe')](handleError(_0x569a93,null));};exports[_0x53c8('0x64')]=function(_0x5b0477,_0x3e8b71){return respondWithRpcPromise(_0x53c8('0x65'),_0x5b0477[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x3e8b71,null))[_0x53c8('0xe')](handleError(_0x3e8b71,null));};exports[_0x53c8('0x66')]=function(_0x5cfea0,_0x187ee7){return respondWithRpcPromise(_0x53c8('0x67'),_0x5cfea0[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0x187ee7,null))['catch'](handleError(_0x187ee7,null));};exports[_0x53c8('0x68')]=function(_0x30403d,_0xf0385c){return respondWithRpcPromise(_0x53c8('0x69'),_0x30403d[_0x53c8('0x1c')],routingClient)[_0x53c8('0x9')](respondWithResult(_0xf0385c,null))['catch'](handleError(_0xf0385c,null));};exports['queueNotify']=function(_0x49c88e){return function(_0x224848,_0xa08d10){var _0x2eee27,_0x148b0d;var _0x4676b3=_[_0x53c8('0x6a')](_0x49c88e);var _0x31f96d=_0x49c88e===_0x53c8('0x6b')?_0x53c8('0x6c'):_0x53c8('0x6d');return db[_0x4676b3+'Queue'][_0x53c8('0x6e')]({'raw':!![],'where':{'id':_0x224848['params']['id']}})[_0x53c8('0x9')](function(_0xd0d2d2){if(_['isNil'](_0xd0d2d2)){throw new Error(_0x4676b3+'\x20Queue\x20not\x20found');}_0x2eee27=_0xd0d2d2;return db[_0x4676b3+_0x53c8('0x6f')][_0x53c8('0x6e')]({'where':{'id':_0x224848['body'][_0x53c8('0x70')]},'include':[{'model':db[_0x4676b3+_0x53c8('0x71')],'as':'Interaction'},{'model':db[_0x4676b3+_0x31f96d],'as':_0x53c8('0x6d')}]});})['then'](function(_0x37e87e){if(_['isNil'](_0x37e87e)){throw new Error(_0x4676b3+'\x20Message\x20not\x20found');}_0x148b0d=_0x37e87e;return _0x37e87e['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4ec94a={'uniqueid':_0x49c88e+'.'+_0x148b0d['id']+'.'+_0x148b0d[_0x53c8('0x71')]['id'],'FromUserId':_0x224848[_0x53c8('0x30')]['id'],'type':'queue'};_0x4ec94a[_0x4676b3+'MessageId']=_0x148b0d['id'];_0x4ec94a[_0x4676b3+_0x53c8('0x72')]=_0x148b0d[_0x53c8('0x71')]['id'];_0x4ec94a['From'+_0x4676b3+_0x31f96d+'Id']=_0x148b0d[_0x53c8('0x6d')]['id'];_0x4ec94a['To'+_0x4676b3+_0x53c8('0x73')]=_0x2eee27['id'];return db[_0x4676b3+_0x53c8('0x74')][_0x53c8('0x75')](_0x4ec94a);})[_0x53c8('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x49c88e,'interaction':_0x148b0d[_0x53c8('0x71')],'message':_0x148b0d,'account':_0x148b0d[_0x53c8('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x53c8('0x76'),'appdata':_0x2eee27[_0x53c8('0x12')]+','+(_0x148b0d['Account'][_0x53c8('0x77')]||0x12c),'interval':_0x53c8('0x78')}]},routingClient);})[_0x53c8('0x9')](respondWithResult(_0xa08d10,null))[_0x53c8('0xe')](handleError(_0xa08d10,null));};};exports[_0x53c8('0x79')]=function(_0x41df1c,_0x132f34){var _0x408220,_0x52aa5e;if(_['isNil'](_0x41df1c[_0x53c8('0x2e')][_0x53c8('0x7a')])){throw new Error(_0x53c8('0x7b'));}var _0xbdc437=_0x41df1c[_0x53c8('0x2e')][_0x53c8('0x7a')];var _0x5adbb4=_[_0x53c8('0x6a')](_0xbdc437);var _0x2a4d75=_0xbdc437==='chat'?'Website':'Account';return db[_0x53c8('0x7c')][_0x53c8('0x6e')]({'raw':!![],'where':{'id':_0x41df1c[_0x53c8('0x1d')]['id'],'role':_0x53c8('0x3c')}})[_0x53c8('0x9')](function(_0x529ba7){if(_[_0x53c8('0x14')](_0x529ba7)){throw new Error(_0x53c8('0x7d'));}_0x408220=_0x529ba7;return db[_0x5adbb4+_0x53c8('0x6f')][_0x53c8('0x6e')]({'where':{'id':_0x41df1c[_0x53c8('0x2e')][_0x53c8('0x70')]},'include':[{'model':db[_0x5adbb4+_0x53c8('0x71')],'as':_0x53c8('0x71')},{'model':db[_0x5adbb4+_0x2a4d75],'as':'Account'}]});})[_0x53c8('0x9')](function(_0x51370a){if(_[_0x53c8('0x14')](_0x51370a)){throw new Error(_0x5adbb4+_0x53c8('0x7e'));}_0x52aa5e=_0x51370a;return _0x51370a[_0x53c8('0x7f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x53c8('0x9')](function(){var _0x5e203a={'uniqueid':_0xbdc437+'.'+_0x52aa5e['id']+'.'+_0x52aa5e[_0x53c8('0x71')]['id'],'FromUserId':_0x41df1c[_0x53c8('0x30')]['id'],'type':_0x53c8('0x76'),'ToUserId':_0x408220['id']};_0x5e203a[_0x5adbb4+_0x53c8('0x80')]=_0x52aa5e['id'];_0x5e203a[_0x5adbb4+'InteractionId']=_0x52aa5e[_0x53c8('0x71')]['id'];_0x5e203a[_0x53c8('0x81')+_0x5adbb4+_0x2a4d75+'Id']=_0x52aa5e[_0x53c8('0x6d')]['id'];return db[_0x5adbb4+_0x53c8('0x74')][_0x53c8('0x75')](_0x5e203a);})[_0x53c8('0x9')](function(){return respondWithRpcPromise(_0x53c8('0x82'),{'channel':_0xbdc437,'interaction':_0x52aa5e['Interaction'],'message':_0x52aa5e,'account':_0x52aa5e[_0x53c8('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x53c8('0x3c'),'appdata':_0x408220['name']+','+(_0x52aa5e[_0x53c8('0x6d')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x53c8('0x9')](respondWithResult(_0x132f34,null))[_0x53c8('0xe')](handleError(_0x132f34,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f811698..1ca1e31 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 _0x50a2=['/:id/run','run','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x50a2,0x1c1));var _0x250a=function(_0x198b3d,_0xebbc6b){_0x198b3d=_0x198b3d-0x0;var _0x3823bc=_0x50a2[_0x198b3d];return _0x3823bc;};'use strict';var multer=require(_0x250a('0x0'));var util=require(_0x250a('0x1'));var path=require(_0x250a('0x2'));var timeout=require(_0x250a('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x250a('0x4'));var interaction=require(_0x250a('0x5'));var config=require(_0x250a('0x6'));var controller=require('./schedule.controller');router[_0x250a('0x7')]('/',auth[_0x250a('0x8')](),controller[_0x250a('0x9')]);router[_0x250a('0x7')]('/:id',auth[_0x250a('0x8')](),controller[_0x250a('0xa')]);router[_0x250a('0x7')](_0x250a('0xb'),auth['isAuthenticated'](),controller[_0x250a('0xc')]);router[_0x250a('0xd')]('/',auth[_0x250a('0x8')](),controller[_0x250a('0xe')]);router[_0x250a('0xf')]('/:id',auth[_0x250a('0x8')](),controller[_0x250a('0x10')]);router['delete'](_0x250a('0x11'),auth[_0x250a('0x8')](),controller[_0x250a('0x12')]);module[_0x250a('0x13')]=router; \ No newline at end of file +var _0xb08d=['isAuthenticated','create','put','update','delete','destroy','exports','connect-timeout','Router','../../components/interaction/service','./schedule.controller','get','index','/:id','/:id/run','run','post'];(function(_0x52ce6c,_0x256de5){var _0x3d8724=function(_0x7cdf34){while(--_0x7cdf34){_0x52ce6c['push'](_0x52ce6c['shift']());}};_0x3d8724(++_0x256de5);}(_0xb08d,0x8f));var _0xdb08=function(_0x39a23e,_0xbae270){_0x39a23e=_0x39a23e-0x0;var _0x1ec2b2=_0xb08d[_0x39a23e];return _0x1ec2b2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdb08('0x0'));var express=require('express');var router=express[_0xdb08('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb08('0x2'));var config=require('../../config/environment');var controller=require(_0xdb08('0x3'));router[_0xdb08('0x4')]('/',auth['isAuthenticated'](),controller[_0xdb08('0x5')]);router[_0xdb08('0x4')](_0xdb08('0x6'),auth['isAuthenticated'](),controller['show']);router[_0xdb08('0x4')](_0xdb08('0x7'),auth['isAuthenticated'](),controller[_0xdb08('0x8')]);router[_0xdb08('0x9')]('/',auth[_0xdb08('0xa')](),controller[_0xdb08('0xb')]);router[_0xdb08('0xc')](_0xdb08('0x6'),auth[_0xdb08('0xa')](),controller[_0xdb08('0xd')]);router[_0xdb08('0xe')]('/:id',auth[_0xdb08('0xa')](),controller[_0xdb08('0xf')]);module[_0xdb08('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d645fa6..e9464bb 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 _0x938d=['pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv'];(function(_0x3ba49a,_0x4cad62){var _0x331e32=function(_0x3894e7){while(--_0x3894e7){_0x3ba49a['push'](_0x3ba49a['shift']());}};_0x331e32(++_0x4cad62);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd938('0x2')]},'active':{'type':Sequelize[_0xd938('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd938('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xd938('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd938('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd938('0x6')]('years',_0xd938('0x7'),_0xd938('0x8'),_0xd938('0x9'),_0xd938('0xa'),_0xd938('0xb'),_0xd938('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xd938('0x6')](_0xd938('0xd'),_0xd938('0xe'),_0xd938('0xf')),'allowNull':![],'defaultValue':_0xd938('0xd')},'type':{'type':Sequelize[_0xd938('0x6')]('custom',_0xd938('0x10')),'allowNull':![],'defaultValue':_0xd938('0x11')},'sendMail':{'type':Sequelize[_0xd938('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd938('0x2')]},'cc':{'type':Sequelize[_0xd938('0x12')]},'bcc':{'type':Sequelize[_0xd938('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd938('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdb2a=['quarters','months','weeks','hours','days','csv','xlsx','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years'];(function(_0x50eb4a,_0x4cc832){var _0x1acc16=function(_0x6c9f0d){while(--_0x6c9f0d){_0x50eb4a['push'](_0x50eb4a['shift']());}};_0x1acc16(++_0x4cc832);}(_0xdb2a,0x16f));var _0xadb2=function(_0x4c8c95,_0x4ed69e){_0x4c8c95=_0x4c8c95-0x0;var _0x15059a=_0xdb2a[_0x4c8c95];return _0x15059a;};'use strict';var Sequelize=require(_0xadb2('0x0'));module[_0xadb2('0x1')]={'name':{'type':Sequelize[_0xadb2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xadb2('0x2')],'allowNull':![],'defaultValue':_0xadb2('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xadb2('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xadb2('0x5')](_0xadb2('0x6'),_0xadb2('0x7'),_0xadb2('0x8'),_0xadb2('0x9'),'days',_0xadb2('0xa'),'minutes'),'allowNull':![],'defaultValue':_0xadb2('0xb')},'output':{'type':Sequelize[_0xadb2('0x5')](_0xadb2('0xc'),'pdf',_0xadb2('0xd')),'allowNull':![],'defaultValue':_0xadb2('0xc')},'type':{'type':Sequelize[_0xadb2('0x5')]('custom',_0xadb2('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xadb2('0xf')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xadb2('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xadb2('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 784f74f..78061d4 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 _0x427f=['rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','order','where','pick','filter','type','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','../../config/schedule','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','destroy','then','get','Scheduler','UserProfileResource','stack','name','send','index','map'];(function(_0x3f88ad,_0x18abcf){var _0x121e2d=function(_0x228db2){while(--_0x228db2){_0x3f88ad['push'](_0x3f88ad['shift']());}};_0x121e2d(++_0x18abcf);}(_0x427f,0xc7));var _0xf427=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x427f[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xf427('0x0'));var emlformat=require(_0xf427('0x1'));var rimraf=require(_0xf427('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf427('0x3'));var rp=require(_0xf427('0x4'));var moment=require(_0xf427('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf427('0x6'));var util=require(_0xf427('0x7'));var path=require('path');var sox=require(_0xf427('0x8'));var csv=require(_0xf427('0x9'));var ejs=require(_0xf427('0xa'));var fs=require('fs');var _=require(_0xf427('0xb'));var squel=require(_0xf427('0xc'));var crypto=require(_0xf427('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf427('0xe'));var toCsv=require(_0xf427('0x9'));var querystring=require(_0xf427('0xf'));var Papa=require(_0xf427('0x10'));var Redis=require('ioredis');var authService=require(_0xf427('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf427('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf427('0x13'))(_0xf427('0x14'));var utils=require(_0xf427('0x15'));var config=require(_0xf427('0x16'));var licenseUtil=require(_0xf427('0x17'));var db=require(_0xf427('0x18'))['db'];function respondWithStatusCode(_0x3ec6b2,_0xdb0c3f){_0xdb0c3f=_0xdb0c3f||0xcc;return function(_0x1e469e){if(_0x1e469e){return _0x3ec6b2[_0xf427('0x19')](_0xdb0c3f);}return _0x3ec6b2[_0xf427('0x1a')](_0xdb0c3f)[_0xf427('0x1b')]();};}function respondWithResult(_0x2cbca5,_0x2e3dc0){_0x2e3dc0=_0x2e3dc0||0xc8;return function(_0x3abac8){if(_0x3abac8){return _0x2cbca5['status'](_0x2e3dc0)[_0xf427('0x1c')](_0x3abac8);}};}function respondWithFilteredResult(_0x156e8e,_0x3ecd3f){return function(_0x9bd401){if(_0x9bd401){var _0x1cb487=_0x9bd401[_0xf427('0x1d')],_0x242e4a=_0x3ecd3f[_0xf427('0x1e')],_0x1681c6=_0x3ecd3f[_0xf427('0x1e')]+_0x3ecd3f[_0xf427('0x1f')],_0x4b76ec;if(_0x1681c6>=_0x1cb487){_0x1681c6=_0x1cb487;_0x4b76ec=0xc8;}else{_0x4b76ec=0xce;}_0x156e8e[_0xf427('0x1a')](_0x4b76ec);return _0x156e8e['set']('Content-Range',_0x242e4a+'-'+_0x1681c6+'/'+_0x1cb487)['json'](_0x9bd401);}return null;};}function patchUpdates(_0x33d35a){return function(_0x1d0da0){try{jsonpatch[_0xf427('0x20')](_0x1d0da0,_0x33d35a,!![]);}catch(_0x3f6baa){return BPromise[_0xf427('0x21')](_0x3f6baa);}return _0x1d0da0['save']();};}function saveUpdates(_0x105954,_0x52b75d){return function(_0x32ca54){if(_0x32ca54){return _0x32ca54['update'](_0x105954)['then'](function(_0x3e642f){return _0x3e642f;});}return null;};}function removeEntity(_0x5824ab,_0x150744){return function(_0x560b6c){if(_0x560b6c){return _0x560b6c[_0xf427('0x22')]()[_0xf427('0x23')](function(){var _0x40573b=_0x560b6c[_0xf427('0x24')]({'plain':!![]});var _0x50bc67=_0xf427('0x25');return db[_0xf427('0x26')][_0xf427('0x22')]({'where':{'type':_0x50bc67,'resourceId':_0x40573b['id']}})['then'](function(){return _0x560b6c;});})[_0xf427('0x23')](function(){_0x5824ab[_0xf427('0x1a')](0xcc)[_0xf427('0x1b')]();});}};}function handleEntityNotFound(_0x39caac,_0xe446b3){return function(_0x534588){if(!_0x534588){_0x39caac[_0xf427('0x19')](0x194);}return _0x534588;};}function handleError(_0x405b09,_0xc21e24){_0xc21e24=_0xc21e24||0x1f4;return function(_0x5f0ca4){logger['error'](_0x5f0ca4[_0xf427('0x27')]);if(_0x5f0ca4[_0xf427('0x28')]){delete _0x5f0ca4[_0xf427('0x28')];}_0x405b09['status'](_0xc21e24)[_0xf427('0x29')](_0x5f0ca4);};}exports[_0xf427('0x2a')]=function(_0x91ecb6,_0x4a55e8){var _0x41f351={},_0x104966={},_0x4049ed={'count':0x0,'rows':[]};var _0x5948f9=_[_0xf427('0x2b')](db['Schedule'][_0xf427('0x2c')],function(_0x5d2c5f){return{'name':_0x5d2c5f['fieldName'],'type':_0x5d2c5f['type'][_0xf427('0x2d')]};});_0x104966[_0xf427('0x2e')]=_[_0xf427('0x2b')](_0x5948f9,'name');_0x104966[_0xf427('0x2f')]=_[_0xf427('0x30')](_0x91ecb6[_0xf427('0x2f')]);_0x104966[_0xf427('0x31')]=_['intersection'](_0x104966[_0xf427('0x2e')],_0x104966[_0xf427('0x2f')]);_0x41f351[_0xf427('0x32')]=_[_0xf427('0x33')](_0x104966[_0xf427('0x2e')],qs[_0xf427('0x34')](_0x91ecb6[_0xf427('0x2f')][_0xf427('0x34')]));_0x41f351[_0xf427('0x32')]=_0x41f351[_0xf427('0x32')][_0xf427('0x35')]?_0x41f351[_0xf427('0x32')]:_0x104966[_0xf427('0x2e')];if(!_0x91ecb6[_0xf427('0x2f')]['hasOwnProperty']('nolimit')){_0x41f351['limit']=qs[_0xf427('0x1f')](_0x91ecb6[_0xf427('0x2f')][_0xf427('0x1f')]);_0x41f351['offset']=qs[_0xf427('0x1e')](_0x91ecb6[_0xf427('0x2f')]['offset']);}_0x41f351[_0xf427('0x36')]=qs['sort'](_0x91ecb6[_0xf427('0x2f')]['sort']);_0x41f351[_0xf427('0x37')]=qs[_0xf427('0x31')](_[_0xf427('0x38')](_0x91ecb6[_0xf427('0x2f')],_0x104966[_0xf427('0x31')]),_0x5948f9);if(_0x91ecb6[_0xf427('0x2f')][_0xf427('0x39')]){_0x41f351[_0xf427('0x37')]=_['merge'](_0x41f351[_0xf427('0x37')],{'$or':_[_0xf427('0x2b')](_0x5948f9,function(_0x49908b){if(_0x49908b[_0xf427('0x3a')]!==_0xf427('0x3b')){var _0x161691={};_0x161691[_0x49908b[_0xf427('0x28')]]={'$like':'%'+_0x91ecb6[_0xf427('0x2f')][_0xf427('0x39')]+'%'};return _0x161691;}})});}_0x41f351=_[_0xf427('0x3c')]({},_0x41f351,_0x91ecb6[_0xf427('0x3d')]);var _0x38a4e1={'where':_0x41f351[_0xf427('0x37')]};return db[_0xf427('0x3e')][_0xf427('0x1d')](_0x38a4e1)[_0xf427('0x23')](function(_0x19b322){_0x4049ed['count']=_0x19b322;if(_0x91ecb6[_0xf427('0x2f')][_0xf427('0x3f')]){_0x41f351[_0xf427('0x40')]=[{'all':!![]}];}return db[_0xf427('0x3e')][_0xf427('0x41')](_0x41f351);})[_0xf427('0x23')](function(_0x36276e){_0x4049ed[_0xf427('0x42')]=_0x36276e;return _0x4049ed;})[_0xf427('0x23')](respondWithFilteredResult(_0x4a55e8,_0x41f351))[_0xf427('0x43')](handleError(_0x4a55e8,null));};exports[_0xf427('0x44')]=function(_0xea52cb,_0x60cda1){var _0x59d391={'raw':![],'where':{'id':_0xea52cb[_0xf427('0x45')]['id']}},_0x5e68c0={};_0x5e68c0[_0xf427('0x2e')]=_['keys'](db[_0xf427('0x3e')][_0xf427('0x2c')]);_0x5e68c0[_0xf427('0x2f')]=_[_0xf427('0x30')](_0xea52cb[_0xf427('0x2f')]);_0x5e68c0[_0xf427('0x31')]=_[_0xf427('0x33')](_0x5e68c0[_0xf427('0x2e')],_0x5e68c0[_0xf427('0x2f')]);_0x59d391[_0xf427('0x32')]=_['intersection'](_0x5e68c0['model'],qs[_0xf427('0x34')](_0xea52cb[_0xf427('0x2f')][_0xf427('0x34')]));_0x59d391['attributes']=_0x59d391['attributes'][_0xf427('0x35')]?_0x59d391['attributes']:_0x5e68c0[_0xf427('0x2e')];if(_0xea52cb[_0xf427('0x2f')][_0xf427('0x3f')]){_0x59d391['include']=[{'all':!![]}];}_0x59d391=_['merge']({},_0x59d391,_0xea52cb['options']);return db['Schedule'][_0xf427('0x46')](_0x59d391)[_0xf427('0x23')](handleEntityNotFound(_0x60cda1,null))[_0xf427('0x23')](respondWithResult(_0x60cda1,null))['catch'](handleError(_0x60cda1,null));};exports[_0xf427('0x47')]=function(_0x71a300,_0x381d38){return db[_0xf427('0x3e')][_0xf427('0x47')](_0x71a300[_0xf427('0x48')],{})['then'](function(_0x5c5d7f){var _0xe49f76=_0x71a300['user'][_0xf427('0x24')]({'plain':!![]});if(!_0xe49f76)throw new Error(_0xf427('0x49'));if(_0xe49f76[_0xf427('0x4a')]===_0xf427('0x4b')){var _0x427854=_0x5c5d7f['get']({'plain':!![]});var _0x55ca35=_0xf427('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x55ca35,'userProfileId':_0xe49f76['userProfileId']},'raw':!![]})['then'](function(_0x9736cf){if(_0x9736cf&&_0x9736cf['autoAssociation']===0x0){return db[_0xf427('0x26')][_0xf427('0x47')]({'name':_0x427854[_0xf427('0x28')],'resourceId':_0x427854['id'],'type':_0x9736cf[_0xf427('0x28')],'sectionId':_0x9736cf['id']},{})['then'](function(){return _0x5c5d7f;});}else{return _0x5c5d7f;}})[_0xf427('0x43')](function(_0x2f667c){logger[_0xf427('0x4c')](_0xf427('0x4d'),_0x2f667c);throw _0x2f667c;});}return _0x5c5d7f;})['then'](respondWithResult(_0x381d38,0xc9))['catch'](handleError(_0x381d38,null));};exports[_0xf427('0x4e')]=function(_0x4ea3c8,_0x48d8bc){if(_0x4ea3c8[_0xf427('0x48')]['id']){delete _0x4ea3c8[_0xf427('0x48')]['id'];}return db[_0xf427('0x3e')][_0xf427('0x46')]({'where':{'id':_0x4ea3c8[_0xf427('0x45')]['id']}})[_0xf427('0x23')](handleEntityNotFound(_0x48d8bc,null))[_0xf427('0x23')](saveUpdates(_0x4ea3c8[_0xf427('0x48')],null))[_0xf427('0x23')](respondWithResult(_0x48d8bc,null))[_0xf427('0x43')](handleError(_0x48d8bc,null));};exports[_0xf427('0x22')]=function(_0x3b7b85,_0x10d381){return db['Schedule'][_0xf427('0x46')]({'where':{'id':_0x3b7b85[_0xf427('0x45')]['id']}})[_0xf427('0x23')](handleEntityNotFound(_0x10d381,null))[_0xf427('0x23')](removeEntity(_0x10d381,null))[_0xf427('0x43')](handleError(_0x10d381,null));};exports['run']=function(_0x3486dc,_0x3ae6cd,_0x4bb4ce){var _0x2b6cf3=require(_0xf427('0x4f'));return db[_0xf427('0x3e')]['find']({'where':{'id':_0x3486dc[_0xf427('0x45')]['id']},'raw':!![]})[_0xf427('0x23')](handleEntityNotFound(_0x3ae6cd,null))[_0xf427('0x23')](function(){_0x2b6cf3[_0xf427('0x50')](_0x3486dc['params']['id']);})['then'](respondWithStatusCode(_0x3ae6cd,null))['catch'](handleError(_0x3ae6cd,null));}; \ No newline at end of file +var _0xc557=['bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4c2079,_0x4acb69){var _0x14638a=function(_0x33704b){while(--_0x33704b){_0x4c2079['push'](_0x4c2079['shift']());}};_0x14638a(++_0x4acb69);}(_0xc557,0xe9));var _0x7c55=function(_0x2ff022,_0x183a9c){_0x2ff022=_0x2ff022-0x0;var _0x1cbaa5=_0xc557[_0x2ff022];return _0x1cbaa5;};'use strict';var pdf=require(_0x7c55('0x0'));var emlformat=require(_0x7c55('0x1'));var rimraf=require(_0x7c55('0x2'));var zipdir=require(_0x7c55('0x3'));var jsonpatch=require(_0x7c55('0x4'));var rp=require(_0x7c55('0x5'));var moment=require(_0x7c55('0x6'));var BPromise=require(_0x7c55('0x7'));var Mustache=require(_0x7c55('0x8'));var util=require(_0x7c55('0x9'));var path=require(_0x7c55('0xa'));var sox=require(_0x7c55('0xb'));var csv=require(_0x7c55('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c55('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c55('0xe'));var deskjs=require(_0x7c55('0xf'));var toCsv=require(_0x7c55('0xc'));var querystring=require('querystring');var Papa=require(_0x7c55('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c55('0x11'));var as=require(_0x7c55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c55('0x13'))(_0x7c55('0x14'));var utils=require('../../config/utils');var config=require(_0x7c55('0x15'));var licenseUtil=require(_0x7c55('0x16'));var db=require(_0x7c55('0x17'))['db'];function respondWithStatusCode(_0x556dc4,_0x1f1bb1){_0x1f1bb1=_0x1f1bb1||0xcc;return function(_0x3690b5){if(_0x3690b5){return _0x556dc4['sendStatus'](_0x1f1bb1);}return _0x556dc4[_0x7c55('0x18')](_0x1f1bb1)[_0x7c55('0x19')]();};}function respondWithResult(_0x100637,_0xad638d){_0xad638d=_0xad638d||0xc8;return function(_0x30bc7f){if(_0x30bc7f){return _0x100637[_0x7c55('0x18')](_0xad638d)[_0x7c55('0x1a')](_0x30bc7f);}};}function respondWithFilteredResult(_0x39fe91,_0x3e13a8){return function(_0xf0a326){if(_0xf0a326){var _0x359377=_0xf0a326[_0x7c55('0x1b')],_0x172f02=_0x3e13a8[_0x7c55('0x1c')],_0x47cf4b=_0x3e13a8[_0x7c55('0x1c')]+_0x3e13a8[_0x7c55('0x1d')],_0x16af0e;if(_0x47cf4b>=_0x359377){_0x47cf4b=_0x359377;_0x16af0e=0xc8;}else{_0x16af0e=0xce;}_0x39fe91[_0x7c55('0x18')](_0x16af0e);return _0x39fe91[_0x7c55('0x1e')]('Content-Range',_0x172f02+'-'+_0x47cf4b+'/'+_0x359377)['json'](_0xf0a326);}return null;};}function patchUpdates(_0x312bae){return function(_0x625905){try{jsonpatch[_0x7c55('0x1f')](_0x625905,_0x312bae,!![]);}catch(_0x2351a7){return BPromise[_0x7c55('0x20')](_0x2351a7);}return _0x625905[_0x7c55('0x21')]();};}function saveUpdates(_0x480fb0,_0x20ca87){return function(_0x3dc8df){if(_0x3dc8df){return _0x3dc8df[_0x7c55('0x22')](_0x480fb0)[_0x7c55('0x23')](function(_0x930405){return _0x930405;});}return null;};}function removeEntity(_0x6944f4,_0x1987e1){return function(_0x1ce060){if(_0x1ce060){return _0x1ce060[_0x7c55('0x24')]()[_0x7c55('0x23')](function(){var _0x3876ec=_0x1ce060[_0x7c55('0x25')]({'plain':!![]});var _0x3ec7d9='Scheduler';return db[_0x7c55('0x26')]['destroy']({'where':{'type':_0x3ec7d9,'resourceId':_0x3876ec['id']}})[_0x7c55('0x23')](function(){return _0x1ce060;});})[_0x7c55('0x23')](function(){_0x6944f4[_0x7c55('0x18')](0xcc)[_0x7c55('0x19')]();});}};}function handleEntityNotFound(_0x1efc8d,_0x6ad6f3){return function(_0xd89d0c){if(!_0xd89d0c){_0x1efc8d['sendStatus'](0x194);}return _0xd89d0c;};}function handleError(_0x2ca06b,_0x3906d5){_0x3906d5=_0x3906d5||0x1f4;return function(_0x319471){logger[_0x7c55('0x27')](_0x319471[_0x7c55('0x28')]);if(_0x319471[_0x7c55('0x29')]){delete _0x319471[_0x7c55('0x29')];}_0x2ca06b[_0x7c55('0x18')](_0x3906d5)['send'](_0x319471);};}exports['index']=function(_0x184c1c,_0x1f1686){var _0x183da1={},_0x412a1f={},_0x90a4ca={'count':0x0,'rows':[]};var _0x58ce31=_[_0x7c55('0x2a')](db[_0x7c55('0x2b')][_0x7c55('0x2c')],function(_0x3fb373){return{'name':_0x3fb373[_0x7c55('0x2d')],'type':_0x3fb373[_0x7c55('0x2e')][_0x7c55('0x2f')]};});_0x412a1f[_0x7c55('0x30')]=_[_0x7c55('0x2a')](_0x58ce31,_0x7c55('0x29'));_0x412a1f[_0x7c55('0x31')]=_['keys'](_0x184c1c[_0x7c55('0x31')]);_0x412a1f[_0x7c55('0x32')]=_[_0x7c55('0x33')](_0x412a1f[_0x7c55('0x30')],_0x412a1f['query']);_0x183da1[_0x7c55('0x34')]=_[_0x7c55('0x33')](_0x412a1f['model'],qs[_0x7c55('0x35')](_0x184c1c[_0x7c55('0x31')]['fields']));_0x183da1[_0x7c55('0x34')]=_0x183da1[_0x7c55('0x34')]['length']?_0x183da1[_0x7c55('0x34')]:_0x412a1f[_0x7c55('0x30')];if(!_0x184c1c[_0x7c55('0x31')][_0x7c55('0x36')](_0x7c55('0x37'))){_0x183da1['limit']=qs['limit'](_0x184c1c[_0x7c55('0x31')]['limit']);_0x183da1[_0x7c55('0x1c')]=qs['offset'](_0x184c1c[_0x7c55('0x31')][_0x7c55('0x1c')]);}_0x183da1['order']=qs[_0x7c55('0x38')](_0x184c1c[_0x7c55('0x31')][_0x7c55('0x38')]);_0x183da1[_0x7c55('0x39')]=qs[_0x7c55('0x32')](_[_0x7c55('0x3a')](_0x184c1c[_0x7c55('0x31')],_0x412a1f[_0x7c55('0x32')]),_0x58ce31);if(_0x184c1c[_0x7c55('0x31')][_0x7c55('0x3b')]){_0x183da1['where']=_[_0x7c55('0x3c')](_0x183da1[_0x7c55('0x39')],{'$or':_['map'](_0x58ce31,function(_0x22a00e){if(_0x22a00e[_0x7c55('0x2e')]!==_0x7c55('0x3d')){var _0x2141ce={};_0x2141ce[_0x22a00e[_0x7c55('0x29')]]={'$like':'%'+_0x184c1c['query'][_0x7c55('0x3b')]+'%'};return _0x2141ce;}})});}_0x183da1=_[_0x7c55('0x3c')]({},_0x183da1,_0x184c1c[_0x7c55('0x3e')]);var _0x16aa32={'where':_0x183da1[_0x7c55('0x39')]};return db[_0x7c55('0x2b')][_0x7c55('0x1b')](_0x16aa32)[_0x7c55('0x23')](function(_0x51a0b3){_0x90a4ca['count']=_0x51a0b3;if(_0x184c1c['query'][_0x7c55('0x3f')]){_0x183da1[_0x7c55('0x40')]=[{'all':!![]}];}return db[_0x7c55('0x2b')]['findAll'](_0x183da1);})[_0x7c55('0x23')](function(_0x42f494){_0x90a4ca[_0x7c55('0x41')]=_0x42f494;return _0x90a4ca;})[_0x7c55('0x23')](respondWithFilteredResult(_0x1f1686,_0x183da1))[_0x7c55('0x42')](handleError(_0x1f1686,null));};exports[_0x7c55('0x43')]=function(_0x204968,_0x479a3d){var _0xa58ad4={'raw':![],'where':{'id':_0x204968['params']['id']}},_0x452c0d={};_0x452c0d[_0x7c55('0x30')]=_[_0x7c55('0x44')](db[_0x7c55('0x2b')]['rawAttributes']);_0x452c0d['query']=_['keys'](_0x204968[_0x7c55('0x31')]);_0x452c0d[_0x7c55('0x32')]=_[_0x7c55('0x33')](_0x452c0d[_0x7c55('0x30')],_0x452c0d[_0x7c55('0x31')]);_0xa58ad4['attributes']=_['intersection'](_0x452c0d['model'],qs[_0x7c55('0x35')](_0x204968[_0x7c55('0x31')][_0x7c55('0x35')]));_0xa58ad4[_0x7c55('0x34')]=_0xa58ad4[_0x7c55('0x34')][_0x7c55('0x45')]?_0xa58ad4[_0x7c55('0x34')]:_0x452c0d[_0x7c55('0x30')];if(_0x204968['query'][_0x7c55('0x3f')]){_0xa58ad4['include']=[{'all':!![]}];}_0xa58ad4=_['merge']({},_0xa58ad4,_0x204968[_0x7c55('0x3e')]);return db[_0x7c55('0x2b')][_0x7c55('0x46')](_0xa58ad4)['then'](handleEntityNotFound(_0x479a3d,null))[_0x7c55('0x23')](respondWithResult(_0x479a3d,null))[_0x7c55('0x42')](handleError(_0x479a3d,null));};exports[_0x7c55('0x47')]=function(_0x425607,_0x396781){return db['Schedule'][_0x7c55('0x47')](_0x425607['body'],{})[_0x7c55('0x23')](function(_0x13bebd){var _0x3b7992=_0x425607[_0x7c55('0x48')]['get']({'plain':!![]});if(!_0x3b7992)throw new Error(_0x7c55('0x49'));if(_0x3b7992[_0x7c55('0x4a')]===_0x7c55('0x48')){var _0x5b984f=_0x13bebd[_0x7c55('0x25')]({'plain':!![]});var _0x37977e='Scheduler';return db['UserProfileSection'][_0x7c55('0x46')]({'where':{'name':_0x37977e,'userProfileId':_0x3b7992[_0x7c55('0x4b')]},'raw':!![]})[_0x7c55('0x23')](function(_0x2da1bd){if(_0x2da1bd&&_0x2da1bd['autoAssociation']===0x0){return db[_0x7c55('0x26')][_0x7c55('0x47')]({'name':_0x5b984f[_0x7c55('0x29')],'resourceId':_0x5b984f['id'],'type':_0x2da1bd[_0x7c55('0x29')],'sectionId':_0x2da1bd['id']},{})['then'](function(){return _0x13bebd;});}else{return _0x13bebd;}})['catch'](function(_0x183b90){logger[_0x7c55('0x27')](_0x7c55('0x4c'),_0x183b90);throw _0x183b90;});}return _0x13bebd;})[_0x7c55('0x23')](respondWithResult(_0x396781,0xc9))[_0x7c55('0x42')](handleError(_0x396781,null));};exports['update']=function(_0x50bdf6,_0x2d056a){if(_0x50bdf6[_0x7c55('0x4d')]['id']){delete _0x50bdf6['body']['id'];}return db[_0x7c55('0x2b')][_0x7c55('0x46')]({'where':{'id':_0x50bdf6[_0x7c55('0x4e')]['id']}})[_0x7c55('0x23')](handleEntityNotFound(_0x2d056a,null))[_0x7c55('0x23')](saveUpdates(_0x50bdf6[_0x7c55('0x4d')],null))[_0x7c55('0x23')](respondWithResult(_0x2d056a,null))[_0x7c55('0x42')](handleError(_0x2d056a,null));};exports['destroy']=function(_0x2b0597,_0x4b9691){return db[_0x7c55('0x2b')][_0x7c55('0x46')]({'where':{'id':_0x2b0597['params']['id']}})[_0x7c55('0x23')](handleEntityNotFound(_0x4b9691,null))['then'](removeEntity(_0x4b9691,null))[_0x7c55('0x42')](handleError(_0x4b9691,null));};exports[_0x7c55('0x4f')]=function(_0x4d7a3b,_0x4c5a4a,_0x109061){var _0x10af4f=require('../../config/schedule');return db[_0x7c55('0x2b')][_0x7c55('0x46')]({'where':{'id':_0x4d7a3b[_0x7c55('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4c5a4a,null))[_0x7c55('0x23')](function(){_0x10af4f[_0x7c55('0x4f')](_0x4d7a3b[_0x7c55('0x4e')]['id']);})['then'](respondWithStatusCode(_0x4c5a4a,null))['catch'](handleError(_0x4c5a4a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 90a6031..7746c22 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 _0xe081=['util','../../config/logger','api','moment','request-promise','rimraf','exports','tools_schedules','lodash'];(function(_0x3fd455,_0x1f7c5b){var _0x1c259f=function(_0x2da88a){while(--_0x2da88a){_0x3fd455['push'](_0x3fd455['shift']());}};_0x1c259f(++_0x1f7c5b);}(_0xe081,0x1b8));var _0x1e08=function(_0x378a7c,_0x2b7556){_0x378a7c=_0x378a7c-0x0;var _0x5e01f9=_0xe081[_0x378a7c];return _0x5e01f9;};'use strict';var _=require(_0x1e08('0x0'));var util=require(_0x1e08('0x1'));var logger=require(_0x1e08('0x2'))(_0x1e08('0x3'));var moment=require(_0x1e08('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e08('0x6'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x1e08('0x7')]=function(_0x376ad8,_0x3a0c97){return _0x376ad8['define']('Schedule',attributes,{'tableName':_0x1e08('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6812=['define','tools_schedules','util','../../config/logger','moment','bluebird','path','./schedule.attributes','exports'];(function(_0x2b5403,_0x4a9ce0){var _0x1b1ede=function(_0x352e1b){while(--_0x352e1b){_0x2b5403['push'](_0x2b5403['shift']());}};_0x1b1ede(++_0x4a9ce0);}(_0x6812,0x197));var _0x2681=function(_0x18f204,_0x4814f8){_0x18f204=_0x18f204-0x0;var _0x251cdb=_0x6812[_0x18f204];return _0x251cdb;};'use strict';var _=require('lodash');var util=require(_0x2681('0x0'));var logger=require(_0x2681('0x1'))('api');var moment=require(_0x2681('0x2'));var BPromise=require(_0x2681('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2681('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2681('0x5'));module[_0x2681('0x6')]=function(_0x3ed785,_0x4c1339){return _0x3ed785[_0x2681('0x7')]('Schedule',attributes,{'tableName':_0x2681('0x8'),'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 0336ef5..8471da6 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 _0x8451=['http','info','request\x20sent','error','code','Schedule,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x8451,0xd4));var _0x1845=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8451[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x1845('0x0'));var util=require(_0x1845('0x1'));var moment=require('moment');var BPromise=require(_0x1845('0x2'));var rs=require(_0x1845('0x3'));var fs=require('fs');var Redis=require(_0x1845('0x4'));var db=require(_0x1845('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1845('0x6'))(_0x1845('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1845('0x8')][_0x1845('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26a5e8,_0x8ba598,_0x14e17e){return new BPromise(function(_0x1666a9,_0xb91b54){return client['request'](_0x26a5e8,_0x14e17e)['then'](function(_0x24be91){logger[_0x1845('0xa')]('Schedule,\x20%s,\x20%s',_0x8ba598,_0x1845('0xb'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x8ba598,'request\x20sent',JSON['stringify'](_0x24be91));if(_0x24be91['error']){if(_0x24be91[_0x1845('0xc')][_0x1845('0xd')]===0x1f4){logger[_0x1845('0xc')](_0x1845('0xe'),_0x8ba598,_0x24be91[_0x1845('0xc')][_0x1845('0xf')]);return _0xb91b54(_0x24be91[_0x1845('0xc')][_0x1845('0xf')]);}logger[_0x1845('0xc')]('Schedule,\x20%s,\x20%s',_0x8ba598,_0x24be91[_0x1845('0xc')][_0x1845('0xf')]);return _0x1666a9(_0x24be91[_0x1845('0xc')]['message']);}else{logger['info'](_0x1845('0xe'),_0x8ba598,_0x1845('0xb'));_0x1666a9(_0x24be91[_0x1845('0x10')]['message']);}})['catch'](function(_0x256843){logger['error'](_0x1845('0xe'),_0x8ba598,_0x256843);_0xb91b54(_0x256843);});});} \ No newline at end of file +var _0x9462=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x137bdd,_0x43a31f){var _0x2656a5=function(_0x130916){while(--_0x130916){_0x137bdd['push'](_0x137bdd['shift']());}};_0x2656a5(++_0x43a31f);}(_0x9462,0x7d));var _0x2946=function(_0x58009c,_0x43c7fe){_0x58009c=_0x58009c-0x0;var _0x23e5f6=_0x9462[_0x58009c];return _0x23e5f6;};'use strict';var _=require(_0x2946('0x0'));var util=require(_0x2946('0x1'));var moment=require('moment');var BPromise=require(_0x2946('0x2'));var rs=require(_0x2946('0x3'));var fs=require('fs');var Redis=require(_0x2946('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2946('0x5'));var logger=require(_0x2946('0x6'))(_0x2946('0x7'));var config=require(_0x2946('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2946('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d04b9,_0x5ec8a2,_0x298233){return new BPromise(function(_0x1d2639,_0x497d9b){return client['request'](_0x8d04b9,_0x298233)[_0x2946('0xa')](function(_0x18f082){logger[_0x2946('0xb')](_0x2946('0xc'),_0x5ec8a2,_0x2946('0xd'));logger[_0x2946('0xe')](_0x2946('0xf'),_0x5ec8a2,_0x2946('0xd'),JSON[_0x2946('0x10')](_0x18f082));if(_0x18f082[_0x2946('0x11')]){if(_0x18f082[_0x2946('0x11')][_0x2946('0x12')]===0x1f4){logger['error'](_0x2946('0xc'),_0x5ec8a2,_0x18f082[_0x2946('0x11')][_0x2946('0x13')]);return _0x497d9b(_0x18f082[_0x2946('0x11')][_0x2946('0x13')]);}logger[_0x2946('0x11')](_0x2946('0xc'),_0x5ec8a2,_0x18f082[_0x2946('0x11')]['message']);return _0x1d2639(_0x18f082[_0x2946('0x11')]['message']);}else{logger[_0x2946('0xb')](_0x2946('0xc'),_0x5ec8a2,_0x2946('0xd'));_0x1d2639(_0x18f082[_0x2946('0x14')][_0x2946('0x13')]);}})['catch'](function(_0x5ab75e){logger['error'](_0x2946('0xc'),_0x5ec8a2,_0x5ab75e);_0x497d9b(_0x5ab75e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fe24f8f..e82be18 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 _0xe636=['describe','show','/:id/download','download','post','create','put','/:id','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x47470f,_0x411315){var _0x5b16a4=function(_0x781291){while(--_0x781291){_0x47470f['push'](_0x47470f['shift']());}};_0x5b16a4(++_0x411315);}(_0xe636,0x1ea));var _0x6e63=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xe636[_0xb725be];return _0x2f2424;};'use strict';var multer=require(_0x6e63('0x0'));var util=require(_0x6e63('0x1'));var path=require(_0x6e63('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e63('0x3')]();var auth=require(_0x6e63('0x4'));var interaction=require(_0x6e63('0x5'));var config=require('../../config/environment');var controller=require(_0x6e63('0x6'));router[_0x6e63('0x7')]('/',auth[_0x6e63('0x8')](),controller[_0x6e63('0x9')]);router[_0x6e63('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6e63('0xa')]);router[_0x6e63('0x7')]('/:id',auth[_0x6e63('0x8')](),controller[_0x6e63('0xb')]);router[_0x6e63('0x7')](_0x6e63('0xc'),auth[_0x6e63('0x8')](),controller[_0x6e63('0xd')]);router[_0x6e63('0xe')]('/',auth[_0x6e63('0x8')](),controller[_0x6e63('0xf')]);router[_0x6e63('0x10')](_0x6e63('0x11'),auth[_0x6e63('0x8')](),controller['update']);router[_0x6e63('0x12')](_0x6e63('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e63('0x13')]=router; \ No newline at end of file +var _0x6188=['Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1bcb9d,_0x196e3d){var _0x5651f2=function(_0x3e8151){while(--_0x3e8151){_0x1bcb9d['push'](_0x1bcb9d['shift']());}};_0x5651f2(++_0x196e3d);}(_0x6188,0x136));var _0x8618=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x6188[_0x3cba93];return _0x4a2991;};'use strict';var multer=require(_0x8618('0x0'));var util=require(_0x8618('0x1'));var path=require(_0x8618('0x2'));var timeout=require(_0x8618('0x3'));var express=require(_0x8618('0x4'));var router=express[_0x8618('0x5')]();var auth=require(_0x8618('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8618('0x7'));var controller=require('./screenRecording.controller');router[_0x8618('0x8')]('/',auth['isAuthenticated'](),controller[_0x8618('0x9')]);router[_0x8618('0x8')](_0x8618('0xa'),auth[_0x8618('0xb')](),controller[_0x8618('0xc')]);router[_0x8618('0x8')](_0x8618('0xd'),auth[_0x8618('0xb')](),controller[_0x8618('0xe')]);router[_0x8618('0x8')](_0x8618('0xf'),auth['isAuthenticated'](),controller[_0x8618('0x10')]);router[_0x8618('0x11')]('/',auth[_0x8618('0xb')](),controller['create']);router['put'](_0x8618('0xd'),auth[_0x8618('0xb')](),controller[_0x8618('0x12')]);router[_0x8618('0x13')](_0x8618('0xd'),auth[_0x8618('0xb')](),controller[_0x8618('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 86b60b7..405c125 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 _0xee14=['extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value'];(function(_0x21db8e,_0x519187){var _0x3d635b=function(_0x2d1755){while(--_0x2d1755){_0x21db8e['push'](_0x21db8e['shift']());}};_0x3d635b(++_0x519187);}(_0xee14,0x13a));var _0x4ee1=function(_0x13b3a7,_0x39cfa9){_0x13b3a7=_0x13b3a7-0x0;var _0x3acdee=_0xee14[_0x13b3a7];return _0x3acdee;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x4ee1('0x0'));var config=require(_0x4ee1('0x1'));module[_0x4ee1('0x2')]={'format':{'type':Sequelize[_0x4ee1('0x3')],'get':function(){return this[_0x4ee1('0x4')](_0x4ee1('0x5'))?path[_0x4ee1('0x6')](this[_0x4ee1('0x4')](_0x4ee1('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4ee1('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x327c18){var _0x3a45a3=_0x327c18[_0x4ee1('0x8')](/\\/g,'/');this[_0x4ee1('0x9')](_0x4ee1('0x5'),_0x3a45a3);}},'rating':{'type':Sequelize[_0x4ee1('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x33dbe6){this[_0x4ee1('0x9')]('startedAt',moment()[_0x4ee1('0xb')](_0x33dbe6,'ms'));this[_0x4ee1('0x9')](_0x4ee1('0xc'),moment());this[_0x4ee1('0x9')]('duration',_0x33dbe6);}},'startedAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0xe')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0xc')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}},'createdAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0x12')))[_0x4ee1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4ee1('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0x13')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}}}; \ No newline at end of file +var _0x34e8=['duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt'];(function(_0x31fc26,_0x8a964d){var _0x37396d=function(_0x1a13fb){while(--_0x1a13fb){_0x31fc26['push'](_0x31fc26['shift']());}};_0x37396d(++_0x8a964d);}(_0x34e8,0x12c));var _0x834e=function(_0x36acba,_0xd5d51d){_0x36acba=_0x36acba-0x0;var _0x2fe147=_0x34e8[_0x36acba];return _0x2fe147;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var config=require(_0x834e('0x3'));module['exports']={'format':{'type':Sequelize[_0x834e('0x4')],'get':function(){return this[_0x834e('0x5')](_0x834e('0x6'))?path[_0x834e('0x7')](this[_0x834e('0x5')](_0x834e('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x834e('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x834e('0x8')],'set':function(_0x52056d){var _0x3e16d2=_0x52056d[_0x834e('0x9')](/\\/g,'/');this[_0x834e('0xa')](_0x834e('0x6'),_0x3e16d2);}},'rating':{'type':Sequelize[_0x834e('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x834e('0xb')],'set':function(_0x363786){this[_0x834e('0xa')](_0x834e('0xc'),moment()[_0x834e('0xd')](_0x363786,'ms'));this[_0x834e('0xa')](_0x834e('0xe'),moment());this[_0x834e('0xa')](_0x834e('0xf'),_0x363786);}},'startedAt':{'type':Sequelize[_0x834e('0x10')],'get':function(){return moment(this[_0x834e('0x5')](_0x834e('0xc')))['format'](_0x834e('0x11'))[_0x834e('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x834e('0x5')](_0x834e('0xe')))[_0x834e('0x13')](_0x834e('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x834e('0x10')],'get':function(){return moment(this[_0x834e('0x5')]('createdAt'))[_0x834e('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x834e('0x12')]();}},'updatedAt':{'type':Sequelize[_0x834e('0x10')],'get':function(){return moment(this['getDataValue'](_0x834e('0x14')))[_0x834e('0x13')](_0x834e('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 30f016a..80e354b 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 _0x5e84=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','includeAll','ScreenRecording','rows','catch','show','params','rawAttributes','options','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf'];(function(_0x4a4f5d,_0x293f9f){var _0x4a5452=function(_0x2dfb4b){while(--_0x2dfb4b){_0x4a4f5d['push'](_0x4a4f5d['shift']());}};_0x4a5452(++_0x293f9f);}(_0x5e84,0xd1));var _0x45e8=function(_0x4b99b2,_0x4f3b64){_0x4b99b2=_0x4b99b2-0x0;var _0x21b2ab=_0x5e84[_0x4b99b2];return _0x21b2ab;};'use strict';var pdf=require(_0x45e8('0x0'));var emlformat=require(_0x45e8('0x1'));var rimraf=require(_0x45e8('0x2'));var zipdir=require(_0x45e8('0x3'));var jsonpatch=require(_0x45e8('0x4'));var rp=require(_0x45e8('0x5'));var moment=require(_0x45e8('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x45e8('0x7'));var path=require(_0x45e8('0x8'));var sox=require('sox');var csv=require(_0x45e8('0x9'));var ejs=require(_0x45e8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x45e8('0xb'));var crypto=require(_0x45e8('0xc'));var jsforce=require(_0x45e8('0xd'));var deskjs=require(_0x45e8('0xe'));var toCsv=require(_0x45e8('0x9'));var querystring=require('querystring');var Papa=require(_0x45e8('0xf'));var Redis=require(_0x45e8('0x10'));var authService=require(_0x45e8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x45e8('0x12'));var hardwareService=require(_0x45e8('0x13'));var logger=require(_0x45e8('0x14'))(_0x45e8('0x15'));var utils=require(_0x45e8('0x16'));var config=require(_0x45e8('0x17'));var licenseUtil=require(_0x45e8('0x18'));var db=require(_0x45e8('0x19'))['db'];function respondWithStatusCode(_0x591849,_0x132268){_0x132268=_0x132268||0xcc;return function(_0x1fc66e){if(_0x1fc66e){return _0x591849[_0x45e8('0x1a')](_0x132268);}return _0x591849[_0x45e8('0x1b')](_0x132268)[_0x45e8('0x1c')]();};}function respondWithResult(_0x5520f1,_0x5e996b){_0x5e996b=_0x5e996b||0xc8;return function(_0x2c3aed){if(_0x2c3aed){return _0x5520f1[_0x45e8('0x1b')](_0x5e996b)['json'](_0x2c3aed);}};}function respondWithFilteredResult(_0x7e4e39,_0x4a2e52){return function(_0x3b37e2){if(_0x3b37e2){var _0x258b56=_0x3b37e2[_0x45e8('0x1d')],_0x9f0662=_0x4a2e52[_0x45e8('0x1e')],_0x1dd7bc=_0x4a2e52[_0x45e8('0x1e')]+_0x4a2e52[_0x45e8('0x1f')],_0x53aedf;if(_0x1dd7bc>=_0x258b56){_0x1dd7bc=_0x258b56;_0x53aedf=0xc8;}else{_0x53aedf=0xce;}_0x7e4e39[_0x45e8('0x1b')](_0x53aedf);return _0x7e4e39[_0x45e8('0x20')](_0x45e8('0x21'),_0x9f0662+'-'+_0x1dd7bc+'/'+_0x258b56)[_0x45e8('0x22')](_0x3b37e2);}return null;};}function patchUpdates(_0x1ac531){return function(_0x5e0e8d){try{jsonpatch[_0x45e8('0x23')](_0x5e0e8d,_0x1ac531,!![]);}catch(_0x44be38){return BPromise[_0x45e8('0x24')](_0x44be38);}return _0x5e0e8d['save']();};}function saveUpdates(_0x4de210,_0x5063a9){return function(_0x410b15){if(_0x410b15){return _0x410b15[_0x45e8('0x25')](_0x4de210)[_0x45e8('0x26')](function(_0x2d4048){return _0x2d4048;});}return null;};}function removeEntity(_0x9fffe6,_0x153785){return function(_0x1e2cd0){if(_0x1e2cd0){return _0x1e2cd0[_0x45e8('0x27')]()[_0x45e8('0x26')](function(){_0x9fffe6[_0x45e8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x206a7c,_0x19f32f){return function(_0x1f794f){if(!_0x1f794f){_0x206a7c[_0x45e8('0x1a')](0x194);}return _0x1f794f;};}function handleError(_0x445198,_0xc3374a){_0xc3374a=_0xc3374a||0x1f4;return function(_0x591814){logger[_0x45e8('0x28')](_0x591814[_0x45e8('0x29')]);if(_0x591814[_0x45e8('0x2a')]){delete _0x591814[_0x45e8('0x2a')];}_0x445198[_0x45e8('0x1b')](_0xc3374a)[_0x45e8('0x2b')](_0x591814);};}exports[_0x45e8('0x2c')]=function(_0x2d9c83,_0x457183){var _0x5e553e={},_0x250fb7={},_0x8dc1d0={'count':0x0,'rows':[]};var _0x363f7a=_[_0x45e8('0x2d')](db['ScreenRecording']['rawAttributes'],function(_0x339477){return{'name':_0x339477[_0x45e8('0x2e')],'type':_0x339477[_0x45e8('0x2f')][_0x45e8('0x30')]};});_0x250fb7[_0x45e8('0x31')]=_['differenceBy'](_[_0x45e8('0x2d')](_0x363f7a,_0x45e8('0x2a')),['format']);_0x250fb7[_0x45e8('0x32')]=_[_0x45e8('0x33')](_0x2d9c83[_0x45e8('0x32')]);_0x250fb7[_0x45e8('0x34')]=_[_0x45e8('0x35')](_0x250fb7[_0x45e8('0x31')],_0x250fb7['query']);_0x5e553e[_0x45e8('0x36')]=_[_0x45e8('0x35')](_0x250fb7['model'],qs[_0x45e8('0x37')](_0x2d9c83[_0x45e8('0x32')][_0x45e8('0x37')]));_0x5e553e[_0x45e8('0x36')]=_0x5e553e['attributes'][_0x45e8('0x38')]?_0x5e553e[_0x45e8('0x36')]:_0x250fb7[_0x45e8('0x31')];if(!_0x2d9c83[_0x45e8('0x32')][_0x45e8('0x39')](_0x45e8('0x3a'))){_0x5e553e[_0x45e8('0x1f')]=qs[_0x45e8('0x1f')](_0x2d9c83[_0x45e8('0x32')][_0x45e8('0x1f')]);_0x5e553e[_0x45e8('0x1e')]=qs[_0x45e8('0x1e')](_0x2d9c83['query']['offset']);}_0x5e553e[_0x45e8('0x3b')]=qs['sort'](_0x2d9c83[_0x45e8('0x32')]['sort']);_0x5e553e['where']=qs[_0x45e8('0x34')](_[_0x45e8('0x3c')](_0x2d9c83[_0x45e8('0x32')],_0x250fb7[_0x45e8('0x34')]),_0x363f7a);if(_0x2d9c83['query'][_0x45e8('0x3d')]){_0x5e553e[_0x45e8('0x3e')]=_['merge'](_0x5e553e[_0x45e8('0x3e')],{'$or':_[_0x45e8('0x2d')](_0x363f7a,function(_0xf7c0c7){if(_0xf7c0c7['type']!==_0x45e8('0x3f')){var _0x4e3e0a={};_0x4e3e0a[_0xf7c0c7[_0x45e8('0x2a')]]={'$like':'%'+_0x2d9c83[_0x45e8('0x32')][_0x45e8('0x3d')]+'%'};return _0x4e3e0a;}})});}_0x5e553e=_[_0x45e8('0x40')]({},_0x5e553e,_0x2d9c83['options']);var _0x7fe315={'where':_0x5e553e['where']};return db['ScreenRecording'][_0x45e8('0x1d')](_0x7fe315)[_0x45e8('0x26')](function(_0x34c2ed){_0x8dc1d0['count']=_0x34c2ed;if(_0x2d9c83['query'][_0x45e8('0x41')]){_0x5e553e['include']=[{'all':!![]}];}return db[_0x45e8('0x42')]['findAll'](_0x5e553e);})[_0x45e8('0x26')](function(_0x15bc99){_0x8dc1d0[_0x45e8('0x43')]=_0x15bc99;return _0x8dc1d0;})[_0x45e8('0x26')](respondWithFilteredResult(_0x457183,_0x5e553e))[_0x45e8('0x44')](handleError(_0x457183,null));};exports[_0x45e8('0x45')]=function(_0x4826d2,_0x4c395c){var _0x15490f={'raw':![],'where':{'id':_0x4826d2[_0x45e8('0x46')]['id']}},_0x352981={};_0x352981[_0x45e8('0x31')]=_[_0x45e8('0x33')](db[_0x45e8('0x42')][_0x45e8('0x47')]);_0x352981[_0x45e8('0x32')]=_[_0x45e8('0x33')](_0x4826d2['query']);_0x352981[_0x45e8('0x34')]=_['intersection'](_0x352981['model'],_0x352981[_0x45e8('0x32')]);_0x15490f[_0x45e8('0x36')]=_[_0x45e8('0x35')](_0x352981[_0x45e8('0x31')],qs['fields'](_0x4826d2[_0x45e8('0x32')][_0x45e8('0x37')]));_0x15490f[_0x45e8('0x36')]=_0x15490f['attributes'][_0x45e8('0x38')]?_0x15490f[_0x45e8('0x36')]:_0x352981[_0x45e8('0x31')];if(_0x4826d2[_0x45e8('0x32')][_0x45e8('0x41')]){_0x15490f['include']=[{'all':!![]}];}_0x15490f=_[_0x45e8('0x40')]({},_0x15490f,_0x4826d2[_0x45e8('0x48')]);return db[_0x45e8('0x42')][_0x45e8('0x49')](_0x15490f)[_0x45e8('0x26')](handleEntityNotFound(_0x4c395c,null))[_0x45e8('0x26')](respondWithResult(_0x4c395c,null))[_0x45e8('0x44')](handleError(_0x4c395c,null));};exports[_0x45e8('0x4a')]=function(_0xc8b4db,_0x39061b){return db[_0x45e8('0x42')][_0x45e8('0x4a')](_0xc8b4db[_0x45e8('0x4b')],{})[_0x45e8('0x26')](respondWithResult(_0x39061b,0xc9))[_0x45e8('0x44')](handleError(_0x39061b,null));};exports[_0x45e8('0x25')]=function(_0x7bc3f,_0x23271f){if(_0x7bc3f[_0x45e8('0x4b')]['id']){delete _0x7bc3f[_0x45e8('0x4b')]['id'];}delete _0x7bc3f[_0x45e8('0x4b')][_0x45e8('0x4c')];delete _0x7bc3f['body'][_0x45e8('0x4d')];delete _0x7bc3f[_0x45e8('0x4b')][_0x45e8('0x4e')];delete _0x7bc3f[_0x45e8('0x4b')][_0x45e8('0x4f')];return db['ScreenRecording'][_0x45e8('0x49')]({'where':{'id':_0x7bc3f[_0x45e8('0x46')]['id']}})[_0x45e8('0x26')](handleEntityNotFound(_0x23271f,null))['then'](saveUpdates(_0x7bc3f[_0x45e8('0x4b')],null))[_0x45e8('0x26')](respondWithResult(_0x23271f,null))[_0x45e8('0x44')](handleError(_0x23271f,null));};exports['describe']=function(_0x441308,_0x2f0519){return db[_0x45e8('0x42')][_0x45e8('0x50')]()[_0x45e8('0x26')](respondWithResult(_0x2f0519,null))[_0x45e8('0x44')](handleError(_0x2f0519,null));};exports[_0x45e8('0x51')]=function(_0x40c917,_0x332f2e,_0x51eeec){var _0x21006e=require(_0x45e8('0x52'));var _0x1e1560=![];var _0x3b093b={};if(_0x40c917[_0x45e8('0x32')][_0x45e8('0x2f')]&&_0x40c917[_0x45e8('0x32')][_0x45e8('0x2f')]==='uniqueid'){_0x3b093b['uniqueid']=_0x40c917[_0x45e8('0x46')]['id'];}else{_0x3b093b['id']=_0x40c917[_0x45e8('0x46')]['id'];}return db['ScreenRecording'][_0x45e8('0x49')]({'where':_0x3b093b,'attributes':['id',_0x45e8('0x4f')],'raw':!![]})[_0x45e8('0x26')](handleEntityNotFound(_0x332f2e,null))['then'](function(_0x309438){if(_0x309438){var _0x23cac3=path[_0x45e8('0x53')](config[_0x45e8('0x54')],_0x45e8('0x55'),_0x309438['value']);var _0x1da32e=util[_0x45e8('0x56')](_0x45e8('0x57'),_0x23cac3);if(fs[_0x45e8('0x58')](_0x1da32e)){_0x1e1560=!![];return _0x21006e['decryptFile'](_0x1da32e,_0x23cac3,config['secrets']['recording'])[_0x45e8('0x26')](function(){return _0x309438;});}return _0x309438;}})[_0x45e8('0x26')](function(_0x2b560c){if(_0x2b560c){var _0x3d8085=path[_0x45e8('0x53')](config[_0x45e8('0x54')],_0x45e8('0x55'),_0x2b560c[_0x45e8('0x4f')]);if(!fs[_0x45e8('0x58')](_0x3d8085)){throw new db[(_0x45e8('0x59'))][(_0x45e8('0x5a'))](_0x45e8('0x5b'));}if(_0x2b560c[_0x45e8('0x5c')]){return _0x332f2e[_0x45e8('0x51')](_0x3d8085,_0x2b560c[_0x45e8('0x5c')]+path[_0x45e8('0x5d')](_0x3d8085),function(){if(_0x1e1560){fs[_0x45e8('0x5e')](_0x3d8085);}});}else{return _0x332f2e['download'](_0x3d8085,function(_0x5eb829){if(_0x1e1560){fs[_0x45e8('0x5e')](_0x3d8085);}});}}})[_0x45e8('0x44')](function(_0x25487d){if(_0x25487d[_0x45e8('0x5f')]===_0x45e8('0x5b')){_0x332f2e['status'](0x194)['send'](_0x45e8('0x60'));}else{return handleError(_0x332f2e,null);}});};exports[_0x45e8('0x27')]=function(_0x2b6dce,_0x8f5003){return db[_0x45e8('0x42')]['find']({'where':{'id':_0x2b6dce[_0x45e8('0x46')]['id']}})[_0x45e8('0x26')](function(_0xe5483c){if(!_0xe5483c)throw new ReferenceError(_0x45e8('0x61'));return _0xe5483c;})[_0x45e8('0x26')](function(_0x2fa97d){var _0x1b73f0=path[_0x45e8('0x53')](config[_0x45e8('0x54')],'server/files/screen_recordings',_0x2fa97d['value']);logger[_0x45e8('0x62')](_0x45e8('0x63'),_0x1b73f0);if(!_[_0x45e8('0x64')](_0x2fa97d[_0x45e8('0x4f')])&&fs[_0x45e8('0x58')](_0x1b73f0)){logger[_0x45e8('0x62')](_0x45e8('0x65')+_0x1b73f0+_0x45e8('0x66'));fs[_0x45e8('0x67')](_0x1b73f0);}_0x1b73f0=_0x1b73f0+_0x45e8('0x68');if(!_[_0x45e8('0x64')](_0x2fa97d['value'])&&fs['existsSync'](_0x1b73f0)){logger[_0x45e8('0x62')](_0x45e8('0x65')+_0x1b73f0+_0x45e8('0x66'));fs[_0x45e8('0x67')](_0x1b73f0);}return _0x2fa97d;})['then'](function(_0x4a7c47){if(!_0x4a7c47)throw new InternalError();return _0x4a7c47[_0x45e8('0x27')]();})['then'](function(){_0x8f5003[_0x45e8('0x1b')](0xcc)[_0x45e8('0x1c')]();})[_0x45e8('0x44')](handleError(_0x8f5003,null));}; \ No newline at end of file +var _0x1055=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22'];(function(_0x45d621,_0x15e43d){var _0x51626d=function(_0x42ada9){while(--_0x42ada9){_0x45d621['push'](_0x45d621['shift']());}};_0x51626d(++_0x15e43d);}(_0x1055,0xd1));var _0x5105=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x1055[_0x3f8a03];return _0x147fb2;};'use strict';var pdf=require(_0x5105('0x0'));var emlformat=require(_0x5105('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5105('0x2'));var jsonpatch=require(_0x5105('0x3'));var rp=require(_0x5105('0x4'));var moment=require('moment');var BPromise=require(_0x5105('0x5'));var Mustache=require('mustache');var util=require(_0x5105('0x6'));var path=require(_0x5105('0x7'));var sox=require(_0x5105('0x8'));var csv=require(_0x5105('0x9'));var ejs=require(_0x5105('0xa'));var fs=require('fs');var _=require(_0x5105('0xb'));var squel=require('squel');var crypto=require(_0x5105('0xc'));var jsforce=require(_0x5105('0xd'));var deskjs=require(_0x5105('0xe'));var toCsv=require(_0x5105('0x9'));var querystring=require(_0x5105('0xf'));var Papa=require('papaparse');var Redis=require(_0x5105('0x10'));var authService=require(_0x5105('0x11'));var qs=require(_0x5105('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5105('0x13'));var logger=require(_0x5105('0x14'))(_0x5105('0x15'));var utils=require(_0x5105('0x16'));var config=require(_0x5105('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5105('0x18'))['db'];function respondWithStatusCode(_0x48e362,_0x3bd118){_0x3bd118=_0x3bd118||0xcc;return function(_0x2ca0f2){if(_0x2ca0f2){return _0x48e362['sendStatus'](_0x3bd118);}return _0x48e362[_0x5105('0x19')](_0x3bd118)['end']();};}function respondWithResult(_0x417e85,_0x4087b3){_0x4087b3=_0x4087b3||0xc8;return function(_0x48fa20){if(_0x48fa20){return _0x417e85[_0x5105('0x19')](_0x4087b3)[_0x5105('0x1a')](_0x48fa20);}};}function respondWithFilteredResult(_0x20e4e3,_0x1d1292){return function(_0x26d414){if(_0x26d414){var _0x53a3e5=_0x26d414[_0x5105('0x1b')],_0x509410=_0x1d1292[_0x5105('0x1c')],_0x54fea2=_0x1d1292[_0x5105('0x1c')]+_0x1d1292[_0x5105('0x1d')],_0x455eeb;if(_0x54fea2>=_0x53a3e5){_0x54fea2=_0x53a3e5;_0x455eeb=0xc8;}else{_0x455eeb=0xce;}_0x20e4e3[_0x5105('0x19')](_0x455eeb);return _0x20e4e3['set'](_0x5105('0x1e'),_0x509410+'-'+_0x54fea2+'/'+_0x53a3e5)[_0x5105('0x1a')](_0x26d414);}return null;};}function patchUpdates(_0x2b277c){return function(_0x292858){try{jsonpatch[_0x5105('0x1f')](_0x292858,_0x2b277c,!![]);}catch(_0x302bf0){return BPromise[_0x5105('0x20')](_0x302bf0);}return _0x292858[_0x5105('0x21')]();};}function saveUpdates(_0x37df6b,_0x1cac01){return function(_0x46c899){if(_0x46c899){return _0x46c899[_0x5105('0x22')](_0x37df6b)[_0x5105('0x23')](function(_0x59135d){return _0x59135d;});}return null;};}function removeEntity(_0x1a3ecb,_0x341621){return function(_0x387e11){if(_0x387e11){return _0x387e11[_0x5105('0x24')]()[_0x5105('0x23')](function(){_0x1a3ecb[_0x5105('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279620,_0x355a29){return function(_0x3a100a){if(!_0x3a100a){_0x279620['sendStatus'](0x194);}return _0x3a100a;};}function handleError(_0x4e16f2,_0x5ba987){_0x5ba987=_0x5ba987||0x1f4;return function(_0x136ad9){logger[_0x5105('0x25')](_0x136ad9[_0x5105('0x26')]);if(_0x136ad9[_0x5105('0x27')]){delete _0x136ad9[_0x5105('0x27')];}_0x4e16f2[_0x5105('0x19')](_0x5ba987)['send'](_0x136ad9);};}exports[_0x5105('0x28')]=function(_0x2a3a54,_0x258e16){var _0x3aad45={},_0x312b68={},_0x512f9b={'count':0x0,'rows':[]};var _0x6b8f46=_[_0x5105('0x29')](db[_0x5105('0x2a')][_0x5105('0x2b')],function(_0x225fc5){return{'name':_0x225fc5[_0x5105('0x2c')],'type':_0x225fc5[_0x5105('0x2d')][_0x5105('0x2e')]};});_0x312b68[_0x5105('0x2f')]=_[_0x5105('0x30')](_['map'](_0x6b8f46,_0x5105('0x27')),[_0x5105('0x31')]);_0x312b68[_0x5105('0x32')]=_[_0x5105('0x33')](_0x2a3a54['query']);_0x312b68['filters']=_['intersection'](_0x312b68[_0x5105('0x2f')],_0x312b68['query']);_0x3aad45[_0x5105('0x34')]=_['intersection'](_0x312b68[_0x5105('0x2f')],qs[_0x5105('0x35')](_0x2a3a54[_0x5105('0x32')][_0x5105('0x35')]));_0x3aad45[_0x5105('0x34')]=_0x3aad45[_0x5105('0x34')]['length']?_0x3aad45[_0x5105('0x34')]:_0x312b68['model'];if(!_0x2a3a54[_0x5105('0x32')][_0x5105('0x36')]('nolimit')){_0x3aad45[_0x5105('0x1d')]=qs[_0x5105('0x1d')](_0x2a3a54[_0x5105('0x32')][_0x5105('0x1d')]);_0x3aad45[_0x5105('0x1c')]=qs['offset'](_0x2a3a54['query'][_0x5105('0x1c')]);}_0x3aad45[_0x5105('0x37')]=qs[_0x5105('0x38')](_0x2a3a54[_0x5105('0x32')][_0x5105('0x38')]);_0x3aad45[_0x5105('0x39')]=qs[_0x5105('0x3a')](_['pick'](_0x2a3a54[_0x5105('0x32')],_0x312b68['filters']),_0x6b8f46);if(_0x2a3a54[_0x5105('0x32')]['filter']){_0x3aad45[_0x5105('0x39')]=_[_0x5105('0x3b')](_0x3aad45['where'],{'$or':_[_0x5105('0x29')](_0x6b8f46,function(_0x3332f5){if(_0x3332f5[_0x5105('0x2d')]!==_0x5105('0x3c')){var _0x1cf2e0={};_0x1cf2e0[_0x3332f5[_0x5105('0x27')]]={'$like':'%'+_0x2a3a54[_0x5105('0x32')][_0x5105('0x3d')]+'%'};return _0x1cf2e0;}})});}_0x3aad45=_[_0x5105('0x3b')]({},_0x3aad45,_0x2a3a54[_0x5105('0x3e')]);var _0x39ad36={'where':_0x3aad45[_0x5105('0x39')]};return db['ScreenRecording'][_0x5105('0x1b')](_0x39ad36)[_0x5105('0x23')](function(_0x51f5ca){_0x512f9b[_0x5105('0x1b')]=_0x51f5ca;if(_0x2a3a54['query'][_0x5105('0x3f')]){_0x3aad45[_0x5105('0x40')]=[{'all':!![]}];}return db[_0x5105('0x2a')]['findAll'](_0x3aad45);})[_0x5105('0x23')](function(_0x8d4b71){_0x512f9b[_0x5105('0x41')]=_0x8d4b71;return _0x512f9b;})[_0x5105('0x23')](respondWithFilteredResult(_0x258e16,_0x3aad45))[_0x5105('0x42')](handleError(_0x258e16,null));};exports[_0x5105('0x43')]=function(_0x58b7d2,_0x2cabca){var _0x4eb7ac={'raw':![],'where':{'id':_0x58b7d2[_0x5105('0x44')]['id']}},_0x303d33={};_0x303d33[_0x5105('0x2f')]=_['keys'](db[_0x5105('0x2a')][_0x5105('0x2b')]);_0x303d33[_0x5105('0x32')]=_[_0x5105('0x33')](_0x58b7d2['query']);_0x303d33['filters']=_[_0x5105('0x45')](_0x303d33[_0x5105('0x2f')],_0x303d33[_0x5105('0x32')]);_0x4eb7ac['attributes']=_[_0x5105('0x45')](_0x303d33[_0x5105('0x2f')],qs[_0x5105('0x35')](_0x58b7d2['query'][_0x5105('0x35')]));_0x4eb7ac[_0x5105('0x34')]=_0x4eb7ac['attributes'][_0x5105('0x46')]?_0x4eb7ac['attributes']:_0x303d33[_0x5105('0x2f')];if(_0x58b7d2[_0x5105('0x32')][_0x5105('0x3f')]){_0x4eb7ac[_0x5105('0x40')]=[{'all':!![]}];}_0x4eb7ac=_[_0x5105('0x3b')]({},_0x4eb7ac,_0x58b7d2[_0x5105('0x3e')]);return db[_0x5105('0x2a')][_0x5105('0x47')](_0x4eb7ac)['then'](handleEntityNotFound(_0x2cabca,null))[_0x5105('0x23')](respondWithResult(_0x2cabca,null))[_0x5105('0x42')](handleError(_0x2cabca,null));};exports[_0x5105('0x48')]=function(_0x53da2c,_0x52b0f7){return db['ScreenRecording'][_0x5105('0x48')](_0x53da2c['body'],{})[_0x5105('0x23')](respondWithResult(_0x52b0f7,0xc9))['catch'](handleError(_0x52b0f7,null));};exports[_0x5105('0x22')]=function(_0x1b07bf,_0x4547aa){if(_0x1b07bf[_0x5105('0x49')]['id']){delete _0x1b07bf['body']['id'];}delete _0x1b07bf[_0x5105('0x49')][_0x5105('0x4a')];delete _0x1b07bf[_0x5105('0x49')][_0x5105('0x4b')];delete _0x1b07bf[_0x5105('0x49')][_0x5105('0x4c')];delete _0x1b07bf[_0x5105('0x49')][_0x5105('0x4d')];return db[_0x5105('0x2a')]['find']({'where':{'id':_0x1b07bf[_0x5105('0x44')]['id']}})[_0x5105('0x23')](handleEntityNotFound(_0x4547aa,null))[_0x5105('0x23')](saveUpdates(_0x1b07bf['body'],null))[_0x5105('0x23')](respondWithResult(_0x4547aa,null))[_0x5105('0x42')](handleError(_0x4547aa,null));};exports['describe']=function(_0x146bae,_0x512da0){return db[_0x5105('0x2a')][_0x5105('0x4e')]()['then'](respondWithResult(_0x512da0,null))[_0x5105('0x42')](handleError(_0x512da0,null));};exports[_0x5105('0x4f')]=function(_0x41eebe,_0x46deb1,_0x5cf99b){var _0x537ab1=require(_0x5105('0x50'));var _0x16ea85=![];var _0xe61314={};if(_0x41eebe[_0x5105('0x32')][_0x5105('0x2d')]&&_0x41eebe[_0x5105('0x32')]['type']===_0x5105('0x51')){_0xe61314[_0x5105('0x51')]=_0x41eebe[_0x5105('0x44')]['id'];}else{_0xe61314['id']=_0x41eebe[_0x5105('0x44')]['id'];}return db[_0x5105('0x2a')][_0x5105('0x47')]({'where':_0xe61314,'attributes':['id',_0x5105('0x4d')],'raw':!![]})[_0x5105('0x23')](handleEntityNotFound(_0x46deb1,null))[_0x5105('0x23')](function(_0x31c2fc){if(_0x31c2fc){var _0x1277ff=path[_0x5105('0x52')](config[_0x5105('0x53')],_0x5105('0x54'),_0x31c2fc['value']);var _0x640851=util['format'](_0x5105('0x55'),_0x1277ff);if(fs[_0x5105('0x56')](_0x640851)){_0x16ea85=!![];return _0x537ab1[_0x5105('0x57')](_0x640851,_0x1277ff,config['secrets']['recording'])['then'](function(){return _0x31c2fc;});}return _0x31c2fc;}})[_0x5105('0x23')](function(_0x7cb893){if(_0x7cb893){var _0x268ac0=path[_0x5105('0x52')](config[_0x5105('0x53')],_0x5105('0x54'),_0x7cb893[_0x5105('0x4d')]);if(!fs[_0x5105('0x56')](_0x268ac0)){throw new db['Sequelize'][(_0x5105('0x58'))](_0x5105('0x59'));}if(_0x7cb893[_0x5105('0x5a')]){return _0x46deb1['download'](_0x268ac0,_0x7cb893[_0x5105('0x5a')]+path[_0x5105('0x5b')](_0x268ac0),function(){if(_0x16ea85){fs[_0x5105('0x5c')](_0x268ac0);}});}else{return _0x46deb1[_0x5105('0x4f')](_0x268ac0,function(_0x22f6dd){if(_0x16ea85){fs[_0x5105('0x5c')](_0x268ac0);}});}}})[_0x5105('0x42')](function(_0x17aa3c){if(_0x17aa3c[_0x5105('0x5d')]===_0x5105('0x59')){_0x46deb1['status'](0x194)[_0x5105('0x5e')]('Not\x20found');}else{return handleError(_0x46deb1,null);}});};exports['destroy']=function(_0x5bb23e,_0x56fe78){return db['ScreenRecording'][_0x5105('0x47')]({'where':{'id':_0x5bb23e[_0x5105('0x44')]['id']}})['then'](function(_0x4fb55a){if(!_0x4fb55a)throw new ReferenceError(_0x5105('0x5f'));return _0x4fb55a;})[_0x5105('0x23')](function(_0x57b495){var _0x2ec46d=path[_0x5105('0x52')](config[_0x5105('0x53')],_0x5105('0x54'),_0x57b495[_0x5105('0x4d')]);logger[_0x5105('0x60')](_0x5105('0x61'),_0x2ec46d);if(!_[_0x5105('0x62')](_0x57b495[_0x5105('0x4d')])&&fs[_0x5105('0x56')](_0x2ec46d)){logger[_0x5105('0x60')](_0x5105('0x63')+_0x2ec46d+_0x5105('0x64'));fs[_0x5105('0x65')](_0x2ec46d);}_0x2ec46d=_0x2ec46d+_0x5105('0x66');if(!_[_0x5105('0x62')](_0x57b495[_0x5105('0x4d')])&&fs['existsSync'](_0x2ec46d)){logger[_0x5105('0x60')]('File:\x20\x22'+_0x2ec46d+_0x5105('0x64'));fs['unlinkSync'](_0x2ec46d);}return _0x57b495;})[_0x5105('0x23')](function(_0x72da30){if(!_0x72da30)throw new InternalError();return _0x72da30[_0x5105('0x24')]();})[_0x5105('0x23')](function(){_0x56fe78[_0x5105('0x19')](0xcc)['end']();})[_0x5105('0x42')](handleError(_0x56fe78,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 1977bc7..b6f38a3 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 _0xd817=['request-promise','../../config/environment','screen_recordings','interactionid','lodash','../../config/logger','api','bluebird'];(function(_0x26660c,_0xa474ef){var _0x21fb98=function(_0xcedc16){while(--_0xcedc16){_0x26660c['push'](_0x26660c['shift']());}};_0x21fb98(++_0xa474ef);}(_0xd817,0x13c));var _0x7d81=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0xd817[_0x503ffd];return _0x160437;};'use strict';var _=require(_0x7d81('0x0'));var util=require('util');var logger=require(_0x7d81('0x1'))(_0x7d81('0x2'));var moment=require('moment');var BPromise=require(_0x7d81('0x3'));var rp=require(_0x7d81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d81('0x5'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x44cc9c,_0x84a5c){return _0x44cc9c['define']('ScreenRecording',attributes,{'tableName':_0x7d81('0x6'),'paranoid':![],'indexes':[{'name':_0x7d81('0x7'),'fields':[_0x7d81('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9585=['request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','util','../../config/logger','api','bluebird'];(function(_0x301602,_0x4e6d13){var _0x2157d3=function(_0x333bb3){while(--_0x333bb3){_0x301602['push'](_0x301602['shift']());}};_0x2157d3(++_0x4e6d13);}(_0x9585,0x1d0));var _0x5958=function(_0xf3ceec,_0x3cf5e7){_0xf3ceec=_0xf3ceec-0x0;var _0x1a8a6e=_0x9585[_0xf3ceec];return _0x1a8a6e;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require(_0x5958('0x1'))(_0x5958('0x2'));var moment=require('moment');var BPromise=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var fs=require('fs');var path=require(_0x5958('0x5'));var rimraf=require(_0x5958('0x6'));var config=require(_0x5958('0x7'));var attributes=require('./screenRecording.attributes');module[_0x5958('0x8')]=function(_0x1c558a,_0xfb90ee){return _0x1c558a[_0x5958('0x9')](_0x5958('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x5958('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 802c13d..3bbd55f 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x2388c5,_0x377d10){var _0xbaeae4=function(_0x5126d8){while(--_0x5126d8){_0x2388c5['push'](_0x2388c5['shift']());}};_0xbaeae4(++_0x377d10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0xadd100,_0x173faf){var _0x43d444=function(_0x127d7c){while(--_0x127d7c){_0xadd100['push'](_0xadd100['shift']());}};_0x43d444(++_0x173faf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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/setting/index.js b/server/api/setting/index.js index 5ade198..e83841d 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 _0xd4dd=['logologin','extname','originalname','single','file','addLogoLogin','preferred','addPreferred','addFavicon','put','update','util','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','post','addLogo','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd4dd,0x7d));var _0xdd4d=function(_0x2bad6e,_0x18618e){_0x2bad6e=_0x2bad6e-0x0;var _0x4d224b=_0xd4dd[_0x2bad6e];return _0x4d224b;};'use strict';var multer=require('multer');var util=require(_0xdd4d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd4d('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdd4d('0x2'));var config=require(_0xdd4d('0x3'));var controller=require(_0xdd4d('0x4'));router[_0xdd4d('0x5')]('/',auth[_0xdd4d('0x6')](),controller[_0xdd4d('0x7')]);router['get'](_0xdd4d('0x8'),controller['getDate']);router[_0xdd4d('0x5')](_0xdd4d('0x9'),controller[_0xdd4d('0xa')]);router[_0xdd4d('0x5')](_0xdd4d('0xb'),controller['getLogo']);router[_0xdd4d('0x5')](_0xdd4d('0xc'),controller['getLogoLogin']);router['get'](_0xdd4d('0xd'),controller[_0xdd4d('0xe')]);router[_0xdd4d('0x5')](_0xdd4d('0xf'),controller[_0xdd4d('0x10')]);router['get'](_0xdd4d('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xdd4d('0x12')]({'destination':function(_0x50342f,_0x401b35,_0x4fea52){_0x4fea52(null,path['join'](config[_0xdd4d('0x13')],_0xdd4d('0x14')));},'filename':function(_0x203aab,_0x5904c3,_0x46b692){_0x46b692(null,util[_0xdd4d('0x15')](_0xdd4d('0x16'),_0xdd4d('0x17'),path['extname'](_0x5904c3['originalname'])));}})});router[_0xdd4d('0x18')](_0xdd4d('0xb'),upload['single']('file'),controller[_0xdd4d('0x19')]);var upload=multer({'storage':multer[_0xdd4d('0x12')]({'destination':function(_0x3634d6,_0x348e0a,_0xcba3fc){_0xcba3fc(null,path[_0xdd4d('0x1a')](config[_0xdd4d('0x13')],_0xdd4d('0x14')));},'filename':function(_0x3bc9c4,_0x454528,_0x2596b8){_0x2596b8(null,util[_0xdd4d('0x15')](_0xdd4d('0x16'),_0xdd4d('0x1b'),path[_0xdd4d('0x1c')](_0x454528[_0xdd4d('0x1d')])));}})});router[_0xdd4d('0x18')]('/:id/logo_login',upload[_0xdd4d('0x1e')](_0xdd4d('0x1f')),controller[_0xdd4d('0x20')]);var upload=multer({'storage':multer[_0xdd4d('0x12')]({'destination':function(_0x1e22b2,_0x21f50f,_0x487669){_0x487669(null,path[_0xdd4d('0x1a')](config[_0xdd4d('0x13')],_0xdd4d('0x14')));},'filename':function(_0x5b78f6,_0x1234bb,_0x1aba40){_0x1aba40(null,util['format'](_0xdd4d('0x16'),_0xdd4d('0x21'),path[_0xdd4d('0x1c')](_0x1234bb[_0xdd4d('0x1d')])));}})});router[_0xdd4d('0x18')](_0xdd4d('0xf'),upload['single'](_0xdd4d('0x1f')),controller[_0xdd4d('0x22')]);var upload=multer({'storage':multer[_0xdd4d('0x12')]({'destination':function(_0x234296,_0x7a9d3c,_0x4396a0){_0x4396a0(null,path[_0xdd4d('0x1a')](config[_0xdd4d('0x13')],_0xdd4d('0x14')));},'filename':function(_0x42aa73,_0x2f9467,_0x38cac4){_0x38cac4(null,util[_0xdd4d('0x15')](_0xdd4d('0x16'),'favicon',path['extname'](_0x2f9467[_0xdd4d('0x1d')])));}})});router[_0xdd4d('0x18')](_0xdd4d('0x11'),upload[_0xdd4d('0x1e')](_0xdd4d('0x1f')),controller[_0xdd4d('0x23')]);router[_0xdd4d('0x24')](_0xdd4d('0x9'),auth[_0xdd4d('0x6')](),controller[_0xdd4d('0x25')]);module['exports']=router; \ No newline at end of file +var _0x7921=['logo','extname','originalname','post','single','file','addLogo','diskStorage','join','logologin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','server/files/images/logos/','format','%s%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7921,0x1ea));var _0x1792=function(_0x573d96,_0x3cb205){_0x573d96=_0x573d96-0x0;var _0x14d177=_0x7921[_0x573d96];return _0x14d177;};'use strict';var multer=require(_0x1792('0x0'));var util=require(_0x1792('0x1'));var path=require(_0x1792('0x2'));var timeout=require(_0x1792('0x3'));var express=require('express');var router=express[_0x1792('0x4')]();var auth=require(_0x1792('0x5'));var interaction=require(_0x1792('0x6'));var config=require(_0x1792('0x7'));var controller=require('./setting.controller');router[_0x1792('0x8')]('/',auth[_0x1792('0x9')](),controller[_0x1792('0xa')]);router[_0x1792('0x8')]('/now',controller[_0x1792('0xb')]);router['get'](_0x1792('0xc'),controller['show']);router['get'](_0x1792('0xd'),controller[_0x1792('0xe')]);router[_0x1792('0x8')](_0x1792('0xf'),controller[_0x1792('0x10')]);router['get'](_0x1792('0x11'),controller['gdpr']);router[_0x1792('0x8')](_0x1792('0x12'),controller[_0x1792('0x13')]);router[_0x1792('0x8')](_0x1792('0x14'),controller[_0x1792('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3181fd,_0x1de6a9,_0x33f442){_0x33f442(null,path['join'](config[_0x1792('0x16')],_0x1792('0x17')));},'filename':function(_0x204ade,_0x17229b,_0x4b3f87){_0x4b3f87(null,util[_0x1792('0x18')](_0x1792('0x19'),_0x1792('0x1a'),path[_0x1792('0x1b')](_0x17229b[_0x1792('0x1c')])));}})});router[_0x1792('0x1d')](_0x1792('0xd'),upload[_0x1792('0x1e')](_0x1792('0x1f')),controller[_0x1792('0x20')]);var upload=multer({'storage':multer[_0x1792('0x21')]({'destination':function(_0x33214b,_0x1b49b6,_0x57f777){_0x57f777(null,path[_0x1792('0x22')](config['root'],'server/files/images/logos/'));},'filename':function(_0x23aa66,_0x19ab88,_0x27bfd0){_0x27bfd0(null,util[_0x1792('0x18')]('%s%s',_0x1792('0x23'),path[_0x1792('0x1b')](_0x19ab88[_0x1792('0x1c')])));}})});router['post'](_0x1792('0xf'),upload[_0x1792('0x1e')](_0x1792('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x1792('0x21')]({'destination':function(_0x2b17f7,_0x47a2e3,_0x5c9d27){_0x5c9d27(null,path[_0x1792('0x22')](config[_0x1792('0x16')],_0x1792('0x17')));},'filename':function(_0x57b3e7,_0x590c70,_0x125aa0){_0x125aa0(null,util[_0x1792('0x18')](_0x1792('0x19'),_0x1792('0x24'),path[_0x1792('0x1b')](_0x590c70[_0x1792('0x1c')])));}})});router[_0x1792('0x1d')]('/:id/preferred',upload[_0x1792('0x1e')]('file'),controller[_0x1792('0x25')]);var upload=multer({'storage':multer[_0x1792('0x21')]({'destination':function(_0x3064f8,_0x219747,_0x52d727){_0x52d727(null,path['join'](config[_0x1792('0x16')],'server/files/images/logos/'));},'filename':function(_0x3eab04,_0x446567,_0x40d030){_0x40d030(null,util[_0x1792('0x18')](_0x1792('0x19'),_0x1792('0x26'),path[_0x1792('0x1b')](_0x446567[_0x1792('0x1c')])));}})});router[_0x1792('0x1d')](_0x1792('0x14'),upload['single'](_0x1792('0x1f')),controller[_0x1792('0x27')]);router[_0x1792('0x28')](_0x1792('0xc'),auth[_0x1792('0x9')](),controller[_0x1792('0x29')]);module[_0x1792('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d22c0df..78556ae 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 _0x1b3e=['min_internal','min_mailbox','INTEGER','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports'];(function(_0x16c045,_0x1fcb5f){var _0xbafe5c=function(_0x21c511){while(--_0x21c511){_0x16c045['push'](_0x16c045['shift']());}};_0xbafe5c(++_0x1fcb5f);}(_0x1b3e,0x17b));var _0xe1b3=function(_0x24664f,_0x57dacc){_0x24664f=_0x24664f-0x0;var _0x2733fc=_0x1b3e[_0x24664f];return _0x2733fc;};'use strict';var Sequelize=require('sequelize');module[_0xe1b3('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xe1b3('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xe1b3('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe1b3('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xe1b3('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe1b3('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe1b3('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe1b3('0x6')]},'turnaddr':{'type':Sequelize[_0xe1b3('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xe1b3('0x6')]},'pageTitle':{'type':Sequelize[_0xe1b3('0x6')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe1b3('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe1b3('0x6')],'defaultValue':_0xe1b3('0x7')},'enableEmailPreview':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe1b3('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xe1b3('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe1b3('0x6')],'defaultValue':_0xe1b3('0x8')},'chatTimeout':{'type':Sequelize[_0xe1b3('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe1b3('0x6')]},'defaultPreferred':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe1b3('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0xe1b3('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe1b3('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe1b3('0x6')]},'defaultFavicon':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe1b3('0x6')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xe1b3('0x6')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe1b3('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xe1b3('0x3')](0x2)[_0xe1b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xe1b3('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3cd6=['exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x3e8f5b,_0x42bf03){var _0x46becc=function(_0x1711a1){while(--_0x1711a1){_0x3e8f5b['push'](_0x3e8f5b['shift']());}};_0x46becc(++_0x42bf03);}(_0x3cd6,0x138));var _0x63cd=function(_0x1b1198,_0x2df1e2){_0x1b1198=_0x1b1198-0x0;var _0x2e7118=_0x3cd6[_0x1b1198];return _0x2e7118;};'use strict';var Sequelize=require('sequelize');module[_0x63cd('0x0')]={'min_internal':{'type':Sequelize[_0x63cd('0x1')](0xb),'unique':_0x63cd('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x63cd('0x3')],'defaultValue':_0x63cd('0x4')},'logo':{'type':Sequelize[_0x63cd('0x3')]},'defaultLogo':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x63cd('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x63cd('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x63cd('0x3')]},'turnaddr':{'type':Sequelize[_0x63cd('0x3')]},'turnusername':{'type':Sequelize[_0x63cd('0x3')]},'turnpassword':{'type':Sequelize[_0x63cd('0x3')]},'pageTitle':{'type':Sequelize[_0x63cd('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x63cd('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x63cd('0x6')},'chatTimeout':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x63cd('0x3')]},'defaultPreferred':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x63cd('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x63cd('0x3')]},'defaultFavicon':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x63cd('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x63cd('0x1')]},'transcribeRegion':{'type':Sequelize[_0x63cd('0x3')]},'sentiment':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x63cd('0x1')]},'sentimentRegion':{'type':Sequelize[_0x63cd('0x3')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x63cd('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x63cd('0x1')](0x2)[_0x63cd('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x63cd('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index aab014d..d1b0423 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 _0x6ea5=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','save','destroy','stack','send','index','map','Setting','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','find','catch','update','body','addLogo','file','filename','loginLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','defaultLoginLogo','default_loginLogo.svg','addPreferred','getPreferred','default_preferred.png','default','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','ioredis'];(function(_0x3b4734,_0x234d33){var _0x5ea6a9=function(_0x225ebb){while(--_0x225ebb){_0x3b4734['push'](_0x3b4734['shift']());}};_0x5ea6a9(++_0x234d33);}(_0x6ea5,0x64));var _0x56ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ea5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x56ea('0x0'));var rimraf=require(_0x56ea('0x1'));var zipdir=require(_0x56ea('0x2'));var jsonpatch=require(_0x56ea('0x3'));var rp=require(_0x56ea('0x4'));var moment=require(_0x56ea('0x5'));var BPromise=require(_0x56ea('0x6'));var Mustache=require(_0x56ea('0x7'));var util=require('util');var path=require(_0x56ea('0x8'));var sox=require('sox');var csv=require(_0x56ea('0x9'));var ejs=require(_0x56ea('0xa'));var fs=require('fs');var _=require(_0x56ea('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x56ea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x56ea('0x9'));var querystring=require(_0x56ea('0xd'));var Papa=require('papaparse');var Redis=require(_0x56ea('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56ea('0xf'));var logger=require(_0x56ea('0x10'))(_0x56ea('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x56ea('0x12'));var db=require(_0x56ea('0x13'))['db'];var jayson=require(_0x56ea('0x14'));var client=jayson['client'][_0x56ea('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2b9dbd,_0xe09138,_0x1d879a,_0x6466f3){return new BPromise(function(_0x4af221,_0x56264f){var _0x3c2cf5=_0x6466f3||client;return _0x3c2cf5['request'](_0x2b9dbd,_0x1d879a)[_0x56ea('0x16')](function(_0x103b7c){logger[_0x56ea('0x17')](_0x56ea('0x18'),_0xe09138,_0x56ea('0x19'));logger[_0x56ea('0x1a')](_0x56ea('0x1b'),_0xe09138,_0x56ea('0x19'),JSON[_0x56ea('0x1c')](_0x103b7c));if(_0x103b7c['error']){if(_0x103b7c[_0x56ea('0x1d')][_0x56ea('0x1e')]===0x1f4){logger[_0x56ea('0x1d')]('Setting,\x20%s,\x20%s',_0xe09138,_0x103b7c[_0x56ea('0x1d')]['message']);return _0x56264f(_0x103b7c['error'][_0x56ea('0x1f')]);}logger[_0x56ea('0x1d')](_0x56ea('0x18'),_0xe09138,_0x103b7c[_0x56ea('0x1d')]['message']);return _0x4af221(_0x103b7c[_0x56ea('0x1d')][_0x56ea('0x1f')]);}else{logger[_0x56ea('0x17')]('Setting,\x20%s,\x20%s',_0xe09138,_0x56ea('0x19'));_0x4af221(_0x103b7c[_0x56ea('0x20')][_0x56ea('0x1f')]);}})['catch'](function(_0x20bc5d){logger[_0x56ea('0x1d')](_0x56ea('0x18'),_0xe09138,_0x20bc5d);_0x56264f(_0x20bc5d);});});}function respondWithStatusCode(_0x36b2ac,_0x5b04ed){_0x5b04ed=_0x5b04ed||0xcc;return function(_0x487cb0){if(_0x487cb0){return _0x36b2ac[_0x56ea('0x21')](_0x5b04ed);}return _0x36b2ac[_0x56ea('0x22')](_0x5b04ed)[_0x56ea('0x23')]();};}function respondWithResult(_0xb49b55,_0x1fb946){_0x1fb946=_0x1fb946||0xc8;return function(_0x18fa46){if(_0x18fa46){return _0xb49b55[_0x56ea('0x22')](_0x1fb946)[_0x56ea('0x24')](_0x18fa46);}};}function respondWithFilteredResult(_0xb61902,_0x5313c5){return function(_0x44e2c8){if(_0x44e2c8){var _0x54049f=_0x44e2c8[_0x56ea('0x25')],_0x2acea9=_0x5313c5[_0x56ea('0x26')],_0x112eca=_0x5313c5['offset']+_0x5313c5[_0x56ea('0x27')],_0x112450;if(_0x112eca>=_0x54049f){_0x112eca=_0x54049f;_0x112450=0xc8;}else{_0x112450=0xce;}_0xb61902[_0x56ea('0x22')](_0x112450);return _0xb61902['set'](_0x56ea('0x28'),_0x2acea9+'-'+_0x112eca+'/'+_0x54049f)[_0x56ea('0x24')](_0x44e2c8);}return null;};}function patchUpdates(_0x49623b){return function(_0x476dd9){try{jsonpatch['apply'](_0x476dd9,_0x49623b,!![]);}catch(_0x41371d){return BPromise['reject'](_0x41371d);}return _0x476dd9[_0x56ea('0x29')]();};}function saveUpdates(_0x4c42a5,_0x1c5227){return function(_0x3fa269){if(_0x3fa269){return _0x3fa269['update'](_0x4c42a5)[_0x56ea('0x16')](function(_0x2a63f5){return _0x2a63f5;});}return null;};}function removeEntity(_0x110c54,_0x48b874){return function(_0x324716){if(_0x324716){return _0x324716[_0x56ea('0x2a')]()[_0x56ea('0x16')](function(){_0x110c54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x474daa,_0x2c1332){return function(_0x30cbef){if(!_0x30cbef){_0x474daa[_0x56ea('0x21')](0x194);}return _0x30cbef;};}function handleError(_0x49df13,_0x3ea18a){_0x3ea18a=_0x3ea18a||0x1f4;return function(_0x2e19ef){logger[_0x56ea('0x1d')](_0x2e19ef[_0x56ea('0x2b')]);if(_0x2e19ef['name']){delete _0x2e19ef['name'];}_0x49df13['status'](_0x3ea18a)[_0x56ea('0x2c')](_0x2e19ef);};}exports[_0x56ea('0x2d')]=function(_0x1ec24c,_0x421995){var _0x2511a4={},_0x147ef7={},_0x54baa3={'count':0x0,'rows':[]};var _0x3e3bff=_[_0x56ea('0x2e')](db[_0x56ea('0x2f')][_0x56ea('0x30')],function(_0x54d636){return{'name':_0x54d636[_0x56ea('0x31')],'type':_0x54d636[_0x56ea('0x32')][_0x56ea('0x33')]};});_0x147ef7[_0x56ea('0x34')]=_[_0x56ea('0x2e')](_0x3e3bff,_0x56ea('0x35'));_0x147ef7[_0x56ea('0x36')]=_[_0x56ea('0x37')](_0x1ec24c[_0x56ea('0x36')]);_0x147ef7['filters']=_[_0x56ea('0x38')](_0x147ef7[_0x56ea('0x34')],_0x147ef7[_0x56ea('0x36')]);_0x2511a4[_0x56ea('0x39')]=_['intersection'](_0x147ef7[_0x56ea('0x34')],qs[_0x56ea('0x3a')](_0x1ec24c['query'][_0x56ea('0x3a')]));_0x2511a4['attributes']=_0x2511a4[_0x56ea('0x39')][_0x56ea('0x3b')]?_0x2511a4[_0x56ea('0x39')]:_0x147ef7[_0x56ea('0x34')];if(!_0x1ec24c[_0x56ea('0x36')][_0x56ea('0x3c')](_0x56ea('0x3d'))){_0x2511a4['limit']=qs[_0x56ea('0x27')](_0x1ec24c[_0x56ea('0x36')][_0x56ea('0x27')]);_0x2511a4[_0x56ea('0x26')]=qs[_0x56ea('0x26')](_0x1ec24c[_0x56ea('0x36')][_0x56ea('0x26')]);}_0x2511a4[_0x56ea('0x3e')]=qs['sort'](_0x1ec24c['query'][_0x56ea('0x3f')]);_0x2511a4['where']=qs[_0x56ea('0x40')](_[_0x56ea('0x41')](_0x1ec24c['query'],_0x147ef7[_0x56ea('0x40')]),_0x3e3bff);if(_0x1ec24c[_0x56ea('0x36')][_0x56ea('0x42')]){_0x2511a4[_0x56ea('0x43')]=_['merge'](_0x2511a4[_0x56ea('0x43')],{'$or':_[_0x56ea('0x2e')](_0x3e3bff,function(_0xb2cbdc){if(_0xb2cbdc['type']!==_0x56ea('0x44')){var _0xf330c0={};_0xf330c0[_0xb2cbdc[_0x56ea('0x35')]]={'$like':'%'+_0x1ec24c['query'][_0x56ea('0x42')]+'%'};return _0xf330c0;}})});}_0x2511a4=_[_0x56ea('0x45')]({},_0x2511a4,_0x1ec24c[_0x56ea('0x46')]);var _0x540d8a={'where':_0x2511a4[_0x56ea('0x43')]};return db[_0x56ea('0x2f')][_0x56ea('0x25')](_0x540d8a)[_0x56ea('0x16')](function(_0xa9a4f6){_0x54baa3['count']=_0xa9a4f6;if(_0x1ec24c[_0x56ea('0x36')]['includeAll']){_0x2511a4[_0x56ea('0x47')]=[{'all':!![]}];}return db[_0x56ea('0x2f')][_0x56ea('0x48')](_0x2511a4);})['then'](function(_0x1e9459){_0x54baa3[_0x56ea('0x49')]=_0x1e9459;return _0x54baa3;})[_0x56ea('0x16')](respondWithFilteredResult(_0x421995,_0x2511a4))['catch'](handleError(_0x421995,null));};exports[_0x56ea('0x4a')]=function(_0x26dc05,_0x48c04b){var _0xd7ee86={'raw':![],'where':{'id':_0x26dc05[_0x56ea('0x4b')]['id']}},_0x2e64db={};_0x2e64db[_0x56ea('0x34')]=_[_0x56ea('0x37')](db[_0x56ea('0x2f')][_0x56ea('0x30')]);_0x2e64db[_0x56ea('0x36')]=_[_0x56ea('0x37')](_0x26dc05[_0x56ea('0x36')]);_0x2e64db[_0x56ea('0x40')]=_[_0x56ea('0x38')](_0x2e64db[_0x56ea('0x34')],_0x2e64db[_0x56ea('0x36')]);_0xd7ee86[_0x56ea('0x39')]=_[_0x56ea('0x38')](_0x2e64db[_0x56ea('0x34')],qs[_0x56ea('0x3a')](_0x26dc05[_0x56ea('0x36')]['fields']));_0xd7ee86[_0x56ea('0x39')]=_0xd7ee86['attributes'][_0x56ea('0x3b')]?_0xd7ee86[_0x56ea('0x39')]:_0x2e64db[_0x56ea('0x34')];if(_0x26dc05['query']['includeAll']){_0xd7ee86['include']=[{'all':!![]}];}_0xd7ee86=_[_0x56ea('0x45')]({},_0xd7ee86,_0x26dc05['options']);return db[_0x56ea('0x2f')][_0x56ea('0x4c')](_0xd7ee86)[_0x56ea('0x16')](handleEntityNotFound(_0x48c04b,null))[_0x56ea('0x16')](respondWithResult(_0x48c04b,null))[_0x56ea('0x4d')](handleError(_0x48c04b,null));};exports[_0x56ea('0x4e')]=function(_0x54b02f,_0x3ea840){if(_0x54b02f[_0x56ea('0x4f')]['id']){delete _0x54b02f[_0x56ea('0x4f')]['id'];}return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0x54b02f[_0x56ea('0x4b')]['id']}})[_0x56ea('0x16')](handleEntityNotFound(_0x3ea840,null))[_0x56ea('0x16')](saveUpdates(_0x54b02f[_0x56ea('0x4f')],null))[_0x56ea('0x16')](respondWithResult(_0x3ea840,null))[_0x56ea('0x4d')](handleError(_0x3ea840,null));};exports[_0x56ea('0x50')]=function(_0x53a5fe,_0x40bd64,_0x187e42){if(_0x53a5fe[_0x56ea('0x51')]&&_0x53a5fe[_0x56ea('0x51')]['filename']){_0x53a5fe[_0x56ea('0x4f')]['logo']=_0x53a5fe['file'][_0x56ea('0x52')];}return db['Setting'][_0x56ea('0x4c')]({'where':{'id':_0x53a5fe['params']['id']}})[_0x56ea('0x16')](handleEntityNotFound(_0x40bd64,null))['then'](saveUpdates(_0x53a5fe[_0x56ea('0x4f')],null))[_0x56ea('0x16')](respondWithResult(_0x40bd64,null))['catch'](handleError(_0x40bd64,null));};exports['addLogoLogin']=function(_0x2f6524,_0x2e4ed0,_0x33b5b1){if(_0x2f6524[_0x56ea('0x51')]&&_0x2f6524[_0x56ea('0x51')]['filename']){_0x2f6524[_0x56ea('0x4f')][_0x56ea('0x53')]=_0x2f6524[_0x56ea('0x51')][_0x56ea('0x52')];}return db['Setting'][_0x56ea('0x4c')]({'where':{'id':_0x2f6524[_0x56ea('0x4b')]['id']}})[_0x56ea('0x16')](handleEntityNotFound(_0x2e4ed0,null))[_0x56ea('0x16')](saveUpdates(_0x2f6524[_0x56ea('0x4f')],null))[_0x56ea('0x16')](respondWithResult(_0x2e4ed0,null))[_0x56ea('0x4d')](handleError(_0x2e4ed0,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x3a48c3,_0x1c025f,_0x42acfe){var _0x5c12fc=_0x56ea('0x54');var _0x2f49c2={'custom':![]};return utilLicense[_0x56ea('0x55')]()[_0x56ea('0x16')](function(_0x11dc34){if(_0x11dc34){_0x2f49c2=_0x11dc34;}return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0x3a48c3[_0x56ea('0x4b')]['id']},'attributes':[_0x56ea('0x56'),_0x56ea('0x53'),_0x56ea('0x57'),_0x56ea('0x58'),'defaultLogo','defaultLoginLogo',_0x56ea('0x59'),_0x56ea('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x1c025f,null))[_0x56ea('0x16')](function(_0x3ff0a6){if(_0x3ff0a6){var _0x468342=_0x3ff0a6['logo']&&fs['existsSync'](path[_0x56ea('0x5b')](config['root'],_0x5c12fc,_['toLower'](_0x3ff0a6[_0x56ea('0x56')])))?path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x5c12fc,_[_0x56ea('0x5d')](_0x3ff0a6[_0x56ea('0x56')])):path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x5c12fc,_[_0x56ea('0x5d')](_0x56ea('0x5e')));var _0x1a8b09='default'+_[_0x56ea('0x5f')]('logo');if(_0x3ff0a6[_0x1a8b09]||!_0x2f49c2[_0x56ea('0x60')]){_0x468342=path[_0x56ea('0x5b')](config['root'],_0x5c12fc,_[_0x56ea('0x5d')](_0x56ea('0x5e')));}if(!fs[_0x56ea('0x61')](_0x468342)){throw new db[(_0x56ea('0x62'))][(_0x56ea('0x63'))](_['upperFirst'](_0x56ea('0x56'))+_0x56ea('0x64'));}return _0x1c025f[_0x56ea('0x65')](_0x468342);}})[_0x56ea('0x4d')](handleError(_0x1c025f,null));};var utilLicense=require(_0x56ea('0x12'));exports[_0x56ea('0x66')]=function(_0x1e91df,_0x308167,_0x292bb0){var _0x44764b=_0x56ea('0x54');var _0x465606={'custom':![]};return utilLicense[_0x56ea('0x55')]()['then'](function(_0x165368){if(_0x165368){_0x465606=_0x165368;}return db['Setting']['find']({'where':{'id':_0x1e91df[_0x56ea('0x4b')]['id']},'attributes':[_0x56ea('0x56'),_0x56ea('0x53'),_0x56ea('0x57'),'favicon',_0x56ea('0x67'),_0x56ea('0x68'),_0x56ea('0x59'),_0x56ea('0x5a')],'raw':!![]});})[_0x56ea('0x16')](handleEntityNotFound(_0x308167,null))['then'](function(_0x5919b4){if(_0x5919b4){var _0x3e918c=_0x5919b4[_0x56ea('0x53')]&&fs[_0x56ea('0x61')](path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x44764b,_[_0x56ea('0x5d')](_0x5919b4[_0x56ea('0x53')])))?path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x44764b,_[_0x56ea('0x5d')](_0x5919b4['loginLogo'])):path[_0x56ea('0x5b')](config['root'],_0x44764b,_[_0x56ea('0x5d')](_0x56ea('0x69')));var _0x9c6d86='default'+_['upperFirst'](_0x56ea('0x53'));if(_0x5919b4[_0x9c6d86]||!_0x465606[_0x56ea('0x60')]){_0x3e918c=path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x44764b,_[_0x56ea('0x5d')](_0x56ea('0x69')));}if(!fs[_0x56ea('0x61')](_0x3e918c)){throw new db['Sequelize'][(_0x56ea('0x63'))](_[_0x56ea('0x5f')](_0x56ea('0x53'))+_0x56ea('0x64'));}return _0x308167['download'](_0x3e918c);}})[_0x56ea('0x4d')](handleError(_0x308167,null));};exports['gdpr']=function(_0xb2c60b,_0x27d85e){return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0xb2c60b[_0x56ea('0x4b')]['id']},'attributes':['securePassword']})[_0x56ea('0x16')](respondWithResult(_0x27d85e,null))['catch'](handleError(_0x27d85e,null));};exports[_0x56ea('0x6a')]=function(_0x2b0d49,_0x11035a,_0x50bb05){if(_0x2b0d49[_0x56ea('0x51')]&&_0x2b0d49[_0x56ea('0x51')][_0x56ea('0x52')]){_0x2b0d49['body'][_0x56ea('0x57')]=_0x2b0d49[_0x56ea('0x51')][_0x56ea('0x52')];}return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0x2b0d49[_0x56ea('0x4b')]['id']}})[_0x56ea('0x16')](handleEntityNotFound(_0x11035a,null))[_0x56ea('0x16')](saveUpdates(_0x2b0d49['body'],null))['then'](respondWithResult(_0x11035a,null))['catch'](handleError(_0x11035a,null));};var utilLicense=require('../../config/license/util');exports[_0x56ea('0x6b')]=function(_0x1778b0,_0x3e89b7,_0x5f32af){var _0x46a93d='server/files/images/logos';var _0x20c9ef={'custom':![]};return utilLicense[_0x56ea('0x55')]()[_0x56ea('0x16')](function(_0xb9ecf9){if(_0xb9ecf9){_0x20c9ef=_0xb9ecf9;}return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0x1778b0[_0x56ea('0x4b')]['id']},'attributes':[_0x56ea('0x56'),_0x56ea('0x53'),'preferred','favicon','defaultLogo',_0x56ea('0x68'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x56ea('0x16')](handleEntityNotFound(_0x3e89b7,null))['then'](function(_0x3122a6){if(_0x3122a6){var _0x2267a1=_0x3122a6[_0x56ea('0x57')]&&fs[_0x56ea('0x61')](path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x46a93d,_['toLower'](_0x3122a6[_0x56ea('0x57')])))?path['join'](config[_0x56ea('0x5c')],_0x46a93d,_['toLower'](_0x3122a6['preferred'])):path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x46a93d,_[_0x56ea('0x5d')](_0x56ea('0x6c')));var _0x45e9d8=_0x56ea('0x6d')+_[_0x56ea('0x5f')](_0x56ea('0x57'));if(_0x3122a6[_0x45e9d8]||!_0x20c9ef[_0x56ea('0x60')]||!_0x20c9ef[_0x56ea('0x57')]){_0x2267a1=path[_0x56ea('0x5b')](config['root'],_0x46a93d,_[_0x56ea('0x5d')](_0x56ea('0x6c')));}if(!fs[_0x56ea('0x61')](_0x2267a1)){throw new db[(_0x56ea('0x62'))][(_0x56ea('0x63'))](_[_0x56ea('0x5f')](_0x56ea('0x57'))+_0x56ea('0x64'));}return _0x3e89b7[_0x56ea('0x65')](_0x2267a1);}})['catch'](handleError(_0x3e89b7,null));};exports[_0x56ea('0x6e')]=function(_0xf55c1a,_0x5ae7eb,_0x5ccaf4){if(_0xf55c1a[_0x56ea('0x51')]&&_0xf55c1a[_0x56ea('0x51')][_0x56ea('0x52')]){_0xf55c1a[_0x56ea('0x4f')][_0x56ea('0x58')]=_0xf55c1a[_0x56ea('0x51')][_0x56ea('0x52')];}return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0xf55c1a[_0x56ea('0x4b')]['id']}})[_0x56ea('0x16')](handleEntityNotFound(_0x5ae7eb,null))[_0x56ea('0x16')](saveUpdates(_0xf55c1a[_0x56ea('0x4f')],null))['then'](respondWithResult(_0x5ae7eb,null))[_0x56ea('0x4d')](handleError(_0x5ae7eb,null));};var utilLicense=require('../../config/license/util');exports[_0x56ea('0x6f')]=function(_0x21e955,_0x5403d1,_0x254b9f){var _0x49b1aa=_0x56ea('0x54');var _0x4d686a={'custom':![]};return utilLicense[_0x56ea('0x55')]()[_0x56ea('0x16')](function(_0x5f1c7d){if(_0x5f1c7d){_0x4d686a=_0x5f1c7d;}return db[_0x56ea('0x2f')][_0x56ea('0x4c')]({'where':{'id':_0x21e955[_0x56ea('0x4b')]['id']},'attributes':[_0x56ea('0x56'),_0x56ea('0x53'),_0x56ea('0x57'),_0x56ea('0x58'),_0x56ea('0x67'),'defaultLoginLogo',_0x56ea('0x59'),_0x56ea('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x5403d1,null))[_0x56ea('0x16')](function(_0xbc8cba){if(_0xbc8cba){var _0x2d0e10=_0xbc8cba[_0x56ea('0x58')]&&fs[_0x56ea('0x61')](path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x49b1aa,_[_0x56ea('0x5d')](_0xbc8cba[_0x56ea('0x58')])))?path[_0x56ea('0x5b')](config[_0x56ea('0x5c')],_0x49b1aa,_['toLower'](_0xbc8cba[_0x56ea('0x58')])):path['join'](config[_0x56ea('0x5c')],_0x49b1aa,_['toLower'](_0x56ea('0x70')));var _0x402df4=_0x56ea('0x6d')+_[_0x56ea('0x5f')]('favicon');if(_0xbc8cba[_0x402df4]||!_0x4d686a[_0x56ea('0x60')]){_0x2d0e10=path['join'](config[_0x56ea('0x5c')],_0x49b1aa,_['toLower']('default_favicon.ico'));}if(!fs[_0x56ea('0x61')](_0x2d0e10)){throw new db['Sequelize'][(_0x56ea('0x63'))](_[_0x56ea('0x5f')](_0x56ea('0x58'))+_0x56ea('0x64'));}return _0x5403d1[_0x56ea('0x65')](_0x2d0e10);}})[_0x56ea('0x4d')](handleError(_0x5403d1,null));};exports[_0x56ea('0x71')]=function(_0x434d9f,_0x4bacf9){var _0xb7f471={'offset':moment()[_0x56ea('0x72')]()};_0xb7f471['now']=moment()[_0x56ea('0x72')](_0xb7f471[_0x56ea('0x26')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x4bacf9['status'](0xc8)['send'](_0xb7f471);}; \ No newline at end of file +var _0x5469=['toLower','join','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','\x20not\x20found','getLogoLogin','defaultFavicon','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','download','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','body','file','filename','logo','addLogoLogin','loginLogo','find','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','root'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5469,0x19d));var _0x9546=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5469[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x9546('0x0'));var emlformat=require(_0x9546('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9546('0x2'));var rp=require(_0x9546('0x3'));var moment=require(_0x9546('0x4'));var BPromise=require(_0x9546('0x5'));var Mustache=require(_0x9546('0x6'));var util=require(_0x9546('0x7'));var path=require(_0x9546('0x8'));var sox=require(_0x9546('0x9'));var csv=require(_0x9546('0xa'));var ejs=require(_0x9546('0xb'));var fs=require('fs');var _=require(_0x9546('0xc'));var squel=require('squel');var crypto=require(_0x9546('0xd'));var jsforce=require(_0x9546('0xe'));var deskjs=require(_0x9546('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9546('0x10'));var Papa=require(_0x9546('0x11'));var Redis=require(_0x9546('0x12'));var authService=require(_0x9546('0x13'));var qs=require(_0x9546('0x14'));var as=require(_0x9546('0x15'));var hardwareService=require(_0x9546('0x16'));var logger=require(_0x9546('0x17'))(_0x9546('0x18'));var utils=require('../../config/utils');var config=require(_0x9546('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9546('0x1a'))['db'];var jayson=require(_0x9546('0x1b'));var client=jayson[_0x9546('0x1c')][_0x9546('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5242f8,_0xece511,_0x1e92ac,_0x54ce89){return new BPromise(function(_0x1616e0,_0x444274){var _0x119566=_0x54ce89||client;return _0x119566[_0x9546('0x1e')](_0x5242f8,_0x1e92ac)['then'](function(_0x1f8f56){logger['info'](_0x9546('0x1f'),_0xece511,_0x9546('0x20'));logger[_0x9546('0x21')](_0x9546('0x22'),_0xece511,_0x9546('0x20'),JSON[_0x9546('0x23')](_0x1f8f56));if(_0x1f8f56[_0x9546('0x24')]){if(_0x1f8f56[_0x9546('0x24')][_0x9546('0x25')]===0x1f4){logger[_0x9546('0x24')]('Setting,\x20%s,\x20%s',_0xece511,_0x1f8f56['error'][_0x9546('0x26')]);return _0x444274(_0x1f8f56[_0x9546('0x24')][_0x9546('0x26')]);}logger[_0x9546('0x24')]('Setting,\x20%s,\x20%s',_0xece511,_0x1f8f56['error'][_0x9546('0x26')]);return _0x1616e0(_0x1f8f56['error'][_0x9546('0x26')]);}else{logger[_0x9546('0x27')]('Setting,\x20%s,\x20%s',_0xece511,_0x9546('0x20'));_0x1616e0(_0x1f8f56[_0x9546('0x28')][_0x9546('0x26')]);}})[_0x9546('0x29')](function(_0x333ce2){logger['error'](_0x9546('0x1f'),_0xece511,_0x333ce2);_0x444274(_0x333ce2);});});}function respondWithStatusCode(_0x33b40b,_0xd6ed19){_0xd6ed19=_0xd6ed19||0xcc;return function(_0x56d229){if(_0x56d229){return _0x33b40b[_0x9546('0x2a')](_0xd6ed19);}return _0x33b40b['status'](_0xd6ed19)[_0x9546('0x2b')]();};}function respondWithResult(_0x208e15,_0xe8a826){_0xe8a826=_0xe8a826||0xc8;return function(_0x389159){if(_0x389159){return _0x208e15['status'](_0xe8a826)['json'](_0x389159);}};}function respondWithFilteredResult(_0x3a426d,_0x1a4c2){return function(_0x1c30f4){if(_0x1c30f4){var _0x2355b0=_0x1c30f4[_0x9546('0x2c')],_0x1cdbc7=_0x1a4c2[_0x9546('0x2d')],_0x1b734c=_0x1a4c2['offset']+_0x1a4c2[_0x9546('0x2e')],_0x3cc0f0;if(_0x1b734c>=_0x2355b0){_0x1b734c=_0x2355b0;_0x3cc0f0=0xc8;}else{_0x3cc0f0=0xce;}_0x3a426d[_0x9546('0x2f')](_0x3cc0f0);return _0x3a426d[_0x9546('0x30')](_0x9546('0x31'),_0x1cdbc7+'-'+_0x1b734c+'/'+_0x2355b0)[_0x9546('0x32')](_0x1c30f4);}return null;};}function patchUpdates(_0xe3aae3){return function(_0x29091c){try{jsonpatch[_0x9546('0x33')](_0x29091c,_0xe3aae3,!![]);}catch(_0x221318){return BPromise['reject'](_0x221318);}return _0x29091c[_0x9546('0x34')]();};}function saveUpdates(_0x548029,_0x172b6c){return function(_0xd3c579){if(_0xd3c579){return _0xd3c579[_0x9546('0x35')](_0x548029)[_0x9546('0x36')](function(_0x4ac4b4){return _0x4ac4b4;});}return null;};}function removeEntity(_0x5be723,_0x390107){return function(_0x49ce39){if(_0x49ce39){return _0x49ce39[_0x9546('0x37')]()['then'](function(){_0x5be723[_0x9546('0x2f')](0xcc)[_0x9546('0x2b')]();});}};}function handleEntityNotFound(_0x37c12f,_0x21ae3a){return function(_0x4d024c){if(!_0x4d024c){_0x37c12f[_0x9546('0x2a')](0x194);}return _0x4d024c;};}function handleError(_0x28ed70,_0x248a2d){_0x248a2d=_0x248a2d||0x1f4;return function(_0x2fbca5){logger[_0x9546('0x24')](_0x2fbca5[_0x9546('0x38')]);if(_0x2fbca5[_0x9546('0x39')]){delete _0x2fbca5[_0x9546('0x39')];}_0x28ed70[_0x9546('0x2f')](_0x248a2d)[_0x9546('0x3a')](_0x2fbca5);};}exports[_0x9546('0x3b')]=function(_0x2e759b,_0x2bd6ed){var _0x4117df={},_0xd0432c={},_0x2cc6bb={'count':0x0,'rows':[]};var _0x1faed1=_[_0x9546('0x3c')](db[_0x9546('0x3d')][_0x9546('0x3e')],function(_0x315fb0){return{'name':_0x315fb0[_0x9546('0x3f')],'type':_0x315fb0[_0x9546('0x40')]['key']};});_0xd0432c[_0x9546('0x41')]=_[_0x9546('0x3c')](_0x1faed1,_0x9546('0x39'));_0xd0432c[_0x9546('0x42')]=_[_0x9546('0x43')](_0x2e759b['query']);_0xd0432c[_0x9546('0x44')]=_[_0x9546('0x45')](_0xd0432c[_0x9546('0x41')],_0xd0432c[_0x9546('0x42')]);_0x4117df[_0x9546('0x46')]=_['intersection'](_0xd0432c[_0x9546('0x41')],qs[_0x9546('0x47')](_0x2e759b['query']['fields']));_0x4117df['attributes']=_0x4117df[_0x9546('0x46')][_0x9546('0x48')]?_0x4117df[_0x9546('0x46')]:_0xd0432c[_0x9546('0x41')];if(!_0x2e759b[_0x9546('0x42')][_0x9546('0x49')](_0x9546('0x4a'))){_0x4117df[_0x9546('0x2e')]=qs[_0x9546('0x2e')](_0x2e759b[_0x9546('0x42')][_0x9546('0x2e')]);_0x4117df[_0x9546('0x2d')]=qs[_0x9546('0x2d')](_0x2e759b[_0x9546('0x42')]['offset']);}_0x4117df[_0x9546('0x4b')]=qs[_0x9546('0x4c')](_0x2e759b['query'][_0x9546('0x4c')]);_0x4117df[_0x9546('0x4d')]=qs[_0x9546('0x44')](_[_0x9546('0x4e')](_0x2e759b[_0x9546('0x42')],_0xd0432c['filters']),_0x1faed1);if(_0x2e759b['query']['filter']){_0x4117df[_0x9546('0x4d')]=_['merge'](_0x4117df['where'],{'$or':_[_0x9546('0x3c')](_0x1faed1,function(_0x2f5845){if(_0x2f5845['type']!=='VIRTUAL'){var _0x5bf516={};_0x5bf516[_0x2f5845[_0x9546('0x39')]]={'$like':'%'+_0x2e759b[_0x9546('0x42')][_0x9546('0x4f')]+'%'};return _0x5bf516;}})});}_0x4117df=_['merge']({},_0x4117df,_0x2e759b[_0x9546('0x50')]);var _0x3e23de={'where':_0x4117df['where']};return db['Setting'][_0x9546('0x2c')](_0x3e23de)[_0x9546('0x36')](function(_0x278524){_0x2cc6bb['count']=_0x278524;if(_0x2e759b['query'][_0x9546('0x51')]){_0x4117df[_0x9546('0x52')]=[{'all':!![]}];}return db[_0x9546('0x3d')][_0x9546('0x53')](_0x4117df);})[_0x9546('0x36')](function(_0x24c229){_0x2cc6bb[_0x9546('0x54')]=_0x24c229;return _0x2cc6bb;})[_0x9546('0x36')](respondWithFilteredResult(_0x2bd6ed,_0x4117df))[_0x9546('0x29')](handleError(_0x2bd6ed,null));};exports[_0x9546('0x55')]=function(_0x2b6e8e,_0x5e8140){var _0x4b1136={'raw':![],'where':{'id':_0x2b6e8e[_0x9546('0x56')]['id']}},_0xdfd844={};_0xdfd844[_0x9546('0x41')]=_[_0x9546('0x43')](db[_0x9546('0x3d')][_0x9546('0x3e')]);_0xdfd844[_0x9546('0x42')]=_[_0x9546('0x43')](_0x2b6e8e['query']);_0xdfd844[_0x9546('0x44')]=_[_0x9546('0x45')](_0xdfd844[_0x9546('0x41')],_0xdfd844[_0x9546('0x42')]);_0x4b1136[_0x9546('0x46')]=_[_0x9546('0x45')](_0xdfd844['model'],qs[_0x9546('0x47')](_0x2b6e8e[_0x9546('0x42')][_0x9546('0x47')]));_0x4b1136[_0x9546('0x46')]=_0x4b1136[_0x9546('0x46')][_0x9546('0x48')]?_0x4b1136[_0x9546('0x46')]:_0xdfd844['model'];if(_0x2b6e8e['query'][_0x9546('0x51')]){_0x4b1136[_0x9546('0x52')]=[{'all':!![]}];}_0x4b1136=_['merge']({},_0x4b1136,_0x2b6e8e[_0x9546('0x50')]);return db['Setting']['find'](_0x4b1136)[_0x9546('0x36')](handleEntityNotFound(_0x5e8140,null))[_0x9546('0x36')](respondWithResult(_0x5e8140,null))[_0x9546('0x29')](handleError(_0x5e8140,null));};exports[_0x9546('0x35')]=function(_0x2cb54a,_0x158a32){if(_0x2cb54a['body']['id']){delete _0x2cb54a[_0x9546('0x57')]['id'];}return db[_0x9546('0x3d')]['find']({'where':{'id':_0x2cb54a['params']['id']}})[_0x9546('0x36')](handleEntityNotFound(_0x158a32,null))['then'](saveUpdates(_0x2cb54a[_0x9546('0x57')],null))['then'](respondWithResult(_0x158a32,null))[_0x9546('0x29')](handleError(_0x158a32,null));};exports['addLogo']=function(_0x96ce72,_0x5da516,_0x5b94df){if(_0x96ce72[_0x9546('0x58')]&&_0x96ce72[_0x9546('0x58')][_0x9546('0x59')]){_0x96ce72['body'][_0x9546('0x5a')]=_0x96ce72[_0x9546('0x58')][_0x9546('0x59')];}return db[_0x9546('0x3d')]['find']({'where':{'id':_0x96ce72['params']['id']}})[_0x9546('0x36')](handleEntityNotFound(_0x5da516,null))[_0x9546('0x36')](saveUpdates(_0x96ce72['body'],null))[_0x9546('0x36')](respondWithResult(_0x5da516,null))[_0x9546('0x29')](handleError(_0x5da516,null));};exports[_0x9546('0x5b')]=function(_0x36fcbb,_0x31a15f,_0xc2b501){if(_0x36fcbb[_0x9546('0x58')]&&_0x36fcbb[_0x9546('0x58')][_0x9546('0x59')]){_0x36fcbb[_0x9546('0x57')][_0x9546('0x5c')]=_0x36fcbb[_0x9546('0x58')][_0x9546('0x59')];}return db[_0x9546('0x3d')][_0x9546('0x5d')]({'where':{'id':_0x36fcbb['params']['id']}})[_0x9546('0x36')](handleEntityNotFound(_0x31a15f,null))[_0x9546('0x36')](saveUpdates(_0x36fcbb[_0x9546('0x57')],null))[_0x9546('0x36')](respondWithResult(_0x31a15f,null))['catch'](handleError(_0x31a15f,null));};var utilLicense=require(_0x9546('0x5e'));exports[_0x9546('0x5f')]=function(_0x3a04f5,_0x1181ce,_0x4939b9){var _0x3fca2b=_0x9546('0x60');var _0x10d2ef={'custom':![]};return utilLicense[_0x9546('0x61')]()[_0x9546('0x36')](function(_0x29acec){if(_0x29acec){_0x10d2ef=_0x29acec;}return db[_0x9546('0x3d')][_0x9546('0x5d')]({'where':{'id':_0x3a04f5['params']['id']},'attributes':['logo',_0x9546('0x5c'),_0x9546('0x62'),_0x9546('0x63'),_0x9546('0x64'),'defaultLoginLogo',_0x9546('0x65'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1181ce,null))[_0x9546('0x36')](function(_0x2c8788){if(_0x2c8788){var _0x479af0=_0x2c8788[_0x9546('0x5a')]&&fs['existsSync'](path['join'](config[_0x9546('0x66')],_0x3fca2b,_[_0x9546('0x67')](_0x2c8788[_0x9546('0x5a')])))?path[_0x9546('0x68')](config['root'],_0x3fca2b,_[_0x9546('0x67')](_0x2c8788[_0x9546('0x5a')])):path[_0x9546('0x68')](config[_0x9546('0x66')],_0x3fca2b,_[_0x9546('0x67')](_0x9546('0x69')));var _0x37fa42=_0x9546('0x6a')+_[_0x9546('0x6b')](_0x9546('0x5a'));if(_0x2c8788[_0x37fa42]||!_0x10d2ef[_0x9546('0x6c')]){_0x479af0=path[_0x9546('0x68')](config['root'],_0x3fca2b,_[_0x9546('0x67')](_0x9546('0x69')));}if(!fs[_0x9546('0x6d')](_0x479af0)){throw new db[(_0x9546('0x6e'))]['ValidationError'](_[_0x9546('0x6b')]('logo')+_0x9546('0x6f'));}return _0x1181ce['download'](_0x479af0);}})[_0x9546('0x29')](handleError(_0x1181ce,null));};var utilLicense=require(_0x9546('0x5e'));exports[_0x9546('0x70')]=function(_0xb253f6,_0x4a12e1,_0x50bf5a){var _0x451ea3=_0x9546('0x60');var _0x354afd={'custom':![]};return utilLicense[_0x9546('0x61')]()[_0x9546('0x36')](function(_0x4e9b18){if(_0x4e9b18){_0x354afd=_0x4e9b18;}return db[_0x9546('0x3d')]['find']({'where':{'id':_0xb253f6[_0x9546('0x56')]['id']},'attributes':[_0x9546('0x5a'),'loginLogo','preferred',_0x9546('0x63'),_0x9546('0x64'),'defaultLoginLogo','defaultPreferred',_0x9546('0x71')],'raw':!![]});})[_0x9546('0x36')](handleEntityNotFound(_0x4a12e1,null))[_0x9546('0x36')](function(_0x3e1ae8){if(_0x3e1ae8){var _0x39cf23=_0x3e1ae8[_0x9546('0x5c')]&&fs[_0x9546('0x6d')](path['join'](config['root'],_0x451ea3,_[_0x9546('0x67')](_0x3e1ae8[_0x9546('0x5c')])))?path[_0x9546('0x68')](config[_0x9546('0x66')],_0x451ea3,_[_0x9546('0x67')](_0x3e1ae8['loginLogo'])):path[_0x9546('0x68')](config['root'],_0x451ea3,_[_0x9546('0x67')](_0x9546('0x72')));var _0x279eb5=_0x9546('0x6a')+_['upperFirst']('loginLogo');if(_0x3e1ae8[_0x279eb5]||!_0x354afd[_0x9546('0x6c')]){_0x39cf23=path[_0x9546('0x68')](config[_0x9546('0x66')],_0x451ea3,_[_0x9546('0x67')](_0x9546('0x72')));}if(!fs[_0x9546('0x6d')](_0x39cf23)){throw new db[(_0x9546('0x6e'))][(_0x9546('0x73'))](_[_0x9546('0x6b')](_0x9546('0x5c'))+'\x20not\x20found');}return _0x4a12e1['download'](_0x39cf23);}})[_0x9546('0x29')](handleError(_0x4a12e1,null));};exports[_0x9546('0x74')]=function(_0x3ba014,_0x527058){return db[_0x9546('0x3d')][_0x9546('0x5d')]({'where':{'id':_0x3ba014[_0x9546('0x56')]['id']},'attributes':[_0x9546('0x75')]})[_0x9546('0x36')](respondWithResult(_0x527058,null))[_0x9546('0x29')](handleError(_0x527058,null));};exports[_0x9546('0x76')]=function(_0x465360,_0x102833,_0x5bd6fe){if(_0x465360[_0x9546('0x58')]&&_0x465360[_0x9546('0x58')]['filename']){_0x465360['body'][_0x9546('0x62')]=_0x465360[_0x9546('0x58')][_0x9546('0x59')];}return db['Setting'][_0x9546('0x5d')]({'where':{'id':_0x465360[_0x9546('0x56')]['id']}})[_0x9546('0x36')](handleEntityNotFound(_0x102833,null))[_0x9546('0x36')](saveUpdates(_0x465360[_0x9546('0x57')],null))[_0x9546('0x36')](respondWithResult(_0x102833,null))[_0x9546('0x29')](handleError(_0x102833,null));};var utilLicense=require('../../config/license/util');exports[_0x9546('0x77')]=function(_0x41b4e8,_0x129a73,_0x53dcc4){var _0x568c7d=_0x9546('0x60');var _0x5514ce={'custom':![]};return utilLicense[_0x9546('0x61')]()[_0x9546('0x36')](function(_0x290753){if(_0x290753){_0x5514ce=_0x290753;}return db['Setting'][_0x9546('0x5d')]({'where':{'id':_0x41b4e8[_0x9546('0x56')]['id']},'attributes':[_0x9546('0x5a'),'loginLogo',_0x9546('0x62'),'favicon','defaultLogo',_0x9546('0x78'),_0x9546('0x65'),_0x9546('0x71')],'raw':!![]});})['then'](handleEntityNotFound(_0x129a73,null))[_0x9546('0x36')](function(_0x4dc7da){if(_0x4dc7da){var _0x7fe31b=_0x4dc7da['preferred']&&fs[_0x9546('0x6d')](path[_0x9546('0x68')](config['root'],_0x568c7d,_[_0x9546('0x67')](_0x4dc7da[_0x9546('0x62')])))?path[_0x9546('0x68')](config[_0x9546('0x66')],_0x568c7d,_['toLower'](_0x4dc7da[_0x9546('0x62')])):path[_0x9546('0x68')](config['root'],_0x568c7d,_[_0x9546('0x67')](_0x9546('0x79')));var _0x12fda9=_0x9546('0x6a')+_[_0x9546('0x6b')](_0x9546('0x62'));if(_0x4dc7da[_0x12fda9]||!_0x5514ce[_0x9546('0x6c')]||!_0x5514ce['preferred']){_0x7fe31b=path[_0x9546('0x68')](config[_0x9546('0x66')],_0x568c7d,_[_0x9546('0x67')](_0x9546('0x79')));}if(!fs[_0x9546('0x6d')](_0x7fe31b)){throw new db[(_0x9546('0x6e'))][(_0x9546('0x73'))](_[_0x9546('0x6b')](_0x9546('0x62'))+_0x9546('0x6f'));}return _0x129a73['download'](_0x7fe31b);}})[_0x9546('0x29')](handleError(_0x129a73,null));};exports[_0x9546('0x7a')]=function(_0x4072ce,_0x342062,_0x44f032){if(_0x4072ce[_0x9546('0x58')]&&_0x4072ce[_0x9546('0x58')]['filename']){_0x4072ce[_0x9546('0x57')][_0x9546('0x63')]=_0x4072ce[_0x9546('0x58')][_0x9546('0x59')];}return db[_0x9546('0x3d')]['find']({'where':{'id':_0x4072ce[_0x9546('0x56')]['id']}})[_0x9546('0x36')](handleEntityNotFound(_0x342062,null))['then'](saveUpdates(_0x4072ce[_0x9546('0x57')],null))[_0x9546('0x36')](respondWithResult(_0x342062,null))['catch'](handleError(_0x342062,null));};var utilLicense=require('../../config/license/util');exports[_0x9546('0x7b')]=function(_0x2869cf,_0x1c4c8b,_0x1b0f3f){var _0x362306=_0x9546('0x60');var _0xc2b0ac={'custom':![]};return utilLicense[_0x9546('0x61')]()[_0x9546('0x36')](function(_0x5a17e2){if(_0x5a17e2){_0xc2b0ac=_0x5a17e2;}return db[_0x9546('0x3d')][_0x9546('0x5d')]({'where':{'id':_0x2869cf[_0x9546('0x56')]['id']},'attributes':[_0x9546('0x5a'),_0x9546('0x5c'),_0x9546('0x62'),_0x9546('0x63'),_0x9546('0x64'),_0x9546('0x78'),_0x9546('0x65'),'defaultFavicon'],'raw':!![]});})[_0x9546('0x36')](handleEntityNotFound(_0x1c4c8b,null))[_0x9546('0x36')](function(_0x5d5715){if(_0x5d5715){var _0x25c267=_0x5d5715['favicon']&&fs[_0x9546('0x6d')](path[_0x9546('0x68')](config[_0x9546('0x66')],_0x362306,_[_0x9546('0x67')](_0x5d5715[_0x9546('0x63')])))?path[_0x9546('0x68')](config[_0x9546('0x66')],_0x362306,_[_0x9546('0x67')](_0x5d5715[_0x9546('0x63')])):path[_0x9546('0x68')](config[_0x9546('0x66')],_0x362306,_[_0x9546('0x67')](_0x9546('0x7c')));var _0x479df8=_0x9546('0x6a')+_[_0x9546('0x6b')](_0x9546('0x63'));if(_0x5d5715[_0x479df8]||!_0xc2b0ac['custom']){_0x25c267=path[_0x9546('0x68')](config[_0x9546('0x66')],_0x362306,_['toLower'](_0x9546('0x7c')));}if(!fs[_0x9546('0x6d')](_0x25c267)){throw new db[(_0x9546('0x6e'))][(_0x9546('0x73'))](_['upperFirst'](_0x9546('0x63'))+_0x9546('0x6f'));}return _0x1c4c8b[_0x9546('0x7d')](_0x25c267);}})[_0x9546('0x29')](handleError(_0x1c4c8b,null));};exports['getDate']=function(_0x47ac79,_0x3b0ef6){var _0x461bab={'offset':moment()[_0x9546('0x7e')]()};_0x461bab[_0x9546('0x7f')]=moment()['utcOffset'](_0x461bab['offset'])['format'](_0x9546('0x80'));return _0x3b0ef6[_0x9546('0x2f')](0xc8)[_0x9546('0x3a')](_0x461bab);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f898e09..3f85775 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 _0x8ce4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Setting','settings','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ce4,0x14f));var _0x48ce=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0x8ce4[_0x343b56];return _0x4bdc57;};'use strict';var _=require(_0x48ce('0x0'));var util=require(_0x48ce('0x1'));var logger=require(_0x48ce('0x2'))(_0x48ce('0x3'));var moment=require(_0x48ce('0x4'));var BPromise=require(_0x48ce('0x5'));var rp=require(_0x48ce('0x6'));var fs=require('fs');var path=require(_0x48ce('0x7'));var rimraf=require(_0x48ce('0x8'));var config=require(_0x48ce('0x9'));var attributes=require('./setting.attributes');module['exports']=function(_0x52e42a,_0x26942d){return _0x52e42a[_0x48ce('0xa')](_0x48ce('0xb'),attributes,{'tableName':_0x48ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c78=['./setting.attributes','exports','define','settings','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x302b54,_0xea647e){var _0x494d8a=function(_0x5f1193){while(--_0x5f1193){_0x302b54['push'](_0x302b54['shift']());}};_0x494d8a(++_0xea647e);}(_0x8c78,0x1c0));var _0x88c7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8c78[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x88c7('0x0'));var util=require('util');var logger=require(_0x88c7('0x1'))(_0x88c7('0x2'));var moment=require(_0x88c7('0x3'));var BPromise=require(_0x88c7('0x4'));var rp=require(_0x88c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88c7('0x6'));var config=require(_0x88c7('0x7'));var attributes=require(_0x88c7('0x8'));module[_0x88c7('0x9')]=function(_0x2fec7e,_0x1a23dd){return _0x2fec7e[_0x88c7('0xa')]('Setting',attributes,{'tableName':_0x88c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index e285359..dbc04df 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 _0xa902=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','request\x20sent','debug','error','code','message','Setting,\x20%s,\x20%s','catch'];(function(_0x23080f,_0x475ecf){var _0x1bf967=function(_0x594d38){while(--_0x594d38){_0x23080f['push'](_0x23080f['shift']());}};_0x1bf967(++_0x475ecf);}(_0xa902,0x17a));var _0x2a90=function(_0x2a80f6,_0x558657){_0x2a80f6=_0x2a80f6-0x0;var _0x468c38=_0xa902[_0x2a80f6];return _0x468c38;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a90('0x4'));var db=require(_0x2a90('0x5'))['db'];var utils=require(_0x2a90('0x6'));var logger=require('../../config/logger')(_0x2a90('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a90('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x230963,_0x1daff5,_0x2f0c21){return new BPromise(function(_0x4bfabb,_0x565cbc){return client[_0x2a90('0x9')](_0x230963,_0x2f0c21)[_0x2a90('0xa')](function(_0x16e08f){logger['info']('Setting,\x20%s,\x20%s',_0x1daff5,_0x2a90('0xb'));logger[_0x2a90('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x1daff5,_0x2a90('0xb'),JSON['stringify'](_0x16e08f));if(_0x16e08f[_0x2a90('0xd')]){if(_0x16e08f[_0x2a90('0xd')][_0x2a90('0xe')]===0x1f4){logger[_0x2a90('0xd')]('Setting,\x20%s,\x20%s',_0x1daff5,_0x16e08f[_0x2a90('0xd')][_0x2a90('0xf')]);return _0x565cbc(_0x16e08f[_0x2a90('0xd')][_0x2a90('0xf')]);}logger[_0x2a90('0xd')](_0x2a90('0x10'),_0x1daff5,_0x16e08f[_0x2a90('0xd')]['message']);return _0x4bfabb(_0x16e08f[_0x2a90('0xd')][_0x2a90('0xf')]);}else{logger['info'](_0x2a90('0x10'),_0x1daff5,'request\x20sent');_0x4bfabb(_0x16e08f['result']['message']);}})[_0x2a90('0x11')](function(_0x42c540){logger['error']('Setting,\x20%s,\x20%s',_0x1daff5,_0x42c540);_0x565cbc(_0x42c540);});});} \ No newline at end of file +var _0xed19=['jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','util','moment','bluebird','rpc','../../config/environment'];(function(_0x1017fd,_0x2dd6e1){var _0x37ae10=function(_0x265e8d){while(--_0x265e8d){_0x1017fd['push'](_0x1017fd['shift']());}};_0x37ae10(++_0x2dd6e1);}(_0xed19,0x182));var _0x9ed1=function(_0x50b976,_0x490862){_0x50b976=_0x50b976-0x0;var _0x183cf2=_0xed19[_0x50b976];return _0x183cf2;};'use strict';var _=require('lodash');var util=require(_0x9ed1('0x0'));var moment=require(_0x9ed1('0x1'));var BPromise=require(_0x9ed1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ed1('0x3'));var config=require(_0x9ed1('0x4'));var jayson=require(_0x9ed1('0x5'));var client=jayson['client'][_0x9ed1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5cbdd1,_0x2aaf4d,_0x568af5){return new BPromise(function(_0x41d94a,_0x5ad9aa){return client[_0x9ed1('0x7')](_0x5cbdd1,_0x568af5)[_0x9ed1('0x8')](function(_0x2c0977){logger[_0x9ed1('0x9')](_0x9ed1('0xa'),_0x2aaf4d,'request\x20sent');logger[_0x9ed1('0xb')]('Setting,\x20%s,\x20%s,\x20%s',_0x2aaf4d,_0x9ed1('0xc'),JSON['stringify'](_0x2c0977));if(_0x2c0977['error']){if(_0x2c0977[_0x9ed1('0xd')][_0x9ed1('0xe')]===0x1f4){logger[_0x9ed1('0xd')]('Setting,\x20%s,\x20%s',_0x2aaf4d,_0x2c0977[_0x9ed1('0xd')][_0x9ed1('0xf')]);return _0x5ad9aa(_0x2c0977['error'][_0x9ed1('0xf')]);}logger[_0x9ed1('0xd')](_0x9ed1('0xa'),_0x2aaf4d,_0x2c0977[_0x9ed1('0xd')]['message']);return _0x41d94a(_0x2c0977[_0x9ed1('0xd')]['message']);}else{logger[_0x9ed1('0x9')]('Setting,\x20%s,\x20%s',_0x2aaf4d,_0x9ed1('0xc'));_0x41d94a(_0x2c0977[_0x9ed1('0x10')][_0x9ed1('0xf')]);}})['catch'](function(_0xfd7fec){logger[_0x9ed1('0xd')]('Setting,\x20%s,\x20%s',_0x2aaf4d,_0xfd7fec);_0x5ad9aa(_0xfd7fec);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8dfe388..b567df3 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 _0xb7e7=['/:id/status','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','status','addAgents','put','update','delete','removeAnswers','exports','multer','path','express','../../components/auth/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions'];(function(_0x1273db,_0x1082a2){var _0x272542=function(_0x33041f){while(--_0x33041f){_0x1273db['push'](_0x1273db['shift']());}};_0x272542(++_0x1082a2);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['getDispositions']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x6')](_0x7b7e('0xe'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x6')]('/:id/interactions',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x10')]);router['get'](_0x7b7e('0x11'),controller['statusGet']);router['get'](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x14')]('/',auth[_0x7b7e('0x8')](),controller['create']);router['post'](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x15')]);router[_0x7b7e('0x14')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x14')](_0x7b7e('0x17'),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x14')](_0x7b7e('0xe'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x19')]);router[_0x7b7e('0x14')](_0x7b7e('0x1a'),auth[_0x7b7e('0x8')](),controller['send']);router[_0x7b7e('0x14')](_0x7b7e('0x11'),controller[_0x7b7e('0x1b')]);router['post'](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1c')]);router[_0x7b7e('0x1d')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1e')]);router[_0x7b7e('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7b7e('0x1f')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x20')]);router[_0x7b7e('0x1f')](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller['removeAgents']);module[_0x7b7e('0x21')]=router; \ No newline at end of file +var _0x0713=['/:id/notify','notify','/:id/send','status','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/status','getAgents','post','create','addDisposition','addAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x7')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x7')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller[_0x3071('0x13')]);router['get']('/:id/interactions',auth[_0x3071('0x8')](),controller['getInteractions']);router[_0x3071('0x7')](_0x3071('0x14'),controller['statusGet']);router[_0x3071('0x7')]('/:id/users',auth[_0x3071('0x8')](),controller[_0x3071('0x15')]);router[_0x3071('0x16')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x17')]);router[_0x3071('0x16')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x18')]);router[_0x3071('0x16')]('/:id/canned_answers',auth[_0x3071('0x8')](),controller[_0x3071('0x19')]);router[_0x3071('0x16')](_0x3071('0x1a'),controller[_0x3071('0x1b')]);router[_0x3071('0x16')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller['addApplications']);router[_0x3071('0x16')](_0x3071('0x1c'),auth[_0x3071('0x8')](),controller['send']);router[_0x3071('0x16')]('/:id/status',controller[_0x3071('0x1d')]);router[_0x3071('0x16')](_0x3071('0x1e'),auth[_0x3071('0x8')](),controller[_0x3071('0x1f')]);router[_0x3071('0x20')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router['delete'](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x21')]);router[_0x3071('0x22')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x23')]);router[_0x3071('0x22')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x24')]);router[_0x3071('0x22')](_0x3071('0x1e'),auth['isAuthenticated'](),controller[_0x3071('0x25')]);module[_0x3071('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0b37c09..538f6d7 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 _0xe504=['infobip','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','connectel','clicksend','plivo','clickatell','csc'];(function(_0x5ed575,_0x596bd3){var _0x3b9ffb=function(_0x251fb8){while(--_0x251fb8){_0x5ed575['push'](_0x5ed575['shift']());}};_0x3b9ffb(++_0x596bd3);}(_0xe504,0x1d9));var _0x4e50=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe504[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4e50('0x0'));module[_0x4e50('0x1')]={'name':{'type':Sequelize[_0x4e50('0x2')],'unique':_0x4e50('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4e50('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4e50('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4e50('0x2')],'defaultValue':function(){return rs[_0x4e50('0x4')]();}},'phone':{'type':Sequelize[_0x4e50('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4e50('0x5'),'skebby',_0x4e50('0x6'),_0x4e50('0x7'),_0x4e50('0x8'),_0x4e50('0x9'),_0x4e50('0xa'),_0x4e50('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0x4e50('0x2')]},'authId':{'type':Sequelize[_0x4e50('0x2')]},'authToken':{'type':Sequelize[_0x4e50('0x2')]},'smsMethod':{'type':Sequelize[_0x4e50('0xc')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x4e50('0x2')]},'senderString':{'type':Sequelize[_0x4e50('0x2')]},'deliveryReport':{'type':Sequelize[_0x4e50('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x4e50('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4e50('0xe')],'defaultValue':function(){return _0x4e50('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4e50('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e50('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4e50('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4e50('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4e50('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4e50('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4e50('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x4e50('0xd')],'defaultValue':![],'comment':_0x4e50('0x12'),'set':function(_0x4c58ef){if(!_0x4c58ef)this[_0x4e50('0x13')](_0x4e50('0x14'),null);this['setDataValue'](_0x4e50('0x15'),_0x4c58ef);}}}; \ No newline at end of file +var _0x00e5=['randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clickatell','csc','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x223f79,_0xd3ab9a){var _0x38acc3=function(_0x2fb680){while(--_0x2fb680){_0x223f79['push'](_0x223f79['shift']());}};_0x38acc3(++_0xd3ab9a);}(_0x00e5,0x17b));var _0x500e=function(_0x4109d9,_0x442104){_0x4109d9=_0x4109d9-0x0;var _0x23ceb2=_0x00e5[_0x4109d9];return _0x23ceb2;};'use strict';var Sequelize=require(_0x500e('0x0'));var rs=require(_0x500e('0x1'));module[_0x500e('0x2')]={'name':{'type':Sequelize[_0x500e('0x3')],'unique':_0x500e('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x500e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x500e('0x3')],'defaultValue':function(){return rs[_0x500e('0x5')]();}},'phone':{'type':Sequelize[_0x500e('0x3')]},'type':{'type':Sequelize[_0x500e('0x6')]('twilio',_0x500e('0x7'),_0x500e('0x8'),'clicksend','plivo',_0x500e('0x9'),_0x500e('0xa'),'infobip',_0x500e('0xb'))},'accountSid':{'type':Sequelize[_0x500e('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x500e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x500e('0x3')]},'password':{'type':Sequelize[_0x500e('0x3')]},'apiKey':{'type':Sequelize[_0x500e('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x500e('0xc')],'defaultValue':function(){return _0x500e('0xd');}},'notificationSound':{'type':Sequelize[_0x500e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x500e('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x500e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x500e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x500e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x500e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x500e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x500e('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x500e('0xf')],'comment':_0x500e('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x500e('0x11'),'set':function(_0x594e73){if(!_0x594e73)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x500e('0x12')](_0x500e('0x13'),_0x594e73);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 95b818c..4906d1c 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 _0xd45f=['emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','find','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','options','rows','removeDispositions','ids','CannedAnswer','order','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','account','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','replyMessageId','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','\x0a','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','requestid','statusInt','status_code','groupName','clickatell','redif','DELIVERED','error_code','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','message-id','state','addAgents'];(function(_0x85a78a,_0x1896e0){var _0x3942ac=function(_0x3be30f){while(--_0x3be30f){_0x85a78a['push'](_0x85a78a['shift']());}};_0x3942ac(++_0x1896e0);}(_0xd45f,0xe0));var _0xfd45=function(_0x10f65d,_0x2279fd){_0x10f65d=_0x10f65d-0x0;var _0x641a7f=_0xd45f[_0x10f65d];return _0x641a7f;};'use strict';var pdf=require(_0xfd45('0x0'));var emlformat=require(_0xfd45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfd45('0x2'));var jsonpatch=require(_0xfd45('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd45('0x4'));var util=require(_0xfd45('0x5'));var path=require(_0xfd45('0x6'));var sox=require(_0xfd45('0x7'));var csv=require(_0xfd45('0x8'));var ejs=require(_0xfd45('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd45('0xa'));var crypto=require(_0xfd45('0xb'));var jsforce=require(_0xfd45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfd45('0x8'));var querystring=require(_0xfd45('0xd'));var Papa=require(_0xfd45('0xe'));var Redis=require(_0xfd45('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfd45('0x10'));var as=require(_0xfd45('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd45('0x12'))('api');var utils=require(_0xfd45('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfd45('0x14')]=_['defaults'](config[_0xfd45('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd45('0x15'))(new Redis(config[_0xfd45('0x14')]));require(_0xfd45('0x16'))[_0xfd45('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2eec3b,_0x4364ad,_0x5243c5,_0x2b663e){return new BPromise(function(_0x34858f,_0x58873b){var _0x2bce54=_0x2b663e||client;return _0x2bce54[_0xfd45('0x18')](_0x2eec3b,_0x5243c5)[_0xfd45('0x19')](function(_0x5e17da){logger[_0xfd45('0x1a')](_0xfd45('0x1b'),_0x4364ad,_0xfd45('0x1c'));logger[_0xfd45('0x1d')](_0xfd45('0x1e'),_0x4364ad,_0xfd45('0x1c'),JSON[_0xfd45('0x1f')](_0x5e17da));if(_0x5e17da['error']){if(_0x5e17da[_0xfd45('0x20')][_0xfd45('0x21')]===0x1f4){logger[_0xfd45('0x20')](_0xfd45('0x1b'),_0x4364ad,_0x5e17da[_0xfd45('0x20')][_0xfd45('0x22')]);return _0x58873b(_0x5e17da['error'][_0xfd45('0x22')]);}logger[_0xfd45('0x20')]('SmsAccount,\x20%s,\x20%s',_0x4364ad,_0x5e17da[_0xfd45('0x20')][_0xfd45('0x22')]);return _0x34858f(_0x5e17da[_0xfd45('0x20')]['message']);}else{logger[_0xfd45('0x1a')](_0xfd45('0x1b'),_0x4364ad,'request\x20sent');_0x34858f(_0x5e17da['result'][_0xfd45('0x22')]);}})[_0xfd45('0x23')](function(_0x5e6274){logger[_0xfd45('0x20')]('SmsAccount,\x20%s,\x20%s',_0x4364ad,_0x5e6274);_0x58873b(_0x5e6274);});});}function respondWithStatusCode(_0x12234f,_0x3d7666){_0x3d7666=_0x3d7666||0xcc;return function(_0x3dfe07){if(_0x3dfe07){return _0x12234f['sendStatus'](_0x3d7666);}return _0x12234f['status'](_0x3d7666)[_0xfd45('0x24')]();};}function respondWithResult(_0x3f04a7,_0x216eff){_0x216eff=_0x216eff||0xc8;return function(_0x51e98b){if(_0x51e98b){return _0x3f04a7[_0xfd45('0x25')](_0x216eff)[_0xfd45('0x26')](_0x51e98b);}};}function respondWithFilteredResult(_0x4ef515,_0xfc730a){return function(_0x257f91){if(_0x257f91){var _0x57c304=_0x257f91['count'],_0x52eaf3=_0xfc730a['offset'],_0x4c0004=_0xfc730a[_0xfd45('0x27')]+_0xfc730a['limit'],_0x1abcad;if(_0x4c0004>=_0x57c304){_0x4c0004=_0x57c304;_0x1abcad=0xc8;}else{_0x1abcad=0xce;}_0x4ef515['status'](_0x1abcad);return _0x4ef515[_0xfd45('0x28')](_0xfd45('0x29'),_0x52eaf3+'-'+_0x4c0004+'/'+_0x57c304)[_0xfd45('0x26')](_0x257f91);}return null;};}function patchUpdates(_0x11238b){return function(_0x427ae1){try{jsonpatch[_0xfd45('0x2a')](_0x427ae1,_0x11238b,!![]);}catch(_0x210686){return BPromise[_0xfd45('0x2b')](_0x210686);}return _0x427ae1['save']();};}function saveUpdates(_0x27cb12,_0x18a06e){return function(_0x4eb32e){if(_0x4eb32e){return _0x4eb32e[_0xfd45('0x2c')](_0x27cb12)[_0xfd45('0x19')](function(_0x1bd66d){return _0x1bd66d;});}return null;};}function removeEntity(_0x3c65c6,_0x3de21){return function(_0x365bdd){if(_0x365bdd){return _0x365bdd[_0xfd45('0x2d')]()[_0xfd45('0x19')](function(){var _0x48ab4b=_0x365bdd[_0xfd45('0x2e')]({'plain':!![]});var _0x4373a9=_0xfd45('0x2f');return db[_0xfd45('0x30')][_0xfd45('0x2d')]({'where':{'type':_0x4373a9,'resourceId':_0x48ab4b['id']}})[_0xfd45('0x19')](function(){return _0x365bdd;});})['then'](function(){_0x3c65c6[_0xfd45('0x25')](0xcc)[_0xfd45('0x24')]();});}};}function handleEntityNotFound(_0x1bacdd,_0x5ee612){return function(_0xd0f87e){if(!_0xd0f87e){_0x1bacdd[_0xfd45('0x31')](0x194);}return _0xd0f87e;};}function handleError(_0x20b517,_0x25c748){_0x25c748=_0x25c748||0x1f4;return function(_0x18ac80){logger[_0xfd45('0x20')](_0x18ac80[_0xfd45('0x32')]);if(_0x18ac80[_0xfd45('0x33')]){delete _0x18ac80[_0xfd45('0x33')];}_0x20b517['status'](_0x25c748)[_0xfd45('0x34')](_0x18ac80);};}exports['index']=function(_0x54913c,_0x3bfe39){var _0x274b38={'include':[{'model':db[_0xfd45('0x35')],'as':_0xfd45('0x36')}]},_0x556a5a={},_0x2e76eb={'count':0x0,'rows':[]};var _0xabba3f=_[_0xfd45('0x37')](db[_0xfd45('0x38')][_0xfd45('0x39')],function(_0x234bb4){return{'name':_0x234bb4[_0xfd45('0x3a')],'type':_0x234bb4['type'][_0xfd45('0x3b')]};});_0x556a5a[_0xfd45('0x3c')]=_['map'](_0xabba3f,_0xfd45('0x33'));_0x556a5a[_0xfd45('0x3d')]=_[_0xfd45('0x3e')](_0x54913c['query']);_0x556a5a[_0xfd45('0x3f')]=_[_0xfd45('0x40')](_0x556a5a[_0xfd45('0x3c')],_0x556a5a['query']);_0x274b38[_0xfd45('0x41')]=_['intersection'](_0x556a5a['model'],qs[_0xfd45('0x42')](_0x54913c['query'][_0xfd45('0x42')]));_0x274b38['attributes']=_0x274b38['attributes'][_0xfd45('0x43')]?_0x274b38[_0xfd45('0x41')]:_0x556a5a[_0xfd45('0x3c')];if(!_0x54913c[_0xfd45('0x3d')][_0xfd45('0x44')](_0xfd45('0x45'))){_0x274b38[_0xfd45('0x46')]=qs['limit'](_0x54913c[_0xfd45('0x3d')][_0xfd45('0x46')]);_0x274b38[_0xfd45('0x27')]=qs[_0xfd45('0x27')](_0x54913c['query'][_0xfd45('0x27')]);}_0x274b38['order']=qs[_0xfd45('0x47')](_0x54913c[_0xfd45('0x3d')][_0xfd45('0x47')]);_0x274b38[_0xfd45('0x48')]=qs[_0xfd45('0x3f')](_['pick'](_0x54913c['query'],_0x556a5a[_0xfd45('0x3f')]),_0xabba3f);if(_0x54913c[_0xfd45('0x3d')][_0xfd45('0x49')]){_0x274b38[_0xfd45('0x48')]=_[_0xfd45('0x4a')](_0x274b38['where'],{'$or':_[_0xfd45('0x37')](_0xabba3f,function(_0x232c33){if(_0x232c33[_0xfd45('0x4b')]!==_0xfd45('0x4c')){var _0x275ef={};_0x275ef[_0x232c33[_0xfd45('0x33')]]={'$like':'%'+_0x54913c['query'][_0xfd45('0x49')]+'%'};return _0x275ef;}})});}_0x274b38=_[_0xfd45('0x4a')]({},_0x274b38,_0x54913c['options']);var _0x9a0274={'where':_0x274b38[_0xfd45('0x48')]};return db[_0xfd45('0x38')][_0xfd45('0x4d')](_0x9a0274)[_0xfd45('0x19')](function(_0x54c735){_0x2e76eb[_0xfd45('0x4d')]=_0x54c735;if(_0x54913c[_0xfd45('0x3d')][_0xfd45('0x4e')]){_0x274b38[_0xfd45('0x4f')]=[{'all':!![]}];}return db[_0xfd45('0x38')][_0xfd45('0x50')](_0x274b38);})[_0xfd45('0x19')](function(_0x3473fd){_0x2e76eb['rows']=_0x3473fd;return _0x2e76eb;})[_0xfd45('0x19')](respondWithFilteredResult(_0x3bfe39,_0x274b38))[_0xfd45('0x23')](handleError(_0x3bfe39,null));};exports[_0xfd45('0x51')]=function(_0x387daf,_0x5048cd){var _0x6994ad={'raw':![],'where':{'id':_0x387daf[_0xfd45('0x52')]['id']},'include':[{'model':db[_0xfd45('0x35')],'as':'mandatoryDispositionPause'}]},_0x29cfbe={};_0x29cfbe[_0xfd45('0x3c')]=_[_0xfd45('0x3e')](db[_0xfd45('0x38')]['rawAttributes']);_0x29cfbe[_0xfd45('0x3d')]=_[_0xfd45('0x3e')](_0x387daf[_0xfd45('0x3d')]);_0x29cfbe[_0xfd45('0x3f')]=_[_0xfd45('0x40')](_0x29cfbe[_0xfd45('0x3c')],_0x29cfbe['query']);_0x6994ad[_0xfd45('0x41')]=_['intersection'](_0x29cfbe[_0xfd45('0x3c')],qs[_0xfd45('0x42')](_0x387daf[_0xfd45('0x3d')][_0xfd45('0x42')]));_0x6994ad[_0xfd45('0x41')]=_0x6994ad['attributes'][_0xfd45('0x43')]?_0x6994ad[_0xfd45('0x41')]:_0x29cfbe['model'];if(_0x387daf[_0xfd45('0x3d')][_0xfd45('0x4e')]){_0x6994ad[_0xfd45('0x4f')]=[{'all':!![]}];}_0x6994ad=_[_0xfd45('0x4a')]({},_0x6994ad,_0x387daf['options']);return db[_0xfd45('0x38')]['find'](_0x6994ad)[_0xfd45('0x19')](handleEntityNotFound(_0x5048cd,null))[_0xfd45('0x19')](respondWithResult(_0x5048cd,null))['catch'](handleError(_0x5048cd,null));};exports[_0xfd45('0x53')]=function(_0x61c6a,_0x54f7ba){return db[_0xfd45('0x38')][_0xfd45('0x53')](_0x61c6a['body'],{})[_0xfd45('0x19')](function(_0x323c08){var _0x175582=_0x61c6a[_0xfd45('0x54')]['get']({'plain':!![]});if(!_0x175582)throw new Error(_0xfd45('0x55'));if(_0x175582[_0xfd45('0x56')]==='user'){var _0x1745e8=_0x323c08[_0xfd45('0x2e')]({'plain':!![]});var _0x52fc4b=_0xfd45('0x2f');return db[_0xfd45('0x57')]['find']({'where':{'name':_0x52fc4b,'userProfileId':_0x175582[_0xfd45('0x58')]},'raw':!![]})[_0xfd45('0x19')](function(_0x52dd80){if(_0x52dd80&&_0x52dd80[_0xfd45('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x1745e8['name'],'resourceId':_0x1745e8['id'],'type':_0x52dd80[_0xfd45('0x33')],'sectionId':_0x52dd80['id']},{})[_0xfd45('0x19')](function(){return _0x323c08;});}else{return _0x323c08;}})[_0xfd45('0x23')](function(_0x3db4cb){logger[_0xfd45('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3db4cb);throw _0x3db4cb;});}return _0x323c08;})[_0xfd45('0x19')](respondWithResult(_0x54f7ba,0xc9))[_0xfd45('0x23')](handleError(_0x54f7ba,null));};exports['update']=function(_0x4d9f7f,_0x20748f){if(_0x4d9f7f['body']['id']){delete _0x4d9f7f[_0xfd45('0x5a')]['id'];}return db[_0xfd45('0x38')]['find']({'where':{'id':_0x4d9f7f[_0xfd45('0x52')]['id']},'include':[{'model':db[_0xfd45('0x35')],'as':_0xfd45('0x36')}]})['then'](handleEntityNotFound(_0x20748f,null))['then'](saveUpdates(_0x4d9f7f[_0xfd45('0x5a')],null))[_0xfd45('0x19')](respondWithResult(_0x20748f,null))['catch'](handleError(_0x20748f,null));};exports['destroy']=function(_0x5e4a5a,_0x526911){return db['SmsAccount'][_0xfd45('0x5b')]({'where':{'id':_0x5e4a5a[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x526911,null))[_0xfd45('0x19')](removeEntity(_0x526911,null))['catch'](handleError(_0x526911,null));};exports['describe']=function(_0x46ba8d,_0x1c164d){return db[_0xfd45('0x38')][_0xfd45('0x5c')]()['then'](respondWithResult(_0x1c164d,null))[_0xfd45('0x23')](handleError(_0x1c164d,null));};exports[_0xfd45('0x5d')]=function(_0x85ee93,_0x15c7e4,_0x48fc9c){if(_0x85ee93[_0xfd45('0x5a')]['id']){delete _0x85ee93[_0xfd45('0x5a')]['id'];}return db[_0xfd45('0x38')][_0xfd45('0x5b')]({'where':{'id':_0x85ee93[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x15c7e4,null))[_0xfd45('0x19')](function(_0x39567b){if(_0x39567b){_0x85ee93['body'][_0xfd45('0x5e')]=_0x39567b['id'];return db[_0xfd45('0x5f')][_0xfd45('0x53')](_0x85ee93[_0xfd45('0x5a')]);}})[_0xfd45('0x19')](respondWithResult(_0x15c7e4,null))[_0xfd45('0x23')](handleError(_0x15c7e4,null));};exports[_0xfd45('0x60')]=function(_0x13f721,_0x10146a,_0x126bb2){var _0x2ee75e={'raw':![],'where':{}};var _0x2772df={};var _0x5520d1={'count':0x0,'rows':[]};return db['SmsAccount'][_0xfd45('0x61')]({'where':{'id':_0x13f721[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x10146a,null))[_0xfd45('0x19')](function(_0xec3c0){if(_0xec3c0){_0x2772df[_0xfd45('0x3c')]=_[_0xfd45('0x3e')](db['Disposition'][_0xfd45('0x39')]);_0x2772df[_0xfd45('0x3d')]=_['keys'](_0x13f721[_0xfd45('0x3d')]);_0x2772df[_0xfd45('0x3f')]=_[_0xfd45('0x40')](_0x2772df[_0xfd45('0x3c')],_0x2772df[_0xfd45('0x3d')]);_0x2ee75e[_0xfd45('0x41')]=_[_0xfd45('0x40')](_0x2772df[_0xfd45('0x3c')],qs['fields'](_0x13f721['query'][_0xfd45('0x42')]));_0x2ee75e[_0xfd45('0x41')]=_0x2ee75e[_0xfd45('0x41')][_0xfd45('0x43')]?_0x2ee75e[_0xfd45('0x41')]:_0x2772df[_0xfd45('0x3c')];if(!_0x13f721[_0xfd45('0x3d')]['hasOwnProperty'](_0xfd45('0x45'))){_0x2ee75e[_0xfd45('0x46')]=qs[_0xfd45('0x46')](_0x13f721['query']['limit']);_0x2ee75e[_0xfd45('0x27')]=qs[_0xfd45('0x27')](_0x13f721['query'][_0xfd45('0x27')]);}_0x2ee75e['order']=qs[_0xfd45('0x47')](_0x13f721[_0xfd45('0x3d')][_0xfd45('0x47')]);_0x2ee75e[_0xfd45('0x48')]=qs[_0xfd45('0x3f')](_[_0xfd45('0x62')](_0x13f721[_0xfd45('0x3d')],_0x2772df[_0xfd45('0x3f')]));_0x2ee75e[_0xfd45('0x48')][_0xfd45('0x5e')]=_0xec3c0['id'];if(_0x13f721[_0xfd45('0x3d')]['filter']){_0x2ee75e[_0xfd45('0x48')]=_[_0xfd45('0x4a')](_0x2ee75e[_0xfd45('0x48')],{'$or':_[_0xfd45('0x37')](_0x2ee75e[_0xfd45('0x41')],function(_0xdfb16d){var _0x4c1d12={};_0x4c1d12[_0xdfb16d]={'$like':'%'+_0x13f721[_0xfd45('0x3d')][_0xfd45('0x49')]+'%'};return _0x4c1d12;})});}_0x2ee75e=_['merge']({},_0x2ee75e,_0x13f721[_0xfd45('0x63')]);return db[_0xfd45('0x5f')][_0xfd45('0x4d')]({'where':_0x2ee75e['where']})['then'](function(_0x3b296e){_0x5520d1[_0xfd45('0x4d')]=_0x3b296e;if(_0x13f721['query'][_0xfd45('0x4e')]){_0x2ee75e[_0xfd45('0x4f')]=[{'all':!![]}];}return db[_0xfd45('0x5f')]['findAll'](_0x2ee75e);})[_0xfd45('0x19')](function(_0x41a62b){_0x5520d1[_0xfd45('0x64')]=_0x41a62b;return _0x5520d1;});}})[_0xfd45('0x19')](respondWithFilteredResult(_0x10146a,_0x2ee75e))[_0xfd45('0x23')](handleError(_0x10146a,null));};exports['removeDispositions']=function(_0x4a5ed8,_0x4f2faa,_0x4a59b9){return db['SmsAccount'][_0xfd45('0x5b')]({'where':{'id':_0x4a5ed8['params']['id']}})['then'](handleEntityNotFound(_0x4f2faa,null))['then'](function(_0x2a87a5){if(_0x2a87a5){return _0x2a87a5[_0xfd45('0x65')](_0x4a5ed8[_0xfd45('0x3d')][_0xfd45('0x66')]);}})['then'](respondWithStatusCode(_0x4f2faa,null))[_0xfd45('0x23')](handleError(_0x4f2faa,null));};exports['addAnswer']=function(_0x5dbdbd,_0x1b4897,_0x474017){if(_0x5dbdbd[_0xfd45('0x5a')]['id']){delete _0x5dbdbd[_0xfd45('0x5a')]['id'];}return db[_0xfd45('0x38')][_0xfd45('0x5b')]({'where':{'id':_0x5dbdbd['params']['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x1b4897,null))[_0xfd45('0x19')](function(_0xfa07a9){if(_0xfa07a9){_0x5dbdbd['body'][_0xfd45('0x5e')]=_0xfa07a9['id'];return db[_0xfd45('0x67')][_0xfd45('0x53')](_0x5dbdbd[_0xfd45('0x5a')]);}})['then'](respondWithResult(_0x1b4897,null))['catch'](handleError(_0x1b4897,null));};exports['getAnswers']=function(_0x3cd57d,_0x262e69,_0x39c4f1){var _0x303177={'raw':![],'where':{}};var _0x55e843={};var _0x3faf9c={'count':0x0,'rows':[]};return db[_0xfd45('0x38')]['findOne']({'where':{'id':_0x3cd57d[_0xfd45('0x52')]['id']}})['then'](handleEntityNotFound(_0x262e69,null))[_0xfd45('0x19')](function(_0x31740c){if(_0x31740c){_0x55e843['model']=_[_0xfd45('0x3e')](db['CannedAnswer'][_0xfd45('0x39')]);_0x55e843[_0xfd45('0x3d')]=_['keys'](_0x3cd57d['query']);_0x55e843[_0xfd45('0x3f')]=_[_0xfd45('0x40')](_0x55e843[_0xfd45('0x3c')],_0x55e843[_0xfd45('0x3d')]);_0x303177['attributes']=_[_0xfd45('0x40')](_0x55e843[_0xfd45('0x3c')],qs['fields'](_0x3cd57d[_0xfd45('0x3d')][_0xfd45('0x42')]));_0x303177[_0xfd45('0x41')]=_0x303177['attributes']['length']?_0x303177[_0xfd45('0x41')]:_0x55e843[_0xfd45('0x3c')];if(!_0x3cd57d[_0xfd45('0x3d')][_0xfd45('0x44')](_0xfd45('0x45'))){_0x303177['limit']=qs[_0xfd45('0x46')](_0x3cd57d[_0xfd45('0x3d')]['limit']);_0x303177[_0xfd45('0x27')]=qs[_0xfd45('0x27')](_0x3cd57d[_0xfd45('0x3d')][_0xfd45('0x27')]);}_0x303177[_0xfd45('0x68')]=qs[_0xfd45('0x47')](_0x3cd57d[_0xfd45('0x3d')][_0xfd45('0x47')]);_0x303177[_0xfd45('0x48')]=qs[_0xfd45('0x3f')](_[_0xfd45('0x62')](_0x3cd57d[_0xfd45('0x3d')],_0x55e843[_0xfd45('0x3f')]));_0x303177['where'][_0xfd45('0x5e')]=_0x31740c['id'];if(_0x3cd57d[_0xfd45('0x3d')]['filter']){_0x303177[_0xfd45('0x48')]=_[_0xfd45('0x4a')](_0x303177[_0xfd45('0x48')],{'$or':_[_0xfd45('0x37')](_0x303177[_0xfd45('0x41')],function(_0x5ea6a5){var _0x4940f6={};_0x4940f6[_0x5ea6a5]={'$like':'%'+_0x3cd57d[_0xfd45('0x3d')][_0xfd45('0x49')]+'%'};return _0x4940f6;})});}_0x303177=_['merge']({},_0x303177,_0x3cd57d[_0xfd45('0x63')]);return db['CannedAnswer'][_0xfd45('0x4d')]({'where':_0x303177[_0xfd45('0x48')]})[_0xfd45('0x19')](function(_0x32ff97){_0x3faf9c[_0xfd45('0x4d')]=_0x32ff97;if(_0x3cd57d[_0xfd45('0x3d')][_0xfd45('0x4e')]){_0x303177[_0xfd45('0x4f')]=[{'all':!![]}];}return db[_0xfd45('0x67')][_0xfd45('0x50')](_0x303177);})[_0xfd45('0x19')](function(_0x2ff7b6){_0x3faf9c[_0xfd45('0x64')]=_0x2ff7b6;return _0x3faf9c;});}})['then'](respondWithFilteredResult(_0x262e69,_0x303177))[_0xfd45('0x23')](handleError(_0x262e69,null));};exports[_0xfd45('0x69')]=function(_0x493cde,_0x1d0952,_0x9e55fe){return db[_0xfd45('0x38')]['find']({'where':{'id':_0x493cde['params']['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x1d0952,null))['then'](function(_0x4873cd){if(_0x4873cd){return _0x4873cd[_0xfd45('0x69')](_0x493cde['query']['ids']);}})['then'](respondWithStatusCode(_0x1d0952,null))['catch'](handleError(_0x1d0952,null));};exports[_0xfd45('0x6a')]=function(_0x535f90,_0x19f598,_0x51fe42){var _0x1f0259={'channel':_0xfd45('0x6b')};var _0x2e4fe3=[];var _0xb94736=[];var _0x3bc47f={};return db[_0xfd45('0x38')][_0xfd45('0x5b')]({'where':{'id':_0x535f90['params']['id']},'include':[{'model':db[_0xfd45('0x6c')],'as':_0xfd45('0x6d')}]})['then'](handleEntityNotFound(_0x19f598,null))['then'](function(_0x385b5b){_0x1f0259['account']=_0x385b5b;_0x1f0259[_0xfd45('0x6e')]=_[_0xfd45('0x6f')](_0x385b5b[_0xfd45('0x6d')],[_0xfd45('0x70')],[_0xfd45('0x71')]);if(_0x1f0259['account'][_0xfd45('0x6d')]){delete _0x1f0259['account']['Applications'];}return db[_0xfd45('0x72')]['describe']();})['then'](function(_0x2a5e9a){if(!_0x2a5e9a){throw new db[(_0xfd45('0x73'))][(_0xfd45('0x74'))](_0xfd45('0x75'));}_0x2e4fe3=_[_0xfd45('0x76')](_['keys'](_0x2a5e9a),[_0xfd45('0x77'),_0xfd45('0x78')]);_0xb94736=_[_0xfd45('0x76')](_['keys'](_0x2a5e9a),['createdAt',_0xfd45('0x78'),_0xfd45('0x79'),_0xfd45('0x7a')]);_0x1f0259['body']={'mapKey':_0xfd45('0x7b')};if(_0x1f0259[_0xfd45('0x7c')]['type']){switch(_0x1f0259[_0xfd45('0x7c')][_0xfd45('0x4b')]){case'twilio':_0x1f0259[_0xfd45('0x5a')]['from']=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x7d')];_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x5a')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x7e')];_0x1f0259['body'][_0xfd45('0x7f')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x80')];break;case _0xfd45('0x81'):_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x82')]='+'+_0x535f90['body'][_0xfd45('0x83')];_0x1f0259['body']['body']=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x84')];break;case _0xfd45('0x85'):_0x1f0259['body'][_0xfd45('0x82')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x82')];_0x1f0259['body']['body']=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x22')];break;case _0xfd45('0x86'):_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x82')]=_0x535f90['body'][_0xfd45('0x82')];_0x1f0259[_0xfd45('0x5a')]['body']=_0x535f90['body'][_0xfd45('0x5a')];_0x1f0259['body']['messageId']=_0x535f90['body'][_0xfd45('0x87')];break;case'plivo':_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x82')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x7d')];_0x1f0259['body'][_0xfd45('0x5a')]=_0x535f90[_0xfd45('0x5a')]['Text'];_0x1f0259[_0xfd45('0x5a')]['messageId']=_0x535f90['body'][_0xfd45('0x88')];break;case _0xfd45('0x89'):_0x1f0259[_0xfd45('0x5a')]['from']='+'+_0x535f90['body'][_0xfd45('0x8a')][0x0]['from'];_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x5a')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x8a')][0x0][_0xfd45('0x84')];_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x7f')]=_0x535f90['body']['results'][0x0][_0xfd45('0x7f')];break;case _0xfd45('0x8b'):_0x1f0259[_0xfd45('0x5a')]['from']=_0x535f90['body'][_0xfd45('0x8c')];_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x5a')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x8d')][_0xfd45('0x22')];break;case'clickatell':_0x1f0259['body'][_0xfd45('0x82')]=_0x535f90[_0xfd45('0x5a')]['fromNumber'];_0x1f0259['body'][_0xfd45('0x5a')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x84')];_0x1f0259['body'][_0xfd45('0x7f')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x8e')];break;case _0xfd45('0x8f'):_0x1f0259['body'][_0xfd45('0x82')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x82')];_0x1f0259['body'][_0xfd45('0x5a')]=_0x535f90['body'][_0xfd45('0x22')];_0x1f0259['body'][_0xfd45('0x7f')]=_0x535f90[_0xfd45('0x5a')][_0xfd45('0x90')];break;}}if(_0x1f0259['body']['id']){delete _0x1f0259[_0xfd45('0x5a')]['id'];}if(_[_0xfd45('0x91')](_0x1f0259['body'][_0xfd45('0x82')])){throw new db[(_0xfd45('0x73'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xfd45('0x91')](_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x5a')])||_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x5a')]===''){throw new db[(_0xfd45('0x73'))][(_0xfd45('0x74'))](_0xfd45('0x92'));}if(_[_0xfd45('0x91')](_0x1f0259['body'][_0xfd45('0x93')])){throw new db[(_0xfd45('0x73'))][(_0xfd45('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb94736);}if(!_[_0xfd45('0x94')](_0xb94736,_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x93')])){throw new db[(_0xfd45('0x73'))][(_0xfd45('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb94736);}_0x3bc47f[_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x93')]]=_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x82')];return db[_0xfd45('0x95')]['find']({'where':{'id':_0x1f0259['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0xfd45('0x96'),'where':_0x3bc47f,'limit':0x1,'order':[[_0xfd45('0x78'),_0xfd45('0x97')]]}]});})['then'](handleEntityNotFound(_0x19f598,null))[_0xfd45('0x19')](function(_0x57f5e4){if(_0x57f5e4){_0x1f0259[_0xfd45('0x98')]=_[_0xfd45('0x99')](_0x57f5e4,[_0xfd45('0x96')]);if(_0x57f5e4['Contacts'][_0xfd45('0x43')]){return _0x57f5e4[_0xfd45('0x96')][0x0];}var _0x54bef0=_[_0xfd45('0x9a')](_0x1f0259[_0xfd45('0x5a')],{'firstName':_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x82')],'ListId':_0x57f5e4['id']});_0x54bef0[_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x93')]]=_0x1f0259[_0xfd45('0x5a')]['from'];return db['CmContact'][_0xfd45('0x53')](_0x54bef0,{'fields':_0x2e4fe3,'raw':!![]});}})[_0xfd45('0x19')](handleEntityNotFound(_0x19f598,null))['then'](function(_0x5d53ad){if(_0x5d53ad){_0x1f0259[_0xfd45('0x9b')]=_0x5d53ad;var _0x2e6f16={'ContactId':_0x5d53ad['id'],'phone':_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x82')],'SmsAccountId':_0x535f90[_0xfd45('0x52')]['id']};var _0x4c0fda={'ContactId':_0x5d53ad['id'],'SmsAccountId':_0x535f90[_0xfd45('0x52')]['id'],'closed':![]};return db[_0xfd45('0x9c')][_0xfd45('0x5b')]({'where':_0x4c0fda})[_0xfd45('0x19')](function(_0x3e1aea){if(_0x3e1aea){return[_0x3e1aea,![]];}return db[_0xfd45('0x9c')][_0xfd45('0x53')](_0x2e6f16)[_0xfd45('0x19')](function(_0xc6bbdd){return[_0xc6bbdd,!![]];});});}})[_0xfd45('0x9d')](function(_0x2b068f,_0x3c4eea){_0x1f0259[_0xfd45('0x9e')]=_0x2b068f['get']({'plain':!![]});_0x1f0259[_0xfd45('0x9e')][_0xfd45('0x9f')]=![];if(_0x3c4eea){if(_0x1f0259[_0xfd45('0x7c')][_0xfd45('0xa0')]){_0x1f0259['applications'][_0xfd45('0xa1')]({'id':0x0,'priority':_0x1f0259[_0xfd45('0x6e')]['length']+0x1,'app':_0xfd45('0xa2'),'appdata':_0xfd45('0xa3'),'interval':_0xfd45('0xa4')});}_0x1f0259[_0xfd45('0x9e')][_0xfd45('0x9f')]=!![];}return db[_0xfd45('0xa5')][_0xfd45('0x53')]({'phone':_0x1f0259[_0xfd45('0x5a')]['from'],'messageId':_0x1f0259[_0xfd45('0x5a')]['messageId'],'body':_0x1f0259[_0xfd45('0x5a')][_0xfd45('0x5a')],'SmsAccountId':_0x535f90[_0xfd45('0x52')]['id'],'SmsInteractionId':_0x2b068f['id'],'direction':'in','ContactId':_0x2b068f[_0xfd45('0xa6')],'AttachmentId':_0x1f0259['body'][_0xfd45('0xa7')]});})[_0xfd45('0x19')](function(_0x37bdda){_0x1f0259[_0xfd45('0x22')]=_0x37bdda;if(_0x1f0259[_0xfd45('0x9e')][_0xfd45('0xa8')]){return db['User']['find']({'attributes':['id',_0xfd45('0x33')],'where':{'id':_0x1f0259[_0xfd45('0x9e')][_0xfd45('0xa8')]}})[_0xfd45('0x19')](function(_0x35e477){if(_0x35e477){_0x1f0259[_0xfd45('0x6e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x35e477[_0xfd45('0x33')]+','+(_0x1f0259[_0xfd45('0x7c')]['waitForTheAssignedAgent']||0xa),'interval':_0xfd45('0xa4')});}return respondWithRpcPromise(_0xfd45('0xa9'),_0xfd45('0xaa'),_0x1f0259);});}return respondWithRpcPromise(_0xfd45('0xa9'),_0xfd45('0xaa'),_0x1f0259);})[_0xfd45('0x19')](function(_0x5bea7f){if(_0x5bea7f){var _0x4b86c6=0xc8;var _0x8d92d5=_0xfd45('0xab');logger[_0xfd45('0x1a')](_0xfd45('0x1e'),_0x8d92d5,_0x4b86c6,_0xfd45('0xac'));logger[_0xfd45('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x8d92d5,_0x4b86c6,'entity\x20found',JSON['stringify'](_0x5bea7f));if(_0x1f0259['account'][_0xfd45('0x4b')]===_0xfd45('0xad')){return _0x19f598[_0xfd45('0x25')](_0x4b86c6)[_0xfd45('0x28')](_0xfd45('0xae'),_0xfd45('0xaf'))[_0xfd45('0x34')](_0xfd45('0xb0'));}else{return _0x19f598[_0xfd45('0x25')](_0x4b86c6)[_0xfd45('0x26')](_0x5bea7f);}}})[_0xfd45('0x23')](handleError(_0x19f598,null));};exports['addApplications']=function(_0x548a66,_0x489826,_0x58a616){return db[_0xfd45('0x38')][_0xfd45('0x61')]({'where':{'id':_0x548a66['params']['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x489826,null))['then'](function(_0x3ea1ed){if(_0x3ea1ed){return db['sequelize']['transaction'](function(_0x2897c8){return db[_0xfd45('0x6c')][_0xfd45('0x2d')]({'where':{'SmsAccountId':_0x548a66[_0xfd45('0x52')]['id']},'transaction':_0x2897c8})[_0xfd45('0x19')](function(_0x7ddd23){var _0x3f3b6d=_[_0xfd45('0x37')](_0x548a66['body'],function(_0x520408){_0x520408[_0xfd45('0x5e')]=_0x548a66[_0xfd45('0x52')]['id'];return _0x520408;});return db['SmsApplication']['bulkCreate'](_0x3f3b6d,{'transaction':_0x2897c8});});})[_0xfd45('0x19')](function(){return db[_0xfd45('0x6c')][_0xfd45('0xb1')]({'where':{'SmsAccountId':_0x548a66[_0xfd45('0x52')]['id']},'order':_0xfd45('0x70')});});}})[_0xfd45('0x19')](respondWithResult(_0x489826,null))[_0xfd45('0x23')](handleError(_0x489826,null));};exports[_0xfd45('0xb2')]=function(_0x4ea217,_0x1c0bc2,_0x3131d4){var _0x2d1251={};var _0x45595d={};var _0x853a86;var _0xea5cf9;return db[_0xfd45('0x38')][_0xfd45('0x61')]({'where':{'id':_0x4ea217['params']['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x1c0bc2,null))[_0xfd45('0x19')](function(_0x52f8ae){if(_0x52f8ae){_0x853a86=_0x52f8ae;_0x45595d[_0xfd45('0x3c')]=_[_0xfd45('0x3e')](db[_0xfd45('0x6c')][_0xfd45('0x39')]);_0x45595d[_0xfd45('0x3d')]=_['keys'](_0x4ea217[_0xfd45('0x3d')]);_0x45595d[_0xfd45('0x3f')]=_['intersection'](_0x45595d[_0xfd45('0x3c')],_0x45595d[_0xfd45('0x3d')]);_0x2d1251['attributes']=_[_0xfd45('0x40')](_0x45595d[_0xfd45('0x3c')],qs[_0xfd45('0x42')](_0x4ea217[_0xfd45('0x3d')][_0xfd45('0x42')]));_0x2d1251['attributes']=_0x2d1251[_0xfd45('0x41')][_0xfd45('0x43')]?_0x2d1251[_0xfd45('0x41')]:_0x45595d[_0xfd45('0x3c')];_0x2d1251[_0xfd45('0x68')]=qs[_0xfd45('0x47')](_0x4ea217['query'][_0xfd45('0x47')]);_0x2d1251[_0xfd45('0x48')]=qs['filters'](_[_0xfd45('0x62')](_0x4ea217[_0xfd45('0x3d')],_0x45595d[_0xfd45('0x3f')]));if(_0x4ea217[_0xfd45('0x3d')][_0xfd45('0x49')]){_0x2d1251[_0xfd45('0x48')]=_['merge'](_0x2d1251[_0xfd45('0x48')],{'$or':_['map'](_0x2d1251[_0xfd45('0x41')],function(_0x30adc2){var _0x435f20={};_0x435f20[_0x30adc2]={'$like':'%'+_0x4ea217['query']['filter']+'%'};return _0x435f20;})});}_0x2d1251=_['merge']({},_0x2d1251,_0x4ea217[_0xfd45('0x63')]);return _0x853a86['getApplications'](_0x2d1251);}})[_0xfd45('0x19')](function(_0x285831){if(_0x285831){_0xea5cf9=_0x285831[_0xfd45('0x43')];if(!_0x4ea217[_0xfd45('0x3d')][_0xfd45('0x44')](_0xfd45('0x45'))){_0x2d1251['limit']=qs[_0xfd45('0x46')](_0x4ea217['query'][_0xfd45('0x46')]);_0x2d1251[_0xfd45('0x27')]=qs[_0xfd45('0x27')](_0x4ea217[_0xfd45('0x3d')][_0xfd45('0x27')]);}return _0x853a86['getApplications'](_0x2d1251);}})[_0xfd45('0x19')](function(_0x21df1d){if(_0x21df1d){return _0x21df1d?{'count':_0xea5cf9,'rows':_0x21df1d}:null;}})[_0xfd45('0x19')](respondWithResult(_0x1c0bc2,null))[_0xfd45('0x23')](handleError(_0x1c0bc2,null));};exports[_0xfd45('0xb3')]=function(_0x219a3b,_0xdb55c0,_0x19031b){var _0x431429={'raw':![],'where':{}};var _0x9c3e04={};var _0x4c5af9={'count':0x0,'rows':[]};return db[_0xfd45('0x38')][_0xfd45('0x61')]({'where':{'id':_0x219a3b[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0xdb55c0,null))['then'](function(_0x3f10ba){if(_0x3f10ba){_0x9c3e04[_0xfd45('0x3c')]=_[_0xfd45('0x3e')](db[_0xfd45('0x9c')][_0xfd45('0x39')]);_0x9c3e04[_0xfd45('0x3d')]=_[_0xfd45('0x3e')](_0x219a3b[_0xfd45('0x3d')]);_0x9c3e04[_0xfd45('0x3f')]=_[_0xfd45('0x40')](_0x9c3e04['model'],_0x9c3e04[_0xfd45('0x3d')]);_0x431429[_0xfd45('0x41')]=_['intersection'](_0x9c3e04[_0xfd45('0x3c')],qs[_0xfd45('0x42')](_0x219a3b[_0xfd45('0x3d')]['fields']));_0x431429[_0xfd45('0x41')]=_0x431429[_0xfd45('0x41')][_0xfd45('0x43')]?_0x431429['attributes']:_0x9c3e04[_0xfd45('0x3c')];if(!_0x219a3b[_0xfd45('0x3d')][_0xfd45('0x44')](_0xfd45('0x45'))){_0x431429[_0xfd45('0x46')]=qs[_0xfd45('0x46')](_0x219a3b[_0xfd45('0x3d')][_0xfd45('0x46')]);_0x431429[_0xfd45('0x27')]=qs[_0xfd45('0x27')](_0x219a3b[_0xfd45('0x3d')][_0xfd45('0x27')]);}_0x431429[_0xfd45('0x68')]=qs[_0xfd45('0x47')](_0x219a3b[_0xfd45('0x3d')][_0xfd45('0x47')]);_0x431429[_0xfd45('0x48')]=qs[_0xfd45('0x3f')](_[_0xfd45('0x62')](_0x219a3b['query'],_0x9c3e04['filters']));_0x431429[_0xfd45('0x48')][_0xfd45('0x5e')]=_0x3f10ba['id'];if(_0x219a3b[_0xfd45('0x3d')]['filter']){_0x431429[_0xfd45('0x48')]=_[_0xfd45('0x4a')](_0x431429[_0xfd45('0x48')],{'$or':_['map'](_0x431429[_0xfd45('0x41')],function(_0x55d1ff){var _0x4fa154={};_0x4fa154[_0x55d1ff]={'$like':'%'+_0x219a3b[_0xfd45('0x3d')][_0xfd45('0x49')]+'%'};return _0x4fa154;})});}_0x431429=_[_0xfd45('0x4a')]({},_0x431429,_0x219a3b[_0xfd45('0x63')]);return db[_0xfd45('0x9c')][_0xfd45('0x4d')]({'where':_0x431429[_0xfd45('0x48')]})[_0xfd45('0x19')](function(_0x3c705d){_0x4c5af9[_0xfd45('0x4d')]=_0x3c705d;if(_0x219a3b[_0xfd45('0x3d')][_0xfd45('0x4e')]){_0x431429[_0xfd45('0x4f')]=[{'model':db[_0xfd45('0x72')],'as':_0xfd45('0xb4'),'required':![]},{'model':db[_0xfd45('0xb5')],'as':_0xfd45('0xb6'),'attributes':[_0xfd45('0x33'),_0xfd45('0xb7'),_0xfd45('0xb8')],'required':![]},{'model':db[_0xfd45('0xb9')],'as':'Tags','attributes':['id',_0xfd45('0x33'),_0xfd45('0xba')],'where':_0x219a3b[_0xfd45('0x3d')]['tag']?{'id':_0x219a3b[_0xfd45('0x3d')]['tag']}:undefined,'required':_0x219a3b[_0xfd45('0x3d')][_0xfd45('0xbb')]?!![]:![]}];}return db[_0xfd45('0x9c')][_0xfd45('0x50')](_0x431429);})[_0xfd45('0x19')](function(_0x138f80){_0x4c5af9[_0xfd45('0x64')]=_0x138f80;return _0x4c5af9;});}})[_0xfd45('0x19')](respondWithFilteredResult(_0xdb55c0,_0x431429))[_0xfd45('0x23')](handleError(_0xdb55c0,null));};exports['send']=function(_0x20bfa1,_0x26c4c3,_0x173552){var _0x3d3c2c,_0x1eb10c,_0x1e5e25;if(_[_0xfd45('0x91')](_0x20bfa1['body']['body'])||_0x20bfa1[_0xfd45('0x5a')][_0xfd45('0x5a')]===''){throw new db[(_0xfd45('0x73'))][(_0xfd45('0x74'))](_0xfd45('0x92'));}if(_['isNil'](_0x20bfa1[_0xfd45('0x5a')]['to'])){throw new db[(_0xfd45('0x73'))][(_0xfd45('0x74'))](_0xfd45('0xbc'));}_0x3d3c2c=_0x20bfa1[_0xfd45('0x5a')]['to'];return db['SmsAccount'][_0xfd45('0x5b')]({'where':{'id':_0x20bfa1[_0xfd45('0x52')]['id']},'include':[{'model':db[_0xfd45('0x95')],'as':_0xfd45('0xbd'),'include':[{'model':db[_0xfd45('0x72')],'as':_0xfd45('0x96'),'where':{'mobile':_0x3d3c2c},'limit':0x1,'order':[[_0xfd45('0x78'),_0xfd45('0x97')]]}]}]})[_0xfd45('0x19')](handleEntityNotFound(_0x26c4c3,null))[_0xfd45('0x19')](function(_0x80c27e){if(_0x80c27e&&_0x80c27e[_0xfd45('0xbd')]){_0x1eb10c=_0x80c27e['get']({'plain':!![]});if(_0x1eb10c[_0xfd45('0xbd')]&&_0x1eb10c['List'][_0xfd45('0x96')][_0xfd45('0x43')]){return _0x1eb10c[_0xfd45('0xbd')][_0xfd45('0x96')][0x0];}return db[_0xfd45('0x72')]['create'](_['defaults'](_0x20bfa1[_0xfd45('0x5a')],{'firstName':_0x3d3c2c,'mobile':_0x3d3c2c,'phone':_0x3d3c2c,'ListId':_0x1eb10c[_0xfd45('0x7a')]}));}})['then'](handleEntityNotFound(_0x26c4c3,null))[_0xfd45('0x19')](function(_0x12d50c){if(_0x12d50c){_0x1e5e25=_0x12d50c;return db[_0xfd45('0x9c')]['find']({'where':{'ContactId':_0x1e5e25['id'],'closed':![],'SmsAccountId':_0x1eb10c['id']}})['then'](function(_0x300686){if(_0x300686){return[_0x300686,![]];}return db[_0xfd45('0x9c')][_0xfd45('0x53')]({'UserId':_0x20bfa1[_0xfd45('0x54')]['id'],'ContactId':_0x1e5e25['id'],'SmsAccountId':_0x1eb10c['id'],'phone':_0x3d3c2c,'firstMsgDirection':_0xfd45('0xbe'),'Messages':[_[_0xfd45('0x4a')](_0x20bfa1[_0xfd45('0x5a')],{'read':![],'body':_0x20bfa1[_0xfd45('0x5a')][_0xfd45('0x5a')],'phone':_0x3d3c2c,'SmsAccountId':_0x1eb10c['id'],'UserId':_0x20bfa1[_0xfd45('0x54')]['id'],'ContactId':_0x1e5e25['id']})]},{'include':[{'model':db[_0xfd45('0xa5')],'as':_0xfd45('0xbf')}]})[_0xfd45('0x19')](function(_0xc04242){return[_0xc04242,!![]];});});}})['spread'](function(_0x55bb16,_0x298b9b){if(_0x298b9b){return _0x55bb16;}return db[_0xfd45('0xa5')]['create'](_[_0xfd45('0x4a')](_0x20bfa1[_0xfd45('0x5a')],{'read':![],'body':_0x20bfa1['body']['body'],'phone':_0x3d3c2c,'SmsAccountId':_0x1eb10c['id'],'SmsInteractionId':_0x55bb16['id'],'UserId':_0x20bfa1[_0xfd45('0x54')]['id'],'ContactId':_0x1e5e25['id']}))['then'](function(_0x1e61a3){_0x55bb16[_0xfd45('0xc0')]['Messages']=[];_0x55bb16[_0xfd45('0xc0')][_0xfd45('0xbf')][_0xfd45('0xa1')](_0x1e61a3['dataValues']);return _0x55bb16;});})[_0xfd45('0x19')](respondWithResult(_0x26c4c3,null))[_0xfd45('0x23')](handleError(_0x26c4c3,null));};exports[_0xfd45('0x25')]=function(_0x5332eb,_0x1629a0,_0x5cb474){if(_0x5332eb[_0xfd45('0x5a')]['id']){delete _0x5332eb[_0xfd45('0x5a')]['id'];}console[_0xfd45('0xc1')](_0xfd45('0xc2'),_0x5332eb['body']);var _0x4f60f7,_0x1e8eb1,_0x297c8e;return db['SmsAccount'][_0xfd45('0x5b')]({'where':{'id':_0x5332eb[_0xfd45('0x52')]['id']}})['then'](handleEntityNotFound(_0x1629a0,null))[_0xfd45('0x19')](function(_0x13ff14){if(_0x13ff14){_0x297c8e=_0x13ff14;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfd45('0x25'),_0xfd45('0xc3'),_0x13ff14['type'],util['inspect'](_0x5332eb[_0xfd45('0x5a')],{'showHidden':![],'depth':null}));switch(_0x13ff14[_0xfd45('0x4b')]){case _0xfd45('0x81'):if(_0x5332eb[_0xfd45('0x5a')]['skebby_dispatch_id']&&_0x5332eb[_0xfd45('0x5a')]['status']){_0x1e8eb1=_0x5332eb[_0xfd45('0x5a')][_0xfd45('0x25')];return db[_0xfd45('0xa5')]['find']({'where':{'messageId':_0x5332eb[_0xfd45('0x5a')]['skebby_dispatch_id']}});}break;case _0xfd45('0x85'):if(_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc4')]&&_0x5332eb[_0xfd45('0x5a')]['statusInt']){_0x1e8eb1=_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc5')];return db[_0xfd45('0xa5')]['find']({'where':{'messageId':_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc4')]}});}break;case _0xfd45('0x86'):if(_0x5332eb[_0xfd45('0x5a')][_0xfd45('0x87')]&&_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc6')]){_0x1e8eb1=_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc6')];return db[_0xfd45('0xa5')]['find']({'where':{'messageId':_0x5332eb['body'][_0xfd45('0x87')]}});}break;case _0xfd45('0x89'):var _0x5ef678=_0x5332eb[_0xfd45('0x5a')][_0xfd45('0x8a')][0x0];if(_0x5ef678[_0xfd45('0x7f')]&&_0x5ef678[_0xfd45('0x25')][_0xfd45('0xc7')]==='DELIVERED'){_0x1e8eb1=_0x5ef678[_0xfd45('0x25')][_0xfd45('0xc7')];return db[_0xfd45('0xa5')][_0xfd45('0x5b')]({'where':{'messageId':_0x5ef678[_0xfd45('0x7f')]}});}break;case _0xfd45('0xc8'):if(_0x5332eb[_0xfd45('0x5a')]['messageId']&&_0x5332eb[_0xfd45('0x5a')]['status']){_0x1e8eb1=_0x5332eb[_0xfd45('0x5a')][_0xfd45('0x25')];return db[_0xfd45('0xa5')]['find']({'where':{'messageId':_0x5332eb[_0xfd45('0x5a')]['messageId']}});}break;case _0xfd45('0x8f'):if(_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc9')]&&_0x5332eb[_0xfd45('0x5a')][_0xfd45('0x25')]){_0x1e8eb1=_0x5332eb[_0xfd45('0x5a')][_0xfd45('0x25')];return db['SmsMessage'][_0xfd45('0x5b')]({'where':{'messageId':_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xc9')]}});}break;}}})[_0xfd45('0x19')](handleEntityNotFound(_0x1629a0,null))[_0xfd45('0x19')](function(_0x3ddd81){if(_0x3ddd81){_0x4f60f7=_0x3ddd81;switch(_0x297c8e[_0xfd45('0x4b')]){case'skebby':if(_0x1e8eb1===_0xfd45('0xca')){return _0x4f60f7[_0xfd45('0x2c')]({'read':!![]});}else{logger[_0xfd45('0x20')](_0xfd45('0x1e'),_0xfd45('0x25'),_0xfd45('0x81'),util['inspect'](_0x5332eb[_0xfd45('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfd45('0x85'):if(_0x1e8eb1==='1'){return _0x4f60f7[_0xfd45('0x2c')]({'read':!![]});}else{logger[_0xfd45('0x20')](_0xfd45('0x1e'),_0xfd45('0x25'),_0xfd45('0x81'),util['inspect'](_0x5332eb[_0xfd45('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfd45('0x86'):if(!_0x5332eb[_0xfd45('0x5a')][_0xfd45('0xcb')]&&_0x1e8eb1>=0xc8&&_0x1e8eb1<=0xce){return _0x4f60f7[_0xfd45('0x2c')]({'read':!![]});}else{logger[_0xfd45('0x20')](_0xfd45('0x1e'),_0xfd45('0x25'),_0xfd45('0x86'),util[_0xfd45('0xcc')](_0x5332eb['body'],{'showHidden':![],'depth':null}));}break;case _0xfd45('0x89'):var _0x80edbf=_0x5332eb[_0xfd45('0x5a')]['results'][0x0];if(_0x80edbf[_0xfd45('0x25')][_0xfd45('0xc7')]===_0xfd45('0xca')){return _0x4f60f7[_0xfd45('0x2c')]({'read':!![]});}else{logger[_0xfd45('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfd45('0x89'),util['inspect'](_0x5332eb[_0xfd45('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfd45('0xc8'):if(_0x1e8eb1==_0xfd45('0xcd')||_0x1e8eb1==_0xfd45('0xce')){return _0x4f60f7['update']({'read':!![]});}else{logger[_0xfd45('0x20')](_0xfd45('0x1e'),_0xfd45('0x25'),_0xfd45('0xc8'),util[_0xfd45('0xcc')](_0x5332eb[_0xfd45('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfd45('0x8f'):if(_0x1e8eb1===_0xfd45('0xcf')||_0x1e8eb1==='ACCEPTD'){return _0x4f60f7[_0xfd45('0x2c')]({'read':!![]});}else{logger[_0xfd45('0x20')](_0xfd45('0x1e'),_0xfd45('0x25'),_0xfd45('0x8f'),util[_0xfd45('0xcc')](_0x5332eb['body'],{'showHidden':![],'depth':null}));}break;}return _0x4f60f7;}})[_0xfd45('0x19')](respondWithResult(_0x1629a0,null))[_0xfd45('0x23')](handleError(_0x1629a0,null));};exports[_0xfd45('0xd0')]=function(_0x2ae012,_0x19a5e8,_0x49df75){var _0x1838d0,_0x22986d,_0x522f25;return db[_0xfd45('0x38')]['find']({'where':{'id':_0x2ae012[_0xfd45('0x52')]['id']}})['then'](handleEntityNotFound(_0x19a5e8,null))[_0xfd45('0x19')](function(_0x128afb){if(_0x128afb){_0x522f25=_0x128afb;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfd45('0xc3'),_0x128afb[_0xfd45('0x4b')],util['inspect'](_0x2ae012[_0xfd45('0x3d')],{'showHidden':![],'depth':null}));switch(_0x128afb[_0xfd45('0x4b')]){case _0xfd45('0x8b'):if(_0x2ae012[_0xfd45('0x3d')][_0xfd45('0xd1')]&&_0x2ae012[_0xfd45('0x3d')][_0xfd45('0xd2')]){_0x22986d=_0x2ae012[_0xfd45('0x3d')][_0xfd45('0xd2')];return db[_0xfd45('0xa5')][_0xfd45('0x5b')]({'where':{'messageId':_0x2ae012[_0xfd45('0x3d')][_0xfd45('0xd1')]}});}break;}}})['then'](handleEntityNotFound(_0x19a5e8,null))['then'](function(_0x1ca2ba){if(_0x1ca2ba){_0x1838d0=_0x1ca2ba;switch(_0x522f25[_0xfd45('0x4b')]){case _0xfd45('0x8b'):if(_0x22986d==='2'||_0x22986d==='6'){return _0x1838d0[_0xfd45('0x2c')]({'read':!![]});}else{logger['error'](_0xfd45('0x1e'),_0xfd45('0x25'),'csc',util[_0xfd45('0xcc')](_0x2ae012[_0xfd45('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x1838d0;}})[_0xfd45('0x19')](respondWithResult(_0x19a5e8,null))[_0xfd45('0x23')](handleError(_0x19a5e8,null));};exports['addAgents']=function(_0x25a640,_0x100a16,_0x3df219){return db[_0xfd45('0x38')][_0xfd45('0x5b')]({'where':{'id':_0x25a640[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x100a16,null))[_0xfd45('0x19')](function(_0xdbf20e){if(_0xdbf20e){return _0xdbf20e[_0xfd45('0xd3')](_0x25a640[_0xfd45('0x5a')]['ids'],_[_0xfd45('0x99')](_0x25a640['body'],[_0xfd45('0x66'),'id'])||{})[_0xfd45('0x9d')](function(_0x2866c1){for(var _0x29ac97=0x0;_0x29ac97<_0x25a640[_0xfd45('0x5a')][_0xfd45('0x66')][_0xfd45('0x43')];_0x29ac97+=0x1){socket[_0xfd45('0xd4')](_0xfd45('0xd5'),{'UserId':_0x25a640[_0xfd45('0x5a')]['ids'][_0x29ac97],'SmsAccountId':_0x25a640[_0xfd45('0x52')]['id']});}return _0x2866c1;});}})[_0xfd45('0x19')](respondWithResult(_0x100a16,null))[_0xfd45('0x23')](handleError(_0x100a16,null));};exports[_0xfd45('0xd6')]=function(_0x27680e,_0x1815d2,_0x104f0f){return db['SmsAccount'][_0xfd45('0x5b')]({'where':{'id':_0x27680e[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x1815d2,null))[_0xfd45('0x19')](function(_0x21c6ae){if(_0x21c6ae){return _0x21c6ae[_0xfd45('0xd6')](_0x27680e[_0xfd45('0x3d')][_0xfd45('0x66')])['then'](function(){if(_[_0xfd45('0xd7')](_0x27680e[_0xfd45('0x3d')][_0xfd45('0x66')])){for(var _0x104c66=0x0;_0x104c66<_0x27680e[_0xfd45('0x3d')]['ids'][_0xfd45('0x43')];_0x104c66+=0x1){socket[_0xfd45('0xd4')](_0xfd45('0xd8'),{'UserId':Number(_0x27680e['query'][_0xfd45('0x66')][_0x104c66]),'SmsAccountId':Number(_0x27680e[_0xfd45('0x52')]['id'])});}}else{socket[_0xfd45('0xd4')](_0xfd45('0xd8'),{'UserId':Number(_0x27680e[_0xfd45('0x3d')][_0xfd45('0x66')]),'SmsAccountId':Number(_0x27680e[_0xfd45('0x52')]['id'])});}});}})[_0xfd45('0x19')](respondWithStatusCode(_0x1815d2,null))[_0xfd45('0x23')](handleError(_0x1815d2,null));};exports[_0xfd45('0xd9')]=function(_0x28979c,_0x30c91a,_0x377276){var _0x2b5538={};var _0x5290b7={};var _0x18c115;var _0x48129a;return db['SmsAccount'][_0xfd45('0x61')]({'where':{'id':_0x28979c[_0xfd45('0x52')]['id']}})[_0xfd45('0x19')](handleEntityNotFound(_0x30c91a,null))[_0xfd45('0x19')](function(_0x1906a3){if(_0x1906a3){_0x18c115=_0x1906a3;_0x5290b7[_0xfd45('0x3c')]=_[_0xfd45('0x3e')](db[_0xfd45('0xb5')]['rawAttributes']);_0x5290b7['query']=_[_0xfd45('0x3e')](_0x28979c[_0xfd45('0x3d')]);_0x5290b7[_0xfd45('0x3f')]=_[_0xfd45('0x40')](_0x5290b7['model'],_0x5290b7['query']);_0x2b5538[_0xfd45('0x41')]=_[_0xfd45('0x40')](_0x5290b7[_0xfd45('0x3c')],qs['fields'](_0x28979c[_0xfd45('0x3d')][_0xfd45('0x42')]));_0x2b5538[_0xfd45('0x41')]=_0x2b5538[_0xfd45('0x41')]['length']?_0x2b5538[_0xfd45('0x41')]:_0x5290b7['model'];_0x2b5538['order']=qs['sort'](_0x28979c['query'][_0xfd45('0x47')]);_0x2b5538[_0xfd45('0x48')]=qs['filters'](_['pick'](_0x28979c[_0xfd45('0x3d')],_0x5290b7['filters']));if(_0x28979c[_0xfd45('0x3d')]['filter']){_0x2b5538[_0xfd45('0x48')]=_[_0xfd45('0x4a')](_0x2b5538[_0xfd45('0x48')],{'$or':_[_0xfd45('0x37')](_0x2b5538[_0xfd45('0x41')],function(_0x2a745a){var _0x3a87fa={};_0x3a87fa[_0x2a745a]={'$like':'%'+_0x28979c[_0xfd45('0x3d')][_0xfd45('0x49')]+'%'};return _0x3a87fa;})});}_0x2b5538=_[_0xfd45('0x4a')]({},_0x2b5538,_0x28979c[_0xfd45('0x63')]);return _0x18c115[_0xfd45('0xd9')](_0x2b5538);}})[_0xfd45('0x19')](function(_0x19d190){if(_0x19d190){_0x48129a=_0x19d190[_0xfd45('0x43')];if(!_0x28979c[_0xfd45('0x3d')][_0xfd45('0x44')](_0xfd45('0x45'))){_0x2b5538[_0xfd45('0x46')]=qs[_0xfd45('0x46')](_0x28979c[_0xfd45('0x3d')][_0xfd45('0x46')]);_0x2b5538[_0xfd45('0x27')]=qs['offset'](_0x28979c[_0xfd45('0x3d')][_0xfd45('0x27')]);}return _0x18c115[_0xfd45('0xd9')](_0x2b5538);}})[_0xfd45('0x19')](function(_0x4e244f){if(_0x4e244f){return _0x4e244f?{'count':_0x48129a,'rows':_0x4e244f}:null;}})[_0xfd45('0x19')](respondWithResult(_0x30c91a,null))['catch'](handleError(_0x30c91a,null));}; \ No newline at end of file +var _0x07e7=['plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','ListId','out','Messages','spread','dataValues','log','endpoint\x20/status\x20POST\x20/','skebby_dispatch_id','requestid','message_id','status_code','groupName','DELIVERED','redif','inspect','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','SmsAccounts','sendStatus','send','index','Pause','map','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','SmsAccount','includeAll','include','rows','show','params','mandatoryDispositionPause','intersection','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','catch','body','describe','addDisposition','SmsAccountId','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','getAnswers','hasOwnProperty','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','mobile','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend'];(function(_0x144a9c,_0xa93812){var _0x5db825=function(_0x388a9d){while(--_0x388a9d){_0x144a9c['push'](_0x144a9c['shift']());}};_0x5db825(++_0xa93812);}(_0x07e7,0x131));var _0x707e=function(_0x30b61d,_0x2f6622){_0x30b61d=_0x30b61d-0x0;var _0x24a61f=_0x07e7[_0x30b61d];return _0x24a61f;};'use strict';var pdf=require(_0x707e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x707e('0x1'));var zipdir=require(_0x707e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x707e('0x3'));var moment=require(_0x707e('0x4'));var BPromise=require(_0x707e('0x5'));var Mustache=require(_0x707e('0x6'));var util=require(_0x707e('0x7'));var path=require(_0x707e('0x8'));var sox=require('sox');var csv=require(_0x707e('0x9'));var ejs=require(_0x707e('0xa'));var fs=require('fs');var _=require(_0x707e('0xb'));var squel=require(_0x707e('0xc'));var crypto=require(_0x707e('0xd'));var jsforce=require(_0x707e('0xe'));var deskjs=require(_0x707e('0xf'));var toCsv=require(_0x707e('0x9'));var querystring=require(_0x707e('0x10'));var Papa=require(_0x707e('0x11'));var Redis=require(_0x707e('0x12'));var authService=require(_0x707e('0x13'));var qs=require(_0x707e('0x14'));var as=require(_0x707e('0x15'));var hardwareService=require(_0x707e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x707e('0x17'));var config=require(_0x707e('0x18'));var licenseUtil=require(_0x707e('0x19'));var db=require(_0x707e('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x707e('0x1b'),'port':0x18eb});var socket=require(_0x707e('0x1c'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x707e('0x1d')](socket);var jayson=require(_0x707e('0x1e'));var client=jayson[_0x707e('0x1f')][_0x707e('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x20277c,_0x4bc619,_0x1ebfdd,_0x3ebcf9){return new BPromise(function(_0x4b6941,_0xdc1b9d){var _0xe866ce=_0x3ebcf9||client;return _0xe866ce['request'](_0x20277c,_0x1ebfdd)[_0x707e('0x21')](function(_0x1eb992){logger[_0x707e('0x22')](_0x707e('0x23'),_0x4bc619,_0x707e('0x24'));logger[_0x707e('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4bc619,'request\x20sent',JSON[_0x707e('0x26')](_0x1eb992));if(_0x1eb992[_0x707e('0x27')]){if(_0x1eb992['error']['code']===0x1f4){logger[_0x707e('0x27')](_0x707e('0x23'),_0x4bc619,_0x1eb992[_0x707e('0x27')][_0x707e('0x28')]);return _0xdc1b9d(_0x1eb992[_0x707e('0x27')]['message']);}logger[_0x707e('0x27')](_0x707e('0x23'),_0x4bc619,_0x1eb992['error'][_0x707e('0x28')]);return _0x4b6941(_0x1eb992[_0x707e('0x27')][_0x707e('0x28')]);}else{logger[_0x707e('0x22')]('SmsAccount,\x20%s,\x20%s',_0x4bc619,'request\x20sent');_0x4b6941(_0x1eb992[_0x707e('0x29')][_0x707e('0x28')]);}})['catch'](function(_0x155c3b){logger[_0x707e('0x27')](_0x707e('0x23'),_0x4bc619,_0x155c3b);_0xdc1b9d(_0x155c3b);});});}function respondWithStatusCode(_0x3ce5e9,_0x2f1338){_0x2f1338=_0x2f1338||0xcc;return function(_0x594321){if(_0x594321){return _0x3ce5e9['sendStatus'](_0x2f1338);}return _0x3ce5e9['status'](_0x2f1338)[_0x707e('0x2a')]();};}function respondWithResult(_0x323199,_0xc404f8){_0xc404f8=_0xc404f8||0xc8;return function(_0x2def75){if(_0x2def75){return _0x323199[_0x707e('0x2b')](_0xc404f8)[_0x707e('0x2c')](_0x2def75);}};}function respondWithFilteredResult(_0x3f05c5,_0x19bd94){return function(_0x20bbb6){if(_0x20bbb6){var _0xbd6bc1=_0x20bbb6[_0x707e('0x2d')],_0x27f4ff=_0x19bd94[_0x707e('0x2e')],_0x728991=_0x19bd94[_0x707e('0x2e')]+_0x19bd94[_0x707e('0x2f')],_0xd46546;if(_0x728991>=_0xbd6bc1){_0x728991=_0xbd6bc1;_0xd46546=0xc8;}else{_0xd46546=0xce;}_0x3f05c5[_0x707e('0x2b')](_0xd46546);return _0x3f05c5[_0x707e('0x30')](_0x707e('0x31'),_0x27f4ff+'-'+_0x728991+'/'+_0xbd6bc1)[_0x707e('0x2c')](_0x20bbb6);}return null;};}function patchUpdates(_0x305d44){return function(_0x47cdcb){try{jsonpatch['apply'](_0x47cdcb,_0x305d44,!![]);}catch(_0x44a97c){return BPromise['reject'](_0x44a97c);}return _0x47cdcb[_0x707e('0x32')]();};}function saveUpdates(_0x5c9a39,_0x423c62){return function(_0x42a533){if(_0x42a533){return _0x42a533[_0x707e('0x33')](_0x5c9a39)['then'](function(_0xfca943){return _0xfca943;});}return null;};}function removeEntity(_0x2a66bc,_0x5be078){return function(_0x42e937){if(_0x42e937){return _0x42e937[_0x707e('0x34')]()[_0x707e('0x21')](function(){var _0x41bdaa=_0x42e937['get']({'plain':!![]});var _0x3cce97=_0x707e('0x35');return db['UserProfileResource'][_0x707e('0x34')]({'where':{'type':_0x3cce97,'resourceId':_0x41bdaa['id']}})[_0x707e('0x21')](function(){return _0x42e937;});})[_0x707e('0x21')](function(){_0x2a66bc[_0x707e('0x2b')](0xcc)[_0x707e('0x2a')]();});}};}function handleEntityNotFound(_0x585cf2,_0x15c6ee){return function(_0x2993c0){if(!_0x2993c0){_0x585cf2[_0x707e('0x36')](0x194);}return _0x2993c0;};}function handleError(_0x1dc267,_0x5cff4e){_0x5cff4e=_0x5cff4e||0x1f4;return function(_0x1a36e4){logger[_0x707e('0x27')](_0x1a36e4['stack']);if(_0x1a36e4['name']){delete _0x1a36e4['name'];}_0x1dc267[_0x707e('0x2b')](_0x5cff4e)[_0x707e('0x37')](_0x1a36e4);};}exports[_0x707e('0x38')]=function(_0x44258c,_0x351f6f){var _0x529eee={'include':[{'model':db[_0x707e('0x39')],'as':'mandatoryDispositionPause'}]},_0x37d84b={},_0x2bf67e={'count':0x0,'rows':[]};var _0x25b012=_[_0x707e('0x3a')](db['SmsAccount'][_0x707e('0x3b')],function(_0x5a0448){return{'name':_0x5a0448[_0x707e('0x3c')],'type':_0x5a0448['type'][_0x707e('0x3d')]};});_0x37d84b['model']=_[_0x707e('0x3a')](_0x25b012,_0x707e('0x3e'));_0x37d84b[_0x707e('0x3f')]=_[_0x707e('0x40')](_0x44258c['query']);_0x37d84b[_0x707e('0x41')]=_['intersection'](_0x37d84b[_0x707e('0x42')],_0x37d84b[_0x707e('0x3f')]);_0x529eee[_0x707e('0x43')]=_['intersection'](_0x37d84b[_0x707e('0x42')],qs[_0x707e('0x44')](_0x44258c['query']['fields']));_0x529eee[_0x707e('0x43')]=_0x529eee[_0x707e('0x43')][_0x707e('0x45')]?_0x529eee[_0x707e('0x43')]:_0x37d84b['model'];if(!_0x44258c['query']['hasOwnProperty'](_0x707e('0x46'))){_0x529eee[_0x707e('0x2f')]=qs['limit'](_0x44258c[_0x707e('0x3f')][_0x707e('0x2f')]);_0x529eee[_0x707e('0x2e')]=qs['offset'](_0x44258c[_0x707e('0x3f')][_0x707e('0x2e')]);}_0x529eee[_0x707e('0x47')]=qs[_0x707e('0x48')](_0x44258c[_0x707e('0x3f')][_0x707e('0x48')]);_0x529eee[_0x707e('0x49')]=qs['filters'](_[_0x707e('0x4a')](_0x44258c[_0x707e('0x3f')],_0x37d84b[_0x707e('0x41')]),_0x25b012);if(_0x44258c[_0x707e('0x3f')][_0x707e('0x4b')]){_0x529eee[_0x707e('0x49')]=_[_0x707e('0x4c')](_0x529eee[_0x707e('0x49')],{'$or':_['map'](_0x25b012,function(_0x56a863){if(_0x56a863[_0x707e('0x4d')]!=='VIRTUAL'){var _0xfb5dc={};_0xfb5dc[_0x56a863[_0x707e('0x3e')]]={'$like':'%'+_0x44258c[_0x707e('0x3f')]['filter']+'%'};return _0xfb5dc;}})});}_0x529eee=_[_0x707e('0x4c')]({},_0x529eee,_0x44258c[_0x707e('0x4e')]);var _0x272e00={'where':_0x529eee[_0x707e('0x49')]};return db[_0x707e('0x4f')][_0x707e('0x2d')](_0x272e00)[_0x707e('0x21')](function(_0x3baf20){_0x2bf67e['count']=_0x3baf20;if(_0x44258c[_0x707e('0x3f')][_0x707e('0x50')]){_0x529eee[_0x707e('0x51')]=[{'all':!![]}];}return db[_0x707e('0x4f')]['findAll'](_0x529eee);})[_0x707e('0x21')](function(_0x1b0522){_0x2bf67e[_0x707e('0x52')]=_0x1b0522;return _0x2bf67e;})[_0x707e('0x21')](respondWithFilteredResult(_0x351f6f,_0x529eee))['catch'](handleError(_0x351f6f,null));};exports[_0x707e('0x53')]=function(_0x4b239e,_0x56706f){var _0x6fbdb1={'raw':![],'where':{'id':_0x4b239e[_0x707e('0x54')]['id']},'include':[{'model':db[_0x707e('0x39')],'as':_0x707e('0x55')}]},_0x26a101={};_0x26a101['model']=_[_0x707e('0x40')](db[_0x707e('0x4f')][_0x707e('0x3b')]);_0x26a101[_0x707e('0x3f')]=_[_0x707e('0x40')](_0x4b239e[_0x707e('0x3f')]);_0x26a101[_0x707e('0x41')]=_[_0x707e('0x56')](_0x26a101[_0x707e('0x42')],_0x26a101['query']);_0x6fbdb1['attributes']=_[_0x707e('0x56')](_0x26a101[_0x707e('0x42')],qs[_0x707e('0x44')](_0x4b239e[_0x707e('0x3f')][_0x707e('0x44')]));_0x6fbdb1['attributes']=_0x6fbdb1[_0x707e('0x43')][_0x707e('0x45')]?_0x6fbdb1[_0x707e('0x43')]:_0x26a101[_0x707e('0x42')];if(_0x4b239e[_0x707e('0x3f')]['includeAll']){_0x6fbdb1[_0x707e('0x51')]=[{'all':!![]}];}_0x6fbdb1=_[_0x707e('0x4c')]({},_0x6fbdb1,_0x4b239e[_0x707e('0x4e')]);return db[_0x707e('0x4f')][_0x707e('0x57')](_0x6fbdb1)[_0x707e('0x21')](handleEntityNotFound(_0x56706f,null))[_0x707e('0x21')](respondWithResult(_0x56706f,null))['catch'](handleError(_0x56706f,null));};exports[_0x707e('0x58')]=function(_0x43da4e,_0x465ec0){return db[_0x707e('0x4f')][_0x707e('0x58')](_0x43da4e['body'],{})[_0x707e('0x21')](function(_0x59f6f3){var _0x22e4b0=_0x43da4e[_0x707e('0x59')]['get']({'plain':!![]});if(!_0x22e4b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22e4b0['role']==='user'){var _0x571865=_0x59f6f3[_0x707e('0x5a')]({'plain':!![]});var _0x39c5f8=_0x707e('0x35');return db[_0x707e('0x5b')][_0x707e('0x57')]({'where':{'name':_0x39c5f8,'userProfileId':_0x22e4b0[_0x707e('0x5c')]},'raw':!![]})[_0x707e('0x21')](function(_0x5affae){if(_0x5affae&&_0x5affae[_0x707e('0x5d')]===0x0){return db['UserProfileResource'][_0x707e('0x58')]({'name':_0x571865['name'],'resourceId':_0x571865['id'],'type':_0x5affae[_0x707e('0x3e')],'sectionId':_0x5affae['id']},{})[_0x707e('0x21')](function(){return _0x59f6f3;});}else{return _0x59f6f3;}})[_0x707e('0x5e')](function(_0xc308ee){logger[_0x707e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc308ee);throw _0xc308ee;});}return _0x59f6f3;})[_0x707e('0x21')](respondWithResult(_0x465ec0,0xc9))[_0x707e('0x5e')](handleError(_0x465ec0,null));};exports[_0x707e('0x33')]=function(_0x47bb53,_0x3fc99a){if(_0x47bb53['body']['id']){delete _0x47bb53[_0x707e('0x5f')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x47bb53[_0x707e('0x54')]['id']},'include':[{'model':db[_0x707e('0x39')],'as':_0x707e('0x55')}]})[_0x707e('0x21')](handleEntityNotFound(_0x3fc99a,null))[_0x707e('0x21')](saveUpdates(_0x47bb53['body'],null))[_0x707e('0x21')](respondWithResult(_0x3fc99a,null))['catch'](handleError(_0x3fc99a,null));};exports['destroy']=function(_0x276077,_0x3a41a4){return db[_0x707e('0x4f')][_0x707e('0x57')]({'where':{'id':_0x276077[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x3a41a4,null))[_0x707e('0x21')](removeEntity(_0x3a41a4,null))[_0x707e('0x5e')](handleError(_0x3a41a4,null));};exports[_0x707e('0x60')]=function(_0x4e276d,_0x103e81){return db[_0x707e('0x4f')]['describe']()['then'](respondWithResult(_0x103e81,null))['catch'](handleError(_0x103e81,null));};exports[_0x707e('0x61')]=function(_0x35fa6a,_0x1c602b,_0x5f3508){if(_0x35fa6a[_0x707e('0x5f')]['id']){delete _0x35fa6a[_0x707e('0x5f')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x35fa6a[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x1c602b,null))[_0x707e('0x21')](function(_0x5b45e5){if(_0x5b45e5){_0x35fa6a[_0x707e('0x5f')][_0x707e('0x62')]=_0x5b45e5['id'];return db['Disposition'][_0x707e('0x58')](_0x35fa6a[_0x707e('0x5f')]);}})[_0x707e('0x21')](respondWithResult(_0x1c602b,null))[_0x707e('0x5e')](handleError(_0x1c602b,null));};exports['getDispositions']=function(_0x3712e1,_0x4e9872,_0x3737fc){var _0x4aba1c={'raw':![],'where':{}};var _0x316dd6={};var _0x377cca={'count':0x0,'rows':[]};return db[_0x707e('0x4f')][_0x707e('0x63')]({'where':{'id':_0x3712e1[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x4e9872,null))['then'](function(_0x514c23){if(_0x514c23){_0x316dd6[_0x707e('0x42')]=_[_0x707e('0x40')](db[_0x707e('0x64')][_0x707e('0x3b')]);_0x316dd6[_0x707e('0x3f')]=_[_0x707e('0x40')](_0x3712e1['query']);_0x316dd6[_0x707e('0x41')]=_[_0x707e('0x56')](_0x316dd6['model'],_0x316dd6[_0x707e('0x3f')]);_0x4aba1c['attributes']=_[_0x707e('0x56')](_0x316dd6[_0x707e('0x42')],qs[_0x707e('0x44')](_0x3712e1[_0x707e('0x3f')][_0x707e('0x44')]));_0x4aba1c['attributes']=_0x4aba1c[_0x707e('0x43')]['length']?_0x4aba1c['attributes']:_0x316dd6[_0x707e('0x42')];if(!_0x3712e1['query']['hasOwnProperty'](_0x707e('0x46'))){_0x4aba1c[_0x707e('0x2f')]=qs[_0x707e('0x2f')](_0x3712e1['query'][_0x707e('0x2f')]);_0x4aba1c[_0x707e('0x2e')]=qs[_0x707e('0x2e')](_0x3712e1[_0x707e('0x3f')][_0x707e('0x2e')]);}_0x4aba1c[_0x707e('0x47')]=qs[_0x707e('0x48')](_0x3712e1[_0x707e('0x3f')][_0x707e('0x48')]);_0x4aba1c[_0x707e('0x49')]=qs[_0x707e('0x41')](_['pick'](_0x3712e1[_0x707e('0x3f')],_0x316dd6[_0x707e('0x41')]));_0x4aba1c['where'][_0x707e('0x62')]=_0x514c23['id'];if(_0x3712e1[_0x707e('0x3f')][_0x707e('0x4b')]){_0x4aba1c[_0x707e('0x49')]=_[_0x707e('0x4c')](_0x4aba1c[_0x707e('0x49')],{'$or':_[_0x707e('0x3a')](_0x4aba1c[_0x707e('0x43')],function(_0x410c39){var _0x4502a5={};_0x4502a5[_0x410c39]={'$like':'%'+_0x3712e1[_0x707e('0x3f')]['filter']+'%'};return _0x4502a5;})});}_0x4aba1c=_[_0x707e('0x4c')]({},_0x4aba1c,_0x3712e1[_0x707e('0x4e')]);return db[_0x707e('0x64')][_0x707e('0x2d')]({'where':_0x4aba1c[_0x707e('0x49')]})['then'](function(_0x462a92){_0x377cca[_0x707e('0x2d')]=_0x462a92;if(_0x3712e1[_0x707e('0x3f')]['includeAll']){_0x4aba1c[_0x707e('0x51')]=[{'all':!![]}];}return db[_0x707e('0x64')][_0x707e('0x65')](_0x4aba1c);})[_0x707e('0x21')](function(_0x1496c4){_0x377cca[_0x707e('0x52')]=_0x1496c4;return _0x377cca;});}})[_0x707e('0x21')](respondWithFilteredResult(_0x4e9872,_0x4aba1c))['catch'](handleError(_0x4e9872,null));};exports[_0x707e('0x66')]=function(_0x1a5859,_0x42520b,_0x3e935c){return db['SmsAccount'][_0x707e('0x57')]({'where':{'id':_0x1a5859[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x42520b,null))[_0x707e('0x21')](function(_0x14b421){if(_0x14b421){return _0x14b421[_0x707e('0x66')](_0x1a5859[_0x707e('0x3f')][_0x707e('0x67')]);}})[_0x707e('0x21')](respondWithStatusCode(_0x42520b,null))[_0x707e('0x5e')](handleError(_0x42520b,null));};exports[_0x707e('0x68')]=function(_0x376e5a,_0x1fa48a,_0x3dbef6){if(_0x376e5a[_0x707e('0x5f')]['id']){delete _0x376e5a[_0x707e('0x5f')]['id'];}return db[_0x707e('0x4f')][_0x707e('0x57')]({'where':{'id':_0x376e5a['params']['id']}})['then'](handleEntityNotFound(_0x1fa48a,null))['then'](function(_0x273194){if(_0x273194){_0x376e5a[_0x707e('0x5f')][_0x707e('0x62')]=_0x273194['id'];return db['CannedAnswer']['create'](_0x376e5a[_0x707e('0x5f')]);}})['then'](respondWithResult(_0x1fa48a,null))[_0x707e('0x5e')](handleError(_0x1fa48a,null));};exports[_0x707e('0x69')]=function(_0x28e08d,_0x2e3e48,_0x1025f7){var _0x353648={'raw':![],'where':{}};var _0x2c06c0={};var _0x40b547={'count':0x0,'rows':[]};return db[_0x707e('0x4f')][_0x707e('0x63')]({'where':{'id':_0x28e08d['params']['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x2e3e48,null))[_0x707e('0x21')](function(_0x109731){if(_0x109731){_0x2c06c0['model']=_[_0x707e('0x40')](db['CannedAnswer'][_0x707e('0x3b')]);_0x2c06c0[_0x707e('0x3f')]=_[_0x707e('0x40')](_0x28e08d[_0x707e('0x3f')]);_0x2c06c0[_0x707e('0x41')]=_[_0x707e('0x56')](_0x2c06c0[_0x707e('0x42')],_0x2c06c0[_0x707e('0x3f')]);_0x353648[_0x707e('0x43')]=_['intersection'](_0x2c06c0[_0x707e('0x42')],qs[_0x707e('0x44')](_0x28e08d['query']['fields']));_0x353648[_0x707e('0x43')]=_0x353648[_0x707e('0x43')][_0x707e('0x45')]?_0x353648['attributes']:_0x2c06c0['model'];if(!_0x28e08d[_0x707e('0x3f')][_0x707e('0x6a')]('nolimit')){_0x353648[_0x707e('0x2f')]=qs[_0x707e('0x2f')](_0x28e08d['query'][_0x707e('0x2f')]);_0x353648['offset']=qs['offset'](_0x28e08d['query'][_0x707e('0x2e')]);}_0x353648[_0x707e('0x47')]=qs['sort'](_0x28e08d['query'][_0x707e('0x48')]);_0x353648[_0x707e('0x49')]=qs[_0x707e('0x41')](_[_0x707e('0x4a')](_0x28e08d['query'],_0x2c06c0['filters']));_0x353648['where'][_0x707e('0x62')]=_0x109731['id'];if(_0x28e08d['query'][_0x707e('0x4b')]){_0x353648[_0x707e('0x49')]=_[_0x707e('0x4c')](_0x353648[_0x707e('0x49')],{'$or':_['map'](_0x353648[_0x707e('0x43')],function(_0x3fcb50){var _0x5d67b8={};_0x5d67b8[_0x3fcb50]={'$like':'%'+_0x28e08d[_0x707e('0x3f')][_0x707e('0x4b')]+'%'};return _0x5d67b8;})});}_0x353648=_['merge']({},_0x353648,_0x28e08d[_0x707e('0x4e')]);return db[_0x707e('0x6b')][_0x707e('0x2d')]({'where':_0x353648['where']})['then'](function(_0x462d82){_0x40b547['count']=_0x462d82;if(_0x28e08d[_0x707e('0x3f')][_0x707e('0x50')]){_0x353648[_0x707e('0x51')]=[{'all':!![]}];}return db[_0x707e('0x6b')][_0x707e('0x65')](_0x353648);})['then'](function(_0x3efe1b){_0x40b547['rows']=_0x3efe1b;return _0x40b547;});}})[_0x707e('0x21')](respondWithFilteredResult(_0x2e3e48,_0x353648))[_0x707e('0x5e')](handleError(_0x2e3e48,null));};exports[_0x707e('0x6c')]=function(_0x32589f,_0x523797,_0x4e525e){return db['SmsAccount']['find']({'where':{'id':_0x32589f[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x523797,null))['then'](function(_0x391f74){if(_0x391f74){return _0x391f74[_0x707e('0x6c')](_0x32589f[_0x707e('0x3f')][_0x707e('0x67')]);}})[_0x707e('0x21')](respondWithStatusCode(_0x523797,null))[_0x707e('0x5e')](handleError(_0x523797,null));};exports[_0x707e('0x6d')]=function(_0x3f3d48,_0x27483e,_0x175aad){var _0x1285e3={'channel':_0x707e('0x6e')};var _0x44d535=[];var _0x12cd62=[];var _0x31c094={};return db[_0x707e('0x4f')][_0x707e('0x57')]({'where':{'id':_0x3f3d48[_0x707e('0x54')]['id']},'include':[{'model':db[_0x707e('0x6f')],'as':_0x707e('0x70')}]})[_0x707e('0x21')](handleEntityNotFound(_0x27483e,null))[_0x707e('0x21')](function(_0x4731c2){_0x1285e3['account']=_0x4731c2;_0x1285e3['applications']=_[_0x707e('0x71')](_0x4731c2[_0x707e('0x70')],[_0x707e('0x72')],['asc']);if(_0x1285e3['account'][_0x707e('0x70')]){delete _0x1285e3[_0x707e('0x73')]['Applications'];}return db[_0x707e('0x74')][_0x707e('0x60')]();})[_0x707e('0x21')](function(_0x4a9305){if(!_0x4a9305){throw new db[(_0x707e('0x75'))][(_0x707e('0x76'))](_0x707e('0x77'));}_0x44d535=_[_0x707e('0x78')](_[_0x707e('0x40')](_0x4a9305),['createdAt',_0x707e('0x79')]);_0x12cd62=_[_0x707e('0x78')](_[_0x707e('0x40')](_0x4a9305),[_0x707e('0x7a'),'updatedAt','CompanyId','ListId']);_0x1285e3[_0x707e('0x5f')]={'mapKey':_0x707e('0x7b')};if(_0x1285e3[_0x707e('0x73')][_0x707e('0x4d')]){switch(_0x1285e3['account']['type']){case'twilio':_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x7d')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x7e')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x7f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x80')];break;case _0x707e('0x81'):_0x1285e3[_0x707e('0x5f')]['from']='+'+_0x3f3d48[_0x707e('0x5f')]['sender'];_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x82')];break;case _0x707e('0x83'):_0x1285e3[_0x707e('0x5f')]['from']=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x7c')];_0x1285e3['body'][_0x707e('0x5f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x28')];break;case _0x707e('0x84'):_0x1285e3[_0x707e('0x5f')]['from']=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x7c')];_0x1285e3['body'][_0x707e('0x5f')]=_0x3f3d48['body'][_0x707e('0x5f')];_0x1285e3['body'][_0x707e('0x7f')]=_0x3f3d48['body']['message_id'];break;case _0x707e('0x85'):_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')]=_0x3f3d48[_0x707e('0x5f')]['From'];_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x86')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x7f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x87')];break;case _0x707e('0x88'):_0x1285e3[_0x707e('0x5f')]['from']='+'+_0x3f3d48['body'][_0x707e('0x89')][0x0][_0x707e('0x7c')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')]=_0x3f3d48[_0x707e('0x5f')]['results'][0x0]['text'];_0x1285e3[_0x707e('0x5f')][_0x707e('0x7f')]=_0x3f3d48['body']['results'][0x0][_0x707e('0x7f')];break;case _0x707e('0x8a'):_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')]=_0x3f3d48[_0x707e('0x5f')]['originatingAddress'];_0x1285e3[_0x707e('0x5f')]['body']=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x8b')][_0x707e('0x28')];break;case _0x707e('0x8c'):_0x1285e3['body'][_0x707e('0x7c')]=_0x3f3d48[_0x707e('0x5f')]['fromNumber'];_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x82')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x7f')]=_0x3f3d48['body'][_0x707e('0x8d')];break;case _0x707e('0x8e'):_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x7c')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')]=_0x3f3d48['body'][_0x707e('0x28')];_0x1285e3[_0x707e('0x5f')][_0x707e('0x7f')]=_0x3f3d48[_0x707e('0x5f')][_0x707e('0x8f')];break;}}if(_0x1285e3[_0x707e('0x5f')]['id']){delete _0x1285e3[_0x707e('0x5f')]['id'];}if(_[_0x707e('0x90')](_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')])){throw new db[(_0x707e('0x75'))][(_0x707e('0x76'))]('from\x20is\x20mandatory');}if(_[_0x707e('0x90')](_0x1285e3[_0x707e('0x5f')]['body'])||_0x1285e3['body'][_0x707e('0x5f')]===''){throw new db[(_0x707e('0x75'))][(_0x707e('0x76'))](_0x707e('0x91'));}if(_[_0x707e('0x90')](_0x1285e3[_0x707e('0x5f')][_0x707e('0x92')])){throw new db['Sequelize'][(_0x707e('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12cd62);}if(!_[_0x707e('0x93')](_0x12cd62,_0x1285e3['body'][_0x707e('0x92')])){throw new db[(_0x707e('0x75'))][(_0x707e('0x76'))](_0x707e('0x94')+_0x12cd62);}_0x31c094[_0x1285e3['body'][_0x707e('0x92')]]=_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')];return db[_0x707e('0x95')][_0x707e('0x57')]({'where':{'id':_0x1285e3[_0x707e('0x73')]['ListId']},'include':[{'model':db[_0x707e('0x74')],'as':'Contacts','where':_0x31c094,'limit':0x1,'order':[['updatedAt',_0x707e('0x96')]]}]});})['then'](handleEntityNotFound(_0x27483e,null))[_0x707e('0x21')](function(_0x41426a){if(_0x41426a){_0x1285e3[_0x707e('0x97')]=_[_0x707e('0x98')](_0x41426a,['Contacts']);if(_0x41426a[_0x707e('0x99')][_0x707e('0x45')]){return _0x41426a[_0x707e('0x99')][0x0];}var _0x2cfad0=_[_0x707e('0x9a')](_0x1285e3['body'],{'firstName':_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')],'ListId':_0x41426a['id']});_0x2cfad0[_0x1285e3[_0x707e('0x5f')][_0x707e('0x92')]]=_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')];return db[_0x707e('0x74')][_0x707e('0x58')](_0x2cfad0,{'fields':_0x44d535,'raw':!![]});}})['then'](handleEntityNotFound(_0x27483e,null))['then'](function(_0x2858b8){if(_0x2858b8){_0x1285e3[_0x707e('0x9b')]=_0x2858b8;var _0x4fe66b={'ContactId':_0x2858b8['id'],'phone':_0x1285e3['body']['from'],'SmsAccountId':_0x3f3d48['params']['id']};var _0x51493c={'ContactId':_0x2858b8['id'],'SmsAccountId':_0x3f3d48[_0x707e('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0x707e('0x57')]({'where':_0x51493c})[_0x707e('0x21')](function(_0x4d7e9b){if(_0x4d7e9b){return[_0x4d7e9b,![]];}return db[_0x707e('0x9c')]['create'](_0x4fe66b)[_0x707e('0x21')](function(_0x1cee9e){return[_0x1cee9e,!![]];});});}})['spread'](function(_0x4d7b43,_0x4cd1ef){_0x1285e3[_0x707e('0x9d')]=_0x4d7b43[_0x707e('0x5a')]({'plain':!![]});_0x1285e3[_0x707e('0x9d')][_0x707e('0x9e')]=![];if(_0x4cd1ef){if(_0x1285e3['account'][_0x707e('0x9f')]){_0x1285e3[_0x707e('0xa0')][_0x707e('0xa1')]({'id':0x0,'priority':_0x1285e3[_0x707e('0xa0')][_0x707e('0x45')]+0x1,'app':_0x707e('0xa2'),'appdata':_0x707e('0xa3'),'interval':_0x707e('0xa4')});}_0x1285e3[_0x707e('0x9d')][_0x707e('0x9e')]=!![];}return db[_0x707e('0xa5')][_0x707e('0x58')]({'phone':_0x1285e3[_0x707e('0x5f')][_0x707e('0x7c')],'messageId':_0x1285e3[_0x707e('0x5f')][_0x707e('0x7f')],'body':_0x1285e3[_0x707e('0x5f')][_0x707e('0x5f')],'SmsAccountId':_0x3f3d48[_0x707e('0x54')]['id'],'SmsInteractionId':_0x4d7b43['id'],'direction':'in','ContactId':_0x4d7b43[_0x707e('0xa6')],'AttachmentId':_0x1285e3['body'][_0x707e('0xa7')]});})[_0x707e('0x21')](function(_0x35bb69){_0x1285e3[_0x707e('0x28')]=_0x35bb69;if(_0x1285e3[_0x707e('0x9d')]['UserId']){return db[_0x707e('0xa8')][_0x707e('0x57')]({'attributes':['id',_0x707e('0x3e')],'where':{'id':_0x1285e3[_0x707e('0x9d')]['UserId']}})[_0x707e('0x21')](function(_0x331f24){if(_0x331f24){_0x1285e3[_0x707e('0xa0')][_0x707e('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x331f24[_0x707e('0x3e')]+','+(_0x1285e3[_0x707e('0x73')][_0x707e('0xaa')]||0xa),'interval':_0x707e('0xa4')});}return respondWithRpcPromise(_0x707e('0xab'),_0x707e('0xac'),_0x1285e3);});}return respondWithRpcPromise(_0x707e('0xab'),_0x707e('0xac'),_0x1285e3);})[_0x707e('0x21')](function(_0x26cb2f){if(_0x26cb2f){var _0x3d365a=0xc8;var _0x13617f=_0x707e('0xad');logger[_0x707e('0x22')](_0x707e('0xae'),_0x13617f,_0x3d365a,_0x707e('0xaf'));logger[_0x707e('0x25')](_0x707e('0xb0'),_0x13617f,_0x3d365a,_0x707e('0xaf'),JSON[_0x707e('0x26')](_0x26cb2f));if(_0x1285e3[_0x707e('0x73')][_0x707e('0x4d')]===_0x707e('0xb1')){return _0x27483e[_0x707e('0x2b')](_0x3d365a)['set'](_0x707e('0xb2'),'text/xml')[_0x707e('0x37')]('\x0a');}else{return _0x27483e[_0x707e('0x2b')](_0x3d365a)[_0x707e('0x2c')](_0x26cb2f);}}})[_0x707e('0x5e')](handleError(_0x27483e,null));};exports[_0x707e('0xb3')]=function(_0x38b42a,_0x44ca29,_0x4611a2){return db[_0x707e('0x4f')][_0x707e('0x63')]({'where':{'id':_0x38b42a['params']['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x44ca29,null))[_0x707e('0x21')](function(_0x3d0974){if(_0x3d0974){return db['sequelize'][_0x707e('0xb4')](function(_0x311d11){return db[_0x707e('0x6f')][_0x707e('0x34')]({'where':{'SmsAccountId':_0x38b42a[_0x707e('0x54')]['id']},'transaction':_0x311d11})[_0x707e('0x21')](function(_0xe88c79){var _0x5e5602=_[_0x707e('0x3a')](_0x38b42a[_0x707e('0x5f')],function(_0x268dd9){_0x268dd9[_0x707e('0x62')]=_0x38b42a['params']['id'];return _0x268dd9;});return db[_0x707e('0x6f')][_0x707e('0xb5')](_0x5e5602,{'transaction':_0x311d11});});})['then'](function(){return db[_0x707e('0x6f')][_0x707e('0xb6')]({'where':{'SmsAccountId':_0x38b42a[_0x707e('0x54')]['id']},'order':_0x707e('0x72')});});}})['then'](respondWithResult(_0x44ca29,null))[_0x707e('0x5e')](handleError(_0x44ca29,null));};exports[_0x707e('0xb7')]=function(_0x167fc1,_0x41a155,_0x260749){var _0x4faa60={};var _0x467aa1={};var _0x66b79c;var _0xf4b6cc;return db[_0x707e('0x4f')][_0x707e('0x63')]({'where':{'id':_0x167fc1[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x41a155,null))['then'](function(_0x291e8a){if(_0x291e8a){_0x66b79c=_0x291e8a;_0x467aa1['model']=_[_0x707e('0x40')](db['SmsApplication'][_0x707e('0x3b')]);_0x467aa1[_0x707e('0x3f')]=_[_0x707e('0x40')](_0x167fc1['query']);_0x467aa1[_0x707e('0x41')]=_['intersection'](_0x467aa1[_0x707e('0x42')],_0x467aa1[_0x707e('0x3f')]);_0x4faa60[_0x707e('0x43')]=_[_0x707e('0x56')](_0x467aa1['model'],qs['fields'](_0x167fc1[_0x707e('0x3f')][_0x707e('0x44')]));_0x4faa60['attributes']=_0x4faa60[_0x707e('0x43')][_0x707e('0x45')]?_0x4faa60[_0x707e('0x43')]:_0x467aa1['model'];_0x4faa60['order']=qs[_0x707e('0x48')](_0x167fc1[_0x707e('0x3f')]['sort']);_0x4faa60[_0x707e('0x49')]=qs[_0x707e('0x41')](_['pick'](_0x167fc1[_0x707e('0x3f')],_0x467aa1[_0x707e('0x41')]));if(_0x167fc1[_0x707e('0x3f')][_0x707e('0x4b')]){_0x4faa60[_0x707e('0x49')]=_[_0x707e('0x4c')](_0x4faa60[_0x707e('0x49')],{'$or':_[_0x707e('0x3a')](_0x4faa60[_0x707e('0x43')],function(_0x41f46e){var _0x3c7217={};_0x3c7217[_0x41f46e]={'$like':'%'+_0x167fc1[_0x707e('0x3f')]['filter']+'%'};return _0x3c7217;})});}_0x4faa60=_[_0x707e('0x4c')]({},_0x4faa60,_0x167fc1[_0x707e('0x4e')]);return _0x66b79c[_0x707e('0xb7')](_0x4faa60);}})['then'](function(_0x30fce3){if(_0x30fce3){_0xf4b6cc=_0x30fce3[_0x707e('0x45')];if(!_0x167fc1[_0x707e('0x3f')][_0x707e('0x6a')]('nolimit')){_0x4faa60[_0x707e('0x2f')]=qs[_0x707e('0x2f')](_0x167fc1['query']['limit']);_0x4faa60[_0x707e('0x2e')]=qs['offset'](_0x167fc1[_0x707e('0x3f')][_0x707e('0x2e')]);}return _0x66b79c[_0x707e('0xb7')](_0x4faa60);}})['then'](function(_0x3bfa02){if(_0x3bfa02){return _0x3bfa02?{'count':_0xf4b6cc,'rows':_0x3bfa02}:null;}})[_0x707e('0x21')](respondWithResult(_0x41a155,null))[_0x707e('0x5e')](handleError(_0x41a155,null));};exports['getInteractions']=function(_0x653b11,_0x3399ee,_0x510930){var _0x50eea6={'raw':![],'where':{}};var _0x5d5094={};var _0x48e4a8={'count':0x0,'rows':[]};return db[_0x707e('0x4f')]['findOne']({'where':{'id':_0x653b11[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x3399ee,null))[_0x707e('0x21')](function(_0x4d73fb){if(_0x4d73fb){_0x5d5094['model']=_[_0x707e('0x40')](db[_0x707e('0x9c')]['rawAttributes']);_0x5d5094['query']=_[_0x707e('0x40')](_0x653b11[_0x707e('0x3f')]);_0x5d5094[_0x707e('0x41')]=_[_0x707e('0x56')](_0x5d5094['model'],_0x5d5094[_0x707e('0x3f')]);_0x50eea6[_0x707e('0x43')]=_['intersection'](_0x5d5094['model'],qs[_0x707e('0x44')](_0x653b11[_0x707e('0x3f')][_0x707e('0x44')]));_0x50eea6[_0x707e('0x43')]=_0x50eea6[_0x707e('0x43')]['length']?_0x50eea6[_0x707e('0x43')]:_0x5d5094['model'];if(!_0x653b11[_0x707e('0x3f')]['hasOwnProperty']('nolimit')){_0x50eea6[_0x707e('0x2f')]=qs[_0x707e('0x2f')](_0x653b11[_0x707e('0x3f')][_0x707e('0x2f')]);_0x50eea6[_0x707e('0x2e')]=qs['offset'](_0x653b11[_0x707e('0x3f')]['offset']);}_0x50eea6[_0x707e('0x47')]=qs[_0x707e('0x48')](_0x653b11[_0x707e('0x3f')][_0x707e('0x48')]);_0x50eea6[_0x707e('0x49')]=qs[_0x707e('0x41')](_[_0x707e('0x4a')](_0x653b11[_0x707e('0x3f')],_0x5d5094['filters']));_0x50eea6[_0x707e('0x49')][_0x707e('0x62')]=_0x4d73fb['id'];if(_0x653b11[_0x707e('0x3f')][_0x707e('0x4b')]){_0x50eea6[_0x707e('0x49')]=_[_0x707e('0x4c')](_0x50eea6[_0x707e('0x49')],{'$or':_[_0x707e('0x3a')](_0x50eea6[_0x707e('0x43')],function(_0x30e5af){var _0x256370={};_0x256370[_0x30e5af]={'$like':'%'+_0x653b11[_0x707e('0x3f')][_0x707e('0x4b')]+'%'};return _0x256370;})});}_0x50eea6=_[_0x707e('0x4c')]({},_0x50eea6,_0x653b11[_0x707e('0x4e')]);return db['SmsInteraction'][_0x707e('0x2d')]({'where':_0x50eea6['where']})[_0x707e('0x21')](function(_0x57a96a){_0x48e4a8[_0x707e('0x2d')]=_0x57a96a;if(_0x653b11[_0x707e('0x3f')][_0x707e('0x50')]){_0x50eea6[_0x707e('0x51')]=[{'model':db[_0x707e('0x74')],'as':_0x707e('0xb8'),'required':![]},{'model':db[_0x707e('0xa8')],'as':'Owner','attributes':[_0x707e('0x3e'),_0x707e('0xb9'),_0x707e('0xba')],'required':![]},{'model':db[_0x707e('0xbb')],'as':'Tags','attributes':['id',_0x707e('0x3e'),_0x707e('0xbc')],'where':_0x653b11['query']['tag']?{'id':_0x653b11[_0x707e('0x3f')]['tag']}:undefined,'required':_0x653b11[_0x707e('0x3f')][_0x707e('0xbd')]?!![]:![]}];}return db[_0x707e('0x9c')]['findAll'](_0x50eea6);})[_0x707e('0x21')](function(_0x1ad87d){_0x48e4a8[_0x707e('0x52')]=_0x1ad87d;return _0x48e4a8;});}})[_0x707e('0x21')](respondWithFilteredResult(_0x3399ee,_0x50eea6))[_0x707e('0x5e')](handleError(_0x3399ee,null));};exports['send']=function(_0x3fd3d1,_0x3aee89,_0x3d7dbc){var _0x4c9eea,_0x447ea4,_0x46ce91;if(_[_0x707e('0x90')](_0x3fd3d1[_0x707e('0x5f')][_0x707e('0x5f')])||_0x3fd3d1['body'][_0x707e('0x5f')]===''){throw new db['Sequelize'][(_0x707e('0x76'))](_0x707e('0x91'));}if(_[_0x707e('0x90')](_0x3fd3d1[_0x707e('0x5f')]['to'])){throw new db[(_0x707e('0x75'))]['ValidationError'](_0x707e('0xbe'));}_0x4c9eea=_0x3fd3d1[_0x707e('0x5f')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x3fd3d1[_0x707e('0x54')]['id']},'include':[{'model':db[_0x707e('0x95')],'as':_0x707e('0xbf'),'include':[{'model':db[_0x707e('0x74')],'as':_0x707e('0x99'),'where':{'mobile':_0x4c9eea},'limit':0x1,'order':[[_0x707e('0x79'),_0x707e('0x96')]]}]}]})[_0x707e('0x21')](handleEntityNotFound(_0x3aee89,null))[_0x707e('0x21')](function(_0x430f18){if(_0x430f18&&_0x430f18[_0x707e('0xbf')]){_0x447ea4=_0x430f18[_0x707e('0x5a')]({'plain':!![]});if(_0x447ea4[_0x707e('0xbf')]&&_0x447ea4[_0x707e('0xbf')][_0x707e('0x99')][_0x707e('0x45')]){return _0x447ea4[_0x707e('0xbf')][_0x707e('0x99')][0x0];}return db[_0x707e('0x74')][_0x707e('0x58')](_[_0x707e('0x9a')](_0x3fd3d1[_0x707e('0x5f')],{'firstName':_0x4c9eea,'mobile':_0x4c9eea,'phone':_0x4c9eea,'ListId':_0x447ea4[_0x707e('0xc0')]}));}})[_0x707e('0x21')](handleEntityNotFound(_0x3aee89,null))[_0x707e('0x21')](function(_0x1a1b80){if(_0x1a1b80){_0x46ce91=_0x1a1b80;return db[_0x707e('0x9c')][_0x707e('0x57')]({'where':{'ContactId':_0x46ce91['id'],'closed':![],'SmsAccountId':_0x447ea4['id']}})[_0x707e('0x21')](function(_0x3786bf){if(_0x3786bf){return[_0x3786bf,![]];}return db[_0x707e('0x9c')]['create']({'UserId':_0x3fd3d1[_0x707e('0x59')]['id'],'ContactId':_0x46ce91['id'],'SmsAccountId':_0x447ea4['id'],'phone':_0x4c9eea,'firstMsgDirection':_0x707e('0xc1'),'Messages':[_[_0x707e('0x4c')](_0x3fd3d1[_0x707e('0x5f')],{'read':![],'body':_0x3fd3d1[_0x707e('0x5f')]['body'],'phone':_0x4c9eea,'SmsAccountId':_0x447ea4['id'],'UserId':_0x3fd3d1[_0x707e('0x59')]['id'],'ContactId':_0x46ce91['id']})]},{'include':[{'model':db[_0x707e('0xa5')],'as':_0x707e('0xc2')}]})[_0x707e('0x21')](function(_0x1789f5){return[_0x1789f5,!![]];});});}})[_0x707e('0xc3')](function(_0x469aa8,_0x143d7b){if(_0x143d7b){return _0x469aa8;}return db[_0x707e('0xa5')][_0x707e('0x58')](_[_0x707e('0x4c')](_0x3fd3d1[_0x707e('0x5f')],{'read':![],'body':_0x3fd3d1[_0x707e('0x5f')][_0x707e('0x5f')],'phone':_0x4c9eea,'SmsAccountId':_0x447ea4['id'],'SmsInteractionId':_0x469aa8['id'],'UserId':_0x3fd3d1[_0x707e('0x59')]['id'],'ContactId':_0x46ce91['id']}))[_0x707e('0x21')](function(_0x11a7b5){_0x469aa8['dataValues'][_0x707e('0xc2')]=[];_0x469aa8[_0x707e('0xc4')][_0x707e('0xc2')][_0x707e('0xa1')](_0x11a7b5[_0x707e('0xc4')]);return _0x469aa8;});})[_0x707e('0x21')](respondWithResult(_0x3aee89,null))['catch'](handleError(_0x3aee89,null));};exports['status']=function(_0x2fcd73,_0x5e9b6,_0x3a8583){if(_0x2fcd73[_0x707e('0x5f')]['id']){delete _0x2fcd73[_0x707e('0x5f')]['id'];}console[_0x707e('0xc5')](_0x707e('0xc6'),_0x2fcd73[_0x707e('0x5f')]);var _0xf0edb4,_0x1d670d,_0x42d5a3;return db[_0x707e('0x4f')][_0x707e('0x57')]({'where':{'id':_0x2fcd73['params']['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x5e9b6,null))[_0x707e('0x21')](function(_0x138018){if(_0x138018){_0x42d5a3=_0x138018;logger['debug'](_0x707e('0xae'),_0x707e('0x2b'),'received\x20delivery\x20report\x20from',_0x138018[_0x707e('0x4d')],util['inspect'](_0x2fcd73[_0x707e('0x5f')],{'showHidden':![],'depth':null}));switch(_0x138018[_0x707e('0x4d')]){case _0x707e('0x81'):if(_0x2fcd73[_0x707e('0x5f')][_0x707e('0xc7')]&&_0x2fcd73[_0x707e('0x5f')][_0x707e('0x2b')]){_0x1d670d=_0x2fcd73['body'][_0x707e('0x2b')];return db[_0x707e('0xa5')]['find']({'where':{'messageId':_0x2fcd73[_0x707e('0x5f')][_0x707e('0xc7')]}});}break;case _0x707e('0x83'):if(_0x2fcd73[_0x707e('0x5f')][_0x707e('0xc8')]&&_0x2fcd73['body']['statusInt']){_0x1d670d=_0x2fcd73[_0x707e('0x5f')]['statusInt'];return db[_0x707e('0xa5')]['find']({'where':{'messageId':_0x2fcd73[_0x707e('0x5f')][_0x707e('0xc8')]}});}break;case _0x707e('0x84'):if(_0x2fcd73[_0x707e('0x5f')][_0x707e('0xc9')]&&_0x2fcd73['body'][_0x707e('0xca')]){_0x1d670d=_0x2fcd73['body']['status_code'];return db[_0x707e('0xa5')][_0x707e('0x57')]({'where':{'messageId':_0x2fcd73[_0x707e('0x5f')][_0x707e('0xc9')]}});}break;case'infobip':var _0x4a65c7=_0x2fcd73['body'][_0x707e('0x89')][0x0];if(_0x4a65c7[_0x707e('0x7f')]&&_0x4a65c7[_0x707e('0x2b')][_0x707e('0xcb')]===_0x707e('0xcc')){_0x1d670d=_0x4a65c7[_0x707e('0x2b')]['groupName'];return db[_0x707e('0xa5')][_0x707e('0x57')]({'where':{'messageId':_0x4a65c7[_0x707e('0x7f')]}});}break;case'clickatell':if(_0x2fcd73['body'][_0x707e('0x7f')]&&_0x2fcd73[_0x707e('0x5f')][_0x707e('0x2b')]){_0x1d670d=_0x2fcd73[_0x707e('0x5f')][_0x707e('0x2b')];return db[_0x707e('0xa5')][_0x707e('0x57')]({'where':{'messageId':_0x2fcd73['body'][_0x707e('0x7f')]}});}break;case _0x707e('0x8e'):if(_0x2fcd73[_0x707e('0x5f')][_0x707e('0xcd')]&&_0x2fcd73[_0x707e('0x5f')]['status']){_0x1d670d=_0x2fcd73['body']['status'];return db[_0x707e('0xa5')][_0x707e('0x57')]({'where':{'messageId':_0x2fcd73[_0x707e('0x5f')][_0x707e('0xcd')]}});}break;}}})[_0x707e('0x21')](handleEntityNotFound(_0x5e9b6,null))[_0x707e('0x21')](function(_0x2d1f22){if(_0x2d1f22){_0xf0edb4=_0x2d1f22;switch(_0x42d5a3[_0x707e('0x4d')]){case _0x707e('0x81'):if(_0x1d670d===_0x707e('0xcc')){return _0xf0edb4['update']({'read':!![]});}else{logger[_0x707e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x707e('0x2b'),_0x707e('0x81'),util[_0x707e('0xce')](_0x2fcd73['body'],{'showHidden':![],'depth':null}));}break;case _0x707e('0x83'):if(_0x1d670d==='1'){return _0xf0edb4[_0x707e('0x33')]({'read':!![]});}else{logger[_0x707e('0x27')](_0x707e('0xae'),_0x707e('0x2b'),_0x707e('0x81'),util['inspect'](_0x2fcd73[_0x707e('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x707e('0x84'):if(!_0x2fcd73['body']['error_code']&&_0x1d670d>=0xc8&&_0x1d670d<=0xce){return _0xf0edb4['update']({'read':!![]});}else{logger['error'](_0x707e('0xae'),_0x707e('0x2b'),'clicksend',util[_0x707e('0xce')](_0x2fcd73[_0x707e('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x707e('0x88'):var _0x396f18=_0x2fcd73['body'][_0x707e('0x89')][0x0];if(_0x396f18[_0x707e('0x2b')][_0x707e('0xcb')]==='DELIVERED'){return _0xf0edb4[_0x707e('0x33')]({'read':!![]});}else{logger[_0x707e('0x27')](_0x707e('0xae'),_0x707e('0x2b'),_0x707e('0x88'),util[_0x707e('0xce')](_0x2fcd73[_0x707e('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x707e('0x8c'):if(_0x1d670d=='DELIVERED_TO_GATEWAY'||_0x1d670d=='RECEIVED_BY_RECIPIENT'){return _0xf0edb4['update']({'read':!![]});}else{logger[_0x707e('0x27')](_0x707e('0xae'),_0x707e('0x2b'),_0x707e('0x8c'),util[_0x707e('0xce')](_0x2fcd73['body'],{'showHidden':![],'depth':null}));}break;case _0x707e('0x8e'):if(_0x1d670d===_0x707e('0xcf')||_0x1d670d===_0x707e('0xd0')){return _0xf0edb4[_0x707e('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x707e('0x2b'),_0x707e('0x8e'),util[_0x707e('0xce')](_0x2fcd73[_0x707e('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0xf0edb4;}})[_0x707e('0x21')](respondWithResult(_0x5e9b6,null))[_0x707e('0x5e')](handleError(_0x5e9b6,null));};exports[_0x707e('0xd1')]=function(_0x332490,_0x4ef385,_0x70f954){var _0xb6b361,_0x12e64f,_0x243cdc;return db[_0x707e('0x4f')][_0x707e('0x57')]({'where':{'id':_0x332490[_0x707e('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ef385,null))[_0x707e('0x21')](function(_0x582ecb){if(_0x582ecb){_0x243cdc=_0x582ecb;logger[_0x707e('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x707e('0xd2'),_0x582ecb[_0x707e('0x4d')],util['inspect'](_0x332490[_0x707e('0x3f')],{'showHidden':![],'depth':null}));switch(_0x582ecb['type']){case'csc':if(_0x332490[_0x707e('0x3f')][_0x707e('0xd3')]&&_0x332490['query']['state']){_0x12e64f=_0x332490['query'][_0x707e('0xd4')];return db[_0x707e('0xa5')][_0x707e('0x57')]({'where':{'messageId':_0x332490['query'][_0x707e('0xd3')]}});}break;}}})['then'](handleEntityNotFound(_0x4ef385,null))['then'](function(_0x3223e3){if(_0x3223e3){_0xb6b361=_0x3223e3;switch(_0x243cdc['type']){case'csc':if(_0x12e64f==='2'||_0x12e64f==='6'){return _0xb6b361[_0x707e('0x33')]({'read':!![]});}else{logger[_0x707e('0x27')](_0x707e('0xae'),_0x707e('0x2b'),_0x707e('0x8a'),util[_0x707e('0xce')](_0x332490[_0x707e('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0xb6b361;}})[_0x707e('0x21')](respondWithResult(_0x4ef385,null))[_0x707e('0x5e')](handleError(_0x4ef385,null));};exports['addAgents']=function(_0x2fc7cc,_0x59f4fa,_0x596322){return db[_0x707e('0x4f')]['find']({'where':{'id':_0x2fc7cc[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x59f4fa,null))[_0x707e('0x21')](function(_0x29473f){if(_0x29473f){return _0x29473f[_0x707e('0xd5')](_0x2fc7cc['body'][_0x707e('0x67')],_['omit'](_0x2fc7cc[_0x707e('0x5f')],[_0x707e('0x67'),'id'])||{})['spread'](function(_0x5bbfbd){for(var _0x26651a=0x0;_0x26651a<_0x2fc7cc['body'][_0x707e('0x67')][_0x707e('0x45')];_0x26651a+=0x1){socket[_0x707e('0xd6')](_0x707e('0xd7'),{'UserId':_0x2fc7cc[_0x707e('0x5f')][_0x707e('0x67')][_0x26651a],'SmsAccountId':_0x2fc7cc[_0x707e('0x54')]['id']});}return _0x5bbfbd;});}})[_0x707e('0x21')](respondWithResult(_0x59f4fa,null))[_0x707e('0x5e')](handleError(_0x59f4fa,null));};exports[_0x707e('0xd8')]=function(_0x39545d,_0x3655f5,_0x45ec5b){return db[_0x707e('0x4f')][_0x707e('0x57')]({'where':{'id':_0x39545d['params']['id']}})['then'](handleEntityNotFound(_0x3655f5,null))[_0x707e('0x21')](function(_0x9c4a53){if(_0x9c4a53){return _0x9c4a53[_0x707e('0xd8')](_0x39545d[_0x707e('0x3f')][_0x707e('0x67')])[_0x707e('0x21')](function(){if(_['isArray'](_0x39545d[_0x707e('0x3f')][_0x707e('0x67')])){for(var _0x2e171a=0x0;_0x2e171a<_0x39545d['query'][_0x707e('0x67')][_0x707e('0x45')];_0x2e171a+=0x1){socket['emit'](_0x707e('0xd9'),{'UserId':Number(_0x39545d[_0x707e('0x3f')][_0x707e('0x67')][_0x2e171a]),'SmsAccountId':Number(_0x39545d[_0x707e('0x54')]['id'])});}}else{socket[_0x707e('0xd6')](_0x707e('0xd9'),{'UserId':Number(_0x39545d[_0x707e('0x3f')]['ids']),'SmsAccountId':Number(_0x39545d[_0x707e('0x54')]['id'])});}});}})[_0x707e('0x21')](respondWithStatusCode(_0x3655f5,null))[_0x707e('0x5e')](handleError(_0x3655f5,null));};exports[_0x707e('0xda')]=function(_0x37a086,_0x32e134,_0x2da598){var _0x5b709a={};var _0x2a7d73={};var _0x19d2a7;var _0x35a989;return db[_0x707e('0x4f')][_0x707e('0x63')]({'where':{'id':_0x37a086[_0x707e('0x54')]['id']}})[_0x707e('0x21')](handleEntityNotFound(_0x32e134,null))[_0x707e('0x21')](function(_0x49de66){if(_0x49de66){_0x19d2a7=_0x49de66;_0x2a7d73[_0x707e('0x42')]=_[_0x707e('0x40')](db[_0x707e('0xa8')][_0x707e('0x3b')]);_0x2a7d73[_0x707e('0x3f')]=_[_0x707e('0x40')](_0x37a086[_0x707e('0x3f')]);_0x2a7d73[_0x707e('0x41')]=_[_0x707e('0x56')](_0x2a7d73['model'],_0x2a7d73[_0x707e('0x3f')]);_0x5b709a[_0x707e('0x43')]=_['intersection'](_0x2a7d73[_0x707e('0x42')],qs['fields'](_0x37a086['query'][_0x707e('0x44')]));_0x5b709a[_0x707e('0x43')]=_0x5b709a[_0x707e('0x43')][_0x707e('0x45')]?_0x5b709a[_0x707e('0x43')]:_0x2a7d73[_0x707e('0x42')];_0x5b709a['order']=qs[_0x707e('0x48')](_0x37a086['query']['sort']);_0x5b709a[_0x707e('0x49')]=qs['filters'](_[_0x707e('0x4a')](_0x37a086['query'],_0x2a7d73['filters']));if(_0x37a086[_0x707e('0x3f')][_0x707e('0x4b')]){_0x5b709a[_0x707e('0x49')]=_[_0x707e('0x4c')](_0x5b709a[_0x707e('0x49')],{'$or':_[_0x707e('0x3a')](_0x5b709a[_0x707e('0x43')],function(_0x313deb){var _0x3621a6={};_0x3621a6[_0x313deb]={'$like':'%'+_0x37a086[_0x707e('0x3f')][_0x707e('0x4b')]+'%'};return _0x3621a6;})});}_0x5b709a=_[_0x707e('0x4c')]({},_0x5b709a,_0x37a086[_0x707e('0x4e')]);return _0x19d2a7[_0x707e('0xda')](_0x5b709a);}})[_0x707e('0x21')](function(_0x1d8efc){if(_0x1d8efc){_0x35a989=_0x1d8efc['length'];if(!_0x37a086[_0x707e('0x3f')]['hasOwnProperty']('nolimit')){_0x5b709a[_0x707e('0x2f')]=qs[_0x707e('0x2f')](_0x37a086[_0x707e('0x3f')][_0x707e('0x2f')]);_0x5b709a['offset']=qs[_0x707e('0x2e')](_0x37a086[_0x707e('0x3f')][_0x707e('0x2e')]);}return _0x19d2a7[_0x707e('0xda')](_0x5b709a);}})[_0x707e('0x21')](function(_0xa32c4){if(_0xa32c4){return _0xa32c4?{'count':_0x35a989,'rows':_0xa32c4}:null;}})['then'](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2b1014d..bc5f632 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 _0x96d8=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x1ea8ab,_0xd53aa9){var _0x930b4=function(_0x584f3d){while(--_0x584f3d){_0x1ea8ab['push'](_0x1ea8ab['shift']());}};_0x930b4(++_0xd53aa9);}(_0x96d8,0x1e0));var _0x896d=function(_0x393641,_0x3ed3a1){_0x393641=_0x393641-0x0;var _0x516a25=_0x96d8[_0x393641];return _0x516a25;};'use strict';var EventEmitter=require(_0x896d('0x0'));var SmsAccount=require(_0x896d('0x1'))['db'][_0x896d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x896d('0x3')](0x0);var events={'afterCreate':_0x896d('0x4'),'afterUpdate':_0x896d('0x5'),'afterDestroy':_0x896d('0x6')};function emitEvent(_0x307e9d){return function(_0x526e96,_0x5cb0a7,_0x48bb04){SmsAccountEvents[_0x896d('0x7')](_0x307e9d+':'+_0x526e96['id'],_0x526e96);SmsAccountEvents['emit'](_0x307e9d,_0x526e96);_0x48bb04(null);};}for(var e in events){if(events[_0x896d('0x8')](e)){var event=events[e];SmsAccount[_0x896d('0x9')](e,emitEvent(event));}}module[_0x896d('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x0e1d=['hook','../../mysqldb','SmsAccount','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x0e1d,0x17b));var _0xd0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xd0e1('0x0'))['db'][_0xd0e1('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd0e1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0e1('0x3'),'afterDestroy':_0xd0e1('0x4')};function emitEvent(_0xad20b1){return function(_0x5566ea,_0x42bd50,_0x3e82fb){SmsAccountEvents['emit'](_0xad20b1+':'+_0x5566ea['id'],_0x5566ea);SmsAccountEvents['emit'](_0xad20b1,_0x5566ea);_0x3e82fb(null);};}for(var e in events){if(events[_0xd0e1('0x5')](e)){var event=events[e];SmsAccount[_0xd0e1('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f88219b..d2adcc8 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 _0x4272=['request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x591bc2,_0x18d14e){var _0x1712a7=function(_0x564f4c){while(--_0x564f4c){_0x591bc2['push'](_0x591bc2['shift']());}};_0x1712a7(++_0x18d14e);}(_0x4272,0x13b));var _0x2427=function(_0x4b56e3,_0x1b0d21){_0x4b56e3=_0x4b56e3-0x0;var _0xfb5ac8=_0x4272[_0x4b56e3];return _0xfb5ac8;};'use strict';var _=require(_0x2427('0x0'));var util=require('util');var logger=require(_0x2427('0x1'))(_0x2427('0x2'));var moment=require('moment');var BPromise=require(_0x2427('0x3'));var rp=require(_0x2427('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2427('0x5'));var config=require(_0x2427('0x6'));var attributes=require(_0x2427('0x7'));module[_0x2427('0x8')]=function(_0x4b76d6,_0x4f8319){return _0x4b76d6[_0x2427('0x9')]('SmsAccount',attributes,{'tableName':_0x2427('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0830=['request-promise','path','rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4bf335,_0x5a16fe){var _0x2b6960=function(_0x228ddf){while(--_0x228ddf){_0x4bf335['push'](_0x4bf335['shift']());}};_0x2b6960(++_0x5a16fe);}(_0x0830,0x97));var _0x0083=function(_0x1e53ca,_0x2692ed){_0x1e53ca=_0x1e53ca-0x0;var _0x55e658=_0x0830[_0x1e53ca];return _0x55e658;};'use strict';var _=require(_0x0083('0x0'));var util=require('util');var logger=require(_0x0083('0x1'))(_0x0083('0x2'));var moment=require(_0x0083('0x3'));var BPromise=require(_0x0083('0x4'));var rp=require(_0x0083('0x5'));var fs=require('fs');var path=require(_0x0083('0x6'));var rimraf=require(_0x0083('0x7'));var config=require('../../config/environment');var attributes=require(_0x0083('0x8'));module['exports']=function(_0x5b8dd6,_0x330702){return _0x5b8dd6[_0x0083('0x9')](_0x0083('0xa'),attributes,{'tableName':_0x0083('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 30458f2..f19ac21 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 _0xdc52=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsAccount','options','raw','attributes','include','map','model','then','ShowSmsAccount','lodash','moment'];(function(_0x17fc55,_0x545a26){var _0x38b2a0=function(_0x2f75ef){while(--_0x2f75ef){_0x17fc55['push'](_0x17fc55['shift']());}};_0x38b2a0(++_0x545a26);}(_0xdc52,0x8e));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc5('0x0'));var util=require('util');var moment=require(_0x2dc5('0x1'));var BPromise=require(_0x2dc5('0x2'));var rs=require(_0x2dc5('0x3'));var fs=require('fs');var Redis=require(_0x2dc5('0x4'));var db=require(_0x2dc5('0x5'))['db'];var utils=require(_0x2dc5('0x6'));var logger=require(_0x2dc5('0x7'))('rpc');var config=require(_0x2dc5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2dc5('0x9')][_0x2dc5('0xa')]({'port':0x232a});config[_0x2dc5('0xb')]=_[_0x2dc5('0xc')](config[_0x2dc5('0xb')],{'host':_0x2dc5('0xd'),'port':0x18eb});var socket=require(_0x2dc5('0xe'))(new Redis(config[_0x2dc5('0xb')]));require('./smsAccount.socket')[_0x2dc5('0xf')](socket);function respondWithRpcPromise(_0x4256aa,_0x2c5cb6,_0x57d7b2){return new BPromise(function(_0x4f0341,_0x557c1e){return client[_0x2dc5('0x10')](_0x4256aa,_0x57d7b2)['then'](function(_0x2470c7){logger[_0x2dc5('0x11')](_0x2dc5('0x12'),_0x2c5cb6,_0x2dc5('0x13'));logger[_0x2dc5('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c5cb6,_0x2dc5('0x13'),JSON[_0x2dc5('0x15')](_0x2470c7));if(_0x2470c7[_0x2dc5('0x16')]){if(_0x2470c7[_0x2dc5('0x16')][_0x2dc5('0x17')]===0x1f4){logger[_0x2dc5('0x16')](_0x2dc5('0x12'),_0x2c5cb6,_0x2470c7[_0x2dc5('0x16')]['message']);return _0x557c1e(_0x2470c7[_0x2dc5('0x16')][_0x2dc5('0x18')]);}logger[_0x2dc5('0x16')](_0x2dc5('0x12'),_0x2c5cb6,_0x2470c7[_0x2dc5('0x16')][_0x2dc5('0x18')]);return _0x4f0341(_0x2470c7[_0x2dc5('0x16')]['message']);}else{logger[_0x2dc5('0x11')](_0x2dc5('0x12'),_0x2c5cb6,_0x2dc5('0x13'));_0x4f0341(_0x2470c7[_0x2dc5('0x19')][_0x2dc5('0x18')]);}})[_0x2dc5('0x1a')](function(_0xb02ab0){logger[_0x2dc5('0x16')](_0x2dc5('0x12'),_0x2c5cb6,_0xb02ab0);_0x557c1e(_0xb02ab0);});});}exports['ShowSmsAccount']=function(_0x4c80be){var _0x26a2ca=this;return new Promise(function(_0x6b7e70,_0x2f3bc9){return db[_0x2dc5('0x1b')]['find']({'raw':_0x4c80be[_0x2dc5('0x1c')]?_0x4c80be[_0x2dc5('0x1c')][_0x2dc5('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c80be[_0x2dc5('0x1c')]?_0x4c80be[_0x2dc5('0x1c')]['where']||null:null,'attributes':_0x4c80be[_0x2dc5('0x1c')]?_0x4c80be['options'][_0x2dc5('0x1e')]||null:null,'include':_0x4c80be[_0x2dc5('0x1c')]?_0x4c80be['options'][_0x2dc5('0x1f')]?_[_0x2dc5('0x20')](_0x4c80be['options'][_0x2dc5('0x1f')],function(_0x1a27cc){return{'model':db[_0x1a27cc[_0x2dc5('0x21')]],'as':_0x1a27cc['as'],'attributes':_0x1a27cc[_0x2dc5('0x1e')],'include':_0x1a27cc[_0x2dc5('0x1f')]?_['map'](_0x1a27cc[_0x2dc5('0x1f')],function(_0x56f627){return{'model':db[_0x56f627['model']],'as':_0x56f627['as'],'attributes':_0x56f627[_0x2dc5('0x1e')],'include':_0x56f627[_0x2dc5('0x1f')]?_[_0x2dc5('0x20')](_0x56f627['include'],function(_0x156b07){return{'model':db[_0x156b07[_0x2dc5('0x21')]],'as':_0x156b07['as'],'attributes':_0x156b07[_0x2dc5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2dc5('0x22')](function(_0x16d4cc){logger[_0x2dc5('0x11')](_0x2dc5('0x23'),_0x4c80be);logger[_0x2dc5('0x14')](_0x2dc5('0x23'),_0x4c80be,JSON['stringify'](_0x16d4cc));_0x6b7e70(_0x16d4cc);})[_0x2dc5('0x1a')](function(_0x74d0ca){logger[_0x2dc5('0x16')]('ShowSmsAccount',_0x74d0ca[_0x2dc5('0x18')],_0x4c80be);_0x2f3bc9(_0x26a2ca[_0x2dc5('0x16')](0x1f4,_0x74d0ca[_0x2dc5('0x18')]));});});}; \ No newline at end of file +var _0xf679=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model'];(function(_0x149f20,_0x3ede6e){var _0xc02933=function(_0x32e910){while(--_0x32e910){_0x149f20['push'](_0x149f20['shift']());}};_0xc02933(++_0x3ede6e);}(_0xf679,0x1bd));var _0x9f67=function(_0x523ee1,_0x7d3c57){_0x523ee1=_0x523ee1-0x0;var _0x477691=_0xf679[_0x523ee1];return _0x477691;};'use strict';var _=require(_0x9f67('0x0'));var util=require(_0x9f67('0x1'));var moment=require(_0x9f67('0x2'));var BPromise=require(_0x9f67('0x3'));var rs=require(_0x9f67('0x4'));var fs=require('fs');var Redis=require(_0x9f67('0x5'));var db=require(_0x9f67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f67('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f67('0x8'));var client=jayson[_0x9f67('0x9')][_0x9f67('0xa')]({'port':0x232a});config['redis']=_[_0x9f67('0xb')](config[_0x9f67('0xc')],{'host':_0x9f67('0xd'),'port':0x18eb});var socket=require(_0x9f67('0xe'))(new Redis(config[_0x9f67('0xc')]));require(_0x9f67('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d262f,_0x119781,_0x464c3e){return new BPromise(function(_0x119f19,_0x4b3e45){return client[_0x9f67('0x10')](_0x5d262f,_0x464c3e)[_0x9f67('0x11')](function(_0x1d78d9){logger[_0x9f67('0x12')]('SmsAccount,\x20%s,\x20%s',_0x119781,_0x9f67('0x13'));logger[_0x9f67('0x14')](_0x9f67('0x15'),_0x119781,'request\x20sent',JSON[_0x9f67('0x16')](_0x1d78d9));if(_0x1d78d9[_0x9f67('0x17')]){if(_0x1d78d9[_0x9f67('0x17')]['code']===0x1f4){logger[_0x9f67('0x17')]('SmsAccount,\x20%s,\x20%s',_0x119781,_0x1d78d9[_0x9f67('0x17')][_0x9f67('0x18')]);return _0x4b3e45(_0x1d78d9[_0x9f67('0x17')][_0x9f67('0x18')]);}logger[_0x9f67('0x17')]('SmsAccount,\x20%s,\x20%s',_0x119781,_0x1d78d9[_0x9f67('0x17')][_0x9f67('0x18')]);return _0x119f19(_0x1d78d9[_0x9f67('0x17')][_0x9f67('0x18')]);}else{logger['info'](_0x9f67('0x19'),_0x119781,_0x9f67('0x13'));_0x119f19(_0x1d78d9[_0x9f67('0x1a')]['message']);}})['catch'](function(_0x210edd){logger['error'](_0x9f67('0x19'),_0x119781,_0x210edd);_0x4b3e45(_0x210edd);});});}exports[_0x9f67('0x1b')]=function(_0x4b0a0d){var _0x3d4263=this;return new Promise(function(_0x134aad,_0x292232){return db[_0x9f67('0x1c')]['find']({'raw':_0x4b0a0d[_0x9f67('0x1d')]?_0x4b0a0d[_0x9f67('0x1d')][_0x9f67('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b0a0d[_0x9f67('0x1d')]?_0x4b0a0d[_0x9f67('0x1d')][_0x9f67('0x1f')]||null:null,'attributes':_0x4b0a0d['options']?_0x4b0a0d[_0x9f67('0x1d')][_0x9f67('0x20')]||null:null,'include':_0x4b0a0d['options']?_0x4b0a0d[_0x9f67('0x1d')][_0x9f67('0x21')]?_[_0x9f67('0x22')](_0x4b0a0d['options'][_0x9f67('0x21')],function(_0x4dd1be){return{'model':db[_0x4dd1be['model']],'as':_0x4dd1be['as'],'attributes':_0x4dd1be[_0x9f67('0x20')],'include':_0x4dd1be[_0x9f67('0x21')]?_['map'](_0x4dd1be[_0x9f67('0x21')],function(_0x36c73a){return{'model':db[_0x36c73a[_0x9f67('0x23')]],'as':_0x36c73a['as'],'attributes':_0x36c73a[_0x9f67('0x20')],'include':_0x36c73a[_0x9f67('0x21')]?_['map'](_0x36c73a[_0x9f67('0x21')],function(_0x15785d){return{'model':db[_0x15785d[_0x9f67('0x23')]],'as':_0x15785d['as'],'attributes':_0x15785d[_0x9f67('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9f67('0x11')](function(_0x4f14f9){logger[_0x9f67('0x12')]('ShowSmsAccount',_0x4b0a0d);logger[_0x9f67('0x14')](_0x9f67('0x1b'),_0x4b0a0d,JSON[_0x9f67('0x16')](_0x4f14f9));_0x134aad(_0x4f14f9);})[_0x9f67('0x24')](function(_0x178786){logger['error']('ShowSmsAccount',_0x178786[_0x9f67('0x18')],_0x4b0a0d);_0x292232(_0x3d4263['error'](0x1f4,_0x178786['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9dd73eb..36d5e06 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 _0xaae4=['smsAccount:','./smsAccount.events','save','remove','emit','removeListener','length'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xaae4,0x120));var _0x4aae=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xaae4[_0x4b369d];return _0x571a98;};'use strict';var SmsAccountEvents=require(_0x4aae('0x0'));var events=[_0x4aae('0x1'),_0x4aae('0x2'),'update'];function createListener(_0x1fd6a2,_0x217bd4){return function(_0xbe26c7){_0x217bd4[_0x4aae('0x3')](_0x1fd6a2,_0xbe26c7);};}function removeListener(_0x5b118d,_0x1d3988){return function(){SmsAccountEvents[_0x4aae('0x4')](_0x5b118d,_0x1d3988);};}exports['register']=function(_0xb5135a){for(var _0x32b1fc=0x0,_0x49741d=events[_0x4aae('0x5')];_0x32b1fc<_0x49741d;_0x32b1fc++){var _0x6da68a=events[_0x32b1fc];var _0x1c4b45=createListener(_0x4aae('0x6')+_0x6da68a,_0xb5135a);SmsAccountEvents['on'](_0x6da68a,_0x1c4b45);}}; \ No newline at end of file +var _0xdaed=['save','update','emit','removeListener','register','length','smsAccount:'];(function(_0x5d83f1,_0x27a83e){var _0x5801ac=function(_0x12d0ce){while(--_0x12d0ce){_0x5d83f1['push'](_0x5d83f1['shift']());}};_0x5801ac(++_0x27a83e);}(_0xdaed,0xcb));var _0xddae=function(_0xe9e080,_0x4e33b5){_0xe9e080=_0xe9e080-0x0;var _0x511825=_0xdaed[_0xe9e080];return _0x511825;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xddae('0x0'),'remove',_0xddae('0x1')];function createListener(_0x4dfdef,_0x5f97ef){return function(_0x1e482b){_0x5f97ef[_0xddae('0x2')](_0x4dfdef,_0x1e482b);};}function removeListener(_0x266d11,_0x2d9125){return function(){SmsAccountEvents[_0xddae('0x3')](_0x266d11,_0x2d9125);};}exports[_0xddae('0x4')]=function(_0x53b556){for(var _0x408444=0x0,_0x1bf43b=events[_0xddae('0x5')];_0x408444<_0x1bf43b;_0x408444++){var _0x3c440b=events[_0x408444];var _0x122f20=createListener(_0xddae('0x6')+_0x3c440b,_0x53b556);SmsAccountEvents['on'](_0x3c440b,_0x122f20);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 1bd4925..ede851a 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 _0x2ab4=['/:id','show','post','create','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x2ab4,0x138));var _0x42ab=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x2ab4[_0x35885a];return _0xe86249;};'use strict';var multer=require('multer');var util=require(_0x42ab('0x0'));var path=require(_0x42ab('0x1'));var timeout=require(_0x42ab('0x2'));var express=require(_0x42ab('0x3'));var router=express[_0x42ab('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x42ab('0x5'));var config=require(_0x42ab('0x6'));var controller=require(_0x42ab('0x7'));router[_0x42ab('0x8')]('/',auth[_0x42ab('0x9')](),controller[_0x42ab('0xa')]);router[_0x42ab('0x8')](_0x42ab('0xb'),auth[_0x42ab('0x9')](),controller[_0x42ab('0xc')]);router[_0x42ab('0xd')]('/',auth[_0x42ab('0x9')](),controller[_0x42ab('0xe')]);router['put'](_0x42ab('0xb'),auth[_0x42ab('0x9')](),controller['update']);router['delete'](_0x42ab('0xb'),auth['isAuthenticated'](),controller[_0x42ab('0xf')]);module[_0x42ab('0x10')]=router; \ No newline at end of file +var _0x5ed6=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','get','show','post','put','delete','/:id','destroy','exports','util','path'];(function(_0x49b885,_0x2544df){var _0x555a80=function(_0x4b027e){while(--_0x4b027e){_0x49b885['push'](_0x49b885['shift']());}};_0x555a80(++_0x2544df);}(_0x5ed6,0x64));var _0x65ed=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x5ed6[_0x236d24];return _0x1574cf;};'use strict';var multer=require('multer');var util=require(_0x65ed('0x0'));var path=require(_0x65ed('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65ed('0x2')]();var auth=require(_0x65ed('0x3'));var interaction=require(_0x65ed('0x4'));var config=require(_0x65ed('0x5'));var controller=require(_0x65ed('0x6'));router['get']('/',auth[_0x65ed('0x7')](),controller[_0x65ed('0x8')]);router[_0x65ed('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x65ed('0xa')]);router[_0x65ed('0xb')]('/',auth[_0x65ed('0x7')](),controller['create']);router[_0x65ed('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x65ed('0xd')](_0x65ed('0xe'),auth[_0x65ed('0x7')](),controller[_0x65ed('0xf')]);module[_0x65ed('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8e2863a..910c021 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 _0xcf01=['STRING','sequelize','INTEGER','TEXT'];(function(_0x3ce42a,_0x2b1a5c){var _0x1d5d40=function(_0x1dd6c1){while(--_0x1dd6c1){_0x3ce42a['push'](_0x3ce42a['shift']());}};_0x1d5d40(++_0x2b1a5c);}(_0xcf01,0x141));var _0x1cf0=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0xcf01[_0x1e8bea];return _0x29f756;};'use strict';var Sequelize=require(_0x1cf0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1cf0('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1cf0('0x2')]()},'description':{'type':Sequelize[_0x1cf0('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7c71=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5b3c53,_0x940fd6){var _0x320084=function(_0x217de8){while(--_0x217de8){_0x5b3c53['push'](_0x5b3c53['shift']());}};_0x320084(++_0x940fd6);}(_0x7c71,0xa5));var _0x17c7=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x7c71[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x17c7('0x0'));module[_0x17c7('0x1')]={'priority':{'type':Sequelize[_0x17c7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x17c7('0x3')],'allowNull':![],'defaultValue':_0x17c7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x17c7('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x17c7('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3b11e4e..b564076 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 _0x3a98=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','SmsApplication','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x305444,_0x5c6506){var _0x973d46=function(_0x39f7d2){while(--_0x39f7d2){_0x305444['push'](_0x305444['shift']());}};_0x973d46(++_0x5c6506);}(_0x3a98,0x84));var _0x83a9=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x3a98[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x83a9('0x0'));var emlformat=require(_0x83a9('0x1'));var rimraf=require(_0x83a9('0x2'));var zipdir=require(_0x83a9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x83a9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x83a9('0x5'));var util=require(_0x83a9('0x6'));var path=require(_0x83a9('0x7'));var sox=require('sox');var csv=require(_0x83a9('0x8'));var ejs=require(_0x83a9('0x9'));var fs=require('fs');var _=require(_0x83a9('0xa'));var squel=require(_0x83a9('0xb'));var crypto=require(_0x83a9('0xc'));var jsforce=require(_0x83a9('0xd'));var deskjs=require(_0x83a9('0xe'));var toCsv=require(_0x83a9('0x8'));var querystring=require(_0x83a9('0xf'));var Papa=require('papaparse');var Redis=require(_0x83a9('0x10'));var authService=require(_0x83a9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x83a9('0x12'));var hardwareService=require(_0x83a9('0x13'));var logger=require(_0x83a9('0x14'))(_0x83a9('0x15'));var utils=require(_0x83a9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x83a9('0x17'));var db=require(_0x83a9('0x18'))['db'];function respondWithStatusCode(_0x26ffa0,_0xec6d12){_0xec6d12=_0xec6d12||0xcc;return function(_0x4898cf){if(_0x4898cf){return _0x26ffa0['sendStatus'](_0xec6d12);}return _0x26ffa0[_0x83a9('0x19')](_0xec6d12)[_0x83a9('0x1a')]();};}function respondWithResult(_0x43d6ce,_0x57e812){_0x57e812=_0x57e812||0xc8;return function(_0x3a3234){if(_0x3a3234){return _0x43d6ce[_0x83a9('0x19')](_0x57e812)[_0x83a9('0x1b')](_0x3a3234);}};}function respondWithFilteredResult(_0xf7870,_0x5f45f1){return function(_0x192071){if(_0x192071){var _0x1c9361=_0x192071[_0x83a9('0x1c')],_0x3a7ef6=_0x5f45f1[_0x83a9('0x1d')],_0x50da15=_0x5f45f1['offset']+_0x5f45f1[_0x83a9('0x1e')],_0x608dc9;if(_0x50da15>=_0x1c9361){_0x50da15=_0x1c9361;_0x608dc9=0xc8;}else{_0x608dc9=0xce;}_0xf7870[_0x83a9('0x19')](_0x608dc9);return _0xf7870[_0x83a9('0x1f')](_0x83a9('0x20'),_0x3a7ef6+'-'+_0x50da15+'/'+_0x1c9361)[_0x83a9('0x1b')](_0x192071);}return null;};}function patchUpdates(_0x44a4ee){return function(_0x59dc31){try{jsonpatch['apply'](_0x59dc31,_0x44a4ee,!![]);}catch(_0x323157){return BPromise[_0x83a9('0x21')](_0x323157);}return _0x59dc31[_0x83a9('0x22')]();};}function saveUpdates(_0x5a276f,_0x2414e2){return function(_0x481f06){if(_0x481f06){return _0x481f06['update'](_0x5a276f)[_0x83a9('0x23')](function(_0x3a161e){return _0x3a161e;});}return null;};}function removeEntity(_0x317a2d,_0x205b9f){return function(_0x4276e6){if(_0x4276e6){return _0x4276e6[_0x83a9('0x24')]()[_0x83a9('0x23')](function(){_0x317a2d[_0x83a9('0x19')](0xcc)[_0x83a9('0x1a')]();});}};}function handleEntityNotFound(_0x1a0366,_0x549fd5){return function(_0x223d37){if(!_0x223d37){_0x1a0366[_0x83a9('0x25')](0x194);}return _0x223d37;};}function handleError(_0x16bde9,_0xeb239c){_0xeb239c=_0xeb239c||0x1f4;return function(_0x1a680d){logger[_0x83a9('0x26')](_0x1a680d[_0x83a9('0x27')]);if(_0x1a680d['name']){delete _0x1a680d[_0x83a9('0x28')];}_0x16bde9[_0x83a9('0x19')](_0xeb239c)[_0x83a9('0x29')](_0x1a680d);};}exports[_0x83a9('0x2a')]=function(_0x2e4783,_0x3bc988){var _0x242876={},_0x45c77c={},_0x6a67ee={'count':0x0,'rows':[]};var _0x290202=_['map'](db[_0x83a9('0x2b')]['rawAttributes'],function(_0x11aa69){return{'name':_0x11aa69['fieldName'],'type':_0x11aa69[_0x83a9('0x2c')][_0x83a9('0x2d')]};});_0x45c77c[_0x83a9('0x2e')]=_[_0x83a9('0x2f')](_0x290202,'name');_0x45c77c[_0x83a9('0x30')]=_[_0x83a9('0x31')](_0x2e4783['query']);_0x45c77c[_0x83a9('0x32')]=_[_0x83a9('0x33')](_0x45c77c[_0x83a9('0x2e')],_0x45c77c[_0x83a9('0x30')]);_0x242876[_0x83a9('0x34')]=_[_0x83a9('0x33')](_0x45c77c[_0x83a9('0x2e')],qs[_0x83a9('0x35')](_0x2e4783[_0x83a9('0x30')][_0x83a9('0x35')]));_0x242876['attributes']=_0x242876[_0x83a9('0x34')][_0x83a9('0x36')]?_0x242876['attributes']:_0x45c77c[_0x83a9('0x2e')];if(!_0x2e4783[_0x83a9('0x30')][_0x83a9('0x37')](_0x83a9('0x38'))){_0x242876[_0x83a9('0x1e')]=qs[_0x83a9('0x1e')](_0x2e4783[_0x83a9('0x30')][_0x83a9('0x1e')]);_0x242876['offset']=qs[_0x83a9('0x1d')](_0x2e4783[_0x83a9('0x30')][_0x83a9('0x1d')]);}_0x242876['order']=qs[_0x83a9('0x39')](_0x2e4783[_0x83a9('0x30')]['sort']);_0x242876[_0x83a9('0x3a')]=qs[_0x83a9('0x32')](_[_0x83a9('0x3b')](_0x2e4783['query'],_0x45c77c[_0x83a9('0x32')]),_0x290202);if(_0x2e4783['query'][_0x83a9('0x3c')]){_0x242876['where']=_['merge'](_0x242876['where'],{'$or':_[_0x83a9('0x2f')](_0x290202,function(_0x42f60f){if(_0x42f60f[_0x83a9('0x2c')]!=='VIRTUAL'){var _0x141b7f={};_0x141b7f[_0x42f60f['name']]={'$like':'%'+_0x2e4783[_0x83a9('0x30')][_0x83a9('0x3c')]+'%'};return _0x141b7f;}})});}_0x242876=_[_0x83a9('0x3d')]({},_0x242876,_0x2e4783['options']);var _0x17a3a8={'where':_0x242876[_0x83a9('0x3a')]};return db[_0x83a9('0x2b')][_0x83a9('0x1c')](_0x17a3a8)[_0x83a9('0x23')](function(_0x19097a){_0x6a67ee[_0x83a9('0x1c')]=_0x19097a;if(_0x2e4783[_0x83a9('0x30')][_0x83a9('0x3e')]){_0x242876[_0x83a9('0x3f')]=[{'all':!![]}];}return db[_0x83a9('0x2b')][_0x83a9('0x40')](_0x242876);})[_0x83a9('0x23')](function(_0x4f31a1){_0x6a67ee[_0x83a9('0x41')]=_0x4f31a1;return _0x6a67ee;})[_0x83a9('0x23')](respondWithFilteredResult(_0x3bc988,_0x242876))[_0x83a9('0x42')](handleError(_0x3bc988,null));};exports[_0x83a9('0x43')]=function(_0xb84b6f,_0x3e3c86){var _0x39fdf8={'raw':!![],'where':{'id':_0xb84b6f['params']['id']}},_0x58e276={};_0x58e276[_0x83a9('0x2e')]=_[_0x83a9('0x31')](db[_0x83a9('0x2b')][_0x83a9('0x44')]);_0x58e276['query']=_[_0x83a9('0x31')](_0xb84b6f[_0x83a9('0x30')]);_0x58e276[_0x83a9('0x32')]=_['intersection'](_0x58e276[_0x83a9('0x2e')],_0x58e276[_0x83a9('0x30')]);_0x39fdf8[_0x83a9('0x34')]=_[_0x83a9('0x33')](_0x58e276[_0x83a9('0x2e')],qs['fields'](_0xb84b6f[_0x83a9('0x30')]['fields']));_0x39fdf8[_0x83a9('0x34')]=_0x39fdf8[_0x83a9('0x34')][_0x83a9('0x36')]?_0x39fdf8[_0x83a9('0x34')]:_0x58e276[_0x83a9('0x2e')];if(_0xb84b6f[_0x83a9('0x30')][_0x83a9('0x3e')]){_0x39fdf8[_0x83a9('0x3f')]=[{'all':!![]}];}_0x39fdf8=_[_0x83a9('0x3d')]({},_0x39fdf8,_0xb84b6f[_0x83a9('0x45')]);return db['SmsApplication'][_0x83a9('0x46')](_0x39fdf8)[_0x83a9('0x23')](handleEntityNotFound(_0x3e3c86,null))[_0x83a9('0x23')](respondWithResult(_0x3e3c86,null))[_0x83a9('0x42')](handleError(_0x3e3c86,null));};exports['create']=function(_0x44cfd4,_0x40454d){return db[_0x83a9('0x2b')][_0x83a9('0x47')](_0x44cfd4[_0x83a9('0x48')],{})['then'](respondWithResult(_0x40454d,0xc9))['catch'](handleError(_0x40454d,null));};exports[_0x83a9('0x49')]=function(_0x57e8cd,_0x53ac0c){if(_0x57e8cd[_0x83a9('0x48')]['id']){delete _0x57e8cd['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x57e8cd['params']['id']}})[_0x83a9('0x23')](handleEntityNotFound(_0x53ac0c,null))[_0x83a9('0x23')](saveUpdates(_0x57e8cd[_0x83a9('0x48')],null))[_0x83a9('0x23')](respondWithResult(_0x53ac0c,null))[_0x83a9('0x42')](handleError(_0x53ac0c,null));};exports[_0x83a9('0x24')]=function(_0x1884e6,_0x2255eb){return db['SmsApplication'][_0x83a9('0x46')]({'where':{'id':_0x1884e6[_0x83a9('0x4a')]['id']}})[_0x83a9('0x23')](handleEntityNotFound(_0x2255eb,null))[_0x83a9('0x23')](removeEntity(_0x2255eb,null))['catch'](handleError(_0x2255eb,null));}; \ No newline at end of file +var _0xef7c=['../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','name','send','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3f965b,_0x24cb2d){var _0x12061d=function(_0x325e06){while(--_0x325e06){_0x3f965b['push'](_0x3f965b['shift']());}};_0x12061d(++_0x24cb2d);}(_0xef7c,0x19a));var _0xcef7=function(_0x525188,_0x3716e2){_0x525188=_0x525188-0x0;var _0xb4d67d=_0xef7c[_0x525188];return _0xb4d67d;};'use strict';var pdf=require(_0xcef7('0x0'));var emlformat=require(_0xcef7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcef7('0x2'));var rp=require('request-promise');var moment=require(_0xcef7('0x3'));var BPromise=require(_0xcef7('0x4'));var Mustache=require(_0xcef7('0x5'));var util=require(_0xcef7('0x6'));var path=require(_0xcef7('0x7'));var sox=require(_0xcef7('0x8'));var csv=require(_0xcef7('0x9'));var ejs=require(_0xcef7('0xa'));var fs=require('fs');var _=require(_0xcef7('0xb'));var squel=require('squel');var crypto=require(_0xcef7('0xc'));var jsforce=require(_0xcef7('0xd'));var deskjs=require(_0xcef7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcef7('0xf'));var Papa=require(_0xcef7('0x10'));var Redis=require(_0xcef7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcef7('0x12'));var hardwareService=require(_0xcef7('0x13'));var logger=require(_0xcef7('0x14'))('api');var utils=require(_0xcef7('0x15'));var config=require(_0xcef7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcef7('0x17'))['db'];function respondWithStatusCode(_0x32217d,_0x33f7b4){_0x33f7b4=_0x33f7b4||0xcc;return function(_0x2ece1a){if(_0x2ece1a){return _0x32217d['sendStatus'](_0x33f7b4);}return _0x32217d[_0xcef7('0x18')](_0x33f7b4)[_0xcef7('0x19')]();};}function respondWithResult(_0x466835,_0x271769){_0x271769=_0x271769||0xc8;return function(_0x55f5c8){if(_0x55f5c8){return _0x466835['status'](_0x271769)['json'](_0x55f5c8);}};}function respondWithFilteredResult(_0x4982c3,_0x27be27){return function(_0x2c5227){if(_0x2c5227){var _0x5b2103=_0x2c5227[_0xcef7('0x1a')],_0x2e0c04=_0x27be27[_0xcef7('0x1b')],_0x586739=_0x27be27['offset']+_0x27be27[_0xcef7('0x1c')],_0x3b77bf;if(_0x586739>=_0x5b2103){_0x586739=_0x5b2103;_0x3b77bf=0xc8;}else{_0x3b77bf=0xce;}_0x4982c3[_0xcef7('0x18')](_0x3b77bf);return _0x4982c3[_0xcef7('0x1d')](_0xcef7('0x1e'),_0x2e0c04+'-'+_0x586739+'/'+_0x5b2103)[_0xcef7('0x1f')](_0x2c5227);}return null;};}function patchUpdates(_0x40012f){return function(_0x2a7a10){try{jsonpatch[_0xcef7('0x20')](_0x2a7a10,_0x40012f,!![]);}catch(_0x377b7b){return BPromise['reject'](_0x377b7b);}return _0x2a7a10['save']();};}function saveUpdates(_0x568194,_0x45d7e2){return function(_0x5671e4){if(_0x5671e4){return _0x5671e4[_0xcef7('0x21')](_0x568194)[_0xcef7('0x22')](function(_0x115b05){return _0x115b05;});}return null;};}function removeEntity(_0x901ba8,_0x388c21){return function(_0x3b8bdc){if(_0x3b8bdc){return _0x3b8bdc[_0xcef7('0x23')]()[_0xcef7('0x22')](function(){_0x901ba8[_0xcef7('0x18')](0xcc)[_0xcef7('0x19')]();});}};}function handleEntityNotFound(_0x535dcf,_0x10bce8){return function(_0x5eeb4b){if(!_0x5eeb4b){_0x535dcf[_0xcef7('0x24')](0x194);}return _0x5eeb4b;};}function handleError(_0x302906,_0x5ecc48){_0x5ecc48=_0x5ecc48||0x1f4;return function(_0x381541){logger[_0xcef7('0x25')](_0x381541[_0xcef7('0x26')]);if(_0x381541[_0xcef7('0x27')]){delete _0x381541[_0xcef7('0x27')];}_0x302906['status'](_0x5ecc48)[_0xcef7('0x28')](_0x381541);};}exports['index']=function(_0x44fb41,_0x5b7768){var _0x345fa3={},_0x5951dd={},_0x572e8e={'count':0x0,'rows':[]};var _0x57b38f=_['map'](db[_0xcef7('0x29')][_0xcef7('0x2a')],function(_0x37e307){return{'name':_0x37e307[_0xcef7('0x2b')],'type':_0x37e307[_0xcef7('0x2c')][_0xcef7('0x2d')]};});_0x5951dd[_0xcef7('0x2e')]=_['map'](_0x57b38f,_0xcef7('0x27'));_0x5951dd[_0xcef7('0x2f')]=_[_0xcef7('0x30')](_0x44fb41[_0xcef7('0x2f')]);_0x5951dd[_0xcef7('0x31')]=_['intersection'](_0x5951dd['model'],_0x5951dd[_0xcef7('0x2f')]);_0x345fa3[_0xcef7('0x32')]=_['intersection'](_0x5951dd[_0xcef7('0x2e')],qs['fields'](_0x44fb41['query'][_0xcef7('0x33')]));_0x345fa3[_0xcef7('0x32')]=_0x345fa3['attributes'][_0xcef7('0x34')]?_0x345fa3['attributes']:_0x5951dd[_0xcef7('0x2e')];if(!_0x44fb41[_0xcef7('0x2f')][_0xcef7('0x35')](_0xcef7('0x36'))){_0x345fa3[_0xcef7('0x1c')]=qs['limit'](_0x44fb41[_0xcef7('0x2f')][_0xcef7('0x1c')]);_0x345fa3[_0xcef7('0x1b')]=qs[_0xcef7('0x1b')](_0x44fb41[_0xcef7('0x2f')]['offset']);}_0x345fa3[_0xcef7('0x37')]=qs['sort'](_0x44fb41[_0xcef7('0x2f')][_0xcef7('0x38')]);_0x345fa3[_0xcef7('0x39')]=qs[_0xcef7('0x31')](_['pick'](_0x44fb41[_0xcef7('0x2f')],_0x5951dd[_0xcef7('0x31')]),_0x57b38f);if(_0x44fb41[_0xcef7('0x2f')][_0xcef7('0x3a')]){_0x345fa3[_0xcef7('0x39')]=_['merge'](_0x345fa3[_0xcef7('0x39')],{'$or':_[_0xcef7('0x3b')](_0x57b38f,function(_0x5d89b1){if(_0x5d89b1[_0xcef7('0x2c')]!=='VIRTUAL'){var _0x26f6ac={};_0x26f6ac[_0x5d89b1[_0xcef7('0x27')]]={'$like':'%'+_0x44fb41[_0xcef7('0x2f')][_0xcef7('0x3a')]+'%'};return _0x26f6ac;}})});}_0x345fa3=_[_0xcef7('0x3c')]({},_0x345fa3,_0x44fb41[_0xcef7('0x3d')]);var _0x308cc9={'where':_0x345fa3[_0xcef7('0x39')]};return db[_0xcef7('0x29')][_0xcef7('0x1a')](_0x308cc9)['then'](function(_0x34c7ad){_0x572e8e[_0xcef7('0x1a')]=_0x34c7ad;if(_0x44fb41[_0xcef7('0x2f')][_0xcef7('0x3e')]){_0x345fa3[_0xcef7('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xcef7('0x40')](_0x345fa3);})['then'](function(_0x182784){_0x572e8e[_0xcef7('0x41')]=_0x182784;return _0x572e8e;})[_0xcef7('0x22')](respondWithFilteredResult(_0x5b7768,_0x345fa3))[_0xcef7('0x42')](handleError(_0x5b7768,null));};exports['show']=function(_0x3b07be,_0x30c57e){var _0x297aa1={'raw':!![],'where':{'id':_0x3b07be[_0xcef7('0x43')]['id']}},_0x38f325={};_0x38f325[_0xcef7('0x2e')]=_[_0xcef7('0x30')](db[_0xcef7('0x29')][_0xcef7('0x2a')]);_0x38f325[_0xcef7('0x2f')]=_[_0xcef7('0x30')](_0x3b07be[_0xcef7('0x2f')]);_0x38f325['filters']=_[_0xcef7('0x44')](_0x38f325['model'],_0x38f325[_0xcef7('0x2f')]);_0x297aa1[_0xcef7('0x32')]=_[_0xcef7('0x44')](_0x38f325[_0xcef7('0x2e')],qs[_0xcef7('0x33')](_0x3b07be[_0xcef7('0x2f')]['fields']));_0x297aa1['attributes']=_0x297aa1['attributes'][_0xcef7('0x34')]?_0x297aa1['attributes']:_0x38f325[_0xcef7('0x2e')];if(_0x3b07be[_0xcef7('0x2f')][_0xcef7('0x3e')]){_0x297aa1[_0xcef7('0x3f')]=[{'all':!![]}];}_0x297aa1=_[_0xcef7('0x3c')]({},_0x297aa1,_0x3b07be['options']);return db[_0xcef7('0x29')][_0xcef7('0x45')](_0x297aa1)[_0xcef7('0x22')](handleEntityNotFound(_0x30c57e,null))[_0xcef7('0x22')](respondWithResult(_0x30c57e,null))[_0xcef7('0x42')](handleError(_0x30c57e,null));};exports['create']=function(_0x7ff28b,_0x15b97e){return db[_0xcef7('0x29')][_0xcef7('0x46')](_0x7ff28b[_0xcef7('0x47')],{})['then'](respondWithResult(_0x15b97e,0xc9))[_0xcef7('0x42')](handleError(_0x15b97e,null));};exports[_0xcef7('0x21')]=function(_0x5e53ed,_0x18528d){if(_0x5e53ed[_0xcef7('0x47')]['id']){delete _0x5e53ed[_0xcef7('0x47')]['id'];}return db[_0xcef7('0x29')][_0xcef7('0x45')]({'where':{'id':_0x5e53ed[_0xcef7('0x43')]['id']}})[_0xcef7('0x22')](handleEntityNotFound(_0x18528d,null))[_0xcef7('0x22')](saveUpdates(_0x5e53ed['body'],null))[_0xcef7('0x22')](respondWithResult(_0x18528d,null))[_0xcef7('0x42')](handleError(_0x18528d,null));};exports[_0xcef7('0x23')]=function(_0x232a5a,_0x39cb8d){return db['SmsApplication']['find']({'where':{'id':_0x232a5a[_0xcef7('0x43')]['id']}})[_0xcef7('0x22')](handleEntityNotFound(_0x39cb8d,null))[_0xcef7('0x22')](removeEntity(_0x39cb8d,null))[_0xcef7('0x42')](handleError(_0x39cb8d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f3b1dbc..f13480c 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 _0x8c3b=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','../../config/environment','exports','define','SmsApplication'];(function(_0x2c7ed9,_0xdde02c){var _0x1ec1c7=function(_0x52b286){while(--_0x52b286){_0x2c7ed9['push'](_0x2c7ed9['shift']());}};_0x1ec1c7(++_0xdde02c);}(_0x8c3b,0x192));var _0xb8c3=function(_0x3e71ea,_0x5e53c0){_0x3e71ea=_0x3e71ea-0x0;var _0x4650b8=_0x8c3b[_0x3e71ea];return _0x4650b8;};'use strict';var _=require(_0xb8c3('0x0'));var util=require('util');var logger=require(_0xb8c3('0x1'))(_0xb8c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb8c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb8c3('0x4'));var attributes=require('./smsApplication.attributes');module[_0xb8c3('0x5')]=function(_0x8ae0be,_0x1a39f2){return _0x8ae0be[_0xb8c3('0x6')](_0xb8c3('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb8c3('0x8'),'collate':_0xb8c3('0x9')});}; \ No newline at end of file +var _0x85d1=['bluebird','rimraf','../../config/environment','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x139238,_0x49eea4){var _0xacb66d=function(_0x59a59a){while(--_0x59a59a){_0x139238['push'](_0x139238['shift']());}};_0xacb66d(++_0x49eea4);}(_0x85d1,0xf9));var _0x185d=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0x85d1[_0x16eb11];return _0x3ae7ef;};'use strict';var _=require(_0x185d('0x0'));var util=require('util');var logger=require(_0x185d('0x1'))(_0x185d('0x2'));var moment=require(_0x185d('0x3'));var BPromise=require(_0x185d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x185d('0x5'));var config=require(_0x185d('0x6'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x2c2c87,_0x51007c){return _0x2c2c87[_0x185d('0x7')]('SmsApplication',attributes,{'tableName':_0x185d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x185d('0x9'),'collate':_0x185d('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 95ffa2a..bc25050 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 _0xbfe8=['stringify','error','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x584985,_0x31a01f){var _0x123c16=function(_0x54ae33){while(--_0x54ae33){_0x584985['push'](_0x584985['shift']());}};_0x123c16(++_0x31a01f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x580d3a,_0x529919){_0x580d3a=_0x580d3a-0x0;var _0x2484d8=_0xbfe8[_0x580d3a];return _0x2484d8;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var moment=require('moment');var BPromise=require(_0x8bfe('0x1'));var rs=require(_0x8bfe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8bfe('0x3'));var logger=require(_0x8bfe('0x4'))('rpc');var config=require(_0x8bfe('0x5'));var jayson=require(_0x8bfe('0x6'));var client=jayson[_0x8bfe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29bb94,_0x1b7dbd,_0x3e3075){return new BPromise(function(_0x4602fc,_0x5d4e54){return client[_0x8bfe('0x8')](_0x29bb94,_0x3e3075)[_0x8bfe('0x9')](function(_0x147c65){logger[_0x8bfe('0xa')](_0x8bfe('0xb'),_0x1b7dbd,_0x8bfe('0xc'));logger[_0x8bfe('0xd')](_0x8bfe('0xe'),_0x1b7dbd,_0x8bfe('0xc'),JSON[_0x8bfe('0xf')](_0x147c65));if(_0x147c65['error']){if(_0x147c65[_0x8bfe('0x10')]['code']===0x1f4){logger[_0x8bfe('0x10')](_0x8bfe('0xb'),_0x1b7dbd,_0x147c65[_0x8bfe('0x10')]['message']);return _0x5d4e54(_0x147c65['error'][_0x8bfe('0x11')]);}logger[_0x8bfe('0x10')](_0x8bfe('0xb'),_0x1b7dbd,_0x147c65[_0x8bfe('0x10')][_0x8bfe('0x11')]);return _0x4602fc(_0x147c65['error'][_0x8bfe('0x11')]);}else{logger[_0x8bfe('0xa')]('SmsApplication,\x20%s,\x20%s',_0x1b7dbd,_0x8bfe('0xc'));_0x4602fc(_0x147c65[_0x8bfe('0x12')][_0x8bfe('0x11')]);}})['catch'](function(_0x4efb72){logger[_0x8bfe('0x10')]('SmsApplication,\x20%s,\x20%s',_0x1b7dbd,_0x4efb72);_0x5d4e54(_0x4efb72);});});} \ No newline at end of file +var _0x535d=['then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3386a3,_0x2132f6){var _0x14697b=function(_0x523ade){while(--_0x523ade){_0x3386a3['push'](_0x3386a3['shift']());}};_0x14697b(++_0x2132f6);}(_0x535d,0xe8));var _0xd535=function(_0x4b3661,_0x1be781){_0x4b3661=_0x4b3661-0x0;var _0x582d0c=_0x535d[_0x4b3661];return _0x582d0c;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var moment=require('moment');var BPromise=require(_0xd535('0x2'));var rs=require(_0xd535('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd535('0x4'));var logger=require(_0xd535('0x5'))(_0xd535('0x6'));var config=require(_0xd535('0x7'));var jayson=require(_0xd535('0x8'));var client=jayson[_0xd535('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52cbc5,_0x44e2bb,_0x20b2ae){return new BPromise(function(_0x4fba4f,_0x1c092f){return client['request'](_0x52cbc5,_0x20b2ae)[_0xd535('0xa')](function(_0x156eea){logger[_0xd535('0xb')](_0xd535('0xc'),_0x44e2bb,'request\x20sent');logger[_0xd535('0xd')](_0xd535('0xe'),_0x44e2bb,_0xd535('0xf'),JSON[_0xd535('0x10')](_0x156eea));if(_0x156eea['error']){if(_0x156eea[_0xd535('0x11')][_0xd535('0x12')]===0x1f4){logger[_0xd535('0x11')](_0xd535('0xc'),_0x44e2bb,_0x156eea[_0xd535('0x11')][_0xd535('0x13')]);return _0x1c092f(_0x156eea[_0xd535('0x11')]['message']);}logger[_0xd535('0x11')]('SmsApplication,\x20%s,\x20%s',_0x44e2bb,_0x156eea['error'][_0xd535('0x13')]);return _0x4fba4f(_0x156eea[_0xd535('0x11')]['message']);}else{logger[_0xd535('0xb')](_0xd535('0xc'),_0x44e2bb,_0xd535('0xf'));_0x4fba4f(_0x156eea[_0xd535('0x14')]['message']);}})[_0xd535('0x15')](function(_0x2b0f32){logger[_0xd535('0x11')](_0xd535('0xc'),_0x44e2bb,_0x2b0f32);_0x1c092f(_0x2b0f32);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d8f9f62..621c03d 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 _0x3392=['delete','removeTags','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy'];(function(_0x5c0031,_0xa00414){var _0x234978=function(_0x5704f4){while(--_0x5704f4){_0x5c0031['push'](_0x5c0031['shift']());}};_0x234978(++_0xa00414);}(_0x3392,0xcf));var _0x2339=function(_0x4c9c33,_0x4daedf){_0x4c9c33=_0x4c9c33-0x0;var _0x4cf268=_0x3392[_0x4c9c33];return _0x4cf268;};'use strict';var multer=require(_0x2339('0x0'));var util=require(_0x2339('0x1'));var path=require(_0x2339('0x2'));var timeout=require('connect-timeout');var express=require(_0x2339('0x3'));var router=express['Router']();var auth=require(_0x2339('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2339('0x5'));var controller=require(_0x2339('0x6'));router[_0x2339('0x7')]('/',auth[_0x2339('0x8')](),controller[_0x2339('0x9')]);router['get'](_0x2339('0xa'),auth['isAuthenticated'](),controller[_0x2339('0xb')]);router[_0x2339('0x7')](_0x2339('0xc'),auth[_0x2339('0x8')](),controller[_0x2339('0xd')]);router[_0x2339('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2339('0xe')]);router['get'](_0x2339('0xf'),auth['isAuthenticated'](),controller[_0x2339('0x10')]);router[_0x2339('0x11')]('/',auth[_0x2339('0x8')](),controller[_0x2339('0x12')]);router[_0x2339('0x11')](_0x2339('0x13'),auth[_0x2339('0x8')](),controller[_0x2339('0x14')]);router['post'](_0x2339('0x15'),auth[_0x2339('0x8')](),interaction[_0x2339('0x16')](_0x2339('0x17'),_0x2339('0x18')),controller[_0x2339('0x19')]);router[_0x2339('0x1a')](_0x2339('0xc'),auth['isAuthenticated'](),interaction[_0x2339('0x16')]('sms',_0x2339('0x1b')),controller[_0x2339('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2339('0x17'),_0x2339('0x1d')),controller[_0x2339('0x1e')]);router[_0x2339('0x1f')](_0x2339('0x15'),auth[_0x2339('0x8')](),controller[_0x2339('0x20')]);module[_0x2339('0x21')]=router; \ No newline at end of file +var _0x94da=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','/:id/tags','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94da,0x1b2));var _0xa94d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x94da[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xa94d('0x0'));var util=require(_0xa94d('0x1'));var path=require(_0xa94d('0x2'));var timeout=require('connect-timeout');var express=require(_0xa94d('0x3'));var router=express[_0xa94d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa94d('0x5'));var config=require(_0xa94d('0x6'));var controller=require(_0xa94d('0x7'));router[_0xa94d('0x8')]('/',auth[_0xa94d('0x9')](),controller[_0xa94d('0xa')]);router[_0xa94d('0x8')](_0xa94d('0xb'),auth[_0xa94d('0x9')](),controller['describe']);router[_0xa94d('0x8')](_0xa94d('0xc'),auth[_0xa94d('0x9')](),controller[_0xa94d('0xd')]);router[_0xa94d('0x8')](_0xa94d('0xe'),auth[_0xa94d('0x9')](),controller[_0xa94d('0xf')]);router['get'](_0xa94d('0x10'),auth[_0xa94d('0x9')](),controller[_0xa94d('0x11')]);router[_0xa94d('0x12')]('/',auth[_0xa94d('0x9')](),controller[_0xa94d('0x13')]);router[_0xa94d('0x12')](_0xa94d('0xe'),auth[_0xa94d('0x9')](),controller[_0xa94d('0x14')]);router[_0xa94d('0x12')]('/:id/tags',auth[_0xa94d('0x9')](),interaction[_0xa94d('0x15')](_0xa94d('0x16'),_0xa94d('0x17')),controller[_0xa94d('0x18')]);router[_0xa94d('0x19')]('/:id',auth[_0xa94d('0x9')](),interaction[_0xa94d('0x15')](_0xa94d('0x16'),_0xa94d('0x1a')),controller[_0xa94d('0x1b')]);router['delete']('/:id',auth[_0xa94d('0x9')](),interaction['tracked']('sms',_0xa94d('0x1c')),controller['destroy']);router['delete'](_0xa94d('0x1d'),auth['isAuthenticated'](),controller['removeTags']);module[_0xa94d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5bd50b0..87c9d94 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 _0xafdc=['exports','DATE','STRING','ENUM','out','moment'];(function(_0x4511c4,_0x2da7ae){var _0x4cdc75=function(_0x3a5118){while(--_0x3a5118){_0x4511c4['push'](_0x4511c4['shift']());}};_0x4cdc75(++_0x2da7ae);}(_0xafdc,0x161));var _0xcafd=function(_0x5342e9,_0x32d024){_0x5342e9=_0x5342e9-0x0;var _0x330fa0=_0xafdc[_0x5342e9];return _0x330fa0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcafd('0x0'));module[_0xcafd('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcafd('0x2')]},'disposition':{'type':Sequelize[_0xcafd('0x3')]},'secondDisposition':{'type':Sequelize[_0xcafd('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xcafd('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xcafd('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcafd('0x4')]('in',_0xcafd('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcafd('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcafd('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe0c9=['DATE','STRING','ENUM','out','moment','exports'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xe0c9,0x136));var _0x9e0c=function(_0x50f1b4,_0x408367){_0x50f1b4=_0x50f1b4-0x0;var _0x2885cc=_0xe0c9[_0x50f1b4];return _0x2885cc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9e0c('0x0'));module[_0x9e0c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9e0c('0x2')]},'disposition':{'type':Sequelize[_0x9e0c('0x3')]},'secondDisposition':{'type':Sequelize[_0x9e0c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9e0c('0x3')]},'note':{'type':Sequelize[_0x9e0c('0x3')]},'phone':{'type':Sequelize[_0x9e0c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9e0c('0x4')]('in',_0x9e0c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9e0c('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9e0c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0587eb5..b19cff3 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 _0xfbd2=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','stack','name','send','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','start','keys','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','keyBy','merge','unreadMessages','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','all','rows','show','params','include','options','create','update','describe','SmsMessage','ids','getMessages','findOne','hasOwnProperty','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','smsInteractionTags:save','removeTags','download','join','root','files','tmp','fullname','CmContact','lastName','direction','secret','SmsAccount','Account','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','YYYY-MM-DD','Sms','Owner','N.A.','closedAt','Messages','System','firstName','renderFile','server','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x57b4d3,_0x4a8072){var _0x5aa3e1=function(_0x175a43){while(--_0x175a43){_0x57b4d3['push'](_0x57b4d3['shift']());}};_0x5aa3e1(++_0x4a8072);}(_0xfbd2,0xc9));var _0x2fbd=function(_0x10fb6f,_0x2fc8b4){_0x10fb6f=_0x10fb6f-0x0;var _0x5cbf76=_0xfbd2[_0x10fb6f];return _0x5cbf76;};'use strict';var pdf=require(_0x2fbd('0x0'));var emlformat=require(_0x2fbd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2fbd('0x2'));var jsonpatch=require(_0x2fbd('0x3'));var rp=require(_0x2fbd('0x4'));var moment=require('moment');var BPromise=require(_0x2fbd('0x5'));var Mustache=require('mustache');var util=require(_0x2fbd('0x6'));var path=require(_0x2fbd('0x7'));var sox=require(_0x2fbd('0x8'));var csv=require(_0x2fbd('0x9'));var ejs=require(_0x2fbd('0xa'));var fs=require('fs');var _=require(_0x2fbd('0xb'));var squel=require(_0x2fbd('0xc'));var crypto=require(_0x2fbd('0xd'));var jsforce=require(_0x2fbd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2fbd('0x9'));var querystring=require(_0x2fbd('0xf'));var Papa=require('papaparse');var Redis=require(_0x2fbd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fbd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fbd('0x12'))(_0x2fbd('0x13'));var utils=require(_0x2fbd('0x14'));var config=require(_0x2fbd('0x15'));var licenseUtil=require(_0x2fbd('0x16'));var db=require(_0x2fbd('0x17'))['db'];config[_0x2fbd('0x18')]=_[_0x2fbd('0x19')](config[_0x2fbd('0x18')],{'host':_0x2fbd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2fbd('0x1b'))['register'](socket);function respondWithStatusCode(_0x247e47,_0x59a7ad){_0x59a7ad=_0x59a7ad||0xcc;return function(_0x36e161){if(_0x36e161){return _0x247e47[_0x2fbd('0x1c')](_0x59a7ad);}return _0x247e47[_0x2fbd('0x1d')](_0x59a7ad)[_0x2fbd('0x1e')]();};}function respondWithResult(_0x1f7500,_0x4bbf0c){_0x4bbf0c=_0x4bbf0c||0xc8;return function(_0x27b8d3){if(_0x27b8d3){return _0x1f7500[_0x2fbd('0x1d')](_0x4bbf0c)[_0x2fbd('0x1f')](_0x27b8d3);}};}function respondWithFilteredResult(_0x573ef2,_0x378011){return function(_0x579b30){if(_0x579b30){var _0x47b8a9=_0x579b30[_0x2fbd('0x20')],_0x1e4888=_0x378011[_0x2fbd('0x21')],_0x1961fc=_0x378011[_0x2fbd('0x21')]+_0x378011[_0x2fbd('0x22')],_0x3dea56;if(_0x1961fc>=_0x47b8a9){_0x1961fc=_0x47b8a9;_0x3dea56=0xc8;}else{_0x3dea56=0xce;}_0x573ef2[_0x2fbd('0x1d')](_0x3dea56);return _0x573ef2['set']('Content-Range',_0x1e4888+'-'+_0x1961fc+'/'+_0x47b8a9)[_0x2fbd('0x1f')](_0x579b30);}return null;};}function patchUpdates(_0x4b95e1){return function(_0x567922){try{jsonpatch[_0x2fbd('0x23')](_0x567922,_0x4b95e1,!![]);}catch(_0x35ebb5){return BPromise[_0x2fbd('0x24')](_0x35ebb5);}return _0x567922[_0x2fbd('0x25')]();};}function saveUpdates(_0xcf3e87,_0x17af8f){return function(_0x406296){if(_0x406296){return _0x406296['update'](_0xcf3e87)['then'](function(_0x1f8f16){return _0x1f8f16;});}return null;};}function removeEntity(_0x270bc8,_0x34680b){return function(_0x238809){if(_0x238809){return _0x238809['destroy']()[_0x2fbd('0x26')](function(){_0x270bc8[_0x2fbd('0x1d')](0xcc)[_0x2fbd('0x1e')]();});}};}function handleEntityNotFound(_0x3a0f2e,_0x25630d){return function(_0x220a8a){if(!_0x220a8a){_0x3a0f2e[_0x2fbd('0x1c')](0x194);}return _0x220a8a;};}function handleError(_0x5f47cb,_0x262c64){_0x262c64=_0x262c64||0x1f4;return function(_0x5262d4){logger['error'](_0x5262d4[_0x2fbd('0x27')]);if(_0x5262d4[_0x2fbd('0x28')]){delete _0x5262d4[_0x2fbd('0x28')];}_0x5f47cb[_0x2fbd('0x1d')](_0x262c64)[_0x2fbd('0x29')](_0x5262d4);};}function getInteractionUsers(_0x4e701e,_0x2add8d){return new BPromise(function(_0x34a44d,_0x47b9d2){try{if(_0x2add8d[_0x4e701e['id']]){_0x4e701e['Users']=_[_0x2fbd('0x2a')](_0x2add8d[_0x4e701e['id']],function(_0x5bc8e2){return{'id':_0x5bc8e2['id'],'fullname':_0x5bc8e2['fullname']};});}}catch(_0x1372ff){_0x47b9d2(_0x1372ff);}_0x34a44d(_0x4e701e);});}function getInteractionTags(_0x4c1258,_0x25639c){return new BPromise(function(_0x5dff30,_0x35345c){try{if(_0x4c1258[_0x2fbd('0x2b')]){_0x4c1258[_0x2fbd('0x2c')]=[];_0x4c1258[_0x2fbd('0x2b')][_0x2fbd('0x2d')](',')[_0x2fbd('0x2e')](function(_0x440c97){_0x4c1258[_0x2fbd('0x2c')][_0x2fbd('0x2f')](_0x25639c[_0x440c97]);});}delete _0x4c1258[_0x2fbd('0x2b')];}catch(_0x3652d7){_0x35345c(_0x3652d7);}_0x5dff30(_0x4c1258);});}function updateSmsInteraction(_0x44898f,_0x32250b,_0x5041e8){return new BPromise(function(_0x1fedb4,_0x270181){return getInteractionUsers(_0x44898f,_0x5041e8)[_0x2fbd('0x26')](function(_0xc83a3e){return getInteractionTags(_0xc83a3e,_0x32250b);})[_0x2fbd('0x26')](function(_0x203d47){_0x1fedb4(_0x203d47);})[_0x2fbd('0x30')](function(_0xd96596){_0x270181(_0xd96596);});});}exports[_0x2fbd('0x31')]=function(_0x4b679b,_0x167939){var _0x594d7b={},_0x3cf2d5={},_0x58c026={'count':0x0,'rows':[]};var _0x5996d0=_[_0x2fbd('0x2a')](db[_0x2fbd('0x32')][_0x2fbd('0x33')],function(_0x264a6d){return{'name':_0x264a6d[_0x2fbd('0x34')],'type':_0x264a6d[_0x2fbd('0x35')]['key']};});_0x3cf2d5[_0x2fbd('0x36')]=_[_0x2fbd('0x2a')](_0x5996d0,_0x2fbd('0x28'));_0x3cf2d5['query']=_['keys'](_0x4b679b[_0x2fbd('0x37')]);_0x3cf2d5['filters']=_[_0x2fbd('0x38')](_0x3cf2d5[_0x2fbd('0x36')],_0x3cf2d5[_0x2fbd('0x37')]);_0x594d7b['attributes']=_['intersection'](_0x3cf2d5['model'],qs[_0x2fbd('0x39')](_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x39')]));_0x594d7b[_0x2fbd('0x3a')]=_0x594d7b['attributes'][_0x2fbd('0x3b')]?_0x594d7b[_0x2fbd('0x3a')]:_0x3cf2d5[_0x2fbd('0x36')];if(!_0x4b679b['query']['hasOwnProperty'](_0x2fbd('0x3c'))){_0x594d7b[_0x2fbd('0x22')]=qs[_0x2fbd('0x22')](_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x22')]);_0x594d7b['offset']=qs[_0x2fbd('0x21')](_0x4b679b[_0x2fbd('0x37')]['offset']);}_0x594d7b[_0x2fbd('0x3d')]=qs[_0x2fbd('0x3e')](_0x4b679b['query'][_0x2fbd('0x3e')]);_0x594d7b[_0x2fbd('0x3f')]=qs['filters'](_[_0x2fbd('0x40')](_0x4b679b[_0x2fbd('0x37')],_0x3cf2d5[_0x2fbd('0x41')]),_0x5996d0);var _0x50e56f=[];var _0x52249c=squel[_0x2fbd('0x42')]()['field']('id')[_0x2fbd('0x43')](_0x2fbd('0x28'))[_0x2fbd('0x43')](_0x2fbd('0x44'))[_0x2fbd('0x45')]('tools_tags');var _0x183fdf=squel[_0x2fbd('0x42')]()['field'](_0x2fbd('0x46'))[_0x2fbd('0x43')](_0x2fbd('0x47'))['field'](_0x2fbd('0x48'))[_0x2fbd('0x45')]('user_has_sms_interactions','ui')[_0x2fbd('0x49')]('users','u',_0x2fbd('0x4a'));var _0x3d8404=squel['select']()[_0x2fbd('0x45')]('sms_interactions','i')[_0x2fbd('0x49')](_0x2fbd('0x4b'),'c',_0x2fbd('0x4c'))['left_join'](_0x2fbd('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x2fbd('0x49')]('sms_accounts','a',_0x2fbd('0x4e'))['left_join']('sms_messages','me',_0x2fbd('0x4f'))[_0x2fbd('0x49')](_0x2fbd('0x50'),'it',_0x2fbd('0x51'))[_0x2fbd('0x49')]('tools_tags','t',_0x2fbd('0x52'));var _0x35c946=squel[_0x2fbd('0x53')]();var _0x3de6f7=[];var _0x27bec8=squel[_0x2fbd('0x53')]();var _0x28c412;if(_0x4b679b[_0x2fbd('0x37')]['search']){_0x28c412=as['parseSearch'](_0x4b679b['query'][_0x2fbd('0x54')]);var _0x1117bb=_0x28c412[_0x2fbd('0x55')];for(var _0x7a8976=0x0;_0x7a8976<_0x28c412[_0x2fbd('0x56')][_0x2fbd('0x3b')];_0x7a8976++){var _0x40e516=_0x28c412[_0x2fbd('0x56')][_0x7a8976];var _0x31cba2='i';var _0x5418d4=_[_0x2fbd('0x57')](_0x5996d0,['name',_0x40e516[_0x2fbd('0x43')]]);if(!_0x5418d4){switch(_0x40e516[_0x2fbd('0x43')]){case'unreadMessages':if(_0x40e516[_0x2fbd('0x58')]==0x1){_0x3d8404['having']('`'+_0x40e516['field']+_0x2fbd('0x59'));}else{_0x3d8404[_0x2fbd('0x5a')]('`'+_0x40e516[_0x2fbd('0x43')]+_0x2fbd('0x5b'));}break;case _0x2fbd('0x5c'):if(_0x40e516[_0x2fbd('0x5d')]===_0x2fbd('0x5e')){if(_0x40e516[_0x2fbd('0x58')][_0x2fbd('0x2d')]('\x20')[_0x2fbd('0x3b')]>0x1){_0x35c946[_0x1117bb](_0x2fbd('0x5f'),qs['getFullTextValue'](_0x40e516[_0x2fbd('0x58')]),null);}else{var _0x38e646='%'+_0x40e516[_0x2fbd('0x58')]+'%';_0x35c946[_0x1117bb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x38e646,_0x38e646,_0x38e646);}}else{_0x5418d4=_['find'](_0x5996d0,['name',_0x2fbd('0x60')]);_0x40e516['field']='ContactId';_0x55f436=as['buildExpression'](_0x31cba2,_0x5418d4['type'],_0x40e516);_0x35c946[_0x1117bb](_0x55f436['text'],_0x55f436['value']['start'],_0x55f436[_0x2fbd('0x58')][_0x2fbd('0x1e')]);}break;case _0x2fbd('0x61'):var _0x525eb9=_0x40e516[_0x2fbd('0x58')]['split'](',')[_0x2fbd('0x2a')](function(_0x17c5ca){return Number(_0x17c5ca);});_0x525eb9[_0x2fbd('0x2e')](function(_0x19677b){_0x27bec8['or'](_0x2fbd('0x62'),'%,'+_0x19677b+',%');});_0x3de6f7=_[_0x2fbd('0x63')](_0x3de6f7,_0x525eb9);break;case _0x2fbd('0x64'):if(_0x40e516[_0x2fbd('0x5d')]===_0x2fbd('0x5e')){_0x35c946[_0x1117bb](_0x2fbd('0x65'),'%'+_0x40e516['value']+'%',null);}else{_0x5418d4=_[_0x2fbd('0x57')](_0x5996d0,[_0x2fbd('0x28'),_0x2fbd('0x66')]);_0x40e516[_0x2fbd('0x43')]=_0x2fbd('0x66');_0x55f436=as[_0x2fbd('0x67')](_0x31cba2,_0x5418d4[_0x2fbd('0x35')],_0x40e516);_0x35c946[_0x1117bb](_0x55f436[_0x2fbd('0x68')],_0x55f436[_0x2fbd('0x58')]['start'],_0x55f436['value'][_0x2fbd('0x1e')]);}break;case _0x2fbd('0x69'):_0x55f436=as[_0x2fbd('0x67')]('me',null,_0x40e516);_0x35c946[_0x1117bb](_0x55f436['text'],_0x55f436[_0x2fbd('0x58')][_0x2fbd('0x6a')],_0x55f436[_0x2fbd('0x58')][_0x2fbd('0x1e')]);break;}}else{var _0x55f436=as[_0x2fbd('0x67')](_0x31cba2,_0x5418d4['type'],_0x40e516);_0x35c946[_0x1117bb](_0x55f436['text'],_0x55f436[_0x2fbd('0x58')]['start'],_0x55f436[_0x2fbd('0x58')][_0x2fbd('0x1e')]);}}}else{var _0x1d35dc=_(_0x4b679b[_0x2fbd('0x37')])[_0x2fbd('0x6b')]()[_0x2fbd('0x2a')](function(_0x14efc8){return _[_0x2fbd('0x6c')](_0x5996d0,[_0x2fbd('0x28'),_0x14efc8])?_0x14efc8:undefined;})[_0x2fbd('0x6d')]()[_0x2fbd('0x58')]();if(!_['isEmpty'](_0x1d35dc)){_0x1d35dc[_0x2fbd('0x2e')](function(_0x53f13c){if(_0x53f13c===_0x2fbd('0x6e')){_0x3d8404['where'](_0x2fbd('0x6f'),[]['concat'](_0x4b679b[_0x2fbd('0x37')][_0x53f13c]));}else if(_0x53f13c===_0x2fbd('0x70')){var _0x2d2a3c=JSON[_0x2fbd('0x71')](_0x4b679b[_0x2fbd('0x37')][_0x53f13c])['$gte'];var _0xa9f56=JSON[_0x2fbd('0x71')](_0x4b679b[_0x2fbd('0x37')][_0x53f13c])[_0x2fbd('0x72')];_0x3d8404[_0x2fbd('0x3f')](_0x2fbd('0x73'),_0x2d2a3c,_0xa9f56);}else{if(_0x4b679b[_0x2fbd('0x37')][_0x53f13c]===_0x2fbd('0x74')){_0x3d8404[_0x2fbd('0x3f')]('i.'+_0x53f13c+_0x2fbd('0x75'));}else{_0x3d8404[_0x2fbd('0x3f')]('i.'+_0x53f13c+_0x2fbd('0x76'),_0x4b679b['query'][_0x53f13c]);}}});}if(_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x77')]){if(_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x77')]==0x1){_0x3d8404[_0x2fbd('0x5a')]('`unreadMessages`\x20=\x200');}else{_0x3d8404[_0x2fbd('0x5a')](_0x2fbd('0x78'));}}if(_0x4b679b[_0x2fbd('0x37')]['tag']){_0x3de6f7=_[_0x2fbd('0x79')](_0x4b679b['query'][_0x2fbd('0x7a')])?_0x4b679b['query'][_0x2fbd('0x7a')]:new Array(_0x4b679b[_0x2fbd('0x37')]['tag']);_0x3de6f7[_0x2fbd('0x2e')](function(_0x4dc2c5){_0x27bec8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4dc2c5+',%');});}if(_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x7b')]){var _0x451b41=_0x4b679b['query']['filter'][_0x2fbd('0x7c')]('\x5c','\x5c\x5c')[_0x2fbd('0x7c')](/'/g,'\x27\x27');if(qs[_0x2fbd('0x7d')](_0x451b41)){_0x35c946['or'](_0x2fbd('0x7e'),_0x451b41+'%')['or'](_0x2fbd('0x7f'),_0x451b41+'%');}else{_0x35c946['or'](_0x2fbd('0x80'),qs['getFullTextValue'](_0x451b41))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x451b41+'%');}}}_0x3d8404[_0x2fbd('0x3f')](_0x35c946);_0x3d8404[_0x2fbd('0x81')]('i.id');var _0x560202={'type':db['Sequelize']['QueryTypes'][_0x2fbd('0x82')],'raw':!![]};var _0x5d9202=_0x3d8404['clone']();_0x5d9202[_0x2fbd('0x43')](_0x2fbd('0x83'));_0x5d9202[_0x2fbd('0x43')](_0x2fbd('0x84'),'unreadMessages');if(_0x594d7b[_0x2fbd('0x3d')]){_0x594d7b[_0x2fbd('0x3d')][_0x2fbd('0x2e')](function(_0x340faf){var _0x74e781=_0x340faf[0x0]===_0x2fbd('0x85')?_0x340faf[0x0]:'i.'+_0x340faf[0x0];_0x3d8404[_0x2fbd('0x3d')](_0x74e781,_0x340faf[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2fbd('0x86')](_0x3de6f7)){_0x3d8404['having'](_0x27bec8);_0x5d9202[_0x2fbd('0x3f')](_0x2fbd('0x87'),_0x3de6f7);}BPromise[_0x2fbd('0x88')]()[_0x2fbd('0x26')](function(){if(!_0x28c412){if(_0x4b679b[_0x2fbd('0x37')]['SmsAccountId'])return;_0x5d9202['where'](_0x2fbd('0x89'));_0x3d8404[_0x2fbd('0x3f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4b679b['user']['role']!==_0x2fbd('0x8a'))return;return _0x4b679b[_0x2fbd('0x8b')][_0x2fbd('0x8c')]({'attributes':['id'],'raw':!![]})[_0x2fbd('0x26')](function(_0xd15e97){if(_[_0x2fbd('0x86')](_0xd15e97)){_0x5d9202[_0x2fbd('0x3f')](_0x2fbd('0x8d'));_0x3d8404[_0x2fbd('0x3f')](_0x2fbd('0x8d'));}else{_0x5d9202['where'](_0x2fbd('0x6f'),_['map'](_0xd15e97,'id'));_0x3d8404[_0x2fbd('0x3f')](_0x2fbd('0x6f'),_[_0x2fbd('0x2a')](_0xd15e97,'id'));}});})[_0x2fbd('0x26')](function(){if(_0x4b679b['user']['role']===_0x2fbd('0x8a')&&!_0x28c412&&!_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x6e')])return[];return db['sequelize'][_0x2fbd('0x37')](_0x5d9202['toString'](),_0x560202);})['then'](function(_0x576c3d){_0x58c026[_0x2fbd('0x20')]=_0x576c3d[_0x2fbd('0x3b')];if(_0x58c026['count']===0x0)return[];return db[_0x2fbd('0x8e')][_0x2fbd('0x37')](_0x52249c['toString'](),_0x560202)[_0x2fbd('0x26')](function(_0x1bb4f0){_0x50e56f=_[_0x2fbd('0x8f')](_0x1bb4f0,'id');_0x560202=_[_0x2fbd('0x90')](_0x560202,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b679b[_0x2fbd('0x37')][_0x2fbd('0x39')]){_0x594d7b[_0x2fbd('0x3a')][_0x2fbd('0x2e')](function(_0x1987a0){_0x3d8404[_0x2fbd('0x43')]('i.'+_0x1987a0);});}else{_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0x84'),_0x2fbd('0x91'));_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0x92'),_0x2fbd('0x93'));_0x3d8404[_0x2fbd('0x43')]('a.mandatoryDisposition',_0x2fbd('0x94'));_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0x95'),_0x2fbd('0x85'));_0x3d8404[_0x2fbd('0x43')]('i.*');_0x3d8404[_0x2fbd('0x43')]('c.firstName',_0x2fbd('0x96'));_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0x97'),_0x2fbd('0x98'));_0x3d8404['field']('c.email',_0x2fbd('0x99'));_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0x9a'),_0x2fbd('0x9b'));_0x3d8404['field'](_0x2fbd('0x9c'),_0x2fbd('0x9d'));_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0x9e'),'Contact.fax');_0x3d8404['field']('o.fullname',_0x2fbd('0x9f'));_0x3d8404[_0x2fbd('0x43')]('o.internal',_0x2fbd('0xa0'));_0x3d8404[_0x2fbd('0x43')](_0x2fbd('0xa1'),_0x2fbd('0x2b'));}if(_0x594d7b['limit'])_0x3d8404['limit'](_0x594d7b[_0x2fbd('0x22')]);if(_0x594d7b[_0x2fbd('0x21')])_0x3d8404['offset'](_0x594d7b[_0x2fbd('0x21')]);return db[_0x2fbd('0x8e')][_0x2fbd('0x37')](_0x3d8404[_0x2fbd('0xa2')](),_0x560202);})[_0x2fbd('0x26')](function(_0x293699){_0x183fdf['where'](_0x2fbd('0xa3'),_[_0x2fbd('0x2a')](_0x293699,'id'));return db[_0x2fbd('0x8e')][_0x2fbd('0x37')](_0x183fdf['toString'](),_0x560202)['then'](function(_0x59b7dc){var _0x47029e=_['groupBy'](_0x59b7dc,'SmsInteractionId');var _0x313055=[];_0x293699['forEach'](function(_0x90d890){_0x313055[_0x2fbd('0x2f')](updateSmsInteraction(_0x90d890,_0x50e56f,_0x47029e));});return BPromise[_0x2fbd('0xa4')](_0x313055);});});})[_0x2fbd('0x26')](function(_0x233a7f){_0x58c026[_0x2fbd('0xa5')]=_0x233a7f;return _0x58c026;})[_0x2fbd('0x26')](respondWithFilteredResult(_0x167939,_0x594d7b))[_0x2fbd('0x30')](handleError(_0x167939,null));};exports[_0x2fbd('0xa6')]=function(_0x1415e9,_0x25104c){var _0x1d0c35={'raw':![],'where':{'id':_0x1415e9[_0x2fbd('0xa7')]['id']}},_0x2c87f7={};_0x2c87f7[_0x2fbd('0x36')]=_['keys'](db[_0x2fbd('0x32')][_0x2fbd('0x33')]);_0x2c87f7[_0x2fbd('0x37')]=_[_0x2fbd('0x6b')](_0x1415e9['query']);_0x2c87f7[_0x2fbd('0x41')]=_[_0x2fbd('0x38')](_0x2c87f7[_0x2fbd('0x36')],_0x2c87f7[_0x2fbd('0x37')]);_0x1d0c35[_0x2fbd('0x3a')]=_[_0x2fbd('0x38')](_0x2c87f7['model'],qs['fields'](_0x1415e9[_0x2fbd('0x37')][_0x2fbd('0x39')]));_0x1d0c35[_0x2fbd('0x3a')]=_0x1d0c35[_0x2fbd('0x3a')][_0x2fbd('0x3b')]?_0x1d0c35[_0x2fbd('0x3a')]:_0x2c87f7[_0x2fbd('0x36')];if(_0x1415e9['query']['includeAll']){_0x1d0c35[_0x2fbd('0xa8')]=[{'all':!![]}];}_0x1d0c35=_[_0x2fbd('0x90')]({},_0x1d0c35,_0x1415e9[_0x2fbd('0xa9')]);return db[_0x2fbd('0x32')]['find'](_0x1d0c35)[_0x2fbd('0x26')](handleEntityNotFound(_0x25104c,null))[_0x2fbd('0x26')](respondWithResult(_0x25104c,null))[_0x2fbd('0x30')](handleError(_0x25104c,null));};exports[_0x2fbd('0xaa')]=function(_0x597290,_0x3e1ad1){return db[_0x2fbd('0x32')][_0x2fbd('0xaa')](_0x597290[_0x2fbd('0x69')],{})[_0x2fbd('0x26')](respondWithResult(_0x3e1ad1,0xc9))[_0x2fbd('0x30')](handleError(_0x3e1ad1,null));};exports[_0x2fbd('0xab')]=function(_0x4b7b6b,_0xaaf301){if(_0x4b7b6b[_0x2fbd('0x69')]['id']){delete _0x4b7b6b['body']['id'];}return db[_0x2fbd('0x32')][_0x2fbd('0x57')]({'where':{'id':_0x4b7b6b[_0x2fbd('0xa7')]['id']}})[_0x2fbd('0x26')](handleEntityNotFound(_0xaaf301,null))[_0x2fbd('0x26')](saveUpdates(_0x4b7b6b[_0x2fbd('0x69')],null))['then'](respondWithResult(_0xaaf301,null))['catch'](handleError(_0xaaf301,null));};exports['destroy']=function(_0x3fec5d,_0x1b96d6){return db['SmsInteraction']['find']({'where':{'id':_0x3fec5d[_0x2fbd('0xa7')]['id']}})[_0x2fbd('0x26')](handleEntityNotFound(_0x1b96d6,null))[_0x2fbd('0x26')](removeEntity(_0x1b96d6,null))[_0x2fbd('0x30')](handleError(_0x1b96d6,null));};exports[_0x2fbd('0xac')]=function(_0x2f1ccd,_0xe8f2e5){return db[_0x2fbd('0x32')][_0x2fbd('0xac')]()[_0x2fbd('0x26')](respondWithResult(_0xe8f2e5,null))['catch'](handleError(_0xe8f2e5,null));};exports['addMessage']=function(_0x503c85,_0x5651c2,_0x133848){return db[_0x2fbd('0xad')][_0x2fbd('0x57')]({'where':{'id':_0x503c85['params']['id']}})[_0x2fbd('0x26')](handleEntityNotFound(_0x5651c2,null))[_0x2fbd('0x26')](function(_0x4b0fd5){if(_0x4b0fd5){return _0x4b0fd5['addMessage'](_0x503c85[_0x2fbd('0x69')][_0x2fbd('0xae')],_['omit'](_0x503c85['body'],[_0x2fbd('0xae'),'id'])||{});}})[_0x2fbd('0x26')](respondWithResult(_0x5651c2,null))[_0x2fbd('0x30')](handleError(_0x5651c2,null));};exports[_0x2fbd('0xaf')]=function(_0x12de14,_0x511838,_0x569584){var _0x3e1ade={'raw':![],'where':{}};var _0x185288={};var _0xd21874={'count':0x0,'rows':[]};return db[_0x2fbd('0x32')][_0x2fbd('0xb0')]({'where':{'id':_0x12de14[_0x2fbd('0xa7')]['id']}})['then'](handleEntityNotFound(_0x511838,null))[_0x2fbd('0x26')](function(_0x4b7aed){if(_0x4b7aed){_0x185288[_0x2fbd('0x36')]=_[_0x2fbd('0x6b')](db['SmsMessage']['rawAttributes']);_0x185288[_0x2fbd('0x37')]=_['keys'](_0x12de14[_0x2fbd('0x37')]);_0x185288[_0x2fbd('0x41')]=_['intersection'](_0x185288[_0x2fbd('0x36')],_0x185288[_0x2fbd('0x37')]);_0x3e1ade[_0x2fbd('0x3a')]=_[_0x2fbd('0x38')](_0x185288['model'],qs[_0x2fbd('0x39')](_0x12de14[_0x2fbd('0x37')][_0x2fbd('0x39')]));_0x3e1ade[_0x2fbd('0x3a')]=_0x3e1ade['attributes'][_0x2fbd('0x3b')]?_0x3e1ade[_0x2fbd('0x3a')]:_0x185288['model'];if(!_0x12de14['query'][_0x2fbd('0xb1')](_0x2fbd('0x3c'))){_0x3e1ade[_0x2fbd('0x22')]=qs['limit'](_0x12de14[_0x2fbd('0x37')][_0x2fbd('0x22')]);_0x3e1ade[_0x2fbd('0x21')]=qs['offset'](_0x12de14[_0x2fbd('0x37')]['offset']);}_0x3e1ade[_0x2fbd('0x3d')]=qs['sort'](_0x12de14[_0x2fbd('0x37')][_0x2fbd('0x3e')]);_0x3e1ade[_0x2fbd('0x3f')]=qs['filters'](_[_0x2fbd('0x40')](_0x12de14['query'],_0x185288[_0x2fbd('0x41')]));_0x3e1ade['where'][_0x2fbd('0xb2')]=_0x4b7aed['id'];if(_0x12de14[_0x2fbd('0x37')][_0x2fbd('0x7b')]){_0x3e1ade[_0x2fbd('0x3f')]=_[_0x2fbd('0x90')](_0x3e1ade[_0x2fbd('0x3f')],{'$or':_[_0x2fbd('0x2a')](_0x3e1ade[_0x2fbd('0x3a')],function(_0x48831a){var _0x1b3a1a={};_0x1b3a1a[_0x48831a]={'$like':'%'+_0x12de14['query']['filter']+'%'};return _0x1b3a1a;})});}if(_0x12de14[_0x2fbd('0x37')][_0x2fbd('0xb3')]){var _0x2561e9=_0x12de14[_0x2fbd('0x37')][_0x2fbd('0xb3')][_0x2fbd('0x2d')](',');var _0x3089a0={};_0x3089a0[_0x2561e9[0x0]]={'$gte':moment(_0x2561e9[0x1])[_0x2fbd('0xb4')](_0x2fbd('0xb5'))};_0x3e1ade['where']=_[_0x2fbd('0x90')](_0x3e1ade[_0x2fbd('0x3f')],_0x3089a0);}_0x3e1ade=_[_0x2fbd('0x90')]({},_0x3e1ade,_0x12de14[_0x2fbd('0xa9')]);return db[_0x2fbd('0xad')][_0x2fbd('0x20')]({'where':_0x3e1ade[_0x2fbd('0x3f')]})['then'](function(_0x2dba01){_0xd21874[_0x2fbd('0x20')]=_0x2dba01;if(_0x12de14[_0x2fbd('0x37')]['includeAll']){_0x3e1ade['include']=[{'all':!![]}];}return db[_0x2fbd('0xad')][_0x2fbd('0xb6')](_0x3e1ade);})['then'](function(_0x49b4ae){_0xd21874['rows']=_0x49b4ae;return _0xd21874;});}})[_0x2fbd('0x26')](respondWithFilteredResult(_0x511838,_0x3e1ade))['catch'](handleError(_0x511838,null));};exports[_0x2fbd('0xb7')]=function(_0x56de0a,_0x503ba9,_0x547793){return db[_0x2fbd('0x32')][_0x2fbd('0x57')]({'where':{'id':_0x56de0a[_0x2fbd('0xa7')]['id']}})[_0x2fbd('0x26')](handleEntityNotFound(_0x503ba9,null))[_0x2fbd('0x26')](function(_0x4e50bb){if(_0x4e50bb){return _0x4e50bb['setTags'](_0x56de0a[_0x2fbd('0x69')]['ids'],_[_0x2fbd('0xb8')](_0x56de0a[_0x2fbd('0x69')],[_0x2fbd('0xae'),'id'])||{})[_0x2fbd('0xb9')](function(){return db[_0x2fbd('0x61')]['findAll']({'attributes':['id','name',_0x2fbd('0x44')],'where':{'id':_0x56de0a[_0x2fbd('0x69')][_0x2fbd('0xae')]}});})[_0x2fbd('0x26')](function(_0x3c8aca){socket['emit'](_0x2fbd('0xba'),{'id':Number(_0x56de0a[_0x2fbd('0xa7')]['id']),'tags':_0x3c8aca||[]});return{'id':Number(_0x56de0a[_0x2fbd('0xa7')]['id']),'tags':_0x3c8aca||[]};});}})[_0x2fbd('0x26')](respondWithResult(_0x503ba9,null))[_0x2fbd('0x30')](handleError(_0x503ba9,null));};exports[_0x2fbd('0xbb')]=function(_0xc82164,_0x3339c9,_0x15a0fb){return db[_0x2fbd('0x32')]['find']({'where':{'id':_0xc82164['params']['id']}})[_0x2fbd('0x26')](handleEntityNotFound(_0x3339c9,null))[_0x2fbd('0x26')](function(_0x4ef83c){if(_0x4ef83c){return _0x4ef83c[_0x2fbd('0xbb')](_0xc82164[_0x2fbd('0x37')][_0x2fbd('0xae')]);}})[_0x2fbd('0x26')](respondWithStatusCode(_0x3339c9,null))[_0x2fbd('0x30')](handleError(_0x3339c9,null));};exports[_0x2fbd('0xbc')]=function(_0x5df210,_0x4159bd){var _0x3978de=moment()['unix']()[_0x2fbd('0xa2')]();var _0x408991=path[_0x2fbd('0xbd')](config[_0x2fbd('0xbe')],'server',_0x2fbd('0xbf'),_0x2fbd('0xc0'));var _0x2a469f=path[_0x2fbd('0xbd')](config[_0x2fbd('0xbe')],'server','files','attachments');var _0x595e1a=path[_0x2fbd('0xbd')](_0x408991,_0x3978de);var _0x523bb5=util['format']('transcript-%d-%s.zip',_0x5df210[_0x2fbd('0xa7')]['id'],_0x3978de);var _0x266f6f=path[_0x2fbd('0xbd')](_0x408991,_0x523bb5);var _0x22722d=[];_0x22722d[_0x2fbd('0x2f')]({'model':db[_0x2fbd('0x64')],'as':_0x2fbd('0x64'),'attributes':['id',_0x2fbd('0xc1')],'raw':!![]});_0x22722d[_0x2fbd('0x2f')]({'model':db[_0x2fbd('0xc2')],'as':_0x2fbd('0x5c'),'attributes':['id','firstName',_0x2fbd('0xc3')],'raw':!![]});var _0xc56d96=[{'model':db[_0x2fbd('0xad')],'as':'Messages','attributes':['id',_0x2fbd('0x69'),_0x2fbd('0x70'),_0x2fbd('0xc4'),_0x2fbd('0xc5'),_0x2fbd('0x77')],'include':_0x22722d}];_0xc56d96[_0x2fbd('0x2f')]({'model':db[_0x2fbd('0xc6')],'as':_0x2fbd('0xc7'),'attributes':['id','name']});_0xc56d96[_0x2fbd('0x2f')]({'model':db[_0x2fbd('0x64')],'as':'Owner','attributes':['id',_0x2fbd('0xc1')]});return db[_0x2fbd('0x32')][_0x2fbd('0x57')]({'where':{'id':_0x5df210[_0x2fbd('0xa7')]['id']},'include':_0xc56d96})['then'](handleEntityNotFound(_0x4159bd,null))['then'](function(_0x28251b){if(_0x28251b){var _0x23dcbc=_0x28251b['get']({'plain':!![]});fs['mkdirSync'](_0x595e1a);var _0xd2b97={'format':'A4','border':_0x2fbd('0xc8'),'header':{'height':_0x2fbd('0xc9'),'contents':{'first':_0x2fbd('0xca')}},'footer':{'height':_0x2fbd('0xcb'),'contents':{'default':util[_0x2fbd('0xb4')](_0x2fbd('0xcc'),util[_0x2fbd('0xb4')]('%s\x20#%d','Sms',_0x23dcbc['id']),moment()[_0x2fbd('0xb4')](_0x2fbd('0xcd'))[_0x2fbd('0xa2')]())}}};var _0x3332ce={'channel':_0x2fbd('0xce'),'account':_0x23dcbc['Account']['name'],'agent':_0x23dcbc[_0x2fbd('0xcf')]?_0x23dcbc[_0x2fbd('0xcf')][_0x2fbd('0xc1')]:_0x2fbd('0xd0'),'createdAt':moment(_0x23dcbc[_0x2fbd('0x70')])[_0x2fbd('0xb4')](_0x2fbd('0xb5'))[_0x2fbd('0xa2')](),'closedAt':_0x23dcbc['closed']?moment(_0x23dcbc[_0x2fbd('0xd1')])[_0x2fbd('0xb4')](_0x2fbd('0xb5'))[_0x2fbd('0xa2')]():'','disposition':_0x23dcbc['disposition'],'messages':_(_0x23dcbc[_0x2fbd('0xd2')])['filter']({'secret':![]})[_0x2fbd('0x2a')](function(_0xdfbe6b){return{'date':moment(_0xdfbe6b[_0x2fbd('0x70')])[_0x2fbd('0xb4')](_0x2fbd('0xb5'))[_0x2fbd('0xa2')](),'sender':_0xdfbe6b[_0x2fbd('0xc4')]==='out'?_0xdfbe6b['User']?_0xdfbe6b[_0x2fbd('0x64')][_0x2fbd('0xc1')]:_0x2fbd('0xd3'):_0xdfbe6b[_0x2fbd('0x5c')][_0x2fbd('0xd4')]+(_0xdfbe6b[_0x2fbd('0x5c')]['lastName']?'\x20'+_0xdfbe6b[_0x2fbd('0x5c')][_0x2fbd('0xc3')]:''),'body':_0xdfbe6b[_0x2fbd('0x69')],'direction':_0xdfbe6b[_0x2fbd('0xc4')]==='out'?'A':'C','secret':_0xdfbe6b[_0x2fbd('0xc5')],'read':_0xdfbe6b['read']};})['value']()};return ejs[_0x2fbd('0xd5')](path[_0x2fbd('0xbd')](config[_0x2fbd('0xbe')],_0x2fbd('0xd6'),'views','downloadInteraction.html'),{'interaction':_0x3332ce})[_0x2fbd('0x26')](function(_0x277a6a){return new BPromise(function(_0x2a9e3d,_0x48e91e){pdf[_0x2fbd('0xaa')](_0x277a6a,_0xd2b97)[_0x2fbd('0xd7')](path[_0x2fbd('0xbd')](_0x595e1a,_0x2fbd('0xd8')+_0x23dcbc['id']+'-'+_0x3978de+_0x2fbd('0xd9')),function(_0x27eb1c,_0x5c62c7){if(_0x27eb1c)return _0x48e91e(_0x27eb1c);_0x2a9e3d(_0x5c62c7);});});})[_0x2fbd('0x26')](function(){return new BPromise(function(_0x4ee68,_0x383aa1){zipdir(_0x595e1a,{'saveTo':_0x266f6f},function(_0x17d3db,_0x2eec9e){if(_0x17d3db)return _0x383aa1(_0x17d3db);return _0x4ee68(_0x2eec9e);});})[_0x2fbd('0x26')](function(){return new BPromise(function(_0xfc409a,_0x4cf53e){rimraf(_0x595e1a,function(_0xe71b65){if(_0xe71b65)_0x4cf53e(_0xe71b65);return _0xfc409a();});});})['then'](function(){return _0x4159bd['download'](_0x266f6f,_0x523bb5,function(_0x516254){if(_0x516254){console[_0x2fbd('0xda')]('err',_0x516254);}else{fs[_0x2fbd('0xdb')](_0x266f6f);}});});});}else{return _0x4159bd[_0x2fbd('0x1c')](0xc8);}})[_0x2fbd('0x30')](handleError(_0x4159bd,null));}; \ No newline at end of file +var _0x786a=['Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','format','findAll','setTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','firstName','lastName','Messages','direction','Account','Owner','fullname','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','./smsInteraction.socket','register','sendStatus','status','offset','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','Users','map','TagIds','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','forEach','union','User','operator','UserId','text','buildExpression','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email'];(function(_0x32e8f2,_0x33cff3){var _0xefd2e6=function(_0x524abd){while(--_0x524abd){_0x32e8f2['push'](_0x32e8f2['shift']());}};_0xefd2e6(++_0x33cff3);}(_0x786a,0x12c));var _0xa786=function(_0x3cdb2d,_0x44b111){_0x3cdb2d=_0x3cdb2d-0x0;var _0x148250=_0x786a[_0x3cdb2d];return _0x148250;};'use strict';var pdf=require(_0xa786('0x0'));var emlformat=require(_0xa786('0x1'));var rimraf=require(_0xa786('0x2'));var zipdir=require(_0xa786('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa786('0x4'));var moment=require(_0xa786('0x5'));var BPromise=require(_0xa786('0x6'));var Mustache=require(_0xa786('0x7'));var util=require(_0xa786('0x8'));var path=require(_0xa786('0x9'));var sox=require('sox');var csv=require(_0xa786('0xa'));var ejs=require(_0xa786('0xb'));var fs=require('fs');var _=require(_0xa786('0xc'));var squel=require('squel');var crypto=require(_0xa786('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa786('0xa'));var querystring=require(_0xa786('0xe'));var Papa=require(_0xa786('0xf'));var Redis=require(_0xa786('0x10'));var authService=require(_0xa786('0x11'));var qs=require(_0xa786('0x12'));var as=require(_0xa786('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa786('0x14'))(_0xa786('0x15'));var utils=require('../../config/utils');var config=require(_0xa786('0x16'));var licenseUtil=require(_0xa786('0x17'));var db=require('../../mysqldb')['db'];config[_0xa786('0x18')]=_['defaults'](config['redis'],{'host':_0xa786('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa786('0x18')]));require(_0xa786('0x1a'))[_0xa786('0x1b')](socket);function respondWithStatusCode(_0x325965,_0x4404eb){_0x4404eb=_0x4404eb||0xcc;return function(_0x13fe19){if(_0x13fe19){return _0x325965[_0xa786('0x1c')](_0x4404eb);}return _0x325965[_0xa786('0x1d')](_0x4404eb)['end']();};}function respondWithResult(_0x392ac8,_0x4195f3){_0x4195f3=_0x4195f3||0xc8;return function(_0x2b2f0e){if(_0x2b2f0e){return _0x392ac8[_0xa786('0x1d')](_0x4195f3)['json'](_0x2b2f0e);}};}function respondWithFilteredResult(_0xf84ab9,_0x2e2ca9){return function(_0xc4616){if(_0xc4616){var _0xe2985c=_0xc4616['count'],_0x3e544c=_0x2e2ca9[_0xa786('0x1e')],_0x26769b=_0x2e2ca9[_0xa786('0x1e')]+_0x2e2ca9['limit'],_0x53f69c;if(_0x26769b>=_0xe2985c){_0x26769b=_0xe2985c;_0x53f69c=0xc8;}else{_0x53f69c=0xce;}_0xf84ab9['status'](_0x53f69c);return _0xf84ab9['set'](_0xa786('0x1f'),_0x3e544c+'-'+_0x26769b+'/'+_0xe2985c)[_0xa786('0x20')](_0xc4616);}return null;};}function patchUpdates(_0x1b6943){return function(_0x1fa84a){try{jsonpatch['apply'](_0x1fa84a,_0x1b6943,!![]);}catch(_0x513001){return BPromise[_0xa786('0x21')](_0x513001);}return _0x1fa84a[_0xa786('0x22')]();};}function saveUpdates(_0x5c19f0,_0x1e7536){return function(_0x1404b5){if(_0x1404b5){return _0x1404b5[_0xa786('0x23')](_0x5c19f0)[_0xa786('0x24')](function(_0x36329b){return _0x36329b;});}return null;};}function removeEntity(_0xf97a74,_0x285209){return function(_0x59efc4){if(_0x59efc4){return _0x59efc4[_0xa786('0x25')]()['then'](function(){_0xf97a74[_0xa786('0x1d')](0xcc)[_0xa786('0x26')]();});}};}function handleEntityNotFound(_0x484498,_0x28f514){return function(_0x502f25){if(!_0x502f25){_0x484498[_0xa786('0x1c')](0x194);}return _0x502f25;};}function handleError(_0x3e89a8,_0x17264e){_0x17264e=_0x17264e||0x1f4;return function(_0xd594e6){logger[_0xa786('0x27')](_0xd594e6[_0xa786('0x28')]);if(_0xd594e6[_0xa786('0x29')]){delete _0xd594e6[_0xa786('0x29')];}_0x3e89a8['status'](_0x17264e)['send'](_0xd594e6);};}function getInteractionUsers(_0x5d6e1a,_0x1f1bae){return new BPromise(function(_0xa4df48,_0x3c03b7){try{if(_0x1f1bae[_0x5d6e1a['id']]){_0x5d6e1a[_0xa786('0x2a')]=_[_0xa786('0x2b')](_0x1f1bae[_0x5d6e1a['id']],function(_0x1bebd3){return{'id':_0x1bebd3['id'],'fullname':_0x1bebd3['fullname']};});}}catch(_0xa8efaf){_0x3c03b7(_0xa8efaf);}_0xa4df48(_0x5d6e1a);});}function getInteractionTags(_0x2506fb,_0x11743d){return new BPromise(function(_0x15b05a,_0x505480){try{if(_0x2506fb[_0xa786('0x2c')]){_0x2506fb[_0xa786('0x2d')]=[];_0x2506fb['TagIds']['split'](',')['forEach'](function(_0x218166){_0x2506fb[_0xa786('0x2d')][_0xa786('0x2e')](_0x11743d[_0x218166]);});}delete _0x2506fb[_0xa786('0x2c')];}catch(_0x1cc9c9){_0x505480(_0x1cc9c9);}_0x15b05a(_0x2506fb);});}function updateSmsInteraction(_0x4da4cb,_0x2b040f,_0x5987d1){return new BPromise(function(_0x2fda0e,_0x37cc45){return getInteractionUsers(_0x4da4cb,_0x5987d1)[_0xa786('0x24')](function(_0x5aecdd){return getInteractionTags(_0x5aecdd,_0x2b040f);})[_0xa786('0x24')](function(_0x1504e9){_0x2fda0e(_0x1504e9);})[_0xa786('0x2f')](function(_0x296eb8){_0x37cc45(_0x296eb8);});});}exports[_0xa786('0x30')]=function(_0x469d5f,_0x156554){var _0x2ea3fa={},_0x1f85af={},_0x8e8d42={'count':0x0,'rows':[]};var _0x2eca21=_[_0xa786('0x2b')](db[_0xa786('0x31')][_0xa786('0x32')],function(_0x3172ff){return{'name':_0x3172ff[_0xa786('0x33')],'type':_0x3172ff[_0xa786('0x34')][_0xa786('0x35')]};});_0x1f85af['model']=_[_0xa786('0x2b')](_0x2eca21,_0xa786('0x29'));_0x1f85af[_0xa786('0x36')]=_[_0xa786('0x37')](_0x469d5f[_0xa786('0x36')]);_0x1f85af[_0xa786('0x38')]=_[_0xa786('0x39')](_0x1f85af[_0xa786('0x3a')],_0x1f85af[_0xa786('0x36')]);_0x2ea3fa['attributes']=_[_0xa786('0x39')](_0x1f85af[_0xa786('0x3a')],qs[_0xa786('0x3b')](_0x469d5f['query']['fields']));_0x2ea3fa[_0xa786('0x3c')]=_0x2ea3fa[_0xa786('0x3c')][_0xa786('0x3d')]?_0x2ea3fa[_0xa786('0x3c')]:_0x1f85af['model'];if(!_0x469d5f[_0xa786('0x36')][_0xa786('0x3e')](_0xa786('0x3f'))){_0x2ea3fa[_0xa786('0x40')]=qs['limit'](_0x469d5f[_0xa786('0x36')][_0xa786('0x40')]);_0x2ea3fa[_0xa786('0x1e')]=qs['offset'](_0x469d5f['query'][_0xa786('0x1e')]);}_0x2ea3fa[_0xa786('0x41')]=qs[_0xa786('0x42')](_0x469d5f[_0xa786('0x36')][_0xa786('0x42')]);_0x2ea3fa[_0xa786('0x43')]=qs[_0xa786('0x38')](_[_0xa786('0x44')](_0x469d5f[_0xa786('0x36')],_0x1f85af[_0xa786('0x38')]),_0x2eca21);var _0x244dd6=[];var _0x308be9=squel[_0xa786('0x45')]()[_0xa786('0x46')]('id')[_0xa786('0x46')]('name')[_0xa786('0x46')](_0xa786('0x47'))[_0xa786('0x48')](_0xa786('0x49'));var _0xb0cd26=squel[_0xa786('0x45')]()[_0xa786('0x46')](_0xa786('0x4a'))[_0xa786('0x46')](_0xa786('0x4b'))['field'](_0xa786('0x4c'))[_0xa786('0x48')]('user_has_sms_interactions','ui')[_0xa786('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x25a1aa=squel['select']()[_0xa786('0x48')](_0xa786('0x4e'),'i')['left_join'](_0xa786('0x4f'),'c',_0xa786('0x50'))[_0xa786('0x4d')](_0xa786('0x51'),'o',_0xa786('0x52'))[_0xa786('0x4d')](_0xa786('0x53'),'a',_0xa786('0x54'))[_0xa786('0x4d')](_0xa786('0x55'),'me',_0xa786('0x56'))[_0xa786('0x4d')]('sms_interaction_has_tags','it',_0xa786('0x57'))[_0xa786('0x4d')](_0xa786('0x49'),'t',_0xa786('0x58'));var _0x1c908a=squel[_0xa786('0x59')]();var _0x4da4ff=[];var _0x2f2de6=squel['expr']();var _0x5989aa;if(_0x469d5f[_0xa786('0x36')][_0xa786('0x5a')]){_0x5989aa=as[_0xa786('0x5b')](_0x469d5f[_0xa786('0x36')]['search']);var _0x3756e6=_0x5989aa[_0xa786('0x5c')];for(var _0x4f4d6d=0x0;_0x4f4d6d<_0x5989aa['conditions'][_0xa786('0x3d')];_0x4f4d6d++){var _0x4395fc=_0x5989aa[_0xa786('0x5d')][_0x4f4d6d];var _0x338cf3='i';var _0xb5ebfa=_[_0xa786('0x5e')](_0x2eca21,[_0xa786('0x29'),_0x4395fc[_0xa786('0x46')]]);if(!_0xb5ebfa){switch(_0x4395fc[_0xa786('0x46')]){case _0xa786('0x5f'):if(_0x4395fc[_0xa786('0x60')]==0x1){_0x25a1aa[_0xa786('0x61')]('`'+_0x4395fc['field']+'`\x20=\x200');}else{_0x25a1aa[_0xa786('0x61')]('`'+_0x4395fc['field']+_0xa786('0x62'));}break;case _0xa786('0x63'):if(_0x4395fc['operator']===_0xa786('0x64')){if(_0x4395fc[_0xa786('0x60')][_0xa786('0x65')]('\x20')[_0xa786('0x3d')]>0x1){_0x1c908a[_0x3756e6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa786('0x66')](_0x4395fc[_0xa786('0x60')]),null);}else{var _0x3a2cd9='%'+_0x4395fc[_0xa786('0x60')]+'%';_0x1c908a[_0x3756e6](_0xa786('0x67'),_0x3a2cd9,_0x3a2cd9,_0x3a2cd9);}}else{_0xb5ebfa=_[_0xa786('0x5e')](_0x2eca21,[_0xa786('0x29'),_0xa786('0x68')]);_0x4395fc[_0xa786('0x46')]=_0xa786('0x68');_0x46af59=as['buildExpression'](_0x338cf3,_0xb5ebfa[_0xa786('0x34')],_0x4395fc);_0x1c908a[_0x3756e6](_0x46af59['text'],_0x46af59[_0xa786('0x60')][_0xa786('0x69')],_0x46af59[_0xa786('0x60')][_0xa786('0x26')]);}break;case'Tag':var _0x337b33=_0x4395fc['value'][_0xa786('0x65')](',')['map'](function(_0xc7ee74){return Number(_0xc7ee74);});_0x337b33[_0xa786('0x6a')](function(_0x341a63){_0x2f2de6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x341a63+',%');});_0x4da4ff=_[_0xa786('0x6b')](_0x4da4ff,_0x337b33);break;case _0xa786('0x6c'):if(_0x4395fc[_0xa786('0x6d')]===_0xa786('0x64')){_0x1c908a[_0x3756e6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4395fc['value']+'%',null);}else{_0xb5ebfa=_[_0xa786('0x5e')](_0x2eca21,[_0xa786('0x29'),_0xa786('0x6e')]);_0x4395fc[_0xa786('0x46')]=_0xa786('0x6e');_0x46af59=as['buildExpression'](_0x338cf3,_0xb5ebfa[_0xa786('0x34')],_0x4395fc);_0x1c908a[_0x3756e6](_0x46af59[_0xa786('0x6f')],_0x46af59[_0xa786('0x60')][_0xa786('0x69')],_0x46af59[_0xa786('0x60')][_0xa786('0x26')]);}break;case'body':_0x46af59=as[_0xa786('0x70')]('me',null,_0x4395fc);_0x1c908a[_0x3756e6](_0x46af59[_0xa786('0x6f')],_0x46af59[_0xa786('0x60')][_0xa786('0x69')],_0x46af59[_0xa786('0x60')]['end']);break;}}else{var _0x46af59=as[_0xa786('0x70')](_0x338cf3,_0xb5ebfa[_0xa786('0x34')],_0x4395fc);_0x1c908a[_0x3756e6](_0x46af59[_0xa786('0x6f')],_0x46af59[_0xa786('0x60')][_0xa786('0x69')],_0x46af59[_0xa786('0x60')][_0xa786('0x26')]);}}}else{var _0x2a5e41=_(_0x469d5f['query'])['keys']()['map'](function(_0x45199e){return _[_0xa786('0x71')](_0x2eca21,['name',_0x45199e])?_0x45199e:undefined;})['compact']()[_0xa786('0x60')]();if(!_[_0xa786('0x72')](_0x2a5e41)){_0x2a5e41[_0xa786('0x6a')](function(_0x44aef4){if(_0x44aef4===_0xa786('0x73')){_0x25a1aa[_0xa786('0x43')](_0xa786('0x74'),[]['concat'](_0x469d5f[_0xa786('0x36')][_0x44aef4]));}else if(_0x44aef4===_0xa786('0x75')){var _0x339ecb=JSON[_0xa786('0x76')](_0x469d5f[_0xa786('0x36')][_0x44aef4])[_0xa786('0x77')];var _0x1f95d1=JSON['parse'](_0x469d5f[_0xa786('0x36')][_0x44aef4])[_0xa786('0x78')];_0x25a1aa[_0xa786('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x339ecb,_0x1f95d1);}else{if(_0x469d5f[_0xa786('0x36')][_0x44aef4]===_0xa786('0x79')){_0x25a1aa[_0xa786('0x43')]('i.'+_0x44aef4+_0xa786('0x7a'));}else{_0x25a1aa['where']('i.'+_0x44aef4+_0xa786('0x7b'),_0x469d5f[_0xa786('0x36')][_0x44aef4]);}}});}if(_0x469d5f['query']['read']){if(_0x469d5f[_0xa786('0x36')][_0xa786('0x7c')]==0x1){_0x25a1aa[_0xa786('0x61')](_0xa786('0x7d'));}else{_0x25a1aa['having'](_0xa786('0x7e'));}}if(_0x469d5f[_0xa786('0x36')][_0xa786('0x7f')]){_0x4da4ff=_['isArray'](_0x469d5f[_0xa786('0x36')][_0xa786('0x7f')])?_0x469d5f[_0xa786('0x36')][_0xa786('0x7f')]:new Array(_0x469d5f[_0xa786('0x36')][_0xa786('0x7f')]);_0x4da4ff[_0xa786('0x6a')](function(_0x3e035f){_0x2f2de6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e035f+',%');});}if(_0x469d5f[_0xa786('0x36')]['filter']){var _0x5040a6=_0x469d5f[_0xa786('0x36')][_0xa786('0x80')][_0xa786('0x81')]('\x5c','\x5c\x5c')[_0xa786('0x81')](/'/g,'\x27\x27');if(qs[_0xa786('0x82')](_0x5040a6)){_0x1c908a['or'](_0xa786('0x83'),_0x5040a6+'%')['or'](_0xa786('0x84'),_0x5040a6+'%');}else{_0x1c908a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5040a6))['or'](_0xa786('0x85'),_0x5040a6+'%');}}}_0x25a1aa[_0xa786('0x43')](_0x1c908a);_0x25a1aa[_0xa786('0x86')](_0xa786('0x87'));var _0x35c45e={'type':db[_0xa786('0x88')][_0xa786('0x89')]['SELECT'],'raw':!![]};var _0xfe6715=_0x25a1aa['clone']();_0xfe6715[_0xa786('0x46')]('i.id');_0xfe6715[_0xa786('0x46')](_0xa786('0x8a'),_0xa786('0x5f'));if(_0x2ea3fa[_0xa786('0x41')]){_0x2ea3fa['order'][_0xa786('0x6a')](function(_0x551415){var _0xaab979=_0x551415[0x0]===_0xa786('0x8b')?_0x551415[0x0]:'i.'+_0x551415[0x0];_0x25a1aa[_0xa786('0x41')](_0xaab979,_0x551415[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa786('0x72')](_0x4da4ff)){_0x25a1aa[_0xa786('0x61')](_0x2f2de6);_0xfe6715['where'](_0xa786('0x8c'),_0x4da4ff);}BPromise[_0xa786('0x8d')]()[_0xa786('0x24')](function(){if(!_0x5989aa){if(_0x469d5f['query'][_0xa786('0x73')])return;_0xfe6715['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x25a1aa['where'](_0xa786('0x8e'));return;}if(_0x469d5f['user'][_0xa786('0x8f')]!==_0xa786('0x90'))return;return _0x469d5f[_0xa786('0x91')][_0xa786('0x92')]({'attributes':['id'],'raw':!![]})[_0xa786('0x24')](function(_0x427cf0){if(_[_0xa786('0x72')](_0x427cf0)){_0xfe6715[_0xa786('0x43')](_0xa786('0x93'));_0x25a1aa['where'](_0xa786('0x93'));}else{_0xfe6715[_0xa786('0x43')](_0xa786('0x74'),_['map'](_0x427cf0,'id'));_0x25a1aa['where'](_0xa786('0x74'),_['map'](_0x427cf0,'id'));}});})['then'](function(){if(_0x469d5f[_0xa786('0x91')][_0xa786('0x8f')]===_0xa786('0x90')&&!_0x5989aa&&!_0x469d5f[_0xa786('0x36')][_0xa786('0x73')])return[];return db[_0xa786('0x94')]['query'](_0xfe6715[_0xa786('0x95')](),_0x35c45e);})[_0xa786('0x24')](function(_0x1ee07){_0x8e8d42['count']=_0x1ee07[_0xa786('0x3d')];if(_0x8e8d42[_0xa786('0x96')]===0x0)return[];return db[_0xa786('0x94')][_0xa786('0x36')](_0x308be9[_0xa786('0x95')](),_0x35c45e)['then'](function(_0x3faff6){_0x244dd6=_[_0xa786('0x97')](_0x3faff6,'id');_0x35c45e=_[_0xa786('0x98')](_0x35c45e,{'model':db[_0xa786('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x469d5f['query'][_0xa786('0x3b')]){_0x2ea3fa['attributes'][_0xa786('0x6a')](function(_0x18b753){_0x25a1aa['field']('i.'+_0x18b753);});}else{_0x25a1aa['field'](_0xa786('0x8a'),_0xa786('0x5f'));_0x25a1aa[_0xa786('0x46')](_0xa786('0x99'),_0xa786('0x9a'));_0x25a1aa[_0xa786('0x46')]('a.mandatoryDisposition',_0xa786('0x9b'));_0x25a1aa[_0xa786('0x46')](_0xa786('0x9c'),_0xa786('0x8b'));_0x25a1aa['field'](_0xa786('0x9d'));_0x25a1aa[_0xa786('0x46')]('c.firstName',_0xa786('0x9e'));_0x25a1aa['field'](_0xa786('0x9f'),_0xa786('0xa0'));_0x25a1aa['field']('c.email',_0xa786('0xa1'));_0x25a1aa['field']('c.phone',_0xa786('0xa2'));_0x25a1aa[_0xa786('0x46')](_0xa786('0xa3'),_0xa786('0xa4'));_0x25a1aa['field'](_0xa786('0xa5'),_0xa786('0xa6'));_0x25a1aa[_0xa786('0x46')]('o.fullname',_0xa786('0xa7'));_0x25a1aa[_0xa786('0x46')]('o.internal','Owner.internal');_0x25a1aa[_0xa786('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa786('0x2c'));}if(_0x2ea3fa['limit'])_0x25a1aa[_0xa786('0x40')](_0x2ea3fa[_0xa786('0x40')]);if(_0x2ea3fa[_0xa786('0x1e')])_0x25a1aa[_0xa786('0x1e')](_0x2ea3fa[_0xa786('0x1e')]);return db[_0xa786('0x94')][_0xa786('0x36')](_0x25a1aa[_0xa786('0x95')](),_0x35c45e);})[_0xa786('0x24')](function(_0x22ebf9){_0xb0cd26['where'](_0xa786('0xa8'),_[_0xa786('0x2b')](_0x22ebf9,'id'));return db[_0xa786('0x94')][_0xa786('0x36')](_0xb0cd26[_0xa786('0x95')](),_0x35c45e)[_0xa786('0x24')](function(_0x360e3f){var _0x5f32f4=_[_0xa786('0xa9')](_0x360e3f,_0xa786('0xaa'));var _0x3493d7=[];_0x22ebf9[_0xa786('0x6a')](function(_0x1601ab){_0x3493d7[_0xa786('0x2e')](updateSmsInteraction(_0x1601ab,_0x244dd6,_0x5f32f4));});return BPromise[_0xa786('0xab')](_0x3493d7);});});})['then'](function(_0x46e01c){_0x8e8d42[_0xa786('0xac')]=_0x46e01c;return _0x8e8d42;})[_0xa786('0x24')](respondWithFilteredResult(_0x156554,_0x2ea3fa))['catch'](handleError(_0x156554,null));};exports[_0xa786('0xad')]=function(_0x4aef1d,_0x449927){var _0x2f7de7={'raw':![],'where':{'id':_0x4aef1d[_0xa786('0xae')]['id']}},_0x2e5b85={};_0x2e5b85[_0xa786('0x3a')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x2e5b85[_0xa786('0x36')]=_[_0xa786('0x37')](_0x4aef1d[_0xa786('0x36')]);_0x2e5b85['filters']=_[_0xa786('0x39')](_0x2e5b85[_0xa786('0x3a')],_0x2e5b85[_0xa786('0x36')]);_0x2f7de7['attributes']=_[_0xa786('0x39')](_0x2e5b85[_0xa786('0x3a')],qs[_0xa786('0x3b')](_0x4aef1d[_0xa786('0x36')][_0xa786('0x3b')]));_0x2f7de7[_0xa786('0x3c')]=_0x2f7de7[_0xa786('0x3c')][_0xa786('0x3d')]?_0x2f7de7[_0xa786('0x3c')]:_0x2e5b85['model'];if(_0x4aef1d[_0xa786('0x36')][_0xa786('0xaf')]){_0x2f7de7[_0xa786('0xb0')]=[{'all':!![]}];}_0x2f7de7=_[_0xa786('0x98')]({},_0x2f7de7,_0x4aef1d[_0xa786('0xb1')]);return db[_0xa786('0x31')][_0xa786('0x5e')](_0x2f7de7)[_0xa786('0x24')](handleEntityNotFound(_0x449927,null))[_0xa786('0x24')](respondWithResult(_0x449927,null))[_0xa786('0x2f')](handleError(_0x449927,null));};exports[_0xa786('0xb2')]=function(_0x2e7543,_0x56b3be){return db['SmsInteraction'][_0xa786('0xb2')](_0x2e7543[_0xa786('0xb3')],{})[_0xa786('0x24')](respondWithResult(_0x56b3be,0xc9))[_0xa786('0x2f')](handleError(_0x56b3be,null));};exports[_0xa786('0x23')]=function(_0x15d469,_0x63462b){if(_0x15d469[_0xa786('0xb3')]['id']){delete _0x15d469[_0xa786('0xb3')]['id'];}return db[_0xa786('0x31')][_0xa786('0x5e')]({'where':{'id':_0x15d469[_0xa786('0xae')]['id']}})[_0xa786('0x24')](handleEntityNotFound(_0x63462b,null))['then'](saveUpdates(_0x15d469['body'],null))[_0xa786('0x24')](respondWithResult(_0x63462b,null))[_0xa786('0x2f')](handleError(_0x63462b,null));};exports['destroy']=function(_0x58055f,_0x5e482b){return db[_0xa786('0x31')][_0xa786('0x5e')]({'where':{'id':_0x58055f[_0xa786('0xae')]['id']}})[_0xa786('0x24')](handleEntityNotFound(_0x5e482b,null))[_0xa786('0x24')](removeEntity(_0x5e482b,null))[_0xa786('0x2f')](handleError(_0x5e482b,null));};exports[_0xa786('0xb4')]=function(_0x552226,_0x21e931){return db[_0xa786('0x31')][_0xa786('0xb4')]()['then'](respondWithResult(_0x21e931,null))['catch'](handleError(_0x21e931,null));};exports[_0xa786('0xb5')]=function(_0x27d2a6,_0x18bf9e,_0x382e00){return db[_0xa786('0xb6')][_0xa786('0x5e')]({'where':{'id':_0x27d2a6['params']['id']}})[_0xa786('0x24')](handleEntityNotFound(_0x18bf9e,null))[_0xa786('0x24')](function(_0x1eb806){if(_0x1eb806){return _0x1eb806[_0xa786('0xb5')](_0x27d2a6[_0xa786('0xb3')][_0xa786('0xb7')],_[_0xa786('0xb8')](_0x27d2a6['body'],[_0xa786('0xb7'),'id'])||{});}})[_0xa786('0x24')](respondWithResult(_0x18bf9e,null))[_0xa786('0x2f')](handleError(_0x18bf9e,null));};exports[_0xa786('0xb9')]=function(_0x36b9ea,_0x3a3819,_0x31dbd1){var _0x5363d5={'raw':![],'where':{}};var _0x35eca5={};var _0x2cec88={'count':0x0,'rows':[]};return db[_0xa786('0x31')]['findOne']({'where':{'id':_0x36b9ea[_0xa786('0xae')]['id']}})['then'](handleEntityNotFound(_0x3a3819,null))[_0xa786('0x24')](function(_0x3a7b34){if(_0x3a7b34){_0x35eca5[_0xa786('0x3a')]=_[_0xa786('0x37')](db[_0xa786('0xb6')][_0xa786('0x32')]);_0x35eca5[_0xa786('0x36')]=_['keys'](_0x36b9ea[_0xa786('0x36')]);_0x35eca5[_0xa786('0x38')]=_[_0xa786('0x39')](_0x35eca5[_0xa786('0x3a')],_0x35eca5['query']);_0x5363d5[_0xa786('0x3c')]=_[_0xa786('0x39')](_0x35eca5[_0xa786('0x3a')],qs[_0xa786('0x3b')](_0x36b9ea[_0xa786('0x36')][_0xa786('0x3b')]));_0x5363d5[_0xa786('0x3c')]=_0x5363d5['attributes'][_0xa786('0x3d')]?_0x5363d5[_0xa786('0x3c')]:_0x35eca5[_0xa786('0x3a')];if(!_0x36b9ea['query'][_0xa786('0x3e')](_0xa786('0x3f'))){_0x5363d5['limit']=qs[_0xa786('0x40')](_0x36b9ea['query']['limit']);_0x5363d5[_0xa786('0x1e')]=qs['offset'](_0x36b9ea[_0xa786('0x36')][_0xa786('0x1e')]);}_0x5363d5[_0xa786('0x41')]=qs[_0xa786('0x42')](_0x36b9ea['query'][_0xa786('0x42')]);_0x5363d5['where']=qs[_0xa786('0x38')](_[_0xa786('0x44')](_0x36b9ea['query'],_0x35eca5[_0xa786('0x38')]));_0x5363d5[_0xa786('0x43')]['SmsInteractionId']=_0x3a7b34['id'];if(_0x36b9ea[_0xa786('0x36')][_0xa786('0x80')]){_0x5363d5[_0xa786('0x43')]=_[_0xa786('0x98')](_0x5363d5[_0xa786('0x43')],{'$or':_[_0xa786('0x2b')](_0x5363d5[_0xa786('0x3c')],function(_0x4b9e7a){var _0x5af88f={};_0x5af88f[_0x4b9e7a]={'$like':'%'+_0x36b9ea[_0xa786('0x36')][_0xa786('0x80')]+'%'};return _0x5af88f;})});}if(_0x36b9ea[_0xa786('0x36')][_0xa786('0x77')]){var _0x33c198=_0x36b9ea[_0xa786('0x36')]['$gte'][_0xa786('0x65')](',');var _0x413442={};_0x413442[_0x33c198[0x0]]={'$gte':moment(_0x33c198[0x1])[_0xa786('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5363d5[_0xa786('0x43')]=_['merge'](_0x5363d5[_0xa786('0x43')],_0x413442);}_0x5363d5=_[_0xa786('0x98')]({},_0x5363d5,_0x36b9ea[_0xa786('0xb1')]);return db[_0xa786('0xb6')][_0xa786('0x96')]({'where':_0x5363d5['where']})['then'](function(_0x352a73){_0x2cec88[_0xa786('0x96')]=_0x352a73;if(_0x36b9ea[_0xa786('0x36')][_0xa786('0xaf')]){_0x5363d5[_0xa786('0xb0')]=[{'all':!![]}];}return db[_0xa786('0xb6')][_0xa786('0xbb')](_0x5363d5);})['then'](function(_0x1e3e16){_0x2cec88[_0xa786('0xac')]=_0x1e3e16;return _0x2cec88;});}})['then'](respondWithFilteredResult(_0x3a3819,_0x5363d5))[_0xa786('0x2f')](handleError(_0x3a3819,null));};exports['addTags']=function(_0x57f2d6,_0x50772c,_0x6e0be5){return db[_0xa786('0x31')][_0xa786('0x5e')]({'where':{'id':_0x57f2d6[_0xa786('0xae')]['id']}})[_0xa786('0x24')](handleEntityNotFound(_0x50772c,null))[_0xa786('0x24')](function(_0x22c490){if(_0x22c490){return _0x22c490[_0xa786('0xbc')](_0x57f2d6['body']['ids'],_[_0xa786('0xb8')](_0x57f2d6[_0xa786('0xb3')],['ids','id'])||{})[_0xa786('0xbd')](function(){return db['Tag'][_0xa786('0xbb')]({'attributes':['id',_0xa786('0x29'),_0xa786('0x47')],'where':{'id':_0x57f2d6[_0xa786('0xb3')]['ids']}});})[_0xa786('0x24')](function(_0x1741ec){socket[_0xa786('0xbe')]('smsInteractionTags:save',{'id':Number(_0x57f2d6[_0xa786('0xae')]['id']),'tags':_0x1741ec||[]});return{'id':Number(_0x57f2d6[_0xa786('0xae')]['id']),'tags':_0x1741ec||[]};});}})['then'](respondWithResult(_0x50772c,null))[_0xa786('0x2f')](handleError(_0x50772c,null));};exports[_0xa786('0xbf')]=function(_0x1cd694,_0x2529d5,_0x46eb24){return db[_0xa786('0x31')][_0xa786('0x5e')]({'where':{'id':_0x1cd694[_0xa786('0xae')]['id']}})[_0xa786('0x24')](handleEntityNotFound(_0x2529d5,null))[_0xa786('0x24')](function(_0x2e0631){if(_0x2e0631){return _0x2e0631[_0xa786('0xbf')](_0x1cd694['query'][_0xa786('0xb7')]);}})[_0xa786('0x24')](respondWithStatusCode(_0x2529d5,null))[_0xa786('0x2f')](handleError(_0x2529d5,null));};exports[_0xa786('0xc0')]=function(_0xbac3c4,_0x37104f){var _0x4e611c=moment()[_0xa786('0xc1')]()[_0xa786('0x95')]();var _0x1dad85=path[_0xa786('0xc2')](config[_0xa786('0xc3')],_0xa786('0xc4'),_0xa786('0xc5'),_0xa786('0xc6'));var _0x1d15ff=path[_0xa786('0xc2')](config[_0xa786('0xc3')],_0xa786('0xc4'),_0xa786('0xc5'),_0xa786('0xc7'));var _0x2102d2=path[_0xa786('0xc2')](_0x1dad85,_0x4e611c);var _0x4aaab4=util[_0xa786('0xba')]('transcript-%d-%s.zip',_0xbac3c4[_0xa786('0xae')]['id'],_0x4e611c);var _0x277b28=path[_0xa786('0xc2')](_0x1dad85,_0x4aaab4);var _0x197f84=[];_0x197f84[_0xa786('0x2e')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x197f84[_0xa786('0x2e')]({'model':db['CmContact'],'as':_0xa786('0x63'),'attributes':['id',_0xa786('0xc8'),_0xa786('0xc9')],'raw':!![]});var _0x174f62=[{'model':db[_0xa786('0xb6')],'as':_0xa786('0xca'),'attributes':['id',_0xa786('0xb3'),_0xa786('0x75'),_0xa786('0xcb'),'secret',_0xa786('0x7c')],'include':_0x197f84}];_0x174f62[_0xa786('0x2e')]({'model':db['SmsAccount'],'as':_0xa786('0xcc'),'attributes':['id',_0xa786('0x29')]});_0x174f62['push']({'model':db[_0xa786('0x6c')],'as':_0xa786('0xcd'),'attributes':['id',_0xa786('0xce')]});return db[_0xa786('0x31')][_0xa786('0x5e')]({'where':{'id':_0xbac3c4[_0xa786('0xae')]['id']},'include':_0x174f62})[_0xa786('0x24')](handleEntityNotFound(_0x37104f,null))['then'](function(_0x54745f){if(_0x54745f){var _0x931e77=_0x54745f[_0xa786('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x2102d2);var _0x1a5cb1={'format':'A4','border':_0xa786('0xd0'),'header':{'height':_0xa786('0xd1'),'contents':{'first':_0xa786('0xd2')}},'footer':{'height':_0xa786('0xd3'),'contents':{'default':util[_0xa786('0xba')](_0xa786('0xd4'),util[_0xa786('0xba')](_0xa786('0xd5'),_0xa786('0xd6'),_0x931e77['id']),moment()[_0xa786('0xba')]('YYYY-MM-DD')[_0xa786('0x95')]())}}};var _0x4ad9ae={'channel':_0xa786('0xd6'),'account':_0x931e77[_0xa786('0xcc')][_0xa786('0x29')],'agent':_0x931e77['Owner']?_0x931e77[_0xa786('0xcd')][_0xa786('0xce')]:_0xa786('0xd7'),'createdAt':moment(_0x931e77[_0xa786('0x75')])['format'](_0xa786('0xd8'))[_0xa786('0x95')](),'closedAt':_0x931e77[_0xa786('0xd9')]?moment(_0x931e77['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa786('0x95')]():'','disposition':_0x931e77[_0xa786('0xda')],'messages':_(_0x931e77[_0xa786('0xca')])['filter']({'secret':![]})[_0xa786('0x2b')](function(_0x5514f1){return{'date':moment(_0x5514f1['createdAt'])['format'](_0xa786('0xd8'))[_0xa786('0x95')](),'sender':_0x5514f1[_0xa786('0xcb')]===_0xa786('0xdb')?_0x5514f1[_0xa786('0x6c')]?_0x5514f1[_0xa786('0x6c')][_0xa786('0xce')]:_0xa786('0xdc'):_0x5514f1['Contact']['firstName']+(_0x5514f1['Contact']['lastName']?'\x20'+_0x5514f1[_0xa786('0x63')]['lastName']:''),'body':_0x5514f1[_0xa786('0xb3')],'direction':_0x5514f1['direction']===_0xa786('0xdb')?'A':'C','secret':_0x5514f1[_0xa786('0xdd')],'read':_0x5514f1[_0xa786('0x7c')]};})['value']()};return ejs[_0xa786('0xde')](path['join'](config[_0xa786('0xc3')],_0xa786('0xc4'),_0xa786('0xdf'),_0xa786('0xe0')),{'interaction':_0x4ad9ae})[_0xa786('0x24')](function(_0x15b31d){return new BPromise(function(_0x3e393f,_0x26b9af){pdf[_0xa786('0xb2')](_0x15b31d,_0x1a5cb1)[_0xa786('0xe1')](path['join'](_0x2102d2,_0xa786('0xe2')+_0x931e77['id']+'-'+_0x4e611c+_0xa786('0xe3')),function(_0x40cfd2,_0x5d04cb){if(_0x40cfd2)return _0x26b9af(_0x40cfd2);_0x3e393f(_0x5d04cb);});});})['then'](function(){return new BPromise(function(_0x1de554,_0x124e13){zipdir(_0x2102d2,{'saveTo':_0x277b28},function(_0x24a24b,_0x4ecb54){if(_0x24a24b)return _0x124e13(_0x24a24b);return _0x1de554(_0x4ecb54);});})[_0xa786('0x24')](function(){return new BPromise(function(_0x2cdbc6,_0x4a56ca){rimraf(_0x2102d2,function(_0x1a5691){if(_0x1a5691)_0x4a56ca(_0x1a5691);return _0x2cdbc6();});});})[_0xa786('0x24')](function(){return _0x37104f[_0xa786('0xc0')](_0x277b28,_0x4aaab4,function(_0x1aeeb7){if(_0x1aeeb7){console[_0xa786('0xe4')](_0xa786('0xe5'),_0x1aeeb7);}else{fs[_0xa786('0xe6')](_0x277b28);}});});});}else{return _0x37104f['sendStatus'](0xc8);}})[_0xa786('0x2f')](handleError(_0x37104f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8834edf..344289e 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 _0x3eea=['update','remove','Users','then','setDataValue','unreadMessages','length','emit','catch','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x2dc99d,_0x3709d8){var _0x4a6aa7=function(_0x2a3f43){while(--_0x2a3f43){_0x2dc99d['push'](_0x2dc99d['shift']());}};_0x4a6aa7(++_0x3709d8);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x56f4c9,_0x55e078){_0x56f4c9=_0x56f4c9-0x0;var _0x22f9d2=_0x3eea[_0x56f4c9];return _0x22f9d2;};'use strict';var EventEmitter=require(_0xa3ee('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xa3ee('0x1')];var SmsMessage=require(_0xa3ee('0x2'))['db'][_0xa3ee('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa3ee('0x4')](0x0);var events={'afterCreate':_0xa3ee('0x5'),'afterUpdate':_0xa3ee('0x6'),'afterDestroy':_0xa3ee('0x7')};function emitEvent(_0x35ed7d){return function(_0x23c42d,_0x1d91df,_0xb93cdb){_0x23c42d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4183ee){_0x23c42d['setDataValue'](_0xa3ee('0x8'),_0x4183ee['map'](function(_0x1eeb5b){return{'id':_0x1eeb5b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x23c42d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa3ee('0x9')](function(_0x5ef236){_0x23c42d[_0xa3ee('0xa')](_0xa3ee('0xb'),_0x5ef236[_0xa3ee('0xc')]);SmsInteractionEvents['emit'](_0x35ed7d+':'+_0x23c42d['id'],_0x23c42d);SmsInteractionEvents[_0xa3ee('0xd')](_0x35ed7d,_0x23c42d);_0xb93cdb(null);})[_0xa3ee('0xe')](_0xb93cdb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xa3ee('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x61a5=['hook','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty'];(function(_0x306d71,_0x19dd75){var _0x368d03=function(_0x49c39d){while(--_0x49c39d){_0x306d71['push'](_0x306d71['shift']());}};_0x368d03(++_0x19dd75);}(_0x61a5,0xf0));var _0x561a=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x61a5[_0x47cfa0];return _0x386b1d;};'use strict';var EventEmitter=require(_0x561a('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x561a('0x1')];var SmsMessage=require(_0x561a('0x2'))['db'][_0x561a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x561a('0x4')](0x0);var events={'afterCreate':_0x561a('0x5'),'afterUpdate':'update','afterDestroy':_0x561a('0x6')};function emitEvent(_0x33c0f5){return function(_0x5b9ca9,_0x18902a,_0x31f762){_0x5b9ca9[_0x561a('0x7')]({'attributes':['id'],'raw':!![]})[_0x561a('0x8')](function(_0x3d55f8){_0x5b9ca9[_0x561a('0x9')](_0x561a('0xa'),_0x3d55f8['map'](function(_0x3db11c){return{'id':_0x3db11c['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5b9ca9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x561a('0x8')](function(_0x5288b4){_0x5b9ca9['setDataValue'](_0x561a('0xb'),_0x5288b4[_0x561a('0xc')]);SmsInteractionEvents['emit'](_0x33c0f5+':'+_0x5b9ca9['id'],_0x5b9ca9);SmsInteractionEvents[_0x561a('0xd')](_0x33c0f5,_0x5b9ca9);_0x31f762(null);})['catch'](_0x31f762(null));};}for(var e in events){if(events[_0x561a('0xe')](e)){var event=events[e];SmsInteraction[_0x561a('0xf')](e,emitEvent(event));}}module[_0x561a('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2be910e..3b1b655 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 _0x9a5a=['./smsInteraction.attributes','define','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x9a5a,0x1d2));var _0xa9a5=function(_0x5471c6,_0x2aa365){_0x5471c6=_0x5471c6-0x0;var _0x170ac2=_0x9a5a[_0x5471c6];return _0x170ac2;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require(_0xa9a5('0x5'));var rp=require(_0xa9a5('0x6'));var fs=require('fs');var path=require(_0xa9a5('0x7'));var rimraf=require(_0xa9a5('0x8'));var config=require(_0xa9a5('0x9'));var attributes=require(_0xa9a5('0xa'));module['exports']=function(_0x54e642,_0x31d10a){return _0x54e642[_0xa9a5('0xb')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5104b6,_0x423074,_0x1b1e7a){if(_0x5104b6['changed']('closed')){_0x5104b6['closedAt']=moment()[_0xa9a5('0xc')](_0xa9a5('0xd'));}_0x1b1e7a(null,_0x5104b6);}}});}; \ No newline at end of file +var _0x8032=['define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','request-promise','../../config/environment','./smsInteraction.attributes','exports'];(function(_0xa4c9c6,_0x462145){var _0x2e1164=function(_0x1c04c4){while(--_0x1c04c4){_0xa4c9c6['push'](_0xa4c9c6['shift']());}};_0x2e1164(++_0x462145);}(_0x8032,0x199));var _0x2803=function(_0x10eb38,_0x2086bd){_0x10eb38=_0x10eb38-0x0;var _0x5af9b5=_0x8032[_0x10eb38];return _0x5af9b5;};'use strict';var _=require(_0x2803('0x0'));var util=require('util');var logger=require(_0x2803('0x1'))('api');var moment=require(_0x2803('0x2'));var BPromise=require('bluebird');var rp=require(_0x2803('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2803('0x4'));var attributes=require(_0x2803('0x5'));module[_0x2803('0x6')]=function(_0x30fda4,_0x4a30aa){return _0x30fda4[_0x2803('0x7')](_0x2803('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x251662,_0x2abadb,_0x27929c){if(_0x251662['changed'](_0x2803('0x9'))){_0x251662[_0x2803('0xa')]=moment()[_0x2803('0xb')](_0x2803('0xc'));}_0x27929c(null,_0x251662);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 59185c5..5dd6a3b 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 _0x0179=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','result','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','catch','find','where','addTags','body','omit','ids','spread','AddTags','lodash'];(function(_0x18c063,_0x40367b){var _0x37b7ef=function(_0x285fcd){while(--_0x285fcd){_0x18c063['push'](_0x18c063['shift']());}};_0x37b7ef(++_0x40367b);}(_0x0179,0xd6));var _0x9017=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0179[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x9017('0x0'));var util=require(_0x9017('0x1'));var moment=require('moment');var BPromise=require(_0x9017('0x2'));var rs=require(_0x9017('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9017('0x4'));var logger=require(_0x9017('0x5'))(_0x9017('0x6'));var config=require(_0x9017('0x7'));var jayson=require(_0x9017('0x8'));var client=jayson['client'][_0x9017('0x9')]({'port':0x232a});config['redis']=_[_0x9017('0xa')](config[_0x9017('0xb')],{'host':_0x9017('0xc'),'port':0x18eb});var socket=require(_0x9017('0xd'))(new Redis(config[_0x9017('0xb')]));require(_0x9017('0xe'))['register'](socket);function respondWithRpcPromise(_0x303387,_0x4e2d63,_0x371da1){return new BPromise(function(_0x510138,_0x4f7343){return client[_0x9017('0xf')](_0x303387,_0x371da1)[_0x9017('0x10')](function(_0x55c9f8){logger[_0x9017('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x4e2d63,_0x9017('0x12'));logger[_0x9017('0x13')](_0x9017('0x14'),_0x4e2d63,_0x9017('0x12'),JSON[_0x9017('0x15')](_0x55c9f8));if(_0x55c9f8[_0x9017('0x16')]){if(_0x55c9f8[_0x9017('0x16')][_0x9017('0x17')]===0x1f4){logger[_0x9017('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4e2d63,_0x55c9f8[_0x9017('0x16')]['message']);return _0x4f7343(_0x55c9f8[_0x9017('0x16')][_0x9017('0x18')]);}logger[_0x9017('0x16')](_0x9017('0x19'),_0x4e2d63,_0x55c9f8[_0x9017('0x16')][_0x9017('0x18')]);return _0x510138(_0x55c9f8[_0x9017('0x16')][_0x9017('0x18')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4e2d63,_0x9017('0x12'));_0x510138(_0x55c9f8[_0x9017('0x1a')][_0x9017('0x18')]);}})['catch'](function(_0x4b0c06){logger['error'](_0x9017('0x19'),_0x4e2d63,_0x4b0c06);_0x4f7343(_0x4b0c06);});});}exports[_0x9017('0x1b')]=function(_0x5f2a70){var _0x469dc0=this;return new Promise(function(_0x48a86e,_0x92490b){return db[_0x9017('0x1c')][_0x9017('0x1d')](_0x5f2a70['body'],{'raw':_0x5f2a70[_0x9017('0x1e')]?_0x5f2a70[_0x9017('0x1e')][_0x9017('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f2a70[_0x9017('0x1e')]?_0x5f2a70[_0x9017('0x1e')]['where']||null:null,'attributes':_0x5f2a70[_0x9017('0x1e')]?_0x5f2a70[_0x9017('0x1e')][_0x9017('0x20')]||null:null,'limit':_0x5f2a70['options']?_0x5f2a70[_0x9017('0x1e')][_0x9017('0x21')]||null:null})['then'](function(_0x43f333){logger['info']('UpdateSmsInteraction',_0x5f2a70);logger[_0x9017('0x13')](_0x9017('0x1b'),_0x5f2a70,JSON[_0x9017('0x15')](_0x43f333));_0x48a86e(_0x43f333);})[_0x9017('0x22')](function(_0x1e058e){logger[_0x9017('0x16')](_0x9017('0x1b'),_0x1e058e[_0x9017('0x18')],_0x5f2a70);_0x92490b(_0x469dc0['error'](0x1f4,_0x1e058e[_0x9017('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x24052d){return new Promise(function(_0x49c716,_0x4552fd){return db[_0x9017('0x1c')][_0x9017('0x23')]({'where':_0x24052d[_0x9017('0x1e')]?_0x24052d['options'][_0x9017('0x24')]||null:null})[_0x9017('0x10')](function(_0x468ee2){if(_0x468ee2){return _0x468ee2[_0x9017('0x25')](_0x24052d[_0x9017('0x26')]['ids'],_[_0x9017('0x27')](_0x24052d[_0x9017('0x26')],[_0x9017('0x28'),'id'])||{});}})[_0x9017('0x29')](function(_0x4df9ac){logger['info'](_0x9017('0x2a'),_0x24052d);logger['debug']('AddTags',_0x24052d,JSON[_0x9017('0x15')](_0x4df9ac));_0x49c716(_0x4df9ac);})[_0x9017('0x22')](function(_0x3ab8b6){logger[_0x9017('0x16')]('AddTags',_0x3ab8b6['message'],_0x24052d);_0x4552fd(_this['error'](0x1f4,_0x3ab8b6['message']));});});}; \ No newline at end of file +var _0x2273=['redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','then','stringify','AddTagsToSmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x36e973,_0x3cd3b4){var _0x3606bd=function(_0x826d3f){while(--_0x826d3f){_0x36e973['push'](_0x36e973['shift']());}};_0x3606bd(++_0x3cd3b4);}(_0x2273,0x1d2));var _0x3227=function(_0x27bd8c,_0x4799e2){_0x27bd8c=_0x27bd8c-0x0;var _0x255b26=_0x2273[_0x27bd8c];return _0x255b26;};'use strict';var _=require(_0x3227('0x0'));var util=require('util');var moment=require(_0x3227('0x1'));var BPromise=require(_0x3227('0x2'));var rs=require(_0x3227('0x3'));var fs=require('fs');var Redis=require(_0x3227('0x4'));var db=require(_0x3227('0x5'))['db'];var utils=require(_0x3227('0x6'));var logger=require(_0x3227('0x7'))(_0x3227('0x8'));var config=require(_0x3227('0x9'));var jayson=require(_0x3227('0xa'));var client=jayson[_0x3227('0xb')][_0x3227('0xc')]({'port':0x232a});config['redis']=_[_0x3227('0xd')](config[_0x3227('0xe')],{'host':_0x3227('0xf'),'port':0x18eb});var socket=require(_0x3227('0x10'))(new Redis(config[_0x3227('0xe')]));require(_0x3227('0x11'))[_0x3227('0x12')](socket);function respondWithRpcPromise(_0x55ca78,_0x208eb4,_0x4ae66d){return new BPromise(function(_0x365b77,_0x513f06){return client[_0x3227('0x13')](_0x55ca78,_0x4ae66d)['then'](function(_0x15c923){logger[_0x3227('0x14')](_0x3227('0x15'),_0x208eb4,_0x3227('0x16'));logger[_0x3227('0x17')](_0x3227('0x18'),_0x208eb4,_0x3227('0x16'),JSON['stringify'](_0x15c923));if(_0x15c923['error']){if(_0x15c923[_0x3227('0x19')][_0x3227('0x1a')]===0x1f4){logger['error'](_0x3227('0x15'),_0x208eb4,_0x15c923[_0x3227('0x19')][_0x3227('0x1b')]);return _0x513f06(_0x15c923[_0x3227('0x19')][_0x3227('0x1b')]);}logger[_0x3227('0x19')](_0x3227('0x15'),_0x208eb4,_0x15c923['error'][_0x3227('0x1b')]);return _0x365b77(_0x15c923[_0x3227('0x19')][_0x3227('0x1b')]);}else{logger[_0x3227('0x14')](_0x3227('0x15'),_0x208eb4,_0x3227('0x16'));_0x365b77(_0x15c923[_0x3227('0x1c')]['message']);}})[_0x3227('0x1d')](function(_0x5eb4c3){logger[_0x3227('0x19')](_0x3227('0x15'),_0x208eb4,_0x5eb4c3);_0x513f06(_0x5eb4c3);});});}exports[_0x3227('0x1e')]=function(_0x3e2f77){var _0x10fc1a=this;return new Promise(function(_0x3a3ee7,_0x34e632){return db[_0x3227('0x1f')][_0x3227('0x20')](_0x3e2f77[_0x3227('0x21')],{'raw':_0x3e2f77[_0x3227('0x22')]?_0x3e2f77[_0x3227('0x22')][_0x3227('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e2f77[_0x3227('0x22')]?_0x3e2f77[_0x3227('0x22')]['where']||null:null,'attributes':_0x3e2f77['options']?_0x3e2f77[_0x3227('0x22')][_0x3227('0x24')]||null:null,'limit':_0x3e2f77[_0x3227('0x22')]?_0x3e2f77['options'][_0x3227('0x25')]||null:null})[_0x3227('0x26')](function(_0xdcfeda){logger['info'](_0x3227('0x1e'),_0x3e2f77);logger[_0x3227('0x17')]('UpdateSmsInteraction',_0x3e2f77,JSON[_0x3227('0x27')](_0xdcfeda));_0x3a3ee7(_0xdcfeda);})[_0x3227('0x1d')](function(_0x5d1c12){logger['error'](_0x3227('0x1e'),_0x5d1c12[_0x3227('0x1b')],_0x3e2f77);_0x34e632(_0x10fc1a['error'](0x1f4,_0x5d1c12[_0x3227('0x1b')]));});});};exports[_0x3227('0x28')]=function(_0x3e0bd5){return new Promise(function(_0x41b9a2,_0x2ba150){return db[_0x3227('0x1f')][_0x3227('0x29')]({'where':_0x3e0bd5['options']?_0x3e0bd5[_0x3227('0x22')][_0x3227('0x2a')]||null:null})[_0x3227('0x26')](function(_0x3f5d25){if(_0x3f5d25){return _0x3f5d25[_0x3227('0x2b')](_0x3e0bd5[_0x3227('0x21')]['ids'],_[_0x3227('0x2c')](_0x3e0bd5[_0x3227('0x21')],[_0x3227('0x2d'),'id'])||{});}})[_0x3227('0x2e')](function(_0x55a08b){logger[_0x3227('0x14')](_0x3227('0x2f'),_0x3e0bd5);logger['debug'](_0x3227('0x2f'),_0x3e0bd5,JSON[_0x3227('0x27')](_0x55a08b));_0x41b9a2(_0x55a08b);})['catch'](function(_0x422c3d){logger[_0x3227('0x19')](_0x3227('0x2f'),_0x422c3d[_0x3227('0x1b')],_0x3e0bd5);_0x2ba150(_this[_0x3227('0x19')](0x1f4,_0x422c3d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8fa944b..ef7cc1f 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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x5cebf2,_0x18288d){var _0x1cdf42=function(_0x5b4f49){while(--_0x5b4f49){_0x5cebf2['push'](_0x5cebf2['shift']());}};_0x1cdf42(++_0x18288d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x384aa4,_0x238c3d){var _0x259c37=function(_0x5bcb25){while(--_0x5bcb25){_0x384aa4['push'](_0x384aa4['shift']());}};_0x259c37(++_0x238c3d);}(_0x757a,0xde));var _0xa757=function(_0x10b646,_0x475801){_0x10b646=_0x10b646-0x0;var _0x3ce994=_0x757a[_0x10b646];return _0x3ce994;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 46690cd..cc05bff 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 _0xb6f0=['/describe','describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','get'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xb6f0,0xba));var _0x0b6f=function(_0x3ae96c,_0x5f1e7e){_0x3ae96c=_0x3ae96c-0x0;var _0x1b0c90=_0xb6f0[_0x3ae96c];return _0x1b0c90;};'use strict';var multer=require(_0x0b6f('0x0'));var util=require(_0x0b6f('0x1'));var path=require(_0x0b6f('0x2'));var timeout=require(_0x0b6f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x0b6f('0x4'));var interaction=require(_0x0b6f('0x5'));var config=require('../../config/environment');var controller=require(_0x0b6f('0x6'));router['get']('/',auth[_0x0b6f('0x7')](),controller[_0x0b6f('0x8')]);router[_0x0b6f('0x9')](_0x0b6f('0xa'),auth['isAuthenticated'](),controller[_0x0b6f('0xb')]);router[_0x0b6f('0x9')](_0x0b6f('0xc'),auth[_0x0b6f('0x7')](),controller['show']);router[_0x0b6f('0xd')]('/',auth[_0x0b6f('0x7')](),interaction[_0x0b6f('0xe')](_0x0b6f('0xf'),_0x0b6f('0x10')),controller[_0x0b6f('0x11')]);router[_0x0b6f('0xd')](_0x0b6f('0x12'),controller[_0x0b6f('0x13')]);router[_0x0b6f('0x14')](_0x0b6f('0xc'),auth['isAuthenticated'](),controller[_0x0b6f('0x15')]);router[_0x0b6f('0x14')](_0x0b6f('0x16'),auth[_0x0b6f('0x7')](),controller['accept']);router[_0x0b6f('0x14')](_0x0b6f('0x17'),auth[_0x0b6f('0x7')](),controller[_0x0b6f('0x18')]);router[_0x0b6f('0x19')]('/:id',auth[_0x0b6f('0x7')](),controller[_0x0b6f('0x1a')]);module[_0x0b6f('0x1b')]=router; \ No newline at end of file +var _0x93be=['create','post','/:id/status','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','express','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','tracked','sms','smsmessage:create'];(function(_0xfcbf57,_0x4b05fd){var _0x1078fa=function(_0xb65856){while(--_0xb65856){_0xfcbf57['push'](_0xfcbf57['shift']());}};_0x1078fa(++_0x4b05fd);}(_0x93be,0xba));var _0xe93b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93be[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xe93b('0x0'));var path=require(_0xe93b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe93b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe93b('0x3'));var config=require(_0xe93b('0x4'));var controller=require(_0xe93b('0x5'));router[_0xe93b('0x6')]('/',auth[_0xe93b('0x7')](),controller[_0xe93b('0x8')]);router[_0xe93b('0x6')](_0xe93b('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xe93b('0x6')](_0xe93b('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe93b('0x7')](),interaction[_0xe93b('0xb')](_0xe93b('0xc'),_0xe93b('0xd')),controller[_0xe93b('0xe')]);router[_0xe93b('0xf')](_0xe93b('0x10'),controller['status']);router['put'](_0xe93b('0xa'),auth[_0xe93b('0x7')](),controller[_0xe93b('0x11')]);router[_0xe93b('0x12')](_0xe93b('0x13'),auth[_0xe93b('0x7')](),controller[_0xe93b('0x14')]);router[_0xe93b('0x12')](_0xe93b('0x15'),auth[_0xe93b('0x7')](),controller[_0xe93b('0x16')]);router['delete'](_0xe93b('0xa'),auth['isAuthenticated'](),controller[_0xe93b('0x17')]);module[_0xe93b('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a3c51bf..7292f00 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 _0xd64d=['out','STRING','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x3b342b,_0x1cf3ba){var _0x4a2716=function(_0x337658){while(--_0x337658){_0x3b342b['push'](_0x3b342b['shift']());}};_0x4a2716(++_0x1cf3ba);}(_0xd64d,0x123));var _0xdd64=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd64d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdd64('0x0'));module['exports']={'body':{'type':Sequelize[_0xdd64('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xdd64('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdd64('0x3')),'defaultValue':_0xdd64('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdd64('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xdd64('0x5')]},'secret':{'type':Sequelize[_0xdd64('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdd64('0x4')]},'providerResponse':{'type':Sequelize[_0xdd64('0x1')]}}; \ No newline at end of file +var _0xe554=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x3cda08,_0x5889fd){var _0x40fb49=function(_0x3ef79a){while(--_0x3ef79a){_0x3cda08['push'](_0x3cda08['shift']());}};_0x40fb49(++_0x5889fd);}(_0xe554,0x127));var _0x4e55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe554[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e55('0x0'));module['exports']={'body':{'type':Sequelize[_0x4e55('0x1')](_0x4e55('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4e55('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e55('0x4')]('in',_0x4e55('0x5')),'defaultValue':_0x4e55('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4e55('0x6')](0xbe)},'phone':{'type':Sequelize[_0x4e55('0x6')]},'readAt':{'type':Sequelize[_0x4e55('0x7')]},'secret':{'type':Sequelize[_0x4e55('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4e55('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7ff29a3..349648f 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 _0x5e48=['mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','stringify','error','code','message','request\x20sent','result','catch','SmsMessage,\x20%s,\x20%s','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','SmsMessage','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','../../config/logger','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','reject','sms','SmsInteractionId','RejectMessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','results','groupName','DELIVERED','infobip','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x1adda4,_0x537884){var _0x4f9025=function(_0x1b82eb){while(--_0x1b82eb){_0x1adda4['push'](_0x1adda4['shift']());}};_0x4f9025(++_0x537884);}(_0x5e48,0x84));var _0x85e4=function(_0x5191d2,_0x5d066e){_0x5191d2=_0x5191d2-0x0;var _0x1a8993=_0x5e48[_0x5191d2];return _0x1a8993;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85e4('0x0'));var zipdir=require(_0x85e4('0x1'));var jsonpatch=require(_0x85e4('0x2'));var rp=require(_0x85e4('0x3'));var moment=require('moment');var BPromise=require(_0x85e4('0x4'));var Mustache=require(_0x85e4('0x5'));var util=require('util');var path=require(_0x85e4('0x6'));var sox=require(_0x85e4('0x7'));var csv=require(_0x85e4('0x8'));var ejs=require(_0x85e4('0x9'));var fs=require('fs');var _=require(_0x85e4('0xa'));var squel=require('squel');var crypto=require(_0x85e4('0xb'));var jsforce=require(_0x85e4('0xc'));var deskjs=require(_0x85e4('0xd'));var toCsv=require(_0x85e4('0x8'));var querystring=require('querystring');var Papa=require(_0x85e4('0xe'));var Redis=require(_0x85e4('0xf'));var authService=require(_0x85e4('0x10'));var qs=require(_0x85e4('0x11'));var as=require(_0x85e4('0x12'));var hardwareService=require(_0x85e4('0x13'));var logger=require('../../config/logger')(_0x85e4('0x14'));var utils=require(_0x85e4('0x15'));var config=require(_0x85e4('0x16'));var licenseUtil=require(_0x85e4('0x17'));var db=require(_0x85e4('0x18'))['db'];config['redis']=_[_0x85e4('0x19')](config[_0x85e4('0x1a')],{'host':_0x85e4('0x1b'),'port':0x18eb});var socket=require(_0x85e4('0x1c'))(new Redis(config['redis']));require(_0x85e4('0x1d'))[_0x85e4('0x1e')](socket);var jayson=require(_0x85e4('0x1f'));var client=jayson[_0x85e4('0x20')][_0x85e4('0x21')]({'port':0x232c});var client9002=jayson[_0x85e4('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31116b,_0x8827f2,_0x215ba4,_0x4988d5){return new BPromise(function(_0x5de8ad,_0x1c3bcc){var _0x3a0426=_0x4988d5||client;return _0x3a0426[_0x85e4('0x22')](_0x31116b,_0x215ba4)['then'](function(_0x41b0aa){logger[_0x85e4('0x23')]('SmsMessage,\x20%s,\x20%s',_0x8827f2,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8827f2,'request\x20sent',JSON[_0x85e4('0x24')](_0x41b0aa));if(_0x41b0aa[_0x85e4('0x25')]){if(_0x41b0aa[_0x85e4('0x25')][_0x85e4('0x26')]===0x1f4){logger[_0x85e4('0x25')]('SmsMessage,\x20%s,\x20%s',_0x8827f2,_0x41b0aa[_0x85e4('0x25')][_0x85e4('0x27')]);return _0x1c3bcc(_0x41b0aa[_0x85e4('0x25')][_0x85e4('0x27')]);}logger[_0x85e4('0x25')]('SmsMessage,\x20%s,\x20%s',_0x8827f2,_0x41b0aa[_0x85e4('0x25')][_0x85e4('0x27')]);return _0x5de8ad(_0x41b0aa[_0x85e4('0x25')][_0x85e4('0x27')]);}else{logger[_0x85e4('0x23')]('SmsMessage,\x20%s,\x20%s',_0x8827f2,_0x85e4('0x28'));_0x5de8ad(_0x41b0aa[_0x85e4('0x29')]['message']);}})[_0x85e4('0x2a')](function(_0x273856){logger[_0x85e4('0x25')](_0x85e4('0x2b'),_0x8827f2,_0x273856);_0x1c3bcc(_0x273856);});});}function respondWithStatusCode(_0x15f83e,_0x34427e){_0x34427e=_0x34427e||0xcc;return function(_0x53bd8e){if(_0x53bd8e){return _0x15f83e[_0x85e4('0x2c')](_0x34427e);}return _0x15f83e[_0x85e4('0x2d')](_0x34427e)[_0x85e4('0x2e')]();};}function respondWithResult(_0x2c6fc8,_0x2aba96){_0x2aba96=_0x2aba96||0xc8;return function(_0x448123){if(_0x448123){return _0x2c6fc8[_0x85e4('0x2d')](_0x2aba96)[_0x85e4('0x2f')](_0x448123);}};}function respondWithFilteredResult(_0x5039f1,_0x2d0d9b){return function(_0x469492){if(_0x469492){var _0x4a9355=_0x469492[_0x85e4('0x30')],_0x3012fe=_0x2d0d9b[_0x85e4('0x31')],_0x2d770e=_0x2d0d9b[_0x85e4('0x31')]+_0x2d0d9b['limit'],_0x4c0d9b;if(_0x2d770e>=_0x4a9355){_0x2d770e=_0x4a9355;_0x4c0d9b=0xc8;}else{_0x4c0d9b=0xce;}_0x5039f1[_0x85e4('0x2d')](_0x4c0d9b);return _0x5039f1['set'](_0x85e4('0x32'),_0x3012fe+'-'+_0x2d770e+'/'+_0x4a9355)[_0x85e4('0x2f')](_0x469492);}return null;};}function patchUpdates(_0x395cc8){return function(_0x2846a5){try{jsonpatch[_0x85e4('0x33')](_0x2846a5,_0x395cc8,!![]);}catch(_0x402245){return BPromise['reject'](_0x402245);}return _0x2846a5[_0x85e4('0x34')]();};}function saveUpdates(_0x29ded6,_0x2cdffd){return function(_0x90400b){if(_0x90400b){return _0x90400b[_0x85e4('0x35')](_0x29ded6)['then'](function(_0x872085){return _0x872085;});}return null;};}function removeEntity(_0x552c24,_0x9b72f3){return function(_0xd1944b){if(_0xd1944b){return _0xd1944b[_0x85e4('0x36')]()[_0x85e4('0x37')](function(){_0x552c24[_0x85e4('0x2d')](0xcc)[_0x85e4('0x2e')]();});}};}function handleEntityNotFound(_0x3caf00,_0x10872a){return function(_0x302b72){if(!_0x302b72){_0x3caf00['sendStatus'](0x194);}return _0x302b72;};}function handleError(_0x3b0df1,_0x556145){_0x556145=_0x556145||0x1f4;return function(_0xf1c1fe){logger[_0x85e4('0x25')](_0xf1c1fe[_0x85e4('0x38')]);if(_0xf1c1fe[_0x85e4('0x39')]){delete _0xf1c1fe[_0x85e4('0x39')];}_0x3b0df1[_0x85e4('0x2d')](_0x556145)[_0x85e4('0x3a')](_0xf1c1fe);};}exports[_0x85e4('0x3b')]=function(_0x7a5345,_0x279f6c){var _0x43457c={},_0x2010d8={},_0x17b6e0={'count':0x0,'rows':[]};var _0x239063=_[_0x85e4('0x3c')](db[_0x85e4('0x3d')]['rawAttributes'],function(_0x33a6b1){return{'name':_0x33a6b1[_0x85e4('0x3e')],'type':_0x33a6b1[_0x85e4('0x3f')][_0x85e4('0x40')]};});_0x2010d8['model']=_[_0x85e4('0x3c')](_0x239063,_0x85e4('0x39'));_0x2010d8[_0x85e4('0x41')]=_[_0x85e4('0x42')](_0x7a5345[_0x85e4('0x41')]);_0x2010d8['filters']=_[_0x85e4('0x43')](_0x2010d8[_0x85e4('0x44')],_0x2010d8[_0x85e4('0x41')]);_0x43457c[_0x85e4('0x45')]=_[_0x85e4('0x43')](_0x2010d8[_0x85e4('0x44')],qs[_0x85e4('0x46')](_0x7a5345[_0x85e4('0x41')][_0x85e4('0x46')]));_0x43457c[_0x85e4('0x45')]=_0x43457c['attributes'][_0x85e4('0x47')]?_0x43457c[_0x85e4('0x45')]:_0x2010d8[_0x85e4('0x44')];if(!_0x7a5345['query'][_0x85e4('0x48')](_0x85e4('0x49'))){_0x43457c['limit']=qs[_0x85e4('0x4a')](_0x7a5345[_0x85e4('0x41')][_0x85e4('0x4a')]);_0x43457c[_0x85e4('0x31')]=qs[_0x85e4('0x31')](_0x7a5345[_0x85e4('0x41')][_0x85e4('0x31')]);}_0x43457c[_0x85e4('0x4b')]=qs['sort'](_0x7a5345['query']['sort']);_0x43457c[_0x85e4('0x4c')]=qs[_0x85e4('0x4d')](_[_0x85e4('0x4e')](_0x7a5345['query'],_0x2010d8[_0x85e4('0x4d')]),_0x239063);if(_0x7a5345[_0x85e4('0x41')][_0x85e4('0x4f')]){_0x43457c[_0x85e4('0x4c')]=_['merge'](_0x43457c[_0x85e4('0x4c')],{'$or':_[_0x85e4('0x3c')](_0x239063,function(_0x473441){if(_0x473441[_0x85e4('0x3f')]!=='VIRTUAL'){var _0x15d5cb={};_0x15d5cb[_0x473441['name']]={'$like':'%'+_0x7a5345[_0x85e4('0x41')]['filter']+'%'};return _0x15d5cb;}})});}_0x43457c=_[_0x85e4('0x50')]({},_0x43457c,_0x7a5345[_0x85e4('0x51')]);var _0x26ffc9={'where':_0x43457c['where']};return db[_0x85e4('0x3d')][_0x85e4('0x30')](_0x26ffc9)[_0x85e4('0x37')](function(_0x1243d4){_0x17b6e0['count']=_0x1243d4;if(_0x7a5345[_0x85e4('0x41')][_0x85e4('0x52')]){_0x43457c[_0x85e4('0x53')]=[{'all':!![]}];}return db[_0x85e4('0x3d')][_0x85e4('0x54')](_0x43457c);})[_0x85e4('0x37')](function(_0x4339dc){_0x17b6e0['rows']=_0x4339dc;return _0x17b6e0;})[_0x85e4('0x37')](respondWithFilteredResult(_0x279f6c,_0x43457c))[_0x85e4('0x2a')](handleError(_0x279f6c,null));};exports[_0x85e4('0x55')]=function(_0x104536,_0xa8813e){var _0x46d31e={'raw':!![],'where':{'id':_0x104536[_0x85e4('0x56')]['id']}},_0x46f36e={};_0x46f36e[_0x85e4('0x44')]=_[_0x85e4('0x42')](db['SmsMessage'][_0x85e4('0x57')]);_0x46f36e['query']=_[_0x85e4('0x42')](_0x104536[_0x85e4('0x41')]);_0x46f36e[_0x85e4('0x4d')]=_['intersection'](_0x46f36e[_0x85e4('0x44')],_0x46f36e[_0x85e4('0x41')]);_0x46d31e[_0x85e4('0x45')]=_[_0x85e4('0x43')](_0x46f36e[_0x85e4('0x44')],qs[_0x85e4('0x46')](_0x104536['query']['fields']));_0x46d31e[_0x85e4('0x45')]=_0x46d31e[_0x85e4('0x45')]['length']?_0x46d31e['attributes']:_0x46f36e[_0x85e4('0x44')];if(_0x104536['query']['includeAll']){_0x46d31e[_0x85e4('0x53')]=[{'all':!![]}];}_0x46d31e=_[_0x85e4('0x50')]({},_0x46d31e,_0x104536[_0x85e4('0x51')]);return db[_0x85e4('0x3d')][_0x85e4('0x58')](_0x46d31e)['then'](handleEntityNotFound(_0xa8813e,null))[_0x85e4('0x37')](respondWithResult(_0xa8813e,null))['catch'](handleError(_0xa8813e,null));};exports[_0x85e4('0x59')]=function(_0x50cb90,_0x58c585){return db[_0x85e4('0x3d')][_0x85e4('0x59')](_0x50cb90[_0x85e4('0x5a')],{})[_0x85e4('0x37')](respondWithResult(_0x58c585,0xc9))[_0x85e4('0x2a')](handleError(_0x58c585,null));};exports[_0x85e4('0x35')]=function(_0x2fe822,_0x332e7d){if(_0x2fe822['body']['id']){delete _0x2fe822[_0x85e4('0x5a')]['id'];}return db['SmsMessage'][_0x85e4('0x58')]({'where':{'id':_0x2fe822[_0x85e4('0x56')]['id']}})[_0x85e4('0x37')](handleEntityNotFound(_0x332e7d,null))[_0x85e4('0x37')](saveUpdates(_0x2fe822[_0x85e4('0x5a')],null))[_0x85e4('0x37')](respondWithResult(_0x332e7d,null))[_0x85e4('0x2a')](handleError(_0x332e7d,null));};exports[_0x85e4('0x36')]=function(_0xbf944b,_0x284eed){return db[_0x85e4('0x3d')][_0x85e4('0x58')]({'where':{'id':_0xbf944b[_0x85e4('0x56')]['id']}})['then'](handleEntityNotFound(_0x284eed,null))[_0x85e4('0x37')](removeEntity(_0x284eed,null))[_0x85e4('0x2a')](handleError(_0x284eed,null));};exports[_0x85e4('0x5b')]=function(_0x4e74fd,_0x1426f0){return db['SmsMessage'][_0x85e4('0x5b')]()[_0x85e4('0x37')](respondWithResult(_0x1426f0,null))[_0x85e4('0x2a')](handleError(_0x1426f0,null));};var interaction_log=require(_0x85e4('0x5c'))('sms-interactions');exports[_0x85e4('0x5d')]=function(_0x242f0a,_0x26451c,_0x5b0632){var _0x4df389={'channel':'sms'};if(_0x242f0a[_0x85e4('0x5a')]['id']){delete _0x242f0a[_0x85e4('0x5a')]['id'];}_0x242f0a[_0x85e4('0x5a')]['read']=!![];_0x242f0a[_0x85e4('0x5a')][_0x85e4('0x5e')]=moment()[_0x85e4('0x5f')](_0x85e4('0x60'));_0x242f0a['body']['UserId']=_0x242f0a[_0x85e4('0x5a')][_0x85e4('0x61')]||_0x242f0a['user']['id'];return db[_0x85e4('0x3d')][_0x85e4('0x58')]({'where':{'id':_0x242f0a[_0x85e4('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x85e4('0x62')],'as':_0x85e4('0x63')}]})['then'](handleEntityNotFound(_0x26451c,null))[_0x85e4('0x37')](saveUpdates(_0x242f0a['body'],null))[_0x85e4('0x37')](function(_0xdd33f8){if(_0xdd33f8){_0x4df389[_0x85e4('0x27')]=_0xdd33f8[_0x85e4('0x64')]({'plain':!![]});return db[_0x85e4('0x65')]['find']({'where':{'id':_0xdd33f8['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x26451c,null))[_0x85e4('0x37')](function(_0x2f5a98){if(_0x2f5a98){return _0x2f5a98[_0x85e4('0x35')]({'UserId':_0x242f0a[_0x85e4('0x5a')][_0x85e4('0x61')],'read1stAt':_[_0x85e4('0x66')](_0x2f5a98['read1stAt'])?moment()['format'](_0x85e4('0x60')):undefined});}return null;})[_0x85e4('0x37')](function(_0x571442){if(_0x571442){_0x4df389[_0x85e4('0x67')]=_0x571442[_0x85e4('0x64')]({'plain':!![]});interaction_log[_0x85e4('0x23')](_0x85e4('0x68'),_0x242f0a[_0x85e4('0x69')]['id'],_0x242f0a[_0x85e4('0x69')][_0x85e4('0x39')],_0x242f0a[_0x85e4('0x69')][_0x85e4('0x6a')],_0x4df389[_0x85e4('0x67')]['id'],_0x242f0a[_0x85e4('0x5a')]?JSON[_0x85e4('0x24')](_0x242f0a[_0x85e4('0x5a')]):_0x85e4('0x6b'));return respondWithRpcPromise(_0x85e4('0x6c'),_0x85e4('0x6d'),_0x4df389);}return null;})['then'](function(_0x1a3a7e){if(_0x1a3a7e){if(_0x242f0a['body'][_0x85e4('0x6e')]){_0x4df389[_0x85e4('0x27')][_0x85e4('0x6f')]=util[_0x85e4('0x5f')](_0x85e4('0x70'),_0x242f0a[_0x85e4('0x69')]['name']);_0x4df389[_0x85e4('0x27')]['channel']=_0x4df389[_0x85e4('0x71')];_0x4df389['message'][_0x85e4('0x72')]=_0x85e4('0x5d');return respondWithRpcPromise(_0x85e4('0x73'),_0x85e4('0x73'),{'event':'acceptmessage','message':_0x4df389[_0x85e4('0x27')]},client9002)[_0x85e4('0x37')](function(){return _0x4df389;});}return _0x4df389;}return null;})[_0x85e4('0x37')](respondWithResult(_0x26451c,null))[_0x85e4('0x2a')](handleError(_0x26451c,null));};var interaction_log=require(_0x85e4('0x5c'))('sms-interactions');exports[_0x85e4('0x74')]=function(_0x1610e0,_0x2f41c1,_0x13e137){var _0x59258d={'agent':{},'channel':_0x85e4('0x75')};if(_0x1610e0['body']['id']){delete _0x1610e0[_0x85e4('0x5a')]['id'];}_0x1610e0['body'][_0x85e4('0x61')]=_0x1610e0['body']['UserId']||_0x1610e0[_0x85e4('0x69')]['id'];_0x59258d['agent']['id']=_0x1610e0[_0x85e4('0x5a')][_0x85e4('0x61')];return db[_0x85e4('0x3d')]['find']({'where':{'id':_0x1610e0[_0x85e4('0x56')]['id'],'UserId':null}})[_0x85e4('0x37')](handleEntityNotFound(_0x2f41c1,null))[_0x85e4('0x37')](function(_0x357d23){if(_0x357d23){_0x59258d[_0x85e4('0x27')]=_0x357d23[_0x85e4('0x64')]({'plain':!![]});return db[_0x85e4('0x65')]['find']({'where':{'id':_0x357d23[_0x85e4('0x76')]}});}return null;})[_0x85e4('0x37')](handleEntityNotFound(_0x2f41c1,null))[_0x85e4('0x37')](function(_0x4087cb){if(_0x4087cb){_0x59258d[_0x85e4('0x67')]=_0x4087cb[_0x85e4('0x64')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1610e0[_0x85e4('0x69')]['id'],_0x1610e0[_0x85e4('0x69')]['name'],_0x1610e0[_0x85e4('0x69')]['role'],_0x59258d[_0x85e4('0x67')]['id'],_0x1610e0[_0x85e4('0x5a')]?JSON['stringify'](_0x1610e0['body']):'null');return respondWithRpcPromise(_0x85e4('0x77'),'rejectMessage',_0x59258d);}return null;})[_0x85e4('0x37')](function(_0x1a3133){if(_0x1a3133){_0x1a3133[_0x85e4('0x27')]['interface']=util[_0x85e4('0x5f')](_0x85e4('0x70'),_0x1610e0[_0x85e4('0x69')]['name']);_0x1a3133['message'][_0x85e4('0x71')]=_0x59258d['channel'];_0x1a3133['message']['event']=_0x85e4('0x74');respondWithRpcPromise(_0x85e4('0x73'),_0x85e4('0x73'),{'event':'rejectmessage','message':_0x1a3133['message']},client9002);return _0x59258d;}return null;})['then'](respondWithResult(_0x2f41c1,null))[_0x85e4('0x2a')](handleError(_0x2f41c1,null));};exports[_0x85e4('0x2d')]=function(_0x3fffd3,_0x536ecc,_0x5dea0){if(_0x3fffd3['body']['id']){delete _0x3fffd3[_0x85e4('0x5a')]['id'];}var _0x4b7b58;return db[_0x85e4('0x3d')][_0x85e4('0x58')]({'where':{'id':_0x3fffd3[_0x85e4('0x56')]['id']}})['then'](handleEntityNotFound(_0x536ecc,null))[_0x85e4('0x37')](function(_0x3d39ae){if(_0x3d39ae){_0x4b7b58=_0x3d39ae;return db['SmsAccount'][_0x85e4('0x58')]({'where':{'id':_0x3d39ae[_0x85e4('0x78')]}});}})[_0x85e4('0x37')](handleEntityNotFound(_0x536ecc,null))[_0x85e4('0x37')](function(_0x4a46e6){if(_0x4a46e6){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x85e4('0x79'),_0x4a46e6['type'],util[_0x85e4('0x7a')](_0x3fffd3[_0x85e4('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4a46e6[_0x85e4('0x3f')]){case'twilio':if(_0x3fffd3[_0x85e4('0x5a')][_0x85e4('0x7b')]&&_0x3fffd3[_0x85e4('0x5a')]['MessageSid']===_0x4b7b58[_0x85e4('0x7c')]){return _0x4b7b58[_0x85e4('0x35')]({'read':!![]});}else{logger[_0x85e4('0x25')](_0x85e4('0x7d'),_0x85e4('0x2d'),_0x85e4('0x7e'),util[_0x85e4('0x7a')](_0x3fffd3['body'],{'showHidden':![],'depth':null}));}break;case _0x85e4('0x7f'):if(_0x3fffd3['body'][_0x85e4('0x80')]&&_0x3fffd3['body']['MessageUUID']===_0x4b7b58[_0x85e4('0x7c')]&&_[_0x85e4('0x81')]([_0x85e4('0x82'),'delivered'],_0x3fffd3[_0x85e4('0x5a')][_0x85e4('0x83')])>=0x0){return _0x4b7b58[_0x85e4('0x35')]({'read':!![]});}else{logger[_0x85e4('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x85e4('0x2d'),_0x85e4('0x84'),util['inspect'](_0x3fffd3[_0x85e4('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xb12332=_0x3fffd3['body'][_0x85e4('0x85')][0x0];if(_0xb12332[_0x85e4('0x2d')][_0x85e4('0x86')]===_0x85e4('0x87')){return _0x4b7b58[_0x85e4('0x35')]({'read':!![]});}else{logger['error'](_0x85e4('0x7d'),_0x85e4('0x2d'),_0x85e4('0x88'),util[_0x85e4('0x7a')](_0x3fffd3[_0x85e4('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4b7b58;}})['then'](respondWithResult(_0x536ecc,null))[_0x85e4('0x2a')](handleError(_0x536ecc,null));}; \ No newline at end of file +var _0x45cf=['MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','update','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','SmsInteraction','isNil','interaction','user','role','null','AcceptMessage','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','sms','agent','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo'];(function(_0xfcecfe,_0x1027e8){var _0x5b926b=function(_0x5e7396){while(--_0x5e7396){_0xfcecfe['push'](_0xfcecfe['shift']());}};_0x5b926b(++_0x1027e8);}(_0x45cf,0x90));var _0xf45c=function(_0x41f663,_0x5996bd){_0x41f663=_0x41f663-0x0;var _0x1cd296=_0x45cf[_0x41f663];return _0x1cd296;};'use strict';var pdf=require(_0xf45c('0x0'));var emlformat=require(_0xf45c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf45c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf45c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf45c('0x4'));var util=require(_0xf45c('0x5'));var path=require(_0xf45c('0x6'));var sox=require(_0xf45c('0x7'));var csv=require('to-csv');var ejs=require(_0xf45c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf45c('0x9'));var crypto=require(_0xf45c('0xa'));var jsforce=require(_0xf45c('0xb'));var deskjs=require(_0xf45c('0xc'));var toCsv=require(_0xf45c('0xd'));var querystring=require('querystring');var Papa=require(_0xf45c('0xe'));var Redis=require('ioredis');var authService=require(_0xf45c('0xf'));var qs=require(_0xf45c('0x10'));var as=require(_0xf45c('0x11'));var hardwareService=require(_0xf45c('0x12'));var logger=require(_0xf45c('0x13'))(_0xf45c('0x14'));var utils=require(_0xf45c('0x15'));var config=require(_0xf45c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf45c('0x17'))['db'];config['redis']=_[_0xf45c('0x18')](config[_0xf45c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf45c('0x1a'))(new Redis(config[_0xf45c('0x19')]));require(_0xf45c('0x1b'))[_0xf45c('0x1c')](socket);var jayson=require(_0xf45c('0x1d'));var client=jayson[_0xf45c('0x1e')][_0xf45c('0x1f')]({'port':0x232c});var client9002=jayson[_0xf45c('0x1e')][_0xf45c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1a0366,_0x2824f7,_0x3b871a,_0x203f7b){return new BPromise(function(_0x293ae8,_0x53d9d0){var _0x252bea=_0x203f7b||client;return _0x252bea[_0xf45c('0x20')](_0x1a0366,_0x3b871a)['then'](function(_0x569841){logger['info'](_0xf45c('0x21'),_0x2824f7,_0xf45c('0x22'));logger[_0xf45c('0x23')](_0xf45c('0x24'),_0x2824f7,_0xf45c('0x22'),JSON[_0xf45c('0x25')](_0x569841));if(_0x569841[_0xf45c('0x26')]){if(_0x569841[_0xf45c('0x26')][_0xf45c('0x27')]===0x1f4){logger[_0xf45c('0x26')](_0xf45c('0x21'),_0x2824f7,_0x569841[_0xf45c('0x26')]['message']);return _0x53d9d0(_0x569841[_0xf45c('0x26')][_0xf45c('0x28')]);}logger[_0xf45c('0x26')](_0xf45c('0x21'),_0x2824f7,_0x569841[_0xf45c('0x26')][_0xf45c('0x28')]);return _0x293ae8(_0x569841['error'][_0xf45c('0x28')]);}else{logger[_0xf45c('0x29')]('SmsMessage,\x20%s,\x20%s',_0x2824f7,_0xf45c('0x22'));_0x293ae8(_0x569841['result'][_0xf45c('0x28')]);}})[_0xf45c('0x2a')](function(_0x6ce00f){logger['error'](_0xf45c('0x21'),_0x2824f7,_0x6ce00f);_0x53d9d0(_0x6ce00f);});});}function respondWithStatusCode(_0x5af535,_0x124d11){_0x124d11=_0x124d11||0xcc;return function(_0x28c1a6){if(_0x28c1a6){return _0x5af535[_0xf45c('0x2b')](_0x124d11);}return _0x5af535[_0xf45c('0x2c')](_0x124d11)[_0xf45c('0x2d')]();};}function respondWithResult(_0x5ede5d,_0xeaa192){_0xeaa192=_0xeaa192||0xc8;return function(_0x528083){if(_0x528083){return _0x5ede5d[_0xf45c('0x2c')](_0xeaa192)[_0xf45c('0x2e')](_0x528083);}};}function respondWithFilteredResult(_0x443006,_0x59d133){return function(_0x47e053){if(_0x47e053){var _0x3f1325=_0x47e053[_0xf45c('0x2f')],_0x3dd818=_0x59d133[_0xf45c('0x30')],_0x4d1f3d=_0x59d133[_0xf45c('0x30')]+_0x59d133[_0xf45c('0x31')],_0x187118;if(_0x4d1f3d>=_0x3f1325){_0x4d1f3d=_0x3f1325;_0x187118=0xc8;}else{_0x187118=0xce;}_0x443006[_0xf45c('0x2c')](_0x187118);return _0x443006['set'](_0xf45c('0x32'),_0x3dd818+'-'+_0x4d1f3d+'/'+_0x3f1325)[_0xf45c('0x2e')](_0x47e053);}return null;};}function patchUpdates(_0x1fecca){return function(_0x3dfab6){try{jsonpatch['apply'](_0x3dfab6,_0x1fecca,!![]);}catch(_0x28270d){return BPromise[_0xf45c('0x33')](_0x28270d);}return _0x3dfab6[_0xf45c('0x34')]();};}function saveUpdates(_0x62d232,_0x2460e7){return function(_0xc51571){if(_0xc51571){return _0xc51571['update'](_0x62d232)[_0xf45c('0x35')](function(_0x13a25f){return _0x13a25f;});}return null;};}function removeEntity(_0x1cd55e,_0xe4c74f){return function(_0x5465e7){if(_0x5465e7){return _0x5465e7[_0xf45c('0x36')]()[_0xf45c('0x35')](function(){_0x1cd55e[_0xf45c('0x2c')](0xcc)[_0xf45c('0x2d')]();});}};}function handleEntityNotFound(_0x165144,_0x7042b4){return function(_0x11c4d1){if(!_0x11c4d1){_0x165144[_0xf45c('0x2b')](0x194);}return _0x11c4d1;};}function handleError(_0x3c4d67,_0x599577){_0x599577=_0x599577||0x1f4;return function(_0x108ea5){logger[_0xf45c('0x26')](_0x108ea5[_0xf45c('0x37')]);if(_0x108ea5[_0xf45c('0x38')]){delete _0x108ea5[_0xf45c('0x38')];}_0x3c4d67[_0xf45c('0x2c')](_0x599577)[_0xf45c('0x39')](_0x108ea5);};}exports[_0xf45c('0x3a')]=function(_0x599776,_0xacfb15){var _0x2842b6={},_0x4971a6={},_0x4ed49a={'count':0x0,'rows':[]};var _0xec49ec=_[_0xf45c('0x3b')](db[_0xf45c('0x3c')][_0xf45c('0x3d')],function(_0x23aa6a){return{'name':_0x23aa6a[_0xf45c('0x3e')],'type':_0x23aa6a[_0xf45c('0x3f')]['key']};});_0x4971a6[_0xf45c('0x40')]=_['map'](_0xec49ec,_0xf45c('0x38'));_0x4971a6[_0xf45c('0x41')]=_[_0xf45c('0x42')](_0x599776['query']);_0x4971a6[_0xf45c('0x43')]=_[_0xf45c('0x44')](_0x4971a6[_0xf45c('0x40')],_0x4971a6['query']);_0x2842b6['attributes']=_['intersection'](_0x4971a6['model'],qs[_0xf45c('0x45')](_0x599776[_0xf45c('0x41')][_0xf45c('0x45')]));_0x2842b6[_0xf45c('0x46')]=_0x2842b6[_0xf45c('0x46')]['length']?_0x2842b6[_0xf45c('0x46')]:_0x4971a6['model'];if(!_0x599776[_0xf45c('0x41')][_0xf45c('0x47')](_0xf45c('0x48'))){_0x2842b6[_0xf45c('0x31')]=qs[_0xf45c('0x31')](_0x599776['query']['limit']);_0x2842b6[_0xf45c('0x30')]=qs[_0xf45c('0x30')](_0x599776['query'][_0xf45c('0x30')]);}_0x2842b6['order']=qs[_0xf45c('0x49')](_0x599776[_0xf45c('0x41')][_0xf45c('0x49')]);_0x2842b6['where']=qs['filters'](_[_0xf45c('0x4a')](_0x599776[_0xf45c('0x41')],_0x4971a6[_0xf45c('0x43')]),_0xec49ec);if(_0x599776[_0xf45c('0x41')]['filter']){_0x2842b6[_0xf45c('0x4b')]=_[_0xf45c('0x4c')](_0x2842b6['where'],{'$or':_[_0xf45c('0x3b')](_0xec49ec,function(_0x32eba0){if(_0x32eba0[_0xf45c('0x3f')]!==_0xf45c('0x4d')){var _0x34a969={};_0x34a969[_0x32eba0[_0xf45c('0x38')]]={'$like':'%'+_0x599776[_0xf45c('0x41')]['filter']+'%'};return _0x34a969;}})});}_0x2842b6=_[_0xf45c('0x4c')]({},_0x2842b6,_0x599776[_0xf45c('0x4e')]);var _0x2745c6={'where':_0x2842b6[_0xf45c('0x4b')]};return db['SmsMessage']['count'](_0x2745c6)[_0xf45c('0x35')](function(_0x4d42b7){_0x4ed49a['count']=_0x4d42b7;if(_0x599776[_0xf45c('0x41')][_0xf45c('0x4f')]){_0x2842b6[_0xf45c('0x50')]=[{'all':!![]}];}return db[_0xf45c('0x3c')][_0xf45c('0x51')](_0x2842b6);})['then'](function(_0x5904f5){_0x4ed49a[_0xf45c('0x52')]=_0x5904f5;return _0x4ed49a;})[_0xf45c('0x35')](respondWithFilteredResult(_0xacfb15,_0x2842b6))[_0xf45c('0x2a')](handleError(_0xacfb15,null));};exports[_0xf45c('0x53')]=function(_0xf9d529,_0x4b5ae7){var _0x1a387d={'raw':!![],'where':{'id':_0xf9d529[_0xf45c('0x54')]['id']}},_0x5abf56={};_0x5abf56[_0xf45c('0x40')]=_[_0xf45c('0x42')](db[_0xf45c('0x3c')][_0xf45c('0x3d')]);_0x5abf56['query']=_[_0xf45c('0x42')](_0xf9d529['query']);_0x5abf56['filters']=_[_0xf45c('0x44')](_0x5abf56[_0xf45c('0x40')],_0x5abf56[_0xf45c('0x41')]);_0x1a387d['attributes']=_[_0xf45c('0x44')](_0x5abf56[_0xf45c('0x40')],qs[_0xf45c('0x45')](_0xf9d529[_0xf45c('0x41')]['fields']));_0x1a387d['attributes']=_0x1a387d['attributes'][_0xf45c('0x55')]?_0x1a387d[_0xf45c('0x46')]:_0x5abf56[_0xf45c('0x40')];if(_0xf9d529[_0xf45c('0x41')][_0xf45c('0x4f')]){_0x1a387d['include']=[{'all':!![]}];}_0x1a387d=_['merge']({},_0x1a387d,_0xf9d529[_0xf45c('0x4e')]);return db[_0xf45c('0x3c')][_0xf45c('0x56')](_0x1a387d)[_0xf45c('0x35')](handleEntityNotFound(_0x4b5ae7,null))[_0xf45c('0x35')](respondWithResult(_0x4b5ae7,null))[_0xf45c('0x2a')](handleError(_0x4b5ae7,null));};exports[_0xf45c('0x57')]=function(_0x58227c,_0x50625f){return db[_0xf45c('0x3c')][_0xf45c('0x57')](_0x58227c['body'],{})[_0xf45c('0x35')](respondWithResult(_0x50625f,0xc9))[_0xf45c('0x2a')](handleError(_0x50625f,null));};exports[_0xf45c('0x58')]=function(_0x3d24ed,_0x48562b){if(_0x3d24ed['body']['id']){delete _0x3d24ed[_0xf45c('0x59')]['id'];}return db['SmsMessage'][_0xf45c('0x56')]({'where':{'id':_0x3d24ed[_0xf45c('0x54')]['id']}})['then'](handleEntityNotFound(_0x48562b,null))[_0xf45c('0x35')](saveUpdates(_0x3d24ed[_0xf45c('0x59')],null))['then'](respondWithResult(_0x48562b,null))[_0xf45c('0x2a')](handleError(_0x48562b,null));};exports[_0xf45c('0x36')]=function(_0x45c9e4,_0x656ebe){return db[_0xf45c('0x3c')]['find']({'where':{'id':_0x45c9e4[_0xf45c('0x54')]['id']}})[_0xf45c('0x35')](handleEntityNotFound(_0x656ebe,null))[_0xf45c('0x35')](removeEntity(_0x656ebe,null))['catch'](handleError(_0x656ebe,null));};exports[_0xf45c('0x5a')]=function(_0x30a3df,_0x5e3397){return db[_0xf45c('0x3c')][_0xf45c('0x5a')]()['then'](respondWithResult(_0x5e3397,null))[_0xf45c('0x2a')](handleError(_0x5e3397,null));};var interaction_log=require(_0xf45c('0x13'))('sms-interactions');exports[_0xf45c('0x5b')]=function(_0x34756a,_0x52f4cb,_0x1be143){var _0x3d0e4d={'channel':'sms'};if(_0x34756a[_0xf45c('0x59')]['id']){delete _0x34756a['body']['id'];}_0x34756a[_0xf45c('0x59')][_0xf45c('0x5c')]=!![];_0x34756a[_0xf45c('0x59')][_0xf45c('0x5d')]=moment()[_0xf45c('0x5e')](_0xf45c('0x5f'));_0x34756a[_0xf45c('0x59')][_0xf45c('0x60')]=_0x34756a[_0xf45c('0x59')][_0xf45c('0x60')]||_0x34756a['user']['id'];return db[_0xf45c('0x3c')][_0xf45c('0x56')]({'where':{'id':_0x34756a[_0xf45c('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xf45c('0x61')],'as':'Contact'}]})[_0xf45c('0x35')](handleEntityNotFound(_0x52f4cb,null))['then'](saveUpdates(_0x34756a[_0xf45c('0x59')],null))[_0xf45c('0x35')](function(_0x39122e){if(_0x39122e){_0x3d0e4d['message']=_0x39122e[_0xf45c('0x62')]({'plain':!![]});return db[_0xf45c('0x63')][_0xf45c('0x56')]({'where':{'id':_0x39122e['SmsInteractionId']}});}return null;})[_0xf45c('0x35')](handleEntityNotFound(_0x52f4cb,null))[_0xf45c('0x35')](function(_0x32cab7){if(_0x32cab7){return _0x32cab7['update']({'UserId':_0x34756a[_0xf45c('0x59')][_0xf45c('0x60')],'read1stAt':_[_0xf45c('0x64')](_0x32cab7['read1stAt'])?moment()[_0xf45c('0x5e')](_0xf45c('0x5f')):undefined});}return null;})[_0xf45c('0x35')](function(_0x3c7820){if(_0x3c7820){_0x3d0e4d[_0xf45c('0x65')]=_0x3c7820[_0xf45c('0x62')]({'plain':!![]});interaction_log[_0xf45c('0x29')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x34756a[_0xf45c('0x66')]['id'],_0x34756a['user'][_0xf45c('0x38')],_0x34756a[_0xf45c('0x66')][_0xf45c('0x67')],_0x3d0e4d[_0xf45c('0x65')]['id'],_0x34756a[_0xf45c('0x59')]?JSON[_0xf45c('0x25')](_0x34756a[_0xf45c('0x59')]):_0xf45c('0x68'));return respondWithRpcPromise(_0xf45c('0x69'),_0xf45c('0x6a'),_0x3d0e4d);}return null;})[_0xf45c('0x35')](function(_0xffb35c){if(_0xffb35c){if(_0x34756a[_0xf45c('0x59')]['manual']){_0x3d0e4d['message']['interface']=util[_0xf45c('0x5e')](_0xf45c('0x6b'),_0x34756a[_0xf45c('0x66')][_0xf45c('0x38')]);_0x3d0e4d[_0xf45c('0x28')]['channel']=_0x3d0e4d[_0xf45c('0x6c')];_0x3d0e4d[_0xf45c('0x28')][_0xf45c('0x6d')]='accept';return respondWithRpcPromise('EventManager',_0xf45c('0x6e'),{'event':_0xf45c('0x6f'),'message':_0x3d0e4d[_0xf45c('0x28')]},client9002)[_0xf45c('0x35')](function(){return _0x3d0e4d;});}return _0x3d0e4d;}return null;})[_0xf45c('0x35')](respondWithResult(_0x52f4cb,null))['catch'](handleError(_0x52f4cb,null));};var interaction_log=require('../../config/logger')(_0xf45c('0x70'));exports[_0xf45c('0x33')]=function(_0xb643af,_0xca8bf8,_0x1998eb){var _0x21ce5b={'agent':{},'channel':_0xf45c('0x71')};if(_0xb643af['body']['id']){delete _0xb643af[_0xf45c('0x59')]['id'];}_0xb643af[_0xf45c('0x59')][_0xf45c('0x60')]=_0xb643af['body'][_0xf45c('0x60')]||_0xb643af['user']['id'];_0x21ce5b[_0xf45c('0x72')]['id']=_0xb643af[_0xf45c('0x59')][_0xf45c('0x60')];return db[_0xf45c('0x3c')][_0xf45c('0x56')]({'where':{'id':_0xb643af[_0xf45c('0x54')]['id'],'UserId':null}})[_0xf45c('0x35')](handleEntityNotFound(_0xca8bf8,null))[_0xf45c('0x35')](function(_0x3c9dd3){if(_0x3c9dd3){_0x21ce5b[_0xf45c('0x28')]=_0x3c9dd3['get']({'plain':!![]});return db[_0xf45c('0x63')]['find']({'where':{'id':_0x3c9dd3[_0xf45c('0x73')]}});}return null;})[_0xf45c('0x35')](handleEntityNotFound(_0xca8bf8,null))[_0xf45c('0x35')](function(_0x26e4dd){if(_0x26e4dd){_0x21ce5b['interaction']=_0x26e4dd[_0xf45c('0x62')]({'plain':!![]});interaction_log[_0xf45c('0x29')](_0xf45c('0x74'),_0xb643af[_0xf45c('0x66')]['id'],_0xb643af[_0xf45c('0x66')][_0xf45c('0x38')],_0xb643af[_0xf45c('0x66')][_0xf45c('0x67')],_0x21ce5b[_0xf45c('0x65')]['id'],_0xb643af[_0xf45c('0x59')]?JSON[_0xf45c('0x25')](_0xb643af['body']):_0xf45c('0x68'));return respondWithRpcPromise(_0xf45c('0x75'),'rejectMessage',_0x21ce5b);}return null;})[_0xf45c('0x35')](function(_0x54514c){if(_0x54514c){_0x54514c[_0xf45c('0x28')][_0xf45c('0x76')]=util[_0xf45c('0x5e')](_0xf45c('0x6b'),_0xb643af[_0xf45c('0x66')][_0xf45c('0x38')]);_0x54514c[_0xf45c('0x28')][_0xf45c('0x6c')]=_0x21ce5b['channel'];_0x54514c[_0xf45c('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0xf45c('0x6e'),{'event':'rejectmessage','message':_0x54514c['message']},client9002);return _0x21ce5b;}return null;})[_0xf45c('0x35')](respondWithResult(_0xca8bf8,null))['catch'](handleError(_0xca8bf8,null));};exports[_0xf45c('0x2c')]=function(_0x2ad8d1,_0x390a3e,_0x2e9833){if(_0x2ad8d1[_0xf45c('0x59')]['id']){delete _0x2ad8d1[_0xf45c('0x59')]['id'];}var _0x376ab0;return db[_0xf45c('0x3c')]['find']({'where':{'id':_0x2ad8d1[_0xf45c('0x54')]['id']}})[_0xf45c('0x35')](handleEntityNotFound(_0x390a3e,null))[_0xf45c('0x35')](function(_0x3bbdae){if(_0x3bbdae){_0x376ab0=_0x3bbdae;return db[_0xf45c('0x77')][_0xf45c('0x56')]({'where':{'id':_0x3bbdae[_0xf45c('0x78')]}});}})[_0xf45c('0x35')](handleEntityNotFound(_0x390a3e,null))[_0xf45c('0x35')](function(_0x4dfbf7){if(_0x4dfbf7){logger[_0xf45c('0x23')](_0xf45c('0x24'),_0xf45c('0x2c'),_0xf45c('0x79'),_0x4dfbf7['type'],util[_0xf45c('0x7a')](_0x2ad8d1[_0xf45c('0x59')],{'showHidden':![],'depth':null}));switch(_0x4dfbf7['type']){case _0xf45c('0x7b'):if(_0x2ad8d1['body']['MessageSid']&&_0x2ad8d1[_0xf45c('0x59')][_0xf45c('0x7c')]===_0x376ab0[_0xf45c('0x7d')]){return _0x376ab0[_0xf45c('0x58')]({'read':!![]});}else{logger[_0xf45c('0x26')](_0xf45c('0x7e'),'status',_0xf45c('0x7b'),util['inspect'](_0x2ad8d1[_0xf45c('0x59')],{'showHidden':![],'depth':null}));}break;case _0xf45c('0x7f'):if(_0x2ad8d1[_0xf45c('0x59')][_0xf45c('0x80')]&&_0x2ad8d1[_0xf45c('0x59')][_0xf45c('0x80')]===_0x376ab0[_0xf45c('0x7d')]&&_[_0xf45c('0x81')]([_0xf45c('0x82'),_0xf45c('0x83')],_0x2ad8d1[_0xf45c('0x59')][_0xf45c('0x84')])>=0x0){return _0x376ab0[_0xf45c('0x58')]({'read':!![]});}else{logger[_0xf45c('0x26')](_0xf45c('0x7e'),_0xf45c('0x2c'),'plivio',util[_0xf45c('0x7a')](_0x2ad8d1[_0xf45c('0x59')],{'showHidden':![],'depth':null}));}break;case _0xf45c('0x85'):var _0xc86198=_0x2ad8d1[_0xf45c('0x59')][_0xf45c('0x86')][0x0];if(_0xc86198['status'][_0xf45c('0x87')]==='DELIVERED'){return _0x376ab0[_0xf45c('0x58')]({'read':!![]});}else{logger[_0xf45c('0x26')](_0xf45c('0x7e'),_0xf45c('0x2c'),'infobip',util[_0xf45c('0x7a')](_0x2ad8d1[_0xf45c('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x376ab0;}})['then'](respondWithResult(_0x390a3e,null))['catch'](handleError(_0x390a3e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4506500..e2d7bc5 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 _0x5277=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update'];(function(_0x51cd7a,_0xef2ad){var _0x18e075=function(_0x38c4bb){while(--_0x38c4bb){_0x51cd7a['push'](_0x51cd7a['shift']());}};_0x18e075(++_0xef2ad);}(_0x5277,0xf7));var _0x7527=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5277[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7527('0x0'));var SmsMessage=require(_0x7527('0x1'))['db'][_0x7527('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7527('0x3'),'afterUpdate':_0x7527('0x4'),'afterDestroy':_0x7527('0x5')};function emitEvent(_0x1ba00a){return function(_0x1f260f,_0x4ca6c1,_0x4463e4){SmsMessageEvents['emit'](_0x1ba00a+':'+_0x1f260f['id'],_0x1f260f);SmsMessageEvents[_0x7527('0x6')](_0x1ba00a,_0x1f260f);_0x4463e4(null);};}for(var e in events){if(events[_0x7527('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x7527('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x0f5c=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x0f5c,0x1cd));var _0xc0f5=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0x0f5c[_0x6978c0];return _0x361377;};'use strict';var EventEmitter=require(_0xc0f5('0x0'));var SmsMessage=require(_0xc0f5('0x1'))['db'][_0xc0f5('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc0f5('0x3')](0x0);var events={'afterCreate':_0xc0f5('0x4'),'afterUpdate':_0xc0f5('0x5'),'afterDestroy':_0xc0f5('0x6')};function emitEvent(_0x430c13){return function(_0x51937c,_0x42113f,_0x7f2f2b){SmsMessageEvents[_0xc0f5('0x7')](_0x430c13+':'+_0x51937c['id'],_0x51937c);SmsMessageEvents['emit'](_0x430c13,_0x51937c);_0x7f2f2b(null);};}for(var e in events){if(events[_0xc0f5('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc0f5('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 42e7fac..6109ab3 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 _0x2a2e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','direction','catch','error','out','find','SmsAccountId','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','&password=','password','GET','POST','user_key','session_key','total_sent','update','SmsMessage,\x20%s,\x20%s,\x20%s','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','username','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','message_id','clickSend','authId','Basic\x20%s','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','login','timestamp','keys','sort','apiKey','createHash','md5','digest','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x12c7c4,_0x445b21){var _0x30bbdb=function(_0x3b9a58){while(--_0x3b9a58){_0x12c7c4['push'](_0x12c7c4['shift']());}};_0x30bbdb(++_0x445b21);}(_0x2a2e,0x76));var _0xe2a2=function(_0x584967,_0x5ab620){_0x584967=_0x584967-0x0;var _0x546acc=_0x2a2e[_0x584967];return _0x546acc;};'use strict';var _=require(_0xe2a2('0x0'));var util=require(_0xe2a2('0x1'));var logger=require(_0xe2a2('0x2'))(_0xe2a2('0x3'));var moment=require(_0xe2a2('0x4'));var BPromise=require(_0xe2a2('0x5'));var rp=require(_0xe2a2('0x6'));var fs=require('fs');var path=require(_0xe2a2('0x7'));var rimraf=require(_0xe2a2('0x8'));var config=require(_0xe2a2('0x9'));var attributes=require(_0xe2a2('0xa'));module[_0xe2a2('0xb')]=function(_0x3f1d8a,_0x11286a){return _0x3f1d8a[_0xe2a2('0xc')]('SmsMessage',attributes,{'tableName':_0xe2a2('0xd'),'paranoid':![],'indexes':[{'name':_0xe2a2('0xe'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xe2a2('0xf')],'type':_0xe2a2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d2595,_0xd7e12f,_0x2d5d9c){var _0x1603e4=_0x3f1d8a[_0xe2a2('0x11')];var _0x1ceb67=_0x4d2595['get']({'plain':!![]});if(_0x1ceb67['direction'][_0xe2a2('0x12')]()==='in'||_0x1ceb67['direction'][_0xe2a2('0x12')]()==='out'&&!_0x1ceb67[_0xe2a2('0x13')]&&!_[_0xe2a2('0x14')](_0x1ceb67[_0xe2a2('0x15')])){_0x1603e4[_0xe2a2('0x16')][_0xe2a2('0x17')]({'where':{'id':_0x1ceb67[_0xe2a2('0x18')]}})[_0xe2a2('0x19')](function(_0x221e82){if(_0x221e82){_0x221e82['update']({'lastMsgAt':_0x1ceb67['createdAt'],'lastMsgDirection':_0x1ceb67[_0xe2a2('0x1a')][_0xe2a2('0x12')]()});}})[_0xe2a2('0x1b')](function(_0x49840b){console[_0xe2a2('0x1c')](_0x49840b);});}if(_0x1ceb67[_0xe2a2('0x1a')]===_0xe2a2('0x1d')&&!_0x1ceb67[_0xe2a2('0x13')]){var _0x3da1b4;_0x1603e4['SmsAccount'][_0xe2a2('0x1e')]({'where':{'id':_0x1ceb67[_0xe2a2('0x1f')]},'raw':!![]})['then'](function(_0x28ffef){_0x3da1b4=_0x28ffef;if(_0x3da1b4&&_0x3da1b4[_0xe2a2('0x20')]){switch(_0x3da1b4['type']){case _0xe2a2('0x21'):var _0x4e7bc5=require(_0xe2a2('0x21'));if(_0x3da1b4['accountSid']&&_0x3da1b4[_0xe2a2('0x22')]&&_0x3da1b4[_0xe2a2('0x23')]){var _0x305a6e=new _0x4e7bc5(_0x3da1b4['accountSid'],_0x3da1b4[_0xe2a2('0x22')]);_0x305a6e[_0xe2a2('0x24')][_0xe2a2('0x25')]({'body':_0x1ceb67[_0xe2a2('0xf')],'to':_0x1ceb67[_0xe2a2('0x23')],'from':_0x3da1b4[_0xe2a2('0x23')],'statusCallback':_0x3da1b4[_0xe2a2('0x26')]+_0xe2a2('0x27')+_0x1ceb67['id']+_0xe2a2('0x28')+_0x3da1b4[_0xe2a2('0x29')]})[_0xe2a2('0x19')](function(_0x436e5e){if(_0x436e5e[_0xe2a2('0x2a')]){return _0x4d2595['update']({'messageId':_0x436e5e[_0xe2a2('0x2a')]});}})[_0xe2a2('0x1b')](function(_0x2b4b27){logger[_0xe2a2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe2a2('0x21'),util[_0xe2a2('0x2b')](_0x2b4b27,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2a2('0x2c'),_0xe2a2('0x21'),_0xe2a2('0x2d'));}break;case _0xe2a2('0x2e'):var _0x5a535a=_0xe2a2('0x2f');if(_0x3da1b4['username']&&_0x3da1b4['password']){var _0x263d9b={'recipient':[_0x1ceb67[_0xe2a2('0x23')]],'message':_0x1ceb67[_0xe2a2('0xf')],'message_type':_0x3da1b4[_0xe2a2('0x30')]};if(_0x3da1b4['smsMethod']&&_0x3da1b4['smsMethod']!=='SI'){_0x263d9b[_0xe2a2('0x31')]=_0x3da1b4[_0xe2a2('0x23')];}var _0x414f16={'url':_0x5a535a+_0xe2a2('0x32')+_0x3da1b4['username']+_0xe2a2('0x33')+_0x3da1b4[_0xe2a2('0x34')],'method':_0xe2a2('0x35')};rp(_0x414f16)[_0xe2a2('0x19')](function(_0x1335b1){var _0x179200=_0x1335b1['split'](';');var _0x1117c5={'user_key':_0x179200[0x0],'session_key':_0x179200[0x1]};_0x414f16={'url':_0x5a535a+'sms','method':_0xe2a2('0x36'),'headers':{'user_key':_0x1117c5[_0xe2a2('0x37')],'Session_key':_0x1117c5[_0xe2a2('0x38')]},'json':!![],'body':_0x263d9b};return rp(_0x414f16);})[_0xe2a2('0x19')](function(_0x4ed145){if(_0x4ed145[_0xe2a2('0x39')]>=0x1){var _0x1573a8={'messageId':_0x4ed145['internal_order_id']};if(_0x3da1b4[_0xe2a2('0x30')]!=='GP'||!_0x3da1b4['deliveryReport']){_0x1573a8['read']=!![];}return _0x4d2595[_0xe2a2('0x3a')](_0x1573a8);}else{return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),'skebby',util[_0xe2a2('0x2b')](_0x4ed145,{'showHidden':![],'depth':null}));}})['catch'](function(_0x6694da){return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x2e'),util[_0xe2a2('0x2b')](_0x6694da,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe2a2('0x3c'):if(_0x3da1b4[_0xe2a2('0x22')]){var _0x56fe1a={'recipient':_0x1ceb67[_0xe2a2('0x23')],'message':_0x1ceb67[_0xe2a2('0xf')],'sender':_0x3da1b4[_0xe2a2('0x3d')]||_0x3da1b4[_0xe2a2('0x23')],'authorization':_0x3da1b4[_0xe2a2('0x22')]};var _0xd7e12f={'method':_0xe2a2('0x36'),'uri':_0xe2a2('0x3e'),'body':_0x56fe1a,'json':!![]};rp(_0xd7e12f)[_0xe2a2('0x19')](function(_0x1fca3b){var _0x256062={'messageId':_0x1fca3b[_0xe2a2('0x3f')]};if(!_0x3da1b4[_0xe2a2('0x40')]){_0x256062[_0xe2a2('0x41')]=!![];}return _0x4d2595[_0xe2a2('0x3a')](_0x256062);})['catch'](function(_0x28ca4a){logger[_0xe2a2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2a2('0x2c'),_0xe2a2('0x3c'),util[_0xe2a2('0x2b')](_0x28ca4a,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x3c'),_0xe2a2('0x42'));}break;case _0xe2a2('0x43'):if(_0x3da1b4['username']&&_0x3da1b4[_0xe2a2('0x34')]){var _0x56fe1a={'messages':[{'source':_0xe2a2('0x44'),'to':_0x1ceb67[_0xe2a2('0x23')],'body':_0x1ceb67[_0xe2a2('0xf')],'from':_0x3da1b4[_0xe2a2('0x3d')]||_0x3da1b4['phone']}]};var _0x3a1297=util[_0xe2a2('0x45')](_0xe2a2('0x46'),_0x3da1b4[_0xe2a2('0x47')],_0x3da1b4['password']);var _0xd7e12f={'method':_0xe2a2('0x36'),'uri':_0xe2a2('0x48'),'body':_0x56fe1a,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x3a1297)['toString'](_0xe2a2('0x49')))},'json':!![]};rp(_0xd7e12f)[_0xe2a2('0x19')](function(_0x2c1a39){if(_0x2c1a39[_0xe2a2('0x4a')]>=0xc8&&_0x2c1a39['http_code']<=0xce){if(_0x2c1a39[_0xe2a2('0x4b')]&&_0x2c1a39[_0xe2a2('0x4b')][_0xe2a2('0x4c')]>0x0){var _0x54d9eb=_[_0xe2a2('0x4d')](_0x2c1a39[_0xe2a2('0x4b')][_0xe2a2('0x24')]);var _0x394818={'messageId':_0x54d9eb[_0xe2a2('0x4e')]};if(!_0x3da1b4['deliveryReport']){_0x394818['read']=!![];}return _0x4d2595[_0xe2a2('0x3a')](_0x394818);}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x4f'),util['inspect'](_0x2c1a39,{'showHidden':![],'depth':null}));}}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x4f'),util[_0xe2a2('0x2b')](_0x2c1a39,{'showHidden':![],'depth':null}));}})['catch'](function(_0xc366d6){logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x4f'),util[_0xe2a2('0x2b')](_0xc366d6,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x3da1b4[_0xe2a2('0x50')]&&_0x3da1b4['authToken']){var _0x56fe1a={'dst':_0x1ceb67[_0xe2a2('0x23')],'text':_0x1ceb67[_0xe2a2('0xf')],'src':_0x3da1b4[_0xe2a2('0x3d')]||_0x3da1b4['phone'],'url':_0x3da1b4[_0xe2a2('0x26')]+_0xe2a2('0x27')+_0x1ceb67['id']+'/status?token='+_0x3da1b4[_0xe2a2('0x29')]};var _0x3a1297=util[_0xe2a2('0x45')](_0xe2a2('0x46'),_0x3da1b4[_0xe2a2('0x50')],_0x3da1b4[_0xe2a2('0x22')]);var _0xd7e12f={'method':_0xe2a2('0x36'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x3da1b4[_0xe2a2('0x50')]),'body':_0x56fe1a,'headers':{'Authorization':util[_0xe2a2('0x45')](_0xe2a2('0x51'),new Buffer(_0x3a1297)[_0xe2a2('0x52')](_0xe2a2('0x49')))},'json':!![]};rp(_0xd7e12f)['then'](function(_0x127f27){var _0x2a65dc={'messageId':_0x127f27[_0xe2a2('0x53')][0x0]};return _0x4d2595[_0xe2a2('0x3a')](_0x2a65dc);})[_0xe2a2('0x1b')](function(_0x1c6622){logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),'plivo',util['inspect'](_0x1c6622,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x54'),_0xe2a2('0x55'));}break;case _0xe2a2('0x56'):if(_0x3da1b4[_0xe2a2('0x47')]&&_0x3da1b4[_0xe2a2('0x34')]){if(_0x3da1b4[_0xe2a2('0x57')]){var _0xdf45da={'method':_0xe2a2('0x36'),'uri':_0x3da1b4['baseUrl']+_0xe2a2('0x58'),'body':{'username':_0x3da1b4[_0xe2a2('0x47')],'password':_0x3da1b4[_0xe2a2('0x34')]},'json':!![]};return rp(_0xdf45da)[_0xe2a2('0x19')](function(_0x4e04ea){var _0x381923={'method':_0xe2a2('0x36'),'uri':_0x3da1b4[_0xe2a2('0x57')]+_0xe2a2('0x59'),'body':{'messages':[{'from':_0x3da1b4[_0xe2a2('0x23')],'destinations':[{'to':_0x1ceb67[_0xe2a2('0x23')]}],'text':_0x1ceb67[_0xe2a2('0xf')],'notifyUrl':_0x3da1b4['remote']+_0xe2a2('0x27')+_0x1ceb67['id']+'/status?token='+_0x3da1b4['token'],'notifyContentType':_0xe2a2('0x5a'),'callbackData':_0x3da1b4['phone']+';'+_0x1ceb67[_0xe2a2('0xf')]}]},'headers':{'Authorization':_0xe2a2('0x5b')+_0x4e04ea[_0xe2a2('0x29')]},'json':!![]};return rp(_0x381923)['then'](function(_0xeb98f9){if(_0xeb98f9[_0xe2a2('0x24')]){var _0x33ab87={'messageId':_0xeb98f9[_0xe2a2('0x24')][0x0][_0xe2a2('0xe')]};if(!_0x3da1b4['deliveryReport']){_0x33ab87['read']=!![];}return _0x4d2595[_0xe2a2('0x3a')](_0x33ab87);}else{return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x56'),util[_0xe2a2('0x2b')](_0xeb98f9,{'showHidden':![],'depth':null}));}});})[_0xe2a2('0x1b')](function(_0x21ad8a){return logger['error'](_0xe2a2('0x3b'),_0xe2a2('0x2c'),'infobip',util['inspect'](_0x21ad8a,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x56'),_0xe2a2('0x5c'));}}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x56'),_0xe2a2('0x5d'));}break;case _0xe2a2('0x5e'):var _0x10de73=require(_0xe2a2('0x5f'));if(_0x3da1b4['apiKey']){var _0x3165c9={};_0x3165c9[_0xe2a2('0x60')]=_0x3da1b4['username'];_0x3165c9[_0xe2a2('0x23')]=_0x1ceb67['phone'];_0x3165c9[_0xe2a2('0x31')]=_0x3da1b4[_0xe2a2('0x23')];_0x3165c9['text']=_0x1ceb67[_0xe2a2('0xf')];_0x3165c9[_0xe2a2('0x61')]=+new Date();var _0xe5b317='';var _0x105f23='';var _0x126092=Object[_0xe2a2('0x62')](_0x3165c9);_0x126092[_0xe2a2('0x63')]();for(var _0x3c8f02=0x0;_0x3c8f02<_0x126092['length'];_0x3c8f02++){if(_0xe5b317!=''){_0xe5b317+='&';}_0xe5b317+=_0x126092[_0x3c8f02]+'='+encodeURIComponent(_0x3165c9[_0x126092[_0x3c8f02]]);_0x105f23+=_0x3165c9[_0x126092[_0x3c8f02]];}_0x105f23+=_0x3da1b4[_0xe2a2('0x64')];_0x105f23=_0x10de73[_0xe2a2('0x65')](_0xe2a2('0x66'))[_0xe2a2('0x3a')](_0x105f23)[_0xe2a2('0x67')]('hex');if(_0xe5b317!==''){_0xe5b317+='&';}_0xe5b317+=_0xe2a2('0x68')+_0x105f23;var _0x414f16={'method':_0xe2a2('0x35'),'uri':_0x3da1b4['baseUrl']+'/external/get/send.php?'+_0xe5b317,'json':!![]};return rp(_0x414f16)['then'](function(_0x3acf9e){var _0x6c014=Object[_0xe2a2('0x62')](_0x3acf9e);if(_0x3acf9e[_0x6c014[0x0]]['error']&&parseInt(_0x3acf9e[_0x6c014[0x0]]['error'])===0x0){var _0x1f01b6={'messageId':_0x3acf9e[_0x6c014[0x0]][_0xe2a2('0x69')]};if(!_0x3da1b4[_0xe2a2('0x40')]){_0x1f01b6[_0xe2a2('0x41')]=!![];}return _0x4d2595[_0xe2a2('0x3a')](_0x1f01b6);}else{return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),'csc',util[_0xe2a2('0x2b')](_0x3acf9e['error'],{'showHidden':![],'depth':null}));}})[_0xe2a2('0x1b')](function(_0x55f08c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2a2('0x2c'),_0xe2a2('0x5e'),util['inspect'](_0x55f08c,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2a2('0x2c'),_0xe2a2('0x5e'),_0xe2a2('0x6a'));}break;case _0xe2a2('0x6b'):if(_0x3da1b4['apiKey']){var _0x214281={'method':_0xe2a2('0x36'),'uri':_0xe2a2('0x6c'),'headers':{'Authorization':_0x3da1b4['apiKey']},'body':{'content':_0x1ceb67[_0xe2a2('0xf')],'to':[_0x1ceb67[_0xe2a2('0x23')]],'from':_0x3da1b4[_0xe2a2('0x23')],'binary':![],'clientMessageId':_0xe2a2('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x214281)['then'](function(_0x56f6b0){if(!_0x56f6b0[_0xe2a2('0x1c')]){var _0x475da0={'messageId':_0x56f6b0[_0xe2a2('0x24')][0x0][_0xe2a2('0x6e')]};if(!_0x3da1b4['deliveryReport']){_0x475da0[_0xe2a2('0x41')]=!![];}return _0x4d2595[_0xe2a2('0x3a')](_0x475da0);}else{return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),_0xe2a2('0x6b'),util[_0xe2a2('0x2b')](_0x56f6b0[_0xe2a2('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x219e64){return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),'afterCreate',_0xe2a2('0x6b'),util[_0xe2a2('0x2b')](_0x219e64,{'showHidden':![],'depth':null}));});}else{logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),_0xe2a2('0x2c'),'clickatell',_0xe2a2('0x6a'));}break;case _0xe2a2('0x6f'):if(_0x3da1b4[_0xe2a2('0x64')]){var _0x4a7aac={};var _0x414f16={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xe2a2('0x70')+_0x3da1b4[_0xe2a2('0x64')],'Content-Type':'application/json'},'body':{'from':_0x3da1b4[_0xe2a2('0x23')],'to':_0x1ceb67[_0xe2a2('0x23')],'text':_0x1ceb67[_0xe2a2('0xf')]},'json':!![]};return rp(_0x414f16)[_0xe2a2('0x19')](function(_0xaeb309){if(_0xaeb309[_0xe2a2('0x71')]==0xca){_0x4a7aac[_0xe2a2('0x72')]=_0xaeb309;var _0x48bc04={'method':_0xe2a2('0x36'),'uri':_0xe2a2('0x73'),'headers':{'Authorization':_0xe2a2('0x70')+_0x3da1b4[_0xe2a2('0x64')],'Content-Type':_0xe2a2('0x5a')},'body':{'refid':_0x4a7aac[_0xe2a2('0x72')][_0xe2a2('0x74')]},'json':!![]};return rp(_0x48bc04)[_0xe2a2('0x19')](function(_0x2b79d8){_0x4a7aac[_0xe2a2('0x75')]=_0x2b79d8;var _0x34210c={'messageId':_0x4a7aac[_0xe2a2('0x72')][_0xe2a2('0x74')],'read':!![]};return _0x4d2595[_0xe2a2('0x3a')](_0x34210c);});}else{return logger[_0xe2a2('0x1c')](_0xe2a2('0x3b'),'afterCreate',_0xe2a2('0x6f'),util[_0xe2a2('0x2b')](_0xaeb309,{'showHidden':![],'depth':null}));}})[_0xe2a2('0x1b')](function(_0x528c45){return logger[_0xe2a2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2a2('0x2c'),_0xe2a2('0x6f'),util[_0xe2a2('0x2b')](_0x528c45,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xe2a2('0x3b'),'afterCreate',_0xe2a2('0x6f'),_0xe2a2('0x76'));}break;}}})[_0xe2a2('0x77')](function(){_0x2d5d9c();});}else{_0x2d5d9c();}}},'charset':_0xe2a2('0x78'),'collate':_0xe2a2('0x79')});}; \ No newline at end of file +var _0x2213=['update','error','SmsAccount','find','SmsAccountId','type','twilio','phone','authToken','messages','create','body','remote','/api/sms/messages/','token','sid','catch','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','hex','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','then'];(function(_0x34edca,_0x18d9eb){var _0x2e2bf3=function(_0x42f266){while(--_0x42f266){_0x34edca['push'](_0x34edca['shift']());}};_0x2e2bf3(++_0x18d9eb);}(_0x2213,0x150));var _0x3221=function(_0x330912,_0x45b260){_0x330912=_0x330912-0x0;var _0x31c674=_0x2213[_0x330912];return _0x31c674;};'use strict';var _=require(_0x3221('0x0'));var util=require('util');var logger=require(_0x3221('0x1'))(_0x3221('0x2'));var moment=require(_0x3221('0x3'));var BPromise=require('bluebird');var rp=require(_0x3221('0x4'));var fs=require('fs');var path=require(_0x3221('0x5'));var rimraf=require(_0x3221('0x6'));var config=require(_0x3221('0x7'));var attributes=require(_0x3221('0x8'));module[_0x3221('0x9')]=function(_0x2c65ad,_0x3f4479){return _0x2c65ad[_0x3221('0xa')](_0x3221('0xb'),attributes,{'tableName':_0x3221('0xc'),'paranoid':![],'indexes':[{'name':_0x3221('0xd'),'fields':[_0x3221('0xd')]},{'name':_0x3221('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3667ba,_0x5c92f1,_0x22f49e){var _0x5880c9=_0x2c65ad[_0x3221('0xf')];var _0x3fac25=_0x3667ba['get']({'plain':!![]});if(_0x3fac25[_0x3221('0x10')][_0x3221('0x11')]()==='in'||_0x3fac25['direction'][_0x3221('0x11')]()===_0x3221('0x12')&&!_0x3fac25[_0x3221('0x13')]&&!_[_0x3221('0x14')](_0x3fac25[_0x3221('0x15')])){_0x5880c9[_0x3221('0x16')]['findOne']({'where':{'id':_0x3fac25['SmsInteractionId']}})[_0x3221('0x17')](function(_0x271186){if(_0x271186){_0x271186[_0x3221('0x18')]({'lastMsgAt':_0x3fac25['createdAt'],'lastMsgDirection':_0x3fac25['direction'][_0x3221('0x11')]()});}})['catch'](function(_0x294340){console[_0x3221('0x19')](_0x294340);});}if(_0x3fac25['direction']==='out'&&!_0x3fac25['secret']){var _0x1c79fb;_0x5880c9[_0x3221('0x1a')][_0x3221('0x1b')]({'where':{'id':_0x3fac25[_0x3221('0x1c')]},'raw':!![]})[_0x3221('0x17')](function(_0x1cbbef){_0x1c79fb=_0x1cbbef;if(_0x1c79fb&&_0x1c79fb[_0x3221('0x1d')]){switch(_0x1c79fb['type']){case _0x3221('0x1e'):var _0x27374c=require('twilio');if(_0x1c79fb['accountSid']&&_0x1c79fb['authToken']&&_0x1c79fb[_0x3221('0x1f')]){var _0x5c6875=new _0x27374c(_0x1c79fb['accountSid'],_0x1c79fb[_0x3221('0x20')]);_0x5c6875[_0x3221('0x21')][_0x3221('0x22')]({'body':_0x3fac25[_0x3221('0x23')],'to':_0x3fac25['phone'],'from':_0x1c79fb[_0x3221('0x1f')],'statusCallback':_0x1c79fb[_0x3221('0x24')]+_0x3221('0x25')+_0x3fac25['id']+'/status?token='+_0x1c79fb[_0x3221('0x26')]})[_0x3221('0x17')](function(_0x7f7c75){if(_0x7f7c75[_0x3221('0x27')]){return _0x3667ba['update']({'messageId':_0x7f7c75[_0x3221('0x27')]});}})[_0x3221('0x28')](function(_0x588063){logger[_0x3221('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3221('0x1e'),util[_0x3221('0x29')](_0x588063,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x1e'),_0x3221('0x2c'));}break;case _0x3221('0x2d'):var _0x3ca44f=_0x3221('0x2e');if(_0x1c79fb['username']&&_0x1c79fb[_0x3221('0x2f')]){var _0x24cbb5={'recipient':[_0x3fac25[_0x3221('0x1f')]],'message':_0x3fac25[_0x3221('0x23')],'message_type':_0x1c79fb[_0x3221('0x30')]};if(_0x1c79fb[_0x3221('0x30')]&&_0x1c79fb[_0x3221('0x30')]!=='SI'){_0x24cbb5[_0x3221('0x31')]=_0x1c79fb[_0x3221('0x1f')];}var _0x5924c5={'url':_0x3ca44f+_0x3221('0x32')+_0x1c79fb[_0x3221('0x33')]+'&password='+_0x1c79fb[_0x3221('0x2f')],'method':'GET'};rp(_0x5924c5)[_0x3221('0x17')](function(_0x3f6ea9){var _0x198958=_0x3f6ea9[_0x3221('0x34')](';');var _0x5706fa={'user_key':_0x198958[0x0],'session_key':_0x198958[0x1]};_0x5924c5={'url':_0x3ca44f+_0x3221('0x35'),'method':_0x3221('0x36'),'headers':{'user_key':_0x5706fa[_0x3221('0x37')],'Session_key':_0x5706fa[_0x3221('0x38')]},'json':!![],'body':_0x24cbb5};return rp(_0x5924c5);})[_0x3221('0x17')](function(_0x339dae){if(_0x339dae[_0x3221('0x39')]>=0x1){var _0x4cb7d3={'messageId':_0x339dae[_0x3221('0x3a')]};if(_0x1c79fb[_0x3221('0x30')]!=='GP'||!_0x1c79fb[_0x3221('0x3b')]){_0x4cb7d3[_0x3221('0x3c')]=!![];}return _0x3667ba[_0x3221('0x18')](_0x4cb7d3);}else{return logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x2d'),util[_0x3221('0x29')](_0x339dae,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e2db5){return logger['error'](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x2d'),util[_0x3221('0x29')](_0x1e2db5,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x3221('0x3d'):if(_0x1c79fb[_0x3221('0x20')]){var _0x4d857f={'recipient':_0x3fac25['phone'],'message':_0x3fac25[_0x3221('0x23')],'sender':_0x1c79fb[_0x3221('0x3e')]||_0x1c79fb[_0x3221('0x1f')],'authorization':_0x1c79fb[_0x3221('0x20')]};var _0x5c92f1={'method':_0x3221('0x36'),'uri':_0x3221('0x3f'),'body':_0x4d857f,'json':!![]};rp(_0x5c92f1)['then'](function(_0x1b74c1){var _0x10242d={'messageId':_0x1b74c1[_0x3221('0x40')]};if(!_0x1c79fb[_0x3221('0x3b')]){_0x10242d['read']=!![];}return _0x3667ba['update'](_0x10242d);})['catch'](function(_0x2adc5d){logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x3d'),util['inspect'](_0x2adc5d,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3221('0x2b'),_0x3221('0x3d'),_0x3221('0x41'));}break;case'clicksend':if(_0x1c79fb['username']&&_0x1c79fb[_0x3221('0x2f')]){var _0x4d857f={'messages':[{'source':_0x3221('0x42'),'to':_0x3fac25[_0x3221('0x1f')],'body':_0x3fac25[_0x3221('0x23')],'from':_0x1c79fb[_0x3221('0x3e')]||_0x1c79fb[_0x3221('0x1f')]}]};var _0x48ec43=util['format'](_0x3221('0x43'),_0x1c79fb[_0x3221('0x33')],_0x1c79fb[_0x3221('0x2f')]);var _0x5c92f1={'method':_0x3221('0x36'),'uri':_0x3221('0x44'),'body':_0x4d857f,'headers':{'Authorization':util[_0x3221('0x45')](_0x3221('0x46'),new Buffer(_0x48ec43)[_0x3221('0x47')](_0x3221('0x48')))},'json':!![]};rp(_0x5c92f1)[_0x3221('0x17')](function(_0x44a5ed){if(_0x44a5ed['http_code']>=0xc8&&_0x44a5ed[_0x3221('0x49')]<=0xce){if(_0x44a5ed['data']&&_0x44a5ed[_0x3221('0x4a')]['queued_count']>0x0){var _0x866ace=_['head'](_0x44a5ed['data'][_0x3221('0x21')]);var _0x2ddd63={'messageId':_0x866ace[_0x3221('0x4b')]};if(!_0x1c79fb[_0x3221('0x3b')]){_0x2ddd63[_0x3221('0x3c')]=!![];}return _0x3667ba['update'](_0x2ddd63);}else{logger[_0x3221('0x19')](_0x3221('0x2a'),'afterCreate','clickSend',util['inspect'](_0x44a5ed,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x4c'),util[_0x3221('0x29')](_0x44a5ed,{'showHidden':![],'depth':null}));}})['catch'](function(_0x29e032){logger[_0x3221('0x19')](_0x3221('0x2a'),'afterCreate',_0x3221('0x4c'),util[_0x3221('0x29')](_0x29e032,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),'clickSend',_0x3221('0x4d'));}break;case'plivo':if(_0x1c79fb['authId']&&_0x1c79fb[_0x3221('0x20')]){var _0x4d857f={'dst':_0x3fac25[_0x3221('0x1f')],'text':_0x3fac25[_0x3221('0x23')],'src':_0x1c79fb[_0x3221('0x3e')]||_0x1c79fb[_0x3221('0x1f')],'url':_0x1c79fb['remote']+_0x3221('0x25')+_0x3fac25['id']+_0x3221('0x4e')+_0x1c79fb[_0x3221('0x26')]};var _0x48ec43=util[_0x3221('0x45')](_0x3221('0x43'),_0x1c79fb['authId'],_0x1c79fb[_0x3221('0x20')]);var _0x5c92f1={'method':_0x3221('0x36'),'uri':util[_0x3221('0x45')](_0x3221('0x4f'),_0x1c79fb['authId']),'body':_0x4d857f,'headers':{'Authorization':util[_0x3221('0x45')](_0x3221('0x46'),new Buffer(_0x48ec43)[_0x3221('0x47')](_0x3221('0x48')))},'json':!![]};rp(_0x5c92f1)[_0x3221('0x17')](function(_0x210895){var _0x408c6d={'messageId':_0x210895[_0x3221('0x50')][0x0]};return _0x3667ba['update'](_0x408c6d);})[_0x3221('0x28')](function(_0x3e7d19){logger['error'](_0x3221('0x2a'),'afterCreate',_0x3221('0x51'),util[_0x3221('0x29')](_0x3e7d19,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x51'),_0x3221('0x52'));}break;case'infobip':if(_0x1c79fb[_0x3221('0x33')]&&_0x1c79fb[_0x3221('0x2f')]){if(_0x1c79fb[_0x3221('0x53')]){var _0x4446b6={'method':_0x3221('0x36'),'uri':_0x1c79fb['baseUrl']+_0x3221('0x54'),'body':{'username':_0x1c79fb[_0x3221('0x33')],'password':_0x1c79fb[_0x3221('0x2f')]},'json':!![]};return rp(_0x4446b6)[_0x3221('0x17')](function(_0x34d982){var _0xb8dbfa={'method':_0x3221('0x36'),'uri':_0x1c79fb[_0x3221('0x53')]+_0x3221('0x55'),'body':{'messages':[{'from':_0x1c79fb[_0x3221('0x1f')],'destinations':[{'to':_0x3fac25[_0x3221('0x1f')]}],'text':_0x3fac25[_0x3221('0x23')],'notifyUrl':_0x1c79fb[_0x3221('0x24')]+_0x3221('0x25')+_0x3fac25['id']+_0x3221('0x4e')+_0x1c79fb[_0x3221('0x26')],'notifyContentType':_0x3221('0x56'),'callbackData':_0x1c79fb[_0x3221('0x1f')]+';'+_0x3fac25[_0x3221('0x23')]}]},'headers':{'Authorization':_0x3221('0x57')+_0x34d982[_0x3221('0x26')]},'json':!![]};return rp(_0xb8dbfa)[_0x3221('0x17')](function(_0x1db458){if(_0x1db458[_0x3221('0x21')]){var _0x159987={'messageId':_0x1db458[_0x3221('0x21')][0x0][_0x3221('0xd')]};if(!_0x1c79fb['deliveryReport']){_0x159987[_0x3221('0x3c')]=!![];}return _0x3667ba[_0x3221('0x18')](_0x159987);}else{return logger['error'](_0x3221('0x2a'),'afterCreate',_0x3221('0x58'),util[_0x3221('0x29')](_0x1db458,{'showHidden':![],'depth':null}));}});})[_0x3221('0x28')](function(_0x4a5fac){return logger['error'](_0x3221('0x2a'),_0x3221('0x2b'),'infobip',util[_0x3221('0x29')](_0x4a5fac,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x58'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),'infobip',_0x3221('0x4d'));}break;case'csc':var _0x55adff=require('crypto');if(_0x1c79fb[_0x3221('0x59')]){var _0x35f60d={};_0x35f60d[_0x3221('0x5a')]=_0x1c79fb[_0x3221('0x33')];_0x35f60d[_0x3221('0x1f')]=_0x3fac25[_0x3221('0x1f')];_0x35f60d['sender']=_0x1c79fb[_0x3221('0x1f')];_0x35f60d[_0x3221('0x5b')]=_0x3fac25[_0x3221('0x23')];_0x35f60d[_0x3221('0x5c')]=+new Date();var _0x1d0a11='';var _0x1feb28='';var _0x215c16=Object[_0x3221('0x5d')](_0x35f60d);_0x215c16[_0x3221('0x5e')]();for(var _0x4e0fc9=0x0;_0x4e0fc9<_0x215c16[_0x3221('0x5f')];_0x4e0fc9++){if(_0x1d0a11!=''){_0x1d0a11+='&';}_0x1d0a11+=_0x215c16[_0x4e0fc9]+'='+encodeURIComponent(_0x35f60d[_0x215c16[_0x4e0fc9]]);_0x1feb28+=_0x35f60d[_0x215c16[_0x4e0fc9]];}_0x1feb28+=_0x1c79fb[_0x3221('0x59')];_0x1feb28=_0x55adff[_0x3221('0x60')](_0x3221('0x61'))['update'](_0x1feb28)['digest'](_0x3221('0x62'));if(_0x1d0a11!==''){_0x1d0a11+='&';}_0x1d0a11+='signature='+_0x1feb28;var _0x5924c5={'method':_0x3221('0x63'),'uri':_0x1c79fb[_0x3221('0x53')]+_0x3221('0x64')+_0x1d0a11,'json':!![]};return rp(_0x5924c5)['then'](function(_0x42b19e){var _0x866c13=Object[_0x3221('0x5d')](_0x42b19e);if(_0x42b19e[_0x866c13[0x0]][_0x3221('0x19')]&&parseInt(_0x42b19e[_0x866c13[0x0]][_0x3221('0x19')])===0x0){var _0x545185={'messageId':_0x42b19e[_0x866c13[0x0]][_0x3221('0x65')]};if(!_0x1c79fb[_0x3221('0x3b')]){_0x545185[_0x3221('0x3c')]=!![];}return _0x3667ba['update'](_0x545185);}else{return logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),'csc',util[_0x3221('0x29')](_0x42b19e[_0x3221('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a21fb){return logger[_0x3221('0x19')](_0x3221('0x2a'),'afterCreate',_0x3221('0x66'),util[_0x3221('0x29')](_0x2a21fb,{'showHidden':![],'depth':null}));});}else{logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x66'),_0x3221('0x67'));}break;case _0x3221('0x68'):if(_0x1c79fb[_0x3221('0x59')]){var _0x369800={'method':'POST','uri':_0x3221('0x69'),'headers':{'Authorization':_0x1c79fb['apiKey']},'body':{'content':_0x3fac25[_0x3221('0x23')],'to':[_0x3fac25['phone']],'from':_0x1c79fb[_0x3221('0x1f')],'binary':![],'clientMessageId':_0x3221('0x6a'),'charset':_0x3221('0x6b')},'json':!![]};rp(_0x369800)[_0x3221('0x17')](function(_0x1d4bf9){if(!_0x1d4bf9['error']){var _0x1169c3={'messageId':_0x1d4bf9[_0x3221('0x21')][0x0][_0x3221('0x6c')]};if(!_0x1c79fb[_0x3221('0x3b')]){_0x1169c3[_0x3221('0x3c')]=!![];}return _0x3667ba[_0x3221('0x18')](_0x1169c3);}else{return logger[_0x3221('0x19')](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x68'),util['inspect'](_0x1d4bf9[_0x3221('0x19')],{'showHidden':![],'depth':null}));}})[_0x3221('0x28')](function(_0x40c658){return logger['error'](_0x3221('0x2a'),_0x3221('0x2b'),_0x3221('0x68'),util[_0x3221('0x29')](_0x40c658,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3221('0x2b'),_0x3221('0x68'),_0x3221('0x67'));}break;case _0x3221('0x6d'):if(_0x1c79fb[_0x3221('0x59')]){var _0x1edb3e={};var _0x5924c5={'method':_0x3221('0x36'),'uri':_0x3221('0x6e'),'headers':{'Authorization':_0x3221('0x6f')+_0x1c79fb[_0x3221('0x59')],'Content-Type':_0x3221('0x56')},'body':{'from':_0x1c79fb[_0x3221('0x1f')],'to':_0x3fac25[_0x3221('0x1f')],'text':_0x3fac25[_0x3221('0x23')]},'json':!![]};return rp(_0x5924c5)[_0x3221('0x17')](function(_0x85c86f){if(_0x85c86f[_0x3221('0x70')]==0xca){_0x1edb3e[_0x3221('0x71')]=_0x85c86f;var _0x300a30={'method':_0x3221('0x36'),'uri':_0x3221('0x72'),'headers':{'Authorization':_0x3221('0x6f')+_0x1c79fb[_0x3221('0x59')],'Content-Type':'application/json'},'body':{'refid':_0x1edb3e[_0x3221('0x71')][_0x3221('0x73')]},'json':!![]};return rp(_0x300a30)['then'](function(_0x20cf7d){_0x1edb3e[_0x3221('0x74')]=_0x20cf7d;var _0x208a92={'messageId':_0x1edb3e['message'][_0x3221('0x73')],'read':!![]};return _0x3667ba[_0x3221('0x18')](_0x208a92);});}else{return logger[_0x3221('0x19')](_0x3221('0x2a'),'afterCreate',_0x3221('0x6d'),util['inspect'](_0x85c86f,{'showHidden':![],'depth':null}));}})[_0x3221('0x28')](function(_0x367aa4){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3221('0x2b'),_0x3221('0x6d'),util[_0x3221('0x29')](_0x367aa4,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0x3221('0x75')](function(){_0x22f49e();});}else{_0x22f49e();}}},'charset':_0x3221('0x76'),'collate':_0x3221('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d8aec7f..eef7cac 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 _0xe608=['../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','body','options','then','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3b308d,_0x14ee14){var _0x2ce080=function(_0x4c3dd5){while(--_0x4c3dd5){_0x3b308d['push'](_0x3b308d['shift']());}};_0x2ce080(++_0x14ee14);}(_0xe608,0x18f));var _0x8e60=function(_0x59b341,_0x122518){_0x59b341=_0x59b341-0x0;var _0x5690b1=_0xe608[_0x59b341];return _0x5690b1;};'use strict';var _=require('lodash');var util=require(_0x8e60('0x0'));var moment=require(_0x8e60('0x1'));var BPromise=require(_0x8e60('0x2'));var rs=require(_0x8e60('0x3'));var fs=require('fs');var Redis=require(_0x8e60('0x4'));var db=require(_0x8e60('0x5'))['db'];var utils=require(_0x8e60('0x6'));var logger=require(_0x8e60('0x7'))(_0x8e60('0x8'));var config=require(_0x8e60('0x9'));var jayson=require(_0x8e60('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8e60('0xb')](config[_0x8e60('0xc')],{'host':_0x8e60('0xd'),'port':0x18eb});var socket=require(_0x8e60('0xe'))(new Redis(config['redis']));require(_0x8e60('0xf'))[_0x8e60('0x10')](socket);function respondWithRpcPromise(_0x55535f,_0x4538fd,_0x5c126f){return new BPromise(function(_0x135185,_0x3d7182){return client[_0x8e60('0x11')](_0x55535f,_0x5c126f)['then'](function(_0x1a755e){logger[_0x8e60('0x12')]('SmsMessage,\x20%s,\x20%s',_0x4538fd,_0x8e60('0x13'));logger[_0x8e60('0x14')](_0x8e60('0x15'),_0x4538fd,_0x8e60('0x13'),JSON[_0x8e60('0x16')](_0x1a755e));if(_0x1a755e[_0x8e60('0x17')]){if(_0x1a755e[_0x8e60('0x17')][_0x8e60('0x18')]===0x1f4){logger['error'](_0x8e60('0x19'),_0x4538fd,_0x1a755e[_0x8e60('0x17')][_0x8e60('0x1a')]);return _0x3d7182(_0x1a755e[_0x8e60('0x17')][_0x8e60('0x1a')]);}logger[_0x8e60('0x17')](_0x8e60('0x19'),_0x4538fd,_0x1a755e[_0x8e60('0x17')]['message']);return _0x135185(_0x1a755e[_0x8e60('0x17')][_0x8e60('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x4538fd,'request\x20sent');_0x135185(_0x1a755e[_0x8e60('0x1b')][_0x8e60('0x1a')]);}})[_0x8e60('0x1c')](function(_0x2e22fc){logger[_0x8e60('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4538fd,_0x2e22fc);_0x3d7182(_0x2e22fc);});});}exports['CreateSmsMessage']=function(_0x139680){var _0x1c43ae=this;return new Promise(function(_0x4d158d,_0x3d7ae3){return db[_0x8e60('0x1d')]['create'](_0x139680[_0x8e60('0x1e')],{'raw':_0x139680['options']?_0x139680[_0x8e60('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x8e60('0x20')](function(_0x100355){logger[_0x8e60('0x12')](_0x8e60('0x21'),_0x139680);logger[_0x8e60('0x14')]('CreateSmsMessage',_0x139680,JSON['stringify'](_0x100355));_0x4d158d(_0x100355);})[_0x8e60('0x1c')](function(_0x59bf46){logger[_0x8e60('0x17')](_0x8e60('0x21'),_0x59bf46[_0x8e60('0x1a')],_0x139680);_0x3d7ae3(_0x1c43ae[_0x8e60('0x17')](0x1f4,_0x59bf46[_0x8e60('0x1a')]));});});}; \ No newline at end of file +var _0x062d=['error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','body','options','raw','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','then','request\x20sent','stringify'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x062d,0x137));var _0xd062=function(_0xc80bfc,_0x175b63){_0xc80bfc=_0xc80bfc-0x0;var _0x136fe0=_0x062d[_0xc80bfc];return _0x136fe0;};'use strict';var _=require(_0xd062('0x0'));var util=require(_0xd062('0x1'));var moment=require('moment');var BPromise=require(_0xd062('0x2'));var rs=require(_0xd062('0x3'));var fs=require('fs');var Redis=require(_0xd062('0x4'));var db=require(_0xd062('0x5'))['db'];var utils=require(_0xd062('0x6'));var logger=require(_0xd062('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd062('0x8'));var client=jayson[_0xd062('0x9')][_0xd062('0xa')]({'port':0x232a});config[_0xd062('0xb')]=_[_0xd062('0xc')](config[_0xd062('0xb')],{'host':_0xd062('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd062('0xb')]));require(_0xd062('0xe'))[_0xd062('0xf')](socket);function respondWithRpcPromise(_0x513c4f,_0x37b509,_0x4105a1){return new BPromise(function(_0x30ffd9,_0x3b8dc8){return client['request'](_0x513c4f,_0x4105a1)[_0xd062('0x10')](function(_0x384165){logger['info']('SmsMessage,\x20%s,\x20%s',_0x37b509,_0xd062('0x11'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x37b509,_0xd062('0x11'),JSON[_0xd062('0x12')](_0x384165));if(_0x384165[_0xd062('0x13')]){if(_0x384165[_0xd062('0x13')][_0xd062('0x14')]===0x1f4){logger[_0xd062('0x13')](_0xd062('0x15'),_0x37b509,_0x384165[_0xd062('0x13')]['message']);return _0x3b8dc8(_0x384165[_0xd062('0x13')][_0xd062('0x16')]);}logger[_0xd062('0x13')](_0xd062('0x15'),_0x37b509,_0x384165[_0xd062('0x13')][_0xd062('0x16')]);return _0x30ffd9(_0x384165[_0xd062('0x13')][_0xd062('0x16')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x37b509,_0xd062('0x11'));_0x30ffd9(_0x384165['result'][_0xd062('0x16')]);}})[_0xd062('0x17')](function(_0x35b505){logger['error'](_0xd062('0x15'),_0x37b509,_0x35b505);_0x3b8dc8(_0x35b505);});});}exports[_0xd062('0x18')]=function(_0x5b7548){var _0x3b2083=this;return new Promise(function(_0x417047,_0x1fe71f){return db[_0xd062('0x19')]['create'](_0x5b7548[_0xd062('0x1a')],{'raw':_0x5b7548[_0xd062('0x1b')]?_0x5b7548[_0xd062('0x1b')][_0xd062('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5d0b59){logger[_0xd062('0x1d')](_0xd062('0x18'),_0x5b7548);logger['debug'](_0xd062('0x18'),_0x5b7548,JSON['stringify'](_0x5d0b59));_0x417047(_0x5d0b59);})[_0xd062('0x17')](function(_0x3092a6){logger[_0xd062('0x13')](_0xd062('0x18'),_0x3092a6[_0xd062('0x16')],_0x5b7548);_0x1fe71f(_0x3b2083[_0xd062('0x13')](0x1f4,_0x3092a6[_0xd062('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e3a7414..c65f3e9 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 _0x113b=['register','length','smsMessage:','save','remove','update','emit','removeListener'];(function(_0x7bedd5,_0x32c335){var _0x3b6521=function(_0x35332f){while(--_0x35332f){_0x7bedd5['push'](_0x7bedd5['shift']());}};_0x3b6521(++_0x32c335);}(_0x113b,0x10b));var _0xb113=function(_0x3930e2,_0x5223b7){_0x3930e2=_0x3930e2-0x0;var _0x9ea0c5=_0x113b[_0x3930e2];return _0x9ea0c5;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xb113('0x0'),_0xb113('0x1'),_0xb113('0x2')];function createListener(_0x15318e,_0x556c9e){return function(_0xda29ee){_0x556c9e[_0xb113('0x3')](_0x15318e,_0xda29ee);};}function removeListener(_0xfb586c,_0x2511de){return function(){SmsMessageEvents[_0xb113('0x4')](_0xfb586c,_0x2511de);};}exports[_0xb113('0x5')]=function(_0x221bd2){for(var _0x44b786=0x0,_0x4d9be3=events[_0xb113('0x6')];_0x44b786<_0x4d9be3;_0x44b786++){var _0x1a8993=events[_0x44b786];var _0x26fd49=createListener(_0xb113('0x7')+_0x1a8993,_0x221bd2);SmsMessageEvents['on'](_0x1a8993,_0x26fd49);}}; \ No newline at end of file +var _0x202e=['remove','update','emit','removeListener','register','smsMessage:','save'];(function(_0x4dc0d8,_0x4fb4ff){var _0x16bf8e=function(_0x9d4ef6){while(--_0x9d4ef6){_0x4dc0d8['push'](_0x4dc0d8['shift']());}};_0x16bf8e(++_0x4fb4ff);}(_0x202e,0x172));var _0xe202=function(_0x3a1d7d,_0x11dfbd){_0x3a1d7d=_0x3a1d7d-0x0;var _0x2af564=_0x202e[_0x3a1d7d];return _0x2af564;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xe202('0x0'),_0xe202('0x1'),_0xe202('0x2')];function createListener(_0x1372d8,_0x572566){return function(_0x187d97){_0x572566[_0xe202('0x3')](_0x1372d8,_0x187d97);};}function removeListener(_0x2853e5,_0x1a1b85){return function(){SmsMessageEvents[_0xe202('0x4')](_0x2853e5,_0x1a1b85);};}exports[_0xe202('0x5')]=function(_0x162c76){for(var _0x48cd4e=0x0,_0x247f8f=events['length'];_0x48cd4e<_0x247f8f;_0x48cd4e++){var _0x59585c=events[_0x48cd4e];var _0x6514d3=createListener(_0xe202('0x6')+_0x59585c,_0x162c76);SmsMessageEvents['on'](_0x59585c,_0x6514d3);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 05be4ee..3aae658 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 _0x7bd0=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','/:id','destroy'];(function(_0x288c14,_0x5121b9){var _0x119cfd=function(_0x4c6507){while(--_0x4c6507){_0x288c14['push'](_0x288c14['shift']());}};_0x119cfd(++_0x5121b9);}(_0x7bd0,0x111));var _0x07bd=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x7bd0[_0x590a38];return _0xf36626;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var auth=require(_0x07bd('0x6'));var interaction=require(_0x07bd('0x7'));var config=require('../../config/environment');var controller=require(_0x07bd('0x8'));router[_0x07bd('0x9')]('/',auth[_0x07bd('0xa')](),controller[_0x07bd('0xb')]);router[_0x07bd('0x9')](_0x07bd('0xc'),auth[_0x07bd('0xa')](),controller['describe']);router[_0x07bd('0x9')]('/:id',auth[_0x07bd('0xa')](),controller[_0x07bd('0xd')]);router[_0x07bd('0x9')]('/:id/members',auth[_0x07bd('0xa')](),controller[_0x07bd('0xe')]);router[_0x07bd('0x9')](_0x07bd('0xf'),auth['isAuthenticated'](),controller[_0x07bd('0x10')]);router[_0x07bd('0x9')](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x12')]);router[_0x07bd('0x13')]('/',auth[_0x07bd('0xa')](),controller[_0x07bd('0x14')]);router['post']('/:id/teams',auth[_0x07bd('0xa')](),controller[_0x07bd('0x15')]);router[_0x07bd('0x13')](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x16')]);router[_0x07bd('0x17')]('/:id',auth[_0x07bd('0xa')](),controller['update']);router[_0x07bd('0x18')](_0x07bd('0x19'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x1a')]);router[_0x07bd('0x18')]('/:id/teams',auth[_0x07bd('0xa')](),controller[_0x07bd('0x1b')]);router['delete'](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x1c')]);module[_0x07bd('0x1d')]=router; \ No newline at end of file +var _0x6c14=['put','update','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6c14,0xd1));var _0x46c1=function(_0x4187a6,_0x2328b1){_0x4187a6=_0x4187a6-0x0;var _0x21af08=_0x6c14[_0x4187a6];return _0x21af08;};'use strict';var multer=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var path=require(_0x46c1('0x2'));var timeout=require(_0x46c1('0x3'));var express=require(_0x46c1('0x4'));var router=express['Router']();var auth=require(_0x46c1('0x5'));var interaction=require(_0x46c1('0x6'));var config=require(_0x46c1('0x7'));var controller=require('./smsQueue.controller');router[_0x46c1('0x8')]('/',auth[_0x46c1('0x9')](),controller[_0x46c1('0xa')]);router[_0x46c1('0x8')](_0x46c1('0xb'),auth[_0x46c1('0x9')](),controller[_0x46c1('0xc')]);router[_0x46c1('0x8')](_0x46c1('0xd'),auth['isAuthenticated'](),controller[_0x46c1('0xe')]);router[_0x46c1('0x8')](_0x46c1('0xf'),auth['isAuthenticated'](),controller[_0x46c1('0x10')]);router[_0x46c1('0x8')](_0x46c1('0x11'),auth['isAuthenticated'](),controller[_0x46c1('0x12')]);router[_0x46c1('0x8')](_0x46c1('0x13'),auth[_0x46c1('0x9')](),controller['getAgents']);router[_0x46c1('0x14')]('/',auth[_0x46c1('0x9')](),controller['create']);router['post'](_0x46c1('0x11'),auth[_0x46c1('0x9')](),controller[_0x46c1('0x15')]);router[_0x46c1('0x14')](_0x46c1('0x13'),auth['isAuthenticated'](),controller[_0x46c1('0x16')]);router[_0x46c1('0x17')](_0x46c1('0xd'),auth[_0x46c1('0x9')](),controller[_0x46c1('0x18')]);router['delete']('/:id',auth[_0x46c1('0x9')](),controller[_0x46c1('0x19')]);router[_0x46c1('0x1a')](_0x46c1('0x11'),auth[_0x46c1('0x9')](),controller[_0x46c1('0x1b')]);router[_0x46c1('0x1a')]('/:id/users',auth[_0x46c1('0x9')](),controller[_0x46c1('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index a2a4dcd..2739221 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 _0x9da6=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x483049,_0x21755d){var _0x374f67=function(_0x13ad8d){while(--_0x13ad8d){_0x483049['push'](_0x483049['shift']());}};_0x374f67(++_0x21755d);}(_0x9da6,0x114));var _0x69da=function(_0x423561,_0x52371c){_0x423561=_0x423561-0x0;var _0x28da5f=_0x9da6[_0x423561];return _0x28da5f;};'use strict';var Sequelize=require('sequelize');module[_0x69da('0x0')]={'name':{'type':Sequelize[_0x69da('0x1')],'unique':_0x69da('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x69da('0x1')]},'timeout':{'type':Sequelize[_0x69da('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x69da('0x4')](_0x69da('0x5'),_0x69da('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x06ac=['STRING','ENUM','roundrobin','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06ac,0x116));var _0xc06a=function(_0x3444e4,_0x14d6ae){_0x3444e4=_0x3444e4-0x0;var _0x5acba3=_0x06ac[_0x3444e4];return _0x5acba3;};'use strict';var Sequelize=require(_0xc06a('0x0'));module[_0xc06a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc06a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc06a('0x3')]('rrmemory','beepall',_0xc06a('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1bca9fd..7871fc0 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 _0x3baf=['end','error','stack','send','index','map','SmsQueue','rawAttributes','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','SmsQueueId','options','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','compact','value','isEmpty','userSmsQueue:remove','addAgents','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','get','UserProfileResource'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3baf,0xf7));var _0xf3ba=function(_0x3b4d59,_0x5b6efd){_0x3b4d59=_0x3b4d59-0x0;var _0x43b851=_0x3baf[_0x3b4d59];return _0x43b851;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var licenseUtil=require(_0xf3ba('0x1b'));var db=require(_0xf3ba('0x1c'))['db'];config[_0xf3ba('0x1d')]=_[_0xf3ba('0x1e')](config[_0xf3ba('0x1d')],{'host':_0xf3ba('0x1f'),'port':0x18eb});var socket=require(_0xf3ba('0x20'))(new Redis(config['redis']));require(_0xf3ba('0x21'))['register'](socket);function respondWithStatusCode(_0x815037,_0x345fc9){_0x345fc9=_0x345fc9||0xcc;return function(_0x4717be){if(_0x4717be){return _0x815037[_0xf3ba('0x22')](_0x345fc9);}return _0x815037[_0xf3ba('0x23')](_0x345fc9)['end']();};}function respondWithResult(_0x301856,_0x29e45b){_0x29e45b=_0x29e45b||0xc8;return function(_0x13d899){if(_0x13d899){return _0x301856['status'](_0x29e45b)[_0xf3ba('0x24')](_0x13d899);}};}function respondWithFilteredResult(_0x11fbd2,_0x430d64){return function(_0x44de40){if(_0x44de40){var _0x4d3c0a=_0x44de40['count'],_0x1e18ed=_0x430d64[_0xf3ba('0x25')],_0x3b0d9e=_0x430d64[_0xf3ba('0x25')]+_0x430d64[_0xf3ba('0x26')],_0x4e601c;if(_0x3b0d9e>=_0x4d3c0a){_0x3b0d9e=_0x4d3c0a;_0x4e601c=0xc8;}else{_0x4e601c=0xce;}_0x11fbd2['status'](_0x4e601c);return _0x11fbd2[_0xf3ba('0x27')](_0xf3ba('0x28'),_0x1e18ed+'-'+_0x3b0d9e+'/'+_0x4d3c0a)[_0xf3ba('0x24')](_0x44de40);}return null;};}function patchUpdates(_0x7ebcea){return function(_0x23a744){try{jsonpatch[_0xf3ba('0x29')](_0x23a744,_0x7ebcea,!![]);}catch(_0x168961){return BPromise['reject'](_0x168961);}return _0x23a744['save']();};}function saveUpdates(_0x4a065a,_0x349998){return function(_0x220588){if(_0x220588){return _0x220588[_0xf3ba('0x2a')](_0x4a065a)[_0xf3ba('0x2b')](function(_0x2cc01a){return _0x2cc01a;});}return null;};}function removeEntity(_0x545ee1,_0x505560){return function(_0x37fdda){if(_0x37fdda){return _0x37fdda[_0xf3ba('0x2c')]()['then'](function(){var _0x1c9d6a=_0x37fdda[_0xf3ba('0x2d')]({'plain':!![]});var _0x59ce48='SmsQueues';return db[_0xf3ba('0x2e')][_0xf3ba('0x2c')]({'where':{'type':_0x59ce48,'resourceId':_0x1c9d6a['id']}})['then'](function(){return _0x37fdda;});})[_0xf3ba('0x2b')](function(){_0x545ee1[_0xf3ba('0x23')](0xcc)[_0xf3ba('0x2f')]();});}};}function handleEntityNotFound(_0x5a880e,_0x29ed57){return function(_0x4e1708){if(!_0x4e1708){_0x5a880e['sendStatus'](0x194);}return _0x4e1708;};}function handleError(_0x7c1a60,_0x19ef2c){_0x19ef2c=_0x19ef2c||0x1f4;return function(_0x5b4e0d){logger[_0xf3ba('0x30')](_0x5b4e0d[_0xf3ba('0x31')]);if(_0x5b4e0d['name']){delete _0x5b4e0d['name'];}_0x7c1a60['status'](_0x19ef2c)[_0xf3ba('0x32')](_0x5b4e0d);};}exports[_0xf3ba('0x33')]=function(_0x47c15f,_0x16a106){var _0x5b2f0d={},_0x48d81c={},_0x28dee0={'count':0x0,'rows':[]};var _0x2a426c=_[_0xf3ba('0x34')](db[_0xf3ba('0x35')][_0xf3ba('0x36')],function(_0xf1b77a){return{'name':_0xf1b77a['fieldName'],'type':_0xf1b77a[_0xf3ba('0x37')]['key']};});_0x48d81c[_0xf3ba('0x38')]=_[_0xf3ba('0x34')](_0x2a426c,'name');_0x48d81c[_0xf3ba('0x39')]=_[_0xf3ba('0x3a')](_0x47c15f[_0xf3ba('0x39')]);_0x48d81c[_0xf3ba('0x3b')]=_['intersection'](_0x48d81c[_0xf3ba('0x38')],_0x48d81c['query']);_0x5b2f0d['attributes']=_['intersection'](_0x48d81c[_0xf3ba('0x38')],qs[_0xf3ba('0x3c')](_0x47c15f[_0xf3ba('0x39')][_0xf3ba('0x3c')]));_0x5b2f0d[_0xf3ba('0x3d')]=_0x5b2f0d['attributes'][_0xf3ba('0x3e')]?_0x5b2f0d['attributes']:_0x48d81c[_0xf3ba('0x38')];if(!_0x47c15f['query'][_0xf3ba('0x3f')](_0xf3ba('0x40'))){_0x5b2f0d[_0xf3ba('0x26')]=qs[_0xf3ba('0x26')](_0x47c15f['query'][_0xf3ba('0x26')]);_0x5b2f0d[_0xf3ba('0x25')]=qs['offset'](_0x47c15f[_0xf3ba('0x39')][_0xf3ba('0x25')]);}_0x5b2f0d[_0xf3ba('0x41')]=qs[_0xf3ba('0x42')](_0x47c15f[_0xf3ba('0x39')][_0xf3ba('0x42')]);_0x5b2f0d[_0xf3ba('0x43')]=qs['filters'](_[_0xf3ba('0x44')](_0x47c15f['query'],_0x48d81c[_0xf3ba('0x3b')]),_0x2a426c);if(_0x47c15f['query'][_0xf3ba('0x45')]){_0x5b2f0d[_0xf3ba('0x43')]=_[_0xf3ba('0x46')](_0x5b2f0d[_0xf3ba('0x43')],{'$or':_[_0xf3ba('0x34')](_0x2a426c,function(_0x5f3dcc){if(_0x5f3dcc['type']!==_0xf3ba('0x47')){var _0x27b810={};_0x27b810[_0x5f3dcc[_0xf3ba('0x48')]]={'$like':'%'+_0x47c15f[_0xf3ba('0x39')][_0xf3ba('0x45')]+'%'};return _0x27b810;}})});}_0x5b2f0d=_[_0xf3ba('0x46')]({},_0x5b2f0d,_0x47c15f['options']);var _0x1859f6={'where':_0x5b2f0d['where']};return db[_0xf3ba('0x35')][_0xf3ba('0x49')](_0x1859f6)[_0xf3ba('0x2b')](function(_0xa7fd7f){_0x28dee0[_0xf3ba('0x49')]=_0xa7fd7f;if(_0x47c15f[_0xf3ba('0x39')][_0xf3ba('0x4a')]){_0x5b2f0d[_0xf3ba('0x4b')]=[{'all':!![]}];}return db['SmsQueue'][_0xf3ba('0x4c')](_0x5b2f0d);})[_0xf3ba('0x2b')](function(_0x28f857){_0x28dee0[_0xf3ba('0x4d')]=_0x28f857;return _0x28dee0;})[_0xf3ba('0x2b')](respondWithFilteredResult(_0x16a106,_0x5b2f0d))[_0xf3ba('0x4e')](handleError(_0x16a106,null));};exports[_0xf3ba('0x4f')]=function(_0x5f5495,_0x89b179){var _0x35481b={'raw':!![],'where':{'id':_0x5f5495[_0xf3ba('0x50')]['id']}},_0x57ad5a={};_0x57ad5a[_0xf3ba('0x38')]=_[_0xf3ba('0x3a')](db[_0xf3ba('0x35')][_0xf3ba('0x36')]);_0x57ad5a[_0xf3ba('0x39')]=_[_0xf3ba('0x3a')](_0x5f5495[_0xf3ba('0x39')]);_0x57ad5a[_0xf3ba('0x3b')]=_[_0xf3ba('0x51')](_0x57ad5a[_0xf3ba('0x38')],_0x57ad5a[_0xf3ba('0x39')]);_0x35481b[_0xf3ba('0x3d')]=_[_0xf3ba('0x51')](_0x57ad5a[_0xf3ba('0x38')],qs[_0xf3ba('0x3c')](_0x5f5495[_0xf3ba('0x39')][_0xf3ba('0x3c')]));_0x35481b['attributes']=_0x35481b[_0xf3ba('0x3d')][_0xf3ba('0x3e')]?_0x35481b['attributes']:_0x57ad5a[_0xf3ba('0x38')];if(_0x5f5495[_0xf3ba('0x39')][_0xf3ba('0x4a')]){_0x35481b[_0xf3ba('0x4b')]=[{'all':!![]}];}_0x35481b=_['merge']({},_0x35481b,_0x5f5495['options']);return db[_0xf3ba('0x35')][_0xf3ba('0x52')](_0x35481b)[_0xf3ba('0x2b')](handleEntityNotFound(_0x89b179,null))[_0xf3ba('0x2b')](respondWithResult(_0x89b179,null))['catch'](handleError(_0x89b179,null));};exports[_0xf3ba('0x53')]=function(_0xdc71c8,_0x221050){return db['SmsQueue'][_0xf3ba('0x53')](_0xdc71c8[_0xf3ba('0x54')],{})[_0xf3ba('0x2b')](function(_0x3639d2){var _0x18f913=_0xdc71c8[_0xf3ba('0x55')][_0xf3ba('0x2d')]({'plain':!![]});if(!_0x18f913)throw new Error(_0xf3ba('0x56'));if(_0x18f913[_0xf3ba('0x57')]===_0xf3ba('0x55')){var _0x534426=_0x3639d2[_0xf3ba('0x2d')]({'plain':!![]});var _0x40c70c=_0xf3ba('0x58');return db[_0xf3ba('0x59')]['find']({'where':{'name':_0x40c70c,'userProfileId':_0x18f913[_0xf3ba('0x5a')]},'raw':!![]})['then'](function(_0x5b5242){if(_0x5b5242&&_0x5b5242[_0xf3ba('0x5b')]===0x0){return db[_0xf3ba('0x2e')][_0xf3ba('0x53')]({'name':_0x534426[_0xf3ba('0x48')],'resourceId':_0x534426['id'],'type':_0x5b5242[_0xf3ba('0x48')],'sectionId':_0x5b5242['id']},{})[_0xf3ba('0x2b')](function(){return _0x3639d2;});}else{return _0x3639d2;}})[_0xf3ba('0x4e')](function(_0x787f73){logger['error'](_0xf3ba('0x5c'),_0x787f73);throw _0x787f73;});}return _0x3639d2;})[_0xf3ba('0x2b')](respondWithResult(_0x221050,0xc9))[_0xf3ba('0x4e')](handleError(_0x221050,null));};exports[_0xf3ba('0x2a')]=function(_0x4cd8c8,_0x55a1fe){if(_0x4cd8c8[_0xf3ba('0x54')]['id']){delete _0x4cd8c8[_0xf3ba('0x54')]['id'];}return db[_0xf3ba('0x35')][_0xf3ba('0x52')]({'where':{'id':_0x4cd8c8[_0xf3ba('0x50')]['id']}})['then'](handleEntityNotFound(_0x55a1fe,null))[_0xf3ba('0x2b')](saveUpdates(_0x4cd8c8['body'],null))[_0xf3ba('0x2b')](respondWithResult(_0x55a1fe,null))['catch'](handleError(_0x55a1fe,null));};exports[_0xf3ba('0x2c')]=function(_0x578000,_0x175690){return db[_0xf3ba('0x35')][_0xf3ba('0x52')]({'where':{'id':_0x578000[_0xf3ba('0x50')]['id']}})[_0xf3ba('0x2b')](handleEntityNotFound(_0x175690,null))['then'](removeEntity(_0x175690,null))[_0xf3ba('0x4e')](handleError(_0x175690,null));};exports[_0xf3ba('0x5d')]=function(_0xe7cb69,_0x494f83){return db[_0xf3ba('0x35')]['describe']()[_0xf3ba('0x2b')](respondWithResult(_0x494f83,null))[_0xf3ba('0x4e')](handleError(_0x494f83,null));};exports[_0xf3ba('0x5e')]=function(_0x21b9c6,_0x3def85,_0x30d4d9){var _0x1b7299={'raw':!![],'where':{}},_0x3589f1={},_0xc39733;return db[_0xf3ba('0x35')][_0xf3ba('0x5f')]({'where':{'id':_0x21b9c6['params']['id']}})[_0xf3ba('0x2b')](handleEntityNotFound(_0x3def85,null))['then'](function(_0x356799){if(_0x356799){_0xc39733=_0x356799[_0xf3ba('0x2d')]({'plain':!![]});_0x3589f1[_0xf3ba('0x38')]=_[_0xf3ba('0x3a')](db['UserSmsQueue'][_0xf3ba('0x36')]);_0x3589f1[_0xf3ba('0x39')]=_[_0xf3ba('0x3a')](_0x21b9c6[_0xf3ba('0x39')]);_0x3589f1[_0xf3ba('0x3b')]=_[_0xf3ba('0x51')](_0x3589f1[_0xf3ba('0x38')],_0x3589f1[_0xf3ba('0x39')]);_0x1b7299[_0xf3ba('0x3d')]=_[_0xf3ba('0x51')](_0x3589f1['model'],qs['fields'](_0x21b9c6['query']['fields']));_0x1b7299[_0xf3ba('0x3d')]=_0x1b7299[_0xf3ba('0x3d')][_0xf3ba('0x3e')]?_0x1b7299['attributes']:_0x3589f1[_0xf3ba('0x38')];if(!_0x21b9c6['query'][_0xf3ba('0x3f')](_0xf3ba('0x40'))){_0x1b7299['limit']=qs['limit'](_0x21b9c6[_0xf3ba('0x39')]['limit']);_0x1b7299[_0xf3ba('0x25')]=qs['offset'](_0x21b9c6[_0xf3ba('0x39')][_0xf3ba('0x25')]);}_0x1b7299[_0xf3ba('0x41')]=qs[_0xf3ba('0x42')](_0x21b9c6['query'][_0xf3ba('0x42')]);_0x1b7299['where']=qs['filters'](_[_0xf3ba('0x44')](_0x21b9c6[_0xf3ba('0x39')],_0x3589f1[_0xf3ba('0x3b')]));_0x1b7299[_0xf3ba('0x43')][_0xf3ba('0x60')]=_0x356799['id'];if(_0x21b9c6[_0xf3ba('0x39')]['filter']){_0x1b7299[_0xf3ba('0x43')]=_[_0xf3ba('0x46')](_0x1b7299[_0xf3ba('0x43')],{'$or':_['map'](_0x1b7299[_0xf3ba('0x3d')],function(_0xc53698){var _0x1eea8c={};_0x1eea8c[_0xc53698]={'$like':'%'+_0x21b9c6[_0xf3ba('0x39')]['filter']+'%'};return _0x1eea8c;})});}_0x1b7299=_[_0xf3ba('0x46')]({},_0x1b7299,_0x21b9c6[_0xf3ba('0x61')]);return db[_0xf3ba('0x62')][_0xf3ba('0x4c')](_0x1b7299);}})[_0xf3ba('0x2b')](function(_0x5b964a){if(_0x5b964a){return db[_0xf3ba('0x63')][_0xf3ba('0x64')]({'where':{'id':_[_0xf3ba('0x34')](_0x5b964a,_0xf3ba('0x65')),'role':_0xf3ba('0x66')},'attributes':['id',_0xf3ba('0x48'),_0xf3ba('0x67'),_0xf3ba('0x68'),_0xf3ba('0x69')]});}})[_0xf3ba('0x2b')](function(_0x31a5c0){if(_0x31a5c0){return{'count':_0x31a5c0[_0xf3ba('0x49')],'rows':_[_0xf3ba('0x34')](_0x31a5c0['rows'],function(_0x36a466){return{'membername':_0x36a466['name'],'UserId':_0x36a466['id'],'queue_name':_0xc39733[_0xf3ba('0x48')],'SmsQueueId':_0xc39733['id'],'interface':util[_0xf3ba('0x6a')](_0xf3ba('0x6b'),_0xf3ba('0x6c'),_0x36a466[_0xf3ba('0x48')]),'penalty':0x0,'paused':_0x36a466[_0xf3ba('0x67')],'createdAt':_0x36a466[_0xf3ba('0x69')],'updatedAt':_0x36a466[_0xf3ba('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3def85,_0x1b7299))[_0xf3ba('0x4e')](handleError(_0x3def85,null));};exports[_0xf3ba('0x6d')]=function(_0x3e9261,_0x5ed946,_0x3e1c39){var _0xf01974={};var _0x3cee62={};var _0x101a00;var _0x323fd1;return db[_0xf3ba('0x35')][_0xf3ba('0x5f')]({'where':{'id':_0x3e9261[_0xf3ba('0x50')]['id']}})[_0xf3ba('0x2b')](handleEntityNotFound(_0x5ed946,null))['then'](function(_0x588ef2){if(_0x588ef2){_0x101a00=_0x588ef2;_0x3cee62[_0xf3ba('0x38')]=_[_0xf3ba('0x3a')](db['Team'][_0xf3ba('0x36')]);_0x3cee62['query']=_[_0xf3ba('0x3a')](_0x3e9261['query']);_0x3cee62[_0xf3ba('0x3b')]=_[_0xf3ba('0x51')](_0x3cee62['model'],_0x3cee62[_0xf3ba('0x39')]);_0xf01974['attributes']=_[_0xf3ba('0x51')](_0x3cee62[_0xf3ba('0x38')],qs[_0xf3ba('0x3c')](_0x3e9261[_0xf3ba('0x39')][_0xf3ba('0x3c')]));_0xf01974[_0xf3ba('0x3d')]=_0xf01974[_0xf3ba('0x3d')][_0xf3ba('0x3e')]?_0xf01974[_0xf3ba('0x3d')]:_0x3cee62['model'];_0xf01974[_0xf3ba('0x41')]=qs[_0xf3ba('0x42')](_0x3e9261[_0xf3ba('0x39')][_0xf3ba('0x42')]);_0xf01974[_0xf3ba('0x43')]=qs[_0xf3ba('0x3b')](_['pick'](_0x3e9261[_0xf3ba('0x39')],_0x3cee62[_0xf3ba('0x3b')]));if(_0x3e9261[_0xf3ba('0x39')]['filter']){_0xf01974[_0xf3ba('0x43')]=_[_0xf3ba('0x46')](_0xf01974[_0xf3ba('0x43')],{'$or':_[_0xf3ba('0x34')](_0xf01974[_0xf3ba('0x3d')],function(_0x388170){var _0x5b3aef={};_0x5b3aef[_0x388170]={'$like':'%'+_0x3e9261[_0xf3ba('0x39')]['filter']+'%'};return _0x5b3aef;})});}_0xf01974=_['merge']({},_0xf01974,_0x3e9261[_0xf3ba('0x61')]);return _0x101a00[_0xf3ba('0x6d')](_0xf01974);}})['then'](function(_0x57bcfd){if(_0x57bcfd){_0x323fd1=_0x57bcfd[_0xf3ba('0x3e')];if(!_0x3e9261[_0xf3ba('0x39')][_0xf3ba('0x3f')](_0xf3ba('0x40'))){_0xf01974[_0xf3ba('0x26')]=qs[_0xf3ba('0x26')](_0x3e9261[_0xf3ba('0x39')]['limit']);_0xf01974[_0xf3ba('0x25')]=qs[_0xf3ba('0x25')](_0x3e9261['query'][_0xf3ba('0x25')]);}return _0x101a00[_0xf3ba('0x6d')](_0xf01974);}})[_0xf3ba('0x2b')](function(_0x240755){if(_0x240755){return _0x240755?{'count':_0x323fd1,'rows':_0x240755}:null;}})[_0xf3ba('0x2b')](respondWithResult(_0x5ed946,null))[_0xf3ba('0x4e')](handleError(_0x5ed946,null));};exports[_0xf3ba('0x6e')]=function(_0x25c496,_0x499ac3,_0x504e6a){var _0x5626a1=_0x25c496[_0xf3ba('0x54')][_0xf3ba('0x6f')];return db['Team']['findAll']({'where':{'id':_0x5626a1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf3ba('0x70'),'attributes':['id',_0xf3ba('0x48'),'online',_0xf3ba('0x71'),_0xf3ba('0x72')],'raw':!![]}]})[_0xf3ba('0x2b')](function(_0x3de094){if(_0x3de094){var _0x41eb6b=_[_0xf3ba('0x73')](_0x3de094,function(_0x14d350){var _0x3bc463=_0x14d350[_0xf3ba('0x2d')]({'plain':!![]});return _0x3bc463['Agents'];});return db[_0xf3ba('0x35')][_0xf3ba('0x52')]({'where':{'id':_0x25c496[_0xf3ba('0x50')]['id']}})[_0xf3ba('0x2b')](function(_0x5028fc){return db[_0xf3ba('0x74')][_0xf3ba('0x75')](function(_0x28b3cb){return _0x5028fc[_0xf3ba('0x6e')](_0x5626a1,{'transaction':_0x28b3cb})[_0xf3ba('0x2b')](function(){return BPromise[_0xf3ba('0x76')](_0x41eb6b,function(_0x48540c){return db[_0xf3ba('0x62')][_0xf3ba('0x77')]({'where':{'UserId':_0x48540c['id'],'SmsQueueId':_0x25c496['params']['id']},'transaction':_0x28b3cb});});})[_0xf3ba('0x2b')](function(){_0x41eb6b[_0xf3ba('0x78')](function(_0x1ea8e3){socket[_0xf3ba('0x79')](_0xf3ba('0x7a'),{'UserId':_0x1ea8e3['id'],'SmsQueueId':_0x5028fc['id']});});});});});}})[_0xf3ba('0x2b')](respondWithStatusCode(_0x499ac3,null))['catch'](handleError(_0x499ac3,null));};exports[_0xf3ba('0x7b')]=function(_0x2707bb,_0x69fec3,_0x31bc13){return db[_0xf3ba('0x7c')]['findAll']({'where':{'id':_0x2707bb[_0xf3ba('0x39')][_0xf3ba('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf3ba('0x70'),'attributes':['id'],'raw':!![]}]})[_0xf3ba('0x2b')](handleEntityNotFound(_0x69fec3,null))['then'](function(_0x88558e){var _0x112377=_['map'](_0x88558e,'id');var _0x3b041c=[];var _0x2c5618=[];var _0x416128=squel[_0xf3ba('0x7d')]();_0x416128['field'](_0xf3ba('0x7e'))[_0xf3ba('0x7f')](_0xf3ba('0x80'),'tq')['join'](_0xf3ba('0x81'),'ut',_0xf3ba('0x82'))[_0xf3ba('0x43')](_0xf3ba('0x83'),_0x2707bb[_0xf3ba('0x50')]['id']);for(var _0x6e4f1c=0x0;_0x6e4f1c<_0x88558e[_0xf3ba('0x3e')];_0x6e4f1c+=0x1){let _0x4d6661=_0x88558e[_0x6e4f1c];for(var _0x4f2106=0x0;_0x4f2106<_0x4d6661[_0xf3ba('0x70')][_0xf3ba('0x3e')];_0x4f2106+=0x1){let _0x4f7664=_0x4d6661['Agents'][_0x4f2106];var _0x51dc63=_0x416128[_0xf3ba('0x84')]();_0x51dc63[_0xf3ba('0x43')]('ut.UserId\x20=\x20?',_0x4f7664['id']);_0x2c5618[_0xf3ba('0x85')](db[_0xf3ba('0x74')][_0xf3ba('0x39')](_0x51dc63[_0xf3ba('0x86')](),{'type':db[_0xf3ba('0x74')]['QueryTypes'][_0xf3ba('0x87')]})[_0xf3ba('0x2b')](function(_0x56553f){if(_0x56553f['length']===0x1){return _0x4f7664['id'];}else{var _0x444db9=_[_0xf3ba('0x88')](_[_0xf3ba('0x34')](_0x56553f,_0xf3ba('0x89')),function(_0x4dbc51){return _[_0xf3ba('0x8a')](_0x112377,_0x4dbc51);});if(_0x444db9){return _0x4f7664['id'];}}}));}}return BPromise['all'](_0x2c5618)['then'](function(_0x4e8c88){_0x3b041c=_(_0x3b041c)['union'](_0x4e8c88)[_0xf3ba('0x8b')]()[_0xf3ba('0x8c')]();return db[_0xf3ba('0x35')][_0xf3ba('0x52')]({'where':{'id':_0x2707bb[_0xf3ba('0x50')]['id']}})[_0xf3ba('0x2b')](function(_0x5b24f0){return db[_0xf3ba('0x74')]['transaction'](function(_0x1f2dde){return _0x5b24f0[_0xf3ba('0x7b')](_0x2707bb[_0xf3ba('0x39')]['ids'],{'transaction':_0x1f2dde})[_0xf3ba('0x2b')](function(){if(!_[_0xf3ba('0x8d')](_0x3b041c)){return _0x5b24f0['removeAgents'](_0x3b041c,{'transaction':_0x1f2dde});}})[_0xf3ba('0x2b')](function(){_0x3b041c[_0xf3ba('0x78')](function(_0x4e3ca6){socket[_0xf3ba('0x79')](_0xf3ba('0x8e'),{'UserId':_0x4e3ca6,'SmsQueueId':_0x5b24f0['id']});});});});});});})[_0xf3ba('0x2b')](respondWithStatusCode(_0x69fec3,null))[_0xf3ba('0x4e')](handleError(_0x69fec3,null));};exports['addAgents']=function(_0xbb3e33,_0x21647a,_0x1df257){return db[_0xf3ba('0x35')][_0xf3ba('0x52')]({'where':{'id':_0xbb3e33[_0xf3ba('0x50')]['id']}})['then'](handleEntityNotFound(_0x21647a,null))['then'](function(_0x3d1885){if(_0x3d1885){return _0x3d1885[_0xf3ba('0x8f')](_0xbb3e33[_0xf3ba('0x54')]['ids'],_['omit'](_0xbb3e33[_0xf3ba('0x54')],[_0xf3ba('0x6f'),'id'])||{})['spread'](function(_0x512e62){for(var _0x57efa1=0x0;_0x57efa1<_0xbb3e33[_0xf3ba('0x54')]['ids'][_0xf3ba('0x3e')];_0x57efa1+=0x1){socket['emit'](_0xf3ba('0x7a'),{'UserId':_0xbb3e33[_0xf3ba('0x54')][_0xf3ba('0x6f')][_0x57efa1],'SmsQueueId':_0xbb3e33['params']['id']});}return _0x512e62;});}})[_0xf3ba('0x2b')](respondWithResult(_0x21647a,null))[_0xf3ba('0x4e')](handleError(_0x21647a,null));};exports[_0xf3ba('0x90')]=function(_0x4f922f,_0x1f27e2,_0x4c4b35){return db[_0xf3ba('0x35')][_0xf3ba('0x52')]({'where':{'id':_0x4f922f['params']['id']}})[_0xf3ba('0x2b')](handleEntityNotFound(_0x1f27e2,null))[_0xf3ba('0x2b')](function(_0x35df45){if(_0x35df45){return _0x35df45[_0xf3ba('0x90')](_0x4f922f['query'][_0xf3ba('0x6f')])[_0xf3ba('0x2b')](function(){if(_[_0xf3ba('0x91')](_0x4f922f[_0xf3ba('0x39')][_0xf3ba('0x6f')])){for(var _0x28ab71=0x0;_0x28ab71<_0x4f922f['query'][_0xf3ba('0x6f')][_0xf3ba('0x3e')];_0x28ab71+=0x1){socket[_0xf3ba('0x79')](_0xf3ba('0x8e'),{'UserId':Number(_0x4f922f[_0xf3ba('0x39')][_0xf3ba('0x6f')][_0x28ab71]),'SmsQueueId':Number(_0x4f922f[_0xf3ba('0x50')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x4f922f['query']['ids']),'SmsQueueId':Number(_0x4f922f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1f27e2,null))[_0xf3ba('0x4e')](handleError(_0x1f27e2,null));};exports[_0xf3ba('0x92')]=function(_0x41958e,_0x49a913,_0x386c5c){var _0x4e68b8={};var _0x247902={};var _0x534b20;var _0x57f5e2;return db['SmsQueue'][_0xf3ba('0x5f')]({'where':{'id':_0x41958e[_0xf3ba('0x50')]['id']}})[_0xf3ba('0x2b')](handleEntityNotFound(_0x49a913,null))[_0xf3ba('0x2b')](function(_0x322669){if(_0x322669){_0x534b20=_0x322669;_0x247902['model']=_[_0xf3ba('0x3a')](db[_0xf3ba('0x63')][_0xf3ba('0x36')]);_0x247902[_0xf3ba('0x39')]=_[_0xf3ba('0x3a')](_0x41958e['query']);_0x247902['filters']=_['intersection'](_0x247902[_0xf3ba('0x38')],_0x247902[_0xf3ba('0x39')]);_0x4e68b8['attributes']=_[_0xf3ba('0x51')](_0x247902['model'],qs[_0xf3ba('0x3c')](_0x41958e[_0xf3ba('0x39')][_0xf3ba('0x3c')]));_0x4e68b8[_0xf3ba('0x3d')]=_0x4e68b8[_0xf3ba('0x3d')][_0xf3ba('0x3e')]?_0x4e68b8[_0xf3ba('0x3d')]:_0x247902[_0xf3ba('0x38')];_0x4e68b8[_0xf3ba('0x41')]=qs[_0xf3ba('0x42')](_0x41958e[_0xf3ba('0x39')][_0xf3ba('0x42')]);_0x4e68b8['where']=qs[_0xf3ba('0x3b')](_[_0xf3ba('0x44')](_0x41958e[_0xf3ba('0x39')],_0x247902['filters']));if(_0x41958e['query'][_0xf3ba('0x45')]){_0x4e68b8[_0xf3ba('0x43')]=_['merge'](_0x4e68b8[_0xf3ba('0x43')],{'$or':_[_0xf3ba('0x34')](_0x4e68b8[_0xf3ba('0x3d')],function(_0x2ce9c2){var _0x12d242={};_0x12d242[_0x2ce9c2]={'$like':'%'+_0x41958e[_0xf3ba('0x39')][_0xf3ba('0x45')]+'%'};return _0x12d242;})});}_0x4e68b8=_[_0xf3ba('0x46')]({},_0x4e68b8,_0x41958e[_0xf3ba('0x61')]);return _0x534b20[_0xf3ba('0x92')](_0x4e68b8);}})['then'](function(_0x179361){if(_0x179361){_0x57f5e2=_0x179361[_0xf3ba('0x3e')];if(!_0x41958e['query']['hasOwnProperty']('nolimit')){_0x4e68b8[_0xf3ba('0x26')]=qs['limit'](_0x41958e['query'][_0xf3ba('0x26')]);_0x4e68b8[_0xf3ba('0x25')]=qs[_0xf3ba('0x25')](_0x41958e[_0xf3ba('0x39')][_0xf3ba('0x25')]);}return _0x534b20[_0xf3ba('0x92')](_0x4e68b8);}})['then'](function(_0x252868){if(_0x252868){return _0x252868?{'count':_0x57f5e2,'rows':_0x252868}:null;}})['then'](respondWithResult(_0x49a913,null))['catch'](handleError(_0x49a913,null));}; \ No newline at end of file +var _0x1db9=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','SmsQueue','findAll','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','describe','getMembers','findOne','UserSmsQueue','nolimit','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields'];(function(_0x2aa669,_0x5ce9d7){var _0x5dbeb8=function(_0x2a7a8b){while(--_0x2a7a8b){_0x2aa669['push'](_0x2aa669['shift']());}};_0x5dbeb8(++_0x5ce9d7);}(_0x1db9,0x176));var _0x91db=function(_0x1ef205,_0x1d6c4e){_0x1ef205=_0x1ef205-0x0;var _0x5431f0=_0x1db9[_0x1ef205];return _0x5431f0;};'use strict';var pdf=require(_0x91db('0x0'));var emlformat=require(_0x91db('0x1'));var rimraf=require(_0x91db('0x2'));var zipdir=require(_0x91db('0x3'));var jsonpatch=require(_0x91db('0x4'));var rp=require(_0x91db('0x5'));var moment=require('moment');var BPromise=require(_0x91db('0x6'));var Mustache=require(_0x91db('0x7'));var util=require('util');var path=require('path');var sox=require(_0x91db('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x91db('0x15')](config[_0x91db('0x16')],{'host':_0x91db('0x17'),'port':0x18eb});var socket=require(_0x91db('0x18'))(new Redis(config[_0x91db('0x16')]));require('./smsQueue.socket')[_0x91db('0x19')](socket);function respondWithStatusCode(_0x285052,_0x3cadc4){_0x3cadc4=_0x3cadc4||0xcc;return function(_0x4035b2){if(_0x4035b2){return _0x285052[_0x91db('0x1a')](_0x3cadc4);}return _0x285052[_0x91db('0x1b')](_0x3cadc4)[_0x91db('0x1c')]();};}function respondWithResult(_0x143bc4,_0x675bd){_0x675bd=_0x675bd||0xc8;return function(_0x26d10c){if(_0x26d10c){return _0x143bc4[_0x91db('0x1b')](_0x675bd)[_0x91db('0x1d')](_0x26d10c);}};}function respondWithFilteredResult(_0x5f5440,_0x3f744f){return function(_0x23d125){if(_0x23d125){var _0x39480f=_0x23d125['count'],_0x42e66c=_0x3f744f['offset'],_0xeb51b0=_0x3f744f[_0x91db('0x1e')]+_0x3f744f[_0x91db('0x1f')],_0x306e92;if(_0xeb51b0>=_0x39480f){_0xeb51b0=_0x39480f;_0x306e92=0xc8;}else{_0x306e92=0xce;}_0x5f5440[_0x91db('0x1b')](_0x306e92);return _0x5f5440[_0x91db('0x20')]('Content-Range',_0x42e66c+'-'+_0xeb51b0+'/'+_0x39480f)[_0x91db('0x1d')](_0x23d125);}return null;};}function patchUpdates(_0x324de7){return function(_0x6e3ca6){try{jsonpatch[_0x91db('0x21')](_0x6e3ca6,_0x324de7,!![]);}catch(_0x25593c){return BPromise[_0x91db('0x22')](_0x25593c);}return _0x6e3ca6[_0x91db('0x23')]();};}function saveUpdates(_0x8e323f,_0xdb48b8){return function(_0x31295f){if(_0x31295f){return _0x31295f['update'](_0x8e323f)['then'](function(_0x134caa){return _0x134caa;});}return null;};}function removeEntity(_0x2ac8d5,_0x50687e){return function(_0xc82085){if(_0xc82085){return _0xc82085[_0x91db('0x24')]()[_0x91db('0x25')](function(){var _0x6e3a9c=_0xc82085[_0x91db('0x26')]({'plain':!![]});var _0x4e2a8f='SmsQueues';return db[_0x91db('0x27')][_0x91db('0x24')]({'where':{'type':_0x4e2a8f,'resourceId':_0x6e3a9c['id']}})[_0x91db('0x25')](function(){return _0xc82085;});})['then'](function(){_0x2ac8d5[_0x91db('0x1b')](0xcc)[_0x91db('0x1c')]();});}};}function handleEntityNotFound(_0x46c0e8,_0x1bb4f8){return function(_0x512c79){if(!_0x512c79){_0x46c0e8[_0x91db('0x1a')](0x194);}return _0x512c79;};}function handleError(_0x2a00d1,_0x1805ef){_0x1805ef=_0x1805ef||0x1f4;return function(_0x49c504){logger[_0x91db('0x28')](_0x49c504[_0x91db('0x29')]);if(_0x49c504[_0x91db('0x2a')]){delete _0x49c504[_0x91db('0x2a')];}_0x2a00d1[_0x91db('0x1b')](_0x1805ef)[_0x91db('0x2b')](_0x49c504);};}exports[_0x91db('0x2c')]=function(_0x1b5a7b,_0x330a9a){var _0x1b27f9={},_0x1946ae={},_0x5b24b2={'count':0x0,'rows':[]};var _0xbef598=_[_0x91db('0x2d')](db['SmsQueue'][_0x91db('0x2e')],function(_0x1368b9){return{'name':_0x1368b9[_0x91db('0x2f')],'type':_0x1368b9[_0x91db('0x30')][_0x91db('0x31')]};});_0x1946ae['model']=_[_0x91db('0x2d')](_0xbef598,_0x91db('0x2a'));_0x1946ae[_0x91db('0x32')]=_['keys'](_0x1b5a7b[_0x91db('0x32')]);_0x1946ae['filters']=_[_0x91db('0x33')](_0x1946ae[_0x91db('0x34')],_0x1946ae[_0x91db('0x32')]);_0x1b27f9[_0x91db('0x35')]=_['intersection'](_0x1946ae[_0x91db('0x34')],qs[_0x91db('0x36')](_0x1b5a7b[_0x91db('0x32')]['fields']));_0x1b27f9[_0x91db('0x35')]=_0x1b27f9[_0x91db('0x35')]['length']?_0x1b27f9[_0x91db('0x35')]:_0x1946ae[_0x91db('0x34')];if(!_0x1b5a7b['query'][_0x91db('0x37')]('nolimit')){_0x1b27f9[_0x91db('0x1f')]=qs[_0x91db('0x1f')](_0x1b5a7b['query']['limit']);_0x1b27f9['offset']=qs[_0x91db('0x1e')](_0x1b5a7b[_0x91db('0x32')]['offset']);}_0x1b27f9[_0x91db('0x38')]=qs[_0x91db('0x39')](_0x1b5a7b[_0x91db('0x32')][_0x91db('0x39')]);_0x1b27f9[_0x91db('0x3a')]=qs[_0x91db('0x3b')](_[_0x91db('0x3c')](_0x1b5a7b[_0x91db('0x32')],_0x1946ae[_0x91db('0x3b')]),_0xbef598);if(_0x1b5a7b[_0x91db('0x32')][_0x91db('0x3d')]){_0x1b27f9['where']=_[_0x91db('0x3e')](_0x1b27f9['where'],{'$or':_[_0x91db('0x2d')](_0xbef598,function(_0xd42afe){if(_0xd42afe['type']!==_0x91db('0x3f')){var _0x191cf0={};_0x191cf0[_0xd42afe[_0x91db('0x2a')]]={'$like':'%'+_0x1b5a7b[_0x91db('0x32')][_0x91db('0x3d')]+'%'};return _0x191cf0;}})});}_0x1b27f9=_['merge']({},_0x1b27f9,_0x1b5a7b[_0x91db('0x40')]);var _0x3f6091={'where':_0x1b27f9[_0x91db('0x3a')]};return db['SmsQueue'][_0x91db('0x41')](_0x3f6091)[_0x91db('0x25')](function(_0x3aaf2e){_0x5b24b2['count']=_0x3aaf2e;if(_0x1b5a7b[_0x91db('0x32')][_0x91db('0x42')]){_0x1b27f9[_0x91db('0x43')]=[{'all':!![]}];}return db[_0x91db('0x44')][_0x91db('0x45')](_0x1b27f9);})['then'](function(_0x4dcdad){_0x5b24b2['rows']=_0x4dcdad;return _0x5b24b2;})[_0x91db('0x25')](respondWithFilteredResult(_0x330a9a,_0x1b27f9))[_0x91db('0x46')](handleError(_0x330a9a,null));};exports[_0x91db('0x47')]=function(_0x3e07fc,_0x46c92a){var _0x2fcf33={'raw':!![],'where':{'id':_0x3e07fc[_0x91db('0x48')]['id']}},_0x2b1fef={};_0x2b1fef[_0x91db('0x34')]=_[_0x91db('0x49')](db[_0x91db('0x44')]['rawAttributes']);_0x2b1fef['query']=_[_0x91db('0x49')](_0x3e07fc[_0x91db('0x32')]);_0x2b1fef[_0x91db('0x3b')]=_['intersection'](_0x2b1fef[_0x91db('0x34')],_0x2b1fef[_0x91db('0x32')]);_0x2fcf33[_0x91db('0x35')]=_[_0x91db('0x33')](_0x2b1fef[_0x91db('0x34')],qs['fields'](_0x3e07fc[_0x91db('0x32')]['fields']));_0x2fcf33[_0x91db('0x35')]=_0x2fcf33[_0x91db('0x35')][_0x91db('0x4a')]?_0x2fcf33[_0x91db('0x35')]:_0x2b1fef[_0x91db('0x34')];if(_0x3e07fc[_0x91db('0x32')][_0x91db('0x42')]){_0x2fcf33[_0x91db('0x43')]=[{'all':!![]}];}_0x2fcf33=_[_0x91db('0x3e')]({},_0x2fcf33,_0x3e07fc['options']);return db['SmsQueue'][_0x91db('0x4b')](_0x2fcf33)[_0x91db('0x25')](handleEntityNotFound(_0x46c92a,null))[_0x91db('0x25')](respondWithResult(_0x46c92a,null))[_0x91db('0x46')](handleError(_0x46c92a,null));};exports[_0x91db('0x4c')]=function(_0x4a3e44,_0x272657){return db[_0x91db('0x44')][_0x91db('0x4c')](_0x4a3e44[_0x91db('0x4d')],{})[_0x91db('0x25')](function(_0x51a75b){var _0xf90032=_0x4a3e44[_0x91db('0x4e')][_0x91db('0x26')]({'plain':!![]});if(!_0xf90032)throw new Error(_0x91db('0x4f'));if(_0xf90032[_0x91db('0x50')]===_0x91db('0x4e')){var _0x59003f=_0x51a75b['get']({'plain':!![]});var _0x132fb5='SmsQueues';return db[_0x91db('0x51')]['find']({'where':{'name':_0x132fb5,'userProfileId':_0xf90032['userProfileId']},'raw':!![]})[_0x91db('0x25')](function(_0x371277){if(_0x371277&&_0x371277[_0x91db('0x52')]===0x0){return db['UserProfileResource'][_0x91db('0x4c')]({'name':_0x59003f[_0x91db('0x2a')],'resourceId':_0x59003f['id'],'type':_0x371277[_0x91db('0x2a')],'sectionId':_0x371277['id']},{})['then'](function(){return _0x51a75b;});}else{return _0x51a75b;}})['catch'](function(_0x173d3e){logger[_0x91db('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x173d3e);throw _0x173d3e;});}return _0x51a75b;})[_0x91db('0x25')](respondWithResult(_0x272657,0xc9))['catch'](handleError(_0x272657,null));};exports[_0x91db('0x53')]=function(_0x239965,_0x24fa52){if(_0x239965[_0x91db('0x4d')]['id']){delete _0x239965['body']['id'];}return db[_0x91db('0x44')][_0x91db('0x4b')]({'where':{'id':_0x239965[_0x91db('0x48')]['id']}})[_0x91db('0x25')](handleEntityNotFound(_0x24fa52,null))[_0x91db('0x25')](saveUpdates(_0x239965[_0x91db('0x4d')],null))[_0x91db('0x25')](respondWithResult(_0x24fa52,null))[_0x91db('0x46')](handleError(_0x24fa52,null));};exports[_0x91db('0x24')]=function(_0x3e2e43,_0x5b127d){return db[_0x91db('0x44')][_0x91db('0x4b')]({'where':{'id':_0x3e2e43[_0x91db('0x48')]['id']}})[_0x91db('0x25')](handleEntityNotFound(_0x5b127d,null))[_0x91db('0x25')](removeEntity(_0x5b127d,null))['catch'](handleError(_0x5b127d,null));};exports[_0x91db('0x54')]=function(_0x5a90e2,_0x1a22dd){return db[_0x91db('0x44')]['describe']()['then'](respondWithResult(_0x1a22dd,null))[_0x91db('0x46')](handleError(_0x1a22dd,null));};exports[_0x91db('0x55')]=function(_0xf48f2,_0x51324a,_0x14a150){var _0x99ee11={'raw':!![],'where':{}},_0x1fb402={},_0x304c93;return db[_0x91db('0x44')][_0x91db('0x56')]({'where':{'id':_0xf48f2['params']['id']}})[_0x91db('0x25')](handleEntityNotFound(_0x51324a,null))[_0x91db('0x25')](function(_0x335b44){if(_0x335b44){_0x304c93=_0x335b44[_0x91db('0x26')]({'plain':!![]});_0x1fb402[_0x91db('0x34')]=_[_0x91db('0x49')](db[_0x91db('0x57')][_0x91db('0x2e')]);_0x1fb402[_0x91db('0x32')]=_[_0x91db('0x49')](_0xf48f2[_0x91db('0x32')]);_0x1fb402['filters']=_[_0x91db('0x33')](_0x1fb402[_0x91db('0x34')],_0x1fb402['query']);_0x99ee11['attributes']=_[_0x91db('0x33')](_0x1fb402[_0x91db('0x34')],qs['fields'](_0xf48f2['query'][_0x91db('0x36')]));_0x99ee11[_0x91db('0x35')]=_0x99ee11['attributes'][_0x91db('0x4a')]?_0x99ee11[_0x91db('0x35')]:_0x1fb402[_0x91db('0x34')];if(!_0xf48f2['query'][_0x91db('0x37')](_0x91db('0x58'))){_0x99ee11['limit']=qs['limit'](_0xf48f2[_0x91db('0x32')]['limit']);_0x99ee11[_0x91db('0x1e')]=qs[_0x91db('0x1e')](_0xf48f2[_0x91db('0x32')][_0x91db('0x1e')]);}_0x99ee11[_0x91db('0x38')]=qs[_0x91db('0x39')](_0xf48f2[_0x91db('0x32')]['sort']);_0x99ee11[_0x91db('0x3a')]=qs[_0x91db('0x3b')](_['pick'](_0xf48f2['query'],_0x1fb402[_0x91db('0x3b')]));_0x99ee11[_0x91db('0x3a')][_0x91db('0x59')]=_0x335b44['id'];if(_0xf48f2[_0x91db('0x32')]['filter']){_0x99ee11[_0x91db('0x3a')]=_[_0x91db('0x3e')](_0x99ee11['where'],{'$or':_[_0x91db('0x2d')](_0x99ee11[_0x91db('0x35')],function(_0x2880fe){var _0x36c1eb={};_0x36c1eb[_0x2880fe]={'$like':'%'+_0xf48f2['query'][_0x91db('0x3d')]+'%'};return _0x36c1eb;})});}_0x99ee11=_[_0x91db('0x3e')]({},_0x99ee11,_0xf48f2[_0x91db('0x40')]);return db['UserSmsQueue'][_0x91db('0x45')](_0x99ee11);}})[_0x91db('0x25')](function(_0x4c6127){if(_0x4c6127){return db[_0x91db('0x5a')][_0x91db('0x5b')]({'where':{'id':_[_0x91db('0x2d')](_0x4c6127,_0x91db('0x5c')),'role':_0x91db('0x5d')},'attributes':['id','name',_0x91db('0x5e'),_0x91db('0x5f'),_0x91db('0x60')]});}})['then'](function(_0x58e92a){if(_0x58e92a){return{'count':_0x58e92a[_0x91db('0x41')],'rows':_[_0x91db('0x2d')](_0x58e92a[_0x91db('0x61')],function(_0x3d3b26){return{'membername':_0x3d3b26[_0x91db('0x2a')],'UserId':_0x3d3b26['id'],'queue_name':_0x304c93[_0x91db('0x2a')],'SmsQueueId':_0x304c93['id'],'interface':util[_0x91db('0x62')]('%s/%s',_0x91db('0x63'),_0x3d3b26[_0x91db('0x2a')]),'penalty':0x0,'paused':_0x3d3b26[_0x91db('0x5e')],'createdAt':_0x3d3b26['createdAt'],'updatedAt':_0x3d3b26['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x91db('0x25')](respondWithFilteredResult(_0x51324a,_0x99ee11))[_0x91db('0x46')](handleError(_0x51324a,null));};exports[_0x91db('0x64')]=function(_0x5a531c,_0x45ca9c,_0x44c924){var _0x3438a4={};var _0x7fe080={};var _0x1e1777;var _0x71e82a;return db[_0x91db('0x44')][_0x91db('0x56')]({'where':{'id':_0x5a531c['params']['id']}})[_0x91db('0x25')](handleEntityNotFound(_0x45ca9c,null))[_0x91db('0x25')](function(_0x1965a0){if(_0x1965a0){_0x1e1777=_0x1965a0;_0x7fe080[_0x91db('0x34')]=_['keys'](db[_0x91db('0x65')]['rawAttributes']);_0x7fe080[_0x91db('0x32')]=_[_0x91db('0x49')](_0x5a531c[_0x91db('0x32')]);_0x7fe080[_0x91db('0x3b')]=_[_0x91db('0x33')](_0x7fe080[_0x91db('0x34')],_0x7fe080['query']);_0x3438a4[_0x91db('0x35')]=_['intersection'](_0x7fe080[_0x91db('0x34')],qs['fields'](_0x5a531c[_0x91db('0x32')][_0x91db('0x36')]));_0x3438a4[_0x91db('0x35')]=_0x3438a4['attributes'][_0x91db('0x4a')]?_0x3438a4[_0x91db('0x35')]:_0x7fe080[_0x91db('0x34')];_0x3438a4[_0x91db('0x38')]=qs[_0x91db('0x39')](_0x5a531c[_0x91db('0x32')][_0x91db('0x39')]);_0x3438a4[_0x91db('0x3a')]=qs[_0x91db('0x3b')](_[_0x91db('0x3c')](_0x5a531c['query'],_0x7fe080[_0x91db('0x3b')]));if(_0x5a531c[_0x91db('0x32')][_0x91db('0x3d')]){_0x3438a4[_0x91db('0x3a')]=_[_0x91db('0x3e')](_0x3438a4['where'],{'$or':_[_0x91db('0x2d')](_0x3438a4[_0x91db('0x35')],function(_0x44209f){var _0x358115={};_0x358115[_0x44209f]={'$like':'%'+_0x5a531c[_0x91db('0x32')][_0x91db('0x3d')]+'%'};return _0x358115;})});}_0x3438a4=_[_0x91db('0x3e')]({},_0x3438a4,_0x5a531c[_0x91db('0x40')]);return _0x1e1777[_0x91db('0x64')](_0x3438a4);}})[_0x91db('0x25')](function(_0x5bc49f){if(_0x5bc49f){_0x71e82a=_0x5bc49f['length'];if(!_0x5a531c[_0x91db('0x32')][_0x91db('0x37')](_0x91db('0x58'))){_0x3438a4['limit']=qs[_0x91db('0x1f')](_0x5a531c[_0x91db('0x32')][_0x91db('0x1f')]);_0x3438a4[_0x91db('0x1e')]=qs['offset'](_0x5a531c['query']['offset']);}return _0x1e1777[_0x91db('0x64')](_0x3438a4);}})['then'](function(_0x150228){if(_0x150228){return _0x150228?{'count':_0x71e82a,'rows':_0x150228}:null;}})[_0x91db('0x25')](respondWithResult(_0x45ca9c,null))[_0x91db('0x46')](handleError(_0x45ca9c,null));};exports[_0x91db('0x66')]=function(_0x4de3b0,_0x34df43,_0x1f7556){var _0x4b34e6=_0x4de3b0[_0x91db('0x4d')][_0x91db('0x67')];return db[_0x91db('0x65')][_0x91db('0x45')]({'where':{'id':_0x4b34e6},'attributes':['id'],'include':[{'model':db[_0x91db('0x5a')],'as':'Agents','attributes':['id',_0x91db('0x2a'),_0x91db('0x68'),_0x91db('0x69'),_0x91db('0x6a')],'raw':!![]}]})[_0x91db('0x25')](function(_0x2006a3){if(_0x2006a3){var _0x469ebd=_[_0x91db('0x6b')](_0x2006a3,function(_0xa24121){var _0x2163ac=_0xa24121[_0x91db('0x26')]({'plain':!![]});return _0x2163ac[_0x91db('0x6c')];});return db[_0x91db('0x44')][_0x91db('0x4b')]({'where':{'id':_0x4de3b0['params']['id']}})[_0x91db('0x25')](function(_0x5b9fdd){return db[_0x91db('0x6d')][_0x91db('0x6e')](function(_0x290d07){return _0x5b9fdd[_0x91db('0x66')](_0x4b34e6,{'transaction':_0x290d07})[_0x91db('0x25')](function(){return BPromise['each'](_0x469ebd,function(_0x3730ab){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x3730ab['id'],'SmsQueueId':_0x4de3b0[_0x91db('0x48')]['id']},'transaction':_0x290d07});});})[_0x91db('0x25')](function(){_0x469ebd[_0x91db('0x6f')](function(_0x134a9e){socket[_0x91db('0x70')]('userSmsQueue:save',{'UserId':_0x134a9e['id'],'SmsQueueId':_0x5b9fdd['id']});});});});});}})[_0x91db('0x25')](respondWithStatusCode(_0x34df43,null))['catch'](handleError(_0x34df43,null));};exports[_0x91db('0x71')]=function(_0x1baa7c,_0x12346b,_0x3b1dd6){return db['Team'][_0x91db('0x45')]({'where':{'id':_0x1baa7c['query'][_0x91db('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x91db('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x91db('0x25')](handleEntityNotFound(_0x12346b,null))['then'](function(_0x20b84f){var _0x41899c=_['map'](_0x20b84f,'id');var _0x577a8b=[];var _0xe49ae8=[];var _0x10f4bb=squel[_0x91db('0x72')]();_0x10f4bb[_0x91db('0x73')](_0x91db('0x74'))[_0x91db('0x75')](_0x91db('0x76'),'tq')['join'](_0x91db('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91db('0x3a')](_0x91db('0x78'),_0x1baa7c[_0x91db('0x48')]['id']);for(var _0x4b2af0=0x0;_0x4b2af0<_0x20b84f[_0x91db('0x4a')];_0x4b2af0+=0x1){let _0x26a0cd=_0x20b84f[_0x4b2af0];for(var _0xdf9a32=0x0;_0xdf9a32<_0x26a0cd['Agents'][_0x91db('0x4a')];_0xdf9a32+=0x1){let _0x57764c=_0x26a0cd[_0x91db('0x6c')][_0xdf9a32];var _0x55c5c9=_0x10f4bb[_0x91db('0x79')]();_0x55c5c9[_0x91db('0x3a')](_0x91db('0x7a'),_0x57764c['id']);_0xe49ae8[_0x91db('0x7b')](db[_0x91db('0x6d')]['query'](_0x55c5c9[_0x91db('0x7c')](),{'type':db[_0x91db('0x6d')][_0x91db('0x7d')][_0x91db('0x7e')]})[_0x91db('0x25')](function(_0x40f719){if(_0x40f719['length']===0x1){return _0x57764c['id'];}else{var _0x134080=_[_0x91db('0x7f')](_[_0x91db('0x2d')](_0x40f719,_0x91db('0x80')),function(_0x2e5ea9){return _[_0x91db('0x81')](_0x41899c,_0x2e5ea9);});if(_0x134080){return _0x57764c['id'];}}}));}}return BPromise[_0x91db('0x82')](_0xe49ae8)[_0x91db('0x25')](function(_0x184b95){_0x577a8b=_(_0x577a8b)[_0x91db('0x83')](_0x184b95)[_0x91db('0x84')]()[_0x91db('0x85')]();return db[_0x91db('0x44')]['find']({'where':{'id':_0x1baa7c[_0x91db('0x48')]['id']}})[_0x91db('0x25')](function(_0x1fa857){return db[_0x91db('0x6d')][_0x91db('0x6e')](function(_0x588787){return _0x1fa857[_0x91db('0x71')](_0x1baa7c['query']['ids'],{'transaction':_0x588787})[_0x91db('0x25')](function(){if(!_[_0x91db('0x86')](_0x577a8b)){return _0x1fa857[_0x91db('0x87')](_0x577a8b,{'transaction':_0x588787});}})[_0x91db('0x25')](function(){_0x577a8b[_0x91db('0x6f')](function(_0x2073a6){socket[_0x91db('0x70')](_0x91db('0x88'),{'UserId':_0x2073a6,'SmsQueueId':_0x1fa857['id']});});});});});});})[_0x91db('0x25')](respondWithStatusCode(_0x12346b,null))[_0x91db('0x46')](handleError(_0x12346b,null));};exports[_0x91db('0x89')]=function(_0x2adc4c,_0x48f571,_0x21874d){return db[_0x91db('0x44')][_0x91db('0x4b')]({'where':{'id':_0x2adc4c[_0x91db('0x48')]['id']}})['then'](handleEntityNotFound(_0x48f571,null))[_0x91db('0x25')](function(_0x3005c6){if(_0x3005c6){return _0x3005c6[_0x91db('0x89')](_0x2adc4c[_0x91db('0x4d')][_0x91db('0x67')],_[_0x91db('0x8a')](_0x2adc4c['body'],[_0x91db('0x67'),'id'])||{})[_0x91db('0x8b')](function(_0x11d8d4){for(var _0x18b099=0x0;_0x18b099<_0x2adc4c[_0x91db('0x4d')][_0x91db('0x67')][_0x91db('0x4a')];_0x18b099+=0x1){socket[_0x91db('0x70')](_0x91db('0x8c'),{'UserId':_0x2adc4c['body'][_0x91db('0x67')][_0x18b099],'SmsQueueId':_0x2adc4c[_0x91db('0x48')]['id']});}return _0x11d8d4;});}})[_0x91db('0x25')](respondWithResult(_0x48f571,null))[_0x91db('0x46')](handleError(_0x48f571,null));};exports[_0x91db('0x87')]=function(_0x4e090b,_0x58c5ce,_0x30d3bb){return db[_0x91db('0x44')][_0x91db('0x4b')]({'where':{'id':_0x4e090b['params']['id']}})[_0x91db('0x25')](handleEntityNotFound(_0x58c5ce,null))[_0x91db('0x25')](function(_0x2ea4b1){if(_0x2ea4b1){return _0x2ea4b1[_0x91db('0x87')](_0x4e090b[_0x91db('0x32')][_0x91db('0x67')])[_0x91db('0x25')](function(){if(_[_0x91db('0x8d')](_0x4e090b[_0x91db('0x32')]['ids'])){for(var _0x51f73a=0x0;_0x51f73a<_0x4e090b[_0x91db('0x32')][_0x91db('0x67')]['length'];_0x51f73a+=0x1){socket[_0x91db('0x70')](_0x91db('0x88'),{'UserId':Number(_0x4e090b[_0x91db('0x32')][_0x91db('0x67')][_0x51f73a]),'SmsQueueId':Number(_0x4e090b['params']['id'])});}}else{socket[_0x91db('0x70')](_0x91db('0x88'),{'UserId':Number(_0x4e090b['query'][_0x91db('0x67')]),'SmsQueueId':Number(_0x4e090b[_0x91db('0x48')]['id'])});}});}})[_0x91db('0x25')](respondWithStatusCode(_0x58c5ce,null))[_0x91db('0x46')](handleError(_0x58c5ce,null));};exports[_0x91db('0x8e')]=function(_0x160b2d,_0x34d701,_0x1d6294){var _0x17aa95={};var _0x5eb2be={};var _0x440a9f;var _0x4978d9;return db['SmsQueue'][_0x91db('0x56')]({'where':{'id':_0x160b2d['params']['id']}})[_0x91db('0x25')](handleEntityNotFound(_0x34d701,null))[_0x91db('0x25')](function(_0x1c21b6){if(_0x1c21b6){_0x440a9f=_0x1c21b6;_0x5eb2be[_0x91db('0x34')]=_[_0x91db('0x49')](db[_0x91db('0x5a')]['rawAttributes']);_0x5eb2be[_0x91db('0x32')]=_['keys'](_0x160b2d[_0x91db('0x32')]);_0x5eb2be[_0x91db('0x3b')]=_[_0x91db('0x33')](_0x5eb2be['model'],_0x5eb2be['query']);_0x17aa95[_0x91db('0x35')]=_[_0x91db('0x33')](_0x5eb2be[_0x91db('0x34')],qs['fields'](_0x160b2d[_0x91db('0x32')][_0x91db('0x36')]));_0x17aa95[_0x91db('0x35')]=_0x17aa95['attributes'][_0x91db('0x4a')]?_0x17aa95[_0x91db('0x35')]:_0x5eb2be[_0x91db('0x34')];_0x17aa95[_0x91db('0x38')]=qs[_0x91db('0x39')](_0x160b2d[_0x91db('0x32')][_0x91db('0x39')]);_0x17aa95[_0x91db('0x3a')]=qs[_0x91db('0x3b')](_[_0x91db('0x3c')](_0x160b2d[_0x91db('0x32')],_0x5eb2be[_0x91db('0x3b')]));if(_0x160b2d[_0x91db('0x32')][_0x91db('0x3d')]){_0x17aa95[_0x91db('0x3a')]=_['merge'](_0x17aa95[_0x91db('0x3a')],{'$or':_['map'](_0x17aa95[_0x91db('0x35')],function(_0x2e51cd){var _0x336f77={};_0x336f77[_0x2e51cd]={'$like':'%'+_0x160b2d['query']['filter']+'%'};return _0x336f77;})});}_0x17aa95=_[_0x91db('0x3e')]({},_0x17aa95,_0x160b2d[_0x91db('0x40')]);return _0x440a9f[_0x91db('0x8e')](_0x17aa95);}})[_0x91db('0x25')](function(_0x5f5511){if(_0x5f5511){_0x4978d9=_0x5f5511['length'];if(!_0x160b2d[_0x91db('0x32')][_0x91db('0x37')](_0x91db('0x58'))){_0x17aa95[_0x91db('0x1f')]=qs[_0x91db('0x1f')](_0x160b2d[_0x91db('0x32')][_0x91db('0x1f')]);_0x17aa95[_0x91db('0x1e')]=qs['offset'](_0x160b2d[_0x91db('0x32')][_0x91db('0x1e')]);}return _0x440a9f['getAgents'](_0x17aa95);}})[_0x91db('0x25')](function(_0x178f82){if(_0x178f82){return _0x178f82?{'count':_0x4978d9,'rows':_0x178f82}:null;}})[_0x91db('0x25')](respondWithResult(_0x34d701,null))[_0x91db('0x46')](handleError(_0x34d701,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 468f557..dbcece5 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 _0x6731=['emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x852d31,_0x1058d5){var _0x5502c9=function(_0x567cba){while(--_0x567cba){_0x852d31['push'](_0x852d31['shift']());}};_0x5502c9(++_0x1058d5);}(_0x6731,0x180));var _0x1673=function(_0x152405,_0x5e8952){_0x152405=_0x152405-0x0;var _0x46647a=_0x6731[_0x152405];return _0x46647a;};'use strict';var EventEmitter=require(_0x1673('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1673('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1673('0x2')](0x0);var events={'afterCreate':_0x1673('0x3'),'afterUpdate':_0x1673('0x4'),'afterDestroy':_0x1673('0x5')};function emitEvent(_0x3707d1){return function(_0x15bed0,_0x285034,_0x24c4bf){SmsQueueEvents[_0x1673('0x6')](_0x3707d1+':'+_0x15bed0['id'],_0x15bed0);SmsQueueEvents[_0x1673('0x6')](_0x3707d1,_0x15bed0);_0x24c4bf(null);};}for(var e in events){if(events[_0x1673('0x7')](e)){var event=events[e];SmsQueue[_0x1673('0x8')](e,emitEvent(event));}}module[_0x1673('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x142b=['events','../../mysqldb','SmsQueue','setMaxListeners','save','remove'];(function(_0x3d51e2,_0x15bca8){var _0x449f0c=function(_0x1feb6a){while(--_0x1feb6a){_0x3d51e2['push'](_0x3d51e2['shift']());}};_0x449f0c(++_0x15bca8);}(_0x142b,0x10e));var _0xb142=function(_0x1facf1,_0x382185){_0x1facf1=_0x1facf1-0x0;var _0x18a261=_0x142b[_0x1facf1];return _0x18a261;};'use strict';var EventEmitter=require(_0xb142('0x0'));var SmsQueue=require(_0xb142('0x1'))['db'][_0xb142('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb142('0x3')](0x0);var events={'afterCreate':_0xb142('0x4'),'afterUpdate':'update','afterDestroy':_0xb142('0x5')};function emitEvent(_0x28ebb6){return function(_0x2b1cae,_0xb3dd9c,_0x5c3714){SmsQueueEvents['emit'](_0x28ebb6+':'+_0x2b1cae['id'],_0x2b1cae);SmsQueueEvents['emit'](_0x28ebb6,_0x2b1cae);_0x5c3714(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 314fbf9..5ec35ef 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 _0x9000=['util','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash'];(function(_0x461397,_0x172e27){var _0x3c4bb1=function(_0x5217f0){while(--_0x5217f0){_0x461397['push'](_0x461397['shift']());}};_0x3c4bb1(++_0x172e27);}(_0x9000,0x173));var _0x0900=function(_0x421e3a,_0xd69d11){_0x421e3a=_0x421e3a-0x0;var _0x3f9abd=_0x9000[_0x421e3a];return _0x3f9abd;};'use strict';var _=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var logger=require('../../config/logger')(_0x0900('0x2'));var moment=require(_0x0900('0x3'));var BPromise=require(_0x0900('0x4'));var rp=require(_0x0900('0x5'));var fs=require('fs');var path=require(_0x0900('0x6'));var rimraf=require(_0x0900('0x7'));var config=require('../../config/environment');var attributes=require(_0x0900('0x8'));module['exports']=function(_0x380f41,_0x274b04){return _0x380f41[_0x0900('0x9')](_0x0900('0xa'),attributes,{'tableName':_0x0900('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf88=['moment','bluebird','request-promise','path','exports','define','lodash','util'];(function(_0x58a0f5,_0x1ecafd){var _0xe0e5e3=function(_0x41f011){while(--_0x41f011){_0x58a0f5['push'](_0x58a0f5['shift']());}};_0xe0e5e3(++_0x1ecafd);}(_0xcf88,0x15e));var _0x8cf8=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xcf88[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x8cf8('0x0'));var util=require(_0x8cf8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cf8('0x2'));var BPromise=require(_0x8cf8('0x3'));var rp=require(_0x8cf8('0x4'));var fs=require('fs');var path=require(_0x8cf8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x8cf8('0x6')]=function(_0x518b4c,_0x32b99d){return _0x518b4c[_0x8cf8('0x7')]('SmsQueue',attributes,{'tableName':'sms_queues','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 e33c8a5..90b334d 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 _0x6f92=['findAll','options','where','attributes','limit','include','map','model','ShowSmsQueue','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue'];(function(_0x4773c8,_0x154aa1){var _0x30312a=function(_0x472d0d){while(--_0x472d0d){_0x4773c8['push'](_0x4773c8['shift']());}};_0x30312a(++_0x154aa1);}(_0x6f92,0xfb));var _0x26f9=function(_0x3f4fe0,_0x10ae2f){_0x3f4fe0=_0x3f4fe0-0x0;var _0x12fa55=_0x6f92[_0x3f4fe0];return _0x12fa55;};'use strict';var _=require('lodash');var util=require(_0x26f9('0x0'));var moment=require(_0x26f9('0x1'));var BPromise=require(_0x26f9('0x2'));var rs=require(_0x26f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26f9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x26f9('0x5'))('rpc');var config=require(_0x26f9('0x6'));var jayson=require(_0x26f9('0x7'));var client=jayson[_0x26f9('0x8')]['http']({'port':0x232a});config[_0x26f9('0x9')]=_[_0x26f9('0xa')](config[_0x26f9('0x9')],{'host':_0x26f9('0xb'),'port':0x18eb});var socket=require(_0x26f9('0xc'))(new Redis(config[_0x26f9('0x9')]));require(_0x26f9('0xd'))[_0x26f9('0xe')](socket);function respondWithRpcPromise(_0x1d0dc4,_0x58c219,_0x500255){return new BPromise(function(_0x3d35bc,_0xcc27f9){return client[_0x26f9('0xf')](_0x1d0dc4,_0x500255)[_0x26f9('0x10')](function(_0x4359d5){logger[_0x26f9('0x11')](_0x26f9('0x12'),_0x58c219,'request\x20sent');logger[_0x26f9('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x58c219,'request\x20sent',JSON[_0x26f9('0x14')](_0x4359d5));if(_0x4359d5[_0x26f9('0x15')]){if(_0x4359d5['error'][_0x26f9('0x16')]===0x1f4){logger[_0x26f9('0x15')](_0x26f9('0x12'),_0x58c219,_0x4359d5[_0x26f9('0x15')][_0x26f9('0x17')]);return _0xcc27f9(_0x4359d5[_0x26f9('0x15')][_0x26f9('0x17')]);}logger[_0x26f9('0x15')](_0x26f9('0x12'),_0x58c219,_0x4359d5[_0x26f9('0x15')]['message']);return _0x3d35bc(_0x4359d5[_0x26f9('0x15')]['message']);}else{logger[_0x26f9('0x11')](_0x26f9('0x12'),_0x58c219,_0x26f9('0x18'));_0x3d35bc(_0x4359d5[_0x26f9('0x19')]['message']);}})[_0x26f9('0x1a')](function(_0x4ea6da){logger[_0x26f9('0x15')](_0x26f9('0x12'),_0x58c219,_0x4ea6da);_0xcc27f9(_0x4ea6da);});});}exports[_0x26f9('0x1b')]=function(_0x444f41){var _0x593efd=this;return new Promise(function(_0x3e8248,_0x17beb0){return db[_0x26f9('0x1c')][_0x26f9('0x1d')]({'raw':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x444f41['options']?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x1f')]||null:null,'attributes':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x20')]||null:null,'limit':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x21')]||null:null,'include':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x444f41[_0x26f9('0x1e')][_0x26f9('0x22')],function(_0x201baf){return{'model':db[_0x201baf[_0x26f9('0x24')]],'as':_0x201baf['as'],'attributes':_0x201baf['attributes'],'include':_0x201baf[_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x201baf[_0x26f9('0x22')],function(_0x4d8d47){return{'model':db[_0x4d8d47[_0x26f9('0x24')]],'as':_0x4d8d47['as'],'attributes':_0x4d8d47[_0x26f9('0x20')],'include':_0x4d8d47[_0x26f9('0x22')]?_['map'](_0x4d8d47['include'],function(_0x3622f3){return{'model':db[_0x3622f3[_0x26f9('0x24')]],'as':_0x3622f3['as'],'attributes':_0x3622f3[_0x26f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x26f9('0x10')](function(_0x4ecf65){logger[_0x26f9('0x11')]('GetSmsQueue',_0x444f41);logger[_0x26f9('0x13')](_0x26f9('0x1b'),_0x444f41,JSON[_0x26f9('0x14')](_0x4ecf65));_0x3e8248(_0x4ecf65);})['catch'](function(_0x2d5155){logger[_0x26f9('0x15')](_0x26f9('0x1b'),_0x2d5155['message'],_0x444f41);_0x17beb0(_0x593efd['error'](0x1f4,_0x2d5155['message']));});});};exports[_0x26f9('0x25')]=function(_0x44c59e){var _0x12af93=this;return new Promise(function(_0x2041a7,_0x2711e9){return db[_0x26f9('0x1c')][_0x26f9('0x26')]({'raw':_0x44c59e['options']?_0x44c59e[_0x26f9('0x1e')][_0x26f9('0x27')]===undefined?!![]:![]:!![],'where':_0x44c59e[_0x26f9('0x1e')]?_0x44c59e['options'][_0x26f9('0x1f')]||null:null,'attributes':_0x44c59e[_0x26f9('0x1e')]?_0x44c59e['options'][_0x26f9('0x20')]||null:null,'include':_0x44c59e[_0x26f9('0x1e')]?_0x44c59e['options'][_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x44c59e[_0x26f9('0x1e')][_0x26f9('0x22')],function(_0x296b41){return{'model':db[_0x296b41['model']],'as':_0x296b41['as'],'attributes':_0x296b41['attributes'],'include':_0x296b41[_0x26f9('0x22')]?_['map'](_0x296b41[_0x26f9('0x22')],function(_0x267d9e){return{'model':db[_0x267d9e['model']],'as':_0x267d9e['as'],'attributes':_0x267d9e[_0x26f9('0x20')],'include':_0x267d9e[_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x267d9e['include'],function(_0x10098c){return{'model':db[_0x10098c[_0x26f9('0x24')]],'as':_0x10098c['as'],'attributes':_0x10098c[_0x26f9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9b1f){logger[_0x26f9('0x11')]('ShowSmsQueue',_0x44c59e);logger[_0x26f9('0x13')](_0x26f9('0x25'),_0x44c59e,JSON[_0x26f9('0x14')](_0x5e9b1f));_0x2041a7(_0x5e9b1f);})[_0x26f9('0x1a')](function(_0x2ff5eb){logger[_0x26f9('0x15')]('ShowSmsQueue',_0x2ff5eb[_0x26f9('0x17')],_0x44c59e);_0x2711e9(_0x12af93[_0x26f9('0x15')](0x1f4,_0x2ff5eb['message']));});});}; \ No newline at end of file +var _0x5500=['include','map','model','debug','SmsQueue','find','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','raw','options','where','attributes','limit'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x5500,0x181));var _0x0550=function(_0x53f7ec,_0x4e769b){_0x53f7ec=_0x53f7ec-0x0;var _0x288eb4=_0x5500[_0x53f7ec];return _0x288eb4;};'use strict';var _=require(_0x0550('0x0'));var util=require(_0x0550('0x1'));var moment=require(_0x0550('0x2'));var BPromise=require(_0x0550('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0550('0x4'));var db=require(_0x0550('0x5'))['db'];var utils=require(_0x0550('0x6'));var logger=require(_0x0550('0x7'))(_0x0550('0x8'));var config=require(_0x0550('0x9'));var jayson=require(_0x0550('0xa'));var client=jayson[_0x0550('0xb')]['http']({'port':0x232a});config[_0x0550('0xc')]=_[_0x0550('0xd')](config['redis'],{'host':_0x0550('0xe'),'port':0x18eb});var socket=require(_0x0550('0xf'))(new Redis(config[_0x0550('0xc')]));require(_0x0550('0x10'))[_0x0550('0x11')](socket);function respondWithRpcPromise(_0x57b892,_0x5e36b8,_0x13c277){return new BPromise(function(_0x4fb7c3,_0xb92068){return client[_0x0550('0x12')](_0x57b892,_0x13c277)[_0x0550('0x13')](function(_0x126871){logger[_0x0550('0x14')](_0x0550('0x15'),_0x5e36b8,'request\x20sent');logger['debug'](_0x0550('0x16'),_0x5e36b8,_0x0550('0x17'),JSON[_0x0550('0x18')](_0x126871));if(_0x126871[_0x0550('0x19')]){if(_0x126871[_0x0550('0x19')]['code']===0x1f4){logger[_0x0550('0x19')](_0x0550('0x15'),_0x5e36b8,_0x126871[_0x0550('0x19')][_0x0550('0x1a')]);return _0xb92068(_0x126871['error']['message']);}logger[_0x0550('0x19')](_0x0550('0x15'),_0x5e36b8,_0x126871['error']['message']);return _0x4fb7c3(_0x126871[_0x0550('0x19')][_0x0550('0x1a')]);}else{logger[_0x0550('0x14')](_0x0550('0x15'),_0x5e36b8,_0x0550('0x17'));_0x4fb7c3(_0x126871[_0x0550('0x1b')][_0x0550('0x1a')]);}})[_0x0550('0x1c')](function(_0x1b1639){logger[_0x0550('0x19')](_0x0550('0x15'),_0x5e36b8,_0x1b1639);_0xb92068(_0x1b1639);});});}exports[_0x0550('0x1d')]=function(_0x250f3){var _0x28d616=this;return new Promise(function(_0x35a4a0,_0x352437){return db['SmsQueue']['findAll']({'raw':_0x250f3['options']?_0x250f3['options'][_0x0550('0x1e')]===undefined?!![]:![]:!![],'where':_0x250f3['options']?_0x250f3[_0x0550('0x1f')][_0x0550('0x20')]||null:null,'attributes':_0x250f3[_0x0550('0x1f')]?_0x250f3[_0x0550('0x1f')][_0x0550('0x21')]||null:null,'limit':_0x250f3[_0x0550('0x1f')]?_0x250f3[_0x0550('0x1f')][_0x0550('0x22')]||null:null,'include':_0x250f3[_0x0550('0x1f')]?_0x250f3[_0x0550('0x1f')][_0x0550('0x23')]?_[_0x0550('0x24')](_0x250f3[_0x0550('0x1f')]['include'],function(_0x329a03){return{'model':db[_0x329a03[_0x0550('0x25')]],'as':_0x329a03['as'],'attributes':_0x329a03[_0x0550('0x21')],'include':_0x329a03[_0x0550('0x23')]?_[_0x0550('0x24')](_0x329a03[_0x0550('0x23')],function(_0x28c241){return{'model':db[_0x28c241[_0x0550('0x25')]],'as':_0x28c241['as'],'attributes':_0x28c241['attributes'],'include':_0x28c241[_0x0550('0x23')]?_['map'](_0x28c241[_0x0550('0x23')],function(_0x3dd97c){return{'model':db[_0x3dd97c[_0x0550('0x25')]],'as':_0x3dd97c['as'],'attributes':_0x3dd97c[_0x0550('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0550('0x13')](function(_0x299322){logger[_0x0550('0x14')](_0x0550('0x1d'),_0x250f3);logger[_0x0550('0x26')](_0x0550('0x1d'),_0x250f3,JSON[_0x0550('0x18')](_0x299322));_0x35a4a0(_0x299322);})[_0x0550('0x1c')](function(_0x36bb1c){logger[_0x0550('0x19')](_0x0550('0x1d'),_0x36bb1c['message'],_0x250f3);_0x352437(_0x28d616[_0x0550('0x19')](0x1f4,_0x36bb1c[_0x0550('0x1a')]));});});};exports['ShowSmsQueue']=function(_0xb5ca4a){var _0x46161a=this;return new Promise(function(_0x17775d,_0x453445){return db[_0x0550('0x27')][_0x0550('0x28')]({'raw':_0xb5ca4a[_0x0550('0x1f')]?_0xb5ca4a[_0x0550('0x1f')][_0x0550('0x1e')]===undefined?!![]:![]:!![],'where':_0xb5ca4a[_0x0550('0x1f')]?_0xb5ca4a['options'][_0x0550('0x20')]||null:null,'attributes':_0xb5ca4a['options']?_0xb5ca4a['options'][_0x0550('0x21')]||null:null,'include':_0xb5ca4a[_0x0550('0x1f')]?_0xb5ca4a[_0x0550('0x1f')]['include']?_['map'](_0xb5ca4a['options'][_0x0550('0x23')],function(_0x46ecd3){return{'model':db[_0x46ecd3[_0x0550('0x25')]],'as':_0x46ecd3['as'],'attributes':_0x46ecd3[_0x0550('0x21')],'include':_0x46ecd3[_0x0550('0x23')]?_['map'](_0x46ecd3[_0x0550('0x23')],function(_0x90dfd9){return{'model':db[_0x90dfd9[_0x0550('0x25')]],'as':_0x90dfd9['as'],'attributes':_0x90dfd9[_0x0550('0x21')],'include':_0x90dfd9['include']?_[_0x0550('0x24')](_0x90dfd9[_0x0550('0x23')],function(_0x57f009){return{'model':db[_0x57f009[_0x0550('0x25')]],'as':_0x57f009['as'],'attributes':_0x57f009[_0x0550('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0550('0x13')](function(_0x178129){logger[_0x0550('0x14')](_0x0550('0x29'),_0xb5ca4a);logger[_0x0550('0x26')]('ShowSmsQueue',_0xb5ca4a,JSON[_0x0550('0x18')](_0x178129));_0x17775d(_0x178129);})['catch'](function(_0x3be40c){logger[_0x0550('0x19')](_0x0550('0x29'),_0x3be40c[_0x0550('0x1a')],_0xb5ca4a);_0x453445(_0x46161a[_0x0550('0x19')](0x1f4,_0x3be40c[_0x0550('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9fb05ad..8f6b57e 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 _0xf9db=['length','smsQueue:','./smsQueue.events','update','emit','register'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xf9db,0xd4));var _0xbf9d=function(_0x32e915,_0x1719c6){_0x32e915=_0x32e915-0x0;var _0x494ae5=_0xf9db[_0x32e915];return _0x494ae5;};'use strict';var SmsQueueEvents=require(_0xbf9d('0x0'));var events=['save','remove',_0xbf9d('0x1')];function createListener(_0x23388e,_0x16a569){return function(_0x1d153b){_0x16a569[_0xbf9d('0x2')](_0x23388e,_0x1d153b);};}function removeListener(_0x12cf3e,_0x59f764){return function(){SmsQueueEvents['removeListener'](_0x12cf3e,_0x59f764);};}exports[_0xbf9d('0x3')]=function(_0x5229dc){for(var _0x79c38a=0x0,_0x1d3e3f=events[_0xbf9d('0x4')];_0x79c38a<_0x1d3e3f;_0x79c38a++){var _0x4fa044=events[_0x79c38a];var _0x8b4fe7=createListener(_0xbf9d('0x5')+_0x4fa044,_0x5229dc);SmsQueueEvents['on'](_0x4fa044,_0x8b4fe7);}}; \ No newline at end of file +var _0xdd0a=['save','remove','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdd0a,0x19c));var _0xadd0=function(_0x4ba75b,_0x4cb5b8){_0x4ba75b=_0x4ba75b-0x0;var _0x365d41=_0xdd0a[_0x4ba75b];return _0x365d41;};'use strict';var SmsQueueEvents=require(_0xadd0('0x0'));var events=[_0xadd0('0x1'),_0xadd0('0x2'),'update'];function createListener(_0x2249e0,_0x1e2e54){return function(_0x464d45){_0x1e2e54['emit'](_0x2249e0,_0x464d45);};}function removeListener(_0x467a91,_0x5a4967){return function(){SmsQueueEvents[_0xadd0('0x3')](_0x467a91,_0x5a4967);};}exports[_0xadd0('0x4')]=function(_0xdcc762){for(var _0x21d987=0x0,_0x1fd653=events[_0xadd0('0x5')];_0x21d987<_0x1fd653;_0x21d987++){var _0x56622f=events[_0x21d987];var _0x5c61ca=createListener(_0xadd0('0x6')+_0x56622f,_0xdcc762);SmsQueueEvents['on'](_0x56622f,_0x5c61ca);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 761e9a8..8b00548 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 _0xb8c2=['./smsQueueReport.controller','get','describe','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb8c2,0x1ab));var _0x2b8c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb8c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x2b8c('0x0'));var path=require(_0x2b8c('0x1'));var timeout=require(_0x2b8c('0x2'));var express=require(_0x2b8c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2b8c('0x4'));var config=require('../../config/environment');var controller=require(_0x2b8c('0x5'));router[_0x2b8c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b8c('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x2b8c('0x7')]);router[_0x2b8c('0x6')]('/:id',auth[_0x2b8c('0x8')](),controller[_0x2b8c('0x9')]);router[_0x2b8c('0xa')]('/',auth[_0x2b8c('0x8')](),controller[_0x2b8c('0xb')]);router['put'](_0x2b8c('0xc'),auth[_0x2b8c('0x8')](),controller[_0x2b8c('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2b8c('0xe')]);module[_0x2b8c('0xf')]=router; \ No newline at end of file +var _0x4655=['../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xe01b82,_0x2879ff){var _0x566217=function(_0x1b77b8){while(--_0x1b77b8){_0xe01b82['push'](_0xe01b82['shift']());}};_0x566217(++_0x2879ff);}(_0x4655,0xc2));var _0x5465=function(_0x3adcc,_0x39ca25){_0x3adcc=_0x3adcc-0x0;var _0x119615=_0x4655[_0x3adcc];return _0x119615;};'use strict';var multer=require('multer');var util=require(_0x5465('0x0'));var path=require(_0x5465('0x1'));var timeout=require('connect-timeout');var express=require(_0x5465('0x2'));var router=express[_0x5465('0x3')]();var auth=require(_0x5465('0x4'));var interaction=require(_0x5465('0x5'));var config=require(_0x5465('0x6'));var controller=require(_0x5465('0x7'));router['get']('/',auth[_0x5465('0x8')](),controller[_0x5465('0x9')]);router[_0x5465('0xa')](_0x5465('0xb'),auth[_0x5465('0x8')](),controller['describe']);router[_0x5465('0xa')](_0x5465('0xc'),auth[_0x5465('0x8')](),controller[_0x5465('0xd')]);router[_0x5465('0xe')]('/',auth[_0x5465('0x8')](),controller[_0x5465('0xf')]);router['put'](_0x5465('0xc'),auth[_0x5465('0x8')](),controller[_0x5465('0x10')]);router[_0x5465('0x11')](_0x5465('0xc'),auth['isAuthenticated'](),controller[_0x5465('0x12')]);module[_0x5465('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2cd4b61..9f77c59 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 _0xd838=['DATE','moment','STRING'];(function(_0x13ffbe,_0xab40c){var _0x542906=function(_0x3705eb){while(--_0x3705eb){_0x13ffbe['push'](_0x13ffbe['shift']());}};_0x542906(++_0xab40c);}(_0xd838,0xdf));var _0x8d83=function(_0x90b38f,_0x47fbd5){_0x90b38f=_0x90b38f-0x0;var _0x5f3d64=_0xd838[_0x90b38f];return _0x5f3d64;};'use strict';var moment=require(_0x8d83('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8d83('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x8d83('0x1')]},'joinAt':{'type':Sequelize[_0x8d83('0x2')]},'leaveAt':{'type':Sequelize[_0x8d83('0x2')]},'acceptAt':{'type':Sequelize[_0x8d83('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8d83('0x1')]}}; \ No newline at end of file +var _0x7fce=['sequelize','STRING','DATE','moment'];(function(_0x5b340a,_0x2dbedc){var _0x1994e1=function(_0x49729f){while(--_0x49729f){_0x5b340a['push'](_0x5b340a['shift']());}};_0x1994e1(++_0x2dbedc);}(_0x7fce,0x1b3));var _0xe7fc=function(_0x58f92c,_0x2726dc){_0x58f92c=_0x58f92c-0x0;var _0x4b4ec1=_0x7fce[_0x58f92c];return _0x4b4ec1;};'use strict';var moment=require(_0xe7fc('0x0'));var Sequelize=require(_0xe7fc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe7fc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fc('0x2')]},'joinAt':{'type':Sequelize[_0xe7fc('0x3')]},'leaveAt':{'type':Sequelize[_0xe7fc('0x3')]},'acceptAt':{'type':Sequelize[_0xe7fc('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index af8ea13..a4600de 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 _0x5e14=['findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5e14,0x13d));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x45e1('0x0'));var zipdir=require(_0x45e1('0x1'));var jsonpatch=require(_0x45e1('0x2'));var rp=require(_0x45e1('0x3'));var moment=require('moment');var BPromise=require(_0x45e1('0x4'));var Mustache=require(_0x45e1('0x5'));var util=require(_0x45e1('0x6'));var path=require(_0x45e1('0x7'));var sox=require(_0x45e1('0x8'));var csv=require(_0x45e1('0x9'));var ejs=require(_0x45e1('0xa'));var fs=require('fs');var _=require(_0x45e1('0xb'));var squel=require(_0x45e1('0xc'));var crypto=require(_0x45e1('0xd'));var jsforce=require(_0x45e1('0xe'));var deskjs=require(_0x45e1('0xf'));var toCsv=require(_0x45e1('0x9'));var querystring=require(_0x45e1('0x10'));var Papa=require(_0x45e1('0x11'));var Redis=require(_0x45e1('0x12'));var authService=require(_0x45e1('0x13'));var qs=require(_0x45e1('0x14'));var as=require(_0x45e1('0x15'));var hardwareService=require(_0x45e1('0x16'));var logger=require(_0x45e1('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x45e1('0x18'));var licenseUtil=require(_0x45e1('0x19'));var db=require(_0x45e1('0x1a'))['db'];function respondWithStatusCode(_0x4c5183,_0x2e0474){_0x2e0474=_0x2e0474||0xcc;return function(_0x394b78){if(_0x394b78){return _0x4c5183['sendStatus'](_0x2e0474);}return _0x4c5183[_0x45e1('0x1b')](_0x2e0474)[_0x45e1('0x1c')]();};}function respondWithResult(_0x318bb7,_0x3d0223){_0x3d0223=_0x3d0223||0xc8;return function(_0x13058b){if(_0x13058b){return _0x318bb7[_0x45e1('0x1b')](_0x3d0223)[_0x45e1('0x1d')](_0x13058b);}};}function respondWithFilteredResult(_0x5f365c,_0x5d09f0){return function(_0x262d97){if(_0x262d97){var _0x4197b3=_0x262d97[_0x45e1('0x1e')],_0x5fc641=_0x5d09f0[_0x45e1('0x1f')],_0x4e8c58=_0x5d09f0[_0x45e1('0x1f')]+_0x5d09f0[_0x45e1('0x20')],_0x5b062e;if(_0x4e8c58>=_0x4197b3){_0x4e8c58=_0x4197b3;_0x5b062e=0xc8;}else{_0x5b062e=0xce;}_0x5f365c[_0x45e1('0x1b')](_0x5b062e);return _0x5f365c[_0x45e1('0x21')](_0x45e1('0x22'),_0x5fc641+'-'+_0x4e8c58+'/'+_0x4197b3)[_0x45e1('0x1d')](_0x262d97);}return null;};}function patchUpdates(_0x439011){return function(_0x7392e3){try{jsonpatch[_0x45e1('0x23')](_0x7392e3,_0x439011,!![]);}catch(_0x4e64df){return BPromise['reject'](_0x4e64df);}return _0x7392e3[_0x45e1('0x24')]();};}function saveUpdates(_0x2e1502,_0x913b29){return function(_0x47d60e){if(_0x47d60e){return _0x47d60e[_0x45e1('0x25')](_0x2e1502)[_0x45e1('0x26')](function(_0x830c5b){return _0x830c5b;});}return null;};}function removeEntity(_0x37f9ca,_0x23d668){return function(_0x2df5b7){if(_0x2df5b7){return _0x2df5b7[_0x45e1('0x27')]()[_0x45e1('0x26')](function(){_0x37f9ca[_0x45e1('0x1b')](0xcc)[_0x45e1('0x1c')]();});}};}function handleEntityNotFound(_0x55d379,_0x1de1a5){return function(_0x341cdc){if(!_0x341cdc){_0x55d379[_0x45e1('0x28')](0x194);}return _0x341cdc;};}function handleError(_0x1be24d,_0x2921e1){_0x2921e1=_0x2921e1||0x1f4;return function(_0x33f611){logger[_0x45e1('0x29')](_0x33f611['stack']);if(_0x33f611['name']){delete _0x33f611[_0x45e1('0x2a')];}_0x1be24d[_0x45e1('0x1b')](_0x2921e1)[_0x45e1('0x2b')](_0x33f611);};}exports[_0x45e1('0x2c')]=function(_0x1f6fc2,_0x12285a){var _0x3af4b1={},_0x19a8c0={},_0xdc8e86={'count':0x0,'rows':[]};var _0x147c0f=_[_0x45e1('0x2d')](db[_0x45e1('0x2e')][_0x45e1('0x2f')],function(_0x3e18fd){return{'name':_0x3e18fd[_0x45e1('0x30')],'type':_0x3e18fd[_0x45e1('0x31')][_0x45e1('0x32')]};});_0x19a8c0['model']=_[_0x45e1('0x2d')](_0x147c0f,_0x45e1('0x2a'));_0x19a8c0[_0x45e1('0x33')]=_[_0x45e1('0x34')](_0x1f6fc2[_0x45e1('0x33')]);_0x19a8c0[_0x45e1('0x35')]=_[_0x45e1('0x36')](_0x19a8c0[_0x45e1('0x37')],_0x19a8c0[_0x45e1('0x33')]);_0x3af4b1[_0x45e1('0x38')]=_[_0x45e1('0x36')](_0x19a8c0[_0x45e1('0x37')],qs[_0x45e1('0x39')](_0x1f6fc2[_0x45e1('0x33')][_0x45e1('0x39')]));_0x3af4b1[_0x45e1('0x38')]=_0x3af4b1[_0x45e1('0x38')][_0x45e1('0x3a')]?_0x3af4b1[_0x45e1('0x38')]:_0x19a8c0[_0x45e1('0x37')];if(!_0x1f6fc2[_0x45e1('0x33')][_0x45e1('0x3b')]('nolimit')){_0x3af4b1[_0x45e1('0x20')]=qs['limit'](_0x1f6fc2['query'][_0x45e1('0x20')]);_0x3af4b1[_0x45e1('0x1f')]=qs[_0x45e1('0x1f')](_0x1f6fc2[_0x45e1('0x33')][_0x45e1('0x1f')]);}_0x3af4b1[_0x45e1('0x3c')]=qs[_0x45e1('0x3d')](_0x1f6fc2[_0x45e1('0x33')][_0x45e1('0x3d')]);_0x3af4b1[_0x45e1('0x3e')]=qs[_0x45e1('0x35')](_[_0x45e1('0x3f')](_0x1f6fc2[_0x45e1('0x33')],_0x19a8c0[_0x45e1('0x35')]),_0x147c0f);if(_0x1f6fc2[_0x45e1('0x33')][_0x45e1('0x40')]){_0x3af4b1[_0x45e1('0x3e')]=_[_0x45e1('0x41')](_0x3af4b1[_0x45e1('0x3e')],{'$or':_[_0x45e1('0x2d')](_0x147c0f,function(_0x986ee0){if(_0x986ee0['type']!=='VIRTUAL'){var _0xda57c8={};_0xda57c8[_0x986ee0[_0x45e1('0x2a')]]={'$like':'%'+_0x1f6fc2[_0x45e1('0x33')]['filter']+'%'};return _0xda57c8;}})});}_0x3af4b1=_[_0x45e1('0x41')]({},_0x3af4b1,_0x1f6fc2[_0x45e1('0x42')]);var _0x45d149={'where':_0x3af4b1[_0x45e1('0x3e')]};return db['SmsQueueReport'][_0x45e1('0x1e')](_0x45d149)[_0x45e1('0x26')](function(_0x2a5fd4){_0xdc8e86[_0x45e1('0x1e')]=_0x2a5fd4;if(_0x1f6fc2['query'][_0x45e1('0x43')]){_0x3af4b1['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x45e1('0x44')](_0x3af4b1);})[_0x45e1('0x26')](function(_0x505290){_0xdc8e86[_0x45e1('0x45')]=_0x505290;return _0xdc8e86;})[_0x45e1('0x26')](respondWithFilteredResult(_0x12285a,_0x3af4b1))['catch'](handleError(_0x12285a,null));};exports[_0x45e1('0x46')]=function(_0x4a60d1,_0x4fb2d2){var _0x3428ea={'raw':!![],'where':{'id':_0x4a60d1[_0x45e1('0x47')]['id']}},_0x532792={};_0x532792[_0x45e1('0x37')]=_['keys'](db['SmsQueueReport'][_0x45e1('0x2f')]);_0x532792[_0x45e1('0x33')]=_[_0x45e1('0x34')](_0x4a60d1[_0x45e1('0x33')]);_0x532792['filters']=_[_0x45e1('0x36')](_0x532792[_0x45e1('0x37')],_0x532792[_0x45e1('0x33')]);_0x3428ea['attributes']=_[_0x45e1('0x36')](_0x532792[_0x45e1('0x37')],qs[_0x45e1('0x39')](_0x4a60d1[_0x45e1('0x33')][_0x45e1('0x39')]));_0x3428ea[_0x45e1('0x38')]=_0x3428ea[_0x45e1('0x38')][_0x45e1('0x3a')]?_0x3428ea['attributes']:_0x532792[_0x45e1('0x37')];if(_0x4a60d1['query']['includeAll']){_0x3428ea['include']=[{'all':!![]}];}_0x3428ea=_[_0x45e1('0x41')]({},_0x3428ea,_0x4a60d1[_0x45e1('0x42')]);return db[_0x45e1('0x2e')][_0x45e1('0x48')](_0x3428ea)[_0x45e1('0x26')](handleEntityNotFound(_0x4fb2d2,null))[_0x45e1('0x26')](respondWithResult(_0x4fb2d2,null))[_0x45e1('0x49')](handleError(_0x4fb2d2,null));};exports[_0x45e1('0x4a')]=function(_0x5efc59,_0x522327){return db[_0x45e1('0x2e')][_0x45e1('0x4a')](_0x5efc59['body'],{})[_0x45e1('0x26')](respondWithResult(_0x522327,0xc9))[_0x45e1('0x49')](handleError(_0x522327,null));};exports[_0x45e1('0x25')]=function(_0x31c108,_0x3f934a){if(_0x31c108[_0x45e1('0x4b')]['id']){delete _0x31c108[_0x45e1('0x4b')]['id'];}return db[_0x45e1('0x2e')][_0x45e1('0x48')]({'where':{'id':_0x31c108[_0x45e1('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f934a,null))[_0x45e1('0x26')](saveUpdates(_0x31c108[_0x45e1('0x4b')],null))['then'](respondWithResult(_0x3f934a,null))[_0x45e1('0x49')](handleError(_0x3f934a,null));};exports[_0x45e1('0x27')]=function(_0x3d3754,_0x4c3cf7){return db[_0x45e1('0x2e')]['find']({'where':{'id':_0x3d3754[_0x45e1('0x47')]['id']}})[_0x45e1('0x26')](handleEntityNotFound(_0x4c3cf7,null))[_0x45e1('0x26')](removeEntity(_0x4c3cf7,null))[_0x45e1('0x49')](handleError(_0x4c3cf7,null));};exports[_0x45e1('0x4c')]=function(_0x30003c,_0x58faa9){return db['SmsQueueReport'][_0x45e1('0x4c')]()['then'](respondWithResult(_0x58faa9,null))[_0x45e1('0x49')](handleError(_0x58faa9,null));}; \ No newline at end of file +var _0xab32=['count','offset','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json'];(function(_0x273765,_0xd06f24){var _0x70c740=function(_0x54e8c9){while(--_0x54e8c9){_0x273765['push'](_0x273765['shift']());}};_0x70c740(++_0xd06f24);}(_0xab32,0x1e4));var _0x2ab3=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xab32[_0x506d2f];return _0x101255;};'use strict';var pdf=require(_0x2ab3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2ab3('0x1'));var zipdir=require(_0x2ab3('0x2'));var jsonpatch=require(_0x2ab3('0x3'));var rp=require(_0x2ab3('0x4'));var moment=require(_0x2ab3('0x5'));var BPromise=require(_0x2ab3('0x6'));var Mustache=require(_0x2ab3('0x7'));var util=require('util');var path=require(_0x2ab3('0x8'));var sox=require(_0x2ab3('0x9'));var csv=require(_0x2ab3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ab3('0xb'));var squel=require(_0x2ab3('0xc'));var crypto=require(_0x2ab3('0xd'));var jsforce=require(_0x2ab3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2ab3('0xa'));var querystring=require('querystring');var Papa=require(_0x2ab3('0xf'));var Redis=require(_0x2ab3('0x10'));var authService=require(_0x2ab3('0x11'));var qs=require(_0x2ab3('0x12'));var as=require(_0x2ab3('0x13'));var hardwareService=require(_0x2ab3('0x14'));var logger=require('../../config/logger')(_0x2ab3('0x15'));var utils=require('../../config/utils');var config=require(_0x2ab3('0x16'));var licenseUtil=require(_0x2ab3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x520ee3,_0x2b09a0){_0x2b09a0=_0x2b09a0||0xcc;return function(_0x2518ae){if(_0x2518ae){return _0x520ee3['sendStatus'](_0x2b09a0);}return _0x520ee3[_0x2ab3('0x18')](_0x2b09a0)[_0x2ab3('0x19')]();};}function respondWithResult(_0x20bf40,_0x263dea){_0x263dea=_0x263dea||0xc8;return function(_0x238322){if(_0x238322){return _0x20bf40[_0x2ab3('0x18')](_0x263dea)[_0x2ab3('0x1a')](_0x238322);}};}function respondWithFilteredResult(_0x1af440,_0x3ae22){return function(_0x5aa8c9){if(_0x5aa8c9){var _0x151be2=_0x5aa8c9[_0x2ab3('0x1b')],_0x2377d9=_0x3ae22[_0x2ab3('0x1c')],_0x1bf03a=_0x3ae22[_0x2ab3('0x1c')]+_0x3ae22['limit'],_0x92655a;if(_0x1bf03a>=_0x151be2){_0x1bf03a=_0x151be2;_0x92655a=0xc8;}else{_0x92655a=0xce;}_0x1af440[_0x2ab3('0x18')](_0x92655a);return _0x1af440[_0x2ab3('0x1d')](_0x2ab3('0x1e'),_0x2377d9+'-'+_0x1bf03a+'/'+_0x151be2)[_0x2ab3('0x1a')](_0x5aa8c9);}return null;};}function patchUpdates(_0x3b49aa){return function(_0x587248){try{jsonpatch[_0x2ab3('0x1f')](_0x587248,_0x3b49aa,!![]);}catch(_0x42de78){return BPromise['reject'](_0x42de78);}return _0x587248['save']();};}function saveUpdates(_0x14f81f,_0x3ffcb4){return function(_0x4fcbaa){if(_0x4fcbaa){return _0x4fcbaa[_0x2ab3('0x20')](_0x14f81f)[_0x2ab3('0x21')](function(_0x18f727){return _0x18f727;});}return null;};}function removeEntity(_0x20022d,_0x15cd10){return function(_0x162e79){if(_0x162e79){return _0x162e79[_0x2ab3('0x22')]()['then'](function(){_0x20022d[_0x2ab3('0x18')](0xcc)[_0x2ab3('0x19')]();});}};}function handleEntityNotFound(_0x31ef47,_0x3ddecd){return function(_0x3c1bc1){if(!_0x3c1bc1){_0x31ef47['sendStatus'](0x194);}return _0x3c1bc1;};}function handleError(_0x5c5d9d,_0xcfd516){_0xcfd516=_0xcfd516||0x1f4;return function(_0xec05ec){logger[_0x2ab3('0x23')](_0xec05ec['stack']);if(_0xec05ec[_0x2ab3('0x24')]){delete _0xec05ec[_0x2ab3('0x24')];}_0x5c5d9d[_0x2ab3('0x18')](_0xcfd516)[_0x2ab3('0x25')](_0xec05ec);};}exports[_0x2ab3('0x26')]=function(_0x2e909f,_0x73b038){var _0x41e530={},_0x130cb4={},_0x52f85f={'count':0x0,'rows':[]};var _0x59dbf2=_[_0x2ab3('0x27')](db[_0x2ab3('0x28')][_0x2ab3('0x29')],function(_0x3b2576){return{'name':_0x3b2576[_0x2ab3('0x2a')],'type':_0x3b2576[_0x2ab3('0x2b')][_0x2ab3('0x2c')]};});_0x130cb4[_0x2ab3('0x2d')]=_[_0x2ab3('0x27')](_0x59dbf2,_0x2ab3('0x24'));_0x130cb4[_0x2ab3('0x2e')]=_['keys'](_0x2e909f[_0x2ab3('0x2e')]);_0x130cb4[_0x2ab3('0x2f')]=_[_0x2ab3('0x30')](_0x130cb4[_0x2ab3('0x2d')],_0x130cb4['query']);_0x41e530[_0x2ab3('0x31')]=_[_0x2ab3('0x30')](_0x130cb4[_0x2ab3('0x2d')],qs['fields'](_0x2e909f['query'][_0x2ab3('0x32')]));_0x41e530[_0x2ab3('0x31')]=_0x41e530['attributes'][_0x2ab3('0x33')]?_0x41e530[_0x2ab3('0x31')]:_0x130cb4[_0x2ab3('0x2d')];if(!_0x2e909f['query'][_0x2ab3('0x34')](_0x2ab3('0x35'))){_0x41e530[_0x2ab3('0x36')]=qs[_0x2ab3('0x36')](_0x2e909f[_0x2ab3('0x2e')]['limit']);_0x41e530[_0x2ab3('0x1c')]=qs[_0x2ab3('0x1c')](_0x2e909f[_0x2ab3('0x2e')]['offset']);}_0x41e530[_0x2ab3('0x37')]=qs['sort'](_0x2e909f[_0x2ab3('0x2e')][_0x2ab3('0x38')]);_0x41e530['where']=qs[_0x2ab3('0x2f')](_[_0x2ab3('0x39')](_0x2e909f['query'],_0x130cb4['filters']),_0x59dbf2);if(_0x2e909f['query'][_0x2ab3('0x3a')]){_0x41e530[_0x2ab3('0x3b')]=_['merge'](_0x41e530['where'],{'$or':_[_0x2ab3('0x27')](_0x59dbf2,function(_0x97cfc7){if(_0x97cfc7[_0x2ab3('0x2b')]!=='VIRTUAL'){var _0x1e767a={};_0x1e767a[_0x97cfc7['name']]={'$like':'%'+_0x2e909f[_0x2ab3('0x2e')][_0x2ab3('0x3a')]+'%'};return _0x1e767a;}})});}_0x41e530=_[_0x2ab3('0x3c')]({},_0x41e530,_0x2e909f['options']);var _0x5bbbae={'where':_0x41e530[_0x2ab3('0x3b')]};return db[_0x2ab3('0x28')][_0x2ab3('0x1b')](_0x5bbbae)[_0x2ab3('0x21')](function(_0x307fb4){_0x52f85f[_0x2ab3('0x1b')]=_0x307fb4;if(_0x2e909f[_0x2ab3('0x2e')]['includeAll']){_0x41e530[_0x2ab3('0x3d')]=[{'all':!![]}];}return db[_0x2ab3('0x28')][_0x2ab3('0x3e')](_0x41e530);})[_0x2ab3('0x21')](function(_0x317a97){_0x52f85f[_0x2ab3('0x3f')]=_0x317a97;return _0x52f85f;})[_0x2ab3('0x21')](respondWithFilteredResult(_0x73b038,_0x41e530))[_0x2ab3('0x40')](handleError(_0x73b038,null));};exports[_0x2ab3('0x41')]=function(_0x176e11,_0x2db365){var _0x477192={'raw':!![],'where':{'id':_0x176e11[_0x2ab3('0x42')]['id']}},_0x42387b={};_0x42387b[_0x2ab3('0x2d')]=_[_0x2ab3('0x43')](db[_0x2ab3('0x28')][_0x2ab3('0x29')]);_0x42387b[_0x2ab3('0x2e')]=_[_0x2ab3('0x43')](_0x176e11[_0x2ab3('0x2e')]);_0x42387b[_0x2ab3('0x2f')]=_[_0x2ab3('0x30')](_0x42387b[_0x2ab3('0x2d')],_0x42387b['query']);_0x477192[_0x2ab3('0x31')]=_[_0x2ab3('0x30')](_0x42387b['model'],qs['fields'](_0x176e11['query'][_0x2ab3('0x32')]));_0x477192[_0x2ab3('0x31')]=_0x477192[_0x2ab3('0x31')][_0x2ab3('0x33')]?_0x477192[_0x2ab3('0x31')]:_0x42387b[_0x2ab3('0x2d')];if(_0x176e11[_0x2ab3('0x2e')]['includeAll']){_0x477192[_0x2ab3('0x3d')]=[{'all':!![]}];}_0x477192=_[_0x2ab3('0x3c')]({},_0x477192,_0x176e11[_0x2ab3('0x44')]);return db[_0x2ab3('0x28')]['find'](_0x477192)[_0x2ab3('0x21')](handleEntityNotFound(_0x2db365,null))[_0x2ab3('0x21')](respondWithResult(_0x2db365,null))[_0x2ab3('0x40')](handleError(_0x2db365,null));};exports[_0x2ab3('0x45')]=function(_0xb1c865,_0x4f0945){return db[_0x2ab3('0x28')][_0x2ab3('0x45')](_0xb1c865['body'],{})['then'](respondWithResult(_0x4f0945,0xc9))[_0x2ab3('0x40')](handleError(_0x4f0945,null));};exports[_0x2ab3('0x20')]=function(_0x175346,_0x2bf796){if(_0x175346[_0x2ab3('0x46')]['id']){delete _0x175346['body']['id'];}return db[_0x2ab3('0x28')][_0x2ab3('0x47')]({'where':{'id':_0x175346[_0x2ab3('0x42')]['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x2bf796,null))[_0x2ab3('0x21')](saveUpdates(_0x175346[_0x2ab3('0x46')],null))[_0x2ab3('0x21')](respondWithResult(_0x2bf796,null))[_0x2ab3('0x40')](handleError(_0x2bf796,null));};exports[_0x2ab3('0x22')]=function(_0x19e294,_0x9c90f1){return db[_0x2ab3('0x28')]['find']({'where':{'id':_0x19e294[_0x2ab3('0x42')]['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x9c90f1,null))[_0x2ab3('0x21')](removeEntity(_0x9c90f1,null))[_0x2ab3('0x40')](handleError(_0x9c90f1,null));};exports['describe']=function(_0x56b519,_0x425698){return db['SmsQueueReport'][_0x2ab3('0x48')]()[_0x2ab3('0x21')](respondWithResult(_0x425698,null))[_0x2ab3('0x40')](handleError(_0x425698,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c4ae502..f620f61 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 _0xb545=['SmsQueueReport','report_sms_queue','uniqueid','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xb545,0xcf));var _0x5b54=function(_0x5227e1,_0x4e2cdc){_0x5227e1=_0x5227e1-0x0;var _0x5cd1e0=_0xb545[_0x5227e1];return _0x5cd1e0;};'use strict';var _=require('lodash');var util=require(_0x5b54('0x0'));var logger=require('../../config/logger')(_0x5b54('0x1'));var moment=require(_0x5b54('0x2'));var BPromise=require(_0x5b54('0x3'));var rp=require(_0x5b54('0x4'));var fs=require('fs');var path=require(_0x5b54('0x5'));var rimraf=require('rimraf');var config=require(_0x5b54('0x6'));var attributes=require(_0x5b54('0x7'));module[_0x5b54('0x8')]=function(_0x867d4d,_0x5abda8){return _0x867d4d['define'](_0x5b54('0x9'),attributes,{'tableName':_0x5b54('0xa'),'paranoid':![],'indexes':[{'name':_0x5b54('0xb'),'fields':[_0x5b54('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8144=['api','moment','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid','lodash','util'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x8144,0xf5));var _0x4814=function(_0x3aae08,_0x2e6e74){_0x3aae08=_0x3aae08-0x0;var _0x39fc75=_0x8144[_0x3aae08];return _0x39fc75;};'use strict';var _=require(_0x4814('0x0'));var util=require(_0x4814('0x1'));var logger=require('../../config/logger')(_0x4814('0x2'));var moment=require(_0x4814('0x3'));var BPromise=require('bluebird');var rp=require(_0x4814('0x4'));var fs=require('fs');var path=require(_0x4814('0x5'));var rimraf=require(_0x4814('0x6'));var config=require(_0x4814('0x7'));var attributes=require(_0x4814('0x8'));module[_0x4814('0x9')]=function(_0x3da152,_0x50164c){return _0x3da152[_0x4814('0xa')](_0x4814('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x4814('0xc'),'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 8184a5b..c074670 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 _0xc867=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsQueueReport','body','options','catch','UpdateSmsQueueReport','update','raw','where','util','moment'];(function(_0x784fec,_0x3f7922){var _0x33975e=function(_0x55e73d){while(--_0x55e73d){_0x784fec['push'](_0x784fec['shift']());}};_0x33975e(++_0x3f7922);}(_0xc867,0xa0));var _0x7c86=function(_0x490623,_0x16652e){_0x490623=_0x490623-0x0;var _0x2a155c=_0xc867[_0x490623];return _0x2a155c;};'use strict';var _=require('lodash');var util=require(_0x7c86('0x0'));var moment=require(_0x7c86('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c86('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c86('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c86('0x4'));var config=require(_0x7c86('0x5'));var jayson=require(_0x7c86('0x6'));var client=jayson[_0x7c86('0x7')][_0x7c86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x308c27,_0x4f2f7d,_0x854336){return new BPromise(function(_0x54d8ec,_0x5016c7){return client[_0x7c86('0x9')](_0x308c27,_0x854336)[_0x7c86('0xa')](function(_0x2ab475){logger[_0x7c86('0xb')](_0x7c86('0xc'),_0x4f2f7d,_0x7c86('0xd'));logger[_0x7c86('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x4f2f7d,_0x7c86('0xd'),JSON[_0x7c86('0xf')](_0x2ab475));if(_0x2ab475[_0x7c86('0x10')]){if(_0x2ab475[_0x7c86('0x10')]['code']===0x1f4){logger[_0x7c86('0x10')](_0x7c86('0xc'),_0x4f2f7d,_0x2ab475[_0x7c86('0x10')]['message']);return _0x5016c7(_0x2ab475[_0x7c86('0x10')]['message']);}logger[_0x7c86('0x10')](_0x7c86('0xc'),_0x4f2f7d,_0x2ab475[_0x7c86('0x10')][_0x7c86('0x11')]);return _0x54d8ec(_0x2ab475[_0x7c86('0x10')][_0x7c86('0x11')]);}else{logger[_0x7c86('0xb')](_0x7c86('0xc'),_0x4f2f7d,'request\x20sent');_0x54d8ec(_0x2ab475[_0x7c86('0x12')][_0x7c86('0x11')]);}})['catch'](function(_0x45916d){logger[_0x7c86('0x10')](_0x7c86('0xc'),_0x4f2f7d,_0x45916d);_0x5016c7(_0x45916d);});});}exports[_0x7c86('0x13')]=function(_0x33f8c0){var _0x218cbe=this;return new Promise(function(_0xcad03c,_0x5c2d1e){return db['SmsQueueReport']['create'](_0x33f8c0[_0x7c86('0x14')],{'raw':_0x33f8c0[_0x7c86('0x15')]?_0x33f8c0['options']['raw']===undefined?!![]:![]:!![]})[_0x7c86('0xa')](function(_0x31419b){logger[_0x7c86('0xb')](_0x7c86('0x13'),_0x33f8c0);logger['debug'](_0x7c86('0x13'),_0x33f8c0,JSON[_0x7c86('0xf')](_0x31419b));_0xcad03c(_0x31419b);})[_0x7c86('0x16')](function(_0xb48995){logger[_0x7c86('0x10')](_0x7c86('0x13'),_0xb48995[_0x7c86('0x11')],_0x33f8c0);_0x5c2d1e(_0x218cbe[_0x7c86('0x10')](0x1f4,_0xb48995[_0x7c86('0x11')]));});});};exports[_0x7c86('0x17')]=function(_0x154a6d){var _0x4b447f=this;return new Promise(function(_0x4eb7fe,_0x3762c4){return db['SmsQueueReport'][_0x7c86('0x18')](_0x154a6d[_0x7c86('0x14')],{'raw':_0x154a6d[_0x7c86('0x15')]?_0x154a6d['options'][_0x7c86('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x154a6d[_0x7c86('0x15')]?_0x154a6d[_0x7c86('0x15')][_0x7c86('0x1a')]||null:null,'attributes':_0x154a6d['options']?_0x154a6d[_0x7c86('0x15')]['attributes']||null:null,'limit':_0x154a6d['options']?_0x154a6d[_0x7c86('0x15')]['limit']||null:null})[_0x7c86('0xa')](function(_0x28ccba){logger[_0x7c86('0xb')](_0x7c86('0x17'),_0x154a6d);logger[_0x7c86('0xe')](_0x7c86('0x17'),_0x154a6d,JSON['stringify'](_0x28ccba));_0x4eb7fe(_0x28ccba);})[_0x7c86('0x16')](function(_0x38ffea){logger[_0x7c86('0x10')](_0x7c86('0x17'),_0x38ffea[_0x7c86('0x11')],_0x154a6d);_0x3762c4(_0x4b447f[_0x7c86('0x10')](0x1f4,_0x38ffea[_0x7c86('0x11')]));});});}; \ No newline at end of file +var _0x4b08=['SmsQueueReport','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsQueueReport'];(function(_0x3124f4,_0x114714){var _0x3aa839=function(_0x1bfe42){while(--_0x1bfe42){_0x3124f4['push'](_0x3124f4['shift']());}};_0x3aa839(++_0x114714);}(_0x4b08,0x149));var _0x84b0=function(_0x35de1d,_0x116ce9){_0x35de1d=_0x35de1d-0x0;var _0xec7016=_0x4b08[_0x35de1d];return _0xec7016;};'use strict';var _=require(_0x84b0('0x0'));var util=require(_0x84b0('0x1'));var moment=require(_0x84b0('0x2'));var BPromise=require(_0x84b0('0x3'));var rs=require(_0x84b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x84b0('0x5'));var logger=require('../../config/logger')(_0x84b0('0x6'));var config=require(_0x84b0('0x7'));var jayson=require(_0x84b0('0x8'));var client=jayson[_0x84b0('0x9')][_0x84b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d6d9b,_0x4ee79b,_0x57cfba){return new BPromise(function(_0x1b09b6,_0x325e9d){return client['request'](_0x4d6d9b,_0x57cfba)[_0x84b0('0xb')](function(_0x356a0b){logger['info'](_0x84b0('0xc'),_0x4ee79b,'request\x20sent');logger[_0x84b0('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x4ee79b,_0x84b0('0xe'),JSON[_0x84b0('0xf')](_0x356a0b));if(_0x356a0b['error']){if(_0x356a0b[_0x84b0('0x10')][_0x84b0('0x11')]===0x1f4){logger[_0x84b0('0x10')](_0x84b0('0xc'),_0x4ee79b,_0x356a0b[_0x84b0('0x10')][_0x84b0('0x12')]);return _0x325e9d(_0x356a0b['error'][_0x84b0('0x12')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x4ee79b,_0x356a0b[_0x84b0('0x10')]['message']);return _0x1b09b6(_0x356a0b[_0x84b0('0x10')][_0x84b0('0x12')]);}else{logger[_0x84b0('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x4ee79b,_0x84b0('0xe'));_0x1b09b6(_0x356a0b[_0x84b0('0x14')][_0x84b0('0x12')]);}})[_0x84b0('0x15')](function(_0x3fec25){logger['error'](_0x84b0('0xc'),_0x4ee79b,_0x3fec25);_0x325e9d(_0x3fec25);});});}exports[_0x84b0('0x16')]=function(_0x15dadf){var _0x542084=this;return new Promise(function(_0x16acdd,_0x2935a1){return db[_0x84b0('0x17')]['create'](_0x15dadf[_0x84b0('0x18')],{'raw':_0x15dadf[_0x84b0('0x19')]?_0x15dadf[_0x84b0('0x19')][_0x84b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3b07b8){logger[_0x84b0('0x13')](_0x84b0('0x16'),_0x15dadf);logger[_0x84b0('0xd')](_0x84b0('0x16'),_0x15dadf,JSON[_0x84b0('0xf')](_0x3b07b8));_0x16acdd(_0x3b07b8);})['catch'](function(_0x31c157){logger[_0x84b0('0x10')](_0x84b0('0x16'),_0x31c157[_0x84b0('0x12')],_0x15dadf);_0x2935a1(_0x542084[_0x84b0('0x10')](0x1f4,_0x31c157[_0x84b0('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x4f082c){var _0x1571e1=this;return new Promise(function(_0x1caed9,_0xddab84){return db[_0x84b0('0x17')][_0x84b0('0x1b')](_0x4f082c['body'],{'raw':_0x4f082c[_0x84b0('0x19')]?_0x4f082c[_0x84b0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f082c[_0x84b0('0x19')]?_0x4f082c[_0x84b0('0x19')][_0x84b0('0x1c')]||null:null,'attributes':_0x4f082c[_0x84b0('0x19')]?_0x4f082c[_0x84b0('0x19')][_0x84b0('0x1d')]||null:null,'limit':_0x4f082c[_0x84b0('0x19')]?_0x4f082c['options'][_0x84b0('0x1e')]||null:null})[_0x84b0('0xb')](function(_0x5ee177){logger[_0x84b0('0x13')]('UpdateSmsQueueReport',_0x4f082c);logger[_0x84b0('0xd')](_0x84b0('0x1f'),_0x4f082c,JSON[_0x84b0('0xf')](_0x5ee177));_0x1caed9(_0x5ee177);})[_0x84b0('0x15')](function(_0x5abe96){logger[_0x84b0('0x10')](_0x84b0('0x1f'),_0x5abe96[_0x84b0('0x12')],_0x4f082c);_0xddab84(_0x1571e1[_0x84b0('0x10')](0x1f4,_0x5abe96[_0x84b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c338528..958ef52 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 _0x80ed=['get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index'];(function(_0x2db607,_0x229405){var _0xf47f58=function(_0xc538f4){while(--_0xc538f4){_0x2db607['push'](_0x2db607['shift']());}};_0xf47f58(++_0x229405);}(_0x80ed,0x11c));var _0xd80e=function(_0x46c1f3,_0x414934){_0x46c1f3=_0x46c1f3-0x0;var _0x36de85=_0x80ed[_0x46c1f3];return _0x36de85;};'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 auth=require(_0xd80e('0x4'));var interaction=require(_0xd80e('0x5'));var config=require(_0xd80e('0x6'));var controller=require(_0xd80e('0x7'));router['get']('/',auth[_0xd80e('0x8')](),controller[_0xd80e('0x9')]);router[_0xd80e('0xa')]('/describe',auth[_0xd80e('0x8')](),controller[_0xd80e('0xb')]);router[_0xd80e('0xa')](_0xd80e('0xc'),auth[_0xd80e('0x8')](),controller[_0xd80e('0xd')]);router[_0xd80e('0xe')]('/',auth[_0xd80e('0x8')](),controller[_0xd80e('0xf')]);router[_0xd80e('0x10')]('/:id',auth[_0xd80e('0x8')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')](_0xd80e('0xc'),auth[_0xd80e('0x8')](),controller[_0xd80e('0x13')]);module[_0xd80e('0x14')]=router; \ No newline at end of file +var _0x8603=['put','update','/:id','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create'];(function(_0x39e3ab,_0x374313){var _0x40af78=function(_0x3df582){while(--_0x3df582){_0x39e3ab['push'](_0x39e3ab['shift']());}};_0x40af78(++_0x374313);}(_0x8603,0x190));var _0x3860=function(_0xe38764,_0x28ce79){_0xe38764=_0xe38764-0x0;var _0x5979cf=_0x8603[_0xe38764];return _0x5979cf;};'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 auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./smsTransferReport.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/',auth['isAuthenticated'](),controller[_0x3860('0xd')]);router[_0x3860('0xe')]('/:id',auth[_0x3860('0x9')](),controller[_0x3860('0xf')]);router['delete'](_0x3860('0x10'),auth[_0x3860('0x9')](),controller['destroy']);module[_0x3860('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9cc3804..ee82216 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 _0xaf52=['sequelize','exports','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaf52,0x131));var _0x2af5=function(_0x1f38dd,_0x41f9c6){_0x1f38dd=_0x1f38dd-0x0;var _0xe44841=_0xaf52[_0x1f38dd];return _0xe44841;};'use strict';var moment=require(_0x2af5('0x0'));var Sequelize=require(_0x2af5('0x1'));module[_0x2af5('0x2')]={'uniqueid':{'type':Sequelize[_0x2af5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2af5('0x4')](_0x2af5('0x5'),_0x2af5('0x6'),_0x2af5('0x7')),'allowNull':![],'defaultValue':_0x2af5('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2af5('0x8')]}}; \ No newline at end of file +var _0xe6ca=['queue','DATE','moment','sequelize','exports','ENUM','account'];(function(_0x55d0c1,_0x565b06){var _0x5751b1=function(_0x455510){while(--_0x455510){_0x55d0c1['push'](_0x55d0c1['shift']());}};_0x5751b1(++_0x565b06);}(_0xe6ca,0x167));var _0xae6c=function(_0xf2efeb,_0x2ee064){_0xf2efeb=_0xf2efeb-0x0;var _0x25004b=_0xe6ca[_0xf2efeb];return _0x25004b;};'use strict';var moment=require(_0xae6c('0x0'));var Sequelize=require(_0xae6c('0x1'));module[_0xae6c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xae6c('0x3')](_0xae6c('0x4'),'agent',_0xae6c('0x5')),'allowNull':![],'defaultValue':_0xae6c('0x5')},'transferredAt':{'type':Sequelize[_0xae6c('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 24b749a..fbb11dd 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 _0x028d=['SmsTransferReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','filters','where','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','catch','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x028d,0xff));var _0xd028=function(_0x5709c1,_0x4ce07e){_0x5709c1=_0x5709c1-0x0;var _0x3f267f=_0x028d[_0x5709c1];return _0x3f267f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd028('0x0'));var rimraf=require(_0xd028('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd028('0x2'));var rp=require(_0xd028('0x3'));var moment=require(_0xd028('0x4'));var BPromise=require(_0xd028('0x5'));var Mustache=require(_0xd028('0x6'));var util=require(_0xd028('0x7'));var path=require('path');var sox=require(_0xd028('0x8'));var csv=require(_0xd028('0x9'));var ejs=require(_0xd028('0xa'));var fs=require('fs');var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x9'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var licenseUtil=require(_0xd028('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5fa,_0x144696){_0x144696=_0x144696||0xcc;return function(_0x4817a4){if(_0x4817a4){return _0x34b5fa[_0xd028('0x1b')](_0x144696);}return _0x34b5fa[_0xd028('0x1c')](_0x144696)[_0xd028('0x1d')]();};}function respondWithResult(_0x17b112,_0x1667bf){_0x1667bf=_0x1667bf||0xc8;return function(_0x5ec067){if(_0x5ec067){return _0x17b112[_0xd028('0x1c')](_0x1667bf)[_0xd028('0x1e')](_0x5ec067);}};}function respondWithFilteredResult(_0x3937b4,_0x3bac54){return function(_0x12450d){if(_0x12450d){var _0x463d38=_0x12450d[_0xd028('0x1f')],_0x4834d4=_0x3bac54[_0xd028('0x20')],_0xb65ea4=_0x3bac54[_0xd028('0x20')]+_0x3bac54['limit'],_0x5a6670;if(_0xb65ea4>=_0x463d38){_0xb65ea4=_0x463d38;_0x5a6670=0xc8;}else{_0x5a6670=0xce;}_0x3937b4[_0xd028('0x1c')](_0x5a6670);return _0x3937b4['set'](_0xd028('0x21'),_0x4834d4+'-'+_0xb65ea4+'/'+_0x463d38)['json'](_0x12450d);}return null;};}function patchUpdates(_0x14a802){return function(_0x415d6c){try{jsonpatch[_0xd028('0x22')](_0x415d6c,_0x14a802,!![]);}catch(_0x5811ed){return BPromise[_0xd028('0x23')](_0x5811ed);}return _0x415d6c[_0xd028('0x24')]();};}function saveUpdates(_0x1a2767,_0x1648a7){return function(_0x58515e){if(_0x58515e){return _0x58515e['update'](_0x1a2767)[_0xd028('0x25')](function(_0x8af385){return _0x8af385;});}return null;};}function removeEntity(_0x8a964d,_0x75657f){return function(_0x3203f9){if(_0x3203f9){return _0x3203f9[_0xd028('0x26')]()[_0xd028('0x25')](function(){_0x8a964d['status'](0xcc)[_0xd028('0x1d')]();});}};}function handleEntityNotFound(_0x10d629,_0x13e5f4){return function(_0x1ec134){if(!_0x1ec134){_0x10d629['sendStatus'](0x194);}return _0x1ec134;};}function handleError(_0x2ad8ee,_0x1de0cc){_0x1de0cc=_0x1de0cc||0x1f4;return function(_0x26eb4e){logger[_0xd028('0x27')](_0x26eb4e[_0xd028('0x28')]);if(_0x26eb4e[_0xd028('0x29')]){delete _0x26eb4e[_0xd028('0x29')];}_0x2ad8ee[_0xd028('0x1c')](_0x1de0cc)[_0xd028('0x2a')](_0x26eb4e);};}exports[_0xd028('0x2b')]=function(_0x38a294,_0x2db5c1){var _0x20d7ff={},_0x2aa5bf={},_0x39a8dd={'count':0x0,'rows':[]};var _0x3294fe=_[_0xd028('0x2c')](db[_0xd028('0x2d')][_0xd028('0x2e')],function(_0x23d9dd){return{'name':_0x23d9dd[_0xd028('0x2f')],'type':_0x23d9dd['type']['key']};});_0x2aa5bf[_0xd028('0x30')]=_[_0xd028('0x2c')](_0x3294fe,_0xd028('0x29'));_0x2aa5bf[_0xd028('0x31')]=_[_0xd028('0x32')](_0x38a294[_0xd028('0x31')]);_0x2aa5bf['filters']=_['intersection'](_0x2aa5bf[_0xd028('0x30')],_0x2aa5bf[_0xd028('0x31')]);_0x20d7ff[_0xd028('0x33')]=_[_0xd028('0x34')](_0x2aa5bf[_0xd028('0x30')],qs[_0xd028('0x35')](_0x38a294[_0xd028('0x31')]['fields']));_0x20d7ff['attributes']=_0x20d7ff[_0xd028('0x33')][_0xd028('0x36')]?_0x20d7ff['attributes']:_0x2aa5bf['model'];if(!_0x38a294[_0xd028('0x31')][_0xd028('0x37')](_0xd028('0x38'))){_0x20d7ff[_0xd028('0x39')]=qs[_0xd028('0x39')](_0x38a294[_0xd028('0x31')][_0xd028('0x39')]);_0x20d7ff[_0xd028('0x20')]=qs[_0xd028('0x20')](_0x38a294[_0xd028('0x31')][_0xd028('0x20')]);}_0x20d7ff['order']=qs['sort'](_0x38a294['query']['sort']);_0x20d7ff['where']=qs[_0xd028('0x3a')](_['pick'](_0x38a294['query'],_0x2aa5bf['filters']),_0x3294fe);if(_0x38a294[_0xd028('0x31')]['filter']){_0x20d7ff[_0xd028('0x3b')]=_['merge'](_0x20d7ff['where'],{'$or':_[_0xd028('0x2c')](_0x3294fe,function(_0x3be456){if(_0x3be456['type']!==_0xd028('0x3c')){var _0x4c705c={};_0x4c705c[_0x3be456['name']]={'$like':'%'+_0x38a294['query']['filter']+'%'};return _0x4c705c;}})});}_0x20d7ff=_['merge']({},_0x20d7ff,_0x38a294[_0xd028('0x3d')]);var _0x24ba63={'where':_0x20d7ff['where']};return db[_0xd028('0x2d')][_0xd028('0x1f')](_0x24ba63)[_0xd028('0x25')](function(_0x42a6a3){_0x39a8dd[_0xd028('0x1f')]=_0x42a6a3;if(_0x38a294[_0xd028('0x31')]['includeAll']){_0x20d7ff[_0xd028('0x3e')]=[{'all':!![]}];}return db[_0xd028('0x2d')][_0xd028('0x3f')](_0x20d7ff);})['then'](function(_0xa46302){_0x39a8dd[_0xd028('0x40')]=_0xa46302;return _0x39a8dd;})[_0xd028('0x25')](respondWithFilteredResult(_0x2db5c1,_0x20d7ff))['catch'](handleError(_0x2db5c1,null));};exports[_0xd028('0x41')]=function(_0x4fdc45,_0x26e51c){var _0x1b791a={'raw':!![],'where':{'id':_0x4fdc45[_0xd028('0x42')]['id']}},_0x1185c1={};_0x1185c1[_0xd028('0x30')]=_[_0xd028('0x32')](db[_0xd028('0x2d')][_0xd028('0x2e')]);_0x1185c1[_0xd028('0x31')]=_['keys'](_0x4fdc45[_0xd028('0x31')]);_0x1185c1[_0xd028('0x3a')]=_[_0xd028('0x34')](_0x1185c1[_0xd028('0x30')],_0x1185c1['query']);_0x1b791a[_0xd028('0x33')]=_[_0xd028('0x34')](_0x1185c1[_0xd028('0x30')],qs['fields'](_0x4fdc45[_0xd028('0x31')][_0xd028('0x35')]));_0x1b791a['attributes']=_0x1b791a[_0xd028('0x33')][_0xd028('0x36')]?_0x1b791a[_0xd028('0x33')]:_0x1185c1[_0xd028('0x30')];if(_0x4fdc45[_0xd028('0x31')][_0xd028('0x43')]){_0x1b791a[_0xd028('0x3e')]=[{'all':!![]}];}_0x1b791a=_[_0xd028('0x44')]({},_0x1b791a,_0x4fdc45[_0xd028('0x3d')]);return db[_0xd028('0x2d')]['find'](_0x1b791a)[_0xd028('0x25')](handleEntityNotFound(_0x26e51c,null))[_0xd028('0x25')](respondWithResult(_0x26e51c,null))[_0xd028('0x45')](handleError(_0x26e51c,null));};exports[_0xd028('0x46')]=function(_0xe198b8,_0x1cc4cf){return db['SmsTransferReport'][_0xd028('0x46')](_0xe198b8[_0xd028('0x47')],{})[_0xd028('0x25')](respondWithResult(_0x1cc4cf,0xc9))[_0xd028('0x45')](handleError(_0x1cc4cf,null));};exports[_0xd028('0x48')]=function(_0x53c7af,_0x570be3){if(_0x53c7af['body']['id']){delete _0x53c7af['body']['id'];}return db[_0xd028('0x2d')][_0xd028('0x49')]({'where':{'id':_0x53c7af[_0xd028('0x42')]['id']}})[_0xd028('0x25')](handleEntityNotFound(_0x570be3,null))[_0xd028('0x25')](saveUpdates(_0x53c7af[_0xd028('0x47')],null))[_0xd028('0x25')](respondWithResult(_0x570be3,null))[_0xd028('0x45')](handleError(_0x570be3,null));};exports[_0xd028('0x26')]=function(_0x52489b,_0x369913){return db[_0xd028('0x2d')][_0xd028('0x49')]({'where':{'id':_0x52489b[_0xd028('0x42')]['id']}})[_0xd028('0x25')](handleEntityNotFound(_0x369913,null))[_0xd028('0x25')](removeEntity(_0x369913,null))['catch'](handleError(_0x369913,null));};exports['describe']=function(_0x1335ab,_0x1ba175){return db['SmsTransferReport'][_0xd028('0x4a')]()[_0xd028('0x25')](respondWithResult(_0x1ba175,null))[_0xd028('0x45')](handleError(_0x1ba175,null));}; \ No newline at end of file +var _0xad53=['nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SmsTransferReport','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xad53,0x1ea));var _0x3ad5=function(_0x4e2951,_0x370626){_0x4e2951=_0x4e2951-0x0;var _0x9d83ce=_0xad53[_0x4e2951];return _0x9d83ce;};'use strict';var pdf=require(_0x3ad5('0x0'));var emlformat=require(_0x3ad5('0x1'));var rimraf=require(_0x3ad5('0x2'));var zipdir=require(_0x3ad5('0x3'));var jsonpatch=require(_0x3ad5('0x4'));var rp=require(_0x3ad5('0x5'));var moment=require(_0x3ad5('0x6'));var BPromise=require(_0x3ad5('0x7'));var Mustache=require('mustache');var util=require(_0x3ad5('0x8'));var path=require(_0x3ad5('0x9'));var sox=require(_0x3ad5('0xa'));var csv=require(_0x3ad5('0xb'));var ejs=require(_0x3ad5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ad5('0xd'));var deskjs=require(_0x3ad5('0xe'));var toCsv=require(_0x3ad5('0xb'));var querystring=require(_0x3ad5('0xf'));var Papa=require(_0x3ad5('0x10'));var Redis=require(_0x3ad5('0x11'));var authService=require(_0x3ad5('0x12'));var qs=require(_0x3ad5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ad5('0x14'));var logger=require(_0x3ad5('0x15'))(_0x3ad5('0x16'));var utils=require(_0x3ad5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ad5('0x18'));var db=require(_0x3ad5('0x19'))['db'];function respondWithStatusCode(_0x1dc68b,_0x542e82){_0x542e82=_0x542e82||0xcc;return function(_0x1bd82f){if(_0x1bd82f){return _0x1dc68b[_0x3ad5('0x1a')](_0x542e82);}return _0x1dc68b[_0x3ad5('0x1b')](_0x542e82)[_0x3ad5('0x1c')]();};}function respondWithResult(_0x2cfe73,_0x28d6ad){_0x28d6ad=_0x28d6ad||0xc8;return function(_0x50758e){if(_0x50758e){return _0x2cfe73['status'](_0x28d6ad)[_0x3ad5('0x1d')](_0x50758e);}};}function respondWithFilteredResult(_0x278364,_0xabcbc0){return function(_0x70aec9){if(_0x70aec9){var _0x1d5868=_0x70aec9[_0x3ad5('0x1e')],_0x365f38=_0xabcbc0[_0x3ad5('0x1f')],_0x533ea1=_0xabcbc0['offset']+_0xabcbc0['limit'],_0x56123a;if(_0x533ea1>=_0x1d5868){_0x533ea1=_0x1d5868;_0x56123a=0xc8;}else{_0x56123a=0xce;}_0x278364[_0x3ad5('0x1b')](_0x56123a);return _0x278364[_0x3ad5('0x20')](_0x3ad5('0x21'),_0x365f38+'-'+_0x533ea1+'/'+_0x1d5868)[_0x3ad5('0x1d')](_0x70aec9);}return null;};}function patchUpdates(_0x523519){return function(_0xb97fb9){try{jsonpatch[_0x3ad5('0x22')](_0xb97fb9,_0x523519,!![]);}catch(_0x36935a){return BPromise[_0x3ad5('0x23')](_0x36935a);}return _0xb97fb9[_0x3ad5('0x24')]();};}function saveUpdates(_0x1c37c7,_0x3aaef8){return function(_0x3a8960){if(_0x3a8960){return _0x3a8960[_0x3ad5('0x25')](_0x1c37c7)['then'](function(_0x98dfb5){return _0x98dfb5;});}return null;};}function removeEntity(_0x4d00e2,_0x936a29){return function(_0x58a06f){if(_0x58a06f){return _0x58a06f[_0x3ad5('0x26')]()[_0x3ad5('0x27')](function(){_0x4d00e2[_0x3ad5('0x1b')](0xcc)[_0x3ad5('0x1c')]();});}};}function handleEntityNotFound(_0x24d2ee,_0x26b402){return function(_0x4c59dc){if(!_0x4c59dc){_0x24d2ee[_0x3ad5('0x1a')](0x194);}return _0x4c59dc;};}function handleError(_0x1aa2e9,_0x4d1a4c){_0x4d1a4c=_0x4d1a4c||0x1f4;return function(_0xaa80a){logger[_0x3ad5('0x28')](_0xaa80a[_0x3ad5('0x29')]);if(_0xaa80a['name']){delete _0xaa80a[_0x3ad5('0x2a')];}_0x1aa2e9[_0x3ad5('0x1b')](_0x4d1a4c)[_0x3ad5('0x2b')](_0xaa80a);};}exports['index']=function(_0x512d41,_0x578463){var _0x33c53e={},_0x4674f2={},_0x141680={'count':0x0,'rows':[]};var _0x4d7e51=_[_0x3ad5('0x2c')](db[_0x3ad5('0x2d')]['rawAttributes'],function(_0x4c66f7){return{'name':_0x4c66f7[_0x3ad5('0x2e')],'type':_0x4c66f7['type'][_0x3ad5('0x2f')]};});_0x4674f2[_0x3ad5('0x30')]=_[_0x3ad5('0x2c')](_0x4d7e51,_0x3ad5('0x2a'));_0x4674f2[_0x3ad5('0x31')]=_['keys'](_0x512d41['query']);_0x4674f2[_0x3ad5('0x32')]=_[_0x3ad5('0x33')](_0x4674f2[_0x3ad5('0x30')],_0x4674f2[_0x3ad5('0x31')]);_0x33c53e['attributes']=_[_0x3ad5('0x33')](_0x4674f2[_0x3ad5('0x30')],qs[_0x3ad5('0x34')](_0x512d41[_0x3ad5('0x31')][_0x3ad5('0x34')]));_0x33c53e[_0x3ad5('0x35')]=_0x33c53e[_0x3ad5('0x35')][_0x3ad5('0x36')]?_0x33c53e[_0x3ad5('0x35')]:_0x4674f2[_0x3ad5('0x30')];if(!_0x512d41['query'][_0x3ad5('0x37')](_0x3ad5('0x38'))){_0x33c53e[_0x3ad5('0x39')]=qs[_0x3ad5('0x39')](_0x512d41[_0x3ad5('0x31')][_0x3ad5('0x39')]);_0x33c53e[_0x3ad5('0x1f')]=qs['offset'](_0x512d41['query'][_0x3ad5('0x1f')]);}_0x33c53e[_0x3ad5('0x3a')]=qs['sort'](_0x512d41[_0x3ad5('0x31')][_0x3ad5('0x3b')]);_0x33c53e[_0x3ad5('0x3c')]=qs[_0x3ad5('0x32')](_[_0x3ad5('0x3d')](_0x512d41[_0x3ad5('0x31')],_0x4674f2[_0x3ad5('0x32')]),_0x4d7e51);if(_0x512d41[_0x3ad5('0x31')][_0x3ad5('0x3e')]){_0x33c53e[_0x3ad5('0x3c')]=_[_0x3ad5('0x3f')](_0x33c53e[_0x3ad5('0x3c')],{'$or':_[_0x3ad5('0x2c')](_0x4d7e51,function(_0x5b2893){if(_0x5b2893[_0x3ad5('0x40')]!=='VIRTUAL'){var _0xe693b={};_0xe693b[_0x5b2893[_0x3ad5('0x2a')]]={'$like':'%'+_0x512d41[_0x3ad5('0x31')][_0x3ad5('0x3e')]+'%'};return _0xe693b;}})});}_0x33c53e=_[_0x3ad5('0x3f')]({},_0x33c53e,_0x512d41[_0x3ad5('0x41')]);var _0x183dcb={'where':_0x33c53e['where']};return db['SmsTransferReport'][_0x3ad5('0x1e')](_0x183dcb)[_0x3ad5('0x27')](function(_0x3734c5){_0x141680[_0x3ad5('0x1e')]=_0x3734c5;if(_0x512d41[_0x3ad5('0x31')][_0x3ad5('0x42')]){_0x33c53e[_0x3ad5('0x43')]=[{'all':!![]}];}return db[_0x3ad5('0x2d')][_0x3ad5('0x44')](_0x33c53e);})[_0x3ad5('0x27')](function(_0xdece6d){_0x141680[_0x3ad5('0x45')]=_0xdece6d;return _0x141680;})[_0x3ad5('0x27')](respondWithFilteredResult(_0x578463,_0x33c53e))[_0x3ad5('0x46')](handleError(_0x578463,null));};exports[_0x3ad5('0x47')]=function(_0x327dbb,_0x26ae59){var _0x29726b={'raw':!![],'where':{'id':_0x327dbb['params']['id']}},_0x5ec9c3={};_0x5ec9c3[_0x3ad5('0x30')]=_[_0x3ad5('0x48')](db['SmsTransferReport'][_0x3ad5('0x49')]);_0x5ec9c3['query']=_['keys'](_0x327dbb[_0x3ad5('0x31')]);_0x5ec9c3[_0x3ad5('0x32')]=_[_0x3ad5('0x33')](_0x5ec9c3[_0x3ad5('0x30')],_0x5ec9c3[_0x3ad5('0x31')]);_0x29726b[_0x3ad5('0x35')]=_[_0x3ad5('0x33')](_0x5ec9c3['model'],qs[_0x3ad5('0x34')](_0x327dbb[_0x3ad5('0x31')][_0x3ad5('0x34')]));_0x29726b[_0x3ad5('0x35')]=_0x29726b[_0x3ad5('0x35')]['length']?_0x29726b[_0x3ad5('0x35')]:_0x5ec9c3[_0x3ad5('0x30')];if(_0x327dbb[_0x3ad5('0x31')][_0x3ad5('0x42')]){_0x29726b['include']=[{'all':!![]}];}_0x29726b=_['merge']({},_0x29726b,_0x327dbb['options']);return db[_0x3ad5('0x2d')][_0x3ad5('0x4a')](_0x29726b)[_0x3ad5('0x27')](handleEntityNotFound(_0x26ae59,null))[_0x3ad5('0x27')](respondWithResult(_0x26ae59,null))['catch'](handleError(_0x26ae59,null));};exports['create']=function(_0x2a86fd,_0x4170d1){return db[_0x3ad5('0x2d')]['create'](_0x2a86fd[_0x3ad5('0x4b')],{})[_0x3ad5('0x27')](respondWithResult(_0x4170d1,0xc9))['catch'](handleError(_0x4170d1,null));};exports[_0x3ad5('0x25')]=function(_0x31f25c,_0x2ad1dd){if(_0x31f25c['body']['id']){delete _0x31f25c['body']['id'];}return db[_0x3ad5('0x2d')]['find']({'where':{'id':_0x31f25c[_0x3ad5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ad1dd,null))[_0x3ad5('0x27')](saveUpdates(_0x31f25c[_0x3ad5('0x4b')],null))['then'](respondWithResult(_0x2ad1dd,null))[_0x3ad5('0x46')](handleError(_0x2ad1dd,null));};exports[_0x3ad5('0x26')]=function(_0x267200,_0x5a8218){return db['SmsTransferReport'][_0x3ad5('0x4a')]({'where':{'id':_0x267200[_0x3ad5('0x4c')]['id']}})[_0x3ad5('0x27')](handleEntityNotFound(_0x5a8218,null))[_0x3ad5('0x27')](removeEntity(_0x5a8218,null))[_0x3ad5('0x46')](handleError(_0x5a8218,null));};exports['describe']=function(_0xb11ec0,_0x457d32){return db['SmsTransferReport'][_0x3ad5('0x4d')]()['then'](respondWithResult(_0x457d32,null))[_0x3ad5('0x46')](handleError(_0x457d32,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ac0ae47..61efced 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 _0xd046=['uniqueid','util','../../config/logger','api','bluebird','rimraf','./smsTransferReport.attributes','define'];(function(_0x4c2b3d,_0x2d97f9){var _0x19174a=function(_0x30c55a){while(--_0x30c55a){_0x4c2b3d['push'](_0x4c2b3d['shift']());}};_0x19174a(++_0x2d97f9);}(_0xd046,0x129));var _0x6d04=function(_0x18b9dd,_0x194228){_0x18b9dd=_0x18b9dd-0x0;var _0x58633e=_0xd046[_0x18b9dd];return _0x58633e;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird','path'];(function(_0x52968c,_0x38b138){var _0x1eef5a=function(_0x73ae67){while(--_0x73ae67){_0x52968c['push'](_0x52968c['shift']());}};_0x1eef5a(++_0x38b138);}(_0xeff8,0x186));var _0x8eff=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xeff8[_0x277107];return _0x1da046;};'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':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('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 4b8ecfb..99296f6 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 _0xc7e7=['ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment','randomstring'];(function(_0x429c12,_0xaa9148){var _0x433cc4=function(_0x1e56c6){while(--_0x1e56c6){_0x429c12['push'](_0x429c12['shift']());}};_0x433cc4(++_0xaa9148);}(_0xc7e7,0x164));var _0x7c7e=function(_0x48b801,_0x230631){_0x48b801=_0x48b801-0x0;var _0x5f46ae=_0xc7e7[_0x48b801];return _0x5f46ae;};'use strict';var _=require(_0x7c7e('0x0'));var util=require(_0x7c7e('0x1'));var moment=require(_0x7c7e('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c7e('0x3'));var fs=require('fs');var Redis=require(_0x7c7e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c7e('0x5'));var logger=require('../../config/logger')(_0x7c7e('0x6'));var config=require(_0x7c7e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c7e('0x8')][_0x7c7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5529b7,_0x400879,_0x679bb2){return new BPromise(function(_0x386f6a,_0x522914){return client[_0x7c7e('0xa')](_0x5529b7,_0x679bb2)[_0x7c7e('0xb')](function(_0x358f61){logger[_0x7c7e('0xc')](_0x7c7e('0xd'),_0x400879,'request\x20sent');logger[_0x7c7e('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x400879,_0x7c7e('0xf'),JSON[_0x7c7e('0x10')](_0x358f61));if(_0x358f61[_0x7c7e('0x11')]){if(_0x358f61[_0x7c7e('0x11')]['code']===0x1f4){logger['error'](_0x7c7e('0xd'),_0x400879,_0x358f61[_0x7c7e('0x11')][_0x7c7e('0x12')]);return _0x522914(_0x358f61['error']['message']);}logger[_0x7c7e('0x11')](_0x7c7e('0xd'),_0x400879,_0x358f61['error'][_0x7c7e('0x12')]);return _0x386f6a(_0x358f61[_0x7c7e('0x11')][_0x7c7e('0x12')]);}else{logger[_0x7c7e('0xc')](_0x7c7e('0xd'),_0x400879,'request\x20sent');_0x386f6a(_0x358f61['result']['message']);}})[_0x7c7e('0x13')](function(_0xbc35c1){logger[_0x7c7e('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x400879,_0xbc35c1);_0x522914(_0xbc35c1);});});} \ No newline at end of file +var _0x0d1c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x253ecc,_0x5d128c){var _0x1bdf15=function(_0x5d17af){while(--_0x5d17af){_0x253ecc['push'](_0x253ecc['shift']());}};_0x1bdf15(++_0x5d128c);}(_0x0d1c,0xd2));var _0xc0d1=function(_0x173962,_0x49b5f5){_0x173962=_0x173962-0x0;var _0x1977f8=_0x0d1c[_0x173962];return _0x1977f8;};'use strict';var _=require(_0xc0d1('0x0'));var util=require(_0xc0d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc0d1('0x2'));var fs=require('fs');var Redis=require(_0xc0d1('0x3'));var db=require(_0xc0d1('0x4'))['db'];var utils=require(_0xc0d1('0x5'));var logger=require(_0xc0d1('0x6'))(_0xc0d1('0x7'));var config=require(_0xc0d1('0x8'));var jayson=require(_0xc0d1('0x9'));var client=jayson[_0xc0d1('0xa')][_0xc0d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32b520,_0x251610,_0xffb636){return new BPromise(function(_0x37f9b3,_0x392b7d){return client[_0xc0d1('0xc')](_0x32b520,_0xffb636)[_0xc0d1('0xd')](function(_0x4adf3d){logger[_0xc0d1('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x251610,_0xc0d1('0xf'));logger[_0xc0d1('0x10')](_0xc0d1('0x11'),_0x251610,_0xc0d1('0xf'),JSON[_0xc0d1('0x12')](_0x4adf3d));if(_0x4adf3d['error']){if(_0x4adf3d['error']['code']===0x1f4){logger[_0xc0d1('0x13')](_0xc0d1('0x14'),_0x251610,_0x4adf3d[_0xc0d1('0x13')][_0xc0d1('0x15')]);return _0x392b7d(_0x4adf3d[_0xc0d1('0x13')]['message']);}logger[_0xc0d1('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x251610,_0x4adf3d[_0xc0d1('0x13')][_0xc0d1('0x15')]);return _0x37f9b3(_0x4adf3d[_0xc0d1('0x13')][_0xc0d1('0x15')]);}else{logger['info'](_0xc0d1('0x14'),_0x251610,'request\x20sent');_0x37f9b3(_0x4adf3d[_0xc0d1('0x16')][_0xc0d1('0x15')]);}})[_0xc0d1('0x17')](function(_0x23877e){logger[_0xc0d1('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x251610,_0x23877e);_0x392b7d(_0x23877e);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 62744df..16eaee1 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 _0xb2b2=['get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','extname','single','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x44bb91,_0x4fd73d){var _0x52e92a=function(_0x39bd4d){while(--_0x39bd4d){_0x44bb91['push'](_0x44bb91['shift']());}};_0x52e92a(++_0x4fd73d);}(_0xb2b2,0x17e));var _0x2b2b=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xb2b2[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x2b2b('0x0'));var util=require('util');var path=require(_0x2b2b('0x1'));var timeout=require(_0x2b2b('0x2'));var express=require(_0x2b2b('0x3'));var router=express[_0x2b2b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b2b('0x5'));var config=require(_0x2b2b('0x6'));var controller=require(_0x2b2b('0x7'));router[_0x2b2b('0x8')]('/',auth[_0x2b2b('0x9')](),controller[_0x2b2b('0xa')]);router['get'](_0x2b2b('0xb'),auth[_0x2b2b('0x9')](),controller[_0x2b2b('0xc')]);router[_0x2b2b('0x8')](_0x2b2b('0xd'),auth[_0x2b2b('0x9')](),controller[_0x2b2b('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c50d4,_0x29c558,_0x3a1b86){_0x3a1b86(null,path[_0x2b2b('0xf')](config[_0x2b2b('0x10')],_0x2b2b('0x11')));},'filename':function(_0x309d62,_0x300bd9,_0x2cddd8){_0x300bd9['originalname']=_0x300bd9['originalname'][_0x2b2b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2cddd8(null,util[_0x2b2b('0x13')](_0x2b2b('0x14'),path[_0x2b2b('0x15')](_0x300bd9[_0x2b2b('0x16')],path['extname'](_0x300bd9[_0x2b2b('0x16')])),Date['now'](),path[_0x2b2b('0x17')](_0x300bd9[_0x2b2b('0x16')])));}})});router['post']('/',upload[_0x2b2b('0x18')]('file'),controller[_0x2b2b('0x19')]);router[_0x2b2b('0x1a')](_0x2b2b('0xb'),auth[_0x2b2b('0x9')](),controller[_0x2b2b('0x1b')]);router[_0x2b2b('0x1c')](_0x2b2b('0xb'),auth['isAuthenticated'](),controller[_0x2b2b('0x1c')]);module[_0x2b2b('0x1d')]=router; \ No newline at end of file +var _0x4fea=['delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','/:id','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post','single','file','create','update'];(function(_0x563cde,_0x188b0d){var _0x3ecb4e=function(_0x3d5e66){while(--_0x3d5e66){_0x563cde['push'](_0x563cde['shift']());}};_0x3ecb4e(++_0x188b0d);}(_0x4fea,0x16e));var _0xa4fe=function(_0x26f783,_0x3b24a7){_0x26f783=_0x26f783-0x0;var _0x175066=_0x4fea[_0x26f783];return _0x175066;};'use strict';var multer=require(_0xa4fe('0x0'));var util=require(_0xa4fe('0x1'));var path=require(_0xa4fe('0x2'));var timeout=require('connect-timeout');var express=require(_0xa4fe('0x3'));var router=express[_0xa4fe('0x4')]();var auth=require(_0xa4fe('0x5'));var interaction=require(_0xa4fe('0x6'));var config=require('../../config/environment');var controller=require(_0xa4fe('0x7'));router[_0xa4fe('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa4fe('0x9'),auth[_0xa4fe('0xa')](),controller['show']);router[_0xa4fe('0x8')]('/:id/download',auth[_0xa4fe('0xa')](),controller[_0xa4fe('0xb')]);var upload=multer({'storage':multer[_0xa4fe('0xc')]({'destination':function(_0x566a84,_0x239cc2,_0x1b3c92){_0x1b3c92(null,path[_0xa4fe('0xd')](config[_0xa4fe('0xe')],_0xa4fe('0xf')));},'filename':function(_0x22b1d7,_0x3bb25a,_0xf3a0ae){_0x3bb25a[_0xa4fe('0x10')]=_0x3bb25a['originalname'][_0xa4fe('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf3a0ae(null,util['format'](_0xa4fe('0x12'),path[_0xa4fe('0x13')](_0x3bb25a[_0xa4fe('0x10')],path[_0xa4fe('0x14')](_0x3bb25a[_0xa4fe('0x10')])),Date['now'](),path[_0xa4fe('0x14')](_0x3bb25a['originalname'])));}})});router[_0xa4fe('0x15')]('/',upload[_0xa4fe('0x16')](_0xa4fe('0x17')),controller[_0xa4fe('0x18')]);router['put'](_0xa4fe('0x9'),auth[_0xa4fe('0xa')](),controller[_0xa4fe('0x19')]);router[_0xa4fe('0x1a')](_0xa4fe('0x9'),auth[_0xa4fe('0xa')](),controller[_0xa4fe('0x1a')]);module[_0xa4fe('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 ba698a8..b7c67b6 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 _0x2daf=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x22991e,_0x4d951e){var _0x2c8857=function(_0x1147b5){while(--_0x1147b5){_0x22991e['push'](_0x22991e['shift']());}};_0x2c8857(++_0x4d951e);}(_0x2daf,0x11a));var _0xf2da=function(_0x36c501,_0x683c53){_0x36c501=_0x36c501-0x0;var _0x2d9fae=_0x2daf[_0x36c501];return _0x2d9fae;};'use strict';var Sequelize=require(_0xf2da('0x0'));module[_0xf2da('0x1')]={'name':{'type':Sequelize[_0xf2da('0x2')],'unique':_0xf2da('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xf2da('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xf2da('0x2')]},'original_format':{'type':Sequelize[_0xf2da('0x2')]},'original_duration':{'type':Sequelize[_0xf2da('0x4')]},'original_sampleCount':{'type':Sequelize[_0xf2da('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf2da('0x6')]},'converted_format':{'type':Sequelize[_0xf2da('0x2')]},'converted_duration':{'type':Sequelize[_0xf2da('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xf2da('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xf2da('0x6')]}}; \ No newline at end of file +var _0xc6c1=['BIGINT','sequelize','exports','STRING','name','FLOAT','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6c1,0x13c));var _0x1c6c=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xc6c1[_0x1f0724];return _0x253ffb;};'use strict';var Sequelize=require(_0x1c6c('0x0'));module[_0x1c6c('0x1')]={'name':{'type':Sequelize[_0x1c6c('0x2')],'unique':_0x1c6c('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1c6c('0x2')]},'display_name':{'type':Sequelize[_0x1c6c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1c6c('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1c6c('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x1c6c('0x5')]},'original_bitRate':{'type':Sequelize[_0x1c6c('0x6')]},'original_sampleRate':{'type':Sequelize[_0x1c6c('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1c6c('0x6')]},'converted_sampleRate':{'type':Sequelize[_0x1c6c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 66df814..05e75d6 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 _0x9263=['name','send','index','map','Sound','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','type','includeAll','findAll','rows','show','params','include','options','catch','find','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','download','join','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','duration','original_sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','0777','body','role','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','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','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','error'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x9263,0xc2));var _0x3926=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9263[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x3926('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3926('0x1'));var zipdir=require(_0x3926('0x2'));var jsonpatch=require(_0x3926('0x3'));var rp=require(_0x3926('0x4'));var moment=require(_0x3926('0x5'));var BPromise=require(_0x3926('0x6'));var Mustache=require(_0x3926('0x7'));var util=require(_0x3926('0x8'));var path=require(_0x3926('0x9'));var sox=require(_0x3926('0xa'));var csv=require('to-csv');var ejs=require(_0x3926('0xb'));var fs=require('fs');var _=require(_0x3926('0xc'));var squel=require(_0x3926('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3926('0xe'));var toCsv=require(_0x3926('0xf'));var querystring=require(_0x3926('0x10'));var Papa=require(_0x3926('0x11'));var Redis=require(_0x3926('0x12'));var authService=require(_0x3926('0x13'));var qs=require(_0x3926('0x14'));var as=require(_0x3926('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3926('0x16'))(_0x3926('0x17'));var utils=require('../../config/utils');var config=require(_0x3926('0x18'));var licenseUtil=require(_0x3926('0x19'));var db=require(_0x3926('0x1a'))['db'];function respondWithStatusCode(_0x102326,_0x249992){_0x249992=_0x249992||0xcc;return function(_0x1b5381){if(_0x1b5381){return _0x102326[_0x3926('0x1b')](_0x249992);}return _0x102326[_0x3926('0x1c')](_0x249992)[_0x3926('0x1d')]();};}function respondWithResult(_0x42aac1,_0x474e42){_0x474e42=_0x474e42||0xc8;return function(_0x2c86bf){if(_0x2c86bf){return _0x42aac1[_0x3926('0x1c')](_0x474e42)[_0x3926('0x1e')](_0x2c86bf);}};}function respondWithFilteredResult(_0x41ae84,_0x1d0bac){return function(_0x43ba87){if(_0x43ba87){var _0x4bfd5e=_0x43ba87[_0x3926('0x1f')],_0x132cf4=_0x1d0bac[_0x3926('0x20')],_0x49a39a=_0x1d0bac['offset']+_0x1d0bac[_0x3926('0x21')],_0x20df8b;if(_0x49a39a>=_0x4bfd5e){_0x49a39a=_0x4bfd5e;_0x20df8b=0xc8;}else{_0x20df8b=0xce;}_0x41ae84['status'](_0x20df8b);return _0x41ae84[_0x3926('0x22')](_0x3926('0x23'),_0x132cf4+'-'+_0x49a39a+'/'+_0x4bfd5e)[_0x3926('0x1e')](_0x43ba87);}return null;};}function patchUpdates(_0x53e957){return function(_0x4d7429){try{jsonpatch[_0x3926('0x24')](_0x4d7429,_0x53e957,!![]);}catch(_0x1b031c){return BPromise[_0x3926('0x25')](_0x1b031c);}return _0x4d7429[_0x3926('0x26')]();};}function saveUpdates(_0x513593,_0x1734b1){return function(_0x34164d){if(_0x34164d){return _0x34164d[_0x3926('0x27')](_0x513593)['then'](function(_0xff02df){return _0xff02df;});}return null;};}function removeEntity(_0xe17bc8,_0x1d27ad){return function(_0x4a5591){if(_0x4a5591){return _0x4a5591['destroy']()[_0x3926('0x28')](function(){var _0x286f28=_0x4a5591[_0x3926('0x29')]({'plain':!![]});var _0x120bc4='Sounds';return db['UserProfileResource'][_0x3926('0x2a')]({'where':{'type':_0x120bc4,'resourceId':_0x286f28['id']}})[_0x3926('0x28')](function(){return _0x4a5591;});})[_0x3926('0x28')](function(){_0xe17bc8[_0x3926('0x1c')](0xcc)[_0x3926('0x1d')]();});}};}function handleEntityNotFound(_0x3987b2,_0x413de6){return function(_0x40e1c2){if(!_0x40e1c2){_0x3987b2['sendStatus'](0x194);}return _0x40e1c2;};}function handleError(_0x32f82d,_0x5b65fb){_0x5b65fb=_0x5b65fb||0x1f4;return function(_0x4cec6e){logger[_0x3926('0x2b')](_0x4cec6e['stack']);if(_0x4cec6e[_0x3926('0x2c')]){delete _0x4cec6e[_0x3926('0x2c')];}_0x32f82d[_0x3926('0x1c')](_0x5b65fb)[_0x3926('0x2d')](_0x4cec6e);};}exports[_0x3926('0x2e')]=function(_0x5afad8,_0x39c1ec){var _0x5957ea={},_0x3d5806={},_0x2c746d={'count':0x0,'rows':[]};var _0x49471f=_[_0x3926('0x2f')](db[_0x3926('0x30')][_0x3926('0x31')],function(_0x4351a2){return{'name':_0x4351a2['fieldName'],'type':_0x4351a2['type']['key']};});_0x3d5806[_0x3926('0x32')]=_[_0x3926('0x2f')](_0x49471f,_0x3926('0x2c'));_0x3d5806['query']=_[_0x3926('0x33')](_0x5afad8[_0x3926('0x34')]);_0x3d5806[_0x3926('0x35')]=_['intersection'](_0x3d5806[_0x3926('0x32')],_0x3d5806[_0x3926('0x34')]);_0x5957ea['attributes']=_[_0x3926('0x36')](_0x3d5806['model'],qs[_0x3926('0x37')](_0x5afad8[_0x3926('0x34')][_0x3926('0x37')]));_0x5957ea['attributes']=_0x5957ea[_0x3926('0x38')][_0x3926('0x39')]?_0x5957ea['attributes']:_0x3d5806[_0x3926('0x32')];if(!_0x5afad8[_0x3926('0x34')]['hasOwnProperty']('nolimit')){_0x5957ea[_0x3926('0x21')]=qs[_0x3926('0x21')](_0x5afad8[_0x3926('0x34')]['limit']);_0x5957ea[_0x3926('0x20')]=qs[_0x3926('0x20')](_0x5afad8[_0x3926('0x34')][_0x3926('0x20')]);}_0x5957ea[_0x3926('0x3a')]=qs[_0x3926('0x3b')](_0x5afad8['query'][_0x3926('0x3b')]);_0x5957ea[_0x3926('0x3c')]=qs[_0x3926('0x35')](_['pick'](_0x5afad8[_0x3926('0x34')],_0x3d5806[_0x3926('0x35')]),_0x49471f);if(_0x5afad8[_0x3926('0x34')][_0x3926('0x3d')]){_0x5957ea[_0x3926('0x3c')]=_[_0x3926('0x3e')](_0x5957ea['where'],{'$or':_[_0x3926('0x2f')](_0x49471f,function(_0x5f58e3){if(_0x5f58e3[_0x3926('0x3f')]!=='VIRTUAL'){var _0x15fed9={};_0x15fed9[_0x5f58e3[_0x3926('0x2c')]]={'$like':'%'+_0x5afad8[_0x3926('0x34')][_0x3926('0x3d')]+'%'};return _0x15fed9;}})});}_0x5957ea=_['merge']({},_0x5957ea,_0x5afad8['options']);var _0x3e8955={'where':_0x5957ea[_0x3926('0x3c')]};return db[_0x3926('0x30')][_0x3926('0x1f')](_0x3e8955)['then'](function(_0x2a935d){_0x2c746d[_0x3926('0x1f')]=_0x2a935d;if(_0x5afad8['query'][_0x3926('0x40')]){_0x5957ea['include']=[{'all':!![]}];}return db[_0x3926('0x30')][_0x3926('0x41')](_0x5957ea);})[_0x3926('0x28')](function(_0x23b33a){_0x2c746d[_0x3926('0x42')]=_0x23b33a;return _0x2c746d;})[_0x3926('0x28')](respondWithFilteredResult(_0x39c1ec,_0x5957ea))['catch'](handleError(_0x39c1ec,null));};exports[_0x3926('0x43')]=function(_0x1f7164,_0x498228){var _0x477cbd={'raw':!![],'where':{'id':_0x1f7164[_0x3926('0x44')]['id']}},_0x20dfdf={};_0x20dfdf['model']=_[_0x3926('0x33')](db[_0x3926('0x30')]['rawAttributes']);_0x20dfdf[_0x3926('0x34')]=_[_0x3926('0x33')](_0x1f7164[_0x3926('0x34')]);_0x20dfdf[_0x3926('0x35')]=_[_0x3926('0x36')](_0x20dfdf[_0x3926('0x32')],_0x20dfdf['query']);_0x477cbd['attributes']=_[_0x3926('0x36')](_0x20dfdf['model'],qs['fields'](_0x1f7164[_0x3926('0x34')][_0x3926('0x37')]));_0x477cbd[_0x3926('0x38')]=_0x477cbd[_0x3926('0x38')][_0x3926('0x39')]?_0x477cbd[_0x3926('0x38')]:_0x20dfdf[_0x3926('0x32')];if(_0x1f7164[_0x3926('0x34')][_0x3926('0x40')]){_0x477cbd[_0x3926('0x45')]=[{'all':!![]}];}_0x477cbd=_['merge']({},_0x477cbd,_0x1f7164[_0x3926('0x46')]);return db[_0x3926('0x30')]['find'](_0x477cbd)[_0x3926('0x28')](handleEntityNotFound(_0x498228,null))[_0x3926('0x28')](respondWithResult(_0x498228,null))[_0x3926('0x47')](handleError(_0x498228,null));};exports['download']=function(_0xcad70a,_0x56456f,_0x146983){return db['Sound'][_0x3926('0x48')]({'where':{'id':_0xcad70a['params']['id']},'attributes':['name',_0x3926('0x49'),_0x3926('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x56456f,null))[_0x3926('0x28')](function(_0x591e74){if(_0x591e74){if(!fs[_0x3926('0x4b')](path['join'](config['root'],_0x3926('0x4c'),_0x591e74[_0x3926('0x49')]+'.'+_0x591e74[_0x3926('0x4a')]))){throw new db[(_0x3926('0x4d'))][(_0x3926('0x4e'))]('Sound\x20not\x20found');}return _0x56456f[_0x3926('0x4f')](path[_0x3926('0x50')](config[_0x3926('0x51')],'server/files/sounds/converted',util['format']('%s.%s',_0x591e74[_0x3926('0x49')],_0x591e74[_0x3926('0x4a')])),util[_0x3926('0x52')](_0x3926('0x53'),_0x591e74[_0x3926('0x2c')],_0x591e74[_0x3926('0x4a')]));}return null;})[_0x3926('0x47')](handleError(_0x56456f,null));};exports[_0x3926('0x54')]=function(_0x23c2d7,_0x1e8627,_0x42b61f){var _0x2df815={'name':path[_0x3926('0x55')](_0x23c2d7[_0x3926('0x56')][_0x3926('0x57')],path[_0x3926('0x58')](_0x23c2d7[_0x3926('0x56')]['originalname'])),'save_name':path[_0x3926('0x55')](_0x23c2d7[_0x3926('0x56')][_0x3926('0x59')],path[_0x3926('0x58')](_0x23c2d7[_0x3926('0x56')][_0x3926('0x59')])),'original_format':path[_0x3926('0x58')](_0x23c2d7['file'][_0x3926('0x57')])[_0x3926('0x5a')](0x1),'converted_format':_0x3926('0x5b')};var _0xe37916=path[_0x3926('0x50')](config[_0x3926('0x51')],_0x3926('0x5c'),_0x23c2d7[_0x3926('0x56')][_0x3926('0x59')]);var _0xf30f25=path[_0x3926('0x50')](config[_0x3926('0x51')],'server/files/sounds/converted',util[_0x3926('0x52')](_0x3926('0x53'),path[_0x3926('0x55')](_0x23c2d7[_0x3926('0x56')][_0x3926('0x59')],path[_0x3926('0x58')](_0x23c2d7[_0x3926('0x56')][_0x3926('0x59')])),_0x2df815[_0x3926('0x4a')]));logger[_0x3926('0x5d')](_0x3926('0x5e'),_0xe37916);logger[_0x3926('0x5d')]('Sound\x20upload\x20destination:\x20%s',_0xf30f25);try{fs[_0x3926('0x5f')](_0xe37916,parseInt('0777',0x8));var _0x14a41c=sox['transcode'](_0xe37916,_0xf30f25,{'sampleRate':0x1f40,'format':_0x3926('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x14a41c['on'](_0x3926('0x2b'),function(_0x39ddf9){fs['unlinkSync'](_0xe37916);_0x1e8627[_0x3926('0x1c')](0x1f4)[_0x3926('0x2d')](_0x39ddf9);});_0x14a41c['on']('src',function(_0x3fd17d){_0x2df815['original_duration']=isNaN(_0x3fd17d[_0x3926('0x60')])?null:_0x3fd17d[_0x3926('0x60')]*0x3e8;_0x2df815[_0x3926('0x61')]=isNaN(_0x3fd17d['sampleCount'])?null:_0x3fd17d['sampleCount'];_0x2df815[_0x3926('0x62')]=isNaN(_0x3fd17d[_0x3926('0x63')])?null:_0x3fd17d[_0x3926('0x63')];_0x2df815['original_bitRate']=isNaN(_0x3fd17d[_0x3926('0x64')])?null:_0x3fd17d[_0x3926('0x64')];_0x2df815[_0x3926('0x65')]=isNaN(_0x3fd17d[_0x3926('0x66')])?null:_0x3fd17d[_0x3926('0x66')];});_0x14a41c['on']('dest',function(_0x44c912){_0x2df815[_0x3926('0x67')]=isNaN(_0x44c912[_0x3926('0x60')])?null:_0x44c912[_0x3926('0x60')]*0x3e8;_0x2df815[_0x3926('0x68')]=isNaN(_0x44c912['sampleCount'])?null:_0x44c912[_0x3926('0x69')];_0x2df815[_0x3926('0x6a')]=isNaN(_0x44c912[_0x3926('0x63')])?null:_0x44c912[_0x3926('0x63')];_0x2df815['converted_bitRate']=isNaN(_0x44c912[_0x3926('0x64')])?null:_0x44c912[_0x3926('0x64')];_0x2df815['converted_sampleRate']=isNaN(_0x44c912[_0x3926('0x66')])?null:_0x44c912[_0x3926('0x66')];});_0x14a41c['on'](_0x3926('0x1d'),function(){fs[_0x3926('0x5f')](_0xf30f25,parseInt(_0x3926('0x6b'),0x8));return db[_0x3926('0x30')][_0x3926('0x54')](_0x2df815)[_0x3926('0x28')](function(_0x11f36d){var _0x115bae={'role':_0x23c2d7[_0x3926('0x6c')][_0x3926('0x6d')],'userProfileId':_0x23c2d7[_0x3926('0x6c')]['userProfileId']};if(!_0x115bae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115bae[_0x3926('0x6d')]===_0x3926('0x6e')){var _0xd28326=_0x11f36d[_0x3926('0x29')]({'plain':!![]});return db[_0x3926('0x6f')][_0x3926('0x48')]({'where':{'name':_0x3926('0x70'),'userProfileId':_0x115bae['userProfileId']},'raw':!![]})['then'](function(_0x4d3525){if(_0x4d3525&&_0x4d3525[_0x3926('0x71')]===0x0){return db['UserProfileResource'][_0x3926('0x54')]({'name':_0xd28326[_0x3926('0x2c')],'resourceId':_0xd28326['id'],'type':_0x4d3525['name'],'sectionId':_0x4d3525['id']},{})['then'](function(){return _0x11f36d;});}else{return _0x11f36d;}})[_0x3926('0x47')](function(_0x151de9){logger[_0x3926('0x2b')](_0x3926('0x72'),_0x151de9);throw _0x151de9;});}return _0x11f36d;})[_0x3926('0x28')](respondWithResult(_0x1e8627,null))[_0x3926('0x47')](handleError(_0x1e8627,null));});_0x14a41c[_0x3926('0x73')]();}catch(_0x100f52){_0x1e8627[_0x3926('0x1c')](0x1f4)[_0x3926('0x2d')](_0x100f52);}};exports['update']=function(_0x2dc245,_0x2e03cb,_0x53bf23){return db['Sound'][_0x3926('0x48')]({'where':{'id':_0x2dc245[_0x3926('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e03cb,null))[_0x3926('0x28')](saveUpdates(_[_0x3926('0x74')](_0x2dc245['body'],[_0x3926('0x2c'),_0x3926('0x75')]),null))[_0x3926('0x28')](respondWithResult(_0x2e03cb,null))['catch'](handleError(_0x2e03cb,null));};exports['delete']=function(_0x360f7d,_0x17fc7a,_0x29ca60){return db[_0x3926('0x30')][_0x3926('0x48')]({'where':{'id':_0x360f7d[_0x3926('0x44')]['id']}})['then'](function(_0x9c94ef){if(_0x9c94ef){return _0x9c94ef[_0x3926('0x2a')]();}})[_0x3926('0x28')](function(_0x7686e9){var _0x62b6cc=path['join'](config[_0x3926('0x51')],_0x3926('0x5c'),util[_0x3926('0x52')](_0x3926('0x53'),_0x7686e9[_0x3926('0x49')],_0x7686e9['original_format']));var _0x49c346=path['join'](config[_0x3926('0x51')],_0x3926('0x4c'),util['format'](_0x3926('0x53'),_0x7686e9[_0x3926('0x49')],_0x7686e9['converted_format']));fs[_0x3926('0x76')](_0x62b6cc);fs[_0x3926('0x76')](_0x49c346);return _0x7686e9;})['then'](function(_0x18d5e9){if(_0x18d5e9){return _0x17fc7a['status'](0xcc)[_0x3926('0x1d')]();}})[_0x3926('0x28')](handleEntityNotFound(_0x17fc7a,null))[_0x3926('0x47')](handleError(_0x17fc7a,null));}; \ No newline at end of file +var _0x52ea=['path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','get','Sounds','error','stack','name','send','map','Sound','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','fields','catch','download','find','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4275ef,_0x26906e){var _0x1061ce=function(_0x201037){while(--_0x201037){_0x4275ef['push'](_0x4275ef['shift']());}};_0x1061ce(++_0x26906e);}(_0x52ea,0x1f4));var _0xa52e=function(_0x789179,_0x455e5f){_0x789179=_0x789179-0x0;var _0x10878f=_0x52ea[_0x789179];return _0x10878f;};'use strict';var pdf=require(_0xa52e('0x0'));var emlformat=require(_0xa52e('0x1'));var rimraf=require(_0xa52e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa52e('0x3'));var rp=require(_0xa52e('0x4'));var moment=require(_0xa52e('0x5'));var BPromise=require(_0xa52e('0x6'));var Mustache=require(_0xa52e('0x7'));var util=require('util');var path=require(_0xa52e('0x8'));var sox=require(_0xa52e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa52e('0xa'));var squel=require(_0xa52e('0xb'));var crypto=require(_0xa52e('0xc'));var jsforce=require(_0xa52e('0xd'));var deskjs=require(_0xa52e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa52e('0xf'));var Redis=require(_0xa52e('0x10'));var authService=require(_0xa52e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa52e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa52e('0x13'));var utils=require(_0xa52e('0x14'));var config=require(_0xa52e('0x15'));var licenseUtil=require(_0xa52e('0x16'));var db=require(_0xa52e('0x17'))['db'];function respondWithStatusCode(_0x147562,_0x54f004){_0x54f004=_0x54f004||0xcc;return function(_0x2f22e7){if(_0x2f22e7){return _0x147562[_0xa52e('0x18')](_0x54f004);}return _0x147562['status'](_0x54f004)[_0xa52e('0x19')]();};}function respondWithResult(_0x1599c7,_0x1eee30){_0x1eee30=_0x1eee30||0xc8;return function(_0x531177){if(_0x531177){return _0x1599c7['status'](_0x1eee30)[_0xa52e('0x1a')](_0x531177);}};}function respondWithFilteredResult(_0xae3924,_0x107c8f){return function(_0x5bd537){if(_0x5bd537){var _0x19567b=_0x5bd537[_0xa52e('0x1b')],_0x557ef6=_0x107c8f[_0xa52e('0x1c')],_0x57d375=_0x107c8f[_0xa52e('0x1c')]+_0x107c8f[_0xa52e('0x1d')],_0x487fa9;if(_0x57d375>=_0x19567b){_0x57d375=_0x19567b;_0x487fa9=0xc8;}else{_0x487fa9=0xce;}_0xae3924[_0xa52e('0x1e')](_0x487fa9);return _0xae3924[_0xa52e('0x1f')](_0xa52e('0x20'),_0x557ef6+'-'+_0x57d375+'/'+_0x19567b)['json'](_0x5bd537);}return null;};}function patchUpdates(_0x4e5ec2){return function(_0xca3632){try{jsonpatch['apply'](_0xca3632,_0x4e5ec2,!![]);}catch(_0x3b3e28){return BPromise[_0xa52e('0x21')](_0x3b3e28);}return _0xca3632[_0xa52e('0x22')]();};}function saveUpdates(_0x225f4b,_0x31f6f5){return function(_0x5da824){if(_0x5da824){return _0x5da824['update'](_0x225f4b)[_0xa52e('0x23')](function(_0x1925e6){return _0x1925e6;});}return null;};}function removeEntity(_0xa23a7d,_0x44dda6){return function(_0x56ce7b){if(_0x56ce7b){return _0x56ce7b[_0xa52e('0x24')]()[_0xa52e('0x23')](function(){var _0x38dd0a=_0x56ce7b[_0xa52e('0x25')]({'plain':!![]});var _0x1568cd=_0xa52e('0x26');return db['UserProfileResource'][_0xa52e('0x24')]({'where':{'type':_0x1568cd,'resourceId':_0x38dd0a['id']}})[_0xa52e('0x23')](function(){return _0x56ce7b;});})['then'](function(){_0xa23a7d[_0xa52e('0x1e')](0xcc)[_0xa52e('0x19')]();});}};}function handleEntityNotFound(_0x2eb5f8,_0x42117f){return function(_0x209862){if(!_0x209862){_0x2eb5f8[_0xa52e('0x18')](0x194);}return _0x209862;};}function handleError(_0x19d296,_0x443b2b){_0x443b2b=_0x443b2b||0x1f4;return function(_0x5bb09f){logger[_0xa52e('0x27')](_0x5bb09f[_0xa52e('0x28')]);if(_0x5bb09f[_0xa52e('0x29')]){delete _0x5bb09f[_0xa52e('0x29')];}_0x19d296['status'](_0x443b2b)[_0xa52e('0x2a')](_0x5bb09f);};}exports['index']=function(_0x137d7,_0x25affe){var _0x307dec={},_0x36af21={},_0x5b7945={'count':0x0,'rows':[]};var _0x4e313b=_[_0xa52e('0x2b')](db[_0xa52e('0x2c')]['rawAttributes'],function(_0x118f2a){return{'name':_0x118f2a[_0xa52e('0x2d')],'type':_0x118f2a[_0xa52e('0x2e')][_0xa52e('0x2f')]};});_0x36af21[_0xa52e('0x30')]=_['map'](_0x4e313b,_0xa52e('0x29'));_0x36af21[_0xa52e('0x31')]=_['keys'](_0x137d7[_0xa52e('0x31')]);_0x36af21[_0xa52e('0x32')]=_[_0xa52e('0x33')](_0x36af21['model'],_0x36af21[_0xa52e('0x31')]);_0x307dec[_0xa52e('0x34')]=_['intersection'](_0x36af21[_0xa52e('0x30')],qs['fields'](_0x137d7[_0xa52e('0x31')]['fields']));_0x307dec['attributes']=_0x307dec[_0xa52e('0x34')][_0xa52e('0x35')]?_0x307dec[_0xa52e('0x34')]:_0x36af21[_0xa52e('0x30')];if(!_0x137d7['query'][_0xa52e('0x36')](_0xa52e('0x37'))){_0x307dec[_0xa52e('0x1d')]=qs[_0xa52e('0x1d')](_0x137d7['query'][_0xa52e('0x1d')]);_0x307dec[_0xa52e('0x1c')]=qs[_0xa52e('0x1c')](_0x137d7['query'][_0xa52e('0x1c')]);}_0x307dec[_0xa52e('0x38')]=qs[_0xa52e('0x39')](_0x137d7[_0xa52e('0x31')][_0xa52e('0x39')]);_0x307dec[_0xa52e('0x3a')]=qs[_0xa52e('0x32')](_[_0xa52e('0x3b')](_0x137d7[_0xa52e('0x31')],_0x36af21['filters']),_0x4e313b);if(_0x137d7['query'][_0xa52e('0x3c')]){_0x307dec[_0xa52e('0x3a')]=_[_0xa52e('0x3d')](_0x307dec[_0xa52e('0x3a')],{'$or':_[_0xa52e('0x2b')](_0x4e313b,function(_0x2f1b7e){if(_0x2f1b7e[_0xa52e('0x2e')]!==_0xa52e('0x3e')){var _0x49d2bb={};_0x49d2bb[_0x2f1b7e[_0xa52e('0x29')]]={'$like':'%'+_0x137d7[_0xa52e('0x31')]['filter']+'%'};return _0x49d2bb;}})});}_0x307dec=_[_0xa52e('0x3d')]({},_0x307dec,_0x137d7[_0xa52e('0x3f')]);var _0x5190f0={'where':_0x307dec[_0xa52e('0x3a')]};return db[_0xa52e('0x2c')]['count'](_0x5190f0)['then'](function(_0x467f6b){_0x5b7945[_0xa52e('0x1b')]=_0x467f6b;if(_0x137d7[_0xa52e('0x31')][_0xa52e('0x40')]){_0x307dec[_0xa52e('0x41')]=[{'all':!![]}];}return db['Sound'][_0xa52e('0x42')](_0x307dec);})[_0xa52e('0x23')](function(_0x50f4c2){_0x5b7945[_0xa52e('0x43')]=_0x50f4c2;return _0x5b7945;})[_0xa52e('0x23')](respondWithFilteredResult(_0x25affe,_0x307dec))['catch'](handleError(_0x25affe,null));};exports[_0xa52e('0x44')]=function(_0x377661,_0x1f1ee3){var _0x5962c0={'raw':!![],'where':{'id':_0x377661[_0xa52e('0x45')]['id']}},_0x3e3d6f={};_0x3e3d6f['model']=_[_0xa52e('0x46')](db[_0xa52e('0x2c')]['rawAttributes']);_0x3e3d6f[_0xa52e('0x31')]=_[_0xa52e('0x46')](_0x377661[_0xa52e('0x31')]);_0x3e3d6f[_0xa52e('0x32')]=_[_0xa52e('0x33')](_0x3e3d6f['model'],_0x3e3d6f['query']);_0x5962c0[_0xa52e('0x34')]=_['intersection'](_0x3e3d6f['model'],qs['fields'](_0x377661['query'][_0xa52e('0x47')]));_0x5962c0[_0xa52e('0x34')]=_0x5962c0[_0xa52e('0x34')]['length']?_0x5962c0['attributes']:_0x3e3d6f[_0xa52e('0x30')];if(_0x377661[_0xa52e('0x31')][_0xa52e('0x40')]){_0x5962c0['include']=[{'all':!![]}];}_0x5962c0=_[_0xa52e('0x3d')]({},_0x5962c0,_0x377661['options']);return db['Sound']['find'](_0x5962c0)[_0xa52e('0x23')](handleEntityNotFound(_0x1f1ee3,null))['then'](respondWithResult(_0x1f1ee3,null))[_0xa52e('0x48')](handleError(_0x1f1ee3,null));};exports[_0xa52e('0x49')]=function(_0x173de5,_0x39d7af,_0x472e23){return db[_0xa52e('0x2c')][_0xa52e('0x4a')]({'where':{'id':_0x173de5[_0xa52e('0x45')]['id']},'attributes':[_0xa52e('0x29'),_0xa52e('0x4b'),_0xa52e('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x39d7af,null))[_0xa52e('0x23')](function(_0x435c72){if(_0x435c72){if(!fs['existsSync'](path[_0xa52e('0x4d')](config[_0xa52e('0x4e')],_0xa52e('0x4f'),_0x435c72['save_name']+'.'+_0x435c72[_0xa52e('0x4c')]))){throw new db['Sequelize'][(_0xa52e('0x50'))](_0xa52e('0x51'));}return _0x39d7af[_0xa52e('0x49')](path['join'](config['root'],_0xa52e('0x4f'),util['format']('%s.%s',_0x435c72['save_name'],_0x435c72[_0xa52e('0x4c')])),util[_0xa52e('0x52')](_0xa52e('0x53'),_0x435c72[_0xa52e('0x29')],_0x435c72[_0xa52e('0x4c')]));}return null;})[_0xa52e('0x48')](handleError(_0x39d7af,null));};exports[_0xa52e('0x54')]=function(_0x41580d,_0x2deff9,_0x4607b3){var _0x2d034f={'name':path[_0xa52e('0x55')](_0x41580d[_0xa52e('0x56')][_0xa52e('0x57')],path[_0xa52e('0x58')](_0x41580d['file'][_0xa52e('0x57')])),'save_name':path[_0xa52e('0x55')](_0x41580d['file'][_0xa52e('0x59')],path[_0xa52e('0x58')](_0x41580d[_0xa52e('0x56')][_0xa52e('0x59')])),'original_format':path[_0xa52e('0x58')](_0x41580d['file'][_0xa52e('0x57')])[_0xa52e('0x5a')](0x1),'converted_format':'wav'};var _0x17edd0=path[_0xa52e('0x4d')](config[_0xa52e('0x4e')],_0xa52e('0x5b'),_0x41580d[_0xa52e('0x56')][_0xa52e('0x59')]);var _0x1812a6=path[_0xa52e('0x4d')](config[_0xa52e('0x4e')],_0xa52e('0x4f'),util[_0xa52e('0x52')](_0xa52e('0x53'),path[_0xa52e('0x55')](_0x41580d[_0xa52e('0x56')]['filename'],path[_0xa52e('0x58')](_0x41580d[_0xa52e('0x56')][_0xa52e('0x59')])),_0x2d034f[_0xa52e('0x4c')]));logger[_0xa52e('0x5c')](_0xa52e('0x5d'),_0x17edd0);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1812a6);try{fs[_0xa52e('0x5e')](_0x17edd0,parseInt(_0xa52e('0x5f'),0x8));var _0x4c1721=sox[_0xa52e('0x60')](_0x17edd0,_0x1812a6,{'sampleRate':0x1f40,'format':_0xa52e('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c1721['on'](_0xa52e('0x27'),function(_0x5c1641){fs['unlinkSync'](_0x17edd0);_0x2deff9[_0xa52e('0x1e')](0x1f4)[_0xa52e('0x2a')](_0x5c1641);});_0x4c1721['on'](_0xa52e('0x62'),function(_0x245c0b){_0x2d034f[_0xa52e('0x63')]=isNaN(_0x245c0b[_0xa52e('0x64')])?null:_0x245c0b[_0xa52e('0x64')]*0x3e8;_0x2d034f[_0xa52e('0x65')]=isNaN(_0x245c0b[_0xa52e('0x66')])?null:_0x245c0b[_0xa52e('0x66')];_0x2d034f['original_channelCount']=isNaN(_0x245c0b[_0xa52e('0x67')])?null:_0x245c0b['channelCount'];_0x2d034f[_0xa52e('0x68')]=isNaN(_0x245c0b['bitRate'])?null:_0x245c0b[_0xa52e('0x69')];_0x2d034f[_0xa52e('0x6a')]=isNaN(_0x245c0b[_0xa52e('0x6b')])?null:_0x245c0b[_0xa52e('0x6b')];});_0x4c1721['on'](_0xa52e('0x6c'),function(_0x4db04e){_0x2d034f[_0xa52e('0x6d')]=isNaN(_0x4db04e[_0xa52e('0x64')])?null:_0x4db04e[_0xa52e('0x64')]*0x3e8;_0x2d034f[_0xa52e('0x6e')]=isNaN(_0x4db04e['sampleCount'])?null:_0x4db04e[_0xa52e('0x66')];_0x2d034f[_0xa52e('0x6f')]=isNaN(_0x4db04e[_0xa52e('0x67')])?null:_0x4db04e[_0xa52e('0x67')];_0x2d034f['converted_bitRate']=isNaN(_0x4db04e['bitRate'])?null:_0x4db04e[_0xa52e('0x69')];_0x2d034f[_0xa52e('0x70')]=isNaN(_0x4db04e[_0xa52e('0x6b')])?null:_0x4db04e['sampleRate'];});_0x4c1721['on'](_0xa52e('0x19'),function(){fs[_0xa52e('0x5e')](_0x1812a6,parseInt('0777',0x8));return db[_0xa52e('0x2c')][_0xa52e('0x54')](_0x2d034f)[_0xa52e('0x23')](function(_0x43d5a3){var _0x58d9b6={'role':_0x41580d[_0xa52e('0x71')][_0xa52e('0x72')],'userProfileId':_0x41580d[_0xa52e('0x71')][_0xa52e('0x73')]};if(!_0x58d9b6)throw new Error(_0xa52e('0x74'));if(_0x58d9b6['role']===_0xa52e('0x75')){var _0x4d619d=_0x43d5a3[_0xa52e('0x25')]({'plain':!![]});return db[_0xa52e('0x76')][_0xa52e('0x4a')]({'where':{'name':_0xa52e('0x26'),'userProfileId':_0x58d9b6[_0xa52e('0x73')]},'raw':!![]})[_0xa52e('0x23')](function(_0x4d43c9){if(_0x4d43c9&&_0x4d43c9[_0xa52e('0x77')]===0x0){return db['UserProfileResource'][_0xa52e('0x54')]({'name':_0x4d619d[_0xa52e('0x29')],'resourceId':_0x4d619d['id'],'type':_0x4d43c9[_0xa52e('0x29')],'sectionId':_0x4d43c9['id']},{})[_0xa52e('0x23')](function(){return _0x43d5a3;});}else{return _0x43d5a3;}})[_0xa52e('0x48')](function(_0x126f45){logger['error'](_0xa52e('0x78'),_0x126f45);throw _0x126f45;});}return _0x43d5a3;})[_0xa52e('0x23')](respondWithResult(_0x2deff9,null))['catch'](handleError(_0x2deff9,null));});_0x4c1721[_0xa52e('0x79')]();}catch(_0x3f7bdf){_0x2deff9[_0xa52e('0x1e')](0x1f4)[_0xa52e('0x2a')](_0x3f7bdf);}};exports[_0xa52e('0x7a')]=function(_0x34c50a,_0x2d33aa,_0x1456ac){return db[_0xa52e('0x2c')][_0xa52e('0x4a')]({'where':{'id':_0x34c50a[_0xa52e('0x45')]['id']}})[_0xa52e('0x23')](handleEntityNotFound(_0x2d33aa,null))[_0xa52e('0x23')](saveUpdates(_[_0xa52e('0x3b')](_0x34c50a[_0xa52e('0x71')],[_0xa52e('0x29'),_0xa52e('0x7b')]),null))[_0xa52e('0x23')](respondWithResult(_0x2d33aa,null))[_0xa52e('0x48')](handleError(_0x2d33aa,null));};exports[_0xa52e('0x7c')]=function(_0x3633af,_0x577977,_0x16763a){return db[_0xa52e('0x2c')][_0xa52e('0x4a')]({'where':{'id':_0x3633af[_0xa52e('0x45')]['id']}})['then'](function(_0x319dbf){if(_0x319dbf){return _0x319dbf['destroy']();}})[_0xa52e('0x23')](function(_0x542a37){var _0x188838=path['join'](config[_0xa52e('0x4e')],_0xa52e('0x5b'),util[_0xa52e('0x52')](_0xa52e('0x53'),_0x542a37['save_name'],_0x542a37[_0xa52e('0x7d')]));var _0xc9b049=path[_0xa52e('0x4d')](config[_0xa52e('0x4e')],_0xa52e('0x4f'),util[_0xa52e('0x52')](_0xa52e('0x53'),_0x542a37[_0xa52e('0x4b')],_0x542a37[_0xa52e('0x4c')]));fs['unlinkSync'](_0x188838);fs[_0xa52e('0x7e')](_0xc9b049);return _0x542a37;})[_0xa52e('0x23')](function(_0x53a2f2){if(_0x53a2f2){return _0x577977[_0xa52e('0x1e')](0xcc)[_0xa52e('0x19')]();}})[_0xa52e('0x23')](handleEntityNotFound(_0x577977,null))[_0xa52e('0x48')](handleError(_0x577977,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 498d4a6..a7c8b06 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 _0x445b=['api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger'];(function(_0x498eba,_0x120f96){var _0x51e65e=function(_0x3d1c25){while(--_0x3d1c25){_0x498eba['push'](_0x498eba['shift']());}};_0x51e65e(++_0x120f96);}(_0x445b,0x143));var _0xb445=function(_0x4c1f1a,_0x15e289){_0x4c1f1a=_0x4c1f1a-0x0;var _0xc813f7=_0x445b[_0x4c1f1a];return _0xc813f7;};'use strict';var _=require('lodash');var util=require(_0xb445('0x0'));var logger=require(_0xb445('0x1'))(_0xb445('0x2'));var moment=require(_0xb445('0x3'));var BPromise=require('bluebird');var rp=require(_0xb445('0x4'));var fs=require('fs');var path=require(_0xb445('0x5'));var rimraf=require(_0xb445('0x6'));var config=require(_0xb445('0x7'));var attributes=require(_0xb445('0x8'));module[_0xb445('0x9')]=function(_0x3740db,_0xca3a6a){return _0x3740db[_0xb445('0xa')](_0xb445('0xb'),attributes,{'tableName':_0xb445('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87db=['exports','define','Sound','lodash','util','api','moment','bluebird','request-promise','rimraf','./sound.attributes'];(function(_0xbec6f3,_0x56cb5f){var _0x2ce152=function(_0x19cd00){while(--_0x19cd00){_0xbec6f3['push'](_0xbec6f3['shift']());}};_0x2ce152(++_0x56cb5f);}(_0x87db,0x179));var _0xb87d=function(_0x19fb3c,_0x48874c){_0x19fb3c=_0x19fb3c-0x0;var _0x42f2d4=_0x87db[_0x19fb3c];return _0x42f2d4;};'use strict';var _=require(_0xb87d('0x0'));var util=require(_0xb87d('0x1'));var logger=require('../../config/logger')(_0xb87d('0x2'));var moment=require(_0xb87d('0x3'));var BPromise=require(_0xb87d('0x4'));var rp=require(_0xb87d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb87d('0x6'));var config=require('../../config/environment');var attributes=require(_0xb87d('0x7'));module[_0xb87d('0x8')]=function(_0x18263b,_0x533889){return _0x18263b[_0xb87d('0x9')](_0xb87d('0xa'),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 b7ca2d7..51edc54 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 _0xa709=['model','then','ShowSound','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','Sound','find','options','raw','where','attributes','map','include'];(function(_0x1b98b6,_0x270973){var _0x587d56=function(_0x32c8a3){while(--_0x32c8a3){_0x1b98b6['push'](_0x1b98b6['shift']());}};_0x587d56(++_0x270973);}(_0xa709,0xf4));var _0x9a70=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xa709[_0x52121d];return _0x448627;};'use strict';var _=require(_0x9a70('0x0'));var util=require(_0x9a70('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a70('0x2'));var db=require(_0x9a70('0x3'))['db'];var utils=require(_0x9a70('0x4'));var logger=require('../../config/logger')(_0x9a70('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a70('0x6'));var client=jayson['client'][_0x9a70('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a232e,_0x9afaa5,_0x46856f){return new BPromise(function(_0x453cc4,_0x50a0f5){return client[_0x9a70('0x8')](_0x5a232e,_0x46856f)['then'](function(_0x2e42ba){logger[_0x9a70('0x9')](_0x9a70('0xa'),_0x9afaa5,_0x9a70('0xb'));logger[_0x9a70('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x9afaa5,_0x9a70('0xb'),JSON['stringify'](_0x2e42ba));if(_0x2e42ba[_0x9a70('0xd')]){if(_0x2e42ba[_0x9a70('0xd')][_0x9a70('0xe')]===0x1f4){logger[_0x9a70('0xd')](_0x9a70('0xa'),_0x9afaa5,_0x2e42ba[_0x9a70('0xd')][_0x9a70('0xf')]);return _0x50a0f5(_0x2e42ba[_0x9a70('0xd')][_0x9a70('0xf')]);}logger[_0x9a70('0xd')](_0x9a70('0xa'),_0x9afaa5,_0x2e42ba[_0x9a70('0xd')][_0x9a70('0xf')]);return _0x453cc4(_0x2e42ba[_0x9a70('0xd')][_0x9a70('0xf')]);}else{logger[_0x9a70('0x9')](_0x9a70('0xa'),_0x9afaa5,_0x9a70('0xb'));_0x453cc4(_0x2e42ba[_0x9a70('0x10')][_0x9a70('0xf')]);}})[_0x9a70('0x11')](function(_0x3f98b2){logger['error'](_0x9a70('0xa'),_0x9afaa5,_0x3f98b2);_0x50a0f5(_0x3f98b2);});});}exports['ShowSound']=function(_0x475fe9){var _0x46a52a=this;return new Promise(function(_0x4d995f,_0x35a085){return db[_0x9a70('0x12')][_0x9a70('0x13')]({'raw':_0x475fe9[_0x9a70('0x14')]?_0x475fe9[_0x9a70('0x14')][_0x9a70('0x15')]===undefined?!![]:![]:!![],'where':_0x475fe9[_0x9a70('0x14')]?_0x475fe9[_0x9a70('0x14')][_0x9a70('0x16')]||null:null,'attributes':_0x475fe9['options']?_0x475fe9[_0x9a70('0x14')][_0x9a70('0x17')]||null:null,'include':_0x475fe9[_0x9a70('0x14')]?_0x475fe9[_0x9a70('0x14')]['include']?_[_0x9a70('0x18')](_0x475fe9['options'][_0x9a70('0x19')],function(_0x5e5e91){return{'model':db[_0x5e5e91['model']],'as':_0x5e5e91['as'],'attributes':_0x5e5e91['attributes'],'include':_0x5e5e91[_0x9a70('0x19')]?_['map'](_0x5e5e91[_0x9a70('0x19')],function(_0x3edd75){return{'model':db[_0x3edd75[_0x9a70('0x1a')]],'as':_0x3edd75['as'],'attributes':_0x3edd75[_0x9a70('0x17')],'include':_0x3edd75[_0x9a70('0x19')]?_[_0x9a70('0x18')](_0x3edd75[_0x9a70('0x19')],function(_0x58c357){return{'model':db[_0x58c357['model']],'as':_0x58c357['as'],'attributes':_0x58c357[_0x9a70('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9a70('0x1b')](function(_0x4d127a){logger[_0x9a70('0x9')](_0x9a70('0x1c'),_0x475fe9);logger['debug'](_0x9a70('0x1c'),_0x475fe9,JSON[_0x9a70('0x1d')](_0x4d127a));_0x4d995f(_0x4d127a);})[_0x9a70('0x11')](function(_0x10903c){logger['error'](_0x9a70('0x1c'),_0x10903c[_0x9a70('0xf')],_0x475fe9);_0x35a085(_0x46a52a[_0x9a70('0xd')](0x1f4,_0x10903c[_0x9a70('0xf')]));});});}; \ No newline at end of file +var _0xadf4=['Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','then','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x4f6347,_0x72c6fc){var _0x147a95=function(_0x29b6bf){while(--_0x29b6bf){_0x4f6347['push'](_0x4f6347['shift']());}};_0x147a95(++_0x72c6fc);}(_0xadf4,0xbf));var _0x4adf=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xadf4[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0x4adf('0x0'));var util=require(_0x4adf('0x1'));var moment=require(_0x4adf('0x2'));var BPromise=require('bluebird');var rs=require(_0x4adf('0x3'));var fs=require('fs');var Redis=require(_0x4adf('0x4'));var db=require(_0x4adf('0x5'))['db'];var utils=require(_0x4adf('0x6'));var logger=require(_0x4adf('0x7'))(_0x4adf('0x8'));var config=require(_0x4adf('0x9'));var jayson=require(_0x4adf('0xa'));var client=jayson[_0x4adf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4adfc1,_0x21ee62,_0x570afd){return new BPromise(function(_0x243e8a,_0x4fd33a){return client['request'](_0x4adfc1,_0x570afd)['then'](function(_0x2a9c09){logger[_0x4adf('0xc')](_0x4adf('0xd'),_0x21ee62,'request\x20sent');logger['debug'](_0x4adf('0xe'),_0x21ee62,_0x4adf('0xf'),JSON[_0x4adf('0x10')](_0x2a9c09));if(_0x2a9c09[_0x4adf('0x11')]){if(_0x2a9c09[_0x4adf('0x11')][_0x4adf('0x12')]===0x1f4){logger[_0x4adf('0x11')]('Sound,\x20%s,\x20%s',_0x21ee62,_0x2a9c09[_0x4adf('0x11')][_0x4adf('0x13')]);return _0x4fd33a(_0x2a9c09[_0x4adf('0x11')][_0x4adf('0x13')]);}logger[_0x4adf('0x11')](_0x4adf('0xd'),_0x21ee62,_0x2a9c09[_0x4adf('0x11')][_0x4adf('0x13')]);return _0x243e8a(_0x2a9c09[_0x4adf('0x11')]['message']);}else{logger['info'](_0x4adf('0xd'),_0x21ee62,_0x4adf('0xf'));_0x243e8a(_0x2a9c09[_0x4adf('0x14')]['message']);}})['catch'](function(_0x5e9fe4){logger['error'](_0x4adf('0xd'),_0x21ee62,_0x5e9fe4);_0x4fd33a(_0x5e9fe4);});});}exports[_0x4adf('0x15')]=function(_0x2882a6){var _0x22a0ff=this;return new Promise(function(_0x580528,_0x18029f){return db[_0x4adf('0x16')][_0x4adf('0x17')]({'raw':_0x2882a6[_0x4adf('0x18')]?_0x2882a6[_0x4adf('0x18')][_0x4adf('0x19')]===undefined?!![]:![]:!![],'where':_0x2882a6[_0x4adf('0x18')]?_0x2882a6[_0x4adf('0x18')][_0x4adf('0x1a')]||null:null,'attributes':_0x2882a6['options']?_0x2882a6[_0x4adf('0x18')][_0x4adf('0x1b')]||null:null,'include':_0x2882a6['options']?_0x2882a6['options']['include']?_[_0x4adf('0x1c')](_0x2882a6[_0x4adf('0x18')][_0x4adf('0x1d')],function(_0x5f463b){return{'model':db[_0x5f463b['model']],'as':_0x5f463b['as'],'attributes':_0x5f463b[_0x4adf('0x1b')],'include':_0x5f463b[_0x4adf('0x1d')]?_[_0x4adf('0x1c')](_0x5f463b['include'],function(_0x4b882c){return{'model':db[_0x4b882c['model']],'as':_0x4b882c['as'],'attributes':_0x4b882c['attributes'],'include':_0x4b882c[_0x4adf('0x1d')]?_[_0x4adf('0x1c')](_0x4b882c[_0x4adf('0x1d')],function(_0x29b10b){return{'model':db[_0x29b10b[_0x4adf('0x1e')]],'as':_0x29b10b['as'],'attributes':_0x29b10b[_0x4adf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4adf('0x1f')](function(_0x4be9ef){logger[_0x4adf('0xc')](_0x4adf('0x15'),_0x2882a6);logger[_0x4adf('0x20')](_0x4adf('0x15'),_0x2882a6,JSON[_0x4adf('0x10')](_0x4be9ef));_0x580528(_0x4be9ef);})[_0x4adf('0x21')](function(_0x565a05){logger[_0x4adf('0x11')](_0x4adf('0x15'),_0x565a05['message'],_0x2882a6);_0x18029f(_0x22a0ff[_0x4adf('0x11')](0x1f4,_0x565a05[_0x4adf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index dc74da1..92ea89f 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 _0xa8c7=['../../components/auth/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa8c7,0x19d));var _0x7a8c=function(_0x3b3a60,_0x136734){_0x3b3a60=_0x3b3a60-0x0;var _0x171ae7=_0xa8c7[_0x3b3a60];return _0x171ae7;};'use strict';var multer=require(_0x7a8c('0x0'));var util=require('util');var path=require(_0x7a8c('0x1'));var timeout=require(_0x7a8c('0x2'));var express=require(_0x7a8c('0x3'));var router=express[_0x7a8c('0x4')]();var auth=require(_0x7a8c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a8c('0x6'));var controller=require(_0x7a8c('0x7'));router[_0x7a8c('0x8')]('/',auth[_0x7a8c('0x9')](),controller[_0x7a8c('0xa')]);router[_0x7a8c('0x8')](_0x7a8c('0xb'),auth[_0x7a8c('0x9')](),controller[_0x7a8c('0xc')]);router[_0x7a8c('0xd')]('/',auth[_0x7a8c('0x9')](),controller[_0x7a8c('0xe')]);router[_0x7a8c('0xf')]('/:id',auth[_0x7a8c('0x9')](),controller['update']);router[_0x7a8c('0x10')](_0x7a8c('0xb'),auth['isAuthenticated'](),controller[_0x7a8c('0x11')]);module[_0x7a8c('0x12')]=router; \ No newline at end of file +var _0x44e5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','update','delete','destroy','multer','util','connect-timeout'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x44e5,0x6d));var _0x544e=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x44e5[_0xb4cc12];return _0x8593b5;};'use strict';var multer=require(_0x544e('0x0'));var util=require(_0x544e('0x1'));var path=require('path');var timeout=require(_0x544e('0x2'));var express=require('express');var router=express[_0x544e('0x3')]();var auth=require(_0x544e('0x4'));var interaction=require(_0x544e('0x5'));var config=require(_0x544e('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x544e('0x7')](),controller[_0x544e('0x8')]);router[_0x544e('0x9')](_0x544e('0xa'),auth['isAuthenticated'](),controller[_0x544e('0xb')]);router[_0x544e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x544e('0x7')](),controller[_0x544e('0xd')]);router[_0x544e('0xe')](_0x544e('0xa'),auth[_0x544e('0x7')](),controller[_0x544e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0052a7d..b975958 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 _0x1b20=['out','TEXT','exports','STRING','ENUM'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x01b2('0x0')]={'uniqueid':{'type':Sequelize[_0x01b2('0x1')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x01b2('0x2')]('in',_0x01b2('0x3')),'defaultValue':_0x01b2('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x01b2('0x1')]},'providerResponse':{'type':Sequelize[_0x01b2('0x4')]}}; \ No newline at end of file +var _0xcb66=['out','exports','STRING','TEXT','medium','ENUM'];(function(_0xb070d3,_0x13edd7){var _0x453e73=function(_0x4c69ec){while(--_0x4c69ec){_0xb070d3['push'](_0xb070d3['shift']());}};_0x453e73(++_0x13edd7);}(_0xcb66,0x19f));var _0x6cb6=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xcb66[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'uniqueid':{'type':Sequelize[_0x6cb6('0x1')]},'body':{'type':Sequelize[_0x6cb6('0x2')](_0x6cb6('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6cb6('0x4')]('in','out'),'defaultValue':_0x6cb6('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6cb6('0x1')]},'providerResponse':{'type':Sequelize[_0x6cb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index b12bd98..db88112 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 _0xe899=['map','SquareMessage','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','find','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','limit','Content-Range','reject','save','then','error','name','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe899,0x6b));var _0x9e89=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xe899[_0x3a7a9c];return _0x59156e;};'use strict';var pdf=require(_0x9e89('0x0'));var emlformat=require(_0x9e89('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9e89('0x2'));var jsonpatch=require(_0x9e89('0x3'));var rp=require(_0x9e89('0x4'));var moment=require(_0x9e89('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e89('0x6'));var util=require(_0x9e89('0x7'));var path=require(_0x9e89('0x8'));var sox=require(_0x9e89('0x9'));var csv=require(_0x9e89('0xa'));var ejs=require(_0x9e89('0xb'));var fs=require('fs');var _=require(_0x9e89('0xc'));var squel=require(_0x9e89('0xd'));var crypto=require(_0x9e89('0xe'));var jsforce=require(_0x9e89('0xf'));var deskjs=require(_0x9e89('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9e89('0x11'));var Papa=require('papaparse');var Redis=require(_0x9e89('0x12'));var authService=require(_0x9e89('0x13'));var qs=require(_0x9e89('0x14'));var as=require(_0x9e89('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e89('0x16'))(_0x9e89('0x17'));var utils=require('../../config/utils');var config=require(_0x9e89('0x18'));var licenseUtil=require(_0x9e89('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38db16,_0x56c67a){_0x56c67a=_0x56c67a||0xcc;return function(_0x8f3fe7){if(_0x8f3fe7){return _0x38db16[_0x9e89('0x1a')](_0x56c67a);}return _0x38db16[_0x9e89('0x1b')](_0x56c67a)[_0x9e89('0x1c')]();};}function respondWithResult(_0xd3c97a,_0x244401){_0x244401=_0x244401||0xc8;return function(_0x38af6e){if(_0x38af6e){return _0xd3c97a[_0x9e89('0x1b')](_0x244401)[_0x9e89('0x1d')](_0x38af6e);}};}function respondWithFilteredResult(_0x286af7,_0x4aed0d){return function(_0x367f1d){if(_0x367f1d){var _0x56250a=_0x367f1d[_0x9e89('0x1e')],_0x54d7aa=_0x4aed0d['offset'],_0x28c0fa=_0x4aed0d['offset']+_0x4aed0d[_0x9e89('0x1f')],_0x44a333;if(_0x28c0fa>=_0x56250a){_0x28c0fa=_0x56250a;_0x44a333=0xc8;}else{_0x44a333=0xce;}_0x286af7[_0x9e89('0x1b')](_0x44a333);return _0x286af7['set'](_0x9e89('0x20'),_0x54d7aa+'-'+_0x28c0fa+'/'+_0x56250a)[_0x9e89('0x1d')](_0x367f1d);}return null;};}function patchUpdates(_0x57abb8){return function(_0x14136c){try{jsonpatch['apply'](_0x14136c,_0x57abb8,!![]);}catch(_0x23c3b2){return BPromise[_0x9e89('0x21')](_0x23c3b2);}return _0x14136c[_0x9e89('0x22')]();};}function saveUpdates(_0x126eb4,_0xf883ba){return function(_0x446786){if(_0x446786){return _0x446786['update'](_0x126eb4)[_0x9e89('0x23')](function(_0xaf5b2){return _0xaf5b2;});}return null;};}function removeEntity(_0x7ff4ef,_0x1e5506){return function(_0x36d5f5){if(_0x36d5f5){return _0x36d5f5['destroy']()[_0x9e89('0x23')](function(){_0x7ff4ef[_0x9e89('0x1b')](0xcc)[_0x9e89('0x1c')]();});}};}function handleEntityNotFound(_0xdcf2ce,_0xdd74cf){return function(_0x509ed9){if(!_0x509ed9){_0xdcf2ce[_0x9e89('0x1a')](0x194);}return _0x509ed9;};}function handleError(_0x2f0c35,_0x581f33){_0x581f33=_0x581f33||0x1f4;return function(_0x4a6caa){logger[_0x9e89('0x24')](_0x4a6caa['stack']);if(_0x4a6caa[_0x9e89('0x25')]){delete _0x4a6caa[_0x9e89('0x25')];}_0x2f0c35[_0x9e89('0x1b')](_0x581f33)['send'](_0x4a6caa);};}exports[_0x9e89('0x26')]=function(_0x328ce9,_0xdd176){var _0x297e86={},_0x417282={},_0x4889b3={'count':0x0,'rows':[]};var _0x20cf0f=_[_0x9e89('0x27')](db[_0x9e89('0x28')][_0x9e89('0x29')],function(_0x44d912){return{'name':_0x44d912['fieldName'],'type':_0x44d912['type'][_0x9e89('0x2a')]};});_0x417282[_0x9e89('0x2b')]=_[_0x9e89('0x27')](_0x20cf0f,'name');_0x417282['query']=_['keys'](_0x328ce9[_0x9e89('0x2c')]);_0x417282[_0x9e89('0x2d')]=_[_0x9e89('0x2e')](_0x417282[_0x9e89('0x2b')],_0x417282[_0x9e89('0x2c')]);_0x297e86[_0x9e89('0x2f')]=_[_0x9e89('0x2e')](_0x417282[_0x9e89('0x2b')],qs[_0x9e89('0x30')](_0x328ce9[_0x9e89('0x2c')][_0x9e89('0x30')]));_0x297e86[_0x9e89('0x2f')]=_0x297e86[_0x9e89('0x2f')][_0x9e89('0x31')]?_0x297e86[_0x9e89('0x2f')]:_0x417282[_0x9e89('0x2b')];if(!_0x328ce9[_0x9e89('0x2c')][_0x9e89('0x32')](_0x9e89('0x33'))){_0x297e86[_0x9e89('0x1f')]=qs[_0x9e89('0x1f')](_0x328ce9[_0x9e89('0x2c')][_0x9e89('0x1f')]);_0x297e86['offset']=qs[_0x9e89('0x34')](_0x328ce9[_0x9e89('0x2c')]['offset']);}_0x297e86[_0x9e89('0x35')]=qs[_0x9e89('0x36')](_0x328ce9[_0x9e89('0x2c')][_0x9e89('0x36')]);_0x297e86[_0x9e89('0x37')]=qs[_0x9e89('0x2d')](_['pick'](_0x328ce9[_0x9e89('0x2c')],_0x417282[_0x9e89('0x2d')]),_0x20cf0f);if(_0x328ce9[_0x9e89('0x2c')][_0x9e89('0x38')]){_0x297e86[_0x9e89('0x37')]=_[_0x9e89('0x39')](_0x297e86[_0x9e89('0x37')],{'$or':_[_0x9e89('0x27')](_0x20cf0f,function(_0x3681bd){if(_0x3681bd['type']!==_0x9e89('0x3a')){var _0x59e1a9={};_0x59e1a9[_0x3681bd[_0x9e89('0x25')]]={'$like':'%'+_0x328ce9['query'][_0x9e89('0x38')]+'%'};return _0x59e1a9;}})});}_0x297e86=_['merge']({},_0x297e86,_0x328ce9[_0x9e89('0x3b')]);var _0x3b4628={'where':_0x297e86[_0x9e89('0x37')]};return db['SquareMessage'][_0x9e89('0x1e')](_0x3b4628)['then'](function(_0x70106d){_0x4889b3['count']=_0x70106d;if(_0x328ce9['query'][_0x9e89('0x3c')]){_0x297e86[_0x9e89('0x3d')]=[{'all':!![]}];}return db['SquareMessage'][_0x9e89('0x3e')](_0x297e86);})[_0x9e89('0x23')](function(_0x2a67e2){_0x4889b3[_0x9e89('0x3f')]=_0x2a67e2;return _0x4889b3;})['then'](respondWithFilteredResult(_0xdd176,_0x297e86))[_0x9e89('0x40')](handleError(_0xdd176,null));};exports[_0x9e89('0x41')]=function(_0x2090f7,_0x2e5818){var _0x471a4a={'raw':!![],'where':{'id':_0x2090f7[_0x9e89('0x42')]['id']}},_0x2cf4d4={};_0x2cf4d4[_0x9e89('0x2b')]=_[_0x9e89('0x43')](db['SquareMessage'][_0x9e89('0x29')]);_0x2cf4d4[_0x9e89('0x2c')]=_[_0x9e89('0x43')](_0x2090f7[_0x9e89('0x2c')]);_0x2cf4d4['filters']=_['intersection'](_0x2cf4d4[_0x9e89('0x2b')],_0x2cf4d4['query']);_0x471a4a[_0x9e89('0x2f')]=_[_0x9e89('0x2e')](_0x2cf4d4[_0x9e89('0x2b')],qs[_0x9e89('0x30')](_0x2090f7[_0x9e89('0x2c')][_0x9e89('0x30')]));_0x471a4a[_0x9e89('0x2f')]=_0x471a4a[_0x9e89('0x2f')][_0x9e89('0x31')]?_0x471a4a[_0x9e89('0x2f')]:_0x2cf4d4[_0x9e89('0x2b')];if(_0x2090f7[_0x9e89('0x2c')][_0x9e89('0x3c')]){_0x471a4a[_0x9e89('0x3d')]=[{'all':!![]}];}_0x471a4a=_[_0x9e89('0x39')]({},_0x471a4a,_0x2090f7[_0x9e89('0x3b')]);return db[_0x9e89('0x28')]['find'](_0x471a4a)[_0x9e89('0x23')](handleEntityNotFound(_0x2e5818,null))[_0x9e89('0x23')](respondWithResult(_0x2e5818,null))[_0x9e89('0x40')](handleError(_0x2e5818,null));};exports[_0x9e89('0x44')]=function(_0x182c0a,_0x2614bd){return db[_0x9e89('0x28')][_0x9e89('0x44')](_0x182c0a['body'],{})[_0x9e89('0x23')](respondWithResult(_0x2614bd,0xc9))[_0x9e89('0x40')](handleError(_0x2614bd,null));};exports[_0x9e89('0x45')]=function(_0x5dc25b,_0x537351){if(_0x5dc25b['body']['id']){delete _0x5dc25b[_0x9e89('0x46')]['id'];}return db[_0x9e89('0x28')][_0x9e89('0x47')]({'where':{'id':_0x5dc25b[_0x9e89('0x42')]['id']}})['then'](handleEntityNotFound(_0x537351,null))[_0x9e89('0x23')](saveUpdates(_0x5dc25b[_0x9e89('0x46')],null))[_0x9e89('0x23')](respondWithResult(_0x537351,null))[_0x9e89('0x40')](handleError(_0x537351,null));};exports[_0x9e89('0x48')]=function(_0x1a44e5,_0x52014d){return db['SquareMessage'][_0x9e89('0x47')]({'where':{'id':_0x1a44e5[_0x9e89('0x42')]['id']}})['then'](handleEntityNotFound(_0x52014d,null))[_0x9e89('0x23')](removeEntity(_0x52014d,null))[_0x9e89('0x40')](handleError(_0x52014d,null));}; \ No newline at end of file +var _0x5c2d=['json','count','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','SquareMessage','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x19f764,_0x1a230b){var _0x17b88f=function(_0x41bafc){while(--_0x41bafc){_0x19f764['push'](_0x19f764['shift']());}};_0x17b88f(++_0x1a230b);}(_0x5c2d,0xc4));var _0xd5c2=function(_0x2a3857,_0x22fb1d){_0x2a3857=_0x2a3857-0x0;var _0x1ac734=_0x5c2d[_0x2a3857];return _0x1ac734;};'use strict';var pdf=require(_0xd5c2('0x0'));var emlformat=require(_0xd5c2('0x1'));var rimraf=require(_0xd5c2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5c2('0x3'));var rp=require(_0xd5c2('0x4'));var moment=require('moment');var BPromise=require(_0xd5c2('0x5'));var Mustache=require(_0xd5c2('0x6'));var util=require(_0xd5c2('0x7'));var path=require('path');var sox=require(_0xd5c2('0x8'));var csv=require(_0xd5c2('0x9'));var ejs=require(_0xd5c2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd5c2('0xb'));var crypto=require(_0xd5c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd5c2('0xd'));var toCsv=require(_0xd5c2('0x9'));var querystring=require('querystring');var Papa=require(_0xd5c2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd5c2('0xf'));var as=require(_0xd5c2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5c2('0x11'))(_0xd5c2('0x12'));var utils=require(_0xd5c2('0x13'));var config=require(_0xd5c2('0x14'));var licenseUtil=require(_0xd5c2('0x15'));var db=require(_0xd5c2('0x16'))['db'];function respondWithStatusCode(_0x261cb8,_0x48e301){_0x48e301=_0x48e301||0xcc;return function(_0x176003){if(_0x176003){return _0x261cb8[_0xd5c2('0x17')](_0x48e301);}return _0x261cb8[_0xd5c2('0x18')](_0x48e301)[_0xd5c2('0x19')]();};}function respondWithResult(_0x3ec029,_0x38db84){_0x38db84=_0x38db84||0xc8;return function(_0x188bff){if(_0x188bff){return _0x3ec029[_0xd5c2('0x18')](_0x38db84)[_0xd5c2('0x1a')](_0x188bff);}};}function respondWithFilteredResult(_0x3e031a,_0x6d5d14){return function(_0x4c6d6d){if(_0x4c6d6d){var _0x559b10=_0x4c6d6d[_0xd5c2('0x1b')],_0x462d60=_0x6d5d14[_0xd5c2('0x1c')],_0x57e0ba=_0x6d5d14['offset']+_0x6d5d14[_0xd5c2('0x1d')],_0x365ab8;if(_0x57e0ba>=_0x559b10){_0x57e0ba=_0x559b10;_0x365ab8=0xc8;}else{_0x365ab8=0xce;}_0x3e031a[_0xd5c2('0x18')](_0x365ab8);return _0x3e031a[_0xd5c2('0x1e')](_0xd5c2('0x1f'),_0x462d60+'-'+_0x57e0ba+'/'+_0x559b10)[_0xd5c2('0x1a')](_0x4c6d6d);}return null;};}function patchUpdates(_0x445b28){return function(_0x45838b){try{jsonpatch['apply'](_0x45838b,_0x445b28,!![]);}catch(_0xf4d2ca){return BPromise[_0xd5c2('0x20')](_0xf4d2ca);}return _0x45838b['save']();};}function saveUpdates(_0x338b02,_0x1a8fcd){return function(_0x26a140){if(_0x26a140){return _0x26a140['update'](_0x338b02)[_0xd5c2('0x21')](function(_0x276042){return _0x276042;});}return null;};}function removeEntity(_0x4be5b7,_0x59d967){return function(_0x2ceb61){if(_0x2ceb61){return _0x2ceb61[_0xd5c2('0x22')]()['then'](function(){_0x4be5b7[_0xd5c2('0x18')](0xcc)[_0xd5c2('0x19')]();});}};}function handleEntityNotFound(_0x455f89,_0x3b5c2d){return function(_0x5a98df){if(!_0x5a98df){_0x455f89['sendStatus'](0x194);}return _0x5a98df;};}function handleError(_0x161b85,_0x52b7e1){_0x52b7e1=_0x52b7e1||0x1f4;return function(_0x203d49){logger[_0xd5c2('0x23')](_0x203d49[_0xd5c2('0x24')]);if(_0x203d49['name']){delete _0x203d49[_0xd5c2('0x25')];}_0x161b85[_0xd5c2('0x18')](_0x52b7e1)[_0xd5c2('0x26')](_0x203d49);};}exports[_0xd5c2('0x27')]=function(_0x5c2366,_0x2fac9a){var _0xdd4eab={},_0x1cdc94={},_0x2a2fc4={'count':0x0,'rows':[]};var _0x26aa9f=_[_0xd5c2('0x28')](db['SquareMessage'][_0xd5c2('0x29')],function(_0x5b2699){return{'name':_0x5b2699[_0xd5c2('0x2a')],'type':_0x5b2699['type'][_0xd5c2('0x2b')]};});_0x1cdc94[_0xd5c2('0x2c')]=_[_0xd5c2('0x28')](_0x26aa9f,_0xd5c2('0x25'));_0x1cdc94[_0xd5c2('0x2d')]=_[_0xd5c2('0x2e')](_0x5c2366[_0xd5c2('0x2d')]);_0x1cdc94[_0xd5c2('0x2f')]=_[_0xd5c2('0x30')](_0x1cdc94['model'],_0x1cdc94[_0xd5c2('0x2d')]);_0xdd4eab[_0xd5c2('0x31')]=_[_0xd5c2('0x30')](_0x1cdc94[_0xd5c2('0x2c')],qs[_0xd5c2('0x32')](_0x5c2366[_0xd5c2('0x2d')][_0xd5c2('0x32')]));_0xdd4eab['attributes']=_0xdd4eab['attributes'][_0xd5c2('0x33')]?_0xdd4eab['attributes']:_0x1cdc94[_0xd5c2('0x2c')];if(!_0x5c2366['query']['hasOwnProperty'](_0xd5c2('0x34'))){_0xdd4eab['limit']=qs[_0xd5c2('0x1d')](_0x5c2366[_0xd5c2('0x2d')]['limit']);_0xdd4eab[_0xd5c2('0x1c')]=qs[_0xd5c2('0x1c')](_0x5c2366[_0xd5c2('0x2d')]['offset']);}_0xdd4eab[_0xd5c2('0x35')]=qs['sort'](_0x5c2366[_0xd5c2('0x2d')][_0xd5c2('0x36')]);_0xdd4eab[_0xd5c2('0x37')]=qs[_0xd5c2('0x2f')](_[_0xd5c2('0x38')](_0x5c2366[_0xd5c2('0x2d')],_0x1cdc94[_0xd5c2('0x2f')]),_0x26aa9f);if(_0x5c2366[_0xd5c2('0x2d')][_0xd5c2('0x39')]){_0xdd4eab[_0xd5c2('0x37')]=_['merge'](_0xdd4eab[_0xd5c2('0x37')],{'$or':_[_0xd5c2('0x28')](_0x26aa9f,function(_0x587da2){if(_0x587da2[_0xd5c2('0x3a')]!==_0xd5c2('0x3b')){var _0x42d91f={};_0x42d91f[_0x587da2[_0xd5c2('0x25')]]={'$like':'%'+_0x5c2366[_0xd5c2('0x2d')]['filter']+'%'};return _0x42d91f;}})});}_0xdd4eab=_[_0xd5c2('0x3c')]({},_0xdd4eab,_0x5c2366[_0xd5c2('0x3d')]);var _0x458931={'where':_0xdd4eab['where']};return db[_0xd5c2('0x3e')]['count'](_0x458931)['then'](function(_0x5dd154){_0x2a2fc4[_0xd5c2('0x1b')]=_0x5dd154;if(_0x5c2366[_0xd5c2('0x2d')][_0xd5c2('0x3f')]){_0xdd4eab[_0xd5c2('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0xd5c2('0x41')](_0xdd4eab);})[_0xd5c2('0x21')](function(_0x592db6){_0x2a2fc4[_0xd5c2('0x42')]=_0x592db6;return _0x2a2fc4;})['then'](respondWithFilteredResult(_0x2fac9a,_0xdd4eab))['catch'](handleError(_0x2fac9a,null));};exports[_0xd5c2('0x43')]=function(_0x57ca7d,_0x2bb09f){var _0x3f9614={'raw':!![],'where':{'id':_0x57ca7d[_0xd5c2('0x44')]['id']}},_0x41cd87={};_0x41cd87[_0xd5c2('0x2c')]=_[_0xd5c2('0x2e')](db[_0xd5c2('0x3e')][_0xd5c2('0x29')]);_0x41cd87['query']=_[_0xd5c2('0x2e')](_0x57ca7d[_0xd5c2('0x2d')]);_0x41cd87['filters']=_['intersection'](_0x41cd87['model'],_0x41cd87[_0xd5c2('0x2d')]);_0x3f9614['attributes']=_['intersection'](_0x41cd87[_0xd5c2('0x2c')],qs[_0xd5c2('0x32')](_0x57ca7d[_0xd5c2('0x2d')][_0xd5c2('0x32')]));_0x3f9614[_0xd5c2('0x31')]=_0x3f9614[_0xd5c2('0x31')][_0xd5c2('0x33')]?_0x3f9614[_0xd5c2('0x31')]:_0x41cd87[_0xd5c2('0x2c')];if(_0x57ca7d[_0xd5c2('0x2d')][_0xd5c2('0x3f')]){_0x3f9614[_0xd5c2('0x40')]=[{'all':!![]}];}_0x3f9614=_[_0xd5c2('0x3c')]({},_0x3f9614,_0x57ca7d[_0xd5c2('0x3d')]);return db[_0xd5c2('0x3e')][_0xd5c2('0x45')](_0x3f9614)[_0xd5c2('0x21')](handleEntityNotFound(_0x2bb09f,null))['then'](respondWithResult(_0x2bb09f,null))[_0xd5c2('0x46')](handleError(_0x2bb09f,null));};exports['create']=function(_0x48e113,_0x33809d){return db[_0xd5c2('0x3e')][_0xd5c2('0x47')](_0x48e113[_0xd5c2('0x48')],{})['then'](respondWithResult(_0x33809d,0xc9))[_0xd5c2('0x46')](handleError(_0x33809d,null));};exports[_0xd5c2('0x49')]=function(_0x24c0e0,_0x515c63){if(_0x24c0e0[_0xd5c2('0x48')]['id']){delete _0x24c0e0[_0xd5c2('0x48')]['id'];}return db[_0xd5c2('0x3e')][_0xd5c2('0x45')]({'where':{'id':_0x24c0e0[_0xd5c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x515c63,null))[_0xd5c2('0x21')](saveUpdates(_0x24c0e0['body'],null))['then'](respondWithResult(_0x515c63,null))['catch'](handleError(_0x515c63,null));};exports[_0xd5c2('0x22')]=function(_0x5f9c70,_0x188e74){return db['SquareMessage'][_0xd5c2('0x45')]({'where':{'id':_0x5f9c70[_0xd5c2('0x44')]['id']}})[_0xd5c2('0x21')](handleEntityNotFound(_0x188e74,null))[_0xd5c2('0x21')](removeEntity(_0x188e74,null))[_0xd5c2('0x46')](handleError(_0x188e74,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fd6edf2..96fb97b 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 _0x20b1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','square_messages','lodash','util','../../config/logger'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x20b1,0xa6));var _0x120b=function(_0x43e9fc,_0x2c453f){_0x43e9fc=_0x43e9fc-0x0;var _0xf846d9=_0x20b1[_0x43e9fc];return _0xf846d9;};'use strict';var _=require(_0x120b('0x0'));var util=require(_0x120b('0x1'));var logger=require(_0x120b('0x2'))(_0x120b('0x3'));var moment=require(_0x120b('0x4'));var BPromise=require(_0x120b('0x5'));var rp=require(_0x120b('0x6'));var fs=require('fs');var path=require(_0x120b('0x7'));var rimraf=require(_0x120b('0x8'));var config=require(_0x120b('0x9'));var attributes=require(_0x120b('0xa'));module['exports']=function(_0x52c00a,_0x2f0208){return _0x52c00a[_0x120b('0xb')]('SquareMessage',attributes,{'tableName':_0x120b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6723=['SquareMessage','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0x6723,0xf1));var _0x3672=function(_0xbdaaca,_0x30900f){_0xbdaaca=_0xbdaaca-0x0;var _0x181ca3=_0x6723[_0xbdaaca];return _0x181ca3;};'use strict';var _=require('lodash');var util=require(_0x3672('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3672('0x1'));var BPromise=require(_0x3672('0x2'));var rp=require(_0x3672('0x3'));var fs=require('fs');var path=require(_0x3672('0x4'));var rimraf=require(_0x3672('0x5'));var config=require(_0x3672('0x6'));var attributes=require(_0x3672('0x7'));module[_0x3672('0x8')]=function(_0x56fb4f,_0x33facf){return _0x56fb4f['define'](_0x3672('0x9'),attributes,{'tableName':'square_messages','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 f461b2e..dc6f55b 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x1508f9,_0x5c55ca){var _0xf3da55=function(_0x19a6fa){while(--_0x19a6fa){_0x1508f9['push'](_0x1508f9['shift']());}};_0xf3da55(++_0x5c55ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x762af4,_0x5230c7){var _0x4a792a=function(_0x47a7ed){while(--_0x47a7ed){_0x762af4['push'](_0x762af4['shift']());}};_0x4a792a(++_0x5230c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1646ef6..6b738c2 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 _0x5ca8=['/:id/test','test','post','create','update','destroy','multer','util','connect-timeout','express','../../components/interaction/service','./squareOdbc.controller','get','index','/:id','isAuthenticated','show'];(function(_0x3b10bf,_0x10ecf7){var _0x53a0fd=function(_0x186a0b){while(--_0x186a0b){_0x3b10bf['push'](_0x3b10bf['shift']());}};_0x53a0fd(++_0x10ecf7);}(_0x5ca8,0x1f3));var _0x85ca=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5ca8[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x85ca('0x0'));var util=require(_0x85ca('0x1'));var path=require('path');var timeout=require(_0x85ca('0x2'));var express=require(_0x85ca('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x85ca('0x4'));var config=require('../../config/environment');var controller=require(_0x85ca('0x5'));router[_0x85ca('0x6')]('/',auth['isAuthenticated'](),controller[_0x85ca('0x7')]);router[_0x85ca('0x6')](_0x85ca('0x8'),auth[_0x85ca('0x9')](),controller[_0x85ca('0xa')]);router[_0x85ca('0x6')](_0x85ca('0xb'),auth['isAuthenticated'](),timeout('15s'),controller[_0x85ca('0xc')]);router[_0x85ca('0xd')]('/',auth[_0x85ca('0x9')](),controller[_0x85ca('0xe')]);router['put'](_0x85ca('0x8'),auth['isAuthenticated'](),controller[_0x85ca('0xf')]);router['delete'](_0x85ca('0x8'),auth[_0x85ca('0x9')](),controller[_0x85ca('0x10')]);module['exports']=router; \ No newline at end of file +var _0x39e4=['../../config/environment','get','isAuthenticated','index','show','/:id/test','15s','test','post','create','put','/:id','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x39e4,0x19e));var _0x439e=function(_0x3f29e2,_0x1b0672){_0x3f29e2=_0x3f29e2-0x0;var _0x53298a=_0x39e4[_0x3f29e2];return _0x53298a;};'use strict';var multer=require(_0x439e('0x0'));var util=require(_0x439e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x439e('0x2'));var router=express[_0x439e('0x3')]();var auth=require(_0x439e('0x4'));var interaction=require(_0x439e('0x5'));var config=require(_0x439e('0x6'));var controller=require('./squareOdbc.controller');router[_0x439e('0x7')]('/',auth[_0x439e('0x8')](),controller[_0x439e('0x9')]);router[_0x439e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x439e('0xa')]);router[_0x439e('0x7')](_0x439e('0xb'),auth[_0x439e('0x8')](),timeout(_0x439e('0xc')),controller[_0x439e('0xd')]);router[_0x439e('0xe')]('/',auth[_0x439e('0x8')](),controller[_0x439e('0xf')]);router[_0x439e('0x10')](_0x439e('0x11'),auth[_0x439e('0x8')](),controller[_0x439e('0x12')]);router['delete'](_0x439e('0x11'),auth[_0x439e('0x8')](),controller['destroy']);module[_0x439e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index efd7c4e..debc409 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 _0xef20=['sequelize','exports','STRING','name'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xef20,0x1e4));var _0x0ef2=function(_0x36789c,_0x4cbd7f){_0x36789c=_0x36789c-0x0;var _0x5a676a=_0xef20[_0x36789c];return _0x5a676a;};'use strict';var Sequelize=require(_0x0ef2('0x0'));module[_0x0ef2('0x1')]={'name':{'type':Sequelize[_0x0ef2('0x2')],'unique':_0x0ef2('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0ef2('0x2')]},'description':{'type':Sequelize[_0x0ef2('0x2')]}}; \ No newline at end of file +var _0xbfd0=['sequelize','exports','STRING'];(function(_0x4851c7,_0x1cb4a0){var _0x56a7d4=function(_0x96532a){while(--_0x96532a){_0x4851c7['push'](_0x4851c7['shift']());}};_0x56a7d4(++_0x1cb4a0);}(_0xbfd0,0x66));var _0x0bfd=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xbfd0[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0x0bfd('0x0'));module[_0x0bfd('0x1')]={'name':{'type':Sequelize[_0x0bfd('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0bfd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 435f3d5..032e943 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 _0x0887=['rows','catch','params','rawAttributes','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','html-pdf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','update','then','get','ODBC','destroy','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','include','findAll'];(function(_0x3b6b49,_0xdb8ca8){var _0x5d51ca=function(_0x259520){while(--_0x259520){_0x3b6b49['push'](_0x3b6b49['shift']());}};_0x5d51ca(++_0xdb8ca8);}(_0x0887,0x1bd));var _0x7088=function(_0x1559a0,_0x9b8fd7){_0x1559a0=_0x1559a0-0x0;var _0x37e36f=_0x0887[_0x1559a0];return _0x37e36f;};'use strict';var pdf=require(_0x7088('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7088('0x1'));var jsonpatch=require(_0x7088('0x2'));var rp=require('request-promise');var moment=require(_0x7088('0x3'));var BPromise=require(_0x7088('0x4'));var Mustache=require('mustache');var util=require(_0x7088('0x5'));var path=require(_0x7088('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7088('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7088('0x8'));var crypto=require(_0x7088('0x9'));var jsforce=require(_0x7088('0xa'));var deskjs=require(_0x7088('0xb'));var toCsv=require(_0x7088('0xc'));var querystring=require(_0x7088('0xd'));var Papa=require(_0x7088('0xe'));var Redis=require(_0x7088('0xf'));var authService=require(_0x7088('0x10'));var qs=require(_0x7088('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7088('0x12'));var logger=require(_0x7088('0x13'))('api');var utils=require(_0x7088('0x14'));var config=require(_0x7088('0x15'));var licenseUtil=require(_0x7088('0x16'));var db=require(_0x7088('0x17'))['db'];function respondWithStatusCode(_0x230262,_0x3f6d02){_0x3f6d02=_0x3f6d02||0xcc;return function(_0x39e34e){if(_0x39e34e){return _0x230262[_0x7088('0x18')](_0x3f6d02);}return _0x230262['status'](_0x3f6d02)[_0x7088('0x19')]();};}function respondWithResult(_0x1e1569,_0x247e8f){_0x247e8f=_0x247e8f||0xc8;return function(_0x220eef){if(_0x220eef){return _0x1e1569['status'](_0x247e8f)[_0x7088('0x1a')](_0x220eef);}};}function respondWithFilteredResult(_0x25f65e,_0x37dd0b){return function(_0x5ce274){if(_0x5ce274){var _0x48726=_0x5ce274[_0x7088('0x1b')],_0x325abe=_0x37dd0b[_0x7088('0x1c')],_0x4678ed=_0x37dd0b[_0x7088('0x1c')]+_0x37dd0b[_0x7088('0x1d')],_0x6c4a57;if(_0x4678ed>=_0x48726){_0x4678ed=_0x48726;_0x6c4a57=0xc8;}else{_0x6c4a57=0xce;}_0x25f65e[_0x7088('0x1e')](_0x6c4a57);return _0x25f65e['set'](_0x7088('0x1f'),_0x325abe+'-'+_0x4678ed+'/'+_0x48726)['json'](_0x5ce274);}return null;};}function patchUpdates(_0x3ae545){return function(_0x25aca3){try{jsonpatch[_0x7088('0x20')](_0x25aca3,_0x3ae545,!![]);}catch(_0x3b4985){return BPromise[_0x7088('0x21')](_0x3b4985);}return _0x25aca3['save']();};}function saveUpdates(_0x2876dc,_0x4ac432){return function(_0x25f3f6){if(_0x25f3f6){return _0x25f3f6[_0x7088('0x22')](_0x2876dc)[_0x7088('0x23')](function(_0x3bd73d){return _0x3bd73d;});}return null;};}function removeEntity(_0x3aa027,_0x2d3735){return function(_0x391a52){if(_0x391a52){return _0x391a52['destroy']()[_0x7088('0x23')](function(){var _0x3bc8c8=_0x391a52[_0x7088('0x24')]({'plain':!![]});var _0x46075e=_0x7088('0x25');return db['UserProfileResource'][_0x7088('0x26')]({'where':{'type':_0x46075e,'resourceId':_0x3bc8c8['id']}})[_0x7088('0x23')](function(){return _0x391a52;});})['then'](function(){_0x3aa027[_0x7088('0x1e')](0xcc)[_0x7088('0x19')]();});}};}function handleEntityNotFound(_0x4662e0,_0x5b0e28){return function(_0x164aab){if(!_0x164aab){_0x4662e0[_0x7088('0x18')](0x194);}return _0x164aab;};}function handleError(_0x3269cb,_0x47b9b4){_0x47b9b4=_0x47b9b4||0x1f4;return function(_0x48de5a){logger[_0x7088('0x27')](_0x48de5a[_0x7088('0x28')]);if(_0x48de5a[_0x7088('0x29')]){delete _0x48de5a[_0x7088('0x29')];}_0x3269cb[_0x7088('0x1e')](_0x47b9b4)[_0x7088('0x2a')](_0x48de5a);};}exports[_0x7088('0x2b')]=function(_0x36b4d5,_0x56493f){var _0x1ebd6c={},_0x360823={},_0x3a8cd5={'count':0x0,'rows':[]};var _0x33ba13=_[_0x7088('0x2c')](db[_0x7088('0x2d')]['rawAttributes'],function(_0x560f01){return{'name':_0x560f01[_0x7088('0x2e')],'type':_0x560f01[_0x7088('0x2f')][_0x7088('0x30')]};});_0x360823[_0x7088('0x31')]=_[_0x7088('0x2c')](_0x33ba13,_0x7088('0x29'));_0x360823[_0x7088('0x32')]=_[_0x7088('0x33')](_0x36b4d5['query']);_0x360823[_0x7088('0x34')]=_['intersection'](_0x360823['model'],_0x360823['query']);_0x1ebd6c[_0x7088('0x35')]=_[_0x7088('0x36')](_0x360823[_0x7088('0x31')],qs['fields'](_0x36b4d5[_0x7088('0x32')]['fields']));_0x1ebd6c['attributes']=_0x1ebd6c[_0x7088('0x35')][_0x7088('0x37')]?_0x1ebd6c[_0x7088('0x35')]:_0x360823['model'];if(!_0x36b4d5[_0x7088('0x32')][_0x7088('0x38')]('nolimit')){_0x1ebd6c['limit']=qs[_0x7088('0x1d')](_0x36b4d5[_0x7088('0x32')][_0x7088('0x1d')]);_0x1ebd6c[_0x7088('0x1c')]=qs[_0x7088('0x1c')](_0x36b4d5[_0x7088('0x32')]['offset']);}_0x1ebd6c['order']=qs[_0x7088('0x39')](_0x36b4d5[_0x7088('0x32')][_0x7088('0x39')]);_0x1ebd6c[_0x7088('0x3a')]=qs[_0x7088('0x34')](_[_0x7088('0x3b')](_0x36b4d5[_0x7088('0x32')],_0x360823[_0x7088('0x34')]),_0x33ba13);if(_0x36b4d5['query'][_0x7088('0x3c')]){_0x1ebd6c[_0x7088('0x3a')]=_[_0x7088('0x3d')](_0x1ebd6c[_0x7088('0x3a')],{'$or':_['map'](_0x33ba13,function(_0x5c6caa){if(_0x5c6caa['type']!==_0x7088('0x3e')){var _0x2a4f2d={};_0x2a4f2d[_0x5c6caa[_0x7088('0x29')]]={'$like':'%'+_0x36b4d5[_0x7088('0x32')][_0x7088('0x3c')]+'%'};return _0x2a4f2d;}})});}_0x1ebd6c=_[_0x7088('0x3d')]({},_0x1ebd6c,_0x36b4d5['options']);var _0x4993e7={'where':_0x1ebd6c[_0x7088('0x3a')]};return db[_0x7088('0x2d')][_0x7088('0x1b')](_0x4993e7)[_0x7088('0x23')](function(_0xcfdcf5){_0x3a8cd5[_0x7088('0x1b')]=_0xcfdcf5;if(_0x36b4d5['query']['includeAll']){_0x1ebd6c[_0x7088('0x3f')]=[{'all':!![]}];}return db[_0x7088('0x2d')][_0x7088('0x40')](_0x1ebd6c);})['then'](function(_0xa3792a){_0x3a8cd5[_0x7088('0x41')]=_0xa3792a;return _0x3a8cd5;})[_0x7088('0x23')](respondWithFilteredResult(_0x56493f,_0x1ebd6c))[_0x7088('0x42')](handleError(_0x56493f,null));};exports['show']=function(_0x76bdf9,_0x3fba6c){var _0x536ba9={'raw':!![],'where':{'id':_0x76bdf9[_0x7088('0x43')]['id']}},_0x35e804={};_0x35e804[_0x7088('0x31')]=_[_0x7088('0x33')](db['SquareOdbc'][_0x7088('0x44')]);_0x35e804[_0x7088('0x32')]=_[_0x7088('0x33')](_0x76bdf9[_0x7088('0x32')]);_0x35e804[_0x7088('0x34')]=_['intersection'](_0x35e804[_0x7088('0x31')],_0x35e804[_0x7088('0x32')]);_0x536ba9[_0x7088('0x35')]=_[_0x7088('0x36')](_0x35e804[_0x7088('0x31')],qs['fields'](_0x76bdf9[_0x7088('0x32')][_0x7088('0x45')]));_0x536ba9[_0x7088('0x35')]=_0x536ba9[_0x7088('0x35')][_0x7088('0x37')]?_0x536ba9['attributes']:_0x35e804[_0x7088('0x31')];if(_0x76bdf9[_0x7088('0x32')]['includeAll']){_0x536ba9['include']=[{'all':!![]}];}_0x536ba9=_[_0x7088('0x3d')]({},_0x536ba9,_0x76bdf9[_0x7088('0x46')]);return db[_0x7088('0x2d')][_0x7088('0x47')](_0x536ba9)[_0x7088('0x23')](handleEntityNotFound(_0x3fba6c,null))['then'](respondWithResult(_0x3fba6c,null))[_0x7088('0x42')](handleError(_0x3fba6c,null));};exports['create']=function(_0x3cfbb2,_0x547d1b){return db[_0x7088('0x2d')][_0x7088('0x48')](_0x3cfbb2[_0x7088('0x49')],{})[_0x7088('0x23')](function(_0x332248){var _0xa9ec65=_0x3cfbb2[_0x7088('0x4a')][_0x7088('0x24')]({'plain':!![]});if(!_0xa9ec65)throw new Error(_0x7088('0x4b'));if(_0xa9ec65['role']===_0x7088('0x4a')){var _0x559b1f=_0x332248[_0x7088('0x24')]({'plain':!![]});var _0x338643=_0x7088('0x25');return db[_0x7088('0x4c')][_0x7088('0x47')]({'where':{'name':_0x338643,'userProfileId':_0xa9ec65[_0x7088('0x4d')]},'raw':!![]})[_0x7088('0x23')](function(_0x3b1db2){if(_0x3b1db2&&_0x3b1db2[_0x7088('0x4e')]===0x0){return db[_0x7088('0x4f')][_0x7088('0x48')]({'name':_0x559b1f[_0x7088('0x29')],'resourceId':_0x559b1f['id'],'type':_0x3b1db2['name'],'sectionId':_0x3b1db2['id']},{})[_0x7088('0x23')](function(){return _0x332248;});}else{return _0x332248;}})['catch'](function(_0x2feb54){logger[_0x7088('0x27')](_0x7088('0x50'),_0x2feb54);throw _0x2feb54;});}return _0x332248;})[_0x7088('0x23')](respondWithResult(_0x547d1b,0xc9))[_0x7088('0x42')](handleError(_0x547d1b,null));};exports[_0x7088('0x22')]=function(_0x4214b9,_0x2a6309){if(_0x4214b9[_0x7088('0x49')]['id']){delete _0x4214b9[_0x7088('0x49')]['id'];}return db['SquareOdbc'][_0x7088('0x47')]({'where':{'id':_0x4214b9['params']['id']}})[_0x7088('0x23')](handleEntityNotFound(_0x2a6309,null))[_0x7088('0x23')](saveUpdates(_0x4214b9[_0x7088('0x49')],null))[_0x7088('0x23')](respondWithResult(_0x2a6309,null))[_0x7088('0x42')](handleError(_0x2a6309,null));};exports[_0x7088('0x26')]=function(_0x28cd4b,_0x4263b4){return db[_0x7088('0x2d')][_0x7088('0x47')]({'where':{'id':_0x28cd4b[_0x7088('0x43')]['id']}})['then'](handleEntityNotFound(_0x4263b4,null))['then'](removeEntity(_0x4263b4,null))[_0x7088('0x42')](handleError(_0x4263b4,null));};exports['test']=function(_0x2ed168,_0x8b2023,_0x3fabbb){var _0x3543c1;return db[_0x7088('0x2d')]['find']({'where':{'id':_0x2ed168[_0x7088('0x43')]['id']},'attributes':['id',_0x7088('0x51')]})['then'](handleEntityNotFound(_0x8b2023,null))['then'](function(_0x25b933){if(_0x25b933){var _0x471307=require(_0x7088('0x52'))();_0x471307[_0x7088('0x53')](_0x25b933['dsn']);_0x471307[_0x7088('0x54')]();return _0x25b933;}})[_0x7088('0x23')](respondWithResult(_0x8b2023,null))[_0x7088('0x42')](handleError(_0x8b2023,null));}; \ No newline at end of file +var _0x2323=['destroy','sendStatus','stack','name','map','SquareOdbc','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','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','params','test','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','end','status','json','count','offset','set','Content-Range','apply','save','update','then','get','ODBC','UserProfileResource'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x2323,0xcd));var _0x3232=function(_0x119f7b,_0x204cc4){_0x119f7b=_0x119f7b-0x0;var _0x247400=_0x2323[_0x119f7b];return _0x247400;};'use strict';var pdf=require(_0x3232('0x0'));var emlformat=require(_0x3232('0x1'));var rimraf=require(_0x3232('0x2'));var zipdir=require(_0x3232('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3232('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3232('0x5'));var util=require('util');var path=require(_0x3232('0x6'));var sox=require(_0x3232('0x7'));var csv=require(_0x3232('0x8'));var ejs=require(_0x3232('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3232('0xa'));var crypto=require(_0x3232('0xb'));var jsforce=require(_0x3232('0xc'));var deskjs=require(_0x3232('0xd'));var toCsv=require(_0x3232('0x8'));var querystring=require(_0x3232('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3232('0xf'));var qs=require(_0x3232('0x10'));var as=require(_0x3232('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3232('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3232('0x13'));var licenseUtil=require(_0x3232('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4603ab,_0x497a8d){_0x497a8d=_0x497a8d||0xcc;return function(_0x1628ed){if(_0x1628ed){return _0x4603ab['sendStatus'](_0x497a8d);}return _0x4603ab['status'](_0x497a8d)[_0x3232('0x15')]();};}function respondWithResult(_0x2d3ca3,_0x25551a){_0x25551a=_0x25551a||0xc8;return function(_0x39790d){if(_0x39790d){return _0x2d3ca3[_0x3232('0x16')](_0x25551a)[_0x3232('0x17')](_0x39790d);}};}function respondWithFilteredResult(_0x202a8d,_0x1db426){return function(_0x7eefdb){if(_0x7eefdb){var _0x4ba333=_0x7eefdb[_0x3232('0x18')],_0x1ad92d=_0x1db426[_0x3232('0x19')],_0x3b8839=_0x1db426[_0x3232('0x19')]+_0x1db426['limit'],_0x153929;if(_0x3b8839>=_0x4ba333){_0x3b8839=_0x4ba333;_0x153929=0xc8;}else{_0x153929=0xce;}_0x202a8d[_0x3232('0x16')](_0x153929);return _0x202a8d[_0x3232('0x1a')](_0x3232('0x1b'),_0x1ad92d+'-'+_0x3b8839+'/'+_0x4ba333)[_0x3232('0x17')](_0x7eefdb);}return null;};}function patchUpdates(_0x5ec93d){return function(_0x4bc5b7){try{jsonpatch[_0x3232('0x1c')](_0x4bc5b7,_0x5ec93d,!![]);}catch(_0x36e03e){return BPromise['reject'](_0x36e03e);}return _0x4bc5b7[_0x3232('0x1d')]();};}function saveUpdates(_0x978bbc,_0x350d23){return function(_0x4a20c5){if(_0x4a20c5){return _0x4a20c5[_0x3232('0x1e')](_0x978bbc)[_0x3232('0x1f')](function(_0x3ef230){return _0x3ef230;});}return null;};}function removeEntity(_0x1a2209,_0x279ec3){return function(_0x12f271){if(_0x12f271){return _0x12f271['destroy']()[_0x3232('0x1f')](function(){var _0xec8479=_0x12f271[_0x3232('0x20')]({'plain':!![]});var _0x53ec37=_0x3232('0x21');return db[_0x3232('0x22')][_0x3232('0x23')]({'where':{'type':_0x53ec37,'resourceId':_0xec8479['id']}})[_0x3232('0x1f')](function(){return _0x12f271;});})[_0x3232('0x1f')](function(){_0x1a2209['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2af6d7,_0x5e9182){return function(_0x359f57){if(!_0x359f57){_0x2af6d7[_0x3232('0x24')](0x194);}return _0x359f57;};}function handleError(_0x57180a,_0x313207){_0x313207=_0x313207||0x1f4;return function(_0x56d8b3){logger['error'](_0x56d8b3[_0x3232('0x25')]);if(_0x56d8b3[_0x3232('0x26')]){delete _0x56d8b3[_0x3232('0x26')];}_0x57180a[_0x3232('0x16')](_0x313207)['send'](_0x56d8b3);};}exports['index']=function(_0x340d56,_0x2362d2){var _0x55f67f={},_0x554d7b={},_0x3cbc42={'count':0x0,'rows':[]};var _0x20753d=_[_0x3232('0x27')](db[_0x3232('0x28')]['rawAttributes'],function(_0x312590){return{'name':_0x312590['fieldName'],'type':_0x312590['type']['key']};});_0x554d7b[_0x3232('0x29')]=_['map'](_0x20753d,_0x3232('0x26'));_0x554d7b['query']=_['keys'](_0x340d56[_0x3232('0x2a')]);_0x554d7b['filters']=_[_0x3232('0x2b')](_0x554d7b[_0x3232('0x29')],_0x554d7b[_0x3232('0x2a')]);_0x55f67f['attributes']=_[_0x3232('0x2b')](_0x554d7b[_0x3232('0x29')],qs['fields'](_0x340d56[_0x3232('0x2a')][_0x3232('0x2c')]));_0x55f67f[_0x3232('0x2d')]=_0x55f67f[_0x3232('0x2d')][_0x3232('0x2e')]?_0x55f67f[_0x3232('0x2d')]:_0x554d7b[_0x3232('0x29')];if(!_0x340d56[_0x3232('0x2a')][_0x3232('0x2f')](_0x3232('0x30'))){_0x55f67f[_0x3232('0x31')]=qs[_0x3232('0x31')](_0x340d56[_0x3232('0x2a')][_0x3232('0x31')]);_0x55f67f[_0x3232('0x19')]=qs['offset'](_0x340d56[_0x3232('0x2a')][_0x3232('0x19')]);}_0x55f67f['order']=qs[_0x3232('0x32')](_0x340d56[_0x3232('0x2a')][_0x3232('0x32')]);_0x55f67f[_0x3232('0x33')]=qs['filters'](_[_0x3232('0x34')](_0x340d56['query'],_0x554d7b[_0x3232('0x35')]),_0x20753d);if(_0x340d56[_0x3232('0x2a')][_0x3232('0x36')]){_0x55f67f[_0x3232('0x33')]=_[_0x3232('0x37')](_0x55f67f[_0x3232('0x33')],{'$or':_[_0x3232('0x27')](_0x20753d,function(_0x1309a1){if(_0x1309a1[_0x3232('0x38')]!=='VIRTUAL'){var _0x268335={};_0x268335[_0x1309a1[_0x3232('0x26')]]={'$like':'%'+_0x340d56[_0x3232('0x2a')][_0x3232('0x36')]+'%'};return _0x268335;}})});}_0x55f67f=_[_0x3232('0x37')]({},_0x55f67f,_0x340d56[_0x3232('0x39')]);var _0x1aa7a3={'where':_0x55f67f[_0x3232('0x33')]};return db[_0x3232('0x28')][_0x3232('0x18')](_0x1aa7a3)[_0x3232('0x1f')](function(_0x449748){_0x3cbc42[_0x3232('0x18')]=_0x449748;if(_0x340d56['query'][_0x3232('0x3a')]){_0x55f67f[_0x3232('0x3b')]=[{'all':!![]}];}return db[_0x3232('0x28')][_0x3232('0x3c')](_0x55f67f);})[_0x3232('0x1f')](function(_0x119b82){_0x3cbc42[_0x3232('0x3d')]=_0x119b82;return _0x3cbc42;})[_0x3232('0x1f')](respondWithFilteredResult(_0x2362d2,_0x55f67f))[_0x3232('0x3e')](handleError(_0x2362d2,null));};exports[_0x3232('0x3f')]=function(_0x13f7e6,_0x3e4011){var _0x18360f={'raw':!![],'where':{'id':_0x13f7e6['params']['id']}},_0x3830d6={};_0x3830d6['model']=_['keys'](db[_0x3232('0x28')][_0x3232('0x40')]);_0x3830d6[_0x3232('0x2a')]=_[_0x3232('0x41')](_0x13f7e6['query']);_0x3830d6[_0x3232('0x35')]=_[_0x3232('0x2b')](_0x3830d6['model'],_0x3830d6[_0x3232('0x2a')]);_0x18360f[_0x3232('0x2d')]=_[_0x3232('0x2b')](_0x3830d6[_0x3232('0x29')],qs['fields'](_0x13f7e6['query'][_0x3232('0x2c')]));_0x18360f['attributes']=_0x18360f['attributes'][_0x3232('0x2e')]?_0x18360f['attributes']:_0x3830d6[_0x3232('0x29')];if(_0x13f7e6[_0x3232('0x2a')]['includeAll']){_0x18360f[_0x3232('0x3b')]=[{'all':!![]}];}_0x18360f=_[_0x3232('0x37')]({},_0x18360f,_0x13f7e6[_0x3232('0x39')]);return db[_0x3232('0x28')][_0x3232('0x42')](_0x18360f)[_0x3232('0x1f')](handleEntityNotFound(_0x3e4011,null))['then'](respondWithResult(_0x3e4011,null))[_0x3232('0x3e')](handleError(_0x3e4011,null));};exports[_0x3232('0x43')]=function(_0x260e8c,_0x3c61ee){return db['SquareOdbc'][_0x3232('0x43')](_0x260e8c[_0x3232('0x44')],{})[_0x3232('0x1f')](function(_0xe4a0fb){var _0x44f8bd=_0x260e8c[_0x3232('0x45')][_0x3232('0x20')]({'plain':!![]});if(!_0x44f8bd)throw new Error(_0x3232('0x46'));if(_0x44f8bd[_0x3232('0x47')]===_0x3232('0x45')){var _0x2771cb=_0xe4a0fb[_0x3232('0x20')]({'plain':!![]});var _0x42b7a8=_0x3232('0x21');return db[_0x3232('0x48')]['find']({'where':{'name':_0x42b7a8,'userProfileId':_0x44f8bd[_0x3232('0x49')]},'raw':!![]})['then'](function(_0x50269c){if(_0x50269c&&_0x50269c[_0x3232('0x4a')]===0x0){return db[_0x3232('0x22')][_0x3232('0x43')]({'name':_0x2771cb[_0x3232('0x26')],'resourceId':_0x2771cb['id'],'type':_0x50269c[_0x3232('0x26')],'sectionId':_0x50269c['id']},{})[_0x3232('0x1f')](function(){return _0xe4a0fb;});}else{return _0xe4a0fb;}})[_0x3232('0x3e')](function(_0x33dbc3){logger['error'](_0x3232('0x4b'),_0x33dbc3);throw _0x33dbc3;});}return _0xe4a0fb;})[_0x3232('0x1f')](respondWithResult(_0x3c61ee,0xc9))[_0x3232('0x3e')](handleError(_0x3c61ee,null));};exports[_0x3232('0x1e')]=function(_0x1211ca,_0x462965){if(_0x1211ca[_0x3232('0x44')]['id']){delete _0x1211ca[_0x3232('0x44')]['id'];}return db[_0x3232('0x28')]['find']({'where':{'id':_0x1211ca[_0x3232('0x4c')]['id']}})[_0x3232('0x1f')](handleEntityNotFound(_0x462965,null))[_0x3232('0x1f')](saveUpdates(_0x1211ca['body'],null))['then'](respondWithResult(_0x462965,null))[_0x3232('0x3e')](handleError(_0x462965,null));};exports['destroy']=function(_0x5b9e03,_0x280cee){return db[_0x3232('0x28')][_0x3232('0x42')]({'where':{'id':_0x5b9e03[_0x3232('0x4c')]['id']}})['then'](handleEntityNotFound(_0x280cee,null))[_0x3232('0x1f')](removeEntity(_0x280cee,null))[_0x3232('0x3e')](handleError(_0x280cee,null));};exports[_0x3232('0x4d')]=function(_0x4cc1aa,_0x10b3e8,_0x29825c){var _0x215180;return db['SquareOdbc'][_0x3232('0x42')]({'where':{'id':_0x4cc1aa['params']['id']},'attributes':['id',_0x3232('0x4e')]})[_0x3232('0x1f')](handleEntityNotFound(_0x10b3e8,null))[_0x3232('0x1f')](function(_0x41929e){if(_0x41929e){var _0xca3937=require('odbc')();_0xca3937['openSync'](_0x41929e[_0x3232('0x4e')]);_0xca3937[_0x3232('0x4f')]();return _0x41929e;}})[_0x3232('0x1f')](respondWithResult(_0x10b3e8,null))[_0x3232('0x3e')](handleError(_0x10b3e8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f73ab05..ba43986 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 _0x8234=['./squareOdbc.attributes','define','SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x8234,0x1cb));var _0x4823=function(_0x368c72,_0x1dd70e){_0x368c72=_0x368c72-0x0;var _0x4c42d6=_0x8234[_0x368c72];return _0x4c42d6;};'use strict';var _=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var logger=require(_0x4823('0x2'))(_0x4823('0x3'));var moment=require(_0x4823('0x4'));var BPromise=require(_0x4823('0x5'));var rp=require(_0x4823('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4823('0x7'));var config=require(_0x4823('0x8'));var attributes=require(_0x4823('0x9'));module['exports']=function(_0x1cc229,_0x54f1db){return _0x1cc229[_0x4823('0xa')](_0x4823('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce2f=['api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes','define','SquareOdbc','square_odbc','util','../../config/logger'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0xce2f,0x18a));var _0xfce2=function(_0x39fb38,_0x3e38cb){_0x39fb38=_0x39fb38-0x0;var _0x4ee8bf=_0xce2f[_0x39fb38];return _0x4ee8bf;};'use strict';var _=require('lodash');var util=require(_0xfce2('0x0'));var logger=require(_0xfce2('0x1'))(_0xfce2('0x2'));var moment=require(_0xfce2('0x3'));var BPromise=require(_0xfce2('0x4'));var rp=require(_0xfce2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfce2('0x6'));var config=require('../../config/environment');var attributes=require(_0xfce2('0x7'));module['exports']=function(_0x22efae,_0xeffde2){return _0x22efae[_0xfce2('0x8')](_0xfce2('0x9'),attributes,{'tableName':_0xfce2('0xa'),'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 42a07aa..ad7c983 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 _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x3a5454,_0x41f2b2){var _0x593b97=function(_0x478356){while(--_0x478356){_0x3a5454['push'](_0x3a5454['shift']());}};_0x593b97(++_0x41f2b2);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('SquareOdbc,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['SquareOdbc'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x358436,_0x5c3c5f){var _0x343cb=function(_0x3b2391){while(--_0x3b2391){_0x358436['push'](_0x358436['shift']());}};_0x343cb(++_0x5c3c5f);}(_0xe14b,0x93));var _0xbe14=function(_0x190618,_0x200c7e){_0x190618=_0x190618-0x0;var _0x5a9c05=_0xe14b[_0x190618];return _0x5a9c05;};'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);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 73217e2..fe38fc5 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 _0xe597=['/:id','getUsers','create','/:id/users','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index'];(function(_0x42638f,_0x4e46a4){var _0x12d663=function(_0x51b14e){while(--_0x51b14e){_0x42638f['push'](_0x42638f['shift']());}};_0x12d663(++_0x4e46a4);}(_0xe597,0x16f));var _0x7e59=function(_0x2042b7,_0x4a84c6){_0x2042b7=_0x2042b7-0x0;var _0x3b2f9d=_0xe597[_0x2042b7];return _0x3b2f9d;};'use strict';var multer=require(_0x7e59('0x0'));var util=require(_0x7e59('0x1'));var path=require(_0x7e59('0x2'));var timeout=require(_0x7e59('0x3'));var express=require(_0x7e59('0x4'));var router=express[_0x7e59('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e59('0x6'));var config=require('../../config/environment');var controller=require(_0x7e59('0x7'));router[_0x7e59('0x8')]('/',auth[_0x7e59('0x9')](),controller[_0x7e59('0xa')]);router[_0x7e59('0x8')](_0x7e59('0xb'),auth[_0x7e59('0x9')](),controller['show']);router[_0x7e59('0x8')]('/:id/users',auth[_0x7e59('0x9')](),controller[_0x7e59('0xc')]);router['post']('/',auth[_0x7e59('0x9')](),controller[_0x7e59('0xd')]);router['post'](_0x7e59('0xe'),auth[_0x7e59('0x9')](),controller['addUsers']);router[_0x7e59('0xf')](_0x7e59('0xb'),auth[_0x7e59('0x9')](),controller[_0x7e59('0x10')]);router[_0x7e59('0x11')]('/:id',auth[_0x7e59('0x9')](),controller[_0x7e59('0x12')]);router[_0x7e59('0x11')]('/:id/users',auth[_0x7e59('0x9')](),controller[_0x7e59('0x13')]);module[_0x7e59('0x14')]=router; \ No newline at end of file +var _0x4d27=['post','addUsers','put','delete','removeUsers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','isAuthenticated','index','/:id','show','get','/:id/users','getUsers'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4d27,0x117));var _0x74d2=function(_0x5b5485,_0x4b846f){_0x5b5485=_0x5b5485-0x0;var _0x184f45=_0x4d27[_0x5b5485];return _0x184f45;};'use strict';var multer=require('multer');var util=require(_0x74d2('0x0'));var path=require(_0x74d2('0x1'));var timeout=require(_0x74d2('0x2'));var express=require(_0x74d2('0x3'));var router=express[_0x74d2('0x4')]();var auth=require(_0x74d2('0x5'));var interaction=require(_0x74d2('0x6'));var config=require('../../config/environment');var controller=require(_0x74d2('0x7'));router['get']('/',auth[_0x74d2('0x8')](),controller[_0x74d2('0x9')]);router['get'](_0x74d2('0xa'),auth[_0x74d2('0x8')](),controller[_0x74d2('0xb')]);router[_0x74d2('0xc')](_0x74d2('0xd'),auth['isAuthenticated'](),controller[_0x74d2('0xe')]);router[_0x74d2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x74d2('0xd'),auth[_0x74d2('0x8')](),controller[_0x74d2('0x10')]);router[_0x74d2('0x11')](_0x74d2('0xa'),auth[_0x74d2('0x8')](),controller['update']);router[_0x74d2('0x12')](_0x74d2('0xa'),auth[_0x74d2('0x8')](),controller['destroy']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x74d2('0x13')]);module[_0x74d2('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 49e6a35..3f3a4c7 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 _0xff32=['preproduction','getDataValue','utf8','long','production','toString','DATE','sequelize','exports','name','STRING','BLOB'];(function(_0x5202e8,_0x24ea22){var _0x216b84=function(_0x18a693){while(--_0x18a693){_0x5202e8['push'](_0x5202e8['shift']());}};_0x216b84(++_0x24ea22);}(_0xff32,0x1ab));var _0x2ff3=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xff32[_0x1a87b3];return _0x37e84d;};'use strict';var Sequelize=require(_0x2ff3('0x0'));module[_0x2ff3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2ff3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2ff3('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x2ff3('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x2ff3('0x5'))){return this[_0x2ff3('0x6')]('preproduction')['toString'](_0x2ff3('0x7'));}}},'production':{'type':Sequelize[_0x2ff3('0x4')](_0x2ff3('0x8')),'get':function(){if(this[_0x2ff3('0x6')](_0x2ff3('0x9'))){return this['getDataValue'](_0x2ff3('0x9'))[_0x2ff3('0xa')]('utf8');}}},'savedAt':{'type':Sequelize[_0x2ff3('0xb')]},'publishedAt':{'type':Sequelize[_0x2ff3('0xb')]}}; \ No newline at end of file +var _0x3093=['long','getDataValue','preproduction','toString','utf8','production','DATE','STRING','TEXT','BLOB'];(function(_0x25f743,_0x765664){var _0x2ba165=function(_0xf13c61){while(--_0xf13c61){_0x25f743['push'](_0x25f743['shift']());}};_0x2ba165(++_0x765664);}(_0x3093,0x183));var _0x3309=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x3093[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3309('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3309('0x0')]},'notes':{'type':Sequelize[_0x3309('0x1')]},'preproduction':{'type':Sequelize[_0x3309('0x2')](_0x3309('0x3')),'get':function(){if(this[_0x3309('0x4')](_0x3309('0x5'))){return this[_0x3309('0x4')](_0x3309('0x5'))[_0x3309('0x6')](_0x3309('0x7'));}}},'production':{'type':Sequelize[_0x3309('0x2')](_0x3309('0x3')),'get':function(){if(this[_0x3309('0x4')](_0x3309('0x8'))){return this[_0x3309('0x4')](_0x3309('0x8'))['toString'](_0x3309('0x7'));}}},'savedAt':{'type':Sequelize[_0x3309('0x9')]},'publishedAt':{'type':Sequelize[_0x3309('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 44a3c75..04df4b1 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 _0x13cf=['then','get','SquareProjects','UserProfileResource','destroy','error','stack','name','send','index','SquareProject','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','offset','set','apply','save','update'];(function(_0x26355f,_0x198959){var _0x3a3807=function(_0x5eb637){while(--_0x5eb637){_0x26355f['push'](_0x26355f['shift']());}};_0x3a3807(++_0x198959);}(_0x13cf,0x1c3));var _0xf13c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x13cf[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf13c('0x0'));var rimraf=require(_0xf13c('0x1'));var zipdir=require(_0xf13c('0x2'));var jsonpatch=require(_0xf13c('0x3'));var rp=require(_0xf13c('0x4'));var moment=require(_0xf13c('0x5'));var BPromise=require(_0xf13c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf13c('0x7'));var sox=require(_0xf13c('0x8'));var csv=require(_0xf13c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf13c('0xa'));var squel=require('squel');var crypto=require(_0xf13c('0xb'));var jsforce=require(_0xf13c('0xc'));var deskjs=require(_0xf13c('0xd'));var toCsv=require(_0xf13c('0x9'));var querystring=require(_0xf13c('0xe'));var Papa=require(_0xf13c('0xf'));var Redis=require('ioredis');var authService=require(_0xf13c('0x10'));var qs=require(_0xf13c('0x11'));var as=require(_0xf13c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf13c('0x13'))('api');var utils=require(_0xf13c('0x14'));var config=require(_0xf13c('0x15'));var licenseUtil=require(_0xf13c('0x16'));var db=require(_0xf13c('0x17'))['db'];config[_0xf13c('0x18')]=_[_0xf13c('0x19')](config[_0xf13c('0x18')],{'host':_0xf13c('0x1a'),'port':0x18eb});var socket=require(_0xf13c('0x1b'))(new Redis(config[_0xf13c('0x18')]));require(_0xf13c('0x1c'))[_0xf13c('0x1d')](socket);function respondWithStatusCode(_0x113a37,_0x5b1d68){_0x5b1d68=_0x5b1d68||0xcc;return function(_0x2724a7){if(_0x2724a7){return _0x113a37[_0xf13c('0x1e')](_0x5b1d68);}return _0x113a37['status'](_0x5b1d68)[_0xf13c('0x1f')]();};}function respondWithResult(_0x24e888,_0x3f753c){_0x3f753c=_0x3f753c||0xc8;return function(_0x560a8b){if(_0x560a8b){return _0x24e888[_0xf13c('0x20')](_0x3f753c)[_0xf13c('0x21')](_0x560a8b);}};}function respondWithFilteredResult(_0x23a67d,_0x531d42){return function(_0x12c7fc){if(_0x12c7fc){var _0x279c66=_0x12c7fc['count'],_0x52c0ee=_0x531d42[_0xf13c('0x22')],_0x104145=_0x531d42[_0xf13c('0x22')]+_0x531d42['limit'],_0x922163;if(_0x104145>=_0x279c66){_0x104145=_0x279c66;_0x922163=0xc8;}else{_0x922163=0xce;}_0x23a67d['status'](_0x922163);return _0x23a67d[_0xf13c('0x23')]('Content-Range',_0x52c0ee+'-'+_0x104145+'/'+_0x279c66)['json'](_0x12c7fc);}return null;};}function patchUpdates(_0x5a794d){return function(_0x11d6f8){try{jsonpatch[_0xf13c('0x24')](_0x11d6f8,_0x5a794d,!![]);}catch(_0x3fe003){return BPromise['reject'](_0x3fe003);}return _0x11d6f8[_0xf13c('0x25')]();};}function saveUpdates(_0x26754b,_0x35d91f){return function(_0x4cc8d0){if(_0x4cc8d0){return _0x4cc8d0[_0xf13c('0x26')](_0x26754b)[_0xf13c('0x27')](function(_0x1a4fde){return _0x1a4fde;});}return null;};}function removeEntity(_0x23561d,_0x2fb43c){return function(_0xf224c2){if(_0xf224c2){return _0xf224c2['destroy']()['then'](function(){var _0x1419c1=_0xf224c2[_0xf13c('0x28')]({'plain':!![]});var _0x2877b6=_0xf13c('0x29');return db[_0xf13c('0x2a')][_0xf13c('0x2b')]({'where':{'type':_0x2877b6,'resourceId':_0x1419c1['id']}})[_0xf13c('0x27')](function(){return _0xf224c2;});})[_0xf13c('0x27')](function(){_0x23561d[_0xf13c('0x20')](0xcc)[_0xf13c('0x1f')]();});}};}function handleEntityNotFound(_0x59eb9a,_0x3565ec){return function(_0x21ee20){if(!_0x21ee20){_0x59eb9a['sendStatus'](0x194);}return _0x21ee20;};}function handleError(_0x2e9641,_0x46e1b5){_0x46e1b5=_0x46e1b5||0x1f4;return function(_0x211456){logger[_0xf13c('0x2c')](_0x211456[_0xf13c('0x2d')]);if(_0x211456[_0xf13c('0x2e')]){delete _0x211456[_0xf13c('0x2e')];}_0x2e9641[_0xf13c('0x20')](_0x46e1b5)[_0xf13c('0x2f')](_0x211456);};}exports[_0xf13c('0x30')]=function(_0x2f211a,_0x49bc5c){var _0x2c536={},_0x3a0052={},_0xc4ce97={'count':0x0,'rows':[]};var _0x43771e=_['map'](db[_0xf13c('0x31')]['rawAttributes'],function(_0x24f46e){return{'name':_0x24f46e['fieldName'],'type':_0x24f46e['type']['key']};});_0x3a0052['model']=_[_0xf13c('0x32')](_0x43771e,_0xf13c('0x2e'));_0x3a0052['query']=_[_0xf13c('0x33')](_0x2f211a[_0xf13c('0x34')]);_0x3a0052[_0xf13c('0x35')]=_[_0xf13c('0x36')](_0x3a0052[_0xf13c('0x37')],_0x3a0052[_0xf13c('0x34')]);_0x2c536[_0xf13c('0x38')]=_[_0xf13c('0x36')](_0x3a0052['model'],qs['fields'](_0x2f211a['query'][_0xf13c('0x39')]));_0x2c536[_0xf13c('0x38')]=_0x2c536[_0xf13c('0x38')][_0xf13c('0x3a')]?_0x2c536[_0xf13c('0x38')]:_0x3a0052[_0xf13c('0x37')];if(!_0x2f211a['query'][_0xf13c('0x3b')](_0xf13c('0x3c'))){_0x2c536['limit']=qs[_0xf13c('0x3d')](_0x2f211a[_0xf13c('0x34')]['limit']);_0x2c536['offset']=qs[_0xf13c('0x22')](_0x2f211a[_0xf13c('0x34')][_0xf13c('0x22')]);}_0x2c536[_0xf13c('0x3e')]=qs[_0xf13c('0x3f')](_0x2f211a['query'][_0xf13c('0x3f')]);_0x2c536[_0xf13c('0x40')]=qs[_0xf13c('0x35')](_[_0xf13c('0x41')](_0x2f211a[_0xf13c('0x34')],_0x3a0052[_0xf13c('0x35')]),_0x43771e);if(_0x2f211a[_0xf13c('0x34')][_0xf13c('0x42')]){_0x2c536[_0xf13c('0x40')]=_['merge'](_0x2c536[_0xf13c('0x40')],{'$or':_[_0xf13c('0x32')](_0x43771e,function(_0x58d99a){if(_0x58d99a[_0xf13c('0x43')]!==_0xf13c('0x44')){var _0x156daa={};_0x156daa[_0x58d99a[_0xf13c('0x2e')]]={'$like':'%'+_0x2f211a[_0xf13c('0x34')]['filter']+'%'};return _0x156daa;}})});}_0x2c536=_[_0xf13c('0x45')]({},_0x2c536,_0x2f211a['options']);var _0x15585a={'where':_0x2c536[_0xf13c('0x40')]};return db[_0xf13c('0x31')][_0xf13c('0x46')](_0x15585a)['then'](function(_0x576481){_0xc4ce97['count']=_0x576481;if(_0x2f211a[_0xf13c('0x34')][_0xf13c('0x47')]){_0x2c536[_0xf13c('0x48')]=[{'all':!![]}];}return db[_0xf13c('0x31')][_0xf13c('0x49')](_0x2c536);})[_0xf13c('0x27')](function(_0x412f71){_0xc4ce97[_0xf13c('0x4a')]=_0x412f71;return _0xc4ce97;})['then'](respondWithFilteredResult(_0x49bc5c,_0x2c536))[_0xf13c('0x4b')](handleError(_0x49bc5c,null));};exports[_0xf13c('0x4c')]=function(_0x4c259b,_0x55607d){var _0x407041={'raw':![],'where':{'id':_0x4c259b[_0xf13c('0x4d')]['id']}},_0x5693ba={};_0x5693ba['model']=_[_0xf13c('0x33')](db['SquareProject'][_0xf13c('0x4e')]);_0x5693ba[_0xf13c('0x34')]=_['keys'](_0x4c259b['query']);_0x5693ba['filters']=_[_0xf13c('0x36')](_0x5693ba[_0xf13c('0x37')],_0x5693ba[_0xf13c('0x34')]);_0x407041['attributes']=_['intersection'](_0x5693ba[_0xf13c('0x37')],qs[_0xf13c('0x39')](_0x4c259b[_0xf13c('0x34')][_0xf13c('0x39')]));_0x407041[_0xf13c('0x38')]=_0x407041[_0xf13c('0x38')][_0xf13c('0x3a')]?_0x407041[_0xf13c('0x38')]:_0x5693ba['model'];if(_0x4c259b[_0xf13c('0x34')][_0xf13c('0x47')]){_0x407041[_0xf13c('0x48')]=[{'all':!![]}];}_0x407041=_['merge']({},_0x407041,_0x4c259b[_0xf13c('0x4f')]);return db['SquareProject'][_0xf13c('0x50')](_0x407041)[_0xf13c('0x27')](handleEntityNotFound(_0x55607d,null))[_0xf13c('0x27')](respondWithResult(_0x55607d,null))[_0xf13c('0x4b')](handleError(_0x55607d,null));};exports[_0xf13c('0x51')]=function(_0x13e3d0,_0x5cd231){return db['SquareProject'][_0xf13c('0x51')](_0x13e3d0['body'],{})['then'](function(_0x49e2e3){var _0xe2d2b1=_0x13e3d0[_0xf13c('0x52')][_0xf13c('0x28')]({'plain':!![]});if(!_0xe2d2b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe2d2b1[_0xf13c('0x53')]===_0xf13c('0x52')){var _0xa0751e=_0x49e2e3['get']({'plain':!![]});var _0x4fccbf=_0xf13c('0x29');return db[_0xf13c('0x54')]['find']({'where':{'name':_0x4fccbf,'userProfileId':_0xe2d2b1[_0xf13c('0x55')]},'raw':!![]})[_0xf13c('0x27')](function(_0x1d5190){if(_0x1d5190&&_0x1d5190['autoAssociation']===0x0){return db['UserProfileResource'][_0xf13c('0x51')]({'name':_0xa0751e[_0xf13c('0x2e')],'resourceId':_0xa0751e['id'],'type':_0x1d5190[_0xf13c('0x2e')],'sectionId':_0x1d5190['id']},{})[_0xf13c('0x27')](function(){return _0x49e2e3;});}else{return _0x49e2e3;}})[_0xf13c('0x4b')](function(_0x36d757){logger[_0xf13c('0x2c')](_0xf13c('0x56'),_0x36d757);throw _0x36d757;});}return _0x49e2e3;})[_0xf13c('0x27')](respondWithResult(_0x5cd231,0xc9))['catch'](handleError(_0x5cd231,null));};exports[_0xf13c('0x26')]=function(_0x436bcf,_0x58d48d){if(_0x436bcf[_0xf13c('0x57')]['id']){delete _0x436bcf[_0xf13c('0x57')]['id'];}return db['SquareProject'][_0xf13c('0x50')]({'where':{'id':_0x436bcf[_0xf13c('0x4d')]['id']}})[_0xf13c('0x27')](handleEntityNotFound(_0x58d48d,null))[_0xf13c('0x27')](saveUpdates(_0x436bcf['body'],null))[_0xf13c('0x27')](respondWithResult(_0x58d48d,null))[_0xf13c('0x4b')](handleError(_0x58d48d,null));};exports[_0xf13c('0x2b')]=function(_0x3c3da6,_0x3048d4){return db['SquareProject'][_0xf13c('0x50')]({'where':{'id':_0x3c3da6[_0xf13c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3048d4,null))[_0xf13c('0x27')](removeEntity(_0x3048d4,null))['catch'](handleError(_0x3048d4,null));};exports[_0xf13c('0x58')]=function(_0x4fa74b,_0x30de10,_0x525029){return db['SquareProject'][_0xf13c('0x50')]({'where':{'id':_0x4fa74b[_0xf13c('0x4d')]['id']}})[_0xf13c('0x27')](handleEntityNotFound(_0x30de10,null))[_0xf13c('0x27')](function(_0x16f77){if(_0x16f77){return _0x16f77['addUsers'](_0x4fa74b['body']['ids'],_[_0xf13c('0x59')](_0x4fa74b[_0xf13c('0x57')],[_0xf13c('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x30de10,null))[_0xf13c('0x4b')](handleError(_0x30de10,null));};exports[_0xf13c('0x5b')]=function(_0x4b7db7,_0x2da31d,_0x358c55){return db[_0xf13c('0x31')][_0xf13c('0x50')]({'where':{'id':_0x4b7db7[_0xf13c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2da31d,null))[_0xf13c('0x27')](function(_0x6c530e){if(_0x6c530e){return _0x6c530e[_0xf13c('0x5b')](_0x4b7db7[_0xf13c('0x34')][_0xf13c('0x5a')])[_0xf13c('0x27')](function(){if(_[_0xf13c('0x5c')](_0x4b7db7['query']['ids'])){for(var _0x3033d9=0x0;_0x3033d9<_0x4b7db7['query'][_0xf13c('0x5a')][_0xf13c('0x3a')];_0x3033d9+=0x1){socket[_0xf13c('0x5d')](_0xf13c('0x5e'),{'UserId':Number(_0x4b7db7[_0xf13c('0x34')][_0xf13c('0x5a')][_0x3033d9]),'SquareProjectId':Number(_0x4b7db7[_0xf13c('0x4d')]['id'])});}}else{socket[_0xf13c('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x4b7db7['query'][_0xf13c('0x5a')]),'SquareProjectId':Number(_0x4b7db7['params']['id'])});}});}})[_0xf13c('0x27')](respondWithStatusCode(_0x2da31d,null))['catch'](handleError(_0x2da31d,null));};exports[_0xf13c('0x5f')]=function(_0x212998,_0x3c5dd9,_0x2ff4d7){var _0x279ca3={};var _0x4bd03a={};var _0x2c4e4f;var _0x5c6ac8;return db[_0xf13c('0x31')][_0xf13c('0x60')]({'where':{'id':_0x212998[_0xf13c('0x4d')]['id']}})[_0xf13c('0x27')](handleEntityNotFound(_0x3c5dd9,null))['then'](function(_0x109b25){if(_0x109b25){_0x2c4e4f=_0x109b25;_0x4bd03a[_0xf13c('0x37')]=_[_0xf13c('0x33')](db[_0xf13c('0x61')][_0xf13c('0x4e')]);_0x4bd03a[_0xf13c('0x34')]=_['keys'](_0x212998[_0xf13c('0x34')]);_0x4bd03a[_0xf13c('0x35')]=_[_0xf13c('0x36')](_0x4bd03a['model'],_0x4bd03a[_0xf13c('0x34')]);_0x279ca3[_0xf13c('0x38')]=_[_0xf13c('0x36')](_0x4bd03a['model'],qs[_0xf13c('0x39')](_0x212998[_0xf13c('0x34')]['fields']));_0x279ca3[_0xf13c('0x38')]=_0x279ca3['attributes'][_0xf13c('0x3a')]?_0x279ca3[_0xf13c('0x38')]:_0x4bd03a[_0xf13c('0x37')];_0x279ca3['order']=qs['sort'](_0x212998[_0xf13c('0x34')][_0xf13c('0x3f')]);_0x279ca3[_0xf13c('0x40')]=qs[_0xf13c('0x35')](_['pick'](_0x212998[_0xf13c('0x34')],_0x4bd03a[_0xf13c('0x35')]));if(_0x212998[_0xf13c('0x34')]['filter']){_0x279ca3[_0xf13c('0x40')]=_['merge'](_0x279ca3['where'],{'$or':_[_0xf13c('0x32')](_0x279ca3[_0xf13c('0x38')],function(_0x58a85a){var _0x57fccf={};_0x57fccf[_0x58a85a]={'$like':'%'+_0x212998[_0xf13c('0x34')][_0xf13c('0x42')]+'%'};return _0x57fccf;})});}_0x279ca3=_[_0xf13c('0x45')]({},_0x279ca3,_0x212998[_0xf13c('0x4f')]);return _0x2c4e4f[_0xf13c('0x5f')](_0x279ca3);}})[_0xf13c('0x27')](function(_0x3cc319){if(_0x3cc319){_0x5c6ac8=_0x3cc319[_0xf13c('0x3a')];if(!_0x212998[_0xf13c('0x34')][_0xf13c('0x3b')](_0xf13c('0x3c'))){_0x279ca3['limit']=qs[_0xf13c('0x3d')](_0x212998['query'][_0xf13c('0x3d')]);_0x279ca3[_0xf13c('0x22')]=qs[_0xf13c('0x22')](_0x212998[_0xf13c('0x34')][_0xf13c('0x22')]);}return _0x2c4e4f[_0xf13c('0x5f')](_0x279ca3);}})[_0xf13c('0x27')](function(_0x4d691a){if(_0x4d691a){return _0x4d691a?{'count':_0x5c6ac8,'rows':_0x4d691a}:null;}})[_0xf13c('0x27')](respondWithResult(_0x3c5dd9,null))[_0xf13c('0x4b')](handleError(_0x3c5dd9,null));}; \ No newline at end of file +var _0xb2a2=['destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','SquareProject','findAll','catch','params','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','isArray','userSquareProject:remove','findOne','User','getUsers','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','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','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2a2,0x154));var _0x2b2a=function(_0x34b831,_0x44b82f){_0x34b831=_0x34b831-0x0;var _0x25dedb=_0xb2a2[_0x34b831];return _0x25dedb;};'use strict';var pdf=require(_0x2b2a('0x0'));var emlformat=require(_0x2b2a('0x1'));var rimraf=require(_0x2b2a('0x2'));var zipdir=require(_0x2b2a('0x3'));var jsonpatch=require(_0x2b2a('0x4'));var rp=require('request-promise');var moment=require(_0x2b2a('0x5'));var BPromise=require(_0x2b2a('0x6'));var Mustache=require('mustache');var util=require(_0x2b2a('0x7'));var path=require(_0x2b2a('0x8'));var sox=require('sox');var csv=require(_0x2b2a('0x9'));var ejs=require(_0x2b2a('0xa'));var fs=require('fs');var _=require(_0x2b2a('0xb'));var squel=require(_0x2b2a('0xc'));var crypto=require(_0x2b2a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b2a('0xe'));var toCsv=require(_0x2b2a('0x9'));var querystring=require('querystring');var Papa=require(_0x2b2a('0xf'));var Redis=require('ioredis');var authService=require(_0x2b2a('0x10'));var qs=require(_0x2b2a('0x11'));var as=require(_0x2b2a('0x12'));var hardwareService=require(_0x2b2a('0x13'));var logger=require(_0x2b2a('0x14'))(_0x2b2a('0x15'));var utils=require(_0x2b2a('0x16'));var config=require(_0x2b2a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b2a('0x18'))['db'];config[_0x2b2a('0x19')]=_['defaults'](config[_0x2b2a('0x19')],{'host':_0x2b2a('0x1a'),'port':0x18eb});var socket=require(_0x2b2a('0x1b'))(new Redis(config[_0x2b2a('0x19')]));require(_0x2b2a('0x1c'))[_0x2b2a('0x1d')](socket);function respondWithStatusCode(_0x34e2b1,_0x43076f){_0x43076f=_0x43076f||0xcc;return function(_0x5c27c6){if(_0x5c27c6){return _0x34e2b1[_0x2b2a('0x1e')](_0x43076f);}return _0x34e2b1['status'](_0x43076f)[_0x2b2a('0x1f')]();};}function respondWithResult(_0x35cc9d,_0x1e15ba){_0x1e15ba=_0x1e15ba||0xc8;return function(_0x18d002){if(_0x18d002){return _0x35cc9d['status'](_0x1e15ba)[_0x2b2a('0x20')](_0x18d002);}};}function respondWithFilteredResult(_0x14d16e,_0x1a7284){return function(_0xe6b131){if(_0xe6b131){var _0x4fb5f7=_0xe6b131[_0x2b2a('0x21')],_0x56e053=_0x1a7284[_0x2b2a('0x22')],_0x1c4f30=_0x1a7284[_0x2b2a('0x22')]+_0x1a7284[_0x2b2a('0x23')],_0x1fba56;if(_0x1c4f30>=_0x4fb5f7){_0x1c4f30=_0x4fb5f7;_0x1fba56=0xc8;}else{_0x1fba56=0xce;}_0x14d16e[_0x2b2a('0x24')](_0x1fba56);return _0x14d16e[_0x2b2a('0x25')](_0x2b2a('0x26'),_0x56e053+'-'+_0x1c4f30+'/'+_0x4fb5f7)[_0x2b2a('0x20')](_0xe6b131);}return null;};}function patchUpdates(_0x4cf1cb){return function(_0x491c35){try{jsonpatch[_0x2b2a('0x27')](_0x491c35,_0x4cf1cb,!![]);}catch(_0xce6918){return BPromise[_0x2b2a('0x28')](_0xce6918);}return _0x491c35[_0x2b2a('0x29')]();};}function saveUpdates(_0x115fcb,_0xa5d41a){return function(_0x5b9dff){if(_0x5b9dff){return _0x5b9dff[_0x2b2a('0x2a')](_0x115fcb)[_0x2b2a('0x2b')](function(_0x2191a0){return _0x2191a0;});}return null;};}function removeEntity(_0x2421a7,_0x111dbd){return function(_0x1667d5){if(_0x1667d5){return _0x1667d5[_0x2b2a('0x2c')]()[_0x2b2a('0x2b')](function(){var _0x11486e=_0x1667d5[_0x2b2a('0x2d')]({'plain':!![]});var _0x3e597c=_0x2b2a('0x2e');return db[_0x2b2a('0x2f')][_0x2b2a('0x2c')]({'where':{'type':_0x3e597c,'resourceId':_0x11486e['id']}})[_0x2b2a('0x2b')](function(){return _0x1667d5;});})[_0x2b2a('0x2b')](function(){_0x2421a7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x410d32,_0x2b8253){return function(_0x68c5cf){if(!_0x68c5cf){_0x410d32[_0x2b2a('0x1e')](0x194);}return _0x68c5cf;};}function handleError(_0x480555,_0x303de5){_0x303de5=_0x303de5||0x1f4;return function(_0x1714b8){logger[_0x2b2a('0x30')](_0x1714b8[_0x2b2a('0x31')]);if(_0x1714b8[_0x2b2a('0x32')]){delete _0x1714b8[_0x2b2a('0x32')];}_0x480555[_0x2b2a('0x24')](_0x303de5)[_0x2b2a('0x33')](_0x1714b8);};}exports['index']=function(_0x388712,_0x1067e9){var _0x18433e={},_0x2e3ea7={},_0x947d04={'count':0x0,'rows':[]};var _0x2c05f9=_[_0x2b2a('0x34')](db['SquareProject']['rawAttributes'],function(_0xc414e2){return{'name':_0xc414e2[_0x2b2a('0x35')],'type':_0xc414e2[_0x2b2a('0x36')][_0x2b2a('0x37')]};});_0x2e3ea7['model']=_[_0x2b2a('0x34')](_0x2c05f9,_0x2b2a('0x32'));_0x2e3ea7[_0x2b2a('0x38')]=_[_0x2b2a('0x39')](_0x388712[_0x2b2a('0x38')]);_0x2e3ea7[_0x2b2a('0x3a')]=_[_0x2b2a('0x3b')](_0x2e3ea7[_0x2b2a('0x3c')],_0x2e3ea7['query']);_0x18433e[_0x2b2a('0x3d')]=_[_0x2b2a('0x3b')](_0x2e3ea7[_0x2b2a('0x3c')],qs[_0x2b2a('0x3e')](_0x388712[_0x2b2a('0x38')][_0x2b2a('0x3e')]));_0x18433e['attributes']=_0x18433e[_0x2b2a('0x3d')][_0x2b2a('0x3f')]?_0x18433e[_0x2b2a('0x3d')]:_0x2e3ea7[_0x2b2a('0x3c')];if(!_0x388712[_0x2b2a('0x38')]['hasOwnProperty']('nolimit')){_0x18433e['limit']=qs[_0x2b2a('0x23')](_0x388712['query'][_0x2b2a('0x23')]);_0x18433e[_0x2b2a('0x22')]=qs[_0x2b2a('0x22')](_0x388712[_0x2b2a('0x38')][_0x2b2a('0x22')]);}_0x18433e[_0x2b2a('0x40')]=qs[_0x2b2a('0x41')](_0x388712[_0x2b2a('0x38')]['sort']);_0x18433e[_0x2b2a('0x42')]=qs[_0x2b2a('0x3a')](_[_0x2b2a('0x43')](_0x388712[_0x2b2a('0x38')],_0x2e3ea7[_0x2b2a('0x3a')]),_0x2c05f9);if(_0x388712['query'][_0x2b2a('0x44')]){_0x18433e['where']=_[_0x2b2a('0x45')](_0x18433e[_0x2b2a('0x42')],{'$or':_[_0x2b2a('0x34')](_0x2c05f9,function(_0x21dcb5){if(_0x21dcb5[_0x2b2a('0x36')]!==_0x2b2a('0x46')){var _0x5458e7={};_0x5458e7[_0x21dcb5[_0x2b2a('0x32')]]={'$like':'%'+_0x388712[_0x2b2a('0x38')][_0x2b2a('0x44')]+'%'};return _0x5458e7;}})});}_0x18433e=_[_0x2b2a('0x45')]({},_0x18433e,_0x388712[_0x2b2a('0x47')]);var _0x376b19={'where':_0x18433e[_0x2b2a('0x42')]};return db['SquareProject']['count'](_0x376b19)['then'](function(_0x5f09f3){_0x947d04[_0x2b2a('0x21')]=_0x5f09f3;if(_0x388712[_0x2b2a('0x38')][_0x2b2a('0x48')]){_0x18433e['include']=[{'all':!![]}];}return db[_0x2b2a('0x49')][_0x2b2a('0x4a')](_0x18433e);})['then'](function(_0xb0ea8){_0x947d04['rows']=_0xb0ea8;return _0x947d04;})[_0x2b2a('0x2b')](respondWithFilteredResult(_0x1067e9,_0x18433e))[_0x2b2a('0x4b')](handleError(_0x1067e9,null));};exports['show']=function(_0x2fe5d4,_0x174d39){var _0x4f7331={'raw':![],'where':{'id':_0x2fe5d4[_0x2b2a('0x4c')]['id']}},_0x5cab08={};_0x5cab08[_0x2b2a('0x3c')]=_[_0x2b2a('0x39')](db[_0x2b2a('0x49')][_0x2b2a('0x4d')]);_0x5cab08['query']=_[_0x2b2a('0x39')](_0x2fe5d4[_0x2b2a('0x38')]);_0x5cab08[_0x2b2a('0x3a')]=_['intersection'](_0x5cab08[_0x2b2a('0x3c')],_0x5cab08['query']);_0x4f7331[_0x2b2a('0x3d')]=_[_0x2b2a('0x3b')](_0x5cab08[_0x2b2a('0x3c')],qs[_0x2b2a('0x3e')](_0x2fe5d4[_0x2b2a('0x38')]['fields']));_0x4f7331[_0x2b2a('0x3d')]=_0x4f7331['attributes']['length']?_0x4f7331[_0x2b2a('0x3d')]:_0x5cab08[_0x2b2a('0x3c')];if(_0x2fe5d4[_0x2b2a('0x38')][_0x2b2a('0x48')]){_0x4f7331[_0x2b2a('0x4e')]=[{'all':!![]}];}_0x4f7331=_['merge']({},_0x4f7331,_0x2fe5d4[_0x2b2a('0x47')]);return db['SquareProject']['find'](_0x4f7331)[_0x2b2a('0x2b')](handleEntityNotFound(_0x174d39,null))[_0x2b2a('0x2b')](respondWithResult(_0x174d39,null))['catch'](handleError(_0x174d39,null));};exports[_0x2b2a('0x4f')]=function(_0x340a08,_0x57f513){return db['SquareProject'][_0x2b2a('0x4f')](_0x340a08[_0x2b2a('0x50')],{})[_0x2b2a('0x2b')](function(_0x2e2acd){var _0x3a1855=_0x340a08['user'][_0x2b2a('0x2d')]({'plain':!![]});if(!_0x3a1855)throw new Error(_0x2b2a('0x51'));if(_0x3a1855[_0x2b2a('0x52')]==='user'){var _0x5cc63e=_0x2e2acd[_0x2b2a('0x2d')]({'plain':!![]});var _0x1b07dc=_0x2b2a('0x2e');return db[_0x2b2a('0x53')][_0x2b2a('0x54')]({'where':{'name':_0x1b07dc,'userProfileId':_0x3a1855[_0x2b2a('0x55')]},'raw':!![]})[_0x2b2a('0x2b')](function(_0x34a641){if(_0x34a641&&_0x34a641['autoAssociation']===0x0){return db[_0x2b2a('0x2f')][_0x2b2a('0x4f')]({'name':_0x5cc63e[_0x2b2a('0x32')],'resourceId':_0x5cc63e['id'],'type':_0x34a641['name'],'sectionId':_0x34a641['id']},{})[_0x2b2a('0x2b')](function(){return _0x2e2acd;});}else{return _0x2e2acd;}})[_0x2b2a('0x4b')](function(_0x2042da){logger[_0x2b2a('0x30')](_0x2b2a('0x56'),_0x2042da);throw _0x2042da;});}return _0x2e2acd;})[_0x2b2a('0x2b')](respondWithResult(_0x57f513,0xc9))[_0x2b2a('0x4b')](handleError(_0x57f513,null));};exports[_0x2b2a('0x2a')]=function(_0x2c4e3f,_0x5d7ec3){if(_0x2c4e3f[_0x2b2a('0x50')]['id']){delete _0x2c4e3f[_0x2b2a('0x50')]['id'];}return db[_0x2b2a('0x49')][_0x2b2a('0x54')]({'where':{'id':_0x2c4e3f['params']['id']}})[_0x2b2a('0x2b')](handleEntityNotFound(_0x5d7ec3,null))[_0x2b2a('0x2b')](saveUpdates(_0x2c4e3f[_0x2b2a('0x50')],null))['then'](respondWithResult(_0x5d7ec3,null))['catch'](handleError(_0x5d7ec3,null));};exports[_0x2b2a('0x2c')]=function(_0x543156,_0x124424){return db[_0x2b2a('0x49')][_0x2b2a('0x54')]({'where':{'id':_0x543156[_0x2b2a('0x4c')]['id']}})[_0x2b2a('0x2b')](handleEntityNotFound(_0x124424,null))[_0x2b2a('0x2b')](removeEntity(_0x124424,null))[_0x2b2a('0x4b')](handleError(_0x124424,null));};exports[_0x2b2a('0x57')]=function(_0x57d3cf,_0x2abada,_0x29cd18){return db[_0x2b2a('0x49')]['find']({'where':{'id':_0x57d3cf[_0x2b2a('0x4c')]['id']}})[_0x2b2a('0x2b')](handleEntityNotFound(_0x2abada,null))['then'](function(_0x556712){if(_0x556712){return _0x556712[_0x2b2a('0x57')](_0x57d3cf['body'][_0x2b2a('0x58')],_['omit'](_0x57d3cf[_0x2b2a('0x50')],[_0x2b2a('0x58'),'id'])||{});}})['then'](respondWithResult(_0x2abada,null))[_0x2b2a('0x4b')](handleError(_0x2abada,null));};exports['removeUsers']=function(_0x45f63d,_0x175d53,_0xfc61c2){return db[_0x2b2a('0x49')][_0x2b2a('0x54')]({'where':{'id':_0x45f63d[_0x2b2a('0x4c')]['id']}})[_0x2b2a('0x2b')](handleEntityNotFound(_0x175d53,null))[_0x2b2a('0x2b')](function(_0x47554e){if(_0x47554e){return _0x47554e['removeUsers'](_0x45f63d[_0x2b2a('0x38')][_0x2b2a('0x58')])['then'](function(){if(_[_0x2b2a('0x59')](_0x45f63d[_0x2b2a('0x38')][_0x2b2a('0x58')])){for(var _0x95b08d=0x0;_0x95b08d<_0x45f63d[_0x2b2a('0x38')][_0x2b2a('0x58')][_0x2b2a('0x3f')];_0x95b08d+=0x1){socket['emit'](_0x2b2a('0x5a'),{'UserId':Number(_0x45f63d[_0x2b2a('0x38')]['ids'][_0x95b08d]),'SquareProjectId':Number(_0x45f63d['params']['id'])});}}else{socket['emit'](_0x2b2a('0x5a'),{'UserId':Number(_0x45f63d['query']['ids']),'SquareProjectId':Number(_0x45f63d[_0x2b2a('0x4c')]['id'])});}});}})[_0x2b2a('0x2b')](respondWithStatusCode(_0x175d53,null))['catch'](handleError(_0x175d53,null));};exports['getUsers']=function(_0x56b828,_0xa87ebf,_0x8ec8b3){var _0x285c8d={};var _0x4aec87={};var _0x217913;var _0x53c96e;return db[_0x2b2a('0x49')][_0x2b2a('0x5b')]({'where':{'id':_0x56b828[_0x2b2a('0x4c')]['id']}})[_0x2b2a('0x2b')](handleEntityNotFound(_0xa87ebf,null))[_0x2b2a('0x2b')](function(_0x18baa5){if(_0x18baa5){_0x217913=_0x18baa5;_0x4aec87[_0x2b2a('0x3c')]=_[_0x2b2a('0x39')](db[_0x2b2a('0x5c')][_0x2b2a('0x4d')]);_0x4aec87[_0x2b2a('0x38')]=_[_0x2b2a('0x39')](_0x56b828['query']);_0x4aec87[_0x2b2a('0x3a')]=_['intersection'](_0x4aec87['model'],_0x4aec87[_0x2b2a('0x38')]);_0x285c8d[_0x2b2a('0x3d')]=_[_0x2b2a('0x3b')](_0x4aec87['model'],qs[_0x2b2a('0x3e')](_0x56b828[_0x2b2a('0x38')][_0x2b2a('0x3e')]));_0x285c8d[_0x2b2a('0x3d')]=_0x285c8d[_0x2b2a('0x3d')][_0x2b2a('0x3f')]?_0x285c8d[_0x2b2a('0x3d')]:_0x4aec87[_0x2b2a('0x3c')];_0x285c8d[_0x2b2a('0x40')]=qs[_0x2b2a('0x41')](_0x56b828[_0x2b2a('0x38')]['sort']);_0x285c8d[_0x2b2a('0x42')]=qs[_0x2b2a('0x3a')](_[_0x2b2a('0x43')](_0x56b828['query'],_0x4aec87[_0x2b2a('0x3a')]));if(_0x56b828[_0x2b2a('0x38')][_0x2b2a('0x44')]){_0x285c8d['where']=_['merge'](_0x285c8d[_0x2b2a('0x42')],{'$or':_[_0x2b2a('0x34')](_0x285c8d[_0x2b2a('0x3d')],function(_0x48dbbf){var _0x523290={};_0x523290[_0x48dbbf]={'$like':'%'+_0x56b828[_0x2b2a('0x38')]['filter']+'%'};return _0x523290;})});}_0x285c8d=_[_0x2b2a('0x45')]({},_0x285c8d,_0x56b828[_0x2b2a('0x47')]);return _0x217913[_0x2b2a('0x5d')](_0x285c8d);}})[_0x2b2a('0x2b')](function(_0x135f60){if(_0x135f60){_0x53c96e=_0x135f60[_0x2b2a('0x3f')];if(!_0x56b828[_0x2b2a('0x38')][_0x2b2a('0x5e')](_0x2b2a('0x5f'))){_0x285c8d[_0x2b2a('0x23')]=qs['limit'](_0x56b828[_0x2b2a('0x38')][_0x2b2a('0x23')]);_0x285c8d[_0x2b2a('0x22')]=qs[_0x2b2a('0x22')](_0x56b828[_0x2b2a('0x38')][_0x2b2a('0x22')]);}return _0x217913[_0x2b2a('0x5d')](_0x285c8d);}})[_0x2b2a('0x2b')](function(_0xd3a370){if(_0xd3a370){return _0xd3a370?{'count':_0x53c96e,'rows':_0xd3a370}:null;}})[_0x2b2a('0x2b')](respondWithResult(_0xa87ebf,null))[_0x2b2a('0x4b')](handleError(_0xa87ebf,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 63da77f..dcef57f 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 _0x4a06=['SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0x4a06,0x1f2));var _0x64a0=function(_0x3ea4af,_0x1b85c0){_0x3ea4af=_0x3ea4af-0x0;var _0x42dea7=_0x4a06[_0x3ea4af];return _0x42dea7;};'use strict';var EventEmitter=require(_0x64a0('0x0'));var SquareProject=require(_0x64a0('0x1'))['db'][_0x64a0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x64a0('0x3')](0x0);var events={'afterCreate':_0x64a0('0x4'),'afterUpdate':_0x64a0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41bff8){return function(_0x38bbc4,_0x1b8494,_0x391dc0){SquareProjectEvents[_0x64a0('0x6')](_0x41bff8+':'+_0x38bbc4['id'],_0x38bbc4);SquareProjectEvents[_0x64a0('0x6')](_0x41bff8,_0x38bbc4);_0x391dc0(null);};}for(var e in events){if(events[_0x64a0('0x7')](e)){var event=events[e];SquareProject[_0x64a0('0x8')](e,emitEvent(event));}}module[_0x64a0('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x7610=['emit','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','remove'];(function(_0x549e70,_0x8a5460){var _0x9a9d8c=function(_0x3408c5){while(--_0x3408c5){_0x549e70['push'](_0x549e70['shift']());}};_0x9a9d8c(++_0x8a5460);}(_0x7610,0x123));var _0x0761=function(_0x310fd6,_0x1c93df){_0x310fd6=_0x310fd6-0x0;var _0xca2ad3=_0x7610[_0x310fd6];return _0xca2ad3;};'use strict';var EventEmitter=require(_0x0761('0x0'));var SquareProject=require(_0x0761('0x1'))['db'][_0x0761('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0761('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0761('0x4')};function emitEvent(_0x3b3bb9){return function(_0x4f1eb6,_0x1a2b34,_0x21f61a){SquareProjectEvents['emit'](_0x3b3bb9+':'+_0x4f1eb6['id'],_0x4f1eb6);SquareProjectEvents[_0x0761('0x5')](_0x3b3bb9,_0x4f1eb6);_0x21f61a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0761('0x6')](e,emitEvent(event));}}module[_0x0761('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0cc85ae..a6a30b1 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 _0x5395=['SquareProject','square_projects','changed','preproduction','production','format','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x5395,0x150));var _0x5539=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5395[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5539('0x0'));var util=require('util');var logger=require(_0x5539('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5539('0x2'));var rp=require(_0x5539('0x3'));var fs=require('fs');var path=require(_0x5539('0x4'));var rimraf=require('rimraf');var config=require(_0x5539('0x5'));var attributes=require(_0x5539('0x6'));module[_0x5539('0x7')]=function(_0x751919,_0x99948d){return _0x751919[_0x5539('0x8')](_0x5539('0x9'),attributes,{'tableName':_0x5539('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56b645,_0x37fb7d,_0x32af1c){if(_0x56b645[_0x5539('0xb')](_0x5539('0xc'))){_0x56b645['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x56b645['changed'](_0x5539('0xd'))){_0x56b645['publishedAt']=moment()[_0x5539('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x32af1c(null,_0x56b645);}}});}; \ No newline at end of file +var _0x38df=['publishedAt','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x38df,0x144));var _0xf38d=function(_0x301583,_0x48e684){_0x301583=_0x301583-0x0;var _0x43add0=_0x38df[_0x301583];return _0x43add0;};'use strict';var _=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var logger=require(_0xf38d('0x2'))(_0xf38d('0x3'));var moment=require(_0xf38d('0x4'));var BPromise=require(_0xf38d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf38d('0x6'));var config=require(_0xf38d('0x7'));var attributes=require(_0xf38d('0x8'));module['exports']=function(_0x42c0bc,_0x3b7646){return _0x42c0bc[_0xf38d('0x9')](_0xf38d('0xa'),attributes,{'tableName':_0xf38d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51e028,_0x1fcc16,_0xc750e6){if(_0x51e028[_0xf38d('0xc')](_0xf38d('0xd'))){_0x51e028[_0xf38d('0xe')]=moment()[_0xf38d('0xf')](_0xf38d('0x10'));}if(_0x51e028['changed'](_0xf38d('0x11'))){_0x51e028[_0xf38d('0x12')]=moment()[_0xf38d('0xf')](_0xf38d('0x10'));}_0xc750e6(null,_0x51e028);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 243487d..f85e907 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 _0x4d88=['catch','SquareProject','find','options','where','attributes','include','model','map','ShowSquareProject','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','error','code','SquareProject,\x20%s,\x20%s','message'];(function(_0x4f97fb,_0x431724){var _0x310ab8=function(_0x512489){while(--_0x512489){_0x4f97fb['push'](_0x4f97fb['shift']());}};_0x310ab8(++_0x431724);}(_0x4d88,0x97));var _0x84d8=function(_0x5ac30d,_0x4eb709){_0x5ac30d=_0x5ac30d-0x0;var _0x49a9c0=_0x4d88[_0x5ac30d];return _0x49a9c0;};'use strict';var _=require('lodash');var util=require(_0x84d8('0x0'));var moment=require('moment');var BPromise=require(_0x84d8('0x1'));var rs=require(_0x84d8('0x2'));var fs=require('fs');var Redis=require(_0x84d8('0x3'));var db=require(_0x84d8('0x4'))['db'];var utils=require(_0x84d8('0x5'));var logger=require(_0x84d8('0x6'))('rpc');var config=require(_0x84d8('0x7'));var jayson=require(_0x84d8('0x8'));var client=jayson[_0x84d8('0x9')][_0x84d8('0xa')]({'port':0x232a});config[_0x84d8('0xb')]=_[_0x84d8('0xc')](config[_0x84d8('0xb')],{'host':_0x84d8('0xd'),'port':0x18eb});var socket=require(_0x84d8('0xe'))(new Redis(config[_0x84d8('0xb')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0xe01119,_0xf80df6,_0x1e2503){return new BPromise(function(_0x496920,_0xf9b53){return client[_0x84d8('0xf')](_0xe01119,_0x1e2503)[_0x84d8('0x10')](function(_0xcf9bf3){logger[_0x84d8('0x11')]('SquareProject,\x20%s,\x20%s',_0xf80df6,_0x84d8('0x12'));logger[_0x84d8('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0xf80df6,_0x84d8('0x12'),JSON['stringify'](_0xcf9bf3));if(_0xcf9bf3[_0x84d8('0x14')]){if(_0xcf9bf3[_0x84d8('0x14')][_0x84d8('0x15')]===0x1f4){logger[_0x84d8('0x14')](_0x84d8('0x16'),_0xf80df6,_0xcf9bf3['error']['message']);return _0xf9b53(_0xcf9bf3[_0x84d8('0x14')][_0x84d8('0x17')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0xf80df6,_0xcf9bf3[_0x84d8('0x14')]['message']);return _0x496920(_0xcf9bf3[_0x84d8('0x14')][_0x84d8('0x17')]);}else{logger['info'](_0x84d8('0x16'),_0xf80df6,_0x84d8('0x12'));_0x496920(_0xcf9bf3['result'][_0x84d8('0x17')]);}})[_0x84d8('0x18')](function(_0x581af9){logger[_0x84d8('0x14')](_0x84d8('0x16'),_0xf80df6,_0x581af9);_0xf9b53(_0x581af9);});});}exports['ShowSquareProject']=function(_0x5d3111){var _0x34e14e=this;return new Promise(function(_0x278907,_0x37f142){return db[_0x84d8('0x19')][_0x84d8('0x1a')]({'raw':_0x5d3111[_0x84d8('0x1b')]?_0x5d3111[_0x84d8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5d3111[_0x84d8('0x1b')]?_0x5d3111[_0x84d8('0x1b')][_0x84d8('0x1c')]||null:null,'attributes':_0x5d3111[_0x84d8('0x1b')]?_0x5d3111[_0x84d8('0x1b')][_0x84d8('0x1d')]||null:null,'include':_0x5d3111[_0x84d8('0x1b')]?_0x5d3111[_0x84d8('0x1b')][_0x84d8('0x1e')]?_['map'](_0x5d3111[_0x84d8('0x1b')][_0x84d8('0x1e')],function(_0xb54f27){return{'model':db[_0xb54f27[_0x84d8('0x1f')]],'as':_0xb54f27['as'],'attributes':_0xb54f27[_0x84d8('0x1d')],'include':_0xb54f27[_0x84d8('0x1e')]?_[_0x84d8('0x20')](_0xb54f27[_0x84d8('0x1e')],function(_0x2c3725){return{'model':db[_0x2c3725['model']],'as':_0x2c3725['as'],'attributes':_0x2c3725[_0x84d8('0x1d')],'include':_0x2c3725[_0x84d8('0x1e')]?_[_0x84d8('0x20')](_0x2c3725[_0x84d8('0x1e')],function(_0x35ea25){return{'model':db[_0x35ea25[_0x84d8('0x1f')]],'as':_0x35ea25['as'],'attributes':_0x35ea25[_0x84d8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x84d8('0x10')](function(_0x3dc71e){logger[_0x84d8('0x11')](_0x84d8('0x21'),_0x5d3111);logger[_0x84d8('0x13')](_0x84d8('0x21'),_0x5d3111,JSON[_0x84d8('0x22')](_0x3dc71e));_0x278907(_0x3dc71e);})[_0x84d8('0x18')](function(_0x44867c){logger['error']('ShowSquareProject',_0x44867c[_0x84d8('0x17')],_0x5d3111);_0x37f142(_0x34e14e[_0x84d8('0x14')](0x1f4,_0x44867c[_0x84d8('0x17')]));});});}; \ No newline at end of file +var _0x4a02=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','attributes','include','map','model','then','ShowSquareProject','debug','lodash'];(function(_0x15ad95,_0x566009){var _0x439717=function(_0x5b73a1){while(--_0x5b73a1){_0x15ad95['push'](_0x15ad95['shift']());}};_0x439717(++_0x566009);}(_0x4a02,0xf4));var _0x24a0=function(_0x46c38b,_0x2e50ec){_0x46c38b=_0x46c38b-0x0;var _0x341652=_0x4a02[_0x46c38b];return _0x341652;};'use strict';var _=require(_0x24a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x24a0('0x1'));var rs=require(_0x24a0('0x2'));var fs=require('fs');var Redis=require(_0x24a0('0x3'));var db=require(_0x24a0('0x4'))['db'];var utils=require(_0x24a0('0x5'));var logger=require(_0x24a0('0x6'))(_0x24a0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24a0('0x8')][_0x24a0('0x9')]({'port':0x232a});config['redis']=_[_0x24a0('0xa')](config[_0x24a0('0xb')],{'host':_0x24a0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24a0('0xb')]));require(_0x24a0('0xd'))[_0x24a0('0xe')](socket);function respondWithRpcPromise(_0x1c0f8,_0xc5ccc9,_0x1e2cb9){return new BPromise(function(_0x268af5,_0x8cdd6a){return client['request'](_0x1c0f8,_0x1e2cb9)['then'](function(_0xcef7a0){logger[_0x24a0('0xf')](_0x24a0('0x10'),_0xc5ccc9,_0x24a0('0x11'));logger['debug'](_0x24a0('0x12'),_0xc5ccc9,_0x24a0('0x11'),JSON[_0x24a0('0x13')](_0xcef7a0));if(_0xcef7a0[_0x24a0('0x14')]){if(_0xcef7a0[_0x24a0('0x14')][_0x24a0('0x15')]===0x1f4){logger[_0x24a0('0x14')](_0x24a0('0x10'),_0xc5ccc9,_0xcef7a0[_0x24a0('0x14')]['message']);return _0x8cdd6a(_0xcef7a0['error']['message']);}logger[_0x24a0('0x14')](_0x24a0('0x10'),_0xc5ccc9,_0xcef7a0['error'][_0x24a0('0x16')]);return _0x268af5(_0xcef7a0[_0x24a0('0x14')][_0x24a0('0x16')]);}else{logger['info'](_0x24a0('0x10'),_0xc5ccc9,_0x24a0('0x11'));_0x268af5(_0xcef7a0[_0x24a0('0x17')][_0x24a0('0x16')]);}})[_0x24a0('0x18')](function(_0x4f9f85){logger[_0x24a0('0x14')]('SquareProject,\x20%s,\x20%s',_0xc5ccc9,_0x4f9f85);_0x8cdd6a(_0x4f9f85);});});}exports['ShowSquareProject']=function(_0x54de29){var _0xf2bd6e=this;return new Promise(function(_0x510ac9,_0x42bbc6){return db['SquareProject'][_0x24a0('0x19')]({'raw':_0x54de29[_0x24a0('0x1a')]?_0x54de29['options'][_0x24a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x54de29['options']?_0x54de29[_0x24a0('0x1a')]['where']||null:null,'attributes':_0x54de29['options']?_0x54de29[_0x24a0('0x1a')][_0x24a0('0x1c')]||null:null,'include':_0x54de29[_0x24a0('0x1a')]?_0x54de29[_0x24a0('0x1a')][_0x24a0('0x1d')]?_[_0x24a0('0x1e')](_0x54de29[_0x24a0('0x1a')][_0x24a0('0x1d')],function(_0x1dc4de){return{'model':db[_0x1dc4de[_0x24a0('0x1f')]],'as':_0x1dc4de['as'],'attributes':_0x1dc4de[_0x24a0('0x1c')],'include':_0x1dc4de[_0x24a0('0x1d')]?_[_0x24a0('0x1e')](_0x1dc4de[_0x24a0('0x1d')],function(_0x1d416d){return{'model':db[_0x1d416d[_0x24a0('0x1f')]],'as':_0x1d416d['as'],'attributes':_0x1d416d[_0x24a0('0x1c')],'include':_0x1d416d[_0x24a0('0x1d')]?_[_0x24a0('0x1e')](_0x1d416d[_0x24a0('0x1d')],function(_0x5babd9){return{'model':db[_0x5babd9['model']],'as':_0x5babd9['as'],'attributes':_0x5babd9[_0x24a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x24a0('0x20')](function(_0x3cc61b){logger['info'](_0x24a0('0x21'),_0x54de29);logger[_0x24a0('0x22')](_0x24a0('0x21'),_0x54de29,JSON['stringify'](_0x3cc61b));_0x510ac9(_0x3cc61b);})['catch'](function(_0x2a7eea){logger[_0x24a0('0x14')](_0x24a0('0x21'),_0x2a7eea[_0x24a0('0x16')],_0x54de29);_0x42bbc6(_0xf2bd6e[_0x24a0('0x14')](0x1f4,_0x2a7eea[_0x24a0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4474ae8..3d28aaa 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 _0x326f=['update','emit','removeListener','register','length','./squareProject.events'];(function(_0x1e6b06,_0x3261c6){var _0x5aed5b=function(_0x598957){while(--_0x598957){_0x1e6b06['push'](_0x1e6b06['shift']());}};_0x5aed5b(++_0x3261c6);}(_0x326f,0xd1));var _0xf326=function(_0x29e3f2,_0x5ddf17){_0x29e3f2=_0x29e3f2-0x0;var _0x586cfa=_0x326f[_0x29e3f2];return _0x586cfa;};'use strict';var SquareProjectEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){SquareProjectEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('squareProject:'+_0x165f95,_0x3ace29);SquareProjectEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x2542=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5d7126,_0x7a842d){var _0x33a75f=function(_0x10c184){while(--_0x10c184){_0x5d7126['push'](_0x5d7126['shift']());}};_0x33a75f(++_0x7a842d);}(_0x2542,0x169));var _0x2254=function(_0x361053,_0xc1e69e){_0x361053=_0x361053-0x0;var _0x38d64b=_0x2542[_0x361053];return _0x38d64b;};'use strict';var SquareProjectEvents=require(_0x2254('0x0'));var events=[_0x2254('0x1'),_0x2254('0x2'),_0x2254('0x3')];function createListener(_0x578407,_0x105910){return function(_0x47b1da){_0x105910[_0x2254('0x4')](_0x578407,_0x47b1da);};}function removeListener(_0x3b3dcb,_0x27f5c9){return function(){SquareProjectEvents[_0x2254('0x5')](_0x3b3dcb,_0x27f5c9);};}exports[_0x2254('0x6')]=function(_0x508183){for(var _0x19ad3c=0x0,_0xe8ca50=events[_0x2254('0x7')];_0x19ad3c<_0xe8ca50;_0x19ad3c++){var _0x3c45ec=events[_0x19ad3c];var _0x1637ad=createListener(_0x2254('0x8')+_0x3c45ec,_0x508183);SquareProjectEvents['on'](_0x3c45ec,_0x1637ad);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 0ef17ed..e5f411c 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 _0x79b0=['index','get','show','/:id/download','download','create','update','delete','/:id/delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79b0,0x123));var _0x079b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x79b0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x079b('0x0'));var path=require(_0x079b('0x1'));var timeout=require('connect-timeout');var express=require(_0x079b('0x2'));var router=express[_0x079b('0x3')]();var auth=require(_0x079b('0x4'));var interaction=require(_0x079b('0x5'));var config=require(_0x079b('0x6'));var controller=require(_0x079b('0x7'));router['get']('/',auth[_0x079b('0x8')](),controller[_0x079b('0x9')]);router[_0x079b('0xa')]('/:id',auth[_0x079b('0x8')](),controller[_0x079b('0xb')]);router[_0x079b('0xa')](_0x079b('0xc'),auth[_0x079b('0x8')](),controller[_0x079b('0xd')]);router['post']('/',auth[_0x079b('0x8')](),controller[_0x079b('0xe')]);router['put']('/:id',auth[_0x079b('0x8')](),controller[_0x079b('0xf')]);router[_0x079b('0x10')](_0x079b('0x11'),auth[_0x079b('0x8')](),controller[_0x079b('0x12')]);module[_0x079b('0x13')]=router; \ No newline at end of file +var _0x444c=['put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','download','post','create'];(function(_0x514c58,_0x3ec414){var _0x1903ef=function(_0x53108f){while(--_0x53108f){_0x514c58['push'](_0x514c58['shift']());}};_0x1903ef(++_0x3ec414);}(_0x444c,0xca));var _0xc444=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x444c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc444('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc444('0x1'));var express=require('express');var router=express[_0xc444('0x2')]();var auth=require(_0xc444('0x3'));var interaction=require(_0xc444('0x4'));var config=require(_0xc444('0x5'));var controller=require('./squareRecording.controller');router[_0xc444('0x6')]('/',auth['isAuthenticated'](),controller[_0xc444('0x7')]);router['get'](_0xc444('0x8'),auth[_0xc444('0x9')](),controller[_0xc444('0xa')]);router['get']('/:id/download',auth[_0xc444('0x9')](),controller[_0xc444('0xb')]);router[_0xc444('0xc')]('/',auth[_0xc444('0x9')](),controller[_0xc444('0xd')]);router[_0xc444('0xe')](_0xc444('0x8'),auth[_0xc444('0x9')](),controller[_0xc444('0xf')]);router[_0xc444('0x10')]('/:id/delete',auth['isAuthenticated'](),controller['destroy']);module[_0xc444('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6942e5e..3fd7ec8 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 _0x6175=['STRING','VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize'];(function(_0x26f0eb,_0x5ead8b){var _0x2827b4=function(_0x47b696){while(--_0x47b696){_0x26f0eb['push'](_0x26f0eb['shift']());}};_0x2827b4(++_0x5ead8b);}(_0x6175,0xd7));var _0x5617=function(_0x53dfba,_0x325390){_0x53dfba=_0x53dfba-0x0;var _0x5dc92c=_0x6175[_0x53dfba];return _0x5dc92c;};'use strict';var Sequelize=require(_0x5617('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5617('0x1')]},'callerid':{'type':Sequelize[_0x5617('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5617('0x1')]},'extension':{'type':Sequelize[_0x5617('0x1')]},'priority':{'type':Sequelize[_0x5617('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5617('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x5617('0x1')]},'savePath':{'type':Sequelize[_0x5617('0x1')]},'format':{'type':Sequelize[_0x5617('0x2')],'get':function(){var _0x19f5ad='';var _0x511402=this[_0x5617('0x3')](_0x5617('0x4'));if(_0x511402){_0x19f5ad=_0x511402['substring'](_0x511402[_0x5617('0x5')]('.'));}return _0x19f5ad;}}}; \ No newline at end of file +var _0x6659=['STRING','VIRTUAL','getDataValue','savePath','exports'];(function(_0x75267d,_0x5d286c){var _0x21ccec=function(_0x1a3c1f){while(--_0x1a3c1f){_0x75267d['push'](_0x75267d['shift']());}};_0x21ccec(++_0x5d286c);}(_0x6659,0xbd));var _0x9665=function(_0x182979,_0x186bb3){_0x182979=_0x182979-0x0;var _0x18da17=_0x6659[_0x182979];return _0x18da17;};'use strict';var Sequelize=require('sequelize');module[_0x9665('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9665('0x1')]},'calleridname':{'type':Sequelize[_0x9665('0x1')]},'context':{'type':Sequelize[_0x9665('0x1')]},'extension':{'type':Sequelize[_0x9665('0x1')]},'priority':{'type':Sequelize[_0x9665('0x1')]},'accountcode':{'type':Sequelize[_0x9665('0x1')]},'dnid':{'type':Sequelize[_0x9665('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9665('0x2')],'get':function(){var _0x279158='';var _0x4d5720=this[_0x9665('0x3')](_0x9665('0x4'));if(_0x4d5720){_0x279158=_0x4d5720['substring'](_0x4d5720['lastIndexOf']('.'));}return _0x279158;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 882d0c4..f254375 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 _0x5db9=['body','download','uniqueid','find','savePath','format','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','limit','set','apply','update','then','destroy','sendStatus','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','create'];(function(_0x22d913,_0xb26258){var _0x4f9acf=function(_0x39e0d5){while(--_0x39e0d5){_0x22d913['push'](_0x22d913['shift']());}};_0x4f9acf(++_0xb26258);}(_0x5db9,0x121));var _0x95db=function(_0x318825,_0x3a280c){_0x318825=_0x318825-0x0;var _0x448f73=_0x5db9[_0x318825];return _0x448f73;};'use strict';var pdf=require(_0x95db('0x0'));var emlformat=require(_0x95db('0x1'));var rimraf=require(_0x95db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95db('0x3'));var rp=require('request-promise');var moment=require(_0x95db('0x4'));var BPromise=require(_0x95db('0x5'));var Mustache=require(_0x95db('0x6'));var util=require('util');var path=require('path');var sox=require(_0x95db('0x7'));var csv=require(_0x95db('0x8'));var ejs=require(_0x95db('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x95db('0xa'));var crypto=require(_0x95db('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x95db('0xc'));var toCsv=require(_0x95db('0x8'));var querystring=require('querystring');var Papa=require(_0x95db('0xd'));var Redis=require(_0x95db('0xe'));var authService=require(_0x95db('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x95db('0x10'));var hardwareService=require(_0x95db('0x11'));var logger=require(_0x95db('0x12'))(_0x95db('0x13'));var utils=require(_0x95db('0x14'));var config=require(_0x95db('0x15'));var licenseUtil=require(_0x95db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e62f6,_0x1973d2){_0x1973d2=_0x1973d2||0xcc;return function(_0x3bc4bb){if(_0x3bc4bb){return _0x4e62f6['sendStatus'](_0x1973d2);}return _0x4e62f6[_0x95db('0x17')](_0x1973d2)[_0x95db('0x18')]();};}function respondWithResult(_0x484412,_0x1741f0){_0x1741f0=_0x1741f0||0xc8;return function(_0x549725){if(_0x549725){return _0x484412[_0x95db('0x17')](_0x1741f0)[_0x95db('0x19')](_0x549725);}};}function respondWithFilteredResult(_0x2bccde,_0x2bfe65){return function(_0x41a59d){if(_0x41a59d){var _0x25ac78=_0x41a59d[_0x95db('0x1a')],_0x456ae6=_0x2bfe65['offset'],_0xe4b35f=_0x2bfe65['offset']+_0x2bfe65[_0x95db('0x1b')],_0x1abfe9;if(_0xe4b35f>=_0x25ac78){_0xe4b35f=_0x25ac78;_0x1abfe9=0xc8;}else{_0x1abfe9=0xce;}_0x2bccde[_0x95db('0x17')](_0x1abfe9);return _0x2bccde[_0x95db('0x1c')]('Content-Range',_0x456ae6+'-'+_0xe4b35f+'/'+_0x25ac78)[_0x95db('0x19')](_0x41a59d);}return null;};}function patchUpdates(_0x5a1158){return function(_0x5d6ce2){try{jsonpatch[_0x95db('0x1d')](_0x5d6ce2,_0x5a1158,!![]);}catch(_0x578a90){return BPromise['reject'](_0x578a90);}return _0x5d6ce2['save']();};}function saveUpdates(_0x29defe,_0x1f96df){return function(_0x95d79a){if(_0x95d79a){return _0x95d79a[_0x95db('0x1e')](_0x29defe)[_0x95db('0x1f')](function(_0x31330c){return _0x31330c;});}return null;};}function removeEntity(_0x3f0969,_0x680296){return function(_0x78c932){if(_0x78c932){return _0x78c932[_0x95db('0x20')]()[_0x95db('0x1f')](function(){_0x3f0969['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4697,_0x37bd9c){return function(_0x49e27a){if(!_0x49e27a){_0x4b4697[_0x95db('0x21')](0x194);}return _0x49e27a;};}function handleError(_0x24b3d8,_0x3b456d){_0x3b456d=_0x3b456d||0x1f4;return function(_0x57b5fe){logger['error'](_0x57b5fe[_0x95db('0x22')]);if(_0x57b5fe['name']){delete _0x57b5fe[_0x95db('0x23')];}_0x24b3d8[_0x95db('0x17')](_0x3b456d)[_0x95db('0x24')](_0x57b5fe);};}exports['index']=function(_0x535427,_0x3eb119){var _0x1f4888={},_0xfb58c8={},_0x49c274={'count':0x0,'rows':[]};var _0x311352=_[_0x95db('0x25')](db[_0x95db('0x26')][_0x95db('0x27')],function(_0x2ffe50){return{'name':_0x2ffe50[_0x95db('0x28')],'type':_0x2ffe50[_0x95db('0x29')][_0x95db('0x2a')]};});_0xfb58c8[_0x95db('0x2b')]=_[_0x95db('0x25')](_0x311352,_0x95db('0x23'));_0xfb58c8[_0x95db('0x2c')]=_[_0x95db('0x2d')](_0x535427[_0x95db('0x2c')]);_0xfb58c8[_0x95db('0x2e')]=_[_0x95db('0x2f')](_0xfb58c8[_0x95db('0x2b')],_0xfb58c8[_0x95db('0x2c')]);_0x1f4888[_0x95db('0x30')]=_['intersection'](_0xfb58c8[_0x95db('0x2b')],qs[_0x95db('0x31')](_0x535427[_0x95db('0x2c')]['fields']));_0x1f4888[_0x95db('0x30')]=_0x1f4888[_0x95db('0x30')][_0x95db('0x32')]?_0x1f4888[_0x95db('0x30')]:_0xfb58c8[_0x95db('0x2b')];if(!_0x535427[_0x95db('0x2c')][_0x95db('0x33')](_0x95db('0x34'))){_0x1f4888[_0x95db('0x1b')]=qs[_0x95db('0x1b')](_0x535427[_0x95db('0x2c')]['limit']);_0x1f4888[_0x95db('0x35')]=qs[_0x95db('0x35')](_0x535427[_0x95db('0x2c')][_0x95db('0x35')]);}_0x1f4888['order']=qs[_0x95db('0x36')](_0x535427['query'][_0x95db('0x36')]);_0x1f4888[_0x95db('0x37')]=qs[_0x95db('0x2e')](_[_0x95db('0x38')](_0x535427[_0x95db('0x2c')],_0xfb58c8[_0x95db('0x2e')]),_0x311352);if(_0x535427[_0x95db('0x2c')][_0x95db('0x39')]){_0x1f4888[_0x95db('0x37')]=_[_0x95db('0x3a')](_0x1f4888[_0x95db('0x37')],{'$or':_[_0x95db('0x25')](_0x311352,function(_0x136afa){if(_0x136afa['type']!=='VIRTUAL'){var _0x524a74={};_0x524a74[_0x136afa[_0x95db('0x23')]]={'$like':'%'+_0x535427['query'][_0x95db('0x39')]+'%'};return _0x524a74;}})});}_0x1f4888=_[_0x95db('0x3a')]({},_0x1f4888,_0x535427['options']);var _0x1ad80b={'where':_0x1f4888[_0x95db('0x37')]};return db[_0x95db('0x26')][_0x95db('0x1a')](_0x1ad80b)[_0x95db('0x1f')](function(_0x2b1834){_0x49c274[_0x95db('0x1a')]=_0x2b1834;if(_0x535427[_0x95db('0x2c')][_0x95db('0x3b')]){_0x1f4888[_0x95db('0x3c')]=[{'all':!![]}];}return db[_0x95db('0x26')][_0x95db('0x3d')](_0x1f4888);})['then'](function(_0x3e6760){_0x49c274[_0x95db('0x3e')]=_0x3e6760;return _0x49c274;})[_0x95db('0x1f')](respondWithFilteredResult(_0x3eb119,_0x1f4888))[_0x95db('0x3f')](handleError(_0x3eb119,null));};exports['show']=function(_0x524937,_0x4d1fa6){var _0x52e243={'raw':!![],'where':{'id':_0x524937[_0x95db('0x40')]['id']}},_0x95280c={};_0x95280c[_0x95db('0x2b')]=_['keys'](db[_0x95db('0x26')]['rawAttributes']);_0x95280c[_0x95db('0x2c')]=_[_0x95db('0x2d')](_0x524937['query']);_0x95280c[_0x95db('0x2e')]=_[_0x95db('0x2f')](_0x95280c[_0x95db('0x2b')],_0x95280c[_0x95db('0x2c')]);_0x52e243[_0x95db('0x30')]=_[_0x95db('0x2f')](_0x95280c[_0x95db('0x2b')],qs[_0x95db('0x31')](_0x524937[_0x95db('0x2c')]['fields']));_0x52e243[_0x95db('0x30')]=_0x52e243[_0x95db('0x30')][_0x95db('0x32')]?_0x52e243[_0x95db('0x30')]:_0x95280c['model'];if(_0x524937['query'][_0x95db('0x3b')]){_0x52e243[_0x95db('0x3c')]=[{'all':!![]}];}_0x52e243=_[_0x95db('0x3a')]({},_0x52e243,_0x524937[_0x95db('0x41')]);return db[_0x95db('0x26')]['find'](_0x52e243)[_0x95db('0x1f')](handleEntityNotFound(_0x4d1fa6,null))['then'](respondWithResult(_0x4d1fa6,null))[_0x95db('0x3f')](handleError(_0x4d1fa6,null));};exports[_0x95db('0x42')]=function(_0x1891c5,_0x47d62e){return db[_0x95db('0x26')]['create'](_0x1891c5[_0x95db('0x43')],{})['then'](respondWithResult(_0x47d62e,0xc9))[_0x95db('0x3f')](handleError(_0x47d62e,null));};exports['update']=function(_0x32bd1c,_0x4ebbe5){if(_0x32bd1c[_0x95db('0x43')]['id']){delete _0x32bd1c['body']['id'];}return db[_0x95db('0x26')]['find']({'where':{'id':_0x32bd1c['params']['id']}})[_0x95db('0x1f')](handleEntityNotFound(_0x4ebbe5,null))[_0x95db('0x1f')](saveUpdates(_0x32bd1c[_0x95db('0x43')],null))['then'](respondWithResult(_0x4ebbe5,null))[_0x95db('0x3f')](handleError(_0x4ebbe5,null));};exports[_0x95db('0x44')]=function(_0x2a3bb0,_0x1b83a2,_0x546205){var _0x2ea987=require('../../components/encryptor');var _0x25c0e7=![];var _0x3c2e74={};if(_0x2a3bb0[_0x95db('0x2c')][_0x95db('0x29')]&&_0x2a3bb0[_0x95db('0x2c')][_0x95db('0x29')]==='uniqueid'){_0x3c2e74[_0x95db('0x45')]=_0x2a3bb0[_0x95db('0x40')]['id'];}else{_0x3c2e74['id']=_0x2a3bb0['params']['id'];}return db['SquareRecording'][_0x95db('0x46')]({'where':_0x3c2e74,'attributes':['id',_0x95db('0x47'),'filename'],'raw':!![]})[_0x95db('0x1f')](handleEntityNotFound(_0x1b83a2,null))[_0x95db('0x1f')](function(_0x1f7246){if(_0x1f7246){var _0x5f6e43=_0x1f7246[_0x95db('0x47')];var _0x7125bc=util[_0x95db('0x48')](_0x95db('0x49'),_0x5f6e43);if(fs['existsSync'](_0x7125bc)){_0x25c0e7=!![];return _0x2ea987['decryptFile'](_0x7125bc,_0x5f6e43,config[_0x95db('0x4a')][_0x95db('0x4b')])[_0x95db('0x1f')](function(){return _0x1f7246;});}return _0x1f7246;}})[_0x95db('0x1f')](function(_0x21bda8){if(_0x21bda8){var _0x18d81c=_0x21bda8['savePath'];if(!fs[_0x95db('0x4c')](_0x18d81c)){throw new db[(_0x95db('0x4d'))][(_0x95db('0x4e'))](_0x95db('0x4f'));}if(_0x21bda8['filename']){return _0x1b83a2[_0x95db('0x44')](_0x18d81c,_0x21bda8['filename']+path['extname'](_0x18d81c),function(){if(_0x25c0e7){fs[_0x95db('0x50')](_0x18d81c);}});}else{return _0x1b83a2[_0x95db('0x44')](_0x18d81c,function(_0x5043d3){if(_0x25c0e7){fs['unlink'](_0x18d81c);}});}}})[_0x95db('0x3f')](function(_0x290a3a){if(_0x290a3a[_0x95db('0x51')]===_0x95db('0x4f')){_0x1b83a2[_0x95db('0x17')](0x194)[_0x95db('0x24')](_0x95db('0x52'));}else{return handleError(_0x1b83a2,null);}});};exports['destroy']=function(_0x4579cb,_0x45b51c){return db[_0x95db('0x26')][_0x95db('0x46')]({'where':{'id':_0x4579cb[_0x95db('0x40')]['id']}})[_0x95db('0x1f')](function(_0x298111){if(!_0x298111)throw new ReferenceError('Entity\x20not\x20found');return _0x298111;})['then'](function(_0x42d8ea){var _0x2f6b04=_0x42d8ea[_0x95db('0x47')];logger[_0x95db('0x53')](_0x95db('0x54'),_0x2f6b04);if(!_[_0x95db('0x55')](_0x42d8ea[_0x95db('0x47')])&&fs[_0x95db('0x4c')](_0x2f6b04)){logger[_0x95db('0x53')](_0x95db('0x56')+_0x2f6b04+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x95db('0x57')](_0x2f6b04);}_0x2f6b04=_0x2f6b04+_0x95db('0x58');if(!_[_0x95db('0x55')](_0x42d8ea[_0x95db('0x47')])&&fs[_0x95db('0x4c')](_0x2f6b04)){logger[_0x95db('0x53')]('File:\x20\x22'+_0x2f6b04+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x95db('0x57')](_0x2f6b04);}return _0x42d8ea;})['then'](function(_0x4f8b71){if(!_0x4f8b71)throw new InternalError();return _0x4f8b71['destroy']();})[_0x95db('0x1f')](function(){_0x45b51c[_0x95db('0x17')](0xcc)['end']();})['catch'](handleError(_0x45b51c,null));}; \ No newline at end of file +var _0xb15c=['sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','includeAll','include','find','create','body','params','download','../../components/encryptor','type','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xb24ddd,_0x4a5e2a){var _0x52ad1a=function(_0x34a1cb){while(--_0x34a1cb){_0xb24ddd['push'](_0xb24ddd['shift']());}};_0x52ad1a(++_0x4a5e2a);}(_0xb15c,0x1cc));var _0xcb15=function(_0x3de6aa,_0x44a0dd){_0x3de6aa=_0x3de6aa-0x0;var _0x1ac9d2=_0xb15c[_0x3de6aa];return _0x1ac9d2;};'use strict';var pdf=require(_0xcb15('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcb15('0x1'));var zipdir=require(_0xcb15('0x2'));var jsonpatch=require(_0xcb15('0x3'));var rp=require(_0xcb15('0x4'));var moment=require(_0xcb15('0x5'));var BPromise=require(_0xcb15('0x6'));var Mustache=require('mustache');var util=require(_0xcb15('0x7'));var path=require(_0xcb15('0x8'));var sox=require(_0xcb15('0x9'));var csv=require('to-csv');var ejs=require(_0xcb15('0xa'));var fs=require('fs');var _=require(_0xcb15('0xb'));var squel=require('squel');var crypto=require(_0xcb15('0xc'));var jsforce=require(_0xcb15('0xd'));var deskjs=require(_0xcb15('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcb15('0xf'));var Redis=require('ioredis');var authService=require(_0xcb15('0x10'));var qs=require(_0xcb15('0x11'));var as=require(_0xcb15('0x12'));var hardwareService=require(_0xcb15('0x13'));var logger=require(_0xcb15('0x14'))(_0xcb15('0x15'));var utils=require(_0xcb15('0x16'));var config=require(_0xcb15('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb15('0x18'))['db'];function respondWithStatusCode(_0x1cd7c6,_0x50d03a){_0x50d03a=_0x50d03a||0xcc;return function(_0x44d6c8){if(_0x44d6c8){return _0x1cd7c6[_0xcb15('0x19')](_0x50d03a);}return _0x1cd7c6[_0xcb15('0x1a')](_0x50d03a)['end']();};}function respondWithResult(_0x342ec9,_0x55e290){_0x55e290=_0x55e290||0xc8;return function(_0x9b67e7){if(_0x9b67e7){return _0x342ec9[_0xcb15('0x1a')](_0x55e290)[_0xcb15('0x1b')](_0x9b67e7);}};}function respondWithFilteredResult(_0x3b3272,_0x1ad38b){return function(_0x5298a0){if(_0x5298a0){var _0x4c04f8=_0x5298a0[_0xcb15('0x1c')],_0x179a45=_0x1ad38b[_0xcb15('0x1d')],_0x3989f3=_0x1ad38b[_0xcb15('0x1d')]+_0x1ad38b['limit'],_0x17d431;if(_0x3989f3>=_0x4c04f8){_0x3989f3=_0x4c04f8;_0x17d431=0xc8;}else{_0x17d431=0xce;}_0x3b3272[_0xcb15('0x1a')](_0x17d431);return _0x3b3272[_0xcb15('0x1e')](_0xcb15('0x1f'),_0x179a45+'-'+_0x3989f3+'/'+_0x4c04f8)[_0xcb15('0x1b')](_0x5298a0);}return null;};}function patchUpdates(_0xaccd45){return function(_0x318d42){try{jsonpatch[_0xcb15('0x20')](_0x318d42,_0xaccd45,!![]);}catch(_0x5e71f6){return BPromise['reject'](_0x5e71f6);}return _0x318d42[_0xcb15('0x21')]();};}function saveUpdates(_0x54d43a,_0x4733f0){return function(_0x7f917a){if(_0x7f917a){return _0x7f917a[_0xcb15('0x22')](_0x54d43a)[_0xcb15('0x23')](function(_0x5c7eaf){return _0x5c7eaf;});}return null;};}function removeEntity(_0xd979b2,_0x1e9866){return function(_0x1a41e6){if(_0x1a41e6){return _0x1a41e6[_0xcb15('0x24')]()[_0xcb15('0x23')](function(){_0xd979b2[_0xcb15('0x1a')](0xcc)[_0xcb15('0x25')]();});}};}function handleEntityNotFound(_0x20e750,_0x17697d){return function(_0x8fd919){if(!_0x8fd919){_0x20e750[_0xcb15('0x19')](0x194);}return _0x8fd919;};}function handleError(_0x207a3e,_0x4286fd){_0x4286fd=_0x4286fd||0x1f4;return function(_0x584f24){logger['error'](_0x584f24[_0xcb15('0x26')]);if(_0x584f24[_0xcb15('0x27')]){delete _0x584f24[_0xcb15('0x27')];}_0x207a3e[_0xcb15('0x1a')](_0x4286fd)[_0xcb15('0x28')](_0x584f24);};}exports[_0xcb15('0x29')]=function(_0x2129cb,_0x145e5c){var _0x4714fb={},_0x3745e1={},_0x5b48d8={'count':0x0,'rows':[]};var _0x37b671=_[_0xcb15('0x2a')](db[_0xcb15('0x2b')][_0xcb15('0x2c')],function(_0x5212ac){return{'name':_0x5212ac[_0xcb15('0x2d')],'type':_0x5212ac['type'][_0xcb15('0x2e')]};});_0x3745e1[_0xcb15('0x2f')]=_[_0xcb15('0x2a')](_0x37b671,'name');_0x3745e1[_0xcb15('0x30')]=_[_0xcb15('0x31')](_0x2129cb['query']);_0x3745e1[_0xcb15('0x32')]=_['intersection'](_0x3745e1[_0xcb15('0x2f')],_0x3745e1['query']);_0x4714fb['attributes']=_[_0xcb15('0x33')](_0x3745e1[_0xcb15('0x2f')],qs[_0xcb15('0x34')](_0x2129cb[_0xcb15('0x30')]['fields']));_0x4714fb[_0xcb15('0x35')]=_0x4714fb[_0xcb15('0x35')][_0xcb15('0x36')]?_0x4714fb['attributes']:_0x3745e1[_0xcb15('0x2f')];if(!_0x2129cb[_0xcb15('0x30')][_0xcb15('0x37')]('nolimit')){_0x4714fb[_0xcb15('0x38')]=qs[_0xcb15('0x38')](_0x2129cb[_0xcb15('0x30')]['limit']);_0x4714fb[_0xcb15('0x1d')]=qs[_0xcb15('0x1d')](_0x2129cb['query'][_0xcb15('0x1d')]);}_0x4714fb['order']=qs[_0xcb15('0x39')](_0x2129cb[_0xcb15('0x30')][_0xcb15('0x39')]);_0x4714fb['where']=qs['filters'](_[_0xcb15('0x3a')](_0x2129cb['query'],_0x3745e1[_0xcb15('0x32')]),_0x37b671);if(_0x2129cb[_0xcb15('0x30')][_0xcb15('0x3b')]){_0x4714fb[_0xcb15('0x3c')]=_[_0xcb15('0x3d')](_0x4714fb[_0xcb15('0x3c')],{'$or':_[_0xcb15('0x2a')](_0x37b671,function(_0x58ca47){if(_0x58ca47['type']!==_0xcb15('0x3e')){var _0x33cf80={};_0x33cf80[_0x58ca47[_0xcb15('0x27')]]={'$like':'%'+_0x2129cb['query'][_0xcb15('0x3b')]+'%'};return _0x33cf80;}})});}_0x4714fb=_['merge']({},_0x4714fb,_0x2129cb[_0xcb15('0x3f')]);var _0x9f2c3a={'where':_0x4714fb[_0xcb15('0x3c')]};return db[_0xcb15('0x2b')][_0xcb15('0x1c')](_0x9f2c3a)[_0xcb15('0x23')](function(_0x5c4c41){_0x5b48d8[_0xcb15('0x1c')]=_0x5c4c41;if(_0x2129cb[_0xcb15('0x30')]['includeAll']){_0x4714fb['include']=[{'all':!![]}];}return db[_0xcb15('0x2b')][_0xcb15('0x40')](_0x4714fb);})[_0xcb15('0x23')](function(_0x15c9f4){_0x5b48d8[_0xcb15('0x41')]=_0x15c9f4;return _0x5b48d8;})['then'](respondWithFilteredResult(_0x145e5c,_0x4714fb))[_0xcb15('0x42')](handleError(_0x145e5c,null));};exports['show']=function(_0x4a6bb0,_0x121267){var _0x4a49a6={'raw':!![],'where':{'id':_0x4a6bb0['params']['id']}},_0x3cd648={};_0x3cd648[_0xcb15('0x2f')]=_['keys'](db['SquareRecording']['rawAttributes']);_0x3cd648[_0xcb15('0x30')]=_[_0xcb15('0x31')](_0x4a6bb0['query']);_0x3cd648[_0xcb15('0x32')]=_[_0xcb15('0x33')](_0x3cd648['model'],_0x3cd648[_0xcb15('0x30')]);_0x4a49a6[_0xcb15('0x35')]=_[_0xcb15('0x33')](_0x3cd648['model'],qs['fields'](_0x4a6bb0[_0xcb15('0x30')]['fields']));_0x4a49a6[_0xcb15('0x35')]=_0x4a49a6[_0xcb15('0x35')][_0xcb15('0x36')]?_0x4a49a6[_0xcb15('0x35')]:_0x3cd648[_0xcb15('0x2f')];if(_0x4a6bb0[_0xcb15('0x30')][_0xcb15('0x43')]){_0x4a49a6[_0xcb15('0x44')]=[{'all':!![]}];}_0x4a49a6=_[_0xcb15('0x3d')]({},_0x4a49a6,_0x4a6bb0['options']);return db['SquareRecording'][_0xcb15('0x45')](_0x4a49a6)[_0xcb15('0x23')](handleEntityNotFound(_0x121267,null))['then'](respondWithResult(_0x121267,null))[_0xcb15('0x42')](handleError(_0x121267,null));};exports[_0xcb15('0x46')]=function(_0x1fe52d,_0x23b495){return db[_0xcb15('0x2b')][_0xcb15('0x46')](_0x1fe52d[_0xcb15('0x47')],{})[_0xcb15('0x23')](respondWithResult(_0x23b495,0xc9))[_0xcb15('0x42')](handleError(_0x23b495,null));};exports['update']=function(_0x441720,_0xad58b0){if(_0x441720['body']['id']){delete _0x441720[_0xcb15('0x47')]['id'];}return db[_0xcb15('0x2b')][_0xcb15('0x45')]({'where':{'id':_0x441720[_0xcb15('0x48')]['id']}})[_0xcb15('0x23')](handleEntityNotFound(_0xad58b0,null))[_0xcb15('0x23')](saveUpdates(_0x441720[_0xcb15('0x47')],null))[_0xcb15('0x23')](respondWithResult(_0xad58b0,null))[_0xcb15('0x42')](handleError(_0xad58b0,null));};exports[_0xcb15('0x49')]=function(_0x1f9ed7,_0x165c02,_0x1762d4){var _0x2fc869=require(_0xcb15('0x4a'));var _0x31d1f2=![];var _0x19c65c={};if(_0x1f9ed7['query'][_0xcb15('0x4b')]&&_0x1f9ed7[_0xcb15('0x30')][_0xcb15('0x4b')]===_0xcb15('0x4c')){_0x19c65c[_0xcb15('0x4c')]=_0x1f9ed7[_0xcb15('0x48')]['id'];}else{_0x19c65c['id']=_0x1f9ed7[_0xcb15('0x48')]['id'];}return db[_0xcb15('0x2b')][_0xcb15('0x45')]({'where':_0x19c65c,'attributes':['id',_0xcb15('0x4d'),'filename'],'raw':!![]})[_0xcb15('0x23')](handleEntityNotFound(_0x165c02,null))[_0xcb15('0x23')](function(_0x115225){if(_0x115225){var _0xd2e5db=_0x115225[_0xcb15('0x4d')];var _0x4bb14c=util[_0xcb15('0x4e')](_0xcb15('0x4f'),_0xd2e5db);if(fs[_0xcb15('0x50')](_0x4bb14c)){_0x31d1f2=!![];return _0x2fc869[_0xcb15('0x51')](_0x4bb14c,_0xd2e5db,config[_0xcb15('0x52')][_0xcb15('0x53')])[_0xcb15('0x23')](function(){return _0x115225;});}return _0x115225;}})['then'](function(_0x1ae983){if(_0x1ae983){var _0x7a3b7a=_0x1ae983[_0xcb15('0x4d')];if(!fs['existsSync'](_0x7a3b7a)){throw new db[(_0xcb15('0x54'))][(_0xcb15('0x55'))](_0xcb15('0x56'));}if(_0x1ae983[_0xcb15('0x57')]){return _0x165c02[_0xcb15('0x49')](_0x7a3b7a,_0x1ae983[_0xcb15('0x57')]+path[_0xcb15('0x58')](_0x7a3b7a),function(){if(_0x31d1f2){fs[_0xcb15('0x59')](_0x7a3b7a);}});}else{return _0x165c02[_0xcb15('0x49')](_0x7a3b7a,function(_0x32b316){if(_0x31d1f2){fs[_0xcb15('0x59')](_0x7a3b7a);}});}}})[_0xcb15('0x42')](function(_0x3a29bf){if(_0x3a29bf['message']==='SquareRecording\x20not\x20found'){_0x165c02[_0xcb15('0x1a')](0x194)[_0xcb15('0x28')]('Not\x20found');}else{return handleError(_0x165c02,null);}});};exports[_0xcb15('0x24')]=function(_0x230547,_0x5768f7){return db[_0xcb15('0x2b')]['find']({'where':{'id':_0x230547[_0xcb15('0x48')]['id']}})[_0xcb15('0x23')](function(_0x1de009){if(!_0x1de009)throw new ReferenceError(_0xcb15('0x5a'));return _0x1de009;})['then'](function(_0x254baf){var _0xb68716=_0x254baf[_0xcb15('0x4d')];logger[_0xcb15('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0xb68716);if(!_['isNil'](_0x254baf[_0xcb15('0x4d')])&&fs[_0xcb15('0x50')](_0xb68716)){logger[_0xcb15('0x5b')](_0xcb15('0x5c')+_0xb68716+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcb15('0x5d')](_0xb68716);}_0xb68716=_0xb68716+_0xcb15('0x5e');if(!_[_0xcb15('0x5f')](_0x254baf[_0xcb15('0x4d')])&&fs[_0xcb15('0x50')](_0xb68716)){logger[_0xcb15('0x5b')]('File:\x20\x22'+_0xb68716+_0xcb15('0x60'));fs[_0xcb15('0x5d')](_0xb68716);}return _0x254baf;})['then'](function(_0x3b07e7){if(!_0x3b07e7)throw new InternalError();return _0x3b07e7[_0xcb15('0x24')]();})[_0xcb15('0x23')](function(){_0x5768f7[_0xcb15('0x1a')](0xcc)[_0xcb15('0x25')]();})[_0xcb15('0x42')](handleError(_0x5768f7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3529f0b..82ee847 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 _0xb4f8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareRecording.attributes','exports','define','square_recordings','util'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xb4f8,0x83));var _0x8b4f=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xb4f8[_0x86b219];return _0x1f320c;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var logger=require(_0x8b4f('0x1'))(_0x8b4f('0x2'));var moment=require(_0x8b4f('0x3'));var BPromise=require(_0x8b4f('0x4'));var rp=require(_0x8b4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b4f('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b4f('0x7'));module[_0x8b4f('0x8')]=function(_0x533e63,_0x17e04f){return _0x533e63[_0x8b4f('0x9')]('SquareRecording',attributes,{'tableName':_0x8b4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1280=['./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x38bd5f,_0x4c05bd){var _0x4ed18d=function(_0x3f437e){while(--_0x3f437e){_0x38bd5f['push'](_0x38bd5f['shift']());}};_0x4ed18d(++_0x4c05bd);}(_0x1280,0xac));var _0x0128=function(_0x4e9a22,_0x65e645){_0x4e9a22=_0x4e9a22-0x0;var _0x364420=_0x1280[_0x4e9a22];return _0x364420;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var logger=require(_0x0128('0x1'))(_0x0128('0x2'));var moment=require(_0x0128('0x3'));var BPromise=require(_0x0128('0x4'));var rp=require(_0x0128('0x5'));var fs=require('fs');var path=require(_0x0128('0x6'));var rimraf=require('rimraf');var config=require(_0x0128('0x7'));var attributes=require(_0x0128('0x8'));module[_0x0128('0x9')]=function(_0x2631a2,_0x4aa391){return _0x2631a2['define'](_0x0128('0xa'),attributes,{'tableName':_0x0128('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 415430d..d6166c9 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 _0x8aab=['client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x412775,_0x50c5b9){var _0x35f15c=function(_0x5c5142){while(--_0x5c5142){_0x412775['push'](_0x412775['shift']());}};_0x35f15c(++_0x50c5b9);}(_0x8aab,0x6e));var _0xb8aa=function(_0x30b18d,_0x42f8dc){_0x30b18d=_0x30b18d-0x0;var _0x45efcc=_0x8aab[_0x30b18d];return _0x45efcc;};'use strict';var _=require(_0xb8aa('0x0'));var util=require(_0xb8aa('0x1'));var moment=require(_0xb8aa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8aa('0x3'));var db=require(_0xb8aa('0x4'))['db'];var utils=require(_0xb8aa('0x5'));var logger=require(_0xb8aa('0x6'))(_0xb8aa('0x7'));var config=require(_0xb8aa('0x8'));var jayson=require(_0xb8aa('0x9'));var client=jayson[_0xb8aa('0xa')][_0xb8aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402692,_0x33b9d1,_0x53bbba){return new BPromise(function(_0x59cc72,_0xcfa486){return client[_0xb8aa('0xc')](_0x402692,_0x53bbba)[_0xb8aa('0xd')](function(_0xc32604){logger[_0xb8aa('0xe')](_0xb8aa('0xf'),_0x33b9d1,_0xb8aa('0x10'));logger[_0xb8aa('0x11')](_0xb8aa('0x12'),_0x33b9d1,_0xb8aa('0x10'),JSON[_0xb8aa('0x13')](_0xc32604));if(_0xc32604[_0xb8aa('0x14')]){if(_0xc32604[_0xb8aa('0x14')][_0xb8aa('0x15')]===0x1f4){logger[_0xb8aa('0x14')](_0xb8aa('0xf'),_0x33b9d1,_0xc32604[_0xb8aa('0x14')]['message']);return _0xcfa486(_0xc32604[_0xb8aa('0x14')][_0xb8aa('0x16')]);}logger[_0xb8aa('0x14')](_0xb8aa('0xf'),_0x33b9d1,_0xc32604[_0xb8aa('0x14')]['message']);return _0x59cc72(_0xc32604[_0xb8aa('0x14')]['message']);}else{logger[_0xb8aa('0xe')](_0xb8aa('0xf'),_0x33b9d1,_0xb8aa('0x10'));_0x59cc72(_0xc32604[_0xb8aa('0x17')]['message']);}})[_0xb8aa('0x18')](function(_0x42e226){logger[_0xb8aa('0x14')](_0xb8aa('0xf'),_0x33b9d1,_0x42e226);_0xcfa486(_0x42e226);});});}exports[_0xb8aa('0x19')]=function(_0x236b73){var _0x1c586c=this;return new Promise(function(_0x188247,_0x59a2fe){return db[_0xb8aa('0x1a')]['create'](_0x236b73[_0xb8aa('0x1b')],{'raw':_0x236b73[_0xb8aa('0x1c')]?_0x236b73['options'][_0xb8aa('0x1d')]===undefined?!![]:![]:!![]})[_0xb8aa('0xd')](function(_0x447a40){logger[_0xb8aa('0xe')](_0xb8aa('0x19'),_0x236b73);logger[_0xb8aa('0x11')](_0xb8aa('0x19'),_0x236b73,JSON[_0xb8aa('0x13')](_0x447a40));_0x188247(_0x447a40);})[_0xb8aa('0x18')](function(_0x3c5642){logger['error']('CreateSquareRecording',_0x3c5642[_0xb8aa('0x16')],_0x236b73);_0x59a2fe(_0x1c586c[_0xb8aa('0x14')](0x1f4,_0x3c5642[_0xb8aa('0x16')]));});});}; \ No newline at end of file +var _0x7786=['client','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','CreateSquareRecording','create','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x35fcae,_0x424750){var _0x1fa5dd=function(_0x13ab57){while(--_0x13ab57){_0x35fcae['push'](_0x35fcae['shift']());}};_0x1fa5dd(++_0x424750);}(_0x7786,0x1dd));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6778('0x0'));var util=require('util');var moment=require(_0x6778('0x1'));var BPromise=require(_0x6778('0x2'));var rs=require(_0x6778('0x3'));var fs=require('fs');var Redis=require(_0x6778('0x4'));var db=require(_0x6778('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6778('0x6'))('rpc');var config=require(_0x6778('0x7'));var jayson=require(_0x6778('0x8'));var client=jayson[_0x6778('0x9')][_0x6778('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244cb2,_0x70c979,_0x5a608c){return new BPromise(function(_0x44d12d,_0x31899d){return client[_0x6778('0xb')](_0x244cb2,_0x5a608c)[_0x6778('0xc')](function(_0x3ab541){logger['info']('SquareRecording,\x20%s,\x20%s',_0x70c979,_0x6778('0xd'));logger[_0x6778('0xe')](_0x6778('0xf'),_0x70c979,_0x6778('0xd'),JSON[_0x6778('0x10')](_0x3ab541));if(_0x3ab541[_0x6778('0x11')]){if(_0x3ab541[_0x6778('0x11')][_0x6778('0x12')]===0x1f4){logger[_0x6778('0x11')](_0x6778('0x13'),_0x70c979,_0x3ab541['error'][_0x6778('0x14')]);return _0x31899d(_0x3ab541[_0x6778('0x11')]['message']);}logger[_0x6778('0x11')](_0x6778('0x13'),_0x70c979,_0x3ab541[_0x6778('0x11')][_0x6778('0x14')]);return _0x44d12d(_0x3ab541[_0x6778('0x11')][_0x6778('0x14')]);}else{logger[_0x6778('0x15')]('SquareRecording,\x20%s,\x20%s',_0x70c979,_0x6778('0xd'));_0x44d12d(_0x3ab541[_0x6778('0x16')][_0x6778('0x14')]);}})[_0x6778('0x17')](function(_0x3e1eed){logger[_0x6778('0x11')]('SquareRecording,\x20%s,\x20%s',_0x70c979,_0x3e1eed);_0x31899d(_0x3e1eed);});});}exports[_0x6778('0x18')]=function(_0x2c6687){var _0x5c0cf6=this;return new Promise(function(_0x2c8882,_0x85bf1f){return db['SquareRecording'][_0x6778('0x19')](_0x2c6687['body'],{'raw':_0x2c6687[_0x6778('0x1a')]?_0x2c6687[_0x6778('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1aae87){logger[_0x6778('0x15')](_0x6778('0x18'),_0x2c6687);logger[_0x6778('0xe')](_0x6778('0x18'),_0x2c6687,JSON['stringify'](_0x1aae87));_0x2c8882(_0x1aae87);})['catch'](function(_0x222e8f){logger[_0x6778('0x11')](_0x6778('0x18'),_0x222e8f[_0x6778('0x14')],_0x2c6687);_0x85bf1f(_0x5c0cf6[_0x6778('0x11')](0x1f4,_0x222e8f[_0x6778('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ae200be..fe8fcc4 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 _0x424f=['show','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x502d22,_0x2c1f84){var _0xf1552=function(_0x3775a4){while(--_0x3775a4){_0x502d22['push'](_0x502d22['shift']());}};_0xf1552(++_0x2c1f84);}(_0x424f,0x76));var _0xf424=function(_0x45dc37,_0x1ff308){_0x45dc37=_0x45dc37-0x0;var _0x3e20bc=_0x424f[_0x45dc37];return _0x3e20bc;};'use strict';var multer=require('multer');var util=require(_0xf424('0x0'));var path=require(_0xf424('0x1'));var timeout=require('connect-timeout');var express=require(_0xf424('0x2'));var router=express[_0xf424('0x3')]();var auth=require(_0xf424('0x4'));var interaction=require(_0xf424('0x5'));var config=require(_0xf424('0x6'));var controller=require(_0xf424('0x7'));router[_0xf424('0x8')]('/',auth[_0xf424('0x9')](),controller[_0xf424('0xa')]);router['get'](_0xf424('0xb'),auth['isAuthenticated'](),controller[_0xf424('0xc')]);router['get'](_0xf424('0xd'),auth[_0xf424('0x9')](),controller[_0xf424('0xe')]);router[_0xf424('0xf')]('/',auth[_0xf424('0x9')](),controller[_0xf424('0x10')]);router[_0xf424('0x11')]('/:id',auth[_0xf424('0x9')](),controller[_0xf424('0x12')]);router[_0xf424('0x13')](_0xf424('0xd'),auth['isAuthenticated'](),controller[_0xf424('0x14')]);module[_0xf424('0x15')]=router; \ No newline at end of file +var _0x9975=['destroy','util','express','Router','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x33cdf2,_0xc28dac){var _0x3d05de=function(_0x37b977){while(--_0x37b977){_0x33cdf2['push'](_0x33cdf2['shift']());}};_0x3d05de(++_0xc28dac);}(_0x9975,0x16d));var _0x5997=function(_0xc1cf9d,_0xc32847){_0xc1cf9d=_0xc1cf9d-0x0;var _0x34c92a=_0x9975[_0xc1cf9d];return _0x34c92a;};'use strict';var multer=require('multer');var util=require(_0x5997('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5997('0x1'));var router=express[_0x5997('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5997('0x3'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x5997('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5997('0x4')]('/describe',auth[_0x5997('0x5')](),controller['describe']);router[_0x5997('0x4')](_0x5997('0x6'),auth[_0x5997('0x5')](),controller[_0x5997('0x7')]);router[_0x5997('0x8')]('/',auth['isAuthenticated'](),controller[_0x5997('0x9')]);router[_0x5997('0xa')](_0x5997('0x6'),auth[_0x5997('0x5')](),controller[_0x5997('0xb')]);router[_0x5997('0xc')](_0x5997('0x6'),auth[_0x5997('0x5')](),controller[_0x5997('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 62c1aaa..1df8f52 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 _0x6fe8=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x5c5471,_0x49e7c6){var _0x16f286=function(_0x287b8b){while(--_0x287b8b){_0x5c5471['push'](_0x5c5471['shift']());}};_0x16f286(++_0x49e7c6);}(_0x6fe8,0x1a1));var _0x86fe=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x6fe8[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require(_0x86fe('0x0'));module[_0x86fe('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x86fe('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x86fe('0x2')]},'language':{'type':Sequelize[_0x86fe('0x2')]},'type':{'type':Sequelize[_0x86fe('0x2')]},'uniqueid':{'type':Sequelize[_0x86fe('0x2')]},'version':{'type':Sequelize[_0x86fe('0x2')]},'callerid':{'type':Sequelize[_0x86fe('0x2')]},'calleridname':{'type':Sequelize[_0x86fe('0x2')]},'callingpres':{'type':Sequelize[_0x86fe('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x86fe('0x2')]},'callingtns':{'type':Sequelize[_0x86fe('0x2')]},'dnid':{'type':Sequelize[_0x86fe('0x2')]},'rdnis':{'type':Sequelize[_0x86fe('0x2')]},'context':{'type':Sequelize[_0x86fe('0x2')]},'extension':{'type':Sequelize[_0x86fe('0x2')]},'priority':{'type':Sequelize[_0x86fe('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x86fe('0x2')]},'project_name':{'type':Sequelize[_0x86fe('0x2')]},'joinAt':{'type':Sequelize[_0x86fe('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x86fe('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8975=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0x8975,0x1d5));var _0x5897=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8975[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x5897('0x0'));module[_0x5897('0x1')]={'network':{'type':Sequelize[_0x5897('0x2')]},'network_script':{'type':Sequelize[_0x5897('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5897('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5897('0x2')]},'version':{'type':Sequelize[_0x5897('0x2')]},'callerid':{'type':Sequelize[_0x5897('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x5897('0x2')]},'callingani2':{'type':Sequelize[_0x5897('0x2')]},'callington':{'type':Sequelize[_0x5897('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x5897('0x2')]},'rdnis':{'type':Sequelize[_0x5897('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5897('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x5897('0x2')]},'accountcode':{'type':Sequelize[_0x5897('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x5897('0x2')]},'joinAt':{'type':Sequelize[_0x5897('0x3')]},'leaveAt':{'type':Sequelize[_0x5897('0x3')]},'bot':{'type':Sequelize[_0x5897('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 fab4f13..5f7d0d8 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 _0xc17d=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','intersection','attributes','fields','find','create','body','update','destroy','describe'];(function(_0x3116d6,_0x2d574f){var _0x18729d=function(_0x1945a0){while(--_0x1945a0){_0x3116d6['push'](_0x3116d6['shift']());}};_0x18729d(++_0x2d574f);}(_0xc17d,0x96));var _0xdc17=function(_0x5a90a7,_0x3576c0){_0x5a90a7=_0x5a90a7-0x0;var _0x47dff8=_0xc17d[_0x5a90a7];return _0x47dff8;};'use strict';var pdf=require(_0xdc17('0x0'));var emlformat=require(_0xdc17('0x1'));var rimraf=require(_0xdc17('0x2'));var zipdir=require(_0xdc17('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc17('0x4'));var moment=require(_0xdc17('0x5'));var BPromise=require(_0xdc17('0x6'));var Mustache=require(_0xdc17('0x7'));var util=require('util');var path=require(_0xdc17('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdc17('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdc17('0xa'));var crypto=require(_0xdc17('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc17('0xc'));var querystring=require(_0xdc17('0xd'));var Papa=require(_0xdc17('0xe'));var Redis=require(_0xdc17('0xf'));var authService=require(_0xdc17('0x10'));var qs=require(_0xdc17('0x11'));var as=require(_0xdc17('0x12'));var hardwareService=require(_0xdc17('0x13'));var logger=require('../../config/logger')(_0xdc17('0x14'));var utils=require(_0xdc17('0x15'));var config=require(_0xdc17('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc17('0x17'))['db'];function respondWithStatusCode(_0x4ddfba,_0x137250){_0x137250=_0x137250||0xcc;return function(_0x954b82){if(_0x954b82){return _0x4ddfba['sendStatus'](_0x137250);}return _0x4ddfba[_0xdc17('0x18')](_0x137250)[_0xdc17('0x19')]();};}function respondWithResult(_0x49d6fd,_0x2bb5b2){_0x2bb5b2=_0x2bb5b2||0xc8;return function(_0x59c100){if(_0x59c100){return _0x49d6fd[_0xdc17('0x18')](_0x2bb5b2)[_0xdc17('0x1a')](_0x59c100);}};}function respondWithFilteredResult(_0x5631b6,_0xb3a102){return function(_0x428c8c){if(_0x428c8c){var _0x17ff01=_0x428c8c['count'],_0x30f50a=_0xb3a102[_0xdc17('0x1b')],_0x5d847f=_0xb3a102[_0xdc17('0x1b')]+_0xb3a102[_0xdc17('0x1c')],_0x3adc90;if(_0x5d847f>=_0x17ff01){_0x5d847f=_0x17ff01;_0x3adc90=0xc8;}else{_0x3adc90=0xce;}_0x5631b6[_0xdc17('0x18')](_0x3adc90);return _0x5631b6[_0xdc17('0x1d')](_0xdc17('0x1e'),_0x30f50a+'-'+_0x5d847f+'/'+_0x17ff01)['json'](_0x428c8c);}return null;};}function patchUpdates(_0x1afac9){return function(_0xd0886e){try{jsonpatch[_0xdc17('0x1f')](_0xd0886e,_0x1afac9,!![]);}catch(_0x209133){return BPromise[_0xdc17('0x20')](_0x209133);}return _0xd0886e[_0xdc17('0x21')]();};}function saveUpdates(_0x5650ad,_0x35662c){return function(_0x207c2a){if(_0x207c2a){return _0x207c2a['update'](_0x5650ad)[_0xdc17('0x22')](function(_0xdedfc4){return _0xdedfc4;});}return null;};}function removeEntity(_0x218a5d,_0x687339){return function(_0x3e8d98){if(_0x3e8d98){return _0x3e8d98['destroy']()[_0xdc17('0x22')](function(){_0x218a5d[_0xdc17('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c01aa,_0x1b4706){return function(_0x4b498a){if(!_0x4b498a){_0x5c01aa[_0xdc17('0x23')](0x194);}return _0x4b498a;};}function handleError(_0x4d887d,_0x2a9d24){_0x2a9d24=_0x2a9d24||0x1f4;return function(_0x519795){logger['error'](_0x519795[_0xdc17('0x24')]);if(_0x519795[_0xdc17('0x25')]){delete _0x519795[_0xdc17('0x25')];}_0x4d887d[_0xdc17('0x18')](_0x2a9d24)[_0xdc17('0x26')](_0x519795);};}exports[_0xdc17('0x27')]=function(_0x15c675,_0x2aede3){var _0x20f45b={},_0x573f37={},_0x7ce403={'count':0x0,'rows':[]};var _0x48e275=_[_0xdc17('0x28')](db[_0xdc17('0x29')][_0xdc17('0x2a')],function(_0x49fd56){return{'name':_0x49fd56[_0xdc17('0x2b')],'type':_0x49fd56[_0xdc17('0x2c')]['key']};});_0x573f37[_0xdc17('0x2d')]=_['map'](_0x48e275,_0xdc17('0x25'));_0x573f37['query']=_['keys'](_0x15c675[_0xdc17('0x2e')]);_0x573f37['filters']=_['intersection'](_0x573f37[_0xdc17('0x2d')],_0x573f37[_0xdc17('0x2e')]);_0x20f45b['attributes']=_['intersection'](_0x573f37['model'],qs['fields'](_0x15c675[_0xdc17('0x2e')]['fields']));_0x20f45b['attributes']=_0x20f45b['attributes'][_0xdc17('0x2f')]?_0x20f45b['attributes']:_0x573f37[_0xdc17('0x2d')];if(!_0x15c675[_0xdc17('0x2e')][_0xdc17('0x30')]('nolimit')){_0x20f45b[_0xdc17('0x1c')]=qs['limit'](_0x15c675[_0xdc17('0x2e')][_0xdc17('0x1c')]);_0x20f45b[_0xdc17('0x1b')]=qs[_0xdc17('0x1b')](_0x15c675[_0xdc17('0x2e')][_0xdc17('0x1b')]);}_0x20f45b[_0xdc17('0x31')]=qs[_0xdc17('0x32')](_0x15c675[_0xdc17('0x2e')][_0xdc17('0x32')]);_0x20f45b['where']=qs[_0xdc17('0x33')](_[_0xdc17('0x34')](_0x15c675[_0xdc17('0x2e')],_0x573f37['filters']),_0x48e275);if(_0x15c675[_0xdc17('0x2e')][_0xdc17('0x35')]){_0x20f45b[_0xdc17('0x36')]=_[_0xdc17('0x37')](_0x20f45b[_0xdc17('0x36')],{'$or':_[_0xdc17('0x28')](_0x48e275,function(_0x1b34a8){if(_0x1b34a8[_0xdc17('0x2c')]!==_0xdc17('0x38')){var _0x1c106c={};_0x1c106c[_0x1b34a8[_0xdc17('0x25')]]={'$like':'%'+_0x15c675[_0xdc17('0x2e')][_0xdc17('0x35')]+'%'};return _0x1c106c;}})});}_0x20f45b=_[_0xdc17('0x37')]({},_0x20f45b,_0x15c675[_0xdc17('0x39')]);var _0x1dcf3b={'where':_0x20f45b[_0xdc17('0x36')]};return db[_0xdc17('0x29')]['count'](_0x1dcf3b)[_0xdc17('0x22')](function(_0x5cb54d){_0x7ce403[_0xdc17('0x3a')]=_0x5cb54d;if(_0x15c675['query'][_0xdc17('0x3b')]){_0x20f45b[_0xdc17('0x3c')]=[{'all':!![]}];}return db[_0xdc17('0x29')][_0xdc17('0x3d')](_0x20f45b);})[_0xdc17('0x22')](function(_0x21e5bb){_0x7ce403['rows']=_0x21e5bb;return _0x7ce403;})[_0xdc17('0x22')](respondWithFilteredResult(_0x2aede3,_0x20f45b))[_0xdc17('0x3e')](handleError(_0x2aede3,null));};exports[_0xdc17('0x3f')]=function(_0x3c282a,_0x687bf3){var _0x1f589f={'raw':!![],'where':{'id':_0x3c282a[_0xdc17('0x40')]['id']}},_0x31b61c={};_0x31b61c[_0xdc17('0x2d')]=_['keys'](db[_0xdc17('0x29')][_0xdc17('0x2a')]);_0x31b61c['query']=_[_0xdc17('0x41')](_0x3c282a[_0xdc17('0x2e')]);_0x31b61c[_0xdc17('0x33')]=_[_0xdc17('0x42')](_0x31b61c['model'],_0x31b61c['query']);_0x1f589f[_0xdc17('0x43')]=_[_0xdc17('0x42')](_0x31b61c[_0xdc17('0x2d')],qs[_0xdc17('0x44')](_0x3c282a[_0xdc17('0x2e')]['fields']));_0x1f589f[_0xdc17('0x43')]=_0x1f589f[_0xdc17('0x43')][_0xdc17('0x2f')]?_0x1f589f[_0xdc17('0x43')]:_0x31b61c[_0xdc17('0x2d')];if(_0x3c282a[_0xdc17('0x2e')][_0xdc17('0x3b')]){_0x1f589f[_0xdc17('0x3c')]=[{'all':!![]}];}_0x1f589f=_[_0xdc17('0x37')]({},_0x1f589f,_0x3c282a[_0xdc17('0x39')]);return db['SquareReport'][_0xdc17('0x45')](_0x1f589f)[_0xdc17('0x22')](handleEntityNotFound(_0x687bf3,null))[_0xdc17('0x22')](respondWithResult(_0x687bf3,null))['catch'](handleError(_0x687bf3,null));};exports[_0xdc17('0x46')]=function(_0x13528c,_0x536693){return db[_0xdc17('0x29')][_0xdc17('0x46')](_0x13528c[_0xdc17('0x47')],{})['then'](respondWithResult(_0x536693,0xc9))[_0xdc17('0x3e')](handleError(_0x536693,null));};exports[_0xdc17('0x48')]=function(_0x532553,_0x43a1f6){if(_0x532553[_0xdc17('0x47')]['id']){delete _0x532553['body']['id'];}return db['SquareReport'][_0xdc17('0x45')]({'where':{'id':_0x532553[_0xdc17('0x40')]['id']}})['then'](handleEntityNotFound(_0x43a1f6,null))[_0xdc17('0x22')](saveUpdates(_0x532553[_0xdc17('0x47')],null))[_0xdc17('0x22')](respondWithResult(_0x43a1f6,null))[_0xdc17('0x3e')](handleError(_0x43a1f6,null));};exports[_0xdc17('0x49')]=function(_0x2c9f4b,_0x3118c2){return db['SquareReport'][_0xdc17('0x45')]({'where':{'id':_0x2c9f4b[_0xdc17('0x40')]['id']}})[_0xdc17('0x22')](handleEntityNotFound(_0x3118c2,null))[_0xdc17('0x22')](removeEntity(_0x3118c2,null))[_0xdc17('0x3e')](handleError(_0x3118c2,null));};exports[_0xdc17('0x4a')]=function(_0x5b490c,_0x4368e0){return db[_0xdc17('0x29')][_0xdc17('0x4a')]()[_0xdc17('0x22')](respondWithResult(_0x4368e0,null))[_0xdc17('0x3e')](handleError(_0x4368e0,null));}; \ No newline at end of file +var _0xc6ac=['status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','show','create','body','find','catch','destroy','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x14f4ae,_0x4e1583){var _0x558518=function(_0x4a03a2){while(--_0x4a03a2){_0x14f4ae['push'](_0x14f4ae['shift']());}};_0x558518(++_0x4e1583);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4d6f84,_0x4d31e6){_0x4d6f84=_0x4d6f84-0x0;var _0x22ea76=_0xc6ac[_0x4d6f84];return _0x22ea76;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=_0x403b18[_0xcc6a('0x1e')],_0x4e628f=_0x4133fa[_0xcc6a('0x1f')],_0x4d021a=_0x4133fa[_0xcc6a('0x1f')]+_0x4133fa[_0xcc6a('0x20')],_0x395a55;if(_0x4d021a>=_0x56ffb0){_0x4d021a=_0x56ffb0;_0x395a55=0xc8;}else{_0x395a55=0xce;}_0x337ec5[_0xcc6a('0x1c')](_0x395a55);return _0x337ec5[_0xcc6a('0x21')](_0xcc6a('0x22'),_0x4e628f+'-'+_0x4d021a+'/'+_0x56ffb0)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x2a3994){return function(_0x1d20a3){try{jsonpatch['apply'](_0x1d20a3,_0x2a3994,!![]);}catch(_0xfec60f){return BPromise[_0xcc6a('0x23')](_0xfec60f);}return _0x1d20a3[_0xcc6a('0x24')]();};}function saveUpdates(_0x368a6e,_0x1495d8){return function(_0x30b8ed){if(_0x30b8ed){return _0x30b8ed[_0xcc6a('0x25')](_0x368a6e)[_0xcc6a('0x26')](function(_0x2254a8){return _0x2254a8;});}return null;};}function removeEntity(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['destroy']()[_0xcc6a('0x26')](function(){_0x19d32c[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x27')]();});}};}function handleEntityNotFound(_0x581aae,_0x10016a){return function(_0x294486){if(!_0x294486){_0x581aae[_0xcc6a('0x1b')](0x194);}return _0x294486;};}function handleError(_0x3ed7ce,_0x432c23){_0x432c23=_0x432c23||0x1f4;return function(_0x5fc697){logger['error'](_0x5fc697[_0xcc6a('0x28')]);if(_0x5fc697[_0xcc6a('0x29')]){delete _0x5fc697[_0xcc6a('0x29')];}_0x3ed7ce['status'](_0x432c23)[_0xcc6a('0x2a')](_0x5fc697);};}exports[_0xcc6a('0x2b')]=function(_0x4da301,_0xb377de){var _0x8b1b2b={},_0x3233d1={},_0x473f88={'count':0x0,'rows':[]};var _0x5d7399=_[_0xcc6a('0x2c')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x4f176b){return{'name':_0x4f176b[_0xcc6a('0x2f')],'type':_0x4f176b['type']['key']};});_0x3233d1[_0xcc6a('0x30')]=_[_0xcc6a('0x2c')](_0x5d7399,_0xcc6a('0x29'));_0x3233d1[_0xcc6a('0x31')]=_[_0xcc6a('0x32')](_0x4da301[_0xcc6a('0x31')]);_0x3233d1['filters']=_[_0xcc6a('0x33')](_0x3233d1[_0xcc6a('0x30')],_0x3233d1[_0xcc6a('0x31')]);_0x8b1b2b[_0xcc6a('0x34')]=_[_0xcc6a('0x33')](_0x3233d1[_0xcc6a('0x30')],qs[_0xcc6a('0x35')](_0x4da301[_0xcc6a('0x31')]['fields']));_0x8b1b2b[_0xcc6a('0x34')]=_0x8b1b2b[_0xcc6a('0x34')][_0xcc6a('0x36')]?_0x8b1b2b[_0xcc6a('0x34')]:_0x3233d1[_0xcc6a('0x30')];if(!_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x37')]('nolimit')){_0x8b1b2b[_0xcc6a('0x20')]=qs['limit'](_0x4da301['query']['limit']);_0x8b1b2b[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x1f')]);}_0x8b1b2b[_0xcc6a('0x38')]=qs['sort'](_0x4da301['query'][_0xcc6a('0x39')]);_0x8b1b2b[_0xcc6a('0x3a')]=qs[_0xcc6a('0x3b')](_['pick'](_0x4da301[_0xcc6a('0x31')],_0x3233d1[_0xcc6a('0x3b')]),_0x5d7399);if(_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x3c')]){_0x8b1b2b[_0xcc6a('0x3a')]=_[_0xcc6a('0x3d')](_0x8b1b2b[_0xcc6a('0x3a')],{'$or':_[_0xcc6a('0x2c')](_0x5d7399,function(_0x2a1cd2){if(_0x2a1cd2[_0xcc6a('0x3e')]!==_0xcc6a('0x3f')){var _0x2c14ba={};_0x2c14ba[_0x2a1cd2[_0xcc6a('0x29')]]={'$like':'%'+_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x3c')]+'%'};return _0x2c14ba;}})});}_0x8b1b2b=_[_0xcc6a('0x3d')]({},_0x8b1b2b,_0x4da301[_0xcc6a('0x40')]);var _0x386cbc={'where':_0x8b1b2b['where']};return db['SquareReport'][_0xcc6a('0x1e')](_0x386cbc)[_0xcc6a('0x26')](function(_0x16dde7){_0x473f88[_0xcc6a('0x1e')]=_0x16dde7;if(_0x4da301[_0xcc6a('0x31')][_0xcc6a('0x41')]){_0x8b1b2b[_0xcc6a('0x42')]=[{'all':!![]}];}return db[_0xcc6a('0x2d')]['findAll'](_0x8b1b2b);})['then'](function(_0x470e3b){_0x473f88['rows']=_0x470e3b;return _0x473f88;})['then'](respondWithFilteredResult(_0xb377de,_0x8b1b2b))['catch'](handleError(_0xb377de,null));};exports[_0xcc6a('0x43')]=function(_0x3eebca,_0xb42897){var _0x46e273={'raw':!![],'where':{'id':_0x3eebca['params']['id']}},_0xe8056f={};_0xe8056f[_0xcc6a('0x30')]=_[_0xcc6a('0x32')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0xe8056f[_0xcc6a('0x31')]=_[_0xcc6a('0x32')](_0x3eebca['query']);_0xe8056f[_0xcc6a('0x3b')]=_[_0xcc6a('0x33')](_0xe8056f[_0xcc6a('0x30')],_0xe8056f[_0xcc6a('0x31')]);_0x46e273['attributes']=_[_0xcc6a('0x33')](_0xe8056f['model'],qs[_0xcc6a('0x35')](_0x3eebca[_0xcc6a('0x31')][_0xcc6a('0x35')]));_0x46e273['attributes']=_0x46e273[_0xcc6a('0x34')][_0xcc6a('0x36')]?_0x46e273[_0xcc6a('0x34')]:_0xe8056f['model'];if(_0x3eebca['query'][_0xcc6a('0x41')]){_0x46e273[_0xcc6a('0x42')]=[{'all':!![]}];}_0x46e273=_[_0xcc6a('0x3d')]({},_0x46e273,_0x3eebca[_0xcc6a('0x40')]);return db[_0xcc6a('0x2d')]['find'](_0x46e273)[_0xcc6a('0x26')](handleEntityNotFound(_0xb42897,null))[_0xcc6a('0x26')](respondWithResult(_0xb42897,null))['catch'](handleError(_0xb42897,null));};exports[_0xcc6a('0x44')]=function(_0xa45d06,_0x42ffcc){return db[_0xcc6a('0x2d')][_0xcc6a('0x44')](_0xa45d06[_0xcc6a('0x45')],{})['then'](respondWithResult(_0x42ffcc,0xc9))['catch'](handleError(_0x42ffcc,null));};exports['update']=function(_0x254e83,_0x267e43){if(_0x254e83[_0xcc6a('0x45')]['id']){delete _0x254e83[_0xcc6a('0x45')]['id'];}return db['SquareReport'][_0xcc6a('0x46')]({'where':{'id':_0x254e83['params']['id']}})[_0xcc6a('0x26')](handleEntityNotFound(_0x267e43,null))[_0xcc6a('0x26')](saveUpdates(_0x254e83[_0xcc6a('0x45')],null))[_0xcc6a('0x26')](respondWithResult(_0x267e43,null))[_0xcc6a('0x47')](handleError(_0x267e43,null));};exports[_0xcc6a('0x48')]=function(_0x47b175,_0x1a3b82){return db[_0xcc6a('0x2d')][_0xcc6a('0x46')]({'where':{'id':_0x47b175[_0xcc6a('0x49')]['id']}})[_0xcc6a('0x26')](handleEntityNotFound(_0x1a3b82,null))[_0xcc6a('0x26')](removeEntity(_0x1a3b82,null))[_0xcc6a('0x47')](handleError(_0x1a3b82,null));};exports[_0xcc6a('0x4a')]=function(_0x31987f,_0x30d0ef){return db['SquareReport'][_0xcc6a('0x4a')]()[_0xcc6a('0x26')](respondWithResult(_0x30d0ef,null))[_0xcc6a('0x47')](handleError(_0x30d0ef,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f2e6a3c..84249e6 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 _0xb3e1=['../../config/environment','./squareReport.attributes','exports','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x96db05,_0x45ba65){var _0x2ed681=function(_0x59eced){while(--_0x59eced){_0x96db05['push'](_0x96db05['shift']());}};_0x2ed681(++_0x45ba65);}(_0xb3e1,0xd8));var _0x1b3e=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0xb3e1[_0x10a212];return _0x23c82b;};'use strict';var _=require(_0x1b3e('0x0'));var util=require(_0x1b3e('0x1'));var logger=require(_0x1b3e('0x2'))(_0x1b3e('0x3'));var moment=require(_0x1b3e('0x4'));var BPromise=require('bluebird');var rp=require(_0x1b3e('0x5'));var fs=require('fs');var path=require(_0x1b3e('0x6'));var rimraf=require(_0x1b3e('0x7'));var config=require(_0x1b3e('0x8'));var attributes=require(_0x1b3e('0x9'));module[_0x1b3e('0xa')]=function(_0x2b9a6f,_0x5eeb4d){return _0x2b9a6f['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1b3e('0xb'),_0x1b3e('0xc')]},{'name':_0x1b3e('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x74c3=['bluebird','request-promise','rimraf','./squareReport.attributes','define','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment'];(function(_0x40e2c0,_0x70dc14){var _0x52ded6=function(_0xaed2ff){while(--_0xaed2ff){_0x40e2c0['push'](_0x40e2c0['shift']());}};_0x52ded6(++_0x70dc14);}(_0x74c3,0x11a));var _0x374c=function(_0x29cb20,_0xc1807d){_0x29cb20=_0x29cb20-0x0;var _0x487f65=_0x74c3[_0x29cb20];return _0x487f65;};'use strict';var _=require(_0x374c('0x0'));var util=require(_0x374c('0x1'));var logger=require(_0x374c('0x2'))('api');var moment=require(_0x374c('0x3'));var BPromise=require(_0x374c('0x4'));var rp=require(_0x374c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x374c('0x6'));var config=require('../../config/environment');var attributes=require(_0x374c('0x7'));module['exports']=function(_0x23469b,_0x20d746){return _0x23469b[_0x374c('0x8')]('SquareReport',attributes,{'tableName':_0x374c('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x374c('0xa'),_0x374c('0xb')]},{'name':_0x374c('0xc'),'fields':[_0x374c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8f34fcc..bb35637 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 _0x8d0e=['../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','CreateSquareReport','debug','update','body','raw','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33f226,_0x101d32){var _0x277648=function(_0x234ba0){while(--_0x234ba0){_0x33f226['push'](_0x33f226['shift']());}};_0x277648(++_0x101d32);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3a9b9d,_0x4dd65a){_0x3a9b9d=_0x3a9b9d-0x0;var _0x3ba2f6=_0x8d0e[_0x3a9b9d];return _0x3ba2f6;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});}exports['CreateSquareReport']=function(_0x47c67a){var _0x1bdd94=this;return new Promise(function(_0x384854,_0x27b910){return db[_0xe8d0('0x16')][_0xe8d0('0x17')](_0x47c67a['body'],{'raw':_0x47c67a[_0xe8d0('0x18')]?_0x47c67a[_0xe8d0('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x554402){logger[_0xe8d0('0xd')](_0xe8d0('0x19'),_0x47c67a);logger[_0xe8d0('0x1a')](_0xe8d0('0x19'),_0x47c67a,JSON[_0xe8d0('0x10')](_0x554402));_0x384854(_0x554402);})[_0xe8d0('0x15')](function(_0x1bd25c){logger[_0xe8d0('0x11')](_0xe8d0('0x19'),_0x1bd25c['message'],_0x47c67a);_0x27b910(_0x1bdd94[_0xe8d0('0x11')](0x1f4,_0x1bd25c[_0xe8d0('0x13')]));});});};exports['UpdateSquareReport']=function(_0x106614){var _0x2e69d1=this;return new Promise(function(_0x274cac,_0xd86c76){return db[_0xe8d0('0x16')][_0xe8d0('0x1b')](_0x106614[_0xe8d0('0x1c')],{'raw':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')][_0xe8d0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106614[_0xe8d0('0x18')]?_0x106614['options'][_0xe8d0('0x1e')]||null:null,'attributes':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['attributes']||null:null,'limit':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['limit']||null:null})[_0xe8d0('0xc')](function(_0x3ffcb7){logger[_0xe8d0('0xd')](_0xe8d0('0x1f'),_0x106614);logger[_0xe8d0('0x1a')]('UpdateSquareReport',_0x106614,JSON[_0xe8d0('0x10')](_0x3ffcb7));_0x274cac(_0x3ffcb7);})['catch'](function(_0x5d3276){logger['error'](_0xe8d0('0x1f'),_0x5d3276[_0xe8d0('0x13')],_0x106614);_0xd86c76(_0x2e69d1[_0xe8d0('0x11')](0x1f4,_0x5d3276['message']));});});}; \ No newline at end of file +var _0x4b84=['CreateSquareReport','SquareReport','create','options','raw','catch','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message'];(function(_0x5b4ace,_0x411a40){var _0x32e9d9=function(_0xecb410){while(--_0xecb410){_0x5b4ace['push'](_0x5b4ace['shift']());}};_0x32e9d9(++_0x411a40);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x4b84[_0x1d7300];return _0x46ee98;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('SquareReport,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('SquareReport,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')](_0x55e258['body'],{'raw':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![]})[_0x44b8('0x7')](function(_0x102ef9){logger[_0x44b8('0x8')](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON[_0x44b8('0xc')](_0x102ef9));_0xe3de8f(_0x102ef9);})[_0x44b8('0x15')](function(_0x14996c){logger['error'](_0x44b8('0x10'),_0x14996c[_0x44b8('0xf')],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x14996c[_0x44b8('0xf')]));});});};exports[_0x44b8('0x16')]=function(_0x51a34a){var _0x402497=this;return new Promise(function(_0x54677c,_0x41a922){return db[_0x44b8('0x11')][_0x44b8('0x17')](_0x51a34a[_0x44b8('0x18')],{'raw':_0x51a34a[_0x44b8('0x13')]?_0x51a34a['options'][_0x44b8('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51a34a['options']?_0x51a34a[_0x44b8('0x13')][_0x44b8('0x19')]||null:null,'attributes':_0x51a34a['options']?_0x51a34a[_0x44b8('0x13')][_0x44b8('0x1a')]||null:null,'limit':_0x51a34a[_0x44b8('0x13')]?_0x51a34a['options'][_0x44b8('0x1b')]||null:null})[_0x44b8('0x7')](function(_0x53d9c7){logger[_0x44b8('0x8')]('UpdateSquareReport',_0x51a34a);logger[_0x44b8('0xa')]('UpdateSquareReport',_0x51a34a,JSON['stringify'](_0x53d9c7));_0x54677c(_0x53d9c7);})['catch'](function(_0x387293){logger[_0x44b8('0xd')](_0x44b8('0x16'),_0x387293[_0x44b8('0xf')],_0x51a34a);_0x41a922(_0x402497[_0x44b8('0xd')](0x1f4,_0x387293[_0x44b8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 52e7891..d117c21 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3abab9,_0x31c075){var _0x17a40b=function(_0x2acf80){while(--_0x2acf80){_0x3abab9['push'](_0x3abab9['shift']());}};_0x17a40b(++_0x31c075);}(_0x7a54,0x106));var _0x47a5=function(_0x5bbcc2,_0x5af61f){_0x5bbcc2=_0x5bbcc2-0x0;var _0x3e6ac5=_0x7a54[_0x5bbcc2];return _0x3e6ac5;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x285f53,_0x3f57f1){var _0x1dad05=function(_0x7bfc5e){while(--_0x7bfc5e){_0x285f53['push'](_0x285f53['shift']());}};_0x1dad05(++_0x3f57f1);}(_0x5f2f,0x73));var _0xf5f2=function(_0xddee7f,_0x5479f0){_0xddee7f=_0xddee7f-0x0;var _0x59682f=_0x5f2f[_0xddee7f];return _0x59682f;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c7fadfe..3d4e145 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 _0xe741=['TEXT','sequelize','exports','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe741,0xa5));var _0x1e74=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xe741[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x1e74('0x0'));module[_0x1e74('0x1')]={'uniqueid':{'type':Sequelize[_0x1e74('0x2')]},'node':{'type':Sequelize[_0x1e74('0x2')]},'application':{'type':Sequelize[_0x1e74('0x2')]},'data':{'type':Sequelize[_0x1e74('0x3')]},'project_name':{'type':Sequelize[_0x1e74('0x2')]},'callerid':{'type':Sequelize[_0x1e74('0x2')]}}; \ No newline at end of file +var _0xa002=['exports','STRING','TEXT','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa002,0x93));var _0x2a00=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa002[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x2a00('0x0'));module[_0x2a00('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x2a00('0x2')]},'application':{'type':Sequelize[_0x2a00('0x2')]},'data':{'type':Sequelize[_0x2a00('0x3')]},'project_name':{'type':Sequelize[_0x2a00('0x2')]},'callerid':{'type':Sequelize[_0x2a00('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 8d53fc6..14b2a35 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 _0x21a8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf'];(function(_0x3399bb,_0x5e7c53){var _0x1afd51=function(_0x463f5f){while(--_0x463f5f){_0x3399bb['push'](_0x3399bb['shift']());}};_0x1afd51(++_0x5e7c53);}(_0x21a8,0xed));var _0x821a=function(_0x20118f,_0xcc6843){_0x20118f=_0x20118f-0x0;var _0x145703=_0x21a8[_0x20118f];return _0x145703;};'use strict';var pdf=require(_0x821a('0x0'));var emlformat=require(_0x821a('0x1'));var rimraf=require(_0x821a('0x2'));var zipdir=require(_0x821a('0x3'));var jsonpatch=require(_0x821a('0x4'));var rp=require(_0x821a('0x5'));var moment=require(_0x821a('0x6'));var BPromise=require(_0x821a('0x7'));var Mustache=require(_0x821a('0x8'));var util=require('util');var path=require(_0x821a('0x9'));var sox=require(_0x821a('0xa'));var csv=require(_0x821a('0xb'));var ejs=require(_0x821a('0xc'));var fs=require('fs');var _=require(_0x821a('0xd'));var squel=require(_0x821a('0xe'));var crypto=require(_0x821a('0xf'));var jsforce=require(_0x821a('0x10'));var deskjs=require(_0x821a('0x11'));var toCsv=require(_0x821a('0xb'));var querystring=require(_0x821a('0x12'));var Papa=require(_0x821a('0x13'));var Redis=require(_0x821a('0x14'));var authService=require(_0x821a('0x15'));var qs=require(_0x821a('0x16'));var as=require(_0x821a('0x17'));var hardwareService=require(_0x821a('0x18'));var logger=require(_0x821a('0x19'))(_0x821a('0x1a'));var utils=require(_0x821a('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x821a('0x1c'));var db=require(_0x821a('0x1d'))['db'];function respondWithStatusCode(_0x33c39c,_0x348663){_0x348663=_0x348663||0xcc;return function(_0x3ae0a8){if(_0x3ae0a8){return _0x33c39c[_0x821a('0x1e')](_0x348663);}return _0x33c39c['status'](_0x348663)[_0x821a('0x1f')]();};}function respondWithResult(_0x10dd4a,_0x363c9c){_0x363c9c=_0x363c9c||0xc8;return function(_0x2663b8){if(_0x2663b8){return _0x10dd4a['status'](_0x363c9c)['json'](_0x2663b8);}};}function respondWithFilteredResult(_0x10c42e,_0x576479){return function(_0x716800){if(_0x716800){var _0x1f8e4a=_0x716800[_0x821a('0x20')],_0x445ab5=_0x576479['offset'],_0x1da377=_0x576479[_0x821a('0x21')]+_0x576479[_0x821a('0x22')],_0x1177e6;if(_0x1da377>=_0x1f8e4a){_0x1da377=_0x1f8e4a;_0x1177e6=0xc8;}else{_0x1177e6=0xce;}_0x10c42e[_0x821a('0x23')](_0x1177e6);return _0x10c42e['set'](_0x821a('0x24'),_0x445ab5+'-'+_0x1da377+'/'+_0x1f8e4a)[_0x821a('0x25')](_0x716800);}return null;};}function patchUpdates(_0x24b47c){return function(_0x407d95){try{jsonpatch[_0x821a('0x26')](_0x407d95,_0x24b47c,!![]);}catch(_0x111bab){return BPromise[_0x821a('0x27')](_0x111bab);}return _0x407d95['save']();};}function saveUpdates(_0x4d402e,_0x3764d1){return function(_0x1f9515){if(_0x1f9515){return _0x1f9515[_0x821a('0x28')](_0x4d402e)[_0x821a('0x29')](function(_0x17736b){return _0x17736b;});}return null;};}function removeEntity(_0x41cd15,_0x5f2de0){return function(_0x264086){if(_0x264086){return _0x264086['destroy']()[_0x821a('0x29')](function(){_0x41cd15['status'](0xcc)[_0x821a('0x1f')]();});}};}function handleEntityNotFound(_0x2ebae9,_0x1c98ab){return function(_0x42e895){if(!_0x42e895){_0x2ebae9[_0x821a('0x1e')](0x194);}return _0x42e895;};}function handleError(_0x5b2eae,_0x46fb95){_0x46fb95=_0x46fb95||0x1f4;return function(_0x4dab90){logger[_0x821a('0x2a')](_0x4dab90[_0x821a('0x2b')]);if(_0x4dab90[_0x821a('0x2c')]){delete _0x4dab90[_0x821a('0x2c')];}_0x5b2eae[_0x821a('0x23')](_0x46fb95)[_0x821a('0x2d')](_0x4dab90);};}exports[_0x821a('0x2e')]=function(_0x627e1a,_0x1bca1a){var _0x4ed4c8={},_0x242fe8={},_0x4791f6={'count':0x0,'rows':[]};var _0x4eb833=_[_0x821a('0x2f')](db[_0x821a('0x30')][_0x821a('0x31')],function(_0x10cfb0){return{'name':_0x10cfb0[_0x821a('0x32')],'type':_0x10cfb0['type'][_0x821a('0x33')]};});_0x242fe8[_0x821a('0x34')]=_['map'](_0x4eb833,_0x821a('0x2c'));_0x242fe8[_0x821a('0x35')]=_[_0x821a('0x36')](_0x627e1a[_0x821a('0x35')]);_0x242fe8[_0x821a('0x37')]=_[_0x821a('0x38')](_0x242fe8[_0x821a('0x34')],_0x242fe8['query']);_0x4ed4c8['attributes']=_[_0x821a('0x38')](_0x242fe8[_0x821a('0x34')],qs[_0x821a('0x39')](_0x627e1a['query'][_0x821a('0x39')]));_0x4ed4c8['attributes']=_0x4ed4c8[_0x821a('0x3a')]['length']?_0x4ed4c8['attributes']:_0x242fe8[_0x821a('0x34')];if(!_0x627e1a[_0x821a('0x35')][_0x821a('0x3b')]('nolimit')){_0x4ed4c8[_0x821a('0x22')]=qs[_0x821a('0x22')](_0x627e1a['query'][_0x821a('0x22')]);_0x4ed4c8[_0x821a('0x21')]=qs[_0x821a('0x21')](_0x627e1a[_0x821a('0x35')][_0x821a('0x21')]);}_0x4ed4c8[_0x821a('0x3c')]=qs[_0x821a('0x3d')](_0x627e1a[_0x821a('0x35')]['sort']);_0x4ed4c8[_0x821a('0x3e')]=qs[_0x821a('0x37')](_[_0x821a('0x3f')](_0x627e1a['query'],_0x242fe8['filters']),_0x4eb833);if(_0x627e1a[_0x821a('0x35')][_0x821a('0x40')]){_0x4ed4c8[_0x821a('0x3e')]=_[_0x821a('0x41')](_0x4ed4c8[_0x821a('0x3e')],{'$or':_[_0x821a('0x2f')](_0x4eb833,function(_0x3c4115){if(_0x3c4115['type']!==_0x821a('0x42')){var _0x3ddea0={};_0x3ddea0[_0x3c4115[_0x821a('0x2c')]]={'$like':'%'+_0x627e1a[_0x821a('0x35')][_0x821a('0x40')]+'%'};return _0x3ddea0;}})});}_0x4ed4c8=_[_0x821a('0x41')]({},_0x4ed4c8,_0x627e1a[_0x821a('0x43')]);var _0x495b6c={'where':_0x4ed4c8[_0x821a('0x3e')]};return db[_0x821a('0x30')][_0x821a('0x20')](_0x495b6c)[_0x821a('0x29')](function(_0x3be211){_0x4791f6['count']=_0x3be211;if(_0x627e1a[_0x821a('0x35')][_0x821a('0x44')]){_0x4ed4c8[_0x821a('0x45')]=[{'all':!![]}];}return db[_0x821a('0x30')][_0x821a('0x46')](_0x4ed4c8);})[_0x821a('0x29')](function(_0x1d917d){_0x4791f6[_0x821a('0x47')]=_0x1d917d;return _0x4791f6;})[_0x821a('0x29')](respondWithFilteredResult(_0x1bca1a,_0x4ed4c8))[_0x821a('0x48')](handleError(_0x1bca1a,null));};exports['show']=function(_0x2c323e,_0x4f130f){var _0x812676={'raw':!![],'where':{'id':_0x2c323e[_0x821a('0x49')]['id']}},_0x169121={};_0x169121[_0x821a('0x34')]=_[_0x821a('0x36')](db[_0x821a('0x30')][_0x821a('0x31')]);_0x169121['query']=_['keys'](_0x2c323e[_0x821a('0x35')]);_0x169121[_0x821a('0x37')]=_[_0x821a('0x38')](_0x169121['model'],_0x169121[_0x821a('0x35')]);_0x812676[_0x821a('0x3a')]=_[_0x821a('0x38')](_0x169121[_0x821a('0x34')],qs[_0x821a('0x39')](_0x2c323e['query'][_0x821a('0x39')]));_0x812676['attributes']=_0x812676['attributes'][_0x821a('0x4a')]?_0x812676[_0x821a('0x3a')]:_0x169121['model'];if(_0x2c323e[_0x821a('0x35')][_0x821a('0x44')]){_0x812676['include']=[{'all':!![]}];}_0x812676=_[_0x821a('0x41')]({},_0x812676,_0x2c323e['options']);return db['SquareDetailsReport'][_0x821a('0x4b')](_0x812676)[_0x821a('0x29')](handleEntityNotFound(_0x4f130f,null))['then'](respondWithResult(_0x4f130f,null))[_0x821a('0x48')](handleError(_0x4f130f,null));};exports[_0x821a('0x4c')]=function(_0x286153,_0x9dd9){return db['SquareDetailsReport'][_0x821a('0x4c')](_0x286153[_0x821a('0x4d')],{})['then'](respondWithResult(_0x9dd9,0xc9))['catch'](handleError(_0x9dd9,null));};exports[_0x821a('0x28')]=function(_0x3eafae,_0x290363){if(_0x3eafae[_0x821a('0x4d')]['id']){delete _0x3eafae[_0x821a('0x4d')]['id'];}return db['SquareDetailsReport'][_0x821a('0x4b')]({'where':{'id':_0x3eafae[_0x821a('0x49')]['id']}})['then'](handleEntityNotFound(_0x290363,null))[_0x821a('0x29')](saveUpdates(_0x3eafae[_0x821a('0x4d')],null))[_0x821a('0x29')](respondWithResult(_0x290363,null))['catch'](handleError(_0x290363,null));};exports[_0x821a('0x4e')]=function(_0x5889e6,_0x26d09e){return db['SquareDetailsReport'][_0x821a('0x4b')]({'where':{'id':_0x5889e6['params']['id']}})['then'](handleEntityNotFound(_0x26d09e,null))[_0x821a('0x29')](removeEntity(_0x26d09e,null))[_0x821a('0x48')](handleError(_0x26d09e,null));};exports[_0x821a('0x4f')]=function(_0x326e08,_0x29b0f5){return db[_0x821a('0x30')]['describe']()[_0x821a('0x29')](respondWithResult(_0x29b0f5,null))['catch'](handleError(_0x29b0f5,null));}; \ No newline at end of file +var _0x5b7b=['describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','error','stack','name','index','SquareDetailsReport','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','length','find','catch','create','update','body','destroy'];(function(_0x10c4dd,_0x2392ce){var _0x1d20ec=function(_0x1fed25){while(--_0x1fed25){_0x10c4dd['push'](_0x10c4dd['shift']());}};_0x1d20ec(++_0x2392ce);}(_0x5b7b,0xd9));var _0xb5b7=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x5b7b[_0x2652ef];return _0x2db578;};'use strict';var pdf=require(_0xb5b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb5b7('0x1'));var zipdir=require(_0xb5b7('0x2'));var jsonpatch=require(_0xb5b7('0x3'));var rp=require(_0xb5b7('0x4'));var moment=require(_0xb5b7('0x5'));var BPromise=require(_0xb5b7('0x6'));var Mustache=require(_0xb5b7('0x7'));var util=require(_0xb5b7('0x8'));var path=require(_0xb5b7('0x9'));var sox=require(_0xb5b7('0xa'));var csv=require(_0xb5b7('0xb'));var ejs=require(_0xb5b7('0xc'));var fs=require('fs');var _=require(_0xb5b7('0xd'));var squel=require(_0xb5b7('0xe'));var crypto=require(_0xb5b7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb5b7('0x10'));var toCsv=require(_0xb5b7('0xb'));var querystring=require(_0xb5b7('0x11'));var Papa=require('papaparse');var Redis=require(_0xb5b7('0x12'));var authService=require(_0xb5b7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb5b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5b7('0x15'))(_0xb5b7('0x16'));var utils=require(_0xb5b7('0x17'));var config=require(_0xb5b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb5b7('0x19'))['db'];function respondWithStatusCode(_0x4ac161,_0x238c19){_0x238c19=_0x238c19||0xcc;return function(_0x4a74e7){if(_0x4a74e7){return _0x4ac161[_0xb5b7('0x1a')](_0x238c19);}return _0x4ac161[_0xb5b7('0x1b')](_0x238c19)[_0xb5b7('0x1c')]();};}function respondWithResult(_0x3997e9,_0x5dfc5b){_0x5dfc5b=_0x5dfc5b||0xc8;return function(_0x52ce80){if(_0x52ce80){return _0x3997e9[_0xb5b7('0x1b')](_0x5dfc5b)[_0xb5b7('0x1d')](_0x52ce80);}};}function respondWithFilteredResult(_0x869820,_0x2ef5c3){return function(_0x107394){if(_0x107394){var _0x23fa74=_0x107394[_0xb5b7('0x1e')],_0x234129=_0x2ef5c3[_0xb5b7('0x1f')],_0x16b71b=_0x2ef5c3[_0xb5b7('0x1f')]+_0x2ef5c3[_0xb5b7('0x20')],_0x3314df;if(_0x16b71b>=_0x23fa74){_0x16b71b=_0x23fa74;_0x3314df=0xc8;}else{_0x3314df=0xce;}_0x869820[_0xb5b7('0x1b')](_0x3314df);return _0x869820[_0xb5b7('0x21')]('Content-Range',_0x234129+'-'+_0x16b71b+'/'+_0x23fa74)[_0xb5b7('0x1d')](_0x107394);}return null;};}function patchUpdates(_0x3bc0b2){return function(_0x5638a3){try{jsonpatch['apply'](_0x5638a3,_0x3bc0b2,!![]);}catch(_0x3bf4b2){return BPromise[_0xb5b7('0x22')](_0x3bf4b2);}return _0x5638a3[_0xb5b7('0x23')]();};}function saveUpdates(_0x3f0686,_0x608137){return function(_0x1fcb4c){if(_0x1fcb4c){return _0x1fcb4c['update'](_0x3f0686)[_0xb5b7('0x24')](function(_0x2d1e10){return _0x2d1e10;});}return null;};}function removeEntity(_0x39cfb6,_0x5451af){return function(_0x4496be){if(_0x4496be){return _0x4496be['destroy']()['then'](function(){_0x39cfb6[_0xb5b7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d2c0,_0x589c24){return function(_0x3cdb4a){if(!_0x3cdb4a){_0x28d2c0[_0xb5b7('0x1a')](0x194);}return _0x3cdb4a;};}function handleError(_0x456d53,_0x55554e){_0x55554e=_0x55554e||0x1f4;return function(_0x3cc941){logger[_0xb5b7('0x25')](_0x3cc941[_0xb5b7('0x26')]);if(_0x3cc941['name']){delete _0x3cc941[_0xb5b7('0x27')];}_0x456d53[_0xb5b7('0x1b')](_0x55554e)['send'](_0x3cc941);};}exports[_0xb5b7('0x28')]=function(_0x689461,_0x37500f){var _0x13f628={},_0xca0053={},_0x55ed15={'count':0x0,'rows':[]};var _0xb6d531=_['map'](db[_0xb5b7('0x29')]['rawAttributes'],function(_0x83c22b){return{'name':_0x83c22b[_0xb5b7('0x2a')],'type':_0x83c22b[_0xb5b7('0x2b')]['key']};});_0xca0053[_0xb5b7('0x2c')]=_[_0xb5b7('0x2d')](_0xb6d531,_0xb5b7('0x27'));_0xca0053[_0xb5b7('0x2e')]=_[_0xb5b7('0x2f')](_0x689461[_0xb5b7('0x2e')]);_0xca0053[_0xb5b7('0x30')]=_['intersection'](_0xca0053[_0xb5b7('0x2c')],_0xca0053['query']);_0x13f628[_0xb5b7('0x31')]=_[_0xb5b7('0x32')](_0xca0053[_0xb5b7('0x2c')],qs['fields'](_0x689461[_0xb5b7('0x2e')][_0xb5b7('0x33')]));_0x13f628[_0xb5b7('0x31')]=_0x13f628['attributes']['length']?_0x13f628[_0xb5b7('0x31')]:_0xca0053[_0xb5b7('0x2c')];if(!_0x689461[_0xb5b7('0x2e')][_0xb5b7('0x34')](_0xb5b7('0x35'))){_0x13f628[_0xb5b7('0x20')]=qs[_0xb5b7('0x20')](_0x689461[_0xb5b7('0x2e')][_0xb5b7('0x20')]);_0x13f628[_0xb5b7('0x1f')]=qs[_0xb5b7('0x1f')](_0x689461['query'][_0xb5b7('0x1f')]);}_0x13f628['order']=qs[_0xb5b7('0x36')](_0x689461[_0xb5b7('0x2e')][_0xb5b7('0x36')]);_0x13f628[_0xb5b7('0x37')]=qs[_0xb5b7('0x30')](_[_0xb5b7('0x38')](_0x689461[_0xb5b7('0x2e')],_0xca0053[_0xb5b7('0x30')]),_0xb6d531);if(_0x689461[_0xb5b7('0x2e')][_0xb5b7('0x39')]){_0x13f628[_0xb5b7('0x37')]=_[_0xb5b7('0x3a')](_0x13f628[_0xb5b7('0x37')],{'$or':_['map'](_0xb6d531,function(_0x25d4dd){if(_0x25d4dd[_0xb5b7('0x2b')]!==_0xb5b7('0x3b')){var _0x5b6efd={};_0x5b6efd[_0x25d4dd[_0xb5b7('0x27')]]={'$like':'%'+_0x689461['query'][_0xb5b7('0x39')]+'%'};return _0x5b6efd;}})});}_0x13f628=_[_0xb5b7('0x3a')]({},_0x13f628,_0x689461['options']);var _0x47f1ed={'where':_0x13f628[_0xb5b7('0x37')]};return db[_0xb5b7('0x29')][_0xb5b7('0x1e')](_0x47f1ed)[_0xb5b7('0x24')](function(_0x1eeb9a){_0x55ed15[_0xb5b7('0x1e')]=_0x1eeb9a;if(_0x689461[_0xb5b7('0x2e')][_0xb5b7('0x3c')]){_0x13f628[_0xb5b7('0x3d')]=[{'all':!![]}];}return db[_0xb5b7('0x29')]['findAll'](_0x13f628);})[_0xb5b7('0x24')](function(_0x43b587){_0x55ed15[_0xb5b7('0x3e')]=_0x43b587;return _0x55ed15;})[_0xb5b7('0x24')](respondWithFilteredResult(_0x37500f,_0x13f628))['catch'](handleError(_0x37500f,null));};exports['show']=function(_0x2bfa19,_0x29f95c){var _0x2521b6={'raw':!![],'where':{'id':_0x2bfa19[_0xb5b7('0x3f')]['id']}},_0x7fcd8c={};_0x7fcd8c[_0xb5b7('0x2c')]=_[_0xb5b7('0x2f')](db[_0xb5b7('0x29')]['rawAttributes']);_0x7fcd8c[_0xb5b7('0x2e')]=_[_0xb5b7('0x2f')](_0x2bfa19['query']);_0x7fcd8c[_0xb5b7('0x30')]=_[_0xb5b7('0x32')](_0x7fcd8c[_0xb5b7('0x2c')],_0x7fcd8c['query']);_0x2521b6['attributes']=_[_0xb5b7('0x32')](_0x7fcd8c[_0xb5b7('0x2c')],qs[_0xb5b7('0x33')](_0x2bfa19['query'][_0xb5b7('0x33')]));_0x2521b6[_0xb5b7('0x31')]=_0x2521b6[_0xb5b7('0x31')][_0xb5b7('0x40')]?_0x2521b6[_0xb5b7('0x31')]:_0x7fcd8c['model'];if(_0x2bfa19[_0xb5b7('0x2e')]['includeAll']){_0x2521b6['include']=[{'all':!![]}];}_0x2521b6=_[_0xb5b7('0x3a')]({},_0x2521b6,_0x2bfa19['options']);return db[_0xb5b7('0x29')][_0xb5b7('0x41')](_0x2521b6)[_0xb5b7('0x24')](handleEntityNotFound(_0x29f95c,null))[_0xb5b7('0x24')](respondWithResult(_0x29f95c,null))[_0xb5b7('0x42')](handleError(_0x29f95c,null));};exports[_0xb5b7('0x43')]=function(_0x4665a1,_0x12e579){return db[_0xb5b7('0x29')][_0xb5b7('0x43')](_0x4665a1['body'],{})[_0xb5b7('0x24')](respondWithResult(_0x12e579,0xc9))[_0xb5b7('0x42')](handleError(_0x12e579,null));};exports[_0xb5b7('0x44')]=function(_0x37d467,_0x5a0492){if(_0x37d467[_0xb5b7('0x45')]['id']){delete _0x37d467[_0xb5b7('0x45')]['id'];}return db['SquareDetailsReport'][_0xb5b7('0x41')]({'where':{'id':_0x37d467['params']['id']}})[_0xb5b7('0x24')](handleEntityNotFound(_0x5a0492,null))[_0xb5b7('0x24')](saveUpdates(_0x37d467[_0xb5b7('0x45')],null))[_0xb5b7('0x24')](respondWithResult(_0x5a0492,null))[_0xb5b7('0x42')](handleError(_0x5a0492,null));};exports[_0xb5b7('0x46')]=function(_0x15347a,_0x3f3590){return db[_0xb5b7('0x29')][_0xb5b7('0x41')]({'where':{'id':_0x15347a[_0xb5b7('0x3f')]['id']}})[_0xb5b7('0x24')](handleEntityNotFound(_0x3f3590,null))[_0xb5b7('0x24')](removeEntity(_0x3f3590,null))[_0xb5b7('0x42')](handleError(_0x3f3590,null));};exports[_0xb5b7('0x47')]=function(_0x22427b,_0x4b7544){return db[_0xb5b7('0x29')][_0xb5b7('0x47')]()['then'](respondWithResult(_0x4b7544,null))[_0xb5b7('0x42')](handleError(_0x4b7544,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3819854..56ea46b 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 _0x2168=['report_square_details','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport'];(function(_0x22ddc0,_0x4b8b8a){var _0x39634=function(_0x1804af){while(--_0x1804af){_0x22ddc0['push'](_0x22ddc0['shift']());}};_0x39634(++_0x4b8b8a);}(_0x2168,0x112));var _0x8216=function(_0x909792,_0x404e59){_0x909792=_0x909792-0x0;var _0x798314=_0x2168[_0x909792];return _0x798314;};'use strict';var _=require(_0x8216('0x0'));var util=require(_0x8216('0x1'));var logger=require('../../config/logger')(_0x8216('0x2'));var moment=require(_0x8216('0x3'));var BPromise=require(_0x8216('0x4'));var rp=require(_0x8216('0x5'));var fs=require('fs');var path=require(_0x8216('0x6'));var rimraf=require(_0x8216('0x7'));var config=require(_0x8216('0x8'));var attributes=require(_0x8216('0x9'));module[_0x8216('0xa')]=function(_0x181e70,_0x32fb7b){return _0x181e70['define'](_0x8216('0xb'),attributes,{'tableName':_0x8216('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc1=['bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','lodash','util','../../config/logger','api','moment'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x9bc1,0x163));var _0x19bc=function(_0x2c5ce4,_0x1b4766){_0x2c5ce4=_0x2c5ce4-0x0;var _0x4060a3=_0x9bc1[_0x2c5ce4];return _0x4060a3;};'use strict';var _=require(_0x19bc('0x0'));var util=require(_0x19bc('0x1'));var logger=require(_0x19bc('0x2'))(_0x19bc('0x3'));var moment=require(_0x19bc('0x4'));var BPromise=require(_0x19bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19bc('0x6'));var rimraf=require(_0x19bc('0x7'));var config=require(_0x19bc('0x8'));var attributes=require(_0x19bc('0x9'));module[_0x19bc('0xa')]=function(_0x9fef0f,_0x1fadc0){return _0x9fef0f['define'](_0x19bc('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 4f04aa8..85d82e9 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 _0x612a=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareDetailsReport','create','options','raw','CreateSquareDetailsReport','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x6dff11,_0x1df1cf){var _0x5b6012=function(_0x16880c){while(--_0x16880c){_0x6dff11['push'](_0x6dff11['shift']());}};_0x5b6012(++_0x1df1cf);}(_0x612a,0xab));var _0xa612=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x612a[_0x46428c];return _0x16a677;};'use strict';var _=require(_0xa612('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa612('0x1'));var rs=require(_0xa612('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa612('0x3'))['db'];var utils=require(_0xa612('0x4'));var logger=require(_0xa612('0x5'))(_0xa612('0x6'));var config=require(_0xa612('0x7'));var jayson=require(_0xa612('0x8'));var client=jayson['client'][_0xa612('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x853b75,_0x469c8b,_0x489d08){return new BPromise(function(_0x519d1a,_0x5a9939){return client['request'](_0x853b75,_0x489d08)[_0xa612('0xa')](function(_0x8c7102){logger[_0xa612('0xb')](_0xa612('0xc'),_0x469c8b,_0xa612('0xd'));logger[_0xa612('0xe')](_0xa612('0xf'),_0x469c8b,_0xa612('0xd'),JSON['stringify'](_0x8c7102));if(_0x8c7102['error']){if(_0x8c7102[_0xa612('0x10')][_0xa612('0x11')]===0x1f4){logger[_0xa612('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x469c8b,_0x8c7102['error'][_0xa612('0x12')]);return _0x5a9939(_0x8c7102[_0xa612('0x10')][_0xa612('0x12')]);}logger['error'](_0xa612('0xc'),_0x469c8b,_0x8c7102[_0xa612('0x10')][_0xa612('0x12')]);return _0x519d1a(_0x8c7102['error'][_0xa612('0x12')]);}else{logger[_0xa612('0xb')](_0xa612('0xc'),_0x469c8b,_0xa612('0xd'));_0x519d1a(_0x8c7102['result'][_0xa612('0x12')]);}})[_0xa612('0x13')](function(_0x4f5d47){logger[_0xa612('0x10')](_0xa612('0xc'),_0x469c8b,_0x4f5d47);_0x5a9939(_0x4f5d47);});});}exports['CreateSquareDetailsReport']=function(_0x33008c){var _0x593d77=this;return new Promise(function(_0x156900,_0x4568b6){return db[_0xa612('0x14')][_0xa612('0x15')](_0x33008c['body'],{'raw':_0x33008c[_0xa612('0x16')]?_0x33008c[_0xa612('0x16')][_0xa612('0x17')]===undefined?!![]:![]:!![]})[_0xa612('0xa')](function(_0x38d622){logger[_0xa612('0xb')](_0xa612('0x18'),_0x33008c);logger[_0xa612('0xe')](_0xa612('0x18'),_0x33008c,JSON[_0xa612('0x19')](_0x38d622));_0x156900(_0x38d622);})[_0xa612('0x13')](function(_0x7babac){logger['error']('CreateSquareDetailsReport',_0x7babac[_0xa612('0x12')],_0x33008c);_0x4568b6(_0x593d77[_0xa612('0x10')](0x1f4,_0x7babac['message']));});});}; \ No newline at end of file +var _0x6110=['CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6110,0x87));var _0x0611=function(_0x5c6bdc,_0x172fd9){_0x5c6bdc=_0x5c6bdc-0x0;var _0x451307=_0x6110[_0x5c6bdc];return _0x451307;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0611('0x0'));var rs=require(_0x0611('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0611('0x2'));var logger=require(_0x0611('0x3'))('rpc');var config=require(_0x0611('0x4'));var jayson=require(_0x0611('0x5'));var client=jayson[_0x0611('0x6')][_0x0611('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e3575,_0x2e669d,_0x31bfe5){return new BPromise(function(_0x2cc314,_0x3f0b8f){return client[_0x0611('0x8')](_0x3e3575,_0x31bfe5)[_0x0611('0x9')](function(_0x14e38c){logger[_0x0611('0xa')](_0x0611('0xb'),_0x2e669d,_0x0611('0xc'));logger[_0x0611('0xd')](_0x0611('0xe'),_0x2e669d,_0x0611('0xc'),JSON[_0x0611('0xf')](_0x14e38c));if(_0x14e38c['error']){if(_0x14e38c[_0x0611('0x10')][_0x0611('0x11')]===0x1f4){logger['error'](_0x0611('0xb'),_0x2e669d,_0x14e38c[_0x0611('0x10')][_0x0611('0x12')]);return _0x3f0b8f(_0x14e38c[_0x0611('0x10')][_0x0611('0x12')]);}logger[_0x0611('0x10')](_0x0611('0xb'),_0x2e669d,_0x14e38c[_0x0611('0x10')]['message']);return _0x2cc314(_0x14e38c[_0x0611('0x10')][_0x0611('0x12')]);}else{logger[_0x0611('0xa')](_0x0611('0xb'),_0x2e669d,_0x0611('0xc'));_0x2cc314(_0x14e38c[_0x0611('0x13')][_0x0611('0x12')]);}})[_0x0611('0x14')](function(_0x4d9d72){logger[_0x0611('0x10')](_0x0611('0xb'),_0x2e669d,_0x4d9d72);_0x3f0b8f(_0x4d9d72);});});}exports[_0x0611('0x15')]=function(_0xc9e3d3){var _0x39d14f=this;return new Promise(function(_0x2830ad,_0x2579e8){return db[_0x0611('0x16')][_0x0611('0x17')](_0xc9e3d3['body'],{'raw':_0xc9e3d3[_0x0611('0x18')]?_0xc9e3d3[_0x0611('0x18')][_0x0611('0x19')]===undefined?!![]:![]:!![]})[_0x0611('0x9')](function(_0x2aef23){logger['info'](_0x0611('0x15'),_0xc9e3d3);logger[_0x0611('0xd')](_0x0611('0x15'),_0xc9e3d3,JSON[_0x0611('0xf')](_0x2aef23));_0x2830ad(_0x2aef23);})[_0x0611('0x14')](function(_0x25110f){logger[_0x0611('0x10')](_0x0611('0x15'),_0x25110f['message'],_0xc9e3d3);_0x2579e8(_0x39d14f[_0x0611('0x10')](0x1f4,_0x25110f[_0x0611('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 4a83c44..4777441 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 _0x4774=['index','/process/:pid/kill','isAuthenticated','killProcess','express','Router','get'];(function(_0x1ee2b3,_0x54762c){var _0x5f460b=function(_0x5e8180){while(--_0x5e8180){_0x1ee2b3['push'](_0x1ee2b3['shift']());}};_0x5f460b(++_0x54762c);}(_0x4774,0x1e7));var _0x4477=function(_0x25cfae,_0x38a3ad){_0x25cfae=_0x25cfae-0x0;var _0x95e943=_0x4774[_0x25cfae];return _0x95e943;};'use strict';var express=require(_0x4477('0x0'));var router=express[_0x4477('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x4477('0x2')]('/',auth['isAuthenticated'](),controller[_0x4477('0x3')]);router[_0x4477('0x2')](_0x4477('0x4'),auth[_0x4477('0x5')](),controller[_0x4477('0x6')]);module['exports']=router; \ No newline at end of file +var _0xe7ae=['../../components/auth/service','./system.controller','isAuthenticated','get','/process/:pid/kill','killProcess'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0xe7ae,0x192));var _0xee7a=function(_0x43f9ba,_0x454402){_0x43f9ba=_0x43f9ba-0x0;var _0x7b5d7e=_0xe7ae[_0x43f9ba];return _0x7b5d7e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xee7a('0x0'));var controller=require(_0xee7a('0x1'));router['get']('/',auth[_0xee7a('0x2')](),controller['index']);router[_0xee7a('0x3')](_0xee7a('0x4'),auth[_0xee7a('0x2')](),controller[_0xee7a('0x5')]);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 88a8f69..5fb8d7e 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 _0xf62e=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','api','util','bluebird'];(function(_0x4a3061,_0x1c5d9c){var _0x1805dc=function(_0x8a12ec){while(--_0x8a12ec){_0x4a3061['push'](_0x4a3061['shift']());}};_0x1805dc(++_0x1c5d9c);}(_0xf62e,0xa8));var _0xef62=function(_0x113c21,_0x7216a0){_0x113c21=_0x113c21-0x0;var _0xad24f6=_0xf62e[_0x113c21];return _0xad24f6;};'use strict';var info=require(_0xef62('0x0'));var exec=require(_0xef62('0x1'))['exec'];var logger=require(_0xef62('0x2'))(_0xef62('0x3'));var util=require(_0xef62('0x4'));var BPromise=require(_0xef62('0x5'));var _=require(_0xef62('0x6'));function handleError(_0xd9c562,_0x484a54,_0x218cbe){_0x484a54=_0x484a54||0x1f4;return function(_0x5685de){logger[_0xef62('0x7')](_0xef62('0x8'),_0x218cbe,_0x484a54,util[_0xef62('0x9')](_0x5685de,{'showHidden':![],'depth':null}));delete _0x5685de[_0xef62('0xa')];_0xd9c562[_0xef62('0xb')](_0x484a54)['send'](_0x5685de);};}exports[_0xef62('0xc')]=function(_0x492cf1,_0x15bf9e){return info[_0xef62('0xd')]()[_0xef62('0xe')](function(_0x54eada){return _0x15bf9e[_0xef62('0xb')](0xc8)[_0xef62('0xf')](_0x54eada);})[_0xef62('0x10')](function(_0x15c38c){return _0x15bf9e[_0xef62('0xb')](0x1f4)[_0xef62('0xf')](_0x15c38c);});};exports['killProcess']=function(_0x32c18f,_0x3d937f){var _0x158669=['components/import/cm'];return new BPromise(function(_0x59eda2,_0x3bd40d){return exec(util[_0xef62('0x11')](_0xef62('0x12'),_0x32c18f[_0xef62('0x13')][_0xef62('0x14')]),function(_0x58be16,_0x355884,_0x5aef99){if(_0x58be16){return _0x3bd40d(_0x58be16);}return _0x59eda2(_0x355884);});})[_0xef62('0xe')](function(_0x301704){var _0x142c1b=![];var _0x58d5b3=_0x301704[_0xef62('0x15')](/\n/);for(var _0x46a375=0x0,_0x4d2ad9=_0x158669[_0xef62('0x16')];_0x46a375<_0x4d2ad9,_0x142c1b===![];_0x46a375+=0x1){if(_0x301704[_0xef62('0x17')](_0x158669[_0x46a375])>=0x0){_0x142c1b=!![];}}if(!_0x142c1b){throw new Error(util['format'](_0xef62('0x18'),_0x32c18f[_0xef62('0x13')][_0xef62('0x14')]));}process[_0xef62('0x19')](_0x32c18f[_0xef62('0x13')][_0xef62('0x14')],_0xef62('0x1a'));return _0x3d937f[_0xef62('0xb')](0xc8)[_0xef62('0xf')]({'message':util[_0xef62('0x11')](_0xef62('0x1b'),_0x32c18f['params'][_0xef62('0x14')])});})[_0xef62('0x10')](handleError(_0x3d937f,null,_0xef62('0x1c')));}; \ No newline at end of file +var _0x582a=['../../config/logger','api','util','bluebird','error','inspect','status','index','getAllData','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','format','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec'];(function(_0x425b19,_0x2dcf14){var _0x15ecab=function(_0x317d46){while(--_0x317d46){_0x425b19['push'](_0x425b19['shift']());}};_0x15ecab(++_0x2dcf14);}(_0x582a,0x135));var _0xa582=function(_0x179320,_0x41f6c9){_0x179320=_0x179320-0x0;var _0x503481=_0x582a[_0x179320];return _0x503481;};'use strict';var info=require(_0xa582('0x0'));var exec=require(_0xa582('0x1'))[_0xa582('0x2')];var logger=require(_0xa582('0x3'))(_0xa582('0x4'));var util=require(_0xa582('0x5'));var BPromise=require(_0xa582('0x6'));var _=require('lodash');function handleError(_0x2ea70c,_0x2c31e0,_0x501e0a){_0x2c31e0=_0x2c31e0||0x1f4;return function(_0x19e835){logger[_0xa582('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x501e0a,_0x2c31e0,util[_0xa582('0x8')](_0x19e835,{'showHidden':![],'depth':null}));delete _0x19e835['name'];_0x2ea70c[_0xa582('0x9')](_0x2c31e0)['send'](_0x19e835);};}exports[_0xa582('0xa')]=function(_0x5454d9,_0x4170d3){return info[_0xa582('0xb')]()['then'](function(_0x80a760){return _0x4170d3['status'](0xc8)['json'](_0x80a760);})[_0xa582('0xc')](function(_0xbeca2a){return _0x4170d3[_0xa582('0x9')](0x1f4)[_0xa582('0xd')](_0xbeca2a);});};exports[_0xa582('0xe')]=function(_0x21114d,_0x3d3ee){var _0xeb86d5=[_0xa582('0xf')];return new BPromise(function(_0x2b2913,_0x337169){return exec(util['format'](_0xa582('0x10'),_0x21114d[_0xa582('0x11')][_0xa582('0x12')]),function(_0x57abb3,_0x579b31,_0xad5e7c){if(_0x57abb3){return _0x337169(_0x57abb3);}return _0x2b2913(_0x579b31);});})[_0xa582('0x13')](function(_0x48d6ca){var _0x420a39=![];var _0x4ff6a7=_0x48d6ca[_0xa582('0x14')](/\n/);for(var _0x49c51b=0x0,_0x399f08=_0xeb86d5[_0xa582('0x15')];_0x49c51b<_0x399f08,_0x420a39===![];_0x49c51b+=0x1){if(_0x48d6ca[_0xa582('0x16')](_0xeb86d5[_0x49c51b])>=0x0){_0x420a39=!![];}}if(!_0x420a39){throw new Error(util[_0xa582('0x17')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x21114d[_0xa582('0x11')][_0xa582('0x12')]));}process['kill'](_0x21114d[_0xa582('0x11')][_0xa582('0x12')],_0xa582('0x18'));return _0x3d3ee[_0xa582('0x9')](0xc8)[_0xa582('0xd')]({'message':util[_0xa582('0x17')](_0xa582('0x19'),_0x21114d[_0xa582('0x11')]['pid'])});})[_0xa582('0xc')](handleError(_0x3d3ee,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 41528f9..9030741 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 _0x6f0d=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0x39483b,_0x45d057){var _0x1a3faa=function(_0x3d2810){while(--_0x3d2810){_0x39483b['push'](_0x39483b['shift']());}};_0x1a3faa(++_0x45d057);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x268fc9,_0x2d5b7a){_0x268fc9=_0x268fc9-0x0;var _0x3613bb=_0x6f0d[_0x268fc9];return _0x3613bb;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6f0('0xe')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xf')]);router[_0xd6f0('0x10')]('/:id',auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file +var _0x2dae=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x43194d,_0xfd818){var _0x324975=function(_0x21d2a2){while(--_0x21d2a2){_0x43194d['push'](_0x43194d['shift']());}};_0x324975(++_0xfd818);}(_0x2dae,0xc3));var _0xe2da=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x2dae[_0x57add2];return _0x4e3670;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var auth=require(_0xe2da('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe2da('0x6'));var controller=require(_0xe2da('0x7'));router[_0xe2da('0x8')]('/',auth[_0xe2da('0x9')](),controller['index']);router[_0xe2da('0x8')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0xb')]);router[_0xe2da('0xc')]('/',auth[_0xe2da('0x9')](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')](_0xe2da('0xa'),auth['isAuthenticated'](),controller[_0xe2da('0xf')]);router[_0xe2da('0x10')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0x11')]);module[_0xe2da('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 928b557..db24ce9 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 _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x23b57c,_0xdc7f98){var _0x4c3b1d=function(_0x283147){while(--_0x283147){_0x23b57c['push'](_0x23b57c['shift']());}};_0x4c3b1d(++_0xdc7f98);}(_0x4fc2,0x111));var _0x24fc=function(_0x42f1e6,_0x372465){_0x42f1e6=_0x42f1e6-0x0;var _0xea2816=_0x4fc2[_0x42f1e6];return _0xea2816;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file +var _0xac4a=['exports','STRING','name','#0091EA','sequelize'];(function(_0x2b7f4d,_0x5ab790){var _0x5b8bfd=function(_0x5dfb28){while(--_0x5dfb28){_0x2b7f4d['push'](_0x2b7f4d['shift']());}};_0x5b8bfd(++_0x5ab790);}(_0xac4a,0x13f));var _0xaac4=function(_0x21cd95,_0x4fccdf){_0x21cd95=_0x21cd95-0x0;var _0x1d2140=_0xac4a[_0x21cd95];return _0x1d2140;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'unique':_0xaac4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c8c067a..eda9794 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 _0xa491=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','Tag','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','rawAttributes','length','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','jsforce','desk.js'];(function(_0x242f39,_0x45c706){var _0x58c51c=function(_0x26e672){while(--_0x26e672){_0x242f39['push'](_0x242f39['shift']());}};_0x58c51c(++_0x45c706);}(_0xa491,0xe8));var _0x1a49=function(_0x3f8204,_0x1568e2){_0x3f8204=_0x3f8204-0x0;var _0x56b8f3=_0xa491[_0x3f8204];return _0x56b8f3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a49('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a49('0x1'));var rp=require(_0x1a49('0x2'));var moment=require(_0x1a49('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a49('0x4'));var path=require(_0x1a49('0x5'));var sox=require(_0x1a49('0x6'));var csv=require('to-csv');var ejs=require(_0x1a49('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1a49('0x8'));var crypto=require('crypto');var jsforce=require(_0x1a49('0x9'));var deskjs=require(_0x1a49('0xa'));var toCsv=require(_0x1a49('0xb'));var querystring=require(_0x1a49('0xc'));var Papa=require(_0x1a49('0xd'));var Redis=require(_0x1a49('0xe'));var authService=require(_0x1a49('0xf'));var qs=require(_0x1a49('0x10'));var as=require(_0x1a49('0x11'));var hardwareService=require(_0x1a49('0x12'));var logger=require(_0x1a49('0x13'))(_0x1a49('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a49('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d8d4,_0x14f78d){_0x14f78d=_0x14f78d||0xcc;return function(_0x11384c){if(_0x11384c){return _0x27d8d4[_0x1a49('0x16')](_0x14f78d);}return _0x27d8d4[_0x1a49('0x17')](_0x14f78d)['end']();};}function respondWithResult(_0x35acfa,_0x5b06e1){_0x5b06e1=_0x5b06e1||0xc8;return function(_0x56a872){if(_0x56a872){return _0x35acfa[_0x1a49('0x17')](_0x5b06e1)[_0x1a49('0x18')](_0x56a872);}};}function respondWithFilteredResult(_0x4ab33b,_0x25d329){return function(_0x200be9){if(_0x200be9){var _0x2bbc01=_0x200be9['count'],_0x3718bf=_0x25d329['offset'],_0x280d43=_0x25d329['offset']+_0x25d329['limit'],_0x19a186;if(_0x280d43>=_0x2bbc01){_0x280d43=_0x2bbc01;_0x19a186=0xc8;}else{_0x19a186=0xce;}_0x4ab33b['status'](_0x19a186);return _0x4ab33b['set'](_0x1a49('0x19'),_0x3718bf+'-'+_0x280d43+'/'+_0x2bbc01)[_0x1a49('0x18')](_0x200be9);}return null;};}function patchUpdates(_0x289197){return function(_0x145e78){try{jsonpatch[_0x1a49('0x1a')](_0x145e78,_0x289197,!![]);}catch(_0x4ae914){return BPromise[_0x1a49('0x1b')](_0x4ae914);}return _0x145e78['save']();};}function saveUpdates(_0x34c9c4,_0x8f35e){return function(_0x4e30cf){if(_0x4e30cf){return _0x4e30cf[_0x1a49('0x1c')](_0x34c9c4)[_0x1a49('0x1d')](function(_0x45b27a){return _0x45b27a;});}return null;};}function removeEntity(_0x3f1cdd,_0x1645e5){return function(_0x50b3da){if(_0x50b3da){return _0x50b3da['destroy']()[_0x1a49('0x1d')](function(){var _0x47f26b=_0x50b3da[_0x1a49('0x1e')]({'plain':!![]});var _0x3a785f='Tags';return db[_0x1a49('0x1f')][_0x1a49('0x20')]({'where':{'type':_0x3a785f,'resourceId':_0x47f26b['id']}})['then'](function(){return _0x50b3da;});})[_0x1a49('0x1d')](function(){_0x3f1cdd['status'](0xcc)[_0x1a49('0x21')]();});}};}function handleEntityNotFound(_0x2e6ec9,_0x2468a7){return function(_0x45daf7){if(!_0x45daf7){_0x2e6ec9[_0x1a49('0x16')](0x194);}return _0x45daf7;};}function handleError(_0xf93fb9,_0x3e1635){_0x3e1635=_0x3e1635||0x1f4;return function(_0x1aaa62){logger['error'](_0x1aaa62[_0x1a49('0x22')]);if(_0x1aaa62[_0x1a49('0x23')]){delete _0x1aaa62['name'];}_0xf93fb9[_0x1a49('0x17')](_0x3e1635)[_0x1a49('0x24')](_0x1aaa62);};}exports[_0x1a49('0x25')]=function(_0x25185b,_0x7bd96e){var _0x4295fb={},_0x32fb1f={},_0xebf05f={'count':0x0,'rows':[]};var _0x2ac025=_[_0x1a49('0x26')](db[_0x1a49('0x27')]['rawAttributes'],function(_0x2856fb){return{'name':_0x2856fb[_0x1a49('0x28')],'type':_0x2856fb[_0x1a49('0x29')][_0x1a49('0x2a')]};});_0x32fb1f[_0x1a49('0x2b')]=_[_0x1a49('0x26')](_0x2ac025,'name');_0x32fb1f['query']=_[_0x1a49('0x2c')](_0x25185b[_0x1a49('0x2d')]);_0x32fb1f[_0x1a49('0x2e')]=_['intersection'](_0x32fb1f['model'],_0x32fb1f[_0x1a49('0x2d')]);_0x4295fb[_0x1a49('0x2f')]=_[_0x1a49('0x30')](_0x32fb1f['model'],qs['fields'](_0x25185b['query'][_0x1a49('0x31')]));_0x4295fb[_0x1a49('0x2f')]=_0x4295fb[_0x1a49('0x2f')]['length']?_0x4295fb[_0x1a49('0x2f')]:_0x32fb1f['model'];if(!_0x25185b[_0x1a49('0x2d')][_0x1a49('0x32')](_0x1a49('0x33'))){_0x4295fb[_0x1a49('0x34')]=qs[_0x1a49('0x34')](_0x25185b[_0x1a49('0x2d')][_0x1a49('0x34')]);_0x4295fb[_0x1a49('0x35')]=qs['offset'](_0x25185b[_0x1a49('0x2d')][_0x1a49('0x35')]);}_0x4295fb[_0x1a49('0x36')]=qs[_0x1a49('0x37')](_0x25185b[_0x1a49('0x2d')][_0x1a49('0x37')]);_0x4295fb['where']=qs[_0x1a49('0x2e')](_[_0x1a49('0x38')](_0x25185b[_0x1a49('0x2d')],_0x32fb1f[_0x1a49('0x2e')]),_0x2ac025);if(_0x25185b[_0x1a49('0x2d')][_0x1a49('0x39')]){_0x4295fb[_0x1a49('0x3a')]=_[_0x1a49('0x3b')](_0x4295fb[_0x1a49('0x3a')],{'$or':_[_0x1a49('0x26')](_0x2ac025,function(_0xeb056d){if(_0xeb056d[_0x1a49('0x29')]!==_0x1a49('0x3c')){var _0x44c0b2={};_0x44c0b2[_0xeb056d['name']]={'$like':'%'+_0x25185b[_0x1a49('0x2d')]['filter']+'%'};return _0x44c0b2;}})});}_0x4295fb=_['merge']({},_0x4295fb,_0x25185b['options']);var _0x4c5952={'where':_0x4295fb['where']};return db[_0x1a49('0x27')][_0x1a49('0x3d')](_0x4c5952)['then'](function(_0x3b0ecc){_0xebf05f[_0x1a49('0x3d')]=_0x3b0ecc;if(_0x25185b[_0x1a49('0x2d')][_0x1a49('0x3e')]){_0x4295fb[_0x1a49('0x3f')]=[{'all':!![]}];}return db['Tag'][_0x1a49('0x40')](_0x4295fb);})[_0x1a49('0x1d')](function(_0x81118a){_0xebf05f[_0x1a49('0x41')]=_0x81118a;return _0xebf05f;})[_0x1a49('0x1d')](respondWithFilteredResult(_0x7bd96e,_0x4295fb))['catch'](handleError(_0x7bd96e,null));};exports[_0x1a49('0x42')]=function(_0x386d12,_0x156575){var _0x123eb6={'raw':!![],'where':{'id':_0x386d12['params']['id']}},_0x4dd181={};_0x4dd181[_0x1a49('0x2b')]=_[_0x1a49('0x2c')](db['Tag'][_0x1a49('0x43')]);_0x4dd181[_0x1a49('0x2d')]=_[_0x1a49('0x2c')](_0x386d12[_0x1a49('0x2d')]);_0x4dd181[_0x1a49('0x2e')]=_[_0x1a49('0x30')](_0x4dd181[_0x1a49('0x2b')],_0x4dd181['query']);_0x123eb6[_0x1a49('0x2f')]=_[_0x1a49('0x30')](_0x4dd181['model'],qs[_0x1a49('0x31')](_0x386d12[_0x1a49('0x2d')][_0x1a49('0x31')]));_0x123eb6[_0x1a49('0x2f')]=_0x123eb6[_0x1a49('0x2f')][_0x1a49('0x44')]?_0x123eb6[_0x1a49('0x2f')]:_0x4dd181[_0x1a49('0x2b')];if(_0x386d12[_0x1a49('0x2d')][_0x1a49('0x3e')]){_0x123eb6[_0x1a49('0x3f')]=[{'all':!![]}];}_0x123eb6=_['merge']({},_0x123eb6,_0x386d12[_0x1a49('0x45')]);return db[_0x1a49('0x27')]['find'](_0x123eb6)['then'](handleEntityNotFound(_0x156575,null))['then'](respondWithResult(_0x156575,null))[_0x1a49('0x46')](handleError(_0x156575,null));};exports[_0x1a49('0x47')]=function(_0x58a16e,_0x18e62a){return db[_0x1a49('0x27')][_0x1a49('0x47')](_0x58a16e['body'],{})[_0x1a49('0x1d')](function(_0xb23215){var _0x5c5fbb=_0x58a16e[_0x1a49('0x48')][_0x1a49('0x1e')]({'plain':!![]});if(!_0x5c5fbb)throw new Error(_0x1a49('0x49'));if(_0x5c5fbb['role']===_0x1a49('0x48')){var _0x3abf86=_0xb23215['get']({'plain':!![]});var _0x2b1624='Tags';return db[_0x1a49('0x4a')][_0x1a49('0x4b')]({'where':{'name':_0x2b1624,'userProfileId':_0x5c5fbb['userProfileId']},'raw':!![]})[_0x1a49('0x1d')](function(_0x59773a){if(_0x59773a&&_0x59773a[_0x1a49('0x4c')]===0x0){return db['UserProfileResource'][_0x1a49('0x47')]({'name':_0x3abf86['name'],'resourceId':_0x3abf86['id'],'type':_0x59773a[_0x1a49('0x23')],'sectionId':_0x59773a['id']},{})[_0x1a49('0x1d')](function(){return _0xb23215;});}else{return _0xb23215;}})['catch'](function(_0x1e23ef){logger[_0x1a49('0x4d')](_0x1a49('0x4e'),_0x1e23ef);throw _0x1e23ef;});}return _0xb23215;})['then'](respondWithResult(_0x18e62a,0xc9))[_0x1a49('0x46')](handleError(_0x18e62a,null));};exports['update']=function(_0xf61740,_0x4a2321){if(_0xf61740[_0x1a49('0x4f')]['id']){delete _0xf61740['body']['id'];}return db['Tag'][_0x1a49('0x4b')]({'where':{'id':_0xf61740[_0x1a49('0x50')]['id']}})[_0x1a49('0x1d')](handleEntityNotFound(_0x4a2321,null))['then'](saveUpdates(_0xf61740[_0x1a49('0x4f')],null))[_0x1a49('0x1d')](respondWithResult(_0x4a2321,null))[_0x1a49('0x46')](handleError(_0x4a2321,null));};exports[_0x1a49('0x20')]=function(_0x197024,_0x59f93e){return db[_0x1a49('0x27')][_0x1a49('0x4b')]({'where':{'id':_0x197024[_0x1a49('0x50')]['id']}})['then'](handleEntityNotFound(_0x59f93e,null))[_0x1a49('0x1d')](removeEntity(_0x59f93e,null))[_0x1a49('0x46')](handleError(_0x59f93e,null));}; \ No newline at end of file +var _0x6e38=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','get','Tags','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir'];(function(_0x28a6fb,_0x1d9a9c){var _0x1f6389=function(_0x3325ad){while(--_0x3325ad){_0x28a6fb['push'](_0x28a6fb['shift']());}};_0x1f6389(++_0x1d9a9c);}(_0x6e38,0xea));var _0x86e3=function(_0x145a91,_0x33e3be){_0x145a91=_0x145a91-0x0;var _0x3f1456=_0x6e38[_0x145a91];return _0x3f1456;};'use strict';var pdf=require(_0x86e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86e3('0x1'));var zipdir=require(_0x86e3('0x2'));var jsonpatch=require(_0x86e3('0x3'));var rp=require('request-promise');var moment=require(_0x86e3('0x4'));var BPromise=require(_0x86e3('0x5'));var Mustache=require(_0x86e3('0x6'));var util=require(_0x86e3('0x7'));var path=require(_0x86e3('0x8'));var sox=require(_0x86e3('0x9'));var csv=require(_0x86e3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x86e3('0xb'));var crypto=require(_0x86e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x86e3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x86e3('0xe'));var Redis=require(_0x86e3('0xf'));var authService=require(_0x86e3('0x10'));var qs=require(_0x86e3('0x11'));var as=require(_0x86e3('0x12'));var hardwareService=require(_0x86e3('0x13'));var logger=require(_0x86e3('0x14'))(_0x86e3('0x15'));var utils=require('../../config/utils');var config=require(_0x86e3('0x16'));var licenseUtil=require(_0x86e3('0x17'));var db=require(_0x86e3('0x18'))['db'];function respondWithStatusCode(_0x315c4e,_0x4d1805){_0x4d1805=_0x4d1805||0xcc;return function(_0x356622){if(_0x356622){return _0x315c4e[_0x86e3('0x19')](_0x4d1805);}return _0x315c4e['status'](_0x4d1805)['end']();};}function respondWithResult(_0x5c7e95,_0x4eda58){_0x4eda58=_0x4eda58||0xc8;return function(_0x461ac2){if(_0x461ac2){return _0x5c7e95[_0x86e3('0x1a')](_0x4eda58)[_0x86e3('0x1b')](_0x461ac2);}};}function respondWithFilteredResult(_0x21480f,_0x43da00){return function(_0x26ad36){if(_0x26ad36){var _0x44f43b=_0x26ad36['count'],_0x480e45=_0x43da00[_0x86e3('0x1c')],_0x2c1e58=_0x43da00[_0x86e3('0x1c')]+_0x43da00['limit'],_0x26c445;if(_0x2c1e58>=_0x44f43b){_0x2c1e58=_0x44f43b;_0x26c445=0xc8;}else{_0x26c445=0xce;}_0x21480f[_0x86e3('0x1a')](_0x26c445);return _0x21480f[_0x86e3('0x1d')](_0x86e3('0x1e'),_0x480e45+'-'+_0x2c1e58+'/'+_0x44f43b)[_0x86e3('0x1b')](_0x26ad36);}return null;};}function patchUpdates(_0x5400ae){return function(_0xfe8477){try{jsonpatch['apply'](_0xfe8477,_0x5400ae,!![]);}catch(_0x1f744a){return BPromise[_0x86e3('0x1f')](_0x1f744a);}return _0xfe8477[_0x86e3('0x20')]();};}function saveUpdates(_0xd16125,_0x1a2a69){return function(_0x472184){if(_0x472184){return _0x472184[_0x86e3('0x21')](_0xd16125)['then'](function(_0x316233){return _0x316233;});}return null;};}function removeEntity(_0x2ef358,_0x122552){return function(_0x355231){if(_0x355231){return _0x355231['destroy']()[_0x86e3('0x22')](function(){var _0x52b229=_0x355231[_0x86e3('0x23')]({'plain':!![]});var _0x4f92d7=_0x86e3('0x24');return db['UserProfileResource'][_0x86e3('0x25')]({'where':{'type':_0x4f92d7,'resourceId':_0x52b229['id']}})[_0x86e3('0x22')](function(){return _0x355231;});})[_0x86e3('0x22')](function(){_0x2ef358[_0x86e3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7de5aa,_0x40742d){return function(_0x3d065a){if(!_0x3d065a){_0x7de5aa[_0x86e3('0x19')](0x194);}return _0x3d065a;};}function handleError(_0x1af67d,_0x393b44){_0x393b44=_0x393b44||0x1f4;return function(_0x40ea50){logger['error'](_0x40ea50[_0x86e3('0x26')]);if(_0x40ea50[_0x86e3('0x27')]){delete _0x40ea50[_0x86e3('0x27')];}_0x1af67d[_0x86e3('0x1a')](_0x393b44)['send'](_0x40ea50);};}exports['index']=function(_0x46576d,_0x1e51bc){var _0x17f501={},_0x2156a7={},_0x1446f5={'count':0x0,'rows':[]};var _0x3f7596=_[_0x86e3('0x28')](db['Tag'][_0x86e3('0x29')],function(_0x3c4b2c){return{'name':_0x3c4b2c[_0x86e3('0x2a')],'type':_0x3c4b2c[_0x86e3('0x2b')][_0x86e3('0x2c')]};});_0x2156a7[_0x86e3('0x2d')]=_[_0x86e3('0x28')](_0x3f7596,_0x86e3('0x27'));_0x2156a7['query']=_[_0x86e3('0x2e')](_0x46576d[_0x86e3('0x2f')]);_0x2156a7[_0x86e3('0x30')]=_['intersection'](_0x2156a7[_0x86e3('0x2d')],_0x2156a7[_0x86e3('0x2f')]);_0x17f501[_0x86e3('0x31')]=_[_0x86e3('0x32')](_0x2156a7[_0x86e3('0x2d')],qs[_0x86e3('0x33')](_0x46576d[_0x86e3('0x2f')]['fields']));_0x17f501['attributes']=_0x17f501[_0x86e3('0x31')][_0x86e3('0x34')]?_0x17f501['attributes']:_0x2156a7[_0x86e3('0x2d')];if(!_0x46576d['query'][_0x86e3('0x35')](_0x86e3('0x36'))){_0x17f501[_0x86e3('0x37')]=qs[_0x86e3('0x37')](_0x46576d[_0x86e3('0x2f')][_0x86e3('0x37')]);_0x17f501['offset']=qs['offset'](_0x46576d[_0x86e3('0x2f')][_0x86e3('0x1c')]);}_0x17f501[_0x86e3('0x38')]=qs[_0x86e3('0x39')](_0x46576d[_0x86e3('0x2f')][_0x86e3('0x39')]);_0x17f501[_0x86e3('0x3a')]=qs['filters'](_[_0x86e3('0x3b')](_0x46576d['query'],_0x2156a7['filters']),_0x3f7596);if(_0x46576d['query'][_0x86e3('0x3c')]){_0x17f501[_0x86e3('0x3a')]=_[_0x86e3('0x3d')](_0x17f501['where'],{'$or':_[_0x86e3('0x28')](_0x3f7596,function(_0x380c00){if(_0x380c00[_0x86e3('0x2b')]!==_0x86e3('0x3e')){var _0x4dffa4={};_0x4dffa4[_0x380c00['name']]={'$like':'%'+_0x46576d[_0x86e3('0x2f')]['filter']+'%'};return _0x4dffa4;}})});}_0x17f501=_[_0x86e3('0x3d')]({},_0x17f501,_0x46576d[_0x86e3('0x3f')]);var _0x3ab8b9={'where':_0x17f501[_0x86e3('0x3a')]};return db[_0x86e3('0x40')]['count'](_0x3ab8b9)['then'](function(_0xf4d7f4){_0x1446f5['count']=_0xf4d7f4;if(_0x46576d[_0x86e3('0x2f')][_0x86e3('0x41')]){_0x17f501['include']=[{'all':!![]}];}return db[_0x86e3('0x40')][_0x86e3('0x42')](_0x17f501);})[_0x86e3('0x22')](function(_0x4aca89){_0x1446f5[_0x86e3('0x43')]=_0x4aca89;return _0x1446f5;})[_0x86e3('0x22')](respondWithFilteredResult(_0x1e51bc,_0x17f501))[_0x86e3('0x44')](handleError(_0x1e51bc,null));};exports[_0x86e3('0x45')]=function(_0x1bdace,_0x30d767){var _0x1b2532={'raw':!![],'where':{'id':_0x1bdace[_0x86e3('0x46')]['id']}},_0x2b462c={};_0x2b462c['model']=_[_0x86e3('0x2e')](db[_0x86e3('0x40')][_0x86e3('0x29')]);_0x2b462c['query']=_['keys'](_0x1bdace[_0x86e3('0x2f')]);_0x2b462c[_0x86e3('0x30')]=_['intersection'](_0x2b462c[_0x86e3('0x2d')],_0x2b462c[_0x86e3('0x2f')]);_0x1b2532[_0x86e3('0x31')]=_[_0x86e3('0x32')](_0x2b462c['model'],qs[_0x86e3('0x33')](_0x1bdace['query'][_0x86e3('0x33')]));_0x1b2532[_0x86e3('0x31')]=_0x1b2532[_0x86e3('0x31')][_0x86e3('0x34')]?_0x1b2532[_0x86e3('0x31')]:_0x2b462c[_0x86e3('0x2d')];if(_0x1bdace[_0x86e3('0x2f')][_0x86e3('0x41')]){_0x1b2532[_0x86e3('0x47')]=[{'all':!![]}];}_0x1b2532=_[_0x86e3('0x3d')]({},_0x1b2532,_0x1bdace[_0x86e3('0x3f')]);return db[_0x86e3('0x40')][_0x86e3('0x48')](_0x1b2532)[_0x86e3('0x22')](handleEntityNotFound(_0x30d767,null))['then'](respondWithResult(_0x30d767,null))[_0x86e3('0x44')](handleError(_0x30d767,null));};exports[_0x86e3('0x49')]=function(_0x4c0748,_0x181217){return db[_0x86e3('0x40')][_0x86e3('0x49')](_0x4c0748[_0x86e3('0x4a')],{})[_0x86e3('0x22')](function(_0x3fa8b1){var _0x471e68=_0x4c0748[_0x86e3('0x4b')]['get']({'plain':!![]});if(!_0x471e68)throw new Error(_0x86e3('0x4c'));if(_0x471e68[_0x86e3('0x4d')]===_0x86e3('0x4b')){var _0x3cd81d=_0x3fa8b1['get']({'plain':!![]});var _0x238dc2=_0x86e3('0x24');return db['UserProfileSection'][_0x86e3('0x48')]({'where':{'name':_0x238dc2,'userProfileId':_0x471e68['userProfileId']},'raw':!![]})[_0x86e3('0x22')](function(_0x40c620){if(_0x40c620&&_0x40c620['autoAssociation']===0x0){return db['UserProfileResource'][_0x86e3('0x49')]({'name':_0x3cd81d[_0x86e3('0x27')],'resourceId':_0x3cd81d['id'],'type':_0x40c620[_0x86e3('0x27')],'sectionId':_0x40c620['id']},{})[_0x86e3('0x22')](function(){return _0x3fa8b1;});}else{return _0x3fa8b1;}})[_0x86e3('0x44')](function(_0x4b6e61){logger['error'](_0x86e3('0x4e'),_0x4b6e61);throw _0x4b6e61;});}return _0x3fa8b1;})[_0x86e3('0x22')](respondWithResult(_0x181217,0xc9))[_0x86e3('0x44')](handleError(_0x181217,null));};exports[_0x86e3('0x21')]=function(_0x43b57d,_0x2a140f){if(_0x43b57d[_0x86e3('0x4a')]['id']){delete _0x43b57d[_0x86e3('0x4a')]['id'];}return db[_0x86e3('0x40')][_0x86e3('0x48')]({'where':{'id':_0x43b57d[_0x86e3('0x46')]['id']}})[_0x86e3('0x22')](handleEntityNotFound(_0x2a140f,null))[_0x86e3('0x22')](saveUpdates(_0x43b57d[_0x86e3('0x4a')],null))[_0x86e3('0x22')](respondWithResult(_0x2a140f,null))['catch'](handleError(_0x2a140f,null));};exports[_0x86e3('0x25')]=function(_0x5ce4ab,_0x3aa200){return db['Tag'][_0x86e3('0x48')]({'where':{'id':_0x5ce4ab[_0x86e3('0x46')]['id']}})[_0x86e3('0x22')](handleEntityNotFound(_0x3aa200,null))[_0x86e3('0x22')](removeEntity(_0x3aa200,null))['catch'](handleError(_0x3aa200,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 36f38a4..7d777ec 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 _0x4498=['define','Tag','tools_tags','lodash','util','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x4498,0x16b));var _0x8449=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0x4498[_0x5e2152];return _0x5ddcf6;};'use strict';var _=require(_0x8449('0x0'));var util=require(_0x8449('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8449('0x2'));var BPromise=require(_0x8449('0x3'));var rp=require(_0x8449('0x4'));var fs=require('fs');var path=require(_0x8449('0x5'));var rimraf=require(_0x8449('0x6'));var config=require('../../config/environment');var attributes=require(_0x8449('0x7'));module[_0x8449('0x8')]=function(_0x7a5035,_0x439415){return _0x7a5035[_0x8449('0x9')](_0x8449('0xa'),attributes,{'tableName':_0x8449('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e7a=['moment','bluebird','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','util','../../config/logger'];(function(_0x31145a,_0x26d54e){var _0x134a99=function(_0x172e13){while(--_0x172e13){_0x31145a['push'](_0x31145a['shift']());}};_0x134a99(++_0x26d54e);}(_0x8e7a,0x1ac));var _0xa8e7=function(_0x1ea0a6,_0x933db7){_0x1ea0a6=_0x1ea0a6-0x0;var _0x458ed1=_0x8e7a[_0x1ea0a6];return _0x458ed1;};'use strict';var _=require('lodash');var util=require(_0xa8e7('0x0'));var logger=require(_0xa8e7('0x1'))('api');var moment=require(_0xa8e7('0x2'));var BPromise=require(_0xa8e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa8e7('0x4'));var config=require(_0xa8e7('0x5'));var attributes=require(_0xa8e7('0x6'));module[_0xa8e7('0x7')]=function(_0x4e63cc,_0x517e42){return _0x4e63cc[_0xa8e7('0x8')](_0xa8e7('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 9499f99..23eec6a 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 _0xa9e0=['http','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\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(_0x2d142d,_0x1a4503){var _0x3ea2e7=function(_0x23bc01){while(--_0x23bc01){_0x2d142d['push'](_0x2d142d['shift']());}};_0x3ea2e7(++_0x1a4503);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 _0x0102=['info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0102,0x186));var _0x2010=function(_0x579ea1,_0x317c86){_0x579ea1=_0x579ea1-0x0;var _0x262615=_0x0102[_0x579ea1];return _0x262615;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9145de9..0553301 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 _0x41b1=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','delete'];(function(_0x2e4964,_0x5c28e5){var _0x3795fa=function(_0x525116){while(--_0x525116){_0x2e4964['push'](_0x2e4964['shift']());}};_0x3795fa(++_0x5c28e5);}(_0x41b1,0x9c));var _0x141b=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x41b1[_0x508c10];return _0x3108b5;};'use strict';var multer=require('multer');var util=require(_0x141b('0x0'));var path=require(_0x141b('0x1'));var timeout=require(_0x141b('0x2'));var express=require(_0x141b('0x3'));var router=express[_0x141b('0x4')]();var auth=require(_0x141b('0x5'));var interaction=require(_0x141b('0x6'));var config=require(_0x141b('0x7'));var controller=require('./team.controller');router[_0x141b('0x8')]('/',auth[_0x141b('0x9')](),controller['index']);router[_0x141b('0x8')](_0x141b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x141b('0x8')](_0x141b('0xb'),auth['isAuthenticated'](),controller[_0x141b('0xc')]);router[_0x141b('0x8')](_0x141b('0xd'),auth[_0x141b('0x9')](),controller[_0x141b('0xe')]);router[_0x141b('0xf')]('/',auth[_0x141b('0x9')](),controller[_0x141b('0x10')]);router[_0x141b('0xf')](_0x141b('0xb'),auth[_0x141b('0x9')](),controller[_0x141b('0x11')]);router[_0x141b('0xf')](_0x141b('0xd'),auth[_0x141b('0x9')](),controller[_0x141b('0x12')]);router['put'](_0x141b('0xa'),auth[_0x141b('0x9')](),controller['update']);router[_0x141b('0x13')]('/:id',auth[_0x141b('0x9')](),controller[_0x141b('0x14')]);router[_0x141b('0x13')](_0x141b('0xb'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0x141b('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x141b('0x15')]=router; \ No newline at end of file +var _0xb02d=['Router','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','/:id','show','/:id/queues','getQueues','getAgents','post','create','addQueues','addAgents','put','update','destroy','delete','/:id/users','removeAgents','util','path','connect-timeout','express'];(function(_0x4434bf,_0x1ddee3){var _0x589467=function(_0x2cec7a){while(--_0x2cec7a){_0x4434bf['push'](_0x4434bf['shift']());}};_0x589467(++_0x1ddee3);}(_0xb02d,0xab));var _0xdb02=function(_0x3e58b2,_0x330a6c){_0x3e58b2=_0x3e58b2-0x0;var _0x2e0fff=_0xb02d[_0x3e58b2];return _0x2e0fff;};'use strict';var multer=require('multer');var util=require(_0xdb02('0x0'));var path=require(_0xdb02('0x1'));var timeout=require(_0xdb02('0x2'));var express=require(_0xdb02('0x3'));var router=express[_0xdb02('0x4')]();var auth=require(_0xdb02('0x5'));var interaction=require(_0xdb02('0x6'));var config=require('../../config/environment');var controller=require(_0xdb02('0x7'));router[_0xdb02('0x8')]('/',auth[_0xdb02('0x9')](),controller['index']);router[_0xdb02('0x8')](_0xdb02('0xa'),auth['isAuthenticated'](),controller[_0xdb02('0xb')]);router['get'](_0xdb02('0xc'),auth['isAuthenticated'](),controller[_0xdb02('0xd')]);router['get']('/:id/users',auth[_0xdb02('0x9')](),controller[_0xdb02('0xe')]);router[_0xdb02('0xf')]('/',auth[_0xdb02('0x9')](),controller[_0xdb02('0x10')]);router['post'](_0xdb02('0xc'),auth[_0xdb02('0x9')](),controller[_0xdb02('0x11')]);router['post']('/:id/users',auth[_0xdb02('0x9')](),controller[_0xdb02('0x12')]);router[_0xdb02('0x13')](_0xdb02('0xa'),auth[_0xdb02('0x9')](),controller[_0xdb02('0x14')]);router['delete']('/:id',auth[_0xdb02('0x9')](),controller[_0xdb02('0x15')]);router['delete']('/:id/queues',auth[_0xdb02('0x9')](),controller['removeQueues']);router[_0xdb02('0x16')](_0xdb02('0x17'),auth['isAuthenticated'](),controller[_0xdb02('0x18')]);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 1ca1025..802ebe6 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 _0x751c=['exports','name','STRING','sequelize'];(function(_0x51114c,_0x37ecbb){var _0x3edea4=function(_0x507ebf){while(--_0x507ebf){_0x51114c['push'](_0x51114c['shift']());}};_0x3edea4(++_0x37ecbb);}(_0x751c,0xbf));var _0xc751=function(_0x23f771,_0x41a0bf){_0x23f771=_0x23f771-0x0;var _0x44dafe=_0x751c[_0x23f771];return _0x44dafe;};'use strict';var Sequelize=require(_0xc751('0x0'));module[_0xc751('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc751('0x2')},'description':{'type':Sequelize[_0xc751('0x3')]}}; \ No newline at end of file +var _0x2ac5=['sequelize','exports','STRING','name'];(function(_0x5543d2,_0xabe6c4){var _0x561e05=function(_0x321c5a){while(--_0x321c5a){_0x5543d2['push'](_0x5543d2['shift']());}};_0x561e05(++_0xabe6c4);}(_0x2ac5,0x1d4));var _0x52ac=function(_0x3b048d,_0x450938){_0x3b048d=_0x3b048d-0x0;var _0x31b2d4=_0x2ac5[_0x3b048d];return _0x31b2d4;};'use strict';var Sequelize=require(_0x52ac('0x0'));module[_0x52ac('0x1')]={'name':{'type':Sequelize[_0x52ac('0x2')],'allowNull':![],'unique':_0x52ac('0x3')},'description':{'type':Sequelize[_0x52ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 565ef86..4d40182 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 _0xd5f7=['addQueues','add','remove','ids','addAgents','Voice','Chat','Mail','Whatsapp','each','online','voicePause','interface','upsert','spread','userTeam:save','removeAgents','voice','chat','mail','fax','openchannel','whatsapp','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','index','map','Team','fieldName','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','count','include','findAll','rows','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','rawAttributes','Queues'];(function(_0x3d9da2,_0x2e6559){var _0x465aea=function(_0x19ce57){while(--_0x19ce57){_0x3d9da2['push'](_0x3d9da2['shift']());}};_0x465aea(++_0x2e6559);}(_0xd5f7,0x18c));var _0x7d5f=function(_0x37d5b0,_0xa12629){_0x37d5b0=_0x37d5b0-0x0;var _0x3b86a1=_0xd5f7[_0x37d5b0];return _0x3b86a1;};'use strict';var pdf=require(_0x7d5f('0x0'));var emlformat=require(_0x7d5f('0x1'));var rimraf=require(_0x7d5f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d5f('0x3'));var rp=require(_0x7d5f('0x4'));var moment=require(_0x7d5f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7d5f('0x6'));var util=require(_0x7d5f('0x7'));var path=require(_0x7d5f('0x8'));var sox=require(_0x7d5f('0x9'));var csv=require(_0x7d5f('0xa'));var ejs=require(_0x7d5f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7d5f('0xc'));var jsforce=require(_0x7d5f('0xd'));var deskjs=require(_0x7d5f('0xe'));var toCsv=require(_0x7d5f('0xa'));var querystring=require(_0x7d5f('0xf'));var Papa=require(_0x7d5f('0x10'));var Redis=require(_0x7d5f('0x11'));var authService=require(_0x7d5f('0x12'));var qs=require(_0x7d5f('0x13'));var as=require(_0x7d5f('0x14'));var hardwareService=require(_0x7d5f('0x15'));var logger=require(_0x7d5f('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7d5f('0x17'));var licenseUtil=require(_0x7d5f('0x18'));var db=require(_0x7d5f('0x19'))['db'];config[_0x7d5f('0x1a')]=_[_0x7d5f('0x1b')](config['redis'],{'host':_0x7d5f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d5f('0x1a')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x2ed79b,_0x3d1982){_0x3d1982=_0x3d1982||0xcc;return function(_0x214575){if(_0x214575){return _0x2ed79b[_0x7d5f('0x1d')](_0x3d1982);}return _0x2ed79b[_0x7d5f('0x1e')](_0x3d1982)[_0x7d5f('0x1f')]();};}function respondWithResult(_0x14bb28,_0x1587a8){_0x1587a8=_0x1587a8||0xc8;return function(_0x4aa093){if(_0x4aa093){return _0x14bb28[_0x7d5f('0x1e')](_0x1587a8)[_0x7d5f('0x20')](_0x4aa093);}};}function respondWithFilteredResult(_0x81e42e,_0x153d51){return function(_0x57fff5){if(_0x57fff5){var _0x449b43=_0x57fff5['count'],_0x54f850=_0x153d51[_0x7d5f('0x21')],_0x66c440=_0x153d51[_0x7d5f('0x21')]+_0x153d51[_0x7d5f('0x22')],_0x54f53b;if(_0x66c440>=_0x449b43){_0x66c440=_0x449b43;_0x54f53b=0xc8;}else{_0x54f53b=0xce;}_0x81e42e['status'](_0x54f53b);return _0x81e42e[_0x7d5f('0x23')](_0x7d5f('0x24'),_0x54f850+'-'+_0x66c440+'/'+_0x449b43)[_0x7d5f('0x20')](_0x57fff5);}return null;};}function patchUpdates(_0x126aaa){return function(_0xd4500e){try{jsonpatch[_0x7d5f('0x25')](_0xd4500e,_0x126aaa,!![]);}catch(_0xf453bc){return BPromise['reject'](_0xf453bc);}return _0xd4500e[_0x7d5f('0x26')]();};}function saveUpdates(_0xa97e2,_0x3bd0dc){return function(_0x69bb61){if(_0x69bb61){return _0x69bb61[_0x7d5f('0x27')](_0xa97e2)[_0x7d5f('0x28')](function(_0x595d7d){return _0x595d7d;});}return null;};}function removeEntity(_0x456888,_0x53c4ee){return function(_0x5c0fb2){if(_0x5c0fb2){return _0x5c0fb2[_0x7d5f('0x29')]()[_0x7d5f('0x28')](function(){var _0x25f675=_0x5c0fb2[_0x7d5f('0x2a')]({'plain':!![]});var _0x411057=_0x7d5f('0x2b');return db[_0x7d5f('0x2c')][_0x7d5f('0x29')]({'where':{'type':_0x411057,'resourceId':_0x25f675['id']}})[_0x7d5f('0x28')](function(){return _0x5c0fb2;});})['then'](function(){_0x456888[_0x7d5f('0x1e')](0xcc)[_0x7d5f('0x1f')]();});}};}function handleEntityNotFound(_0x1c67f4,_0x13b46d){return function(_0xa129b2){if(!_0xa129b2){_0x1c67f4[_0x7d5f('0x1d')](0x194);}return _0xa129b2;};}function handleError(_0x4dda0d,_0x197e79){_0x197e79=_0x197e79||0x1f4;return function(_0x4f8926){logger[_0x7d5f('0x2d')](_0x4f8926[_0x7d5f('0x2e')]);if(_0x4f8926['name']){delete _0x4f8926[_0x7d5f('0x2f')];}_0x4dda0d[_0x7d5f('0x1e')](_0x197e79)['send'](_0x4f8926);};}exports[_0x7d5f('0x30')]=function(_0x5b1fba,_0xd18eb0){var _0x1ce215={},_0x30c731={},_0x44b07a={'count':0x0,'rows':[]};var _0x211dd6=_[_0x7d5f('0x31')](db[_0x7d5f('0x32')]['rawAttributes'],function(_0x1b310c){return{'name':_0x1b310c[_0x7d5f('0x33')],'type':_0x1b310c['type']['key']};});_0x30c731['model']=_['map'](_0x211dd6,'name');_0x30c731['query']=_[_0x7d5f('0x34')](_0x5b1fba[_0x7d5f('0x35')]);_0x30c731[_0x7d5f('0x36')]=_[_0x7d5f('0x37')](_0x30c731[_0x7d5f('0x38')],_0x30c731['query']);_0x1ce215[_0x7d5f('0x39')]=_[_0x7d5f('0x37')](_0x30c731[_0x7d5f('0x38')],qs[_0x7d5f('0x3a')](_0x5b1fba[_0x7d5f('0x35')]['fields']));_0x1ce215['attributes']=_0x1ce215[_0x7d5f('0x39')][_0x7d5f('0x3b')]?_0x1ce215[_0x7d5f('0x39')]:_0x30c731['model'];if(!_0x5b1fba[_0x7d5f('0x35')]['hasOwnProperty'](_0x7d5f('0x3c'))){_0x1ce215[_0x7d5f('0x22')]=qs[_0x7d5f('0x22')](_0x5b1fba[_0x7d5f('0x35')][_0x7d5f('0x22')]);_0x1ce215[_0x7d5f('0x21')]=qs[_0x7d5f('0x21')](_0x5b1fba[_0x7d5f('0x35')]['offset']);}_0x1ce215[_0x7d5f('0x3d')]=qs[_0x7d5f('0x3e')](_0x5b1fba[_0x7d5f('0x35')][_0x7d5f('0x3e')]);_0x1ce215[_0x7d5f('0x3f')]=qs[_0x7d5f('0x36')](_[_0x7d5f('0x40')](_0x5b1fba['query'],_0x30c731['filters']),_0x211dd6);if(_0x5b1fba[_0x7d5f('0x35')]['filter']){_0x1ce215['where']=_[_0x7d5f('0x41')](_0x1ce215[_0x7d5f('0x3f')],{'$or':_[_0x7d5f('0x31')](_0x211dd6,function(_0x443dbf){if(_0x443dbf['type']!=='VIRTUAL'){var _0x36091e={};_0x36091e[_0x443dbf['name']]={'$like':'%'+_0x5b1fba[_0x7d5f('0x35')][_0x7d5f('0x42')]+'%'};return _0x36091e;}})});}_0x1ce215=_['merge']({},_0x1ce215,_0x5b1fba['options']);var _0x40ed21={'where':_0x1ce215[_0x7d5f('0x3f')]};return db['Team'][_0x7d5f('0x43')](_0x40ed21)['then'](function(_0x47aaa7){_0x44b07a[_0x7d5f('0x43')]=_0x47aaa7;if(_0x5b1fba[_0x7d5f('0x35')]['includeAll']){_0x1ce215[_0x7d5f('0x44')]=[{'all':!![]}];}return db['Team'][_0x7d5f('0x45')](_0x1ce215);})[_0x7d5f('0x28')](function(_0x47018a){_0x44b07a[_0x7d5f('0x46')]=_0x47018a;return _0x44b07a;})[_0x7d5f('0x28')](respondWithFilteredResult(_0xd18eb0,_0x1ce215))['catch'](handleError(_0xd18eb0,null));};exports[_0x7d5f('0x47')]=function(_0x7736e,_0x295fea){var _0x230996={'raw':![],'where':{'id':_0x7736e[_0x7d5f('0x48')]['id']}},_0x4d29f5={};_0x4d29f5[_0x7d5f('0x38')]=_[_0x7d5f('0x34')](db['Team']['rawAttributes']);_0x4d29f5[_0x7d5f('0x35')]=_[_0x7d5f('0x34')](_0x7736e[_0x7d5f('0x35')]);_0x4d29f5[_0x7d5f('0x36')]=_[_0x7d5f('0x37')](_0x4d29f5[_0x7d5f('0x38')],_0x4d29f5['query']);_0x230996[_0x7d5f('0x39')]=_[_0x7d5f('0x37')](_0x4d29f5[_0x7d5f('0x38')],qs[_0x7d5f('0x3a')](_0x7736e[_0x7d5f('0x35')][_0x7d5f('0x3a')]));_0x230996[_0x7d5f('0x39')]=_0x230996[_0x7d5f('0x39')][_0x7d5f('0x3b')]?_0x230996[_0x7d5f('0x39')]:_0x4d29f5['model'];if(_0x7736e['query'][_0x7d5f('0x49')]){_0x230996[_0x7d5f('0x44')]=[{'all':!![]}];}_0x230996=_[_0x7d5f('0x41')]({},_0x230996,_0x7736e[_0x7d5f('0x4a')]);return db[_0x7d5f('0x32')][_0x7d5f('0x4b')](_0x230996)['then'](handleEntityNotFound(_0x295fea,null))[_0x7d5f('0x28')](respondWithResult(_0x295fea,null))['catch'](handleError(_0x295fea,null));};exports[_0x7d5f('0x4c')]=function(_0x5593fe,_0x2cd37d){return db[_0x7d5f('0x32')][_0x7d5f('0x4c')](_0x5593fe[_0x7d5f('0x4d')],{})[_0x7d5f('0x28')](function(_0x301195){var _0x3a2c84=_0x5593fe[_0x7d5f('0x4e')][_0x7d5f('0x2a')]({'plain':!![]});if(!_0x3a2c84)throw new Error(_0x7d5f('0x4f'));if(_0x3a2c84[_0x7d5f('0x50')]==='user'){var _0x217e28=_0x301195['get']({'plain':!![]});var _0x4d603e=_0x7d5f('0x2b');return db['UserProfileSection'][_0x7d5f('0x4b')]({'where':{'name':_0x4d603e,'userProfileId':_0x3a2c84[_0x7d5f('0x51')]},'raw':!![]})['then'](function(_0x4fe51c){if(_0x4fe51c&&_0x4fe51c[_0x7d5f('0x52')]===0x0){return db['UserProfileResource'][_0x7d5f('0x4c')]({'name':_0x217e28['name'],'resourceId':_0x217e28['id'],'type':_0x4fe51c[_0x7d5f('0x2f')],'sectionId':_0x4fe51c['id']},{})['then'](function(){return _0x301195;});}else{return _0x301195;}})[_0x7d5f('0x53')](function(_0x2ea08a){logger[_0x7d5f('0x2d')](_0x7d5f('0x54'),_0x2ea08a);throw _0x2ea08a;});}return _0x301195;})[_0x7d5f('0x28')](respondWithResult(_0x2cd37d,0xc9))['catch'](handleError(_0x2cd37d,null));};exports[_0x7d5f('0x27')]=function(_0x514e86,_0x53ec4b){if(_0x514e86['body']['id']){delete _0x514e86[_0x7d5f('0x4d')]['id'];}return db[_0x7d5f('0x32')][_0x7d5f('0x4b')]({'where':{'id':_0x514e86[_0x7d5f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53ec4b,null))[_0x7d5f('0x28')](saveUpdates(_0x514e86[_0x7d5f('0x4d')],null))[_0x7d5f('0x28')](respondWithResult(_0x53ec4b,null))['catch'](handleError(_0x53ec4b,null));};exports[_0x7d5f('0x29')]=function(_0x4ecbf0,_0x32d1a1){return db[_0x7d5f('0x32')][_0x7d5f('0x4b')]({'where':{'id':_0x4ecbf0[_0x7d5f('0x48')]['id']}})[_0x7d5f('0x28')](handleEntityNotFound(_0x32d1a1,null))[_0x7d5f('0x28')](removeEntity(_0x32d1a1,null))[_0x7d5f('0x53')](handleError(_0x32d1a1,null));};exports[_0x7d5f('0x55')]=function(_0x93e507,_0x415bba,_0x183ef8){return db[_0x7d5f('0x32')][_0x7d5f('0x56')]({'where':{'id':_0x93e507['params']['id']}})[_0x7d5f('0x28')](handleEntityNotFound(_0x415bba,null))[_0x7d5f('0x28')](function(_0x34af3b){if(!_0x93e507[_0x7d5f('0x35')][_0x7d5f('0x57')]||!utils[_0x7d5f('0x58')](_0x93e507['query'][_0x7d5f('0x57')])){throw new db[(_0x7d5f('0x59'))][(_0x7d5f('0x5a'))](_0x7d5f('0x5b'));}var _0x75ae8f={};var _0x46bac4={};_0x46bac4[_0x7d5f('0x38')]=_[_0x7d5f('0x34')](db[_[_0x7d5f('0x5c')](_0x93e507[_0x7d5f('0x35')][_0x7d5f('0x57')][_0x7d5f('0x5d')]())+'Queue'][_0x7d5f('0x5e')]);_0x46bac4[_0x7d5f('0x35')]=_[_0x7d5f('0x34')](_0x93e507[_0x7d5f('0x35')]);_0x46bac4['filters']=_['intersection'](_0x46bac4[_0x7d5f('0x38')],_0x46bac4[_0x7d5f('0x35')]);_0x75ae8f['attributes']=_[_0x7d5f('0x37')](_0x46bac4[_0x7d5f('0x38')],qs['fields'](_0x93e507[_0x7d5f('0x35')][_0x7d5f('0x3a')]));_0x75ae8f['attributes']=_0x75ae8f[_0x7d5f('0x39')][_0x7d5f('0x3b')]?_0x75ae8f[_0x7d5f('0x39')]:_0x46bac4[_0x7d5f('0x38')];_0x75ae8f['limit']=qs[_0x7d5f('0x22')](_0x93e507[_0x7d5f('0x35')][_0x7d5f('0x22')]);_0x75ae8f[_0x7d5f('0x21')]=qs[_0x7d5f('0x21')](_0x93e507[_0x7d5f('0x35')]['offset']);_0x75ae8f[_0x7d5f('0x3d')]=qs[_0x7d5f('0x3e')](_0x93e507[_0x7d5f('0x35')][_0x7d5f('0x3e')]);_0x75ae8f[_0x7d5f('0x3f')]=qs[_0x7d5f('0x36')](_[_0x7d5f('0x40')](_0x93e507[_0x7d5f('0x35')],_0x46bac4[_0x7d5f('0x36')]));_0x75ae8f=_[_0x7d5f('0x41')]({},_0x75ae8f,_0x93e507['options']);return _0x34af3b[_0x7d5f('0x2a')+_[_0x7d5f('0x5c')](_0x93e507['query'][_0x7d5f('0x57')][_0x7d5f('0x5d')]())+_0x7d5f('0x5f')](_0x75ae8f);})['then'](respondWithResult(_0x415bba,null))[_0x7d5f('0x53')](handleError(_0x415bba,null));};exports[_0x7d5f('0x60')]=function(_0x12c003,_0x190a3c,_0x2d37eb){return db[_0x7d5f('0x32')][_0x7d5f('0x56')]({'where':{'id':_0x12c003[_0x7d5f('0x48')]['id']}})['then'](function(_0x14f88a){if(_0x14f88a){if(!_0x12c003[_0x7d5f('0x4d')][_0x7d5f('0x57')]||!utils['isValidChannel'](_0x12c003['body']['channel'])){throw new db[(_0x7d5f('0x59'))]['ValidationError'](_0x7d5f('0x5b'));}return _0x14f88a[_0x7d5f('0x61')+_[_0x7d5f('0x5c')](_0x12c003[_0x7d5f('0x4d')]['channel']['toLowerCase']())+_0x7d5f('0x5f')](_0x12c003[_0x7d5f('0x4d')]['ids']);}return null;})[_0x7d5f('0x28')](handleEntityNotFound(_0x190a3c,null))[_0x7d5f('0x28')](respondWithStatusCode(_0x190a3c,null))[_0x7d5f('0x53')](handleError(_0x190a3c,null));};exports['removeQueues']=function(_0x479360,_0x3f92bc,_0x83a7b1){return db['Team'][_0x7d5f('0x56')]({'where':{'id':_0x479360[_0x7d5f('0x48')]['id']}})['then'](function(_0x473136){if(_0x473136){if(!_0x479360[_0x7d5f('0x35')]['channel']||!utils['isValidChannel'](_0x479360['query']['channel'])){throw new db[(_0x7d5f('0x59'))]['ValidationError'](_0x7d5f('0x5b'));}return _0x473136[_0x7d5f('0x62')+_['capitalize'](_0x479360[_0x7d5f('0x35')][_0x7d5f('0x57')][_0x7d5f('0x5d')]())+_0x7d5f('0x5f')](_0x479360['query'][_0x7d5f('0x63')]);}return null;})['then'](handleEntityNotFound(_0x3f92bc,null))[_0x7d5f('0x28')](respondWithStatusCode(_0x3f92bc,null))[_0x7d5f('0x53')](handleError(_0x3f92bc,null));};exports[_0x7d5f('0x64')]=function(_0xb85652,_0x1f055f,_0x4669bb){return db[_0x7d5f('0x32')][_0x7d5f('0x4b')]({'where':{'id':_0xb85652[_0x7d5f('0x48')]['id']}})[_0x7d5f('0x28')](handleEntityNotFound(_0x1f055f,null))['then'](function(_0xedb944){if(_0xedb944){var _0x143163=[_0x7d5f('0x65'),_0x7d5f('0x66'),_0x7d5f('0x67'),'Sms','Fax','Openchannel',_0x7d5f('0x68')];return BPromise[_0x7d5f('0x69')](_0x143163,function(_0x22bff2){return _0xedb944['get'+_0x22bff2+'Queues']({'attributes':['id',_0x7d5f('0x2f')]})[_0x7d5f('0x28')](function(_0x153437){return BPromise['each'](_0x153437,function(_0x171b20){return _0x171b20['addAgents'](_0xb85652[_0x7d5f('0x4d')][_0x7d5f('0x63')])[_0x7d5f('0x28')](function(){if(_0x22bff2==='Voice'){return db['User'][_0x7d5f('0x45')]({'where':{'id':_0xb85652[_0x7d5f('0x4d')][_0x7d5f('0x63')]},'attributes':['id',_0x7d5f('0x2f'),_0x7d5f('0x6a'),_0x7d5f('0x6b'),_0x7d5f('0x6c')],'raw':!![]})[_0x7d5f('0x28')](function(_0x53cfe8){return BPromise['each'](_[_0x7d5f('0x42')](_0x53cfe8,{'online':0x1}),function(_0x44117e){return db['UserVoiceQueueRt'][_0x7d5f('0x6d')]({'membername':_0x44117e[_0x7d5f('0x2f')],'UserId':_0x44117e['id'],'queue_name':_0x171b20[_0x7d5f('0x2f')],'VoiceQueueId':_0x171b20['id'],'interface':_['isNil'](_0x44117e['interface'])?util['format']('SIP/%s',_0x44117e['name']):_0x44117e['interface'],'paused':_0x44117e[_0x7d5f('0x6b')]||![],'penalty':0x0});});});}});});})[_0x7d5f('0x28')](function(){return _0xedb944;});})[_0x7d5f('0x28')](function(){return _0xedb944;});}})['then'](function(_0x50cdd4){if(_0x50cdd4){return _0x50cdd4[_0x7d5f('0x64')](_0xb85652['body'][_0x7d5f('0x63')],_['omit'](_0xb85652[_0x7d5f('0x4d')],[_0x7d5f('0x63'),'id'])||{})[_0x7d5f('0x6e')](function(_0x4cf7cc){for(var _0x1d8ecb=0x0;_0x1d8ecb<_0xb85652[_0x7d5f('0x4d')][_0x7d5f('0x63')][_0x7d5f('0x3b')];_0x1d8ecb+=0x1){socket['emit'](_0x7d5f('0x6f'),{'UserId':_0xb85652[_0x7d5f('0x4d')]['ids'][_0x1d8ecb],'TeamId':_0xb85652['params']['id']});}return _0x4cf7cc;});}})[_0x7d5f('0x28')](respondWithResult(_0x1f055f,null))[_0x7d5f('0x53')](handleError(_0x1f055f,null));};exports[_0x7d5f('0x70')]=function(_0x5103a3,_0x2eedb6,_0x4a0667){return db['Team'][_0x7d5f('0x4b')]({'where':{'id':_0x5103a3[_0x7d5f('0x48')]['id']}})[_0x7d5f('0x28')](handleEntityNotFound(_0x2eedb6,null))['then'](function(_0x19dfe3){if(_0x19dfe3){return BPromise['each']([_0x7d5f('0x71'),_0x7d5f('0x72'),_0x7d5f('0x73'),'sms',_0x7d5f('0x74'),_0x7d5f('0x75'),_0x7d5f('0x76')],function(_0x4aaa52){return _0x19dfe3[_0x7d5f('0x2a')+_[_0x7d5f('0x5c')](_0x4aaa52)+_0x7d5f('0x5f')]({'attributes':['id',_0x7d5f('0x2f')]})[_0x7d5f('0x28')](function(_0x26c11a){return BPromise[_0x7d5f('0x69')](_0x26c11a,function(_0x4ce222){return _0x4ce222[_0x7d5f('0x70')](_0x5103a3[_0x7d5f('0x35')]['ids'])['then'](function(){if(_0x4aaa52===_0x7d5f('0x71')){return db['UserVoiceQueueRt'][_0x7d5f('0x29')]({'where':{'VoiceQueueId':_0x4ce222['id'],'UserId':_0x5103a3[_0x7d5f('0x35')][_0x7d5f('0x63')]}});}});});})[_0x7d5f('0x28')](function(){return _0x19dfe3;});})['then'](function(){return _0x19dfe3;});}})[_0x7d5f('0x28')](function(_0x1614fd){if(_0x1614fd){return _0x1614fd['removeAgents'](_0x5103a3['query'][_0x7d5f('0x63')])[_0x7d5f('0x28')](function(){if(_[_0x7d5f('0x77')](_0x5103a3[_0x7d5f('0x35')][_0x7d5f('0x63')])){for(var _0xf19ae3=0x0;_0xf19ae3<_0x5103a3[_0x7d5f('0x35')][_0x7d5f('0x63')][_0x7d5f('0x3b')];_0xf19ae3+=0x1){socket[_0x7d5f('0x78')](_0x7d5f('0x79'),{'UserId':Number(_0x5103a3[_0x7d5f('0x35')]['ids'][_0xf19ae3]),'TeamId':Number(_0x5103a3[_0x7d5f('0x48')]['id'])});}}else{socket[_0x7d5f('0x78')](_0x7d5f('0x79'),{'UserId':Number(_0x5103a3[_0x7d5f('0x35')][_0x7d5f('0x63')]),'TeamId':Number(_0x5103a3[_0x7d5f('0x48')]['id'])});}});}})[_0x7d5f('0x28')](respondWithStatusCode(_0x2eedb6,null))['catch'](handleError(_0x2eedb6,null));};exports[_0x7d5f('0x7a')]=function(_0x48b138,_0x3456f2,_0xde5ad){var _0x2cde39={};var _0x29c9ec={};var _0x5109a1;var _0x10fcdb;return db[_0x7d5f('0x32')][_0x7d5f('0x56')]({'where':{'id':_0x48b138[_0x7d5f('0x48')]['id']}})[_0x7d5f('0x28')](handleEntityNotFound(_0x3456f2,null))['then'](function(_0x434bfd){if(_0x434bfd){_0x5109a1=_0x434bfd;_0x29c9ec[_0x7d5f('0x38')]=_[_0x7d5f('0x34')](db['User'][_0x7d5f('0x5e')]);_0x29c9ec['query']=_[_0x7d5f('0x34')](_0x48b138[_0x7d5f('0x35')]);_0x29c9ec[_0x7d5f('0x36')]=_['intersection'](_0x29c9ec[_0x7d5f('0x38')],_0x29c9ec[_0x7d5f('0x35')]);_0x2cde39[_0x7d5f('0x39')]=_['intersection'](_0x29c9ec['model'],qs[_0x7d5f('0x3a')](_0x48b138[_0x7d5f('0x35')]['fields']));_0x2cde39[_0x7d5f('0x39')]=_0x2cde39[_0x7d5f('0x39')][_0x7d5f('0x3b')]?_0x2cde39[_0x7d5f('0x39')]:_0x29c9ec['model'];_0x2cde39[_0x7d5f('0x3d')]=qs['sort'](_0x48b138['query'][_0x7d5f('0x3e')]);_0x2cde39[_0x7d5f('0x3f')]=qs[_0x7d5f('0x36')](_[_0x7d5f('0x40')](_0x48b138[_0x7d5f('0x35')],_0x29c9ec[_0x7d5f('0x36')]));if(_0x48b138[_0x7d5f('0x35')]['filter']){_0x2cde39[_0x7d5f('0x3f')]=_['merge'](_0x2cde39[_0x7d5f('0x3f')],{'$or':_[_0x7d5f('0x31')](_0x2cde39['attributes'],function(_0x32287f){var _0x4880cc={};_0x4880cc[_0x32287f]={'$like':'%'+_0x48b138[_0x7d5f('0x35')][_0x7d5f('0x42')]+'%'};return _0x4880cc;})});}_0x2cde39=_['merge']({},_0x2cde39,_0x48b138[_0x7d5f('0x4a')]);return _0x5109a1[_0x7d5f('0x7a')](_0x2cde39);}})['then'](function(_0x18a987){if(_0x18a987){_0x10fcdb=_0x18a987[_0x7d5f('0x3b')];if(!_0x48b138[_0x7d5f('0x35')]['hasOwnProperty'](_0x7d5f('0x3c'))){_0x2cde39['limit']=qs['limit'](_0x48b138[_0x7d5f('0x35')][_0x7d5f('0x22')]);_0x2cde39[_0x7d5f('0x21')]=qs[_0x7d5f('0x21')](_0x48b138[_0x7d5f('0x35')][_0x7d5f('0x21')]);}return _0x5109a1[_0x7d5f('0x7a')](_0x2cde39);}})['then'](function(_0x573f8c){if(_0x573f8c){return _0x573f8c?{'count':_0x10fcdb,'rows':_0x573f8c}:null;}})[_0x7d5f('0x28')](respondWithResult(_0x3456f2,null))[_0x7d5f('0x53')](handleError(_0x3456f2,null));}; \ No newline at end of file +var _0xf86c=['addQueues','Sequelize','Queues','ids','removeQueues','remove','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','each','addAgents','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','spread','emit','userTeam:save','removeAgents','voice','chat','sms','fax','openchannel','whatsapp','isArray','userTeam:remove','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','then','destroy','get','Teams','UserProfileResource','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','Team','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','sort','capitalize'];(function(_0x2db735,_0x5ddb29){var _0x445d0e=function(_0x571f5a){while(--_0x571f5a){_0x2db735['push'](_0x2db735['shift']());}};_0x445d0e(++_0x5ddb29);}(_0xf86c,0x11f));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xcf86('0x0'));var emlformat=require(_0xcf86('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf86('0x2'));var rp=require(_0xcf86('0x3'));var moment=require(_0xcf86('0x4'));var BPromise=require(_0xcf86('0x5'));var Mustache=require(_0xcf86('0x6'));var util=require(_0xcf86('0x7'));var path=require(_0xcf86('0x8'));var sox=require(_0xcf86('0x9'));var csv=require(_0xcf86('0xa'));var ejs=require(_0xcf86('0xb'));var fs=require('fs');var _=require(_0xcf86('0xc'));var squel=require('squel');var crypto=require(_0xcf86('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcf86('0xe'));var toCsv=require(_0xcf86('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcf86('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcf86('0x10'));var as=require(_0xcf86('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf86('0x12'))('api');var utils=require(_0xcf86('0x13'));var config=require(_0xcf86('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf86('0x15'))['db'];config[_0xcf86('0x16')]=_['defaults'](config[_0xcf86('0x16')],{'host':_0xcf86('0x17'),'port':0x18eb});var socket=require(_0xcf86('0x18'))(new Redis(config[_0xcf86('0x16')]));require('./team.socket')[_0xcf86('0x19')](socket);function respondWithStatusCode(_0x10e253,_0x211aee){_0x211aee=_0x211aee||0xcc;return function(_0x1b8384){if(_0x1b8384){return _0x10e253[_0xcf86('0x1a')](_0x211aee);}return _0x10e253[_0xcf86('0x1b')](_0x211aee)[_0xcf86('0x1c')]();};}function respondWithResult(_0x348782,_0x51bd52){_0x51bd52=_0x51bd52||0xc8;return function(_0x1ccc97){if(_0x1ccc97){return _0x348782[_0xcf86('0x1b')](_0x51bd52)[_0xcf86('0x1d')](_0x1ccc97);}};}function respondWithFilteredResult(_0x43b07c,_0x27ff8f){return function(_0xa519d4){if(_0xa519d4){var _0x2d55c0=_0xa519d4[_0xcf86('0x1e')],_0x4f76c8=_0x27ff8f[_0xcf86('0x1f')],_0x10c2cd=_0x27ff8f[_0xcf86('0x1f')]+_0x27ff8f[_0xcf86('0x20')],_0x18e3a2;if(_0x10c2cd>=_0x2d55c0){_0x10c2cd=_0x2d55c0;_0x18e3a2=0xc8;}else{_0x18e3a2=0xce;}_0x43b07c['status'](_0x18e3a2);return _0x43b07c[_0xcf86('0x21')]('Content-Range',_0x4f76c8+'-'+_0x10c2cd+'/'+_0x2d55c0)[_0xcf86('0x1d')](_0xa519d4);}return null;};}function patchUpdates(_0xdcb271){return function(_0x4ed71c){try{jsonpatch[_0xcf86('0x22')](_0x4ed71c,_0xdcb271,!![]);}catch(_0x10b709){return BPromise['reject'](_0x10b709);}return _0x4ed71c['save']();};}function saveUpdates(_0x52c93a,_0x4e8658){return function(_0x3df226){if(_0x3df226){return _0x3df226['update'](_0x52c93a)[_0xcf86('0x23')](function(_0x293a4f){return _0x293a4f;});}return null;};}function removeEntity(_0x1aa1f3,_0x409b6c){return function(_0x328bc0){if(_0x328bc0){return _0x328bc0[_0xcf86('0x24')]()[_0xcf86('0x23')](function(){var _0x1ddc7d=_0x328bc0[_0xcf86('0x25')]({'plain':!![]});var _0x26929f=_0xcf86('0x26');return db[_0xcf86('0x27')][_0xcf86('0x24')]({'where':{'type':_0x26929f,'resourceId':_0x1ddc7d['id']}})[_0xcf86('0x23')](function(){return _0x328bc0;});})[_0xcf86('0x23')](function(){_0x1aa1f3[_0xcf86('0x1b')](0xcc)[_0xcf86('0x1c')]();});}};}function handleEntityNotFound(_0x21fd0e,_0x569977){return function(_0x28aef4){if(!_0x28aef4){_0x21fd0e['sendStatus'](0x194);}return _0x28aef4;};}function handleError(_0x11e458,_0x25a632){_0x25a632=_0x25a632||0x1f4;return function(_0x47229e){logger['error'](_0x47229e['stack']);if(_0x47229e['name']){delete _0x47229e[_0xcf86('0x28')];}_0x11e458['status'](_0x25a632)[_0xcf86('0x29')](_0x47229e);};}exports[_0xcf86('0x2a')]=function(_0x2dcfb8,_0x1fe869){var _0xb5323c={},_0x437b94={},_0x3097c7={'count':0x0,'rows':[]};var _0x5c8f96=_[_0xcf86('0x2b')](db['Team']['rawAttributes'],function(_0x3f16e7){return{'name':_0x3f16e7['fieldName'],'type':_0x3f16e7['type'][_0xcf86('0x2c')]};});_0x437b94[_0xcf86('0x2d')]=_[_0xcf86('0x2b')](_0x5c8f96,_0xcf86('0x28'));_0x437b94[_0xcf86('0x2e')]=_[_0xcf86('0x2f')](_0x2dcfb8['query']);_0x437b94[_0xcf86('0x30')]=_[_0xcf86('0x31')](_0x437b94[_0xcf86('0x2d')],_0x437b94[_0xcf86('0x2e')]);_0xb5323c[_0xcf86('0x32')]=_[_0xcf86('0x31')](_0x437b94[_0xcf86('0x2d')],qs[_0xcf86('0x33')](_0x2dcfb8[_0xcf86('0x2e')][_0xcf86('0x33')]));_0xb5323c['attributes']=_0xb5323c['attributes'][_0xcf86('0x34')]?_0xb5323c[_0xcf86('0x32')]:_0x437b94['model'];if(!_0x2dcfb8['query'][_0xcf86('0x35')](_0xcf86('0x36'))){_0xb5323c[_0xcf86('0x20')]=qs[_0xcf86('0x20')](_0x2dcfb8['query'][_0xcf86('0x20')]);_0xb5323c[_0xcf86('0x1f')]=qs[_0xcf86('0x1f')](_0x2dcfb8['query'][_0xcf86('0x1f')]);}_0xb5323c[_0xcf86('0x37')]=qs['sort'](_0x2dcfb8[_0xcf86('0x2e')]['sort']);_0xb5323c[_0xcf86('0x38')]=qs['filters'](_[_0xcf86('0x39')](_0x2dcfb8[_0xcf86('0x2e')],_0x437b94[_0xcf86('0x30')]),_0x5c8f96);if(_0x2dcfb8[_0xcf86('0x2e')][_0xcf86('0x3a')]){_0xb5323c['where']=_[_0xcf86('0x3b')](_0xb5323c[_0xcf86('0x38')],{'$or':_[_0xcf86('0x2b')](_0x5c8f96,function(_0x5eee4e){if(_0x5eee4e[_0xcf86('0x3c')]!=='VIRTUAL'){var _0x21bb42={};_0x21bb42[_0x5eee4e[_0xcf86('0x28')]]={'$like':'%'+_0x2dcfb8[_0xcf86('0x2e')][_0xcf86('0x3a')]+'%'};return _0x21bb42;}})});}_0xb5323c=_[_0xcf86('0x3b')]({},_0xb5323c,_0x2dcfb8[_0xcf86('0x3d')]);var _0x5029e8={'where':_0xb5323c['where']};return db[_0xcf86('0x3e')][_0xcf86('0x1e')](_0x5029e8)[_0xcf86('0x23')](function(_0x480fdb){_0x3097c7[_0xcf86('0x1e')]=_0x480fdb;if(_0x2dcfb8[_0xcf86('0x2e')][_0xcf86('0x3f')]){_0xb5323c[_0xcf86('0x40')]=[{'all':!![]}];}return db[_0xcf86('0x3e')][_0xcf86('0x41')](_0xb5323c);})[_0xcf86('0x23')](function(_0x5966b6){_0x3097c7[_0xcf86('0x42')]=_0x5966b6;return _0x3097c7;})[_0xcf86('0x23')](respondWithFilteredResult(_0x1fe869,_0xb5323c))['catch'](handleError(_0x1fe869,null));};exports[_0xcf86('0x43')]=function(_0x33e92a,_0x27a089){var _0x18518b={'raw':![],'where':{'id':_0x33e92a[_0xcf86('0x44')]['id']}},_0x204fd5={};_0x204fd5[_0xcf86('0x2d')]=_[_0xcf86('0x2f')](db[_0xcf86('0x3e')][_0xcf86('0x45')]);_0x204fd5[_0xcf86('0x2e')]=_[_0xcf86('0x2f')](_0x33e92a[_0xcf86('0x2e')]);_0x204fd5[_0xcf86('0x30')]=_['intersection'](_0x204fd5[_0xcf86('0x2d')],_0x204fd5[_0xcf86('0x2e')]);_0x18518b[_0xcf86('0x32')]=_[_0xcf86('0x31')](_0x204fd5[_0xcf86('0x2d')],qs[_0xcf86('0x33')](_0x33e92a[_0xcf86('0x2e')][_0xcf86('0x33')]));_0x18518b[_0xcf86('0x32')]=_0x18518b['attributes'][_0xcf86('0x34')]?_0x18518b[_0xcf86('0x32')]:_0x204fd5[_0xcf86('0x2d')];if(_0x33e92a[_0xcf86('0x2e')][_0xcf86('0x3f')]){_0x18518b['include']=[{'all':!![]}];}_0x18518b=_[_0xcf86('0x3b')]({},_0x18518b,_0x33e92a[_0xcf86('0x3d')]);return db[_0xcf86('0x3e')][_0xcf86('0x46')](_0x18518b)['then'](handleEntityNotFound(_0x27a089,null))['then'](respondWithResult(_0x27a089,null))[_0xcf86('0x47')](handleError(_0x27a089,null));};exports[_0xcf86('0x48')]=function(_0x138ead,_0x2392bd){return db[_0xcf86('0x3e')]['create'](_0x138ead[_0xcf86('0x49')],{})[_0xcf86('0x23')](function(_0x264f26){var _0x5d3b07=_0x138ead[_0xcf86('0x4a')][_0xcf86('0x25')]({'plain':!![]});if(!_0x5d3b07)throw new Error(_0xcf86('0x4b'));if(_0x5d3b07[_0xcf86('0x4c')]===_0xcf86('0x4a')){var _0x353b4a=_0x264f26[_0xcf86('0x25')]({'plain':!![]});var _0x2ddd87='Teams';return db['UserProfileSection'][_0xcf86('0x46')]({'where':{'name':_0x2ddd87,'userProfileId':_0x5d3b07[_0xcf86('0x4d')]},'raw':!![]})[_0xcf86('0x23')](function(_0x4a4008){if(_0x4a4008&&_0x4a4008['autoAssociation']===0x0){return db[_0xcf86('0x27')][_0xcf86('0x48')]({'name':_0x353b4a[_0xcf86('0x28')],'resourceId':_0x353b4a['id'],'type':_0x4a4008[_0xcf86('0x28')],'sectionId':_0x4a4008['id']},{})[_0xcf86('0x23')](function(){return _0x264f26;});}else{return _0x264f26;}})['catch'](function(_0x4bd781){logger[_0xcf86('0x4e')](_0xcf86('0x4f'),_0x4bd781);throw _0x4bd781;});}return _0x264f26;})[_0xcf86('0x23')](respondWithResult(_0x2392bd,0xc9))[_0xcf86('0x47')](handleError(_0x2392bd,null));};exports[_0xcf86('0x50')]=function(_0x424da,_0x27af8f){if(_0x424da[_0xcf86('0x49')]['id']){delete _0x424da[_0xcf86('0x49')]['id'];}return db[_0xcf86('0x3e')][_0xcf86('0x46')]({'where':{'id':_0x424da[_0xcf86('0x44')]['id']}})[_0xcf86('0x23')](handleEntityNotFound(_0x27af8f,null))[_0xcf86('0x23')](saveUpdates(_0x424da[_0xcf86('0x49')],null))['then'](respondWithResult(_0x27af8f,null))[_0xcf86('0x47')](handleError(_0x27af8f,null));};exports[_0xcf86('0x24')]=function(_0x4a4403,_0x5487ab){return db[_0xcf86('0x3e')][_0xcf86('0x46')]({'where':{'id':_0x4a4403[_0xcf86('0x44')]['id']}})[_0xcf86('0x23')](handleEntityNotFound(_0x5487ab,null))[_0xcf86('0x23')](removeEntity(_0x5487ab,null))[_0xcf86('0x47')](handleError(_0x5487ab,null));};exports[_0xcf86('0x51')]=function(_0x3eb775,_0x315881,_0x78c63c){return db[_0xcf86('0x3e')][_0xcf86('0x52')]({'where':{'id':_0x3eb775[_0xcf86('0x44')]['id']}})[_0xcf86('0x23')](handleEntityNotFound(_0x315881,null))[_0xcf86('0x23')](function(_0x284330){if(!_0x3eb775['query'][_0xcf86('0x53')]||!utils[_0xcf86('0x54')](_0x3eb775[_0xcf86('0x2e')][_0xcf86('0x53')])){throw new db['Sequelize'][(_0xcf86('0x55'))](_0xcf86('0x56'));}var _0x2395f7={};var _0x10a79c={};_0x10a79c[_0xcf86('0x2d')]=_[_0xcf86('0x2f')](db[_['capitalize'](_0x3eb775[_0xcf86('0x2e')][_0xcf86('0x53')][_0xcf86('0x57')]())+_0xcf86('0x58')][_0xcf86('0x45')]);_0x10a79c[_0xcf86('0x2e')]=_[_0xcf86('0x2f')](_0x3eb775[_0xcf86('0x2e')]);_0x10a79c[_0xcf86('0x30')]=_[_0xcf86('0x31')](_0x10a79c[_0xcf86('0x2d')],_0x10a79c['query']);_0x2395f7[_0xcf86('0x32')]=_[_0xcf86('0x31')](_0x10a79c[_0xcf86('0x2d')],qs[_0xcf86('0x33')](_0x3eb775[_0xcf86('0x2e')]['fields']));_0x2395f7['attributes']=_0x2395f7[_0xcf86('0x32')][_0xcf86('0x34')]?_0x2395f7[_0xcf86('0x32')]:_0x10a79c[_0xcf86('0x2d')];_0x2395f7[_0xcf86('0x20')]=qs[_0xcf86('0x20')](_0x3eb775[_0xcf86('0x2e')][_0xcf86('0x20')]);_0x2395f7['offset']=qs[_0xcf86('0x1f')](_0x3eb775[_0xcf86('0x2e')][_0xcf86('0x1f')]);_0x2395f7[_0xcf86('0x37')]=qs[_0xcf86('0x59')](_0x3eb775[_0xcf86('0x2e')][_0xcf86('0x59')]);_0x2395f7[_0xcf86('0x38')]=qs[_0xcf86('0x30')](_[_0xcf86('0x39')](_0x3eb775[_0xcf86('0x2e')],_0x10a79c[_0xcf86('0x30')]));_0x2395f7=_['merge']({},_0x2395f7,_0x3eb775[_0xcf86('0x3d')]);return _0x284330[_0xcf86('0x25')+_[_0xcf86('0x5a')](_0x3eb775[_0xcf86('0x2e')][_0xcf86('0x53')][_0xcf86('0x57')]())+'Queues'](_0x2395f7);})['then'](respondWithResult(_0x315881,null))['catch'](handleError(_0x315881,null));};exports[_0xcf86('0x5b')]=function(_0x550bc0,_0x2968b8,_0x57255c){return db[_0xcf86('0x3e')]['findOne']({'where':{'id':_0x550bc0['params']['id']}})[_0xcf86('0x23')](function(_0x2100f8){if(_0x2100f8){if(!_0x550bc0[_0xcf86('0x49')][_0xcf86('0x53')]||!utils['isValidChannel'](_0x550bc0[_0xcf86('0x49')][_0xcf86('0x53')])){throw new db[(_0xcf86('0x5c'))]['ValidationError'](_0xcf86('0x56'));}return _0x2100f8['add'+_[_0xcf86('0x5a')](_0x550bc0[_0xcf86('0x49')]['channel'][_0xcf86('0x57')]())+_0xcf86('0x5d')](_0x550bc0['body'][_0xcf86('0x5e')]);}return null;})[_0xcf86('0x23')](handleEntityNotFound(_0x2968b8,null))[_0xcf86('0x23')](respondWithStatusCode(_0x2968b8,null))['catch'](handleError(_0x2968b8,null));};exports[_0xcf86('0x5f')]=function(_0xf0e230,_0x450ad9,_0x559877){return db[_0xcf86('0x3e')][_0xcf86('0x52')]({'where':{'id':_0xf0e230[_0xcf86('0x44')]['id']}})[_0xcf86('0x23')](function(_0x4e2e1e){if(_0x4e2e1e){if(!_0xf0e230[_0xcf86('0x2e')][_0xcf86('0x53')]||!utils[_0xcf86('0x54')](_0xf0e230[_0xcf86('0x2e')][_0xcf86('0x53')])){throw new db[(_0xcf86('0x5c'))][(_0xcf86('0x55'))](_0xcf86('0x56'));}return _0x4e2e1e[_0xcf86('0x60')+_['capitalize'](_0xf0e230['query'][_0xcf86('0x53')][_0xcf86('0x57')]())+'Queues'](_0xf0e230[_0xcf86('0x2e')][_0xcf86('0x5e')]);}return null;})[_0xcf86('0x23')](handleEntityNotFound(_0x450ad9,null))[_0xcf86('0x23')](respondWithStatusCode(_0x450ad9,null))[_0xcf86('0x47')](handleError(_0x450ad9,null));};exports['addAgents']=function(_0x18e898,_0x11b629,_0x131d61){return db[_0xcf86('0x3e')][_0xcf86('0x46')]({'where':{'id':_0x18e898['params']['id']}})[_0xcf86('0x23')](handleEntityNotFound(_0x11b629,null))[_0xcf86('0x23')](function(_0x2cb634){if(_0x2cb634){var _0x1fcb82=[_0xcf86('0x61'),_0xcf86('0x62'),'Mail',_0xcf86('0x63'),_0xcf86('0x64'),_0xcf86('0x65'),_0xcf86('0x66')];return BPromise[_0xcf86('0x67')](_0x1fcb82,function(_0x45e9ec){return _0x2cb634[_0xcf86('0x25')+_0x45e9ec+_0xcf86('0x5d')]({'attributes':['id',_0xcf86('0x28')]})[_0xcf86('0x23')](function(_0x15b521){return BPromise['each'](_0x15b521,function(_0x4c4a52){return _0x4c4a52[_0xcf86('0x68')](_0x18e898[_0xcf86('0x49')][_0xcf86('0x5e')])['then'](function(){if(_0x45e9ec==='Voice'){return db[_0xcf86('0x69')][_0xcf86('0x41')]({'where':{'id':_0x18e898['body']['ids']},'attributes':['id',_0xcf86('0x28'),_0xcf86('0x6a'),_0xcf86('0x6b'),_0xcf86('0x6c')],'raw':!![]})[_0xcf86('0x23')](function(_0x265802){return BPromise[_0xcf86('0x67')](_[_0xcf86('0x3a')](_0x265802,{'online':0x1}),function(_0x8d6a51){return db[_0xcf86('0x6d')][_0xcf86('0x6e')]({'membername':_0x8d6a51[_0xcf86('0x28')],'UserId':_0x8d6a51['id'],'queue_name':_0x4c4a52[_0xcf86('0x28')],'VoiceQueueId':_0x4c4a52['id'],'interface':_[_0xcf86('0x6f')](_0x8d6a51['interface'])?util['format'](_0xcf86('0x70'),_0x8d6a51[_0xcf86('0x28')]):_0x8d6a51[_0xcf86('0x6c')],'paused':_0x8d6a51[_0xcf86('0x6b')]||![],'penalty':0x0});});});}});});})[_0xcf86('0x23')](function(){return _0x2cb634;});})[_0xcf86('0x23')](function(){return _0x2cb634;});}})[_0xcf86('0x23')](function(_0x15d468){if(_0x15d468){return _0x15d468['addAgents'](_0x18e898[_0xcf86('0x49')][_0xcf86('0x5e')],_['omit'](_0x18e898[_0xcf86('0x49')],[_0xcf86('0x5e'),'id'])||{})[_0xcf86('0x71')](function(_0x54fda8){for(var _0xd2e31e=0x0;_0xd2e31e<_0x18e898[_0xcf86('0x49')][_0xcf86('0x5e')][_0xcf86('0x34')];_0xd2e31e+=0x1){socket[_0xcf86('0x72')](_0xcf86('0x73'),{'UserId':_0x18e898['body']['ids'][_0xd2e31e],'TeamId':_0x18e898[_0xcf86('0x44')]['id']});}return _0x54fda8;});}})[_0xcf86('0x23')](respondWithResult(_0x11b629,null))[_0xcf86('0x47')](handleError(_0x11b629,null));};exports[_0xcf86('0x74')]=function(_0x40fd1a,_0x45f981,_0x319346){return db[_0xcf86('0x3e')][_0xcf86('0x46')]({'where':{'id':_0x40fd1a[_0xcf86('0x44')]['id']}})['then'](handleEntityNotFound(_0x45f981,null))[_0xcf86('0x23')](function(_0x339856){if(_0x339856){return BPromise[_0xcf86('0x67')]([_0xcf86('0x75'),_0xcf86('0x76'),'mail',_0xcf86('0x77'),_0xcf86('0x78'),_0xcf86('0x79'),_0xcf86('0x7a')],function(_0x9ac1a5){return _0x339856[_0xcf86('0x25')+_[_0xcf86('0x5a')](_0x9ac1a5)+_0xcf86('0x5d')]({'attributes':['id',_0xcf86('0x28')]})[_0xcf86('0x23')](function(_0x5ffa59){return BPromise[_0xcf86('0x67')](_0x5ffa59,function(_0x467cc7){return _0x467cc7['removeAgents'](_0x40fd1a[_0xcf86('0x2e')][_0xcf86('0x5e')])[_0xcf86('0x23')](function(){if(_0x9ac1a5===_0xcf86('0x75')){return db[_0xcf86('0x6d')][_0xcf86('0x24')]({'where':{'VoiceQueueId':_0x467cc7['id'],'UserId':_0x40fd1a[_0xcf86('0x2e')]['ids']}});}});});})['then'](function(){return _0x339856;});})[_0xcf86('0x23')](function(){return _0x339856;});}})[_0xcf86('0x23')](function(_0x2966b3){if(_0x2966b3){return _0x2966b3[_0xcf86('0x74')](_0x40fd1a[_0xcf86('0x2e')][_0xcf86('0x5e')])[_0xcf86('0x23')](function(){if(_[_0xcf86('0x7b')](_0x40fd1a['query'][_0xcf86('0x5e')])){for(var _0xcab53a=0x0;_0xcab53a<_0x40fd1a[_0xcf86('0x2e')][_0xcf86('0x5e')][_0xcf86('0x34')];_0xcab53a+=0x1){socket['emit'](_0xcf86('0x7c'),{'UserId':Number(_0x40fd1a[_0xcf86('0x2e')][_0xcf86('0x5e')][_0xcab53a]),'TeamId':Number(_0x40fd1a['params']['id'])});}}else{socket['emit'](_0xcf86('0x7c'),{'UserId':Number(_0x40fd1a[_0xcf86('0x2e')][_0xcf86('0x5e')]),'TeamId':Number(_0x40fd1a[_0xcf86('0x44')]['id'])});}});}})[_0xcf86('0x23')](respondWithStatusCode(_0x45f981,null))['catch'](handleError(_0x45f981,null));};exports[_0xcf86('0x7d')]=function(_0x319ada,_0x457e08,_0x4cf4bf){var _0x31f519={};var _0x32b1e7={};var _0x3fc4ff;var _0x1b41f7;return db[_0xcf86('0x3e')]['findOne']({'where':{'id':_0x319ada[_0xcf86('0x44')]['id']}})[_0xcf86('0x23')](handleEntityNotFound(_0x457e08,null))[_0xcf86('0x23')](function(_0x11a059){if(_0x11a059){_0x3fc4ff=_0x11a059;_0x32b1e7['model']=_[_0xcf86('0x2f')](db[_0xcf86('0x69')][_0xcf86('0x45')]);_0x32b1e7[_0xcf86('0x2e')]=_[_0xcf86('0x2f')](_0x319ada[_0xcf86('0x2e')]);_0x32b1e7[_0xcf86('0x30')]=_[_0xcf86('0x31')](_0x32b1e7[_0xcf86('0x2d')],_0x32b1e7[_0xcf86('0x2e')]);_0x31f519[_0xcf86('0x32')]=_['intersection'](_0x32b1e7[_0xcf86('0x2d')],qs[_0xcf86('0x33')](_0x319ada[_0xcf86('0x2e')]['fields']));_0x31f519[_0xcf86('0x32')]=_0x31f519[_0xcf86('0x32')][_0xcf86('0x34')]?_0x31f519[_0xcf86('0x32')]:_0x32b1e7['model'];_0x31f519['order']=qs[_0xcf86('0x59')](_0x319ada[_0xcf86('0x2e')]['sort']);_0x31f519['where']=qs[_0xcf86('0x30')](_[_0xcf86('0x39')](_0x319ada['query'],_0x32b1e7['filters']));if(_0x319ada['query']['filter']){_0x31f519[_0xcf86('0x38')]=_['merge'](_0x31f519[_0xcf86('0x38')],{'$or':_[_0xcf86('0x2b')](_0x31f519['attributes'],function(_0x32b0b5){var _0x99972a={};_0x99972a[_0x32b0b5]={'$like':'%'+_0x319ada[_0xcf86('0x2e')][_0xcf86('0x3a')]+'%'};return _0x99972a;})});}_0x31f519=_[_0xcf86('0x3b')]({},_0x31f519,_0x319ada['options']);return _0x3fc4ff[_0xcf86('0x7d')](_0x31f519);}})[_0xcf86('0x23')](function(_0xbe67a8){if(_0xbe67a8){_0x1b41f7=_0xbe67a8[_0xcf86('0x34')];if(!_0x319ada[_0xcf86('0x2e')][_0xcf86('0x35')]('nolimit')){_0x31f519[_0xcf86('0x20')]=qs[_0xcf86('0x20')](_0x319ada[_0xcf86('0x2e')][_0xcf86('0x20')]);_0x31f519[_0xcf86('0x1f')]=qs['offset'](_0x319ada[_0xcf86('0x2e')][_0xcf86('0x1f')]);}return _0x3fc4ff[_0xcf86('0x7d')](_0x31f519);}})[_0xcf86('0x23')](function(_0x38aff2){if(_0x38aff2){return _0x38aff2?{'count':_0x1b41f7,'rows':_0x38aff2}:null;}})['then'](respondWithResult(_0x457e08,null))[_0xcf86('0x47')](handleError(_0x457e08,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2ebc1da..aa916e0 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 _0xd321=['emit','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0xd321,0x83));var _0x1d32=function(_0x4c756b,_0x1f8afb){_0x4c756b=_0x4c756b-0x0;var _0x1cb663=_0xd321[_0x4c756b];return _0x1cb663;};'use strict';var EventEmitter=require(_0x1d32('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1d32('0x1')](0x0);var events={'afterCreate':_0x1d32('0x2'),'afterUpdate':_0x1d32('0x3'),'afterDestroy':_0x1d32('0x4')};function emitEvent(_0x15efd9){return function(_0x4a2683,_0x9931b3,_0x57bfc6){TeamEvents['emit'](_0x15efd9+':'+_0x4a2683['id'],_0x4a2683);TeamEvents[_0x1d32('0x5')](_0x15efd9,_0x4a2683);_0x57bfc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x1d32('0x6')](e,emitEvent(event));}}module[_0x1d32('0x7')]=TeamEvents; \ No newline at end of file +var _0xc357=['exports','../../mysqldb','setMaxListeners','save','update','remove','hook'];(function(_0x4d5cfd,_0x5b5c6c){var _0x442f17=function(_0x32a375){while(--_0x32a375){_0x4d5cfd['push'](_0x4d5cfd['shift']());}};_0x442f17(++_0x5b5c6c);}(_0xc357,0x86));var _0x7c35=function(_0x3228cb,_0x42a4a2){_0x3228cb=_0x3228cb-0x0;var _0x64c4d9=_0xc357[_0x3228cb];return _0x64c4d9;};'use strict';var EventEmitter=require('events');var Team=require(_0x7c35('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x7c35('0x1')](0x0);var events={'afterCreate':_0x7c35('0x2'),'afterUpdate':_0x7c35('0x3'),'afterDestroy':_0x7c35('0x4')};function emitEvent(_0x30ed8b){return function(_0x2a4e35,_0x4b7326,_0x14953c){TeamEvents['emit'](_0x30ed8b+':'+_0x2a4e35['id'],_0x2a4e35);TeamEvents['emit'](_0x30ed8b,_0x2a4e35);_0x14953c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x7c35('0x5')](e,emitEvent(event));}}module[_0x7c35('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4325314..e445ee0 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 _0xb524=['define','Team','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./team.attributes','exports'];(function(_0x386042,_0x1869f1){var _0x5e766c=function(_0x24091e){while(--_0x24091e){_0x386042['push'](_0x386042['shift']());}};_0x5e766c(++_0x1869f1);}(_0xb524,0x1ba));var _0x4b52=function(_0x1317d7,_0x12100e){_0x1317d7=_0x1317d7-0x0;var _0x516eb2=_0xb524[_0x1317d7];return _0x516eb2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b52('0x0'))('api');var moment=require(_0x4b52('0x1'));var BPromise=require(_0x4b52('0x2'));var rp=require(_0x4b52('0x3'));var fs=require('fs');var path=require(_0x4b52('0x4'));var rimraf=require('rimraf');var config=require(_0x4b52('0x5'));var attributes=require(_0x4b52('0x6'));module[_0x4b52('0x7')]=function(_0x35acf4,_0x1bdc2e){return _0x35acf4[_0x4b52('0x8')](_0x4b52('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d48=['teams','lodash','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d48,0x18d));var _0x88d4=function(_0x575934,_0x4a6760){_0x575934=_0x575934-0x0;var _0x109a3d=_0x8d48[_0x575934];return _0x109a3d;};'use strict';var _=require(_0x88d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x88d4('0x1'));var moment=require(_0x88d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x88d4('0x3'));var fs=require('fs');var path=require(_0x88d4('0x4'));var rimraf=require(_0x88d4('0x5'));var config=require(_0x88d4('0x6'));var attributes=require('./team.attributes');module[_0x88d4('0x7')]=function(_0x2f81a2,_0x1e6591){return _0x2f81a2[_0x88d4('0x8')](_0x88d4('0x9'),attributes,{'tableName':_0x88d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 77805f5..a0d0ce0 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 _0x0204=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4e4e69,_0x3b8a2c){var _0x1a1211=function(_0x484021){while(--_0x484021){_0x4e4e69['push'](_0x4e4e69['shift']());}};_0x1a1211(++_0x3b8a2c);}(_0x0204,0x81));var _0x4020=function(_0x52ac03,_0x27284c){_0x52ac03=_0x52ac03-0x0;var _0x214cc3=_0x0204[_0x52ac03];return _0x214cc3;};'use strict';var _=require(_0x4020('0x0'));var util=require('util');var moment=require(_0x4020('0x1'));var BPromise=require(_0x4020('0x2'));var rs=require(_0x4020('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4020('0x4'));var logger=require(_0x4020('0x5'))(_0x4020('0x6'));var config=require(_0x4020('0x7'));var jayson=require(_0x4020('0x8'));var client=jayson[_0x4020('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4020('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4020('0xb'))(new Redis(config[_0x4020('0xa')]));require(_0x4020('0xc'))[_0x4020('0xd')](socket);function respondWithRpcPromise(_0x54b709,_0x2a928d,_0x5189c1){return new BPromise(function(_0x212b14,_0x1fc4a2){return client[_0x4020('0xe')](_0x54b709,_0x5189c1)[_0x4020('0xf')](function(_0x1defce){logger[_0x4020('0x10')]('Team,\x20%s,\x20%s',_0x2a928d,'request\x20sent');logger[_0x4020('0x11')](_0x4020('0x12'),_0x2a928d,_0x4020('0x13'),JSON['stringify'](_0x1defce));if(_0x1defce['error']){if(_0x1defce[_0x4020('0x14')][_0x4020('0x15')]===0x1f4){logger[_0x4020('0x14')](_0x4020('0x16'),_0x2a928d,_0x1defce[_0x4020('0x14')][_0x4020('0x17')]);return _0x1fc4a2(_0x1defce[_0x4020('0x14')]['message']);}logger['error']('Team,\x20%s,\x20%s',_0x2a928d,_0x1defce[_0x4020('0x14')]['message']);return _0x212b14(_0x1defce[_0x4020('0x14')]['message']);}else{logger[_0x4020('0x10')](_0x4020('0x16'),_0x2a928d,_0x4020('0x13'));_0x212b14(_0x1defce[_0x4020('0x18')][_0x4020('0x17')]);}})[_0x4020('0x19')](function(_0x30155b){logger[_0x4020('0x14')](_0x4020('0x16'),_0x2a928d,_0x30155b);_0x1fc4a2(_0x30155b);});});} \ No newline at end of file +var _0x3195=['info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./team.socket','register','request','then'];(function(_0x1a9204,_0x1e4d83){var _0x234691=function(_0x4751e3){while(--_0x4751e3){_0x1a9204['push'](_0x1a9204['shift']());}};_0x234691(++_0x1e4d83);}(_0x3195,0x191));var _0x5319=function(_0x3018e6,_0x2824a6){_0x3018e6=_0x3018e6-0x0;var _0x3cb4c9=_0x3195[_0x3018e6];return _0x3cb4c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5319('0x0'));var fs=require('fs');var Redis=require(_0x5319('0x1'));var db=require(_0x5319('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5319('0x3'))(_0x5319('0x4'));var config=require('../../config/environment');var jayson=require(_0x5319('0x5'));var client=jayson[_0x5319('0x6')]['http']({'port':0x232a});config['redis']=_[_0x5319('0x7')](config['redis'],{'host':_0x5319('0x8'),'port':0x18eb});var socket=require(_0x5319('0x9'))(new Redis(config[_0x5319('0xa')]));require(_0x5319('0xb'))[_0x5319('0xc')](socket);function respondWithRpcPromise(_0x153557,_0x470b2d,_0x36e51d){return new BPromise(function(_0x590a44,_0x71b968){return client[_0x5319('0xd')](_0x153557,_0x36e51d)[_0x5319('0xe')](function(_0x308e9c){logger[_0x5319('0xf')](_0x5319('0x10'),_0x470b2d,_0x5319('0x11'));logger[_0x5319('0x12')](_0x5319('0x13'),_0x470b2d,_0x5319('0x11'),JSON[_0x5319('0x14')](_0x308e9c));if(_0x308e9c[_0x5319('0x15')]){if(_0x308e9c[_0x5319('0x15')][_0x5319('0x16')]===0x1f4){logger[_0x5319('0x15')]('Team,\x20%s,\x20%s',_0x470b2d,_0x308e9c[_0x5319('0x15')][_0x5319('0x17')]);return _0x71b968(_0x308e9c['error'][_0x5319('0x17')]);}logger[_0x5319('0x15')](_0x5319('0x10'),_0x470b2d,_0x308e9c[_0x5319('0x15')][_0x5319('0x17')]);return _0x590a44(_0x308e9c['error'][_0x5319('0x17')]);}else{logger[_0x5319('0xf')](_0x5319('0x10'),_0x470b2d,_0x5319('0x11'));_0x590a44(_0x308e9c[_0x5319('0x18')][_0x5319('0x17')]);}})[_0x5319('0x19')](function(_0x529f13){logger[_0x5319('0x15')]('Team,\x20%s,\x20%s',_0x470b2d,_0x529f13);_0x71b968(_0x529f13);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5673dd7..91d74de 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 _0x565e=['remove','update','emit','removeListener','register','length','team:','./team.events'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xe565('0x0'));var events=['save',_0xe565('0x1'),_0xe565('0x2')];function createListener(_0x1944d3,_0x47c225){return function(_0x48861a){_0x47c225[_0xe565('0x3')](_0x1944d3,_0x48861a);};}function removeListener(_0x33fd83,_0x14f472){return function(){TeamEvents[_0xe565('0x4')](_0x33fd83,_0x14f472);};}exports[_0xe565('0x5')]=function(_0x45ba66){for(var _0xe4af03=0x0,_0x1a9d48=events[_0xe565('0x6')];_0xe4af03<_0x1a9d48;_0xe4af03++){var _0x359a05=events[_0xe4af03];var _0x1204c8=createListener(_0xe565('0x7')+_0x359a05,_0x45ba66);TeamEvents['on'](_0x359a05,_0x1204c8);}}; \ No newline at end of file +var _0xdc86=['emit','register','length','team:','save','update'];(function(_0x2e3136,_0x739259){var _0x3cbd9d=function(_0x31fa6b){while(--_0x31fa6b){_0x2e3136['push'](_0x2e3136['shift']());}};_0x3cbd9d(++_0x739259);}(_0xdc86,0x118));var _0x6dc8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc86[_0x321bb2];return _0x9c12ed;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6dc8('0x0'),'remove',_0x6dc8('0x1')];function createListener(_0x52ed6c,_0x30da65){return function(_0x384f46){_0x30da65[_0x6dc8('0x2')](_0x52ed6c,_0x384f46);};}function removeListener(_0xfa6165,_0x44634f){return function(){TeamEvents['removeListener'](_0xfa6165,_0x44634f);};}exports[_0x6dc8('0x3')]=function(_0x3109bf){for(var _0xbc9bc4=0x0,_0x9b1bcc=events[_0x6dc8('0x4')];_0xbc9bc4<_0x9b1bcc;_0xbc9bc4++){var _0x1f41c7=events[_0xbc9bc4];var _0x41bdf5=createListener(_0x6dc8('0x5')+_0x1f41c7,_0x3109bf);TeamEvents['on'](_0x1f41c7,_0x41bdf5);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 00b3169..351f819 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 _0x3aa4=['express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x3aa4,0x6d));var _0x43aa=function(_0x5308cb,_0x16c79b){_0x5308cb=_0x5308cb-0x0;var _0x38b5eb=_0x3aa4[_0x5308cb];return _0x38b5eb;};'use strict';var multer=require(_0x43aa('0x0'));var util=require(_0x43aa('0x1'));var path=require(_0x43aa('0x2'));var timeout=require('connect-timeout');var express=require(_0x43aa('0x3'));var router=express[_0x43aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x43aa('0x5'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x43aa('0x6')]('/',auth[_0x43aa('0x7')](),controller[_0x43aa('0x8')]);router['get'](_0x43aa('0x9'),auth[_0x43aa('0x7')](),controller[_0x43aa('0xa')]);router[_0x43aa('0xb')]('/',auth[_0x43aa('0x7')](),controller['create']);router[_0x43aa('0xc')](_0x43aa('0x9'),auth[_0x43aa('0x7')](),controller[_0x43aa('0xd')]);router[_0x43aa('0xe')](_0x43aa('0x9'),auth['isAuthenticated'](),controller[_0x43aa('0xf')]);module['exports']=router; \ No newline at end of file +var _0x188d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','create','put','update','exports','multer','path','connect-timeout'];(function(_0x59c128,_0x50f1ce){var _0x4d81de=function(_0xec38ba){while(--_0xec38ba){_0x59c128['push'](_0x59c128['shift']());}};_0x4d81de(++_0x50f1ce);}(_0x188d,0x151));var _0xd188=function(_0x196ddc,_0x514491){_0x196ddc=_0x196ddc-0x0;var _0x5d15f2=_0x188d[_0x196ddc];return _0x5d15f2;};'use strict';var multer=require(_0xd188('0x0'));var util=require('util');var path=require(_0xd188('0x1'));var timeout=require(_0xd188('0x2'));var express=require(_0xd188('0x3'));var router=express[_0xd188('0x4')]();var auth=require(_0xd188('0x5'));var interaction=require(_0xd188('0x6'));var config=require(_0xd188('0x7'));var controller=require(_0xd188('0x8'));router[_0xd188('0x9')]('/',auth[_0xd188('0xa')](),controller['index']);router[_0xd188('0x9')](_0xd188('0xb'),auth[_0xd188('0xa')](),controller[_0xd188('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd188('0xd')]);router[_0xd188('0xe')]('/:id',auth[_0xd188('0xa')](),controller[_0xd188('0xf')]);router['delete'](_0xd188('0xb'),auth[_0xd188('0xa')](),controller['destroy']);module[_0xd188('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f85a68e..bf9a725 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 _0x5e5e=['sequelize','STRING'];(function(_0x322f97,_0x36c812){var _0x240189=function(_0x57b095){while(--_0x57b095){_0x322f97['push'](_0x322f97['shift']());}};_0x240189(++_0x36c812);}(_0x5e5e,0x7a));var _0xe5e5=function(_0xbade7c,_0x3088e1){_0xbade7c=_0xbade7c-0x0;var _0x4dbaa4=_0x5e5e[_0xbade7c];return _0x4dbaa4;};'use strict';var Sequelize=require(_0xe5e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5e5('0x1')]},'description':{'type':Sequelize[_0xe5e5('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xaf00=['STRING','TEXT','sequelize'];(function(_0x36afdd,_0x62adc7){var _0x20d2ab=function(_0x22d92c){while(--_0x22d92c){_0x36afdd['push'](_0x36afdd['shift']());}};_0x20d2ab(++_0x62adc7);}(_0xaf00,0xf5));var _0x0af0=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0xaf00[_0x2a0183];return _0x158c3a;};'use strict';var Sequelize=require(_0x0af0('0x0'));module['exports']={'name':{'type':Sequelize[_0x0af0('0x1')]},'description':{'type':Sequelize[_0x0af0('0x1')]},'html':{'type':Sequelize[_0x0af0('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 24429a8..12071c4 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 _0x1261=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','name','send','index','Template','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x32ecef,_0x517adc){var _0x2de8ea=function(_0x575e62){while(--_0x575e62){_0x32ecef['push'](_0x32ecef['shift']());}};_0x2de8ea(++_0x517adc);}(_0x1261,0x144));var _0x1126=function(_0x1a1c45,_0x4fdc66){_0x1a1c45=_0x1a1c45-0x0;var _0x3dbd0f=_0x1261[_0x1a1c45];return _0x3dbd0f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=_0x45149c['count'],_0x35fe9f=_0x4be0c6[_0x1126('0x1c')],_0x42f379=_0x4be0c6[_0x1126('0x1c')]+_0x4be0c6['limit'],_0x257b5f;if(_0x42f379>=_0x4794a7){_0x42f379=_0x4794a7;_0x257b5f=0xc8;}else{_0x257b5f=0xce;}_0x279455['status'](_0x257b5f);return _0x279455[_0x1126('0x1d')](_0x1126('0x1e'),_0x35fe9f+'-'+_0x42f379+'/'+_0x4794a7)['json'](_0x45149c);}return null;};}function patchUpdates(_0x548359){return function(_0x4564c0){try{jsonpatch['apply'](_0x4564c0,_0x548359,!![]);}catch(_0x22ed37){return BPromise[_0x1126('0x1f')](_0x22ed37);}return _0x4564c0[_0x1126('0x20')]();};}function saveUpdates(_0x54400a,_0x2a08ba){return function(_0x49d209){if(_0x49d209){return _0x49d209['update'](_0x54400a)[_0x1126('0x21')](function(_0x3a9bed){return _0x3a9bed;});}return null;};}function removeEntity(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x22')]()[_0x1126('0x21')](function(){var _0x48a08d=_0x526ca1[_0x1126('0x23')]({'plain':!![]});var _0x59cd8e='Templates';return db['UserProfileResource'][_0x1126('0x22')]({'where':{'type':_0x59cd8e,'resourceId':_0x48a08d['id']}})[_0x1126('0x21')](function(){return _0x526ca1;});})[_0x1126('0x21')](function(){_0x25b24b[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x1b07a7,_0xea0971){return function(_0x38119d){if(!_0x38119d){_0x1b07a7['sendStatus'](0x194);}return _0x38119d;};}function handleError(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0x1f4;return function(_0xa293f4){logger['error'](_0xa293f4['stack']);if(_0xa293f4[_0x1126('0x24')]){delete _0xa293f4[_0x1126('0x24')];}_0x35eec3['status'](_0x375e59)[_0x1126('0x25')](_0xa293f4);};}exports[_0x1126('0x26')]=function(_0x4a334a,_0x3fa694){var _0x4bf807={},_0xc62460={},_0x4bd50b={'count':0x0,'rows':[]};var _0x771bb8=_['map'](db[_0x1126('0x27')]['rawAttributes'],function(_0x5252e0){return{'name':_0x5252e0['fieldName'],'type':_0x5252e0[_0x1126('0x28')][_0x1126('0x29')]};});_0xc62460[_0x1126('0x2a')]=_['map'](_0x771bb8,_0x1126('0x24'));_0xc62460[_0x1126('0x2b')]=_['keys'](_0x4a334a[_0x1126('0x2b')]);_0xc62460[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],_0xc62460['query']);_0x4bf807['attributes']=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],qs[_0x1126('0x2e')](_0x4a334a[_0x1126('0x2b')]['fields']));_0x4bf807[_0x1126('0x2f')]=_0x4bf807[_0x1126('0x2f')][_0x1126('0x30')]?_0x4bf807[_0x1126('0x2f')]:_0xc62460[_0x1126('0x2a')];if(!_0x4a334a['query'][_0x1126('0x31')](_0x1126('0x32'))){_0x4bf807[_0x1126('0x33')]=qs[_0x1126('0x33')](_0x4a334a['query']['limit']);_0x4bf807[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x4a334a['query'][_0x1126('0x1c')]);}_0x4bf807[_0x1126('0x34')]=qs[_0x1126('0x35')](_0x4a334a['query']['sort']);_0x4bf807[_0x1126('0x36')]=qs[_0x1126('0x2c')](_[_0x1126('0x37')](_0x4a334a[_0x1126('0x2b')],_0xc62460['filters']),_0x771bb8);if(_0x4a334a[_0x1126('0x2b')]['filter']){_0x4bf807[_0x1126('0x36')]=_[_0x1126('0x38')](_0x4bf807[_0x1126('0x36')],{'$or':_[_0x1126('0x39')](_0x771bb8,function(_0x57e5d2){if(_0x57e5d2['type']!==_0x1126('0x3a')){var _0x3ea9de={};_0x3ea9de[_0x57e5d2[_0x1126('0x24')]]={'$like':'%'+_0x4a334a[_0x1126('0x2b')][_0x1126('0x3b')]+'%'};return _0x3ea9de;}})});}_0x4bf807=_[_0x1126('0x38')]({},_0x4bf807,_0x4a334a[_0x1126('0x3c')]);var _0x4faaa3={'where':_0x4bf807[_0x1126('0x36')]};return db[_0x1126('0x27')][_0x1126('0x3d')](_0x4faaa3)[_0x1126('0x21')](function(_0xcf0483){_0x4bd50b['count']=_0xcf0483;if(_0x4a334a['query'][_0x1126('0x3e')]){_0x4bf807[_0x1126('0x3f')]=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x40')](_0x4bf807);})[_0x1126('0x21')](function(_0x276fd5){_0x4bd50b['rows']=_0x276fd5;return _0x4bd50b;})['then'](respondWithFilteredResult(_0x3fa694,_0x4bf807))['catch'](handleError(_0x3fa694,null));};exports[_0x1126('0x41')]=function(_0x5d4194,_0xf84005){var _0x462da8={'raw':!![],'where':{'id':_0x5d4194[_0x1126('0x42')]['id']}},_0x3584a3={};_0x3584a3['model']=_['keys'](db[_0x1126('0x27')][_0x1126('0x43')]);_0x3584a3[_0x1126('0x2b')]=_['keys'](_0x5d4194[_0x1126('0x2b')]);_0x3584a3['filters']=_[_0x1126('0x2d')](_0x3584a3['model'],_0x3584a3[_0x1126('0x2b')]);_0x462da8[_0x1126('0x2f')]=_[_0x1126('0x2d')](_0x3584a3['model'],qs[_0x1126('0x2e')](_0x5d4194[_0x1126('0x2b')][_0x1126('0x2e')]));_0x462da8['attributes']=_0x462da8['attributes']['length']?_0x462da8[_0x1126('0x2f')]:_0x3584a3['model'];if(_0x5d4194[_0x1126('0x2b')]['includeAll']){_0x462da8[_0x1126('0x3f')]=[{'all':!![]}];}_0x462da8=_[_0x1126('0x38')]({},_0x462da8,_0x5d4194[_0x1126('0x3c')]);return db[_0x1126('0x27')][_0x1126('0x44')](_0x462da8)['then'](handleEntityNotFound(_0xf84005,null))[_0x1126('0x21')](respondWithResult(_0xf84005,null))[_0x1126('0x45')](handleError(_0xf84005,null));};exports['create']=function(_0x1a15f8,_0x13dc39){return db['Template'][_0x1126('0x46')](_0x1a15f8[_0x1126('0x47')],{})['then'](function(_0x3e4eeb){var _0xbdde58=_0x1a15f8[_0x1126('0x48')]['get']({'plain':!![]});if(!_0xbdde58)throw new Error(_0x1126('0x49'));if(_0xbdde58[_0x1126('0x4a')]===_0x1126('0x48')){var _0x5878bb=_0x3e4eeb[_0x1126('0x23')]({'plain':!![]});var _0x2081f2=_0x1126('0x4b');return db[_0x1126('0x4c')]['find']({'where':{'name':_0x2081f2,'userProfileId':_0xbdde58[_0x1126('0x4d')]},'raw':!![]})['then'](function(_0x40168e){if(_0x40168e&&_0x40168e[_0x1126('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5878bb[_0x1126('0x24')],'resourceId':_0x5878bb['id'],'type':_0x40168e[_0x1126('0x24')],'sectionId':_0x40168e['id']},{})[_0x1126('0x21')](function(){return _0x3e4eeb;});}else{return _0x3e4eeb;}})['catch'](function(_0x3cb44c){logger[_0x1126('0x4f')](_0x1126('0x50'),_0x3cb44c);throw _0x3cb44c;});}return _0x3e4eeb;})[_0x1126('0x21')](respondWithResult(_0x13dc39,0xc9))['catch'](handleError(_0x13dc39,null));};exports[_0x1126('0x51')]=function(_0x46551f,_0x5c36b9){if(_0x46551f['body']['id']){delete _0x46551f['body']['id'];}return db['Template'][_0x1126('0x44')]({'where':{'id':_0x46551f[_0x1126('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c36b9,null))[_0x1126('0x21')](saveUpdates(_0x46551f[_0x1126('0x47')],null))[_0x1126('0x21')](respondWithResult(_0x5c36b9,null))[_0x1126('0x45')](handleError(_0x5c36b9,null));};exports[_0x1126('0x22')]=function(_0x4e4d49,_0x41cbb6){return db[_0x1126('0x27')]['find']({'where':{'id':_0x4e4d49[_0x1126('0x42')]['id']}})[_0x1126('0x21')](handleEntityNotFound(_0x41cbb6,null))[_0x1126('0x21')](removeEntity(_0x41cbb6,null))[_0x1126('0x45')](handleError(_0x41cbb6,null));}; \ No newline at end of file +var _0x7a54=['fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','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','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','type','key','model','map','keys','query','intersection'];(function(_0x2dfd1b,_0x1dfb6c){var _0x223f96=function(_0x572df2){while(--_0x572df2){_0x2dfd1b['push'](_0x2dfd1b['shift']());}};_0x223f96(++_0x1dfb6c);}(_0x7a54,0x106));var _0x47a5=function(_0x46578e,_0x1582db){_0x46578e=_0x46578e-0x0;var _0x32a04f=_0x7a54[_0x46578e];return _0x32a04f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='Templates';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filters']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 006427e..7996a3e 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 _0xe09d=['rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x38cfe6,_0x13f32a){var _0xffcb11=function(_0x18ea20){while(--_0x18ea20){_0x38cfe6['push'](_0x38cfe6['shift']());}};_0xffcb11(++_0x13f32a);}(_0xe09d,0x166));var _0xde09=function(_0x5dcebf,_0x3b43fb){_0x5dcebf=_0x5dcebf-0x0;var _0x309252=_0xe09d[_0x5dcebf];return _0x309252;};'use strict';var _=require(_0xde09('0x0'));var util=require(_0xde09('0x1'));var logger=require(_0xde09('0x2'))('api');var moment=require('moment');var BPromise=require(_0xde09('0x3'));var rp=require(_0xde09('0x4'));var fs=require('fs');var path=require(_0xde09('0x5'));var rimraf=require(_0xde09('0x6'));var config=require(_0xde09('0x7'));var attributes=require(_0xde09('0x8'));module[_0xde09('0x9')]=function(_0x4c2598,_0x1a1483){return _0x4c2598[_0xde09('0xa')](_0xde09('0xb'),attributes,{'tableName':_0xde09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e0c=['api','moment','bluebird','request-promise','path','rimraf','define','tools_templates','lodash','util','../../config/logger'];(function(_0xaa3e22,_0x874ebb){var _0xf90dc4=function(_0x35df8e){while(--_0x35df8e){_0xaa3e22['push'](_0xaa3e22['shift']());}};_0xf90dc4(++_0x874ebb);}(_0x9e0c,0x1aa));var _0xc9e0=function(_0x5e7423,_0x3327ec){_0x5e7423=_0x5e7423-0x0;var _0xc3a2db=_0x9e0c[_0x5e7423];return _0xc3a2db;};'use strict';var _=require(_0xc9e0('0x0'));var util=require(_0xc9e0('0x1'));var logger=require(_0xc9e0('0x2'))(_0xc9e0('0x3'));var moment=require(_0xc9e0('0x4'));var BPromise=require(_0xc9e0('0x5'));var rp=require(_0xc9e0('0x6'));var fs=require('fs');var path=require(_0xc9e0('0x7'));var rimraf=require(_0xc9e0('0x8'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x570258,_0x37d652){return _0x570258[_0xc9e0('0x9')]('Template',attributes,{'tableName':_0xc9e0('0xa'),'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 09780ff..ddcf350 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 _0x6b68=['map','model','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','options','raw','attributes','limit','include'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6b68,0xbd));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x86b6('0x0'));var util=require('util');var moment=require(_0x86b6('0x1'));var BPromise=require(_0x86b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86b6('0x3'));var db=require(_0x86b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x86b6('0x5'))(_0x86b6('0x6'));var config=require(_0x86b6('0x7'));var jayson=require(_0x86b6('0x8'));var client=jayson[_0x86b6('0x9')][_0x86b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14c37a,_0x19919f,_0x1b455a){return new BPromise(function(_0x23b7a7,_0x3f56d1){return client['request'](_0x14c37a,_0x1b455a)[_0x86b6('0xb')](function(_0x178647){logger[_0x86b6('0xc')](_0x86b6('0xd'),_0x19919f,'request\x20sent');logger['debug'](_0x86b6('0xe'),_0x19919f,_0x86b6('0xf'),JSON[_0x86b6('0x10')](_0x178647));if(_0x178647[_0x86b6('0x11')]){if(_0x178647[_0x86b6('0x11')][_0x86b6('0x12')]===0x1f4){logger[_0x86b6('0x11')]('Template,\x20%s,\x20%s',_0x19919f,_0x178647['error']['message']);return _0x3f56d1(_0x178647[_0x86b6('0x11')][_0x86b6('0x13')]);}logger[_0x86b6('0x11')](_0x86b6('0xd'),_0x19919f,_0x178647[_0x86b6('0x11')][_0x86b6('0x13')]);return _0x23b7a7(_0x178647[_0x86b6('0x11')][_0x86b6('0x13')]);}else{logger[_0x86b6('0xc')]('Template,\x20%s,\x20%s',_0x19919f,'request\x20sent');_0x23b7a7(_0x178647[_0x86b6('0x14')][_0x86b6('0x13')]);}})[_0x86b6('0x15')](function(_0x44c78e){logger['error'](_0x86b6('0xd'),_0x19919f,_0x44c78e);_0x3f56d1(_0x44c78e);});});}exports[_0x86b6('0x16')]=function(_0x2f7d33){var _0x3d778b=this;return new Promise(function(_0x47ab13,_0x261dcc){return db['Template']['findAll']({'raw':_0x2f7d33[_0x86b6('0x17')]?_0x2f7d33[_0x86b6('0x17')][_0x86b6('0x18')]===undefined?!![]:![]:!![],'where':_0x2f7d33[_0x86b6('0x17')]?_0x2f7d33[_0x86b6('0x17')]['where']||null:null,'attributes':_0x2f7d33['options']?_0x2f7d33[_0x86b6('0x17')][_0x86b6('0x19')]||null:null,'limit':_0x2f7d33[_0x86b6('0x17')]?_0x2f7d33[_0x86b6('0x17')][_0x86b6('0x1a')]||null:null,'include':_0x2f7d33['options']?_0x2f7d33[_0x86b6('0x17')][_0x86b6('0x1b')]?_[_0x86b6('0x1c')](_0x2f7d33[_0x86b6('0x17')][_0x86b6('0x1b')],function(_0x485d1a){return{'model':db[_0x485d1a[_0x86b6('0x1d')]],'as':_0x485d1a['as'],'attributes':_0x485d1a[_0x86b6('0x19')],'include':_0x485d1a['include']?_['map'](_0x485d1a['include'],function(_0x2208ca){return{'model':db[_0x2208ca[_0x86b6('0x1d')]],'as':_0x2208ca['as'],'attributes':_0x2208ca['attributes'],'include':_0x2208ca['include']?_[_0x86b6('0x1c')](_0x2208ca[_0x86b6('0x1b')],function(_0x2320b1){return{'model':db[_0x2320b1['model']],'as':_0x2320b1['as'],'attributes':_0x2320b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x86b6('0xb')](function(_0x1a50c6){logger[_0x86b6('0xc')](_0x86b6('0x16'),_0x2f7d33);logger[_0x86b6('0x1e')](_0x86b6('0x16'),_0x2f7d33,JSON[_0x86b6('0x10')](_0x1a50c6));_0x47ab13(_0x1a50c6);})['catch'](function(_0x2af9fc){logger['error'](_0x86b6('0x16'),_0x2af9fc[_0x86b6('0x13')],_0x2f7d33);_0x261dcc(_0x3d778b[_0x86b6('0x11')](0x1f4,_0x2af9fc[_0x86b6('0x13')]));});});}; \ No newline at end of file +var _0x2a0d=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','Template','findAll','options','raw','where','include','map','attributes','model','GetTemplate','debug','lodash','util','moment','bluebird'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x2a0d,0x150));var _0xd2a0=function(_0x11620d,_0x34f8e1){_0x11620d=_0x11620d-0x0;var _0x194626=_0x2a0d[_0x11620d];return _0x194626;};'use strict';var _=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var moment=require(_0xd2a0('0x2'));var BPromise=require(_0xd2a0('0x3'));var rs=require(_0xd2a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2a0('0x5'))['db'];var utils=require(_0xd2a0('0x6'));var logger=require(_0xd2a0('0x7'))(_0xd2a0('0x8'));var config=require('../../config/environment');var jayson=require(_0xd2a0('0x9'));var client=jayson[_0xd2a0('0xa')][_0xd2a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x484546,_0x55862b,_0x379a50){return new BPromise(function(_0x4ba79a,_0x4c0408){return client[_0xd2a0('0xc')](_0x484546,_0x379a50)[_0xd2a0('0xd')](function(_0xfe56dd){logger['info'](_0xd2a0('0xe'),_0x55862b,_0xd2a0('0xf'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x55862b,_0xd2a0('0xf'),JSON[_0xd2a0('0x10')](_0xfe56dd));if(_0xfe56dd[_0xd2a0('0x11')]){if(_0xfe56dd[_0xd2a0('0x11')][_0xd2a0('0x12')]===0x1f4){logger[_0xd2a0('0x11')]('Template,\x20%s,\x20%s',_0x55862b,_0xfe56dd[_0xd2a0('0x11')][_0xd2a0('0x13')]);return _0x4c0408(_0xfe56dd[_0xd2a0('0x11')]['message']);}logger[_0xd2a0('0x11')]('Template,\x20%s,\x20%s',_0x55862b,_0xfe56dd[_0xd2a0('0x11')]['message']);return _0x4ba79a(_0xfe56dd[_0xd2a0('0x11')][_0xd2a0('0x13')]);}else{logger[_0xd2a0('0x14')](_0xd2a0('0xe'),_0x55862b,_0xd2a0('0xf'));_0x4ba79a(_0xfe56dd[_0xd2a0('0x15')][_0xd2a0('0x13')]);}})[_0xd2a0('0x16')](function(_0x25681e){logger['error'](_0xd2a0('0xe'),_0x55862b,_0x25681e);_0x4c0408(_0x25681e);});});}exports['GetTemplate']=function(_0x572242){var _0x1c5246=this;return new Promise(function(_0x32749e,_0x39a9e9){return db[_0xd2a0('0x17')][_0xd2a0('0x18')]({'raw':_0x572242[_0xd2a0('0x19')]?_0x572242[_0xd2a0('0x19')][_0xd2a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x572242[_0xd2a0('0x19')]?_0x572242[_0xd2a0('0x19')][_0xd2a0('0x1b')]||null:null,'attributes':_0x572242[_0xd2a0('0x19')]?_0x572242['options']['attributes']||null:null,'limit':_0x572242[_0xd2a0('0x19')]?_0x572242['options']['limit']||null:null,'include':_0x572242[_0xd2a0('0x19')]?_0x572242[_0xd2a0('0x19')][_0xd2a0('0x1c')]?_[_0xd2a0('0x1d')](_0x572242['options']['include'],function(_0x5a4975){return{'model':db[_0x5a4975['model']],'as':_0x5a4975['as'],'attributes':_0x5a4975[_0xd2a0('0x1e')],'include':_0x5a4975[_0xd2a0('0x1c')]?_[_0xd2a0('0x1d')](_0x5a4975[_0xd2a0('0x1c')],function(_0x3217da){return{'model':db[_0x3217da['model']],'as':_0x3217da['as'],'attributes':_0x3217da[_0xd2a0('0x1e')],'include':_0x3217da[_0xd2a0('0x1c')]?_[_0xd2a0('0x1d')](_0x3217da[_0xd2a0('0x1c')],function(_0x37d6eb){return{'model':db[_0x37d6eb[_0xd2a0('0x1f')]],'as':_0x37d6eb['as'],'attributes':_0x37d6eb[_0xd2a0('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x516dd9){logger[_0xd2a0('0x14')](_0xd2a0('0x20'),_0x572242);logger[_0xd2a0('0x21')](_0xd2a0('0x20'),_0x572242,JSON[_0xd2a0('0x10')](_0x516dd9));_0x32749e(_0x516dd9);})[_0xd2a0('0x16')](function(_0x54a003){logger['error'](_0xd2a0('0x20'),_0x54a003[_0xd2a0('0x13')],_0x572242);_0x39a9e9(_0x1c5246['error'](0x1f4,_0x54a003[_0xd2a0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 78c71ec..7d81fc1 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 _0x23c0=['update','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','put','/:id'];(function(_0x421a35,_0x140142){var _0x2b2163=function(_0x14ac9b){while(--_0x14ac9b){_0x421a35['push'](_0x421a35['shift']());}};_0x2b2163(++_0x140142);}(_0x23c0,0x153));var _0x023c=function(_0x52ca7f,_0x43ea59){_0x52ca7f=_0x52ca7f-0x0;var _0x470923=_0x23c0[_0x52ca7f];return _0x470923;};'use strict';var multer=require(_0x023c('0x0'));var util=require(_0x023c('0x1'));var path=require(_0x023c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x023c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x023c('0x4'));var config=require(_0x023c('0x5'));var controller=require('./trigger.controller');router[_0x023c('0x6')]('/',auth[_0x023c('0x7')](),controller[_0x023c('0x8')]);router[_0x023c('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x023c('0x6')](_0x023c('0x9'),auth[_0x023c('0x7')](),controller['getAllConditions']);router[_0x023c('0x6')](_0x023c('0xa'),auth[_0x023c('0x7')](),controller['getAnyConditions']);router[_0x023c('0x6')](_0x023c('0xb'),auth[_0x023c('0x7')](),controller[_0x023c('0xc')]);router[_0x023c('0xd')]('/',auth[_0x023c('0x7')](),controller['create']);router[_0x023c('0xd')]('/:id/all_conditions',auth[_0x023c('0x7')](),controller[_0x023c('0xe')]);router[_0x023c('0xd')](_0x023c('0xa'),auth['isAuthenticated'](),controller[_0x023c('0xf')]);router[_0x023c('0xd')](_0x023c('0xb'),auth[_0x023c('0x7')](),controller['addAction']);router[_0x023c('0x10')](_0x023c('0x11'),auth[_0x023c('0x7')](),controller[_0x023c('0x12')]);router['delete'](_0x023c('0x11'),auth[_0x023c('0x7')](),controller[_0x023c('0x13')]);module[_0x023c('0x14')]=router; \ No newline at end of file +var _0x4c84=['getAnyConditions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x28168e,_0x3a2565){var _0x26d32c=function(_0xc0fc69){while(--_0xc0fc69){_0x28168e['push'](_0x28168e['shift']());}};_0x26d32c(++_0x3a2565);}(_0x4c84,0x1df));var _0x44c8=function(_0x13a919,_0xafb244){_0x13a919=_0x13a919-0x0;var _0x2191d4=_0x4c84[_0x13a919];return _0x2191d4;};'use strict';var multer=require(_0x44c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x44c8('0x1'));var express=require('express');var router=express[_0x44c8('0x2')]();var auth=require(_0x44c8('0x3'));var interaction=require(_0x44c8('0x4'));var config=require(_0x44c8('0x5'));var controller=require(_0x44c8('0x6'));router[_0x44c8('0x7')]('/',auth[_0x44c8('0x8')](),controller[_0x44c8('0x9')]);router[_0x44c8('0x7')](_0x44c8('0xa'),auth['isAuthenticated'](),controller[_0x44c8('0xb')]);router[_0x44c8('0x7')](_0x44c8('0xc'),auth[_0x44c8('0x8')](),controller[_0x44c8('0xd')]);router[_0x44c8('0x7')](_0x44c8('0xe'),auth['isAuthenticated'](),controller[_0x44c8('0xf')]);router['get']('/:id/actions',auth[_0x44c8('0x8')](),controller['getActions']);router[_0x44c8('0x10')]('/',auth['isAuthenticated'](),controller[_0x44c8('0x11')]);router['post']('/:id/all_conditions',auth[_0x44c8('0x8')](),controller[_0x44c8('0x12')]);router[_0x44c8('0x10')](_0x44c8('0xe'),auth[_0x44c8('0x8')](),controller[_0x44c8('0x13')]);router['post'](_0x44c8('0x14'),auth[_0x44c8('0x8')](),controller[_0x44c8('0x15')]);router[_0x44c8('0x16')]('/:id',auth[_0x44c8('0x8')](),controller[_0x44c8('0x17')]);router[_0x44c8('0x18')]('/:id',auth[_0x44c8('0x8')](),controller['destroy']);module[_0x44c8('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 cba22fb..7d33086 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 _0x7cc9=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3f6f5b,_0x3624eb){var _0x2973a5=function(_0x2e9e3f){while(--_0x2e9e3f){_0x3f6f5b['push'](_0x3f6f5b['shift']());}};_0x2973a5(++_0x3624eb);}(_0x7cc9,0x13a));var _0x97cc=function(_0xe0c564,_0x2ff569){_0xe0c564=_0xe0c564-0x0;var _0x32e0f6=_0x7cc9[_0xe0c564];return _0x32e0f6;};'use strict';var Sequelize=require(_0x97cc('0x0'));module[_0x97cc('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x97cc('0x2')]},'description':{'type':Sequelize[_0x97cc('0x2')]},'status':{'type':Sequelize[_0x97cc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf6a3=['BOOLEAN','sequelize','exports','STRING'];(function(_0x28a1b2,_0xdc3fc5){var _0x30c439=function(_0x4efa11){while(--_0x4efa11){_0x28a1b2['push'](_0x28a1b2['shift']());}};_0x30c439(++_0xdc3fc5);}(_0xf6a3,0xe9));var _0x3f6a=function(_0x11ec26,_0x11f134){_0x11ec26=_0x11ec26-0x0;var _0x55b15f=_0xf6a3[_0x11ec26];return _0x55b15f;};'use strict';var Sequelize=require(_0x3f6a('0x0'));module[_0x3f6a('0x1')]={'name':{'type':Sequelize[_0x3f6a('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f6a('0x2')]},'status':{'type':Sequelize[_0x3f6a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 62a10a1..6e7c7d8 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 _0x8781=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','index','Trigger','fieldName','type','key','map','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','pick','filter','where','merge','options','findAll','rows','catch','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','TriggerAnyId','findOne','sort','getAllConditions','hasOwnProperty','getAnyConditions','TriggerId','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x15f7b7,_0x346fa8){var _0x3c7407=function(_0x51bf93){while(--_0x51bf93){_0x15f7b7['push'](_0x15f7b7['shift']());}};_0x3c7407(++_0x346fa8);}(_0x8781,0x1c8));var _0x1878=function(_0x4eab8c,_0x20c492){_0x4eab8c=_0x4eab8c-0x0;var _0x4baac4=_0x8781[_0x4eab8c];return _0x4baac4;};'use strict';var pdf=require(_0x1878('0x0'));var emlformat=require(_0x1878('0x1'));var rimraf=require(_0x1878('0x2'));var zipdir=require(_0x1878('0x3'));var jsonpatch=require(_0x1878('0x4'));var rp=require(_0x1878('0x5'));var moment=require(_0x1878('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1878('0x7'));var util=require(_0x1878('0x8'));var path=require(_0x1878('0x9'));var sox=require(_0x1878('0xa'));var csv=require(_0x1878('0xb'));var ejs=require(_0x1878('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1878('0xd'));var crypto=require(_0x1878('0xe'));var jsforce=require(_0x1878('0xf'));var deskjs=require(_0x1878('0x10'));var toCsv=require(_0x1878('0xb'));var querystring=require(_0x1878('0x11'));var Papa=require(_0x1878('0x12'));var Redis=require(_0x1878('0x13'));var authService=require(_0x1878('0x14'));var qs=require(_0x1878('0x15'));var as=require(_0x1878('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1878('0x17'))(_0x1878('0x18'));var utils=require(_0x1878('0x19'));var config=require(_0x1878('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4272ab,_0x1ed9f0){_0x1ed9f0=_0x1ed9f0||0xcc;return function(_0x181e51){if(_0x181e51){return _0x4272ab[_0x1878('0x1b')](_0x1ed9f0);}return _0x4272ab['status'](_0x1ed9f0)['end']();};}function respondWithResult(_0x19ffaa,_0x396f3a){_0x396f3a=_0x396f3a||0xc8;return function(_0x49d3a1){if(_0x49d3a1){return _0x19ffaa[_0x1878('0x1c')](_0x396f3a)[_0x1878('0x1d')](_0x49d3a1);}};}function respondWithFilteredResult(_0xb324ba,_0x4a5ba9){return function(_0x562902){if(_0x562902){var _0x13e16d=_0x562902[_0x1878('0x1e')],_0x450103=_0x4a5ba9[_0x1878('0x1f')],_0x1ff9c1=_0x4a5ba9[_0x1878('0x1f')]+_0x4a5ba9[_0x1878('0x20')],_0x43b85e;if(_0x1ff9c1>=_0x13e16d){_0x1ff9c1=_0x13e16d;_0x43b85e=0xc8;}else{_0x43b85e=0xce;}_0xb324ba[_0x1878('0x1c')](_0x43b85e);return _0xb324ba[_0x1878('0x21')](_0x1878('0x22'),_0x450103+'-'+_0x1ff9c1+'/'+_0x13e16d)['json'](_0x562902);}return null;};}function patchUpdates(_0x5ecfe3){return function(_0xf80c60){try{jsonpatch[_0x1878('0x23')](_0xf80c60,_0x5ecfe3,!![]);}catch(_0x5b8fd9){return BPromise[_0x1878('0x24')](_0x5b8fd9);}return _0xf80c60[_0x1878('0x25')]();};}function saveUpdates(_0x1fae20,_0x387f5){return function(_0x383956){if(_0x383956){return _0x383956['update'](_0x1fae20)[_0x1878('0x26')](function(_0x537efd){return _0x537efd;});}return null;};}function removeEntity(_0x1c2b5d,_0x45e2b6){return function(_0x2bc65b){if(_0x2bc65b){return _0x2bc65b[_0x1878('0x27')]()[_0x1878('0x26')](function(){var _0x524e68=_0x2bc65b[_0x1878('0x28')]({'plain':!![]});var _0x10ce95=_0x1878('0x29');return db[_0x1878('0x2a')][_0x1878('0x27')]({'where':{'type':_0x10ce95,'resourceId':_0x524e68['id']}})[_0x1878('0x26')](function(){return _0x2bc65b;});})[_0x1878('0x26')](function(){_0x1c2b5d['status'](0xcc)[_0x1878('0x2b')]();});}};}function handleEntityNotFound(_0x10ab5c,_0x243329){return function(_0xb191d0){if(!_0xb191d0){_0x10ab5c[_0x1878('0x1b')](0x194);}return _0xb191d0;};}function handleError(_0x57580b,_0x2f7e55){_0x2f7e55=_0x2f7e55||0x1f4;return function(_0x16410e){logger[_0x1878('0x2c')](_0x16410e[_0x1878('0x2d')]);if(_0x16410e['name']){delete _0x16410e[_0x1878('0x2e')];}_0x57580b[_0x1878('0x1c')](_0x2f7e55)[_0x1878('0x2f')](_0x16410e);};}exports[_0x1878('0x30')]=function(_0x1eda2b,_0x45e3db){var _0x49112c={},_0x35750c={},_0x6ad492={'count':0x0,'rows':[]};var _0x4baef1=_['map'](db[_0x1878('0x31')]['rawAttributes'],function(_0x5e9d48){return{'name':_0x5e9d48[_0x1878('0x32')],'type':_0x5e9d48[_0x1878('0x33')][_0x1878('0x34')]};});_0x35750c['model']=_[_0x1878('0x35')](_0x4baef1,_0x1878('0x2e'));_0x35750c[_0x1878('0x36')]=_[_0x1878('0x37')](_0x1eda2b['query']);_0x35750c[_0x1878('0x38')]=_[_0x1878('0x39')](_0x35750c[_0x1878('0x3a')],_0x35750c['query']);_0x49112c['attributes']=_[_0x1878('0x39')](_0x35750c['model'],qs[_0x1878('0x3b')](_0x1eda2b[_0x1878('0x36')]['fields']));_0x49112c['attributes']=_0x49112c['attributes'][_0x1878('0x3c')]?_0x49112c[_0x1878('0x3d')]:_0x35750c[_0x1878('0x3a')];if(!_0x1eda2b[_0x1878('0x36')]['hasOwnProperty'](_0x1878('0x3e'))){_0x49112c['limit']=qs[_0x1878('0x20')](_0x1eda2b[_0x1878('0x36')]['limit']);_0x49112c[_0x1878('0x1f')]=qs[_0x1878('0x1f')](_0x1eda2b['query'][_0x1878('0x1f')]);}_0x49112c[_0x1878('0x3f')]=qs['sort'](_0x1eda2b[_0x1878('0x36')]['sort']);_0x49112c['where']=qs[_0x1878('0x38')](_[_0x1878('0x40')](_0x1eda2b['query'],_0x35750c[_0x1878('0x38')]),_0x4baef1);if(_0x1eda2b[_0x1878('0x36')][_0x1878('0x41')]){_0x49112c[_0x1878('0x42')]=_['merge'](_0x49112c[_0x1878('0x42')],{'$or':_[_0x1878('0x35')](_0x4baef1,function(_0x2a967a){if(_0x2a967a['type']!=='VIRTUAL'){var _0x17b51b={};_0x17b51b[_0x2a967a[_0x1878('0x2e')]]={'$like':'%'+_0x1eda2b[_0x1878('0x36')]['filter']+'%'};return _0x17b51b;}})});}_0x49112c=_[_0x1878('0x43')]({},_0x49112c,_0x1eda2b[_0x1878('0x44')]);var _0x736873={'where':_0x49112c['where']};return db[_0x1878('0x31')]['count'](_0x736873)[_0x1878('0x26')](function(_0x4cf1c4){_0x6ad492['count']=_0x4cf1c4;if(_0x1eda2b[_0x1878('0x36')]['includeAll']){_0x49112c['include']=[{'all':!![]}];}return db[_0x1878('0x31')][_0x1878('0x45')](_0x49112c);})[_0x1878('0x26')](function(_0xd6dd95){_0x6ad492[_0x1878('0x46')]=_0xd6dd95;return _0x6ad492;})[_0x1878('0x26')](respondWithFilteredResult(_0x45e3db,_0x49112c))[_0x1878('0x47')](handleError(_0x45e3db,null));};exports['show']=function(_0x5c646f,_0x5ceb54){var _0x4722ef={'raw':![],'where':{'id':_0x5c646f[_0x1878('0x48')]['id']}},_0x57b99d={};_0x57b99d[_0x1878('0x3a')]=_[_0x1878('0x37')](db['Trigger'][_0x1878('0x49')]);_0x57b99d[_0x1878('0x36')]=_[_0x1878('0x37')](_0x5c646f[_0x1878('0x36')]);_0x57b99d[_0x1878('0x38')]=_['intersection'](_0x57b99d['model'],_0x57b99d[_0x1878('0x36')]);_0x4722ef[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x57b99d[_0x1878('0x3a')],qs[_0x1878('0x3b')](_0x5c646f['query'][_0x1878('0x3b')]));_0x4722ef[_0x1878('0x3d')]=_0x4722ef[_0x1878('0x3d')][_0x1878('0x3c')]?_0x4722ef['attributes']:_0x57b99d[_0x1878('0x3a')];if(_0x5c646f[_0x1878('0x36')][_0x1878('0x4a')]){_0x4722ef[_0x1878('0x4b')]=[{'all':!![]}];}_0x4722ef=_[_0x1878('0x43')]({},_0x4722ef,_0x5c646f[_0x1878('0x44')]);return db[_0x1878('0x31')][_0x1878('0x4c')](_0x4722ef)['then'](handleEntityNotFound(_0x5ceb54,null))[_0x1878('0x26')](respondWithResult(_0x5ceb54,null))[_0x1878('0x47')](handleError(_0x5ceb54,null));};exports['create']=function(_0x2cc185,_0x30f3c9){return db[_0x1878('0x31')][_0x1878('0x4d')](_0x2cc185[_0x1878('0x4e')],{})['then'](function(_0x2e9bee){var _0x4f2ac1=_0x2cc185[_0x1878('0x4f')][_0x1878('0x28')]({'plain':!![]});if(!_0x4f2ac1)throw new Error(_0x1878('0x50'));if(_0x4f2ac1[_0x1878('0x51')]===_0x1878('0x4f')){var _0x1616ac=_0x2e9bee[_0x1878('0x28')]({'plain':!![]});var _0x111f4d=_0x1878('0x29');return db[_0x1878('0x52')][_0x1878('0x4c')]({'where':{'name':_0x111f4d,'userProfileId':_0x4f2ac1[_0x1878('0x53')]},'raw':!![]})['then'](function(_0x2cefa6){if(_0x2cefa6&&_0x2cefa6[_0x1878('0x54')]===0x0){return db[_0x1878('0x2a')][_0x1878('0x4d')]({'name':_0x1616ac[_0x1878('0x2e')],'resourceId':_0x1616ac['id'],'type':_0x2cefa6[_0x1878('0x2e')],'sectionId':_0x2cefa6['id']},{})[_0x1878('0x26')](function(){return _0x2e9bee;});}else{return _0x2e9bee;}})[_0x1878('0x47')](function(_0x1d8b91){logger[_0x1878('0x2c')](_0x1878('0x55'),_0x1d8b91);throw _0x1d8b91;});}return _0x2e9bee;})[_0x1878('0x26')](respondWithResult(_0x30f3c9,0xc9))[_0x1878('0x47')](handleError(_0x30f3c9,null));};exports[_0x1878('0x56')]=function(_0x56870c,_0x112f5e){if(_0x56870c[_0x1878('0x4e')]['id']){delete _0x56870c['body']['id'];}return db[_0x1878('0x31')][_0x1878('0x4c')]({'where':{'id':_0x56870c['params']['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x112f5e,null))[_0x1878('0x26')](saveUpdates(_0x56870c['body'],null))['then'](respondWithResult(_0x112f5e,null))['catch'](handleError(_0x112f5e,null));};exports['destroy']=function(_0x5deb9b,_0x251cd9){return db[_0x1878('0x31')][_0x1878('0x4c')]({'where':{'id':_0x5deb9b[_0x1878('0x48')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x251cd9,null))[_0x1878('0x26')](removeEntity(_0x251cd9,null))[_0x1878('0x47')](handleError(_0x251cd9,null));};exports['addAllCondition']=function(_0x2f07e3,_0xca569e,_0x44aabc){if(_0x2f07e3[_0x1878('0x4e')]['id']){delete _0x2f07e3[_0x1878('0x4e')]['id'];}return db['Trigger'][_0x1878('0x4c')]({'where':{'id':_0x2f07e3[_0x1878('0x48')]['id']}})['then'](handleEntityNotFound(_0xca569e,null))[_0x1878('0x26')](function(_0x184ef4){if(_0x184ef4){_0x2f07e3[_0x1878('0x4e')][_0x1878('0x57')]=_0x184ef4['id'];return db[_0x1878('0x58')][_0x1878('0x4d')](_0x2f07e3['body']);}})[_0x1878('0x26')](respondWithResult(_0xca569e,null))['catch'](handleError(_0xca569e,null));};exports['addAnyCondition']=function(_0x2d2d83,_0x3f6a2e,_0x1b114f){if(_0x2d2d83[_0x1878('0x4e')]['id']){delete _0x2d2d83[_0x1878('0x4e')]['id'];}return db[_0x1878('0x31')][_0x1878('0x4c')]({'where':{'id':_0x2d2d83[_0x1878('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f6a2e,null))['then'](function(_0x4ff687){if(_0x4ff687){_0x2d2d83[_0x1878('0x4e')][_0x1878('0x59')]=_0x4ff687['id'];return db[_0x1878('0x58')]['create'](_0x2d2d83['body']);}})[_0x1878('0x26')](respondWithResult(_0x3f6a2e,null))['catch'](handleError(_0x3f6a2e,null));};exports['getAllConditions']=function(_0x32cced,_0x544eba,_0x5e0afb){var _0x3630f6={};var _0x5c343b={};var _0x518422;var _0x1670a0;return db['Trigger'][_0x1878('0x5a')]({'where':{'id':_0x32cced[_0x1878('0x48')]['id']}})['then'](handleEntityNotFound(_0x544eba,null))[_0x1878('0x26')](function(_0x196803){if(_0x196803){_0x518422=_0x196803;_0x5c343b[_0x1878('0x3a')]=_[_0x1878('0x37')](db[_0x1878('0x58')][_0x1878('0x49')]);_0x5c343b[_0x1878('0x36')]=_[_0x1878('0x37')](_0x32cced['query']);_0x5c343b[_0x1878('0x38')]=_['intersection'](_0x5c343b[_0x1878('0x3a')],_0x5c343b[_0x1878('0x36')]);_0x3630f6[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x5c343b[_0x1878('0x3a')],qs['fields'](_0x32cced[_0x1878('0x36')]['fields']));_0x3630f6[_0x1878('0x3d')]=_0x3630f6['attributes'][_0x1878('0x3c')]?_0x3630f6[_0x1878('0x3d')]:_0x5c343b['model'];_0x3630f6[_0x1878('0x3f')]=qs[_0x1878('0x5b')](_0x32cced[_0x1878('0x36')][_0x1878('0x5b')]);_0x3630f6['where']=qs[_0x1878('0x38')](_[_0x1878('0x40')](_0x32cced[_0x1878('0x36')],_0x5c343b[_0x1878('0x38')]));if(_0x32cced[_0x1878('0x36')]['filter']){_0x3630f6[_0x1878('0x42')]=_[_0x1878('0x43')](_0x3630f6['where'],{'$or':_['map'](_0x3630f6[_0x1878('0x3d')],function(_0x50a506){var _0x356525={};_0x356525[_0x50a506]={'$like':'%'+_0x32cced[_0x1878('0x36')][_0x1878('0x41')]+'%'};return _0x356525;})});}_0x3630f6=_[_0x1878('0x43')]({},_0x3630f6,_0x32cced[_0x1878('0x44')]);return _0x518422[_0x1878('0x5c')](_0x3630f6);}})[_0x1878('0x26')](function(_0x298f8e){if(_0x298f8e){_0x1670a0=_0x298f8e[_0x1878('0x3c')];if(!_0x32cced[_0x1878('0x36')][_0x1878('0x5d')](_0x1878('0x3e'))){_0x3630f6[_0x1878('0x20')]=qs[_0x1878('0x20')](_0x32cced['query'][_0x1878('0x20')]);_0x3630f6[_0x1878('0x1f')]=qs['offset'](_0x32cced[_0x1878('0x36')][_0x1878('0x1f')]);}return _0x518422['getAllConditions'](_0x3630f6);}})[_0x1878('0x26')](function(_0x680ec3){if(_0x680ec3){return _0x680ec3?{'count':_0x1670a0,'rows':_0x680ec3}:null;}})['then'](respondWithResult(_0x544eba,null))['catch'](handleError(_0x544eba,null));};exports[_0x1878('0x5e')]=function(_0x36d8b3,_0x59f930,_0x3af824){var _0x3e3e12={};var _0x51e10c={};var _0x2d5ecf;var _0x255812;return db[_0x1878('0x31')][_0x1878('0x5a')]({'where':{'id':_0x36d8b3['params']['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x59f930,null))[_0x1878('0x26')](function(_0x40bce5){if(_0x40bce5){_0x2d5ecf=_0x40bce5;_0x51e10c['model']=_[_0x1878('0x37')](db['Condition'][_0x1878('0x49')]);_0x51e10c[_0x1878('0x36')]=_[_0x1878('0x37')](_0x36d8b3[_0x1878('0x36')]);_0x51e10c[_0x1878('0x38')]=_[_0x1878('0x39')](_0x51e10c[_0x1878('0x3a')],_0x51e10c[_0x1878('0x36')]);_0x3e3e12[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x51e10c[_0x1878('0x3a')],qs[_0x1878('0x3b')](_0x36d8b3[_0x1878('0x36')][_0x1878('0x3b')]));_0x3e3e12['attributes']=_0x3e3e12[_0x1878('0x3d')]['length']?_0x3e3e12[_0x1878('0x3d')]:_0x51e10c['model'];_0x3e3e12[_0x1878('0x3f')]=qs[_0x1878('0x5b')](_0x36d8b3[_0x1878('0x36')][_0x1878('0x5b')]);_0x3e3e12[_0x1878('0x42')]=qs[_0x1878('0x38')](_[_0x1878('0x40')](_0x36d8b3['query'],_0x51e10c[_0x1878('0x38')]));if(_0x36d8b3[_0x1878('0x36')][_0x1878('0x41')]){_0x3e3e12['where']=_[_0x1878('0x43')](_0x3e3e12[_0x1878('0x42')],{'$or':_[_0x1878('0x35')](_0x3e3e12[_0x1878('0x3d')],function(_0x56d929){var _0x50b54e={};_0x50b54e[_0x56d929]={'$like':'%'+_0x36d8b3[_0x1878('0x36')][_0x1878('0x41')]+'%'};return _0x50b54e;})});}_0x3e3e12=_['merge']({},_0x3e3e12,_0x36d8b3[_0x1878('0x44')]);return _0x2d5ecf[_0x1878('0x5e')](_0x3e3e12);}})[_0x1878('0x26')](function(_0x5a0787){if(_0x5a0787){_0x255812=_0x5a0787['length'];if(!_0x36d8b3[_0x1878('0x36')][_0x1878('0x5d')](_0x1878('0x3e'))){_0x3e3e12['limit']=qs['limit'](_0x36d8b3[_0x1878('0x36')]['limit']);_0x3e3e12[_0x1878('0x1f')]=qs[_0x1878('0x1f')](_0x36d8b3[_0x1878('0x36')][_0x1878('0x1f')]);}return _0x2d5ecf[_0x1878('0x5e')](_0x3e3e12);}})[_0x1878('0x26')](function(_0x19f843){if(_0x19f843){return _0x19f843?{'count':_0x255812,'rows':_0x19f843}:null;}})[_0x1878('0x26')](respondWithResult(_0x59f930,null))[_0x1878('0x47')](handleError(_0x59f930,null));};exports['addAction']=function(_0x3e7a03,_0x55fa1b,_0x29aa67){if(_0x3e7a03['body']['id']){delete _0x3e7a03[_0x1878('0x4e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3e7a03[_0x1878('0x48')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x55fa1b,null))[_0x1878('0x26')](function(_0x39d677){if(_0x39d677){_0x3e7a03['body'][_0x1878('0x5f')]=_0x39d677['id'];return db['Action'][_0x1878('0x4d')](_0x3e7a03[_0x1878('0x4e')]);}})['then'](respondWithResult(_0x55fa1b,null))[_0x1878('0x47')](handleError(_0x55fa1b,null));};exports['getActions']=function(_0x5714a5,_0x54c992,_0x20bbb3){var _0x1c7bc4={};var _0x59fabb={};var _0x234243;var _0x3834e3;return db[_0x1878('0x31')]['findOne']({'where':{'id':_0x5714a5[_0x1878('0x48')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x54c992,null))[_0x1878('0x26')](function(_0x137fb7){if(_0x137fb7){_0x234243=_0x137fb7;_0x59fabb[_0x1878('0x3a')]=_[_0x1878('0x37')](db['Action'][_0x1878('0x49')]);_0x59fabb[_0x1878('0x36')]=_[_0x1878('0x37')](_0x5714a5[_0x1878('0x36')]);_0x59fabb[_0x1878('0x38')]=_[_0x1878('0x39')](_0x59fabb[_0x1878('0x3a')],_0x59fabb[_0x1878('0x36')]);_0x1c7bc4[_0x1878('0x3d')]=_[_0x1878('0x39')](_0x59fabb[_0x1878('0x3a')],qs[_0x1878('0x3b')](_0x5714a5[_0x1878('0x36')][_0x1878('0x3b')]));_0x1c7bc4['attributes']=_0x1c7bc4['attributes'][_0x1878('0x3c')]?_0x1c7bc4[_0x1878('0x3d')]:_0x59fabb[_0x1878('0x3a')];_0x1c7bc4[_0x1878('0x3f')]=qs[_0x1878('0x5b')](_0x5714a5['query'][_0x1878('0x5b')]);_0x1c7bc4[_0x1878('0x42')]=qs[_0x1878('0x38')](_['pick'](_0x5714a5[_0x1878('0x36')],_0x59fabb[_0x1878('0x38')]));if(_0x5714a5[_0x1878('0x36')][_0x1878('0x41')]){_0x1c7bc4[_0x1878('0x42')]=_[_0x1878('0x43')](_0x1c7bc4['where'],{'$or':_[_0x1878('0x35')](_0x1c7bc4[_0x1878('0x3d')],function(_0x34cd45){var _0x65987f={};_0x65987f[_0x34cd45]={'$like':'%'+_0x5714a5[_0x1878('0x36')]['filter']+'%'};return _0x65987f;})});}_0x1c7bc4=_[_0x1878('0x43')]({},_0x1c7bc4,_0x5714a5['options']);return _0x234243[_0x1878('0x60')](_0x1c7bc4);}})['then'](function(_0x4b173c){if(_0x4b173c){_0x3834e3=_0x4b173c[_0x1878('0x3c')];if(!_0x5714a5[_0x1878('0x36')][_0x1878('0x5d')](_0x1878('0x3e'))){_0x1c7bc4[_0x1878('0x20')]=qs[_0x1878('0x20')](_0x5714a5[_0x1878('0x36')]['limit']);_0x1c7bc4[_0x1878('0x1f')]=qs[_0x1878('0x1f')](_0x5714a5[_0x1878('0x36')][_0x1878('0x1f')]);}return _0x234243['getActions'](_0x1c7bc4);}})[_0x1878('0x26')](function(_0x41d057){if(_0x41d057){return _0x41d057?{'count':_0x3834e3,'rows':_0x41d057}:null;}})['then'](respondWithResult(_0x54c992,null))[_0x1878('0x47')](handleError(_0x54c992,null));}; \ No newline at end of file +var _0x2a9a=['addAnyCondition','TriggerAnyId','findOne','sort','getAllConditions','getAnyConditions','order','nolimit','addAction','TriggerId','getActions','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','end','error','stack','name','index','map','Trigger','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','where','pick','merge','type','filter','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition'];(function(_0x53f3ad,_0x39163e){var _0x48b203=function(_0x475ced){while(--_0x475ced){_0x53f3ad['push'](_0x53f3ad['shift']());}};_0x48b203(++_0x39163e);}(_0x2a9a,0x64));var _0xa2a9=function(_0x4d6939,_0x390d94){_0x4d6939=_0x4d6939-0x0;var _0xc91469=_0x2a9a[_0x4d6939];return _0xc91469;};'use strict';var pdf=require(_0xa2a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa2a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa2a9('0x2'));var moment=require(_0xa2a9('0x3'));var BPromise=require(_0xa2a9('0x4'));var Mustache=require(_0xa2a9('0x5'));var util=require(_0xa2a9('0x6'));var path=require('path');var sox=require(_0xa2a9('0x7'));var csv=require(_0xa2a9('0x8'));var ejs=require(_0xa2a9('0x9'));var fs=require('fs');var _=require(_0xa2a9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa2a9('0x8'));var querystring=require(_0xa2a9('0xb'));var Papa=require(_0xa2a9('0xc'));var Redis=require(_0xa2a9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa2a9('0xe'));var as=require(_0xa2a9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2a9('0x10'))(_0xa2a9('0x11'));var utils=require(_0xa2a9('0x12'));var config=require(_0xa2a9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2a9('0x14'))['db'];function respondWithStatusCode(_0x252808,_0x31b217){_0x31b217=_0x31b217||0xcc;return function(_0x26936b){if(_0x26936b){return _0x252808[_0xa2a9('0x15')](_0x31b217);}return _0x252808[_0xa2a9('0x16')](_0x31b217)['end']();};}function respondWithResult(_0x1e99ed,_0x2c69f2){_0x2c69f2=_0x2c69f2||0xc8;return function(_0x4e4078){if(_0x4e4078){return _0x1e99ed['status'](_0x2c69f2)['json'](_0x4e4078);}};}function respondWithFilteredResult(_0x2826e6,_0x53a6a1){return function(_0x3f667a){if(_0x3f667a){var _0x487e53=_0x3f667a[_0xa2a9('0x17')],_0x3b533f=_0x53a6a1['offset'],_0x11838f=_0x53a6a1[_0xa2a9('0x18')]+_0x53a6a1['limit'],_0x657934;if(_0x11838f>=_0x487e53){_0x11838f=_0x487e53;_0x657934=0xc8;}else{_0x657934=0xce;}_0x2826e6[_0xa2a9('0x16')](_0x657934);return _0x2826e6['set'](_0xa2a9('0x19'),_0x3b533f+'-'+_0x11838f+'/'+_0x487e53)['json'](_0x3f667a);}return null;};}function patchUpdates(_0x3f5f76){return function(_0xe86c00){try{jsonpatch[_0xa2a9('0x1a')](_0xe86c00,_0x3f5f76,!![]);}catch(_0x12a238){return BPromise[_0xa2a9('0x1b')](_0x12a238);}return _0xe86c00[_0xa2a9('0x1c')]();};}function saveUpdates(_0x17ccc3,_0x447338){return function(_0x131246){if(_0x131246){return _0x131246[_0xa2a9('0x1d')](_0x17ccc3)['then'](function(_0x22b816){return _0x22b816;});}return null;};}function removeEntity(_0x34abbf,_0x1204e9){return function(_0xe00463){if(_0xe00463){return _0xe00463[_0xa2a9('0x1e')]()[_0xa2a9('0x1f')](function(){var _0x48aa77=_0xe00463[_0xa2a9('0x20')]({'plain':!![]});var _0x565c8c='Triggers';return db['UserProfileResource'][_0xa2a9('0x1e')]({'where':{'type':_0x565c8c,'resourceId':_0x48aa77['id']}})[_0xa2a9('0x1f')](function(){return _0xe00463;});})['then'](function(){_0x34abbf[_0xa2a9('0x16')](0xcc)[_0xa2a9('0x21')]();});}};}function handleEntityNotFound(_0x1c81e8,_0x74d048){return function(_0x4ae2f7){if(!_0x4ae2f7){_0x1c81e8[_0xa2a9('0x15')](0x194);}return _0x4ae2f7;};}function handleError(_0x44e435,_0x43a6c8){_0x43a6c8=_0x43a6c8||0x1f4;return function(_0x551567){logger[_0xa2a9('0x22')](_0x551567[_0xa2a9('0x23')]);if(_0x551567[_0xa2a9('0x24')]){delete _0x551567['name'];}_0x44e435['status'](_0x43a6c8)['send'](_0x551567);};}exports[_0xa2a9('0x25')]=function(_0x12d222,_0x40ff63){var _0xca45e8={},_0x447564={},_0x4f1c21={'count':0x0,'rows':[]};var _0x247fc5=_[_0xa2a9('0x26')](db[_0xa2a9('0x27')][_0xa2a9('0x28')],function(_0x3e7339){return{'name':_0x3e7339['fieldName'],'type':_0x3e7339['type'][_0xa2a9('0x29')]};});_0x447564['model']=_['map'](_0x247fc5,_0xa2a9('0x24'));_0x447564[_0xa2a9('0x2a')]=_[_0xa2a9('0x2b')](_0x12d222['query']);_0x447564[_0xa2a9('0x2c')]=_[_0xa2a9('0x2d')](_0x447564[_0xa2a9('0x2e')],_0x447564[_0xa2a9('0x2a')]);_0xca45e8['attributes']=_[_0xa2a9('0x2d')](_0x447564[_0xa2a9('0x2e')],qs[_0xa2a9('0x2f')](_0x12d222[_0xa2a9('0x2a')]['fields']));_0xca45e8[_0xa2a9('0x30')]=_0xca45e8['attributes'][_0xa2a9('0x31')]?_0xca45e8['attributes']:_0x447564[_0xa2a9('0x2e')];if(!_0x12d222[_0xa2a9('0x2a')][_0xa2a9('0x32')]('nolimit')){_0xca45e8['limit']=qs[_0xa2a9('0x33')](_0x12d222['query'][_0xa2a9('0x33')]);_0xca45e8['offset']=qs[_0xa2a9('0x18')](_0x12d222['query'][_0xa2a9('0x18')]);}_0xca45e8['order']=qs['sort'](_0x12d222['query']['sort']);_0xca45e8[_0xa2a9('0x34')]=qs[_0xa2a9('0x2c')](_[_0xa2a9('0x35')](_0x12d222['query'],_0x447564[_0xa2a9('0x2c')]),_0x247fc5);if(_0x12d222[_0xa2a9('0x2a')]['filter']){_0xca45e8['where']=_[_0xa2a9('0x36')](_0xca45e8[_0xa2a9('0x34')],{'$or':_['map'](_0x247fc5,function(_0x2f27cf){if(_0x2f27cf[_0xa2a9('0x37')]!=='VIRTUAL'){var _0x43c7ba={};_0x43c7ba[_0x2f27cf[_0xa2a9('0x24')]]={'$like':'%'+_0x12d222[_0xa2a9('0x2a')][_0xa2a9('0x38')]+'%'};return _0x43c7ba;}})});}_0xca45e8=_[_0xa2a9('0x36')]({},_0xca45e8,_0x12d222[_0xa2a9('0x39')]);var _0x1ddec3={'where':_0xca45e8[_0xa2a9('0x34')]};return db[_0xa2a9('0x27')][_0xa2a9('0x17')](_0x1ddec3)[_0xa2a9('0x1f')](function(_0x4605bd){_0x4f1c21[_0xa2a9('0x17')]=_0x4605bd;if(_0x12d222[_0xa2a9('0x2a')]['includeAll']){_0xca45e8[_0xa2a9('0x3a')]=[{'all':!![]}];}return db['Trigger'][_0xa2a9('0x3b')](_0xca45e8);})[_0xa2a9('0x1f')](function(_0xbdf19a){_0x4f1c21[_0xa2a9('0x3c')]=_0xbdf19a;return _0x4f1c21;})[_0xa2a9('0x1f')](respondWithFilteredResult(_0x40ff63,_0xca45e8))[_0xa2a9('0x3d')](handleError(_0x40ff63,null));};exports['show']=function(_0x1828cb,_0x818b7e){var _0x505f34={'raw':![],'where':{'id':_0x1828cb[_0xa2a9('0x3e')]['id']}},_0x4be21c={};_0x4be21c['model']=_['keys'](db['Trigger'][_0xa2a9('0x28')]);_0x4be21c['query']=_[_0xa2a9('0x2b')](_0x1828cb[_0xa2a9('0x2a')]);_0x4be21c[_0xa2a9('0x2c')]=_['intersection'](_0x4be21c[_0xa2a9('0x2e')],_0x4be21c[_0xa2a9('0x2a')]);_0x505f34[_0xa2a9('0x30')]=_['intersection'](_0x4be21c[_0xa2a9('0x2e')],qs[_0xa2a9('0x2f')](_0x1828cb[_0xa2a9('0x2a')][_0xa2a9('0x2f')]));_0x505f34[_0xa2a9('0x30')]=_0x505f34[_0xa2a9('0x30')][_0xa2a9('0x31')]?_0x505f34[_0xa2a9('0x30')]:_0x4be21c[_0xa2a9('0x2e')];if(_0x1828cb[_0xa2a9('0x2a')][_0xa2a9('0x3f')]){_0x505f34[_0xa2a9('0x3a')]=[{'all':!![]}];}_0x505f34=_[_0xa2a9('0x36')]({},_0x505f34,_0x1828cb['options']);return db[_0xa2a9('0x27')][_0xa2a9('0x40')](_0x505f34)[_0xa2a9('0x1f')](handleEntityNotFound(_0x818b7e,null))[_0xa2a9('0x1f')](respondWithResult(_0x818b7e,null))[_0xa2a9('0x3d')](handleError(_0x818b7e,null));};exports[_0xa2a9('0x41')]=function(_0x2d2d5d,_0x2d7df7){return db['Trigger'][_0xa2a9('0x41')](_0x2d2d5d[_0xa2a9('0x42')],{})['then'](function(_0x323406){var _0x569e6a=_0x2d2d5d[_0xa2a9('0x43')][_0xa2a9('0x20')]({'plain':!![]});if(!_0x569e6a)throw new Error(_0xa2a9('0x44'));if(_0x569e6a[_0xa2a9('0x45')]==='user'){var _0x347902=_0x323406['get']({'plain':!![]});var _0x53f8e3=_0xa2a9('0x46');return db[_0xa2a9('0x47')][_0xa2a9('0x40')]({'where':{'name':_0x53f8e3,'userProfileId':_0x569e6a[_0xa2a9('0x48')]},'raw':!![]})['then'](function(_0x5f5872){if(_0x5f5872&&_0x5f5872['autoAssociation']===0x0){return db[_0xa2a9('0x49')][_0xa2a9('0x41')]({'name':_0x347902[_0xa2a9('0x24')],'resourceId':_0x347902['id'],'type':_0x5f5872['name'],'sectionId':_0x5f5872['id']},{})[_0xa2a9('0x1f')](function(){return _0x323406;});}else{return _0x323406;}})[_0xa2a9('0x3d')](function(_0x566065){logger[_0xa2a9('0x22')](_0xa2a9('0x4a'),_0x566065);throw _0x566065;});}return _0x323406;})['then'](respondWithResult(_0x2d7df7,0xc9))[_0xa2a9('0x3d')](handleError(_0x2d7df7,null));};exports['update']=function(_0x58767a,_0xddfe7){if(_0x58767a[_0xa2a9('0x42')]['id']){delete _0x58767a[_0xa2a9('0x42')]['id'];}return db[_0xa2a9('0x27')]['find']({'where':{'id':_0x58767a[_0xa2a9('0x3e')]['id']}})[_0xa2a9('0x1f')](handleEntityNotFound(_0xddfe7,null))[_0xa2a9('0x1f')](saveUpdates(_0x58767a['body'],null))[_0xa2a9('0x1f')](respondWithResult(_0xddfe7,null))[_0xa2a9('0x3d')](handleError(_0xddfe7,null));};exports[_0xa2a9('0x1e')]=function(_0x424ed4,_0x3780c9){return db[_0xa2a9('0x27')][_0xa2a9('0x40')]({'where':{'id':_0x424ed4[_0xa2a9('0x3e')]['id']}})[_0xa2a9('0x1f')](handleEntityNotFound(_0x3780c9,null))[_0xa2a9('0x1f')](removeEntity(_0x3780c9,null))[_0xa2a9('0x3d')](handleError(_0x3780c9,null));};exports[_0xa2a9('0x4b')]=function(_0x103f90,_0x1eb38b,_0x11f922){if(_0x103f90[_0xa2a9('0x42')]['id']){delete _0x103f90[_0xa2a9('0x42')]['id'];}return db[_0xa2a9('0x27')][_0xa2a9('0x40')]({'where':{'id':_0x103f90[_0xa2a9('0x3e')]['id']}})[_0xa2a9('0x1f')](handleEntityNotFound(_0x1eb38b,null))[_0xa2a9('0x1f')](function(_0x49ecb6){if(_0x49ecb6){_0x103f90[_0xa2a9('0x42')][_0xa2a9('0x4c')]=_0x49ecb6['id'];return db[_0xa2a9('0x4d')][_0xa2a9('0x41')](_0x103f90[_0xa2a9('0x42')]);}})[_0xa2a9('0x1f')](respondWithResult(_0x1eb38b,null))[_0xa2a9('0x3d')](handleError(_0x1eb38b,null));};exports[_0xa2a9('0x4e')]=function(_0x1a2cda,_0x3a2cfd,_0x2ca2fb){if(_0x1a2cda[_0xa2a9('0x42')]['id']){delete _0x1a2cda[_0xa2a9('0x42')]['id'];}return db[_0xa2a9('0x27')][_0xa2a9('0x40')]({'where':{'id':_0x1a2cda[_0xa2a9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3a2cfd,null))[_0xa2a9('0x1f')](function(_0x572c01){if(_0x572c01){_0x1a2cda[_0xa2a9('0x42')][_0xa2a9('0x4f')]=_0x572c01['id'];return db[_0xa2a9('0x4d')][_0xa2a9('0x41')](_0x1a2cda[_0xa2a9('0x42')]);}})['then'](respondWithResult(_0x3a2cfd,null))['catch'](handleError(_0x3a2cfd,null));};exports['getAllConditions']=function(_0x4cbab6,_0x17c55e,_0x2fc084){var _0x161f7a={};var _0x53b079={};var _0x3860de;var _0x212f11;return db[_0xa2a9('0x27')][_0xa2a9('0x50')]({'where':{'id':_0x4cbab6[_0xa2a9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17c55e,null))[_0xa2a9('0x1f')](function(_0x207c3f){if(_0x207c3f){_0x3860de=_0x207c3f;_0x53b079[_0xa2a9('0x2e')]=_[_0xa2a9('0x2b')](db[_0xa2a9('0x4d')][_0xa2a9('0x28')]);_0x53b079[_0xa2a9('0x2a')]=_[_0xa2a9('0x2b')](_0x4cbab6[_0xa2a9('0x2a')]);_0x53b079[_0xa2a9('0x2c')]=_[_0xa2a9('0x2d')](_0x53b079[_0xa2a9('0x2e')],_0x53b079[_0xa2a9('0x2a')]);_0x161f7a[_0xa2a9('0x30')]=_[_0xa2a9('0x2d')](_0x53b079[_0xa2a9('0x2e')],qs[_0xa2a9('0x2f')](_0x4cbab6[_0xa2a9('0x2a')][_0xa2a9('0x2f')]));_0x161f7a[_0xa2a9('0x30')]=_0x161f7a[_0xa2a9('0x30')]['length']?_0x161f7a[_0xa2a9('0x30')]:_0x53b079['model'];_0x161f7a['order']=qs[_0xa2a9('0x51')](_0x4cbab6[_0xa2a9('0x2a')][_0xa2a9('0x51')]);_0x161f7a[_0xa2a9('0x34')]=qs[_0xa2a9('0x2c')](_[_0xa2a9('0x35')](_0x4cbab6[_0xa2a9('0x2a')],_0x53b079[_0xa2a9('0x2c')]));if(_0x4cbab6['query'][_0xa2a9('0x38')]){_0x161f7a[_0xa2a9('0x34')]=_['merge'](_0x161f7a[_0xa2a9('0x34')],{'$or':_[_0xa2a9('0x26')](_0x161f7a[_0xa2a9('0x30')],function(_0x9e2e44){var _0x4dc9b7={};_0x4dc9b7[_0x9e2e44]={'$like':'%'+_0x4cbab6[_0xa2a9('0x2a')][_0xa2a9('0x38')]+'%'};return _0x4dc9b7;})});}_0x161f7a=_[_0xa2a9('0x36')]({},_0x161f7a,_0x4cbab6[_0xa2a9('0x39')]);return _0x3860de[_0xa2a9('0x52')](_0x161f7a);}})[_0xa2a9('0x1f')](function(_0x26121c){if(_0x26121c){_0x212f11=_0x26121c['length'];if(!_0x4cbab6[_0xa2a9('0x2a')][_0xa2a9('0x32')]('nolimit')){_0x161f7a['limit']=qs[_0xa2a9('0x33')](_0x4cbab6['query']['limit']);_0x161f7a['offset']=qs[_0xa2a9('0x18')](_0x4cbab6[_0xa2a9('0x2a')]['offset']);}return _0x3860de[_0xa2a9('0x52')](_0x161f7a);}})[_0xa2a9('0x1f')](function(_0x1e1d76){if(_0x1e1d76){return _0x1e1d76?{'count':_0x212f11,'rows':_0x1e1d76}:null;}})[_0xa2a9('0x1f')](respondWithResult(_0x17c55e,null))[_0xa2a9('0x3d')](handleError(_0x17c55e,null));};exports[_0xa2a9('0x53')]=function(_0x3fe6df,_0x15db5c,_0x2af6c8){var _0x2c42b8={};var _0x331389={};var _0x2ba3b3;var _0x5182ab;return db[_0xa2a9('0x27')][_0xa2a9('0x50')]({'where':{'id':_0x3fe6df[_0xa2a9('0x3e')]['id']}})[_0xa2a9('0x1f')](handleEntityNotFound(_0x15db5c,null))[_0xa2a9('0x1f')](function(_0x30d6d9){if(_0x30d6d9){_0x2ba3b3=_0x30d6d9;_0x331389[_0xa2a9('0x2e')]=_['keys'](db[_0xa2a9('0x4d')][_0xa2a9('0x28')]);_0x331389['query']=_[_0xa2a9('0x2b')](_0x3fe6df['query']);_0x331389['filters']=_[_0xa2a9('0x2d')](_0x331389[_0xa2a9('0x2e')],_0x331389[_0xa2a9('0x2a')]);_0x2c42b8[_0xa2a9('0x30')]=_['intersection'](_0x331389[_0xa2a9('0x2e')],qs['fields'](_0x3fe6df['query'][_0xa2a9('0x2f')]));_0x2c42b8['attributes']=_0x2c42b8[_0xa2a9('0x30')][_0xa2a9('0x31')]?_0x2c42b8['attributes']:_0x331389[_0xa2a9('0x2e')];_0x2c42b8[_0xa2a9('0x54')]=qs['sort'](_0x3fe6df[_0xa2a9('0x2a')]['sort']);_0x2c42b8[_0xa2a9('0x34')]=qs[_0xa2a9('0x2c')](_['pick'](_0x3fe6df[_0xa2a9('0x2a')],_0x331389[_0xa2a9('0x2c')]));if(_0x3fe6df['query'][_0xa2a9('0x38')]){_0x2c42b8[_0xa2a9('0x34')]=_[_0xa2a9('0x36')](_0x2c42b8[_0xa2a9('0x34')],{'$or':_[_0xa2a9('0x26')](_0x2c42b8[_0xa2a9('0x30')],function(_0x88e167){var _0x3511c9={};_0x3511c9[_0x88e167]={'$like':'%'+_0x3fe6df[_0xa2a9('0x2a')][_0xa2a9('0x38')]+'%'};return _0x3511c9;})});}_0x2c42b8=_[_0xa2a9('0x36')]({},_0x2c42b8,_0x3fe6df[_0xa2a9('0x39')]);return _0x2ba3b3['getAnyConditions'](_0x2c42b8);}})[_0xa2a9('0x1f')](function(_0x345520){if(_0x345520){_0x5182ab=_0x345520['length'];if(!_0x3fe6df[_0xa2a9('0x2a')][_0xa2a9('0x32')](_0xa2a9('0x55'))){_0x2c42b8['limit']=qs[_0xa2a9('0x33')](_0x3fe6df['query'][_0xa2a9('0x33')]);_0x2c42b8['offset']=qs[_0xa2a9('0x18')](_0x3fe6df[_0xa2a9('0x2a')][_0xa2a9('0x18')]);}return _0x2ba3b3[_0xa2a9('0x53')](_0x2c42b8);}})[_0xa2a9('0x1f')](function(_0x4375d3){if(_0x4375d3){return _0x4375d3?{'count':_0x5182ab,'rows':_0x4375d3}:null;}})[_0xa2a9('0x1f')](respondWithResult(_0x15db5c,null))[_0xa2a9('0x3d')](handleError(_0x15db5c,null));};exports[_0xa2a9('0x56')]=function(_0x44b6cb,_0x26fbb9,_0x4db1ff){if(_0x44b6cb[_0xa2a9('0x42')]['id']){delete _0x44b6cb['body']['id'];}return db[_0xa2a9('0x27')][_0xa2a9('0x40')]({'where':{'id':_0x44b6cb[_0xa2a9('0x3e')]['id']}})[_0xa2a9('0x1f')](handleEntityNotFound(_0x26fbb9,null))[_0xa2a9('0x1f')](function(_0x9a62b3){if(_0x9a62b3){_0x44b6cb[_0xa2a9('0x42')][_0xa2a9('0x57')]=_0x9a62b3['id'];return db['Action'][_0xa2a9('0x41')](_0x44b6cb['body']);}})[_0xa2a9('0x1f')](respondWithResult(_0x26fbb9,null))[_0xa2a9('0x3d')](handleError(_0x26fbb9,null));};exports[_0xa2a9('0x58')]=function(_0x2fb91e,_0x16748e,_0x3c35de){var _0x546375={};var _0x1e9702={};var _0x2c4280;var _0x45d1a7;return db[_0xa2a9('0x27')][_0xa2a9('0x50')]({'where':{'id':_0x2fb91e[_0xa2a9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x16748e,null))['then'](function(_0x38dddf){if(_0x38dddf){_0x2c4280=_0x38dddf;_0x1e9702['model']=_['keys'](db['Action'][_0xa2a9('0x28')]);_0x1e9702[_0xa2a9('0x2a')]=_[_0xa2a9('0x2b')](_0x2fb91e['query']);_0x1e9702[_0xa2a9('0x2c')]=_[_0xa2a9('0x2d')](_0x1e9702[_0xa2a9('0x2e')],_0x1e9702[_0xa2a9('0x2a')]);_0x546375[_0xa2a9('0x30')]=_[_0xa2a9('0x2d')](_0x1e9702[_0xa2a9('0x2e')],qs[_0xa2a9('0x2f')](_0x2fb91e['query'][_0xa2a9('0x2f')]));_0x546375[_0xa2a9('0x30')]=_0x546375[_0xa2a9('0x30')][_0xa2a9('0x31')]?_0x546375[_0xa2a9('0x30')]:_0x1e9702[_0xa2a9('0x2e')];_0x546375['order']=qs['sort'](_0x2fb91e['query']['sort']);_0x546375[_0xa2a9('0x34')]=qs[_0xa2a9('0x2c')](_[_0xa2a9('0x35')](_0x2fb91e[_0xa2a9('0x2a')],_0x1e9702[_0xa2a9('0x2c')]));if(_0x2fb91e[_0xa2a9('0x2a')][_0xa2a9('0x38')]){_0x546375[_0xa2a9('0x34')]=_[_0xa2a9('0x36')](_0x546375[_0xa2a9('0x34')],{'$or':_[_0xa2a9('0x26')](_0x546375[_0xa2a9('0x30')],function(_0x109be0){var _0x36ef8f={};_0x36ef8f[_0x109be0]={'$like':'%'+_0x2fb91e['query'][_0xa2a9('0x38')]+'%'};return _0x36ef8f;})});}_0x546375=_[_0xa2a9('0x36')]({},_0x546375,_0x2fb91e[_0xa2a9('0x39')]);return _0x2c4280[_0xa2a9('0x58')](_0x546375);}})['then'](function(_0x46ab07){if(_0x46ab07){_0x45d1a7=_0x46ab07[_0xa2a9('0x31')];if(!_0x2fb91e[_0xa2a9('0x2a')][_0xa2a9('0x32')](_0xa2a9('0x55'))){_0x546375[_0xa2a9('0x33')]=qs[_0xa2a9('0x33')](_0x2fb91e[_0xa2a9('0x2a')][_0xa2a9('0x33')]);_0x546375['offset']=qs[_0xa2a9('0x18')](_0x2fb91e[_0xa2a9('0x2a')][_0xa2a9('0x18')]);}return _0x2c4280['getActions'](_0x546375);}})[_0xa2a9('0x1f')](function(_0x5e288b){if(_0x5e288b){return _0x5e288b?{'count':_0x45d1a7,'rows':_0x5e288b}:null;}})[_0xa2a9('0x1f')](respondWithResult(_0x16748e,null))['catch'](handleError(_0x16748e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 51be5c8..f8bd3ea 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 _0xb19d=['path','../../config/environment','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0xb19d,0x1dc));var _0xdb19=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xb19d[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0xdb19('0x0'));var util=require(_0xdb19('0x1'));var logger=require(_0xdb19('0x2'))(_0xdb19('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb19('0x4'));var rimraf=require('rimraf');var config=require(_0xdb19('0x5'));var attributes=require('./trigger.attributes');module[_0xdb19('0x6')]=function(_0x4aafb8,_0x1ebe99){return _0x4aafb8[_0xdb19('0x7')](_0xdb19('0x8'),attributes,{'tableName':_0xdb19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f7c=['api','moment','request-promise','path','../../config/environment','exports','define','Trigger','tools_triggers','util','../../config/logger'];(function(_0x5d882d,_0x41a1b3){var _0xc622f=function(_0x58b760){while(--_0x58b760){_0x5d882d['push'](_0x5d882d['shift']());}};_0xc622f(++_0x41a1b3);}(_0x7f7c,0x8d));var _0xc7f7=function(_0x123944,_0x308bef){_0x123944=_0x123944-0x0;var _0x363dcd=_0x7f7c[_0x123944];return _0x363dcd;};'use strict';var _=require('lodash');var util=require(_0xc7f7('0x0'));var logger=require(_0xc7f7('0x1'))(_0xc7f7('0x2'));var moment=require(_0xc7f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xc7f7('0x4'));var fs=require('fs');var path=require(_0xc7f7('0x5'));var rimraf=require('rimraf');var config=require(_0xc7f7('0x6'));var attributes=require('./trigger.attributes');module[_0xc7f7('0x7')]=function(_0x4475e6,_0xd8e5ab){return _0x4475e6[_0xc7f7('0x8')](_0xc7f7('0x9'),attributes,{'tableName':_0xc7f7('0xa'),'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 df82f0a..a69de08 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 _0x4b17=['http','request','then','info','request\x20sent','debug','stringify','error','message','Trigger,\x20%s,\x20%s','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','catch','ShowTrigger','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x52740f,_0x343961){var _0x1cbe11=function(_0x376976){while(--_0x376976){_0x52740f['push'](_0x52740f['shift']());}};_0x1cbe11(++_0x343961);}(_0x4b17,0x10f));var _0x74b1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4b17[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371c3b,_0x191d2b,_0x16761b){return new BPromise(function(_0x4c293c,_0x287e3e){return client[_0x74b1('0x9')](_0x371c3b,_0x16761b)[_0x74b1('0xa')](function(_0x25382b){logger[_0x74b1('0xb')]('Trigger,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'));logger[_0x74b1('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'),JSON[_0x74b1('0xe')](_0x25382b));if(_0x25382b[_0x74b1('0xf')]){if(_0x25382b[_0x74b1('0xf')]['code']===0x1f4){logger[_0x74b1('0xf')]('Trigger,\x20%s,\x20%s',_0x191d2b,_0x25382b['error'][_0x74b1('0x10')]);return _0x287e3e(_0x25382b[_0x74b1('0xf')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x191d2b,_0x25382b[_0x74b1('0xf')]['message']);return _0x4c293c(_0x25382b['error'][_0x74b1('0x10')]);}else{logger[_0x74b1('0xb')](_0x74b1('0x11'),_0x191d2b,_0x74b1('0xc'));_0x4c293c(_0x25382b[_0x74b1('0x12')][_0x74b1('0x10')]);}})['catch'](function(_0x6237be){logger[_0x74b1('0xf')](_0x74b1('0x11'),_0x191d2b,_0x6237be);_0x287e3e(_0x6237be);});});}exports[_0x74b1('0x13')]=function(_0xde2736){var _0x8c9510=this;return new Promise(function(_0x1ab838,_0x4bb3d2){return db[_0x74b1('0x14')][_0x74b1('0x15')]({'raw':_0xde2736['options']?_0xde2736[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'where':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x18')]||null:null,'attributes':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x19')]||null:null,'limit':_0xde2736['options']?_0xde2736[_0x74b1('0x16')]['limit']||null:null,'include':_0xde2736['options']?_0xde2736['options'][_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0xde2736[_0x74b1('0x16')][_0x74b1('0x1a')],function(_0x563781){return{'model':db[_0x563781['model']],'as':_0x563781['as'],'attributes':_0x563781[_0x74b1('0x19')],'include':_0x563781['include']?_[_0x74b1('0x1b')](_0x563781[_0x74b1('0x1a')],function(_0xb5af0){return{'model':db[_0xb5af0[_0x74b1('0x1c')]],'as':_0xb5af0['as'],'attributes':_0xb5af0[_0x74b1('0x19')],'include':_0xb5af0[_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0xb5af0[_0x74b1('0x1a')],function(_0x4c7f05){return{'model':db[_0x4c7f05[_0x74b1('0x1c')]],'as':_0x4c7f05['as'],'attributes':_0x4c7f05[_0x74b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xa')](function(_0x5c32d2){logger[_0x74b1('0xb')](_0x74b1('0x13'),_0xde2736);logger[_0x74b1('0xd')](_0x74b1('0x13'),_0xde2736,JSON[_0x74b1('0xe')](_0x5c32d2));_0x1ab838(_0x5c32d2);})[_0x74b1('0x1d')](function(_0x436eda){logger[_0x74b1('0xf')]('GetTrigger',_0x436eda[_0x74b1('0x10')],_0xde2736);_0x4bb3d2(_0x8c9510[_0x74b1('0xf')](0x1f4,_0x436eda['message']));});});};exports[_0x74b1('0x1e')]=function(_0x45404f){var _0x1ac433=this;return new Promise(function(_0x5f4d1b,_0x113300){return db[_0x74b1('0x14')]['find']({'raw':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'where':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')][_0x74b1('0x18')]||null:null,'attributes':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')]['attributes']||null:null,'include':_0x45404f[_0x74b1('0x16')]?_0x45404f['options']['include']?_[_0x74b1('0x1b')](_0x45404f['options']['include'],function(_0x3fd43c){return{'model':db[_0x3fd43c[_0x74b1('0x1c')]],'as':_0x3fd43c['as'],'attributes':_0x3fd43c[_0x74b1('0x19')],'include':_0x3fd43c[_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0x3fd43c[_0x74b1('0x1a')],function(_0x171fa4){return{'model':db[_0x171fa4[_0x74b1('0x1c')]],'as':_0x171fa4['as'],'attributes':_0x171fa4['attributes'],'include':_0x171fa4['include']?_['map'](_0x171fa4[_0x74b1('0x1a')],function(_0x57f7b5){return{'model':db[_0x57f7b5['model']],'as':_0x57f7b5['as'],'attributes':_0x57f7b5[_0x74b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xa')](function(_0x222783){logger['info'](_0x74b1('0x1e'),_0x45404f);logger['debug'](_0x74b1('0x1e'),_0x45404f,JSON[_0x74b1('0xe')](_0x222783));_0x5f4d1b(_0x222783);})['catch'](function(_0x514d0e){logger[_0x74b1('0xf')](_0x74b1('0x1e'),_0x514d0e['message'],_0x45404f);_0x113300(_0x1ac433['error'](0x1f4,_0x514d0e[_0x74b1('0x10')]));});});}; \ No newline at end of file +var _0x4024=['attributes','include','map','model','then','debug','ShowTrigger','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','options'];(function(_0x342eb8,_0x45f4c8){var _0x12f00b=function(_0x5e42b1){while(--_0x5e42b1){_0x342eb8['push'](_0x342eb8['shift']());}};_0x12f00b(++_0x45f4c8);}(_0x4024,0x89));var _0x4402=function(_0x247923,_0x3aa509){_0x247923=_0x247923-0x0;var _0x4e4fbd=_0x4024[_0x247923];return _0x4e4fbd;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('Trigger,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['findAll']({'raw':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x231382[_0x4402('0x16')]?_0x231382['options']['where']||null:null,'attributes':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')][_0x4402('0x17')]||null:null,'limit':_0x231382['options']?_0x231382[_0x4402('0x16')]['limit']||null:null,'include':_0x231382['options']?_0x231382[_0x4402('0x16')][_0x4402('0x18')]?_[_0x4402('0x19')](_0x231382[_0x4402('0x16')][_0x4402('0x18')],function(_0x2e6fee){return{'model':db[_0x2e6fee[_0x4402('0x1a')]],'as':_0x2e6fee['as'],'attributes':_0x2e6fee[_0x4402('0x17')],'include':_0x2e6fee[_0x4402('0x18')]?_['map'](_0x2e6fee[_0x4402('0x18')],function(_0x4e1c04){return{'model':db[_0x4e1c04[_0x4402('0x1a')]],'as':_0x4e1c04['as'],'attributes':_0x4e1c04[_0x4402('0x17')],'include':_0x4e1c04[_0x4402('0x18')]?_[_0x4402('0x19')](_0x4e1c04['include'],function(_0x15c19f){return{'model':db[_0x15c19f['model']],'as':_0x15c19f['as'],'attributes':_0x15c19f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x395e49){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x1c')]('GetTrigger',_0x231382,JSON[_0x4402('0xd')](_0x395e49));_0x494389(_0x395e49);})['catch'](function(_0x71da2f){logger[_0x4402('0xe')](_0x4402('0x14'),_0x71da2f['message'],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x71da2f[_0x4402('0x11')]));});});};exports[_0x4402('0x1d')]=function(_0x3f4bcb){var _0x2526d1=this;return new Promise(function(_0x605702,_0x1189b8){return db[_0x4402('0x15')][_0x4402('0x1e')]({'raw':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb['options'][_0x4402('0x1f')]||null:null,'attributes':_0x3f4bcb['options']?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x17')]||null:null,'include':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')]?_['map'](_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')],function(_0x169340){return{'model':db[_0x169340['model']],'as':_0x169340['as'],'attributes':_0x169340[_0x4402('0x17')],'include':_0x169340[_0x4402('0x18')]?_['map'](_0x169340[_0x4402('0x18')],function(_0x437e83){return{'model':db[_0x437e83[_0x4402('0x1a')]],'as':_0x437e83['as'],'attributes':_0x437e83[_0x4402('0x17')],'include':_0x437e83[_0x4402('0x18')]?_[_0x4402('0x19')](_0x437e83[_0x4402('0x18')],function(_0x6e9fb7){return{'model':db[_0x6e9fb7[_0x4402('0x1a')]],'as':_0x6e9fb7['as'],'attributes':_0x6e9fb7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x28fee8){logger[_0x4402('0xa')]('ShowTrigger',_0x3f4bcb);logger[_0x4402('0x1c')](_0x4402('0x1d'),_0x3f4bcb,JSON['stringify'](_0x28fee8));_0x605702(_0x28fee8);})['catch'](function(_0x2b9d51){logger[_0x4402('0xe')](_0x4402('0x1d'),_0x2b9d51[_0x4402('0x11')],_0x3f4bcb);_0x1189b8(_0x2526d1['error'](0x1f4,_0x2b9d51['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e2ff384..bbaf0e9 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 _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','index','get','/:id','isAuthenticated','show','/:id/clone','clone','post','put'];(function(_0x42ffb1,_0x15c84b){var _0x11ff76=function(_0x293650){while(--_0x293650){_0x42ffb1['push'](_0x42ffb1['shift']());}};_0x11ff76(++_0x15c84b);}(_0xac31,0xca));var _0x1ac3=function(_0x1332c2,_0x130d66){_0x1332c2=_0x1332c2-0x0;var _0x486afc=_0xac31[_0x1332c2];return _0x486afc;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var auth=require(_0x1ac3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac3('0x7'));var controller=require(_0x1ac3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ac3('0x9')]);router[_0x1ac3('0xa')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0xd')]);router['post'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')]('/',auth[_0x1ac3('0xc')](),controller['create']);router[_0x1ac3('0x11')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')](_0x1ac3('0xb'),auth['isAuthenticated'](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file +var _0x6aa7=['Router','../../components/interaction/service','../../config/environment','./trunk.controller','index','/:id','isAuthenticated','show','/:id/clone','clone','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0xbd36ed,_0xe0956d){var _0x5852ce=function(_0x31bbd7){while(--_0x31bbd7){_0xbd36ed['push'](_0xbd36ed['shift']());}};_0x5852ce(++_0xe0956d);}(_0x6aa7,0x178));var _0x76aa=function(_0x441e7b,_0x2c8eea){_0x441e7b=_0x441e7b-0x0;var _0x4f7edf=_0x6aa7[_0x441e7b];return _0x4f7edf;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['post'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xd')]);router['post']('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);router[_0x76aa('0x11')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9a8b1f6..b653fe0 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 _0xd5e3=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x2b4174,_0x251220){var _0x211be=function(_0xcc42af){while(--_0xcc42af){_0x2b4174['push'](_0x2b4174['shift']());}};_0x211be(++_0x251220);}(_0xd5e3,0x191));var _0x3d5e=function(_0x5ec2fe,_0xa6aca){_0x5ec2fe=_0x5ec2fe-0x0;var _0x4385bc=_0xd5e3[_0x5ec2fe];return _0x4385bc;};'use strict';var Sequelize=require(_0x3d5e('0x0'));module[_0x3d5e('0x1')]={'name':{'type':Sequelize[_0x3d5e('0x2')],'allowNull':![],'unique':_0x3d5e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x5'),_0x3d5e('0x6'),_0x3d5e('0x7')),'allowNull':![],'defaultValue':_0x3d5e('0x5')},'context':{'type':Sequelize[_0x3d5e('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x8'),_0x3d5e('0x9'),'ALLOWED_FAILED_SCREEN',_0x3d5e('0xa'),_0x3d5e('0xb'),_0x3d5e('0xc'),_0x3d5e('0xd'),_0x3d5e('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x3d5e('0x2')]},'secret':{'type':Sequelize[_0x3d5e('0x2')]},'md5secret':{'type':Sequelize[_0x3d5e('0x2')]},'remotesecret':{'type':Sequelize[_0x3d5e('0x2')]},'transport':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':_0x3d5e('0xf'),'set':function(_0x485907){this['setDataValue'](_0x3d5e('0x10'),_0x485907?_0x485907[_0x3d5e('0x11')](','):null);},'get':function(){return this[_0x3d5e('0x12')]('transport')?this['getDataValue'](_0x3d5e('0x10'))[_0x3d5e('0x13')](','):null;},'comment':_0x3d5e('0x14')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x3d5e('0x15'),_0x3d5e('0x16'),'inband',_0x3d5e('0x17')),'defaultValue':_0x3d5e('0x18')},'directmedia':{'type':Sequelize['ENUM'](_0x3d5e('0x19'),'no','nonat','update',_0x3d5e('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3d5e('0x2')]},'directmediadeny':{'type':Sequelize[_0x3d5e('0x2')]},'nat':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':_0x3d5e('0x1b'),'set':function(_0x11483c){this[_0x3d5e('0x1c')]('nat',_0x11483c?_0x11483c[_0x3d5e('0x11')](','):null);},'get':function(){return this[_0x3d5e('0x12')](_0x3d5e('0x1d'))?this[_0x3d5e('0x12')](_0x3d5e('0x1d'))[_0x3d5e('0x13')](','):null;},'comment':_0x3d5e('0x1e')},'callgroup':{'type':Sequelize[_0x3d5e('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3d5e('0x2')]},'pickupgroup':{'type':Sequelize[_0x3d5e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3d5e('0x2')]},'language':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3d5e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3d5e('0x1f'),'set':function(_0x2cef51){this['setDataValue']('allow',_0x2cef51?_0x2cef51['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3d5e('0x12')](_0x3d5e('0x20'))?this['getDataValue'](_0x3d5e('0x20'))[_0x3d5e('0x13')](';'):null;},'comment':_0x3d5e('0x21')},'autoframing':{'type':Sequelize[_0x3d5e('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':_0x3d5e('0x22'),'set':function(_0x381916){this['setDataValue'](_0x3d5e('0x23'),_0x381916?_0x381916[_0x3d5e('0x11')](','):null);},'get':function(){return this[_0x3d5e('0x12')]('insecure')?this[_0x3d5e('0x12')](_0x3d5e('0x23'))[_0x3d5e('0x13')](','):null;},'comment':_0x3d5e('0x24')},'trustrpid':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no',_0x3d5e('0x25'))},'promiscredir':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3d5e('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3d5e('0x2')]},'callerid':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x3d5e('0x2')]},'callcounter':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':_0x3d5e('0x19')},'busylevel':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x3d5e('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x3d5e('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x3d5e('0x2')]},'template':{'type':Sequelize[_0x3d5e('0x2')]},'videosupport':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no',_0x3d5e('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'mailbox':{'type':Sequelize[_0x3d5e('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x3d5e('0x28'),_0x3d5e('0x29'),_0x3d5e('0x2a'))},'session_expires':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x2b'),_0x3d5e('0x2c')),'defaultValue':_0x3d5e('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x3d5e('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x3d5e('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':_0x3d5e('0x19')},'keepalive':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3d5e('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no',_0x3d5e('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3d5e('0x2')]},'callbackextension':{'type':Sequelize[_0x3d5e('0x2')]},'timert1':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'timerb':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x3d5e('0x2')]},'contactdeny':{'type':Sequelize[_0x3d5e('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3d5e('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3d5e('0x2')]},'maxforwards':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'encryption':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'force_avp':{'type':Sequelize[_0x3d5e('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x3d5e('0x2e'),_0x3d5e('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x3d5e('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3d5e('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3d5e('0x2')]},'dtlscipher':{'type':Sequelize[_0x3d5e('0x2')]},'dtlscafile':{'type':Sequelize[_0x3d5e('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x3d5e('0x30'),_0x3d5e('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3d5e('0x2')]},'usereqphone':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3d5e('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3d5e('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x3d5e('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x3d5e('0x4')](_0x3d5e('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3d5e('0x2')]},'mohsuggest':{'type':Sequelize[_0x3d5e('0x2')]},'parkinglot':{'type':Sequelize[_0x3d5e('0x2')]},'description':{'type':Sequelize[_0x3d5e('0x2')]},'host':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':_0x3d5e('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x3d5e('0x19'),'no','nonat',_0x3d5e('0x33'),_0x3d5e('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3d5e('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3d5e('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3d5e('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0ccb=['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]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','join'];(function(_0x1bf2b2,_0x5579a8){var _0x2907e8=function(_0x52e0c7){while(--_0x52e0c7){_0x1bf2b2['push'](_0x1bf2b2['shift']());}};_0x2907e8(++_0x5579a8);}(_0x0ccb,0x180));var _0xb0cc=function(_0x43c59b,_0x31c6fd){_0x43c59b=_0x43c59b-0x0;var _0x3562a7=_0x0ccb[_0x43c59b];return _0x3562a7;};'use strict';var Sequelize=require(_0xb0cc('0x0'));module[_0xb0cc('0x1')]={'name':{'type':Sequelize[_0xb0cc('0x2')],'allowNull':![],'unique':_0xb0cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb0cc('0x4')]('friend',_0xb0cc('0x5'),_0xb0cc('0x6')),'allowNull':![],'defaultValue':_0xb0cc('0x7')},'context':{'type':Sequelize[_0xb0cc('0x2')],'allowNull':![],'defaultValue':_0xb0cc('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0xb0cc('0x9'),'ALLOWED_PASSED_SCREEN',_0xb0cc('0xa'),'ALLOWED',_0xb0cc('0xb'),_0xb0cc('0xc'),_0xb0cc('0xd'),_0xb0cc('0xe'))},'deny':{'type':Sequelize[_0xb0cc('0x2')]},'permit':{'type':Sequelize[_0xb0cc('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xb0cc('0x2')]},'remotesecret':{'type':Sequelize[_0xb0cc('0x2')]},'transport':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':_0xb0cc('0xf'),'set':function(_0x4b7603){this[_0xb0cc('0x10')](_0xb0cc('0x11'),_0x4b7603?_0x4b7603['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0xb0cc('0x11'))[_0xb0cc('0x12')](','):null;},'comment':_0xb0cc('0x13')},'dtmfmode':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x14'),_0xb0cc('0x15'),_0xb0cc('0x16'),'inband',_0xb0cc('0x17')),'defaultValue':_0xb0cc('0x14')},'directmedia':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no','nonat',_0xb0cc('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb0cc('0x2')]},'directmediadeny':{'type':Sequelize[_0xb0cc('0x2')]},'nat':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x31067f){this[_0xb0cc('0x10')](_0xb0cc('0x1a'),_0x31067f?_0x31067f['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xb0cc('0x1b')](_0xb0cc('0x1a'))['split'](','):null;},'comment':_0xb0cc('0x1c')},'callgroup':{'type':Sequelize[_0xb0cc('0x2')]},'namedcallgroup':{'type':Sequelize[_0xb0cc('0x2')]},'pickupgroup':{'type':Sequelize[_0xb0cc('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xb0cc('0x2')]},'language':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb0cc('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xb0cc('0x2')],'allowNull':![],'defaultValue':_0xb0cc('0x1d'),'set':function(_0x447395){this[_0xb0cc('0x10')](_0xb0cc('0x1e'),_0x447395?_0x447395[_0xb0cc('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xb0cc('0x1e'))?this[_0xb0cc('0x1b')](_0xb0cc('0x1e'))[_0xb0cc('0x12')](';'):null;},'comment':_0xb0cc('0x20')},'autoframing':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'insecure':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':_0xb0cc('0x21'),'set':function(_0xe9c0a2){this[_0xb0cc('0x10')](_0xb0cc('0x22'),_0xe9c0a2?_0xe9c0a2[_0xb0cc('0x1f')](','):null);},'get':function(){return this[_0xb0cc('0x1b')](_0xb0cc('0x22'))?this['getDataValue'](_0xb0cc('0x22'))[_0xb0cc('0x12')](','):null;},'comment':_0xb0cc('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xb0cc('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xb0cc('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xb0cc('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'setvar':{'type':Sequelize[_0xb0cc('0x2')]},'callerid':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':_0xb0cc('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xb0cc('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xb0cc('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xb0cc('0x2')]},'template':{'type':Sequelize[_0xb0cc('0x2')]},'videosupport':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no',_0xb0cc('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb0cc('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xb0cc('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xb0cc('0x27'),_0xb0cc('0x28'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xb0cc('0x29'),_0xb0cc('0x2a')),'defaultValue':_0xb0cc('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xb0cc('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xb0cc('0x2')]},'port':{'type':Sequelize[_0xb0cc('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xb0cc('0x18'),'no'),'defaultValue':_0xb0cc('0x18')},'keepalive':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xb0cc('0x2')]},'defaultuser':{'type':Sequelize[_0xb0cc('0x2')]},'rtptimeout':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no',_0xb0cc('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb0cc('0x2')]},'callbackextension':{'type':Sequelize[_0xb0cc('0x2')]},'timert1':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xb0cc('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xb0cc('0x2')]},'maxforwards':{'type':Sequelize[_0xb0cc('0x24')](0xb)},'encryption':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'force_avp':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xb0cc('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no',_0xb0cc('0x2c'),_0xb0cc('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xb0cc('0x2')]},'dtlscipher':{'type':Sequelize[_0xb0cc('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xb0cc('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xb0cc('0x2e'),_0xb0cc('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb0cc('0x2')]},'usereqphone':{'type':Sequelize[_0xb0cc('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb0cc('0x2')]},'recordofffeature':{'type':Sequelize[_0xb0cc('0x2')]},'call_limit':{'type':Sequelize[_0xb0cc('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xb0cc('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xb0cc('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xb0cc('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0cc('0x2')]},'host':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':_0xb0cc('0x30')},'canreinvite':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x18'),'no',_0xb0cc('0x31'),'update',_0xb0cc('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb0cc('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xb0cc('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 6aa24b3..282d358 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 _0x70b5=['limit','set','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','end','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','rawAttributes','find','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','findAll','root','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','registry','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','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','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset'];(function(_0x57914d,_0x3a0591){var _0x4a558f=function(_0x8a39f9){while(--_0x8a39f9){_0x57914d['push'](_0x57914d['shift']());}};_0x4a558f(++_0x3a0591);}(_0x70b5,0x1f0));var _0x570b=function(_0x5491e5,_0x37a869){_0x5491e5=_0x5491e5-0x0;var _0x214eb5=_0x70b5[_0x5491e5];return _0x214eb5;};'use strict';var pdf=require(_0x570b('0x0'));var emlformat=require(_0x570b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x570b('0x2'));var rp=require(_0x570b('0x3'));var moment=require('moment');var BPromise=require(_0x570b('0x4'));var Mustache=require(_0x570b('0x5'));var util=require(_0x570b('0x6'));var path=require(_0x570b('0x7'));var sox=require(_0x570b('0x8'));var csv=require(_0x570b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x570b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x570b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x570b('0x9'));var querystring=require('querystring');var Papa=require(_0x570b('0xc'));var Redis=require(_0x570b('0xd'));var authService=require(_0x570b('0xe'));var qs=require(_0x570b('0xf'));var as=require(_0x570b('0x10'));var hardwareService=require(_0x570b('0x11'));var logger=require(_0x570b('0x12'))(_0x570b('0x13'));var utils=require(_0x570b('0x14'));var config=require(_0x570b('0x15'));var licenseUtil=require(_0x570b('0x16'));var db=require(_0x570b('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x570b('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe61,_0x137894,_0x1c96cd,_0x1e631a){return new BPromise(function(_0x481903,_0x2213d3){var _0x52a920=_0x1e631a||client;return _0x52a920['request'](_0x11fe61,_0x1c96cd)[_0x570b('0x19')](function(_0x2c67e6){logger[_0x570b('0x1a')](_0x570b('0x1b'),_0x137894,_0x570b('0x1c'));logger[_0x570b('0x1d')](_0x570b('0x1e'),_0x137894,_0x570b('0x1c'),JSON[_0x570b('0x1f')](_0x2c67e6));if(_0x2c67e6[_0x570b('0x20')]){if(_0x2c67e6[_0x570b('0x20')][_0x570b('0x21')]===0x1f4){logger[_0x570b('0x20')](_0x570b('0x1b'),_0x137894,_0x2c67e6[_0x570b('0x20')][_0x570b('0x22')]);return _0x2213d3(_0x2c67e6[_0x570b('0x20')][_0x570b('0x22')]);}logger[_0x570b('0x20')](_0x570b('0x1b'),_0x137894,_0x2c67e6['error'][_0x570b('0x22')]);return _0x481903(_0x2c67e6[_0x570b('0x20')][_0x570b('0x22')]);}else{logger[_0x570b('0x1a')](_0x570b('0x1b'),_0x137894,_0x570b('0x1c'));_0x481903(_0x2c67e6['result'][_0x570b('0x22')]);}})[_0x570b('0x23')](function(_0x569a5f){logger['error'](_0x570b('0x1b'),_0x137894,_0x569a5f);_0x2213d3(_0x569a5f);});});}function respondWithStatusCode(_0x18ec52,_0x27c015){_0x27c015=_0x27c015||0xcc;return function(_0x5a3d1d){if(_0x5a3d1d){return _0x18ec52['sendStatus'](_0x27c015);}return _0x18ec52[_0x570b('0x24')](_0x27c015)['end']();};}function respondWithResult(_0x46e7d1,_0x12b2cd){_0x12b2cd=_0x12b2cd||0xc8;return function(_0x4f0aa3){if(_0x4f0aa3){return _0x46e7d1['status'](_0x12b2cd)[_0x570b('0x25')](_0x4f0aa3);}};}function respondWithFilteredResult(_0x313e23,_0xdbb64d){return function(_0x2e4257){if(_0x2e4257){var _0x49b6e3=_0x2e4257['count'],_0x24d01d=_0xdbb64d[_0x570b('0x26')],_0x32fbb0=_0xdbb64d[_0x570b('0x26')]+_0xdbb64d[_0x570b('0x27')],_0x45800d;if(_0x32fbb0>=_0x49b6e3){_0x32fbb0=_0x49b6e3;_0x45800d=0xc8;}else{_0x45800d=0xce;}_0x313e23[_0x570b('0x24')](_0x45800d);return _0x313e23[_0x570b('0x28')](_0x570b('0x29'),_0x24d01d+'-'+_0x32fbb0+'/'+_0x49b6e3)[_0x570b('0x25')](_0x2e4257);}return null;};}function patchUpdates(_0x4b3fe3){return function(_0x4f7a14){try{jsonpatch[_0x570b('0x2a')](_0x4f7a14,_0x4b3fe3,!![]);}catch(_0x418436){return BPromise[_0x570b('0x2b')](_0x418436);}return _0x4f7a14['save']();};}function saveUpdates(_0x2fea20,_0x2cedd5){return function(_0x19ab88){if(_0x19ab88){return _0x19ab88[_0x570b('0x2c')](_0x2fea20)[_0x570b('0x19')](function(_0x40b5d2){return _0x40b5d2;});}return null;};}function removeEntity(_0x1b24dc,_0x2b681d){return function(_0x5c6b71){if(_0x5c6b71){return _0x5c6b71[_0x570b('0x2d')]()['then'](function(){var _0x7b1df4=_0x5c6b71[_0x570b('0x2e')]({'plain':!![]});var _0x5cf0c9=_0x570b('0x2f');return db[_0x570b('0x30')][_0x570b('0x2d')]({'where':{'type':_0x5cf0c9,'resourceId':_0x7b1df4['id']}})[_0x570b('0x19')](function(){return _0x5c6b71;});})[_0x570b('0x19')](function(){_0x1b24dc[_0x570b('0x24')](0xcc)[_0x570b('0x31')]();});}};}function handleEntityNotFound(_0xa64b19,_0x17ab1d){return function(_0x404e94){if(!_0x404e94){_0xa64b19['sendStatus'](0x194);}return _0x404e94;};}function handleError(_0x4a3384,_0x417963){_0x417963=_0x417963||0x1f4;return function(_0x337d4e){logger[_0x570b('0x20')](_0x337d4e[_0x570b('0x32')]);if(_0x337d4e[_0x570b('0x33')]){delete _0x337d4e['name'];}_0x4a3384[_0x570b('0x24')](_0x417963)['send'](_0x337d4e);};}exports[_0x570b('0x34')]=function(_0x4b9928,_0x374cf4){var _0x34a6b9={},_0x47a88f={},_0x185a25={'count':0x0,'rows':[]};var _0x3a52a7=_[_0x570b('0x35')](db[_0x570b('0x36')]['rawAttributes'],function(_0x5e133d){return{'name':_0x5e133d[_0x570b('0x37')],'type':_0x5e133d[_0x570b('0x38')][_0x570b('0x39')]};});_0x47a88f[_0x570b('0x3a')]=_[_0x570b('0x35')](_0x3a52a7,_0x570b('0x33'));_0x47a88f[_0x570b('0x3b')]=_[_0x570b('0x3c')](_0x4b9928['query']);_0x47a88f[_0x570b('0x3d')]=_[_0x570b('0x3e')](_0x47a88f[_0x570b('0x3a')],_0x47a88f[_0x570b('0x3b')]);_0x34a6b9[_0x570b('0x3f')]=_[_0x570b('0x3e')](_0x47a88f[_0x570b('0x3a')],qs[_0x570b('0x40')](_0x4b9928[_0x570b('0x3b')][_0x570b('0x40')]));_0x34a6b9[_0x570b('0x3f')]=_0x34a6b9[_0x570b('0x3f')][_0x570b('0x41')]?_0x34a6b9[_0x570b('0x3f')]:_0x47a88f[_0x570b('0x3a')];if(!_0x4b9928[_0x570b('0x3b')][_0x570b('0x42')]('nolimit')){_0x34a6b9[_0x570b('0x27')]=qs[_0x570b('0x27')](_0x4b9928[_0x570b('0x3b')]['limit']);_0x34a6b9[_0x570b('0x26')]=qs[_0x570b('0x26')](_0x4b9928['query']['offset']);}_0x34a6b9[_0x570b('0x43')]=qs[_0x570b('0x44')](_0x4b9928[_0x570b('0x3b')][_0x570b('0x44')]);_0x34a6b9['where']=qs['filters'](_['pick'](_0x4b9928['query'],_0x47a88f[_0x570b('0x3d')]),_0x3a52a7);if(_0x4b9928[_0x570b('0x3b')]['filter']){_0x34a6b9[_0x570b('0x45')]=_[_0x570b('0x46')](_0x34a6b9[_0x570b('0x45')],{'$or':_[_0x570b('0x35')](_0x3a52a7,function(_0x1735b7){if(_0x1735b7[_0x570b('0x38')]!==_0x570b('0x47')){var _0x5e41dc={};_0x5e41dc[_0x1735b7[_0x570b('0x33')]]={'$like':'%'+_0x4b9928['query'][_0x570b('0x48')]+'%'};return _0x5e41dc;}})});}_0x34a6b9=_['merge']({},_0x34a6b9,_0x4b9928[_0x570b('0x49')]);var _0x57ca66={'where':_0x34a6b9[_0x570b('0x45')]};return db['Trunk']['count'](_0x57ca66)[_0x570b('0x19')](function(_0x230593){_0x185a25[_0x570b('0x4a')]=_0x230593;if(_0x4b9928['query'][_0x570b('0x4b')]){_0x34a6b9[_0x570b('0x4c')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x34a6b9);})['then'](function(_0x5d769e){_0x185a25[_0x570b('0x4d')]=_0x5d769e;return _0x185a25;})[_0x570b('0x19')](respondWithFilteredResult(_0x374cf4,_0x34a6b9))[_0x570b('0x23')](handleError(_0x374cf4,null));};exports[_0x570b('0x4e')]=function(_0x193906,_0x3afa1d){var _0x5cf20c={'raw':![],'where':{'id':_0x193906[_0x570b('0x4f')]['id']}},_0x3d3257={};_0x3d3257[_0x570b('0x3a')]=_[_0x570b('0x3c')](db['Trunk'][_0x570b('0x50')]);_0x3d3257[_0x570b('0x3b')]=_[_0x570b('0x3c')](_0x193906[_0x570b('0x3b')]);_0x3d3257[_0x570b('0x3d')]=_[_0x570b('0x3e')](_0x3d3257[_0x570b('0x3a')],_0x3d3257[_0x570b('0x3b')]);_0x5cf20c[_0x570b('0x3f')]=_[_0x570b('0x3e')](_0x3d3257[_0x570b('0x3a')],qs[_0x570b('0x40')](_0x193906[_0x570b('0x3b')]['fields']));_0x5cf20c[_0x570b('0x3f')]=_0x5cf20c[_0x570b('0x3f')]['length']?_0x5cf20c[_0x570b('0x3f')]:_0x3d3257[_0x570b('0x3a')];if(_0x193906['query'][_0x570b('0x4b')]){_0x5cf20c['include']=[{'all':!![]}];}_0x5cf20c=_[_0x570b('0x46')]({},_0x5cf20c,_0x193906[_0x570b('0x49')]);return db['Trunk'][_0x570b('0x51')](_0x5cf20c)[_0x570b('0x19')](handleEntityNotFound(_0x3afa1d,null))[_0x570b('0x19')](respondWithResult(_0x3afa1d,null))[_0x570b('0x23')](handleError(_0x3afa1d,null));};exports['clone']=function(_0x12a278,_0x468ac4){var _0x260a79={'where':{'id':_0x12a278[_0x570b('0x4f')]['id']}},_0x12c130={};_0x12c130[_0x570b('0x3a')]=_[_0x570b('0x3c')](db[_0x570b('0x36')][_0x570b('0x50')]);_0x260a79['attributes']=_[_0x570b('0x3e')](_0x12c130[_0x570b('0x3a')],qs[_0x570b('0x40')](_0x12a278[_0x570b('0x3b')]['fields']));_0x260a79['attributes']=_0x260a79['attributes'][_0x570b('0x41')]?_0x260a79[_0x570b('0x3f')]:_0x12c130[_0x570b('0x3a')];if(_0x12a278[_0x570b('0x3b')][_0x570b('0x4b')]){_0x260a79[_0x570b('0x4c')]=[{'all':!![]}];}_0x260a79=_['merge']({},_0x260a79,_0x12a278[_0x570b('0x49')]);return db[_0x570b('0x36')][_0x570b('0x51')](_0x260a79)[_0x570b('0x19')](handleEntityNotFound(_0x468ac4,null))['then'](function(_0x2f7b65){if(_0x2f7b65){var _0x43230a=_0x2f7b65[_0x570b('0x2e')]({'plain':!![]});_0x43230a=qs[_0x570b('0x52')](_0x43230a,['id',_0x570b('0x53'),_0x570b('0x54')]);_0x12a278[_0x570b('0x55')]=_[_0x570b('0x52')](_0x12a278[_0x570b('0x55')],['id',_0x570b('0x53'),_0x570b('0x54')]);return db['Trunk'][_0x570b('0x56')](_['merge'](_0x43230a,_0x12a278['body']),{'include':_0x12a278[_0x570b('0x3b')][_0x570b('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x525adf){var _0x3d9d92=_0x12a278[_0x570b('0x57')][_0x570b('0x2e')]({'plain':!![]});if(!_0x3d9d92)throw new Error(_0x570b('0x58'));if(_0x3d9d92[_0x570b('0x59')]===_0x570b('0x57')){var _0x2be964=_0x525adf['get']({'plain':!![]});var _0x559315=_0x570b('0x2f');return db[_0x570b('0x5a')][_0x570b('0x51')]({'where':{'name':_0x559315,'userProfileId':_0x3d9d92[_0x570b('0x5b')]},'raw':!![]})[_0x570b('0x19')](function(_0x4bde5a){if(_0x4bde5a&&_0x4bde5a[_0x570b('0x5c')]===0x0){return db[_0x570b('0x30')][_0x570b('0x56')]({'name':_0x2be964[_0x570b('0x33')],'resourceId':_0x2be964['id'],'type':_0x4bde5a[_0x570b('0x33')],'sectionId':_0x4bde5a['id']},{})[_0x570b('0x19')](function(){return _0x525adf;});}else{return _0x525adf;}})[_0x570b('0x23')](function(_0x1033d3){logger[_0x570b('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1033d3);throw _0x1033d3;});}return _0x525adf;});}})['then'](respondWithResult(_0x468ac4,0xc9))[_0x570b('0x23')](handleError(_0x468ac4,null));};exports[_0x570b('0x56')]=function(_0x558472,_0x3a47b7,_0x3efbc4){var _0x466b6d;return db['Trunk'][_0x570b('0x56')](_0x558472[_0x570b('0x55')],{'raw':!![]})[_0x570b('0x19')](function(_0x174bf1){_0x466b6d=_0x174bf1;return db[_0x570b('0x36')][_0x570b('0x5d')]({'raw':!![]});})[_0x570b('0x19')](function(_0x5a82e4){var _0x3ce146=fs['readFileSync'](path['join'](config[_0x570b('0x5e')],'server/files/templates/trunk.ejs'),_0x570b('0x5f'));var _0x335276=fs['readFileSync'](path[_0x570b('0x60')](config[_0x570b('0x5e')],_0x570b('0x61')),_0x570b('0x5f'));var _0x408371=ejs[_0x570b('0x62')](_0x3ce146,{'trunks':_0x5a82e4||[]});fs[_0x570b('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x408371);if(_0x466b6d[_0x570b('0x64')]){var _0xfd1b03=ejs[_0x570b('0x62')](_0x335276,{'trunks':_0x5a82e4||[]});fs[_0x570b('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0xfd1b03);}})[_0x570b('0x19')](function(){return respondWithRpcPromise('Reload',_0x570b('0x56'),{'module':_0x570b('0x65')});})[_0x570b('0x19')](function(){var _0x15b6f4=_0x558472[_0x570b('0x57')]['get']({'plain':!![]});if(!_0x15b6f4)throw new Error(_0x570b('0x58'));if(_0x15b6f4[_0x570b('0x59')]==='user'){var _0x203e11=_0x466b6d[_0x570b('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x570b('0x51')]({'where':{'name':_0x570b('0x2f'),'userProfileId':_0x15b6f4['userProfileId']},'raw':!![]})[_0x570b('0x19')](function(_0x108f7c){if(_0x108f7c&&_0x108f7c[_0x570b('0x5c')]===0x0){return db[_0x570b('0x30')][_0x570b('0x56')]({'name':_0x203e11[_0x570b('0x33')],'resourceId':_0x203e11['id'],'type':_0x108f7c[_0x570b('0x33')],'sectionId':_0x108f7c['id']},{})[_0x570b('0x19')](function(){return _0x466b6d;});}else{return _0x466b6d;}})[_0x570b('0x23')](function(_0x485a0a){logger[_0x570b('0x20')](_0x570b('0x66'),_0x485a0a);throw _0x485a0a;});}return _0x466b6d;})[_0x570b('0x19')](respondWithResult(_0x3a47b7,0xc9))[_0x570b('0x23')](handleError(_0x3a47b7,null));};exports['update']=function(_0x5b44bd,_0x442403,_0x161295){var _0x3d1a6b;return db[_0x570b('0x36')]['find']({'where':{'id':_0x5b44bd[_0x570b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x442403,null))[_0x570b('0x19')](saveUpdates(_0x5b44bd[_0x570b('0x55')],null))[_0x570b('0x19')](function(_0x3ffd2e){if(_0x3ffd2e){_0x3d1a6b=_0x3ffd2e;return db[_0x570b('0x36')]['findAll']({'raw':!![]});}})[_0x570b('0x19')](function(_0x24f97d){if(_0x24f97d){var _0x14b43b=fs[_0x570b('0x67')](path[_0x570b('0x60')](config[_0x570b('0x5e')],'server/files/templates/trunk.ejs'),_0x570b('0x5f'));var _0x42d6f3=fs[_0x570b('0x67')](path[_0x570b('0x60')](config['root'],_0x570b('0x61')),_0x570b('0x5f'));var _0x278e15=ejs[_0x570b('0x62')](_0x14b43b,{'trunks':_0x24f97d||[]});fs[_0x570b('0x63')](_0x570b('0x68'),_0x278e15);var _0x327510=ejs[_0x570b('0x62')](_0x42d6f3,{'trunks':_0x24f97d||[]});fs[_0x570b('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x327510);return respondWithRpcPromise(_0x570b('0x69'),_0x570b('0x2c'),{'module':'chan_sip.so'});}return null;})[_0x570b('0x19')](function(_0x4dc735){if(_0x4dc735){return _0x3d1a6b;}})[_0x570b('0x19')](respondWithResult(_0x442403,null))['catch'](handleError(_0x442403,null));};exports['destroy']=function(_0x2011e9,_0x4c1f7d,_0x309d85){var _0x12f9e8;return db['Trunk'][_0x570b('0x51')]({'where':{'id':_0x2011e9[_0x570b('0x4f')]['id']}})[_0x570b('0x19')](handleEntityNotFound(_0x4c1f7d,null))[_0x570b('0x19')](removeEntity(_0x4c1f7d,null))[_0x570b('0x19')](function(){return db[_0x570b('0x36')][_0x570b('0x5d')]({'raw':!![]});})[_0x570b('0x19')](function(_0x5ddd62){var _0x2e8f8c=fs[_0x570b('0x67')](path[_0x570b('0x60')](config[_0x570b('0x5e')],'server/files/templates/trunk.ejs'),_0x570b('0x5f'));var _0x308284=fs[_0x570b('0x67')](path['join'](config['root'],_0x570b('0x61')),'utf8');var _0x4be5ef=ejs['render'](_0x2e8f8c,{'trunks':_0x5ddd62});var _0x4a5d9a=ejs['render'](_0x308284,{'trunks':_0x5ddd62});fs['writeFileSync'](_0x570b('0x68'),_0x4be5ef);fs[_0x570b('0x63')](_0x570b('0x6a'),_0x4a5d9a);return respondWithRpcPromise(_0x570b('0x69'),'destroy',{'module':_0x570b('0x65')});})[_0x570b('0x23')](handleError(_0x4c1f7d,null));}; \ No newline at end of file +var _0xf20a=['update','get','Trunks','UserProfileResource','destroy','stack','name','send','index','map','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','clone','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save'];(function(_0x4b9678,_0x382652){var _0x286037=function(_0x3c5550){while(--_0x3c5550){_0x4b9678['push'](_0x4b9678['shift']());}};_0x286037(++_0x382652);}(_0xf20a,0xad));var _0xaf20=function(_0xcb0237,_0x115e19){_0xcb0237=_0xcb0237-0x0;var _0x2c0354=_0xf20a[_0xcb0237];return _0x2c0354;};'use strict';var pdf=require(_0xaf20('0x0'));var emlformat=require(_0xaf20('0x1'));var rimraf=require(_0xaf20('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaf20('0x3'));var moment=require(_0xaf20('0x4'));var BPromise=require(_0xaf20('0x5'));var Mustache=require(_0xaf20('0x6'));var util=require(_0xaf20('0x7'));var path=require(_0xaf20('0x8'));var sox=require(_0xaf20('0x9'));var csv=require(_0xaf20('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaf20('0xb'));var squel=require(_0xaf20('0xc'));var crypto=require(_0xaf20('0xd'));var jsforce=require(_0xaf20('0xe'));var deskjs=require(_0xaf20('0xf'));var toCsv=require(_0xaf20('0xa'));var querystring=require(_0xaf20('0x10'));var Papa=require(_0xaf20('0x11'));var Redis=require('ioredis');var authService=require(_0xaf20('0x12'));var qs=require(_0xaf20('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf20('0x14'));var logger=require('../../config/logger')(_0xaf20('0x15'));var utils=require(_0xaf20('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xaf20('0x17'));var db=require(_0xaf20('0x18'))['db'];var jayson=require(_0xaf20('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8092a1,_0x58c5a3,_0x11fc91,_0x10c21b){return new BPromise(function(_0x17165d,_0x482545){var _0x204491=_0x10c21b||client;return _0x204491['request'](_0x8092a1,_0x11fc91)[_0xaf20('0x1a')](function(_0x4888be){logger[_0xaf20('0x1b')](_0xaf20('0x1c'),_0x58c5a3,_0xaf20('0x1d'));logger['debug'](_0xaf20('0x1e'),_0x58c5a3,'request\x20sent',JSON[_0xaf20('0x1f')](_0x4888be));if(_0x4888be[_0xaf20('0x20')]){if(_0x4888be[_0xaf20('0x20')][_0xaf20('0x21')]===0x1f4){logger[_0xaf20('0x20')](_0xaf20('0x1c'),_0x58c5a3,_0x4888be['error'][_0xaf20('0x22')]);return _0x482545(_0x4888be[_0xaf20('0x20')][_0xaf20('0x22')]);}logger[_0xaf20('0x20')]('Trunk,\x20%s,\x20%s',_0x58c5a3,_0x4888be[_0xaf20('0x20')][_0xaf20('0x22')]);return _0x17165d(_0x4888be[_0xaf20('0x20')]['message']);}else{logger[_0xaf20('0x1b')](_0xaf20('0x1c'),_0x58c5a3,_0xaf20('0x1d'));_0x17165d(_0x4888be[_0xaf20('0x23')][_0xaf20('0x22')]);}})[_0xaf20('0x24')](function(_0x33c3f4){logger['error']('Trunk,\x20%s,\x20%s',_0x58c5a3,_0x33c3f4);_0x482545(_0x33c3f4);});});}function respondWithStatusCode(_0x20e543,_0x2e70d9){_0x2e70d9=_0x2e70d9||0xcc;return function(_0x269a51){if(_0x269a51){return _0x20e543[_0xaf20('0x25')](_0x2e70d9);}return _0x20e543[_0xaf20('0x26')](_0x2e70d9)[_0xaf20('0x27')]();};}function respondWithResult(_0x206cbb,_0x4a0159){_0x4a0159=_0x4a0159||0xc8;return function(_0x4fe4c1){if(_0x4fe4c1){return _0x206cbb[_0xaf20('0x26')](_0x4a0159)[_0xaf20('0x28')](_0x4fe4c1);}};}function respondWithFilteredResult(_0xc1f2d8,_0x343e6d){return function(_0xe92aa2){if(_0xe92aa2){var _0x30593e=_0xe92aa2[_0xaf20('0x29')],_0x489c5a=_0x343e6d[_0xaf20('0x2a')],_0x5246f7=_0x343e6d[_0xaf20('0x2a')]+_0x343e6d[_0xaf20('0x2b')],_0x5ecf01;if(_0x5246f7>=_0x30593e){_0x5246f7=_0x30593e;_0x5ecf01=0xc8;}else{_0x5ecf01=0xce;}_0xc1f2d8[_0xaf20('0x26')](_0x5ecf01);return _0xc1f2d8[_0xaf20('0x2c')]('Content-Range',_0x489c5a+'-'+_0x5246f7+'/'+_0x30593e)[_0xaf20('0x28')](_0xe92aa2);}return null;};}function patchUpdates(_0x522c16){return function(_0x493321){try{jsonpatch[_0xaf20('0x2d')](_0x493321,_0x522c16,!![]);}catch(_0x556e9e){return BPromise['reject'](_0x556e9e);}return _0x493321[_0xaf20('0x2e')]();};}function saveUpdates(_0x5e16c8,_0x2dd718){return function(_0x22acbb){if(_0x22acbb){return _0x22acbb[_0xaf20('0x2f')](_0x5e16c8)[_0xaf20('0x1a')](function(_0x4a48cb){return _0x4a48cb;});}return null;};}function removeEntity(_0x1d321c,_0x40b716){return function(_0x3be27e){if(_0x3be27e){return _0x3be27e['destroy']()[_0xaf20('0x1a')](function(){var _0x8a4f36=_0x3be27e[_0xaf20('0x30')]({'plain':!![]});var _0x26fcc4=_0xaf20('0x31');return db[_0xaf20('0x32')][_0xaf20('0x33')]({'where':{'type':_0x26fcc4,'resourceId':_0x8a4f36['id']}})[_0xaf20('0x1a')](function(){return _0x3be27e;});})[_0xaf20('0x1a')](function(){_0x1d321c[_0xaf20('0x26')](0xcc)[_0xaf20('0x27')]();});}};}function handleEntityNotFound(_0x59be2e,_0x438bb1){return function(_0x12ff2e){if(!_0x12ff2e){_0x59be2e[_0xaf20('0x25')](0x194);}return _0x12ff2e;};}function handleError(_0x1a2374,_0x41beaf){_0x41beaf=_0x41beaf||0x1f4;return function(_0x3fba9d){logger[_0xaf20('0x20')](_0x3fba9d[_0xaf20('0x34')]);if(_0x3fba9d['name']){delete _0x3fba9d[_0xaf20('0x35')];}_0x1a2374[_0xaf20('0x26')](_0x41beaf)[_0xaf20('0x36')](_0x3fba9d);};}exports[_0xaf20('0x37')]=function(_0x3e8cb3,_0x2a4a09){var _0x5869a0={},_0xbed784={},_0x2037b1={'count':0x0,'rows':[]};var _0x4ca78b=_[_0xaf20('0x38')](db['Trunk']['rawAttributes'],function(_0x1202de){return{'name':_0x1202de['fieldName'],'type':_0x1202de[_0xaf20('0x39')]['key']};});_0xbed784[_0xaf20('0x3a')]=_['map'](_0x4ca78b,_0xaf20('0x35'));_0xbed784[_0xaf20('0x3b')]=_[_0xaf20('0x3c')](_0x3e8cb3[_0xaf20('0x3b')]);_0xbed784['filters']=_[_0xaf20('0x3d')](_0xbed784[_0xaf20('0x3a')],_0xbed784[_0xaf20('0x3b')]);_0x5869a0[_0xaf20('0x3e')]=_[_0xaf20('0x3d')](_0xbed784['model'],qs['fields'](_0x3e8cb3[_0xaf20('0x3b')]['fields']));_0x5869a0[_0xaf20('0x3e')]=_0x5869a0['attributes'][_0xaf20('0x3f')]?_0x5869a0[_0xaf20('0x3e')]:_0xbed784[_0xaf20('0x3a')];if(!_0x3e8cb3[_0xaf20('0x3b')][_0xaf20('0x40')](_0xaf20('0x41'))){_0x5869a0[_0xaf20('0x2b')]=qs[_0xaf20('0x2b')](_0x3e8cb3[_0xaf20('0x3b')][_0xaf20('0x2b')]);_0x5869a0[_0xaf20('0x2a')]=qs[_0xaf20('0x2a')](_0x3e8cb3[_0xaf20('0x3b')][_0xaf20('0x2a')]);}_0x5869a0[_0xaf20('0x42')]=qs[_0xaf20('0x43')](_0x3e8cb3['query']['sort']);_0x5869a0[_0xaf20('0x44')]=qs[_0xaf20('0x45')](_[_0xaf20('0x46')](_0x3e8cb3[_0xaf20('0x3b')],_0xbed784[_0xaf20('0x45')]),_0x4ca78b);if(_0x3e8cb3['query']['filter']){_0x5869a0[_0xaf20('0x44')]=_[_0xaf20('0x47')](_0x5869a0[_0xaf20('0x44')],{'$or':_[_0xaf20('0x38')](_0x4ca78b,function(_0x51e4a1){if(_0x51e4a1[_0xaf20('0x39')]!=='VIRTUAL'){var _0x42b278={};_0x42b278[_0x51e4a1[_0xaf20('0x35')]]={'$like':'%'+_0x3e8cb3[_0xaf20('0x3b')][_0xaf20('0x48')]+'%'};return _0x42b278;}})});}_0x5869a0=_['merge']({},_0x5869a0,_0x3e8cb3[_0xaf20('0x49')]);var _0x2bbbd1={'where':_0x5869a0['where']};return db[_0xaf20('0x4a')][_0xaf20('0x29')](_0x2bbbd1)[_0xaf20('0x1a')](function(_0xee157f){_0x2037b1['count']=_0xee157f;if(_0x3e8cb3[_0xaf20('0x3b')][_0xaf20('0x4b')]){_0x5869a0[_0xaf20('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0xaf20('0x4d')](_0x5869a0);})[_0xaf20('0x1a')](function(_0x43b3f0){_0x2037b1[_0xaf20('0x4e')]=_0x43b3f0;return _0x2037b1;})['then'](respondWithFilteredResult(_0x2a4a09,_0x5869a0))[_0xaf20('0x24')](handleError(_0x2a4a09,null));};exports[_0xaf20('0x4f')]=function(_0x2c2bf2,_0x576e9e){var _0x39fdea={'raw':![],'where':{'id':_0x2c2bf2[_0xaf20('0x50')]['id']}},_0x17cc3d={};_0x17cc3d[_0xaf20('0x3a')]=_[_0xaf20('0x3c')](db[_0xaf20('0x4a')][_0xaf20('0x51')]);_0x17cc3d[_0xaf20('0x3b')]=_[_0xaf20('0x3c')](_0x2c2bf2['query']);_0x17cc3d[_0xaf20('0x45')]=_[_0xaf20('0x3d')](_0x17cc3d[_0xaf20('0x3a')],_0x17cc3d[_0xaf20('0x3b')]);_0x39fdea[_0xaf20('0x3e')]=_[_0xaf20('0x3d')](_0x17cc3d[_0xaf20('0x3a')],qs['fields'](_0x2c2bf2[_0xaf20('0x3b')][_0xaf20('0x52')]));_0x39fdea[_0xaf20('0x3e')]=_0x39fdea[_0xaf20('0x3e')][_0xaf20('0x3f')]?_0x39fdea[_0xaf20('0x3e')]:_0x17cc3d[_0xaf20('0x3a')];if(_0x2c2bf2['query'][_0xaf20('0x4b')]){_0x39fdea['include']=[{'all':!![]}];}_0x39fdea=_[_0xaf20('0x47')]({},_0x39fdea,_0x2c2bf2[_0xaf20('0x49')]);return db['Trunk'][_0xaf20('0x53')](_0x39fdea)[_0xaf20('0x1a')](handleEntityNotFound(_0x576e9e,null))['then'](respondWithResult(_0x576e9e,null))[_0xaf20('0x24')](handleError(_0x576e9e,null));};exports[_0xaf20('0x54')]=function(_0x3ae41d,_0x2439e2){var _0x215d75={'where':{'id':_0x3ae41d['params']['id']}},_0x56c993={};_0x56c993['model']=_[_0xaf20('0x3c')](db['Trunk'][_0xaf20('0x51')]);_0x215d75[_0xaf20('0x3e')]=_['intersection'](_0x56c993[_0xaf20('0x3a')],qs[_0xaf20('0x52')](_0x3ae41d[_0xaf20('0x3b')][_0xaf20('0x52')]));_0x215d75[_0xaf20('0x3e')]=_0x215d75['attributes']['length']?_0x215d75[_0xaf20('0x3e')]:_0x56c993['model'];if(_0x3ae41d[_0xaf20('0x3b')][_0xaf20('0x4b')]){_0x215d75[_0xaf20('0x4c')]=[{'all':!![]}];}_0x215d75=_[_0xaf20('0x47')]({},_0x215d75,_0x3ae41d[_0xaf20('0x49')]);return db[_0xaf20('0x4a')][_0xaf20('0x53')](_0x215d75)['then'](handleEntityNotFound(_0x2439e2,null))[_0xaf20('0x1a')](function(_0x3b68ac){if(_0x3b68ac){var _0x22b07b=_0x3b68ac['get']({'plain':!![]});_0x22b07b=qs[_0xaf20('0x55')](_0x22b07b,['id',_0xaf20('0x56'),'updatedAt']);_0x3ae41d[_0xaf20('0x57')]=_[_0xaf20('0x55')](_0x3ae41d[_0xaf20('0x57')],['id',_0xaf20('0x56'),_0xaf20('0x58')]);return db[_0xaf20('0x4a')]['create'](_['merge'](_0x22b07b,_0x3ae41d[_0xaf20('0x57')]),{'include':_0x3ae41d['query'][_0xaf20('0x4b')]?[{'all':!![]}]:undefined})[_0xaf20('0x1a')](function(_0x33a481){var _0x53a8db=_0x3ae41d['user'][_0xaf20('0x30')]({'plain':!![]});if(!_0x53a8db)throw new Error(_0xaf20('0x59'));if(_0x53a8db['role']===_0xaf20('0x5a')){var _0xe57991=_0x33a481[_0xaf20('0x30')]({'plain':!![]});var _0x24f5cf=_0xaf20('0x31');return db[_0xaf20('0x5b')][_0xaf20('0x53')]({'where':{'name':_0x24f5cf,'userProfileId':_0x53a8db['userProfileId']},'raw':!![]})[_0xaf20('0x1a')](function(_0x57ddc2){if(_0x57ddc2&&_0x57ddc2['autoAssociation']===0x0){return db[_0xaf20('0x32')][_0xaf20('0x5c')]({'name':_0xe57991['name'],'resourceId':_0xe57991['id'],'type':_0x57ddc2['name'],'sectionId':_0x57ddc2['id']},{})[_0xaf20('0x1a')](function(){return _0x33a481;});}else{return _0x33a481;}})[_0xaf20('0x24')](function(_0x3b4b6b){logger['error'](_0xaf20('0x5d'),_0x3b4b6b);throw _0x3b4b6b;});}return _0x33a481;});}})[_0xaf20('0x1a')](respondWithResult(_0x2439e2,0xc9))[_0xaf20('0x24')](handleError(_0x2439e2,null));};exports[_0xaf20('0x5c')]=function(_0x1fdfdb,_0xae1870,_0x515484){var _0x31359f;return db[_0xaf20('0x4a')][_0xaf20('0x5c')](_0x1fdfdb[_0xaf20('0x57')],{'raw':!![]})[_0xaf20('0x1a')](function(_0x5496f0){_0x31359f=_0x5496f0;return db[_0xaf20('0x4a')][_0xaf20('0x4d')]({'raw':!![]});})[_0xaf20('0x1a')](function(_0x15ed53){var _0x35e787=fs[_0xaf20('0x5e')](path[_0xaf20('0x5f')](config[_0xaf20('0x60')],_0xaf20('0x61')),_0xaf20('0x62'));var _0xc3883d=fs[_0xaf20('0x5e')](path['join'](config[_0xaf20('0x60')],_0xaf20('0x63')),_0xaf20('0x62'));var _0x116545=ejs[_0xaf20('0x64')](_0x35e787,{'trunks':_0x15ed53||[]});fs[_0xaf20('0x65')](_0xaf20('0x66'),_0x116545);if(_0x31359f[_0xaf20('0x67')]){var _0x3047e0=ejs[_0xaf20('0x64')](_0xc3883d,{'trunks':_0x15ed53||[]});fs[_0xaf20('0x65')](_0xaf20('0x68'),_0x3047e0);}})[_0xaf20('0x1a')](function(){return respondWithRpcPromise(_0xaf20('0x69'),_0xaf20('0x5c'),{'module':_0xaf20('0x6a')});})[_0xaf20('0x1a')](function(){var _0x1de592=_0x1fdfdb[_0xaf20('0x5a')]['get']({'plain':!![]});if(!_0x1de592)throw new Error(_0xaf20('0x59'));if(_0x1de592[_0xaf20('0x6b')]===_0xaf20('0x5a')){var _0x26ffcf=_0x31359f[_0xaf20('0x30')]({'plain':!![]});return db[_0xaf20('0x5b')][_0xaf20('0x53')]({'where':{'name':_0xaf20('0x31'),'userProfileId':_0x1de592[_0xaf20('0x6c')]},'raw':!![]})['then'](function(_0x119ae9){if(_0x119ae9&&_0x119ae9[_0xaf20('0x6d')]===0x0){return db['UserProfileResource']['create']({'name':_0x26ffcf[_0xaf20('0x35')],'resourceId':_0x26ffcf['id'],'type':_0x119ae9[_0xaf20('0x35')],'sectionId':_0x119ae9['id']},{})[_0xaf20('0x1a')](function(){return _0x31359f;});}else{return _0x31359f;}})[_0xaf20('0x24')](function(_0x3e433e){logger[_0xaf20('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e433e);throw _0x3e433e;});}return _0x31359f;})[_0xaf20('0x1a')](respondWithResult(_0xae1870,0xc9))[_0xaf20('0x24')](handleError(_0xae1870,null));};exports[_0xaf20('0x2f')]=function(_0x5f0ccc,_0x1f9ce,_0x58b0c1){var _0x2d8cc8;return db['Trunk']['find']({'where':{'id':_0x5f0ccc['params']['id']}})[_0xaf20('0x1a')](handleEntityNotFound(_0x1f9ce,null))[_0xaf20('0x1a')](saveUpdates(_0x5f0ccc[_0xaf20('0x57')],null))[_0xaf20('0x1a')](function(_0x52d91b){if(_0x52d91b){_0x2d8cc8=_0x52d91b;return db[_0xaf20('0x4a')][_0xaf20('0x4d')]({'raw':!![]});}})['then'](function(_0x80a673){if(_0x80a673){var _0x1dcea5=fs[_0xaf20('0x5e')](path['join'](config['root'],_0xaf20('0x61')),_0xaf20('0x62'));var _0x522a13=fs[_0xaf20('0x5e')](path[_0xaf20('0x5f')](config[_0xaf20('0x60')],_0xaf20('0x63')),_0xaf20('0x62'));var _0x3dfbe5=ejs['render'](_0x1dcea5,{'trunks':_0x80a673||[]});fs[_0xaf20('0x65')](_0xaf20('0x66'),_0x3dfbe5);var _0x4fd007=ejs[_0xaf20('0x64')](_0x522a13,{'trunks':_0x80a673||[]});fs[_0xaf20('0x65')](_0xaf20('0x68'),_0x4fd007);return respondWithRpcPromise(_0xaf20('0x69'),_0xaf20('0x2f'),{'module':_0xaf20('0x6a')});}return null;})[_0xaf20('0x1a')](function(_0x4c3177){if(_0x4c3177){return _0x2d8cc8;}})[_0xaf20('0x1a')](respondWithResult(_0x1f9ce,null))[_0xaf20('0x24')](handleError(_0x1f9ce,null));};exports[_0xaf20('0x33')]=function(_0x2a0646,_0x371e0d,_0x2a291d){var _0x5768ad;return db[_0xaf20('0x4a')][_0xaf20('0x53')]({'where':{'id':_0x2a0646[_0xaf20('0x50')]['id']}})[_0xaf20('0x1a')](handleEntityNotFound(_0x371e0d,null))[_0xaf20('0x1a')](removeEntity(_0x371e0d,null))[_0xaf20('0x1a')](function(){return db[_0xaf20('0x4a')]['findAll']({'raw':!![]});})[_0xaf20('0x1a')](function(_0x50c1f5){var _0x1a4c88=fs[_0xaf20('0x5e')](path[_0xaf20('0x5f')](config[_0xaf20('0x60')],_0xaf20('0x61')),'utf8');var _0x31c9fd=fs[_0xaf20('0x5e')](path['join'](config['root'],_0xaf20('0x63')),_0xaf20('0x62'));var _0x5aaab1=ejs[_0xaf20('0x64')](_0x1a4c88,{'trunks':_0x50c1f5});var _0x280757=ejs['render'](_0x31c9fd,{'trunks':_0x50c1f5});fs[_0xaf20('0x65')](_0xaf20('0x66'),_0x5aaab1);fs[_0xaf20('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x280757);return respondWithRpcPromise(_0xaf20('0x69'),_0xaf20('0x33'),{'module':_0xaf20('0x6a')});})[_0xaf20('0x24')](handleError(_0x371e0d,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b3b32c4..a6ac462 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 _0xf362=['define','tools_trunks','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf362,0x16a));var _0x2f36=function(_0x314cb6,_0x23bd92){_0x314cb6=_0x314cb6-0x0;var _0x411ebf=_0xf362[_0x314cb6];return _0x411ebf;};'use strict';var _=require(_0x2f36('0x0'));var util=require(_0x2f36('0x1'));var logger=require(_0x2f36('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2f36('0x3'));var rp=require(_0x2f36('0x4'));var fs=require('fs');var path=require(_0x2f36('0x5'));var rimraf=require('rimraf');var config=require(_0x2f36('0x6'));var attributes=require('./trunk.attributes');module[_0x2f36('0x7')]=function(_0x33171c,_0xf49615){return _0x33171c[_0x2f36('0x8')]('Trunk',attributes,{'tableName':_0x2f36('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb6=['tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x3e32b1,_0x487a75){var _0x419327=function(_0x6ad6a3){while(--_0x6ad6a3){_0x3e32b1['push'](_0x3e32b1['shift']());}};_0x419327(++_0x487a75);}(_0x7bb6,0x9d));var _0x67bb=function(_0xf94b75,_0x3cbe25){_0xf94b75=_0xf94b75-0x0;var _0x387fd7=_0x7bb6[_0xf94b75];return _0x387fd7;};'use strict';var _=require(_0x67bb('0x0'));var util=require(_0x67bb('0x1'));var logger=require(_0x67bb('0x2'))(_0x67bb('0x3'));var moment=require(_0x67bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x67bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x67bb('0x6'));var attributes=require(_0x67bb('0x7'));module[_0x67bb('0x8')]=function(_0x2cd500,_0x363e62){return _0x2cd500[_0x67bb('0x9')](_0x67bb('0xa'),attributes,{'tableName':_0x67bb('0xb'),'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 1da30bb..5177a4b 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','debug','stringify','ShowTrunk','find','lodash'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x66fa,0x117));var _0xa66f=function(_0x19f779,_0x4edfe4){_0x19f779=_0x19f779-0x0;var _0x272077=_0x66fa[_0x19f779];return _0x272077;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Trunk,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Trunk,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['GetTrunk']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')]({'raw':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x18')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'limit':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1a')]||null:null,'include':_0x1cbe64['options']?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0x1cbe64[_0xa66f('0x16')]['include'],function(_0x337602){return{'model':db[_0x337602[_0xa66f('0x1d')]],'as':_0x337602['as'],'attributes':_0x337602[_0xa66f('0x19')],'include':_0x337602[_0xa66f('0x1b')]?_['map'](_0x337602['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x19')],'include':_0xed98b9[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1d')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x17c103){logger[_0xa66f('0xc')](_0xa66f('0x1e'),_0x1cbe64);logger[_0xa66f('0x1f')](_0xa66f('0x1e'),_0x1cbe64,JSON[_0xa66f('0x20')](_0x17c103));_0x4a28d4(_0x17c103);})[_0xa66f('0x13')](function(_0x63650b){logger[_0xa66f('0xf')](_0xa66f('0x1e'),_0x63650b['message'],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x63650b[_0xa66f('0x12')]));});});};exports[_0xa66f('0x21')]=function(_0x55f309){var _0x44c79a=this;return new Promise(function(_0x2de5f3,_0x4cd7f2){return db[_0xa66f('0x14')][_0xa66f('0x22')]({'raw':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x55f309['options']?_0x55f309[_0xa66f('0x16')]['where']||null:null,'attributes':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'include':_0x55f309['options']?_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')]?_['map'](_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')],function(_0xba9457){return{'model':db[_0xba9457[_0xa66f('0x1d')]],'as':_0xba9457['as'],'attributes':_0xba9457[_0xa66f('0x19')],'include':_0xba9457[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xba9457[_0xa66f('0x1b')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1d')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1b')]?_['map'](_0x35ef27[_0xa66f('0x1b')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1d')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x201432){logger[_0xa66f('0xc')](_0xa66f('0x21'),_0x55f309);logger['debug'](_0xa66f('0x21'),_0x55f309,JSON['stringify'](_0x201432));_0x2de5f3(_0x201432);})[_0xa66f('0x13')](function(_0x45eeb8){logger[_0xa66f('0xf')]('ShowTrunk',_0x45eeb8['message'],_0x55f309);_0x4cd7f2(_0x44c79a[_0xa66f('0xf')](0x1f4,_0x45eeb8[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4a80f6,_0x3d43ad){_0x4a80f6=_0x4a80f6-0x0;var _0x5bc762=_0x5eb8[_0x4a80f6];return _0x5bc762;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a5adcc6..dcd22c4 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 _0xe8ec=['now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','update','changePassword','removeQueues','delete','/:id/teams','removeTeams','destroy','removeChatInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','addQueues','root','server/files/images/','%s-%s'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0xe8ec,0x172));var _0xce8e=function(_0xded08d,_0x23561c){_0xded08d=_0xded08d-0x0;var _0xc48e2a=_0xe8ec[_0xded08d];return _0xc48e2a;};'use strict';var multer=require(_0xce8e('0x0'));var util=require(_0xce8e('0x1'));var path=require(_0xce8e('0x2'));var timeout=require(_0xce8e('0x3'));var express=require(_0xce8e('0x4'));var router=express['Router']();var auth=require(_0xce8e('0x5'));var interaction=require(_0xce8e('0x6'));var config=require('../../config/environment');var controller=require(_0xce8e('0x7'));router[_0xce8e('0x8')]('/',auth[_0xce8e('0x9')](),controller[_0xce8e('0xa')]);router[_0xce8e('0x8')](_0xce8e('0xb'),auth['isAuthenticated'](),controller[_0xce8e('0xc')]);router[_0xce8e('0x8')](_0xce8e('0xd'),auth[_0xce8e('0x9')](),controller[_0xce8e('0xe')]);router[_0xce8e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xce8e('0x8')](_0xce8e('0xf'),controller[_0xce8e('0x10')]);router[_0xce8e('0x8')]('/:id/contacts',auth[_0xce8e('0x9')](),controller[_0xce8e('0x11')]);router[_0xce8e('0x8')](_0xce8e('0x12'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x13')]);router[_0xce8e('0x8')](_0xce8e('0x14'),auth['isAuthenticated'](),controller[_0xce8e('0x15')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0xce8e('0x16')]);router[_0xce8e('0x8')](_0xce8e('0x17'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x18')]);router[_0xce8e('0x8')](_0xce8e('0x19'),auth[_0xce8e('0x9')](),controller['getScreenRecordings']);router[_0xce8e('0x8')](_0xce8e('0x1a'),auth['isAuthenticated'](),controller[_0xce8e('0x1b')]);router[_0xce8e('0x8')]('/:id/openchannel/interactions',auth[_0xce8e('0x9')](),controller[_0xce8e('0x1c')]);router[_0xce8e('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xce8e('0x1d')]);router[_0xce8e('0x8')](_0xce8e('0x1e'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x1f')]);router[_0xce8e('0x8')](_0xce8e('0x20'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x21')]);router[_0xce8e('0x8')]('/:id/whatsapp/interactions',auth[_0xce8e('0x9')](),controller[_0xce8e('0x22')]);router[_0xce8e('0x8')]('/:id/teams',auth[_0xce8e('0x9')](),controller[_0xce8e('0x23')]);router[_0xce8e('0x8')]('/:id/lists',auth[_0xce8e('0x9')](),controller[_0xce8e('0x24')]);router['get'](_0xce8e('0x25'),auth[_0xce8e('0x9')](),controller['getAgents']);router[_0xce8e('0x8')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xce8e('0x26')]);router['get']('/:id/fax_accounts',auth[_0xce8e('0x9')](),controller[_0xce8e('0x27')]);router[_0xce8e('0x8')](_0xce8e('0x28'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x29')]);router[_0xce8e('0x8')](_0xce8e('0x2a'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x2b')]);router[_0xce8e('0x8')](_0xce8e('0x2c'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x2d')]);router[_0xce8e('0x8')]('/:id/chat_websites',auth[_0xce8e('0x9')](),controller['getChatWebsites']);router['get'](_0xce8e('0x2e'),auth['isAuthenticated'](),controller[_0xce8e('0x2f')]);router['get'](_0xce8e('0x30'),auth[_0xce8e('0x9')](),controller['getSquareProjects']);router['get'](_0xce8e('0x31'),auth[_0xce8e('0x9')](),controller['getScheduledCalls']);router[_0xce8e('0x8')](_0xce8e('0x32'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x33')]);router[_0xce8e('0x34')]('/:id/contacts',auth[_0xce8e('0x9')](),controller[_0xce8e('0x35')]);router[_0xce8e('0x34')]('/',auth['isAuthenticated'](),controller['create']);router[_0xce8e('0x34')]('/create_many',auth[_0xce8e('0x9')](),controller['bulkCreate']);router[_0xce8e('0x34')]('/:id/queues',auth['isAuthenticated'](),controller[_0xce8e('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48ed63,_0x1cef0c,_0xefc595){_0xefc595(null,path['join'](config[_0xce8e('0x37')],_0xce8e('0x38')));},'filename':function(_0xd7bbe4,_0x323256,_0x10f4e9){_0x10f4e9(null,util['format'](_0xce8e('0x39'),Date[_0xce8e('0x3a')](),_0x323256[_0xce8e('0x3b')]));}})});router[_0xce8e('0x34')](_0xce8e('0xf'),upload[_0xce8e('0x3c')](_0xce8e('0x3d')),controller[_0xce8e('0x3e')]);router[_0xce8e('0x34')](_0xce8e('0x3f'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x40')]);router[_0xce8e('0x34')](_0xce8e('0x41'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x42')]);router[_0xce8e('0x34')](_0xce8e('0x43'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x44')]);router[_0xce8e('0x34')](_0xce8e('0x45'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x46')]);router[_0xce8e('0x34')]('/:id/teams',auth[_0xce8e('0x9')](),controller[_0xce8e('0x47')]);router['post'](_0xce8e('0x48'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x49')]);router['post'](_0xce8e('0x4a'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x4b')]);router[_0xce8e('0x34')](_0xce8e('0x4c'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x4d')]);router[_0xce8e('0x34')]('/:id/sms_interactions',auth[_0xce8e('0x9')](),controller[_0xce8e('0x4e')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xce8e('0x4f')]);router[_0xce8e('0x34')]('/:id/whatsapp_interactions',auth[_0xce8e('0x9')](),controller[_0xce8e('0x50')]);router[_0xce8e('0x34')](_0xce8e('0x51'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x52')]);router[_0xce8e('0x34')](_0xce8e('0x28'),auth['isAuthenticated'](),controller[_0xce8e('0x53')]);router[_0xce8e('0x34')]('/:id/openchannel_accounts',auth[_0xce8e('0x9')](),controller[_0xce8e('0x54')]);router['post'](_0xce8e('0x2c'),auth[_0xce8e('0x9')](),controller['addSmsAccounts']);router[_0xce8e('0x34')](_0xce8e('0x55'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x56')]);router[_0xce8e('0x34')](_0xce8e('0x2e'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x57')]);router[_0xce8e('0x34')](_0xce8e('0x30'),auth[_0xce8e('0x9')](),controller['addSquareProjects']);router[_0xce8e('0x34')](_0xce8e('0x32'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x58')]);router[_0xce8e('0x59')](_0xce8e('0x5a'),auth['isAuthenticated'](),controller[_0xce8e('0x5b')]);router[_0xce8e('0x59')]('/:id/password',auth[_0xce8e('0x9')](),controller[_0xce8e('0x5c')]);router['delete']('/:id/queues',auth[_0xce8e('0x9')](),controller[_0xce8e('0x5d')]);router[_0xce8e('0x5e')](_0xce8e('0x5f'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x60')]);router[_0xce8e('0x5e')](_0xce8e('0x5a'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x61')]);router[_0xce8e('0x5e')]('/:id/chat_interactions',auth[_0xce8e('0x9')](),controller[_0xce8e('0x62')]);router[_0xce8e('0x5e')](_0xce8e('0x4a'),auth[_0xce8e('0x9')](),controller['removeMailInteractions']);router[_0xce8e('0x5e')](_0xce8e('0x4c'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xce8e('0x5e')]('/:id/sms_interactions',auth[_0xce8e('0x9')](),controller['removeSmsInteractions']);router[_0xce8e('0x5e')](_0xce8e('0x63'),auth[_0xce8e('0x9')](),controller['removeOpenchannelInteractions']);router['delete'](_0xce8e('0x64'),auth[_0xce8e('0x9')](),controller['removeWhatsappInteractions']);router[_0xce8e('0x5e')](_0xce8e('0x51'),auth[_0xce8e('0x9')](),controller['removeFaxAccounts']);router[_0xce8e('0x5e')](_0xce8e('0x28'),auth['isAuthenticated'](),controller[_0xce8e('0x65')]);router[_0xce8e('0x5e')](_0xce8e('0x2a'),auth[_0xce8e('0x9')](),controller['removeOpenchannelAccounts']);router[_0xce8e('0x5e')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xce8e('0x66')]);router[_0xce8e('0x5e')](_0xce8e('0x55'),auth['isAuthenticated'](),controller[_0xce8e('0x67')]);router[_0xce8e('0x5e')](_0xce8e('0x2e'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x68')]);router[_0xce8e('0x5e')](_0xce8e('0x30'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x69')]);router[_0xce8e('0x5e')](_0xce8e('0x32'),auth[_0xce8e('0x9')](),controller[_0xce8e('0x6a')]);module['exports']=router; \ No newline at end of file +var _0xcd13=['removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/:id','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','addContacts','post','create','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','/:id/mail_accounts'];(function(_0xf6f2f9,_0x434af3){var _0x58c5e9=function(_0x35b7df){while(--_0x35b7df){_0xf6f2f9['push'](_0xf6f2f9['shift']());}};_0x58c5e9(++_0x434af3);}(_0xcd13,0x15a));var _0x3cd1=function(_0x3ce734,_0x1eb87e){_0x3ce734=_0x3ce734-0x0;var _0x28fada=_0xcd13[_0x3ce734];return _0x28fada;};'use strict';var multer=require(_0x3cd1('0x0'));var util=require(_0x3cd1('0x1'));var path=require(_0x3cd1('0x2'));var timeout=require(_0x3cd1('0x3'));var express=require(_0x3cd1('0x4'));var router=express[_0x3cd1('0x5')]();var auth=require(_0x3cd1('0x6'));var interaction=require(_0x3cd1('0x7'));var config=require(_0x3cd1('0x8'));var controller=require(_0x3cd1('0x9'));router[_0x3cd1('0xa')]('/',auth[_0x3cd1('0xb')](),controller['index']);router['get']('/describe',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0xc')]);router[_0x3cd1('0xa')]('/whoami',auth[_0x3cd1('0xb')](),controller['whoami']);router[_0x3cd1('0xa')](_0x3cd1('0xd'),auth[_0x3cd1('0xb')](),controller['show']);router[_0x3cd1('0xa')]('/:id/avatar',controller[_0x3cd1('0xe')]);router[_0x3cd1('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x3cd1('0xf')]);router[_0x3cd1('0xa')](_0x3cd1('0x10'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x11')]);router[_0x3cd1('0xa')](_0x3cd1('0x12'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x13')]);router['get'](_0x3cd1('0x14'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x15')]);router[_0x3cd1('0xa')](_0x3cd1('0x16'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x17')]);router['get'](_0x3cd1('0x18'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x19')]);router[_0x3cd1('0xa')](_0x3cd1('0x1a'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x1b')]);router[_0x3cd1('0xa')](_0x3cd1('0x1c'),auth['isAuthenticated'](),controller[_0x3cd1('0x1d')]);router[_0x3cd1('0xa')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x3cd1('0x1e')]);router[_0x3cd1('0xa')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x3cd1('0x1f')]);router[_0x3cd1('0xa')]('/:id/fax/interactions',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x20')]);router[_0x3cd1('0xa')](_0x3cd1('0x21'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x3cd1('0xa')]('/:id/teams',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x22')]);router['get']('/:id/lists',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x23')]);router['get'](_0x3cd1('0x24'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x25')]);router['get'](_0x3cd1('0x26'),auth['isAuthenticated'](),controller[_0x3cd1('0x27')]);router[_0x3cd1('0xa')](_0x3cd1('0x28'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x29')]);router[_0x3cd1('0xa')]('/:id/mail_accounts',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x2a')]);router['get'](_0x3cd1('0x2b'),auth['isAuthenticated'](),controller[_0x3cd1('0x2c')]);router['get'](_0x3cd1('0x2d'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x3cd1('0xa')](_0x3cd1('0x2e'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x2f')]);router[_0x3cd1('0xa')](_0x3cd1('0x30'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x31')]);router[_0x3cd1('0xa')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x3cd1('0x32')]);router[_0x3cd1('0xa')](_0x3cd1('0x33'),auth['isAuthenticated'](),controller[_0x3cd1('0x34')]);router[_0x3cd1('0xa')](_0x3cd1('0x35'),auth['isAuthenticated'](),controller[_0x3cd1('0x36')]);router['post'](_0x3cd1('0x37'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x38')]);router[_0x3cd1('0x39')]('/',auth['isAuthenticated'](),controller[_0x3cd1('0x3a')]);router[_0x3cd1('0x39')]('/create_many',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x3b')]);router[_0x3cd1('0x39')]('/:id/queues',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x3c')]);var upload=multer({'storage':multer[_0x3cd1('0x3d')]({'destination':function(_0x34d8fb,_0x5559c6,_0x4a568a){_0x4a568a(null,path[_0x3cd1('0x3e')](config['root'],_0x3cd1('0x3f')));},'filename':function(_0x331b89,_0x26299d,_0x4a3527){_0x4a3527(null,util[_0x3cd1('0x40')](_0x3cd1('0x41'),Date[_0x3cd1('0x42')](),_0x26299d[_0x3cd1('0x43')]));}})});router[_0x3cd1('0x39')](_0x3cd1('0x44'),upload[_0x3cd1('0x45')](_0x3cd1('0x46')),controller[_0x3cd1('0x47')]);router[_0x3cd1('0x39')]('/:id/login',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x48')]);router[_0x3cd1('0x39')](_0x3cd1('0x49'),auth[_0x3cd1('0xb')](),controller['logout']);router['post'](_0x3cd1('0x4a'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x4b')]);router[_0x3cd1('0x39')](_0x3cd1('0x4c'),auth['isAuthenticated'](),controller[_0x3cd1('0x4d')]);router[_0x3cd1('0x39')]('/:id/teams',auth[_0x3cd1('0xb')](),controller['addTeams']);router['post'](_0x3cd1('0x4e'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x4f')]);router[_0x3cd1('0x39')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x3cd1('0x50')]);router[_0x3cd1('0x39')](_0x3cd1('0x51'),auth[_0x3cd1('0xb')](),controller['addFaxInteractions']);router['post'](_0x3cd1('0x52'),auth[_0x3cd1('0xb')](),controller['addSmsInteractions']);router['post'](_0x3cd1('0x53'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x54')]);router[_0x3cd1('0x39')](_0x3cd1('0x55'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x56')]);router[_0x3cd1('0x39')](_0x3cd1('0x28'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x57')]);router['post']('/:id/mail_accounts',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x58')]);router[_0x3cd1('0x39')](_0x3cd1('0x2b'),auth[_0x3cd1('0xb')](),controller['addOpenchannelAccounts']);router[_0x3cd1('0x39')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x3cd1('0x39')](_0x3cd1('0x2e'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x59')]);router[_0x3cd1('0x39')](_0x3cd1('0x30'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x5a')]);router[_0x3cd1('0x39')](_0x3cd1('0x5b'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x5c')]);router[_0x3cd1('0x39')]('/:id/api_key',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x5d')]);router[_0x3cd1('0x5e')](_0x3cd1('0xd'),auth[_0x3cd1('0xb')](),controller['update']);router[_0x3cd1('0x5e')](_0x3cd1('0x5f'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x60')]);router[_0x3cd1('0x61')](_0x3cd1('0x10'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x3cd1('0x61')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3cd1('0x62')]);router[_0x3cd1('0x61')](_0x3cd1('0xd'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x63')]);router[_0x3cd1('0x61')](_0x3cd1('0x4e'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x64')]);router['delete']('/:id/mail_interactions',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x65')]);router[_0x3cd1('0x61')](_0x3cd1('0x51'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x66')]);router[_0x3cd1('0x61')](_0x3cd1('0x52'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x67')]);router[_0x3cd1('0x61')](_0x3cd1('0x53'),auth[_0x3cd1('0xb')](),controller['removeOpenchannelInteractions']);router[_0x3cd1('0x61')]('/:id/whatsapp_interactions',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x68')]);router[_0x3cd1('0x61')](_0x3cd1('0x28'),auth[_0x3cd1('0xb')](),controller['removeFaxAccounts']);router[_0x3cd1('0x61')](_0x3cd1('0x69'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x6a')]);router['delete'](_0x3cd1('0x2b'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x6b')]);router[_0x3cd1('0x61')]('/:id/sms_accounts',auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x6c')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x3cd1('0x6d')]);router['delete'](_0x3cd1('0x30'),auth['isAuthenticated'](),controller[_0x3cd1('0x6e')]);router[_0x3cd1('0x61')](_0x3cd1('0x5b'),auth[_0x3cd1('0xb')](),controller[_0x3cd1('0x6f')]);router[_0x3cd1('0x61')]('/:id/api_key',auth[_0x3cd1('0xb')](),controller['removeApiKey']);module[_0x3cd1('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8268e6d..589d6c7 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 _0x77ac=['allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','isArray','udp','wss','encryption','avpf','force_avp','dtlsverify','dtlscertfile','rtcp_mux','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','email','toLowerCase','ENUM','telephone','local','internal','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','user','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x2316b9,_0x87059b){var _0x4405a9=function(_0xd9a3e1){while(--_0xd9a3e1){_0x2316b9['push'](_0x2316b9['shift']());}};_0x4405a9(++_0x87059b);}(_0x77ac,0x13f));var _0xc77a=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x77ac[_0x77d310];return _0x2cdce4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc77a('0x0'));var util=require('util');var _=require(_0xc77a('0x1'));module[_0xc77a('0x2')]={'name':{'type':Sequelize[_0xc77a('0x3')],'allowNull':![],'unique':_0xc77a('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3cec23){this[_0xc77a('0x5')](_0xc77a('0x4'),_0x3cec23);this['setDataValue'](_0xc77a('0x6'),_0x3cec23);},'comment':_0xc77a('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x28f8ed){this[_0xc77a('0x5')](_0xc77a('0x8'),_0x28f8ed);this['setDataValue'](_0xc77a('0x9'),util[_0xc77a('0xa')]('\x22%s\x22\x20<%s>',_0x28f8ed,this[_0xc77a('0xb')]('internal')));}},'alias':{'type':Sequelize[_0xc77a('0x3')]},'email':{'type':Sequelize[_0xc77a('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4039ae){if(_0x4039ae){this[_0xc77a('0x5')](_0xc77a('0xc'),_0x4039ae[_0xc77a('0xd')]());}}},'role':{'type':Sequelize[_0xc77a('0xe')]('admin','user','agent',_0xc77a('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xc77a('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc77a('0x3')],'defaultValue':_0xc77a('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xc77a('0x11'),'set':function(_0x226fbe){this['setDataValue']('internal',_0x226fbe);this[_0xc77a('0x5')](_0xc77a('0x12'),_0x226fbe);this[_0xc77a('0x5')](_0xc77a('0x9'),util[_0xc77a('0xa')](_0xc77a('0x13'),this[_0xc77a('0xb')](_0xc77a('0x8')),_0x226fbe));}},'salt':{'type':Sequelize[_0xc77a('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xc77a('0x3')]},'address':{'type':Sequelize[_0xc77a('0x3')]},'zipcode':{'type':Sequelize[_0xc77a('0x3')]},'userpic':{'type':Sequelize[_0xc77a('0x3')]},'city':{'type':Sequelize[_0xc77a('0x3')]},'country':{'type':Sequelize[_0xc77a('0x3')]},'online':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc77a('0x15')]},'voicePause':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc77a('0x3')],'defaultValue':_0xc77a('0x16')},'lastPauseAt':{'type':Sequelize[_0xc77a('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc77a('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![],'defaultValue':_0xc77a('0x18')},'ipaddr':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xc77a('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xc77a('0x19'),_0xc77a('0x1a')),'allowNull':!![],'defaultValue':_0xc77a('0x1b')},'context':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![],'defaultValue':_0xc77a('0x1c')},'callingpres':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x1d'),_0xc77a('0x1e'),_0xc77a('0x1f'),_0xc77a('0x20'),_0xc77a('0x21'),_0xc77a('0x22'),_0xc77a('0x23'),_0xc77a('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x221f6b){this[_0xc77a('0x5')]('transport',_0x221f6b?_0x221f6b['join'](','):null);},'get':function(){return this['getDataValue'](_0xc77a('0x25'))?this[_0xc77a('0xb')]('transport')[_0xc77a('0x26')](','):null;},'comment':_0xc77a('0x27')},'dtmfmode':{'type':Sequelize[_0xc77a('0xe')]('rfc2833',_0xc77a('0x28'),_0xc77a('0x29'),'inband',_0xc77a('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no',_0xc77a('0x2c'),_0xc77a('0x2d'),_0xc77a('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc77a('0x2f'),'set':function(_0x423d3e){this[_0xc77a('0x5')](_0xc77a('0x30'),_0x423d3e?_0x423d3e[_0xc77a('0x31')](','):null);},'get':function(){return this[_0xc77a('0xb')](_0xc77a('0x30'))?this[_0xc77a('0xb')](_0xc77a('0x30'))[_0xc77a('0x26')](','):null;},'comment':_0xc77a('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc77a('0x3')]},'pickupgroup':{'type':Sequelize[_0xc77a('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xc77a('0x3')]},'language':{'type':Sequelize[_0xc77a('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc77a('0x3')]},'disallow':{'type':Sequelize[_0xc77a('0x3')],'allowNull':![],'defaultValue':_0xc77a('0x33')},'allow':{'type':Sequelize[_0xc77a('0x3')],'allowNull':![],'defaultValue':_0xc77a('0x34'),'set':function(_0x141430){this[_0xc77a('0x5')](_0xc77a('0x35'),_0x141430?_0x141430[_0xc77a('0x31')](';'):_0xc77a('0x34'));},'get':function(){return this[_0xc77a('0xb')](_0xc77a('0x35'))?this[_0xc77a('0xb')]('allow')[_0xc77a('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x6718e5){this[_0xc77a('0x5')](_0xc77a('0x36'),_0x6718e5?_0x6718e5[_0xc77a('0x31')](','):null);},'get':function(){return this['getDataValue'](_0xc77a('0x36'))?this[_0xc77a('0xb')](_0xc77a('0x36'))[_0xc77a('0x26')](','):null;},'comment':_0xc77a('0x37')},'trustrpid':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc77a('0x2b'),'no',_0xc77a('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xc77a('0x2b')},'busylevel':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc77a('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no',_0xc77a('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc77a('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x3a'),_0xc77a('0x3b'),_0xc77a('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x3d'),_0xc77a('0x3e')),'allowNull':!![],'defaultValue':_0xc77a('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xc77a('0x2b')},'keepalive':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xc77a('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc77a('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc77a('0xe')]('yes','no','fingerprint',_0xc77a('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc77a('0xe')]('active',_0xc77a('0x40'),_0xc77a('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc77a('0xe')](_0xc77a('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc77a('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc77a('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xc77a('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc77a('0xe')]('yes','no',_0xc77a('0x2c'),_0xc77a('0x2d'),_0xc77a('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc77a('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xc77a('0x15')]},'passwordResetAt':{'type':Sequelize[_0xc77a('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x0,'set':function(_0x11a40e){this[_0xc77a('0x5')]('showWebBar',_0x11a40e);var _0x21544f=this['get']({'plain':!![]});switch(_0x11a40e){case 0x0:case 0x1:var _0x1976f8=_0x21544f[_0xc77a('0x25')]?_[_0xc77a('0x43')](_0x21544f[_0xc77a('0x25')])?_0x21544f[_0xc77a('0x25')][_0xc77a('0x31')]():_0x21544f['transport']:_0xc77a('0x44');if(_0x1976f8===_0xc77a('0x45')){_0x1976f8='udp';}this['setDataValue']('transport',_0x1976f8);this[_0xc77a('0x5')](_0xc77a('0x46'),'no');this[_0xc77a('0x5')](_0xc77a('0x47'),null);this[_0xc77a('0x5')](_0xc77a('0x48'),null);this[_0xc77a('0x5')]('icesupport',null);this[_0xc77a('0x5')]('dtlsenable',null);this[_0xc77a('0x5')](_0xc77a('0x49'),null);this['setDataValue']('dtlssetup',null);this[_0xc77a('0x5')](_0xc77a('0x4a'),null);this[_0xc77a('0x5')]('dtlsprivatekey',null);this[_0xc77a('0x5')](_0xc77a('0x4b'),'no');break;case 0x2:this['setDataValue'](_0xc77a('0x25'),_0xc77a('0x45'));this['setDataValue'](_0xc77a('0x46'),_0xc77a('0x2b'));this['setDataValue'](_0xc77a('0x47'),'yes');this[_0xc77a('0x5')]('force_avp','yes');this[_0xc77a('0x5')](_0xc77a('0x4c'),_0xc77a('0x2b'));this[_0xc77a('0x5')]('dtlsenable',_0xc77a('0x2b'));this[_0xc77a('0x5')](_0xc77a('0x49'),'no');this[_0xc77a('0x5')](_0xc77a('0x4d'),'actpass');this['setDataValue'](_0xc77a('0x4a'),_0x21544f['dtlscertfile']||_0xc77a('0x4e'));this[_0xc77a('0x5')](_0xc77a('0x4f'),_0x21544f[_0xc77a('0x4f')]||_0xc77a('0x50'));this[_0xc77a('0x5')](_0xc77a('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xc77a('0x51')],'set':function(_0x52d342){this[_0xc77a('0x5')](_0xc77a('0x52'),_0x52d342?_0x52d342[_0xc77a('0x31')](','):[]);},'get':function(){return this[_0xc77a('0xb')](_0xc77a('0x52'))?_[_0xc77a('0x53')](this['getDataValue'](_0xc77a('0x52'))['split'](','),function(_0x175f49){return parseInt(_0x175f49,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xc77a('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc77a('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc77a('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc77a('0x54')],'get':function(){return this[_0xc77a('0xb')](_0xc77a('0x55'))?this[_0xc77a('0xb')](_0xc77a('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc77a('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc77a('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![],'set':function(_0x554817){if(typeof _0x554817===_0xc77a('0x56')){var _0x27ed57=_0x554817==='1'?!![]:_0x554817==='0'?![]:_0x554817===_0xc77a('0x57')?!![]:_0x554817===_0xc77a('0x58')?![]:![];this[_0xc77a('0x5')]('screenrecording',_0x27ed57);}else{this[_0xc77a('0x5')](_0xc77a('0x59'),_0x554817);}}},'blocked':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![],'set':function(_0x2235c1){this['setDataValue'](_0xc77a('0x5a'),_0x2235c1);if(_0x2235c1===!![]){this['setDataValue'](_0xc77a('0x5b'),moment());this['setDataValue'](_0xc77a('0x5c'),0x0);}else{this[_0xc77a('0x5')](_0xc77a('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0xc77a('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc77a('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc77a('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0cba=['telephone','local','INTEGER','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','info','shortinfo','inband','rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','originate','uas','fingerprint','certificate','active','passive','update,nonat','showWebBar','get','udp','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','avpf','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x0cba,0xa0));var _0xa0cb=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0x0cba[_0x51b80a];return _0x22fdf0;};'use strict';var Sequelize=require(_0xa0cb('0x0'));var moment=require(_0xa0cb('0x1'));var util=require(_0xa0cb('0x2'));var _=require(_0xa0cb('0x3'));module['exports']={'name':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':![],'unique':_0xa0cb('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b1eef){this[_0xa0cb('0x6')](_0xa0cb('0x5'),_0x5b1eef);this[_0xa0cb('0x6')](_0xa0cb('0x7'),_0x5b1eef);},'comment':_0xa0cb('0x8')},'fullname':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':![],'set':function(_0x57533a){this['setDataValue'](_0xa0cb('0x9'),_0x57533a);this[_0xa0cb('0x6')](_0xa0cb('0xa'),util['format'](_0xa0cb('0xb'),_0x57533a,this[_0xa0cb('0xc')](_0xa0cb('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':![],'unique':_0xa0cb('0xe'),'validate':{'isEmail':!![]},'set':function(_0x18378a){if(_0x18378a){this[_0xa0cb('0x6')](_0xa0cb('0xe'),_0x18378a[_0xa0cb('0xf')]());}}},'role':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x11'),_0xa0cb('0x12'),_0xa0cb('0x13'),_0xa0cb('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xa0cb('0x15')},'internal':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':![],'unique':_0xa0cb('0xd'),'set':function(_0x2d0b26){this[_0xa0cb('0x6')](_0xa0cb('0xd'),_0x2d0b26);this['setDataValue']('accountcode',_0x2d0b26);this[_0xa0cb('0x6')](_0xa0cb('0xa'),util[_0xa0cb('0x17')](_0xa0cb('0xb'),this['getDataValue'](_0xa0cb('0x9')),_0x2d0b26));}},'salt':{'type':Sequelize[_0xa0cb('0x4')]},'phone':{'type':Sequelize[_0xa0cb('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xa0cb('0x4')]},'zipcode':{'type':Sequelize[_0xa0cb('0x4')]},'userpic':{'type':Sequelize[_0xa0cb('0x4')]},'city':{'type':Sequelize[_0xa0cb('0x4')]},'country':{'type':Sequelize[_0xa0cb('0x4')]},'online':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa0cb('0x19')]},'voicePause':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xa0cb('0x1a')},'lastPauseAt':{'type':Sequelize[_0xa0cb('0x19')]},'chatCapacity':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'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[_0xa0cb('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x1b'),_0xa0cb('0x12'),_0xa0cb('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x1d'),_0xa0cb('0x1e'),_0xa0cb('0x1f'),'ALLOWED',_0xa0cb('0x20'),_0xa0cb('0x21'),_0xa0cb('0x22'),_0xa0cb('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x4696f2){this['setDataValue'](_0xa0cb('0x24'),_0x4696f2?_0x4696f2[_0xa0cb('0x25')](','):null);},'get':function(){return this[_0xa0cb('0xc')](_0xa0cb('0x24'))?this[_0xa0cb('0xc')](_0xa0cb('0x24'))[_0xa0cb('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa0cb('0x10')]('rfc2833',_0xa0cb('0x27'),_0xa0cb('0x28'),_0xa0cb('0x29'),'auto'),'allowNull':!![],'defaultValue':_0xa0cb('0x2a')},'directmedia':{'type':Sequelize['ENUM'](_0xa0cb('0x2b'),'no',_0xa0cb('0x2c'),_0xa0cb('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![],'defaultValue':_0xa0cb('0x2e'),'set':function(_0x2e48d8){this['setDataValue'](_0xa0cb('0x2f'),_0x2e48d8?_0x2e48d8['join'](','):null);},'get':function(){return this[_0xa0cb('0xc')](_0xa0cb('0x2f'))?this[_0xa0cb('0xc')](_0xa0cb('0x2f'))[_0xa0cb('0x26')](','):null;},'comment':_0xa0cb('0x30')},'callgroup':{'type':Sequelize[_0xa0cb('0x4')]},'namedcallgroup':{'type':Sequelize[_0xa0cb('0x4')]},'pickupgroup':{'type':Sequelize[_0xa0cb('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xa0cb('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa0cb('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4f2cfe){this['setDataValue'](_0xa0cb('0x31'),_0x4f2cfe?_0x4f2cfe['join'](';'):_0xa0cb('0x32'));},'get':function(){return this[_0xa0cb('0xc')](_0xa0cb('0x31'))?this[_0xa0cb('0xc')](_0xa0cb('0x31'))['split'](';'):null;},'comment':_0xa0cb('0x33')},'autoframing':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![],'set':function(_0x321516){this[_0xa0cb('0x6')](_0xa0cb('0x34'),_0x321516?_0x321516[_0xa0cb('0x25')](','):null);},'get':function(){return this[_0xa0cb('0xc')]('insecure')?this[_0xa0cb('0xc')](_0xa0cb('0x34'))[_0xa0cb('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no',_0xa0cb('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![],'defaultValue':_0xa0cb('0x36')},'amaflags':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xa0cb('0x2b')},'busylevel':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa0cb('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa0cb('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no',_0xa0cb('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xa0cb('0x38'),'refuse',_0xa0cb('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa0cb('0x10')]('uac',_0xa0cb('0x3a')),'allowNull':!![],'defaultValue':_0xa0cb('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xa0cb('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa0cb('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no',_0xa0cb('0x3b'),_0xa0cb('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa0cb('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x3d'),_0xa0cb('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xa0cb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xa0cb('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0xa0cb('0x2d'),_0xa0cb('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xa0cb('0x19')]},'passwordResetAt':{'type':Sequelize[_0xa0cb('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa0cb('0x4')]},'showWebBar':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0,'set':function(_0x51265e){this[_0xa0cb('0x6')](_0xa0cb('0x40'),_0x51265e);var _0x45335b=this[_0xa0cb('0x41')]({'plain':!![]});switch(_0x51265e){case 0x0:case 0x1:var _0x18d135=_0x45335b[_0xa0cb('0x24')]?_['isArray'](_0x45335b[_0xa0cb('0x24')])?_0x45335b[_0xa0cb('0x24')][_0xa0cb('0x25')]():_0x45335b[_0xa0cb('0x24')]:_0xa0cb('0x42');if(_0x18d135==='wss'){_0x18d135='udp';}this[_0xa0cb('0x6')]('transport',_0x18d135);this[_0xa0cb('0x6')](_0xa0cb('0x43'),'no');this[_0xa0cb('0x6')]('avpf',null);this[_0xa0cb('0x6')](_0xa0cb('0x44'),null);this[_0xa0cb('0x6')](_0xa0cb('0x45'),null);this[_0xa0cb('0x6')](_0xa0cb('0x46'),null);this[_0xa0cb('0x6')](_0xa0cb('0x47'),null);this['setDataValue']('dtlssetup',null);this[_0xa0cb('0x6')](_0xa0cb('0x48'),null);this[_0xa0cb('0x6')](_0xa0cb('0x49'),null);this['setDataValue'](_0xa0cb('0x4a'),'no');break;case 0x2:this['setDataValue'](_0xa0cb('0x24'),_0xa0cb('0x4b'));this[_0xa0cb('0x6')](_0xa0cb('0x43'),_0xa0cb('0x2b'));this[_0xa0cb('0x6')](_0xa0cb('0x4c'),_0xa0cb('0x2b'));this[_0xa0cb('0x6')](_0xa0cb('0x44'),_0xa0cb('0x2b'));this[_0xa0cb('0x6')](_0xa0cb('0x45'),_0xa0cb('0x2b'));this[_0xa0cb('0x6')]('dtlsenable',_0xa0cb('0x2b'));this[_0xa0cb('0x6')]('dtlsverify','no');this['setDataValue'](_0xa0cb('0x4d'),_0xa0cb('0x4e'));this['setDataValue'](_0xa0cb('0x48'),_0x45335b[_0xa0cb('0x48')]||_0xa0cb('0x4f'));this[_0xa0cb('0x6')](_0xa0cb('0x49'),_0x45335b[_0xa0cb('0x49')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xa0cb('0x4a'),_0xa0cb('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xa0cb('0x50')],'set':function(_0x5d1aea){this[_0xa0cb('0x6')](_0xa0cb('0x51'),_0x5d1aea?_0x5d1aea[_0xa0cb('0x25')](','):[]);},'get':function(){return this[_0xa0cb('0xc')](_0xa0cb('0x51'))?_['map'](this[_0xa0cb('0xc')]('permissions')[_0xa0cb('0x26')](','),function(_0x2ee817){return parseInt(_0x2ee817,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa0cb('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa0cb('0x10')](_0xa0cb('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa0cb('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa0cb('0xc')](_0xa0cb('0x52'))?this[_0xa0cb('0xc')](_0xa0cb('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa0cb('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa0cb('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![],'set':function(_0x320b15){if(typeof _0x320b15===_0xa0cb('0x53')){var _0x12f206=_0x320b15==='1'?!![]:_0x320b15==='0'?![]:_0x320b15===_0xa0cb('0x54')?!![]:_0x320b15===_0xa0cb('0x55')?![]:![];this['setDataValue'](_0xa0cb('0x56'),_0x12f206);}else{this['setDataValue'](_0xa0cb('0x56'),_0x320b15);}}},'blocked':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![],'set':function(_0x3ae7f3){this[_0xa0cb('0x6')](_0xa0cb('0x57'),_0x3ae7f3);if(_0x3ae7f3===!![]){this[_0xa0cb('0x6')](_0xa0cb('0x58'),moment());this['setDataValue'](_0xa0cb('0x59'),0x0);}else{this['setDataValue'](_0xa0cb('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xa0cb('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa0cb('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa0cb('0x18')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index fd467b7..e7a2f83 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 _0x41d9=['ignore','map','value','includes','find','name','UserProfileResource','stack','send','User','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','sequelize','lower','col','includeAll','findAll','rows','show','params','keys','filters','length','include','update','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','email','agent','permissions','101','103','113','110','104','105','107','108','109','100','111','114','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','all','push','each','userProfileId','changePassword','Sequelize','ValidationError','authenticate','oldPassword','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','channel','voicePause','interface','add','capitalize','Queues','penalty','QueueId','Queue:save','voice','online','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','toLowerCase','Queue:remove','addAvatar','file','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','server/files/images/','download','getContacts','options','CmList','Tag','Tags','color','tag','getQueues','isValidChannel','Queue','getVoiceQueuesRt','pick','getGroups','ChatGroup','VoiceRecording','UserId','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','emit','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','getVoiceQueues','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getOpenchannelQueues','flatten','transaction','getDataValue','removeTeams','getFaxQueues','Fax','Openchannel','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./user.socket','register','jayson/promise','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','get','role','admin','Agents','Telephones','telephone','filter'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x941d('0x0'));var emlformat=require(_0x941d('0x1'));var rimraf=require(_0x941d('0x2'));var zipdir=require(_0x941d('0x3'));var jsonpatch=require(_0x941d('0x4'));var rp=require(_0x941d('0x5'));var moment=require(_0x941d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x941d('0x7'));var util=require(_0x941d('0x8'));var path=require('path');var sox=require(_0x941d('0x9'));var csv=require(_0x941d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x941d('0xb'));var squel=require('squel');var crypto=require(_0x941d('0xc'));var jsforce=require(_0x941d('0xd'));var deskjs=require(_0x941d('0xe'));var toCsv=require(_0x941d('0xa'));var querystring=require(_0x941d('0xf'));var Papa=require('papaparse');var Redis=require(_0x941d('0x10'));var authService=require(_0x941d('0x11'));var qs=require(_0x941d('0x12'));var as=require(_0x941d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x941d('0x14'))(_0x941d('0x15'));var utils=require(_0x941d('0x16'));var config=require(_0x941d('0x17'));var licenseUtil=require(_0x941d('0x18'));var db=require(_0x941d('0x19'))['db'];config['redis']=_[_0x941d('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x941d('0x1b'))(new Redis(config[_0x941d('0x1c')]));require(_0x941d('0x1d'))[_0x941d('0x1e')](socket);var jayson=require(_0x941d('0x1f'));var client=jayson[_0x941d('0x20')][_0x941d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x45d85d,_0x369b0b,_0x1f1aeb,_0x7df80e){return new BPromise(function(_0x50c8b6,_0x1e1140){var _0x244d96=_0x7df80e||client;return _0x244d96[_0x941d('0x22')](_0x45d85d,_0x1f1aeb)[_0x941d('0x23')](function(_0x20845a){logger[_0x941d('0x24')](_0x941d('0x25'),_0x369b0b,_0x941d('0x26'));logger[_0x941d('0x27')]('User,\x20%s,\x20%s,\x20%s',_0x369b0b,_0x941d('0x26'),JSON['stringify'](_0x20845a));if(_0x20845a[_0x941d('0x28')]){if(_0x20845a[_0x941d('0x28')]['code']===0x1f4){logger[_0x941d('0x28')]('User,\x20%s,\x20%s',_0x369b0b,_0x20845a['error'][_0x941d('0x29')]);return _0x1e1140(_0x20845a[_0x941d('0x28')][_0x941d('0x29')]);}logger['error'](_0x941d('0x25'),_0x369b0b,_0x20845a[_0x941d('0x28')][_0x941d('0x29')]);return _0x50c8b6(_0x20845a['error']['message']);}else{logger[_0x941d('0x24')](_0x941d('0x25'),_0x369b0b,_0x941d('0x26'));_0x50c8b6(_0x20845a[_0x941d('0x2a')][_0x941d('0x29')]);}})[_0x941d('0x2b')](function(_0x572190){logger[_0x941d('0x28')](_0x941d('0x25'),_0x369b0b,_0x572190);_0x1e1140(_0x572190);});});}function respondWithStatusCode(_0x11c2c9,_0x48baff){_0x48baff=_0x48baff||0xcc;return function(_0x1ecde8){if(_0x1ecde8){return _0x11c2c9[_0x941d('0x2c')](_0x48baff);}return _0x11c2c9[_0x941d('0x2d')](_0x48baff)[_0x941d('0x2e')]();};}function respondWithResult(_0x26a4b4,_0x213052){_0x213052=_0x213052||0xc8;return function(_0x1a3dc2){if(_0x1a3dc2){return _0x26a4b4[_0x941d('0x2d')](_0x213052)[_0x941d('0x2f')](_0x1a3dc2);}};}function respondWithFilteredResult(_0x145991,_0x2f38c8){return function(_0x1cacc4){if(_0x1cacc4){var _0x4cf929=_0x1cacc4[_0x941d('0x30')],_0x30615a=_0x2f38c8[_0x941d('0x31')],_0x42050d=_0x2f38c8[_0x941d('0x31')]+_0x2f38c8[_0x941d('0x32')],_0x5908c3;if(_0x42050d>=_0x4cf929){_0x42050d=_0x4cf929;_0x5908c3=0xc8;}else{_0x5908c3=0xce;}_0x145991[_0x941d('0x2d')](_0x5908c3);return _0x145991[_0x941d('0x33')](_0x941d('0x34'),_0x30615a+'-'+_0x42050d+'/'+_0x4cf929)['json'](_0x1cacc4);}return null;};}function patchUpdates(_0x59297e){return function(_0x40694a){try{jsonpatch[_0x941d('0x35')](_0x40694a,_0x59297e,!![]);}catch(_0x11f0b5){return BPromise['reject'](_0x11f0b5);}return _0x40694a['save']();};}function saveUpdates(_0x227a9a,_0x42a8d7){return function(_0x150e14){if(_0x150e14){return _0x150e14['update'](_0x227a9a)[_0x941d('0x23')](function(_0x42650e){return _0x42650e;});}return null;};}function removeEntity(_0x46cac6,_0x1b6956){return function(_0x4aea48){if(_0x4aea48){return _0x4aea48[_0x941d('0x36')]()[_0x941d('0x23')](function(){var _0xa369f2=_0x4aea48[_0x941d('0x37')]({'plain':!![]});if(_0xa369f2[_0x941d('0x38')]===_0x941d('0x39'))return;var _0x4bbbb2=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x941d('0x3a'),'value':'agent','ignore':![]},{'name':_0x941d('0x3b'),'value':_0x941d('0x3c'),'ignore':![]}];var _0x1503c5=_(_0x4bbbb2)[_0x941d('0x3d')](_0x941d('0x3e'))[_0x941d('0x3f')](_0x941d('0x40'))[_0x941d('0x40')]();if(_[_0x941d('0x41')](_0x1503c5,_0xa369f2[_0x941d('0x38')])){return;}var _0x4b9efd=_[_0x941d('0x42')](_0x4bbbb2,[_0x941d('0x40'),_0xa369f2[_0x941d('0x38')]])[_0x941d('0x43')];return db[_0x941d('0x44')][_0x941d('0x36')]({'where':{'type':_0x4b9efd,'resourceId':_0xa369f2['id']}})[_0x941d('0x23')](function(){return _0x4aea48;});})[_0x941d('0x23')](function(){_0x46cac6[_0x941d('0x2d')](0xcc)[_0x941d('0x2e')]();});}};}function handleEntityNotFound(_0x37b04c,_0x3a018d){return function(_0x1401d4){if(!_0x1401d4){_0x37b04c['sendStatus'](0x194);}return _0x1401d4;};}function handleError(_0x509653,_0x26d256){_0x26d256=_0x26d256||0x1f4;return function(_0x3fb8ae){logger['error'](_0x3fb8ae[_0x941d('0x45')]);if(_0x3fb8ae['name']){delete _0x3fb8ae[_0x941d('0x43')];}_0x509653['status'](_0x26d256)[_0x941d('0x46')](_0x3fb8ae);};}exports['index']=function(_0x2a0a21,_0x31c350){var _0x34a217={},_0x2dc0aa={},_0x185d7b={'count':0x0,'rows':[]};var _0x567725=_['map'](db[_0x941d('0x47')][_0x941d('0x48')],function(_0x300c7d){return{'name':_0x300c7d[_0x941d('0x49')],'type':_0x300c7d[_0x941d('0x4a')][_0x941d('0x4b')]};});_0x2dc0aa[_0x941d('0x4c')]=_[_0x941d('0x4d')](_[_0x941d('0x3f')](_0x567725,_0x941d('0x43')),[_0x941d('0x4e'),_0x941d('0x4f')]);_0x2dc0aa[_0x941d('0x50')]=_['keys'](_0x2a0a21[_0x941d('0x50')]);_0x2dc0aa['filters']=_[_0x941d('0x51')](_0x2dc0aa['model'],_0x2dc0aa['query']);_0x34a217['attributes']=_['intersection'](_0x2dc0aa[_0x941d('0x4c')],qs[_0x941d('0x52')](_0x2a0a21['query'][_0x941d('0x52')]));_0x34a217[_0x941d('0x53')]=_0x34a217[_0x941d('0x53')]['length']?_0x34a217['attributes']:_0x2dc0aa[_0x941d('0x4c')];if(!_0x2a0a21[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x34a217['limit']=qs[_0x941d('0x32')](_0x2a0a21['query']['limit']);_0x34a217['offset']=qs[_0x941d('0x31')](_0x2a0a21[_0x941d('0x50')][_0x941d('0x31')]);}_0x34a217[_0x941d('0x56')]=qs['sort'](_0x2a0a21[_0x941d('0x50')][_0x941d('0x57')]);_0x34a217[_0x941d('0x58')]=qs['filters'](_['pick'](_0x2a0a21[_0x941d('0x50')],_0x2dc0aa['filters']),_0x567725);if(_0x2a0a21[_0x941d('0x50')][_0x941d('0x3d')]){_0x34a217[_0x941d('0x58')]=_[_0x941d('0x59')](_0x34a217[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x567725,function(_0x307d37){if(_0x307d37[_0x941d('0x4a')]!==_0x941d('0x5a')){return db[_0x941d('0x5b')][_0x941d('0x58')](db[_0x941d('0x5b')]['fn'](_0x941d('0x5c'),db[_0x941d('0x5b')][_0x941d('0x5d')](_0x307d37[_0x941d('0x43')])),{'$like':db[_0x941d('0x5b')]['fn']('lower','%'+_0x2a0a21[_0x941d('0x50')][_0x941d('0x3d')]+'%')});}})});}_0x34a217=_[_0x941d('0x59')]({},_0x34a217,_0x2a0a21['options']);var _0x5de4b8={'where':_0x34a217[_0x941d('0x58')]};return db['User']['count'](_0x5de4b8)[_0x941d('0x23')](function(_0x3625ab){_0x185d7b[_0x941d('0x30')]=_0x3625ab;if(_0x2a0a21[_0x941d('0x50')][_0x941d('0x5e')]){_0x34a217['include']=[{'all':!![]}];}return db['User'][_0x941d('0x5f')](_0x34a217);})[_0x941d('0x23')](function(_0x190ffe){_0x185d7b[_0x941d('0x60')]=_0x190ffe;return _0x185d7b;})[_0x941d('0x23')](respondWithFilteredResult(_0x31c350,_0x34a217))[_0x941d('0x2b')](handleError(_0x31c350,null));};exports[_0x941d('0x61')]=function(_0x254ec4,_0x16fcd9){var _0x113f2c={'raw':![],'where':{'id':_0x254ec4[_0x941d('0x62')]['id']}},_0x671f00={};_0x671f00[_0x941d('0x4c')]=_['differenceBy'](_[_0x941d('0x63')](db[_0x941d('0x47')][_0x941d('0x48')]),[_0x941d('0x4e'),_0x941d('0x4f')]);_0x671f00[_0x941d('0x50')]=_[_0x941d('0x63')](_0x254ec4[_0x941d('0x50')]);_0x671f00[_0x941d('0x64')]=_[_0x941d('0x51')](_0x671f00[_0x941d('0x4c')],_0x671f00[_0x941d('0x50')]);_0x113f2c[_0x941d('0x53')]=_[_0x941d('0x51')](_0x671f00[_0x941d('0x4c')],qs[_0x941d('0x52')](_0x254ec4['query'][_0x941d('0x52')]));_0x113f2c[_0x941d('0x53')]=_0x113f2c['attributes'][_0x941d('0x65')]?_0x113f2c['attributes']:_0x671f00[_0x941d('0x4c')];if(_0x254ec4[_0x941d('0x50')][_0x941d('0x5e')]){_0x113f2c[_0x941d('0x66')]=[{'all':!![]}];}_0x113f2c=_[_0x941d('0x59')]({},_0x113f2c,_0x254ec4['options']);return db['User']['find'](_0x113f2c)['then'](handleEntityNotFound(_0x16fcd9,null))[_0x941d('0x23')](respondWithResult(_0x16fcd9,null))[_0x941d('0x2b')](handleError(_0x16fcd9,null));};exports[_0x941d('0x67')]=function(_0xd2788c,_0x30d1e3){if(_0xd2788c['body']['id']){delete _0xd2788c['body']['id'];}delete _0xd2788c['body'][_0x941d('0x38')];return db['User'][_0x941d('0x42')]({'where':{'id':_0xd2788c[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x30d1e3,null))['then'](saveUpdates(_0xd2788c[_0x941d('0x68')],null))[_0x941d('0x23')](respondWithResult(_0x30d1e3,null))['catch'](handleError(_0x30d1e3,null));};exports['describe']=function(_0x4d1f1c,_0x20d0ab){return db[_0x941d('0x47')][_0x941d('0x69')]()[_0x941d('0x23')](respondWithResult(_0x20d0ab,null))[_0x941d('0x2b')](handleError(_0x20d0ab,null));};exports[_0x941d('0x6a')]=function(_0x15f886,_0x4ef634,_0x10afd4){return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x15f886['params']['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x4ef634,null))[_0x941d('0x23')](function(_0x14180d){if(_0x14180d){return _0x14180d[_0x941d('0x6a')](_0x15f886[_0x941d('0x68')][_0x941d('0x6b')],_[_0x941d('0x6c')](_0x15f886[_0x941d('0x68')],[_0x941d('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4ef634,null))['catch'](handleError(_0x4ef634,null));};function validateUser(_0xb2a443){return new BPromise(function(_0x1517f8,_0x26afcc){if(_0xb2a443[_0x941d('0x6d')])return _0x1517f8(_0xb2a443);return db[_0x941d('0x6e')][_0x941d('0x6f')](0x1)['then'](function(_0x1baf10){if(_0x1baf10[_0x941d('0x70')])authService[_0x941d('0x71')](_0xb2a443[_0x941d('0x4e')]);db[_0x941d('0x47')]['max'](_0x941d('0x6d'))['then'](function(_0x153ae8){if(_[_0x941d('0x72')](_0x153ae8)){_0xb2a443[_0x941d('0x6d')]=_0x1baf10[_0x941d('0x73')]||0x1;return;}if(_[_0x941d('0x72')](_0x1baf10[_0x941d('0x73')])||_0x1baf10[_0x941d('0x73')]===_0x153ae8){_0xb2a443[_0x941d('0x6d')]=_0x153ae8+0x1;return;}if(_0x1baf10[_0x941d('0x73')]>_0x153ae8){_0xb2a443['internal']=_0x1baf10[_0x941d('0x73')];return;}return db[_0x941d('0x5b')]['query'](_0x941d('0x74'),{'type':db[_0x941d('0x5b')][_0x941d('0x75')]['SELECT']})[_0x941d('0x23')](function(_0x3ffc4d){if(_0x3ffc4d&&_0x3ffc4d['length']){for(var _0x2a2743=0x0,_0x1515d3=_0x3ffc4d['length'];_0x2a2743<_0x1515d3&&_['isNil'](_0xb2a443['internal']);_0x2a2743++){if(_0x1baf10[_0x941d('0x73')]<=_0x3ffc4d[_0x2a2743]['from']){_0xb2a443[_0x941d('0x6d')]=_0x3ffc4d[_0x2a2743][_0x941d('0x76')];}else if(_0x1baf10[_0x941d('0x73')]>_0x3ffc4d[_0x2a2743]['from']&&_0x1baf10[_0x941d('0x73')]<=_0x3ffc4d[_0x2a2743]['to']){_0xb2a443['internal']=_0x1baf10[_0x941d('0x73')];}}}if(_[_0x941d('0x72')](_0xb2a443[_0x941d('0x6d')])){_0xb2a443[_0x941d('0x6d')]=_0x153ae8+0x1;}return _0x1517f8(_0xb2a443);});});})['catch'](function(_0x3d896b){_0x26afcc(_0x3d896b);});});}function updateUser(_0x5989b9){return new BPromise(function(_0x32be4f,_0x359721){try{if(_0x5989b9[_0x941d('0x77')]){_0x5989b9[_0x941d('0x78')]=_0x5989b9[_0x941d('0x6d')];_0x5989b9[_0x941d('0x79')]={'mailbox':_0x5989b9[_0x941d('0x6d')],'password':_0x5989b9[_0x941d('0x4e')],'fullname':_0x5989b9[_0x941d('0x7a')],'email':_0x5989b9[_0x941d('0x7b')]};}if(_0x5989b9[_0x941d('0x38')]===_0x941d('0x7c')){if(!_0x5989b9['permissions'])_0x5989b9[_0x941d('0x7d')]=[_0x941d('0x7e'),'102',_0x941d('0x7f'),_0x941d('0x80'),_0x941d('0x81'),_0x941d('0x82'),_0x941d('0x83'),'106',_0x941d('0x84'),_0x941d('0x85'),_0x941d('0x86'),_0x941d('0x87'),_0x941d('0x88'),_0x941d('0x89')];}_0x32be4f(_0x5989b9);}catch(_0x27c07e){_0x359721(_0x27c07e);}});}exports['create']=function(_0x25a905,_0x22ec89){if(_0x25a905[_0x941d('0x8a')][_0x941d('0x38')]===_0x941d('0x7c'))throw new Error(_0x941d('0x8b'));if(_0x25a905[_0x941d('0x68')][_0x941d('0x38')]===_0x941d('0x8a')&&_0x25a905['user'][_0x941d('0x38')]!==_0x941d('0x39')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x25a905['body'][_0x941d('0x38')]===_0x941d('0x39')&&_0x25a905['user'][_0x941d('0x38')]!==_0x941d('0x39')){throw new Error(_0x941d('0x8c'));}return licenseUtil['checkUserLimits']([_0x25a905[_0x941d('0x68')]])['then'](function(){return validateUser(_0x25a905[_0x941d('0x68')]);})[_0x941d('0x23')](function(_0x255c7f){return updateUser(_0x255c7f)[_0x941d('0x23')](function(_0x4eb310){if(_0x4eb310[_0x941d('0x38')]==='admin'){_0x4eb310['settingsEnabled']=_0x25a905[_0x941d('0x8a')]['settingsEnabled'];delete _0x4eb310['userProfileId'];}return _0x4eb310;});})[_0x941d('0x23')](function(_0xcd87da){return db[_0x941d('0x47')]['create'](_0xcd87da,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x392927){if(_0x25a905['body'][_0x941d('0x38')]===_0x941d('0x8a'))return _0x392927;if(_0x25a905[_0x941d('0x8a')][_0x941d('0x38')]!==_0x941d('0x8a'))return _0x392927;return db[_0x941d('0x8d')][_0x941d('0x42')]({'where':{'name':_0x392927[_0x941d('0x38')]===_0x941d('0x7c')?'Agents':_0x941d('0x3b'),'userProfileId':_0x25a905[_0x941d('0x8a')]['userProfileId']},'raw':!![]})['then'](function(_0x1696da){if(!_0x1696da||_0x1696da[_0x941d('0x8e')]!=0x0)return _0x392927;return db[_0x941d('0x44')][_0x941d('0x8f')]({'name':_0x392927[_0x941d('0x43')],'resourceId':_0x392927['id'],'type':_0x1696da[_0x941d('0x43')],'sectionId':_0x1696da['id']},{})['then'](function(){return _0x392927;});})[_0x941d('0x2b')](function(_0x462d92){logger[_0x941d('0x28')](_0x941d('0x90'),_0x462d92);throw _0x462d92;});})[_0x941d('0x23')](respondWithResult(_0x22ec89,0xc9))[_0x941d('0x2b')](handleError(_0x22ec89,null));};exports['bulkCreate']=function(_0x1ef3ef,_0x5040ed){var _0x34f7c9=_0x1ef3ef[_0x941d('0x68')];var _0x1198c8=[];if(_0x1ef3ef[_0x941d('0x8a')][_0x941d('0x38')]===_0x941d('0x7c'))throw new Error('Unauthorized');if(_[_0x941d('0x91')](_0x34f7c9,[_0x941d('0x38'),'user'])&&_0x1ef3ef[_0x941d('0x8a')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x941d('0x91')](_0x34f7c9,[_0x941d('0x38'),'admin'])&&_0x1ef3ef[_0x941d('0x8a')][_0x941d('0x38')]!==_0x941d('0x39')){throw new Error(_0x941d('0x92'));}return licenseUtil[_0x941d('0x93')](_0x34f7c9)['then'](function(){return validateUser(_0x34f7c9[0x0]);})[_0x941d('0x23')](function(){for(var _0x2ee702=0x1;_0x2ee702<_0x34f7c9['length'];_0x2ee702++){var _0x2ba6eb=_0x34f7c9[_0x2ee702-0x1][_0x941d('0x6d')];if(!_0x34f7c9[_0x2ee702]['internal'])_0x34f7c9[_0x2ee702][_0x941d('0x6d')]=_0x2ba6eb+0x1;_0x1198c8['push'](validateUser(_0x34f7c9[_0x2ee702]));}return BPromise[_0x941d('0x94')](_0x1198c8);})[_0x941d('0x23')](function(){_0x1198c8=[];for(var _0x5a9d4b=0x0;_0x5a9d4b<_0x34f7c9[_0x941d('0x65')];_0x5a9d4b++){_0x1198c8[_0x941d('0x95')](updateUser(_0x34f7c9[_0x5a9d4b]));}return BPromise[_0x941d('0x94')](_0x1198c8);})[_0x941d('0x23')](function(){return BPromise[_0x941d('0x96')](_0x34f7c9,function(_0x3e0dfc){return db[_0x941d('0x47')][_0x941d('0x8f')](_0x3e0dfc,{'include':[{'model':db[_0x941d('0x79')],'as':_0x941d('0x79')}]})[_0x941d('0x23')](function(_0x2ad5e7){_0x3e0dfc['id']=_0x2ad5e7['id'];return _0x3e0dfc;});});})['then'](function(_0x297ae5){if(_0x1ef3ef[_0x941d('0x68')]['role']===_0x941d('0x8a'))return _0x297ae5;if(_0x1ef3ef[_0x941d('0x8a')][_0x941d('0x38')]!=='user')return _0x297ae5;var _0xc2b82b=_['some'](_0x297ae5,function(_0x543ce0){return _0x543ce0[_0x941d('0x38')]===_0x941d('0x7c')||_0x543ce0['role']===_0x941d('0x3c');});if(!_0xc2b82b)return _0x297ae5;return db['UserProfileSection'][_0x941d('0x5f')]({'where':{'name':{'$or':[_0x941d('0x3a'),'Telephones']},'userProfileId':_0x1ef3ef[_0x941d('0x8a')][_0x941d('0x97')]},'raw':!![]})[_0x941d('0x23')](function(_0x400064){if(_['isEmpty'](_0x400064)||!_[_0x941d('0x91')](_0x400064,[_0x941d('0x8e'),0x0]))return _0x297ae5;_0x1198c8=[];var _0xfe9194=_(_0x400064)[_0x941d('0x3f')](function(_0x5584c2){if(_0x5584c2[_0x941d('0x8e')]===0x1)return;return _0x5584c2[_0x941d('0x43')]==='Agents'?'agent':_0x941d('0x3c');})['compact']()[_0x941d('0x40')]();for(var _0x3d8075=0x0;_0x3d8075<_0x297ae5[_0x941d('0x65')];_0x3d8075++){if(!_['includes'](_0xfe9194,_0x297ae5[_0x3d8075][_0x941d('0x38')]))return;var _0x1e990b=_0x297ae5[_0x3d8075][_0x941d('0x38')]===_0x941d('0x7c')?_0x941d('0x3a'):_0x941d('0x3b');_0x1198c8[_0x941d('0x95')](db[_0x941d('0x44')][_0x941d('0x8f')]({'name':_0x297ae5[_0x3d8075]['name'],'resourceId':_0x297ae5[_0x3d8075]['id'],'type':_0x1e990b,'sectionId':_['find'](_0x400064,[_0x941d('0x43'),_0x1e990b])['id']},{}));}return BPromise[_0x941d('0x94')](_0x1198c8);})['then'](respondWithResult(_0x5040ed,0xc9))['catch'](handleError(_0x5040ed,null));});};exports[_0x941d('0x98')]=function(_0x463439,_0x3a16be,_0x123e3b){if(_0x463439['body']['id']){delete _0x463439[_0x941d('0x68')]['id'];}return db[_0x941d('0x47')]['find']({'where':{'id':_0x463439[_0x941d('0x62')]['id']}})['then'](function(_0x158e2d){if(!_0x158e2d)return null;if(_0x158e2d['id']===_0x463439[_0x941d('0x8a')]['id']){if(!_0x463439['body']['oldPassword']||!_0x463439[_0x941d('0x68')]['newPassword']){throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x158e2d[_0x941d('0x9b')](_0x463439[_0x941d('0x68')][_0x941d('0x9c')])){throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))]('Wrong\x20credentials');}if(_0x463439[_0x941d('0x68')][_0x941d('0x9c')]===_0x463439[_0x941d('0x68')][_0x941d('0x9d')]){throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))](_0x941d('0x9e'));}}else if(_0x463439['user']['role']===_0x941d('0x39')){if(!_0x463439[_0x941d('0x68')]['newPassword']){throw new db['Sequelize'][(_0x941d('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x463439[_0x941d('0x8a')][_0x941d('0x38')]===_0x941d('0x8a')){if(!_0x463439[_0x941d('0x68')][_0x941d('0x9d')]){throw new db['Sequelize'][(_0x941d('0x9a'))](_0x941d('0x9f'));}if(_0x158e2d[_0x941d('0x38')]!==_0x941d('0x7c')){throw new db['Sequelize'][(_0x941d('0x9a'))](_0x941d('0x8b'));}}else{throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))](_0x941d('0x8b'));}return _0x158e2d;})[_0x941d('0x23')](handleEntityNotFound(_0x3a16be,null))['then'](function(_0xe5312f){return db[_0x941d('0x6e')][_0x941d('0xa0')]({'attributes':['id',_0x941d('0x70'),_0x941d('0xa1'),_0x941d('0xa2')]})[_0x941d('0x23')](function(_0x547fef){if(_0x547fef['securePassword'])authService[_0x941d('0x71')](_0x463439[_0x941d('0x68')][_0x941d('0x9d')]);if(!_0x547fef[_0x941d('0xa1')]||!_0xe5312f[_0x941d('0xa3')])return _0xe5312f;authService[_0x941d('0xa4')](_0x463439[_0x941d('0x68')][_0x941d('0x9d')],_0xe5312f[_0x941d('0xa3')],_0x547fef[_0x941d('0xa2')]);return _0xe5312f;})[_0x941d('0x23')](saveUpdates({'password':_0x463439[_0x941d('0x68')][_0x941d('0x9d')],'passwordResetAt':_0x463439[_0x941d('0x8a')]['id']==_0x463439[_0x941d('0x62')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x463439[_0x941d('0x68')][_0x941d('0x9d')],_0xe5312f[_0x941d('0xa3')])},null));})[_0x941d('0x23')](respondWithResult(_0x3a16be,null))[_0x941d('0x2b')](handleError(_0x3a16be,null));};exports['addQueues']=function(_0x543a4b,_0x372fc1,_0x175558){var _0x299566=_0x543a4b[_0x941d('0x68')][_0x941d('0xa5')];return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x543a4b[_0x941d('0x62')]['id']},'attributes':['id','name',_0x941d('0x38'),'online','loginInPause',_0x941d('0xa6'),_0x941d('0xa7')]})[_0x941d('0x23')](handleEntityNotFound(_0x372fc1,null))[_0x941d('0x23')](function(_0x2ddbea){if(_0x2ddbea){if(!utils['isValidChannel'](_0x299566)){throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))]('Unknown\x20channel');}return _0x2ddbea[_0x941d('0xa8')+_[_0x941d('0xa9')](_0x299566['toLowerCase']())+_0x941d('0xaa')](_0x543a4b[_0x941d('0x68')][_0x941d('0x6b')],{'penalty':_0x543a4b[_0x941d('0x68')][_0x941d('0xab')]||0x0})['spread'](function(_0x32ba1d){for(var _0x4ac85b=0x0;_0x4ac85b<_0x543a4b[_0x941d('0x68')][_0x941d('0x6b')][_0x941d('0x65')];_0x4ac85b+=0x1){var _0xa240a8={'UserId':_0x543a4b['params']['id']};_0xa240a8[_['capitalize'](_0x299566['toLowerCase']())+_0x941d('0xac')]=_0x543a4b[_0x941d('0x68')][_0x941d('0x6b')][_0x4ac85b];socket['emit'](_0x941d('0x8a')+_[_0x941d('0xa9')](_0x299566['toLowerCase']())+_0x941d('0xad'),_0xa240a8);}return _0x32ba1d;})[_0x941d('0x23')](function(){if(_0x299566===_0x941d('0xae')){return db['VoiceQueue'][_0x941d('0x5f')]({'where':{'id':_0x543a4b[_0x941d('0x68')][_0x941d('0x6b')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x144a9e){var _0x5c31b2=_0x2ddbea[_0x941d('0x37')]({'plain':!![]});var _0xcc0ff2=[];if(_0x299566===_0x941d('0xae')&&_0x5c31b2[_0x941d('0x38')]===_0x941d('0x7c')&&_0x5c31b2[_0x941d('0xaf')]){for(var _0x34d50c=0x0;_0x34d50c<_0x144a9e['length'];_0x34d50c+=0x1){_0xcc0ff2['push']({'membername':_0x5c31b2[_0x941d('0x43')],'UserId':_0x5c31b2['id'],'queue_name':_0x144a9e[_0x34d50c][_0x941d('0x43')],'VoiceQueueId':_0x144a9e[_0x34d50c]['id'],'interface':_['isNil'](_0x5c31b2[_0x941d('0xa7')])?util[_0x941d('0xb0')](_0x941d('0xb1'),_0x5c31b2[_0x941d('0x43')]):_0x5c31b2[_0x941d('0xa7')],'paused':_0x5c31b2[_0x941d('0xa6')]||![],'penalty':_0x543a4b[_0x941d('0x68')][_0x941d('0xab')]||0x0});}return BPromise[_0x941d('0x96')](_0xcc0ff2,function(_0x4ba38d){return db[_0x941d('0xb2')][_0x941d('0xb3')](_0x4ba38d);});}return _0x2ddbea;});}})['then'](respondWithStatusCode(_0x372fc1,null))[_0x941d('0x2b')](handleError(_0x372fc1,null));};exports[_0x941d('0xb4')]=function(_0x8c5283,_0x42756c,_0x125f22){var _0x4041d8;return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x8c5283[_0x941d('0x62')]['id']},'attributes':['id',_0x941d('0x43'),'role']})['then'](handleEntityNotFound(_0x42756c,null))['then'](function(_0x1f7d11){if(_0x1f7d11){_0x4041d8=_0x1f7d11;if(!_0x8c5283[_0x941d('0x50')][_0x941d('0xa5')]||!utils['isValidChannel'](_0x8c5283['query'][_0x941d('0xa5')])){throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))](_0x941d('0xb5'));}return _0x1f7d11[_0x941d('0xb6')+_[_0x941d('0xa9')](_0x8c5283[_0x941d('0x50')][_0x941d('0xa5')][_0x941d('0xb7')]())+_0x941d('0xaa')](_0x8c5283[_0x941d('0x50')][_0x941d('0x6b')]);}})[_0x941d('0x23')](function(_0xade4cb){for(var _0x4759db=0x0;_0x4759db<_0x8c5283[_0x941d('0x50')][_0x941d('0x6b')][_0x941d('0x65')];_0x4759db+=0x1){var _0x59e7e6={'UserId':_0x8c5283[_0x941d('0x62')]['id']};_0x59e7e6[_[_0x941d('0xa9')](_0x8c5283[_0x941d('0x50')][_0x941d('0xa5')][_0x941d('0xb7')]())+'QueueId']=_0x8c5283[_0x941d('0x50')]['ids'][_0x4759db];socket['emit']('user'+_['capitalize'](_0x8c5283[_0x941d('0x50')][_0x941d('0xa5')][_0x941d('0xb7')]())+_0x941d('0xb8'),_0x59e7e6);}return _0xade4cb;})[_0x941d('0x23')](function(){if(_0x8c5283[_0x941d('0x50')]['channel']===_0x941d('0xae')){return db[_0x941d('0xb2')]['destroy']({'where':{'UserId':_0x8c5283[_0x941d('0x62')]['id'],'VoiceQueueId':_0x8c5283[_0x941d('0x50')]['ids']},'individualHooks':!![]})['then'](function(){return _0x4041d8;});}return _0x4041d8;})[_0x941d('0x23')](respondWithStatusCode(_0x42756c,null))[_0x941d('0x2b')](handleError(_0x42756c,null));};exports[_0x941d('0xb9')]=function(_0x4edcd6,_0xda4f6e,_0x4b9876){_0x4edcd6[_0x941d('0x68')]['userpic']=_0x4edcd6[_0x941d('0xba')]['filename'];return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x4edcd6[_0x941d('0x62')]['id']}})['then'](handleEntityNotFound(_0xda4f6e,null))[_0x941d('0x23')](saveUpdates(_0x4edcd6[_0x941d('0x68')],null))[_0x941d('0x23')](respondWithResult(_0xda4f6e,null))['catch'](handleError(_0xda4f6e,null));};exports[_0x941d('0xbb')]=function(_0x47429e,_0x3a9b61,_0x3402f7){var _0x60e54b=path[_0x941d('0xbc')](config[_0x941d('0xbd')],_0x941d('0xbe'));return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x47429e[_0x941d('0x62')]['id']},'attributes':['id',_0x941d('0xbf')],'raw':!![]})[_0x941d('0x23')](handleEntityNotFound(_0x3a9b61,null))[_0x941d('0x23')](function(_0x3ab4f6){if(_0x3ab4f6){if(_['isNil'](_0x3ab4f6['userpic'])){return _0x3a9b61['download'](_0x60e54b);}else{if(!fs[_0x941d('0xc0')](path[_0x941d('0xbc')](config[_0x941d('0xbd')],_0x941d('0xc1'),_0x3ab4f6['userpic']))){return _0x3a9b61['download'](_0x60e54b);}return _0x3a9b61[_0x941d('0xc2')](path['join'](config[_0x941d('0xbd')],'server/files/images/',_0x3ab4f6[_0x941d('0xbf')]));}}})[_0x941d('0x2b')](handleError(_0x3a9b61,null));};exports[_0x941d('0xc3')]=function(_0xc9ff9f,_0x1eb161,_0x6cf62a){var _0x46ec34={};var _0x56878a={};var _0x561fe2;var _0x22bbd9;return db[_0x941d('0x47')]['findOne']({'where':{'id':_0xc9ff9f[_0x941d('0x62')]['id']}})['then'](handleEntityNotFound(_0x1eb161,null))[_0x941d('0x23')](function(_0x4dce38){if(_0x4dce38){_0x561fe2=_0x4dce38;_0x56878a[_0x941d('0x4c')]=_[_0x941d('0x63')](db['CmContact'][_0x941d('0x48')]);_0x56878a[_0x941d('0x50')]=_['keys'](_0xc9ff9f[_0x941d('0x50')]);_0x56878a[_0x941d('0x64')]=_[_0x941d('0x51')](_0x56878a[_0x941d('0x4c')],_0x56878a[_0x941d('0x50')]);_0x46ec34[_0x941d('0x53')]=_[_0x941d('0x51')](_0x56878a[_0x941d('0x4c')],qs[_0x941d('0x52')](_0xc9ff9f[_0x941d('0x50')][_0x941d('0x52')]));_0x46ec34[_0x941d('0x53')]=_0x46ec34[_0x941d('0x53')]['length']?_0x46ec34[_0x941d('0x53')]:_0x56878a['model'];_0x46ec34[_0x941d('0x56')]=qs[_0x941d('0x57')](_0xc9ff9f[_0x941d('0x50')][_0x941d('0x57')]);_0x46ec34['where']=qs[_0x941d('0x64')](_['pick'](_0xc9ff9f[_0x941d('0x50')],_0x56878a[_0x941d('0x64')]));if(_0xc9ff9f[_0x941d('0x50')][_0x941d('0x3d')]){_0x46ec34['where']=_[_0x941d('0x59')](_0x46ec34['where'],{'$or':_[_0x941d('0x3f')](_0x46ec34[_0x941d('0x53')],function(_0x2909e3){var _0x59c3ee={};_0x59c3ee[_0x2909e3]={'$like':'%'+_0xc9ff9f[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0x59c3ee;})});}_0x46ec34=_[_0x941d('0x59')]({},_0x46ec34,_0xc9ff9f[_0x941d('0xc4')]);return _0x561fe2[_0x941d('0xc3')](_0x46ec34);}})[_0x941d('0x23')](function(_0x2a71df){if(_0x2a71df){_0x22bbd9=_0x2a71df[_0x941d('0x65')];if(_0xc9ff9f[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x5e'))){_0x46ec34[_0x941d('0x66')]=[{'model':db[_0x941d('0xc5')],'as':'List','required':![]},{'model':db[_0x941d('0xc6')],'as':_0x941d('0xc7'),'attributes':['id','name',_0x941d('0xc8')],'where':_0xc9ff9f[_0x941d('0x50')][_0x941d('0xc9')]?{'id':_0xc9ff9f[_0x941d('0x50')]['tag']}:undefined,'required':_0xc9ff9f[_0x941d('0x50')][_0x941d('0xc9')]?!![]:![]}];}if(!_0xc9ff9f[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x46ec34[_0x941d('0x32')]=qs['limit'](_0xc9ff9f[_0x941d('0x50')]['limit']);_0x46ec34[_0x941d('0x31')]=qs[_0x941d('0x31')](_0xc9ff9f[_0x941d('0x50')][_0x941d('0x31')]);}return _0x561fe2[_0x941d('0xc3')](_0x46ec34);}})['then'](function(_0x252152){if(_0x252152){return _0x252152?{'count':_0x22bbd9,'rows':_0x252152}:null;}})[_0x941d('0x23')](respondWithResult(_0x1eb161,null))[_0x941d('0x2b')](handleError(_0x1eb161,null));};exports[_0x941d('0xca')]=function(_0x373305,_0x3dba29,_0xc4947){var _0x1befc4;var _0x4258a1;var _0x311f97={};var _0x363526;return db['User'][_0x941d('0xa0')]({'where':{'id':_0x373305['params']['id']},'attributes':['id',_0x941d('0x43'),_0x941d('0x38')]})[_0x941d('0x23')](handleEntityNotFound(_0x3dba29,null))[_0x941d('0x23')](function(_0x54d4f3){if(!utils[_0x941d('0xcb')](_0x373305[_0x941d('0x50')][_0x941d('0xa5')])){throw new db['Sequelize']['ValidationError'](_0x941d('0xb5'));}_0x1befc4=_0x54d4f3;var _0xa9a4c3={};_0xa9a4c3['model']=_['keys'](db[_['capitalize'](_0x373305[_0x941d('0x50')][_0x941d('0xa5')])+_0x941d('0xcc')]['rawAttributes']);_0xa9a4c3[_0x941d('0x50')]=_[_0x941d('0x63')](_0x373305['query']);_0xa9a4c3['filters']=_[_0x941d('0x51')](_0xa9a4c3['model'],_0xa9a4c3['query']);_0x311f97[_0x941d('0x53')]=_['intersection'](_0xa9a4c3[_0x941d('0x4c')],qs['fields'](_0x373305[_0x941d('0x50')][_0x941d('0x52')]));_0x311f97['attributes']=_0x311f97['attributes'][_0x941d('0x65')]?_0x311f97[_0x941d('0x53')]:_0xa9a4c3['model'];_0x311f97[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x373305['query'][_0x941d('0x57')]);_0x311f97['where']=qs[_0x941d('0x64')](_['pick'](_0x373305['query'],_0xa9a4c3['filters']));if(_0x373305[_0x941d('0x50')][_0x941d('0x3d')]){_0x311f97[_0x941d('0x58')]=_[_0x941d('0x59')](_0x311f97['where'],{'$or':_[_0x941d('0x3f')](_0x311f97['attributes'],function(_0x4ef9e6){var _0xafcdc5={};_0xafcdc5[_0x4ef9e6]={'$like':'%'+_0x373305[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0xafcdc5;})});}_0x311f97=_[_0x941d('0x59')]({},_0x311f97,_0x373305[_0x941d('0xc4')]);switch(_0x1befc4[_0x941d('0x38')]){case _0x941d('0x39'):return db[_[_0x941d('0xa9')](_0x373305[_0x941d('0x50')][_0x941d('0xa5')])+_0x941d('0xcc')]['findAll'](_0x311f97);case'user':case'agent':return _0x1befc4[_0x941d('0x37')+_[_0x941d('0xa9')](_0x373305[_0x941d('0x50')]['channel'])+_0x941d('0xaa')](_0x311f97);default:throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))]('Unknown\x20role');}})[_0x941d('0x23')](function(_0x466170){_0x363526=_0x466170[_0x941d('0x65')];if(!_0x373305[_0x941d('0x50')][_0x941d('0x54')]('nolimit')){_0x311f97[_0x941d('0x32')]=qs['limit'](_0x373305[_0x941d('0x50')][_0x941d('0x32')]);_0x311f97[_0x941d('0x31')]=qs['offset'](_0x373305[_0x941d('0x50')][_0x941d('0x31')]);}switch(_0x1befc4[_0x941d('0x38')]){case _0x941d('0x39'):return db[_[_0x941d('0xa9')](_0x373305[_0x941d('0x50')][_0x941d('0xa5')])+'Queue'][_0x941d('0x5f')](_0x311f97);case _0x941d('0x8a'):case _0x941d('0x7c'):return _0x1befc4[_0x941d('0x37')+_[_0x941d('0xa9')](_0x373305['query'][_0x941d('0xa5')])+_0x941d('0xaa')](_0x311f97);}})[_0x941d('0x23')](function(_0xb23a24){return{'count':_0x363526,'rows':_0xb23a24};})[_0x941d('0x23')](respondWithResult(_0x3dba29,null))[_0x941d('0x2b')](handleError(_0x3dba29,null));};exports[_0x941d('0xcd')]=function(_0xeebc4,_0x2e069e,_0x5c9e41){var _0x4992bf={};var _0x10584c={};var _0x4ad88a;var _0x3c3c30;return db[_0x941d('0x47')]['findOne']({'where':{'id':_0xeebc4[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x2e069e,null))[_0x941d('0x23')](function(_0x5832fe){if(_0x5832fe){_0x4ad88a=_0x5832fe;_0x10584c[_0x941d('0x4c')]=_['keys'](db[_0x941d('0xb2')]['rawAttributes']);_0x10584c[_0x941d('0x50')]=_[_0x941d('0x63')](_0xeebc4['query']);_0x10584c[_0x941d('0x64')]=_[_0x941d('0x51')](_0x10584c['model'],_0x10584c[_0x941d('0x50')]);_0x4992bf[_0x941d('0x53')]=_[_0x941d('0x51')](_0x10584c[_0x941d('0x4c')],qs['fields'](_0xeebc4[_0x941d('0x50')][_0x941d('0x52')]));_0x4992bf[_0x941d('0x53')]=_0x4992bf[_0x941d('0x53')]['length']?_0x4992bf[_0x941d('0x53')]:_0x10584c['model'];_0x4992bf[_0x941d('0x56')]=qs[_0x941d('0x57')](_0xeebc4[_0x941d('0x50')][_0x941d('0x57')]);_0x4992bf[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0xeebc4[_0x941d('0x50')],_0x10584c['filters']));if(_0xeebc4[_0x941d('0x50')][_0x941d('0x3d')]){_0x4992bf[_0x941d('0x58')]=_['merge'](_0x4992bf[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x4992bf['attributes'],function(_0x3555de){var _0x3955ec={};_0x3955ec[_0x3555de]={'$like':'%'+_0xeebc4['query']['filter']+'%'};return _0x3955ec;})});}_0x4992bf=_['merge']({},_0x4992bf,_0xeebc4['options']);return _0x4ad88a[_0x941d('0xcd')](_0x4992bf);}})['then'](function(_0x4f4b2a){if(_0x4f4b2a){_0x3c3c30=_0x4f4b2a[_0x941d('0x65')];if(!_0xeebc4[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x4992bf[_0x941d('0x32')]=qs[_0x941d('0x32')](_0xeebc4[_0x941d('0x50')][_0x941d('0x32')]);_0x4992bf['offset']=qs[_0x941d('0x31')](_0xeebc4[_0x941d('0x50')][_0x941d('0x31')]);}return _0x4ad88a[_0x941d('0xcd')](_0x4992bf);}})[_0x941d('0x23')](function(_0x5d922c){if(_0x5d922c){return _0x5d922c?{'count':_0x3c3c30,'rows':_0x5d922c}:null;}})[_0x941d('0x23')](respondWithResult(_0x2e069e,null))[_0x941d('0x2b')](handleError(_0x2e069e,null));};exports[_0x941d('0xcf')]=function(_0x38ac92,_0x2a90e8,_0x30c5f4){var _0x3dcae2={};var _0x1a74d4={};var _0x4f1d60;var _0x4908ac;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x38ac92[_0x941d('0x62')]['id']}})['then'](handleEntityNotFound(_0x2a90e8,null))[_0x941d('0x23')](function(_0xf343a0){if(_0xf343a0){_0x4f1d60=_0xf343a0;_0x1a74d4[_0x941d('0x4c')]=_['keys'](db[_0x941d('0xd0')]['rawAttributes']);_0x1a74d4['query']=_[_0x941d('0x63')](_0x38ac92[_0x941d('0x50')]);_0x1a74d4['filters']=_['intersection'](_0x1a74d4[_0x941d('0x4c')],_0x1a74d4[_0x941d('0x50')]);_0x3dcae2[_0x941d('0x53')]=_[_0x941d('0x51')](_0x1a74d4['model'],qs[_0x941d('0x52')](_0x38ac92[_0x941d('0x50')]['fields']));_0x3dcae2[_0x941d('0x53')]=_0x3dcae2[_0x941d('0x53')][_0x941d('0x65')]?_0x3dcae2['attributes']:_0x1a74d4[_0x941d('0x4c')];_0x3dcae2[_0x941d('0x56')]=qs['sort'](_0x38ac92['query'][_0x941d('0x57')]);_0x3dcae2[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x38ac92[_0x941d('0x50')],_0x1a74d4['filters']));if(_0x38ac92['query'][_0x941d('0x3d')]){_0x3dcae2[_0x941d('0x58')]=_['merge'](_0x3dcae2[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x3dcae2['attributes'],function(_0x5792ea){var _0x43db16={};_0x43db16[_0x5792ea]={'$like':'%'+_0x38ac92[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0x43db16;})});}_0x3dcae2=_[_0x941d('0x59')]({},_0x3dcae2,_0x38ac92[_0x941d('0xc4')]);return _0x4f1d60[_0x941d('0xcf')](_0x3dcae2);}})['then'](function(_0x2140a2){if(_0x2140a2){_0x4908ac=_0x2140a2[_0x941d('0x65')];if(!_0x38ac92['query'][_0x941d('0x54')](_0x941d('0x55'))){_0x3dcae2['limit']=qs[_0x941d('0x32')](_0x38ac92[_0x941d('0x50')][_0x941d('0x32')]);_0x3dcae2[_0x941d('0x31')]=qs['offset'](_0x38ac92['query']['offset']);}return _0x4f1d60[_0x941d('0xcf')](_0x3dcae2);}})['then'](function(_0xf4cece){if(_0xf4cece){return _0xf4cece?{'count':_0x4908ac,'rows':_0xf4cece}:null;}})[_0x941d('0x23')](respondWithResult(_0x2a90e8,null))[_0x941d('0x2b')](handleError(_0x2a90e8,null));};exports['getRecordings']=function(_0x1e0d67,_0x375c17,_0x56bf17){var _0x4ddd5e={'raw':!![],'where':{}};var _0x5ec25c={};var _0x5b987c={'count':0x0,'rows':[]};return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x1e0d67['params']['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x375c17,null))[_0x941d('0x23')](function(_0x4a14b0){if(_0x4a14b0){_0x5ec25c['model']=_[_0x941d('0x63')](db[_0x941d('0xd1')][_0x941d('0x48')]);_0x5ec25c[_0x941d('0x50')]=_[_0x941d('0x63')](_0x1e0d67['query']);_0x5ec25c['filters']=_['intersection'](_0x5ec25c[_0x941d('0x4c')],_0x5ec25c[_0x941d('0x50')]);_0x4ddd5e['attributes']=_['intersection'](_0x5ec25c['model'],qs[_0x941d('0x52')](_0x1e0d67[_0x941d('0x50')][_0x941d('0x52')]));_0x4ddd5e['attributes']=_0x4ddd5e[_0x941d('0x53')][_0x941d('0x65')]?_0x4ddd5e[_0x941d('0x53')]:_0x5ec25c[_0x941d('0x4c')];if(!_0x1e0d67[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x4ddd5e[_0x941d('0x32')]=qs[_0x941d('0x32')](_0x1e0d67[_0x941d('0x50')][_0x941d('0x32')]);_0x4ddd5e[_0x941d('0x31')]=qs[_0x941d('0x31')](_0x1e0d67[_0x941d('0x50')][_0x941d('0x31')]);}_0x4ddd5e[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x1e0d67[_0x941d('0x50')][_0x941d('0x57')]);_0x4ddd5e[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x1e0d67[_0x941d('0x50')],_0x5ec25c['filters']));_0x4ddd5e[_0x941d('0x58')][_0x941d('0xd2')]=_0x4a14b0['id'];if(_0x1e0d67[_0x941d('0x50')][_0x941d('0x3d')]){_0x4ddd5e['where']=_[_0x941d('0x59')](_0x4ddd5e[_0x941d('0x58')],{'$or':_['map'](_0x4ddd5e[_0x941d('0x53')],function(_0x776bce){var _0x523cda={};_0x523cda[_0x776bce]={'$like':'%'+_0x1e0d67['query']['filter']+'%'};return _0x523cda;})});}_0x4ddd5e=_['merge']({},_0x4ddd5e,_0x1e0d67['options']);return db['VoiceRecording']['count']({'where':_0x4ddd5e['where']})[_0x941d('0x23')](function(_0x91dbb2){_0x5b987c['count']=_0x91dbb2;if(_0x1e0d67[_0x941d('0x50')][_0x941d('0x5e')]){_0x4ddd5e[_0x941d('0x66')]=[{'all':!![]}];}return db[_0x941d('0xd1')][_0x941d('0x5f')](_0x4ddd5e);})[_0x941d('0x23')](function(_0x2df1a3){_0x5b987c[_0x941d('0x60')]=_0x2df1a3;return _0x5b987c;});}})[_0x941d('0x23')](respondWithFilteredResult(_0x375c17,_0x4ddd5e))[_0x941d('0x2b')](handleError(_0x375c17,null));};exports['getScreenRecordings']=function(_0xe7934f,_0x5ee331,_0x19e640){var _0x2efb13={'raw':!![],'where':{}};var _0xf9bf80={};var _0x36641f={'count':0x0,'rows':[]};return db['User'][_0x941d('0xa0')]({'where':{'id':_0xe7934f[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x5ee331,null))['then'](function(_0x12cbe4){if(_0x12cbe4){_0xf9bf80['model']=_['keys'](db[_0x941d('0xd3')][_0x941d('0x48')]);_0xf9bf80['query']=_[_0x941d('0x63')](_0xe7934f[_0x941d('0x50')]);_0xf9bf80['filters']=_[_0x941d('0x51')](_0xf9bf80[_0x941d('0x4c')],_0xf9bf80[_0x941d('0x50')]);_0x2efb13['attributes']=_[_0x941d('0x51')](_0xf9bf80[_0x941d('0x4c')],qs[_0x941d('0x52')](_0xe7934f[_0x941d('0x50')][_0x941d('0x52')]));_0x2efb13[_0x941d('0x53')]=_0x2efb13[_0x941d('0x53')][_0x941d('0x65')]?_0x2efb13[_0x941d('0x53')]:_0xf9bf80[_0x941d('0x4c')];if(!_0xe7934f['query'][_0x941d('0x54')](_0x941d('0x55'))){_0x2efb13['limit']=qs['limit'](_0xe7934f[_0x941d('0x50')][_0x941d('0x32')]);_0x2efb13[_0x941d('0x31')]=qs[_0x941d('0x31')](_0xe7934f[_0x941d('0x50')][_0x941d('0x31')]);}_0x2efb13['order']=qs[_0x941d('0x57')](_0xe7934f[_0x941d('0x50')][_0x941d('0x57')]);_0x2efb13[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0xe7934f[_0x941d('0x50')],_0xf9bf80[_0x941d('0x64')]));_0x2efb13['where']['UserId']=_0x12cbe4['id'];if(_0xe7934f[_0x941d('0x50')][_0x941d('0x3d')]){_0x2efb13[_0x941d('0x58')]=_[_0x941d('0x59')](_0x2efb13['where'],{'$or':_[_0x941d('0x3f')](_0x2efb13[_0x941d('0x53')],function(_0x326f68){var _0x247afb={};_0x247afb[_0x326f68]={'$like':'%'+_0xe7934f['query'][_0x941d('0x3d')]+'%'};return _0x247afb;})});}_0x2efb13=_[_0x941d('0x59')]({},_0x2efb13,_0xe7934f[_0x941d('0xc4')]);return db[_0x941d('0xd3')]['count']({'where':_0x2efb13[_0x941d('0x58')]})[_0x941d('0x23')](function(_0x52aa09){_0x36641f[_0x941d('0x30')]=_0x52aa09;if(_0xe7934f[_0x941d('0x50')]['includeAll']){_0x2efb13[_0x941d('0x66')]=[{'all':!![]}];}return db[_0x941d('0xd3')][_0x941d('0x5f')](_0x2efb13);})['then'](function(_0x3d61dc){_0x36641f[_0x941d('0x60')]=_0x3d61dc;return _0x36641f;});}})['then'](respondWithFilteredResult(_0x5ee331,_0x2efb13))['catch'](handleError(_0x5ee331,null));};exports[_0x941d('0xd4')]=function(_0x14b034,_0x1258aa,_0x41bb88){var _0x200af1={};var _0x2d5a42={};var _0x5396d7;var _0x5b2c6c;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x14b034[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x1258aa,null))[_0x941d('0x23')](function(_0x4e9be2){if(_0x4e9be2){_0x5396d7=_0x4e9be2;_0x2d5a42[_0x941d('0x4c')]=_[_0x941d('0x63')](db['ChatInteraction'][_0x941d('0x48')]);_0x2d5a42['query']=_['keys'](_0x14b034[_0x941d('0x50')]);_0x2d5a42[_0x941d('0x64')]=_[_0x941d('0x51')](_0x2d5a42[_0x941d('0x4c')],_0x2d5a42['query']);_0x200af1[_0x941d('0x53')]=_[_0x941d('0x51')](_0x2d5a42[_0x941d('0x4c')],qs[_0x941d('0x52')](_0x14b034[_0x941d('0x50')]['fields']));_0x200af1['attributes']=_0x200af1[_0x941d('0x53')][_0x941d('0x65')]?_0x200af1[_0x941d('0x53')]:_0x2d5a42[_0x941d('0x4c')];_0x200af1[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x14b034[_0x941d('0x50')][_0x941d('0x57')]);_0x200af1[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x14b034[_0x941d('0x50')],_0x2d5a42[_0x941d('0x64')]));if(_0x14b034[_0x941d('0x50')][_0x941d('0x3d')]){_0x200af1[_0x941d('0x58')]=_[_0x941d('0x59')](_0x200af1['where'],{'$or':_[_0x941d('0x3f')](_0x200af1[_0x941d('0x53')],function(_0x3d0482){var _0x202ee9={};_0x202ee9[_0x3d0482]={'$like':'%'+_0x14b034['query'][_0x941d('0x3d')]+'%'};return _0x202ee9;})});}_0x200af1=_[_0x941d('0x59')]({},_0x200af1,_0x14b034['options']);return _0x5396d7[_0x941d('0xd4')](_0x200af1);}})[_0x941d('0x23')](function(_0x4deac2){if(_0x4deac2){_0x5b2c6c=_0x4deac2['length'];if(!_0x14b034[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x200af1[_0x941d('0x32')]=qs[_0x941d('0x32')](_0x14b034[_0x941d('0x50')][_0x941d('0x32')]);_0x200af1[_0x941d('0x31')]=qs[_0x941d('0x31')](_0x14b034[_0x941d('0x50')]['offset']);}return _0x5396d7[_0x941d('0xd4')](_0x200af1);}})['then'](function(_0x59ab43){if(_0x59ab43){return _0x59ab43?{'count':_0x5b2c6c,'rows':_0x59ab43}:null;}})[_0x941d('0x23')](respondWithResult(_0x1258aa,null))[_0x941d('0x2b')](handleError(_0x1258aa,null));};exports['getOpenchannelInteractions']=function(_0x3359ba,_0x5b9a91,_0x41b528){var _0x541b8c={};var _0x262a4b={};var _0x45edc4;var _0x3421f3;return db[_0x941d('0x47')]['findOne']({'where':{'id':_0x3359ba['params']['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x5b9a91,null))[_0x941d('0x23')](function(_0x555fdc){if(_0x555fdc){_0x45edc4=_0x555fdc;_0x262a4b['model']=_[_0x941d('0x63')](db[_0x941d('0xd5')][_0x941d('0x48')]);_0x262a4b[_0x941d('0x50')]=_[_0x941d('0x63')](_0x3359ba['query']);_0x262a4b[_0x941d('0x64')]=_[_0x941d('0x51')](_0x262a4b[_0x941d('0x4c')],_0x262a4b['query']);_0x541b8c[_0x941d('0x53')]=_[_0x941d('0x51')](_0x262a4b[_0x941d('0x4c')],qs['fields'](_0x3359ba[_0x941d('0x50')][_0x941d('0x52')]));_0x541b8c[_0x941d('0x53')]=_0x541b8c[_0x941d('0x53')]['length']?_0x541b8c[_0x941d('0x53')]:_0x262a4b['model'];_0x541b8c['order']=qs[_0x941d('0x57')](_0x3359ba[_0x941d('0x50')][_0x941d('0x57')]);_0x541b8c[_0x941d('0x58')]=qs[_0x941d('0x64')](_['pick'](_0x3359ba[_0x941d('0x50')],_0x262a4b[_0x941d('0x64')]));if(_0x3359ba[_0x941d('0x50')]['filter']){_0x541b8c['where']=_[_0x941d('0x59')](_0x541b8c[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x541b8c[_0x941d('0x53')],function(_0x9e4e93){var _0x5c2bcc={};_0x5c2bcc[_0x9e4e93]={'$like':'%'+_0x3359ba[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0x5c2bcc;})});}_0x541b8c=_[_0x941d('0x59')]({},_0x541b8c,_0x3359ba[_0x941d('0xc4')]);return _0x45edc4[_0x941d('0xd6')](_0x541b8c);}})[_0x941d('0x23')](function(_0x4dc95f){if(_0x4dc95f){_0x3421f3=_0x4dc95f[_0x941d('0x65')];if(!_0x3359ba[_0x941d('0x50')]['hasOwnProperty']('nolimit')){_0x541b8c[_0x941d('0x32')]=qs[_0x941d('0x32')](_0x3359ba['query']['limit']);_0x541b8c[_0x941d('0x31')]=qs[_0x941d('0x31')](_0x3359ba[_0x941d('0x50')][_0x941d('0x31')]);}return _0x45edc4[_0x941d('0xd6')](_0x541b8c);}})[_0x941d('0x23')](function(_0x32678b){if(_0x32678b){return _0x32678b?{'count':_0x3421f3,'rows':_0x32678b}:null;}})[_0x941d('0x23')](respondWithResult(_0x5b9a91,null))[_0x941d('0x2b')](handleError(_0x5b9a91,null));};exports[_0x941d('0xd7')]=function(_0x1d7715,_0x313659,_0x2e7206){var _0x9613a6={'raw':!![],'where':{}};var _0xd3d45e={};var _0x2f36d7={'count':0x0,'rows':[]};return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x1d7715['params']['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x313659,null))['then'](function(_0x25fd26){if(_0x25fd26){_0xd3d45e[_0x941d('0x4c')]=_['keys'](db[_0x941d('0xd8')][_0x941d('0x48')]);_0xd3d45e[_0x941d('0x50')]=_[_0x941d('0x63')](_0x1d7715[_0x941d('0x50')]);_0xd3d45e[_0x941d('0x64')]=_['intersection'](_0xd3d45e[_0x941d('0x4c')],_0xd3d45e[_0x941d('0x50')]);_0x9613a6[_0x941d('0x53')]=_[_0x941d('0x51')](_0xd3d45e['model'],qs['fields'](_0x1d7715['query']['fields']));_0x9613a6[_0x941d('0x53')]=_0x9613a6[_0x941d('0x53')][_0x941d('0x65')]?_0x9613a6['attributes']:_0xd3d45e[_0x941d('0x4c')];if(!_0x1d7715[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x9613a6[_0x941d('0x32')]=qs['limit'](_0x1d7715[_0x941d('0x50')][_0x941d('0x32')]);_0x9613a6[_0x941d('0x31')]=qs[_0x941d('0x31')](_0x1d7715['query'][_0x941d('0x31')]);}_0x9613a6[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x1d7715[_0x941d('0x50')][_0x941d('0x57')]);_0x9613a6['where']=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x1d7715[_0x941d('0x50')],_0xd3d45e['filters']));_0x9613a6[_0x941d('0x58')]['UserId']=_0x25fd26['id'];if(_0x1d7715['query'][_0x941d('0x3d')]){_0x9613a6[_0x941d('0x58')]=_[_0x941d('0x59')](_0x9613a6['where'],{'$or':_[_0x941d('0x3f')](_0x9613a6[_0x941d('0x53')],function(_0x3cac13){var _0x254188={};_0x254188[_0x3cac13]={'$like':'%'+_0x1d7715[_0x941d('0x50')]['filter']+'%'};return _0x254188;})});}_0x9613a6=_[_0x941d('0x59')]({},_0x9613a6,_0x1d7715['options']);return db[_0x941d('0xd8')][_0x941d('0x30')]({'where':_0x9613a6[_0x941d('0x58')]})[_0x941d('0x23')](function(_0x9a4d94){_0x2f36d7[_0x941d('0x30')]=_0x9a4d94;if(_0x1d7715['query'][_0x941d('0x5e')]){_0x9613a6['include']=[{'all':!![]}];}return db['MailInteraction'][_0x941d('0x5f')](_0x9613a6);})[_0x941d('0x23')](function(_0x4a567d){_0x2f36d7[_0x941d('0x60')]=_0x4a567d;return _0x2f36d7;});}})['then'](respondWithFilteredResult(_0x313659,_0x9613a6))[_0x941d('0x2b')](handleError(_0x313659,null));};exports[_0x941d('0xd9')]=function(_0x5c4170,_0x25567f,_0x3aabdc){var _0x5ab23b={};var _0x369911={};var _0x559fa2;var _0xa78c98;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x5c4170[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x25567f,null))[_0x941d('0x23')](function(_0x1c0ae5){if(_0x1c0ae5){_0x559fa2=_0x1c0ae5;_0x369911[_0x941d('0x4c')]=_[_0x941d('0x63')](db[_0x941d('0xda')]['rawAttributes']);_0x369911[_0x941d('0x50')]=_['keys'](_0x5c4170['query']);_0x369911[_0x941d('0x64')]=_['intersection'](_0x369911[_0x941d('0x4c')],_0x369911[_0x941d('0x50')]);_0x5ab23b[_0x941d('0x53')]=_[_0x941d('0x51')](_0x369911[_0x941d('0x4c')],qs[_0x941d('0x52')](_0x5c4170['query']['fields']));_0x5ab23b[_0x941d('0x53')]=_0x5ab23b[_0x941d('0x53')][_0x941d('0x65')]?_0x5ab23b[_0x941d('0x53')]:_0x369911[_0x941d('0x4c')];_0x5ab23b['order']=qs[_0x941d('0x57')](_0x5c4170[_0x941d('0x50')][_0x941d('0x57')]);_0x5ab23b[_0x941d('0x58')]=qs['filters'](_[_0x941d('0xce')](_0x5c4170[_0x941d('0x50')],_0x369911['filters']));if(_0x5c4170[_0x941d('0x50')][_0x941d('0x3d')]){_0x5ab23b[_0x941d('0x58')]=_[_0x941d('0x59')](_0x5ab23b[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x5ab23b[_0x941d('0x53')],function(_0x15ac9b){var _0x18680b={};_0x18680b[_0x15ac9b]={'$like':'%'+_0x5c4170[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0x18680b;})});}_0x5ab23b=_[_0x941d('0x59')]({},_0x5ab23b,_0x5c4170[_0x941d('0xc4')]);return _0x559fa2[_0x941d('0xd9')](_0x5ab23b);}})['then'](function(_0x4c8248){if(_0x4c8248){_0xa78c98=_0x4c8248[_0x941d('0x65')];if(!_0x5c4170[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x5ab23b[_0x941d('0x32')]=qs[_0x941d('0x32')](_0x5c4170[_0x941d('0x50')][_0x941d('0x32')]);_0x5ab23b[_0x941d('0x31')]=qs[_0x941d('0x31')](_0x5c4170[_0x941d('0x50')][_0x941d('0x31')]);}return _0x559fa2[_0x941d('0xd9')](_0x5ab23b);}})['then'](function(_0x3cc8b5){if(_0x3cc8b5){return _0x3cc8b5?{'count':_0xa78c98,'rows':_0x3cc8b5}:null;}})[_0x941d('0x23')](respondWithResult(_0x25567f,null))[_0x941d('0x2b')](handleError(_0x25567f,null));};exports[_0x941d('0xdb')]=function(_0x2f1621,_0x15167d,_0x566d61){var _0x3a6a90={};var _0x135e32={};var _0x31fc40;var _0x190510;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x2f1621[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x15167d,null))[_0x941d('0x23')](function(_0x2e27e7){if(_0x2e27e7){_0x31fc40=_0x2e27e7;_0x135e32[_0x941d('0x4c')]=_[_0x941d('0x63')](db[_0x941d('0xdc')]['rawAttributes']);_0x135e32[_0x941d('0x50')]=_['keys'](_0x2f1621[_0x941d('0x50')]);_0x135e32['filters']=_['intersection'](_0x135e32[_0x941d('0x4c')],_0x135e32[_0x941d('0x50')]);_0x3a6a90['attributes']=_[_0x941d('0x51')](_0x135e32['model'],qs[_0x941d('0x52')](_0x2f1621[_0x941d('0x50')][_0x941d('0x52')]));_0x3a6a90['attributes']=_0x3a6a90[_0x941d('0x53')][_0x941d('0x65')]?_0x3a6a90[_0x941d('0x53')]:_0x135e32[_0x941d('0x4c')];_0x3a6a90[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x2f1621[_0x941d('0x50')][_0x941d('0x57')]);_0x3a6a90['where']=qs[_0x941d('0x64')](_['pick'](_0x2f1621['query'],_0x135e32[_0x941d('0x64')]));if(_0x2f1621[_0x941d('0x50')]['filter']){_0x3a6a90[_0x941d('0x58')]=_[_0x941d('0x59')](_0x3a6a90[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x3a6a90[_0x941d('0x53')],function(_0x3db16f){var _0x17e21d={};_0x17e21d[_0x3db16f]={'$like':'%'+_0x2f1621[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0x17e21d;})});}_0x3a6a90=_[_0x941d('0x59')]({},_0x3a6a90,_0x2f1621[_0x941d('0xc4')]);return _0x31fc40[_0x941d('0xdb')](_0x3a6a90);}})['then'](function(_0x5541f3){if(_0x5541f3){_0x190510=_0x5541f3[_0x941d('0x65')];if(!_0x2f1621[_0x941d('0x50')]['hasOwnProperty']('nolimit')){_0x3a6a90['limit']=qs[_0x941d('0x32')](_0x2f1621[_0x941d('0x50')][_0x941d('0x32')]);_0x3a6a90[_0x941d('0x31')]=qs[_0x941d('0x31')](_0x2f1621[_0x941d('0x50')][_0x941d('0x31')]);}return _0x31fc40[_0x941d('0xdb')](_0x3a6a90);}})[_0x941d('0x23')](function(_0x18da14){if(_0x18da14){return _0x18da14?{'count':_0x190510,'rows':_0x18da14}:null;}})[_0x941d('0x23')](respondWithResult(_0x15167d,null))[_0x941d('0x2b')](handleError(_0x15167d,null));};exports[_0x941d('0xdd')]=function(_0x3c4bf9,_0x5a3ec8,_0xfe3e2d){var _0x4f6c14={};var _0x52b927={};var _0x245ade;var _0x17e45a;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x3c4bf9[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x5a3ec8,null))[_0x941d('0x23')](function(_0xa2915e){if(_0xa2915e){_0x245ade=_0xa2915e;_0x52b927['model']=_['keys'](db[_0x941d('0xde')]['rawAttributes']);_0x52b927[_0x941d('0x50')]=_[_0x941d('0x63')](_0x3c4bf9['query']);_0x52b927[_0x941d('0x64')]=_[_0x941d('0x51')](_0x52b927['model'],_0x52b927['query']);_0x4f6c14[_0x941d('0x53')]=_[_0x941d('0x51')](_0x52b927[_0x941d('0x4c')],qs['fields'](_0x3c4bf9[_0x941d('0x50')]['fields']));_0x4f6c14[_0x941d('0x53')]=_0x4f6c14[_0x941d('0x53')][_0x941d('0x65')]?_0x4f6c14[_0x941d('0x53')]:_0x52b927['model'];_0x4f6c14['order']=qs['sort'](_0x3c4bf9[_0x941d('0x50')][_0x941d('0x57')]);_0x4f6c14[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x3c4bf9[_0x941d('0x50')],_0x52b927[_0x941d('0x64')]));if(_0x3c4bf9[_0x941d('0x50')][_0x941d('0x3d')]){_0x4f6c14[_0x941d('0x58')]=_[_0x941d('0x59')](_0x4f6c14[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x4f6c14['attributes'],function(_0x3ddf17){var _0x3a2ffb={};_0x3a2ffb[_0x3ddf17]={'$like':'%'+_0x3c4bf9['query'][_0x941d('0x3d')]+'%'};return _0x3a2ffb;})});}_0x4f6c14=_['merge']({},_0x4f6c14,_0x3c4bf9[_0x941d('0xc4')]);return _0x245ade['getWhatsappInteractions'](_0x4f6c14);}})['then'](function(_0x2e4649){if(_0x2e4649){_0x17e45a=_0x2e4649[_0x941d('0x65')];if(!_0x3c4bf9[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x4f6c14[_0x941d('0x32')]=qs[_0x941d('0x32')](_0x3c4bf9[_0x941d('0x50')]['limit']);_0x4f6c14['offset']=qs[_0x941d('0x31')](_0x3c4bf9[_0x941d('0x50')][_0x941d('0x31')]);}return _0x245ade[_0x941d('0xdd')](_0x4f6c14);}})[_0x941d('0x23')](function(_0x2583c7){if(_0x2583c7){return _0x2583c7?{'count':_0x17e45a,'rows':_0x2583c7}:null;}})[_0x941d('0x23')](respondWithResult(_0x5a3ec8,null))[_0x941d('0x2b')](handleError(_0x5a3ec8,null));};exports[_0x941d('0xdf')]=function(_0x3fe24b,_0x5c8725,_0x34a01d){var _0x13a14a;var _0x278671;var _0x53c016;var _0x390403=!_['isNil'](_0x3fe24b[_0x941d('0x62')]['id'])?_0x3fe24b[_0x941d('0x62')]['id']:!_['isNil'](_0x3fe24b[_0x941d('0x8a')]['id'])?_0x3fe24b[_0x941d('0x8a')]['id']:null;return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x390403,'role':{'$or':[_0x941d('0x39'),_0x941d('0x8a'),_0x941d('0x7c')]}},'attributes':['id','name',_0x941d('0xe0'),'mobile',_0x941d('0x38'),_0x941d('0x6d'),_0x941d('0xe1')]})[_0x941d('0x23')](function(_0xd52f41){if(_0xd52f41){if(_0xd52f41[_0x941d('0x38')]===_0x941d('0x7c')){_0x13a14a=_0xd52f41;if(_0x3fe24b['body'][_0x941d('0xa7')]){_0x53c016=util[_0x941d('0xb0')](_0x941d('0xe2'),_0x13a14a[_0x3fe24b[_0x941d('0x68')][_0x941d('0xa7')]]);}else if(_0x3fe24b[_0x941d('0x68')][_0x941d('0xe3')]){_0x53c016=util[_0x941d('0xb0')]('SIP/%s',_0x3fe24b['body'][_0x941d('0xe3')]);}else{_0x53c016=util[_0x941d('0xb0')](_0x941d('0xb1'),_0x13a14a['name']);}socket['to'](util[_0x941d('0xb0')](_0x941d('0xe4'),_0x13a14a[_0x941d('0x43')]))[_0x941d('0xe5')](_0x941d('0xe6'),{'ip':_0x3fe24b[_0x941d('0xe7')][_0x941d('0xe8')]||_0x3fe24b[_0x941d('0xe9')]['remoteAddress']||_0x3fe24b[_0x941d('0xea')][_0x941d('0xeb')]||_0x3fe24b['connection'][_0x941d('0xea')][_0x941d('0xeb')]});return db['UserVoiceQueueRt'][_0x941d('0x36')]({'where':{'membername':_0x13a14a[_0x941d('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x941d('0x99'))][(_0x941d('0x9a'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x941d('0x23')](function(){if(_0x13a14a){return _0x13a14a['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x19a952){if(_0x13a14a){var _0x591ccf=[];if(_0x19a952){_0x278671=_0x19a952;if(_0x278671[_0x941d('0x65')]){for(var _0x2cb7c9=0x0;_0x2cb7c9<_0x278671['length'];_0x2cb7c9++){_0x591ccf[_0x941d('0x95')]({'membername':_0x13a14a[_0x941d('0x43')],'UserId':_0x13a14a['id'],'queue_name':_0x278671[_0x2cb7c9]['name'],'VoiceQueueId':_0x278671[_0x2cb7c9]['id'],'interface':_0x53c016,'paused':_0x13a14a[_0x941d('0xe1')]||![],'penalty':_0x278671[_0x2cb7c9][_0x941d('0xec')]||0x0});}return BPromise[_0x941d('0x96')](_0x591ccf,function(_0xa67dca){return db[_0x941d('0xb2')][_0x941d('0xb3')](_0xa67dca);});}}}})[_0x941d('0x23')](function(){if(_0x13a14a){return db[_0x941d('0xed')][_0x941d('0x5f')]({'where':{'membername':_0x13a14a[_0x941d('0x43')],'exitAt':null}});}})[_0x941d('0x23')](function(_0x5b72c2){if(_0x13a14a){var _0x4c282a=[];_0x5b72c2[_0x941d('0xee')](function(_0x170bf1){_0x4c282a[_0x941d('0x95')](_0x170bf1[_0x941d('0x67')]({'exitAt':moment()[_0x941d('0xb0')](_0x941d('0xef'))}));});return BPromise[_0x941d('0x94')](_0x4c282a);}})[_0x941d('0x23')](function(){if(_0x13a14a){var _0x40f9fa=[];var _0x1720de=[];var _0x1be62c=utils[_0x941d('0xf0')]();var _0x3f08f6={'membername':_0x13a14a['name'],'interface':_0x53c016,'enterAt':moment()[_0x941d('0xb0')](_0x941d('0xef')),'role':_0x13a14a[_0x941d('0x38')],'internal':_0x13a14a[_0x941d('0x6d')]};_0x1be62c[_0x941d('0xee')](function(_0x5e2081){_0x40f9fa[_0x941d('0x95')](_[_0x941d('0x59')]({'channel':_0x5e2081,'type':_0x941d('0xf1'),'data1':_0x3fe24b[_0x941d('0x68')][_0x941d('0xf2')],'data2':_0x53c016},_0x3f08f6));if(_0x13a14a[_0x941d('0xe1')]){_0x1720de[_0x941d('0x95')](_['merge']({'channel':_0x5e2081,'type':'PAUSE','data1':_0x941d('0xf3')},_0x3f08f6));}});return db[_0x941d('0xed')][_0x941d('0xf4')](_0x40f9fa[_0x941d('0xf5')](_0x1720de),{'individualHooks':!![]});}})[_0x941d('0x23')](function(){if(_0x13a14a){return _0x13a14a['update']({'online':!![],'lastLoginAt':moment()['format'](_0x941d('0xef')),'voicePause':_0x13a14a[_0x941d('0xe1')]||![],'mailPause':_0x13a14a['loginInPause']||![],'chatPause':_0x13a14a[_0x941d('0xe1')]||![],'faxPause':_0x13a14a[_0x941d('0xe1')]||![],'smsPause':_0x13a14a[_0x941d('0xe1')]||![],'openchannelPause':_0x13a14a[_0x941d('0xe1')]||![],'whatsappPause':_0x13a14a[_0x941d('0xe1')]||![],'pauseType':_0x13a14a[_0x941d('0xe1')]?'LOGININPAUSE':null,'interface':_0x53c016,'lastPauseAt':moment()[_0x941d('0xb0')](_0x941d('0xef'))});}})[_0x941d('0x23')](function(_0x220717){if(_0x3fe24b[_0x941d('0xf6')]){return _0x34a01d();}else{return BPromise[_0x941d('0xf7')](_0x220717)[_0x941d('0x23')](respondWithResult(_0x5c8725,null));}})[_0x941d('0x2b')](handleError(_0x5c8725,null));};exports[_0x941d('0xf8')]=function(_0x23e3ac,_0x59b909,_0x32bcf7){var _0x1c14aa;return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x23e3ac[_0x941d('0x62')]['id'],'role':_0x941d('0x7c')},'attributes':['id','name',_0x941d('0x38')]})[_0x941d('0x23')](handleEntityNotFound(_0x59b909,null))[_0x941d('0x23')](function(_0x297894){if(_0x297894){_0x1c14aa=_0x297894;return db[_0x941d('0xb2')][_0x941d('0x36')]({'where':{'membername':_0x1c14aa[_0x941d('0x43')]},'individualHooks':!![]});}})['then'](function(){return db[_0x941d('0xed')]['findAll']({'where':{'membername':_0x1c14aa[_0x941d('0x43')],'exitAt':null}});})[_0x941d('0x23')](function(_0x403ca2){var _0x2163b2=[];_0x403ca2[_0x941d('0xee')](function(_0x3d9aa0){_0x2163b2[_0x941d('0x95')](_0x3d9aa0[_0x941d('0x67')]({'exitAt':moment()['format'](_0x941d('0xef'))}));});return BPromise[_0x941d('0x94')](_0x2163b2);})[_0x941d('0x23')](function(){return _0x1c14aa[_0x941d('0x67')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x941d('0x23')](respondWithResult(_0x59b909,null))[_0x941d('0x2b')](handleError(_0x59b909,null));};exports[_0x941d('0xf9')]=function(_0x563e9f,_0x25555e,_0x168ad7){var _0x4cf9d1;return db[_0x941d('0xb2')][_0x941d('0x67')]({'paused':0x1},{'where':{'UserId':_0x563e9f['params']['id']},'individualHooks':!![]})[_0x941d('0x23')](function(){return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x563e9f['params']['id'],'role':_0x941d('0x7c')},'attributes':['id','name','role',_0x941d('0x6d'),_0x941d('0xa7')]});})['then'](handleEntityNotFound(_0x25555e,null))[_0x941d('0x23')](function(_0x18f279){if(_0x18f279){_0x4cf9d1=_0x18f279;return respondWithRpcPromise(_0x941d('0xfa'),_0x941d('0xf9'),{'id':_0x4cf9d1['id'],'name':_0x4cf9d1[_0x941d('0x43')],'pause':!![]});}})[_0x941d('0x23')](function(){if(_0x4cf9d1){return db[_0x941d('0xed')][_0x941d('0x5f')]({'where':{'membername':_0x4cf9d1[_0x941d('0x43')],'type':_0x941d('0xfb'),'exitAt':null}});}})[_0x941d('0x23')](function(_0x42bccf){if(_0x42bccf[_0x941d('0x65')]){var _0x392186=moment()[_0x941d('0xb0')](_0x941d('0xef'));for(var _0x29466d=0x0,_0x3c27e3=_0x42bccf['length'];_0x29466d<_0x3c27e3;_0x29466d++){_0x42bccf[_0x29466d][_0x941d('0xfc')]({'exitAt':_0x392186});}}})[_0x941d('0x23')](function(){var _0xa7008c=[];var _0x551955=utils[_0x941d('0xf0')]();_0x551955[_0x941d('0xee')](function(_0x3256ac){_0xa7008c[_0x941d('0x95')]({'channel':_0x3256ac,'membername':_0x4cf9d1[_0x941d('0x43')],'interface':_[_0x941d('0x72')](_0x4cf9d1[_0x941d('0xa7')])?util[_0x941d('0xb0')](_0x941d('0xb1'),_0x4cf9d1[_0x941d('0x43')]):_0x4cf9d1[_0x941d('0xa7')],'type':'PAUSE','enterAt':moment()[_0x941d('0xb0')](_0x941d('0xef')),'data1':_0x563e9f[_0x941d('0x68')][_0x941d('0x4a')]||_0x941d('0xfd'),'role':_0x4cf9d1[_0x941d('0x38')],'internal':_0x4cf9d1[_0x941d('0x6d')]});});return db[_0x941d('0xed')][_0x941d('0xf4')](_0xa7008c,{'individualHooks':!![]});})['then'](function(){return _0x4cf9d1[_0x941d('0x67')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x563e9f['body'][_0x941d('0x4a')]||_0x941d('0xfd'),'lastPauseAt':moment()[_0x941d('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x941d('0x23')](respondWithResult(_0x25555e,null))[_0x941d('0x2b')](handleError(_0x25555e,null));};exports[_0x941d('0xfe')]=function(_0x43f42a,_0x24b48e,_0x338893){var _0x12a851;return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x43f42a[_0x941d('0x62')]['id']},'attributes':['id',_0x941d('0x43'),_0x941d('0x38'),_0x941d('0xa6'),_0x941d('0xff'),_0x941d('0x100'),_0x941d('0x101'),_0x941d('0x102'),_0x941d('0x103'),'whatsapppause',_0x941d('0x104'),_0x941d('0x105')]})[_0x941d('0x23')](handleEntityNotFound(_0x24b48e,null))[_0x941d('0x23')](function(_0x2886e9){if(_0x2886e9){_0x12a851=_0x2886e9;if(_0x43f42a[_0x941d('0x68')][_0x941d('0xa5')]&&!utils[_0x941d('0xcb')](_0x43f42a['body'][_0x941d('0xa5')])){throw new db[(_0x941d('0x99'))]['ValidationError'](_0x941d('0xb5'));}switch(_0x43f42a[_0x941d('0x68')][_0x941d('0xa5')]){case'voice':return respondWithRpcPromise(_0x941d('0xfa'),'unpause',{'id':_0x12a851['id'],'name':_0x12a851[_0x941d('0x43')],'pause':![]})[_0x941d('0x23')](function(){return db[_0x941d('0xb2')][_0x941d('0x67')]({'paused':0x0},{'where':{'UserId':_0x12a851['id']},'individualHooks':!![]});})[_0x941d('0x23')](function(){return db[_0x941d('0xed')][_0x941d('0x42')]({'where':{'channel':_0x43f42a[_0x941d('0x68')]['channel'],'membername':_0x12a851[_0x941d('0x43')],'type':'PAUSE','exitAt':null}});})[_0x941d('0x23')](function(_0x3bfc9){if(_0x3bfc9){return _0x3bfc9['update']({'exitAt':moment()[_0x941d('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x941d('0x106')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x12a851['update']({'voicePause':![]});});case _0x941d('0x107'):case _0x941d('0x108'):case _0x941d('0x109'):case _0x941d('0x10a'):case _0x941d('0x10b'):case _0x941d('0x10c'):return db[_0x941d('0xed')][_0x941d('0x42')]({'where':{'channel':_0x43f42a[_0x941d('0x68')][_0x941d('0xa5')],'membername':_0x12a851[_0x941d('0x43')],'type':'PAUSE','exitAt':null}})[_0x941d('0x23')](function(_0x3e751a){if(_0x3e751a){return _0x3e751a[_0x941d('0x67')]({'exitAt':moment()[_0x941d('0xb0')](_0x941d('0xef')),'data2':_0x941d('0x106')},{'individualHooks':!![]});}return null;})[_0x941d('0x23')](function(){var _0x205c22={};_['set'](_0x205c22,util[_0x941d('0xb0')](_0x941d('0x10d'),_0x43f42a['body'][_0x941d('0xa5')],_0x941d('0x10e')),![]);return _0x12a851[_0x941d('0x67')](_0x205c22);});default:return respondWithRpcPromise(_0x941d('0xfa'),_0x941d('0xfe'),{'id':_0x12a851['id'],'name':_0x12a851[_0x941d('0x43')],'pause':![]})[_0x941d('0x23')](function(){return db[_0x941d('0xb2')][_0x941d('0x67')]({'paused':0x0},{'where':{'UserId':_0x12a851['id']}});})[_0x941d('0x23')](function(){return db[_0x941d('0xed')][_0x941d('0x5f')]({'where':{'membername':_0x12a851['name'],'type':_0x941d('0xfb'),'exitAt':null}});})[_0x941d('0x23')](function(_0x284a0a){var _0x54435e=[];_0x284a0a[_0x941d('0xee')](function(_0x169831){_0x54435e[_0x941d('0x95')](_0x169831[_0x941d('0x67')]({'exitAt':moment()[_0x941d('0xb0')](_0x941d('0xef')),'data2':'manual'}));});return BPromise[_0x941d('0x94')](_0x54435e);})['then'](function(){return _0x12a851[_0x941d('0x67')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x941d('0x23')](respondWithResult(_0x24b48e,null))[_0x941d('0x2b')](handleError(_0x24b48e,null));};exports[_0x941d('0x10f')]=function(_0x2215e8,_0x423bd6,_0x19f721){var _0x3584a8={};var _0x2f262b={};var _0x31d754;var _0x1dc8e0;return db['User'][_0x941d('0xa0')]({'where':{'id':_0x2215e8[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x423bd6,null))['then'](function(_0x22a3a3){if(_0x22a3a3){_0x31d754=_0x22a3a3;_0x2f262b[_0x941d('0x4c')]=_[_0x941d('0x63')](db[_0x941d('0x110')][_0x941d('0x48')]);_0x2f262b[_0x941d('0x50')]=_[_0x941d('0x63')](_0x2215e8[_0x941d('0x50')]);_0x2f262b[_0x941d('0x64')]=_[_0x941d('0x51')](_0x2f262b[_0x941d('0x4c')],_0x2f262b['query']);_0x3584a8['attributes']=_['intersection'](_0x2f262b['model'],qs[_0x941d('0x52')](_0x2215e8[_0x941d('0x50')][_0x941d('0x52')]));_0x3584a8[_0x941d('0x53')]=_0x3584a8[_0x941d('0x53')][_0x941d('0x65')]?_0x3584a8[_0x941d('0x53')]:_0x2f262b['model'];_0x3584a8[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x2215e8[_0x941d('0x50')]['sort']);_0x3584a8[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x2215e8['query'],_0x2f262b[_0x941d('0x64')]));if(_0x2215e8[_0x941d('0x50')]['filter']){_0x3584a8['where']=_[_0x941d('0x59')](_0x3584a8[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x3584a8['attributes'],function(_0x4652e1){var _0x485319={};_0x485319[_0x4652e1]={'$like':'%'+_0x2215e8['query'][_0x941d('0x3d')]+'%'};return _0x485319;})});}_0x3584a8=_[_0x941d('0x59')]({},_0x3584a8,_0x2215e8[_0x941d('0xc4')]);return _0x31d754[_0x941d('0x10f')](_0x3584a8);}})[_0x941d('0x23')](function(_0x257722){if(_0x257722){_0x1dc8e0=_0x257722[_0x941d('0x65')];if(!_0x2215e8[_0x941d('0x50')][_0x941d('0x54')](_0x941d('0x55'))){_0x3584a8[_0x941d('0x32')]=qs[_0x941d('0x32')](_0x2215e8['query'][_0x941d('0x32')]);_0x3584a8[_0x941d('0x31')]=qs['offset'](_0x2215e8[_0x941d('0x50')][_0x941d('0x31')]);}return _0x31d754[_0x941d('0x10f')](_0x3584a8);}})[_0x941d('0x23')](function(_0x2970db){if(_0x2970db){return _0x2970db?{'count':_0x1dc8e0,'rows':_0x2970db}:null;}})['then'](respondWithResult(_0x423bd6,null))[_0x941d('0x2b')](handleError(_0x423bd6,null));};exports[_0x941d('0x111')]=function(_0x16fde9,_0x5edf5f){return db[_0x941d('0x47')][_0x941d('0x42')]({'where':{'id':_0x16fde9[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x5edf5f,null))['then'](function(_0x22a2e7){if(_0x22a2e7){var _0x3040a3=_0x22a2e7['get']({'plain':!![]});return _0x22a2e7['addTeams'](_0x16fde9['body'][_0x941d('0x6b')],_[_0x941d('0x6c')](_0x16fde9[_0x941d('0x68')],[_0x941d('0x6b'),'id'])||{})[_0x941d('0x23')](function(){for(var _0x2614a5=0x0;_0x2614a5<_0x16fde9[_0x941d('0x68')]['ids'][_0x941d('0x65')];_0x2614a5++){var _0x45ad9b=[];db[_0x941d('0x110')][_0x941d('0xa0')]({'where':{'id':_0x16fde9[_0x941d('0x68')][_0x941d('0x6b')][_0x2614a5]}})[_0x941d('0x23')](function(_0x1080a7){_0x45ad9b['push'](_0x1080a7[_0x941d('0x112')]()[_0x941d('0x23')](function(_0x2b3e40){for(var _0x57dabc=0x0;_0x57dabc<_0x2b3e40[_0x941d('0x65')];_0x57dabc++){_0x2b3e40[_0x57dabc][_0x941d('0x113')]('channel',_0x941d('0x114'));}return _0x2b3e40;}));_0x45ad9b['push'](_0x1080a7[_0x941d('0x115')]()[_0x941d('0x23')](function(_0x1be6a7){for(var _0x298b30=0x0;_0x298b30<_0x1be6a7[_0x941d('0x65')];_0x298b30++){_0x1be6a7[_0x298b30][_0x941d('0x113')]('channel',_0x941d('0x116'));}return _0x1be6a7;}));_0x45ad9b[_0x941d('0x95')](_0x1080a7[_0x941d('0x117')]()[_0x941d('0x23')](function(_0x2a4ff4){for(var _0x573cc9=0x0;_0x573cc9<_0x2a4ff4[_0x941d('0x65')];_0x573cc9++){_0x2a4ff4[_0x573cc9][_0x941d('0x113')]('channel',_0x941d('0x118'));}return _0x2a4ff4;}));_0x45ad9b['push'](_0x1080a7[_0x941d('0x119')]()[_0x941d('0x23')](function(_0x77c332){for(var _0x3b1a94=0x0;_0x3b1a94<_0x77c332[_0x941d('0x65')];_0x3b1a94++){_0x77c332[_0x3b1a94][_0x941d('0x113')](_0x941d('0xa5'),'Sms');}return _0x77c332;}));_0x45ad9b['push'](_0x1080a7[_0x941d('0x11a')]()['then'](function(_0x58077e){for(var _0x522aed=0x0;_0x522aed<_0x58077e['length'];_0x522aed++){_0x58077e[_0x522aed][_0x941d('0x113')](_0x941d('0xa5'),_0x941d('0x11b'));}return _0x58077e;}));_0x45ad9b[_0x941d('0x95')](_0x1080a7['getFaxQueues']()[_0x941d('0x23')](function(_0x371fe0){for(var _0x433f11=0x0;_0x433f11<_0x371fe0['length'];_0x433f11++){_0x371fe0[_0x433f11]['setDataValue'](_0x941d('0xa5'),'Fax');}return _0x371fe0;}));_0x45ad9b[_0x941d('0x95')](_0x1080a7[_0x941d('0x11c')]()[_0x941d('0x23')](function(_0xe0e8f3){for(var _0x4a3119=0x0;_0x4a3119<_0xe0e8f3['length'];_0x4a3119++){_0xe0e8f3[_0x4a3119][_0x941d('0x113')](_0x941d('0xa5'),'Openchannel');}return _0xe0e8f3;}));return BPromise[_0x941d('0x94')](_0x45ad9b);})['then'](function(_0x3e7e7a){var _0x27ea6b=_[_0x941d('0x11d')](_0x3e7e7a);_0x45ad9b=[];return db['sequelize'][_0x941d('0x11e')](function(_0x49ffea){for(var _0x5942d8=0x0;_0x5942d8<_0x27ea6b[_0x941d('0x65')];_0x5942d8++){_0x45ad9b[_0x941d('0x95')](_0x27ea6b[_0x5942d8]['addAgent'](_0x3040a3['id']),{'transaction':_0x49ffea});}return BPromise[_0x941d('0x94')](_0x45ad9b)[_0x941d('0x23')](function(){if(_0x3040a3['online']){return BPromise['each'](_[_0x941d('0x3d')](_0x27ea6b,function(_0x42d5a7){return _0x42d5a7[_0x941d('0x11f')](_0x941d('0xa5'))===_0x941d('0x114');}),function(_0x4e4785){return db[_0x941d('0xb2')]['upsert']({'membername':_0x3040a3[_0x941d('0x43')],'UserId':_0x3040a3['id'],'queue_name':_0x4e4785[_0x941d('0x43')],'VoiceQueueId':_0x4e4785['id'],'interface':_['isNil'](_0x3040a3['interface'])?util[_0x941d('0xb0')](_0x941d('0xb1'),_0x3040a3[_0x941d('0x43')]):_0x3040a3['interface'],'paused':_0x3040a3['voicePause']||![],'penalty':_0x3040a3[_0x941d('0xab')]},{'transaction':_0x49ffea});});}else{return;}})[_0x941d('0x23')](function(){for(var _0x3e2030=0x0;_0x3e2030<_0x27ea6b['length'];_0x3e2030++){var _0x3284f0=_0x27ea6b[_0x3e2030][_0x941d('0x11f')](_0x941d('0xa5'));var _0x532211=_0x3284f0+'QueueId';socket[_0x941d('0xe5')](_0x941d('0x8a')+_0x3284f0+'Queue:save',{'UserId':_0x3040a3['id'],['queueField']:_0x27ea6b[_0x3e2030]['id']});}});});});}});}})[_0x941d('0x23')](respondWithStatusCode(_0x5edf5f,null))[_0x941d('0x2b')](handleError(_0x5edf5f,null));};exports[_0x941d('0x120')]=function(_0x2e2268,_0x3b6fe8){return db[_0x941d('0x47')]['findOne']({'where':{'id':_0x2e2268[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x3b6fe8,null))[_0x941d('0x23')](function(_0x4c9b92){if(_0x4c9b92){var _0x4b2c04=_0x4c9b92[_0x941d('0x37')]({'plain':!![]});var _0x27493b=_0x2e2268[_0x941d('0x50')]['ids'];return _0x4c9b92[_0x941d('0x120')](_0x27493b)[_0x941d('0x23')](function(){for(var _0x111c04=0x0;_0x111c04<_0x27493b['length'];_0x111c04++){var _0x1a6ff5=[];db[_0x941d('0x110')]['findOne']({'where':{'id':_0x27493b[_0x111c04]}})[_0x941d('0x23')](function(_0xa954eb){_0x1a6ff5[_0x941d('0x95')](_0xa954eb[_0x941d('0x112')]()['then'](function(_0x132090){for(var _0x5d22b9=0x0;_0x5d22b9<_0x132090[_0x941d('0x65')];_0x5d22b9++){_0x132090[_0x5d22b9]['setDataValue']('channel',_0x941d('0x114'));}return _0x132090;}));_0x1a6ff5[_0x941d('0x95')](_0xa954eb[_0x941d('0x115')]()[_0x941d('0x23')](function(_0xe63647){for(var _0x13514f=0x0;_0x13514f<_0xe63647[_0x941d('0x65')];_0x13514f++){_0xe63647[_0x13514f][_0x941d('0x113')](_0x941d('0xa5'),'Chat');}return _0xe63647;}));_0x1a6ff5[_0x941d('0x95')](_0xa954eb[_0x941d('0x117')]()[_0x941d('0x23')](function(_0x46173f){for(var _0x525b20=0x0;_0x525b20<_0x46173f[_0x941d('0x65')];_0x525b20++){_0x46173f[_0x525b20]['setDataValue'](_0x941d('0xa5'),_0x941d('0x118'));}return _0x46173f;}));_0x1a6ff5[_0x941d('0x95')](_0xa954eb['getSmsQueues']()['then'](function(_0xe16e58){for(var _0xac3096=0x0;_0xac3096<_0xe16e58[_0x941d('0x65')];_0xac3096++){_0xe16e58[_0xac3096][_0x941d('0x113')](_0x941d('0xa5'),'Sms');}return _0xe16e58;}));_0x1a6ff5['push'](_0xa954eb['getWhatsappQueues']()[_0x941d('0x23')](function(_0x1bcb2a){for(var _0x44c996=0x0;_0x44c996<_0x1bcb2a[_0x941d('0x65')];_0x44c996++){_0x1bcb2a[_0x44c996]['setDataValue'](_0x941d('0xa5'),_0x941d('0x11b'));}return _0x1bcb2a;}));_0x1a6ff5[_0x941d('0x95')](_0xa954eb[_0x941d('0x121')]()['then'](function(_0x341453){for(var _0x11dfcb=0x0;_0x11dfcb<_0x341453[_0x941d('0x65')];_0x11dfcb++){_0x341453[_0x11dfcb]['setDataValue'](_0x941d('0xa5'),_0x941d('0x122'));}return _0x341453;}));_0x1a6ff5[_0x941d('0x95')](_0xa954eb[_0x941d('0x11c')]()[_0x941d('0x23')](function(_0x28dd1d){for(var _0x3cf774=0x0;_0x3cf774<_0x28dd1d[_0x941d('0x65')];_0x3cf774++){_0x28dd1d[_0x3cf774]['setDataValue'](_0x941d('0xa5'),_0x941d('0x123'));}return _0x28dd1d;}));return BPromise[_0x941d('0x94')](_0x1a6ff5);})[_0x941d('0x23')](function(_0x5c8514){var _0xeeabe=_[_0x941d('0x11d')](_0x5c8514);_0x1a6ff5=[];return db['sequelize'][_0x941d('0x11e')](function(_0x2e6489){for(var _0x267243=0x0;_0x267243<_0xeeabe['length'];_0x267243++){_0x1a6ff5[_0x941d('0x95')](_0xeeabe[_0x267243][_0x941d('0x124')](_0x4b2c04['id']),{'transaction':_0x2e6489});}return BPromise[_0x941d('0x94')](_0x1a6ff5)[_0x941d('0x23')](function(){if(_0x4b2c04[_0x941d('0xaf')]){return BPromise[_0x941d('0x96')](_[_0x941d('0x3d')](_0xeeabe,function(_0xa6d293){return _0xa6d293[_0x941d('0x11f')]('channel')===_0x941d('0x114');}),function(_0x1b9900){return db['UserVoiceQueueRt'][_0x941d('0x36')]({'where':{'VoiceQueueId':_0x1b9900['id'],'UserId':_0x4b2c04['id']},'transaction':_0x2e6489});});}else{return;}})['then'](function(){for(var _0x50750b=0x0;_0x50750b<_0xeeabe['length'];_0x50750b++){var _0x4f2c48=_0xeeabe[_0x50750b][_0x941d('0x11f')](_0x941d('0xa5'));var _0x518fe0=_0x4f2c48+'QueueId';socket['emit'](_0x941d('0x8a')+_0x4f2c48+_0x941d('0xb8'),{'UserId':_0x4b2c04['id'],['queueField']:_0xeeabe[_0x50750b]['id']});}});});});}});}})[_0x941d('0x23')](respondWithStatusCode(_0x3b6fe8,null))['catch'](handleError(_0x3b6fe8,null));};exports['getLists']=function(_0x2b5cb4,_0x7e98ba,_0x1ccbbc){var _0x1108e9={};var _0x4be963={};var _0x59ca9a;var _0x491153;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x2b5cb4['params']['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x7e98ba,null))[_0x941d('0x23')](function(_0x1c6e33){if(_0x1c6e33){_0x59ca9a=_0x1c6e33;_0x4be963[_0x941d('0x4c')]=_['keys'](db[_0x941d('0xc5')]['rawAttributes']);_0x4be963[_0x941d('0x50')]=_[_0x941d('0x63')](_0x2b5cb4[_0x941d('0x50')]);_0x4be963['filters']=_['intersection'](_0x4be963[_0x941d('0x4c')],_0x4be963[_0x941d('0x50')]);_0x1108e9[_0x941d('0x53')]=_[_0x941d('0x51')](_0x4be963[_0x941d('0x4c')],qs[_0x941d('0x52')](_0x2b5cb4['query'][_0x941d('0x52')]));_0x1108e9[_0x941d('0x53')]=_0x1108e9[_0x941d('0x53')][_0x941d('0x65')]?_0x1108e9[_0x941d('0x53')]:_0x4be963[_0x941d('0x4c')];_0x1108e9[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x2b5cb4[_0x941d('0x50')][_0x941d('0x57')]);_0x1108e9['where']=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x2b5cb4[_0x941d('0x50')],_0x4be963[_0x941d('0x64')]));if(_0x2b5cb4[_0x941d('0x50')][_0x941d('0x3d')]){_0x1108e9[_0x941d('0x58')]=_['merge'](_0x1108e9['where'],{'$or':_[_0x941d('0x3f')](_0x1108e9[_0x941d('0x53')],function(_0x3c1d8b){var _0x226717={};_0x226717[_0x3c1d8b]={'$like':'%'+_0x2b5cb4[_0x941d('0x50')][_0x941d('0x3d')]+'%'};return _0x226717;})});}_0x1108e9=_['merge']({},_0x1108e9,_0x2b5cb4[_0x941d('0xc4')]);return _0x59ca9a['getLists'](_0x1108e9);}})['then'](function(_0x21aeaf){if(_0x21aeaf){_0x491153=_0x21aeaf[_0x941d('0x65')];if(!_0x2b5cb4['query'][_0x941d('0x54')](_0x941d('0x55'))){_0x1108e9[_0x941d('0x32')]=qs['limit'](_0x2b5cb4[_0x941d('0x50')]['limit']);_0x1108e9['offset']=qs[_0x941d('0x31')](_0x2b5cb4[_0x941d('0x50')][_0x941d('0x31')]);}return _0x59ca9a[_0x941d('0x125')](_0x1108e9);}})[_0x941d('0x23')](function(_0x4bc3f){if(_0x4bc3f){return _0x4bc3f?{'count':_0x491153,'rows':_0x4bc3f}:null;}})['then'](respondWithResult(_0x7e98ba,null))[_0x941d('0x2b')](handleError(_0x7e98ba,null));};exports[_0x941d('0x126')]=function(_0x31393b,_0x17e9f2,_0x2a9170){var _0x1dc5f0={};var _0x1c4c35={};var _0x422486;var _0xd54179;return db[_0x941d('0x47')][_0x941d('0xa0')]({'where':{'id':_0x31393b[_0x941d('0x62')]['id']}})[_0x941d('0x23')](handleEntityNotFound(_0x17e9f2,null))[_0x941d('0x23')](function(_0x38968c){if(_0x38968c){_0x422486=_0x38968c;_0x1c4c35[_0x941d('0x4c')]=_['keys'](db[_0x941d('0x47')][_0x941d('0x48')]);_0x1c4c35[_0x941d('0x50')]=_[_0x941d('0x63')](_0x31393b[_0x941d('0x50')]);_0x1c4c35[_0x941d('0x64')]=_[_0x941d('0x51')](_0x1c4c35[_0x941d('0x4c')],_0x1c4c35[_0x941d('0x50')]);_0x1dc5f0['attributes']=_[_0x941d('0x51')](_0x1c4c35['model'],qs[_0x941d('0x52')](_0x31393b['query'][_0x941d('0x52')]));_0x1dc5f0['attributes']=_0x1dc5f0[_0x941d('0x53')][_0x941d('0x65')]?_0x1dc5f0[_0x941d('0x53')]:_0x1c4c35[_0x941d('0x4c')];_0x1dc5f0[_0x941d('0x56')]=qs[_0x941d('0x57')](_0x31393b[_0x941d('0x50')]['sort']);_0x1dc5f0[_0x941d('0x58')]=qs[_0x941d('0x64')](_[_0x941d('0xce')](_0x31393b[_0x941d('0x50')],_0x1c4c35[_0x941d('0x64')]));if(_0x31393b[_0x941d('0x50')][_0x941d('0x3d')]){_0x1dc5f0['where']=_[_0x941d('0x59')](_0x1dc5f0[_0x941d('0x58')],{'$or':_[_0x941d('0x3f')](_0x1dc5f0['attributes'],function(_0x3bcd26){var _0x286c76={};_0x286c76[_0x3bcd26]={'$like':'%'+_0x31393b[_0x941d('0x50')]['filter']+'%'};return _0x286c76;})});}_0x1dc5f0['model']=db['User'];_0x1dc5f0['as']=_0x941d('0x3a');_0x1dc5f0=_[_0x941d('0x59')]({},_0x1dc5f0,_0x31393b[_0x941d('0xc4')]);return _0x422486[_0x941d('0x112')]({'include':[_0x1dc5f0]});}})[_0x941d('0x23')](function(_0x2f6b6c){if(_0x2f6b6c){var _0x401676={},_0x4cbcc2=[],_0x58c8bb=0x0;for(var _0x2e680e=0x0;_0x2e680e<_0x2f6b6c[_0x941d('0x65')];_0x2e680e+=0x1){for(var _0x88b4f1=0x0,_0x3b235f;_0x88b4f1<_0x2f6b6c[_0x2e680e]['Agents'][_0x941d('0x65')];_0x88b4f1+=0x1){_0x3b235f=_0x2f6b6c[_0x2e680e]['Agents'][_0x88b4f1][_0x941d('0x37')]({'plain':!![]});_0x401676[_0x3b235f['id']]=_0x3b235f;}}_0x401676=_['values'](_0x401676);for(var _0x2ff5ea=qs[_0x941d('0x31')](_0x31393b['query'][_0x941d('0x31')]);_0x2ff5ea<_0x401676[_0x941d('0x65')]&&_0x4cbcc2['length']=_0x23a54b){_0x2a48c7=_0x23a54b;_0xca89f5=0xc8;}else{_0xca89f5=0xce;}_0x183267[_0x00e5('0x2b')](_0xca89f5);return _0x183267[_0x00e5('0x30')](_0x00e5('0x31'),_0x321bbf+'-'+_0x2a48c7+'/'+_0x23a54b)[_0x00e5('0x2d')](_0x1f58f6);}return null;};}function patchUpdates(_0x2c0507){return function(_0x306765){try{jsonpatch[_0x00e5('0x32')](_0x306765,_0x2c0507,!![]);}catch(_0x1f32a1){return BPromise['reject'](_0x1f32a1);}return _0x306765[_0x00e5('0x33')]();};}function saveUpdates(_0x5b9c44,_0x599192){return function(_0x531f94){if(_0x531f94){return _0x531f94[_0x00e5('0x34')](_0x5b9c44)[_0x00e5('0x35')](function(_0x5dbc0b){return _0x5dbc0b;});}return null;};}function removeEntity(_0x208db9,_0x582878){return function(_0x53090f){if(_0x53090f){return _0x53090f[_0x00e5('0x36')]()[_0x00e5('0x35')](function(){var _0x90e33e=_0x53090f[_0x00e5('0x37')]({'plain':!![]});if(_0x90e33e[_0x00e5('0x38')]===_0x00e5('0x39'))return;var _0x2f7926=[{'name':_0x00e5('0x3a'),'value':'user','ignore':!![]},{'name':_0x00e5('0x3b'),'value':_0x00e5('0x3c'),'ignore':![]},{'name':_0x00e5('0x3d'),'value':_0x00e5('0x3e'),'ignore':![]}];var _0x64a990=_(_0x2f7926)['filter']('ignore')[_0x00e5('0x3f')](_0x00e5('0x40'))[_0x00e5('0x40')]();if(_[_0x00e5('0x41')](_0x64a990,_0x90e33e['role'])){return;}var _0x165752=_[_0x00e5('0x42')](_0x2f7926,[_0x00e5('0x40'),_0x90e33e['role']])[_0x00e5('0x43')];return db[_0x00e5('0x44')][_0x00e5('0x36')]({'where':{'type':_0x165752,'resourceId':_0x90e33e['id']}})[_0x00e5('0x35')](function(){return _0x53090f;});})[_0x00e5('0x35')](function(){_0x208db9['status'](0xcc)[_0x00e5('0x2c')]();});}};}function handleEntityNotFound(_0x1e9104,_0x5962b2){return function(_0x15c47b){if(!_0x15c47b){_0x1e9104[_0x00e5('0x2a')](0x194);}return _0x15c47b;};}function handleError(_0x3d54ea,_0x2c715e){_0x2c715e=_0x2c715e||0x1f4;return function(_0x1a9d69){logger[_0x00e5('0x25')](_0x1a9d69[_0x00e5('0x45')]);if(_0x1a9d69['name']){delete _0x1a9d69[_0x00e5('0x43')];}_0x3d54ea['status'](_0x2c715e)[_0x00e5('0x46')](_0x1a9d69);};}exports[_0x00e5('0x47')]=function(_0x26a819,_0x3d2f90){var _0x36d103={},_0x23d9f5={},_0x5a9e23={'count':0x0,'rows':[]};var _0x3d3ed9=_[_0x00e5('0x3f')](db[_0x00e5('0x48')][_0x00e5('0x49')],function(_0x3bc8e5){return{'name':_0x3bc8e5[_0x00e5('0x4a')],'type':_0x3bc8e5['type'][_0x00e5('0x4b')]};});_0x23d9f5[_0x00e5('0x4c')]=_[_0x00e5('0x4d')](_['map'](_0x3d3ed9,'name'),['password',_0x00e5('0x4e')]);_0x23d9f5[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x26a819[_0x00e5('0x4f')]);_0x23d9f5['filters']=_[_0x00e5('0x51')](_0x23d9f5['model'],_0x23d9f5[_0x00e5('0x4f')]);_0x36d103[_0x00e5('0x52')]=_['intersection'](_0x23d9f5[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x26a819['query']['fields']));_0x36d103[_0x00e5('0x52')]=_0x36d103['attributes']['length']?_0x36d103['attributes']:_0x23d9f5[_0x00e5('0x4c')];if(!_0x26a819[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x36d103['limit']=qs[_0x00e5('0x2f')](_0x26a819[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x36d103['offset']=qs[_0x00e5('0x2e')](_0x26a819[_0x00e5('0x4f')]['offset']);}_0x36d103['order']=qs[_0x00e5('0x56')](_0x26a819[_0x00e5('0x4f')][_0x00e5('0x56')]);_0x36d103[_0x00e5('0x57')]=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x26a819[_0x00e5('0x4f')],_0x23d9f5[_0x00e5('0x58')]),_0x3d3ed9);if(_0x26a819[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x36d103[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x36d103['where'],{'$or':_['map'](_0x3d3ed9,function(_0x270357){if(_0x270357[_0x00e5('0x5c')]!==_0x00e5('0x5d')){return db[_0x00e5('0x5e')]['where'](db[_0x00e5('0x5e')]['fn'](_0x00e5('0x5f'),db[_0x00e5('0x5e')][_0x00e5('0x60')](_0x270357[_0x00e5('0x43')])),{'$like':db[_0x00e5('0x5e')]['fn'](_0x00e5('0x5f'),'%'+_0x26a819[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%')});}})});}_0x36d103=_['merge']({},_0x36d103,_0x26a819['options']);var _0x41dcf3={'where':_0x36d103['where']};return db[_0x00e5('0x48')][_0x00e5('0x61')](_0x41dcf3)['then'](function(_0x390dbe){_0x5a9e23[_0x00e5('0x61')]=_0x390dbe;if(_0x26a819[_0x00e5('0x4f')][_0x00e5('0x62')]){_0x36d103[_0x00e5('0x63')]=[{'all':!![]}];}return db[_0x00e5('0x48')][_0x00e5('0x64')](_0x36d103);})[_0x00e5('0x35')](function(_0x26f9cb){_0x5a9e23[_0x00e5('0x65')]=_0x26f9cb;return _0x5a9e23;})[_0x00e5('0x35')](respondWithFilteredResult(_0x3d2f90,_0x36d103))[_0x00e5('0x29')](handleError(_0x3d2f90,null));};exports['show']=function(_0x1d6cab,_0xf1cfba){var _0x25afdb={'raw':![],'where':{'id':_0x1d6cab[_0x00e5('0x66')]['id']}},_0x46fd4d={};_0x46fd4d[_0x00e5('0x4c')]=_['differenceBy'](_[_0x00e5('0x50')](db[_0x00e5('0x48')]['rawAttributes']),['password',_0x00e5('0x4e')]);_0x46fd4d[_0x00e5('0x4f')]=_['keys'](_0x1d6cab[_0x00e5('0x4f')]);_0x46fd4d['filters']=_['intersection'](_0x46fd4d[_0x00e5('0x4c')],_0x46fd4d[_0x00e5('0x4f')]);_0x25afdb[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x46fd4d[_0x00e5('0x4c')],qs['fields'](_0x1d6cab[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x25afdb[_0x00e5('0x52')]=_0x25afdb['attributes']['length']?_0x25afdb['attributes']:_0x46fd4d[_0x00e5('0x4c')];if(_0x1d6cab[_0x00e5('0x4f')][_0x00e5('0x62')]){_0x25afdb[_0x00e5('0x63')]=[{'all':!![]}];}_0x25afdb=_[_0x00e5('0x5b')]({},_0x25afdb,_0x1d6cab[_0x00e5('0x67')]);return db[_0x00e5('0x48')][_0x00e5('0x42')](_0x25afdb)['then'](handleEntityNotFound(_0xf1cfba,null))[_0x00e5('0x35')](respondWithResult(_0xf1cfba,null))[_0x00e5('0x29')](handleError(_0xf1cfba,null));};exports[_0x00e5('0x34')]=function(_0xf30b1c,_0x1cb242){if(_0xf30b1c['body']['id']){delete _0xf30b1c['body']['id'];}delete _0xf30b1c[_0x00e5('0x68')][_0x00e5('0x38')];return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0xf30b1c[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x1cb242,null))[_0x00e5('0x35')](saveUpdates(_0xf30b1c[_0x00e5('0x68')],null))['then'](respondWithResult(_0x1cb242,null))[_0x00e5('0x29')](handleError(_0x1cb242,null));};exports[_0x00e5('0x69')]=function(_0x3400f0,_0x55874c){return db[_0x00e5('0x48')][_0x00e5('0x69')]()[_0x00e5('0x35')](respondWithResult(_0x55874c,null))[_0x00e5('0x29')](handleError(_0x55874c,null));};exports[_0x00e5('0x6a')]=function(_0x368b27,_0xb0003c,_0x19d12b){return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0x368b27[_0x00e5('0x66')]['id']}})['then'](handleEntityNotFound(_0xb0003c,null))[_0x00e5('0x35')](function(_0x46198a){if(_0x46198a){return _0x46198a[_0x00e5('0x6a')](_0x368b27[_0x00e5('0x68')][_0x00e5('0x6b')],_['omit'](_0x368b27[_0x00e5('0x68')],['ids','id'])||{});}})[_0x00e5('0x35')](respondWithResult(_0xb0003c,null))['catch'](handleError(_0xb0003c,null));};function validateUser(_0x34fdd9){return new BPromise(function(_0x170194,_0x48c7f6){if(_0x34fdd9[_0x00e5('0x6c')])return _0x170194(_0x34fdd9);return db[_0x00e5('0x6d')][_0x00e5('0x6e')](0x1)[_0x00e5('0x35')](function(_0x17dc70){if(_0x17dc70[_0x00e5('0x6f')])authService[_0x00e5('0x70')](_0x34fdd9[_0x00e5('0x71')]);db['User'][_0x00e5('0x72')](_0x00e5('0x6c'))[_0x00e5('0x35')](function(_0x33bd72){if(_[_0x00e5('0x73')](_0x33bd72)){_0x34fdd9['internal']=_0x17dc70['min_internal']||0x1;return;}if(_[_0x00e5('0x73')](_0x17dc70[_0x00e5('0x74')])||_0x17dc70[_0x00e5('0x74')]===_0x33bd72){_0x34fdd9[_0x00e5('0x6c')]=_0x33bd72+0x1;return;}if(_0x17dc70[_0x00e5('0x74')]>_0x33bd72){_0x34fdd9[_0x00e5('0x6c')]=_0x17dc70[_0x00e5('0x74')];return;}return db[_0x00e5('0x5e')][_0x00e5('0x4f')](_0x00e5('0x75'),{'type':db[_0x00e5('0x5e')][_0x00e5('0x76')]['SELECT']})[_0x00e5('0x35')](function(_0x5d21b1){if(_0x5d21b1&&_0x5d21b1[_0x00e5('0x77')]){for(var _0x33cad4=0x0,_0x24d5a0=_0x5d21b1[_0x00e5('0x77')];_0x33cad4<_0x24d5a0&&_[_0x00e5('0x73')](_0x34fdd9[_0x00e5('0x6c')]);_0x33cad4++){if(_0x17dc70[_0x00e5('0x74')]<=_0x5d21b1[_0x33cad4][_0x00e5('0x78')]){_0x34fdd9['internal']=_0x5d21b1[_0x33cad4][_0x00e5('0x78')];}else if(_0x17dc70[_0x00e5('0x74')]>_0x5d21b1[_0x33cad4][_0x00e5('0x78')]&&_0x17dc70[_0x00e5('0x74')]<=_0x5d21b1[_0x33cad4]['to']){_0x34fdd9[_0x00e5('0x6c')]=_0x17dc70[_0x00e5('0x74')];}}}if(_[_0x00e5('0x73')](_0x34fdd9[_0x00e5('0x6c')])){_0x34fdd9[_0x00e5('0x6c')]=_0x33bd72+0x1;}return _0x170194(_0x34fdd9);});});})[_0x00e5('0x29')](function(_0x16b0b6){_0x48c7f6(_0x16b0b6);});});}function updateUser(_0x1f0249){return new BPromise(function(_0x37f723,_0x488140){try{if(_0x1f0249[_0x00e5('0x79')]){_0x1f0249['mailbox']=_0x1f0249[_0x00e5('0x6c')];_0x1f0249[_0x00e5('0x7a')]={'mailbox':_0x1f0249[_0x00e5('0x6c')],'password':_0x1f0249[_0x00e5('0x71')],'fullname':_0x1f0249[_0x00e5('0x7b')],'email':_0x1f0249['email']};}if(_0x1f0249[_0x00e5('0x38')]==='agent'){if(!_0x1f0249[_0x00e5('0x7c')])_0x1f0249['permissions']=['101',_0x00e5('0x7d'),_0x00e5('0x7e'),'113','110',_0x00e5('0x7f'),_0x00e5('0x80'),'106','107','108',_0x00e5('0x81'),_0x00e5('0x82'),_0x00e5('0x83'),_0x00e5('0x84')];}_0x37f723(_0x1f0249);}catch(_0x179a2c){_0x488140(_0x179a2c);}});}exports[_0x00e5('0x85')]=function(_0x2083c4,_0x434242){if(_0x2083c4[_0x00e5('0x86')]['role']===_0x00e5('0x3c'))throw new Error(_0x00e5('0x87'));if(_0x2083c4[_0x00e5('0x68')][_0x00e5('0x38')]===_0x00e5('0x86')&&_0x2083c4['user'][_0x00e5('0x38')]!==_0x00e5('0x39')){throw new Error(_0x00e5('0x88'));}if(_0x2083c4[_0x00e5('0x68')][_0x00e5('0x38')]==='admin'&&_0x2083c4[_0x00e5('0x86')]['role']!==_0x00e5('0x39')){throw new Error(_0x00e5('0x89'));}return licenseUtil[_0x00e5('0x8a')]([_0x2083c4[_0x00e5('0x68')]])['then'](function(){return validateUser(_0x2083c4[_0x00e5('0x68')]);})[_0x00e5('0x35')](function(_0x3206a6){return updateUser(_0x3206a6)[_0x00e5('0x35')](function(_0x223a5d){if(_0x223a5d['role']==='admin'){_0x223a5d['settingsEnabled']=_0x2083c4[_0x00e5('0x86')][_0x00e5('0x8b')];delete _0x223a5d[_0x00e5('0x8c')];}return _0x223a5d;});})['then'](function(_0x42a1ce){return db[_0x00e5('0x48')][_0x00e5('0x85')](_0x42a1ce,{'include':[{'model':db[_0x00e5('0x7a')],'as':'VoiceMail'}]});})[_0x00e5('0x35')](function(_0x4e3b8f){if(_0x2083c4['body'][_0x00e5('0x38')]===_0x00e5('0x86'))return _0x4e3b8f;if(_0x2083c4['user'][_0x00e5('0x38')]!==_0x00e5('0x86'))return _0x4e3b8f;return db[_0x00e5('0x8d')][_0x00e5('0x42')]({'where':{'name':_0x4e3b8f[_0x00e5('0x38')]===_0x00e5('0x3c')?_0x00e5('0x3b'):'Telephones','userProfileId':_0x2083c4[_0x00e5('0x86')]['userProfileId']},'raw':!![]})[_0x00e5('0x35')](function(_0x4a0101){if(!_0x4a0101||_0x4a0101[_0x00e5('0x8e')]!=0x0)return _0x4e3b8f;return db[_0x00e5('0x44')][_0x00e5('0x85')]({'name':_0x4e3b8f[_0x00e5('0x43')],'resourceId':_0x4e3b8f['id'],'type':_0x4a0101[_0x00e5('0x43')],'sectionId':_0x4a0101['id']},{})[_0x00e5('0x35')](function(){return _0x4e3b8f;});})[_0x00e5('0x29')](function(_0x441277){logger[_0x00e5('0x25')](_0x00e5('0x8f'),_0x441277);throw _0x441277;});})[_0x00e5('0x35')](respondWithResult(_0x434242,0xc9))[_0x00e5('0x29')](handleError(_0x434242,null));};exports[_0x00e5('0x90')]=function(_0x43f6fa,_0x3d8869){var _0x3118d8=_0x43f6fa[_0x00e5('0x68')];var _0x34af35=[];if(_0x43f6fa['user'][_0x00e5('0x38')]===_0x00e5('0x3c'))throw new Error('Unauthorized');if(_[_0x00e5('0x91')](_0x3118d8,[_0x00e5('0x38'),_0x00e5('0x86')])&&_0x43f6fa[_0x00e5('0x86')][_0x00e5('0x38')]!==_0x00e5('0x39')){throw new Error(_0x00e5('0x88'));}if(_[_0x00e5('0x91')](_0x3118d8,[_0x00e5('0x38'),'admin'])&&_0x43f6fa[_0x00e5('0x86')]['role']!=='admin'){throw new Error(_0x00e5('0x92'));}return licenseUtil[_0x00e5('0x8a')](_0x3118d8)[_0x00e5('0x35')](function(){return validateUser(_0x3118d8[0x0]);})[_0x00e5('0x35')](function(){for(var _0x90e6ff=0x1;_0x90e6ff<_0x3118d8['length'];_0x90e6ff++){var _0x52f6ea=_0x3118d8[_0x90e6ff-0x1][_0x00e5('0x6c')];if(!_0x3118d8[_0x90e6ff]['internal'])_0x3118d8[_0x90e6ff][_0x00e5('0x6c')]=_0x52f6ea+0x1;_0x34af35['push'](validateUser(_0x3118d8[_0x90e6ff]));}return BPromise[_0x00e5('0x93')](_0x34af35);})[_0x00e5('0x35')](function(){_0x34af35=[];for(var _0x53dcf3=0x0;_0x53dcf3<_0x3118d8[_0x00e5('0x77')];_0x53dcf3++){_0x34af35['push'](updateUser(_0x3118d8[_0x53dcf3]));}return BPromise['all'](_0x34af35);})[_0x00e5('0x35')](function(){return BPromise[_0x00e5('0x94')](_0x3118d8,function(_0x5b53cc){return db[_0x00e5('0x48')][_0x00e5('0x85')](_0x5b53cc,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x00e5('0x35')](function(_0x332320){_0x5b53cc['id']=_0x332320['id'];return _0x5b53cc;});});})[_0x00e5('0x35')](function(_0x23b616){if(_0x43f6fa[_0x00e5('0x68')]['role']===_0x00e5('0x86'))return _0x23b616;if(_0x43f6fa[_0x00e5('0x86')]['role']!==_0x00e5('0x86'))return _0x23b616;var _0x21a3b0=_[_0x00e5('0x91')](_0x23b616,function(_0x406a5d){return _0x406a5d[_0x00e5('0x38')]===_0x00e5('0x3c')||_0x406a5d[_0x00e5('0x38')]===_0x00e5('0x3e');});if(!_0x21a3b0)return _0x23b616;return db[_0x00e5('0x8d')][_0x00e5('0x64')]({'where':{'name':{'$or':[_0x00e5('0x3b'),_0x00e5('0x3d')]},'userProfileId':_0x43f6fa[_0x00e5('0x86')][_0x00e5('0x8c')]},'raw':!![]})[_0x00e5('0x35')](function(_0x5315f1){if(_[_0x00e5('0x95')](_0x5315f1)||!_[_0x00e5('0x91')](_0x5315f1,[_0x00e5('0x8e'),0x0]))return _0x23b616;_0x34af35=[];var _0x5a9951=_(_0x5315f1)[_0x00e5('0x3f')](function(_0x2b28e2){if(_0x2b28e2[_0x00e5('0x8e')]===0x1)return;return _0x2b28e2['name']==='Agents'?'agent':_0x00e5('0x3e');})['compact']()['value']();for(var _0x15cf47=0x0;_0x15cf47<_0x23b616[_0x00e5('0x77')];_0x15cf47++){if(!_[_0x00e5('0x41')](_0x5a9951,_0x23b616[_0x15cf47]['role']))return;var _0x4a11c7=_0x23b616[_0x15cf47][_0x00e5('0x38')]===_0x00e5('0x3c')?'Agents':_0x00e5('0x3d');_0x34af35['push'](db['UserProfileResource'][_0x00e5('0x85')]({'name':_0x23b616[_0x15cf47][_0x00e5('0x43')],'resourceId':_0x23b616[_0x15cf47]['id'],'type':_0x4a11c7,'sectionId':_[_0x00e5('0x42')](_0x5315f1,[_0x00e5('0x43'),_0x4a11c7])['id']},{}));}return BPromise[_0x00e5('0x93')](_0x34af35);})[_0x00e5('0x35')](respondWithResult(_0x3d8869,0xc9))['catch'](handleError(_0x3d8869,null));});};exports['changePassword']=function(_0x433c32,_0x42de76,_0x4526ab){if(_0x433c32[_0x00e5('0x68')]['id']){delete _0x433c32[_0x00e5('0x68')]['id'];}return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0x433c32[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](function(_0x3d1319){if(!_0x3d1319)return null;if(_0x3d1319['id']===_0x433c32[_0x00e5('0x86')]['id']){if(!_0x433c32[_0x00e5('0x68')][_0x00e5('0x96')]||!_0x433c32['body'][_0x00e5('0x97')]){throw new db['Sequelize'][(_0x00e5('0x98'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3d1319[_0x00e5('0x99')](_0x433c32[_0x00e5('0x68')]['oldPassword'])){throw new db[(_0x00e5('0x9a'))]['ValidationError'](_0x00e5('0x9b'));}if(_0x433c32[_0x00e5('0x68')][_0x00e5('0x96')]===_0x433c32[_0x00e5('0x68')][_0x00e5('0x97')]){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x433c32['user'][_0x00e5('0x38')]===_0x00e5('0x39')){if(!_0x433c32[_0x00e5('0x68')][_0x00e5('0x97')]){throw new db['Sequelize'][(_0x00e5('0x98'))](_0x00e5('0x9c'));}}else if(_0x433c32[_0x00e5('0x86')][_0x00e5('0x38')]==='user'){if(!_0x433c32[_0x00e5('0x68')]['newPassword']){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))](_0x00e5('0x9c'));}if(_0x3d1319[_0x00e5('0x38')]!==_0x00e5('0x3c')){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))]('Unauthorized');}}else{throw new db[(_0x00e5('0x9a'))]['ValidationError'](_0x00e5('0x87'));}return _0x3d1319;})[_0x00e5('0x35')](handleEntityNotFound(_0x42de76,null))[_0x00e5('0x35')](function(_0x32938e){return db['Setting'][_0x00e5('0x9d')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x00e5('0x9e')]})[_0x00e5('0x35')](function(_0x364348){if(_0x364348['securePassword'])authService[_0x00e5('0x70')](_0x433c32['body'][_0x00e5('0x97')]);if(!_0x364348[_0x00e5('0x9f')]||!_0x32938e[_0x00e5('0xa0')])return _0x32938e;authService['validatePasswordHistory'](_0x433c32[_0x00e5('0x68')][_0x00e5('0x97')],_0x32938e[_0x00e5('0xa0')],_0x364348['passwordHistoryLimit']);return _0x32938e;})['then'](saveUpdates({'password':_0x433c32[_0x00e5('0x68')][_0x00e5('0x97')],'passwordResetAt':_0x433c32[_0x00e5('0x86')]['id']==_0x433c32[_0x00e5('0x66')]['id']?moment():null,'previousPasswords':authService[_0x00e5('0xa1')](_0x433c32[_0x00e5('0x68')][_0x00e5('0x97')],_0x32938e[_0x00e5('0xa0')])},null));})[_0x00e5('0x35')](respondWithResult(_0x42de76,null))[_0x00e5('0x29')](handleError(_0x42de76,null));};exports[_0x00e5('0xa2')]=function(_0x461788,_0x1e5e77,_0x543596){var _0x14eb2c=_0x461788[_0x00e5('0x68')][_0x00e5('0xa3')];return db[_0x00e5('0x48')]['find']({'where':{'id':_0x461788[_0x00e5('0x66')]['id']},'attributes':['id',_0x00e5('0x43'),_0x00e5('0x38'),_0x00e5('0xa4'),_0x00e5('0xa5'),_0x00e5('0xa6'),_0x00e5('0xa7')]})[_0x00e5('0x35')](handleEntityNotFound(_0x1e5e77,null))['then'](function(_0x48ec8d){if(_0x48ec8d){if(!utils[_0x00e5('0xa8')](_0x14eb2c)){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))](_0x00e5('0xa9'));}return _0x48ec8d[_0x00e5('0xaa')+_[_0x00e5('0xab')](_0x14eb2c['toLowerCase']())+'Queues'](_0x461788[_0x00e5('0x68')]['ids'],{'penalty':_0x461788[_0x00e5('0x68')][_0x00e5('0xac')]||0x0})[_0x00e5('0xad')](function(_0x5abd6b){for(var _0x45eb92=0x0;_0x45eb92<_0x461788[_0x00e5('0x68')][_0x00e5('0x6b')]['length'];_0x45eb92+=0x1){var _0x44e061={'UserId':_0x461788[_0x00e5('0x66')]['id']};_0x44e061[_[_0x00e5('0xab')](_0x14eb2c[_0x00e5('0xae')]())+_0x00e5('0xaf')]=_0x461788[_0x00e5('0x68')]['ids'][_0x45eb92];socket[_0x00e5('0xb0')](_0x00e5('0x86')+_['capitalize'](_0x14eb2c['toLowerCase']())+'Queue:save',_0x44e061);}return _0x5abd6b;})[_0x00e5('0x35')](function(){if(_0x14eb2c===_0x00e5('0xb1')){return db[_0x00e5('0xb2')][_0x00e5('0x64')]({'where':{'id':_0x461788['body']['ids']||[]},'raw':!![],'attributes':['id',_0x00e5('0x43')]});}})['then'](function(_0x40b77b){var _0x4bec8b=_0x48ec8d[_0x00e5('0x37')]({'plain':!![]});var _0x20d92f=[];if(_0x14eb2c===_0x00e5('0xb1')&&_0x4bec8b[_0x00e5('0x38')]===_0x00e5('0x3c')&&_0x4bec8b[_0x00e5('0xa4')]){for(var _0x15a4a7=0x0;_0x15a4a7<_0x40b77b[_0x00e5('0x77')];_0x15a4a7+=0x1){_0x20d92f[_0x00e5('0xb3')]({'membername':_0x4bec8b[_0x00e5('0x43')],'UserId':_0x4bec8b['id'],'queue_name':_0x40b77b[_0x15a4a7][_0x00e5('0x43')],'VoiceQueueId':_0x40b77b[_0x15a4a7]['id'],'interface':_[_0x00e5('0x73')](_0x4bec8b[_0x00e5('0xa7')])?util[_0x00e5('0xb4')](_0x00e5('0xb5'),_0x4bec8b['name']):_0x4bec8b[_0x00e5('0xa7')],'paused':_0x4bec8b[_0x00e5('0xa6')]||![],'penalty':_0x461788[_0x00e5('0x68')][_0x00e5('0xac')]||0x0});}return BPromise[_0x00e5('0x94')](_0x20d92f,function(_0x54582f){return db[_0x00e5('0xb6')][_0x00e5('0xb7')](_0x54582f);});}return _0x48ec8d;});}})[_0x00e5('0x35')](respondWithStatusCode(_0x1e5e77,null))['catch'](handleError(_0x1e5e77,null));};exports[_0x00e5('0xb8')]=function(_0x4e327a,_0x43434d,_0xaafefb){var _0x2266d8;return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0x4e327a[_0x00e5('0x66')]['id']},'attributes':['id','name','role']})[_0x00e5('0x35')](handleEntityNotFound(_0x43434d,null))['then'](function(_0x1743c7){if(_0x1743c7){_0x2266d8=_0x1743c7;if(!_0x4e327a[_0x00e5('0x4f')]['channel']||!utils['isValidChannel'](_0x4e327a[_0x00e5('0x4f')][_0x00e5('0xa3')])){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))](_0x00e5('0xa9'));}return _0x1743c7[_0x00e5('0xb9')+_[_0x00e5('0xab')](_0x4e327a[_0x00e5('0x4f')][_0x00e5('0xa3')][_0x00e5('0xae')]())+_0x00e5('0xba')](_0x4e327a[_0x00e5('0x4f')][_0x00e5('0x6b')]);}})[_0x00e5('0x35')](function(_0x2052f7){for(var _0x4b5d75=0x0;_0x4b5d75<_0x4e327a['query'][_0x00e5('0x6b')]['length'];_0x4b5d75+=0x1){var _0x397586={'UserId':_0x4e327a[_0x00e5('0x66')]['id']};_0x397586[_[_0x00e5('0xab')](_0x4e327a[_0x00e5('0x4f')][_0x00e5('0xa3')]['toLowerCase']())+_0x00e5('0xaf')]=_0x4e327a[_0x00e5('0x4f')][_0x00e5('0x6b')][_0x4b5d75];socket[_0x00e5('0xb0')](_0x00e5('0x86')+_[_0x00e5('0xab')](_0x4e327a[_0x00e5('0x4f')][_0x00e5('0xa3')][_0x00e5('0xae')]())+_0x00e5('0xbb'),_0x397586);}return _0x2052f7;})[_0x00e5('0x35')](function(){if(_0x4e327a[_0x00e5('0x4f')][_0x00e5('0xa3')]===_0x00e5('0xb1')){return db['UserVoiceQueueRt'][_0x00e5('0x36')]({'where':{'UserId':_0x4e327a['params']['id'],'VoiceQueueId':_0x4e327a[_0x00e5('0x4f')][_0x00e5('0x6b')]},'individualHooks':!![]})['then'](function(){return _0x2266d8;});}return _0x2266d8;})['then'](respondWithStatusCode(_0x43434d,null))['catch'](handleError(_0x43434d,null));};exports['addAvatar']=function(_0x1f76d2,_0x2f38a1,_0x547288){_0x1f76d2['body'][_0x00e5('0xbc')]=_0x1f76d2[_0x00e5('0xbd')][_0x00e5('0xbe')];return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0x1f76d2[_0x00e5('0x66')]['id']}})['then'](handleEntityNotFound(_0x2f38a1,null))[_0x00e5('0x35')](saveUpdates(_0x1f76d2['body'],null))[_0x00e5('0x35')](respondWithResult(_0x2f38a1,null))[_0x00e5('0x29')](handleError(_0x2f38a1,null));};exports[_0x00e5('0xbf')]=function(_0x2f27e9,_0x1c1161,_0x91f626){var _0x2fa728=path['join'](config[_0x00e5('0xc0')],'server/files/images/logos/default_profile.png');return db[_0x00e5('0x48')]['find']({'where':{'id':_0x2f27e9[_0x00e5('0x66')]['id']},'attributes':['id',_0x00e5('0xbc')],'raw':!![]})[_0x00e5('0x35')](handleEntityNotFound(_0x1c1161,null))[_0x00e5('0x35')](function(_0x994de6){if(_0x994de6){if(_[_0x00e5('0x73')](_0x994de6['userpic'])){return _0x1c1161['download'](_0x2fa728);}else{if(!fs[_0x00e5('0xc1')](path[_0x00e5('0xc2')](config[_0x00e5('0xc0')],_0x00e5('0xc3'),_0x994de6[_0x00e5('0xbc')]))){return _0x1c1161[_0x00e5('0xc4')](_0x2fa728);}return _0x1c1161[_0x00e5('0xc4')](path[_0x00e5('0xc2')](config[_0x00e5('0xc0')],'server/files/images/',_0x994de6[_0x00e5('0xbc')]));}}})['catch'](handleError(_0x1c1161,null));};exports[_0x00e5('0xc5')]=function(_0x4e9bbd,_0x229b1d,_0x3c75e3){var _0x2cec34={};var _0x1854c1={};var _0x166ac6;var _0x3cc73c;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x4e9bbd[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x229b1d,null))[_0x00e5('0x35')](function(_0x53dc17){if(_0x53dc17){_0x166ac6=_0x53dc17;_0x1854c1[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xc6')][_0x00e5('0x49')]);_0x1854c1[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x4e9bbd['query']);_0x1854c1[_0x00e5('0x58')]=_['intersection'](_0x1854c1[_0x00e5('0x4c')],_0x1854c1['query']);_0x2cec34['attributes']=_['intersection'](_0x1854c1[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x2cec34[_0x00e5('0x52')]=_0x2cec34[_0x00e5('0x52')][_0x00e5('0x77')]?_0x2cec34[_0x00e5('0x52')]:_0x1854c1['model'];_0x2cec34[_0x00e5('0xc7')]=qs['sort'](_0x4e9bbd['query'][_0x00e5('0x56')]);_0x2cec34['where']=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x4e9bbd[_0x00e5('0x4f')],_0x1854c1[_0x00e5('0x58')]));if(_0x4e9bbd['query']['filter']){_0x2cec34[_0x00e5('0x57')]=_['merge'](_0x2cec34[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x2cec34['attributes'],function(_0x5a9566){var _0x5a118d={};_0x5a118d[_0x5a9566]={'$like':'%'+_0x4e9bbd['query'][_0x00e5('0x5a')]+'%'};return _0x5a118d;})});}_0x2cec34=_[_0x00e5('0x5b')]({},_0x2cec34,_0x4e9bbd[_0x00e5('0x67')]);return _0x166ac6['getContacts'](_0x2cec34);}})[_0x00e5('0x35')](function(_0x2bb796){if(_0x2bb796){_0x3cc73c=_0x2bb796[_0x00e5('0x77')];if(_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0x54')]('includeAll')){_0x2cec34[_0x00e5('0x63')]=[{'model':db[_0x00e5('0xc8')],'as':_0x00e5('0xc9'),'required':![]},{'model':db[_0x00e5('0xca')],'as':_0x00e5('0xcb'),'attributes':['id','name',_0x00e5('0xcc')],'where':_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0xcd')]?{'id':_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0xcd')]}:undefined,'required':_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0xcd')]?!![]:![]}];}if(!_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x2cec34['limit']=qs[_0x00e5('0x2f')](_0x4e9bbd['query'][_0x00e5('0x2f')]);_0x2cec34[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x4e9bbd[_0x00e5('0x4f')][_0x00e5('0x2e')]);}return _0x166ac6[_0x00e5('0xc5')](_0x2cec34);}})['then'](function(_0x12c59d){if(_0x12c59d){return _0x12c59d?{'count':_0x3cc73c,'rows':_0x12c59d}:null;}})[_0x00e5('0x35')](respondWithResult(_0x229b1d,null))[_0x00e5('0x29')](handleError(_0x229b1d,null));};exports['getQueues']=function(_0x40390f,_0x2a6045,_0x5524b8){var _0x4404a7;var _0x22919c;var _0x21c69b={};var _0x473e1e;return db['User'][_0x00e5('0x9d')]({'where':{'id':_0x40390f[_0x00e5('0x66')]['id']},'attributes':['id',_0x00e5('0x43'),_0x00e5('0x38')]})['then'](handleEntityNotFound(_0x2a6045,null))['then'](function(_0x246aee){if(!utils[_0x00e5('0xa8')](_0x40390f[_0x00e5('0x4f')]['channel'])){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))](_0x00e5('0xa9'));}_0x4404a7=_0x246aee;var _0x1bb26f={};_0x1bb26f[_0x00e5('0x4c')]=_['keys'](db[_[_0x00e5('0xab')](_0x40390f[_0x00e5('0x4f')]['channel'])+_0x00e5('0xce')][_0x00e5('0x49')]);_0x1bb26f[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x40390f['query']);_0x1bb26f[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x1bb26f[_0x00e5('0x4c')],_0x1bb26f['query']);_0x21c69b[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x1bb26f['model'],qs['fields'](_0x40390f[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x21c69b['attributes']=_0x21c69b[_0x00e5('0x52')][_0x00e5('0x77')]?_0x21c69b[_0x00e5('0x52')]:_0x1bb26f[_0x00e5('0x4c')];_0x21c69b[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x40390f['query'][_0x00e5('0x56')]);_0x21c69b['where']=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x40390f[_0x00e5('0x4f')],_0x1bb26f[_0x00e5('0x58')]));if(_0x40390f[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x21c69b[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x21c69b['where'],{'$or':_[_0x00e5('0x3f')](_0x21c69b['attributes'],function(_0x401e9a){var _0x5485f4={};_0x5485f4[_0x401e9a]={'$like':'%'+_0x40390f[_0x00e5('0x4f')]['filter']+'%'};return _0x5485f4;})});}_0x21c69b=_[_0x00e5('0x5b')]({},_0x21c69b,_0x40390f[_0x00e5('0x67')]);switch(_0x4404a7['role']){case _0x00e5('0x39'):return db[_[_0x00e5('0xab')](_0x40390f[_0x00e5('0x4f')][_0x00e5('0xa3')])+_0x00e5('0xce')][_0x00e5('0x64')](_0x21c69b);case _0x00e5('0x86'):case _0x00e5('0x3c'):return _0x4404a7[_0x00e5('0x37')+_['capitalize'](_0x40390f[_0x00e5('0x4f')][_0x00e5('0xa3')])+'Queues'](_0x21c69b);default:throw new db[(_0x00e5('0x9a'))]['ValidationError'](_0x00e5('0xcf'));}})[_0x00e5('0x35')](function(_0x51dfdf){_0x473e1e=_0x51dfdf[_0x00e5('0x77')];if(!_0x40390f[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x21c69b[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x40390f[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x21c69b[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x40390f['query'][_0x00e5('0x2e')]);}switch(_0x4404a7[_0x00e5('0x38')]){case _0x00e5('0x39'):return db[_[_0x00e5('0xab')](_0x40390f[_0x00e5('0x4f')][_0x00e5('0xa3')])+_0x00e5('0xce')][_0x00e5('0x64')](_0x21c69b);case _0x00e5('0x86'):case _0x00e5('0x3c'):return _0x4404a7['get'+_[_0x00e5('0xab')](_0x40390f[_0x00e5('0x4f')][_0x00e5('0xa3')])+_0x00e5('0xba')](_0x21c69b);}})[_0x00e5('0x35')](function(_0x5a7792){return{'count':_0x473e1e,'rows':_0x5a7792};})['then'](respondWithResult(_0x2a6045,null))[_0x00e5('0x29')](handleError(_0x2a6045,null));};exports[_0x00e5('0xd0')]=function(_0x2d8f38,_0x205a86,_0x512b7a){var _0x141a22={};var _0x84ac77={};var _0x5a8722;var _0x2946cf;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x2d8f38['params']['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x205a86,null))['then'](function(_0x26cc3e){if(_0x26cc3e){_0x5a8722=_0x26cc3e;_0x84ac77[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xb6')][_0x00e5('0x49')]);_0x84ac77['query']=_[_0x00e5('0x50')](_0x2d8f38['query']);_0x84ac77['filters']=_[_0x00e5('0x51')](_0x84ac77[_0x00e5('0x4c')],_0x84ac77[_0x00e5('0x4f')]);_0x141a22['attributes']=_['intersection'](_0x84ac77[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x2d8f38[_0x00e5('0x4f')]['fields']));_0x141a22['attributes']=_0x141a22[_0x00e5('0x52')][_0x00e5('0x77')]?_0x141a22[_0x00e5('0x52')]:_0x84ac77['model'];_0x141a22['order']=qs[_0x00e5('0x56')](_0x2d8f38['query'][_0x00e5('0x56')]);_0x141a22[_0x00e5('0x57')]=qs['filters'](_['pick'](_0x2d8f38['query'],_0x84ac77[_0x00e5('0x58')]));if(_0x2d8f38[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x141a22['where']=_['merge'](_0x141a22[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x141a22[_0x00e5('0x52')],function(_0xee5c86){var _0x8d12bb={};_0x8d12bb[_0xee5c86]={'$like':'%'+_0x2d8f38[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x8d12bb;})});}_0x141a22=_[_0x00e5('0x5b')]({},_0x141a22,_0x2d8f38[_0x00e5('0x67')]);return _0x5a8722[_0x00e5('0xd0')](_0x141a22);}})[_0x00e5('0x35')](function(_0x1855b8){if(_0x1855b8){_0x2946cf=_0x1855b8[_0x00e5('0x77')];if(!_0x2d8f38[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x141a22[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x2d8f38[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x141a22[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x2d8f38[_0x00e5('0x4f')][_0x00e5('0x2e')]);}return _0x5a8722[_0x00e5('0xd0')](_0x141a22);}})[_0x00e5('0x35')](function(_0x2448fa){if(_0x2448fa){return _0x2448fa?{'count':_0x2946cf,'rows':_0x2448fa}:null;}})[_0x00e5('0x35')](respondWithResult(_0x205a86,null))[_0x00e5('0x29')](handleError(_0x205a86,null));};exports[_0x00e5('0xd1')]=function(_0x5cf0e5,_0x2bd6d5,_0x50df27){var _0x15aa4b={};var _0x398f45={};var _0x3dfb3f;var _0x594e0f;return db['User'][_0x00e5('0x9d')]({'where':{'id':_0x5cf0e5[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x2bd6d5,null))[_0x00e5('0x35')](function(_0x5ee3c2){if(_0x5ee3c2){_0x3dfb3f=_0x5ee3c2;_0x398f45[_0x00e5('0x4c')]=_['keys'](db[_0x00e5('0xd2')][_0x00e5('0x49')]);_0x398f45['query']=_[_0x00e5('0x50')](_0x5cf0e5[_0x00e5('0x4f')]);_0x398f45[_0x00e5('0x58')]=_['intersection'](_0x398f45[_0x00e5('0x4c')],_0x398f45['query']);_0x15aa4b[_0x00e5('0x52')]=_['intersection'](_0x398f45[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x5cf0e5['query'][_0x00e5('0x53')]));_0x15aa4b[_0x00e5('0x52')]=_0x15aa4b['attributes'][_0x00e5('0x77')]?_0x15aa4b[_0x00e5('0x52')]:_0x398f45[_0x00e5('0x4c')];_0x15aa4b[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x5cf0e5[_0x00e5('0x4f')][_0x00e5('0x56')]);_0x15aa4b[_0x00e5('0x57')]=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x5cf0e5['query'],_0x398f45[_0x00e5('0x58')]));if(_0x5cf0e5[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x15aa4b[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x15aa4b[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x15aa4b[_0x00e5('0x52')],function(_0xfd5a6d){var _0x107abe={};_0x107abe[_0xfd5a6d]={'$like':'%'+_0x5cf0e5[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x107abe;})});}_0x15aa4b=_[_0x00e5('0x5b')]({},_0x15aa4b,_0x5cf0e5['options']);return _0x3dfb3f['getGroups'](_0x15aa4b);}})['then'](function(_0x3c7daa){if(_0x3c7daa){_0x594e0f=_0x3c7daa[_0x00e5('0x77')];if(!_0x5cf0e5['query']['hasOwnProperty'](_0x00e5('0x55'))){_0x15aa4b[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x5cf0e5[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x15aa4b[_0x00e5('0x2e')]=qs['offset'](_0x5cf0e5[_0x00e5('0x4f')][_0x00e5('0x2e')]);}return _0x3dfb3f['getGroups'](_0x15aa4b);}})[_0x00e5('0x35')](function(_0xe3b40b){if(_0xe3b40b){return _0xe3b40b?{'count':_0x594e0f,'rows':_0xe3b40b}:null;}})[_0x00e5('0x35')](respondWithResult(_0x2bd6d5,null))[_0x00e5('0x29')](handleError(_0x2bd6d5,null));};exports[_0x00e5('0xd3')]=function(_0x589217,_0x5b0c89,_0x49f5b7){var _0x141edb={'raw':!![],'where':{}};var _0x5635c9={};var _0x5065de={'count':0x0,'rows':[]};return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x589217[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x5b0c89,null))[_0x00e5('0x35')](function(_0x372d5e){if(_0x372d5e){_0x5635c9[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xd4')][_0x00e5('0x49')]);_0x5635c9[_0x00e5('0x4f')]=_['keys'](_0x589217['query']);_0x5635c9['filters']=_[_0x00e5('0x51')](_0x5635c9[_0x00e5('0x4c')],_0x5635c9['query']);_0x141edb[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x5635c9['model'],qs[_0x00e5('0x53')](_0x589217['query'][_0x00e5('0x53')]));_0x141edb[_0x00e5('0x52')]=_0x141edb[_0x00e5('0x52')][_0x00e5('0x77')]?_0x141edb[_0x00e5('0x52')]:_0x5635c9[_0x00e5('0x4c')];if(!_0x589217[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x141edb[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x589217[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x141edb[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x589217[_0x00e5('0x4f')][_0x00e5('0x2e')]);}_0x141edb[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x589217[_0x00e5('0x4f')][_0x00e5('0x56')]);_0x141edb['where']=qs[_0x00e5('0x58')](_['pick'](_0x589217[_0x00e5('0x4f')],_0x5635c9[_0x00e5('0x58')]));_0x141edb[_0x00e5('0x57')][_0x00e5('0xd5')]=_0x372d5e['id'];if(_0x589217[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x141edb[_0x00e5('0x57')]=_['merge'](_0x141edb[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x141edb[_0x00e5('0x52')],function(_0x2541f3){var _0x581fad={};_0x581fad[_0x2541f3]={'$like':'%'+_0x589217[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x581fad;})});}_0x141edb=_[_0x00e5('0x5b')]({},_0x141edb,_0x589217[_0x00e5('0x67')]);return db['VoiceRecording'][_0x00e5('0x61')]({'where':_0x141edb[_0x00e5('0x57')]})[_0x00e5('0x35')](function(_0x4767bc){_0x5065de[_0x00e5('0x61')]=_0x4767bc;if(_0x589217[_0x00e5('0x4f')][_0x00e5('0x62')]){_0x141edb[_0x00e5('0x63')]=[{'all':!![]}];}return db[_0x00e5('0xd4')][_0x00e5('0x64')](_0x141edb);})[_0x00e5('0x35')](function(_0x14510c){_0x5065de[_0x00e5('0x65')]=_0x14510c;return _0x5065de;});}})['then'](respondWithFilteredResult(_0x5b0c89,_0x141edb))['catch'](handleError(_0x5b0c89,null));};exports['getScreenRecordings']=function(_0x254ae7,_0x5c5c9d,_0x2d9145){var _0x292383={'raw':!![],'where':{}};var _0x11fe59={};var _0x47f6df={'count':0x0,'rows':[]};return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x254ae7['params']['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x5c5c9d,null))['then'](function(_0x8c1529){if(_0x8c1529){_0x11fe59[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xd6')][_0x00e5('0x49')]);_0x11fe59['query']=_[_0x00e5('0x50')](_0x254ae7[_0x00e5('0x4f')]);_0x11fe59[_0x00e5('0x58')]=_['intersection'](_0x11fe59[_0x00e5('0x4c')],_0x11fe59['query']);_0x292383[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x11fe59[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x254ae7['query'][_0x00e5('0x53')]));_0x292383[_0x00e5('0x52')]=_0x292383[_0x00e5('0x52')][_0x00e5('0x77')]?_0x292383['attributes']:_0x11fe59[_0x00e5('0x4c')];if(!_0x254ae7[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x292383['limit']=qs['limit'](_0x254ae7['query']['limit']);_0x292383['offset']=qs[_0x00e5('0x2e')](_0x254ae7[_0x00e5('0x4f')][_0x00e5('0x2e')]);}_0x292383[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x254ae7['query']['sort']);_0x292383['where']=qs[_0x00e5('0x58')](_['pick'](_0x254ae7['query'],_0x11fe59['filters']));_0x292383['where'][_0x00e5('0xd5')]=_0x8c1529['id'];if(_0x254ae7[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x292383[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x292383[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x292383['attributes'],function(_0x2974f1){var _0x1a6fe4={};_0x1a6fe4[_0x2974f1]={'$like':'%'+_0x254ae7['query'][_0x00e5('0x5a')]+'%'};return _0x1a6fe4;})});}_0x292383=_['merge']({},_0x292383,_0x254ae7[_0x00e5('0x67')]);return db[_0x00e5('0xd6')][_0x00e5('0x61')]({'where':_0x292383[_0x00e5('0x57')]})[_0x00e5('0x35')](function(_0x56212b){_0x47f6df[_0x00e5('0x61')]=_0x56212b;if(_0x254ae7[_0x00e5('0x4f')]['includeAll']){_0x292383[_0x00e5('0x63')]=[{'all':!![]}];}return db[_0x00e5('0xd6')][_0x00e5('0x64')](_0x292383);})[_0x00e5('0x35')](function(_0x3a1cf){_0x47f6df['rows']=_0x3a1cf;return _0x47f6df;});}})['then'](respondWithFilteredResult(_0x5c5c9d,_0x292383))[_0x00e5('0x29')](handleError(_0x5c5c9d,null));};exports[_0x00e5('0xd7')]=function(_0x783cdd,_0x58fb8e,_0x29b367){var _0x1b8ad4={};var _0x3f3a44={};var _0x1f5b78;var _0x1d4747;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x783cdd[_0x00e5('0x66')]['id']}})['then'](handleEntityNotFound(_0x58fb8e,null))[_0x00e5('0x35')](function(_0x164f97){if(_0x164f97){_0x1f5b78=_0x164f97;_0x3f3a44['model']=_[_0x00e5('0x50')](db[_0x00e5('0xd8')][_0x00e5('0x49')]);_0x3f3a44[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x783cdd[_0x00e5('0x4f')]);_0x3f3a44['filters']=_['intersection'](_0x3f3a44[_0x00e5('0x4c')],_0x3f3a44[_0x00e5('0x4f')]);_0x1b8ad4[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x3f3a44['model'],qs['fields'](_0x783cdd[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x1b8ad4[_0x00e5('0x52')]=_0x1b8ad4['attributes'][_0x00e5('0x77')]?_0x1b8ad4[_0x00e5('0x52')]:_0x3f3a44[_0x00e5('0x4c')];_0x1b8ad4[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x783cdd[_0x00e5('0x4f')][_0x00e5('0x56')]);_0x1b8ad4[_0x00e5('0x57')]=qs['filters'](_[_0x00e5('0x59')](_0x783cdd[_0x00e5('0x4f')],_0x3f3a44['filters']));if(_0x783cdd[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x1b8ad4[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x1b8ad4[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x1b8ad4[_0x00e5('0x52')],function(_0x54b661){var _0x5964d4={};_0x5964d4[_0x54b661]={'$like':'%'+_0x783cdd['query'][_0x00e5('0x5a')]+'%'};return _0x5964d4;})});}_0x1b8ad4=_[_0x00e5('0x5b')]({},_0x1b8ad4,_0x783cdd[_0x00e5('0x67')]);return _0x1f5b78['getChatInteractions'](_0x1b8ad4);}})[_0x00e5('0x35')](function(_0x408d61){if(_0x408d61){_0x1d4747=_0x408d61[_0x00e5('0x77')];if(!_0x783cdd[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x1b8ad4[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x783cdd[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x1b8ad4[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x783cdd['query']['offset']);}return _0x1f5b78[_0x00e5('0xd7')](_0x1b8ad4);}})[_0x00e5('0x35')](function(_0x591ac5){if(_0x591ac5){return _0x591ac5?{'count':_0x1d4747,'rows':_0x591ac5}:null;}})['then'](respondWithResult(_0x58fb8e,null))[_0x00e5('0x29')](handleError(_0x58fb8e,null));};exports['getOpenchannelInteractions']=function(_0x4c398b,_0x57ee09,_0x56eb23){var _0xf90740={};var _0xd6b10c={};var _0x39227d;var _0x8ce1a7;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x4c398b[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x57ee09,null))['then'](function(_0x461ee7){if(_0x461ee7){_0x39227d=_0x461ee7;_0xd6b10c[_0x00e5('0x4c')]=_['keys'](db['OpenchannelInteraction'][_0x00e5('0x49')]);_0xd6b10c[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x4c398b[_0x00e5('0x4f')]);_0xd6b10c[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0xd6b10c[_0x00e5('0x4c')],_0xd6b10c['query']);_0xf90740['attributes']=_[_0x00e5('0x51')](_0xd6b10c[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x4c398b[_0x00e5('0x4f')][_0x00e5('0x53')]));_0xf90740['attributes']=_0xf90740[_0x00e5('0x52')][_0x00e5('0x77')]?_0xf90740[_0x00e5('0x52')]:_0xd6b10c['model'];_0xf90740[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x4c398b[_0x00e5('0x4f')][_0x00e5('0x56')]);_0xf90740['where']=qs[_0x00e5('0x58')](_['pick'](_0x4c398b[_0x00e5('0x4f')],_0xd6b10c[_0x00e5('0x58')]));if(_0x4c398b['query'][_0x00e5('0x5a')]){_0xf90740[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0xf90740[_0x00e5('0x57')],{'$or':_['map'](_0xf90740[_0x00e5('0x52')],function(_0x14e643){var _0x463618={};_0x463618[_0x14e643]={'$like':'%'+_0x4c398b[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x463618;})});}_0xf90740=_['merge']({},_0xf90740,_0x4c398b[_0x00e5('0x67')]);return _0x39227d['getOpenchannelInteractions'](_0xf90740);}})[_0x00e5('0x35')](function(_0x4e7678){if(_0x4e7678){_0x8ce1a7=_0x4e7678[_0x00e5('0x77')];if(!_0x4c398b[_0x00e5('0x4f')][_0x00e5('0x54')]('nolimit')){_0xf90740[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x4c398b[_0x00e5('0x4f')]['limit']);_0xf90740[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x4c398b['query'][_0x00e5('0x2e')]);}return _0x39227d[_0x00e5('0xd9')](_0xf90740);}})['then'](function(_0x497afd){if(_0x497afd){return _0x497afd?{'count':_0x8ce1a7,'rows':_0x497afd}:null;}})[_0x00e5('0x35')](respondWithResult(_0x57ee09,null))[_0x00e5('0x29')](handleError(_0x57ee09,null));};exports[_0x00e5('0xda')]=function(_0x205665,_0x28dec1,_0x181793){var _0x57c418={'raw':!![],'where':{}};var _0x53844e={};var _0x5e895c={'count':0x0,'rows':[]};return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x205665[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x28dec1,null))[_0x00e5('0x35')](function(_0x1841d7){if(_0x1841d7){_0x53844e[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xdb')][_0x00e5('0x49')]);_0x53844e[_0x00e5('0x4f')]=_['keys'](_0x205665[_0x00e5('0x4f')]);_0x53844e[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x53844e[_0x00e5('0x4c')],_0x53844e['query']);_0x57c418[_0x00e5('0x52')]=_['intersection'](_0x53844e[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x205665[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x57c418[_0x00e5('0x52')]=_0x57c418['attributes']['length']?_0x57c418['attributes']:_0x53844e[_0x00e5('0x4c')];if(!_0x205665[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x57c418[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x205665[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x57c418[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x205665[_0x00e5('0x4f')][_0x00e5('0x2e')]);}_0x57c418['order']=qs['sort'](_0x205665['query'][_0x00e5('0x56')]);_0x57c418[_0x00e5('0x57')]=qs['filters'](_[_0x00e5('0x59')](_0x205665[_0x00e5('0x4f')],_0x53844e['filters']));_0x57c418[_0x00e5('0x57')][_0x00e5('0xd5')]=_0x1841d7['id'];if(_0x205665[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x57c418[_0x00e5('0x57')]=_['merge'](_0x57c418['where'],{'$or':_[_0x00e5('0x3f')](_0x57c418[_0x00e5('0x52')],function(_0x1eac87){var _0x4df79c={};_0x4df79c[_0x1eac87]={'$like':'%'+_0x205665[_0x00e5('0x4f')]['filter']+'%'};return _0x4df79c;})});}_0x57c418=_[_0x00e5('0x5b')]({},_0x57c418,_0x205665[_0x00e5('0x67')]);return db[_0x00e5('0xdb')][_0x00e5('0x61')]({'where':_0x57c418['where']})['then'](function(_0x482c69){_0x5e895c[_0x00e5('0x61')]=_0x482c69;if(_0x205665[_0x00e5('0x4f')][_0x00e5('0x62')]){_0x57c418[_0x00e5('0x63')]=[{'all':!![]}];}return db[_0x00e5('0xdb')][_0x00e5('0x64')](_0x57c418);})[_0x00e5('0x35')](function(_0x3128d2){_0x5e895c[_0x00e5('0x65')]=_0x3128d2;return _0x5e895c;});}})[_0x00e5('0x35')](respondWithFilteredResult(_0x28dec1,_0x57c418))['catch'](handleError(_0x28dec1,null));};exports['getSmsInteractions']=function(_0x5de0d5,_0x33d73a,_0x2cef60){var _0x37900d={};var _0x30a0f0={};var _0xaab4a6;var _0x15c0fd;return db[_0x00e5('0x48')]['findOne']({'where':{'id':_0x5de0d5[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x33d73a,null))[_0x00e5('0x35')](function(_0x2a2d51){if(_0x2a2d51){_0xaab4a6=_0x2a2d51;_0x30a0f0['model']=_['keys'](db['SmsInteraction'][_0x00e5('0x49')]);_0x30a0f0[_0x00e5('0x4f')]=_['keys'](_0x5de0d5[_0x00e5('0x4f')]);_0x30a0f0['filters']=_['intersection'](_0x30a0f0[_0x00e5('0x4c')],_0x30a0f0[_0x00e5('0x4f')]);_0x37900d[_0x00e5('0x52')]=_['intersection'](_0x30a0f0[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x5de0d5[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x37900d['attributes']=_0x37900d[_0x00e5('0x52')][_0x00e5('0x77')]?_0x37900d[_0x00e5('0x52')]:_0x30a0f0['model'];_0x37900d[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x5de0d5['query'][_0x00e5('0x56')]);_0x37900d[_0x00e5('0x57')]=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x5de0d5[_0x00e5('0x4f')],_0x30a0f0[_0x00e5('0x58')]));if(_0x5de0d5[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x37900d['where']=_[_0x00e5('0x5b')](_0x37900d[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x37900d[_0x00e5('0x52')],function(_0x30a69c){var _0x3801d5={};_0x3801d5[_0x30a69c]={'$like':'%'+_0x5de0d5[_0x00e5('0x4f')]['filter']+'%'};return _0x3801d5;})});}_0x37900d=_['merge']({},_0x37900d,_0x5de0d5[_0x00e5('0x67')]);return _0xaab4a6['getSmsInteractions'](_0x37900d);}})[_0x00e5('0x35')](function(_0x10ed7e){if(_0x10ed7e){_0x15c0fd=_0x10ed7e[_0x00e5('0x77')];if(!_0x5de0d5['query'][_0x00e5('0x54')](_0x00e5('0x55'))){_0x37900d[_0x00e5('0x2f')]=qs['limit'](_0x5de0d5[_0x00e5('0x4f')]['limit']);_0x37900d[_0x00e5('0x2e')]=qs['offset'](_0x5de0d5[_0x00e5('0x4f')][_0x00e5('0x2e')]);}return _0xaab4a6['getSmsInteractions'](_0x37900d);}})[_0x00e5('0x35')](function(_0x589cc0){if(_0x589cc0){return _0x589cc0?{'count':_0x15c0fd,'rows':_0x589cc0}:null;}})[_0x00e5('0x35')](respondWithResult(_0x33d73a,null))['catch'](handleError(_0x33d73a,null));};exports[_0x00e5('0xdc')]=function(_0x5d0949,_0x4d4174,_0x5d0d79){var _0x58830b={};var _0x73a2cc={};var _0x1c9a17;var _0x3323ee;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x5d0949['params']['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x4d4174,null))[_0x00e5('0x35')](function(_0x318e06){if(_0x318e06){_0x1c9a17=_0x318e06;_0x73a2cc[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xdd')][_0x00e5('0x49')]);_0x73a2cc['query']=_[_0x00e5('0x50')](_0x5d0949[_0x00e5('0x4f')]);_0x73a2cc[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x73a2cc[_0x00e5('0x4c')],_0x73a2cc[_0x00e5('0x4f')]);_0x58830b[_0x00e5('0x52')]=_['intersection'](_0x73a2cc[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x5d0949[_0x00e5('0x4f')]['fields']));_0x58830b['attributes']=_0x58830b[_0x00e5('0x52')][_0x00e5('0x77')]?_0x58830b['attributes']:_0x73a2cc[_0x00e5('0x4c')];_0x58830b['order']=qs[_0x00e5('0x56')](_0x5d0949[_0x00e5('0x4f')]['sort']);_0x58830b['where']=qs['filters'](_[_0x00e5('0x59')](_0x5d0949[_0x00e5('0x4f')],_0x73a2cc[_0x00e5('0x58')]));if(_0x5d0949[_0x00e5('0x4f')]['filter']){_0x58830b[_0x00e5('0x57')]=_['merge'](_0x58830b[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x58830b[_0x00e5('0x52')],function(_0x159ab1){var _0x1c1b7d={};_0x1c1b7d[_0x159ab1]={'$like':'%'+_0x5d0949['query']['filter']+'%'};return _0x1c1b7d;})});}_0x58830b=_[_0x00e5('0x5b')]({},_0x58830b,_0x5d0949[_0x00e5('0x67')]);return _0x1c9a17[_0x00e5('0xdc')](_0x58830b);}})[_0x00e5('0x35')](function(_0x221b78){if(_0x221b78){_0x3323ee=_0x221b78[_0x00e5('0x77')];if(!_0x5d0949[_0x00e5('0x4f')][_0x00e5('0x54')]('nolimit')){_0x58830b[_0x00e5('0x2f')]=qs['limit'](_0x5d0949[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x58830b[_0x00e5('0x2e')]=qs['offset'](_0x5d0949[_0x00e5('0x4f')]['offset']);}return _0x1c9a17[_0x00e5('0xdc')](_0x58830b);}})[_0x00e5('0x35')](function(_0x4f89e6){if(_0x4f89e6){return _0x4f89e6?{'count':_0x3323ee,'rows':_0x4f89e6}:null;}})[_0x00e5('0x35')](respondWithResult(_0x4d4174,null))[_0x00e5('0x29')](handleError(_0x4d4174,null));};exports[_0x00e5('0xde')]=function(_0x38ab07,_0x80e26b,_0x3f4815){var _0x30af6e={};var _0x3bbeb4={};var _0x4c104e;var _0x37a094;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x38ab07['params']['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x80e26b,null))[_0x00e5('0x35')](function(_0x3285b2){if(_0x3285b2){_0x4c104e=_0x3285b2;_0x3bbeb4[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xdf')][_0x00e5('0x49')]);_0x3bbeb4[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x38ab07['query']);_0x3bbeb4[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x3bbeb4['model'],_0x3bbeb4[_0x00e5('0x4f')]);_0x30af6e[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x3bbeb4[_0x00e5('0x4c')],qs['fields'](_0x38ab07['query'][_0x00e5('0x53')]));_0x30af6e['attributes']=_0x30af6e['attributes']['length']?_0x30af6e[_0x00e5('0x52')]:_0x3bbeb4[_0x00e5('0x4c')];_0x30af6e[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x38ab07[_0x00e5('0x4f')][_0x00e5('0x56')]);_0x30af6e[_0x00e5('0x57')]=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x38ab07['query'],_0x3bbeb4[_0x00e5('0x58')]));if(_0x38ab07[_0x00e5('0x4f')][_0x00e5('0x5a')]){_0x30af6e[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x30af6e[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x30af6e[_0x00e5('0x52')],function(_0x4800e2){var _0x2d4bc1={};_0x2d4bc1[_0x4800e2]={'$like':'%'+_0x38ab07[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x2d4bc1;})});}_0x30af6e=_[_0x00e5('0x5b')]({},_0x30af6e,_0x38ab07[_0x00e5('0x67')]);return _0x4c104e['getWhatsappInteractions'](_0x30af6e);}})[_0x00e5('0x35')](function(_0x3b57d3){if(_0x3b57d3){_0x37a094=_0x3b57d3['length'];if(!_0x38ab07[_0x00e5('0x4f')][_0x00e5('0x54')]('nolimit')){_0x30af6e['limit']=qs['limit'](_0x38ab07['query'][_0x00e5('0x2f')]);_0x30af6e[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x38ab07['query'][_0x00e5('0x2e')]);}return _0x4c104e['getWhatsappInteractions'](_0x30af6e);}})[_0x00e5('0x35')](function(_0xaaa736){if(_0xaaa736){return _0xaaa736?{'count':_0x37a094,'rows':_0xaaa736}:null;}})[_0x00e5('0x35')](respondWithResult(_0x80e26b,null))[_0x00e5('0x29')](handleError(_0x80e26b,null));};exports[_0x00e5('0xe0')]=function(_0x1f70f9,_0x3dbdcd,_0x40c358){var _0x5cd143;var _0x1c5296;var _0x284456;var _0x2cece8=!_[_0x00e5('0x73')](_0x1f70f9[_0x00e5('0x66')]['id'])?_0x1f70f9[_0x00e5('0x66')]['id']:!_[_0x00e5('0x73')](_0x1f70f9[_0x00e5('0x86')]['id'])?_0x1f70f9['user']['id']:null;return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0x2cece8,'role':{'$or':['admin','user',_0x00e5('0x3c')]}},'attributes':['id','name','phone',_0x00e5('0xe1'),'role',_0x00e5('0x6c'),_0x00e5('0xa5')]})['then'](function(_0x24b7b2){if(_0x24b7b2){if(_0x24b7b2[_0x00e5('0x38')]===_0x00e5('0x3c')){_0x5cd143=_0x24b7b2;if(_0x1f70f9[_0x00e5('0x68')]['interface']){_0x284456=util[_0x00e5('0xb4')](_0x00e5('0xe2'),_0x5cd143[_0x1f70f9[_0x00e5('0x68')][_0x00e5('0xa7')]]);}else if(_0x1f70f9['body'][_0x00e5('0xe3')]){_0x284456=util['format'](_0x00e5('0xb5'),_0x1f70f9[_0x00e5('0x68')][_0x00e5('0xe3')]);}else{_0x284456=util[_0x00e5('0xb4')](_0x00e5('0xb5'),_0x5cd143['name']);}socket['to'](util[_0x00e5('0xb4')](_0x00e5('0xe4'),_0x5cd143[_0x00e5('0x43')]))[_0x00e5('0xb0')](_0x00e5('0xe5'),{'ip':_0x1f70f9[_0x00e5('0xe6')][_0x00e5('0xe7')]||_0x1f70f9[_0x00e5('0xe8')][_0x00e5('0xe9')]||_0x1f70f9['socket'][_0x00e5('0xe9')]||_0x1f70f9[_0x00e5('0xe8')][_0x00e5('0xea')][_0x00e5('0xe9')]});return db[_0x00e5('0xb6')][_0x00e5('0x36')]({'where':{'membername':_0x5cd143[_0x00e5('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))](_0x00e5('0xeb'));}})[_0x00e5('0x35')](function(){if(_0x5cd143){return _0x5cd143['getVoiceQueues']({'raw':!![]});}})[_0x00e5('0x35')](function(_0x53708c){if(_0x5cd143){var _0x39e216=[];if(_0x53708c){_0x1c5296=_0x53708c;if(_0x1c5296[_0x00e5('0x77')]){for(var _0x510ba9=0x0;_0x510ba9<_0x1c5296[_0x00e5('0x77')];_0x510ba9++){_0x39e216[_0x00e5('0xb3')]({'membername':_0x5cd143['name'],'UserId':_0x5cd143['id'],'queue_name':_0x1c5296[_0x510ba9][_0x00e5('0x43')],'VoiceQueueId':_0x1c5296[_0x510ba9]['id'],'interface':_0x284456,'paused':_0x5cd143[_0x00e5('0xa5')]||![],'penalty':_0x1c5296[_0x510ba9][_0x00e5('0xec')]||0x0});}return BPromise[_0x00e5('0x94')](_0x39e216,function(_0x4e0f21){return db['UserVoiceQueueRt']['upsert'](_0x4e0f21);});}}}})[_0x00e5('0x35')](function(){if(_0x5cd143){return db[_0x00e5('0xed')][_0x00e5('0x64')]({'where':{'membername':_0x5cd143[_0x00e5('0x43')],'exitAt':null}});}})[_0x00e5('0x35')](function(_0x153341){if(_0x5cd143){var _0x3d72bc=[];_0x153341['forEach'](function(_0x588681){_0x3d72bc[_0x00e5('0xb3')](_0x588681['update']({'exitAt':moment()[_0x00e5('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x3d72bc);}})[_0x00e5('0x35')](function(){if(_0x5cd143){var _0x33c173=[];var _0x3f69c7=[];var _0x11188e=utils['getChannels']();var _0x3e3a7e={'membername':_0x5cd143[_0x00e5('0x43')],'interface':_0x284456,'enterAt':moment()['format'](_0x00e5('0xee')),'role':_0x5cd143['role'],'internal':_0x5cd143[_0x00e5('0x6c')]};_0x11188e[_0x00e5('0xef')](function(_0x18c030){_0x33c173[_0x00e5('0xb3')](_[_0x00e5('0x5b')]({'channel':_0x18c030,'type':_0x00e5('0xf0'),'data1':_0x1f70f9['body']['device'],'data2':_0x284456},_0x3e3a7e));if(_0x5cd143[_0x00e5('0xa5')]){_0x3f69c7[_0x00e5('0xb3')](_[_0x00e5('0x5b')]({'channel':_0x18c030,'type':'PAUSE','data1':_0x00e5('0xf1')},_0x3e3a7e));}});return db[_0x00e5('0xed')][_0x00e5('0x90')](_0x33c173[_0x00e5('0xf2')](_0x3f69c7),{'individualHooks':!![]});}})[_0x00e5('0x35')](function(){if(_0x5cd143){return _0x5cd143[_0x00e5('0x34')]({'online':!![],'lastLoginAt':moment()[_0x00e5('0xb4')](_0x00e5('0xee')),'voicePause':_0x5cd143[_0x00e5('0xa5')]||![],'mailPause':_0x5cd143[_0x00e5('0xa5')]||![],'chatPause':_0x5cd143[_0x00e5('0xa5')]||![],'faxPause':_0x5cd143[_0x00e5('0xa5')]||![],'smsPause':_0x5cd143[_0x00e5('0xa5')]||![],'openchannelPause':_0x5cd143[_0x00e5('0xa5')]||![],'whatsappPause':_0x5cd143['loginInPause']||![],'pauseType':_0x5cd143['loginInPause']?_0x00e5('0xf1'):null,'interface':_0x284456,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x00e5('0x35')](function(_0x31165c){if(_0x1f70f9[_0x00e5('0xf3')]){return _0x40c358();}else{return BPromise['resolve'](_0x31165c)[_0x00e5('0x35')](respondWithResult(_0x3dbdcd,null));}})[_0x00e5('0x29')](handleError(_0x3dbdcd,null));};exports[_0x00e5('0xf4')]=function(_0x33b74c,_0x70cafe,_0x57ab8c){var _0x356616;return db[_0x00e5('0x48')]['find']({'where':{'id':_0x33b74c[_0x00e5('0x66')]['id'],'role':_0x00e5('0x3c')},'attributes':['id',_0x00e5('0x43'),'role']})['then'](handleEntityNotFound(_0x70cafe,null))[_0x00e5('0x35')](function(_0x3ed673){if(_0x3ed673){_0x356616=_0x3ed673;return db[_0x00e5('0xb6')][_0x00e5('0x36')]({'where':{'membername':_0x356616[_0x00e5('0x43')]},'individualHooks':!![]});}})[_0x00e5('0x35')](function(){return db[_0x00e5('0xed')][_0x00e5('0x64')]({'where':{'membername':_0x356616[_0x00e5('0x43')],'exitAt':null}});})[_0x00e5('0x35')](function(_0x2cc879){var _0x54fec0=[];_0x2cc879['forEach'](function(_0x105498){_0x54fec0[_0x00e5('0xb3')](_0x105498[_0x00e5('0x34')]({'exitAt':moment()[_0x00e5('0xb4')](_0x00e5('0xee'))}));});return BPromise[_0x00e5('0x93')](_0x54fec0);})[_0x00e5('0x35')](function(){return _0x356616[_0x00e5('0x34')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x00e5('0x35')](respondWithResult(_0x70cafe,null))[_0x00e5('0x29')](handleError(_0x70cafe,null));};exports[_0x00e5('0xf5')]=function(_0xbe3afe,_0x5815b3,_0x17b981){var _0x5e4428;return db['UserVoiceQueueRt'][_0x00e5('0x34')]({'paused':0x1},{'where':{'UserId':_0xbe3afe[_0x00e5('0x66')]['id']},'individualHooks':!![]})[_0x00e5('0x35')](function(){return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0xbe3afe['params']['id'],'role':_0x00e5('0x3c')},'attributes':['id',_0x00e5('0x43'),'role','internal',_0x00e5('0xa7')]});})[_0x00e5('0x35')](handleEntityNotFound(_0x5815b3,null))[_0x00e5('0x35')](function(_0x579a75){if(_0x579a75){_0x5e4428=_0x579a75;return respondWithRpcPromise(_0x00e5('0xf6'),_0x00e5('0xf5'),{'id':_0x5e4428['id'],'name':_0x5e4428[_0x00e5('0x43')],'pause':!![]});}})[_0x00e5('0x35')](function(){if(_0x5e4428){return db[_0x00e5('0xed')][_0x00e5('0x64')]({'where':{'membername':_0x5e4428[_0x00e5('0x43')],'type':_0x00e5('0xf7'),'exitAt':null}});}})[_0x00e5('0x35')](function(_0x2b459d){if(_0x2b459d[_0x00e5('0x77')]){var _0x27f276=moment()[_0x00e5('0xb4')](_0x00e5('0xee'));for(var _0x3d38ce=0x0,_0x58e084=_0x2b459d[_0x00e5('0x77')];_0x3d38ce<_0x58e084;_0x3d38ce++){_0x2b459d[_0x3d38ce][_0x00e5('0xf8')]({'exitAt':_0x27f276});}}})['then'](function(){var _0x2917bb=[];var _0x523c47=utils[_0x00e5('0xf9')]();_0x523c47[_0x00e5('0xef')](function(_0x6f5d06){_0x2917bb[_0x00e5('0xb3')]({'channel':_0x6f5d06,'membername':_0x5e4428[_0x00e5('0x43')],'interface':_[_0x00e5('0x73')](_0x5e4428[_0x00e5('0xa7')])?util[_0x00e5('0xb4')](_0x00e5('0xb5'),_0x5e4428[_0x00e5('0x43')]):_0x5e4428[_0x00e5('0xa7')],'type':_0x00e5('0xf7'),'enterAt':moment()[_0x00e5('0xb4')](_0x00e5('0xee')),'data1':_0xbe3afe[_0x00e5('0x68')][_0x00e5('0x5c')]||_0x00e5('0xfa'),'role':_0x5e4428[_0x00e5('0x38')],'internal':_0x5e4428[_0x00e5('0x6c')]});});return db[_0x00e5('0xed')]['bulkCreate'](_0x2917bb,{'individualHooks':!![]});})['then'](function(){return _0x5e4428[_0x00e5('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xbe3afe[_0x00e5('0x68')][_0x00e5('0x5c')]||_0x00e5('0xfa'),'lastPauseAt':moment()[_0x00e5('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x00e5('0x35')](respondWithResult(_0x5815b3,null))[_0x00e5('0x29')](handleError(_0x5815b3,null));};exports[_0x00e5('0xfb')]=function(_0xe0bde1,_0x19abb0,_0x1a730f){var _0x345d07;return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0xe0bde1['params']['id']},'attributes':['id','name','role','voicePause','mailPause',_0x00e5('0xfc'),_0x00e5('0xfd'),_0x00e5('0xfe'),_0x00e5('0xff'),_0x00e5('0x100'),_0x00e5('0x101'),_0x00e5('0x102')]})[_0x00e5('0x35')](handleEntityNotFound(_0x19abb0,null))['then'](function(_0x589268){if(_0x589268){_0x345d07=_0x589268;if(_0xe0bde1[_0x00e5('0x68')][_0x00e5('0xa3')]&&!utils['isValidChannel'](_0xe0bde1['body'][_0x00e5('0xa3')])){throw new db[(_0x00e5('0x9a'))][(_0x00e5('0x98'))](_0x00e5('0xa9'));}switch(_0xe0bde1[_0x00e5('0x68')][_0x00e5('0xa3')]){case'voice':return respondWithRpcPromise('QueuePause',_0x00e5('0xfb'),{'id':_0x345d07['id'],'name':_0x345d07[_0x00e5('0x43')],'pause':![]})[_0x00e5('0x35')](function(){return db[_0x00e5('0xb6')][_0x00e5('0x34')]({'paused':0x0},{'where':{'UserId':_0x345d07['id']},'individualHooks':!![]});})[_0x00e5('0x35')](function(){return db['MemberReport'][_0x00e5('0x42')]({'where':{'channel':_0xe0bde1[_0x00e5('0x68')]['channel'],'membername':_0x345d07[_0x00e5('0x43')],'type':_0x00e5('0xf7'),'exitAt':null}});})[_0x00e5('0x35')](function(_0x9c788f){if(_0x9c788f){return _0x9c788f[_0x00e5('0x34')]({'exitAt':moment()[_0x00e5('0xb4')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x00e5('0x103')},{'individualHooks':!![]});}return null;})[_0x00e5('0x35')](function(){return _0x345d07[_0x00e5('0x34')]({'voicePause':![]});});case _0x00e5('0x104'):case _0x00e5('0x105'):case _0x00e5('0x106'):case _0x00e5('0x107'):case _0x00e5('0x108'):case'openchannel':return db[_0x00e5('0xed')]['find']({'where':{'channel':_0xe0bde1['body'][_0x00e5('0xa3')],'membername':_0x345d07[_0x00e5('0x43')],'type':_0x00e5('0xf7'),'exitAt':null}})[_0x00e5('0x35')](function(_0x59cfc1){if(_0x59cfc1){return _0x59cfc1['update']({'exitAt':moment()[_0x00e5('0xb4')](_0x00e5('0xee')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x00e5('0x35')](function(){var _0x403cd7={};_[_0x00e5('0x30')](_0x403cd7,util['format'](_0x00e5('0x109'),_0xe0bde1['body'][_0x00e5('0xa3')],_0x00e5('0x10a')),![]);return _0x345d07[_0x00e5('0x34')](_0x403cd7);});default:return respondWithRpcPromise('QueuePause',_0x00e5('0xfb'),{'id':_0x345d07['id'],'name':_0x345d07[_0x00e5('0x43')],'pause':![]})[_0x00e5('0x35')](function(){return db[_0x00e5('0xb6')][_0x00e5('0x34')]({'paused':0x0},{'where':{'UserId':_0x345d07['id']}});})[_0x00e5('0x35')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x345d07['name'],'type':'PAUSE','exitAt':null}});})[_0x00e5('0x35')](function(_0xdde441){var _0x4e8497=[];_0xdde441['forEach'](function(_0x382a47){_0x4e8497[_0x00e5('0xb3')](_0x382a47[_0x00e5('0x34')]({'exitAt':moment()['format'](_0x00e5('0xee')),'data2':'manual'}));});return BPromise[_0x00e5('0x93')](_0x4e8497);})[_0x00e5('0x35')](function(){return _0x345d07[_0x00e5('0x34')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x00e5('0x35')](respondWithResult(_0x19abb0,null))['catch'](handleError(_0x19abb0,null));};exports[_0x00e5('0x10b')]=function(_0x3488e4,_0x4079bf,_0x3bb280){var _0x3e0a5c={};var _0x35c254={};var _0x4d9064;var _0x415421;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x3488e4[_0x00e5('0x66')]['id']}})['then'](handleEntityNotFound(_0x4079bf,null))[_0x00e5('0x35')](function(_0x383014){if(_0x383014){_0x4d9064=_0x383014;_0x35c254[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0x10c')]['rawAttributes']);_0x35c254['query']=_[_0x00e5('0x50')](_0x3488e4[_0x00e5('0x4f')]);_0x35c254[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x35c254['model'],_0x35c254['query']);_0x3e0a5c[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x35c254[_0x00e5('0x4c')],qs['fields'](_0x3488e4[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x3e0a5c[_0x00e5('0x52')]=_0x3e0a5c['attributes']['length']?_0x3e0a5c['attributes']:_0x35c254['model'];_0x3e0a5c[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x3488e4['query']['sort']);_0x3e0a5c[_0x00e5('0x57')]=qs[_0x00e5('0x58')](_['pick'](_0x3488e4['query'],_0x35c254[_0x00e5('0x58')]));if(_0x3488e4['query'][_0x00e5('0x5a')]){_0x3e0a5c[_0x00e5('0x57')]=_['merge'](_0x3e0a5c[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x3e0a5c[_0x00e5('0x52')],function(_0x414ed7){var _0x3d867c={};_0x3d867c[_0x414ed7]={'$like':'%'+_0x3488e4[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x3d867c;})});}_0x3e0a5c=_[_0x00e5('0x5b')]({},_0x3e0a5c,_0x3488e4['options']);return _0x4d9064[_0x00e5('0x10b')](_0x3e0a5c);}})[_0x00e5('0x35')](function(_0x3ce425){if(_0x3ce425){_0x415421=_0x3ce425[_0x00e5('0x77')];if(!_0x3488e4['query']['hasOwnProperty'](_0x00e5('0x55'))){_0x3e0a5c[_0x00e5('0x2f')]=qs[_0x00e5('0x2f')](_0x3488e4['query']['limit']);_0x3e0a5c[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x3488e4[_0x00e5('0x4f')]['offset']);}return _0x4d9064[_0x00e5('0x10b')](_0x3e0a5c);}})[_0x00e5('0x35')](function(_0x1fd98e){if(_0x1fd98e){return _0x1fd98e?{'count':_0x415421,'rows':_0x1fd98e}:null;}})[_0x00e5('0x35')](respondWithResult(_0x4079bf,null))[_0x00e5('0x29')](handleError(_0x4079bf,null));};exports[_0x00e5('0x10d')]=function(_0xa47caf,_0x21f5b8){return db[_0x00e5('0x48')][_0x00e5('0x42')]({'where':{'id':_0xa47caf[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x21f5b8,null))[_0x00e5('0x35')](function(_0x1f26d9){if(_0x1f26d9){var _0x285bf8=_0x1f26d9[_0x00e5('0x37')]({'plain':!![]});return _0x1f26d9['addTeams'](_0xa47caf['body'][_0x00e5('0x6b')],_[_0x00e5('0x10e')](_0xa47caf[_0x00e5('0x68')],[_0x00e5('0x6b'),'id'])||{})['then'](function(){for(var _0x354367=0x0;_0x354367<_0xa47caf['body'][_0x00e5('0x6b')][_0x00e5('0x77')];_0x354367++){var _0x4f462e=[];db[_0x00e5('0x10c')][_0x00e5('0x9d')]({'where':{'id':_0xa47caf[_0x00e5('0x68')][_0x00e5('0x6b')][_0x354367]}})[_0x00e5('0x35')](function(_0x36f867){_0x4f462e[_0x00e5('0xb3')](_0x36f867[_0x00e5('0x10f')]()[_0x00e5('0x35')](function(_0x2c25b5){for(var _0x235eb7=0x0;_0x235eb7<_0x2c25b5['length'];_0x235eb7++){_0x2c25b5[_0x235eb7][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x111'));}return _0x2c25b5;}));_0x4f462e['push'](_0x36f867['getChatQueues']()['then'](function(_0x41165e){for(var _0x584172=0x0;_0x584172<_0x41165e[_0x00e5('0x77')];_0x584172++){_0x41165e[_0x584172][_0x00e5('0x110')]('channel',_0x00e5('0x112'));}return _0x41165e;}));_0x4f462e['push'](_0x36f867[_0x00e5('0x113')]()[_0x00e5('0x35')](function(_0x463f8f){for(var _0x53a0ff=0x0;_0x53a0ff<_0x463f8f[_0x00e5('0x77')];_0x53a0ff++){_0x463f8f[_0x53a0ff][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x114'));}return _0x463f8f;}));_0x4f462e[_0x00e5('0xb3')](_0x36f867['getSmsQueues']()[_0x00e5('0x35')](function(_0x103214){for(var _0x4d3d31=0x0;_0x4d3d31<_0x103214['length'];_0x4d3d31++){_0x103214[_0x4d3d31][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x115'));}return _0x103214;}));_0x4f462e['push'](_0x36f867['getWhatsappQueues']()[_0x00e5('0x35')](function(_0x3c35fb){for(var _0x3088ed=0x0;_0x3088ed<_0x3c35fb[_0x00e5('0x77')];_0x3088ed++){_0x3c35fb[_0x3088ed][_0x00e5('0x110')]('channel','Whatsapp');}return _0x3c35fb;}));_0x4f462e['push'](_0x36f867[_0x00e5('0x116')]()[_0x00e5('0x35')](function(_0xaa4a68){for(var _0xe7a4c8=0x0;_0xe7a4c8<_0xaa4a68[_0x00e5('0x77')];_0xe7a4c8++){_0xaa4a68[_0xe7a4c8]['setDataValue']('channel',_0x00e5('0x117'));}return _0xaa4a68;}));_0x4f462e[_0x00e5('0xb3')](_0x36f867['getOpenchannelQueues']()[_0x00e5('0x35')](function(_0x1ae47c){for(var _0xcd1b69=0x0;_0xcd1b69<_0x1ae47c[_0x00e5('0x77')];_0xcd1b69++){_0x1ae47c[_0xcd1b69][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x118'));}return _0x1ae47c;}));return BPromise[_0x00e5('0x93')](_0x4f462e);})[_0x00e5('0x35')](function(_0x145c57){var _0x14365f=_[_0x00e5('0x119')](_0x145c57);_0x4f462e=[];return db[_0x00e5('0x5e')][_0x00e5('0x11a')](function(_0x315ee5){for(var _0x5c43a6=0x0;_0x5c43a6<_0x14365f[_0x00e5('0x77')];_0x5c43a6++){_0x4f462e[_0x00e5('0xb3')](_0x14365f[_0x5c43a6][_0x00e5('0x11b')](_0x285bf8['id']),{'transaction':_0x315ee5});}return BPromise[_0x00e5('0x93')](_0x4f462e)[_0x00e5('0x35')](function(){if(_0x285bf8[_0x00e5('0xa4')]){return BPromise['each'](_[_0x00e5('0x5a')](_0x14365f,function(_0x1ff00e){return _0x1ff00e['getDataValue']('channel')===_0x00e5('0x111');}),function(_0x69914d){return db[_0x00e5('0xb6')][_0x00e5('0xb7')]({'membername':_0x285bf8[_0x00e5('0x43')],'UserId':_0x285bf8['id'],'queue_name':_0x69914d['name'],'VoiceQueueId':_0x69914d['id'],'interface':_['isNil'](_0x285bf8[_0x00e5('0xa7')])?util[_0x00e5('0xb4')](_0x00e5('0xb5'),_0x285bf8[_0x00e5('0x43')]):_0x285bf8[_0x00e5('0xa7')],'paused':_0x285bf8['voicePause']||![],'penalty':_0x285bf8[_0x00e5('0xac')]},{'transaction':_0x315ee5});});}else{return;}})[_0x00e5('0x35')](function(){for(var _0x66ccd4=0x0;_0x66ccd4<_0x14365f['length'];_0x66ccd4++){var _0x22441a=_0x14365f[_0x66ccd4]['getDataValue'](_0x00e5('0xa3'));var _0x5c0104=_0x22441a+_0x00e5('0xaf');socket['emit'](_0x00e5('0x86')+_0x22441a+_0x00e5('0x11c'),{'UserId':_0x285bf8['id'],['queueField']:_0x14365f[_0x66ccd4]['id']});}});});});}});}})[_0x00e5('0x35')](respondWithStatusCode(_0x21f5b8,null))['catch'](handleError(_0x21f5b8,null));};exports[_0x00e5('0x11d')]=function(_0x4dbe69,_0x412a61){return db[_0x00e5('0x48')]['findOne']({'where':{'id':_0x4dbe69[_0x00e5('0x66')]['id']}})[_0x00e5('0x35')](handleEntityNotFound(_0x412a61,null))['then'](function(_0x19bfaa){if(_0x19bfaa){var _0x213539=_0x19bfaa['get']({'plain':!![]});var _0x3a9603=_0x4dbe69[_0x00e5('0x4f')][_0x00e5('0x6b')];return _0x19bfaa[_0x00e5('0x11d')](_0x3a9603)[_0x00e5('0x35')](function(){for(var _0x277035=0x0;_0x277035<_0x3a9603['length'];_0x277035++){var _0x446676=[];db['Team'][_0x00e5('0x9d')]({'where':{'id':_0x3a9603[_0x277035]}})[_0x00e5('0x35')](function(_0x39502f){_0x446676['push'](_0x39502f[_0x00e5('0x10f')]()[_0x00e5('0x35')](function(_0x44e423){for(var _0x154dba=0x0;_0x154dba<_0x44e423[_0x00e5('0x77')];_0x154dba++){_0x44e423[_0x154dba]['setDataValue']('channel',_0x00e5('0x111'));}return _0x44e423;}));_0x446676[_0x00e5('0xb3')](_0x39502f[_0x00e5('0x11e')]()[_0x00e5('0x35')](function(_0x800ac4){for(var _0x482051=0x0;_0x482051<_0x800ac4['length'];_0x482051++){_0x800ac4[_0x482051][_0x00e5('0x110')](_0x00e5('0xa3'),'Chat');}return _0x800ac4;}));_0x446676['push'](_0x39502f[_0x00e5('0x113')]()[_0x00e5('0x35')](function(_0x2253c3){for(var _0x922375=0x0;_0x922375<_0x2253c3[_0x00e5('0x77')];_0x922375++){_0x2253c3[_0x922375][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x114'));}return _0x2253c3;}));_0x446676[_0x00e5('0xb3')](_0x39502f[_0x00e5('0x11f')]()['then'](function(_0x4bde26){for(var _0x281661=0x0;_0x281661<_0x4bde26['length'];_0x281661++){_0x4bde26[_0x281661][_0x00e5('0x110')]('channel',_0x00e5('0x115'));}return _0x4bde26;}));_0x446676[_0x00e5('0xb3')](_0x39502f[_0x00e5('0x120')]()[_0x00e5('0x35')](function(_0x1bff3f){for(var _0x3cd3e7=0x0;_0x3cd3e7<_0x1bff3f['length'];_0x3cd3e7++){_0x1bff3f[_0x3cd3e7][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x121'));}return _0x1bff3f;}));_0x446676[_0x00e5('0xb3')](_0x39502f['getFaxQueues']()[_0x00e5('0x35')](function(_0xbaef3a){for(var _0x460ce4=0x0;_0x460ce4<_0xbaef3a[_0x00e5('0x77')];_0x460ce4++){_0xbaef3a[_0x460ce4]['setDataValue'](_0x00e5('0xa3'),'Fax');}return _0xbaef3a;}));_0x446676[_0x00e5('0xb3')](_0x39502f[_0x00e5('0x122')]()[_0x00e5('0x35')](function(_0x48f374){for(var _0x26a61d=0x0;_0x26a61d<_0x48f374[_0x00e5('0x77')];_0x26a61d++){_0x48f374[_0x26a61d][_0x00e5('0x110')](_0x00e5('0xa3'),_0x00e5('0x118'));}return _0x48f374;}));return BPromise['all'](_0x446676);})[_0x00e5('0x35')](function(_0x13dd3f){var _0x3cab0a=_[_0x00e5('0x119')](_0x13dd3f);_0x446676=[];return db[_0x00e5('0x5e')][_0x00e5('0x11a')](function(_0x28e688){for(var _0x34e9a3=0x0;_0x34e9a3<_0x3cab0a['length'];_0x34e9a3++){_0x446676[_0x00e5('0xb3')](_0x3cab0a[_0x34e9a3]['removeAgent'](_0x213539['id']),{'transaction':_0x28e688});}return BPromise[_0x00e5('0x93')](_0x446676)[_0x00e5('0x35')](function(){if(_0x213539[_0x00e5('0xa4')]){return BPromise[_0x00e5('0x94')](_['filter'](_0x3cab0a,function(_0xfbe702){return _0xfbe702[_0x00e5('0x123')](_0x00e5('0xa3'))===_0x00e5('0x111');}),function(_0x1852bb){return db[_0x00e5('0xb6')][_0x00e5('0x36')]({'where':{'VoiceQueueId':_0x1852bb['id'],'UserId':_0x213539['id']},'transaction':_0x28e688});});}else{return;}})['then'](function(){for(var _0x5574a3=0x0;_0x5574a3<_0x3cab0a[_0x00e5('0x77')];_0x5574a3++){var _0x136269=_0x3cab0a[_0x5574a3][_0x00e5('0x123')]('channel');var _0x397c1c=_0x136269+_0x00e5('0xaf');socket['emit'](_0x00e5('0x86')+_0x136269+'Queue:remove',{'UserId':_0x213539['id'],['queueField']:_0x3cab0a[_0x5574a3]['id']});}});});});}});}})[_0x00e5('0x35')](respondWithStatusCode(_0x412a61,null))['catch'](handleError(_0x412a61,null));};exports[_0x00e5('0x124')]=function(_0x23dce0,_0x46e10a,_0x29eaa6){var _0x4d25fe={};var _0x3b1a57={};var _0x48043f;var _0x4dc61e;return db['User']['findOne']({'where':{'id':_0x23dce0[_0x00e5('0x66')]['id']}})['then'](handleEntityNotFound(_0x46e10a,null))['then'](function(_0xf3a8fa){if(_0xf3a8fa){_0x48043f=_0xf3a8fa;_0x3b1a57[_0x00e5('0x4c')]=_[_0x00e5('0x50')](db[_0x00e5('0xc8')]['rawAttributes']);_0x3b1a57[_0x00e5('0x4f')]=_[_0x00e5('0x50')](_0x23dce0[_0x00e5('0x4f')]);_0x3b1a57[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x3b1a57[_0x00e5('0x4c')],_0x3b1a57[_0x00e5('0x4f')]);_0x4d25fe[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x3b1a57[_0x00e5('0x4c')],qs[_0x00e5('0x53')](_0x23dce0[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x4d25fe[_0x00e5('0x52')]=_0x4d25fe[_0x00e5('0x52')]['length']?_0x4d25fe['attributes']:_0x3b1a57[_0x00e5('0x4c')];_0x4d25fe[_0x00e5('0xc7')]=qs['sort'](_0x23dce0[_0x00e5('0x4f')]['sort']);_0x4d25fe['where']=qs[_0x00e5('0x58')](_[_0x00e5('0x59')](_0x23dce0[_0x00e5('0x4f')],_0x3b1a57[_0x00e5('0x58')]));if(_0x23dce0['query']['filter']){_0x4d25fe[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x4d25fe[_0x00e5('0x57')],{'$or':_[_0x00e5('0x3f')](_0x4d25fe[_0x00e5('0x52')],function(_0x2982a4){var _0x9c1d52={};_0x9c1d52[_0x2982a4]={'$like':'%'+_0x23dce0[_0x00e5('0x4f')][_0x00e5('0x5a')]+'%'};return _0x9c1d52;})});}_0x4d25fe=_[_0x00e5('0x5b')]({},_0x4d25fe,_0x23dce0[_0x00e5('0x67')]);return _0x48043f['getLists'](_0x4d25fe);}})[_0x00e5('0x35')](function(_0x1c60d7){if(_0x1c60d7){_0x4dc61e=_0x1c60d7['length'];if(!_0x23dce0[_0x00e5('0x4f')][_0x00e5('0x54')](_0x00e5('0x55'))){_0x4d25fe['limit']=qs['limit'](_0x23dce0[_0x00e5('0x4f')][_0x00e5('0x2f')]);_0x4d25fe[_0x00e5('0x2e')]=qs[_0x00e5('0x2e')](_0x23dce0['query'][_0x00e5('0x2e')]);}return _0x48043f[_0x00e5('0x124')](_0x4d25fe);}})[_0x00e5('0x35')](function(_0x417996){if(_0x417996){return _0x417996?{'count':_0x4dc61e,'rows':_0x417996}:null;}})[_0x00e5('0x35')](respondWithResult(_0x46e10a,null))[_0x00e5('0x29')](handleError(_0x46e10a,null));};exports[_0x00e5('0x125')]=function(_0x372e80,_0x378302,_0x21c91d){var _0x5e2159={};var _0x366fd8={};var _0x2254d9;var _0x2848bf;return db[_0x00e5('0x48')][_0x00e5('0x9d')]({'where':{'id':_0x372e80['params']['id']}})['then'](handleEntityNotFound(_0x378302,null))[_0x00e5('0x35')](function(_0x599307){if(_0x599307){_0x2254d9=_0x599307;_0x366fd8[_0x00e5('0x4c')]=_['keys'](db[_0x00e5('0x48')][_0x00e5('0x49')]);_0x366fd8['query']=_['keys'](_0x372e80[_0x00e5('0x4f')]);_0x366fd8[_0x00e5('0x58')]=_[_0x00e5('0x51')](_0x366fd8[_0x00e5('0x4c')],_0x366fd8[_0x00e5('0x4f')]);_0x5e2159[_0x00e5('0x52')]=_[_0x00e5('0x51')](_0x366fd8['model'],qs[_0x00e5('0x53')](_0x372e80[_0x00e5('0x4f')][_0x00e5('0x53')]));_0x5e2159[_0x00e5('0x52')]=_0x5e2159['attributes'][_0x00e5('0x77')]?_0x5e2159[_0x00e5('0x52')]:_0x366fd8[_0x00e5('0x4c')];_0x5e2159[_0x00e5('0xc7')]=qs[_0x00e5('0x56')](_0x372e80[_0x00e5('0x4f')][_0x00e5('0x56')]);_0x5e2159[_0x00e5('0x57')]=qs['filters'](_[_0x00e5('0x59')](_0x372e80[_0x00e5('0x4f')],_0x366fd8[_0x00e5('0x58')]));if(_0x372e80['query'][_0x00e5('0x5a')]){_0x5e2159[_0x00e5('0x57')]=_[_0x00e5('0x5b')](_0x5e2159[_0x00e5('0x57')],{'$or':_['map'](_0x5e2159['attributes'],function(_0x14e0ab){var _0x14fe04={};_0x14fe04[_0x14e0ab]={'$like':'%'+_0x372e80['query'][_0x00e5('0x5a')]+'%'};return _0x14fe04;})});}_0x5e2159[_0x00e5('0x4c')]=db[_0x00e5('0x48')];_0x5e2159['as']=_0x00e5('0x3b');_0x5e2159=_[_0x00e5('0x5b')]({},_0x5e2159,_0x372e80[_0x00e5('0x67')]);return _0x2254d9[_0x00e5('0x10f')]({'include':[_0x5e2159]});}})[_0x00e5('0x35')](function(_0xdbce0d){if(_0xdbce0d){var _0x4ccd38={},_0x23de9c=[],_0x4d652c=0x0;for(var _0x31a2ee=0x0;_0x31a2ee<_0xdbce0d[_0x00e5('0x77')];_0x31a2ee+=0x1){for(var _0x45a598=0x0,_0x9fc113;_0x45a598<_0xdbce0d[_0x31a2ee][_0x00e5('0x3b')][_0x00e5('0x77')];_0x45a598+=0x1){_0x9fc113=_0xdbce0d[_0x31a2ee][_0x00e5('0x3b')][_0x45a598][_0x00e5('0x37')]({'plain':!![]});_0x4ccd38[_0x9fc113['id']]=_0x9fc113;}}_0x4ccd38=_['values'](_0x4ccd38);for(var _0x1bd226=qs[_0x00e5('0x2e')](_0x372e80['query'][_0x00e5('0x2e')]);_0x1bd226<_0x4ccd38[_0x00e5('0x77')]&&_0x23de9c['length']=_0x592929[_0x2738('0x49')]){throw new Error(_0x2738('0x4a'));}})[_0x2738('0x1f')](function(){if(_0x51151c){return db[_0x2738('0x28')][_0x2738('0x43')]({'where':{'membername':_0x51151c[_0x2738('0x25')]},'individualHooks':!![]});}})['then'](function(){if(_0x51151c){return _0x51151c['getVoiceQueues']({'raw':!![]});}})[_0x2738('0x1f')](function(_0x47a66d){if(_0x51151c){if(_0x47a66d){var _0x2b3786=[];_0x5daca6=_0x47a66d;if(_0x5daca6['length']){for(var _0x545c0f=0x0;_0x545c0f<_0x5daca6[_0x2738('0x2b')];_0x545c0f++){_0x2b3786[_0x2738('0x31')](db[_0x2738('0x28')][_0x2738('0x4b')]({'membername':_0x51151c[_0x2738('0x25')],'UserId':_0x51151c['id'],'queue_name':_0x5daca6[_0x545c0f][_0x2738('0x25')],'VoiceQueueId':_0x5daca6[_0x545c0f]['id'],'interface':_0x57170a,'paused':_0x51151c[_0x2738('0x45')]||![],'penalty':_0x5daca6[_0x545c0f][_0x2738('0x4c')]||0x0}));}return BPromise[_0x2738('0x4d')](_0x2b3786);}}}})[_0x2738('0x1f')](function(){if(_0x51151c){return db[_0x2738('0x29')]['findAll']({'where':{'membername':_0x51151c[_0x2738('0x25')],'exitAt':null}});}})['then'](function(_0x4c1b8f){if(_0x51151c){if(_0x4c1b8f&&_0x4c1b8f[_0x2738('0x2b')]){var _0x404233=[];_0x4c1b8f[_0x2738('0x30')](function(_0x209bcf){_0x404233[_0x2738('0x31')](_0x209bcf[_0x2738('0x35')]({'exitAt':moment()[_0x2738('0x2c')](_0x2738('0x2d'))}));});return BPromise[_0x2738('0x4d')](_0x404233);}}})['then'](function(_0x3a46bd){if(_0x51151c){var _0x1e62b4=[];var _0x5d41b5=[];var _0x4054c5=utils[_0x2738('0x2f')]();var _0x215ecc={'membername':_0x51151c['name'],'interface':_0x57170a,'enterAt':moment()[_0x2738('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x51151c[_0x2738('0x34')],'internal':_0x51151c[_0x2738('0x26')]};_0x4054c5['forEach'](function(_0x1e362e){_0x1e62b4[_0x2738('0x31')](_[_0x2738('0x4e')]({'channel':_0x1e362e,'type':_0x2738('0x4f'),'data1':_0x2738('0x50'),'data2':_0x57170a},_0x215ecc));if(_0x51151c[_0x2738('0x45')]){_0x5d41b5[_0x2738('0x31')](_[_0x2738('0x4e')]({'channel':_0x1e362e,'type':'PAUSE','data1':_0x2738('0x51')},_0x215ecc));}});return db[_0x2738('0x29')][_0x2738('0x52')](_0x1e62b4[_0x2738('0x53')](_0x5d41b5),{'individualHooks':!![]});}})[_0x2738('0x1f')](function(){if(_0x51151c){return _0x51151c[_0x2738('0x35')]({'online':!![],'lastLoginAt':moment()[_0x2738('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x51151c[_0x2738('0x45')]||![],'mailPause':_0x51151c[_0x2738('0x45')]||![],'chatPause':_0x51151c['loginInPause']||![],'faxPause':_0x51151c[_0x2738('0x45')]||![],'smsPause':_0x51151c['loginInPause']||![],'openchannelPause':_0x51151c[_0x2738('0x45')]||![],'pauseType':_0x51151c[_0x2738('0x45')]?_0x2738('0x51'):null,'lastPauseAt':moment()[_0x2738('0x2c')](_0x2738('0x2d')),'interface':_0x57170a});}})['then'](function(_0x373799){_0x44dd79(_0x373799);})['catch'](function(_0x4d86e6){_0x28a596(_0x2250ea[_0x2738('0x12')](0x1f4,_0x4d86e6['message']));});});}; \ No newline at end of file +var _0x60a5=['length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','SIP/%s','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','body','type','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','mail','chat','fax','sms','system','set','Pause','all','LogoutUser','destroy','role','mobile','phone','count','agent','getLicense','agents','upsert','loginInPause','UserVoiceQueue.penalty','getChannels','merge','callysquare','concat','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./user.socket','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetUser','User','findAll','options','raw','where','attributes','limit','map','model','include','catch','ShowUser','PauseUser','find','name','internal','interface','update','PAUSE'];(function(_0x1d5bfd,_0x25075b){var _0xd5b68d=function(_0x15802a){while(--_0x15802a){_0x1d5bfd['push'](_0x1d5bfd['shift']());}};_0xd5b68d(++_0x25075b);}(_0x60a5,0x83));var _0x560a=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x60a5[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x560a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x560a('0x2'))['db'];var utils=require(_0x560a('0x3'));var logger=require(_0x560a('0x4'))('rpc');var config=require(_0x560a('0x5'));var jayson=require(_0x560a('0x6'));var client=jayson[_0x560a('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x560a('0x8'),'port':0x18eb});var socket=require(_0x560a('0x9'))(new Redis(config[_0x560a('0xa')]));require(_0x560a('0xb'))['register'](socket);function respondWithRpcPromise(_0x4c7a7a,_0x359da4,_0x5d95ee){return new BPromise(function(_0x2e3b88,_0x13c6a3){return client['request'](_0x4c7a7a,_0x5d95ee)[_0x560a('0xc')](function(_0x36e345){logger[_0x560a('0xd')](_0x560a('0xe'),_0x359da4,_0x560a('0xf'));logger[_0x560a('0x10')](_0x560a('0x11'),_0x359da4,_0x560a('0xf'),JSON[_0x560a('0x12')](_0x36e345));if(_0x36e345['error']){if(_0x36e345[_0x560a('0x13')][_0x560a('0x14')]===0x1f4){logger[_0x560a('0x13')]('User,\x20%s,\x20%s',_0x359da4,_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);return _0x13c6a3(_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);}logger['error'](_0x560a('0xe'),_0x359da4,_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);return _0x2e3b88(_0x36e345[_0x560a('0x13')]['message']);}else{logger['info'](_0x560a('0xe'),_0x359da4,_0x560a('0xf'));_0x2e3b88(_0x36e345[_0x560a('0x16')][_0x560a('0x15')]);}})['catch'](function(_0x96deb7){logger[_0x560a('0x13')](_0x560a('0xe'),_0x359da4,_0x96deb7);_0x13c6a3(_0x96deb7);});});}exports[_0x560a('0x17')]=function(_0xe9be04){var _0x4807f2=this;return new Promise(function(_0x32ff83,_0x155c2b){return db[_0x560a('0x18')][_0x560a('0x19')]({'raw':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1b')]===undefined?!![]:![]:!![],'where':_0xe9be04['options']?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1c')]||null:null,'attributes':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1d')]||null:null,'limit':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1e')]||null:null,'include':_0xe9be04['options']?_0xe9be04['options']['include']?_[_0x560a('0x1f')](_0xe9be04[_0x560a('0x1a')]['include'],function(_0x47b251){return{'model':db[_0x47b251[_0x560a('0x20')]],'as':_0x47b251['as'],'attributes':_0x47b251['attributes'],'include':_0x47b251[_0x560a('0x21')]?_[_0x560a('0x1f')](_0x47b251['include'],function(_0x6ad203){return{'model':db[_0x6ad203[_0x560a('0x20')]],'as':_0x6ad203['as'],'attributes':_0x6ad203['attributes'],'include':_0x6ad203[_0x560a('0x21')]?_[_0x560a('0x1f')](_0x6ad203[_0x560a('0x21')],function(_0x305bd9){return{'model':db[_0x305bd9[_0x560a('0x20')]],'as':_0x305bd9['as'],'attributes':_0x305bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x560a('0xc')](function(_0x3c4af2){logger['info'](_0x560a('0x17'),_0xe9be04);logger[_0x560a('0x10')](_0x560a('0x17'),_0xe9be04,JSON[_0x560a('0x12')](_0x3c4af2));_0x32ff83(_0x3c4af2);})[_0x560a('0x22')](function(_0x226c9c){logger[_0x560a('0x13')]('GetUser',_0x226c9c[_0x560a('0x15')],_0xe9be04);_0x155c2b(_0x4807f2[_0x560a('0x13')](0x1f4,_0x226c9c['message']));});});};exports['ShowUser']=function(_0x16bccd){var _0x465418=this;return new Promise(function(_0x155e3e,_0x546f45){return db['User']['find']({'raw':_0x16bccd['options']?_0x16bccd[_0x560a('0x1a')][_0x560a('0x1b')]===undefined?!![]:![]:!![],'where':_0x16bccd[_0x560a('0x1a')]?_0x16bccd[_0x560a('0x1a')][_0x560a('0x1c')]||null:null,'attributes':_0x16bccd[_0x560a('0x1a')]?_0x16bccd[_0x560a('0x1a')][_0x560a('0x1d')]||null:null,'include':_0x16bccd[_0x560a('0x1a')]?_0x16bccd[_0x560a('0x1a')]['include']?_[_0x560a('0x1f')](_0x16bccd[_0x560a('0x1a')][_0x560a('0x21')],function(_0x2b3c21){return{'model':db[_0x2b3c21[_0x560a('0x20')]],'as':_0x2b3c21['as'],'attributes':_0x2b3c21['attributes'],'include':_0x2b3c21['include']?_[_0x560a('0x1f')](_0x2b3c21[_0x560a('0x21')],function(_0x4388f4){return{'model':db[_0x4388f4[_0x560a('0x20')]],'as':_0x4388f4['as'],'attributes':_0x4388f4[_0x560a('0x1d')],'include':_0x4388f4['include']?_[_0x560a('0x1f')](_0x4388f4[_0x560a('0x21')],function(_0x4c027e){return{'model':db[_0x4c027e[_0x560a('0x20')]],'as':_0x4c027e['as'],'attributes':_0x4c027e[_0x560a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x560a('0xc')](function(_0x384f39){logger[_0x560a('0xd')](_0x560a('0x23'),_0x16bccd);logger['debug'](_0x560a('0x23'),_0x16bccd,JSON[_0x560a('0x12')](_0x384f39));_0x155e3e(_0x384f39);})[_0x560a('0x22')](function(_0x30fa04){logger['error'](_0x560a('0x23'),_0x30fa04['message'],_0x16bccd);_0x546f45(_0x465418[_0x560a('0x13')](0x1f4,_0x30fa04[_0x560a('0x15')]));});});};exports[_0x560a('0x24')]=function(_0x21b999){var _0x329f01=this;return new Promise(function(_0x8f8f84,_0xc562ac){var _0x2c01c0;return db[_0x560a('0x18')][_0x560a('0x25')]({'where':_0x21b999[_0x560a('0x1a')][_0x560a('0x1c')]||{},'attributes':['id',_0x560a('0x26'),'role',_0x560a('0x27'),_0x560a('0x28')]})[_0x560a('0xc')](function(_0x175719){if(_0x175719){_0x2c01c0=_0x175719;return db['UserVoiceQueueRt'][_0x560a('0x29')]({'paused':0x1},{'where':{'UserId':_0x2c01c0['id']},'individualHooks':!![]});}})['then'](function(){if(_0x2c01c0){return db['MemberReport'][_0x560a('0x19')]({'where':{'membername':_0x2c01c0[_0x560a('0x26')],'type':_0x560a('0x2a'),'exitAt':null}});}})[_0x560a('0xc')](function(_0x1a1d3a){if(_0x2c01c0){if(_0x1a1d3a&&_0x1a1d3a[_0x560a('0x2b')]){var _0x4b245d=moment()[_0x560a('0x2c')](_0x560a('0x2d'));for(var _0x4eb404=0x0,_0x50a2b6=_0x1a1d3a['length'];_0x4eb404<_0x50a2b6;_0x4eb404++){_0x1a1d3a[_0x4eb404][_0x560a('0x2e')]({'exitAt':_0x4b245d});}}}})[_0x560a('0xc')](function(){if(_0x2c01c0){var _0xa7d1a=[];var _0x4813b3=utils['getChannels']();_0x4813b3[_0x560a('0x2f')](function(_0x4e52c3){_0xa7d1a[_0x560a('0x30')]({'channel':_0x4e52c3,'membername':_0x2c01c0[_0x560a('0x26')],'interface':_[_0x560a('0x31')](_0x2c01c0['interface'])?util[_0x560a('0x2c')](_0x560a('0x32'),_0x2c01c0[_0x560a('0x26')]):_0x2c01c0['interface'],'type':_0x560a('0x2a'),'enterAt':moment()[_0x560a('0x2c')](_0x560a('0x2d')),'data1':_0x21b999['body']['type']||_0x560a('0x33'),'role':_0x2c01c0['role'],'internal':_0x2c01c0[_0x560a('0x27')],'uniqueid':_0x21b999['body'][_0x560a('0x34')]||null});});return db[_0x560a('0x35')][_0x560a('0x36')](_0xa7d1a,{'individualHooks':!![]});}})[_0x560a('0xc')](function(){if(_0x2c01c0){return _0x2c01c0[_0x560a('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x21b999[_0x560a('0x37')][_0x560a('0x38')]||_0x560a('0x33'),'lastPauseAt':moment()['format'](_0x560a('0x2d'))});}})['then'](function(_0x580999){_0x8f8f84(_0x580999);})[_0x560a('0x22')](function(_0xdf1613){_0xc562ac(_0x329f01[_0x560a('0x13')](0x1f4,_0xdf1613[_0x560a('0x15')]));});});};exports['UnpauseUser']=function(_0x563f94){var _0x211111=this;return new Promise(function(_0x5ab3f0,_0x3f8a48){var _0x2146ca;return db['User'][_0x560a('0x39')]({'where':_0x563f94[_0x560a('0x1a')][_0x560a('0x1c')]||{},'attributes':['id',_0x560a('0x26')]})['then'](function(_0x38dae1){if(_0x38dae1){_0x2146ca=_0x38dae1;if(_0x563f94[_0x560a('0x37')][_0x560a('0x3a')]&&!utils[_0x560a('0x3b')](_0x563f94['body'][_0x560a('0x3a')])){throw new Error(_0x560a('0x3c'));}switch(_0x563f94[_0x560a('0x37')][_0x560a('0x3a')]){case _0x560a('0x3d'):return db[_0x560a('0x3e')][_0x560a('0x29')]({'paused':0x0},{'where':{'UserId':_0x2146ca['id']}})[_0x560a('0xc')](function(){return db['MemberReport'][_0x560a('0x25')]({'where':{'channel':_0x563f94[_0x560a('0x37')][_0x560a('0x3a')],'membername':_0x2146ca[_0x560a('0x26')],'type':'PAUSE','exitAt':null}});})[_0x560a('0xc')](function(_0x5eb025){if(_0x5eb025){return _0x5eb025[_0x560a('0x29')]({'exitAt':moment()['format'](_0x560a('0x2d')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x560a('0xc')](function(){return _0x2146ca[_0x560a('0x29')]({'voicePause':![]});});case _0x560a('0x3f'):case _0x560a('0x40'):case _0x560a('0x41'):case _0x560a('0x42'):case'openchannel':case'whatsapp':return db[_0x560a('0x35')][_0x560a('0x25')]({'where':{'channel':_0x563f94[_0x560a('0x37')][_0x560a('0x3a')],'membername':_0x2146ca[_0x560a('0x26')],'type':_0x560a('0x2a'),'exitAt':null}})[_0x560a('0xc')](function(_0x178f7a){return _0x178f7a[_0x560a('0x29')]({'exitAt':moment()['format'](_0x560a('0x2d')),'data2':_0x560a('0x43')},{'individualHooks':!![]});})['then'](function(){var _0x131744={};_[_0x560a('0x44')](_0x131744,util[_0x560a('0x2c')]('%s%s',_0x563f94[_0x560a('0x37')]['channel'],_0x560a('0x45')),![]);return _0x2146ca[_0x560a('0x29')](_0x131744);});default:return db[_0x560a('0x3e')]['update']({'paused':0x0},{'where':{'UserId':_0x2146ca['id']}})[_0x560a('0xc')](function(){return db[_0x560a('0x35')][_0x560a('0x19')]({'where':{'membername':_0x2146ca[_0x560a('0x26')],'type':'PAUSE','exitAt':null}});})[_0x560a('0xc')](function(_0x6361d5){var _0x234c5b=[];_0x6361d5['forEach'](function(_0x23fdd4){_0x234c5b['push'](_0x23fdd4['update']({'exitAt':moment()['format'](_0x560a('0x2d')),'data2':_0x560a('0x43')}));});return BPromise[_0x560a('0x46')](_0x234c5b);})[_0x560a('0xc')](function(){return _0x2146ca[_0x560a('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x560a('0xc')](function(_0x7e602e){_0x5ab3f0(_0x7e602e);})['catch'](function(_0x27384b){_0x3f8a48(_0x211111[_0x560a('0x13')](0x1f4,_0x27384b[_0x560a('0x15')]));});});};exports[_0x560a('0x47')]=function(_0x50c05c){var _0x3e0314=this;return new Promise(function(_0x3e8800,_0x2dfad1){var _0x2ea8b8;return db[_0x560a('0x18')][_0x560a('0x39')]({'where':_0x50c05c[_0x560a('0x1a')]['where']||{},'attributes':['id',_0x560a('0x26')]})['then'](function(_0x3874d2){if(_0x3874d2){_0x2ea8b8=_0x3874d2;return db['UserVoiceQueueRt'][_0x560a('0x48')]({'where':{'membername':_0x2ea8b8[_0x560a('0x26')]},'individualHooks':!![]});}})[_0x560a('0xc')](function(){if(_0x2ea8b8){return db['MemberReport'][_0x560a('0x19')]({'where':{'membername':_0x2ea8b8[_0x560a('0x26')],'exitAt':null}});}})[_0x560a('0xc')](function(_0x1c161a){if(_0x2ea8b8){if(_0x1c161a&&_0x1c161a['length']){var _0x745abe=[];_0x1c161a[_0x560a('0x2f')](function(_0x326a69){_0x745abe[_0x560a('0x30')](_0x326a69[_0x560a('0x29')]({'exitAt':moment()['format'](_0x560a('0x2d'))}));});return BPromise['all'](_0x745abe);}}})[_0x560a('0xc')](function(){if(_0x2ea8b8){return _0x2ea8b8[_0x560a('0x29')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x560a('0xc')](function(_0x5c6bfe){_0x3e8800(_0x5c6bfe);})[_0x560a('0x22')](function(_0x15a58d){_0x2dfad1(_0x3e0314[_0x560a('0x13')](0x1f4,_0x15a58d[_0x560a('0x15')]));});});};exports['LoginUser']=function(_0x5f305a){var _0x52facf=this;return new Promise(function(_0x5dd836,_0x118cb8){var _0x38feb5;var _0x8c479f;var _0x5075b0;var _0xb992b3;return db[_0x560a('0x18')][_0x560a('0x39')]({'where':_0x5f305a[_0x560a('0x1a')][_0x560a('0x1c')]||{},'attributes':['id',_0x560a('0x26'),_0x560a('0x49'),_0x560a('0x4a'),_0x560a('0x4b'),_0x560a('0x27'),'loginInPause',_0x560a('0x28')]})[_0x560a('0xc')](function(_0x2a1eae){if(_0x2a1eae){_0x38feb5=_0x2a1eae;_0xb992b3=_0x5f305a[_0x560a('0x37')][_0x560a('0x28')]?_0x5f305a[_0x560a('0x37')]['interface']:util['format'](_0x560a('0x32'),_0x38feb5[_0x560a('0x26')]);return db['User'][_0x560a('0x4c')]({'where':{'role':_0x560a('0x4d'),'online':!![],'id':{'$ne':_0x38feb5['id']}}});}})[_0x560a('0xc')](function(_0x1b5d07){if(_0x1b5d07){_0x5075b0=_0x1b5d07;return require('../../config/license/util')[_0x560a('0x4e')]();}})[_0x560a('0xc')](function(_0x3ec18c){if(_0x3ec18c&&_0x3ec18c[_0x560a('0x4f')]&&_0x5075b0>=_0x3ec18c[_0x560a('0x4f')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x560a('0xc')](function(){if(_0x38feb5){return db[_0x560a('0x3e')][_0x560a('0x48')]({'where':{'membername':_0x38feb5[_0x560a('0x26')]},'individualHooks':!![]});}})[_0x560a('0xc')](function(){if(_0x38feb5){return _0x38feb5['getVoiceQueues']({'raw':!![]});}})[_0x560a('0xc')](function(_0x306546){if(_0x38feb5){if(_0x306546){var _0x1e9d4b=[];_0x8c479f=_0x306546;if(_0x8c479f[_0x560a('0x2b')]){for(var _0x29daba=0x0;_0x29daba<_0x8c479f[_0x560a('0x2b')];_0x29daba++){_0x1e9d4b['push'](db['UserVoiceQueueRt'][_0x560a('0x50')]({'membername':_0x38feb5[_0x560a('0x26')],'UserId':_0x38feb5['id'],'queue_name':_0x8c479f[_0x29daba][_0x560a('0x26')],'VoiceQueueId':_0x8c479f[_0x29daba]['id'],'interface':_0xb992b3,'paused':_0x38feb5[_0x560a('0x51')]||![],'penalty':_0x8c479f[_0x29daba][_0x560a('0x52')]||0x0}));}return BPromise[_0x560a('0x46')](_0x1e9d4b);}}}})[_0x560a('0xc')](function(){if(_0x38feb5){return db[_0x560a('0x35')][_0x560a('0x19')]({'where':{'membername':_0x38feb5['name'],'exitAt':null}});}})['then'](function(_0x402606){if(_0x38feb5){if(_0x402606&&_0x402606[_0x560a('0x2b')]){var _0x16a9ce=[];_0x402606['forEach'](function(_0xbda73e){_0x16a9ce['push'](_0xbda73e[_0x560a('0x29')]({'exitAt':moment()[_0x560a('0x2c')](_0x560a('0x2d'))}));});return BPromise[_0x560a('0x46')](_0x16a9ce);}}})[_0x560a('0xc')](function(_0x198a85){if(_0x38feb5){var _0x16d150=[];var _0x29f194=[];var _0x42ef64=utils[_0x560a('0x53')]();var _0x5ac917={'membername':_0x38feb5['name'],'interface':_0xb992b3,'enterAt':moment()['format'](_0x560a('0x2d')),'role':_0x38feb5['role'],'internal':_0x38feb5['internal']};_0x42ef64[_0x560a('0x2f')](function(_0x42266e){_0x16d150[_0x560a('0x30')](_[_0x560a('0x54')]({'channel':_0x42266e,'type':'LOGIN','data1':_0x560a('0x55'),'data2':_0xb992b3},_0x5ac917));if(_0x38feb5[_0x560a('0x51')]){_0x29f194[_0x560a('0x30')](_[_0x560a('0x54')]({'channel':_0x42266e,'type':_0x560a('0x2a'),'data1':'LOGININPAUSE'},_0x5ac917));}});return db['MemberReport'][_0x560a('0x36')](_0x16d150[_0x560a('0x56')](_0x29f194),{'individualHooks':!![]});}})['then'](function(){if(_0x38feb5){return _0x38feb5[_0x560a('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0x560a('0x2d')),'voicePause':_0x38feb5[_0x560a('0x51')]||![],'mailPause':_0x38feb5[_0x560a('0x51')]||![],'chatPause':_0x38feb5[_0x560a('0x51')]||![],'faxPause':_0x38feb5[_0x560a('0x51')]||![],'smsPause':_0x38feb5[_0x560a('0x51')]||![],'openchannelPause':_0x38feb5[_0x560a('0x51')]||![],'pauseType':_0x38feb5[_0x560a('0x51')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x560a('0x2c')](_0x560a('0x2d')),'interface':_0xb992b3});}})[_0x560a('0xc')](function(_0x4cd8f8){_0x5dd836(_0x4cd8f8);})['catch'](function(_0x340611){_0x118cb8(_0x52facf[_0x560a('0x13')](0x1f4,_0x340611['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 83659da..eadd861 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 _0x9529=['save','remove','update','emit','length','user:','./user.events'];(function(_0x36dbe5,_0x4158f4){var _0x2ac009=function(_0x5e39ed){while(--_0x5e39ed){_0x36dbe5['push'](_0x36dbe5['shift']());}};_0x2ac009(++_0x4158f4);}(_0x9529,0x1aa));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';var UserEvents=require(_0x9952('0x0'));var events=[_0x9952('0x1'),_0x9952('0x2'),_0x9952('0x3')];function createListener(_0x11b11a,_0x2756a5){return function(_0x3a13ae){_0x2756a5[_0x9952('0x4')](_0x11b11a,_0x3a13ae);};}function removeListener(_0x24e62a,_0x39d02c){return function(){UserEvents['removeListener'](_0x24e62a,_0x39d02c);};}exports['register']=function(_0xa048d0){for(var _0x3bba91=0x0,_0x39f463=events[_0x9952('0x5')];_0x3bba91<_0x39f463;_0x3bba91++){var _0x4c6531=events[_0x3bba91];var _0x493720=createListener(_0x9952('0x6')+_0x4c6531,_0xa048d0);UserEvents['on'](_0x4c6531,_0x493720);}}; \ No newline at end of file +var _0x7c53=['emit','removeListener','length','user:','./user.events','save','remove','update'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7c53,0x17c));var _0x37c5=function(_0x4a7885,_0x4519e2){_0x4a7885=_0x4a7885-0x0;var _0x6099eb=_0x7c53[_0x4a7885];return _0x6099eb;};'use strict';var UserEvents=require(_0x37c5('0x0'));var events=[_0x37c5('0x1'),_0x37c5('0x2'),_0x37c5('0x3')];function createListener(_0x2df197,_0x46f784){return function(_0x2b908b){_0x46f784[_0x37c5('0x4')](_0x2df197,_0x2b908b);};}function removeListener(_0x184c1a,_0x599359){return function(){UserEvents[_0x37c5('0x5')](_0x184c1a,_0x599359);};}exports['register']=function(_0x1150e5){for(var _0x7375bc=0x0,_0x50d78d=events[_0x37c5('0x6')];_0x7375bc<_0x50d78d;_0x7375bc++){var _0x53b188=events[_0x7375bc];var _0x55844a=createListener(_0x37c5('0x7')+_0x53b188,_0x1150e5);UserEvents['on'](_0x53b188,_0x55844a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0b31e56..662b104 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 _0x503c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','express','Router'];(function(_0x4bfa24,_0x2c52ee){var _0x3bde7a=function(_0x47cbe2){while(--_0x47cbe2){_0x4bfa24['push'](_0x4bfa24['shift']());}};_0x3bde7a(++_0x2c52ee);}(_0x503c,0xc4));var _0xc503=function(_0x39af14,_0x4f8bde){_0x39af14=_0x39af14-0x0;var _0xc3d557=_0x503c[_0x39af14];return _0xc3d557;};'use strict';var multer=require('multer');var util=require(_0xc503('0x0'));var path=require(_0xc503('0x1'));var timeout=require('connect-timeout');var express=require(_0xc503('0x2'));var router=express[_0xc503('0x3')]();var auth=require(_0xc503('0x4'));var interaction=require(_0xc503('0x5'));var config=require(_0xc503('0x6'));module[_0xc503('0x7')]=router; \ No newline at end of file +var _0x65d9=['../../components/interaction/service','../../config/environment','multer','util','express'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x65d9,0x1dd));var _0x965d=function(_0x634aa8,_0x312420){_0x634aa8=_0x634aa8-0x0;var _0x3fafac=_0x65d9[_0x634aa8];return _0x3fafac;};'use strict';var multer=require(_0x965d('0x0'));var util=require(_0x965d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x965d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x965d('0x3'));var config=require(_0x965d('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e6fc3e8..fca7705 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x3f7fcd,_0x4d6d2d){var _0x1c8693=function(_0x546ef5){while(--_0x546ef5){_0x3f7fcd['push'](_0x3f7fcd['shift']());}};_0x1c8693(++_0x4d6d2d);}(_0xe706,0xa3));var _0x6e70=function(_0x354fc7,_0x10bd45){_0x354fc7=_0x354fc7-0x0;var _0x462135=_0xe706[_0x354fc7];return _0x462135;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0xc3aae7,_0x3bfa91){var _0x1f365a=function(_0x465838){while(--_0x465838){_0xc3aae7['push'](_0xc3aae7['shift']());}};_0x1f365a(++_0x3bfa91);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('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 d1021ab..c6c80e2 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 _0xff8d=['exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','bluebird','request-promise','path','rimraf','./userChatQueue.attributes'];(function(_0x308d54,_0x15e32c){var _0x4de8c4=function(_0x425b4c){while(--_0x425b4c){_0x308d54['push'](_0x308d54['shift']());}};_0x4de8c4(++_0x15e32c);}(_0xff8d,0x7d));var _0xdff8=function(_0x470194,_0x15b56d){_0x470194=_0x470194-0x0;var _0x44895f=_0xff8d[_0x470194];return _0x44895f;};'use strict';var _=require('lodash');var util=require(_0xdff8('0x0'));var logger=require(_0xdff8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdff8('0x2'));var rp=require(_0xdff8('0x3'));var fs=require('fs');var path=require(_0xdff8('0x4'));var rimraf=require(_0xdff8('0x5'));var config=require('../../config/environment');var attributes=require(_0xdff8('0x6'));module[_0xdff8('0x7')]=function(_0xdaf0a3,_0x42a72c){return _0xdaf0a3[_0xdff8('0x8')](_0xdff8('0x9'),attributes,{'tableName':_0xdff8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25a5=['./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','api','request-promise','rimraf'];(function(_0x572e92,_0x5b8c78){var _0x50bf10=function(_0x4001d3){while(--_0x4001d3){_0x572e92['push'](_0x572e92['shift']());}};_0x50bf10(++_0x5b8c78);}(_0x25a5,0x1e1));var _0x525a=function(_0x316f77,_0x17f87a){_0x316f77=_0x316f77-0x0;var _0x8abaf4=_0x25a5[_0x316f77];return _0x8abaf4;};'use strict';var _=require(_0x525a('0x0'));var util=require(_0x525a('0x1'));var logger=require('../../config/logger')(_0x525a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x525a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x525a('0x4'));var config=require('../../config/environment');var attributes=require(_0x525a('0x5'));module['exports']=function(_0x4d16a1,_0x56b131){return _0x4d16a1[_0x525a('0x6')](_0x525a('0x7'),attributes,{'tableName':_0x525a('0x8'),'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 3fd8138..e4108f3 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 _0x32a4=['../../config/utils','rpc','../../config/environment','jayson/promise','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x32a4,0x1d6));var _0x432a=function(_0x155882,_0x240858){_0x155882=_0x155882-0x0;var _0x5aaf42=_0x32a4[_0x155882];return _0x5aaf42;};'use strict';var _=require(_0x432a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x432a('0x1'));var rs=require(_0x432a('0x2'));var fs=require('fs');var Redis=require(_0x432a('0x3'));var db=require(_0x432a('0x4'))['db'];var utils=require(_0x432a('0x5'));var logger=require('../../config/logger')(_0x432a('0x6'));var config=require(_0x432a('0x7'));var jayson=require(_0x432a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11be09,_0x10321a,_0x4813b1){return new BPromise(function(_0x58cd90,_0x2b42e1){return client[_0x432a('0x9')](_0x11be09,_0x4813b1)[_0x432a('0xa')](function(_0x253eef){logger['info'](_0x432a('0xb'),_0x10321a,_0x432a('0xc'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10321a,'request\x20sent',JSON['stringify'](_0x253eef));if(_0x253eef[_0x432a('0xd')]){if(_0x253eef[_0x432a('0xd')][_0x432a('0xe')]===0x1f4){logger[_0x432a('0xd')](_0x432a('0xb'),_0x10321a,_0x253eef[_0x432a('0xd')][_0x432a('0xf')]);return _0x2b42e1(_0x253eef['error']['message']);}logger[_0x432a('0xd')](_0x432a('0xb'),_0x10321a,_0x253eef[_0x432a('0xd')][_0x432a('0xf')]);return _0x58cd90(_0x253eef[_0x432a('0xd')][_0x432a('0xf')]);}else{logger[_0x432a('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x10321a,_0x432a('0xc'));_0x58cd90(_0x253eef[_0x432a('0x11')]['message']);}})[_0x432a('0x12')](function(_0x30ba9c){logger[_0x432a('0xd')](_0x432a('0xb'),_0x10321a,_0x30ba9c);_0x2b42e1(_0x30ba9c);});});} \ No newline at end of file +var _0x1d40=['../../config/logger','rpc','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1d40,0x160));var _0x01d4=function(_0x2e684b,_0x11f578){_0x2e684b=_0x2e684b-0x0;var _0x19d9da=_0x1d40[_0x2e684b];return _0x19d9da;};'use strict';var _=require(_0x01d4('0x0'));var util=require(_0x01d4('0x1'));var moment=require(_0x01d4('0x2'));var BPromise=require(_0x01d4('0x3'));var rs=require(_0x01d4('0x4'));var fs=require('fs');var Redis=require(_0x01d4('0x5'));var db=require(_0x01d4('0x6'))['db'];var utils=require(_0x01d4('0x7'));var logger=require(_0x01d4('0x8'))(_0x01d4('0x9'));var config=require('../../config/environment');var jayson=require(_0x01d4('0xa'));var client=jayson['client'][_0x01d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb75d00,_0x2c8e5e,_0x22c870){return new BPromise(function(_0x4d859f,_0x21d127){return client[_0x01d4('0xc')](_0xb75d00,_0x22c870)[_0x01d4('0xd')](function(_0xdd908e){logger[_0x01d4('0xe')](_0x01d4('0xf'),_0x2c8e5e,_0x01d4('0x10'));logger[_0x01d4('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2c8e5e,_0x01d4('0x10'),JSON[_0x01d4('0x12')](_0xdd908e));if(_0xdd908e[_0x01d4('0x13')]){if(_0xdd908e[_0x01d4('0x13')][_0x01d4('0x14')]===0x1f4){logger[_0x01d4('0x13')](_0x01d4('0xf'),_0x2c8e5e,_0xdd908e['error'][_0x01d4('0x15')]);return _0x21d127(_0xdd908e[_0x01d4('0x13')][_0x01d4('0x15')]);}logger[_0x01d4('0x13')](_0x01d4('0xf'),_0x2c8e5e,_0xdd908e[_0x01d4('0x13')]['message']);return _0x4d859f(_0xdd908e[_0x01d4('0x13')][_0x01d4('0x15')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2c8e5e,_0x01d4('0x10'));_0x4d859f(_0xdd908e[_0x01d4('0x16')][_0x01d4('0x15')]);}})[_0x01d4('0x17')](function(_0x25c48d){logger[_0x01d4('0x13')](_0x01d4('0xf'),_0x2c8e5e,_0x25c48d);_0x21d127(_0x25c48d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fe432fd..bfeb706 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 _0x1e89=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1b2c04,_0x5bb67c){var _0x4d4ece=function(_0x26b4d8){while(--_0x26b4d8){_0x1b2c04['push'](_0x1b2c04['shift']());}};_0x4d4ece(++_0x5bb67c);}(_0x1e89,0x119));var _0x91e8=function(_0x1d7102,_0x1f37ea){_0x1d7102=_0x1d7102-0x0;var _0x5df6da=_0x1e89[_0x1d7102];return _0x5df6da;};'use strict';var multer=require(_0x91e8('0x0'));var util=require(_0x91e8('0x1'));var path=require('path');var timeout=require(_0x91e8('0x2'));var express=require(_0x91e8('0x3'));var router=express[_0x91e8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91e8('0x5'));var config=require('../../config/environment');module[_0x91e8('0x6')]=router; \ No newline at end of file +var _0x9c5a=['exports','util','path','express','Router','../../components/auth/service'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9c5a,0x79));var _0xa9c5=function(_0x2b2620,_0xa91be3){_0x2b2620=_0x2b2620-0x0;var _0x25b6cb=_0x9c5a[_0x2b2620];return _0x25b6cb;};'use strict';var multer=require('multer');var util=require(_0xa9c5('0x0'));var path=require(_0xa9c5('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9c5('0x2'));var router=express[_0xa9c5('0x3')]();var auth=require(_0xa9c5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xa9c5('0x5')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0ad17e6..8332704 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 _0x0abf=['sequelize','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5eb8=['INTEGER','STRING'];(function(_0xb0926b,_0x37a65b){var _0x3cbc3c=function(_0x18b711){while(--_0x18b711){_0xb0926b['push'](_0xb0926b['shift']());}};_0x3cbc3c(++_0x37a65b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x509d9e,_0x2d1197){_0x509d9e=_0x509d9e-0x0;var _0x56b488=_0x5eb8[_0x509d9e];return _0x56b488;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x85eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 465e422..1a32a46 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 _0x7b10=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x7b10,0x1ac));var _0x07b1=function(_0x574f3b,_0x11296b){_0x574f3b=_0x574f3b-0x0;var _0x18a225=_0x7b10[_0x574f3b];return _0x18a225;};'use strict';var _=require(_0x07b1('0x0'));var util=require(_0x07b1('0x1'));var logger=require(_0x07b1('0x2'))(_0x07b1('0x3'));var moment=require(_0x07b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x07b1('0x5'));var fs=require('fs');var path=require(_0x07b1('0x6'));var rimraf=require(_0x07b1('0x7'));var config=require(_0x07b1('0x8'));var attributes=require(_0x07b1('0x9'));module['exports']=function(_0x3cf5e4,_0x106f8d){return _0x3cf5e4[_0x07b1('0xa')](_0x07b1('0xb'),attributes,{'tableName':_0x07b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9227=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x9227,0xc3));var _0x7922=function(_0x5dca45,_0x50e665){_0x5dca45=_0x5dca45-0x0;var _0x235313=_0x9227[_0x5dca45];return _0x235313;};'use strict';var _=require(_0x7922('0x0'));var util=require('util');var logger=require(_0x7922('0x1'))(_0x7922('0x2'));var moment=require(_0x7922('0x3'));var BPromise=require(_0x7922('0x4'));var rp=require(_0x7922('0x5'));var fs=require('fs');var path=require(_0x7922('0x6'));var rimraf=require(_0x7922('0x7'));var config=require(_0x7922('0x8'));var attributes=require(_0x7922('0x9'));module[_0x7922('0xa')]=function(_0x38513a,_0x3a2538){return _0x38513a[_0x7922('0xb')](_0x7922('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 182a805..3fabcba 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 _0xe75e=['request','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4e667e,_0x112720){var _0x454ef3=function(_0x1b22c5){while(--_0x1b22c5){_0x4e667e['push'](_0x4e667e['shift']());}};_0x454ef3(++_0x112720);}(_0xe75e,0x15f));var _0xee75=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xe75e[_0x3c487b];return _0x1d65f6;};'use strict';var _=require(_0xee75('0x0'));var util=require(_0xee75('0x1'));var moment=require(_0xee75('0x2'));var BPromise=require(_0xee75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee75('0x4'));var logger=require(_0xee75('0x5'))('rpc');var config=require(_0xee75('0x6'));var jayson=require(_0xee75('0x7'));var client=jayson[_0xee75('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a69b8,_0x2bdd6e,_0x13575b){return new BPromise(function(_0x2b0543,_0x3f0351){return client[_0xee75('0x9')](_0x5a69b8,_0x13575b)[_0xee75('0xa')](function(_0x4e5428){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2bdd6e,_0xee75('0xb'));logger[_0xee75('0xc')](_0xee75('0xd'),_0x2bdd6e,_0xee75('0xb'),JSON[_0xee75('0xe')](_0x4e5428));if(_0x4e5428[_0xee75('0xf')]){if(_0x4e5428[_0xee75('0xf')][_0xee75('0x10')]===0x1f4){logger[_0xee75('0xf')](_0xee75('0x11'),_0x2bdd6e,_0x4e5428[_0xee75('0xf')][_0xee75('0x12')]);return _0x3f0351(_0x4e5428[_0xee75('0xf')][_0xee75('0x12')]);}logger[_0xee75('0xf')](_0xee75('0x11'),_0x2bdd6e,_0x4e5428['error'][_0xee75('0x12')]);return _0x2b0543(_0x4e5428['error']['message']);}else{logger['info'](_0xee75('0x11'),_0x2bdd6e,'request\x20sent');_0x2b0543(_0x4e5428['result'][_0xee75('0x12')]);}})[_0xee75('0x13')](function(_0x179555){logger['error'](_0xee75('0x11'),_0x2bdd6e,_0x179555);_0x3f0351(_0x179555);});});} \ No newline at end of file +var _0xa96d=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x54f1cb,_0x116be9){var _0x276906=function(_0x40527e){while(--_0x40527e){_0x54f1cb['push'](_0x54f1cb['shift']());}};_0x276906(++_0x116be9);}(_0xa96d,0x116));var _0xda96=function(_0xfff9cf,_0x55ad70){_0xfff9cf=_0xfff9cf-0x0;var _0x231718=_0xa96d[_0xfff9cf];return _0x231718;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xda96('0x0'));var fs=require('fs');var Redis=require(_0xda96('0x1'));var db=require(_0xda96('0x2'))['db'];var utils=require(_0xda96('0x3'));var logger=require(_0xda96('0x4'))(_0xda96('0x5'));var config=require(_0xda96('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xda96('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x478da9,_0x3199d0,_0x2ff9dd){return new BPromise(function(_0x3673b8,_0x3e0c6f){return client['request'](_0x478da9,_0x2ff9dd)[_0xda96('0x8')](function(_0x1c3e37){logger['info'](_0xda96('0x9'),_0x3199d0,_0xda96('0xa'));logger['debug'](_0xda96('0xb'),_0x3199d0,_0xda96('0xa'),JSON[_0xda96('0xc')](_0x1c3e37));if(_0x1c3e37['error']){if(_0x1c3e37[_0xda96('0xd')]['code']===0x1f4){logger[_0xda96('0xd')](_0xda96('0x9'),_0x3199d0,_0x1c3e37[_0xda96('0xd')][_0xda96('0xe')]);return _0x3e0c6f(_0x1c3e37[_0xda96('0xd')][_0xda96('0xe')]);}logger[_0xda96('0xd')](_0xda96('0x9'),_0x3199d0,_0x1c3e37[_0xda96('0xd')]['message']);return _0x3673b8(_0x1c3e37['error']['message']);}else{logger['info'](_0xda96('0x9'),_0x3199d0,_0xda96('0xa'));_0x3673b8(_0x1c3e37[_0xda96('0xf')][_0xda96('0xe')]);}})[_0xda96('0x10')](function(_0x2155b0){logger[_0xda96('0xd')](_0xda96('0x9'),_0x3199d0,_0x2155b0);_0x3e0c6f(_0x2155b0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1bd680b..c196b0f 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 _0x4434=['../../config/environment','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x26fc9e,_0x2f8039){var _0x513514=function(_0x43fe82){while(--_0x43fe82){_0x26fc9e['push'](_0x26fc9e['shift']());}};_0x513514(++_0x2f8039);}(_0x4434,0x175));var _0x4443=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4434[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0x4443('0x0'));var path=require(_0x4443('0x1'));var timeout=require(_0x4443('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4443('0x3'));var interaction=require(_0x4443('0x4'));var config=require(_0x4443('0x5'));module[_0x4443('0x6')]=router; \ No newline at end of file +var _0x39ed=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x39ed,0xbd));var _0xd39e=function(_0x2723d6,_0x554b78){_0x2723d6=_0x2723d6-0x0;var _0x1c01a9=_0x39ed[_0x2723d6];return _0x1c01a9;};'use strict';var multer=require(_0xd39e('0x0'));var util=require(_0xd39e('0x1'));var path=require('path');var timeout=require(_0xd39e('0x2'));var express=require(_0xd39e('0x3'));var router=express[_0xd39e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd39e('0x5'));var config=require(_0xd39e('0x6'));module[_0xd39e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ee64f1e..0f72c83 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 _0xd8b0=['exports','sequelize'];(function(_0x5b6aa8,_0x1f206a){var _0x5d7da4=function(_0x5a39b0){while(--_0x5a39b0){_0x5b6aa8['push'](_0x5b6aa8['shift']());}};_0x5d7da4(++_0x1f206a);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_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')]={'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 3090024..db67779 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x3496bb,_0x53ab1b){var _0x41aa58=function(_0x30c83c){while(--_0x30c83c){_0x3496bb['push'](_0x3496bb['shift']());}};_0x41aa58(++_0x53ab1b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x757a,0xde));var _0xa757=function(_0x4297fb,_0x1f30f5){_0x4297fb=_0x4297fb-0x0;var _0x46acfe=_0x757a[_0x4297fb];return _0x46acfe;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'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 a3a5a2d..3b92fcf 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 _0xb0e5=['info','UserMailQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x4060da,_0x3a9736){var _0x5c553d=function(_0x57ee78){while(--_0x57ee78){_0x4060da['push'](_0x4060da['shift']());}};_0x5c553d(++_0x3a9736);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x84ada4,_0x4b6de9){_0x84ada4=_0x84ada4-0x0;var _0x136066=_0xb0e5[_0x84ada4];return _0x136066;};'use strict';var _=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var moment=require(_0x5b0e('0x2'));var BPromise=require(_0x5b0e('0x3'));var rs=require(_0x5b0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b0e('0x5'));var logger=require('../../config/logger')(_0x5b0e('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b0e('0x7'));var client=jayson[_0x5b0e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x598ede,_0xbed2ff,_0x1bf5d0){return new BPromise(function(_0x2e7503,_0xb3ec8d){return client[_0x5b0e('0x9')](_0x598ede,_0x1bf5d0)[_0x5b0e('0xa')](function(_0x1aa61c){logger[_0x5b0e('0xb')](_0x5b0e('0xc'),_0xbed2ff,'request\x20sent');logger[_0x5b0e('0xd')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0xbed2ff,'request\x20sent',JSON[_0x5b0e('0xe')](_0x1aa61c));if(_0x1aa61c[_0x5b0e('0xf')]){if(_0x1aa61c[_0x5b0e('0xf')]['code']===0x1f4){logger[_0x5b0e('0xf')]('UserMailQueue,\x20%s,\x20%s',_0xbed2ff,_0x1aa61c['error'][_0x5b0e('0x10')]);return _0xb3ec8d(_0x1aa61c[_0x5b0e('0xf')][_0x5b0e('0x10')]);}logger[_0x5b0e('0xf')](_0x5b0e('0xc'),_0xbed2ff,_0x1aa61c[_0x5b0e('0xf')][_0x5b0e('0x10')]);return _0x2e7503(_0x1aa61c[_0x5b0e('0xf')][_0x5b0e('0x10')]);}else{logger[_0x5b0e('0xb')](_0x5b0e('0xc'),_0xbed2ff,_0x5b0e('0x11'));_0x2e7503(_0x1aa61c[_0x5b0e('0x12')][_0x5b0e('0x10')]);}})[_0x5b0e('0x13')](function(_0x133f39){logger[_0x5b0e('0xf')](_0x5b0e('0xc'),_0xbed2ff,_0x133f39);_0xb3ec8d(_0x133f39);});});} \ No newline at end of file +var _0x46e1=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1b3db3,_0x514ac5){var _0x18bd72=function(_0x5d631c){while(--_0x5d631c){_0x1b3db3['push'](_0x1b3db3['shift']());}};_0x18bd72(++_0x514ac5);}(_0x46e1,0x155));var _0x146e=function(_0xf0ed54,_0x23447e){_0xf0ed54=_0xf0ed54-0x0;var _0x6b36b0=_0x46e1[_0xf0ed54];return _0x6b36b0;};'use strict';var _=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var moment=require(_0x146e('0x2'));var BPromise=require(_0x146e('0x3'));var rs=require(_0x146e('0x4'));var fs=require('fs');var Redis=require(_0x146e('0x5'));var db=require(_0x146e('0x6'))['db'];var utils=require(_0x146e('0x7'));var logger=require(_0x146e('0x8'))(_0x146e('0x9'));var config=require('../../config/environment');var jayson=require(_0x146e('0xa'));var client=jayson[_0x146e('0xb')][_0x146e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x228fe7,_0x70ce4,_0x35e40e){return new BPromise(function(_0x1c1398,_0x5f33c0){return client[_0x146e('0xd')](_0x228fe7,_0x35e40e)['then'](function(_0x36f843){logger[_0x146e('0xe')](_0x146e('0xf'),_0x70ce4,_0x146e('0x10'));logger[_0x146e('0x11')](_0x146e('0x12'),_0x70ce4,'request\x20sent',JSON['stringify'](_0x36f843));if(_0x36f843[_0x146e('0x13')]){if(_0x36f843[_0x146e('0x13')][_0x146e('0x14')]===0x1f4){logger[_0x146e('0x13')](_0x146e('0xf'),_0x70ce4,_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);return _0x5f33c0(_0x36f843[_0x146e('0x13')]['message']);}logger['error'](_0x146e('0xf'),_0x70ce4,_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);return _0x1c1398(_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);}else{logger[_0x146e('0xe')](_0x146e('0xf'),_0x70ce4,_0x146e('0x10'));_0x1c1398(_0x36f843[_0x146e('0x16')][_0x146e('0x15')]);}})[_0x146e('0x17')](function(_0x55fddc){logger[_0x146e('0x13')](_0x146e('0xf'),_0x70ce4,_0x55fddc);_0x5f33c0(_0x55fddc);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a03caba..bf8317e 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 _0x223f=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x223f,0x168));var _0xf223=function(_0xed3f5f,_0x538e47){_0xed3f5f=_0xed3f5f-0x0;var _0x41bf09=_0x223f[_0xed3f5f];return _0x41bf09;};'use strict';var multer=require(_0xf223('0x0'));var util=require(_0xf223('0x1'));var path=require(_0xf223('0x2'));var timeout=require(_0xf223('0x3'));var express=require(_0xf223('0x4'));var router=express[_0xf223('0x5')]();var auth=require(_0xf223('0x6'));var interaction=require(_0xf223('0x7'));var config=require(_0xf223('0x8'));module['exports']=router; \ No newline at end of file +var _0x5f2a=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2ad2a4,_0x5cde36){var _0x2990eb=function(_0x5609fa){while(--_0x5609fa){_0x2ad2a4['push'](_0x2ad2a4['shift']());}};_0x2990eb(++_0x5cde36);}(_0x5f2a,0x1ea));var _0xa5f2=function(_0x5cea65,_0x1355ad){_0x5cea65=_0x5cea65-0x0;var _0x4508c2=_0x5f2a[_0x5cea65];return _0x4508c2;};'use strict';var multer=require(_0xa5f2('0x0'));var util=require('util');var path=require(_0xa5f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5f2('0x2'));var router=express[_0xa5f2('0x3')]();var auth=require(_0xa5f2('0x4'));var interaction=require(_0xa5f2('0x5'));var config=require('../../config/environment');module[_0xa5f2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 88de16a..145b240 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 _0xbaf0=['exports','INTEGER'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_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')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x362597,_0x24409d){var _0x9c20b9=function(_0x2307be){while(--_0x2307be){_0x362597['push'](_0x362597['shift']());}};_0x9c20b9(++_0x24409d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1df378,_0x2c4af3){_0x1df378=_0x1df378-0x0;var _0x2cb9fe=_0xb10b[_0x1df378];return _0x2cb9fe;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 918e4d2..59f090a 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 _0x6233=['bluebird','request-promise','path','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6233,0xa1));var _0x3623=function(_0x49d8ab,_0x58ef7a){_0x49d8ab=_0x49d8ab-0x0;var _0x1a3cdf=_0x6233[_0x49d8ab];return _0x1a3cdf;};'use strict';var _=require(_0x3623('0x0'));var util=require(_0x3623('0x1'));var logger=require(_0x3623('0x2'))(_0x3623('0x3'));var moment=require('moment');var BPromise=require(_0x3623('0x4'));var rp=require(_0x3623('0x5'));var fs=require('fs');var path=require(_0x3623('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3623('0x7'));module['exports']=function(_0x90da03,_0x3c2603){return _0x90da03[_0x3623('0x8')](_0x3623('0x9'),attributes,{'tableName':_0x3623('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa645=['request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa645,0x1a7));var _0x5a64=function(_0x1ae2fd,_0x361785){_0x1ae2fd=_0x1ae2fd-0x0;var _0x11b4eb=_0xa645[_0x1ae2fd];return _0x11b4eb;};'use strict';var _=require(_0x5a64('0x0'));var util=require(_0x5a64('0x1'));var logger=require(_0x5a64('0x2'))(_0x5a64('0x3'));var moment=require(_0x5a64('0x4'));var BPromise=require(_0x5a64('0x5'));var rp=require(_0x5a64('0x6'));var fs=require('fs');var path=require(_0x5a64('0x7'));var rimraf=require(_0x5a64('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a64('0x9'));module['exports']=function(_0x132e03,_0x39bf35){return _0x132e03[_0x5a64('0xa')](_0x5a64('0xb'),attributes,{'tableName':_0x5a64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 3c32974..ea6df93 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 _0x2370=['request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1b7c5c,_0x528ddd){var _0x47c5ca=function(_0x10e841){while(--_0x10e841){_0x1b7c5c['push'](_0x1b7c5c['shift']());}};_0x47c5ca(++_0x528ddd);}(_0x2370,0x13c));var _0x0237=function(_0x21024f,_0x35e650){_0x21024f=_0x21024f-0x0;var _0x26e8f8=_0x2370[_0x21024f];return _0x26e8f8;};'use strict';var _=require(_0x0237('0x0'));var util=require('util');var moment=require(_0x0237('0x1'));var BPromise=require('bluebird');var rs=require(_0x0237('0x2'));var fs=require('fs');var Redis=require(_0x0237('0x3'));var db=require(_0x0237('0x4'))['db'];var utils=require(_0x0237('0x5'));var logger=require(_0x0237('0x6'))(_0x0237('0x7'));var config=require(_0x0237('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0237('0x9')][_0x0237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfb574f,_0x5954d1,_0x1857f8){return new BPromise(function(_0x228ae3,_0x29203b){return client[_0x0237('0xb')](_0xfb574f,_0x1857f8)[_0x0237('0xc')](function(_0x1f6603){logger[_0x0237('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5954d1,_0x0237('0xe'));logger['debug'](_0x0237('0xf'),_0x5954d1,_0x0237('0xe'),JSON['stringify'](_0x1f6603));if(_0x1f6603[_0x0237('0x10')]){if(_0x1f6603[_0x0237('0x10')][_0x0237('0x11')]===0x1f4){logger[_0x0237('0x10')](_0x0237('0x12'),_0x5954d1,_0x1f6603[_0x0237('0x10')][_0x0237('0x13')]);return _0x29203b(_0x1f6603[_0x0237('0x10')][_0x0237('0x13')]);}logger[_0x0237('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5954d1,_0x1f6603[_0x0237('0x10')][_0x0237('0x13')]);return _0x228ae3(_0x1f6603[_0x0237('0x10')]['message']);}else{logger[_0x0237('0xd')](_0x0237('0x12'),_0x5954d1,_0x0237('0xe'));_0x228ae3(_0x1f6603[_0x0237('0x14')]['message']);}})[_0x0237('0x15')](function(_0x199f21){logger[_0x0237('0x10')](_0x0237('0x12'),_0x5954d1,_0x199f21);_0x29203b(_0x199f21);});});} \ No newline at end of file +var _0x237e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x559974,_0x4a0452){var _0x7a3849=function(_0xfd8e11){while(--_0xfd8e11){_0x559974['push'](_0x559974['shift']());}};_0x7a3849(++_0x4a0452);}(_0x237e,0xb4));var _0xe237=function(_0x20287f,_0x258257){_0x20287f=_0x20287f-0x0;var _0x12e482=_0x237e[_0x20287f];return _0x12e482;};'use strict';var _=require(_0xe237('0x0'));var util=require(_0xe237('0x1'));var moment=require('moment');var BPromise=require(_0xe237('0x2'));var rs=require(_0xe237('0x3'));var fs=require('fs');var Redis=require(_0xe237('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe237('0x5'));var logger=require(_0xe237('0x6'))(_0xe237('0x7'));var config=require(_0xe237('0x8'));var jayson=require(_0xe237('0x9'));var client=jayson[_0xe237('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f7d0a,_0x5c4105,_0x2cb420){return new BPromise(function(_0x312763,_0x27951a){return client['request'](_0x1f7d0a,_0x2cb420)[_0xe237('0xb')](function(_0x296fcc){logger[_0xe237('0xc')](_0xe237('0xd'),_0x5c4105,_0xe237('0xe'));logger[_0xe237('0xf')](_0xe237('0x10'),_0x5c4105,'request\x20sent',JSON[_0xe237('0x11')](_0x296fcc));if(_0x296fcc[_0xe237('0x12')]){if(_0x296fcc[_0xe237('0x12')][_0xe237('0x13')]===0x1f4){logger[_0xe237('0x12')](_0xe237('0xd'),_0x5c4105,_0x296fcc['error'][_0xe237('0x14')]);return _0x27951a(_0x296fcc['error'][_0xe237('0x14')]);}logger['error'](_0xe237('0xd'),_0x5c4105,_0x296fcc[_0xe237('0x12')][_0xe237('0x14')]);return _0x312763(_0x296fcc[_0xe237('0x12')]['message']);}else{logger['info'](_0xe237('0xd'),_0x5c4105,_0xe237('0xe'));_0x312763(_0x296fcc[_0xe237('0x15')][_0xe237('0x14')]);}})[_0xe237('0x16')](function(_0x2f2c3d){logger[_0xe237('0x12')](_0xe237('0xd'),_0x5c4105,_0x2f2c3d);_0x27951a(_0x2f2c3d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f9e871d..8e35b0d 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 _0x57ad=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','delete','destroy','removeSections','removeResources','exports','multer','util','path'];(function(_0xb8ba04,_0x29006a){var _0x99ca66=function(_0x469d20){while(--_0x469d20){_0xb8ba04['push'](_0xb8ba04['shift']());}};_0x99ca66(++_0x29006a);}(_0x57ad,0x10b));var _0xd57a=function(_0x1b8050,_0x4d12c6){_0x1b8050=_0x1b8050-0x0;var _0x1ec2b1=_0x57ad[_0x1b8050];return _0x1ec2b1;};'use strict';var multer=require(_0xd57a('0x0'));var util=require(_0xd57a('0x1'));var path=require(_0xd57a('0x2'));var timeout=require(_0xd57a('0x3'));var express=require(_0xd57a('0x4'));var router=express[_0xd57a('0x5')]();var auth=require(_0xd57a('0x6'));var interaction=require(_0xd57a('0x7'));var config=require(_0xd57a('0x8'));var controller=require(_0xd57a('0x9'));router[_0xd57a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd57a('0xa')](_0xd57a('0xb'),auth[_0xd57a('0xc')](),controller[_0xd57a('0xd')]);router[_0xd57a('0xa')](_0xd57a('0xe'),auth[_0xd57a('0xc')](),controller[_0xd57a('0xf')]);router[_0xd57a('0xa')](_0xd57a('0x10'),auth[_0xd57a('0xc')](),controller['getSections']);router['get'](_0xd57a('0x11'),auth[_0xd57a('0xc')](),controller[_0xd57a('0x12')]);router[_0xd57a('0x13')]('/',auth[_0xd57a('0xc')](),controller[_0xd57a('0x14')]);router[_0xd57a('0x13')]('/:id/clone',auth[_0xd57a('0xc')](),controller[_0xd57a('0x15')]);router['post']('/:id/sections',auth[_0xd57a('0xc')](),controller[_0xd57a('0x16')]);router[_0xd57a('0x13')]('/:id/resources',auth[_0xd57a('0xc')](),controller[_0xd57a('0x17')]);router[_0xd57a('0x18')](_0xd57a('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd57a('0x19')](_0xd57a('0xe'),auth[_0xd57a('0xc')](),controller[_0xd57a('0x1a')]);router[_0xd57a('0x19')](_0xd57a('0x10'),auth[_0xd57a('0xc')](),controller[_0xd57a('0x1b')]);router['delete']('/:id/resources',auth[_0xd57a('0xc')](),controller[_0xd57a('0x1c')]);module[_0xd57a('0x1d')]=router; \ No newline at end of file +var _0xf44a=['getResources','create','post','/:id/clone','addResources','put','/:id','update','delete','removeSections','removeResources','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','/describe','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources'];(function(_0x28bfdc,_0x50fd27){var _0x25bf45=function(_0x17f94a){while(--_0x17f94a){_0x28bfdc['push'](_0x28bfdc['shift']());}};_0x25bf45(++_0x50fd27);}(_0xf44a,0xc8));var _0xaf44=function(_0x23d274,_0x7e1ebe){_0x23d274=_0x23d274-0x0;var _0x2b0f72=_0xf44a[_0x23d274];return _0x2b0f72;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xaf44('0x0'));var express=require(_0xaf44('0x1'));var router=express[_0xaf44('0x2')]();var auth=require(_0xaf44('0x3'));var interaction=require(_0xaf44('0x4'));var config=require(_0xaf44('0x5'));var controller=require(_0xaf44('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xaf44('0x7')]);router[_0xaf44('0x8')](_0xaf44('0x9'),auth[_0xaf44('0xa')](),controller[_0xaf44('0xb')]);router[_0xaf44('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaf44('0xc')]);router['get'](_0xaf44('0xd'),auth[_0xaf44('0xa')](),controller[_0xaf44('0xe')]);router[_0xaf44('0x8')](_0xaf44('0xf'),auth[_0xaf44('0xa')](),controller[_0xaf44('0x10')]);router['post']('/',auth[_0xaf44('0xa')](),controller[_0xaf44('0x11')]);router[_0xaf44('0x12')](_0xaf44('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xaf44('0x12')]('/:id/sections',auth[_0xaf44('0xa')](),controller['addSections']);router['post']('/:id/resources',auth[_0xaf44('0xa')](),controller[_0xaf44('0x14')]);router[_0xaf44('0x15')](_0xaf44('0x16'),auth[_0xaf44('0xa')](),controller[_0xaf44('0x17')]);router[_0xaf44('0x18')](_0xaf44('0x16'),auth[_0xaf44('0xa')](),controller['destroy']);router[_0xaf44('0x18')](_0xaf44('0xd'),auth['isAuthenticated'](),controller[_0xaf44('0x19')]);router['delete'](_0xaf44('0xf'),auth['isAuthenticated'](),controller[_0xaf44('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 216d1cc..c8e06db 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 _0x92ac=['split','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x92ac,0x151));var _0xc92a=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x92ac[_0x725a4c];return _0x37b2cc;};'use strict';var Sequelize=require(_0xc92a('0x0'));module[_0xc92a('0x1')]={'name':{'type':Sequelize[_0xc92a('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2d2db5){this[_0xc92a('0x3')](_0xc92a('0x4'),_0x2d2db5?_0x2d2db5[_0xc92a('0x5')](''):[]);},'get':function(){return this[_0xc92a('0x6')](_0xc92a('0x4'))?this['getDataValue'](_0xc92a('0x4'))[_0xc92a('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc92a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2dc3=['exports','name','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2dc3,0x150));var _0x32dc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2dc3[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x32dc('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x32dc('0x1')},'crudPermissions':{'type':Sequelize[_0x32dc('0x2')],'set':function(_0x3f4a2f){this[_0x32dc('0x3')](_0x32dc('0x4'),_0x3f4a2f?_0x3f4a2f[_0x32dc('0x5')](''):[]);},'get':function(){return this[_0x32dc('0x6')](_0x32dc('0x4'))?this[_0x32dc('0x6')](_0x32dc('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x32dc('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c6e346e..d7e3e65 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 _0xb383=['OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','intervals','pauses','Pause','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','metrics','AnalyticMetric','WhatsappAccount','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/utils','defaults','redis','./userProfile.socket','register','sendStatus','status','json','count','offset','apply','reject','save','update','end','stack','name','send','index','map','UserProfile','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','type','VIRTUAL','options','includeAll','include','then','rows','catch','show','rawAttributes','find','create','clone','params','length','get','omit','createdAt','updatedAt','crudPermissions','body','transaction','findAll','each','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','describe','addSections','destroy','push','ids','getSections','enabled','isEmpty','includes','subsections','autoAssociation','Dashboard','forEach','Plugin','sequelize','bulkCreate','removeResources','getResources','undefined','ValidationError','Unknown\x20section','mergeResources','childModel','Sequelize','Invalid\x20section\x20\x27','parentSections','findOne','ignore','all','where','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CmContact','Tag','Tags','color','tag','value','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projects','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts'];(function(_0x1191ce,_0x3d1269){var _0x5caff9=function(_0x44f1bf){while(--_0x44f1bf){_0x1191ce['push'](_0x1191ce['shift']());}};_0x5caff9(++_0x3d1269);}(_0xb383,0x114));var _0x3b38=function(_0x98de1d,_0x2c605d){_0x98de1d=_0x98de1d-0x0;var _0x47e56a=_0xb383[_0x98de1d];return _0x47e56a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b38('0x0'));var rimraf=require(_0x3b38('0x1'));var zipdir=require(_0x3b38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b38('0x3'));var moment=require(_0x3b38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b38('0x5'));var util=require(_0x3b38('0x6'));var path=require(_0x3b38('0x7'));var sox=require(_0x3b38('0x8'));var csv=require(_0x3b38('0x9'));var ejs=require(_0x3b38('0xa'));var fs=require('fs');var _=require(_0x3b38('0xb'));var squel=require(_0x3b38('0xc'));var crypto=require(_0x3b38('0xd'));var jsforce=require(_0x3b38('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3b38('0x9'));var querystring=require(_0x3b38('0xf'));var Papa=require(_0x3b38('0x10'));var Redis=require('ioredis');var authService=require(_0x3b38('0x11'));var qs=require(_0x3b38('0x12'));var as=require(_0x3b38('0x13'));var hardwareService=require(_0x3b38('0x14'));var logger=require(_0x3b38('0x15'))('api');var utils=require(_0x3b38('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3b38('0x17')](config[_0x3b38('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b38('0x18')]));require(_0x3b38('0x19'))[_0x3b38('0x1a')](socket);function respondWithStatusCode(_0x1991f3,_0x5ce89b){_0x5ce89b=_0x5ce89b||0xcc;return function(_0xd0846d){if(_0xd0846d){return _0x1991f3[_0x3b38('0x1b')](_0x5ce89b);}return _0x1991f3[_0x3b38('0x1c')](_0x5ce89b)['end']();};}function respondWithResult(_0xf11cdf,_0x58e564){_0x58e564=_0x58e564||0xc8;return function(_0x30cbd6){if(_0x30cbd6){return _0xf11cdf['status'](_0x58e564)[_0x3b38('0x1d')](_0x30cbd6);}};}function respondWithFilteredResult(_0x3d564e,_0x5ce732){return function(_0x2e3354){if(_0x2e3354){var _0x1c3d2b=_0x2e3354[_0x3b38('0x1e')],_0x1aa245=_0x5ce732[_0x3b38('0x1f')],_0x2e2901=_0x5ce732[_0x3b38('0x1f')]+_0x5ce732['limit'],_0x19b922;if(_0x2e2901>=_0x1c3d2b){_0x2e2901=_0x1c3d2b;_0x19b922=0xc8;}else{_0x19b922=0xce;}_0x3d564e['status'](_0x19b922);return _0x3d564e['set']('Content-Range',_0x1aa245+'-'+_0x2e2901+'/'+_0x1c3d2b)[_0x3b38('0x1d')](_0x2e3354);}return null;};}function patchUpdates(_0x2397c2){return function(_0x2a6277){try{jsonpatch[_0x3b38('0x20')](_0x2a6277,_0x2397c2,!![]);}catch(_0x2908b6){return BPromise[_0x3b38('0x21')](_0x2908b6);}return _0x2a6277[_0x3b38('0x22')]();};}function saveUpdates(_0x3092cd,_0x151c00){return function(_0x2d1c33){if(_0x2d1c33){return _0x2d1c33[_0x3b38('0x23')](_0x3092cd)['then'](function(_0x41e5be){return _0x41e5be;});}return null;};}function removeEntity(_0x245fba,_0x43941f){return function(_0x23f6de){if(_0x23f6de){return _0x23f6de['destroy']()['then'](function(){_0x245fba[_0x3b38('0x1c')](0xcc)[_0x3b38('0x24')]();});}};}function handleEntityNotFound(_0x5a5d4a,_0x2f4ebe){return function(_0xc13925){if(!_0xc13925){_0x5a5d4a[_0x3b38('0x1b')](0x194);}return _0xc13925;};}function handleError(_0x1441c6,_0x46c3e1){_0x46c3e1=_0x46c3e1||0x1f4;return function(_0x9653da){logger['error'](_0x9653da[_0x3b38('0x25')]);if(_0x9653da[_0x3b38('0x26')]){delete _0x9653da[_0x3b38('0x26')];}_0x1441c6['status'](_0x46c3e1)[_0x3b38('0x27')](_0x9653da);};}exports[_0x3b38('0x28')]=function(_0x475993,_0x165cef){var _0x17c9a3={},_0x3b98cd={},_0x13328b={'count':0x0,'rows':[]};var _0x50d615=_[_0x3b38('0x29')](db[_0x3b38('0x2a')]['rawAttributes'],function(_0x2aa382){return{'name':_0x2aa382[_0x3b38('0x2b')],'type':_0x2aa382['type'][_0x3b38('0x2c')]};});_0x3b98cd[_0x3b38('0x2d')]=_[_0x3b38('0x29')](_0x50d615,_0x3b38('0x26'));_0x3b98cd[_0x3b38('0x2e')]=_[_0x3b38('0x2f')](_0x475993['query']);_0x3b98cd[_0x3b38('0x30')]=_['intersection'](_0x3b98cd[_0x3b38('0x2d')],_0x3b98cd[_0x3b38('0x2e')]);_0x17c9a3[_0x3b38('0x31')]=_[_0x3b38('0x32')](_0x3b98cd[_0x3b38('0x2d')],qs[_0x3b38('0x33')](_0x475993[_0x3b38('0x2e')][_0x3b38('0x33')]));_0x17c9a3[_0x3b38('0x31')]=_0x17c9a3[_0x3b38('0x31')]['length']?_0x17c9a3['attributes']:_0x3b98cd[_0x3b38('0x2d')];if(!_0x475993[_0x3b38('0x2e')][_0x3b38('0x34')](_0x3b38('0x35'))){_0x17c9a3[_0x3b38('0x36')]=qs[_0x3b38('0x36')](_0x475993[_0x3b38('0x2e')][_0x3b38('0x36')]);_0x17c9a3[_0x3b38('0x1f')]=qs[_0x3b38('0x1f')](_0x475993[_0x3b38('0x2e')][_0x3b38('0x1f')]);}_0x17c9a3[_0x3b38('0x37')]=qs[_0x3b38('0x38')](_0x475993[_0x3b38('0x2e')][_0x3b38('0x38')]);_0x17c9a3['where']=qs['filters'](_[_0x3b38('0x39')](_0x475993[_0x3b38('0x2e')],_0x3b98cd['filters']),_0x50d615);if(_0x475993['query'][_0x3b38('0x3a')]){_0x17c9a3['where']=_[_0x3b38('0x3b')](_0x17c9a3['where'],{'$or':_['map'](_0x50d615,function(_0x34be34){if(_0x34be34[_0x3b38('0x3c')]!==_0x3b38('0x3d')){var _0x104ec8={};_0x104ec8[_0x34be34[_0x3b38('0x26')]]={'$like':'%'+_0x475993[_0x3b38('0x2e')][_0x3b38('0x3a')]+'%'};return _0x104ec8;}})});}_0x17c9a3=_[_0x3b38('0x3b')]({},_0x17c9a3,_0x475993[_0x3b38('0x3e')]);var _0x4199cf={'where':_0x17c9a3['where']};return db[_0x3b38('0x2a')]['count'](_0x4199cf)['then'](function(_0x58273e){_0x13328b[_0x3b38('0x1e')]=_0x58273e;if(_0x475993[_0x3b38('0x2e')][_0x3b38('0x3f')]){_0x17c9a3[_0x3b38('0x40')]=[{'all':!![]}];}return db[_0x3b38('0x2a')]['findAll'](_0x17c9a3);})[_0x3b38('0x41')](function(_0xe98795){_0x13328b[_0x3b38('0x42')]=_0xe98795;return _0x13328b;})[_0x3b38('0x41')](respondWithFilteredResult(_0x165cef,_0x17c9a3))[_0x3b38('0x43')](handleError(_0x165cef,null));};exports[_0x3b38('0x44')]=function(_0x5861c2,_0x2fd1be){var _0x1909e4={'raw':![],'where':{'id':_0x5861c2['params']['id']}},_0x244825={};_0x244825[_0x3b38('0x2d')]=_[_0x3b38('0x2f')](db[_0x3b38('0x2a')][_0x3b38('0x45')]);_0x244825[_0x3b38('0x2e')]=_[_0x3b38('0x2f')](_0x5861c2[_0x3b38('0x2e')]);_0x244825[_0x3b38('0x30')]=_['intersection'](_0x244825[_0x3b38('0x2d')],_0x244825[_0x3b38('0x2e')]);_0x1909e4['attributes']=_[_0x3b38('0x32')](_0x244825[_0x3b38('0x2d')],qs[_0x3b38('0x33')](_0x5861c2['query'][_0x3b38('0x33')]));_0x1909e4[_0x3b38('0x31')]=_0x1909e4['attributes']['length']?_0x1909e4[_0x3b38('0x31')]:_0x244825[_0x3b38('0x2d')];if(_0x5861c2[_0x3b38('0x2e')][_0x3b38('0x3f')]){_0x1909e4[_0x3b38('0x40')]=[{'all':!![]}];}_0x1909e4=_[_0x3b38('0x3b')]({},_0x1909e4,_0x5861c2[_0x3b38('0x3e')]);return db[_0x3b38('0x2a')][_0x3b38('0x46')](_0x1909e4)[_0x3b38('0x41')](handleEntityNotFound(_0x2fd1be,null))[_0x3b38('0x41')](respondWithResult(_0x2fd1be,null))[_0x3b38('0x43')](handleError(_0x2fd1be,null));};exports['create']=function(_0x5803d2,_0x303fe9){return db[_0x3b38('0x2a')][_0x3b38('0x47')](_0x5803d2['body'],{})[_0x3b38('0x41')](respondWithResult(_0x303fe9,0xc9))['catch'](handleError(_0x303fe9,null));};exports[_0x3b38('0x48')]=function(_0x276753,_0x1a3a37){var _0x33b571={'where':{'id':_0x276753[_0x3b38('0x49')]['id']}},_0x200828={};_0x200828[_0x3b38('0x2d')]=_[_0x3b38('0x2f')](db[_0x3b38('0x2a')][_0x3b38('0x45')]);_0x33b571[_0x3b38('0x31')]=_['intersection'](_0x200828[_0x3b38('0x2d')],qs[_0x3b38('0x33')](_0x276753['query'][_0x3b38('0x33')]));_0x33b571[_0x3b38('0x31')]=_0x33b571[_0x3b38('0x31')][_0x3b38('0x4a')]?_0x33b571[_0x3b38('0x31')]:_0x200828[_0x3b38('0x2d')];if(_0x276753[_0x3b38('0x2e')][_0x3b38('0x3f')]){_0x33b571[_0x3b38('0x40')]=[{'all':!![]}];}_0x33b571=_[_0x3b38('0x3b')]({},_0x33b571,_0x276753[_0x3b38('0x3e')]);return db['UserProfile']['find'](_0x33b571)[_0x3b38('0x41')](handleEntityNotFound(_0x1a3a37,null))[_0x3b38('0x41')](function(_0x514dc0){if(_0x514dc0){var _0x4b37b2=_0x514dc0[_0x3b38('0x4b')]({'plain':!![]});_0x4b37b2=qs[_0x3b38('0x4c')](_0x4b37b2,['id',_0x3b38('0x4d'),_0x3b38('0x4e'),_0x3b38('0x4f')]);_0x276753[_0x3b38('0x50')]=_[_0x3b38('0x4c')](_0x276753[_0x3b38('0x50')],['id',_0x3b38('0x4d'),_0x3b38('0x4e')]);return db['sequelize'][_0x3b38('0x51')](function(_0x317dc9){return db[_0x3b38('0x2a')]['create'](_[_0x3b38('0x3b')](_0x4b37b2,_0x276753[_0x3b38('0x50')]),{'include':_0x276753[_0x3b38('0x2e')][_0x3b38('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x317dc9})[_0x3b38('0x41')](function(_0x122685){var _0x186289=_0x122685[_0x3b38('0x4b')]({'plain':!![]});return db['UserProfileSection'][_0x3b38('0x52')]({'where':{'userProfileId':_0x276753['params']['id']},'raw':!![]})[_0x3b38('0x41')](function(_0x2d306f){if(_0x2d306f){return BPromise[_0x3b38('0x53')](_0x2d306f,function(_0xcd15ce){return new BPromise(function(_0x417e04,_0x74553b){if(_0xcd15ce['autoAssociation']===null||_0xcd15ce['autoAssociation']===0x1)_0x417e04(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xcd15ce['id']},'raw':!![]})[_0x3b38('0x41')](function(_0x2f831d){var _0x39b137=_[_0x3b38('0x29')](_0x2f831d,function(_0x5949f7){return qs[_0x3b38('0x4c')](_0x5949f7,['id',_0x3b38('0x4d'),_0x3b38('0x4e'),_0x3b38('0x54')]);});_0x417e04(_0x39b137);})[_0x3b38('0x43')](function(_0x5e1e19){_0x74553b(_0x5e1e19);});})[_0x3b38('0x41')](function(_0x2db72f){var _0xac7cf=qs['omit'](_0xcd15ce,['id',_0x3b38('0x4d'),_0x3b38('0x4e')]);_0xac7cf[_0x3b38('0x55')]=_0x186289['id'];if(_0x2db72f)_0xac7cf[_0x3b38('0x56')]=_0x2db72f;return _0xac7cf;})[_0x3b38('0x41')](function(_0x77f186){return db[_0x3b38('0x57')][_0x3b38('0x47')](_0x77f186,{'include':[{'model':db[_0x3b38('0x58')],'as':_0x3b38('0x56')}],'raw':!![],'transaction':_0x317dc9});});})[_0x3b38('0x41')](function(){return _0x186289;});}});});});}})[_0x3b38('0x41')](respondWithResult(_0x1a3a37,0xc9))[_0x3b38('0x43')](handleError(_0x1a3a37,null));};exports[_0x3b38('0x23')]=function(_0xa6231b,_0x575192){if(_0xa6231b[_0x3b38('0x50')]['id']){delete _0xa6231b[_0x3b38('0x50')]['id'];}return db['UserProfile'][_0x3b38('0x46')]({'where':{'id':_0xa6231b['params']['id']}})['then'](handleEntityNotFound(_0x575192,null))[_0x3b38('0x41')](saveUpdates(_0xa6231b[_0x3b38('0x50')],null))['then'](respondWithResult(_0x575192,null))[_0x3b38('0x43')](handleError(_0x575192,null));};exports['destroy']=function(_0x2e70c6,_0x169320){return db[_0x3b38('0x2a')]['find']({'where':{'id':_0x2e70c6['params']['id']}})[_0x3b38('0x41')](handleEntityNotFound(_0x169320,null))['then'](removeEntity(_0x169320,null))['catch'](handleError(_0x169320,null));};exports[_0x3b38('0x59')]=function(_0x37212c,_0x499ebf){return db['UserProfile'][_0x3b38('0x59')]()['then'](respondWithResult(_0x499ebf,null))[_0x3b38('0x43')](handleError(_0x499ebf,null));};exports[_0x3b38('0x5a')]=function(_0x113491,_0x33f1c6){var _0x416849=_0x113491[_0x3b38('0x50')];return db[_0x3b38('0x2a')]['find']({'where':{'id':_0x113491[_0x3b38('0x49')]['id']}})['then'](handleEntityNotFound(_0x33f1c6,null))[_0x3b38('0x41')](function(_0xa17aa1){if(_0xa17aa1){return db['sequelize'][_0x3b38('0x51')](function(_0x4ffded){return db['UserProfileSection'][_0x3b38('0x5b')]({'where':{'userProfileId':_0x113491[_0x3b38('0x49')]['id'],'sectionId':_['map'](_0x416849,function(_0x58ae84){return _0x58ae84[_0x3b38('0x54')];})},'transaction':_0x4ffded})[_0x3b38('0x41')](function(){var _0x15561e=_['map'](_0x416849,function(_0x4b479a){_0x4b479a[_0x3b38('0x55')]=_0x113491[_0x3b38('0x49')]['id'];return _0x4b479a;});var _0x45f321=[];return BPromise[_0x3b38('0x53')](_0x15561e,function(_0x3179d2){return db['UserProfileSection'][_0x3b38('0x47')](_0x3179d2,{'include':[{'model':db[_0x3b38('0x58')],'as':_0x3b38('0x56')}],'raw':!![],'transaction':_0x4ffded})[_0x3b38('0x41')](function(_0x396f67){_0x45f321[_0x3b38('0x5c')](_0x396f67[_0x3b38('0x4b')]({'plain':!![]}));});})[_0x3b38('0x41')](function(){return _0x45f321;});});});}})[_0x3b38('0x41')](function(_0x418098){return _0x418098;})[_0x3b38('0x41')](respondWithResult(_0x33f1c6,null))[_0x3b38('0x43')](handleError(_0x33f1c6,null));};exports['removeSections']=function(_0x16af67,_0xe0163d){var _0x4b3337;return db[_0x3b38('0x2a')][_0x3b38('0x46')]({'where':{'id':_0x16af67[_0x3b38('0x49')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0xe0163d,null))['then'](function(_0x21b60e){if(_0x21b60e){_0x4b3337=_0x21b60e;return db['UserProfileSection'][_0x3b38('0x5b')]({'where':{'userProfileId':_0x16af67[_0x3b38('0x49')]['id'],'sectionId':_0x16af67['query'][_0x3b38('0x5d')]}});}})['then'](function(){return _0x4b3337;})[_0x3b38('0x41')](respondWithStatusCode(_0xe0163d,null))[_0x3b38('0x43')](handleError(_0xe0163d,null));};exports[_0x3b38('0x5e')]=function(_0x3ad750,_0x5da163){var _0x2c0e4a=[];var _0x1bc885=[];return db[_0x3b38('0x57')][_0x3b38('0x52')]({'where':{'userProfileId':_0x3ad750[_0x3b38('0x49')]['id']},'raw':!![]})[_0x3b38('0x41')](function(_0x48aa3e){_0x2c0e4a=_['filter'](_0x48aa3e,function(_0x276d42){return _0x276d42[_0x3b38('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x276d42[_0x3b38('0x54')]);});if(!_[_0x3b38('0x60')](_0x2c0e4a)){return _['map'](_0x2c0e4a,function(_0xbcf682){return _0xbcf682[_0x3b38('0x54')];});}else{return;}})[_0x3b38('0x41')](function(_0x452627){if(_0x452627)_0x1bc885=_0x452627;if(_[_0x3b38('0x61')](_0x1bc885,0x64)){var _0x10d395=_['find'](_0x2c0e4a,{'sectionId':0x64});return hasDefaultDashboard(_0x10d395)[_0x3b38('0x41')](function(_0x548da5){return _[_0x3b38('0x29')](_0x2c0e4a,function(_0xe5d403){if(_0xe5d403[_0x3b38('0x54')]===0x64){_0xe5d403['subsections']=_0x548da5;}return _0xe5d403;});});}else{return;}})[_0x3b38('0x41')](function(_0x599956){if(_0x599956)_0x2c0e4a=_0x599956;if(_[_0x3b38('0x61')](_0x1bc885,0x3eb)){var _0x304bbd=_['find'](_0x2c0e4a,{'sectionId':0x3eb});return getCustomDashboards(_0x304bbd)['then'](function(_0x127471){return _[_0x3b38('0x29')](_0x2c0e4a,function(_0x3f4af6){if(_0x304bbd[_0x3b38('0x5f')]){if(_0x3f4af6[_0x3b38('0x54')]===0x3eb){_0x3f4af6[_0x3b38('0x62')]=_0x127471;}}else{if(_0x3f4af6[_0x3b38('0x54')]===0x64){_0x3f4af6['subsections']=_0x127471;}}return _0x3f4af6;});});}else{return;}})['then'](function(_0x2b1a5c){if(_0x2b1a5c)_0x2c0e4a=_0x2b1a5c;if(_[_0x3b38('0x61')](_0x1bc885,0x709)){var _0x23b33e=_[_0x3b38('0x46')](_0x2c0e4a,{'sectionId':0x709});return getPlugins(_0x23b33e)['then'](function(_0x11cc47){if(_0x23b33e[_0x3b38('0x5f')]){return _[_0x3b38('0x29')](_0x2c0e4a,function(_0x1f6781){if(_0x1f6781['sectionId']===0x709){_0x1f6781[_0x3b38('0x62')]=_0x11cc47;}return _0x1f6781;});}else{var _0x5a52d8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x11cc47};var _0x5e3663=_[_0x3b38('0x29')](_0x2c0e4a);_0x5e3663[_0x3b38('0x5c')](_0x5a52d8);return _0x5e3663;}});}else{return;}})[_0x3b38('0x41')](function(_0x3c6ccb){if(_0x3c6ccb)_0x2c0e4a=_0x3c6ccb;return _['filter'](_0x2c0e4a,[_0x3b38('0x5f'),0x1]);})['then'](respondWithResult(_0x5da163,null))[_0x3b38('0x43')](handleError(_0x5da163,null));};function hasDefaultDashboard(_0x1bccf2){var _0x3dd595=[0x65];return new BPromise(function(_0x2f2904,_0x522d33){try{if(_0x1bccf2['autoAssociation']){_0x2f2904(_0x3dd595);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x1bccf2['id']},'raw':!![]})[_0x3b38('0x41')](function(_0x22dd3c){_0x22dd3c?_0x2f2904(_0x3dd595):_0x2f2904();});}}catch(_0x502f36){_0x522d33(_0x502f36);}});}function getCustomDashboards(_0xbed588){var _0x12b8ea=[];return new BPromise(function(_0x4cac66,_0x4e1cc9){try{if(_0xbed588[_0x3b38('0x63')]){return db[_0x3b38('0x64')][_0x3b38('0x52')]({'raw':!![]})[_0x3b38('0x41')](function(_0x3caf80){_0x3caf80[_0x3b38('0x65')](function(_0x14e4e2){_0x12b8ea[_0x3b38('0x5c')](_0x14e4e2['id']+0x1869f);});_0x4cac66(_0x12b8ea);});}else{return db[_0x3b38('0x58')][_0x3b38('0x52')]({'where':{'sectionId':_0xbed588['id']},'raw':!![]})['then'](function(_0x5854bb){_0x5854bb[_0x3b38('0x65')](function(_0x4640be){_0x12b8ea[_0x3b38('0x5c')](_0x4640be['resourceId']+0x1869f);});_0x4cac66(_0x12b8ea);});}}catch(_0x8efe54){_0x4e1cc9(_0x8efe54);}});}function getPlugins(_0x3a6997){var _0x23feed=[];return new BPromise(function(_0x173abd,_0x4bc55e){try{if(_0x3a6997[_0x3b38('0x63')]){return db[_0x3b38('0x66')][_0x3b38('0x52')]({'raw':!![]})[_0x3b38('0x41')](function(_0xd02458){_0xd02458[_0x3b38('0x65')](function(_0x1efe49){_0x23feed[_0x3b38('0x5c')](_0x1efe49['id']+0x15b38);});_0x173abd(_0x23feed);});}else{return db[_0x3b38('0x58')][_0x3b38('0x52')]({'where':{'sectionId':_0x3a6997['id']},'raw':!![]})[_0x3b38('0x41')](function(_0x4f3a2f){_0x4f3a2f['forEach'](function(_0x2fe7bd){_0x23feed[_0x3b38('0x5c')](_0x2fe7bd['resourceId']+0x15b38);});_0x173abd(_0x23feed);});}}catch(_0x2b0468){_0x4bc55e(_0x2b0468);}});}exports['addResources']=function(_0x5adf28,_0x1895eb){return db['UserProfile'][_0x3b38('0x46')]({'where':{'id':_0x5adf28[_0x3b38('0x49')]['id']}})[_0x3b38('0x41')](handleEntityNotFound(_0x1895eb,null))[_0x3b38('0x41')](function(_0x2e1d8d){if(_0x2e1d8d){return db[_0x3b38('0x67')][_0x3b38('0x51')](function(_0x152e66){return db[_0x3b38('0x57')][_0x3b38('0x52')]({'where':{'userProfileId':_0x5adf28[_0x3b38('0x49')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x13617a){if(_0x13617a){return db[_0x3b38('0x57')]['destroy']({'where':{'userProfileId':_0x5adf28[_0x3b38('0x49')]['id'],'id':_[_0x3b38('0x29')](_0x13617a,function(_0x181a78){return _0x181a78['id'];})},'transaction':_0x152e66});}})[_0x3b38('0x41')](function(_0x158c53){var _0x40d8a7=_[_0x3b38('0x29')](_0x5adf28[_0x3b38('0x50')],function(_0x5c8d90){_0x5c8d90[_0x3b38('0x55')]=_0x5adf28['params']['id'];return _0x5c8d90;});return db[_0x3b38('0x57')][_0x3b38('0x68')](_0x40d8a7,{'raw':!![],'transaction':_0x152e66});})[_0x3b38('0x41')](function(_0x247cce){var _0x22f8a7=_[_0x3b38('0x3a')](_[_0x3b38('0x29')](_0x247cce,function(_0x3ce993){return _0x3ce993['get']({'plain':!![]});}),{'includeAll':![]});if(_0x22f8a7){return db[_0x3b38('0x57')][_0x3b38('0x52')]({'where':{'userProfileId':_0x5adf28[_0x3b38('0x49')]['id'],'sectionId':_[_0x3b38('0x29')](_0x22f8a7,function(_0x524003){return _0x524003[_0x3b38('0x54')];})},'attributes':['id',_0x3b38('0x54')],'raw':!![]})[_0x3b38('0x41')](function(_0x3c9532){var _0x109a43=_[_0x3b38('0x29')](_0x5adf28[_0x3b38('0x50')],function(_0x56a706){_0x56a706['userProfileId']=_0x5adf28[_0x3b38('0x49')]['id'];return _0x56a706;});return db[_0x3b38('0x58')][_0x3b38('0x68')](_0x109a43,{'raw':!![],'transaction':_0x152e66});});}})['catch'](handleError(_0x1895eb,null));});}})[_0x3b38('0x41')](function(_0x473caf){var _0x591560=_['map'](_0x473caf,function(_0x2abc2e){return _0x2abc2e[_0x3b38('0x4b')]({'plain':!![]});});})[_0x3b38('0x41')](respondWithResult(_0x1895eb,null))[_0x3b38('0x43')](handleError(_0x1895eb,null));};exports[_0x3b38('0x69')]=function(_0x1d3be7,_0x223d81,_0x41a163){return db[_0x3b38('0x2a')][_0x3b38('0x46')]({'where':{'id':_0x1d3be7[_0x3b38('0x49')]['id']}})['then'](handleEntityNotFound(_0x223d81,null))['then'](function(_0x5b7190){if(_0x5b7190){return _0x5b7190['removeResources'](_0x1d3be7['query'][_0x3b38('0x5d')]);}})[_0x3b38('0x41')](respondWithStatusCode(_0x223d81,null))['catch'](handleError(_0x223d81,null));};exports[_0x3b38('0x6a')]=function(_0x5f51dd,_0x1cd91e){var _0x1361f4={'raw':![],'where':{}};var _0x42a767={};var _0xeb4ec7={'count':0x0,'rows':[]};var _0x24c6f6=_0x5f51dd[_0x3b38('0x2e')]['section'];if(typeof _0x24c6f6===_0x3b38('0x6b')){throw new db['Sequelize'][(_0x3b38('0x6c'))](_0x3b38('0x6d'));}var _0x5060ee=_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x6e')]||![];var _0x15f5a5=getQueryModels(_0x24c6f6,_0x5060ee);if(typeof _0x15f5a5[_0x3b38('0x6f')]===_0x3b38('0x6b')){throw new db[(_0x3b38('0x70'))][(_0x3b38('0x6c'))](_0x3b38('0x71')+_0x24c6f6+'\x27');}var _0x3bfddf=[];if(!_[_0x3b38('0x60')](_0x15f5a5[_0x3b38('0x72')])){_0x3bfddf=_0x15f5a5['parentSections'];}else{_0x3bfddf=[{'name':_0x24c6f6}];}return db['UserProfile']['findOne']({'where':{'id':_0x5f51dd[_0x3b38('0x49')]['id']}})[_0x3b38('0x41')](handleEntityNotFound(_0x1cd91e,null))[_0x3b38('0x41')](function(_0x55a842){if(_0x55a842){var _0x6c36da=[];for(var _0x433810=0x0;_0x433810<_0x3bfddf['length'];_0x433810++){_0x6c36da[_0x3b38('0x5c')](db['UserProfileSection'][_0x3b38('0x73')]({'where':{'userProfileId':_0x55a842['id'],'name':_0x3bfddf[_0x433810][_0x3b38('0x26')]},'raw':!![]}));}return BPromise['all'](_0x6c36da);}})[_0x3b38('0x41')](function(_0x98c38b){var _0x471b11=_['filter'](_0x98c38b,function(_0x141bca){return _0x141bca?_0x141bca:undefined;});var _0x2db297=_[_0x3b38('0x3a')](_0x3bfddf,[_0x3b38('0x74'),!![]]);var _0xa97251=_['isEmpty'](_0x471b11)&&_[_0x3b38('0x60')](_0x2db297)?null:_['union'](_0x2db297,_0x471b11);if(_0xa97251){var _0x5b1b89=[];for(var _0x474257=0x0;_0x474257<_0xa97251[_0x3b38('0x4a')];_0x474257++){var _0x284449=_[_0x3b38('0x46')](_0x3bfddf,function(_0x1d4ec1){return _0xa97251[_0x474257]?_0x1d4ec1[_0x3b38('0x26')]===_0xa97251[_0x474257][_0x3b38('0x26')]:null;});if(_0x284449){if(_0xa97251[_0x474257][_0x3b38('0x74')]){_0x5b1b89['push'](getAllResources(_0x15f5a5[_0x3b38('0x6f')],_0xa97251[_0x474257]));}else{if(!_0xa97251[_0x474257]['autoAssociation']){_0x5b1b89['push'](getAllowedResources(_0x284449,_0xa97251[_0x474257],_0x15f5a5['childModel']));}else{if(_0x284449[_0x3b38('0x2d')]){_0x5b1b89['push'](getAllFilteredResources(_0x284449,_0xa97251[_0x474257]));}}}}}return BPromise[_0x3b38('0x75')](_0x5b1b89);}else{return null;}})['then'](function(_0x460491){var _0x2e9c16=_0x460491;var _0x441005=null;if(_0x2e9c16){_0x441005=_0x2e9c16[_0x3b38('0x4a')]===0x1?_0x2e9c16[0x0]:null;}if(_0x441005||_0x2e9c16){var _0xd973d0=db[_0x15f5a5[_0x3b38('0x6f')]]['rawAttributes'];_0x42a767['model']=_[_0x3b38('0x2f')](_0xd973d0);_0x42a767[_0x3b38('0x2e')]=_[_0x3b38('0x2f')](_0x5f51dd[_0x3b38('0x2e')]);_0x42a767[_0x3b38('0x30')]=_[_0x3b38('0x32')](_0x42a767[_0x3b38('0x2d')],_0x42a767[_0x3b38('0x2e')]);_0x1361f4[_0x3b38('0x31')]=_[_0x3b38('0x32')](_0x42a767[_0x3b38('0x2d')],qs[_0x3b38('0x33')](_0x5f51dd['query'][_0x3b38('0x33')]));_0x1361f4[_0x3b38('0x31')]=_0x1361f4[_0x3b38('0x31')][_0x3b38('0x4a')]?_0x1361f4[_0x3b38('0x31')]:_0x42a767[_0x3b38('0x2d')];if(!_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x34')](_0x3b38('0x35'))){_0x1361f4['limit']=qs[_0x3b38('0x36')](_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x36')]);_0x1361f4[_0x3b38('0x1f')]=qs['offset'](_0x5f51dd['query'][_0x3b38('0x1f')]);}_0x1361f4['order']=qs['sort'](_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x38')]);_0x1361f4[_0x3b38('0x76')]=qs[_0x3b38('0x30')](_['pick'](_0x5f51dd[_0x3b38('0x2e')],_0x42a767[_0x3b38('0x30')]));if(_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x3a')]){_0x1361f4[_0x3b38('0x76')]=_[_0x3b38('0x3b')](_0x1361f4[_0x3b38('0x76')],{'$or':_[_0x3b38('0x29')](_0xd973d0,function(_0x29a270){if(_0x29a270[_0x3b38('0x3c')][_0x3b38('0x2c')]!=='VIRTUAL'){var _0x1967a5={};_0x1967a5[_0x29a270[_0x3b38('0x77')]]={'$like':'%'+_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x3a')]+'%'};return _0x1967a5;}})});}var _0x4e57b7=[];if(_0x441005){var _0x424c00=_[_0x3b38('0x46')](_0x3bfddf,['name',_0x441005[_0x3b38('0x26')]]);if(_0x424c00[_0x3b38('0x77')]){var _0x23c052={};if(_0x15f5a5[_0x3b38('0x6f')]===_0x3b38('0x78')){_0x23c052[_0x424c00[_0x3b38('0x79')]]=_[_0x3b38('0x29')](_0x441005[_0x3b38('0x7a')],'id');}else{_0x23c052[_0x424c00[_0x3b38('0x79')]]=_0x441005[_0x3b38('0x7a')];}_0x4e57b7[_0x3b38('0x5c')](_0x23c052);}else{_0x1361f4[_0x3b38('0x76')]['id']=_0x441005['associatedResources'];}}else{for(var _0x451d1a=0x0;_0x451d1a<_0x2e9c16[_0x3b38('0x4a')];_0x451d1a++){var _0x424c00=_[_0x3b38('0x46')](_0x3bfddf,[_0x3b38('0x26'),_0x2e9c16[_0x451d1a][_0x3b38('0x26')]]);if(_0x424c00[_0x3b38('0x77')]){var _0x23c052={};_0x23c052[_0x424c00['foreignKey']]=_0x2e9c16[_0x451d1a]['associatedResources'];_0x4e57b7[_0x3b38('0x5c')](_0x23c052);}else{if(!_0x1361f4[_0x3b38('0x76')]['id'])_0x1361f4[_0x3b38('0x76')]['id']=[];_0x2e9c16[_0x451d1a][_0x3b38('0x7a')][_0x3b38('0x65')](function(_0x4dc195){_0x1361f4[_0x3b38('0x76')]['id']['push'](_0x4dc195);});}}}if(!_[_0x3b38('0x60')](_0x4e57b7)){_0x1361f4[_0x3b38('0x76')]=_['merge'](_0x1361f4['where'],{'$and':{'$or':_0x4e57b7}});}_0x1361f4=_[_0x3b38('0x3b')]({},_0x1361f4,_0x5f51dd[_0x3b38('0x3e')]);if(_0x441005&&!_0x441005[_0x3b38('0x63')]&&_0x15f5a5[_0x3b38('0x6f')]==='AnalyticExtractedReport'){if(_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x3f')]){_0x1361f4[_0x3b38('0x40')]=[{'all':!![]}];}return db[_0x15f5a5[_0x3b38('0x6f')]][_0x3b38('0x52')](_0x1361f4)[_0x3b38('0x41')](function(_0x1cc340){var _0x27b370=[];_0x1cc340[_0x3b38('0x65')](function(_0x5cc4ec){var _0x55644a;switch(_0x5cc4ec[_0x3b38('0x7b')]){case _0x3b38('0x7c'):_0x55644a=_[_0x3b38('0x46')](_0x441005[_0x3b38('0x7a')],function(_0x364666){return _0x364666['id']===_0x5cc4ec['reportId']&&_0x364666[_0x3b38('0x3c')]===_0x3b38('0x7d');});break;case _0x3b38('0x7e'):_0x55644a=_['find'](_0x441005[_0x3b38('0x7a')],function(_0x130271){return _0x130271['id']===_0x5cc4ec[_0x3b38('0x7f')]&&_0x130271[_0x3b38('0x3c')]==='CustomReports';});break;}if(_0x55644a)_0x27b370[_0x3b38('0x5c')](_0x5cc4ec);});_0xeb4ec7[_0x3b38('0x1e')]=_0x27b370[_0x3b38('0x4a')];_0xeb4ec7[_0x3b38('0x42')]=_0x27b370;return _0xeb4ec7;});}else{return db[_0x15f5a5[_0x3b38('0x6f')]]['count']({'where':_0x1361f4[_0x3b38('0x76')]})[_0x3b38('0x41')](function(_0x5bf17a){_0xeb4ec7['count']=_0x5bf17a;if(_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x3f')]){if(_0x15f5a5[_0x3b38('0x6f')]===_0x3b38('0x80')){_0x1361f4[_0x3b38('0x40')]=[{'model':db[_0x3b38('0x81')],'as':_0x3b38('0x82'),'attributes':['id',_0x3b38('0x26'),_0x3b38('0x83')],'required':_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x84')]?!![]:![]},{'model':db[_0x3b38('0x81')],'as':'ThroughTags','attributes':['id','name',_0x3b38('0x83')],'through':_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x84')]?{'attributes':[],'where':{'TagId':_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x84')]||undefined}}:{},'required':_0x5f51dd[_0x3b38('0x2e')][_0x3b38('0x84')]?!![]:![]}];}else{_0x1361f4[_0x3b38('0x40')]=[{'all':!![]}];}}return db[_0x15f5a5[_0x3b38('0x6f')]][_0x3b38('0x52')](_0x1361f4);})[_0x3b38('0x41')](function(_0x582357){_0xeb4ec7['rows']=_0x582357;return _0xeb4ec7;});}}else{return _0xeb4ec7;}})[_0x3b38('0x41')](respondWithFilteredResult(_0x1cd91e,_0x1361f4))[_0x3b38('0x43')](handleError(_0x1cd91e,null));};function getAllResources(_0x2c73dc,_0x23a536){return new BPromise(function(_0x11ff16,_0x2efaf9){if(_0x23a536){var _0x2c7087=_0x23a536['filter']?{[_0x23a536[_0x3b38('0x3a')]['field']]:_0x23a536[_0x3b38('0x3a')][_0x3b38('0x85')]}:undefined;return db[_0x2c73dc][_0x3b38('0x52')]({'where':_0x2c7087,'raw':!![]})[_0x3b38('0x41')](function(_0x35851e){_0x23a536['associatedResources']=_[_0x3b38('0x29')](_0x35851e,'id');_0x11ff16(_0x23a536);})[_0x3b38('0x43')](function(_0x56d2e3){_0x2efaf9(_0x56d2e3);});}else{_0x11ff16(null);}});}function getAllFilteredResources(_0x364d38,_0x427eed){return new BPromise(function(_0x57a1e2,_0x270152){var _0x43fa63=_0x364d38[_0x3b38('0x3a')]?{[_0x364d38[_0x3b38('0x3a')][_0x3b38('0x77')]]:_0x364d38['filter']['value']}:undefined;return db[_0x364d38[_0x3b38('0x2d')]][_0x3b38('0x52')]({'where':_0x43fa63,'raw':!![]})[_0x3b38('0x41')](function(_0xf376a){_0x427eed[_0x3b38('0x7a')]=_[_0x3b38('0x29')](_0xf376a,function(_0x4c9f3f){return _0x4c9f3f[_0x3b38('0x26')];});_0x57a1e2(_0x427eed);})[_0x3b38('0x43')](function(_0x4b44f0){_0x270152(_0x4b44f0);});});}function getAllowedResources(_0x5a40d8,_0x458f8a,_0x574f38){return new BPromise(function(_0x24498e,_0x19d964){if(_0x458f8a){return db[_0x3b38('0x58')][_0x3b38('0x52')]({'where':{'sectionId':_0x458f8a['id']},'raw':!![]})[_0x3b38('0x41')](function(_0x5ef1f1){if(_0x5a40d8[_0x3b38('0x77')]&&_0x5a40d8[_0x3b38('0x77')]!=='id'){_0x458f8a[_0x3b38('0x7a')]=_[_0x3b38('0x29')](_0x5ef1f1,function(_0x1afb46){return _0x1afb46[_0x5a40d8[_0x3b38('0x77')]];});}else{if(_0x574f38==='AnalyticExtractedReport'){_0x458f8a['associatedResources']=_[_0x3b38('0x29')](_0x5ef1f1,function(_0x30cb30){return{'id':_0x30cb30[_0x3b38('0x86')],'type':_0x30cb30['type']};});}else{_0x458f8a[_0x3b38('0x7a')]=_[_0x3b38('0x29')](_0x5ef1f1,function(_0x58672c){return _0x58672c[_0x3b38('0x86')];});}}_0x24498e(_0x458f8a);})[_0x3b38('0x43')](function(_0x48e1b3){_0x19d964(_0x48e1b3);});}else{_0x24498e(null);}});}function getQueryModels(_0x4df861,_0x4d9fd1){var _0x58a271=_0x4df861[_0x3b38('0x87')]();var _0x1eddac={'childModel':undefined,'parentSections':[]};switch(_0x58a271){case _0x3b38('0x88'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x89');break;case _0x3b38('0x8a'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x8b');break;case _0x3b38('0x8c'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x8d');_0x1eddac['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0x3b38('0x8e'):_0x1eddac[_0x3b38('0x6f')]='JscriptyProject';break;case _0x3b38('0x8f'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x80');_0x1eddac[_0x3b38('0x72')]=[{'name':_0x3b38('0x90'),'field':'id','foreignKey':_0x3b38('0x91')}];break;case'lists':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x92');break;case _0x3b38('0x93'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x94');break;case _0x3b38('0x95'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x96');break;case _0x3b38('0x97'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x98');break;case'chatwebsites':_0x1eddac['childModel']=_0x3b38('0x99');break;case _0x3b38('0x9a'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x9b');break;case'faxaccounts':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x9c');break;case'inboundroutes':case _0x3b38('0x9d'):case _0x3b38('0x9e'):_0x1eddac[_0x3b38('0x6f')]='VoiceExtension';break;case _0x3b38('0x9f'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xa0');break;case _0x3b38('0xa1'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xa2');break;case _0x3b38('0xa3'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xa4');_0x1eddac['parentSections']=[{'name':_0x3b38('0xa5'),'field':_0x3b38('0x26'),'foreignKey':_0x3b38('0xa6'),'model':_0x3b38('0xa7'),'filter':{'field':_0x3b38('0xa8'),'value':[_0x3b38('0xa9')]}},{'name':_0x3b38('0xaa'),'field':_0x3b38('0x26'),'foreignKey':'membername','model':'User','filter':{'field':_0x3b38('0xa8'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':'queue','model':_0x3b38('0xab'),'filter':{'field':_0x3b38('0x3c'),'value':['inbound']}},{'name':_0x3b38('0xac'),'field':'name','foreignKey':'queue','model':_0x3b38('0xab'),'filter':{'field':_0x3b38('0x3c'),'value':[_0x3b38('0xad')]}}];break;case _0x3b38('0xae'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xaf');break;case _0x3b38('0xb0'):_0x1eddac['childModel']=_0x3b38('0xb1');break;case _0x3b38('0xb2'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xb3');break;case'ivrcampaigns':_0x1eddac[_0x3b38('0x6f')]='Campaign';break;case _0x3b38('0xb4'):_0x1eddac['childModel']=_0x3b38('0xb5');break;case _0x3b38('0xb6'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xb7');break;case'mailsubstatuses':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xb8');break;case _0x3b38('0xb9'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xba');break;case _0x3b38('0xbb'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xbc');break;case _0x3b38('0xbd'):_0x1eddac['childModel']='SmsQueue';break;case'smsaccounts':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xbe');break;case _0x3b38('0xbf'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xc0');break;case _0x3b38('0xc1'):_0x1eddac['childModel']='WhatsappAccount';break;case _0x3b38('0xc2'):_0x1eddac[_0x3b38('0x6f')]='Team';break;case _0x3b38('0xc3'):case _0x3b38('0xc4'):_0x1eddac['childModel']=_0x3b38('0xab');if(_0x4d9fd1){_0x1eddac[_0x3b38('0x72')]=[{'name':_0x3b38('0xc5')},{'name':'QueueCampaigns'}];}break;case _0x3b38('0xc6'):case _0x3b38('0xc7'):case _0x3b38('0xc8'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xa7');if(_0x4d9fd1){_0x1eddac['parentSections']=[{'name':'Users','filter':{'field':_0x3b38('0xa8'),'value':[_0x3b38('0xc9'),_0x3b38('0xca')]},'ignore':!![]},{'name':'Agents'},{'name':_0x3b38('0xaa')}];}break;case _0x3b38('0xcb'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xcc');break;case'salesforceaccounts':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xcd');break;case _0x3b38('0xce'):_0x1eddac[_0x3b38('0x6f')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x1eddac[_0x3b38('0x6f')]='SugarcrmAccount';break;case'deskaccounts':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xcf');break;case _0x3b38('0xd0'):_0x1eddac['childModel']='ZohoAccount';break;case _0x3b38('0xd1'):_0x1eddac[_0x3b38('0x6f')]='User';break;case'cannedanswers':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xd2');break;case _0x3b38('0xd3'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xd4');break;case'customdashboards':_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x64');break;case _0x3b38('0xd5'):_0x1eddac[_0x3b38('0x6f')]='Interval';break;case _0x3b38('0xd6'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xd7');break;case'scheduler':_0x1eddac['childModel']=_0x3b38('0xd8');break;case _0x3b38('0xd9'):_0x1eddac['childModel']=_0x3b38('0xda');break;case _0x3b38('0xdb'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x81');break;case _0x3b38('0xdc'):_0x1eddac['childModel']=_0x3b38('0xdd');break;case _0x3b38('0xde'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xdf');break;case _0x3b38('0xe0'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xe1');break;case _0x3b38('0xe2'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xe3');break;case _0x3b38('0xe4'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0x66');break;case'extractedreports':_0x1eddac['childModel']=_0x3b38('0x78');_0x1eddac[_0x3b38('0x72')]=[{'name':'Reports','field':'id','foreignKey':_0x3b38('0x7f')}];break;case _0x3b38('0xe5'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xe6');break;case _0x3b38('0xc1'):_0x1eddac[_0x3b38('0x6f')]=_0x3b38('0xe7');break;default:return _0x1eddac;}return _0x1eddac;} \ No newline at end of file +var _0x1fda=['zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','scheduler','Schedule','sounds','Sound','templates','triggers','trunks','Trunk','variables','plugins','Plugin','Reports','metrics','AnalyticMetric','html-pdf','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','body','clone','find','get','omit','crudPermissions','createdAt','sequelize','transaction','each','autoAssociation','updatedAt','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','describe','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','mergeResources','childModel','undefined','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','union','pick','VIRTUAL','field','foreignKey','associatedResources','AnalyticExtractedReport','reportId','custom','CustomReports','CmContact','Tag','ThroughTags','color','tag','value','toLowerCase','SquareProject','odbc','SquareOdbc','SquareProjects','projectName','projects','JscriptyProject','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueue','agents','telephones','Users','user'];(function(_0x519d5a,_0x573c67){var _0xc7270f=function(_0x2ad5a3){while(--_0x2ad5a3){_0x519d5a['push'](_0x519d5a['shift']());}};_0xc7270f(++_0x573c67);}(_0x1fda,0x103));var _0xa1fd=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0x1fda[_0x512e72];return _0x143086;};'use strict';var pdf=require(_0xa1fd('0x0'));var emlformat=require(_0xa1fd('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1fd('0x2'));var moment=require('moment');var BPromise=require(_0xa1fd('0x3'));var Mustache=require(_0xa1fd('0x4'));var util=require(_0xa1fd('0x5'));var path=require(_0xa1fd('0x6'));var sox=require(_0xa1fd('0x7'));var csv=require(_0xa1fd('0x8'));var ejs=require(_0xa1fd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1fd('0xa'));var crypto=require('crypto');var jsforce=require(_0xa1fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa1fd('0x8'));var querystring=require('querystring');var Papa=require(_0xa1fd('0xc'));var Redis=require(_0xa1fd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa1fd('0xe'));var as=require(_0xa1fd('0xf'));var hardwareService=require(_0xa1fd('0x10'));var logger=require(_0xa1fd('0x11'))(_0xa1fd('0x12'));var utils=require(_0xa1fd('0x13'));var config=require(_0xa1fd('0x14'));var licenseUtil=require(_0xa1fd('0x15'));var db=require(_0xa1fd('0x16'))['db'];config[_0xa1fd('0x17')]=_[_0xa1fd('0x18')](config[_0xa1fd('0x17')],{'host':_0xa1fd('0x19'),'port':0x18eb});var socket=require(_0xa1fd('0x1a'))(new Redis(config[_0xa1fd('0x17')]));require(_0xa1fd('0x1b'))[_0xa1fd('0x1c')](socket);function respondWithStatusCode(_0x55c89d,_0x242714){_0x242714=_0x242714||0xcc;return function(_0x545927){if(_0x545927){return _0x55c89d[_0xa1fd('0x1d')](_0x242714);}return _0x55c89d[_0xa1fd('0x1e')](_0x242714)[_0xa1fd('0x1f')]();};}function respondWithResult(_0x305ab1,_0x44b8f8){_0x44b8f8=_0x44b8f8||0xc8;return function(_0x3d7a16){if(_0x3d7a16){return _0x305ab1['status'](_0x44b8f8)['json'](_0x3d7a16);}};}function respondWithFilteredResult(_0x353dc2,_0x53b16e){return function(_0x560df8){if(_0x560df8){var _0x556191=_0x560df8[_0xa1fd('0x20')],_0x4fccbe=_0x53b16e[_0xa1fd('0x21')],_0x5acf30=_0x53b16e[_0xa1fd('0x21')]+_0x53b16e['limit'],_0x482381;if(_0x5acf30>=_0x556191){_0x5acf30=_0x556191;_0x482381=0xc8;}else{_0x482381=0xce;}_0x353dc2[_0xa1fd('0x1e')](_0x482381);return _0x353dc2[_0xa1fd('0x22')](_0xa1fd('0x23'),_0x4fccbe+'-'+_0x5acf30+'/'+_0x556191)['json'](_0x560df8);}return null;};}function patchUpdates(_0x576db5){return function(_0x36562d){try{jsonpatch[_0xa1fd('0x24')](_0x36562d,_0x576db5,!![]);}catch(_0x5bcb55){return BPromise[_0xa1fd('0x25')](_0x5bcb55);}return _0x36562d[_0xa1fd('0x26')]();};}function saveUpdates(_0x6e09dc,_0x29d274){return function(_0x26e45a){if(_0x26e45a){return _0x26e45a['update'](_0x6e09dc)['then'](function(_0xe2675a){return _0xe2675a;});}return null;};}function removeEntity(_0x59a5ae,_0x53e029){return function(_0x307c34){if(_0x307c34){return _0x307c34[_0xa1fd('0x27')]()[_0xa1fd('0x28')](function(){_0x59a5ae[_0xa1fd('0x1e')](0xcc)[_0xa1fd('0x1f')]();});}};}function handleEntityNotFound(_0x499811,_0x425d50){return function(_0x4bb554){if(!_0x4bb554){_0x499811[_0xa1fd('0x1d')](0x194);}return _0x4bb554;};}function handleError(_0xe4148e,_0x4acf19){_0x4acf19=_0x4acf19||0x1f4;return function(_0x50a2d6){logger[_0xa1fd('0x29')](_0x50a2d6['stack']);if(_0x50a2d6[_0xa1fd('0x2a')]){delete _0x50a2d6[_0xa1fd('0x2a')];}_0xe4148e['status'](_0x4acf19)[_0xa1fd('0x2b')](_0x50a2d6);};}exports['index']=function(_0x499adc,_0x63ab01){var _0x28a172={},_0x29c95b={},_0x24b188={'count':0x0,'rows':[]};var _0x2bf8fa=_[_0xa1fd('0x2c')](db[_0xa1fd('0x2d')][_0xa1fd('0x2e')],function(_0x4eed75){return{'name':_0x4eed75[_0xa1fd('0x2f')],'type':_0x4eed75['type'][_0xa1fd('0x30')]};});_0x29c95b[_0xa1fd('0x31')]=_[_0xa1fd('0x2c')](_0x2bf8fa,_0xa1fd('0x2a'));_0x29c95b[_0xa1fd('0x32')]=_[_0xa1fd('0x33')](_0x499adc[_0xa1fd('0x32')]);_0x29c95b[_0xa1fd('0x34')]=_[_0xa1fd('0x35')](_0x29c95b[_0xa1fd('0x31')],_0x29c95b['query']);_0x28a172[_0xa1fd('0x36')]=_[_0xa1fd('0x35')](_0x29c95b[_0xa1fd('0x31')],qs[_0xa1fd('0x37')](_0x499adc[_0xa1fd('0x32')][_0xa1fd('0x37')]));_0x28a172[_0xa1fd('0x36')]=_0x28a172[_0xa1fd('0x36')][_0xa1fd('0x38')]?_0x28a172[_0xa1fd('0x36')]:_0x29c95b[_0xa1fd('0x31')];if(!_0x499adc['query'][_0xa1fd('0x39')](_0xa1fd('0x3a'))){_0x28a172[_0xa1fd('0x3b')]=qs[_0xa1fd('0x3b')](_0x499adc[_0xa1fd('0x32')][_0xa1fd('0x3b')]);_0x28a172['offset']=qs[_0xa1fd('0x21')](_0x499adc[_0xa1fd('0x32')][_0xa1fd('0x21')]);}_0x28a172[_0xa1fd('0x3c')]=qs['sort'](_0x499adc[_0xa1fd('0x32')][_0xa1fd('0x3d')]);_0x28a172[_0xa1fd('0x3e')]=qs['filters'](_['pick'](_0x499adc[_0xa1fd('0x32')],_0x29c95b[_0xa1fd('0x34')]),_0x2bf8fa);if(_0x499adc[_0xa1fd('0x32')][_0xa1fd('0x3f')]){_0x28a172[_0xa1fd('0x3e')]=_[_0xa1fd('0x40')](_0x28a172[_0xa1fd('0x3e')],{'$or':_[_0xa1fd('0x2c')](_0x2bf8fa,function(_0x6a41ed){if(_0x6a41ed[_0xa1fd('0x41')]!=='VIRTUAL'){var _0x3027a6={};_0x3027a6[_0x6a41ed[_0xa1fd('0x2a')]]={'$like':'%'+_0x499adc['query']['filter']+'%'};return _0x3027a6;}})});}_0x28a172=_[_0xa1fd('0x40')]({},_0x28a172,_0x499adc[_0xa1fd('0x42')]);var _0x2f91a5={'where':_0x28a172[_0xa1fd('0x3e')]};return db['UserProfile'][_0xa1fd('0x20')](_0x2f91a5)[_0xa1fd('0x28')](function(_0x2c2d86){_0x24b188[_0xa1fd('0x20')]=_0x2c2d86;if(_0x499adc[_0xa1fd('0x32')][_0xa1fd('0x43')]){_0x28a172[_0xa1fd('0x44')]=[{'all':!![]}];}return db[_0xa1fd('0x2d')][_0xa1fd('0x45')](_0x28a172);})['then'](function(_0x5b6e63){_0x24b188[_0xa1fd('0x46')]=_0x5b6e63;return _0x24b188;})['then'](respondWithFilteredResult(_0x63ab01,_0x28a172))[_0xa1fd('0x47')](handleError(_0x63ab01,null));};exports[_0xa1fd('0x48')]=function(_0x19a1b0,_0x47d48f){var _0x26faad={'raw':![],'where':{'id':_0x19a1b0[_0xa1fd('0x49')]['id']}},_0x468227={};_0x468227[_0xa1fd('0x31')]=_['keys'](db[_0xa1fd('0x2d')][_0xa1fd('0x2e')]);_0x468227[_0xa1fd('0x32')]=_[_0xa1fd('0x33')](_0x19a1b0[_0xa1fd('0x32')]);_0x468227[_0xa1fd('0x34')]=_[_0xa1fd('0x35')](_0x468227[_0xa1fd('0x31')],_0x468227[_0xa1fd('0x32')]);_0x26faad[_0xa1fd('0x36')]=_[_0xa1fd('0x35')](_0x468227[_0xa1fd('0x31')],qs[_0xa1fd('0x37')](_0x19a1b0['query']['fields']));_0x26faad['attributes']=_0x26faad['attributes'][_0xa1fd('0x38')]?_0x26faad[_0xa1fd('0x36')]:_0x468227[_0xa1fd('0x31')];if(_0x19a1b0[_0xa1fd('0x32')][_0xa1fd('0x43')]){_0x26faad['include']=[{'all':!![]}];}_0x26faad=_[_0xa1fd('0x40')]({},_0x26faad,_0x19a1b0[_0xa1fd('0x42')]);return db[_0xa1fd('0x2d')]['find'](_0x26faad)[_0xa1fd('0x28')](handleEntityNotFound(_0x47d48f,null))[_0xa1fd('0x28')](respondWithResult(_0x47d48f,null))[_0xa1fd('0x47')](handleError(_0x47d48f,null));};exports[_0xa1fd('0x4a')]=function(_0x571fe5,_0x15420d){return db[_0xa1fd('0x2d')][_0xa1fd('0x4a')](_0x571fe5[_0xa1fd('0x4b')],{})['then'](respondWithResult(_0x15420d,0xc9))[_0xa1fd('0x47')](handleError(_0x15420d,null));};exports[_0xa1fd('0x4c')]=function(_0x1a0781,_0x39c618){var _0x52f9bb={'where':{'id':_0x1a0781['params']['id']}},_0xbfebc1={};_0xbfebc1[_0xa1fd('0x31')]=_[_0xa1fd('0x33')](db['UserProfile'][_0xa1fd('0x2e')]);_0x52f9bb['attributes']=_['intersection'](_0xbfebc1[_0xa1fd('0x31')],qs[_0xa1fd('0x37')](_0x1a0781[_0xa1fd('0x32')][_0xa1fd('0x37')]));_0x52f9bb[_0xa1fd('0x36')]=_0x52f9bb[_0xa1fd('0x36')][_0xa1fd('0x38')]?_0x52f9bb['attributes']:_0xbfebc1['model'];if(_0x1a0781[_0xa1fd('0x32')][_0xa1fd('0x43')]){_0x52f9bb['include']=[{'all':!![]}];}_0x52f9bb=_[_0xa1fd('0x40')]({},_0x52f9bb,_0x1a0781[_0xa1fd('0x42')]);return db[_0xa1fd('0x2d')][_0xa1fd('0x4d')](_0x52f9bb)['then'](handleEntityNotFound(_0x39c618,null))[_0xa1fd('0x28')](function(_0x5b3237){if(_0x5b3237){var _0x971940=_0x5b3237[_0xa1fd('0x4e')]({'plain':!![]});_0x971940=qs[_0xa1fd('0x4f')](_0x971940,['id','createdAt','updatedAt',_0xa1fd('0x50')]);_0x1a0781['body']=_[_0xa1fd('0x4f')](_0x1a0781['body'],['id',_0xa1fd('0x51'),'updatedAt']);return db[_0xa1fd('0x52')][_0xa1fd('0x53')](function(_0x2e4932){return db[_0xa1fd('0x2d')][_0xa1fd('0x4a')](_[_0xa1fd('0x40')](_0x971940,_0x1a0781[_0xa1fd('0x4b')]),{'include':_0x1a0781['query'][_0xa1fd('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x2e4932})['then'](function(_0x269a87){var _0x263cf2=_0x269a87['get']({'plain':!![]});return db['UserProfileSection'][_0xa1fd('0x45')]({'where':{'userProfileId':_0x1a0781['params']['id']},'raw':!![]})['then'](function(_0x39c878){if(_0x39c878){return BPromise[_0xa1fd('0x54')](_0x39c878,function(_0x47c37e){return new BPromise(function(_0xbce930,_0x50e328){if(_0x47c37e['autoAssociation']===null||_0x47c37e[_0xa1fd('0x55')]===0x1)_0xbce930(null);return db['UserProfileResource'][_0xa1fd('0x45')]({'where':{'sectionId':_0x47c37e['id']},'raw':!![]})['then'](function(_0x39b2bb){var _0x2f56b7=_['map'](_0x39b2bb,function(_0x1e6903){return qs[_0xa1fd('0x4f')](_0x1e6903,['id','createdAt',_0xa1fd('0x56'),_0xa1fd('0x57')]);});_0xbce930(_0x2f56b7);})[_0xa1fd('0x47')](function(_0xa55fb6){_0x50e328(_0xa55fb6);});})[_0xa1fd('0x28')](function(_0x253f1b){var _0x667d3c=qs[_0xa1fd('0x4f')](_0x47c37e,['id',_0xa1fd('0x51'),_0xa1fd('0x56')]);_0x667d3c[_0xa1fd('0x58')]=_0x263cf2['id'];if(_0x253f1b)_0x667d3c[_0xa1fd('0x59')]=_0x253f1b;return _0x667d3c;})['then'](function(_0x2cc75f){return db[_0xa1fd('0x5a')][_0xa1fd('0x4a')](_0x2cc75f,{'include':[{'model':db[_0xa1fd('0x5b')],'as':_0xa1fd('0x59')}],'raw':!![],'transaction':_0x2e4932});});})[_0xa1fd('0x28')](function(){return _0x263cf2;});}});});});}})[_0xa1fd('0x28')](respondWithResult(_0x39c618,0xc9))['catch'](handleError(_0x39c618,null));};exports['update']=function(_0x1e99d5,_0x3b5421){if(_0x1e99d5[_0xa1fd('0x4b')]['id']){delete _0x1e99d5[_0xa1fd('0x4b')]['id'];}return db[_0xa1fd('0x2d')][_0xa1fd('0x4d')]({'where':{'id':_0x1e99d5[_0xa1fd('0x49')]['id']}})[_0xa1fd('0x28')](handleEntityNotFound(_0x3b5421,null))[_0xa1fd('0x28')](saveUpdates(_0x1e99d5[_0xa1fd('0x4b')],null))[_0xa1fd('0x28')](respondWithResult(_0x3b5421,null))[_0xa1fd('0x47')](handleError(_0x3b5421,null));};exports[_0xa1fd('0x27')]=function(_0x346075,_0x285554){return db['UserProfile'][_0xa1fd('0x4d')]({'where':{'id':_0x346075[_0xa1fd('0x49')]['id']}})[_0xa1fd('0x28')](handleEntityNotFound(_0x285554,null))[_0xa1fd('0x28')](removeEntity(_0x285554,null))[_0xa1fd('0x47')](handleError(_0x285554,null));};exports[_0xa1fd('0x5c')]=function(_0x17c303,_0x3bdeb5){return db[_0xa1fd('0x2d')]['describe']()[_0xa1fd('0x28')](respondWithResult(_0x3bdeb5,null))['catch'](handleError(_0x3bdeb5,null));};exports['addSections']=function(_0x15d3ea,_0xc882aa){var _0x4782c5=_0x15d3ea[_0xa1fd('0x4b')];return db[_0xa1fd('0x2d')]['find']({'where':{'id':_0x15d3ea['params']['id']}})[_0xa1fd('0x28')](handleEntityNotFound(_0xc882aa,null))[_0xa1fd('0x28')](function(_0x15e85e){if(_0x15e85e){return db[_0xa1fd('0x52')][_0xa1fd('0x53')](function(_0x240069){return db[_0xa1fd('0x5a')][_0xa1fd('0x27')]({'where':{'userProfileId':_0x15d3ea[_0xa1fd('0x49')]['id'],'sectionId':_[_0xa1fd('0x2c')](_0x4782c5,function(_0x42a19c){return _0x42a19c[_0xa1fd('0x57')];})},'transaction':_0x240069})[_0xa1fd('0x28')](function(){var _0x2ac813=_[_0xa1fd('0x2c')](_0x4782c5,function(_0x23d0f0){_0x23d0f0[_0xa1fd('0x58')]=_0x15d3ea['params']['id'];return _0x23d0f0;});var _0x2f0c3e=[];return BPromise[_0xa1fd('0x54')](_0x2ac813,function(_0x14d639){return db[_0xa1fd('0x5a')]['create'](_0x14d639,{'include':[{'model':db[_0xa1fd('0x5b')],'as':_0xa1fd('0x59')}],'raw':!![],'transaction':_0x240069})[_0xa1fd('0x28')](function(_0x5b83a5){_0x2f0c3e[_0xa1fd('0x5d')](_0x5b83a5['get']({'plain':!![]}));});})['then'](function(){return _0x2f0c3e;});});});}})[_0xa1fd('0x28')](function(_0x446032){return _0x446032;})[_0xa1fd('0x28')](respondWithResult(_0xc882aa,null))[_0xa1fd('0x47')](handleError(_0xc882aa,null));};exports[_0xa1fd('0x5e')]=function(_0x4e659d,_0x1a2e83){var _0x2157d9;return db[_0xa1fd('0x2d')]['find']({'where':{'id':_0x4e659d[_0xa1fd('0x49')]['id']},'attributes':['id',_0xa1fd('0x2a')]})[_0xa1fd('0x28')](handleEntityNotFound(_0x1a2e83,null))[_0xa1fd('0x28')](function(_0xd2ddeb){if(_0xd2ddeb){_0x2157d9=_0xd2ddeb;return db[_0xa1fd('0x5a')]['destroy']({'where':{'userProfileId':_0x4e659d[_0xa1fd('0x49')]['id'],'sectionId':_0x4e659d[_0xa1fd('0x32')][_0xa1fd('0x5f')]}});}})[_0xa1fd('0x28')](function(){return _0x2157d9;})[_0xa1fd('0x28')](respondWithStatusCode(_0x1a2e83,null))[_0xa1fd('0x47')](handleError(_0x1a2e83,null));};exports['getSections']=function(_0x22d2b9,_0x2faf78){var _0x4f70d8=[];var _0x5724e0=[];return db[_0xa1fd('0x5a')][_0xa1fd('0x45')]({'where':{'userProfileId':_0x22d2b9['params']['id']},'raw':!![]})[_0xa1fd('0x28')](function(_0x2537ec){_0x4f70d8=_[_0xa1fd('0x3f')](_0x2537ec,function(_0x9d0a87){return _0x9d0a87[_0xa1fd('0x60')]===0x1||_[_0xa1fd('0x61')]([0x3eb,0x709],_0x9d0a87[_0xa1fd('0x57')]);});if(!_[_0xa1fd('0x62')](_0x4f70d8)){return _[_0xa1fd('0x2c')](_0x4f70d8,function(_0x239c2c){return _0x239c2c[_0xa1fd('0x57')];});}else{return;}})[_0xa1fd('0x28')](function(_0x52da1a){if(_0x52da1a)_0x5724e0=_0x52da1a;if(_[_0xa1fd('0x61')](_0x5724e0,0x64)){var _0x272cf4=_[_0xa1fd('0x4d')](_0x4f70d8,{'sectionId':0x64});return hasDefaultDashboard(_0x272cf4)[_0xa1fd('0x28')](function(_0x31ecbb){return _[_0xa1fd('0x2c')](_0x4f70d8,function(_0x29ee3e){if(_0x29ee3e['sectionId']===0x64){_0x29ee3e['subsections']=_0x31ecbb;}return _0x29ee3e;});});}else{return;}})[_0xa1fd('0x28')](function(_0x4b3a65){if(_0x4b3a65)_0x4f70d8=_0x4b3a65;if(_[_0xa1fd('0x61')](_0x5724e0,0x3eb)){var _0x3e017a=_['find'](_0x4f70d8,{'sectionId':0x3eb});return getCustomDashboards(_0x3e017a)[_0xa1fd('0x28')](function(_0x1e3033){return _['map'](_0x4f70d8,function(_0x4bd435){if(_0x3e017a[_0xa1fd('0x60')]){if(_0x4bd435[_0xa1fd('0x57')]===0x3eb){_0x4bd435[_0xa1fd('0x63')]=_0x1e3033;}}else{if(_0x4bd435[_0xa1fd('0x57')]===0x64){_0x4bd435['subsections']=_0x1e3033;}}return _0x4bd435;});});}else{return;}})['then'](function(_0x1ab6f8){if(_0x1ab6f8)_0x4f70d8=_0x1ab6f8;if(_[_0xa1fd('0x61')](_0x5724e0,0x709)){var _0x2bf2d6=_[_0xa1fd('0x4d')](_0x4f70d8,{'sectionId':0x709});return getPlugins(_0x2bf2d6)[_0xa1fd('0x28')](function(_0x2be492){if(_0x2bf2d6[_0xa1fd('0x60')]){return _[_0xa1fd('0x2c')](_0x4f70d8,function(_0x2267d){if(_0x2267d[_0xa1fd('0x57')]===0x709){_0x2267d['subsections']=_0x2be492;}return _0x2267d;});}else{var _0x168ce5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2be492};var _0x205832=_['map'](_0x4f70d8);_0x205832[_0xa1fd('0x5d')](_0x168ce5);return _0x205832;}});}else{return;}})[_0xa1fd('0x28')](function(_0x28c412){if(_0x28c412)_0x4f70d8=_0x28c412;return _[_0xa1fd('0x3f')](_0x4f70d8,['enabled',0x1]);})[_0xa1fd('0x28')](respondWithResult(_0x2faf78,null))[_0xa1fd('0x47')](handleError(_0x2faf78,null));};function hasDefaultDashboard(_0x3daf03){var _0x46cd70=[0x65];return new BPromise(function(_0x13e65e,_0x256a4d){try{if(_0x3daf03['autoAssociation']){_0x13e65e(_0x46cd70);}else{return db['UserProfileResource'][_0xa1fd('0x64')]({'where':{'sectionId':_0x3daf03['id']},'raw':!![]})[_0xa1fd('0x28')](function(_0x37ecc3){_0x37ecc3?_0x13e65e(_0x46cd70):_0x13e65e();});}}catch(_0x5e45c7){_0x256a4d(_0x5e45c7);}});}function getCustomDashboards(_0x42c88e){var _0x49441d=[];return new BPromise(function(_0x53fe97,_0x399d7c){try{if(_0x42c88e[_0xa1fd('0x55')]){return db[_0xa1fd('0x65')][_0xa1fd('0x45')]({'raw':!![]})['then'](function(_0x26414f){_0x26414f[_0xa1fd('0x66')](function(_0x42ee65){_0x49441d[_0xa1fd('0x5d')](_0x42ee65['id']+0x1869f);});_0x53fe97(_0x49441d);});}else{return db[_0xa1fd('0x5b')][_0xa1fd('0x45')]({'where':{'sectionId':_0x42c88e['id']},'raw':!![]})[_0xa1fd('0x28')](function(_0x10ea03){_0x10ea03['forEach'](function(_0x667367){_0x49441d['push'](_0x667367[_0xa1fd('0x67')]+0x1869f);});_0x53fe97(_0x49441d);});}}catch(_0x5d3e9){_0x399d7c(_0x5d3e9);}});}function getPlugins(_0x3735d6){var _0x2c9e59=[];return new BPromise(function(_0xa62b6c,_0x16c175){try{if(_0x3735d6[_0xa1fd('0x55')]){return db['Plugin'][_0xa1fd('0x45')]({'raw':!![]})[_0xa1fd('0x28')](function(_0x362b2e){_0x362b2e[_0xa1fd('0x66')](function(_0x5083d4){_0x2c9e59[_0xa1fd('0x5d')](_0x5083d4['id']+0x15b38);});_0xa62b6c(_0x2c9e59);});}else{return db[_0xa1fd('0x5b')][_0xa1fd('0x45')]({'where':{'sectionId':_0x3735d6['id']},'raw':!![]})[_0xa1fd('0x28')](function(_0xdc78e9){_0xdc78e9[_0xa1fd('0x66')](function(_0x19ebe7){_0x2c9e59[_0xa1fd('0x5d')](_0x19ebe7[_0xa1fd('0x67')]+0x15b38);});_0xa62b6c(_0x2c9e59);});}}catch(_0x4b1c81){_0x16c175(_0x4b1c81);}});}exports[_0xa1fd('0x68')]=function(_0x53ce3a,_0x3556fa){return db[_0xa1fd('0x2d')]['find']({'where':{'id':_0x53ce3a[_0xa1fd('0x49')]['id']}})['then'](handleEntityNotFound(_0x3556fa,null))[_0xa1fd('0x28')](function(_0x2240df){if(_0x2240df){return db['sequelize'][_0xa1fd('0x53')](function(_0x2198dc){return db[_0xa1fd('0x5a')]['findAll']({'where':{'userProfileId':_0x53ce3a[_0xa1fd('0x49')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2fa08d){if(_0x2fa08d){return db['UserProfileSection'][_0xa1fd('0x27')]({'where':{'userProfileId':_0x53ce3a['params']['id'],'id':_[_0xa1fd('0x2c')](_0x2fa08d,function(_0x4dd966){return _0x4dd966['id'];})},'transaction':_0x2198dc});}})[_0xa1fd('0x28')](function(_0x5bb6f5){var _0xae6f80=_['map'](_0x53ce3a[_0xa1fd('0x4b')],function(_0x50af1e){_0x50af1e[_0xa1fd('0x58')]=_0x53ce3a[_0xa1fd('0x49')]['id'];return _0x50af1e;});return db['UserProfileSection']['bulkCreate'](_0xae6f80,{'raw':!![],'transaction':_0x2198dc});})[_0xa1fd('0x28')](function(_0xf6a24d){var _0x1702b9=_['filter'](_['map'](_0xf6a24d,function(_0x21e1bf){return _0x21e1bf['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1702b9){return db['UserProfileSection'][_0xa1fd('0x45')]({'where':{'userProfileId':_0x53ce3a[_0xa1fd('0x49')]['id'],'sectionId':_[_0xa1fd('0x2c')](_0x1702b9,function(_0x2636ed){return _0x2636ed[_0xa1fd('0x57')];})},'attributes':['id',_0xa1fd('0x57')],'raw':!![]})[_0xa1fd('0x28')](function(_0x1e6065){var _0x481d75=_[_0xa1fd('0x2c')](_0x53ce3a[_0xa1fd('0x4b')],function(_0x39af74){_0x39af74[_0xa1fd('0x58')]=_0x53ce3a[_0xa1fd('0x49')]['id'];return _0x39af74;});return db['UserProfileResource'][_0xa1fd('0x69')](_0x481d75,{'raw':!![],'transaction':_0x2198dc});});}})[_0xa1fd('0x47')](handleError(_0x3556fa,null));});}})[_0xa1fd('0x28')](function(_0x335fe1){var _0x5bd938=_[_0xa1fd('0x2c')](_0x335fe1,function(_0x457ffd){return _0x457ffd['get']({'plain':!![]});});})[_0xa1fd('0x28')](respondWithResult(_0x3556fa,null))[_0xa1fd('0x47')](handleError(_0x3556fa,null));};exports['removeResources']=function(_0x1d9984,_0x40a361,_0x5aa29a){return db[_0xa1fd('0x2d')]['find']({'where':{'id':_0x1d9984[_0xa1fd('0x49')]['id']}})[_0xa1fd('0x28')](handleEntityNotFound(_0x40a361,null))['then'](function(_0xacd347){if(_0xacd347){return _0xacd347[_0xa1fd('0x6a')](_0x1d9984[_0xa1fd('0x32')]['ids']);}})[_0xa1fd('0x28')](respondWithStatusCode(_0x40a361,null))[_0xa1fd('0x47')](handleError(_0x40a361,null));};exports[_0xa1fd('0x6b')]=function(_0x15d114,_0x43be6b){var _0x14b19e={'raw':![],'where':{}};var _0x5145fe={};var _0x5b1837={'count':0x0,'rows':[]};var _0x329088=_0x15d114['query'][_0xa1fd('0x6c')];if(typeof _0x329088==='undefined'){throw new db[(_0xa1fd('0x6d'))]['ValidationError']('Unknown\x20section');}var _0x3c9e62=_0x15d114[_0xa1fd('0x32')][_0xa1fd('0x6e')]||![];var _0x5b703a=getQueryModels(_0x329088,_0x3c9e62);if(typeof _0x5b703a[_0xa1fd('0x6f')]===_0xa1fd('0x70')){throw new db[(_0xa1fd('0x6d'))][(_0xa1fd('0x71'))](_0xa1fd('0x72')+_0x329088+'\x27');}var _0x198b76=[];if(!_[_0xa1fd('0x62')](_0x5b703a[_0xa1fd('0x73')])){_0x198b76=_0x5b703a[_0xa1fd('0x73')];}else{_0x198b76=[{'name':_0x329088}];}return db[_0xa1fd('0x2d')][_0xa1fd('0x64')]({'where':{'id':_0x15d114['params']['id']}})[_0xa1fd('0x28')](handleEntityNotFound(_0x43be6b,null))[_0xa1fd('0x28')](function(_0x2a1555){if(_0x2a1555){var _0x2b00a2=[];for(var _0x3ac1a1=0x0;_0x3ac1a1<_0x198b76[_0xa1fd('0x38')];_0x3ac1a1++){_0x2b00a2[_0xa1fd('0x5d')](db[_0xa1fd('0x5a')]['findOne']({'where':{'userProfileId':_0x2a1555['id'],'name':_0x198b76[_0x3ac1a1][_0xa1fd('0x2a')]},'raw':!![]}));}return BPromise[_0xa1fd('0x74')](_0x2b00a2);}})[_0xa1fd('0x28')](function(_0x5c913e){var _0x4cd176=_[_0xa1fd('0x3f')](_0x5c913e,function(_0x2d1dde){return _0x2d1dde?_0x2d1dde:undefined;});var _0x42f6c8=_[_0xa1fd('0x3f')](_0x198b76,[_0xa1fd('0x75'),!![]]);var _0x30dd83=_[_0xa1fd('0x62')](_0x4cd176)&&_['isEmpty'](_0x42f6c8)?null:_[_0xa1fd('0x76')](_0x42f6c8,_0x4cd176);if(_0x30dd83){var _0x3eb23c=[];for(var _0xc04fe=0x0;_0xc04fe<_0x30dd83[_0xa1fd('0x38')];_0xc04fe++){var _0x24f676=_[_0xa1fd('0x4d')](_0x198b76,function(_0x3e2bda){return _0x30dd83[_0xc04fe]?_0x3e2bda[_0xa1fd('0x2a')]===_0x30dd83[_0xc04fe]['name']:null;});if(_0x24f676){if(_0x30dd83[_0xc04fe][_0xa1fd('0x75')]){_0x3eb23c['push'](getAllResources(_0x5b703a['childModel'],_0x30dd83[_0xc04fe]));}else{if(!_0x30dd83[_0xc04fe]['autoAssociation']){_0x3eb23c[_0xa1fd('0x5d')](getAllowedResources(_0x24f676,_0x30dd83[_0xc04fe],_0x5b703a[_0xa1fd('0x6f')]));}else{if(_0x24f676[_0xa1fd('0x31')]){_0x3eb23c[_0xa1fd('0x5d')](getAllFilteredResources(_0x24f676,_0x30dd83[_0xc04fe]));}}}}}return BPromise[_0xa1fd('0x74')](_0x3eb23c);}else{return null;}})[_0xa1fd('0x28')](function(_0x357aa1){var _0x38ee0f=_0x357aa1;var _0x5dc595=null;if(_0x38ee0f){_0x5dc595=_0x38ee0f[_0xa1fd('0x38')]===0x1?_0x38ee0f[0x0]:null;}if(_0x5dc595||_0x38ee0f){var _0x31017b=db[_0x5b703a[_0xa1fd('0x6f')]]['rawAttributes'];_0x5145fe['model']=_[_0xa1fd('0x33')](_0x31017b);_0x5145fe[_0xa1fd('0x32')]=_[_0xa1fd('0x33')](_0x15d114[_0xa1fd('0x32')]);_0x5145fe['filters']=_['intersection'](_0x5145fe[_0xa1fd('0x31')],_0x5145fe['query']);_0x14b19e[_0xa1fd('0x36')]=_[_0xa1fd('0x35')](_0x5145fe[_0xa1fd('0x31')],qs[_0xa1fd('0x37')](_0x15d114[_0xa1fd('0x32')][_0xa1fd('0x37')]));_0x14b19e[_0xa1fd('0x36')]=_0x14b19e['attributes'][_0xa1fd('0x38')]?_0x14b19e['attributes']:_0x5145fe[_0xa1fd('0x31')];if(!_0x15d114['query'][_0xa1fd('0x39')]('nolimit')){_0x14b19e[_0xa1fd('0x3b')]=qs[_0xa1fd('0x3b')](_0x15d114['query'][_0xa1fd('0x3b')]);_0x14b19e[_0xa1fd('0x21')]=qs['offset'](_0x15d114[_0xa1fd('0x32')][_0xa1fd('0x21')]);}_0x14b19e[_0xa1fd('0x3c')]=qs['sort'](_0x15d114[_0xa1fd('0x32')][_0xa1fd('0x3d')]);_0x14b19e[_0xa1fd('0x3e')]=qs['filters'](_[_0xa1fd('0x77')](_0x15d114[_0xa1fd('0x32')],_0x5145fe[_0xa1fd('0x34')]));if(_0x15d114['query']['filter']){_0x14b19e[_0xa1fd('0x3e')]=_[_0xa1fd('0x40')](_0x14b19e['where'],{'$or':_['map'](_0x31017b,function(_0x3312d){if(_0x3312d[_0xa1fd('0x41')][_0xa1fd('0x30')]!==_0xa1fd('0x78')){var _0x3daca3={};_0x3daca3[_0x3312d[_0xa1fd('0x79')]]={'$like':'%'+_0x15d114[_0xa1fd('0x32')][_0xa1fd('0x3f')]+'%'};return _0x3daca3;}})});}var _0x5e80ad=[];if(_0x5dc595){var _0x2a4392=_['find'](_0x198b76,[_0xa1fd('0x2a'),_0x5dc595['name']]);if(_0x2a4392['field']){var _0x119171={};if(_0x5b703a[_0xa1fd('0x6f')]==='AnalyticExtractedReport'){_0x119171[_0x2a4392[_0xa1fd('0x7a')]]=_[_0xa1fd('0x2c')](_0x5dc595[_0xa1fd('0x7b')],'id');}else{_0x119171[_0x2a4392[_0xa1fd('0x7a')]]=_0x5dc595[_0xa1fd('0x7b')];}_0x5e80ad[_0xa1fd('0x5d')](_0x119171);}else{_0x14b19e['where']['id']=_0x5dc595['associatedResources'];}}else{for(var _0x54f8be=0x0;_0x54f8be<_0x38ee0f[_0xa1fd('0x38')];_0x54f8be++){var _0x2a4392=_[_0xa1fd('0x4d')](_0x198b76,['name',_0x38ee0f[_0x54f8be][_0xa1fd('0x2a')]]);if(_0x2a4392[_0xa1fd('0x79')]){var _0x119171={};_0x119171[_0x2a4392[_0xa1fd('0x7a')]]=_0x38ee0f[_0x54f8be]['associatedResources'];_0x5e80ad['push'](_0x119171);}else{if(!_0x14b19e[_0xa1fd('0x3e')]['id'])_0x14b19e[_0xa1fd('0x3e')]['id']=[];_0x38ee0f[_0x54f8be]['associatedResources']['forEach'](function(_0x374530){_0x14b19e['where']['id'][_0xa1fd('0x5d')](_0x374530);});}}}if(!_['isEmpty'](_0x5e80ad)){_0x14b19e['where']=_['merge'](_0x14b19e[_0xa1fd('0x3e')],{'$and':{'$or':_0x5e80ad}});}_0x14b19e=_[_0xa1fd('0x40')]({},_0x14b19e,_0x15d114[_0xa1fd('0x42')]);if(_0x5dc595&&!_0x5dc595[_0xa1fd('0x55')]&&_0x5b703a[_0xa1fd('0x6f')]===_0xa1fd('0x7c')){if(_0x15d114[_0xa1fd('0x32')]['includeAll']){_0x14b19e['include']=[{'all':!![]}];}return db[_0x5b703a['childModel']][_0xa1fd('0x45')](_0x14b19e)[_0xa1fd('0x28')](function(_0x46f238){var _0x47cfd5=[];_0x46f238[_0xa1fd('0x66')](function(_0x42751a){var _0x5a0008;switch(_0x42751a['reportType']){case'default':_0x5a0008=_[_0xa1fd('0x4d')](_0x5dc595[_0xa1fd('0x7b')],function(_0x20abfc){return _0x20abfc['id']===_0x42751a[_0xa1fd('0x7d')]&&_0x20abfc['type']==='DefaultReports';});break;case _0xa1fd('0x7e'):_0x5a0008=_[_0xa1fd('0x4d')](_0x5dc595[_0xa1fd('0x7b')],function(_0xd33604){return _0xd33604['id']===_0x42751a[_0xa1fd('0x7d')]&&_0xd33604[_0xa1fd('0x41')]===_0xa1fd('0x7f');});break;}if(_0x5a0008)_0x47cfd5['push'](_0x42751a);});_0x5b1837[_0xa1fd('0x20')]=_0x47cfd5[_0xa1fd('0x38')];_0x5b1837['rows']=_0x47cfd5;return _0x5b1837;});}else{return db[_0x5b703a[_0xa1fd('0x6f')]][_0xa1fd('0x20')]({'where':_0x14b19e['where']})[_0xa1fd('0x28')](function(_0x486da0){_0x5b1837[_0xa1fd('0x20')]=_0x486da0;if(_0x15d114['query'][_0xa1fd('0x43')]){if(_0x5b703a[_0xa1fd('0x6f')]===_0xa1fd('0x80')){_0x14b19e[_0xa1fd('0x44')]=[{'model':db[_0xa1fd('0x81')],'as':'Tags','attributes':['id',_0xa1fd('0x2a'),'color'],'required':_0x15d114[_0xa1fd('0x32')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0xa1fd('0x82'),'attributes':['id',_0xa1fd('0x2a'),_0xa1fd('0x83')],'through':_0x15d114['query']['tag']?{'attributes':[],'where':{'TagId':_0x15d114['query'][_0xa1fd('0x84')]||undefined}}:{},'required':_0x15d114['query'][_0xa1fd('0x84')]?!![]:![]}];}else{_0x14b19e[_0xa1fd('0x44')]=[{'all':!![]}];}}return db[_0x5b703a['childModel']][_0xa1fd('0x45')](_0x14b19e);})[_0xa1fd('0x28')](function(_0x27ac84){_0x5b1837[_0xa1fd('0x46')]=_0x27ac84;return _0x5b1837;});}}else{return _0x5b1837;}})[_0xa1fd('0x28')](respondWithFilteredResult(_0x43be6b,_0x14b19e))[_0xa1fd('0x47')](handleError(_0x43be6b,null));};function getAllResources(_0x82f96e,_0x2f09a9){return new BPromise(function(_0x1b08ed,_0x5020b6){if(_0x2f09a9){var _0x9bf821=_0x2f09a9[_0xa1fd('0x3f')]?{[_0x2f09a9[_0xa1fd('0x3f')][_0xa1fd('0x79')]]:_0x2f09a9[_0xa1fd('0x3f')][_0xa1fd('0x85')]}:undefined;return db[_0x82f96e][_0xa1fd('0x45')]({'where':_0x9bf821,'raw':!![]})[_0xa1fd('0x28')](function(_0x1d43ce){_0x2f09a9[_0xa1fd('0x7b')]=_['map'](_0x1d43ce,'id');_0x1b08ed(_0x2f09a9);})[_0xa1fd('0x47')](function(_0x3f0b85){_0x5020b6(_0x3f0b85);});}else{_0x1b08ed(null);}});}function getAllFilteredResources(_0x2620da,_0x159feb){return new BPromise(function(_0xab1dfc,_0x1f8913){var _0x1869d3=_0x2620da['filter']?{[_0x2620da['filter'][_0xa1fd('0x79')]]:_0x2620da['filter']['value']}:undefined;return db[_0x2620da[_0xa1fd('0x31')]][_0xa1fd('0x45')]({'where':_0x1869d3,'raw':!![]})['then'](function(_0x3bced4){_0x159feb['associatedResources']=_['map'](_0x3bced4,function(_0x4e5908){return _0x4e5908[_0xa1fd('0x2a')];});_0xab1dfc(_0x159feb);})[_0xa1fd('0x47')](function(_0x50b3b3){_0x1f8913(_0x50b3b3);});});}function getAllowedResources(_0x5560ac,_0x1bb32f,_0x3a7b89){return new BPromise(function(_0x496256,_0x21b3b4){if(_0x1bb32f){return db[_0xa1fd('0x5b')][_0xa1fd('0x45')]({'where':{'sectionId':_0x1bb32f['id']},'raw':!![]})['then'](function(_0x1e3a19){if(_0x5560ac[_0xa1fd('0x79')]&&_0x5560ac[_0xa1fd('0x79')]!=='id'){_0x1bb32f[_0xa1fd('0x7b')]=_['map'](_0x1e3a19,function(_0xaf1261){return _0xaf1261[_0x5560ac['field']];});}else{if(_0x3a7b89==='AnalyticExtractedReport'){_0x1bb32f['associatedResources']=_[_0xa1fd('0x2c')](_0x1e3a19,function(_0x3b4cf3){return{'id':_0x3b4cf3[_0xa1fd('0x67')],'type':_0x3b4cf3['type']};});}else{_0x1bb32f[_0xa1fd('0x7b')]=_['map'](_0x1e3a19,function(_0x403d97){return _0x403d97[_0xa1fd('0x67')];});}}_0x496256(_0x1bb32f);})[_0xa1fd('0x47')](function(_0x55d436){_0x21b3b4(_0x55d436);});}else{_0x496256(null);}});}function getQueryModels(_0x3efa79,_0x34cb8d){var _0x3cfa41=_0x3efa79[_0xa1fd('0x86')]();var _0xab82c5={'childModel':undefined,'parentSections':[]};switch(_0x3cfa41){case'squareprojects':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x87');break;case _0xa1fd('0x88'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x89');break;case'squarerecordings':_0xab82c5[_0xa1fd('0x6f')]='SquareRecording';_0xab82c5['parentSections']=[{'name':_0xa1fd('0x8a'),'field':_0xa1fd('0x2a'),'foreignKey':_0xa1fd('0x8b')}];break;case _0xa1fd('0x8c'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x8d');break;case'contacts':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x80');_0xab82c5['parentSections']=[{'name':_0xa1fd('0x8e'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x8f');break;case _0xa1fd('0x90'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x91');break;case _0xa1fd('0x92'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x93');break;case'chatqueues':_0xab82c5[_0xa1fd('0x6f')]='ChatQueue';break;case _0xa1fd('0x94'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x95');break;case _0xa1fd('0x96'):_0xab82c5['childModel']=_0xa1fd('0x97');break;case _0xa1fd('0x98'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x99');break;case _0xa1fd('0x9a'):case _0xa1fd('0x9b'):case _0xa1fd('0x9c'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x9d');break;case _0xa1fd('0x9e'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x9f');break;case _0xa1fd('0xa0'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xa1');break;case'voicerecordings':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xa2');_0xab82c5[_0xa1fd('0x73')]=[{'name':_0xa1fd('0xa3'),'field':_0xa1fd('0x2a'),'foreignKey':_0xa1fd('0xa4'),'model':_0xa1fd('0xa5'),'filter':{'field':_0xa1fd('0xa6'),'value':['agent']}},{'name':_0xa1fd('0xa7'),'field':'name','foreignKey':'membername','model':_0xa1fd('0xa5'),'filter':{'field':_0xa1fd('0xa6'),'value':['telephone']}},{'name':_0xa1fd('0xa8'),'field':_0xa1fd('0x2a'),'foreignKey':_0xa1fd('0xa9'),'model':'VoiceQueue','filter':{'field':_0xa1fd('0x41'),'value':[_0xa1fd('0xaa')]}},{'name':_0xa1fd('0xab'),'field':'name','foreignKey':_0xa1fd('0xa9'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xa1fd('0xac')]}}];break;case _0xa1fd('0xad'):_0xab82c5[_0xa1fd('0x6f')]='VoiceMusicOnHold';break;case _0xa1fd('0xae'):_0xab82c5[_0xa1fd('0x6f')]='VoiceChanSpy';break;case _0xa1fd('0xaf'):_0xab82c5['childModel']='VoicePrefix';break;case _0xa1fd('0xb0'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xb1');break;case _0xa1fd('0xb2'):_0xab82c5['childModel']='MailQueue';break;case _0xa1fd('0xb3'):_0xab82c5['childModel']=_0xa1fd('0xb4');break;case _0xa1fd('0xb5'):_0xab82c5['childModel']=_0xa1fd('0xb6');break;case _0xa1fd('0xb7'):_0xab82c5[_0xa1fd('0x6f')]='OpenchannelQueue';break;case'openchannelaccounts':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xb8');break;case _0xa1fd('0xb9'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xba');break;case'smsaccounts':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xbb');break;case _0xa1fd('0xbc'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xbd');break;case _0xa1fd('0xbe'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xbf');break;case'teams':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xc0');break;case'voicequeues':case _0xa1fd('0xc1'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xc2');if(_0x34cb8d){_0xab82c5[_0xa1fd('0x73')]=[{'name':_0xa1fd('0xa8')},{'name':_0xa1fd('0xab')}];}break;case'users':case _0xa1fd('0xc3'):case _0xa1fd('0xc4'):_0xab82c5['childModel']=_0xa1fd('0xa5');if(_0x34cb8d){_0xab82c5['parentSections']=[{'name':_0xa1fd('0xc5'),'filter':{'field':_0xa1fd('0xa6'),'value':['admin',_0xa1fd('0xc6')]},'ignore':!![]},{'name':_0xa1fd('0xa3')},{'name':'Telephones'}];}break;case _0xa1fd('0xc7'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xc8');break;case'salesforceaccounts':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xc9');break;case'freshdeskaccounts':_0xab82c5['childModel']=_0xa1fd('0xca');break;case _0xa1fd('0xcb'):_0xab82c5[_0xa1fd('0x6f')]='SugarcrmAccount';break;case _0xa1fd('0xcc'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xcd');break;case _0xa1fd('0xce'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xcf');break;case'vtigeraccounts':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xa5');break;case _0xa1fd('0xd0'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xd1');break;case _0xa1fd('0xd2'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xd3');break;case _0xa1fd('0xd4'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x65');break;case _0xa1fd('0xd5'):_0xab82c5[_0xa1fd('0x6f')]='Interval';break;case _0xa1fd('0xd6'):_0xab82c5[_0xa1fd('0x6f')]='Pause';break;case _0xa1fd('0xd7'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xd8');break;case _0xa1fd('0xd9'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xda');break;case'tags':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x81');break;case _0xa1fd('0xdb'):_0xab82c5[_0xa1fd('0x6f')]='Template';break;case _0xa1fd('0xdc'):_0xab82c5[_0xa1fd('0x6f')]='Trigger';break;case _0xa1fd('0xdd'):_0xab82c5['childModel']=_0xa1fd('0xde');break;case _0xa1fd('0xdf'):_0xab82c5[_0xa1fd('0x6f')]='Variable';break;case _0xa1fd('0xe0'):_0xab82c5['childModel']=_0xa1fd('0xe1');break;case'extractedreports':_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0x7c');_0xab82c5[_0xa1fd('0x73')]=[{'name':_0xa1fd('0xe2'),'field':'id','foreignKey':_0xa1fd('0x7d')}];break;case _0xa1fd('0xe3'):_0xab82c5[_0xa1fd('0x6f')]=_0xa1fd('0xe4');break;case'whatsappaccounts':_0xab82c5[_0xa1fd('0x6f')]='WhatsappAccount';break;default:return _0xab82c5;}return _0xab82c5;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index fa97d66..8f52d2a 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 _0x3d3e=['UserProfile','setMaxListeners','save','update','emit','hook','../../mysqldb'];(function(_0x2aca5e,_0x2ef58a){var _0x5e35ce=function(_0x249a71){while(--_0x249a71){_0x2aca5e['push'](_0x2aca5e['shift']());}};_0x5e35ce(++_0x2ef58a);}(_0x3d3e,0xbc));var _0xe3d3=function(_0x3c9ec0,_0x42f0d3){_0x3c9ec0=_0x3c9ec0-0x0;var _0x5d4926=_0x3d3e[_0x3c9ec0];return _0x5d4926;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xe3d3('0x0'))['db'][_0xe3d3('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe3d3('0x2')](0x0);var events={'afterCreate':_0xe3d3('0x3'),'afterUpdate':_0xe3d3('0x4'),'afterDestroy':'remove'};function emitEvent(_0xdaf729){return function(_0x3662d4,_0x3052dd,_0x2d52c8){UserProfileEvents[_0xe3d3('0x5')](_0xdaf729+':'+_0x3662d4['id'],_0x3662d4);UserProfileEvents[_0xe3d3('0x5')](_0xdaf729,_0x3662d4);_0x2d52c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xe3d3('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x4ccc=['setMaxListeners','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x4ccc,0x19d));var _0xc4cc=function(_0x458ecc,_0x51d25){_0x458ecc=_0x458ecc-0x0;var _0x2dab38=_0x4ccc[_0x458ecc];return _0x2dab38;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xc4cc('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc4cc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc4cc('0x2'),'afterDestroy':_0xc4cc('0x3')};function emitEvent(_0xa4f570){return function(_0x2ab575,_0x17d567,_0x118719){UserProfileEvents[_0xc4cc('0x4')](_0xa4f570+':'+_0x2ab575['id'],_0x2ab575);UserProfileEvents[_0xc4cc('0x4')](_0xa4f570,_0x2ab575);_0x118719(null);};}for(var e in events){if(events[_0xc4cc('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ff99226..69af77c 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 _0xe0af=['../../config/environment','./userProfile.attributes','exports','define','UserProfile','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x14b0e8,_0xa672a1){var _0x5f14aa=function(_0x4c1da9){while(--_0x4c1da9){_0x14b0e8['push'](_0x14b0e8['shift']());}};_0x5f14aa(++_0xa672a1);}(_0xe0af,0x1b2));var _0xfe0a=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0xe0af[_0x149f32];return _0x11f475;};'use strict';var _=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var logger=require('../../config/logger')(_0xfe0a('0x2'));var moment=require(_0xfe0a('0x3'));var BPromise=require(_0xfe0a('0x4'));var rp=require(_0xfe0a('0x5'));var fs=require('fs');var path=require(_0xfe0a('0x6'));var rimraf=require(_0xfe0a('0x7'));var config=require(_0xfe0a('0x8'));var attributes=require(_0xfe0a('0x9'));module[_0xfe0a('0xa')]=function(_0x1fec23,_0x4b1209){return _0x1fec23[_0xfe0a('0xb')](_0xfe0a('0xc'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeacc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','lodash','../../config/logger'];(function(_0x3035f9,_0xcdeb72){var _0x3a1d01=function(_0x56a1a5){while(--_0x56a1a5){_0x3035f9['push'](_0x3035f9['shift']());}};_0x3a1d01(++_0xcdeb72);}(_0xeacc,0x1c5));var _0xceac=function(_0x4da6d1,_0x3c316e){_0x4da6d1=_0x4da6d1-0x0;var _0x4193a8=_0xeacc[_0x4da6d1];return _0x4193a8;};'use strict';var _=require(_0xceac('0x0'));var util=require('util');var logger=require(_0xceac('0x1'))(_0xceac('0x2'));var moment=require(_0xceac('0x3'));var BPromise=require(_0xceac('0x4'));var rp=require(_0xceac('0x5'));var fs=require('fs');var path=require(_0xceac('0x6'));var rimraf=require(_0xceac('0x7'));var config=require(_0xceac('0x8'));var attributes=require(_0xceac('0x9'));module[_0xceac('0xa')]=function(_0x39169f,_0x2d44fa){return _0x39169f[_0xceac('0xb')]('UserProfile',attributes,{'tableName':_0xceac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e3d9186..2499403 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 _0x5fab=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userProfile.socket','register'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x5fab,0x177));var _0xb5fa=function(_0x77fbf8,_0x31cf3f){_0x77fbf8=_0x77fbf8-0x0;var _0x2df250=_0x5fab[_0x77fbf8];return _0x2df250;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file +var _0x9c5a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b7e51,_0x28c84f){var _0x41293d=function(_0x105876){while(--_0x105876){_0x5b7e51['push'](_0x5b7e51['shift']());}};_0x41293d(++_0x28c84f);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4fd2ee,_0x3524bb){_0x4fd2ee=_0x4fd2ee-0x0;var _0x911814=_0x9c5a[_0x4fd2ee];return _0x911814;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});config[_0xa9c5('0xa')]=_['defaults'](config['redis'],{'host':_0xa9c5('0xb'),'port':0x18eb});var socket=require(_0xa9c5('0xc'))(new Redis(config['redis']));require(_0xa9c5('0xd'))[_0xa9c5('0xe')](socket);function respondWithRpcPromise(_0x51c14c,_0x2e4f45,_0x40a79d){return new BPromise(function(_0x4a19c0,_0x4c55e9){return client[_0xa9c5('0xf')](_0x51c14c,_0x40a79d)[_0xa9c5('0x10')](function(_0x45f8d8){logger[_0xa9c5('0x11')](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));logger[_0xa9c5('0x14')](_0xa9c5('0x15'),_0x2e4f45,_0xa9c5('0x13'),JSON[_0xa9c5('0x16')](_0x45f8d8));if(_0x45f8d8['error']){if(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x18')]===0x1f4){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);return _0x4c55e9(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8['error'][_0xa9c5('0x19')]);return _0x4a19c0(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}else{logger['info'](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));_0x4a19c0(_0x45f8d8[_0xa9c5('0x1a')][_0xa9c5('0x19')]);}})[_0xa9c5('0x1b')](function(_0x349f27){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x349f27);_0x4c55e9(_0x349f27);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8f3298e..9b60eaa 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 _0x4261=['emit','register','./userProfile.events','save'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0x4261,0x1ea));var _0x1426=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4261[_0x28947d];return _0x12d2ee;};'use strict';var UserProfileEvents=require(_0x1426('0x0'));var events=[_0x1426('0x1'),'remove','update'];function createListener(_0x2f5bc3,_0x5c62d6){return function(_0x400882){_0x5c62d6[_0x1426('0x2')](_0x2f5bc3,_0x400882);};}function removeListener(_0x58d34a,_0x468346){return function(){UserProfileEvents['removeListener'](_0x58d34a,_0x468346);};}exports[_0x1426('0x3')]=function(_0x1a1f53){for(var _0x243a93=0x0,_0x52b0a2=events['length'];_0x243a93<_0x52b0a2;_0x243a93++){var _0x443948=events[_0x243a93];var _0x27b14c=createListener('userProfile:'+_0x443948,_0x1a1f53);UserProfileEvents['on'](_0x443948,_0x27b14c);}}; \ No newline at end of file +var _0x6d06=['removeListener','./userProfile.events','save'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6d06,0x181));var _0x66d0=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x6d06[_0x5d8018];return _0x151ac4;};'use strict';var UserProfileEvents=require(_0x66d0('0x0'));var events=[_0x66d0('0x1'),'remove','update'];function createListener(_0x5a9a83,_0xca90){return function(_0x586bee){_0xca90['emit'](_0x5a9a83,_0x586bee);};}function removeListener(_0x426139,_0x53812c){return function(){UserProfileEvents[_0x66d0('0x2')](_0x426139,_0x53812c);};}exports['register']=function(_0x3d4ee9){for(var _0x488e04=0x0,_0x91a723=events['length'];_0x488e04<_0x91a723;_0x488e04++){var _0x32e471=events[_0x488e04];var _0x3d9ae4=createListener('userProfile:'+_0x32e471,_0x3d4ee9);UserProfileEvents['on'](_0x32e471,_0x3d9ae4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 38eb4f9..b735783 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 _0xd3b0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0xd3b0,0x1f4));var _0x0d3b=function(_0x591fa4,_0x100bf9){_0x591fa4=_0x591fa4-0x0;var _0x5c3e4e=_0xd3b0[_0x591fa4];return _0x5c3e4e;};'use strict';var multer=require(_0x0d3b('0x0'));var util=require(_0x0d3b('0x1'));var path=require(_0x0d3b('0x2'));var timeout=require(_0x0d3b('0x3'));var express=require(_0x0d3b('0x4'));var router=express[_0x0d3b('0x5')]();var auth=require(_0x0d3b('0x6'));var interaction=require(_0x0d3b('0x7'));var config=require(_0x0d3b('0x8'));var controller=require(_0x0d3b('0x9'));router[_0x0d3b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0d3b('0xa')](_0x0d3b('0xb'),auth[_0x0d3b('0xc')](),controller[_0x0d3b('0xd')]);router[_0x0d3b('0xa')](_0x0d3b('0xe'),auth[_0x0d3b('0xc')](),controller[_0x0d3b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d3b('0x10')]);router[_0x0d3b('0x11')](_0x0d3b('0xe'),auth[_0x0d3b('0xc')](),controller[_0x0d3b('0x12')]);router[_0x0d3b('0x13')](_0x0d3b('0xe'),auth[_0x0d3b('0xc')](),controller[_0x0d3b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb7e2=['post','create','update','delete','/:id','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','show'];(function(_0x407853,_0x4887bf){var _0x5b33e4=function(_0x458ab1){while(--_0x458ab1){_0x407853['push'](_0x407853['shift']());}};_0x5b33e4(++_0x4887bf);}(_0xb7e2,0x103));var _0x2b7e=function(_0x371a60,_0x47098f){_0x371a60=_0x371a60-0x0;var _0x2ec1ec=_0xb7e2[_0x371a60];return _0x2ec1ec;};'use strict';var multer=require(_0x2b7e('0x0'));var util=require('util');var path=require(_0x2b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b7e('0x2'));var router=express['Router']();var auth=require(_0x2b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2b7e('0x4'));var controller=require(_0x2b7e('0x5'));router[_0x2b7e('0x6')]('/',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0x8')]);router[_0x2b7e('0x6')]('/describe',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0x9')]);router[_0x2b7e('0x6')]('/:id',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0xa')]);router[_0x2b7e('0xb')]('/',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0xc')]);router['put']('/:id',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0xd')]);router[_0x2b7e('0xe')](_0x2b7e('0xf'),auth[_0x2b7e('0x7')](),controller[_0x2b7e('0x10')]);module[_0x2b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a1da47b..fefd488 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 _0x6b9b=['STRING','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6b9b,0x1a7));var _0xb6b9=function(_0xdb8ad,_0x41edfb){_0xdb8ad=_0xdb8ad-0x0;var _0x1b96dc=_0x6b9b[_0xdb8ad];return _0x1b96dc;};'use strict';var Sequelize=require('sequelize');module[_0xb6b9('0x0')]={'name':{'type':Sequelize[_0xb6b9('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xb6b9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3eb2=['exports','INTEGER','STRING','sequelize'];(function(_0x122790,_0x2b8654){var _0x4bffd9=function(_0x3ba343){while(--_0x3ba343){_0x122790['push'](_0x122790['shift']());}};_0x4bffd9(++_0x2b8654);}(_0x3eb2,0x1d7));var _0x23eb=function(_0x1bbd15,_0x550da2){_0x1bbd15=_0x1bbd15-0x0;var _0x18ad1f=_0x3eb2[_0x1bbd15];return _0x18ad1f;};'use strict';var Sequelize=require(_0x23eb('0x0'));module[_0x23eb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x23eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x23eb('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index b8968cc..c944990 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 _0xabce=['UserProfileResource','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','count','includeAll','rows','show','params','include','merge','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0xf5535,_0x4ee2fd){var _0x23c17f=function(_0x295fc1){while(--_0x295fc1){_0xf5535['push'](_0xf5535['shift']());}};_0x23c17f(++_0x4ee2fd);}(_0xabce,0x103));var _0xeabc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xabce[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=_0xf913d7['count'],_0x49f2d8=_0x53d5cb[_0xeabc('0x1d')],_0x53fe28=_0x53d5cb[_0xeabc('0x1d')]+_0x53d5cb[_0xeabc('0x1e')],_0x10fa8e;if(_0x53fe28>=_0x638976){_0x53fe28=_0x638976;_0x10fa8e=0xc8;}else{_0x10fa8e=0xce;}_0x326bac[_0xeabc('0x1a')](_0x10fa8e);return _0x326bac[_0xeabc('0x1f')](_0xeabc('0x20'),_0x49f2d8+'-'+_0x53fe28+'/'+_0x638976)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x5e30ee){return function(_0x5d92e5){try{jsonpatch[_0xeabc('0x21')](_0x5d92e5,_0x5e30ee,!![]);}catch(_0x4d68ea){return BPromise[_0xeabc('0x22')](_0x4d68ea);}return _0x5d92e5[_0xeabc('0x23')]();};}function saveUpdates(_0x502947,_0x28063a){return function(_0x41d67a){if(_0x41d67a){return _0x41d67a[_0xeabc('0x24')](_0x502947)[_0xeabc('0x25')](function(_0x3c9611){return _0x3c9611;});}return null;};}function removeEntity(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x26')]()['then'](function(){_0x4e99a4[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x214953,_0x319119){return function(_0x5b8838){if(!_0x5b8838){_0x214953[_0xeabc('0x27')](0x194);}return _0x5b8838;};}function handleError(_0x480440,_0x27dbaf){_0x27dbaf=_0x27dbaf||0x1f4;return function(_0x4d4e29){logger[_0xeabc('0x28')](_0x4d4e29[_0xeabc('0x29')]);if(_0x4d4e29[_0xeabc('0x2a')]){delete _0x4d4e29[_0xeabc('0x2a')];}_0x480440[_0xeabc('0x1a')](_0x27dbaf)[_0xeabc('0x2b')](_0x4d4e29);};}exports[_0xeabc('0x2c')]=function(_0x4c2693,_0x5b2934){var _0x459c8a={},_0x5bf8f2={},_0x3c1b5b={'count':0x0,'rows':[]};var _0x2b342c=_['map'](db[_0xeabc('0x2d')][_0xeabc('0x2e')],function(_0x2b568f){return{'name':_0x2b568f[_0xeabc('0x2f')],'type':_0x2b568f[_0xeabc('0x30')][_0xeabc('0x31')]};});_0x5bf8f2[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x2b342c,_0xeabc('0x2a'));_0x5bf8f2['query']=_[_0xeabc('0x34')](_0x4c2693['query']);_0x5bf8f2[_0xeabc('0x35')]=_[_0xeabc('0x36')](_0x5bf8f2[_0xeabc('0x32')],_0x5bf8f2[_0xeabc('0x37')]);_0x459c8a[_0xeabc('0x38')]=_[_0xeabc('0x36')](_0x5bf8f2[_0xeabc('0x32')],qs['fields'](_0x4c2693[_0xeabc('0x37')][_0xeabc('0x39')]));_0x459c8a[_0xeabc('0x38')]=_0x459c8a['attributes'][_0xeabc('0x3a')]?_0x459c8a[_0xeabc('0x38')]:_0x5bf8f2[_0xeabc('0x32')];if(!_0x4c2693['query'][_0xeabc('0x3b')](_0xeabc('0x3c'))){_0x459c8a[_0xeabc('0x1e')]=qs['limit'](_0x4c2693[_0xeabc('0x37')][_0xeabc('0x1e')]);_0x459c8a['offset']=qs['offset'](_0x4c2693[_0xeabc('0x37')][_0xeabc('0x1d')]);}_0x459c8a['order']=qs[_0xeabc('0x3d')](_0x4c2693[_0xeabc('0x37')][_0xeabc('0x3d')]);_0x459c8a[_0xeabc('0x3e')]=qs[_0xeabc('0x35')](_['pick'](_0x4c2693[_0xeabc('0x37')],_0x5bf8f2['filters']),_0x2b342c);if(_0x4c2693[_0xeabc('0x37')][_0xeabc('0x3f')]){_0x459c8a[_0xeabc('0x3e')]=_['merge'](_0x459c8a['where'],{'$or':_[_0xeabc('0x33')](_0x2b342c,function(_0x560d4a){if(_0x560d4a[_0xeabc('0x30')]!=='VIRTUAL'){var _0x54e284={};_0x54e284[_0x560d4a['name']]={'$like':'%'+_0x4c2693['query'][_0xeabc('0x3f')]+'%'};return _0x54e284;}})});}_0x459c8a=_['merge']({},_0x459c8a,_0x4c2693[_0xeabc('0x40')]);var _0x1ebfb6={'where':_0x459c8a['where']};return db[_0xeabc('0x2d')]['count'](_0x1ebfb6)[_0xeabc('0x25')](function(_0x58aafe){_0x3c1b5b[_0xeabc('0x41')]=_0x58aafe;if(_0x4c2693[_0xeabc('0x37')][_0xeabc('0x42')]){_0x459c8a['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x459c8a);})[_0xeabc('0x25')](function(_0x23fb33){_0x3c1b5b[_0xeabc('0x43')]=_0x23fb33;return _0x3c1b5b;})['then'](respondWithFilteredResult(_0x5b2934,_0x459c8a))['catch'](handleError(_0x5b2934,null));};exports[_0xeabc('0x44')]=function(_0x1680e8,_0x5e9cb3){var _0xc6af4d={'raw':![],'where':{'id':_0x1680e8[_0xeabc('0x45')]['id']}},_0x5e0b78={};_0x5e0b78['model']=_['keys'](db['UserProfileResource'][_0xeabc('0x2e')]);_0x5e0b78[_0xeabc('0x37')]=_[_0xeabc('0x34')](_0x1680e8[_0xeabc('0x37')]);_0x5e0b78['filters']=_[_0xeabc('0x36')](_0x5e0b78['model'],_0x5e0b78[_0xeabc('0x37')]);_0xc6af4d[_0xeabc('0x38')]=_[_0xeabc('0x36')](_0x5e0b78[_0xeabc('0x32')],qs[_0xeabc('0x39')](_0x1680e8['query']['fields']));_0xc6af4d[_0xeabc('0x38')]=_0xc6af4d['attributes'][_0xeabc('0x3a')]?_0xc6af4d[_0xeabc('0x38')]:_0x5e0b78['model'];if(_0x1680e8[_0xeabc('0x37')][_0xeabc('0x42')]){_0xc6af4d[_0xeabc('0x46')]=[{'all':!![]}];}_0xc6af4d=_[_0xeabc('0x47')]({},_0xc6af4d,_0x1680e8[_0xeabc('0x40')]);return db[_0xeabc('0x2d')][_0xeabc('0x48')](_0xc6af4d)['then'](handleEntityNotFound(_0x5e9cb3,null))[_0xeabc('0x25')](respondWithResult(_0x5e9cb3,null))[_0xeabc('0x49')](handleError(_0x5e9cb3,null));};exports[_0xeabc('0x4a')]=function(_0x1b41c8,_0x271f8c){return db[_0xeabc('0x2d')][_0xeabc('0x4a')](_0x1b41c8[_0xeabc('0x4b')],{})[_0xeabc('0x25')](respondWithResult(_0x271f8c,0xc9))[_0xeabc('0x49')](handleError(_0x271f8c,null));};exports['update']=function(_0x38356c,_0x2e6efb){if(_0x38356c[_0xeabc('0x4b')]['id']){delete _0x38356c[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x2d')][_0xeabc('0x48')]({'where':{'id':_0x38356c[_0xeabc('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e6efb,null))[_0xeabc('0x25')](saveUpdates(_0x38356c[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x2e6efb,null))[_0xeabc('0x49')](handleError(_0x2e6efb,null));};exports[_0xeabc('0x26')]=function(_0x58e2c1,_0x305946){return db[_0xeabc('0x2d')][_0xeabc('0x48')]({'where':{'id':_0x58e2c1[_0xeabc('0x45')]['id']}})['then'](handleEntityNotFound(_0x305946,null))[_0xeabc('0x25')](removeEntity(_0x305946,null))[_0xeabc('0x49')](handleError(_0x305946,null));};exports['describe']=function(_0x43e596,_0x5a0d4d){return db[_0xeabc('0x2d')]['describe']()[_0xeabc('0x25')](respondWithResult(_0x5a0d4d,null))[_0xeabc('0x49')](handleError(_0x5a0d4d,null));}; \ No newline at end of file +var _0xe14b=['catch','create','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','fields','length','include','options','find'];(function(_0x5de945,_0x5dd747){var _0xe8fd9d=function(_0x56395d){while(--_0x56395d){_0x5de945['push'](_0x5de945['shift']());}};_0xe8fd9d(++_0x5dd747);}(_0xe14b,0x93));var _0xbe14=function(_0x1067e2,_0x1a2186){_0x1067e2=_0x1067e2-0x0;var _0x381aad=_0xe14b[_0x1067e2];return _0x381aad;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x505dbd,_0x2da350){return function(_0x4d4190){if(!_0x4d4190){_0x505dbd[_0xbe14('0x16')](0x194);}return _0x4d4190;};}function handleError(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0x1f4;return function(_0x5fa043){logger[_0xbe14('0x22')](_0x5fa043[_0xbe14('0x23')]);if(_0x5fa043[_0xbe14('0x24')]){delete _0x5fa043[_0xbe14('0x24')];}_0x4851f8['status'](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);};}exports[_0xbe14('0x26')]=function(_0x391556,_0x169369){var _0x5dd475={},_0x16f884={},_0x29fc64={'count':0x0,'rows':[]};var _0x59bf34=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x19252f){return{'name':_0x19252f[_0xbe14('0x2a')],'type':_0x19252f[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x16f884[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x59bf34,_0xbe14('0x24'));_0x16f884[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x391556[_0xbe14('0x2e')]);_0x16f884[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],_0x16f884[_0xbe14('0x2e')]);_0x5dd475[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],qs['fields'](_0x391556[_0xbe14('0x2e')]['fields']));_0x5dd475['attributes']=_0x5dd475[_0xbe14('0x32')]['length']?_0x5dd475[_0xbe14('0x32')]:_0x16f884[_0xbe14('0x2d')];if(!_0x391556['query']['hasOwnProperty']('nolimit')){_0x5dd475[_0xbe14('0x1b')]=qs[_0xbe14('0x1b')](_0x391556['query'][_0xbe14('0x1b')]);_0x5dd475[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x391556[_0xbe14('0x2e')][_0xbe14('0x1a')]);}_0x5dd475['order']=qs['sort'](_0x391556[_0xbe14('0x2e')]['sort']);_0x5dd475['where']=qs['filters'](_[_0xbe14('0x33')](_0x391556[_0xbe14('0x2e')],_0x16f884[_0xbe14('0x30')]),_0x59bf34);if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]){_0x5dd475[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x5dd475[_0xbe14('0x35')],{'$or':_[_0xbe14('0x27')](_0x59bf34,function(_0x2dfd5a){if(_0x2dfd5a[_0xbe14('0x2b')]!==_0xbe14('0x37')){var _0x539c41={};_0x539c41[_0x2dfd5a['name']]={'$like':'%'+_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]+'%'};return _0x539c41;}})});}_0x5dd475=_[_0xbe14('0x36')]({},_0x5dd475,_0x391556['options']);var _0x326329={'where':_0x5dd475[_0xbe14('0x35')]};return db[_0xbe14('0x28')][_0xbe14('0x19')](_0x326329)[_0xbe14('0x38')](function(_0x25ee1f){_0x29fc64[_0xbe14('0x19')]=_0x25ee1f;if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x39')]){_0x5dd475['include']=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x3a')](_0x5dd475);})[_0xbe14('0x38')](function(_0x1b3118){_0x29fc64[_0xbe14('0x3b')]=_0x1b3118;return _0x29fc64;})[_0xbe14('0x38')](respondWithFilteredResult(_0x169369,_0x5dd475))['catch'](handleError(_0x169369,null));};exports[_0xbe14('0x3c')]=function(_0x1974a4,_0x1220c9){var _0x36263c={'raw':![],'where':{'id':_0x1974a4['params']['id']}},_0x5cf713={};_0x5cf713[_0xbe14('0x2d')]=_[_0xbe14('0x2f')](db[_0xbe14('0x28')]['rawAttributes']);_0x5cf713['query']=_[_0xbe14('0x2f')](_0x1974a4['query']);_0x5cf713['filters']=_[_0xbe14('0x31')](_0x5cf713[_0xbe14('0x2d')],_0x5cf713[_0xbe14('0x2e')]);_0x36263c['attributes']=_['intersection'](_0x5cf713['model'],qs[_0xbe14('0x3d')](_0x1974a4[_0xbe14('0x2e')][_0xbe14('0x3d')]));_0x36263c['attributes']=_0x36263c[_0xbe14('0x32')][_0xbe14('0x3e')]?_0x36263c[_0xbe14('0x32')]:_0x5cf713[_0xbe14('0x2d')];if(_0x1974a4['query']['includeAll']){_0x36263c[_0xbe14('0x3f')]=[{'all':!![]}];}_0x36263c=_[_0xbe14('0x36')]({},_0x36263c,_0x1974a4[_0xbe14('0x40')]);return db[_0xbe14('0x28')][_0xbe14('0x41')](_0x36263c)['then'](handleEntityNotFound(_0x1220c9,null))['then'](respondWithResult(_0x1220c9,null))[_0xbe14('0x42')](handleError(_0x1220c9,null));};exports[_0xbe14('0x43')]=function(_0x238c60,_0x2a3b35){return db['UserProfileResource'][_0xbe14('0x43')](_0x238c60[_0xbe14('0x44')],{})['then'](respondWithResult(_0x2a3b35,0xc9))[_0xbe14('0x42')](handleError(_0x2a3b35,null));};exports[_0xbe14('0x20')]=function(_0x2d6ee8,_0x36c20c){if(_0x2d6ee8['body']['id']){delete _0x2d6ee8['body']['id'];}return db[_0xbe14('0x28')][_0xbe14('0x41')]({'where':{'id':_0x2d6ee8['params']['id']}})['then'](handleEntityNotFound(_0x36c20c,null))[_0xbe14('0x38')](saveUpdates(_0x2d6ee8[_0xbe14('0x44')],null))[_0xbe14('0x38')](respondWithResult(_0x36c20c,null))[_0xbe14('0x42')](handleError(_0x36c20c,null));};exports[_0xbe14('0x21')]=function(_0xd04fd5,_0x10cd86){return db['UserProfileResource'][_0xbe14('0x41')]({'where':{'id':_0xd04fd5[_0xbe14('0x45')]['id']}})[_0xbe14('0x38')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x38')](removeEntity(_0x10cd86,null))[_0xbe14('0x42')](handleError(_0x10cd86,null));};exports['describe']=function(_0x3a221b,_0x3d419a){return db[_0xbe14('0x28')][_0xbe14('0x46')]()[_0xbe14('0x38')](respondWithResult(_0x3d419a,null))[_0xbe14('0x42')](handleError(_0x3d419a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 771f5bf..e931ec4 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 _0x924a=['sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x2c309d,_0x218c55){var _0x31f0a6=function(_0x4b9918){while(--_0x4b9918){_0x2c309d['push'](_0x2c309d['shift']());}};_0x31f0a6(++_0x218c55);}(_0x924a,0x79));var _0xa924=function(_0x598390,_0x3add71){_0x598390=_0x598390-0x0;var _0x2380a6=_0x924a[_0x598390];return _0x2380a6;};'use strict';var _=require(_0xa924('0x0'));var util=require(_0xa924('0x1'));var logger=require(_0xa924('0x2'))(_0xa924('0x3'));var moment=require(_0xa924('0x4'));var BPromise=require('bluebird');var rp=require(_0xa924('0x5'));var fs=require('fs');var path=require(_0xa924('0x6'));var rimraf=require(_0xa924('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xa924('0x8')]=function(_0x1bd52d,_0x53a092){return _0x1bd52d[_0xa924('0x9')](_0xa924('0xa'),attributes,{'tableName':_0xa924('0xb'),'paranoid':![],'indexes':[{'name':_0xa924('0xc'),'fields':[_0xa924('0xd'),_0xa924('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefba=['UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x26c518,_0xcd1c0c){var _0x5cf2d5=function(_0x2a2bbc){while(--_0x2a2bbc){_0x26c518['push'](_0x26c518['shift']());}};_0x5cf2d5(++_0xcd1c0c);}(_0xefba,0x1cf));var _0xaefb=function(_0x4f2e4b,_0x2d084c){_0x4f2e4b=_0x4f2e4b-0x0;var _0x3afdbb=_0xefba[_0x4f2e4b];return _0x3afdbb;};'use strict';var _=require(_0xaefb('0x0'));var util=require(_0xaefb('0x1'));var logger=require(_0xaefb('0x2'))(_0xaefb('0x3'));var moment=require(_0xaefb('0x4'));var BPromise=require(_0xaefb('0x5'));var rp=require(_0xaefb('0x6'));var fs=require('fs');var path=require(_0xaefb('0x7'));var rimraf=require(_0xaefb('0x8'));var config=require(_0xaefb('0x9'));var attributes=require(_0xaefb('0xa'));module[_0xaefb('0xb')]=function(_0x37709f,_0xfc4f1d){return _0x37709f[_0xaefb('0xc')](_0xaefb('0xd'),attributes,{'tableName':_0xaefb('0xe'),'paranoid':![],'indexes':[{'name':_0xaefb('0xf'),'fields':['resourceId',_0xaefb('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 354cf43..fa41e90 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 _0xff61=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x5bd30e,_0x1cf617){var _0x52f137=function(_0x4ff05b){while(--_0x4ff05b){_0x5bd30e['push'](_0x5bd30e['shift']());}};_0x52f137(++_0x1cf617);}(_0xff61,0x71));var _0x1ff6=function(_0x5e3adc,_0x28a873){_0x5e3adc=_0x5e3adc-0x0;var _0x530fd9=_0xff61[_0x5e3adc];return _0x530fd9;};'use strict';var _=require(_0x1ff6('0x0'));var util=require(_0x1ff6('0x1'));var moment=require('moment');var BPromise=require(_0x1ff6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ff6('0x3'));var db=require(_0x1ff6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ff6('0x5'))(_0x1ff6('0x6'));var config=require(_0x1ff6('0x7'));var jayson=require(_0x1ff6('0x8'));var client=jayson[_0x1ff6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18edc7,_0x14a978,_0x2cc7c3){return new BPromise(function(_0x395fee,_0x52cb20){return client[_0x1ff6('0xa')](_0x18edc7,_0x2cc7c3)['then'](function(_0xb8d69e){logger[_0x1ff6('0xb')](_0x1ff6('0xc'),_0x14a978,_0x1ff6('0xd'));logger[_0x1ff6('0xe')](_0x1ff6('0xf'),_0x14a978,'request\x20sent',JSON[_0x1ff6('0x10')](_0xb8d69e));if(_0xb8d69e[_0x1ff6('0x11')]){if(_0xb8d69e[_0x1ff6('0x11')]['code']===0x1f4){logger['error'](_0x1ff6('0xc'),_0x14a978,_0xb8d69e[_0x1ff6('0x11')][_0x1ff6('0x12')]);return _0x52cb20(_0xb8d69e[_0x1ff6('0x11')][_0x1ff6('0x12')]);}logger[_0x1ff6('0x11')](_0x1ff6('0xc'),_0x14a978,_0xb8d69e[_0x1ff6('0x11')]['message']);return _0x395fee(_0xb8d69e[_0x1ff6('0x11')]['message']);}else{logger[_0x1ff6('0xb')](_0x1ff6('0xc'),_0x14a978,_0x1ff6('0xd'));_0x395fee(_0xb8d69e[_0x1ff6('0x13')][_0x1ff6('0x12')]);}})[_0x1ff6('0x14')](function(_0x1e9eb4){logger[_0x1ff6('0x11')](_0x1ff6('0xc'),_0x14a978,_0x1e9eb4);_0x52cb20(_0x1e9eb4);});});} \ No newline at end of file +var _0xc176=['then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc176,0xf4));var _0x6c17=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xc176[_0x648163];return _0x199d4d;};'use strict';var _=require('lodash');var util=require(_0x6c17('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6c17('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c17('0x2'))['db'];var utils=require(_0x6c17('0x3'));var logger=require(_0x6c17('0x4'))('rpc');var config=require(_0x6c17('0x5'));var jayson=require(_0x6c17('0x6'));var client=jayson[_0x6c17('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378338,_0x5cfb14,_0x5a22b1){return new BPromise(function(_0x17bc18,_0x42b610){return client['request'](_0x378338,_0x5a22b1)[_0x6c17('0x8')](function(_0x1bf170){logger[_0x6c17('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x5cfb14,_0x6c17('0xa'));logger[_0x6c17('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5cfb14,_0x6c17('0xa'),JSON[_0x6c17('0xc')](_0x1bf170));if(_0x1bf170[_0x6c17('0xd')]){if(_0x1bf170['error'][_0x6c17('0xe')]===0x1f4){logger['error'](_0x6c17('0xf'),_0x5cfb14,_0x1bf170[_0x6c17('0xd')][_0x6c17('0x10')]);return _0x42b610(_0x1bf170[_0x6c17('0xd')][_0x6c17('0x10')]);}logger['error'](_0x6c17('0xf'),_0x5cfb14,_0x1bf170[_0x6c17('0xd')][_0x6c17('0x10')]);return _0x17bc18(_0x1bf170[_0x6c17('0xd')][_0x6c17('0x10')]);}else{logger[_0x6c17('0x9')](_0x6c17('0xf'),_0x5cfb14,'request\x20sent');_0x17bc18(_0x1bf170['result']['message']);}})[_0x6c17('0x11')](function(_0x65ad34){logger['error'](_0x6c17('0xf'),_0x5cfb14,_0x65ad34);_0x42b610(_0x65ad34);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4124982..7869f06 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 _0xe48f=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','describe','/:id','isAuthenticated','show','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe48f,0x9c));var _0xfe48=function(_0xbce261,_0x5bf87e){_0xbce261=_0xbce261-0x0;var _0x23848f=_0xe48f[_0xbce261];return _0x23848f;};'use strict';var multer=require(_0xfe48('0x0'));var util=require(_0xfe48('0x1'));var path=require(_0xfe48('0x2'));var timeout=require(_0xfe48('0x3'));var express=require('express');var router=express[_0xfe48('0x4')]();var auth=require(_0xfe48('0x5'));var interaction=require(_0xfe48('0x6'));var config=require(_0xfe48('0x7'));var controller=require(_0xfe48('0x8'));router[_0xfe48('0x9')]('/',auth['isAuthenticated'](),controller[_0xfe48('0xa')]);router['get'](_0xfe48('0xb'),auth['isAuthenticated'](),controller[_0xfe48('0xc')]);router['get'](_0xfe48('0xd'),auth[_0xfe48('0xe')](),controller[_0xfe48('0xf')]);router['post']('/',auth[_0xfe48('0xe')](),controller['create']);router['put'](_0xfe48('0xd'),auth['isAuthenticated'](),controller[_0xfe48('0x10')]);router['delete']('/:id',auth[_0xfe48('0xe')](),controller[_0xfe48('0x11')]);module['exports']=router; \ No newline at end of file +var _0x52d2=['Router','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x3b441d,_0xdae64d){var _0x1b257b=function(_0x59870b){while(--_0x59870b){_0x3b441d['push'](_0x3b441d['shift']());}};_0x1b257b(++_0xdae64d);}(_0x52d2,0x13e));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var path=require(_0x252d('0x2'));var timeout=require(_0x252d('0x3'));var express=require(_0x252d('0x4'));var router=express[_0x252d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x252d('0x6'));var config=require('../../config/environment');var controller=require(_0x252d('0x7'));router['get']('/',auth[_0x252d('0x8')](),controller[_0x252d('0x9')]);router[_0x252d('0xa')](_0x252d('0xb'),auth[_0x252d('0x8')](),controller[_0x252d('0xc')]);router[_0x252d('0xa')](_0x252d('0xd'),auth[_0x252d('0x8')](),controller[_0x252d('0xe')]);router[_0x252d('0xf')]('/',auth['isAuthenticated'](),controller[_0x252d('0x10')]);router['put'](_0x252d('0xd'),auth[_0x252d('0x8')](),controller[_0x252d('0x11')]);router['delete'](_0x252d('0xd'),auth[_0x252d('0x8')](),controller[_0x252d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3fe8ee7..110d9a6 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 _0x1360=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING'];(function(_0x4a39af,_0x86837){var _0x33a9a5=function(_0x5cbaac){while(--_0x5cbaac){_0x4a39af['push'](_0x4a39af['shift']());}};_0x33a9a5(++_0x86837);}(_0x1360,0x180));var _0x0136=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x1360[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x0136('0x0'));module[_0x0136('0x1')]={'name':{'type':Sequelize[_0x0136('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x0136('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0136('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0136('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0136('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0136('0x2')],'set':function(_0x44180e){this[_0x0136('0x5')](_0x0136('0x6'),_0x44180e?_0x44180e[_0x0136('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x0136('0x6'))?this[_0x0136('0x8')](_0x0136('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0x0776=['BOOLEAN','setDataValue','crudPermissions','join','split','sequelize','STRING','INTEGER'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x0776,0xad));var _0x6077=function(_0x5ccdac,_0x5ba9b1){_0x5ccdac=_0x5ccdac-0x0;var _0x38961c=_0x0776[_0x5ccdac];return _0x38961c;};'use strict';var Sequelize=require(_0x6077('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x6077('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6077('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x6077('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6077('0x1')],'set':function(_0x360b30){this[_0x6077('0x4')](_0x6077('0x5'),_0x360b30?_0x360b30[_0x6077('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue']('crudPermissions')[_0x6077('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 47fee0f..ca2d26c 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 _0x7261=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto'];(function(_0x2dc89,_0xda2bc0){var _0x375b28=function(_0x5d3ce8){while(--_0x5d3ce8){_0x2dc89['push'](_0x2dc89['shift']());}};_0x375b28(++_0xda2bc0);}(_0x7261,0x91));var _0x1726=function(_0x57868d,_0x238f03){_0x57868d=_0x57868d-0x0;var _0xc30fcb=_0x7261[_0x57868d];return _0xc30fcb;};'use strict';var pdf=require(_0x1726('0x0'));var emlformat=require(_0x1726('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1726('0x2'));var jsonpatch=require(_0x1726('0x3'));var rp=require(_0x1726('0x4'));var moment=require('moment');var BPromise=require(_0x1726('0x5'));var Mustache=require(_0x1726('0x6'));var util=require('util');var path=require(_0x1726('0x7'));var sox=require(_0x1726('0x8'));var csv=require('to-csv');var ejs=require(_0x1726('0x9'));var fs=require('fs');var _=require(_0x1726('0xa'));var squel=require(_0x1726('0xb'));var crypto=require(_0x1726('0xc'));var jsforce=require(_0x1726('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1726('0xe'));var querystring=require(_0x1726('0xf'));var Papa=require(_0x1726('0x10'));var Redis=require(_0x1726('0x11'));var authService=require(_0x1726('0x12'));var qs=require(_0x1726('0x13'));var as=require(_0x1726('0x14'));var hardwareService=require(_0x1726('0x15'));var logger=require(_0x1726('0x16'))(_0x1726('0x17'));var utils=require(_0x1726('0x18'));var config=require(_0x1726('0x19'));var licenseUtil=require(_0x1726('0x1a'));var db=require(_0x1726('0x1b'))['db'];function respondWithStatusCode(_0x1ec005,_0x4cd6bb){_0x4cd6bb=_0x4cd6bb||0xcc;return function(_0x4e88e6){if(_0x4e88e6){return _0x1ec005[_0x1726('0x1c')](_0x4cd6bb);}return _0x1ec005['status'](_0x4cd6bb)[_0x1726('0x1d')]();};}function respondWithResult(_0x48361a,_0x5c2a6f){_0x5c2a6f=_0x5c2a6f||0xc8;return function(_0x4c0481){if(_0x4c0481){return _0x48361a['status'](_0x5c2a6f)[_0x1726('0x1e')](_0x4c0481);}};}function respondWithFilteredResult(_0x3122d7,_0x5d652d){return function(_0x1fce0c){if(_0x1fce0c){var _0x21fa53=_0x1fce0c['count'],_0x4cec89=_0x5d652d['offset'],_0x1be596=_0x5d652d[_0x1726('0x1f')]+_0x5d652d[_0x1726('0x20')],_0x4c533b;if(_0x1be596>=_0x21fa53){_0x1be596=_0x21fa53;_0x4c533b=0xc8;}else{_0x4c533b=0xce;}_0x3122d7[_0x1726('0x21')](_0x4c533b);return _0x3122d7[_0x1726('0x22')](_0x1726('0x23'),_0x4cec89+'-'+_0x1be596+'/'+_0x21fa53)[_0x1726('0x1e')](_0x1fce0c);}return null;};}function patchUpdates(_0x1db604){return function(_0xfd7f8a){try{jsonpatch['apply'](_0xfd7f8a,_0x1db604,!![]);}catch(_0x533caa){return BPromise[_0x1726('0x24')](_0x533caa);}return _0xfd7f8a[_0x1726('0x25')]();};}function saveUpdates(_0x9f6523,_0x15a84d){return function(_0x39cd32){if(_0x39cd32){return _0x39cd32[_0x1726('0x26')](_0x9f6523)['then'](function(_0x534534){return _0x534534;});}return null;};}function removeEntity(_0xa7cd46,_0x3f4498){return function(_0x4a1ec2){if(_0x4a1ec2){return _0x4a1ec2[_0x1726('0x27')]()['then'](function(){_0xa7cd46[_0x1726('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b76f,_0x538df1){return function(_0x3ff7f7){if(!_0x3ff7f7){_0x57b76f[_0x1726('0x1c')](0x194);}return _0x3ff7f7;};}function handleError(_0xff2462,_0x305a1f){_0x305a1f=_0x305a1f||0x1f4;return function(_0x28be2a){logger[_0x1726('0x28')](_0x28be2a[_0x1726('0x29')]);if(_0x28be2a[_0x1726('0x2a')]){delete _0x28be2a['name'];}_0xff2462[_0x1726('0x21')](_0x305a1f)[_0x1726('0x2b')](_0x28be2a);};}exports[_0x1726('0x2c')]=function(_0x1c0e32,_0x1505ba){var _0x11ffbe={},_0x59e148={},_0x1b4eb7={'count':0x0,'rows':[]};var _0x11b9f2=_[_0x1726('0x2d')](db[_0x1726('0x2e')][_0x1726('0x2f')],function(_0x267620){return{'name':_0x267620['fieldName'],'type':_0x267620[_0x1726('0x30')][_0x1726('0x31')]};});_0x59e148[_0x1726('0x32')]=_['map'](_0x11b9f2,'name');_0x59e148[_0x1726('0x33')]=_[_0x1726('0x34')](_0x1c0e32[_0x1726('0x33')]);_0x59e148[_0x1726('0x35')]=_[_0x1726('0x36')](_0x59e148[_0x1726('0x32')],_0x59e148[_0x1726('0x33')]);_0x11ffbe[_0x1726('0x37')]=_['intersection'](_0x59e148[_0x1726('0x32')],qs['fields'](_0x1c0e32[_0x1726('0x33')][_0x1726('0x38')]));_0x11ffbe[_0x1726('0x37')]=_0x11ffbe[_0x1726('0x37')][_0x1726('0x39')]?_0x11ffbe[_0x1726('0x37')]:_0x59e148[_0x1726('0x32')];if(!_0x1c0e32['query'][_0x1726('0x3a')](_0x1726('0x3b'))){_0x11ffbe[_0x1726('0x20')]=qs['limit'](_0x1c0e32[_0x1726('0x33')][_0x1726('0x20')]);_0x11ffbe[_0x1726('0x1f')]=qs[_0x1726('0x1f')](_0x1c0e32[_0x1726('0x33')][_0x1726('0x1f')]);}_0x11ffbe['order']=qs['sort'](_0x1c0e32[_0x1726('0x33')][_0x1726('0x3c')]);_0x11ffbe['where']=qs[_0x1726('0x35')](_[_0x1726('0x3d')](_0x1c0e32[_0x1726('0x33')],_0x59e148[_0x1726('0x35')]),_0x11b9f2);if(_0x1c0e32[_0x1726('0x33')][_0x1726('0x3e')]){_0x11ffbe[_0x1726('0x3f')]=_[_0x1726('0x40')](_0x11ffbe[_0x1726('0x3f')],{'$or':_['map'](_0x11b9f2,function(_0x37700b){if(_0x37700b[_0x1726('0x30')]!==_0x1726('0x41')){var _0x448f1e={};_0x448f1e[_0x37700b['name']]={'$like':'%'+_0x1c0e32[_0x1726('0x33')][_0x1726('0x3e')]+'%'};return _0x448f1e;}})});}_0x11ffbe=_[_0x1726('0x40')]({},_0x11ffbe,_0x1c0e32[_0x1726('0x42')]);var _0x272bba={'where':_0x11ffbe[_0x1726('0x3f')]};return db[_0x1726('0x2e')][_0x1726('0x43')](_0x272bba)[_0x1726('0x44')](function(_0x11f964){_0x1b4eb7['count']=_0x11f964;if(_0x1c0e32[_0x1726('0x33')][_0x1726('0x45')]){_0x11ffbe[_0x1726('0x46')]=[{'all':!![]}];}return db[_0x1726('0x2e')][_0x1726('0x47')](_0x11ffbe);})[_0x1726('0x44')](function(_0xd980f9){_0x1b4eb7[_0x1726('0x48')]=_0xd980f9;return _0x1b4eb7;})['then'](respondWithFilteredResult(_0x1505ba,_0x11ffbe))[_0x1726('0x49')](handleError(_0x1505ba,null));};exports['show']=function(_0x124f4c,_0x4bddc8){var _0x49066e={'raw':![],'where':{'id':_0x124f4c[_0x1726('0x4a')]['id']}},_0x463181={};_0x463181[_0x1726('0x32')]=_[_0x1726('0x34')](db[_0x1726('0x2e')]['rawAttributes']);_0x463181['query']=_[_0x1726('0x34')](_0x124f4c[_0x1726('0x33')]);_0x463181['filters']=_['intersection'](_0x463181['model'],_0x463181[_0x1726('0x33')]);_0x49066e[_0x1726('0x37')]=_[_0x1726('0x36')](_0x463181[_0x1726('0x32')],qs[_0x1726('0x38')](_0x124f4c[_0x1726('0x33')][_0x1726('0x38')]));_0x49066e[_0x1726('0x37')]=_0x49066e['attributes'][_0x1726('0x39')]?_0x49066e['attributes']:_0x463181[_0x1726('0x32')];if(_0x124f4c[_0x1726('0x33')][_0x1726('0x45')]){_0x49066e[_0x1726('0x46')]=[{'all':!![]}];}_0x49066e=_[_0x1726('0x40')]({},_0x49066e,_0x124f4c['options']);return db[_0x1726('0x2e')][_0x1726('0x4b')](_0x49066e)[_0x1726('0x44')](handleEntityNotFound(_0x4bddc8,null))[_0x1726('0x44')](respondWithResult(_0x4bddc8,null))[_0x1726('0x49')](handleError(_0x4bddc8,null));};exports[_0x1726('0x4c')]=function(_0x1a4aa8,_0x430f6e){return db[_0x1726('0x2e')][_0x1726('0x4c')](_0x1a4aa8['body'],{})[_0x1726('0x44')](respondWithResult(_0x430f6e,0xc9))[_0x1726('0x49')](handleError(_0x430f6e,null));};exports[_0x1726('0x26')]=function(_0x17d664,_0x482613){if(_0x17d664[_0x1726('0x4d')]['id']){delete _0x17d664[_0x1726('0x4d')]['id'];}return db['UserProfileSection'][_0x1726('0x4b')]({'where':{'id':_0x17d664[_0x1726('0x4a')]['id']}})['then'](handleEntityNotFound(_0x482613,null))[_0x1726('0x44')](saveUpdates(_0x17d664['body'],null))['then'](respondWithResult(_0x482613,null))['catch'](handleError(_0x482613,null));};exports['destroy']=function(_0xd81fc5,_0x46ac2d){return db[_0x1726('0x2e')][_0x1726('0x4b')]({'where':{'id':_0xd81fc5['params']['id']}})[_0x1726('0x44')](handleEntityNotFound(_0x46ac2d,null))[_0x1726('0x44')](removeEntity(_0x46ac2d,null))[_0x1726('0x49')](handleError(_0x46ac2d,null));};exports[_0x1726('0x4e')]=function(_0x14ce4b,_0x5ca894){return db['UserProfileSection'][_0x1726('0x4e')]()[_0x1726('0x44')](respondWithResult(_0x5ca894,null))['catch'](handleError(_0x5ca894,null));}; \ No newline at end of file +var _0x37c1=['send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','length','model','order','sort','filters','pick','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','squel','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','name'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x37c1,0x120));var _0x137c=function(_0x480834,_0x2fbcee){_0x480834=_0x480834-0x0;var _0x33aab2=_0x37c1[_0x480834];return _0x33aab2;};'use strict';var pdf=require(_0x137c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x137c('0x1'));var jsonpatch=require(_0x137c('0x2'));var rp=require(_0x137c('0x3'));var moment=require('moment');var BPromise=require(_0x137c('0x4'));var Mustache=require('mustache');var util=require(_0x137c('0x5'));var path=require('path');var sox=require(_0x137c('0x6'));var csv=require(_0x137c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x137c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x137c('0x7'));var querystring=require(_0x137c('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x137c('0xa'));var as=require(_0x137c('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x137c('0xc'))(_0x137c('0xd'));var utils=require(_0x137c('0xe'));var config=require(_0x137c('0xf'));var licenseUtil=require(_0x137c('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14f4ac,_0x48f5ed){_0x48f5ed=_0x48f5ed||0xcc;return function(_0x138a44){if(_0x138a44){return _0x14f4ac[_0x137c('0x11')](_0x48f5ed);}return _0x14f4ac[_0x137c('0x12')](_0x48f5ed)[_0x137c('0x13')]();};}function respondWithResult(_0x2dd5a5,_0xee689b){_0xee689b=_0xee689b||0xc8;return function(_0x10cb76){if(_0x10cb76){return _0x2dd5a5['status'](_0xee689b)['json'](_0x10cb76);}};}function respondWithFilteredResult(_0x37f203,_0x2e6966){return function(_0x54f641){if(_0x54f641){var _0x19c92c=_0x54f641[_0x137c('0x14')],_0xc45abf=_0x2e6966[_0x137c('0x15')],_0x4a4f47=_0x2e6966[_0x137c('0x15')]+_0x2e6966[_0x137c('0x16')],_0xad8868;if(_0x4a4f47>=_0x19c92c){_0x4a4f47=_0x19c92c;_0xad8868=0xc8;}else{_0xad8868=0xce;}_0x37f203[_0x137c('0x12')](_0xad8868);return _0x37f203[_0x137c('0x17')](_0x137c('0x18'),_0xc45abf+'-'+_0x4a4f47+'/'+_0x19c92c)[_0x137c('0x19')](_0x54f641);}return null;};}function patchUpdates(_0x36bed4){return function(_0xb57995){try{jsonpatch['apply'](_0xb57995,_0x36bed4,!![]);}catch(_0x378033){return BPromise[_0x137c('0x1a')](_0x378033);}return _0xb57995[_0x137c('0x1b')]();};}function saveUpdates(_0x2bb3b4,_0x2db7a5){return function(_0x3423d5){if(_0x3423d5){return _0x3423d5['update'](_0x2bb3b4)[_0x137c('0x1c')](function(_0x701c76){return _0x701c76;});}return null;};}function removeEntity(_0x1b64c6,_0x214382){return function(_0x35b0df){if(_0x35b0df){return _0x35b0df[_0x137c('0x1d')]()['then'](function(){_0x1b64c6[_0x137c('0x12')](0xcc)[_0x137c('0x13')]();});}};}function handleEntityNotFound(_0x226b3c,_0x1ccee4){return function(_0x321677){if(!_0x321677){_0x226b3c[_0x137c('0x11')](0x194);}return _0x321677;};}function handleError(_0x37f9ef,_0x1cc6fc){_0x1cc6fc=_0x1cc6fc||0x1f4;return function(_0x2464c8){logger[_0x137c('0x1e')](_0x2464c8['stack']);if(_0x2464c8[_0x137c('0x1f')]){delete _0x2464c8['name'];}_0x37f9ef[_0x137c('0x12')](_0x1cc6fc)[_0x137c('0x20')](_0x2464c8);};}exports[_0x137c('0x21')]=function(_0x3b8db2,_0x732aba){var _0x2aac4d={},_0x18178f={},_0x47e707={'count':0x0,'rows':[]};var _0x48c7f9=_[_0x137c('0x22')](db[_0x137c('0x23')][_0x137c('0x24')],function(_0x180a86){return{'name':_0x180a86[_0x137c('0x25')],'type':_0x180a86[_0x137c('0x26')][_0x137c('0x27')]};});_0x18178f['model']=_[_0x137c('0x22')](_0x48c7f9,_0x137c('0x1f'));_0x18178f[_0x137c('0x28')]=_[_0x137c('0x29')](_0x3b8db2[_0x137c('0x28')]);_0x18178f['filters']=_[_0x137c('0x2a')](_0x18178f['model'],_0x18178f[_0x137c('0x28')]);_0x2aac4d['attributes']=_[_0x137c('0x2a')](_0x18178f['model'],qs[_0x137c('0x2b')](_0x3b8db2[_0x137c('0x28')]['fields']));_0x2aac4d[_0x137c('0x2c')]=_0x2aac4d[_0x137c('0x2c')][_0x137c('0x2d')]?_0x2aac4d[_0x137c('0x2c')]:_0x18178f[_0x137c('0x2e')];if(!_0x3b8db2[_0x137c('0x28')]['hasOwnProperty']('nolimit')){_0x2aac4d[_0x137c('0x16')]=qs[_0x137c('0x16')](_0x3b8db2['query']['limit']);_0x2aac4d[_0x137c('0x15')]=qs[_0x137c('0x15')](_0x3b8db2[_0x137c('0x28')]['offset']);}_0x2aac4d[_0x137c('0x2f')]=qs[_0x137c('0x30')](_0x3b8db2[_0x137c('0x28')][_0x137c('0x30')]);_0x2aac4d['where']=qs[_0x137c('0x31')](_[_0x137c('0x32')](_0x3b8db2['query'],_0x18178f[_0x137c('0x31')]),_0x48c7f9);if(_0x3b8db2[_0x137c('0x28')]['filter']){_0x2aac4d[_0x137c('0x33')]=_['merge'](_0x2aac4d[_0x137c('0x33')],{'$or':_[_0x137c('0x22')](_0x48c7f9,function(_0x22c229){if(_0x22c229[_0x137c('0x26')]!==_0x137c('0x34')){var _0x11d408={};_0x11d408[_0x22c229[_0x137c('0x1f')]]={'$like':'%'+_0x3b8db2[_0x137c('0x28')]['filter']+'%'};return _0x11d408;}})});}_0x2aac4d=_[_0x137c('0x35')]({},_0x2aac4d,_0x3b8db2[_0x137c('0x36')]);var _0x5474a5={'where':_0x2aac4d['where']};return db[_0x137c('0x23')][_0x137c('0x14')](_0x5474a5)[_0x137c('0x1c')](function(_0x30e4e6){_0x47e707[_0x137c('0x14')]=_0x30e4e6;if(_0x3b8db2[_0x137c('0x28')][_0x137c('0x37')]){_0x2aac4d['include']=[{'all':!![]}];}return db[_0x137c('0x23')][_0x137c('0x38')](_0x2aac4d);})[_0x137c('0x1c')](function(_0x3a8277){_0x47e707[_0x137c('0x39')]=_0x3a8277;return _0x47e707;})[_0x137c('0x1c')](respondWithFilteredResult(_0x732aba,_0x2aac4d))[_0x137c('0x3a')](handleError(_0x732aba,null));};exports['show']=function(_0x4fdfd3,_0x46f19d){var _0x1048c1={'raw':![],'where':{'id':_0x4fdfd3[_0x137c('0x3b')]['id']}},_0x407e75={};_0x407e75[_0x137c('0x2e')]=_[_0x137c('0x29')](db[_0x137c('0x23')]['rawAttributes']);_0x407e75[_0x137c('0x28')]=_['keys'](_0x4fdfd3[_0x137c('0x28')]);_0x407e75[_0x137c('0x31')]=_['intersection'](_0x407e75['model'],_0x407e75[_0x137c('0x28')]);_0x1048c1['attributes']=_['intersection'](_0x407e75['model'],qs[_0x137c('0x2b')](_0x4fdfd3[_0x137c('0x28')][_0x137c('0x2b')]));_0x1048c1[_0x137c('0x2c')]=_0x1048c1[_0x137c('0x2c')][_0x137c('0x2d')]?_0x1048c1[_0x137c('0x2c')]:_0x407e75[_0x137c('0x2e')];if(_0x4fdfd3['query'][_0x137c('0x37')]){_0x1048c1['include']=[{'all':!![]}];}_0x1048c1=_[_0x137c('0x35')]({},_0x1048c1,_0x4fdfd3['options']);return db[_0x137c('0x23')][_0x137c('0x3c')](_0x1048c1)['then'](handleEntityNotFound(_0x46f19d,null))[_0x137c('0x1c')](respondWithResult(_0x46f19d,null))[_0x137c('0x3a')](handleError(_0x46f19d,null));};exports[_0x137c('0x3d')]=function(_0x2aeda7,_0x4e0a66){return db['UserProfileSection'][_0x137c('0x3d')](_0x2aeda7[_0x137c('0x3e')],{})[_0x137c('0x1c')](respondWithResult(_0x4e0a66,0xc9))[_0x137c('0x3a')](handleError(_0x4e0a66,null));};exports['update']=function(_0x143095,_0x476820){if(_0x143095['body']['id']){delete _0x143095[_0x137c('0x3e')]['id'];}return db[_0x137c('0x23')][_0x137c('0x3c')]({'where':{'id':_0x143095['params']['id']}})[_0x137c('0x1c')](handleEntityNotFound(_0x476820,null))[_0x137c('0x1c')](saveUpdates(_0x143095[_0x137c('0x3e')],null))[_0x137c('0x1c')](respondWithResult(_0x476820,null))[_0x137c('0x3a')](handleError(_0x476820,null));};exports[_0x137c('0x1d')]=function(_0x22999b,_0x24babd){return db[_0x137c('0x23')][_0x137c('0x3c')]({'where':{'id':_0x22999b[_0x137c('0x3b')]['id']}})[_0x137c('0x1c')](handleEntityNotFound(_0x24babd,null))[_0x137c('0x1c')](removeEntity(_0x24babd,null))[_0x137c('0x3a')](handleError(_0x24babd,null));};exports[_0x137c('0x3f')]=function(_0x277315,_0x53236c){return db[_0x137c('0x23')][_0x137c('0x3f')]()[_0x137c('0x1c')](respondWithResult(_0x53236c,null))['catch'](handleError(_0x53236c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3d477d1..0f38b1f 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 _0x44d4=['UserProfileSection','compositeIndex','userProfileId','lodash','moment','bluebird','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x1d65dc,_0x1ba30d){var _0x564ddd=function(_0x370b0e){while(--_0x370b0e){_0x1d65dc['push'](_0x1d65dc['shift']());}};_0x564ddd(++_0x1ba30d);}(_0x44d4,0x161));var _0x444d=function(_0x1b8b87,_0x33eb40){_0x1b8b87=_0x1b8b87-0x0;var _0x34b03f=_0x44d4[_0x1b8b87];return _0x34b03f;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x444d('0x1'));var BPromise=require(_0x444d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x444d('0x3'));var attributes=require(_0x444d('0x4'));module[_0x444d('0x5')]=function(_0x24f601,_0x45dfdb){return _0x24f601[_0x444d('0x6')](_0x444d('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x444d('0x8'),'fields':['sectionId',_0x444d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b93=['sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections'];(function(_0x13be43,_0x1261e8){var _0x2b5d2f=function(_0x4a979f){while(--_0x4a979f){_0x13be43['push'](_0x13be43['shift']());}};_0x2b5d2f(++_0x1261e8);}(_0x3b93,0x92));var _0x33b9=function(_0x21a3f0,_0x155071){_0x21a3f0=_0x21a3f0-0x0;var _0x289209=_0x3b93[_0x21a3f0];return _0x289209;};'use strict';var _=require('lodash');var util=require(_0x33b9('0x0'));var logger=require(_0x33b9('0x1'))(_0x33b9('0x2'));var moment=require(_0x33b9('0x3'));var BPromise=require(_0x33b9('0x4'));var rp=require(_0x33b9('0x5'));var fs=require('fs');var path=require(_0x33b9('0x6'));var rimraf=require(_0x33b9('0x7'));var config=require(_0x33b9('0x8'));var attributes=require(_0x33b9('0x9'));module[_0x33b9('0xa')]=function(_0x51d85c,_0x1ab793){return _0x51d85c[_0x33b9('0xb')](_0x33b9('0xc'),attributes,{'tableName':_0x33b9('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x33b9('0xe'),_0x33b9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3d2d3ee..fdb5e5a 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 _0xdd03=['catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd03,0xe5));var _0x3dd0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdd03[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3dd0('0x0'));var rs=require(_0x3dd0('0x1'));var fs=require('fs');var Redis=require(_0x3dd0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dd0('0x3'));var logger=require(_0x3dd0('0x4'))('rpc');var config=require(_0x3dd0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3dd0('0x6')][_0x3dd0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fa16b,_0x3cdc82,_0x189431){return new BPromise(function(_0x9e8531,_0xf9d231){return client[_0x3dd0('0x8')](_0x3fa16b,_0x189431)[_0x3dd0('0x9')](function(_0x4d4a4b){logger[_0x3dd0('0xa')](_0x3dd0('0xb'),_0x3cdc82,_0x3dd0('0xc'));logger['debug'](_0x3dd0('0xd'),_0x3cdc82,_0x3dd0('0xc'),JSON[_0x3dd0('0xe')](_0x4d4a4b));if(_0x4d4a4b[_0x3dd0('0xf')]){if(_0x4d4a4b[_0x3dd0('0xf')]['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x3cdc82,_0x4d4a4b[_0x3dd0('0xf')]['message']);return _0xf9d231(_0x4d4a4b[_0x3dd0('0xf')]['message']);}logger[_0x3dd0('0xf')](_0x3dd0('0xb'),_0x3cdc82,_0x4d4a4b[_0x3dd0('0xf')]['message']);return _0x9e8531(_0x4d4a4b[_0x3dd0('0xf')][_0x3dd0('0x10')]);}else{logger[_0x3dd0('0xa')](_0x3dd0('0xb'),_0x3cdc82,_0x3dd0('0xc'));_0x9e8531(_0x4d4a4b[_0x3dd0('0x11')][_0x3dd0('0x10')]);}})[_0x3dd0('0x12')](function(_0x388ab7){logger[_0x3dd0('0xf')](_0x3dd0('0xb'),_0x3cdc82,_0x388ab7);_0xf9d231(_0x388ab7);});});} \ No newline at end of file +var _0xe636=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20295d,_0x562a65){var _0x4e524c=function(_0x5f1ffd){while(--_0x5f1ffd){_0x20295d['push'](_0x20295d['shift']());}};_0x4e524c(++_0x562a65);}(_0xe636,0x16d));var _0x6e63=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xe636[_0x36909d];return _0x1fd29d;};'use strict';var _=require(_0x6e63('0x0'));var util=require(_0x6e63('0x1'));var moment=require('moment');var BPromise=require(_0x6e63('0x2'));var rs=require(_0x6e63('0x3'));var fs=require('fs');var Redis=require(_0x6e63('0x4'));var db=require(_0x6e63('0x5'))['db'];var utils=require(_0x6e63('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6e63('0x7'));var client=jayson[_0x6e63('0x8')][_0x6e63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x677089,_0x33c842,_0x36d4ce){return new BPromise(function(_0x15b438,_0x5558f6){return client[_0x6e63('0xa')](_0x677089,_0x36d4ce)['then'](function(_0x43fbc7){logger[_0x6e63('0xb')](_0x6e63('0xc'),_0x33c842,_0x6e63('0xd'));logger[_0x6e63('0xe')](_0x6e63('0xf'),_0x33c842,_0x6e63('0xd'),JSON[_0x6e63('0x10')](_0x43fbc7));if(_0x43fbc7[_0x6e63('0x11')]){if(_0x43fbc7[_0x6e63('0x11')]['code']===0x1f4){logger[_0x6e63('0x11')](_0x6e63('0xc'),_0x33c842,_0x43fbc7['error']['message']);return _0x5558f6(_0x43fbc7['error'][_0x6e63('0x12')]);}logger['error'](_0x6e63('0xc'),_0x33c842,_0x43fbc7[_0x6e63('0x11')][_0x6e63('0x12')]);return _0x15b438(_0x43fbc7[_0x6e63('0x11')]['message']);}else{logger[_0x6e63('0xb')](_0x6e63('0xc'),_0x33c842,_0x6e63('0xd'));_0x15b438(_0x43fbc7['result'][_0x6e63('0x12')]);}})[_0x6e63('0x13')](function(_0x5a9570){logger[_0x6e63('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x33c842,_0x5a9570);_0x5558f6(_0x5a9570);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a8f8337..31fc578 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 _0xa919=['Router','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x54a92d,_0x2a4edc){var _0x37fd93=function(_0x3d650e){while(--_0x3d650e){_0x54a92d['push'](_0x54a92d['shift']());}};_0x37fd93(++_0x2a4edc);}(_0xa919,0x1ae));var _0x9a91=function(_0x3bcda9,_0x277f01){_0x3bcda9=_0x3bcda9-0x0;var _0x54991f=_0xa919[_0x3bcda9];return _0x54991f;};'use strict';var multer=require('multer');var util=require(_0x9a91('0x0'));var path=require(_0x9a91('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a91('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a91('0x3'));var config=require(_0x9a91('0x4'));module[_0x9a91('0x5')]=router; \ No newline at end of file +var _0x8b5b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path'];(function(_0x41ea77,_0x6e8b59){var _0x5fe88a=function(_0x173211){while(--_0x173211){_0x41ea77['push'](_0x41ea77['shift']());}};_0x5fe88a(++_0x6e8b59);}(_0x8b5b,0x137));var _0xb8b5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8b5b[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8b5('0x0'));var timeout=require(_0xb8b5('0x1'));var express=require(_0xb8b5('0x2'));var router=express[_0xb8b5('0x3')]();var auth=require(_0xb8b5('0x4'));var interaction=require(_0xb8b5('0x5'));var config=require(_0xb8b5('0x6'));module[_0xb8b5('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 ae5d14a..5986abf 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 _0xbaf0=['exports','INTEGER'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x10a631,_0x55ff30){var _0x3b284b=function(_0x4b20d5){while(--_0x4b20d5){_0x10a631['push'](_0x10a631['shift']());}};_0x3b284b(++_0x55ff30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 17574f2..5cf365a 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 _0x9b7d=['user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x36acf3,_0x53c155){var _0x420330=function(_0x300835){while(--_0x300835){_0x36acf3['push'](_0x36acf3['shift']());}};_0x420330(++_0x53c155);}(_0x9b7d,0xde));var _0xd9b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9b7d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xd9b7('0x0'));var logger=require(_0xd9b7('0x1'))(_0xd9b7('0x2'));var moment=require('moment');var BPromise=require(_0xd9b7('0x3'));var rp=require(_0xd9b7('0x4'));var fs=require('fs');var path=require(_0xd9b7('0x5'));var rimraf=require(_0xd9b7('0x6'));var config=require(_0xd9b7('0x7'));var attributes=require(_0xd9b7('0x8'));module[_0xd9b7('0x9')]=function(_0x2bfcc9,_0x1d7607){return _0x2bfcc9[_0xd9b7('0xa')](_0xd9b7('0xb'),attributes,{'tableName':_0xd9b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2494=['UserSmsQueue','lodash','util','api','moment','bluebird','request-promise','path','./userSmsQueue.attributes','exports','define'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x2494,0x85));var _0x4249=function(_0x254fd7,_0x942322){_0x254fd7=_0x254fd7-0x0;var _0xdfd77f=_0x2494[_0x254fd7];return _0xdfd77f;};'use strict';var _=require(_0x4249('0x0'));var util=require(_0x4249('0x1'));var logger=require('../../config/logger')(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module[_0x4249('0x8')]=function(_0x106758,_0xf5fec9){return _0x106758[_0x4249('0x9')](_0x4249('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index cdce78c..9684be1 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 _0x6a18=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6a18,0xf7));var _0x86a1=function(_0x16e652,_0x24250e){_0x16e652=_0x16e652-0x0;var _0x27d312=_0x6a18[_0x16e652];return _0x27d312;};'use strict';var _=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var moment=require(_0x86a1('0x2'));var BPromise=require(_0x86a1('0x3'));var rs=require(_0x86a1('0x4'));var fs=require('fs');var Redis=require(_0x86a1('0x5'));var db=require(_0x86a1('0x6'))['db'];var utils=require(_0x86a1('0x7'));var logger=require(_0x86a1('0x8'))(_0x86a1('0x9'));var config=require('../../config/environment');var jayson=require(_0x86a1('0xa'));var client=jayson['client'][_0x86a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c670f,_0x2dd88b,_0x195c46){return new BPromise(function(_0xbaeefb,_0x312845){return client[_0x86a1('0xc')](_0x3c670f,_0x195c46)[_0x86a1('0xd')](function(_0x1e7018){logger[_0x86a1('0xe')](_0x86a1('0xf'),_0x2dd88b,_0x86a1('0x10'));logger['debug'](_0x86a1('0x11'),_0x2dd88b,_0x86a1('0x10'),JSON[_0x86a1('0x12')](_0x1e7018));if(_0x1e7018['error']){if(_0x1e7018[_0x86a1('0x13')][_0x86a1('0x14')]===0x1f4){logger[_0x86a1('0x13')](_0x86a1('0xf'),_0x2dd88b,_0x1e7018['error'][_0x86a1('0x15')]);return _0x312845(_0x1e7018[_0x86a1('0x13')]['message']);}logger[_0x86a1('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2dd88b,_0x1e7018[_0x86a1('0x13')]['message']);return _0xbaeefb(_0x1e7018[_0x86a1('0x13')][_0x86a1('0x15')]);}else{logger['info'](_0x86a1('0xf'),_0x2dd88b,_0x86a1('0x10'));_0xbaeefb(_0x1e7018[_0x86a1('0x16')]['message']);}})[_0x86a1('0x17')](function(_0x15a425){logger[_0x86a1('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2dd88b,_0x15a425);_0x312845(_0x15a425);});});} \ No newline at end of file +var _0x295a=['UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x163555,_0x27ce78){var _0x250307=function(_0x27c529){while(--_0x27c529){_0x163555['push'](_0x163555['shift']());}};_0x250307(++_0x27ce78);}(_0x295a,0x155));var _0xa295=function(_0x581cbd,_0x387b1c){_0x581cbd=_0x581cbd-0x0;var _0x32d9d1=_0x295a[_0x581cbd];return _0x32d9d1;};'use strict';var _=require('lodash');var util=require(_0xa295('0x0'));var moment=require('moment');var BPromise=require(_0xa295('0x1'));var rs=require(_0xa295('0x2'));var fs=require('fs');var Redis=require(_0xa295('0x3'));var db=require(_0xa295('0x4'))['db'];var utils=require(_0xa295('0x5'));var logger=require(_0xa295('0x6'))(_0xa295('0x7'));var config=require(_0xa295('0x8'));var jayson=require(_0xa295('0x9'));var client=jayson[_0xa295('0xa')][_0xa295('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a58c1,_0x4bce79,_0x149a31){return new BPromise(function(_0x46d9ce,_0x551767){return client[_0xa295('0xc')](_0x1a58c1,_0x149a31)[_0xa295('0xd')](function(_0x28e649){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4bce79,_0xa295('0xe'));logger['debug'](_0xa295('0xf'),_0x4bce79,'request\x20sent',JSON[_0xa295('0x10')](_0x28e649));if(_0x28e649[_0xa295('0x11')]){if(_0x28e649[_0xa295('0x11')][_0xa295('0x12')]===0x1f4){logger['error'](_0xa295('0x13'),_0x4bce79,_0x28e649['error'][_0xa295('0x14')]);return _0x551767(_0x28e649[_0xa295('0x11')][_0xa295('0x14')]);}logger[_0xa295('0x11')](_0xa295('0x13'),_0x4bce79,_0x28e649[_0xa295('0x11')]['message']);return _0x46d9ce(_0x28e649['error']['message']);}else{logger[_0xa295('0x15')](_0xa295('0x13'),_0x4bce79,_0xa295('0xe'));_0x46d9ce(_0x28e649[_0xa295('0x16')]['message']);}})[_0xa295('0x17')](function(_0x147c0b){logger['error'](_0xa295('0x13'),_0x4bce79,_0x147c0b);_0x551767(_0x147c0b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 300ffe7..8ae2ec0 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 _0xe2af=['../../components/interaction/service','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe2af,0x6a));var _0xfe2a=function(_0xb80f79,_0x37a929){_0xb80f79=_0xb80f79-0x0;var _0x2cbfbf=_0xe2af[_0xb80f79];return _0x2cbfbf;};'use strict';var multer=require('multer');var util=require(_0xfe2a('0x0'));var path=require(_0xfe2a('0x1'));var timeout=require(_0xfe2a('0x2'));var express=require(_0xfe2a('0x3'));var router=express[_0xfe2a('0x4')]();var auth=require(_0xfe2a('0x5'));var interaction=require(_0xfe2a('0x6'));var config=require('../../config/environment');module[_0xfe2a('0x7')]=router; \ No newline at end of file +var _0xe9b5=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x296edf,_0x57171a){var _0x51e7e4=function(_0x31be0e){while(--_0x31be0e){_0x296edf['push'](_0x296edf['shift']());}};_0x51e7e4(++_0x57171a);}(_0xe9b5,0x104));var _0x5e9b=function(_0x2edfd8,_0x455f56){_0x2edfd8=_0x2edfd8-0x0;var _0x5b38c9=_0xe9b5[_0x2edfd8];return _0x5b38c9;};'use strict';var multer=require(_0x5e9b('0x0'));var util=require(_0x5e9b('0x1'));var path=require(_0x5e9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e9b('0x3'));var router=express[_0x5e9b('0x4')]();var auth=require(_0x5e9b('0x5'));var interaction=require(_0x5e9b('0x6'));var config=require(_0x5e9b('0x7'));module[_0x5e9b('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 87921d4..ad824a3 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x1cdf3e,_0x47519d){var _0xdecdf=function(_0x4ea7cf){while(--_0x4ea7cf){_0x1cdf3e['push'](_0x1cdf3e['shift']());}};_0xdecdf(++_0x47519d);}(_0xe706,0xa3));var _0x6e70=function(_0x4b8b21,_0x1a910b){_0x4b8b21=_0x4b8b21-0x0;var _0xeb8cc1=_0xe706[_0x4b8b21];return _0xeb8cc1;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3ad497,_0x1285d3){var _0x39a541=function(_0x3dff59){while(--_0x3dff59){_0x3ad497['push'](_0x3ad497['shift']());}};_0x39a541(++_0x1285d3);}(_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')]={'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 c55e225..566c855 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x8de0ff,_0xfa5d8f){var _0x41599e=function(_0xffdaf1){while(--_0xffdaf1){_0x8de0ff['push'](_0x8de0ff['shift']());}};_0x41599e(++_0xfa5d8f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xcf69e4,_0x22359f){_0xcf69e4=_0xcf69e4-0x0;var _0x3ae183=_0xf3cd[_0xcf69e4];return _0x3ae183;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcca7=['request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x2ff51e,_0x327cdf){var _0x603124=function(_0x106aab){while(--_0x106aab){_0x2ff51e['push'](_0x2ff51e['shift']());}};_0x603124(++_0x327cdf);}(_0xcca7,0x1aa));var _0x7cca=function(_0x526408,_0x585982){_0x526408=_0x526408-0x0;var _0x3f66e3=_0xcca7[_0x526408];return _0x3f66e3;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('UserVoiceQueue',attributes,{'tableName':_0x7cca('0x9'),'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 9cce94c..3e77d65 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 _0xc308=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x28add2,_0x4136cf){var _0x209a82=function(_0x340eac){while(--_0x340eac){_0x28add2['push'](_0x28add2['shift']());}};_0x209a82(++_0x4136cf);}(_0xc308,0x1af));var _0x8c30=function(_0x23fd09,_0x51c74c){_0x23fd09=_0x23fd09-0x0;var _0x5d8176=_0xc308[_0x23fd09];return _0x5d8176;};'use strict';var _=require(_0x8c30('0x0'));var util=require('util');var moment=require(_0x8c30('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c30('0x2'));var fs=require('fs');var Redis=require(_0x8c30('0x3'));var db=require(_0x8c30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c30('0x5'))(_0x8c30('0x6'));var config=require(_0x8c30('0x7'));var jayson=require(_0x8c30('0x8'));var client=jayson[_0x8c30('0x9')][_0x8c30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165415,_0x2eec89,_0x24c3b7){return new BPromise(function(_0x202404,_0x482b8f){return client[_0x8c30('0xb')](_0x165415,_0x24c3b7)[_0x8c30('0xc')](function(_0x3f3122){logger[_0x8c30('0xd')](_0x8c30('0xe'),_0x2eec89,_0x8c30('0xf'));logger[_0x8c30('0x10')](_0x8c30('0x11'),_0x2eec89,_0x8c30('0xf'),JSON[_0x8c30('0x12')](_0x3f3122));if(_0x3f3122[_0x8c30('0x13')]){if(_0x3f3122[_0x8c30('0x13')]['code']===0x1f4){logger[_0x8c30('0x13')](_0x8c30('0xe'),_0x2eec89,_0x3f3122['error'][_0x8c30('0x14')]);return _0x482b8f(_0x3f3122[_0x8c30('0x13')][_0x8c30('0x14')]);}logger[_0x8c30('0x13')](_0x8c30('0xe'),_0x2eec89,_0x3f3122[_0x8c30('0x13')][_0x8c30('0x14')]);return _0x202404(_0x3f3122['error']['message']);}else{logger['info'](_0x8c30('0xe'),_0x2eec89,_0x8c30('0xf'));_0x202404(_0x3f3122[_0x8c30('0x15')]['message']);}})['catch'](function(_0x3b5468){logger['error'](_0x8c30('0xe'),_0x2eec89,_0x3b5468);_0x482b8f(_0x3b5468);});});} \ No newline at end of file +var _0x3caa=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x1a2455,_0xdaa32e){var _0xd2286c=function(_0x1427b2){while(--_0x1427b2){_0x1a2455['push'](_0x1a2455['shift']());}};_0xd2286c(++_0xdaa32e);}(_0x3caa,0x15d));var _0xa3ca=function(_0x5b46f2,_0x25f16a){_0x5b46f2=_0x5b46f2-0x0;var _0x95b3f7=_0x3caa[_0x5b46f2];return _0x95b3f7;};'use strict';var _=require(_0xa3ca('0x0'));var util=require(_0xa3ca('0x1'));var moment=require(_0xa3ca('0x2'));var BPromise=require(_0xa3ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3ca('0x4'));var db=require(_0xa3ca('0x5'))['db'];var utils=require(_0xa3ca('0x6'));var logger=require(_0xa3ca('0x7'))(_0xa3ca('0x8'));var config=require(_0xa3ca('0x9'));var jayson=require(_0xa3ca('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c6dab,_0x413570,_0x4fbf0a){return new BPromise(function(_0x3c6f32,_0x58f6a4){return client[_0xa3ca('0xb')](_0x1c6dab,_0x4fbf0a)[_0xa3ca('0xc')](function(_0x456ccf){logger[_0xa3ca('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x413570,_0xa3ca('0xe'));logger[_0xa3ca('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x413570,_0xa3ca('0xe'),JSON[_0xa3ca('0x10')](_0x456ccf));if(_0x456ccf[_0xa3ca('0x11')]){if(_0x456ccf[_0xa3ca('0x11')][_0xa3ca('0x12')]===0x1f4){logger[_0xa3ca('0x11')](_0xa3ca('0x13'),_0x413570,_0x456ccf[_0xa3ca('0x11')][_0xa3ca('0x14')]);return _0x58f6a4(_0x456ccf[_0xa3ca('0x11')][_0xa3ca('0x14')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x413570,_0x456ccf['error'][_0xa3ca('0x14')]);return _0x3c6f32(_0x456ccf[_0xa3ca('0x11')]['message']);}else{logger[_0xa3ca('0xd')](_0xa3ca('0x13'),_0x413570,_0xa3ca('0xe'));_0x3c6f32(_0x456ccf[_0xa3ca('0x15')][_0xa3ca('0x14')]);}})['catch'](function(_0x54317c){logger[_0xa3ca('0x11')](_0xa3ca('0x13'),_0x413570,_0x54317c);_0x58f6a4(_0x54317c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 642db0e..58281cb 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 _0xf188=['Router','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0xc9dcd3,_0x592a48){var _0x45004c=function(_0x2078a4){while(--_0x2078a4){_0xc9dcd3['push'](_0xc9dcd3['shift']());}};_0x45004c(++_0x592a48);}(_0xf188,0xcf));var _0x8f18=function(_0xbc7161,_0x3aa13b){_0xbc7161=_0xbc7161-0x0;var _0xd45cb=_0xf188[_0xbc7161];return _0xd45cb;};'use strict';var multer=require(_0x8f18('0x0'));var util=require(_0x8f18('0x1'));var path=require(_0x8f18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8f18('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f18('0x4'));var config=require(_0x8f18('0x5'));module['exports']=router; \ No newline at end of file +var _0x48e3=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0x48e3,0x114));var _0x348e=function(_0x47cdda,_0x35c279){_0x47cdda=_0x47cdda-0x0;var _0x39abff=_0x48e3[_0x47cdda];return _0x39abff;};'use strict';var multer=require('multer');var util=require(_0x348e('0x0'));var path=require(_0x348e('0x1'));var timeout=require(_0x348e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x348e('0x3'));var interaction=require(_0x348e('0x4'));var config=require(_0x348e('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7662332..f63f95a 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 _0x57a0=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x57a0,0x152));var _0x057a=function(_0x11c4f9,_0x549780){_0x11c4f9=_0x11c4f9-0x0;var _0x2548eb=_0x57a0[_0x11c4f9];return _0x2548eb;};'use strict';var Sequelize=require(_0x057a('0x0'));module[_0x057a('0x1')]={'uniqueid':{'type':Sequelize[_0x057a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x057a('0x3')},'membername':{'type':Sequelize[_0x057a('0x4')],'allowNull':![],'comment':_0x057a('0x3')},'UserId':{'type':Sequelize[_0x057a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x057a('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x057a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x057a('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x057a('0x4')],'allowNull':![],'unique':_0x057a('0x5'),'comment':_0x057a('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x057a('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x057a('0x3')}}; \ No newline at end of file +var _0x46e0=['Required\x20by\x20Asterisk','sequelize','STRING','INTEGER','queue_interface'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0x46e0,0x196));var _0x046e=function(_0x289ab6,_0x39e50f){_0x289ab6=_0x289ab6-0x0;var _0x26863e=_0x46e0[_0x289ab6];return _0x26863e;};'use strict';var Sequelize=require(_0x046e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x046e('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x046e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x046e('0x1')],'allowNull':![],'unique':_0x046e('0x3'),'comment':_0x046e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x046e('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x046e('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x046e('0x2')](0xb),'defaultValue':0x0,'comment':_0x046e('0x4')},'paused':{'type':Sequelize[_0x046e('0x2')](0xb),'defaultValue':0x0,'comment':_0x046e('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d49b398..bfa792b 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 _0x514f=['hasOwnProperty','exports','UserVoiceQueueRt','setMaxListeners','update','remove','emit'];(function(_0x141564,_0x2d253b){var _0x45bf6b=function(_0x532676){while(--_0x532676){_0x141564['push'](_0x141564['shift']());}};_0x45bf6b(++_0x2d253b);}(_0x514f,0x10c));var _0xf514=function(_0x551f6e,_0x4b6328){_0x551f6e=_0x551f6e-0x0;var _0x422780=_0x514f[_0x551f6e];return _0x422780;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xf514('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf514('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf514('0x2'),'afterDestroy':_0xf514('0x3')};function emitEvent(_0x785191){return function(_0x1b6a05,_0x12f0c1,_0x39b472){UserVoiceQueueRtEvents[_0xf514('0x4')](_0x785191+':'+_0x1b6a05['id'],_0x1b6a05);UserVoiceQueueRtEvents[_0xf514('0x4')](_0x785191,_0x1b6a05);_0x39b472(null);};}for(var e in events){if(events[_0xf514('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xf514('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7a46=['events','UserVoiceQueueRt','update','remove','emit','hook','exports'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0x7a46,0x173));var _0x67a4=function(_0x5ab588,_0x419aba){_0x5ab588=_0x5ab588-0x0;var _0x539503=_0x7a46[_0x5ab588];return _0x539503;};'use strict';var EventEmitter=require(_0x67a4('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x67a4('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x67a4('0x2'),'afterDestroy':_0x67a4('0x3')};function emitEvent(_0x41b2ae){return function(_0x164ec4,_0x5c1eb4,_0x3de0c8){UserVoiceQueueRtEvents['emit'](_0x41b2ae+':'+_0x164ec4['id'],_0x164ec4);UserVoiceQueueRtEvents[_0x67a4('0x4')](_0x41b2ae,_0x164ec4);_0x3de0c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x67a4('0x5')](e,emitEvent(event));}}module[_0x67a4('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9b97ddb..f1a4c67 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 _0xa619=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','moment','path','./userVoiceQueueRt.attributes','define'];(function(_0x26fb86,_0x579070){var _0x2df8cb=function(_0x4ed846){while(--_0x4ed846){_0x26fb86['push'](_0x26fb86['shift']());}};_0x2df8cb(++_0x579070);}(_0xa619,0x14a));var _0x9a61=function(_0x1f72ae,_0x2cca35){_0x1f72ae=_0x1f72ae-0x0;var _0x33c1a1=_0xa619[_0x1f72ae];return _0x33c1a1;};'use strict';var _=require(_0x9a61('0x0'));var util=require(_0x9a61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a61('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a61('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9a61('0x4'));module['exports']=function(_0x1c2006,_0xb5e75e){return _0x1c2006[_0x9a61('0x5')](_0x9a61('0x6'),attributes,{'tableName':_0x9a61('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x314b=['bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x314b,0x96));var _0xb314=function(_0x282999,_0x4df660){_0x282999=_0x282999-0x0;var _0x30681f=_0x314b[_0x282999];return _0x30681f;};'use strict';var _=require(_0xb314('0x0'));var util=require('util');var logger=require(_0xb314('0x1'))(_0xb314('0x2'));var moment=require(_0xb314('0x3'));var BPromise=require(_0xb314('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb314('0x5'));var rimraf=require('rimraf');var config=require(_0xb314('0x6'));var attributes=require(_0xb314('0x7'));module['exports']=function(_0x5c14ab,_0x25bff4){return _0x5c14ab[_0xb314('0x8')](_0xb314('0x9'),attributes,{'tableName':_0xb314('0xa'),'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 6b690d9..3b5a19d 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 _0x88fc=['info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then'];(function(_0x4fd767,_0x25cdca){var _0x48e469=function(_0xec9baa){while(--_0xec9baa){_0x4fd767['push'](_0x4fd767['shift']());}};_0x48e469(++_0x25cdca);}(_0x88fc,0x100));var _0xc88f=function(_0xf0f683,_0x28fce1){_0xf0f683=_0xf0f683-0x0;var _0x465dee=_0x88fc[_0xf0f683];return _0x465dee;};'use strict';var _=require(_0xc88f('0x0'));var util=require(_0xc88f('0x1'));var moment=require(_0xc88f('0x2'));var BPromise=require(_0xc88f('0x3'));var rs=require(_0xc88f('0x4'));var fs=require('fs');var Redis=require(_0xc88f('0x5'));var db=require(_0xc88f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc88f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc88f('0x8')][_0xc88f('0x9')]({'port':0x232a});config[_0xc88f('0xa')]=_['defaults'](config[_0xc88f('0xa')],{'host':_0xc88f('0xb'),'port':0x18eb});var socket=require(_0xc88f('0xc'))(new Redis(config['redis']));require(_0xc88f('0xd'))[_0xc88f('0xe')](socket);function respondWithRpcPromise(_0x56bd3d,_0x241ee5,_0x37d29){return new BPromise(function(_0x1774c2,_0xa11650){return client['request'](_0x56bd3d,_0x37d29)[_0xc88f('0xf')](function(_0x112831){logger[_0xc88f('0x10')](_0xc88f('0x11'),_0x241ee5,_0xc88f('0x12'));logger[_0xc88f('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x241ee5,_0xc88f('0x12'),JSON[_0xc88f('0x14')](_0x112831));if(_0x112831[_0xc88f('0x15')]){if(_0x112831[_0xc88f('0x15')]['code']===0x1f4){logger[_0xc88f('0x15')](_0xc88f('0x11'),_0x241ee5,_0x112831['error']['message']);return _0xa11650(_0x112831[_0xc88f('0x15')][_0xc88f('0x16')]);}logger['error'](_0xc88f('0x11'),_0x241ee5,_0x112831[_0xc88f('0x15')][_0xc88f('0x16')]);return _0x1774c2(_0x112831[_0xc88f('0x15')]['message']);}else{logger[_0xc88f('0x10')](_0xc88f('0x11'),_0x241ee5,_0xc88f('0x12'));_0x1774c2(_0x112831[_0xc88f('0x17')][_0xc88f('0x16')]);}})[_0xc88f('0x18')](function(_0x29a67f){logger[_0xc88f('0x15')](_0xc88f('0x11'),_0x241ee5,_0x29a67f);_0xa11650(_0x29a67f);});});}exports[_0xc88f('0x19')]=function(_0x290926){var _0x570304=this;return new Promise(function(_0x11308b,_0x7525d1){return db[_0xc88f('0x1a')]['findAll']({'raw':_0x290926[_0xc88f('0x1b')]?_0x290926['options'][_0xc88f('0x1c')]===undefined?!![]:![]:!![],'where':_0x290926[_0xc88f('0x1b')]?_0x290926[_0xc88f('0x1b')][_0xc88f('0x1d')]||null:null,'attributes':[[db[_0xc88f('0x1e')]['fn'](_0xc88f('0x1f'),db[_0xc88f('0x1e')]['fn']('IF',db[_0xc88f('0x1e')]['literal'](_0xc88f('0x20')))),_0xc88f('0x21')]]})[_0xc88f('0xf')](function(_0x34d533){logger[_0xc88f('0x10')](_0xc88f('0x19'),_0x290926);logger[_0xc88f('0x13')]('GetVoiceQueueRtPauses',_0x290926,JSON[_0xc88f('0x14')](_0x34d533));_0x11308b(_0x34d533);})[_0xc88f('0x18')](function(_0x3aa47b){logger[_0xc88f('0x15')](_0xc88f('0x19'),_0x3aa47b[_0xc88f('0x16')],_0x290926);_0x7525d1(_0x570304[_0xc88f('0x15')](0x1f4,_0x3aa47b['message']));});});}; \ No newline at end of file +var _0xb0bc=['raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','then','catch','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','GetVoiceQueueRtPauses','options'];(function(_0x147fa5,_0x25d300){var _0x53bc5d=function(_0x579f73){while(--_0x579f73){_0x147fa5['push'](_0x147fa5['shift']());}};_0x53bc5d(++_0x25d300);}(_0xb0bc,0x82));var _0xcb0b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb0bc[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcb0b('0x0'));var BPromise=require('bluebird');var rs=require(_0xcb0b('0x1'));var fs=require('fs');var Redis=require(_0xcb0b('0x2'));var db=require(_0xcb0b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcb0b('0x4'));var config=require(_0xcb0b('0x5'));var jayson=require(_0xcb0b('0x6'));var client=jayson[_0xcb0b('0x7')]['http']({'port':0x232a});config[_0xcb0b('0x8')]=_[_0xcb0b('0x9')](config[_0xcb0b('0x8')],{'host':_0xcb0b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb0b('0x8')]));require(_0xcb0b('0xb'))[_0xcb0b('0xc')](socket);function respondWithRpcPromise(_0x1f9f05,_0x2a3fe7,_0x1e35db){return new BPromise(function(_0x2237c6,_0x2d2285){return client[_0xcb0b('0xd')](_0x1f9f05,_0x1e35db)['then'](function(_0x92aa13){logger[_0xcb0b('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2a3fe7,_0xcb0b('0xf'));logger[_0xcb0b('0x10')](_0xcb0b('0x11'),_0x2a3fe7,'request\x20sent',JSON[_0xcb0b('0x12')](_0x92aa13));if(_0x92aa13[_0xcb0b('0x13')]){if(_0x92aa13[_0xcb0b('0x13')][_0xcb0b('0x14')]===0x1f4){logger[_0xcb0b('0x13')](_0xcb0b('0x15'),_0x2a3fe7,_0x92aa13['error'][_0xcb0b('0x16')]);return _0x2d2285(_0x92aa13[_0xcb0b('0x13')][_0xcb0b('0x16')]);}logger[_0xcb0b('0x13')](_0xcb0b('0x15'),_0x2a3fe7,_0x92aa13[_0xcb0b('0x13')][_0xcb0b('0x16')]);return _0x2237c6(_0x92aa13[_0xcb0b('0x13')]['message']);}else{logger[_0xcb0b('0xe')](_0xcb0b('0x15'),_0x2a3fe7,_0xcb0b('0xf'));_0x2237c6(_0x92aa13['result'][_0xcb0b('0x16')]);}})['catch'](function(_0x405a9d){logger[_0xcb0b('0x13')](_0xcb0b('0x15'),_0x2a3fe7,_0x405a9d);_0x2d2285(_0x405a9d);});});}exports[_0xcb0b('0x17')]=function(_0x5a1efe){var _0x3040c8=this;return new Promise(function(_0x569d57,_0x3bcb17){return db['UserVoiceQueueRt']['findAll']({'raw':_0x5a1efe[_0xcb0b('0x18')]?_0x5a1efe[_0xcb0b('0x18')][_0xcb0b('0x19')]===undefined?!![]:![]:!![],'where':_0x5a1efe['options']?_0x5a1efe[_0xcb0b('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcb0b('0x1a')][_0xcb0b('0x1b')](_0xcb0b('0x1c')))),'outboundQueuePauses']]})[_0xcb0b('0x1d')](function(_0x2c4a6a){logger[_0xcb0b('0xe')](_0xcb0b('0x17'),_0x5a1efe);logger[_0xcb0b('0x10')]('GetVoiceQueueRtPauses',_0x5a1efe,JSON['stringify'](_0x2c4a6a));_0x569d57(_0x2c4a6a);})[_0xcb0b('0x1e')](function(_0x1f0375){logger['error'](_0xcb0b('0x17'),_0x1f0375['message'],_0x5a1efe);_0x3bcb17(_0x3040c8[_0xcb0b('0x13')](0x1f4,_0x1f0375[_0xcb0b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 35bd568..245adaa 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 _0xdab9=['remove','update','emit','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xdab9,0x12b));var _0x9dab=function(_0x19e91d,_0x5df028){_0x19e91d=_0x19e91d-0x0;var _0x510256=_0xdab9[_0x19e91d];return _0x510256;};'use strict';var UserVoiceQueueRtEvents=require(_0x9dab('0x0'));var events=[_0x9dab('0x1'),_0x9dab('0x2'),_0x9dab('0x3')];function createListener(_0x2e0b3,_0x259433){return function(_0x1034e4){_0x259433[_0x9dab('0x4')](_0x2e0b3,_0x1034e4);};}function removeListener(_0x5e771b,_0x3fcc4b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5e771b,_0x3fcc4b);};}exports['register']=function(_0x5b4630){for(var _0x4323bb=0x0,_0x554505=events[_0x9dab('0x5')];_0x4323bb<_0x554505;_0x4323bb++){var _0x3f5e24=events[_0x4323bb];var _0x4c9f54=createListener(_0x9dab('0x6')+_0x3f5e24,_0x5b4630);UserVoiceQueueRtEvents['on'](_0x3f5e24,_0x4c9f54);}}; \ No newline at end of file +var _0xb810=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x27dcd1,_0x37c250){var _0x31b331=function(_0x264114){while(--_0x264114){_0x27dcd1['push'](_0x27dcd1['shift']());}};_0x31b331(++_0x37c250);}(_0xb810,0x16f));var _0x0b81=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb810[_0xc4001c];return _0x49f7bc;};'use strict';var UserVoiceQueueRtEvents=require(_0x0b81('0x0'));var events=[_0x0b81('0x1'),_0x0b81('0x2'),_0x0b81('0x3')];function createListener(_0x5e517e,_0x1ce00){return function(_0x35dca7){_0x1ce00[_0x0b81('0x4')](_0x5e517e,_0x35dca7);};}function removeListener(_0x4e3dcc,_0xfdb482){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4e3dcc,_0xfdb482);};}exports['register']=function(_0x23edbc){for(var _0x1ee1a5=0x0,_0x3e1b74=events['length'];_0x1ee1a5<_0x3e1b74;_0x1ee1a5++){var _0x284cbe=events[_0x1ee1a5];var _0x465a38=createListener(_0x0b81('0x5')+_0x284cbe,_0x23edbc);UserVoiceQueueRtEvents['on'](_0x284cbe,_0x465a38);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a8c936d..fc198f2 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 _0x3344=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2d765c,_0x296471){var _0x13ee1d=function(_0x352aa4){while(--_0x352aa4){_0x2d765c['push'](_0x2d765c['shift']());}};_0x13ee1d(++_0x296471);}(_0x3344,0xdb));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4334('0x0'));var util=require(_0x4334('0x1'));var path=require(_0x4334('0x2'));var timeout=require(_0x4334('0x3'));var express=require(_0x4334('0x4'));var router=express[_0x4334('0x5')]();var auth=require(_0x4334('0x6'));var interaction=require(_0x4334('0x7'));var config=require('../../config/environment');module[_0x4334('0x8')]=router; \ No newline at end of file +var _0x8838=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xcd5bb3,_0x41afe0){var _0xfacb9c=function(_0x40cae9){while(--_0x40cae9){_0xcd5bb3['push'](_0xcd5bb3['shift']());}};_0xfacb9c(++_0x41afe0);}(_0x8838,0x90));var _0x8883=function(_0x2fce51,_0xa8f15a){_0x2fce51=_0x2fce51-0x0;var _0x1fea1a=_0x8838[_0x2fce51];return _0x1fea1a;};'use strict';var multer=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var path=require(_0x8883('0x2'));var timeout=require(_0x8883('0x3'));var express=require(_0x8883('0x4'));var router=express[_0x8883('0x5')]();var auth=require(_0x8883('0x6'));var interaction=require(_0x8883('0x7'));var config=require(_0x8883('0x8'));module[_0x8883('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 985bdef..b358114 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x27f14e,_0x5184a8){var _0x192c96=function(_0x179c7f){while(--_0x179c7f){_0x27f14e['push'](_0x27f14e['shift']());}};_0x192c96(++_0x5184a8);}(_0xe706,0xa3));var _0x6e70=function(_0x2e0a25,_0x2da7a6){_0x2e0a25=_0x2e0a25-0x0;var _0x359873=_0xe706[_0x2e0a25];return _0x359873;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x45add7,_0x1e1659){var _0x46d36c=function(_0x51dfa7){while(--_0x51dfa7){_0x45add7['push'](_0x45add7['shift']());}};_0x46d36c(++_0x1e1659);}(_0xe706,0xa3));var _0x6e70=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0xe706[_0x30b159];return _0x23c3f9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 cd4a559..579dc79 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 _0x77e6=['path','../../config/environment','./userWhatsappQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xcfb6c0,_0x161272){var _0x2d8d1f=function(_0x1b5414){while(--_0x1b5414){_0xcfb6c0['push'](_0xcfb6c0['shift']());}};_0x2d8d1f(++_0x161272);}(_0x77e6,0x1a6));var _0x677e=function(_0xb056ba,_0x500902){_0xb056ba=_0xb056ba-0x0;var _0x562752=_0x77e6[_0xb056ba];return _0x562752;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserWhatsappQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0x4abce7,_0x95a4bc){var _0x12ee53=function(_0x1a85d7){while(--_0x1a85d7){_0x4abce7['push'](_0x4abce7['shift']());}};_0x12ee53(++_0x95a4bc);}(_0xb7e7,0x121));var _0x7b7e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb7e7[_0xbd08b4];return _0x314f1e;};'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':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1667bc8..2ed2281 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x279570,_0x441546){var _0xd1ce5b=function(_0x1a63f2){while(--_0x1a63f2){_0x279570['push'](_0x279570['shift']());}};_0xd1ce5b(++_0x441546);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x277c6f,_0x4e8c06){var _0x5d9888=function(_0x5e250f){while(--_0x5e250f){_0x277c6f['push'](_0x277c6f['shift']());}};_0x5d9888(++_0x4e8c06);}(_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 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/variable/index.js b/server/api/variable/index.js index ac2f159..ed5a930 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 _0x2011=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x2906f7,_0xf4212a){var _0x4c4c8f=function(_0x18f537){while(--_0x18f537){_0x2906f7['push'](_0x2906f7['shift']());}};_0x4c4c8f(++_0xf4212a);}(_0x2011,0x128));var _0x1201=function(_0x339a91,_0x360771){_0x339a91=_0x339a91-0x0;var _0x4b68d4=_0x2011[_0x339a91];return _0x4b68d4;};'use strict';var multer=require('multer');var util=require(_0x1201('0x0'));var path=require(_0x1201('0x1'));var timeout=require('connect-timeout');var express=require(_0x1201('0x2'));var router=express[_0x1201('0x3')]();var auth=require(_0x1201('0x4'));var interaction=require(_0x1201('0x5'));var config=require(_0x1201('0x6'));var controller=require(_0x1201('0x7'));router['get']('/',auth[_0x1201('0x8')](),controller[_0x1201('0x9')]);router[_0x1201('0xa')](_0x1201('0xb'),auth[_0x1201('0x8')](),controller[_0x1201('0xc')]);router[_0x1201('0xd')]('/',auth[_0x1201('0x8')](),controller[_0x1201('0xe')]);router[_0x1201('0xf')]('/:id',auth[_0x1201('0x8')](),controller[_0x1201('0x10')]);router[_0x1201('0x11')](_0x1201('0xb'),auth[_0x1201('0x8')](),controller['destroy']);module[_0x1201('0x12')]=router; \ No newline at end of file +var _0xbd7c=['path','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','index','/:id','isAuthenticated','show','post','create','delete','destroy','exports','util'];(function(_0x55336a,_0x240d59){var _0x28ceb3=function(_0x399d5c){while(--_0x399d5c){_0x55336a['push'](_0x55336a['shift']());}};_0x28ceb3(++_0x240d59);}(_0xbd7c,0x1ec));var _0xcbd7=function(_0x353abf,_0x4c27ff){_0x353abf=_0x353abf-0x0;var _0x2e8c40=_0xbd7c[_0x353abf];return _0x2e8c40;};'use strict';var multer=require('multer');var util=require(_0xcbd7('0x0'));var path=require(_0xcbd7('0x1'));var timeout=require('connect-timeout');var express=require(_0xcbd7('0x2'));var router=express[_0xcbd7('0x3')]();var auth=require(_0xcbd7('0x4'));var interaction=require(_0xcbd7('0x5'));var config=require('../../config/environment');var controller=require(_0xcbd7('0x6'));router[_0xcbd7('0x7')]('/',auth['isAuthenticated'](),controller[_0xcbd7('0x8')]);router['get'](_0xcbd7('0x9'),auth[_0xcbd7('0xa')](),controller[_0xcbd7('0xb')]);router[_0xcbd7('0xc')]('/',auth[_0xcbd7('0xa')](),controller[_0xcbd7('0xd')]);router['put'](_0xcbd7('0x9'),auth[_0xcbd7('0xa')](),controller['update']);router[_0xcbd7('0xe')](_0xcbd7('0x9'),auth['isAuthenticated'](),controller[_0xcbd7('0xf')]);module[_0xcbd7('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index cc00007..04cfc64 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 _0xad20=['STRING','sequelize','exports'];(function(_0x506477,_0x35192d){var _0x2bc999=function(_0x4c61f){while(--_0x4c61f){_0x506477['push'](_0x506477['shift']());}};_0x2bc999(++_0x35192d);}(_0xad20,0x190));var _0x0ad2=function(_0x3303fb,_0x1266dd){_0x3303fb=_0x3303fb-0x0;var _0x71a686=_0xad20[_0x3303fb];return _0x71a686;};'use strict';var Sequelize=require(_0x0ad2('0x0'));module[_0x0ad2('0x1')]={'name':{'type':Sequelize[_0x0ad2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ad2('0x2')]}}; \ No newline at end of file +var _0x6c74=['STRING','name','sequelize'];(function(_0x1aee73,_0x39b787){var _0x433d1f=function(_0x4c5cce){while(--_0x4c5cce){_0x1aee73['push'](_0x1aee73['shift']());}};_0x433d1f(++_0x39b787);}(_0x6c74,0x158));var _0x46c7=function(_0x3c1ed7,_0x589c80){_0x3c1ed7=_0x3c1ed7-0x0;var _0x45e5dd=_0x6c74[_0x3c1ed7];return _0x45e5dd;};'use strict';var Sequelize=require(_0x46c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x46c7('0x1')],'unique':_0x46c7('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 77224fb..19e91f6 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 _0x3e50=['Variables','sendStatus','error','stack','name','map','Variable','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','fields','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy'];(function(_0x9bdcf2,_0x24f92c){var _0x6249b0=function(_0x337d73){while(--_0x337d73){_0x9bdcf2['push'](_0x9bdcf2['shift']());}};_0x6249b0(++_0x24f92c);}(_0x3e50,0x80));var _0x03e5=function(_0x32cafe,_0x4e5b7e){_0x32cafe=_0x32cafe-0x0;var _0x535f0b=_0x3e50[_0x32cafe];return _0x535f0b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03e5('0x0'));var rimraf=require(_0x03e5('0x1'));var zipdir=require(_0x03e5('0x2'));var jsonpatch=require(_0x03e5('0x3'));var rp=require(_0x03e5('0x4'));var moment=require(_0x03e5('0x5'));var BPromise=require(_0x03e5('0x6'));var Mustache=require(_0x03e5('0x7'));var util=require(_0x03e5('0x8'));var path=require(_0x03e5('0x9'));var sox=require(_0x03e5('0xa'));var csv=require(_0x03e5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x03e5('0xc'));var squel=require(_0x03e5('0xd'));var crypto=require(_0x03e5('0xe'));var jsforce=require(_0x03e5('0xf'));var deskjs=require(_0x03e5('0x10'));var toCsv=require(_0x03e5('0xb'));var querystring=require(_0x03e5('0x11'));var Papa=require('papaparse');var Redis=require(_0x03e5('0x12'));var authService=require(_0x03e5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x03e5('0x14'));var hardwareService=require(_0x03e5('0x15'));var logger=require(_0x03e5('0x16'))(_0x03e5('0x17'));var utils=require(_0x03e5('0x18'));var config=require(_0x03e5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x03e5('0x1a'))['db'];function respondWithStatusCode(_0x2510f2,_0x21e37b){_0x21e37b=_0x21e37b||0xcc;return function(_0x56725a){if(_0x56725a){return _0x2510f2['sendStatus'](_0x21e37b);}return _0x2510f2[_0x03e5('0x1b')](_0x21e37b)[_0x03e5('0x1c')]();};}function respondWithResult(_0x3bddfc,_0x4fbfbd){_0x4fbfbd=_0x4fbfbd||0xc8;return function(_0x1e67b6){if(_0x1e67b6){return _0x3bddfc[_0x03e5('0x1b')](_0x4fbfbd)[_0x03e5('0x1d')](_0x1e67b6);}};}function respondWithFilteredResult(_0x3f8532,_0x56f92c){return function(_0x239316){if(_0x239316){var _0x4c2d1b=_0x239316[_0x03e5('0x1e')],_0x4986b0=_0x56f92c['offset'],_0x36ad20=_0x56f92c[_0x03e5('0x1f')]+_0x56f92c[_0x03e5('0x20')],_0x3429ed;if(_0x36ad20>=_0x4c2d1b){_0x36ad20=_0x4c2d1b;_0x3429ed=0xc8;}else{_0x3429ed=0xce;}_0x3f8532[_0x03e5('0x1b')](_0x3429ed);return _0x3f8532[_0x03e5('0x21')](_0x03e5('0x22'),_0x4986b0+'-'+_0x36ad20+'/'+_0x4c2d1b)['json'](_0x239316);}return null;};}function patchUpdates(_0x2e3ecb){return function(_0x1a4cde){try{jsonpatch[_0x03e5('0x23')](_0x1a4cde,_0x2e3ecb,!![]);}catch(_0xd2e4c7){return BPromise['reject'](_0xd2e4c7);}return _0x1a4cde[_0x03e5('0x24')]();};}function saveUpdates(_0x46bc71,_0x384e43){return function(_0x386039){if(_0x386039){return _0x386039[_0x03e5('0x25')](_0x46bc71)[_0x03e5('0x26')](function(_0x3354bd){return _0x3354bd;});}return null;};}function removeEntity(_0x1bbd93,_0x402751){return function(_0x18f5bd){if(_0x18f5bd){return _0x18f5bd[_0x03e5('0x27')]()[_0x03e5('0x26')](function(){var _0x228caf=_0x18f5bd['get']({'plain':!![]});var _0x152839=_0x03e5('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x152839,'resourceId':_0x228caf['id']}})[_0x03e5('0x26')](function(){return _0x18f5bd;});})[_0x03e5('0x26')](function(){_0x1bbd93[_0x03e5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14afbe,_0x4c7a04){return function(_0x187adb){if(!_0x187adb){_0x14afbe[_0x03e5('0x29')](0x194);}return _0x187adb;};}function handleError(_0x5d9cdf,_0xb34c31){_0xb34c31=_0xb34c31||0x1f4;return function(_0x554a30){logger[_0x03e5('0x2a')](_0x554a30[_0x03e5('0x2b')]);if(_0x554a30[_0x03e5('0x2c')]){delete _0x554a30['name'];}_0x5d9cdf['status'](_0xb34c31)['send'](_0x554a30);};}exports['index']=function(_0x5c994d,_0x3540d1){var _0x4ca98b={},_0x56ba88={},_0x3fd10c={'count':0x0,'rows':[]};var _0x38aa7f=_[_0x03e5('0x2d')](db[_0x03e5('0x2e')][_0x03e5('0x2f')],function(_0x3a99e0){return{'name':_0x3a99e0[_0x03e5('0x30')],'type':_0x3a99e0[_0x03e5('0x31')]['key']};});_0x56ba88[_0x03e5('0x32')]=_[_0x03e5('0x2d')](_0x38aa7f,_0x03e5('0x2c'));_0x56ba88[_0x03e5('0x33')]=_[_0x03e5('0x34')](_0x5c994d['query']);_0x56ba88['filters']=_[_0x03e5('0x35')](_0x56ba88[_0x03e5('0x32')],_0x56ba88[_0x03e5('0x33')]);_0x4ca98b[_0x03e5('0x36')]=_[_0x03e5('0x35')](_0x56ba88[_0x03e5('0x32')],qs['fields'](_0x5c994d[_0x03e5('0x33')]['fields']));_0x4ca98b[_0x03e5('0x36')]=_0x4ca98b[_0x03e5('0x36')]['length']?_0x4ca98b[_0x03e5('0x36')]:_0x56ba88[_0x03e5('0x32')];if(!_0x5c994d['query'][_0x03e5('0x37')](_0x03e5('0x38'))){_0x4ca98b[_0x03e5('0x20')]=qs[_0x03e5('0x20')](_0x5c994d[_0x03e5('0x33')][_0x03e5('0x20')]);_0x4ca98b[_0x03e5('0x1f')]=qs[_0x03e5('0x1f')](_0x5c994d[_0x03e5('0x33')][_0x03e5('0x1f')]);}_0x4ca98b[_0x03e5('0x39')]=qs['sort'](_0x5c994d[_0x03e5('0x33')][_0x03e5('0x3a')]);_0x4ca98b[_0x03e5('0x3b')]=qs[_0x03e5('0x3c')](_[_0x03e5('0x3d')](_0x5c994d[_0x03e5('0x33')],_0x56ba88[_0x03e5('0x3c')]),_0x38aa7f);if(_0x5c994d['query']['filter']){_0x4ca98b[_0x03e5('0x3b')]=_[_0x03e5('0x3e')](_0x4ca98b[_0x03e5('0x3b')],{'$or':_[_0x03e5('0x2d')](_0x38aa7f,function(_0x4f9046){if(_0x4f9046[_0x03e5('0x31')]!==_0x03e5('0x3f')){var _0x3dffdf={};_0x3dffdf[_0x4f9046[_0x03e5('0x2c')]]={'$like':'%'+_0x5c994d['query'][_0x03e5('0x40')]+'%'};return _0x3dffdf;}})});}_0x4ca98b=_[_0x03e5('0x3e')]({},_0x4ca98b,_0x5c994d[_0x03e5('0x41')]);var _0x3ff8ef={'where':_0x4ca98b['where']};return db['Variable']['count'](_0x3ff8ef)[_0x03e5('0x26')](function(_0x26fa77){_0x3fd10c[_0x03e5('0x1e')]=_0x26fa77;if(_0x5c994d['query'][_0x03e5('0x42')]){_0x4ca98b['include']=[{'all':!![]}];}return db[_0x03e5('0x2e')]['findAll'](_0x4ca98b);})['then'](function(_0x53eb30){_0x3fd10c[_0x03e5('0x43')]=_0x53eb30;return _0x3fd10c;})[_0x03e5('0x26')](respondWithFilteredResult(_0x3540d1,_0x4ca98b))[_0x03e5('0x44')](handleError(_0x3540d1,null));};exports[_0x03e5('0x45')]=function(_0x12e3c4,_0x5e8d42){var _0xed8882={'raw':!![],'where':{'id':_0x12e3c4[_0x03e5('0x46')]['id']}},_0x15575c={};_0x15575c[_0x03e5('0x32')]=_[_0x03e5('0x34')](db[_0x03e5('0x2e')][_0x03e5('0x2f')]);_0x15575c[_0x03e5('0x33')]=_[_0x03e5('0x34')](_0x12e3c4[_0x03e5('0x33')]);_0x15575c[_0x03e5('0x3c')]=_[_0x03e5('0x35')](_0x15575c[_0x03e5('0x32')],_0x15575c['query']);_0xed8882['attributes']=_[_0x03e5('0x35')](_0x15575c[_0x03e5('0x32')],qs[_0x03e5('0x47')](_0x12e3c4['query'][_0x03e5('0x47')]));_0xed8882[_0x03e5('0x36')]=_0xed8882['attributes'][_0x03e5('0x48')]?_0xed8882['attributes']:_0x15575c[_0x03e5('0x32')];if(_0x12e3c4[_0x03e5('0x33')]['includeAll']){_0xed8882['include']=[{'all':!![]}];}_0xed8882=_[_0x03e5('0x3e')]({},_0xed8882,_0x12e3c4['options']);return db[_0x03e5('0x2e')][_0x03e5('0x49')](_0xed8882)[_0x03e5('0x26')](handleEntityNotFound(_0x5e8d42,null))['then'](respondWithResult(_0x5e8d42,null))['catch'](handleError(_0x5e8d42,null));};exports[_0x03e5('0x4a')]=function(_0x56779b,_0x2065b0){return db[_0x03e5('0x2e')]['create'](_0x56779b[_0x03e5('0x4b')],{})[_0x03e5('0x26')](function(_0xdde609){var _0x37caea=_0x56779b['user']['get']({'plain':!![]});if(!_0x37caea)throw new Error(_0x03e5('0x4c'));if(_0x37caea[_0x03e5('0x4d')]===_0x03e5('0x4e')){var _0x12102e=_0xdde609[_0x03e5('0x4f')]({'plain':!![]});var _0x2a66b8=_0x03e5('0x28');return db[_0x03e5('0x50')][_0x03e5('0x49')]({'where':{'name':_0x2a66b8,'userProfileId':_0x37caea[_0x03e5('0x51')]},'raw':!![]})[_0x03e5('0x26')](function(_0x50c0cc){if(_0x50c0cc&&_0x50c0cc['autoAssociation']===0x0){return db[_0x03e5('0x52')][_0x03e5('0x4a')]({'name':_0x12102e[_0x03e5('0x2c')],'resourceId':_0x12102e['id'],'type':_0x50c0cc[_0x03e5('0x2c')],'sectionId':_0x50c0cc['id']},{})[_0x03e5('0x26')](function(){return _0xdde609;});}else{return _0xdde609;}})['catch'](function(_0x52ab1e){logger['error'](_0x03e5('0x53'),_0x52ab1e);throw _0x52ab1e;});}return _0xdde609;})[_0x03e5('0x26')](respondWithResult(_0x2065b0,0xc9))['catch'](handleError(_0x2065b0,null));};exports[_0x03e5('0x25')]=function(_0x13f624,_0x4a8a89){if(_0x13f624['body']['id']){delete _0x13f624['body']['id'];}return db[_0x03e5('0x2e')]['find']({'where':{'id':_0x13f624[_0x03e5('0x46')]['id']}})[_0x03e5('0x26')](handleEntityNotFound(_0x4a8a89,null))[_0x03e5('0x26')](saveUpdates(_0x13f624[_0x03e5('0x4b')],null))['then'](respondWithResult(_0x4a8a89,null))[_0x03e5('0x44')](handleError(_0x4a8a89,null));};exports[_0x03e5('0x27')]=function(_0x5654ad,_0x28e0b0){return db[_0x03e5('0x2e')]['find']({'where':{'id':_0x5654ad[_0x03e5('0x46')]['id']}})[_0x03e5('0x26')](handleEntityNotFound(_0x28e0b0,null))[_0x03e5('0x26')](removeEntity(_0x28e0b0,null))[_0x03e5('0x44')](handleError(_0x28e0b0,null));}; \ No newline at end of file +var _0x462f=['send','index','map','Variable','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Variables','UserProfileResource','destroy','then','error','stack','name'];(function(_0x122481,_0x4ab9ec){var _0x8f8026=function(_0x146f26){while(--_0x146f26){_0x122481['push'](_0x122481['shift']());}};_0x8f8026(++_0x4ab9ec);}(_0x462f,0x1d7));var _0xf462=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x462f[_0x188a93];return _0x23b40d;};'use strict';var pdf=require(_0xf462('0x0'));var emlformat=require(_0xf462('0x1'));var rimraf=require(_0xf462('0x2'));var zipdir=require(_0xf462('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf462('0x4'));var moment=require(_0xf462('0x5'));var BPromise=require(_0xf462('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf462('0x7'));var sox=require(_0xf462('0x8'));var csv=require(_0xf462('0x9'));var ejs=require(_0xf462('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf462('0xb'));var crypto=require(_0xf462('0xc'));var jsforce=require(_0xf462('0xd'));var deskjs=require(_0xf462('0xe'));var toCsv=require(_0xf462('0x9'));var querystring=require(_0xf462('0xf'));var Papa=require(_0xf462('0x10'));var Redis=require('ioredis');var authService=require(_0xf462('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf462('0x12'));var hardwareService=require(_0xf462('0x13'));var logger=require(_0xf462('0x14'))(_0xf462('0x15'));var utils=require(_0xf462('0x16'));var config=require(_0xf462('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17653c,_0x230d84){_0x230d84=_0x230d84||0xcc;return function(_0x2b8b18){if(_0x2b8b18){return _0x17653c[_0xf462('0x18')](_0x230d84);}return _0x17653c[_0xf462('0x19')](_0x230d84)[_0xf462('0x1a')]();};}function respondWithResult(_0x218da6,_0x5e4360){_0x5e4360=_0x5e4360||0xc8;return function(_0x18705f){if(_0x18705f){return _0x218da6[_0xf462('0x19')](_0x5e4360)[_0xf462('0x1b')](_0x18705f);}};}function respondWithFilteredResult(_0x57796d,_0x5e270d){return function(_0xdafe28){if(_0xdafe28){var _0x364f97=_0xdafe28[_0xf462('0x1c')],_0x539987=_0x5e270d[_0xf462('0x1d')],_0x3de162=_0x5e270d[_0xf462('0x1d')]+_0x5e270d[_0xf462('0x1e')],_0x3f1496;if(_0x3de162>=_0x364f97){_0x3de162=_0x364f97;_0x3f1496=0xc8;}else{_0x3f1496=0xce;}_0x57796d[_0xf462('0x19')](_0x3f1496);return _0x57796d[_0xf462('0x1f')](_0xf462('0x20'),_0x539987+'-'+_0x3de162+'/'+_0x364f97)[_0xf462('0x1b')](_0xdafe28);}return null;};}function patchUpdates(_0x2de176){return function(_0x5a0fa9){try{jsonpatch[_0xf462('0x21')](_0x5a0fa9,_0x2de176,!![]);}catch(_0x5ce136){return BPromise[_0xf462('0x22')](_0x5ce136);}return _0x5a0fa9[_0xf462('0x23')]();};}function saveUpdates(_0x49367c,_0x2b8394){return function(_0x3afd17){if(_0x3afd17){return _0x3afd17[_0xf462('0x24')](_0x49367c)['then'](function(_0x4a9345){return _0x4a9345;});}return null;};}function removeEntity(_0x39439c,_0x1c1a18){return function(_0xdda554){if(_0xdda554){return _0xdda554['destroy']()['then'](function(){var _0x3853b9=_0xdda554[_0xf462('0x25')]({'plain':!![]});var _0x297d42=_0xf462('0x26');return db[_0xf462('0x27')][_0xf462('0x28')]({'where':{'type':_0x297d42,'resourceId':_0x3853b9['id']}})[_0xf462('0x29')](function(){return _0xdda554;});})[_0xf462('0x29')](function(){_0x39439c[_0xf462('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9d18,_0x2494ec){return function(_0x4c37f2){if(!_0x4c37f2){_0x1d9d18[_0xf462('0x18')](0x194);}return _0x4c37f2;};}function handleError(_0x40c436,_0x111083){_0x111083=_0x111083||0x1f4;return function(_0x267669){logger[_0xf462('0x2a')](_0x267669[_0xf462('0x2b')]);if(_0x267669[_0xf462('0x2c')]){delete _0x267669[_0xf462('0x2c')];}_0x40c436[_0xf462('0x19')](_0x111083)[_0xf462('0x2d')](_0x267669);};}exports[_0xf462('0x2e')]=function(_0x519637,_0x3b0d25){var _0x18bc27={},_0x46e4dd={},_0x57e098={'count':0x0,'rows':[]};var _0x39a575=_[_0xf462('0x2f')](db[_0xf462('0x30')][_0xf462('0x31')],function(_0xb49c5a){return{'name':_0xb49c5a['fieldName'],'type':_0xb49c5a[_0xf462('0x32')][_0xf462('0x33')]};});_0x46e4dd[_0xf462('0x34')]=_[_0xf462('0x2f')](_0x39a575,_0xf462('0x2c'));_0x46e4dd['query']=_[_0xf462('0x35')](_0x519637[_0xf462('0x36')]);_0x46e4dd[_0xf462('0x37')]=_[_0xf462('0x38')](_0x46e4dd[_0xf462('0x34')],_0x46e4dd[_0xf462('0x36')]);_0x18bc27['attributes']=_[_0xf462('0x38')](_0x46e4dd[_0xf462('0x34')],qs[_0xf462('0x39')](_0x519637[_0xf462('0x36')]['fields']));_0x18bc27[_0xf462('0x3a')]=_0x18bc27[_0xf462('0x3a')]['length']?_0x18bc27['attributes']:_0x46e4dd[_0xf462('0x34')];if(!_0x519637[_0xf462('0x36')][_0xf462('0x3b')](_0xf462('0x3c'))){_0x18bc27['limit']=qs['limit'](_0x519637[_0xf462('0x36')]['limit']);_0x18bc27[_0xf462('0x1d')]=qs[_0xf462('0x1d')](_0x519637[_0xf462('0x36')][_0xf462('0x1d')]);}_0x18bc27[_0xf462('0x3d')]=qs[_0xf462('0x3e')](_0x519637[_0xf462('0x36')][_0xf462('0x3e')]);_0x18bc27[_0xf462('0x3f')]=qs[_0xf462('0x37')](_[_0xf462('0x40')](_0x519637[_0xf462('0x36')],_0x46e4dd[_0xf462('0x37')]),_0x39a575);if(_0x519637['query']['filter']){_0x18bc27['where']=_['merge'](_0x18bc27[_0xf462('0x3f')],{'$or':_[_0xf462('0x2f')](_0x39a575,function(_0x482135){if(_0x482135[_0xf462('0x32')]!==_0xf462('0x41')){var _0x3fb2ab={};_0x3fb2ab[_0x482135['name']]={'$like':'%'+_0x519637['query'][_0xf462('0x42')]+'%'};return _0x3fb2ab;}})});}_0x18bc27=_[_0xf462('0x43')]({},_0x18bc27,_0x519637[_0xf462('0x44')]);var _0x36483e={'where':_0x18bc27['where']};return db[_0xf462('0x30')][_0xf462('0x1c')](_0x36483e)[_0xf462('0x29')](function(_0x3c8e1b){_0x57e098['count']=_0x3c8e1b;if(_0x519637[_0xf462('0x36')][_0xf462('0x45')]){_0x18bc27[_0xf462('0x46')]=[{'all':!![]}];}return db[_0xf462('0x30')][_0xf462('0x47')](_0x18bc27);})[_0xf462('0x29')](function(_0x3beb7d){_0x57e098[_0xf462('0x48')]=_0x3beb7d;return _0x57e098;})['then'](respondWithFilteredResult(_0x3b0d25,_0x18bc27))[_0xf462('0x49')](handleError(_0x3b0d25,null));};exports[_0xf462('0x4a')]=function(_0x364537,_0x8a3636){var _0x277596={'raw':!![],'where':{'id':_0x364537[_0xf462('0x4b')]['id']}},_0x57e628={};_0x57e628[_0xf462('0x34')]=_[_0xf462('0x35')](db[_0xf462('0x30')][_0xf462('0x31')]);_0x57e628['query']=_['keys'](_0x364537[_0xf462('0x36')]);_0x57e628[_0xf462('0x37')]=_[_0xf462('0x38')](_0x57e628[_0xf462('0x34')],_0x57e628[_0xf462('0x36')]);_0x277596[_0xf462('0x3a')]=_[_0xf462('0x38')](_0x57e628[_0xf462('0x34')],qs[_0xf462('0x39')](_0x364537[_0xf462('0x36')][_0xf462('0x39')]));_0x277596[_0xf462('0x3a')]=_0x277596[_0xf462('0x3a')][_0xf462('0x4c')]?_0x277596[_0xf462('0x3a')]:_0x57e628[_0xf462('0x34')];if(_0x364537[_0xf462('0x36')][_0xf462('0x45')]){_0x277596[_0xf462('0x46')]=[{'all':!![]}];}_0x277596=_[_0xf462('0x43')]({},_0x277596,_0x364537[_0xf462('0x44')]);return db['Variable'][_0xf462('0x4d')](_0x277596)['then'](handleEntityNotFound(_0x8a3636,null))[_0xf462('0x29')](respondWithResult(_0x8a3636,null))[_0xf462('0x49')](handleError(_0x8a3636,null));};exports['create']=function(_0x3c720e,_0x3516ff){return db[_0xf462('0x30')][_0xf462('0x4e')](_0x3c720e[_0xf462('0x4f')],{})[_0xf462('0x29')](function(_0x36de6f){var _0x33bbce=_0x3c720e['user'][_0xf462('0x25')]({'plain':!![]});if(!_0x33bbce)throw new Error(_0xf462('0x50'));if(_0x33bbce[_0xf462('0x51')]===_0xf462('0x52')){var _0x96dac1=_0x36de6f[_0xf462('0x25')]({'plain':!![]});var _0x3ce44b=_0xf462('0x26');return db[_0xf462('0x53')][_0xf462('0x4d')]({'where':{'name':_0x3ce44b,'userProfileId':_0x33bbce['userProfileId']},'raw':!![]})[_0xf462('0x29')](function(_0x52766b){if(_0x52766b&&_0x52766b[_0xf462('0x54')]===0x0){return db[_0xf462('0x27')]['create']({'name':_0x96dac1['name'],'resourceId':_0x96dac1['id'],'type':_0x52766b[_0xf462('0x2c')],'sectionId':_0x52766b['id']},{})['then'](function(){return _0x36de6f;});}else{return _0x36de6f;}})[_0xf462('0x49')](function(_0x38e5dd){logger[_0xf462('0x2a')](_0xf462('0x55'),_0x38e5dd);throw _0x38e5dd;});}return _0x36de6f;})[_0xf462('0x29')](respondWithResult(_0x3516ff,0xc9))[_0xf462('0x49')](handleError(_0x3516ff,null));};exports[_0xf462('0x24')]=function(_0x4096ff,_0x672555){if(_0x4096ff['body']['id']){delete _0x4096ff[_0xf462('0x4f')]['id'];}return db['Variable'][_0xf462('0x4d')]({'where':{'id':_0x4096ff['params']['id']}})['then'](handleEntityNotFound(_0x672555,null))[_0xf462('0x29')](saveUpdates(_0x4096ff[_0xf462('0x4f')],null))['then'](respondWithResult(_0x672555,null))[_0xf462('0x49')](handleError(_0x672555,null));};exports[_0xf462('0x28')]=function(_0x2ff315,_0x433271){return db[_0xf462('0x30')][_0xf462('0x4d')]({'where':{'id':_0x2ff315[_0xf462('0x4b')]['id']}})[_0xf462('0x29')](handleEntityNotFound(_0x433271,null))[_0xf462('0x29')](removeEntity(_0x433271,null))[_0xf462('0x49')](handleError(_0x433271,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index bcd3d9b..7b9c7dd 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 _0x7cc4=['request-promise','path','../../config/environment','define','Variable','tools_variables','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7cc4,0x1a8));var _0x47cc=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0x7cc4[_0x31b31b];return _0x2c8fc2;};'use strict';var _=require('lodash');var util=require(_0x47cc('0x0'));var logger=require(_0x47cc('0x1'))(_0x47cc('0x2'));var moment=require(_0x47cc('0x3'));var BPromise=require(_0x47cc('0x4'));var rp=require(_0x47cc('0x5'));var fs=require('fs');var path=require(_0x47cc('0x6'));var rimraf=require('rimraf');var config=require(_0x47cc('0x7'));var attributes=require('./variable.attributes');module['exports']=function(_0x347672,_0x4aab27){return _0x347672[_0x47cc('0x8')](_0x47cc('0x9'),attributes,{'tableName':_0x47cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x684c=['../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var logger=require('../../config/logger')(_0xc684('0x2'));var moment=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var rp=require(_0xc684('0x5'));var fs=require('fs');var path=require(_0xc684('0x6'));var rimraf=require('rimraf');var config=require(_0xc684('0x7'));var attributes=require(_0xc684('0x8'));module[_0xc684('0x9')]=function(_0x4487f6,_0x46cb0e){return _0x4487f6[_0xc684('0xa')](_0xc684('0xb'),attributes,{'tableName':_0xc684('0xc'),'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 657761c..d21cf3c 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 _0x5b6a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','Variable,\x20%s,\x20%s','result','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b6a,0x19f));var _0xa5b6=function(_0x456c0b,_0xb6d3a9){_0x456c0b=_0x456c0b-0x0;var _0x3b4866=_0x5b6a[_0x456c0b];return _0x3b4866;};'use strict';var _=require(_0xa5b6('0x0'));var util=require(_0xa5b6('0x1'));var moment=require(_0xa5b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5b6('0x3'));var db=require(_0xa5b6('0x4'))['db'];var utils=require(_0xa5b6('0x5'));var logger=require(_0xa5b6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa5b6('0x7'));var client=jayson[_0xa5b6('0x8')][_0xa5b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5605d1,_0x3d9bbd,_0x3b1339){return new BPromise(function(_0x10b7b8,_0x47bf83){return client[_0xa5b6('0xa')](_0x5605d1,_0x3b1339)[_0xa5b6('0xb')](function(_0x17fb92){logger[_0xa5b6('0xc')]('Variable,\x20%s,\x20%s',_0x3d9bbd,_0xa5b6('0xd'));logger[_0xa5b6('0xe')](_0xa5b6('0xf'),_0x3d9bbd,_0xa5b6('0xd'),JSON['stringify'](_0x17fb92));if(_0x17fb92['error']){if(_0x17fb92[_0xa5b6('0x10')][_0xa5b6('0x11')]===0x1f4){logger[_0xa5b6('0x10')]('Variable,\x20%s,\x20%s',_0x3d9bbd,_0x17fb92[_0xa5b6('0x10')][_0xa5b6('0x12')]);return _0x47bf83(_0x17fb92[_0xa5b6('0x10')][_0xa5b6('0x12')]);}logger[_0xa5b6('0x10')](_0xa5b6('0x13'),_0x3d9bbd,_0x17fb92[_0xa5b6('0x10')][_0xa5b6('0x12')]);return _0x10b7b8(_0x17fb92[_0xa5b6('0x10')][_0xa5b6('0x12')]);}else{logger['info'](_0xa5b6('0x13'),_0x3d9bbd,_0xa5b6('0xd'));_0x10b7b8(_0x17fb92[_0xa5b6('0x14')]['message']);}})['catch'](function(_0x32f11f){logger[_0xa5b6('0x10')](_0xa5b6('0x13'),_0x3d9bbd,_0x32f11f);_0x47bf83(_0x32f11f);});});}exports[_0xa5b6('0x15')]=function(_0x2676fd){var _0x146389=this;return new Promise(function(_0x20e9ee,_0x326f00){return db[_0xa5b6('0x16')][_0xa5b6('0x17')]({'raw':_0x2676fd['options']?_0x2676fd[_0xa5b6('0x18')][_0xa5b6('0x19')]===undefined?!![]:![]:!![],'where':_0x2676fd[_0xa5b6('0x18')]?_0x2676fd['options'][_0xa5b6('0x1a')]||null:null,'attributes':_0x2676fd['options']?_0x2676fd[_0xa5b6('0x18')][_0xa5b6('0x1b')]||null:null,'include':_0x2676fd['options']?_0x2676fd[_0xa5b6('0x18')][_0xa5b6('0x1c')]?_[_0xa5b6('0x1d')](_0x2676fd[_0xa5b6('0x18')][_0xa5b6('0x1c')],function(_0xad8c41){return{'model':db[_0xad8c41[_0xa5b6('0x1e')]],'as':_0xad8c41['as'],'attributes':_0xad8c41[_0xa5b6('0x1b')],'include':_0xad8c41['include']?_['map'](_0xad8c41['include'],function(_0x5ec4e9){return{'model':db[_0x5ec4e9['model']],'as':_0x5ec4e9['as'],'attributes':_0x5ec4e9['attributes'],'include':_0x5ec4e9['include']?_[_0xa5b6('0x1d')](_0x5ec4e9['include'],function(_0x383c35){return{'model':db[_0x383c35[_0xa5b6('0x1e')]],'as':_0x383c35['as'],'attributes':_0x383c35[_0xa5b6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aca01){logger['info'](_0xa5b6('0x15'),_0x2676fd);logger[_0xa5b6('0xe')](_0xa5b6('0x15'),_0x2676fd,JSON[_0xa5b6('0x1f')](_0x2aca01));_0x20e9ee(_0x2aca01);})[_0xa5b6('0x20')](function(_0x4eedcc){logger[_0xa5b6('0x10')](_0xa5b6('0x15'),_0x4eedcc[_0xa5b6('0x12')],_0x2676fd);_0x326f00(_0x146389[_0xa5b6('0x10')](0x1f4,_0x4eedcc[_0xa5b6('0x12')]));});});}; \ No newline at end of file +var _0xdf4d=['options','raw','where','attributes','include','map','model','ShowVariable','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find'];(function(_0x29e664,_0x488ae2){var _0x4bbd4b=function(_0x26b7f8){while(--_0x26b7f8){_0x29e664['push'](_0x29e664['shift']());}};_0x4bbd4b(++_0x488ae2);}(_0xdf4d,0xa3));var _0xddf4=function(_0x32cfc0,_0x5811c5){_0x32cfc0=_0x32cfc0-0x0;var _0x46b1f0=_0xdf4d[_0x32cfc0];return _0x46b1f0;};'use strict';var _=require(_0xddf4('0x0'));var util=require(_0xddf4('0x1'));var moment=require('moment');var BPromise=require(_0xddf4('0x2'));var rs=require(_0xddf4('0x3'));var fs=require('fs');var Redis=require(_0xddf4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xddf4('0x5'));var config=require(_0xddf4('0x6'));var jayson=require(_0xddf4('0x7'));var client=jayson[_0xddf4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41bee7,_0x259322,_0x429511){return new BPromise(function(_0x57b921,_0x335ba3){return client[_0xddf4('0x9')](_0x41bee7,_0x429511)[_0xddf4('0xa')](function(_0x3dbae9){logger[_0xddf4('0xb')](_0xddf4('0xc'),_0x259322,_0xddf4('0xd'));logger[_0xddf4('0xe')](_0xddf4('0xf'),_0x259322,_0xddf4('0xd'),JSON[_0xddf4('0x10')](_0x3dbae9));if(_0x3dbae9[_0xddf4('0x11')]){if(_0x3dbae9[_0xddf4('0x11')][_0xddf4('0x12')]===0x1f4){logger[_0xddf4('0x11')](_0xddf4('0xc'),_0x259322,_0x3dbae9[_0xddf4('0x11')][_0xddf4('0x13')]);return _0x335ba3(_0x3dbae9['error']['message']);}logger[_0xddf4('0x11')]('Variable,\x20%s,\x20%s',_0x259322,_0x3dbae9[_0xddf4('0x11')][_0xddf4('0x13')]);return _0x57b921(_0x3dbae9[_0xddf4('0x11')]['message']);}else{logger['info'](_0xddf4('0xc'),_0x259322,_0xddf4('0xd'));_0x57b921(_0x3dbae9[_0xddf4('0x14')][_0xddf4('0x13')]);}})[_0xddf4('0x15')](function(_0xe13214){logger['error'](_0xddf4('0xc'),_0x259322,_0xe13214);_0x335ba3(_0xe13214);});});}exports['ShowVariable']=function(_0x1f47b7){var _0xeb8c2f=this;return new Promise(function(_0x1f67e6,_0x1c6ec2){return db['Variable'][_0xddf4('0x16')]({'raw':_0x1f47b7['options']?_0x1f47b7[_0xddf4('0x17')][_0xddf4('0x18')]===undefined?!![]:![]:!![],'where':_0x1f47b7[_0xddf4('0x17')]?_0x1f47b7['options'][_0xddf4('0x19')]||null:null,'attributes':_0x1f47b7[_0xddf4('0x17')]?_0x1f47b7[_0xddf4('0x17')][_0xddf4('0x1a')]||null:null,'include':_0x1f47b7['options']?_0x1f47b7[_0xddf4('0x17')][_0xddf4('0x1b')]?_[_0xddf4('0x1c')](_0x1f47b7[_0xddf4('0x17')][_0xddf4('0x1b')],function(_0x22eeda){return{'model':db[_0x22eeda[_0xddf4('0x1d')]],'as':_0x22eeda['as'],'attributes':_0x22eeda['attributes'],'include':_0x22eeda['include']?_['map'](_0x22eeda[_0xddf4('0x1b')],function(_0x236a49){return{'model':db[_0x236a49[_0xddf4('0x1d')]],'as':_0x236a49['as'],'attributes':_0x236a49['attributes'],'include':_0x236a49[_0xddf4('0x1b')]?_['map'](_0x236a49[_0xddf4('0x1b')],function(_0x5d1bb7){return{'model':db[_0x5d1bb7[_0xddf4('0x1d')]],'as':_0x5d1bb7['as'],'attributes':_0x5d1bb7[_0xddf4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xddf4('0xa')](function(_0x25f303){logger['info'](_0xddf4('0x1e'),_0x1f47b7);logger[_0xddf4('0xe')](_0xddf4('0x1e'),_0x1f47b7,JSON['stringify'](_0x25f303));_0x1f67e6(_0x25f303);})[_0xddf4('0x15')](function(_0x4e5716){logger[_0xddf4('0x11')](_0xddf4('0x1e'),_0x4e5716['message'],_0x1f47b7);_0x1c6ec2(_0xeb8c2f[_0xddf4('0x11')](0x1f4,_0x4e5716['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 65fd58f..9edc5c2 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 _0x2c58=['canUpdate','fetch','/reset','isAuthenticated','reset','/pull','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','index','get'];(function(_0x2a2d7a,_0x3638fa){var _0x122240=function(_0x484c0f){while(--_0x484c0f){_0x2a2d7a['push'](_0x2a2d7a['shift']());}};_0x122240(++_0x3638fa);}(_0x2c58,0x1ab));var _0x82c5=function(_0x587831,_0x125cf8){_0x587831=_0x587831-0x0;var _0x4aee37=_0x2c58[_0x587831];return _0x4aee37;};'use strict';var express=require('express');var router=express[_0x82c5('0x0')]();var auth=require(_0x82c5('0x1'));var controller=require(_0x82c5('0x2'));router['get']('/',controller[_0x82c5('0x3')]);router[_0x82c5('0x4')]('/fetch',auth['isAuthenticated'](),auth[_0x82c5('0x5')](),controller[_0x82c5('0x6')]);router[_0x82c5('0x4')](_0x82c5('0x7'),auth[_0x82c5('0x8')](),auth[_0x82c5('0x5')](),controller[_0x82c5('0x9')]);router[_0x82c5('0x4')](_0x82c5('0xa'),auth['isAuthenticated'](),auth[_0x82c5('0x5')](),controller['pull']);router[_0x82c5('0x4')](_0x82c5('0xb'),auth[_0x82c5('0x8')](),controller[_0x82c5('0xc')]);router[_0x82c5('0x4')](_0x82c5('0xd'),controller[_0x82c5('0xe')]);module[_0x82c5('0xf')]=router; \ No newline at end of file +var _0xb968=['canUpdate','fetch','get','/reset','reset','/restart','restart','migrations','exports','express','../../components/auth/service','./version.controller','index','/fetch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb968,0xe9));var _0x8b96=function(_0x2fbabe,_0x45bebc){_0x2fbabe=_0x2fbabe-0x0;var _0x79e99c=_0xb968[_0x2fbabe];return _0x79e99c;};'use strict';var express=require(_0x8b96('0x0'));var router=express['Router']();var auth=require(_0x8b96('0x1'));var controller=require(_0x8b96('0x2'));router['get']('/',controller[_0x8b96('0x3')]);router['get'](_0x8b96('0x4'),auth['isAuthenticated'](),auth[_0x8b96('0x5')](),controller[_0x8b96('0x6')]);router[_0x8b96('0x7')](_0x8b96('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8b96('0x9')]);router[_0x8b96('0x7')]('/pull',auth['isAuthenticated'](),auth[_0x8b96('0x5')](),controller['pull']);router['get'](_0x8b96('0xa'),auth['isAuthenticated'](),controller[_0x8b96('0xb')]);router[_0x8b96('0x7')]('/migrations',controller[_0x8b96('0xc')]);module[_0x8b96('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8987016..a6689de 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 _0xc2a2=['info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','exports','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','version','query','latest','fetch','tags','2.0.0','status','json','master','error'];(function(_0x316b85,_0x1e3721){var _0x38ecc9=function(_0x4b5405){while(--_0x4b5405){_0x316b85['push'](_0x316b85['shift']());}};_0x38ecc9(++_0x1e3721);}(_0xc2a2,0x84));var _0x2c2a=function(_0xd727e0,_0x4ffee6){_0xd727e0=_0xd727e0-0x0;var _0x25fa19=_0xc2a2[_0xd727e0];return _0x25fa19;};'use strict';var Umzug=require(_0x2c2a('0x0'));var path=require(_0x2c2a('0x1'));var fs=require('fs');var _=require(_0x2c2a('0x2'));var pkginfo=require(_0x2c2a('0x3'))(module,'version');var compareVersions=require(_0x2c2a('0x4'));var exec=require(_0x2c2a('0x5'))[_0x2c2a('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x2c2a('0x7'));var pm2=require(_0x2c2a('0x8'));var logger=require(_0x2c2a('0x9'))(_0x2c2a('0xa'));var git=require('simple-git')(config['root']);exports['index']=function(_0x578a80,_0x48a901){var _0x5cc8c5={'current':module['exports'][_0x2c2a('0xb')],'phonebar':0x2};if(_0x578a80['query']&&_0x578a80[_0x2c2a('0xc')][_0x2c2a('0xd')]){return git[_0x2c2a('0xe')]()[_0x2c2a('0xf')](function(_0x221deb,_0x26bd2f){_0x5cc8c5['latest']=(_0x221deb?module['exports'][_0x2c2a('0xb')]:_0x26bd2f[_0x2c2a('0xd')])||_0x2c2a('0x10');return _0x48a901[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')](_0x5cc8c5);});}else{return _0x48a901[_0x2c2a('0x11')](0xc8)['json'](_0x5cc8c5);}};exports[_0x2c2a('0xe')]=function(_0x3443ee,_0x50e4d0){return git[_0x2c2a('0xe')](['origin',_0x2c2a('0x13')],function(_0x4c5faa){if(_0x4c5faa){logger[_0x2c2a('0x14')](_0x4c5faa);return _0x50e4d0[_0x2c2a('0x11')](0x1f4)['json'](_0x4c5faa);}logger[_0x2c2a('0x15')](_0x2c2a('0x16'));return _0x50e4d0[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':_0x2c2a('0x17')});});};exports[_0x2c2a('0x18')]=function(_0x4b5724,_0x53fe55){return git[_0x2c2a('0x18')](['--hard',_0x2c2a('0x19')],function(_0x401b5e){if(_0x401b5e){logger[_0x2c2a('0x14')](_0x401b5e);return _0x53fe55[_0x2c2a('0x11')](0x1f4)[_0x2c2a('0x12')](_0x401b5e);}logger[_0x2c2a('0x15')](_0x2c2a('0x1a'));return _0x53fe55[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':_0x2c2a('0x1b')});});};exports['pull']=function(_0x1896f2,_0x593027){exec(_0x2c2a('0x1c'),function(_0x3bf453,_0x5c2e06,_0x36927b){logger[_0x2c2a('0x15')](_0x5c2e06);logger[_0x2c2a('0x15')](_0x36927b);if(_0x3bf453){logger['error'](_0x3bf453);return _0x593027[_0x2c2a('0x11')](0x1f4)[_0x2c2a('0x12')](_0x3bf453);}return _0x593027[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':_0x5c2e06});});};exports[_0x2c2a('0x1d')]=function(_0x10573c,_0x46fddf){return pm2[_0x2c2a('0x1d')]('motion2')['then'](function(_0x5afa5f){logger['info'](_0x2c2a('0x1e'),_0x5afa5f);return _0x46fddf[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':_0x2c2a('0x1f')});})[_0x2c2a('0x20')](function(_0x43239d){logger['error'](_0x43239d);return _0x46fddf['status'](0x1f4)[_0x2c2a('0x12')](_0x43239d);});};exports[_0x2c2a('0x21')]=function(_0x10e371,_0x27dc1b){var _0x5c2fbb=fs[_0x2c2a('0x22')](path[_0x2c2a('0x23')](config[_0x2c2a('0x24')],_0x2c2a('0x25'),_0x2c2a('0x21')));var _0x2fcd8b=[];for(var _0x49e451=0x0;_0x49e451<_0x5c2fbb[_0x2c2a('0x26')];_0x49e451++){var _0x5059b9=_0x5c2fbb[_0x49e451][_0x2c2a('0x27')](_0x2c2a('0x28'),'');if(compareVersions(module[_0x2c2a('0x29')][_0x2c2a('0xb')],_0x5059b9)===-0x1){_0x2fcd8b[_0x2c2a('0x2a')](_0x5059b9);}}if(_0x2fcd8b['length']){var _0x3327f7=_0x2fcd8b[_0x2c2a('0x2b')](compareVersions);var _0x19b86f=new Umzug({'storage':_0x2c2a('0x2c'),'storageOptions':{'model':db[_0x2c2a('0x2d')],'modelName':'Migration','columnName':_0x2c2a('0xb')},'migrations':{'params':[db[_0x2c2a('0x2c')]['getQueryInterface'](),db[_0x2c2a('0x2c')]['constructor'],function(){throw new Error(_0x2c2a('0x2e'));}],'path':path[_0x2c2a('0x23')](config[_0x2c2a('0x24')],_0x2c2a('0x25'),_0x2c2a('0x21')),'pattern':/\.js$/}});_0x19b86f['up']({'migrations':_[_0x2c2a('0x2f')](_0x3327f7,function(_0x3ff77b){return _0x3ff77b+'.js';})})[_0x2c2a('0x30')](function(){return _0x27dc1b[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x2c2a('0xb')]+'\x20to\x20'+_[_0x2c2a('0x31')](_0x3327f7),'migrations':_[_0x2c2a('0x23')](_0x3327f7)});})[_0x2c2a('0x20')](function(_0x3e6b12){if(_0x3e6b12 instanceof db[_0x2c2a('0x2c')]['UniqueConstraintError']){return _0x27dc1b[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':_0x2c2a('0x32')});}else{return _0x27dc1b[_0x2c2a('0x11')](0x1f4)[_0x2c2a('0x12')](_0x3e6b12);}});}else{return _0x27dc1b[_0x2c2a('0x11')](0xc8)[_0x2c2a('0x12')]({'output':_0x2c2a('0x32')});}}; \ No newline at end of file +var _0x5ae9=['last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','child_process','exec','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','fetch','tags','2.0.0','status','json','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','error','migrations','readdirSync','join','replace','.js','length','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20'];(function(_0x526fc1,_0x251335){var _0x29908e=function(_0x57311b){while(--_0x57311b){_0x526fc1['push'](_0x526fc1['shift']());}};_0x29908e(++_0x251335);}(_0x5ae9,0x19b));var _0x95ae=function(_0x4c2bc5,_0x4984e2){_0x4c2bc5=_0x4c2bc5-0x0;var _0x487209=_0x5ae9[_0x4c2bc5];return _0x487209;};'use strict';var Umzug=require(_0x95ae('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x95ae('0x1'))(module,_0x95ae('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x95ae('0x3'))[_0x95ae('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x95ae('0x5'));var pm2=require('../../config/pm2');var logger=require(_0x95ae('0x6'))(_0x95ae('0x7'));var git=require(_0x95ae('0x8'))(config[_0x95ae('0x9')]);exports[_0x95ae('0xa')]=function(_0x4df142,_0x588bab){var _0x19ba28={'current':module[_0x95ae('0xb')][_0x95ae('0x2')],'phonebar':0x2};if(_0x4df142[_0x95ae('0xc')]&&_0x4df142['query']['latest']){return git[_0x95ae('0xd')]()[_0x95ae('0xe')](function(_0x7846a2,_0x34b023){_0x19ba28['latest']=(_0x7846a2?module['exports'][_0x95ae('0x2')]:_0x34b023['latest'])||_0x95ae('0xf');return _0x588bab[_0x95ae('0x10')](0xc8)['json'](_0x19ba28);});}else{return _0x588bab[_0x95ae('0x10')](0xc8)[_0x95ae('0x11')](_0x19ba28);}};exports[_0x95ae('0xd')]=function(_0x4e3050,_0x4685a4){return git[_0x95ae('0xd')]([_0x95ae('0x12'),'master'],function(_0x1bc94f){if(_0x1bc94f){logger['error'](_0x1bc94f);return _0x4685a4[_0x95ae('0x10')](0x1f4)['json'](_0x1bc94f);}logger[_0x95ae('0x13')](_0x95ae('0x14'));return _0x4685a4[_0x95ae('0x10')](0xc8)[_0x95ae('0x11')]({'output':_0x95ae('0x15')});});};exports[_0x95ae('0x16')]=function(_0x129b62,_0x24d5d2){return git[_0x95ae('0x16')](['--hard',_0x95ae('0x17')],function(_0x23cb10){if(_0x23cb10){logger['error'](_0x23cb10);return _0x24d5d2[_0x95ae('0x10')](0x1f4)[_0x95ae('0x11')](_0x23cb10);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x24d5d2[_0x95ae('0x10')](0xc8)[_0x95ae('0x11')]({'output':_0x95ae('0x18')});});};exports[_0x95ae('0x19')]=function(_0x8ed1b1,_0x530ca6){exec(_0x95ae('0x1a'),function(_0x457324,_0x1ecde4,_0x2ad155){logger['info'](_0x1ecde4);logger[_0x95ae('0x13')](_0x2ad155);if(_0x457324){logger['error'](_0x457324);return _0x530ca6[_0x95ae('0x10')](0x1f4)['json'](_0x457324);}return _0x530ca6[_0x95ae('0x10')](0xc8)[_0x95ae('0x11')]({'output':_0x1ecde4});});};exports[_0x95ae('0x1b')]=function(_0x4990f8,_0xdc8e7e){return pm2[_0x95ae('0x1b')](_0x95ae('0x1c'))[_0x95ae('0x1d')](function(_0x36351e){logger['info'](_0x95ae('0x1e'),_0x36351e);return _0xdc8e7e[_0x95ae('0x10')](0xc8)[_0x95ae('0x11')]({'output':_0x95ae('0x1f')});})[_0x95ae('0x20')](function(_0x51ba5d){logger[_0x95ae('0x21')](_0x51ba5d);return _0xdc8e7e['status'](0x1f4)[_0x95ae('0x11')](_0x51ba5d);});};exports[_0x95ae('0x22')]=function(_0x611fca,_0x424e0f){var _0x4fa625=fs[_0x95ae('0x23')](path[_0x95ae('0x24')](config[_0x95ae('0x9')],'server',_0x95ae('0x22')));var _0x4c111d=[];for(var _0x4c44f4=0x0;_0x4c44f4<_0x4fa625['length'];_0x4c44f4++){var _0x1820b4=_0x4fa625[_0x4c44f4][_0x95ae('0x25')](_0x95ae('0x26'),'');if(compareVersions(module['exports'][_0x95ae('0x2')],_0x1820b4)===-0x1){_0x4c111d['push'](_0x1820b4);}}if(_0x4c111d[_0x95ae('0x27')]){var _0x5ac97=_0x4c111d['sort'](compareVersions);var _0x3d09ab=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x95ae('0x28')],'modelName':_0x95ae('0x28'),'columnName':'version'},'migrations':{'params':[db[_0x95ae('0x29')][_0x95ae('0x2a')](),db[_0x95ae('0x29')][_0x95ae('0x2b')],function(){throw new Error(_0x95ae('0x2c'));}],'path':path[_0x95ae('0x24')](config[_0x95ae('0x9')],'server','migrations'),'pattern':/\.js$/}});_0x3d09ab['up']({'migrations':_[_0x95ae('0x2d')](_0x5ac97,function(_0x2aa190){return _0x2aa190+_0x95ae('0x26');})})[_0x95ae('0x1d')](function(){return _0x424e0f[_0x95ae('0x10')](0xc8)['json']({'output':_0x95ae('0x2e')+module[_0x95ae('0xb')][_0x95ae('0x2')]+_0x95ae('0x2f')+_[_0x95ae('0x30')](_0x5ac97),'migrations':_[_0x95ae('0x24')](_0x5ac97)});})['catch'](function(_0x8d8b8f){if(_0x8d8b8f instanceof db[_0x95ae('0x29')][_0x95ae('0x31')]){return _0x424e0f[_0x95ae('0x10')](0xc8)['json']({'output':_0x95ae('0x32')});}else{return _0x424e0f['status'](0x1f4)[_0x95ae('0x11')](_0x8d8b8f);}});}else{return _0x424e0f[_0x95ae('0x10')](0xc8)[_0x95ae('0x11')]({'output':_0x95ae('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ea625c9..1e9bc24 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 _0x58da=['show','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe'];(function(_0x12e99f,_0x5f1f3c){var _0x2abbfe=function(_0x5c57a1){while(--_0x5c57a1){_0x12e99f['push'](_0x12e99f['shift']());}};_0x2abbfe(++_0x5f1f3c);}(_0x58da,0x19e));var _0xa58d=function(_0x2eeedc,_0x2446f5){_0x2eeedc=_0x2eeedc-0x0;var _0x4e99bc=_0x58da[_0x2eeedc];return _0x4e99bc;};'use strict';var multer=require(_0xa58d('0x0'));var util=require(_0xa58d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa58d('0x2'));var router=express['Router']();var auth=require(_0xa58d('0x3'));var interaction=require(_0xa58d('0x4'));var config=require(_0xa58d('0x5'));var controller=require(_0xa58d('0x6'));router[_0xa58d('0x7')]('/',auth[_0xa58d('0x8')](),controller[_0xa58d('0x9')]);router[_0xa58d('0x7')]('/describe',auth[_0xa58d('0x8')](),controller[_0xa58d('0xa')]);router['get']('/:id',auth[_0xa58d('0x8')](),controller[_0xa58d('0xb')]);router['post']('/',auth[_0xa58d('0x8')](),controller['create']);router['put'](_0xa58d('0xc'),auth[_0xa58d('0x8')](),controller[_0xa58d('0xd')]);router[_0xa58d('0xe')](_0xa58d('0xc'),auth[_0xa58d('0x8')](),controller[_0xa58d('0xf')]);module[_0xa58d('0x10')]=router; \ No newline at end of file +var _0x8130=['index','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x8130,0x14d));var _0x0813=function(_0x4d9fa6,_0x23242c){_0x4d9fa6=_0x4d9fa6-0x0;var _0x27ddb2=_0x8130[_0x4d9fa6];return _0x27ddb2;};'use strict';var multer=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var path=require('path');var timeout=require(_0x0813('0x2'));var express=require(_0x0813('0x3'));var router=express[_0x0813('0x4')]();var auth=require(_0x0813('0x5'));var interaction=require(_0x0813('0x6'));var config=require(_0x0813('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x0813('0x8')]('/',auth['isAuthenticated'](),controller[_0x0813('0x9')]);router['get']('/describe',auth[_0x0813('0xa')](),controller[_0x0813('0xb')]);router[_0x0813('0x8')](_0x0813('0xc'),auth[_0x0813('0xa')](),controller[_0x0813('0xd')]);router['post']('/',auth[_0x0813('0xa')](),controller['create']);router[_0x0813('0xe')](_0x0813('0xc'),auth[_0x0813('0xa')](),controller[_0x0813('0xf')]);router[_0x0813('0x10')]('/:id',auth[_0x0813('0xa')](),controller['destroy']);module[_0x0813('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1949139..502539c 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 _0x7da7=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x1d2da4,_0x18adc3){var _0x365fd4=function(_0x45d0a9){while(--_0x45d0a9){_0x1d2da4['push'](_0x1d2da4['shift']());}};_0x365fd4(++_0x18adc3);}(_0x7da7,0x10d));var _0x77da=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x7da7[_0x2e3545];return _0xcf18f;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'type':{'type':Sequelize[_0x77da('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x77da('0x2')]},'queue':{'type':Sequelize[_0x77da('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x77da('0x2')]},'agentcalledAt':{'type':Sequelize[_0x77da('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x77da('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x77da('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x77da('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x77da('0x4')]},'agentacw':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x77da('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x77da('0x2')]},'channel':{'type':Sequelize[_0x77da('0x2')]},'channelstate':{'type':Sequelize[_0x77da('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x77da('0x2')]},'connectedlinename':{'type':Sequelize[_0x77da('0x2')]},'language':{'type':Sequelize[_0x77da('0x2')]},'accountcode':{'type':Sequelize[_0x77da('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x77da('0x2')]},'priority':{'type':Sequelize[_0x77da('0x2')]},'destchannel':{'type':Sequelize[_0x77da('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x77da('0x2')]},'destcalleridname':{'type':Sequelize[_0x77da('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x77da('0x2')]},'destlanguage':{'type':Sequelize[_0x77da('0x2')]},'destaccountcode':{'type':Sequelize[_0x77da('0x2')]},'destcontext':{'type':Sequelize[_0x77da('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x77da('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x77da('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x77da('0x2')]},'transfer':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x77da('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeec6=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x37e754,_0xfa0ffd){var _0x5162c1=function(_0x51e249){while(--_0x51e249){_0x37e754['push'](_0x37e754['shift']());}};_0x5162c1(++_0xfa0ffd);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3f92bc,_0x482ad4){_0x3f92bc=_0x3f92bc-0x0;var _0xa15d20=_0xeec6[_0x3f92bc];return _0xa15d20;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'type':{'type':Sequelize[_0x6eec('0x2')]},'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6eec('0x2')]},'queue':{'type':Sequelize[_0x6eec('0x2')]},'interface':{'type':Sequelize[_0x6eec('0x2')]},'membername':{'type':Sequelize[_0x6eec('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6eec('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6eec('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x6eec('0x3')]},'agentdumpAt':{'type':Sequelize[_0x6eec('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6eec('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6eec('0x5')]},'reason':{'type':Sequelize[_0x6eec('0x2')]},'lastevent':{'type':Sequelize[_0x6eec('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6eec('0x2')]},'connectedlinename':{'type':Sequelize[_0x6eec('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6eec('0x2')]},'destchannel':{'type':Sequelize[_0x6eec('0x2')]},'destchannelstate':{'type':Sequelize[_0x6eec('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x6eec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6eec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6eec('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6eec('0x2')]},'destlanguage':{'type':Sequelize[_0x6eec('0x2')]},'destaccountcode':{'type':Sequelize[_0x6eec('0x2')]},'destcontext':{'type':Sequelize[_0x6eec('0x2')]},'destexten':{'type':Sequelize[_0x6eec('0x2')]},'destpriority':{'type':Sequelize[_0x6eec('0x2')]},'destuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6eec('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6eec('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6eec('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ff178fd..49e6320 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 _0xebfb=['attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','VoiceAgentReport','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','stack','name','send','index','fieldName','type','key','map','query','keys','intersection','model'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xebfb,0x1bd));var _0xbebf=function(_0x329502,_0x2c7184){_0x329502=_0x329502-0x0;var _0x7f91b6=_0xebfb[_0x329502];return _0x7f91b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbebf('0x0'));var rimraf=require(_0xbebf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbebf('0x2'));var rp=require('request-promise');var moment=require(_0xbebf('0x3'));var BPromise=require(_0xbebf('0x4'));var Mustache=require(_0xbebf('0x5'));var util=require('util');var path=require(_0xbebf('0x6'));var sox=require(_0xbebf('0x7'));var csv=require(_0xbebf('0x8'));var ejs=require(_0xbebf('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbebf('0xa'));var crypto=require(_0xbebf('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbebf('0x8'));var querystring=require('querystring');var Papa=require(_0xbebf('0xc'));var Redis=require(_0xbebf('0xd'));var authService=require(_0xbebf('0xe'));var qs=require(_0xbebf('0xf'));var as=require(_0xbebf('0x10'));var hardwareService=require(_0xbebf('0x11'));var logger=require(_0xbebf('0x12'))('api');var utils=require(_0xbebf('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f80d1,_0x49133c){_0x49133c=_0x49133c||0xcc;return function(_0xa4439e){if(_0xa4439e){return _0x3f80d1[_0xbebf('0x14')](_0x49133c);}return _0x3f80d1['status'](_0x49133c)['end']();};}function respondWithResult(_0x35d8a2,_0x2bc61e){_0x2bc61e=_0x2bc61e||0xc8;return function(_0x4eee78){if(_0x4eee78){return _0x35d8a2[_0xbebf('0x15')](_0x2bc61e)[_0xbebf('0x16')](_0x4eee78);}};}function respondWithFilteredResult(_0x473046,_0x3e1b84){return function(_0x60bc36){if(_0x60bc36){var _0x3d65bd=_0x60bc36[_0xbebf('0x17')],_0x4427a2=_0x3e1b84[_0xbebf('0x18')],_0x5e9fb6=_0x3e1b84[_0xbebf('0x18')]+_0x3e1b84[_0xbebf('0x19')],_0xecddcf;if(_0x5e9fb6>=_0x3d65bd){_0x5e9fb6=_0x3d65bd;_0xecddcf=0xc8;}else{_0xecddcf=0xce;}_0x473046[_0xbebf('0x15')](_0xecddcf);return _0x473046[_0xbebf('0x1a')](_0xbebf('0x1b'),_0x4427a2+'-'+_0x5e9fb6+'/'+_0x3d65bd)['json'](_0x60bc36);}return null;};}function patchUpdates(_0x46b248){return function(_0x5a5c7c){try{jsonpatch['apply'](_0x5a5c7c,_0x46b248,!![]);}catch(_0x4f6ffc){return BPromise[_0xbebf('0x1c')](_0x4f6ffc);}return _0x5a5c7c[_0xbebf('0x1d')]();};}function saveUpdates(_0xdd145f,_0x5577b5){return function(_0x5955d7){if(_0x5955d7){return _0x5955d7[_0xbebf('0x1e')](_0xdd145f)[_0xbebf('0x1f')](function(_0x398b80){return _0x398b80;});}return null;};}function removeEntity(_0x444de4,_0x55b99a){return function(_0x3b5a8d){if(_0x3b5a8d){return _0x3b5a8d['destroy']()[_0xbebf('0x1f')](function(){_0x444de4[_0xbebf('0x15')](0xcc)[_0xbebf('0x20')]();});}};}function handleEntityNotFound(_0x27b5c7,_0x4ae5d6){return function(_0x9fb608){if(!_0x9fb608){_0x27b5c7[_0xbebf('0x14')](0x194);}return _0x9fb608;};}function handleError(_0x29083f,_0x100b67){_0x100b67=_0x100b67||0x1f4;return function(_0x52de98){logger['error'](_0x52de98[_0xbebf('0x21')]);if(_0x52de98[_0xbebf('0x22')]){delete _0x52de98[_0xbebf('0x22')];}_0x29083f[_0xbebf('0x15')](_0x100b67)[_0xbebf('0x23')](_0x52de98);};}exports[_0xbebf('0x24')]=function(_0x403165,_0x2c4479){var _0x439293={},_0x5eaa3f={},_0x409b88={'count':0x0,'rows':[]};var _0x4fcad0=_['map'](db['VoiceAgentReport']['rawAttributes'],function(_0x433f47){return{'name':_0x433f47[_0xbebf('0x25')],'type':_0x433f47[_0xbebf('0x26')][_0xbebf('0x27')]};});_0x5eaa3f['model']=_[_0xbebf('0x28')](_0x4fcad0,'name');_0x5eaa3f[_0xbebf('0x29')]=_[_0xbebf('0x2a')](_0x403165[_0xbebf('0x29')]);_0x5eaa3f['filters']=_[_0xbebf('0x2b')](_0x5eaa3f[_0xbebf('0x2c')],_0x5eaa3f[_0xbebf('0x29')]);_0x439293[_0xbebf('0x2d')]=_[_0xbebf('0x2b')](_0x5eaa3f[_0xbebf('0x2c')],qs[_0xbebf('0x2e')](_0x403165[_0xbebf('0x29')][_0xbebf('0x2e')]));_0x439293[_0xbebf('0x2d')]=_0x439293[_0xbebf('0x2d')][_0xbebf('0x2f')]?_0x439293['attributes']:_0x5eaa3f[_0xbebf('0x2c')];if(!_0x403165[_0xbebf('0x29')]['hasOwnProperty'](_0xbebf('0x30'))){_0x439293[_0xbebf('0x19')]=qs[_0xbebf('0x19')](_0x403165[_0xbebf('0x29')][_0xbebf('0x19')]);_0x439293['offset']=qs[_0xbebf('0x18')](_0x403165['query'][_0xbebf('0x18')]);}_0x439293[_0xbebf('0x31')]=qs['sort'](_0x403165['query'][_0xbebf('0x32')]);_0x439293[_0xbebf('0x33')]=qs[_0xbebf('0x34')](_[_0xbebf('0x35')](_0x403165['query'],_0x5eaa3f[_0xbebf('0x34')]),_0x4fcad0);if(_0x403165[_0xbebf('0x29')]['filter']){_0x439293[_0xbebf('0x33')]=_[_0xbebf('0x36')](_0x439293['where'],{'$or':_[_0xbebf('0x28')](_0x4fcad0,function(_0x84121a){if(_0x84121a[_0xbebf('0x26')]!==_0xbebf('0x37')){var _0x469d03={};_0x469d03[_0x84121a[_0xbebf('0x22')]]={'$like':'%'+_0x403165[_0xbebf('0x29')]['filter']+'%'};return _0x469d03;}})});}_0x439293=_[_0xbebf('0x36')]({},_0x439293,_0x403165['options']);var _0x26b0b5={'where':_0x439293[_0xbebf('0x33')]};return db[_0xbebf('0x38')][_0xbebf('0x17')](_0x26b0b5)['then'](function(_0x68121d){_0x409b88[_0xbebf('0x17')]=_0x68121d;if(_0x403165[_0xbebf('0x29')]['includeAll']){_0x439293[_0xbebf('0x39')]=[{'all':!![]}];}return db[_0xbebf('0x38')][_0xbebf('0x3a')](_0x439293);})[_0xbebf('0x1f')](function(_0x5bf0b3){_0x409b88[_0xbebf('0x3b')]=_0x5bf0b3;return _0x409b88;})[_0xbebf('0x1f')](respondWithFilteredResult(_0x2c4479,_0x439293))[_0xbebf('0x3c')](handleError(_0x2c4479,null));};exports['show']=function(_0x1586a0,_0x23c4a1){var _0x3c84f3={'raw':![],'where':{'id':_0x1586a0[_0xbebf('0x3d')]['id']}},_0x177dea={};_0x177dea['model']=_[_0xbebf('0x2a')](db[_0xbebf('0x38')][_0xbebf('0x3e')]);_0x177dea[_0xbebf('0x29')]=_['keys'](_0x1586a0[_0xbebf('0x29')]);_0x177dea['filters']=_['intersection'](_0x177dea[_0xbebf('0x2c')],_0x177dea[_0xbebf('0x29')]);_0x3c84f3[_0xbebf('0x2d')]=_['intersection'](_0x177dea['model'],qs[_0xbebf('0x2e')](_0x1586a0['query'][_0xbebf('0x2e')]));_0x3c84f3[_0xbebf('0x2d')]=_0x3c84f3[_0xbebf('0x2d')][_0xbebf('0x2f')]?_0x3c84f3[_0xbebf('0x2d')]:_0x177dea[_0xbebf('0x2c')];if(_0x1586a0[_0xbebf('0x29')][_0xbebf('0x3f')]){_0x3c84f3[_0xbebf('0x39')]=[{'all':!![]}];}_0x3c84f3=_[_0xbebf('0x36')]({},_0x3c84f3,_0x1586a0[_0xbebf('0x40')]);return db[_0xbebf('0x38')][_0xbebf('0x41')](_0x3c84f3)['then'](handleEntityNotFound(_0x23c4a1,null))[_0xbebf('0x1f')](respondWithResult(_0x23c4a1,null))['catch'](handleError(_0x23c4a1,null));};exports[_0xbebf('0x42')]=function(_0x5a91dc,_0x3647ea){return db['VoiceAgentReport'][_0xbebf('0x42')](_0x5a91dc['body'],{})[_0xbebf('0x1f')](respondWithResult(_0x3647ea,0xc9))[_0xbebf('0x3c')](handleError(_0x3647ea,null));};exports[_0xbebf('0x1e')]=function(_0x13f8c4,_0x467d84){if(_0x13f8c4['body']['id']){delete _0x13f8c4[_0xbebf('0x43')]['id'];}return db[_0xbebf('0x38')][_0xbebf('0x41')]({'where':{'id':_0x13f8c4[_0xbebf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x467d84,null))['then'](saveUpdates(_0x13f8c4[_0xbebf('0x43')],null))['then'](respondWithResult(_0x467d84,null))[_0xbebf('0x3c')](handleError(_0x467d84,null));};exports[_0xbebf('0x44')]=function(_0x4a3aaf,_0x439cba){return db[_0xbebf('0x38')][_0xbebf('0x41')]({'where':{'id':_0x4a3aaf['params']['id']}})[_0xbebf('0x1f')](handleEntityNotFound(_0x439cba,null))[_0xbebf('0x1f')](removeEntity(_0x439cba,null))[_0xbebf('0x3c')](handleError(_0x439cba,null));};exports['describe']=function(_0x49fb01,_0x49b2ec){return db[_0xbebf('0x38')][_0xbebf('0x45')]()[_0xbebf('0x1f')](respondWithResult(_0x49b2ec,null))[_0xbebf('0x3c')](handleError(_0x49b2ec,null));}; \ No newline at end of file +var _0x989e=['path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','index','VoiceAgentReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','merge','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x989e,0x119));var _0xe989=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x989e[_0x4ad0f7];return _0x30f5c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe989('0x0'));var rimraf=require(_0xe989('0x1'));var zipdir=require(_0xe989('0x2'));var jsonpatch=require(_0xe989('0x3'));var rp=require('request-promise');var moment=require(_0xe989('0x4'));var BPromise=require(_0xe989('0x5'));var Mustache=require(_0xe989('0x6'));var util=require('util');var path=require(_0xe989('0x7'));var sox=require(_0xe989('0x8'));var csv=require(_0xe989('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe989('0xa'));var crypto=require(_0xe989('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe989('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe989('0xd'));var Papa=require(_0xe989('0xe'));var Redis=require(_0xe989('0xf'));var authService=require(_0xe989('0x10'));var qs=require(_0xe989('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe989('0x12'));var utils=require(_0xe989('0x13'));var config=require(_0xe989('0x14'));var licenseUtil=require(_0xe989('0x15'));var db=require(_0xe989('0x16'))['db'];function respondWithStatusCode(_0x5dab57,_0x4d3d09){_0x4d3d09=_0x4d3d09||0xcc;return function(_0x21b89f){if(_0x21b89f){return _0x5dab57[_0xe989('0x17')](_0x4d3d09);}return _0x5dab57[_0xe989('0x18')](_0x4d3d09)[_0xe989('0x19')]();};}function respondWithResult(_0x585d1e,_0x2ec5df){_0x2ec5df=_0x2ec5df||0xc8;return function(_0x1e2e28){if(_0x1e2e28){return _0x585d1e[_0xe989('0x18')](_0x2ec5df)['json'](_0x1e2e28);}};}function respondWithFilteredResult(_0x4b2fa3,_0x15b6d5){return function(_0xce7b24){if(_0xce7b24){var _0x1048db=_0xce7b24[_0xe989('0x1a')],_0x5cb07f=_0x15b6d5[_0xe989('0x1b')],_0x22dc20=_0x15b6d5[_0xe989('0x1b')]+_0x15b6d5['limit'],_0x15c8b2;if(_0x22dc20>=_0x1048db){_0x22dc20=_0x1048db;_0x15c8b2=0xc8;}else{_0x15c8b2=0xce;}_0x4b2fa3[_0xe989('0x18')](_0x15c8b2);return _0x4b2fa3['set'](_0xe989('0x1c'),_0x5cb07f+'-'+_0x22dc20+'/'+_0x1048db)['json'](_0xce7b24);}return null;};}function patchUpdates(_0x33e4f0){return function(_0xb7a9e8){try{jsonpatch['apply'](_0xb7a9e8,_0x33e4f0,!![]);}catch(_0x36073e){return BPromise[_0xe989('0x1d')](_0x36073e);}return _0xb7a9e8[_0xe989('0x1e')]();};}function saveUpdates(_0x178c2e,_0x1e4f37){return function(_0x19789b){if(_0x19789b){return _0x19789b['update'](_0x178c2e)[_0xe989('0x1f')](function(_0x314c81){return _0x314c81;});}return null;};}function removeEntity(_0x2431bc,_0x5bb5a0){return function(_0xeb7acb){if(_0xeb7acb){return _0xeb7acb[_0xe989('0x20')]()[_0xe989('0x1f')](function(){_0x2431bc[_0xe989('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a32b,_0x56407e){return function(_0x3e1c09){if(!_0x3e1c09){_0x44a32b[_0xe989('0x17')](0x194);}return _0x3e1c09;};}function handleError(_0x1d513e,_0x35d1b1){_0x35d1b1=_0x35d1b1||0x1f4;return function(_0x502c74){logger[_0xe989('0x21')](_0x502c74[_0xe989('0x22')]);if(_0x502c74[_0xe989('0x23')]){delete _0x502c74[_0xe989('0x23')];}_0x1d513e[_0xe989('0x18')](_0x35d1b1)['send'](_0x502c74);};}exports[_0xe989('0x24')]=function(_0x41b359,_0x265a7c){var _0x1c755e={},_0x15eda7={},_0x2570b5={'count':0x0,'rows':[]};var _0x5022e5=_['map'](db[_0xe989('0x25')]['rawAttributes'],function(_0x54a6d9){return{'name':_0x54a6d9[_0xe989('0x26')],'type':_0x54a6d9[_0xe989('0x27')][_0xe989('0x28')]};});_0x15eda7[_0xe989('0x29')]=_['map'](_0x5022e5,_0xe989('0x23'));_0x15eda7[_0xe989('0x2a')]=_[_0xe989('0x2b')](_0x41b359['query']);_0x15eda7['filters']=_[_0xe989('0x2c')](_0x15eda7[_0xe989('0x29')],_0x15eda7[_0xe989('0x2a')]);_0x1c755e[_0xe989('0x2d')]=_[_0xe989('0x2c')](_0x15eda7[_0xe989('0x29')],qs['fields'](_0x41b359['query'][_0xe989('0x2e')]));_0x1c755e[_0xe989('0x2d')]=_0x1c755e[_0xe989('0x2d')][_0xe989('0x2f')]?_0x1c755e[_0xe989('0x2d')]:_0x15eda7['model'];if(!_0x41b359[_0xe989('0x2a')][_0xe989('0x30')]('nolimit')){_0x1c755e['limit']=qs[_0xe989('0x31')](_0x41b359[_0xe989('0x2a')][_0xe989('0x31')]);_0x1c755e[_0xe989('0x1b')]=qs['offset'](_0x41b359[_0xe989('0x2a')]['offset']);}_0x1c755e[_0xe989('0x32')]=qs[_0xe989('0x33')](_0x41b359[_0xe989('0x2a')]['sort']);_0x1c755e['where']=qs[_0xe989('0x34')](_[_0xe989('0x35')](_0x41b359[_0xe989('0x2a')],_0x15eda7[_0xe989('0x34')]),_0x5022e5);if(_0x41b359[_0xe989('0x2a')][_0xe989('0x36')]){_0x1c755e[_0xe989('0x37')]=_['merge'](_0x1c755e['where'],{'$or':_['map'](_0x5022e5,function(_0x524203){if(_0x524203['type']!==_0xe989('0x38')){var _0x13d292={};_0x13d292[_0x524203[_0xe989('0x23')]]={'$like':'%'+_0x41b359[_0xe989('0x2a')][_0xe989('0x36')]+'%'};return _0x13d292;}})});}_0x1c755e=_['merge']({},_0x1c755e,_0x41b359[_0xe989('0x39')]);var _0x582f17={'where':_0x1c755e[_0xe989('0x37')]};return db['VoiceAgentReport']['count'](_0x582f17)[_0xe989('0x1f')](function(_0x3a1228){_0x2570b5[_0xe989('0x1a')]=_0x3a1228;if(_0x41b359['query'][_0xe989('0x3a')]){_0x1c755e[_0xe989('0x3b')]=[{'all':!![]}];}return db[_0xe989('0x25')][_0xe989('0x3c')](_0x1c755e);})[_0xe989('0x1f')](function(_0x5126a5){_0x2570b5[_0xe989('0x3d')]=_0x5126a5;return _0x2570b5;})[_0xe989('0x1f')](respondWithFilteredResult(_0x265a7c,_0x1c755e))['catch'](handleError(_0x265a7c,null));};exports[_0xe989('0x3e')]=function(_0x2bd5e0,_0x312d22){var _0x468fb8={'raw':![],'where':{'id':_0x2bd5e0[_0xe989('0x3f')]['id']}},_0x3d4be0={};_0x3d4be0[_0xe989('0x29')]=_[_0xe989('0x2b')](db[_0xe989('0x25')][_0xe989('0x40')]);_0x3d4be0[_0xe989('0x2a')]=_['keys'](_0x2bd5e0['query']);_0x3d4be0['filters']=_['intersection'](_0x3d4be0[_0xe989('0x29')],_0x3d4be0[_0xe989('0x2a')]);_0x468fb8[_0xe989('0x2d')]=_[_0xe989('0x2c')](_0x3d4be0[_0xe989('0x29')],qs[_0xe989('0x2e')](_0x2bd5e0[_0xe989('0x2a')][_0xe989('0x2e')]));_0x468fb8['attributes']=_0x468fb8[_0xe989('0x2d')]['length']?_0x468fb8[_0xe989('0x2d')]:_0x3d4be0['model'];if(_0x2bd5e0[_0xe989('0x2a')][_0xe989('0x3a')]){_0x468fb8[_0xe989('0x3b')]=[{'all':!![]}];}_0x468fb8=_[_0xe989('0x41')]({},_0x468fb8,_0x2bd5e0[_0xe989('0x39')]);return db[_0xe989('0x25')]['find'](_0x468fb8)[_0xe989('0x1f')](handleEntityNotFound(_0x312d22,null))[_0xe989('0x1f')](respondWithResult(_0x312d22,null))[_0xe989('0x42')](handleError(_0x312d22,null));};exports[_0xe989('0x43')]=function(_0x1c4003,_0x5cf0dd){return db[_0xe989('0x25')][_0xe989('0x43')](_0x1c4003[_0xe989('0x44')],{})[_0xe989('0x1f')](respondWithResult(_0x5cf0dd,0xc9))[_0xe989('0x42')](handleError(_0x5cf0dd,null));};exports[_0xe989('0x45')]=function(_0x3f1970,_0x5d2fb0){if(_0x3f1970['body']['id']){delete _0x3f1970[_0xe989('0x44')]['id'];}return db['VoiceAgentReport'][_0xe989('0x46')]({'where':{'id':_0x3f1970[_0xe989('0x3f')]['id']}})[_0xe989('0x1f')](handleEntityNotFound(_0x5d2fb0,null))[_0xe989('0x1f')](saveUpdates(_0x3f1970[_0xe989('0x44')],null))[_0xe989('0x1f')](respondWithResult(_0x5d2fb0,null))[_0xe989('0x42')](handleError(_0x5d2fb0,null));};exports[_0xe989('0x20')]=function(_0x2e91b6,_0x46864e){return db['VoiceAgentReport'][_0xe989('0x46')]({'where':{'id':_0x2e91b6[_0xe989('0x3f')]['id']}})['then'](handleEntityNotFound(_0x46864e,null))[_0xe989('0x1f')](removeEntity(_0x46864e,null))[_0xe989('0x42')](handleError(_0x46864e,null));};exports['describe']=function(_0x375b76,_0x520ab3){return db[_0xe989('0x25')][_0xe989('0x47')]()['then'](respondWithResult(_0x520ab3,null))[_0xe989('0x42')](handleError(_0x520ab3,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index ff11eec..f716429 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 _0xde71=['lodash','util','../../config/logger','api','moment','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid'];(function(_0xfff9e5,_0x3c4bbb){var _0x1828ca=function(_0x496656){while(--_0x496656){_0xfff9e5['push'](_0xfff9e5['shift']());}};_0x1828ca(++_0x3c4bbb);}(_0xde71,0x155));var _0x1de7=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0xde71[_0x4ac424];return _0xe1b890;};'use strict';var _=require(_0x1de7('0x0'));var util=require(_0x1de7('0x1'));var logger=require(_0x1de7('0x2'))(_0x1de7('0x3'));var moment=require(_0x1de7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1de7('0x5'));var attributes=require(_0x1de7('0x6'));module[_0x1de7('0x7')]=function(_0x135c00,_0x3b167f){return _0x135c00[_0x1de7('0x8')](_0x1de7('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x1de7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b2=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd5b2,0x1f1));var _0x2d5b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd5b2[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x2d5b('0x0'));var util=require(_0x2d5b('0x1'));var logger=require(_0x2d5b('0x2'))(_0x2d5b('0x3'));var moment=require(_0x2d5b('0x4'));var BPromise=require(_0x2d5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d5b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2d5b('0x7'));module['exports']=function(_0x2da8f6,_0x37ce48){return _0x2da8f6[_0x2d5b('0x8')](_0x2d5b('0x9'),attributes,{'tableName':_0x2d5b('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2d5b('0xb'),_0x2d5b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ba6cb65..74b0fe1 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 _0x0ff7=['body','where','attributes','limit','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceAgentReport','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update'];(function(_0x19c317,_0x47d192){var _0x1cd1a8=function(_0x1454bb){while(--_0x1454bb){_0x19c317['push'](_0x19c317['shift']());}};_0x1cd1a8(++_0x47d192);}(_0x0ff7,0xbe));var _0x70ff=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x0ff7[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x70ff('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70ff('0x1'));var db=require(_0x70ff('0x2'))['db'];var utils=require(_0x70ff('0x3'));var logger=require(_0x70ff('0x4'))(_0x70ff('0x5'));var config=require('../../config/environment');var jayson=require(_0x70ff('0x6'));var client=jayson[_0x70ff('0x7')][_0x70ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b7e1e,_0x30ce51,_0x1c6f56){return new BPromise(function(_0xd11b2d,_0x5a0a91){return client[_0x70ff('0x9')](_0x4b7e1e,_0x1c6f56)[_0x70ff('0xa')](function(_0x1e3526){logger[_0x70ff('0xb')](_0x70ff('0xc'),_0x30ce51,_0x70ff('0xd'));logger[_0x70ff('0xe')](_0x70ff('0xf'),_0x30ce51,_0x70ff('0xd'),JSON[_0x70ff('0x10')](_0x1e3526));if(_0x1e3526[_0x70ff('0x11')]){if(_0x1e3526['error'][_0x70ff('0x12')]===0x1f4){logger[_0x70ff('0x11')](_0x70ff('0xc'),_0x30ce51,_0x1e3526[_0x70ff('0x11')]['message']);return _0x5a0a91(_0x1e3526['error'][_0x70ff('0x13')]);}logger['error'](_0x70ff('0xc'),_0x30ce51,_0x1e3526['error'][_0x70ff('0x13')]);return _0xd11b2d(_0x1e3526[_0x70ff('0x11')]['message']);}else{logger[_0x70ff('0xb')](_0x70ff('0xc'),_0x30ce51,'request\x20sent');_0xd11b2d(_0x1e3526['result'][_0x70ff('0x13')]);}})[_0x70ff('0x14')](function(_0x110386){logger['error'](_0x70ff('0xc'),_0x30ce51,_0x110386);_0x5a0a91(_0x110386);});});}exports['CreateVoiceAgentReport']=function(_0x3d5337){var _0x4bdafe=this;return new Promise(function(_0x818da9,_0x4f4606){return db[_0x70ff('0x15')]['create'](_0x3d5337['body'],{'raw':_0x3d5337[_0x70ff('0x16')]?_0x3d5337['options'][_0x70ff('0x17')]===undefined?!![]:![]:!![]})[_0x70ff('0xa')](function(_0x146e0c){logger[_0x70ff('0xb')](_0x70ff('0x18'),_0x3d5337);logger[_0x70ff('0xe')](_0x70ff('0x18'),_0x3d5337,JSON[_0x70ff('0x10')](_0x146e0c));_0x818da9(_0x146e0c);})['catch'](function(_0x516f64){logger['error'](_0x70ff('0x18'),_0x516f64['message'],_0x3d5337);_0x4f4606(_0x4bdafe[_0x70ff('0x11')](0x1f4,_0x516f64['message']));});});};exports[_0x70ff('0x19')]=function(_0x30a47c){var _0x5d5654=this;return new Promise(function(_0x4779f2,_0x53dcfc){return db['VoiceAgentReport'][_0x70ff('0x1a')](_0x30a47c[_0x70ff('0x1b')],{'raw':_0x30a47c[_0x70ff('0x16')]?_0x30a47c['options'][_0x70ff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30a47c[_0x70ff('0x16')]?_0x30a47c[_0x70ff('0x16')][_0x70ff('0x1c')]||null:null,'attributes':_0x30a47c[_0x70ff('0x16')]?_0x30a47c[_0x70ff('0x16')][_0x70ff('0x1d')]||null:null,'limit':_0x30a47c[_0x70ff('0x16')]?_0x30a47c[_0x70ff('0x16')][_0x70ff('0x1e')]||null:null})[_0x70ff('0xa')](function(_0x16a551){logger[_0x70ff('0xb')]('UpdateVoiceAgentReport',_0x30a47c);logger[_0x70ff('0xe')]('UpdateVoiceAgentReport',_0x30a47c,JSON[_0x70ff('0x10')](_0x16a551));_0x4779f2(_0x16a551);})[_0x70ff('0x14')](function(_0x3b6c6d){logger[_0x70ff('0x11')](_0x70ff('0x19'),_0x3b6c6d[_0x70ff('0x13')],_0x30a47c);_0x53dcfc(_0x5d5654[_0x70ff('0x11')](0x1f4,_0x3b6c6d[_0x70ff('0x13')]));});});}; \ No newline at end of file +var _0x907e=['raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','create','body','options','info','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport'];(function(_0x2e3c52,_0x151424){var _0x592f59=function(_0x124830){while(--_0x124830){_0x2e3c52['push'](_0x2e3c52['shift']());}};_0x592f59(++_0x151424);}(_0x907e,0x11b));var _0xe907=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x907e[_0x2ddfd9];return _0x2668f0;};'use strict';var _=require(_0xe907('0x0'));var util=require(_0xe907('0x1'));var moment=require(_0xe907('0x2'));var BPromise=require(_0xe907('0x3'));var rs=require(_0xe907('0x4'));var fs=require('fs');var Redis=require(_0xe907('0x5'));var db=require(_0xe907('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe907('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe907('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a563,_0x1d946e,_0x378fbb){return new BPromise(function(_0x31f8b3,_0x4bc2ac){return client[_0xe907('0x9')](_0x55a563,_0x378fbb)[_0xe907('0xa')](function(_0x933381){logger['info'](_0xe907('0xb'),_0x1d946e,'request\x20sent');logger[_0xe907('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1d946e,_0xe907('0xd'),JSON[_0xe907('0xe')](_0x933381));if(_0x933381['error']){if(_0x933381[_0xe907('0xf')][_0xe907('0x10')]===0x1f4){logger[_0xe907('0xf')](_0xe907('0xb'),_0x1d946e,_0x933381[_0xe907('0xf')][_0xe907('0x11')]);return _0x4bc2ac(_0x933381['error'][_0xe907('0x11')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1d946e,_0x933381[_0xe907('0xf')][_0xe907('0x11')]);return _0x31f8b3(_0x933381[_0xe907('0xf')][_0xe907('0x11')]);}else{logger['info'](_0xe907('0xb'),_0x1d946e,_0xe907('0xd'));_0x31f8b3(_0x933381[_0xe907('0x12')][_0xe907('0x11')]);}})[_0xe907('0x13')](function(_0x3bf81e){logger[_0xe907('0xf')](_0xe907('0xb'),_0x1d946e,_0x3bf81e);_0x4bc2ac(_0x3bf81e);});});}exports['CreateVoiceAgentReport']=function(_0x1f8647){var _0x53b81b=this;return new Promise(function(_0x2b3985,_0x3f00f8){return db['VoiceAgentReport'][_0xe907('0x14')](_0x1f8647[_0xe907('0x15')],{'raw':_0x1f8647[_0xe907('0x16')]?_0x1f8647[_0xe907('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x88c743){logger[_0xe907('0x17')](_0xe907('0x18'),_0x1f8647);logger[_0xe907('0xc')]('CreateVoiceAgentReport',_0x1f8647,JSON['stringify'](_0x88c743));_0x2b3985(_0x88c743);})['catch'](function(_0x414516){logger[_0xe907('0xf')](_0xe907('0x18'),_0x414516['message'],_0x1f8647);_0x3f00f8(_0x53b81b[_0xe907('0xf')](0x1f4,_0x414516[_0xe907('0x11')]));});});};exports[_0xe907('0x19')]=function(_0x11321a){var _0x52cc69=this;return new Promise(function(_0x4aeb7a,_0x357024){return db[_0xe907('0x1a')]['update'](_0x11321a[_0xe907('0x15')],{'raw':_0x11321a[_0xe907('0x16')]?_0x11321a['options'][_0xe907('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11321a[_0xe907('0x16')]?_0x11321a[_0xe907('0x16')][_0xe907('0x1c')]||null:null,'attributes':_0x11321a[_0xe907('0x16')]?_0x11321a[_0xe907('0x16')][_0xe907('0x1d')]||null:null,'limit':_0x11321a[_0xe907('0x16')]?_0x11321a[_0xe907('0x16')][_0xe907('0x1e')]||null:null})[_0xe907('0xa')](function(_0x299fef){logger['info'](_0xe907('0x19'),_0x11321a);logger[_0xe907('0xc')]('UpdateVoiceAgentReport',_0x11321a,JSON[_0xe907('0xe')](_0x299fef));_0x4aeb7a(_0x299fef);})['catch'](function(_0x2f6c45){logger[_0xe907('0xf')](_0xe907('0x19'),_0x2f6c45['message'],_0x11321a);_0x357024(_0x52cc69[_0xe907('0xf')](0x1f4,_0x2f6c45[_0xe907('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 87e6f4a..9182d20 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 _0xc21c=['index','/describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated'];(function(_0x593cfb,_0x56c270){var _0x17b726=function(_0x3d739f){while(--_0x3d739f){_0x593cfb['push'](_0x593cfb['shift']());}};_0x17b726(++_0x56c270);}(_0xc21c,0xdc));var _0xcc21=function(_0x1cade0,_0x2dd15c){_0x1cade0=_0x1cade0-0x0;var _0x386600=_0xc21c[_0x1cade0];return _0x386600;};'use strict';var multer=require(_0xcc21('0x0'));var util=require(_0xcc21('0x1'));var path=require(_0xcc21('0x2'));var timeout=require(_0xcc21('0x3'));var express=require(_0xcc21('0x4'));var router=express[_0xcc21('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcc21('0x6'));var config=require(_0xcc21('0x7'));var controller=require(_0xcc21('0x8'));router[_0xcc21('0x9')]('/',auth[_0xcc21('0xa')](),controller[_0xcc21('0xb')]);router[_0xcc21('0x9')](_0xcc21('0xc'),auth[_0xcc21('0xa')](),controller['describe']);router[_0xcc21('0x9')](_0xcc21('0xd'),auth[_0xcc21('0xa')](),controller[_0xcc21('0xe')]);router[_0xcc21('0xf')]('/',auth[_0xcc21('0xa')](),controller[_0xcc21('0x10')]);router[_0xcc21('0x11')](_0xcc21('0xd'),auth[_0xcc21('0xa')](),controller[_0xcc21('0x12')]);router[_0xcc21('0x13')](_0xcc21('0xd'),auth['isAuthenticated'](),controller[_0xcc21('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2fb2=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x2fb2,0x195));var _0x22fb=function(_0x2b257f,_0x4e6648){_0x2b257f=_0x2b257f-0x0;var _0x42fd53=_0x2fb2[_0x2b257f];return _0x42fd53;};'use strict';var multer=require(_0x22fb('0x0'));var util=require('util');var path=require(_0x22fb('0x1'));var timeout=require(_0x22fb('0x2'));var express=require(_0x22fb('0x3'));var router=express[_0x22fb('0x4')]();var auth=require(_0x22fb('0x5'));var interaction=require(_0x22fb('0x6'));var config=require('../../config/environment');var controller=require(_0x22fb('0x7'));router[_0x22fb('0x8')]('/',auth['isAuthenticated'](),controller[_0x22fb('0x9')]);router[_0x22fb('0x8')](_0x22fb('0xa'),auth[_0x22fb('0xb')](),controller['describe']);router[_0x22fb('0x8')](_0x22fb('0xc'),auth[_0x22fb('0xb')](),controller[_0x22fb('0xd')]);router[_0x22fb('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x22fb('0xf')](_0x22fb('0xc'),auth[_0x22fb('0xb')](),controller[_0x22fb('0x10')]);router[_0x22fb('0x11')](_0x22fb('0xc'),auth[_0x22fb('0xb')](),controller[_0x22fb('0x12')]);module[_0x22fb('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e7bc38d..dc2396e 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 _0x56a4=['STRING','DATE','INTEGER','sequelize','exports','ENUM','inbound','inbound-fax','outbound-fax','dialer'];(function(_0x341406,_0x39946b){var _0x3dc71c=function(_0x303cdb){while(--_0x303cdb){_0x341406['push'](_0x341406['shift']());}};_0x3dc71c(++_0x39946b);}(_0x56a4,0x11b));var _0x456a=function(_0x329a5d,_0x4a886d){_0x329a5d=_0x329a5d-0x0;var _0x56d83d=_0x56a4[_0x329a5d];return _0x56d83d;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x456a('0x2')](_0x456a('0x3'),'internal','outbound',_0x456a('0x4'),_0x456a('0x5'),_0x456a('0x6'))},'tag':{'type':Sequelize[_0x456a('0x7')]},'accountcode':{'type':Sequelize[_0x456a('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x456a('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x456a('0x7')]},'destinationchannel':{'type':Sequelize[_0x456a('0x7')]},'lastapplication':{'type':Sequelize[_0x456a('0x7')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x456a('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x456a('0x8')]},'endtime':{'type':Sequelize[_0x456a('0x8')]},'duration':{'type':Sequelize[_0x456a('0x9')]},'billableseconds':{'type':Sequelize[_0x456a('0x9')]},'mohtime':{'type':Sequelize[_0x456a('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x456a('0x7')]},'amaflags':{'type':Sequelize[_0x456a('0x7')]},'userfield':{'type':Sequelize[_0x456a('0x7')]},'userDisposition':{'type':Sequelize[_0x456a('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x456a('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x456a('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x456a('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a5a=['ENUM','inbound','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x5e67d0,_0x33d135){var _0x2fc26b=function(_0x690675){while(--_0x690675){_0x5e67d0['push'](_0x5e67d0['shift']());}};_0x2fc26b(++_0x33d135);}(_0x9a5a,0x194));var _0xa9a5=function(_0x40294a,_0x50e268){_0x40294a=_0x40294a-0x0;var _0x247632=_0x9a5a[_0x40294a];return _0x247632;};'use strict';var Sequelize=require(_0xa9a5('0x0'));module[_0xa9a5('0x1')]={'uniqueid':{'type':Sequelize[_0xa9a5('0x2')]},'type':{'type':Sequelize[_0xa9a5('0x3')](_0xa9a5('0x4'),'internal',_0xa9a5('0x5'),_0xa9a5('0x6'),_0xa9a5('0x7'),_0xa9a5('0x8'))},'tag':{'type':Sequelize[_0xa9a5('0x2')]},'accountcode':{'type':Sequelize[_0xa9a5('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa9a5('0x2')]},'destinationcontext':{'type':Sequelize[_0xa9a5('0x2')]},'callerid':{'type':Sequelize[_0xa9a5('0x2')]},'channel':{'type':Sequelize[_0xa9a5('0x2')]},'destinationchannel':{'type':Sequelize[_0xa9a5('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xa9a5('0x9')]},'answertime':{'type':Sequelize[_0xa9a5('0x9')]},'endtime':{'type':Sequelize[_0xa9a5('0x9')]},'duration':{'type':Sequelize[_0xa9a5('0xa')]},'billableseconds':{'type':Sequelize[_0xa9a5('0xa')]},'mohtime':{'type':Sequelize[_0xa9a5('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9a5('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xa9a5('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xa9a5('0x2')]},'note':{'type':Sequelize[_0xa9a5('0x2')]},'prefix':{'type':Sequelize[_0xa9a5('0x2')]},'routeid':{'type':Sequelize[_0xa9a5('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 0415a1f..252c3f9 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 _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 84b8abf..c54578f 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 _0x8c48=['uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x1f708e,_0x21018e){var _0x490aa8=function(_0x12e6b6){while(--_0x12e6b6){_0x1f708e['push'](_0x1f708e['shift']());}};_0x490aa8(++_0x21018e);}(_0x8c48,0x14b));var _0x88c4=function(_0xe27b65,_0x5c0f4c){_0xe27b65=_0xe27b65-0x0;var _0x17b420=_0x8c48[_0xe27b65];return _0x17b420;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x88c4('0x0'))(_0x88c4('0x1'));var moment=require(_0x88c4('0x2'));var BPromise=require(_0x88c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88c4('0x4'));var rimraf=require(_0x88c4('0x5'));var config=require('../../config/environment');var attributes=require(_0x88c4('0x6'));module[_0x88c4('0x7')]=function(_0x583c86,_0x2734a6){return _0x583c86[_0x88c4('0x8')](_0x88c4('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x88c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfff=['report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','VoiceCallReport'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xdfff,0x122));var _0xfdff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdff('0x0'));var util=require(_0xfdff('0x1'));var logger=require(_0xfdff('0x2'))(_0xfdff('0x3'));var moment=require(_0xfdff('0x4'));var BPromise=require(_0xfdff('0x5'));var rp=require(_0xfdff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdff('0x7'));var config=require(_0xfdff('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x3dc6dd,_0x302ec0){return _0x3dc6dd['define'](_0xfdff('0x9'),attributes,{'tableName':_0xfdff('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfdff('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1b9bab8..653259c 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 _0x3085=['stringify','error','code','message','catch','GetVoiceCallReport','findAll','options','raw','where','include','map','model','attributes','CreateVoiceCallReport','create','body','VoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0x3085,0x158));var _0x5308=function(_0x334778,_0x3750a8){_0x334778=_0x334778-0x0;var _0x470998=_0x3085[_0x334778];return _0x470998;};'use strict';var _=require(_0x5308('0x0'));var util=require(_0x5308('0x1'));var moment=require(_0x5308('0x2'));var BPromise=require(_0x5308('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5308('0x4'))['db'];var utils=require(_0x5308('0x5'));var logger=require(_0x5308('0x6'))('rpc');var config=require(_0x5308('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5308('0x8')][_0x5308('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be5e0,_0x3e46c1,_0x3e1ad8){return new BPromise(function(_0x30052a,_0x45a07){return client[_0x5308('0xa')](_0x3be5e0,_0x3e1ad8)[_0x5308('0xb')](function(_0xf672a){logger[_0x5308('0xc')](_0x5308('0xd'),_0x3e46c1,_0x5308('0xe'));logger[_0x5308('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3e46c1,_0x5308('0xe'),JSON[_0x5308('0x10')](_0xf672a));if(_0xf672a['error']){if(_0xf672a[_0x5308('0x11')][_0x5308('0x12')]===0x1f4){logger[_0x5308('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3e46c1,_0xf672a[_0x5308('0x11')][_0x5308('0x13')]);return _0x45a07(_0xf672a[_0x5308('0x11')][_0x5308('0x13')]);}logger['error'](_0x5308('0xd'),_0x3e46c1,_0xf672a[_0x5308('0x11')][_0x5308('0x13')]);return _0x30052a(_0xf672a[_0x5308('0x11')][_0x5308('0x13')]);}else{logger[_0x5308('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3e46c1,_0x5308('0xe'));_0x30052a(_0xf672a['result'][_0x5308('0x13')]);}})[_0x5308('0x14')](function(_0x3d6fc0){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3e46c1,_0x3d6fc0);_0x45a07(_0x3d6fc0);});});}exports[_0x5308('0x15')]=function(_0x32c041){var _0x6ae71a=this;return new Promise(function(_0xc38003,_0x27e389){return db['VoiceCallReport'][_0x5308('0x16')]({'raw':_0x32c041['options']?_0x32c041[_0x5308('0x17')][_0x5308('0x18')]===undefined?!![]:![]:!![],'where':_0x32c041[_0x5308('0x17')]?_0x32c041[_0x5308('0x17')][_0x5308('0x19')]||null:null,'attributes':_0x32c041[_0x5308('0x17')]?_0x32c041[_0x5308('0x17')]['attributes']||null:null,'limit':_0x32c041[_0x5308('0x17')]?_0x32c041[_0x5308('0x17')]['limit']||null:null,'include':_0x32c041[_0x5308('0x17')]?_0x32c041[_0x5308('0x17')][_0x5308('0x1a')]?_[_0x5308('0x1b')](_0x32c041[_0x5308('0x17')][_0x5308('0x1a')],function(_0x40f555){return{'model':db[_0x40f555[_0x5308('0x1c')]],'as':_0x40f555['as'],'attributes':_0x40f555[_0x5308('0x1d')],'include':_0x40f555[_0x5308('0x1a')]?_[_0x5308('0x1b')](_0x40f555[_0x5308('0x1a')],function(_0x16219a){return{'model':db[_0x16219a[_0x5308('0x1c')]],'as':_0x16219a['as'],'attributes':_0x16219a[_0x5308('0x1d')],'include':_0x16219a[_0x5308('0x1a')]?_[_0x5308('0x1b')](_0x16219a[_0x5308('0x1a')],function(_0x5d0af8){return{'model':db[_0x5d0af8['model']],'as':_0x5d0af8['as'],'attributes':_0x5d0af8[_0x5308('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5308('0xb')](function(_0x472e26){logger[_0x5308('0xc')]('GetVoiceCallReport',_0x32c041);logger['debug']('GetVoiceCallReport',_0x32c041,JSON[_0x5308('0x10')](_0x472e26));_0xc38003(_0x472e26);})[_0x5308('0x14')](function(_0x441737){logger['error'](_0x5308('0x15'),_0x441737[_0x5308('0x13')],_0x32c041);_0x27e389(_0x6ae71a[_0x5308('0x11')](0x1f4,_0x441737[_0x5308('0x13')]));});});};exports[_0x5308('0x1e')]=function(_0x426d9d){var _0x465eec=this;return new Promise(function(_0x38d723,_0x408c18){return db['VoiceCallReport'][_0x5308('0x1f')](_0x426d9d[_0x5308('0x20')],{'raw':_0x426d9d[_0x5308('0x17')]?_0x426d9d[_0x5308('0x17')][_0x5308('0x18')]===undefined?!![]:![]:!![]})[_0x5308('0xb')](function(_0xd9d106){logger[_0x5308('0xc')](_0x5308('0x1e'),_0x426d9d);logger[_0x5308('0xf')](_0x5308('0x1e'),_0x426d9d,JSON['stringify'](_0xd9d106));_0x38d723(_0xd9d106);})[_0x5308('0x14')](function(_0x5b83b5){logger[_0x5308('0x11')](_0x5308('0x1e'),_0x5b83b5['message'],_0x426d9d);_0x408c18(_0x465eec['error'](0x1f4,_0x5b83b5[_0x5308('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x3df42c){var _0x152d4f=this;return new Promise(function(_0x3d09e1,_0x5d7c1a){return db[_0x5308('0x21')][_0x5308('0x22')](_0x3df42c[_0x5308('0x20')],{'raw':_0x3df42c['options']?_0x3df42c[_0x5308('0x17')][_0x5308('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3df42c[_0x5308('0x17')]?_0x3df42c['options'][_0x5308('0x19')]||null:null,'attributes':_0x3df42c['options']?_0x3df42c[_0x5308('0x17')]['attributes']||null:null,'limit':_0x3df42c['options']?_0x3df42c[_0x5308('0x17')]['limit']||null:null})[_0x5308('0xb')](function(_0x3a83bd){logger[_0x5308('0xc')](_0x5308('0x23'),_0x3df42c);logger[_0x5308('0xf')](_0x5308('0x23'),_0x3df42c,JSON[_0x5308('0x10')](_0x3a83bd));_0x3d09e1(_0x3a83bd);})[_0x5308('0x14')](function(_0x449348){logger[_0x5308('0x11')](_0x5308('0x23'),_0x449348[_0x5308('0x13')],_0x3df42c);_0x5d7c1a(_0x152d4f[_0x5308('0x11')](0x1f4,_0x449348[_0x5308('0x13')]));});});}; \ No newline at end of file +var _0xc98d=['http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0xc98d,0x66));var _0xdc98=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xc98d[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0xdc98('0x0'));var util=require(_0xdc98('0x1'));var moment=require(_0xdc98('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc98('0x4'))['db'];var utils=require(_0xdc98('0x5'));var logger=require(_0xdc98('0x6'))(_0xdc98('0x7'));var config=require(_0xdc98('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a8a88,_0x3bafea,_0x469bf5){return new BPromise(function(_0x17ef25,_0x570301){return client[_0xdc98('0xa')](_0x1a8a88,_0x469bf5)[_0xdc98('0xb')](function(_0x5e521f){logger[_0xdc98('0xc')](_0xdc98('0xd'),_0x3bafea,_0xdc98('0xe'));logger[_0xdc98('0xf')](_0xdc98('0x10'),_0x3bafea,_0xdc98('0xe'),JSON[_0xdc98('0x11')](_0x5e521f));if(_0x5e521f['error']){if(_0x5e521f[_0xdc98('0x12')]['code']===0x1f4){logger[_0xdc98('0x12')](_0xdc98('0xd'),_0x3bafea,_0x5e521f[_0xdc98('0x12')][_0xdc98('0x13')]);return _0x570301(_0x5e521f[_0xdc98('0x12')]['message']);}logger[_0xdc98('0x12')](_0xdc98('0xd'),_0x3bafea,_0x5e521f[_0xdc98('0x12')][_0xdc98('0x13')]);return _0x17ef25(_0x5e521f[_0xdc98('0x12')]['message']);}else{logger[_0xdc98('0xc')](_0xdc98('0xd'),_0x3bafea,_0xdc98('0xe'));_0x17ef25(_0x5e521f[_0xdc98('0x14')][_0xdc98('0x13')]);}})[_0xdc98('0x15')](function(_0x1fa9fa){logger[_0xdc98('0x12')](_0xdc98('0xd'),_0x3bafea,_0x1fa9fa);_0x570301(_0x1fa9fa);});});}exports[_0xdc98('0x16')]=function(_0x32b145){var _0x75e4b=this;return new Promise(function(_0x5bea4e,_0xbb44c9){return db[_0xdc98('0x17')]['findAll']({'raw':_0x32b145[_0xdc98('0x18')]?_0x32b145['options'][_0xdc98('0x19')]===undefined?!![]:![]:!![],'where':_0x32b145['options']?_0x32b145[_0xdc98('0x18')][_0xdc98('0x1a')]||null:null,'attributes':_0x32b145['options']?_0x32b145[_0xdc98('0x18')][_0xdc98('0x1b')]||null:null,'limit':_0x32b145[_0xdc98('0x18')]?_0x32b145['options'][_0xdc98('0x1c')]||null:null,'include':_0x32b145[_0xdc98('0x18')]?_0x32b145[_0xdc98('0x18')][_0xdc98('0x1d')]?_[_0xdc98('0x1e')](_0x32b145['options']['include'],function(_0x442aee){return{'model':db[_0x442aee[_0xdc98('0x1f')]],'as':_0x442aee['as'],'attributes':_0x442aee['attributes'],'include':_0x442aee[_0xdc98('0x1d')]?_['map'](_0x442aee['include'],function(_0x57bacc){return{'model':db[_0x57bacc[_0xdc98('0x1f')]],'as':_0x57bacc['as'],'attributes':_0x57bacc[_0xdc98('0x1b')],'include':_0x57bacc[_0xdc98('0x1d')]?_[_0xdc98('0x1e')](_0x57bacc[_0xdc98('0x1d')],function(_0x54a954){return{'model':db[_0x54a954[_0xdc98('0x1f')]],'as':_0x54a954['as'],'attributes':_0x54a954[_0xdc98('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52cb53){logger[_0xdc98('0xc')](_0xdc98('0x16'),_0x32b145);logger[_0xdc98('0xf')](_0xdc98('0x16'),_0x32b145,JSON['stringify'](_0x52cb53));_0x5bea4e(_0x52cb53);})[_0xdc98('0x15')](function(_0x51e94d){logger[_0xdc98('0x12')](_0xdc98('0x16'),_0x51e94d[_0xdc98('0x13')],_0x32b145);_0xbb44c9(_0x75e4b[_0xdc98('0x12')](0x1f4,_0x51e94d['message']));});});};exports['CreateVoiceCallReport']=function(_0x2dcd7f){var _0x57ad38=this;return new Promise(function(_0x481f19,_0x4fead5){return db[_0xdc98('0x17')][_0xdc98('0x20')](_0x2dcd7f[_0xdc98('0x21')],{'raw':_0x2dcd7f[_0xdc98('0x18')]?_0x2dcd7f[_0xdc98('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c11c9){logger[_0xdc98('0xc')](_0xdc98('0x22'),_0x2dcd7f);logger[_0xdc98('0xf')]('CreateVoiceCallReport',_0x2dcd7f,JSON[_0xdc98('0x11')](_0x2c11c9));_0x481f19(_0x2c11c9);})[_0xdc98('0x15')](function(_0x4951b1){logger[_0xdc98('0x12')]('CreateVoiceCallReport',_0x4951b1[_0xdc98('0x13')],_0x2dcd7f);_0x4fead5(_0x57ad38[_0xdc98('0x12')](0x1f4,_0x4951b1[_0xdc98('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x333e9a){var _0x9ebe0f=this;return new Promise(function(_0x2fec1f,_0x58df62){return db[_0xdc98('0x17')][_0xdc98('0x23')](_0x333e9a[_0xdc98('0x21')],{'raw':_0x333e9a[_0xdc98('0x18')]?_0x333e9a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x333e9a['options']?_0x333e9a[_0xdc98('0x18')][_0xdc98('0x1a')]||null:null,'attributes':_0x333e9a['options']?_0x333e9a['options'][_0xdc98('0x1b')]||null:null,'limit':_0x333e9a[_0xdc98('0x18')]?_0x333e9a['options'][_0xdc98('0x1c')]||null:null})[_0xdc98('0xb')](function(_0x23bea7){logger[_0xdc98('0xc')](_0xdc98('0x24'),_0x333e9a);logger['debug'](_0xdc98('0x24'),_0x333e9a,JSON[_0xdc98('0x11')](_0x23bea7));_0x2fec1f(_0x23bea7);})[_0xdc98('0x15')](function(_0x3e6616){logger['error']('UpdateVoiceCallReport',_0x3e6616['message'],_0x333e9a);_0x58df62(_0x9ebe0f[_0xdc98('0x12')](0x1f4,_0x3e6616[_0xdc98('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 872b778..6d09df6 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 _0xc17f=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','post','put','/:id','delete'];(function(_0x5f0ba5,_0x269b28){var _0x1ff178=function(_0xe1b9b1){while(--_0xe1b9b1){_0x5f0ba5['push'](_0x5f0ba5['shift']());}};_0x1ff178(++_0x269b28);}(_0xc17f,0x155));var _0xfc17=function(_0x30b3bb,_0x3530b9){_0x30b3bb=_0x30b3bb-0x0;var _0xd22413=_0xc17f[_0x30b3bb];return _0xd22413;};'use strict';var multer=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var path=require(_0xfc17('0x2'));var timeout=require(_0xfc17('0x3'));var express=require(_0xfc17('0x4'));var router=express[_0xfc17('0x5')]();var auth=require(_0xfc17('0x6'));var interaction=require(_0xfc17('0x7'));var config=require(_0xfc17('0x8'));var controller=require(_0xfc17('0x9'));router[_0xfc17('0xa')]('/',auth[_0xfc17('0xb')](),controller['index']);router['get']('/:id',auth[_0xfc17('0xb')](),controller['show']);router[_0xfc17('0xc')]('/',auth[_0xfc17('0xb')](),controller['create']);router[_0xfc17('0xd')](_0xfc17('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xfc17('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfc17('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7ee9=['show','post','create','put','/:id','update','delete','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x1d23d8,_0x2427c3){var _0x4730e6=function(_0xbed46){while(--_0xbed46){_0x1d23d8['push'](_0x1d23d8['shift']());}};_0x4730e6(++_0x2427c3);}(_0x7ee9,0x115));var _0x97ee=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0x7ee9[_0x1103c4];return _0x1c19ab;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x97ee('0x0'));var express=require('express');var router=express[_0x97ee('0x1')]();var auth=require(_0x97ee('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x97ee('0x3'));var controller=require(_0x97ee('0x4'));router[_0x97ee('0x5')]('/',auth[_0x97ee('0x6')](),controller[_0x97ee('0x7')]);router[_0x97ee('0x5')]('/:id',auth[_0x97ee('0x6')](),controller[_0x97ee('0x8')]);router[_0x97ee('0x9')]('/',auth[_0x97ee('0x6')](),controller[_0x97ee('0xa')]);router[_0x97ee('0xb')](_0x97ee('0xc'),auth[_0x97ee('0x6')](),controller[_0x97ee('0xd')]);router[_0x97ee('0xe')](_0x97ee('0xc'),auth['isAuthenticated'](),controller['destroy']);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 a275368..492731a 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 _0x4617=['BOOLEAN','sequelize','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x3bd851,_0x1ab5bf){var _0x100576=function(_0x2e9eed){while(--_0x2e9eed){_0x3bd851['push'](_0x3bd851['shift']());}};_0x100576(++_0x1ab5bf);}(_0x4617,0xb1));var _0x7461=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4617[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x7461('0x0'));module['exports']={'name':{'type':Sequelize[_0x7461('0x1')]},'prefix':{'type':Sequelize[_0x7461('0x1')],'unique':_0x7461('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7461('0x1')],'set':function(_0x9eb4c){this[_0x7461('0x3')](_0x7461('0x4'),_0x9eb4c?_0x9eb4c['join'](''):[]);},'get':function(){return this[_0x7461('0x5')](_0x7461('0x4'))?this['getDataValue']('options')[_0x7461('0x6')](''):[];}},'auth':{'type':Sequelize[_0x7461('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x7461('0x1')]},'record':{'type':Sequelize[_0x7461('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7461('0x1')]}}; \ No newline at end of file +var _0xb276=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb276,0x1bb));var _0x6b27=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0xb276[_0xe896bf];return _0x4c7a8a;};'use strict';var Sequelize=require('sequelize');module[_0x6b27('0x0')]={'name':{'type':Sequelize[_0x6b27('0x1')]},'prefix':{'type':Sequelize[_0x6b27('0x1')],'unique':_0x6b27('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x6b27('0x1')],'set':function(_0x4613ac){this[_0x6b27('0x3')](_0x6b27('0x4'),_0x4613ac?_0x4613ac[_0x6b27('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x6b27('0x4'))?this[_0x6b27('0x6')](_0x6b27('0x4'))[_0x6b27('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6b27('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6b27('0x1')]},'record':{'type':Sequelize[_0x6b27('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8c0c79a..573d392 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 _0x632a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation'];(function(_0x2e80ce,_0x1762ae){var _0xd822a3=function(_0x1ef6f9){while(--_0x1ef6f9){_0x2e80ce['push'](_0x2e80ce['shift']());}};_0xd822a3(++_0x1762ae);}(_0x632a,0x14d));var _0xa632=function(_0x436ed5,_0xb0e510){_0x436ed5=_0x436ed5-0x0;var _0x59e004=_0x632a[_0x436ed5];return _0x59e004;};'use strict';var pdf=require(_0xa632('0x0'));var emlformat=require(_0xa632('0x1'));var rimraf=require(_0xa632('0x2'));var zipdir=require(_0xa632('0x3'));var jsonpatch=require(_0xa632('0x4'));var rp=require(_0xa632('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa632('0x6'));var util=require(_0xa632('0x7'));var path=require(_0xa632('0x8'));var sox=require(_0xa632('0x9'));var csv=require(_0xa632('0xa'));var ejs=require(_0xa632('0xb'));var fs=require('fs');var _=require(_0xa632('0xc'));var squel=require(_0xa632('0xd'));var crypto=require(_0xa632('0xe'));var jsforce=require(_0xa632('0xf'));var deskjs=require(_0xa632('0x10'));var toCsv=require(_0xa632('0xa'));var querystring=require('querystring');var Papa=require(_0xa632('0x11'));var Redis=require(_0xa632('0x12'));var authService=require(_0xa632('0x13'));var qs=require(_0xa632('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa632('0x15'))(_0xa632('0x16'));var utils=require(_0xa632('0x17'));var config=require(_0xa632('0x18'));var licenseUtil=require(_0xa632('0x19'));var db=require(_0xa632('0x1a'))['db'];function respondWithStatusCode(_0x41a501,_0x1f3393){_0x1f3393=_0x1f3393||0xcc;return function(_0x30dbcf){if(_0x30dbcf){return _0x41a501[_0xa632('0x1b')](_0x1f3393);}return _0x41a501[_0xa632('0x1c')](_0x1f3393)[_0xa632('0x1d')]();};}function respondWithResult(_0x3c78b8,_0x39a1a9){_0x39a1a9=_0x39a1a9||0xc8;return function(_0x1d5c5a){if(_0x1d5c5a){return _0x3c78b8[_0xa632('0x1c')](_0x39a1a9)[_0xa632('0x1e')](_0x1d5c5a);}};}function respondWithFilteredResult(_0x1709b0,_0x4ecc4f){return function(_0x1086cf){if(_0x1086cf){var _0x58a51d=_0x1086cf[_0xa632('0x1f')],_0x20c4f3=_0x4ecc4f[_0xa632('0x20')],_0x555a83=_0x4ecc4f[_0xa632('0x20')]+_0x4ecc4f[_0xa632('0x21')],_0x3e5346;if(_0x555a83>=_0x58a51d){_0x555a83=_0x58a51d;_0x3e5346=0xc8;}else{_0x3e5346=0xce;}_0x1709b0['status'](_0x3e5346);return _0x1709b0['set'](_0xa632('0x22'),_0x20c4f3+'-'+_0x555a83+'/'+_0x58a51d)['json'](_0x1086cf);}return null;};}function patchUpdates(_0x876947){return function(_0x2b5c2f){try{jsonpatch[_0xa632('0x23')](_0x2b5c2f,_0x876947,!![]);}catch(_0x389807){return BPromise[_0xa632('0x24')](_0x389807);}return _0x2b5c2f[_0xa632('0x25')]();};}function saveUpdates(_0x54492a,_0x1cf430){return function(_0x208946){if(_0x208946){return _0x208946[_0xa632('0x26')](_0x54492a)[_0xa632('0x27')](function(_0x52429a){return _0x52429a;});}return null;};}function removeEntity(_0x7f4afd,_0x5ca356){return function(_0x94222b){if(_0x94222b){return _0x94222b['destroy']()[_0xa632('0x27')](function(){var _0x2b859f=_0x94222b[_0xa632('0x28')]({'plain':!![]});var _0x340189=_0xa632('0x29');return db[_0xa632('0x2a')][_0xa632('0x2b')]({'where':{'type':_0x340189,'resourceId':_0x2b859f['id']}})[_0xa632('0x27')](function(){return _0x94222b;});})[_0xa632('0x27')](function(){_0x7f4afd['status'](0xcc)[_0xa632('0x1d')]();});}};}function handleEntityNotFound(_0x358c1a,_0xc4f025){return function(_0x2a348e){if(!_0x2a348e){_0x358c1a[_0xa632('0x1b')](0x194);}return _0x2a348e;};}function handleError(_0x126b74,_0x48fb9e){_0x48fb9e=_0x48fb9e||0x1f4;return function(_0x51a971){logger[_0xa632('0x2c')](_0x51a971['stack']);if(_0x51a971[_0xa632('0x2d')]){delete _0x51a971[_0xa632('0x2d')];}_0x126b74['status'](_0x48fb9e)[_0xa632('0x2e')](_0x51a971);};}exports[_0xa632('0x2f')]=function(_0x3bac10,_0x570dcf){var _0x8264db={},_0x4f93fa={},_0x53ce17={'count':0x0,'rows':[]};var _0x28bb13=_[_0xa632('0x30')](db[_0xa632('0x31')][_0xa632('0x32')],function(_0x2c29c2){return{'name':_0x2c29c2[_0xa632('0x33')],'type':_0x2c29c2[_0xa632('0x34')][_0xa632('0x35')]};});_0x4f93fa[_0xa632('0x36')]=_[_0xa632('0x30')](_0x28bb13,_0xa632('0x2d'));_0x4f93fa[_0xa632('0x37')]=_['keys'](_0x3bac10['query']);_0x4f93fa[_0xa632('0x38')]=_[_0xa632('0x39')](_0x4f93fa[_0xa632('0x36')],_0x4f93fa['query']);_0x8264db[_0xa632('0x3a')]=_[_0xa632('0x39')](_0x4f93fa[_0xa632('0x36')],qs[_0xa632('0x3b')](_0x3bac10[_0xa632('0x37')][_0xa632('0x3b')]));_0x8264db[_0xa632('0x3a')]=_0x8264db[_0xa632('0x3a')][_0xa632('0x3c')]?_0x8264db[_0xa632('0x3a')]:_0x4f93fa[_0xa632('0x36')];if(!_0x3bac10[_0xa632('0x37')][_0xa632('0x3d')](_0xa632('0x3e'))){_0x8264db[_0xa632('0x21')]=qs[_0xa632('0x21')](_0x3bac10[_0xa632('0x37')][_0xa632('0x21')]);_0x8264db[_0xa632('0x20')]=qs[_0xa632('0x20')](_0x3bac10['query']['offset']);}_0x8264db['order']=qs[_0xa632('0x3f')](_0x3bac10[_0xa632('0x37')][_0xa632('0x3f')]);_0x8264db[_0xa632('0x40')]=qs[_0xa632('0x38')](_[_0xa632('0x41')](_0x3bac10[_0xa632('0x37')],_0x4f93fa[_0xa632('0x38')]),_0x28bb13);if(_0x3bac10[_0xa632('0x37')][_0xa632('0x42')]){_0x8264db['where']=_[_0xa632('0x43')](_0x8264db[_0xa632('0x40')],{'$or':_[_0xa632('0x30')](_0x28bb13,function(_0x10b330){if(_0x10b330['type']!=='VIRTUAL'){var _0xc9feda={};_0xc9feda[_0x10b330['name']]={'$like':'%'+_0x3bac10[_0xa632('0x37')][_0xa632('0x42')]+'%'};return _0xc9feda;}})});}_0x8264db=_[_0xa632('0x43')]({},_0x8264db,_0x3bac10[_0xa632('0x44')]);var _0x590253={'where':_0x8264db[_0xa632('0x40')]};return db['VoiceChanSpy'][_0xa632('0x1f')](_0x590253)[_0xa632('0x27')](function(_0x2c2cc7){_0x53ce17['count']=_0x2c2cc7;if(_0x3bac10['query']['includeAll']){_0x8264db[_0xa632('0x45')]=[{'all':!![]}];}return db[_0xa632('0x31')][_0xa632('0x46')](_0x8264db);})[_0xa632('0x27')](function(_0x1f2224){_0x53ce17[_0xa632('0x47')]=_0x1f2224;return _0x53ce17;})[_0xa632('0x27')](respondWithFilteredResult(_0x570dcf,_0x8264db))[_0xa632('0x48')](handleError(_0x570dcf,null));};exports['show']=function(_0x34e7fe,_0x32cf15){var _0x561848={'raw':![],'where':{'id':_0x34e7fe[_0xa632('0x49')]['id']}},_0x32a3bb={};_0x32a3bb[_0xa632('0x36')]=_[_0xa632('0x4a')](db['VoiceChanSpy']['rawAttributes']);_0x32a3bb[_0xa632('0x37')]=_['keys'](_0x34e7fe[_0xa632('0x37')]);_0x32a3bb[_0xa632('0x38')]=_[_0xa632('0x39')](_0x32a3bb['model'],_0x32a3bb[_0xa632('0x37')]);_0x561848['attributes']=_[_0xa632('0x39')](_0x32a3bb['model'],qs[_0xa632('0x3b')](_0x34e7fe['query'][_0xa632('0x3b')]));_0x561848[_0xa632('0x3a')]=_0x561848[_0xa632('0x3a')][_0xa632('0x3c')]?_0x561848[_0xa632('0x3a')]:_0x32a3bb[_0xa632('0x36')];if(_0x34e7fe[_0xa632('0x37')]['includeAll']){_0x561848[_0xa632('0x45')]=[{'all':!![]}];}_0x561848=_[_0xa632('0x43')]({},_0x561848,_0x34e7fe[_0xa632('0x44')]);return db[_0xa632('0x31')]['find'](_0x561848)[_0xa632('0x27')](handleEntityNotFound(_0x32cf15,null))['then'](respondWithResult(_0x32cf15,null))[_0xa632('0x48')](handleError(_0x32cf15,null));};exports[_0xa632('0x4b')]=function(_0x5a8676,_0x14949f){return db[_0xa632('0x31')][_0xa632('0x4b')](_0x5a8676[_0xa632('0x4c')],{})[_0xa632('0x27')](function(_0x6b7c2){var _0x5a62c2=_0x5a8676[_0xa632('0x4d')][_0xa632('0x28')]({'plain':!![]});if(!_0x5a62c2)throw new Error(_0xa632('0x4e'));if(_0x5a62c2[_0xa632('0x4f')]===_0xa632('0x4d')){var _0x40683a=_0x6b7c2[_0xa632('0x28')]({'plain':!![]});var _0x1749dd=_0xa632('0x29');return db['UserProfileSection'][_0xa632('0x50')]({'where':{'name':_0x1749dd,'userProfileId':_0x5a62c2['userProfileId']},'raw':!![]})[_0xa632('0x27')](function(_0x421830){if(_0x421830&&_0x421830[_0xa632('0x51')]===0x0){return db[_0xa632('0x2a')][_0xa632('0x4b')]({'name':_0x40683a[_0xa632('0x2d')],'resourceId':_0x40683a['id'],'type':_0x421830['name'],'sectionId':_0x421830['id']},{})[_0xa632('0x27')](function(){return _0x6b7c2;});}else{return _0x6b7c2;}})['catch'](function(_0x3b688f){logger['error'](_0xa632('0x52'),_0x3b688f);throw _0x3b688f;});}return _0x6b7c2;})[_0xa632('0x27')](respondWithResult(_0x14949f,0xc9))[_0xa632('0x48')](handleError(_0x14949f,null));};exports['update']=function(_0x20c58d,_0x5e3882){if(_0x20c58d[_0xa632('0x4c')]['id']){delete _0x20c58d[_0xa632('0x4c')]['id'];}return db[_0xa632('0x31')][_0xa632('0x50')]({'where':{'id':_0x20c58d['params']['id']}})[_0xa632('0x27')](handleEntityNotFound(_0x5e3882,null))[_0xa632('0x27')](saveUpdates(_0x20c58d[_0xa632('0x4c')],null))[_0xa632('0x27')](respondWithResult(_0x5e3882,null))[_0xa632('0x48')](handleError(_0x5e3882,null));};exports[_0xa632('0x2b')]=function(_0x44d429,_0x14916a){return db[_0xa632('0x31')]['find']({'where':{'id':_0x44d429[_0xa632('0x49')]['id']}})[_0xa632('0x27')](handleEntityNotFound(_0x14916a,null))[_0xa632('0x27')](removeEntity(_0x14916a,null))[_0xa632('0x48')](handleError(_0x14916a,null));}; \ No newline at end of file +var _0xc7bf=['bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','get','ChanSpies','sendStatus','error','name','index','map','fieldName','key','keys','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','where','filters','pick','merge','type','filter','count','includeAll','include','VoiceChanSpy','findAll','rows','catch','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','zip-dir','fast-json-patch','request-promise'];(function(_0x4a9801,_0x548afb){var _0x2b089a=function(_0x4b4074){while(--_0x4b4074){_0x4a9801['push'](_0x4a9801['shift']());}};_0x2b089a(++_0x548afb);}(_0xc7bf,0x83));var _0xfc7b=function(_0x3a6c59,_0x10dee7){_0x3a6c59=_0x3a6c59-0x0;var _0x3926e8=_0xc7bf[_0x3a6c59];return _0x3926e8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc7b('0x0'));var jsonpatch=require(_0xfc7b('0x1'));var rp=require(_0xfc7b('0x2'));var moment=require('moment');var BPromise=require(_0xfc7b('0x3'));var Mustache=require(_0xfc7b('0x4'));var util=require(_0xfc7b('0x5'));var path=require('path');var sox=require(_0xfc7b('0x6'));var csv=require('to-csv');var ejs=require(_0xfc7b('0x7'));var fs=require('fs');var _=require(_0xfc7b('0x8'));var squel=require('squel');var crypto=require(_0xfc7b('0x9'));var jsforce=require(_0xfc7b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfc7b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfc7b('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc7b('0xd'));var logger=require(_0xfc7b('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xfc7b('0xf'));var licenseUtil=require(_0xfc7b('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11484c,_0x1032e0){_0x1032e0=_0x1032e0||0xcc;return function(_0x56fe08){if(_0x56fe08){return _0x11484c['sendStatus'](_0x1032e0);}return _0x11484c[_0xfc7b('0x11')](_0x1032e0)[_0xfc7b('0x12')]();};}function respondWithResult(_0x5a1f56,_0x2c061c){_0x2c061c=_0x2c061c||0xc8;return function(_0x4f8e81){if(_0x4f8e81){return _0x5a1f56[_0xfc7b('0x11')](_0x2c061c)[_0xfc7b('0x13')](_0x4f8e81);}};}function respondWithFilteredResult(_0x344055,_0x2e197b){return function(_0x2391b5){if(_0x2391b5){var _0x1e9250=_0x2391b5['count'],_0x1826ba=_0x2e197b[_0xfc7b('0x14')],_0x7a13f9=_0x2e197b[_0xfc7b('0x14')]+_0x2e197b[_0xfc7b('0x15')],_0x267883;if(_0x7a13f9>=_0x1e9250){_0x7a13f9=_0x1e9250;_0x267883=0xc8;}else{_0x267883=0xce;}_0x344055['status'](_0x267883);return _0x344055['set'](_0xfc7b('0x16'),_0x1826ba+'-'+_0x7a13f9+'/'+_0x1e9250)[_0xfc7b('0x13')](_0x2391b5);}return null;};}function patchUpdates(_0x567a03){return function(_0x5eb2b9){try{jsonpatch['apply'](_0x5eb2b9,_0x567a03,!![]);}catch(_0x16c17c){return BPromise[_0xfc7b('0x17')](_0x16c17c);}return _0x5eb2b9['save']();};}function saveUpdates(_0x260368,_0x3187ff){return function(_0x4c464e){if(_0x4c464e){return _0x4c464e[_0xfc7b('0x18')](_0x260368)[_0xfc7b('0x19')](function(_0x5c3a13){return _0x5c3a13;});}return null;};}function removeEntity(_0x1d3ad4,_0x31ce2a){return function(_0x3d66e4){if(_0x3d66e4){return _0x3d66e4[_0xfc7b('0x1a')]()[_0xfc7b('0x19')](function(){var _0x5fe509=_0x3d66e4[_0xfc7b('0x1b')]({'plain':!![]});var _0x557422=_0xfc7b('0x1c');return db['UserProfileResource']['destroy']({'where':{'type':_0x557422,'resourceId':_0x5fe509['id']}})[_0xfc7b('0x19')](function(){return _0x3d66e4;});})[_0xfc7b('0x19')](function(){_0x1d3ad4['status'](0xcc)[_0xfc7b('0x12')]();});}};}function handleEntityNotFound(_0x128e0b,_0x1dc752){return function(_0x3e39ec){if(!_0x3e39ec){_0x128e0b[_0xfc7b('0x1d')](0x194);}return _0x3e39ec;};}function handleError(_0x52ae51,_0x557f74){_0x557f74=_0x557f74||0x1f4;return function(_0x2cbef9){logger[_0xfc7b('0x1e')](_0x2cbef9['stack']);if(_0x2cbef9['name']){delete _0x2cbef9[_0xfc7b('0x1f')];}_0x52ae51['status'](_0x557f74)['send'](_0x2cbef9);};}exports[_0xfc7b('0x20')]=function(_0x15c941,_0x367691){var _0x37f4ba={},_0x36fdbb={},_0x35a6c3={'count':0x0,'rows':[]};var _0x182867=_[_0xfc7b('0x21')](db['VoiceChanSpy']['rawAttributes'],function(_0x5f202f){return{'name':_0x5f202f[_0xfc7b('0x22')],'type':_0x5f202f['type'][_0xfc7b('0x23')]};});_0x36fdbb['model']=_[_0xfc7b('0x21')](_0x182867,_0xfc7b('0x1f'));_0x36fdbb['query']=_[_0xfc7b('0x24')](_0x15c941['query']);_0x36fdbb['filters']=_[_0xfc7b('0x25')](_0x36fdbb['model'],_0x36fdbb[_0xfc7b('0x26')]);_0x37f4ba[_0xfc7b('0x27')]=_[_0xfc7b('0x25')](_0x36fdbb[_0xfc7b('0x28')],qs[_0xfc7b('0x29')](_0x15c941[_0xfc7b('0x26')][_0xfc7b('0x29')]));_0x37f4ba[_0xfc7b('0x27')]=_0x37f4ba[_0xfc7b('0x27')]['length']?_0x37f4ba[_0xfc7b('0x27')]:_0x36fdbb['model'];if(!_0x15c941[_0xfc7b('0x26')][_0xfc7b('0x2a')](_0xfc7b('0x2b'))){_0x37f4ba[_0xfc7b('0x15')]=qs[_0xfc7b('0x15')](_0x15c941['query'][_0xfc7b('0x15')]);_0x37f4ba[_0xfc7b('0x14')]=qs[_0xfc7b('0x14')](_0x15c941[_0xfc7b('0x26')]['offset']);}_0x37f4ba['order']=qs['sort'](_0x15c941[_0xfc7b('0x26')]['sort']);_0x37f4ba[_0xfc7b('0x2c')]=qs[_0xfc7b('0x2d')](_[_0xfc7b('0x2e')](_0x15c941[_0xfc7b('0x26')],_0x36fdbb['filters']),_0x182867);if(_0x15c941['query']['filter']){_0x37f4ba['where']=_[_0xfc7b('0x2f')](_0x37f4ba[_0xfc7b('0x2c')],{'$or':_[_0xfc7b('0x21')](_0x182867,function(_0x3412a7){if(_0x3412a7[_0xfc7b('0x30')]!=='VIRTUAL'){var _0x15b1ee={};_0x15b1ee[_0x3412a7[_0xfc7b('0x1f')]]={'$like':'%'+_0x15c941['query'][_0xfc7b('0x31')]+'%'};return _0x15b1ee;}})});}_0x37f4ba=_['merge']({},_0x37f4ba,_0x15c941['options']);var _0x21480f={'where':_0x37f4ba[_0xfc7b('0x2c')]};return db['VoiceChanSpy']['count'](_0x21480f)[_0xfc7b('0x19')](function(_0x275b5c){_0x35a6c3[_0xfc7b('0x32')]=_0x275b5c;if(_0x15c941['query'][_0xfc7b('0x33')]){_0x37f4ba[_0xfc7b('0x34')]=[{'all':!![]}];}return db[_0xfc7b('0x35')][_0xfc7b('0x36')](_0x37f4ba);})[_0xfc7b('0x19')](function(_0x595e1e){_0x35a6c3[_0xfc7b('0x37')]=_0x595e1e;return _0x35a6c3;})['then'](respondWithFilteredResult(_0x367691,_0x37f4ba))[_0xfc7b('0x38')](handleError(_0x367691,null));};exports['show']=function(_0x3726fd,_0x49c4f3){var _0x432610={'raw':![],'where':{'id':_0x3726fd[_0xfc7b('0x39')]['id']}},_0x16106a={};_0x16106a[_0xfc7b('0x28')]=_[_0xfc7b('0x24')](db[_0xfc7b('0x35')][_0xfc7b('0x3a')]);_0x16106a['query']=_[_0xfc7b('0x24')](_0x3726fd[_0xfc7b('0x26')]);_0x16106a[_0xfc7b('0x2d')]=_[_0xfc7b('0x25')](_0x16106a[_0xfc7b('0x28')],_0x16106a['query']);_0x432610[_0xfc7b('0x27')]=_[_0xfc7b('0x25')](_0x16106a[_0xfc7b('0x28')],qs[_0xfc7b('0x29')](_0x3726fd[_0xfc7b('0x26')][_0xfc7b('0x29')]));_0x432610['attributes']=_0x432610['attributes'][_0xfc7b('0x3b')]?_0x432610[_0xfc7b('0x27')]:_0x16106a[_0xfc7b('0x28')];if(_0x3726fd[_0xfc7b('0x26')][_0xfc7b('0x33')]){_0x432610[_0xfc7b('0x34')]=[{'all':!![]}];}_0x432610=_[_0xfc7b('0x2f')]({},_0x432610,_0x3726fd['options']);return db[_0xfc7b('0x35')][_0xfc7b('0x3c')](_0x432610)[_0xfc7b('0x19')](handleEntityNotFound(_0x49c4f3,null))[_0xfc7b('0x19')](respondWithResult(_0x49c4f3,null))[_0xfc7b('0x38')](handleError(_0x49c4f3,null));};exports[_0xfc7b('0x3d')]=function(_0x3ed6c0,_0x3c3606){return db[_0xfc7b('0x35')][_0xfc7b('0x3d')](_0x3ed6c0[_0xfc7b('0x3e')],{})[_0xfc7b('0x19')](function(_0x5d4c4d){var _0x2184df=_0x3ed6c0['user'][_0xfc7b('0x1b')]({'plain':!![]});if(!_0x2184df)throw new Error(_0xfc7b('0x3f'));if(_0x2184df['role']===_0xfc7b('0x40')){var _0x44e088=_0x5d4c4d['get']({'plain':!![]});var _0x41823f=_0xfc7b('0x1c');return db['UserProfileSection']['find']({'where':{'name':_0x41823f,'userProfileId':_0x2184df['userProfileId']},'raw':!![]})[_0xfc7b('0x19')](function(_0x522bc8){if(_0x522bc8&&_0x522bc8[_0xfc7b('0x41')]===0x0){return db[_0xfc7b('0x42')]['create']({'name':_0x44e088[_0xfc7b('0x1f')],'resourceId':_0x44e088['id'],'type':_0x522bc8[_0xfc7b('0x1f')],'sectionId':_0x522bc8['id']},{})[_0xfc7b('0x19')](function(){return _0x5d4c4d;});}else{return _0x5d4c4d;}})[_0xfc7b('0x38')](function(_0x3a6106){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a6106);throw _0x3a6106;});}return _0x5d4c4d;})[_0xfc7b('0x19')](respondWithResult(_0x3c3606,0xc9))[_0xfc7b('0x38')](handleError(_0x3c3606,null));};exports['update']=function(_0x417f97,_0x1169a3){if(_0x417f97[_0xfc7b('0x3e')]['id']){delete _0x417f97[_0xfc7b('0x3e')]['id'];}return db[_0xfc7b('0x35')][_0xfc7b('0x3c')]({'where':{'id':_0x417f97[_0xfc7b('0x39')]['id']}})[_0xfc7b('0x19')](handleEntityNotFound(_0x1169a3,null))[_0xfc7b('0x19')](saveUpdates(_0x417f97[_0xfc7b('0x3e')],null))[_0xfc7b('0x19')](respondWithResult(_0x1169a3,null))[_0xfc7b('0x38')](handleError(_0x1169a3,null));};exports[_0xfc7b('0x1a')]=function(_0xd3d899,_0x38dbd9){return db[_0xfc7b('0x35')][_0xfc7b('0x3c')]({'where':{'id':_0xd3d899[_0xfc7b('0x39')]['id']}})['then'](handleEntityNotFound(_0x38dbd9,null))[_0xfc7b('0x19')](removeEntity(_0x38dbd9,null))[_0xfc7b('0x38')](handleError(_0x38dbd9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a07bbb2..943c630 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 _0x4631=['VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','agent','then','catch','exports','models'];(function(_0x5b73e9,_0x144406){var _0x12915c=function(_0x4bda05){while(--_0x4bda05){_0x5b73e9['push'](_0x5b73e9['shift']());}};_0x12915c(++_0x144406);}(_0x4631,0xb9));var _0x1463=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0x4631[_0x328b1c];return _0x4dbeaa;};'use strict';var _=require(_0x1463('0x0'));var util=require(_0x1463('0x1'));var BPromise=require('bluebird');var attributes=require(_0x1463('0x2'));var getUserApplications=function(_0x56fb20,_0x5a9f5e,_0x5bf8b7){var _0x4c1d5b=0x1;var _0x3524e4=[];var _0x296e9d={'context':_0x5a9f5e[_0x1463('0x3')]||_0x1463('0x4'),'exten':util[_0x1463('0x5')](_0x1463('0x6'),_0x56fb20[_0x1463('0x7')],_0x5bf8b7),'type':'system','isApp':![],'ChanSpyId':_0x56fb20['id'],'UserId':_0x5a9f5e['id']};_0x3524e4[_0x1463('0x8')](_[_0x1463('0x9')]({'app':_0x1463('0xa'),'appdata':util[_0x1463('0x5')]('CDR(type)=%s',_0x1463('0xb')),'priority':_0x4c1d5b++},_0x296e9d));if(_0x56fb20[_0x1463('0xc')]){_0x3524e4[_0x1463('0x8')](_['merge']({'app':_0x1463('0xd'),'appdata':util['format'](_0x1463('0xe'),_0x56fb20['recordingFormat']),'priority':_0x4c1d5b++},_0x296e9d));}if(_0x56fb20[_0x1463('0xf')]){_0x3524e4['push'](_['merge']({'app':'Authenticate','appdata':_0x56fb20[_0x1463('0x10')],'priority':_0x4c1d5b++},_0x296e9d));}_0x3524e4[_0x1463('0x8')](_[_0x1463('0x9')]({'app':_0x1463('0x11'),'appdata':util[_0x1463('0x5')](_0x1463('0x12'),_0x5a9f5e[_0x1463('0x13')],_0x56fb20[_0x1463('0x14')]?_0x56fb20[_0x1463('0x14')][_0x1463('0x15')](''):''),'priority':_0x4c1d5b++},_0x296e9d));if(_0x56fb20[_0x1463('0xc')]){_0x3524e4[_0x1463('0x8')](_[_0x1463('0x9')]({'app':_0x1463('0x16'),'priority':_0x4c1d5b++},_0x296e9d));}return _0x3524e4;};var getChanSpyApplications=function(_0x5e606d,_0x611c19){var _0x522994=[];for(var _0x3f0239=0x0,_0x17b4ba=0x1;_0x3f0239<_0x611c19['length'];_0x3f0239++,_0x17b4ba=0x1){_0x522994=_0x522994[_0x1463('0x17')](getUserApplications(_0x5e606d,_0x611c19[_0x3f0239],_0x611c19[_0x3f0239][_0x1463('0x18')]));if(_0x611c19[_0x3f0239][_0x1463('0x18')]!=_0x611c19[_0x3f0239][_0x1463('0x13')]){_0x522994=_0x522994[_0x1463('0x17')](getUserApplications(_0x5e606d,_0x611c19[_0x3f0239],_0x611c19[_0x3f0239][_0x1463('0x13')]));}}return _0x522994;};var getChanSpyPromise=function(_0x17bea1,_0x1a0173){return new BPromise(function(_0x380f14,_0x2d2db3){return _0x17bea1[_0x1463('0x19')]['findAll']({'attributes':['id','name',_0x1463('0x18')],'where':{'role':_0x1463('0x1a'),'chanspy':!![]},'raw':!![]})[_0x1463('0x1b')](function(_0x3a024c){if(_0x3a024c){return _0x380f14(getChanSpyApplications(_0x1a0173,_0x3a024c));}return _0x380f14([]);})[_0x1463('0x1c')](function(_0x6de5b1){_0x2d2db3(_0x6de5b1);});});};module[_0x1463('0x1d')]=function(_0xd8834a,_0x274229){var _0x50edb2=_0xd8834a[_0x1463('0x1e')];return _0xd8834a['define'](_0x1463('0x1f'),attributes,{'tableName':_0x1463('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ee12d,_0x129177,_0x1f7609){return getChanSpyPromise(_0x50edb2,_0x1ee12d)['then'](function(_0x1cb809){if(_0x1cb809&&_0x1cb809['length']){return _0x50edb2[_0x1463('0x21')][_0x1463('0x22')](_0x1cb809);}})['then'](function(){_0x1f7609();})[_0x1463('0x1c')](function(_0x37c69f){_0x1f7609(_0x37c69f);});},'afterUpdate':function(_0x10fc41,_0x515e3f,_0x45d64a){return _0x50edb2[_0x1463('0x21')]['destroy']({'where':{'ChanSpyId':_0x10fc41['id']}})[_0x1463('0x1b')](function(){return getChanSpyPromise(_0x50edb2,_0x10fc41);})[_0x1463('0x1b')](function(_0x42c280){if(_0x42c280&&_0x42c280['length']){return _0x50edb2[_0x1463('0x21')][_0x1463('0x22')](_0x42c280);}})[_0x1463('0x1b')](function(){_0x45d64a();})['catch'](function(_0x589258){_0x45d64a(_0x589258);});},'afterDestroy':function(_0x1b2a25,_0x4555f2,_0x282d3d){return _0x50edb2[_0x1463('0x21')][_0x1463('0x23')]({'where':{'ChanSpyId':_0x1b2a25['id']}})[_0x1463('0x1b')](function(){_0x282d3d();})[_0x1463('0x1c')](function(_0x35ff26){_0x282d3d(_0x35ff26);});}}});}; \ No newline at end of file +var _0xc6d8=['voice_chanspy','VoiceExtension','bulkCreate','then','catch','lodash','bluebird','context','from-sip','format','%s%s','prefix','system','merge','Set','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','agent','exports','VoiceChanSpy'];(function(_0x33fe81,_0x27b0e2){var _0x68a576=function(_0x92c854){while(--_0x92c854){_0x33fe81['push'](_0x33fe81['shift']());}};_0x68a576(++_0x27b0e2);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xc6d8[_0x1529a3];return _0x1a0d4b;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var BPromise=require(_0x8c6d('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3b88d1,_0x5974d3,_0x292852){var _0x4fa8a4=0x1;var _0x5b6b04=[];var _0x352b8c={'context':_0x5974d3[_0x8c6d('0x2')]||_0x8c6d('0x3'),'exten':util[_0x8c6d('0x4')](_0x8c6d('0x5'),_0x3b88d1[_0x8c6d('0x6')],_0x292852),'type':_0x8c6d('0x7'),'isApp':![],'ChanSpyId':_0x3b88d1['id'],'UserId':_0x5974d3['id']};_0x5b6b04['push'](_[_0x8c6d('0x8')]({'app':_0x8c6d('0x9'),'appdata':util[_0x8c6d('0x4')]('CDR(type)=%s',_0x8c6d('0xa')),'priority':_0x4fa8a4++},_0x352b8c));if(_0x3b88d1[_0x8c6d('0xb')]){_0x5b6b04[_0x8c6d('0xc')](_[_0x8c6d('0x8')]({'app':_0x8c6d('0xd'),'appdata':util[_0x8c6d('0x4')](_0x8c6d('0xe'),_0x3b88d1[_0x8c6d('0xf')]),'priority':_0x4fa8a4++},_0x352b8c));}if(_0x3b88d1['auth']){_0x5b6b04[_0x8c6d('0xc')](_['merge']({'app':'Authenticate','appdata':_0x3b88d1[_0x8c6d('0x10')],'priority':_0x4fa8a4++},_0x352b8c));}_0x5b6b04[_0x8c6d('0xc')](_[_0x8c6d('0x8')]({'app':_0x8c6d('0x11'),'appdata':util[_0x8c6d('0x4')](_0x8c6d('0x12'),_0x5974d3[_0x8c6d('0x13')],_0x3b88d1[_0x8c6d('0x14')]?_0x3b88d1[_0x8c6d('0x14')][_0x8c6d('0x15')](''):''),'priority':_0x4fa8a4++},_0x352b8c));if(_0x3b88d1['record']){_0x5b6b04[_0x8c6d('0xc')](_['merge']({'app':_0x8c6d('0x16'),'priority':_0x4fa8a4++},_0x352b8c));}return _0x5b6b04;};var getChanSpyApplications=function(_0x4dd4b6,_0x150a16){var _0x3d95a6=[];for(var _0x52ed7b=0x0,_0x7f894c=0x1;_0x52ed7b<_0x150a16[_0x8c6d('0x17')];_0x52ed7b++,_0x7f894c=0x1){_0x3d95a6=_0x3d95a6['concat'](getUserApplications(_0x4dd4b6,_0x150a16[_0x52ed7b],_0x150a16[_0x52ed7b][_0x8c6d('0x18')]));if(_0x150a16[_0x52ed7b]['internal']!=_0x150a16[_0x52ed7b]['name']){_0x3d95a6=_0x3d95a6[_0x8c6d('0x19')](getUserApplications(_0x4dd4b6,_0x150a16[_0x52ed7b],_0x150a16[_0x52ed7b]['name']));}}return _0x3d95a6;};var getChanSpyPromise=function(_0x1d6d58,_0x174a4f){return new BPromise(function(_0x1d0f0a,_0xe58632){return _0x1d6d58[_0x8c6d('0x1a')]['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x8c6d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0xc3288){if(_0xc3288){return _0x1d0f0a(getChanSpyApplications(_0x174a4f,_0xc3288));}return _0x1d0f0a([]);})['catch'](function(_0x4c378b){_0xe58632(_0x4c378b);});});};module[_0x8c6d('0x1c')]=function(_0x8cebeb,_0x54dcc7){var _0x512a72=_0x8cebeb['models'];return _0x8cebeb['define'](_0x8c6d('0x1d'),attributes,{'tableName':_0x8c6d('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x292ae4,_0x48f64a,_0x41c904){return getChanSpyPromise(_0x512a72,_0x292ae4)['then'](function(_0x15a9c4){if(_0x15a9c4&&_0x15a9c4['length']){return _0x512a72[_0x8c6d('0x1f')][_0x8c6d('0x20')](_0x15a9c4);}})[_0x8c6d('0x21')](function(){_0x41c904();})[_0x8c6d('0x22')](function(_0x1e6755){_0x41c904(_0x1e6755);});},'afterUpdate':function(_0x3e3cd3,_0x9c269d,_0x41957d){return _0x512a72[_0x8c6d('0x1f')]['destroy']({'where':{'ChanSpyId':_0x3e3cd3['id']}})['then'](function(){return getChanSpyPromise(_0x512a72,_0x3e3cd3);})[_0x8c6d('0x21')](function(_0x93a094){if(_0x93a094&&_0x93a094[_0x8c6d('0x17')]){return _0x512a72[_0x8c6d('0x1f')][_0x8c6d('0x20')](_0x93a094);}})[_0x8c6d('0x21')](function(){_0x41957d();})[_0x8c6d('0x22')](function(_0x2d028f){_0x41957d(_0x2d028f);});},'afterDestroy':function(_0x407234,_0x43d70c,_0x3375dd){return _0x512a72[_0x8c6d('0x1f')]['destroy']({'where':{'ChanSpyId':_0x407234['id']}})[_0x8c6d('0x21')](function(){_0x3375dd();})[_0x8c6d('0x22')](function(_0x373839){_0x3375dd(_0x373839);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 12c649e..f9f4c25 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 _0x81dc=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81dc,0x88));var _0xc81d=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x81dc[_0x4828b1];return _0x1fec1b;};'use strict';var _=require(_0xc81d('0x0'));var util=require(_0xc81d('0x1'));var moment=require(_0xc81d('0x2'));var BPromise=require(_0xc81d('0x3'));var rs=require(_0xc81d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc81d('0x5'))['db'];var utils=require(_0xc81d('0x6'));var logger=require(_0xc81d('0x7'))(_0xc81d('0x8'));var config=require(_0xc81d('0x9'));var jayson=require(_0xc81d('0xa'));var client=jayson['client'][_0xc81d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e4c08,_0x18be3c,_0x2f093a){return new BPromise(function(_0xab8f1,_0x3ead73){return client[_0xc81d('0xc')](_0x2e4c08,_0x2f093a)[_0xc81d('0xd')](function(_0x45ff4e){logger[_0xc81d('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x18be3c,_0xc81d('0xf'));logger[_0xc81d('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x18be3c,_0xc81d('0xf'),JSON['stringify'](_0x45ff4e));if(_0x45ff4e[_0xc81d('0x11')]){if(_0x45ff4e[_0xc81d('0x11')][_0xc81d('0x12')]===0x1f4){logger[_0xc81d('0x11')](_0xc81d('0x13'),_0x18be3c,_0x45ff4e[_0xc81d('0x11')][_0xc81d('0x14')]);return _0x3ead73(_0x45ff4e[_0xc81d('0x11')][_0xc81d('0x14')]);}logger[_0xc81d('0x11')](_0xc81d('0x13'),_0x18be3c,_0x45ff4e[_0xc81d('0x11')]['message']);return _0xab8f1(_0x45ff4e[_0xc81d('0x11')][_0xc81d('0x14')]);}else{logger[_0xc81d('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x18be3c,_0xc81d('0xf'));_0xab8f1(_0x45ff4e[_0xc81d('0x15')]['message']);}})[_0xc81d('0x16')](function(_0x8a1e05){logger[_0xc81d('0x11')](_0xc81d('0x13'),_0x18be3c,_0x8a1e05);_0x3ead73(_0x8a1e05);});});} \ No newline at end of file +var _0x2e52=['jayson/promise','client','http','then','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5b2a32,_0x4d4ca4){var _0x4bf53c=function(_0x2be49f){while(--_0x2be49f){_0x5b2a32['push'](_0x5b2a32['shift']());}};_0x4bf53c(++_0x4d4ca4);}(_0x2e52,0x71));var _0x22e5=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x2e52[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x22e5('0x0'));var util=require(_0x22e5('0x1'));var moment=require(_0x22e5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22e5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x22e5('0x4'));var logger=require(_0x22e5('0x5'))('rpc');var config=require(_0x22e5('0x6'));var jayson=require(_0x22e5('0x7'));var client=jayson[_0x22e5('0x8')][_0x22e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c0a9d,_0xd9b3cd,_0x490908){return new BPromise(function(_0x128909,_0x10e87a){return client['request'](_0x2c0a9d,_0x490908)[_0x22e5('0xa')](function(_0x388950){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0xd9b3cd,_0x22e5('0xb'));logger['debug'](_0x22e5('0xc'),_0xd9b3cd,'request\x20sent',JSON[_0x22e5('0xd')](_0x388950));if(_0x388950[_0x22e5('0xe')]){if(_0x388950[_0x22e5('0xe')]['code']===0x1f4){logger['error'](_0x22e5('0xf'),_0xd9b3cd,_0x388950[_0x22e5('0xe')]['message']);return _0x10e87a(_0x388950[_0x22e5('0xe')]['message']);}logger[_0x22e5('0xe')](_0x22e5('0xf'),_0xd9b3cd,_0x388950[_0x22e5('0xe')]['message']);return _0x128909(_0x388950['error'][_0x22e5('0x10')]);}else{logger[_0x22e5('0x11')](_0x22e5('0xf'),_0xd9b3cd,'request\x20sent');_0x128909(_0x388950[_0x22e5('0x12')][_0x22e5('0x10')]);}})[_0x22e5('0x13')](function(_0x20a13b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0xd9b3cd,_0x20a13b);_0x10e87a(_0x20a13b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 88d68cf..246bf7b 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 _0x881e=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0x881e,0x11c));var _0xe881=function(_0x593c2e,_0x564b10){_0x593c2e=_0x593c2e-0x0;var _0x3d624f=_0x881e[_0x593c2e];return _0x3d624f;};'use strict';var multer=require('multer');var util=require(_0xe881('0x0'));var path=require(_0xe881('0x1'));var timeout=require(_0xe881('0x2'));var express=require(_0xe881('0x3'));var router=express[_0xe881('0x4')]();var auth=require(_0xe881('0x5'));var interaction=require(_0xe881('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xe881('0x7')]('/',auth[_0xe881('0x8')](),controller['index']);router[_0xe881('0x7')](_0xe881('0x9'),auth[_0xe881('0x8')](),controller['show']);router[_0xe881('0xa')]('/',auth[_0xe881('0x8')](),controller[_0xe881('0xb')]);router[_0xe881('0xc')](_0xe881('0x9'),auth[_0xe881('0x8')](),controller[_0xe881('0xd')]);router[_0xe881('0xe')](_0xe881('0x9'),auth[_0xe881('0x8')](),controller[_0xe881('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa96c=['connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','post','put','update','delete','path'];(function(_0x58e261,_0x404f31){var _0x57bbd6=function(_0x11988e){while(--_0x11988e){_0x58e261['push'](_0x58e261['shift']());}};_0x57bbd6(++_0x404f31);}(_0xa96c,0x137));var _0xca96=function(_0x51df15,_0x4d9920){_0x51df15=_0x51df15-0x0;var _0x270f7c=_0xa96c[_0x51df15];return _0x270f7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca96('0x0'));var timeout=require(_0xca96('0x1'));var express=require(_0xca96('0x2'));var router=express[_0xca96('0x3')]();var auth=require(_0xca96('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xca96('0x5')]('/',auth[_0xca96('0x6')](),controller[_0xca96('0x7')]);router[_0xca96('0x5')](_0xca96('0x8'),auth[_0xca96('0x6')](),controller['show']);router[_0xca96('0x9')]('/',auth[_0xca96('0x6')](),controller['create']);router[_0xca96('0xa')](_0xca96('0x8'),auth[_0xca96('0x6')](),controller[_0xca96('0xb')]);router[_0xca96('0xc')](_0xca96('0x8'),auth[_0xca96('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 33179d6..fb80e9e 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x91c175,_0x5c3bcc){var _0x6458b6=function(_0x27d1c7){while(--_0x27d1c7){_0x91c175['push'](_0x91c175['shift']());}};_0x6458b6(++_0x5c3bcc);}(_0x34e8,0x12c));var _0x834e=function(_0x217126,_0x5c2bf8){_0x217126=_0x217126-0x0;var _0x5b53ea=_0x34e8[_0x217126];return _0x5b53ea;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5001f6,_0x34d4d8){var _0x3765aa=function(_0x14b855){while(--_0x14b855){_0x5001f6['push'](_0x5001f6['shift']());}};_0x3765aa(++_0x34d4d8);}(_0xe14b,0x93));var _0xbe14=function(_0x31cb63,_0x207a5d){_0x31cb63=_0x31cb63-0x0;var _0x12f083=_0xe14b[_0x31cb63];return _0x12f083;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('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 bf6c92c..bd66c67 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 _0xab5b=['message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','create','body','findAll','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','Reload','chan_sip.so','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4016e1,_0x1bf0da){var _0x2160fc=function(_0xf3a508){while(--_0xf3a508){_0x4016e1['push'](_0x4016e1['shift']());}};_0x2160fc(++_0x1bf0da);}(_0xab5b,0x11a));var _0xbab5=function(_0xd7f84d,_0xfc8e88){_0xd7f84d=_0xd7f84d-0x0;var _0x4748d2=_0xab5b[_0xd7f84d];return _0x4748d2;};'use strict';var pdf=require(_0xbab5('0x0'));var emlformat=require(_0xbab5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbab5('0x2'));var jsonpatch=require(_0xbab5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbab5('0x4'));var Mustache=require('mustache');var util=require(_0xbab5('0x5'));var path=require(_0xbab5('0x6'));var sox=require(_0xbab5('0x7'));var csv=require(_0xbab5('0x8'));var ejs=require(_0xbab5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbab5('0xa'));var crypto=require(_0xbab5('0xb'));var jsforce=require(_0xbab5('0xc'));var deskjs=require(_0xbab5('0xd'));var toCsv=require(_0xbab5('0x8'));var querystring=require('querystring');var Papa=require(_0xbab5('0xe'));var Redis=require(_0xbab5('0xf'));var authService=require(_0xbab5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbab5('0x11'));var hardwareService=require(_0xbab5('0x12'));var logger=require('../../config/logger')(_0xbab5('0x13'));var utils=require(_0xbab5('0x14'));var config=require(_0xbab5('0x15'));var licenseUtil=require(_0xbab5('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbab5('0x17'));var client=jayson['client'][_0xbab5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xee0909,_0x122c12,_0x2bae54,_0x40c9e1){return new BPromise(function(_0x51acbc,_0x360b72){var _0x31ed39=_0x40c9e1||client;return _0x31ed39[_0xbab5('0x19')](_0xee0909,_0x2bae54)[_0xbab5('0x1a')](function(_0x21b818){logger[_0xbab5('0x1b')](_0xbab5('0x1c'),_0x122c12,_0xbab5('0x1d'));logger[_0xbab5('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x122c12,_0xbab5('0x1d'),JSON[_0xbab5('0x1f')](_0x21b818));if(_0x21b818[_0xbab5('0x20')]){if(_0x21b818['error']['code']===0x1f4){logger[_0xbab5('0x20')](_0xbab5('0x1c'),_0x122c12,_0x21b818[_0xbab5('0x20')][_0xbab5('0x21')]);return _0x360b72(_0x21b818[_0xbab5('0x20')][_0xbab5('0x21')]);}logger[_0xbab5('0x20')]('VoiceContext,\x20%s,\x20%s',_0x122c12,_0x21b818[_0xbab5('0x20')][_0xbab5('0x21')]);return _0x51acbc(_0x21b818[_0xbab5('0x20')]['message']);}else{logger[_0xbab5('0x1b')](_0xbab5('0x1c'),_0x122c12,_0xbab5('0x1d'));_0x51acbc(_0x21b818[_0xbab5('0x22')][_0xbab5('0x21')]);}})[_0xbab5('0x23')](function(_0x28d7db){logger[_0xbab5('0x20')](_0xbab5('0x1c'),_0x122c12,_0x28d7db);_0x360b72(_0x28d7db);});});}function respondWithStatusCode(_0x32e69d,_0x27e76f){_0x27e76f=_0x27e76f||0xcc;return function(_0x58ba05){if(_0x58ba05){return _0x32e69d[_0xbab5('0x24')](_0x27e76f);}return _0x32e69d[_0xbab5('0x25')](_0x27e76f)[_0xbab5('0x26')]();};}function respondWithResult(_0x14e649,_0x229d82){_0x229d82=_0x229d82||0xc8;return function(_0x4bbb3e){if(_0x4bbb3e){return _0x14e649[_0xbab5('0x25')](_0x229d82)[_0xbab5('0x27')](_0x4bbb3e);}};}function respondWithFilteredResult(_0x24578d,_0x546ae0){return function(_0x29be55){if(_0x29be55){var _0x25ab3e=_0x29be55[_0xbab5('0x28')],_0x168d75=_0x546ae0[_0xbab5('0x29')],_0xaac42=_0x546ae0[_0xbab5('0x29')]+_0x546ae0['limit'],_0x194e60;if(_0xaac42>=_0x25ab3e){_0xaac42=_0x25ab3e;_0x194e60=0xc8;}else{_0x194e60=0xce;}_0x24578d[_0xbab5('0x25')](_0x194e60);return _0x24578d['set'](_0xbab5('0x2a'),_0x168d75+'-'+_0xaac42+'/'+_0x25ab3e)[_0xbab5('0x27')](_0x29be55);}return null;};}function patchUpdates(_0x4a23cb){return function(_0x2008e5){try{jsonpatch[_0xbab5('0x2b')](_0x2008e5,_0x4a23cb,!![]);}catch(_0x3a6a98){return BPromise[_0xbab5('0x2c')](_0x3a6a98);}return _0x2008e5[_0xbab5('0x2d')]();};}function saveUpdates(_0x1f5311,_0x19fdfe){return function(_0x501caf){if(_0x501caf){return _0x501caf['update'](_0x1f5311)[_0xbab5('0x1a')](function(_0x5ac156){return _0x5ac156;});}return null;};}function removeEntity(_0x122296,_0x45c5bd){return function(_0x586e60){if(_0x586e60){return _0x586e60[_0xbab5('0x2e')]()[_0xbab5('0x1a')](function(){var _0x32924b=_0x586e60[_0xbab5('0x2f')]({'plain':!![]});var _0x3a8962=_0xbab5('0x30');return db[_0xbab5('0x31')]['destroy']({'where':{'type':_0x3a8962,'resourceId':_0x32924b['id']}})[_0xbab5('0x1a')](function(){return _0x586e60;});})[_0xbab5('0x1a')](function(){_0x122296[_0xbab5('0x25')](0xcc)[_0xbab5('0x26')]();});}};}function handleEntityNotFound(_0x341901,_0x1dc644){return function(_0x2a4793){if(!_0x2a4793){_0x341901['sendStatus'](0x194);}return _0x2a4793;};}function handleError(_0x367443,_0x336bff){_0x336bff=_0x336bff||0x1f4;return function(_0x2e053d){logger['error'](_0x2e053d[_0xbab5('0x32')]);if(_0x2e053d[_0xbab5('0x33')]){delete _0x2e053d['name'];}_0x367443[_0xbab5('0x25')](_0x336bff)[_0xbab5('0x34')](_0x2e053d);};}exports[_0xbab5('0x35')]=function(_0x30d11a,_0x1d6a5a){var _0x3a8ea5={},_0x2977cc={},_0x5b7bc3={'count':0x0,'rows':[]};var _0x8d877c=_[_0xbab5('0x36')](db[_0xbab5('0x37')][_0xbab5('0x38')],function(_0x16218e){return{'name':_0x16218e[_0xbab5('0x39')],'type':_0x16218e[_0xbab5('0x3a')][_0xbab5('0x3b')]};});_0x2977cc['model']=_[_0xbab5('0x36')](_0x8d877c,'name');_0x2977cc[_0xbab5('0x3c')]=_['keys'](_0x30d11a['query']);_0x2977cc[_0xbab5('0x3d')]=_[_0xbab5('0x3e')](_0x2977cc[_0xbab5('0x3f')],_0x2977cc['query']);_0x3a8ea5[_0xbab5('0x40')]=_['intersection'](_0x2977cc[_0xbab5('0x3f')],qs[_0xbab5('0x41')](_0x30d11a[_0xbab5('0x3c')]['fields']));_0x3a8ea5[_0xbab5('0x40')]=_0x3a8ea5['attributes'][_0xbab5('0x42')]?_0x3a8ea5[_0xbab5('0x40')]:_0x2977cc[_0xbab5('0x3f')];if(!_0x30d11a[_0xbab5('0x3c')]['hasOwnProperty'](_0xbab5('0x43'))){_0x3a8ea5[_0xbab5('0x44')]=qs['limit'](_0x30d11a[_0xbab5('0x3c')][_0xbab5('0x44')]);_0x3a8ea5[_0xbab5('0x29')]=qs[_0xbab5('0x29')](_0x30d11a[_0xbab5('0x3c')][_0xbab5('0x29')]);}_0x3a8ea5[_0xbab5('0x45')]=qs[_0xbab5('0x46')](_0x30d11a[_0xbab5('0x3c')]['sort']);_0x3a8ea5[_0xbab5('0x47')]=qs[_0xbab5('0x3d')](_[_0xbab5('0x48')](_0x30d11a[_0xbab5('0x3c')],_0x2977cc[_0xbab5('0x3d')]),_0x8d877c);if(_0x30d11a[_0xbab5('0x3c')][_0xbab5('0x49')]){_0x3a8ea5[_0xbab5('0x47')]=_[_0xbab5('0x4a')](_0x3a8ea5[_0xbab5('0x47')],{'$or':_['map'](_0x8d877c,function(_0x1fee68){if(_0x1fee68['type']!==_0xbab5('0x4b')){var _0x4a9b5b={};_0x4a9b5b[_0x1fee68[_0xbab5('0x33')]]={'$like':'%'+_0x30d11a[_0xbab5('0x3c')][_0xbab5('0x49')]+'%'};return _0x4a9b5b;}})});}_0x3a8ea5=_[_0xbab5('0x4a')]({},_0x3a8ea5,_0x30d11a['options']);var _0x5e67aa={'where':_0x3a8ea5[_0xbab5('0x47')]};return db[_0xbab5('0x37')][_0xbab5('0x28')](_0x5e67aa)[_0xbab5('0x1a')](function(_0x126455){_0x5b7bc3[_0xbab5('0x28')]=_0x126455;if(_0x30d11a['query'][_0xbab5('0x4c')]){_0x3a8ea5[_0xbab5('0x4d')]=[{'all':!![]}];}return db[_0xbab5('0x37')]['findAll'](_0x3a8ea5);})[_0xbab5('0x1a')](function(_0x351b9d){_0x5b7bc3[_0xbab5('0x4e')]=_0x351b9d;return _0x5b7bc3;})[_0xbab5('0x1a')](respondWithFilteredResult(_0x1d6a5a,_0x3a8ea5))[_0xbab5('0x23')](handleError(_0x1d6a5a,null));};exports[_0xbab5('0x4f')]=function(_0x114458,_0xd5209d){var _0x3b1713={'raw':![],'where':{'id':_0x114458[_0xbab5('0x50')]['id']}},_0x525e7b={};_0x525e7b['model']=_[_0xbab5('0x51')](db[_0xbab5('0x37')][_0xbab5('0x38')]);_0x525e7b[_0xbab5('0x3c')]=_[_0xbab5('0x51')](_0x114458[_0xbab5('0x3c')]);_0x525e7b[_0xbab5('0x3d')]=_['intersection'](_0x525e7b[_0xbab5('0x3f')],_0x525e7b['query']);_0x3b1713[_0xbab5('0x40')]=_[_0xbab5('0x3e')](_0x525e7b['model'],qs[_0xbab5('0x41')](_0x114458[_0xbab5('0x3c')]['fields']));_0x3b1713[_0xbab5('0x40')]=_0x3b1713[_0xbab5('0x40')][_0xbab5('0x42')]?_0x3b1713[_0xbab5('0x40')]:_0x525e7b[_0xbab5('0x3f')];if(_0x114458['query']['includeAll']){_0x3b1713[_0xbab5('0x4d')]=[{'all':!![]}];}_0x3b1713=_[_0xbab5('0x4a')]({},_0x3b1713,_0x114458[_0xbab5('0x52')]);return db['VoiceContext'][_0xbab5('0x53')](_0x3b1713)[_0xbab5('0x1a')](handleEntityNotFound(_0xd5209d,null))[_0xbab5('0x1a')](respondWithResult(_0xd5209d,null))[_0xbab5('0x23')](handleError(_0xd5209d,null));};exports['create']=function(_0x2ebb69,_0xea128d,_0x2f48f2){var _0x26cc76;return db[_0xbab5('0x37')][_0xbab5('0x54')](_0x2ebb69[_0xbab5('0x55')],{'raw':!![]})[_0xbab5('0x1a')](function(_0x490595){_0x26cc76=_0x490595;return db[_0xbab5('0x37')][_0xbab5('0x56')]({'raw':!![]});})['then'](function(_0x379972){var _0x14d5ec=fs[_0xbab5('0x57')](path[_0xbab5('0x58')](config[_0xbab5('0x59')],'server/files/templates/context.ejs'),_0xbab5('0x5a'));var _0x190571=ejs[_0xbab5('0x5b')](_0x14d5ec,{'contexts':_0x379972||[]});fs[_0xbab5('0x5c')](_0xbab5('0x5d'),_0x190571);})[_0xbab5('0x1a')](function(){return respondWithRpcPromise('Reload',_0xbab5('0x54'),{'module':'chan_sip.so'});})['then'](function(){var _0x29dfcc=_0x2ebb69[_0xbab5('0x5e')]['get']({'plain':!![]});if(!_0x29dfcc)throw new Error(_0xbab5('0x5f'));if(_0x29dfcc[_0xbab5('0x60')]==='user'){var _0x429412=_0x26cc76['get']({'plain':!![]});return db[_0xbab5('0x61')][_0xbab5('0x53')]({'where':{'name':'Contexts','userProfileId':_0x29dfcc[_0xbab5('0x62')]},'raw':!![]})[_0xbab5('0x1a')](function(_0x2aa8a6){if(_0x2aa8a6&&_0x2aa8a6[_0xbab5('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x429412[_0xbab5('0x33')],'resourceId':_0x429412['id'],'type':_0x2aa8a6['name'],'sectionId':_0x2aa8a6['id']},{})[_0xbab5('0x1a')](function(){return _0x26cc76;});}else{return _0x26cc76;}})[_0xbab5('0x23')](function(_0x1f1823){logger[_0xbab5('0x20')](_0xbab5('0x64'),_0x1f1823);throw _0x1f1823;});}return _0x26cc76;})[_0xbab5('0x1a')](respondWithResult(_0xea128d,0xc9))[_0xbab5('0x23')](handleError(_0xea128d,null));};exports[_0xbab5('0x65')]=function(_0x3823fa,_0x3f6782,_0x54d1ce){var _0x14e23d;return db['VoiceContext']['find']({'where':{'id':_0x3823fa[_0xbab5('0x50')]['id']}})[_0xbab5('0x1a')](handleEntityNotFound(_0x3f6782,null))['then'](saveUpdates(_0x3823fa[_0xbab5('0x55')],null))[_0xbab5('0x1a')](function(_0x4cc4e1){if(_0x4cc4e1){_0x14e23d=_0x4cc4e1;return db[_0xbab5('0x37')][_0xbab5('0x56')]({'raw':!![]});}})[_0xbab5('0x1a')](function(_0x3ed08e){var _0x30668f=fs[_0xbab5('0x57')](path['join'](config['root'],_0xbab5('0x66')),'utf8');var _0x2a80df=ejs[_0xbab5('0x5b')](_0x30668f,{'contexts':_0x3ed08e||[]});fs[_0xbab5('0x5c')](_0xbab5('0x5d'),_0x2a80df);})[_0xbab5('0x1a')](function(){return respondWithRpcPromise(_0xbab5('0x67'),_0xbab5('0x65'),{'module':'chan_sip.so'});})[_0xbab5('0x1a')](function(){return _0x14e23d;})['then'](respondWithResult(_0x3f6782,null))[_0xbab5('0x23')](handleError(_0x3f6782,null));};exports[_0xbab5('0x2e')]=function(_0x25263b,_0x46fadb,_0xd3ddf1){var _0x1692be;return db[_0xbab5('0x37')][_0xbab5('0x53')]({'where':{'id':_0x25263b[_0xbab5('0x50')]['id']}})['then'](handleEntityNotFound(_0x46fadb,null))[_0xbab5('0x1a')](removeEntity(_0x46fadb,null))[_0xbab5('0x1a')](function(){return db[_0xbab5('0x37')][_0xbab5('0x56')]({'raw':!![]});})[_0xbab5('0x1a')](function(_0x15594d){var _0x3a374c=fs[_0xbab5('0x57')](path['join'](config[_0xbab5('0x59')],'server/files/templates/context.ejs'),'utf8');var _0x37df34=ejs[_0xbab5('0x5b')](_0x3a374c,{'contexts':_0x15594d});fs[_0xbab5('0x5c')](_0xbab5('0x5d'),_0x37df34);return respondWithRpcPromise(_0xbab5('0x67'),_0xbab5('0x2e'),{'module':_0xbab5('0x68')});})[_0xbab5('0x23')](handleError(_0x46fadb,null));}; \ No newline at end of file +var _0xd52a=['userProfileId','create','server/files/templates/context.ejs','Reload','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','params','includeAll','find','catch','body','findAll','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x432724,_0x1b6237){var _0x1a47ef=function(_0x474cf7){while(--_0x474cf7){_0x432724['push'](_0x432724['shift']());}};_0x1a47ef(++_0x1b6237);}(_0xd52a,0xca));var _0xad52=function(_0x538516,_0x4e4006){_0x538516=_0x538516-0x0;var _0x330d8e=_0xd52a[_0x538516];return _0x330d8e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xad52('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad52('0x1'));var jsonpatch=require(_0xad52('0x2'));var rp=require(_0xad52('0x3'));var moment=require('moment');var BPromise=require(_0xad52('0x4'));var Mustache=require(_0xad52('0x5'));var util=require(_0xad52('0x6'));var path=require(_0xad52('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad52('0x12'))['db'];var jayson=require(_0xad52('0x13'));var client=jayson[_0xad52('0x14')][_0xad52('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x11127c,_0x230eaa,_0x16e0f7,_0xd04cde){return new BPromise(function(_0x3d2df6,_0x5727a2){var _0x330794=_0xd04cde||client;return _0x330794[_0xad52('0x16')](_0x11127c,_0x16e0f7)[_0xad52('0x17')](function(_0x42eb20){logger[_0xad52('0x18')](_0xad52('0x19'),_0x230eaa,_0xad52('0x1a'));logger[_0xad52('0x1b')](_0xad52('0x1c'),_0x230eaa,'request\x20sent',JSON['stringify'](_0x42eb20));if(_0x42eb20[_0xad52('0x1d')]){if(_0x42eb20[_0xad52('0x1d')][_0xad52('0x1e')]===0x1f4){logger[_0xad52('0x1d')](_0xad52('0x19'),_0x230eaa,_0x42eb20['error'][_0xad52('0x1f')]);return _0x5727a2(_0x42eb20['error'][_0xad52('0x1f')]);}logger[_0xad52('0x1d')](_0xad52('0x19'),_0x230eaa,_0x42eb20['error'][_0xad52('0x1f')]);return _0x3d2df6(_0x42eb20['error'][_0xad52('0x1f')]);}else{logger[_0xad52('0x18')](_0xad52('0x19'),_0x230eaa,_0xad52('0x1a'));_0x3d2df6(_0x42eb20[_0xad52('0x20')][_0xad52('0x1f')]);}})['catch'](function(_0x7de59d){logger['error'](_0xad52('0x19'),_0x230eaa,_0x7de59d);_0x5727a2(_0x7de59d);});});}function respondWithStatusCode(_0x2acbb4,_0x2fa90c){_0x2fa90c=_0x2fa90c||0xcc;return function(_0x5bce67){if(_0x5bce67){return _0x2acbb4[_0xad52('0x21')](_0x2fa90c);}return _0x2acbb4['status'](_0x2fa90c)['end']();};}function respondWithResult(_0x2809f7,_0x583999){_0x583999=_0x583999||0xc8;return function(_0x477b47){if(_0x477b47){return _0x2809f7[_0xad52('0x22')](_0x583999)['json'](_0x477b47);}};}function respondWithFilteredResult(_0x58adf5,_0xb526bf){return function(_0x31b5e0){if(_0x31b5e0){var _0x42db69=_0x31b5e0[_0xad52('0x23')],_0x50431e=_0xb526bf[_0xad52('0x24')],_0x132e94=_0xb526bf[_0xad52('0x24')]+_0xb526bf[_0xad52('0x25')],_0x5771ce;if(_0x132e94>=_0x42db69){_0x132e94=_0x42db69;_0x5771ce=0xc8;}else{_0x5771ce=0xce;}_0x58adf5['status'](_0x5771ce);return _0x58adf5[_0xad52('0x26')](_0xad52('0x27'),_0x50431e+'-'+_0x132e94+'/'+_0x42db69)['json'](_0x31b5e0);}return null;};}function patchUpdates(_0x3f5757){return function(_0x3a0fd6){try{jsonpatch[_0xad52('0x28')](_0x3a0fd6,_0x3f5757,!![]);}catch(_0x75dfb6){return BPromise[_0xad52('0x29')](_0x75dfb6);}return _0x3a0fd6['save']();};}function saveUpdates(_0x5ccd33,_0x4c389e){return function(_0xc2553d){if(_0xc2553d){return _0xc2553d[_0xad52('0x2a')](_0x5ccd33)[_0xad52('0x17')](function(_0x548d04){return _0x548d04;});}return null;};}function removeEntity(_0x52e3cc,_0x2e77fe){return function(_0x1af23e){if(_0x1af23e){return _0x1af23e[_0xad52('0x2b')]()[_0xad52('0x17')](function(){var _0x919c28=_0x1af23e[_0xad52('0x2c')]({'plain':!![]});var _0x504d75=_0xad52('0x2d');return db[_0xad52('0x2e')][_0xad52('0x2b')]({'where':{'type':_0x504d75,'resourceId':_0x919c28['id']}})[_0xad52('0x17')](function(){return _0x1af23e;});})[_0xad52('0x17')](function(){_0x52e3cc[_0xad52('0x22')](0xcc)[_0xad52('0x2f')]();});}};}function handleEntityNotFound(_0x123f30,_0x3d863d){return function(_0x434762){if(!_0x434762){_0x123f30[_0xad52('0x21')](0x194);}return _0x434762;};}function handleError(_0x5027c1,_0x1745e0){_0x1745e0=_0x1745e0||0x1f4;return function(_0x2c3676){logger[_0xad52('0x1d')](_0x2c3676[_0xad52('0x30')]);if(_0x2c3676[_0xad52('0x31')]){delete _0x2c3676[_0xad52('0x31')];}_0x5027c1['status'](_0x1745e0)[_0xad52('0x32')](_0x2c3676);};}exports[_0xad52('0x33')]=function(_0xc9461d,_0x596a3a){var _0x2ff49c={},_0x1d16b4={},_0x268353={'count':0x0,'rows':[]};var _0x4ad21c=_[_0xad52('0x34')](db[_0xad52('0x35')][_0xad52('0x36')],function(_0x49260f){return{'name':_0x49260f[_0xad52('0x37')],'type':_0x49260f[_0xad52('0x38')][_0xad52('0x39')]};});_0x1d16b4[_0xad52('0x3a')]=_[_0xad52('0x34')](_0x4ad21c,_0xad52('0x31'));_0x1d16b4['query']=_[_0xad52('0x3b')](_0xc9461d['query']);_0x1d16b4[_0xad52('0x3c')]=_[_0xad52('0x3d')](_0x1d16b4[_0xad52('0x3a')],_0x1d16b4[_0xad52('0x3e')]);_0x2ff49c[_0xad52('0x3f')]=_['intersection'](_0x1d16b4[_0xad52('0x3a')],qs[_0xad52('0x40')](_0xc9461d[_0xad52('0x3e')]['fields']));_0x2ff49c[_0xad52('0x3f')]=_0x2ff49c[_0xad52('0x3f')][_0xad52('0x41')]?_0x2ff49c['attributes']:_0x1d16b4[_0xad52('0x3a')];if(!_0xc9461d['query'][_0xad52('0x42')](_0xad52('0x43'))){_0x2ff49c[_0xad52('0x25')]=qs[_0xad52('0x25')](_0xc9461d['query'][_0xad52('0x25')]);_0x2ff49c[_0xad52('0x24')]=qs[_0xad52('0x24')](_0xc9461d[_0xad52('0x3e')][_0xad52('0x24')]);}_0x2ff49c[_0xad52('0x44')]=qs[_0xad52('0x45')](_0xc9461d[_0xad52('0x3e')]['sort']);_0x2ff49c[_0xad52('0x46')]=qs['filters'](_[_0xad52('0x47')](_0xc9461d[_0xad52('0x3e')],_0x1d16b4[_0xad52('0x3c')]),_0x4ad21c);if(_0xc9461d[_0xad52('0x3e')][_0xad52('0x48')]){_0x2ff49c[_0xad52('0x46')]=_[_0xad52('0x49')](_0x2ff49c[_0xad52('0x46')],{'$or':_[_0xad52('0x34')](_0x4ad21c,function(_0x24b970){if(_0x24b970[_0xad52('0x38')]!==_0xad52('0x4a')){var _0x4411eb={};_0x4411eb[_0x24b970[_0xad52('0x31')]]={'$like':'%'+_0xc9461d[_0xad52('0x3e')][_0xad52('0x48')]+'%'};return _0x4411eb;}})});}_0x2ff49c=_[_0xad52('0x49')]({},_0x2ff49c,_0xc9461d[_0xad52('0x4b')]);var _0x711cc6={'where':_0x2ff49c[_0xad52('0x46')]};return db['VoiceContext'][_0xad52('0x23')](_0x711cc6)[_0xad52('0x17')](function(_0x14b87b){_0x268353['count']=_0x14b87b;if(_0xc9461d[_0xad52('0x3e')]['includeAll']){_0x2ff49c[_0xad52('0x4c')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x2ff49c);})[_0xad52('0x17')](function(_0x1746b0){_0x268353[_0xad52('0x4d')]=_0x1746b0;return _0x268353;})[_0xad52('0x17')](respondWithFilteredResult(_0x596a3a,_0x2ff49c))['catch'](handleError(_0x596a3a,null));};exports['show']=function(_0x254416,_0x5dede4){var _0x207096={'raw':![],'where':{'id':_0x254416[_0xad52('0x4e')]['id']}},_0x581f41={};_0x581f41[_0xad52('0x3a')]=_[_0xad52('0x3b')](db[_0xad52('0x35')][_0xad52('0x36')]);_0x581f41[_0xad52('0x3e')]=_['keys'](_0x254416[_0xad52('0x3e')]);_0x581f41[_0xad52('0x3c')]=_[_0xad52('0x3d')](_0x581f41[_0xad52('0x3a')],_0x581f41['query']);_0x207096[_0xad52('0x3f')]=_[_0xad52('0x3d')](_0x581f41[_0xad52('0x3a')],qs['fields'](_0x254416[_0xad52('0x3e')][_0xad52('0x40')]));_0x207096[_0xad52('0x3f')]=_0x207096[_0xad52('0x3f')]['length']?_0x207096[_0xad52('0x3f')]:_0x581f41[_0xad52('0x3a')];if(_0x254416[_0xad52('0x3e')][_0xad52('0x4f')]){_0x207096[_0xad52('0x4c')]=[{'all':!![]}];}_0x207096=_['merge']({},_0x207096,_0x254416['options']);return db[_0xad52('0x35')][_0xad52('0x50')](_0x207096)[_0xad52('0x17')](handleEntityNotFound(_0x5dede4,null))[_0xad52('0x17')](respondWithResult(_0x5dede4,null))[_0xad52('0x51')](handleError(_0x5dede4,null));};exports['create']=function(_0x21f850,_0x4ccf7b,_0x5fe34c){var _0xa72c7;return db[_0xad52('0x35')]['create'](_0x21f850[_0xad52('0x52')],{'raw':!![]})['then'](function(_0x3784b5){_0xa72c7=_0x3784b5;return db[_0xad52('0x35')][_0xad52('0x53')]({'raw':!![]});})['then'](function(_0x490866){var _0xf0fc0d=fs['readFileSync'](path[_0xad52('0x54')](config[_0xad52('0x55')],'server/files/templates/context.ejs'),_0xad52('0x56'));var _0x4b51fd=ejs[_0xad52('0x57')](_0xf0fc0d,{'contexts':_0x490866||[]});fs[_0xad52('0x58')](_0xad52('0x59'),_0x4b51fd);})[_0xad52('0x17')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xad52('0x5a')});})[_0xad52('0x17')](function(){var _0x541fd3=_0x21f850[_0xad52('0x5b')][_0xad52('0x2c')]({'plain':!![]});if(!_0x541fd3)throw new Error(_0xad52('0x5c'));if(_0x541fd3[_0xad52('0x5d')]==='user'){var _0xba9665=_0xa72c7[_0xad52('0x2c')]({'plain':!![]});return db[_0xad52('0x5e')][_0xad52('0x50')]({'where':{'name':_0xad52('0x2d'),'userProfileId':_0x541fd3[_0xad52('0x5f')]},'raw':!![]})[_0xad52('0x17')](function(_0x16807a){if(_0x16807a&&_0x16807a['autoAssociation']===0x0){return db['UserProfileResource'][_0xad52('0x60')]({'name':_0xba9665[_0xad52('0x31')],'resourceId':_0xba9665['id'],'type':_0x16807a[_0xad52('0x31')],'sectionId':_0x16807a['id']},{})['then'](function(){return _0xa72c7;});}else{return _0xa72c7;}})[_0xad52('0x51')](function(_0x805bc3){logger[_0xad52('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x805bc3);throw _0x805bc3;});}return _0xa72c7;})[_0xad52('0x17')](respondWithResult(_0x4ccf7b,0xc9))['catch'](handleError(_0x4ccf7b,null));};exports[_0xad52('0x2a')]=function(_0x56fca3,_0x538c7b,_0x3db9d6){var _0x2c6c48;return db['VoiceContext']['find']({'where':{'id':_0x56fca3['params']['id']}})[_0xad52('0x17')](handleEntityNotFound(_0x538c7b,null))[_0xad52('0x17')](saveUpdates(_0x56fca3['body'],null))[_0xad52('0x17')](function(_0x352302){if(_0x352302){_0x2c6c48=_0x352302;return db[_0xad52('0x35')]['findAll']({'raw':!![]});}})[_0xad52('0x17')](function(_0x2622a4){var _0x26935e=fs['readFileSync'](path['join'](config[_0xad52('0x55')],_0xad52('0x61')),_0xad52('0x56'));var _0xe22d76=ejs['render'](_0x26935e,{'contexts':_0x2622a4||[]});fs[_0xad52('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xe22d76);})[_0xad52('0x17')](function(){return respondWithRpcPromise('Reload',_0xad52('0x2a'),{'module':_0xad52('0x5a')});})[_0xad52('0x17')](function(){return _0x2c6c48;})[_0xad52('0x17')](respondWithResult(_0x538c7b,null))[_0xad52('0x51')](handleError(_0x538c7b,null));};exports[_0xad52('0x2b')]=function(_0xa4097c,_0x15f49d,_0x41b710){var _0x2b71e2;return db[_0xad52('0x35')]['find']({'where':{'id':_0xa4097c['params']['id']}})[_0xad52('0x17')](handleEntityNotFound(_0x15f49d,null))['then'](removeEntity(_0x15f49d,null))[_0xad52('0x17')](function(){return db[_0xad52('0x35')][_0xad52('0x53')]({'raw':!![]});})['then'](function(_0x3b865f){var _0x55b17b=fs['readFileSync'](path[_0xad52('0x54')](config[_0xad52('0x55')],_0xad52('0x61')),_0xad52('0x56'));var _0x72f326=ejs['render'](_0x55b17b,{'contexts':_0x3b865f});fs[_0xad52('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x72f326);return respondWithRpcPromise(_0xad52('0x62'),_0xad52('0x2b'),{'module':'chan_sip.so'});})[_0xad52('0x51')](handleError(_0x15f49d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6f4276e..5dd61e2 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 _0x3718=['moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0x20b039,_0xc8dadd){var _0xc6c7d7=function(_0x4495d0){while(--_0x4495d0){_0x20b039['push'](_0x20b039['shift']());}};_0xc6c7d7(++_0xc8dadd);}(_0x3718,0x1ba));var _0x8371=function(_0x17cb8a,_0x3a9e66){_0x17cb8a=_0x17cb8a-0x0;var _0x2a119f=_0x3718[_0x17cb8a];return _0x2a119f;};'use strict';var _=require('lodash');var util=require(_0x8371('0x0'));var logger=require(_0x8371('0x1'))('api');var moment=require(_0x8371('0x2'));var BPromise=require(_0x8371('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8371('0x4'));var rimraf=require(_0x8371('0x5'));var config=require(_0x8371('0x6'));var attributes=require(_0x8371('0x7'));module[_0x8371('0x8')]=function(_0x5245fa,_0x2256e3){return _0x5245fa[_0x8371('0x9')](_0x8371('0xa'),attributes,{'tableName':_0x8371('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa13=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2b05fa,_0x481073){var _0x25633c=function(_0x1698cf){while(--_0x1698cf){_0x2b05fa['push'](_0x2b05fa['shift']());}};_0x25633c(++_0x481073);}(_0xaa13,0x171));var _0x3aa1=function(_0x5d5437,_0x339939){_0x5d5437=_0x5d5437-0x0;var _0x2897de=_0xaa13[_0x5d5437];return _0x2897de;};'use strict';var _=require(_0x3aa1('0x0'));var util=require('util');var logger=require(_0x3aa1('0x1'))(_0x3aa1('0x2'));var moment=require(_0x3aa1('0x3'));var BPromise=require('bluebird');var rp=require(_0x3aa1('0x4'));var fs=require('fs');var path=require(_0x3aa1('0x5'));var rimraf=require(_0x3aa1('0x6'));var config=require(_0x3aa1('0x7'));var attributes=require(_0x3aa1('0x8'));module[_0x3aa1('0x9')]=function(_0x486b04,_0x2527d2){return _0x486b04[_0x3aa1('0xa')](_0x3aa1('0xb'),attributes,{'tableName':_0x3aa1('0xc'),'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 1479707..0ca516e 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 _0xc737=['code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xc737,0x10d));var _0x7c73=function(_0x150f94,_0x4f83cf){_0x150f94=_0x150f94-0x0;var _0x2e0fb6=_0xc737[_0x150f94];return _0x2e0fb6;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var moment=require(_0x7c73('0x2'));var BPromise=require(_0x7c73('0x3'));var rs=require(_0x7c73('0x4'));var fs=require('fs');var Redis=require(_0x7c73('0x5'));var db=require(_0x7c73('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c73('0x7'))(_0x7c73('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c73('0x9'));var client=jayson[_0x7c73('0xa')][_0x7c73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e41f,_0x2a3b26,_0x397ce8){return new BPromise(function(_0x30546b,_0x44156a){return client['request'](_0x41e41f,_0x397ce8)[_0x7c73('0xc')](function(_0x4b21bc){logger[_0x7c73('0xd')]('VoiceContext,\x20%s,\x20%s',_0x2a3b26,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2a3b26,_0x7c73('0xe'),JSON[_0x7c73('0xf')](_0x4b21bc));if(_0x4b21bc[_0x7c73('0x10')]){if(_0x4b21bc[_0x7c73('0x10')][_0x7c73('0x11')]===0x1f4){logger['error'](_0x7c73('0x12'),_0x2a3b26,_0x4b21bc[_0x7c73('0x10')]['message']);return _0x44156a(_0x4b21bc[_0x7c73('0x10')][_0x7c73('0x13')]);}logger[_0x7c73('0x10')](_0x7c73('0x12'),_0x2a3b26,_0x4b21bc[_0x7c73('0x10')][_0x7c73('0x13')]);return _0x30546b(_0x4b21bc[_0x7c73('0x10')]['message']);}else{logger[_0x7c73('0xd')]('VoiceContext,\x20%s,\x20%s',_0x2a3b26,_0x7c73('0xe'));_0x30546b(_0x4b21bc[_0x7c73('0x14')][_0x7c73('0x13')]);}})[_0x7c73('0x15')](function(_0x5580c7){logger[_0x7c73('0x10')]('VoiceContext,\x20%s,\x20%s',_0x2a3b26,_0x5580c7);_0x44156a(_0x5580c7);});});} \ No newline at end of file +var _0x4a8a=['client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3a5cac,_0x39f40a){var _0x1f81c2=function(_0xb508e3){while(--_0xb508e3){_0x3a5cac['push'](_0x3a5cac['shift']());}};_0x1f81c2(++_0x39f40a);}(_0x4a8a,0x9b));var _0xa4a8=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0x4a8a[_0x34b87f];return _0x449805;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa4a8('0x0'));var fs=require('fs');var Redis=require(_0xa4a8('0x1'));var db=require(_0xa4a8('0x2'))['db'];var utils=require(_0xa4a8('0x3'));var logger=require('../../config/logger')(_0xa4a8('0x4'));var config=require(_0xa4a8('0x5'));var jayson=require(_0xa4a8('0x6'));var client=jayson[_0xa4a8('0x7')][_0xa4a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cd98f,_0x3477ea,_0x35281e){return new BPromise(function(_0x1f52ae,_0x300088){return client['request'](_0x4cd98f,_0x35281e)['then'](function(_0xffb57b){logger['info'](_0xa4a8('0x9'),_0x3477ea,_0xa4a8('0xa'));logger[_0xa4a8('0xb')](_0xa4a8('0xc'),_0x3477ea,_0xa4a8('0xa'),JSON[_0xa4a8('0xd')](_0xffb57b));if(_0xffb57b[_0xa4a8('0xe')]){if(_0xffb57b['error']['code']===0x1f4){logger[_0xa4a8('0xe')](_0xa4a8('0x9'),_0x3477ea,_0xffb57b['error']['message']);return _0x300088(_0xffb57b[_0xa4a8('0xe')]['message']);}logger['error'](_0xa4a8('0x9'),_0x3477ea,_0xffb57b[_0xa4a8('0xe')][_0xa4a8('0xf')]);return _0x1f52ae(_0xffb57b['error'][_0xa4a8('0xf')]);}else{logger[_0xa4a8('0x10')](_0xa4a8('0x9'),_0x3477ea,_0xa4a8('0xa'));_0x1f52ae(_0xffb57b['result'][_0xa4a8('0xf')]);}})[_0xa4a8('0x11')](function(_0x48b3d6){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3477ea,_0x48b3d6);_0x300088(_0x48b3d6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index fd9adcf..ecc2fc2 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 _0xf8e8=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x1e7f8f,_0x444a8f){var _0x418765=function(_0x1d765a){while(--_0x1d765a){_0x1e7f8f['push'](_0x1e7f8f['shift']());}};_0x418765(++_0x444a8f);}(_0xf8e8,0xef));var _0x8f8e=function(_0x7031a4,_0x50886a){_0x7031a4=_0x7031a4-0x0;var _0x5358f0=_0xf8e8[_0x7031a4];return _0x5358f0;};'use strict';var multer=require('multer');var util=require(_0x8f8e('0x0'));var path=require(_0x8f8e('0x1'));var timeout=require(_0x8f8e('0x2'));var express=require(_0x8f8e('0x3'));var router=express[_0x8f8e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f8e('0x5'));var config=require(_0x8f8e('0x6'));var controller=require(_0x8f8e('0x7'));router[_0x8f8e('0x8')]('/',auth[_0x8f8e('0x9')](),controller[_0x8f8e('0xa')]);router[_0x8f8e('0x8')](_0x8f8e('0xb'),auth[_0x8f8e('0x9')](),controller['describe']);router[_0x8f8e('0x8')](_0x8f8e('0xc'),auth[_0x8f8e('0x9')](),controller[_0x8f8e('0xd')]);router[_0x8f8e('0xe')]('/',auth[_0x8f8e('0x9')](),controller[_0x8f8e('0xf')]);router[_0x8f8e('0x10')](_0x8f8e('0xc'),auth[_0x8f8e('0x9')](),controller['update']);router['delete'](_0x8f8e('0xc'),auth[_0x8f8e('0x9')](),controller[_0x8f8e('0x11')]);module[_0x8f8e('0x12')]=router; \ No newline at end of file +var _0xff37=['/describe','describe','/:id','post','put','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get'];(function(_0x3d72a2,_0x3d5a71){var _0x33acc6=function(_0x46ca8a){while(--_0x46ca8a){_0x3d72a2['push'](_0x3d72a2['shift']());}};_0x33acc6(++_0x3d5a71);}(_0xff37,0x116));var _0x7ff3=function(_0x3a45e0,_0xb1bb6c){_0x3a45e0=_0x3a45e0-0x0;var _0x2648de=_0xff37[_0x3a45e0];return _0x2648de;};'use strict';var multer=require('multer');var util=require(_0x7ff3('0x0'));var path=require('path');var timeout=require(_0x7ff3('0x1'));var express=require(_0x7ff3('0x2'));var router=express[_0x7ff3('0x3')]();var auth=require(_0x7ff3('0x4'));var interaction=require(_0x7ff3('0x5'));var config=require(_0x7ff3('0x6'));var controller=require(_0x7ff3('0x7'));router['get']('/',auth[_0x7ff3('0x8')](),controller[_0x7ff3('0x9')]);router[_0x7ff3('0xa')](_0x7ff3('0xb'),auth['isAuthenticated'](),controller[_0x7ff3('0xc')]);router[_0x7ff3('0xa')](_0x7ff3('0xd'),auth[_0x7ff3('0x8')](),controller['show']);router[_0x7ff3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7ff3('0xf')]('/:id',auth[_0x7ff3('0x8')](),controller['update']);router['delete']('/:id',auth[_0x7ff3('0x8')](),controller[_0x7ff3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 409b078..f4ab9c8 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 _0x37a6=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x2faa0e,_0x117786){var _0x25b472=function(_0x19cedc){while(--_0x19cedc){_0x2faa0e['push'](_0x2faa0e['shift']());}};_0x25b472(++_0x117786);}(_0x37a6,0x13a));var _0x637a=function(_0xc93400,_0x43c791){_0xc93400=_0xc93400-0x0;var _0x22021b=_0x37a6[_0xc93400];return _0x22021b;};'use strict';var Sequelize=require('sequelize');module[_0x637a('0x0')]={'privilege':{'type':Sequelize[_0x637a('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x637a('0x2')]},'channelstatedesc':{'type':Sequelize[_0x637a('0x1')]},'calleridnum':{'type':Sequelize[_0x637a('0x1')]},'calleridname':{'type':Sequelize[_0x637a('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x637a('0x1')]},'language':{'type':Sequelize[_0x637a('0x1')]},'accountcode':{'type':Sequelize[_0x637a('0x1')]},'context':{'type':Sequelize[_0x637a('0x1')]},'exten':{'type':Sequelize[_0x637a('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x637a('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x637a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x637a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x637a('0x1')]},'destcalleridname':{'type':Sequelize[_0x637a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x637a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x637a('0x1')]},'destaccountcode':{'type':Sequelize[_0x637a('0x1')]},'destcontext':{'type':Sequelize[_0x637a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x637a('0x2')]},'destuniqueid':{'type':Sequelize[_0x637a('0x1')]},'destlinkedid':{'type':Sequelize[_0x637a('0x1')]},'dialstring':{'type':Sequelize[_0x637a('0x1')]},'dialstatus':{'type':Sequelize[_0x637a('0x1')]},'starttime':{'type':Sequelize[_0x637a('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x637a('0x3')]},'lastevent':{'type':Sequelize[_0x637a('0x1')],'comment':_0x637a('0x4')},'routeId':{'type':Sequelize[_0x637a('0x2')]},'duration':{'type':Sequelize[_0x637a('0x2')]},'holdtime':{'type':Sequelize[_0x637a('0x2')]},'billableseconds':{'type':Sequelize[_0x637a('0x2')]}}; \ No newline at end of file +var _0xf674=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x48150d,_0x4ec2d7){var _0x28d65f=function(_0x1188d2){while(--_0x1188d2){_0x48150d['push'](_0x48150d['shift']());}};_0x28d65f(++_0x4ec2d7);}(_0xf674,0x65));var _0x4f67=function(_0x27380a,_0x11b4db){_0x27380a=_0x27380a-0x0;var _0x49557d=_0xf674[_0x27380a];return _0x49557d;};'use strict';var Sequelize=require(_0x4f67('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x4f67('0x1')]},'channel':{'type':Sequelize[_0x4f67('0x1')]},'channelstate':{'type':Sequelize[_0x4f67('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4f67('0x1')]},'calleridname':{'type':Sequelize[_0x4f67('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4f67('0x1')]},'connectedlinename':{'type':Sequelize[_0x4f67('0x1')]},'language':{'type':Sequelize[_0x4f67('0x1')]},'accountcode':{'type':Sequelize[_0x4f67('0x1')]},'context':{'type':Sequelize[_0x4f67('0x1')]},'exten':{'type':Sequelize[_0x4f67('0x1')]},'priority':{'type':Sequelize[_0x4f67('0x2')]},'uniqueid':{'type':Sequelize[_0x4f67('0x1')]},'linkedid':{'type':Sequelize[_0x4f67('0x1')]},'destchannel':{'type':Sequelize[_0x4f67('0x1')]},'destchannelstate':{'type':Sequelize[_0x4f67('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4f67('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4f67('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4f67('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4f67('0x1')]},'destcontext':{'type':Sequelize[_0x4f67('0x1')]},'destexten':{'type':Sequelize[_0x4f67('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x4f67('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4f67('0x3')]},'answertime':{'type':Sequelize[_0x4f67('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x4f67('0x4')},'routeId':{'type':Sequelize[_0x4f67('0x2')]},'duration':{'type':Sequelize[_0x4f67('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4f67('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1c98506..aca78b1 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 _0x8420=['includeAll','include','findAll','rows','params','keys','rawAttributes','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','squel','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceDialReport'];(function(_0x2e713d,_0x5e7ce3){var _0x350bb6=function(_0x6db875){while(--_0x6db875){_0x2e713d['push'](_0x2e713d['shift']());}};_0x350bb6(++_0x5e7ce3);}(_0x8420,0x124));var _0x0842=function(_0x56afbe,_0x24dae9){_0x56afbe=_0x56afbe-0x0;var _0x2f6060=_0x8420[_0x56afbe];return _0x2f6060;};'use strict';var pdf=require(_0x0842('0x0'));var emlformat=require(_0x0842('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0842('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0842('0x3'));var moment=require(_0x0842('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0842('0x5'));var util=require(_0x0842('0x6'));var path=require(_0x0842('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0842('0x8'));var crypto=require('crypto');var jsforce=require(_0x0842('0x9'));var deskjs=require(_0x0842('0xa'));var toCsv=require(_0x0842('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0842('0xc'));var as=require(_0x0842('0xd'));var hardwareService=require(_0x0842('0xe'));var logger=require('../../config/logger')(_0x0842('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0842('0x10'));var db=require(_0x0842('0x11'))['db'];function respondWithStatusCode(_0x4be904,_0x5e0cbc){_0x5e0cbc=_0x5e0cbc||0xcc;return function(_0x17f00d){if(_0x17f00d){return _0x4be904['sendStatus'](_0x5e0cbc);}return _0x4be904['status'](_0x5e0cbc)[_0x0842('0x12')]();};}function respondWithResult(_0x424224,_0x2aacd7){_0x2aacd7=_0x2aacd7||0xc8;return function(_0x40ad46){if(_0x40ad46){return _0x424224[_0x0842('0x13')](_0x2aacd7)[_0x0842('0x14')](_0x40ad46);}};}function respondWithFilteredResult(_0x1efa24,_0x396aa5){return function(_0x166e14){if(_0x166e14){var _0x4d9ecf=_0x166e14[_0x0842('0x15')],_0x37ef6c=_0x396aa5[_0x0842('0x16')],_0x3c817a=_0x396aa5['offset']+_0x396aa5[_0x0842('0x17')],_0x28d660;if(_0x3c817a>=_0x4d9ecf){_0x3c817a=_0x4d9ecf;_0x28d660=0xc8;}else{_0x28d660=0xce;}_0x1efa24[_0x0842('0x13')](_0x28d660);return _0x1efa24[_0x0842('0x18')]('Content-Range',_0x37ef6c+'-'+_0x3c817a+'/'+_0x4d9ecf)[_0x0842('0x14')](_0x166e14);}return null;};}function patchUpdates(_0x1a3460){return function(_0x22e36d){try{jsonpatch[_0x0842('0x19')](_0x22e36d,_0x1a3460,!![]);}catch(_0x19baf0){return BPromise[_0x0842('0x1a')](_0x19baf0);}return _0x22e36d[_0x0842('0x1b')]();};}function saveUpdates(_0x33c619,_0x2192a4){return function(_0x34e96f){if(_0x34e96f){return _0x34e96f[_0x0842('0x1c')](_0x33c619)[_0x0842('0x1d')](function(_0x193f63){return _0x193f63;});}return null;};}function removeEntity(_0x2b1301,_0x3dd08c){return function(_0x3858cb){if(_0x3858cb){return _0x3858cb[_0x0842('0x1e')]()[_0x0842('0x1d')](function(){_0x2b1301[_0x0842('0x13')](0xcc)[_0x0842('0x12')]();});}};}function handleEntityNotFound(_0x474c54,_0x584fe1){return function(_0x5a3c6b){if(!_0x5a3c6b){_0x474c54[_0x0842('0x1f')](0x194);}return _0x5a3c6b;};}function handleError(_0x353bf9,_0x3b599e){_0x3b599e=_0x3b599e||0x1f4;return function(_0xc77530){logger['error'](_0xc77530[_0x0842('0x20')]);if(_0xc77530[_0x0842('0x21')]){delete _0xc77530[_0x0842('0x21')];}_0x353bf9[_0x0842('0x13')](_0x3b599e)[_0x0842('0x22')](_0xc77530);};}exports[_0x0842('0x23')]=function(_0x2beb2d,_0x318368){var _0x493afd={},_0x10bea4={},_0x5d97cb={'count':0x0,'rows':[]};var _0x531a6f=_[_0x0842('0x24')](db['VoiceDialReport']['rawAttributes'],function(_0x1ef41f){return{'name':_0x1ef41f[_0x0842('0x25')],'type':_0x1ef41f[_0x0842('0x26')][_0x0842('0x27')]};});_0x10bea4['model']=_[_0x0842('0x24')](_0x531a6f,_0x0842('0x21'));_0x10bea4[_0x0842('0x28')]=_['keys'](_0x2beb2d[_0x0842('0x28')]);_0x10bea4[_0x0842('0x29')]=_[_0x0842('0x2a')](_0x10bea4[_0x0842('0x2b')],_0x10bea4['query']);_0x493afd[_0x0842('0x2c')]=_[_0x0842('0x2a')](_0x10bea4[_0x0842('0x2b')],qs[_0x0842('0x2d')](_0x2beb2d[_0x0842('0x28')]['fields']));_0x493afd[_0x0842('0x2c')]=_0x493afd[_0x0842('0x2c')][_0x0842('0x2e')]?_0x493afd[_0x0842('0x2c')]:_0x10bea4[_0x0842('0x2b')];if(!_0x2beb2d[_0x0842('0x28')][_0x0842('0x2f')](_0x0842('0x30'))){_0x493afd[_0x0842('0x17')]=qs['limit'](_0x2beb2d[_0x0842('0x28')][_0x0842('0x17')]);_0x493afd[_0x0842('0x16')]=qs[_0x0842('0x16')](_0x2beb2d[_0x0842('0x28')][_0x0842('0x16')]);}_0x493afd[_0x0842('0x31')]=qs['sort'](_0x2beb2d[_0x0842('0x28')][_0x0842('0x32')]);_0x493afd[_0x0842('0x33')]=qs[_0x0842('0x29')](_[_0x0842('0x34')](_0x2beb2d[_0x0842('0x28')],_0x10bea4['filters']),_0x531a6f);if(_0x2beb2d['query'][_0x0842('0x35')]){_0x493afd[_0x0842('0x33')]=_['merge'](_0x493afd[_0x0842('0x33')],{'$or':_[_0x0842('0x24')](_0x531a6f,function(_0x48839e){if(_0x48839e[_0x0842('0x26')]!==_0x0842('0x36')){var _0x47b37c={};_0x47b37c[_0x48839e['name']]={'$like':'%'+_0x2beb2d[_0x0842('0x28')]['filter']+'%'};return _0x47b37c;}})});}_0x493afd=_[_0x0842('0x37')]({},_0x493afd,_0x2beb2d[_0x0842('0x38')]);var _0x5ef8f7={'where':_0x493afd['where']};return db[_0x0842('0x39')][_0x0842('0x15')](_0x5ef8f7)[_0x0842('0x1d')](function(_0x3089fa){_0x5d97cb[_0x0842('0x15')]=_0x3089fa;if(_0x2beb2d[_0x0842('0x28')][_0x0842('0x3a')]){_0x493afd[_0x0842('0x3b')]=[{'all':!![]}];}return db[_0x0842('0x39')][_0x0842('0x3c')](_0x493afd);})[_0x0842('0x1d')](function(_0x3391a2){_0x5d97cb[_0x0842('0x3d')]=_0x3391a2;return _0x5d97cb;})['then'](respondWithFilteredResult(_0x318368,_0x493afd))['catch'](handleError(_0x318368,null));};exports['show']=function(_0x4c8357,_0x31a96d){var _0x311d77={'raw':!![],'where':{'id':_0x4c8357[_0x0842('0x3e')]['id']}},_0x575c88={};_0x575c88[_0x0842('0x2b')]=_[_0x0842('0x3f')](db[_0x0842('0x39')][_0x0842('0x40')]);_0x575c88['query']=_[_0x0842('0x3f')](_0x4c8357[_0x0842('0x28')]);_0x575c88[_0x0842('0x29')]=_[_0x0842('0x2a')](_0x575c88[_0x0842('0x2b')],_0x575c88[_0x0842('0x28')]);_0x311d77[_0x0842('0x2c')]=_['intersection'](_0x575c88[_0x0842('0x2b')],qs[_0x0842('0x2d')](_0x4c8357[_0x0842('0x28')][_0x0842('0x2d')]));_0x311d77[_0x0842('0x2c')]=_0x311d77[_0x0842('0x2c')]['length']?_0x311d77[_0x0842('0x2c')]:_0x575c88[_0x0842('0x2b')];if(_0x4c8357[_0x0842('0x28')][_0x0842('0x3a')]){_0x311d77[_0x0842('0x3b')]=[{'all':!![]}];}_0x311d77=_[_0x0842('0x37')]({},_0x311d77,_0x4c8357[_0x0842('0x38')]);return db[_0x0842('0x39')]['find'](_0x311d77)[_0x0842('0x1d')](handleEntityNotFound(_0x31a96d,null))[_0x0842('0x1d')](respondWithResult(_0x31a96d,null))[_0x0842('0x41')](handleError(_0x31a96d,null));};exports[_0x0842('0x42')]=function(_0x3f6780,_0x22437f){return db[_0x0842('0x39')][_0x0842('0x42')](_0x3f6780[_0x0842('0x43')],{})[_0x0842('0x1d')](respondWithResult(_0x22437f,0xc9))[_0x0842('0x41')](handleError(_0x22437f,null));};exports['update']=function(_0x2b7316,_0x40f623){if(_0x2b7316[_0x0842('0x43')]['id']){delete _0x2b7316[_0x0842('0x43')]['id'];}return db[_0x0842('0x39')][_0x0842('0x44')]({'where':{'id':_0x2b7316[_0x0842('0x3e')]['id']}})[_0x0842('0x1d')](handleEntityNotFound(_0x40f623,null))[_0x0842('0x1d')](saveUpdates(_0x2b7316['body'],null))[_0x0842('0x1d')](respondWithResult(_0x40f623,null))[_0x0842('0x41')](handleError(_0x40f623,null));};exports[_0x0842('0x1e')]=function(_0x30959d,_0x3d83d3){return db[_0x0842('0x39')][_0x0842('0x44')]({'where':{'id':_0x30959d['params']['id']}})['then'](handleEntityNotFound(_0x3d83d3,null))[_0x0842('0x1d')](removeEntity(_0x3d83d3,null))[_0x0842('0x41')](handleError(_0x3d83d3,null));};exports['describe']=function(_0x4c9519,_0x151b3c){return db[_0x0842('0x39')][_0x0842('0x45')]()[_0x0842('0x1d')](respondWithResult(_0x151b3c,null))[_0x0842('0x41')](handleError(_0x151b3c,null));}; \ No newline at end of file +var _0xf6c4=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto'];(function(_0x38312b,_0xbddfbc){var _0x3df78a=function(_0x179424){while(--_0x179424){_0x38312b['push'](_0x38312b['shift']());}};_0x3df78a(++_0xbddfbc);}(_0xf6c4,0x118));var _0x4f6c=function(_0x564fe1,_0x2dd2e2){_0x564fe1=_0x564fe1-0x0;var _0x1a7f56=_0xf6c4[_0x564fe1];return _0x1a7f56;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4f6c('0x0'));var zipdir=require(_0x4f6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f6c('0x2'));var moment=require(_0x4f6c('0x3'));var BPromise=require(_0x4f6c('0x4'));var Mustache=require(_0x4f6c('0x5'));var util=require(_0x4f6c('0x6'));var path=require(_0x4f6c('0x7'));var sox=require('sox');var csv=require(_0x4f6c('0x8'));var ejs=require(_0x4f6c('0x9'));var fs=require('fs');var _=require(_0x4f6c('0xa'));var squel=require('squel');var crypto=require(_0x4f6c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4f6c('0x8'));var querystring=require(_0x4f6c('0xc'));var Papa=require('papaparse');var Redis=require(_0x4f6c('0xd'));var authService=require(_0x4f6c('0xe'));var qs=require(_0x4f6c('0xf'));var as=require(_0x4f6c('0x10'));var hardwareService=require(_0x4f6c('0x11'));var logger=require('../../config/logger')(_0x4f6c('0x12'));var utils=require(_0x4f6c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4f6c('0x14'));var db=require(_0x4f6c('0x15'))['db'];function respondWithStatusCode(_0x1148e7,_0x33145e){_0x33145e=_0x33145e||0xcc;return function(_0x3ecef2){if(_0x3ecef2){return _0x1148e7[_0x4f6c('0x16')](_0x33145e);}return _0x1148e7[_0x4f6c('0x17')](_0x33145e)[_0x4f6c('0x18')]();};}function respondWithResult(_0x56d337,_0x2fb02e){_0x2fb02e=_0x2fb02e||0xc8;return function(_0x47201c){if(_0x47201c){return _0x56d337[_0x4f6c('0x17')](_0x2fb02e)[_0x4f6c('0x19')](_0x47201c);}};}function respondWithFilteredResult(_0x509380,_0x54002e){return function(_0x153029){if(_0x153029){var _0x445a79=_0x153029[_0x4f6c('0x1a')],_0x1b6092=_0x54002e[_0x4f6c('0x1b')],_0x40a5b9=_0x54002e['offset']+_0x54002e[_0x4f6c('0x1c')],_0x8b3ba4;if(_0x40a5b9>=_0x445a79){_0x40a5b9=_0x445a79;_0x8b3ba4=0xc8;}else{_0x8b3ba4=0xce;}_0x509380[_0x4f6c('0x17')](_0x8b3ba4);return _0x509380[_0x4f6c('0x1d')](_0x4f6c('0x1e'),_0x1b6092+'-'+_0x40a5b9+'/'+_0x445a79)[_0x4f6c('0x19')](_0x153029);}return null;};}function patchUpdates(_0x3f8a58){return function(_0x386050){try{jsonpatch[_0x4f6c('0x1f')](_0x386050,_0x3f8a58,!![]);}catch(_0x2bbddf){return BPromise[_0x4f6c('0x20')](_0x2bbddf);}return _0x386050[_0x4f6c('0x21')]();};}function saveUpdates(_0x103581,_0x31c4b9){return function(_0x5960e7){if(_0x5960e7){return _0x5960e7[_0x4f6c('0x22')](_0x103581)['then'](function(_0x42c378){return _0x42c378;});}return null;};}function removeEntity(_0x15cb22,_0x5511a8){return function(_0x15aacb){if(_0x15aacb){return _0x15aacb[_0x4f6c('0x23')]()[_0x4f6c('0x24')](function(){_0x15cb22[_0x4f6c('0x17')](0xcc)[_0x4f6c('0x18')]();});}};}function handleEntityNotFound(_0xd398d0,_0x3acd0f){return function(_0x266e68){if(!_0x266e68){_0xd398d0['sendStatus'](0x194);}return _0x266e68;};}function handleError(_0x528041,_0x1c6a6c){_0x1c6a6c=_0x1c6a6c||0x1f4;return function(_0x3a984a){logger['error'](_0x3a984a[_0x4f6c('0x25')]);if(_0x3a984a[_0x4f6c('0x26')]){delete _0x3a984a['name'];}_0x528041['status'](_0x1c6a6c)['send'](_0x3a984a);};}exports[_0x4f6c('0x27')]=function(_0x31fcda,_0x28b4c7){var _0x1ff279={},_0x22ab0a={},_0x4b0c45={'count':0x0,'rows':[]};var _0x5bd58e=_[_0x4f6c('0x28')](db[_0x4f6c('0x29')][_0x4f6c('0x2a')],function(_0x33b72c){return{'name':_0x33b72c[_0x4f6c('0x2b')],'type':_0x33b72c[_0x4f6c('0x2c')]['key']};});_0x22ab0a[_0x4f6c('0x2d')]=_['map'](_0x5bd58e,_0x4f6c('0x26'));_0x22ab0a[_0x4f6c('0x2e')]=_['keys'](_0x31fcda['query']);_0x22ab0a[_0x4f6c('0x2f')]=_['intersection'](_0x22ab0a[_0x4f6c('0x2d')],_0x22ab0a[_0x4f6c('0x2e')]);_0x1ff279['attributes']=_[_0x4f6c('0x30')](_0x22ab0a[_0x4f6c('0x2d')],qs[_0x4f6c('0x31')](_0x31fcda[_0x4f6c('0x2e')][_0x4f6c('0x31')]));_0x1ff279[_0x4f6c('0x32')]=_0x1ff279[_0x4f6c('0x32')][_0x4f6c('0x33')]?_0x1ff279['attributes']:_0x22ab0a[_0x4f6c('0x2d')];if(!_0x31fcda[_0x4f6c('0x2e')][_0x4f6c('0x34')](_0x4f6c('0x35'))){_0x1ff279[_0x4f6c('0x1c')]=qs[_0x4f6c('0x1c')](_0x31fcda['query'][_0x4f6c('0x1c')]);_0x1ff279['offset']=qs[_0x4f6c('0x1b')](_0x31fcda[_0x4f6c('0x2e')][_0x4f6c('0x1b')]);}_0x1ff279[_0x4f6c('0x36')]=qs['sort'](_0x31fcda[_0x4f6c('0x2e')][_0x4f6c('0x37')]);_0x1ff279[_0x4f6c('0x38')]=qs['filters'](_[_0x4f6c('0x39')](_0x31fcda[_0x4f6c('0x2e')],_0x22ab0a['filters']),_0x5bd58e);if(_0x31fcda[_0x4f6c('0x2e')][_0x4f6c('0x3a')]){_0x1ff279[_0x4f6c('0x38')]=_['merge'](_0x1ff279[_0x4f6c('0x38')],{'$or':_[_0x4f6c('0x28')](_0x5bd58e,function(_0x342505){if(_0x342505[_0x4f6c('0x2c')]!==_0x4f6c('0x3b')){var _0x5efae6={};_0x5efae6[_0x342505[_0x4f6c('0x26')]]={'$like':'%'+_0x31fcda[_0x4f6c('0x2e')]['filter']+'%'};return _0x5efae6;}})});}_0x1ff279=_['merge']({},_0x1ff279,_0x31fcda[_0x4f6c('0x3c')]);var _0x34c2f2={'where':_0x1ff279[_0x4f6c('0x38')]};return db[_0x4f6c('0x29')][_0x4f6c('0x1a')](_0x34c2f2)[_0x4f6c('0x24')](function(_0x45d10b){_0x4b0c45['count']=_0x45d10b;if(_0x31fcda[_0x4f6c('0x2e')][_0x4f6c('0x3d')]){_0x1ff279[_0x4f6c('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x4f6c('0x3f')](_0x1ff279);})[_0x4f6c('0x24')](function(_0x497759){_0x4b0c45[_0x4f6c('0x40')]=_0x497759;return _0x4b0c45;})['then'](respondWithFilteredResult(_0x28b4c7,_0x1ff279))[_0x4f6c('0x41')](handleError(_0x28b4c7,null));};exports[_0x4f6c('0x42')]=function(_0x4460c8,_0x4edcd3){var _0x273037={'raw':!![],'where':{'id':_0x4460c8[_0x4f6c('0x43')]['id']}},_0x44e188={};_0x44e188[_0x4f6c('0x2d')]=_[_0x4f6c('0x44')](db['VoiceDialReport'][_0x4f6c('0x2a')]);_0x44e188['query']=_[_0x4f6c('0x44')](_0x4460c8[_0x4f6c('0x2e')]);_0x44e188[_0x4f6c('0x2f')]=_['intersection'](_0x44e188[_0x4f6c('0x2d')],_0x44e188['query']);_0x273037['attributes']=_[_0x4f6c('0x30')](_0x44e188['model'],qs[_0x4f6c('0x31')](_0x4460c8[_0x4f6c('0x2e')][_0x4f6c('0x31')]));_0x273037[_0x4f6c('0x32')]=_0x273037['attributes']['length']?_0x273037['attributes']:_0x44e188[_0x4f6c('0x2d')];if(_0x4460c8[_0x4f6c('0x2e')][_0x4f6c('0x3d')]){_0x273037[_0x4f6c('0x3e')]=[{'all':!![]}];}_0x273037=_['merge']({},_0x273037,_0x4460c8['options']);return db[_0x4f6c('0x29')][_0x4f6c('0x45')](_0x273037)[_0x4f6c('0x24')](handleEntityNotFound(_0x4edcd3,null))[_0x4f6c('0x24')](respondWithResult(_0x4edcd3,null))['catch'](handleError(_0x4edcd3,null));};exports[_0x4f6c('0x46')]=function(_0x2c82b5,_0x1c50ad){return db[_0x4f6c('0x29')]['create'](_0x2c82b5[_0x4f6c('0x47')],{})[_0x4f6c('0x24')](respondWithResult(_0x1c50ad,0xc9))['catch'](handleError(_0x1c50ad,null));};exports[_0x4f6c('0x22')]=function(_0xc87b16,_0x58394e){if(_0xc87b16[_0x4f6c('0x47')]['id']){delete _0xc87b16[_0x4f6c('0x47')]['id'];}return db[_0x4f6c('0x29')]['find']({'where':{'id':_0xc87b16[_0x4f6c('0x43')]['id']}})['then'](handleEntityNotFound(_0x58394e,null))[_0x4f6c('0x24')](saveUpdates(_0xc87b16[_0x4f6c('0x47')],null))['then'](respondWithResult(_0x58394e,null))['catch'](handleError(_0x58394e,null));};exports[_0x4f6c('0x23')]=function(_0x4dd60a,_0x433e0a){return db[_0x4f6c('0x29')]['find']({'where':{'id':_0x4dd60a[_0x4f6c('0x43')]['id']}})['then'](handleEntityNotFound(_0x433e0a,null))['then'](removeEntity(_0x433e0a,null))[_0x4f6c('0x41')](handleError(_0x433e0a,null));};exports[_0x4f6c('0x48')]=function(_0x2e6d28,_0x2ffbe2){return db[_0x4f6c('0x29')]['describe']()[_0x4f6c('0x24')](respondWithResult(_0x2ffbe2,null))[_0x4f6c('0x41')](handleError(_0x2ffbe2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index be15b3a..dd20d97 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 _0xaef8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','VoiceDialReport','lodash'];(function(_0x1bad8a,_0x4a160f){var _0xfa3b6b=function(_0x1abb3a){while(--_0x1abb3a){_0x1bad8a['push'](_0x1bad8a['shift']());}};_0xfa3b6b(++_0x4a160f);}(_0xaef8,0x173));var _0x8aef=function(_0x38759f,_0x1eaa52){_0x38759f=_0x38759f-0x0;var _0x30fd7e=_0xaef8[_0x38759f];return _0x30fd7e;};'use strict';var _=require(_0x8aef('0x0'));var util=require(_0x8aef('0x1'));var logger=require(_0x8aef('0x2'))(_0x8aef('0x3'));var moment=require(_0x8aef('0x4'));var BPromise=require(_0x8aef('0x5'));var rp=require(_0x8aef('0x6'));var fs=require('fs');var path=require(_0x8aef('0x7'));var rimraf=require(_0x8aef('0x8'));var config=require('../../config/environment');var attributes=require(_0x8aef('0x9'));module[_0x8aef('0xa')]=function(_0x2607d4,_0x29e4f){return _0x2607d4['define'](_0x8aef('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3932=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1001b2,_0x3fc3b7){var _0x52cab2=function(_0x2a1c11){while(--_0x2a1c11){_0x1001b2['push'](_0x1001b2['shift']());}};_0x52cab2(++_0x3fc3b7);}(_0x3932,0x131));var _0x2393=function(_0x1eb24f,_0x5229b6){_0x1eb24f=_0x1eb24f-0x0;var _0x23594a=_0x3932[_0x1eb24f];return _0x23594a;};'use strict';var _=require(_0x2393('0x0'));var util=require(_0x2393('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2393('0x2'));var BPromise=require('bluebird');var rp=require(_0x2393('0x3'));var fs=require('fs');var path=require(_0x2393('0x4'));var rimraf=require(_0x2393('0x5'));var config=require(_0x2393('0x6'));var attributes=require(_0x2393('0x7'));module[_0x2393('0x8')]=function(_0x3bb741,_0x27cc3c){return _0x3bb741[_0x2393('0x9')](_0x2393('0xa'),attributes,{'tableName':_0x2393('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2393('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c549bd7..6ffd40b 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 _0xcf2e=['code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options','stringify','UpdateVoiceDialReport','body','raw','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x11f8e9,_0x67f67f){var _0x3a04d7=function(_0x5a230c){while(--_0x5a230c){_0x11f8e9['push'](_0x11f8e9['shift']());}};_0x3a04d7(++_0x67f67f);}(_0xcf2e,0x111));var _0xecf2=function(_0x8a917c,_0x19c5f6){_0x8a917c=_0x8a917c-0x0;var _0x2c704e=_0xcf2e[_0x8a917c];return _0x2c704e;};'use strict';var _=require(_0xecf2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xecf2('0x1'));var rs=require(_0xecf2('0x2'));var fs=require('fs');var Redis=require(_0xecf2('0x3'));var db=require(_0xecf2('0x4'))['db'];var utils=require(_0xecf2('0x5'));var logger=require(_0xecf2('0x6'))(_0xecf2('0x7'));var config=require(_0xecf2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xecf2('0x9')][_0xecf2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x490a5f,_0x208dd6,_0x4b0b62){return new BPromise(function(_0x304b8a,_0x3cc70f){return client['request'](_0x490a5f,_0x4b0b62)[_0xecf2('0xb')](function(_0x5e3a80){logger[_0xecf2('0xc')](_0xecf2('0xd'),_0x208dd6,_0xecf2('0xe'));logger[_0xecf2('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x208dd6,_0xecf2('0xe'),JSON['stringify'](_0x5e3a80));if(_0x5e3a80[_0xecf2('0x10')]){if(_0x5e3a80['error'][_0xecf2('0x11')]===0x1f4){logger[_0xecf2('0x10')](_0xecf2('0xd'),_0x208dd6,_0x5e3a80[_0xecf2('0x10')]['message']);return _0x3cc70f(_0x5e3a80['error'][_0xecf2('0x12')]);}logger[_0xecf2('0x10')](_0xecf2('0xd'),_0x208dd6,_0x5e3a80[_0xecf2('0x10')][_0xecf2('0x12')]);return _0x304b8a(_0x5e3a80[_0xecf2('0x10')][_0xecf2('0x12')]);}else{logger[_0xecf2('0xc')](_0xecf2('0xd'),_0x208dd6,_0xecf2('0xe'));_0x304b8a(_0x5e3a80[_0xecf2('0x13')][_0xecf2('0x12')]);}})[_0xecf2('0x14')](function(_0x1a4653){logger[_0xecf2('0x10')](_0xecf2('0xd'),_0x208dd6,_0x1a4653);_0x3cc70f(_0x1a4653);});});}exports[_0xecf2('0x15')]=function(_0x53924a){var _0x139beb=this;return new Promise(function(_0x422f82,_0x1e12b5){return db[_0xecf2('0x16')]['create'](_0x53924a['body'],{'raw':_0x53924a[_0xecf2('0x17')]?_0x53924a[_0xecf2('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xecf2('0xb')](function(_0x16d597){logger[_0xecf2('0xc')](_0xecf2('0x15'),_0x53924a);logger[_0xecf2('0xf')]('CreateVoiceDialReport',_0x53924a,JSON[_0xecf2('0x18')](_0x16d597));_0x422f82(_0x16d597);})[_0xecf2('0x14')](function(_0x3c7275){logger['error'](_0xecf2('0x15'),_0x3c7275[_0xecf2('0x12')],_0x53924a);_0x1e12b5(_0x139beb[_0xecf2('0x10')](0x1f4,_0x3c7275[_0xecf2('0x12')]));});});};exports[_0xecf2('0x19')]=function(_0x12e98b){var _0x47921c=this;return new Promise(function(_0x28f29a,_0x255406){return db[_0xecf2('0x16')]['update'](_0x12e98b[_0xecf2('0x1a')],{'raw':_0x12e98b[_0xecf2('0x17')]?_0x12e98b['options'][_0xecf2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e98b[_0xecf2('0x17')]?_0x12e98b[_0xecf2('0x17')]['where']||null:null,'attributes':_0x12e98b[_0xecf2('0x17')]?_0x12e98b[_0xecf2('0x17')]['attributes']||null:null,'limit':_0x12e98b[_0xecf2('0x17')]?_0x12e98b['options'][_0xecf2('0x1c')]||null:null})['then'](function(_0x4500b8){logger[_0xecf2('0xc')](_0xecf2('0x19'),_0x12e98b);logger[_0xecf2('0xf')]('UpdateVoiceDialReport',_0x12e98b,JSON[_0xecf2('0x18')](_0x4500b8));_0x28f29a(_0x4500b8);})[_0xecf2('0x14')](function(_0x16a4ad){logger[_0xecf2('0x10')]('UpdateVoiceDialReport',_0x16a4ad[_0xecf2('0x12')],_0x12e98b);_0x255406(_0x47921c[_0xecf2('0x10')](0x1f4,_0x16a4ad[_0xecf2('0x12')]));});});}; \ No newline at end of file +var _0xbaa9=['limit','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','update','where','attributes'];(function(_0x5736fa,_0xbd0b59){var _0x79eb14=function(_0x4a4778){while(--_0x4a4778){_0x5736fa['push'](_0x5736fa['shift']());}};_0x79eb14(++_0xbd0b59);}(_0xbaa9,0xd3));var _0x9baa=function(_0x1986bd,_0x577dfb){_0x1986bd=_0x1986bd-0x0;var _0x4b2041=_0xbaa9[_0x1986bd];return _0x4b2041;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9baa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9baa('0x2'));var db=require(_0x9baa('0x3'))['db'];var utils=require(_0x9baa('0x4'));var logger=require(_0x9baa('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9baa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x365c05,_0x816e0e,_0x38f719){return new BPromise(function(_0x446c24,_0x5e49e7){return client[_0x9baa('0x7')](_0x365c05,_0x38f719)['then'](function(_0x499428){logger[_0x9baa('0x8')]('VoiceDialReport,\x20%s,\x20%s',_0x816e0e,_0x9baa('0x9'));logger[_0x9baa('0xa')](_0x9baa('0xb'),_0x816e0e,_0x9baa('0x9'),JSON[_0x9baa('0xc')](_0x499428));if(_0x499428[_0x9baa('0xd')]){if(_0x499428[_0x9baa('0xd')]['code']===0x1f4){logger['error'](_0x9baa('0xe'),_0x816e0e,_0x499428[_0x9baa('0xd')][_0x9baa('0xf')]);return _0x5e49e7(_0x499428[_0x9baa('0xd')][_0x9baa('0xf')]);}logger[_0x9baa('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x816e0e,_0x499428[_0x9baa('0xd')]['message']);return _0x446c24(_0x499428[_0x9baa('0xd')]['message']);}else{logger[_0x9baa('0x8')](_0x9baa('0xe'),_0x816e0e,_0x9baa('0x9'));_0x446c24(_0x499428[_0x9baa('0x10')][_0x9baa('0xf')]);}})[_0x9baa('0x11')](function(_0x38e1b6){logger[_0x9baa('0xd')](_0x9baa('0xe'),_0x816e0e,_0x38e1b6);_0x5e49e7(_0x38e1b6);});});}exports[_0x9baa('0x12')]=function(_0x6bcbe3){var _0xbce3ac=this;return new Promise(function(_0x19bfaf,_0x1fab52){return db[_0x9baa('0x13')][_0x9baa('0x14')](_0x6bcbe3[_0x9baa('0x15')],{'raw':_0x6bcbe3[_0x9baa('0x16')]?_0x6bcbe3[_0x9baa('0x16')][_0x9baa('0x17')]===undefined?!![]:![]:!![]})[_0x9baa('0x18')](function(_0x15f9cc){logger[_0x9baa('0x8')]('CreateVoiceDialReport',_0x6bcbe3);logger[_0x9baa('0xa')](_0x9baa('0x12'),_0x6bcbe3,JSON[_0x9baa('0xc')](_0x15f9cc));_0x19bfaf(_0x15f9cc);})[_0x9baa('0x11')](function(_0x50b5d5){logger['error']('CreateVoiceDialReport',_0x50b5d5[_0x9baa('0xf')],_0x6bcbe3);_0x1fab52(_0xbce3ac[_0x9baa('0xd')](0x1f4,_0x50b5d5[_0x9baa('0xf')]));});});};exports[_0x9baa('0x19')]=function(_0x4fbf5b){var _0x4c305f=this;return new Promise(function(_0x20c498,_0x4ef0de){return db[_0x9baa('0x13')][_0x9baa('0x1a')](_0x4fbf5b[_0x9baa('0x15')],{'raw':_0x4fbf5b[_0x9baa('0x16')]?_0x4fbf5b['options'][_0x9baa('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fbf5b[_0x9baa('0x16')]?_0x4fbf5b['options'][_0x9baa('0x1b')]||null:null,'attributes':_0x4fbf5b[_0x9baa('0x16')]?_0x4fbf5b['options'][_0x9baa('0x1c')]||null:null,'limit':_0x4fbf5b['options']?_0x4fbf5b[_0x9baa('0x16')][_0x9baa('0x1d')]||null:null})[_0x9baa('0x18')](function(_0x230477){logger[_0x9baa('0x8')](_0x9baa('0x19'),_0x4fbf5b);logger[_0x9baa('0xa')]('UpdateVoiceDialReport',_0x4fbf5b,JSON[_0x9baa('0xc')](_0x230477));_0x20c498(_0x230477);})[_0x9baa('0x11')](function(_0x4d786c){logger[_0x9baa('0xd')](_0x9baa('0x19'),_0x4d786c[_0x9baa('0xf')],_0x4fbf5b);_0x4ef0de(_0x4c305f[_0x9baa('0xd')](0x1f4,_0x4d786c[_0x9baa('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 4361724..2d49714 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 _0xd1e1=['isAuthenticated','index','show','create','post','/:id/applications','addApplications','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get'];(function(_0x5aae50,_0x207ca2){var _0x1edc90=function(_0x20f864){while(--_0x20f864){_0x5aae50['push'](_0x5aae50['shift']());}};_0x1edc90(++_0x207ca2);}(_0xd1e1,0x1a8));var _0x1d1e=function(_0x1e33a0,_0x349081){_0x1e33a0=_0x1e33a0-0x0;var _0x3438fa=_0xd1e1[_0x1e33a0];return _0x3438fa;};'use strict';var multer=require(_0x1d1e('0x0'));var util=require(_0x1d1e('0x1'));var path=require(_0x1d1e('0x2'));var timeout=require(_0x1d1e('0x3'));var express=require(_0x1d1e('0x4'));var router=express[_0x1d1e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1d1e('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x1d1e('0x7')]('/',auth[_0x1d1e('0x8')](),controller[_0x1d1e('0x9')]);router[_0x1d1e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1d1e('0xa')]);router['post']('/',auth[_0x1d1e('0x8')](),controller[_0x1d1e('0xb')]);router[_0x1d1e('0xc')](_0x1d1e('0xd'),auth[_0x1d1e('0x8')](),controller[_0x1d1e('0xe')]);router['put'](_0x1d1e('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1d1e('0xf'),auth['isAuthenticated'](),controller[_0x1d1e('0x10')]);module[_0x1d1e('0x11')]=router; \ No newline at end of file +var _0xe7ed=['/:id/applications','addApplications','put','update','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7ed,0x15b));var _0xde7e=function(_0x12e317,_0x1c96f5){_0x12e317=_0x12e317-0x0;var _0x3fc099=_0xe7ed[_0x12e317];return _0x3fc099;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde7e('0x0'));var timeout=require(_0xde7e('0x1'));var express=require(_0xde7e('0x2'));var router=express[_0xde7e('0x3')]();var auth=require(_0xde7e('0x4'));var interaction=require(_0xde7e('0x5'));var config=require(_0xde7e('0x6'));var controller=require(_0xde7e('0x7'));router[_0xde7e('0x8')]('/',auth[_0xde7e('0x9')](),controller[_0xde7e('0xa')]);router[_0xde7e('0x8')](_0xde7e('0xb'),auth[_0xde7e('0x9')](),controller[_0xde7e('0xc')]);router['post']('/',auth[_0xde7e('0x9')](),controller['create']);router[_0xde7e('0xd')](_0xde7e('0xe'),auth[_0xde7e('0x9')](),controller[_0xde7e('0xf')]);router[_0xde7e('0x10')](_0xde7e('0xb'),auth[_0xde7e('0x9')](),controller[_0xde7e('0x11')]);router['delete'](_0xde7e('0xb'),auth['isAuthenticated'](),controller[_0xde7e('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 f414247..ce85eb6 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x5dd848,_0x59c784){var _0x22becf=function(_0x542c7b){while(--_0x542c7b){_0x5dd848['push'](_0x5dd848['shift']());}};_0x22becf(++_0x59c784);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x328fb8,_0x5d294a){var _0x4314c7=function(_0x5debf0){while(--_0x5debf0){_0x328fb8['push'](_0x328fb8['shift']());}};_0x4314c7(++_0x5d294a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 43d30a5..f826762 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 _0xcedb=['recordingFormat','cutdigits','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','name','UserProfileResource','end','stack','send','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','body','startsWith','exten','user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcedb,0x1b7));var _0xbced=function(_0xf11126,_0x1eac80){_0xf11126=_0xf11126-0x0;var _0x216602=_0xcedb[_0xf11126];return _0x216602;};'use strict';var pdf=require(_0xbced('0x0'));var emlformat=require(_0xbced('0x1'));var rimraf=require(_0xbced('0x2'));var zipdir=require(_0xbced('0x3'));var jsonpatch=require(_0xbced('0x4'));var rp=require(_0xbced('0x5'));var moment=require(_0xbced('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbced('0x7'));var util=require(_0xbced('0x8'));var path=require('path');var sox=require(_0xbced('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbced('0xa'));var squel=require(_0xbced('0xb'));var crypto=require('crypto');var jsforce=require(_0xbced('0xc'));var deskjs=require(_0xbced('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbced('0xe'));var Papa=require(_0xbced('0xf'));var Redis=require(_0xbced('0x10'));var authService=require(_0xbced('0x11'));var qs=require(_0xbced('0x12'));var as=require(_0xbced('0x13'));var hardwareService=require(_0xbced('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbced('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbced('0x16'));var db=require(_0xbced('0x17'))['db'];config[_0xbced('0x18')]=_[_0xbced('0x19')](config[_0xbced('0x18')],{'host':_0xbced('0x1a'),'port':0x18eb});var socket=require(_0xbced('0x1b'))(new Redis(config[_0xbced('0x18')]));require(_0xbced('0x1c'))[_0xbced('0x1d')](socket);function respondWithStatusCode(_0x57ec7b,_0x4502ae){_0x4502ae=_0x4502ae||0xcc;return function(_0x11ea96){if(_0x11ea96){return _0x57ec7b['sendStatus'](_0x4502ae);}return _0x57ec7b[_0xbced('0x1e')](_0x4502ae)['end']();};}function respondWithResult(_0x18cc9b,_0x23219a){_0x23219a=_0x23219a||0xc8;return function(_0x367533){if(_0x367533){return _0x18cc9b[_0xbced('0x1e')](_0x23219a)[_0xbced('0x1f')](_0x367533);}};}function respondWithFilteredResult(_0x40cfcf,_0x4f891d){return function(_0x250ff4){if(_0x250ff4){var _0x41353f=_0x250ff4[_0xbced('0x20')],_0x52efc6=_0x4f891d[_0xbced('0x21')],_0x252f7f=_0x4f891d['offset']+_0x4f891d[_0xbced('0x22')],_0x168acd;if(_0x252f7f>=_0x41353f){_0x252f7f=_0x41353f;_0x168acd=0xc8;}else{_0x168acd=0xce;}_0x40cfcf[_0xbced('0x1e')](_0x168acd);return _0x40cfcf[_0xbced('0x23')](_0xbced('0x24'),_0x52efc6+'-'+_0x252f7f+'/'+_0x41353f)[_0xbced('0x1f')](_0x250ff4);}return null;};}function patchUpdates(_0x1d304c){return function(_0x339ad9){try{jsonpatch[_0xbced('0x25')](_0x339ad9,_0x1d304c,!![]);}catch(_0xb775ae){return BPromise[_0xbced('0x26')](_0xb775ae);}return _0x339ad9[_0xbced('0x27')]();};}function saveUpdates(_0x4c25e0,_0x471939){return function(_0x4434a6){if(_0x4434a6){return _0x4434a6[_0xbced('0x28')](_0x4c25e0)['then'](function(_0x8af517){return _0x8af517;});}return null;};}function removeEntity(_0x35006d,_0x31cc28){return function(_0x3e66a7){if(_0x3e66a7){return _0x3e66a7[_0xbced('0x29')]()[_0xbced('0x2a')](function(){var _0x26054a=_0x3e66a7[_0xbced('0x2b')]({'plain':!![]});var _0x8def3c=[{'name':'InboundRoutes','value':_0xbced('0x2c'),'ignore':![]},{'name':_0xbced('0x2d'),'value':_0xbced('0x2e'),'ignore':![]},{'name':_0xbced('0x2f'),'value':_0xbced('0x30'),'ignore':![]}];var _0x501220=_(_0x8def3c)[_0xbced('0x31')](_0xbced('0x32'))['map'](_0xbced('0x33'))[_0xbced('0x33')]();if(_[_0xbced('0x34')](_0x501220,_0x26054a['type'])){return;}var _0x2d4d44=_['find'](_0x8def3c,[_0xbced('0x33'),_0x26054a[_0xbced('0x35')]])[_0xbced('0x36')];return db[_0xbced('0x37')]['destroy']({'where':{'type':_0x2d4d44,'resourceId':_0x26054a['id']}})['then'](function(){return _0x3e66a7;});})[_0xbced('0x2a')](function(){_0x35006d[_0xbced('0x1e')](0xcc)[_0xbced('0x38')]();});}};}function handleEntityNotFound(_0x11b799,_0x1ee21c){return function(_0x35ed59){if(!_0x35ed59){_0x11b799['sendStatus'](0x194);}return _0x35ed59;};}function handleError(_0x4760a3,_0x366edc){_0x366edc=_0x366edc||0x1f4;return function(_0xe7f5ae){logger['error'](_0xe7f5ae[_0xbced('0x39')]);if(_0xe7f5ae[_0xbced('0x36')]){delete _0xe7f5ae[_0xbced('0x36')];}_0x4760a3[_0xbced('0x1e')](_0x366edc)[_0xbced('0x3a')](_0xe7f5ae);};}exports['index']=function(_0x51192c,_0x6067b9){var _0x2a5f2a={},_0x334406={},_0x5397b2={'count':0x0,'rows':[]};var _0x2c599e=_['map'](db[_0xbced('0x3b')]['rawAttributes'],function(_0x33c5e4){return{'name':_0x33c5e4[_0xbced('0x3c')],'type':_0x33c5e4['type'][_0xbced('0x3d')]};});_0x334406[_0xbced('0x3e')]=_['map'](_0x2c599e,_0xbced('0x36'));_0x334406[_0xbced('0x3f')]=_[_0xbced('0x40')](_0x51192c['query']);_0x334406[_0xbced('0x41')]=_['intersection'](_0x334406[_0xbced('0x3e')],_0x334406[_0xbced('0x3f')]);_0x2a5f2a['attributes']=_[_0xbced('0x42')](_0x334406[_0xbced('0x3e')],qs[_0xbced('0x43')](_0x51192c['query'][_0xbced('0x43')]));_0x2a5f2a['attributes']=_0x2a5f2a[_0xbced('0x44')][_0xbced('0x45')]?_0x2a5f2a['attributes']:_0x334406[_0xbced('0x3e')];if(!_0x51192c[_0xbced('0x3f')][_0xbced('0x46')](_0xbced('0x47'))){_0x2a5f2a[_0xbced('0x22')]=qs[_0xbced('0x22')](_0x51192c[_0xbced('0x3f')]['limit']);_0x2a5f2a[_0xbced('0x21')]=qs[_0xbced('0x21')](_0x51192c[_0xbced('0x3f')]['offset']);}_0x2a5f2a[_0xbced('0x48')]=qs[_0xbced('0x49')](_0x51192c['query']['sort']);_0x2a5f2a[_0xbced('0x4a')]=qs[_0xbced('0x41')](_[_0xbced('0x4b')](_0x51192c[_0xbced('0x3f')],_0x334406[_0xbced('0x41')]),_0x2c599e);if(_0x51192c[_0xbced('0x3f')][_0xbced('0x31')]){_0x2a5f2a[_0xbced('0x4a')]=_[_0xbced('0x4c')](_0x2a5f2a[_0xbced('0x4a')],{'$or':_[_0xbced('0x4d')](_0x2c599e,function(_0x464dcc){if(_0x464dcc['type']!==_0xbced('0x4e')){var _0x432f9c={};_0x432f9c[_0x464dcc[_0xbced('0x36')]]={'$like':'%'+_0x51192c['query'][_0xbced('0x31')]+'%'};return _0x432f9c;}})});}_0x2a5f2a=_[_0xbced('0x4c')]({},_0x2a5f2a,_0x51192c[_0xbced('0x4f')]);var _0x10bcee={'where':_0x2a5f2a[_0xbced('0x4a')]};return db[_0xbced('0x3b')][_0xbced('0x20')](_0x10bcee)[_0xbced('0x2a')](function(_0x3edd3c){_0x5397b2[_0xbced('0x20')]=_0x3edd3c;if(_0x51192c[_0xbced('0x3f')][_0xbced('0x50')]){_0x2a5f2a['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xbced('0x51')](_0x2a5f2a);})['then'](function(_0x20480c){_0x5397b2[_0xbced('0x52')]=_0x20480c;return _0x5397b2;})[_0xbced('0x2a')](respondWithFilteredResult(_0x6067b9,_0x2a5f2a))['catch'](handleError(_0x6067b9,null));};exports['show']=function(_0x411bf6,_0x2165b4){var _0x161f4f={'raw':![],'where':{'id':_0x411bf6[_0xbced('0x53')]['id']}},_0x2b3176={};_0x2b3176[_0xbced('0x3e')]=_[_0xbced('0x40')](db[_0xbced('0x3b')]['rawAttributes']);_0x2b3176['query']=_[_0xbced('0x40')](_0x411bf6['query']);_0x2b3176[_0xbced('0x41')]=_['intersection'](_0x2b3176[_0xbced('0x3e')],_0x2b3176[_0xbced('0x3f')]);_0x161f4f[_0xbced('0x44')]=_['intersection'](_0x2b3176['model'],qs[_0xbced('0x43')](_0x411bf6[_0xbced('0x3f')][_0xbced('0x43')]));_0x161f4f[_0xbced('0x44')]=_0x161f4f[_0xbced('0x44')][_0xbced('0x45')]?_0x161f4f['attributes']:_0x2b3176[_0xbced('0x3e')];if(_0x411bf6['query'][_0xbced('0x50')]){_0x161f4f[_0xbced('0x54')]=[{'all':!![]}];}_0x161f4f=_[_0xbced('0x4c')]({},_0x161f4f,_0x411bf6[_0xbced('0x4f')]);return db['VoiceExtension'][_0xbced('0x55')](_0x161f4f)[_0xbced('0x2a')](handleEntityNotFound(_0x2165b4,null))[_0xbced('0x2a')](respondWithResult(_0x2165b4,null))['catch'](handleError(_0x2165b4,null));};exports['destroy']=function(_0x5e8248,_0x4291ea){return db['VoiceExtension'][_0xbced('0x55')]({'where':{'id':_0x5e8248[_0xbced('0x53')]['id']}})['then'](handleEntityNotFound(_0x4291ea,null))[_0xbced('0x2a')](removeEntity(_0x4291ea,null))[_0xbced('0x56')](handleError(_0x4291ea,null));};exports[_0xbced('0x57')]=function(_0x41c268,_0x36a882){if(_0x41c268[_0xbced('0x58')][_0xbced('0x35')]===_0xbced('0x2e')&&!_[_0xbced('0x59')](_0x41c268['body'][_0xbced('0x5a')],'_')){_0x41c268['body'][_0xbced('0x5a')]='_'['concat'](_0x41c268['body'][_0xbced('0x5a')]);}return db[_0xbced('0x3b')][_0xbced('0x57')](_0x41c268[_0xbced('0x58')],{'raw':![]})[_0xbced('0x2a')](function(_0x4a515c){var _0x49301c=_0x41c268[_0xbced('0x5b')]['get']({'plain':!![]});if(!_0x49301c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49301c[_0xbced('0x5c')]===_0xbced('0x5b')){var _0x196da2=_0x4a515c[_0xbced('0x2b')]({'plain':!![]});var _0x215618=[{'name':_0xbced('0x5d'),'value':_0xbced('0x2c')},{'name':_0xbced('0x2d'),'value':_0xbced('0x2e')},{'name':_0xbced('0x2f'),'value':_0xbced('0x30')}];var _0x5f075a=_[_0xbced('0x55')](_0x215618,['value',_0x196da2[_0xbced('0x35')]])[_0xbced('0x36')];return db[_0xbced('0x5e')][_0xbced('0x55')]({'where':{'name':_0x5f075a,'userProfileId':_0x49301c[_0xbced('0x5f')]},'raw':!![]})[_0xbced('0x2a')](function(_0x11a360){if(_0x11a360&&_0x11a360[_0xbced('0x60')]===0x0){return db[_0xbced('0x37')]['create']({'name':_0x196da2['name'],'resourceId':_0x196da2['id'],'type':_0x11a360[_0xbced('0x36')],'sectionId':_0x11a360['id']},{})['then'](function(){return _0x4a515c;});}else{return _0x4a515c;}})[_0xbced('0x56')](function(_0x36f55f){logger[_0xbced('0x61')](_0xbced('0x62'),_0x36f55f);throw _0x36f55f;});}return _0x4a515c;})[_0xbced('0x2a')](respondWithResult(_0x36a882,0xc9))[_0xbced('0x56')](handleError(_0x36a882,null));};exports[_0xbced('0x28')]=function(_0x353081,_0x47caa2){if(_0x353081[_0xbced('0x58')]['id']){delete _0x353081[_0xbced('0x58')]['id'];}return db[_0xbced('0x3b')][_0xbced('0x55')]({'where':{'id':_0x353081[_0xbced('0x53')]['id']}})[_0xbced('0x2a')](handleEntityNotFound(_0x47caa2,null))[_0xbced('0x2a')](function(_0x8eeb8a){if(_0x8eeb8a){return db['VoiceExtension']['update'](_[_0xbced('0x4b')](_0x353081['body'],[_0xbced('0x5a'),_0xbced('0x63'),_0xbced('0x64'),_0xbced('0x65'),_0xbced('0x66'),'mandatoryDisposition']),{'where':{'context':_0x8eeb8a['context'],'exten':_0x8eeb8a[_0xbced('0x5a')]},'individualHooks':!![]})[_0xbced('0x2a')](function(_0x265ab6){return _0x265ab6;});}return null;})[_0xbced('0x2a')](respondWithStatusCode(_0x47caa2,null))['catch'](handleError(_0x47caa2,null));};exports['addApplications']=function(_0x22e078,_0x43c8b3,_0x36f83b){return db[_0xbced('0x3b')]['findOne']({'where':{'id':_0x22e078[_0xbced('0x53')]['id']}})[_0xbced('0x2a')](handleEntityNotFound(_0x43c8b3,null))[_0xbced('0x2a')](function(_0x176d3a){if(_0x176d3a){return db[_0xbced('0x67')][_0xbced('0x68')](function(_0x43e4b8){return db['VoiceExtension'][_0xbced('0x29')]({'where':{'VoiceExtensionId':_0x22e078['params']['id']},'transaction':_0x43e4b8})[_0xbced('0x2a')](function(_0xa1ce5d){var _0x404170=_['map'](_0x22e078[_0xbced('0x58')],function(_0x1c58f3){_0x1c58f3[_0xbced('0x69')]=_0x22e078[_0xbced('0x53')]['id'];return _0x1c58f3;});return db[_0xbced('0x3b')]['bulkCreate'](_0x404170,{'transaction':_0x43e4b8});});})[_0xbced('0x2a')](function(){return db[_0xbced('0x3b')][_0xbced('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22e078['params']['id']},'order':_0xbced('0x6b')});});}})['then'](respondWithResult(_0x43c8b3,null))[_0xbced('0x56')](handleError(_0x43c8b3,null));}; \ No newline at end of file +var _0x4e6b=['VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','sendStatus','end','json','limit','status','set','Content-Range','reject','save','update','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','error','stack','name','send','index','VoiceExtension','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','options','find','create','body','exten','user','role','UserProfileSection','userProfileId','UserProfileResource','description','addApplications','findOne','sequelize','transaction'];(function(_0x5c961d,_0x5e0c4c){var _0x2ab2e9=function(_0x4379fe){while(--_0x4379fe){_0x5c961d['push'](_0x5c961d['shift']());}};_0x2ab2e9(++_0x5e0c4c);}(_0x4e6b,0x1df));var _0xb4e6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4e6b[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb4e6('0x0'));var rimraf=require(_0xb4e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb4e6('0x2'));var BPromise=require(_0xb4e6('0x3'));var Mustache=require(_0xb4e6('0x4'));var util=require('util');var path=require(_0xb4e6('0x5'));var sox=require(_0xb4e6('0x6'));var csv=require(_0xb4e6('0x7'));var ejs=require(_0xb4e6('0x8'));var fs=require('fs');var _=require(_0xb4e6('0x9'));var squel=require(_0xb4e6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb4e6('0xb'));var toCsv=require(_0xb4e6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb4e6('0xc'));var authService=require(_0xb4e6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb4e6('0xe'));var hardwareService=require(_0xb4e6('0xf'));var logger=require(_0xb4e6('0x10'))(_0xb4e6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb4e6('0x12'))['db'];config['redis']=_['defaults'](config[_0xb4e6('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4e6('0x14'))(new Redis(config[_0xb4e6('0x13')]));require(_0xb4e6('0x15'))['register'](socket);function respondWithStatusCode(_0x2acc0,_0x118841){_0x118841=_0x118841||0xcc;return function(_0xbf9d1b){if(_0xbf9d1b){return _0x2acc0[_0xb4e6('0x16')](_0x118841);}return _0x2acc0['status'](_0x118841)[_0xb4e6('0x17')]();};}function respondWithResult(_0xd47fab,_0x2151b0){_0x2151b0=_0x2151b0||0xc8;return function(_0x4fd348){if(_0x4fd348){return _0xd47fab['status'](_0x2151b0)[_0xb4e6('0x18')](_0x4fd348);}};}function respondWithFilteredResult(_0x2eed6c,_0x4ed33a){return function(_0x27840e){if(_0x27840e){var _0x58af63=_0x27840e['count'],_0x499d88=_0x4ed33a['offset'],_0x3f5c2f=_0x4ed33a['offset']+_0x4ed33a[_0xb4e6('0x19')],_0x4cfd04;if(_0x3f5c2f>=_0x58af63){_0x3f5c2f=_0x58af63;_0x4cfd04=0xc8;}else{_0x4cfd04=0xce;}_0x2eed6c[_0xb4e6('0x1a')](_0x4cfd04);return _0x2eed6c[_0xb4e6('0x1b')](_0xb4e6('0x1c'),_0x499d88+'-'+_0x3f5c2f+'/'+_0x58af63)[_0xb4e6('0x18')](_0x27840e);}return null;};}function patchUpdates(_0x1cdf03){return function(_0x84a3a1){try{jsonpatch['apply'](_0x84a3a1,_0x1cdf03,!![]);}catch(_0x525d17){return BPromise[_0xb4e6('0x1d')](_0x525d17);}return _0x84a3a1[_0xb4e6('0x1e')]();};}function saveUpdates(_0x5f44fa,_0x4a96e0){return function(_0x4beea9){if(_0x4beea9){return _0x4beea9[_0xb4e6('0x1f')](_0x5f44fa)['then'](function(_0x5b9fa2){return _0x5b9fa2;});}return null;};}function removeEntity(_0x40258d,_0x7f5f1){return function(_0x2e6c4a){if(_0x2e6c4a){return _0x2e6c4a[_0xb4e6('0x20')]()[_0xb4e6('0x21')](function(){var _0x33d13f=_0x2e6c4a[_0xb4e6('0x22')]({'plain':!![]});var _0xf1c688=[{'name':_0xb4e6('0x23'),'value':_0xb4e6('0x24'),'ignore':![]},{'name':_0xb4e6('0x25'),'value':_0xb4e6('0x26'),'ignore':![]},{'name':_0xb4e6('0x27'),'value':_0xb4e6('0x28'),'ignore':![]}];var _0x169d46=_(_0xf1c688)[_0xb4e6('0x29')]('ignore')[_0xb4e6('0x2a')](_0xb4e6('0x2b'))[_0xb4e6('0x2b')]();if(_[_0xb4e6('0x2c')](_0x169d46,_0x33d13f[_0xb4e6('0x2d')])){return;}var _0x1216c2=_['find'](_0xf1c688,[_0xb4e6('0x2b'),_0x33d13f[_0xb4e6('0x2d')]])['name'];return db['UserProfileResource'][_0xb4e6('0x20')]({'where':{'type':_0x1216c2,'resourceId':_0x33d13f['id']}})[_0xb4e6('0x21')](function(){return _0x2e6c4a;});})['then'](function(){_0x40258d[_0xb4e6('0x1a')](0xcc)[_0xb4e6('0x17')]();});}};}function handleEntityNotFound(_0x2c056b,_0x4c7ec3){return function(_0x471b1a){if(!_0x471b1a){_0x2c056b[_0xb4e6('0x16')](0x194);}return _0x471b1a;};}function handleError(_0x50ba87,_0xeff27a){_0xeff27a=_0xeff27a||0x1f4;return function(_0xd47176){logger[_0xb4e6('0x2e')](_0xd47176[_0xb4e6('0x2f')]);if(_0xd47176['name']){delete _0xd47176[_0xb4e6('0x30')];}_0x50ba87[_0xb4e6('0x1a')](_0xeff27a)[_0xb4e6('0x31')](_0xd47176);};}exports[_0xb4e6('0x32')]=function(_0x317e65,_0x429478){var _0x49a246={},_0x56bb86={},_0xb93bff={'count':0x0,'rows':[]};var _0x4fae40=_['map'](db[_0xb4e6('0x33')]['rawAttributes'],function(_0x10452e){return{'name':_0x10452e['fieldName'],'type':_0x10452e[_0xb4e6('0x2d')][_0xb4e6('0x34')]};});_0x56bb86[_0xb4e6('0x35')]=_[_0xb4e6('0x2a')](_0x4fae40,_0xb4e6('0x30'));_0x56bb86[_0xb4e6('0x36')]=_[_0xb4e6('0x37')](_0x317e65[_0xb4e6('0x36')]);_0x56bb86[_0xb4e6('0x38')]=_['intersection'](_0x56bb86[_0xb4e6('0x35')],_0x56bb86[_0xb4e6('0x36')]);_0x49a246['attributes']=_[_0xb4e6('0x39')](_0x56bb86['model'],qs['fields'](_0x317e65['query'][_0xb4e6('0x3a')]));_0x49a246[_0xb4e6('0x3b')]=_0x49a246[_0xb4e6('0x3b')][_0xb4e6('0x3c')]?_0x49a246[_0xb4e6('0x3b')]:_0x56bb86[_0xb4e6('0x35')];if(!_0x317e65[_0xb4e6('0x36')][_0xb4e6('0x3d')]('nolimit')){_0x49a246['limit']=qs[_0xb4e6('0x19')](_0x317e65[_0xb4e6('0x36')]['limit']);_0x49a246[_0xb4e6('0x3e')]=qs[_0xb4e6('0x3e')](_0x317e65[_0xb4e6('0x36')][_0xb4e6('0x3e')]);}_0x49a246[_0xb4e6('0x3f')]=qs[_0xb4e6('0x40')](_0x317e65[_0xb4e6('0x36')][_0xb4e6('0x40')]);_0x49a246[_0xb4e6('0x41')]=qs[_0xb4e6('0x38')](_[_0xb4e6('0x42')](_0x317e65[_0xb4e6('0x36')],_0x56bb86[_0xb4e6('0x38')]),_0x4fae40);if(_0x317e65['query']['filter']){_0x49a246[_0xb4e6('0x41')]=_[_0xb4e6('0x43')](_0x49a246[_0xb4e6('0x41')],{'$or':_[_0xb4e6('0x2a')](_0x4fae40,function(_0x2e59ed){if(_0x2e59ed[_0xb4e6('0x2d')]!==_0xb4e6('0x44')){var _0x59bc52={};_0x59bc52[_0x2e59ed[_0xb4e6('0x30')]]={'$like':'%'+_0x317e65[_0xb4e6('0x36')][_0xb4e6('0x29')]+'%'};return _0x59bc52;}})});}_0x49a246=_[_0xb4e6('0x43')]({},_0x49a246,_0x317e65['options']);var _0x5114ba={'where':_0x49a246[_0xb4e6('0x41')]};return db['VoiceExtension'][_0xb4e6('0x45')](_0x5114ba)[_0xb4e6('0x21')](function(_0xe0d935){_0xb93bff[_0xb4e6('0x45')]=_0xe0d935;if(_0x317e65[_0xb4e6('0x36')][_0xb4e6('0x46')]){_0x49a246[_0xb4e6('0x47')]=[{'all':!![]}];}return db[_0xb4e6('0x33')][_0xb4e6('0x48')](_0x49a246);})[_0xb4e6('0x21')](function(_0x4f0da8){_0xb93bff['rows']=_0x4f0da8;return _0xb93bff;})[_0xb4e6('0x21')](respondWithFilteredResult(_0x429478,_0x49a246))[_0xb4e6('0x49')](handleError(_0x429478,null));};exports[_0xb4e6('0x4a')]=function(_0x1eb321,_0x30afe6){var _0x146a7e={'raw':![],'where':{'id':_0x1eb321[_0xb4e6('0x4b')]['id']}},_0x17ecea={};_0x17ecea[_0xb4e6('0x35')]=_['keys'](db['VoiceExtension']['rawAttributes']);_0x17ecea['query']=_[_0xb4e6('0x37')](_0x1eb321['query']);_0x17ecea[_0xb4e6('0x38')]=_['intersection'](_0x17ecea[_0xb4e6('0x35')],_0x17ecea[_0xb4e6('0x36')]);_0x146a7e[_0xb4e6('0x3b')]=_[_0xb4e6('0x39')](_0x17ecea[_0xb4e6('0x35')],qs[_0xb4e6('0x3a')](_0x1eb321['query'][_0xb4e6('0x3a')]));_0x146a7e[_0xb4e6('0x3b')]=_0x146a7e['attributes']['length']?_0x146a7e[_0xb4e6('0x3b')]:_0x17ecea[_0xb4e6('0x35')];if(_0x1eb321[_0xb4e6('0x36')][_0xb4e6('0x46')]){_0x146a7e['include']=[{'all':!![]}];}_0x146a7e=_['merge']({},_0x146a7e,_0x1eb321[_0xb4e6('0x4c')]);return db['VoiceExtension'][_0xb4e6('0x4d')](_0x146a7e)[_0xb4e6('0x21')](handleEntityNotFound(_0x30afe6,null))[_0xb4e6('0x21')](respondWithResult(_0x30afe6,null))[_0xb4e6('0x49')](handleError(_0x30afe6,null));};exports[_0xb4e6('0x20')]=function(_0x198ed0,_0x5cf121){return db[_0xb4e6('0x33')][_0xb4e6('0x4d')]({'where':{'id':_0x198ed0[_0xb4e6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cf121,null))[_0xb4e6('0x21')](removeEntity(_0x5cf121,null))['catch'](handleError(_0x5cf121,null));};exports[_0xb4e6('0x4e')]=function(_0x2a0c64,_0x4780a0){if(_0x2a0c64[_0xb4e6('0x4f')][_0xb4e6('0x2d')]===_0xb4e6('0x26')&&!_['startsWith'](_0x2a0c64['body'][_0xb4e6('0x50')],'_')){_0x2a0c64[_0xb4e6('0x4f')][_0xb4e6('0x50')]='_'['concat'](_0x2a0c64[_0xb4e6('0x4f')]['exten']);}return db['VoiceExtension']['create'](_0x2a0c64[_0xb4e6('0x4f')],{'raw':![]})['then'](function(_0x349d83){var _0x7f9d0=_0x2a0c64[_0xb4e6('0x51')][_0xb4e6('0x22')]({'plain':!![]});if(!_0x7f9d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7f9d0[_0xb4e6('0x52')]===_0xb4e6('0x51')){var _0x1d9d5e=_0x349d83[_0xb4e6('0x22')]({'plain':!![]});var _0xdba486=[{'name':'InboundRoutes','value':_0xb4e6('0x24')},{'name':'OutboundRoutes','value':_0xb4e6('0x26')},{'name':_0xb4e6('0x27'),'value':_0xb4e6('0x28')}];var _0x3b33f6=_[_0xb4e6('0x4d')](_0xdba486,[_0xb4e6('0x2b'),_0x1d9d5e[_0xb4e6('0x2d')]])[_0xb4e6('0x30')];return db[_0xb4e6('0x53')][_0xb4e6('0x4d')]({'where':{'name':_0x3b33f6,'userProfileId':_0x7f9d0[_0xb4e6('0x54')]},'raw':!![]})[_0xb4e6('0x21')](function(_0x52fa4f){if(_0x52fa4f&&_0x52fa4f['autoAssociation']===0x0){return db[_0xb4e6('0x55')][_0xb4e6('0x4e')]({'name':_0x1d9d5e['name'],'resourceId':_0x1d9d5e['id'],'type':_0x52fa4f['name'],'sectionId':_0x52fa4f['id']},{})['then'](function(){return _0x349d83;});}else{return _0x349d83;}})[_0xb4e6('0x49')](function(_0x2d2b4b){logger[_0xb4e6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d2b4b);throw _0x2d2b4b;});}return _0x349d83;})['then'](respondWithResult(_0x4780a0,0xc9))['catch'](handleError(_0x4780a0,null));};exports[_0xb4e6('0x1f')]=function(_0x355c11,_0x407bf9){if(_0x355c11[_0xb4e6('0x4f')]['id']){delete _0x355c11[_0xb4e6('0x4f')]['id'];}return db[_0xb4e6('0x33')][_0xb4e6('0x4d')]({'where':{'id':_0x355c11[_0xb4e6('0x4b')]['id']}})[_0xb4e6('0x21')](handleEntityNotFound(_0x407bf9,null))[_0xb4e6('0x21')](function(_0x4dc05a){if(_0x4dc05a){return db[_0xb4e6('0x33')][_0xb4e6('0x1f')](_['pick'](_0x355c11[_0xb4e6('0x4f')],[_0xb4e6('0x50'),'context',_0xb4e6('0x56'),'recordingFormat','cutdigits','mandatoryDisposition']),{'where':{'context':_0x4dc05a['context'],'exten':_0x4dc05a[_0xb4e6('0x50')]},'individualHooks':!![]})[_0xb4e6('0x21')](function(_0x521762){return _0x521762;});}return null;})[_0xb4e6('0x21')](respondWithStatusCode(_0x407bf9,null))[_0xb4e6('0x49')](handleError(_0x407bf9,null));};exports[_0xb4e6('0x57')]=function(_0x145a4d,_0x23fa1c,_0x1d7fdb){return db[_0xb4e6('0x33')][_0xb4e6('0x58')]({'where':{'id':_0x145a4d[_0xb4e6('0x4b')]['id']}})[_0xb4e6('0x21')](handleEntityNotFound(_0x23fa1c,null))[_0xb4e6('0x21')](function(_0x43ab77){if(_0x43ab77){return db[_0xb4e6('0x59')][_0xb4e6('0x5a')](function(_0x223260){return db[_0xb4e6('0x33')][_0xb4e6('0x20')]({'where':{'VoiceExtensionId':_0x145a4d[_0xb4e6('0x4b')]['id']},'transaction':_0x223260})[_0xb4e6('0x21')](function(_0x17643f){var _0x4e2e99=_['map'](_0x145a4d['body'],function(_0x2cf27b){_0x2cf27b[_0xb4e6('0x5b')]=_0x145a4d[_0xb4e6('0x4b')]['id'];return _0x2cf27b;});return db[_0xb4e6('0x33')][_0xb4e6('0x5c')](_0x4e2e99,{'transaction':_0x223260});});})[_0xb4e6('0x21')](function(){return db['VoiceExtension'][_0xb4e6('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x145a4d[_0xb4e6('0x4b')]['id']},'order':_0xb4e6('0x5e')});});}})[_0xb4e6('0x21')](respondWithResult(_0x23fa1c,null))[_0xb4e6('0x49')](handleError(_0x23fa1c,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7d6fec8..0853e47 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 _0x037d=['save','emit','hook','exports','events','VoiceExtension'];(function(_0x256823,_0x2392df){var _0x5db66b=function(_0x2bd5d6){while(--_0x2bd5d6){_0x256823['push'](_0x256823['shift']());}};_0x5db66b(++_0x2392df);}(_0x037d,0x1d8));var _0xd037=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x037d[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0xd037('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xd037('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd037('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x191ab9){return function(_0x5c92fe,_0x52214b,_0x121d38){VoiceExtensionEvents[_0xd037('0x3')](_0x191ab9+':'+_0x5c92fe['id'],_0x5c92fe);VoiceExtensionEvents[_0xd037('0x3')](_0x191ab9,_0x5c92fe);_0x121d38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xd037('0x4')](e,emitEvent(event));}}module[_0xd037('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0xfac7=['emit','events','../../mysqldb','VoiceExtension','setMaxListeners','update'];(function(_0xa1dc15,_0x2f3c63){var _0x2c4d39=function(_0x195277){while(--_0x195277){_0xa1dc15['push'](_0xa1dc15['shift']());}};_0x2c4d39(++_0x2f3c63);}(_0xfac7,0x1c9));var _0x7fac=function(_0x163cd0,_0x461c03){_0x163cd0=_0x163cd0-0x0;var _0x166213=_0xfac7[_0x163cd0];return _0x166213;};'use strict';var EventEmitter=require(_0x7fac('0x0'));var VoiceExtension=require(_0x7fac('0x1'))['db'][_0x7fac('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7fac('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7fac('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53fffa){return function(_0x177ba5,_0x586213,_0x15371a){VoiceExtensionEvents[_0x7fac('0x5')](_0x53fffa+':'+_0x177ba5['id'],_0x177ba5);VoiceExtensionEvents[_0x7fac('0x5')](_0x53fffa,_0x177ba5);_0x15371a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 26c407f..4910b29 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 _0x9fed=['VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceExtension.attributes','exports'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0x9fed,0x91));var _0xd9fe=function(_0x17d16b,_0x3825fb){_0x17d16b=_0x17d16b-0x0;var _0x14ab30=_0x9fed[_0x17d16b];return _0x14ab30;};'use strict';var _=require('lodash');var util=require(_0xd9fe('0x0'));var logger=require(_0xd9fe('0x1'))(_0xd9fe('0x2'));var moment=require(_0xd9fe('0x3'));var BPromise=require(_0xd9fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9fe('0x5'));var rimraf=require(_0xd9fe('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9fe('0x7'));module[_0xd9fe('0x8')]=function(_0x11dce4,_0x42de81){return _0x11dce4['define'](_0xd9fe('0x9'),attributes,{'tableName':_0xd9fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dfa=['../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','../../config/logger','moment','path'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x5dfa,0xf7));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa5df('0x0'));var util=require(_0xa5df('0x1'));var logger=require(_0xa5df('0x2'))('api');var moment=require(_0xa5df('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5df('0x4'));var rimraf=require('rimraf');var config=require(_0xa5df('0x5'));var attributes=require(_0xa5df('0x6'));module[_0xa5df('0x7')]=function(_0x18f337,_0x179897){return _0x18f337['define'](_0xa5df('0x8'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6adfc8d..548ceac 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 _0x6996=['findAll','options','where','attributes','include','model','map','then','debug','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6996,0x144));var _0x6699=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x6996[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x6699('0x0'));var util=require(_0x6699('0x1'));var moment=require(_0x6699('0x2'));var BPromise=require(_0x6699('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6699('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6699('0x5'))(_0x6699('0x6'));var config=require('../../config/environment');var jayson=require(_0x6699('0x7'));var client=jayson[_0x6699('0x8')][_0x6699('0x9')]({'port':0x232a});config[_0x6699('0xa')]=_[_0x6699('0xb')](config[_0x6699('0xa')],{'host':_0x6699('0xc'),'port':0x18eb});var socket=require(_0x6699('0xd'))(new Redis(config[_0x6699('0xa')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x94d6a4,_0x5c0063,_0x1326aa){return new BPromise(function(_0x38a438,_0x27ced6){return client[_0x6699('0xe')](_0x94d6a4,_0x1326aa)['then'](function(_0x30f3ea){logger[_0x6699('0xf')](_0x6699('0x10'),_0x5c0063,_0x6699('0x11'));logger['debug'](_0x6699('0x12'),_0x5c0063,_0x6699('0x11'),JSON[_0x6699('0x13')](_0x30f3ea));if(_0x30f3ea['error']){if(_0x30f3ea[_0x6699('0x14')][_0x6699('0x15')]===0x1f4){logger[_0x6699('0x14')](_0x6699('0x10'),_0x5c0063,_0x30f3ea[_0x6699('0x14')][_0x6699('0x16')]);return _0x27ced6(_0x30f3ea['error'][_0x6699('0x16')]);}logger['error'](_0x6699('0x10'),_0x5c0063,_0x30f3ea[_0x6699('0x14')][_0x6699('0x16')]);return _0x38a438(_0x30f3ea[_0x6699('0x14')][_0x6699('0x16')]);}else{logger[_0x6699('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x5c0063,_0x6699('0x11'));_0x38a438(_0x30f3ea['result']['message']);}})[_0x6699('0x17')](function(_0x3bd054){logger[_0x6699('0x14')](_0x6699('0x10'),_0x5c0063,_0x3bd054);_0x27ced6(_0x3bd054);});});}exports[_0x6699('0x18')]=function(_0x15c890){var _0x51dd6f=this;return new Promise(function(_0x37a265,_0xc8f48a){return db[_0x6699('0x19')][_0x6699('0x1a')]({'raw':_0x15c890[_0x6699('0x1b')]?_0x15c890['options']['raw']===undefined?!![]:![]:!![],'where':_0x15c890[_0x6699('0x1b')]?_0x15c890[_0x6699('0x1b')][_0x6699('0x1c')]||null:null,'attributes':_0x15c890[_0x6699('0x1b')]?_0x15c890[_0x6699('0x1b')][_0x6699('0x1d')]||null:null,'limit':_0x15c890[_0x6699('0x1b')]?_0x15c890[_0x6699('0x1b')]['limit']||null:null,'include':_0x15c890[_0x6699('0x1b')]?_0x15c890[_0x6699('0x1b')][_0x6699('0x1e')]?_['map'](_0x15c890[_0x6699('0x1b')][_0x6699('0x1e')],function(_0x533051){return{'model':db[_0x533051[_0x6699('0x1f')]],'as':_0x533051['as'],'attributes':_0x533051[_0x6699('0x1d')],'include':_0x533051['include']?_[_0x6699('0x20')](_0x533051[_0x6699('0x1e')],function(_0x3590cb){return{'model':db[_0x3590cb['model']],'as':_0x3590cb['as'],'attributes':_0x3590cb[_0x6699('0x1d')],'include':_0x3590cb[_0x6699('0x1e')]?_['map'](_0x3590cb[_0x6699('0x1e')],function(_0x1e268b){return{'model':db[_0x1e268b[_0x6699('0x1f')]],'as':_0x1e268b['as'],'attributes':_0x1e268b[_0x6699('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6699('0x21')](function(_0x2084ab){logger[_0x6699('0xf')](_0x6699('0x18'),_0x15c890);logger[_0x6699('0x22')](_0x6699('0x18'),_0x15c890,JSON[_0x6699('0x13')](_0x2084ab));_0x37a265(_0x2084ab);})[_0x6699('0x17')](function(_0x6e566a){logger['error'](_0x6699('0x18'),_0x6e566a[_0x6699('0x16')],_0x15c890);_0xc8f48a(_0x51dd6f[_0x6699('0x14')](0x1f4,_0x6e566a['message']));});});}; \ No newline at end of file +var _0xaef7=['client','http','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','map','model','include','GetVoiceExtension','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaef7,0xac));var _0x7aef=function(_0x21c130,_0x225833){_0x21c130=_0x21c130-0x0;var _0x58f574=_0xaef7[_0x21c130];return _0x58f574;};'use strict';var _=require(_0x7aef('0x0'));var util=require(_0x7aef('0x1'));var moment=require('moment');var BPromise=require(_0x7aef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aef('0x3'));var db=require(_0x7aef('0x4'))['db'];var utils=require(_0x7aef('0x5'));var logger=require(_0x7aef('0x6'))(_0x7aef('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7aef('0x8')][_0x7aef('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7aef('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7aef('0xb'))[_0x7aef('0xc')](socket);function respondWithRpcPromise(_0x28ba86,_0x33f73a,_0x182d01){return new BPromise(function(_0x57774d,_0x5ca90d){return client['request'](_0x28ba86,_0x182d01)[_0x7aef('0xd')](function(_0x26446a){logger[_0x7aef('0xe')](_0x7aef('0xf'),_0x33f73a,_0x7aef('0x10'));logger[_0x7aef('0x11')](_0x7aef('0x12'),_0x33f73a,_0x7aef('0x10'),JSON[_0x7aef('0x13')](_0x26446a));if(_0x26446a['error']){if(_0x26446a[_0x7aef('0x14')][_0x7aef('0x15')]===0x1f4){logger[_0x7aef('0x14')](_0x7aef('0xf'),_0x33f73a,_0x26446a[_0x7aef('0x14')][_0x7aef('0x16')]);return _0x5ca90d(_0x26446a[_0x7aef('0x14')]['message']);}logger[_0x7aef('0x14')](_0x7aef('0xf'),_0x33f73a,_0x26446a[_0x7aef('0x14')]['message']);return _0x57774d(_0x26446a[_0x7aef('0x14')][_0x7aef('0x16')]);}else{logger[_0x7aef('0xe')](_0x7aef('0xf'),_0x33f73a,_0x7aef('0x10'));_0x57774d(_0x26446a[_0x7aef('0x17')][_0x7aef('0x16')]);}})[_0x7aef('0x18')](function(_0x52d7c4){logger[_0x7aef('0x14')](_0x7aef('0xf'),_0x33f73a,_0x52d7c4);_0x5ca90d(_0x52d7c4);});});}exports['GetVoiceExtension']=function(_0x132f41){var _0x4cec0=this;return new Promise(function(_0x3850d2,_0x53a718){return db[_0x7aef('0x19')][_0x7aef('0x1a')]({'raw':_0x132f41['options']?_0x132f41[_0x7aef('0x1b')][_0x7aef('0x1c')]===undefined?!![]:![]:!![],'where':_0x132f41[_0x7aef('0x1b')]?_0x132f41[_0x7aef('0x1b')][_0x7aef('0x1d')]||null:null,'attributes':_0x132f41[_0x7aef('0x1b')]?_0x132f41[_0x7aef('0x1b')][_0x7aef('0x1e')]||null:null,'limit':_0x132f41[_0x7aef('0x1b')]?_0x132f41[_0x7aef('0x1b')][_0x7aef('0x1f')]||null:null,'include':_0x132f41['options']?_0x132f41[_0x7aef('0x1b')]['include']?_[_0x7aef('0x20')](_0x132f41['options']['include'],function(_0x23e85a){return{'model':db[_0x23e85a[_0x7aef('0x21')]],'as':_0x23e85a['as'],'attributes':_0x23e85a[_0x7aef('0x1e')],'include':_0x23e85a['include']?_[_0x7aef('0x20')](_0x23e85a[_0x7aef('0x22')],function(_0x341fdd){return{'model':db[_0x341fdd[_0x7aef('0x21')]],'as':_0x341fdd['as'],'attributes':_0x341fdd[_0x7aef('0x1e')],'include':_0x341fdd[_0x7aef('0x22')]?_[_0x7aef('0x20')](_0x341fdd[_0x7aef('0x22')],function(_0x5d1cda){return{'model':db[_0x5d1cda[_0x7aef('0x21')]],'as':_0x5d1cda['as'],'attributes':_0x5d1cda[_0x7aef('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7aef('0xd')](function(_0x1f338b){logger[_0x7aef('0xe')](_0x7aef('0x23'),_0x132f41);logger[_0x7aef('0x11')](_0x7aef('0x23'),_0x132f41,JSON[_0x7aef('0x13')](_0x1f338b));_0x3850d2(_0x1f338b);})['catch'](function(_0x550f21){logger[_0x7aef('0x14')](_0x7aef('0x23'),_0x550f21['message'],_0x132f41);_0x53a718(_0x4cec0[_0x7aef('0x14')](0x1f4,_0x550f21['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a73f772..e6a9c3f 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 _0x6573=['voiceExtension:','./voiceExtension.events','remove','update','emit','removeListener','register','length'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x6573,0xf9));var _0x3657=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6573[_0x20a584];return _0x4b41a8;};'use strict';var VoiceExtensionEvents=require(_0x3657('0x0'));var events=['save',_0x3657('0x1'),_0x3657('0x2')];function createListener(_0x1b8e81,_0x139d81){return function(_0x3c44e4){_0x139d81[_0x3657('0x3')](_0x1b8e81,_0x3c44e4);};}function removeListener(_0x4d770c,_0x2bd6d0){return function(){VoiceExtensionEvents[_0x3657('0x4')](_0x4d770c,_0x2bd6d0);};}exports[_0x3657('0x5')]=function(_0x34fb6b){for(var _0x1c5ef2=0x0,_0x257642=events[_0x3657('0x6')];_0x1c5ef2<_0x257642;_0x1c5ef2++){var _0x44071b=events[_0x1c5ef2];var _0x49327d=createListener(_0x3657('0x7')+_0x44071b,_0x34fb6b);VoiceExtensionEvents['on'](_0x44071b,_0x49327d);}}; \ No newline at end of file +var _0xbc8d=['register','voiceExtension:','./voiceExtension.events','save','update','emit','removeListener'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0xbc8d,0x152));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceExtensionEvents=require(_0xdbc8('0x0'));var events=[_0xdbc8('0x1'),'remove',_0xdbc8('0x2')];function createListener(_0x3110cf,_0x42f30a){return function(_0x44cb1a){_0x42f30a[_0xdbc8('0x3')](_0x3110cf,_0x44cb1a);};}function removeListener(_0x42d333,_0x3cbffd){return function(){VoiceExtensionEvents[_0xdbc8('0x4')](_0x42d333,_0x3cbffd);};}exports[_0xdbc8('0x5')]=function(_0x11210b){for(var _0x456bd3=0x0,_0x2542bf=events['length'];_0x456bd3<_0x2542bf;_0x456bd3++){var _0x2a4add=events[_0x456bd3];var _0x344237=createListener(_0xdbc8('0x6')+_0x2a4add,_0x11210b);VoiceExtensionEvents['on'](_0x2a4add,_0x344237);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4b04532..e9a7d50 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 _0x2222=['isAuthenticated','/:id/messages','getMessages','post','put','/:id','update','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4cf963,_0x5905c0){var _0x214841=function(_0x1f66d4){while(--_0x1f66d4){_0x4cf963['push'](_0x4cf963['shift']());}};_0x214841(++_0x5905c0);}(_0x2222,0x177));var _0x2222=function(_0x1d95d6,_0x5a6057){_0x1d95d6=_0x1d95d6-0x0;var _0x46de43=_0x2222[_0x1d95d6];return _0x46de43;};'use strict';var multer=require(_0x2222('0x0'));var util=require('util');var path=require(_0x2222('0x1'));var timeout=require(_0x2222('0x2'));var express=require(_0x2222('0x3'));var router=express['Router']();var auth=require(_0x2222('0x4'));var interaction=require(_0x2222('0x5'));var config=require(_0x2222('0x6'));var controller=require('./voiceMail.controller');router[_0x2222('0x7')]('/',auth['isAuthenticated'](),controller[_0x2222('0x8')]);router[_0x2222('0x7')]('/:id',auth[_0x2222('0x9')](),controller['show']);router[_0x2222('0x7')](_0x2222('0xa'),auth[_0x2222('0x9')](),controller[_0x2222('0xb')]);router[_0x2222('0xc')]('/',auth[_0x2222('0x9')](),controller['create']);router[_0x2222('0xd')](_0x2222('0xe'),auth[_0x2222('0x9')](),controller[_0x2222('0xf')]);router['delete']('/:id',auth[_0x2222('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x20e2=['connect-timeout','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path'];(function(_0x6abae1,_0x11a02f){var _0x14dad0=function(_0xf1fa3){while(--_0xf1fa3){_0x6abae1['push'](_0x6abae1['shift']());}};_0x14dad0(++_0x11a02f);}(_0x20e2,0x15d));var _0x220e=function(_0x544a35,_0x1361d0){_0x544a35=_0x544a35-0x0;var _0x2d4602=_0x20e2[_0x544a35];return _0x2d4602;};'use strict';var multer=require(_0x220e('0x0'));var util=require(_0x220e('0x1'));var path=require(_0x220e('0x2'));var timeout=require(_0x220e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x220e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x220e('0x5'));router[_0x220e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x220e('0x6')]('/:id',auth[_0x220e('0x7')](),controller['show']);router[_0x220e('0x6')]('/:id/messages',auth[_0x220e('0x7')](),controller[_0x220e('0x8')]);router[_0x220e('0x9')]('/',auth[_0x220e('0x7')](),controller[_0x220e('0xa')]);router[_0x220e('0xb')]('/:id',auth[_0x220e('0x7')](),controller[_0x220e('0xc')]);router[_0x220e('0xd')](_0x220e('0xe'),auth[_0x220e('0x7')](),controller[_0x220e('0xf')]);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 9806bc6..942160d 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 _0x4fc2=['mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0x2de158,_0x5d0be6){var _0xed709f=function(_0x34dc5a){while(--_0x34dc5a){_0x2de158['push'](_0x2de158['shift']());}};_0xed709f(++_0x5d0be6);}(_0x4fc2,0x111));var _0x24fc=function(_0x2b8fbd,_0x49624a){_0x2b8fbd=_0x2b8fbd-0x0;var _0x6f2b8d=_0x4fc2[_0x2b8fbd];return _0x6f2b8d;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'customer_id':{'type':Sequelize[_0x24fc('0x2')]},'context':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':'from-voicemail','unique':_0x24fc('0x3')},'mailbox':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':'','allowNull':![],'unique':_0x24fc('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x24fc('0x2')]},'email':{'type':Sequelize[_0x24fc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58dafc){this[_0x24fc('0x4')](_0x24fc('0x5'),typeof _0x58dafc==='string'&&_0x58dafc[_0x24fc('0x6')]()?_0x58dafc[_0x24fc('0x6')]():null);}},'pager':{'type':Sequelize[_0x24fc('0x2')]},'tz':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':_0x24fc('0x7')},'attach':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x24fc('0x2')]},'callback':{'type':Sequelize[_0x24fc('0x2')]},'review':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x24fc('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'stamp':{'type':_0x24fc('0xb')},'emailsubject':{'type':Sequelize[_0x24fc('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x24fc('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x24fc('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x24fc('0xd')],'get':function(){return this[_0x24fc('0xe')]('fullname')+_0x24fc('0xf')+this[_0x24fc('0xe')](_0x24fc('0x10'));}}}; \ No newline at end of file +var _0x5eb8=['email','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x2bbacf,_0x111845){var _0x65ed98=function(_0x386880){while(--_0x386880){_0x2bbacf['push'](_0x2bbacf['shift']());}};_0x65ed98(++_0x111845);}(_0x5eb8,0xb0));var _0x85eb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5eb8[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x85eb('0x0')]},'context':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x1'),'unique':_0x85eb('0x2')},'mailbox':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':'','allowNull':![],'unique':_0x85eb('0x2')},'password':{'type':Sequelize[_0x85eb('0x0')]},'fullname':{'type':Sequelize[_0x85eb('0x0')]},'email':{'type':Sequelize[_0x85eb('0x0')],'validate':{'isEmail':!![]},'set':function(_0x1fde1a){this[_0x85eb('0x3')](_0x85eb('0x4'),typeof _0x1fde1a==='string'&&_0x1fde1a[_0x85eb('0x5')]()?_0x1fde1a[_0x85eb('0x5')]():null);}},'pager':{'type':Sequelize[_0x85eb('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x85eb('0x6')},'attach':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x85eb('0x0')]},'callback':{'type':Sequelize[_0x85eb('0x0')]},'review':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'stamp':{'type':_0x85eb('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x85eb('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x85eb('0xb')],'get':function(){return this[_0x85eb('0xc')](_0x85eb('0xd'))+_0x85eb('0xe')+this[_0x85eb('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 62dd136..b1c8770 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 _0x9805=['get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','VoiceMail','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','VoiceMailMessage','nolimit','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','then','destroy'];(function(_0x27694f,_0x150986){var _0xce032d=function(_0x3ffc20){while(--_0x3ffc20){_0x27694f['push'](_0x27694f['shift']());}};_0xce032d(++_0x150986);}(_0x9805,0x18f));var _0x5980=function(_0x50e07,_0x1879a7){_0x50e07=_0x50e07-0x0;var _0x2ac2db=_0x9805[_0x50e07];return _0x2ac2db;};'use strict';var pdf=require(_0x5980('0x0'));var emlformat=require(_0x5980('0x1'));var rimraf=require(_0x5980('0x2'));var zipdir=require(_0x5980('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5980('0x4'));var BPromise=require(_0x5980('0x5'));var Mustache=require(_0x5980('0x6'));var util=require(_0x5980('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5980('0x8'));var ejs=require(_0x5980('0x9'));var fs=require('fs');var _=require(_0x5980('0xa'));var squel=require(_0x5980('0xb'));var crypto=require(_0x5980('0xc'));var jsforce=require(_0x5980('0xd'));var deskjs=require(_0x5980('0xe'));var toCsv=require(_0x5980('0x8'));var querystring=require(_0x5980('0xf'));var Papa=require(_0x5980('0x10'));var Redis=require(_0x5980('0x11'));var authService=require(_0x5980('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5980('0x13'));var logger=require(_0x5980('0x14'))(_0x5980('0x15'));var utils=require(_0x5980('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5980('0x17'));var db=require(_0x5980('0x18'))['db'];function respondWithStatusCode(_0x59f545,_0x4feb61){_0x4feb61=_0x4feb61||0xcc;return function(_0x1892d4){if(_0x1892d4){return _0x59f545[_0x5980('0x19')](_0x4feb61);}return _0x59f545[_0x5980('0x1a')](_0x4feb61)[_0x5980('0x1b')]();};}function respondWithResult(_0x9e7cee,_0x3cce48){_0x3cce48=_0x3cce48||0xc8;return function(_0x15fd1a){if(_0x15fd1a){return _0x9e7cee[_0x5980('0x1a')](_0x3cce48)['json'](_0x15fd1a);}};}function respondWithFilteredResult(_0x247cb8,_0x53af6e){return function(_0x46cf94){if(_0x46cf94){var _0x2fcdf2=_0x46cf94['count'],_0x1ce651=_0x53af6e[_0x5980('0x1c')],_0x18275c=_0x53af6e[_0x5980('0x1c')]+_0x53af6e[_0x5980('0x1d')],_0x183261;if(_0x18275c>=_0x2fcdf2){_0x18275c=_0x2fcdf2;_0x183261=0xc8;}else{_0x183261=0xce;}_0x247cb8[_0x5980('0x1a')](_0x183261);return _0x247cb8[_0x5980('0x1e')](_0x5980('0x1f'),_0x1ce651+'-'+_0x18275c+'/'+_0x2fcdf2)[_0x5980('0x20')](_0x46cf94);}return null;};}function patchUpdates(_0x661e7f){return function(_0x1d1050){try{jsonpatch[_0x5980('0x21')](_0x1d1050,_0x661e7f,!![]);}catch(_0x2222fa){return BPromise['reject'](_0x2222fa);}return _0x1d1050['save']();};}function saveUpdates(_0x4f5300,_0x216f4a){return function(_0x4ca6f5){if(_0x4ca6f5){return _0x4ca6f5['update'](_0x4f5300)[_0x5980('0x22')](function(_0x2a4019){return _0x2a4019;});}return null;};}function removeEntity(_0x329cbf,_0x3fa8fe){return function(_0x453aeb){if(_0x453aeb){return _0x453aeb[_0x5980('0x23')]()[_0x5980('0x22')](function(){var _0x34a943=_0x453aeb[_0x5980('0x24')]({'plain':!![]});var _0x509100='Voicemails';return db[_0x5980('0x25')][_0x5980('0x23')]({'where':{'type':_0x509100,'resourceId':_0x34a943['id']}})[_0x5980('0x22')](function(){return _0x453aeb;});})[_0x5980('0x22')](function(){_0x329cbf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b428e,_0x31cfd6){return function(_0x481cb1){if(!_0x481cb1){_0x5b428e[_0x5980('0x19')](0x194);}return _0x481cb1;};}function handleError(_0x3c84da,_0x3d50b1){_0x3d50b1=_0x3d50b1||0x1f4;return function(_0x35915e){logger[_0x5980('0x26')](_0x35915e['stack']);if(_0x35915e[_0x5980('0x27')]){delete _0x35915e[_0x5980('0x27')];}_0x3c84da[_0x5980('0x1a')](_0x3d50b1)[_0x5980('0x28')](_0x35915e);};}exports[_0x5980('0x29')]=function(_0x55e6f6,_0x55dd71){var _0x4d7e02={},_0x34066c={},_0x336711={'count':0x0,'rows':[]};var _0x1ead85=_[_0x5980('0x2a')](db['VoiceMail'][_0x5980('0x2b')],function(_0x491385){return{'name':_0x491385[_0x5980('0x2c')],'type':_0x491385['type'][_0x5980('0x2d')]};});_0x34066c['model']=_[_0x5980('0x2a')](_0x1ead85,_0x5980('0x27'));_0x34066c['query']=_[_0x5980('0x2e')](_0x55e6f6[_0x5980('0x2f')]);_0x34066c[_0x5980('0x30')]=_[_0x5980('0x31')](_0x34066c['model'],_0x34066c[_0x5980('0x2f')]);_0x4d7e02[_0x5980('0x32')]=_[_0x5980('0x31')](_0x34066c[_0x5980('0x33')],qs[_0x5980('0x34')](_0x55e6f6[_0x5980('0x2f')][_0x5980('0x34')]));_0x4d7e02[_0x5980('0x32')]=_0x4d7e02[_0x5980('0x32')][_0x5980('0x35')]?_0x4d7e02[_0x5980('0x32')]:_0x34066c[_0x5980('0x33')];if(!_0x55e6f6[_0x5980('0x2f')][_0x5980('0x36')]('nolimit')){_0x4d7e02['limit']=qs[_0x5980('0x1d')](_0x55e6f6['query']['limit']);_0x4d7e02[_0x5980('0x1c')]=qs['offset'](_0x55e6f6[_0x5980('0x2f')]['offset']);}_0x4d7e02[_0x5980('0x37')]=qs[_0x5980('0x38')](_0x55e6f6[_0x5980('0x2f')][_0x5980('0x38')]);_0x4d7e02[_0x5980('0x39')]=qs['filters'](_[_0x5980('0x3a')](_0x55e6f6[_0x5980('0x2f')],_0x34066c['filters']),_0x1ead85);if(_0x55e6f6[_0x5980('0x2f')][_0x5980('0x3b')]){_0x4d7e02[_0x5980('0x39')]=_[_0x5980('0x3c')](_0x4d7e02[_0x5980('0x39')],{'$or':_[_0x5980('0x2a')](_0x1ead85,function(_0x4379ba){if(_0x4379ba[_0x5980('0x3d')]!==_0x5980('0x3e')){var _0x535600={};_0x535600[_0x4379ba['name']]={'$like':'%'+_0x55e6f6['query'][_0x5980('0x3b')]+'%'};return _0x535600;}})});}_0x4d7e02=_['merge']({},_0x4d7e02,_0x55e6f6[_0x5980('0x3f')]);var _0x49f070={'where':_0x4d7e02[_0x5980('0x39')]};return db['VoiceMail'][_0x5980('0x40')](_0x49f070)['then'](function(_0x116298){_0x336711[_0x5980('0x40')]=_0x116298;if(_0x55e6f6[_0x5980('0x2f')][_0x5980('0x41')]){_0x4d7e02[_0x5980('0x42')]=[{'all':!![]}];}return db[_0x5980('0x43')][_0x5980('0x44')](_0x4d7e02);})['then'](function(_0x6ad54){_0x336711[_0x5980('0x45')]=_0x6ad54;return _0x336711;})[_0x5980('0x22')](respondWithFilteredResult(_0x55dd71,_0x4d7e02))[_0x5980('0x46')](handleError(_0x55dd71,null));};exports[_0x5980('0x47')]=function(_0x54ace1,_0x22d838){var _0x45bdf1={'raw':!![],'where':{'id':_0x54ace1[_0x5980('0x48')]['id']}},_0x239798={};_0x239798[_0x5980('0x33')]=_['keys'](db[_0x5980('0x43')][_0x5980('0x2b')]);_0x239798[_0x5980('0x2f')]=_[_0x5980('0x2e')](_0x54ace1[_0x5980('0x2f')]);_0x239798[_0x5980('0x30')]=_['intersection'](_0x239798[_0x5980('0x33')],_0x239798[_0x5980('0x2f')]);_0x45bdf1[_0x5980('0x32')]=_['intersection'](_0x239798[_0x5980('0x33')],qs[_0x5980('0x34')](_0x54ace1[_0x5980('0x2f')][_0x5980('0x34')]));_0x45bdf1[_0x5980('0x32')]=_0x45bdf1[_0x5980('0x32')][_0x5980('0x35')]?_0x45bdf1['attributes']:_0x239798[_0x5980('0x33')];if(_0x54ace1[_0x5980('0x2f')][_0x5980('0x41')]){_0x45bdf1[_0x5980('0x42')]=[{'all':!![]}];}_0x45bdf1=_[_0x5980('0x3c')]({},_0x45bdf1,_0x54ace1['options']);return db[_0x5980('0x43')]['find'](_0x45bdf1)[_0x5980('0x22')](handleEntityNotFound(_0x22d838,null))[_0x5980('0x22')](respondWithResult(_0x22d838,null))['catch'](handleError(_0x22d838,null));};exports['create']=function(_0x819e92,_0x57bf11){return db[_0x5980('0x43')]['create'](_0x819e92[_0x5980('0x49')],{})[_0x5980('0x22')](function(_0x48a5fe){var _0x54f017=_0x819e92[_0x5980('0x4a')][_0x5980('0x24')]({'plain':!![]});if(!_0x54f017)throw new Error(_0x5980('0x4b'));if(_0x54f017[_0x5980('0x4c')]==='user'){var _0x2db086=_0x48a5fe[_0x5980('0x24')]({'plain':!![]});var _0x57381e=_0x5980('0x4d');return db[_0x5980('0x4e')][_0x5980('0x4f')]({'where':{'name':_0x57381e,'userProfileId':_0x54f017['userProfileId']},'raw':!![]})[_0x5980('0x22')](function(_0x574861){if(_0x574861&&_0x574861['autoAssociation']===0x0){return db['UserProfileResource'][_0x5980('0x50')]({'name':_0x2db086[_0x5980('0x27')],'resourceId':_0x2db086['id'],'type':_0x574861[_0x5980('0x27')],'sectionId':_0x574861['id']},{})[_0x5980('0x22')](function(){return _0x48a5fe;});}else{return _0x48a5fe;}})[_0x5980('0x46')](function(_0x177e0c){logger[_0x5980('0x26')](_0x5980('0x51'),_0x177e0c);throw _0x177e0c;});}return _0x48a5fe;})[_0x5980('0x22')](respondWithResult(_0x57bf11,0xc9))[_0x5980('0x46')](handleError(_0x57bf11,null));};exports[_0x5980('0x52')]=function(_0x371893,_0x56ea00){if(_0x371893[_0x5980('0x49')]['id']){delete _0x371893[_0x5980('0x49')]['id'];}return db[_0x5980('0x43')][_0x5980('0x4f')]({'where':{'id':_0x371893[_0x5980('0x48')]['id']}})[_0x5980('0x22')](handleEntityNotFound(_0x56ea00,null))[_0x5980('0x22')](saveUpdates(_0x371893[_0x5980('0x49')],null))[_0x5980('0x22')](respondWithResult(_0x56ea00,null))[_0x5980('0x46')](handleError(_0x56ea00,null));};exports['destroy']=function(_0x89026a,_0x532463){return db[_0x5980('0x43')][_0x5980('0x4f')]({'where':{'id':_0x89026a[_0x5980('0x48')]['id']}})[_0x5980('0x22')](handleEntityNotFound(_0x532463,null))['then'](removeEntity(_0x532463,null))[_0x5980('0x46')](handleError(_0x532463,null));};exports['getMessages']=function(_0x103177,_0x59e565,_0x335db6){return db[_0x5980('0x43')][_0x5980('0x53')]({'where':{'id':_0x103177[_0x5980('0x48')]['id']}})[_0x5980('0x22')](handleEntityNotFound(_0x59e565,null))['then'](function(_0x5379e0){var _0x1861ed;var _0x23ebff={},_0x565b98={};_0x565b98['model']=_[_0x5980('0x2e')](db[_0x5980('0x54')]['rawAttributes']);_0x565b98[_0x5980('0x2f')]=_[_0x5980('0x2e')](_0x103177[_0x5980('0x2f')]);_0x565b98[_0x5980('0x30')]=_[_0x5980('0x31')](_0x565b98[_0x5980('0x33')],_0x565b98[_0x5980('0x2f')]);_0x23ebff['attributes']=_['intersection'](_0x565b98[_0x5980('0x33')],qs[_0x5980('0x34')](_0x103177[_0x5980('0x2f')][_0x5980('0x34')]));_0x23ebff[_0x5980('0x32')]=_0x23ebff[_0x5980('0x32')][_0x5980('0x35')]?_0x23ebff[_0x5980('0x32')]:_0x565b98[_0x5980('0x33')];if(!_0x103177[_0x5980('0x2f')][_0x5980('0x36')](_0x5980('0x55'))){_0x23ebff[_0x5980('0x1d')]=qs[_0x5980('0x1d')](_0x103177[_0x5980('0x2f')][_0x5980('0x1d')]);_0x23ebff['offset']=qs[_0x5980('0x1c')](_0x103177['query'][_0x5980('0x1c')]);}_0x23ebff[_0x5980('0x37')]=qs[_0x5980('0x38')](_0x103177[_0x5980('0x2f')][_0x5980('0x38')]);_0x23ebff[_0x5980('0x39')]=qs[_0x5980('0x30')](_[_0x5980('0x3a')](_0x103177[_0x5980('0x2f')],_0x565b98['filters']));if(_0x103177[_0x5980('0x2f')][_0x5980('0x3b')]){_0x23ebff['where']=_[_0x5980('0x3c')](_0x23ebff['where'],{'$or':_[_0x5980('0x2a')](_0x23ebff[_0x5980('0x32')],function(_0x108015){var _0x3168c4={};_0x3168c4[_0x108015]={'$like':'%'+_0x103177[_0x5980('0x2f')][_0x5980('0x3b')]+'%'};return _0x3168c4;})});}_0x23ebff[_0x5980('0x39')]=_['merge'](_0x23ebff[_0x5980('0x39')],{'mailboxuser':_0x5379e0['mailbox']});_0x23ebff=_[_0x5980('0x3c')]({},_0x23ebff,_0x103177[_0x5980('0x3f')]);return db[_0x5980('0x54')][_0x5980('0x56')](_0x23ebff)[_0x5980('0x22')](respondWithFilteredResult(_0x59e565,_0x23ebff));})[_0x5980('0x46')](handleError(_0x59e565,null));}; \ No newline at end of file +var _0x1c52=['VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','name','send'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x1c52,0x7c));var _0x21c5=function(_0x464230,_0x48c150){_0x464230=_0x464230-0x0;var _0x250879=_0x1c52[_0x464230];return _0x250879;};'use strict';var pdf=require(_0x21c5('0x0'));var emlformat=require(_0x21c5('0x1'));var rimraf=require(_0x21c5('0x2'));var zipdir=require(_0x21c5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21c5('0x4'));var Mustache=require(_0x21c5('0x5'));var util=require('util');var path=require(_0x21c5('0x6'));var sox=require(_0x21c5('0x7'));var csv=require(_0x21c5('0x8'));var ejs=require(_0x21c5('0x9'));var fs=require('fs');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('0x8'));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=_0x15de0c['count'],_0x41b810=_0x20902a['offset'],_0x4bdf72=_0x20902a[_0x21c5('0x1a')]+_0x20902a['limit'],_0x331080;if(_0x4bdf72>=_0x102433){_0x4bdf72=_0x102433;_0x331080=0xc8;}else{_0x331080=0xce;}_0x47030b['status'](_0x331080);return _0x47030b[_0x21c5('0x1b')]('Content-Range',_0x41b810+'-'+_0x4bdf72+'/'+_0x102433)[_0x21c5('0x19')](_0x15de0c);}return null;};}function patchUpdates(_0x5770e6){return function(_0x30fb8a){try{jsonpatch['apply'](_0x30fb8a,_0x5770e6,!![]);}catch(_0x4bf01b){return BPromise[_0x21c5('0x1c')](_0x4bf01b);}return _0x30fb8a[_0x21c5('0x1d')]();};}function saveUpdates(_0x2840b7,_0x300178){return function(_0xd23b55){if(_0xd23b55){return _0xd23b55[_0x21c5('0x1e')](_0x2840b7)[_0x21c5('0x1f')](function(_0x117e93){return _0x117e93;});}return null;};}function removeEntity(_0x1905a9,_0x493fbf){return function(_0x8021db){if(_0x8021db){return _0x8021db[_0x21c5('0x20')]()[_0x21c5('0x1f')](function(){var _0x1aa54e=_0x8021db[_0x21c5('0x21')]({'plain':!![]});var _0x4bf186=_0x21c5('0x22');return db[_0x21c5('0x23')][_0x21c5('0x20')]({'where':{'type':_0x4bf186,'resourceId':_0x1aa54e['id']}})[_0x21c5('0x1f')](function(){return _0x8021db;});})[_0x21c5('0x1f')](function(){_0x1905a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f877c,_0x2ac36b){return function(_0x200bc4){if(!_0x200bc4){_0x4f877c[_0x21c5('0x17')](0x194);}return _0x200bc4;};}function handleError(_0x2ae029,_0x25aba4){_0x25aba4=_0x25aba4||0x1f4;return function(_0x531cf4){logger['error'](_0x531cf4['stack']);if(_0x531cf4[_0x21c5('0x24')]){delete _0x531cf4[_0x21c5('0x24')];}_0x2ae029[_0x21c5('0x18')](_0x25aba4)[_0x21c5('0x25')](_0x531cf4);};}exports['index']=function(_0x887b,_0x428b60){var _0x26dc04={},_0x1f3892={},_0x3b66f9={'count':0x0,'rows':[]};var _0x526174=_['map'](db[_0x21c5('0x26')][_0x21c5('0x27')],function(_0x3353b3){return{'name':_0x3353b3[_0x21c5('0x28')],'type':_0x3353b3[_0x21c5('0x29')][_0x21c5('0x2a')]};});_0x1f3892[_0x21c5('0x2b')]=_[_0x21c5('0x2c')](_0x526174,_0x21c5('0x24'));_0x1f3892[_0x21c5('0x2d')]=_['keys'](_0x887b['query']);_0x1f3892[_0x21c5('0x2e')]=_['intersection'](_0x1f3892[_0x21c5('0x2b')],_0x1f3892[_0x21c5('0x2d')]);_0x26dc04[_0x21c5('0x2f')]=_[_0x21c5('0x30')](_0x1f3892['model'],qs[_0x21c5('0x31')](_0x887b['query'][_0x21c5('0x31')]));_0x26dc04['attributes']=_0x26dc04[_0x21c5('0x2f')][_0x21c5('0x32')]?_0x26dc04[_0x21c5('0x2f')]:_0x1f3892['model'];if(!_0x887b[_0x21c5('0x2d')]['hasOwnProperty'](_0x21c5('0x33'))){_0x26dc04[_0x21c5('0x34')]=qs[_0x21c5('0x34')](_0x887b['query'][_0x21c5('0x34')]);_0x26dc04['offset']=qs['offset'](_0x887b[_0x21c5('0x2d')][_0x21c5('0x1a')]);}_0x26dc04[_0x21c5('0x35')]=qs[_0x21c5('0x36')](_0x887b['query'][_0x21c5('0x36')]);_0x26dc04[_0x21c5('0x37')]=qs[_0x21c5('0x2e')](_[_0x21c5('0x38')](_0x887b[_0x21c5('0x2d')],_0x1f3892[_0x21c5('0x2e')]),_0x526174);if(_0x887b[_0x21c5('0x2d')][_0x21c5('0x39')]){_0x26dc04['where']=_[_0x21c5('0x3a')](_0x26dc04[_0x21c5('0x37')],{'$or':_[_0x21c5('0x2c')](_0x526174,function(_0x5348ff){if(_0x5348ff[_0x21c5('0x29')]!==_0x21c5('0x3b')){var _0x32634f={};_0x32634f[_0x5348ff[_0x21c5('0x24')]]={'$like':'%'+_0x887b[_0x21c5('0x2d')]['filter']+'%'};return _0x32634f;}})});}_0x26dc04=_[_0x21c5('0x3a')]({},_0x26dc04,_0x887b[_0x21c5('0x3c')]);var _0x6358ae={'where':_0x26dc04[_0x21c5('0x37')]};return db[_0x21c5('0x26')]['count'](_0x6358ae)[_0x21c5('0x1f')](function(_0x169c0d){_0x3b66f9[_0x21c5('0x3d')]=_0x169c0d;if(_0x887b[_0x21c5('0x2d')]['includeAll']){_0x26dc04[_0x21c5('0x3e')]=[{'all':!![]}];}return db[_0x21c5('0x26')]['findAll'](_0x26dc04);})[_0x21c5('0x1f')](function(_0x1915a4){_0x3b66f9[_0x21c5('0x3f')]=_0x1915a4;return _0x3b66f9;})['then'](respondWithFilteredResult(_0x428b60,_0x26dc04))[_0x21c5('0x40')](handleError(_0x428b60,null));};exports[_0x21c5('0x41')]=function(_0x19d698,_0x56547e){var _0x2c079b={'raw':!![],'where':{'id':_0x19d698[_0x21c5('0x42')]['id']}},_0x5d0140={};_0x5d0140[_0x21c5('0x2b')]=_[_0x21c5('0x43')](db[_0x21c5('0x26')][_0x21c5('0x27')]);_0x5d0140['query']=_['keys'](_0x19d698['query']);_0x5d0140[_0x21c5('0x2e')]=_['intersection'](_0x5d0140[_0x21c5('0x2b')],_0x5d0140[_0x21c5('0x2d')]);_0x2c079b[_0x21c5('0x2f')]=_[_0x21c5('0x30')](_0x5d0140['model'],qs[_0x21c5('0x31')](_0x19d698[_0x21c5('0x2d')][_0x21c5('0x31')]));_0x2c079b[_0x21c5('0x2f')]=_0x2c079b[_0x21c5('0x2f')][_0x21c5('0x32')]?_0x2c079b[_0x21c5('0x2f')]:_0x5d0140[_0x21c5('0x2b')];if(_0x19d698[_0x21c5('0x2d')]['includeAll']){_0x2c079b[_0x21c5('0x3e')]=[{'all':!![]}];}_0x2c079b=_['merge']({},_0x2c079b,_0x19d698[_0x21c5('0x3c')]);return db[_0x21c5('0x26')][_0x21c5('0x44')](_0x2c079b)[_0x21c5('0x1f')](handleEntityNotFound(_0x56547e,null))[_0x21c5('0x1f')](respondWithResult(_0x56547e,null))[_0x21c5('0x40')](handleError(_0x56547e,null));};exports[_0x21c5('0x45')]=function(_0x132eec,_0x30328f){return db[_0x21c5('0x26')][_0x21c5('0x45')](_0x132eec[_0x21c5('0x46')],{})['then'](function(_0x5e4586){var _0x5513c5=_0x132eec[_0x21c5('0x47')][_0x21c5('0x21')]({'plain':!![]});if(!_0x5513c5)throw new Error(_0x21c5('0x48'));if(_0x5513c5['role']===_0x21c5('0x47')){var _0x1a8015=_0x5e4586[_0x21c5('0x21')]({'plain':!![]});var _0x4fb63f='Voicemails';return db[_0x21c5('0x49')][_0x21c5('0x44')]({'where':{'name':_0x4fb63f,'userProfileId':_0x5513c5[_0x21c5('0x4a')]},'raw':!![]})[_0x21c5('0x1f')](function(_0x59f8cf){if(_0x59f8cf&&_0x59f8cf[_0x21c5('0x4b')]===0x0){return db[_0x21c5('0x23')][_0x21c5('0x45')]({'name':_0x1a8015[_0x21c5('0x24')],'resourceId':_0x1a8015['id'],'type':_0x59f8cf['name'],'sectionId':_0x59f8cf['id']},{})[_0x21c5('0x1f')](function(){return _0x5e4586;});}else{return _0x5e4586;}})[_0x21c5('0x40')](function(_0x385a61){logger['error'](_0x21c5('0x4c'),_0x385a61);throw _0x385a61;});}return _0x5e4586;})['then'](respondWithResult(_0x30328f,0xc9))['catch'](handleError(_0x30328f,null));};exports[_0x21c5('0x1e')]=function(_0x2daf92,_0x26007f){if(_0x2daf92[_0x21c5('0x46')]['id']){delete _0x2daf92[_0x21c5('0x46')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x2daf92['params']['id']}})[_0x21c5('0x1f')](handleEntityNotFound(_0x26007f,null))[_0x21c5('0x1f')](saveUpdates(_0x2daf92['body'],null))[_0x21c5('0x1f')](respondWithResult(_0x26007f,null))[_0x21c5('0x40')](handleError(_0x26007f,null));};exports[_0x21c5('0x20')]=function(_0x67f482,_0x4b85be){return db[_0x21c5('0x26')][_0x21c5('0x44')]({'where':{'id':_0x67f482[_0x21c5('0x42')]['id']}})[_0x21c5('0x1f')](handleEntityNotFound(_0x4b85be,null))[_0x21c5('0x1f')](removeEntity(_0x4b85be,null))['catch'](handleError(_0x4b85be,null));};exports['getMessages']=function(_0x2de46c,_0x3d7144,_0x100f02){return db[_0x21c5('0x26')][_0x21c5('0x4d')]({'where':{'id':_0x2de46c['params']['id']}})[_0x21c5('0x1f')](handleEntityNotFound(_0x3d7144,null))[_0x21c5('0x1f')](function(_0x564acd){var _0xeb6ad9;var _0x4640f5={},_0x4fbbd8={};_0x4fbbd8[_0x21c5('0x2b')]=_['keys'](db[_0x21c5('0x4e')]['rawAttributes']);_0x4fbbd8[_0x21c5('0x2d')]=_[_0x21c5('0x43')](_0x2de46c[_0x21c5('0x2d')]);_0x4fbbd8[_0x21c5('0x2e')]=_[_0x21c5('0x30')](_0x4fbbd8['model'],_0x4fbbd8[_0x21c5('0x2d')]);_0x4640f5['attributes']=_[_0x21c5('0x30')](_0x4fbbd8['model'],qs[_0x21c5('0x31')](_0x2de46c[_0x21c5('0x2d')][_0x21c5('0x31')]));_0x4640f5[_0x21c5('0x2f')]=_0x4640f5[_0x21c5('0x2f')][_0x21c5('0x32')]?_0x4640f5[_0x21c5('0x2f')]:_0x4fbbd8[_0x21c5('0x2b')];if(!_0x2de46c['query'][_0x21c5('0x4f')]('nolimit')){_0x4640f5[_0x21c5('0x34')]=qs[_0x21c5('0x34')](_0x2de46c[_0x21c5('0x2d')][_0x21c5('0x34')]);_0x4640f5[_0x21c5('0x1a')]=qs['offset'](_0x2de46c['query'][_0x21c5('0x1a')]);}_0x4640f5[_0x21c5('0x35')]=qs[_0x21c5('0x36')](_0x2de46c[_0x21c5('0x2d')][_0x21c5('0x36')]);_0x4640f5['where']=qs[_0x21c5('0x2e')](_[_0x21c5('0x38')](_0x2de46c['query'],_0x4fbbd8[_0x21c5('0x2e')]));if(_0x2de46c['query'][_0x21c5('0x39')]){_0x4640f5[_0x21c5('0x37')]=_[_0x21c5('0x3a')](_0x4640f5[_0x21c5('0x37')],{'$or':_[_0x21c5('0x2c')](_0x4640f5['attributes'],function(_0x9a7d28){var _0x23a1f0={};_0x23a1f0[_0x9a7d28]={'$like':'%'+_0x2de46c[_0x21c5('0x2d')]['filter']+'%'};return _0x23a1f0;})});}_0x4640f5[_0x21c5('0x37')]=_['merge'](_0x4640f5[_0x21c5('0x37')],{'mailboxuser':_0x564acd['mailbox']});_0x4640f5=_[_0x21c5('0x3a')]({},_0x4640f5,_0x2de46c[_0x21c5('0x3c')]);return db[_0x21c5('0x4e')][_0x21c5('0x50')](_0x4640f5)[_0x21c5('0x1f')](respondWithFilteredResult(_0x3d7144,_0x4640f5));})['catch'](handleError(_0x3d7144,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index fc11ada..c58d494 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 _0x1a40=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api'];(function(_0x298f61,_0x517e67){var _0x8669be=function(_0x2576ed){while(--_0x2576ed){_0x298f61['push'](_0x298f61['shift']());}};_0x8669be(++_0x517e67);}(_0x1a40,0xb7));var _0x01a4=function(_0x392f3b,_0x2b7332){_0x392f3b=_0x392f3b-0x0;var _0x5b9fe8=_0x1a40[_0x392f3b];return _0x5b9fe8;};'use strict';var _=require(_0x01a4('0x0'));var util=require(_0x01a4('0x1'));var logger=require(_0x01a4('0x2'))(_0x01a4('0x3'));var moment=require(_0x01a4('0x4'));var BPromise=require(_0x01a4('0x5'));var rp=require(_0x01a4('0x6'));var fs=require('fs');var path=require(_0x01a4('0x7'));var rimraf=require(_0x01a4('0x8'));var config=require(_0x01a4('0x9'));var attributes=require(_0x01a4('0xa'));module[_0x01a4('0xb')]=function(_0x2e6cde,_0xce027e){return _0x2e6cde[_0x01a4('0xc')](_0x01a4('0xd'),attributes,{'tableName':_0x01a4('0xe'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x01a4('0xf'),_0x01a4('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf300=['../../config/logger','api','request-promise','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','context'];(function(_0x31079d,_0x47ead8){var _0xf0ee13=function(_0x3e85dd){while(--_0x3e85dd){_0x31079d['push'](_0x31079d['shift']());}};_0xf0ee13(++_0x47ead8);}(_0xf300,0xc6));var _0x0f30=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xf300[_0x1e5cc3];return _0x15c596;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f30('0x0'))(_0x0f30('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f30('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0f30('0x3'));var attributes=require(_0x0f30('0x4'));module[_0x0f30('0x5')]=function(_0xf93aae,_0x2649d8){return _0xf93aae['define']('VoiceMail',attributes,{'tableName':_0x0f30('0x6'),'paranoid':![],'indexes':[{'name':_0x0f30('0x7'),'fields':['mailbox',_0x0f30('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 52882b9..cbc5244 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 _0xbe23=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x317725,_0x1bd734){var _0x1e08cb=function(_0x42d51c){while(--_0x42d51c){_0x317725['push'](_0x317725['shift']());}};_0x1e08cb(++_0x1bd734);}(_0xbe23,0x92));var _0x3be2=function(_0x25e1a3,_0x39997f){_0x25e1a3=_0x25e1a3-0x0;var _0x1a6e6d=_0xbe23[_0x25e1a3];return _0x1a6e6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3be2('0x0'));var BPromise=require(_0x3be2('0x1'));var rs=require(_0x3be2('0x2'));var fs=require('fs');var Redis=require(_0x3be2('0x3'));var db=require(_0x3be2('0x4'))['db'];var utils=require(_0x3be2('0x5'));var logger=require(_0x3be2('0x6'))(_0x3be2('0x7'));var config=require('../../config/environment');var jayson=require(_0x3be2('0x8'));var client=jayson[_0x3be2('0x9')][_0x3be2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7edba1,_0xb68c6f,_0x362ff7){return new BPromise(function(_0x395297,_0x50441f){return client[_0x3be2('0xb')](_0x7edba1,_0x362ff7)['then'](function(_0x362c0e){logger[_0x3be2('0xc')](_0x3be2('0xd'),_0xb68c6f,_0x3be2('0xe'));logger[_0x3be2('0xf')](_0x3be2('0x10'),_0xb68c6f,_0x3be2('0xe'),JSON[_0x3be2('0x11')](_0x362c0e));if(_0x362c0e['error']){if(_0x362c0e[_0x3be2('0x12')][_0x3be2('0x13')]===0x1f4){logger[_0x3be2('0x12')](_0x3be2('0xd'),_0xb68c6f,_0x362c0e[_0x3be2('0x12')][_0x3be2('0x14')]);return _0x50441f(_0x362c0e[_0x3be2('0x12')][_0x3be2('0x14')]);}logger[_0x3be2('0x12')](_0x3be2('0xd'),_0xb68c6f,_0x362c0e[_0x3be2('0x12')][_0x3be2('0x14')]);return _0x395297(_0x362c0e[_0x3be2('0x12')][_0x3be2('0x14')]);}else{logger[_0x3be2('0xc')](_0x3be2('0xd'),_0xb68c6f,_0x3be2('0xe'));_0x395297(_0x362c0e[_0x3be2('0x15')][_0x3be2('0x14')]);}})[_0x3be2('0x16')](function(_0x5b9631){logger[_0x3be2('0x12')](_0x3be2('0xd'),_0xb68c6f,_0x5b9631);_0x50441f(_0x5b9631);});});} \ No newline at end of file +var _0x5d52=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x2eacce,_0x3d2f13){var _0x3b4faa=function(_0x151152){while(--_0x151152){_0x2eacce['push'](_0x2eacce['shift']());}};_0x3b4faa(++_0x3d2f13);}(_0x5d52,0x1e1));var _0x25d5=function(_0x4f51f9,_0x5d5613){_0x4f51f9=_0x4f51f9-0x0;var _0x533984=_0x5d52[_0x4f51f9];return _0x533984;};'use strict';var _=require(_0x25d5('0x0'));var util=require(_0x25d5('0x1'));var moment=require(_0x25d5('0x2'));var BPromise=require(_0x25d5('0x3'));var rs=require(_0x25d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x25d5('0x5'));var logger=require('../../config/logger')(_0x25d5('0x6'));var config=require(_0x25d5('0x7'));var jayson=require(_0x25d5('0x8'));var client=jayson[_0x25d5('0x9')][_0x25d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ddc57,_0xb36159,_0x10b204){return new BPromise(function(_0x1d9cc5,_0x2e6ac7){return client[_0x25d5('0xb')](_0x2ddc57,_0x10b204)[_0x25d5('0xc')](function(_0x1252aa){logger[_0x25d5('0xd')](_0x25d5('0xe'),_0xb36159,'request\x20sent');logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0xb36159,_0x25d5('0xf'),JSON[_0x25d5('0x10')](_0x1252aa));if(_0x1252aa[_0x25d5('0x11')]){if(_0x1252aa['error']['code']===0x1f4){logger[_0x25d5('0x11')](_0x25d5('0xe'),_0xb36159,_0x1252aa[_0x25d5('0x11')][_0x25d5('0x12')]);return _0x2e6ac7(_0x1252aa[_0x25d5('0x11')]['message']);}logger[_0x25d5('0x11')]('VoiceMail,\x20%s,\x20%s',_0xb36159,_0x1252aa[_0x25d5('0x11')][_0x25d5('0x12')]);return _0x1d9cc5(_0x1252aa['error'][_0x25d5('0x12')]);}else{logger[_0x25d5('0xd')](_0x25d5('0xe'),_0xb36159,'request\x20sent');_0x1d9cc5(_0x1252aa[_0x25d5('0x13')][_0x25d5('0x12')]);}})[_0x25d5('0x14')](function(_0x2fff16){logger[_0x25d5('0x11')](_0x25d5('0xe'),_0xb36159,_0x2fff16);_0x2e6ac7(_0x2fff16);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 55bebb8..beff1b1 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 _0xba34=['express','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x42003f,_0x1ac84a){var _0x371c69=function(_0x358814){while(--_0x358814){_0x42003f['push'](_0x42003f['shift']());}};_0x371c69(++_0x1ac84a);}(_0xba34,0x119));var _0x4ba3=function(_0x1755d7,_0x574579){_0x1755d7=_0x1755d7-0x0;var _0x491588=_0xba34[_0x1755d7];return _0x491588;};'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 auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x7')](_0x4ba3('0xc'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['update']);router[_0x4ba3('0x11')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3f0aea,_0x40ea8c){var _0x382714=function(_0x5284b9){while(--_0x5284b9){_0x3f0aea['push'](_0x3f0aea['shift']());}};_0x382714(++_0x40ea8c);}(_0x4819,0xcd));var _0x9481=function(_0x6ea8a2,_0x561d6c){_0x6ea8a2=_0x6ea8a2-0x0;var _0x4fe938=_0x4819[_0x6ea8a2];return _0x4fe938;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 465d55d..9c4a5bf 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 _0x880f=['getDataValue','INTEGER','STRING','sequelize','exports'];(function(_0x1d3901,_0xa5c1d1){var _0xdbaa4d=function(_0x5644c8){while(--_0x5644c8){_0x1d3901['push'](_0x1d3901['shift']());}};_0xdbaa4d(++_0xa5c1d1);}(_0x880f,0xc1));var _0xf880=function(_0x463adf,_0x3881b4){_0x463adf=_0x463adf-0x0;var _0x35fe78=_0x880f[_0x463adf];return _0x35fe78;};'use strict';var Sequelize=require(_0xf880('0x0'));module[_0xf880('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x49fc46){return this[_0xf880('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf880('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xf880('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf880('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf880('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xf880('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf880('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x1c05=['VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','sequelize','exports'];(function(_0x347b71,_0x5e6e46){var _0x44b702=function(_0x21aebf){while(--_0x21aebf){_0x347b71['push'](_0x347b71['shift']());}};_0x44b702(++_0x5e6e46);}(_0x1c05,0x1de));var _0x51c0=function(_0x1d0b2d,_0x1d5ddf){_0x1d0b2d=_0x1d0b2d-0x0;var _0x2f9065=_0x1c05[_0x1d0b2d];return _0x2f9065;};'use strict';var Sequelize=require(_0x51c0('0x0'));module[_0x51c0('0x1')]={'name':{'type':Sequelize[_0x51c0('0x2')],'get':function(_0x38cb2e){return this[_0x51c0('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x51c0('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x51c0('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x51c0('0x5')],'defaultValue':''},'stamp':{'type':_0x51c0('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6f2a3f5..67812ed 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 _0x946e=['keys','find','catch','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','html-pdf','eml-format','request-promise','moment','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params'];(function(_0x3d556b,_0x66257){var _0x477d34=function(_0x30c881){while(--_0x30c881){_0x3d556b['push'](_0x3d556b['shift']());}};_0x477d34(++_0x66257);}(_0x946e,0x148));var _0xe946=function(_0x396883,_0x5851ff){_0x396883=_0x396883-0x0;var _0x3b64d4=_0x946e[_0x396883];return _0x3b64d4;};'use strict';var pdf=require(_0xe946('0x0'));var emlformat=require(_0xe946('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe946('0x2'));var moment=require(_0xe946('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe946('0x4'));var csv=require('to-csv');var ejs=require(_0xe946('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe946('0x6'));var crypto=require(_0xe946('0x7'));var jsforce=require(_0xe946('0x8'));var deskjs=require(_0xe946('0x9'));var toCsv=require(_0xe946('0xa'));var querystring=require(_0xe946('0xb'));var Papa=require('papaparse');var Redis=require(_0xe946('0xc'));var authService=require(_0xe946('0xd'));var qs=require(_0xe946('0xe'));var as=require(_0xe946('0xf'));var hardwareService=require(_0xe946('0x10'));var logger=require(_0xe946('0x11'))(_0xe946('0x12'));var utils=require(_0xe946('0x13'));var config=require(_0xe946('0x14'));var licenseUtil=require(_0xe946('0x15'));var db=require(_0xe946('0x16'))['db'];function respondWithStatusCode(_0x40e3ec,_0xdf210f){_0xdf210f=_0xdf210f||0xcc;return function(_0xc10125){if(_0xc10125){return _0x40e3ec[_0xe946('0x17')](_0xdf210f);}return _0x40e3ec[_0xe946('0x18')](_0xdf210f)[_0xe946('0x19')]();};}function respondWithResult(_0x2eac52,_0x1ba0c1){_0x1ba0c1=_0x1ba0c1||0xc8;return function(_0x3ff1fe){if(_0x3ff1fe){return _0x2eac52[_0xe946('0x18')](_0x1ba0c1)[_0xe946('0x1a')](_0x3ff1fe);}};}function respondWithFilteredResult(_0x30663c,_0x1fdc4b){return function(_0x390a6b){if(_0x390a6b){var _0x39baa9=_0x390a6b['count'],_0xf367e=_0x1fdc4b[_0xe946('0x1b')],_0x484e4e=_0x1fdc4b[_0xe946('0x1b')]+_0x1fdc4b[_0xe946('0x1c')],_0x44aefd;if(_0x484e4e>=_0x39baa9){_0x484e4e=_0x39baa9;_0x44aefd=0xc8;}else{_0x44aefd=0xce;}_0x30663c[_0xe946('0x18')](_0x44aefd);return _0x30663c[_0xe946('0x1d')]('Content-Range',_0xf367e+'-'+_0x484e4e+'/'+_0x39baa9)[_0xe946('0x1a')](_0x390a6b);}return null;};}function patchUpdates(_0x293128){return function(_0x4d7a9d){try{jsonpatch[_0xe946('0x1e')](_0x4d7a9d,_0x293128,!![]);}catch(_0x53b3c1){return BPromise[_0xe946('0x1f')](_0x53b3c1);}return _0x4d7a9d[_0xe946('0x20')]();};}function saveUpdates(_0x337ba3,_0x39f224){return function(_0x2d07a2){if(_0x2d07a2){return _0x2d07a2[_0xe946('0x21')](_0x337ba3)[_0xe946('0x22')](function(_0x20d99d){return _0x20d99d;});}return null;};}function removeEntity(_0x59f6ea,_0x118faa){return function(_0x568da9){if(_0x568da9){return _0x568da9[_0xe946('0x23')]()[_0xe946('0x22')](function(){_0x59f6ea[_0xe946('0x18')](0xcc)[_0xe946('0x19')]();});}};}function handleEntityNotFound(_0x425dfa,_0x400709){return function(_0x2003e9){if(!_0x2003e9){_0x425dfa['sendStatus'](0x194);}return _0x2003e9;};}function handleError(_0x4ec33c,_0x13d49e){_0x13d49e=_0x13d49e||0x1f4;return function(_0x406b96){logger[_0xe946('0x24')](_0x406b96[_0xe946('0x25')]);if(_0x406b96[_0xe946('0x26')]){delete _0x406b96[_0xe946('0x26')];}_0x4ec33c['status'](_0x13d49e)['send'](_0x406b96);};}exports[_0xe946('0x27')]=function(_0x1d7cd7,_0x5528bc){var _0x333867={},_0x5412dc={},_0xeafc0c={'count':0x0,'rows':[]};var _0x246cb9=_[_0xe946('0x28')](db[_0xe946('0x29')][_0xe946('0x2a')],function(_0x28b9a8){return{'name':_0x28b9a8['fieldName'],'type':_0x28b9a8[_0xe946('0x2b')][_0xe946('0x2c')]};});_0x5412dc[_0xe946('0x2d')]=_[_0xe946('0x2e')](_[_0xe946('0x28')](_0x246cb9,_0xe946('0x26')),[_0xe946('0x26')]);_0x5412dc[_0xe946('0x2f')]=_['keys'](_0x1d7cd7['query']);_0x5412dc[_0xe946('0x30')]=_[_0xe946('0x31')](_0x5412dc[_0xe946('0x2d')],_0x5412dc[_0xe946('0x2f')]);_0x333867[_0xe946('0x32')]=_[_0xe946('0x31')](_0x5412dc['model'],qs[_0xe946('0x33')](_0x1d7cd7['query'][_0xe946('0x33')]));_0x333867[_0xe946('0x32')]=_0x333867['attributes']['length']?_0x333867[_0xe946('0x32')]:_0x5412dc[_0xe946('0x2d')];if(!_0x1d7cd7[_0xe946('0x2f')][_0xe946('0x34')](_0xe946('0x35'))){_0x333867['limit']=qs[_0xe946('0x1c')](_0x1d7cd7['query'][_0xe946('0x1c')]);_0x333867[_0xe946('0x1b')]=qs[_0xe946('0x1b')](_0x1d7cd7[_0xe946('0x2f')][_0xe946('0x1b')]);}_0x333867['order']=qs[_0xe946('0x36')](_0x1d7cd7[_0xe946('0x2f')][_0xe946('0x36')]);_0x333867[_0xe946('0x37')]=qs[_0xe946('0x30')](_['pick'](_0x1d7cd7[_0xe946('0x2f')],_0x5412dc['filters']),_0x246cb9);if(_0x1d7cd7['query'][_0xe946('0x38')]){_0x333867['where']=_[_0xe946('0x39')](_0x333867[_0xe946('0x37')],{'$or':_[_0xe946('0x28')](_0x246cb9,function(_0x1bf3fa){if(_0x1bf3fa[_0xe946('0x2b')]!==_0xe946('0x3a')){var _0x567e9e={};_0x567e9e[_0x1bf3fa['name']]={'$like':'%'+_0x1d7cd7[_0xe946('0x2f')]['filter']+'%'};return _0x567e9e;}})});}_0x333867=_['merge']({},_0x333867,_0x1d7cd7[_0xe946('0x3b')]);var _0x3683d1={'where':_0x333867['where']};return db[_0xe946('0x29')]['count'](_0x3683d1)[_0xe946('0x22')](function(_0x467841){_0xeafc0c[_0xe946('0x3c')]=_0x467841;if(_0x1d7cd7[_0xe946('0x2f')][_0xe946('0x3d')]){_0x333867[_0xe946('0x3e')]=[{'all':!![]}];}return db[_0xe946('0x29')][_0xe946('0x3f')](_0x333867);})[_0xe946('0x22')](function(_0x215a18){_0xeafc0c[_0xe946('0x40')]=_0x215a18;return _0xeafc0c;})[_0xe946('0x22')](respondWithFilteredResult(_0x5528bc,_0x333867))['catch'](handleError(_0x5528bc,null));};exports[_0xe946('0x41')]=function(_0x2ff93b,_0x1077f2){var _0x509b8f={'raw':!![],'where':{'id':_0x2ff93b[_0xe946('0x42')]['id']}},_0x18cdf0={};_0x18cdf0[_0xe946('0x2d')]=_[_0xe946('0x43')](db[_0xe946('0x29')][_0xe946('0x2a')]);_0x18cdf0[_0xe946('0x2f')]=_[_0xe946('0x43')](_0x2ff93b[_0xe946('0x2f')]);_0x18cdf0[_0xe946('0x30')]=_[_0xe946('0x31')](_0x18cdf0[_0xe946('0x2d')],_0x18cdf0[_0xe946('0x2f')]);_0x509b8f[_0xe946('0x32')]=_[_0xe946('0x31')](_0x18cdf0[_0xe946('0x2d')],qs[_0xe946('0x33')](_0x2ff93b[_0xe946('0x2f')]['fields']));_0x509b8f[_0xe946('0x32')]=_0x509b8f['attributes']['length']?_0x509b8f['attributes']:_0x18cdf0['model'];if(_0x2ff93b[_0xe946('0x2f')]['includeAll']){_0x509b8f[_0xe946('0x3e')]=[{'all':!![]}];}_0x509b8f=_['merge']({},_0x509b8f,_0x2ff93b[_0xe946('0x3b')]);return db[_0xe946('0x29')][_0xe946('0x44')](_0x509b8f)['then'](handleEntityNotFound(_0x1077f2,null))[_0xe946('0x22')](respondWithResult(_0x1077f2,null))[_0xe946('0x45')](handleError(_0x1077f2,null));};exports[_0xe946('0x46')]=function(_0x5cc07b,_0x16e5d){return db[_0xe946('0x29')][_0xe946('0x46')](_0x5cc07b[_0xe946('0x47')],{})[_0xe946('0x22')](respondWithResult(_0x16e5d,0xc9))[_0xe946('0x45')](handleError(_0x16e5d,null));};exports['update']=function(_0x38f1e9,_0x93ac1){if(_0x38f1e9['body']['id']){delete _0x38f1e9[_0xe946('0x47')]['id'];}return db[_0xe946('0x29')]['find']({'where':{'id':_0x38f1e9[_0xe946('0x42')]['id']}})[_0xe946('0x22')](handleEntityNotFound(_0x93ac1,null))[_0xe946('0x22')](saveUpdates(_0x38f1e9[_0xe946('0x47')],null))[_0xe946('0x22')](respondWithResult(_0x93ac1,null))[_0xe946('0x45')](handleError(_0x93ac1,null));};exports[_0xe946('0x23')]=function(_0x195321,_0x1e2586){return db[_0xe946('0x29')][_0xe946('0x44')]({'where':{'id':_0x195321['params']['id']}})['then'](handleEntityNotFound(_0x1e2586,null))[_0xe946('0x22')](removeEntity(_0x1e2586,null))[_0xe946('0x45')](handleError(_0x1e2586,null));};exports[_0xe946('0x48')]=function(_0x4496af,_0x50038b,_0x465847){return db[_0xe946('0x29')]['find']({'where':{'id':_0x4496af['params']['id']},'attributes':['id',_0xe946('0x49'),_0xe946('0x4a')]})['then'](handleEntityNotFound(_0x50038b,null))['then'](function(_0x386cc1){if(_0x386cc1){if(!_0x386cc1[_0xe946('0x49')]){throw new db[(_0xe946('0x4b'))]['ValidationError'](_0xe946('0x4c'));}var _0x1806cd={'Content-Type':_0xe946('0x4d'),'Content-Disposition':_0xe946('0x4e')};if(_0x386cc1[_0xe946('0x4a')]){_0x1806cd['Content-Disposition']='attachment;\x20filename=\x22'+_0x386cc1['msg_id']+'.wav\x22';}_0x50038b[_0xe946('0x1d')](_0x1806cd);return _0x50038b['send'](new Buffer(_0x386cc1[_0xe946('0x49')]));}})[_0xe946('0x45')](handleError(_0x50038b,null));}; \ No newline at end of file +var _0x1a49=['desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','create','body','params','find','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto'];(function(_0x23e051,_0x3483eb){var _0x5a948b=function(_0x4a12bd){while(--_0x4a12bd){_0x23e051['push'](_0x23e051['shift']());}};_0x5a948b(++_0x3483eb);}(_0x1a49,0xe1));var _0x91a4=function(_0x3a090f,_0x3d3a7d){_0x3a090f=_0x3a090f-0x0;var _0x232162=_0x1a49[_0x3a090f];return _0x232162;};'use strict';var pdf=require(_0x91a4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x91a4('0x1'));var jsonpatch=require(_0x91a4('0x2'));var rp=require(_0x91a4('0x3'));var moment=require(_0x91a4('0x4'));var BPromise=require(_0x91a4('0x5'));var Mustache=require(_0x91a4('0x6'));var util=require(_0x91a4('0x7'));var path=require(_0x91a4('0x8'));var sox=require('sox');var csv=require(_0x91a4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x91a4('0xa'));var crypto=require(_0x91a4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x91a4('0xc'));var toCsv=require(_0x91a4('0x9'));var querystring=require(_0x91a4('0xd'));var Papa=require('papaparse');var Redis=require(_0x91a4('0xe'));var authService=require(_0x91a4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91a4('0x10'));var logger=require(_0x91a4('0x11'))(_0x91a4('0x12'));var utils=require(_0x91a4('0x13'));var config=require(_0x91a4('0x14'));var licenseUtil=require(_0x91a4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c2b16,_0x4a8212){_0x4a8212=_0x4a8212||0xcc;return function(_0x48f86c){if(_0x48f86c){return _0x2c2b16[_0x91a4('0x16')](_0x4a8212);}return _0x2c2b16[_0x91a4('0x17')](_0x4a8212)[_0x91a4('0x18')]();};}function respondWithResult(_0x47d965,_0x1d0b2a){_0x1d0b2a=_0x1d0b2a||0xc8;return function(_0x10a465){if(_0x10a465){return _0x47d965[_0x91a4('0x17')](_0x1d0b2a)['json'](_0x10a465);}};}function respondWithFilteredResult(_0xbeead6,_0x4720f1){return function(_0x42fb01){if(_0x42fb01){var _0xefbae3=_0x42fb01[_0x91a4('0x19')],_0x3df08d=_0x4720f1[_0x91a4('0x1a')],_0x238667=_0x4720f1['offset']+_0x4720f1[_0x91a4('0x1b')],_0x43d4ac;if(_0x238667>=_0xefbae3){_0x238667=_0xefbae3;_0x43d4ac=0xc8;}else{_0x43d4ac=0xce;}_0xbeead6[_0x91a4('0x17')](_0x43d4ac);return _0xbeead6['set'](_0x91a4('0x1c'),_0x3df08d+'-'+_0x238667+'/'+_0xefbae3)[_0x91a4('0x1d')](_0x42fb01);}return null;};}function patchUpdates(_0x141139){return function(_0x4a7389){try{jsonpatch['apply'](_0x4a7389,_0x141139,!![]);}catch(_0x267f64){return BPromise['reject'](_0x267f64);}return _0x4a7389[_0x91a4('0x1e')]();};}function saveUpdates(_0x5fc44c,_0x10bde6){return function(_0x11e9ae){if(_0x11e9ae){return _0x11e9ae[_0x91a4('0x1f')](_0x5fc44c)[_0x91a4('0x20')](function(_0x428eed){return _0x428eed;});}return null;};}function removeEntity(_0x13ccf5,_0x4804a0){return function(_0x19a6c6){if(_0x19a6c6){return _0x19a6c6[_0x91a4('0x21')]()[_0x91a4('0x20')](function(){_0x13ccf5[_0x91a4('0x17')](0xcc)[_0x91a4('0x18')]();});}};}function handleEntityNotFound(_0x4fa18e,_0x87b400){return function(_0x3d539b){if(!_0x3d539b){_0x4fa18e[_0x91a4('0x16')](0x194);}return _0x3d539b;};}function handleError(_0x175fb4,_0x93c9a6){_0x93c9a6=_0x93c9a6||0x1f4;return function(_0x3034d2){logger[_0x91a4('0x22')](_0x3034d2[_0x91a4('0x23')]);if(_0x3034d2['name']){delete _0x3034d2[_0x91a4('0x24')];}_0x175fb4['status'](_0x93c9a6)[_0x91a4('0x25')](_0x3034d2);};}exports[_0x91a4('0x26')]=function(_0x324db4,_0x34e06a){var _0x5e3df7={},_0x97823d={},_0x2ed110={'count':0x0,'rows':[]};var _0x3365a7=_[_0x91a4('0x27')](db[_0x91a4('0x28')][_0x91a4('0x29')],function(_0x31d5a5){return{'name':_0x31d5a5[_0x91a4('0x2a')],'type':_0x31d5a5[_0x91a4('0x2b')]['key']};});_0x97823d[_0x91a4('0x2c')]=_[_0x91a4('0x2d')](_['map'](_0x3365a7,_0x91a4('0x24')),[_0x91a4('0x24')]);_0x97823d[_0x91a4('0x2e')]=_['keys'](_0x324db4[_0x91a4('0x2e')]);_0x97823d[_0x91a4('0x2f')]=_[_0x91a4('0x30')](_0x97823d[_0x91a4('0x2c')],_0x97823d['query']);_0x5e3df7[_0x91a4('0x31')]=_[_0x91a4('0x30')](_0x97823d[_0x91a4('0x2c')],qs[_0x91a4('0x32')](_0x324db4[_0x91a4('0x2e')][_0x91a4('0x32')]));_0x5e3df7[_0x91a4('0x31')]=_0x5e3df7[_0x91a4('0x31')][_0x91a4('0x33')]?_0x5e3df7[_0x91a4('0x31')]:_0x97823d[_0x91a4('0x2c')];if(!_0x324db4[_0x91a4('0x2e')][_0x91a4('0x34')]('nolimit')){_0x5e3df7['limit']=qs['limit'](_0x324db4['query'][_0x91a4('0x1b')]);_0x5e3df7['offset']=qs[_0x91a4('0x1a')](_0x324db4[_0x91a4('0x2e')][_0x91a4('0x1a')]);}_0x5e3df7['order']=qs[_0x91a4('0x35')](_0x324db4[_0x91a4('0x2e')][_0x91a4('0x35')]);_0x5e3df7[_0x91a4('0x36')]=qs[_0x91a4('0x2f')](_[_0x91a4('0x37')](_0x324db4[_0x91a4('0x2e')],_0x97823d['filters']),_0x3365a7);if(_0x324db4[_0x91a4('0x2e')][_0x91a4('0x38')]){_0x5e3df7[_0x91a4('0x36')]=_[_0x91a4('0x39')](_0x5e3df7[_0x91a4('0x36')],{'$or':_['map'](_0x3365a7,function(_0x57dba0){if(_0x57dba0[_0x91a4('0x2b')]!==_0x91a4('0x3a')){var _0x517733={};_0x517733[_0x57dba0[_0x91a4('0x24')]]={'$like':'%'+_0x324db4[_0x91a4('0x2e')][_0x91a4('0x38')]+'%'};return _0x517733;}})});}_0x5e3df7=_[_0x91a4('0x39')]({},_0x5e3df7,_0x324db4[_0x91a4('0x3b')]);var _0x46a6ce={'where':_0x5e3df7[_0x91a4('0x36')]};return db[_0x91a4('0x28')]['count'](_0x46a6ce)[_0x91a4('0x20')](function(_0x41ade4){_0x2ed110[_0x91a4('0x19')]=_0x41ade4;if(_0x324db4[_0x91a4('0x2e')][_0x91a4('0x3c')]){_0x5e3df7[_0x91a4('0x3d')]=[{'all':!![]}];}return db[_0x91a4('0x28')]['findAll'](_0x5e3df7);})[_0x91a4('0x20')](function(_0x4c090a){_0x2ed110[_0x91a4('0x3e')]=_0x4c090a;return _0x2ed110;})[_0x91a4('0x20')](respondWithFilteredResult(_0x34e06a,_0x5e3df7))[_0x91a4('0x3f')](handleError(_0x34e06a,null));};exports['show']=function(_0x2e2633,_0x3da5b7){var _0x1a43ff={'raw':!![],'where':{'id':_0x2e2633['params']['id']}},_0x2f7547={};_0x2f7547['model']=_[_0x91a4('0x40')](db[_0x91a4('0x28')]['rawAttributes']);_0x2f7547[_0x91a4('0x2e')]=_[_0x91a4('0x40')](_0x2e2633['query']);_0x2f7547[_0x91a4('0x2f')]=_[_0x91a4('0x30')](_0x2f7547[_0x91a4('0x2c')],_0x2f7547[_0x91a4('0x2e')]);_0x1a43ff[_0x91a4('0x31')]=_[_0x91a4('0x30')](_0x2f7547[_0x91a4('0x2c')],qs[_0x91a4('0x32')](_0x2e2633[_0x91a4('0x2e')][_0x91a4('0x32')]));_0x1a43ff[_0x91a4('0x31')]=_0x1a43ff['attributes'][_0x91a4('0x33')]?_0x1a43ff[_0x91a4('0x31')]:_0x2f7547[_0x91a4('0x2c')];if(_0x2e2633[_0x91a4('0x2e')][_0x91a4('0x3c')]){_0x1a43ff['include']=[{'all':!![]}];}_0x1a43ff=_[_0x91a4('0x39')]({},_0x1a43ff,_0x2e2633['options']);return db[_0x91a4('0x28')]['find'](_0x1a43ff)[_0x91a4('0x20')](handleEntityNotFound(_0x3da5b7,null))[_0x91a4('0x20')](respondWithResult(_0x3da5b7,null))[_0x91a4('0x3f')](handleError(_0x3da5b7,null));};exports[_0x91a4('0x41')]=function(_0x57c2e1,_0x1db0cc){return db[_0x91a4('0x28')][_0x91a4('0x41')](_0x57c2e1[_0x91a4('0x42')],{})[_0x91a4('0x20')](respondWithResult(_0x1db0cc,0xc9))[_0x91a4('0x3f')](handleError(_0x1db0cc,null));};exports['update']=function(_0x8f1ad8,_0xabd674){if(_0x8f1ad8[_0x91a4('0x42')]['id']){delete _0x8f1ad8[_0x91a4('0x42')]['id'];}return db[_0x91a4('0x28')]['find']({'where':{'id':_0x8f1ad8[_0x91a4('0x43')]['id']}})[_0x91a4('0x20')](handleEntityNotFound(_0xabd674,null))[_0x91a4('0x20')](saveUpdates(_0x8f1ad8[_0x91a4('0x42')],null))['then'](respondWithResult(_0xabd674,null))[_0x91a4('0x3f')](handleError(_0xabd674,null));};exports['destroy']=function(_0x33140d,_0x591515){return db['VoiceMailMessage']['find']({'where':{'id':_0x33140d[_0x91a4('0x43')]['id']}})[_0x91a4('0x20')](handleEntityNotFound(_0x591515,null))[_0x91a4('0x20')](removeEntity(_0x591515,null))[_0x91a4('0x3f')](handleError(_0x591515,null));};exports['download']=function(_0x3f2e93,_0x23dac4,_0x4ddb54){return db[_0x91a4('0x28')][_0x91a4('0x44')]({'where':{'id':_0x3f2e93['params']['id']},'attributes':['id',_0x91a4('0x45'),'msg_id']})[_0x91a4('0x20')](handleEntityNotFound(_0x23dac4,null))['then'](function(_0x2ec12d){if(_0x2ec12d){if(!_0x2ec12d[_0x91a4('0x45')]){throw new db[(_0x91a4('0x46'))]['ValidationError'](_0x91a4('0x47'));}var _0x1a629b={'Content-Type':_0x91a4('0x48'),'Content-Disposition':_0x91a4('0x49')};if(_0x2ec12d[_0x91a4('0x4a')]){_0x1a629b[_0x91a4('0x4b')]=_0x91a4('0x4c')+_0x2ec12d[_0x91a4('0x4a')]+_0x91a4('0x4d');}_0x23dac4[_0x91a4('0x4e')](_0x1a629b);return _0x23dac4[_0x91a4('0x25')](new Buffer(_0x2ec12d['recording']));}})[_0x91a4('0x3f')](handleError(_0x23dac4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8d6c99a..e16f80e 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 _0x596c=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','lodash'];(function(_0x193520,_0x5bc39c){var _0x17ed47=function(_0x520547){while(--_0x520547){_0x193520['push'](_0x193520['shift']());}};_0x17ed47(++_0x5bc39c);}(_0x596c,0x1ac));var _0xc596=function(_0x4fef2f,_0x35fb39){_0x4fef2f=_0x4fef2f-0x0;var _0x46423f=_0x596c[_0x4fef2f];return _0x46423f;};'use strict';var _=require(_0xc596('0x0'));var util=require(_0xc596('0x1'));var logger=require(_0xc596('0x2'))(_0xc596('0x3'));var moment=require(_0xc596('0x4'));var BPromise=require('bluebird');var rp=require(_0xc596('0x5'));var fs=require('fs');var path=require(_0xc596('0x6'));var rimraf=require('rimraf');var config=require(_0xc596('0x7'));var attributes=require(_0xc596('0x8'));module['exports']=function(_0x34eb7c,_0x125332){return _0x34eb7c['define'](_0xc596('0x9'),attributes,{'tableName':_0xc596('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xcbe4=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x1ae2b1,_0x5b090c){var _0x417c24=function(_0x233867){while(--_0x233867){_0x1ae2b1['push'](_0x1ae2b1['shift']());}};_0x417c24(++_0x5b090c);}(_0xcbe4,0x1ed));var _0x4cbe=function(_0xd1ade,_0x221a08){_0xd1ade=_0xd1ade-0x0;var _0x15f0c3=_0xcbe4[_0xd1ade];return _0x15f0c3;};'use strict';var _=require(_0x4cbe('0x0'));var util=require(_0x4cbe('0x1'));var logger=require(_0x4cbe('0x2'))(_0x4cbe('0x3'));var moment=require('moment');var BPromise=require(_0x4cbe('0x4'));var rp=require(_0x4cbe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cbe('0x6'));var config=require(_0x4cbe('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x4cbe('0x8')]=function(_0x587fe0,_0x52ad13){return _0x587fe0[_0x4cbe('0x9')](_0x4cbe('0xa'),attributes,{'tableName':_0x4cbe('0xb'),'paranoid':![],'indexes':[{'name':_0x4cbe('0xc'),'fields':[_0x4cbe('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index e197b5a..47b719c 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 _0x0295=['client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52f835,_0x27dfa9){var _0x144b9c=function(_0x2d8c82){while(--_0x2d8c82){_0x52f835['push'](_0x52f835['shift']());}};_0x144b9c(++_0x27dfa9);}(_0x0295,0x1f0));var _0x5029=function(_0x5aef12,_0x1edd9d){_0x5aef12=_0x5aef12-0x0;var _0x245089=_0x0295[_0x5aef12];return _0x245089;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x1967,0x173));var _0x7196=function(_0x5bc311,_0xfda7ed){_0x5bc311=_0x5bc311-0x0;var _0x2732ff=_0x1967[_0x5bc311];return _0x2732ff;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 40ae749..5e797ae 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 _0x80d5=['getSounds','post','create','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds'];(function(_0xf71e78,_0x5a4184){var _0x5bfc4c=function(_0x5f1999){while(--_0x5f1999){_0xf71e78['push'](_0xf71e78['shift']());}};_0x5bfc4c(++_0x5a4184);}(_0x80d5,0x14b));var _0x580d=function(_0x2783c3,_0x1cad62){_0x2783c3=_0x2783c3-0x0;var _0x19957d=_0x80d5[_0x2783c3];return _0x19957d;};'use strict';var multer=require(_0x580d('0x0'));var util=require('util');var path=require(_0x580d('0x1'));var timeout=require(_0x580d('0x2'));var express=require(_0x580d('0x3'));var router=express[_0x580d('0x4')]();var auth=require(_0x580d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x580d('0x6'));var controller=require(_0x580d('0x7'));router[_0x580d('0x8')]('/',auth['isAuthenticated'](),controller[_0x580d('0x9')]);router[_0x580d('0x8')](_0x580d('0xa'),auth[_0x580d('0xb')](),controller[_0x580d('0xc')]);router[_0x580d('0x8')](_0x580d('0xd'),auth[_0x580d('0xb')](),controller[_0x580d('0xe')]);router[_0x580d('0xf')]('/',auth[_0x580d('0xb')](),controller[_0x580d('0x10')]);router[_0x580d('0xf')](_0x580d('0xd'),auth['isAuthenticated'](),controller['addSound']);router[_0x580d('0x11')](_0x580d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x580d('0x12')](_0x580d('0xa'),auth[_0x580d('0xb')](),controller[_0x580d('0x13')]);router['delete'](_0x580d('0x14'),auth[_0x580d('0xb')](),controller[_0x580d('0x15')]);module[_0x580d('0x16')]=router; \ No newline at end of file +var _0x955f=['post','create','put','/:id','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./voiceMusicOnHold.controller','isAuthenticated','index','get','show','/:id/sounds','getSounds'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x955f,0x1eb));var _0xf955=function(_0x39426f,_0x503ca0){_0x39426f=_0x39426f-0x0;var _0x5a9bb6=_0x955f[_0x39426f];return _0x5a9bb6;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var auth=require(_0xf955('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf955('0x6'));router['get']('/',auth[_0xf955('0x7')](),controller[_0xf955('0x8')]);router[_0xf955('0x9')]('/:id',auth[_0xf955('0x7')](),controller[_0xf955('0xa')]);router['get'](_0xf955('0xb'),auth[_0xf955('0x7')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x7')](),controller[_0xf955('0xe')]);router[_0xf955('0xd')]('/:id/sounds',auth[_0xf955('0x7')](),controller['addSound']);router[_0xf955('0xf')](_0xf955('0x10'),auth[_0xf955('0x7')](),controller['update']);router[_0xf955('0x11')]('/:id',auth[_0xf955('0x7')](),controller['destroy']);router[_0xf955('0x11')](_0xf955('0x12'),auth[_0xf955('0x7')](),controller[_0xf955('0x13')]);module[_0xf955('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 3d3e925..ce5d370 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 _0xb367=['files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','mp3nb','quietmp3','mp3'];(function(_0x461fe7,_0x288104){var _0x35e5d1=function(_0x57df90){while(--_0x57df90){_0x461fe7['push'](_0x461fe7['shift']());}};_0x35e5d1(++_0x288104);}(_0xb367,0x1d2));var _0x7b36=function(_0x3f2f91,_0x52aa81){_0x3f2f91=_0x3f2f91-0x0;var _0x479ac3=_0xb367[_0x3f2f91];return _0x479ac3;};'use strict';var Sequelize=require(_0x7b36('0x0'));module[_0x7b36('0x1')]={'name':{'type':Sequelize[_0x7b36('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7b36('0x3')]('custom','files',_0x7b36('0x4'),'quietmp3nb',_0x7b36('0x5'),_0x7b36('0x6')),'allowNull':!![],'defaultValue':_0x7b36('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7b36('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7b36('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7b36('0x8')},'format':{'type':Sequelize[_0x7b36('0x2')],'allowNull':!![]},'stamp':{'type':_0x7b36('0x9')},'defaultEntry':{'type':Sequelize[_0x7b36('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x811b=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x19f04c,_0x1abb53){var _0x1f6ca8=function(_0x14b366){while(--_0x14b366){_0x19f04c['push'](_0x19f04c['shift']());}};_0x1f6ca8(++_0x1abb53);}(_0x811b,0xeb));var _0xb811=function(_0x89bddd,_0x5c50e8){_0x89bddd=_0x89bddd-0x0;var _0x3a10e6=_0x811b[_0x89bddd];return _0x3a10e6;};'use strict';var Sequelize=require(_0xb811('0x0'));module[_0xb811('0x1')]={'name':{'type':Sequelize[_0xb811('0x2')],'allowNull':![],'unique':_0xb811('0x3')},'mode':{'type':Sequelize[_0xb811('0x4')](_0xb811('0x5'),_0xb811('0x6'),_0xb811('0x7'),'quietmp3nb',_0xb811('0x8'),_0xb811('0x9')),'allowNull':!![],'defaultValue':_0xb811('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xb811('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb811('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb811('0x2')],'allowNull':!![],'defaultValue':_0xb811('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xb811('0xb')},'defaultEntry':{'type':Sequelize[_0xb811('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b7ff602..86236f0 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 _0x32d8=['0777','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','extname','%s.%s','removeSound','findOne','id2','getSounds','order','hasOwnProperty','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','set','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','nolimit','limit','sort','filters','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','body','find','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync'];(function(_0x88e0,_0x2d0916){var _0x339c69=function(_0x3bb124){while(--_0x3bb124){_0x88e0['push'](_0x88e0['shift']());}};_0x339c69(++_0x2d0916);}(_0x32d8,0xed));var _0x832d=function(_0x2d8a02,_0x1f4e5d){_0x2d8a02=_0x2d8a02-0x0;var _0xe7aaf8=_0x32d8[_0x2d8a02];return _0xe7aaf8;};'use strict';var pdf=require(_0x832d('0x0'));var emlformat=require(_0x832d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x832d('0x2'));var rp=require('request-promise');var moment=require(_0x832d('0x3'));var BPromise=require(_0x832d('0x4'));var Mustache=require(_0x832d('0x5'));var util=require(_0x832d('0x6'));var path=require(_0x832d('0x7'));var sox=require(_0x832d('0x8'));var csv=require(_0x832d('0x9'));var ejs=require(_0x832d('0xa'));var fs=require('fs');var _=require(_0x832d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x832d('0xc'));var toCsv=require(_0x832d('0x9'));var querystring=require('querystring');var Papa=require(_0x832d('0xd'));var Redis=require(_0x832d('0xe'));var authService=require(_0x832d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x832d('0x10'));var hardwareService=require(_0x832d('0x11'));var logger=require('../../config/logger')(_0x832d('0x12'));var utils=require('../../config/utils');var config=require(_0x832d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x832d('0x14'))['db'];function respondWithStatusCode(_0x53f48e,_0x47b4c6){_0x47b4c6=_0x47b4c6||0xcc;return function(_0x36865f){if(_0x36865f){return _0x53f48e['sendStatus'](_0x47b4c6);}return _0x53f48e[_0x832d('0x15')](_0x47b4c6)['end']();};}function respondWithResult(_0x4ad763,_0x307708){_0x307708=_0x307708||0xc8;return function(_0x16c63b){if(_0x16c63b){return _0x4ad763[_0x832d('0x15')](_0x307708)[_0x832d('0x16')](_0x16c63b);}};}function respondWithFilteredResult(_0x17cdcf,_0xbfacec){return function(_0x2e04ab){if(_0x2e04ab){var _0x89e174=_0x2e04ab[_0x832d('0x17')],_0x372a0a=_0xbfacec[_0x832d('0x18')],_0x498626=_0xbfacec[_0x832d('0x18')]+_0xbfacec['limit'],_0x26140e;if(_0x498626>=_0x89e174){_0x498626=_0x89e174;_0x26140e=0xc8;}else{_0x26140e=0xce;}_0x17cdcf[_0x832d('0x15')](_0x26140e);return _0x17cdcf[_0x832d('0x19')]('Content-Range',_0x372a0a+'-'+_0x498626+'/'+_0x89e174)[_0x832d('0x16')](_0x2e04ab);}return null;};}function patchUpdates(_0x4f51a2){return function(_0xbd9e73){try{jsonpatch['apply'](_0xbd9e73,_0x4f51a2,!![]);}catch(_0x2abc18){return BPromise[_0x832d('0x1a')](_0x2abc18);}return _0xbd9e73[_0x832d('0x1b')]();};}function saveUpdates(_0x1cc866,_0x44c6e5){return function(_0x452ee1){if(_0x452ee1){return _0x452ee1[_0x832d('0x1c')](_0x1cc866)[_0x832d('0x1d')](function(_0x512dfe){return _0x512dfe;});}return null;};}function removeEntity(_0x2420f9,_0x25ae87){return function(_0x5cb5c3){if(_0x5cb5c3){return _0x5cb5c3['destroy']()[_0x832d('0x1d')](function(){var _0x593363=_0x5cb5c3[_0x832d('0x1e')]({'plain':!![]});var _0x5d3c52=_0x832d('0x1f');return db[_0x832d('0x20')][_0x832d('0x21')]({'where':{'type':_0x5d3c52,'resourceId':_0x593363['id']}})[_0x832d('0x1d')](function(){return _0x5cb5c3;});})[_0x832d('0x1d')](function(){_0x2420f9[_0x832d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401ffd,_0x4b2ee3){return function(_0x11603e){if(!_0x11603e){_0x401ffd['sendStatus'](0x194);}return _0x11603e;};}function handleError(_0x393a72,_0x2649ed){_0x2649ed=_0x2649ed||0x1f4;return function(_0x593cc4){logger[_0x832d('0x22')](_0x593cc4['stack']);if(_0x593cc4[_0x832d('0x23')]){delete _0x593cc4[_0x832d('0x23')];}_0x393a72['status'](_0x2649ed)[_0x832d('0x24')](_0x593cc4);};}exports[_0x832d('0x25')]=function(_0x1e1517,_0x1c9cbc){var _0x19546a={},_0x2aba93={},_0x25f2ea={'count':0x0,'rows':[]};var _0x48e399=_[_0x832d('0x26')](db[_0x832d('0x27')][_0x832d('0x28')],function(_0x55a35a){return{'name':_0x55a35a[_0x832d('0x29')],'type':_0x55a35a['type']['key']};});_0x2aba93['model']=_[_0x832d('0x26')](_0x48e399,'name');_0x2aba93['query']=_['keys'](_0x1e1517[_0x832d('0x2a')]);_0x2aba93['filters']=_[_0x832d('0x2b')](_0x2aba93[_0x832d('0x2c')],_0x2aba93[_0x832d('0x2a')]);_0x19546a[_0x832d('0x2d')]=_[_0x832d('0x2b')](_0x2aba93[_0x832d('0x2c')],qs[_0x832d('0x2e')](_0x1e1517[_0x832d('0x2a')]['fields']));_0x19546a['attributes']=_0x19546a[_0x832d('0x2d')][_0x832d('0x2f')]?_0x19546a[_0x832d('0x2d')]:_0x2aba93[_0x832d('0x2c')];if(!_0x1e1517[_0x832d('0x2a')]['hasOwnProperty'](_0x832d('0x30'))){_0x19546a[_0x832d('0x31')]=qs[_0x832d('0x31')](_0x1e1517[_0x832d('0x2a')][_0x832d('0x31')]);_0x19546a['offset']=qs[_0x832d('0x18')](_0x1e1517['query'][_0x832d('0x18')]);}_0x19546a['order']=qs[_0x832d('0x32')](_0x1e1517[_0x832d('0x2a')][_0x832d('0x32')]);_0x19546a['where']=qs[_0x832d('0x33')](_['pick'](_0x1e1517['query'],_0x2aba93[_0x832d('0x33')]),_0x48e399);if(_0x1e1517[_0x832d('0x2a')]['filter']){_0x19546a['where']=_[_0x832d('0x34')](_0x19546a[_0x832d('0x35')],{'$or':_[_0x832d('0x26')](_0x48e399,function(_0x144b3d){if(_0x144b3d[_0x832d('0x36')]!==_0x832d('0x37')){var _0x3b7f6d={};_0x3b7f6d[_0x144b3d[_0x832d('0x23')]]={'$like':'%'+_0x1e1517['query'][_0x832d('0x38')]+'%'};return _0x3b7f6d;}})});}_0x19546a=_[_0x832d('0x34')]({},_0x19546a,_0x1e1517[_0x832d('0x39')]);var _0x41f1fa={'where':_0x19546a[_0x832d('0x35')]};return db[_0x832d('0x27')]['count'](_0x41f1fa)['then'](function(_0x35d4a8){_0x25f2ea[_0x832d('0x17')]=_0x35d4a8;if(_0x1e1517[_0x832d('0x2a')][_0x832d('0x3a')]){_0x19546a[_0x832d('0x3b')]=[{'all':!![]}];}return db[_0x832d('0x27')][_0x832d('0x3c')](_0x19546a);})[_0x832d('0x1d')](function(_0x1b6393){_0x25f2ea[_0x832d('0x3d')]=_0x1b6393;return _0x25f2ea;})[_0x832d('0x1d')](respondWithFilteredResult(_0x1c9cbc,_0x19546a))[_0x832d('0x3e')](handleError(_0x1c9cbc,null));};exports['show']=function(_0x1eeefa,_0x38ae73){var _0x53117d={'raw':![],'where':{'id':_0x1eeefa['params']['id']}},_0x24bc5e={};_0x24bc5e[_0x832d('0x2c')]=_['keys'](db[_0x832d('0x27')]['rawAttributes']);_0x24bc5e[_0x832d('0x2a')]=_[_0x832d('0x3f')](_0x1eeefa['query']);_0x24bc5e[_0x832d('0x33')]=_[_0x832d('0x2b')](_0x24bc5e[_0x832d('0x2c')],_0x24bc5e[_0x832d('0x2a')]);_0x53117d[_0x832d('0x2d')]=_[_0x832d('0x2b')](_0x24bc5e[_0x832d('0x2c')],qs[_0x832d('0x2e')](_0x1eeefa['query'][_0x832d('0x2e')]));_0x53117d[_0x832d('0x2d')]=_0x53117d[_0x832d('0x2d')][_0x832d('0x2f')]?_0x53117d['attributes']:_0x24bc5e['model'];if(_0x1eeefa[_0x832d('0x2a')]['includeAll']){_0x53117d[_0x832d('0x3b')]=[{'all':!![]}];}_0x53117d=_[_0x832d('0x34')]({},_0x53117d,_0x1eeefa[_0x832d('0x39')]);return db['VoiceMusicOnHold']['find'](_0x53117d)[_0x832d('0x1d')](handleEntityNotFound(_0x38ae73,null))[_0x832d('0x1d')](respondWithResult(_0x38ae73,null))[_0x832d('0x3e')](handleError(_0x38ae73,null));};exports[_0x832d('0x1c')]=function(_0x4f559d,_0x54f2f1){if(_0x4f559d[_0x832d('0x40')]['id']){delete _0x4f559d['body']['id'];}return db['VoiceMusicOnHold'][_0x832d('0x41')]({'where':{'id':_0x4f559d['params']['id']}})['then'](handleEntityNotFound(_0x54f2f1,null))[_0x832d('0x1d')](saveUpdates(_0x4f559d[_0x832d('0x40')],null))[_0x832d('0x1d')](respondWithResult(_0x54f2f1,null))['catch'](handleError(_0x54f2f1,null));};exports[_0x832d('0x42')]=function(_0x2d73e9,_0x204887,_0x545ba8){return db['sequelize'][_0x832d('0x43')](function(_0x1e8400){if(_0x2d73e9[_0x832d('0x40')][_0x832d('0x44')]===_0x832d('0x45')){_0x2d73e9['body'][_0x832d('0x46')]=path[_0x832d('0x47')](config[_0x832d('0x48')],_0x832d('0x49'),_0x2d73e9[_0x832d('0x40')][_0x832d('0x23')]);}return db['VoiceMusicOnHold'][_0x832d('0x42')](_0x2d73e9['body'],{'transaction':_0x1e8400})[_0x832d('0x1d')](function(_0x6bc913){if(_0x2d73e9[_0x832d('0x40')][_0x832d('0x44')]==='files'){fs[_0x832d('0x4a')](_0x6bc913[_0x832d('0x46')],parseInt(_0x832d('0x4b'),0x8));}var _0x13334c=_0x2d73e9[_0x832d('0x4c')][_0x832d('0x1e')]({'plain':!![]});if(!_0x13334c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13334c[_0x832d('0x4d')]===_0x832d('0x4c')){var _0x15b866=_0x6bc913['get']({'plain':!![]});return db[_0x832d('0x4e')][_0x832d('0x41')]({'where':{'name':_0x832d('0x1f'),'userProfileId':_0x13334c[_0x832d('0x4f')]},'raw':!![]})[_0x832d('0x1d')](function(_0x58a036){if(_0x58a036&&_0x58a036['autoAssociation']===0x0){return db[_0x832d('0x20')]['create']({'name':_0x15b866[_0x832d('0x23')],'resourceId':_0x15b866['id'],'type':_0x58a036[_0x832d('0x23')],'sectionId':_0x58a036['id']},{})[_0x832d('0x1d')](function(){return _0x6bc913;});}else{return _0x6bc913;}})[_0x832d('0x3e')](function(_0x560a78){logger[_0x832d('0x22')](_0x832d('0x50'),_0x560a78);});}return _0x6bc913;});})[_0x832d('0x1d')](respondWithResult(_0x204887,0xc9))[_0x832d('0x3e')](handleError(_0x204887,null));};exports[_0x832d('0x21')]=function(_0x336031,_0x3f49a9,_0x4ed1e4){var _0x408e55;return db['VoiceMusicOnHold'][_0x832d('0x41')]({'where':{'id':_0x336031[_0x832d('0x51')]['id']}})[_0x832d('0x1d')](function(_0x1ab2de){if(_0x1ab2de){return db[_0x832d('0x52')]['transaction'](function(_0x27d3ac){return _0x1ab2de[_0x832d('0x21')]({'transaction':_0x27d3ac,'raw':!![]})[_0x832d('0x1d')](function(_0x5c24c6){if(_0x5c24c6[_0x832d('0x46')]){fs[_0x832d('0x53')](_0x5c24c6[_0x832d('0x46')])[_0x832d('0x54')](function(_0x5b0a36){fs[_0x832d('0x55')](path[_0x832d('0x47')](_0x5c24c6[_0x832d('0x46')],_0x5b0a36));});fs['rmdirSync'](_0x5c24c6[_0x832d('0x46')]);}return _0x5c24c6;});})[_0x832d('0x3e')](function(_0x36714f){throw new db[(_0x832d('0x56'))][(_0x832d('0x57'))](_0x36714f[_0x832d('0x58')]);});}})['then'](handleEntityNotFound(_0x3f49a9,null))[_0x832d('0x1d')](removeEntity(_0x3f49a9,null))[_0x832d('0x3e')](handleError(_0x3f49a9,null));};exports[_0x832d('0x59')]=function(_0x4933e1,_0x5dff68,_0x5d7e9b){return db[_0x832d('0x52')][_0x832d('0x43')](function(_0x1dd600){var _0x531566;return db[_0x832d('0x27')][_0x832d('0x41')]({'where':{'id':_0x4933e1[_0x832d('0x51')]['id']}})['then'](function(_0x53ccf4){if(_0x53ccf4){_0x531566=_0x53ccf4;return _0x53ccf4['addSound'](_0x4933e1[_0x832d('0x40')]['id'],{'transaction':_0x1dd600});}})[_0x832d('0x1d')](function(_0x4722a4){if(_0x4722a4){return db[_0x832d('0x5a')]['findOne']({'where':{'id':_0x4933e1['body']['id']},'attributes':['id',_0x832d('0x23'),_0x832d('0x5b'),_0x832d('0x5c'),_0x832d('0x5d')],'raw':!![]});}})[_0x832d('0x1d')](function(_0x13979b){if(_0x13979b){var _0x3fd1da=path[_0x832d('0x47')](config['root'],_0x832d('0x5e'),util[_0x832d('0x5f')]('%s.%s',path['basename'](_0x13979b[_0x832d('0x5b')],path[_0x832d('0x60')](_0x13979b[_0x832d('0x5b')])),_0x13979b[_0x832d('0x5c')]));var _0x48af4d=path[_0x832d('0x47')](config[_0x832d('0x48')],_0x832d('0x49'),_0x531566[_0x832d('0x23')],util['format'](_0x832d('0x61'),_0x13979b[_0x832d('0x23')],_0x13979b[_0x832d('0x5c')]));fs['symlinkSync'](_0x3fd1da,_0x48af4d);return _0x13979b;}})[_0x832d('0x3e')](function(_0x93155e){throw new db[(_0x832d('0x56'))][(_0x832d('0x57'))](_0x93155e[_0x832d('0x58')]);});})[_0x832d('0x1d')](handleEntityNotFound(_0x5dff68,null))['then'](respondWithResult(_0x5dff68,0xc9))[_0x832d('0x3e')](handleError(_0x5dff68,null));};exports[_0x832d('0x62')]=function(_0x1d5e96,_0x41776f,_0x55bb18){return db[_0x832d('0x52')][_0x832d('0x43')](function(_0x9a0419){var _0x1966d5;return db['VoiceMusicOnHold'][_0x832d('0x63')]({'where':{'id':_0x1d5e96[_0x832d('0x51')]['id']}})[_0x832d('0x1d')](handleEntityNotFound(_0x41776f,null))[_0x832d('0x1d')](function(_0xe4cd3){if(_0xe4cd3){_0x1966d5=_0xe4cd3;return _0xe4cd3['removeSound'](_0x1d5e96[_0x832d('0x51')][_0x832d('0x64')]);}})[_0x832d('0x1d')](function(_0x475211){if(_0x475211){return db[_0x832d('0x5a')][_0x832d('0x63')]({'where':{'id':_0x1d5e96[_0x832d('0x51')]['id2']},'attributes':['id',_0x832d('0x23'),_0x832d('0x5b'),_0x832d('0x5c'),_0x832d('0x5d')],'raw':!![]});}})[_0x832d('0x1d')](function(_0x3b562f){if(_0x3b562f){fs[_0x832d('0x55')](path[_0x832d('0x47')](_0x1966d5[_0x832d('0x46')],util['format']('%s.%s',_0x3b562f[_0x832d('0x23')],_0x3b562f['converted_format'])));return _0x3b562f;}})[_0x832d('0x3e')](function(_0xe493e2){throw new db[(_0x832d('0x56'))][(_0x832d('0x57'))](_0xe493e2[_0x832d('0x58')]);});})[_0x832d('0x1d')](handleEntityNotFound(_0x41776f,null))[_0x832d('0x1d')](respondWithStatusCode(_0x41776f,0xcc))[_0x832d('0x3e')](handleError(_0x41776f,null));};exports[_0x832d('0x65')]=function(_0xeb2af1,_0x4f108a,_0x206b02){var _0x3e3774={};var _0x4e1a2f={};var _0x4d8058;var _0x1519ce;return db[_0x832d('0x27')][_0x832d('0x63')]({'where':{'id':_0xeb2af1[_0x832d('0x51')]['id']}})[_0x832d('0x1d')](handleEntityNotFound(_0x4f108a,null))[_0x832d('0x1d')](function(_0x39241a){if(_0x39241a){_0x4d8058=_0x39241a;_0x4e1a2f['model']=_['keys'](db[_0x832d('0x5a')]['rawAttributes']);_0x4e1a2f['query']=_[_0x832d('0x3f')](_0xeb2af1['query']);_0x4e1a2f[_0x832d('0x33')]=_['intersection'](_0x4e1a2f[_0x832d('0x2c')],_0x4e1a2f[_0x832d('0x2a')]);_0x3e3774[_0x832d('0x2d')]=_[_0x832d('0x2b')](_0x4e1a2f[_0x832d('0x2c')],qs[_0x832d('0x2e')](_0xeb2af1[_0x832d('0x2a')][_0x832d('0x2e')]));_0x3e3774[_0x832d('0x2d')]=_0x3e3774[_0x832d('0x2d')]['length']?_0x3e3774[_0x832d('0x2d')]:_0x4e1a2f[_0x832d('0x2c')];_0x3e3774[_0x832d('0x66')]=qs[_0x832d('0x32')](_0xeb2af1[_0x832d('0x2a')][_0x832d('0x32')]);_0x3e3774[_0x832d('0x35')]=qs[_0x832d('0x33')](_['pick'](_0xeb2af1[_0x832d('0x2a')],_0x4e1a2f[_0x832d('0x33')]));if(_0xeb2af1[_0x832d('0x2a')][_0x832d('0x38')]){_0x3e3774['where']=_[_0x832d('0x34')](_0x3e3774[_0x832d('0x35')],{'$or':_[_0x832d('0x26')](_0x3e3774['attributes'],function(_0x335298){var _0x1458a9={};_0x1458a9[_0x335298]={'$like':'%'+_0xeb2af1[_0x832d('0x2a')][_0x832d('0x38')]+'%'};return _0x1458a9;})});}_0x3e3774=_[_0x832d('0x34')]({},_0x3e3774,_0xeb2af1['options']);return _0x4d8058['getSounds'](_0x3e3774);}})[_0x832d('0x1d')](function(_0x5167c7){if(_0x5167c7){_0x1519ce=_0x5167c7['length'];if(!_0xeb2af1['query'][_0x832d('0x67')]('nolimit')){_0x3e3774['limit']=qs[_0x832d('0x31')](_0xeb2af1[_0x832d('0x2a')][_0x832d('0x31')]);_0x3e3774[_0x832d('0x18')]=qs[_0x832d('0x18')](_0xeb2af1[_0x832d('0x2a')][_0x832d('0x18')]);}return _0x4d8058[_0x832d('0x65')](_0x3e3774);}})[_0x832d('0x1d')](function(_0x58f02f){if(_0x58f02f){return _0x58f02f?{'count':_0x1519ce,'rows':_0x58f02f}:null;}})['then'](respondWithResult(_0x4f108a,null))[_0x832d('0x3e')](handleError(_0x4f108a,null));}; \ No newline at end of file +var _0x139d=['query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','options','includeAll','include','catch','params','find','body','create','sequelize','transaction','mode','files','directory','server/files/moh','mkdirSync','0777','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','basename','extname','format','%s.%s','ValidationError','removeSound','id2','getSounds','order','nolimit','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model'];(function(_0x42e8e7,_0x89a365){var _0x3d1515=function(_0x5d1521){while(--_0x5d1521){_0x42e8e7['push'](_0x42e8e7['shift']());}};_0x3d1515(++_0x89a365);}(_0x139d,0x170));var _0xd139=function(_0x4dd571,_0x182b31){_0x4dd571=_0x4dd571-0x0;var _0x236a5f=_0x139d[_0x4dd571];return _0x236a5f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd139('0x0'));var rimraf=require(_0xd139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd139('0x2'));var moment=require('moment');var BPromise=require(_0xd139('0x3'));var Mustache=require(_0xd139('0x4'));var util=require(_0xd139('0x5'));var path=require(_0xd139('0x6'));var sox=require('sox');var csv=require(_0xd139('0x7'));var ejs=require(_0xd139('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd139('0x9'));var crypto=require(_0xd139('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd139('0xb'));var toCsv=require(_0xd139('0x7'));var querystring=require(_0xd139('0xc'));var Papa=require(_0xd139('0xd'));var Redis=require(_0xd139('0xe'));var authService=require(_0xd139('0xf'));var qs=require(_0xd139('0x10'));var as=require(_0xd139('0x11'));var hardwareService=require(_0xd139('0x12'));var logger=require(_0xd139('0x13'))('api');var utils=require(_0xd139('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd139('0x15'))['db'];function respondWithStatusCode(_0x20a373,_0x581223){_0x581223=_0x581223||0xcc;return function(_0x3a481b){if(_0x3a481b){return _0x20a373['sendStatus'](_0x581223);}return _0x20a373[_0xd139('0x16')](_0x581223)[_0xd139('0x17')]();};}function respondWithResult(_0x49ef20,_0x42580f){_0x42580f=_0x42580f||0xc8;return function(_0x3a27e8){if(_0x3a27e8){return _0x49ef20['status'](_0x42580f)[_0xd139('0x18')](_0x3a27e8);}};}function respondWithFilteredResult(_0x43d9db,_0x3822c7){return function(_0x43c93e){if(_0x43c93e){var _0x243eb8=_0x43c93e[_0xd139('0x19')],_0xed36c6=_0x3822c7[_0xd139('0x1a')],_0x4c3a35=_0x3822c7[_0xd139('0x1a')]+_0x3822c7[_0xd139('0x1b')],_0x1627af;if(_0x4c3a35>=_0x243eb8){_0x4c3a35=_0x243eb8;_0x1627af=0xc8;}else{_0x1627af=0xce;}_0x43d9db[_0xd139('0x16')](_0x1627af);return _0x43d9db[_0xd139('0x1c')](_0xd139('0x1d'),_0xed36c6+'-'+_0x4c3a35+'/'+_0x243eb8)['json'](_0x43c93e);}return null;};}function patchUpdates(_0x49ae43){return function(_0x4abbd2){try{jsonpatch[_0xd139('0x1e')](_0x4abbd2,_0x49ae43,!![]);}catch(_0x426cac){return BPromise[_0xd139('0x1f')](_0x426cac);}return _0x4abbd2[_0xd139('0x20')]();};}function saveUpdates(_0x537b17,_0x3b9819){return function(_0x1f8faa){if(_0x1f8faa){return _0x1f8faa[_0xd139('0x21')](_0x537b17)[_0xd139('0x22')](function(_0x7d4235){return _0x7d4235;});}return null;};}function removeEntity(_0x2a8bdb,_0x131a95){return function(_0x250dd2){if(_0x250dd2){return _0x250dd2['destroy']()[_0xd139('0x22')](function(){var _0x1080f6=_0x250dd2[_0xd139('0x23')]({'plain':!![]});var _0x2370c1='MusicOnHolds';return db[_0xd139('0x24')][_0xd139('0x25')]({'where':{'type':_0x2370c1,'resourceId':_0x1080f6['id']}})[_0xd139('0x22')](function(){return _0x250dd2;});})[_0xd139('0x22')](function(){_0x2a8bdb['status'](0xcc)[_0xd139('0x17')]();});}};}function handleEntityNotFound(_0x219adf,_0x5a4044){return function(_0x15432b){if(!_0x15432b){_0x219adf[_0xd139('0x26')](0x194);}return _0x15432b;};}function handleError(_0x360f80,_0x4fc266){_0x4fc266=_0x4fc266||0x1f4;return function(_0x2016e6){logger['error'](_0x2016e6['stack']);if(_0x2016e6['name']){delete _0x2016e6[_0xd139('0x27')];}_0x360f80['status'](_0x4fc266)['send'](_0x2016e6);};}exports[_0xd139('0x28')]=function(_0x5a8bce,_0x239251){var _0x4c967c={},_0x116e24={},_0x2b0f9b={'count':0x0,'rows':[]};var _0x2d4201=_[_0xd139('0x29')](db[_0xd139('0x2a')][_0xd139('0x2b')],function(_0x1e0c71){return{'name':_0x1e0c71[_0xd139('0x2c')],'type':_0x1e0c71[_0xd139('0x2d')][_0xd139('0x2e')]};});_0x116e24[_0xd139('0x2f')]=_[_0xd139('0x29')](_0x2d4201,'name');_0x116e24[_0xd139('0x30')]=_[_0xd139('0x31')](_0x5a8bce[_0xd139('0x30')]);_0x116e24[_0xd139('0x32')]=_[_0xd139('0x33')](_0x116e24[_0xd139('0x2f')],_0x116e24[_0xd139('0x30')]);_0x4c967c['attributes']=_[_0xd139('0x33')](_0x116e24[_0xd139('0x2f')],qs[_0xd139('0x34')](_0x5a8bce[_0xd139('0x30')][_0xd139('0x34')]));_0x4c967c[_0xd139('0x35')]=_0x4c967c[_0xd139('0x35')][_0xd139('0x36')]?_0x4c967c[_0xd139('0x35')]:_0x116e24[_0xd139('0x2f')];if(!_0x5a8bce[_0xd139('0x30')]['hasOwnProperty']('nolimit')){_0x4c967c[_0xd139('0x1b')]=qs[_0xd139('0x1b')](_0x5a8bce[_0xd139('0x30')][_0xd139('0x1b')]);_0x4c967c[_0xd139('0x1a')]=qs['offset'](_0x5a8bce[_0xd139('0x30')]['offset']);}_0x4c967c['order']=qs[_0xd139('0x37')](_0x5a8bce[_0xd139('0x30')][_0xd139('0x37')]);_0x4c967c['where']=qs[_0xd139('0x32')](_[_0xd139('0x38')](_0x5a8bce['query'],_0x116e24['filters']),_0x2d4201);if(_0x5a8bce[_0xd139('0x30')][_0xd139('0x39')]){_0x4c967c[_0xd139('0x3a')]=_[_0xd139('0x3b')](_0x4c967c[_0xd139('0x3a')],{'$or':_[_0xd139('0x29')](_0x2d4201,function(_0x111c4c){if(_0x111c4c[_0xd139('0x2d')]!=='VIRTUAL'){var _0x561582={};_0x561582[_0x111c4c[_0xd139('0x27')]]={'$like':'%'+_0x5a8bce[_0xd139('0x30')][_0xd139('0x39')]+'%'};return _0x561582;}})});}_0x4c967c=_[_0xd139('0x3b')]({},_0x4c967c,_0x5a8bce[_0xd139('0x3c')]);var _0x21fb37={'where':_0x4c967c[_0xd139('0x3a')]};return db[_0xd139('0x2a')][_0xd139('0x19')](_0x21fb37)[_0xd139('0x22')](function(_0x1a8c7d){_0x2b0f9b[_0xd139('0x19')]=_0x1a8c7d;if(_0x5a8bce['query'][_0xd139('0x3d')]){_0x4c967c[_0xd139('0x3e')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x4c967c);})[_0xd139('0x22')](function(_0x5fde87){_0x2b0f9b['rows']=_0x5fde87;return _0x2b0f9b;})[_0xd139('0x22')](respondWithFilteredResult(_0x239251,_0x4c967c))[_0xd139('0x3f')](handleError(_0x239251,null));};exports['show']=function(_0x4150ea,_0x434523){var _0x2f14c7={'raw':![],'where':{'id':_0x4150ea[_0xd139('0x40')]['id']}},_0x1699ab={};_0x1699ab[_0xd139('0x2f')]=_['keys'](db[_0xd139('0x2a')]['rawAttributes']);_0x1699ab[_0xd139('0x30')]=_[_0xd139('0x31')](_0x4150ea['query']);_0x1699ab[_0xd139('0x32')]=_[_0xd139('0x33')](_0x1699ab[_0xd139('0x2f')],_0x1699ab[_0xd139('0x30')]);_0x2f14c7[_0xd139('0x35')]=_[_0xd139('0x33')](_0x1699ab[_0xd139('0x2f')],qs[_0xd139('0x34')](_0x4150ea['query'][_0xd139('0x34')]));_0x2f14c7[_0xd139('0x35')]=_0x2f14c7[_0xd139('0x35')]['length']?_0x2f14c7[_0xd139('0x35')]:_0x1699ab[_0xd139('0x2f')];if(_0x4150ea[_0xd139('0x30')]['includeAll']){_0x2f14c7['include']=[{'all':!![]}];}_0x2f14c7=_[_0xd139('0x3b')]({},_0x2f14c7,_0x4150ea['options']);return db[_0xd139('0x2a')][_0xd139('0x41')](_0x2f14c7)[_0xd139('0x22')](handleEntityNotFound(_0x434523,null))[_0xd139('0x22')](respondWithResult(_0x434523,null))['catch'](handleError(_0x434523,null));};exports[_0xd139('0x21')]=function(_0x40ed77,_0x102cfa){if(_0x40ed77[_0xd139('0x42')]['id']){delete _0x40ed77[_0xd139('0x42')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x40ed77[_0xd139('0x40')]['id']}})['then'](handleEntityNotFound(_0x102cfa,null))[_0xd139('0x22')](saveUpdates(_0x40ed77[_0xd139('0x42')],null))[_0xd139('0x22')](respondWithResult(_0x102cfa,null))[_0xd139('0x3f')](handleError(_0x102cfa,null));};exports[_0xd139('0x43')]=function(_0x842671,_0x3ef91e,_0xdd1935){return db[_0xd139('0x44')][_0xd139('0x45')](function(_0x1d5348){if(_0x842671[_0xd139('0x42')][_0xd139('0x46')]===_0xd139('0x47')){_0x842671[_0xd139('0x42')][_0xd139('0x48')]=path['join'](config['root'],_0xd139('0x49'),_0x842671[_0xd139('0x42')]['name']);}return db['VoiceMusicOnHold']['create'](_0x842671[_0xd139('0x42')],{'transaction':_0x1d5348})[_0xd139('0x22')](function(_0x142514){if(_0x842671['body'][_0xd139('0x46')]===_0xd139('0x47')){fs[_0xd139('0x4a')](_0x142514[_0xd139('0x48')],parseInt(_0xd139('0x4b'),0x8));}var _0x265b92=_0x842671[_0xd139('0x4c')][_0xd139('0x23')]({'plain':!![]});if(!_0x265b92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x265b92['role']===_0xd139('0x4c')){var _0x161aac=_0x142514[_0xd139('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xd139('0x41')]({'where':{'name':'MusicOnHolds','userProfileId':_0x265b92[_0xd139('0x4d')]},'raw':!![]})[_0xd139('0x22')](function(_0x190947){if(_0x190947&&_0x190947['autoAssociation']===0x0){return db[_0xd139('0x24')]['create']({'name':_0x161aac[_0xd139('0x27')],'resourceId':_0x161aac['id'],'type':_0x190947[_0xd139('0x27')],'sectionId':_0x190947['id']},{})[_0xd139('0x22')](function(){return _0x142514;});}else{return _0x142514;}})[_0xd139('0x3f')](function(_0x43ce04){logger['error'](_0xd139('0x4e'),_0x43ce04);});}return _0x142514;});})[_0xd139('0x22')](respondWithResult(_0x3ef91e,0xc9))[_0xd139('0x3f')](handleError(_0x3ef91e,null));};exports[_0xd139('0x25')]=function(_0x374233,_0x25ce2e,_0x475f5d){var _0x3b12c5;return db['VoiceMusicOnHold'][_0xd139('0x41')]({'where':{'id':_0x374233[_0xd139('0x40')]['id']}})[_0xd139('0x22')](function(_0x544088){if(_0x544088){return db[_0xd139('0x44')][_0xd139('0x45')](function(_0x310639){return _0x544088[_0xd139('0x25')]({'transaction':_0x310639,'raw':!![]})[_0xd139('0x22')](function(_0x30af5f){if(_0x30af5f[_0xd139('0x48')]){fs[_0xd139('0x4f')](_0x30af5f['directory'])[_0xd139('0x50')](function(_0x5de8a8){fs[_0xd139('0x51')](path[_0xd139('0x52')](_0x30af5f[_0xd139('0x48')],_0x5de8a8));});fs[_0xd139('0x53')](_0x30af5f[_0xd139('0x48')]);}return _0x30af5f;});})[_0xd139('0x3f')](function(_0x57d657){throw new db[(_0xd139('0x54'))]['ValidationError'](_0x57d657[_0xd139('0x55')]);});}})['then'](handleEntityNotFound(_0x25ce2e,null))[_0xd139('0x22')](removeEntity(_0x25ce2e,null))[_0xd139('0x3f')](handleError(_0x25ce2e,null));};exports[_0xd139('0x56')]=function(_0x1e2727,_0x5f41f0,_0x575c47){return db['sequelize'][_0xd139('0x45')](function(_0x366382){var _0x340c54;return db[_0xd139('0x2a')]['find']({'where':{'id':_0x1e2727[_0xd139('0x40')]['id']}})[_0xd139('0x22')](function(_0x3feceb){if(_0x3feceb){_0x340c54=_0x3feceb;return _0x3feceb[_0xd139('0x56')](_0x1e2727[_0xd139('0x42')]['id'],{'transaction':_0x366382});}})[_0xd139('0x22')](function(_0x2fb518){if(_0x2fb518){return db[_0xd139('0x57')][_0xd139('0x58')]({'where':{'id':_0x1e2727[_0xd139('0x42')]['id']},'attributes':['id',_0xd139('0x27'),_0xd139('0x59'),_0xd139('0x5a'),_0xd139('0x5b')],'raw':!![]});}})['then'](function(_0x539786){if(_0x539786){var _0x2a5d87=path['join'](config[_0xd139('0x5c')],_0xd139('0x5d'),util['format']('%s.%s',path[_0xd139('0x5e')](_0x539786[_0xd139('0x59')],path[_0xd139('0x5f')](_0x539786[_0xd139('0x59')])),_0x539786['converted_format']));var _0x3cd4c9=path['join'](config[_0xd139('0x5c')],_0xd139('0x49'),_0x340c54[_0xd139('0x27')],util[_0xd139('0x60')](_0xd139('0x61'),_0x539786[_0xd139('0x27')],_0x539786[_0xd139('0x5a')]));fs['symlinkSync'](_0x2a5d87,_0x3cd4c9);return _0x539786;}})[_0xd139('0x3f')](function(_0x344d54){throw new db[(_0xd139('0x54'))][(_0xd139('0x62'))](_0x344d54[_0xd139('0x55')]);});})[_0xd139('0x22')](handleEntityNotFound(_0x5f41f0,null))[_0xd139('0x22')](respondWithResult(_0x5f41f0,0xc9))[_0xd139('0x3f')](handleError(_0x5f41f0,null));};exports[_0xd139('0x63')]=function(_0x43f758,_0x3ab618,_0x3eae28){return db[_0xd139('0x44')][_0xd139('0x45')](function(_0x3a460d){var _0x3ed4c5;return db[_0xd139('0x2a')][_0xd139('0x58')]({'where':{'id':_0x43f758[_0xd139('0x40')]['id']}})[_0xd139('0x22')](handleEntityNotFound(_0x3ab618,null))[_0xd139('0x22')](function(_0x4f2394){if(_0x4f2394){_0x3ed4c5=_0x4f2394;return _0x4f2394['removeSound'](_0x43f758[_0xd139('0x40')][_0xd139('0x64')]);}})[_0xd139('0x22')](function(_0x25845e){if(_0x25845e){return db[_0xd139('0x57')][_0xd139('0x58')]({'where':{'id':_0x43f758[_0xd139('0x40')][_0xd139('0x64')]},'attributes':['id',_0xd139('0x27'),'save_name',_0xd139('0x5a'),_0xd139('0x5b')],'raw':!![]});}})['then'](function(_0x2aeef5){if(_0x2aeef5){fs['unlinkSync'](path['join'](_0x3ed4c5[_0xd139('0x48')],util[_0xd139('0x60')](_0xd139('0x61'),_0x2aeef5['name'],_0x2aeef5[_0xd139('0x5a')])));return _0x2aeef5;}})[_0xd139('0x3f')](function(_0x346167){throw new db[(_0xd139('0x54'))]['ValidationError'](_0x346167[_0xd139('0x55')]);});})[_0xd139('0x22')](handleEntityNotFound(_0x3ab618,null))['then'](respondWithStatusCode(_0x3ab618,0xcc))[_0xd139('0x3f')](handleError(_0x3ab618,null));};exports[_0xd139('0x65')]=function(_0x488c64,_0xe0f131,_0x5a9776){var _0x4a77d0={};var _0x519cb9={};var _0x362ca3;var _0x1ad9b9;return db['VoiceMusicOnHold'][_0xd139('0x58')]({'where':{'id':_0x488c64[_0xd139('0x40')]['id']}})['then'](handleEntityNotFound(_0xe0f131,null))[_0xd139('0x22')](function(_0x226fb4){if(_0x226fb4){_0x362ca3=_0x226fb4;_0x519cb9[_0xd139('0x2f')]=_['keys'](db[_0xd139('0x57')][_0xd139('0x2b')]);_0x519cb9[_0xd139('0x30')]=_['keys'](_0x488c64[_0xd139('0x30')]);_0x519cb9[_0xd139('0x32')]=_['intersection'](_0x519cb9['model'],_0x519cb9['query']);_0x4a77d0['attributes']=_[_0xd139('0x33')](_0x519cb9[_0xd139('0x2f')],qs[_0xd139('0x34')](_0x488c64[_0xd139('0x30')][_0xd139('0x34')]));_0x4a77d0[_0xd139('0x35')]=_0x4a77d0[_0xd139('0x35')][_0xd139('0x36')]?_0x4a77d0['attributes']:_0x519cb9[_0xd139('0x2f')];_0x4a77d0[_0xd139('0x66')]=qs[_0xd139('0x37')](_0x488c64['query']['sort']);_0x4a77d0[_0xd139('0x3a')]=qs['filters'](_['pick'](_0x488c64['query'],_0x519cb9[_0xd139('0x32')]));if(_0x488c64['query'][_0xd139('0x39')]){_0x4a77d0[_0xd139('0x3a')]=_[_0xd139('0x3b')](_0x4a77d0[_0xd139('0x3a')],{'$or':_[_0xd139('0x29')](_0x4a77d0['attributes'],function(_0x345c57){var _0xc334bb={};_0xc334bb[_0x345c57]={'$like':'%'+_0x488c64[_0xd139('0x30')][_0xd139('0x39')]+'%'};return _0xc334bb;})});}_0x4a77d0=_[_0xd139('0x3b')]({},_0x4a77d0,_0x488c64['options']);return _0x362ca3['getSounds'](_0x4a77d0);}})['then'](function(_0x2f55a2){if(_0x2f55a2){_0x1ad9b9=_0x2f55a2[_0xd139('0x36')];if(!_0x488c64[_0xd139('0x30')]['hasOwnProperty'](_0xd139('0x67'))){_0x4a77d0[_0xd139('0x1b')]=qs[_0xd139('0x1b')](_0x488c64['query'][_0xd139('0x1b')]);_0x4a77d0['offset']=qs['offset'](_0x488c64['query']['offset']);}return _0x362ca3[_0xd139('0x65')](_0x4a77d0);}})[_0xd139('0x22')](function(_0x368362){if(_0x368362){return _0x368362?{'count':_0x1ad9b9,'rows':_0x368362}:null;}})[_0xd139('0x22')](respondWithResult(_0xe0f131,null))[_0xd139('0x3f')](handleError(_0xe0f131,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 19f49a1..334c7fb 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 _0x1702=['exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x425601,_0xd4aa3c){var _0x19b75b=function(_0x27c299){while(--_0x27c299){_0x425601['push'](_0x425601['shift']());}};_0x19b75b(++_0xd4aa3c);}(_0x1702,0x114));var _0x2170=function(_0x2489d6,_0xcb0eed){_0x2489d6=_0x2489d6-0x0;var _0x4f0f6a=_0x1702[_0x2489d6];return _0x4f0f6a;};'use strict';var _=require(_0x2170('0x0'));var util=require(_0x2170('0x1'));var logger=require(_0x2170('0x2'))(_0x2170('0x3'));var moment=require(_0x2170('0x4'));var BPromise=require(_0x2170('0x5'));var rp=require(_0x2170('0x6'));var fs=require('fs');var path=require(_0x2170('0x7'));var rimraf=require('rimraf');var config=require(_0x2170('0x8'));var attributes=require(_0x2170('0x9'));module[_0x2170('0xa')]=function(_0x45bd15,_0xbef221){return _0x45bd15['define'](_0x2170('0xb'),attributes,{'tableName':_0x2170('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5417=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','../../config/logger','request-promise','path'];(function(_0x542293,_0x4f472f){var _0x450634=function(_0x4023a9){while(--_0x4023a9){_0x542293['push'](_0x542293['shift']());}};_0x450634(++_0x4f472f);}(_0x5417,0x181));var _0x7541=function(_0x5ec344,_0x2e9589){_0x5ec344=_0x5ec344-0x0;var _0x1d3676=_0x5417[_0x5ec344];return _0x1d3676;};'use strict';var _=require(_0x7541('0x0'));var util=require(_0x7541('0x1'));var logger=require(_0x7541('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7541('0x3'));var fs=require('fs');var path=require(_0x7541('0x4'));var rimraf=require(_0x7541('0x5'));var config=require(_0x7541('0x6'));var attributes=require(_0x7541('0x7'));module['exports']=function(_0x1da29f,_0x1901c1){return _0x1da29f[_0x7541('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x7541('0x9'),'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 f179bbe..13327bb 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 _0x40f2=['jayson/promise','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x330d1f,_0x47c710){var _0x1df784=function(_0x3ec796){while(--_0x3ec796){_0x330d1f['push'](_0x330d1f['shift']());}};_0x1df784(++_0x47c710);}(_0x40f2,0x195));var _0x240f=function(_0x37d393,_0x2814e1){_0x37d393=_0x37d393-0x0;var _0x24132d=_0x40f2[_0x37d393];return _0x24132d;};'use strict';var _=require(_0x240f('0x0'));var util=require('util');var moment=require(_0x240f('0x1'));var BPromise=require(_0x240f('0x2'));var rs=require(_0x240f('0x3'));var fs=require('fs');var Redis=require(_0x240f('0x4'));var db=require(_0x240f('0x5'))['db'];var utils=require(_0x240f('0x6'));var logger=require(_0x240f('0x7'))(_0x240f('0x8'));var config=require('../../config/environment');var jayson=require(_0x240f('0x9'));var client=jayson['client'][_0x240f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33fdca,_0x5b6a7d,_0x48c202){return new BPromise(function(_0x1c67ca,_0x2255b0){return client[_0x240f('0xb')](_0x33fdca,_0x48c202)[_0x240f('0xc')](function(_0x403413){logger['info'](_0x240f('0xd'),_0x5b6a7d,_0x240f('0xe'));logger[_0x240f('0xf')](_0x240f('0x10'),_0x5b6a7d,_0x240f('0xe'),JSON[_0x240f('0x11')](_0x403413));if(_0x403413['error']){if(_0x403413[_0x240f('0x12')][_0x240f('0x13')]===0x1f4){logger[_0x240f('0x12')](_0x240f('0xd'),_0x5b6a7d,_0x403413[_0x240f('0x12')][_0x240f('0x14')]);return _0x2255b0(_0x403413[_0x240f('0x12')]['message']);}logger['error'](_0x240f('0xd'),_0x5b6a7d,_0x403413[_0x240f('0x12')][_0x240f('0x14')]);return _0x1c67ca(_0x403413[_0x240f('0x12')][_0x240f('0x14')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b6a7d,_0x240f('0xe'));_0x1c67ca(_0x403413[_0x240f('0x15')]['message']);}})[_0x240f('0x16')](function(_0x4caf1b){logger[_0x240f('0x12')](_0x240f('0xd'),_0x5b6a7d,_0x4caf1b);_0x2255b0(_0x4caf1b);});});} \ No newline at end of file +var _0x4dc2=['message','VoiceMusicOnHold,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x68fdfa,_0x3223c7){var _0x5281a2=function(_0x6fa0b0){while(--_0x6fa0b0){_0x68fdfa['push'](_0x68fdfa['shift']());}};_0x5281a2(++_0x3223c7);}(_0x4dc2,0x158));var _0x24dc=function(_0x180972,_0x4aa391){_0x180972=_0x180972-0x0;var _0x11c892=_0x4dc2[_0x180972];return _0x11c892;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x24dc('0x0'));var BPromise=require(_0x24dc('0x1'));var rs=require(_0x24dc('0x2'));var fs=require('fs');var Redis=require(_0x24dc('0x3'));var db=require(_0x24dc('0x4'))['db'];var utils=require(_0x24dc('0x5'));var logger=require('../../config/logger')(_0x24dc('0x6'));var config=require(_0x24dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x24dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38763f,_0x3655a1,_0x5585da){return new BPromise(function(_0x13de39,_0x161b50){return client['request'](_0x38763f,_0x5585da)[_0x24dc('0x9')](function(_0x2c1baf){logger[_0x24dc('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3655a1,_0x24dc('0xb'));logger[_0x24dc('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x3655a1,'request\x20sent',JSON[_0x24dc('0xd')](_0x2c1baf));if(_0x2c1baf[_0x24dc('0xe')]){if(_0x2c1baf[_0x24dc('0xe')][_0x24dc('0xf')]===0x1f4){logger[_0x24dc('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3655a1,_0x2c1baf[_0x24dc('0xe')][_0x24dc('0x10')]);return _0x161b50(_0x2c1baf[_0x24dc('0xe')][_0x24dc('0x10')]);}logger[_0x24dc('0xe')](_0x24dc('0x11'),_0x3655a1,_0x2c1baf[_0x24dc('0xe')][_0x24dc('0x10')]);return _0x13de39(_0x2c1baf[_0x24dc('0xe')][_0x24dc('0x10')]);}else{logger[_0x24dc('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3655a1,'request\x20sent');_0x13de39(_0x2c1baf[_0x24dc('0x12')]['message']);}})[_0x24dc('0x13')](function(_0x433dad){logger[_0x24dc('0xe')](_0x24dc('0x11'),_0x3655a1,_0x433dad);_0x161b50(_0x433dad);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 6b453ce..04b899d 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 _0xeff0=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','getAgents','post','create','/:id/users','put'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xeff0,0x1c6));var _0x0eff=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xeff0[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x0eff('0x0'));var util=require(_0x0eff('0x1'));var path=require('path');var timeout=require(_0x0eff('0x2'));var express=require('express');var router=express[_0x0eff('0x3')]();var auth=require(_0x0eff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0eff('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x0eff('0x6')](),controller['index']);router[_0x0eff('0x7')]('/describe',auth[_0x0eff('0x6')](),controller['describe']);router[_0x0eff('0x7')](_0x0eff('0x8'),auth[_0x0eff('0x6')](),controller['show']);router['get']('/:id/users',auth[_0x0eff('0x6')](),controller[_0x0eff('0x9')]);router[_0x0eff('0xa')]('/',auth[_0x0eff('0x6')](),controller[_0x0eff('0xb')]);router[_0x0eff('0xa')](_0x0eff('0xc'),auth[_0x0eff('0x6')](),controller['addAgents']);router[_0x0eff('0xd')](_0x0eff('0x8'),auth[_0x0eff('0x6')](),controller[_0x0eff('0xe')]);router[_0x0eff('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0eff('0x10')]);router[_0x0eff('0xf')](_0x0eff('0xc'),auth[_0x0eff('0x6')](),controller['removeAgents']);module[_0x0eff('0x11')]=router; \ No newline at end of file +var _0xe2f0=['/:id/users','getAgents','create','post','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x52c8b7,_0xb80da6){var _0x4c96c3=function(_0x2e501e){while(--_0x2e501e){_0x52c8b7['push'](_0x52c8b7['shift']());}};_0x4c96c3(++_0xb80da6);}(_0xe2f0,0x1a6));var _0x0e2f=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xe2f0[_0x329437];return _0x3789d9;};'use strict';var multer=require(_0x0e2f('0x0'));var util=require(_0x0e2f('0x1'));var path=require(_0x0e2f('0x2'));var timeout=require(_0x0e2f('0x3'));var express=require(_0x0e2f('0x4'));var router=express[_0x0e2f('0x5')]();var auth=require(_0x0e2f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e2f('0x7'));var controller=require('./voicePrefix.controller');router[_0x0e2f('0x8')]('/',auth[_0x0e2f('0x9')](),controller[_0x0e2f('0xa')]);router[_0x0e2f('0x8')](_0x0e2f('0xb'),auth['isAuthenticated'](),controller[_0x0e2f('0xc')]);router['get'](_0x0e2f('0xd'),auth[_0x0e2f('0x9')](),controller[_0x0e2f('0xe')]);router['get'](_0x0e2f('0xf'),auth[_0x0e2f('0x9')](),controller[_0x0e2f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e2f('0x11')]);router[_0x0e2f('0x12')](_0x0e2f('0xf'),auth[_0x0e2f('0x9')](),controller['addAgents']);router['put'](_0x0e2f('0xd'),auth[_0x0e2f('0x9')](),controller[_0x0e2f('0x13')]);router[_0x0e2f('0x14')]('/:id',auth[_0x0e2f('0x9')](),controller[_0x0e2f('0x15')]);router['delete']('/:id/users',auth[_0x0e2f('0x9')](),controller[_0x0e2f('0x16')]);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 ee63410..14baf25 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 _0xda06=['STRING','system-','getDataValue','name','exports'];(function(_0x1efa26,_0x2a2295){var _0x4bdc5f=function(_0x155bee){while(--_0x155bee){_0x1efa26['push'](_0x1efa26['shift']());}};_0x4bdc5f(++_0x2a2295);}(_0xda06,0x176));var _0x6da0=function(_0x3f9602,_0x115411){_0x3f9602=_0x3f9602-0x0;var _0xb22e48=_0xda06[_0x3f9602];return _0xb22e48;};'use strict';var Sequelize=require('sequelize');module[_0x6da0('0x0')]={'name':{'type':Sequelize[_0x6da0('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3ff7b7){return _0x6da0('0x2')+this[_0x6da0('0x3')](_0x6da0('0x4'))+'-';}},'description':{'type':Sequelize[_0x6da0('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x492d=['INTEGER','sequelize','exports','name','VIRTUAL','STRING'];(function(_0x5a456c,_0x383e77){var _0x3ba13a=function(_0x3da6c9){while(--_0x3da6c9){_0x5a456c['push'](_0x5a456c['shift']());}};_0x3ba13a(++_0x383e77);}(_0x492d,0x121));var _0xd492=function(_0xeb59d5,_0x36bec2){_0xeb59d5=_0xeb59d5-0x0;var _0xb86bb7=_0x492d[_0xeb59d5];return _0xb86bb7;};'use strict';var Sequelize=require(_0xd492('0x0'));module[_0xd492('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd492('0x2')},'prefix':{'type':Sequelize[_0xd492('0x3')],'get':function(_0x4675ae){return'system-'+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xd492('0x4')]},'callerIdAll':{'type':Sequelize[_0xd492('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0xd492('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0b0d728..0ec1419 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 _0x2dc3=['params','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','context','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','VoicePrefix','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','length','find','catch'];(function(_0x47a5c4,_0x2f3f64){var _0x276083=function(_0x3bcf79){while(--_0x3bcf79){_0x47a5c4['push'](_0x47a5c4['shift']());}};_0x276083(++_0x2f3f64);}(_0x2dc3,0x127));var _0x32dc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2dc3[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32dc('0x0'));var rimraf=require(_0x32dc('0x1'));var zipdir=require(_0x32dc('0x2'));var jsonpatch=require(_0x32dc('0x3'));var rp=require(_0x32dc('0x4'));var moment=require(_0x32dc('0x5'));var BPromise=require(_0x32dc('0x6'));var Mustache=require(_0x32dc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x32dc('0x8'));var csv=require('to-csv');var ejs=require(_0x32dc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x32dc('0xc'));var Papa=require(_0x32dc('0xd'));var Redis=require(_0x32dc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32dc('0xf'));var hardwareService=require(_0x32dc('0x10'));var logger=require(_0x32dc('0x11'))(_0x32dc('0x12'));var utils=require(_0x32dc('0x13'));var config=require(_0x32dc('0x14'));var licenseUtil=require(_0x32dc('0x15'));var db=require('../../mysqldb')['db'];config[_0x32dc('0x16')]=_['defaults'](config[_0x32dc('0x16')],{'host':_0x32dc('0x17'),'port':0x18eb});var socket=require(_0x32dc('0x18'))(new Redis(config['redis']));require(_0x32dc('0x19'))[_0x32dc('0x1a')](socket);function respondWithStatusCode(_0x5e373a,_0x1fb775){_0x1fb775=_0x1fb775||0xcc;return function(_0x4bf4ca){if(_0x4bf4ca){return _0x5e373a[_0x32dc('0x1b')](_0x1fb775);}return _0x5e373a['status'](_0x1fb775)['end']();};}function respondWithResult(_0x497b11,_0x2e1a9d){_0x2e1a9d=_0x2e1a9d||0xc8;return function(_0x328940){if(_0x328940){return _0x497b11[_0x32dc('0x1c')](_0x2e1a9d)['json'](_0x328940);}};}function respondWithFilteredResult(_0x284dfe,_0x32d0d1){return function(_0x38064a){if(_0x38064a){var _0x47ccb4=_0x38064a[_0x32dc('0x1d')],_0x36e287=_0x32d0d1['offset'],_0x36389b=_0x32d0d1[_0x32dc('0x1e')]+_0x32d0d1[_0x32dc('0x1f')],_0x2671b1;if(_0x36389b>=_0x47ccb4){_0x36389b=_0x47ccb4;_0x2671b1=0xc8;}else{_0x2671b1=0xce;}_0x284dfe[_0x32dc('0x1c')](_0x2671b1);return _0x284dfe[_0x32dc('0x20')](_0x32dc('0x21'),_0x36e287+'-'+_0x36389b+'/'+_0x47ccb4)[_0x32dc('0x22')](_0x38064a);}return null;};}function patchUpdates(_0x43b18c){return function(_0x33eae0){try{jsonpatch['apply'](_0x33eae0,_0x43b18c,!![]);}catch(_0x227563){return BPromise[_0x32dc('0x23')](_0x227563);}return _0x33eae0[_0x32dc('0x24')]();};}function saveUpdates(_0x2a4bf9,_0x5ed495){return function(_0xa5c303){if(_0xa5c303){return _0xa5c303[_0x32dc('0x25')](_0x2a4bf9)[_0x32dc('0x26')](function(_0x39182b){return _0x39182b;});}return null;};}function removeEntity(_0x57e1e3,_0x36a190){return function(_0x18fc9c){if(_0x18fc9c){return _0x18fc9c[_0x32dc('0x27')]()['then'](function(){var _0x51af54=_0x18fc9c[_0x32dc('0x28')]({'plain':!![]});var _0x4a0e6e=_0x32dc('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a0e6e,'resourceId':_0x51af54['id']}})['then'](function(){return _0x18fc9c;});})[_0x32dc('0x26')](function(){_0x57e1e3['status'](0xcc)[_0x32dc('0x2a')]();});}};}function handleEntityNotFound(_0x26e348,_0x58a46c){return function(_0x2cbe2a){if(!_0x2cbe2a){_0x26e348[_0x32dc('0x1b')](0x194);}return _0x2cbe2a;};}function handleError(_0x28beb9,_0xa37191){_0xa37191=_0xa37191||0x1f4;return function(_0x287bb2){logger[_0x32dc('0x2b')](_0x287bb2[_0x32dc('0x2c')]);if(_0x287bb2['name']){delete _0x287bb2[_0x32dc('0x2d')];}_0x28beb9[_0x32dc('0x1c')](_0xa37191)['send'](_0x287bb2);};}exports['index']=function(_0x2e240f,_0x51e50c){var _0x46a526={},_0x5b9c3a={},_0x1c90dc={'count':0x0,'rows':[]};var _0x1e5e51=_['map'](db[_0x32dc('0x2e')][_0x32dc('0x2f')],function(_0x1ec064){return{'name':_0x1ec064['fieldName'],'type':_0x1ec064[_0x32dc('0x30')][_0x32dc('0x31')]};});_0x5b9c3a[_0x32dc('0x32')]=_[_0x32dc('0x33')](_0x1e5e51,_0x32dc('0x2d'));_0x5b9c3a[_0x32dc('0x34')]=_[_0x32dc('0x35')](_0x2e240f[_0x32dc('0x34')]);_0x5b9c3a[_0x32dc('0x36')]=_[_0x32dc('0x37')](_0x5b9c3a['model'],_0x5b9c3a[_0x32dc('0x34')]);_0x46a526[_0x32dc('0x38')]=_[_0x32dc('0x37')](_0x5b9c3a[_0x32dc('0x32')],qs[_0x32dc('0x39')](_0x2e240f['query'][_0x32dc('0x39')]));_0x46a526['attributes']=_0x46a526[_0x32dc('0x38')]['length']?_0x46a526[_0x32dc('0x38')]:_0x5b9c3a['model'];if(!_0x2e240f['query'][_0x32dc('0x3a')](_0x32dc('0x3b'))){_0x46a526[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x2e240f['query'][_0x32dc('0x1f')]);_0x46a526[_0x32dc('0x1e')]=qs[_0x32dc('0x1e')](_0x2e240f[_0x32dc('0x34')]['offset']);}_0x46a526[_0x32dc('0x3c')]=qs[_0x32dc('0x3d')](_0x2e240f[_0x32dc('0x34')][_0x32dc('0x3d')]);_0x46a526[_0x32dc('0x3e')]=qs['filters'](_['pick'](_0x2e240f['query'],_0x5b9c3a['filters']),_0x1e5e51);if(_0x2e240f['query'][_0x32dc('0x3f')]){_0x46a526[_0x32dc('0x3e')]=_['merge'](_0x46a526[_0x32dc('0x3e')],{'$or':_[_0x32dc('0x33')](_0x1e5e51,function(_0x515709){if(_0x515709[_0x32dc('0x30')]!==_0x32dc('0x40')){var _0x15c217={};_0x15c217[_0x515709['name']]={'$like':'%'+_0x2e240f['query'][_0x32dc('0x3f')]+'%'};return _0x15c217;}})});}_0x46a526=_[_0x32dc('0x41')]({},_0x46a526,_0x2e240f[_0x32dc('0x42')]);var _0x405dbc={'where':_0x46a526[_0x32dc('0x3e')]};return db[_0x32dc('0x2e')][_0x32dc('0x1d')](_0x405dbc)[_0x32dc('0x26')](function(_0x12c093){_0x1c90dc[_0x32dc('0x1d')]=_0x12c093;if(_0x2e240f[_0x32dc('0x34')][_0x32dc('0x43')]){_0x46a526[_0x32dc('0x44')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x46a526);})[_0x32dc('0x26')](function(_0x2bf523){_0x1c90dc[_0x32dc('0x45')]=_0x2bf523;return _0x1c90dc;})[_0x32dc('0x26')](respondWithFilteredResult(_0x51e50c,_0x46a526))['catch'](handleError(_0x51e50c,null));};exports[_0x32dc('0x46')]=function(_0x9fac10,_0x3e3896){var _0x530e46={'raw':![],'where':{'id':_0x9fac10['params']['id']}},_0xa49568={};_0xa49568[_0x32dc('0x32')]=_[_0x32dc('0x35')](db[_0x32dc('0x2e')][_0x32dc('0x2f')]);_0xa49568['query']=_[_0x32dc('0x35')](_0x9fac10['query']);_0xa49568[_0x32dc('0x36')]=_['intersection'](_0xa49568[_0x32dc('0x32')],_0xa49568[_0x32dc('0x34')]);_0x530e46[_0x32dc('0x38')]=_[_0x32dc('0x37')](_0xa49568[_0x32dc('0x32')],qs[_0x32dc('0x39')](_0x9fac10[_0x32dc('0x34')][_0x32dc('0x39')]));_0x530e46[_0x32dc('0x38')]=_0x530e46[_0x32dc('0x38')][_0x32dc('0x47')]?_0x530e46['attributes']:_0xa49568[_0x32dc('0x32')];if(_0x9fac10[_0x32dc('0x34')][_0x32dc('0x43')]){_0x530e46[_0x32dc('0x44')]=[{'all':!![]}];}_0x530e46=_['merge']({},_0x530e46,_0x9fac10[_0x32dc('0x42')]);return db['VoicePrefix'][_0x32dc('0x48')](_0x530e46)['then'](handleEntityNotFound(_0x3e3896,null))['then'](respondWithResult(_0x3e3896,null))[_0x32dc('0x49')](handleError(_0x3e3896,null));};exports[_0x32dc('0x27')]=function(_0x112cca,_0x2ff025){return db['VoicePrefix'][_0x32dc('0x48')]({'where':{'id':_0x112cca[_0x32dc('0x4a')]['id']}})[_0x32dc('0x26')](handleEntityNotFound(_0x2ff025,null))['then'](removeEntity(_0x2ff025,null))['catch'](handleError(_0x2ff025,null));};exports[_0x32dc('0x4b')]=function(_0x5e7b48,_0x387643){return db['VoicePrefix']['describe']()[_0x32dc('0x26')](respondWithResult(_0x387643,null))[_0x32dc('0x49')](handleError(_0x387643,null));};exports[_0x32dc('0x4c')]=function(_0x307b0f,_0x524f9d){var _0x18b4e7;return db['sequelize'][_0x32dc('0x4d')](function(_0x2056c2){return db[_0x32dc('0x2e')][_0x32dc('0x4c')](_0x307b0f[_0x32dc('0x4e')],{'transaction':_0x2056c2})['then'](function(_0x5f51f0){_0x18b4e7=_0x5f51f0[_0x32dc('0x28')]({'plain':!![]});return db['VoiceExtension'][_0x32dc('0x48')]({'where':{'id':_0x18b4e7[_0x32dc('0x4f')]},'raw':!![]})[_0x32dc('0x26')](function(_0x1a528b){return createVoicePrefixExtensions(_0x18b4e7,_0x1a528b,_0x2056c2);});});})[_0x32dc('0x26')](function(){var _0x3c18e8=_0x307b0f[_0x32dc('0x50')][_0x32dc('0x28')]({'plain':!![]});if(!_0x3c18e8)throw new Error(_0x32dc('0x51'));if(_0x3c18e8[_0x32dc('0x52')]===_0x32dc('0x50')){var _0x29944c=_0x18b4e7;return db[_0x32dc('0x53')][_0x32dc('0x48')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c18e8[_0x32dc('0x54')]},'raw':!![]})['then'](function(_0x2f7243){if(_0x2f7243&&_0x2f7243[_0x32dc('0x55')]===0x0){return db[_0x32dc('0x56')]['create']({'name':_0x29944c[_0x32dc('0x2d')],'resourceId':_0x29944c['id'],'type':_0x2f7243[_0x32dc('0x2d')],'sectionId':_0x2f7243['id']},{})[_0x32dc('0x26')](function(){return _0x18b4e7;});}else{return _0x18b4e7;}})[_0x32dc('0x49')](function(_0x1a6566){logger[_0x32dc('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a6566);throw _0x1a6566;});}return _0x18b4e7;})['then'](respondWithResult(_0x524f9d,null))[_0x32dc('0x49')](handleError(_0x524f9d,null));};function Extension(_0x32c973,_0x507ba2,_0x26e0d4,_0x54f701){this[_0x32dc('0x57')]='from-sip';this[_0x32dc('0x58')]=_0x32c973;this[_0x32dc('0x59')]=_0x26e0d4;this[_0x32dc('0x30')]=_0x32dc('0x5a');this[_0x32dc('0x5b')]=_0x32dc('0x5c');this['priority']=_0x507ba2;this[_0x32dc('0x5d')]=_0x54f701;}function createVoicePrefixExtensions(_0x50597b,_0x2df0f8,_0x546a34){return new BPromise(function(_0x1d277f,_0x281313){var _0x1c8d2a=new Extension(formatPrefixName(_0x50597b[_0x32dc('0x5e')]),0x1,_0x32dc('0x5f'),_0x32dc('0x60'));_0x1c8d2a[_0x32dc('0x61')]=_0x50597b['id'];return db[_0x32dc('0x62')][_0x32dc('0x4c')](_0x1c8d2a,{'transaction':_0x546a34})['then'](function(_0x866993){var _0x4e6471=_0x866993['get']({'plain':!![]});var _0x8de2fd=_[_0x32dc('0x33')](addVoicePrefixExtensions(_0x50597b,_0x2df0f8),function(_0x33f093){_0x33f093['VoiceExtensionId']=_0x4e6471['id'];_0x33f093[_0x32dc('0x61')]=_0x50597b['id'];return _0x33f093;});return db[_0x32dc('0x62')][_0x32dc('0x63')](_0x8de2fd,{'transaction':_0x546a34})[_0x32dc('0x26')](function(_0x3227b4){if(!_0x3227b4){return _0x281313(_0x32dc('0x64'));}else{return _0x1d277f(_0x3227b4);}})['catch'](function(_0x43c764){return _0x281313(_0x43c764);});});;});};function addVoicePrefixExtensions(_0x388312,_0x43fb82){var _0x4a1840=[];var _0x314563=formatPrefixName(_0x388312[_0x32dc('0x5e')]);_0x4a1840['push'](new Extension(_0x314563,0x2,_0x32dc('0x65'),_0x32dc('0x66')+_0x388312[_0x32dc('0x2d')]));if(_0x388312[_0x32dc('0x67')]){_0x4a1840['push'](new Extension(_0x314563,0x3,_0x32dc('0x65'),_0x32dc('0x68')+_0x388312[_0x32dc('0x67')]));}else{_0x4a1840[_0x32dc('0x69')](new Extension(_0x314563,0x3,_0x32dc('0x5f'),_0x32dc('0x6a')));}_0x4a1840[_0x32dc('0x69')](new Extension(_0x314563,0x4,_0x32dc('0x6b'),_0x43fb82[_0x32dc('0x57')]+','+'${EXTEN:'+(0x8+_0x388312[_0x32dc('0x2d')][_0x32dc('0x47')])+'}'+','+0x1));return _0x4a1840;}function formatPrefixName(_0x14cbf9){var _0x123b4a='_';for(var _0x538680=0x0;_0x538680<_0x14cbf9[_0x32dc('0x47')];_0x538680++){if(_0x14cbf9[_0x32dc('0x6c')](_0x538680)=='-'){_0x123b4a+=_0x14cbf9[_0x32dc('0x6c')](_0x538680);}else{_0x123b4a+='['+_0x14cbf9[_0x32dc('0x6c')](_0x538680)+']';}}_0x123b4a+='.';return _0x123b4a;}exports[_0x32dc('0x25')]=function(_0xa1a13,_0xf62624,_0x1781fa){var _0x215b58=_0xa1a13[_0x32dc('0x4e')];_0x215b58[_0x32dc('0x5e')]=_0x32dc('0x6d')+_0x215b58[_0x32dc('0x2d')]+'-';return db[_0x32dc('0x6e')][_0x32dc('0x4d')](function(_0x29ad68){return db[_0x32dc('0x2e')][_0x32dc('0x25')](_0x215b58,{'where':{'id':_0x215b58['id']},'transaction':_0x29ad68})[_0x32dc('0x26')](function(){return db['VoiceExtension'][_0x32dc('0x27')]({'where':{'VoicePrefixId':_0x215b58['id']},'transaction':_0x29ad68})[_0x32dc('0x26')](function(){return db[_0x32dc('0x62')][_0x32dc('0x48')]({'where':{'id':_0x215b58['VoiceExtensionId']},'raw':!![]})[_0x32dc('0x26')](function(_0x406292){return createVoicePrefixExtensions(_0x215b58,_0x406292,_0x29ad68);});});});})[_0x32dc('0x26')](function(){return db[_0x32dc('0x2e')][_0x32dc('0x6f')](_0x215b58['id']);})[_0x32dc('0x26')](respondWithResult(_0xf62624,null))[_0x32dc('0x49')](handleError(_0xf62624,null));};exports[_0x32dc('0x70')]=function(_0x289bda,_0x3c2bdc,_0x3d6afa){return db[_0x32dc('0x2e')]['find']({'where':{'id':_0x289bda[_0x32dc('0x4a')]['id']}})[_0x32dc('0x26')](handleEntityNotFound(_0x3c2bdc,null))['then'](function(_0x23cdf1){if(_0x23cdf1){return _0x23cdf1[_0x32dc('0x70')](_0x289bda[_0x32dc('0x4e')][_0x32dc('0x71')],_[_0x32dc('0x72')](_0x289bda[_0x32dc('0x4e')],[_0x32dc('0x71'),'id'])||{})['spread'](function(_0x4114b6){for(var _0x22e9bd=0x0;_0x22e9bd<_0x289bda[_0x32dc('0x4e')][_0x32dc('0x71')][_0x32dc('0x47')];_0x22e9bd+=0x1){socket[_0x32dc('0x73')]('userVoicePrefix:save',{'UserId':_0x289bda[_0x32dc('0x4e')]['ids'][_0x22e9bd],'VoicePrefixId':_0x289bda[_0x32dc('0x4a')]['id']});}return _0x4114b6;});}})[_0x32dc('0x26')](respondWithResult(_0x3c2bdc,null))['catch'](handleError(_0x3c2bdc,null));};exports[_0x32dc('0x74')]=function(_0xbf195d,_0xc71aa7,_0x59d766){return db[_0x32dc('0x2e')][_0x32dc('0x48')]({'where':{'id':_0xbf195d[_0x32dc('0x4a')]['id']}})[_0x32dc('0x26')](handleEntityNotFound(_0xc71aa7,null))[_0x32dc('0x26')](function(_0x1a10ff){if(_0x1a10ff){return _0x1a10ff[_0x32dc('0x74')](_0xbf195d['query'][_0x32dc('0x71')])['then'](function(){if(_[_0x32dc('0x75')](_0xbf195d[_0x32dc('0x34')]['ids'])){for(var _0x273f7c=0x0;_0x273f7c<_0xbf195d[_0x32dc('0x34')][_0x32dc('0x71')][_0x32dc('0x47')];_0x273f7c+=0x1){socket[_0x32dc('0x73')](_0x32dc('0x76'),{'UserId':Number(_0xbf195d[_0x32dc('0x34')]['ids'][_0x273f7c]),'VoicePrefixId':Number(_0xbf195d[_0x32dc('0x4a')]['id'])});}}else{socket['emit'](_0x32dc('0x76'),{'UserId':Number(_0xbf195d[_0x32dc('0x34')][_0x32dc('0x71')]),'VoicePrefixId':Number(_0xbf195d[_0x32dc('0x4a')]['id'])});}});}})[_0x32dc('0x26')](respondWithStatusCode(_0xc71aa7,null))[_0x32dc('0x49')](handleError(_0xc71aa7,null));};exports['getAgents']=function(_0x2f22f8,_0x289c0b,_0x46185c){var _0x328cf3={};var _0x18f3a9={};var _0x46e61c;var _0xcc7e13;return db[_0x32dc('0x2e')][_0x32dc('0x77')]({'where':{'id':_0x2f22f8[_0x32dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x289c0b,null))['then'](function(_0x5e72d9){if(_0x5e72d9){_0x46e61c=_0x5e72d9;_0x18f3a9[_0x32dc('0x32')]=_[_0x32dc('0x35')](db[_0x32dc('0x78')][_0x32dc('0x2f')]);_0x18f3a9[_0x32dc('0x34')]=_[_0x32dc('0x35')](_0x2f22f8[_0x32dc('0x34')]);_0x18f3a9[_0x32dc('0x36')]=_[_0x32dc('0x37')](_0x18f3a9['model'],_0x18f3a9[_0x32dc('0x34')]);_0x328cf3[_0x32dc('0x38')]=_[_0x32dc('0x37')](_0x18f3a9[_0x32dc('0x32')],qs['fields'](_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x39')]));_0x328cf3[_0x32dc('0x38')]=_0x328cf3[_0x32dc('0x38')]['length']?_0x328cf3[_0x32dc('0x38')]:_0x18f3a9[_0x32dc('0x32')];_0x328cf3['order']=qs['sort'](_0x2f22f8[_0x32dc('0x34')]['sort']);_0x328cf3['where']=qs[_0x32dc('0x36')](_[_0x32dc('0x79')](_0x2f22f8[_0x32dc('0x34')],_0x18f3a9[_0x32dc('0x36')]));if(_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x3f')]){_0x328cf3[_0x32dc('0x3e')]=_['merge'](_0x328cf3[_0x32dc('0x3e')],{'$or':_[_0x32dc('0x33')](_0x328cf3[_0x32dc('0x38')],function(_0x28bd70){var _0x96ddb={};_0x96ddb[_0x28bd70]={'$like':'%'+_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x3f')]+'%'};return _0x96ddb;})});}_0x328cf3=_['merge']({},_0x328cf3,_0x2f22f8['options']);return _0x46e61c['getAgents'](_0x328cf3);}})[_0x32dc('0x26')](function(_0x360ece){if(_0x360ece){_0xcc7e13=_0x360ece[_0x32dc('0x47')];if(!_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x3a')](_0x32dc('0x3b'))){_0x328cf3[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x1f')]);_0x328cf3[_0x32dc('0x1e')]=qs['offset'](_0x2f22f8[_0x32dc('0x34')]['offset']);}return _0x46e61c[_0x32dc('0x7a')](_0x328cf3);}})[_0x32dc('0x26')](function(_0x47bf1b){if(_0x47bf1b){return _0x47bf1b?{'count':_0xcc7e13,'rows':_0x47bf1b}:null;}})[_0x32dc('0x26')](respondWithResult(_0x289c0b,null))[_0x32dc('0x49')](handleError(_0x289c0b,null));}; \ No newline at end of file +var _0xa5aa=['bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','index','map','VoicePrefix','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId'];(function(_0x44d9a7,_0x35937f){var _0x2cde00=function(_0x50e93a){while(--_0x50e93a){_0x44d9a7['push'](_0x44d9a7['shift']());}};_0x2cde00(++_0x35937f);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0xbfc9fe,_0x4041ff){_0xbfc9fe=_0xbfc9fe-0x0;var _0x6d41a9=_0xa5aa[_0xbfc9fe];return _0x6d41a9;};'use strict';var pdf=require(_0xaa5a('0x0'));var emlformat=require(_0xaa5a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa5a('0x2'));var jsonpatch=require(_0xaa5a('0x3'));var rp=require(_0xaa5a('0x4'));var moment=require(_0xaa5a('0x5'));var BPromise=require(_0xaa5a('0x6'));var Mustache=require(_0xaa5a('0x7'));var util=require('util');var path=require(_0xaa5a('0x8'));var sox=require(_0xaa5a('0x9'));var csv=require(_0xaa5a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xaa5a('0xb'));var crypto=require(_0xaa5a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaa5a('0xd'));var toCsv=require(_0xaa5a('0xa'));var querystring=require(_0xaa5a('0xe'));var Papa=require('papaparse');var Redis=require(_0xaa5a('0xf'));var authService=require(_0xaa5a('0x10'));var qs=require(_0xaa5a('0x11'));var as=require(_0xaa5a('0x12'));var hardwareService=require(_0xaa5a('0x13'));var logger=require(_0xaa5a('0x14'))('api');var utils=require(_0xaa5a('0x15'));var config=require(_0xaa5a('0x16'));var licenseUtil=require(_0xaa5a('0x17'));var db=require(_0xaa5a('0x18'))['db'];config[_0xaa5a('0x19')]=_[_0xaa5a('0x1a')](config[_0xaa5a('0x19')],{'host':_0xaa5a('0x1b'),'port':0x18eb});var socket=require(_0xaa5a('0x1c'))(new Redis(config[_0xaa5a('0x19')]));require(_0xaa5a('0x1d'))[_0xaa5a('0x1e')](socket);function respondWithStatusCode(_0x5eaa9c,_0x2d931c){_0x2d931c=_0x2d931c||0xcc;return function(_0x40b34f){if(_0x40b34f){return _0x5eaa9c[_0xaa5a('0x1f')](_0x2d931c);}return _0x5eaa9c['status'](_0x2d931c)[_0xaa5a('0x20')]();};}function respondWithResult(_0x10ba31,_0x286f17){_0x286f17=_0x286f17||0xc8;return function(_0x2b6fd0){if(_0x2b6fd0){return _0x10ba31[_0xaa5a('0x21')](_0x286f17)[_0xaa5a('0x22')](_0x2b6fd0);}};}function respondWithFilteredResult(_0x1b3eba,_0x1c7320){return function(_0xef5dd3){if(_0xef5dd3){var _0x3a8ccf=_0xef5dd3[_0xaa5a('0x23')],_0x8799a4=_0x1c7320[_0xaa5a('0x24')],_0x1c613d=_0x1c7320[_0xaa5a('0x24')]+_0x1c7320[_0xaa5a('0x25')],_0x127d71;if(_0x1c613d>=_0x3a8ccf){_0x1c613d=_0x3a8ccf;_0x127d71=0xc8;}else{_0x127d71=0xce;}_0x1b3eba['status'](_0x127d71);return _0x1b3eba[_0xaa5a('0x26')](_0xaa5a('0x27'),_0x8799a4+'-'+_0x1c613d+'/'+_0x3a8ccf)[_0xaa5a('0x22')](_0xef5dd3);}return null;};}function patchUpdates(_0x379da2){return function(_0x5af50f){try{jsonpatch[_0xaa5a('0x28')](_0x5af50f,_0x379da2,!![]);}catch(_0x2b2f2b){return BPromise[_0xaa5a('0x29')](_0x2b2f2b);}return _0x5af50f[_0xaa5a('0x2a')]();};}function saveUpdates(_0xf50dd0,_0x3b6083){return function(_0x8932ba){if(_0x8932ba){return _0x8932ba[_0xaa5a('0x2b')](_0xf50dd0)[_0xaa5a('0x2c')](function(_0x5a9993){return _0x5a9993;});}return null;};}function removeEntity(_0x1e4e12,_0x4c9035){return function(_0x416351){if(_0x416351){return _0x416351[_0xaa5a('0x2d')]()[_0xaa5a('0x2c')](function(){var _0x3e6ac1=_0x416351[_0xaa5a('0x2e')]({'plain':!![]});var _0x47cdcf=_0xaa5a('0x2f');return db[_0xaa5a('0x30')]['destroy']({'where':{'type':_0x47cdcf,'resourceId':_0x3e6ac1['id']}})[_0xaa5a('0x2c')](function(){return _0x416351;});})['then'](function(){_0x1e4e12[_0xaa5a('0x21')](0xcc)[_0xaa5a('0x20')]();});}};}function handleEntityNotFound(_0x24c8e5,_0x27fe53){return function(_0x4117a6){if(!_0x4117a6){_0x24c8e5[_0xaa5a('0x1f')](0x194);}return _0x4117a6;};}function handleError(_0x57cd56,_0x1176b7){_0x1176b7=_0x1176b7||0x1f4;return function(_0x3ecf03){logger['error'](_0x3ecf03[_0xaa5a('0x31')]);if(_0x3ecf03[_0xaa5a('0x32')]){delete _0x3ecf03['name'];}_0x57cd56[_0xaa5a('0x21')](_0x1176b7)[_0xaa5a('0x33')](_0x3ecf03);};}exports[_0xaa5a('0x34')]=function(_0x115f03,_0x24ff37){var _0xa01478={},_0x4b49af={},_0x215eb4={'count':0x0,'rows':[]};var _0x1c877b=_[_0xaa5a('0x35')](db[_0xaa5a('0x36')]['rawAttributes'],function(_0x4d59a2){return{'name':_0x4d59a2[_0xaa5a('0x37')],'type':_0x4d59a2[_0xaa5a('0x38')]['key']};});_0x4b49af[_0xaa5a('0x39')]=_['map'](_0x1c877b,'name');_0x4b49af[_0xaa5a('0x3a')]=_[_0xaa5a('0x3b')](_0x115f03[_0xaa5a('0x3a')]);_0x4b49af[_0xaa5a('0x3c')]=_[_0xaa5a('0x3d')](_0x4b49af[_0xaa5a('0x39')],_0x4b49af[_0xaa5a('0x3a')]);_0xa01478['attributes']=_[_0xaa5a('0x3d')](_0x4b49af[_0xaa5a('0x39')],qs[_0xaa5a('0x3e')](_0x115f03['query'][_0xaa5a('0x3e')]));_0xa01478['attributes']=_0xa01478[_0xaa5a('0x3f')]['length']?_0xa01478['attributes']:_0x4b49af[_0xaa5a('0x39')];if(!_0x115f03[_0xaa5a('0x3a')][_0xaa5a('0x40')](_0xaa5a('0x41'))){_0xa01478[_0xaa5a('0x25')]=qs[_0xaa5a('0x25')](_0x115f03[_0xaa5a('0x3a')][_0xaa5a('0x25')]);_0xa01478['offset']=qs['offset'](_0x115f03['query'][_0xaa5a('0x24')]);}_0xa01478[_0xaa5a('0x42')]=qs[_0xaa5a('0x43')](_0x115f03[_0xaa5a('0x3a')][_0xaa5a('0x43')]);_0xa01478[_0xaa5a('0x44')]=qs['filters'](_['pick'](_0x115f03['query'],_0x4b49af[_0xaa5a('0x3c')]),_0x1c877b);if(_0x115f03['query']['filter']){_0xa01478['where']=_[_0xaa5a('0x45')](_0xa01478[_0xaa5a('0x44')],{'$or':_[_0xaa5a('0x35')](_0x1c877b,function(_0x5d656a){if(_0x5d656a[_0xaa5a('0x38')]!==_0xaa5a('0x46')){var _0x6a2c1d={};_0x6a2c1d[_0x5d656a[_0xaa5a('0x32')]]={'$like':'%'+_0x115f03[_0xaa5a('0x3a')]['filter']+'%'};return _0x6a2c1d;}})});}_0xa01478=_[_0xaa5a('0x45')]({},_0xa01478,_0x115f03[_0xaa5a('0x47')]);var _0x2dbbf4={'where':_0xa01478[_0xaa5a('0x44')]};return db[_0xaa5a('0x36')][_0xaa5a('0x23')](_0x2dbbf4)[_0xaa5a('0x2c')](function(_0x26afd3){_0x215eb4[_0xaa5a('0x23')]=_0x26afd3;if(_0x115f03['query']['includeAll']){_0xa01478['include']=[{'all':!![]}];}return db['VoicePrefix'][_0xaa5a('0x48')](_0xa01478);})[_0xaa5a('0x2c')](function(_0x37f840){_0x215eb4[_0xaa5a('0x49')]=_0x37f840;return _0x215eb4;})[_0xaa5a('0x2c')](respondWithFilteredResult(_0x24ff37,_0xa01478))[_0xaa5a('0x4a')](handleError(_0x24ff37,null));};exports[_0xaa5a('0x4b')]=function(_0x2985d8,_0x58c73a){var _0x12febf={'raw':![],'where':{'id':_0x2985d8[_0xaa5a('0x4c')]['id']}},_0x5a5a18={};_0x5a5a18[_0xaa5a('0x39')]=_[_0xaa5a('0x3b')](db[_0xaa5a('0x36')][_0xaa5a('0x4d')]);_0x5a5a18[_0xaa5a('0x3a')]=_[_0xaa5a('0x3b')](_0x2985d8['query']);_0x5a5a18[_0xaa5a('0x3c')]=_[_0xaa5a('0x3d')](_0x5a5a18[_0xaa5a('0x39')],_0x5a5a18[_0xaa5a('0x3a')]);_0x12febf[_0xaa5a('0x3f')]=_[_0xaa5a('0x3d')](_0x5a5a18[_0xaa5a('0x39')],qs[_0xaa5a('0x3e')](_0x2985d8[_0xaa5a('0x3a')]['fields']));_0x12febf['attributes']=_0x12febf[_0xaa5a('0x3f')][_0xaa5a('0x4e')]?_0x12febf[_0xaa5a('0x3f')]:_0x5a5a18[_0xaa5a('0x39')];if(_0x2985d8[_0xaa5a('0x3a')][_0xaa5a('0x4f')]){_0x12febf[_0xaa5a('0x50')]=[{'all':!![]}];}_0x12febf=_['merge']({},_0x12febf,_0x2985d8[_0xaa5a('0x47')]);return db[_0xaa5a('0x36')][_0xaa5a('0x51')](_0x12febf)[_0xaa5a('0x2c')](handleEntityNotFound(_0x58c73a,null))[_0xaa5a('0x2c')](respondWithResult(_0x58c73a,null))['catch'](handleError(_0x58c73a,null));};exports['destroy']=function(_0x4e9b9b,_0x5d91c5){return db[_0xaa5a('0x36')][_0xaa5a('0x51')]({'where':{'id':_0x4e9b9b[_0xaa5a('0x4c')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x5d91c5,null))[_0xaa5a('0x2c')](removeEntity(_0x5d91c5,null))[_0xaa5a('0x4a')](handleError(_0x5d91c5,null));};exports[_0xaa5a('0x52')]=function(_0x4506a4,_0x16a875){return db[_0xaa5a('0x36')][_0xaa5a('0x52')]()[_0xaa5a('0x2c')](respondWithResult(_0x16a875,null))[_0xaa5a('0x4a')](handleError(_0x16a875,null));};exports[_0xaa5a('0x53')]=function(_0x1758d9,_0x4e78fb){var _0x4ddf3e;return db['sequelize'][_0xaa5a('0x54')](function(_0x45ad31){return db[_0xaa5a('0x36')][_0xaa5a('0x53')](_0x1758d9[_0xaa5a('0x55')],{'transaction':_0x45ad31})[_0xaa5a('0x2c')](function(_0x3e3a98){_0x4ddf3e=_0x3e3a98[_0xaa5a('0x2e')]({'plain':!![]});return db[_0xaa5a('0x56')][_0xaa5a('0x51')]({'where':{'id':_0x4ddf3e[_0xaa5a('0x57')]},'raw':!![]})[_0xaa5a('0x2c')](function(_0xd8ef63){return createVoicePrefixExtensions(_0x4ddf3e,_0xd8ef63,_0x45ad31);});});})[_0xaa5a('0x2c')](function(){var _0x154b6e=_0x1758d9['user'][_0xaa5a('0x2e')]({'plain':!![]});if(!_0x154b6e)throw new Error(_0xaa5a('0x58'));if(_0x154b6e[_0xaa5a('0x59')]===_0xaa5a('0x5a')){var _0x20db3f=_0x4ddf3e;return db[_0xaa5a('0x5b')][_0xaa5a('0x51')]({'where':{'name':_0xaa5a('0x2f'),'userProfileId':_0x154b6e[_0xaa5a('0x5c')]},'raw':!![]})[_0xaa5a('0x2c')](function(_0x28f8b3){if(_0x28f8b3&&_0x28f8b3[_0xaa5a('0x5d')]===0x0){return db[_0xaa5a('0x30')][_0xaa5a('0x53')]({'name':_0x20db3f[_0xaa5a('0x32')],'resourceId':_0x20db3f['id'],'type':_0x28f8b3[_0xaa5a('0x32')],'sectionId':_0x28f8b3['id']},{})[_0xaa5a('0x2c')](function(){return _0x4ddf3e;});}else{return _0x4ddf3e;}})[_0xaa5a('0x4a')](function(_0x4f4aa8){logger[_0xaa5a('0x5e')](_0xaa5a('0x5f'),_0x4f4aa8);throw _0x4f4aa8;});}return _0x4ddf3e;})[_0xaa5a('0x2c')](respondWithResult(_0x4e78fb,null))['catch'](handleError(_0x4e78fb,null));};function Extension(_0x3f3eb3,_0x24ef7c,_0x435409,_0x1669fc){this[_0xaa5a('0x60')]=_0xaa5a('0x61');this[_0xaa5a('0x62')]=_0x3f3eb3;this['app']=_0x435409;this[_0xaa5a('0x38')]=_0xaa5a('0x63');this[_0xaa5a('0x64')]=_0xaa5a('0x65');this[_0xaa5a('0x66')]=_0x24ef7c;this[_0xaa5a('0x67')]=_0x1669fc;}function createVoicePrefixExtensions(_0x4c9c22,_0xcbee9f,_0x50e4dc){return new BPromise(function(_0x2b2579,_0x5d87cf){var _0x50be15=new Extension(formatPrefixName(_0x4c9c22[_0xaa5a('0x68')]),0x1,_0xaa5a('0x69'),_0xaa5a('0x6a'));_0x50be15[_0xaa5a('0x6b')]=_0x4c9c22['id'];return db[_0xaa5a('0x56')][_0xaa5a('0x53')](_0x50be15,{'transaction':_0x50e4dc})[_0xaa5a('0x2c')](function(_0x44c35c){var _0x43f190=_0x44c35c[_0xaa5a('0x2e')]({'plain':!![]});var _0x5b8c7c=_[_0xaa5a('0x35')](addVoicePrefixExtensions(_0x4c9c22,_0xcbee9f),function(_0x410b29){_0x410b29[_0xaa5a('0x57')]=_0x43f190['id'];_0x410b29[_0xaa5a('0x6b')]=_0x4c9c22['id'];return _0x410b29;});return db[_0xaa5a('0x56')][_0xaa5a('0x6c')](_0x5b8c7c,{'transaction':_0x50e4dc})['then'](function(_0xd9d8f5){if(!_0xd9d8f5){return _0x5d87cf(_0xaa5a('0x6d'));}else{return _0x2b2579(_0xd9d8f5);}})[_0xaa5a('0x4a')](function(_0x2c9113){return _0x5d87cf(_0x2c9113);});});;});};function addVoicePrefixExtensions(_0x50b21c,_0xe8328a){var _0x1f33de=[];var _0x51db13=formatPrefixName(_0x50b21c[_0xaa5a('0x68')]);_0x1f33de['push'](new Extension(_0x51db13,0x2,_0xaa5a('0x6e'),_0xaa5a('0x6f')+_0x50b21c[_0xaa5a('0x32')]));if(_0x50b21c[_0xaa5a('0x70')]){_0x1f33de[_0xaa5a('0x71')](new Extension(_0x51db13,0x3,_0xaa5a('0x6e'),_0xaa5a('0x72')+_0x50b21c['callerIdAll']));}else{_0x1f33de[_0xaa5a('0x71')](new Extension(_0x51db13,0x3,_0xaa5a('0x69'),_0xaa5a('0x73')));}_0x1f33de['push'](new Extension(_0x51db13,0x4,_0xaa5a('0x74'),_0xe8328a[_0xaa5a('0x60')]+','+_0xaa5a('0x75')+(0x8+_0x50b21c[_0xaa5a('0x32')][_0xaa5a('0x4e')])+'}'+','+0x1));return _0x1f33de;}function formatPrefixName(_0x3e3b23){var _0x73c40a='_';for(var _0x2f5e1e=0x0;_0x2f5e1e<_0x3e3b23['length'];_0x2f5e1e++){if(_0x3e3b23['charAt'](_0x2f5e1e)=='-'){_0x73c40a+=_0x3e3b23[_0xaa5a('0x76')](_0x2f5e1e);}else{_0x73c40a+='['+_0x3e3b23['charAt'](_0x2f5e1e)+']';}}_0x73c40a+='.';return _0x73c40a;}exports['update']=function(_0x1b6ebd,_0x170626,_0x5b490b){var _0x29b7a6=_0x1b6ebd[_0xaa5a('0x55')];_0x29b7a6[_0xaa5a('0x68')]=_0xaa5a('0x77')+_0x29b7a6[_0xaa5a('0x32')]+'-';return db[_0xaa5a('0x78')]['transaction'](function(_0x42a9a0){return db[_0xaa5a('0x36')][_0xaa5a('0x2b')](_0x29b7a6,{'where':{'id':_0x29b7a6['id']},'transaction':_0x42a9a0})[_0xaa5a('0x2c')](function(){return db[_0xaa5a('0x56')][_0xaa5a('0x2d')]({'where':{'VoicePrefixId':_0x29b7a6['id']},'transaction':_0x42a9a0})[_0xaa5a('0x2c')](function(){return db[_0xaa5a('0x56')][_0xaa5a('0x51')]({'where':{'id':_0x29b7a6['VoiceExtensionId']},'raw':!![]})[_0xaa5a('0x2c')](function(_0x3138bb){return createVoicePrefixExtensions(_0x29b7a6,_0x3138bb,_0x42a9a0);});});});})[_0xaa5a('0x2c')](function(){return db[_0xaa5a('0x36')][_0xaa5a('0x79')](_0x29b7a6['id']);})[_0xaa5a('0x2c')](respondWithResult(_0x170626,null))['catch'](handleError(_0x170626,null));};exports[_0xaa5a('0x7a')]=function(_0x3cde0f,_0x4a001d,_0x45831a){return db['VoicePrefix'][_0xaa5a('0x51')]({'where':{'id':_0x3cde0f[_0xaa5a('0x4c')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x4a001d,null))[_0xaa5a('0x2c')](function(_0x4a11ab){if(_0x4a11ab){return _0x4a11ab[_0xaa5a('0x7a')](_0x3cde0f[_0xaa5a('0x55')][_0xaa5a('0x7b')],_['omit'](_0x3cde0f['body'],['ids','id'])||{})[_0xaa5a('0x7c')](function(_0x2b3e37){for(var _0x2aa399=0x0;_0x2aa399<_0x3cde0f['body'][_0xaa5a('0x7b')][_0xaa5a('0x4e')];_0x2aa399+=0x1){socket[_0xaa5a('0x7d')](_0xaa5a('0x7e'),{'UserId':_0x3cde0f['body'][_0xaa5a('0x7b')][_0x2aa399],'VoicePrefixId':_0x3cde0f['params']['id']});}return _0x2b3e37;});}})[_0xaa5a('0x2c')](respondWithResult(_0x4a001d,null))[_0xaa5a('0x4a')](handleError(_0x4a001d,null));};exports['removeAgents']=function(_0xb36649,_0x57245e,_0x231265){return db[_0xaa5a('0x36')][_0xaa5a('0x51')]({'where':{'id':_0xb36649[_0xaa5a('0x4c')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x57245e,null))[_0xaa5a('0x2c')](function(_0x4a4431){if(_0x4a4431){return _0x4a4431[_0xaa5a('0x7f')](_0xb36649[_0xaa5a('0x3a')][_0xaa5a('0x7b')])[_0xaa5a('0x2c')](function(){if(_['isArray'](_0xb36649[_0xaa5a('0x3a')]['ids'])){for(var _0x2e99f6=0x0;_0x2e99f6<_0xb36649[_0xaa5a('0x3a')]['ids'][_0xaa5a('0x4e')];_0x2e99f6+=0x1){socket[_0xaa5a('0x7d')](_0xaa5a('0x80'),{'UserId':Number(_0xb36649[_0xaa5a('0x3a')][_0xaa5a('0x7b')][_0x2e99f6]),'VoicePrefixId':Number(_0xb36649['params']['id'])});}}else{socket[_0xaa5a('0x7d')](_0xaa5a('0x80'),{'UserId':Number(_0xb36649[_0xaa5a('0x3a')][_0xaa5a('0x7b')]),'VoicePrefixId':Number(_0xb36649['params']['id'])});}});}})[_0xaa5a('0x2c')](respondWithStatusCode(_0x57245e,null))[_0xaa5a('0x4a')](handleError(_0x57245e,null));};exports[_0xaa5a('0x81')]=function(_0x268bc7,_0x1cab20,_0x50f030){var _0x1a7522={};var _0x536fd4={};var _0x2b2e08;var _0xb623af;return db[_0xaa5a('0x36')][_0xaa5a('0x82')]({'where':{'id':_0x268bc7[_0xaa5a('0x4c')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x1cab20,null))[_0xaa5a('0x2c')](function(_0x13f644){if(_0x13f644){_0x2b2e08=_0x13f644;_0x536fd4[_0xaa5a('0x39')]=_[_0xaa5a('0x3b')](db[_0xaa5a('0x83')][_0xaa5a('0x4d')]);_0x536fd4[_0xaa5a('0x3a')]=_[_0xaa5a('0x3b')](_0x268bc7[_0xaa5a('0x3a')]);_0x536fd4[_0xaa5a('0x3c')]=_[_0xaa5a('0x3d')](_0x536fd4['model'],_0x536fd4[_0xaa5a('0x3a')]);_0x1a7522[_0xaa5a('0x3f')]=_['intersection'](_0x536fd4[_0xaa5a('0x39')],qs[_0xaa5a('0x3e')](_0x268bc7[_0xaa5a('0x3a')][_0xaa5a('0x3e')]));_0x1a7522[_0xaa5a('0x3f')]=_0x1a7522[_0xaa5a('0x3f')]['length']?_0x1a7522[_0xaa5a('0x3f')]:_0x536fd4[_0xaa5a('0x39')];_0x1a7522[_0xaa5a('0x42')]=qs[_0xaa5a('0x43')](_0x268bc7[_0xaa5a('0x3a')][_0xaa5a('0x43')]);_0x1a7522[_0xaa5a('0x44')]=qs[_0xaa5a('0x3c')](_[_0xaa5a('0x84')](_0x268bc7['query'],_0x536fd4[_0xaa5a('0x3c')]));if(_0x268bc7[_0xaa5a('0x3a')]['filter']){_0x1a7522[_0xaa5a('0x44')]=_[_0xaa5a('0x45')](_0x1a7522[_0xaa5a('0x44')],{'$or':_['map'](_0x1a7522['attributes'],function(_0x21fdb3){var _0x5c6388={};_0x5c6388[_0x21fdb3]={'$like':'%'+_0x268bc7[_0xaa5a('0x3a')][_0xaa5a('0x85')]+'%'};return _0x5c6388;})});}_0x1a7522=_['merge']({},_0x1a7522,_0x268bc7['options']);return _0x2b2e08['getAgents'](_0x1a7522);}})['then'](function(_0x539996){if(_0x539996){_0xb623af=_0x539996[_0xaa5a('0x4e')];if(!_0x268bc7['query']['hasOwnProperty'](_0xaa5a('0x41'))){_0x1a7522[_0xaa5a('0x25')]=qs[_0xaa5a('0x25')](_0x268bc7[_0xaa5a('0x3a')][_0xaa5a('0x25')]);_0x1a7522[_0xaa5a('0x24')]=qs[_0xaa5a('0x24')](_0x268bc7[_0xaa5a('0x3a')][_0xaa5a('0x24')]);}return _0x2b2e08[_0xaa5a('0x81')](_0x1a7522);}})[_0xaa5a('0x2c')](function(_0x1bb631){if(_0x1bb631){return _0x1bb631?{'count':_0xb623af,'rows':_0x1bb631}:null;}})['then'](respondWithResult(_0x1cab20,null))[_0xaa5a('0x4a')](handleError(_0x1cab20,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ba7f1a6..14ccaa3 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0xfbaae4,_0xbc60a5){var _0x528ecf=function(_0x3ca73d){while(--_0x3ca73d){_0xfbaae4['push'](_0xfbaae4['shift']());}};_0x528ecf(++_0xbc60a5);}(_0x008c,0x188));var _0xc008=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0x008c[_0x1c72b8];return _0x191114;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x34e8,0x12c));var _0x834e=function(_0x3c4d3d,_0x11f97e){_0x3c4d3d=_0x3c4d3d-0x0;var _0x53be7c=_0x34e8[_0x3c4d3d];return _0x53be7c;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 97fbe61..3ee9b1f 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 _0xf347=['api','moment','bluebird','path','rimraf','../../config/environment','define','VoicePrefix','lodash'];(function(_0x5b3b0e,_0x3130e2){var _0x4498e3=function(_0x420d5a){while(--_0x420d5a){_0x5b3b0e['push'](_0x5b3b0e['shift']());}};_0x4498e3(++_0x3130e2);}(_0xf347,0x10d));var _0x7f34=function(_0x2e104b,_0x4a6268){_0x2e104b=_0x2e104b-0x0;var _0x2b9f10=_0xf347[_0x2e104b];return _0x2b9f10;};'use strict';var _=require(_0x7f34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7f34('0x1'));var moment=require(_0x7f34('0x2'));var BPromise=require(_0x7f34('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f34('0x4'));var rimraf=require(_0x7f34('0x5'));var config=require(_0x7f34('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x403063,_0x36a54c){return _0x403063[_0x7f34('0x7')](_0x7f34('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x901f=['../../config/logger','api','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util'];(function(_0x2dbbe5,_0xb7c79b){var _0x3af882=function(_0x190eb6){while(--_0x190eb6){_0x2dbbe5['push'](_0x2dbbe5['shift']());}};_0x3af882(++_0xb7c79b);}(_0x901f,0x8f));var _0xf901=function(_0x36b283,_0x438b12){_0x36b283=_0x36b283-0x0;var _0x5da40c=_0x901f[_0x36b283];return _0x5da40c;};'use strict';var _=require('lodash');var util=require(_0xf901('0x0'));var logger=require(_0xf901('0x1'))(_0xf901('0x2'));var moment=require('moment');var BPromise=require(_0xf901('0x3'));var rp=require(_0xf901('0x4'));var fs=require('fs');var path=require(_0xf901('0x5'));var rimraf=require(_0xf901('0x6'));var config=require('../../config/environment');var attributes=require(_0xf901('0x7'));module[_0xf901('0x8')]=function(_0x42cafd,_0x481496){return _0x42cafd[_0xf901('0x9')](_0xf901('0xa'),attributes,{'tableName':_0xf901('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 62d59cb..2a4d533 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 _0x6666=['error','VoicePrefix,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0xb8f08e,_0x3542cb){var _0x397344=function(_0x412910){while(--_0x412910){_0xb8f08e['push'](_0xb8f08e['shift']());}};_0x397344(++_0x3542cb);}(_0x6666,0x1c7));var _0x6666=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x6666[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x6666('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6666('0x1'));var rs=require(_0x6666('0x2'));var fs=require('fs');var Redis=require(_0x6666('0x3'));var db=require(_0x6666('0x4'))['db'];var utils=require(_0x6666('0x5'));var logger=require(_0x6666('0x6'))(_0x6666('0x7'));var config=require(_0x6666('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6666('0x9')]['http']({'port':0x232a});config[_0x6666('0xa')]=_[_0x6666('0xb')](config['redis'],{'host':_0x6666('0xc'),'port':0x18eb});var socket=require(_0x6666('0xd'))(new Redis(config[_0x6666('0xa')]));require(_0x6666('0xe'))['register'](socket);function respondWithRpcPromise(_0x4afcbf,_0x4ca025,_0x41212d){return new BPromise(function(_0x401100,_0xf62d31){return client[_0x6666('0xf')](_0x4afcbf,_0x41212d)[_0x6666('0x10')](function(_0x3c0d55){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x4ca025,_0x6666('0x11'));logger[_0x6666('0x12')](_0x6666('0x13'),_0x4ca025,'request\x20sent',JSON['stringify'](_0x3c0d55));if(_0x3c0d55[_0x6666('0x14')]){if(_0x3c0d55[_0x6666('0x14')]['code']===0x1f4){logger['error'](_0x6666('0x15'),_0x4ca025,_0x3c0d55[_0x6666('0x14')][_0x6666('0x16')]);return _0xf62d31(_0x3c0d55['error']['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4ca025,_0x3c0d55['error']['message']);return _0x401100(_0x3c0d55['error'][_0x6666('0x16')]);}else{logger[_0x6666('0x17')](_0x6666('0x15'),_0x4ca025,_0x6666('0x11'));_0x401100(_0x3c0d55['result'][_0x6666('0x16')]);}})[_0x6666('0x18')](function(_0x366806){logger[_0x6666('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4ca025,_0x366806);_0xf62d31(_0x366806);});});} \ No newline at end of file +var _0x14c5=['socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x27dd27,_0x397f9e){var _0x116fed=function(_0x491bd1){while(--_0x491bd1){_0x27dd27['push'](_0x27dd27['shift']());}};_0x116fed(++_0x397f9e);}(_0x14c5,0x1de));var _0x514c=function(_0x2c24b3,_0x8ba2e7){_0x2c24b3=_0x2c24b3-0x0;var _0x52d8d6=_0x14c5[_0x2c24b3];return _0x52d8d6;};'use strict';var _=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var moment=require(_0x514c('0x2'));var BPromise=require('bluebird');var rs=require(_0x514c('0x3'));var fs=require('fs');var Redis=require(_0x514c('0x4'));var db=require(_0x514c('0x5'))['db'];var utils=require(_0x514c('0x6'));var logger=require(_0x514c('0x7'))(_0x514c('0x8'));var config=require(_0x514c('0x9'));var jayson=require(_0x514c('0xa'));var client=jayson[_0x514c('0xb')]['http']({'port':0x232a});config[_0x514c('0xc')]=_[_0x514c('0xd')](config[_0x514c('0xc')],{'host':_0x514c('0xe'),'port':0x18eb});var socket=require(_0x514c('0xf'))(new Redis(config[_0x514c('0xc')]));require(_0x514c('0x10'))[_0x514c('0x11')](socket);function respondWithRpcPromise(_0x533911,_0x27ffde,_0x37e39f){return new BPromise(function(_0x1a84e5,_0x27b85a){return client[_0x514c('0x12')](_0x533911,_0x37e39f)[_0x514c('0x13')](function(_0x1bbb57){logger[_0x514c('0x14')](_0x514c('0x15'),_0x27ffde,_0x514c('0x16'));logger['debug'](_0x514c('0x17'),_0x27ffde,'request\x20sent',JSON[_0x514c('0x18')](_0x1bbb57));if(_0x1bbb57[_0x514c('0x19')]){if(_0x1bbb57[_0x514c('0x19')]['code']===0x1f4){logger[_0x514c('0x19')](_0x514c('0x15'),_0x27ffde,_0x1bbb57[_0x514c('0x19')][_0x514c('0x1a')]);return _0x27b85a(_0x1bbb57['error'][_0x514c('0x1a')]);}logger[_0x514c('0x19')](_0x514c('0x15'),_0x27ffde,_0x1bbb57[_0x514c('0x19')][_0x514c('0x1a')]);return _0x1a84e5(_0x1bbb57[_0x514c('0x19')][_0x514c('0x1a')]);}else{logger['info'](_0x514c('0x15'),_0x27ffde,_0x514c('0x16'));_0x1a84e5(_0x1bbb57[_0x514c('0x1b')]['message']);}})[_0x514c('0x1c')](function(_0x3b2ab0){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x27ffde,_0x3b2ab0);_0x27b85a(_0x3b2ab0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 31962ce..1c6e6bc 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 _0x33f2=['remove','update','emit','removeListener','register','voicePrefix:','save'];(function(_0x45145a,_0x151315){var _0xe85329=function(_0x5d7a25){while(--_0x5d7a25){_0x45145a['push'](_0x45145a['shift']());}};_0xe85329(++_0x151315);}(_0x33f2,0x68));var _0x233f=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x33f2[_0xe30e17];return _0x2342c9;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x233f('0x0'),_0x233f('0x1'),_0x233f('0x2')];function createListener(_0x2bc0b5,_0x6c379){return function(_0x4b0025){_0x6c379[_0x233f('0x3')](_0x2bc0b5,_0x4b0025);};}function removeListener(_0x12e176,_0x260c5c){return function(){VoicePrefixEvents[_0x233f('0x4')](_0x12e176,_0x260c5c);};}exports[_0x233f('0x5')]=function(_0x2ace32){for(var _0x559968=0x0,_0x1235de=events['length'];_0x559968<_0x1235de;_0x559968++){var _0x5c553f=events[_0x559968];var _0x257a5d=createListener(_0x233f('0x6')+_0x5c553f,_0x2ace32);VoicePrefixEvents['on'](_0x5c553f,_0x257a5d);}}; \ No newline at end of file +var _0x2b19=['./voicePrefix.events','emit','removeListener','voicePrefix:'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x2b19,0x70));var _0x92b1=function(_0x5e1395,_0x23d57c){_0x5e1395=_0x5e1395-0x0;var _0x4b7991=_0x2b19[_0x5e1395];return _0x4b7991;};'use strict';var VoicePrefixEvents=require(_0x92b1('0x0'));var events=['save','remove','update'];function createListener(_0x2411aa,_0x3a48b4){return function(_0xa7e235){_0x3a48b4[_0x92b1('0x1')](_0x2411aa,_0xa7e235);};}function removeListener(_0x51a280,_0x151c18){return function(){VoicePrefixEvents[_0x92b1('0x2')](_0x51a280,_0x151c18);};}exports['register']=function(_0xb4fa04){for(var _0x26826c=0x0,_0x39f91d=events['length'];_0x26826c<_0x39f91d;_0x26826c++){var _0x2e96f1=events[_0x26826c];var _0x2e24d0=createListener(_0x92b1('0x3')+_0x2e96f1,_0xb4fa04);VoicePrefixEvents['on'](_0x2e96f1,_0x2e24d0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index cf1f232..a24dae8 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 _0xc570=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','/:id/lists','getLists','getBlackLists','create','/:id/clone','clone','addTeams','post','/:id/users','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express'];(function(_0x42377b,_0x244ddc){var _0x3090ab=function(_0x2413b3){while(--_0x2413b3){_0x42377b['push'](_0x42377b['shift']());}};_0x3090ab(++_0x244ddc);}(_0xc570,0x1d4));var _0x0c57=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xc570[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x0c57('0x0'));var util=require(_0x0c57('0x1'));var path=require(_0x0c57('0x2'));var timeout=require(_0x0c57('0x3'));var express=require(_0x0c57('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c57('0x5'));var controller=require('./voiceQueue.controller');router[_0x0c57('0x6')]('/',auth['isAuthenticated'](),controller[_0x0c57('0x7')]);router[_0x0c57('0x6')](_0x0c57('0x8'),auth[_0x0c57('0x9')](),controller[_0x0c57('0xa')]);router[_0x0c57('0x6')](_0x0c57('0xb'),auth[_0x0c57('0x9')](),controller[_0x0c57('0xc')]);router['get'](_0x0c57('0xd'),auth[_0x0c57('0x9')](),controller[_0x0c57('0xe')]);router['get'](_0x0c57('0xf'),auth[_0x0c57('0x9')](),controller['getHopperFinals']);router[_0x0c57('0x6')](_0x0c57('0x10'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x11')]);router[_0x0c57('0x6')](_0x0c57('0x12'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x13')]);router['get']('/:id/users',auth[_0x0c57('0x9')](),controller[_0x0c57('0x14')]);router[_0x0c57('0x6')](_0x0c57('0x15'),auth['isAuthenticated'](),controller['getMembers']);router[_0x0c57('0x6')](_0x0c57('0x16'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x17')]);router[_0x0c57('0x6')]('/:id/blacklists',auth[_0x0c57('0x9')](),controller[_0x0c57('0x18')]);router['post']('/',auth[_0x0c57('0x9')](),controller[_0x0c57('0x19')]);router['post'](_0x0c57('0x1a'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x1b')]);router['post'](_0x0c57('0x12'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x1c')]);router[_0x0c57('0x1d')](_0x0c57('0x1e'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x1f')]);router[_0x0c57('0x1d')](_0x0c57('0x16'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x20')]);router[_0x0c57('0x1d')](_0x0c57('0x21'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x22')]);router[_0x0c57('0x23')](_0x0c57('0x8'),auth['isAuthenticated'](),controller[_0x0c57('0x24')]);router[_0x0c57('0x25')](_0x0c57('0x8'),auth[_0x0c57('0x9')](),controller[_0x0c57('0x26')]);router[_0x0c57('0x25')]('/:id/teams',auth[_0x0c57('0x9')](),controller[_0x0c57('0x27')]);router[_0x0c57('0x25')]('/:id/users',auth[_0x0c57('0x9')](),controller[_0x0c57('0x28')]);router[_0x0c57('0x25')](_0x0c57('0x16'),auth['isAuthenticated'](),controller[_0x0c57('0x29')]);router[_0x0c57('0x25')]('/:id/blacklists',auth[_0x0c57('0x9')](),controller[_0x0c57('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xc6be=['removeAgents','removeLists','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','get','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','/:id/teams','addTeams','addAgents','addLists','/:id/blacklists','put','update','delete','destroy','removeTeams','/:id/users'];(function(_0x383f85,_0x3d72e3){var _0x306b81=function(_0x5abe7d){while(--_0x5abe7d){_0x383f85['push'](_0x383f85['shift']());}};_0x306b81(++_0x3d72e3);}(_0xc6be,0xd5));var _0xec6b=function(_0x4eefc3,_0x299c6d){_0x4eefc3=_0x4eefc3-0x0;var _0x1460a9=_0xc6be[_0x4eefc3];return _0x1460a9;};'use strict';var multer=require(_0xec6b('0x0'));var util=require(_0xec6b('0x1'));var path=require(_0xec6b('0x2'));var timeout=require(_0xec6b('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xec6b('0x4'));var config=require(_0xec6b('0x5'));var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xec6b('0x6')](),controller[_0xec6b('0x7')]);router['get'](_0xec6b('0x8'),auth[_0xec6b('0x6')](),controller['show']);router['get'](_0xec6b('0x9'),auth[_0xec6b('0x6')](),controller[_0xec6b('0xa')]);router[_0xec6b('0xb')](_0xec6b('0xc'),auth[_0xec6b('0x6')](),controller[_0xec6b('0xd')]);router[_0xec6b('0xb')]('/:id/hopper_finals',auth[_0xec6b('0x6')](),controller[_0xec6b('0xe')]);router[_0xec6b('0xb')](_0xec6b('0xf'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x10')]);router[_0xec6b('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0xec6b('0x11')]);router[_0xec6b('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xec6b('0x12')]);router[_0xec6b('0xb')](_0xec6b('0x13'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x14')]);router[_0xec6b('0xb')](_0xec6b('0x15'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x16')]);router[_0xec6b('0xb')]('/:id/blacklists',auth[_0xec6b('0x6')](),controller[_0xec6b('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec6b('0x18')]);router[_0xec6b('0x19')](_0xec6b('0x1a'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x1b')]);router[_0xec6b('0x19')](_0xec6b('0x1c'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x1d')]);router[_0xec6b('0x19')]('/:id/users',auth[_0xec6b('0x6')](),controller[_0xec6b('0x1e')]);router[_0xec6b('0x19')](_0xec6b('0x15'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x1f')]);router[_0xec6b('0x19')](_0xec6b('0x20'),auth[_0xec6b('0x6')](),controller['addBlackLists']);router[_0xec6b('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xec6b('0x22')]);router[_0xec6b('0x23')](_0xec6b('0x8'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x24')]);router[_0xec6b('0x23')](_0xec6b('0x1c'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x25')]);router['delete'](_0xec6b('0x26'),auth[_0xec6b('0x6')](),controller[_0xec6b('0x27')]);router[_0xec6b('0x23')](_0xec6b('0x15'),auth['isAuthenticated'](),controller[_0xec6b('0x28')]);router[_0xec6b('0x23')](_0xec6b('0x20'),auth[_0xec6b('0x6')](),controller['removeBlackLists']);module[_0xec6b('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 294ec61..88e4325 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\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','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x35b0d3,_0x15f5d8){var _0x1e20ea=function(_0x44683f){while(--_0x44683f){_0x35b0d3['push'](_0x35b0d3['shift']());}};_0x1e20ea(++_0x15f5d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\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','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x52d74f,_0x4b101e){var _0x5a59f3=function(_0x1c63b4){while(--_0x1c63b4){_0x52d74f['push'](_0x52d74f['shift']());}};_0x5a59f3(++_0x4b101e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index d15cc28..bae4d15 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 _0x4906=['include','findAll','rows','catch','show','params','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','getHoppers','findOne','hasOwnProperty','order','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','isEmpty','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','User','all','removeAgents','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','select','phone','NOW()','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','ListId','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','send','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VoiceQueue','count','includeAll'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x4906,0x6b));var _0x6490=function(_0x78ba23,_0xa8295e){_0x78ba23=_0x78ba23-0x0;var _0xce6d4b=_0x4906[_0x78ba23];return _0xce6d4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6490('0x0'));var rimraf=require(_0x6490('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6490('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6490('0x3'));var util=require(_0x6490('0x4'));var path=require(_0x6490('0x5'));var sox=require(_0x6490('0x6'));var csv=require(_0x6490('0x7'));var ejs=require(_0x6490('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6490('0x9'));var crypto=require(_0x6490('0xa'));var jsforce=require(_0x6490('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6490('0x7'));var querystring=require(_0x6490('0xc'));var Papa=require(_0x6490('0xd'));var Redis=require(_0x6490('0xe'));var authService=require(_0x6490('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6490('0x10'));var hardwareService=require(_0x6490('0x11'));var logger=require(_0x6490('0x12'))(_0x6490('0x13'));var utils=require('../../config/utils');var config=require(_0x6490('0x14'));var licenseUtil=require(_0x6490('0x15'));var db=require('../../mysqldb')['db'];config[_0x6490('0x16')]=_[_0x6490('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6490('0x18'))(new Redis(config[_0x6490('0x16')]));require(_0x6490('0x19'))[_0x6490('0x1a')](socket);function respondWithStatusCode(_0x32a6e9,_0x388ec4){_0x388ec4=_0x388ec4||0xcc;return function(_0x42b70c){if(_0x42b70c){return _0x32a6e9[_0x6490('0x1b')](_0x388ec4);}return _0x32a6e9[_0x6490('0x1c')](_0x388ec4)[_0x6490('0x1d')]();};}function respondWithResult(_0x1c41f6,_0x13c2a6){_0x13c2a6=_0x13c2a6||0xc8;return function(_0x206657){if(_0x206657){return _0x1c41f6[_0x6490('0x1c')](_0x13c2a6)['json'](_0x206657);}};}function respondWithFilteredResult(_0x19d839,_0x3cf79d){return function(_0x26a524){if(_0x26a524){var _0x18030a=_0x26a524['count'],_0x4f1272=_0x3cf79d[_0x6490('0x1e')],_0x352439=_0x3cf79d[_0x6490('0x1e')]+_0x3cf79d[_0x6490('0x1f')],_0x469c67;if(_0x352439>=_0x18030a){_0x352439=_0x18030a;_0x469c67=0xc8;}else{_0x469c67=0xce;}_0x19d839[_0x6490('0x1c')](_0x469c67);return _0x19d839[_0x6490('0x20')]('Content-Range',_0x4f1272+'-'+_0x352439+'/'+_0x18030a)[_0x6490('0x21')](_0x26a524);}return null;};}function patchUpdates(_0x5bba2f){return function(_0x43a01e){try{jsonpatch[_0x6490('0x22')](_0x43a01e,_0x5bba2f,!![]);}catch(_0x44fe9e){return BPromise[_0x6490('0x23')](_0x44fe9e);}return _0x43a01e[_0x6490('0x24')]();};}function saveUpdates(_0x1d17be,_0x3c2d87){return function(_0x3e129a){if(_0x3e129a){return _0x3e129a[_0x6490('0x25')](_0x1d17be)[_0x6490('0x26')](function(_0x48b8d1){return _0x48b8d1;});}return null;};}function removeEntity(_0x1f3129,_0xaf85cc){return function(_0x7551c1){if(_0x7551c1){return _0x7551c1[_0x6490('0x27')]()[_0x6490('0x26')](function(){var _0x11fe92=_0x7551c1[_0x6490('0x28')]({'plain':!![]});var _0x5d6c25=[{'name':'VoiceQueues','value':_0x6490('0x29'),'ignore':![]},{'name':_0x6490('0x2a'),'value':_0x6490('0x2b'),'ignore':![]}];var _0x270bfd=_(_0x5d6c25)[_0x6490('0x2c')](_0x6490('0x2d'))[_0x6490('0x2e')](_0x6490('0x2f'))[_0x6490('0x2f')]();if(_[_0x6490('0x30')](_0x270bfd,_0x11fe92['type'])){return;}var _0x2ec3a0=_[_0x6490('0x31')](_0x5d6c25,[_0x6490('0x2f'),_0x11fe92[_0x6490('0x32')]])[_0x6490('0x33')];return db[_0x6490('0x34')][_0x6490('0x27')]({'where':{'type':_0x2ec3a0,'resourceId':_0x11fe92['id']}})[_0x6490('0x26')](function(){return _0x7551c1;});})[_0x6490('0x26')](function(){_0x1f3129['status'](0xcc)[_0x6490('0x1d')]();});}};}function handleEntityNotFound(_0x3411a4,_0x2f803e){return function(_0xba9874){if(!_0xba9874){_0x3411a4[_0x6490('0x1b')](0x194);}return _0xba9874;};}function handleError(_0x5b23e5,_0x188f0c){_0x188f0c=_0x188f0c||0x1f4;return function(_0x2429b0){logger[_0x6490('0x35')](_0x2429b0['stack']);if(_0x2429b0[_0x6490('0x33')]){delete _0x2429b0[_0x6490('0x33')];}_0x5b23e5[_0x6490('0x1c')](_0x188f0c)[_0x6490('0x36')](_0x2429b0);};}exports['index']=function(_0x56191f,_0x2600cc){var _0x4f6ce0={},_0x7a7c62={},_0x1ca9b6={'count':0x0,'rows':[]};var _0xacf7d8=_[_0x6490('0x2e')](db['VoiceQueue']['rawAttributes'],function(_0x3946ba){return{'name':_0x3946ba[_0x6490('0x37')],'type':_0x3946ba['type']['key']};});_0x7a7c62[_0x6490('0x38')]=_[_0x6490('0x2e')](_0xacf7d8,_0x6490('0x33'));_0x7a7c62[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x56191f['query']);_0x7a7c62[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x7a7c62['model'],_0x7a7c62[_0x6490('0x39')]);_0x4f6ce0[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x7a7c62[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x56191f[_0x6490('0x39')][_0x6490('0x3e')]));_0x4f6ce0[_0x6490('0x3d')]=_0x4f6ce0[_0x6490('0x3d')][_0x6490('0x3f')]?_0x4f6ce0['attributes']:_0x7a7c62[_0x6490('0x38')];if(!_0x56191f[_0x6490('0x39')]['hasOwnProperty'](_0x6490('0x40'))){_0x4f6ce0['limit']=qs[_0x6490('0x1f')](_0x56191f[_0x6490('0x39')][_0x6490('0x1f')]);_0x4f6ce0[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x56191f[_0x6490('0x39')]['offset']);}_0x4f6ce0['order']=qs[_0x6490('0x41')](_0x56191f[_0x6490('0x39')][_0x6490('0x41')]);_0x4f6ce0[_0x6490('0x42')]=qs[_0x6490('0x3b')](_[_0x6490('0x43')](_0x56191f['query'],_0x7a7c62[_0x6490('0x3b')]),_0xacf7d8);if(_0x56191f[_0x6490('0x39')][_0x6490('0x2c')]){_0x4f6ce0[_0x6490('0x42')]=_[_0x6490('0x44')](_0x4f6ce0['where'],{'$or':_[_0x6490('0x2e')](_0xacf7d8,function(_0x1cda7d){if(_0x1cda7d[_0x6490('0x32')]!=='VIRTUAL'){var _0x240ce4={};_0x240ce4[_0x1cda7d['name']]={'$like':'%'+_0x56191f['query']['filter']+'%'};return _0x240ce4;}})});}_0x4f6ce0=_[_0x6490('0x44')]({},_0x4f6ce0,_0x56191f['options']);var _0x531d28={'where':_0x4f6ce0['where']};return db[_0x6490('0x45')]['count'](_0x531d28)[_0x6490('0x26')](function(_0x5c0ead){_0x1ca9b6[_0x6490('0x46')]=_0x5c0ead;if(_0x56191f[_0x6490('0x39')][_0x6490('0x47')]){_0x4f6ce0[_0x6490('0x48')]=[{'all':!![]}];}return db[_0x6490('0x45')][_0x6490('0x49')](_0x4f6ce0);})[_0x6490('0x26')](function(_0x2664bb){_0x1ca9b6[_0x6490('0x4a')]=_0x2664bb;return _0x1ca9b6;})[_0x6490('0x26')](respondWithFilteredResult(_0x2600cc,_0x4f6ce0))[_0x6490('0x4b')](handleError(_0x2600cc,null));};exports[_0x6490('0x4c')]=function(_0x4dd63f,_0x4fa069){var _0x100cdf={'raw':![],'where':{'id':_0x4dd63f[_0x6490('0x4d')]['id']}},_0x4d230b={};_0x4d230b[_0x6490('0x38')]=_['keys'](db[_0x6490('0x45')][_0x6490('0x4e')]);_0x4d230b['query']=_[_0x6490('0x3a')](_0x4dd63f[_0x6490('0x39')]);_0x4d230b[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x4d230b['model'],_0x4d230b['query']);_0x100cdf['attributes']=_[_0x6490('0x3c')](_0x4d230b[_0x6490('0x38')],qs['fields'](_0x4dd63f['query'][_0x6490('0x3e')]));_0x100cdf[_0x6490('0x3d')]=_0x100cdf[_0x6490('0x3d')][_0x6490('0x3f')]?_0x100cdf[_0x6490('0x3d')]:_0x4d230b[_0x6490('0x38')];if(_0x4dd63f['query'][_0x6490('0x47')]){_0x100cdf[_0x6490('0x48')]=[{'all':!![]}];}_0x100cdf=_[_0x6490('0x44')]({},_0x100cdf,_0x4dd63f[_0x6490('0x4f')]);return db[_0x6490('0x45')][_0x6490('0x31')](_0x100cdf)[_0x6490('0x26')](handleEntityNotFound(_0x4fa069,null))[_0x6490('0x26')](respondWithResult(_0x4fa069,null))[_0x6490('0x4b')](handleError(_0x4fa069,null));};exports[_0x6490('0x50')]=function(_0x5c1c5e,_0x3f7ac6){return db['VoiceQueue']['create'](_0x5c1c5e[_0x6490('0x51')],{})[_0x6490('0x26')](function(_0x572e97){var _0xb72f0c=_0x5c1c5e['user'][_0x6490('0x28')]({'plain':!![]});if(!_0xb72f0c)throw new Error(_0x6490('0x52'));if(_0xb72f0c[_0x6490('0x53')]===_0x6490('0x54')){var _0x24f588=_0x572e97[_0x6490('0x28')]({'plain':!![]});var _0x360ee1=[{'name':_0x6490('0x55'),'value':'inbound'},{'name':_0x6490('0x2a'),'value':_0x6490('0x2b')}];var _0x3aa221=_['find'](_0x360ee1,[_0x6490('0x2f'),_0x24f588[_0x6490('0x32')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x3aa221,'userProfileId':_0xb72f0c[_0x6490('0x56')]},'raw':!![]})['then'](function(_0x566ffc){if(_0x566ffc&&_0x566ffc[_0x6490('0x57')]===0x0){return db[_0x6490('0x34')][_0x6490('0x50')]({'name':_0x24f588[_0x6490('0x33')],'resourceId':_0x24f588['id'],'type':_0x566ffc[_0x6490('0x33')],'sectionId':_0x566ffc['id']},{})[_0x6490('0x26')](function(){return _0x572e97;});}else{return _0x572e97;}})[_0x6490('0x4b')](function(_0xfd8d2){logger[_0x6490('0x35')](_0x6490('0x58'),_0xfd8d2);throw _0xfd8d2;});}return _0x572e97;})[_0x6490('0x26')](respondWithResult(_0x3f7ac6,0xc9))[_0x6490('0x4b')](handleError(_0x3f7ac6,null));};exports[_0x6490('0x59')]=function(_0x1d6381,_0x696abb){var _0x519ae0={'where':{'id':_0x1d6381[_0x6490('0x4d')]['id']}},_0x77795f={};_0x77795f[_0x6490('0x38')]=_[_0x6490('0x3a')](db['VoiceQueue'][_0x6490('0x4e')]);_0x519ae0[_0x6490('0x3d')]=_['intersection'](_0x77795f[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x1d6381['query']['fields']));_0x519ae0[_0x6490('0x3d')]=_0x519ae0[_0x6490('0x3d')][_0x6490('0x3f')]?_0x519ae0[_0x6490('0x3d')]:_0x77795f['model'];if(_0x1d6381[_0x6490('0x39')][_0x6490('0x47')]){_0x519ae0['include']=[{'all':!![]}];}_0x519ae0=_[_0x6490('0x44')]({},_0x519ae0,_0x1d6381[_0x6490('0x4f')]);return db[_0x6490('0x45')][_0x6490('0x31')](_0x519ae0)[_0x6490('0x26')](handleEntityNotFound(_0x696abb,null))[_0x6490('0x26')](function(_0x35ad89){if(_0x35ad89){var _0x173eb6=_0x35ad89['get']({'plain':!![]});_0x173eb6=qs['omit'](_0x173eb6,['id',_0x6490('0x5a'),_0x6490('0x5b')]);_0x1d6381[_0x6490('0x51')]=_[_0x6490('0x5c')](_0x1d6381[_0x6490('0x51')],['id',_0x6490('0x5a'),'updatedAt']);return db[_0x6490('0x45')][_0x6490('0x50')](_[_0x6490('0x44')](_0x173eb6,_0x1d6381[_0x6490('0x51')]),{'include':_0x1d6381[_0x6490('0x39')][_0x6490('0x47')]?[{'all':!![]}]:undefined})[_0x6490('0x26')](function(_0x407c71){var _0x5d98fc=_0x1d6381[_0x6490('0x54')]['get']({'plain':!![]});if(!_0x5d98fc)throw new Error(_0x6490('0x52'));if(_0x5d98fc[_0x6490('0x53')]===_0x6490('0x54')){var _0x372bc8=_0x407c71[_0x6490('0x28')]({'plain':!![]});var _0x5c402e=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x6490('0x2a'),'value':_0x6490('0x2b')}];var _0x24c3a2=_[_0x6490('0x31')](_0x5c402e,['value',_0x372bc8[_0x6490('0x32')]])['name'];return db['UserProfileSection'][_0x6490('0x31')]({'where':{'name':_0x24c3a2,'userProfileId':_0x5d98fc[_0x6490('0x56')]},'raw':!![]})[_0x6490('0x26')](function(_0x59a08c){if(_0x59a08c&&_0x59a08c[_0x6490('0x57')]===0x0){return db[_0x6490('0x34')][_0x6490('0x50')]({'name':_0x372bc8[_0x6490('0x33')],'resourceId':_0x372bc8['id'],'type':_0x59a08c[_0x6490('0x33')],'sectionId':_0x59a08c['id']},{})[_0x6490('0x26')](function(){return _0x407c71;});}else{return _0x407c71;}})[_0x6490('0x4b')](function(_0x3eade9){logger[_0x6490('0x35')](_0x6490('0x58'),_0x3eade9);throw _0x3eade9;});}return _0x407c71;});}})[_0x6490('0x26')](respondWithResult(_0x696abb,0xc9))[_0x6490('0x4b')](handleError(_0x696abb,null));};exports[_0x6490('0x25')]=function(_0x5981ac,_0x587992){if(_0x5981ac[_0x6490('0x51')]['id']){delete _0x5981ac[_0x6490('0x51')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x5981ac[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x587992,null))[_0x6490('0x26')](saveUpdates(_0x5981ac[_0x6490('0x51')],null))['then'](respondWithResult(_0x587992,null))['catch'](handleError(_0x587992,null));};exports[_0x6490('0x27')]=function(_0x4bab98,_0x5063e9){return db['VoiceQueue'][_0x6490('0x31')]({'where':{'id':_0x4bab98[_0x6490('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5063e9,null))[_0x6490('0x26')](removeEntity(_0x5063e9,null))[_0x6490('0x4b')](handleError(_0x5063e9,null));};exports[_0x6490('0x5d')]=function(_0x5ebecb,_0x572534,_0x32cacd){var _0x1456b1={'raw':![],'where':{}};var _0x2b4861={};var _0x54fe95={'count':0x0,'rows':[]};return db[_0x6490('0x45')][_0x6490('0x5e')]({'where':{'id':_0x5ebecb[_0x6490('0x4d')]['id']}})['then'](handleEntityNotFound(_0x572534,null))['then'](function(_0x2c03bb){if(_0x2c03bb){_0x2b4861[_0x6490('0x38')]=_['keys'](db['CmHopper']['rawAttributes']);_0x2b4861[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x5ebecb['query']);_0x2b4861['filters']=_[_0x6490('0x3c')](_0x2b4861['model'],_0x2b4861[_0x6490('0x39')]);_0x1456b1[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x2b4861[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x5ebecb['query'][_0x6490('0x3e')]));_0x1456b1[_0x6490('0x3d')]=_0x1456b1['attributes'][_0x6490('0x3f')]?_0x1456b1['attributes']:_0x2b4861[_0x6490('0x38')];if(!_0x5ebecb[_0x6490('0x39')][_0x6490('0x5f')]('nolimit')){_0x1456b1[_0x6490('0x1f')]=qs[_0x6490('0x1f')](_0x5ebecb[_0x6490('0x39')]['limit']);_0x1456b1[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x5ebecb[_0x6490('0x39')][_0x6490('0x1e')]);}_0x1456b1[_0x6490('0x60')]=qs[_0x6490('0x41')](_0x5ebecb[_0x6490('0x39')]['sort']);_0x1456b1['where']=qs[_0x6490('0x3b')](_['pick'](_0x5ebecb['query'],_0x2b4861[_0x6490('0x3b')]));_0x1456b1[_0x6490('0x42')][_0x6490('0x61')]=_0x2c03bb['id'];if(_0x5ebecb[_0x6490('0x39')][_0x6490('0x2c')]){_0x1456b1[_0x6490('0x42')]=_['merge'](_0x1456b1[_0x6490('0x42')],{'$or':_['map'](_0x1456b1['attributes'],function(_0x2a5be9){var _0x5a071c={};_0x5a071c[_0x2a5be9]={'$like':'%'+_0x5ebecb[_0x6490('0x39')][_0x6490('0x2c')]+'%'};return _0x5a071c;})});}_0x1456b1=_[_0x6490('0x44')]({},_0x1456b1,_0x5ebecb[_0x6490('0x4f')]);return db['CmHopper'][_0x6490('0x46')]({'where':_0x1456b1[_0x6490('0x42')]})[_0x6490('0x26')](function(_0x5c5586){_0x54fe95[_0x6490('0x46')]=_0x5c5586;if(_0x5ebecb[_0x6490('0x39')]['includeAll']){_0x1456b1[_0x6490('0x48')]=[{'all':!![]}];}return db[_0x6490('0x62')][_0x6490('0x49')](_0x1456b1);})[_0x6490('0x26')](function(_0x527c2f){_0x54fe95[_0x6490('0x4a')]=_0x527c2f;return _0x54fe95;});}})[_0x6490('0x26')](respondWithFilteredResult(_0x572534,_0x1456b1))[_0x6490('0x4b')](handleError(_0x572534,null));};exports[_0x6490('0x63')]=function(_0xc79295,_0x4406d4,_0x3b54c5){var _0x2dbb5f={'raw':!![],'where':{}};var _0x2dcf23={};var _0x530f2b={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xc79295[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x4406d4,null))[_0x6490('0x26')](function(_0x5d0b63){if(_0x5d0b63){_0x2dcf23[_0x6490('0x38')]=_['keys'](db[_0x6490('0x64')][_0x6490('0x4e')]);_0x2dcf23[_0x6490('0x39')]=_[_0x6490('0x3a')](_0xc79295[_0x6490('0x39')]);_0x2dcf23[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x2dcf23[_0x6490('0x38')],_0x2dcf23[_0x6490('0x39')]);_0x2dbb5f[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x2dcf23['model'],qs[_0x6490('0x3e')](_0xc79295[_0x6490('0x39')][_0x6490('0x3e')]));_0x2dbb5f[_0x6490('0x3d')]=_0x2dbb5f[_0x6490('0x3d')]['length']?_0x2dbb5f[_0x6490('0x3d')]:_0x2dcf23['model'];if(!_0xc79295['query'][_0x6490('0x5f')](_0x6490('0x40'))){_0x2dbb5f[_0x6490('0x1f')]=qs[_0x6490('0x1f')](_0xc79295[_0x6490('0x39')][_0x6490('0x1f')]);_0x2dbb5f[_0x6490('0x1e')]=qs['offset'](_0xc79295[_0x6490('0x39')][_0x6490('0x1e')]);}_0x2dbb5f['order']=qs[_0x6490('0x41')](_0xc79295['query']['sort']);_0x2dbb5f[_0x6490('0x42')]=qs['filters'](_['pick'](_0xc79295['query'],_0x2dcf23[_0x6490('0x3b')]));_0x2dbb5f['where']['VoiceQueueId']=_0x5d0b63['id'];if(_0xc79295[_0x6490('0x39')]['filter']){_0x2dbb5f[_0x6490('0x42')]=_[_0x6490('0x44')](_0x2dbb5f[_0x6490('0x42')],{'$or':_['map'](_0x2dbb5f[_0x6490('0x3d')],function(_0x378aaf){var _0x89be81={};_0x89be81[_0x378aaf]={'$like':'%'+_0xc79295['query'][_0x6490('0x2c')]+'%'};return _0x89be81;})});}_0x2dbb5f=_[_0x6490('0x44')]({},_0x2dbb5f,_0xc79295['options']);return db['CmHopperHistory'][_0x6490('0x46')]({'where':_0x2dbb5f[_0x6490('0x42')]})[_0x6490('0x26')](function(_0x508b4e){_0x530f2b['count']=_0x508b4e;if(_0xc79295[_0x6490('0x39')][_0x6490('0x47')]){_0x2dbb5f['include']=[{'all':!![]}];}return db[_0x6490('0x64')][_0x6490('0x49')](_0x2dbb5f);})[_0x6490('0x26')](function(_0x279f35){_0x530f2b['rows']=_0x279f35;return _0x530f2b;});}})[_0x6490('0x26')](respondWithFilteredResult(_0x4406d4,_0x2dbb5f))[_0x6490('0x4b')](handleError(_0x4406d4,null));};exports['getHopperFinals']=function(_0x375ea2,_0x5c2dff,_0x3874f2){var _0x50bb9a={'raw':!![],'where':{}};var _0x5ea77a={};var _0x171fdd={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x375ea2[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x5c2dff,null))[_0x6490('0x26')](function(_0x5a25fc){if(_0x5a25fc){_0x5ea77a[_0x6490('0x38')]=_[_0x6490('0x3a')](db[_0x6490('0x65')][_0x6490('0x4e')]);_0x5ea77a[_0x6490('0x39')]=_['keys'](_0x375ea2[_0x6490('0x39')]);_0x5ea77a[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x5ea77a[_0x6490('0x38')],_0x5ea77a[_0x6490('0x39')]);_0x50bb9a['attributes']=_[_0x6490('0x3c')](_0x5ea77a[_0x6490('0x38')],qs['fields'](_0x375ea2[_0x6490('0x39')]['fields']));_0x50bb9a['attributes']=_0x50bb9a[_0x6490('0x3d')][_0x6490('0x3f')]?_0x50bb9a[_0x6490('0x3d')]:_0x5ea77a['model'];if(!_0x375ea2[_0x6490('0x39')][_0x6490('0x5f')](_0x6490('0x40'))){_0x50bb9a[_0x6490('0x1f')]=qs[_0x6490('0x1f')](_0x375ea2[_0x6490('0x39')][_0x6490('0x1f')]);_0x50bb9a[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x375ea2[_0x6490('0x39')][_0x6490('0x1e')]);}_0x50bb9a['order']=qs[_0x6490('0x41')](_0x375ea2[_0x6490('0x39')][_0x6490('0x41')]);_0x50bb9a[_0x6490('0x42')]=qs[_0x6490('0x3b')](_['pick'](_0x375ea2[_0x6490('0x39')],_0x5ea77a['filters']));_0x50bb9a[_0x6490('0x42')][_0x6490('0x61')]=_0x5a25fc['id'];if(_0x375ea2[_0x6490('0x39')][_0x6490('0x2c')]){_0x50bb9a['where']=_[_0x6490('0x44')](_0x50bb9a[_0x6490('0x42')],{'$or':_[_0x6490('0x2e')](_0x50bb9a[_0x6490('0x3d')],function(_0x23b8d9){var _0x9d524c={};_0x9d524c[_0x23b8d9]={'$like':'%'+_0x375ea2[_0x6490('0x39')][_0x6490('0x2c')]+'%'};return _0x9d524c;})});}_0x50bb9a=_[_0x6490('0x44')]({},_0x50bb9a,_0x375ea2['options']);return db[_0x6490('0x65')][_0x6490('0x46')]({'where':_0x50bb9a['where']})['then'](function(_0x3ed39c){_0x171fdd[_0x6490('0x46')]=_0x3ed39c;if(_0x375ea2[_0x6490('0x39')]['includeAll']){_0x50bb9a[_0x6490('0x48')]=[{'all':!![]}];}return db[_0x6490('0x65')][_0x6490('0x49')](_0x50bb9a);})[_0x6490('0x26')](function(_0x2c03b8){_0x171fdd[_0x6490('0x4a')]=_0x2c03b8;return _0x171fdd;});}})[_0x6490('0x26')](respondWithFilteredResult(_0x5c2dff,_0x50bb9a))['catch'](handleError(_0x5c2dff,null));};exports[_0x6490('0x66')]=function(_0x52c3d8,_0x22d750,_0x4c6a85){var _0x2b7941={'raw':!![],'where':{}};var _0x3be020={};var _0x52b822={'count':0x0,'rows':[]};return db[_0x6490('0x45')][_0x6490('0x5e')]({'where':{'id':_0x52c3d8['params']['id']}})['then'](handleEntityNotFound(_0x22d750,null))['then'](function(_0x32ab2e){if(_0x32ab2e){_0x3be020[_0x6490('0x38')]=_[_0x6490('0x3a')](db['CmHopperBlack']['rawAttributes']);_0x3be020['query']=_[_0x6490('0x3a')](_0x52c3d8[_0x6490('0x39')]);_0x3be020['filters']=_[_0x6490('0x3c')](_0x3be020[_0x6490('0x38')],_0x3be020[_0x6490('0x39')]);_0x2b7941[_0x6490('0x3d')]=_['intersection'](_0x3be020[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x52c3d8['query']['fields']));_0x2b7941[_0x6490('0x3d')]=_0x2b7941[_0x6490('0x3d')][_0x6490('0x3f')]?_0x2b7941[_0x6490('0x3d')]:_0x3be020[_0x6490('0x38')];if(!_0x52c3d8[_0x6490('0x39')][_0x6490('0x5f')](_0x6490('0x40'))){_0x2b7941['limit']=qs[_0x6490('0x1f')](_0x52c3d8[_0x6490('0x39')][_0x6490('0x1f')]);_0x2b7941['offset']=qs[_0x6490('0x1e')](_0x52c3d8['query'][_0x6490('0x1e')]);}_0x2b7941[_0x6490('0x60')]=qs[_0x6490('0x41')](_0x52c3d8[_0x6490('0x39')][_0x6490('0x41')]);_0x2b7941[_0x6490('0x42')]=qs['filters'](_[_0x6490('0x43')](_0x52c3d8[_0x6490('0x39')],_0x3be020[_0x6490('0x3b')]));_0x2b7941[_0x6490('0x42')][_0x6490('0x61')]=_0x32ab2e['id'];if(_0x52c3d8['query'][_0x6490('0x2c')]){_0x2b7941[_0x6490('0x42')]=_[_0x6490('0x44')](_0x2b7941[_0x6490('0x42')],{'$or':_['map'](_0x2b7941[_0x6490('0x3d')],function(_0x172e8b){var _0x55208a={};_0x55208a[_0x172e8b]={'$like':'%'+_0x52c3d8['query'][_0x6490('0x2c')]+'%'};return _0x55208a;})});}_0x2b7941=_[_0x6490('0x44')]({},_0x2b7941,_0x52c3d8[_0x6490('0x4f')]);return db['CmHopperBlack']['count']({'where':_0x2b7941['where']})[_0x6490('0x26')](function(_0x174c25){_0x52b822[_0x6490('0x46')]=_0x174c25;if(_0x52c3d8[_0x6490('0x39')][_0x6490('0x47')]){_0x2b7941[_0x6490('0x48')]=[{'all':!![]}];}return db[_0x6490('0x67')][_0x6490('0x49')](_0x2b7941);})['then'](function(_0x55c3d7){_0x52b822[_0x6490('0x4a')]=_0x55c3d7;return _0x52b822;});}})[_0x6490('0x26')](respondWithFilteredResult(_0x22d750,_0x2b7941))[_0x6490('0x4b')](handleError(_0x22d750,null));};exports['getTeams']=function(_0x4c3311,_0xda1b6e,_0x41ff39){var _0x28b5b9={};var _0x13d238={};var _0x7fd45a;var _0x5be840;return db[_0x6490('0x45')][_0x6490('0x5e')]({'where':{'id':_0x4c3311['params']['id']}})[_0x6490('0x26')](handleEntityNotFound(_0xda1b6e,null))[_0x6490('0x26')](function(_0x44a04c){if(_0x44a04c){_0x7fd45a=_0x44a04c;_0x13d238[_0x6490('0x38')]=_[_0x6490('0x3a')](db[_0x6490('0x68')][_0x6490('0x4e')]);_0x13d238[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x4c3311['query']);_0x13d238[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x13d238['model'],_0x13d238[_0x6490('0x39')]);_0x28b5b9[_0x6490('0x3d')]=_['intersection'](_0x13d238[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x4c3311['query']['fields']));_0x28b5b9[_0x6490('0x3d')]=_0x28b5b9[_0x6490('0x3d')]['length']?_0x28b5b9[_0x6490('0x3d')]:_0x13d238[_0x6490('0x38')];_0x28b5b9['order']=qs['sort'](_0x4c3311[_0x6490('0x39')][_0x6490('0x41')]);_0x28b5b9[_0x6490('0x42')]=qs[_0x6490('0x3b')](_[_0x6490('0x43')](_0x4c3311[_0x6490('0x39')],_0x13d238[_0x6490('0x3b')]));if(_0x4c3311[_0x6490('0x39')][_0x6490('0x2c')]){_0x28b5b9['where']=_[_0x6490('0x44')](_0x28b5b9['where'],{'$or':_[_0x6490('0x2e')](_0x28b5b9[_0x6490('0x3d')],function(_0x5cd6e8){var _0x2e560c={};_0x2e560c[_0x5cd6e8]={'$like':'%'+_0x4c3311[_0x6490('0x39')][_0x6490('0x2c')]+'%'};return _0x2e560c;})});}_0x28b5b9=_[_0x6490('0x44')]({},_0x28b5b9,_0x4c3311[_0x6490('0x4f')]);return _0x7fd45a[_0x6490('0x69')](_0x28b5b9);}})[_0x6490('0x26')](function(_0x46d6b5){if(_0x46d6b5){_0x5be840=_0x46d6b5['length'];if(!_0x4c3311[_0x6490('0x39')][_0x6490('0x5f')](_0x6490('0x40'))){_0x28b5b9[_0x6490('0x1f')]=qs[_0x6490('0x1f')](_0x4c3311[_0x6490('0x39')][_0x6490('0x1f')]);_0x28b5b9[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x4c3311[_0x6490('0x39')]['offset']);}return _0x7fd45a[_0x6490('0x69')](_0x28b5b9);}})[_0x6490('0x26')](function(_0x5567e5){if(_0x5567e5){return _0x5567e5?{'count':_0x5be840,'rows':_0x5567e5}:null;}})[_0x6490('0x26')](respondWithResult(_0xda1b6e,null))[_0x6490('0x4b')](handleError(_0xda1b6e,null));};exports[_0x6490('0x6a')]=function(_0x4982b9,_0x1b77df,_0x234091){var _0xe7c50e=_0x4982b9[_0x6490('0x51')]['teams'];var _0x259e67=_['map'](_0xe7c50e,'id');return db[_0x6490('0x68')]['findAll']({'where':{'id':_0x259e67},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6490('0x6b'),'attributes':['id',_0x6490('0x33'),_0x6490('0x6c'),_0x6490('0x6d'),'interface'],'raw':!![]}]})[_0x6490('0x26')](function(_0xb57168){if(_0xb57168){var _0x418b3f=_[_0x6490('0x6e')](_0xb57168,function(_0x5793eb){var _0x317b51=_0x5793eb[_0x6490('0x28')]({'plain':!![]});_0x317b51[_0x6490('0x6b')][_0x6490('0x6f')](function(_0x284b61){_0x284b61[_0x6490('0x70')]=_[_0x6490('0x31')](_0xe7c50e,{'id':_0x317b51['id']})[_0x6490('0x70')];});return _0x317b51[_0x6490('0x6b')];});return db[_0x6490('0x45')]['find']({'where':{'id':_0x4982b9[_0x6490('0x4d')]['id']}})['then'](function(_0x33b920){return db[_0x6490('0x71')][_0x6490('0x72')](function(_0x55157e){return _0x33b920[_0x6490('0x6a')](_0x259e67,{'transaction':_0x55157e})[_0x6490('0x26')](function(){return BPromise[_0x6490('0x73')](_0x418b3f,function(_0x52627c){return db[_0x6490('0x74')][_0x6490('0x75')]({'where':{'UserId':_0x52627c['id'],'VoiceQueueId':_0x4982b9[_0x6490('0x4d')]['id']},'defaults':{'penalty':_0x52627c['penalty']},'transaction':_0x55157e});});})[_0x6490('0x26')](function(){return BPromise[_0x6490('0x73')](_['filter'](_0x418b3f,{'online':!![]}),function(_0x28efe7){return db['UserVoiceQueueRt'][_0x6490('0x76')]({'membername':_0x28efe7[_0x6490('0x33')],'UserId':_0x28efe7['id'],'queue_name':_0x33b920['name'],'VoiceQueueId':_0x33b920['id'],'interface':_[_0x6490('0x77')](_0x28efe7[_0x6490('0x78')])?util[_0x6490('0x79')]('SIP/%s',_0x28efe7['name']):_0x28efe7[_0x6490('0x78')],'paused':_0x28efe7['voicePause']||![],'penalty':_0x28efe7[_0x6490('0x70')]},{'transaction':_0x55157e});});})[_0x6490('0x26')](function(){_0x418b3f['forEach'](function(_0xc89c0e){socket[_0x6490('0x7a')](_0x6490('0x7b'),{'UserId':_0xc89c0e['id'],'VoiceQueueId':_0x33b920['id']});});});});});}})[_0x6490('0x26')](respondWithStatusCode(_0x1b77df,null))[_0x6490('0x4b')](handleError(_0x1b77df,null));};exports[_0x6490('0x7c')]=function(_0x1dc775,_0x1e61a3,_0xec4307){return db[_0x6490('0x68')][_0x6490('0x49')]({'where':{'id':_0x1dc775[_0x6490('0x39')][_0x6490('0x7d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6490('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e61a3,null))[_0x6490('0x26')](function(_0x22d939){var _0x15baaf=_[_0x6490('0x2e')](_0x22d939,'id');var _0x23494c=[];var _0x35184f=[];var _0x25a5cf=squel['select']();_0x25a5cf[_0x6490('0x7e')](_0x6490('0x7f'))[_0x6490('0x80')](_0x6490('0x81'),'tq')[_0x6490('0x82')](_0x6490('0x83'),'ut',_0x6490('0x84'))['where'](_0x6490('0x85'),_0x1dc775['params']['id']);for(var _0x33eb76=0x0;_0x33eb76<_0x22d939[_0x6490('0x3f')];_0x33eb76+=0x1){let _0x276291=_0x22d939[_0x33eb76];for(var _0x4f4a4e=0x0;_0x4f4a4e<_0x276291[_0x6490('0x6b')]['length'];_0x4f4a4e+=0x1){let _0x1eb41d=_0x276291[_0x6490('0x6b')][_0x4f4a4e];var _0x10446d=_0x25a5cf[_0x6490('0x59')]();_0x10446d[_0x6490('0x42')]('ut.UserId\x20=\x20?',_0x1eb41d['id']);_0x35184f[_0x6490('0x86')](db[_0x6490('0x71')][_0x6490('0x39')](_0x10446d['toString'](),{'type':db['sequelize'][_0x6490('0x87')][_0x6490('0x88')]})[_0x6490('0x26')](function(_0x1f657c){if(_0x1f657c[_0x6490('0x3f')]===0x1){return _0x1eb41d['id'];}else{var _0x45bbe7=_[_0x6490('0x89')](_[_0x6490('0x2e')](_0x1f657c,_0x6490('0x8a')),function(_0x3680df){return _[_0x6490('0x30')](_0x15baaf,_0x3680df);});if(_0x45bbe7){return _0x1eb41d['id'];}}}));}}return BPromise['all'](_0x35184f)[_0x6490('0x26')](function(_0x41a90a){_0x23494c=_(_0x23494c)[_0x6490('0x8b')](_0x41a90a)['compact']()['value']();return db['VoiceQueue'][_0x6490('0x31')]({'where':{'id':_0x1dc775['params']['id']}})[_0x6490('0x26')](function(_0xd50bf7){return db[_0x6490('0x71')][_0x6490('0x72')](function(_0x30c293){return _0xd50bf7[_0x6490('0x7c')](_0x1dc775[_0x6490('0x39')]['ids'],{'transaction':_0x30c293})['then'](function(){if(!_[_0x6490('0x8c')](_0x23494c)){return _0xd50bf7['removeAgents'](_0x23494c,{'transaction':_0x30c293})['then'](function(){return db[_0x6490('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x1dc775[_0x6490('0x4d')]['id'],'UserId':_0x23494c},'transaction':_0x30c293});});}})[_0x6490('0x26')](function(){_0x23494c[_0x6490('0x6f')](function(_0x35e4b1){socket[_0x6490('0x7a')](_0x6490('0x8e'),{'UserId':_0x35e4b1,'VoiceQueueId':_0xd50bf7['id']});});});});});});})[_0x6490('0x26')](respondWithStatusCode(_0x1e61a3,null))[_0x6490('0x4b')](handleError(_0x1e61a3,null));};exports[_0x6490('0x8f')]=function(_0x23baa9,_0x4d3957,_0x29e559){var _0x5e5a4b,_0x4fb340;return db[_0x6490('0x45')]['find']({'where':{'id':_0x23baa9[_0x6490('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4d3957,null))['then'](function(_0x165f03){if(_0x165f03){_0x4fb340=_0x165f03;return _0x165f03['addAgents'](_0x23baa9[_0x6490('0x51')]['ids'],_['omit'](_0x23baa9[_0x6490('0x51')],[_0x6490('0x7d'),'id'])||{})['spread'](function(_0x3f57a6){for(var _0xb4a679=0x0;_0xb4a679<_0x23baa9['body'][_0x6490('0x7d')][_0x6490('0x3f')];_0xb4a679+=0x1){socket[_0x6490('0x7a')]('userVoiceQueue:save',{'UserId':_0x23baa9[_0x6490('0x51')][_0x6490('0x7d')][_0xb4a679],'VoiceQueueId':_0x23baa9['params']['id']});}return _0x3f57a6;});}})['then'](function(_0x4e7e63){_0x5e5a4b=_0x4e7e63||[];if(_0x4fb340){return db[_0x6490('0x90')]['findAll']({'where':{'id':_0x23baa9[_0x6490('0x51')]['ids']},'attributes':['id','name',_0x6490('0x6c'),_0x6490('0x6d'),_0x6490('0x78')],'raw':!![]});}})[_0x6490('0x26')](function(_0x210238){if(!_[_0x6490('0x8c')](_0x210238)){var _0x1b4b29=[];for(var _0x26b79b=0x0;_0x26b79b<_0x210238[_0x6490('0x3f')];_0x26b79b++){if(_0x210238[_0x26b79b][_0x6490('0x6c')]){_0x1b4b29['push'](db[_0x6490('0x8d')][_0x6490('0x76')]({'membername':_0x210238[_0x26b79b][_0x6490('0x33')],'UserId':_0x210238[_0x26b79b]['id'],'queue_name':_0x4fb340[_0x6490('0x33')],'VoiceQueueId':_0x4fb340['id'],'interface':_[_0x6490('0x77')](_0x210238[_0x26b79b]['interface'])?util['format']('SIP/%s',_0x210238[_0x26b79b][_0x6490('0x33')]):_0x210238[_0x26b79b][_0x6490('0x78')],'paused':_0x210238[_0x26b79b][_0x6490('0x6d')]||![],'penalty':_0x23baa9[_0x6490('0x51')][_0x6490('0x70')]||0x0}));}}return BPromise[_0x6490('0x91')](_0x1b4b29);}})[_0x6490('0x26')](function(){return _0x5e5a4b;})[_0x6490('0x26')](respondWithResult(_0x4d3957,null))[_0x6490('0x4b')](handleError(_0x4d3957,null));};exports[_0x6490('0x92')]=function(_0x497286,_0x2b2229,_0x24e290){return db[_0x6490('0x45')][_0x6490('0x31')]({'where':{'id':_0x497286[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x2b2229,null))[_0x6490('0x26')](function(_0x5f3ea0){if(_0x5f3ea0){return _0x5f3ea0['removeAgents'](_0x497286[_0x6490('0x39')][_0x6490('0x7d')])[_0x6490('0x26')](function(){if(_['isArray'](_0x497286['query'][_0x6490('0x7d')])){for(var _0x4c356e=0x0;_0x4c356e<_0x497286[_0x6490('0x39')]['ids'][_0x6490('0x3f')];_0x4c356e+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x497286[_0x6490('0x39')][_0x6490('0x7d')][_0x4c356e]),'VoiceQueueId':Number(_0x497286[_0x6490('0x4d')]['id'])});}}else{socket[_0x6490('0x7a')]('userVoiceQueue:remove',{'UserId':Number(_0x497286[_0x6490('0x39')][_0x6490('0x7d')]),'VoiceQueueId':Number(_0x497286[_0x6490('0x4d')]['id'])});}});}})[_0x6490('0x26')](function(_0x58cf09){return db[_0x6490('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x497286[_0x6490('0x4d')]['id'],'UserId':_0x497286[_0x6490('0x39')][_0x6490('0x7d')]}})[_0x6490('0x26')](function(){return _0x58cf09;});})[_0x6490('0x26')](respondWithStatusCode(_0x2b2229,null))['catch'](handleError(_0x2b2229,null));};exports[_0x6490('0x93')]=function(_0x5976fc,_0x2e24d1,_0x5f5628){var _0x21b59b={};var _0x35fbd7={};var _0x4eba46;var _0x21712;return db[_0x6490('0x45')][_0x6490('0x5e')]({'where':{'id':_0x5976fc['params']['id']}})['then'](handleEntityNotFound(_0x2e24d1,null))[_0x6490('0x26')](function(_0x3cface){if(_0x3cface){_0x4eba46=_0x3cface;_0x35fbd7[_0x6490('0x38')]=_[_0x6490('0x3a')](db[_0x6490('0x90')][_0x6490('0x4e')]);_0x35fbd7[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x5976fc['query']);_0x35fbd7['filters']=_[_0x6490('0x3c')](_0x35fbd7[_0x6490('0x38')],_0x35fbd7[_0x6490('0x39')]);_0x21b59b[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x35fbd7[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x5976fc[_0x6490('0x39')][_0x6490('0x3e')]));_0x21b59b[_0x6490('0x3d')]=_0x21b59b['attributes'][_0x6490('0x3f')]?_0x21b59b[_0x6490('0x3d')]:_0x35fbd7['model'];_0x21b59b[_0x6490('0x60')]=qs[_0x6490('0x41')](_0x5976fc['query'][_0x6490('0x41')]);_0x21b59b[_0x6490('0x42')]=qs[_0x6490('0x3b')](_[_0x6490('0x43')](_0x5976fc[_0x6490('0x39')],_0x35fbd7[_0x6490('0x3b')]));if(_0x5976fc['query'][_0x6490('0x2c')]){_0x21b59b['where']=_[_0x6490('0x44')](_0x21b59b['where'],{'$or':_[_0x6490('0x2e')](_0x21b59b['attributes'],function(_0x5a2983){var _0x1649f7={};_0x1649f7[_0x5a2983]={'$like':'%'+_0x5976fc[_0x6490('0x39')][_0x6490('0x2c')]+'%'};return _0x1649f7;})});}_0x21b59b=_['merge']({},_0x21b59b,_0x5976fc[_0x6490('0x4f')]);return _0x4eba46[_0x6490('0x93')](_0x21b59b);}})[_0x6490('0x26')](function(_0x4e7c50){if(_0x4e7c50){_0x21712=_0x4e7c50[_0x6490('0x3f')];if(!_0x5976fc[_0x6490('0x39')][_0x6490('0x5f')](_0x6490('0x40'))){_0x21b59b[_0x6490('0x1f')]=qs[_0x6490('0x1f')](_0x5976fc[_0x6490('0x39')]['limit']);_0x21b59b[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x5976fc[_0x6490('0x39')]['offset']);}return _0x4eba46[_0x6490('0x93')](_0x21b59b);}})[_0x6490('0x26')](function(_0x51ec43){if(_0x51ec43){return _0x51ec43?{'count':_0x21712,'rows':_0x51ec43}:null;}})[_0x6490('0x26')](respondWithResult(_0x2e24d1,null))[_0x6490('0x4b')](handleError(_0x2e24d1,null));};exports['getMembers']=function(_0x3b6d03,_0x60c716,_0x397875){var _0x50a244={};var _0x19807b={};var _0xfc0dd1;var _0x514f90;return db[_0x6490('0x45')][_0x6490('0x5e')]({'where':{'id':_0x3b6d03['params']['id']}})['then'](handleEntityNotFound(_0x60c716,null))['then'](function(_0x4f3f77){if(_0x4f3f77){_0xfc0dd1=_0x4f3f77;_0x19807b[_0x6490('0x38')]=_[_0x6490('0x3a')](db[_0x6490('0x8d')][_0x6490('0x4e')]);_0x19807b[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x3b6d03[_0x6490('0x39')]);_0x19807b[_0x6490('0x3b')]=_['intersection'](_0x19807b[_0x6490('0x38')],_0x19807b[_0x6490('0x39')]);_0x50a244[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x19807b[_0x6490('0x38')],qs['fields'](_0x3b6d03[_0x6490('0x39')]['fields']));_0x50a244[_0x6490('0x3d')]=_0x50a244['attributes']['length']?_0x50a244[_0x6490('0x3d')]:_0x19807b[_0x6490('0x38')];_0x50a244[_0x6490('0x60')]=qs[_0x6490('0x41')](_0x3b6d03[_0x6490('0x39')][_0x6490('0x41')]);_0x50a244[_0x6490('0x42')]=qs['filters'](_['pick'](_0x3b6d03[_0x6490('0x39')],_0x19807b[_0x6490('0x3b')]));if(_0x3b6d03[_0x6490('0x39')]['filter']){_0x50a244['where']=_['merge'](_0x50a244[_0x6490('0x42')],{'$or':_[_0x6490('0x2e')](_0x50a244['attributes'],function(_0x124b6d){var _0x493cb4={};_0x493cb4[_0x124b6d]={'$like':'%'+_0x3b6d03[_0x6490('0x39')][_0x6490('0x2c')]+'%'};return _0x493cb4;})});}_0x50a244=_[_0x6490('0x44')]({},_0x50a244,_0x3b6d03['options']);return _0xfc0dd1[_0x6490('0x94')](_0x50a244);}})[_0x6490('0x26')](function(_0xaca3da){if(_0xaca3da){_0x514f90=_0xaca3da[_0x6490('0x3f')];if(!_0x3b6d03[_0x6490('0x39')][_0x6490('0x5f')](_0x6490('0x40'))){_0x50a244['limit']=qs[_0x6490('0x1f')](_0x3b6d03[_0x6490('0x39')]['limit']);_0x50a244[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x3b6d03[_0x6490('0x39')][_0x6490('0x1e')]);}return _0xfc0dd1[_0x6490('0x94')](_0x50a244);}})[_0x6490('0x26')](function(_0x393031){return _0x393031?{'count':_0x514f90,'rows':_0x393031}:null;})[_0x6490('0x26')](respondWithResult(_0x60c716,null))['catch'](handleError(_0x60c716,null));};exports[_0x6490('0x95')]=function(_0x3b8bab,_0x31e321,_0x1b94e0){var _0x2adc93={};var _0x33ad4b={};var _0x5f35d8;var _0x3fca4a;return db[_0x6490('0x45')]['findOne']({'where':{'id':_0x3b8bab[_0x6490('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31e321,null))[_0x6490('0x26')](function(_0x21390b){if(_0x21390b){_0x5f35d8=_0x21390b;_0x33ad4b[_0x6490('0x38')]=_['keys'](db['CmList'][_0x6490('0x4e')]);_0x33ad4b[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x3b8bab[_0x6490('0x39')]);_0x33ad4b[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x33ad4b['model'],_0x33ad4b[_0x6490('0x39')]);_0x2adc93[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x33ad4b[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x3b8bab[_0x6490('0x39')][_0x6490('0x3e')]));_0x2adc93[_0x6490('0x3d')]=_0x2adc93[_0x6490('0x3d')]['length']?_0x2adc93[_0x6490('0x3d')]:_0x33ad4b[_0x6490('0x38')];_0x2adc93[_0x6490('0x60')]=qs[_0x6490('0x41')](_0x3b8bab[_0x6490('0x39')]['sort']);_0x2adc93[_0x6490('0x42')]=qs[_0x6490('0x3b')](_[_0x6490('0x43')](_0x3b8bab[_0x6490('0x39')],_0x33ad4b[_0x6490('0x3b')]));if(_0x3b8bab[_0x6490('0x39')][_0x6490('0x2c')]){_0x2adc93['where']=_[_0x6490('0x44')](_0x2adc93['where'],{'$or':_[_0x6490('0x2e')](_0x2adc93[_0x6490('0x3d')],function(_0x5c0926){var _0x47000f={};_0x47000f[_0x5c0926]={'$like':'%'+_0x3b8bab[_0x6490('0x39')]['filter']+'%'};return _0x47000f;})});}_0x2adc93=_['merge']({},_0x2adc93,_0x3b8bab[_0x6490('0x4f')]);return _0x5f35d8[_0x6490('0x95')](_0x2adc93);}})[_0x6490('0x26')](function(_0x55632d){if(_0x55632d){_0x3fca4a=_0x55632d[_0x6490('0x3f')];if(!_0x3b8bab[_0x6490('0x39')]['hasOwnProperty'](_0x6490('0x40'))){_0x2adc93['limit']=qs[_0x6490('0x1f')](_0x3b8bab[_0x6490('0x39')][_0x6490('0x1f')]);_0x2adc93['offset']=qs[_0x6490('0x1e')](_0x3b8bab[_0x6490('0x39')][_0x6490('0x1e')]);}return _0x5f35d8[_0x6490('0x95')](_0x2adc93);}})[_0x6490('0x26')](function(_0x223827){if(_0x223827){return _0x223827?{'count':_0x3fca4a,'rows':_0x223827}:null;}})[_0x6490('0x26')](respondWithResult(_0x31e321,null))[_0x6490('0x4b')](handleError(_0x31e321,null));};exports['addLists']=function(_0x414e12,_0x3ec5f0,_0x4710b0){var _0x2d6cf0,_0x15865b;return db[_0x6490('0x45')][_0x6490('0x31')]({'where':{'id':_0x414e12[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x3ec5f0,null))[_0x6490('0x26')](function(_0x118691){if(_0x118691){_0x15865b=_0x118691;return _0x118691[_0x6490('0x96')](_0x414e12[_0x6490('0x51')]['ids'],_[_0x6490('0x5c')](_0x414e12[_0x6490('0x51')],[_0x6490('0x7d'),'id'])||{});}return null;})[_0x6490('0x97')](function(_0x24e1ef){var _0x25f317;_0x2d6cf0=_0x24e1ef||[];var _0x1f7fa0=[];if(_0x24e1ef){for(var _0x76c418=0x0;_0x76c418<_0x24e1ef[_0x6490('0x3f')];_0x76c418+=0x1){var _0x274b6f=_0x24e1ef[_0x76c418][_0x6490('0x28')]({'plain':!![]});_0x15865b[_0x6490('0x98')]=_0x414e12[_0x6490('0x51')][_0x6490('0x98')]?_0x414e12['body']['dialCheckDuplicateType']:_0x15865b['dialCheckDuplicateType'];switch(_0x15865b[_0x6490('0x98')]){case _0x6490('0x99'):_0x25f317=squel[_0x6490('0x9a')]()[_0x6490('0x9b')]('cm_hopper')[_0x6490('0x9c')](['phone',_0x6490('0x9d'),'ContactId','ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0x6490('0x9e')]()['field'](_0x6490('0x9f'),_0x6490('0x9f'))[_0x6490('0x7e')](_0x6490('0xa0'),'scheduledAt')[_0x6490('0x7e')]('id',_0x6490('0xa1'))[_0x6490('0x7e')](_0x274b6f['CmListId'][_0x6490('0xa2')](),'ListId')[_0x6490('0x7e')](_0x414e12[_0x6490('0x4d')]['id']['toString'](),_0x6490('0x61'))[_0x6490('0x7e')](_0x6490('0xa0'),_0x6490('0x5a'))[_0x6490('0x7e')](_0x6490('0xa0'),'updatedAt')[_0x6490('0x80')](_0x6490('0xa3'))[_0x6490('0x42')](_0x6490('0xa4'))[_0x6490('0x42')](_0x6490('0xa5'),_0x274b6f[_0x6490('0xa6')][_0x6490('0xa2')]())['where'](_0x6490('0xa7'))[_0x6490('0x42')](_0x6490('0xa8'),squel[_0x6490('0x9e')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x6490('0x80')](_0x6490('0xa9'))[_0x6490('0x42')](_0x6490('0x85'),_0x414e12[_0x6490('0x4d')]['id'][_0x6490('0xa2')]()))[_0x6490('0x42')](_0x6490('0xa8'),squel['select']()['field'](_0x6490('0xaa'))[_0x6490('0x80')](_0x6490('0xab'))[_0x6490('0x42')](_0x6490('0x85'),_0x414e12[_0x6490('0x4d')]['id'][_0x6490('0xa2')]())))['toString']();break;case'onlyIfOpen':_0x25f317=squel[_0x6490('0x9a')]()[_0x6490('0x9b')](_0x6490('0xab'))[_0x6490('0x9c')]([_0x6490('0x9f'),_0x6490('0x9d'),_0x6490('0xa1'),_0x6490('0xac'),'VoiceQueueId','createdAt',_0x6490('0x5b')],squel['select']()[_0x6490('0x7e')]('phone','phone')[_0x6490('0x7e')](_0x6490('0xa0'),'scheduledAt')[_0x6490('0x7e')]('id',_0x6490('0xa1'))[_0x6490('0x7e')](_0x274b6f[_0x6490('0xa6')][_0x6490('0xa2')](),_0x6490('0xac'))['field'](_0x414e12[_0x6490('0x4d')]['id']['toString'](),'VoiceQueueId')[_0x6490('0x7e')](_0x6490('0xa0'),_0x6490('0x5a'))[_0x6490('0x7e')](_0x6490('0xa0'),_0x6490('0x5b'))[_0x6490('0x80')]('cm_contacts')[_0x6490('0x42')](_0x6490('0xa4'))[_0x6490('0x42')](_0x6490('0xa5'),_0x274b6f[_0x6490('0xa6')][_0x6490('0xa2')]())['where'](_0x6490('0xa7'))[_0x6490('0x42')](_0x6490('0xa8'),squel[_0x6490('0x9e')]()['field'](_0x6490('0xaa'))[_0x6490('0x80')](_0x6490('0xab'))['where'](_0x6490('0x85'),_0x414e12[_0x6490('0x4d')]['id'][_0x6490('0xa2')]())))['toString']();break;default:_0x25f317=squel[_0x6490('0x9a')]()[_0x6490('0x9b')](_0x6490('0xab'))[_0x6490('0x9c')]([_0x6490('0x9f'),_0x6490('0x9d'),_0x6490('0xa1'),_0x6490('0xac'),'VoiceQueueId',_0x6490('0x5a'),'updatedAt'],squel[_0x6490('0x9e')]()[_0x6490('0x7e')]('phone',_0x6490('0x9f'))[_0x6490('0x7e')](_0x6490('0xa0'),'scheduledAt')[_0x6490('0x7e')]('id',_0x6490('0xa1'))[_0x6490('0x7e')](_0x274b6f[_0x6490('0xa6')][_0x6490('0xa2')](),_0x6490('0xac'))[_0x6490('0x7e')](_0x414e12['params']['id'][_0x6490('0xa2')](),_0x6490('0x61'))[_0x6490('0x7e')](_0x6490('0xa0'),_0x6490('0x5a'))[_0x6490('0x7e')](_0x6490('0xa0'),_0x6490('0x5b'))[_0x6490('0x80')](_0x6490('0xa3'))[_0x6490('0x42')](_0x6490('0xa4'))['where'](_0x6490('0xa5'),_0x274b6f[_0x6490('0xa6')]['toString']())[_0x6490('0x42')](_0x6490('0xa7')))[_0x6490('0xa2')]();}_0x1f7fa0[_0x6490('0x86')](db[_0x6490('0x71')][_0x6490('0x39')](_0x25f317));}return BPromise[_0x6490('0x91')](_0x1f7fa0);}})[_0x6490('0x26')](function(){return _0x2d6cf0;})[_0x6490('0x26')](respondWithResult(_0x3ec5f0,null))[_0x6490('0x4b')](handleError(_0x3ec5f0,null));};exports[_0x6490('0xad')]=function(_0x155616,_0x2f1b34,_0x5561ba){return db[_0x6490('0x45')][_0x6490('0x31')]({'where':{'id':_0x155616['params']['id']}})['then'](handleEntityNotFound(_0x2f1b34,null))[_0x6490('0x26')](function(_0x53da98){if(_0x53da98){return _0x53da98[_0x6490('0xad')](_0x155616[_0x6490('0x39')]['ids']);}})[_0x6490('0x26')](function(_0x156ce8){if(_0x156ce8){return db[_0x6490('0x62')]['destroy']({'where':{'ListId':_0x155616[_0x6490('0x39')][_0x6490('0x7d')],'VoiceQueueId':_0x155616[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](function(){return _0x156ce8;});}})[_0x6490('0x26')](respondWithStatusCode(_0x2f1b34,null))[_0x6490('0x4b')](handleError(_0x2f1b34,null));};exports['getBlackLists']=function(_0x60c357,_0x1998ae,_0xece444){var _0x13ea57={};var _0x337781={};var _0x49f3df;var _0x4c6026;return db['VoiceQueue'][_0x6490('0x5e')]({'where':{'id':_0x60c357[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x1998ae,null))[_0x6490('0x26')](function(_0x505ce1){if(_0x505ce1){_0x49f3df=_0x505ce1;_0x337781[_0x6490('0x38')]=_['keys'](db[_0x6490('0xae')][_0x6490('0x4e')]);_0x337781[_0x6490('0x39')]=_[_0x6490('0x3a')](_0x60c357[_0x6490('0x39')]);_0x337781[_0x6490('0x3b')]=_[_0x6490('0x3c')](_0x337781['model'],_0x337781[_0x6490('0x39')]);_0x13ea57[_0x6490('0x3d')]=_[_0x6490('0x3c')](_0x337781[_0x6490('0x38')],qs[_0x6490('0x3e')](_0x60c357[_0x6490('0x39')]['fields']));_0x13ea57['attributes']=_0x13ea57[_0x6490('0x3d')][_0x6490('0x3f')]?_0x13ea57[_0x6490('0x3d')]:_0x337781[_0x6490('0x38')];_0x13ea57[_0x6490('0x60')]=qs['sort'](_0x60c357[_0x6490('0x39')]['sort']);_0x13ea57['where']=qs[_0x6490('0x3b')](_[_0x6490('0x43')](_0x60c357[_0x6490('0x39')],_0x337781['filters']));if(_0x60c357[_0x6490('0x39')][_0x6490('0x2c')]){_0x13ea57[_0x6490('0x42')]=_[_0x6490('0x44')](_0x13ea57[_0x6490('0x42')],{'$or':_['map'](_0x13ea57[_0x6490('0x3d')],function(_0x391eb5){var _0x5c4e5a={};_0x5c4e5a[_0x391eb5]={'$like':'%'+_0x60c357['query'][_0x6490('0x2c')]+'%'};return _0x5c4e5a;})});}_0x13ea57=_[_0x6490('0x44')]({},_0x13ea57,_0x60c357[_0x6490('0x4f')]);return _0x49f3df[_0x6490('0xaf')](_0x13ea57);}})[_0x6490('0x26')](function(_0x5b637c){if(_0x5b637c){_0x4c6026=_0x5b637c[_0x6490('0x3f')];if(!_0x60c357['query']['hasOwnProperty'](_0x6490('0x40'))){_0x13ea57['limit']=qs[_0x6490('0x1f')](_0x60c357[_0x6490('0x39')][_0x6490('0x1f')]);_0x13ea57[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x60c357[_0x6490('0x39')][_0x6490('0x1e')]);}return _0x49f3df[_0x6490('0xaf')](_0x13ea57);}})[_0x6490('0x26')](function(_0x4a0de7){if(_0x4a0de7){return _0x4a0de7?{'count':_0x4c6026,'rows':_0x4a0de7}:null;}})[_0x6490('0x26')](respondWithResult(_0x1998ae,null))[_0x6490('0x4b')](handleError(_0x1998ae,null));};exports[_0x6490('0xb0')]=function(_0x121db2,_0x5363cd,_0x2b9834){var _0x40d174,_0x17857a;return db[_0x6490('0x45')][_0x6490('0x31')]({'where':{'id':_0x121db2[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x5363cd,null))[_0x6490('0x26')](function(_0x55de33){if(_0x55de33){_0x17857a=_0x55de33;return _0x55de33[_0x6490('0xb0')](_0x121db2[_0x6490('0x51')][_0x6490('0x7d')],_[_0x6490('0x5c')](_0x121db2[_0x6490('0x51')],[_0x6490('0x7d'),'id'])||{});}return null;})['spread'](function(_0xa25c67){var _0x6bfce3;_0x40d174=_0xa25c67||[];var _0x241b77=[];if(_0xa25c67){for(var _0x495728=0x0;_0x495728<_0xa25c67[_0x6490('0x3f')];_0x495728+=0x1){var _0x3a9310=_0xa25c67[_0x495728]['get']({'plain':!![]});_0x6bfce3=squel['insert']()[_0x6490('0x9b')](_0x6490('0xb1'))[_0x6490('0x9c')]([_0x6490('0x9f'),_0x6490('0xa1'),_0x6490('0xac'),_0x6490('0x61'),_0x6490('0x5a'),'updatedAt'],squel[_0x6490('0x9e')]()['field'](_0x6490('0x9f'),_0x6490('0x9f'))[_0x6490('0x7e')]('id',_0x6490('0xa1'))[_0x6490('0x7e')](_0x3a9310[_0x6490('0xa6')][_0x6490('0xa2')](),_0x6490('0xac'))[_0x6490('0x7e')](_0x121db2[_0x6490('0x4d')]['id']['toString'](),_0x6490('0x61'))['field'](_0x6490('0xa0'),'createdAt')[_0x6490('0x7e')]('NOW()',_0x6490('0x5b'))['from'](_0x6490('0xa3'))['where'](_0x6490('0xa4'))[_0x6490('0x42')]('ListId\x20=\x20?',_0x3a9310[_0x6490('0xa6')][_0x6490('0xa2')]())['where'](_0x6490('0xa7')))[_0x6490('0xa2')]();_0x241b77['push'](db[_0x6490('0x71')][_0x6490('0x39')](_0x6bfce3));}return BPromise[_0x6490('0x91')](_0x241b77);}})[_0x6490('0x26')](function(){return _0x40d174;})[_0x6490('0x26')](respondWithResult(_0x5363cd,null))[_0x6490('0x4b')](handleError(_0x5363cd,null));};exports['removeBlackLists']=function(_0x1a9c67,_0x53254e,_0x2dd523){return db[_0x6490('0x45')][_0x6490('0x31')]({'where':{'id':_0x1a9c67[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](handleEntityNotFound(_0x53254e,null))[_0x6490('0x26')](function(_0x4fa99a){if(_0x4fa99a){return _0x4fa99a[_0x6490('0xb2')](_0x1a9c67[_0x6490('0x39')][_0x6490('0x7d')]);}})['then'](function(_0x83c089){if(_0x83c089){return db[_0x6490('0x67')][_0x6490('0x27')]({'where':{'ListId':_0x1a9c67[_0x6490('0x39')]['ids'],'VoiceQueueId':_0x1a9c67[_0x6490('0x4d')]['id']}})[_0x6490('0x26')](function(){return _0x83c089;});}})[_0x6490('0x26')](respondWithStatusCode(_0x53254e,null))[_0x6490('0x4b')](handleError(_0x53254e,null));}; \ No newline at end of file +var _0x6f9f=['map','value','includes','type','find','name','UserProfileResource','stack','index','VoiceQueue','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','error','CmHopper','hasOwnProperty','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','forEach','penalty','transaction','UserVoiceQueue','findOrCreate','each','format','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','all','union','isEmpty','UserVoiceQueueRt','destroy','userVoiceQueue:remove','online','upsert','isNil','SIP/%s','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x6f9f,0x142));var _0xf6f9=function(_0x4de1d3,_0x46b0ba){_0x4de1d3=_0x4de1d3-0x0;var _0x1879a6=_0x6f9f[_0x4de1d3];return _0x1879a6;};'use strict';var pdf=require(_0xf6f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf6f9('0x1'));var zipdir=require(_0xf6f9('0x2'));var jsonpatch=require(_0xf6f9('0x3'));var rp=require(_0xf6f9('0x4'));var moment=require('moment');var BPromise=require(_0xf6f9('0x5'));var Mustache=require(_0xf6f9('0x6'));var util=require(_0xf6f9('0x7'));var path=require(_0xf6f9('0x8'));var sox=require(_0xf6f9('0x9'));var csv=require(_0xf6f9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf6f9('0xb'));var squel=require(_0xf6f9('0xc'));var crypto=require(_0xf6f9('0xd'));var jsforce=require(_0xf6f9('0xe'));var deskjs=require(_0xf6f9('0xf'));var toCsv=require(_0xf6f9('0xa'));var querystring=require(_0xf6f9('0x10'));var Papa=require(_0xf6f9('0x11'));var Redis=require(_0xf6f9('0x12'));var authService=require(_0xf6f9('0x13'));var qs=require(_0xf6f9('0x14'));var as=require(_0xf6f9('0x15'));var hardwareService=require(_0xf6f9('0x16'));var logger=require(_0xf6f9('0x17'))(_0xf6f9('0x18'));var utils=require(_0xf6f9('0x19'));var config=require(_0xf6f9('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf6f9('0x1b')]=_[_0xf6f9('0x1c')](config['redis'],{'host':_0xf6f9('0x1d'),'port':0x18eb});var socket=require(_0xf6f9('0x1e'))(new Redis(config[_0xf6f9('0x1b')]));require(_0xf6f9('0x1f'))[_0xf6f9('0x20')](socket);function respondWithStatusCode(_0x1b558c,_0x4c1374){_0x4c1374=_0x4c1374||0xcc;return function(_0x384fa5){if(_0x384fa5){return _0x1b558c[_0xf6f9('0x21')](_0x4c1374);}return _0x1b558c[_0xf6f9('0x22')](_0x4c1374)[_0xf6f9('0x23')]();};}function respondWithResult(_0x165930,_0x179df9){_0x179df9=_0x179df9||0xc8;return function(_0x53afbb){if(_0x53afbb){return _0x165930[_0xf6f9('0x22')](_0x179df9)[_0xf6f9('0x24')](_0x53afbb);}};}function respondWithFilteredResult(_0x1ec1e7,_0x3cb10d){return function(_0x4b8336){if(_0x4b8336){var _0x3ce53a=_0x4b8336[_0xf6f9('0x25')],_0x1f35bc=_0x3cb10d['offset'],_0x508a07=_0x3cb10d[_0xf6f9('0x26')]+_0x3cb10d[_0xf6f9('0x27')],_0x65fbbc;if(_0x508a07>=_0x3ce53a){_0x508a07=_0x3ce53a;_0x65fbbc=0xc8;}else{_0x65fbbc=0xce;}_0x1ec1e7[_0xf6f9('0x22')](_0x65fbbc);return _0x1ec1e7[_0xf6f9('0x28')]('Content-Range',_0x1f35bc+'-'+_0x508a07+'/'+_0x3ce53a)[_0xf6f9('0x24')](_0x4b8336);}return null;};}function patchUpdates(_0x4bfd97){return function(_0x11e990){try{jsonpatch[_0xf6f9('0x29')](_0x11e990,_0x4bfd97,!![]);}catch(_0x4f41ea){return BPromise[_0xf6f9('0x2a')](_0x4f41ea);}return _0x11e990[_0xf6f9('0x2b')]();};}function saveUpdates(_0x4a3724,_0x4b76f0){return function(_0x3c92de){if(_0x3c92de){return _0x3c92de[_0xf6f9('0x2c')](_0x4a3724)[_0xf6f9('0x2d')](function(_0x2b924b){return _0x2b924b;});}return null;};}function removeEntity(_0x434ccd,_0x17dac2){return function(_0x1dc19d){if(_0x1dc19d){return _0x1dc19d['destroy']()[_0xf6f9('0x2d')](function(){var _0x39d1b0=_0x1dc19d[_0xf6f9('0x2e')]({'plain':!![]});var _0x414315=[{'name':_0xf6f9('0x2f'),'value':_0xf6f9('0x30'),'ignore':![]},{'name':_0xf6f9('0x31'),'value':_0xf6f9('0x32'),'ignore':![]}];var _0x480c9e=_(_0x414315)['filter'](_0xf6f9('0x33'))[_0xf6f9('0x34')](_0xf6f9('0x35'))['value']();if(_[_0xf6f9('0x36')](_0x480c9e,_0x39d1b0[_0xf6f9('0x37')])){return;}var _0x55b422=_[_0xf6f9('0x38')](_0x414315,['value',_0x39d1b0[_0xf6f9('0x37')]])[_0xf6f9('0x39')];return db[_0xf6f9('0x3a')]['destroy']({'where':{'type':_0x55b422,'resourceId':_0x39d1b0['id']}})[_0xf6f9('0x2d')](function(){return _0x1dc19d;});})['then'](function(){_0x434ccd[_0xf6f9('0x22')](0xcc)[_0xf6f9('0x23')]();});}};}function handleEntityNotFound(_0x566f59,_0x436f32){return function(_0x4a74eb){if(!_0x4a74eb){_0x566f59[_0xf6f9('0x21')](0x194);}return _0x4a74eb;};}function handleError(_0x485f36,_0x1349d0){_0x1349d0=_0x1349d0||0x1f4;return function(_0x3717de){logger['error'](_0x3717de[_0xf6f9('0x3b')]);if(_0x3717de[_0xf6f9('0x39')]){delete _0x3717de[_0xf6f9('0x39')];}_0x485f36[_0xf6f9('0x22')](_0x1349d0)['send'](_0x3717de);};}exports[_0xf6f9('0x3c')]=function(_0x405cb9,_0x3a8ea5){var _0xed95b3={},_0x18869c={},_0x2c1855={'count':0x0,'rows':[]};var _0x4f1f30=_[_0xf6f9('0x34')](db[_0xf6f9('0x3d')]['rawAttributes'],function(_0x5296a5){return{'name':_0x5296a5[_0xf6f9('0x3e')],'type':_0x5296a5[_0xf6f9('0x37')][_0xf6f9('0x3f')]};});_0x18869c['model']=_[_0xf6f9('0x34')](_0x4f1f30,_0xf6f9('0x39'));_0x18869c[_0xf6f9('0x40')]=_[_0xf6f9('0x41')](_0x405cb9['query']);_0x18869c['filters']=_[_0xf6f9('0x42')](_0x18869c[_0xf6f9('0x43')],_0x18869c['query']);_0xed95b3[_0xf6f9('0x44')]=_['intersection'](_0x18869c[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x405cb9['query'][_0xf6f9('0x45')]));_0xed95b3[_0xf6f9('0x44')]=_0xed95b3[_0xf6f9('0x44')][_0xf6f9('0x46')]?_0xed95b3[_0xf6f9('0x44')]:_0x18869c[_0xf6f9('0x43')];if(!_0x405cb9[_0xf6f9('0x40')]['hasOwnProperty'](_0xf6f9('0x47'))){_0xed95b3[_0xf6f9('0x27')]=qs['limit'](_0x405cb9[_0xf6f9('0x40')][_0xf6f9('0x27')]);_0xed95b3[_0xf6f9('0x26')]=qs['offset'](_0x405cb9['query'][_0xf6f9('0x26')]);}_0xed95b3[_0xf6f9('0x48')]=qs['sort'](_0x405cb9['query'][_0xf6f9('0x49')]);_0xed95b3[_0xf6f9('0x4a')]=qs[_0xf6f9('0x4b')](_[_0xf6f9('0x4c')](_0x405cb9[_0xf6f9('0x40')],_0x18869c[_0xf6f9('0x4b')]),_0x4f1f30);if(_0x405cb9[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0xed95b3['where']=_[_0xf6f9('0x4e')](_0xed95b3['where'],{'$or':_[_0xf6f9('0x34')](_0x4f1f30,function(_0x2f948b){if(_0x2f948b[_0xf6f9('0x37')]!==_0xf6f9('0x4f')){var _0x1bb037={};_0x1bb037[_0x2f948b[_0xf6f9('0x39')]]={'$like':'%'+_0x405cb9[_0xf6f9('0x40')]['filter']+'%'};return _0x1bb037;}})});}_0xed95b3=_['merge']({},_0xed95b3,_0x405cb9[_0xf6f9('0x50')]);var _0x5b508c={'where':_0xed95b3['where']};return db[_0xf6f9('0x3d')][_0xf6f9('0x25')](_0x5b508c)[_0xf6f9('0x2d')](function(_0x5f1f84){_0x2c1855[_0xf6f9('0x25')]=_0x5f1f84;if(_0x405cb9[_0xf6f9('0x40')][_0xf6f9('0x51')]){_0xed95b3[_0xf6f9('0x52')]=[{'all':!![]}];}return db[_0xf6f9('0x3d')][_0xf6f9('0x53')](_0xed95b3);})['then'](function(_0x24ad16){_0x2c1855[_0xf6f9('0x54')]=_0x24ad16;return _0x2c1855;})['then'](respondWithFilteredResult(_0x3a8ea5,_0xed95b3))[_0xf6f9('0x55')](handleError(_0x3a8ea5,null));};exports[_0xf6f9('0x56')]=function(_0x4ea714,_0x2b437c){var _0x6b638d={'raw':![],'where':{'id':_0x4ea714[_0xf6f9('0x57')]['id']}},_0xd7e8bd={};_0xd7e8bd[_0xf6f9('0x43')]=_[_0xf6f9('0x41')](db[_0xf6f9('0x3d')][_0xf6f9('0x58')]);_0xd7e8bd['query']=_[_0xf6f9('0x41')](_0x4ea714[_0xf6f9('0x40')]);_0xd7e8bd['filters']=_[_0xf6f9('0x42')](_0xd7e8bd['model'],_0xd7e8bd['query']);_0x6b638d[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0xd7e8bd['model'],qs[_0xf6f9('0x45')](_0x4ea714[_0xf6f9('0x40')]['fields']));_0x6b638d[_0xf6f9('0x44')]=_0x6b638d[_0xf6f9('0x44')][_0xf6f9('0x46')]?_0x6b638d[_0xf6f9('0x44')]:_0xd7e8bd['model'];if(_0x4ea714[_0xf6f9('0x40')][_0xf6f9('0x51')]){_0x6b638d[_0xf6f9('0x52')]=[{'all':!![]}];}_0x6b638d=_[_0xf6f9('0x4e')]({},_0x6b638d,_0x4ea714[_0xf6f9('0x50')]);return db['VoiceQueue'][_0xf6f9('0x38')](_0x6b638d)[_0xf6f9('0x2d')](handleEntityNotFound(_0x2b437c,null))[_0xf6f9('0x2d')](respondWithResult(_0x2b437c,null))[_0xf6f9('0x55')](handleError(_0x2b437c,null));};exports[_0xf6f9('0x59')]=function(_0x33f22a,_0x3d7922){return db[_0xf6f9('0x3d')][_0xf6f9('0x59')](_0x33f22a[_0xf6f9('0x5a')],{})[_0xf6f9('0x2d')](function(_0x8f410c){var _0x20f48d=_0x33f22a[_0xf6f9('0x5b')][_0xf6f9('0x2e')]({'plain':!![]});if(!_0x20f48d)throw new Error(_0xf6f9('0x5c'));if(_0x20f48d[_0xf6f9('0x5d')]==='user'){var _0x8511d=_0x8f410c[_0xf6f9('0x2e')]({'plain':!![]});var _0x52c1d3=[{'name':_0xf6f9('0x2f'),'value':_0xf6f9('0x30')},{'name':_0xf6f9('0x31'),'value':'outbound'}];var _0x19c98a=_[_0xf6f9('0x38')](_0x52c1d3,[_0xf6f9('0x35'),_0x8511d['type']])[_0xf6f9('0x39')];return db['UserProfileSection'][_0xf6f9('0x38')]({'where':{'name':_0x19c98a,'userProfileId':_0x20f48d[_0xf6f9('0x5e')]},'raw':!![]})[_0xf6f9('0x2d')](function(_0x48278a){if(_0x48278a&&_0x48278a[_0xf6f9('0x5f')]===0x0){return db[_0xf6f9('0x3a')][_0xf6f9('0x59')]({'name':_0x8511d['name'],'resourceId':_0x8511d['id'],'type':_0x48278a[_0xf6f9('0x39')],'sectionId':_0x48278a['id']},{})['then'](function(){return _0x8f410c;});}else{return _0x8f410c;}})[_0xf6f9('0x55')](function(_0x276590){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x276590);throw _0x276590;});}return _0x8f410c;})[_0xf6f9('0x2d')](respondWithResult(_0x3d7922,0xc9))[_0xf6f9('0x55')](handleError(_0x3d7922,null));};exports[_0xf6f9('0x60')]=function(_0x42e2b0,_0x418cc6){var _0x35834c={'where':{'id':_0x42e2b0[_0xf6f9('0x57')]['id']}},_0xdb6061={};_0xdb6061[_0xf6f9('0x43')]=_[_0xf6f9('0x41')](db[_0xf6f9('0x3d')]['rawAttributes']);_0x35834c['attributes']=_[_0xf6f9('0x42')](_0xdb6061[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x42e2b0['query'][_0xf6f9('0x45')]));_0x35834c['attributes']=_0x35834c[_0xf6f9('0x44')]['length']?_0x35834c['attributes']:_0xdb6061[_0xf6f9('0x43')];if(_0x42e2b0[_0xf6f9('0x40')][_0xf6f9('0x51')]){_0x35834c[_0xf6f9('0x52')]=[{'all':!![]}];}_0x35834c=_[_0xf6f9('0x4e')]({},_0x35834c,_0x42e2b0[_0xf6f9('0x50')]);return db[_0xf6f9('0x3d')][_0xf6f9('0x38')](_0x35834c)[_0xf6f9('0x2d')](handleEntityNotFound(_0x418cc6,null))[_0xf6f9('0x2d')](function(_0x12ca82){if(_0x12ca82){var _0x21cf8a=_0x12ca82[_0xf6f9('0x2e')]({'plain':!![]});_0x21cf8a=qs[_0xf6f9('0x61')](_0x21cf8a,['id','createdAt',_0xf6f9('0x62')]);_0x42e2b0['body']=_[_0xf6f9('0x61')](_0x42e2b0[_0xf6f9('0x5a')],['id',_0xf6f9('0x63'),'updatedAt']);return db[_0xf6f9('0x3d')][_0xf6f9('0x59')](_[_0xf6f9('0x4e')](_0x21cf8a,_0x42e2b0[_0xf6f9('0x5a')]),{'include':_0x42e2b0[_0xf6f9('0x40')][_0xf6f9('0x51')]?[{'all':!![]}]:undefined})['then'](function(_0x2cc031){var _0x1275ce=_0x42e2b0[_0xf6f9('0x5b')]['get']({'plain':!![]});if(!_0x1275ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1275ce[_0xf6f9('0x5d')]===_0xf6f9('0x5b')){var _0x110998=_0x2cc031['get']({'plain':!![]});var _0x4dcb98=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xf6f9('0x31'),'value':'outbound'}];var _0x29b992=_[_0xf6f9('0x38')](_0x4dcb98,[_0xf6f9('0x35'),_0x110998[_0xf6f9('0x37')]])['name'];return db['UserProfileSection'][_0xf6f9('0x38')]({'where':{'name':_0x29b992,'userProfileId':_0x1275ce['userProfileId']},'raw':!![]})[_0xf6f9('0x2d')](function(_0x27f1b0){if(_0x27f1b0&&_0x27f1b0['autoAssociation']===0x0){return db[_0xf6f9('0x3a')][_0xf6f9('0x59')]({'name':_0x110998[_0xf6f9('0x39')],'resourceId':_0x110998['id'],'type':_0x27f1b0[_0xf6f9('0x39')],'sectionId':_0x27f1b0['id']},{})[_0xf6f9('0x2d')](function(){return _0x2cc031;});}else{return _0x2cc031;}})['catch'](function(_0x51568a){logger[_0xf6f9('0x64')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51568a);throw _0x51568a;});}return _0x2cc031;});}})[_0xf6f9('0x2d')](respondWithResult(_0x418cc6,0xc9))[_0xf6f9('0x55')](handleError(_0x418cc6,null));};exports[_0xf6f9('0x2c')]=function(_0x31f9ef,_0x15d234){if(_0x31f9ef[_0xf6f9('0x5a')]['id']){delete _0x31f9ef[_0xf6f9('0x5a')]['id'];}return db['VoiceQueue'][_0xf6f9('0x38')]({'where':{'id':_0x31f9ef[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x15d234,null))[_0xf6f9('0x2d')](saveUpdates(_0x31f9ef['body'],null))[_0xf6f9('0x2d')](respondWithResult(_0x15d234,null))['catch'](handleError(_0x15d234,null));};exports['destroy']=function(_0x42c095,_0x3c3704){return db[_0xf6f9('0x3d')]['find']({'where':{'id':_0x42c095[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0x3c3704,null))[_0xf6f9('0x2d')](removeEntity(_0x3c3704,null))[_0xf6f9('0x55')](handleError(_0x3c3704,null));};exports['getHoppers']=function(_0x39bd4c,_0x8f3dc3,_0x262bc9){var _0x871b22={'raw':![],'where':{}};var _0x258881={};var _0x3a52f6={'count':0x0,'rows':[]};return db[_0xf6f9('0x3d')]['findOne']({'where':{'id':_0x39bd4c[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x8f3dc3,null))[_0xf6f9('0x2d')](function(_0x632e9f){if(_0x632e9f){_0x258881[_0xf6f9('0x43')]=_['keys'](db[_0xf6f9('0x65')][_0xf6f9('0x58')]);_0x258881['query']=_[_0xf6f9('0x41')](_0x39bd4c[_0xf6f9('0x40')]);_0x258881['filters']=_[_0xf6f9('0x42')](_0x258881['model'],_0x258881['query']);_0x871b22[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0x258881['model'],qs[_0xf6f9('0x45')](_0x39bd4c['query'][_0xf6f9('0x45')]));_0x871b22[_0xf6f9('0x44')]=_0x871b22[_0xf6f9('0x44')][_0xf6f9('0x46')]?_0x871b22[_0xf6f9('0x44')]:_0x258881[_0xf6f9('0x43')];if(!_0x39bd4c[_0xf6f9('0x40')][_0xf6f9('0x66')](_0xf6f9('0x47'))){_0x871b22[_0xf6f9('0x27')]=qs[_0xf6f9('0x27')](_0x39bd4c[_0xf6f9('0x40')][_0xf6f9('0x27')]);_0x871b22['offset']=qs['offset'](_0x39bd4c['query']['offset']);}_0x871b22[_0xf6f9('0x48')]=qs[_0xf6f9('0x49')](_0x39bd4c[_0xf6f9('0x40')]['sort']);_0x871b22[_0xf6f9('0x4a')]=qs['filters'](_[_0xf6f9('0x4c')](_0x39bd4c[_0xf6f9('0x40')],_0x258881[_0xf6f9('0x4b')]));_0x871b22[_0xf6f9('0x4a')]['VoiceQueueId']=_0x632e9f['id'];if(_0x39bd4c[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x871b22['where']=_[_0xf6f9('0x4e')](_0x871b22[_0xf6f9('0x4a')],{'$or':_['map'](_0x871b22[_0xf6f9('0x44')],function(_0x5ce279){var _0x183072={};_0x183072[_0x5ce279]={'$like':'%'+_0x39bd4c['query']['filter']+'%'};return _0x183072;})});}_0x871b22=_['merge']({},_0x871b22,_0x39bd4c['options']);return db[_0xf6f9('0x65')][_0xf6f9('0x25')]({'where':_0x871b22['where']})[_0xf6f9('0x2d')](function(_0x2875bf){_0x3a52f6[_0xf6f9('0x25')]=_0x2875bf;if(_0x39bd4c[_0xf6f9('0x40')][_0xf6f9('0x51')]){_0x871b22[_0xf6f9('0x52')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x871b22);})[_0xf6f9('0x2d')](function(_0x33596d){_0x3a52f6[_0xf6f9('0x54')]=_0x33596d;return _0x3a52f6;});}})[_0xf6f9('0x2d')](respondWithFilteredResult(_0x8f3dc3,_0x871b22))[_0xf6f9('0x55')](handleError(_0x8f3dc3,null));};exports[_0xf6f9('0x67')]=function(_0x4f76fc,_0xcfd1c6,_0x45c126){var _0x517d04={'raw':!![],'where':{}};var _0x2b03dd={};var _0x491be0={'count':0x0,'rows':[]};return db[_0xf6f9('0x3d')][_0xf6f9('0x68')]({'where':{'id':_0x4f76fc[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0xcfd1c6,null))[_0xf6f9('0x2d')](function(_0x6ea69c){if(_0x6ea69c){_0x2b03dd[_0xf6f9('0x43')]=_[_0xf6f9('0x41')](db[_0xf6f9('0x69')][_0xf6f9('0x58')]);_0x2b03dd['query']=_[_0xf6f9('0x41')](_0x4f76fc[_0xf6f9('0x40')]);_0x2b03dd[_0xf6f9('0x4b')]=_[_0xf6f9('0x42')](_0x2b03dd[_0xf6f9('0x43')],_0x2b03dd[_0xf6f9('0x40')]);_0x517d04[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0x2b03dd[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x4f76fc[_0xf6f9('0x40')][_0xf6f9('0x45')]));_0x517d04[_0xf6f9('0x44')]=_0x517d04[_0xf6f9('0x44')][_0xf6f9('0x46')]?_0x517d04[_0xf6f9('0x44')]:_0x2b03dd[_0xf6f9('0x43')];if(!_0x4f76fc['query'][_0xf6f9('0x66')](_0xf6f9('0x47'))){_0x517d04[_0xf6f9('0x27')]=qs['limit'](_0x4f76fc[_0xf6f9('0x40')][_0xf6f9('0x27')]);_0x517d04['offset']=qs[_0xf6f9('0x26')](_0x4f76fc['query']['offset']);}_0x517d04[_0xf6f9('0x48')]=qs[_0xf6f9('0x49')](_0x4f76fc[_0xf6f9('0x40')][_0xf6f9('0x49')]);_0x517d04[_0xf6f9('0x4a')]=qs[_0xf6f9('0x4b')](_[_0xf6f9('0x4c')](_0x4f76fc['query'],_0x2b03dd[_0xf6f9('0x4b')]));_0x517d04['where'][_0xf6f9('0x6a')]=_0x6ea69c['id'];if(_0x4f76fc[_0xf6f9('0x40')]['filter']){_0x517d04[_0xf6f9('0x4a')]=_[_0xf6f9('0x4e')](_0x517d04[_0xf6f9('0x4a')],{'$or':_[_0xf6f9('0x34')](_0x517d04[_0xf6f9('0x44')],function(_0x1f486e){var _0x45b040={};_0x45b040[_0x1f486e]={'$like':'%'+_0x4f76fc[_0xf6f9('0x40')]['filter']+'%'};return _0x45b040;})});}_0x517d04=_[_0xf6f9('0x4e')]({},_0x517d04,_0x4f76fc[_0xf6f9('0x50')]);return db[_0xf6f9('0x69')][_0xf6f9('0x25')]({'where':_0x517d04[_0xf6f9('0x4a')]})['then'](function(_0x3c7d55){_0x491be0[_0xf6f9('0x25')]=_0x3c7d55;if(_0x4f76fc['query'][_0xf6f9('0x51')]){_0x517d04['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xf6f9('0x53')](_0x517d04);})[_0xf6f9('0x2d')](function(_0x5abcc0){_0x491be0[_0xf6f9('0x54')]=_0x5abcc0;return _0x491be0;});}})[_0xf6f9('0x2d')](respondWithFilteredResult(_0xcfd1c6,_0x517d04))[_0xf6f9('0x55')](handleError(_0xcfd1c6,null));};exports[_0xf6f9('0x6b')]=function(_0x33f04c,_0x220ecf,_0x4b7dde){var _0x4bdddc={'raw':!![],'where':{}};var _0xf82dda={};var _0x154129={'count':0x0,'rows':[]};return db[_0xf6f9('0x3d')][_0xf6f9('0x68')]({'where':{'id':_0x33f04c[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x220ecf,null))[_0xf6f9('0x2d')](function(_0x424f05){if(_0x424f05){_0xf82dda[_0xf6f9('0x43')]=_['keys'](db[_0xf6f9('0x6c')][_0xf6f9('0x58')]);_0xf82dda[_0xf6f9('0x40')]=_[_0xf6f9('0x41')](_0x33f04c[_0xf6f9('0x40')]);_0xf82dda['filters']=_['intersection'](_0xf82dda[_0xf6f9('0x43')],_0xf82dda['query']);_0x4bdddc[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0xf82dda[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x33f04c['query'][_0xf6f9('0x45')]));_0x4bdddc[_0xf6f9('0x44')]=_0x4bdddc[_0xf6f9('0x44')]['length']?_0x4bdddc[_0xf6f9('0x44')]:_0xf82dda[_0xf6f9('0x43')];if(!_0x33f04c[_0xf6f9('0x40')]['hasOwnProperty'](_0xf6f9('0x47'))){_0x4bdddc[_0xf6f9('0x27')]=qs[_0xf6f9('0x27')](_0x33f04c['query'][_0xf6f9('0x27')]);_0x4bdddc[_0xf6f9('0x26')]=qs[_0xf6f9('0x26')](_0x33f04c[_0xf6f9('0x40')][_0xf6f9('0x26')]);}_0x4bdddc[_0xf6f9('0x48')]=qs[_0xf6f9('0x49')](_0x33f04c[_0xf6f9('0x40')][_0xf6f9('0x49')]);_0x4bdddc[_0xf6f9('0x4a')]=qs[_0xf6f9('0x4b')](_[_0xf6f9('0x4c')](_0x33f04c[_0xf6f9('0x40')],_0xf82dda['filters']));_0x4bdddc[_0xf6f9('0x4a')]['VoiceQueueId']=_0x424f05['id'];if(_0x33f04c[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x4bdddc['where']=_[_0xf6f9('0x4e')](_0x4bdddc[_0xf6f9('0x4a')],{'$or':_['map'](_0x4bdddc[_0xf6f9('0x44')],function(_0x5f2be8){var _0x1d45b9={};_0x1d45b9[_0x5f2be8]={'$like':'%'+_0x33f04c[_0xf6f9('0x40')][_0xf6f9('0x4d')]+'%'};return _0x1d45b9;})});}_0x4bdddc=_[_0xf6f9('0x4e')]({},_0x4bdddc,_0x33f04c['options']);return db[_0xf6f9('0x6c')]['count']({'where':_0x4bdddc[_0xf6f9('0x4a')]})[_0xf6f9('0x2d')](function(_0x4eb651){_0x154129[_0xf6f9('0x25')]=_0x4eb651;if(_0x33f04c[_0xf6f9('0x40')][_0xf6f9('0x51')]){_0x4bdddc[_0xf6f9('0x52')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4bdddc);})[_0xf6f9('0x2d')](function(_0x35074d){_0x154129[_0xf6f9('0x54')]=_0x35074d;return _0x154129;});}})[_0xf6f9('0x2d')](respondWithFilteredResult(_0x220ecf,_0x4bdddc))['catch'](handleError(_0x220ecf,null));};exports['getHopperBlacks']=function(_0x360f9c,_0x4bb4cf,_0x14339e){var _0x230d8c={'raw':!![],'where':{}};var _0x5ed43a={};var _0x507c17={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf6f9('0x68')]({'where':{'id':_0x360f9c[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x4bb4cf,null))['then'](function(_0x478e50){if(_0x478e50){_0x5ed43a[_0xf6f9('0x43')]=_[_0xf6f9('0x41')](db['CmHopperBlack'][_0xf6f9('0x58')]);_0x5ed43a[_0xf6f9('0x40')]=_['keys'](_0x360f9c[_0xf6f9('0x40')]);_0x5ed43a[_0xf6f9('0x4b')]=_[_0xf6f9('0x42')](_0x5ed43a[_0xf6f9('0x43')],_0x5ed43a['query']);_0x230d8c[_0xf6f9('0x44')]=_['intersection'](_0x5ed43a[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x360f9c[_0xf6f9('0x40')]['fields']));_0x230d8c[_0xf6f9('0x44')]=_0x230d8c[_0xf6f9('0x44')]['length']?_0x230d8c[_0xf6f9('0x44')]:_0x5ed43a[_0xf6f9('0x43')];if(!_0x360f9c[_0xf6f9('0x40')][_0xf6f9('0x66')](_0xf6f9('0x47'))){_0x230d8c['limit']=qs[_0xf6f9('0x27')](_0x360f9c['query']['limit']);_0x230d8c['offset']=qs[_0xf6f9('0x26')](_0x360f9c[_0xf6f9('0x40')][_0xf6f9('0x26')]);}_0x230d8c[_0xf6f9('0x48')]=qs[_0xf6f9('0x49')](_0x360f9c[_0xf6f9('0x40')][_0xf6f9('0x49')]);_0x230d8c[_0xf6f9('0x4a')]=qs[_0xf6f9('0x4b')](_[_0xf6f9('0x4c')](_0x360f9c[_0xf6f9('0x40')],_0x5ed43a[_0xf6f9('0x4b')]));_0x230d8c[_0xf6f9('0x4a')][_0xf6f9('0x6a')]=_0x478e50['id'];if(_0x360f9c[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x230d8c['where']=_[_0xf6f9('0x4e')](_0x230d8c[_0xf6f9('0x4a')],{'$or':_[_0xf6f9('0x34')](_0x230d8c[_0xf6f9('0x44')],function(_0x19bc01){var _0x38c1ae={};_0x38c1ae[_0x19bc01]={'$like':'%'+_0x360f9c['query']['filter']+'%'};return _0x38c1ae;})});}_0x230d8c=_['merge']({},_0x230d8c,_0x360f9c[_0xf6f9('0x50')]);return db[_0xf6f9('0x6d')][_0xf6f9('0x25')]({'where':_0x230d8c['where']})[_0xf6f9('0x2d')](function(_0x471154){_0x507c17[_0xf6f9('0x25')]=_0x471154;if(_0x360f9c['query']['includeAll']){_0x230d8c[_0xf6f9('0x52')]=[{'all':!![]}];}return db[_0xf6f9('0x6d')][_0xf6f9('0x53')](_0x230d8c);})[_0xf6f9('0x2d')](function(_0x1ced71){_0x507c17[_0xf6f9('0x54')]=_0x1ced71;return _0x507c17;});}})[_0xf6f9('0x2d')](respondWithFilteredResult(_0x4bb4cf,_0x230d8c))['catch'](handleError(_0x4bb4cf,null));};exports[_0xf6f9('0x6e')]=function(_0x2d4a9c,_0x4caa18,_0x4167aa){var _0x12cda6={};var _0x198eb1={};var _0x5e1e0a;var _0x34b8ae;return db['VoiceQueue'][_0xf6f9('0x68')]({'where':{'id':_0x2d4a9c[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x4caa18,null))[_0xf6f9('0x2d')](function(_0x3d8c05){if(_0x3d8c05){_0x5e1e0a=_0x3d8c05;_0x198eb1[_0xf6f9('0x43')]=_[_0xf6f9('0x41')](db[_0xf6f9('0x6f')]['rawAttributes']);_0x198eb1[_0xf6f9('0x40')]=_['keys'](_0x2d4a9c[_0xf6f9('0x40')]);_0x198eb1[_0xf6f9('0x4b')]=_[_0xf6f9('0x42')](_0x198eb1[_0xf6f9('0x43')],_0x198eb1[_0xf6f9('0x40')]);_0x12cda6['attributes']=_[_0xf6f9('0x42')](_0x198eb1['model'],qs[_0xf6f9('0x45')](_0x2d4a9c[_0xf6f9('0x40')]['fields']));_0x12cda6[_0xf6f9('0x44')]=_0x12cda6['attributes'][_0xf6f9('0x46')]?_0x12cda6[_0xf6f9('0x44')]:_0x198eb1['model'];_0x12cda6[_0xf6f9('0x48')]=qs[_0xf6f9('0x49')](_0x2d4a9c[_0xf6f9('0x40')]['sort']);_0x12cda6['where']=qs['filters'](_[_0xf6f9('0x4c')](_0x2d4a9c[_0xf6f9('0x40')],_0x198eb1[_0xf6f9('0x4b')]));if(_0x2d4a9c[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x12cda6[_0xf6f9('0x4a')]=_[_0xf6f9('0x4e')](_0x12cda6['where'],{'$or':_[_0xf6f9('0x34')](_0x12cda6[_0xf6f9('0x44')],function(_0x27a21d){var _0x839b2a={};_0x839b2a[_0x27a21d]={'$like':'%'+_0x2d4a9c[_0xf6f9('0x40')][_0xf6f9('0x4d')]+'%'};return _0x839b2a;})});}_0x12cda6=_['merge']({},_0x12cda6,_0x2d4a9c[_0xf6f9('0x50')]);return _0x5e1e0a['getTeams'](_0x12cda6);}})[_0xf6f9('0x2d')](function(_0x45bc6a){if(_0x45bc6a){_0x34b8ae=_0x45bc6a[_0xf6f9('0x46')];if(!_0x2d4a9c[_0xf6f9('0x40')][_0xf6f9('0x66')]('nolimit')){_0x12cda6[_0xf6f9('0x27')]=qs['limit'](_0x2d4a9c['query'][_0xf6f9('0x27')]);_0x12cda6[_0xf6f9('0x26')]=qs['offset'](_0x2d4a9c[_0xf6f9('0x40')][_0xf6f9('0x26')]);}return _0x5e1e0a[_0xf6f9('0x6e')](_0x12cda6);}})[_0xf6f9('0x2d')](function(_0x4097db){if(_0x4097db){return _0x4097db?{'count':_0x34b8ae,'rows':_0x4097db}:null;}})['then'](respondWithResult(_0x4caa18,null))['catch'](handleError(_0x4caa18,null));};exports[_0xf6f9('0x70')]=function(_0x25962b,_0x445dce,_0x5e0d58){var _0x25fcae=_0x25962b[_0xf6f9('0x5a')]['teams'];var _0x3bd2f6=_[_0xf6f9('0x34')](_0x25fcae,'id');return db[_0xf6f9('0x6f')]['findAll']({'where':{'id':_0x3bd2f6},'attributes':['id'],'include':[{'model':db[_0xf6f9('0x71')],'as':_0xf6f9('0x72'),'attributes':['id',_0xf6f9('0x39'),'online',_0xf6f9('0x73'),_0xf6f9('0x74')],'raw':!![]}]})['then'](function(_0x1aea8e){if(_0x1aea8e){var _0x345a32=_[_0xf6f9('0x75')](_0x1aea8e,function(_0x3be40a){var _0x468e68=_0x3be40a[_0xf6f9('0x2e')]({'plain':!![]});_0x468e68['Agents'][_0xf6f9('0x76')](function(_0x365819){_0x365819[_0xf6f9('0x77')]=_[_0xf6f9('0x38')](_0x25fcae,{'id':_0x468e68['id']})[_0xf6f9('0x77')];});return _0x468e68['Agents'];});return db['VoiceQueue'][_0xf6f9('0x38')]({'where':{'id':_0x25962b[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](function(_0x47898b){return db['sequelize'][_0xf6f9('0x78')](function(_0x269afa){return _0x47898b['addTeams'](_0x3bd2f6,{'transaction':_0x269afa})['then'](function(){return BPromise['each'](_0x345a32,function(_0x5be84c){return db[_0xf6f9('0x79')][_0xf6f9('0x7a')]({'where':{'UserId':_0x5be84c['id'],'VoiceQueueId':_0x25962b['params']['id']},'defaults':{'penalty':_0x5be84c['penalty']},'transaction':_0x269afa});});})[_0xf6f9('0x2d')](function(){return BPromise[_0xf6f9('0x7b')](_[_0xf6f9('0x4d')](_0x345a32,{'online':!![]}),function(_0x555d12){return db['UserVoiceQueueRt']['upsert']({'membername':_0x555d12[_0xf6f9('0x39')],'UserId':_0x555d12['id'],'queue_name':_0x47898b[_0xf6f9('0x39')],'VoiceQueueId':_0x47898b['id'],'interface':_['isNil'](_0x555d12[_0xf6f9('0x74')])?util[_0xf6f9('0x7c')]('SIP/%s',_0x555d12['name']):_0x555d12[_0xf6f9('0x74')],'paused':_0x555d12[_0xf6f9('0x73')]||![],'penalty':_0x555d12[_0xf6f9('0x77')]},{'transaction':_0x269afa});});})[_0xf6f9('0x2d')](function(){_0x345a32[_0xf6f9('0x76')](function(_0x431471){socket[_0xf6f9('0x7d')](_0xf6f9('0x7e'),{'UserId':_0x431471['id'],'VoiceQueueId':_0x47898b['id']});});});});});}})[_0xf6f9('0x2d')](respondWithStatusCode(_0x445dce,null))[_0xf6f9('0x55')](handleError(_0x445dce,null));};exports[_0xf6f9('0x7f')]=function(_0x2ef450,_0x41a05c,_0x483490){return db[_0xf6f9('0x6f')]['findAll']({'where':{'id':_0x2ef450[_0xf6f9('0x40')][_0xf6f9('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf6f9('0x2d')](handleEntityNotFound(_0x41a05c,null))[_0xf6f9('0x2d')](function(_0x2eb0aa){var _0x222f85=_[_0xf6f9('0x34')](_0x2eb0aa,'id');var _0x593508=[];var _0x6b696b=[];var _0x2301ea=squel['select']();_0x2301ea[_0xf6f9('0x81')](_0xf6f9('0x82'))[_0xf6f9('0x83')](_0xf6f9('0x84'),'tq')[_0xf6f9('0x85')](_0xf6f9('0x86'),'ut',_0xf6f9('0x87'))[_0xf6f9('0x4a')](_0xf6f9('0x88'),_0x2ef450[_0xf6f9('0x57')]['id']);for(var _0xe1dbc7=0x0;_0xe1dbc7<_0x2eb0aa[_0xf6f9('0x46')];_0xe1dbc7+=0x1){let _0x477113=_0x2eb0aa[_0xe1dbc7];for(var _0x1849af=0x0;_0x1849af<_0x477113[_0xf6f9('0x72')][_0xf6f9('0x46')];_0x1849af+=0x1){let _0x465d88=_0x477113['Agents'][_0x1849af];var _0x494d55=_0x2301ea[_0xf6f9('0x60')]();_0x494d55[_0xf6f9('0x4a')](_0xf6f9('0x89'),_0x465d88['id']);_0x6b696b[_0xf6f9('0x8a')](db[_0xf6f9('0x8b')][_0xf6f9('0x40')](_0x494d55[_0xf6f9('0x8c')](),{'type':db[_0xf6f9('0x8b')][_0xf6f9('0x8d')][_0xf6f9('0x8e')]})[_0xf6f9('0x2d')](function(_0x51aef8){if(_0x51aef8[_0xf6f9('0x46')]===0x1){return _0x465d88['id'];}else{var _0x44c085=_['every'](_[_0xf6f9('0x34')](_0x51aef8,'TeamId'),function(_0x2d5532){return _['includes'](_0x222f85,_0x2d5532);});if(_0x44c085){return _0x465d88['id'];}}}));}}return BPromise[_0xf6f9('0x8f')](_0x6b696b)[_0xf6f9('0x2d')](function(_0x59934e){_0x593508=_(_0x593508)[_0xf6f9('0x90')](_0x59934e)['compact']()[_0xf6f9('0x35')]();return db[_0xf6f9('0x3d')][_0xf6f9('0x38')]({'where':{'id':_0x2ef450[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](function(_0x15dc46){return db[_0xf6f9('0x8b')][_0xf6f9('0x78')](function(_0x6ad6b5){return _0x15dc46['removeTeams'](_0x2ef450[_0xf6f9('0x40')][_0xf6f9('0x80')],{'transaction':_0x6ad6b5})['then'](function(){if(!_[_0xf6f9('0x91')](_0x593508)){return _0x15dc46['removeAgents'](_0x593508,{'transaction':_0x6ad6b5})[_0xf6f9('0x2d')](function(){return db[_0xf6f9('0x92')][_0xf6f9('0x93')]({'where':{'VoiceQueueId':_0x2ef450[_0xf6f9('0x57')]['id'],'UserId':_0x593508},'transaction':_0x6ad6b5});});}})[_0xf6f9('0x2d')](function(){_0x593508[_0xf6f9('0x76')](function(_0x3b7c23){socket[_0xf6f9('0x7d')](_0xf6f9('0x94'),{'UserId':_0x3b7c23,'VoiceQueueId':_0x15dc46['id']});});});});});});})[_0xf6f9('0x2d')](respondWithStatusCode(_0x41a05c,null))[_0xf6f9('0x55')](handleError(_0x41a05c,null));};exports['addAgents']=function(_0x1182d4,_0x29320b,_0x230011){var _0x574813,_0x551ca2;return db[_0xf6f9('0x3d')][_0xf6f9('0x38')]({'where':{'id':_0x1182d4[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x29320b,null))[_0xf6f9('0x2d')](function(_0xab7a83){if(_0xab7a83){_0x551ca2=_0xab7a83;return _0xab7a83['addAgents'](_0x1182d4[_0xf6f9('0x5a')][_0xf6f9('0x80')],_[_0xf6f9('0x61')](_0x1182d4[_0xf6f9('0x5a')],[_0xf6f9('0x80'),'id'])||{})['spread'](function(_0x14b78c){for(var _0x5800de=0x0;_0x5800de<_0x1182d4[_0xf6f9('0x5a')][_0xf6f9('0x80')][_0xf6f9('0x46')];_0x5800de+=0x1){socket[_0xf6f9('0x7d')](_0xf6f9('0x7e'),{'UserId':_0x1182d4['body'][_0xf6f9('0x80')][_0x5800de],'VoiceQueueId':_0x1182d4[_0xf6f9('0x57')]['id']});}return _0x14b78c;});}})[_0xf6f9('0x2d')](function(_0x3d865f){_0x574813=_0x3d865f||[];if(_0x551ca2){return db[_0xf6f9('0x71')][_0xf6f9('0x53')]({'where':{'id':_0x1182d4[_0xf6f9('0x5a')][_0xf6f9('0x80')]},'attributes':['id',_0xf6f9('0x39'),_0xf6f9('0x95'),_0xf6f9('0x73'),_0xf6f9('0x74')],'raw':!![]});}})[_0xf6f9('0x2d')](function(_0x569b3a){if(!_[_0xf6f9('0x91')](_0x569b3a)){var _0x860c83=[];for(var _0x3555f7=0x0;_0x3555f7<_0x569b3a[_0xf6f9('0x46')];_0x3555f7++){if(_0x569b3a[_0x3555f7][_0xf6f9('0x95')]){_0x860c83[_0xf6f9('0x8a')](db[_0xf6f9('0x92')][_0xf6f9('0x96')]({'membername':_0x569b3a[_0x3555f7][_0xf6f9('0x39')],'UserId':_0x569b3a[_0x3555f7]['id'],'queue_name':_0x551ca2[_0xf6f9('0x39')],'VoiceQueueId':_0x551ca2['id'],'interface':_[_0xf6f9('0x97')](_0x569b3a[_0x3555f7][_0xf6f9('0x74')])?util[_0xf6f9('0x7c')](_0xf6f9('0x98'),_0x569b3a[_0x3555f7]['name']):_0x569b3a[_0x3555f7]['interface'],'paused':_0x569b3a[_0x3555f7]['voicePause']||![],'penalty':_0x1182d4[_0xf6f9('0x5a')][_0xf6f9('0x77')]||0x0}));}}return BPromise['all'](_0x860c83);}})[_0xf6f9('0x2d')](function(){return _0x574813;})[_0xf6f9('0x2d')](respondWithResult(_0x29320b,null))['catch'](handleError(_0x29320b,null));};exports[_0xf6f9('0x99')]=function(_0x3783ea,_0x384961,_0x13f478){return db['VoiceQueue'][_0xf6f9('0x38')]({'where':{'id':_0x3783ea[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0x384961,null))[_0xf6f9('0x2d')](function(_0x40250f){if(_0x40250f){return _0x40250f[_0xf6f9('0x99')](_0x3783ea[_0xf6f9('0x40')][_0xf6f9('0x80')])[_0xf6f9('0x2d')](function(){if(_['isArray'](_0x3783ea[_0xf6f9('0x40')]['ids'])){for(var _0x37405c=0x0;_0x37405c<_0x3783ea[_0xf6f9('0x40')][_0xf6f9('0x80')][_0xf6f9('0x46')];_0x37405c+=0x1){socket[_0xf6f9('0x7d')](_0xf6f9('0x94'),{'UserId':Number(_0x3783ea[_0xf6f9('0x40')][_0xf6f9('0x80')][_0x37405c]),'VoiceQueueId':Number(_0x3783ea['params']['id'])});}}else{socket[_0xf6f9('0x7d')](_0xf6f9('0x94'),{'UserId':Number(_0x3783ea['query']['ids']),'VoiceQueueId':Number(_0x3783ea[_0xf6f9('0x57')]['id'])});}});}})['then'](function(_0xa1551a){return db[_0xf6f9('0x92')]['destroy']({'where':{'VoiceQueueId':_0x3783ea[_0xf6f9('0x57')]['id'],'UserId':_0x3783ea[_0xf6f9('0x40')][_0xf6f9('0x80')]}})[_0xf6f9('0x2d')](function(){return _0xa1551a;});})[_0xf6f9('0x2d')](respondWithStatusCode(_0x384961,null))['catch'](handleError(_0x384961,null));};exports[_0xf6f9('0x9a')]=function(_0xe2de80,_0x76165c,_0x5cecdb){var _0x8842f8={};var _0x26639e={};var _0x10d96f;var _0x5b77f0;return db['VoiceQueue'][_0xf6f9('0x68')]({'where':{'id':_0xe2de80[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0x76165c,null))['then'](function(_0x2ace8e){if(_0x2ace8e){_0x10d96f=_0x2ace8e;_0x26639e[_0xf6f9('0x43')]=_['keys'](db[_0xf6f9('0x71')][_0xf6f9('0x58')]);_0x26639e[_0xf6f9('0x40')]=_['keys'](_0xe2de80[_0xf6f9('0x40')]);_0x26639e[_0xf6f9('0x4b')]=_['intersection'](_0x26639e[_0xf6f9('0x43')],_0x26639e['query']);_0x8842f8[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0x26639e['model'],qs[_0xf6f9('0x45')](_0xe2de80['query'][_0xf6f9('0x45')]));_0x8842f8['attributes']=_0x8842f8[_0xf6f9('0x44')][_0xf6f9('0x46')]?_0x8842f8[_0xf6f9('0x44')]:_0x26639e[_0xf6f9('0x43')];_0x8842f8[_0xf6f9('0x48')]=qs['sort'](_0xe2de80[_0xf6f9('0x40')]['sort']);_0x8842f8['where']=qs[_0xf6f9('0x4b')](_[_0xf6f9('0x4c')](_0xe2de80[_0xf6f9('0x40')],_0x26639e['filters']));if(_0xe2de80['query'][_0xf6f9('0x4d')]){_0x8842f8[_0xf6f9('0x4a')]=_[_0xf6f9('0x4e')](_0x8842f8[_0xf6f9('0x4a')],{'$or':_[_0xf6f9('0x34')](_0x8842f8['attributes'],function(_0x715bef){var _0x3e7de3={};_0x3e7de3[_0x715bef]={'$like':'%'+_0xe2de80['query']['filter']+'%'};return _0x3e7de3;})});}_0x8842f8=_['merge']({},_0x8842f8,_0xe2de80[_0xf6f9('0x50')]);return _0x10d96f[_0xf6f9('0x9a')](_0x8842f8);}})[_0xf6f9('0x2d')](function(_0x426e6a){if(_0x426e6a){_0x5b77f0=_0x426e6a[_0xf6f9('0x46')];if(!_0xe2de80[_0xf6f9('0x40')][_0xf6f9('0x66')](_0xf6f9('0x47'))){_0x8842f8['limit']=qs[_0xf6f9('0x27')](_0xe2de80[_0xf6f9('0x40')][_0xf6f9('0x27')]);_0x8842f8[_0xf6f9('0x26')]=qs[_0xf6f9('0x26')](_0xe2de80[_0xf6f9('0x40')][_0xf6f9('0x26')]);}return _0x10d96f[_0xf6f9('0x9a')](_0x8842f8);}})[_0xf6f9('0x2d')](function(_0x3b8dc6){if(_0x3b8dc6){return _0x3b8dc6?{'count':_0x5b77f0,'rows':_0x3b8dc6}:null;}})[_0xf6f9('0x2d')](respondWithResult(_0x76165c,null))[_0xf6f9('0x55')](handleError(_0x76165c,null));};exports['getMembers']=function(_0x16ee18,_0x16cc8d,_0x3b0691){var _0x5129eb={};var _0x54c8e7={};var _0x33e419;var _0x1519a4;return db[_0xf6f9('0x3d')]['findOne']({'where':{'id':_0x16ee18[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x16cc8d,null))[_0xf6f9('0x2d')](function(_0x2ce239){if(_0x2ce239){_0x33e419=_0x2ce239;_0x54c8e7['model']=_[_0xf6f9('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x54c8e7['query']=_[_0xf6f9('0x41')](_0x16ee18[_0xf6f9('0x40')]);_0x54c8e7[_0xf6f9('0x4b')]=_[_0xf6f9('0x42')](_0x54c8e7[_0xf6f9('0x43')],_0x54c8e7[_0xf6f9('0x40')]);_0x5129eb['attributes']=_[_0xf6f9('0x42')](_0x54c8e7[_0xf6f9('0x43')],qs['fields'](_0x16ee18[_0xf6f9('0x40')][_0xf6f9('0x45')]));_0x5129eb[_0xf6f9('0x44')]=_0x5129eb[_0xf6f9('0x44')]['length']?_0x5129eb['attributes']:_0x54c8e7['model'];_0x5129eb[_0xf6f9('0x48')]=qs['sort'](_0x16ee18[_0xf6f9('0x40')][_0xf6f9('0x49')]);_0x5129eb[_0xf6f9('0x4a')]=qs['filters'](_[_0xf6f9('0x4c')](_0x16ee18['query'],_0x54c8e7[_0xf6f9('0x4b')]));if(_0x16ee18[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x5129eb[_0xf6f9('0x4a')]=_[_0xf6f9('0x4e')](_0x5129eb['where'],{'$or':_['map'](_0x5129eb['attributes'],function(_0x548c95){var _0x4f310a={};_0x4f310a[_0x548c95]={'$like':'%'+_0x16ee18[_0xf6f9('0x40')][_0xf6f9('0x4d')]+'%'};return _0x4f310a;})});}_0x5129eb=_[_0xf6f9('0x4e')]({},_0x5129eb,_0x16ee18[_0xf6f9('0x50')]);return _0x33e419[_0xf6f9('0x9b')](_0x5129eb);}})['then'](function(_0x16353c){if(_0x16353c){_0x1519a4=_0x16353c[_0xf6f9('0x46')];if(!_0x16ee18['query'][_0xf6f9('0x66')](_0xf6f9('0x47'))){_0x5129eb[_0xf6f9('0x27')]=qs[_0xf6f9('0x27')](_0x16ee18[_0xf6f9('0x40')][_0xf6f9('0x27')]);_0x5129eb[_0xf6f9('0x26')]=qs[_0xf6f9('0x26')](_0x16ee18[_0xf6f9('0x40')][_0xf6f9('0x26')]);}return _0x33e419[_0xf6f9('0x9b')](_0x5129eb);}})[_0xf6f9('0x2d')](function(_0x428c8d){return _0x428c8d?{'count':_0x1519a4,'rows':_0x428c8d}:null;})[_0xf6f9('0x2d')](respondWithResult(_0x16cc8d,null))['catch'](handleError(_0x16cc8d,null));};exports[_0xf6f9('0x9c')]=function(_0x2d80c0,_0x498378,_0x130947){var _0x51f93b={};var _0x153104={};var _0x3e5b91;var _0x29f3b2;return db[_0xf6f9('0x3d')]['findOne']({'where':{'id':_0x2d80c0[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x498378,null))[_0xf6f9('0x2d')](function(_0x127cc0){if(_0x127cc0){_0x3e5b91=_0x127cc0;_0x153104[_0xf6f9('0x43')]=_['keys'](db[_0xf6f9('0x9d')][_0xf6f9('0x58')]);_0x153104[_0xf6f9('0x40')]=_[_0xf6f9('0x41')](_0x2d80c0[_0xf6f9('0x40')]);_0x153104[_0xf6f9('0x4b')]=_['intersection'](_0x153104[_0xf6f9('0x43')],_0x153104['query']);_0x51f93b[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0x153104[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x2d80c0[_0xf6f9('0x40')][_0xf6f9('0x45')]));_0x51f93b[_0xf6f9('0x44')]=_0x51f93b[_0xf6f9('0x44')]['length']?_0x51f93b[_0xf6f9('0x44')]:_0x153104[_0xf6f9('0x43')];_0x51f93b[_0xf6f9('0x48')]=qs['sort'](_0x2d80c0[_0xf6f9('0x40')][_0xf6f9('0x49')]);_0x51f93b['where']=qs[_0xf6f9('0x4b')](_[_0xf6f9('0x4c')](_0x2d80c0[_0xf6f9('0x40')],_0x153104[_0xf6f9('0x4b')]));if(_0x2d80c0[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x51f93b[_0xf6f9('0x4a')]=_[_0xf6f9('0x4e')](_0x51f93b[_0xf6f9('0x4a')],{'$or':_[_0xf6f9('0x34')](_0x51f93b[_0xf6f9('0x44')],function(_0x5bbfed){var _0x2f0d17={};_0x2f0d17[_0x5bbfed]={'$like':'%'+_0x2d80c0['query'][_0xf6f9('0x4d')]+'%'};return _0x2f0d17;})});}_0x51f93b=_['merge']({},_0x51f93b,_0x2d80c0[_0xf6f9('0x50')]);return _0x3e5b91['getLists'](_0x51f93b);}})[_0xf6f9('0x2d')](function(_0x1ac48f){if(_0x1ac48f){_0x29f3b2=_0x1ac48f[_0xf6f9('0x46')];if(!_0x2d80c0[_0xf6f9('0x40')][_0xf6f9('0x66')](_0xf6f9('0x47'))){_0x51f93b['limit']=qs[_0xf6f9('0x27')](_0x2d80c0[_0xf6f9('0x40')][_0xf6f9('0x27')]);_0x51f93b['offset']=qs[_0xf6f9('0x26')](_0x2d80c0['query'][_0xf6f9('0x26')]);}return _0x3e5b91[_0xf6f9('0x9c')](_0x51f93b);}})[_0xf6f9('0x2d')](function(_0xe14d90){if(_0xe14d90){return _0xe14d90?{'count':_0x29f3b2,'rows':_0xe14d90}:null;}})[_0xf6f9('0x2d')](respondWithResult(_0x498378,null))[_0xf6f9('0x55')](handleError(_0x498378,null));};exports[_0xf6f9('0x9e')]=function(_0x3bffd2,_0x1f6d7f,_0x236f13){var _0x2f535d,_0x5ab5d1;return db[_0xf6f9('0x3d')][_0xf6f9('0x38')]({'where':{'id':_0x3bffd2['params']['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0x1f6d7f,null))[_0xf6f9('0x2d')](function(_0x58cb08){if(_0x58cb08){_0x5ab5d1=_0x58cb08;return _0x58cb08[_0xf6f9('0x9e')](_0x3bffd2[_0xf6f9('0x5a')]['ids'],_['omit'](_0x3bffd2[_0xf6f9('0x5a')],[_0xf6f9('0x80'),'id'])||{});}return null;})[_0xf6f9('0x9f')](function(_0x1dfd50){var _0x2c15e7;_0x2f535d=_0x1dfd50||[];var _0x8c32b7=[];if(_0x1dfd50){for(var _0x5ca6d4=0x0;_0x5ca6d4<_0x1dfd50[_0xf6f9('0x46')];_0x5ca6d4+=0x1){var _0x10f2f3=_0x1dfd50[_0x5ca6d4][_0xf6f9('0x2e')]({'plain':!![]});_0x5ab5d1[_0xf6f9('0xa0')]=_0x3bffd2[_0xf6f9('0x5a')][_0xf6f9('0xa0')]?_0x3bffd2[_0xf6f9('0x5a')][_0xf6f9('0xa0')]:_0x5ab5d1[_0xf6f9('0xa0')];switch(_0x5ab5d1['dialCheckDuplicateType']){case _0xf6f9('0xa1'):_0x2c15e7=squel[_0xf6f9('0xa2')]()[_0xf6f9('0xa3')](_0xf6f9('0xa4'))['fromQuery']([_0xf6f9('0xa5'),_0xf6f9('0xa6'),_0xf6f9('0xa7'),_0xf6f9('0xa8'),_0xf6f9('0x6a'),'createdAt',_0xf6f9('0x62')],squel[_0xf6f9('0xa9')]()[_0xf6f9('0x81')](_0xf6f9('0xa5'),_0xf6f9('0xa5'))['field'](_0xf6f9('0xaa'),_0xf6f9('0xa6'))[_0xf6f9('0x81')]('id',_0xf6f9('0xa7'))[_0xf6f9('0x81')](_0x10f2f3['CmListId']['toString'](),_0xf6f9('0xa8'))[_0xf6f9('0x81')](_0x3bffd2['params']['id'][_0xf6f9('0x8c')](),'VoiceQueueId')[_0xf6f9('0x81')](_0xf6f9('0xaa'),_0xf6f9('0x63'))[_0xf6f9('0x81')]('NOW()',_0xf6f9('0x62'))[_0xf6f9('0x83')]('cm_contacts')[_0xf6f9('0x4a')](_0xf6f9('0xab'))[_0xf6f9('0x4a')](_0xf6f9('0xac'),_0x10f2f3[_0xf6f9('0xad')][_0xf6f9('0x8c')]())[_0xf6f9('0x4a')](_0xf6f9('0xae'))['where'](_0xf6f9('0xaf'),squel[_0xf6f9('0xa9')]()[_0xf6f9('0x81')](_0xf6f9('0xb0'))[_0xf6f9('0x83')](_0xf6f9('0xb1'))[_0xf6f9('0x4a')]('VoiceQueueId\x20=\x20?',_0x3bffd2[_0xf6f9('0x57')]['id'][_0xf6f9('0x8c')]()))[_0xf6f9('0x4a')](_0xf6f9('0xaf'),squel[_0xf6f9('0xa9')]()['field'](_0xf6f9('0xb2'))[_0xf6f9('0x83')](_0xf6f9('0xa4'))[_0xf6f9('0x4a')](_0xf6f9('0x88'),_0x3bffd2[_0xf6f9('0x57')]['id'][_0xf6f9('0x8c')]())))[_0xf6f9('0x8c')]();break;case _0xf6f9('0xb3'):_0x2c15e7=squel[_0xf6f9('0xa2')]()[_0xf6f9('0xa3')](_0xf6f9('0xa4'))[_0xf6f9('0xb4')]([_0xf6f9('0xa5'),_0xf6f9('0xa6'),_0xf6f9('0xa7'),'ListId',_0xf6f9('0x6a'),_0xf6f9('0x63'),'updatedAt'],squel[_0xf6f9('0xa9')]()[_0xf6f9('0x81')](_0xf6f9('0xa5'),'phone')['field']('NOW()',_0xf6f9('0xa6'))['field']('id',_0xf6f9('0xa7'))['field'](_0x10f2f3[_0xf6f9('0xad')][_0xf6f9('0x8c')](),_0xf6f9('0xa8'))[_0xf6f9('0x81')](_0x3bffd2[_0xf6f9('0x57')]['id'][_0xf6f9('0x8c')](),'VoiceQueueId')['field'](_0xf6f9('0xaa'),_0xf6f9('0x63'))[_0xf6f9('0x81')]('NOW()',_0xf6f9('0x62'))[_0xf6f9('0x83')](_0xf6f9('0xb5'))['where'](_0xf6f9('0xab'))[_0xf6f9('0x4a')](_0xf6f9('0xac'),_0x10f2f3[_0xf6f9('0xad')][_0xf6f9('0x8c')]())[_0xf6f9('0x4a')](_0xf6f9('0xae'))[_0xf6f9('0x4a')](_0xf6f9('0xaf'),squel[_0xf6f9('0xa9')]()[_0xf6f9('0x81')](_0xf6f9('0xb2'))[_0xf6f9('0x83')](_0xf6f9('0xa4'))[_0xf6f9('0x4a')](_0xf6f9('0x88'),_0x3bffd2[_0xf6f9('0x57')]['id'][_0xf6f9('0x8c')]())))[_0xf6f9('0x8c')]();break;default:_0x2c15e7=squel[_0xf6f9('0xa2')]()['into'](_0xf6f9('0xa4'))[_0xf6f9('0xb4')](['phone',_0xf6f9('0xa6'),_0xf6f9('0xa7'),_0xf6f9('0xa8'),_0xf6f9('0x6a'),_0xf6f9('0x63'),_0xf6f9('0x62')],squel['select']()[_0xf6f9('0x81')]('phone',_0xf6f9('0xa5'))[_0xf6f9('0x81')](_0xf6f9('0xaa'),_0xf6f9('0xa6'))[_0xf6f9('0x81')]('id',_0xf6f9('0xa7'))[_0xf6f9('0x81')](_0x10f2f3[_0xf6f9('0xad')]['toString'](),'ListId')['field'](_0x3bffd2['params']['id'][_0xf6f9('0x8c')](),_0xf6f9('0x6a'))[_0xf6f9('0x81')](_0xf6f9('0xaa'),_0xf6f9('0x63'))[_0xf6f9('0x81')](_0xf6f9('0xaa'),_0xf6f9('0x62'))[_0xf6f9('0x83')](_0xf6f9('0xb5'))[_0xf6f9('0x4a')](_0xf6f9('0xab'))[_0xf6f9('0x4a')]('ListId\x20=\x20?',_0x10f2f3[_0xf6f9('0xad')][_0xf6f9('0x8c')]())[_0xf6f9('0x4a')]('phone\x20IS\x20NOT\x20NULL'))[_0xf6f9('0x8c')]();}_0x8c32b7[_0xf6f9('0x8a')](db['sequelize'][_0xf6f9('0x40')](_0x2c15e7));}return BPromise[_0xf6f9('0x8f')](_0x8c32b7);}})[_0xf6f9('0x2d')](function(){return _0x2f535d;})[_0xf6f9('0x2d')](respondWithResult(_0x1f6d7f,null))['catch'](handleError(_0x1f6d7f,null));};exports[_0xf6f9('0xb6')]=function(_0xaf43ca,_0x41db3e,_0x4581c3){return db['VoiceQueue'][_0xf6f9('0x38')]({'where':{'id':_0xaf43ca['params']['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0x41db3e,null))[_0xf6f9('0x2d')](function(_0x13bc1e){if(_0x13bc1e){return _0x13bc1e[_0xf6f9('0xb6')](_0xaf43ca[_0xf6f9('0x40')][_0xf6f9('0x80')]);}})[_0xf6f9('0x2d')](function(_0x575f90){if(_0x575f90){return db[_0xf6f9('0x65')][_0xf6f9('0x93')]({'where':{'ListId':_0xaf43ca[_0xf6f9('0x40')][_0xf6f9('0x80')],'VoiceQueueId':_0xaf43ca[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](function(){return _0x575f90;});}})[_0xf6f9('0x2d')](respondWithStatusCode(_0x41db3e,null))[_0xf6f9('0x55')](handleError(_0x41db3e,null));};exports[_0xf6f9('0xb7')]=function(_0x1ca209,_0x163821,_0x5ad514){var _0x5c0c1e={};var _0x3db9b4={};var _0x3024f9;var _0xbc2462;return db[_0xf6f9('0x3d')][_0xf6f9('0x68')]({'where':{'id':_0x1ca209['params']['id']}})['then'](handleEntityNotFound(_0x163821,null))[_0xf6f9('0x2d')](function(_0x2b9a5c){if(_0x2b9a5c){_0x3024f9=_0x2b9a5c;_0x3db9b4[_0xf6f9('0x43')]=_[_0xf6f9('0x41')](db[_0xf6f9('0x9d')][_0xf6f9('0x58')]);_0x3db9b4[_0xf6f9('0x40')]=_[_0xf6f9('0x41')](_0x1ca209['query']);_0x3db9b4['filters']=_['intersection'](_0x3db9b4['model'],_0x3db9b4[_0xf6f9('0x40')]);_0x5c0c1e[_0xf6f9('0x44')]=_[_0xf6f9('0x42')](_0x3db9b4[_0xf6f9('0x43')],qs[_0xf6f9('0x45')](_0x1ca209[_0xf6f9('0x40')][_0xf6f9('0x45')]));_0x5c0c1e[_0xf6f9('0x44')]=_0x5c0c1e[_0xf6f9('0x44')][_0xf6f9('0x46')]?_0x5c0c1e['attributes']:_0x3db9b4[_0xf6f9('0x43')];_0x5c0c1e[_0xf6f9('0x48')]=qs['sort'](_0x1ca209[_0xf6f9('0x40')][_0xf6f9('0x49')]);_0x5c0c1e[_0xf6f9('0x4a')]=qs['filters'](_[_0xf6f9('0x4c')](_0x1ca209['query'],_0x3db9b4[_0xf6f9('0x4b')]));if(_0x1ca209[_0xf6f9('0x40')][_0xf6f9('0x4d')]){_0x5c0c1e[_0xf6f9('0x4a')]=_[_0xf6f9('0x4e')](_0x5c0c1e[_0xf6f9('0x4a')],{'$or':_[_0xf6f9('0x34')](_0x5c0c1e[_0xf6f9('0x44')],function(_0x53df10){var _0x4b1907={};_0x4b1907[_0x53df10]={'$like':'%'+_0x1ca209[_0xf6f9('0x40')][_0xf6f9('0x4d')]+'%'};return _0x4b1907;})});}_0x5c0c1e=_[_0xf6f9('0x4e')]({},_0x5c0c1e,_0x1ca209[_0xf6f9('0x50')]);return _0x3024f9['getBlackLists'](_0x5c0c1e);}})[_0xf6f9('0x2d')](function(_0x2bcd98){if(_0x2bcd98){_0xbc2462=_0x2bcd98['length'];if(!_0x1ca209[_0xf6f9('0x40')]['hasOwnProperty'](_0xf6f9('0x47'))){_0x5c0c1e['limit']=qs[_0xf6f9('0x27')](_0x1ca209['query'][_0xf6f9('0x27')]);_0x5c0c1e[_0xf6f9('0x26')]=qs['offset'](_0x1ca209[_0xf6f9('0x40')]['offset']);}return _0x3024f9[_0xf6f9('0xb7')](_0x5c0c1e);}})[_0xf6f9('0x2d')](function(_0x586d29){if(_0x586d29){return _0x586d29?{'count':_0xbc2462,'rows':_0x586d29}:null;}})[_0xf6f9('0x2d')](respondWithResult(_0x163821,null))[_0xf6f9('0x55')](handleError(_0x163821,null));};exports[_0xf6f9('0xb8')]=function(_0x157791,_0x29bdf3,_0x4a78d5){var _0xadb722,_0x5c852f;return db[_0xf6f9('0x3d')][_0xf6f9('0x38')]({'where':{'id':_0x157791[_0xf6f9('0x57')]['id']}})['then'](handleEntityNotFound(_0x29bdf3,null))['then'](function(_0x1535fb){if(_0x1535fb){_0x5c852f=_0x1535fb;return _0x1535fb['addBlackLists'](_0x157791[_0xf6f9('0x5a')][_0xf6f9('0x80')],_[_0xf6f9('0x61')](_0x157791[_0xf6f9('0x5a')],[_0xf6f9('0x80'),'id'])||{});}return null;})[_0xf6f9('0x9f')](function(_0x1aa070){var _0x51b8bb;_0xadb722=_0x1aa070||[];var _0x5cf0e2=[];if(_0x1aa070){for(var _0x3aeb21=0x0;_0x3aeb21<_0x1aa070['length'];_0x3aeb21+=0x1){var _0x228a98=_0x1aa070[_0x3aeb21][_0xf6f9('0x2e')]({'plain':!![]});_0x51b8bb=squel['insert']()['into'](_0xf6f9('0xb9'))[_0xf6f9('0xb4')]([_0xf6f9('0xa5'),_0xf6f9('0xa7'),_0xf6f9('0xa8'),_0xf6f9('0x6a'),_0xf6f9('0x63'),_0xf6f9('0x62')],squel[_0xf6f9('0xa9')]()['field'](_0xf6f9('0xa5'),_0xf6f9('0xa5'))[_0xf6f9('0x81')]('id','ContactId')[_0xf6f9('0x81')](_0x228a98[_0xf6f9('0xad')][_0xf6f9('0x8c')](),_0xf6f9('0xa8'))['field'](_0x157791['params']['id'][_0xf6f9('0x8c')](),_0xf6f9('0x6a'))[_0xf6f9('0x81')](_0xf6f9('0xaa'),_0xf6f9('0x63'))[_0xf6f9('0x81')](_0xf6f9('0xaa'),_0xf6f9('0x62'))[_0xf6f9('0x83')](_0xf6f9('0xb5'))[_0xf6f9('0x4a')](_0xf6f9('0xab'))[_0xf6f9('0x4a')](_0xf6f9('0xac'),_0x228a98[_0xf6f9('0xad')][_0xf6f9('0x8c')]())[_0xf6f9('0x4a')](_0xf6f9('0xae')))[_0xf6f9('0x8c')]();_0x5cf0e2[_0xf6f9('0x8a')](db[_0xf6f9('0x8b')][_0xf6f9('0x40')](_0x51b8bb));}return BPromise[_0xf6f9('0x8f')](_0x5cf0e2);}})[_0xf6f9('0x2d')](function(){return _0xadb722;})[_0xf6f9('0x2d')](respondWithResult(_0x29bdf3,null))['catch'](handleError(_0x29bdf3,null));};exports['removeBlackLists']=function(_0x2bb463,_0x17cea4,_0x352a7b){return db[_0xf6f9('0x3d')]['find']({'where':{'id':_0x2bb463['params']['id']}})[_0xf6f9('0x2d')](handleEntityNotFound(_0x17cea4,null))[_0xf6f9('0x2d')](function(_0x588c2b){if(_0x588c2b){return _0x588c2b[_0xf6f9('0xba')](_0x2bb463[_0xf6f9('0x40')]['ids']);}})[_0xf6f9('0x2d')](function(_0x4159a7){if(_0x4159a7){return db[_0xf6f9('0x6d')]['destroy']({'where':{'ListId':_0x2bb463[_0xf6f9('0x40')][_0xf6f9('0x80')],'VoiceQueueId':_0x2bb463[_0xf6f9('0x57')]['id']}})[_0xf6f9('0x2d')](function(){return _0x4159a7;});}})[_0xf6f9('0x2d')](respondWithStatusCode(_0x17cea4,null))[_0xf6f9('0x55')](handleError(_0x17cea4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e83e0c7..8b7600f 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 _0x5fb2=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x15085f,_0x28fdca){var _0x5bcc27=function(_0x1064cc){while(--_0x1064cc){_0x15085f['push'](_0x15085f['shift']());}};_0x5bcc27(++_0x28fdca);}(_0x5fb2,0x129));var _0x25fb=function(_0x2a24de,_0x21fcbc){_0x2a24de=_0x2a24de-0x0;var _0x32b38e=_0x5fb2[_0x2a24de];return _0x32b38e;};'use strict';var EventEmitter=require(_0x25fb('0x0'));var VoiceQueue=require(_0x25fb('0x1'))['db'][_0x25fb('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x25fb('0x3')](0x0);var events={'afterCreate':_0x25fb('0x4'),'afterUpdate':_0x25fb('0x5'),'afterDestroy':_0x25fb('0x6')};function emitEvent(_0x3ff7c8){return function(_0x16ec0d,_0x2753b8,_0x5c704a){VoiceQueueEvents['emit'](_0x3ff7c8+':'+_0x16ec0d['id'],_0x16ec0d);VoiceQueueEvents['emit'](_0x3ff7c8,_0x16ec0d);_0x5c704a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x25fb('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xa592=['emit','hook','exports','save','update','remove'];(function(_0x5522fe,_0x46c5dd){var _0xd648f5=function(_0x413d11){while(--_0x413d11){_0x5522fe['push'](_0x5522fe['shift']());}};_0xd648f5(++_0x46c5dd);}(_0xa592,0xdb));var _0x2a59=function(_0x243676,_0x351afc){_0x243676=_0x243676-0x0;var _0x5c4497=_0xa592[_0x243676];return _0x5c4497;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a59('0x0'),'afterUpdate':_0x2a59('0x1'),'afterDestroy':_0x2a59('0x2')};function emitEvent(_0x3bd13e){return function(_0x11a640,_0x44d092,_0x4e13d6){VoiceQueueEvents[_0x2a59('0x3')](_0x3bd13e+':'+_0x11a640['id'],_0x11a640);VoiceQueueEvents['emit'](_0x3bd13e,_0x11a640);_0x4e13d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2a59('0x4')](e,emitEvent(event));}}module[_0x2a59('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e4c62aa..6cda497 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 _0x6d49=['VoiceQueue','voice_queues','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x39a634,_0xa2d86e){var _0xfeb427=function(_0x36c14c){while(--_0x36c14c){_0x39a634['push'](_0x39a634['shift']());}};_0xfeb427(++_0xa2d86e);}(_0x6d49,0xda));var _0x96d4=function(_0x43581c,_0x52c91b){_0x43581c=_0x43581c-0x0;var _0x2bfd4f=_0x6d49[_0x43581c];return _0x2bfd4f;};'use strict';var _=require(_0x96d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x96d4('0x1'));var moment=require(_0x96d4('0x2'));var BPromise=require(_0x96d4('0x3'));var rp=require(_0x96d4('0x4'));var fs=require('fs');var path=require(_0x96d4('0x5'));var rimraf=require('rimraf');var config=require(_0x96d4('0x6'));var attributes=require(_0x96d4('0x7'));module[_0x96d4('0x8')]=function(_0x33a58c,_0x4e13d6){return _0x33a58c[_0x96d4('0x9')](_0x96d4('0xa'),attributes,{'tableName':_0x96d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9db=['./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xb9db,0x7a));var _0xbb9d=function(_0x13701b,_0x24bc8f){_0x13701b=_0x13701b-0x0;var _0x362fb8=_0xb9db[_0x13701b];return _0x362fb8;};'use strict';var _=require(_0xbb9d('0x0'));var util=require(_0xbb9d('0x1'));var logger=require(_0xbb9d('0x2'))(_0xbb9d('0x3'));var moment=require(_0xbb9d('0x4'));var BPromise=require(_0xbb9d('0x5'));var rp=require(_0xbb9d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbb9d('0x7'));var attributes=require(_0xbb9d('0x8'));module[_0xbb9d('0x9')]=function(_0x2b9915,_0x239a84){return _0x2b9915[_0xbb9d('0xa')](_0xbb9d('0xb'),attributes,{'tableName':_0xbb9d('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 d46a97e..32d3f71 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 _0x8926=['localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','limit','include','model','attributes','map','ShowVoiceQueue','VoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x484ddf,_0x5f8f3f){var _0x563684=function(_0x103f32){while(--_0x103f32){_0x484ddf['push'](_0x484ddf['shift']());}};_0x563684(++_0x5f8f3f);}(_0x8926,0x18d));var _0x6892=function(_0x31a536,_0x3f799e){_0x31a536=_0x31a536-0x0;var _0x949b6d=_0x8926[_0x31a536];return _0x949b6d;};'use strict';var _=require(_0x6892('0x0'));var util=require(_0x6892('0x1'));var moment=require(_0x6892('0x2'));var BPromise=require(_0x6892('0x3'));var rs=require(_0x6892('0x4'));var fs=require('fs');var Redis=require(_0x6892('0x5'));var db=require(_0x6892('0x6'))['db'];var utils=require(_0x6892('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6892('0x8'));var jayson=require(_0x6892('0x9'));var client=jayson[_0x6892('0xa')][_0x6892('0xb')]({'port':0x232a});config[_0x6892('0xc')]=_['defaults'](config[_0x6892('0xc')],{'host':_0x6892('0xd'),'port':0x18eb});var socket=require(_0x6892('0xe'))(new Redis(config['redis']));require(_0x6892('0xf'))[_0x6892('0x10')](socket);function respondWithRpcPromise(_0x44055e,_0x28db46,_0x429144){return new BPromise(function(_0x17041a,_0x24d283){return client[_0x6892('0x11')](_0x44055e,_0x429144)[_0x6892('0x12')](function(_0x476c43){logger[_0x6892('0x13')](_0x6892('0x14'),_0x28db46,_0x6892('0x15'));logger[_0x6892('0x16')](_0x6892('0x17'),_0x28db46,'request\x20sent',JSON[_0x6892('0x18')](_0x476c43));if(_0x476c43[_0x6892('0x19')]){if(_0x476c43[_0x6892('0x19')]['code']===0x1f4){logger[_0x6892('0x19')](_0x6892('0x14'),_0x28db46,_0x476c43['error'][_0x6892('0x1a')]);return _0x24d283(_0x476c43[_0x6892('0x19')][_0x6892('0x1a')]);}logger['error'](_0x6892('0x14'),_0x28db46,_0x476c43[_0x6892('0x19')][_0x6892('0x1a')]);return _0x17041a(_0x476c43['error'][_0x6892('0x1a')]);}else{logger[_0x6892('0x13')](_0x6892('0x14'),_0x28db46,'request\x20sent');_0x17041a(_0x476c43[_0x6892('0x1b')][_0x6892('0x1a')]);}})[_0x6892('0x1c')](function(_0x17ae93){logger[_0x6892('0x19')](_0x6892('0x14'),_0x28db46,_0x17ae93);_0x24d283(_0x17ae93);});});}exports[_0x6892('0x1d')]=function(_0x497947){var _0x1f286e=this;return new Promise(function(_0x4aa333,_0x5f1895){return db['VoiceQueue'][_0x6892('0x1e')]({'raw':_0x497947[_0x6892('0x1f')]?_0x497947[_0x6892('0x1f')][_0x6892('0x20')]===undefined?!![]:![]:!![],'where':_0x497947[_0x6892('0x1f')]?_0x497947[_0x6892('0x1f')][_0x6892('0x21')]||null:null,'attributes':_0x497947[_0x6892('0x1f')]?_0x497947[_0x6892('0x1f')]['attributes']||null:null,'limit':_0x497947[_0x6892('0x1f')]?_0x497947[_0x6892('0x1f')][_0x6892('0x22')]||null:null,'include':_0x497947[_0x6892('0x1f')]?_0x497947[_0x6892('0x1f')][_0x6892('0x23')]?_['map'](_0x497947['options'][_0x6892('0x23')],function(_0x1d9c42){return{'model':db[_0x1d9c42[_0x6892('0x24')]],'as':_0x1d9c42['as'],'attributes':_0x1d9c42[_0x6892('0x25')],'include':_0x1d9c42[_0x6892('0x23')]?_[_0x6892('0x26')](_0x1d9c42['include'],function(_0x348328){return{'model':db[_0x348328[_0x6892('0x24')]],'as':_0x348328['as'],'attributes':_0x348328['attributes'],'include':_0x348328[_0x6892('0x23')]?_[_0x6892('0x26')](_0x348328[_0x6892('0x23')],function(_0x5e17ea){return{'model':db[_0x5e17ea[_0x6892('0x24')]],'as':_0x5e17ea['as'],'attributes':_0x5e17ea[_0x6892('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6892('0x12')](function(_0x40a684){logger[_0x6892('0x13')]('GetVoiceQueue',_0x497947);logger[_0x6892('0x16')](_0x6892('0x1d'),_0x497947,JSON['stringify'](_0x40a684));_0x4aa333(_0x40a684);})[_0x6892('0x1c')](function(_0x46a952){logger[_0x6892('0x19')]('GetVoiceQueue',_0x46a952[_0x6892('0x1a')],_0x497947);_0x5f1895(_0x1f286e[_0x6892('0x19')](0x1f4,_0x46a952[_0x6892('0x1a')]));});});};exports[_0x6892('0x27')]=function(_0x3e80ef){var _0x1c9b90=this;return new Promise(function(_0x202bde,_0x5de425){return db[_0x6892('0x28')]['find']({'raw':_0x3e80ef[_0x6892('0x1f')]?_0x3e80ef[_0x6892('0x1f')][_0x6892('0x20')]===undefined?!![]:![]:!![],'where':_0x3e80ef['options']?_0x3e80ef[_0x6892('0x1f')][_0x6892('0x21')]||null:null,'attributes':_0x3e80ef[_0x6892('0x1f')]?_0x3e80ef[_0x6892('0x1f')][_0x6892('0x25')]||null:null,'include':_0x3e80ef['options']?_0x3e80ef[_0x6892('0x1f')]['include']?_[_0x6892('0x26')](_0x3e80ef[_0x6892('0x1f')][_0x6892('0x23')],function(_0x234104){return{'model':db[_0x234104[_0x6892('0x24')]],'as':_0x234104['as'],'attributes':_0x234104[_0x6892('0x25')],'include':_0x234104[_0x6892('0x23')]?_['map'](_0x234104[_0x6892('0x23')],function(_0x41048c){return{'model':db[_0x41048c['model']],'as':_0x41048c['as'],'attributes':_0x41048c[_0x6892('0x25')],'include':_0x41048c[_0x6892('0x23')]?_['map'](_0x41048c[_0x6892('0x23')],function(_0x5d9498){return{'model':db[_0x5d9498[_0x6892('0x24')]],'as':_0x5d9498['as'],'attributes':_0x5d9498[_0x6892('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6892('0x12')](function(_0x445e68){logger[_0x6892('0x13')](_0x6892('0x27'),_0x3e80ef);logger[_0x6892('0x16')]('ShowVoiceQueue',_0x3e80ef,JSON[_0x6892('0x18')](_0x445e68));_0x202bde(_0x445e68);})[_0x6892('0x1c')](function(_0x4c5834){logger[_0x6892('0x19')](_0x6892('0x27'),_0x4c5834[_0x6892('0x1a')],_0x3e80ef);_0x5de425(_0x1c9b90[_0x6892('0x19')](0x1f4,_0x4c5834['message']));});});}; \ No newline at end of file +var _0x0ec3=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','include','map','model','ShowVoiceQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d0e74,_0x114d06){var _0x50df70=function(_0x1c493b){while(--_0x1c493b){_0x4d0e74['push'](_0x4d0e74['shift']());}};_0x50df70(++_0x114d06);}(_0x0ec3,0xe4));var _0x30ec=function(_0x42d159,_0xc1d3ab){_0x42d159=_0x42d159-0x0;var _0x5ea1b7=_0x0ec3[_0x42d159];return _0x5ea1b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30ec('0x0'));var BPromise=require('bluebird');var rs=require(_0x30ec('0x1'));var fs=require('fs');var Redis=require(_0x30ec('0x2'));var db=require(_0x30ec('0x3'))['db'];var utils=require(_0x30ec('0x4'));var logger=require(_0x30ec('0x5'))(_0x30ec('0x6'));var config=require(_0x30ec('0x7'));var jayson=require(_0x30ec('0x8'));var client=jayson[_0x30ec('0x9')][_0x30ec('0xa')]({'port':0x232a});config[_0x30ec('0xb')]=_['defaults'](config[_0x30ec('0xb')],{'host':_0x30ec('0xc'),'port':0x18eb});var socket=require(_0x30ec('0xd'))(new Redis(config[_0x30ec('0xb')]));require(_0x30ec('0xe'))[_0x30ec('0xf')](socket);function respondWithRpcPromise(_0x414c95,_0x2d33d4,_0x2fdec1){return new BPromise(function(_0x50b70a,_0x4a5afc){return client[_0x30ec('0x10')](_0x414c95,_0x2fdec1)[_0x30ec('0x11')](function(_0x77c47){logger[_0x30ec('0x12')](_0x30ec('0x13'),_0x2d33d4,'request\x20sent');logger[_0x30ec('0x14')](_0x30ec('0x15'),_0x2d33d4,_0x30ec('0x16'),JSON[_0x30ec('0x17')](_0x77c47));if(_0x77c47[_0x30ec('0x18')]){if(_0x77c47[_0x30ec('0x18')][_0x30ec('0x19')]===0x1f4){logger['error'](_0x30ec('0x13'),_0x2d33d4,_0x77c47[_0x30ec('0x18')]['message']);return _0x4a5afc(_0x77c47['error']['message']);}logger[_0x30ec('0x18')](_0x30ec('0x13'),_0x2d33d4,_0x77c47['error']['message']);return _0x50b70a(_0x77c47['error'][_0x30ec('0x1a')]);}else{logger[_0x30ec('0x12')](_0x30ec('0x13'),_0x2d33d4,_0x30ec('0x16'));_0x50b70a(_0x77c47[_0x30ec('0x1b')][_0x30ec('0x1a')]);}})[_0x30ec('0x1c')](function(_0x2b4c63){logger[_0x30ec('0x18')](_0x30ec('0x13'),_0x2d33d4,_0x2b4c63);_0x4a5afc(_0x2b4c63);});});}exports[_0x30ec('0x1d')]=function(_0x477ab0){var _0x981371=this;return new Promise(function(_0x37b41c,_0x5bf3c5){return db[_0x30ec('0x1e')]['findAll']({'raw':_0x477ab0[_0x30ec('0x1f')]?_0x477ab0[_0x30ec('0x1f')][_0x30ec('0x20')]===undefined?!![]:![]:!![],'where':_0x477ab0[_0x30ec('0x1f')]?_0x477ab0['options']['where']||null:null,'attributes':_0x477ab0[_0x30ec('0x1f')]?_0x477ab0[_0x30ec('0x1f')][_0x30ec('0x21')]||null:null,'limit':_0x477ab0['options']?_0x477ab0[_0x30ec('0x1f')]['limit']||null:null,'include':_0x477ab0['options']?_0x477ab0[_0x30ec('0x1f')][_0x30ec('0x22')]?_[_0x30ec('0x23')](_0x477ab0[_0x30ec('0x1f')][_0x30ec('0x22')],function(_0x3296ea){return{'model':db[_0x3296ea[_0x30ec('0x24')]],'as':_0x3296ea['as'],'attributes':_0x3296ea['attributes'],'include':_0x3296ea['include']?_['map'](_0x3296ea[_0x30ec('0x22')],function(_0x32c773){return{'model':db[_0x32c773[_0x30ec('0x24')]],'as':_0x32c773['as'],'attributes':_0x32c773[_0x30ec('0x21')],'include':_0x32c773['include']?_[_0x30ec('0x23')](_0x32c773[_0x30ec('0x22')],function(_0x50a115){return{'model':db[_0x50a115['model']],'as':_0x50a115['as'],'attributes':_0x50a115[_0x30ec('0x21')]};}):[]};}):[]};}):[]:[]})[_0x30ec('0x11')](function(_0x464abc){logger[_0x30ec('0x12')](_0x30ec('0x1d'),_0x477ab0);logger[_0x30ec('0x14')](_0x30ec('0x1d'),_0x477ab0,JSON['stringify'](_0x464abc));_0x37b41c(_0x464abc);})[_0x30ec('0x1c')](function(_0x58b435){logger[_0x30ec('0x18')](_0x30ec('0x1d'),_0x58b435[_0x30ec('0x1a')],_0x477ab0);_0x5bf3c5(_0x981371[_0x30ec('0x18')](0x1f4,_0x58b435['message']));});});};exports[_0x30ec('0x25')]=function(_0x37effd){var _0x1d79f0=this;return new Promise(function(_0x50ef8e,_0x111720){return db[_0x30ec('0x1e')][_0x30ec('0x26')]({'raw':_0x37effd['options']?_0x37effd[_0x30ec('0x1f')][_0x30ec('0x20')]===undefined?!![]:![]:!![],'where':_0x37effd[_0x30ec('0x1f')]?_0x37effd[_0x30ec('0x1f')]['where']||null:null,'attributes':_0x37effd[_0x30ec('0x1f')]?_0x37effd[_0x30ec('0x1f')][_0x30ec('0x21')]||null:null,'include':_0x37effd['options']?_0x37effd[_0x30ec('0x1f')][_0x30ec('0x22')]?_['map'](_0x37effd[_0x30ec('0x1f')]['include'],function(_0x918db){return{'model':db[_0x918db[_0x30ec('0x24')]],'as':_0x918db['as'],'attributes':_0x918db[_0x30ec('0x21')],'include':_0x918db[_0x30ec('0x22')]?_[_0x30ec('0x23')](_0x918db['include'],function(_0x3826db){return{'model':db[_0x3826db[_0x30ec('0x24')]],'as':_0x3826db['as'],'attributes':_0x3826db['attributes'],'include':_0x3826db[_0x30ec('0x22')]?_['map'](_0x3826db[_0x30ec('0x22')],function(_0x242390){return{'model':db[_0x242390[_0x30ec('0x24')]],'as':_0x242390['as'],'attributes':_0x242390[_0x30ec('0x21')]};}):[]};}):[]};}):[]:[]})[_0x30ec('0x11')](function(_0x1375f0){logger[_0x30ec('0x12')](_0x30ec('0x25'),_0x37effd);logger['debug'](_0x30ec('0x25'),_0x37effd,JSON['stringify'](_0x1375f0));_0x50ef8e(_0x1375f0);})[_0x30ec('0x1c')](function(_0x56cb14){logger[_0x30ec('0x18')](_0x30ec('0x25'),_0x56cb14[_0x30ec('0x1a')],_0x37effd);_0x111720(_0x1d79f0[_0x30ec('0x18')](0x1f4,_0x56cb14[_0x30ec('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 06229d7..253c3ff 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 _0x066f=['emit','register','voiceQueue:','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x066f,0x137));var _0xf066=function(_0x267c5b,_0x14feac){_0x267c5b=_0x267c5b-0x0;var _0x51c435=_0x066f[_0x267c5b];return _0x51c435;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0xf066('0x0'),'update'];function createListener(_0x6d373d,_0xe103e8){return function(_0x54185c){_0xe103e8[_0xf066('0x1')](_0x6d373d,_0x54185c);};}function removeListener(_0x1acae8,_0x29334e){return function(){VoiceQueueEvents['removeListener'](_0x1acae8,_0x29334e);};}exports[_0xf066('0x2')]=function(_0x2ddbef){for(var _0x14757b=0x0,_0x499fc2=events['length'];_0x14757b<_0x499fc2;_0x14757b++){var _0x5b1d62=events[_0x14757b];var _0x2e5134=createListener(_0xf066('0x3')+_0x5b1d62,_0x2ddbef);VoiceQueueEvents['on'](_0x5b1d62,_0x2e5134);}}; \ No newline at end of file +var _0x3ede=['removeListener','register','length','voiceQueue:','./voiceQueue.events','update','emit'];(function(_0x1cb9b2,_0x3db057){var _0x5d4628=function(_0x34dbad){while(--_0x34dbad){_0x1cb9b2['push'](_0x1cb9b2['shift']());}};_0x5d4628(++_0x3db057);}(_0x3ede,0x1cb));var _0xe3ed=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x3ede[_0x39c734];return _0xb2a2f9;};'use strict';var VoiceQueueEvents=require(_0xe3ed('0x0'));var events=['save','remove',_0xe3ed('0x1')];function createListener(_0x52bbde,_0x535885){return function(_0x12d440){_0x535885[_0xe3ed('0x2')](_0x52bbde,_0x12d440);};}function removeListener(_0x401874,_0xa2a30b){return function(){VoiceQueueEvents[_0xe3ed('0x3')](_0x401874,_0xa2a30b);};}exports[_0xe3ed('0x4')]=function(_0x20af53){for(var _0x25221f=0x0,_0x2ec140=events[_0xe3ed('0x5')];_0x25221f<_0x2ec140;_0x25221f++){var _0xdb6db9=events[_0x25221f];var _0x168228=createListener(_0xe3ed('0x6')+_0xdb6db9,_0x20af53);VoiceQueueEvents['on'](_0xdb6db9,_0x168228);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index af2df4d..425df9a 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 _0x13f5=['connect-timeout','Router','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x457e95,_0x2d3542){var _0x2ee19d=function(_0x4b58cb){while(--_0x4b58cb){_0x457e95['push'](_0x457e95['shift']());}};_0x2ee19d(++_0x2d3542);}(_0x13f5,0xc3));var _0x513f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x13f5[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x513f('0x5'));var controller=require(_0x513f('0x6'));router[_0x513f('0x7')]('/',auth[_0x513f('0x8')](),controller[_0x513f('0x9')]);router[_0x513f('0x7')](_0x513f('0xa'),auth[_0x513f('0x8')](),controller[_0x513f('0xb')]);router[_0x513f('0x7')](_0x513f('0xc'),auth[_0x513f('0x8')](),controller['getVoiceQueuesReport']);router[_0x513f('0x7')](_0x513f('0xd'),auth[_0x513f('0x8')](),controller[_0x513f('0xe')]);router[_0x513f('0xf')]('/',auth['isAuthenticated'](),controller[_0x513f('0x10')]);router[_0x513f('0x11')]('/:id',auth[_0x513f('0x8')](),controller[_0x513f('0x12')]);router[_0x513f('0x13')](_0x513f('0xd'),auth[_0x513f('0x8')](),controller[_0x513f('0x14')]);module[_0x513f('0x15')]=router; \ No newline at end of file +var _0x6c45=['delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','update'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x6c45,0xb1));var _0x56c4=function(_0x11228a,_0xbca713){_0x11228a=_0x11228a-0x0;var _0x434083=_0x6c45[_0x11228a];return _0x434083;};'use strict';var multer=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var path=require('path');var timeout=require(_0x56c4('0x2'));var express=require(_0x56c4('0x3'));var router=express[_0x56c4('0x4')]();var auth=require(_0x56c4('0x5'));var interaction=require(_0x56c4('0x6'));var config=require(_0x56c4('0x7'));var controller=require(_0x56c4('0x8'));router[_0x56c4('0x9')]('/',auth[_0x56c4('0xa')](),controller[_0x56c4('0xb')]);router[_0x56c4('0x9')](_0x56c4('0xc'),auth[_0x56c4('0xa')](),controller[_0x56c4('0xd')]);router[_0x56c4('0x9')](_0x56c4('0xe'),auth[_0x56c4('0xa')](),controller[_0x56c4('0xf')]);router[_0x56c4('0x9')](_0x56c4('0x10'),auth['isAuthenticated'](),controller[_0x56c4('0x11')]);router[_0x56c4('0x12')]('/',auth[_0x56c4('0xa')](),controller[_0x56c4('0x13')]);router['put'](_0x56c4('0x10'),auth[_0x56c4('0xa')](),controller[_0x56c4('0x14')]);router[_0x56c4('0x15')]('/:id',auth[_0x56c4('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 47805cd..e4d3c48 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 _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x1c3429,_0x11d159){var _0x1609bd=function(_0x5ce42c){while(--_0x5ce42c){_0x1c3429['push'](_0x1c3429['shift']());}};_0x1609bd(++_0x11d159);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0xb1f045,_0x43eb1c){var _0x1c574d=function(_0x324ef7){while(--_0x324ef7){_0xb1f045['push'](_0xb1f045['shift']());}};_0x1c574d(++_0x43eb1c);}(_0x70e0,0x17b));var _0x070e=function(_0x22a923,_0x2b175f){_0x22a923=_0x22a923-0x0;var _0x10208b=_0x70e0[_0x22a923];return _0x10208b;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9d2687f..29ae784 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 _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x568039,_0x570f8e){var _0x1595fc=function(_0x50ac8f){while(--_0x50ac8f){_0x568039['push'](_0x568039['shift']());}};_0x1595fc(++_0x570f8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x5262bb,_0x473282){var _0x830bb6=function(_0x576cb8){while(--_0x576cb8){_0x5262bb['push'](_0x5262bb['shift']());}};_0x830bb6(++_0x473282);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index a0fc0a1..4f21f4d 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 _0x7d7d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','VoiceQueueReport'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7d7d,0xa9));var _0xd7d7=function(_0x46146c,_0xaa3442){_0x46146c=_0x46146c-0x0;var _0x56451b=_0x7d7d[_0x46146c];return _0x56451b;};'use strict';var EventEmitter=require(_0xd7d7('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xd7d7('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd7d7('0x2')](0x0);var events={'afterCreate':_0xd7d7('0x3'),'afterUpdate':'update','afterDestroy':_0xd7d7('0x4')};function emitEvent(_0x380cf6){return function(_0x11634b,_0x2c78d6,_0x1c49a8){VoiceQueueReportEvents[_0xd7d7('0x5')](_0x380cf6+':'+_0x11634b['id'],_0x11634b);VoiceQueueReportEvents[_0xd7d7('0x5')](_0x380cf6,_0x11634b);_0x1c49a8(null);};}for(var e in events){if(events[_0xd7d7('0x6')](e)){var event=events[e];VoiceQueueReport[_0xd7d7('0x7')](e,emitEvent(event));}}module[_0xd7d7('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe47c=['VoiceQueueReport','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x517699,_0x33f88d){var _0x2cb34a=function(_0x3f2beb){while(--_0x3f2beb){_0x517699['push'](_0x517699['shift']());}};_0x2cb34a(++_0x33f88d);}(_0xe47c,0xd8));var _0xce47=function(_0x50bf4b,_0x2295f4){_0x50bf4b=_0x50bf4b-0x0;var _0x292031=_0xe47c[_0x50bf4b];return _0x292031;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xce47('0x0'))['db'][_0xce47('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce47('0x2'),'afterUpdate':_0xce47('0x3'),'afterDestroy':_0xce47('0x4')};function emitEvent(_0xf2abce){return function(_0x1cc0ff,_0x154b8e,_0x2e31fb){VoiceQueueReportEvents['emit'](_0xf2abce+':'+_0x1cc0ff['id'],_0x1cc0ff);VoiceQueueReportEvents[_0xce47('0x5')](_0xf2abce,_0x1cc0ff);_0x2e31fb(null);};}for(var e in events){if(events[_0xce47('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index a021471..47074a6 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 _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x38381f,_0x4eff8a){var _0x1c1631=function(_0x36eccd){while(--_0x36eccd){_0x38381f['push'](_0x38381f['shift']());}};_0x1c1631(++_0x4eff8a);}(_0xdb28,0x106));var _0x8db2=function(_0x578b04,_0x58fdd5){_0x578b04=_0x578b04-0x0;var _0x20c02e=_0xdb28[_0x578b04];return _0x20c02e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0xdb28,0x106));var _0x8db2=function(_0x5b16cc,_0x4acf02){_0x5b16cc=_0x5b16cc-0x0;var _0x3a6503=_0xdb28[_0x5b16cc];return _0x3a6503;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('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 4e575d6..fd8c8bb 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 _0x34cf=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','update','raw','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x34cf,0x9b));var _0xf34c=function(_0x407f30,_0x522f08){_0x407f30=_0x407f30-0x0;var _0x10e173=_0x34cf[_0x407f30];return _0x10e173;};'use strict';var _=require('lodash');var util=require(_0xf34c('0x0'));var moment=require(_0xf34c('0x1'));var BPromise=require(_0xf34c('0x2'));var rs=require(_0xf34c('0x3'));var fs=require('fs');var Redis=require(_0xf34c('0x4'));var db=require(_0xf34c('0x5'))['db'];var utils=require(_0xf34c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf34c('0x7'));var jayson=require(_0xf34c('0x8'));var client=jayson[_0xf34c('0x9')][_0xf34c('0xa')]({'port':0x232a});config[_0xf34c('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf34c('0xc'))(new Redis(config[_0xf34c('0xb')]));require(_0xf34c('0xd'))[_0xf34c('0xe')](socket);function respondWithRpcPromise(_0x2c52ba,_0x35f222,_0x556915){return new BPromise(function(_0x51a74d,_0x423bdb){return client[_0xf34c('0xf')](_0x2c52ba,_0x556915)[_0xf34c('0x10')](function(_0x45536b){logger[_0xf34c('0x11')](_0xf34c('0x12'),_0x35f222,_0xf34c('0x13'));logger[_0xf34c('0x14')](_0xf34c('0x15'),_0x35f222,_0xf34c('0x13'),JSON[_0xf34c('0x16')](_0x45536b));if(_0x45536b['error']){if(_0x45536b[_0xf34c('0x17')]['code']===0x1f4){logger[_0xf34c('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x35f222,_0x45536b[_0xf34c('0x17')][_0xf34c('0x18')]);return _0x423bdb(_0x45536b['error'][_0xf34c('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x35f222,_0x45536b[_0xf34c('0x17')][_0xf34c('0x18')]);return _0x51a74d(_0x45536b[_0xf34c('0x17')][_0xf34c('0x18')]);}else{logger[_0xf34c('0x11')](_0xf34c('0x12'),_0x35f222,_0xf34c('0x13'));_0x51a74d(_0x45536b[_0xf34c('0x19')][_0xf34c('0x18')]);}})[_0xf34c('0x1a')](function(_0x5800a7){logger[_0xf34c('0x17')](_0xf34c('0x12'),_0x35f222,_0x5800a7);_0x423bdb(_0x5800a7);});});}exports[_0xf34c('0x1b')]=function(_0x378904){var _0x4b6cbb=this;return new Promise(function(_0x4664aa,_0x4c63fd){return db[_0xf34c('0x1c')][_0xf34c('0x1d')]({'raw':_0x378904[_0xf34c('0x1e')]?_0x378904[_0xf34c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x378904[_0xf34c('0x1e')]?_0x378904[_0xf34c('0x1e')][_0xf34c('0x1f')]||null:null,'attributes':_0x378904[_0xf34c('0x1e')]?_0x378904['options'][_0xf34c('0x20')]||null:null,'limit':_0x378904[_0xf34c('0x1e')]?_0x378904[_0xf34c('0x1e')][_0xf34c('0x21')]||null:null,'include':_0x378904[_0xf34c('0x1e')]?_0x378904[_0xf34c('0x1e')][_0xf34c('0x22')]?_[_0xf34c('0x23')](_0x378904[_0xf34c('0x1e')]['include'],function(_0x5289bf){return{'model':db[_0x5289bf['model']],'as':_0x5289bf['as'],'attributes':_0x5289bf[_0xf34c('0x20')],'include':_0x5289bf['include']?_[_0xf34c('0x23')](_0x5289bf[_0xf34c('0x22')],function(_0xc026f2){return{'model':db[_0xc026f2[_0xf34c('0x24')]],'as':_0xc026f2['as'],'attributes':_0xc026f2[_0xf34c('0x20')],'include':_0xc026f2['include']?_[_0xf34c('0x23')](_0xc026f2[_0xf34c('0x22')],function(_0x19e4aa){return{'model':db[_0x19e4aa['model']],'as':_0x19e4aa['as'],'attributes':_0x19e4aa[_0xf34c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf34c('0x10')](function(_0x575717){logger['info'](_0xf34c('0x1b'),_0x378904);logger[_0xf34c('0x14')](_0xf34c('0x1b'),_0x378904,JSON['stringify'](_0x575717));_0x4664aa(_0x575717);})[_0xf34c('0x1a')](function(_0x2628db){logger['error'](_0xf34c('0x1b'),_0x2628db[_0xf34c('0x18')],_0x378904);_0x4c63fd(_0x4b6cbb[_0xf34c('0x17')](0x1f4,_0x2628db['message']));});});};exports[_0xf34c('0x25')]=function(_0x2f3591){var _0x74fe21=this;return new Promise(function(_0x591b40,_0x475f1d){return db[_0xf34c('0x1c')][_0xf34c('0x26')](_0x2f3591[_0xf34c('0x27')],{'raw':_0x2f3591['options']?_0x2f3591[_0xf34c('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3c601e){logger[_0xf34c('0x11')](_0xf34c('0x25'),_0x2f3591);logger[_0xf34c('0x14')](_0xf34c('0x25'),_0x2f3591,JSON['stringify'](_0x3c601e));_0x591b40(_0x3c601e);})[_0xf34c('0x1a')](function(_0x35d23a){logger['error'](_0xf34c('0x25'),_0x35d23a[_0xf34c('0x18')],_0x2f3591);_0x475f1d(_0x74fe21[_0xf34c('0x17')](0x1f4,_0x35d23a[_0xf34c('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x45b8ea){var _0x42cd9b=this;return new Promise(function(_0x5c3d8a,_0x12b026){return db[_0xf34c('0x1c')][_0xf34c('0x28')](_0x45b8ea[_0xf34c('0x27')],{'raw':_0x45b8ea[_0xf34c('0x1e')]?_0x45b8ea[_0xf34c('0x1e')][_0xf34c('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b8ea['options']?_0x45b8ea[_0xf34c('0x1e')][_0xf34c('0x1f')]||null:null,'attributes':_0x45b8ea[_0xf34c('0x1e')]?_0x45b8ea['options'][_0xf34c('0x20')]||null:null,'limit':_0x45b8ea[_0xf34c('0x1e')]?_0x45b8ea[_0xf34c('0x1e')]['limit']||null:null})[_0xf34c('0x10')](function(_0xa6a549){logger[_0xf34c('0x11')](_0xf34c('0x2a'),_0x45b8ea);logger[_0xf34c('0x14')](_0xf34c('0x2a'),_0x45b8ea,JSON[_0xf34c('0x16')](_0xa6a549));_0x5c3d8a(_0xa6a549);})['catch'](function(_0x131da2){logger[_0xf34c('0x17')](_0xf34c('0x2a'),_0x131da2['message'],_0x45b8ea);_0x12b026(_0x42cd9b[_0xf34c('0x17')](0x1f4,_0x131da2[_0xf34c('0x18')]));});});}; \ No newline at end of file +var _0x14a4=['include','map','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','limit','model'];(function(_0x5e1298,_0x3e496d){var _0x971d45=function(_0x306305){while(--_0x306305){_0x5e1298['push'](_0x5e1298['shift']());}};_0x971d45(++_0x3e496d);}(_0x14a4,0x13c));var _0x414a=function(_0x31cbc1,_0x59d083){_0x31cbc1=_0x31cbc1-0x0;var _0x3ccf09=_0x14a4[_0x31cbc1];return _0x3ccf09;};'use strict';var _=require('lodash');var util=require(_0x414a('0x0'));var moment=require(_0x414a('0x1'));var BPromise=require(_0x414a('0x2'));var rs=require(_0x414a('0x3'));var fs=require('fs');var Redis=require(_0x414a('0x4'));var db=require(_0x414a('0x5'))['db'];var utils=require(_0x414a('0x6'));var logger=require(_0x414a('0x7'))(_0x414a('0x8'));var config=require(_0x414a('0x9'));var jayson=require(_0x414a('0xa'));var client=jayson['client'][_0x414a('0xb')]({'port':0x232a});config[_0x414a('0xc')]=_['defaults'](config[_0x414a('0xc')],{'host':_0x414a('0xd'),'port':0x18eb});var socket=require(_0x414a('0xe'))(new Redis(config['redis']));require(_0x414a('0xf'))['register'](socket);function respondWithRpcPromise(_0x29fae7,_0x1e3001,_0x23c63e){return new BPromise(function(_0x3d61b4,_0x2ab29f){return client[_0x414a('0x10')](_0x29fae7,_0x23c63e)[_0x414a('0x11')](function(_0x12e6d9){logger[_0x414a('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e3001,_0x414a('0x13'));logger[_0x414a('0x14')](_0x414a('0x15'),_0x1e3001,_0x414a('0x13'),JSON[_0x414a('0x16')](_0x12e6d9));if(_0x12e6d9[_0x414a('0x17')]){if(_0x12e6d9['error'][_0x414a('0x18')]===0x1f4){logger[_0x414a('0x17')](_0x414a('0x19'),_0x1e3001,_0x12e6d9[_0x414a('0x17')][_0x414a('0x1a')]);return _0x2ab29f(_0x12e6d9['error']['message']);}logger['error'](_0x414a('0x19'),_0x1e3001,_0x12e6d9[_0x414a('0x17')][_0x414a('0x1a')]);return _0x3d61b4(_0x12e6d9[_0x414a('0x17')][_0x414a('0x1a')]);}else{logger[_0x414a('0x12')](_0x414a('0x19'),_0x1e3001,_0x414a('0x13'));_0x3d61b4(_0x12e6d9[_0x414a('0x1b')][_0x414a('0x1a')]);}})['catch'](function(_0x359ec8){logger[_0x414a('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e3001,_0x359ec8);_0x2ab29f(_0x359ec8);});});}exports['GetVoiceQueueReport']=function(_0x2f5d29){var _0x3c8d82=this;return new Promise(function(_0x3386d2,_0x36dc17){return db[_0x414a('0x1c')][_0x414a('0x1d')]({'raw':_0x2f5d29['options']?_0x2f5d29[_0x414a('0x1e')][_0x414a('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f5d29[_0x414a('0x1e')]?_0x2f5d29[_0x414a('0x1e')][_0x414a('0x20')]||null:null,'attributes':_0x2f5d29[_0x414a('0x1e')]?_0x2f5d29[_0x414a('0x1e')][_0x414a('0x21')]||null:null,'limit':_0x2f5d29[_0x414a('0x1e')]?_0x2f5d29[_0x414a('0x1e')][_0x414a('0x22')]||null:null,'include':_0x2f5d29[_0x414a('0x1e')]?_0x2f5d29[_0x414a('0x1e')]['include']?_['map'](_0x2f5d29[_0x414a('0x1e')]['include'],function(_0x5ebe69){return{'model':db[_0x5ebe69[_0x414a('0x23')]],'as':_0x5ebe69['as'],'attributes':_0x5ebe69[_0x414a('0x21')],'include':_0x5ebe69[_0x414a('0x24')]?_[_0x414a('0x25')](_0x5ebe69[_0x414a('0x24')],function(_0x48c2b7){return{'model':db[_0x48c2b7['model']],'as':_0x48c2b7['as'],'attributes':_0x48c2b7['attributes'],'include':_0x48c2b7[_0x414a('0x24')]?_[_0x414a('0x25')](_0x48c2b7[_0x414a('0x24')],function(_0x886130){return{'model':db[_0x886130[_0x414a('0x23')]],'as':_0x886130['as'],'attributes':_0x886130[_0x414a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x284da9){logger[_0x414a('0x12')](_0x414a('0x26'),_0x2f5d29);logger[_0x414a('0x14')](_0x414a('0x26'),_0x2f5d29,JSON[_0x414a('0x16')](_0x284da9));_0x3386d2(_0x284da9);})[_0x414a('0x27')](function(_0x419faf){logger['error'](_0x414a('0x26'),_0x419faf['message'],_0x2f5d29);_0x36dc17(_0x3c8d82[_0x414a('0x17')](0x1f4,_0x419faf[_0x414a('0x1a')]));});});};exports[_0x414a('0x28')]=function(_0x2b1b75){var _0x128c0a=this;return new Promise(function(_0x51347b,_0x217d27){return db[_0x414a('0x1c')][_0x414a('0x29')](_0x2b1b75[_0x414a('0x2a')],{'raw':_0x2b1b75[_0x414a('0x1e')]?_0x2b1b75[_0x414a('0x1e')][_0x414a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x5ba710){logger[_0x414a('0x12')]('CreateVoiceQueueReport',_0x2b1b75);logger['debug']('CreateVoiceQueueReport',_0x2b1b75,JSON['stringify'](_0x5ba710));_0x51347b(_0x5ba710);})['catch'](function(_0x52ea3f){logger[_0x414a('0x17')](_0x414a('0x28'),_0x52ea3f[_0x414a('0x1a')],_0x2b1b75);_0x217d27(_0x128c0a['error'](0x1f4,_0x52ea3f[_0x414a('0x1a')]));});});};exports[_0x414a('0x2b')]=function(_0x3c5569){var _0x5b937b=this;return new Promise(function(_0x483a41,_0x1911b5){return db[_0x414a('0x1c')]['update'](_0x3c5569[_0x414a('0x2a')],{'raw':_0x3c5569['options']?_0x3c5569['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c5569['options']?_0x3c5569['options'][_0x414a('0x20')]||null:null,'attributes':_0x3c5569[_0x414a('0x1e')]?_0x3c5569['options'][_0x414a('0x21')]||null:null,'limit':_0x3c5569[_0x414a('0x1e')]?_0x3c5569[_0x414a('0x1e')]['limit']||null:null})['then'](function(_0x346f89){logger[_0x414a('0x12')](_0x414a('0x2b'),_0x3c5569);logger[_0x414a('0x14')]('UpdateVoiceQueueReport',_0x3c5569,JSON[_0x414a('0x16')](_0x346f89));_0x483a41(_0x346f89);})[_0x414a('0x27')](function(_0x333a11){logger[_0x414a('0x17')]('UpdateVoiceQueueReport',_0x333a11[_0x414a('0x1a')],_0x3c5569);_0x1911b5(_0x5b937b[_0x414a('0x17')](0x1f4,_0x333a11[_0x414a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 1386d24..a77b7db 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 _0xf4de=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x3894c8,_0x108e06){var _0x4cee9a=function(_0x249d02){while(--_0x249d02){_0x3894c8['push'](_0x3894c8['shift']());}};_0x4cee9a(++_0x108e06);}(_0xf4de,0xdf));var _0xef4d=function(_0x710e3e,_0x51ba90){_0x710e3e=_0x710e3e-0x0;var _0x2df053=_0xf4de[_0x710e3e];return _0x2df053;};'use strict';var VoiceQueueReportEvents=require(_0xef4d('0x0'));var events=['save','remove',_0xef4d('0x1')];function createListener(_0xe2eedc,_0x275bc5){return function(_0x658fcd){_0x275bc5[_0xef4d('0x2')](_0xe2eedc,_0x658fcd);};}function removeListener(_0x425b38,_0x426c3e){return function(){VoiceQueueReportEvents[_0xef4d('0x3')](_0x425b38,_0x426c3e);};}exports[_0xef4d('0x4')]=function(_0x183ea6){for(var _0x2e4625=0x0,_0x595b34=events[_0xef4d('0x5')];_0x2e4625<_0x595b34;_0x2e4625++){var _0x233c3e=events[_0x2e4625];var _0x2db32f=createListener(_0xef4d('0x6')+_0x233c3e,_0x183ea6);VoiceQueueReportEvents['on'](_0x233c3e,_0x2db32f);}}; \ No newline at end of file +var _0x3c7d=['emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x37b321,_0x44320f){var _0x1b85ad=function(_0x34bbe7){while(--_0x34bbe7){_0x37b321['push'](_0x37b321['shift']());}};_0x1b85ad(++_0x44320f);}(_0x3c7d,0x10c));var _0xd3c7=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x3c7d[_0x5a79e2];return _0x266c45;};'use strict';var VoiceQueueReportEvents=require(_0xd3c7('0x0'));var events=[_0xd3c7('0x1'),_0xd3c7('0x2'),_0xd3c7('0x3')];function createListener(_0x1964b1,_0x343bce){return function(_0x37caa3){_0x343bce[_0xd3c7('0x4')](_0x1964b1,_0x37caa3);};}function removeListener(_0x116806,_0x5ba113){return function(){VoiceQueueReportEvents[_0xd3c7('0x5')](_0x116806,_0x5ba113);};}exports['register']=function(_0xb234c5){for(var _0x3a19a3=0x0,_0x41de14=events[_0xd3c7('0x6')];_0x3a19a3<_0x41de14;_0x3a19a3++){var _0x16f635=events[_0x3a19a3];var _0x32ec50=createListener(_0xd3c7('0x7')+_0x16f635,_0xb234c5);VoiceQueueReportEvents['on'](_0x16f635,_0x32ec50);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a6fac76..f5a4312 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 _0xf013=['get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xf013,0x118));var _0x3f01=function(_0x56dac6,_0x6627c2){_0x56dac6=_0x56dac6-0x0;var _0x1458ef=_0xf013[_0x56dac6];return _0x1458ef;};'use strict';var multer=require(_0x3f01('0x0'));var util=require(_0x3f01('0x1'));var path=require(_0x3f01('0x2'));var timeout=require(_0x3f01('0x3'));var express=require('express');var router=express[_0x3f01('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3f01('0x5'));var config=require(_0x3f01('0x6'));var controller=require(_0x3f01('0x7'));router[_0x3f01('0x8')]('/',auth[_0x3f01('0x9')](),controller[_0x3f01('0xa')]);router[_0x3f01('0x8')](_0x3f01('0xb'),auth[_0x3f01('0x9')](),controller[_0x3f01('0xc')]);router['post']('/',auth[_0x3f01('0x9')](),controller[_0x3f01('0xd')]);router['put'](_0x3f01('0xb'),auth[_0x3f01('0x9')](),controller[_0x3f01('0xe')]);router[_0x3f01('0xf')](_0x3f01('0xb'),auth[_0x3f01('0x9')](),controller[_0x3f01('0x10')]);module[_0x3f01('0x11')]=router; \ No newline at end of file +var _0x14b3=['express','Router','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x14b3,0xcd));var _0x314b=function(_0x480f4a,_0x2ea3f8){_0x480f4a=_0x480f4a-0x0;var _0xdccb7d=_0x14b3[_0x480f4a];return _0xdccb7d;};'use strict';var multer=require(_0x314b('0x0'));var util=require(_0x314b('0x1'));var path=require(_0x314b('0x2'));var timeout=require('connect-timeout');var express=require(_0x314b('0x3'));var router=express[_0x314b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x314b('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x314b('0x6')]('/',auth[_0x314b('0x7')](),controller['index']);router[_0x314b('0x6')](_0x314b('0x8'),auth[_0x314b('0x7')](),controller[_0x314b('0x9')]);router[_0x314b('0xa')]('/',auth[_0x314b('0x7')](),controller[_0x314b('0xb')]);router[_0x314b('0xc')](_0x314b('0x8'),auth[_0x314b('0x7')](),controller[_0x314b('0xd')]);router[_0x314b('0xe')]('/:id',auth[_0x314b('0x7')](),controller[_0x314b('0xf')]);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 d6a9a9a..f850d2b 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 _0xc474=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x197853,_0x24487b){var _0x1cbb30=function(_0x53bab3){while(--_0x53bab3){_0x197853['push'](_0x197853['shift']());}};_0x1cbb30(++_0x24487b);}(_0xc474,0xe8));var _0x4c47=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xc474[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0x4c47('0x0'));var moment=require(_0x4c47('0x1'));module['exports']={'time':{'type':Sequelize[_0x4c47('0x2')]},'callid':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4c47('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4c47('0x3')],'allowNull':![],'defaultValue':moment()[_0x4c47('0x4')](_0x4c47('0x5'))}}; \ No newline at end of file +var _0x907c=['sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x907c,0x8a));var _0xc907=function(_0x138c9e,_0xde923d){_0x138c9e=_0x138c9e-0x0;var _0x45ed32=_0x907c[_0x138c9e];return _0x45ed32;};'use strict';var Sequelize=require(_0xc907('0x0'));var moment=require(_0xc907('0x1'));module[_0xc907('0x2')]={'time':{'type':Sequelize[_0xc907('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc907('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xc907('0x4')](_0xc907('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4ef667b..ef1a25e 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 _0xd71a=['request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','length','find','create','update','body','params','eml-format','rimraf','zip-dir'];(function(_0x25c313,_0xee3428){var _0x52dc3c=function(_0xa8287b){while(--_0xa8287b){_0x25c313['push'](_0x25c313['shift']());}};_0x52dc3c(++_0xee3428);}(_0xd71a,0x1d2));var _0xad71=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd71a[_0x40a045];return _0x1a687c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xad71('0x0'));var rimraf=require(_0xad71('0x1'));var zipdir=require(_0xad71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad71('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad71('0x4'));var util=require('util');var path=require(_0xad71('0x5'));var sox=require(_0xad71('0x6'));var csv=require(_0xad71('0x7'));var ejs=require(_0xad71('0x8'));var fs=require('fs');var _=require(_0xad71('0x9'));var squel=require('squel');var crypto=require(_0xad71('0xa'));var jsforce=require(_0xad71('0xb'));var deskjs=require(_0xad71('0xc'));var toCsv=require('to-csv');var querystring=require(_0xad71('0xd'));var Papa=require('papaparse');var Redis=require(_0xad71('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xad71('0xf'));var as=require(_0xad71('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xad71('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xad71('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bffe6,_0xf44488){_0xf44488=_0xf44488||0xcc;return function(_0x7752f9){if(_0x7752f9){return _0x3bffe6[_0xad71('0x13')](_0xf44488);}return _0x3bffe6['status'](_0xf44488)[_0xad71('0x14')]();};}function respondWithResult(_0x2c2ca1,_0x4da646){_0x4da646=_0x4da646||0xc8;return function(_0x31cca6){if(_0x31cca6){return _0x2c2ca1[_0xad71('0x15')](_0x4da646)['json'](_0x31cca6);}};}function respondWithFilteredResult(_0x594aff,_0x27819e){return function(_0x1811d2){if(_0x1811d2){var _0x5eea49=_0x1811d2[_0xad71('0x16')],_0x176492=_0x27819e[_0xad71('0x17')],_0x3d23fd=_0x27819e[_0xad71('0x17')]+_0x27819e[_0xad71('0x18')],_0x1264ba;if(_0x3d23fd>=_0x5eea49){_0x3d23fd=_0x5eea49;_0x1264ba=0xc8;}else{_0x1264ba=0xce;}_0x594aff['status'](_0x1264ba);return _0x594aff[_0xad71('0x19')](_0xad71('0x1a'),_0x176492+'-'+_0x3d23fd+'/'+_0x5eea49)['json'](_0x1811d2);}return null;};}function patchUpdates(_0x219cf2){return function(_0x4344e8){try{jsonpatch[_0xad71('0x1b')](_0x4344e8,_0x219cf2,!![]);}catch(_0x4983ed){return BPromise[_0xad71('0x1c')](_0x4983ed);}return _0x4344e8['save']();};}function saveUpdates(_0x5b7358,_0xc2e0fa){return function(_0x4181d1){if(_0x4181d1){return _0x4181d1['update'](_0x5b7358)[_0xad71('0x1d')](function(_0x159b02){return _0x159b02;});}return null;};}function removeEntity(_0x29a882,_0x51b4ee){return function(_0xc6c3d4){if(_0xc6c3d4){return _0xc6c3d4[_0xad71('0x1e')]()[_0xad71('0x1d')](function(){_0x29a882[_0xad71('0x15')](0xcc)[_0xad71('0x14')]();});}};}function handleEntityNotFound(_0x19644d,_0x45d0a4){return function(_0x1f8bde){if(!_0x1f8bde){_0x19644d[_0xad71('0x13')](0x194);}return _0x1f8bde;};}function handleError(_0x440aac,_0x4a646f){_0x4a646f=_0x4a646f||0x1f4;return function(_0x4ba037){logger[_0xad71('0x1f')](_0x4ba037[_0xad71('0x20')]);if(_0x4ba037[_0xad71('0x21')]){delete _0x4ba037['name'];}_0x440aac['status'](_0x4a646f)[_0xad71('0x22')](_0x4ba037);};}exports[_0xad71('0x23')]=function(_0x2201f5,_0x2e3687){var _0x40d1b9={},_0x432939={},_0x3d3213={'count':0x0,'rows':[]};var _0x4a8c4c=_[_0xad71('0x24')](db[_0xad71('0x25')][_0xad71('0x26')],function(_0xab4ed3){return{'name':_0xab4ed3[_0xad71('0x27')],'type':_0xab4ed3['type']['key']};});_0x432939[_0xad71('0x28')]=_[_0xad71('0x24')](_0x4a8c4c,_0xad71('0x21'));_0x432939[_0xad71('0x29')]=_[_0xad71('0x2a')](_0x2201f5[_0xad71('0x29')]);_0x432939['filters']=_['intersection'](_0x432939[_0xad71('0x28')],_0x432939[_0xad71('0x29')]);_0x40d1b9[_0xad71('0x2b')]=_[_0xad71('0x2c')](_0x432939['model'],qs[_0xad71('0x2d')](_0x2201f5[_0xad71('0x29')][_0xad71('0x2d')]));_0x40d1b9['attributes']=_0x40d1b9['attributes']['length']?_0x40d1b9['attributes']:_0x432939[_0xad71('0x28')];if(!_0x2201f5['query'][_0xad71('0x2e')]('nolimit')){_0x40d1b9[_0xad71('0x18')]=qs[_0xad71('0x18')](_0x2201f5['query'][_0xad71('0x18')]);_0x40d1b9[_0xad71('0x17')]=qs[_0xad71('0x17')](_0x2201f5[_0xad71('0x29')]['offset']);}_0x40d1b9[_0xad71('0x2f')]=qs[_0xad71('0x30')](_0x2201f5['query'][_0xad71('0x30')]);_0x40d1b9[_0xad71('0x31')]=qs[_0xad71('0x32')](_[_0xad71('0x33')](_0x2201f5['query'],_0x432939[_0xad71('0x32')]),_0x4a8c4c);if(_0x2201f5[_0xad71('0x29')][_0xad71('0x34')]){_0x40d1b9[_0xad71('0x31')]=_['merge'](_0x40d1b9[_0xad71('0x31')],{'$or':_[_0xad71('0x24')](_0x4a8c4c,function(_0x22c071){if(_0x22c071[_0xad71('0x35')]!=='VIRTUAL'){var _0x4348a3={};_0x4348a3[_0x22c071[_0xad71('0x21')]]={'$like':'%'+_0x2201f5[_0xad71('0x29')][_0xad71('0x34')]+'%'};return _0x4348a3;}})});}_0x40d1b9=_[_0xad71('0x36')]({},_0x40d1b9,_0x2201f5[_0xad71('0x37')]);var _0x3262dd={'where':_0x40d1b9[_0xad71('0x31')]};return db['VoiceQueuesLog'][_0xad71('0x16')](_0x3262dd)[_0xad71('0x1d')](function(_0x1b2bea){_0x3d3213['count']=_0x1b2bea;if(_0x2201f5[_0xad71('0x29')][_0xad71('0x38')]){_0x40d1b9[_0xad71('0x39')]=[{'all':!![]}];}return db[_0xad71('0x25')][_0xad71('0x3a')](_0x40d1b9);})['then'](function(_0x50b20e){_0x3d3213[_0xad71('0x3b')]=_0x50b20e;return _0x3d3213;})[_0xad71('0x1d')](respondWithFilteredResult(_0x2e3687,_0x40d1b9))[_0xad71('0x3c')](handleError(_0x2e3687,null));};exports['show']=function(_0xcb57a2,_0xcbe972){var _0x32e520={'raw':!![],'where':{'id':_0xcb57a2['params']['id']}},_0x4fdc8c={};_0x4fdc8c['model']=_[_0xad71('0x2a')](db['VoiceQueuesLog']['rawAttributes']);_0x4fdc8c[_0xad71('0x29')]=_['keys'](_0xcb57a2[_0xad71('0x29')]);_0x4fdc8c[_0xad71('0x32')]=_[_0xad71('0x2c')](_0x4fdc8c[_0xad71('0x28')],_0x4fdc8c[_0xad71('0x29')]);_0x32e520[_0xad71('0x2b')]=_['intersection'](_0x4fdc8c[_0xad71('0x28')],qs[_0xad71('0x2d')](_0xcb57a2['query'][_0xad71('0x2d')]));_0x32e520[_0xad71('0x2b')]=_0x32e520[_0xad71('0x2b')][_0xad71('0x3d')]?_0x32e520[_0xad71('0x2b')]:_0x4fdc8c['model'];if(_0xcb57a2[_0xad71('0x29')][_0xad71('0x38')]){_0x32e520[_0xad71('0x39')]=[{'all':!![]}];}_0x32e520=_[_0xad71('0x36')]({},_0x32e520,_0xcb57a2[_0xad71('0x37')]);return db[_0xad71('0x25')][_0xad71('0x3e')](_0x32e520)['then'](handleEntityNotFound(_0xcbe972,null))[_0xad71('0x1d')](respondWithResult(_0xcbe972,null))[_0xad71('0x3c')](handleError(_0xcbe972,null));};exports['create']=function(_0x17d028,_0x118565){return db[_0xad71('0x25')][_0xad71('0x3f')](_0x17d028['body'],{})[_0xad71('0x1d')](respondWithResult(_0x118565,0xc9))[_0xad71('0x3c')](handleError(_0x118565,null));};exports[_0xad71('0x40')]=function(_0x5b2470,_0x438d70){if(_0x5b2470[_0xad71('0x41')]['id']){delete _0x5b2470[_0xad71('0x41')]['id'];}return db[_0xad71('0x25')][_0xad71('0x3e')]({'where':{'id':_0x5b2470[_0xad71('0x42')]['id']}})[_0xad71('0x1d')](handleEntityNotFound(_0x438d70,null))[_0xad71('0x1d')](saveUpdates(_0x5b2470['body'],null))[_0xad71('0x1d')](respondWithResult(_0x438d70,null))[_0xad71('0x3c')](handleError(_0x438d70,null));};exports['destroy']=function(_0x2f27ab,_0x58013b){return db[_0xad71('0x25')]['find']({'where':{'id':_0x2f27ab[_0xad71('0x42')]['id']}})[_0xad71('0x1d')](handleEntityNotFound(_0x58013b,null))['then'](removeEntity(_0x58013b,null))[_0xad71('0x3c')](handleError(_0x58013b,null));}; \ No newline at end of file +var _0x9c3e=['stack','name','index','VoiceQueuesLog','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','set','apply','reject','save','then','destroy','error'];(function(_0x4e1fbf,_0x4f2da9){var _0x4ee62f=function(_0x4e257c){while(--_0x4e257c){_0x4e1fbf['push'](_0x4e1fbf['shift']());}};_0x4ee62f(++_0x4f2da9);}(_0x9c3e,0xbf));var _0xe9c3=function(_0x186270,_0x59c68a){_0x186270=_0x186270-0x0;var _0x5a6c9a=_0x9c3e[_0x186270];return _0x5a6c9a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9c3('0x1'));var jsonpatch=require(_0xe9c3('0x2'));var rp=require(_0xe9c3('0x3'));var moment=require(_0xe9c3('0x4'));var BPromise=require(_0xe9c3('0x5'));var Mustache=require(_0xe9c3('0x6'));var util=require('util');var path=require(_0xe9c3('0x7'));var sox=require(_0xe9c3('0x8'));var csv=require(_0xe9c3('0x9'));var ejs=require(_0xe9c3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe9c3('0xb'));var jsforce=require(_0xe9c3('0xc'));var deskjs=require(_0xe9c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe9c3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe9c3('0xf'));var qs=require(_0xe9c3('0x10'));var as=require(_0xe9c3('0x11'));var hardwareService=require(_0xe9c3('0x12'));var logger=require(_0xe9c3('0x13'))(_0xe9c3('0x14'));var utils=require('../../config/utils');var config=require(_0xe9c3('0x15'));var licenseUtil=require(_0xe9c3('0x16'));var db=require(_0xe9c3('0x17'))['db'];function respondWithStatusCode(_0x21e6c3,_0x4b31e8){_0x4b31e8=_0x4b31e8||0xcc;return function(_0x364d53){if(_0x364d53){return _0x21e6c3[_0xe9c3('0x18')](_0x4b31e8);}return _0x21e6c3['status'](_0x4b31e8)[_0xe9c3('0x19')]();};}function respondWithResult(_0x276db2,_0x361467){_0x361467=_0x361467||0xc8;return function(_0xd56a2e){if(_0xd56a2e){return _0x276db2['status'](_0x361467)[_0xe9c3('0x1a')](_0xd56a2e);}};}function respondWithFilteredResult(_0x58bab5,_0x1483f0){return function(_0x5e9ac2){if(_0x5e9ac2){var _0x5e021e=_0x5e9ac2[_0xe9c3('0x1b')],_0x3e287e=_0x1483f0['offset'],_0x25dffa=_0x1483f0[_0xe9c3('0x1c')]+_0x1483f0['limit'],_0x804148;if(_0x25dffa>=_0x5e021e){_0x25dffa=_0x5e021e;_0x804148=0xc8;}else{_0x804148=0xce;}_0x58bab5[_0xe9c3('0x1d')](_0x804148);return _0x58bab5[_0xe9c3('0x1e')]('Content-Range',_0x3e287e+'-'+_0x25dffa+'/'+_0x5e021e)[_0xe9c3('0x1a')](_0x5e9ac2);}return null;};}function patchUpdates(_0x6fbde0){return function(_0x40850b){try{jsonpatch[_0xe9c3('0x1f')](_0x40850b,_0x6fbde0,!![]);}catch(_0x4c64b2){return BPromise[_0xe9c3('0x20')](_0x4c64b2);}return _0x40850b[_0xe9c3('0x21')]();};}function saveUpdates(_0x4b6dfd,_0x205218){return function(_0x38efac){if(_0x38efac){return _0x38efac['update'](_0x4b6dfd)[_0xe9c3('0x22')](function(_0x51a73f){return _0x51a73f;});}return null;};}function removeEntity(_0x36a898,_0x5ae390){return function(_0xde7850){if(_0xde7850){return _0xde7850[_0xe9c3('0x23')]()[_0xe9c3('0x22')](function(){_0x36a898['status'](0xcc)[_0xe9c3('0x19')]();});}};}function handleEntityNotFound(_0x36139b,_0x6df32e){return function(_0x3f4a82){if(!_0x3f4a82){_0x36139b[_0xe9c3('0x18')](0x194);}return _0x3f4a82;};}function handleError(_0x2cdd37,_0x15d4ca){_0x15d4ca=_0x15d4ca||0x1f4;return function(_0x2f067a){logger[_0xe9c3('0x24')](_0x2f067a[_0xe9c3('0x25')]);if(_0x2f067a[_0xe9c3('0x26')]){delete _0x2f067a['name'];}_0x2cdd37[_0xe9c3('0x1d')](_0x15d4ca)['send'](_0x2f067a);};}exports[_0xe9c3('0x27')]=function(_0x215aad,_0x40aa9f){var _0x389d86={},_0x5990d1={},_0x52eca0={'count':0x0,'rows':[]};var _0x4dafe2=_['map'](db[_0xe9c3('0x28')]['rawAttributes'],function(_0x56fdcc){return{'name':_0x56fdcc[_0xe9c3('0x29')],'type':_0x56fdcc[_0xe9c3('0x2a')][_0xe9c3('0x2b')]};});_0x5990d1[_0xe9c3('0x2c')]=_[_0xe9c3('0x2d')](_0x4dafe2,_0xe9c3('0x26'));_0x5990d1[_0xe9c3('0x2e')]=_[_0xe9c3('0x2f')](_0x215aad[_0xe9c3('0x2e')]);_0x5990d1[_0xe9c3('0x30')]=_[_0xe9c3('0x31')](_0x5990d1[_0xe9c3('0x2c')],_0x5990d1['query']);_0x389d86[_0xe9c3('0x32')]=_[_0xe9c3('0x31')](_0x5990d1[_0xe9c3('0x2c')],qs[_0xe9c3('0x33')](_0x215aad['query'][_0xe9c3('0x33')]));_0x389d86['attributes']=_0x389d86[_0xe9c3('0x32')][_0xe9c3('0x34')]?_0x389d86[_0xe9c3('0x32')]:_0x5990d1['model'];if(!_0x215aad[_0xe9c3('0x2e')][_0xe9c3('0x35')](_0xe9c3('0x36'))){_0x389d86['limit']=qs['limit'](_0x215aad[_0xe9c3('0x2e')][_0xe9c3('0x37')]);_0x389d86[_0xe9c3('0x1c')]=qs[_0xe9c3('0x1c')](_0x215aad[_0xe9c3('0x2e')]['offset']);}_0x389d86[_0xe9c3('0x38')]=qs[_0xe9c3('0x39')](_0x215aad[_0xe9c3('0x2e')][_0xe9c3('0x39')]);_0x389d86[_0xe9c3('0x3a')]=qs[_0xe9c3('0x30')](_[_0xe9c3('0x3b')](_0x215aad[_0xe9c3('0x2e')],_0x5990d1[_0xe9c3('0x30')]),_0x4dafe2);if(_0x215aad['query']['filter']){_0x389d86[_0xe9c3('0x3a')]=_[_0xe9c3('0x3c')](_0x389d86[_0xe9c3('0x3a')],{'$or':_[_0xe9c3('0x2d')](_0x4dafe2,function(_0x10251f){if(_0x10251f[_0xe9c3('0x2a')]!==_0xe9c3('0x3d')){var _0x219faa={};_0x219faa[_0x10251f[_0xe9c3('0x26')]]={'$like':'%'+_0x215aad[_0xe9c3('0x2e')][_0xe9c3('0x3e')]+'%'};return _0x219faa;}})});}_0x389d86=_[_0xe9c3('0x3c')]({},_0x389d86,_0x215aad[_0xe9c3('0x3f')]);var _0x20b06b={'where':_0x389d86['where']};return db[_0xe9c3('0x28')][_0xe9c3('0x1b')](_0x20b06b)[_0xe9c3('0x22')](function(_0x500365){_0x52eca0[_0xe9c3('0x1b')]=_0x500365;if(_0x215aad[_0xe9c3('0x2e')][_0xe9c3('0x40')]){_0x389d86[_0xe9c3('0x41')]=[{'all':!![]}];}return db[_0xe9c3('0x28')][_0xe9c3('0x42')](_0x389d86);})[_0xe9c3('0x22')](function(_0x343b31){_0x52eca0[_0xe9c3('0x43')]=_0x343b31;return _0x52eca0;})[_0xe9c3('0x22')](respondWithFilteredResult(_0x40aa9f,_0x389d86))[_0xe9c3('0x44')](handleError(_0x40aa9f,null));};exports[_0xe9c3('0x45')]=function(_0x169848,_0x422075){var _0x102592={'raw':!![],'where':{'id':_0x169848[_0xe9c3('0x46')]['id']}},_0x3fe183={};_0x3fe183['model']=_['keys'](db['VoiceQueuesLog'][_0xe9c3('0x47')]);_0x3fe183[_0xe9c3('0x2e')]=_[_0xe9c3('0x2f')](_0x169848['query']);_0x3fe183['filters']=_['intersection'](_0x3fe183[_0xe9c3('0x2c')],_0x3fe183['query']);_0x102592[_0xe9c3('0x32')]=_[_0xe9c3('0x31')](_0x3fe183[_0xe9c3('0x2c')],qs[_0xe9c3('0x33')](_0x169848[_0xe9c3('0x2e')][_0xe9c3('0x33')]));_0x102592[_0xe9c3('0x32')]=_0x102592['attributes'][_0xe9c3('0x34')]?_0x102592[_0xe9c3('0x32')]:_0x3fe183[_0xe9c3('0x2c')];if(_0x169848['query']['includeAll']){_0x102592[_0xe9c3('0x41')]=[{'all':!![]}];}_0x102592=_[_0xe9c3('0x3c')]({},_0x102592,_0x169848[_0xe9c3('0x3f')]);return db['VoiceQueuesLog'][_0xe9c3('0x48')](_0x102592)[_0xe9c3('0x22')](handleEntityNotFound(_0x422075,null))[_0xe9c3('0x22')](respondWithResult(_0x422075,null))[_0xe9c3('0x44')](handleError(_0x422075,null));};exports[_0xe9c3('0x49')]=function(_0x3d6e3b,_0x1c2bbb){return db[_0xe9c3('0x28')][_0xe9c3('0x49')](_0x3d6e3b[_0xe9c3('0x4a')],{})[_0xe9c3('0x22')](respondWithResult(_0x1c2bbb,0xc9))[_0xe9c3('0x44')](handleError(_0x1c2bbb,null));};exports[_0xe9c3('0x4b')]=function(_0x9ec933,_0xef5113){if(_0x9ec933[_0xe9c3('0x4a')]['id']){delete _0x9ec933[_0xe9c3('0x4a')]['id'];}return db[_0xe9c3('0x28')]['find']({'where':{'id':_0x9ec933['params']['id']}})[_0xe9c3('0x22')](handleEntityNotFound(_0xef5113,null))[_0xe9c3('0x22')](saveUpdates(_0x9ec933[_0xe9c3('0x4a')],null))[_0xe9c3('0x22')](respondWithResult(_0xef5113,null))[_0xe9c3('0x44')](handleError(_0xef5113,null));};exports[_0xe9c3('0x23')]=function(_0x1ed7f3,_0x40b206){return db['VoiceQueuesLog'][_0xe9c3('0x48')]({'where':{'id':_0x1ed7f3[_0xe9c3('0x46')]['id']}})['then'](handleEntityNotFound(_0x40b206,null))[_0xe9c3('0x22')](removeEntity(_0x40b206,null))['catch'](handleError(_0x40b206,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5e5d841..51babc9 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 _0xc203=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc203,0x12a));var _0x3c20=function(_0x208469,_0x47c157){_0x208469=_0x208469-0x0;var _0x3113c2=_0xc203[_0x208469];return _0x3113c2;};'use strict';var _=require(_0x3c20('0x0'));var util=require(_0x3c20('0x1'));var logger=require(_0x3c20('0x2'))(_0x3c20('0x3'));var moment=require(_0x3c20('0x4'));var BPromise=require(_0x3c20('0x5'));var rp=require(_0x3c20('0x6'));var fs=require('fs');var path=require(_0x3c20('0x7'));var rimraf=require(_0x3c20('0x8'));var config=require(_0x3c20('0x9'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x344762,_0x33f883){return _0x344762[_0x3c20('0xa')](_0x3c20('0xb'),attributes,{'tableName':_0x3c20('0xc'),'paranoid':![],'indexes':[{'name':_0x3c20('0xd'),'fields':[_0x3c20('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xd14a=['event','dtm','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x580b50,_0x1df4ed){var _0x2e438c=function(_0x462764){while(--_0x462764){_0x580b50['push'](_0x580b50['shift']());}};_0x2e438c(++_0x1df4ed);}(_0xd14a,0x1e2));var _0xad14=function(_0x3eedf6,_0x17bee7){_0x3eedf6=_0x3eedf6-0x0;var _0x347c9c=_0xd14a[_0x3eedf6];return _0x347c9c;};'use strict';var _=require(_0xad14('0x0'));var util=require(_0xad14('0x1'));var logger=require('../../config/logger')(_0xad14('0x2'));var moment=require(_0xad14('0x3'));var BPromise=require(_0xad14('0x4'));var rp=require(_0xad14('0x5'));var fs=require('fs');var path=require(_0xad14('0x6'));var rimraf=require(_0xad14('0x7'));var config=require(_0xad14('0x8'));var attributes=require(_0xad14('0x9'));module[_0xad14('0xa')]=function(_0x537423,_0x328e7c){return _0x537423[_0xad14('0xb')](_0xad14('0xc'),attributes,{'tableName':_0xad14('0xd'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xad14('0xe'),_0xad14('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9cd2dbb..3f01231 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 _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xa902,0x8d));var _0x2a90=function(_0x430467,_0x38d8ad){_0x430467=_0x430467-0x0;var _0x149266=_0xa902[_0x430467];return _0x149266;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file +var _0x9ffd=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x28644f,_0x6f5392){var _0x253dc9=function(_0x2ecee3){while(--_0x2ecee3){_0x28644f['push'](_0x28644f['shift']());}};_0x253dc9(++_0x6f5392);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5a90e7,_0x17e1e7){_0x5a90e7=_0x5a90e7-0x0;var _0x549ee7=_0x9ffd[_0x5a90e7];return _0x549ee7;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index faa8c3f..179e34f 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 _0x272b=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','delete'];(function(_0x47f767,_0x2e92f3){var _0x21c9a0=function(_0x203c34){while(--_0x203c34){_0x47f767['push'](_0x47f767['shift']());}};_0x21c9a0(++_0x2e92f3);}(_0x272b,0x6e));var _0xb272=function(_0x5b2b34,_0xe14d30){_0x5b2b34=_0x5b2b34-0x0;var _0x31db59=_0x272b[_0x5b2b34];return _0x31db59;};'use strict';var multer=require(_0xb272('0x0'));var util=require('util');var path=require(_0xb272('0x1'));var timeout=require(_0xb272('0x2'));var express=require('express');var router=express[_0xb272('0x3')]();var auth=require(_0xb272('0x4'));var interaction=require(_0xb272('0x5'));var config=require(_0xb272('0x6'));var controller=require(_0xb272('0x7'));router[_0xb272('0x8')]('/',auth['isAuthenticated'](),controller[_0xb272('0x9')]);router[_0xb272('0x8')](_0xb272('0xa'),auth[_0xb272('0xb')](),controller[_0xb272('0xc')]);router[_0xb272('0x8')](_0xb272('0xd'),auth[_0xb272('0xb')](),controller['show']);router[_0xb272('0x8')](_0xb272('0xe'),auth[_0xb272('0xb')](),controller[_0xb272('0xf')]);router['get'](_0xb272('0x10'),controller[_0xb272('0x11')]);router[_0xb272('0x8')](_0xb272('0x12'),auth[_0xb272('0xb')](),controller[_0xb272('0x13')]);router[_0xb272('0x14')]('/',auth['isAuthenticated'](),controller[_0xb272('0x15')]);router[_0xb272('0x14')]('/:id/transcribe',auth[_0xb272('0xb')](),controller[_0xb272('0x16')]);router['put'](_0xb272('0xd'),auth[_0xb272('0xb')](),controller[_0xb272('0x17')]);router[_0xb272('0x18')](_0xb272('0xd'),auth[_0xb272('0xb')](),controller[_0xb272('0x19')]);module[_0xb272('0x1a')]=router; \ No newline at end of file +var _0x0f0f=['/:id/downloads','downloadTranscribe','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download','download'];(function(_0x364154,_0x399863){var _0x413d88=function(_0xfca2c5){while(--_0xfca2c5){_0x364154['push'](_0x364154['shift']());}};_0x413d88(++_0x399863);}(_0x0f0f,0x105));var _0xf0f0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f0f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf0f0('0x0'));var util=require(_0xf0f0('0x1'));var path=require(_0xf0f0('0x2'));var timeout=require(_0xf0f0('0x3'));var express=require(_0xf0f0('0x4'));var router=express[_0xf0f0('0x5')]();var auth=require(_0xf0f0('0x6'));var interaction=require(_0xf0f0('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xf0f0('0x8')]('/',auth[_0xf0f0('0x9')](),controller[_0xf0f0('0xa')]);router[_0xf0f0('0x8')]('/describe',auth[_0xf0f0('0x9')](),controller[_0xf0f0('0xb')]);router[_0xf0f0('0x8')](_0xf0f0('0xc'),auth[_0xf0f0('0x9')](),controller['show']);router['get'](_0xf0f0('0xd'),auth[_0xf0f0('0x9')](),controller[_0xf0f0('0xe')]);router[_0xf0f0('0x8')](_0xf0f0('0xf'),controller['downloads']);router[_0xf0f0('0x8')]('/:id/transcribe',auth[_0xf0f0('0x9')](),controller[_0xf0f0('0x10')]);router['post']('/',auth[_0xf0f0('0x9')](),controller[_0xf0f0('0x11')]);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0xf0f0('0x12')](_0xf0f0('0xc'),auth[_0xf0f0('0x9')](),controller[_0xf0f0('0x13')]);router[_0xf0f0('0x14')](_0xf0f0('0xc'),auth['isAuthenticated'](),controller[_0xf0f0('0x15')]);module[_0xf0f0('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 98e42d1..eac5c97 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 _0x1512=['FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','INTEGER','TEXT','NEW'];(function(_0x1dd0e0,_0x4e4ff0){var _0x4b399a=function(_0x5f3d21){while(--_0x5f3d21){_0x1dd0e0['push'](_0x1dd0e0['shift']());}};_0x4b399a(++_0x4e4ff0);}(_0x1512,0x1bd));var _0x2151=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1512[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2151('0x0'));var moment=require(_0x2151('0x1'));var path=require(_0x2151('0x2'));module[_0x2151('0x3')]={'format':{'type':Sequelize[_0x2151('0x4')],'get':function(){return this[_0x2151('0x5')](_0x2151('0x6'))?path[_0x2151('0x7')](this[_0x2151('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x2151('0x8')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x5f38b1){if(_0x5f38b1){this[_0x2151('0x9')](_0x2151('0xa'),_0x5f38b1);this['setDataValue'](_0x2151('0xb'),_0x5f38b1['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x2151('0x8')]},'calleridnum':{'type':Sequelize[_0x2151('0x8')]},'calleridname':{'type':Sequelize[_0x2151('0x8')]},'connectedlinenum':{'type':Sequelize[_0x2151('0x8')]},'connectedlinename':{'type':Sequelize[_0x2151('0x8')]},'accountcode':{'type':Sequelize[_0x2151('0x8')]},'context':{'type':Sequelize[_0x2151('0x8')]},'exten':{'type':Sequelize[_0x2151('0x8')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x2151('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x2151('0x8')]},'userDisposition':{'type':Sequelize[_0x2151('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x2151('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x2151('0x8')]},'location':{'type':Sequelize[_0x2151('0xd')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x2151('0x8')],'defaultValue':_0x2151('0xe')},'fileUri':{'type':Sequelize[_0x2151('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x2151('0xd')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0x2151('0xf')]},'sNegative':{'type':Sequelize[_0x2151('0xf')]},'sNeutral':{'type':Sequelize[_0x2151('0xf')]},'sMixed':{'type':Sequelize[_0x2151('0xf')]},'tempSentiment':{'type':Sequelize[_0x2151('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2151('0x11')],'get':function(){return moment(this[_0x2151('0x5')](_0x2151('0x12')))[_0x2151('0x13')](_0x2151('0x14'))[_0x2151('0x15')]();}},'updatedAt':{'type':Sequelize[_0x2151('0x11')],'get':function(){return moment(this[_0x2151('0x5')](_0x2151('0x16')))[_0x2151('0x13')](_0x2151('0x14'))[_0x2151('0x15')]();}}}; \ No newline at end of file +var _0x1cd2=['STRING','setDataValue','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname'];(function(_0x5b6d64,_0x1a8e32){var _0xfc576e=function(_0x395f11){while(--_0x395f11){_0x5b6d64['push'](_0x5b6d64['shift']());}};_0xfc576e(++_0x1a8e32);}(_0x1cd2,0x11e));var _0x21cd=function(_0x6140b8,_0x1f3f62){_0x6140b8=_0x6140b8-0x0;var _0x3c6e64=_0x1cd2[_0x6140b8];return _0x3c6e64;};'use strict';var Sequelize=require(_0x21cd('0x0'));var moment=require(_0x21cd('0x1'));var path=require(_0x21cd('0x2'));module[_0x21cd('0x3')]={'format':{'type':Sequelize[_0x21cd('0x4')],'get':function(){return this[_0x21cd('0x5')](_0x21cd('0x6'))?path[_0x21cd('0x7')](this[_0x21cd('0x5')](_0x21cd('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x21cd('0x8')]},'channel':{'type':Sequelize[_0x21cd('0x8')],'set':function(_0x209cfc){if(_0x209cfc){this[_0x21cd('0x9')]('channel',_0x209cfc);this[_0x21cd('0x9')](_0x21cd('0xa'),_0x209cfc[_0x21cd('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x21cd('0x8')]},'connectedlinename':{'type':Sequelize[_0x21cd('0x8')]},'accountcode':{'type':Sequelize[_0x21cd('0x8')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x21cd('0x8')]},'value':{'type':Sequelize[_0x21cd('0x8')]},'type':{'type':Sequelize[_0x21cd('0x8')]},'rating':{'type':Sequelize[_0x21cd('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x21cd('0x8')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x21cd('0x8')]},'location':{'type':Sequelize[_0x21cd('0xd')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x21cd('0x8')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x21cd('0xd')]},'fileText':{'type':Sequelize[_0x21cd('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x21cd('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x21cd('0xe')]},'tempSentiment':{'type':Sequelize[_0x21cd('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x21cd('0x10')],'get':function(){return moment(this[_0x21cd('0x5')]('createdAt'))['format'](_0x21cd('0x11'))[_0x21cd('0x12')]();}},'updatedAt':{'type':Sequelize[_0x21cd('0x10')],'get':function(){return moment(this[_0x21cd('0x5')](_0x21cd('0x13')))[_0x21cd('0x14')](_0x21cd('0x11'))[_0x21cd('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index e090989..3142744 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 _0x1f01=['Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','NEW','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VoiceRecording','fieldName','type','key','map','format','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','merge','where','count','findAll','show','params','includeAll','include','options','find','create','catch','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','recording','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribeRegion','language'];(function(_0x4d18a9,_0x820ca4){var _0x582cb5=function(_0x33cdc8){while(--_0x33cdc8){_0x4d18a9['push'](_0x4d18a9['shift']());}};_0x582cb5(++_0x820ca4);}(_0x1f01,0xae));var _0x11f0=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x1f01[_0x57ee8c];return _0x3a2322;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x11f0('0x0'));var rimraf=require(_0x11f0('0x1'));var zipdir=require(_0x11f0('0x2'));var jsonpatch=require(_0x11f0('0x3'));var rp=require(_0x11f0('0x4'));var moment=require(_0x11f0('0x5'));var BPromise=require(_0x11f0('0x6'));var Mustache=require(_0x11f0('0x7'));var util=require('util');var path=require(_0x11f0('0x8'));var sox=require(_0x11f0('0x9'));var csv=require('to-csv');var ejs=require(_0x11f0('0xa'));var fs=require('fs');var _=require(_0x11f0('0xb'));var squel=require(_0x11f0('0xc'));var crypto=require(_0x11f0('0xd'));var jsforce=require(_0x11f0('0xe'));var deskjs=require(_0x11f0('0xf'));var toCsv=require(_0x11f0('0x10'));var querystring=require('querystring');var Papa=require(_0x11f0('0x11'));var AWS=require('aws-sdk');var uuidv4=require(_0x11f0('0x12'));var Redis=require(_0x11f0('0x13'));var authService=require(_0x11f0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x11f0('0x15'));var hardwareService=require(_0x11f0('0x16'));var logger=require(_0x11f0('0x17'))(_0x11f0('0x18'));var utils=require(_0x11f0('0x19'));var config=require(_0x11f0('0x1a'));var licenseUtil=require(_0x11f0('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2b1ba,_0x58fa9f){_0x58fa9f=_0x58fa9f||0xcc;return function(_0x1a8d25){if(_0x1a8d25){return _0xe2b1ba['sendStatus'](_0x58fa9f);}return _0xe2b1ba['status'](_0x58fa9f)[_0x11f0('0x1c')]();};}function respondWithResult(_0x2cbc02,_0x1d39b3){_0x1d39b3=_0x1d39b3||0xc8;return function(_0x34288d){if(_0x34288d){return _0x2cbc02[_0x11f0('0x1d')](_0x1d39b3)[_0x11f0('0x1e')](_0x34288d);}};}function respondWithFilteredResult(_0x561117,_0x3359fb){return function(_0x36e558){if(_0x36e558){var _0x2514e3=_0x36e558['count'],_0x4b4535=_0x3359fb[_0x11f0('0x1f')],_0x33dd0e=_0x3359fb[_0x11f0('0x1f')]+_0x3359fb[_0x11f0('0x20')],_0x4a19dc;if(_0x33dd0e>=_0x2514e3){_0x33dd0e=_0x2514e3;_0x4a19dc=0xc8;}else{_0x4a19dc=0xce;}_0x561117[_0x11f0('0x1d')](_0x4a19dc);return _0x561117[_0x11f0('0x21')](_0x11f0('0x22'),_0x4b4535+'-'+_0x33dd0e+'/'+_0x2514e3)[_0x11f0('0x1e')](_0x36e558);}return null;};}function patchUpdates(_0x4ce094){return function(_0x18f1b8){try{jsonpatch[_0x11f0('0x23')](_0x18f1b8,_0x4ce094,!![]);}catch(_0x30ebd0){return BPromise[_0x11f0('0x24')](_0x30ebd0);}return _0x18f1b8[_0x11f0('0x25')]();};}function saveUpdates(_0x9a34ad,_0xc5608c){return function(_0x55f237){if(_0x55f237){return _0x55f237[_0x11f0('0x26')](_0x9a34ad)[_0x11f0('0x27')](function(_0x224e60){return _0x224e60;});}return null;};}function removeEntity(_0x343e96,_0x48bf22){return function(_0xf9551c){if(_0xf9551c){return _0xf9551c[_0x11f0('0x28')]()[_0x11f0('0x27')](function(){_0x343e96['status'](0xcc)[_0x11f0('0x1c')]();});}};}function handleEntityNotFound(_0x26187b,_0x1ee36b){return function(_0x560d12){if(!_0x560d12){_0x26187b[_0x11f0('0x29')](0x194);}return _0x560d12;};}function handleError(_0x5e1e03,_0x4353e0){_0x4353e0=_0x4353e0||0x1f4;return function(_0x372cbc){logger[_0x11f0('0x2a')](_0x372cbc[_0x11f0('0x2b')]);if(_0x372cbc[_0x11f0('0x2c')]){delete _0x372cbc['name'];}_0x5e1e03[_0x11f0('0x1d')](_0x4353e0)[_0x11f0('0x2d')](_0x372cbc);};}exports[_0x11f0('0x2e')]=function(_0xa91e03,_0x39c010){var _0xfb0a14={},_0x25d0a0={},_0x1fca8e={'count':0x0,'rows':[]};var _0x234dce=_['map'](db[_0x11f0('0x2f')]['rawAttributes'],function(_0x4d0477){return{'name':_0x4d0477[_0x11f0('0x30')],'type':_0x4d0477[_0x11f0('0x31')][_0x11f0('0x32')]};});_0x25d0a0['model']=_['differenceBy'](_[_0x11f0('0x33')](_0x234dce,'name'),[_0x11f0('0x34')]);_0x25d0a0[_0x11f0('0x35')]=_[_0x11f0('0x36')](_0xa91e03[_0x11f0('0x35')]);_0x25d0a0[_0x11f0('0x37')]=_[_0x11f0('0x38')](_0x25d0a0['model'],_0x25d0a0['query']);_0xfb0a14[_0x11f0('0x39')]=_[_0x11f0('0x38')](_0x25d0a0[_0x11f0('0x3a')],qs['fields'](_0xa91e03[_0x11f0('0x35')][_0x11f0('0x3b')]));_0xfb0a14[_0x11f0('0x39')]=_0xfb0a14[_0x11f0('0x39')][_0x11f0('0x3c')]?_0xfb0a14[_0x11f0('0x39')]:_0x25d0a0[_0x11f0('0x3a')];if(!_0xa91e03['query']['hasOwnProperty'](_0x11f0('0x3d'))){_0xfb0a14['limit']=qs['limit'](_0xa91e03[_0x11f0('0x35')]['limit']);_0xfb0a14[_0x11f0('0x1f')]=qs[_0x11f0('0x1f')](_0xa91e03[_0x11f0('0x35')][_0x11f0('0x1f')]);}_0xfb0a14[_0x11f0('0x3e')]=qs[_0x11f0('0x3f')](_0xa91e03['query'][_0x11f0('0x3f')]);_0xfb0a14['where']=qs[_0x11f0('0x37')](_[_0x11f0('0x40')](_0xa91e03[_0x11f0('0x35')],_0x25d0a0[_0x11f0('0x37')]),_0x234dce);if(_0xa91e03[_0x11f0('0x35')][_0x11f0('0x41')]){_0xfb0a14['where']=_[_0x11f0('0x42')](_0xfb0a14[_0x11f0('0x43')],{'$or':_[_0x11f0('0x33')](_0x234dce,function(_0xff872a){if(_0xff872a[_0x11f0('0x31')]!=='VIRTUAL'){var _0x2d00a0={};_0x2d00a0[_0xff872a[_0x11f0('0x2c')]]={'$like':'%'+_0xa91e03[_0x11f0('0x35')][_0x11f0('0x41')]+'%'};return _0x2d00a0;}})});}_0xfb0a14=_[_0x11f0('0x42')]({},_0xfb0a14,_0xa91e03['options']);var _0xe5840b={'where':_0xfb0a14[_0x11f0('0x43')]};return db[_0x11f0('0x2f')]['count'](_0xe5840b)[_0x11f0('0x27')](function(_0x54e11a){_0x1fca8e[_0x11f0('0x44')]=_0x54e11a;if(_0xa91e03['query']['includeAll']){_0xfb0a14['include']=[{'all':!![]}];}return db[_0x11f0('0x2f')][_0x11f0('0x45')](_0xfb0a14);})[_0x11f0('0x27')](function(_0x73bf7b){_0x1fca8e['rows']=_0x73bf7b;return _0x1fca8e;})[_0x11f0('0x27')](respondWithFilteredResult(_0x39c010,_0xfb0a14))['catch'](handleError(_0x39c010,null));};exports[_0x11f0('0x46')]=function(_0x29ec3e,_0x275237){var _0x21569f={'raw':![],'where':{'id':_0x29ec3e[_0x11f0('0x47')]['id']}},_0x2ac3dc={};_0x2ac3dc[_0x11f0('0x3a')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x2ac3dc[_0x11f0('0x35')]=_[_0x11f0('0x36')](_0x29ec3e[_0x11f0('0x35')]);_0x2ac3dc['filters']=_['intersection'](_0x2ac3dc[_0x11f0('0x3a')],_0x2ac3dc['query']);_0x21569f[_0x11f0('0x39')]=_[_0x11f0('0x38')](_0x2ac3dc[_0x11f0('0x3a')],qs['fields'](_0x29ec3e['query']['fields']));_0x21569f['attributes']=_0x21569f['attributes'][_0x11f0('0x3c')]?_0x21569f[_0x11f0('0x39')]:_0x2ac3dc['model'];if(_0x29ec3e[_0x11f0('0x35')][_0x11f0('0x48')]){_0x21569f[_0x11f0('0x49')]=[{'all':!![]}];}_0x21569f=_[_0x11f0('0x42')]({},_0x21569f,_0x29ec3e[_0x11f0('0x4a')]);return db[_0x11f0('0x2f')][_0x11f0('0x4b')](_0x21569f)[_0x11f0('0x27')](handleEntityNotFound(_0x275237,null))[_0x11f0('0x27')](respondWithResult(_0x275237,null))['catch'](handleError(_0x275237,null));};exports[_0x11f0('0x4c')]=function(_0x4af68d,_0x246efe){return db['VoiceRecording']['create'](_0x4af68d['body'],{})[_0x11f0('0x27')](respondWithResult(_0x246efe,0xc9))[_0x11f0('0x4d')](handleError(_0x246efe,null));};exports[_0x11f0('0x26')]=function(_0x182b5c,_0xf568a8){if(_0x182b5c['body']['id']){delete _0x182b5c[_0x11f0('0x4e')]['id'];}return db[_0x11f0('0x2f')][_0x11f0('0x4b')]({'where':{'id':_0x182b5c[_0x11f0('0x47')]['id']}})[_0x11f0('0x27')](handleEntityNotFound(_0xf568a8,null))[_0x11f0('0x27')](saveUpdates(_0x182b5c['body'],null))[_0x11f0('0x27')](respondWithResult(_0xf568a8,null))[_0x11f0('0x4d')](handleError(_0xf568a8,null));};exports['describe']=function(_0x79d137,_0x15e6f6){return db[_0x11f0('0x2f')][_0x11f0('0x4f')]()['then'](respondWithResult(_0x15e6f6,null))[_0x11f0('0x4d')](handleError(_0x15e6f6,null));};exports[_0x11f0('0x50')]=function(_0x329ccd,_0x4cd850,_0xf22ffc){var _0x391020=require('../../components/encryptor');var _0x136c43=![];var _0x3abc97={};if(_0x329ccd[_0x11f0('0x35')][_0x11f0('0x31')]&&_0x329ccd[_0x11f0('0x35')]['type']===_0x11f0('0x51')){_0x3abc97[_0x11f0('0x51')]=_0x329ccd['params']['id'];}else{_0x3abc97['id']=_0x329ccd[_0x11f0('0x47')]['id'];}return db['VoiceRecording']['find']({'where':_0x3abc97,'attributes':['id','value'],'raw':!![]})[_0x11f0('0x27')](handleEntityNotFound(_0x4cd850,null))[_0x11f0('0x27')](function(_0x20c969){if(_0x20c969){var _0x3295b0=_0x20c969[_0x11f0('0x52')];var _0x2ee59b=util['format'](_0x11f0('0x53'),_0x3295b0);if(fs[_0x11f0('0x54')](_0x2ee59b)){_0x136c43=!![];return _0x391020[_0x11f0('0x55')](_0x2ee59b,_0x3295b0,config[_0x11f0('0x56')]['recording'])[_0x11f0('0x27')](function(){return _0x20c969;});}return _0x20c969;}})[_0x11f0('0x27')](function(_0x1bd9ce){if(_0x1bd9ce){var _0x4496e1=_0x1bd9ce['value'];if(!fs[_0x11f0('0x54')](_0x4496e1)){throw new db['Sequelize'][(_0x11f0('0x57'))](_0x11f0('0x58'));}if(_0x1bd9ce[_0x11f0('0x59')]){return _0x4cd850[_0x11f0('0x50')](_0x4496e1,_0x1bd9ce[_0x11f0('0x59')]+path[_0x11f0('0x5a')](_0x4496e1),function(){if(_0x136c43){fs[_0x11f0('0x5b')](_0x4496e1);}});}else{return _0x4cd850[_0x11f0('0x50')](_0x4496e1,function(_0xb3051d){if(_0x136c43){fs[_0x11f0('0x5b')](_0x4496e1);}});}}})[_0x11f0('0x4d')](function(_0x29d51c){if(_0x29d51c[_0x11f0('0x5c')]===_0x11f0('0x58')){_0x4cd850['status'](0x194)[_0x11f0('0x2d')](_0x11f0('0x5d'));}else{return handleError(_0x4cd850,null);}});};exports[_0x11f0('0x5e')]=function(_0x52f856,_0x1f24e6,_0x4e39a1){var _0x17d11c=require(_0x11f0('0x5f'));var _0x7cc4fd=![];var _0x4cbced={'$and':[db[_0x11f0('0x60')]['where'](db[_0x11f0('0x60')]['fn'](_0x11f0('0x61'),db[_0x11f0('0x60')][_0x11f0('0x62')](_0x11f0('0x51'))),_0x52f856[_0x11f0('0x35')][_0x11f0('0x63')])]};if(_0x52f856[_0x11f0('0x35')][_0x11f0('0x31')]&&_0x52f856['query'][_0x11f0('0x31')]===_0x11f0('0x51')){_0x4cbced[_0x11f0('0x64')]['push']({'uniqueid':_0x52f856[_0x11f0('0x47')]['id']});}else{_0x4cbced[_0x11f0('0x64')][_0x11f0('0x65')]({'id':_0x52f856[_0x11f0('0x47')]['id']});}return db['VoiceRecording'][_0x11f0('0x4b')]({'where':_0x4cbced,'attributes':['id',_0x11f0('0x52')],'raw':!![]})[_0x11f0('0x27')](handleEntityNotFound(_0x1f24e6,null))[_0x11f0('0x27')](function(_0xc0a09d){if(_0xc0a09d){var _0x13113c=util['format'](_0x11f0('0x53'),_0xc0a09d[_0x11f0('0x52')]);if(fs[_0x11f0('0x54')](_0x13113c)){_0x7cc4fd=!![];return _0x17d11c[_0x11f0('0x55')](_0x13113c,_0xc0a09d[_0x11f0('0x52')],config[_0x11f0('0x56')][_0x11f0('0x66')])['then'](function(){return _0xc0a09d;});}return _0xc0a09d;}})[_0x11f0('0x27')](function(_0x4856cb){if(_0x4856cb){if(!fs['existsSync'](_0x4856cb[_0x11f0('0x52')])){throw new db[(_0x11f0('0x67'))][(_0x11f0('0x57'))](_0x11f0('0x58'));}if(_0x4856cb['filename']){return _0x1f24e6['download'](_0x4856cb[_0x11f0('0x52')],_0x4856cb['filename']+path[_0x11f0('0x5a')](_0x4856cb[_0x11f0('0x52')]),function(){if(_0x7cc4fd){fs[_0x11f0('0x5b')](_0x4856cb['value']);}});}else{return _0x1f24e6['download'](_0x4856cb[_0x11f0('0x52')],function(_0x998b6e){if(_0x7cc4fd){fs[_0x11f0('0x5b')](_0x4856cb['value']);}});}}})['catch'](handleError(_0x1f24e6,null));};exports[_0x11f0('0x28')]=function(_0x61f33c,_0x1b5954){return db[_0x11f0('0x2f')]['find']({'where':{'id':_0x61f33c[_0x11f0('0x47')]['id']}})[_0x11f0('0x27')](function(_0x450891){if(!_0x450891)throw new ReferenceError(_0x11f0('0x68'));return _0x450891;})[_0x11f0('0x27')](function(_0x352af2){var _0x41a073=_0x352af2[_0x11f0('0x52')];logger[_0x11f0('0x69')](_0x11f0('0x6a'),_0x41a073);if(!_[_0x11f0('0x6b')](_0x352af2[_0x11f0('0x52')])&&fs['existsSync'](_0x41a073)){logger[_0x11f0('0x69')]('File:\x20\x22'+_0x41a073+_0x11f0('0x6c'));fs[_0x11f0('0x6d')](_0x41a073);}_0x41a073=_0x41a073+_0x11f0('0x6e');if(!_[_0x11f0('0x6b')](_0x352af2[_0x11f0('0x52')])&&fs[_0x11f0('0x54')](_0x41a073)){logger[_0x11f0('0x69')]('File:\x20\x22'+_0x41a073+_0x11f0('0x6c'));fs[_0x11f0('0x6d')](_0x41a073);}return _0x352af2;})[_0x11f0('0x27')](function(_0x130518){if(!_0x130518)throw new InternalError();return _0x130518[_0x11f0('0x28')]();})[_0x11f0('0x27')](function(){_0x1b5954[_0x11f0('0x1d')](0xcc)['end']();})['catch'](handleError(_0x1b5954,null));};function getBucketslist(_0x514549,_0x1074ef,_0x15a9e4){return new Promise(function(_0x331c9d,_0x15dfff){var _0x5bceac=new AWS['S3']({'accessKeyId':_0x1074ef,'secretAccessKey':_0x514549,'region':_0x15a9e4});_0x5bceac[_0x11f0('0x6f')]({},function(_0x483c42,_0x5522eb){if(_0x483c42){return _0x15dfff(_0x483c42);}else{return _0x331c9d(_0x5522eb);}});});}function createBucket(_0x30df2c,_0x570daf,_0x40920b,_0x1b7192){return new Promise(function(_0x39791d,_0x490532){var _0xe7bdd8=new AWS['S3']({'accessKeyId':_0x570daf,'secretAccessKey':_0x30df2c,'region':_0x40920b});_0xe7bdd8[_0x11f0('0x70')]({'Bucket':_0x1b7192},function(_0x43d48a,_0x36aacb){if(_0x43d48a){return _0x490532(_0x43d48a);}else{return _0x39791d(_0x36aacb);}});});}function uploadFile(_0x35cf68,_0x3fd199,_0x391575,_0xcfeb44,_0x539119,_0x47e25d){return new Promise(function(_0x4b7f44,_0x12fd38){var _0x25dadf=new AWS['S3']({'accessKeyId':_0x3fd199,'secretAccessKey':_0x35cf68,'region':_0x391575});_0x25dadf[_0x11f0('0x71')]({'Bucket':_0xcfeb44,'Key':_0x539119,'Body':_0x47e25d},function(_0x31cefb,_0x3ca72c){if(_0x31cefb){return _0x12fd38(_0x31cefb);}else{return _0x4b7f44(_0x3ca72c);}});});}function startTranscribe(_0x464f9c,_0x1c058e,_0x35893f,_0x286447,_0x59e6eb,_0x5cf4f0){return new Promise(function(_0x6569a6,_0x152efe){var _0x3e8cb4=new AWS[(_0x11f0('0x72'))]({'accessKeyId':_0x1c058e,'secretAccessKey':_0x464f9c,'region':_0x35893f});_0x3e8cb4['startTranscriptionJob']({'TranscriptionJobName':_0x286447,'LanguageCode':_0x59e6eb,'Media':{'MediaFileUri':_0x5cf4f0}},function(_0x50dd24,_0x82b3b6){if(_0x50dd24){return _0x152efe(_0x50dd24);}else{return _0x6569a6(_0x82b3b6);}});});}function transcribe(_0xda4f4f,_0x13ecf7,_0x273996,_0x98746f,_0x2cae63,_0x1b370c,_0x3104cf){return new Promise(function(_0x27ae9a,_0x1d70a1){var _0x24ec0d={};logger[_0x11f0('0x69')](util[_0x11f0('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xda4f4f,_0x2cae63));return uploadFile(_0x13ecf7,_0x273996,_0x98746f,_0x2cae63,path['basename'](_0x1b370c),fs['readFileSync'](_0x1b370c))['then'](function(_0x190bb2){logger['info'](util[_0x11f0('0x34')](_0x11f0('0x73'),_0xda4f4f,_0x2cae63,_0x190bb2[_0x11f0('0x74')]));_0x24ec0d[_0x11f0('0x75')]=_0x190bb2[_0x11f0('0x76')];_0x24ec0d[_0x11f0('0x77')]=_0x190bb2[_0x11f0('0x74')];logger[_0x11f0('0x69')](util['format'](_0x11f0('0x78'),_0xda4f4f));return startTranscribe(_0x13ecf7,_0x273996,_0x98746f,uuidv4(),_0x3104cf,_0x190bb2[_0x11f0('0x74')]);})[_0x11f0('0x27')](function(_0x2576fa){logger[_0x11f0('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xda4f4f,_0x2576fa[_0x11f0('0x79')][_0x11f0('0x7a')]));_0x24ec0d[_0x11f0('0x7b')]=_0x2576fa[_0x11f0('0x79')][_0x11f0('0x7a')];_0x24ec0d[_0x11f0('0x7c')]=_0x2576fa['TranscriptionJob'][_0x11f0('0x7d')];return _0x27ae9a(_0x24ec0d);})[_0x11f0('0x4d')](function(_0x1cec79){return _0x1d70a1(_0x1cec79);});});}exports['runTranscribe']=function(_0x177935,_0x5f518c,_0xef651b){var _0x4699fa;var _0x35ac24;var _0x17c93f;var _0x590b6a=require(_0x11f0('0x5f'));return db[_0x11f0('0x2f')][_0x11f0('0x7e')]({'where':{'id':_0x177935[_0x11f0('0x47')]['id']}})['then'](function(_0x32c068){if(_0x32c068){var _0x3157d=util[_0x11f0('0x34')](_0x11f0('0x53'),_0x32c068[_0x11f0('0x52')]);if(fs['existsSync'](_0x3157d)){cypher=!![];return _0x590b6a[_0x11f0('0x55')](_0x3157d,_0x32c068['value'],config['secrets'][_0x11f0('0x66')])['then'](function(){return _0x32c068;});}return _0x32c068;}})['then'](function(_0x57965d){if(!_0x57965d){throw new db[(_0x11f0('0x67'))][(_0x11f0('0x57'))](_0x11f0('0x7f'));}_0x35ac24=_0x57965d;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x11f0('0x27')](handleEntityNotFound(_0x5f518c,null))[_0x11f0('0x27')](function(_0x589c2a){if(_0x589c2a){_0x4699fa=_0x589c2a;if(!_0x4699fa['transcribe']||!_0x4699fa['transcribeAccountId']||!_0x4699fa[_0x11f0('0x80')]||!_0x4699fa[_0x11f0('0x81')]||!_0x4699fa[_0x11f0('0x75')]){throw new db[(_0x11f0('0x67'))][(_0x11f0('0x57'))](_0x11f0('0x82'));}if(_0x177935[_0x11f0('0x4e')][_0x11f0('0x83')]&&(!_0x4699fa[_0x11f0('0x84')]||!_0x4699fa[_0x11f0('0x85')]||!_0x4699fa[_0x11f0('0x86')]||!_0x4699fa[_0x11f0('0x81')]||!_0x4699fa[_0x11f0('0x75')])){throw new db[(_0x11f0('0x67'))][(_0x11f0('0x57'))](_0x11f0('0x87'));}return db[_0x11f0('0x88')]['findOne']({'where':{'id':_0x4699fa[_0x11f0('0x89')]}});}})[_0x11f0('0x27')](function(_0x2e7739){if(!_0x2e7739){throw new db[(_0x11f0('0x67'))][(_0x11f0('0x57'))](_0x11f0('0x8a'));}if(!_0x2e7739['data1']||!_0x2e7739[_0x11f0('0x8b')]){throw new db[(_0x11f0('0x67'))][(_0x11f0('0x57'))](_0x11f0('0x8c'));}_0x17c93f=_0x2e7739;return getBucketslist(_0x17c93f[_0x11f0('0x8d')],_0x17c93f[_0x11f0('0x8b')],_0x4699fa[_0x11f0('0x80')]);})[_0x11f0('0x27')](function(_0x5c45f2){if(_0x5c45f2&&_0x5c45f2[_0x11f0('0x8e')]){var _0xd036c6=_['find'](_0x5c45f2['Buckets'],function(_0x408fe5){return _0x408fe5[_0x11f0('0x8f')]===_0x4699fa['bucket'];});if(!_0xd036c6){logger[_0x11f0('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x177935[_0x11f0('0x47')]['id'],_0x4699fa[_0x11f0('0x75')]));return createBucket(_0x17c93f['data1'],_0x17c93f['data2'],_0x4699fa[_0x11f0('0x80')],_0x4699fa[_0x11f0('0x75')]);}logger[_0x11f0('0x69')](util[_0x11f0('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x177935[_0x11f0('0x47')]['id'],_0x4699fa[_0x11f0('0x75')]));return;}})[_0x11f0('0x27')](function(_0x2a8268){if(_0x35ac24[_0x11f0('0x7c')]===_0x11f0('0x90')){return transcribe(_0x177935[_0x11f0('0x47')]['id'],_0x17c93f[_0x11f0('0x8d')],_0x17c93f[_0x11f0('0x8b')],_0x4699fa[_0x11f0('0x80')],_0x4699fa[_0x11f0('0x75')],_0x35ac24[_0x11f0('0x52')],_0x4699fa['language']);}else{logger[_0x11f0('0x69')](util[_0x11f0('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x177935[_0x11f0('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x587892){if(_0x587892){_0x587892[_0x11f0('0x91')]=_0x177935[_0x11f0('0x4e')][_0x11f0('0x83')];return _0x35ac24[_0x11f0('0x92')](_0x587892);}})[_0x11f0('0x27')](respondWithResult(_0x5f518c,null))[_0x11f0('0x4d')](handleError(_0x5f518c,null));};function writeFile(_0x14690c,_0x28e1cf){return new Promise(function(_0x33230f,_0xe397d3){fs[_0x11f0('0x93')](_0x28e1cf,_0x14690c,function(_0x17a3fe,_0x46ea64){if(_0x17a3fe){return _0xe397d3(_0x17a3fe);}else{return _0x33230f(_0x46ea64);}});});}exports[_0x11f0('0x94')]=function(_0x5b966b,_0x2871b4,_0x2437d5){return db['VoiceRecording'][_0x11f0('0x7e')]({'where':{'id':_0x5b966b[_0x11f0('0x47')]['id']}})[_0x11f0('0x27')](handleEntityNotFound(_0x2871b4))[_0x11f0('0x27')](function(_0x506ad5){if(_0x506ad5&&_0x506ad5[_0x11f0('0x95')]){var _0x4021f4=_0x506ad5[_0x11f0('0x95')];var _0x137d11=config[_0x11f0('0x96')]+_0x11f0('0x97')+_0x506ad5['id']+'.txt';if(fs['existsSync'](_0x137d11)){return _0x137d11;}return writeFile(_0x4021f4,_0x137d11)[_0x11f0('0x27')](function(){return _0x137d11;});}else{throw new db['Sequelize'][(_0x11f0('0x57'))]('Transcript\x20not\x20available');}})['then'](function(_0x13621b){return _0x2871b4[_0x11f0('0x50')](_0x13621b);})[_0x11f0('0x4d')](handleError(_0x2871b4));}; \ No newline at end of file +var _0xddcd=['Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','token','$and','push','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xddcd,0xa9));var _0xdddc=function(_0x1bc71d,_0x26e5f9){_0x1bc71d=_0x1bc71d-0x0;var _0x1c6acf=_0xddcd[_0x1bc71d];return _0x1c6acf;};'use strict';var pdf=require(_0xdddc('0x0'));var emlformat=require(_0xdddc('0x1'));var rimraf=require(_0xdddc('0x2'));var zipdir=require(_0xdddc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdddc('0x4'));var moment=require(_0xdddc('0x5'));var BPromise=require(_0xdddc('0x6'));var Mustache=require(_0xdddc('0x7'));var util=require(_0xdddc('0x8'));var path=require(_0xdddc('0x9'));var sox=require(_0xdddc('0xa'));var csv=require(_0xdddc('0xb'));var ejs=require(_0xdddc('0xc'));var fs=require('fs');var _=require(_0xdddc('0xd'));var squel=require(_0xdddc('0xe'));var crypto=require(_0xdddc('0xf'));var jsforce=require(_0xdddc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xdddc('0xb'));var querystring=require('querystring');var Papa=require(_0xdddc('0x11'));var AWS=require(_0xdddc('0x12'));var uuidv4=require(_0xdddc('0x13'));var Redis=require(_0xdddc('0x14'));var authService=require(_0xdddc('0x15'));var qs=require(_0xdddc('0x16'));var as=require(_0xdddc('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdddc('0x18'));var utils=require(_0xdddc('0x19'));var config=require(_0xdddc('0x1a'));var licenseUtil=require(_0xdddc('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eef6d,_0x5d44c8){_0x5d44c8=_0x5d44c8||0xcc;return function(_0x133aa5){if(_0x133aa5){return _0x1eef6d[_0xdddc('0x1c')](_0x5d44c8);}return _0x1eef6d[_0xdddc('0x1d')](_0x5d44c8)[_0xdddc('0x1e')]();};}function respondWithResult(_0x4b0d6d,_0x27d0a4){_0x27d0a4=_0x27d0a4||0xc8;return function(_0xd5bef6){if(_0xd5bef6){return _0x4b0d6d[_0xdddc('0x1d')](_0x27d0a4)[_0xdddc('0x1f')](_0xd5bef6);}};}function respondWithFilteredResult(_0x22a6c8,_0x57d4aa){return function(_0x4627d3){if(_0x4627d3){var _0x42837d=_0x4627d3[_0xdddc('0x20')],_0x1c51a3=_0x57d4aa[_0xdddc('0x21')],_0xcfdd6d=_0x57d4aa[_0xdddc('0x21')]+_0x57d4aa['limit'],_0x1ab0d1;if(_0xcfdd6d>=_0x42837d){_0xcfdd6d=_0x42837d;_0x1ab0d1=0xc8;}else{_0x1ab0d1=0xce;}_0x22a6c8['status'](_0x1ab0d1);return _0x22a6c8[_0xdddc('0x22')](_0xdddc('0x23'),_0x1c51a3+'-'+_0xcfdd6d+'/'+_0x42837d)[_0xdddc('0x1f')](_0x4627d3);}return null;};}function patchUpdates(_0x268171){return function(_0xf8c439){try{jsonpatch['apply'](_0xf8c439,_0x268171,!![]);}catch(_0x4ad834){return BPromise['reject'](_0x4ad834);}return _0xf8c439[_0xdddc('0x24')]();};}function saveUpdates(_0x3ca3f9,_0x4d756f){return function(_0x28cf22){if(_0x28cf22){return _0x28cf22[_0xdddc('0x25')](_0x3ca3f9)[_0xdddc('0x26')](function(_0x10ca65){return _0x10ca65;});}return null;};}function removeEntity(_0x2db5eb,_0x102485){return function(_0x469c6c){if(_0x469c6c){return _0x469c6c[_0xdddc('0x27')]()[_0xdddc('0x26')](function(){_0x2db5eb[_0xdddc('0x1d')](0xcc)[_0xdddc('0x1e')]();});}};}function handleEntityNotFound(_0x1fe053,_0x561fef){return function(_0x297e73){if(!_0x297e73){_0x1fe053[_0xdddc('0x1c')](0x194);}return _0x297e73;};}function handleError(_0x2977d0,_0x5e28f8){_0x5e28f8=_0x5e28f8||0x1f4;return function(_0x23c434){logger['error'](_0x23c434['stack']);if(_0x23c434[_0xdddc('0x28')]){delete _0x23c434[_0xdddc('0x28')];}_0x2977d0[_0xdddc('0x1d')](_0x5e28f8)[_0xdddc('0x29')](_0x23c434);};}exports[_0xdddc('0x2a')]=function(_0x24a064,_0x21e1ec){var _0x5ee820={},_0xd14f71={},_0x21f34d={'count':0x0,'rows':[]};var _0x2e925a=_['map'](db[_0xdddc('0x2b')][_0xdddc('0x2c')],function(_0x7ed2ff){return{'name':_0x7ed2ff[_0xdddc('0x2d')],'type':_0x7ed2ff['type'][_0xdddc('0x2e')]};});_0xd14f71[_0xdddc('0x2f')]=_[_0xdddc('0x30')](_['map'](_0x2e925a,_0xdddc('0x28')),[_0xdddc('0x31')]);_0xd14f71[_0xdddc('0x32')]=_[_0xdddc('0x33')](_0x24a064[_0xdddc('0x32')]);_0xd14f71[_0xdddc('0x34')]=_[_0xdddc('0x35')](_0xd14f71[_0xdddc('0x2f')],_0xd14f71[_0xdddc('0x32')]);_0x5ee820[_0xdddc('0x36')]=_[_0xdddc('0x35')](_0xd14f71[_0xdddc('0x2f')],qs[_0xdddc('0x37')](_0x24a064[_0xdddc('0x32')]['fields']));_0x5ee820[_0xdddc('0x36')]=_0x5ee820[_0xdddc('0x36')][_0xdddc('0x38')]?_0x5ee820[_0xdddc('0x36')]:_0xd14f71[_0xdddc('0x2f')];if(!_0x24a064[_0xdddc('0x32')][_0xdddc('0x39')](_0xdddc('0x3a'))){_0x5ee820[_0xdddc('0x3b')]=qs['limit'](_0x24a064[_0xdddc('0x32')][_0xdddc('0x3b')]);_0x5ee820[_0xdddc('0x21')]=qs[_0xdddc('0x21')](_0x24a064[_0xdddc('0x32')][_0xdddc('0x21')]);}_0x5ee820[_0xdddc('0x3c')]=qs['sort'](_0x24a064[_0xdddc('0x32')][_0xdddc('0x3d')]);_0x5ee820[_0xdddc('0x3e')]=qs[_0xdddc('0x34')](_[_0xdddc('0x3f')](_0x24a064[_0xdddc('0x32')],_0xd14f71[_0xdddc('0x34')]),_0x2e925a);if(_0x24a064['query'][_0xdddc('0x40')]){_0x5ee820[_0xdddc('0x3e')]=_['merge'](_0x5ee820[_0xdddc('0x3e')],{'$or':_[_0xdddc('0x41')](_0x2e925a,function(_0x26aca8){if(_0x26aca8[_0xdddc('0x42')]!==_0xdddc('0x43')){var _0x146d84={};_0x146d84[_0x26aca8[_0xdddc('0x28')]]={'$like':'%'+_0x24a064[_0xdddc('0x32')][_0xdddc('0x40')]+'%'};return _0x146d84;}})});}_0x5ee820=_[_0xdddc('0x44')]({},_0x5ee820,_0x24a064['options']);var _0x497f58={'where':_0x5ee820['where']};return db['VoiceRecording'][_0xdddc('0x20')](_0x497f58)[_0xdddc('0x26')](function(_0x4dbc63){_0x21f34d[_0xdddc('0x20')]=_0x4dbc63;if(_0x24a064['query'][_0xdddc('0x45')]){_0x5ee820['include']=[{'all':!![]}];}return db[_0xdddc('0x2b')][_0xdddc('0x46')](_0x5ee820);})[_0xdddc('0x26')](function(_0x1bf2a3){_0x21f34d[_0xdddc('0x47')]=_0x1bf2a3;return _0x21f34d;})[_0xdddc('0x26')](respondWithFilteredResult(_0x21e1ec,_0x5ee820))[_0xdddc('0x48')](handleError(_0x21e1ec,null));};exports[_0xdddc('0x49')]=function(_0x377e60,_0x170c7c){var _0x4136d7={'raw':![],'where':{'id':_0x377e60[_0xdddc('0x4a')]['id']}},_0x5d6c61={};_0x5d6c61[_0xdddc('0x2f')]=_[_0xdddc('0x33')](db['VoiceRecording'][_0xdddc('0x2c')]);_0x5d6c61['query']=_[_0xdddc('0x33')](_0x377e60['query']);_0x5d6c61['filters']=_[_0xdddc('0x35')](_0x5d6c61['model'],_0x5d6c61['query']);_0x4136d7[_0xdddc('0x36')]=_[_0xdddc('0x35')](_0x5d6c61[_0xdddc('0x2f')],qs[_0xdddc('0x37')](_0x377e60[_0xdddc('0x32')]['fields']));_0x4136d7[_0xdddc('0x36')]=_0x4136d7[_0xdddc('0x36')][_0xdddc('0x38')]?_0x4136d7[_0xdddc('0x36')]:_0x5d6c61['model'];if(_0x377e60[_0xdddc('0x32')][_0xdddc('0x45')]){_0x4136d7['include']=[{'all':!![]}];}_0x4136d7=_[_0xdddc('0x44')]({},_0x4136d7,_0x377e60[_0xdddc('0x4b')]);return db[_0xdddc('0x2b')][_0xdddc('0x4c')](_0x4136d7)[_0xdddc('0x26')](handleEntityNotFound(_0x170c7c,null))[_0xdddc('0x26')](respondWithResult(_0x170c7c,null))['catch'](handleError(_0x170c7c,null));};exports[_0xdddc('0x4d')]=function(_0x3073a7,_0x36ea2d){return db[_0xdddc('0x2b')][_0xdddc('0x4d')](_0x3073a7['body'],{})[_0xdddc('0x26')](respondWithResult(_0x36ea2d,0xc9))['catch'](handleError(_0x36ea2d,null));};exports[_0xdddc('0x25')]=function(_0x564a7f,_0x5b824e){if(_0x564a7f['body']['id']){delete _0x564a7f[_0xdddc('0x4e')]['id'];}return db['VoiceRecording'][_0xdddc('0x4c')]({'where':{'id':_0x564a7f[_0xdddc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b824e,null))[_0xdddc('0x26')](saveUpdates(_0x564a7f['body'],null))['then'](respondWithResult(_0x5b824e,null))[_0xdddc('0x48')](handleError(_0x5b824e,null));};exports[_0xdddc('0x4f')]=function(_0x246a17,_0x1168ef){return db[_0xdddc('0x2b')][_0xdddc('0x4f')]()[_0xdddc('0x26')](respondWithResult(_0x1168ef,null))[_0xdddc('0x48')](handleError(_0x1168ef,null));};exports[_0xdddc('0x50')]=function(_0xa02fb1,_0x38e128,_0x33a30c){var _0x427d13=require(_0xdddc('0x51'));var _0xbc7db9=![];var _0xe3430a={};if(_0xa02fb1[_0xdddc('0x32')][_0xdddc('0x42')]&&_0xa02fb1[_0xdddc('0x32')][_0xdddc('0x42')]===_0xdddc('0x52')){_0xe3430a[_0xdddc('0x52')]=_0xa02fb1['params']['id'];}else{_0xe3430a['id']=_0xa02fb1['params']['id'];}return db[_0xdddc('0x2b')][_0xdddc('0x4c')]({'where':_0xe3430a,'attributes':['id',_0xdddc('0x53')],'raw':!![]})[_0xdddc('0x26')](handleEntityNotFound(_0x38e128,null))[_0xdddc('0x26')](function(_0x2e71d8){if(_0x2e71d8){var _0x445cd5=_0x2e71d8[_0xdddc('0x53')];var _0x263828=util[_0xdddc('0x31')](_0xdddc('0x54'),_0x445cd5);if(fs[_0xdddc('0x55')](_0x263828)){_0xbc7db9=!![];return _0x427d13[_0xdddc('0x56')](_0x263828,_0x445cd5,config[_0xdddc('0x57')][_0xdddc('0x58')])[_0xdddc('0x26')](function(){return _0x2e71d8;});}return _0x2e71d8;}})[_0xdddc('0x26')](function(_0xcb61b2){if(_0xcb61b2){var _0x353340=_0xcb61b2['value'];if(!fs['existsSync'](_0x353340)){throw new db[(_0xdddc('0x59'))][(_0xdddc('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0xcb61b2[_0xdddc('0x5b')]){return _0x38e128[_0xdddc('0x50')](_0x353340,_0xcb61b2[_0xdddc('0x5b')]+path[_0xdddc('0x5c')](_0x353340),function(){if(_0xbc7db9){fs[_0xdddc('0x5d')](_0x353340);}});}else{return _0x38e128[_0xdddc('0x50')](_0x353340,function(_0x4722ff){if(_0xbc7db9){fs[_0xdddc('0x5d')](_0x353340);}});}}})['catch'](function(_0x911d51){if(_0x911d51[_0xdddc('0x5e')]===_0xdddc('0x5f')){_0x38e128[_0xdddc('0x1d')](0x194)['send'](_0xdddc('0x60'));}else{return handleError(_0x38e128,null);}});};exports[_0xdddc('0x61')]=function(_0xd0c712,_0x5c33b0,_0xacc725){var _0x43f61e=require(_0xdddc('0x51'));var _0x67025b=![];var _0x1f0388={'$and':[db[_0xdddc('0x62')][_0xdddc('0x3e')](db[_0xdddc('0x62')]['fn']('MD5',db[_0xdddc('0x62')]['col'](_0xdddc('0x52'))),_0xd0c712[_0xdddc('0x32')][_0xdddc('0x63')])]};if(_0xd0c712[_0xdddc('0x32')][_0xdddc('0x42')]&&_0xd0c712['query'][_0xdddc('0x42')]===_0xdddc('0x52')){_0x1f0388[_0xdddc('0x64')][_0xdddc('0x65')]({'uniqueid':_0xd0c712[_0xdddc('0x4a')]['id']});}else{_0x1f0388[_0xdddc('0x64')][_0xdddc('0x65')]({'id':_0xd0c712[_0xdddc('0x4a')]['id']});}return db['VoiceRecording'][_0xdddc('0x4c')]({'where':_0x1f0388,'attributes':['id',_0xdddc('0x53')],'raw':!![]})[_0xdddc('0x26')](handleEntityNotFound(_0x5c33b0,null))[_0xdddc('0x26')](function(_0x1d2bd9){if(_0x1d2bd9){var _0x127ac8=util[_0xdddc('0x31')](_0xdddc('0x54'),_0x1d2bd9['value']);if(fs[_0xdddc('0x55')](_0x127ac8)){_0x67025b=!![];return _0x43f61e[_0xdddc('0x56')](_0x127ac8,_0x1d2bd9[_0xdddc('0x53')],config[_0xdddc('0x57')][_0xdddc('0x58')])[_0xdddc('0x26')](function(){return _0x1d2bd9;});}return _0x1d2bd9;}})['then'](function(_0x8d3e66){if(_0x8d3e66){if(!fs[_0xdddc('0x55')](_0x8d3e66['value'])){throw new db['Sequelize'][(_0xdddc('0x5a'))](_0xdddc('0x5f'));}if(_0x8d3e66[_0xdddc('0x5b')]){return _0x5c33b0['download'](_0x8d3e66[_0xdddc('0x53')],_0x8d3e66[_0xdddc('0x5b')]+path[_0xdddc('0x5c')](_0x8d3e66['value']),function(){if(_0x67025b){fs[_0xdddc('0x5d')](_0x8d3e66[_0xdddc('0x53')]);}});}else{return _0x5c33b0[_0xdddc('0x50')](_0x8d3e66['value'],function(_0x1508c5){if(_0x67025b){fs[_0xdddc('0x5d')](_0x8d3e66[_0xdddc('0x53')]);}});}}})[_0xdddc('0x48')](handleError(_0x5c33b0,null));};exports[_0xdddc('0x27')]=function(_0x359254,_0x83e1c6){return db[_0xdddc('0x2b')][_0xdddc('0x4c')]({'where':{'id':_0x359254['params']['id']}})[_0xdddc('0x26')](function(_0x28daf9){if(!_0x28daf9)throw new ReferenceError(_0xdddc('0x66'));return _0x28daf9;})[_0xdddc('0x26')](function(_0x116175){var _0x3cbd41=_0x116175[_0xdddc('0x53')];logger['info'](_0xdddc('0x67'),_0x3cbd41);if(!_[_0xdddc('0x68')](_0x116175[_0xdddc('0x53')])&&fs[_0xdddc('0x55')](_0x3cbd41)){logger[_0xdddc('0x69')]('File:\x20\x22'+_0x3cbd41+_0xdddc('0x6a'));fs[_0xdddc('0x6b')](_0x3cbd41);}_0x3cbd41=_0x3cbd41+_0xdddc('0x6c');if(!_[_0xdddc('0x68')](_0x116175[_0xdddc('0x53')])&&fs['existsSync'](_0x3cbd41)){logger[_0xdddc('0x69')](_0xdddc('0x6d')+_0x3cbd41+_0xdddc('0x6a'));fs[_0xdddc('0x6b')](_0x3cbd41);}return _0x116175;})[_0xdddc('0x26')](function(_0x321abd){if(!_0x321abd)throw new InternalError();return _0x321abd[_0xdddc('0x27')]();})[_0xdddc('0x26')](function(){_0x83e1c6['status'](0xcc)[_0xdddc('0x1e')]();})[_0xdddc('0x48')](handleError(_0x83e1c6,null));};function getBucketslist(_0x5e71b7,_0x3e3a55,_0x181678){return new Promise(function(_0x12669,_0x3a0403){var _0xc06f06=new AWS['S3']({'accessKeyId':_0x3e3a55,'secretAccessKey':_0x5e71b7,'region':_0x181678});_0xc06f06[_0xdddc('0x6e')]({},function(_0x4f998a,_0x12ca9){if(_0x4f998a){return _0x3a0403(_0x4f998a);}else{return _0x12669(_0x12ca9);}});});}function createBucket(_0x5e5a41,_0x51791d,_0xe9e9d7,_0x593154){return new Promise(function(_0x479a5a,_0x4ddb48){var _0x34f3b9=new AWS['S3']({'accessKeyId':_0x51791d,'secretAccessKey':_0x5e5a41,'region':_0xe9e9d7});_0x34f3b9[_0xdddc('0x6f')]({'Bucket':_0x593154},function(_0x328250,_0x58f08d){if(_0x328250){return _0x4ddb48(_0x328250);}else{return _0x479a5a(_0x58f08d);}});});}function uploadFile(_0x1afcbd,_0x585026,_0x2ca49c,_0x3b652e,_0x398ad9,_0x4d9879){return new Promise(function(_0x409ff0,_0x531686){var _0x5ed809=new AWS['S3']({'accessKeyId':_0x585026,'secretAccessKey':_0x1afcbd,'region':_0x2ca49c});_0x5ed809['upload']({'Bucket':_0x3b652e,'Key':_0x398ad9,'Body':_0x4d9879},function(_0x5b3170,_0x4ddf05){if(_0x5b3170){return _0x531686(_0x5b3170);}else{return _0x409ff0(_0x4ddf05);}});});}function startTranscribe(_0x21abc5,_0x21186d,_0x4a8c4d,_0xc2eec1,_0x570e62,_0x4e46d2){return new Promise(function(_0x57dc9b,_0x5f46a0){var _0x487a6f=new AWS['TranscribeService']({'accessKeyId':_0x21186d,'secretAccessKey':_0x21abc5,'region':_0x4a8c4d});_0x487a6f[_0xdddc('0x70')]({'TranscriptionJobName':_0xc2eec1,'LanguageCode':_0x570e62,'Media':{'MediaFileUri':_0x4e46d2}},function(_0x168ccd,_0x591a69){if(_0x168ccd){return _0x5f46a0(_0x168ccd);}else{return _0x57dc9b(_0x591a69);}});});}function transcribe(_0x371f8a,_0x3776b4,_0x2a8882,_0x4c09e1,_0x5b7268,_0x2c98ca,_0x5e13c1){return new Promise(function(_0x383821,_0x54b445){var _0x1d0595={};logger[_0xdddc('0x69')](util[_0xdddc('0x31')](_0xdddc('0x71'),_0x371f8a,_0x5b7268));return uploadFile(_0x3776b4,_0x2a8882,_0x4c09e1,_0x5b7268,path['basename'](_0x2c98ca),fs[_0xdddc('0x72')](_0x2c98ca))[_0xdddc('0x26')](function(_0x94a675){logger[_0xdddc('0x69')](util[_0xdddc('0x31')](_0xdddc('0x73'),_0x371f8a,_0x5b7268,_0x94a675[_0xdddc('0x74')]));_0x1d0595[_0xdddc('0x75')]=_0x94a675[_0xdddc('0x76')];_0x1d0595[_0xdddc('0x77')]=_0x94a675[_0xdddc('0x74')];logger[_0xdddc('0x69')](util[_0xdddc('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x371f8a));return startTranscribe(_0x3776b4,_0x2a8882,_0x4c09e1,uuidv4(),_0x5e13c1,_0x94a675[_0xdddc('0x74')]);})[_0xdddc('0x26')](function(_0x1e8a5e){logger['info'](util['format'](_0xdddc('0x78'),_0x371f8a,_0x1e8a5e[_0xdddc('0x79')][_0xdddc('0x7a')]));_0x1d0595[_0xdddc('0x7b')]=_0x1e8a5e[_0xdddc('0x79')][_0xdddc('0x7a')];_0x1d0595['transcribeStatus']=_0x1e8a5e[_0xdddc('0x79')][_0xdddc('0x7c')];return _0x383821(_0x1d0595);})[_0xdddc('0x48')](function(_0x5b05c5){return _0x54b445(_0x5b05c5);});});}exports[_0xdddc('0x7d')]=function(_0x4a21c0,_0x31acc7,_0x27e22f){var _0x4b682d;var _0x4a57a0;var _0x310342;var _0x52a3d4=require(_0xdddc('0x51'));return db[_0xdddc('0x2b')]['findOne']({'where':{'id':_0x4a21c0['params']['id']}})[_0xdddc('0x26')](function(_0x98c4cb){if(_0x98c4cb){var _0x539e81=util['format'](_0xdddc('0x54'),_0x98c4cb[_0xdddc('0x53')]);if(fs['existsSync'](_0x539e81)){cypher=!![];return _0x52a3d4[_0xdddc('0x56')](_0x539e81,_0x98c4cb[_0xdddc('0x53')],config['secrets']['recording'])['then'](function(){return _0x98c4cb;});}return _0x98c4cb;}})[_0xdddc('0x26')](function(_0x130ed3){if(!_0x130ed3){throw new db[(_0xdddc('0x59'))][(_0xdddc('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x4a57a0=_0x130ed3;return db[_0xdddc('0x7e')]['findOne']({'where':{'id':0x1}});})[_0xdddc('0x26')](handleEntityNotFound(_0x31acc7,null))[_0xdddc('0x26')](function(_0x2ebc56){if(_0x2ebc56){_0x4b682d=_0x2ebc56;if(!_0x4b682d[_0xdddc('0x7f')]||!_0x4b682d[_0xdddc('0x80')]||!_0x4b682d[_0xdddc('0x81')]||!_0x4b682d[_0xdddc('0x82')]||!_0x4b682d[_0xdddc('0x75')]){throw new db['Sequelize']['ValidationError'](_0xdddc('0x83'));}if(_0x4a21c0['body']['runSentiment']&&(!_0x4b682d[_0xdddc('0x84')]||!_0x4b682d['sentimentAccountId']||!_0x4b682d[_0xdddc('0x85')]||!_0x4b682d[_0xdddc('0x82')]||!_0x4b682d[_0xdddc('0x75')])){throw new db[(_0xdddc('0x59'))]['ValidationError'](_0xdddc('0x86'));}return db[_0xdddc('0x87')][_0xdddc('0x88')]({'where':{'id':_0x4b682d[_0xdddc('0x80')]}});}})[_0xdddc('0x26')](function(_0x108244){if(!_0x108244){throw new db[(_0xdddc('0x59'))][(_0xdddc('0x5a'))](_0xdddc('0x89'));}if(!_0x108244[_0xdddc('0x8a')]||!_0x108244[_0xdddc('0x8b')]){throw new db[(_0xdddc('0x59'))][(_0xdddc('0x5a'))](_0xdddc('0x8c'));}_0x310342=_0x108244;return getBucketslist(_0x310342[_0xdddc('0x8a')],_0x310342['data2'],_0x4b682d[_0xdddc('0x81')]);})[_0xdddc('0x26')](function(_0x17f1ba){if(_0x17f1ba&&_0x17f1ba[_0xdddc('0x8d')]){var _0x5a7fe1=_['find'](_0x17f1ba[_0xdddc('0x8d')],function(_0x3477b8){return _0x3477b8[_0xdddc('0x8e')]===_0x4b682d['bucket'];});if(!_0x5a7fe1){logger[_0xdddc('0x69')](util[_0xdddc('0x31')](_0xdddc('0x8f'),_0x4a21c0[_0xdddc('0x4a')]['id'],_0x4b682d[_0xdddc('0x75')]));return createBucket(_0x310342[_0xdddc('0x8a')],_0x310342[_0xdddc('0x8b')],_0x4b682d[_0xdddc('0x81')],_0x4b682d[_0xdddc('0x75')]);}logger[_0xdddc('0x69')](util[_0xdddc('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4a21c0[_0xdddc('0x4a')]['id'],_0x4b682d[_0xdddc('0x75')]));return;}})['then'](function(_0x219770){if(_0x4a57a0[_0xdddc('0x90')]==='NEW'){return transcribe(_0x4a21c0[_0xdddc('0x4a')]['id'],_0x310342[_0xdddc('0x8a')],_0x310342[_0xdddc('0x8b')],_0x4b682d[_0xdddc('0x81')],_0x4b682d[_0xdddc('0x75')],_0x4a57a0[_0xdddc('0x53')],_0x4b682d['language']);}else{logger[_0xdddc('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4a21c0[_0xdddc('0x4a')]['id']));return{'transcribeStatus':_0xdddc('0x91')};}})[_0xdddc('0x26')](function(_0x42c4a5){if(_0x42c4a5){_0x42c4a5[_0xdddc('0x92')]=_0x4a21c0[_0xdddc('0x4e')]['runSentiment'];return _0x4a57a0[_0xdddc('0x93')](_0x42c4a5);}})[_0xdddc('0x26')](respondWithResult(_0x31acc7,null))[_0xdddc('0x48')](handleError(_0x31acc7,null));};function writeFile(_0x8e68b2,_0x3b8d4b){return new Promise(function(_0x3a5816,_0x59c27d){fs[_0xdddc('0x94')](_0x3b8d4b,_0x8e68b2,function(_0x4b45b7,_0x45895b){if(_0x4b45b7){return _0x59c27d(_0x4b45b7);}else{return _0x3a5816(_0x45895b);}});});}exports[_0xdddc('0x95')]=function(_0x3e76c5,_0x479be9,_0x5d5d07){return db[_0xdddc('0x2b')][_0xdddc('0x88')]({'where':{'id':_0x3e76c5['params']['id']}})[_0xdddc('0x26')](handleEntityNotFound(_0x479be9))[_0xdddc('0x26')](function(_0x2c8833){if(_0x2c8833&&_0x2c8833[_0xdddc('0x96')]){var _0x51b558=_0x2c8833['fileText'];var _0x1a545a=config[_0xdddc('0x97')]+_0xdddc('0x98')+_0x2c8833['id']+_0xdddc('0x99');if(fs[_0xdddc('0x55')](_0x1a545a)){return _0x1a545a;}return writeFile(_0x51b558,_0x1a545a)[_0xdddc('0x26')](function(){return _0x1a545a;});}else{throw new db[(_0xdddc('0x59'))][(_0xdddc('0x5a'))](_0xdddc('0x9a'));}})['then'](function(_0x179c99){return _0x479be9[_0xdddc('0x50')](_0x179c99);})[_0xdddc('0x48')](handleError(_0x479be9));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c9a3327..c2af320 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 _0xaaa5=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaaa5,0xf6));var _0x5aaa=function(_0xbd28ab,_0x27e80d){_0xbd28ab=_0xbd28ab-0x0;var _0x1dd87c=_0xaaa5[_0xbd28ab];return _0x1dd87c;};'use strict';var _=require('lodash');var util=require(_0x5aaa('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5aaa('0x1'));var BPromise=require(_0x5aaa('0x2'));var rp=require(_0x5aaa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5aaa('0x4'));var config=require(_0x5aaa('0x5'));var attributes=require(_0x5aaa('0x6'));module[_0x5aaa('0x7')]=function(_0x3fe4d4,_0x1cd5af){return _0x3fe4d4[_0x5aaa('0x8')](_0x5aaa('0x9'),attributes,{'tableName':_0x5aaa('0xa'),'paranoid':![],'indexes':[{'name':_0x5aaa('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed53=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x181a3d,_0x5b9211){var _0x1c8483=function(_0x4c4175){while(--_0x4c4175){_0x181a3d['push'](_0x181a3d['shift']());}};_0x1c8483(++_0x5b9211);}(_0xed53,0x1b2));var _0x3ed5=function(_0x2a1e2d,_0x1669e9){_0x2a1e2d=_0x2a1e2d-0x0;var _0x500b95=_0xed53[_0x2a1e2d];return _0x500b95;};'use strict';var _=require(_0x3ed5('0x0'));var util=require(_0x3ed5('0x1'));var logger=require(_0x3ed5('0x2'))(_0x3ed5('0x3'));var moment=require(_0x3ed5('0x4'));var BPromise=require(_0x3ed5('0x5'));var rp=require(_0x3ed5('0x6'));var fs=require('fs');var path=require(_0x3ed5('0x7'));var rimraf=require('rimraf');var config=require(_0x3ed5('0x8'));var attributes=require(_0x3ed5('0x9'));module['exports']=function(_0x43db13,_0x187f5c){return _0x43db13[_0x3ed5('0xa')](_0x3ed5('0xb'),attributes,{'tableName':_0x3ed5('0xc'),'paranoid':![],'indexes':[{'name':_0x3ed5('0xd'),'fields':[_0x3ed5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 3e7a207..6cd4af3 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x395b58,_0x23518d){var _0x43c80a=function(_0x4f5687){while(--_0x4f5687){_0x395b58['push'](_0x395b58['shift']());}};_0x43c80a(++_0x23518d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4c2cd2,_0x280f2a){var _0x28fc7a=function(_0x4f96c1){while(--_0x4f96c1){_0x4c2cd2['push'](_0x4c2cd2['shift']());}};_0x28fc7a(++_0x280f2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 191d0ca..437786b 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 _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x37db64,_0x462c99){_0x37db64=_0x37db64-0x0;var _0x340333=_0xc6ac[_0x37db64];return _0x340333;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x2542,0x169));var _0x2254=function(_0x1e6d68,_0x42f4c3){_0x1e6d68=_0x1e6d68-0x0;var _0x15fe66=_0x2542[_0x1e6d68];return _0x15fe66;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 70fd524..1826f92 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 _0x6d5b=['STRING','ENUM','Yes','sequelize','exports','blind'];(function(_0x7ad065,_0x3b9005){var _0x591984=function(_0x4a4e6a){while(--_0x4a4e6a){_0x7ad065['push'](_0x7ad065['shift']());}};_0x591984(++_0x3b9005);}(_0x6d5b,0x8d));var _0xb6d5=function(_0x35779b,_0x4d5e22){_0x35779b=_0x35779b-0x0;var _0x441486=_0x6d5b[_0x35779b];return _0x441486;};'use strict';var Sequelize=require(_0xb6d5('0x0'));var moment=require('moment');module[_0xb6d5('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb6d5('0x2'),'attended')},'result':{'type':Sequelize[_0xb6d5('0x3')]},'transfererchannel':{'type':Sequelize[_0xb6d5('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xb6d5('0x3')]},'transferercalleridname':{'type':Sequelize[_0xb6d5('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb6d5('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xb6d5('0x3')]},'transferercontext':{'type':Sequelize[_0xb6d5('0x3')]},'transfererexten':{'type':Sequelize[_0xb6d5('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xb6d5('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb6d5('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb6d5('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xb6d5('0x3')]},'transfereeexten':{'type':Sequelize[_0xb6d5('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xb6d5('0x4')](_0xb6d5('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7e9d=['STRING','ENUM','Yes','exports'];(function(_0x24de9f,_0x228cac){var _0x1de54b=function(_0x1e92c9){while(--_0x1e92c9){_0x24de9f['push'](_0x24de9f['shift']());}};_0x1de54b(++_0x228cac);}(_0x7e9d,0x9f));var _0xd7e9=function(_0x49d68e,_0x2a239e){_0x49d68e=_0x49d68e-0x0;var _0x5ea081=_0x7e9d[_0x49d68e];return _0x5ea081;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd7e9('0x0')]={'type':{'type':Sequelize['ENUM']('blind','attended')},'result':{'type':Sequelize[_0xd7e9('0x1')]},'transfererchannel':{'type':Sequelize[_0xd7e9('0x1')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xd7e9('0x1')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xd7e9('0x1')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xd7e9('0x1')]},'transfererlinkedid':{'type':Sequelize[_0xd7e9('0x1')]},'transfereechannel':{'type':Sequelize[_0xd7e9('0x1')]},'transfereecalleridnum':{'type':Sequelize[_0xd7e9('0x1')]},'transfereecalleridname':{'type':Sequelize[_0xd7e9('0x1')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd7e9('0x1')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd7e9('0x1')]},'transfereeaccountcode':{'type':Sequelize[_0xd7e9('0x1')]},'transfereecontext':{'type':Sequelize[_0xd7e9('0x1')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xd7e9('0x2')](_0xd7e9('0x3'),'No')},'context':{'type':Sequelize[_0xd7e9('0x1')]},'extension':{'type':Sequelize[_0xd7e9('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e45118d..2728ccc 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 _0xa728=['keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','options','includeAll','include','rows','show','params','merge','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0xa728,0x18d));var _0x8a72=function(_0x4fced0,_0x3616c5){_0x4fced0=_0x4fced0-0x0;var _0x25686c=_0xa728[_0x4fced0];return _0x25686c;};'use strict';var pdf=require(_0x8a72('0x0'));var emlformat=require(_0x8a72('0x1'));var rimraf=require(_0x8a72('0x2'));var zipdir=require(_0x8a72('0x3'));var jsonpatch=require(_0x8a72('0x4'));var rp=require(_0x8a72('0x5'));var moment=require(_0x8a72('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8a72('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8a72('0x8'));var csv=require(_0x8a72('0x9'));var ejs=require(_0x8a72('0xa'));var fs=require('fs');var _=require(_0x8a72('0xb'));var squel=require(_0x8a72('0xc'));var crypto=require(_0x8a72('0xd'));var jsforce=require(_0x8a72('0xe'));var deskjs=require(_0x8a72('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8a72('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a72('0x11'));var authService=require(_0x8a72('0x12'));var qs=require(_0x8a72('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a72('0x14'));var logger=require(_0x8a72('0x15'))(_0x8a72('0x16'));var utils=require(_0x8a72('0x17'));var config=require(_0x8a72('0x18'));var licenseUtil=require(_0x8a72('0x19'));var db=require(_0x8a72('0x1a'))['db'];function respondWithStatusCode(_0xb59985,_0x27db93){_0x27db93=_0x27db93||0xcc;return function(_0x45b612){if(_0x45b612){return _0xb59985[_0x8a72('0x1b')](_0x27db93);}return _0xb59985[_0x8a72('0x1c')](_0x27db93)[_0x8a72('0x1d')]();};}function respondWithResult(_0x2469f1,_0x35e25e){_0x35e25e=_0x35e25e||0xc8;return function(_0x20822f){if(_0x20822f){return _0x2469f1[_0x8a72('0x1c')](_0x35e25e)['json'](_0x20822f);}};}function respondWithFilteredResult(_0x9345db,_0x5000d6){return function(_0x3acc5d){if(_0x3acc5d){var _0x5e55c6=_0x3acc5d[_0x8a72('0x1e')],_0x36c8ae=_0x5000d6[_0x8a72('0x1f')],_0x5542ac=_0x5000d6[_0x8a72('0x1f')]+_0x5000d6[_0x8a72('0x20')],_0x13af26;if(_0x5542ac>=_0x5e55c6){_0x5542ac=_0x5e55c6;_0x13af26=0xc8;}else{_0x13af26=0xce;}_0x9345db[_0x8a72('0x1c')](_0x13af26);return _0x9345db['set'](_0x8a72('0x21'),_0x36c8ae+'-'+_0x5542ac+'/'+_0x5e55c6)[_0x8a72('0x22')](_0x3acc5d);}return null;};}function patchUpdates(_0x5e0366){return function(_0x3220eb){try{jsonpatch[_0x8a72('0x23')](_0x3220eb,_0x5e0366,!![]);}catch(_0x15a908){return BPromise[_0x8a72('0x24')](_0x15a908);}return _0x3220eb[_0x8a72('0x25')]();};}function saveUpdates(_0x344896,_0x516a74){return function(_0xc741cc){if(_0xc741cc){return _0xc741cc[_0x8a72('0x26')](_0x344896)[_0x8a72('0x27')](function(_0x3dfcf6){return _0x3dfcf6;});}return null;};}function removeEntity(_0x57bf29,_0x30b640){return function(_0x40b567){if(_0x40b567){return _0x40b567[_0x8a72('0x28')]()['then'](function(){_0x57bf29[_0x8a72('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5b91,_0x2dc19b){return function(_0x4100d7){if(!_0x4100d7){_0x1a5b91[_0x8a72('0x1b')](0x194);}return _0x4100d7;};}function handleError(_0x54075a,_0x27a2a8){_0x27a2a8=_0x27a2a8||0x1f4;return function(_0x217636){logger[_0x8a72('0x29')](_0x217636['stack']);if(_0x217636[_0x8a72('0x2a')]){delete _0x217636[_0x8a72('0x2a')];}_0x54075a['status'](_0x27a2a8)[_0x8a72('0x2b')](_0x217636);};}exports[_0x8a72('0x2c')]=function(_0x282ad5,_0xec0554){var _0x5d8ba8={},_0x4084c0={},_0x23176a={'count':0x0,'rows':[]};var _0x4e771c=_[_0x8a72('0x2d')](db[_0x8a72('0x2e')][_0x8a72('0x2f')],function(_0x5106c0){return{'name':_0x5106c0[_0x8a72('0x30')],'type':_0x5106c0[_0x8a72('0x31')][_0x8a72('0x32')]};});_0x4084c0[_0x8a72('0x33')]=_[_0x8a72('0x2d')](_0x4e771c,_0x8a72('0x2a'));_0x4084c0[_0x8a72('0x34')]=_[_0x8a72('0x35')](_0x282ad5[_0x8a72('0x34')]);_0x4084c0[_0x8a72('0x36')]=_[_0x8a72('0x37')](_0x4084c0[_0x8a72('0x33')],_0x4084c0[_0x8a72('0x34')]);_0x5d8ba8['attributes']=_[_0x8a72('0x37')](_0x4084c0[_0x8a72('0x33')],qs[_0x8a72('0x38')](_0x282ad5[_0x8a72('0x34')][_0x8a72('0x38')]));_0x5d8ba8[_0x8a72('0x39')]=_0x5d8ba8[_0x8a72('0x39')][_0x8a72('0x3a')]?_0x5d8ba8['attributes']:_0x4084c0[_0x8a72('0x33')];if(!_0x282ad5['query']['hasOwnProperty'](_0x8a72('0x3b'))){_0x5d8ba8[_0x8a72('0x20')]=qs[_0x8a72('0x20')](_0x282ad5[_0x8a72('0x34')][_0x8a72('0x20')]);_0x5d8ba8[_0x8a72('0x1f')]=qs['offset'](_0x282ad5[_0x8a72('0x34')]['offset']);}_0x5d8ba8[_0x8a72('0x3c')]=qs[_0x8a72('0x3d')](_0x282ad5[_0x8a72('0x34')][_0x8a72('0x3d')]);_0x5d8ba8[_0x8a72('0x3e')]=qs['filters'](_[_0x8a72('0x3f')](_0x282ad5[_0x8a72('0x34')],_0x4084c0['filters']),_0x4e771c);if(_0x282ad5[_0x8a72('0x34')]['filter']){_0x5d8ba8['where']=_['merge'](_0x5d8ba8[_0x8a72('0x3e')],{'$or':_['map'](_0x4e771c,function(_0x761448){if(_0x761448[_0x8a72('0x31')]!=='VIRTUAL'){var _0x44741b={};_0x44741b[_0x761448[_0x8a72('0x2a')]]={'$like':'%'+_0x282ad5[_0x8a72('0x34')]['filter']+'%'};return _0x44741b;}})});}_0x5d8ba8=_['merge']({},_0x5d8ba8,_0x282ad5[_0x8a72('0x40')]);var _0x2a3f4f={'where':_0x5d8ba8['where']};return db[_0x8a72('0x2e')][_0x8a72('0x1e')](_0x2a3f4f)['then'](function(_0x5a3469){_0x23176a['count']=_0x5a3469;if(_0x282ad5[_0x8a72('0x34')][_0x8a72('0x41')]){_0x5d8ba8[_0x8a72('0x42')]=[{'all':!![]}];}return db[_0x8a72('0x2e')]['findAll'](_0x5d8ba8);})[_0x8a72('0x27')](function(_0x128e90){_0x23176a[_0x8a72('0x43')]=_0x128e90;return _0x23176a;})['then'](respondWithFilteredResult(_0xec0554,_0x5d8ba8))['catch'](handleError(_0xec0554,null));};exports[_0x8a72('0x44')]=function(_0x5c1ea2,_0x4881d9){var _0x16b9ce={'raw':!![],'where':{'id':_0x5c1ea2[_0x8a72('0x45')]['id']}},_0x29ff17={};_0x29ff17[_0x8a72('0x33')]=_[_0x8a72('0x35')](db[_0x8a72('0x2e')][_0x8a72('0x2f')]);_0x29ff17[_0x8a72('0x34')]=_['keys'](_0x5c1ea2['query']);_0x29ff17[_0x8a72('0x36')]=_[_0x8a72('0x37')](_0x29ff17[_0x8a72('0x33')],_0x29ff17[_0x8a72('0x34')]);_0x16b9ce[_0x8a72('0x39')]=_[_0x8a72('0x37')](_0x29ff17[_0x8a72('0x33')],qs[_0x8a72('0x38')](_0x5c1ea2[_0x8a72('0x34')]['fields']));_0x16b9ce[_0x8a72('0x39')]=_0x16b9ce[_0x8a72('0x39')][_0x8a72('0x3a')]?_0x16b9ce[_0x8a72('0x39')]:_0x29ff17[_0x8a72('0x33')];if(_0x5c1ea2[_0x8a72('0x34')][_0x8a72('0x41')]){_0x16b9ce[_0x8a72('0x42')]=[{'all':!![]}];}_0x16b9ce=_[_0x8a72('0x46')]({},_0x16b9ce,_0x5c1ea2[_0x8a72('0x40')]);return db['VoiceTransferReport'][_0x8a72('0x47')](_0x16b9ce)[_0x8a72('0x27')](handleEntityNotFound(_0x4881d9,null))[_0x8a72('0x27')](respondWithResult(_0x4881d9,null))[_0x8a72('0x48')](handleError(_0x4881d9,null));};exports[_0x8a72('0x49')]=function(_0x1cb596,_0x1f9718){return db[_0x8a72('0x2e')]['create'](_0x1cb596['body'],{})['then'](respondWithResult(_0x1f9718,0xc9))[_0x8a72('0x48')](handleError(_0x1f9718,null));};exports[_0x8a72('0x26')]=function(_0x507e4e,_0xc1aa30){if(_0x507e4e[_0x8a72('0x4a')]['id']){delete _0x507e4e[_0x8a72('0x4a')]['id'];}return db[_0x8a72('0x2e')][_0x8a72('0x47')]({'where':{'id':_0x507e4e[_0x8a72('0x45')]['id']}})['then'](handleEntityNotFound(_0xc1aa30,null))[_0x8a72('0x27')](saveUpdates(_0x507e4e['body'],null))['then'](respondWithResult(_0xc1aa30,null))[_0x8a72('0x48')](handleError(_0xc1aa30,null));};exports[_0x8a72('0x28')]=function(_0xc9b71b,_0x15ac96){return db[_0x8a72('0x2e')][_0x8a72('0x47')]({'where':{'id':_0xc9b71b[_0x8a72('0x45')]['id']}})['then'](handleEntityNotFound(_0x15ac96,null))['then'](removeEntity(_0x15ac96,null))['catch'](handleError(_0x15ac96,null));}; \ No newline at end of file +var _0x88b7=['find','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','count','includeAll','include','findAll','rows','catch','show','intersection'];(function(_0x4cd733,_0x43d616){var _0x47290a=function(_0x22b57b){while(--_0x22b57b){_0x4cd733['push'](_0x4cd733['shift']());}};_0x47290a(++_0x43d616);}(_0x88b7,0x13f));var _0x788b=function(_0x278e80,_0x17bcc9){_0x278e80=_0x278e80-0x0;var _0x13f0d7=_0x88b7[_0x278e80];return _0x13f0d7;};'use strict';var pdf=require(_0x788b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x788b('0x1'));var zipdir=require(_0x788b('0x2'));var jsonpatch=require(_0x788b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x788b('0x4'));var util=require(_0x788b('0x5'));var path=require(_0x788b('0x6'));var sox=require(_0x788b('0x7'));var csv=require(_0x788b('0x8'));var ejs=require(_0x788b('0x9'));var fs=require('fs');var _=require(_0x788b('0xa'));var squel=require(_0x788b('0xb'));var crypto=require(_0x788b('0xc'));var jsforce=require(_0x788b('0xd'));var deskjs=require(_0x788b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x788b('0xf'));var Papa=require(_0x788b('0x10'));var Redis=require(_0x788b('0x11'));var authService=require(_0x788b('0x12'));var qs=require(_0x788b('0x13'));var as=require(_0x788b('0x14'));var hardwareService=require(_0x788b('0x15'));var logger=require(_0x788b('0x16'))(_0x788b('0x17'));var utils=require('../../config/utils');var config=require(_0x788b('0x18'));var licenseUtil=require(_0x788b('0x19'));var db=require(_0x788b('0x1a'))['db'];function respondWithStatusCode(_0xdfba6d,_0xddabaf){_0xddabaf=_0xddabaf||0xcc;return function(_0x5b4daf){if(_0x5b4daf){return _0xdfba6d[_0x788b('0x1b')](_0xddabaf);}return _0xdfba6d[_0x788b('0x1c')](_0xddabaf)[_0x788b('0x1d')]();};}function respondWithResult(_0x3deaae,_0x349603){_0x349603=_0x349603||0xc8;return function(_0x28b95a){if(_0x28b95a){return _0x3deaae[_0x788b('0x1c')](_0x349603)[_0x788b('0x1e')](_0x28b95a);}};}function respondWithFilteredResult(_0x8bdd22,_0x5e8299){return function(_0x9edee9){if(_0x9edee9){var _0x42080c=_0x9edee9['count'],_0x32789d=_0x5e8299[_0x788b('0x1f')],_0x5ded52=_0x5e8299[_0x788b('0x1f')]+_0x5e8299[_0x788b('0x20')],_0x9ce17f;if(_0x5ded52>=_0x42080c){_0x5ded52=_0x42080c;_0x9ce17f=0xc8;}else{_0x9ce17f=0xce;}_0x8bdd22['status'](_0x9ce17f);return _0x8bdd22[_0x788b('0x21')](_0x788b('0x22'),_0x32789d+'-'+_0x5ded52+'/'+_0x42080c)[_0x788b('0x1e')](_0x9edee9);}return null;};}function patchUpdates(_0x48ce5a){return function(_0x3e4c58){try{jsonpatch[_0x788b('0x23')](_0x3e4c58,_0x48ce5a,!![]);}catch(_0x4db890){return BPromise[_0x788b('0x24')](_0x4db890);}return _0x3e4c58[_0x788b('0x25')]();};}function saveUpdates(_0x502b4b,_0x5863ed){return function(_0x96504f){if(_0x96504f){return _0x96504f[_0x788b('0x26')](_0x502b4b)['then'](function(_0xc71202){return _0xc71202;});}return null;};}function removeEntity(_0x38453f,_0x147224){return function(_0x35ebab){if(_0x35ebab){return _0x35ebab[_0x788b('0x27')]()['then'](function(){_0x38453f[_0x788b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0c19,_0x26277c){return function(_0x217f79){if(!_0x217f79){_0x3a0c19[_0x788b('0x1b')](0x194);}return _0x217f79;};}function handleError(_0x418465,_0x350027){_0x350027=_0x350027||0x1f4;return function(_0x5ade84){logger['error'](_0x5ade84[_0x788b('0x28')]);if(_0x5ade84[_0x788b('0x29')]){delete _0x5ade84[_0x788b('0x29')];}_0x418465[_0x788b('0x1c')](_0x350027)[_0x788b('0x2a')](_0x5ade84);};}exports[_0x788b('0x2b')]=function(_0x218716,_0x57e80f){var _0x36aab0={},_0x1dbeda={},_0x137a24={'count':0x0,'rows':[]};var _0x54ab50=_[_0x788b('0x2c')](db[_0x788b('0x2d')][_0x788b('0x2e')],function(_0x4483c1){return{'name':_0x4483c1[_0x788b('0x2f')],'type':_0x4483c1[_0x788b('0x30')][_0x788b('0x31')]};});_0x1dbeda['model']=_[_0x788b('0x2c')](_0x54ab50,_0x788b('0x29'));_0x1dbeda[_0x788b('0x32')]=_[_0x788b('0x33')](_0x218716[_0x788b('0x32')]);_0x1dbeda[_0x788b('0x34')]=_['intersection'](_0x1dbeda[_0x788b('0x35')],_0x1dbeda[_0x788b('0x32')]);_0x36aab0[_0x788b('0x36')]=_['intersection'](_0x1dbeda[_0x788b('0x35')],qs[_0x788b('0x37')](_0x218716[_0x788b('0x32')][_0x788b('0x37')]));_0x36aab0[_0x788b('0x36')]=_0x36aab0['attributes'][_0x788b('0x38')]?_0x36aab0[_0x788b('0x36')]:_0x1dbeda[_0x788b('0x35')];if(!_0x218716['query'][_0x788b('0x39')](_0x788b('0x3a'))){_0x36aab0['limit']=qs[_0x788b('0x20')](_0x218716[_0x788b('0x32')][_0x788b('0x20')]);_0x36aab0[_0x788b('0x1f')]=qs[_0x788b('0x1f')](_0x218716[_0x788b('0x32')][_0x788b('0x1f')]);}_0x36aab0[_0x788b('0x3b')]=qs[_0x788b('0x3c')](_0x218716[_0x788b('0x32')][_0x788b('0x3c')]);_0x36aab0['where']=qs[_0x788b('0x34')](_[_0x788b('0x3d')](_0x218716['query'],_0x1dbeda['filters']),_0x54ab50);if(_0x218716[_0x788b('0x32')][_0x788b('0x3e')]){_0x36aab0['where']=_['merge'](_0x36aab0[_0x788b('0x3f')],{'$or':_[_0x788b('0x2c')](_0x54ab50,function(_0x41740c){if(_0x41740c[_0x788b('0x30')]!==_0x788b('0x40')){var _0x480de1={};_0x480de1[_0x41740c[_0x788b('0x29')]]={'$like':'%'+_0x218716['query'][_0x788b('0x3e')]+'%'};return _0x480de1;}})});}_0x36aab0=_[_0x788b('0x41')]({},_0x36aab0,_0x218716[_0x788b('0x42')]);var _0x245087={'where':_0x36aab0[_0x788b('0x3f')]};return db[_0x788b('0x2d')]['count'](_0x245087)[_0x788b('0x43')](function(_0x10e27c){_0x137a24[_0x788b('0x44')]=_0x10e27c;if(_0x218716['query'][_0x788b('0x45')]){_0x36aab0[_0x788b('0x46')]=[{'all':!![]}];}return db[_0x788b('0x2d')][_0x788b('0x47')](_0x36aab0);})[_0x788b('0x43')](function(_0x2df5a3){_0x137a24[_0x788b('0x48')]=_0x2df5a3;return _0x137a24;})[_0x788b('0x43')](respondWithFilteredResult(_0x57e80f,_0x36aab0))[_0x788b('0x49')](handleError(_0x57e80f,null));};exports[_0x788b('0x4a')]=function(_0x5b2cc9,_0x359538){var _0x2356ef={'raw':!![],'where':{'id':_0x5b2cc9['params']['id']}},_0x49700d={};_0x49700d[_0x788b('0x35')]=_[_0x788b('0x33')](db[_0x788b('0x2d')]['rawAttributes']);_0x49700d[_0x788b('0x32')]=_[_0x788b('0x33')](_0x5b2cc9[_0x788b('0x32')]);_0x49700d['filters']=_[_0x788b('0x4b')](_0x49700d[_0x788b('0x35')],_0x49700d['query']);_0x2356ef[_0x788b('0x36')]=_[_0x788b('0x4b')](_0x49700d[_0x788b('0x35')],qs['fields'](_0x5b2cc9[_0x788b('0x32')][_0x788b('0x37')]));_0x2356ef['attributes']=_0x2356ef[_0x788b('0x36')][_0x788b('0x38')]?_0x2356ef['attributes']:_0x49700d[_0x788b('0x35')];if(_0x5b2cc9[_0x788b('0x32')][_0x788b('0x45')]){_0x2356ef[_0x788b('0x46')]=[{'all':!![]}];}_0x2356ef=_['merge']({},_0x2356ef,_0x5b2cc9[_0x788b('0x42')]);return db[_0x788b('0x2d')][_0x788b('0x4c')](_0x2356ef)[_0x788b('0x43')](handleEntityNotFound(_0x359538,null))[_0x788b('0x43')](respondWithResult(_0x359538,null))[_0x788b('0x49')](handleError(_0x359538,null));};exports['create']=function(_0x1f28e8,_0x166e2f){return db[_0x788b('0x2d')]['create'](_0x1f28e8['body'],{})[_0x788b('0x43')](respondWithResult(_0x166e2f,0xc9))[_0x788b('0x49')](handleError(_0x166e2f,null));};exports[_0x788b('0x26')]=function(_0xfac483,_0x6c06f0){if(_0xfac483[_0x788b('0x4d')]['id']){delete _0xfac483[_0x788b('0x4d')]['id'];}return db[_0x788b('0x2d')]['find']({'where':{'id':_0xfac483[_0x788b('0x4e')]['id']}})[_0x788b('0x43')](handleEntityNotFound(_0x6c06f0,null))[_0x788b('0x43')](saveUpdates(_0xfac483[_0x788b('0x4d')],null))[_0x788b('0x43')](respondWithResult(_0x6c06f0,null))[_0x788b('0x49')](handleError(_0x6c06f0,null));};exports[_0x788b('0x27')]=function(_0x2153e4,_0x540b2c){return db[_0x788b('0x2d')]['find']({'where':{'id':_0x2153e4['params']['id']}})[_0x788b('0x43')](handleEntityNotFound(_0x540b2c,null))[_0x788b('0x43')](removeEntity(_0x540b2c,null))['catch'](handleError(_0x540b2c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ed83aa4..72e6aad 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 _0x7a3d=['define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird','path','./voiceTransferReport.attributes','exports'];(function(_0x541817,_0x42ce68){var _0x46a287=function(_0x2e1a1b){while(--_0x2e1a1b){_0x541817['push'](_0x541817['shift']());}};_0x46a287(++_0x42ce68);}(_0x7a3d,0x1d1));var _0xd7a3=function(_0x70c986,_0x26a280){_0x70c986=_0x70c986-0x0;var _0x586bfd=_0x7a3d[_0x70c986];return _0x586bfd;};'use strict';var _=require('lodash');var util=require(_0xd7a3('0x0'));var logger=require(_0xd7a3('0x1'))(_0xd7a3('0x2'));var moment=require(_0xd7a3('0x3'));var BPromise=require(_0xd7a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7a3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd7a3('0x6'));module[_0xd7a3('0x7')]=function(_0x3e862a,_0x4104ab){return _0x3e862a[_0xd7a3('0x8')](_0xd7a3('0x9'),attributes,{'tableName':_0xd7a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe9d=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','lodash','util','../../config/logger','api','moment'];(function(_0x2b0283,_0x58f0ff){var _0x1eff96=function(_0x12506f){while(--_0x12506f){_0x2b0283['push'](_0x2b0283['shift']());}};_0x1eff96(++_0x58f0ff);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x5870a2,_0x530208){_0x5870a2=_0x5870a2-0x0;var _0x2b3944=_0xfe9d[_0x5870a2];return _0x2b3944;};'use strict';var _=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var logger=require(_0xdfe9('0x2'))(_0xdfe9('0x3'));var moment=require(_0xdfe9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdfe9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfe9('0x6'));var config=require(_0xdfe9('0x7'));var attributes=require(_0xdfe9('0x8'));module[_0xdfe9('0x9')]=function(_0xeb5238,_0x582904){return _0xeb5238['define'](_0xdfe9('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 56d9cd4..735cfd1 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 _0x6df5=['create','body','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceTransferReport'];(function(_0x53184a,_0x44484d){var _0xfcb92c=function(_0x3d0afa){while(--_0x3d0afa){_0x53184a['push'](_0x53184a['shift']());}};_0xfcb92c(++_0x44484d);}(_0x6df5,0xa6));var _0x56df=function(_0x1aab9d,_0x503b9e){_0x1aab9d=_0x1aab9d-0x0;var _0x3840b2=_0x6df5[_0x1aab9d];return _0x3840b2;};'use strict';var _=require(_0x56df('0x0'));var util=require(_0x56df('0x1'));var moment=require(_0x56df('0x2'));var BPromise=require(_0x56df('0x3'));var rs=require(_0x56df('0x4'));var fs=require('fs');var Redis=require(_0x56df('0x5'));var db=require(_0x56df('0x6'))['db'];var utils=require(_0x56df('0x7'));var logger=require(_0x56df('0x8'))(_0x56df('0x9'));var config=require(_0x56df('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f20ca,_0x3eebec,_0x32e1de){return new BPromise(function(_0x1fda61,_0x89c34c){return client[_0x56df('0xc')](_0x4f20ca,_0x32e1de)[_0x56df('0xd')](function(_0x451065){logger[_0x56df('0xe')](_0x56df('0xf'),_0x3eebec,'request\x20sent');logger[_0x56df('0x10')](_0x56df('0x11'),_0x3eebec,'request\x20sent',JSON['stringify'](_0x451065));if(_0x451065['error']){if(_0x451065['error']['code']===0x1f4){logger[_0x56df('0x12')](_0x56df('0xf'),_0x3eebec,_0x451065['error'][_0x56df('0x13')]);return _0x89c34c(_0x451065['error'][_0x56df('0x13')]);}logger[_0x56df('0x12')](_0x56df('0xf'),_0x3eebec,_0x451065[_0x56df('0x12')]['message']);return _0x1fda61(_0x451065['error']['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x3eebec,'request\x20sent');_0x1fda61(_0x451065[_0x56df('0x14')][_0x56df('0x13')]);}})[_0x56df('0x15')](function(_0x149a9c){logger[_0x56df('0x12')](_0x56df('0xf'),_0x3eebec,_0x149a9c);_0x89c34c(_0x149a9c);});});}exports['CreateVoiceTransferReport']=function(_0x1847ae){var _0x239c04=this;return new Promise(function(_0x157a26,_0x2d90a6){return db[_0x56df('0x16')][_0x56df('0x17')](_0x1847ae[_0x56df('0x18')],{'raw':_0x1847ae['options']?_0x1847ae['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xcb0d26){logger[_0x56df('0xe')](_0x56df('0x19'),_0x1847ae);logger['debug'](_0x56df('0x19'),_0x1847ae,JSON[_0x56df('0x1a')](_0xcb0d26));_0x157a26(_0xcb0d26);})[_0x56df('0x15')](function(_0x340811){logger[_0x56df('0x12')](_0x56df('0x19'),_0x340811[_0x56df('0x13')],_0x1847ae);_0x2d90a6(_0x239c04[_0x56df('0x12')](0x1f4,_0x340811[_0x56df('0x13')]));});});}; \ No newline at end of file +var _0x7662=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7662,0xd2));var _0x2766=function(_0x21e85f,_0x5d141b){_0x21e85f=_0x21e85f-0x0;var _0x31978b=_0x7662[_0x21e85f];return _0x31978b;};'use strict';var _=require(_0x2766('0x0'));var util=require(_0x2766('0x1'));var moment=require(_0x2766('0x2'));var BPromise=require('bluebird');var rs=require(_0x2766('0x3'));var fs=require('fs');var Redis=require(_0x2766('0x4'));var db=require(_0x2766('0x5'))['db'];var utils=require(_0x2766('0x6'));var logger=require('../../config/logger')(_0x2766('0x7'));var config=require(_0x2766('0x8'));var jayson=require(_0x2766('0x9'));var client=jayson[_0x2766('0xa')][_0x2766('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a9852,_0x57930d,_0x40d57b){return new BPromise(function(_0x571ca7,_0x229f06){return client['request'](_0x1a9852,_0x40d57b)['then'](function(_0xf8c0d4){logger[_0x2766('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x57930d,_0x2766('0xd'));logger['debug'](_0x2766('0xe'),_0x57930d,_0x2766('0xd'),JSON['stringify'](_0xf8c0d4));if(_0xf8c0d4[_0x2766('0xf')]){if(_0xf8c0d4[_0x2766('0xf')]['code']===0x1f4){logger['error'](_0x2766('0x10'),_0x57930d,_0xf8c0d4[_0x2766('0xf')][_0x2766('0x11')]);return _0x229f06(_0xf8c0d4[_0x2766('0xf')][_0x2766('0x11')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x57930d,_0xf8c0d4[_0x2766('0xf')][_0x2766('0x11')]);return _0x571ca7(_0xf8c0d4[_0x2766('0xf')]['message']);}else{logger[_0x2766('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x57930d,'request\x20sent');_0x571ca7(_0xf8c0d4[_0x2766('0x12')]['message']);}})[_0x2766('0x13')](function(_0x20c0c2){logger['error'](_0x2766('0x10'),_0x57930d,_0x20c0c2);_0x229f06(_0x20c0c2);});});}exports[_0x2766('0x14')]=function(_0x5793a1){var _0x2bec43=this;return new Promise(function(_0x46f9e6,_0x5e4e8d){return db[_0x2766('0x15')][_0x2766('0x16')](_0x5793a1['body'],{'raw':_0x5793a1[_0x2766('0x17')]?_0x5793a1['options'][_0x2766('0x18')]===undefined?!![]:![]:!![]})[_0x2766('0x19')](function(_0x20af2b){logger[_0x2766('0xc')]('CreateVoiceTransferReport',_0x5793a1);logger[_0x2766('0x1a')](_0x2766('0x14'),_0x5793a1,JSON['stringify'](_0x20af2b));_0x46f9e6(_0x20af2b);})[_0x2766('0x13')](function(_0x52d42b){logger[_0x2766('0xf')]('CreateVoiceTransferReport',_0x52d42b[_0x2766('0x11')],_0x5793a1);_0x5e4e8d(_0x2bec43['error'](0x1f4,_0x52d42b[_0x2766('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a31d80d..afe6bc6 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 _0x7b6b=['exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls','/transfer','transfer'];(function(_0x567e7a,_0x129d75){var _0x313d2c=function(_0x10dcbb){while(--_0x10dcbb){_0x567e7a['push'](_0x567e7a['shift']());}};_0x313d2c(++_0x129d75);}(_0x7b6b,0xac));var _0xb7b6=function(_0x3a827e,_0x1d218e){_0x3a827e=_0x3a827e-0x0;var _0x1244fc=_0x7b6b[_0x3a827e];return _0x1244fc;};'use strict';var express=require(_0xb7b6('0x0'));var router=express['Router']();var auth=require(_0xb7b6('0x1'));var controller=require(_0xb7b6('0x2'));router[_0xb7b6('0x3')]('/originate',auth[_0xb7b6('0x4')](),auth['canUpdate'](),controller[_0xb7b6('0x5')]);router[_0xb7b6('0x3')](_0xb7b6('0x6'),auth[_0xb7b6('0x4')](),auth[_0xb7b6('0x7')](),controller[_0xb7b6('0x8')]);router[_0xb7b6('0x3')](_0xb7b6('0x9'),auth[_0xb7b6('0x4')](),auth[_0xb7b6('0x7')](),controller[_0xb7b6('0xa')]);router[_0xb7b6('0x3')](_0xb7b6('0xb'),auth[_0xb7b6('0x4')](),auth[_0xb7b6('0x7')](),controller[_0xb7b6('0xc')]);router[_0xb7b6('0x3')](_0xb7b6('0xd'),auth[_0xb7b6('0x4')](),auth[_0xb7b6('0x7')](),controller['unhold']);router[_0xb7b6('0x3')](_0xb7b6('0xe'),auth[_0xb7b6('0x4')](),auth[_0xb7b6('0x7')](),controller[_0xb7b6('0xf')]);router[_0xb7b6('0x3')](_0xb7b6('0x10'),auth[_0xb7b6('0x4')](),auth[_0xb7b6('0x7')](),controller[_0xb7b6('0x11')]);module[_0xb7b6('0x12')]=router; \ No newline at end of file +var _0xa7dc=['express','Router','../../components/auth/service','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xa7dc,0x11d));var _0xca7d=function(_0xba2228,_0x17742c){_0xba2228=_0xba2228-0x0;var _0x3d1df9=_0xa7dc[_0xba2228];return _0x3d1df9;};'use strict';var express=require(_0xca7d('0x0'));var router=express[_0xca7d('0x1')]();var auth=require(_0xca7d('0x2'));var controller=require('./webbar.controller');router[_0xca7d('0x3')]('/originate',auth[_0xca7d('0x4')](),auth[_0xca7d('0x5')](),controller[_0xca7d('0x6')]);router[_0xca7d('0x3')](_0xca7d('0x7'),auth[_0xca7d('0x4')](),auth[_0xca7d('0x5')](),controller[_0xca7d('0x8')]);router['post'](_0xca7d('0x9'),auth[_0xca7d('0x4')](),auth['canUpdate'](),controller[_0xca7d('0xa')]);router[_0xca7d('0x3')](_0xca7d('0xb'),auth['isAuthenticated'](),auth[_0xca7d('0x5')](),controller[_0xca7d('0xc')]);router[_0xca7d('0x3')](_0xca7d('0xd'),auth[_0xca7d('0x4')](),auth['canUpdate'](),controller[_0xca7d('0xe')]);router['post'](_0xca7d('0xf'),auth['isAuthenticated'](),auth[_0xca7d('0x5')](),controller[_0xca7d('0x10')]);router[_0xca7d('0x3')](_0xca7d('0x11'),auth['isAuthenticated'](),auth['canUpdate'](),controller['transfer']);module[_0xca7d('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 07a0576..4735a40 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 _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x11d7e3,_0x387e61){var _0x1cd21a=function(_0xe3cd8d){while(--_0xe3cd8d){_0x11d7e3['push'](_0x11d7e3['shift']());}};_0x1cd21a(++_0x387e61);}(_0x7341,0xe4));var _0x1734=function(_0x4d3259,_0x5f0b54){_0x4d3259=_0x4d3259-0x0;var _0x36c8b9=_0x7341[_0x4d3259];return _0x36c8b9;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));}; \ No newline at end of file +var _0x1a66=['webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:'];(function(_0x14726c,_0x5086c5){var _0x2af547=function(_0x480bee){while(--_0x480bee){_0x14726c['push'](_0x14726c['shift']());}};_0x2af547(++_0x5086c5);}(_0x1a66,0x102));var _0x61a6=function(_0x3c9e6b,_0x4c121b){_0x3c9e6b=_0x3c9e6b-0x0;var _0x4d6687=_0x1a66[_0x3c9e6b];return _0x4d6687;};'use strict';var path=require(_0x61a6('0x0'));var fs=require('fs');var _=require(_0x61a6('0x1'));var db=require(_0x61a6('0x2'))['db'];var config=require(_0x61a6('0x3'));var util=require(_0x61a6('0x4'));var BPromise=require(_0x61a6('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x61a6('0x6')]({'port':0x232a});var logger=require(_0x61a6('0x7'))(_0x61a6('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config['redis'],{'host':_0x61a6('0x9'),'port':0x18eb});var io=require(_0x61a6('0xa'))(new Redis(config['redis']));var Schema=require(_0x61a6('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x61a6('0xc')]},'callNumber':{'type':_0x61a6('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x61a6('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x61a6('0xc')]},'sessionId':{'type':_0x61a6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x61a6('0xe'),'required':[!![],_0x61a6('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x61a6('0xe'),'required':[!![],_0x61a6('0xc')]},'sessionId':{'type':'string','required':[!![],_0x61a6('0xf')]},'transferNumber':{'type':'string','required':[!![],_0x61a6('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x61a6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x61a6('0xe'),'required':[!![],_0x61a6('0xc')]},'sessionId':{'type':_0x61a6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x61a6('0xe'),'required':[!![],_0x61a6('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x61a6('0xe'),'required':[!![],_0x61a6('0xc')]}});function emit(_0x55b923,_0x107d97,_0x4c810e){logger[_0x61a6('0x11')](_0x55b923,_0x107d97,JSON[_0x61a6('0x12')](_0x4c810e));io['to'](_0x55b923)[_0x61a6('0x13')](_0x107d97,_0x4c810e);}function handleError(_0x115c8b){return function(_0x365bb2){console[_0x61a6('0x14')]('handleError:',_0x365bb2,_0x365bb2 instanceof RangeError);logger[_0x61a6('0x15')](_0x365bb2[_0x61a6('0x16')]);if(_0x365bb2 instanceof RangeError){if(_0x365bb2[_0x61a6('0x17')]){delete _0x365bb2['name'];}_0x115c8b[_0x61a6('0x18')](0x194)['send'](_0x365bb2);}else{if(_0x365bb2[_0x61a6('0x17')]){delete _0x365bb2[_0x61a6('0x17')];}_0x115c8b[_0x61a6('0x18')](0x1f4)[_0x61a6('0x19')](_0x365bb2);}};}function checkError(){return function(_0x4a0daa){if(!_0x4a0daa){throw new RangeError(_0x61a6('0x1a'));}return _0x4a0daa;};}function respondWithRpcPromise(_0x755886,_0x51a15e){return new BPromise(function(_0xac9dd2,_0x530650){var _0x5b1109=amiClient;return _0x5b1109[_0x61a6('0x1b')](_0x755886,_0x51a15e)[_0x61a6('0x1c')](function(_0x2bdee3){if(_0x2bdee3['error']){if(_0x2bdee3['error'][_0x61a6('0x1d')]===0x1f4){return _0x530650(_0x2bdee3['error'][_0x61a6('0x1e')]);}return _0xac9dd2(_0x2bdee3[_0x61a6('0x15')][_0x61a6('0x1e')]);}else{_0xac9dd2(_0x2bdee3[_0x61a6('0x1f')]);}})['catch'](function(_0x48e59e){_0x530650(_0x48e59e);});});}function getAgent(_0xa267bd){return db[_0x61a6('0x20')][_0x61a6('0x21')]({'where':{'id':_0xa267bd,'role':_0x61a6('0x22')}})[_0x61a6('0x1c')](checkError());}function getAgentCheckSession(_0xe518e8,_0x38b754){return new BPromise(function(_0x1ba337,_0x3c7e3c){var _0x76992c=respondWithRpcPromise('VoiceChannels');var _0x7cebf8=getAgent(_0xe518e8);Promise[_0x61a6('0x23')]([_0x76992c,_0x7cebf8])[_0x61a6('0x1c')](function(_0x51063c){var _0x125d06=_0x51063c[0x0];var _0x268b53=_0x51063c[0x1];var _0x16c57b=_[_0x61a6('0x24')](_0x125d06[_0x61a6('0x25')],function(_0x102794){return _0x102794[_0x61a6('0x26')]==_0x268b53['id']&&_0x102794[_0x61a6('0x27')]==_0x38b754;});if(_0x16c57b[_0x61a6('0x28')]==0x1){_0x1ba337(_0x268b53);}else{_0x3c7e3c(new RangeError(_0x61a6('0x29')+_0x38b754+_0x61a6('0x2a')));}});});}exports[_0x61a6('0x2b')]=function(_0x2e4e33,_0x1f9784){logger[_0x61a6('0x11')](_0x61a6('0x2c'),_0x2e4e33[_0x61a6('0x2d')]);var _0x148693=originateValidation['validate'](_0x2e4e33[_0x61a6('0x2d')]);if(_0x148693[_0x61a6('0x28')]>0x0){return _0x1f9784[_0x61a6('0x18')](0x190)[_0x61a6('0x2e')](_0x148693);}var _0x27e384=_0x2e4e33['body'][_0x61a6('0x2f')];var _0x119cd1=_0x2e4e33['body'][_0x61a6('0x30')];var _0x4de2f5=_0x2e4e33[_0x61a6('0x2d')]['callerId'];var _0x386c6e=_0x2e4e33[_0x61a6('0x2d')][_0x61a6('0x31')];return getAgent(_0x27e384)['then'](function(_0x4ea820){logger[_0x61a6('0x11')](_0x61a6('0x32'),_0x4ea820[_0x61a6('0x17')]);emit(util[_0x61a6('0x33')](_0x61a6('0x34'),_0x4ea820[_0x61a6('0x17')]),_0x61a6('0x35'),{'callNumber':_0x119cd1,'callerId':_0x4de2f5,'callbackUrl':_0x386c6e});return _0x1f9784[_0x61a6('0x18')](0xc8)[_0x61a6('0x2e')]({'error':![],'message':_0x61a6('0x36')});})[_0x61a6('0x37')](handleError(_0x1f9784));};exports[_0x61a6('0x38')]=function(_0x3b17d0,_0x26fc56){logger[_0x61a6('0x11')](_0x61a6('0x39'),_0x3b17d0[_0x61a6('0x2d')]);var _0x53373b=hangupValidation[_0x61a6('0xb')](_0x3b17d0['body']);if(_0x53373b[_0x61a6('0x28')]>0x0){return _0x26fc56[_0x61a6('0x18')](0x190)[_0x61a6('0x2e')](_0x53373b);}var _0x58a51d=_0x3b17d0['body'][_0x61a6('0x2f')];var _0x548cf3=_0x3b17d0[_0x61a6('0x2d')][_0x61a6('0x27')];return getAgent(_0x58a51d)[_0x61a6('0x1c')](function(_0x24284e){logger[_0x61a6('0x11')](_0x61a6('0x32'),_0x24284e[_0x61a6('0x17')]);emit(util[_0x61a6('0x33')](_0x61a6('0x34'),_0x24284e[_0x61a6('0x17')]),_0x61a6('0x3a'),{'sessionId':_0x548cf3});return _0x26fc56['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x26fc56));};exports[_0x61a6('0x3b')]=function(_0x322d5f,_0xe0e0d){logger['info'](_0x61a6('0x3c'),_0x322d5f[_0x61a6('0x2d')]);var _0x4ab557=answerValidation[_0x61a6('0xb')](_0x322d5f['body']);if(_0x4ab557['length']>0x0){return _0xe0e0d[_0x61a6('0x18')](0x190)[_0x61a6('0x2e')](_0x4ab557);}var _0x563cb6=_0x322d5f[_0x61a6('0x2d')][_0x61a6('0x2f')];var _0x9ca16d=_0x322d5f[_0x61a6('0x2d')][_0x61a6('0x27')];return getAgent(_0x563cb6)[_0x61a6('0x1c')](function(_0x28126a){logger['info'](_0x61a6('0x32'),_0x28126a[_0x61a6('0x17')]);emit(util[_0x61a6('0x33')]('user:%s',_0x28126a[_0x61a6('0x17')]),'webbar:answer',{'sessionId':_0x9ca16d});return _0xe0e0d[_0x61a6('0x18')](0xc8)[_0x61a6('0x2e')]({'error':![],'message':_0x61a6('0x3d')});})['catch'](handleError(_0xe0e0d));};exports['hold']=function(_0x1717b9,_0x3aa9f5){logger[_0x61a6('0x11')](_0x61a6('0x3e'),_0x1717b9[_0x61a6('0x2d')]);var _0x1f4cee=holdValidation[_0x61a6('0xb')](_0x1717b9['body']);if(_0x1f4cee[_0x61a6('0x28')]>0x0){return _0x3aa9f5['status'](0x190)[_0x61a6('0x2e')](_0x1f4cee);}var _0x33ca01=_0x1717b9[_0x61a6('0x2d')][_0x61a6('0x2f')];var _0x39f724=_0x1717b9['body'][_0x61a6('0x27')];return getAgent(_0x33ca01)[_0x61a6('0x1c')](function(_0x2ec48c){logger[_0x61a6('0x11')](_0x61a6('0x32'),_0x2ec48c['name']);emit(util[_0x61a6('0x33')]('user:%s',_0x2ec48c[_0x61a6('0x17')]),_0x61a6('0x3f'),{'sessionId':_0x39f724});return _0x3aa9f5[_0x61a6('0x18')](0xc8)[_0x61a6('0x2e')]({'error':![],'message':_0x61a6('0x40')});})[_0x61a6('0x37')](handleError(_0x3aa9f5));};exports[_0x61a6('0x41')]=function(_0xbfa1ef,_0x7b9f7a){logger[_0x61a6('0x11')](_0x61a6('0x42'),_0xbfa1ef[_0x61a6('0x2d')]);var _0x44add5=unholdValidation[_0x61a6('0xb')](_0xbfa1ef[_0x61a6('0x2d')]);if(_0x44add5[_0x61a6('0x28')]>0x0){return _0x7b9f7a[_0x61a6('0x18')](0x190)[_0x61a6('0x2e')](_0x44add5);}var _0x31aed0=_0xbfa1ef['body'][_0x61a6('0x2f')];var _0x346a11=_0xbfa1ef[_0x61a6('0x2d')]['sessionId'];return getAgent(_0x31aed0)['then'](function(_0x312ebe){logger[_0x61a6('0x11')](_0x61a6('0x32'),_0x312ebe[_0x61a6('0x17')]);emit(util[_0x61a6('0x33')](_0x61a6('0x34'),_0x312ebe[_0x61a6('0x17')]),'webbar:unhold',{'sessionId':_0x346a11});return _0x7b9f7a[_0x61a6('0x18')](0xc8)[_0x61a6('0x2e')]({'error':![],'message':_0x61a6('0x43')});})[_0x61a6('0x37')](handleError(_0x7b9f7a));};exports[_0x61a6('0x44')]=function(_0x2d72c6,_0x4fb5d7){logger[_0x61a6('0x11')](_0x61a6('0x45'),_0x4fb5d7[_0x61a6('0x2d')]);var _0x1b8773=callsValidation['validate'](_0x2d72c6[_0x61a6('0x2d')]);if(_0x1b8773[_0x61a6('0x28')]>0x0){return _0x4fb5d7['status'](0x190)['json'](_0x1b8773);}var _0x506e7d=_0x2d72c6[_0x61a6('0x2d')][_0x61a6('0x2f')];var _0x4a3492=respondWithRpcPromise('VoiceChannels');var _0x50172f=getAgent(_0x506e7d);return Promise[_0x61a6('0x23')]([_0x4a3492,_0x50172f])[_0x61a6('0x1c')](function(_0x5d1705){var _0x473684=_0x5d1705[0x0];var _0x3e8772=_0x5d1705[0x1];var _0x517436=_[_0x61a6('0x24')](_0x473684[_0x61a6('0x25')],function(_0x5930a8){return _0x5930a8['UserId']==_0x3e8772['id'];});return _0x4fb5d7[_0x61a6('0x18')](0xc8)[_0x61a6('0x2e')]({'count':_0x517436['length'],'rows':_0x517436});})['catch'](handleError(_0x4fb5d7));};exports[_0x61a6('0x46')]=function(_0x607043,_0xd6ec86){logger['info'](_0x61a6('0x47'),_0x607043[_0x61a6('0x2d')]);var _0x4ce1e2=conferenceValidation[_0x61a6('0xb')](_0x607043['body']);if(_0x4ce1e2[_0x61a6('0x28')]>0x0){return _0xd6ec86[_0x61a6('0x18')](0x190)['json'](_0x4ce1e2);}var _0x3bc836=_0x607043['body']['userId'];return getAgent(_0x3bc836)['then'](function(_0x13b8ed){logger[_0x61a6('0x11')]('entityFound:',_0x13b8ed[_0x61a6('0x17')]);emit(util['format']('user:%s',_0x13b8ed['name']),_0x61a6('0x48'));return _0xd6ec86[_0x61a6('0x18')](0xc8)[_0x61a6('0x2e')]({'error':![],'message':_0x61a6('0x49')});})[_0x61a6('0x37')](handleError(_0xd6ec86));};exports[_0x61a6('0x4a')]=function(_0x5f5050,_0xfa1f7c){logger['info'](_0x61a6('0x4b'),_0x5f5050[_0x61a6('0x2d')]);var _0x44434a=transferValidation[_0x61a6('0xb')](_0x5f5050[_0x61a6('0x2d')]);if(_0x44434a[_0x61a6('0x28')]>0x0){return _0xfa1f7c[_0x61a6('0x18')](0x190)[_0x61a6('0x2e')](_0x44434a);}var _0x33815e=_0x5f5050['body'][_0x61a6('0x2f')];var _0x3c4517=_0x5f5050[_0x61a6('0x2d')][_0x61a6('0x27')];var _0x3ab67b=_0x5f5050['body'][_0x61a6('0x4c')];return getAgent(_0x33815e)[_0x61a6('0x1c')](function(_0x3d266c){logger['info'](_0x61a6('0x32'),_0x3d266c[_0x61a6('0x17')]);emit(util[_0x61a6('0x33')](_0x61a6('0x34'),_0x3d266c[_0x61a6('0x17')]),_0x61a6('0x4d'),{'sessionId':_0x3c4517,'transferNumber':_0x3ab67b});return _0xfa1f7c[_0x61a6('0x18')](0xc8)['json']({'error':![],'message':_0x61a6('0x4e')});})[_0x61a6('0x37')](handleError(_0xfa1f7c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index db48b2c..90664ed 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 _0x3d04=['create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','getAnswers','/:id/users','getAgents','getApplications','post'];(function(_0x2f5ecc,_0x5edb87){var _0x116ec7=function(_0x279144){while(--_0x279144){_0x2f5ecc['push'](_0x2f5ecc['shift']());}};_0x116ec7(++_0x5edb87);}(_0x3d04,0xbe));var _0x43d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3d04[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var auth=require(_0x43d0('0x6'));var interaction=require(_0x43d0('0x7'));var config=require('../../config/environment');var controller=require(_0x43d0('0x8'));router[_0x43d0('0x9')]('/',auth[_0x43d0('0xa')](),controller[_0x43d0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x43d0('0x9')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0xd')]);router[_0x43d0('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x43d0('0xe')]);router['get']('/:id/canned_answers',auth[_0x43d0('0xa')](),controller[_0x43d0('0xf')]);router[_0x43d0('0x9')](_0x43d0('0x10'),auth['isAuthenticated'](),controller[_0x43d0('0x11')]);router[_0x43d0('0x9')]('/:id/applications',auth[_0x43d0('0xa')](),controller[_0x43d0('0x12')]);router[_0x43d0('0x13')]('/',auth['isAuthenticated'](),controller[_0x43d0('0x14')]);router[_0x43d0('0x13')](_0x43d0('0x15'),auth['isAuthenticated'](),controller[_0x43d0('0x16')]);router[_0x43d0('0x13')](_0x43d0('0x17'),auth[_0x43d0('0xa')](),controller[_0x43d0('0x18')]);router['post']('/:id/users',auth[_0x43d0('0xa')](),controller[_0x43d0('0x19')]);router[_0x43d0('0x13')]('/:id/applications',auth[_0x43d0('0xa')](),controller['addApplications']);router[_0x43d0('0x13')](_0x43d0('0x1a'),controller[_0x43d0('0x1b')]);router['post'](_0x43d0('0x1c'),auth[_0x43d0('0xa')](),controller['send']);router[_0x43d0('0x1d')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0x1e')]);router[_0x43d0('0x1f')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0x20')]);router[_0x43d0('0x1f')](_0x43d0('0x15'),auth[_0x43d0('0xa')](),controller[_0x43d0('0x21')]);router[_0x43d0('0x1f')](_0x43d0('0x17'),auth[_0x43d0('0xa')](),controller['removeAnswers']);router[_0x43d0('0x1f')](_0x43d0('0x10'),auth['isAuthenticated'](),controller[_0x43d0('0x22')]);module['exports']=router; \ No newline at end of file +var _0x0120=['removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','create','post','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','put','destroy','delete','removeDispositions'];(function(_0x8ac4e5,_0x484a5c){var _0x3a872d=function(_0x183181){while(--_0x183181){_0x8ac4e5['push'](_0x8ac4e5['shift']());}};_0x3a872d(++_0x484a5c);}(_0x0120,0x6f));var _0x0012=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0120[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var auth=require(_0x0012('0x6'));var interaction=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var controller=require(_0x0012('0x9'));router[_0x0012('0xa')]('/',auth[_0x0012('0xb')](),controller['index']);router['get']('/describe',auth[_0x0012('0xb')](),controller[_0x0012('0xc')]);router[_0x0012('0xa')](_0x0012('0xd'),auth[_0x0012('0xb')](),controller['show']);router[_0x0012('0xa')](_0x0012('0xe'),auth[_0x0012('0xb')](),controller[_0x0012('0xf')]);router['get'](_0x0012('0x10'),auth['isAuthenticated'](),controller[_0x0012('0x11')]);router[_0x0012('0xa')](_0x0012('0x12'),auth[_0x0012('0xb')](),controller[_0x0012('0x13')]);router['get'](_0x0012('0x14'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0x0012('0x15')]);router['post'](_0x0012('0xe'),auth[_0x0012('0xb')](),controller['addDisposition']);router[_0x0012('0x16')](_0x0012('0x10'),auth[_0x0012('0xb')](),controller[_0x0012('0x17')]);router['post']('/:id/users',auth[_0x0012('0xb')](),controller[_0x0012('0x18')]);router[_0x0012('0x16')](_0x0012('0x14'),auth[_0x0012('0xb')](),controller[_0x0012('0x19')]);router[_0x0012('0x16')](_0x0012('0x1a'),controller['notify']);router[_0x0012('0x16')](_0x0012('0x1b'),auth['isAuthenticated'](),controller[_0x0012('0x1c')]);router[_0x0012('0x1d')](_0x0012('0xd'),auth[_0x0012('0xb')](),controller['update']);router['delete'](_0x0012('0xd'),auth[_0x0012('0xb')](),controller[_0x0012('0x1e')]);router[_0x0012('0x1f')](_0x0012('0xe'),auth[_0x0012('0xb')](),controller[_0x0012('0x20')]);router[_0x0012('0x1f')]('/:id/canned_answers',auth[_0x0012('0xb')](),controller[_0x0012('0x21')]);router['delete'](_0x0012('0x12'),auth[_0x0012('0xb')](),controller[_0x0012('0x22')]);module[_0x0012('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index e6efacf..2fa0c5d 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 _0x0f7f=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x27405e,_0x8bda1){var _0x25bfb3=function(_0x50f217){while(--_0x50f217){_0x27405e['push'](_0x27405e['shift']());}};_0x25bfb3(++_0x8bda1);}(_0x0f7f,0xd7));var _0xf0f7=function(_0x5bb388,_0x42cada){_0x5bb388=_0x5bb388-0x0;var _0x55a5f0=_0x0f7f[_0x5bb388];return _0x55a5f0;};'use strict';var Sequelize=require(_0xf0f7('0x0'));var rs=require(_0xf0f7('0x1'));module[_0xf0f7('0x2')]={'name':{'type':Sequelize[_0xf0f7('0x3')],'unique':_0xf0f7('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xf0f7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xf0f7('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf0f7('0x3')]},'type':{'type':Sequelize[_0xf0f7('0x5')](_0xf0f7('0x6'))},'accountSid':{'type':Sequelize[_0xf0f7('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf0f7('0x7')],'defaultValue':function(){return _0xf0f7('0x8');}},'notificationSound':{'type':Sequelize[_0xf0f7('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf0f7('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf0f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf0f7('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0f7('0xa')],'comment':_0xf0f7('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x313571){if(!_0x313571){this[_0xf0f7('0xc')]('mandatoryDispositionPauseId',null);}this[_0xf0f7('0xc')](_0xf0f7('0xd'),_0x313571);}},'description':{'type':Sequelize[_0xf0f7('0x3')]}}; \ No newline at end of file +var _0x37f9=['name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','randomstring','exports','STRING'];(function(_0xdc0397,_0x20d1f1){var _0x553d02=function(_0x364781){while(--_0x364781){_0xdc0397['push'](_0xdc0397['shift']());}};_0x553d02(++_0x20d1f1);}(_0x37f9,0x105));var _0x937f=function(_0x23b89c,_0x1f165e){_0x23b89c=_0x23b89c-0x0;var _0x29b51e=_0x37f9[_0x23b89c];return _0x29b51e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x937f('0x0'));module[_0x937f('0x1')]={'name':{'type':Sequelize[_0x937f('0x2')],'unique':_0x937f('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x937f('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x937f('0x2')],'defaultValue':function(){return rs[_0x937f('0x4')]();}},'phone':{'type':Sequelize[_0x937f('0x2')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x937f('0x2')]},'authToken':{'type':Sequelize[_0x937f('0x2')]},'notificationTemplate':{'type':Sequelize[_0x937f('0x5')],'defaultValue':function(){return _0x937f('0x6');}},'notificationSound':{'type':Sequelize[_0x937f('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x937f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x937f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x937f('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x937f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x937f('0x8')],'comment':_0x937f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x937f('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x20ecca){if(!_0x20ecca){this[_0x937f('0xa')]('mandatoryDispositionPauseId',null);}this[_0x937f('0xa')](_0x937f('0xb'),_0x20ecca);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a8e40a1..6045743 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 _0xfaf0=['send','index','Pause','map','WhatsappAccount','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','findOne','offset','sort','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','destroy','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','Applications','account','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','MessageSid','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','DESC','omit','CmContact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','apply','reject','save','get','WhatsappAccounts','UserProfileResource','name'];(function(_0x88b167,_0x3d9011){var _0x54cb73=function(_0x4a8d71){while(--_0x4a8d71){_0x88b167['push'](_0x88b167['shift']());}};_0x54cb73(++_0x3d9011);}(_0xfaf0,0x12d));var _0x0faf=function(_0x1c5d85,_0xe4b35b){_0x1c5d85=_0x1c5d85-0x0;var _0x3e0835=_0xfaf0[_0x1c5d85];return _0x3e0835;};'use strict';var pdf=require(_0x0faf('0x0'));var emlformat=require(_0x0faf('0x1'));var rimraf=require(_0x0faf('0x2'));var zipdir=require(_0x0faf('0x3'));var jsonpatch=require(_0x0faf('0x4'));var rp=require(_0x0faf('0x5'));var moment=require('moment');var BPromise=require(_0x0faf('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0faf('0x7'));var sox=require(_0x0faf('0x8'));var csv=require(_0x0faf('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0faf('0xa'));var squel=require(_0x0faf('0xb'));var crypto=require(_0x0faf('0xc'));var jsforce=require(_0x0faf('0xd'));var deskjs=require(_0x0faf('0xe'));var toCsv=require(_0x0faf('0x9'));var querystring=require(_0x0faf('0xf'));var Papa=require(_0x0faf('0x10'));var Redis=require(_0x0faf('0x11'));var authService=require(_0x0faf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0faf('0x13'));var hardwareService=require(_0x0faf('0x14'));var logger=require(_0x0faf('0x15'))('api');var utils=require(_0x0faf('0x16'));var config=require(_0x0faf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0faf('0x18'))['db'];config[_0x0faf('0x19')]=_[_0x0faf('0x1a')](config[_0x0faf('0x19')],{'host':_0x0faf('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0faf('0x19')]));require('./whatsappAccount.socket')[_0x0faf('0x1c')](socket);var jayson=require(_0x0faf('0x1d'));var client=jayson[_0x0faf('0x1e')][_0x0faf('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x6f20b1,_0x2c894e,_0x1a46c4,_0x3f483d){return new BPromise(function(_0x3733de,_0x934d){var _0x381a8f=_0x3f483d||client;return _0x381a8f['request'](_0x6f20b1,_0x1a46c4)[_0x0faf('0x20')](function(_0x5254b8){logger['info'](_0x0faf('0x21'),_0x2c894e,'request\x20sent');logger['debug'](_0x0faf('0x22'),_0x2c894e,_0x0faf('0x23'),JSON[_0x0faf('0x24')](_0x5254b8));if(_0x5254b8[_0x0faf('0x25')]){if(_0x5254b8[_0x0faf('0x25')][_0x0faf('0x26')]===0x1f4){logger[_0x0faf('0x25')](_0x0faf('0x21'),_0x2c894e,_0x5254b8['error'][_0x0faf('0x27')]);return _0x934d(_0x5254b8[_0x0faf('0x25')][_0x0faf('0x27')]);}logger[_0x0faf('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2c894e,_0x5254b8[_0x0faf('0x25')]['message']);return _0x3733de(_0x5254b8['error']['message']);}else{logger['info'](_0x0faf('0x21'),_0x2c894e,'request\x20sent');_0x3733de(_0x5254b8[_0x0faf('0x28')][_0x0faf('0x27')]);}})[_0x0faf('0x29')](function(_0x5b634f){logger[_0x0faf('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2c894e,_0x5b634f);_0x934d(_0x5b634f);});});}function respondWithStatusCode(_0x284ecd,_0x50bd64){_0x50bd64=_0x50bd64||0xcc;return function(_0x44fc1d){if(_0x44fc1d){return _0x284ecd[_0x0faf('0x2a')](_0x50bd64);}return _0x284ecd[_0x0faf('0x2b')](_0x50bd64)[_0x0faf('0x2c')]();};}function respondWithResult(_0x301290,_0x126f09){_0x126f09=_0x126f09||0xc8;return function(_0xf9db66){if(_0xf9db66){return _0x301290[_0x0faf('0x2b')](_0x126f09)[_0x0faf('0x2d')](_0xf9db66);}};}function respondWithFilteredResult(_0x236e42,_0x35187a){return function(_0x512208){if(_0x512208){var _0x392802=_0x512208[_0x0faf('0x2e')],_0x4e1e15=_0x35187a['offset'],_0x1796b8=_0x35187a['offset']+_0x35187a[_0x0faf('0x2f')],_0x580658;if(_0x1796b8>=_0x392802){_0x1796b8=_0x392802;_0x580658=0xc8;}else{_0x580658=0xce;}_0x236e42['status'](_0x580658);return _0x236e42['set']('Content-Range',_0x4e1e15+'-'+_0x1796b8+'/'+_0x392802)[_0x0faf('0x2d')](_0x512208);}return null;};}function patchUpdates(_0x3b1abf){return function(_0x5bbec9){try{jsonpatch[_0x0faf('0x30')](_0x5bbec9,_0x3b1abf,!![]);}catch(_0x78ab3b){return BPromise[_0x0faf('0x31')](_0x78ab3b);}return _0x5bbec9[_0x0faf('0x32')]();};}function saveUpdates(_0x5b373a,_0x23e57b){return function(_0x19b71a){if(_0x19b71a){return _0x19b71a['update'](_0x5b373a)[_0x0faf('0x20')](function(_0x598882){return _0x598882;});}return null;};}function removeEntity(_0x8da7ee,_0x221e77){return function(_0x216843){if(_0x216843){return _0x216843['destroy']()[_0x0faf('0x20')](function(){var _0xa613cf=_0x216843[_0x0faf('0x33')]({'plain':!![]});var _0x33f6dd=_0x0faf('0x34');return db[_0x0faf('0x35')]['destroy']({'where':{'type':_0x33f6dd,'resourceId':_0xa613cf['id']}})[_0x0faf('0x20')](function(){return _0x216843;});})[_0x0faf('0x20')](function(){_0x8da7ee[_0x0faf('0x2b')](0xcc)[_0x0faf('0x2c')]();});}};}function handleEntityNotFound(_0x470554,_0x22558d){return function(_0x5cdfd8){if(!_0x5cdfd8){_0x470554['sendStatus'](0x194);}return _0x5cdfd8;};}function handleError(_0x38d674,_0xe9f83){_0xe9f83=_0xe9f83||0x1f4;return function(_0x1433de){logger['error'](_0x1433de['stack']);if(_0x1433de[_0x0faf('0x36')]){delete _0x1433de[_0x0faf('0x36')];}_0x38d674['status'](_0xe9f83)[_0x0faf('0x37')](_0x1433de);};}exports[_0x0faf('0x38')]=function(_0x438829,_0x217223){var _0x36ffbe={'include':[{'model':db[_0x0faf('0x39')],'as':'mandatoryDispositionPause'}]},_0x169ca6={},_0x5f0225={'count':0x0,'rows':[]};var _0x643be6=_[_0x0faf('0x3a')](db[_0x0faf('0x3b')][_0x0faf('0x3c')],function(_0x2716f2){return{'name':_0x2716f2['fieldName'],'type':_0x2716f2[_0x0faf('0x3d')][_0x0faf('0x3e')]};});_0x169ca6[_0x0faf('0x3f')]=_[_0x0faf('0x3a')](_0x643be6,_0x0faf('0x36'));_0x169ca6['query']=_[_0x0faf('0x40')](_0x438829[_0x0faf('0x41')]);_0x169ca6['filters']=_['intersection'](_0x169ca6[_0x0faf('0x3f')],_0x169ca6[_0x0faf('0x41')]);_0x36ffbe[_0x0faf('0x42')]=_[_0x0faf('0x43')](_0x169ca6[_0x0faf('0x3f')],qs[_0x0faf('0x44')](_0x438829[_0x0faf('0x41')]['fields']));_0x36ffbe[_0x0faf('0x42')]=_0x36ffbe[_0x0faf('0x42')][_0x0faf('0x45')]?_0x36ffbe[_0x0faf('0x42')]:_0x169ca6[_0x0faf('0x3f')];if(!_0x438829[_0x0faf('0x41')][_0x0faf('0x46')](_0x0faf('0x47'))){_0x36ffbe['limit']=qs['limit'](_0x438829[_0x0faf('0x41')]['limit']);_0x36ffbe['offset']=qs['offset'](_0x438829[_0x0faf('0x41')]['offset']);}_0x36ffbe[_0x0faf('0x48')]=qs['sort'](_0x438829[_0x0faf('0x41')]['sort']);_0x36ffbe[_0x0faf('0x49')]=qs[_0x0faf('0x4a')](_['pick'](_0x438829[_0x0faf('0x41')],_0x169ca6[_0x0faf('0x4a')]),_0x643be6);if(_0x438829[_0x0faf('0x41')]['filter']){_0x36ffbe[_0x0faf('0x49')]=_['merge'](_0x36ffbe[_0x0faf('0x49')],{'$or':_[_0x0faf('0x3a')](_0x643be6,function(_0x46ea98){if(_0x46ea98['type']!==_0x0faf('0x4b')){var _0x1abfaa={};_0x1abfaa[_0x46ea98[_0x0faf('0x36')]]={'$like':'%'+_0x438829[_0x0faf('0x41')]['filter']+'%'};return _0x1abfaa;}})});}_0x36ffbe=_['merge']({},_0x36ffbe,_0x438829[_0x0faf('0x4c')]);var _0x42b49e={'where':_0x36ffbe[_0x0faf('0x49')]};return db[_0x0faf('0x3b')][_0x0faf('0x2e')](_0x42b49e)[_0x0faf('0x20')](function(_0x2b5bb3){_0x5f0225[_0x0faf('0x2e')]=_0x2b5bb3;if(_0x438829[_0x0faf('0x41')][_0x0faf('0x4d')]){_0x36ffbe[_0x0faf('0x4e')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x0faf('0x4f')](_0x36ffbe);})[_0x0faf('0x20')](function(_0x22c8b8){_0x5f0225[_0x0faf('0x50')]=_0x22c8b8;return _0x5f0225;})['then'](respondWithFilteredResult(_0x217223,_0x36ffbe))['catch'](handleError(_0x217223,null));};exports[_0x0faf('0x51')]=function(_0x172c50,_0x3300a5){var _0x172aab={'raw':![],'where':{'id':_0x172c50[_0x0faf('0x52')]['id']},'include':[{'model':db[_0x0faf('0x39')],'as':_0x0faf('0x53')}]},_0x2041df={};_0x2041df[_0x0faf('0x3f')]=_['keys'](db[_0x0faf('0x3b')][_0x0faf('0x3c')]);_0x2041df[_0x0faf('0x41')]=_[_0x0faf('0x40')](_0x172c50[_0x0faf('0x41')]);_0x2041df['filters']=_[_0x0faf('0x43')](_0x2041df[_0x0faf('0x3f')],_0x2041df[_0x0faf('0x41')]);_0x172aab[_0x0faf('0x42')]=_[_0x0faf('0x43')](_0x2041df[_0x0faf('0x3f')],qs[_0x0faf('0x44')](_0x172c50['query']['fields']));_0x172aab[_0x0faf('0x42')]=_0x172aab[_0x0faf('0x42')][_0x0faf('0x45')]?_0x172aab[_0x0faf('0x42')]:_0x2041df[_0x0faf('0x3f')];if(_0x172c50['query'][_0x0faf('0x4d')]){_0x172aab[_0x0faf('0x4e')]=[{'all':!![]}];}_0x172aab=_[_0x0faf('0x54')]({},_0x172aab,_0x172c50['options']);return db[_0x0faf('0x3b')][_0x0faf('0x55')](_0x172aab)[_0x0faf('0x20')](handleEntityNotFound(_0x3300a5,null))[_0x0faf('0x20')](respondWithResult(_0x3300a5,null))[_0x0faf('0x29')](handleError(_0x3300a5,null));};exports[_0x0faf('0x56')]=function(_0x4c92ee,_0x5740f){return db[_0x0faf('0x3b')][_0x0faf('0x56')](_0x4c92ee[_0x0faf('0x57')],{})[_0x0faf('0x20')](function(_0x151426){var _0xbddf2d=_0x4c92ee[_0x0faf('0x58')][_0x0faf('0x33')]({'plain':!![]});if(!_0xbddf2d)throw new Error(_0x0faf('0x59'));if(_0xbddf2d['role']===_0x0faf('0x58')){var _0x2b7cb2=_0x151426[_0x0faf('0x33')]({'plain':!![]});var _0x252ce6='WhatsappAccounts';return db[_0x0faf('0x5a')][_0x0faf('0x55')]({'where':{'name':_0x252ce6,'userProfileId':_0xbddf2d[_0x0faf('0x5b')]},'raw':!![]})['then'](function(_0x2deea2){if(_0x2deea2&&_0x2deea2['autoAssociation']===0x0){return db[_0x0faf('0x35')][_0x0faf('0x56')]({'name':_0x2b7cb2[_0x0faf('0x36')],'resourceId':_0x2b7cb2['id'],'type':_0x2deea2[_0x0faf('0x36')],'sectionId':_0x2deea2['id']},{})[_0x0faf('0x20')](function(){return _0x151426;});}else{return _0x151426;}})[_0x0faf('0x29')](function(_0x531ff8){logger[_0x0faf('0x25')](_0x0faf('0x5c'),_0x531ff8);throw _0x531ff8;});}return _0x151426;})[_0x0faf('0x20')](respondWithResult(_0x5740f,0xc9))[_0x0faf('0x29')](handleError(_0x5740f,null));};exports['update']=function(_0x2f8677,_0x458acd){if(_0x2f8677[_0x0faf('0x57')]['id']){delete _0x2f8677[_0x0faf('0x57')]['id'];}return db[_0x0faf('0x3b')][_0x0faf('0x55')]({'where':{'id':_0x2f8677[_0x0faf('0x52')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x0faf('0x20')](handleEntityNotFound(_0x458acd,null))['then'](saveUpdates(_0x2f8677['body'],null))[_0x0faf('0x20')](respondWithResult(_0x458acd,null))[_0x0faf('0x29')](handleError(_0x458acd,null));};exports['destroy']=function(_0x818c4f,_0x15e59d){return db['WhatsappAccount'][_0x0faf('0x55')]({'where':{'id':_0x818c4f['params']['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x15e59d,null))[_0x0faf('0x20')](removeEntity(_0x15e59d,null))[_0x0faf('0x29')](handleError(_0x15e59d,null));};exports[_0x0faf('0x5d')]=function(_0x5b21b2,_0x4b9f2e){return db[_0x0faf('0x3b')][_0x0faf('0x5d')]()[_0x0faf('0x20')](respondWithResult(_0x4b9f2e,null))[_0x0faf('0x29')](handleError(_0x4b9f2e,null));};exports[_0x0faf('0x5e')]=function(_0x30a9ca,_0x5e2063,_0x26a7f8){if(_0x30a9ca['body']['id']){delete _0x30a9ca['body']['id'];}return db[_0x0faf('0x3b')][_0x0faf('0x55')]({'where':{'id':_0x30a9ca[_0x0faf('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e2063,null))[_0x0faf('0x20')](function(_0x55cb47){if(_0x55cb47){_0x30a9ca['body'][_0x0faf('0x5f')]=_0x55cb47['id'];return db[_0x0faf('0x60')][_0x0faf('0x56')](_0x30a9ca[_0x0faf('0x57')]);}})[_0x0faf('0x20')](respondWithResult(_0x5e2063,null))[_0x0faf('0x29')](handleError(_0x5e2063,null));};exports['getDispositions']=function(_0x419aee,_0x42a207,_0x9955b5){var _0x54d778={'raw':![],'where':{}};var _0x1bf6b6={};var _0x230ab1={'count':0x0,'rows':[]};return db[_0x0faf('0x3b')][_0x0faf('0x61')]({'where':{'id':_0x419aee[_0x0faf('0x52')]['id']}})['then'](handleEntityNotFound(_0x42a207,null))['then'](function(_0x4beede){if(_0x4beede){_0x1bf6b6[_0x0faf('0x3f')]=_[_0x0faf('0x40')](db[_0x0faf('0x60')]['rawAttributes']);_0x1bf6b6[_0x0faf('0x41')]=_[_0x0faf('0x40')](_0x419aee[_0x0faf('0x41')]);_0x1bf6b6[_0x0faf('0x4a')]=_['intersection'](_0x1bf6b6[_0x0faf('0x3f')],_0x1bf6b6[_0x0faf('0x41')]);_0x54d778[_0x0faf('0x42')]=_[_0x0faf('0x43')](_0x1bf6b6[_0x0faf('0x3f')],qs[_0x0faf('0x44')](_0x419aee[_0x0faf('0x41')][_0x0faf('0x44')]));_0x54d778[_0x0faf('0x42')]=_0x54d778['attributes']['length']?_0x54d778[_0x0faf('0x42')]:_0x1bf6b6[_0x0faf('0x3f')];if(!_0x419aee['query'][_0x0faf('0x46')](_0x0faf('0x47'))){_0x54d778[_0x0faf('0x2f')]=qs['limit'](_0x419aee[_0x0faf('0x41')][_0x0faf('0x2f')]);_0x54d778[_0x0faf('0x62')]=qs['offset'](_0x419aee[_0x0faf('0x41')]['offset']);}_0x54d778[_0x0faf('0x48')]=qs[_0x0faf('0x63')](_0x419aee['query'][_0x0faf('0x63')]);_0x54d778[_0x0faf('0x49')]=qs[_0x0faf('0x4a')](_['pick'](_0x419aee[_0x0faf('0x41')],_0x1bf6b6[_0x0faf('0x4a')]));_0x54d778['where'][_0x0faf('0x5f')]=_0x4beede['id'];if(_0x419aee[_0x0faf('0x41')]['filter']){_0x54d778[_0x0faf('0x49')]=_[_0x0faf('0x54')](_0x54d778[_0x0faf('0x49')],{'$or':_[_0x0faf('0x3a')](_0x54d778[_0x0faf('0x42')],function(_0x315dea){var _0x282d92={};_0x282d92[_0x315dea]={'$like':'%'+_0x419aee['query'][_0x0faf('0x64')]+'%'};return _0x282d92;})});}_0x54d778=_[_0x0faf('0x54')]({},_0x54d778,_0x419aee['options']);return db[_0x0faf('0x60')][_0x0faf('0x2e')]({'where':_0x54d778[_0x0faf('0x49')]})[_0x0faf('0x20')](function(_0x5dbc85){_0x230ab1[_0x0faf('0x2e')]=_0x5dbc85;if(_0x419aee['query'][_0x0faf('0x4d')]){_0x54d778[_0x0faf('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0x0faf('0x4f')](_0x54d778);})[_0x0faf('0x20')](function(_0x4be120){_0x230ab1[_0x0faf('0x50')]=_0x4be120;return _0x230ab1;});}})[_0x0faf('0x20')](respondWithFilteredResult(_0x42a207,_0x54d778))[_0x0faf('0x29')](handleError(_0x42a207,null));};exports[_0x0faf('0x65')]=function(_0x48ccb0,_0x45d3ae,_0x3e54ea){return db[_0x0faf('0x3b')]['find']({'where':{'id':_0x48ccb0[_0x0faf('0x52')]['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x45d3ae,null))[_0x0faf('0x20')](function(_0x469aad){if(_0x469aad){return _0x469aad[_0x0faf('0x65')](_0x48ccb0[_0x0faf('0x41')][_0x0faf('0x66')]);}})[_0x0faf('0x20')](respondWithStatusCode(_0x45d3ae,null))['catch'](handleError(_0x45d3ae,null));};exports[_0x0faf('0x67')]=function(_0x5149d9,_0x41e6db,_0x5e66a0){if(_0x5149d9['body']['id']){delete _0x5149d9[_0x0faf('0x57')]['id'];}return db[_0x0faf('0x3b')][_0x0faf('0x55')]({'where':{'id':_0x5149d9[_0x0faf('0x52')]['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x41e6db,null))[_0x0faf('0x20')](function(_0x535843){if(_0x535843){_0x5149d9[_0x0faf('0x57')][_0x0faf('0x5f')]=_0x535843['id'];return db[_0x0faf('0x68')][_0x0faf('0x56')](_0x5149d9[_0x0faf('0x57')]);}})['then'](respondWithResult(_0x41e6db,null))['catch'](handleError(_0x41e6db,null));};exports[_0x0faf('0x69')]=function(_0x5b4ba7,_0x5efd66,_0x4bddce){var _0x2344a0={'raw':![],'where':{}};var _0x5bcca7={};var _0x23b330={'count':0x0,'rows':[]};return db[_0x0faf('0x3b')]['findOne']({'where':{'id':_0x5b4ba7[_0x0faf('0x52')]['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x5efd66,null))[_0x0faf('0x20')](function(_0x29d09d){if(_0x29d09d){_0x5bcca7['model']=_[_0x0faf('0x40')](db[_0x0faf('0x68')][_0x0faf('0x3c')]);_0x5bcca7[_0x0faf('0x41')]=_[_0x0faf('0x40')](_0x5b4ba7['query']);_0x5bcca7[_0x0faf('0x4a')]=_['intersection'](_0x5bcca7[_0x0faf('0x3f')],_0x5bcca7['query']);_0x2344a0[_0x0faf('0x42')]=_[_0x0faf('0x43')](_0x5bcca7[_0x0faf('0x3f')],qs[_0x0faf('0x44')](_0x5b4ba7['query']['fields']));_0x2344a0[_0x0faf('0x42')]=_0x2344a0[_0x0faf('0x42')][_0x0faf('0x45')]?_0x2344a0[_0x0faf('0x42')]:_0x5bcca7[_0x0faf('0x3f')];if(!_0x5b4ba7['query'][_0x0faf('0x46')]('nolimit')){_0x2344a0[_0x0faf('0x2f')]=qs[_0x0faf('0x2f')](_0x5b4ba7[_0x0faf('0x41')][_0x0faf('0x2f')]);_0x2344a0['offset']=qs[_0x0faf('0x62')](_0x5b4ba7[_0x0faf('0x41')]['offset']);}_0x2344a0[_0x0faf('0x48')]=qs[_0x0faf('0x63')](_0x5b4ba7[_0x0faf('0x41')][_0x0faf('0x63')]);_0x2344a0[_0x0faf('0x49')]=qs[_0x0faf('0x4a')](_[_0x0faf('0x6a')](_0x5b4ba7[_0x0faf('0x41')],_0x5bcca7['filters']));_0x2344a0[_0x0faf('0x49')][_0x0faf('0x5f')]=_0x29d09d['id'];if(_0x5b4ba7['query'][_0x0faf('0x64')]){_0x2344a0[_0x0faf('0x49')]=_['merge'](_0x2344a0[_0x0faf('0x49')],{'$or':_[_0x0faf('0x3a')](_0x2344a0['attributes'],function(_0x372115){var _0x39ae34={};_0x39ae34[_0x372115]={'$like':'%'+_0x5b4ba7[_0x0faf('0x41')][_0x0faf('0x64')]+'%'};return _0x39ae34;})});}_0x2344a0=_[_0x0faf('0x54')]({},_0x2344a0,_0x5b4ba7[_0x0faf('0x4c')]);return db[_0x0faf('0x68')][_0x0faf('0x2e')]({'where':_0x2344a0[_0x0faf('0x49')]})[_0x0faf('0x20')](function(_0x247553){_0x23b330[_0x0faf('0x2e')]=_0x247553;if(_0x5b4ba7[_0x0faf('0x41')][_0x0faf('0x4d')]){_0x2344a0['include']=[{'all':!![]}];}return db[_0x0faf('0x68')][_0x0faf('0x4f')](_0x2344a0);})[_0x0faf('0x20')](function(_0x160c8a){_0x23b330[_0x0faf('0x50')]=_0x160c8a;return _0x23b330;});}})['then'](respondWithFilteredResult(_0x5efd66,_0x2344a0))[_0x0faf('0x29')](handleError(_0x5efd66,null));};exports[_0x0faf('0x6b')]=function(_0x53e235,_0x7d5c05,_0x5e0a7d){return db[_0x0faf('0x3b')][_0x0faf('0x55')]({'where':{'id':_0x53e235[_0x0faf('0x52')]['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x7d5c05,null))[_0x0faf('0x20')](function(_0x132855){if(_0x132855){return _0x132855['removeAnswers'](_0x53e235[_0x0faf('0x41')][_0x0faf('0x66')]);}})[_0x0faf('0x20')](respondWithStatusCode(_0x7d5c05,null))[_0x0faf('0x29')](handleError(_0x7d5c05,null));};exports[_0x0faf('0x6c')]=function(_0x111d1f,_0x218254,_0x4aceb8){return db[_0x0faf('0x3b')][_0x0faf('0x55')]({'where':{'id':_0x111d1f['params']['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x218254,null))['then'](function(_0x2af5a1){if(_0x2af5a1){return _0x2af5a1['addAgents'](_0x111d1f[_0x0faf('0x57')][_0x0faf('0x66')],_['omit'](_0x111d1f[_0x0faf('0x57')],[_0x0faf('0x66'),'id'])||{})[_0x0faf('0x6d')](function(_0x5cdc19){for(var _0x54fa2d=0x0;_0x54fa2d<_0x111d1f[_0x0faf('0x57')][_0x0faf('0x66')][_0x0faf('0x45')];_0x54fa2d+=0x1){socket[_0x0faf('0x6e')](_0x0faf('0x6f'),{'UserId':_0x111d1f[_0x0faf('0x57')][_0x0faf('0x66')][_0x54fa2d],'WhatsappAccountId':_0x111d1f['params']['id']});}return _0x5cdc19;});}})[_0x0faf('0x20')](respondWithResult(_0x218254,null))[_0x0faf('0x29')](handleError(_0x218254,null));};exports['removeAgents']=function(_0x2521a9,_0x5bc1c6,_0x357c97){return db['WhatsappAccount'][_0x0faf('0x55')]({'where':{'id':_0x2521a9[_0x0faf('0x52')]['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x5bc1c6,null))[_0x0faf('0x20')](function(_0x3d0c2c){if(_0x3d0c2c){return _0x3d0c2c['removeAgents'](_0x2521a9[_0x0faf('0x41')][_0x0faf('0x66')])['then'](function(){if(_[_0x0faf('0x70')](_0x2521a9[_0x0faf('0x41')]['ids'])){for(var _0x447ed4=0x0;_0x447ed4<_0x2521a9[_0x0faf('0x41')][_0x0faf('0x66')][_0x0faf('0x45')];_0x447ed4+=0x1){socket['emit'](_0x0faf('0x71'),{'UserId':Number(_0x2521a9[_0x0faf('0x41')]['ids'][_0x447ed4]),'WhatsappAccountId':Number(_0x2521a9[_0x0faf('0x52')]['id'])});}}else{socket['emit'](_0x0faf('0x71'),{'UserId':Number(_0x2521a9[_0x0faf('0x41')][_0x0faf('0x66')]),'WhatsappAccountId':Number(_0x2521a9[_0x0faf('0x52')]['id'])});}});}})[_0x0faf('0x20')](respondWithStatusCode(_0x5bc1c6,null))[_0x0faf('0x29')](handleError(_0x5bc1c6,null));};exports[_0x0faf('0x72')]=function(_0x52faf4,_0x3dac33,_0x4a6e9e){var _0x538099={};var _0x4f15e4={};var _0x1b8941;var _0x12bcde;return db[_0x0faf('0x3b')]['findOne']({'where':{'id':_0x52faf4['params']['id']}})['then'](handleEntityNotFound(_0x3dac33,null))[_0x0faf('0x20')](function(_0x1ee2ef){if(_0x1ee2ef){_0x1b8941=_0x1ee2ef;_0x4f15e4[_0x0faf('0x3f')]=_[_0x0faf('0x40')](db[_0x0faf('0x73')][_0x0faf('0x3c')]);_0x4f15e4[_0x0faf('0x41')]=_[_0x0faf('0x40')](_0x52faf4[_0x0faf('0x41')]);_0x4f15e4[_0x0faf('0x4a')]=_[_0x0faf('0x43')](_0x4f15e4[_0x0faf('0x3f')],_0x4f15e4[_0x0faf('0x41')]);_0x538099['attributes']=_[_0x0faf('0x43')](_0x4f15e4[_0x0faf('0x3f')],qs[_0x0faf('0x44')](_0x52faf4[_0x0faf('0x41')][_0x0faf('0x44')]));_0x538099[_0x0faf('0x42')]=_0x538099[_0x0faf('0x42')][_0x0faf('0x45')]?_0x538099[_0x0faf('0x42')]:_0x4f15e4[_0x0faf('0x3f')];_0x538099[_0x0faf('0x48')]=qs[_0x0faf('0x63')](_0x52faf4['query'][_0x0faf('0x63')]);_0x538099[_0x0faf('0x49')]=qs['filters'](_[_0x0faf('0x6a')](_0x52faf4[_0x0faf('0x41')],_0x4f15e4['filters']));if(_0x52faf4['query'][_0x0faf('0x64')]){_0x538099['where']=_[_0x0faf('0x54')](_0x538099[_0x0faf('0x49')],{'$or':_[_0x0faf('0x3a')](_0x538099[_0x0faf('0x42')],function(_0x24b011){var _0x2f9fe8={};_0x2f9fe8[_0x24b011]={'$like':'%'+_0x52faf4[_0x0faf('0x41')][_0x0faf('0x64')]+'%'};return _0x2f9fe8;})});}_0x538099=_['merge']({},_0x538099,_0x52faf4['options']);return _0x1b8941['getAgents'](_0x538099);}})[_0x0faf('0x20')](function(_0x1a02f6){if(_0x1a02f6){_0x12bcde=_0x1a02f6[_0x0faf('0x45')];if(!_0x52faf4[_0x0faf('0x41')][_0x0faf('0x46')](_0x0faf('0x47'))){_0x538099['limit']=qs[_0x0faf('0x2f')](_0x52faf4[_0x0faf('0x41')][_0x0faf('0x2f')]);_0x538099['offset']=qs['offset'](_0x52faf4['query']['offset']);}return _0x1b8941['getAgents'](_0x538099);}})['then'](function(_0x1487f2){if(_0x1487f2){return _0x1487f2?{'count':_0x12bcde,'rows':_0x1487f2}:null;}})[_0x0faf('0x20')](respondWithResult(_0x3dac33,null))[_0x0faf('0x29')](handleError(_0x3dac33,null));};exports[_0x0faf('0x74')]=function(_0x398285,_0x49d561,_0x42a462){return db[_0x0faf('0x3b')][_0x0faf('0x61')]({'where':{'id':_0x398285['params']['id']}})[_0x0faf('0x20')](handleEntityNotFound(_0x49d561,null))['then'](function(_0x528f6e){if(_0x528f6e){return db[_0x0faf('0x75')][_0x0faf('0x76')](function(_0x5d0387){return db['WhatsappApplication'][_0x0faf('0x77')]({'where':{'WhatsappAccountId':_0x398285[_0x0faf('0x52')]['id']},'transaction':_0x5d0387})[_0x0faf('0x20')](function(_0x58ae53){var _0x4271fe=_['map'](_0x398285[_0x0faf('0x57')],function(_0x4031d9){_0x4031d9[_0x0faf('0x5f')]=_0x398285[_0x0faf('0x52')]['id'];return _0x4031d9;});return db[_0x0faf('0x78')][_0x0faf('0x79')](_0x4271fe,{'transaction':_0x5d0387});});})[_0x0faf('0x20')](function(){return db[_0x0faf('0x78')][_0x0faf('0x7a')]({'where':{'WhatsappAccountId':_0x398285[_0x0faf('0x52')]['id']},'order':_0x0faf('0x7b')});});}})[_0x0faf('0x20')](respondWithResult(_0x49d561,null))[_0x0faf('0x29')](handleError(_0x49d561,null));};exports['getApplications']=function(_0x592eed,_0x1492c4,_0x147f03){var _0x4acff2={};var _0x22fbc4={};var _0x5314e0;var _0x5dcb08;return db[_0x0faf('0x3b')][_0x0faf('0x61')]({'where':{'id':_0x592eed[_0x0faf('0x52')]['id']}})['then'](handleEntityNotFound(_0x1492c4,null))[_0x0faf('0x20')](function(_0x568b1e){if(_0x568b1e){_0x5314e0=_0x568b1e;_0x22fbc4[_0x0faf('0x3f')]=_[_0x0faf('0x40')](db['WhatsappApplication'][_0x0faf('0x3c')]);_0x22fbc4[_0x0faf('0x41')]=_[_0x0faf('0x40')](_0x592eed[_0x0faf('0x41')]);_0x22fbc4['filters']=_[_0x0faf('0x43')](_0x22fbc4[_0x0faf('0x3f')],_0x22fbc4[_0x0faf('0x41')]);_0x4acff2[_0x0faf('0x42')]=_['intersection'](_0x22fbc4['model'],qs[_0x0faf('0x44')](_0x592eed[_0x0faf('0x41')]['fields']));_0x4acff2[_0x0faf('0x42')]=_0x4acff2[_0x0faf('0x42')]['length']?_0x4acff2[_0x0faf('0x42')]:_0x22fbc4[_0x0faf('0x3f')];_0x4acff2[_0x0faf('0x48')]=qs[_0x0faf('0x63')](_0x592eed[_0x0faf('0x41')][_0x0faf('0x63')]);_0x4acff2[_0x0faf('0x49')]=qs[_0x0faf('0x4a')](_['pick'](_0x592eed[_0x0faf('0x41')],_0x22fbc4['filters']));if(_0x592eed[_0x0faf('0x41')]['filter']){_0x4acff2['where']=_[_0x0faf('0x54')](_0x4acff2[_0x0faf('0x49')],{'$or':_[_0x0faf('0x3a')](_0x4acff2[_0x0faf('0x42')],function(_0x2a33af){var _0x25901d={};_0x25901d[_0x2a33af]={'$like':'%'+_0x592eed[_0x0faf('0x41')]['filter']+'%'};return _0x25901d;})});}_0x4acff2=_[_0x0faf('0x54')]({},_0x4acff2,_0x592eed[_0x0faf('0x4c')]);return _0x5314e0[_0x0faf('0x7c')](_0x4acff2);}})[_0x0faf('0x20')](function(_0x1fb696){if(_0x1fb696){_0x5dcb08=_0x1fb696['length'];if(!_0x592eed[_0x0faf('0x41')][_0x0faf('0x46')]('nolimit')){_0x4acff2[_0x0faf('0x2f')]=qs[_0x0faf('0x2f')](_0x592eed['query'][_0x0faf('0x2f')]);_0x4acff2[_0x0faf('0x62')]=qs[_0x0faf('0x62')](_0x592eed[_0x0faf('0x41')][_0x0faf('0x62')]);}return _0x5314e0[_0x0faf('0x7c')](_0x4acff2);}})['then'](function(_0x1668f9){if(_0x1668f9){return _0x1668f9?{'count':_0x5dcb08,'rows':_0x1668f9}:null;}})[_0x0faf('0x20')](respondWithResult(_0x1492c4,null))[_0x0faf('0x29')](handleError(_0x1492c4,null));};exports['notify']=function(_0xd29ccc,_0x27518a,_0x55709e){var _0x340061={'channel':'whatsapp'};var _0x20537e=[];var _0x820e08=[];var _0x192ed4={};return db[_0x0faf('0x3b')]['find']({'where':{'id':_0xd29ccc[_0x0faf('0x52')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0faf('0x7d')}]})[_0x0faf('0x20')](handleEntityNotFound(_0x27518a,null))[_0x0faf('0x20')](function(_0x24f16a){_0x340061[_0x0faf('0x7e')]=_0x24f16a;_0x340061[_0x0faf('0x7f')]=_['orderBy'](_0x24f16a[_0x0faf('0x7d')],[_0x0faf('0x7b')],[_0x0faf('0x80')]);if(_0x340061[_0x0faf('0x7e')][_0x0faf('0x7d')]){delete _0x340061[_0x0faf('0x7e')][_0x0faf('0x7d')];}return db['CmContact'][_0x0faf('0x5d')]();})[_0x0faf('0x20')](function(_0x87475e){if(!_0x87475e){throw new db[(_0x0faf('0x81'))][(_0x0faf('0x82'))](_0x0faf('0x83'));}_0x20537e=_[_0x0faf('0x84')](_[_0x0faf('0x40')](_0x87475e),['createdAt',_0x0faf('0x85')]);_0x820e08=_[_0x0faf('0x84')](_[_0x0faf('0x40')](_0x87475e),[_0x0faf('0x86'),'updatedAt',_0x0faf('0x87'),_0x0faf('0x88')]);_0x340061['body']={'mapKey':_0x0faf('0x89')};if(_0x340061[_0x0faf('0x7e')][_0x0faf('0x3d')]&&_0x340061[_0x0faf('0x7e')][_0x0faf('0x3d')]===_0x0faf('0x8a')){_0x340061[_0x0faf('0x57')][_0x0faf('0x8b')]=_0xd29ccc[_0x0faf('0x57')][_0x0faf('0x8c')][_0x0faf('0x8d')]('whatsapp:','');_0x340061[_0x0faf('0x57')][_0x0faf('0x57')]=_0xd29ccc[_0x0faf('0x57')][_0x0faf('0x8e')];_0x340061[_0x0faf('0x57')][_0x0faf('0x8f')]=_0xd29ccc['body'][_0x0faf('0x90')];}if(_0x340061['body']['id']){delete _0x340061[_0x0faf('0x57')]['id'];}if(_[_0x0faf('0x91')](_0x340061[_0x0faf('0x57')][_0x0faf('0x8b')])){throw new db['Sequelize']['ValidationError'](_0x0faf('0x92'));}if(_[_0x0faf('0x91')](_0x340061[_0x0faf('0x57')]['body'])||_0x340061[_0x0faf('0x57')]['body']===''){throw new db[(_0x0faf('0x81'))][(_0x0faf('0x82'))](_0x0faf('0x93'));}if(_['isNil'](_0x340061[_0x0faf('0x57')][_0x0faf('0x94')])){throw new db['Sequelize'][(_0x0faf('0x82'))](_0x0faf('0x95')+_0x820e08);}if(!_['includes'](_0x820e08,_0x340061[_0x0faf('0x57')]['mapKey'])){throw new db['Sequelize'][(_0x0faf('0x82'))](_0x0faf('0x96')+_0x820e08);}_0x192ed4[_0x340061[_0x0faf('0x57')][_0x0faf('0x94')]]=_0x340061[_0x0faf('0x57')][_0x0faf('0x8b')];return db[_0x0faf('0x97')][_0x0faf('0x55')]({'where':{'id':_0x340061[_0x0faf('0x7e')][_0x0faf('0x88')]},'include':[{'model':db['CmContact'],'as':_0x0faf('0x98'),'where':_0x192ed4,'limit':0x1,'order':[[_0x0faf('0x85'),_0x0faf('0x99')]]}]});})['then'](handleEntityNotFound(_0x27518a,null))[_0x0faf('0x20')](function(_0xf26da2){if(_0xf26da2){_0x340061['list']=_[_0x0faf('0x9a')](_0xf26da2,[_0x0faf('0x98')]);if(_0xf26da2['Contacts'][_0x0faf('0x45')]){return _0xf26da2[_0x0faf('0x98')][0x0];}var _0x33789e=_[_0x0faf('0x1a')](_0x340061['body'],{'firstName':_0x340061['body'][_0x0faf('0x8b')],'ListId':_0xf26da2['id']});_0x33789e[_0x340061[_0x0faf('0x57')]['mapKey']]=_0x340061[_0x0faf('0x57')][_0x0faf('0x8b')];return db[_0x0faf('0x9b')]['create'](_0x33789e,{'fields':_0x20537e,'raw':!![]});}})[_0x0faf('0x20')](handleEntityNotFound(_0x27518a,null))[_0x0faf('0x20')](function(_0x48cd9e){if(_0x48cd9e){_0x340061['contact']=_0x48cd9e;var _0x318f6e={'ContactId':_0x48cd9e['id'],'phone':_0x340061[_0x0faf('0x57')][_0x0faf('0x8b')],'WhatsappAccountId':_0xd29ccc[_0x0faf('0x52')]['id']};var _0x38140e={'ContactId':_0x48cd9e['id'],'WhatsappAccountId':_0xd29ccc[_0x0faf('0x52')]['id'],'closed':![]};return db[_0x0faf('0x9c')]['find']({'where':_0x38140e})[_0x0faf('0x20')](function(_0x5d5c7d){if(_0x5d5c7d){return[_0x5d5c7d,![]];}return db[_0x0faf('0x9c')][_0x0faf('0x56')](_0x318f6e)[_0x0faf('0x20')](function(_0x15d5a0){return[_0x15d5a0,!![]];});});}})[_0x0faf('0x6d')](function(_0x16c60d,_0xa8c4b4){_0x340061['interaction']=_0x16c60d[_0x0faf('0x33')]({'plain':!![]});_0x340061[_0x0faf('0x9d')][_0x0faf('0x9e')]=![];if(_0xa8c4b4){if(_0x340061[_0x0faf('0x7e')][_0x0faf('0x9f')]){_0x340061['applications'][_0x0faf('0xa0')]({'id':0x0,'priority':_0x340061['applications'][_0x0faf('0x45')]+0x1,'app':_0x0faf('0xa1'),'appdata':'unmanaged','interval':_0x0faf('0xa2')});}_0x340061['interaction'][_0x0faf('0x9e')]=!![];}return db[_0x0faf('0xa3')]['create']({'phone':_0x340061[_0x0faf('0x57')]['from'],'messageId':_0x340061[_0x0faf('0x57')][_0x0faf('0x8f')],'body':_0x340061[_0x0faf('0x57')][_0x0faf('0x57')],'WhatsappAccountId':_0xd29ccc['params']['id'],'WhatsappInteractionId':_0x16c60d['id'],'direction':'in','ContactId':_0x16c60d['ContactId'],'AttachmentId':_0x340061[_0x0faf('0x57')][_0x0faf('0xa4')]});})[_0x0faf('0x20')](function(_0x524934){_0x340061[_0x0faf('0x27')]=_0x524934;if(_0x340061[_0x0faf('0x9d')][_0x0faf('0xa5')]){return db[_0x0faf('0x73')][_0x0faf('0x55')]({'attributes':['id',_0x0faf('0x36')],'where':{'id':_0x340061['interaction'][_0x0faf('0xa5')]}})[_0x0faf('0x20')](function(_0x216230){if(_0x216230){_0x340061[_0x0faf('0x7f')][_0x0faf('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x216230[_0x0faf('0x36')]+','+(_0x340061[_0x0faf('0x7e')]['waitForTheAssignedAgent']||0xa),'interval':_0x0faf('0xa2')});}return respondWithRpcPromise(_0x0faf('0xa7'),_0x0faf('0xa8'),_0x340061);});}return respondWithRpcPromise('Start',_0x0faf('0xa8'),_0x340061);})[_0x0faf('0x20')](function(_0x25fa2d){if(_0x25fa2d){var _0x591e06=0xc8;var _0x179656=_0x0faf('0xa9');logger['info'](_0x0faf('0x22'),_0x179656,_0x591e06,_0x0faf('0xaa'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x179656,_0x591e06,'entity\x20found',JSON[_0x0faf('0x24')](_0x25fa2d));if(_0x340061['account'][_0x0faf('0x3d')]===_0x0faf('0x8a')){return _0x27518a['status'](_0x591e06)['set'](_0x0faf('0xab'),_0x0faf('0xac'))[_0x0faf('0x37')](_0x0faf('0xad'));}else{return _0x27518a[_0x0faf('0x2b')](_0x591e06)[_0x0faf('0x2d')](_0x25fa2d);}}})[_0x0faf('0x29')](handleError(_0x27518a,null));};exports[_0x0faf('0x37')]=function(_0x3adc4f,_0x5298a5,_0x65a842){var _0x3beb46,_0x837a19,_0x1a0ec5;if(_[_0x0faf('0x91')](_0x3adc4f[_0x0faf('0x57')]['body'])||_0x3adc4f[_0x0faf('0x57')]['body']===''){throw new db[(_0x0faf('0x81'))][(_0x0faf('0x82'))](_0x0faf('0x93'));}if(_[_0x0faf('0x91')](_0x3adc4f[_0x0faf('0x57')]['to'])){throw new db[(_0x0faf('0x81'))]['ValidationError'](_0x0faf('0xae'));}_0x3beb46=_0x3adc4f[_0x0faf('0x57')]['to'];return db[_0x0faf('0x3b')][_0x0faf('0x55')]({'where':{'id':_0x3adc4f[_0x0faf('0x52')]['id']},'include':[{'model':db[_0x0faf('0x97')],'as':_0x0faf('0xaf'),'include':[{'model':db[_0x0faf('0x9b')],'as':_0x0faf('0x98'),'where':{'mobile':_0x3beb46},'limit':0x1,'order':[[_0x0faf('0x85'),_0x0faf('0x99')]]}]}]})['then'](handleEntityNotFound(_0x5298a5,null))[_0x0faf('0x20')](function(_0x395cac){if(_0x395cac&&_0x395cac['List']){_0x837a19=_0x395cac['get']({'plain':!![]});if(_0x837a19[_0x0faf('0xaf')]&&_0x837a19['List']['Contacts']['length']){return _0x837a19[_0x0faf('0xaf')][_0x0faf('0x98')][0x0];}return db[_0x0faf('0x9b')][_0x0faf('0x56')](_['defaults'](_0x3adc4f[_0x0faf('0x57')],{'firstName':_0x3beb46,'mobile':_0x3beb46,'phone':_0x3beb46,'ListId':_0x837a19[_0x0faf('0x88')]}));}})[_0x0faf('0x20')](handleEntityNotFound(_0x5298a5,null))['then'](function(_0x4aa268){if(_0x4aa268){_0x1a0ec5=_0x4aa268;return db['WhatsappInteraction'][_0x0faf('0x55')]({'where':{'ContactId':_0x1a0ec5['id'],'closed':![],'WhatsappAccountId':_0x837a19['id']}})[_0x0faf('0x20')](function(_0x345523){if(_0x345523){return[_0x345523,![]];}return db[_0x0faf('0x9c')][_0x0faf('0x56')]({'UserId':_0x3adc4f['user']['id'],'ContactId':_0x1a0ec5['id'],'WhatsappAccountId':_0x837a19['id'],'phone':_0x3beb46,'firstMsgDirection':'out','Messages':[_[_0x0faf('0x54')](_0x3adc4f[_0x0faf('0x57')],{'read':![],'body':_0x3adc4f['body'][_0x0faf('0x57')],'phone':_0x3beb46,'WhatsappAccountId':_0x837a19['id'],'UserId':_0x3adc4f[_0x0faf('0x58')]['id'],'ContactId':_0x1a0ec5['id']})]},{'include':[{'model':db[_0x0faf('0xa3')],'as':_0x0faf('0xb0')}]})[_0x0faf('0x20')](function(_0x50c722){return[_0x50c722,!![]];});});}})[_0x0faf('0x6d')](function(_0xba9847,_0xf34f51){if(_0xf34f51){return _0xba9847;}return db[_0x0faf('0xa3')][_0x0faf('0x56')](_[_0x0faf('0x54')](_0x3adc4f[_0x0faf('0x57')],{'read':![],'body':_0x3adc4f['body'][_0x0faf('0x57')],'phone':_0x3beb46,'WhatsappAccountId':_0x837a19['id'],'WhatsappInteractionId':_0xba9847['id'],'UserId':_0x3adc4f[_0x0faf('0x58')]['id'],'ContactId':_0x1a0ec5['id']}))[_0x0faf('0x20')](function(_0xff8ea4){_0xba9847[_0x0faf('0xb1')]['Messages']=[];_0xba9847[_0x0faf('0xb1')]['Messages'][_0x0faf('0xa0')](_0xff8ea4[_0x0faf('0xb1')]);return _0xba9847;});})[_0x0faf('0x20')](respondWithResult(_0x5298a5,null))[_0x0faf('0x29')](handleError(_0x5298a5,null));}; \ No newline at end of file +var _0x2b7f=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','then','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','save','update','get','destroy','sendStatus','stack','name','send','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','find','userProfileId','autoAssociation','UserProfileResource','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','close','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto'];(function(_0x478b61,_0x542c3a){var _0x3fd573=function(_0x457830){while(--_0x457830){_0x478b61['push'](_0x478b61['shift']());}};_0x3fd573(++_0x542c3a);}(_0x2b7f,0x16c));var _0xf2b7=function(_0x1d1a82,_0x244d7f){_0x1d1a82=_0x1d1a82-0x0;var _0x263968=_0x2b7f[_0x1d1a82];return _0x263968;};'use strict';var pdf=require(_0xf2b7('0x0'));var emlformat=require(_0xf2b7('0x1'));var rimraf=require(_0xf2b7('0x2'));var zipdir=require(_0xf2b7('0x3'));var jsonpatch=require(_0xf2b7('0x4'));var rp=require(_0xf2b7('0x5'));var moment=require(_0xf2b7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf2b7('0x7'));var util=require(_0xf2b7('0x8'));var path=require(_0xf2b7('0x9'));var sox=require(_0xf2b7('0xa'));var csv=require(_0xf2b7('0xb'));var ejs=require(_0xf2b7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf2b7('0xd'));var jsforce=require(_0xf2b7('0xe'));var deskjs=require(_0xf2b7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf2b7('0x10'));var Papa=require(_0xf2b7('0x11'));var Redis=require(_0xf2b7('0x12'));var authService=require(_0xf2b7('0x13'));var qs=require(_0xf2b7('0x14'));var as=require(_0xf2b7('0x15'));var hardwareService=require(_0xf2b7('0x16'));var logger=require('../../config/logger')(_0xf2b7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf2b7('0x18'));var db=require('../../mysqldb')['db'];config[_0xf2b7('0x19')]=_['defaults'](config['redis'],{'host':_0xf2b7('0x1a'),'port':0x18eb});var socket=require(_0xf2b7('0x1b'))(new Redis(config['redis']));require(_0xf2b7('0x1c'))[_0xf2b7('0x1d')](socket);var jayson=require(_0xf2b7('0x1e'));var client=jayson[_0xf2b7('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b2afe,_0x1ac69e,_0x4e4ed2,_0x510f9f){return new BPromise(function(_0x1b28f5,_0xafb94c){var _0x9d9aa6=_0x510f9f||client;return _0x9d9aa6['request'](_0x3b2afe,_0x4e4ed2)[_0xf2b7('0x20')](function(_0x4b22d8){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1ac69e,'request\x20sent');logger[_0xf2b7('0x21')](_0xf2b7('0x22'),_0x1ac69e,_0xf2b7('0x23'),JSON[_0xf2b7('0x24')](_0x4b22d8));if(_0x4b22d8['error']){if(_0x4b22d8['error'][_0xf2b7('0x25')]===0x1f4){logger[_0xf2b7('0x26')](_0xf2b7('0x27'),_0x1ac69e,_0x4b22d8[_0xf2b7('0x26')][_0xf2b7('0x28')]);return _0xafb94c(_0x4b22d8['error'][_0xf2b7('0x28')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1ac69e,_0x4b22d8[_0xf2b7('0x26')][_0xf2b7('0x28')]);return _0x1b28f5(_0x4b22d8[_0xf2b7('0x26')][_0xf2b7('0x28')]);}else{logger[_0xf2b7('0x29')](_0xf2b7('0x27'),_0x1ac69e,'request\x20sent');_0x1b28f5(_0x4b22d8[_0xf2b7('0x2a')][_0xf2b7('0x28')]);}})[_0xf2b7('0x2b')](function(_0x35222e){logger[_0xf2b7('0x26')](_0xf2b7('0x27'),_0x1ac69e,_0x35222e);_0xafb94c(_0x35222e);});});}function respondWithStatusCode(_0x4b72d6,_0x23b993){_0x23b993=_0x23b993||0xcc;return function(_0x427f17){if(_0x427f17){return _0x4b72d6['sendStatus'](_0x23b993);}return _0x4b72d6[_0xf2b7('0x2c')](_0x23b993)[_0xf2b7('0x2d')]();};}function respondWithResult(_0x3ca63b,_0x5a821f){_0x5a821f=_0x5a821f||0xc8;return function(_0x403a5d){if(_0x403a5d){return _0x3ca63b[_0xf2b7('0x2c')](_0x5a821f)[_0xf2b7('0x2e')](_0x403a5d);}};}function respondWithFilteredResult(_0x160e86,_0x1ef90e){return function(_0x4ea184){if(_0x4ea184){var _0x9ae018=_0x4ea184[_0xf2b7('0x2f')],_0xab17eb=_0x1ef90e[_0xf2b7('0x30')],_0x58bf59=_0x1ef90e['offset']+_0x1ef90e[_0xf2b7('0x31')],_0x2c7cbb;if(_0x58bf59>=_0x9ae018){_0x58bf59=_0x9ae018;_0x2c7cbb=0xc8;}else{_0x2c7cbb=0xce;}_0x160e86[_0xf2b7('0x2c')](_0x2c7cbb);return _0x160e86[_0xf2b7('0x32')](_0xf2b7('0x33'),_0xab17eb+'-'+_0x58bf59+'/'+_0x9ae018)[_0xf2b7('0x2e')](_0x4ea184);}return null;};}function patchUpdates(_0x3baa3a){return function(_0x37c2a7){try{jsonpatch['apply'](_0x37c2a7,_0x3baa3a,!![]);}catch(_0x496503){return BPromise['reject'](_0x496503);}return _0x37c2a7[_0xf2b7('0x34')]();};}function saveUpdates(_0x27c000,_0x44cf93){return function(_0x474edd){if(_0x474edd){return _0x474edd[_0xf2b7('0x35')](_0x27c000)[_0xf2b7('0x20')](function(_0x1192b1){return _0x1192b1;});}return null;};}function removeEntity(_0x3c7889,_0x37c4bb){return function(_0x2c942d){if(_0x2c942d){return _0x2c942d['destroy']()['then'](function(){var _0x467a0c=_0x2c942d[_0xf2b7('0x36')]({'plain':!![]});var _0x557dfe='WhatsappAccounts';return db['UserProfileResource'][_0xf2b7('0x37')]({'where':{'type':_0x557dfe,'resourceId':_0x467a0c['id']}})[_0xf2b7('0x20')](function(){return _0x2c942d;});})[_0xf2b7('0x20')](function(){_0x3c7889['status'](0xcc)[_0xf2b7('0x2d')]();});}};}function handleEntityNotFound(_0x229f30,_0x504923){return function(_0x2f45fe){if(!_0x2f45fe){_0x229f30[_0xf2b7('0x38')](0x194);}return _0x2f45fe;};}function handleError(_0x5036b5,_0x366fd7){_0x366fd7=_0x366fd7||0x1f4;return function(_0x1fe04f){logger[_0xf2b7('0x26')](_0x1fe04f[_0xf2b7('0x39')]);if(_0x1fe04f[_0xf2b7('0x3a')]){delete _0x1fe04f[_0xf2b7('0x3a')];}_0x5036b5[_0xf2b7('0x2c')](_0x366fd7)[_0xf2b7('0x3b')](_0x1fe04f);};}exports['index']=function(_0x5add5f,_0x450d5f){var _0x5020f4={'include':[{'model':db['Pause'],'as':_0xf2b7('0x3c')}]},_0x32b753={},_0x52ec9a={'count':0x0,'rows':[]};var _0x2aca86=_[_0xf2b7('0x3d')](db[_0xf2b7('0x3e')][_0xf2b7('0x3f')],function(_0x9f3e6c){return{'name':_0x9f3e6c[_0xf2b7('0x40')],'type':_0x9f3e6c[_0xf2b7('0x41')][_0xf2b7('0x42')]};});_0x32b753[_0xf2b7('0x43')]=_['map'](_0x2aca86,_0xf2b7('0x3a'));_0x32b753[_0xf2b7('0x44')]=_[_0xf2b7('0x45')](_0x5add5f[_0xf2b7('0x44')]);_0x32b753[_0xf2b7('0x46')]=_['intersection'](_0x32b753[_0xf2b7('0x43')],_0x32b753[_0xf2b7('0x44')]);_0x5020f4['attributes']=_[_0xf2b7('0x47')](_0x32b753['model'],qs[_0xf2b7('0x48')](_0x5add5f['query'][_0xf2b7('0x48')]));_0x5020f4['attributes']=_0x5020f4[_0xf2b7('0x49')][_0xf2b7('0x4a')]?_0x5020f4['attributes']:_0x32b753[_0xf2b7('0x43')];if(!_0x5add5f[_0xf2b7('0x44')]['hasOwnProperty'](_0xf2b7('0x4b'))){_0x5020f4[_0xf2b7('0x31')]=qs['limit'](_0x5add5f['query'][_0xf2b7('0x31')]);_0x5020f4[_0xf2b7('0x30')]=qs[_0xf2b7('0x30')](_0x5add5f[_0xf2b7('0x44')][_0xf2b7('0x30')]);}_0x5020f4[_0xf2b7('0x4c')]=qs[_0xf2b7('0x4d')](_0x5add5f[_0xf2b7('0x44')]['sort']);_0x5020f4['where']=qs[_0xf2b7('0x46')](_[_0xf2b7('0x4e')](_0x5add5f[_0xf2b7('0x44')],_0x32b753[_0xf2b7('0x46')]),_0x2aca86);if(_0x5add5f[_0xf2b7('0x44')]['filter']){_0x5020f4[_0xf2b7('0x4f')]=_['merge'](_0x5020f4[_0xf2b7('0x4f')],{'$or':_[_0xf2b7('0x3d')](_0x2aca86,function(_0x94de80){if(_0x94de80[_0xf2b7('0x41')]!==_0xf2b7('0x50')){var _0x2f6714={};_0x2f6714[_0x94de80[_0xf2b7('0x3a')]]={'$like':'%'+_0x5add5f[_0xf2b7('0x44')][_0xf2b7('0x51')]+'%'};return _0x2f6714;}})});}_0x5020f4=_[_0xf2b7('0x52')]({},_0x5020f4,_0x5add5f[_0xf2b7('0x53')]);var _0x40dd66={'where':_0x5020f4[_0xf2b7('0x4f')]};return db[_0xf2b7('0x3e')]['count'](_0x40dd66)[_0xf2b7('0x20')](function(_0xf5154b){_0x52ec9a[_0xf2b7('0x2f')]=_0xf5154b;if(_0x5add5f[_0xf2b7('0x44')][_0xf2b7('0x54')]){_0x5020f4['include']=[{'all':!![]}];}return db[_0xf2b7('0x3e')][_0xf2b7('0x55')](_0x5020f4);})[_0xf2b7('0x20')](function(_0x213577){_0x52ec9a[_0xf2b7('0x56')]=_0x213577;return _0x52ec9a;})['then'](respondWithFilteredResult(_0x450d5f,_0x5020f4))['catch'](handleError(_0x450d5f,null));};exports[_0xf2b7('0x57')]=function(_0x166192,_0x409ebd){var _0x3bf06e={'raw':![],'where':{'id':_0x166192[_0xf2b7('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xf2b7('0x3c')}]},_0x440591={};_0x440591['model']=_[_0xf2b7('0x45')](db['WhatsappAccount'][_0xf2b7('0x3f')]);_0x440591[_0xf2b7('0x44')]=_[_0xf2b7('0x45')](_0x166192[_0xf2b7('0x44')]);_0x440591[_0xf2b7('0x46')]=_[_0xf2b7('0x47')](_0x440591[_0xf2b7('0x43')],_0x440591[_0xf2b7('0x44')]);_0x3bf06e[_0xf2b7('0x49')]=_['intersection'](_0x440591[_0xf2b7('0x43')],qs[_0xf2b7('0x48')](_0x166192[_0xf2b7('0x44')][_0xf2b7('0x48')]));_0x3bf06e[_0xf2b7('0x49')]=_0x3bf06e[_0xf2b7('0x49')]['length']?_0x3bf06e[_0xf2b7('0x49')]:_0x440591[_0xf2b7('0x43')];if(_0x166192['query'][_0xf2b7('0x54')]){_0x3bf06e[_0xf2b7('0x59')]=[{'all':!![]}];}_0x3bf06e=_[_0xf2b7('0x52')]({},_0x3bf06e,_0x166192[_0xf2b7('0x53')]);return db[_0xf2b7('0x3e')]['find'](_0x3bf06e)[_0xf2b7('0x20')](handleEntityNotFound(_0x409ebd,null))[_0xf2b7('0x20')](respondWithResult(_0x409ebd,null))[_0xf2b7('0x2b')](handleError(_0x409ebd,null));};exports[_0xf2b7('0x5a')]=function(_0x278242,_0x1caeb6){return db[_0xf2b7('0x3e')]['create'](_0x278242[_0xf2b7('0x5b')],{})[_0xf2b7('0x20')](function(_0x30e239){var _0x25a314=_0x278242[_0xf2b7('0x5c')]['get']({'plain':!![]});if(!_0x25a314)throw new Error(_0xf2b7('0x5d'));if(_0x25a314[_0xf2b7('0x5e')]===_0xf2b7('0x5c')){var _0x4db50c=_0x30e239[_0xf2b7('0x36')]({'plain':!![]});var _0xef4d46=_0xf2b7('0x5f');return db['UserProfileSection'][_0xf2b7('0x60')]({'where':{'name':_0xef4d46,'userProfileId':_0x25a314[_0xf2b7('0x61')]},'raw':!![]})[_0xf2b7('0x20')](function(_0x27e564){if(_0x27e564&&_0x27e564[_0xf2b7('0x62')]===0x0){return db[_0xf2b7('0x63')][_0xf2b7('0x5a')]({'name':_0x4db50c[_0xf2b7('0x3a')],'resourceId':_0x4db50c['id'],'type':_0x27e564[_0xf2b7('0x3a')],'sectionId':_0x27e564['id']},{})[_0xf2b7('0x20')](function(){return _0x30e239;});}else{return _0x30e239;}})['catch'](function(_0x51ca62){logger[_0xf2b7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51ca62);throw _0x51ca62;});}return _0x30e239;})[_0xf2b7('0x20')](respondWithResult(_0x1caeb6,0xc9))['catch'](handleError(_0x1caeb6,null));};exports[_0xf2b7('0x35')]=function(_0x4dd149,_0x2f99e2){if(_0x4dd149[_0xf2b7('0x5b')]['id']){delete _0x4dd149[_0xf2b7('0x5b')]['id'];}return db['WhatsappAccount'][_0xf2b7('0x60')]({'where':{'id':_0x4dd149[_0xf2b7('0x58')]['id']},'include':[{'model':db[_0xf2b7('0x64')],'as':_0xf2b7('0x3c')}]})['then'](handleEntityNotFound(_0x2f99e2,null))['then'](saveUpdates(_0x4dd149[_0xf2b7('0x5b')],null))[_0xf2b7('0x20')](respondWithResult(_0x2f99e2,null))[_0xf2b7('0x2b')](handleError(_0x2f99e2,null));};exports['destroy']=function(_0x12a5fa,_0x226add){return db[_0xf2b7('0x3e')][_0xf2b7('0x60')]({'where':{'id':_0x12a5fa[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x226add,null))[_0xf2b7('0x20')](removeEntity(_0x226add,null))[_0xf2b7('0x2b')](handleError(_0x226add,null));};exports[_0xf2b7('0x65')]=function(_0x50446e,_0x5713c0){return db[_0xf2b7('0x3e')][_0xf2b7('0x65')]()['then'](respondWithResult(_0x5713c0,null))[_0xf2b7('0x2b')](handleError(_0x5713c0,null));};exports[_0xf2b7('0x66')]=function(_0x51959f,_0x3bb56e,_0x5b5c6f){if(_0x51959f['body']['id']){delete _0x51959f[_0xf2b7('0x5b')]['id'];}return db[_0xf2b7('0x3e')][_0xf2b7('0x60')]({'where':{'id':_0x51959f[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x3bb56e,null))[_0xf2b7('0x20')](function(_0x18b714){if(_0x18b714){_0x51959f['body'][_0xf2b7('0x67')]=_0x18b714['id'];return db[_0xf2b7('0x68')]['create'](_0x51959f['body']);}})['then'](respondWithResult(_0x3bb56e,null))[_0xf2b7('0x2b')](handleError(_0x3bb56e,null));};exports[_0xf2b7('0x69')]=function(_0x12100d,_0xfb6115,_0x207280){var _0x15314e={'raw':![],'where':{}};var _0x23dd48={};var _0x49d457={'count':0x0,'rows':[]};return db[_0xf2b7('0x3e')]['findOne']({'where':{'id':_0x12100d['params']['id']}})['then'](handleEntityNotFound(_0xfb6115,null))[_0xf2b7('0x20')](function(_0x1aca5f){if(_0x1aca5f){_0x23dd48[_0xf2b7('0x43')]=_['keys'](db['Disposition'][_0xf2b7('0x3f')]);_0x23dd48[_0xf2b7('0x44')]=_[_0xf2b7('0x45')](_0x12100d[_0xf2b7('0x44')]);_0x23dd48[_0xf2b7('0x46')]=_[_0xf2b7('0x47')](_0x23dd48[_0xf2b7('0x43')],_0x23dd48['query']);_0x15314e['attributes']=_[_0xf2b7('0x47')](_0x23dd48[_0xf2b7('0x43')],qs[_0xf2b7('0x48')](_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x48')]));_0x15314e[_0xf2b7('0x49')]=_0x15314e[_0xf2b7('0x49')][_0xf2b7('0x4a')]?_0x15314e[_0xf2b7('0x49')]:_0x23dd48['model'];if(!_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x6a')](_0xf2b7('0x4b'))){_0x15314e[_0xf2b7('0x31')]=qs[_0xf2b7('0x31')](_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x31')]);_0x15314e['offset']=qs[_0xf2b7('0x30')](_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x30')]);}_0x15314e['order']=qs[_0xf2b7('0x4d')](_0x12100d['query'][_0xf2b7('0x4d')]);_0x15314e[_0xf2b7('0x4f')]=qs[_0xf2b7('0x46')](_['pick'](_0x12100d[_0xf2b7('0x44')],_0x23dd48[_0xf2b7('0x46')]));_0x15314e['where'][_0xf2b7('0x67')]=_0x1aca5f['id'];if(_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x51')]){_0x15314e[_0xf2b7('0x4f')]=_['merge'](_0x15314e[_0xf2b7('0x4f')],{'$or':_['map'](_0x15314e[_0xf2b7('0x49')],function(_0x164013){var _0x296a18={};_0x296a18[_0x164013]={'$like':'%'+_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x51')]+'%'};return _0x296a18;})});}_0x15314e=_['merge']({},_0x15314e,_0x12100d[_0xf2b7('0x53')]);return db[_0xf2b7('0x68')][_0xf2b7('0x2f')]({'where':_0x15314e[_0xf2b7('0x4f')]})[_0xf2b7('0x20')](function(_0x443300){_0x49d457[_0xf2b7('0x2f')]=_0x443300;if(_0x12100d[_0xf2b7('0x44')][_0xf2b7('0x54')]){_0x15314e[_0xf2b7('0x59')]=[{'all':!![]}];}return db[_0xf2b7('0x68')]['findAll'](_0x15314e);})[_0xf2b7('0x20')](function(_0x30f0f0){_0x49d457[_0xf2b7('0x56')]=_0x30f0f0;return _0x49d457;});}})[_0xf2b7('0x20')](respondWithFilteredResult(_0xfb6115,_0x15314e))[_0xf2b7('0x2b')](handleError(_0xfb6115,null));};exports['removeDispositions']=function(_0x42fd7b,_0x1cca48,_0xd90a4d){return db[_0xf2b7('0x3e')]['find']({'where':{'id':_0x42fd7b[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x1cca48,null))[_0xf2b7('0x20')](function(_0x4cd614){if(_0x4cd614){return _0x4cd614['removeDispositions'](_0x42fd7b[_0xf2b7('0x44')][_0xf2b7('0x6b')]);}})[_0xf2b7('0x20')](respondWithStatusCode(_0x1cca48,null))['catch'](handleError(_0x1cca48,null));};exports[_0xf2b7('0x6c')]=function(_0x53a58d,_0x42bbad,_0xb20314){if(_0x53a58d['body']['id']){delete _0x53a58d[_0xf2b7('0x5b')]['id'];}return db[_0xf2b7('0x3e')][_0xf2b7('0x60')]({'where':{'id':_0x53a58d['params']['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x42bbad,null))[_0xf2b7('0x20')](function(_0x142512){if(_0x142512){_0x53a58d[_0xf2b7('0x5b')][_0xf2b7('0x67')]=_0x142512['id'];return db[_0xf2b7('0x6d')][_0xf2b7('0x5a')](_0x53a58d[_0xf2b7('0x5b')]);}})[_0xf2b7('0x20')](respondWithResult(_0x42bbad,null))['catch'](handleError(_0x42bbad,null));};exports['getAnswers']=function(_0x5bee99,_0x5ab82e,_0x23b4ae){var _0x3fd29a={'raw':![],'where':{}};var _0x94ef76={};var _0x59a006={'count':0x0,'rows':[]};return db[_0xf2b7('0x3e')][_0xf2b7('0x6e')]({'where':{'id':_0x5bee99[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x5ab82e,null))[_0xf2b7('0x20')](function(_0x531991){if(_0x531991){_0x94ef76[_0xf2b7('0x43')]=_[_0xf2b7('0x45')](db[_0xf2b7('0x6d')]['rawAttributes']);_0x94ef76[_0xf2b7('0x44')]=_[_0xf2b7('0x45')](_0x5bee99[_0xf2b7('0x44')]);_0x94ef76[_0xf2b7('0x46')]=_['intersection'](_0x94ef76[_0xf2b7('0x43')],_0x94ef76['query']);_0x3fd29a[_0xf2b7('0x49')]=_[_0xf2b7('0x47')](_0x94ef76[_0xf2b7('0x43')],qs[_0xf2b7('0x48')](_0x5bee99['query']['fields']));_0x3fd29a[_0xf2b7('0x49')]=_0x3fd29a['attributes'][_0xf2b7('0x4a')]?_0x3fd29a[_0xf2b7('0x49')]:_0x94ef76['model'];if(!_0x5bee99[_0xf2b7('0x44')][_0xf2b7('0x6a')](_0xf2b7('0x4b'))){_0x3fd29a[_0xf2b7('0x31')]=qs[_0xf2b7('0x31')](_0x5bee99[_0xf2b7('0x44')][_0xf2b7('0x31')]);_0x3fd29a[_0xf2b7('0x30')]=qs[_0xf2b7('0x30')](_0x5bee99[_0xf2b7('0x44')][_0xf2b7('0x30')]);}_0x3fd29a[_0xf2b7('0x4c')]=qs[_0xf2b7('0x4d')](_0x5bee99[_0xf2b7('0x44')][_0xf2b7('0x4d')]);_0x3fd29a['where']=qs['filters'](_['pick'](_0x5bee99[_0xf2b7('0x44')],_0x94ef76[_0xf2b7('0x46')]));_0x3fd29a[_0xf2b7('0x4f')][_0xf2b7('0x67')]=_0x531991['id'];if(_0x5bee99[_0xf2b7('0x44')][_0xf2b7('0x51')]){_0x3fd29a['where']=_[_0xf2b7('0x52')](_0x3fd29a['where'],{'$or':_[_0xf2b7('0x3d')](_0x3fd29a[_0xf2b7('0x49')],function(_0x1bed2d){var _0x33554d={};_0x33554d[_0x1bed2d]={'$like':'%'+_0x5bee99[_0xf2b7('0x44')][_0xf2b7('0x51')]+'%'};return _0x33554d;})});}_0x3fd29a=_[_0xf2b7('0x52')]({},_0x3fd29a,_0x5bee99['options']);return db[_0xf2b7('0x6d')][_0xf2b7('0x2f')]({'where':_0x3fd29a[_0xf2b7('0x4f')]})[_0xf2b7('0x20')](function(_0x16f089){_0x59a006['count']=_0x16f089;if(_0x5bee99[_0xf2b7('0x44')]['includeAll']){_0x3fd29a['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3fd29a);})['then'](function(_0x1628e2){_0x59a006[_0xf2b7('0x56')]=_0x1628e2;return _0x59a006;});}})[_0xf2b7('0x20')](respondWithFilteredResult(_0x5ab82e,_0x3fd29a))[_0xf2b7('0x2b')](handleError(_0x5ab82e,null));};exports[_0xf2b7('0x6f')]=function(_0x5c902a,_0x5e21be,_0x12b324){return db['WhatsappAccount'][_0xf2b7('0x60')]({'where':{'id':_0x5c902a[_0xf2b7('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e21be,null))[_0xf2b7('0x20')](function(_0xe6c8b1){if(_0xe6c8b1){return _0xe6c8b1[_0xf2b7('0x6f')](_0x5c902a['query'][_0xf2b7('0x6b')]);}})[_0xf2b7('0x20')](respondWithStatusCode(_0x5e21be,null))['catch'](handleError(_0x5e21be,null));};exports[_0xf2b7('0x70')]=function(_0x1841d6,_0x26aafa,_0x4072e0){return db[_0xf2b7('0x3e')][_0xf2b7('0x60')]({'where':{'id':_0x1841d6['params']['id']}})['then'](handleEntityNotFound(_0x26aafa,null))[_0xf2b7('0x20')](function(_0x3130a4){if(_0x3130a4){return _0x3130a4[_0xf2b7('0x70')](_0x1841d6[_0xf2b7('0x5b')]['ids'],_[_0xf2b7('0x71')](_0x1841d6['body'],[_0xf2b7('0x6b'),'id'])||{})['spread'](function(_0x4d3b0b){for(var _0x27f75f=0x0;_0x27f75f<_0x1841d6[_0xf2b7('0x5b')][_0xf2b7('0x6b')][_0xf2b7('0x4a')];_0x27f75f+=0x1){socket['emit'](_0xf2b7('0x72'),{'UserId':_0x1841d6[_0xf2b7('0x5b')][_0xf2b7('0x6b')][_0x27f75f],'WhatsappAccountId':_0x1841d6['params']['id']});}return _0x4d3b0b;});}})[_0xf2b7('0x20')](respondWithResult(_0x26aafa,null))[_0xf2b7('0x2b')](handleError(_0x26aafa,null));};exports[_0xf2b7('0x73')]=function(_0x57548d,_0x513e14,_0x2856e6){return db[_0xf2b7('0x3e')]['find']({'where':{'id':_0x57548d[_0xf2b7('0x58')]['id']}})['then'](handleEntityNotFound(_0x513e14,null))[_0xf2b7('0x20')](function(_0x4fdc30){if(_0x4fdc30){return _0x4fdc30[_0xf2b7('0x73')](_0x57548d[_0xf2b7('0x44')][_0xf2b7('0x6b')])[_0xf2b7('0x20')](function(){if(_[_0xf2b7('0x74')](_0x57548d['query'][_0xf2b7('0x6b')])){for(var _0x5a6651=0x0;_0x5a6651<_0x57548d[_0xf2b7('0x44')][_0xf2b7('0x6b')][_0xf2b7('0x4a')];_0x5a6651+=0x1){socket[_0xf2b7('0x75')](_0xf2b7('0x76'),{'UserId':Number(_0x57548d[_0xf2b7('0x44')][_0xf2b7('0x6b')][_0x5a6651]),'WhatsappAccountId':Number(_0x57548d['params']['id'])});}}else{socket['emit'](_0xf2b7('0x76'),{'UserId':Number(_0x57548d['query']['ids']),'WhatsappAccountId':Number(_0x57548d[_0xf2b7('0x58')]['id'])});}});}})[_0xf2b7('0x20')](respondWithStatusCode(_0x513e14,null))[_0xf2b7('0x2b')](handleError(_0x513e14,null));};exports[_0xf2b7('0x77')]=function(_0x504c17,_0x9ca9da,_0x189e49){var _0x59c774={};var _0x4d7d84={};var _0x196ed9;var _0x1d2a8d;return db[_0xf2b7('0x3e')][_0xf2b7('0x6e')]({'where':{'id':_0x504c17[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x9ca9da,null))[_0xf2b7('0x20')](function(_0x44a76c){if(_0x44a76c){_0x196ed9=_0x44a76c;_0x4d7d84['model']=_[_0xf2b7('0x45')](db[_0xf2b7('0x78')][_0xf2b7('0x3f')]);_0x4d7d84['query']=_[_0xf2b7('0x45')](_0x504c17['query']);_0x4d7d84['filters']=_['intersection'](_0x4d7d84[_0xf2b7('0x43')],_0x4d7d84[_0xf2b7('0x44')]);_0x59c774[_0xf2b7('0x49')]=_[_0xf2b7('0x47')](_0x4d7d84[_0xf2b7('0x43')],qs[_0xf2b7('0x48')](_0x504c17[_0xf2b7('0x44')][_0xf2b7('0x48')]));_0x59c774[_0xf2b7('0x49')]=_0x59c774[_0xf2b7('0x49')][_0xf2b7('0x4a')]?_0x59c774[_0xf2b7('0x49')]:_0x4d7d84[_0xf2b7('0x43')];_0x59c774[_0xf2b7('0x4c')]=qs['sort'](_0x504c17[_0xf2b7('0x44')][_0xf2b7('0x4d')]);_0x59c774['where']=qs['filters'](_[_0xf2b7('0x4e')](_0x504c17[_0xf2b7('0x44')],_0x4d7d84[_0xf2b7('0x46')]));if(_0x504c17[_0xf2b7('0x44')][_0xf2b7('0x51')]){_0x59c774[_0xf2b7('0x4f')]=_[_0xf2b7('0x52')](_0x59c774[_0xf2b7('0x4f')],{'$or':_[_0xf2b7('0x3d')](_0x59c774[_0xf2b7('0x49')],function(_0x400598){var _0x25e436={};_0x25e436[_0x400598]={'$like':'%'+_0x504c17[_0xf2b7('0x44')]['filter']+'%'};return _0x25e436;})});}_0x59c774=_[_0xf2b7('0x52')]({},_0x59c774,_0x504c17[_0xf2b7('0x53')]);return _0x196ed9['getAgents'](_0x59c774);}})[_0xf2b7('0x20')](function(_0x7f98a9){if(_0x7f98a9){_0x1d2a8d=_0x7f98a9[_0xf2b7('0x4a')];if(!_0x504c17[_0xf2b7('0x44')]['hasOwnProperty'](_0xf2b7('0x4b'))){_0x59c774[_0xf2b7('0x31')]=qs[_0xf2b7('0x31')](_0x504c17[_0xf2b7('0x44')][_0xf2b7('0x31')]);_0x59c774['offset']=qs[_0xf2b7('0x30')](_0x504c17['query'][_0xf2b7('0x30')]);}return _0x196ed9[_0xf2b7('0x77')](_0x59c774);}})[_0xf2b7('0x20')](function(_0x2dcde8){if(_0x2dcde8){return _0x2dcde8?{'count':_0x1d2a8d,'rows':_0x2dcde8}:null;}})['then'](respondWithResult(_0x9ca9da,null))[_0xf2b7('0x2b')](handleError(_0x9ca9da,null));};exports[_0xf2b7('0x79')]=function(_0x2b2764,_0x17731b,_0x2a8ca1){return db[_0xf2b7('0x3e')]['findOne']({'where':{'id':_0x2b2764[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x17731b,null))[_0xf2b7('0x20')](function(_0x284dbd){if(_0x284dbd){return db['sequelize'][_0xf2b7('0x7a')](function(_0x2754d9){return db[_0xf2b7('0x7b')][_0xf2b7('0x37')]({'where':{'WhatsappAccountId':_0x2b2764[_0xf2b7('0x58')]['id']},'transaction':_0x2754d9})[_0xf2b7('0x20')](function(_0x379281){var _0x394013=_['map'](_0x2b2764[_0xf2b7('0x5b')],function(_0x175814){_0x175814[_0xf2b7('0x67')]=_0x2b2764['params']['id'];return _0x175814;});return db[_0xf2b7('0x7b')][_0xf2b7('0x7c')](_0x394013,{'transaction':_0x2754d9});});})[_0xf2b7('0x20')](function(){return db['WhatsappApplication'][_0xf2b7('0x7d')]({'where':{'WhatsappAccountId':_0x2b2764['params']['id']},'order':'priority'});});}})[_0xf2b7('0x20')](respondWithResult(_0x17731b,null))[_0xf2b7('0x2b')](handleError(_0x17731b,null));};exports[_0xf2b7('0x7e')]=function(_0x3e6c81,_0x510086,_0x4f2841){var _0x33e5c5={};var _0x449acd={};var _0x17daf5;var _0x25cd09;return db[_0xf2b7('0x3e')][_0xf2b7('0x6e')]({'where':{'id':_0x3e6c81[_0xf2b7('0x58')]['id']}})[_0xf2b7('0x20')](handleEntityNotFound(_0x510086,null))[_0xf2b7('0x20')](function(_0x5b10f3){if(_0x5b10f3){_0x17daf5=_0x5b10f3;_0x449acd[_0xf2b7('0x43')]=_['keys'](db[_0xf2b7('0x7b')][_0xf2b7('0x3f')]);_0x449acd[_0xf2b7('0x44')]=_[_0xf2b7('0x45')](_0x3e6c81[_0xf2b7('0x44')]);_0x449acd[_0xf2b7('0x46')]=_[_0xf2b7('0x47')](_0x449acd[_0xf2b7('0x43')],_0x449acd[_0xf2b7('0x44')]);_0x33e5c5[_0xf2b7('0x49')]=_[_0xf2b7('0x47')](_0x449acd[_0xf2b7('0x43')],qs[_0xf2b7('0x48')](_0x3e6c81[_0xf2b7('0x44')][_0xf2b7('0x48')]));_0x33e5c5[_0xf2b7('0x49')]=_0x33e5c5['attributes']['length']?_0x33e5c5[_0xf2b7('0x49')]:_0x449acd['model'];_0x33e5c5[_0xf2b7('0x4c')]=qs[_0xf2b7('0x4d')](_0x3e6c81[_0xf2b7('0x44')]['sort']);_0x33e5c5[_0xf2b7('0x4f')]=qs[_0xf2b7('0x46')](_[_0xf2b7('0x4e')](_0x3e6c81['query'],_0x449acd[_0xf2b7('0x46')]));if(_0x3e6c81[_0xf2b7('0x44')][_0xf2b7('0x51')]){_0x33e5c5['where']=_[_0xf2b7('0x52')](_0x33e5c5[_0xf2b7('0x4f')],{'$or':_[_0xf2b7('0x3d')](_0x33e5c5[_0xf2b7('0x49')],function(_0x424573){var _0x207162={};_0x207162[_0x424573]={'$like':'%'+_0x3e6c81[_0xf2b7('0x44')]['filter']+'%'};return _0x207162;})});}_0x33e5c5=_[_0xf2b7('0x52')]({},_0x33e5c5,_0x3e6c81['options']);return _0x17daf5[_0xf2b7('0x7e')](_0x33e5c5);}})[_0xf2b7('0x20')](function(_0x4605dd){if(_0x4605dd){_0x25cd09=_0x4605dd[_0xf2b7('0x4a')];if(!_0x3e6c81['query']['hasOwnProperty']('nolimit')){_0x33e5c5[_0xf2b7('0x31')]=qs['limit'](_0x3e6c81[_0xf2b7('0x44')][_0xf2b7('0x31')]);_0x33e5c5[_0xf2b7('0x30')]=qs[_0xf2b7('0x30')](_0x3e6c81[_0xf2b7('0x44')][_0xf2b7('0x30')]);}return _0x17daf5[_0xf2b7('0x7e')](_0x33e5c5);}})['then'](function(_0x2fa840){if(_0x2fa840){return _0x2fa840?{'count':_0x25cd09,'rows':_0x2fa840}:null;}})[_0xf2b7('0x20')](respondWithResult(_0x510086,null))['catch'](handleError(_0x510086,null));};exports[_0xf2b7('0x7f')]=function(_0x7aafb7,_0x1424c9,_0x4d1ed8){var _0xcfa2b8={'channel':_0xf2b7('0x80')};var _0x322a04=[];var _0x4f8629=[];var _0x4b5675={};return db[_0xf2b7('0x3e')][_0xf2b7('0x60')]({'where':{'id':_0x7aafb7[_0xf2b7('0x58')]['id']},'include':[{'model':db[_0xf2b7('0x7b')],'as':_0xf2b7('0x81')}]})[_0xf2b7('0x20')](handleEntityNotFound(_0x1424c9,null))[_0xf2b7('0x20')](function(_0x5e2acf){_0xcfa2b8[_0xf2b7('0x82')]=_0x5e2acf;_0xcfa2b8['applications']=_[_0xf2b7('0x83')](_0x5e2acf[_0xf2b7('0x81')],[_0xf2b7('0x84')],[_0xf2b7('0x85')]);if(_0xcfa2b8[_0xf2b7('0x82')]['Applications']){delete _0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0x81')];}return db['CmContact'][_0xf2b7('0x65')]();})[_0xf2b7('0x20')](function(_0x1fa430){if(!_0x1fa430){throw new db[(_0xf2b7('0x86'))][(_0xf2b7('0x87'))](_0xf2b7('0x88'));}_0x322a04=_[_0xf2b7('0x89')](_[_0xf2b7('0x45')](_0x1fa430),['createdAt',_0xf2b7('0x8a')]);_0x4f8629=_[_0xf2b7('0x89')](_['keys'](_0x1fa430),['createdAt',_0xf2b7('0x8a'),_0xf2b7('0x8b'),_0xf2b7('0x8c')]);_0xcfa2b8[_0xf2b7('0x5b')]={'mapKey':_0xf2b7('0x8d')};if(_0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0x41')]&&_0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0x41')]===_0xf2b7('0x8e')){_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x8f')]=_0x7aafb7['body'][_0xf2b7('0x90')][_0xf2b7('0x91')](_0xf2b7('0x92'),'');_0xcfa2b8[_0xf2b7('0x5b')]['body']=_0x7aafb7[_0xf2b7('0x5b')][_0xf2b7('0x93')];_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x94')]=_0x7aafb7['body'][_0xf2b7('0x95')];}if(_0xcfa2b8[_0xf2b7('0x5b')]['id']){delete _0xcfa2b8[_0xf2b7('0x5b')]['id'];}if(_[_0xf2b7('0x96')](_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x8f')])){throw new db[(_0xf2b7('0x86'))]['ValidationError'](_0xf2b7('0x97'));}if(_[_0xf2b7('0x96')](_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x5b')])||_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x5b')]===''){throw new db[(_0xf2b7('0x86'))][(_0xf2b7('0x87'))](_0xf2b7('0x98'));}if(_[_0xf2b7('0x96')](_0xcfa2b8['body'][_0xf2b7('0x99')])){throw new db['Sequelize'][(_0xf2b7('0x87'))](_0xf2b7('0x9a')+_0x4f8629);}if(!_[_0xf2b7('0x9b')](_0x4f8629,_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x99')])){throw new db[(_0xf2b7('0x86'))]['ValidationError'](_0xf2b7('0x9c')+_0x4f8629);}_0x4b5675[_0xcfa2b8['body']['mapKey']]=_0xcfa2b8[_0xf2b7('0x5b')]['from'];return db[_0xf2b7('0x9d')][_0xf2b7('0x60')]({'where':{'id':_0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0x8c')]},'include':[{'model':db[_0xf2b7('0x9e')],'as':'Contacts','where':_0x4b5675,'limit':0x1,'order':[[_0xf2b7('0x8a'),_0xf2b7('0x9f')]]}]});})[_0xf2b7('0x20')](handleEntityNotFound(_0x1424c9,null))['then'](function(_0x2292e1){if(_0x2292e1){_0xcfa2b8[_0xf2b7('0xa0')]=_['omit'](_0x2292e1,[_0xf2b7('0xa1')]);if(_0x2292e1[_0xf2b7('0xa1')]['length']){return _0x2292e1[_0xf2b7('0xa1')][0x0];}var _0x1e1fca=_[_0xf2b7('0xa2')](_0xcfa2b8[_0xf2b7('0x5b')],{'firstName':_0xcfa2b8[_0xf2b7('0x5b')]['from'],'ListId':_0x2292e1['id']});_0x1e1fca[_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x99')]]=_0xcfa2b8['body'][_0xf2b7('0x8f')];return db[_0xf2b7('0x9e')][_0xf2b7('0x5a')](_0x1e1fca,{'fields':_0x322a04,'raw':!![]});}})[_0xf2b7('0x20')](handleEntityNotFound(_0x1424c9,null))[_0xf2b7('0x20')](function(_0x47c9c0){if(_0x47c9c0){_0xcfa2b8[_0xf2b7('0xa3')]=_0x47c9c0;var _0x1f5daf={'ContactId':_0x47c9c0['id'],'phone':_0xcfa2b8[_0xf2b7('0x5b')]['from'],'WhatsappAccountId':_0x7aafb7['params']['id']};var _0xb341b6={'ContactId':_0x47c9c0['id'],'WhatsappAccountId':_0x7aafb7['params']['id'],'closed':![]};return db[_0xf2b7('0xa4')]['find']({'where':_0xb341b6})[_0xf2b7('0x20')](function(_0x2a03bf){if(_0x2a03bf){return[_0x2a03bf,![]];}return db[_0xf2b7('0xa4')][_0xf2b7('0x5a')](_0x1f5daf)[_0xf2b7('0x20')](function(_0x45d93a){return[_0x45d93a,!![]];});});}})[_0xf2b7('0xa5')](function(_0x5a9a4c,_0x45703d){_0xcfa2b8[_0xf2b7('0xa6')]=_0x5a9a4c[_0xf2b7('0x36')]({'plain':!![]});_0xcfa2b8[_0xf2b7('0xa6')][_0xf2b7('0xa7')]=![];if(_0x45703d){if(_0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0xa8')]){_0xcfa2b8[_0xf2b7('0xa9')]['push']({'id':0x0,'priority':_0xcfa2b8[_0xf2b7('0xa9')][_0xf2b7('0x4a')]+0x1,'app':_0xf2b7('0xaa'),'appdata':'unmanaged','interval':_0xf2b7('0xab')});}_0xcfa2b8[_0xf2b7('0xa6')][_0xf2b7('0xa7')]=!![];}return db[_0xf2b7('0xac')][_0xf2b7('0x5a')]({'phone':_0xcfa2b8[_0xf2b7('0x5b')][_0xf2b7('0x8f')],'messageId':_0xcfa2b8['body'][_0xf2b7('0x94')],'body':_0xcfa2b8['body']['body'],'WhatsappAccountId':_0x7aafb7[_0xf2b7('0x58')]['id'],'WhatsappInteractionId':_0x5a9a4c['id'],'direction':'in','ContactId':_0x5a9a4c['ContactId'],'AttachmentId':_0xcfa2b8[_0xf2b7('0x5b')]['AttachmentId']});})[_0xf2b7('0x20')](function(_0xc666a5){_0xcfa2b8['message']=_0xc666a5;if(_0xcfa2b8['interaction']['UserId']){return db['User'][_0xf2b7('0x60')]({'attributes':['id','name'],'where':{'id':_0xcfa2b8['interaction'][_0xf2b7('0xad')]}})[_0xf2b7('0x20')](function(_0x2c6302){if(_0x2c6302){_0xcfa2b8[_0xf2b7('0xa9')][_0xf2b7('0xae')]({'id':0x0,'priority':0x0,'app':_0xf2b7('0xaf'),'appdata':_0x2c6302['name']+','+(_0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0xb0')]||0xa),'interval':_0xf2b7('0xab')});}return respondWithRpcPromise(_0xf2b7('0xb1'),_0xf2b7('0xb2'),_0xcfa2b8);});}return respondWithRpcPromise(_0xf2b7('0xb1'),'startRouting',_0xcfa2b8);})[_0xf2b7('0x20')](function(_0x1e7a46){if(_0x1e7a46){var _0x1a5813=0xc8;var _0x153f13=_0xf2b7('0xb3');logger[_0xf2b7('0x29')](_0xf2b7('0x22'),_0x153f13,_0x1a5813,_0xf2b7('0xb4'));logger[_0xf2b7('0x21')](_0xf2b7('0xb5'),_0x153f13,_0x1a5813,_0xf2b7('0xb4'),JSON['stringify'](_0x1e7a46));if(_0xcfa2b8[_0xf2b7('0x82')][_0xf2b7('0x41')]===_0xf2b7('0x8e')){return _0x1424c9[_0xf2b7('0x2c')](_0x1a5813)[_0xf2b7('0x32')](_0xf2b7('0xb6'),_0xf2b7('0xb7'))[_0xf2b7('0x3b')]('\x0a');}else{return _0x1424c9[_0xf2b7('0x2c')](_0x1a5813)['json'](_0x1e7a46);}}})['catch'](handleError(_0x1424c9,null));};exports['send']=function(_0x495692,_0xf21bac,_0x3a4e84){var _0x276022,_0x5376d4,_0x479eb2;if(_[_0xf2b7('0x96')](_0x495692[_0xf2b7('0x5b')][_0xf2b7('0x5b')])||_0x495692[_0xf2b7('0x5b')][_0xf2b7('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0xf2b7('0x98'));}if(_[_0xf2b7('0x96')](_0x495692[_0xf2b7('0x5b')]['to'])){throw new db[(_0xf2b7('0x86'))][(_0xf2b7('0x87'))](_0xf2b7('0xb8'));}_0x276022=_0x495692['body']['to'];return db[_0xf2b7('0x3e')][_0xf2b7('0x60')]({'where':{'id':_0x495692[_0xf2b7('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xf2b7('0xb9'),'include':[{'model':db['CmContact'],'as':_0xf2b7('0xa1'),'where':{'mobile':_0x276022},'limit':0x1,'order':[[_0xf2b7('0x8a'),'DESC']]}]}]})[_0xf2b7('0x20')](handleEntityNotFound(_0xf21bac,null))['then'](function(_0x109f66){if(_0x109f66&&_0x109f66[_0xf2b7('0xb9')]){_0x5376d4=_0x109f66['get']({'plain':!![]});if(_0x5376d4['List']&&_0x5376d4[_0xf2b7('0xb9')][_0xf2b7('0xa1')][_0xf2b7('0x4a')]){return _0x5376d4['List'][_0xf2b7('0xa1')][0x0];}return db[_0xf2b7('0x9e')][_0xf2b7('0x5a')](_[_0xf2b7('0xa2')](_0x495692[_0xf2b7('0x5b')],{'firstName':_0x276022,'mobile':_0x276022,'phone':_0x276022,'ListId':_0x5376d4[_0xf2b7('0x8c')]}));}})[_0xf2b7('0x20')](handleEntityNotFound(_0xf21bac,null))[_0xf2b7('0x20')](function(_0x42815d){if(_0x42815d){_0x479eb2=_0x42815d;return db[_0xf2b7('0xa4')]['find']({'where':{'ContactId':_0x479eb2['id'],'closed':![],'WhatsappAccountId':_0x5376d4['id']}})['then'](function(_0x12b456){if(_0x12b456){return[_0x12b456,![]];}return db[_0xf2b7('0xa4')]['create']({'UserId':_0x495692[_0xf2b7('0x5c')]['id'],'ContactId':_0x479eb2['id'],'WhatsappAccountId':_0x5376d4['id'],'phone':_0x276022,'firstMsgDirection':_0xf2b7('0xba'),'Messages':[_[_0xf2b7('0x52')](_0x495692['body'],{'read':![],'body':_0x495692['body'][_0xf2b7('0x5b')],'phone':_0x276022,'WhatsappAccountId':_0x5376d4['id'],'UserId':_0x495692[_0xf2b7('0x5c')]['id'],'ContactId':_0x479eb2['id']})]},{'include':[{'model':db[_0xf2b7('0xac')],'as':_0xf2b7('0xbb')}]})['then'](function(_0x516d13){return[_0x516d13,!![]];});});}})[_0xf2b7('0xa5')](function(_0x2d4286,_0x1f64a0){if(_0x1f64a0){return _0x2d4286;}return db[_0xf2b7('0xac')]['create'](_['merge'](_0x495692[_0xf2b7('0x5b')],{'read':![],'body':_0x495692[_0xf2b7('0x5b')][_0xf2b7('0x5b')],'phone':_0x276022,'WhatsappAccountId':_0x5376d4['id'],'WhatsappInteractionId':_0x2d4286['id'],'UserId':_0x495692['user']['id'],'ContactId':_0x479eb2['id']}))[_0xf2b7('0x20')](function(_0x1b3e8c){_0x2d4286[_0xf2b7('0xbc')][_0xf2b7('0xbb')]=[];_0x2d4286[_0xf2b7('0xbc')][_0xf2b7('0xbb')]['push'](_0x1b3e8c[_0xf2b7('0xbc')]);return _0x2d4286;});})[_0xf2b7('0x20')](respondWithResult(_0xf21bac,null))[_0xf2b7('0x2b')](handleError(_0xf21bac,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7a21581..4efd812 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 _0x33af=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2152f5,_0xbd773b){var _0x34515c=function(_0x484ca8){while(--_0x484ca8){_0x2152f5['push'](_0x2152f5['shift']());}};_0x34515c(++_0xbd773b);}(_0x33af,0xec));var _0xf33a=function(_0x1f20c1,_0x350567){_0x1f20c1=_0x1f20c1-0x0;var _0x548c58=_0x33af[_0x1f20c1];return _0x548c58;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf33a('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf33a('0x1')](0x0);var events={'afterCreate':_0xf33a('0x2'),'afterUpdate':_0xf33a('0x3'),'afterDestroy':_0xf33a('0x4')};function emitEvent(_0x169f02){return function(_0x25f156,_0x4c734e,_0x433e25){WhatsappAccountEvents[_0xf33a('0x5')](_0x169f02+':'+_0x25f156['id'],_0x25f156);WhatsappAccountEvents['emit'](_0x169f02,_0x25f156);_0x433e25(null);};}for(var e in events){if(events[_0xf33a('0x6')](e)){var event=events[e];WhatsappAccount[_0xf33a('0x7')](e,emitEvent(event));}}module[_0xf33a('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x1189=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit'];(function(_0x5a1885,_0xe7cd37){var _0x5c1e4d=function(_0x29e942){while(--_0x29e942){_0x5a1885['push'](_0x5a1885['shift']());}};_0x5c1e4d(++_0xe7cd37);}(_0x1189,0x17f));var _0x9118=function(_0x53aecd,_0x3d159f){_0x53aecd=_0x53aecd-0x0;var _0x13992c=_0x1189[_0x53aecd];return _0x13992c;};'use strict';var EventEmitter=require(_0x9118('0x0'));var WhatsappAccount=require(_0x9118('0x1'))['db'][_0x9118('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9118('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9118('0x4'),'afterDestroy':_0x9118('0x5')};function emitEvent(_0x175cd5){return function(_0xd7a81b,_0x37a638,_0x3650f2){WhatsappAccountEvents[_0x9118('0x6')](_0x175cd5+':'+_0xd7a81b['id'],_0xd7a81b);WhatsappAccountEvents['emit'](_0x175cd5,_0xd7a81b);_0x3650f2(null);};}for(var e in events){if(events[_0x9118('0x7')](e)){var event=events[e];WhatsappAccount[_0x9118('0x8')](e,emitEvent(event));}}module[_0x9118('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 722dcb2..2aebf17 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 _0x050e=['define','WhatsappAccount','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x050e,0xaa));var _0xe050=function(_0x100dab,_0x566447){_0x100dab=_0x100dab-0x0;var _0x3572e4=_0x050e[_0x100dab];return _0x3572e4;};'use strict';var _=require(_0xe050('0x0'));var util=require(_0xe050('0x1'));var logger=require(_0xe050('0x2'))('api');var moment=require(_0xe050('0x3'));var BPromise=require(_0xe050('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe050('0x5'));var rimraf=require(_0xe050('0x6'));var config=require(_0xe050('0x7'));var attributes=require(_0xe050('0x8'));module[_0xe050('0x9')]=function(_0x1fbc3a,_0x1f383a){return _0x1fbc3a[_0xe050('0xa')](_0xe050('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75e=['exports','define','WhatsappAccount','lodash','util','api','moment','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x1c816c,_0x2e0355){var _0x3ba6eb=function(_0x37f730){while(--_0x37f730){_0x1c816c['push'](_0x1c816c['shift']());}};_0x3ba6eb(++_0x2e0355);}(_0xa75e,0x137));var _0xea75=function(_0x597501,_0x4914d8){_0x597501=_0x597501-0x0;var _0x42f12f=_0xa75e[_0x597501];return _0x42f12f;};'use strict';var _=require(_0xea75('0x0'));var util=require(_0xea75('0x1'));var logger=require('../../config/logger')(_0xea75('0x2'));var moment=require(_0xea75('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea75('0x4'));var rimraf=require(_0xea75('0x5'));var config=require(_0xea75('0x6'));var attributes=require(_0xea75('0x7'));module[_0xea75('0x8')]=function(_0x174eeb,_0x2d0eeb){return _0x174eeb[_0xea75('0x9')](_0xea75('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 7bb2517..33bbcea 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 _0x2c64=['localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis'];(function(_0x292a97,_0x49fb87){var _0x36aa25=function(_0x3f3f05){while(--_0x3f3f05){_0x292a97['push'](_0x292a97['shift']());}};_0x36aa25(++_0x49fb87);}(_0x2c64,0x181));var _0x42c6=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x2c64[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var moment=require('moment');var BPromise=require(_0x42c6('0x2'));var rs=require(_0x42c6('0x3'));var fs=require('fs');var Redis=require(_0x42c6('0x4'));var db=require(_0x42c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42c6('0x6'));var config=require(_0x42c6('0x7'));var jayson=require(_0x42c6('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x42c6('0x9')](config[_0x42c6('0xa')],{'host':_0x42c6('0xb'),'port':0x18eb});var socket=require(_0x42c6('0xc'))(new Redis(config[_0x42c6('0xa')]));require('./whatsappAccount.socket')[_0x42c6('0xd')](socket);function respondWithRpcPromise(_0x15af4d,_0x27500d,_0x5480ea){return new BPromise(function(_0x235256,_0x3d749e){return client['request'](_0x15af4d,_0x5480ea)[_0x42c6('0xe')](function(_0x227a87){logger[_0x42c6('0xf')](_0x42c6('0x10'),_0x27500d,_0x42c6('0x11'));logger[_0x42c6('0x12')](_0x42c6('0x13'),_0x27500d,'request\x20sent',JSON[_0x42c6('0x14')](_0x227a87));if(_0x227a87[_0x42c6('0x15')]){if(_0x227a87[_0x42c6('0x15')][_0x42c6('0x16')]===0x1f4){logger[_0x42c6('0x15')](_0x42c6('0x10'),_0x27500d,_0x227a87[_0x42c6('0x15')]['message']);return _0x3d749e(_0x227a87[_0x42c6('0x15')][_0x42c6('0x17')]);}logger[_0x42c6('0x15')](_0x42c6('0x10'),_0x27500d,_0x227a87['error'][_0x42c6('0x17')]);return _0x235256(_0x227a87['error'][_0x42c6('0x17')]);}else{logger[_0x42c6('0xf')](_0x42c6('0x10'),_0x27500d,'request\x20sent');_0x235256(_0x227a87[_0x42c6('0x18')][_0x42c6('0x17')]);}})[_0x42c6('0x19')](function(_0x3fce8d){logger[_0x42c6('0x15')](_0x42c6('0x10'),_0x27500d,_0x3fce8d);_0x3d749e(_0x3fce8d);});});}exports[_0x42c6('0x1a')]=function(_0x486e94){var _0x51aae3=this;return new Promise(function(_0x141e3e,_0x3139bc){return db[_0x42c6('0x1b')][_0x42c6('0x1c')]({'raw':_0x486e94['options']?_0x486e94['options'][_0x42c6('0x1d')]===undefined?!![]:![]:!![],'where':_0x486e94[_0x42c6('0x1e')]?_0x486e94['options'][_0x42c6('0x1f')]||null:null,'attributes':_0x486e94['options']?_0x486e94[_0x42c6('0x1e')][_0x42c6('0x20')]||null:null,'include':_0x486e94[_0x42c6('0x1e')]?_0x486e94[_0x42c6('0x1e')][_0x42c6('0x21')]?_[_0x42c6('0x22')](_0x486e94[_0x42c6('0x1e')][_0x42c6('0x21')],function(_0x10c408){return{'model':db[_0x10c408[_0x42c6('0x23')]],'as':_0x10c408['as'],'attributes':_0x10c408[_0x42c6('0x20')],'include':_0x10c408[_0x42c6('0x21')]?_['map'](_0x10c408[_0x42c6('0x21')],function(_0x34f85b){return{'model':db[_0x34f85b[_0x42c6('0x23')]],'as':_0x34f85b['as'],'attributes':_0x34f85b[_0x42c6('0x20')],'include':_0x34f85b['include']?_[_0x42c6('0x22')](_0x34f85b[_0x42c6('0x21')],function(_0x9fac8c){return{'model':db[_0x9fac8c['model']],'as':_0x9fac8c['as'],'attributes':_0x9fac8c[_0x42c6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31aa56){logger[_0x42c6('0xf')](_0x42c6('0x1a'),_0x486e94);logger[_0x42c6('0x12')](_0x42c6('0x1a'),_0x486e94,JSON['stringify'](_0x31aa56));_0x141e3e(_0x31aa56);})['catch'](function(_0x4bdccf){logger[_0x42c6('0x15')](_0x42c6('0x1a'),_0x4bdccf[_0x42c6('0x17')],_0x486e94);_0x3139bc(_0x51aae3[_0x42c6('0x15')](0x1f4,_0x4bdccf['message']));});});}; \ No newline at end of file +var _0x4cc4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','util','moment','bluebird'];(function(_0x1fc0cc,_0xa16138){var _0x438a6b=function(_0x21748a){while(--_0x21748a){_0x1fc0cc['push'](_0x1fc0cc['shift']());}};_0x438a6b(++_0xa16138);}(_0x4cc4,0x6f));var _0x44cc=function(_0x800952,_0x1c47a3){_0x800952=_0x800952-0x0;var _0x4d793b=_0x4cc4[_0x800952];return _0x4d793b;};'use strict';var _=require('lodash');var util=require(_0x44cc('0x0'));var moment=require(_0x44cc('0x1'));var BPromise=require(_0x44cc('0x2'));var rs=require(_0x44cc('0x3'));var fs=require('fs');var Redis=require(_0x44cc('0x4'));var db=require(_0x44cc('0x5'))['db'];var utils=require(_0x44cc('0x6'));var logger=require(_0x44cc('0x7'))(_0x44cc('0x8'));var config=require(_0x44cc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x44cc('0xa')][_0x44cc('0xb')]({'port':0x232a});config[_0x44cc('0xc')]=_[_0x44cc('0xd')](config[_0x44cc('0xc')],{'host':_0x44cc('0xe'),'port':0x18eb});var socket=require(_0x44cc('0xf'))(new Redis(config[_0x44cc('0xc')]));require('./whatsappAccount.socket')[_0x44cc('0x10')](socket);function respondWithRpcPromise(_0x97ea7e,_0x4c821d,_0xfab3a1){return new BPromise(function(_0x18cb93,_0x51cb8c){return client['request'](_0x97ea7e,_0xfab3a1)[_0x44cc('0x11')](function(_0x51cc2b){logger[_0x44cc('0x12')](_0x44cc('0x13'),_0x4c821d,_0x44cc('0x14'));logger[_0x44cc('0x15')](_0x44cc('0x16'),_0x4c821d,_0x44cc('0x14'),JSON[_0x44cc('0x17')](_0x51cc2b));if(_0x51cc2b[_0x44cc('0x18')]){if(_0x51cc2b[_0x44cc('0x18')][_0x44cc('0x19')]===0x1f4){logger[_0x44cc('0x18')](_0x44cc('0x13'),_0x4c821d,_0x51cc2b[_0x44cc('0x18')]['message']);return _0x51cb8c(_0x51cc2b[_0x44cc('0x18')]['message']);}logger[_0x44cc('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x4c821d,_0x51cc2b[_0x44cc('0x18')][_0x44cc('0x1a')]);return _0x18cb93(_0x51cc2b[_0x44cc('0x18')][_0x44cc('0x1a')]);}else{logger['info'](_0x44cc('0x13'),_0x4c821d,_0x44cc('0x14'));_0x18cb93(_0x51cc2b[_0x44cc('0x1b')][_0x44cc('0x1a')]);}})[_0x44cc('0x1c')](function(_0x3fca76){logger[_0x44cc('0x18')](_0x44cc('0x13'),_0x4c821d,_0x3fca76);_0x51cb8c(_0x3fca76);});});}exports[_0x44cc('0x1d')]=function(_0x240798){var _0x1e8bdc=this;return new Promise(function(_0x35bb76,_0x42d3c3){return db[_0x44cc('0x1e')]['find']({'raw':_0x240798[_0x44cc('0x1f')]?_0x240798[_0x44cc('0x1f')][_0x44cc('0x20')]===undefined?!![]:![]:!![],'where':_0x240798[_0x44cc('0x1f')]?_0x240798[_0x44cc('0x1f')][_0x44cc('0x21')]||null:null,'attributes':_0x240798[_0x44cc('0x1f')]?_0x240798[_0x44cc('0x1f')][_0x44cc('0x22')]||null:null,'include':_0x240798[_0x44cc('0x1f')]?_0x240798[_0x44cc('0x1f')][_0x44cc('0x23')]?_[_0x44cc('0x24')](_0x240798[_0x44cc('0x1f')]['include'],function(_0x3ede95){return{'model':db[_0x3ede95['model']],'as':_0x3ede95['as'],'attributes':_0x3ede95[_0x44cc('0x22')],'include':_0x3ede95['include']?_[_0x44cc('0x24')](_0x3ede95[_0x44cc('0x23')],function(_0x501875){return{'model':db[_0x501875[_0x44cc('0x25')]],'as':_0x501875['as'],'attributes':_0x501875[_0x44cc('0x22')],'include':_0x501875['include']?_[_0x44cc('0x24')](_0x501875[_0x44cc('0x23')],function(_0xd84de3){return{'model':db[_0xd84de3[_0x44cc('0x25')]],'as':_0xd84de3['as'],'attributes':_0xd84de3[_0x44cc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x44cc('0x11')](function(_0xc2e36d){logger[_0x44cc('0x12')]('ShowWhatsappAccount',_0x240798);logger[_0x44cc('0x15')]('ShowWhatsappAccount',_0x240798,JSON[_0x44cc('0x17')](_0xc2e36d));_0x35bb76(_0xc2e36d);})['catch'](function(_0x2bee8f){logger[_0x44cc('0x18')]('ShowWhatsappAccount',_0x2bee8f[_0x44cc('0x1a')],_0x240798);_0x42d3c3(_0x1e8bdc[_0x44cc('0x18')](0x1f4,_0x2bee8f[_0x44cc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7235872..2bf634d 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 _0xe484=['length','save','remove','update','emit','removeListener','register'];(function(_0x2c1bc8,_0x19a942){var _0x2f6a2d=function(_0x4f982a){while(--_0x4f982a){_0x2c1bc8['push'](_0x2c1bc8['shift']());}};_0x2f6a2d(++_0x19a942);}(_0xe484,0x14a));var _0x4e48=function(_0x2a57d6,_0x42f040){_0x2a57d6=_0x2a57d6-0x0;var _0x1078d4=_0xe484[_0x2a57d6];return _0x1078d4;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x4e48('0x0'),_0x4e48('0x1'),_0x4e48('0x2')];function createListener(_0x537718,_0x30322e){return function(_0x3806c8){_0x30322e[_0x4e48('0x3')](_0x537718,_0x3806c8);};}function removeListener(_0x317230,_0x5d076b){return function(){WhatsappAccountEvents[_0x4e48('0x4')](_0x317230,_0x5d076b);};}exports[_0x4e48('0x5')]=function(_0x322e0f){for(var _0x3c930b=0x0,_0x337e22=events[_0x4e48('0x6')];_0x3c930b<_0x337e22;_0x3c930b++){var _0x3b5bed=events[_0x3c930b];var _0xd37358=createListener('whatsappAccount:'+_0x3b5bed,_0x322e0f);WhatsappAccountEvents['on'](_0x3b5bed,_0xd37358);}}; \ No newline at end of file +var _0xfde2=['register','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x129253,_0x58e440){var _0x2e8565=function(_0x14a88f){while(--_0x14a88f){_0x129253['push'](_0x129253['shift']());}};_0x2e8565(++_0x58e440);}(_0xfde2,0xd2));var _0x2fde=function(_0x4d8790,_0x521730){_0x4d8790=_0x4d8790-0x0;var _0x5e99c4=_0xfde2[_0x4d8790];return _0x5e99c4;};'use strict';var WhatsappAccountEvents=require(_0x2fde('0x0'));var events=[_0x2fde('0x1'),_0x2fde('0x2'),_0x2fde('0x3')];function createListener(_0xbd4337,_0x5495ac){return function(_0x1001ef){_0x5495ac[_0x2fde('0x4')](_0xbd4337,_0x1001ef);};}function removeListener(_0x158610,_0x4635cd){return function(){WhatsappAccountEvents[_0x2fde('0x5')](_0x158610,_0x4635cd);};}exports[_0x2fde('0x6')]=function(_0x11849d){for(var _0x148efe=0x0,_0x5c6603=events['length'];_0x148efe<_0x5c6603;_0x148efe++){var _0x385df2=events[_0x148efe];var _0x4b7a99=createListener(_0x2fde('0x7')+_0x385df2,_0x11849d);WhatsappAccountEvents['on'](_0x385df2,_0x4b7a99);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cc0eecd..b22098c 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 _0x9beb=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0x455456,_0x5a2211){var _0x3bbc12=function(_0x2e69aa){while(--_0x2e69aa){_0x455456['push'](_0x455456['shift']());}};_0x3bbc12(++_0x5a2211);}(_0x9beb,0x18e));var _0xb9be=function(_0x344f52,_0x5733e1){_0x344f52=_0x344f52-0x0;var _0x4da12b=_0x9beb[_0x344f52];return _0x4da12b;};'use strict';var multer=require(_0xb9be('0x0'));var util=require('util');var path=require(_0xb9be('0x1'));var timeout=require(_0xb9be('0x2'));var express=require(_0xb9be('0x3'));var router=express['Router']();var auth=require(_0xb9be('0x4'));var interaction=require(_0xb9be('0x5'));var config=require(_0xb9be('0x6'));var controller=require(_0xb9be('0x7'));router[_0xb9be('0x8')]('/',auth['isAuthenticated'](),controller[_0xb9be('0x9')]);router[_0xb9be('0x8')](_0xb9be('0xa'),auth[_0xb9be('0xb')](),controller[_0xb9be('0xc')]);router[_0xb9be('0xd')]('/',auth[_0xb9be('0xb')](),controller[_0xb9be('0xe')]);router[_0xb9be('0xf')]('/:id',auth[_0xb9be('0xb')](),controller['update']);router[_0xb9be('0x10')](_0xb9be('0xa'),auth[_0xb9be('0xb')](),controller[_0xb9be('0x11')]);module[_0xb9be('0x12')]=router; \ No newline at end of file +var _0x6bca=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','/:id','isAuthenticated','post','update','delete','destroy','multer','util','path'];(function(_0x484599,_0x56224f){var _0x2c91f1=function(_0x40dab9){while(--_0x40dab9){_0x484599['push'](_0x484599['shift']());}};_0x2c91f1(++_0x56224f);}(_0x6bca,0xa2));var _0xa6bc=function(_0x599a9e,_0xee6f1f){_0x599a9e=_0x599a9e-0x0;var _0x2390e0=_0x6bca[_0x599a9e];return _0x2390e0;};'use strict';var multer=require(_0xa6bc('0x0'));var util=require(_0xa6bc('0x1'));var path=require(_0xa6bc('0x2'));var timeout=require(_0xa6bc('0x3'));var express=require(_0xa6bc('0x4'));var router=express[_0xa6bc('0x5')]();var auth=require(_0xa6bc('0x6'));var interaction=require(_0xa6bc('0x7'));var config=require('../../config/environment');var controller=require(_0xa6bc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa6bc('0x9'),auth[_0xa6bc('0xa')](),controller['show']);router[_0xa6bc('0xb')]('/',auth[_0xa6bc('0xa')](),controller['create']);router['put']('/:id',auth[_0xa6bc('0xa')](),controller[_0xa6bc('0xc')]);router[_0xa6bc('0xd')](_0xa6bc('0x9'),auth['isAuthenticated'](),controller[_0xa6bc('0xe')]);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 2335764..2b2dd34 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 _0x5137=['TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x65fc1b,_0x41cd8e){var _0x395601=function(_0x5d29f0){while(--_0x5d29f0){_0x65fc1b['push'](_0x65fc1b['shift']());}};_0x395601(++_0x41cd8e);}(_0x5137,0x12f));var _0x7513=function(_0xde97d1,_0xce6de9){_0xde97d1=_0xde97d1-0x0;var _0x7da263=_0x5137[_0xde97d1];return _0x7da263;};'use strict';var Sequelize=require(_0x7513('0x0'));module[_0x7513('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7513('0x2')]()},'description':{'type':Sequelize[_0x7513('0x3')]},'interval':{'type':Sequelize[_0x7513('0x3')],'defaultValue':_0x7513('0x4')}}; \ No newline at end of file +var _0xb695=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x5de55b,_0x1c78d3){var _0x4635d2=function(_0x16ee53){while(--_0x16ee53){_0x5de55b['push'](_0x5de55b['shift']());}};_0x4635d2(++_0x1c78d3);}(_0xb695,0x129));var _0x5b69=function(_0x38ee65,_0x2f23b6){_0x38ee65=_0x38ee65-0x0;var _0x5d35a6=_0xb695[_0x38ee65];return _0x5d35a6;};'use strict';var Sequelize=require(_0x5b69('0x0'));module[_0x5b69('0x1')]={'priority':{'type':Sequelize[_0x5b69('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5b69('0x3')},'appdata':{'type':Sequelize[_0x5b69('0x4')]()},'description':{'type':Sequelize[_0x5b69('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5b69('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1b31caf..4d6c658 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 _0x570b=['Content-Range','apply','reject','then','destroy','stack','name','send','index','map','WhatsappApplication','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','rows','catch','show','params','merge','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x4caca1,_0x2388d1){var _0x75d75c=function(_0x8fa3d1){while(--_0x8fa3d1){_0x4caca1['push'](_0x4caca1['shift']());}};_0x75d75c(++_0x2388d1);}(_0x570b,0x73));var _0xb570=function(_0x475b20,_0x8cead4){_0x475b20=_0x475b20-0x0;var _0x5c69cd=_0x570b[_0x475b20];return _0x5c69cd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb570('0x0'));var zipdir=require(_0xb570('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb570('0x2'));var moment=require(_0xb570('0x3'));var BPromise=require(_0xb570('0x4'));var Mustache=require(_0xb570('0x5'));var util=require(_0xb570('0x6'));var path=require(_0xb570('0x7'));var sox=require(_0xb570('0x8'));var csv=require(_0xb570('0x9'));var ejs=require(_0xb570('0xa'));var fs=require('fs');var _=require(_0xb570('0xb'));var squel=require(_0xb570('0xc'));var crypto=require(_0xb570('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb570('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb570('0xf'));var Papa=require(_0xb570('0x10'));var Redis=require(_0xb570('0x11'));var authService=require(_0xb570('0x12'));var qs=require(_0xb570('0x13'));var as=require(_0xb570('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb570('0x15'));var utils=require(_0xb570('0x16'));var config=require(_0xb570('0x17'));var licenseUtil=require(_0xb570('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28e44e,_0x5134d8){_0x5134d8=_0x5134d8||0xcc;return function(_0x584e03){if(_0x584e03){return _0x28e44e[_0xb570('0x19')](_0x5134d8);}return _0x28e44e['status'](_0x5134d8)[_0xb570('0x1a')]();};}function respondWithResult(_0xa9fa24,_0x1bb73d){_0x1bb73d=_0x1bb73d||0xc8;return function(_0x37918f){if(_0x37918f){return _0xa9fa24[_0xb570('0x1b')](_0x1bb73d)[_0xb570('0x1c')](_0x37918f);}};}function respondWithFilteredResult(_0x53c4b4,_0x459407){return function(_0x3e314a){if(_0x3e314a){var _0x2f19c2=_0x3e314a[_0xb570('0x1d')],_0x253334=_0x459407[_0xb570('0x1e')],_0x376def=_0x459407[_0xb570('0x1e')]+_0x459407[_0xb570('0x1f')],_0x7777e;if(_0x376def>=_0x2f19c2){_0x376def=_0x2f19c2;_0x7777e=0xc8;}else{_0x7777e=0xce;}_0x53c4b4[_0xb570('0x1b')](_0x7777e);return _0x53c4b4[_0xb570('0x20')](_0xb570('0x21'),_0x253334+'-'+_0x376def+'/'+_0x2f19c2)[_0xb570('0x1c')](_0x3e314a);}return null;};}function patchUpdates(_0x137c4f){return function(_0x200af8){try{jsonpatch[_0xb570('0x22')](_0x200af8,_0x137c4f,!![]);}catch(_0x53d72c){return BPromise[_0xb570('0x23')](_0x53d72c);}return _0x200af8['save']();};}function saveUpdates(_0x348a42,_0x41c94d){return function(_0x52e6a2){if(_0x52e6a2){return _0x52e6a2['update'](_0x348a42)[_0xb570('0x24')](function(_0x10321a){return _0x10321a;});}return null;};}function removeEntity(_0x5e15ef,_0xb0829c){return function(_0x5cc133){if(_0x5cc133){return _0x5cc133[_0xb570('0x25')]()['then'](function(){_0x5e15ef[_0xb570('0x1b')](0xcc)[_0xb570('0x1a')]();});}};}function handleEntityNotFound(_0xe7cbf7,_0x3ddb03){return function(_0x2d454a){if(!_0x2d454a){_0xe7cbf7[_0xb570('0x19')](0x194);}return _0x2d454a;};}function handleError(_0x1cab66,_0x39794b){_0x39794b=_0x39794b||0x1f4;return function(_0x5dd488){logger['error'](_0x5dd488[_0xb570('0x26')]);if(_0x5dd488[_0xb570('0x27')]){delete _0x5dd488[_0xb570('0x27')];}_0x1cab66[_0xb570('0x1b')](_0x39794b)[_0xb570('0x28')](_0x5dd488);};}exports[_0xb570('0x29')]=function(_0xd84515,_0x220df7){var _0x24fc58={},_0x39bf96={},_0x25c8fb={'count':0x0,'rows':[]};var _0x49a501=_[_0xb570('0x2a')](db[_0xb570('0x2b')]['rawAttributes'],function(_0x303993){return{'name':_0x303993[_0xb570('0x2c')],'type':_0x303993['type'][_0xb570('0x2d')]};});_0x39bf96[_0xb570('0x2e')]=_[_0xb570('0x2a')](_0x49a501,_0xb570('0x27'));_0x39bf96['query']=_[_0xb570('0x2f')](_0xd84515[_0xb570('0x30')]);_0x39bf96[_0xb570('0x31')]=_[_0xb570('0x32')](_0x39bf96[_0xb570('0x2e')],_0x39bf96[_0xb570('0x30')]);_0x24fc58[_0xb570('0x33')]=_['intersection'](_0x39bf96[_0xb570('0x2e')],qs[_0xb570('0x34')](_0xd84515[_0xb570('0x30')][_0xb570('0x34')]));_0x24fc58[_0xb570('0x33')]=_0x24fc58[_0xb570('0x33')][_0xb570('0x35')]?_0x24fc58[_0xb570('0x33')]:_0x39bf96['model'];if(!_0xd84515['query'][_0xb570('0x36')](_0xb570('0x37'))){_0x24fc58[_0xb570('0x1f')]=qs[_0xb570('0x1f')](_0xd84515[_0xb570('0x30')][_0xb570('0x1f')]);_0x24fc58[_0xb570('0x1e')]=qs[_0xb570('0x1e')](_0xd84515[_0xb570('0x30')][_0xb570('0x1e')]);}_0x24fc58[_0xb570('0x38')]=qs[_0xb570('0x39')](_0xd84515['query'][_0xb570('0x39')]);_0x24fc58[_0xb570('0x3a')]=qs['filters'](_[_0xb570('0x3b')](_0xd84515[_0xb570('0x30')],_0x39bf96[_0xb570('0x31')]),_0x49a501);if(_0xd84515[_0xb570('0x30')][_0xb570('0x3c')]){_0x24fc58['where']=_['merge'](_0x24fc58[_0xb570('0x3a')],{'$or':_['map'](_0x49a501,function(_0x146e15){if(_0x146e15[_0xb570('0x3d')]!=='VIRTUAL'){var _0x26b809={};_0x26b809[_0x146e15[_0xb570('0x27')]]={'$like':'%'+_0xd84515[_0xb570('0x30')][_0xb570('0x3c')]+'%'};return _0x26b809;}})});}_0x24fc58=_['merge']({},_0x24fc58,_0xd84515[_0xb570('0x3e')]);var _0x1224f4={'where':_0x24fc58[_0xb570('0x3a')]};return db[_0xb570('0x2b')][_0xb570('0x1d')](_0x1224f4)[_0xb570('0x24')](function(_0x1305ce){_0x25c8fb['count']=_0x1305ce;if(_0xd84515[_0xb570('0x30')][_0xb570('0x3f')]){_0x24fc58[_0xb570('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x24fc58);})['then'](function(_0x180838){_0x25c8fb[_0xb570('0x41')]=_0x180838;return _0x25c8fb;})[_0xb570('0x24')](respondWithFilteredResult(_0x220df7,_0x24fc58))[_0xb570('0x42')](handleError(_0x220df7,null));};exports[_0xb570('0x43')]=function(_0xdfd55e,_0x5b19fd){var _0xdb4145={'raw':!![],'where':{'id':_0xdfd55e[_0xb570('0x44')]['id']}},_0x308d4d={};_0x308d4d[_0xb570('0x2e')]=_[_0xb570('0x2f')](db[_0xb570('0x2b')]['rawAttributes']);_0x308d4d[_0xb570('0x30')]=_[_0xb570('0x2f')](_0xdfd55e['query']);_0x308d4d[_0xb570('0x31')]=_[_0xb570('0x32')](_0x308d4d[_0xb570('0x2e')],_0x308d4d['query']);_0xdb4145[_0xb570('0x33')]=_[_0xb570('0x32')](_0x308d4d[_0xb570('0x2e')],qs[_0xb570('0x34')](_0xdfd55e[_0xb570('0x30')][_0xb570('0x34')]));_0xdb4145[_0xb570('0x33')]=_0xdb4145[_0xb570('0x33')][_0xb570('0x35')]?_0xdb4145[_0xb570('0x33')]:_0x308d4d[_0xb570('0x2e')];if(_0xdfd55e['query'][_0xb570('0x3f')]){_0xdb4145[_0xb570('0x40')]=[{'all':!![]}];}_0xdb4145=_[_0xb570('0x45')]({},_0xdb4145,_0xdfd55e[_0xb570('0x3e')]);return db[_0xb570('0x2b')][_0xb570('0x46')](_0xdb4145)[_0xb570('0x24')](handleEntityNotFound(_0x5b19fd,null))[_0xb570('0x24')](respondWithResult(_0x5b19fd,null))['catch'](handleError(_0x5b19fd,null));};exports[_0xb570('0x47')]=function(_0x120ad9,_0x3e84ae){return db[_0xb570('0x2b')][_0xb570('0x47')](_0x120ad9[_0xb570('0x48')],{})[_0xb570('0x24')](respondWithResult(_0x3e84ae,0xc9))[_0xb570('0x42')](handleError(_0x3e84ae,null));};exports[_0xb570('0x49')]=function(_0x34a4dc,_0x55701b){if(_0x34a4dc[_0xb570('0x48')]['id']){delete _0x34a4dc[_0xb570('0x48')]['id'];}return db['WhatsappApplication'][_0xb570('0x46')]({'where':{'id':_0x34a4dc[_0xb570('0x44')]['id']}})[_0xb570('0x24')](handleEntityNotFound(_0x55701b,null))[_0xb570('0x24')](saveUpdates(_0x34a4dc[_0xb570('0x48')],null))['then'](respondWithResult(_0x55701b,null))[_0xb570('0x42')](handleError(_0x55701b,null));};exports[_0xb570('0x25')]=function(_0x572756,_0x36acd8){return db[_0xb570('0x2b')][_0xb570('0x46')]({'where':{'id':_0x572756[_0xb570('0x44')]['id']}})[_0xb570('0x24')](handleEntityNotFound(_0x36acd8,null))[_0xb570('0x24')](removeEntity(_0x36acd8,null))[_0xb570('0x42')](handleError(_0x36acd8,null));}; \ No newline at end of file +var _0x0dcd=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappApplication','include','catch','params','includeAll','merge','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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/utils','../../config/environment','../../mysqldb'];(function(_0x2a85d4,_0x2dd390){var _0x4e0110=function(_0x920c9){while(--_0x920c9){_0x2a85d4['push'](_0x2a85d4['shift']());}};_0x4e0110(++_0x2dd390);}(_0x0dcd,0x1d7));var _0xd0dc=function(_0x5964bc,_0x17aecf){_0x5964bc=_0x5964bc-0x0;var _0x57d001=_0x0dcd[_0x5964bc];return _0x57d001;};'use strict';var pdf=require(_0xd0dc('0x0'));var emlformat=require(_0xd0dc('0x1'));var rimraf=require(_0xd0dc('0x2'));var zipdir=require(_0xd0dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0dc('0x4'));var moment=require(_0xd0dc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0dc('0x6'));var path=require(_0xd0dc('0x7'));var sox=require(_0xd0dc('0x8'));var csv=require('to-csv');var ejs=require(_0xd0dc('0x9'));var fs=require('fs');var _=require(_0xd0dc('0xa'));var squel=require(_0xd0dc('0xb'));var crypto=require(_0xd0dc('0xc'));var jsforce=require(_0xd0dc('0xd'));var deskjs=require(_0xd0dc('0xe'));var toCsv=require(_0xd0dc('0xf'));var querystring=require('querystring');var Papa=require(_0xd0dc('0x10'));var Redis=require(_0xd0dc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd0dc('0x12'));var as=require(_0xd0dc('0x13'));var hardwareService=require(_0xd0dc('0x14'));var logger=require(_0xd0dc('0x15'))(_0xd0dc('0x16'));var utils=require(_0xd0dc('0x17'));var config=require(_0xd0dc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0dc('0x19'))['db'];function respondWithStatusCode(_0x2afb43,_0xf90552){_0xf90552=_0xf90552||0xcc;return function(_0x27e456){if(_0x27e456){return _0x2afb43[_0xd0dc('0x1a')](_0xf90552);}return _0x2afb43[_0xd0dc('0x1b')](_0xf90552)[_0xd0dc('0x1c')]();};}function respondWithResult(_0x3549a2,_0x995c6c){_0x995c6c=_0x995c6c||0xc8;return function(_0x198ab1){if(_0x198ab1){return _0x3549a2[_0xd0dc('0x1b')](_0x995c6c)[_0xd0dc('0x1d')](_0x198ab1);}};}function respondWithFilteredResult(_0x2ad148,_0xb7662f){return function(_0x816df2){if(_0x816df2){var _0x3b3196=_0x816df2[_0xd0dc('0x1e')],_0x4ef627=_0xb7662f[_0xd0dc('0x1f')],_0x174f2f=_0xb7662f[_0xd0dc('0x1f')]+_0xb7662f[_0xd0dc('0x20')],_0x3b97af;if(_0x174f2f>=_0x3b3196){_0x174f2f=_0x3b3196;_0x3b97af=0xc8;}else{_0x3b97af=0xce;}_0x2ad148[_0xd0dc('0x1b')](_0x3b97af);return _0x2ad148[_0xd0dc('0x21')](_0xd0dc('0x22'),_0x4ef627+'-'+_0x174f2f+'/'+_0x3b3196)['json'](_0x816df2);}return null;};}function patchUpdates(_0x91490e){return function(_0x547abb){try{jsonpatch[_0xd0dc('0x23')](_0x547abb,_0x91490e,!![]);}catch(_0x2261cf){return BPromise['reject'](_0x2261cf);}return _0x547abb['save']();};}function saveUpdates(_0x3e0e0e,_0x1d01a8){return function(_0x404dc0){if(_0x404dc0){return _0x404dc0[_0xd0dc('0x24')](_0x3e0e0e)[_0xd0dc('0x25')](function(_0x199c14){return _0x199c14;});}return null;};}function removeEntity(_0x27d1ba,_0x3c5b8d){return function(_0x599591){if(_0x599591){return _0x599591[_0xd0dc('0x26')]()['then'](function(){_0x27d1ba[_0xd0dc('0x1b')](0xcc)[_0xd0dc('0x1c')]();});}};}function handleEntityNotFound(_0x14083d,_0x2dba9c){return function(_0x4f106f){if(!_0x4f106f){_0x14083d[_0xd0dc('0x1a')](0x194);}return _0x4f106f;};}function handleError(_0x6f3851,_0x12eba0){_0x12eba0=_0x12eba0||0x1f4;return function(_0x5b2603){logger[_0xd0dc('0x27')](_0x5b2603['stack']);if(_0x5b2603[_0xd0dc('0x28')]){delete _0x5b2603[_0xd0dc('0x28')];}_0x6f3851[_0xd0dc('0x1b')](_0x12eba0)['send'](_0x5b2603);};}exports[_0xd0dc('0x29')]=function(_0x359ec1,_0x213ffa){var _0x1d18f8={},_0x457899={},_0x1b796b={'count':0x0,'rows':[]};var _0x60c07c=_[_0xd0dc('0x2a')](db['WhatsappApplication'][_0xd0dc('0x2b')],function(_0x3bf085){return{'name':_0x3bf085[_0xd0dc('0x2c')],'type':_0x3bf085[_0xd0dc('0x2d')][_0xd0dc('0x2e')]};});_0x457899[_0xd0dc('0x2f')]=_[_0xd0dc('0x2a')](_0x60c07c,_0xd0dc('0x28'));_0x457899[_0xd0dc('0x30')]=_[_0xd0dc('0x31')](_0x359ec1[_0xd0dc('0x30')]);_0x457899[_0xd0dc('0x32')]=_[_0xd0dc('0x33')](_0x457899[_0xd0dc('0x2f')],_0x457899[_0xd0dc('0x30')]);_0x1d18f8[_0xd0dc('0x34')]=_['intersection'](_0x457899[_0xd0dc('0x2f')],qs[_0xd0dc('0x35')](_0x359ec1[_0xd0dc('0x30')][_0xd0dc('0x35')]));_0x1d18f8[_0xd0dc('0x34')]=_0x1d18f8[_0xd0dc('0x34')][_0xd0dc('0x36')]?_0x1d18f8[_0xd0dc('0x34')]:_0x457899['model'];if(!_0x359ec1[_0xd0dc('0x30')][_0xd0dc('0x37')](_0xd0dc('0x38'))){_0x1d18f8['limit']=qs[_0xd0dc('0x20')](_0x359ec1[_0xd0dc('0x30')]['limit']);_0x1d18f8[_0xd0dc('0x1f')]=qs[_0xd0dc('0x1f')](_0x359ec1['query'][_0xd0dc('0x1f')]);}_0x1d18f8[_0xd0dc('0x39')]=qs[_0xd0dc('0x3a')](_0x359ec1[_0xd0dc('0x30')]['sort']);_0x1d18f8[_0xd0dc('0x3b')]=qs[_0xd0dc('0x32')](_[_0xd0dc('0x3c')](_0x359ec1[_0xd0dc('0x30')],_0x457899[_0xd0dc('0x32')]),_0x60c07c);if(_0x359ec1[_0xd0dc('0x30')]['filter']){_0x1d18f8[_0xd0dc('0x3b')]=_['merge'](_0x1d18f8[_0xd0dc('0x3b')],{'$or':_[_0xd0dc('0x2a')](_0x60c07c,function(_0x10e88c){if(_0x10e88c[_0xd0dc('0x2d')]!=='VIRTUAL'){var _0x4a7321={};_0x4a7321[_0x10e88c[_0xd0dc('0x28')]]={'$like':'%'+_0x359ec1[_0xd0dc('0x30')]['filter']+'%'};return _0x4a7321;}})});}_0x1d18f8=_['merge']({},_0x1d18f8,_0x359ec1['options']);var _0x1d1e0f={'where':_0x1d18f8[_0xd0dc('0x3b')]};return db[_0xd0dc('0x3d')]['count'](_0x1d1e0f)[_0xd0dc('0x25')](function(_0x5cc1c3){_0x1b796b[_0xd0dc('0x1e')]=_0x5cc1c3;if(_0x359ec1[_0xd0dc('0x30')]['includeAll']){_0x1d18f8[_0xd0dc('0x3e')]=[{'all':!![]}];}return db[_0xd0dc('0x3d')]['findAll'](_0x1d18f8);})[_0xd0dc('0x25')](function(_0x40a560){_0x1b796b['rows']=_0x40a560;return _0x1b796b;})[_0xd0dc('0x25')](respondWithFilteredResult(_0x213ffa,_0x1d18f8))[_0xd0dc('0x3f')](handleError(_0x213ffa,null));};exports['show']=function(_0x5e709c,_0x575ea1){var _0x24650f={'raw':!![],'where':{'id':_0x5e709c[_0xd0dc('0x40')]['id']}},_0x58adb0={};_0x58adb0[_0xd0dc('0x2f')]=_['keys'](db['WhatsappApplication'][_0xd0dc('0x2b')]);_0x58adb0[_0xd0dc('0x30')]=_['keys'](_0x5e709c[_0xd0dc('0x30')]);_0x58adb0[_0xd0dc('0x32')]=_[_0xd0dc('0x33')](_0x58adb0[_0xd0dc('0x2f')],_0x58adb0['query']);_0x24650f['attributes']=_['intersection'](_0x58adb0[_0xd0dc('0x2f')],qs[_0xd0dc('0x35')](_0x5e709c[_0xd0dc('0x30')][_0xd0dc('0x35')]));_0x24650f[_0xd0dc('0x34')]=_0x24650f[_0xd0dc('0x34')]['length']?_0x24650f[_0xd0dc('0x34')]:_0x58adb0['model'];if(_0x5e709c[_0xd0dc('0x30')][_0xd0dc('0x41')]){_0x24650f['include']=[{'all':!![]}];}_0x24650f=_[_0xd0dc('0x42')]({},_0x24650f,_0x5e709c[_0xd0dc('0x43')]);return db[_0xd0dc('0x3d')][_0xd0dc('0x44')](_0x24650f)[_0xd0dc('0x25')](handleEntityNotFound(_0x575ea1,null))[_0xd0dc('0x25')](respondWithResult(_0x575ea1,null))[_0xd0dc('0x3f')](handleError(_0x575ea1,null));};exports[_0xd0dc('0x45')]=function(_0x407bc8,_0x2959b9){return db[_0xd0dc('0x3d')]['create'](_0x407bc8['body'],{})[_0xd0dc('0x25')](respondWithResult(_0x2959b9,0xc9))[_0xd0dc('0x3f')](handleError(_0x2959b9,null));};exports['update']=function(_0x19e9eb,_0x20dd58){if(_0x19e9eb['body']['id']){delete _0x19e9eb[_0xd0dc('0x46')]['id'];}return db[_0xd0dc('0x3d')]['find']({'where':{'id':_0x19e9eb[_0xd0dc('0x40')]['id']}})[_0xd0dc('0x25')](handleEntityNotFound(_0x20dd58,null))[_0xd0dc('0x25')](saveUpdates(_0x19e9eb['body'],null))[_0xd0dc('0x25')](respondWithResult(_0x20dd58,null))['catch'](handleError(_0x20dd58,null));};exports['destroy']=function(_0x2d72f4,_0x5b11c4){return db[_0xd0dc('0x3d')]['find']({'where':{'id':_0x2d72f4[_0xd0dc('0x40')]['id']}})[_0xd0dc('0x25')](handleEntityNotFound(_0x5b11c4,null))[_0xd0dc('0x25')](removeEntity(_0x5b11c4,null))[_0xd0dc('0x3f')](handleError(_0x5b11c4,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index dc566c8..85c80ba 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 _0xcead=['request-promise','path','rimraf','../../config/environment','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0xc7c4b5,_0x36bcf2){var _0x22a7a9=function(_0x3425f8){while(--_0x3425f8){_0xc7c4b5['push'](_0xc7c4b5['shift']());}};_0x22a7a9(++_0x36bcf2);}(_0xcead,0x194));var _0xdcea=function(_0x2e9a63,_0xcb23f1){_0x2e9a63=_0x2e9a63-0x0;var _0x130ea5=_0xcead[_0x2e9a63];return _0x130ea5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdcea('0x0'))(_0xdcea('0x1'));var moment=require(_0xdcea('0x2'));var BPromise=require('bluebird');var rp=require(_0xdcea('0x3'));var fs=require('fs');var path=require(_0xdcea('0x4'));var rimraf=require(_0xdcea('0x5'));var config=require(_0xdcea('0x6'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x377c6c,_0x15ec3a){return _0x377c6c[_0xdcea('0x7')](_0xdcea('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdcea('0x9'),'collate':_0xdcea('0xa')});}; \ No newline at end of file +var _0xe8ae=['moment','request-promise','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x332ff9,_0x2a6021){var _0x11ca93=function(_0x144f9a){while(--_0x144f9a){_0x332ff9['push'](_0x332ff9['shift']());}};_0x11ca93(++_0x2a6021);}(_0xe8ae,0x9a));var _0xee8a=function(_0x470543,_0x529f93){_0x470543=_0x470543-0x0;var _0x5feec2=_0xe8ae[_0x470543];return _0x5feec2;};'use strict';var _=require(_0xee8a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee8a('0x1'));var moment=require(_0xee8a('0x2'));var BPromise=require('bluebird');var rp=require(_0xee8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee8a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee8a('0x5'));module[_0xee8a('0x6')]=function(_0x2c9501,_0x455900){return _0x2c9501[_0xee8a('0x7')](_0xee8a('0x8'),attributes,{'tableName':_0xee8a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee8a('0xa'),'collate':_0xee8a('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ef2c684..5a2605f 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 _0x06f4=['error','message','info','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x5eebe3,_0x5a3e61){var _0xcae9f1=function(_0x51a7e0){while(--_0x51a7e0){_0x5eebe3['push'](_0x5eebe3['shift']());}};_0xcae9f1(++_0x5a3e61);}(_0x06f4,0x136));var _0x406f=function(_0x1024bd,_0x4a7d88){_0x1024bd=_0x1024bd-0x0;var _0xd048da=_0x06f4[_0x1024bd];return _0xd048da;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var moment=require('moment');var BPromise=require(_0x406f('0x2'));var rs=require(_0x406f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x406f('0x4'));var logger=require('../../config/logger')(_0x406f('0x5'));var config=require(_0x406f('0x6'));var jayson=require(_0x406f('0x7'));var client=jayson[_0x406f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2886,_0x5bec4f,_0x1afec4){return new BPromise(function(_0x1c39ce,_0xc2f682){return client['request'](_0x1d2886,_0x1afec4)[_0x406f('0x9')](function(_0x52bad2){logger['info'](_0x406f('0xa'),_0x5bec4f,'request\x20sent');logger[_0x406f('0xb')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x5bec4f,_0x406f('0xc'),JSON['stringify'](_0x52bad2));if(_0x52bad2[_0x406f('0xd')]){if(_0x52bad2[_0x406f('0xd')]['code']===0x1f4){logger[_0x406f('0xd')](_0x406f('0xa'),_0x5bec4f,_0x52bad2[_0x406f('0xd')][_0x406f('0xe')]);return _0xc2f682(_0x52bad2[_0x406f('0xd')][_0x406f('0xe')]);}logger[_0x406f('0xd')](_0x406f('0xa'),_0x5bec4f,_0x52bad2[_0x406f('0xd')][_0x406f('0xe')]);return _0x1c39ce(_0x52bad2[_0x406f('0xd')]['message']);}else{logger[_0x406f('0xf')](_0x406f('0xa'),_0x5bec4f,_0x406f('0xc'));_0x1c39ce(_0x52bad2['result'][_0x406f('0xe')]);}})[_0x406f('0x10')](function(_0x4dfbc1){logger['error'](_0x406f('0xa'),_0x5bec4f,_0x4dfbc1);_0xc2f682(_0x4dfbc1);});});} \ No newline at end of file +var _0xed54=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','util'];(function(_0x3f7861,_0x13619b){var _0x36fdae=function(_0x6aa7b8){while(--_0x6aa7b8){_0x3f7861['push'](_0x3f7861['shift']());}};_0x36fdae(++_0x13619b);}(_0xed54,0xfc));var _0x4ed5=function(_0x2d41bb,_0x2a8584){_0x2d41bb=_0x2d41bb-0x0;var _0x1ce894=_0xed54[_0x2d41bb];return _0x1ce894;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var moment=require(_0x4ed5('0x1'));var BPromise=require(_0x4ed5('0x2'));var rs=require(_0x4ed5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ed5('0x4'))['db'];var utils=require(_0x4ed5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ed5('0x6'));var jayson=require(_0x4ed5('0x7'));var client=jayson[_0x4ed5('0x8')][_0x4ed5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32b0b3,_0x406871,_0x499db9){return new BPromise(function(_0x487945,_0x3993ac){return client[_0x4ed5('0xa')](_0x32b0b3,_0x499db9)[_0x4ed5('0xb')](function(_0xb74766){logger[_0x4ed5('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x406871,_0x4ed5('0xd'));logger[_0x4ed5('0xe')](_0x4ed5('0xf'),_0x406871,_0x4ed5('0xd'),JSON[_0x4ed5('0x10')](_0xb74766));if(_0xb74766['error']){if(_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x12')]===0x1f4){logger[_0x4ed5('0x11')](_0x4ed5('0x13'),_0x406871,_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);return _0x3993ac(_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x406871,_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);return _0x487945(_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);}else{logger[_0x4ed5('0xc')](_0x4ed5('0x13'),_0x406871,_0x4ed5('0xd'));_0x487945(_0xb74766[_0x4ed5('0x15')][_0x4ed5('0x14')]);}})[_0x4ed5('0x16')](function(_0x168916){logger[_0x4ed5('0x11')](_0x4ed5('0x13'),_0x406871,_0x168916);_0x3993ac(_0x168916);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f36c434..9f24656 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 _0x3fe2=['/:id','/:id/download','download','post','/:id/messages','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','update','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xc248ba,_0x4b69db){var _0x4fa874=function(_0x1ad295){while(--_0x1ad295){_0xc248ba['push'](_0xc248ba['shift']());}};_0x4fa874(++_0x4b69db);}(_0x3fe2,0x1ee));var _0x23fe=function(_0x4eaff3,_0x14e7cd){_0x4eaff3=_0x4eaff3-0x0;var _0x5acaa6=_0x3fe2[_0x4eaff3];return _0x5acaa6;};'use strict';var multer=require(_0x23fe('0x0'));var util=require('util');var path=require(_0x23fe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x23fe('0x2'));var interaction=require(_0x23fe('0x3'));var config=require('../../config/environment');var controller=require(_0x23fe('0x4'));router[_0x23fe('0x5')]('/',auth[_0x23fe('0x6')](),controller[_0x23fe('0x7')]);router['get'](_0x23fe('0x8'),auth[_0x23fe('0x6')](),controller[_0x23fe('0x9')]);router[_0x23fe('0x5')](_0x23fe('0xa'),auth[_0x23fe('0x6')](),controller['show']);router[_0x23fe('0x5')]('/:id/messages',auth[_0x23fe('0x6')](),controller['getMessages']);router[_0x23fe('0x5')](_0x23fe('0xb'),auth['isAuthenticated'](),controller[_0x23fe('0xc')]);router['post']('/',auth[_0x23fe('0x6')](),controller['create']);router[_0x23fe('0xd')](_0x23fe('0xe'),auth[_0x23fe('0x6')](),controller['addMessage']);router[_0x23fe('0xd')](_0x23fe('0xf'),auth[_0x23fe('0x6')](),interaction[_0x23fe('0x10')](_0x23fe('0x11'),'whatsappinteraction:addtags'),controller[_0x23fe('0x12')]);router['put'](_0x23fe('0xa'),auth[_0x23fe('0x6')](),interaction[_0x23fe('0x10')](_0x23fe('0x11'),_0x23fe('0x13')),controller[_0x23fe('0x14')]);router[_0x23fe('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x23fe('0x11'),'whatsappinteraction:destroy'),controller[_0x23fe('0x16')]);router['delete']('/:id/tags',auth[_0x23fe('0x6')](),controller['removeTags']);module[_0x23fe('0x17')]=router; \ No newline at end of file +var _0xc375=['get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x5302c0,_0x13d656){var _0x912371=function(_0x45765c){while(--_0x45765c){_0x5302c0['push'](_0x5302c0['shift']());}};_0x912371(++_0x13d656);}(_0xc375,0x1b8));var _0x5c37=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xc375[_0x2e78e9];return _0x35aad4;};'use strict';var multer=require(_0x5c37('0x0'));var util=require('util');var path=require(_0x5c37('0x1'));var timeout=require(_0x5c37('0x2'));var express=require(_0x5c37('0x3'));var router=express['Router']();var auth=require(_0x5c37('0x4'));var interaction=require(_0x5c37('0x5'));var config=require(_0x5c37('0x6'));var controller=require(_0x5c37('0x7'));router[_0x5c37('0x8')]('/',auth[_0x5c37('0x9')](),controller[_0x5c37('0xa')]);router[_0x5c37('0x8')]('/describe',auth[_0x5c37('0x9')](),controller[_0x5c37('0xb')]);router[_0x5c37('0x8')](_0x5c37('0xc'),auth[_0x5c37('0x9')](),controller[_0x5c37('0xd')]);router[_0x5c37('0x8')](_0x5c37('0xe'),auth['isAuthenticated'](),controller[_0x5c37('0xf')]);router[_0x5c37('0x8')](_0x5c37('0x10'),auth[_0x5c37('0x9')](),controller[_0x5c37('0x11')]);router[_0x5c37('0x12')]('/',auth[_0x5c37('0x9')](),controller[_0x5c37('0x13')]);router['post'](_0x5c37('0xe'),auth[_0x5c37('0x9')](),controller[_0x5c37('0x14')]);router['post'](_0x5c37('0x15'),auth['isAuthenticated'](),interaction[_0x5c37('0x16')](_0x5c37('0x17'),_0x5c37('0x18')),controller[_0x5c37('0x19')]);router[_0x5c37('0x1a')](_0x5c37('0xc'),auth[_0x5c37('0x9')](),interaction['tracked'](_0x5c37('0x17'),_0x5c37('0x1b')),controller[_0x5c37('0x1c')]);router[_0x5c37('0x1d')](_0x5c37('0xc'),auth[_0x5c37('0x9')](),interaction[_0x5c37('0x16')]('whatsapp',_0x5c37('0x1e')),controller['destroy']);router[_0x5c37('0x1d')](_0x5c37('0x15'),auth[_0x5c37('0x9')](),controller[_0x5c37('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 5393e44..783d8bb 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 _0x10df=['DATE','ENUM','out','sequelize','moment','BOOLEAN','STRING'];(function(_0x5421eb,_0x426220){var _0x2a23e5=function(_0x565bc2){while(--_0x565bc2){_0x5421eb['push'](_0x5421eb['shift']());}};_0x2a23e5(++_0x426220);}(_0x10df,0x1ae));var _0xf10d=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x10df[_0x77d310];return _0x2cdce4;};'use strict';var Sequelize=require(_0xf10d('0x0'));var moment=require(_0xf10d('0x1'));module['exports']={'closed':{'type':Sequelize[_0xf10d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf10d('0x3')]},'secondDisposition':{'type':Sequelize[_0xf10d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf10d('0x3')]},'note':{'type':Sequelize[_0xf10d('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf10d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf10d('0x5')]('in',_0xf10d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf10d('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf10d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x407f=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x407f,0xc2));var _0xf407=function(_0x33609a,_0x3ad162){_0x33609a=_0x33609a-0x0;var _0x2b33e5=_0x407f[_0x33609a];return _0x2b33e5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xf407('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf407('0x1')]},'disposition':{'type':Sequelize[_0xf407('0x2')]},'secondDisposition':{'type':Sequelize[_0xf407('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf407('0x2')]},'note':{'type':Sequelize[_0xf407('0x2')]},'phone':{'type':Sequelize[_0xf407('0x2')]},'read1stAt':{'type':Sequelize[_0xf407('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xf407('0x3')]('in',_0xf407('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf407('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xf407('0x3')]('in',_0xf407('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b3832d3..517cac8 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 _0xcb18=['CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','params','includeAll','include','merge','options','create','update','describe','addMessage','WhatsappMessage','ids','getMessages','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','tmp','files','CmContact','lastName','direction','Account','Owner','get','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','Messages','Attachment','basename','createReadStream','pipe','createWriteStream','out','firstName','renderFile','server','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','index','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xcb18,0x159));var _0x8cb1=function(_0x43949f,_0x62183){_0x43949f=_0x43949f-0x0;var _0x288147=_0xcb18[_0x43949f];return _0x288147;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cb1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cb1('0x1'));var rp=require('request-promise');var moment=require(_0x8cb1('0x2'));var BPromise=require(_0x8cb1('0x3'));var Mustache=require(_0x8cb1('0x4'));var util=require(_0x8cb1('0x5'));var path=require(_0x8cb1('0x6'));var sox=require(_0x8cb1('0x7'));var csv=require('to-csv');var ejs=require(_0x8cb1('0x8'));var fs=require('fs');var _=require(_0x8cb1('0x9'));var squel=require('squel');var crypto=require(_0x8cb1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8cb1('0xb'));var toCsv=require(_0x8cb1('0xc'));var querystring=require('querystring');var Papa=require(_0x8cb1('0xd'));var Redis=require(_0x8cb1('0xe'));var authService=require(_0x8cb1('0xf'));var qs=require(_0x8cb1('0x10'));var as=require(_0x8cb1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cb1('0x12'))(_0x8cb1('0x13'));var utils=require(_0x8cb1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8cb1('0x15'));var db=require(_0x8cb1('0x16'))['db'];config[_0x8cb1('0x17')]=_[_0x8cb1('0x18')](config[_0x8cb1('0x17')],{'host':_0x8cb1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cb1('0x17')]));require('./whatsappInteraction.socket')[_0x8cb1('0x1a')](socket);function respondWithStatusCode(_0x2fe7a3,_0x3f650a){_0x3f650a=_0x3f650a||0xcc;return function(_0x2d389b){if(_0x2d389b){return _0x2fe7a3[_0x8cb1('0x1b')](_0x3f650a);}return _0x2fe7a3[_0x8cb1('0x1c')](_0x3f650a)['end']();};}function respondWithResult(_0x1f34f8,_0x4b6320){_0x4b6320=_0x4b6320||0xc8;return function(_0x5b2859){if(_0x5b2859){return _0x1f34f8['status'](_0x4b6320)[_0x8cb1('0x1d')](_0x5b2859);}};}function respondWithFilteredResult(_0x450d05,_0x384d5c){return function(_0x49d1ef){if(_0x49d1ef){var _0x25b578=_0x49d1ef['count'],_0x14c1fa=_0x384d5c[_0x8cb1('0x1e')],_0x565284=_0x384d5c['offset']+_0x384d5c[_0x8cb1('0x1f')],_0x57f55c;if(_0x565284>=_0x25b578){_0x565284=_0x25b578;_0x57f55c=0xc8;}else{_0x57f55c=0xce;}_0x450d05[_0x8cb1('0x1c')](_0x57f55c);return _0x450d05[_0x8cb1('0x20')](_0x8cb1('0x21'),_0x14c1fa+'-'+_0x565284+'/'+_0x25b578)['json'](_0x49d1ef);}return null;};}function patchUpdates(_0x3f0370){return function(_0x5df496){try{jsonpatch[_0x8cb1('0x22')](_0x5df496,_0x3f0370,!![]);}catch(_0x475ea4){return BPromise[_0x8cb1('0x23')](_0x475ea4);}return _0x5df496['save']();};}function saveUpdates(_0x3bc045,_0x57ece3){return function(_0x521369){if(_0x521369){return _0x521369['update'](_0x3bc045)[_0x8cb1('0x24')](function(_0x5d34d4){return _0x5d34d4;});}return null;};}function removeEntity(_0x19886c,_0x22eb2d){return function(_0x391653){if(_0x391653){return _0x391653[_0x8cb1('0x25')]()['then'](function(){_0x19886c[_0x8cb1('0x1c')](0xcc)[_0x8cb1('0x26')]();});}};}function handleEntityNotFound(_0x500106,_0x548707){return function(_0x10b854){if(!_0x10b854){_0x500106['sendStatus'](0x194);}return _0x10b854;};}function handleError(_0xcc6e9d,_0x44edde){_0x44edde=_0x44edde||0x1f4;return function(_0xe9ef53){logger[_0x8cb1('0x27')](_0xe9ef53[_0x8cb1('0x28')]);if(_0xe9ef53[_0x8cb1('0x29')]){delete _0xe9ef53[_0x8cb1('0x29')];}_0xcc6e9d[_0x8cb1('0x1c')](_0x44edde)[_0x8cb1('0x2a')](_0xe9ef53);};}function getInteractionUsers(_0x4255f4,_0x41bb77){return new BPromise(function(_0x5d7ab9,_0x427544){try{if(_0x41bb77[_0x4255f4['id']]){_0x4255f4[_0x8cb1('0x2b')]=_[_0x8cb1('0x2c')](_0x41bb77[_0x4255f4['id']],function(_0x324b25){return{'id':_0x324b25['id'],'fullname':_0x324b25[_0x8cb1('0x2d')]};});}}catch(_0x447f68){_0x427544(_0x447f68);}_0x5d7ab9(_0x4255f4);});}function getInteractionTags(_0x56169b,_0x475898){return new BPromise(function(_0x389790,_0x203cb3){try{if(_0x56169b['TagIds']){_0x56169b[_0x8cb1('0x2e')]=[];_0x56169b[_0x8cb1('0x2f')]['split'](',')[_0x8cb1('0x30')](function(_0x42b56e){_0x56169b[_0x8cb1('0x2e')][_0x8cb1('0x31')](_0x475898[_0x42b56e]);});}delete _0x56169b[_0x8cb1('0x2f')];}catch(_0x364d83){_0x203cb3(_0x364d83);}_0x389790(_0x56169b);});}function updateWhatsappInteraction(_0x5a8642,_0x1034b4,_0x286089){return new BPromise(function(_0x421c21,_0x5d0226){return getInteractionUsers(_0x5a8642,_0x286089)[_0x8cb1('0x24')](function(_0x27ec95){return getInteractionTags(_0x27ec95,_0x1034b4);})[_0x8cb1('0x24')](function(_0xa3f417){_0x421c21(_0xa3f417);})['catch'](function(_0x1c6d4a){_0x5d0226(_0x1c6d4a);});});}exports[_0x8cb1('0x32')]=function(_0x1ca4b8,_0x2fb688){var _0x136450={},_0x15823d={},_0xbb61fa={'count':0x0,'rows':[]};var _0x339e4c=_['map'](db[_0x8cb1('0x33')][_0x8cb1('0x34')],function(_0x525836){return{'name':_0x525836[_0x8cb1('0x35')],'type':_0x525836['type'][_0x8cb1('0x36')]};});_0x15823d[_0x8cb1('0x37')]=_['map'](_0x339e4c,'name');_0x15823d[_0x8cb1('0x38')]=_[_0x8cb1('0x39')](_0x1ca4b8[_0x8cb1('0x38')]);_0x15823d[_0x8cb1('0x3a')]=_[_0x8cb1('0x3b')](_0x15823d[_0x8cb1('0x37')],_0x15823d['query']);_0x136450[_0x8cb1('0x3c')]=_[_0x8cb1('0x3b')](_0x15823d[_0x8cb1('0x37')],qs[_0x8cb1('0x3d')](_0x1ca4b8['query'][_0x8cb1('0x3d')]));_0x136450[_0x8cb1('0x3c')]=_0x136450[_0x8cb1('0x3c')]['length']?_0x136450[_0x8cb1('0x3c')]:_0x15823d[_0x8cb1('0x37')];if(!_0x1ca4b8['query'][_0x8cb1('0x3e')]('nolimit')){_0x136450[_0x8cb1('0x1f')]=qs[_0x8cb1('0x1f')](_0x1ca4b8['query'][_0x8cb1('0x1f')]);_0x136450['offset']=qs[_0x8cb1('0x1e')](_0x1ca4b8['query']['offset']);}_0x136450[_0x8cb1('0x3f')]=qs[_0x8cb1('0x40')](_0x1ca4b8['query'][_0x8cb1('0x40')]);_0x136450[_0x8cb1('0x41')]=qs[_0x8cb1('0x3a')](_['pick'](_0x1ca4b8['query'],_0x15823d['filters']),_0x339e4c);var _0x43c9ce=[];var _0x5f3627=squel[_0x8cb1('0x42')]()[_0x8cb1('0x43')]('id')[_0x8cb1('0x43')](_0x8cb1('0x29'))[_0x8cb1('0x43')](_0x8cb1('0x44'))['from'](_0x8cb1('0x45'));var _0xf3c7dc=squel[_0x8cb1('0x42')]()['field'](_0x8cb1('0x46'))[_0x8cb1('0x43')](_0x8cb1('0x47'))[_0x8cb1('0x43')](_0x8cb1('0x48'))[_0x8cb1('0x49')](_0x8cb1('0x4a'),'ui')['left_join'](_0x8cb1('0x4b'),'u',_0x8cb1('0x4c'));var _0x5eab87=squel[_0x8cb1('0x42')]()[_0x8cb1('0x49')](_0x8cb1('0x4d'),'i')[_0x8cb1('0x4e')]('cm_contacts','c',_0x8cb1('0x4f'))['left_join'](_0x8cb1('0x4b'),'o',_0x8cb1('0x50'))[_0x8cb1('0x4e')](_0x8cb1('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x8cb1('0x4e')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x8cb1('0x4e')](_0x8cb1('0x52'),'it',_0x8cb1('0x53'))[_0x8cb1('0x4e')](_0x8cb1('0x45'),'t',_0x8cb1('0x54'));var _0x1b680a=squel[_0x8cb1('0x55')]();var _0x129a2b=[];var _0x59a4f2=squel[_0x8cb1('0x55')]();var _0x4db780;if(_0x1ca4b8[_0x8cb1('0x38')]['search']){_0x4db780=as[_0x8cb1('0x56')](_0x1ca4b8[_0x8cb1('0x38')]['search']);var _0x574183=_0x4db780[_0x8cb1('0x57')];for(var _0x596f35=0x0;_0x596f35<_0x4db780[_0x8cb1('0x58')][_0x8cb1('0x59')];_0x596f35++){var _0x47244c=_0x4db780[_0x8cb1('0x58')][_0x596f35];var _0x5819c9='i';var _0x3b2799=_[_0x8cb1('0x5a')](_0x339e4c,[_0x8cb1('0x29'),_0x47244c[_0x8cb1('0x43')]]);if(!_0x3b2799){switch(_0x47244c[_0x8cb1('0x43')]){case _0x8cb1('0x5b'):if(_0x47244c[_0x8cb1('0x5c')]==0x1){_0x5eab87['having']('`'+_0x47244c[_0x8cb1('0x43')]+'`\x20=\x200');}else{_0x5eab87[_0x8cb1('0x5d')]('`'+_0x47244c[_0x8cb1('0x43')]+'`\x20>\x200');}break;case _0x8cb1('0x5e'):if(_0x47244c[_0x8cb1('0x5f')]===_0x8cb1('0x60')){if(_0x47244c[_0x8cb1('0x5c')]['split']('\x20')[_0x8cb1('0x59')]>0x1){_0x1b680a[_0x574183](_0x8cb1('0x61'),qs[_0x8cb1('0x62')](_0x47244c[_0x8cb1('0x5c')]),null);}else{var _0x572194='%'+_0x47244c[_0x8cb1('0x5c')]+'%';_0x1b680a[_0x574183](_0x8cb1('0x63'),_0x572194,_0x572194,_0x572194);}}else{_0x3b2799=_[_0x8cb1('0x5a')](_0x339e4c,[_0x8cb1('0x29'),_0x8cb1('0x64')]);_0x47244c[_0x8cb1('0x43')]='ContactId';_0xcf0bee=as[_0x8cb1('0x65')](_0x5819c9,_0x3b2799[_0x8cb1('0x66')],_0x47244c);_0x1b680a[_0x574183](_0xcf0bee[_0x8cb1('0x67')],_0xcf0bee[_0x8cb1('0x5c')][_0x8cb1('0x68')],_0xcf0bee[_0x8cb1('0x5c')]['end']);}break;case'Tag':var _0x4f6b6e=_0x47244c[_0x8cb1('0x5c')]['split'](',')[_0x8cb1('0x2c')](function(_0x5a2e9c){return Number(_0x5a2e9c);});_0x4f6b6e[_0x8cb1('0x30')](function(_0xecaf54){_0x59a4f2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xecaf54+',%');});_0x129a2b=_[_0x8cb1('0x69')](_0x129a2b,_0x4f6b6e);break;case _0x8cb1('0x6a'):if(_0x47244c[_0x8cb1('0x5f')]==='$substring'){_0x1b680a[_0x574183](_0x8cb1('0x6b'),'%'+_0x47244c[_0x8cb1('0x5c')]+'%',null);}else{_0x3b2799=_['find'](_0x339e4c,[_0x8cb1('0x29'),_0x8cb1('0x6c')]);_0x47244c['field']='UserId';_0xcf0bee=as[_0x8cb1('0x65')](_0x5819c9,_0x3b2799['type'],_0x47244c);_0x1b680a[_0x574183](_0xcf0bee[_0x8cb1('0x67')],_0xcf0bee['value']['start'],_0xcf0bee[_0x8cb1('0x5c')][_0x8cb1('0x26')]);}break;case _0x8cb1('0x6d'):_0xcf0bee=as[_0x8cb1('0x65')]('me',null,_0x47244c);_0x1b680a[_0x574183](_0xcf0bee['text'],_0xcf0bee[_0x8cb1('0x5c')][_0x8cb1('0x68')],_0xcf0bee[_0x8cb1('0x5c')]['end']);break;}}else{var _0xcf0bee=as[_0x8cb1('0x65')](_0x5819c9,_0x3b2799[_0x8cb1('0x66')],_0x47244c);_0x1b680a[_0x574183](_0xcf0bee[_0x8cb1('0x67')],_0xcf0bee['value'][_0x8cb1('0x68')],_0xcf0bee[_0x8cb1('0x5c')][_0x8cb1('0x26')]);}}}else{var _0x45ada4=_(_0x1ca4b8['query'])[_0x8cb1('0x39')]()['map'](function(_0xcc3da3){return _[_0x8cb1('0x6e')](_0x339e4c,[_0x8cb1('0x29'),_0xcc3da3])?_0xcc3da3:undefined;})[_0x8cb1('0x6f')]()[_0x8cb1('0x5c')]();if(!_[_0x8cb1('0x70')](_0x45ada4)){_0x45ada4[_0x8cb1('0x30')](function(_0x24de98){if(_0x24de98===_0x8cb1('0x71')){_0x5eab87[_0x8cb1('0x41')](_0x8cb1('0x72'),[]['concat'](_0x1ca4b8['query'][_0x24de98]));}else if(_0x24de98===_0x8cb1('0x73')){var _0x1e3d49=JSON['parse'](_0x1ca4b8['query'][_0x24de98])[_0x8cb1('0x74')];var _0x1f96ce=JSON[_0x8cb1('0x75')](_0x1ca4b8[_0x8cb1('0x38')][_0x24de98])[_0x8cb1('0x76')];_0x5eab87[_0x8cb1('0x41')](_0x8cb1('0x77'),_0x1e3d49,_0x1f96ce);}else{if(_0x1ca4b8['query'][_0x24de98]===_0x8cb1('0x78')){_0x5eab87[_0x8cb1('0x41')]('i.'+_0x24de98+_0x8cb1('0x79'));}else{_0x5eab87[_0x8cb1('0x41')]('i.'+_0x24de98+_0x8cb1('0x7a'),_0x1ca4b8[_0x8cb1('0x38')][_0x24de98]);}}});}if(_0x1ca4b8[_0x8cb1('0x38')][_0x8cb1('0x7b')]){if(_0x1ca4b8['query'][_0x8cb1('0x7b')]==0x1){_0x5eab87['having'](_0x8cb1('0x7c'));}else{_0x5eab87[_0x8cb1('0x5d')](_0x8cb1('0x7d'));}}if(_0x1ca4b8[_0x8cb1('0x38')]['tag']){_0x129a2b=_['isArray'](_0x1ca4b8[_0x8cb1('0x38')]['tag'])?_0x1ca4b8[_0x8cb1('0x38')][_0x8cb1('0x7e')]:new Array(_0x1ca4b8[_0x8cb1('0x38')][_0x8cb1('0x7e')]);_0x129a2b[_0x8cb1('0x30')](function(_0x5cf784){_0x59a4f2['or'](_0x8cb1('0x7f'),'%,'+_0x5cf784+',%');});}if(_0x1ca4b8[_0x8cb1('0x38')][_0x8cb1('0x80')]){var _0x36b343=_0x1ca4b8['query'][_0x8cb1('0x80')][_0x8cb1('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x36b343)){_0x1b680a['or'](_0x8cb1('0x82'),_0x36b343+'%')['or'](_0x8cb1('0x83'),_0x36b343+'%');}else{_0x1b680a['or'](_0x8cb1('0x84'),qs[_0x8cb1('0x62')](_0x36b343))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x36b343+'%');}}}_0x5eab87[_0x8cb1('0x41')](_0x1b680a);_0x5eab87[_0x8cb1('0x85')]('i.id');var _0x5caac4={'type':db['Sequelize'][_0x8cb1('0x86')][_0x8cb1('0x87')],'raw':!![]};var _0x573066=_0x5eab87[_0x8cb1('0x88')]();_0x573066[_0x8cb1('0x43')](_0x8cb1('0x89'));_0x573066[_0x8cb1('0x43')](_0x8cb1('0x8a'),'unreadMessages');if(_0x136450[_0x8cb1('0x3f')]){_0x136450[_0x8cb1('0x3f')]['forEach'](function(_0x13063c){var _0x3c2aac=_0x13063c[0x0]===_0x8cb1('0x8b')?_0x13063c[0x0]:'i.'+_0x13063c[0x0];_0x5eab87[_0x8cb1('0x3f')](_0x3c2aac,_0x13063c[0x1]===_0x8cb1('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x129a2b)){_0x5eab87[_0x8cb1('0x5d')](_0x59a4f2);_0x573066[_0x8cb1('0x41')](_0x8cb1('0x8d'),_0x129a2b);}BPromise[_0x8cb1('0x8e')]()[_0x8cb1('0x24')](function(){if(!_0x4db780){if(_0x1ca4b8[_0x8cb1('0x38')][_0x8cb1('0x71')])return;_0x573066['where'](_0x8cb1('0x8f'));_0x5eab87[_0x8cb1('0x41')](_0x8cb1('0x8f'));return;}if(_0x1ca4b8[_0x8cb1('0x90')][_0x8cb1('0x91')]!==_0x8cb1('0x92'))return;return _0x1ca4b8['user'][_0x8cb1('0x93')]({'attributes':['id'],'raw':!![]})[_0x8cb1('0x24')](function(_0x3109a3){if(_[_0x8cb1('0x70')](_0x3109a3)){_0x573066[_0x8cb1('0x41')](_0x8cb1('0x94'));_0x5eab87[_0x8cb1('0x41')](_0x8cb1('0x94'));}else{_0x573066[_0x8cb1('0x41')](_0x8cb1('0x72'),_['map'](_0x3109a3,'id'));_0x5eab87[_0x8cb1('0x41')](_0x8cb1('0x72'),_['map'](_0x3109a3,'id'));}});})[_0x8cb1('0x24')](function(){if(_0x1ca4b8[_0x8cb1('0x90')][_0x8cb1('0x91')]===_0x8cb1('0x92')&&!_0x4db780&&!_0x1ca4b8['query'][_0x8cb1('0x71')])return[];return db[_0x8cb1('0x95')][_0x8cb1('0x38')](_0x573066[_0x8cb1('0x96')](),_0x5caac4);})[_0x8cb1('0x24')](function(_0x47f000){_0xbb61fa[_0x8cb1('0x97')]=_0x47f000['length'];if(_0xbb61fa[_0x8cb1('0x97')]===0x0)return[];return db[_0x8cb1('0x95')][_0x8cb1('0x38')](_0x5f3627[_0x8cb1('0x96')](),_0x5caac4)[_0x8cb1('0x24')](function(_0x3e7027){_0x43c9ce=_[_0x8cb1('0x98')](_0x3e7027,'id');_0x5caac4=_['merge'](_0x5caac4,{'model':db[_0x8cb1('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ca4b8[_0x8cb1('0x38')][_0x8cb1('0x3d')]){_0x136450[_0x8cb1('0x3c')][_0x8cb1('0x30')](function(_0x55f7fb){_0x5eab87[_0x8cb1('0x43')]('i.'+_0x55f7fb);});}else{_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0x8a'),_0x8cb1('0x5b'));_0x5eab87[_0x8cb1('0x43')]('a.key',_0x8cb1('0x99'));_0x5eab87[_0x8cb1('0x43')]('a.mandatoryDisposition',_0x8cb1('0x9a'));_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0x9b'),_0x8cb1('0x8b'));_0x5eab87[_0x8cb1('0x43')]('i.*');_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0x9c'),'Contact.firstName');_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0x9d'),_0x8cb1('0x9e'));_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0x9f'),_0x8cb1('0xa0'));_0x5eab87['field'](_0x8cb1('0xa1'),_0x8cb1('0xa2'));_0x5eab87[_0x8cb1('0x43')]('c.mobile',_0x8cb1('0xa3'));_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0xa4'),'Contact.fax');_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0xa5'),_0x8cb1('0xa6'));_0x5eab87[_0x8cb1('0x43')]('o.internal',_0x8cb1('0xa7'));_0x5eab87[_0x8cb1('0x43')](_0x8cb1('0xa8'),_0x8cb1('0x2f'));}if(_0x136450['limit'])_0x5eab87[_0x8cb1('0x1f')](_0x136450[_0x8cb1('0x1f')]);if(_0x136450[_0x8cb1('0x1e')])_0x5eab87[_0x8cb1('0x1e')](_0x136450[_0x8cb1('0x1e')]);return db[_0x8cb1('0x95')][_0x8cb1('0x38')](_0x5eab87[_0x8cb1('0x96')](),_0x5caac4);})[_0x8cb1('0x24')](function(_0x5370eb){_0xf3c7dc[_0x8cb1('0x41')](_0x8cb1('0xa9'),_[_0x8cb1('0x2c')](_0x5370eb,'id'));return db['sequelize'][_0x8cb1('0x38')](_0xf3c7dc[_0x8cb1('0x96')](),_0x5caac4)[_0x8cb1('0x24')](function(_0x44e193){var _0x115dfb=_[_0x8cb1('0xaa')](_0x44e193,_0x8cb1('0xab'));var _0x684c17=[];_0x5370eb['forEach'](function(_0x14f644){_0x684c17[_0x8cb1('0x31')](updateWhatsappInteraction(_0x14f644,_0x43c9ce,_0x115dfb));});return BPromise[_0x8cb1('0xac')](_0x684c17);});});})['then'](function(_0x1cfc10){_0xbb61fa[_0x8cb1('0xad')]=_0x1cfc10;return _0xbb61fa;})[_0x8cb1('0x24')](respondWithFilteredResult(_0x2fb688,_0x136450))[_0x8cb1('0xae')](handleError(_0x2fb688,null));};exports['show']=function(_0x215481,_0x4c0d5b){var _0x1ffe24={'raw':![],'where':{'id':_0x215481[_0x8cb1('0xaf')]['id']}},_0x1737b3={};_0x1737b3[_0x8cb1('0x37')]=_[_0x8cb1('0x39')](db['WhatsappInteraction'][_0x8cb1('0x34')]);_0x1737b3[_0x8cb1('0x38')]=_[_0x8cb1('0x39')](_0x215481[_0x8cb1('0x38')]);_0x1737b3['filters']=_['intersection'](_0x1737b3[_0x8cb1('0x37')],_0x1737b3[_0x8cb1('0x38')]);_0x1ffe24['attributes']=_[_0x8cb1('0x3b')](_0x1737b3[_0x8cb1('0x37')],qs[_0x8cb1('0x3d')](_0x215481['query'][_0x8cb1('0x3d')]));_0x1ffe24[_0x8cb1('0x3c')]=_0x1ffe24[_0x8cb1('0x3c')][_0x8cb1('0x59')]?_0x1ffe24[_0x8cb1('0x3c')]:_0x1737b3[_0x8cb1('0x37')];if(_0x215481[_0x8cb1('0x38')][_0x8cb1('0xb0')]){_0x1ffe24[_0x8cb1('0xb1')]=[{'all':!![]}];}_0x1ffe24=_[_0x8cb1('0xb2')]({},_0x1ffe24,_0x215481[_0x8cb1('0xb3')]);return db[_0x8cb1('0x33')][_0x8cb1('0x5a')](_0x1ffe24)[_0x8cb1('0x24')](handleEntityNotFound(_0x4c0d5b,null))['then'](respondWithResult(_0x4c0d5b,null))[_0x8cb1('0xae')](handleError(_0x4c0d5b,null));};exports[_0x8cb1('0xb4')]=function(_0x47a84d,_0x29a9b1){return db[_0x8cb1('0x33')][_0x8cb1('0xb4')](_0x47a84d['body'],{})[_0x8cb1('0x24')](respondWithResult(_0x29a9b1,0xc9))[_0x8cb1('0xae')](handleError(_0x29a9b1,null));};exports[_0x8cb1('0xb5')]=function(_0x19f2b9,_0x14b1fd){if(_0x19f2b9[_0x8cb1('0x6d')]['id']){delete _0x19f2b9[_0x8cb1('0x6d')]['id'];}return db['WhatsappInteraction'][_0x8cb1('0x5a')]({'where':{'id':_0x19f2b9[_0x8cb1('0xaf')]['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x14b1fd,null))['then'](saveUpdates(_0x19f2b9[_0x8cb1('0x6d')],null))[_0x8cb1('0x24')](respondWithResult(_0x14b1fd,null))[_0x8cb1('0xae')](handleError(_0x14b1fd,null));};exports[_0x8cb1('0x25')]=function(_0x17a8d0,_0x44d816){return db[_0x8cb1('0x33')][_0x8cb1('0x5a')]({'where':{'id':_0x17a8d0[_0x8cb1('0xaf')]['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x44d816,null))[_0x8cb1('0x24')](removeEntity(_0x44d816,null))[_0x8cb1('0xae')](handleError(_0x44d816,null));};exports[_0x8cb1('0xb6')]=function(_0x6abd3e,_0x4dda80){return db['WhatsappInteraction'][_0x8cb1('0xb6')]()[_0x8cb1('0x24')](respondWithResult(_0x4dda80,null))['catch'](handleError(_0x4dda80,null));};exports[_0x8cb1('0xb7')]=function(_0x14b61f,_0x2a4c26,_0x5bb9bb){return db[_0x8cb1('0xb8')]['find']({'where':{'id':_0x14b61f[_0x8cb1('0xaf')]['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x2a4c26,null))['then'](function(_0x44913b){if(_0x44913b){return _0x44913b[_0x8cb1('0xb7')](_0x14b61f['body'][_0x8cb1('0xb9')],_['omit'](_0x14b61f[_0x8cb1('0x6d')],[_0x8cb1('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x2a4c26,null))[_0x8cb1('0xae')](handleError(_0x2a4c26,null));};exports[_0x8cb1('0xba')]=function(_0x5e003c,_0x56ad8e,_0xbb2d62){var _0x58a109={'raw':![],'where':{}};var _0x56542f={};var _0x263aa0={'count':0x0,'rows':[]};return db[_0x8cb1('0x33')]['findOne']({'where':{'id':_0x5e003c['params']['id']}})['then'](handleEntityNotFound(_0x56ad8e,null))['then'](function(_0x386e37){if(_0x386e37){_0x56542f[_0x8cb1('0x37')]=_[_0x8cb1('0x39')](db[_0x8cb1('0xb8')][_0x8cb1('0x34')]);_0x56542f[_0x8cb1('0x38')]=_[_0x8cb1('0x39')](_0x5e003c['query']);_0x56542f[_0x8cb1('0x3a')]=_[_0x8cb1('0x3b')](_0x56542f[_0x8cb1('0x37')],_0x56542f['query']);_0x58a109[_0x8cb1('0x3c')]=_[_0x8cb1('0x3b')](_0x56542f[_0x8cb1('0x37')],qs[_0x8cb1('0x3d')](_0x5e003c['query'][_0x8cb1('0x3d')]));_0x58a109[_0x8cb1('0x3c')]=_0x58a109[_0x8cb1('0x3c')][_0x8cb1('0x59')]?_0x58a109[_0x8cb1('0x3c')]:_0x56542f[_0x8cb1('0x37')];if(!_0x5e003c[_0x8cb1('0x38')][_0x8cb1('0x3e')](_0x8cb1('0xbb'))){_0x58a109['limit']=qs['limit'](_0x5e003c[_0x8cb1('0x38')]['limit']);_0x58a109[_0x8cb1('0x1e')]=qs[_0x8cb1('0x1e')](_0x5e003c[_0x8cb1('0x38')]['offset']);}_0x58a109[_0x8cb1('0x3f')]=qs[_0x8cb1('0x40')](_0x5e003c['query']['sort']);_0x58a109['where']=qs['filters'](_[_0x8cb1('0xbc')](_0x5e003c[_0x8cb1('0x38')],_0x56542f['filters']));_0x58a109['where'][_0x8cb1('0xab')]=_0x386e37['id'];if(_0x5e003c['query']['filter']){_0x58a109[_0x8cb1('0x41')]=_[_0x8cb1('0xb2')](_0x58a109[_0x8cb1('0x41')],{'$or':_['map'](_0x58a109[_0x8cb1('0x3c')],function(_0x52a744){var _0xccabe2={};_0xccabe2[_0x52a744]={'$like':'%'+_0x5e003c[_0x8cb1('0x38')][_0x8cb1('0x80')]+'%'};return _0xccabe2;})});}if(_0x5e003c[_0x8cb1('0x38')][_0x8cb1('0x74')]){var _0xe258a1=_0x5e003c['query'][_0x8cb1('0x74')]['split'](',');var _0x2bec50={};_0x2bec50[_0xe258a1[0x0]]={'$gte':moment(_0xe258a1[0x1])[_0x8cb1('0xbd')](_0x8cb1('0xbe'))};_0x58a109[_0x8cb1('0x41')]=_[_0x8cb1('0xb2')](_0x58a109[_0x8cb1('0x41')],_0x2bec50);}_0x58a109=_[_0x8cb1('0xb2')]({},_0x58a109,_0x5e003c[_0x8cb1('0xb3')]);return db[_0x8cb1('0xb8')][_0x8cb1('0x97')]({'where':_0x58a109['where']})[_0x8cb1('0x24')](function(_0xbc9763){_0x263aa0[_0x8cb1('0x97')]=_0xbc9763;if(_0x5e003c[_0x8cb1('0x38')]['includeAll']){_0x58a109[_0x8cb1('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8cb1('0xbf')](_0x58a109);})['then'](function(_0x5c35c7){_0x263aa0[_0x8cb1('0xad')]=_0x5c35c7;return _0x263aa0;});}})[_0x8cb1('0x24')](respondWithFilteredResult(_0x56ad8e,_0x58a109))[_0x8cb1('0xae')](handleError(_0x56ad8e,null));};exports[_0x8cb1('0xc0')]=function(_0x13509c,_0x2820d0,_0x9952e){return db[_0x8cb1('0x33')][_0x8cb1('0x5a')]({'where':{'id':_0x13509c[_0x8cb1('0xaf')]['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x2820d0,null))[_0x8cb1('0x24')](function(_0x4654be){if(_0x4654be){return _0x4654be[_0x8cb1('0xc1')](_0x13509c[_0x8cb1('0x6d')][_0x8cb1('0xb9')],_['omit'](_0x13509c[_0x8cb1('0x6d')],[_0x8cb1('0xb9'),'id'])||{})['spread'](function(){return db[_0x8cb1('0xc2')]['findAll']({'attributes':['id',_0x8cb1('0x29'),'color'],'where':{'id':_0x13509c[_0x8cb1('0x6d')]['ids']}});})[_0x8cb1('0x24')](function(_0x4507e0){socket[_0x8cb1('0xc3')](_0x8cb1('0xc4'),{'id':Number(_0x13509c[_0x8cb1('0xaf')]['id']),'tags':_0x4507e0||[]});return{'id':Number(_0x13509c[_0x8cb1('0xaf')]['id']),'tags':_0x4507e0||[]};});}})['then'](respondWithResult(_0x2820d0,null))[_0x8cb1('0xae')](handleError(_0x2820d0,null));};exports[_0x8cb1('0xc5')]=function(_0x515cb3,_0x5c9e69,_0x58944c){return db[_0x8cb1('0x33')][_0x8cb1('0x5a')]({'where':{'id':_0x515cb3['params']['id']}})[_0x8cb1('0x24')](handleEntityNotFound(_0x5c9e69,null))[_0x8cb1('0x24')](function(_0x7c6586){if(_0x7c6586){return _0x7c6586[_0x8cb1('0xc5')](_0x515cb3[_0x8cb1('0x38')][_0x8cb1('0xb9')]);}})[_0x8cb1('0x24')](respondWithStatusCode(_0x5c9e69,null))[_0x8cb1('0xae')](handleError(_0x5c9e69,null));};exports[_0x8cb1('0xc6')]=function(_0x44583b,_0x2d02f4){var _0x3c8d76=moment()[_0x8cb1('0xc7')]()[_0x8cb1('0x96')]();var _0xb6a518=path[_0x8cb1('0xc8')](config[_0x8cb1('0xc9')],'server','files',_0x8cb1('0xca'));var _0x53e42b=path['join'](config[_0x8cb1('0xc9')],'server',_0x8cb1('0xcb'),'attachments');var _0x1653f3=path[_0x8cb1('0xc8')](_0xb6a518,_0x3c8d76);var _0x161f3b=util[_0x8cb1('0xbd')]('transcript-%d-%s.zip',_0x44583b[_0x8cb1('0xaf')]['id'],_0x3c8d76);var _0x3d149c=path[_0x8cb1('0xc8')](_0xb6a518,_0x161f3b);var _0x5601c0=[];_0x5601c0[_0x8cb1('0x31')]({'model':db[_0x8cb1('0x6a')],'as':_0x8cb1('0x6a'),'attributes':['id','fullname'],'raw':!![]});_0x5601c0['push']({'model':db[_0x8cb1('0xcc')],'as':_0x8cb1('0x5e'),'attributes':['id','firstName',_0x8cb1('0xcd')],'raw':!![]});if(_0x44583b['query']['attachments']){_0x5601c0['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0xa9415b=[{'model':db[_0x8cb1('0xb8')],'as':'Messages','attributes':['id',_0x8cb1('0x6d'),_0x8cb1('0x73'),_0x8cb1('0xce'),'secret',_0x8cb1('0x7b')],'include':_0x5601c0}];_0xa9415b[_0x8cb1('0x31')]({'model':db['WhatsappAccount'],'as':_0x8cb1('0xcf'),'attributes':['id',_0x8cb1('0x29')]});_0xa9415b[_0x8cb1('0x31')]({'model':db[_0x8cb1('0x6a')],'as':_0x8cb1('0xd0'),'attributes':['id',_0x8cb1('0x2d')]});return db[_0x8cb1('0x33')]['find']({'where':{'id':_0x44583b[_0x8cb1('0xaf')]['id']},'include':_0xa9415b})[_0x8cb1('0x24')](handleEntityNotFound(_0x2d02f4,null))[_0x8cb1('0x24')](function(_0x1f0567){if(_0x1f0567){var _0x141cfe=_0x1f0567[_0x8cb1('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x1653f3);var _0x10e7c7={'format':'A4','border':'10px','header':{'height':_0x8cb1('0xd2'),'contents':{'first':_0x8cb1('0xd3')}},'footer':{'height':_0x8cb1('0xd4'),'contents':{'default':util[_0x8cb1('0xbd')](_0x8cb1('0xd5'),util[_0x8cb1('0xbd')](_0x8cb1('0xd6'),_0x8cb1('0xd7'),_0x141cfe['id']),moment()['format'](_0x8cb1('0xd8'))[_0x8cb1('0x96')]())}}};var _0x2bfe94={'channel':'Whatsapp','account':_0x141cfe['Account'][_0x8cb1('0x29')],'agent':_0x141cfe[_0x8cb1('0xd0')]?_0x141cfe[_0x8cb1('0xd0')][_0x8cb1('0x2d')]:_0x8cb1('0xd9'),'createdAt':moment(_0x141cfe[_0x8cb1('0x73')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x141cfe[_0x8cb1('0xda')]?moment(_0x141cfe['closedAt'])[_0x8cb1('0xbd')](_0x8cb1('0xbe'))['toString']():'','disposition':_0x141cfe['disposition'],'messages':_(_0x141cfe[_0x8cb1('0xdb')])[_0x8cb1('0x80')]({'secret':![]})[_0x8cb1('0x2c')](function(_0x3e16c9){if(_0x3e16c9[_0x8cb1('0xdc')]){var _0x39ae25=path['join'](_0x53e42b,_0x3e16c9[_0x8cb1('0xdc')][_0x8cb1('0xdd')]);if(fs['existsSync'](_0x39ae25)){fs[_0x8cb1('0xde')](_0x39ae25)[_0x8cb1('0xdf')](fs[_0x8cb1('0xe0')](path[_0x8cb1('0xc8')](_0x1653f3,_0x3e16c9['Attachment'][_0x8cb1('0xdd')])));}}return{'date':moment(_0x3e16c9[_0x8cb1('0x73')])[_0x8cb1('0xbd')](_0x8cb1('0xbe'))[_0x8cb1('0x96')](),'sender':_0x3e16c9[_0x8cb1('0xce')]===_0x8cb1('0xe1')?_0x3e16c9[_0x8cb1('0x6a')]?_0x3e16c9[_0x8cb1('0x6a')][_0x8cb1('0x2d')]:'System':_0x3e16c9[_0x8cb1('0x5e')][_0x8cb1('0xe2')]+(_0x3e16c9['Contact'][_0x8cb1('0xcd')]?'\x20'+_0x3e16c9['Contact'][_0x8cb1('0xcd')]:''),'body':_0x3e16c9['Attachment']?_0x3e16c9[_0x8cb1('0xdc')][_0x8cb1('0xdd')]:_0x3e16c9['body'],'direction':_0x3e16c9['direction']===_0x8cb1('0xe1')?'A':'C','secret':_0x3e16c9['secret'],'read':_0x3e16c9[_0x8cb1('0x7b')],'attachment':_0x3e16c9[_0x8cb1('0xdc')]};})['value']()};return ejs[_0x8cb1('0xe3')](path[_0x8cb1('0xc8')](config['root'],_0x8cb1('0xe4'),_0x8cb1('0xe5'),_0x8cb1('0xe6')),{'interaction':_0x2bfe94})[_0x8cb1('0x24')](function(_0x4bb58a){return new BPromise(function(_0x1120e1,_0x791507){pdf[_0x8cb1('0xb4')](_0x4bb58a,_0x10e7c7)[_0x8cb1('0xe7')](path[_0x8cb1('0xc8')](_0x1653f3,_0x8cb1('0xe8')+_0x141cfe['id']+'-'+_0x3c8d76+'.pdf'),function(_0x10bd14,_0x548b19){if(_0x10bd14)return _0x791507(_0x10bd14);_0x1120e1(_0x548b19);});});})[_0x8cb1('0x24')](function(){return new BPromise(function(_0x4705d9,_0x175eda){zipdir(_0x1653f3,{'saveTo':_0x3d149c},function(_0x40e408,_0x20e256){if(_0x40e408)return _0x175eda(_0x40e408);return _0x4705d9(_0x20e256);});})[_0x8cb1('0x24')](function(){return new BPromise(function(_0x214200,_0x55fc49){rimraf(_0x1653f3,function(_0x4dd1bc){if(_0x4dd1bc)_0x55fc49(_0x4dd1bc);return _0x214200();});});})[_0x8cb1('0x24')](function(){return _0x2d02f4[_0x8cb1('0xc6')](_0x3d149c,_0x161f3b,function(_0x44b932){if(_0x44b932){console[_0x8cb1('0xe9')](_0x8cb1('0xea'),_0x44b932);}else{fs[_0x8cb1('0xeb')](_0x3d149c);}});});});}else{return _0x2d02f4[_0x8cb1('0x1b')](0xc8);}})[_0x8cb1('0xae')](handleError(_0x2d02f4,null));}; \ No newline at end of file +var _0xf403=['transcript-','.pdf','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','destroy','error','name','map','fullname','Tags','TagIds','split','forEach','push','then','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','includeAll','include','options','find','create','body','params','describe','addMessage','ids','omit','findOne','WhatsappMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','Tag','emit','removeTags','unix','join','root','files','server','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','closed','closedAt','basename','existsSync','createWriteStream','out','System','renderFile','views','toFile'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0xf403,0x1d3));var _0x3f40=function(_0x19607c,_0x42a583){_0x19607c=_0x19607c-0x0;var _0x3fab52=_0xf403[_0x19607c];return _0x3fab52;};'use strict';var pdf=require(_0x3f40('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f40('0x1'));var zipdir=require(_0x3f40('0x2'));var jsonpatch=require(_0x3f40('0x3'));var rp=require(_0x3f40('0x4'));var moment=require(_0x3f40('0x5'));var BPromise=require(_0x3f40('0x6'));var Mustache=require(_0x3f40('0x7'));var util=require(_0x3f40('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3f40('0x9'));var ejs=require(_0x3f40('0xa'));var fs=require('fs');var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require('../../mysqldb')['db'];config[_0x3f40('0x17')]=_['defaults'](config[_0x3f40('0x17')],{'host':_0x3f40('0x18'),'port':0x18eb});var socket=require(_0x3f40('0x19'))(new Redis(config[_0x3f40('0x17')]));require('./whatsappInteraction.socket')[_0x3f40('0x1a')](socket);function respondWithStatusCode(_0x308e97,_0xa25e56){_0xa25e56=_0xa25e56||0xcc;return function(_0x1c9144){if(_0x1c9144){return _0x308e97[_0x3f40('0x1b')](_0xa25e56);}return _0x308e97['status'](_0xa25e56)[_0x3f40('0x1c')]();};}function respondWithResult(_0x3d11c9,_0x535f85){_0x535f85=_0x535f85||0xc8;return function(_0x4ef80e){if(_0x4ef80e){return _0x3d11c9['status'](_0x535f85)[_0x3f40('0x1d')](_0x4ef80e);}};}function respondWithFilteredResult(_0x13b950,_0x59718c){return function(_0x131e55){if(_0x131e55){var _0x374644=_0x131e55[_0x3f40('0x1e')],_0x5b4ebc=_0x59718c[_0x3f40('0x1f')],_0x2639ef=_0x59718c[_0x3f40('0x1f')]+_0x59718c['limit'],_0xaab367;if(_0x2639ef>=_0x374644){_0x2639ef=_0x374644;_0xaab367=0xc8;}else{_0xaab367=0xce;}_0x13b950[_0x3f40('0x20')](_0xaab367);return _0x13b950['set'](_0x3f40('0x21'),_0x5b4ebc+'-'+_0x2639ef+'/'+_0x374644)[_0x3f40('0x1d')](_0x131e55);}return null;};}function patchUpdates(_0x3f4a93){return function(_0x113293){try{jsonpatch[_0x3f40('0x22')](_0x113293,_0x3f4a93,!![]);}catch(_0x4aa559){return BPromise[_0x3f40('0x23')](_0x4aa559);}return _0x113293[_0x3f40('0x24')]();};}function saveUpdates(_0x117823,_0x3a230a){return function(_0x258de9){if(_0x258de9){return _0x258de9[_0x3f40('0x25')](_0x117823)['then'](function(_0x31fc91){return _0x31fc91;});}return null;};}function removeEntity(_0x59eb32,_0x5d9e35){return function(_0x4fed43){if(_0x4fed43){return _0x4fed43[_0x3f40('0x26')]()['then'](function(){_0x59eb32[_0x3f40('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b206b,_0x4b0ade){return function(_0x30a945){if(!_0x30a945){_0x4b206b[_0x3f40('0x1b')](0x194);}return _0x30a945;};}function handleError(_0x140044,_0x257833){_0x257833=_0x257833||0x1f4;return function(_0x5b1079){logger[_0x3f40('0x27')](_0x5b1079['stack']);if(_0x5b1079[_0x3f40('0x28')]){delete _0x5b1079[_0x3f40('0x28')];}_0x140044[_0x3f40('0x20')](_0x257833)['send'](_0x5b1079);};}function getInteractionUsers(_0x287632,_0x4b5ef7){return new BPromise(function(_0x1cab5c,_0x5b9079){try{if(_0x4b5ef7[_0x287632['id']]){_0x287632['Users']=_[_0x3f40('0x29')](_0x4b5ef7[_0x287632['id']],function(_0x19fb8e){return{'id':_0x19fb8e['id'],'fullname':_0x19fb8e[_0x3f40('0x2a')]};});}}catch(_0xb23186){_0x5b9079(_0xb23186);}_0x1cab5c(_0x287632);});}function getInteractionTags(_0x357396,_0x1056d0){return new BPromise(function(_0x40cd76,_0xe70e64){try{if(_0x357396['TagIds']){_0x357396[_0x3f40('0x2b')]=[];_0x357396[_0x3f40('0x2c')][_0x3f40('0x2d')](',')[_0x3f40('0x2e')](function(_0x3b20f4){_0x357396['Tags'][_0x3f40('0x2f')](_0x1056d0[_0x3b20f4]);});}delete _0x357396[_0x3f40('0x2c')];}catch(_0x434e6d){_0xe70e64(_0x434e6d);}_0x40cd76(_0x357396);});}function updateWhatsappInteraction(_0x575bd8,_0x21c8eb,_0x2869d0){return new BPromise(function(_0x239fd5,_0x27f13d){return getInteractionUsers(_0x575bd8,_0x2869d0)[_0x3f40('0x30')](function(_0x323908){return getInteractionTags(_0x323908,_0x21c8eb);})[_0x3f40('0x30')](function(_0x1b5f3f){_0x239fd5(_0x1b5f3f);})[_0x3f40('0x31')](function(_0x1eed90){_0x27f13d(_0x1eed90);});});}exports[_0x3f40('0x32')]=function(_0x25399a,_0x424168){var _0x13f7bc={},_0x22a8bc={},_0xf26a2f={'count':0x0,'rows':[]};var _0x81e4ad=_[_0x3f40('0x29')](db[_0x3f40('0x33')][_0x3f40('0x34')],function(_0x234420){return{'name':_0x234420[_0x3f40('0x35')],'type':_0x234420[_0x3f40('0x36')][_0x3f40('0x37')]};});_0x22a8bc[_0x3f40('0x38')]=_[_0x3f40('0x29')](_0x81e4ad,_0x3f40('0x28'));_0x22a8bc[_0x3f40('0x39')]=_[_0x3f40('0x3a')](_0x25399a[_0x3f40('0x39')]);_0x22a8bc['filters']=_['intersection'](_0x22a8bc[_0x3f40('0x38')],_0x22a8bc[_0x3f40('0x39')]);_0x13f7bc[_0x3f40('0x3b')]=_[_0x3f40('0x3c')](_0x22a8bc[_0x3f40('0x38')],qs[_0x3f40('0x3d')](_0x25399a[_0x3f40('0x39')]['fields']));_0x13f7bc[_0x3f40('0x3b')]=_0x13f7bc['attributes'][_0x3f40('0x3e')]?_0x13f7bc[_0x3f40('0x3b')]:_0x22a8bc[_0x3f40('0x38')];if(!_0x25399a['query'][_0x3f40('0x3f')](_0x3f40('0x40'))){_0x13f7bc['limit']=qs[_0x3f40('0x41')](_0x25399a[_0x3f40('0x39')]['limit']);_0x13f7bc[_0x3f40('0x1f')]=qs['offset'](_0x25399a[_0x3f40('0x39')]['offset']);}_0x13f7bc['order']=qs[_0x3f40('0x42')](_0x25399a['query'][_0x3f40('0x42')]);_0x13f7bc[_0x3f40('0x43')]=qs[_0x3f40('0x44')](_[_0x3f40('0x45')](_0x25399a['query'],_0x22a8bc[_0x3f40('0x44')]),_0x81e4ad);var _0x5b0eaa=[];var _0x4597fb=squel[_0x3f40('0x46')]()[_0x3f40('0x47')]('id')['field']('name')[_0x3f40('0x47')](_0x3f40('0x48'))[_0x3f40('0x49')](_0x3f40('0x4a'));var _0x1ae82d=squel[_0x3f40('0x46')]()[_0x3f40('0x47')](_0x3f40('0x4b'))['field'](_0x3f40('0x4c'))['field']('ui.WhatsappInteractionId')[_0x3f40('0x49')](_0x3f40('0x4d'),'ui')[_0x3f40('0x4e')](_0x3f40('0x4f'),'u',_0x3f40('0x50'));var _0xa75b96=squel[_0x3f40('0x46')]()[_0x3f40('0x49')](_0x3f40('0x51'),'i')[_0x3f40('0x4e')](_0x3f40('0x52'),'c',_0x3f40('0x53'))[_0x3f40('0x4e')](_0x3f40('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x3f40('0x4e')]('whatsapp_accounts','a',_0x3f40('0x54'))[_0x3f40('0x4e')]('whatsapp_messages','me',_0x3f40('0x55'))[_0x3f40('0x4e')](_0x3f40('0x56'),'it',_0x3f40('0x57'))[_0x3f40('0x4e')](_0x3f40('0x4a'),'t',_0x3f40('0x58'));var _0x2a141e=squel[_0x3f40('0x59')]();var _0x1a9967=[];var _0x3a7b82=squel[_0x3f40('0x59')]();var _0x1cfe4f;if(_0x25399a[_0x3f40('0x39')][_0x3f40('0x5a')]){_0x1cfe4f=as[_0x3f40('0x5b')](_0x25399a[_0x3f40('0x39')][_0x3f40('0x5a')]);var _0x32bd05=_0x1cfe4f[_0x3f40('0x5c')];for(var _0xca7210=0x0;_0xca7210<_0x1cfe4f['conditions'][_0x3f40('0x3e')];_0xca7210++){var _0x50db96=_0x1cfe4f[_0x3f40('0x5d')][_0xca7210];var _0x11ee59='i';var _0x3bfb89=_['find'](_0x81e4ad,['name',_0x50db96['field']]);if(!_0x3bfb89){switch(_0x50db96[_0x3f40('0x47')]){case _0x3f40('0x5e'):if(_0x50db96['value']==0x1){_0xa75b96[_0x3f40('0x5f')]('`'+_0x50db96[_0x3f40('0x47')]+'`\x20=\x200');}else{_0xa75b96[_0x3f40('0x5f')]('`'+_0x50db96['field']+_0x3f40('0x60'));}break;case _0x3f40('0x61'):if(_0x50db96[_0x3f40('0x62')]===_0x3f40('0x63')){if(_0x50db96[_0x3f40('0x64')][_0x3f40('0x2d')]('\x20')[_0x3f40('0x3e')]>0x1){_0x2a141e[_0x32bd05](_0x3f40('0x65'),qs[_0x3f40('0x66')](_0x50db96[_0x3f40('0x64')]),null);}else{var _0x4138bd='%'+_0x50db96[_0x3f40('0x64')]+'%';_0x2a141e[_0x32bd05](_0x3f40('0x67'),_0x4138bd,_0x4138bd,_0x4138bd);}}else{_0x3bfb89=_['find'](_0x81e4ad,[_0x3f40('0x28'),_0x3f40('0x68')]);_0x50db96[_0x3f40('0x47')]=_0x3f40('0x68');_0x35b1d2=as[_0x3f40('0x69')](_0x11ee59,_0x3bfb89['type'],_0x50db96);_0x2a141e[_0x32bd05](_0x35b1d2[_0x3f40('0x6a')],_0x35b1d2[_0x3f40('0x64')][_0x3f40('0x6b')],_0x35b1d2[_0x3f40('0x64')][_0x3f40('0x1c')]);}break;case'Tag':var _0x5acce7=_0x50db96[_0x3f40('0x64')][_0x3f40('0x2d')](',')['map'](function(_0x701ed0){return Number(_0x701ed0);});_0x5acce7['forEach'](function(_0x204cff){_0x3a7b82['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x204cff+',%');});_0x1a9967=_[_0x3f40('0x6c')](_0x1a9967,_0x5acce7);break;case'User':if(_0x50db96[_0x3f40('0x62')]===_0x3f40('0x63')){_0x2a141e[_0x32bd05](_0x3f40('0x6d'),'%'+_0x50db96['value']+'%',null);}else{_0x3bfb89=_['find'](_0x81e4ad,['name','UserId']);_0x50db96[_0x3f40('0x47')]='UserId';_0x35b1d2=as['buildExpression'](_0x11ee59,_0x3bfb89[_0x3f40('0x36')],_0x50db96);_0x2a141e[_0x32bd05](_0x35b1d2[_0x3f40('0x6a')],_0x35b1d2[_0x3f40('0x64')][_0x3f40('0x6b')],_0x35b1d2['value'][_0x3f40('0x1c')]);}break;case'body':_0x35b1d2=as['buildExpression']('me',null,_0x50db96);_0x2a141e[_0x32bd05](_0x35b1d2['text'],_0x35b1d2[_0x3f40('0x64')]['start'],_0x35b1d2['value'][_0x3f40('0x1c')]);break;}}else{var _0x35b1d2=as[_0x3f40('0x69')](_0x11ee59,_0x3bfb89[_0x3f40('0x36')],_0x50db96);_0x2a141e[_0x32bd05](_0x35b1d2[_0x3f40('0x6a')],_0x35b1d2['value'][_0x3f40('0x6b')],_0x35b1d2['value'][_0x3f40('0x1c')]);}}}else{var _0x2b1619=_(_0x25399a[_0x3f40('0x39')])['keys']()[_0x3f40('0x29')](function(_0x2408f4){return _[_0x3f40('0x6e')](_0x81e4ad,[_0x3f40('0x28'),_0x2408f4])?_0x2408f4:undefined;})[_0x3f40('0x6f')]()['value']();if(!_[_0x3f40('0x70')](_0x2b1619)){_0x2b1619[_0x3f40('0x2e')](function(_0xf6b569){if(_0xf6b569===_0x3f40('0x71')){_0xa75b96[_0x3f40('0x43')](_0x3f40('0x72'),[][_0x3f40('0x73')](_0x25399a[_0x3f40('0x39')][_0xf6b569]));}else if(_0xf6b569===_0x3f40('0x74')){var _0x37add1=JSON[_0x3f40('0x75')](_0x25399a[_0x3f40('0x39')][_0xf6b569])['$gte'];var _0x5de7af=JSON['parse'](_0x25399a[_0x3f40('0x39')][_0xf6b569])[_0x3f40('0x76')];_0xa75b96[_0x3f40('0x43')](_0x3f40('0x77'),_0x37add1,_0x5de7af);}else{if(_0x25399a[_0x3f40('0x39')][_0xf6b569]===_0x3f40('0x78')){_0xa75b96['where']('i.'+_0xf6b569+_0x3f40('0x79'));}else{_0xa75b96['where']('i.'+_0xf6b569+_0x3f40('0x7a'),_0x25399a[_0x3f40('0x39')][_0xf6b569]);}}});}if(_0x25399a[_0x3f40('0x39')][_0x3f40('0x7b')]){if(_0x25399a[_0x3f40('0x39')]['read']==0x1){_0xa75b96[_0x3f40('0x5f')]('`unreadMessages`\x20=\x200');}else{_0xa75b96['having'](_0x3f40('0x7c'));}}if(_0x25399a['query'][_0x3f40('0x7d')]){_0x1a9967=_[_0x3f40('0x7e')](_0x25399a[_0x3f40('0x39')][_0x3f40('0x7d')])?_0x25399a[_0x3f40('0x39')][_0x3f40('0x7d')]:new Array(_0x25399a[_0x3f40('0x39')]['tag']);_0x1a9967[_0x3f40('0x2e')](function(_0x250e3a){_0x3a7b82['or'](_0x3f40('0x7f'),'%,'+_0x250e3a+',%');});}if(_0x25399a[_0x3f40('0x39')][_0x3f40('0x80')]){var _0x53fbcf=_0x25399a[_0x3f40('0x39')][_0x3f40('0x80')][_0x3f40('0x81')]('\x5c','\x5c\x5c')[_0x3f40('0x81')](/'/g,'\x27\x27');if(qs[_0x3f40('0x82')](_0x53fbcf)){_0x2a141e['or'](_0x3f40('0x83'),_0x53fbcf+'%')['or']('i.phone\x20LIKE\x20?',_0x53fbcf+'%');}else{_0x2a141e['or'](_0x3f40('0x84'),qs[_0x3f40('0x66')](_0x53fbcf))['or'](_0x3f40('0x85'),_0x53fbcf+'%');}}}_0xa75b96[_0x3f40('0x43')](_0x2a141e);_0xa75b96[_0x3f40('0x86')]('i.id');var _0x5adccf={'type':db['Sequelize'][_0x3f40('0x87')][_0x3f40('0x88')],'raw':!![]};var _0x212ca4=_0xa75b96[_0x3f40('0x89')]();_0x212ca4[_0x3f40('0x47')](_0x3f40('0x8a'));_0x212ca4[_0x3f40('0x47')](_0x3f40('0x8b'),_0x3f40('0x5e'));if(_0x13f7bc[_0x3f40('0x8c')]){_0x13f7bc[_0x3f40('0x8c')][_0x3f40('0x2e')](function(_0x14afa7){var _0x4f5a02=_0x14afa7[0x0]===_0x3f40('0x8d')?_0x14afa7[0x0]:'i.'+_0x14afa7[0x0];_0xa75b96[_0x3f40('0x8c')](_0x4f5a02,_0x14afa7[0x1]===_0x3f40('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x1a9967)){_0xa75b96['having'](_0x3a7b82);_0x212ca4[_0x3f40('0x43')](_0x3f40('0x8f'),_0x1a9967);}BPromise[_0x3f40('0x90')]()[_0x3f40('0x30')](function(){if(!_0x1cfe4f){if(_0x25399a['query'][_0x3f40('0x71')])return;_0x212ca4[_0x3f40('0x43')](_0x3f40('0x91'));_0xa75b96[_0x3f40('0x43')](_0x3f40('0x91'));return;}if(_0x25399a[_0x3f40('0x92')][_0x3f40('0x93')]!==_0x3f40('0x94'))return;return _0x25399a[_0x3f40('0x92')][_0x3f40('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x556904){if(_[_0x3f40('0x70')](_0x556904)){_0x212ca4[_0x3f40('0x43')](_0x3f40('0x96'));_0xa75b96[_0x3f40('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x212ca4[_0x3f40('0x43')](_0x3f40('0x72'),_[_0x3f40('0x29')](_0x556904,'id'));_0xa75b96[_0x3f40('0x43')](_0x3f40('0x72'),_['map'](_0x556904,'id'));}});})['then'](function(){if(_0x25399a[_0x3f40('0x92')][_0x3f40('0x93')]===_0x3f40('0x94')&&!_0x1cfe4f&&!_0x25399a['query'][_0x3f40('0x71')])return[];return db[_0x3f40('0x97')][_0x3f40('0x39')](_0x212ca4['toString'](),_0x5adccf);})['then'](function(_0xd842ca){_0xf26a2f[_0x3f40('0x1e')]=_0xd842ca[_0x3f40('0x3e')];if(_0xf26a2f[_0x3f40('0x1e')]===0x0)return[];return db[_0x3f40('0x97')][_0x3f40('0x39')](_0x4597fb[_0x3f40('0x98')](),_0x5adccf)['then'](function(_0xb4e27e){_0x5b0eaa=_['keyBy'](_0xb4e27e,'id');_0x5adccf=_[_0x3f40('0x99')](_0x5adccf,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25399a['query'][_0x3f40('0x3d')]){_0x13f7bc['attributes']['forEach'](function(_0x271f7f){_0xa75b96[_0x3f40('0x47')]('i.'+_0x271f7f);});}else{_0xa75b96[_0x3f40('0x47')](_0x3f40('0x8b'),_0x3f40('0x5e'));_0xa75b96[_0x3f40('0x47')](_0x3f40('0x9a'),'Account.key');_0xa75b96[_0x3f40('0x47')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xa75b96[_0x3f40('0x47')](_0x3f40('0x9b'),_0x3f40('0x8d'));_0xa75b96['field'](_0x3f40('0x9c'));_0xa75b96['field']('c.firstName','Contact.firstName');_0xa75b96['field']('c.lastName','Contact.lastName');_0xa75b96[_0x3f40('0x47')](_0x3f40('0x9d'),_0x3f40('0x9e'));_0xa75b96[_0x3f40('0x47')](_0x3f40('0x9f'),_0x3f40('0xa0'));_0xa75b96[_0x3f40('0x47')](_0x3f40('0xa1'),'Contact.mobile');_0xa75b96[_0x3f40('0x47')](_0x3f40('0xa2'),_0x3f40('0xa3'));_0xa75b96[_0x3f40('0x47')](_0x3f40('0xa4'),_0x3f40('0xa5'));_0xa75b96[_0x3f40('0x47')](_0x3f40('0xa6'),_0x3f40('0xa7'));_0xa75b96[_0x3f40('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3f40('0x2c'));}if(_0x13f7bc[_0x3f40('0x41')])_0xa75b96['limit'](_0x13f7bc['limit']);if(_0x13f7bc['offset'])_0xa75b96[_0x3f40('0x1f')](_0x13f7bc['offset']);return db[_0x3f40('0x97')][_0x3f40('0x39')](_0xa75b96['toString'](),_0x5adccf);})[_0x3f40('0x30')](function(_0x223db3){_0x1ae82d[_0x3f40('0x43')](_0x3f40('0xa8'),_[_0x3f40('0x29')](_0x223db3,'id'));return db[_0x3f40('0x97')][_0x3f40('0x39')](_0x1ae82d[_0x3f40('0x98')](),_0x5adccf)[_0x3f40('0x30')](function(_0x30020c){var _0x441028=_[_0x3f40('0xa9')](_0x30020c,_0x3f40('0xaa'));var _0x11e081=[];_0x223db3[_0x3f40('0x2e')](function(_0x54212d){_0x11e081[_0x3f40('0x2f')](updateWhatsappInteraction(_0x54212d,_0x5b0eaa,_0x441028));});return BPromise[_0x3f40('0xab')](_0x11e081);});});})[_0x3f40('0x30')](function(_0x1926d3){_0xf26a2f[_0x3f40('0xac')]=_0x1926d3;return _0xf26a2f;})[_0x3f40('0x30')](respondWithFilteredResult(_0x424168,_0x13f7bc))[_0x3f40('0x31')](handleError(_0x424168,null));};exports['show']=function(_0x22c349,_0x4b3c26){var _0x7d91c7={'raw':![],'where':{'id':_0x22c349['params']['id']}},_0x594cd0={};_0x594cd0[_0x3f40('0x38')]=_[_0x3f40('0x3a')](db['WhatsappInteraction'][_0x3f40('0x34')]);_0x594cd0['query']=_['keys'](_0x22c349[_0x3f40('0x39')]);_0x594cd0[_0x3f40('0x44')]=_[_0x3f40('0x3c')](_0x594cd0['model'],_0x594cd0['query']);_0x7d91c7[_0x3f40('0x3b')]=_[_0x3f40('0x3c')](_0x594cd0['model'],qs['fields'](_0x22c349[_0x3f40('0x39')][_0x3f40('0x3d')]));_0x7d91c7[_0x3f40('0x3b')]=_0x7d91c7[_0x3f40('0x3b')][_0x3f40('0x3e')]?_0x7d91c7[_0x3f40('0x3b')]:_0x594cd0[_0x3f40('0x38')];if(_0x22c349[_0x3f40('0x39')][_0x3f40('0xad')]){_0x7d91c7[_0x3f40('0xae')]=[{'all':!![]}];}_0x7d91c7=_['merge']({},_0x7d91c7,_0x22c349[_0x3f40('0xaf')]);return db[_0x3f40('0x33')][_0x3f40('0xb0')](_0x7d91c7)[_0x3f40('0x30')](handleEntityNotFound(_0x4b3c26,null))[_0x3f40('0x30')](respondWithResult(_0x4b3c26,null))[_0x3f40('0x31')](handleError(_0x4b3c26,null));};exports['create']=function(_0x1d9589,_0x5de0fc){return db[_0x3f40('0x33')][_0x3f40('0xb1')](_0x1d9589[_0x3f40('0xb2')],{})['then'](respondWithResult(_0x5de0fc,0xc9))[_0x3f40('0x31')](handleError(_0x5de0fc,null));};exports[_0x3f40('0x25')]=function(_0x45246d,_0x1372e0){if(_0x45246d[_0x3f40('0xb2')]['id']){delete _0x45246d[_0x3f40('0xb2')]['id'];}return db[_0x3f40('0x33')][_0x3f40('0xb0')]({'where':{'id':_0x45246d['params']['id']}})[_0x3f40('0x30')](handleEntityNotFound(_0x1372e0,null))[_0x3f40('0x30')](saveUpdates(_0x45246d[_0x3f40('0xb2')],null))[_0x3f40('0x30')](respondWithResult(_0x1372e0,null))[_0x3f40('0x31')](handleError(_0x1372e0,null));};exports['destroy']=function(_0x2f2c96,_0x183306){return db[_0x3f40('0x33')]['find']({'where':{'id':_0x2f2c96[_0x3f40('0xb3')]['id']}})['then'](handleEntityNotFound(_0x183306,null))['then'](removeEntity(_0x183306,null))['catch'](handleError(_0x183306,null));};exports[_0x3f40('0xb4')]=function(_0x5356a0,_0x2c48c6){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x2c48c6,null))[_0x3f40('0x31')](handleError(_0x2c48c6,null));};exports[_0x3f40('0xb5')]=function(_0x322a0a,_0x4b8291,_0x22ea5c){return db['WhatsappMessage']['find']({'where':{'id':_0x322a0a[_0x3f40('0xb3')]['id']}})[_0x3f40('0x30')](handleEntityNotFound(_0x4b8291,null))[_0x3f40('0x30')](function(_0x540287){if(_0x540287){return _0x540287['addMessage'](_0x322a0a[_0x3f40('0xb2')][_0x3f40('0xb6')],_[_0x3f40('0xb7')](_0x322a0a[_0x3f40('0xb2')],[_0x3f40('0xb6'),'id'])||{});}})[_0x3f40('0x30')](respondWithResult(_0x4b8291,null))[_0x3f40('0x31')](handleError(_0x4b8291,null));};exports['getMessages']=function(_0x2b132a,_0x3a191c,_0x8b8c0f){var _0x249f65={'raw':![],'where':{}};var _0x2ac0bc={};var _0x202458={'count':0x0,'rows':[]};return db[_0x3f40('0x33')][_0x3f40('0xb8')]({'where':{'id':_0x2b132a[_0x3f40('0xb3')]['id']}})[_0x3f40('0x30')](handleEntityNotFound(_0x3a191c,null))[_0x3f40('0x30')](function(_0x42442e){if(_0x42442e){_0x2ac0bc[_0x3f40('0x38')]=_['keys'](db[_0x3f40('0xb9')][_0x3f40('0x34')]);_0x2ac0bc[_0x3f40('0x39')]=_[_0x3f40('0x3a')](_0x2b132a[_0x3f40('0x39')]);_0x2ac0bc[_0x3f40('0x44')]=_[_0x3f40('0x3c')](_0x2ac0bc['model'],_0x2ac0bc[_0x3f40('0x39')]);_0x249f65[_0x3f40('0x3b')]=_[_0x3f40('0x3c')](_0x2ac0bc[_0x3f40('0x38')],qs[_0x3f40('0x3d')](_0x2b132a['query']['fields']));_0x249f65[_0x3f40('0x3b')]=_0x249f65['attributes'][_0x3f40('0x3e')]?_0x249f65[_0x3f40('0x3b')]:_0x2ac0bc[_0x3f40('0x38')];if(!_0x2b132a['query'][_0x3f40('0x3f')](_0x3f40('0x40'))){_0x249f65[_0x3f40('0x41')]=qs[_0x3f40('0x41')](_0x2b132a[_0x3f40('0x39')][_0x3f40('0x41')]);_0x249f65['offset']=qs[_0x3f40('0x1f')](_0x2b132a[_0x3f40('0x39')][_0x3f40('0x1f')]);}_0x249f65[_0x3f40('0x8c')]=qs[_0x3f40('0x42')](_0x2b132a[_0x3f40('0x39')][_0x3f40('0x42')]);_0x249f65[_0x3f40('0x43')]=qs[_0x3f40('0x44')](_[_0x3f40('0x45')](_0x2b132a[_0x3f40('0x39')],_0x2ac0bc[_0x3f40('0x44')]));_0x249f65['where'][_0x3f40('0xaa')]=_0x42442e['id'];if(_0x2b132a['query']['filter']){_0x249f65['where']=_[_0x3f40('0x99')](_0x249f65[_0x3f40('0x43')],{'$or':_['map'](_0x249f65[_0x3f40('0x3b')],function(_0x3e32c2){var _0x4f06dc={};_0x4f06dc[_0x3e32c2]={'$like':'%'+_0x2b132a[_0x3f40('0x39')][_0x3f40('0x80')]+'%'};return _0x4f06dc;})});}if(_0x2b132a['query']['$gte']){var _0x4b704a=_0x2b132a[_0x3f40('0x39')]['$gte']['split'](',');var _0x26e579={};_0x26e579[_0x4b704a[0x0]]={'$gte':moment(_0x4b704a[0x1])[_0x3f40('0xba')](_0x3f40('0xbb'))};_0x249f65[_0x3f40('0x43')]=_['merge'](_0x249f65[_0x3f40('0x43')],_0x26e579);}_0x249f65=_[_0x3f40('0x99')]({},_0x249f65,_0x2b132a[_0x3f40('0xaf')]);return db[_0x3f40('0xb9')]['count']({'where':_0x249f65['where']})['then'](function(_0x55d419){_0x202458[_0x3f40('0x1e')]=_0x55d419;if(_0x2b132a['query'][_0x3f40('0xad')]){_0x249f65[_0x3f40('0xae')]=[{'all':!![]}];}return db[_0x3f40('0xb9')][_0x3f40('0xbc')](_0x249f65);})[_0x3f40('0x30')](function(_0x280f03){_0x202458[_0x3f40('0xac')]=_0x280f03;return _0x202458;});}})[_0x3f40('0x30')](respondWithFilteredResult(_0x3a191c,_0x249f65))['catch'](handleError(_0x3a191c,null));};exports[_0x3f40('0xbd')]=function(_0x4d3384,_0xb59200,_0x5c313d){return db['WhatsappInteraction']['find']({'where':{'id':_0x4d3384[_0x3f40('0xb3')]['id']}})[_0x3f40('0x30')](handleEntityNotFound(_0xb59200,null))[_0x3f40('0x30')](function(_0x4e7ded){if(_0x4e7ded){return _0x4e7ded['setTags'](_0x4d3384[_0x3f40('0xb2')]['ids'],_['omit'](_0x4d3384[_0x3f40('0xb2')],[_0x3f40('0xb6'),'id'])||{})['spread'](function(){return db[_0x3f40('0xbe')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4d3384['body']['ids']}});})[_0x3f40('0x30')](function(_0x497dec){socket[_0x3f40('0xbf')]('whatsappInteractionTags:save',{'id':Number(_0x4d3384['params']['id']),'tags':_0x497dec||[]});return{'id':Number(_0x4d3384[_0x3f40('0xb3')]['id']),'tags':_0x497dec||[]};});}})[_0x3f40('0x30')](respondWithResult(_0xb59200,null))['catch'](handleError(_0xb59200,null));};exports['removeTags']=function(_0x14d34f,_0x5ce3c1,_0x3f73a7){return db[_0x3f40('0x33')]['find']({'where':{'id':_0x14d34f[_0x3f40('0xb3')]['id']}})[_0x3f40('0x30')](handleEntityNotFound(_0x5ce3c1,null))['then'](function(_0x21f445){if(_0x21f445){return _0x21f445[_0x3f40('0xc0')](_0x14d34f[_0x3f40('0x39')]['ids']);}})[_0x3f40('0x30')](respondWithStatusCode(_0x5ce3c1,null))[_0x3f40('0x31')](handleError(_0x5ce3c1,null));};exports['download']=function(_0x2e7950,_0x901767){var _0x25b757=moment()[_0x3f40('0xc1')]()[_0x3f40('0x98')]();var _0x444f4f=path[_0x3f40('0xc2')](config[_0x3f40('0xc3')],'server',_0x3f40('0xc4'),'tmp');var _0x500f31=path[_0x3f40('0xc2')](config['root'],_0x3f40('0xc5'),_0x3f40('0xc4'),_0x3f40('0xc6'));var _0x5b4fcc=path[_0x3f40('0xc2')](_0x444f4f,_0x25b757);var _0x434d13=util[_0x3f40('0xba')](_0x3f40('0xc7'),_0x2e7950[_0x3f40('0xb3')]['id'],_0x25b757);var _0x5253fc=path[_0x3f40('0xc2')](_0x444f4f,_0x434d13);var _0x1fb90e=[];_0x1fb90e[_0x3f40('0x2f')]({'model':db[_0x3f40('0xc8')],'as':'User','attributes':['id',_0x3f40('0x2a')],'raw':!![]});_0x1fb90e[_0x3f40('0x2f')]({'model':db[_0x3f40('0xc9')],'as':_0x3f40('0x61'),'attributes':['id',_0x3f40('0xca'),_0x3f40('0xcb')],'raw':!![]});if(_0x2e7950[_0x3f40('0x39')][_0x3f40('0xc6')]){_0x1fb90e[_0x3f40('0x2f')]({'model':db[_0x3f40('0xcc')],'as':_0x3f40('0xcc'),'raw':!![]});}var _0x16c78b=[{'model':db[_0x3f40('0xb9')],'as':_0x3f40('0xcd'),'attributes':['id',_0x3f40('0xb2'),'createdAt',_0x3f40('0xce'),_0x3f40('0xcf'),'read'],'include':_0x1fb90e}];_0x16c78b['push']({'model':db[_0x3f40('0xd0')],'as':_0x3f40('0xd1'),'attributes':['id','name']});_0x16c78b['push']({'model':db[_0x3f40('0xc8')],'as':_0x3f40('0xd2'),'attributes':['id','fullname']});return db[_0x3f40('0x33')][_0x3f40('0xb0')]({'where':{'id':_0x2e7950[_0x3f40('0xb3')]['id']},'include':_0x16c78b})['then'](handleEntityNotFound(_0x901767,null))[_0x3f40('0x30')](function(_0x3f6b5b){if(_0x3f6b5b){var _0xfe8a1e=_0x3f6b5b[_0x3f40('0xd3')]({'plain':!![]});fs[_0x3f40('0xd4')](_0x5b4fcc);var _0x2b424b={'format':'A4','border':'10px','header':{'height':_0x3f40('0xd5'),'contents':{'first':_0x3f40('0xd6')}},'footer':{'height':_0x3f40('0xd7'),'contents':{'default':util['format'](_0x3f40('0xd8'),util['format']('%s\x20#%d',_0x3f40('0xd9'),_0xfe8a1e['id']),moment()['format'](_0x3f40('0xda'))[_0x3f40('0x98')]())}}};var _0x2e22dc={'channel':_0x3f40('0xd9'),'account':_0xfe8a1e['Account'][_0x3f40('0x28')],'agent':_0xfe8a1e[_0x3f40('0xd2')]?_0xfe8a1e[_0x3f40('0xd2')][_0x3f40('0x2a')]:'N.A.','createdAt':moment(_0xfe8a1e[_0x3f40('0x74')])[_0x3f40('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3f40('0x98')](),'closedAt':_0xfe8a1e[_0x3f40('0xdb')]?moment(_0xfe8a1e[_0x3f40('0xdc')])['format'](_0x3f40('0xbb'))['toString']():'','disposition':_0xfe8a1e['disposition'],'messages':_(_0xfe8a1e[_0x3f40('0xcd')])[_0x3f40('0x80')]({'secret':![]})['map'](function(_0x17645d){if(_0x17645d[_0x3f40('0xcc')]){var _0x5103cc=path['join'](_0x500f31,_0x17645d['Attachment'][_0x3f40('0xdd')]);if(fs[_0x3f40('0xde')](_0x5103cc)){fs['createReadStream'](_0x5103cc)['pipe'](fs[_0x3f40('0xdf')](path[_0x3f40('0xc2')](_0x5b4fcc,_0x17645d[_0x3f40('0xcc')][_0x3f40('0xdd')])));}}return{'date':moment(_0x17645d[_0x3f40('0x74')])[_0x3f40('0xba')](_0x3f40('0xbb'))['toString'](),'sender':_0x17645d['direction']===_0x3f40('0xe0')?_0x17645d['User']?_0x17645d[_0x3f40('0xc8')][_0x3f40('0x2a')]:_0x3f40('0xe1'):_0x17645d[_0x3f40('0x61')]['firstName']+(_0x17645d['Contact'][_0x3f40('0xcb')]?'\x20'+_0x17645d[_0x3f40('0x61')][_0x3f40('0xcb')]:''),'body':_0x17645d[_0x3f40('0xcc')]?_0x17645d[_0x3f40('0xcc')][_0x3f40('0xdd')]:_0x17645d[_0x3f40('0xb2')],'direction':_0x17645d[_0x3f40('0xce')]===_0x3f40('0xe0')?'A':'C','secret':_0x17645d[_0x3f40('0xcf')],'read':_0x17645d[_0x3f40('0x7b')],'attachment':_0x17645d['Attachment']};})['value']()};return ejs[_0x3f40('0xe2')](path[_0x3f40('0xc2')](config[_0x3f40('0xc3')],'server',_0x3f40('0xe3'),'downloadInteraction.html'),{'interaction':_0x2e22dc})[_0x3f40('0x30')](function(_0x5ad920){return new BPromise(function(_0x3eef26,_0x203365){pdf[_0x3f40('0xb1')](_0x5ad920,_0x2b424b)[_0x3f40('0xe4')](path['join'](_0x5b4fcc,_0x3f40('0xe5')+_0xfe8a1e['id']+'-'+_0x25b757+_0x3f40('0xe6')),function(_0x31a285,_0x189013){if(_0x31a285)return _0x203365(_0x31a285);_0x3eef26(_0x189013);});});})[_0x3f40('0x30')](function(){return new BPromise(function(_0x2487f1,_0x37f8c3){zipdir(_0x5b4fcc,{'saveTo':_0x5253fc},function(_0x23b4a3,_0x5a352a){if(_0x23b4a3)return _0x37f8c3(_0x23b4a3);return _0x2487f1(_0x5a352a);});})[_0x3f40('0x30')](function(){return new BPromise(function(_0x84d59d,_0x48fb2c){rimraf(_0x5b4fcc,function(_0x3286bd){if(_0x3286bd)_0x48fb2c(_0x3286bd);return _0x84d59d();});});})[_0x3f40('0x30')](function(){return _0x901767['download'](_0x5253fc,_0x434d13,function(_0x3980a8){if(_0x3980a8){console['log']('err',_0x3980a8);}else{fs[_0x3f40('0xe7')](_0x5253fc);}});});});}else{return _0x901767[_0x3f40('0x1b')](0xc8);}})[_0x3f40('0x31')](handleError(_0x901767,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c159e4b..3a4c0b3 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 _0xd3bd=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','WhatsappInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xd3bd,0xa8));var _0xdd3b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xd3bd[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0xdd3b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xdd3b('0x1')];var WhatsappMessage=require(_0xdd3b('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdd3b('0x3')](0x0);var events={'afterCreate':_0xdd3b('0x4'),'afterUpdate':_0xdd3b('0x5'),'afterDestroy':_0xdd3b('0x6')};function emitEvent(_0x2e81a2){return function(_0x11274e,_0x17772c,_0x4572db){_0x11274e[_0xdd3b('0x7')]({'attributes':['id'],'raw':!![]})[_0xdd3b('0x8')](function(_0x55cb98){_0x11274e[_0xdd3b('0x9')](_0xdd3b('0xa'),_0x55cb98[_0xdd3b('0xb')](function(_0x26e926){return{'id':_0x26e926['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x11274e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdd3b('0x8')](function(_0x324090){_0x11274e[_0xdd3b('0x9')](_0xdd3b('0xc'),_0x324090[_0xdd3b('0xd')]);WhatsappInteractionEvents['emit'](_0x2e81a2+':'+_0x11274e['id'],_0x11274e);WhatsappInteractionEvents[_0xdd3b('0xe')](_0x2e81a2,_0x11274e);_0x4572db(null);})[_0xdd3b('0xf')](_0x4572db(null));};}for(var e in events){if(events[_0xdd3b('0x10')](e)){var event=events[e];WhatsappInteraction[_0xdd3b('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xa6ff=['WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa6ff,0x8d));var _0xfa6f=function(_0x1cc372,_0x79999){_0x1cc372=_0x1cc372-0x0;var _0x1c8203=_0xa6ff[_0x1cc372];return _0x1c8203;};'use strict';var EventEmitter=require(_0xfa6f('0x0'));var WhatsappInteraction=require(_0xfa6f('0x1'))['db'][_0xfa6f('0x2')];var WhatsappMessage=require(_0xfa6f('0x1'))['db'][_0xfa6f('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xfa6f('0x4')](0x0);var events={'afterCreate':_0xfa6f('0x5'),'afterUpdate':'update','afterDestroy':_0xfa6f('0x6')};function emitEvent(_0x62f0bd){return function(_0x35598e,_0x56c159,_0x288524){_0x35598e['getUsers']({'attributes':['id'],'raw':!![]})[_0xfa6f('0x7')](function(_0x81ddef){_0x35598e[_0xfa6f('0x8')](_0xfa6f('0x9'),_0x81ddef['map'](function(_0x5f233d){return{'id':_0x5f233d['id']};}));return WhatsappMessage[_0xfa6f('0xa')]({'where':{'WhatsappInteractionId':_0x35598e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfa6f('0x7')](function(_0x5a960c){_0x35598e[_0xfa6f('0x8')](_0xfa6f('0xb'),_0x5a960c['length']);WhatsappInteractionEvents['emit'](_0x62f0bd+':'+_0x35598e['id'],_0x35598e);WhatsappInteractionEvents[_0xfa6f('0xc')](_0x62f0bd,_0x35598e);_0x288524(null);})[_0xfa6f('0xd')](_0x288524(null));};}for(var e in events){if(events[_0xfa6f('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xfa6f('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 83836ed..bfd43ed 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 _0xf513=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','WhatsappInteraction','whatsapp_interactions'];(function(_0xd5b543,_0x1e2f21){var _0x1a1e80=function(_0x5a692d){while(--_0x5a692d){_0xd5b543['push'](_0xd5b543['shift']());}};_0x1a1e80(++_0x1e2f21);}(_0xf513,0xf5));var _0x3f51=function(_0x1968e0,_0x3933e0){_0x1968e0=_0x1968e0-0x0;var _0x57ecc6=_0xf513[_0x1968e0];return _0x57ecc6;};'use strict';var _=require(_0x3f51('0x0'));var util=require('util');var logger=require(_0x3f51('0x1'))(_0x3f51('0x2'));var moment=require(_0x3f51('0x3'));var BPromise=require(_0x3f51('0x4'));var rp=require(_0x3f51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f51('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x3f51('0x7')]=function(_0x26e1da,_0x614254){return _0x26e1da['define'](_0x3f51('0x8'),attributes,{'tableName':_0x3f51('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x337e2f,_0x441946,_0x1350fc){if(_0x337e2f[_0x3f51('0xa')](_0x3f51('0xb'))){_0x337e2f[_0x3f51('0xc')]=moment()[_0x3f51('0xd')](_0x3f51('0xe'));}_0x1350fc(null,_0x337e2f);}}});}; \ No newline at end of file +var _0x9855=['closed','closedAt','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','changed'];(function(_0x204a37,_0x54e8a5){var _0x32f13e=function(_0x2dd84d){while(--_0x2dd84d){_0x204a37['push'](_0x204a37['shift']());}};_0x32f13e(++_0x54e8a5);}(_0x9855,0xc6));var _0x5985=function(_0x5491f7,_0x478212){_0x5491f7=_0x5491f7-0x0;var _0xe7d4d8=_0x9855[_0x5491f7];return _0xe7d4d8;};'use strict';var _=require('lodash');var util=require(_0x5985('0x0'));var logger=require(_0x5985('0x1'))(_0x5985('0x2'));var moment=require(_0x5985('0x3'));var BPromise=require('bluebird');var rp=require(_0x5985('0x4'));var fs=require('fs');var path=require(_0x5985('0x5'));var rimraf=require(_0x5985('0x6'));var config=require(_0x5985('0x7'));var attributes=require(_0x5985('0x8'));module[_0x5985('0x9')]=function(_0x1124cd,_0x17f411){return _0x1124cd['define']('WhatsappInteraction',attributes,{'tableName':_0x5985('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ae290,_0x4b5f9c,_0x23427a){if(_0x1ae290[_0x5985('0xb')](_0x5985('0xc'))){_0x1ae290[_0x5985('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x23427a(null,_0x1ae290);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3a79d50..64c6ae7 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 _0x12e9=['then','addTags','body','ids','omit','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','AddTagsToWhatsappInteraction','find'];(function(_0x1cc2a9,_0x2c5885){var _0xdcc257=function(_0x3b0739){while(--_0x3b0739){_0x1cc2a9['push'](_0x1cc2a9['shift']());}};_0xdcc257(++_0x2c5885);}(_0x12e9,0xb6));var _0x912e=function(_0x133d00,_0x27f689){_0x133d00=_0x133d00-0x0;var _0x510044=_0x12e9[_0x133d00];return _0x510044;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x912e('0x0'));var BPromise=require(_0x912e('0x1'));var rs=require(_0x912e('0x2'));var fs=require('fs');var Redis=require(_0x912e('0x3'));var db=require(_0x912e('0x4'))['db'];var utils=require(_0x912e('0x5'));var logger=require(_0x912e('0x6'))(_0x912e('0x7'));var config=require(_0x912e('0x8'));var jayson=require(_0x912e('0x9'));var client=jayson[_0x912e('0xa')][_0x912e('0xb')]({'port':0x232a});config[_0x912e('0xc')]=_[_0x912e('0xd')](config['redis'],{'host':_0x912e('0xe'),'port':0x18eb});var socket=require(_0x912e('0xf'))(new Redis(config[_0x912e('0xc')]));require(_0x912e('0x10'))['register'](socket);function respondWithRpcPromise(_0x466a80,_0x54db5e,_0x4268dd){return new BPromise(function(_0xc17dcf,_0x10e4ba){return client[_0x912e('0x11')](_0x466a80,_0x4268dd)['then'](function(_0x3a95b3){logger['info'](_0x912e('0x12'),_0x54db5e,'request\x20sent');logger[_0x912e('0x13')](_0x912e('0x14'),_0x54db5e,'request\x20sent',JSON[_0x912e('0x15')](_0x3a95b3));if(_0x3a95b3[_0x912e('0x16')]){if(_0x3a95b3['error'][_0x912e('0x17')]===0x1f4){logger['error'](_0x912e('0x12'),_0x54db5e,_0x3a95b3['error']['message']);return _0x10e4ba(_0x3a95b3[_0x912e('0x16')]['message']);}logger['error'](_0x912e('0x12'),_0x54db5e,_0x3a95b3[_0x912e('0x16')][_0x912e('0x18')]);return _0xc17dcf(_0x3a95b3[_0x912e('0x16')][_0x912e('0x18')]);}else{logger[_0x912e('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x54db5e,_0x912e('0x1a'));_0xc17dcf(_0x3a95b3[_0x912e('0x1b')][_0x912e('0x18')]);}})[_0x912e('0x1c')](function(_0x58288f){logger[_0x912e('0x16')](_0x912e('0x12'),_0x54db5e,_0x58288f);_0x10e4ba(_0x58288f);});});}exports[_0x912e('0x1d')]=function(_0xedc993){var _0x2ed85f=this;return new Promise(function(_0x264f60,_0xcafb0){return db[_0x912e('0x1e')][_0x912e('0x1f')](_0xedc993['body'],{'raw':_0xedc993[_0x912e('0x20')]?_0xedc993[_0x912e('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedc993[_0x912e('0x20')]?_0xedc993['options'][_0x912e('0x21')]||null:null,'attributes':_0xedc993[_0x912e('0x20')]?_0xedc993['options'][_0x912e('0x22')]||null:null,'limit':_0xedc993[_0x912e('0x20')]?_0xedc993[_0x912e('0x20')][_0x912e('0x23')]||null:null})['then'](function(_0x561c69){logger[_0x912e('0x19')](_0x912e('0x1d'),_0xedc993);logger['debug'](_0x912e('0x1d'),_0xedc993,JSON[_0x912e('0x15')](_0x561c69));_0x264f60(_0x561c69);})[_0x912e('0x1c')](function(_0x3132bb){logger[_0x912e('0x16')](_0x912e('0x1d'),_0x3132bb[_0x912e('0x18')],_0xedc993);_0xcafb0(_0x2ed85f[_0x912e('0x16')](0x1f4,_0x3132bb[_0x912e('0x18')]));});});};exports[_0x912e('0x24')]=function(_0x5cf31b){return new Promise(function(_0x3120eb,_0x297d6f){return db['WhatsappInteraction'][_0x912e('0x25')]({'where':_0x5cf31b[_0x912e('0x20')]?_0x5cf31b['options']['where']||null:null})[_0x912e('0x26')](function(_0x5764ce){if(_0x5764ce){return _0x5764ce[_0x912e('0x27')](_0x5cf31b[_0x912e('0x28')][_0x912e('0x29')],_[_0x912e('0x2a')](_0x5cf31b[_0x912e('0x28')],[_0x912e('0x29'),'id'])||{});}})['spread'](function(_0x36e057){logger[_0x912e('0x19')](_0x912e('0x2b'),_0x5cf31b);logger['debug'](_0x912e('0x2b'),_0x5cf31b,JSON[_0x912e('0x15')](_0x36e057));_0x3120eb(_0x36e057);})['catch'](function(_0x379292){logger[_0x912e('0x16')](_0x912e('0x2b'),_0x379292[_0x912e('0x18')],_0x5cf31b);_0x297d6f(_this['error'](0x1f4,_0x379292[_0x912e('0x18')]));});});}; \ No newline at end of file +var _0xa5a4=['request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','catch','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x41aeaa,_0x5a355c){var _0x11e8ce=function(_0x42cccf){while(--_0x42cccf){_0x41aeaa['push'](_0x41aeaa['shift']());}};_0x11e8ce(++_0x5a355c);}(_0xa5a4,0x14f));var _0x4a5a=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xa5a4[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x4a5a('0x0'));var util=require(_0x4a5a('0x1'));var moment=require(_0x4a5a('0x2'));var BPromise=require(_0x4a5a('0x3'));var rs=require(_0x4a5a('0x4'));var fs=require('fs');var Redis=require(_0x4a5a('0x5'));var db=require(_0x4a5a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a5a('0x7'))(_0x4a5a('0x8'));var config=require(_0x4a5a('0x9'));var jayson=require(_0x4a5a('0xa'));var client=jayson[_0x4a5a('0xb')]['http']({'port':0x232a});config[_0x4a5a('0xc')]=_[_0x4a5a('0xd')](config[_0x4a5a('0xc')],{'host':_0x4a5a('0xe'),'port':0x18eb});var socket=require(_0x4a5a('0xf'))(new Redis(config[_0x4a5a('0xc')]));require('./whatsappInteraction.socket')[_0x4a5a('0x10')](socket);function respondWithRpcPromise(_0x238419,_0x55e82d,_0x12b5dd){return new BPromise(function(_0x25d045,_0x532345){return client[_0x4a5a('0x11')](_0x238419,_0x12b5dd)[_0x4a5a('0x12')](function(_0x1d8206){logger[_0x4a5a('0x13')](_0x4a5a('0x14'),_0x55e82d,_0x4a5a('0x15'));logger[_0x4a5a('0x16')](_0x4a5a('0x17'),_0x55e82d,'request\x20sent',JSON['stringify'](_0x1d8206));if(_0x1d8206['error']){if(_0x1d8206[_0x4a5a('0x18')][_0x4a5a('0x19')]===0x1f4){logger[_0x4a5a('0x18')](_0x4a5a('0x14'),_0x55e82d,_0x1d8206[_0x4a5a('0x18')][_0x4a5a('0x1a')]);return _0x532345(_0x1d8206[_0x4a5a('0x18')][_0x4a5a('0x1a')]);}logger['error'](_0x4a5a('0x14'),_0x55e82d,_0x1d8206[_0x4a5a('0x18')][_0x4a5a('0x1a')]);return _0x25d045(_0x1d8206[_0x4a5a('0x18')][_0x4a5a('0x1a')]);}else{logger['info'](_0x4a5a('0x14'),_0x55e82d,_0x4a5a('0x15'));_0x25d045(_0x1d8206[_0x4a5a('0x1b')][_0x4a5a('0x1a')]);}})['catch'](function(_0x1330ea){logger[_0x4a5a('0x18')](_0x4a5a('0x14'),_0x55e82d,_0x1330ea);_0x532345(_0x1330ea);});});}exports['UpdateWhatsappInteraction']=function(_0xbf374c){var _0x363e6f=this;return new Promise(function(_0x60bc7d,_0x558e66){return db[_0x4a5a('0x1c')][_0x4a5a('0x1d')](_0xbf374c[_0x4a5a('0x1e')],{'raw':_0xbf374c[_0x4a5a('0x1f')]?_0xbf374c['options'][_0x4a5a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbf374c['options']?_0xbf374c[_0x4a5a('0x1f')][_0x4a5a('0x21')]||null:null,'attributes':_0xbf374c[_0x4a5a('0x1f')]?_0xbf374c[_0x4a5a('0x1f')][_0x4a5a('0x22')]||null:null,'limit':_0xbf374c[_0x4a5a('0x1f')]?_0xbf374c['options'][_0x4a5a('0x23')]||null:null})[_0x4a5a('0x12')](function(_0x4b81d9){logger[_0x4a5a('0x13')](_0x4a5a('0x24'),_0xbf374c);logger[_0x4a5a('0x16')](_0x4a5a('0x24'),_0xbf374c,JSON[_0x4a5a('0x25')](_0x4b81d9));_0x60bc7d(_0x4b81d9);})[_0x4a5a('0x26')](function(_0x40123d){logger['error'](_0x4a5a('0x24'),_0x40123d[_0x4a5a('0x1a')],_0xbf374c);_0x558e66(_0x363e6f[_0x4a5a('0x18')](0x1f4,_0x40123d[_0x4a5a('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x669c2e){return new Promise(function(_0x29aae8,_0x3bbeb7){return db[_0x4a5a('0x1c')][_0x4a5a('0x27')]({'where':_0x669c2e[_0x4a5a('0x1f')]?_0x669c2e['options']['where']||null:null})[_0x4a5a('0x12')](function(_0x455b59){if(_0x455b59){return _0x455b59['addTags'](_0x669c2e['body'][_0x4a5a('0x28')],_[_0x4a5a('0x29')](_0x669c2e[_0x4a5a('0x1e')],[_0x4a5a('0x28'),'id'])||{});}})[_0x4a5a('0x2a')](function(_0x4cecea){logger[_0x4a5a('0x13')](_0x4a5a('0x2b'),_0x669c2e);logger[_0x4a5a('0x16')]('AddTags',_0x669c2e,JSON[_0x4a5a('0x25')](_0x4cecea));_0x29aae8(_0x4cecea);})[_0x4a5a('0x26')](function(_0x211399){logger[_0x4a5a('0x18')](_0x4a5a('0x2b'),_0x211399[_0x4a5a('0x1a')],_0x669c2e);_0x3bbeb7(_this[_0x4a5a('0x18')](0x1f4,_0x211399['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 94c84a3..ad06182 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 _0xb5d7=['emit','removeListener','length','./whatsappInteraction.events','save','remove','update'];(function(_0x34ec72,_0x3c254a){var _0x749b21=function(_0x2af816){while(--_0x2af816){_0x34ec72['push'](_0x34ec72['shift']());}};_0x749b21(++_0x3c254a);}(_0xb5d7,0x73));var _0x7b5d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb5d7[_0x3b380d];return _0x54502b;};'use strict';var WhatsappInteractionEvents=require(_0x7b5d('0x0'));var events=[_0x7b5d('0x1'),_0x7b5d('0x2'),_0x7b5d('0x3')];function createListener(_0x299e51,_0x110f0e){return function(_0x73f3d2){_0x110f0e[_0x7b5d('0x4')](_0x299e51,_0x73f3d2);};}function removeListener(_0x5a0509,_0x2a9566){return function(){WhatsappInteractionEvents[_0x7b5d('0x5')](_0x5a0509,_0x2a9566);};}exports['register']=function(_0x42bd6a){for(var _0x3a8b7e=0x0,_0x1c0eb9=events[_0x7b5d('0x6')];_0x3a8b7e<_0x1c0eb9;_0x3a8b7e++){var _0x18c1e4=events[_0x3a8b7e];var _0x597a28=createListener('whatsappInteraction:'+_0x18c1e4,_0x42bd6a);WhatsappInteractionEvents['on'](_0x18c1e4,_0x597a28);}}; \ No newline at end of file +var _0x9bde=['whatsappInteraction:','./whatsappInteraction.events','emit','removeListener'];(function(_0x19dbc0,_0x180cad){var _0xf0b964=function(_0x59fd98){while(--_0x59fd98){_0x19dbc0['push'](_0x19dbc0['shift']());}};_0xf0b964(++_0x180cad);}(_0x9bde,0xb9));var _0xe9bd=function(_0x5633eb,_0x2dc4a5){_0x5633eb=_0x5633eb-0x0;var _0x2e87aa=_0x9bde[_0x5633eb];return _0x2e87aa;};'use strict';var WhatsappInteractionEvents=require(_0xe9bd('0x0'));var events=['save','remove','update'];function createListener(_0x3c8a1d,_0x3b742f){return function(_0x48daf0){_0x3b742f[_0xe9bd('0x1')](_0x3c8a1d,_0x48daf0);};}function removeListener(_0x516bf1,_0x819c98){return function(){WhatsappInteractionEvents[_0xe9bd('0x2')](_0x516bf1,_0x819c98);};}exports['register']=function(_0x5186f6){for(var _0x48bd63=0x0,_0x5b7ec2=events['length'];_0x48bd63<_0x5b7ec2;_0x48bd63++){var _0x4fa252=events[_0x48bd63];var _0x452fce=createListener(_0xe9bd('0x3')+_0x4fa252,_0x5186f6);WhatsappInteractionEvents['on'](_0x4fa252,_0x452fce);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5d4f28a..5ffd29d 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 _0xb301=['/:id/accept','accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./whatsappMessage.controller','get','describe','/:id','show','post','isAuthenticated','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update'];(function(_0x3dfe97,_0x326384){var _0x4be838=function(_0x31624f){while(--_0x31624f){_0x3dfe97['push'](_0x3dfe97['shift']());}};_0x4be838(++_0x326384);}(_0xb301,0xd6));var _0x1b30=function(_0x12957a,_0x2c128d){_0x12957a=_0x12957a-0x0;var _0xfbf4a2=_0xb301[_0x12957a];return _0xfbf4a2;};'use strict';var multer=require(_0x1b30('0x0'));var util=require(_0x1b30('0x1'));var path=require('path');var timeout=require(_0x1b30('0x2'));var express=require(_0x1b30('0x3'));var router=express[_0x1b30('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b30('0x5'));var controller=require(_0x1b30('0x6'));router[_0x1b30('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1b30('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1b30('0x8')]);router[_0x1b30('0x7')](_0x1b30('0x9'),auth['isAuthenticated'](),controller[_0x1b30('0xa')]);router[_0x1b30('0xb')]('/',auth[_0x1b30('0xc')](),interaction[_0x1b30('0xd')](_0x1b30('0xe'),_0x1b30('0xf')),controller['create']);router['post'](_0x1b30('0x10'),controller[_0x1b30('0x11')]);router[_0x1b30('0x12')]('/:id',auth[_0x1b30('0xc')](),controller[_0x1b30('0x13')]);router[_0x1b30('0x12')](_0x1b30('0x14'),auth[_0x1b30('0xc')](),controller[_0x1b30('0x15')]);router['put']('/:id/reject',auth[_0x1b30('0xc')](),controller[_0x1b30('0x16')]);router[_0x1b30('0x17')](_0x1b30('0x9'),auth[_0x1b30('0xc')](),controller[_0x1b30('0x18')]);module[_0x1b30('0x19')]=router; \ No newline at end of file +var _0xefe2=['/:id/accept','accept','/:id/reject','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id','show','post','whatsapp','whatsappmessage:create','put','update'];(function(_0xd92e0f,_0x4c28de){var _0x408a33=function(_0x35be94){while(--_0x35be94){_0xd92e0f['push'](_0xd92e0f['shift']());}};_0x408a33(++_0x4c28de);}(_0xefe2,0x174));var _0x2efe=function(_0x3252eb,_0x840a11){_0x3252eb=_0x3252eb-0x0;var _0x4fd2eb=_0xefe2[_0x3252eb];return _0x4fd2eb;};'use strict';var multer=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var path=require('path');var timeout=require(_0x2efe('0x2'));var express=require(_0x2efe('0x3'));var router=express[_0x2efe('0x4')]();var auth=require(_0x2efe('0x5'));var interaction=require(_0x2efe('0x6'));var config=require(_0x2efe('0x7'));var controller=require(_0x2efe('0x8'));router[_0x2efe('0x9')]('/',auth[_0x2efe('0xa')](),controller['index']);router[_0x2efe('0x9')](_0x2efe('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x2efe('0x9')](_0x2efe('0xc'),auth['isAuthenticated'](),controller[_0x2efe('0xd')]);router[_0x2efe('0xe')]('/',auth[_0x2efe('0xa')](),interaction['tracked'](_0x2efe('0xf'),_0x2efe('0x10')),controller['create']);router[_0x2efe('0xe')]('/:id/status',controller['status']);router[_0x2efe('0x11')](_0x2efe('0xc'),auth[_0x2efe('0xa')](),controller[_0x2efe('0x12')]);router[_0x2efe('0x11')](_0x2efe('0x13'),auth['isAuthenticated'](),controller[_0x2efe('0x14')]);router['put'](_0x2efe('0x15'),auth[_0x2efe('0xa')](),controller['reject']);router[_0x2efe('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 0104490..fa7372c 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 _0x2b47=['medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT'];(function(_0x30d38e,_0x429b88){var _0x430420=function(_0x284e8d){while(--_0x284e8d){_0x30d38e['push'](_0x30d38e['shift']());}};_0x430420(++_0x429b88);}(_0x2b47,0x16e));var _0x72b4=function(_0x5104e2,_0x363934){_0x5104e2=_0x5104e2-0x0;var _0x45f61c=_0x2b47[_0x5104e2];return _0x45f61c;};'use strict';var Sequelize=require(_0x72b4('0x0'));module[_0x72b4('0x1')]={'body':{'type':Sequelize[_0x72b4('0x2')](_0x72b4('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x72b4('0x4')]('in','out'),'defaultValue':_0x72b4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x72b4('0x6')](0xbe)},'phone':{'type':Sequelize[_0x72b4('0x6')]},'readAt':{'type':Sequelize[_0x72b4('0x7')]},'secret':{'type':Sequelize[_0x72b4('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x72b4('0x2')]}}; \ No newline at end of file +var _0x39e2=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x10a44b,_0x403d48){var _0x3d714e=function(_0x1d1e8e){while(--_0x1d1e8e){_0x10a44b['push'](_0x10a44b['shift']());}};_0x3d714e(++_0x403d48);}(_0x39e2,0x194));var _0x239e=function(_0x1e2104,_0x47ffca){_0x1e2104=_0x1e2104-0x0;var _0x27e537=_0x39e2[_0x1e2104];return _0x27e537;};'use strict';var Sequelize=require(_0x239e('0x0'));module[_0x239e('0x1')]={'body':{'type':Sequelize[_0x239e('0x2')](_0x239e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x239e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x239e('0x5')]('in',_0x239e('0x6')),'defaultValue':_0x239e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x239e('0x7')](0xbe)},'phone':{'type':Sequelize[_0x239e('0x7')]},'readAt':{'type':Sequelize[_0x239e('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x239e('0x7')]},'providerResponse':{'type':Sequelize[_0x239e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a71069b..24e3b6b 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 _0x14a0=['RejectMessage','rejectMessage','interface','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','WhatsappMessage','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','WhatsappInteractionId','UserId','isNil','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x14a0,0x8e));var _0x014a=function(_0x3cfb62,_0x5b588c){_0x3cfb62=_0x3cfb62-0x0;var _0x1aaf79=_0x14a0[_0x3cfb62];return _0x1aaf79;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);var jayson=require(_0x014a('0x1a'));var client=jayson['client'][_0x014a('0x1b')]({'port':0x232c});var client9002=jayson[_0x014a('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a836f,_0x128c46,_0x59a4ea,_0x16e6fc){return new BPromise(function(_0x17e4be,_0x20f148){var _0x12da95=_0x16e6fc||client;return _0x12da95[_0x014a('0x1d')](_0x3a836f,_0x59a4ea)[_0x014a('0x1e')](function(_0x61ec9f){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x128c46,_0x014a('0x21'),JSON[_0x014a('0x24')](_0x61ec9f));if(_0x61ec9f['error']){if(_0x61ec9f[_0x014a('0x25')][_0x014a('0x26')]===0x1f4){logger[_0x014a('0x25')](_0x014a('0x20'),_0x128c46,_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);return _0x20f148(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}logger[_0x014a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x128c46,_0x61ec9f[_0x014a('0x25')]['message']);return _0x17e4be(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));_0x17e4be(_0x61ec9f[_0x014a('0x28')][_0x014a('0x27')]);}})[_0x014a('0x29')](function(_0x165a42){logger['error'](_0x014a('0x20'),_0x128c46,_0x165a42);_0x20f148(_0x165a42);});});}function respondWithStatusCode(_0x5358e9,_0x39a432){_0x39a432=_0x39a432||0xcc;return function(_0x28701e){if(_0x28701e){return _0x5358e9['sendStatus'](_0x39a432);}return _0x5358e9['status'](_0x39a432)[_0x014a('0x2a')]();};}function respondWithResult(_0x3f9719,_0x143346){_0x143346=_0x143346||0xc8;return function(_0x5ed71b){if(_0x5ed71b){return _0x3f9719[_0x014a('0x2b')](_0x143346)[_0x014a('0x2c')](_0x5ed71b);}};}function respondWithFilteredResult(_0x598179,_0x31dc95){return function(_0x2560a6){if(_0x2560a6){var _0x496040=_0x2560a6[_0x014a('0x2d')],_0x4f9c1c=_0x31dc95[_0x014a('0x2e')],_0x397850=_0x31dc95['offset']+_0x31dc95[_0x014a('0x2f')],_0x3e5a0a;if(_0x397850>=_0x496040){_0x397850=_0x496040;_0x3e5a0a=0xc8;}else{_0x3e5a0a=0xce;}_0x598179[_0x014a('0x2b')](_0x3e5a0a);return _0x598179[_0x014a('0x30')](_0x014a('0x31'),_0x4f9c1c+'-'+_0x397850+'/'+_0x496040)[_0x014a('0x2c')](_0x2560a6);}return null;};}function patchUpdates(_0x1eb007){return function(_0x354f4c){try{jsonpatch[_0x014a('0x32')](_0x354f4c,_0x1eb007,!![]);}catch(_0xc802d5){return BPromise[_0x014a('0x33')](_0xc802d5);}return _0x354f4c[_0x014a('0x34')]();};}function saveUpdates(_0x4ed54e,_0x105d4a){return function(_0x41ead8){if(_0x41ead8){return _0x41ead8[_0x014a('0x35')](_0x4ed54e)[_0x014a('0x1e')](function(_0x5f1022){return _0x5f1022;});}return null;};}function removeEntity(_0x39b3b8,_0x211d18){return function(_0x4dd025){if(_0x4dd025){return _0x4dd025[_0x014a('0x36')]()[_0x014a('0x1e')](function(){_0x39b3b8['status'](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x12de94,_0x40738f){return function(_0x467032){if(!_0x467032){_0x12de94[_0x014a('0x37')](0x194);}return _0x467032;};}function handleError(_0xa8fcfb,_0x26a5e8){_0x26a5e8=_0x26a5e8||0x1f4;return function(_0x1cff0f){logger['error'](_0x1cff0f[_0x014a('0x38')]);if(_0x1cff0f[_0x014a('0x39')]){delete _0x1cff0f[_0x014a('0x39')];}_0xa8fcfb[_0x014a('0x2b')](_0x26a5e8)['send'](_0x1cff0f);};}exports[_0x014a('0x3a')]=function(_0x978870,_0x27ee0c){var _0x157bd0={},_0x35e527={},_0x309925={'count':0x0,'rows':[]};var _0x128fb9=_[_0x014a('0x3b')](db[_0x014a('0x3c')]['rawAttributes'],function(_0x1b34f8){return{'name':_0x1b34f8['fieldName'],'type':_0x1b34f8[_0x014a('0x3d')][_0x014a('0x3e')]};});_0x35e527[_0x014a('0x3f')]=_[_0x014a('0x3b')](_0x128fb9,_0x014a('0x39'));_0x35e527['query']=_[_0x014a('0x40')](_0x978870[_0x014a('0x41')]);_0x35e527['filters']=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],_0x35e527[_0x014a('0x41')]);_0x157bd0[_0x014a('0x43')]=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x978870[_0x014a('0x41')][_0x014a('0x44')]));_0x157bd0['attributes']=_0x157bd0[_0x014a('0x43')][_0x014a('0x45')]?_0x157bd0[_0x014a('0x43')]:_0x35e527[_0x014a('0x3f')];if(!_0x978870['query'][_0x014a('0x46')](_0x014a('0x47'))){_0x157bd0[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x978870[_0x014a('0x41')][_0x014a('0x2f')]);_0x157bd0['offset']=qs[_0x014a('0x2e')](_0x978870[_0x014a('0x41')]['offset']);}_0x157bd0[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x978870[_0x014a('0x41')]['sort']);_0x157bd0[_0x014a('0x4a')]=qs['filters'](_['pick'](_0x978870[_0x014a('0x41')],_0x35e527[_0x014a('0x4b')]),_0x128fb9);if(_0x978870['query'][_0x014a('0x4c')]){_0x157bd0[_0x014a('0x4a')]=_[_0x014a('0x4d')](_0x157bd0[_0x014a('0x4a')],{'$or':_[_0x014a('0x3b')](_0x128fb9,function(_0xbaf8c6){if(_0xbaf8c6['type']!==_0x014a('0x4e')){var _0xb0d8e0={};_0xb0d8e0[_0xbaf8c6[_0x014a('0x39')]]={'$like':'%'+_0x978870['query']['filter']+'%'};return _0xb0d8e0;}})});}_0x157bd0=_[_0x014a('0x4d')]({},_0x157bd0,_0x978870['options']);var _0x489590={'where':_0x157bd0[_0x014a('0x4a')]};return db['WhatsappMessage'][_0x014a('0x2d')](_0x489590)[_0x014a('0x1e')](function(_0x36372d){_0x309925['count']=_0x36372d;if(_0x978870[_0x014a('0x41')][_0x014a('0x4f')]){_0x157bd0[_0x014a('0x50')]=[{'all':!![]}];}return db[_0x014a('0x3c')][_0x014a('0x51')](_0x157bd0);})[_0x014a('0x1e')](function(_0x559954){_0x309925[_0x014a('0x52')]=_0x559954;return _0x309925;})[_0x014a('0x1e')](respondWithFilteredResult(_0x27ee0c,_0x157bd0))['catch'](handleError(_0x27ee0c,null));};exports[_0x014a('0x53')]=function(_0x29345b,_0x20bb0c){var _0x324df7={'raw':!![],'where':{'id':_0x29345b[_0x014a('0x54')]['id']}},_0x40a9c1={};_0x40a9c1[_0x014a('0x3f')]=_[_0x014a('0x40')](db['WhatsappMessage'][_0x014a('0x55')]);_0x40a9c1[_0x014a('0x41')]=_[_0x014a('0x40')](_0x29345b[_0x014a('0x41')]);_0x40a9c1[_0x014a('0x4b')]=_['intersection'](_0x40a9c1[_0x014a('0x3f')],_0x40a9c1['query']);_0x324df7[_0x014a('0x43')]=_[_0x014a('0x42')](_0x40a9c1[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x29345b[_0x014a('0x41')]['fields']));_0x324df7['attributes']=_0x324df7['attributes']['length']?_0x324df7[_0x014a('0x43')]:_0x40a9c1['model'];if(_0x29345b[_0x014a('0x41')]['includeAll']){_0x324df7['include']=[{'all':!![]}];}_0x324df7=_[_0x014a('0x4d')]({},_0x324df7,_0x29345b['options']);return db[_0x014a('0x3c')][_0x014a('0x56')](_0x324df7)[_0x014a('0x1e')](handleEntityNotFound(_0x20bb0c,null))[_0x014a('0x1e')](respondWithResult(_0x20bb0c,null))[_0x014a('0x29')](handleError(_0x20bb0c,null));};exports[_0x014a('0x57')]=function(_0x35a421,_0x46fa9d){return db[_0x014a('0x3c')][_0x014a('0x57')](_0x35a421['body'],{})['then'](respondWithResult(_0x46fa9d,0xc9))[_0x014a('0x29')](handleError(_0x46fa9d,null));};exports[_0x014a('0x35')]=function(_0x237345,_0x4cc246){if(_0x237345['body']['id']){delete _0x237345[_0x014a('0x58')]['id'];}return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x237345[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x1e')](saveUpdates(_0x237345['body'],null))[_0x014a('0x1e')](respondWithResult(_0x4cc246,null))[_0x014a('0x29')](handleError(_0x4cc246,null));};exports[_0x014a('0x36')]=function(_0x56c09b,_0xbaeb5f){return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x56c09b[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0xbaeb5f,null))[_0x014a('0x1e')](removeEntity(_0xbaeb5f,null))[_0x014a('0x29')](handleError(_0xbaeb5f,null));};exports[_0x014a('0x59')]=function(_0x4e9260,_0x889080){return db[_0x014a('0x3c')][_0x014a('0x59')]()['then'](respondWithResult(_0x889080,null))[_0x014a('0x29')](handleError(_0x889080,null));};var interaction_log=require(_0x014a('0xf'))(_0x014a('0x5a'));exports[_0x014a('0x5b')]=function(_0x11bf5c,_0x5da1f7,_0x8ac9cd){var _0x46168d={'channel':_0x014a('0x5c')};if(_0x11bf5c[_0x014a('0x58')]['id']){delete _0x11bf5c[_0x014a('0x58')]['id'];}_0x11bf5c[_0x014a('0x58')][_0x014a('0x5d')]=!![];_0x11bf5c[_0x014a('0x58')][_0x014a('0x5e')]=moment()[_0x014a('0x5f')](_0x014a('0x60'));_0x11bf5c[_0x014a('0x58')]['UserId']=_0x11bf5c[_0x014a('0x58')]['UserId']||_0x11bf5c['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x11bf5c['params']['id'],'UserId':null},'include':[{'model':db[_0x014a('0x61')],'as':_0x014a('0x62')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))['then'](saveUpdates(_0x11bf5c[_0x014a('0x58')],null))[_0x014a('0x1e')](function(_0x3071c8){if(_0x3071c8){_0x46168d[_0x014a('0x27')]=_0x3071c8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x014a('0x56')]({'where':{'id':_0x3071c8[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))[_0x014a('0x1e')](function(_0x34c0b2){if(_0x34c0b2){return _0x34c0b2[_0x014a('0x35')]({'UserId':_0x11bf5c[_0x014a('0x58')][_0x014a('0x64')],'read1stAt':_[_0x014a('0x65')](_0x34c0b2[_0x014a('0x66')])?moment()[_0x014a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x014a('0x1e')](function(_0x25a53b){if(_0x25a53b){_0x46168d['interaction']=_0x25a53b[_0x014a('0x67')]({'plain':!![]});interaction_log[_0x014a('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11bf5c[_0x014a('0x68')]['id'],_0x11bf5c['user'][_0x014a('0x39')],_0x11bf5c[_0x014a('0x68')][_0x014a('0x69')],_0x46168d[_0x014a('0x6a')]['id'],_0x11bf5c[_0x014a('0x58')]?JSON['stringify'](_0x11bf5c[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x6c'),_0x014a('0x6d'),_0x46168d);}return null;})[_0x014a('0x1e')](function(_0x52e79e){if(_0x52e79e){if(_0x11bf5c[_0x014a('0x58')][_0x014a('0x6e')]){_0x46168d[_0x014a('0x27')]['interface']=util[_0x014a('0x5f')]('SIP/%s',_0x11bf5c[_0x014a('0x68')][_0x014a('0x39')]);_0x46168d[_0x014a('0x27')][_0x014a('0x6f')]=_0x46168d[_0x014a('0x6f')];_0x46168d[_0x014a('0x27')][_0x014a('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x014a('0x71'),{'event':'acceptmessage','message':_0x46168d[_0x014a('0x27')]},client9002)['then'](function(){return _0x46168d;});}return _0x46168d;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5da1f7,null))[_0x014a('0x29')](handleError(_0x5da1f7,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x014a('0x33')]=function(_0x8234ee,_0x5f391d,_0x882fc9){var _0x42e4e9={'agent':{},'channel':'whatsapp'};if(_0x8234ee['body']['id']){delete _0x8234ee[_0x014a('0x58')]['id'];}_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]=_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]||_0x8234ee[_0x014a('0x68')]['id'];_0x42e4e9['agent']['id']=_0x8234ee[_0x014a('0x58')]['UserId'];return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x8234ee[_0x014a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x43165e){if(_0x43165e){_0x42e4e9[_0x014a('0x27')]=_0x43165e[_0x014a('0x67')]({'plain':!![]});return db[_0x014a('0x72')]['find']({'where':{'id':_0x43165e[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x163fa2){if(_0x163fa2){_0x42e4e9['interaction']=_0x163fa2[_0x014a('0x67')]({'plain':!![]});interaction_log['info'](_0x014a('0x73'),_0x8234ee[_0x014a('0x68')]['id'],_0x8234ee[_0x014a('0x68')][_0x014a('0x39')],_0x8234ee[_0x014a('0x68')][_0x014a('0x69')],_0x42e4e9['interaction']['id'],_0x8234ee[_0x014a('0x58')]?JSON[_0x014a('0x24')](_0x8234ee[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x74'),_0x014a('0x75'),_0x42e4e9);}return null;})[_0x014a('0x1e')](function(_0x28a8a9){if(_0x28a8a9){_0x28a8a9['message'][_0x014a('0x76')]=util[_0x014a('0x5f')](_0x014a('0x77'),_0x8234ee['user'][_0x014a('0x39')]);_0x28a8a9[_0x014a('0x27')][_0x014a('0x6f')]=_0x42e4e9[_0x014a('0x6f')];_0x28a8a9[_0x014a('0x27')][_0x014a('0x70')]=_0x014a('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x28a8a9['message']},client9002);return _0x42e4e9;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5f391d,null))[_0x014a('0x29')](handleError(_0x5f391d,null));};exports[_0x014a('0x2b')]=function(_0x3804e1,_0xe1b5ed,_0x7cd599){if(_0x3804e1[_0x014a('0x58')]['id']){delete _0x3804e1['body']['id'];}var _0x24ffb0;return db[_0x014a('0x3c')][_0x014a('0x56')]({'where':{'id':_0x3804e1[_0x014a('0x54')]['id']}})['then'](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x13e2fc){if(_0x13e2fc){_0x24ffb0=_0x13e2fc;return db[_0x014a('0x78')]['find']({'where':{'id':_0x13e2fc['WhatsappAccountId']}});}})[_0x014a('0x1e')](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x5d4099){if(_0x5d4099){logger[_0x014a('0x22')](_0x014a('0x79'),'status',_0x014a('0x7a'),_0x5d4099[_0x014a('0x3d')],util[_0x014a('0x7b')](_0x3804e1[_0x014a('0x58')],{'showHidden':![],'depth':null}));switch(_0x5d4099[_0x014a('0x3d')]){case _0x014a('0x7c'):if(_0x3804e1[_0x014a('0x58')][_0x014a('0x7d')]&&_0x3804e1['body']['MessageSid']===_0x24ffb0[_0x014a('0x7e')]&&_0x3804e1['body']['MessageStatus']&&_0x3804e1['body'][_0x014a('0x7f')]===_0x014a('0x5d')){return _0x24ffb0[_0x014a('0x35')]({'read':!![]});}else{logger['error'](_0x014a('0x80'),_0x014a('0x2b'),_0x014a('0x7c'),util[_0x014a('0x7b')](_0x3804e1['body'],{'showHidden':![],'depth':null}));}break;}return _0x24ffb0;}})[_0x014a('0x1e')](respondWithResult(_0xe1b5ed,null))[_0x014a('0x29')](handleError(_0xe1b5ed,null));}; \ No newline at end of file +var _0x2ef3=['map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','whatsapp-interactions','whatsapp','format','UserId','Contact','get','WhatsappInteraction','isNil','read1stAt','interaction','user','role','null','AcceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./whatsappMessage.socket','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','update','destroy','name','send'];(function(_0x5803a8,_0x3c54db){var _0x4ccd3a=function(_0x49de33){while(--_0x49de33){_0x5803a8['push'](_0x5803a8['shift']());}};_0x4ccd3a(++_0x3c54db);}(_0x2ef3,0xba));var _0x32ef=function(_0x360d7f,_0x19b852){_0x360d7f=_0x360d7f-0x0;var _0x19dc3c=_0x2ef3[_0x360d7f];return _0x19dc3c;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');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('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x18'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x19')]=_['defaults'](config[_0x32ef('0x19')],{'host':_0x32ef('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x32ef('0x1b'))['register'](socket);var jayson=require(_0x32ef('0x1c'));var client=jayson[_0x32ef('0x1d')][_0x32ef('0x1e')]({'port':0x232c});var client9002=jayson[_0x32ef('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55bf0b,_0x531e30,_0x13db1a,_0x3950e6){return new BPromise(function(_0xb5aed2,_0x53a5ca){var _0x5d559b=_0x3950e6||client;return _0x5d559b[_0x32ef('0x1f')](_0x55bf0b,_0x13db1a)[_0x32ef('0x20')](function(_0x286bfb){logger['info'](_0x32ef('0x21'),_0x531e30,_0x32ef('0x22'));logger['debug'](_0x32ef('0x23'),_0x531e30,_0x32ef('0x22'),JSON[_0x32ef('0x24')](_0x286bfb));if(_0x286bfb[_0x32ef('0x25')]){if(_0x286bfb[_0x32ef('0x25')][_0x32ef('0x26')]===0x1f4){logger['error'](_0x32ef('0x21'),_0x531e30,_0x286bfb['error'][_0x32ef('0x27')]);return _0x53a5ca(_0x286bfb[_0x32ef('0x25')]['message']);}logger[_0x32ef('0x25')](_0x32ef('0x21'),_0x531e30,_0x286bfb[_0x32ef('0x25')]['message']);return _0xb5aed2(_0x286bfb['error'][_0x32ef('0x27')]);}else{logger[_0x32ef('0x28')](_0x32ef('0x21'),_0x531e30,'request\x20sent');_0xb5aed2(_0x286bfb['result'][_0x32ef('0x27')]);}})['catch'](function(_0x51a412){logger[_0x32ef('0x25')](_0x32ef('0x21'),_0x531e30,_0x51a412);_0x53a5ca(_0x51a412);});});}function respondWithStatusCode(_0x371540,_0x1dbe98){_0x1dbe98=_0x1dbe98||0xcc;return function(_0x15ce54){if(_0x15ce54){return _0x371540[_0x32ef('0x29')](_0x1dbe98);}return _0x371540[_0x32ef('0x2a')](_0x1dbe98)[_0x32ef('0x2b')]();};}function respondWithResult(_0x338f19,_0x2f52d7){_0x2f52d7=_0x2f52d7||0xc8;return function(_0x1335e2){if(_0x1335e2){return _0x338f19[_0x32ef('0x2a')](_0x2f52d7)['json'](_0x1335e2);}};}function respondWithFilteredResult(_0xd65fde,_0x2f5d06){return function(_0x5a04cd){if(_0x5a04cd){var _0x12de1a=_0x5a04cd['count'],_0x3c569d=_0x2f5d06[_0x32ef('0x2c')],_0x30b250=_0x2f5d06[_0x32ef('0x2c')]+_0x2f5d06[_0x32ef('0x2d')],_0x26e207;if(_0x30b250>=_0x12de1a){_0x30b250=_0x12de1a;_0x26e207=0xc8;}else{_0x26e207=0xce;}_0xd65fde[_0x32ef('0x2a')](_0x26e207);return _0xd65fde[_0x32ef('0x2e')](_0x32ef('0x2f'),_0x3c569d+'-'+_0x30b250+'/'+_0x12de1a)[_0x32ef('0x30')](_0x5a04cd);}return null;};}function patchUpdates(_0x575f3e){return function(_0x36ac37){try{jsonpatch['apply'](_0x36ac37,_0x575f3e,!![]);}catch(_0x38bf73){return BPromise[_0x32ef('0x31')](_0x38bf73);}return _0x36ac37['save']();};}function saveUpdates(_0xcc2efb,_0x17e4d1){return function(_0x3b00ad){if(_0x3b00ad){return _0x3b00ad[_0x32ef('0x32')](_0xcc2efb)[_0x32ef('0x20')](function(_0x59a4a3){return _0x59a4a3;});}return null;};}function removeEntity(_0x50ecd6,_0x2a5eb5){return function(_0x5dadf7){if(_0x5dadf7){return _0x5dadf7[_0x32ef('0x33')]()[_0x32ef('0x20')](function(){_0x50ecd6[_0x32ef('0x2a')](0xcc)[_0x32ef('0x2b')]();});}};}function handleEntityNotFound(_0x389583,_0x22fa1a){return function(_0x566b56){if(!_0x566b56){_0x389583['sendStatus'](0x194);}return _0x566b56;};}function handleError(_0x484ad7,_0x2261a6){_0x2261a6=_0x2261a6||0x1f4;return function(_0x3c4651){logger[_0x32ef('0x25')](_0x3c4651['stack']);if(_0x3c4651['name']){delete _0x3c4651[_0x32ef('0x34')];}_0x484ad7[_0x32ef('0x2a')](_0x2261a6)[_0x32ef('0x35')](_0x3c4651);};}exports['index']=function(_0x4abbd6,_0xcbdec8){var _0x21706f={},_0x3ed1b0={},_0x1415ef={'count':0x0,'rows':[]};var _0x3a7c49=_[_0x32ef('0x36')](db[_0x32ef('0x37')][_0x32ef('0x38')],function(_0x7f2319){return{'name':_0x7f2319['fieldName'],'type':_0x7f2319[_0x32ef('0x39')][_0x32ef('0x3a')]};});_0x3ed1b0[_0x32ef('0x3b')]=_['map'](_0x3a7c49,_0x32ef('0x34'));_0x3ed1b0[_0x32ef('0x3c')]=_[_0x32ef('0x3d')](_0x4abbd6[_0x32ef('0x3c')]);_0x3ed1b0[_0x32ef('0x3e')]=_[_0x32ef('0x3f')](_0x3ed1b0[_0x32ef('0x3b')],_0x3ed1b0[_0x32ef('0x3c')]);_0x21706f[_0x32ef('0x40')]=_[_0x32ef('0x3f')](_0x3ed1b0[_0x32ef('0x3b')],qs[_0x32ef('0x41')](_0x4abbd6['query'][_0x32ef('0x41')]));_0x21706f[_0x32ef('0x40')]=_0x21706f[_0x32ef('0x40')][_0x32ef('0x42')]?_0x21706f[_0x32ef('0x40')]:_0x3ed1b0[_0x32ef('0x3b')];if(!_0x4abbd6[_0x32ef('0x3c')]['hasOwnProperty']('nolimit')){_0x21706f[_0x32ef('0x2d')]=qs[_0x32ef('0x2d')](_0x4abbd6[_0x32ef('0x3c')][_0x32ef('0x2d')]);_0x21706f['offset']=qs[_0x32ef('0x2c')](_0x4abbd6[_0x32ef('0x3c')]['offset']);}_0x21706f[_0x32ef('0x43')]=qs['sort'](_0x4abbd6[_0x32ef('0x3c')][_0x32ef('0x44')]);_0x21706f[_0x32ef('0x45')]=qs[_0x32ef('0x3e')](_[_0x32ef('0x46')](_0x4abbd6[_0x32ef('0x3c')],_0x3ed1b0[_0x32ef('0x3e')]),_0x3a7c49);if(_0x4abbd6[_0x32ef('0x3c')][_0x32ef('0x47')]){_0x21706f[_0x32ef('0x45')]=_['merge'](_0x21706f[_0x32ef('0x45')],{'$or':_['map'](_0x3a7c49,function(_0xfe9f16){if(_0xfe9f16[_0x32ef('0x39')]!==_0x32ef('0x48')){var _0x4d8393={};_0x4d8393[_0xfe9f16[_0x32ef('0x34')]]={'$like':'%'+_0x4abbd6[_0x32ef('0x3c')][_0x32ef('0x47')]+'%'};return _0x4d8393;}})});}_0x21706f=_[_0x32ef('0x49')]({},_0x21706f,_0x4abbd6[_0x32ef('0x4a')]);var _0x40bf12={'where':_0x21706f[_0x32ef('0x45')]};return db['WhatsappMessage']['count'](_0x40bf12)[_0x32ef('0x20')](function(_0x270826){_0x1415ef[_0x32ef('0x4b')]=_0x270826;if(_0x4abbd6[_0x32ef('0x3c')][_0x32ef('0x4c')]){_0x21706f[_0x32ef('0x4d')]=[{'all':!![]}];}return db[_0x32ef('0x37')][_0x32ef('0x4e')](_0x21706f);})[_0x32ef('0x20')](function(_0x1ebedf){_0x1415ef[_0x32ef('0x4f')]=_0x1ebedf;return _0x1415ef;})[_0x32ef('0x20')](respondWithFilteredResult(_0xcbdec8,_0x21706f))[_0x32ef('0x50')](handleError(_0xcbdec8,null));};exports['show']=function(_0x420f00,_0x12fbd7){var _0x2837ee={'raw':!![],'where':{'id':_0x420f00[_0x32ef('0x51')]['id']}},_0xd42609={};_0xd42609[_0x32ef('0x3b')]=_[_0x32ef('0x3d')](db[_0x32ef('0x37')][_0x32ef('0x38')]);_0xd42609[_0x32ef('0x3c')]=_[_0x32ef('0x3d')](_0x420f00[_0x32ef('0x3c')]);_0xd42609[_0x32ef('0x3e')]=_[_0x32ef('0x3f')](_0xd42609[_0x32ef('0x3b')],_0xd42609[_0x32ef('0x3c')]);_0x2837ee[_0x32ef('0x40')]=_[_0x32ef('0x3f')](_0xd42609['model'],qs['fields'](_0x420f00[_0x32ef('0x3c')][_0x32ef('0x41')]));_0x2837ee[_0x32ef('0x40')]=_0x2837ee[_0x32ef('0x40')][_0x32ef('0x42')]?_0x2837ee[_0x32ef('0x40')]:_0xd42609[_0x32ef('0x3b')];if(_0x420f00[_0x32ef('0x3c')][_0x32ef('0x4c')]){_0x2837ee[_0x32ef('0x4d')]=[{'all':!![]}];}_0x2837ee=_[_0x32ef('0x49')]({},_0x2837ee,_0x420f00['options']);return db[_0x32ef('0x37')][_0x32ef('0x52')](_0x2837ee)[_0x32ef('0x20')](handleEntityNotFound(_0x12fbd7,null))[_0x32ef('0x20')](respondWithResult(_0x12fbd7,null))[_0x32ef('0x50')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x53')]=function(_0x52c588,_0x44a4e9){return db[_0x32ef('0x37')][_0x32ef('0x53')](_0x52c588['body'],{})[_0x32ef('0x20')](respondWithResult(_0x44a4e9,0xc9))['catch'](handleError(_0x44a4e9,null));};exports[_0x32ef('0x32')]=function(_0xbe35b,_0x579bc1){if(_0xbe35b[_0x32ef('0x54')]['id']){delete _0xbe35b['body']['id'];}return db[_0x32ef('0x37')][_0x32ef('0x52')]({'where':{'id':_0xbe35b[_0x32ef('0x51')]['id']}})[_0x32ef('0x20')](handleEntityNotFound(_0x579bc1,null))[_0x32ef('0x20')](saveUpdates(_0xbe35b[_0x32ef('0x54')],null))[_0x32ef('0x20')](respondWithResult(_0x579bc1,null))['catch'](handleError(_0x579bc1,null));};exports['destroy']=function(_0xdfa103,_0x52232a){return db['WhatsappMessage'][_0x32ef('0x52')]({'where':{'id':_0xdfa103[_0x32ef('0x51')]['id']}})[_0x32ef('0x20')](handleEntityNotFound(_0x52232a,null))[_0x32ef('0x20')](removeEntity(_0x52232a,null))[_0x32ef('0x50')](handleError(_0x52232a,null));};exports[_0x32ef('0x55')]=function(_0x316547,_0x4249c3){return db[_0x32ef('0x37')][_0x32ef('0x55')]()['then'](respondWithResult(_0x4249c3,null))['catch'](handleError(_0x4249c3,null));};var interaction_log=require(_0x32ef('0x15'))(_0x32ef('0x56'));exports['accept']=function(_0xda1d1,_0x12e1ef,_0x2b5703){var _0x49c245={'channel':_0x32ef('0x57')};if(_0xda1d1[_0x32ef('0x54')]['id']){delete _0xda1d1[_0x32ef('0x54')]['id'];}_0xda1d1['body']['read']=!![];_0xda1d1[_0x32ef('0x54')]['readAt']=moment()[_0x32ef('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0xda1d1['body'][_0x32ef('0x59')]=_0xda1d1[_0x32ef('0x54')][_0x32ef('0x59')]||_0xda1d1['user']['id'];return db[_0x32ef('0x37')][_0x32ef('0x52')]({'where':{'id':_0xda1d1[_0x32ef('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x32ef('0x5a')}]})[_0x32ef('0x20')](handleEntityNotFound(_0x12e1ef,null))['then'](saveUpdates(_0xda1d1['body'],null))[_0x32ef('0x20')](function(_0x3a6697){if(_0x3a6697){_0x49c245[_0x32ef('0x27')]=_0x3a6697[_0x32ef('0x5b')]({'plain':!![]});return db[_0x32ef('0x5c')][_0x32ef('0x52')]({'where':{'id':_0x3a6697['WhatsappInteractionId']}});}return null;})[_0x32ef('0x20')](handleEntityNotFound(_0x12e1ef,null))[_0x32ef('0x20')](function(_0x25b6d6){if(_0x25b6d6){return _0x25b6d6[_0x32ef('0x32')]({'UserId':_0xda1d1[_0x32ef('0x54')][_0x32ef('0x59')],'read1stAt':_[_0x32ef('0x5d')](_0x25b6d6[_0x32ef('0x5e')])?moment()[_0x32ef('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x32ef('0x20')](function(_0x29ff58){if(_0x29ff58){_0x49c245[_0x32ef('0x5f')]=_0x29ff58[_0x32ef('0x5b')]({'plain':!![]});interaction_log[_0x32ef('0x28')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xda1d1['user']['id'],_0xda1d1[_0x32ef('0x60')][_0x32ef('0x34')],_0xda1d1[_0x32ef('0x60')][_0x32ef('0x61')],_0x49c245[_0x32ef('0x5f')]['id'],_0xda1d1['body']?JSON[_0x32ef('0x24')](_0xda1d1['body']):_0x32ef('0x62'));return respondWithRpcPromise(_0x32ef('0x63'),'acceptMessage',_0x49c245);}return null;})['then'](function(_0x2c9f7a){if(_0x2c9f7a){if(_0xda1d1[_0x32ef('0x54')][_0x32ef('0x64')]){_0x49c245['message']['interface']=util[_0x32ef('0x58')](_0x32ef('0x65'),_0xda1d1[_0x32ef('0x60')][_0x32ef('0x34')]);_0x49c245['message'][_0x32ef('0x66')]=_0x49c245[_0x32ef('0x66')];_0x49c245[_0x32ef('0x27')][_0x32ef('0x67')]=_0x32ef('0x68');return respondWithRpcPromise(_0x32ef('0x69'),_0x32ef('0x69'),{'event':_0x32ef('0x6a'),'message':_0x49c245[_0x32ef('0x27')]},client9002)[_0x32ef('0x20')](function(){return _0x49c245;});}return _0x49c245;}return null;})[_0x32ef('0x20')](respondWithResult(_0x12e1ef,null))[_0x32ef('0x50')](handleError(_0x12e1ef,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x32ef('0x31')]=function(_0x3c0b29,_0x57a40e,_0x3a4be1){var _0x5b3e58={'agent':{},'channel':_0x32ef('0x57')};if(_0x3c0b29[_0x32ef('0x54')]['id']){delete _0x3c0b29[_0x32ef('0x54')]['id'];}_0x3c0b29['body'][_0x32ef('0x59')]=_0x3c0b29['body'][_0x32ef('0x59')]||_0x3c0b29[_0x32ef('0x60')]['id'];_0x5b3e58['agent']['id']=_0x3c0b29['body'][_0x32ef('0x59')];return db['WhatsappMessage'][_0x32ef('0x52')]({'where':{'id':_0x3c0b29['params']['id'],'UserId':null}})[_0x32ef('0x20')](handleEntityNotFound(_0x57a40e,null))[_0x32ef('0x20')](function(_0x1adcb8){if(_0x1adcb8){_0x5b3e58['message']=_0x1adcb8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x32ef('0x52')]({'where':{'id':_0x1adcb8['WhatsappInteractionId']}});}return null;})[_0x32ef('0x20')](handleEntityNotFound(_0x57a40e,null))[_0x32ef('0x20')](function(_0x281541){if(_0x281541){_0x5b3e58[_0x32ef('0x5f')]=_0x281541[_0x32ef('0x5b')]({'plain':!![]});interaction_log[_0x32ef('0x28')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c0b29[_0x32ef('0x60')]['id'],_0x3c0b29['user']['name'],_0x3c0b29[_0x32ef('0x60')]['role'],_0x5b3e58[_0x32ef('0x5f')]['id'],_0x3c0b29[_0x32ef('0x54')]?JSON['stringify'](_0x3c0b29[_0x32ef('0x54')]):_0x32ef('0x62'));return respondWithRpcPromise(_0x32ef('0x6b'),_0x32ef('0x6c'),_0x5b3e58);}return null;})[_0x32ef('0x20')](function(_0x247e88){if(_0x247e88){_0x247e88['message']['interface']=util[_0x32ef('0x58')]('SIP/%s',_0x3c0b29[_0x32ef('0x60')][_0x32ef('0x34')]);_0x247e88[_0x32ef('0x27')][_0x32ef('0x66')]=_0x5b3e58[_0x32ef('0x66')];_0x247e88[_0x32ef('0x27')]['event']=_0x32ef('0x31');respondWithRpcPromise(_0x32ef('0x69'),_0x32ef('0x69'),{'event':_0x32ef('0x6d'),'message':_0x247e88[_0x32ef('0x27')]},client9002);return _0x5b3e58;}return null;})['then'](respondWithResult(_0x57a40e,null))['catch'](handleError(_0x57a40e,null));};exports[_0x32ef('0x2a')]=function(_0x904a4f,_0x54d7ea,_0x211fb1){if(_0x904a4f[_0x32ef('0x54')]['id']){delete _0x904a4f[_0x32ef('0x54')]['id'];}var _0xd2ff54;return db[_0x32ef('0x37')][_0x32ef('0x52')]({'where':{'id':_0x904a4f[_0x32ef('0x51')]['id']}})[_0x32ef('0x20')](handleEntityNotFound(_0x54d7ea,null))[_0x32ef('0x20')](function(_0x54e65d){if(_0x54e65d){_0xd2ff54=_0x54e65d;return db[_0x32ef('0x6e')][_0x32ef('0x52')]({'where':{'id':_0x54e65d['WhatsappAccountId']}});}})[_0x32ef('0x20')](handleEntityNotFound(_0x54d7ea,null))['then'](function(_0x18f96c){if(_0x18f96c){logger['debug'](_0x32ef('0x6f'),_0x32ef('0x2a'),_0x32ef('0x70'),_0x18f96c[_0x32ef('0x39')],util['inspect'](_0x904a4f[_0x32ef('0x54')],{'showHidden':![],'depth':null}));switch(_0x18f96c[_0x32ef('0x39')]){case _0x32ef('0x71'):if(_0x904a4f['body']['MessageSid']&&_0x904a4f['body'][_0x32ef('0x72')]===_0xd2ff54[_0x32ef('0x73')]&&_0x904a4f[_0x32ef('0x54')][_0x32ef('0x74')]&&_0x904a4f[_0x32ef('0x54')]['MessageStatus']===_0x32ef('0x75')){return _0xd2ff54['update']({'read':!![]});}else{logger[_0x32ef('0x25')](_0x32ef('0x76'),_0x32ef('0x2a'),'twilio',util[_0x32ef('0x77')](_0x904a4f[_0x32ef('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xd2ff54;}})[_0x32ef('0x20')](respondWithResult(_0x54d7ea,null))[_0x32ef('0x50')](handleError(_0x54d7ea,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0957508..d888c8b 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x27e3d4,_0x4a8950){var _0x35d3c5=function(_0x17ad3b){while(--_0x17ad3b){_0x27e3d4['push'](_0x27e3d4['shift']());}};_0x35d3c5(++_0x4a8950);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4da6a3,_0x15f71c){_0x4da6a3=_0x4da6a3-0x0;var _0xd252a6=_0x5f2f[_0x4da6a3];return _0xd252a6;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x443789,_0x4dabb9){var _0x24578e=function(_0x27d375){while(--_0x27d375){_0x443789['push'](_0x443789['shift']());}};_0x24578e(++_0x4dabb9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53c310,_0xb729e7){_0x53c310=_0x53c310-0x0;var _0x458b62=_0x5f2f[_0x53c310];return _0x458b62;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e5f00fa..4f60f69 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 _0x3044=['body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','error','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','api','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','out','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','toLowerCase','catch','secret','WhatsappAccount','type','twilio','accountSid','authToken','messages','create'];(function(_0x134798,_0xd30a2e){var _0x58f124=function(_0x211fcd){while(--_0x211fcd){_0x134798['push'](_0x134798['shift']());}};_0x58f124(++_0xd30a2e);}(_0x3044,0xfa));var _0x4304=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x3044[_0x1cd47d];return _0x29d52f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4304('0x0'));var moment=require('moment');var BPromise=require(_0x4304('0x1'));var rp=require(_0x4304('0x2'));var fs=require('fs');var path=require(_0x4304('0x3'));var rimraf=require(_0x4304('0x4'));var config=require('../../config/environment');var attributes=require(_0x4304('0x5'));module['exports']=function(_0x131043,_0x585971){return _0x131043[_0x4304('0x6')](_0x4304('0x7'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x4304('0x8'),'fields':[_0x4304('0x8')]},{'name':_0x4304('0x9'),'fields':['body'],'type':_0x4304('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x477c27,_0xf3fd89,_0x248ae5){var _0x93e562=_0x131043[_0x4304('0xb')];var _0x42bc98=_0x477c27[_0x4304('0xc')]({'plain':!![]});if(_0x42bc98[_0x4304('0xd')]['toLowerCase']()==='in'||_0x42bc98[_0x4304('0xd')]['toLowerCase']()===_0x4304('0xe')&&!_0x42bc98['secret']&&!_[_0x4304('0xf')](_0x42bc98[_0x4304('0x10')])){_0x93e562[_0x4304('0x11')]['findOne']({'where':{'id':_0x42bc98[_0x4304('0x12')]}})[_0x4304('0x13')](function(_0x3daa3d){if(_0x3daa3d){_0x3daa3d[_0x4304('0x14')]({'lastMsgAt':_0x42bc98[_0x4304('0x15')],'lastMsgDirection':_0x42bc98[_0x4304('0xd')][_0x4304('0x16')]()});}})[_0x4304('0x17')](function(_0x1d3bd2){console['error'](_0x1d3bd2);});}if(_0x42bc98['direction']==='out'&&!_0x42bc98[_0x4304('0x18')]){var _0x1cb2da;_0x93e562[_0x4304('0x19')]['find']({'where':{'id':_0x42bc98['WhatsappAccountId']},'raw':!![]})[_0x4304('0x13')](function(_0x10fc7d){_0x1cb2da=_0x10fc7d;if(_0x1cb2da&&_0x1cb2da['type']){switch(_0x1cb2da[_0x4304('0x1a')]){case _0x4304('0x1b'):var _0x275962=require(_0x4304('0x1b'));if(_0x1cb2da[_0x4304('0x1c')]&&_0x1cb2da[_0x4304('0x1d')]&&_0x1cb2da['phone']){var _0x225ce9=new _0x275962(_0x1cb2da[_0x4304('0x1c')],_0x1cb2da['authToken']);_0x225ce9[_0x4304('0x1e')][_0x4304('0x1f')]({'body':_0x42bc98[_0x4304('0x20')],'to':_0x4304('0x21')+_0x42bc98[_0x4304('0x22')],'from':_0x4304('0x21')+_0x1cb2da['phone'],'statusCallback':_0x1cb2da[_0x4304('0x23')]+_0x4304('0x24')+_0x42bc98['id']+_0x4304('0x25')+_0x1cb2da['token']})[_0x4304('0x13')](function(_0xc57d93){if(_0xc57d93['sid']){return _0x477c27[_0x4304('0x14')]({'messageId':_0xc57d93[_0x4304('0x26')]});}})['catch'](function(_0x5d8d7b){logger['error'](_0x4304('0x27'),'afterCreate',_0x4304('0x1b'),util[_0x4304('0x28')](_0x5d8d7b,{'showHidden':![],'depth':null}));});}else{logger[_0x4304('0x29')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4304('0x2a'),_0x4304('0x1b'),_0x4304('0x2b'));}break;}}})[_0x4304('0x2c')](function(){_0x248ae5();});}else{_0x248ae5();}}},'charset':_0x4304('0x2d'),'collate':_0x4304('0x2e')});}; \ No newline at end of file +var _0x06a6=['then','update','createdAt','error','WhatsappAccount','find','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x06a6,0xa9));var _0x606a=function(_0x30c3c2,_0x330cca){_0x30c3c2=_0x30c3c2-0x0;var _0x738110=_0x06a6[_0x30c3c2];return _0x738110;};'use strict';var _=require(_0x606a('0x0'));var util=require(_0x606a('0x1'));var logger=require(_0x606a('0x2'))(_0x606a('0x3'));var moment=require(_0x606a('0x4'));var BPromise=require(_0x606a('0x5'));var rp=require(_0x606a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x606a('0x7'));var config=require(_0x606a('0x8'));var attributes=require(_0x606a('0x9'));module[_0x606a('0xa')]=function(_0x3bdb40,_0x18d8c9){return _0x3bdb40['define'](_0x606a('0xb'),attributes,{'tableName':_0x606a('0xc'),'paranoid':![],'indexes':[{'name':_0x606a('0xd'),'fields':[_0x606a('0xd')]},{'name':_0x606a('0xe'),'fields':[_0x606a('0xf')],'type':_0x606a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ed044,_0x5879a2,_0x4e8174){var _0x308d72=_0x3bdb40[_0x606a('0x11')];var _0x2b1b1f=_0x5ed044[_0x606a('0x12')]({'plain':!![]});if(_0x2b1b1f[_0x606a('0x13')][_0x606a('0x14')]()==='in'||_0x2b1b1f[_0x606a('0x13')][_0x606a('0x14')]()===_0x606a('0x15')&&!_0x2b1b1f[_0x606a('0x16')]&&!_[_0x606a('0x17')](_0x2b1b1f[_0x606a('0x18')])){_0x308d72[_0x606a('0x19')]['findOne']({'where':{'id':_0x2b1b1f[_0x606a('0x1a')]}})[_0x606a('0x1b')](function(_0xe33579){if(_0xe33579){_0xe33579[_0x606a('0x1c')]({'lastMsgAt':_0x2b1b1f[_0x606a('0x1d')],'lastMsgDirection':_0x2b1b1f[_0x606a('0x13')][_0x606a('0x14')]()});}})['catch'](function(_0x2b1bf5){console[_0x606a('0x1e')](_0x2b1bf5);});}if(_0x2b1b1f[_0x606a('0x13')]==='out'&&!_0x2b1b1f['secret']){var _0x392981;_0x308d72[_0x606a('0x1f')][_0x606a('0x20')]({'where':{'id':_0x2b1b1f['WhatsappAccountId']},'raw':!![]})['then'](function(_0x224790){_0x392981=_0x224790;if(_0x392981&&_0x392981['type']){switch(_0x392981['type']){case _0x606a('0x21'):var _0x5c2f1d=require(_0x606a('0x21'));if(_0x392981[_0x606a('0x22')]&&_0x392981[_0x606a('0x23')]&&_0x392981[_0x606a('0x24')]){var _0x7a0c7d=new _0x5c2f1d(_0x392981['accountSid'],_0x392981[_0x606a('0x23')]);_0x7a0c7d[_0x606a('0x25')][_0x606a('0x26')]({'body':_0x2b1b1f[_0x606a('0xf')],'to':'whatsapp:'+_0x2b1b1f['phone'],'from':'whatsapp:'+_0x392981[_0x606a('0x24')],'statusCallback':_0x392981[_0x606a('0x27')]+'/api/whatsapp/messages/'+_0x2b1b1f['id']+_0x606a('0x28')+_0x392981[_0x606a('0x29')]})['then'](function(_0x54cc61){if(_0x54cc61[_0x606a('0x2a')]){return _0x5ed044[_0x606a('0x1c')]({'messageId':_0x54cc61[_0x606a('0x2a')]});}})[_0x606a('0x2b')](function(_0x263ae2){logger[_0x606a('0x1e')](_0x606a('0x2c'),_0x606a('0x2d'),_0x606a('0x21'),util[_0x606a('0x2e')](_0x263ae2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x606a('0x2c'),_0x606a('0x2d'),_0x606a('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x606a('0x2f')](function(){_0x4e8174();});}else{_0x4e8174();}}},'charset':'utf8mb4','collate':_0x606a('0x30')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cc5f655..d177484 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 _0xc7b3=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info'];(function(_0x472072,_0x46dec7){var _0x347687=function(_0x3a96b5){while(--_0x3a96b5){_0x472072['push'](_0x472072['shift']());}};_0x347687(++_0x46dec7);}(_0xc7b3,0xfe));var _0x3c7b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc7b3[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3c7b('0x0'));var util=require('util');var moment=require(_0x3c7b('0x1'));var BPromise=require(_0x3c7b('0x2'));var rs=require(_0x3c7b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c7b('0x5'));var config=require(_0x3c7b('0x6'));var jayson=require(_0x3c7b('0x7'));var client=jayson[_0x3c7b('0x8')][_0x3c7b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3c7b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c7b('0xb'))(new Redis(config['redis']));require(_0x3c7b('0xc'))[_0x3c7b('0xd')](socket);function respondWithRpcPromise(_0x4dc8e7,_0x4128a1,_0x1b365c){return new BPromise(function(_0x313496,_0x390b8d){return client[_0x3c7b('0xe')](_0x4dc8e7,_0x1b365c)[_0x3c7b('0xf')](function(_0x1dff0b){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4128a1,_0x3c7b('0x10'));logger[_0x3c7b('0x11')](_0x3c7b('0x12'),_0x4128a1,_0x3c7b('0x10'),JSON[_0x3c7b('0x13')](_0x1dff0b));if(_0x1dff0b['error']){if(_0x1dff0b[_0x3c7b('0x14')][_0x3c7b('0x15')]===0x1f4){logger[_0x3c7b('0x14')](_0x3c7b('0x16'),_0x4128a1,_0x1dff0b['error']['message']);return _0x390b8d(_0x1dff0b['error'][_0x3c7b('0x17')]);}logger['error'](_0x3c7b('0x16'),_0x4128a1,_0x1dff0b[_0x3c7b('0x14')][_0x3c7b('0x17')]);return _0x313496(_0x1dff0b[_0x3c7b('0x14')][_0x3c7b('0x17')]);}else{logger[_0x3c7b('0x18')](_0x3c7b('0x16'),_0x4128a1,_0x3c7b('0x10'));_0x313496(_0x1dff0b['result'][_0x3c7b('0x17')]);}})[_0x3c7b('0x19')](function(_0x4a3ee8){logger['error'](_0x3c7b('0x16'),_0x4128a1,_0x4a3ee8);_0x390b8d(_0x4a3ee8);});});}exports[_0x3c7b('0x1a')]=function(_0x48104d){var _0x23b7e8=this;return new Promise(function(_0x1cf224,_0x3dae5b){return db[_0x3c7b('0x1b')][_0x3c7b('0x1c')](_0x48104d[_0x3c7b('0x1d')],{'raw':_0x48104d['options']?_0x48104d[_0x3c7b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x3c7b('0xf')](function(_0x55ee24){logger['info']('CreateWhatsappMessage',_0x48104d);logger[_0x3c7b('0x11')](_0x3c7b('0x1a'),_0x48104d,JSON[_0x3c7b('0x13')](_0x55ee24));_0x1cf224(_0x55ee24);})[_0x3c7b('0x19')](function(_0x54996d){logger[_0x3c7b('0x14')]('CreateWhatsappMessage',_0x54996d[_0x3c7b('0x17')],_0x48104d);_0x3dae5b(_0x23b7e8['error'](0x1f4,_0x54996d[_0x3c7b('0x17')]));});});}; \ No newline at end of file +var _0x3b4b=['result','CreateWhatsappMessage','WhatsappMessage','create','body','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x16cdf1,_0x4795b3){var _0x15bb81=function(_0x1b3037){while(--_0x1b3037){_0x16cdf1['push'](_0x16cdf1['shift']());}};_0x15bb81(++_0x4795b3);}(_0x3b4b,0xd8));var _0xb3b4=function(_0x37b026,_0x58571d){_0x37b026=_0x37b026-0x0;var _0x3c240f=_0x3b4b[_0x37b026];return _0x3c240f;};'use strict';var _=require('lodash');var util=require(_0xb3b4('0x0'));var moment=require('moment');var BPromise=require(_0xb3b4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3b4('0x2'));var db=require(_0xb3b4('0x3'))['db'];var utils=require(_0xb3b4('0x4'));var logger=require(_0xb3b4('0x5'))(_0xb3b4('0x6'));var config=require(_0xb3b4('0x7'));var jayson=require(_0xb3b4('0x8'));var client=jayson['client'][_0xb3b4('0x9')]({'port':0x232a});config[_0xb3b4('0xa')]=_[_0xb3b4('0xb')](config[_0xb3b4('0xa')],{'host':_0xb3b4('0xc'),'port':0x18eb});var socket=require(_0xb3b4('0xd'))(new Redis(config[_0xb3b4('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x23e7ff,_0x342254,_0x5d7ec2){return new BPromise(function(_0x544646,_0x3cc733){return client[_0xb3b4('0xe')](_0x23e7ff,_0x5d7ec2)['then'](function(_0x4bc44b){logger[_0xb3b4('0xf')](_0xb3b4('0x10'),_0x342254,_0xb3b4('0x11'));logger[_0xb3b4('0x12')](_0xb3b4('0x13'),_0x342254,_0xb3b4('0x11'),JSON[_0xb3b4('0x14')](_0x4bc44b));if(_0x4bc44b[_0xb3b4('0x15')]){if(_0x4bc44b[_0xb3b4('0x15')][_0xb3b4('0x16')]===0x1f4){logger[_0xb3b4('0x15')](_0xb3b4('0x10'),_0x342254,_0x4bc44b[_0xb3b4('0x15')][_0xb3b4('0x17')]);return _0x3cc733(_0x4bc44b[_0xb3b4('0x15')]['message']);}logger['error'](_0xb3b4('0x10'),_0x342254,_0x4bc44b[_0xb3b4('0x15')]['message']);return _0x544646(_0x4bc44b[_0xb3b4('0x15')][_0xb3b4('0x17')]);}else{logger[_0xb3b4('0xf')](_0xb3b4('0x10'),_0x342254,_0xb3b4('0x11'));_0x544646(_0x4bc44b[_0xb3b4('0x18')][_0xb3b4('0x17')]);}})['catch'](function(_0xfb1366){logger['error'](_0xb3b4('0x10'),_0x342254,_0xfb1366);_0x3cc733(_0xfb1366);});});}exports[_0xb3b4('0x19')]=function(_0x3b7760){var _0x4e6797=this;return new Promise(function(_0x12f5eb,_0x1aabff){return db[_0xb3b4('0x1a')][_0xb3b4('0x1b')](_0x3b7760[_0xb3b4('0x1c')],{'raw':_0x3b7760['options']?_0x3b7760['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x39950d){logger['info']('CreateWhatsappMessage',_0x3b7760);logger[_0xb3b4('0x12')](_0xb3b4('0x19'),_0x3b7760,JSON[_0xb3b4('0x14')](_0x39950d));_0x12f5eb(_0x39950d);})[_0xb3b4('0x1d')](function(_0x362710){logger['error']('CreateWhatsappMessage',_0x362710[_0xb3b4('0x17')],_0x3b7760);_0x1aabff(_0x4e6797['error'](0x1f4,_0x362710['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 72ec343..99bd887 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 _0x98d5=['whatsappMessage:','./whatsappMessage.events','update','emit','removeListener'];(function(_0x5e9b99,_0x1640e4){var _0x460e6d=function(_0x5f0204){while(--_0x5f0204){_0x5e9b99['push'](_0x5e9b99['shift']());}};_0x460e6d(++_0x1640e4);}(_0x98d5,0xfb));var _0x598d=function(_0x163e94,_0x48d15c){_0x163e94=_0x163e94-0x0;var _0x11101d=_0x98d5[_0x163e94];return _0x11101d;};'use strict';var WhatsappMessageEvents=require(_0x598d('0x0'));var events=['save','remove',_0x598d('0x1')];function createListener(_0x3f371e,_0xb5c285){return function(_0x281a63){_0xb5c285[_0x598d('0x2')](_0x3f371e,_0x281a63);};}function removeListener(_0x3890f3,_0x2a3fe3){return function(){WhatsappMessageEvents[_0x598d('0x3')](_0x3890f3,_0x2a3fe3);};}exports['register']=function(_0x334640){for(var _0x49368d=0x0,_0x286d2a=events['length'];_0x49368d<_0x286d2a;_0x49368d++){var _0x4de6f3=events[_0x49368d];var _0x26d1cb=createListener(_0x598d('0x4')+_0x4de6f3,_0x334640);WhatsappMessageEvents['on'](_0x4de6f3,_0x26d1cb);}}; \ No newline at end of file +var _0x4ce5=['emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x36aff7,_0x57d515){var _0x581def=function(_0x376bfa){while(--_0x376bfa){_0x36aff7['push'](_0x36aff7['shift']());}};_0x581def(++_0x57d515);}(_0x4ce5,0xf9));var _0x54ce=function(_0x395663,_0x10e46f){_0x395663=_0x395663-0x0;var _0x3fb829=_0x4ce5[_0x395663];return _0x3fb829;};'use strict';var WhatsappMessageEvents=require(_0x54ce('0x0'));var events=['save',_0x54ce('0x1'),_0x54ce('0x2')];function createListener(_0x47683b,_0x56dce0){return function(_0x4f8000){_0x56dce0[_0x54ce('0x3')](_0x47683b,_0x4f8000);};}function removeListener(_0x32c992,_0x242a43){return function(){WhatsappMessageEvents[_0x54ce('0x4')](_0x32c992,_0x242a43);};}exports['register']=function(_0x291f0b){for(var _0x4316ab=0x0,_0x13446a=events[_0x54ce('0x5')];_0x4316ab<_0x13446a;_0x4316ab++){var _0x2a7fa1=events[_0x4316ab];var _0xc1db84=createListener(_0x54ce('0x6')+_0x2a7fa1,_0x291f0b);WhatsappMessageEvents['on'](_0x2a7fa1,_0xc1db84);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e2b7d0d..2b80fe1 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 _0xce88=['describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','../../components/interaction/service','./whatsappQueue.controller','index','isAuthenticated'];(function(_0xc352bd,_0x312795){var _0x10e333=function(_0x9fc6bd){while(--_0x9fc6bd){_0xc352bd['push'](_0xc352bd['shift']());}};_0x10e333(++_0x312795);}(_0xce88,0x121));var _0x8ce8=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xce88[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x8ce8('0x0'));var util=require('util');var path=require(_0x8ce8('0x1'));var timeout=require(_0x8ce8('0x2'));var express=require(_0x8ce8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8ce8('0x4'));var config=require('../../config/environment');var controller=require(_0x8ce8('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ce8('0x6')]);router['get']('/describe',auth[_0x8ce8('0x7')](),controller[_0x8ce8('0x8')]);router[_0x8ce8('0x9')](_0x8ce8('0xa'),auth[_0x8ce8('0x7')](),controller[_0x8ce8('0xb')]);router['get'](_0x8ce8('0xc'),auth[_0x8ce8('0x7')](),controller[_0x8ce8('0xd')]);router[_0x8ce8('0x9')](_0x8ce8('0xe'),auth['isAuthenticated'](),controller[_0x8ce8('0xf')]);router[_0x8ce8('0x9')]('/:id/users',auth[_0x8ce8('0x7')](),controller[_0x8ce8('0x10')]);router[_0x8ce8('0x11')]('/',auth['isAuthenticated'](),controller[_0x8ce8('0x12')]);router['post'](_0x8ce8('0xe'),auth[_0x8ce8('0x7')](),controller[_0x8ce8('0x13')]);router[_0x8ce8('0x11')](_0x8ce8('0x14'),auth[_0x8ce8('0x7')](),controller[_0x8ce8('0x15')]);router[_0x8ce8('0x16')](_0x8ce8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8ce8('0x17')]('/:id',auth[_0x8ce8('0x7')](),controller[_0x8ce8('0x18')]);router[_0x8ce8('0x17')]('/:id/teams',auth[_0x8ce8('0x7')](),controller['removeTeams']);router[_0x8ce8('0x17')](_0x8ce8('0x14'),auth['isAuthenticated'](),controller[_0x8ce8('0x19')]);module[_0x8ce8('0x1a')]=router; \ No newline at end of file +var _0xf7a3=['../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xf7a3,0x1c4));var _0x3f7a=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0xf7a3[_0x1e05c1];return _0x15f1ca;};'use strict';var multer=require(_0x3f7a('0x0'));var util=require(_0x3f7a('0x1'));var path=require('path');var timeout=require(_0x3f7a('0x2'));var express=require(_0x3f7a('0x3'));var router=express[_0x3f7a('0x4')]();var auth=require(_0x3f7a('0x5'));var interaction=require(_0x3f7a('0x6'));var config=require(_0x3f7a('0x7'));var controller=require(_0x3f7a('0x8'));router[_0x3f7a('0x9')]('/',auth[_0x3f7a('0xa')](),controller['index']);router[_0x3f7a('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3f7a('0xb')]);router[_0x3f7a('0x9')](_0x3f7a('0xc'),auth[_0x3f7a('0xa')](),controller[_0x3f7a('0xd')]);router['get']('/:id/members',auth[_0x3f7a('0xa')](),controller['getMembers']);router[_0x3f7a('0x9')](_0x3f7a('0xe'),auth[_0x3f7a('0xa')](),controller['getTeams']);router['get'](_0x3f7a('0xf'),auth[_0x3f7a('0xa')](),controller[_0x3f7a('0x10')]);router[_0x3f7a('0x11')]('/',auth[_0x3f7a('0xa')](),controller['create']);router[_0x3f7a('0x11')](_0x3f7a('0xe'),auth['isAuthenticated'](),controller[_0x3f7a('0x12')]);router[_0x3f7a('0x11')](_0x3f7a('0xf'),auth[_0x3f7a('0xa')](),controller[_0x3f7a('0x13')]);router[_0x3f7a('0x14')](_0x3f7a('0xc'),auth['isAuthenticated'](),controller[_0x3f7a('0x15')]);router['delete']('/:id',auth[_0x3f7a('0xa')](),controller[_0x3f7a('0x16')]);router[_0x3f7a('0x17')](_0x3f7a('0xe'),auth[_0x3f7a('0xa')](),controller[_0x3f7a('0x18')]);router[_0x3f7a('0x17')](_0x3f7a('0xf'),auth[_0x3f7a('0xa')](),controller[_0x3f7a('0x19')]);module[_0x3f7a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 7e97aa3..f443225 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 _0xb50e=['exports','name','INTEGER','ENUM','rrmemory','beepall','STRING'];(function(_0x2a5208,_0x4b9bf8){var _0x57650c=function(_0x575109){while(--_0x575109){_0x2a5208['push'](_0x2a5208['shift']());}};_0x57650c(++_0x4b9bf8);}(_0xb50e,0xee));var _0xeb50=function(_0x2de0ab,_0x353746){_0x2de0ab=_0x2de0ab-0x0;var _0x7f8af9=_0xb50e[_0x2de0ab];return _0x7f8af9;};'use strict';var Sequelize=require('sequelize');module[_0xeb50('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xeb50('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xeb50('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb50('0x3')](_0xeb50('0x4'),_0xeb50('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xeb50('0x6')]}}; \ No newline at end of file +var _0x78f5=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x47961,_0xff82bd){var _0x798565=function(_0x21fccb){while(--_0x21fccb){_0x47961['push'](_0x47961['shift']());}};_0x798565(++_0xff82bd);}(_0x78f5,0xbc));var _0x578f=function(_0x4df0ac,_0x18f735){_0x4df0ac=_0x4df0ac-0x0;var _0x1683d7=_0x78f5[_0x4df0ac];return _0x1683d7;};'use strict';var Sequelize=require(_0x578f('0x0'));module[_0x578f('0x1')]={'name':{'type':Sequelize[_0x578f('0x2')],'unique':_0x578f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x578f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x578f('0x5')](_0x578f('0x6'),'beepall',_0x578f('0x7'))},'description':{'type':Sequelize[_0x578f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a5e3899..ffcfcba 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 _0xe406=['Agents','online','interface','transaction','each','findOrCreate','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','compact','forEach','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','count','offset','limit','set','reject','save','update','destroy','then','get','UserProfileResource','error','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','nolimit','WhatsappQueueId','options','UserId','agent','whatsappPause','createdAt','rows','format','%s/%s','updatedAt','findOne','Team','getTeams','addTeams','ids','User'];(function(_0x8d3476,_0x5bd277){var _0xda0b51=function(_0x2f33ad){while(--_0x2f33ad){_0x8d3476['push'](_0x8d3476['shift']());}};_0xda0b51(++_0x5bd277);}(_0xe406,0xa7));var _0x6e40=function(_0x172a35,_0xcc99e3){_0x172a35=_0x172a35-0x0;var _0x478fa4=_0xe406[_0x172a35];return _0x478fa4;};'use strict';var pdf=require(_0x6e40('0x0'));var emlformat=require(_0x6e40('0x1'));var rimraf=require(_0x6e40('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e40('0x3'));var rp=require('request-promise');var moment=require(_0x6e40('0x4'));var BPromise=require(_0x6e40('0x5'));var Mustache=require('mustache');var util=require(_0x6e40('0x6'));var path=require(_0x6e40('0x7'));var sox=require(_0x6e40('0x8'));var csv=require(_0x6e40('0x9'));var ejs=require(_0x6e40('0xa'));var fs=require('fs');var _=require(_0x6e40('0xb'));var squel=require('squel');var crypto=require(_0x6e40('0xc'));var jsforce=require(_0x6e40('0xd'));var deskjs=require(_0x6e40('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6e40('0xf'));var Redis=require('ioredis');var authService=require(_0x6e40('0x10'));var qs=require(_0x6e40('0x11'));var as=require(_0x6e40('0x12'));var hardwareService=require(_0x6e40('0x13'));var logger=require(_0x6e40('0x14'))(_0x6e40('0x15'));var utils=require(_0x6e40('0x16'));var config=require(_0x6e40('0x17'));var licenseUtil=require(_0x6e40('0x18'));var db=require(_0x6e40('0x19'))['db'];config[_0x6e40('0x1a')]=_[_0x6e40('0x1b')](config[_0x6e40('0x1a')],{'host':_0x6e40('0x1c'),'port':0x18eb});var socket=require(_0x6e40('0x1d'))(new Redis(config[_0x6e40('0x1a')]));require(_0x6e40('0x1e'))['register'](socket);function respondWithStatusCode(_0x132b6f,_0x2fc041){_0x2fc041=_0x2fc041||0xcc;return function(_0x555df4){if(_0x555df4){return _0x132b6f[_0x6e40('0x1f')](_0x2fc041);}return _0x132b6f[_0x6e40('0x20')](_0x2fc041)[_0x6e40('0x21')]();};}function respondWithResult(_0x196d91,_0x375a76){_0x375a76=_0x375a76||0xc8;return function(_0x172bd2){if(_0x172bd2){return _0x196d91[_0x6e40('0x20')](_0x375a76)['json'](_0x172bd2);}};}function respondWithFilteredResult(_0x2a5888,_0x160d26){return function(_0xe6a790){if(_0xe6a790){var _0x275ed4=_0xe6a790[_0x6e40('0x22')],_0x467221=_0x160d26[_0x6e40('0x23')],_0x2a0666=_0x160d26['offset']+_0x160d26[_0x6e40('0x24')],_0x52a9c7;if(_0x2a0666>=_0x275ed4){_0x2a0666=_0x275ed4;_0x52a9c7=0xc8;}else{_0x52a9c7=0xce;}_0x2a5888['status'](_0x52a9c7);return _0x2a5888[_0x6e40('0x25')]('Content-Range',_0x467221+'-'+_0x2a0666+'/'+_0x275ed4)['json'](_0xe6a790);}return null;};}function patchUpdates(_0x36008d){return function(_0x17c9e4){try{jsonpatch['apply'](_0x17c9e4,_0x36008d,!![]);}catch(_0x532467){return BPromise[_0x6e40('0x26')](_0x532467);}return _0x17c9e4[_0x6e40('0x27')]();};}function saveUpdates(_0x3d58e1,_0x2a611c){return function(_0x20f125){if(_0x20f125){return _0x20f125[_0x6e40('0x28')](_0x3d58e1)['then'](function(_0x3b9b87){return _0x3b9b87;});}return null;};}function removeEntity(_0x5f13d5,_0x10ea59){return function(_0x433723){if(_0x433723){return _0x433723[_0x6e40('0x29')]()[_0x6e40('0x2a')](function(){var _0x405e82=_0x433723[_0x6e40('0x2b')]({'plain':!![]});var _0x32aea2='WhatsappQueues';return db[_0x6e40('0x2c')][_0x6e40('0x29')]({'where':{'type':_0x32aea2,'resourceId':_0x405e82['id']}})['then'](function(){return _0x433723;});})[_0x6e40('0x2a')](function(){_0x5f13d5[_0x6e40('0x20')](0xcc)[_0x6e40('0x21')]();});}};}function handleEntityNotFound(_0x1940de,_0xe3bc81){return function(_0x558665){if(!_0x558665){_0x1940de['sendStatus'](0x194);}return _0x558665;};}function handleError(_0x26f969,_0x1883b8){_0x1883b8=_0x1883b8||0x1f4;return function(_0xeb2b21){logger[_0x6e40('0x2d')](_0xeb2b21['stack']);if(_0xeb2b21['name']){delete _0xeb2b21['name'];}_0x26f969['status'](_0x1883b8)[_0x6e40('0x2e')](_0xeb2b21);};}exports[_0x6e40('0x2f')]=function(_0x11b843,_0x3c3d33){var _0x1db6ca={},_0x5c7e29={},_0x3c02c2={'count':0x0,'rows':[]};var _0x4a2056=_[_0x6e40('0x30')](db[_0x6e40('0x31')][_0x6e40('0x32')],function(_0x5324b0){return{'name':_0x5324b0[_0x6e40('0x33')],'type':_0x5324b0[_0x6e40('0x34')][_0x6e40('0x35')]};});_0x5c7e29[_0x6e40('0x36')]=_['map'](_0x4a2056,_0x6e40('0x37'));_0x5c7e29['query']=_['keys'](_0x11b843['query']);_0x5c7e29[_0x6e40('0x38')]=_['intersection'](_0x5c7e29['model'],_0x5c7e29[_0x6e40('0x39')]);_0x1db6ca[_0x6e40('0x3a')]=_[_0x6e40('0x3b')](_0x5c7e29[_0x6e40('0x36')],qs[_0x6e40('0x3c')](_0x11b843[_0x6e40('0x39')][_0x6e40('0x3c')]));_0x1db6ca[_0x6e40('0x3a')]=_0x1db6ca['attributes'][_0x6e40('0x3d')]?_0x1db6ca['attributes']:_0x5c7e29[_0x6e40('0x36')];if(!_0x11b843[_0x6e40('0x39')][_0x6e40('0x3e')]('nolimit')){_0x1db6ca[_0x6e40('0x24')]=qs[_0x6e40('0x24')](_0x11b843[_0x6e40('0x39')][_0x6e40('0x24')]);_0x1db6ca[_0x6e40('0x23')]=qs[_0x6e40('0x23')](_0x11b843[_0x6e40('0x39')][_0x6e40('0x23')]);}_0x1db6ca[_0x6e40('0x3f')]=qs[_0x6e40('0x40')](_0x11b843[_0x6e40('0x39')][_0x6e40('0x40')]);_0x1db6ca[_0x6e40('0x41')]=qs[_0x6e40('0x38')](_[_0x6e40('0x42')](_0x11b843['query'],_0x5c7e29['filters']),_0x4a2056);if(_0x11b843['query'][_0x6e40('0x43')]){_0x1db6ca[_0x6e40('0x41')]=_[_0x6e40('0x44')](_0x1db6ca['where'],{'$or':_[_0x6e40('0x30')](_0x4a2056,function(_0x3ac84a){if(_0x3ac84a[_0x6e40('0x34')]!==_0x6e40('0x45')){var _0x22cbc5={};_0x22cbc5[_0x3ac84a[_0x6e40('0x37')]]={'$like':'%'+_0x11b843[_0x6e40('0x39')]['filter']+'%'};return _0x22cbc5;}})});}_0x1db6ca=_[_0x6e40('0x44')]({},_0x1db6ca,_0x11b843['options']);var _0x529a46={'where':_0x1db6ca['where']};return db[_0x6e40('0x31')][_0x6e40('0x22')](_0x529a46)[_0x6e40('0x2a')](function(_0x398142){_0x3c02c2[_0x6e40('0x22')]=_0x398142;if(_0x11b843[_0x6e40('0x39')]['includeAll']){_0x1db6ca[_0x6e40('0x46')]=[{'all':!![]}];}return db[_0x6e40('0x31')][_0x6e40('0x47')](_0x1db6ca);})[_0x6e40('0x2a')](function(_0x20907d){_0x3c02c2['rows']=_0x20907d;return _0x3c02c2;})[_0x6e40('0x2a')](respondWithFilteredResult(_0x3c3d33,_0x1db6ca))[_0x6e40('0x48')](handleError(_0x3c3d33,null));};exports[_0x6e40('0x49')]=function(_0x28d52f,_0x1145da){var _0x4f6848={'raw':!![],'where':{'id':_0x28d52f[_0x6e40('0x4a')]['id']}},_0x4f8b7c={};_0x4f8b7c[_0x6e40('0x36')]=_[_0x6e40('0x4b')](db[_0x6e40('0x31')][_0x6e40('0x32')]);_0x4f8b7c[_0x6e40('0x39')]=_[_0x6e40('0x4b')](_0x28d52f[_0x6e40('0x39')]);_0x4f8b7c[_0x6e40('0x38')]=_['intersection'](_0x4f8b7c[_0x6e40('0x36')],_0x4f8b7c['query']);_0x4f6848['attributes']=_['intersection'](_0x4f8b7c[_0x6e40('0x36')],qs[_0x6e40('0x3c')](_0x28d52f[_0x6e40('0x39')][_0x6e40('0x3c')]));_0x4f6848['attributes']=_0x4f6848[_0x6e40('0x3a')][_0x6e40('0x3d')]?_0x4f6848[_0x6e40('0x3a')]:_0x4f8b7c[_0x6e40('0x36')];if(_0x28d52f[_0x6e40('0x39')][_0x6e40('0x4c')]){_0x4f6848[_0x6e40('0x46')]=[{'all':!![]}];}_0x4f6848=_[_0x6e40('0x44')]({},_0x4f6848,_0x28d52f['options']);return db[_0x6e40('0x31')][_0x6e40('0x4d')](_0x4f6848)['then'](handleEntityNotFound(_0x1145da,null))[_0x6e40('0x2a')](respondWithResult(_0x1145da,null))[_0x6e40('0x48')](handleError(_0x1145da,null));};exports[_0x6e40('0x4e')]=function(_0x19eb6d,_0x13beba){return db[_0x6e40('0x31')][_0x6e40('0x4e')](_0x19eb6d[_0x6e40('0x4f')],{})[_0x6e40('0x2a')](function(_0x189286){var _0x2f4c3e=_0x19eb6d['user'][_0x6e40('0x2b')]({'plain':!![]});if(!_0x2f4c3e)throw new Error(_0x6e40('0x50'));if(_0x2f4c3e[_0x6e40('0x51')]===_0x6e40('0x52')){var _0x51d36c=_0x189286[_0x6e40('0x2b')]({'plain':!![]});var _0x4acd52='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4acd52,'userProfileId':_0x2f4c3e['userProfileId']},'raw':!![]})[_0x6e40('0x2a')](function(_0x122275){if(_0x122275&&_0x122275[_0x6e40('0x53')]===0x0){return db[_0x6e40('0x2c')]['create']({'name':_0x51d36c[_0x6e40('0x37')],'resourceId':_0x51d36c['id'],'type':_0x122275[_0x6e40('0x37')],'sectionId':_0x122275['id']},{})[_0x6e40('0x2a')](function(){return _0x189286;});}else{return _0x189286;}})['catch'](function(_0xa5c63f){logger[_0x6e40('0x2d')](_0x6e40('0x54'),_0xa5c63f);throw _0xa5c63f;});}return _0x189286;})[_0x6e40('0x2a')](respondWithResult(_0x13beba,0xc9))[_0x6e40('0x48')](handleError(_0x13beba,null));};exports[_0x6e40('0x28')]=function(_0x2be42d,_0x55f837){if(_0x2be42d['body']['id']){delete _0x2be42d[_0x6e40('0x4f')]['id'];}return db[_0x6e40('0x31')]['find']({'where':{'id':_0x2be42d[_0x6e40('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55f837,null))[_0x6e40('0x2a')](saveUpdates(_0x2be42d[_0x6e40('0x4f')],null))['then'](respondWithResult(_0x55f837,null))[_0x6e40('0x48')](handleError(_0x55f837,null));};exports[_0x6e40('0x29')]=function(_0x10894f,_0x31618d){return db['WhatsappQueue']['find']({'where':{'id':_0x10894f[_0x6e40('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31618d,null))[_0x6e40('0x2a')](removeEntity(_0x31618d,null))[_0x6e40('0x48')](handleError(_0x31618d,null));};exports['describe']=function(_0x3dbcd5,_0x4a5fb9){return db[_0x6e40('0x31')][_0x6e40('0x55')]()[_0x6e40('0x2a')](respondWithResult(_0x4a5fb9,null))[_0x6e40('0x48')](handleError(_0x4a5fb9,null));};exports[_0x6e40('0x56')]=function(_0x427d24,_0x131ef5,_0x53010c){var _0x3b9b93={'raw':!![],'where':{}},_0x265489={},_0xfd556a;return db[_0x6e40('0x31')]['findOne']({'where':{'id':_0x427d24['params']['id']}})[_0x6e40('0x2a')](handleEntityNotFound(_0x131ef5,null))[_0x6e40('0x2a')](function(_0x2aa6dc){if(_0x2aa6dc){_0xfd556a=_0x2aa6dc[_0x6e40('0x2b')]({'plain':!![]});_0x265489['model']=_[_0x6e40('0x4b')](db[_0x6e40('0x57')]['rawAttributes']);_0x265489['query']=_['keys'](_0x427d24['query']);_0x265489['filters']=_[_0x6e40('0x3b')](_0x265489[_0x6e40('0x36')],_0x265489[_0x6e40('0x39')]);_0x3b9b93[_0x6e40('0x3a')]=_[_0x6e40('0x3b')](_0x265489[_0x6e40('0x36')],qs[_0x6e40('0x3c')](_0x427d24['query'][_0x6e40('0x3c')]));_0x3b9b93[_0x6e40('0x3a')]=_0x3b9b93[_0x6e40('0x3a')][_0x6e40('0x3d')]?_0x3b9b93[_0x6e40('0x3a')]:_0x265489['model'];if(!_0x427d24['query'][_0x6e40('0x3e')](_0x6e40('0x58'))){_0x3b9b93[_0x6e40('0x24')]=qs[_0x6e40('0x24')](_0x427d24[_0x6e40('0x39')]['limit']);_0x3b9b93[_0x6e40('0x23')]=qs[_0x6e40('0x23')](_0x427d24[_0x6e40('0x39')][_0x6e40('0x23')]);}_0x3b9b93[_0x6e40('0x3f')]=qs['sort'](_0x427d24[_0x6e40('0x39')][_0x6e40('0x40')]);_0x3b9b93[_0x6e40('0x41')]=qs[_0x6e40('0x38')](_['pick'](_0x427d24['query'],_0x265489[_0x6e40('0x38')]));_0x3b9b93[_0x6e40('0x41')][_0x6e40('0x59')]=_0x2aa6dc['id'];if(_0x427d24[_0x6e40('0x39')][_0x6e40('0x43')]){_0x3b9b93[_0x6e40('0x41')]=_[_0x6e40('0x44')](_0x3b9b93[_0x6e40('0x41')],{'$or':_['map'](_0x3b9b93[_0x6e40('0x3a')],function(_0x14408f){var _0x4a1f4b={};_0x4a1f4b[_0x14408f]={'$like':'%'+_0x427d24['query'][_0x6e40('0x43')]+'%'};return _0x4a1f4b;})});}_0x3b9b93=_[_0x6e40('0x44')]({},_0x3b9b93,_0x427d24[_0x6e40('0x5a')]);return db['UserWhatsappQueue'][_0x6e40('0x47')](_0x3b9b93);}})[_0x6e40('0x2a')](function(_0x2d2a69){if(_0x2d2a69){return db['User']['findAndCountAll']({'where':{'id':_[_0x6e40('0x30')](_0x2d2a69,_0x6e40('0x5b')),'role':_0x6e40('0x5c')},'attributes':['id',_0x6e40('0x37'),_0x6e40('0x5d'),'updatedAt',_0x6e40('0x5e')]});}})[_0x6e40('0x2a')](function(_0x404da8){if(_0x404da8){return{'count':_0x404da8[_0x6e40('0x22')],'rows':_['map'](_0x404da8[_0x6e40('0x5f')],function(_0x5e144b){return{'membername':_0x5e144b[_0x6e40('0x37')],'UserId':_0x5e144b['id'],'queue_name':_0xfd556a[_0x6e40('0x37')],'WhatsappQueueId':_0xfd556a['id'],'interface':util[_0x6e40('0x60')](_0x6e40('0x61'),'SIP',_0x5e144b['name']),'penalty':0x0,'paused':_0x5e144b[_0x6e40('0x5d')],'createdAt':_0x5e144b['createdAt'],'updatedAt':_0x5e144b[_0x6e40('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x131ef5,_0x3b9b93))[_0x6e40('0x48')](handleError(_0x131ef5,null));};exports['getTeams']=function(_0x1ce974,_0x223803,_0x59de23){var _0x36034f={};var _0x4d362e={};var _0x24c97f;var _0x10b8a0;return db['WhatsappQueue'][_0x6e40('0x63')]({'where':{'id':_0x1ce974[_0x6e40('0x4a')]['id']}})['then'](handleEntityNotFound(_0x223803,null))[_0x6e40('0x2a')](function(_0x5b9230){if(_0x5b9230){_0x24c97f=_0x5b9230;_0x4d362e[_0x6e40('0x36')]=_[_0x6e40('0x4b')](db[_0x6e40('0x64')]['rawAttributes']);_0x4d362e[_0x6e40('0x39')]=_[_0x6e40('0x4b')](_0x1ce974[_0x6e40('0x39')]);_0x4d362e[_0x6e40('0x38')]=_[_0x6e40('0x3b')](_0x4d362e[_0x6e40('0x36')],_0x4d362e[_0x6e40('0x39')]);_0x36034f[_0x6e40('0x3a')]=_['intersection'](_0x4d362e['model'],qs[_0x6e40('0x3c')](_0x1ce974[_0x6e40('0x39')]['fields']));_0x36034f[_0x6e40('0x3a')]=_0x36034f['attributes'][_0x6e40('0x3d')]?_0x36034f[_0x6e40('0x3a')]:_0x4d362e[_0x6e40('0x36')];_0x36034f[_0x6e40('0x3f')]=qs[_0x6e40('0x40')](_0x1ce974['query'][_0x6e40('0x40')]);_0x36034f['where']=qs[_0x6e40('0x38')](_[_0x6e40('0x42')](_0x1ce974[_0x6e40('0x39')],_0x4d362e[_0x6e40('0x38')]));if(_0x1ce974['query']['filter']){_0x36034f[_0x6e40('0x41')]=_['merge'](_0x36034f[_0x6e40('0x41')],{'$or':_[_0x6e40('0x30')](_0x36034f['attributes'],function(_0x211e2d){var _0x3e24b4={};_0x3e24b4[_0x211e2d]={'$like':'%'+_0x1ce974[_0x6e40('0x39')][_0x6e40('0x43')]+'%'};return _0x3e24b4;})});}_0x36034f=_['merge']({},_0x36034f,_0x1ce974[_0x6e40('0x5a')]);return _0x24c97f[_0x6e40('0x65')](_0x36034f);}})[_0x6e40('0x2a')](function(_0xb73ae8){if(_0xb73ae8){_0x10b8a0=_0xb73ae8['length'];if(!_0x1ce974[_0x6e40('0x39')][_0x6e40('0x3e')]('nolimit')){_0x36034f[_0x6e40('0x24')]=qs[_0x6e40('0x24')](_0x1ce974[_0x6e40('0x39')][_0x6e40('0x24')]);_0x36034f[_0x6e40('0x23')]=qs[_0x6e40('0x23')](_0x1ce974[_0x6e40('0x39')][_0x6e40('0x23')]);}return _0x24c97f[_0x6e40('0x65')](_0x36034f);}})['then'](function(_0x2f8528){if(_0x2f8528){return _0x2f8528?{'count':_0x10b8a0,'rows':_0x2f8528}:null;}})[_0x6e40('0x2a')](respondWithResult(_0x223803,null))[_0x6e40('0x48')](handleError(_0x223803,null));};exports[_0x6e40('0x66')]=function(_0x23be56,_0x50d6c0,_0x5396c2){var _0x4ee9b8=_0x23be56[_0x6e40('0x4f')][_0x6e40('0x67')];return db[_0x6e40('0x64')][_0x6e40('0x47')]({'where':{'id':_0x4ee9b8},'attributes':['id'],'include':[{'model':db[_0x6e40('0x68')],'as':_0x6e40('0x69'),'attributes':['id','name',_0x6e40('0x6a'),'voicePause',_0x6e40('0x6b')],'raw':!![]}]})[_0x6e40('0x2a')](function(_0x3b3ee7){if(_0x3b3ee7){var _0x51f9bf=_['flatMap'](_0x3b3ee7,function(_0x604a7f){var _0x335b7e=_0x604a7f[_0x6e40('0x2b')]({'plain':!![]});return _0x335b7e[_0x6e40('0x69')];});return db[_0x6e40('0x31')]['find']({'where':{'id':_0x23be56['params']['id']}})['then'](function(_0x8072e8){return db['sequelize'][_0x6e40('0x6c')](function(_0x17e730){return _0x8072e8[_0x6e40('0x66')](_0x4ee9b8,{'transaction':_0x17e730})[_0x6e40('0x2a')](function(){return BPromise[_0x6e40('0x6d')](_0x51f9bf,function(_0x5d65e3){return db[_0x6e40('0x57')][_0x6e40('0x6e')]({'where':{'UserId':_0x5d65e3['id'],'WhatsappQueueId':_0x23be56[_0x6e40('0x4a')]['id']},'transaction':_0x17e730});});})['then'](function(){_0x51f9bf['forEach'](function(_0x549b97){socket[_0x6e40('0x6f')](_0x6e40('0x70'),{'UserId':_0x549b97['id'],'WhatsappQueueId':_0x8072e8['id']});});});});});}})[_0x6e40('0x2a')](respondWithStatusCode(_0x50d6c0,null))['catch'](handleError(_0x50d6c0,null));};exports['removeTeams']=function(_0xa13464,_0x6ea4d1,_0x386d49){return db['Team'][_0x6e40('0x47')]({'where':{'id':_0xa13464[_0x6e40('0x39')][_0x6e40('0x67')]},'attributes':['id'],'include':[{'model':db[_0x6e40('0x68')],'as':_0x6e40('0x69'),'attributes':['id'],'raw':!![]}]})[_0x6e40('0x2a')](handleEntityNotFound(_0x6ea4d1,null))[_0x6e40('0x2a')](function(_0x27569b){var _0xdcb0af=_[_0x6e40('0x30')](_0x27569b,'id');var _0x5f4445=[];var _0x306499=[];var _0x3ee93e=squel['select']();_0x3ee93e['field'](_0x6e40('0x71'))[_0x6e40('0x72')](_0x6e40('0x73'),'tq')[_0x6e40('0x74')](_0x6e40('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6e40('0x41')](_0x6e40('0x76'),_0xa13464['params']['id']);for(var _0x14215e=0x0;_0x14215e<_0x27569b[_0x6e40('0x3d')];_0x14215e+=0x1){let _0x27b8fd=_0x27569b[_0x14215e];for(var _0x4d98fc=0x0;_0x4d98fc<_0x27b8fd['Agents'][_0x6e40('0x3d')];_0x4d98fc+=0x1){let _0x1203b3=_0x27b8fd[_0x6e40('0x69')][_0x4d98fc];var _0x5e502b=_0x3ee93e[_0x6e40('0x77')]();_0x5e502b[_0x6e40('0x41')](_0x6e40('0x78'),_0x1203b3['id']);_0x306499[_0x6e40('0x79')](db[_0x6e40('0x7a')]['query'](_0x5e502b[_0x6e40('0x7b')](),{'type':db[_0x6e40('0x7a')]['QueryTypes'][_0x6e40('0x7c')]})[_0x6e40('0x2a')](function(_0xc83bbf){if(_0xc83bbf[_0x6e40('0x3d')]===0x1){return _0x1203b3['id'];}else{var _0xe93ce3=_[_0x6e40('0x7d')](_[_0x6e40('0x30')](_0xc83bbf,'TeamId'),function(_0xaf0ef5){return _[_0x6e40('0x7e')](_0xdcb0af,_0xaf0ef5);});if(_0xe93ce3){return _0x1203b3['id'];}}}));}}return BPromise[_0x6e40('0x7f')](_0x306499)[_0x6e40('0x2a')](function(_0x13aa1a){_0x5f4445=_(_0x5f4445)['union'](_0x13aa1a)[_0x6e40('0x80')]()['value']();return db[_0x6e40('0x31')][_0x6e40('0x4d')]({'where':{'id':_0xa13464[_0x6e40('0x4a')]['id']}})['then'](function(_0x345a78){return db['sequelize']['transaction'](function(_0x7f0240){return _0x345a78['removeTeams'](_0xa13464[_0x6e40('0x39')][_0x6e40('0x67')],{'transaction':_0x7f0240})['then'](function(){if(!_['isEmpty'](_0x5f4445)){return _0x345a78['removeAgents'](_0x5f4445,{'transaction':_0x7f0240});}})[_0x6e40('0x2a')](function(){_0x5f4445[_0x6e40('0x81')](function(_0x1a628e){socket[_0x6e40('0x6f')](_0x6e40('0x82'),{'UserId':_0x1a628e,'WhatsappQueueId':_0x345a78['id']});});});});});});})[_0x6e40('0x2a')](respondWithStatusCode(_0x6ea4d1,null))[_0x6e40('0x48')](handleError(_0x6ea4d1,null));};exports[_0x6e40('0x83')]=function(_0x4f40c2,_0xb5a532,_0x47a613){return db[_0x6e40('0x31')][_0x6e40('0x4d')]({'where':{'id':_0x4f40c2[_0x6e40('0x4a')]['id']}})[_0x6e40('0x2a')](handleEntityNotFound(_0xb5a532,null))[_0x6e40('0x2a')](function(_0x2c6f25){if(_0x2c6f25){return _0x2c6f25[_0x6e40('0x83')](_0x4f40c2[_0x6e40('0x4f')][_0x6e40('0x67')],_['omit'](_0x4f40c2[_0x6e40('0x4f')],[_0x6e40('0x67'),'id'])||{})[_0x6e40('0x84')](function(_0x335155){for(var _0x482105=0x0;_0x482105<_0x4f40c2['body'][_0x6e40('0x67')][_0x6e40('0x3d')];_0x482105+=0x1){socket[_0x6e40('0x6f')]('userWhatsappQueue:save',{'UserId':_0x4f40c2[_0x6e40('0x4f')][_0x6e40('0x67')][_0x482105],'WhatsappQueueId':_0x4f40c2[_0x6e40('0x4a')]['id']});}return _0x335155;});}})[_0x6e40('0x2a')](respondWithResult(_0xb5a532,null))[_0x6e40('0x48')](handleError(_0xb5a532,null));};exports[_0x6e40('0x85')]=function(_0x213cdd,_0x4bdfbe,_0x4ba1d8){return db[_0x6e40('0x31')][_0x6e40('0x4d')]({'where':{'id':_0x213cdd['params']['id']}})['then'](handleEntityNotFound(_0x4bdfbe,null))[_0x6e40('0x2a')](function(_0x4cfb0d){if(_0x4cfb0d){return _0x4cfb0d[_0x6e40('0x85')](_0x213cdd[_0x6e40('0x39')]['ids'])[_0x6e40('0x2a')](function(){if(_[_0x6e40('0x86')](_0x213cdd[_0x6e40('0x39')][_0x6e40('0x67')])){for(var _0x47c756=0x0;_0x47c756<_0x213cdd[_0x6e40('0x39')]['ids'][_0x6e40('0x3d')];_0x47c756+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x213cdd['query'][_0x6e40('0x67')][_0x47c756]),'WhatsappQueueId':Number(_0x213cdd[_0x6e40('0x4a')]['id'])});}}else{socket[_0x6e40('0x6f')](_0x6e40('0x82'),{'UserId':Number(_0x213cdd[_0x6e40('0x39')][_0x6e40('0x67')]),'WhatsappQueueId':Number(_0x213cdd['params']['id'])});}});}})[_0x6e40('0x2a')](respondWithStatusCode(_0x4bdfbe,null))[_0x6e40('0x48')](handleError(_0x4bdfbe,null));};exports[_0x6e40('0x87')]=function(_0x1a5496,_0x20bbd0,_0x214c6b){var _0x763942={};var _0x40aa4c={};var _0x57442d;var _0x3bc6ac;return db[_0x6e40('0x31')][_0x6e40('0x63')]({'where':{'id':_0x1a5496[_0x6e40('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20bbd0,null))['then'](function(_0x31ddbf){if(_0x31ddbf){_0x57442d=_0x31ddbf;_0x40aa4c['model']=_[_0x6e40('0x4b')](db['User'][_0x6e40('0x32')]);_0x40aa4c[_0x6e40('0x39')]=_['keys'](_0x1a5496[_0x6e40('0x39')]);_0x40aa4c[_0x6e40('0x38')]=_[_0x6e40('0x3b')](_0x40aa4c['model'],_0x40aa4c[_0x6e40('0x39')]);_0x763942['attributes']=_[_0x6e40('0x3b')](_0x40aa4c['model'],qs[_0x6e40('0x3c')](_0x1a5496['query']['fields']));_0x763942['attributes']=_0x763942[_0x6e40('0x3a')][_0x6e40('0x3d')]?_0x763942[_0x6e40('0x3a')]:_0x40aa4c[_0x6e40('0x36')];_0x763942[_0x6e40('0x3f')]=qs[_0x6e40('0x40')](_0x1a5496['query'][_0x6e40('0x40')]);_0x763942[_0x6e40('0x41')]=qs[_0x6e40('0x38')](_[_0x6e40('0x42')](_0x1a5496['query'],_0x40aa4c[_0x6e40('0x38')]));if(_0x1a5496[_0x6e40('0x39')]['filter']){_0x763942[_0x6e40('0x41')]=_[_0x6e40('0x44')](_0x763942[_0x6e40('0x41')],{'$or':_[_0x6e40('0x30')](_0x763942[_0x6e40('0x3a')],function(_0x1b4ba6){var _0x554264={};_0x554264[_0x1b4ba6]={'$like':'%'+_0x1a5496[_0x6e40('0x39')][_0x6e40('0x43')]+'%'};return _0x554264;})});}_0x763942=_[_0x6e40('0x44')]({},_0x763942,_0x1a5496['options']);return _0x57442d[_0x6e40('0x87')](_0x763942);}})['then'](function(_0x35f97c){if(_0x35f97c){_0x3bc6ac=_0x35f97c[_0x6e40('0x3d')];if(!_0x1a5496[_0x6e40('0x39')][_0x6e40('0x3e')]('nolimit')){_0x763942[_0x6e40('0x24')]=qs[_0x6e40('0x24')](_0x1a5496[_0x6e40('0x39')][_0x6e40('0x24')]);_0x763942['offset']=qs[_0x6e40('0x23')](_0x1a5496[_0x6e40('0x39')][_0x6e40('0x23')]);}return _0x57442d['getAgents'](_0x763942);}})[_0x6e40('0x2a')](function(_0x4d213b){if(_0x4d213b){return _0x4d213b?{'count':_0x3bc6ac,'rows':_0x4d213b}:null;}})['then'](respondWithResult(_0x20bbd0,null))[_0x6e40('0x48')](handleError(_0x20bbd0,null));}; \ No newline at end of file +var _0x6e5e=['body','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','order','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6e5e,0x13f));var _0xe6e5=function(_0x10f419,_0x575272){_0x10f419=_0x10f419-0x0;var _0x12c666=_0x6e5e[_0x10f419];return _0x12c666;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6e5('0x0'));var rimraf=require(_0xe6e5('0x1'));var zipdir=require(_0xe6e5('0x2'));var jsonpatch=require(_0xe6e5('0x3'));var rp=require(_0xe6e5('0x4'));var moment=require(_0xe6e5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe6e5('0x6'));var path=require(_0xe6e5('0x7'));var sox=require(_0xe6e5('0x8'));var csv=require(_0xe6e5('0x9'));var ejs=require(_0xe6e5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe6e5('0xb'));var crypto=require(_0xe6e5('0xc'));var jsforce=require(_0xe6e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe6e5('0x9'));var querystring=require(_0xe6e5('0xe'));var Papa=require(_0xe6e5('0xf'));var Redis=require(_0xe6e5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe6e5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6e5('0x12'))('api');var utils=require(_0xe6e5('0x13'));var config=require(_0xe6e5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6e5('0x15'))['db'];config['redis']=_[_0xe6e5('0x16')](config['redis'],{'host':_0xe6e5('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6e5('0x18')]));require(_0xe6e5('0x19'))[_0xe6e5('0x1a')](socket);function respondWithStatusCode(_0x1e7e23,_0x1ff700){_0x1ff700=_0x1ff700||0xcc;return function(_0x210cb1){if(_0x210cb1){return _0x1e7e23[_0xe6e5('0x1b')](_0x1ff700);}return _0x1e7e23[_0xe6e5('0x1c')](_0x1ff700)[_0xe6e5('0x1d')]();};}function respondWithResult(_0x3beead,_0x35c333){_0x35c333=_0x35c333||0xc8;return function(_0x233162){if(_0x233162){return _0x3beead['status'](_0x35c333)['json'](_0x233162);}};}function respondWithFilteredResult(_0x481fd3,_0x8b806a){return function(_0x527546){if(_0x527546){var _0xa6bea5=_0x527546[_0xe6e5('0x1e')],_0x515fb1=_0x8b806a[_0xe6e5('0x1f')],_0x3200a9=_0x8b806a['offset']+_0x8b806a[_0xe6e5('0x20')],_0x3bc29a;if(_0x3200a9>=_0xa6bea5){_0x3200a9=_0xa6bea5;_0x3bc29a=0xc8;}else{_0x3bc29a=0xce;}_0x481fd3[_0xe6e5('0x1c')](_0x3bc29a);return _0x481fd3[_0xe6e5('0x21')](_0xe6e5('0x22'),_0x515fb1+'-'+_0x3200a9+'/'+_0xa6bea5)[_0xe6e5('0x23')](_0x527546);}return null;};}function patchUpdates(_0x5f57e3){return function(_0x373dd8){try{jsonpatch['apply'](_0x373dd8,_0x5f57e3,!![]);}catch(_0x4c6f6c){return BPromise[_0xe6e5('0x24')](_0x4c6f6c);}return _0x373dd8['save']();};}function saveUpdates(_0x52efdf,_0x3b3fda){return function(_0x5c0923){if(_0x5c0923){return _0x5c0923[_0xe6e5('0x25')](_0x52efdf)[_0xe6e5('0x26')](function(_0x2bfe68){return _0x2bfe68;});}return null;};}function removeEntity(_0x2e63c0,_0x1b56d9){return function(_0x1af9dd){if(_0x1af9dd){return _0x1af9dd[_0xe6e5('0x27')]()['then'](function(){var _0x4ef03d=_0x1af9dd[_0xe6e5('0x28')]({'plain':!![]});var _0x245e6d=_0xe6e5('0x29');return db[_0xe6e5('0x2a')]['destroy']({'where':{'type':_0x245e6d,'resourceId':_0x4ef03d['id']}})[_0xe6e5('0x26')](function(){return _0x1af9dd;});})[_0xe6e5('0x26')](function(){_0x2e63c0[_0xe6e5('0x1c')](0xcc)[_0xe6e5('0x1d')]();});}};}function handleEntityNotFound(_0x59b0b7,_0x169e49){return function(_0x47885b){if(!_0x47885b){_0x59b0b7['sendStatus'](0x194);}return _0x47885b;};}function handleError(_0x3bdac7,_0xfd727b){_0xfd727b=_0xfd727b||0x1f4;return function(_0x445df0){logger['error'](_0x445df0[_0xe6e5('0x2b')]);if(_0x445df0[_0xe6e5('0x2c')]){delete _0x445df0[_0xe6e5('0x2c')];}_0x3bdac7[_0xe6e5('0x1c')](_0xfd727b)[_0xe6e5('0x2d')](_0x445df0);};}exports[_0xe6e5('0x2e')]=function(_0x2d05c4,_0x51e0bc){var _0x5ccc08={},_0x3cdac0={},_0x29b44f={'count':0x0,'rows':[]};var _0x50c9aa=_[_0xe6e5('0x2f')](db[_0xe6e5('0x30')]['rawAttributes'],function(_0x9b7081){return{'name':_0x9b7081['fieldName'],'type':_0x9b7081[_0xe6e5('0x31')]['key']};});_0x3cdac0[_0xe6e5('0x32')]=_[_0xe6e5('0x2f')](_0x50c9aa,_0xe6e5('0x2c'));_0x3cdac0[_0xe6e5('0x33')]=_['keys'](_0x2d05c4[_0xe6e5('0x33')]);_0x3cdac0['filters']=_['intersection'](_0x3cdac0[_0xe6e5('0x32')],_0x3cdac0[_0xe6e5('0x33')]);_0x5ccc08[_0xe6e5('0x34')]=_[_0xe6e5('0x35')](_0x3cdac0[_0xe6e5('0x32')],qs[_0xe6e5('0x36')](_0x2d05c4['query'][_0xe6e5('0x36')]));_0x5ccc08[_0xe6e5('0x34')]=_0x5ccc08[_0xe6e5('0x34')][_0xe6e5('0x37')]?_0x5ccc08[_0xe6e5('0x34')]:_0x3cdac0[_0xe6e5('0x32')];if(!_0x2d05c4[_0xe6e5('0x33')][_0xe6e5('0x38')](_0xe6e5('0x39'))){_0x5ccc08[_0xe6e5('0x20')]=qs[_0xe6e5('0x20')](_0x2d05c4[_0xe6e5('0x33')][_0xe6e5('0x20')]);_0x5ccc08[_0xe6e5('0x1f')]=qs[_0xe6e5('0x1f')](_0x2d05c4[_0xe6e5('0x33')][_0xe6e5('0x1f')]);}_0x5ccc08['order']=qs[_0xe6e5('0x3a')](_0x2d05c4['query']['sort']);_0x5ccc08[_0xe6e5('0x3b')]=qs['filters'](_['pick'](_0x2d05c4[_0xe6e5('0x33')],_0x3cdac0[_0xe6e5('0x3c')]),_0x50c9aa);if(_0x2d05c4[_0xe6e5('0x33')][_0xe6e5('0x3d')]){_0x5ccc08[_0xe6e5('0x3b')]=_[_0xe6e5('0x3e')](_0x5ccc08['where'],{'$or':_[_0xe6e5('0x2f')](_0x50c9aa,function(_0x5a4f9a){if(_0x5a4f9a[_0xe6e5('0x31')]!==_0xe6e5('0x3f')){var _0x41ec7d={};_0x41ec7d[_0x5a4f9a[_0xe6e5('0x2c')]]={'$like':'%'+_0x2d05c4[_0xe6e5('0x33')][_0xe6e5('0x3d')]+'%'};return _0x41ec7d;}})});}_0x5ccc08=_['merge']({},_0x5ccc08,_0x2d05c4[_0xe6e5('0x40')]);var _0x38a068={'where':_0x5ccc08[_0xe6e5('0x3b')]};return db[_0xe6e5('0x30')][_0xe6e5('0x1e')](_0x38a068)[_0xe6e5('0x26')](function(_0x4ac046){_0x29b44f[_0xe6e5('0x1e')]=_0x4ac046;if(_0x2d05c4[_0xe6e5('0x33')][_0xe6e5('0x41')]){_0x5ccc08[_0xe6e5('0x42')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xe6e5('0x43')](_0x5ccc08);})['then'](function(_0x2b951c){_0x29b44f['rows']=_0x2b951c;return _0x29b44f;})['then'](respondWithFilteredResult(_0x51e0bc,_0x5ccc08))[_0xe6e5('0x44')](handleError(_0x51e0bc,null));};exports[_0xe6e5('0x45')]=function(_0x379dfc,_0x5c34b8){var _0x958c35={'raw':!![],'where':{'id':_0x379dfc[_0xe6e5('0x46')]['id']}},_0x2a33e4={};_0x2a33e4[_0xe6e5('0x32')]=_[_0xe6e5('0x47')](db['WhatsappQueue']['rawAttributes']);_0x2a33e4[_0xe6e5('0x33')]=_[_0xe6e5('0x47')](_0x379dfc[_0xe6e5('0x33')]);_0x2a33e4[_0xe6e5('0x3c')]=_[_0xe6e5('0x35')](_0x2a33e4[_0xe6e5('0x32')],_0x2a33e4[_0xe6e5('0x33')]);_0x958c35[_0xe6e5('0x34')]=_['intersection'](_0x2a33e4[_0xe6e5('0x32')],qs[_0xe6e5('0x36')](_0x379dfc[_0xe6e5('0x33')]['fields']));_0x958c35[_0xe6e5('0x34')]=_0x958c35['attributes']['length']?_0x958c35[_0xe6e5('0x34')]:_0x2a33e4[_0xe6e5('0x32')];if(_0x379dfc[_0xe6e5('0x33')][_0xe6e5('0x41')]){_0x958c35[_0xe6e5('0x42')]=[{'all':!![]}];}_0x958c35=_[_0xe6e5('0x3e')]({},_0x958c35,_0x379dfc[_0xe6e5('0x40')]);return db[_0xe6e5('0x30')][_0xe6e5('0x48')](_0x958c35)[_0xe6e5('0x26')](handleEntityNotFound(_0x5c34b8,null))[_0xe6e5('0x26')](respondWithResult(_0x5c34b8,null))[_0xe6e5('0x44')](handleError(_0x5c34b8,null));};exports[_0xe6e5('0x49')]=function(_0xc85133,_0x441df4){return db[_0xe6e5('0x30')][_0xe6e5('0x49')](_0xc85133['body'],{})[_0xe6e5('0x26')](function(_0x2c01b9){var _0x37fa37=_0xc85133[_0xe6e5('0x4a')]['get']({'plain':!![]});if(!_0x37fa37)throw new Error(_0xe6e5('0x4b'));if(_0x37fa37[_0xe6e5('0x4c')]===_0xe6e5('0x4a')){var _0x7d602b=_0x2c01b9['get']({'plain':!![]});var _0x23c6bf=_0xe6e5('0x29');return db[_0xe6e5('0x4d')][_0xe6e5('0x48')]({'where':{'name':_0x23c6bf,'userProfileId':_0x37fa37[_0xe6e5('0x4e')]},'raw':!![]})[_0xe6e5('0x26')](function(_0x28f819){if(_0x28f819&&_0x28f819['autoAssociation']===0x0){return db[_0xe6e5('0x2a')][_0xe6e5('0x49')]({'name':_0x7d602b[_0xe6e5('0x2c')],'resourceId':_0x7d602b['id'],'type':_0x28f819[_0xe6e5('0x2c')],'sectionId':_0x28f819['id']},{})[_0xe6e5('0x26')](function(){return _0x2c01b9;});}else{return _0x2c01b9;}})['catch'](function(_0x557b45){logger[_0xe6e5('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557b45);throw _0x557b45;});}return _0x2c01b9;})['then'](respondWithResult(_0x441df4,0xc9))[_0xe6e5('0x44')](handleError(_0x441df4,null));};exports[_0xe6e5('0x25')]=function(_0x3fd718,_0x2ccd40){if(_0x3fd718[_0xe6e5('0x50')]['id']){delete _0x3fd718[_0xe6e5('0x50')]['id'];}return db[_0xe6e5('0x30')][_0xe6e5('0x48')]({'where':{'id':_0x3fd718[_0xe6e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ccd40,null))[_0xe6e5('0x26')](saveUpdates(_0x3fd718['body'],null))[_0xe6e5('0x26')](respondWithResult(_0x2ccd40,null))[_0xe6e5('0x44')](handleError(_0x2ccd40,null));};exports[_0xe6e5('0x27')]=function(_0xf7056a,_0x460e39){return db['WhatsappQueue'][_0xe6e5('0x48')]({'where':{'id':_0xf7056a[_0xe6e5('0x46')]['id']}})[_0xe6e5('0x26')](handleEntityNotFound(_0x460e39,null))['then'](removeEntity(_0x460e39,null))[_0xe6e5('0x44')](handleError(_0x460e39,null));};exports['describe']=function(_0x274ee0,_0x350a84){return db[_0xe6e5('0x30')][_0xe6e5('0x51')]()['then'](respondWithResult(_0x350a84,null))['catch'](handleError(_0x350a84,null));};exports[_0xe6e5('0x52')]=function(_0xbdca3d,_0x5963e5,_0x524239){var _0x57bfca={'raw':!![],'where':{}},_0x25d4d3={},_0xd67ad4;return db[_0xe6e5('0x30')][_0xe6e5('0x53')]({'where':{'id':_0xbdca3d[_0xe6e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x5963e5,null))[_0xe6e5('0x26')](function(_0x1ee516){if(_0x1ee516){_0xd67ad4=_0x1ee516['get']({'plain':!![]});_0x25d4d3['model']=_[_0xe6e5('0x47')](db[_0xe6e5('0x54')][_0xe6e5('0x55')]);_0x25d4d3[_0xe6e5('0x33')]=_[_0xe6e5('0x47')](_0xbdca3d[_0xe6e5('0x33')]);_0x25d4d3[_0xe6e5('0x3c')]=_[_0xe6e5('0x35')](_0x25d4d3[_0xe6e5('0x32')],_0x25d4d3[_0xe6e5('0x33')]);_0x57bfca[_0xe6e5('0x34')]=_[_0xe6e5('0x35')](_0x25d4d3['model'],qs['fields'](_0xbdca3d[_0xe6e5('0x33')][_0xe6e5('0x36')]));_0x57bfca[_0xe6e5('0x34')]=_0x57bfca[_0xe6e5('0x34')]['length']?_0x57bfca[_0xe6e5('0x34')]:_0x25d4d3[_0xe6e5('0x32')];if(!_0xbdca3d['query'][_0xe6e5('0x38')](_0xe6e5('0x39'))){_0x57bfca[_0xe6e5('0x20')]=qs[_0xe6e5('0x20')](_0xbdca3d[_0xe6e5('0x33')][_0xe6e5('0x20')]);_0x57bfca['offset']=qs['offset'](_0xbdca3d['query'][_0xe6e5('0x1f')]);}_0x57bfca[_0xe6e5('0x56')]=qs[_0xe6e5('0x3a')](_0xbdca3d['query'][_0xe6e5('0x3a')]);_0x57bfca['where']=qs[_0xe6e5('0x3c')](_[_0xe6e5('0x57')](_0xbdca3d[_0xe6e5('0x33')],_0x25d4d3[_0xe6e5('0x3c')]));_0x57bfca[_0xe6e5('0x3b')][_0xe6e5('0x58')]=_0x1ee516['id'];if(_0xbdca3d[_0xe6e5('0x33')][_0xe6e5('0x3d')]){_0x57bfca[_0xe6e5('0x3b')]=_[_0xe6e5('0x3e')](_0x57bfca[_0xe6e5('0x3b')],{'$or':_[_0xe6e5('0x2f')](_0x57bfca[_0xe6e5('0x34')],function(_0x3e3e8d){var _0x2d21f1={};_0x2d21f1[_0x3e3e8d]={'$like':'%'+_0xbdca3d[_0xe6e5('0x33')]['filter']+'%'};return _0x2d21f1;})});}_0x57bfca=_['merge']({},_0x57bfca,_0xbdca3d[_0xe6e5('0x40')]);return db['UserWhatsappQueue'][_0xe6e5('0x43')](_0x57bfca);}})['then'](function(_0x485760){if(_0x485760){return db[_0xe6e5('0x59')][_0xe6e5('0x5a')]({'where':{'id':_['map'](_0x485760,_0xe6e5('0x5b')),'role':_0xe6e5('0x5c')},'attributes':['id',_0xe6e5('0x2c'),'whatsappPause',_0xe6e5('0x5d'),_0xe6e5('0x5e')]});}})[_0xe6e5('0x26')](function(_0x479c68){if(_0x479c68){return{'count':_0x479c68[_0xe6e5('0x1e')],'rows':_[_0xe6e5('0x2f')](_0x479c68['rows'],function(_0x1ffc40){return{'membername':_0x1ffc40[_0xe6e5('0x2c')],'UserId':_0x1ffc40['id'],'queue_name':_0xd67ad4['name'],'WhatsappQueueId':_0xd67ad4['id'],'interface':util['format'](_0xe6e5('0x5f'),_0xe6e5('0x60'),_0x1ffc40[_0xe6e5('0x2c')]),'penalty':0x0,'paused':_0x1ffc40['whatsappPause'],'createdAt':_0x1ffc40[_0xe6e5('0x5e')],'updatedAt':_0x1ffc40[_0xe6e5('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5963e5,_0x57bfca))[_0xe6e5('0x44')](handleError(_0x5963e5,null));};exports[_0xe6e5('0x61')]=function(_0x427b51,_0x14c3aa,_0x17f0ba){var _0x396ecc={};var _0x491b8e={};var _0x1855c4;var _0x5ec7a7;return db['WhatsappQueue'][_0xe6e5('0x53')]({'where':{'id':_0x427b51[_0xe6e5('0x46')]['id']}})[_0xe6e5('0x26')](handleEntityNotFound(_0x14c3aa,null))['then'](function(_0x4faf6d){if(_0x4faf6d){_0x1855c4=_0x4faf6d;_0x491b8e[_0xe6e5('0x32')]=_[_0xe6e5('0x47')](db['Team'][_0xe6e5('0x55')]);_0x491b8e[_0xe6e5('0x33')]=_[_0xe6e5('0x47')](_0x427b51[_0xe6e5('0x33')]);_0x491b8e[_0xe6e5('0x3c')]=_[_0xe6e5('0x35')](_0x491b8e[_0xe6e5('0x32')],_0x491b8e[_0xe6e5('0x33')]);_0x396ecc[_0xe6e5('0x34')]=_['intersection'](_0x491b8e['model'],qs[_0xe6e5('0x36')](_0x427b51['query'][_0xe6e5('0x36')]));_0x396ecc[_0xe6e5('0x34')]=_0x396ecc['attributes']['length']?_0x396ecc[_0xe6e5('0x34')]:_0x491b8e[_0xe6e5('0x32')];_0x396ecc[_0xe6e5('0x56')]=qs['sort'](_0x427b51[_0xe6e5('0x33')][_0xe6e5('0x3a')]);_0x396ecc['where']=qs[_0xe6e5('0x3c')](_[_0xe6e5('0x57')](_0x427b51[_0xe6e5('0x33')],_0x491b8e[_0xe6e5('0x3c')]));if(_0x427b51[_0xe6e5('0x33')][_0xe6e5('0x3d')]){_0x396ecc['where']=_['merge'](_0x396ecc['where'],{'$or':_['map'](_0x396ecc['attributes'],function(_0xa284fa){var _0xde0a1={};_0xde0a1[_0xa284fa]={'$like':'%'+_0x427b51[_0xe6e5('0x33')][_0xe6e5('0x3d')]+'%'};return _0xde0a1;})});}_0x396ecc=_[_0xe6e5('0x3e')]({},_0x396ecc,_0x427b51[_0xe6e5('0x40')]);return _0x1855c4[_0xe6e5('0x61')](_0x396ecc);}})['then'](function(_0xff1216){if(_0xff1216){_0x5ec7a7=_0xff1216['length'];if(!_0x427b51[_0xe6e5('0x33')][_0xe6e5('0x38')](_0xe6e5('0x39'))){_0x396ecc[_0xe6e5('0x20')]=qs['limit'](_0x427b51['query']['limit']);_0x396ecc[_0xe6e5('0x1f')]=qs['offset'](_0x427b51[_0xe6e5('0x33')][_0xe6e5('0x1f')]);}return _0x1855c4['getTeams'](_0x396ecc);}})['then'](function(_0x5e9906){if(_0x5e9906){return _0x5e9906?{'count':_0x5ec7a7,'rows':_0x5e9906}:null;}})[_0xe6e5('0x26')](respondWithResult(_0x14c3aa,null))[_0xe6e5('0x44')](handleError(_0x14c3aa,null));};exports[_0xe6e5('0x62')]=function(_0x59ac13,_0x3d225e,_0xd73b19){var _0x2b372d=_0x59ac13[_0xe6e5('0x50')][_0xe6e5('0x63')];return db[_0xe6e5('0x64')][_0xe6e5('0x43')]({'where':{'id':_0x2b372d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe6e5('0x65'),'attributes':['id',_0xe6e5('0x2c'),'online','voicePause',_0xe6e5('0x66')],'raw':!![]}]})[_0xe6e5('0x26')](function(_0x15ab7b){if(_0x15ab7b){var _0x31d8ae=_[_0xe6e5('0x67')](_0x15ab7b,function(_0x495273){var _0x51f9ad=_0x495273[_0xe6e5('0x28')]({'plain':!![]});return _0x51f9ad['Agents'];});return db[_0xe6e5('0x30')][_0xe6e5('0x48')]({'where':{'id':_0x59ac13[_0xe6e5('0x46')]['id']}})['then'](function(_0x4b6936){return db[_0xe6e5('0x68')][_0xe6e5('0x69')](function(_0x4a1aa6){return _0x4b6936[_0xe6e5('0x62')](_0x2b372d,{'transaction':_0x4a1aa6})[_0xe6e5('0x26')](function(){return BPromise[_0xe6e5('0x6a')](_0x31d8ae,function(_0x1f2736){return db[_0xe6e5('0x54')]['findOrCreate']({'where':{'UserId':_0x1f2736['id'],'WhatsappQueueId':_0x59ac13['params']['id']},'transaction':_0x4a1aa6});});})[_0xe6e5('0x26')](function(){_0x31d8ae[_0xe6e5('0x6b')](function(_0x3cc5ed){socket[_0xe6e5('0x6c')]('userWhatsappQueue:save',{'UserId':_0x3cc5ed['id'],'WhatsappQueueId':_0x4b6936['id']});});});});});}})[_0xe6e5('0x26')](respondWithStatusCode(_0x3d225e,null))['catch'](handleError(_0x3d225e,null));};exports[_0xe6e5('0x6d')]=function(_0x292d5d,_0x45a180,_0x12ebca){return db[_0xe6e5('0x64')][_0xe6e5('0x43')]({'where':{'id':_0x292d5d[_0xe6e5('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe6e5('0x59')],'as':_0xe6e5('0x65'),'attributes':['id'],'raw':!![]}]})[_0xe6e5('0x26')](handleEntityNotFound(_0x45a180,null))['then'](function(_0xbdd0ff){var _0x4b2517=_[_0xe6e5('0x2f')](_0xbdd0ff,'id');var _0x191ac5=[];var _0x3f5ffa=[];var _0x40ab7a=squel[_0xe6e5('0x6e')]();_0x40ab7a[_0xe6e5('0x6f')](_0xe6e5('0x70'))[_0xe6e5('0x71')]('team_has_whatsapp_queues','tq')['join']('user_has_teams','ut',_0xe6e5('0x72'))[_0xe6e5('0x3b')](_0xe6e5('0x73'),_0x292d5d[_0xe6e5('0x46')]['id']);for(var _0x26e171=0x0;_0x26e171<_0xbdd0ff[_0xe6e5('0x37')];_0x26e171+=0x1){let _0xe733e5=_0xbdd0ff[_0x26e171];for(var _0x4fa024=0x0;_0x4fa024<_0xe733e5['Agents'][_0xe6e5('0x37')];_0x4fa024+=0x1){let _0xc8b81f=_0xe733e5[_0xe6e5('0x65')][_0x4fa024];var _0xb86262=_0x40ab7a[_0xe6e5('0x74')]();_0xb86262[_0xe6e5('0x3b')](_0xe6e5('0x75'),_0xc8b81f['id']);_0x3f5ffa['push'](db[_0xe6e5('0x68')]['query'](_0xb86262['toString'](),{'type':db[_0xe6e5('0x68')][_0xe6e5('0x76')][_0xe6e5('0x77')]})[_0xe6e5('0x26')](function(_0x26e6cc){if(_0x26e6cc[_0xe6e5('0x37')]===0x1){return _0xc8b81f['id'];}else{var _0x40e300=_['every'](_[_0xe6e5('0x2f')](_0x26e6cc,_0xe6e5('0x78')),function(_0x1eb5cf){return _[_0xe6e5('0x79')](_0x4b2517,_0x1eb5cf);});if(_0x40e300){return _0xc8b81f['id'];}}}));}}return BPromise[_0xe6e5('0x7a')](_0x3f5ffa)[_0xe6e5('0x26')](function(_0x1d5076){_0x191ac5=_(_0x191ac5)[_0xe6e5('0x7b')](_0x1d5076)[_0xe6e5('0x7c')]()[_0xe6e5('0x7d')]();return db[_0xe6e5('0x30')][_0xe6e5('0x48')]({'where':{'id':_0x292d5d[_0xe6e5('0x46')]['id']}})[_0xe6e5('0x26')](function(_0x349f20){return db[_0xe6e5('0x68')][_0xe6e5('0x69')](function(_0x53659c){return _0x349f20[_0xe6e5('0x6d')](_0x292d5d[_0xe6e5('0x33')][_0xe6e5('0x63')],{'transaction':_0x53659c})['then'](function(){if(!_[_0xe6e5('0x7e')](_0x191ac5)){return _0x349f20['removeAgents'](_0x191ac5,{'transaction':_0x53659c});}})[_0xe6e5('0x26')](function(){_0x191ac5[_0xe6e5('0x6b')](function(_0xe385c4){socket['emit'](_0xe6e5('0x7f'),{'UserId':_0xe385c4,'WhatsappQueueId':_0x349f20['id']});});});});});});})['then'](respondWithStatusCode(_0x45a180,null))[_0xe6e5('0x44')](handleError(_0x45a180,null));};exports[_0xe6e5('0x80')]=function(_0x4e65be,_0xed085,_0x344636){return db[_0xe6e5('0x30')][_0xe6e5('0x48')]({'where':{'id':_0x4e65be[_0xe6e5('0x46')]['id']}})[_0xe6e5('0x26')](handleEntityNotFound(_0xed085,null))[_0xe6e5('0x26')](function(_0x1c156c){if(_0x1c156c){return _0x1c156c['addAgents'](_0x4e65be[_0xe6e5('0x50')][_0xe6e5('0x63')],_[_0xe6e5('0x81')](_0x4e65be[_0xe6e5('0x50')],[_0xe6e5('0x63'),'id'])||{})[_0xe6e5('0x82')](function(_0x468ff5){for(var _0xa00411=0x0;_0xa00411<_0x4e65be[_0xe6e5('0x50')][_0xe6e5('0x63')][_0xe6e5('0x37')];_0xa00411+=0x1){socket[_0xe6e5('0x6c')]('userWhatsappQueue:save',{'UserId':_0x4e65be[_0xe6e5('0x50')][_0xe6e5('0x63')][_0xa00411],'WhatsappQueueId':_0x4e65be['params']['id']});}return _0x468ff5;});}})[_0xe6e5('0x26')](respondWithResult(_0xed085,null))[_0xe6e5('0x44')](handleError(_0xed085,null));};exports[_0xe6e5('0x83')]=function(_0x1ef1e5,_0x27a362,_0x218c60){return db[_0xe6e5('0x30')][_0xe6e5('0x48')]({'where':{'id':_0x1ef1e5[_0xe6e5('0x46')]['id']}})[_0xe6e5('0x26')](handleEntityNotFound(_0x27a362,null))[_0xe6e5('0x26')](function(_0x2cc864){if(_0x2cc864){return _0x2cc864[_0xe6e5('0x83')](_0x1ef1e5[_0xe6e5('0x33')][_0xe6e5('0x63')])['then'](function(){if(_['isArray'](_0x1ef1e5['query'][_0xe6e5('0x63')])){for(var _0x53d782=0x0;_0x53d782<_0x1ef1e5[_0xe6e5('0x33')]['ids'][_0xe6e5('0x37')];_0x53d782+=0x1){socket[_0xe6e5('0x6c')](_0xe6e5('0x7f'),{'UserId':Number(_0x1ef1e5['query'][_0xe6e5('0x63')][_0x53d782]),'WhatsappQueueId':Number(_0x1ef1e5[_0xe6e5('0x46')]['id'])});}}else{socket[_0xe6e5('0x6c')](_0xe6e5('0x7f'),{'UserId':Number(_0x1ef1e5[_0xe6e5('0x33')][_0xe6e5('0x63')]),'WhatsappQueueId':Number(_0x1ef1e5[_0xe6e5('0x46')]['id'])});}});}})[_0xe6e5('0x26')](respondWithStatusCode(_0x27a362,null))[_0xe6e5('0x44')](handleError(_0x27a362,null));};exports['getAgents']=function(_0xa15b63,_0xb65e81,_0x55e72b){var _0x362d03={};var _0x45b3e1={};var _0x21e555;var _0x4d87cd;return db[_0xe6e5('0x30')][_0xe6e5('0x53')]({'where':{'id':_0xa15b63[_0xe6e5('0x46')]['id']}})[_0xe6e5('0x26')](handleEntityNotFound(_0xb65e81,null))[_0xe6e5('0x26')](function(_0x55b231){if(_0x55b231){_0x21e555=_0x55b231;_0x45b3e1[_0xe6e5('0x32')]=_['keys'](db['User'][_0xe6e5('0x55')]);_0x45b3e1[_0xe6e5('0x33')]=_[_0xe6e5('0x47')](_0xa15b63[_0xe6e5('0x33')]);_0x45b3e1['filters']=_[_0xe6e5('0x35')](_0x45b3e1[_0xe6e5('0x32')],_0x45b3e1['query']);_0x362d03[_0xe6e5('0x34')]=_[_0xe6e5('0x35')](_0x45b3e1['model'],qs[_0xe6e5('0x36')](_0xa15b63[_0xe6e5('0x33')][_0xe6e5('0x36')]));_0x362d03[_0xe6e5('0x34')]=_0x362d03[_0xe6e5('0x34')][_0xe6e5('0x37')]?_0x362d03['attributes']:_0x45b3e1[_0xe6e5('0x32')];_0x362d03['order']=qs['sort'](_0xa15b63[_0xe6e5('0x33')][_0xe6e5('0x3a')]);_0x362d03[_0xe6e5('0x3b')]=qs[_0xe6e5('0x3c')](_['pick'](_0xa15b63[_0xe6e5('0x33')],_0x45b3e1[_0xe6e5('0x3c')]));if(_0xa15b63[_0xe6e5('0x33')][_0xe6e5('0x3d')]){_0x362d03[_0xe6e5('0x3b')]=_[_0xe6e5('0x3e')](_0x362d03[_0xe6e5('0x3b')],{'$or':_['map'](_0x362d03[_0xe6e5('0x34')],function(_0x4adc9e){var _0x5d5d2e={};_0x5d5d2e[_0x4adc9e]={'$like':'%'+_0xa15b63[_0xe6e5('0x33')][_0xe6e5('0x3d')]+'%'};return _0x5d5d2e;})});}_0x362d03=_[_0xe6e5('0x3e')]({},_0x362d03,_0xa15b63[_0xe6e5('0x40')]);return _0x21e555[_0xe6e5('0x84')](_0x362d03);}})['then'](function(_0x413678){if(_0x413678){_0x4d87cd=_0x413678[_0xe6e5('0x37')];if(!_0xa15b63[_0xe6e5('0x33')][_0xe6e5('0x38')](_0xe6e5('0x39'))){_0x362d03[_0xe6e5('0x20')]=qs[_0xe6e5('0x20')](_0xa15b63['query']['limit']);_0x362d03[_0xe6e5('0x1f')]=qs[_0xe6e5('0x1f')](_0xa15b63[_0xe6e5('0x33')]['offset']);}return _0x21e555[_0xe6e5('0x84')](_0x362d03);}})[_0xe6e5('0x26')](function(_0x32d139){if(_0x32d139){return _0x32d139?{'count':_0x4d87cd,'rows':_0x32d139}:null;}})[_0xe6e5('0x26')](respondWithResult(_0xb65e81,null))[_0xe6e5('0x44')](handleError(_0xb65e81,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 58aac49..2e7e174 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 _0xa46e=['../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x200a81,_0x330c6b){var _0x5c8a90=function(_0x1b0c49){while(--_0x1b0c49){_0x200a81['push'](_0x200a81['shift']());}};_0x5c8a90(++_0x330c6b);}(_0xa46e,0x13f));var _0xea46=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xa46e[_0x18f64a];return _0x44687f;};'use strict';var EventEmitter=require(_0xea46('0x0'));var WhatsappQueue=require(_0xea46('0x1'))['db'][_0xea46('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xea46('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xea46('0x4')};function emitEvent(_0x2d8052){return function(_0x329d73,_0x321176,_0x3480d4){WhatsappQueueEvents[_0xea46('0x5')](_0x2d8052+':'+_0x329d73['id'],_0x329d73);WhatsappQueueEvents['emit'](_0x2d8052,_0x329d73);_0x3480d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xea46('0x6')](e,emitEvent(event));}}module[_0xea46('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xae2f=['events','../../mysqldb','WhatsappQueue','save','remove','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae2f,0x70));var _0xfae2=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0xae2f[_0x1139d0];return _0xcc01a6;};'use strict';var EventEmitter=require(_0xfae2('0x0'));var WhatsappQueue=require(_0xfae2('0x1'))['db'][_0xfae2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfae2('0x3'),'afterUpdate':'update','afterDestroy':_0xfae2('0x4')};function emitEvent(_0x45ce86){return function(_0x473aff,_0x2eeaa4,_0x2d09e1){WhatsappQueueEvents[_0xfae2('0x5')](_0x45ce86+':'+_0x473aff['id'],_0x473aff);WhatsappQueueEvents[_0xfae2('0x5')](_0x45ce86,_0x473aff);_0x2d09e1(null);};}for(var e in events){if(events[_0xfae2('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xfae2('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 1e05ed5..a773a92 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 _0x1e4d=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x519036,_0x13f961){var _0x1147df=function(_0x30263f){while(--_0x30263f){_0x519036['push'](_0x519036['shift']());}};_0x1147df(++_0x13f961);}(_0x1e4d,0x1e9));var _0xd1e4=function(_0x11d637,_0x57ff64){_0x11d637=_0x11d637-0x0;var _0x182579=_0x1e4d[_0x11d637];return _0x182579;};'use strict';var _=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var logger=require(_0xd1e4('0x2'))('api');var moment=require(_0xd1e4('0x3'));var BPromise=require(_0xd1e4('0x4'));var rp=require(_0xd1e4('0x5'));var fs=require('fs');var path=require(_0xd1e4('0x6'));var rimraf=require(_0xd1e4('0x7'));var config=require(_0xd1e4('0x8'));var attributes=require(_0xd1e4('0x9'));module[_0xd1e4('0xa')]=function(_0x2ee513,_0x1caf27){return _0x2ee513[_0xd1e4('0xb')]('WhatsappQueue',attributes,{'tableName':_0xd1e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cc2=['api','moment','path','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x5cc2,0x8c));var _0x25cc=function(_0x442388,_0x1e67f9){_0x442388=_0x442388-0x0;var _0x421eed=_0x5cc2[_0x442388];return _0x421eed;};'use strict';var _=require(_0x25cc('0x0'));var util=require(_0x25cc('0x1'));var logger=require(_0x25cc('0x2'))(_0x25cc('0x3'));var moment=require(_0x25cc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x25cc('0x5'));var rimraf=require('rimraf');var config=require(_0x25cc('0x6'));var attributes=require(_0x25cc('0x7'));module['exports']=function(_0x4e7ce4,_0x168aca){return _0x4e7ce4[_0x25cc('0x8')](_0x25cc('0x9'),attributes,{'tableName':_0x25cc('0xa'),'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 bdd9d1e..07ce4a4 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 _0xcf80=['request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','model','map','ShowWhatsappQueue','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','register'];(function(_0x45d5ad,_0x348c32){var _0x3da492=function(_0x12aaeb){while(--_0x12aaeb){_0x45d5ad['push'](_0x45d5ad['shift']());}};_0x3da492(++_0x348c32);}(_0xcf80,0x1c7));var _0x0cf8=function(_0x4495cb,_0x3cab48){_0x4495cb=_0x4495cb-0x0;var _0x3c2818=_0xcf80[_0x4495cb];return _0x3c2818;};'use strict';var _=require(_0x0cf8('0x0'));var util=require('util');var moment=require(_0x0cf8('0x1'));var BPromise=require(_0x0cf8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cf8('0x3'));var db=require(_0x0cf8('0x4'))['db'];var utils=require(_0x0cf8('0x5'));var logger=require(_0x0cf8('0x6'))(_0x0cf8('0x7'));var config=require('../../config/environment');var jayson=require(_0x0cf8('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x0cf8('0x9')]=_[_0x0cf8('0xa')](config['redis'],{'host':_0x0cf8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cf8('0x9')]));require('./whatsappQueue.socket')[_0x0cf8('0xc')](socket);function respondWithRpcPromise(_0xfe88b6,_0x358a6c,_0xce6ae6){return new BPromise(function(_0x52213e,_0x4d2d1f){return client[_0x0cf8('0xd')](_0xfe88b6,_0xce6ae6)[_0x0cf8('0xe')](function(_0x10aa1e){logger['info'](_0x0cf8('0xf'),_0x358a6c,_0x0cf8('0x10'));logger[_0x0cf8('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x358a6c,_0x0cf8('0x10'),JSON[_0x0cf8('0x12')](_0x10aa1e));if(_0x10aa1e[_0x0cf8('0x13')]){if(_0x10aa1e[_0x0cf8('0x13')][_0x0cf8('0x14')]===0x1f4){logger[_0x0cf8('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x358a6c,_0x10aa1e['error'][_0x0cf8('0x15')]);return _0x4d2d1f(_0x10aa1e[_0x0cf8('0x13')][_0x0cf8('0x15')]);}logger[_0x0cf8('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x358a6c,_0x10aa1e[_0x0cf8('0x13')][_0x0cf8('0x15')]);return _0x52213e(_0x10aa1e['error'][_0x0cf8('0x15')]);}else{logger[_0x0cf8('0x16')](_0x0cf8('0xf'),_0x358a6c,'request\x20sent');_0x52213e(_0x10aa1e[_0x0cf8('0x17')][_0x0cf8('0x15')]);}})[_0x0cf8('0x18')](function(_0x5e8d65){logger[_0x0cf8('0x13')](_0x0cf8('0xf'),_0x358a6c,_0x5e8d65);_0x4d2d1f(_0x5e8d65);});});}exports[_0x0cf8('0x19')]=function(_0x592322){var _0x15fe64=this;return new Promise(function(_0x1ef3b3,_0x1c52e0){return db[_0x0cf8('0x1a')][_0x0cf8('0x1b')]({'raw':_0x592322[_0x0cf8('0x1c')]?_0x592322[_0x0cf8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x592322['options']?_0x592322[_0x0cf8('0x1c')][_0x0cf8('0x1d')]||null:null,'attributes':_0x592322['options']?_0x592322[_0x0cf8('0x1c')][_0x0cf8('0x1e')]||null:null,'limit':_0x592322['options']?_0x592322[_0x0cf8('0x1c')][_0x0cf8('0x1f')]||null:null,'include':_0x592322[_0x0cf8('0x1c')]?_0x592322['options'][_0x0cf8('0x20')]?_['map'](_0x592322[_0x0cf8('0x1c')][_0x0cf8('0x20')],function(_0x1aeb0f){return{'model':db[_0x1aeb0f[_0x0cf8('0x21')]],'as':_0x1aeb0f['as'],'attributes':_0x1aeb0f['attributes'],'include':_0x1aeb0f[_0x0cf8('0x20')]?_[_0x0cf8('0x22')](_0x1aeb0f[_0x0cf8('0x20')],function(_0x5b722){return{'model':db[_0x5b722[_0x0cf8('0x21')]],'as':_0x5b722['as'],'attributes':_0x5b722[_0x0cf8('0x1e')],'include':_0x5b722[_0x0cf8('0x20')]?_[_0x0cf8('0x22')](_0x5b722[_0x0cf8('0x20')],function(_0x129163){return{'model':db[_0x129163[_0x0cf8('0x21')]],'as':_0x129163['as'],'attributes':_0x129163[_0x0cf8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x704687){logger[_0x0cf8('0x16')](_0x0cf8('0x19'),_0x592322);logger[_0x0cf8('0x11')](_0x0cf8('0x19'),_0x592322,JSON['stringify'](_0x704687));_0x1ef3b3(_0x704687);})[_0x0cf8('0x18')](function(_0x161cac){logger[_0x0cf8('0x13')](_0x0cf8('0x19'),_0x161cac[_0x0cf8('0x15')],_0x592322);_0x1c52e0(_0x15fe64[_0x0cf8('0x13')](0x1f4,_0x161cac[_0x0cf8('0x15')]));});});};exports[_0x0cf8('0x23')]=function(_0x3fc928){var _0x4844b7=this;return new Promise(function(_0x47b797,_0x39962f){return db[_0x0cf8('0x1a')]['find']({'raw':_0x3fc928[_0x0cf8('0x1c')]?_0x3fc928[_0x0cf8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3fc928['options']?_0x3fc928['options'][_0x0cf8('0x1d')]||null:null,'attributes':_0x3fc928[_0x0cf8('0x1c')]?_0x3fc928[_0x0cf8('0x1c')][_0x0cf8('0x1e')]||null:null,'include':_0x3fc928[_0x0cf8('0x1c')]?_0x3fc928[_0x0cf8('0x1c')][_0x0cf8('0x20')]?_[_0x0cf8('0x22')](_0x3fc928['options'][_0x0cf8('0x20')],function(_0x3e19a0){return{'model':db[_0x3e19a0[_0x0cf8('0x21')]],'as':_0x3e19a0['as'],'attributes':_0x3e19a0[_0x0cf8('0x1e')],'include':_0x3e19a0[_0x0cf8('0x20')]?_[_0x0cf8('0x22')](_0x3e19a0[_0x0cf8('0x20')],function(_0x19df50){return{'model':db[_0x19df50['model']],'as':_0x19df50['as'],'attributes':_0x19df50[_0x0cf8('0x1e')],'include':_0x19df50[_0x0cf8('0x20')]?_['map'](_0x19df50['include'],function(_0x40df64){return{'model':db[_0x40df64[_0x0cf8('0x21')]],'as':_0x40df64['as'],'attributes':_0x40df64[_0x0cf8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33e17a){logger[_0x0cf8('0x16')](_0x0cf8('0x23'),_0x3fc928);logger[_0x0cf8('0x11')](_0x0cf8('0x23'),_0x3fc928,JSON[_0x0cf8('0x12')](_0x33e17a));_0x47b797(_0x33e17a);})[_0x0cf8('0x18')](function(_0xb7c1c6){logger[_0x0cf8('0x13')](_0x0cf8('0x23'),_0xb7c1c6[_0x0cf8('0x15')],_0x3fc928);_0x39962f(_0x4844b7['error'](0x1f4,_0xb7c1c6[_0x0cf8('0x15')]));});});}; \ No newline at end of file +var _0x3846=['redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','request\x20sent','debug','error','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','map','include','model','attributes','stringify','catch','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3846,0x1c9));var _0x6384=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x3846[_0xc87d08];return _0x30a714;};'use strict';var _=require(_0x6384('0x0'));var util=require(_0x6384('0x1'));var moment=require(_0x6384('0x2'));var BPromise=require(_0x6384('0x3'));var rs=require(_0x6384('0x4'));var fs=require('fs');var Redis=require(_0x6384('0x5'));var db=require(_0x6384('0x6'))['db'];var utils=require(_0x6384('0x7'));var logger=require(_0x6384('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6384('0x9')][_0x6384('0xa')]({'port':0x232a});config[_0x6384('0xb')]=_[_0x6384('0xc')](config[_0x6384('0xb')],{'host':_0x6384('0xd'),'port':0x18eb});var socket=require(_0x6384('0xe'))(new Redis(config[_0x6384('0xb')]));require(_0x6384('0xf'))['register'](socket);function respondWithRpcPromise(_0x1c45d1,_0x3ffc54,_0x385aaa){return new BPromise(function(_0x357909,_0x544a93){return client[_0x6384('0x10')](_0x1c45d1,_0x385aaa)[_0x6384('0x11')](function(_0x3ef290){logger[_0x6384('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x3ffc54,_0x6384('0x13'));logger[_0x6384('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3ffc54,_0x6384('0x13'),JSON['stringify'](_0x3ef290));if(_0x3ef290[_0x6384('0x15')]){if(_0x3ef290['error']['code']===0x1f4){logger[_0x6384('0x15')](_0x6384('0x16'),_0x3ffc54,_0x3ef290[_0x6384('0x15')]['message']);return _0x544a93(_0x3ef290[_0x6384('0x15')][_0x6384('0x17')]);}logger[_0x6384('0x15')](_0x6384('0x16'),_0x3ffc54,_0x3ef290[_0x6384('0x15')]['message']);return _0x357909(_0x3ef290['error'][_0x6384('0x17')]);}else{logger[_0x6384('0x12')](_0x6384('0x16'),_0x3ffc54,'request\x20sent');_0x357909(_0x3ef290[_0x6384('0x18')][_0x6384('0x17')]);}})['catch'](function(_0x5c1661){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x3ffc54,_0x5c1661);_0x544a93(_0x5c1661);});});}exports[_0x6384('0x19')]=function(_0x227f3d){var _0x4930ca=this;return new Promise(function(_0xe2612d,_0x5e0bb2){return db[_0x6384('0x1a')][_0x6384('0x1b')]({'raw':_0x227f3d[_0x6384('0x1c')]?_0x227f3d['options'][_0x6384('0x1d')]===undefined?!![]:![]:!![],'where':_0x227f3d[_0x6384('0x1c')]?_0x227f3d['options'][_0x6384('0x1e')]||null:null,'attributes':_0x227f3d[_0x6384('0x1c')]?_0x227f3d['options']['attributes']||null:null,'limit':_0x227f3d['options']?_0x227f3d['options'][_0x6384('0x1f')]||null:null,'include':_0x227f3d[_0x6384('0x1c')]?_0x227f3d[_0x6384('0x1c')]['include']?_[_0x6384('0x20')](_0x227f3d[_0x6384('0x1c')][_0x6384('0x21')],function(_0x65cea1){return{'model':db[_0x65cea1[_0x6384('0x22')]],'as':_0x65cea1['as'],'attributes':_0x65cea1[_0x6384('0x23')],'include':_0x65cea1['include']?_['map'](_0x65cea1[_0x6384('0x21')],function(_0x3fa9f9){return{'model':db[_0x3fa9f9['model']],'as':_0x3fa9f9['as'],'attributes':_0x3fa9f9[_0x6384('0x23')],'include':_0x3fa9f9[_0x6384('0x21')]?_['map'](_0x3fa9f9[_0x6384('0x21')],function(_0x2c9e42){return{'model':db[_0x2c9e42[_0x6384('0x22')]],'as':_0x2c9e42['as'],'attributes':_0x2c9e42[_0x6384('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57549f){logger['info'](_0x6384('0x19'),_0x227f3d);logger[_0x6384('0x14')](_0x6384('0x19'),_0x227f3d,JSON[_0x6384('0x24')](_0x57549f));_0xe2612d(_0x57549f);})[_0x6384('0x25')](function(_0x157505){logger[_0x6384('0x15')](_0x6384('0x19'),_0x157505[_0x6384('0x17')],_0x227f3d);_0x5e0bb2(_0x4930ca[_0x6384('0x15')](0x1f4,_0x157505[_0x6384('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x58a9a0){var _0x2a0161=this;return new Promise(function(_0x50fd5b,_0x1305d2){return db[_0x6384('0x1a')]['find']({'raw':_0x58a9a0['options']?_0x58a9a0[_0x6384('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x58a9a0[_0x6384('0x1c')]?_0x58a9a0[_0x6384('0x1c')]['where']||null:null,'attributes':_0x58a9a0[_0x6384('0x1c')]?_0x58a9a0[_0x6384('0x1c')][_0x6384('0x23')]||null:null,'include':_0x58a9a0[_0x6384('0x1c')]?_0x58a9a0[_0x6384('0x1c')][_0x6384('0x21')]?_['map'](_0x58a9a0[_0x6384('0x1c')][_0x6384('0x21')],function(_0x3826c6){return{'model':db[_0x3826c6[_0x6384('0x22')]],'as':_0x3826c6['as'],'attributes':_0x3826c6[_0x6384('0x23')],'include':_0x3826c6[_0x6384('0x21')]?_['map'](_0x3826c6[_0x6384('0x21')],function(_0x1401bd){return{'model':db[_0x1401bd[_0x6384('0x22')]],'as':_0x1401bd['as'],'attributes':_0x1401bd[_0x6384('0x23')],'include':_0x1401bd[_0x6384('0x21')]?_[_0x6384('0x20')](_0x1401bd[_0x6384('0x21')],function(_0x19915a){return{'model':db[_0x19915a[_0x6384('0x22')]],'as':_0x19915a['as'],'attributes':_0x19915a[_0x6384('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6384('0x11')](function(_0x4b0254){logger[_0x6384('0x12')](_0x6384('0x26'),_0x58a9a0);logger[_0x6384('0x14')](_0x6384('0x26'),_0x58a9a0,JSON[_0x6384('0x24')](_0x4b0254));_0x50fd5b(_0x4b0254);})['catch'](function(_0x2188c9){logger[_0x6384('0x15')](_0x6384('0x26'),_0x2188c9[_0x6384('0x17')],_0x58a9a0);_0x1305d2(_0x2a0161[_0x6384('0x15')](0x1f4,_0x2188c9[_0x6384('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ea1203f..5d7f5b1 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 _0x4d59=['whatsappQueue:','./whatsappQueue.events','save','remove','removeListener','length'];(function(_0x249e6f,_0x2765ea){var _0x32001e=function(_0x3bacdd){while(--_0x3bacdd){_0x249e6f['push'](_0x249e6f['shift']());}};_0x32001e(++_0x2765ea);}(_0x4d59,0x6d));var _0x94d5=function(_0x231200,_0x5b7ee1){_0x231200=_0x231200-0x0;var _0x303779=_0x4d59[_0x231200];return _0x303779;};'use strict';var WhatsappQueueEvents=require(_0x94d5('0x0'));var events=[_0x94d5('0x1'),_0x94d5('0x2'),'update'];function createListener(_0x1d38bd,_0x2e96cf){return function(_0x5bf58a){_0x2e96cf['emit'](_0x1d38bd,_0x5bf58a);};}function removeListener(_0x321915,_0x32096f){return function(){WhatsappQueueEvents[_0x94d5('0x3')](_0x321915,_0x32096f);};}exports['register']=function(_0x161b37){for(var _0x5d2e35=0x0,_0x35c771=events[_0x94d5('0x4')];_0x5d2e35<_0x35c771;_0x5d2e35++){var _0x15eb09=events[_0x5d2e35];var _0x5e5cb5=createListener(_0x94d5('0x5')+_0x15eb09,_0x161b37);WhatsappQueueEvents['on'](_0x15eb09,_0x5e5cb5);}}; \ No newline at end of file +var _0x1fb5=['length','whatsappQueue:','save','remove','emit','removeListener','register'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1fb5,0x159));var _0x51fb=function(_0x3fa6a4,_0x141a04){_0x3fa6a4=_0x3fa6a4-0x0;var _0x41099d=_0x1fb5[_0x3fa6a4];return _0x41099d;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x51fb('0x0'),_0x51fb('0x1'),'update'];function createListener(_0xfa5288,_0x571fd7){return function(_0x5b2aaa){_0x571fd7[_0x51fb('0x2')](_0xfa5288,_0x5b2aaa);};}function removeListener(_0x4a1dcc,_0x699397){return function(){WhatsappQueueEvents[_0x51fb('0x3')](_0x4a1dcc,_0x699397);};}exports[_0x51fb('0x4')]=function(_0x59e207){for(var _0x577652=0x0,_0x5ed032=events[_0x51fb('0x5')];_0x577652<_0x5ed032;_0x577652++){var _0x244953=events[_0x577652];var _0x59023a=createListener(_0x51fb('0x6')+_0x244953,_0x59e207);WhatsappQueueEvents['on'](_0x244953,_0x59023a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c91a642..7da1905 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 _0x2178=['isAuthenticated','index','/describe','describe','show','post','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get'];(function(_0x539d96,_0x5da022){var _0x431529=function(_0x617f16){while(--_0x617f16){_0x539d96['push'](_0x539d96['shift']());}};_0x431529(++_0x5da022);}(_0x2178,0x1b0));var _0x8217=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x2178[_0x270a54];return _0x4d07d0;};'use strict';var multer=require(_0x8217('0x0'));var util=require('util');var path=require(_0x8217('0x1'));var timeout=require(_0x8217('0x2'));var express=require(_0x8217('0x3'));var router=express['Router']();var auth=require(_0x8217('0x4'));var interaction=require(_0x8217('0x5'));var config=require('../../config/environment');var controller=require(_0x8217('0x6'));router[_0x8217('0x7')]('/',auth[_0x8217('0x8')](),controller[_0x8217('0x9')]);router[_0x8217('0x7')](_0x8217('0xa'),auth[_0x8217('0x8')](),controller[_0x8217('0xb')]);router[_0x8217('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8217('0xc')]);router[_0x8217('0xd')]('/',auth[_0x8217('0x8')](),controller['create']);router[_0x8217('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8217('0xf')]);router[_0x8217('0x10')](_0x8217('0x11'),auth[_0x8217('0x8')](),controller[_0x8217('0x12')]);module[_0x8217('0x13')]=router; \ No newline at end of file +var _0x5ef6=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','destroy'];(function(_0x558650,_0x171a01){var _0xdb77d2=function(_0x650036){while(--_0x650036){_0x558650['push'](_0x558650['shift']());}};_0xdb77d2(++_0x171a01);}(_0x5ef6,0xe8));var _0x65ef=function(_0x560b56,_0x2004b9){_0x560b56=_0x560b56-0x0;var _0x173c4e=_0x5ef6[_0x560b56];return _0x173c4e;};'use strict';var multer=require(_0x65ef('0x0'));var util=require(_0x65ef('0x1'));var path=require(_0x65ef('0x2'));var timeout=require(_0x65ef('0x3'));var express=require(_0x65ef('0x4'));var router=express[_0x65ef('0x5')]();var auth=require(_0x65ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65ef('0x7'));var controller=require(_0x65ef('0x8'));router[_0x65ef('0x9')]('/',auth[_0x65ef('0xa')](),controller[_0x65ef('0xb')]);router[_0x65ef('0x9')](_0x65ef('0xc'),auth['isAuthenticated'](),controller[_0x65ef('0xd')]);router[_0x65ef('0x9')]('/:id',auth[_0x65ef('0xa')](),controller[_0x65ef('0xe')]);router[_0x65ef('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65ef('0x10')](_0x65ef('0x11'),auth['isAuthenticated'](),controller[_0x65ef('0x12')]);router['delete'](_0x65ef('0x11'),auth[_0x65ef('0xa')](),controller[_0x65ef('0x13')]);module[_0x65ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 55be533..a597c74 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 _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x58b283,_0x4d4148){var _0x501a88=function(_0x23b2ff){while(--_0x23b2ff){_0x58b283['push'](_0x58b283['shift']());}};_0x501a88(++_0x4d4148);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x4b84[_0x3f25b2];return _0xd8caeb;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x33b23b,_0x226837){var _0x48d96a=function(_0x4e746e){while(--_0x4e746e){_0x33b23b['push'](_0x33b23b['shift']());}};_0x48d96a(++_0x226837);}(_0x55ca,0x126));var _0xa55c=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x55ca[_0x349367];return _0x14179b;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 1a87725..9fcff6d 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 _0x0b41=['findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include'];(function(_0x441f45,_0x16130c){var _0x2bc267=function(_0x44f8a4){while(--_0x44f8a4){_0x441f45['push'](_0x441f45['shift']());}};_0x2bc267(++_0x16130c);}(_0x0b41,0xf3));var _0x10b4=function(_0x446c10,_0x36313f){_0x446c10=_0x446c10-0x0;var _0x49d86c=_0x0b41[_0x446c10];return _0x49d86c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x10b4('0x0'));var rimraf=require(_0x10b4('0x1'));var zipdir=require(_0x10b4('0x2'));var jsonpatch=require(_0x10b4('0x3'));var rp=require(_0x10b4('0x4'));var moment=require(_0x10b4('0x5'));var BPromise=require(_0x10b4('0x6'));var Mustache=require(_0x10b4('0x7'));var util=require(_0x10b4('0x8'));var path=require(_0x10b4('0x9'));var sox=require(_0x10b4('0xa'));var csv=require(_0x10b4('0xb'));var ejs=require(_0x10b4('0xc'));var fs=require('fs');var _=require(_0x10b4('0xd'));var squel=require(_0x10b4('0xe'));var crypto=require(_0x10b4('0xf'));var jsforce=require(_0x10b4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x10b4('0xb'));var querystring=require(_0x10b4('0x11'));var Papa=require('papaparse');var Redis=require(_0x10b4('0x12'));var authService=require(_0x10b4('0x13'));var qs=require(_0x10b4('0x14'));var as=require(_0x10b4('0x15'));var hardwareService=require(_0x10b4('0x16'));var logger=require(_0x10b4('0x17'))(_0x10b4('0x18'));var utils=require(_0x10b4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x10b4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d230,_0x192c52){_0x192c52=_0x192c52||0xcc;return function(_0x2ddcae){if(_0x2ddcae){return _0x44d230[_0x10b4('0x1b')](_0x192c52);}return _0x44d230[_0x10b4('0x1c')](_0x192c52)[_0x10b4('0x1d')]();};}function respondWithResult(_0x423b2f,_0x1041d1){_0x1041d1=_0x1041d1||0xc8;return function(_0x5dd623){if(_0x5dd623){return _0x423b2f['status'](_0x1041d1)[_0x10b4('0x1e')](_0x5dd623);}};}function respondWithFilteredResult(_0x3b1b22,_0x53d134){return function(_0x36fb27){if(_0x36fb27){var _0x114180=_0x36fb27[_0x10b4('0x1f')],_0x57ec98=_0x53d134[_0x10b4('0x20')],_0x12abc4=_0x53d134[_0x10b4('0x20')]+_0x53d134[_0x10b4('0x21')],_0x24ac7d;if(_0x12abc4>=_0x114180){_0x12abc4=_0x114180;_0x24ac7d=0xc8;}else{_0x24ac7d=0xce;}_0x3b1b22[_0x10b4('0x1c')](_0x24ac7d);return _0x3b1b22[_0x10b4('0x22')](_0x10b4('0x23'),_0x57ec98+'-'+_0x12abc4+'/'+_0x114180)[_0x10b4('0x1e')](_0x36fb27);}return null;};}function patchUpdates(_0x1822e0){return function(_0x4d9353){try{jsonpatch[_0x10b4('0x24')](_0x4d9353,_0x1822e0,!![]);}catch(_0x1af2c9){return BPromise[_0x10b4('0x25')](_0x1af2c9);}return _0x4d9353[_0x10b4('0x26')]();};}function saveUpdates(_0x16d3d3,_0x4734de){return function(_0x89d4e5){if(_0x89d4e5){return _0x89d4e5[_0x10b4('0x27')](_0x16d3d3)[_0x10b4('0x28')](function(_0x23a534){return _0x23a534;});}return null;};}function removeEntity(_0x45136e,_0x1043be){return function(_0x26d551){if(_0x26d551){return _0x26d551[_0x10b4('0x29')]()['then'](function(){_0x45136e[_0x10b4('0x1c')](0xcc)[_0x10b4('0x1d')]();});}};}function handleEntityNotFound(_0x1e9e12,_0x10a161){return function(_0x264b49){if(!_0x264b49){_0x1e9e12[_0x10b4('0x1b')](0x194);}return _0x264b49;};}function handleError(_0x206315,_0x2bd3f6){_0x2bd3f6=_0x2bd3f6||0x1f4;return function(_0x17b047){logger[_0x10b4('0x2a')](_0x17b047['stack']);if(_0x17b047[_0x10b4('0x2b')]){delete _0x17b047['name'];}_0x206315[_0x10b4('0x1c')](_0x2bd3f6)[_0x10b4('0x2c')](_0x17b047);};}exports[_0x10b4('0x2d')]=function(_0x396625,_0x3118c6){var _0x4e4c06={},_0x513154={},_0xfad3c7={'count':0x0,'rows':[]};var _0x2b5dc6=_['map'](db[_0x10b4('0x2e')][_0x10b4('0x2f')],function(_0x3359c5){return{'name':_0x3359c5[_0x10b4('0x30')],'type':_0x3359c5['type'][_0x10b4('0x31')]};});_0x513154['model']=_[_0x10b4('0x32')](_0x2b5dc6,_0x10b4('0x2b'));_0x513154[_0x10b4('0x33')]=_[_0x10b4('0x34')](_0x396625[_0x10b4('0x33')]);_0x513154[_0x10b4('0x35')]=_[_0x10b4('0x36')](_0x513154[_0x10b4('0x37')],_0x513154[_0x10b4('0x33')]);_0x4e4c06[_0x10b4('0x38')]=_[_0x10b4('0x36')](_0x513154['model'],qs[_0x10b4('0x39')](_0x396625[_0x10b4('0x33')][_0x10b4('0x39')]));_0x4e4c06['attributes']=_0x4e4c06[_0x10b4('0x38')][_0x10b4('0x3a')]?_0x4e4c06[_0x10b4('0x38')]:_0x513154[_0x10b4('0x37')];if(!_0x396625[_0x10b4('0x33')]['hasOwnProperty'](_0x10b4('0x3b'))){_0x4e4c06['limit']=qs[_0x10b4('0x21')](_0x396625[_0x10b4('0x33')][_0x10b4('0x21')]);_0x4e4c06[_0x10b4('0x20')]=qs[_0x10b4('0x20')](_0x396625[_0x10b4('0x33')][_0x10b4('0x20')]);}_0x4e4c06[_0x10b4('0x3c')]=qs['sort'](_0x396625[_0x10b4('0x33')][_0x10b4('0x3d')]);_0x4e4c06[_0x10b4('0x3e')]=qs[_0x10b4('0x35')](_[_0x10b4('0x3f')](_0x396625[_0x10b4('0x33')],_0x513154[_0x10b4('0x35')]),_0x2b5dc6);if(_0x396625[_0x10b4('0x33')]['filter']){_0x4e4c06[_0x10b4('0x3e')]=_[_0x10b4('0x40')](_0x4e4c06['where'],{'$or':_[_0x10b4('0x32')](_0x2b5dc6,function(_0x24b5fe){if(_0x24b5fe['type']!==_0x10b4('0x41')){var _0x3e3fe0={};_0x3e3fe0[_0x24b5fe[_0x10b4('0x2b')]]={'$like':'%'+_0x396625[_0x10b4('0x33')][_0x10b4('0x42')]+'%'};return _0x3e3fe0;}})});}_0x4e4c06=_[_0x10b4('0x40')]({},_0x4e4c06,_0x396625[_0x10b4('0x43')]);var _0x556994={'where':_0x4e4c06[_0x10b4('0x3e')]};return db[_0x10b4('0x2e')][_0x10b4('0x1f')](_0x556994)['then'](function(_0xc6c8fb){_0xfad3c7[_0x10b4('0x1f')]=_0xc6c8fb;if(_0x396625['query']['includeAll']){_0x4e4c06[_0x10b4('0x44')]=[{'all':!![]}];}return db[_0x10b4('0x2e')][_0x10b4('0x45')](_0x4e4c06);})[_0x10b4('0x28')](function(_0x16e89f){_0xfad3c7[_0x10b4('0x46')]=_0x16e89f;return _0xfad3c7;})['then'](respondWithFilteredResult(_0x3118c6,_0x4e4c06))[_0x10b4('0x47')](handleError(_0x3118c6,null));};exports['show']=function(_0x2945e7,_0x3def6b){var _0x504a21={'raw':!![],'where':{'id':_0x2945e7[_0x10b4('0x48')]['id']}},_0x2a275b={};_0x2a275b[_0x10b4('0x37')]=_[_0x10b4('0x34')](db[_0x10b4('0x2e')][_0x10b4('0x2f')]);_0x2a275b['query']=_[_0x10b4('0x34')](_0x2945e7['query']);_0x2a275b[_0x10b4('0x35')]=_[_0x10b4('0x36')](_0x2a275b[_0x10b4('0x37')],_0x2a275b['query']);_0x504a21[_0x10b4('0x38')]=_[_0x10b4('0x36')](_0x2a275b[_0x10b4('0x37')],qs[_0x10b4('0x39')](_0x2945e7[_0x10b4('0x33')][_0x10b4('0x39')]));_0x504a21[_0x10b4('0x38')]=_0x504a21[_0x10b4('0x38')][_0x10b4('0x3a')]?_0x504a21['attributes']:_0x2a275b[_0x10b4('0x37')];if(_0x2945e7[_0x10b4('0x33')][_0x10b4('0x49')]){_0x504a21[_0x10b4('0x44')]=[{'all':!![]}];}_0x504a21=_[_0x10b4('0x40')]({},_0x504a21,_0x2945e7[_0x10b4('0x43')]);return db[_0x10b4('0x2e')][_0x10b4('0x4a')](_0x504a21)['then'](handleEntityNotFound(_0x3def6b,null))[_0x10b4('0x28')](respondWithResult(_0x3def6b,null))[_0x10b4('0x47')](handleError(_0x3def6b,null));};exports[_0x10b4('0x4b')]=function(_0x403ef2,_0x560bda){return db[_0x10b4('0x2e')][_0x10b4('0x4b')](_0x403ef2[_0x10b4('0x4c')],{})[_0x10b4('0x28')](respondWithResult(_0x560bda,0xc9))[_0x10b4('0x47')](handleError(_0x560bda,null));};exports[_0x10b4('0x27')]=function(_0x4c7974,_0x149145){if(_0x4c7974[_0x10b4('0x4c')]['id']){delete _0x4c7974[_0x10b4('0x4c')]['id'];}return db['WhatsappQueueReport'][_0x10b4('0x4a')]({'where':{'id':_0x4c7974[_0x10b4('0x48')]['id']}})[_0x10b4('0x28')](handleEntityNotFound(_0x149145,null))['then'](saveUpdates(_0x4c7974[_0x10b4('0x4c')],null))['then'](respondWithResult(_0x149145,null))[_0x10b4('0x47')](handleError(_0x149145,null));};exports[_0x10b4('0x29')]=function(_0x104169,_0x11ae73){return db[_0x10b4('0x2e')][_0x10b4('0x4a')]({'where':{'id':_0x104169[_0x10b4('0x48')]['id']}})[_0x10b4('0x28')](handleEntityNotFound(_0x11ae73,null))[_0x10b4('0x28')](removeEntity(_0x11ae73,null))[_0x10b4('0x47')](handleError(_0x11ae73,null));};exports[_0x10b4('0x4d')]=function(_0x1c6687,_0x1b77f8){return db[_0x10b4('0x2e')]['describe']()[_0x10b4('0x28')](respondWithResult(_0x1b77f8,null))[_0x10b4('0x47')](handleError(_0x1b77f8,null));}; \ No newline at end of file +var _0x3215=['WhatsappQueueReport','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','then','includeAll','include'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x3215,0xb0));var _0x5321=function(_0x3a23e9,_0x232c0f){_0x3a23e9=_0x3a23e9-0x0;var _0x4693ab=_0x3215[_0x3a23e9];return _0x4693ab;};'use strict';var pdf=require(_0x5321('0x0'));var emlformat=require(_0x5321('0x1'));var rimraf=require(_0x5321('0x2'));var zipdir=require(_0x5321('0x3'));var jsonpatch=require(_0x5321('0x4'));var rp=require(_0x5321('0x5'));var moment=require(_0x5321('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5321('0x7'));var util=require(_0x5321('0x8'));var path=require(_0x5321('0x9'));var sox=require(_0x5321('0xa'));var csv=require(_0x5321('0xb'));var ejs=require(_0x5321('0xc'));var fs=require('fs');var _=require(_0x5321('0xd'));var squel=require('squel');var crypto=require(_0x5321('0xe'));var jsforce=require(_0x5321('0xf'));var deskjs=require(_0x5321('0x10'));var toCsv=require(_0x5321('0xb'));var querystring=require(_0x5321('0x11'));var Papa=require(_0x5321('0x12'));var Redis=require(_0x5321('0x13'));var authService=require(_0x5321('0x14'));var qs=require(_0x5321('0x15'));var as=require(_0x5321('0x16'));var hardwareService=require(_0x5321('0x17'));var logger=require(_0x5321('0x18'))(_0x5321('0x19'));var utils=require(_0x5321('0x1a'));var config=require(_0x5321('0x1b'));var licenseUtil=require(_0x5321('0x1c'));var db=require(_0x5321('0x1d'))['db'];function respondWithStatusCode(_0x181f16,_0x391fe2){_0x391fe2=_0x391fe2||0xcc;return function(_0x4a96fc){if(_0x4a96fc){return _0x181f16[_0x5321('0x1e')](_0x391fe2);}return _0x181f16[_0x5321('0x1f')](_0x391fe2)[_0x5321('0x20')]();};}function respondWithResult(_0x449b6a,_0xf3fd2b){_0xf3fd2b=_0xf3fd2b||0xc8;return function(_0x16c3e9){if(_0x16c3e9){return _0x449b6a[_0x5321('0x1f')](_0xf3fd2b)[_0x5321('0x21')](_0x16c3e9);}};}function respondWithFilteredResult(_0x319659,_0x272aae){return function(_0xe11596){if(_0xe11596){var _0x586971=_0xe11596[_0x5321('0x22')],_0x5118d7=_0x272aae[_0x5321('0x23')],_0x125e85=_0x272aae[_0x5321('0x23')]+_0x272aae[_0x5321('0x24')],_0x2c500d;if(_0x125e85>=_0x586971){_0x125e85=_0x586971;_0x2c500d=0xc8;}else{_0x2c500d=0xce;}_0x319659[_0x5321('0x1f')](_0x2c500d);return _0x319659[_0x5321('0x25')](_0x5321('0x26'),_0x5118d7+'-'+_0x125e85+'/'+_0x586971)[_0x5321('0x21')](_0xe11596);}return null;};}function patchUpdates(_0x2cdae2){return function(_0xf89984){try{jsonpatch[_0x5321('0x27')](_0xf89984,_0x2cdae2,!![]);}catch(_0x14ebe6){return BPromise[_0x5321('0x28')](_0x14ebe6);}return _0xf89984[_0x5321('0x29')]();};}function saveUpdates(_0x411da3,_0x23a0b2){return function(_0x27da15){if(_0x27da15){return _0x27da15[_0x5321('0x2a')](_0x411da3)['then'](function(_0x38bdd5){return _0x38bdd5;});}return null;};}function removeEntity(_0x5cf5c5,_0x209edd){return function(_0x3ea96c){if(_0x3ea96c){return _0x3ea96c[_0x5321('0x2b')]()['then'](function(){_0x5cf5c5[_0x5321('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc2ac43,_0xdd40d0){return function(_0x1b0374){if(!_0x1b0374){_0xc2ac43[_0x5321('0x1e')](0x194);}return _0x1b0374;};}function handleError(_0x118a2e,_0x1d7ee4){_0x1d7ee4=_0x1d7ee4||0x1f4;return function(_0x4fd5b1){logger[_0x5321('0x2c')](_0x4fd5b1[_0x5321('0x2d')]);if(_0x4fd5b1[_0x5321('0x2e')]){delete _0x4fd5b1[_0x5321('0x2e')];}_0x118a2e['status'](_0x1d7ee4)['send'](_0x4fd5b1);};}exports[_0x5321('0x2f')]=function(_0x7fbab5,_0x34d0ca){var _0x369429={},_0x1d1e3a={},_0x202116={'count':0x0,'rows':[]};var _0x4f1435=_[_0x5321('0x30')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3d86b3){return{'name':_0x3d86b3[_0x5321('0x31')],'type':_0x3d86b3[_0x5321('0x32')][_0x5321('0x33')]};});_0x1d1e3a['model']=_[_0x5321('0x30')](_0x4f1435,'name');_0x1d1e3a['query']=_[_0x5321('0x34')](_0x7fbab5[_0x5321('0x35')]);_0x1d1e3a[_0x5321('0x36')]=_['intersection'](_0x1d1e3a[_0x5321('0x37')],_0x1d1e3a['query']);_0x369429[_0x5321('0x38')]=_['intersection'](_0x1d1e3a[_0x5321('0x37')],qs[_0x5321('0x39')](_0x7fbab5['query'][_0x5321('0x39')]));_0x369429[_0x5321('0x38')]=_0x369429['attributes'][_0x5321('0x3a')]?_0x369429[_0x5321('0x38')]:_0x1d1e3a[_0x5321('0x37')];if(!_0x7fbab5['query'][_0x5321('0x3b')](_0x5321('0x3c'))){_0x369429[_0x5321('0x24')]=qs['limit'](_0x7fbab5[_0x5321('0x35')][_0x5321('0x24')]);_0x369429[_0x5321('0x23')]=qs[_0x5321('0x23')](_0x7fbab5[_0x5321('0x35')][_0x5321('0x23')]);}_0x369429[_0x5321('0x3d')]=qs[_0x5321('0x3e')](_0x7fbab5[_0x5321('0x35')][_0x5321('0x3e')]);_0x369429['where']=qs[_0x5321('0x36')](_['pick'](_0x7fbab5[_0x5321('0x35')],_0x1d1e3a[_0x5321('0x36')]),_0x4f1435);if(_0x7fbab5[_0x5321('0x35')][_0x5321('0x3f')]){_0x369429['where']=_['merge'](_0x369429[_0x5321('0x40')],{'$or':_['map'](_0x4f1435,function(_0x1673f7){if(_0x1673f7[_0x5321('0x32')]!==_0x5321('0x41')){var _0x39003a={};_0x39003a[_0x1673f7[_0x5321('0x2e')]]={'$like':'%'+_0x7fbab5[_0x5321('0x35')][_0x5321('0x3f')]+'%'};return _0x39003a;}})});}_0x369429=_[_0x5321('0x42')]({},_0x369429,_0x7fbab5['options']);var _0x331331={'where':_0x369429[_0x5321('0x40')]};return db['WhatsappQueueReport'][_0x5321('0x22')](_0x331331)[_0x5321('0x43')](function(_0x2077f5){_0x202116[_0x5321('0x22')]=_0x2077f5;if(_0x7fbab5[_0x5321('0x35')][_0x5321('0x44')]){_0x369429[_0x5321('0x45')]=[{'all':!![]}];}return db[_0x5321('0x46')][_0x5321('0x47')](_0x369429);})[_0x5321('0x43')](function(_0x16b1c7){_0x202116[_0x5321('0x48')]=_0x16b1c7;return _0x202116;})[_0x5321('0x43')](respondWithFilteredResult(_0x34d0ca,_0x369429))[_0x5321('0x49')](handleError(_0x34d0ca,null));};exports[_0x5321('0x4a')]=function(_0x2fbe38,_0x3bc5b9){var _0x1f8f9f={'raw':!![],'where':{'id':_0x2fbe38[_0x5321('0x4b')]['id']}},_0x151201={};_0x151201[_0x5321('0x37')]=_[_0x5321('0x34')](db['WhatsappQueueReport'][_0x5321('0x4c')]);_0x151201[_0x5321('0x35')]=_[_0x5321('0x34')](_0x2fbe38[_0x5321('0x35')]);_0x151201[_0x5321('0x36')]=_[_0x5321('0x4d')](_0x151201[_0x5321('0x37')],_0x151201[_0x5321('0x35')]);_0x1f8f9f[_0x5321('0x38')]=_[_0x5321('0x4d')](_0x151201['model'],qs[_0x5321('0x39')](_0x2fbe38[_0x5321('0x35')][_0x5321('0x39')]));_0x1f8f9f[_0x5321('0x38')]=_0x1f8f9f[_0x5321('0x38')][_0x5321('0x3a')]?_0x1f8f9f[_0x5321('0x38')]:_0x151201[_0x5321('0x37')];if(_0x2fbe38[_0x5321('0x35')][_0x5321('0x44')]){_0x1f8f9f[_0x5321('0x45')]=[{'all':!![]}];}_0x1f8f9f=_[_0x5321('0x42')]({},_0x1f8f9f,_0x2fbe38['options']);return db[_0x5321('0x46')][_0x5321('0x4e')](_0x1f8f9f)['then'](handleEntityNotFound(_0x3bc5b9,null))[_0x5321('0x43')](respondWithResult(_0x3bc5b9,null))['catch'](handleError(_0x3bc5b9,null));};exports['create']=function(_0xeb312b,_0x266d88){return db[_0x5321('0x46')][_0x5321('0x4f')](_0xeb312b[_0x5321('0x50')],{})[_0x5321('0x43')](respondWithResult(_0x266d88,0xc9))[_0x5321('0x49')](handleError(_0x266d88,null));};exports[_0x5321('0x2a')]=function(_0x4512f3,_0x351db6){if(_0x4512f3[_0x5321('0x50')]['id']){delete _0x4512f3[_0x5321('0x50')]['id'];}return db[_0x5321('0x46')][_0x5321('0x4e')]({'where':{'id':_0x4512f3['params']['id']}})[_0x5321('0x43')](handleEntityNotFound(_0x351db6,null))[_0x5321('0x43')](saveUpdates(_0x4512f3['body'],null))['then'](respondWithResult(_0x351db6,null))[_0x5321('0x49')](handleError(_0x351db6,null));};exports['destroy']=function(_0x47faca,_0x44ec37){return db[_0x5321('0x46')][_0x5321('0x4e')]({'where':{'id':_0x47faca[_0x5321('0x4b')]['id']}})[_0x5321('0x43')](handleEntityNotFound(_0x44ec37,null))['then'](removeEntity(_0x44ec37,null))['catch'](handleError(_0x44ec37,null));};exports[_0x5321('0x51')]=function(_0x96861c,_0x19ae28){return db[_0x5321('0x46')]['describe']()['then'](respondWithResult(_0x19ae28,null))[_0x5321('0x49')](handleError(_0x19ae28,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 80f14c3..31b2046 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 _0x85ac=['../../config/environment','exports','WhatsappQueueReport','report_whatsapp_queue','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x85ac,0x7d));var _0xc85a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x85ac[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xc85a('0x0'));var util=require(_0xc85a('0x1'));var logger=require(_0xc85a('0x2'))('api');var moment=require(_0xc85a('0x3'));var BPromise=require('bluebird');var rp=require(_0xc85a('0x4'));var fs=require('fs');var path=require(_0xc85a('0x5'));var rimraf=require(_0xc85a('0x6'));var config=require(_0xc85a('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xc85a('0x8')]=function(_0x3a30cc,_0x2d86b3){return _0x3a30cc['define'](_0xc85a('0x9'),attributes,{'tableName':_0xc85a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c6e=['bluebird','request-promise','rimraf','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','api','moment'];(function(_0x2f68a3,_0x535fe3){var _0x144be1=function(_0x184e5f){while(--_0x184e5f){_0x2f68a3['push'](_0x2f68a3['shift']());}};_0x144be1(++_0x535fe3);}(_0x5c6e,0xad));var _0xe5c6=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x5c6e[_0x4409e7];return _0x24c751;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe5c6('0x0'))(_0xe5c6('0x1'));var moment=require(_0xe5c6('0x2'));var BPromise=require(_0xe5c6('0x3'));var rp=require(_0xe5c6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5c6('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0xe5c6('0x6')]=function(_0x30b470,_0x1d8f16){return _0x30b470[_0xe5c6('0x7')](_0xe5c6('0x8'),attributes,{'tableName':_0xe5c6('0x9'),'paranoid':![],'indexes':[{'name':_0xe5c6('0xa'),'fields':[_0xe5c6('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 5b54d96..0110096 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 _0xa5eb=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappQueueReport','create','options','raw','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc8f494,_0x561bbc){var _0x1faf44=function(_0x131672){while(--_0x131672){_0xc8f494['push'](_0xc8f494['shift']());}};_0x1faf44(++_0x561bbc);}(_0xa5eb,0x19b));var _0xba5e=function(_0x274e7e,_0x554fec){_0x274e7e=_0x274e7e-0x0;var _0x2462be=_0xa5eb[_0x274e7e];return _0x2462be;};'use strict';var _=require('lodash');var util=require(_0xba5e('0x0'));var moment=require(_0xba5e('0x1'));var BPromise=require(_0xba5e('0x2'));var rs=require(_0xba5e('0x3'));var fs=require('fs');var Redis=require(_0xba5e('0x4'));var db=require(_0xba5e('0x5'))['db'];var utils=require(_0xba5e('0x6'));var logger=require(_0xba5e('0x7'))(_0xba5e('0x8'));var config=require(_0xba5e('0x9'));var jayson=require(_0xba5e('0xa'));var client=jayson[_0xba5e('0xb')][_0xba5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb84545,_0x3e78e2,_0x401425){return new BPromise(function(_0x4e2c9e,_0x28fafb){return client[_0xba5e('0xd')](_0xb84545,_0x401425)[_0xba5e('0xe')](function(_0x3d1a0a){logger[_0xba5e('0xf')](_0xba5e('0x10'),_0x3e78e2,_0xba5e('0x11'));logger[_0xba5e('0x12')](_0xba5e('0x13'),_0x3e78e2,'request\x20sent',JSON[_0xba5e('0x14')](_0x3d1a0a));if(_0x3d1a0a[_0xba5e('0x15')]){if(_0x3d1a0a['error'][_0xba5e('0x16')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3e78e2,_0x3d1a0a[_0xba5e('0x15')][_0xba5e('0x17')]);return _0x28fafb(_0x3d1a0a['error']['message']);}logger['error'](_0xba5e('0x10'),_0x3e78e2,_0x3d1a0a[_0xba5e('0x15')][_0xba5e('0x17')]);return _0x4e2c9e(_0x3d1a0a['error']['message']);}else{logger[_0xba5e('0xf')](_0xba5e('0x10'),_0x3e78e2,_0xba5e('0x11'));_0x4e2c9e(_0x3d1a0a['result'][_0xba5e('0x17')]);}})['catch'](function(_0x4c5bf6){logger['error'](_0xba5e('0x10'),_0x3e78e2,_0x4c5bf6);_0x28fafb(_0x4c5bf6);});});}exports[_0xba5e('0x18')]=function(_0x3d1b13){var _0x360766=this;return new Promise(function(_0x5ca005,_0x27df24){return db['WhatsappQueueReport'][_0xba5e('0x19')](_0x3d1b13['body'],{'raw':_0x3d1b13[_0xba5e('0x1a')]?_0x3d1b13['options'][_0xba5e('0x1b')]===undefined?!![]:![]:!![]})[_0xba5e('0xe')](function(_0x1c8d3f){logger[_0xba5e('0xf')](_0xba5e('0x18'),_0x3d1b13);logger[_0xba5e('0x12')]('CreateWhatsappQueueReport',_0x3d1b13,JSON['stringify'](_0x1c8d3f));_0x5ca005(_0x1c8d3f);})[_0xba5e('0x1c')](function(_0x1acdfa){logger[_0xba5e('0x15')](_0xba5e('0x18'),_0x1acdfa['message'],_0x3d1b13);_0x27df24(_0x360766[_0xba5e('0x15')](0x1f4,_0x1acdfa['message']));});});};exports[_0xba5e('0x1d')]=function(_0x38beb5){var _0x1772da=this;return new Promise(function(_0x1e82d8,_0x140cb8){return db[_0xba5e('0x1e')][_0xba5e('0x1f')](_0x38beb5['body'],{'raw':_0x38beb5[_0xba5e('0x1a')]?_0x38beb5[_0xba5e('0x1a')][_0xba5e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38beb5[_0xba5e('0x1a')]?_0x38beb5['options'][_0xba5e('0x20')]||null:null,'attributes':_0x38beb5[_0xba5e('0x1a')]?_0x38beb5['options'][_0xba5e('0x21')]||null:null,'limit':_0x38beb5[_0xba5e('0x1a')]?_0x38beb5['options'][_0xba5e('0x22')]||null:null})[_0xba5e('0xe')](function(_0x5813f5){logger[_0xba5e('0xf')]('UpdateWhatsappQueueReport',_0x38beb5);logger['debug']('UpdateWhatsappQueueReport',_0x38beb5,JSON[_0xba5e('0x14')](_0x5813f5));_0x1e82d8(_0x5813f5);})[_0xba5e('0x1c')](function(_0x5b8e9b){logger[_0xba5e('0x15')]('UpdateWhatsappQueueReport',_0x5b8e9b[_0xba5e('0x17')],_0x38beb5);_0x140cb8(_0x1772da[_0xba5e('0x15')](0x1f4,_0x5b8e9b['message']));});});}; \ No newline at end of file +var _0x27ed=['result','catch','WhatsappQueueReport','create','options','raw','info','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x27ed,0x1db));var _0xd27e=function(_0x534897,_0x51d8ef){_0x534897=_0x534897-0x0;var _0x37d0fb=_0x27ed[_0x534897];return _0x37d0fb;};'use strict';var _=require(_0xd27e('0x0'));var util=require(_0xd27e('0x1'));var moment=require(_0xd27e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd27e('0x3'));var fs=require('fs');var Redis=require(_0xd27e('0x4'));var db=require(_0xd27e('0x5'))['db'];var utils=require(_0xd27e('0x6'));var logger=require(_0xd27e('0x7'))(_0xd27e('0x8'));var config=require(_0xd27e('0x9'));var jayson=require(_0xd27e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4b7d,_0x22cbdc,_0x1e15c4){return new BPromise(function(_0x11a69d,_0x570e19){return client[_0xd27e('0xb')](_0x3c4b7d,_0x1e15c4)[_0xd27e('0xc')](function(_0x4d1dee){logger['info'](_0xd27e('0xd'),_0x22cbdc,_0xd27e('0xe'));logger[_0xd27e('0xf')](_0xd27e('0x10'),_0x22cbdc,_0xd27e('0xe'),JSON['stringify'](_0x4d1dee));if(_0x4d1dee[_0xd27e('0x11')]){if(_0x4d1dee[_0xd27e('0x11')][_0xd27e('0x12')]===0x1f4){logger[_0xd27e('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x22cbdc,_0x4d1dee[_0xd27e('0x11')][_0xd27e('0x13')]);return _0x570e19(_0x4d1dee['error'][_0xd27e('0x13')]);}logger['error'](_0xd27e('0xd'),_0x22cbdc,_0x4d1dee[_0xd27e('0x11')][_0xd27e('0x13')]);return _0x11a69d(_0x4d1dee[_0xd27e('0x11')]['message']);}else{logger['info'](_0xd27e('0xd'),_0x22cbdc,_0xd27e('0xe'));_0x11a69d(_0x4d1dee[_0xd27e('0x14')][_0xd27e('0x13')]);}})[_0xd27e('0x15')](function(_0x18287c){logger[_0xd27e('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x22cbdc,_0x18287c);_0x570e19(_0x18287c);});});}exports['CreateWhatsappQueueReport']=function(_0x57e9ac){var _0x288951=this;return new Promise(function(_0x4c4ef3,_0x48f011){return db[_0xd27e('0x16')][_0xd27e('0x17')](_0x57e9ac['body'],{'raw':_0x57e9ac[_0xd27e('0x18')]?_0x57e9ac[_0xd27e('0x18')][_0xd27e('0x19')]===undefined?!![]:![]:!![]})[_0xd27e('0xc')](function(_0x5d28ba){logger[_0xd27e('0x1a')](_0xd27e('0x1b'),_0x57e9ac);logger[_0xd27e('0xf')]('CreateWhatsappQueueReport',_0x57e9ac,JSON[_0xd27e('0x1c')](_0x5d28ba));_0x4c4ef3(_0x5d28ba);})[_0xd27e('0x15')](function(_0x3cb831){logger[_0xd27e('0x11')](_0xd27e('0x1b'),_0x3cb831[_0xd27e('0x13')],_0x57e9ac);_0x48f011(_0x288951[_0xd27e('0x11')](0x1f4,_0x3cb831['message']));});});};exports[_0xd27e('0x1d')]=function(_0xd88033){var _0x3f35ee=this;return new Promise(function(_0xccfe69,_0x5c159c){return db['WhatsappQueueReport'][_0xd27e('0x1e')](_0xd88033[_0xd27e('0x1f')],{'raw':_0xd88033['options']?_0xd88033[_0xd27e('0x18')][_0xd27e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd88033[_0xd27e('0x18')]?_0xd88033[_0xd27e('0x18')][_0xd27e('0x20')]||null:null,'attributes':_0xd88033['options']?_0xd88033[_0xd27e('0x18')]['attributes']||null:null,'limit':_0xd88033[_0xd27e('0x18')]?_0xd88033[_0xd27e('0x18')]['limit']||null:null})['then'](function(_0x127d93){logger['info']('UpdateWhatsappQueueReport',_0xd88033);logger[_0xd27e('0xf')](_0xd27e('0x1d'),_0xd88033,JSON[_0xd27e('0x1c')](_0x127d93));_0xccfe69(_0x127d93);})['catch'](function(_0x196352){logger[_0xd27e('0x11')](_0xd27e('0x1d'),_0x196352['message'],_0xd88033);_0x5c159c(_0x3f35ee[_0xd27e('0x11')](0x1f4,_0x196352['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index bf952cc..f3f0221 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 _0x72c8=['isAuthenticated','index','/describe','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x72c8,0x8e));var _0x872c=function(_0xc7cb26,_0x56b847){_0xc7cb26=_0xc7cb26-0x0;var _0x2d22ec=_0x72c8[_0xc7cb26];return _0x2d22ec;};'use strict';var multer=require(_0x872c('0x0'));var util=require(_0x872c('0x1'));var path=require(_0x872c('0x2'));var timeout=require(_0x872c('0x3'));var express=require(_0x872c('0x4'));var router=express[_0x872c('0x5')]();var auth=require(_0x872c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x872c('0x7'));var controller=require(_0x872c('0x8'));router[_0x872c('0x9')]('/',auth[_0x872c('0xa')](),controller[_0x872c('0xb')]);router[_0x872c('0x9')](_0x872c('0xc'),auth[_0x872c('0xa')](),controller['describe']);router['get']('/:id',auth[_0x872c('0xa')](),controller['show']);router[_0x872c('0xd')]('/',auth[_0x872c('0xa')](),controller['create']);router['put'](_0x872c('0xe'),auth[_0x872c('0xa')](),controller[_0x872c('0xf')]);router[_0x872c('0x10')]('/:id',auth[_0x872c('0xa')](),controller[_0x872c('0x11')]);module[_0x872c('0x12')]=router; \ No newline at end of file +var _0xc0b9=['exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc0b9,0x119));var _0x9c0b=function(_0x54aed9,_0x48c31c){_0x54aed9=_0x54aed9-0x0;var _0x41e8a6=_0xc0b9[_0x54aed9];return _0x41e8a6;};'use strict';var multer=require('multer');var util=require(_0x9c0b('0x0'));var path=require(_0x9c0b('0x1'));var timeout=require(_0x9c0b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9c0b('0x3'));var interaction=require(_0x9c0b('0x4'));var config=require(_0x9c0b('0x5'));var controller=require(_0x9c0b('0x6'));router[_0x9c0b('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c0b('0x8')]);router['get'](_0x9c0b('0x9'),auth[_0x9c0b('0xa')](),controller[_0x9c0b('0xb')]);router[_0x9c0b('0x7')](_0x9c0b('0xc'),auth[_0x9c0b('0xa')](),controller[_0x9c0b('0xd')]);router[_0x9c0b('0xe')]('/',auth[_0x9c0b('0xa')](),controller[_0x9c0b('0xf')]);router[_0x9c0b('0x10')](_0x9c0b('0xc'),auth[_0x9c0b('0xa')](),controller['update']);router[_0x9c0b('0x11')]('/:id',auth[_0x9c0b('0xa')](),controller[_0x9c0b('0x12')]);module[_0x9c0b('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 cc4668f..9f8b874 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xb10b,0x12a));var _0xbb10=function(_0x161299,_0x4991c7){_0x161299=_0x161299-0x0;var _0x293d51=_0xb10b[_0x161299];return _0x293d51;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 074ac6f..7878bea 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 _0xf9e4=['apply','reject','save','update','then','error','stack','name','send','index','WhatsappTransferReport','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','catch','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf9e4,0xc5));var _0x4f9e=function(_0x4848cf,_0x190ab2){_0x4848cf=_0x4848cf-0x0;var _0x5c9caf=_0xf9e4[_0x4848cf];return _0x5c9caf;};'use strict';var pdf=require(_0x4f9e('0x0'));var emlformat=require(_0x4f9e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f9e('0x2'));var jsonpatch=require(_0x4f9e('0x3'));var rp=require('request-promise');var moment=require(_0x4f9e('0x4'));var BPromise=require(_0x4f9e('0x5'));var Mustache=require('mustache');var util=require(_0x4f9e('0x6'));var path=require(_0x4f9e('0x7'));var sox=require(_0x4f9e('0x8'));var csv=require(_0x4f9e('0x9'));var ejs=require(_0x4f9e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f9e('0xb'));var crypto=require(_0x4f9e('0xc'));var jsforce=require(_0x4f9e('0xd'));var deskjs=require(_0x4f9e('0xe'));var toCsv=require(_0x4f9e('0x9'));var querystring=require(_0x4f9e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4f9e('0x10'));var as=require(_0x4f9e('0x11'));var hardwareService=require(_0x4f9e('0x12'));var logger=require(_0x4f9e('0x13'))(_0x4f9e('0x14'));var utils=require(_0x4f9e('0x15'));var config=require(_0x4f9e('0x16'));var licenseUtil=require(_0x4f9e('0x17'));var db=require(_0x4f9e('0x18'))['db'];function respondWithStatusCode(_0x45e4b0,_0x38b543){_0x38b543=_0x38b543||0xcc;return function(_0x1b071a){if(_0x1b071a){return _0x45e4b0[_0x4f9e('0x19')](_0x38b543);}return _0x45e4b0[_0x4f9e('0x1a')](_0x38b543)[_0x4f9e('0x1b')]();};}function respondWithResult(_0x40fce3,_0x4ac1ae){_0x4ac1ae=_0x4ac1ae||0xc8;return function(_0x29a1c3){if(_0x29a1c3){return _0x40fce3[_0x4f9e('0x1a')](_0x4ac1ae)[_0x4f9e('0x1c')](_0x29a1c3);}};}function respondWithFilteredResult(_0x27986d,_0x57b951){return function(_0x5a185d){if(_0x5a185d){var _0x5209d1=_0x5a185d[_0x4f9e('0x1d')],_0x176aa4=_0x57b951['offset'],_0x45931e=_0x57b951[_0x4f9e('0x1e')]+_0x57b951[_0x4f9e('0x1f')],_0x2bc0a5;if(_0x45931e>=_0x5209d1){_0x45931e=_0x5209d1;_0x2bc0a5=0xc8;}else{_0x2bc0a5=0xce;}_0x27986d[_0x4f9e('0x1a')](_0x2bc0a5);return _0x27986d[_0x4f9e('0x20')](_0x4f9e('0x21'),_0x176aa4+'-'+_0x45931e+'/'+_0x5209d1)[_0x4f9e('0x1c')](_0x5a185d);}return null;};}function patchUpdates(_0x6497a8){return function(_0x2e3dbd){try{jsonpatch[_0x4f9e('0x22')](_0x2e3dbd,_0x6497a8,!![]);}catch(_0x36c21c){return BPromise[_0x4f9e('0x23')](_0x36c21c);}return _0x2e3dbd[_0x4f9e('0x24')]();};}function saveUpdates(_0x478995,_0x77adc4){return function(_0x3cec08){if(_0x3cec08){return _0x3cec08[_0x4f9e('0x25')](_0x478995)[_0x4f9e('0x26')](function(_0x20c937){return _0x20c937;});}return null;};}function removeEntity(_0x44e042,_0x5ac355){return function(_0x43ae4e){if(_0x43ae4e){return _0x43ae4e['destroy']()[_0x4f9e('0x26')](function(){_0x44e042[_0x4f9e('0x1a')](0xcc)[_0x4f9e('0x1b')]();});}};}function handleEntityNotFound(_0x10195c,_0x2709d2){return function(_0x58eb40){if(!_0x58eb40){_0x10195c[_0x4f9e('0x19')](0x194);}return _0x58eb40;};}function handleError(_0x92c49d,_0x2a18c7){_0x2a18c7=_0x2a18c7||0x1f4;return function(_0x2cc783){logger[_0x4f9e('0x27')](_0x2cc783[_0x4f9e('0x28')]);if(_0x2cc783[_0x4f9e('0x29')]){delete _0x2cc783[_0x4f9e('0x29')];}_0x92c49d[_0x4f9e('0x1a')](_0x2a18c7)[_0x4f9e('0x2a')](_0x2cc783);};}exports[_0x4f9e('0x2b')]=function(_0x35d7f9,_0x2e2814){var _0x23914f={},_0x404157={},_0xaf2e14={'count':0x0,'rows':[]};var _0x4564f9=_['map'](db[_0x4f9e('0x2c')]['rawAttributes'],function(_0x3c1610){return{'name':_0x3c1610[_0x4f9e('0x2d')],'type':_0x3c1610['type'][_0x4f9e('0x2e')]};});_0x404157['model']=_[_0x4f9e('0x2f')](_0x4564f9,'name');_0x404157[_0x4f9e('0x30')]=_[_0x4f9e('0x31')](_0x35d7f9[_0x4f9e('0x30')]);_0x404157['filters']=_[_0x4f9e('0x32')](_0x404157[_0x4f9e('0x33')],_0x404157['query']);_0x23914f['attributes']=_[_0x4f9e('0x32')](_0x404157[_0x4f9e('0x33')],qs['fields'](_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x34')]));_0x23914f[_0x4f9e('0x35')]=_0x23914f[_0x4f9e('0x35')][_0x4f9e('0x36')]?_0x23914f[_0x4f9e('0x35')]:_0x404157[_0x4f9e('0x33')];if(!_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x37')](_0x4f9e('0x38'))){_0x23914f['limit']=qs['limit'](_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x1f')]);_0x23914f['offset']=qs[_0x4f9e('0x1e')](_0x35d7f9[_0x4f9e('0x30')]['offset']);}_0x23914f['order']=qs['sort'](_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x39')]);_0x23914f['where']=qs[_0x4f9e('0x3a')](_['pick'](_0x35d7f9['query'],_0x404157[_0x4f9e('0x3a')]),_0x4564f9);if(_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x3b')]){_0x23914f[_0x4f9e('0x3c')]=_[_0x4f9e('0x3d')](_0x23914f[_0x4f9e('0x3c')],{'$or':_[_0x4f9e('0x2f')](_0x4564f9,function(_0x990cde){if(_0x990cde[_0x4f9e('0x3e')]!==_0x4f9e('0x3f')){var _0x40c525={};_0x40c525[_0x990cde['name']]={'$like':'%'+_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x3b')]+'%'};return _0x40c525;}})});}_0x23914f=_[_0x4f9e('0x3d')]({},_0x23914f,_0x35d7f9[_0x4f9e('0x40')]);var _0x474d4b={'where':_0x23914f['where']};return db['WhatsappTransferReport']['count'](_0x474d4b)[_0x4f9e('0x26')](function(_0x4f9bc7){_0xaf2e14[_0x4f9e('0x1d')]=_0x4f9bc7;if(_0x35d7f9[_0x4f9e('0x30')][_0x4f9e('0x41')]){_0x23914f[_0x4f9e('0x42')]=[{'all':!![]}];}return db[_0x4f9e('0x2c')][_0x4f9e('0x43')](_0x23914f);})[_0x4f9e('0x26')](function(_0x3e4437){_0xaf2e14[_0x4f9e('0x44')]=_0x3e4437;return _0xaf2e14;})[_0x4f9e('0x26')](respondWithFilteredResult(_0x2e2814,_0x23914f))['catch'](handleError(_0x2e2814,null));};exports[_0x4f9e('0x45')]=function(_0x60e814,_0x3e1d54){var _0x26f5cb={'raw':!![],'where':{'id':_0x60e814['params']['id']}},_0x8c1de2={};_0x8c1de2[_0x4f9e('0x33')]=_[_0x4f9e('0x31')](db[_0x4f9e('0x2c')]['rawAttributes']);_0x8c1de2[_0x4f9e('0x30')]=_[_0x4f9e('0x31')](_0x60e814[_0x4f9e('0x30')]);_0x8c1de2[_0x4f9e('0x3a')]=_[_0x4f9e('0x32')](_0x8c1de2[_0x4f9e('0x33')],_0x8c1de2['query']);_0x26f5cb['attributes']=_[_0x4f9e('0x32')](_0x8c1de2[_0x4f9e('0x33')],qs['fields'](_0x60e814[_0x4f9e('0x30')][_0x4f9e('0x34')]));_0x26f5cb['attributes']=_0x26f5cb[_0x4f9e('0x35')]['length']?_0x26f5cb[_0x4f9e('0x35')]:_0x8c1de2[_0x4f9e('0x33')];if(_0x60e814[_0x4f9e('0x30')][_0x4f9e('0x41')]){_0x26f5cb[_0x4f9e('0x42')]=[{'all':!![]}];}_0x26f5cb=_['merge']({},_0x26f5cb,_0x60e814[_0x4f9e('0x40')]);return db['WhatsappTransferReport'][_0x4f9e('0x46')](_0x26f5cb)[_0x4f9e('0x26')](handleEntityNotFound(_0x3e1d54,null))[_0x4f9e('0x26')](respondWithResult(_0x3e1d54,null))['catch'](handleError(_0x3e1d54,null));};exports[_0x4f9e('0x47')]=function(_0x1bbf7a,_0x538c0b){return db[_0x4f9e('0x2c')]['create'](_0x1bbf7a[_0x4f9e('0x48')],{})[_0x4f9e('0x26')](respondWithResult(_0x538c0b,0xc9))['catch'](handleError(_0x538c0b,null));};exports[_0x4f9e('0x25')]=function(_0x588d6d,_0x3cb26a){if(_0x588d6d[_0x4f9e('0x48')]['id']){delete _0x588d6d[_0x4f9e('0x48')]['id'];}return db[_0x4f9e('0x2c')][_0x4f9e('0x46')]({'where':{'id':_0x588d6d[_0x4f9e('0x49')]['id']}})[_0x4f9e('0x26')](handleEntityNotFound(_0x3cb26a,null))[_0x4f9e('0x26')](saveUpdates(_0x588d6d[_0x4f9e('0x48')],null))[_0x4f9e('0x26')](respondWithResult(_0x3cb26a,null))[_0x4f9e('0x4a')](handleError(_0x3cb26a,null));};exports[_0x4f9e('0x4b')]=function(_0x2529d0,_0x407845){return db[_0x4f9e('0x2c')]['find']({'where':{'id':_0x2529d0[_0x4f9e('0x49')]['id']}})[_0x4f9e('0x26')](handleEntityNotFound(_0x407845,null))['then'](removeEntity(_0x407845,null))[_0x4f9e('0x4a')](handleError(_0x407845,null));};exports[_0x4f9e('0x4c')]=function(_0x671bd8,_0x8e38db){return db[_0x4f9e('0x2c')][_0x4f9e('0x4c')]()['then'](respondWithResult(_0x8e38db,null))['catch'](handleError(_0x8e38db,null));}; \ No newline at end of file +var _0x83da=['key','model','query','filters','intersection','attributes','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','count','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','find','create','body','describe','html-pdf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','json','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x83da,0xac));var _0xa83d=function(_0x4a9331,_0x361ba8){_0x4a9331=_0x4a9331-0x0;var _0x484b3c=_0x83da[_0x4a9331];return _0x484b3c;};'use strict';var pdf=require(_0xa83d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa83d('0x1'));var moment=require('moment');var BPromise=require(_0xa83d('0x2'));var Mustache=require('mustache');var util=require(_0xa83d('0x3'));var path=require(_0xa83d('0x4'));var sox=require(_0xa83d('0x5'));var csv=require(_0xa83d('0x6'));var ejs=require(_0xa83d('0x7'));var fs=require('fs');var _=require(_0xa83d('0x8'));var squel=require('squel');var crypto=require(_0xa83d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa83d('0xa'));var toCsv=require(_0xa83d('0x6'));var querystring=require(_0xa83d('0xb'));var Papa=require(_0xa83d('0xc'));var Redis=require('ioredis');var authService=require(_0xa83d('0xd'));var qs=require(_0xa83d('0xe'));var as=require(_0xa83d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa83d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa83d('0x11'));var db=require(_0xa83d('0x12'))['db'];function respondWithStatusCode(_0x64392d,_0x5a460b){_0x5a460b=_0x5a460b||0xcc;return function(_0x14cee9){if(_0x14cee9){return _0x64392d[_0xa83d('0x13')](_0x5a460b);}return _0x64392d[_0xa83d('0x14')](_0x5a460b)[_0xa83d('0x15')]();};}function respondWithResult(_0x5ec7e0,_0x5bb1f8){_0x5bb1f8=_0x5bb1f8||0xc8;return function(_0x392acc){if(_0x392acc){return _0x5ec7e0[_0xa83d('0x14')](_0x5bb1f8)['json'](_0x392acc);}};}function respondWithFilteredResult(_0x2dea6b,_0x43e455){return function(_0x3853b8){if(_0x3853b8){var _0x48e351=_0x3853b8['count'],_0x57e5b6=_0x43e455[_0xa83d('0x16')],_0x5361ce=_0x43e455[_0xa83d('0x16')]+_0x43e455['limit'],_0x4391cb;if(_0x5361ce>=_0x48e351){_0x5361ce=_0x48e351;_0x4391cb=0xc8;}else{_0x4391cb=0xce;}_0x2dea6b[_0xa83d('0x14')](_0x4391cb);return _0x2dea6b[_0xa83d('0x17')]('Content-Range',_0x57e5b6+'-'+_0x5361ce+'/'+_0x48e351)[_0xa83d('0x18')](_0x3853b8);}return null;};}function patchUpdates(_0x590164){return function(_0x5733d1){try{jsonpatch['apply'](_0x5733d1,_0x590164,!![]);}catch(_0x44cf72){return BPromise[_0xa83d('0x19')](_0x44cf72);}return _0x5733d1[_0xa83d('0x1a')]();};}function saveUpdates(_0x36ce57,_0x2d9618){return function(_0x3be5fa){if(_0x3be5fa){return _0x3be5fa[_0xa83d('0x1b')](_0x36ce57)[_0xa83d('0x1c')](function(_0x2150a2){return _0x2150a2;});}return null;};}function removeEntity(_0x5e52f9,_0x484419){return function(_0x279479){if(_0x279479){return _0x279479[_0xa83d('0x1d')]()[_0xa83d('0x1c')](function(){_0x5e52f9[_0xa83d('0x14')](0xcc)[_0xa83d('0x15')]();});}};}function handleEntityNotFound(_0x31f0bd,_0x3ba0f1){return function(_0x320698){if(!_0x320698){_0x31f0bd[_0xa83d('0x13')](0x194);}return _0x320698;};}function handleError(_0x5ea035,_0x1f10f1){_0x1f10f1=_0x1f10f1||0x1f4;return function(_0x2060b4){logger[_0xa83d('0x1e')](_0x2060b4[_0xa83d('0x1f')]);if(_0x2060b4[_0xa83d('0x20')]){delete _0x2060b4['name'];}_0x5ea035[_0xa83d('0x14')](_0x1f10f1)['send'](_0x2060b4);};}exports[_0xa83d('0x21')]=function(_0x489ce0,_0x282d96){var _0x17cebc={},_0x3f9ccf={},_0x269fd9={'count':0x0,'rows':[]};var _0x29475d=_[_0xa83d('0x22')](db['WhatsappTransferReport'][_0xa83d('0x23')],function(_0x253178){return{'name':_0x253178[_0xa83d('0x24')],'type':_0x253178[_0xa83d('0x25')][_0xa83d('0x26')]};});_0x3f9ccf[_0xa83d('0x27')]=_['map'](_0x29475d,_0xa83d('0x20'));_0x3f9ccf[_0xa83d('0x28')]=_['keys'](_0x489ce0[_0xa83d('0x28')]);_0x3f9ccf[_0xa83d('0x29')]=_[_0xa83d('0x2a')](_0x3f9ccf[_0xa83d('0x27')],_0x3f9ccf['query']);_0x17cebc[_0xa83d('0x2b')]=_[_0xa83d('0x2a')](_0x3f9ccf[_0xa83d('0x27')],qs['fields'](_0x489ce0[_0xa83d('0x28')]['fields']));_0x17cebc[_0xa83d('0x2b')]=_0x17cebc[_0xa83d('0x2b')]['length']?_0x17cebc[_0xa83d('0x2b')]:_0x3f9ccf[_0xa83d('0x27')];if(!_0x489ce0[_0xa83d('0x28')]['hasOwnProperty'](_0xa83d('0x2c'))){_0x17cebc[_0xa83d('0x2d')]=qs[_0xa83d('0x2d')](_0x489ce0[_0xa83d('0x28')]['limit']);_0x17cebc[_0xa83d('0x16')]=qs['offset'](_0x489ce0[_0xa83d('0x28')][_0xa83d('0x16')]);}_0x17cebc[_0xa83d('0x2e')]=qs['sort'](_0x489ce0[_0xa83d('0x28')][_0xa83d('0x2f')]);_0x17cebc[_0xa83d('0x30')]=qs[_0xa83d('0x29')](_[_0xa83d('0x31')](_0x489ce0['query'],_0x3f9ccf[_0xa83d('0x29')]),_0x29475d);if(_0x489ce0[_0xa83d('0x28')][_0xa83d('0x32')]){_0x17cebc[_0xa83d('0x30')]=_[_0xa83d('0x33')](_0x17cebc['where'],{'$or':_['map'](_0x29475d,function(_0x7b8f95){if(_0x7b8f95[_0xa83d('0x25')]!==_0xa83d('0x34')){var _0x33fe7e={};_0x33fe7e[_0x7b8f95['name']]={'$like':'%'+_0x489ce0[_0xa83d('0x28')][_0xa83d('0x32')]+'%'};return _0x33fe7e;}})});}_0x17cebc=_[_0xa83d('0x33')]({},_0x17cebc,_0x489ce0[_0xa83d('0x35')]);var _0x5d671a={'where':_0x17cebc[_0xa83d('0x30')]};return db[_0xa83d('0x36')][_0xa83d('0x37')](_0x5d671a)['then'](function(_0x19db5c){_0x269fd9[_0xa83d('0x37')]=_0x19db5c;if(_0x489ce0['query'][_0xa83d('0x38')]){_0x17cebc[_0xa83d('0x39')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa83d('0x3a')](_0x17cebc);})[_0xa83d('0x1c')](function(_0x18d1d3){_0x269fd9[_0xa83d('0x3b')]=_0x18d1d3;return _0x269fd9;})[_0xa83d('0x1c')](respondWithFilteredResult(_0x282d96,_0x17cebc))[_0xa83d('0x3c')](handleError(_0x282d96,null));};exports[_0xa83d('0x3d')]=function(_0x122410,_0x501958){var _0x15b215={'raw':!![],'where':{'id':_0x122410[_0xa83d('0x3e')]['id']}},_0x104ade={};_0x104ade[_0xa83d('0x27')]=_[_0xa83d('0x3f')](db[_0xa83d('0x36')][_0xa83d('0x23')]);_0x104ade[_0xa83d('0x28')]=_['keys'](_0x122410['query']);_0x104ade[_0xa83d('0x29')]=_[_0xa83d('0x2a')](_0x104ade[_0xa83d('0x27')],_0x104ade[_0xa83d('0x28')]);_0x15b215[_0xa83d('0x2b')]=_['intersection'](_0x104ade['model'],qs[_0xa83d('0x40')](_0x122410[_0xa83d('0x28')]['fields']));_0x15b215[_0xa83d('0x2b')]=_0x15b215[_0xa83d('0x2b')][_0xa83d('0x41')]?_0x15b215[_0xa83d('0x2b')]:_0x104ade[_0xa83d('0x27')];if(_0x122410['query']['includeAll']){_0x15b215[_0xa83d('0x39')]=[{'all':!![]}];}_0x15b215=_[_0xa83d('0x33')]({},_0x15b215,_0x122410[_0xa83d('0x35')]);return db[_0xa83d('0x36')][_0xa83d('0x42')](_0x15b215)[_0xa83d('0x1c')](handleEntityNotFound(_0x501958,null))['then'](respondWithResult(_0x501958,null))[_0xa83d('0x3c')](handleError(_0x501958,null));};exports[_0xa83d('0x43')]=function(_0x4136cf,_0x3b3b8d){return db[_0xa83d('0x36')][_0xa83d('0x43')](_0x4136cf['body'],{})[_0xa83d('0x1c')](respondWithResult(_0x3b3b8d,0xc9))[_0xa83d('0x3c')](handleError(_0x3b3b8d,null));};exports[_0xa83d('0x1b')]=function(_0x3e9cdb,_0xd83494){if(_0x3e9cdb['body']['id']){delete _0x3e9cdb['body']['id'];}return db['WhatsappTransferReport'][_0xa83d('0x42')]({'where':{'id':_0x3e9cdb['params']['id']}})['then'](handleEntityNotFound(_0xd83494,null))[_0xa83d('0x1c')](saveUpdates(_0x3e9cdb[_0xa83d('0x44')],null))[_0xa83d('0x1c')](respondWithResult(_0xd83494,null))[_0xa83d('0x3c')](handleError(_0xd83494,null));};exports[_0xa83d('0x1d')]=function(_0x14d6ee,_0x23db6b){return db[_0xa83d('0x36')][_0xa83d('0x42')]({'where':{'id':_0x14d6ee[_0xa83d('0x3e')]['id']}})[_0xa83d('0x1c')](handleEntityNotFound(_0x23db6b,null))[_0xa83d('0x1c')](removeEntity(_0x23db6b,null))[_0xa83d('0x3c')](handleError(_0x23db6b,null));};exports[_0xa83d('0x45')]=function(_0xc0f75c,_0x160f4c){return db[_0xa83d('0x36')][_0xa83d('0x45')]()[_0xa83d('0x1c')](respondWithResult(_0x160f4c,null))[_0xa83d('0x3c')](handleError(_0x160f4c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0db39e2..c1ad896 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 _0x8a9a=['request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','moment'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x8a9a,0xf9));var _0xa8a9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8a9a[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xa8a9('0x0'));var util=require(_0xa8a9('0x1'));var logger=require('../../config/logger')(_0xa8a9('0x2'));var moment=require(_0xa8a9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa8a9('0x5'));var attributes=require(_0xa8a9('0x6'));module[_0xa8a9('0x7')]=function(_0x4266bf,_0x3974c6){return _0x4266bf['define'](_0xa8a9('0x8'),attributes,{'tableName':_0xa8a9('0x9'),'paranoid':![],'indexes':[{'name':_0xa8a9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x340b=['define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x340b,0x85));var _0xb340=function(_0x4334b6,_0x30d251){_0x4334b6=_0x4334b6-0x0;var _0x20a51a=_0x340b[_0x4334b6];return _0x20a51a;};'use strict';var _=require(_0xb340('0x0'));var util=require(_0xb340('0x1'));var logger=require(_0xb340('0x2'))(_0xb340('0x3'));var moment=require(_0xb340('0x4'));var BPromise=require(_0xb340('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb340('0x6'));var rimraf=require(_0xb340('0x7'));var config=require(_0xb340('0x8'));var attributes=require(_0xb340('0x9'));module['exports']=function(_0x1746ee,_0x172128){return _0x1746ee[_0xb340('0xa')](_0xb340('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xb340('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ef9d654..da50e2a 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x6888e2,_0x1d15c0){var _0x20c17e=function(_0x1b0cd0){while(--_0x1b0cd0){_0x6888e2['push'](_0x6888e2['shift']());}};_0x20c17e(++_0x1d15c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x2e10c9,_0x14d37){var _0x287aa5=function(_0x5d075d){while(--_0x5d075d){_0x2e10c9['push'](_0x2e10c9['shift']());}};_0x287aa5(++_0x14d37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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/app.js b/server/app.js index 96f4dec..0f32759 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1f1=['join','None','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','start','info','map','filter','online','name','Offline\x20apps:','status'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x2a3ca4,_0x39a7e8){_0x2a3ca4=_0x2a3ca4-0x0;var _0x374c52=_0xd1f1[_0x2a3ca4];return _0x374c52;};'use strict';var _=require(_0x1d1f('0x0'));var mysqldb=require(_0x1d1f('0x1'));var rpc=require('./rpc');var config=require(_0x1d1f('0x2'));var logger=require(_0x1d1f('0x3'))(_0x1d1f('0x4'));var pm2=require(_0x1d1f('0x5'));var pm2Config=require(_0x1d1f('0x6'));var schedule=require(_0x1d1f('0x7'));var chat=require(_0x1d1f('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1d1f('0x9'));function main(){return mysqldb['db'][_0x1d1f('0xa')][_0x1d1f('0xb')]()[_0x1d1f('0xc')](function(){return rpc[_0x1d1f('0xd')]();})['then'](function(_0x4836b3){logger['info'](_0x4836b3);return chat[_0x1d1f('0xe')]();})[_0x1d1f('0xc')](function(){return whatsapp[_0x1d1f('0xe')]();})[_0x1d1f('0xc')](function(){return schedule['start']();})[_0x1d1f('0xc')](function(){return transcribe[_0x1d1f('0xe')]();})[_0x1d1f('0xc')](function(_0x38cff4){logger[_0x1d1f('0xf')](_0x38cff4);return pm2['start'](pm2Config);})['then'](function(_0xad2d04){logger[_0x1d1f('0xf')]('Online\x20apps:',_[_0x1d1f('0x10')](_[_0x1d1f('0x11')](_0xad2d04,{'status':_0x1d1f('0x12')}),_0x1d1f('0x13'))['join']());logger[_0x1d1f('0xf')](_0x1d1f('0x14'),_[_0x1d1f('0x10')](_[_0x1d1f('0x11')](_0xad2d04,function(_0x465f39){return _0x465f39[_0x1d1f('0x15')]!==_0x1d1f('0x12');}),_0x1d1f('0x13'))[_0x1d1f('0x16')]()||_0x1d1f('0x17'));config[_0x1d1f('0x18')]&&require(_0x1d1f('0x19'))[_0x1d1f('0x1a')]();require(_0x1d1f('0x1b'))['default']();})['catch'](function(_0x498fd0){logger[_0x1d1f('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x498fd0);process[_0x1d1f('0x1d')](0x1);});}main(); \ No newline at end of file +var _0x0adf=['join','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','listen','info','start','Online\x20apps:','map','online','name','status'];(function(_0x30f2d1,_0x5710ac){var _0x44605d=function(_0x46d60b){while(--_0x46d60b){_0x30f2d1['push'](_0x30f2d1['shift']());}};_0x44605d(++_0x5710ac);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x1d4c70,_0x4f28c3){_0x1d4c70=_0x1d4c70-0x0;var _0x3193a1=_0x0adf[_0x1d4c70];return _0x3193a1;};'use strict';var _=require(_0xf0ad('0x0'));var mysqldb=require(_0xf0ad('0x1'));var rpc=require(_0xf0ad('0x2'));var config=require('./config/environment');var logger=require(_0xf0ad('0x3'))(_0xf0ad('0x4'));var pm2=require(_0xf0ad('0x5'));var pm2Config=require(_0xf0ad('0x6'));var schedule=require(_0xf0ad('0x7'));var chat=require(_0xf0ad('0x8'));var whatsapp=require(_0xf0ad('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xf0ad('0xa')]['sync']()[_0xf0ad('0xb')](function(){return rpc[_0xf0ad('0xc')]();})[_0xf0ad('0xb')](function(_0x41c99d){logger[_0xf0ad('0xd')](_0x41c99d);return chat[_0xf0ad('0xe')]();})[_0xf0ad('0xb')](function(){return whatsapp['start']();})[_0xf0ad('0xb')](function(){return schedule['start']();})[_0xf0ad('0xb')](function(){return transcribe[_0xf0ad('0xe')]();})[_0xf0ad('0xb')](function(_0x2a5d0e){logger[_0xf0ad('0xd')](_0x2a5d0e);return pm2['start'](pm2Config);})['then'](function(_0x13ed94){logger[_0xf0ad('0xd')](_0xf0ad('0xf'),_[_0xf0ad('0x10')](_['filter'](_0x13ed94,{'status':_0xf0ad('0x11')}),_0xf0ad('0x12'))['join']());logger['info']('Offline\x20apps:',_[_0xf0ad('0x10')](_['filter'](_0x13ed94,function(_0x1dad7b){return _0x1dad7b[_0xf0ad('0x13')]!==_0xf0ad('0x11');}),_0xf0ad('0x12'))[_0xf0ad('0x14')]()||'None');config[_0xf0ad('0x15')]&&require(_0xf0ad('0x16'))[_0xf0ad('0x17')]();require(_0xf0ad('0x18'))['default']();})['catch'](function(_0x2466e8){logger[_0xf0ad('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2466e8);process[_0xf0ad('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d505085..f9d491c 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 _0xe826=['promisify','secret','payload','options','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','util','moment','secrets','session','role','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','use','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','Basic','User','find','authenticate','pass','startsWith','query','apikey','getUuid','Setting','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','user','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','length','unshift','encryptString','join'];(function(_0x5d338b,_0x3f6c0b){var _0x2034b3=function(_0x362716){while(--_0x362716){_0x5d338b['push'](_0x5d338b['shift']());}};_0x2034b3(++_0x3f6c0b);}(_0xe826,0x168));var _0x6e82=function(_0x2c7c60,_0x2572c0){_0x2c7c60=_0x2c7c60-0x0;var _0x54ea05=_0xe826[_0x2c7c60];return _0x54ea05;};'use strict';var db=require(_0x6e82('0x0'))['db'];var config=require(_0x6e82('0x1'));var hardwareConf=require(_0x6e82('0x2'));var licenseUtil=require(_0x6e82('0x3'));var encryptor=require('../encryptor');var _=require(_0x6e82('0x4'));var jwt=require(_0x6e82('0x5'));var expressJwt=require(_0x6e82('0x6'));var compose=require(_0x6e82('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x6e82('0x8'));var util=require(_0x6e82('0x9'));var moment=require(_0x6e82('0xa'));var validateJwt=expressJwt({'secret':config[_0x6e82('0xb')][_0x6e82('0xc')]});var userAttributes=['id',_0x6e82('0xd'),'fullname','name',_0x6e82('0xe'),_0x6e82('0xf'),_0x6e82('0x10'),_0x6e82('0x11'),_0x6e82('0x12'),_0x6e82('0x13'),'chatPause',_0x6e82('0x14'),_0x6e82('0x15'),'smsPause',_0x6e82('0x16'),_0x6e82('0x17'),'showWebBar',_0x6e82('0x18'),'lastPauseAt',_0x6e82('0x19'),_0x6e82('0x1a'),_0x6e82('0x1b'),_0x6e82('0x1c'),_0x6e82('0x1d'),'phoneBarAutoAnswerDelay',_0x6e82('0x1e'),_0x6e82('0x1f'),'phoneBarEnableDtmfTone',_0x6e82('0x20'),'phoneBarExpires',_0x6e82('0x21'),_0x6e82('0x22'),_0x6e82('0x23'),_0x6e82('0x24'),_0x6e82('0x25'),'userProfileId','settingsEnabled'];exports[_0x6e82('0x26')]=function(){return this[_0x6e82('0x27')](!![])[_0x6e82('0x28')](function(_0x18abf2,_0x1ed066,_0x245444){if(_0x18abf2['user']){_0x245444();}else{return db['ChatInteraction'][_0x6e82('0x29')]({'where':{'id':_0x18abf2[_0x6e82('0x2a')]['id']},'attributes':['id',_0x6e82('0x2b'),_0x6e82('0x2c')],'raw':!![]})[_0x6e82('0x2d')](function(_0x2e5eb4){if(_0x2e5eb4&&_0x2e5eb4[_0x6e82('0x2b')]){return _0x1ed066[_0x6e82('0x2e')](_0x2e5eb4[_0x6e82('0x2c')]===_0x6e82('0x2f')?0x195:0x193)[_0x6e82('0x30')]({'message':_0x2e5eb4[_0x6e82('0x2c')]==='unmanaged'?_0x6e82('0x31'):'Forbidden.'});}else{_0x245444();}})[_0x6e82('0x32')](function(_0x5a07ee){_0x245444(_0x5a07ee);});}});};exports[_0x6e82('0x27')]=function isAuthenticated(_0x32f26d){return compose()['use'](function(_0xc4a30a,_0x1c77cc,_0x5dc2e4){var _0x3bebd6;if(_0xc4a30a['headers']['authorization']){if(_['startsWith'](_0xc4a30a[_0x6e82('0x33')][_0x6e82('0x34')],_0x6e82('0x35'))){var _0x284506=basicAuth(_0xc4a30a);db[_0x6e82('0x36')][_0x6e82('0x37')]({'where':{'name':_0x284506['name']}})[_0x6e82('0x2d')](function(_0xcdd970){if(!_0xcdd970||!_0xcdd970[_0x6e82('0x38')](_0x284506[_0x6e82('0x39')])){return _0x1c77cc[_0x6e82('0x2e')](0x191)[_0x6e82('0x30')]({'message':'Wrong\x20credentials.'});}_0xc4a30a['user']={'id':_0xcdd970['id']};_0x5dc2e4();})[_0x6e82('0x32')](function(_0x14c56f){_0x5dc2e4(_0x14c56f);});}else if(_[_0x6e82('0x3a')](_0xc4a30a['headers'][_0x6e82('0x34')],'Bearer')){validateJwt(_0xc4a30a,_0x1c77cc,_0x5dc2e4);}else{if(_0x32f26d){_0x5dc2e4();}else{return _0x1c77cc['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0xc4a30a[_0x6e82('0x3b')][_0x6e82('0x3c')]){try{var _0x2255a6={'audience':hardwareConf[_0x6e82('0x3d')](),'issuer':hardwareConf[_0x6e82('0x3d')]()};verifyJwt(_0xc4a30a[_0x6e82('0x3b')][_0x6e82('0x3c')],_0x2255a6)['then'](function(_0x1d7b6a){return db['User'][_0x6e82('0x37')]({'where':{'id':_0x1d7b6a['sub']}})[_0x6e82('0x2d')](function(_0x1c4e70){_0x3bebd6=_0x1c4e70;return db[_0x6e82('0x3e')][_0x6e82('0x29')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6e82('0x3f')],'raw':!![]});})[_0x6e82('0x2d')](function(_0x50aef1){if(!_0x3bebd6||!_[_0x6e82('0x40')](_0x3bebd6['apiKeyNonce'],_0x1d7b6a['nonce'])){return _0x1c77cc['status'](0x191)[_0x6e82('0x30')]({'message':_0x6e82('0x41')});}if(_0x3bebd6[_0x6e82('0x42')]){return _0x1c77cc[_0x6e82('0x2e')](0x191)['json']({'message':_0x6e82('0x43')});}if(_0x3bebd6[_0x6e82('0x44')]){if(_0x50aef1[_0x6e82('0x3f')]>0x0){if(moment(_0x3bebd6[_0x6e82('0x45')])[_0x6e82('0x46')](_0x50aef1['blockDuration'],_0x6e82('0x47'))>moment()){return _0x1c77cc['status'](0x191)[_0x6e82('0x30')]({'message':_0x6e82('0x43')});}}else{return _0x1c77cc['status'](0x191)[_0x6e82('0x30')]({'message':_0x6e82('0x43')});}}_0xc4a30a[_0x6e82('0x48')]={'id':_0x3bebd6['id']};_0x5dc2e4();});})['catch'](function(){return _0x1c77cc[_0x6e82('0x2e')](0x191)[_0x6e82('0x30')]({'message':_0x6e82('0x43')});});}catch(_0x5ca183){_0x5dc2e4(_0x5ca183);}}else if(_0x32f26d){_0x5dc2e4();}else{return _0x1c77cc[_0x6e82('0x2e')](0x193)[_0x6e82('0x30')]({'message':_0x6e82('0x49')});}})['use'](function(_0xd6b91,_0x99828a,_0x269b3a){if(_0xd6b91[_0x6e82('0x48')]){db['User'][_0x6e82('0x37')]({'where':{'id':_0xd6b91[_0x6e82('0x48')]['id']},'attributes':userAttributes})[_0x6e82('0x2d')](function(_0x5a14e8){if(!_0x5a14e8){return _0x99828a[_0x6e82('0x2e')](0x194)['json']({'message':'User\x20not\x20found.'});}_0xd6b91[_0x6e82('0x48')]=_0x5a14e8;_0x269b3a();})['catch'](function(_0x113f19){_0x269b3a(_0x113f19);});}else if(_0x32f26d){_0x269b3a();}else{return _0x99828a[_0x6e82('0x2e')](0x194)[_0x6e82('0x30')]({'message':_0x6e82('0x4a')});}});};exports[_0x6e82('0x4b')]=function canUpdate(){return compose()[_0x6e82('0x28')](function(_0x31319a,_0x3bfa97,_0x4b57df){return licenseUtil[_0x6e82('0x4c')]()['then'](function(_0x4559fe){if(_0x4559fe[_0x6e82('0x4d')]){_0x4b57df();}else{return _0x3bfa97['status'](0x193)[_0x6e82('0x30')]({'message':'Forbidden'});}})[_0x6e82('0x32')](function(_0x5e29a4){_0x4b57df(_0x5e29a4);});});};exports[_0x6e82('0x4e')]=function(_0x1e288b,_0x31a80e,_0x395ce4){_0x1e288b['isMiddleware']=!![];return _0x395ce4();};exports['signToken']=function signToken(_0x5b3df3){return signJwt(_0x5b3df3);};exports[_0x6e82('0x4f')]=function(_0x46eb32,_0x25cb0b){if(!_0x46eb32[_0x6e82('0x48')]){return _0x25cb0b[_0x6e82('0x2e')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x467c97={'payload':{'id':_0x46eb32[_0x6e82('0x48')]['id'],'role':_0x46eb32[_0x6e82('0x48')][_0x6e82('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x467c97)['then'](function(_0x25f3a6){_0x25cb0b[_0x6e82('0x50')](_0x6e82('0x51'),_0x25f3a6);_0x25cb0b[_0x6e82('0x52')](_0x6e82('0x53'));})[_0x6e82('0x32')](function(_0x140f97){return _0x25cb0b[_0x6e82('0x2e')](0x1f4)[_0x6e82('0x54')](_0x140f97);});};exports[_0x6e82('0x55')]=function(_0x3ecf55){if(_[_0x6e82('0x56')](_0x3ecf55[_0x6e82('0x57')])||_[_0x6e82('0x56')](_0x3ecf55[_0x6e82('0x58')])){return null;}else{return createJwt(_0x3ecf55);}};exports[_0x6e82('0x59')]=function(_0x2b758f){_0x2b758f[_0x6e82('0x57')]=generateNonce();_0x2b758f[_0x6e82('0x58')]=generateIssuedAt();return createJwt(_0x2b758f);};exports[_0x6e82('0x5a')]=function(_0x507d37,_0x119aca){var _0x19d8ca=_0x507d37[_0x6e82('0x3b')][_0x6e82('0x3c')];if(_0x19d8ca){var _0x24f023={'nonce':_0x119aca[_0x6e82('0x57')],'iat':_0x119aca[_0x6e82('0x58')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x6e82('0x3d')]()};return verifyJwt(_0x19d8ca,_0x24f023)['then'](function(){return generateApiKey(_0x119aca);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x6e82('0x5b')]=function(_0x5f3ec8){var _0x43d22a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x43d22a[_0x6e82('0x5c')](_0x5f3ec8))throw new db[(_0x6e82('0x5d'))]['ValidationError'](_0x6e82('0x5e'));return;};exports[_0x6e82('0x5f')]=function(_0x4b4de8,_0x4be87f,_0x241646){var _0x3ee7b6=encryptor[_0x6e82('0x60')](_0x4be87f)['split'](',');for(var _0x55dcaf=0x0;_0x55dcaf<_0x241646;_0x55dcaf++){if(!_0x3ee7b6[_0x55dcaf])break;if(_0x4b4de8[_0x6e82('0x61')]()===_0x3ee7b6[_0x55dcaf]['toLowerCase']()){var _0x3aaf39=util[_0x6e82('0x62')](_0x6e82('0x63'),_0x241646);if(_0x241646===0x1){_0x3aaf39=_0x6e82('0x64');}throw new db[(_0x6e82('0x5d'))][(_0x6e82('0x65'))](_0x3aaf39);}}return;};exports[_0x6e82('0x66')]=function(_0x46d96f,_0x1bda7b){var _0x588cfa=_0x1bda7b?encryptor['decryptString'](_0x1bda7b)[_0x6e82('0x67')](','):[];if(_0x588cfa[_0x6e82('0x68')]===0x5){_0x588cfa['splice'](-0x1,0x1);}_0x588cfa[_0x6e82('0x69')](_0x46d96f);return encryptor[_0x6e82('0x6a')](_0x588cfa[_0x6e82('0x6b')](','));};function signJwt(_0x294f30){var _0x31b01b=BPromise[_0x6e82('0x6c')](jwt['sign'],{'context':jwt});var _0x1000b4=_0x294f30[_0x6e82('0x6d')]||config[_0x6e82('0xb')]['session'];return new BPromise(function(_0x57eafe,_0x3dceaf){_0x31b01b(_0x294f30[_0x6e82('0x6e')],_0x1000b4,_0x294f30[_0x6e82('0x6f')])[_0x6e82('0x2d')](function(_0x84263b){_0x57eafe(_0x84263b);})['catch'](function(_0x1e6afd){_0x3dceaf(_0x1e6afd);});});}function verifyJwt(_0x5c72a1,_0x5cd2cb,_0x391e14){var _0x227e57=BPromise[_0x6e82('0x6c')](jwt['verify'],{'context':jwt});var _0xef2075=_0x391e14||config[_0x6e82('0xb')][_0x6e82('0xc')];return new BPromise(function(_0x37df33,_0x3991bc){_0x227e57(_0x5c72a1,_0xef2075,_0x5cd2cb)[_0x6e82('0x2d')](function(_0x1f66b9){_0x37df33(_0x1f66b9);})[_0x6e82('0x32')](function(_0x42776e){_0x3991bc(_0x42776e);});});}function generateNonce(){return crypto[_0x6e82('0x70')](0x10)[_0x6e82('0x71')]('hex');}function generateIssuedAt(){return Math[_0x6e82('0x72')](Date[_0x6e82('0x73')]()/0x3e8)['toString']();}function createJwt(_0x5ae14b){var _0x2f9517={'payload':{'iat':_0x5ae14b[_0x6e82('0x58')],'nonce':_0x5ae14b['apiKeyNonce']},'options':{'algorithm':_0x6e82('0x74'),'subject':_0x5ae14b['id']['toString'](),'issuer':hardwareConf[_0x6e82('0x3d')](),'audience':hardwareConf[_0x6e82('0x3d')]()}};return signJwt(_0x2f9517)[_0x6e82('0x2d')](function(_0x5727eb){return{'iat':_0x5ae14b['apiKeyIat'],'nonce':_0x5ae14b[_0x6e82('0x57')],'token':_0x5727eb};});} \ No newline at end of file +var _0x9dad=['phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','params','closed','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','user','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','findOne','allowedLoginAttempts','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','motion.token','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','secrets','session','role','name','internal','email','userpic','md5secret','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9dad,0xcb));var _0xd9da=function(_0x35e154,_0x155189){_0x35e154=_0x35e154-0x0;var _0x5c6b27=_0x9dad[_0x35e154];return _0x5c6b27;};'use strict';var db=require(_0xd9da('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xd9da('0x1'));var licenseUtil=require(_0xd9da('0x2'));var encryptor=require(_0xd9da('0x3'));var _=require(_0xd9da('0x4'));var jwt=require(_0xd9da('0x5'));var expressJwt=require(_0xd9da('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xd9da('0x7'));var crypto=require('crypto');var BPromise=require(_0xd9da('0x8'));var util=require(_0xd9da('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xd9da('0xa')][_0xd9da('0xb')]});var userAttributes=['id',_0xd9da('0xc'),'fullname',_0xd9da('0xd'),_0xd9da('0xe'),_0xd9da('0xf'),_0xd9da('0x10'),'permissions',_0xd9da('0x11'),'voicePause','chatPause','mailPause',_0xd9da('0x12'),'smsPause',_0xd9da('0x13'),_0xd9da('0x14'),'showWebBar',_0xd9da('0x15'),_0xd9da('0x16'),_0xd9da('0x17'),_0xd9da('0x18'),_0xd9da('0x19'),'alias',_0xd9da('0x1a'),'phoneBarAutoAnswerDelay',_0xd9da('0x1b'),_0xd9da('0x1c'),_0xd9da('0x1d'),'phoneBarEnableSettings','phoneBarExpires',_0xd9da('0x1e'),_0xd9da('0x1f'),_0xd9da('0x20'),'hotdesk',_0xd9da('0x21'),_0xd9da('0x22'),_0xd9da('0x23')];exports[_0xd9da('0x24')]=function(){return this[_0xd9da('0x25')](!![])[_0xd9da('0x26')](function(_0x276524,_0x26f9f8,_0x4157f0){if(_0x276524['user']){_0x4157f0();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x276524[_0xd9da('0x27')]['id']},'attributes':['id',_0xd9da('0x28'),_0xd9da('0x29')],'raw':!![]})[_0xd9da('0x2a')](function(_0x59490b){if(_0x59490b&&_0x59490b[_0xd9da('0x28')]){return _0x26f9f8[_0xd9da('0x2b')](_0x59490b['disposition']===_0xd9da('0x2c')?0x195:0x193)[_0xd9da('0x2d')]({'message':_0x59490b[_0xd9da('0x29')]===_0xd9da('0x2c')?'Unmanaged.':_0xd9da('0x2e')});}else{_0x4157f0();}})[_0xd9da('0x2f')](function(_0x4238c4){_0x4157f0(_0x4238c4);});}});};exports[_0xd9da('0x25')]=function isAuthenticated(_0x3473a8){return compose()[_0xd9da('0x26')](function(_0x32cac0,_0x40193c,_0x4921c5){var _0x3524d0;if(_0x32cac0[_0xd9da('0x30')][_0xd9da('0x31')]){if(_[_0xd9da('0x32')](_0x32cac0[_0xd9da('0x30')]['authorization'],_0xd9da('0x33'))){var _0x286e3f=basicAuth(_0x32cac0);db[_0xd9da('0x34')][_0xd9da('0x35')]({'where':{'name':_0x286e3f[_0xd9da('0xd')]}})[_0xd9da('0x2a')](function(_0x5133a3){if(!_0x5133a3||!_0x5133a3[_0xd9da('0x36')](_0x286e3f[_0xd9da('0x37')])){return _0x40193c[_0xd9da('0x2b')](0x191)[_0xd9da('0x2d')]({'message':_0xd9da('0x38')});}_0x32cac0[_0xd9da('0x39')]={'id':_0x5133a3['id']};_0x4921c5();})[_0xd9da('0x2f')](function(_0xa66541){_0x4921c5(_0xa66541);});}else if(_[_0xd9da('0x32')](_0x32cac0[_0xd9da('0x30')][_0xd9da('0x31')],'Bearer')){validateJwt(_0x32cac0,_0x40193c,_0x4921c5);}else{if(_0x3473a8){_0x4921c5();}else{return _0x40193c[_0xd9da('0x2b')](0x193)['json']({'message':_0xd9da('0x3a')});}}}else if(_0x32cac0[_0xd9da('0x3b')]['apikey']){try{var _0x599a85={'audience':hardwareConf[_0xd9da('0x3c')](),'issuer':hardwareConf[_0xd9da('0x3c')]()};verifyJwt(_0x32cac0[_0xd9da('0x3b')][_0xd9da('0x3d')],_0x599a85)['then'](function(_0x1686e0){return db[_0xd9da('0x34')]['find']({'where':{'id':_0x1686e0[_0xd9da('0x3e')]}})['then'](function(_0x1e1bea){_0x3524d0=_0x1e1bea;return db[_0xd9da('0x3f')][_0xd9da('0x40')]({'where':{'id':0x1},'attributes':[_0xd9da('0x41'),'blockDuration'],'raw':!![]});})['then'](function(_0x3e63c9){if(!_0x3524d0||!_['isEqual'](_0x3524d0[_0xd9da('0x42')],_0x1686e0[_0xd9da('0x43')])){return _0x40193c[_0xd9da('0x2b')](0x191)[_0xd9da('0x2d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3524d0[_0xd9da('0x44')]){return _0x40193c[_0xd9da('0x2b')](0x191)[_0xd9da('0x2d')]({'message':_0xd9da('0x45')});}if(_0x3524d0[_0xd9da('0x46')]){if(_0x3e63c9[_0xd9da('0x47')]>0x0){if(moment(_0x3524d0['blockedAt'])['add'](_0x3e63c9[_0xd9da('0x47')],_0xd9da('0x48'))>moment()){return _0x40193c[_0xd9da('0x2b')](0x191)[_0xd9da('0x2d')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x40193c[_0xd9da('0x2b')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x32cac0[_0xd9da('0x39')]={'id':_0x3524d0['id']};_0x4921c5();});})[_0xd9da('0x2f')](function(){return _0x40193c[_0xd9da('0x2b')](0x191)[_0xd9da('0x2d')]({'message':_0xd9da('0x45')});});}catch(_0x2a8047){_0x4921c5(_0x2a8047);}}else if(_0x3473a8){_0x4921c5();}else{return _0x40193c[_0xd9da('0x2b')](0x193)[_0xd9da('0x2d')]({'message':_0xd9da('0x3a')});}})[_0xd9da('0x26')](function(_0x16518b,_0x25f292,_0x170421){if(_0x16518b['user']){db[_0xd9da('0x34')][_0xd9da('0x35')]({'where':{'id':_0x16518b[_0xd9da('0x39')]['id']},'attributes':userAttributes})[_0xd9da('0x2a')](function(_0x3c2726){if(!_0x3c2726){return _0x25f292[_0xd9da('0x2b')](0x194)['json']({'message':_0xd9da('0x49')});}_0x16518b[_0xd9da('0x39')]=_0x3c2726;_0x170421();})[_0xd9da('0x2f')](function(_0x34756a){_0x170421(_0x34756a);});}else if(_0x3473a8){_0x170421();}else{return _0x25f292[_0xd9da('0x2b')](0x194)['json']({'message':_0xd9da('0x4a')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xd9da('0x26')](function(_0x35f272,_0x277a24,_0x308dfc){return licenseUtil[_0xd9da('0x4b')]()[_0xd9da('0x2a')](function(_0x84e4cb){if(_0x84e4cb[_0xd9da('0x4c')]){_0x308dfc();}else{return _0x277a24[_0xd9da('0x2b')](0x193)[_0xd9da('0x2d')]({'message':_0xd9da('0x4d')});}})[_0xd9da('0x2f')](function(_0x1e24c1){_0x308dfc(_0x1e24c1);});});};exports[_0xd9da('0x4e')]=function(_0x4bd06f,_0x5d7862,_0x55b75a){_0x4bd06f['isMiddleware']=!![];return _0x55b75a();};exports['signToken']=function signToken(_0x5158db){return signJwt(_0x5158db);};exports['setTokenCookie']=function(_0x3dd699,_0x171974){if(!_0x3dd699['user']){return _0x171974['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x2259e3={'payload':{'id':_0x3dd699[_0xd9da('0x39')]['id'],'role':_0x3dd699[_0xd9da('0x39')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x2259e3)[_0xd9da('0x2a')](function(_0x25cbcd){_0x171974['cookie'](_0xd9da('0x4f'),_0x25cbcd);_0x171974[_0xd9da('0x50')](_0xd9da('0x51'));})[_0xd9da('0x2f')](function(_0x2e6835){return _0x171974[_0xd9da('0x2b')](0x1f4)[_0xd9da('0x52')](_0x2e6835);});};exports['retrieveApiKey']=function(_0x3b3623){if(_[_0xd9da('0x53')](_0x3b3623['apiKeyNonce'])||_[_0xd9da('0x53')](_0x3b3623['apiKeyIat'])){return null;}else{return createJwt(_0x3b3623);}};exports[_0xd9da('0x54')]=function(_0x20031a){_0x20031a['apiKeyNonce']=generateNonce();_0x20031a[_0xd9da('0x55')]=generateIssuedAt();return createJwt(_0x20031a);};exports[_0xd9da('0x56')]=function(_0x557a82,_0x192621){var _0x56ef5c=_0x557a82[_0xd9da('0x3b')]['apikey'];if(_0x56ef5c){var _0x2de14c={'nonce':_0x192621[_0xd9da('0x42')],'iat':_0x192621[_0xd9da('0x55')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xd9da('0x3c')]()};return verifyJwt(_0x56ef5c,_0x2de14c)['then'](function(){return generateApiKey(_0x192621);});}else{throw{'message':_0xd9da('0x57')};}};exports['validatePasswordPattern']=function(_0xcc271d){var _0x1f59cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1f59cd[_0xd9da('0x58')](_0xcc271d))throw new db[(_0xd9da('0x59'))][(_0xd9da('0x5a'))](_0xd9da('0x5b'));return;};exports[_0xd9da('0x5c')]=function(_0x27fc94,_0x526404,_0x5335d8){var _0x591667=encryptor[_0xd9da('0x5d')](_0x526404)[_0xd9da('0x5e')](',');for(var _0x36e31b=0x0;_0x36e31b<_0x5335d8;_0x36e31b++){if(!_0x591667[_0x36e31b])break;if(_0x27fc94['toLowerCase']()===_0x591667[_0x36e31b][_0xd9da('0x5f')]()){var _0x3d3bcd=util[_0xd9da('0x60')](_0xd9da('0x61'),_0x5335d8);if(_0x5335d8===0x1){_0x3d3bcd=_0xd9da('0x62');}throw new db[(_0xd9da('0x59'))][(_0xd9da('0x5a'))](_0x3d3bcd);}}return;};exports['updatePasswordsHistory']=function(_0x2d5dc1,_0x3c7df8){var _0x5a2ce7=_0x3c7df8?encryptor[_0xd9da('0x5d')](_0x3c7df8)[_0xd9da('0x5e')](','):[];if(_0x5a2ce7[_0xd9da('0x63')]===0x5){_0x5a2ce7[_0xd9da('0x64')](-0x1,0x1);}_0x5a2ce7[_0xd9da('0x65')](_0x2d5dc1);return encryptor[_0xd9da('0x66')](_0x5a2ce7[_0xd9da('0x67')](','));};function signJwt(_0x57707a){var _0x17ee45=BPromise[_0xd9da('0x68')](jwt[_0xd9da('0x69')],{'context':jwt});var _0x50a9b1=_0x57707a[_0xd9da('0x6a')]||config[_0xd9da('0xa')][_0xd9da('0xb')];return new BPromise(function(_0x387bc7,_0x5826a1){_0x17ee45(_0x57707a[_0xd9da('0x6b')],_0x50a9b1,_0x57707a[_0xd9da('0x6c')])[_0xd9da('0x2a')](function(_0x4ec527){_0x387bc7(_0x4ec527);})[_0xd9da('0x2f')](function(_0x2141dc){_0x5826a1(_0x2141dc);});});}function verifyJwt(_0x4e18eb,_0x2b5e6e,_0x3805c3){var _0x342ce0=BPromise[_0xd9da('0x68')](jwt[_0xd9da('0x6d')],{'context':jwt});var _0x55cb19=_0x3805c3||config[_0xd9da('0xa')][_0xd9da('0xb')];return new BPromise(function(_0x36e747,_0x577781){_0x342ce0(_0x4e18eb,_0x55cb19,_0x2b5e6e)['then'](function(_0x42c5b7){_0x36e747(_0x42c5b7);})[_0xd9da('0x2f')](function(_0x5bc0ea){_0x577781(_0x5bc0ea);});});}function generateNonce(){return crypto[_0xd9da('0x6e')](0x10)[_0xd9da('0x6f')](_0xd9da('0x70'));}function generateIssuedAt(){return Math['floor'](Date[_0xd9da('0x71')]()/0x3e8)[_0xd9da('0x6f')]();}function createJwt(_0x5e4c02){var _0x7b2857={'payload':{'iat':_0x5e4c02[_0xd9da('0x55')],'nonce':_0x5e4c02['apiKeyNonce']},'options':{'algorithm':_0xd9da('0x72'),'subject':_0x5e4c02['id'][_0xd9da('0x6f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xd9da('0x3c')]()}};return signJwt(_0x7b2857)['then'](function(_0x3bb56f){return{'iat':_0x5e4c02[_0xd9da('0x55')],'nonce':_0x5e4c02['apiKeyNonce'],'token':_0x3bb56f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5cba8b9..ba4b04f 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 _0x6b8f=['base64','secret','createDecipher','bluebird','secrets','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','write','final','end','close','unlink','algorithm','data','utf8'];(function(_0x5c8d92,_0x322372){var _0x4b9c17=function(_0xaeeaf2){while(--_0xaeeaf2){_0x5c8d92['push'](_0x5c8d92['shift']());}};_0x4b9c17(++_0x322372);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x442505,_0x3391fa){_0x442505=_0x442505-0x0;var _0x21ca17=_0x6b8f[_0x442505];return _0x21ca17;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xf6b8('0x0'));var config=require('../../config/environment');const stringOptions={'secret':config[_0xf6b8('0x1')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xf6b8('0x2')};function combineOptions(_0x15de3a){var _0x4d0ee5={};for(var _0x2b5ca9 in fileOptions){if(fileOptions[_0xf6b8('0x3')](_0x2b5ca9)){_0x4d0ee5[_0x2b5ca9]=fileOptions[_0x2b5ca9];}}if(_0x15de3a){for(var _0x347a0b in _0x15de3a){if(_0x15de3a['hasOwnProperty'](_0x347a0b)){_0x4d0ee5[_0x347a0b]=_0x15de3a[_0x347a0b];}}}return _0x4d0ee5;}exports[_0xf6b8('0x4')]=function(_0x79c66d,_0x446336,_0x3c3430,_0x557910){return new BPromise(function(_0x5f07f4,_0x33e9a0){_0x557910=combineOptions(_0x557910);var _0x577c92=new Buffer(_0x3c3430);var _0x24458c=fs[_0xf6b8('0x5')](_0x79c66d);var _0x16a799=fs[_0xf6b8('0x6')](_0x446336);var _0x21734d=crypto[_0xf6b8('0x7')](_0x557910['algorithm'],_0x577c92);_0x24458c['on']('data',function(_0x5ae09d){var _0x24117d=new Buffer(_0x21734d[_0xf6b8('0x8')](_0x5ae09d),_0xf6b8('0x9'));_0x16a799[_0xf6b8('0xa')](_0x24117d);});_0x24458c['on']('end',function(){try{var _0x4e5235=new Buffer(_0x21734d[_0xf6b8('0xb')](_0xf6b8('0x9')),'binary');_0x16a799[_0xf6b8('0xa')](_0x4e5235);_0x16a799[_0xf6b8('0xc')]();_0x16a799['on'](_0xf6b8('0xd'),function(){return _0x5f07f4(_0x446336);});}catch(_0x59bfed){fs[_0xf6b8('0xe')](_0x446336);return _0x33e9a0(_0x59bfed);}});});};exports['decryptFile']=function(_0x410345,_0x1ee041,_0x2e1748,_0x1a4b65){return new BPromise(function(_0x12f9a8,_0x567b58){_0x1a4b65=combineOptions(_0x1a4b65);var _0x48e375=new Buffer(_0x2e1748);var _0x3bb9ae=fs['createReadStream'](_0x410345);var _0x3cf63c=fs[_0xf6b8('0x6')](_0x1ee041);var _0x4a93a8=crypto['createDecipher'](_0x1a4b65[_0xf6b8('0xf')],_0x48e375);_0x3bb9ae['on'](_0xf6b8('0x10'),function(_0x3081db){var _0x2cac60=new Buffer(_0x4a93a8['update'](_0x3081db),'binary');_0x3cf63c['write'](_0x2cac60);});_0x3bb9ae['on'](_0xf6b8('0xc'),function(){try{var _0x2a8195=new Buffer(_0x4a93a8[_0xf6b8('0xb')]('binary'),_0xf6b8('0x9'));_0x3cf63c[_0xf6b8('0xa')](_0x2a8195);_0x3cf63c[_0xf6b8('0xc')]();_0x3cf63c['on'](_0xf6b8('0xd'),function(){return _0x12f9a8(_0x1ee041);});}catch(_0x5dd616){fs[_0xf6b8('0xe')](_0x1ee041);return _0x567b58(_0x5dd616);}});});};exports['encryptString']=function(_0x22c52d,_0x2b5bd3,_0x13a451){var _0x4127c9=_0x13a451||stringOptions[_0xf6b8('0xf')];var _0x55c72=_0x2b5bd3||stringOptions['secret'];var _0x1aca8a=crypto[_0xf6b8('0x7')](_0x4127c9,_0x55c72);var _0x4815f7=_0x1aca8a[_0xf6b8('0x8')](_0x22c52d,_0xf6b8('0x11'),_0xf6b8('0x12'));_0x4815f7+=_0x1aca8a[_0xf6b8('0xb')](_0xf6b8('0x12'));return _0x4815f7;};exports['decryptString']=function(_0x5e5b1c,_0xfa77d3,_0x9050c6){var _0x5a9514=_0x9050c6||stringOptions[_0xf6b8('0xf')];var _0x27e46d=_0xfa77d3||stringOptions[_0xf6b8('0x13')];var _0x5a7f55=crypto[_0xf6b8('0x14')](_0x5a9514,_0x27e46d);var _0xc958f4=_0x5a7f55['update'](_0x5e5b1c,_0xf6b8('0x12'),_0xf6b8('0x11'));_0xc958f4+=_0x5a7f55[_0xf6b8('0xb')](_0xf6b8('0x11'));return _0xc958f4;}; \ No newline at end of file +var _0x5334=['write','end','createWriteStream','createDecipher','final','close','unlink','secret','update','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','aes192','encryptFile','createReadStream','createCipher','algorithm','data','binary'];(function(_0xd898a1,_0x2fa04c){var _0x497f6e=function(_0x1f2162){while(--_0x1f2162){_0xd898a1['push'](_0xd898a1['shift']());}};_0x497f6e(++_0x2fa04c);}(_0x5334,0x84));var _0x4533=function(_0x38fa97,_0x51d816){_0x38fa97=_0x38fa97-0x0;var _0x5e4859=_0x5334[_0x38fa97];return _0x5e4859;};'use strict';var crypto=require(_0x4533('0x0'));var fs=require('fs');var BPromise=require(_0x4533('0x1'));var config=require(_0x4533('0x2'));const stringOptions={'secret':config[_0x4533('0x3')][_0x4533('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x4533('0x5')};function combineOptions(_0x5176b5){var _0x42184d={};for(var _0x11ce61 in fileOptions){if(fileOptions['hasOwnProperty'](_0x11ce61)){_0x42184d[_0x11ce61]=fileOptions[_0x11ce61];}}if(_0x5176b5){for(var _0x4a576a in _0x5176b5){if(_0x5176b5['hasOwnProperty'](_0x4a576a)){_0x42184d[_0x4a576a]=_0x5176b5[_0x4a576a];}}}return _0x42184d;}exports[_0x4533('0x6')]=function(_0x4dea06,_0x4d89e7,_0x487906,_0x3fbdc3){return new BPromise(function(_0x42f94b,_0x300877){_0x3fbdc3=combineOptions(_0x3fbdc3);var _0x2489b6=new Buffer(_0x487906);var _0x31018b=fs[_0x4533('0x7')](_0x4dea06);var _0xd417=fs['createWriteStream'](_0x4d89e7);var _0x5533=crypto[_0x4533('0x8')](_0x3fbdc3[_0x4533('0x9')],_0x2489b6);_0x31018b['on'](_0x4533('0xa'),function(_0x5465bf){var _0x7b2420=new Buffer(_0x5533['update'](_0x5465bf),_0x4533('0xb'));_0xd417[_0x4533('0xc')](_0x7b2420);});_0x31018b['on'](_0x4533('0xd'),function(){try{var _0x19b74e=new Buffer(_0x5533['final'](_0x4533('0xb')),_0x4533('0xb'));_0xd417[_0x4533('0xc')](_0x19b74e);_0xd417[_0x4533('0xd')]();_0xd417['on']('close',function(){return _0x42f94b(_0x4d89e7);});}catch(_0xe47213){fs['unlink'](_0x4d89e7);return _0x300877(_0xe47213);}});});};exports['decryptFile']=function(_0x466545,_0x34dea9,_0x5da8b8,_0x30c68c){return new BPromise(function(_0x1e6a1a,_0x2a9877){_0x30c68c=combineOptions(_0x30c68c);var _0x551b0d=new Buffer(_0x5da8b8);var _0x3ed873=fs['createReadStream'](_0x466545);var _0x3ddb36=fs[_0x4533('0xe')](_0x34dea9);var _0x56ab4f=crypto[_0x4533('0xf')](_0x30c68c['algorithm'],_0x551b0d);_0x3ed873['on']('data',function(_0x1c5cdd){var _0x9740a6=new Buffer(_0x56ab4f['update'](_0x1c5cdd),'binary');_0x3ddb36[_0x4533('0xc')](_0x9740a6);});_0x3ed873['on'](_0x4533('0xd'),function(){try{var _0x3467ba=new Buffer(_0x56ab4f[_0x4533('0x10')](_0x4533('0xb')),_0x4533('0xb'));_0x3ddb36[_0x4533('0xc')](_0x3467ba);_0x3ddb36['end']();_0x3ddb36['on'](_0x4533('0x11'),function(){return _0x1e6a1a(_0x34dea9);});}catch(_0xd55c04){fs[_0x4533('0x12')](_0x34dea9);return _0x2a9877(_0xd55c04);}});});};exports['encryptString']=function(_0x513011,_0x138fd9,_0x11e93a){var _0x4c640c=_0x11e93a||stringOptions['algorithm'];var _0x307bdd=_0x138fd9||stringOptions[_0x4533('0x13')];var _0xfd9409=crypto['createCipher'](_0x4c640c,_0x307bdd);var _0x44786f=_0xfd9409[_0x4533('0x14')](_0x513011,_0x4533('0x15'),_0x4533('0x16'));_0x44786f+=_0xfd9409[_0x4533('0x10')](_0x4533('0x16'));return _0x44786f;};exports[_0x4533('0x17')]=function(_0x27b653,_0x45ad98,_0x5f16bb){var _0x5c1e24=_0x5f16bb||stringOptions[_0x4533('0x9')];var _0x5aaf2d=_0x45ad98||stringOptions[_0x4533('0x13')];var _0x4e2b80=crypto[_0x4533('0xf')](_0x5c1e24,_0x5aaf2d);var _0x42ba2d=_0x4e2b80[_0x4533('0x14')](_0x27b653,_0x4533('0x16'),_0x4533('0x15'));_0x42ba2d+=_0x4e2b80[_0x4533('0x10')](_0x4533('0x15'));return _0x42ba2d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1406b4f..6e7f171 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 _0x5c12=['basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','QueryTypes','SELECT','Empty','length','num','push','query'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x5c12,0x188));var _0x25c1=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0x5c12[_0x5cabfd];return _0x4bc06c;};'use strict';var util=require('util');var path=require(_0x25c1('0x0'));var _=require(_0x25c1('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x25c1('0x2'));var zipdir=require(_0x25c1('0x3'));var rimraf=require(_0x25c1('0x4'));var db=require(_0x25c1('0x5'))['db'];var dbH=require(_0x25c1('0x5'))[_0x25c1('0x6')];var logger=require(_0x25c1('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x25c1('0x8')][0x2]);var QUERY=process[_0x25c1('0x8')][0x3];var PATH=process[_0x25c1('0x8')][0x4];function analyticExtractedReport(_0x4ab674,_0x5c69b1){var _0x24981c={'status':_0x4ab674};var _0x3b69ba={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c69b1){_0x24981c[_0x25c1('0x9')]=_0x5c69b1;}return db[_0x25c1('0xa')][_0x25c1('0xb')](_0x24981c,_0x3b69ba);}function main(){var _0x588f30=0x1388;var _0x3e062e;logger[_0x25c1('0xc')](util[_0x25c1('0xd')](_0x25c1('0xe'),EXTRACTED_REPORT_ID,_0x25c1('0xf')));return db['Setting'][_0x25c1('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x25c1('0x11'),'splitSizeCsv']})[_0x25c1('0x12')](function(_0x209af5){if(_0x209af5){_0x3e062e=_0x209af5;_0x588f30=_0x3e062e[_0x25c1('0x13')]||0x1388;}})[_0x25c1('0x12')](function(){return dbH['sequelize']['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x25c1('0x14')][_0x25c1('0x15')][_0x25c1('0x16')]});})[_0x25c1('0x12')](function(_0x17a032){if(!_0x17a032[0x0]['num']){return analyticExtractedReport(_0x25c1('0x17'));}var _0x55b62d=[];var _0x5d631e=0x0;var _0x5b852a=!![];if(_0x17a032&&_0x17a032[_0x25c1('0x18')]){var _0x1a08b5=_0x17a032[0x0]['num']%(_0x5d631e+_0x588f30);if(_0x3e062e['split']){for(;_0x5b852a;_0x5d631e+=_0x588f30,_0x1a08b5=_0x17a032[0x0][_0x25c1('0x19')]%(_0x5d631e+_0x588f30)){if(_0x1a08b5==0x0||_0x1a08b5==_0x17a032[0x0]['num']){_0x5b852a=![];}_0x55b62d[_0x25c1('0x1a')](dbH[_0x25c1('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x588f30,_0x5d631e),{'type':dbH[_0x25c1('0x14')][_0x25c1('0x15')][_0x25c1('0x16')]}));}}else{_0x55b62d[_0x25c1('0x1a')](dbH['sequelize'][_0x25c1('0x1b')](QUERY,{'type':dbH[_0x25c1('0x14')][_0x25c1('0x15')][_0x25c1('0x16')]}));}}var _0x517a46=path['dirname'](PATH);var _0x2a8a84=path[_0x25c1('0x1c')](PATH,_0x25c1('0x1d'));var _0x1c61e7=_0x3e062e[_0x25c1('0x11')]&&_0x55b62d[_0x25c1('0x18')]>0x1;var _0x2ba595=[];if(!fs[_0x25c1('0x1e')](path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84))&&_0x1c61e7){fs[_0x25c1('0x20')](path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84));}return BPromise[_0x25c1('0x21')](_0x55b62d,function(_0x399d72){_0x2ba595['push'](_0x399d72);})[_0x25c1('0x12')](function(){for(var _0x20dbb9=0x0;_0x20dbb9<_0x2ba595[_0x25c1('0x18')];_0x20dbb9+=0x1){var _0x1fb59f;var _0x21fdb8=_0x2ba595[_0x20dbb9];if(_0x1c61e7){_0x1fb59f=path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84,util['format'](_0x25c1('0x22'),_0x2a8a84,_0x20dbb9,_0x25c1('0x23')));}else{_0x1fb59f=path[_0x25c1('0x1f')](_0x517a46,util[_0x25c1('0xd')](_0x25c1('0x24'),_0x2a8a84,_0x25c1('0x23')));}fs['writeFileSync'](_0x1fb59f,csv(_0x21fdb8));}})[_0x25c1('0x12')](function(){if(_0x1c61e7){zipdir(path['join'](_0x517a46,_0x2a8a84),{'saveTo':path[_0x25c1('0x1f')](_0x517a46,util[_0x25c1('0xd')](_0x25c1('0x24'),_0x2a8a84,_0x25c1('0x25')))},function(_0x2e80b5,_0x21069c){});rimraf(path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84),function(){});}})[_0x25c1('0x12')](function(){logger[_0x25c1('0xc')](util['format'](_0x25c1('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x1c61e7?util[_0x25c1('0xd')](_0x25c1('0x24'),_0x2a8a84,_0x1c61e7?'zip':_0x25c1('0x23')):null);});})['catch'](function(_0x3bfcff){logger['info'](util[_0x25c1('0xd')](_0x25c1('0x27'),EXTRACTED_REPORT_ID,_0x25c1('0xf')),util[_0x25c1('0x28')](_0x3bfcff,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x25c1('0x29'));});}main(); \ No newline at end of file +var _0x4ea3=['split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','inspect','util','path','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting'];(function(_0x732ed6,_0x4c2afd){var _0x1cb22c=function(_0x96978b){while(--_0x96978b){_0x732ed6['push'](_0x732ed6['shift']());}};_0x1cb22c(++_0x4c2afd);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x34ea('0x0'));var path=require(_0x34ea('0x1'));var _=require(_0x34ea('0x2'));var csv=require(_0x34ea('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x34ea('0x4'));var rimraf=require('rimraf');var db=require(_0x34ea('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x34ea('0x6'))(_0x34ea('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x34ea('0x8')][0x2]);var QUERY=process[_0x34ea('0x8')][0x3];var PATH=process[_0x34ea('0x8')][0x4];function analyticExtractedReport(_0x18b461,_0x22b09e){var _0x5bec7c={'status':_0x18b461};var _0x341727={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22b09e){_0x5bec7c[_0x34ea('0x9')]=_0x22b09e;}return db[_0x34ea('0xa')]['update'](_0x5bec7c,_0x341727);}function main(){var _0x301b98=0x1388;var _0xea1be2;logger['info'](util['format'](_0x34ea('0xb'),EXTRACTED_REPORT_ID,_0x34ea('0xc')));return db[_0x34ea('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x34ea('0xe'),_0x34ea('0xf')]})[_0x34ea('0x10')](function(_0x233b11){if(_0x233b11){_0xea1be2=_0x233b11;_0x301b98=_0xea1be2[_0x34ea('0xf')]||0x1388;}})[_0x34ea('0x10')](function(){return dbH[_0x34ea('0x11')][_0x34ea('0x12')](util[_0x34ea('0x13')](_0x34ea('0x14'),QUERY),{'type':dbH[_0x34ea('0x11')]['QueryTypes'][_0x34ea('0x15')]});})[_0x34ea('0x10')](function(_0x14ebb9){if(!_0x14ebb9[0x0][_0x34ea('0x16')]){return analyticExtractedReport(_0x34ea('0x17'));}var _0x56b2d7=[];var _0x6a84a7=0x0;var _0x18c013=!![];if(_0x14ebb9&&_0x14ebb9[_0x34ea('0x18')]){var _0x305576=_0x14ebb9[0x0]['num']%(_0x6a84a7+_0x301b98);if(_0xea1be2[_0x34ea('0xe')]){for(;_0x18c013;_0x6a84a7+=_0x301b98,_0x305576=_0x14ebb9[0x0][_0x34ea('0x16')]%(_0x6a84a7+_0x301b98)){if(_0x305576==0x0||_0x305576==_0x14ebb9[0x0][_0x34ea('0x16')]){_0x18c013=![];}_0x56b2d7['push'](dbH[_0x34ea('0x11')][_0x34ea('0x12')](util[_0x34ea('0x13')](_0x34ea('0x19'),QUERY,_0x301b98,_0x6a84a7),{'type':dbH['sequelize'][_0x34ea('0x1a')][_0x34ea('0x15')]}));}}else{_0x56b2d7[_0x34ea('0x1b')](dbH[_0x34ea('0x11')]['query'](QUERY,{'type':dbH['sequelize'][_0x34ea('0x1a')][_0x34ea('0x15')]}));}}var _0x151fae=path['dirname'](PATH);var _0x5197a2=path[_0x34ea('0x1c')](PATH,_0x34ea('0x1d'));var _0x2a0ec2=_0xea1be2[_0x34ea('0xe')]&&_0x56b2d7[_0x34ea('0x18')]>0x1;var _0x697475=[];if(!fs['existsSync'](path[_0x34ea('0x1e')](_0x151fae,_0x5197a2))&&_0x2a0ec2){fs[_0x34ea('0x1f')](path[_0x34ea('0x1e')](_0x151fae,_0x5197a2));}return BPromise[_0x34ea('0x20')](_0x56b2d7,function(_0x5b5885){_0x697475['push'](_0x5b5885);})['then'](function(){for(var _0x142709=0x0;_0x142709<_0x697475[_0x34ea('0x18')];_0x142709+=0x1){var _0x37c214;var _0x4204d7=_0x697475[_0x142709];if(_0x2a0ec2){_0x37c214=path['join'](_0x151fae,_0x5197a2,util[_0x34ea('0x13')](_0x34ea('0x21'),_0x5197a2,_0x142709,_0x34ea('0x22')));}else{_0x37c214=path['join'](_0x151fae,util['format']('%s.%s',_0x5197a2,'csv'));}fs[_0x34ea('0x23')](_0x37c214,csv(_0x4204d7));}})[_0x34ea('0x10')](function(){if(_0x2a0ec2){zipdir(path[_0x34ea('0x1e')](_0x151fae,_0x5197a2),{'saveTo':path[_0x34ea('0x1e')](_0x151fae,util['format'](_0x34ea('0x24'),_0x5197a2,'zip'))},function(_0x2c6de8,_0x4f2b77){});rimraf(path[_0x34ea('0x1e')](_0x151fae,_0x5197a2),function(){});}})[_0x34ea('0x10')](function(){logger[_0x34ea('0x25')](util['format'](_0x34ea('0x26'),EXTRACTED_REPORT_ID,_0x34ea('0xc')));return analyticExtractedReport('Completed',_0x2a0ec2?util[_0x34ea('0x13')]('%s.%s',_0x5197a2,_0x2a0ec2?_0x34ea('0x27'):_0x34ea('0x22')):null);});})[_0x34ea('0x28')](function(_0x5ead76){logger['info'](util[_0x34ea('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x34ea('0xc')),util[_0x34ea('0x29')](_0x5ead76,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0b65455..71ae3c6 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x286aa2,_0x3ef125){var _0x12aa0c=function(_0x264530){while(--_0x264530){_0x286aa2['push'](_0x286aa2['shift']());}};_0x12aa0c(++_0x3ef125);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x506070,_0x9f83da){var _0x4049e4=function(_0x1d401f){while(--_0x1d401f){_0x506070['push'](_0x506070['shift']());}};_0x4049e4(++_0x9f83da);}(_0x5f2f,0x73));var _0xf5f2=function(_0x289010,_0x166cf8){_0x289010=_0x289010-0x0;var _0x124101=_0x5f2f[_0x289010];return _0x124101;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 89df077..f521be6 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 _0x8ad3=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','json2xls','bluebird','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip'];(function(_0x1bda6c,_0x5440b1){var _0x501a86=function(_0x1de54c){while(--_0x1de54c){_0x1bda6c['push'](_0x1bda6c['shift']());}};_0x501a86(++_0x5440b1);}(_0x8ad3,0xe8));var _0x38ad=function(_0x165ea1,_0x3ae398){_0x165ea1=_0x165ea1-0x0;var _0x5db1a3=_0x8ad3[_0x165ea1];return _0x5db1a3;};'use strict';var util=require(_0x38ad('0x0'));var path=require('path');var _=require(_0x38ad('0x1'));var fs=require('fs');var json2xls=require(_0x38ad('0x2'));var BPromise=require(_0x38ad('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x38ad('0x4'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x38ad('0x5')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x25d1d1,_0x36243d){var _0x1fb994={'status':_0x25d1d1};var _0xd9edd9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x36243d){_0x1fb994[_0x38ad('0x6')]=_0x36243d;}return db[_0x38ad('0x7')][_0x38ad('0x8')](_0x1fb994,_0xd9edd9);}function main(){var _0x201ee5=0x1388;var _0x307afc;logger[_0x38ad('0x9')](util[_0x38ad('0xa')](_0x38ad('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x38ad('0xc')][_0x38ad('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x38ad('0xe'),_0x38ad('0xf')]})['then'](function(_0x18ec09){if(_0x18ec09){_0x307afc=_0x18ec09;_0x201ee5=_0x307afc[_0x38ad('0xf')]||0x1388;}})['then'](function(){return dbH[_0x38ad('0x10')][_0x38ad('0x11')](util[_0x38ad('0xa')](_0x38ad('0x12'),QUERY),{'type':dbH[_0x38ad('0x10')][_0x38ad('0x13')][_0x38ad('0x14')]});})[_0x38ad('0x15')](function(_0x138ba4){if(!_0x138ba4[0x0][_0x38ad('0x16')]){return analyticExtractedReport(_0x38ad('0x17'));}var _0x319109=[];var _0x1a7b2f=0x0;var _0x1436f2=!![];if(_0x307afc[_0x38ad('0xe')]){if(_0x138ba4&&_0x138ba4[_0x38ad('0x18')]){var _0x5f06e9=_0x138ba4[0x0][_0x38ad('0x16')]%(_0x1a7b2f+_0x201ee5);for(;_0x1436f2;_0x1a7b2f+=_0x201ee5,_0x5f06e9=_0x138ba4[0x0][_0x38ad('0x16')]%(_0x1a7b2f+_0x201ee5)){if(_0x5f06e9==0x0||_0x5f06e9==_0x138ba4[0x0][_0x38ad('0x16')]){_0x1436f2=![];}_0x319109[_0x38ad('0x19')](dbH[_0x38ad('0x10')][_0x38ad('0x11')](util[_0x38ad('0xa')](_0x38ad('0x1a'),QUERY,_0x201ee5,_0x1a7b2f),{'type':dbH[_0x38ad('0x10')][_0x38ad('0x13')][_0x38ad('0x14')]}));}}}else{_0x319109[_0x38ad('0x19')](dbH[_0x38ad('0x10')][_0x38ad('0x11')](QUERY,{'type':dbH[_0x38ad('0x10')][_0x38ad('0x13')]['SELECT']}));}var _0x22bedd=path[_0x38ad('0x1b')](PATH);var _0x57cd33=path[_0x38ad('0x1c')](PATH,_0x38ad('0x1d'));var _0x8bb8ec=_0x307afc[_0x38ad('0xe')]&&_0x319109[_0x38ad('0x18')]>0x1;var _0x1f92db=[];if(!fs[_0x38ad('0x1e')](path[_0x38ad('0x1f')](_0x22bedd,_0x57cd33))&&_0x8bb8ec){fs['mkdirSync'](path['join'](_0x22bedd,_0x57cd33));}return BPromise[_0x38ad('0x20')](_0x319109,function(_0x27bf09){_0x1f92db[_0x38ad('0x19')](_0x27bf09);})[_0x38ad('0x15')](function(){for(var _0x5725f8=0x0;_0x5725f8<_0x1f92db['length'];_0x5725f8+=0x1){var _0x24cd86;var _0x5f5b64=_0x1f92db[_0x5725f8];if(_0x8bb8ec){_0x24cd86=path[_0x38ad('0x1f')](_0x22bedd,_0x57cd33,util['format']('%s%d.%s',_0x57cd33,_0x5725f8,_0x38ad('0x21')));}else{_0x24cd86=path[_0x38ad('0x1f')](_0x22bedd,util[_0x38ad('0xa')](_0x38ad('0x22'),_0x57cd33,_0x38ad('0x21')));}fs[_0x38ad('0x23')](_0x24cd86,json2xls(_0x5f5b64),_0x38ad('0x24'));}})[_0x38ad('0x15')](function(){if(_0x8bb8ec){zipdir(path['join'](_0x22bedd,_0x57cd33),{'saveTo':path[_0x38ad('0x1f')](_0x22bedd,util['format'](_0x38ad('0x22'),_0x57cd33,_0x38ad('0x25')))},function(_0x29c990,_0x253ca2){});rimraf(path[_0x38ad('0x1f')](_0x22bedd,_0x57cd33),function(){});}})['then'](function(){logger[_0x38ad('0x9')](util[_0x38ad('0xa')](_0x38ad('0x26'),EXTRACTED_REPORT_ID,_0x38ad('0x27')));return analyticExtractedReport(_0x38ad('0x28'),_0x8bb8ec?util['format'](_0x38ad('0x22'),_0x57cd33,_0x8bb8ec?'zip':_0x38ad('0x21')):null);});})[_0x38ad('0x29')](function(_0x13a2d5){logger[_0x38ad('0x9')](util[_0x38ad('0xa')](_0x38ad('0x2a'),EXTRACTED_REPORT_ID,_0x38ad('0x27')),util[_0x38ad('0x2b')](_0x13a2d5,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x38ad('0x2c'));});}main(); \ No newline at end of file +var _0x7a34=['dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','length','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb'];(function(_0x503c99,_0x44ebe5){var _0x464b39=function(_0x2fbc79){while(--_0x2fbc79){_0x503c99['push'](_0x503c99['shift']());}};_0x464b39(++_0x44ebe5);}(_0x7a34,0xb0));var _0x47a3=function(_0x5e721f,_0x440c13){_0x5e721f=_0x5e721f-0x0;var _0x3030a2=_0x7a34[_0x5e721f];return _0x3030a2;};'use strict';var util=require(_0x47a3('0x0'));var path=require(_0x47a3('0x1'));var _=require(_0x47a3('0x2'));var fs=require('fs');var json2xls=require(_0x47a3('0x3'));var BPromise=require(_0x47a3('0x4'));var zipdir=require(_0x47a3('0x5'));var rimraf=require(_0x47a3('0x6'));var db=require(_0x47a3('0x7'))['db'];var dbH=require(_0x47a3('0x7'))[_0x47a3('0x8')];var logger=require(_0x47a3('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x47a3('0xa')][0x2]);var QUERY=process[_0x47a3('0xa')][0x3];var PATH=process[_0x47a3('0xa')][0x4];function analyticExtractedReport(_0x54ab2b,_0x193e01){var _0x3097f8={'status':_0x54ab2b};var _0x3a6f46={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x193e01){_0x3097f8[_0x47a3('0xb')]=_0x193e01;}return db[_0x47a3('0xc')][_0x47a3('0xd')](_0x3097f8,_0x3a6f46);}function main(){var _0x581222=0x1388;var _0xaf28ed;logger['info'](util[_0x47a3('0xe')](_0x47a3('0xf'),EXTRACTED_REPORT_ID,_0x47a3('0x10')));return db['Setting'][_0x47a3('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x47a3('0x12'),_0x47a3('0x13')]})[_0x47a3('0x14')](function(_0x1a57d3){if(_0x1a57d3){_0xaf28ed=_0x1a57d3;_0x581222=_0xaf28ed[_0x47a3('0x13')]||0x1388;}})['then'](function(){return dbH[_0x47a3('0x15')][_0x47a3('0x16')](util[_0x47a3('0xe')](_0x47a3('0x17'),QUERY),{'type':dbH[_0x47a3('0x15')][_0x47a3('0x18')][_0x47a3('0x19')]});})[_0x47a3('0x14')](function(_0x4f2414){if(!_0x4f2414[0x0][_0x47a3('0x1a')]){return analyticExtractedReport('Empty');}var _0x31686a=[];var _0x13bcc3=0x0;var _0x3be92f=!![];if(_0xaf28ed[_0x47a3('0x12')]){if(_0x4f2414&&_0x4f2414['length']){var _0x2a1dc8=_0x4f2414[0x0][_0x47a3('0x1a')]%(_0x13bcc3+_0x581222);for(;_0x3be92f;_0x13bcc3+=_0x581222,_0x2a1dc8=_0x4f2414[0x0][_0x47a3('0x1a')]%(_0x13bcc3+_0x581222)){if(_0x2a1dc8==0x0||_0x2a1dc8==_0x4f2414[0x0][_0x47a3('0x1a')]){_0x3be92f=![];}_0x31686a[_0x47a3('0x1b')](dbH[_0x47a3('0x15')][_0x47a3('0x16')](util['format'](_0x47a3('0x1c'),QUERY,_0x581222,_0x13bcc3),{'type':dbH['sequelize'][_0x47a3('0x18')][_0x47a3('0x19')]}));}}}else{_0x31686a[_0x47a3('0x1b')](dbH['sequelize'][_0x47a3('0x16')](QUERY,{'type':dbH[_0x47a3('0x15')][_0x47a3('0x18')][_0x47a3('0x19')]}));}var _0x5252e6=path['dirname'](PATH);var _0x141b02=path['basename'](PATH,_0x47a3('0x1d'));var _0x1377b1=_0xaf28ed[_0x47a3('0x12')]&&_0x31686a[_0x47a3('0x1e')]>0x1;var _0x361c06=[];if(!fs['existsSync'](path[_0x47a3('0x1f')](_0x5252e6,_0x141b02))&&_0x1377b1){fs[_0x47a3('0x20')](path[_0x47a3('0x1f')](_0x5252e6,_0x141b02));}return BPromise[_0x47a3('0x21')](_0x31686a,function(_0x2028a7){_0x361c06[_0x47a3('0x1b')](_0x2028a7);})['then'](function(){for(var _0x3d17b5=0x0;_0x3d17b5<_0x361c06[_0x47a3('0x1e')];_0x3d17b5+=0x1){var _0x287ec2;var _0x46a7ee=_0x361c06[_0x3d17b5];if(_0x1377b1){_0x287ec2=path[_0x47a3('0x1f')](_0x5252e6,_0x141b02,util[_0x47a3('0xe')]('%s%d.%s',_0x141b02,_0x3d17b5,_0x47a3('0x22')));}else{_0x287ec2=path[_0x47a3('0x1f')](_0x5252e6,util[_0x47a3('0xe')](_0x47a3('0x23'),_0x141b02,_0x47a3('0x22')));}fs[_0x47a3('0x24')](_0x287ec2,json2xls(_0x46a7ee),_0x47a3('0x25'));}})[_0x47a3('0x14')](function(){if(_0x1377b1){zipdir(path[_0x47a3('0x1f')](_0x5252e6,_0x141b02),{'saveTo':path['join'](_0x5252e6,util[_0x47a3('0xe')](_0x47a3('0x23'),_0x141b02,_0x47a3('0x26')))},function(_0xf2c1f8,_0x297f37){});rimraf(path[_0x47a3('0x1f')](_0x5252e6,_0x141b02),function(){});}})[_0x47a3('0x14')](function(){logger[_0x47a3('0x27')](util[_0x47a3('0xe')](_0x47a3('0x28'),EXTRACTED_REPORT_ID,_0x47a3('0x10')));return analyticExtractedReport(_0x47a3('0x29'),_0x1377b1?util[_0x47a3('0xe')](_0x47a3('0x23'),_0x141b02,_0x1377b1?_0x47a3('0x26'):_0x47a3('0x22')):null);});})[_0x47a3('0x2a')](function(_0x5de94e){logger[_0x47a3('0x27')](util[_0x47a3('0xe')](_0x47a3('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x47a3('0x2c')](_0x5de94e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x47a3('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 34cda15..3252e17 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 _0x574d=['destroy','sortBy','catch','error','rewrite','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','context','outbound','cutdigits','${EXTEN:','VoiceExtensionId','CDR(routeid)=','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','interval','*,*,*,*','map','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1',',${EXTEN},','last','concat','Hangup','transaction'];(function(_0x6bc5a4,_0x569afa){var _0x4af1c1=function(_0x2da28b){while(--_0x2da28b){_0x6bc5a4['push'](_0x6bc5a4['shift']());}};_0x4af1c1(++_0x569afa);}(_0x574d,0x85));var _0xd574=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x574d[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x303705,_0x4dc7f9){var _0x1a92f8=this;return _0x303705[_0xd574('0x0')][_0xd574('0x1')]['findAll']({'raw':!![]})[_0xd574('0x2')](function(_0x421c40){_0x1a92f8[_0xd574('0x3')]=_0x421c40;return _0x303705[_0xd574('0x0')][_0xd574('0x4')][_0xd574('0x5')]({'where':{'IntervalId':_0x4dc7f9[_0xd574('0x6')]},'raw':!![]});})[_0xd574('0x2')](function(_0x3bab7f){return _0x303705[_0xd574('0x0')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0xd574('0x7')](_['map'](_0x3bab7f,_0xd574('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xd574('0x2')](function(_0x116f8a){var _0x8f22f4=_[_0xd574('0x9')](_0x116f8a,{'priority':'1'});var _0x57bf01=_[_0xd574('0x9')](_0x116f8a,{'isApp':0x1});var _0x7e494c=_[_0xd574('0xa')](_0x57bf01,_0xd574('0x8'));var _0x5c33e7=[_0xd574('0xb'),_0xd574('0xc')];var _0x665482=[];var _0xf9c74d=[];for(var _0x49b626 in _0x7e494c){if(_0x7e494c[_0xd574('0xd')](_0x49b626)){_0x1a92f8[_0xd574('0xe')]=0x2;_0x1a92f8['extensions']=[];_0x1a92f8[_0xd574('0xf')]=_[_0xd574('0x10')](_0x8f22f4,{'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')]});_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':util['format']('CDR(type)=%s',_0x7e494c[_0x49b626][0x0]['type']),'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0]['VoiceExtensionId']});if(_0x7e494c[_0x49b626][0x0][_0xd574('0x13')]===_0xd574('0x16')){if(_0x1a92f8['extension']){_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':'CDR(destination)='+(_0x1a92f8[_0xd574('0xf')][_0xd574('0x17')]?_0xd574('0x18')+_0x1a92f8[_0xd574('0xf')][_0xd574('0x17')]+'}':'${EXTEN}'),'context':_0x7e494c[_0x49b626][0x0]['context'],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});}_0x1a92f8[_0xd574('0x11')]['push']({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x1a')+_0x7e494c[_0x49b626][0x0][_0xd574('0x19')],'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});var _0x4c7f78=_0x1a92f8[_0xd574('0xe')]++;_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4c7f78+0x2)+'):Goto('+(_0x4c7f78+0x1)+')','context':_0x7e494c[_0x49b626][0x0]['context'],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x4c7f78,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});if(_0x1a92f8[_0xd574('0xf')]){_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0x1a92f8[_0xd574('0xf')][_0xd574('0x17')]?'CDR(prefix)=${EXTEN:0:'+_0x1a92f8[_0xd574('0xf')][_0xd574('0x17')]+'}':_0xd574('0x1b'),'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});}_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0]['type'],'app':'Set','appdata':_0xd574('0x1c')+_0x7e494c[_0x49b626][0x0][_0xd574('0x19')],'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});if(_0x1a92f8[_0xd574('0xf')]&&_0x1a92f8[_0xd574('0xf')][_0xd574('0xd')](_0xd574('0x1d'))&&_0x1a92f8[_0xd574('0xf')]['recordingFormat']!==_0xd574('0x1e')){_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x1f'),'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0]['exten'],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});_0x1a92f8['extensions'][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x20')+_0x1a92f8[_0xd574('0xf')][_0xd574('0x1d')]||_0xd574('0x21'),'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8['priority']++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0]['VoiceExtensionId']});}}_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x22'),'context':_0x7e494c[_0x49b626][0x0]['context'],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x23'),'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8['priority']++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});_0x1a92f8[_0xd574('0x11')][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x7e494c[_0x49b626][0x0]['context'],'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'priority':_0x1a92f8[_0xd574('0xe')]++,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});for(var _0x43acb0=0x0,_0x3b8170=0x0;_0x43acb0<_0x7e494c[_0x49b626]['length'];_0x43acb0+=0x1,_0x3b8170=0x0){var _0x1516b7=_0x7e494c[_0x49b626][_0x43acb0];if(_0x1516b7[_0xd574('0x13')]){_0x1516b7[_0xd574('0x13')]=_0x1516b7['type'][_0xd574('0x24')]();}var _0x444d9e=[];var _0x15b603=[];delete _0x1516b7['id'];delete _0x1516b7[_0xd574('0x25')];delete _0x1516b7['updatedAt'];var _0x40d150=_0x1516b7[_0xd574('0x26')]!==_0xd574('0x27')?[_0x1516b7[_0xd574('0x26')]]:_0x1516b7[_0xd574('0x6')]?_[_0xd574('0x28')](_[_0xd574('0x9')](_0x1a92f8[_0xd574('0x3')],{'IntervalId':_0x1516b7[_0xd574('0x6')]}),_0xd574('0x26')):[];if(_0x1516b7[_0xd574('0xd')](_0xd574('0x29'))){if(_0x1516b7[_0xd574('0x29')]&&_0x1516b7[_0xd574('0x29')]!=='--'){_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7[_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x2a')+_0x1516b7[_0xd574('0x29')],'context':_0x1516b7[_0xd574('0x15')],'exten':_0x1516b7[_0xd574('0x8')],'priority':_0x40d150[_0xd574('0x2b')]+_0x1a92f8['priority']+_0x3b8170++,'VoiceExtensionId':_0x1516b7[_0xd574('0x19')]});}}if(_0x1516b7[_0xd574('0x13')]==='outbound'&&_0x1516b7[_0xd574('0xd')](_0xd574('0x2c'))){if(_0x1516b7[_0xd574('0x2c')]){_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7[_0xd574('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1516b7[_0xd574('0x2c')]+')','context':_0x1516b7[_0xd574('0x15')],'exten':_0x1516b7[_0xd574('0x8')],'priority':_0x40d150['length']+_0x1a92f8['priority']+_0x3b8170++,'VoiceExtensionId':_0x1516b7['VoiceExtensionId']});}else{_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7[_0xd574('0x13')],'app':_0xd574('0x2d'),'appdata':_0xd574('0x2e'),'context':_0x1516b7[_0xd574('0x15')],'exten':_0x1516b7[_0xd574('0x8')],'priority':_0x40d150[_0xd574('0x2b')]+_0x1a92f8['priority']+_0x3b8170++,'VoiceExtensionId':_0x1516b7['VoiceExtensionId']});}}if(_0x1516b7[_0xd574('0xd')](_0xd574('0x2f'))){if(_0x5c33e7[_0xd574('0x30')](_0x1516b7[_0xd574('0x31')][_0xd574('0x24')]())>=0x0&&_0x1516b7[_0xd574('0x32')]!==_0xd574('0x33')){if(_0x1516b7['answer']){_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7[_0xd574('0x13')],'app':'ExecIf','appdata':_0xd574('0x34'),'context':_0x1516b7[_0xd574('0x15')],'exten':_0x1516b7['exten'],'priority':_0x40d150['length']+_0x1a92f8[_0xd574('0xe')]+_0x3b8170++,'VoiceExtensionId':_0x1516b7[_0xd574('0x19')]});_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7[_0xd574('0x13')],'app':_0xd574('0x14'),'appdata':_0xd574('0x35'),'context':_0x1516b7[_0xd574('0x15')],'exten':_0x1516b7[_0xd574('0x8')],'priority':_0x40d150[_0xd574('0x2b')]+_0x1a92f8[_0xd574('0xe')]+_0x3b8170++,'VoiceExtensionId':_0x1516b7[_0xd574('0x19')]});}else{_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7[_0xd574('0x13')],'app':_0xd574('0x2d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1516b7[_0xd574('0x15')],'exten':_0x1516b7['exten'],'priority':_0x40d150[_0xd574('0x2b')]+_0x1a92f8[_0xd574('0xe')]+_0x3b8170++,'VoiceExtensionId':_0x1516b7[_0xd574('0x19')]});_0x444d9e[_0xd574('0x12')]({'type':_0x1516b7['type'],'app':_0xd574('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1516b7['context'],'exten':_0x1516b7[_0xd574('0x8')],'priority':_0x40d150['length']+_0x1a92f8[_0xd574('0xe')]+_0x3b8170++,'VoiceExtensionId':_0x1516b7[_0xd574('0x19')]});}}}for(var _0x43c7aa=0x0;_0x43c7aa<_0x40d150[_0xd574('0x2b')];_0x43c7aa+=0x1){var _0x508109=_0x1a92f8['priority']+_0x40d150['length'];var _0x2d464a=_0x43c7aa===_0x40d150[_0xd574('0x2b')]-0x1?_0x1a92f8[_0xd574('0xe')]+_0x444d9e[_0xd574('0x2b')]+_0x15b603['length']+0x2:_0x1a92f8[_0xd574('0xe')]+_0x43c7aa+0x1;_0x444d9e['splice'](_0x43c7aa,0x0,{'type':_0x1516b7[_0xd574('0x13')],'app':'GotoIfTime','appdata':_0x40d150[_0x43c7aa]+'?'+_0x1516b7['context']+_0xd574('0x36')+_0x508109+':'+_0x1516b7['context']+_0xd574('0x36')+_0x2d464a,'exten':_0x1516b7['exten'],'context':_0x1516b7['context'],'priority':_0x1a92f8[_0xd574('0xe')]+_0x43c7aa,'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});}_0x1516b7[_0xd574('0xe')]=_0x444d9e[_0xd574('0x2b')]?_[_0xd574('0x37')](_0x444d9e)[_0xd574('0xe')]+0x1:_0x1a92f8[_0xd574('0xe')];_0x1a92f8[_0xd574('0xe')]=(_0x15b603[_0xd574('0x2b')]?_[_0xd574('0x37')](_0x15b603)[_0xd574('0xe')]:_0x1516b7[_0xd574('0xe')])+0x1;_0x1a92f8[_0xd574('0x11')]=_[_0xd574('0x38')](_0x1a92f8[_0xd574('0x11')],_0x444d9e,[_0x1516b7],_0x15b603);}_0x1a92f8['extensions'][_0xd574('0x12')]({'type':_0x7e494c[_0x49b626][0x0][_0xd574('0x13')],'app':_0xd574('0x39'),'exten':_0x7e494c[_0x49b626][0x0][_0xd574('0x8')],'context':_0x7e494c[_0x49b626][0x0][_0xd574('0x15')],'priority':_0x1a92f8[_0xd574('0xe')],'VoiceExtensionId':_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]});_0x665482[_0xd574('0x12')](_0x7e494c[_0x49b626][0x0][_0xd574('0x19')]);_0xf9c74d=_['concat'](_0xf9c74d,_0x1a92f8[_0xd574('0x11')]);}}return _0x303705[_0xd574('0x3a')](function(_0x51fe91){return _0x303705[_0xd574('0x0')]['VoiceExtension'][_0xd574('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x665482}},'transaction':_0x51fe91})[_0xd574('0x2')](function(_0x79b919){return _0x303705['models'][_0xd574('0x4')]['bulkCreate'](_[_0xd574('0x3c')](_0xf9c74d,_0xd574('0xe')),{'transaction':_0x51fe91});});});})[_0xd574('0x3d')](function(_0x45adfc){console[_0xd574('0x3e')](_0x45adfc);});}exports[_0xd574('0x3f')]=rewrite; \ No newline at end of file +var _0xc336=['format','context','VoiceExtensionId','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','Set','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','hasOwnProperty','priority','extensions','extension','find','type'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0xc336,0x1d6));var _0x6c33=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xc336[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x6c33('0x0'));var util=require(_0x6c33('0x1'));function rewrite(_0x5b1ce4,_0x560ea6){var _0x932882=this;return _0x5b1ce4['models']['Interval'][_0x6c33('0x2')]({'raw':!![]})[_0x6c33('0x3')](function(_0x4bed8b){_0x932882[_0x6c33('0x4')]=_0x4bed8b;return _0x5b1ce4[_0x6c33('0x5')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x560ea6[_0x6c33('0x6')]},'raw':!![]});})[_0x6c33('0x3')](function(_0x5c5fdb){return _0x5b1ce4[_0x6c33('0x5')][_0x6c33('0x7')][_0x6c33('0x2')]({'where':{'exten':{'$in':_[_0x6c33('0x8')](_[_0x6c33('0x9')](_0x5c5fdb,'exten'))}},'order':[{'raw':_0x6c33('0xa')}],'raw':!![]});})['then'](function(_0xf4039b){var _0x31e6a6=_['filter'](_0xf4039b,{'priority':'1'});var _0x5b74e6=_[_0x6c33('0xb')](_0xf4039b,{'isApp':0x1});var _0x48e336=_['groupBy'](_0x5b74e6,_0x6c33('0xc'));var _0x4bff40=[_0x6c33('0xd'),'playback'];var _0x498de6=[];var _0xcb31d1=[];for(var _0x3e887d in _0x48e336){if(_0x48e336[_0x6c33('0xe')](_0x3e887d)){_0x932882[_0x6c33('0xf')]=0x2;_0x932882[_0x6c33('0x10')]=[];_0x932882[_0x6c33('0x11')]=_[_0x6c33('0x12')](_0x31e6a6,{'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')]});_0x932882[_0x6c33('0x10')]['push']({'type':_0x48e336[_0x3e887d][0x0][_0x6c33('0x13')],'app':'Set','appdata':util[_0x6c33('0x14')]('CDR(type)=%s',_0x48e336[_0x3e887d][0x0][_0x6c33('0x13')]),'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0]['exten'],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});if(_0x48e336[_0x3e887d][0x0][_0x6c33('0x13')]===_0x6c33('0x17')){if(_0x932882[_0x6c33('0x11')]){_0x932882['extensions'][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0][_0x6c33('0x13')],'app':'Set','appdata':_0x6c33('0x19')+(_0x932882[_0x6c33('0x11')][_0x6c33('0x1a')]?_0x6c33('0x1b')+_0x932882[_0x6c33('0x11')]['cutdigits']+'}':_0x6c33('0x1c')),'context':_0x48e336[_0x3e887d][0x0]['context'],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0]['VoiceExtensionId']});}_0x932882[_0x6c33('0x10')][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x48e336[_0x3e887d][0x0]['VoiceExtensionId'],'context':_0x48e336[_0x3e887d][0x0]['context'],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});var _0x2a5afb=_0x932882['priority']++;_0x932882['extensions'][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':_0x6c33('0x1d'),'appdata':_0x6c33('0x1e')+(_0x2a5afb+0x2)+'):Goto('+(_0x2a5afb+0x1)+')','context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x2a5afb,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});if(_0x932882[_0x6c33('0x11')]){_0x932882[_0x6c33('0x10')][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0][_0x6c33('0x13')],'app':_0x6c33('0x1f'),'appdata':_0x932882[_0x6c33('0x11')][_0x6c33('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x932882[_0x6c33('0x11')][_0x6c33('0x1a')]+'}':_0x6c33('0x20'),'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882['priority']++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0]['VoiceExtensionId']});}_0x932882[_0x6c33('0x10')][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':'Set','appdata':_0x6c33('0x21')+_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')],'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});if(_0x932882[_0x6c33('0x11')]&&_0x932882[_0x6c33('0x11')]['hasOwnProperty'](_0x6c33('0x22'))&&_0x932882[_0x6c33('0x11')][_0x6c33('0x22')]!==_0x6c33('0x23')){_0x932882[_0x6c33('0x10')][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':_0x6c33('0x1f'),'appdata':_0x6c33('0x24'),'context':_0x48e336[_0x3e887d][0x0]['context'],'exten':_0x48e336[_0x3e887d][0x0]['exten'],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});_0x932882[_0x6c33('0x10')][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':_0x6c33('0x1f'),'appdata':_0x6c33('0x25')+_0x932882['extension'][_0x6c33('0x22')]||_0x6c33('0x26'),'context':_0x48e336[_0x3e887d][0x0]['context'],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0]['VoiceExtensionId']});}}_0x932882[_0x6c33('0x10')]['push']({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':_0x6c33('0x1f'),'appdata':_0x6c33('0x27'),'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0]['exten'],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});_0x932882[_0x6c33('0x10')]['push']({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':_0x6c33('0x1f'),'appdata':_0x6c33('0x28'),'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882[_0x6c33('0xf')]++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});_0x932882['extensions'][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0]['type'],'app':_0x6c33('0x1f'),'appdata':_0x6c33('0x29'),'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'priority':_0x932882['priority']++,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});for(var _0x85c24e=0x0,_0x5ee8ae=0x0;_0x85c24e<_0x48e336[_0x3e887d][_0x6c33('0x2a')];_0x85c24e+=0x1,_0x5ee8ae=0x0){var _0x3a97bb=_0x48e336[_0x3e887d][_0x85c24e];if(_0x3a97bb['type']){_0x3a97bb[_0x6c33('0x13')]=_0x3a97bb[_0x6c33('0x13')][_0x6c33('0x2b')]();}var _0x3bc2cb=[];var _0x5a86c5=[];delete _0x3a97bb['id'];delete _0x3a97bb[_0x6c33('0x2c')];delete _0x3a97bb[_0x6c33('0x2d')];var _0x22f168=_0x3a97bb[_0x6c33('0x2e')]!==_0x6c33('0x2f')?[_0x3a97bb[_0x6c33('0x2e')]]:_0x3a97bb[_0x6c33('0x6')]?_[_0x6c33('0x9')](_[_0x6c33('0xb')](_0x932882['intervals'],{'IntervalId':_0x3a97bb[_0x6c33('0x6')]}),_0x6c33('0x2e')):[];if(_0x3a97bb[_0x6c33('0xe')](_0x6c33('0x30'))){if(_0x3a97bb['tag']&&_0x3a97bb[_0x6c33('0x30')]!=='--'){_0x3bc2cb[_0x6c33('0x18')]({'type':_0x3a97bb[_0x6c33('0x13')],'app':_0x6c33('0x1f'),'appdata':'CDR(tag)='+_0x3a97bb['tag'],'context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb['exten'],'priority':_0x22f168[_0x6c33('0x2a')]+_0x932882['priority']+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb[_0x6c33('0x16')]});}}if(_0x3a97bb[_0x6c33('0x13')]==='outbound'&&_0x3a97bb[_0x6c33('0xe')](_0x6c33('0x31'))){if(_0x3a97bb[_0x6c33('0x31')]){_0x3bc2cb['push']({'type':_0x3a97bb[_0x6c33('0x13')],'app':_0x6c33('0x1d'),'appdata':_0x6c33('0x32')+_0x3a97bb['callerID']+')','context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb['exten'],'priority':_0x22f168['length']+_0x932882[_0x6c33('0xf')]+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb[_0x6c33('0x16')]});}else{_0x3bc2cb[_0x6c33('0x18')]({'type':_0x3a97bb[_0x6c33('0x13')],'app':_0x6c33('0x1d'),'appdata':_0x6c33('0x33'),'context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb[_0x6c33('0xc')],'priority':_0x22f168[_0x6c33('0x2a')]+_0x932882[_0x6c33('0xf')]+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb[_0x6c33('0x16')]});}}if(_0x3a97bb[_0x6c33('0xe')]('answer')){if(_0x4bff40[_0x6c33('0x34')](_0x3a97bb[_0x6c33('0x35')][_0x6c33('0x2b')]())>=0x0&&_0x3a97bb[_0x6c33('0x36')]!=='custom'){if(_0x3a97bb['answer']){_0x3bc2cb[_0x6c33('0x18')]({'type':_0x3a97bb[_0x6c33('0x13')],'app':_0x6c33('0x1d'),'appdata':_0x6c33('0x37'),'context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb[_0x6c33('0xc')],'priority':_0x22f168[_0x6c33('0x2a')]+_0x932882[_0x6c33('0xf')]+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb[_0x6c33('0x16')]});_0x3bc2cb[_0x6c33('0x18')]({'type':_0x3a97bb[_0x6c33('0x13')],'app':_0x6c33('0x1f'),'appdata':_0x6c33('0x38'),'context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb[_0x6c33('0xc')],'priority':_0x22f168['length']+_0x932882['priority']+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb[_0x6c33('0x16')]});}else{_0x3bc2cb[_0x6c33('0x18')]({'type':_0x3a97bb['type'],'app':_0x6c33('0x1d'),'appdata':_0x6c33('0x39'),'context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb[_0x6c33('0xc')],'priority':_0x22f168[_0x6c33('0x2a')]+_0x932882['priority']+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb['VoiceExtensionId']});_0x3bc2cb[_0x6c33('0x18')]({'type':_0x3a97bb['type'],'app':'Set','appdata':_0x6c33('0x3a'),'context':_0x3a97bb[_0x6c33('0x15')],'exten':_0x3a97bb[_0x6c33('0xc')],'priority':_0x22f168['length']+_0x932882[_0x6c33('0xf')]+_0x5ee8ae++,'VoiceExtensionId':_0x3a97bb['VoiceExtensionId']});}}}for(var _0x279765=0x0;_0x279765<_0x22f168[_0x6c33('0x2a')];_0x279765+=0x1){var _0xb98e8b=_0x932882[_0x6c33('0xf')]+_0x22f168[_0x6c33('0x2a')];var _0x129121=_0x279765===_0x22f168[_0x6c33('0x2a')]-0x1?_0x932882[_0x6c33('0xf')]+_0x3bc2cb[_0x6c33('0x2a')]+_0x5a86c5[_0x6c33('0x2a')]+0x2:_0x932882[_0x6c33('0xf')]+_0x279765+0x1;_0x3bc2cb[_0x6c33('0x3b')](_0x279765,0x0,{'type':_0x3a97bb['type'],'app':_0x6c33('0x3c'),'appdata':_0x22f168[_0x279765]+'?'+_0x3a97bb[_0x6c33('0x15')]+_0x6c33('0x3d')+_0xb98e8b+':'+_0x3a97bb[_0x6c33('0x15')]+_0x6c33('0x3d')+_0x129121,'exten':_0x3a97bb[_0x6c33('0xc')],'context':_0x3a97bb[_0x6c33('0x15')],'priority':_0x932882[_0x6c33('0xf')]+_0x279765,'VoiceExtensionId':_0x48e336[_0x3e887d][0x0]['VoiceExtensionId']});}_0x3a97bb['priority']=_0x3bc2cb[_0x6c33('0x2a')]?_[_0x6c33('0x3e')](_0x3bc2cb)[_0x6c33('0xf')]+0x1:_0x932882[_0x6c33('0xf')];_0x932882[_0x6c33('0xf')]=(_0x5a86c5['length']?_[_0x6c33('0x3e')](_0x5a86c5)[_0x6c33('0xf')]:_0x3a97bb[_0x6c33('0xf')])+0x1;_0x932882[_0x6c33('0x10')]=_['concat'](_0x932882[_0x6c33('0x10')],_0x3bc2cb,[_0x3a97bb],_0x5a86c5);}_0x932882[_0x6c33('0x10')][_0x6c33('0x18')]({'type':_0x48e336[_0x3e887d][0x0][_0x6c33('0x13')],'app':_0x6c33('0x3f'),'exten':_0x48e336[_0x3e887d][0x0][_0x6c33('0xc')],'context':_0x48e336[_0x3e887d][0x0][_0x6c33('0x15')],'priority':_0x932882['priority'],'VoiceExtensionId':_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]});_0x498de6[_0x6c33('0x18')](_0x48e336[_0x3e887d][0x0][_0x6c33('0x16')]);_0xcb31d1=_['concat'](_0xcb31d1,_0x932882[_0x6c33('0x10')]);}}return _0x5b1ce4[_0x6c33('0x40')](function(_0x28ed16){return _0x5b1ce4[_0x6c33('0x5')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x498de6}},'transaction':_0x28ed16})[_0x6c33('0x3')](function(_0x472ec5){return _0x5b1ce4['models'][_0x6c33('0x7')][_0x6c33('0x41')](_[_0x6c33('0x42')](_0xcb31d1,_0x6c33('0xf')),{'transaction':_0x28ed16});});});})[_0x6c33('0x43')](function(_0x545784){console[_0x6c33('0x44')](_0x545784);});}exports[_0x6c33('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0c99f35..4b3ab83 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x16ed96,_0x179e11){var _0x51a1c8=function(_0x2973c7){while(--_0x2973c7){_0x16ed96['push'](_0x16ed96['shift']());}};_0x51a1c8(++_0x179e11);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xcb91[_0x4c1ec2];return _0x3f6f1c;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x259b09,_0x139776){var _0x526927=function(_0x21d742){while(--_0x21d742){_0x259b09['push'](_0x259b09['shift']());}};_0x526927(++_0x139776);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xcb91[_0x443494];return _0x4a6794;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0da1394..94d89b3 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 _0x7ef8=['fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','where','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','insert','into','cm_hopper_black','cm_contacts','.CmListId','field','ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','spread','push','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','email\x20wrong\x20format','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','campaigns','CampaignId','each','then','finish','affectedRows','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../mysqldb','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7ef8,0xe8));var _0x87ef=function(_0x89ac51,_0x5ecae1){_0x89ac51=_0x89ac51-0x0;var _0x166509=_0x7ef8[_0x89ac51];return _0x166509;};'use strict';var fs=require('fs');var path=require(_0x87ef('0x0'));var _=require(_0x87ef('0x1'));var Papa=require('papaparse');var util=require(_0x87ef('0x2'));var BPromise=require(_0x87ef('0x3'));var moment=require(_0x87ef('0x4'));var squel=require(_0x87ef('0x5'));var Redis=require('ioredis');var db=require(_0x87ef('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x87ef('0x7'));config['redis']=_[_0x87ef('0x8')](config[_0x87ef('0x9')],{'host':_0x87ef('0xa'),'port':0x18eb});var socket=require(_0x87ef('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x87ef('0xc')](_0x87ef('0xd'));function isEmail(_0x4671bd){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))*$/[_0x87ef('0xe')](_0x4671bd);}function selectNotIn(_0x581671,_0x9ac195,_0x43ecc2,_0x3ddccf,_0x92fa97){return squel[_0x87ef('0xf')]()['field'](_0x87ef('0x10'))[_0x87ef('0x11')](_0x3ddccf)[_0x87ef('0x12')](_0x9ac195,null,_0x9ac195+_0x87ef('0x13')+_0x3ddccf+'.'+_0x43ecc2)['where'](_0x3ddccf+'.'+_0x43ecc2+_0x87ef('0x14')+_0x581671+'.'+_0x43ecc2)['where'](_0x9ac195+'.dialCheckDuplicateType\x20IN\x20('+_0x92fa97[_0x87ef('0x12')]()+')');}function insertCmHopper(_0x2aafd1,_0x31de3d,_0x258f1d,_0x2a69eb,_0x59f8c7){var _0x41ae37=[_0x87ef('0x15'),_0x87ef('0x16'),_0x87ef('0x17'),'cm_contacts.ListId',_0x31de3d+'.'+_0x2a69eb,_0x87ef('0x18'),_0x87ef('0x19'),'cm_contacts.priority',_0x87ef('0x1a'),'\x22'+_0x59f8c7+'\x22'];return squel['insert']()['into'](_0x87ef('0x1b'))[_0x87ef('0x1c')]([_0x87ef('0x10'),_0x87ef('0x1d'),_0x87ef('0x1e'),_0x87ef('0x1f'),_0x2a69eb,_0x87ef('0x20'),_0x87ef('0x21'),_0x87ef('0x22'),_0x87ef('0x23'),_0x87ef('0x24')],squel['select']()[_0x87ef('0x25')](_0x41ae37)['from'](_0x31de3d)['join']('cm_contacts',null,_0x87ef('0x26')+_0x31de3d+'.CmListId')[_0x87ef('0x12')](_0x258f1d,null,_0x258f1d+_0x87ef('0x13')+_0x31de3d+'.'+_0x2a69eb)['where'](_0x31de3d+_0x87ef('0x27'),_0x2aafd1)['where'](_0x87ef('0x28'),NOW)[_0x87ef('0x29')](_0x87ef('0x2a'),selectNotIn(_0x31de3d,_0x258f1d,_0x2a69eb,_0x87ef('0x1b'),[_0x87ef('0x2b'),_0x87ef('0x2c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x31de3d,_0x258f1d,_0x2a69eb,_0x87ef('0x1b'),[_0x87ef('0x2b')])))[_0x87ef('0x2d')]();}function insertCmHopperBlack(_0x36cefc,_0x2b5790,_0x5984d0,_0x5317d0){var _0x3da294=[_0x87ef('0x15'),_0x87ef('0x17'),_0x87ef('0x2e'),_0x2b5790+'.'+_0x5317d0,'cm_contacts.createdAt',_0x87ef('0x19')];return squel[_0x87ef('0x2f')]()[_0x87ef('0x30')](_0x87ef('0x31'))[_0x87ef('0x1c')]([_0x87ef('0x10'),_0x87ef('0x1e'),'ListId',_0x5317d0,'createdAt',_0x87ef('0x21')],squel[_0x87ef('0xf')]()[_0x87ef('0x25')](_0x3da294)[_0x87ef('0x11')](_0x2b5790)[_0x87ef('0x12')](_0x87ef('0x32'),null,'cm_contacts.ListId\x20=\x20'+_0x2b5790+_0x87ef('0x33'))[_0x87ef('0x12')](_0x5984d0,null,_0x5984d0+_0x87ef('0x13')+_0x2b5790+'.'+_0x5317d0)[_0x87ef('0x29')](_0x2b5790+_0x87ef('0x27'),_0x36cefc)[_0x87ef('0x29')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x87ef('0x29')](_0x87ef('0x2a'),squel[_0x87ef('0xf')]()[_0x87ef('0x34')](_0x87ef('0x10'))[_0x87ef('0x11')](_0x87ef('0x31'))[_0x87ef('0x29')](_0x87ef('0x35'),_0x36cefc)['where'](_0x5317d0+'\x20=\x20?',_0x2b5790+'.'+_0x5317d0)))[_0x87ef('0x2d')]();}function insertCmContact(_0x2a122a,_0x31e9db,_0x9c71ca,_0x181a03){var _0x55de39=_[_0x87ef('0x36')](_['keys'](_0x181a03),[_0x87ef('0x1f'),'CompanyId',_0x87ef('0x20'),_0x87ef('0x21')]);return squel[_0x87ef('0x2f')]()[_0x87ef('0x30')](_0x87ef('0x32'))[_0x87ef('0x1c')](_0x55de39,squel[_0x87ef('0xf')]()[_0x87ef('0x25')](_0x55de39)[_0x87ef('0x11')](_0x31e9db)[_0x87ef('0x29')]('('+_0x9c71ca['join'](',')+_0x87ef('0x37'),squel[_0x87ef('0xf')]()[_0x87ef('0x25')](_0x9c71ca)[_0x87ef('0x11')](_0x87ef('0x32'))[_0x87ef('0x29')](_0x87ef('0x35'),_0x2a122a)[_0x87ef('0x29')](_0x87ef('0x38')))[_0x87ef('0x29')](_0x87ef('0x39'),squel[_0x87ef('0xf')]()['field'](_0x87ef('0x3a'),_0x87ef('0x3b'))['from'](_0x31e9db)[_0x87ef('0x3c')](_0x9c71ca[_0x87ef('0x12')](','))))[_0x87ef('0x2d')]();}function handleStop(){logger[_0x87ef('0x3d')](_0x87ef('0x3e'));stopped=!![];}function handleUncaughtException(_0x5e14e3){logger[_0x87ef('0x3f')](_0x5e14e3[_0x87ef('0x40')]);process[_0x87ef('0x41')](0x1);}function handleError(_0x2fae8f,_0x30a460){stats['errors']['push']({'name':_0x30a460[_0x87ef('0x42')],'message':_0x30a460['message'],'row':_0x2fae8f});}function handleQuery(_0x5b5250){logger[_0x87ef('0x3d')](_0x5b5250);return db[_0x87ef('0x43')]['query'](_0x5b5250)[_0x87ef('0x44')](function(_0x8f2081){results[_0x87ef('0x45')](_0x8f2081);})[_0x87ef('0x46')](function(_0x3b8435){logger['error'](_0x3b8435[_0x87ef('0x40')]);});}function main(_0x1be279,_0x269f95,_0x39a5fb,_0x5cb852){logger[_0x87ef('0x3d')](_0x87ef('0x47'),_0x1be279,JSON['stringify'](_0x269f95));process[_0x87ef('0x48')](_0x87ef('0x49'));var _0x348e6d=_0x269f95[_0x87ef('0x4a')];var _0x6f5e24=_0x269f95[_0x87ef('0x4b')];var _0x3e5d27=path['join'](config[_0x87ef('0x4c')],_0x87ef('0x4d'),_0x6f5e24+_0x87ef('0x4e'));var _0xd710f9=_[_0x87ef('0x4f')](_0x348e6d)['join']();logger['info'](_0x87ef('0x50'),_0xd710f9);fs['writeFileSync'](_0x3e5d27,_0xd710f9+'\x0a');Papa['parse'](fs[_0x87ef('0x51')](_0x1be279),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2f769b,_0x34e450){try{for(var _0x50f6a7=0x0,_0x4ec7df=[];_0x50f6a7<_0x2f769b[_0x87ef('0x52')][_0x87ef('0x53')];_0x50f6a7++){stats[_0x87ef('0x54')]+=0x1;if(_0x2f769b[_0x87ef('0x55')][_0x50f6a7]){handleError(_0x2f769b['data'][_0x50f6a7],_0x2f769b[_0x87ef('0x55')][_0x50f6a7]);}else{var _0xdea39b=[];for(var _0x4eaf14 in _0x348e6d){if(_0x348e6d[_0x87ef('0x56')](_0x4eaf14)){if(_0x2f769b[_0x87ef('0x52')][_0x50f6a7][_0x348e6d[_0x4eaf14]]){var _0x17b8b9=_[_0x87ef('0x57')](_0x2f769b[_0x87ef('0x52')][_0x50f6a7][_0x348e6d[_0x4eaf14]][_0x87ef('0x58')](/"/g,'\x27'));switch(_0x4eaf14){case _0x87ef('0x1d'):var _0x1e13cb=moment(_0x17b8b9,_0x87ef('0xd'),!![]);if(_0x1e13cb[_0x87ef('0x59')]()){_0x4ec7df[_0x87ef('0x45')]('\x22'+_0x17b8b9+'\x22');}else{_0xdea39b[_0x87ef('0x45')](_0x87ef('0x5a'));}break;case _0x87ef('0x22'):var _0x5c3639=parseInt(_0x17b8b9);_0x17b8b9=_[_0x87ef('0x5b')](_0x5c3639)||_0x5c3639<0x0||_0x5c3639>0x4?_0x5cb852?0x3:0x2:_0x5c3639;_0x4ec7df[_0x87ef('0x45')]('\x22'+_0x17b8b9+'\x22');break;case'UserId':var _0xde8b75=parseInt(_0x17b8b9);if(_['isNumber'](_0xde8b75)&&_[_0x87ef('0x5c')](_0x39a5fb,_0xde8b75)){_0x4ec7df[_0x87ef('0x45')]('\x22'+_0xde8b75+'\x22');}else{_0xdea39b[_0x87ef('0x45')]('agent\x20not\x20exists');}break;case _0x87ef('0x5d'):if(isEmail(_0x17b8b9)){_0x4ec7df[_0x87ef('0x45')]('\x22'+_0x17b8b9+'\x22');}else{_0xdea39b[_0x87ef('0x45')](_0x87ef('0x5e'));}break;case'dateOfBirth':var _0x3b8eba=moment(_0x17b8b9,_0x87ef('0x5f'),!![]);if(_0x3b8eba[_0x87ef('0x59')]()){_0x4ec7df['push']('\x22'+_0x17b8b9+'\x22');}else{_0xdea39b[_0x87ef('0x45')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4ec7df[_0x87ef('0x45')]('\x22'+_0x17b8b9+'\x22');}}else{switch(_0x4eaf14){case _0x87ef('0x60'):case _0x87ef('0x10'):_0xdea39b['push'](_0x4eaf14+_0x87ef('0x61'));break;default:_0x4ec7df[_0x87ef('0x45')]('\x22\x22');}}}}if(_0xdea39b[_0x87ef('0x53')]){handleError(_0x2f769b[_0x87ef('0x52')][_0x50f6a7],{'code':_0x87ef('0x62'),'message':_0xdea39b[_0x87ef('0x12')]()});}else{fs[_0x87ef('0x63')](_0x3e5d27,_0x4ec7df[_0x87ef('0x12')]()+'\x0a');}_0x4ec7df=[];}if(!(stats[_0x87ef('0x54')]%0xc8)){socket[_0x87ef('0x64')](_0x87ef('0x65')+_0x6f5e24,stats);stats[_0x87ef('0x55')]=[];}}if(stopped){logger[_0x87ef('0x3d')](_0x87ef('0x66'));_0x34e450['abort']();}}catch(_0x3d5b21){handleError(_0x2f769b[_0x87ef('0x52')][_0x50f6a7],{'code':_0x87ef('0x67'),'message':_0x3d5b21['message']});logger[_0x87ef('0x3f')](_0x87ef('0x68'),_0x3d5b21['message']);}},'complete':function(){try{var _0xe95899=[];var _0x28646c=_0x87ef('0x32');if(_0x269f95[_0x87ef('0x69')]&&_0x269f95['duplicates']['length']){_0x28646c='cm_contacts_'+_0x6f5e24;_0xe95899[_0x87ef('0x45')]('CREATE\x20TABLE\x20'+_0x28646c+'\x20LIKE\x20cm_contacts;');}var _0x4d114d=util['format'](_0x87ef('0x6a'),_0x3e5d27,_0x28646c,_0xd710f9,_0x269f95[_0x87ef('0x1f')],_0x269f95[_0x87ef('0x6b')]||null,NOW,NOW);if(_[_0x87ef('0x6c')](_0x348e6d['scheduledat'])){_0x4d114d+=_0x87ef('0x6d');}_0xe95899['push'](_0x4d114d);if(_0x269f95[_0x87ef('0x69')]&&_0x269f95['duplicates'][_0x87ef('0x53')]){_0xe95899[_0x87ef('0x45')](insertCmContact(_0x269f95[_0x87ef('0x1f')],_0x28646c,_0x269f95[_0x87ef('0x69')],_0x348e6d));_0xe95899[_0x87ef('0x45')](_0x87ef('0x6e')+_0x28646c+';');}_0xe95899[_0x87ef('0x45')](insertCmHopper(_0x269f95[_0x87ef('0x1f')],_0x87ef('0x6f'),'voice_queues','VoiceQueueId',_0x5cb852));_0xe95899[_0x87ef('0x45')](insertCmHopperBlack(_0x269f95[_0x87ef('0x1f')],_0x87ef('0x70'),'voice_queues','VoiceQueueId'));_0xe95899[_0x87ef('0x45')](insertCmHopper(_0x269f95[_0x87ef('0x1f')],'campaigns_has_cm_lists',_0x87ef('0x71'),'CampaignId',_0x5cb852));_0xe95899[_0x87ef('0x45')](insertCmHopperBlack(_0x269f95['ListId'],'campaigns_has_cm_blacklists',_0x87ef('0x71'),_0x87ef('0x72')));BPromise[_0x87ef('0x73')](_0xe95899,handleQuery)[_0x87ef('0x74')](function(_0x26fd47){stats[_0x87ef('0x75')]=!![];stats[_0x87ef('0x76')]=_0x269f95[_0x87ef('0x69')]&&_0x269f95['duplicates'][_0x87ef('0x53')]?results[0x2][_0x87ef('0x76')]:results[0x0]['affectedRows'];socket[_0x87ef('0x64')]('contact:import:'+_0x6f5e24,stats);fs['unlink'](_0x1be279);fs['unlink'](_0x3e5d27);process[_0x87ef('0x41')](0x0);})[_0x87ef('0x46')](function(_0x28c3ab){logger[_0x87ef('0x3f')](_0x28c3ab['message']);process['exit'](0x1);});}catch(_0xff8d39){logger[_0x87ef('0x3f')](_0x87ef('0x77'),_0xff8d39[_0x87ef('0x40')]);process[_0x87ef('0x41')](0x1);}},'error':function(_0x2d7238,_0x214208,_0x280107,_0x5cbd2c){throw new Error(_0x5cbd2c);}});}function validate(){if(process[_0x87ef('0x78')]&&process['argv'][_0x87ef('0x53')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x1cf633=path['join'](config['root'],_0x87ef('0x4d'),process[_0x87ef('0x78')][0x2]);if(!fs[_0x87ef('0x79')](_0x1cf633)){throw new Error(_0x87ef('0x7a'));}var _0x20885d={};try{_0x20885d=JSON['parse'](process[_0x87ef('0x78')][0x3]);if(!_0x20885d[_0x87ef('0x4a')]){throw new Error(_0x87ef('0x7b'));}if(!_0x20885d['binding'][_0x87ef('0x10')]){throw new Error(_0x87ef('0x7c'));}if(!_0x20885d[_0x87ef('0x4a')][_0x87ef('0x60')]){throw new Error(_0x87ef('0x7d'));}var _0x197049=0x0;if(_0x20885d[_0x87ef('0x4a')][_0x87ef('0x23')]){_0x197049=0x1;}if(!_0x20885d[_0x87ef('0x1f')]){throw new Error(_0x87ef('0x7e'));}}catch(_0x13a658){throw new Error(_0x87ef('0x7f'));}var _0x1a1aa6=[];try{_0x1a1aa6=_['map'](JSON['parse'](process[_0x87ef('0x78')][0x4]),'id');}catch(_0x545174){logger[_0x87ef('0x3d')]('No\x20agent\x20available');}main(_0x1cf633,_0x20885d,_0x1a1aa6,_0x197049);}validate();process['on'](_0x87ef('0x80'),handleStop);process['on'](_0x87ef('0x81'),handleUncaughtException); \ No newline at end of file +var _0x33c4=['scheduledat','ListId','createdAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.id','cm_hopper_black','ContactId','updatedAt','select','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','push','code','info','query','spread','catch','main','stringify','send','start','root','server/files/tmp','.csv','header','parse','createReadStream','length','rows','errors','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','emit','Abort\x20parser','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CompanyId','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery'];(function(_0x24c71d,_0x441ec3){var _0x2cdd54=function(_0x31529){while(--_0x31529){_0x24c71d['push'](_0x24c71d['shift']());}};_0x2cdd54(++_0x441ec3);}(_0x33c4,0xef));var _0x433c=function(_0xb8a63a,_0x3f90ac){_0xb8a63a=_0xb8a63a-0x0;var _0x3e8367=_0x33c4[_0xb8a63a];return _0x3e8367;};'use strict';var fs=require('fs');var path=require(_0x433c('0x0'));var _=require(_0x433c('0x1'));var Papa=require(_0x433c('0x2'));var util=require(_0x433c('0x3'));var BPromise=require(_0x433c('0x4'));var moment=require(_0x433c('0x5'));var squel=require(_0x433c('0x6'));var Redis=require(_0x433c('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x433c('0x8'));var logger=require(_0x433c('0x9'))(_0x433c('0xa'));config['redis']=_[_0x433c('0xb')](config[_0x433c('0xc')],{'host':_0x433c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x433c('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x433c('0xe')](_0x433c('0xf'));function isEmail(_0x238dcf){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))*$/[_0x433c('0x10')](_0x238dcf);}function selectNotIn(_0x367f7f,_0x499c2d,_0x356b44,_0x27663e,_0x4559ff){return squel['select']()[_0x433c('0x11')](_0x433c('0x12'))[_0x433c('0x13')](_0x27663e)[_0x433c('0x14')](_0x499c2d,null,_0x499c2d+_0x433c('0x15')+_0x27663e+'.'+_0x356b44)[_0x433c('0x16')](_0x27663e+'.'+_0x356b44+_0x433c('0x17')+_0x367f7f+'.'+_0x356b44)[_0x433c('0x16')](_0x499c2d+'.dialCheckDuplicateType\x20IN\x20('+_0x4559ff[_0x433c('0x14')]()+')');}function insertCmHopper(_0x27b71c,_0x5a45d8,_0x52f8db,_0x9b2ff1,_0x41ae27){var _0x311ff5=['cm_contacts.phone',_0x433c('0x18'),'cm_contacts.id',_0x433c('0x19'),_0x5a45d8+'.'+_0x9b2ff1,_0x433c('0x1a'),_0x433c('0x1b'),_0x433c('0x1c'),'cm_contacts.UserId','\x22'+_0x41ae27+'\x22'];return squel[_0x433c('0x1d')]()[_0x433c('0x1e')](_0x433c('0x1f'))[_0x433c('0x20')]([_0x433c('0x12'),_0x433c('0x21'),'ContactId',_0x433c('0x22'),_0x9b2ff1,_0x433c('0x23'),'updatedAt',_0x433c('0x24'),'UserId',_0x433c('0x25')],squel['select']()[_0x433c('0x26')](_0x311ff5)['from'](_0x5a45d8)['join'](_0x433c('0x27'),null,_0x433c('0x28')+_0x5a45d8+_0x433c('0x29'))['join'](_0x52f8db,null,_0x52f8db+_0x433c('0x15')+_0x5a45d8+'.'+_0x9b2ff1)['where'](_0x5a45d8+_0x433c('0x2a'),_0x27b71c)[_0x433c('0x16')](_0x433c('0x2b'),NOW)[_0x433c('0x16')](_0x433c('0x2c'),selectNotIn(_0x5a45d8,_0x52f8db,_0x9b2ff1,_0x433c('0x1f'),[_0x433c('0x2d'),_0x433c('0x2e')]))[_0x433c('0x16')](_0x433c('0x2c'),selectNotIn(_0x5a45d8,_0x52f8db,_0x9b2ff1,'cm_hopper',[_0x433c('0x2d')])))[_0x433c('0x2f')]();}function insertCmHopperBlack(_0x405606,_0x24f2a4,_0x285817,_0x388562){var _0x36da0f=[_0x433c('0x30'),_0x433c('0x31'),'cm_contacts.ListId',_0x24f2a4+'.'+_0x388562,_0x433c('0x1a'),_0x433c('0x1b')];return squel[_0x433c('0x1d')]()[_0x433c('0x1e')](_0x433c('0x32'))['fromQuery']([_0x433c('0x12'),_0x433c('0x33'),_0x433c('0x22'),_0x388562,_0x433c('0x23'),_0x433c('0x34')],squel[_0x433c('0x35')]()[_0x433c('0x26')](_0x36da0f)[_0x433c('0x13')](_0x24f2a4)[_0x433c('0x14')](_0x433c('0x27'),null,_0x433c('0x28')+_0x24f2a4+_0x433c('0x29'))[_0x433c('0x14')](_0x285817,null,_0x285817+'.id\x20=\x20'+_0x24f2a4+'.'+_0x388562)[_0x433c('0x16')](_0x24f2a4+'.CmListId\x20=\x20?',_0x405606)[_0x433c('0x16')](_0x433c('0x2b'),NOW)[_0x433c('0x16')](_0x433c('0x2c'),squel['select']()['field'](_0x433c('0x12'))['from']('cm_hopper_black')[_0x433c('0x16')](_0x433c('0x36'),_0x405606)[_0x433c('0x16')](_0x388562+_0x433c('0x37'),_0x24f2a4+'.'+_0x388562)))[_0x433c('0x2f')]();}function insertCmContact(_0x26ef27,_0x403a8a,_0xc7a2b8,_0x12fa84){var _0x10c598=_[_0x433c('0x38')](_[_0x433c('0x39')](_0x12fa84),['ListId','CompanyId',_0x433c('0x23'),'updatedAt']);return squel[_0x433c('0x1d')]()[_0x433c('0x1e')](_0x433c('0x27'))[_0x433c('0x20')](_0x10c598,squel['select']()[_0x433c('0x26')](_0x10c598)[_0x433c('0x13')](_0x403a8a)['where']('('+_0xc7a2b8[_0x433c('0x14')](',')+_0x433c('0x3a'),squel[_0x433c('0x35')]()[_0x433c('0x26')](_0xc7a2b8)[_0x433c('0x13')](_0x433c('0x27'))[_0x433c('0x16')](_0x433c('0x36'),_0x26ef27)['where'](_0x433c('0x3b')))[_0x433c('0x16')](_0x433c('0x3c'),squel['select']()['field'](_0x433c('0x3d'),_0x433c('0x3e'))['from'](_0x403a8a)[_0x433c('0x3f')](_0xc7a2b8[_0x433c('0x14')](','))))['toString']();}function handleStop(){logger['info'](_0x433c('0x40'));stopped=!![];}function handleUncaughtException(_0x9cb837){logger[_0x433c('0x41')](_0x9cb837[_0x433c('0x42')]);process[_0x433c('0x43')](0x1);}function handleError(_0x48c1d9,_0x1315e7){stats['errors'][_0x433c('0x44')]({'name':_0x1315e7[_0x433c('0x45')],'message':_0x1315e7[_0x433c('0x42')],'row':_0x48c1d9});}function handleQuery(_0x5e5e16){logger[_0x433c('0x46')](_0x5e5e16);return db['sequelize'][_0x433c('0x47')](_0x5e5e16)[_0x433c('0x48')](function(_0x111434){results[_0x433c('0x44')](_0x111434);})[_0x433c('0x49')](function(_0x53020b){logger[_0x433c('0x41')](_0x53020b[_0x433c('0x42')]);});}function main(_0x586a4c,_0x4045cd,_0x2cd835,_0x519980){logger[_0x433c('0x46')](_0x433c('0x4a'),_0x586a4c,JSON[_0x433c('0x4b')](_0x4045cd));process[_0x433c('0x4c')](_0x433c('0x4d'));var _0x2aaa00=_0x4045cd['binding'];var _0x3b3081=_0x4045cd['socket_timestamp'];var _0x41d5ba=path[_0x433c('0x14')](config[_0x433c('0x4e')],_0x433c('0x4f'),_0x3b3081+_0x433c('0x50'));var _0x31fbd2=_[_0x433c('0x39')](_0x2aaa00)[_0x433c('0x14')]();logger['info'](_0x433c('0x51'),_0x31fbd2);fs['writeFileSync'](_0x41d5ba,_0x31fbd2+'\x0a');Papa[_0x433c('0x52')](fs[_0x433c('0x53')](_0x586a4c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56eb3b,_0x1ece1c){try{for(var _0x2ae241=0x0,_0x1ef56a=[];_0x2ae241<_0x56eb3b['data'][_0x433c('0x54')];_0x2ae241++){stats[_0x433c('0x55')]+=0x1;if(_0x56eb3b[_0x433c('0x56')][_0x2ae241]){handleError(_0x56eb3b[_0x433c('0x57')][_0x2ae241],_0x56eb3b[_0x433c('0x56')][_0x2ae241]);}else{var _0x1a9471=[];for(var _0x5dc935 in _0x2aaa00){if(_0x2aaa00['hasOwnProperty'](_0x5dc935)){if(_0x56eb3b[_0x433c('0x57')][_0x2ae241][_0x2aaa00[_0x5dc935]]){var _0x4e1825=_[_0x433c('0x58')](_0x56eb3b[_0x433c('0x57')][_0x2ae241][_0x2aaa00[_0x5dc935]][_0x433c('0x59')](/"/g,'\x27'));switch(_0x5dc935){case'scheduledat':var _0x219d54=moment(_0x4e1825,_0x433c('0xf'),!![]);if(_0x219d54[_0x433c('0x5a')]()){_0x1ef56a[_0x433c('0x44')]('\x22'+_0x4e1825+'\x22');}else{_0x1a9471[_0x433c('0x44')](_0x433c('0x5b'));}break;case'priority':var _0x12bb26=parseInt(_0x4e1825);_0x4e1825=_[_0x433c('0x5c')](_0x12bb26)||_0x12bb26<0x0||_0x12bb26>0x4?_0x519980?0x3:0x2:_0x12bb26;_0x1ef56a[_0x433c('0x44')]('\x22'+_0x4e1825+'\x22');break;case _0x433c('0x5d'):var _0x40b996=parseInt(_0x4e1825);if(_[_0x433c('0x5e')](_0x40b996)&&_['includes'](_0x2cd835,_0x40b996)){_0x1ef56a[_0x433c('0x44')]('\x22'+_0x40b996+'\x22');}else{_0x1a9471[_0x433c('0x44')](_0x433c('0x5f'));}break;case'email':if(isEmail(_0x4e1825)){_0x1ef56a['push']('\x22'+_0x4e1825+'\x22');}else{_0x1a9471[_0x433c('0x44')](_0x433c('0x60'));}break;case _0x433c('0x61'):var _0x2b744c=moment(_0x4e1825,'YYYY-MM-DD',!![]);if(_0x2b744c[_0x433c('0x5a')]()){_0x1ef56a[_0x433c('0x44')]('\x22'+_0x4e1825+'\x22');}else{_0x1a9471['push'](_0x433c('0x62'));}break;default:_0x1ef56a['push']('\x22'+_0x4e1825+'\x22');}}else{switch(_0x5dc935){case _0x433c('0x63'):case _0x433c('0x12'):_0x1a9471[_0x433c('0x44')](_0x5dc935+_0x433c('0x64'));break;default:_0x1ef56a[_0x433c('0x44')]('\x22\x22');}}}}if(_0x1a9471[_0x433c('0x54')]){handleError(_0x56eb3b[_0x433c('0x57')][_0x2ae241],{'code':_0x433c('0x65'),'message':_0x1a9471[_0x433c('0x14')]()});}else{fs['appendFileSync'](_0x41d5ba,_0x1ef56a[_0x433c('0x14')]()+'\x0a');}_0x1ef56a=[];}if(!(stats['rows']%0xc8)){socket[_0x433c('0x66')]('contact:import:'+_0x3b3081,stats);stats['errors']=[];}}if(stopped){logger[_0x433c('0x46')](_0x433c('0x67'));_0x1ece1c['abort']();}}catch(_0x405539){handleError(_0x56eb3b['data'][_0x2ae241],{'code':_0x433c('0x68'),'message':_0x405539[_0x433c('0x42')]});logger[_0x433c('0x41')]('step',_0x405539['message']);}},'complete':function(){try{var _0x2c47ae=[];var _0x319c5c=_0x433c('0x27');if(_0x4045cd[_0x433c('0x69')]&&_0x4045cd[_0x433c('0x69')][_0x433c('0x54')]){_0x319c5c=_0x433c('0x6a')+_0x3b3081;_0x2c47ae['push'](_0x433c('0x6b')+_0x319c5c+_0x433c('0x6c'));}var _0xc14bec=util[_0x433c('0xe')]('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',_0x41d5ba,_0x319c5c,_0x31fbd2,_0x4045cd[_0x433c('0x22')],_0x4045cd[_0x433c('0x6d')]||null,NOW,NOW);if(_['isNil'](_0x2aaa00[_0x433c('0x21')])){_0xc14bec+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c47ae[_0x433c('0x44')](_0xc14bec);if(_0x4045cd[_0x433c('0x69')]&&_0x4045cd['duplicates'][_0x433c('0x54')]){_0x2c47ae['push'](insertCmContact(_0x4045cd[_0x433c('0x22')],_0x319c5c,_0x4045cd[_0x433c('0x69')],_0x2aaa00));_0x2c47ae[_0x433c('0x44')](_0x433c('0x6e')+_0x319c5c+';');}_0x2c47ae[_0x433c('0x44')](insertCmHopper(_0x4045cd['ListId'],_0x433c('0x6f'),_0x433c('0x70'),'VoiceQueueId',_0x519980));_0x2c47ae['push'](insertCmHopperBlack(_0x4045cd[_0x433c('0x22')],_0x433c('0x71'),_0x433c('0x70'),_0x433c('0x72')));_0x2c47ae[_0x433c('0x44')](insertCmHopper(_0x4045cd[_0x433c('0x22')],'campaigns_has_cm_lists',_0x433c('0x73'),_0x433c('0x74'),_0x519980));_0x2c47ae['push'](insertCmHopperBlack(_0x4045cd[_0x433c('0x22')],_0x433c('0x75'),_0x433c('0x73'),_0x433c('0x74')));BPromise[_0x433c('0x76')](_0x2c47ae,handleQuery)[_0x433c('0x77')](function(_0x5e6f77){stats[_0x433c('0x78')]=!![];stats[_0x433c('0x79')]=_0x4045cd[_0x433c('0x69')]&&_0x4045cd['duplicates'][_0x433c('0x54')]?results[0x2][_0x433c('0x79')]:results[0x0][_0x433c('0x79')];socket['emit'](_0x433c('0x7a')+_0x3b3081,stats);fs[_0x433c('0x7b')](_0x586a4c);fs[_0x433c('0x7b')](_0x41d5ba);process[_0x433c('0x43')](0x0);})[_0x433c('0x49')](function(_0x1cded0){logger[_0x433c('0x41')](_0x1cded0[_0x433c('0x42')]);process[_0x433c('0x43')](0x1);});}catch(_0x3e9f92){logger[_0x433c('0x41')](_0x433c('0x7c'),_0x3e9f92[_0x433c('0x42')]);process['exit'](0x1);}},'error':function(_0x2b3c62,_0x4f3351,_0x2ee4ff,_0x149ef8){throw new Error(_0x149ef8);}});}function validate(){if(process[_0x433c('0x7d')]&&process[_0x433c('0x7d')][_0x433c('0x54')]<0x4){throw new Error(_0x433c('0x7e'));}var _0xe07ab0=path[_0x433c('0x14')](config[_0x433c('0x4e')],'server/files/tmp',process[_0x433c('0x7d')][0x2]);if(!fs[_0x433c('0x7f')](_0xe07ab0)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x31fd5d={};try{_0x31fd5d=JSON[_0x433c('0x52')](process[_0x433c('0x7d')][0x3]);if(!_0x31fd5d[_0x433c('0x80')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x31fd5d['binding'][_0x433c('0x12')]){throw new Error(_0x433c('0x81'));}if(!_0x31fd5d['binding'][_0x433c('0x63')]){throw new Error(_0x433c('0x82'));}var _0x3e8873=0x0;if(_0x31fd5d[_0x433c('0x80')]['UserId']){_0x3e8873=0x1;}if(!_0x31fd5d[_0x433c('0x22')]){throw new Error(_0x433c('0x83'));}}catch(_0x2e9027){throw new Error('body\x20id\x20mandatory');}var _0x2ba1cc=[];try{_0x2ba1cc=_[_0x433c('0x84')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x4cf993){logger[_0x433c('0x46')](_0x433c('0x85'));}main(_0xe07ab0,_0x31fd5d,_0x2ba1cc,_0x3e8873);}validate();process['on'](_0x433c('0x86'),handleStop);process['on'](_0x433c('0x87'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2061f71..963cb6b 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb574=['Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','outbound','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','inbound','push','Outbound\x20Call','variable','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***'];(function(_0x277985,_0x4c1c1b){var _0x41f043=function(_0x1af7d5){while(--_0x1af7d5){_0x277985['push'](_0x277985['shift']());}};_0x41f043(++_0x4c1c1b);}(_0xb574,0x106));var _0x4b57=function(_0x146ef5,_0xdc3971){_0x146ef5=_0x146ef5-0x0;var _0x2b6a1f=_0xb574[_0x146ef5];return _0x2b6a1f;};'use strict';exports[_0x4b57('0x0')]=function(_0x45645e,_0x4c29a6){var _0x213dde=[{'type':_0x4b57('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x45645e[_0x4b57('0x2')]()){case _0x4b57('0x3'):switch(_0x4c29a6[_0x4b57('0x2')]()){case _0x4b57('0x4'):_0x213dde[_0x4b57('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x213dde[_0x4b57('0x5')]({'type':'variable','content':'','variableName':'calleridnum'});break;case'outbound':_0x213dde['push']({'type':_0x4b57('0x1'),'content':_0x4b57('0x6'),'variableName':null});_0x213dde[_0x4b57('0x5')]({'type':_0x4b57('0x7'),'content':'','variableName':_0x4b57('0x8')});break;}}return _0x213dde;};exports[_0x4b57('0x9')]=function(_0x1db79a,_0x43b108){var _0x5593b8=[];switch(_0x1db79a[_0x4b57('0x2')]()){case _0x4b57('0x3'):switch(_0x43b108[_0x4b57('0x2')]()){case'inbound':_0x5593b8=[{'type':'string','content':_0x4b57('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0xc'),'keyType':_0x4b57('0x7'),'variableName':_0x4b57('0xd')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0xe'),'keyType':_0x4b57('0x7'),'variableName':_0x4b57('0xf')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x4b57('0x7'),'variableName':_0x4b57('0x10')},{'type':_0x4b57('0xb'),'content':'','key':'Queue','keyType':_0x4b57('0x7'),'variableName':'queue'},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x11'),'keyType':_0x4b57('0x7'),'variableName':_0x4b57('0x12')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x13'),'keyType':'variable','variableName':_0x4b57('0x14')},{'type':_0x4b57('0x1'),'content':_0x4b57('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x4b57('0xb'),'content':'','key':'Agent\x20Name','keyType':_0x4b57('0x7'),'variableName':_0x4b57('0x16')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x17'),'keyType':_0x4b57('0x7'),'variableName':_0x4b57('0x8')},{'type':'string','content':_0x4b57('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x19'),'keyType':'variable','variableName':_0x4b57('0x14')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x1a'),'keyType':_0x4b57('0x7'),'variableName':'agentconnectAt'},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x1b'),'keyType':'variable','variableName':_0x4b57('0x1c')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x1d'),'keyType':_0x4b57('0x7'),'variableName':'holdtime'},{'type':_0x4b57('0xb'),'content':'','key':'Talk\x20Time','keyType':_0x4b57('0x7'),'variableName':'talktime'}];break;case _0x4b57('0x1e'):_0x5593b8=[{'type':_0x4b57('0x1'),'content':_0x4b57('0xa'),'variableName':null},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x1f'),'keyType':_0x4b57('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x4b57('0x20'),'keyType':'variable','keyContent':'','variableName':_0x4b57('0x21')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x11'),'keyType':_0x4b57('0x7'),'keyContent':'','variableName':_0x4b57('0x12')},{'type':_0x4b57('0xb'),'content':'','key':'Date','keyType':_0x4b57('0x7'),'keyContent':'','variableName':_0x4b57('0x22')},{'type':_0x4b57('0x1'),'content':_0x4b57('0x18')},{'type':'keyValue','content':'','key':_0x4b57('0x23'),'keyType':_0x4b57('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x24'),'keyType':_0x4b57('0x7'),'keyContent':'','variableName':_0x4b57('0x25')},{'type':'keyValue','content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x4b57('0x26')},{'type':_0x4b57('0xb'),'content':'','key':_0x4b57('0x27'),'keyType':_0x4b57('0x7'),'keyContent':'','variableName':_0x4b57('0x28')}];break;}}return _0x5593b8;}; \ No newline at end of file +var _0x9d5b=['destcalleridnum','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','string','[xCALLY\x20Ticket]','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number'];(function(_0x56e1e7,_0x23f687){var _0x2e0b91=function(_0x4918e7){while(--_0x4918e7){_0x56e1e7['push'](_0x56e1e7['shift']());}};_0x2e0b91(++_0x23f687);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x5ae801,_0x5e418d){_0x5ae801=_0x5ae801-0x0;var _0x1bf1d5=_0x9d5b[_0x5ae801];return _0x1bf1d5;};'use strict';exports['getSubjects']=function(_0x2372bb,_0x4388a4){var _0x348259=[{'type':_0xb9d5('0x0'),'content':_0xb9d5('0x1'),'variableName':null}];switch(_0x2372bb['toLowerCase']()){case _0xb9d5('0x2'):switch(_0x4388a4['toLowerCase']()){case _0xb9d5('0x3'):_0x348259[_0xb9d5('0x4')]({'type':_0xb9d5('0x5'),'content':'','variableName':_0xb9d5('0x6')});_0x348259[_0xb9d5('0x4')]({'type':'variable','content':'','variableName':_0xb9d5('0x7')});break;case _0xb9d5('0x8'):_0x348259['push']({'type':_0xb9d5('0x0'),'content':_0xb9d5('0x9'),'variableName':null});_0x348259[_0xb9d5('0x4')]({'type':_0xb9d5('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x348259;};exports[_0xb9d5('0xa')]=function(_0x1ae073,_0x4c1ce3){var _0x35d69f=[];switch(_0x1ae073[_0xb9d5('0xb')]()){case _0xb9d5('0x2'):switch(_0x4c1ce3[_0xb9d5('0xb')]()){case _0xb9d5('0x3'):_0x35d69f=[{'type':_0xb9d5('0x0'),'content':_0xb9d5('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0xe'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x7')},{'type':'keyValue','content':'','key':_0xb9d5('0xf'),'keyType':_0xb9d5('0x5'),'variableName':'calleridname'},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x10'),'keyType':_0xb9d5('0x5'),'variableName':'destexten'},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x11'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x6')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x12'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x13')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x14'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x15')},{'type':_0xb9d5('0x0'),'content':_0xb9d5('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb9d5('0x17'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x18')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x19'),'keyType':_0xb9d5('0x5'),'variableName':'destcalleridnum'},{'type':_0xb9d5('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x1a'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x15')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x1b'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x1c')},{'type':'keyValue','content':'','key':_0xb9d5('0x1d'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x1e')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x1f'),'keyType':_0xb9d5('0x5'),'variableName':'holdtime'},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x20'),'keyType':_0xb9d5('0x5'),'variableName':_0xb9d5('0x21')}];break;case _0xb9d5('0x8'):_0x35d69f=[{'type':_0xb9d5('0x0'),'content':_0xb9d5('0xc'),'variableName':null},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x22'),'keyType':'variable','keyContent':'','variableName':_0xb9d5('0x23')},{'type':'keyValue','content':'','key':_0xb9d5('0x24'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':_0xb9d5('0x25')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x12'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':_0xb9d5('0x13')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x14'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':_0xb9d5('0x26')},{'type':_0xb9d5('0x0'),'content':_0xb9d5('0x27')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x28'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':_0xb9d5('0x29')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x2a'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':_0xb9d5('0x2b')},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x2c'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':'duration'},{'type':_0xb9d5('0xd'),'content':'','key':_0xb9d5('0x2d'),'keyType':_0xb9d5('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x35d69f;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 09d5750..550779b 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4d9=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','user','clone','omit','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xe4d9,0x141));var _0x9e4d=function(_0x2ed85f,_0x463450){_0x2ed85f=_0x2ed85f-0x0;var _0x1a122d=_0xe4d9[_0x2ed85f];return _0x1a122d;};'use strict';var _=require(_0x9e4d('0x0'));var db=require(_0x9e4d('0x1'))['db'];var loggers={'openchannel':require(_0x9e4d('0x2'))('openchannel-interactions'),'mail':require(_0x9e4d('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x9e4d('0x3')),'sms':require(_0x9e4d('0x2'))('sms-interactions'),'chat':require(_0x9e4d('0x2'))(_0x9e4d('0x4')),'whatsapp':require('../../config/logger')(_0x9e4d('0x5'))};function getInteractionId(_0x74b14,_0x5bfad3,_0x5af2a0){if(_0x74b14&&_0x74b14[_[_0x9e4d('0x6')](_0x5af2a0)+'InteractionId']){return _0x74b14[_[_0x9e4d('0x6')](_0x5af2a0)+_0x9e4d('0x7')];}else if(_0x74b14&&_0x74b14['id']){return _0x74b14['id'];}else if(_0x5bfad3&&_0x5bfad3['id']){return _0x5bfad3['id'];}else{return'unknown';}}function log(_0x111bf0,_0x205666,_0x43ab1c,_0x219736,_0x3f21e3,_0x1033d8){loggers[_0x3f21e3[_0x9e4d('0x8')]()][_0x111bf0](_0x9e4d('0x9'),_0x1033d8[_0x9e4d('0xa')](),_0x205666?_0x205666['id']:null,_0x205666?_0x205666[_0x9e4d('0xb')]:null,_0x205666?_0x205666[_0x9e4d('0xc')]:null,getInteractionId(_0x43ab1c,_0x219736,_0x3f21e3),_0x43ab1c?JSON[_0x9e4d('0xd')](_0x43ab1c):_0x9e4d('0xe'));}function updateUser(_0x231b75,_0x23d83b,_0x48191d,_0x15afce,_0x34916b){db[_[_0x9e4d('0x6')](_0x15afce)+_0x9e4d('0xf')][_0x9e4d('0x10')]({'where':{'id':getInteractionId(_0x23d83b,_0x48191d,_0x15afce)}})[_0x9e4d('0x11')](function(_0x56dcca){if(_0x56dcca){return _0x56dcca[_0x9e4d('0x12')]({'UserId':_0x231b75?_0x231b75['id']:null});}})[_0x9e4d('0x11')](function(_0x7d1a16){if(_0x7d1a16){log(_0x9e4d('0x13'),_0x231b75,_0x23d83b,_0x48191d,_0x15afce,_0x34916b);}})[_0x9e4d('0x14')](function(){log(_0x9e4d('0x15'),_0x231b75,_0x23d83b,_0x48191d,_0x15afce,_0x34916b);});}exports['tracked']=function(_0x23925b,_0x59e4aa){return function(_0x5c598f,_0x2cdcfa,_0x445d08){var _0xb40e2=_0x5c598f[_0x9e4d('0x16')];var _0x35f0ba={};var _0x269bf3=_0x5c598f['query'];if(_0x35f0ba){_0x35f0ba=_[_0x9e4d('0x17')](_0x5c598f['body']);_0x35f0ba=_[_0x9e4d('0x18')](_0x35f0ba,[_0x9e4d('0x19'),_0x9e4d('0x1a'),_0x9e4d('0x1b'),_0x9e4d('0x1c'),_0x9e4d('0x1d')]);}updateUser(_0xb40e2,_0x35f0ba,_0x269bf3,_0x23925b,_0x59e4aa);_0x445d08(null);};}; \ No newline at end of file +var _0x1ba8=['info','catch','error','tracked','clone','body','html','phone','fax','lodash','openchannel-interactions','mail-interactions','sms-interactions','../../config/logger','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update'];(function(_0x408bb6,_0x51ec4a){var _0x830d87=function(_0x2a0ccd){while(--_0x2a0ccd){_0x408bb6['push'](_0x408bb6['shift']());}};_0x830d87(++_0x51ec4a);}(_0x1ba8,0x10d));var _0x81ba=function(_0x18850d,_0x553264){_0x18850d=_0x18850d-0x0;var _0x59ba45=_0x1ba8[_0x18850d];return _0x59ba45;};'use strict';var _=require(_0x81ba('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x81ba('0x1')),'mail':require('../../config/logger')(_0x81ba('0x2')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x81ba('0x3')),'chat':require(_0x81ba('0x4'))('chat-interactions'),'whatsapp':require(_0x81ba('0x4'))(_0x81ba('0x5'))};function getInteractionId(_0x5bf14b,_0x5e24d3,_0xc45bdb){if(_0x5bf14b&&_0x5bf14b[_[_0x81ba('0x6')](_0xc45bdb)+_0x81ba('0x7')]){return _0x5bf14b[_['upperFirst'](_0xc45bdb)+_0x81ba('0x7')];}else if(_0x5bf14b&&_0x5bf14b['id']){return _0x5bf14b['id'];}else if(_0x5e24d3&&_0x5e24d3['id']){return _0x5e24d3['id'];}else{return'unknown';}}function log(_0x377869,_0x2f773e,_0x2ff46c,_0x210f1a,_0x482711,_0x1520ae){loggers[_0x482711['toLowerCase']()][_0x377869](_0x81ba('0x8'),_0x1520ae[_0x81ba('0x9')](),_0x2f773e?_0x2f773e['id']:null,_0x2f773e?_0x2f773e[_0x81ba('0xa')]:null,_0x2f773e?_0x2f773e[_0x81ba('0xb')]:null,getInteractionId(_0x2ff46c,_0x210f1a,_0x482711),_0x2ff46c?JSON['stringify'](_0x2ff46c):_0x81ba('0xc'));}function updateUser(_0x51a5c4,_0x3b9329,_0x741125,_0x5810c1,_0x44a51c){db[_['upperFirst'](_0x5810c1)+_0x81ba('0xd')][_0x81ba('0xe')]({'where':{'id':getInteractionId(_0x3b9329,_0x741125,_0x5810c1)}})[_0x81ba('0xf')](function(_0x12f9bf){if(_0x12f9bf){return _0x12f9bf[_0x81ba('0x10')]({'UserId':_0x51a5c4?_0x51a5c4['id']:null});}})[_0x81ba('0xf')](function(_0x56822b){if(_0x56822b){log(_0x81ba('0x11'),_0x51a5c4,_0x3b9329,_0x741125,_0x5810c1,_0x44a51c);}})[_0x81ba('0x12')](function(){log(_0x81ba('0x13'),_0x51a5c4,_0x3b9329,_0x741125,_0x5810c1,_0x44a51c);});}exports[_0x81ba('0x14')]=function(_0x2a9db5,_0x4bf57a){return function(_0x3cc696,_0xf1d3b2,_0x533282){var _0x232f25=_0x3cc696['user'];var _0x33fb9f={};var _0x58d6e1=_0x3cc696['query'];if(_0x33fb9f){_0x33fb9f=_[_0x81ba('0x15')](_0x3cc696[_0x81ba('0x16')]);_0x33fb9f=_['omit'](_0x33fb9f,['body',_0x81ba('0x17'),_0x81ba('0x18'),_0x81ba('0x19'),'mobile']);}updateUser(_0x232f25,_0x33fb9f,_0x58d6e1,_0x2a9db5,_0x4bf57a);_0x533282(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 77fda9e..a2ae7d1 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 _0x3200=['split','aes-256-ctr','format','%s:%s:%s','update','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','isUserLimit','composable-middleware','../../mysqldb','data1','license'];(function(_0x1bfe51,_0x4bebab){var _0x503b1e=function(_0x356083){while(--_0x356083){_0x1bfe51['push'](_0x1bfe51['shift']());}};_0x503b1e(++_0x4bebab);}(_0x3200,0x128));var _0x0320=function(_0x3b3da5,_0x2f7de6){_0x3b3da5=_0x3b3da5-0x0;var _0x142712=_0x3200[_0x3b3da5];return _0x142712;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x0320('0x0'));var db=require(_0x0320('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xa8ddd1,_0x43ec0b){if(_0xa8ddd1&&_0x43ec0b){if(_0x43ec0b[_0x0320('0x2')]&&_0x43ec0b[_0x0320('0x3')]){var _0x17852f=_0x43ec0b[_0x0320('0x2')];var _0x4bc4bb=_0x43ec0b['license'];var _0x89a74b=_0x17852f[_0x0320('0x4')]('-')[0x4];var _0x1e7b7b=_0x17852f['split']('-')[0x0];var _0x2eb204=crypto['createDecipher'](_0x0320('0x5'),util[_0x0320('0x6')](_0x0320('0x7'),_0x89a74b,_0x17852f,_0x1e7b7b));var _0x2bf59a=_0x2eb204[_0x0320('0x8')](_0x4bc4bb,'base64','utf8');_0x2bf59a+=_0x2eb204[_0x0320('0x9')](_0x0320('0xa'));var _0x435cf1=JSON[_0x0320('0xb')](_0x2bf59a);return _0x435cf1[_0x0320('0xc')](_0xa8ddd1)?_0x435cf1[_0xa8ddd1]:null;}}return null;}function isLimit(_0x18cba7,_0x33e933,_0x3e9771,_0x27788e){var _0xd674dd=_0x33e933;return compose()[_0x0320('0xd')](function(_0x120c45,_0x9e2008,_0x17d5a7){return db[_0x0320('0xe')][_0x0320('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x0320('0x10')](function(_0x2b0860){var _0x4561ec=getValueFromLicense(_0x18cba7,_0x2b0860);return _0x4561ec?_0x4561ec:_0xd674dd;})[_0x0320('0x10')](function(_0x58864d){_0xd674dd=_0x58864d;return _0x3e9771[_0x0320('0x11')](_0x27788e);})[_0x0320('0x10')](function(_0x4eba7b){if(_0x4eba7b>=_0xd674dd){return _0x9e2008[_0x0320('0x12')](0x193)[_0x0320('0x13')]({'message':util[_0x0320('0x6')](_0x0320('0x14'),_0x18cba7)});}_0x17d5a7();})[_0x0320('0x15')](function(_0x3dc608){_0x17d5a7(_0x3dc608);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x0320('0x16')],{'where':{'$or':[{'role':_0x0320('0x17')},{'role':'user'}]}});}exports[_0x0320('0x18')]=isUserLimit; \ No newline at end of file +var _0xf6c8=['parse','hasOwnProperty','findOne','then','count','status','json','catch','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','base64','utf8'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf6c8,0x16b));var _0x8f6c=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xf6c8[_0x1b349a];return _0x5d1f7c;};'use strict';var crypto=require('crypto');var util=require(_0x8f6c('0x0'));var compose=require(_0x8f6c('0x1'));var db=require(_0x8f6c('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5f3326,_0x600f15){if(_0x5f3326&&_0x600f15){if(_0x600f15[_0x8f6c('0x3')]&&_0x600f15[_0x8f6c('0x4')]){var _0x11ccf2=_0x600f15[_0x8f6c('0x3')];var _0x2779b3=_0x600f15[_0x8f6c('0x4')];var _0x5b03af=_0x11ccf2[_0x8f6c('0x5')]('-')[0x4];var _0x35eb7b=_0x11ccf2['split']('-')[0x0];var _0x36f38c=crypto[_0x8f6c('0x6')](_0x8f6c('0x7'),util[_0x8f6c('0x8')]('%s:%s:%s',_0x5b03af,_0x11ccf2,_0x35eb7b));var _0x150d0f=_0x36f38c['update'](_0x2779b3,_0x8f6c('0x9'),_0x8f6c('0xa'));_0x150d0f+=_0x36f38c['final'](_0x8f6c('0xa'));var _0x53c037=JSON[_0x8f6c('0xb')](_0x150d0f);return _0x53c037[_0x8f6c('0xc')](_0x5f3326)?_0x53c037[_0x5f3326]:null;}}return null;}function isLimit(_0x2d1cec,_0x198ec4,_0x5648ff,_0x146e1a){var _0x542bb2=_0x198ec4;return compose()['use'](function(_0x1b049a,_0x5ed4a1,_0x212896){return db['License'][_0x8f6c('0xd')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x59ee82){var _0xdfc5d3=getValueFromLicense(_0x2d1cec,_0x59ee82);return _0xdfc5d3?_0xdfc5d3:_0x542bb2;})[_0x8f6c('0xe')](function(_0x48edf9){_0x542bb2=_0x48edf9;return _0x5648ff[_0x8f6c('0xf')](_0x146e1a);})[_0x8f6c('0xe')](function(_0x1b3466){if(_0x1b3466>=_0x542bb2){return _0x5ed4a1[_0x8f6c('0x10')](0x193)[_0x8f6c('0x11')]({'message':util[_0x8f6c('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2d1cec)});}_0x212896();})[_0x8f6c('0x12')](function(_0x3cbc63){_0x212896(_0x3cbc63);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x8f6c('0x13')},{'role':_0x8f6c('0x14')}]}});}exports[_0x8f6c('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 6ab04f5..f926874 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 _0x8d6d=['lodash','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','match','indexOf','map','push','buildExpression','DATE','operator','$eq','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$in','start','$endsWith','$between','shift','pop','hours','minutes','seconds'];(function(_0x336eaa,_0x2ffc61){var _0x2fed2c=function(_0x4eed9f){while(--_0x4eed9f){_0x336eaa['push'](_0x336eaa['shift']());}};_0x2fed2c(++_0x2ffc61);}(_0x8d6d,0x156));var _0xd8d6=function(_0x4bbed4,_0xc9746a){_0x4bbed4=_0x4bbed4-0x0;var _0x178457=_0x8d6d[_0x4bbed4];return _0x178457;};'use strict';var _=require(_0xd8d6('0x0'));var moment=require('moment');exports[_0xd8d6('0x1')]=function(_0xcd5d1f){var _0x1f029d={'conditions':[]};_0x1f029d[_0xd8d6('0x2')]=_[_0xd8d6('0x3')](_0xcd5d1f,_0xd8d6('0x4'))?'or':_0xd8d6('0x5');var _0x1ddbcb=_0xcd5d1f['replace'](_0xd8d6('0x6'),'')[_0xd8d6('0x7')](_0xd8d6('0x4'),'')[_0xd8d6('0x8')]('||');for(var _0x30eadc=0x0;_0x30eadc<_0x1ddbcb[_0xd8d6('0x9')];_0x30eadc++){var _0x404a31=_0x1ddbcb[_0x30eadc][_0xd8d6('0x8')](':=');var _0x23d6bb=_0x404a31[0x0];var _0x3a825f=_0x404a31[_0xd8d6('0xa')](0x1);_0x3a825f[_0xd8d6('0xb')](function(_0x2f0a8d){var _0x42cc51=_0x2f0a8d[_0xd8d6('0x8')]('[')['shift']();var _0x544019=_0x2f0a8d[_0xd8d6('0xc')](/\[(.*?)\]/g);_0x544019[_0xd8d6('0xb')](function(_0x406577){var _0xd1c2f9=_0x406577['split']('[')['filter'](function(_0x3b4766){return _0x3b4766[_0xd8d6('0xd')](']')>-0x1;})[_0xd8d6('0xe')](function(_0x335e2b){return _0x335e2b['split'](']')[0x0];})[0x0];_0x1f029d['conditions'][_0xd8d6('0xf')]({'field':_0x23d6bb,'operator':_0x42cc51,'value':_0xd1c2f9});});});}return _0x1f029d;};exports[_0xd8d6('0x10')]=function(_0x400e40,_0x19f814,_0xdfd3dc){var _0x47628d={};if(_0x19f814===_0xd8d6('0x11')){if(_0xdfd3dc[_0xd8d6('0x12')]===_0xd8d6('0x13')){_0xdfd3dc[_0xd8d6('0x12')]='$between';_0xdfd3dc[_0xd8d6('0x14')]+=','+_0xdfd3dc['value'];}else if(_[_0xd8d6('0x15')]([_0xd8d6('0x16'),'$lte'],_0xdfd3dc[_0xd8d6('0x12')])){_0xdfd3dc['value']=moment(_0xdfd3dc[_0xd8d6('0x14')])[_0xd8d6('0x17')](0x1,_0xd8d6('0x18'))[_0xd8d6('0x19')](_0xd8d6('0x1a'));}}if(_0xdfd3dc['castTo']){_0x19f814=_0xdfd3dc[_0xd8d6('0x1b')];_0x47628d[_0xd8d6('0x1c')]=_0xd8d6('0x1d')+_0x400e40+'.'+_0xdfd3dc['field']+_0xd8d6('0x1e')+_0xdfd3dc[_0xd8d6('0x1b')]+')\x20'+parseOperator(_0xdfd3dc[_0xd8d6('0x12')]);}else{_0x47628d['text']=_0x400e40+'.'+_0xdfd3dc[_0xd8d6('0x1f')]+'\x20'+parseOperator(_0xdfd3dc[_0xd8d6('0x12')]);}if(_[_0xd8d6('0x15')]([_0xd8d6('0x20'),_0xd8d6('0x21')],_0xdfd3dc[_0xd8d6('0x12')]))_0x47628d['text']='('+_0x47628d['text']+_0xd8d6('0x22')+_0x400e40+'.'+_0xdfd3dc[_0xd8d6('0x1f')]+'\x20IS\x20NULL)';_0x47628d[_0xd8d6('0x14')]=parseValue(_0x19f814,_0xdfd3dc[_0xd8d6('0x12')],_0xdfd3dc[_0xd8d6('0x14')]);return _0x47628d;};function parseOperator(_0x591d60){var _0x3b2f10;switch(_0x591d60){case'$in':_0x3b2f10=_0xd8d6('0x23');break;case _0xd8d6('0x21'):_0x3b2f10=_0xd8d6('0x24');break;case _0xd8d6('0x13'):_0x3b2f10=_0xd8d6('0x25');break;case _0xd8d6('0x20'):_0x3b2f10=_0xd8d6('0x26');break;case _0xd8d6('0x27'):case _0xd8d6('0x28'):case'$endsWith':_0x3b2f10=_0xd8d6('0x29');break;case'$lt':_0x3b2f10=_0xd8d6('0x2a');break;case'$gt':_0x3b2f10=_0xd8d6('0x2b');break;case _0xd8d6('0x2c'):_0x3b2f10=_0xd8d6('0x2d');break;case _0xd8d6('0x2e'):_0x3b2f10=_0xd8d6('0x2f');break;case'$between':_0x3b2f10='BETWEEN\x20?\x20AND\x20?';break;}return _0x3b2f10;}function parseValue(_0x3c71b6,_0x2b7461,_0x4767a0){var _0x5d799a={'start':undefined,'end':undefined};switch(_0x2b7461){case _0xd8d6('0x30'):case'$notIn':_0x5d799a[_0xd8d6('0x31')]=_0x4767a0[_0xd8d6('0x8')](',');break;case _0xd8d6('0x27'):_0x5d799a['start']='%'+_0x4767a0+'%';break;case _0xd8d6('0x28'):_0x5d799a[_0xd8d6('0x31')]=_0x4767a0+'%';break;case _0xd8d6('0x32'):_0x5d799a[_0xd8d6('0x31')]='%'+_0x4767a0;break;case _0xd8d6('0x33'):var _0x267382=_0x4767a0[_0xd8d6('0x8')](',');var _0x4767a0=_0x267382[_0xd8d6('0x34')]();var _0x13c605=_0x267382[_0xd8d6('0x35')]();if(_0x3c71b6===_0xd8d6('0x11')){_0x4767a0=moment(_0x4767a0)['utcOffset'](0x0,!![])[_0xd8d6('0x19')]();_0x13c605=moment(_0x13c605)['utcOffset'](0x0,!![])['add'](0x17,_0xd8d6('0x36'))[_0xd8d6('0x17')](0x3b,_0xd8d6('0x37'))[_0xd8d6('0x17')](0x3b,_0xd8d6('0x38'))[_0xd8d6('0x19')]();}_0x5d799a={'start':_0x4767a0,'end':_0x13c605};break;default:_0x5d799a[_0xd8d6('0x31')]=_0x4767a0;break;}return _0x5d799a;} \ No newline at end of file +var _0x10ce=['\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$substring','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$startsWith','shift','pop','utcOffset','hours','lodash','moment','parseSearch','startsWith','and','replace','[$or]','split','length','slice','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn'];(function(_0x4487c1,_0x979b89){var _0x13bc49=function(_0x27708c){while(--_0x27708c){_0x4487c1['push'](_0x4487c1['shift']());}};_0x13bc49(++_0x979b89);}(_0x10ce,0x117));var _0xe10c=function(_0x52cd97,_0x4e9f69){_0x52cd97=_0x52cd97-0x0;var _0x2b8d9f=_0x10ce[_0x52cd97];return _0x2b8d9f;};'use strict';var _=require(_0xe10c('0x0'));var moment=require(_0xe10c('0x1'));exports[_0xe10c('0x2')]=function(_0x2f691c){var _0x3828db={'conditions':[]};_0x3828db['sqlOperator']=_[_0xe10c('0x3')](_0x2f691c,'[$or]')?'or':_0xe10c('0x4');var _0xb23a24=_0x2f691c['replace']('[$and]','')[_0xe10c('0x5')](_0xe10c('0x6'),'')[_0xe10c('0x7')]('||');for(var _0x4ec2e9=0x0;_0x4ec2e9<_0xb23a24[_0xe10c('0x8')];_0x4ec2e9++){var _0x34c200=_0xb23a24[_0x4ec2e9][_0xe10c('0x7')](':=');var _0x285c0c=_0x34c200[0x0];var _0x4fb815=_0x34c200[_0xe10c('0x9')](0x1);_0x4fb815['forEach'](function(_0x4a4c34){var _0x5df099=_0x4a4c34['split']('[')['shift']();var _0x3fb47f=_0x4a4c34[_0xe10c('0xa')](/\[(.*?)\]/g);_0x3fb47f['forEach'](function(_0x4b1da0){var _0x313b1a=_0x4b1da0['split']('[')[_0xe10c('0xb')](function(_0x2f06b8){return _0x2f06b8[_0xe10c('0xc')](']')>-0x1;})[_0xe10c('0xd')](function(_0x476758){return _0x476758['split'](']')[0x0];})[0x0];_0x3828db[_0xe10c('0xe')][_0xe10c('0xf')]({'field':_0x285c0c,'operator':_0x5df099,'value':_0x313b1a});});});}return _0x3828db;};exports[_0xe10c('0x10')]=function(_0x5ad7a1,_0x4a7ab0,_0x6d086c){var _0x310913={};if(_0x4a7ab0===_0xe10c('0x11')){if(_0x6d086c[_0xe10c('0x12')]===_0xe10c('0x13')){_0x6d086c[_0xe10c('0x12')]=_0xe10c('0x14');_0x6d086c[_0xe10c('0x15')]+=','+_0x6d086c['value'];}else if(_[_0xe10c('0x16')]([_0xe10c('0x17'),'$lte'],_0x6d086c[_0xe10c('0x12')])){_0x6d086c[_0xe10c('0x15')]=moment(_0x6d086c['value'])[_0xe10c('0x18')](0x1,_0xe10c('0x19'))['format'](_0xe10c('0x1a'));}}if(_0x6d086c[_0xe10c('0x1b')]){_0x4a7ab0=_0x6d086c[_0xe10c('0x1b')];_0x310913[_0xe10c('0x1c')]=_0xe10c('0x1d')+_0x5ad7a1+'.'+_0x6d086c[_0xe10c('0x1e')]+'\x20AS\x20'+_0x6d086c['castTo']+')\x20'+parseOperator(_0x6d086c[_0xe10c('0x12')]);}else{_0x310913[_0xe10c('0x1c')]=_0x5ad7a1+'.'+_0x6d086c[_0xe10c('0x1e')]+'\x20'+parseOperator(_0x6d086c[_0xe10c('0x12')]);}if(_[_0xe10c('0x16')]([_0xe10c('0x1f'),_0xe10c('0x20')],_0x6d086c[_0xe10c('0x12')]))_0x310913[_0xe10c('0x1c')]='('+_0x310913[_0xe10c('0x1c')]+_0xe10c('0x21')+_0x5ad7a1+'.'+_0x6d086c[_0xe10c('0x1e')]+_0xe10c('0x22');_0x310913[_0xe10c('0x15')]=parseValue(_0x4a7ab0,_0x6d086c[_0xe10c('0x12')],_0x6d086c[_0xe10c('0x15')]);return _0x310913;};function parseOperator(_0x5b4d2b){var _0x51610a;switch(_0x5b4d2b){case _0xe10c('0x23'):_0x51610a=_0xe10c('0x24');break;case _0xe10c('0x20'):_0x51610a=_0xe10c('0x25');break;case _0xe10c('0x13'):_0x51610a='=\x20?';break;case'$ne':_0x51610a='<>\x20?';break;case _0xe10c('0x26'):case'$startsWith':case _0xe10c('0x27'):_0x51610a=_0xe10c('0x28');break;case'$lt':_0x51610a=_0xe10c('0x29');break;case _0xe10c('0x17'):_0x51610a=_0xe10c('0x2a');break;case'$lte':_0x51610a=_0xe10c('0x2b');break;case _0xe10c('0x2c'):_0x51610a=_0xe10c('0x2d');break;case _0xe10c('0x14'):_0x51610a='BETWEEN\x20?\x20AND\x20?';break;}return _0x51610a;}function parseValue(_0xe0ae2c,_0x5e3825,_0x46ee0a){var _0x7e7914={'start':undefined,'end':undefined};switch(_0x5e3825){case _0xe10c('0x23'):case _0xe10c('0x20'):_0x7e7914[_0xe10c('0x2e')]=_0x46ee0a[_0xe10c('0x7')](',');break;case _0xe10c('0x26'):_0x7e7914[_0xe10c('0x2e')]='%'+_0x46ee0a+'%';break;case _0xe10c('0x2f'):_0x7e7914[_0xe10c('0x2e')]=_0x46ee0a+'%';break;case _0xe10c('0x27'):_0x7e7914[_0xe10c('0x2e')]='%'+_0x46ee0a;break;case _0xe10c('0x14'):var _0x54bc44=_0x46ee0a[_0xe10c('0x7')](',');var _0x46ee0a=_0x54bc44[_0xe10c('0x30')]();var _0xcca10a=_0x54bc44[_0xe10c('0x31')]();if(_0xe0ae2c===_0xe10c('0x11')){_0x46ee0a=moment(_0x46ee0a)[_0xe10c('0x32')](0x0,!![])['format']();_0xcca10a=moment(_0xcca10a)[_0xe10c('0x32')](0x0,!![])[_0xe10c('0x18')](0x17,_0xe10c('0x33'))[_0xe10c('0x18')](0x3b,'minutes')[_0xe10c('0x18')](0x3b,'seconds')['format']();}_0x7e7914={'start':_0x46ee0a,'end':_0xcca10a};break;default:_0x7e7914[_0xe10c('0x2e')]=_0x46ee0a;break;}return _0x7e7914;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0ba8920..46e6060 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 _0xa10c=['isEmail','getFullTextValue','forEach','includes','push','lodash','sequelize','moment','split','filters','isEmpty','find','type','DATE','$gte','format','$lte','YYYY-MM-DD','utc','subtract','isArray','parse','limit','offset','sort','map','priority','cast','col','unsigned','substr','DESC','omit','isString','length','unset','match'];(function(_0x4504c2,_0x30b309){var _0x1dc44e=function(_0x10b0a5){while(--_0x10b0a5){_0x4504c2['push'](_0x4504c2['shift']());}};_0x1dc44e(++_0x30b309);}(_0xa10c,0x19c));var _0xca10=function(_0x28d467,_0x44cc87){_0x28d467=_0x28d467-0x0;var _0x14b257=_0xa10c[_0x28d467];return _0x14b257;};'use strict';var _=require(_0xca10('0x0'));var sequelize=require(_0xca10('0x1'));var moment=require(_0xca10('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x225641){var _0x3e79dd=null;if(_0x225641){_0x3e79dd=_0x225641[_0xca10('0x3')](',');}return _0x3e79dd;};exports[_0xca10('0x4')]=function(_0xacb684,_0x255a94){var _0x92cf8a={};if(!_[_0xca10('0x5')](_0xacb684)){_['forOwn'](_0xacb684,function(_0xfa048f,_0x49ee8d){try{if(_0x255a94){var _0x46b18a=_[_0xca10('0x6')](_0x255a94,{'name':_0x49ee8d})||{};if(_0x46b18a[_0xca10('0x7')]===_0xca10('0x8')&&_['isPlainObject'](_0xfa048f)){var _0x4ba549=JSON['parse'](_0xfa048f);var _0x3be561={'$gte':moment(moment(_0x4ba549[_0xca10('0x9')])[_0xca10('0xa')]('YYYY-MM-DD'))['utc']()[_0xca10('0xa')](),'$lte':moment(moment(_0x4ba549[_0xca10('0xb')])['format'](_0xca10('0xc')))[_0xca10('0xd')]()[_0xca10('0xe')](0x1,'s')['format']()};_0x92cf8a[_0x49ee8d]=_0x3be561;}else{_0x92cf8a[_0x49ee8d]=_[_0xca10('0xf')](_0xfa048f)?_0xfa048f:JSON[_0xca10('0x10')](_0xfa048f);}}else{_0x92cf8a[_0x49ee8d]=_[_0xca10('0xf')](_0xfa048f)?_0xfa048f:JSON['parse'](_0xfa048f);}}catch(_0x494878){_0x92cf8a[_0x49ee8d]=_0xfa048f[_0xca10('0x3')](',');}});}return _0x92cf8a;};exports[_0xca10('0x11')]=function(_0x1e2bb4){_0x1e2bb4=parseInt(_0x1e2bb4,0xa);if(!_0x1e2bb4||_0x1e2bb4<0x0){_0x1e2bb4=LIMIT_VALUE;}return _0x1e2bb4;};exports[_0xca10('0x12')]=function(_0x50cbfb){_0x50cbfb=parseInt(_0x50cbfb,0xa);if(!_0x50cbfb||_0x50cbfb<0x0){_0x50cbfb=0x0;}return _0x50cbfb;};exports[_0xca10('0x13')]=function(_0x520f93){var _0x15f891,_0x19dac6=null;if(_0x520f93){_0x15f891=_0x520f93[_0xca10('0x3')](',');_0x19dac6=_[_0xca10('0x14')](_0x15f891,function(_0x7d7cd8){if(_0x7d7cd8['indexOf']('-')===0x0){return[_0x7d7cd8===_0xca10('0x15')?sequelize[_0xca10('0x16')](sequelize[_0xca10('0x17')]('priority'),_0xca10('0x18')):_0x7d7cd8[_0xca10('0x19')](0x1),_0xca10('0x1a')];}else{return[_0x7d7cd8===_0xca10('0x15')?sequelize[_0xca10('0x16')](sequelize[_0xca10('0x17')](_0xca10('0x15')),_0xca10('0x18')):_0x7d7cd8,'ASC'];}});}return _0x19dac6;};exports[_0xca10('0x1b')]=function(_0x13f12c,_0x34e91f){if(_[_0xca10('0x5')](_0x13f12c)){return _0x13f12c;}if(_[_0xca10('0xf')](_0x13f12c)){for(var _0x5b5f2b=0x0;_0x5b5f2b<_0x13f12c['length'];_0x5b5f2b+=0x1){_0x13f12c[_0x5b5f2b]=this[_0xca10('0x1b')](_0x13f12c[_0x5b5f2b],_0x34e91f);}return _0x13f12c;}if(!_['isObject'](_0x13f12c)){return _0x13f12c;}if(_[_0xca10('0x1c')](_0x34e91f)){_0x34e91f=[_0x34e91f];}if(!_['isArray'](_0x34e91f)){return _0x13f12c;}for(var _0x28f952=0x0;_0x28f952<_0x34e91f[_0xca10('0x1d')];_0x28f952+=0x1){_[_0xca10('0x1e')](_0x13f12c,_0x34e91f[_0x28f952]);}for(var _0xf6a051 in _0x13f12c){if(_0x13f12c['hasOwnProperty'](_0xf6a051)){_0x13f12c[_0xf6a051]=this[_0xca10('0x1b')](_0x13f12c[_0xf6a051],_0x34e91f);}}return _0x13f12c;};exports['isNumeric']=function(_0x49236d){return _0x49236d[_0xca10('0x1f')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xca10('0x20')]=function(_0xffeb08){return _0xffeb08['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xca10('0x21')]=function(_0x609db0){var _0xcede42=[];_0x609db0[_0xca10('0x3')](/[ ,]+/)[_0xca10('0x22')](function(_0x5a2177){_0x5a2177=_0x5a2177['replace'](/([^:]")"+/g,'$1');_0x5a2177='+'+_0x5a2177+'*';if(_0x5a2177[_0xca10('0x23')]('@'))_0x5a2177='\x22'+_0x5a2177+'\x22';_0xcede42[_0xca10('0x24')](_0x5a2177);});return _0xcede42['join']('\x20');}; \ No newline at end of file +var _0x72a5=['col','priority','unsigned','DESC','ASC','omit','isObject','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','lodash','sequelize','moment','split','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','$lte','format','YYYY-MM-DD','subtract','isArray','limit','sort','map','indexOf','cast'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x72a5,0x17b));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x572a('0x0'));var sequelize=require(_0x572a('0x1'));var moment=require(_0x572a('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0xb30e68){var _0x29ac20=null;if(_0xb30e68){_0x29ac20=_0xb30e68[_0x572a('0x3')](',');}return _0x29ac20;};exports['filters']=function(_0x1a4de8,_0x3b6ee6){var _0x53f522={};if(!_[_0x572a('0x4')](_0x1a4de8)){_[_0x572a('0x5')](_0x1a4de8,function(_0x23eb7d,_0x352832){try{if(_0x3b6ee6){var _0x532114=_['find'](_0x3b6ee6,{'name':_0x352832})||{};if(_0x532114[_0x572a('0x6')]===_0x572a('0x7')&&_[_0x572a('0x8')](_0x23eb7d)){var _0xec284f=JSON[_0x572a('0x9')](_0x23eb7d);var _0xb50117={'$gte':moment(moment(_0xec284f[_0x572a('0xa')])['format']('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0xec284f[_0x572a('0xb')])[_0x572a('0xc')](_0x572a('0xd')))['utc']()[_0x572a('0xe')](0x1,'s')[_0x572a('0xc')]()};_0x53f522[_0x352832]=_0xb50117;}else{_0x53f522[_0x352832]=_[_0x572a('0xf')](_0x23eb7d)?_0x23eb7d:JSON[_0x572a('0x9')](_0x23eb7d);}}else{_0x53f522[_0x352832]=_[_0x572a('0xf')](_0x23eb7d)?_0x23eb7d:JSON[_0x572a('0x9')](_0x23eb7d);}}catch(_0x577545){_0x53f522[_0x352832]=_0x23eb7d['split'](',');}});}return _0x53f522;};exports[_0x572a('0x10')]=function(_0x4784e2){_0x4784e2=parseInt(_0x4784e2,0xa);if(!_0x4784e2||_0x4784e2<0x0){_0x4784e2=LIMIT_VALUE;}return _0x4784e2;};exports['offset']=function(_0x136625){_0x136625=parseInt(_0x136625,0xa);if(!_0x136625||_0x136625<0x0){_0x136625=0x0;}return _0x136625;};exports[_0x572a('0x11')]=function(_0xd0a44){var _0x19f495,_0xfa5927=null;if(_0xd0a44){_0x19f495=_0xd0a44[_0x572a('0x3')](',');_0xfa5927=_[_0x572a('0x12')](_0x19f495,function(_0x554e68){if(_0x554e68[_0x572a('0x13')]('-')===0x0){return[_0x554e68==='priority'?sequelize[_0x572a('0x14')](sequelize[_0x572a('0x15')](_0x572a('0x16')),_0x572a('0x17')):_0x554e68['substr'](0x1),_0x572a('0x18')];}else{return[_0x554e68===_0x572a('0x16')?sequelize[_0x572a('0x14')](sequelize[_0x572a('0x15')]('priority'),_0x572a('0x17')):_0x554e68,_0x572a('0x19')];}});}return _0xfa5927;};exports['omit']=function(_0x5c1774,_0xc5e4e8){if(_[_0x572a('0x4')](_0x5c1774)){return _0x5c1774;}if(_[_0x572a('0xf')](_0x5c1774)){for(var _0x19f63a=0x0;_0x19f63a<_0x5c1774['length'];_0x19f63a+=0x1){_0x5c1774[_0x19f63a]=this[_0x572a('0x1a')](_0x5c1774[_0x19f63a],_0xc5e4e8);}return _0x5c1774;}if(!_[_0x572a('0x1b')](_0x5c1774)){return _0x5c1774;}if(_['isString'](_0xc5e4e8)){_0xc5e4e8=[_0xc5e4e8];}if(!_[_0x572a('0xf')](_0xc5e4e8)){return _0x5c1774;}for(var _0x3d996d=0x0;_0x3d996d<_0xc5e4e8[_0x572a('0x1c')];_0x3d996d+=0x1){_[_0x572a('0x1d')](_0x5c1774,_0xc5e4e8[_0x3d996d]);}for(var _0xd86cb2 in _0x5c1774){if(_0x5c1774[_0x572a('0x1e')](_0xd86cb2)){_0x5c1774[_0xd86cb2]=this[_0x572a('0x1a')](_0x5c1774[_0xd86cb2],_0xc5e4e8);}}return _0x5c1774;};exports[_0x572a('0x1f')]=function(_0x24e7e5){return _0x24e7e5[_0x572a('0x20')](RegExp(_0x572a('0x21')))?!![]:![];};exports[_0x572a('0x22')]=function(_0x3b9a3a){return _0x3b9a3a['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x572a('0x23')]=function(_0x25411d){var _0x79f4d1=[];_0x25411d[_0x572a('0x3')](/[ ,]+/)[_0x572a('0x24')](function(_0x2967da){_0x2967da=_0x2967da[_0x572a('0x25')](/([^:]")"+/g,'$1');_0x2967da='+'+_0x2967da+'*';if(_0x2967da['includes']('@'))_0x2967da='\x22'+_0x2967da+'\x22';_0x79f4d1[_0x572a('0x26')](_0x2967da);});return _0x79f4d1[_0x572a('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 41d1e31..6f80ed2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4853=['path','passport','cors','moment','./environment','../mysqldb','default','get','appPath','join','root','public','development','test','set','client','use','views','engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','body-parser','method-override','errorhandler'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0x4853,0x8e));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x3485('0x0'));var methodOverride=require(_0x3485('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x3485('0x2'));var path=require(_0x3485('0x3'));var passport=require(_0x3485('0x4'));var cors=require(_0x3485('0x5'));var moment=require(_0x3485('0x6'));var config=require(_0x3485('0x7'));var db=require(_0x3485('0x8'))['db'];exports[_0x3485('0x9')]=function(_0x45adf4){var _0x1b19db=_0x45adf4[_0x3485('0xa')]('env');if(_0x1b19db==='production'){_0x45adf4['set'](_0x3485('0xb'),path[_0x3485('0xc')](config[_0x3485('0xd')],_0x3485('0xe')));}if(_0x1b19db===_0x3485('0xf')||_0x1b19db===_0x3485('0x10')){_0x45adf4[_0x3485('0x11')](_0x3485('0xb'),path[_0x3485('0xc')](config[_0x3485('0xd')],_0x3485('0x12')));_0x45adf4['use'](errorHandler());}_0x45adf4[_0x3485('0x11')]('json\x20replacer',function(_0x26ebd8,_0x484007){if(this[_0x26ebd8]instanceof Date){_0x484007=this[_0x26ebd8]['toISOString']()['split']('.')[0x0]+'Z';}return _0x484007;});_0x45adf4[_0x3485('0x13')](express['static'](_0x45adf4[_0x3485('0xa')](_0x3485('0xb'))));_0x45adf4[_0x3485('0x11')](_0x3485('0x14'),config[_0x3485('0xd')]+'/server/views');_0x45adf4[_0x3485('0x15')]('html',require(_0x3485('0x16'))[_0x3485('0x17')]);_0x45adf4[_0x3485('0x11')](_0x3485('0x18'),_0x3485('0x19'));_0x45adf4[_0x3485('0x13')](bodyParser[_0x3485('0x1a')]({'limit':_0x3485('0x1b'),'extended':!![]}));_0x45adf4[_0x3485('0x13')](bodyParser[_0x3485('0x1c')]({'limit':_0x3485('0x1b')}));_0x45adf4[_0x3485('0x13')](cors());_0x45adf4[_0x3485('0x13')](methodOverride());_0x45adf4[_0x3485('0x13')](cookieParser());_0x45adf4[_0x3485('0x13')](passport['initialize']());}; \ No newline at end of file +var _0xd856=['50mb','json','initialize','express','body-parser','method-override','cookie-parser','errorhandler','path','passport','moment','./environment','../mysqldb','default','get','env','production','join','root','public','development','set','appPath','client','use','json\x20replacer','split','static','/server/views','engine','renderFile','view\x20engine','html','urlencoded'];(function(_0x1bc7d4,_0xa2fe4f){var _0x3054d6=function(_0x21cccd){while(--_0x21cccd){_0x1bc7d4['push'](_0x1bc7d4['shift']());}};_0x3054d6(++_0xa2fe4f);}(_0xd856,0x113));var _0x6d85=function(_0x2d3c2d,_0x31aeda){_0x2d3c2d=_0x2d3c2d-0x0;var _0x4f38f4=_0xd856[_0x2d3c2d];return _0x4f38f4;};'use strict';var express=require(_0x6d85('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x6d85('0x1'));var methodOverride=require(_0x6d85('0x2'));var cookieParser=require(_0x6d85('0x3'));var errorHandler=require(_0x6d85('0x4'));var path=require(_0x6d85('0x5'));var passport=require(_0x6d85('0x6'));var cors=require('cors');var moment=require(_0x6d85('0x7'));var config=require(_0x6d85('0x8'));var db=require(_0x6d85('0x9'))['db'];exports[_0x6d85('0xa')]=function(_0x24033c){var _0x23488c=_0x24033c[_0x6d85('0xb')](_0x6d85('0xc'));if(_0x23488c===_0x6d85('0xd')){_0x24033c['set']('appPath',path[_0x6d85('0xe')](config[_0x6d85('0xf')],_0x6d85('0x10')));}if(_0x23488c===_0x6d85('0x11')||_0x23488c==='test'){_0x24033c[_0x6d85('0x12')](_0x6d85('0x13'),path['join'](config[_0x6d85('0xf')],_0x6d85('0x14')));_0x24033c[_0x6d85('0x15')](errorHandler());}_0x24033c[_0x6d85('0x12')](_0x6d85('0x16'),function(_0x298728,_0x12c2df){if(this[_0x298728]instanceof Date){_0x12c2df=this[_0x298728]['toISOString']()[_0x6d85('0x17')]('.')[0x0]+'Z';}return _0x12c2df;});_0x24033c['use'](express[_0x6d85('0x18')](_0x24033c[_0x6d85('0xb')](_0x6d85('0x13'))));_0x24033c[_0x6d85('0x12')]('views',config[_0x6d85('0xf')]+_0x6d85('0x19'));_0x24033c[_0x6d85('0x1a')]('html',require('ejs')[_0x6d85('0x1b')]);_0x24033c[_0x6d85('0x12')](_0x6d85('0x1c'),_0x6d85('0x1d'));_0x24033c[_0x6d85('0x15')](bodyParser[_0x6d85('0x1e')]({'limit':_0x6d85('0x1f'),'extended':!![]}));_0x24033c[_0x6d85('0x15')](bodyParser[_0x6d85('0x20')]({'limit':_0x6d85('0x1f')}));_0x24033c[_0x6d85('0x15')](cors());_0x24033c['use'](methodOverride());_0x24033c[_0x6d85('0x15')](cookieParser());_0x24033c[_0x6d85('0x15')](passport[_0x6d85('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ef1e8e1..454e44c 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 _0xca9e=['update','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','join','createHash'];(function(_0x573256,_0x1ddefe){var _0x570647=function(_0x41eea2){while(--_0x41eea2){_0x573256['push'](_0x573256['shift']());}};_0x570647(++_0x1ddefe);}(_0xca9e,0x136));var _0xeca9=function(_0x328670,_0x4a2bb2){_0x328670=_0x328670-0x0;var _0x2e8787=_0xca9e[_0x328670];return _0x2e8787;};'use strict';var _=require(_0xeca9('0x0'));var os=require('os');var crypto=require(_0xeca9('0x1'));var machine=require(_0xeca9('0x2'));var exec=require(_0xeca9('0x3'))[_0xeca9('0x4')];function getInterfaces(){var _0x1443e3=[];var _0x8dbabb=os[_0xeca9('0x5')]();var _0x1b2864=_[_0xeca9('0x6')](_[_0xeca9('0x7')](_0x8dbabb));for(var _0x1c4ce6=0x0;_0x1c4ce6<_0x1b2864[_0xeca9('0x8')];_0x1c4ce6++){var _0x305dc5=_0x8dbabb[_0x1b2864[_0x1c4ce6]]['filter'](function(_0x369f5e){return _0x369f5e[_0xeca9('0x9')]==='IPv4'&&_0x369f5e['internal']===![];});_0x1443e3=_0x1443e3[_0xeca9('0xa')](_0x305dc5);}return _0x1443e3;}function getFirstInterface(){var _0x239e92=_[_0xeca9('0xb')](getInterfaces());return{'macAddress':_0x239e92&&_0x239e92['mac']?_0x239e92[_0xeca9('0xc')]:_0xeca9('0xd'),'ipAddress':_0x239e92&&_0x239e92[_0xeca9('0xe')]?_0x239e92[_0xeca9('0xe')]:_0xeca9('0xf')};}exports[_0xeca9('0x10')]=getFirstInterface;function getCPUhash(){var _0x5b5fbf=_[_0xeca9('0x6')](os[_0xeca9('0x11')]()['map'](function(_0x27ca6f){return _0x27ca6f['model'];}))[_0xeca9('0x12')](':');return crypto[_0xeca9('0x13')]('md5')[_0xeca9('0x14')](_0x5b5fbf)[_0xeca9('0x15')](_0xeca9('0x16'));}exports['getUuid']=function(){switch(os[_0xeca9('0x17')]()){case _0xeca9('0x18'):return exec(_0xeca9('0x19'),{'encoding':_0xeca9('0x1a')})['replace']('\x0d\x0a','');default:var _0x520411=getFirstInterface();var _0x964e05=getCPUhash();var _0x77cb=_0x964e05+'|'+os['hostname']()+'|'+_0x520411[_0xeca9('0x1b')]+'|'+_0x520411[_0xeca9('0x1c')];var _0x4fbe8a=crypto['createHash']('md5')[_0xeca9('0x14')](_0x77cb)[_0xeca9('0x15')](_0xeca9('0x16'));return _0x4fbe8a['substring'](0x0,0x8)+'-'+_0x4fbe8a[_0xeca9('0x1d')](0x8,0xc)+'-'+_0x4fbe8a['substring'](0xc,0x10)+'-'+_0x4fbe8a['substring'](0x10,0x14)+'-'+_0x4fbe8a[_0xeca9('0x1d')](0x14);}}; \ No newline at end of file +var _0x3c6c=['macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname'];(function(_0x2ca60c,_0x3851f1){var _0xa477c4=function(_0x3f10d3){while(--_0x3f10d3){_0x2ca60c['push'](_0x2ca60c['shift']());}};_0xa477c4(++_0x3851f1);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x5b70d8,_0x91fd1f){_0x5b70d8=_0x5b70d8-0x0;var _0x132a95=_0x3c6c[_0x5b70d8];return _0x132a95;};'use strict';var _=require(_0xc3c6('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xc3c6('0x1'));var exec=require(_0xc3c6('0x2'))[_0xc3c6('0x3')];function getInterfaces(){var _0x3d2b3f=[];var _0x16a464=os[_0xc3c6('0x4')]();var _0x65a78=_[_0xc3c6('0x5')](_['keys'](_0x16a464));for(var _0x3c630b=0x0;_0x3c630b<_0x65a78['length'];_0x3c630b++){var _0xe7731e=_0x16a464[_0x65a78[_0x3c630b]]['filter'](function(_0x50cd05){return _0x50cd05['family']==='IPv4'&&_0x50cd05['internal']===![];});_0x3d2b3f=_0x3d2b3f[_0xc3c6('0x6')](_0xe7731e);}return _0x3d2b3f;}function getFirstInterface(){var _0x1c04d4=_['head'](getInterfaces());return{'macAddress':_0x1c04d4&&_0x1c04d4[_0xc3c6('0x7')]?_0x1c04d4[_0xc3c6('0x7')]:_0xc3c6('0x8'),'ipAddress':_0x1c04d4&&_0x1c04d4[_0xc3c6('0x9')]?_0x1c04d4['address']:_0xc3c6('0xa')};}exports[_0xc3c6('0xb')]=getFirstInterface;function getCPUhash(){var _0x1b78ca=_['orderBy'](os['cpus']()[_0xc3c6('0xc')](function(_0x407147){return _0x407147[_0xc3c6('0xd')];}))[_0xc3c6('0xe')](':');return crypto[_0xc3c6('0xf')](_0xc3c6('0x10'))[_0xc3c6('0x11')](_0x1b78ca)[_0xc3c6('0x12')](_0xc3c6('0x13'));}exports[_0xc3c6('0x14')]=function(){switch(os[_0xc3c6('0x15')]()){case _0xc3c6('0x16'):return exec(_0xc3c6('0x17'),{'encoding':_0xc3c6('0x18')})[_0xc3c6('0x19')]('\x0d\x0a','');default:var _0x42c631=getFirstInterface();var _0x32c52f=getCPUhash();var _0x181b3b=_0x32c52f+'|'+os[_0xc3c6('0x1a')]()+'|'+_0x42c631[_0xc3c6('0x1b')]+'|'+_0x42c631[_0xc3c6('0x1c')];var _0x15ebec=crypto[_0xc3c6('0xf')](_0xc3c6('0x10'))[_0xc3c6('0x11')](_0x181b3b)[_0xc3c6('0x12')]('hex');return _0x15ebec[_0xc3c6('0x1d')](0x0,0x8)+'-'+_0x15ebec[_0xc3c6('0x1d')](0x8,0xc)+'-'+_0x15ebec[_0xc3c6('0x1d')](0xc,0x10)+'-'+_0x15ebec[_0xc3c6('0x1d')](0x10,0x14)+'-'+_0x15ebec[_0xc3c6('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c3cd406..a8dd650 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 _0x1e1f=['error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|uuid|','|machineUuid|','|name|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1e1f,0xaa));var _0xf1e1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1e1f[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xf1e1('0x0'));var moment=require(_0xf1e1('0x1'));var rp=require('request-promise');var BPromise=require(_0xf1e1('0x2'));var pkginfo=require(_0xf1e1('0x3'))(module,_0xf1e1('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf1e1('0x5'));var logger=require(_0xf1e1('0x6'))(_0xf1e1('0x7'));var jira=require(_0xf1e1('0x8'));const {config}=require(_0xf1e1('0x9'));var HOST=_0xf1e1('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2b3d84){return new BPromise(function(_0x4ea3e1,_0x3e6ae4){var _0x47bd03=util[_0xf1e1('0xb')](_0xf1e1('0xc'),HOST,_0x2b3d84,module[_0xf1e1('0xd')]['version']);if(oldToken){_0x47bd03=util['format'](_0xf1e1('0xe'),HOST,_0x2b3d84,module['exports'][_0xf1e1('0x4')],oldToken);}var _0x4b26d6={'uri':_0x47bd03,'method':_0xf1e1('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x4b26d6)[_0xf1e1('0x10')](function(_0x191b3e){_0x4ea3e1(_0x191b3e);})[_0xf1e1('0x11')](function(_0x220f72){_0x3e6ae4(_0x220f72);});});}function sendJiraAlert(_0x2f89c6,_0x3aadab,_0x387a52){var _0x1d47ef=_0xf1e1('0x12');return db[_0xf1e1('0x13')][_0xf1e1('0x14')]({'where':{'role':_0xf1e1('0x15')},'attributes':[_0xf1e1('0x16'),'email'],'raw':!![]})[_0xf1e1('0x10')](function(_0x3cc5f1){ADMIN=_0x3cc5f1;_0x1d47ef+='|reason|'+_0x387a52+'|\x0a';_0x1d47ef+=_0xf1e1('0x17')+_0x2f89c6+'|\x0a';_0x1d47ef+=_0xf1e1('0x18')+_0x3aadab+'|\x0a';_0x1d47ef+=_0xf1e1('0x19')+ADMIN[_0xf1e1('0x16')]+'|\x0a';_0x1d47ef+='|email|'+ADMIN[_0xf1e1('0x1a')]+'|\x0a';return _0x1d47ef;})[_0xf1e1('0x10')](function(_0x380328){var _0x17f855=hardware[_0xf1e1('0x1b')]()[_0xf1e1('0x1c')];return jira[_0xf1e1('0x1d')]({'key':_0xf1e1('0x1e'),'summary':_0xf1e1('0x1f'),'description':_0x380328,'issuetype':_0xf1e1('0x20'),'oldToken':_0x2f89c6,'newToken':_0x3aadab,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x17f855});});}function manageLicense(_0xd07daa,_0x480c80){var _0x49ddab=_0x480c80[_0xf1e1('0x21')]({'plain':!![]});httpRequest(_0xd07daa)[_0xf1e1('0x10')](function(_0x2e645e){if(oldToken){oldToken=undefined;}if(_0x2e645e['active']){if(!_0x49ddab[_0xf1e1('0x7')]&&_0x49ddab[_0xf1e1('0x7')]!=_0x2e645e['license']||_0x49ddab[_0xf1e1('0x7')]&&_0x49ddab[_0xf1e1('0x22')]){logger['info'](_0xf1e1('0x23'));}if(_0x49ddab[_0xf1e1('0x7')]&&!_0x49ddab[_0xf1e1('0x22')]&&_0x49ddab['license']!=_0x2e645e[_0xf1e1('0x7')]){logger[_0xf1e1('0x24')](_0xf1e1('0x25'));}if(_0x49ddab[_0xf1e1('0x7')]&&!_0x49ddab['data2']&&_0x49ddab['license']==_0x2e645e[_0xf1e1('0x7')]){return _0x480c80;}return _0x480c80[_0xf1e1('0x26')]({'data1':_0xd07daa,'data2':null,'license':_0x2e645e[_0xf1e1('0x7')]});}else{if(_0x2e645e[_0xf1e1('0x7')]||_0x49ddab['license']){if(!_0x49ddab['data2']){if(_0x49ddab[_0xf1e1('0x27')]==_0xd07daa){GRAY_PERIOD_REASON='Disabled';logger[_0xf1e1('0x24')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x49ddab[_0xf1e1('0x27')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x49ddab[_0xf1e1('0x27')],_0xd07daa);}sendJiraAlert(_0x49ddab[_0xf1e1('0x27')],_0x2e645e['uuid'],GRAY_PERIOD_REASON);logger['info'](_0xf1e1('0x28'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf1e1('0xb')](_0xf1e1('0x29')));return _0x480c80['update']({'data2':encryptor[_0xf1e1('0x2a')](moment()['format'](_0xf1e1('0x29')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x49ddab[_0xf1e1('0x22')]),_0xf1e1('0x2b'))>DAYS){logger['info'](_0xf1e1('0x2c'),moment()[_0xf1e1('0xb')](_0xf1e1('0x29')));return _0x480c80['update']({'data1':_0xd07daa,'data2':null,'license':null});}}}else{if(_0x49ddab[_0xf1e1('0x27')]!=_0xd07daa){logger[_0xf1e1('0x24')](_0xf1e1('0x2d'),_0x49ddab[_0xf1e1('0x27')],_0xd07daa);return _0x480c80[_0xf1e1('0x26')]({'data1':_0xd07daa,'data2':null,'license':null});}}}return _0x480c80;})[_0xf1e1('0x10')](function(_0x2e3249){_0x480c80=_0x2e3249;})[_0xf1e1('0x11')](function(_0x6be618){logger[_0xf1e1('0x2e')](_0x6be618[_0xf1e1('0x2f')]);})[_0xf1e1('0x30')](function(){setTimeout(function(){manageLicense(hardware[_0xf1e1('0x31')](),_0x480c80);},TIME);});}function defaultLicense(){var _0x2c9d5f=hardware[_0xf1e1('0x31')]();if(_0x2c9d5f){return db[_0xf1e1('0x32')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2c9d5f}})[_0xf1e1('0x33')](function(_0x4e137b,_0x3feeb8){logger[_0xf1e1('0x24')](_0xf1e1('0x34'),_0x2c9d5f);manageLicense(_0x2c9d5f,_0x4e137b);})[_0xf1e1('0x11')](function(_0x2233ba){logger[_0xf1e1('0x2e')](_0x2233ba['message']);});}}exports[_0xf1e1('0x35')]=defaultLicense; \ No newline at end of file +var _0xfc74=['license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','../../api/jira/jira.controller','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','findOne','admin','fullname','then','|reason|','|machineUuid|','|name|','email','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','active'];(function(_0x5e498f,_0x22de74){var _0x19574a=function(_0x91364e){while(--_0x91364e){_0x5e498f['push'](_0x5e498f['shift']());}};_0x19574a(++_0x22de74);}(_0xfc74,0x1d3));var _0x4fc7=function(_0xbc845b,_0x5b784a){_0xbc845b=_0xbc845b-0x0;var _0x5b0aca=_0xfc74[_0xbc845b];return _0x5b0aca;};'use strict';var util=require(_0x4fc7('0x0'));var moment=require(_0x4fc7('0x1'));var rp=require(_0x4fc7('0x2'));var BPromise=require(_0x4fc7('0x3'));var pkginfo=require(_0x4fc7('0x4'))(module,'version');var db=require(_0x4fc7('0x5'))['db'];var encryptor=require(_0x4fc7('0x6'));var hardware=require(_0x4fc7('0x7'));var logger=require(_0x4fc7('0x8'))('license');var jira=require(_0x4fc7('0x9'));const {config}=require('process');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2f7252){return new BPromise(function(_0x2e0ed5,_0x3b2c2d){var _0x38477b=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x2f7252,module['exports'][_0x4fc7('0xa')]);if(oldToken){_0x38477b=util[_0x4fc7('0xb')](_0x4fc7('0xc'),HOST,_0x2f7252,module[_0x4fc7('0xd')]['version'],oldToken);}var _0x4084db={'uri':_0x38477b,'method':_0x4fc7('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4084db)['then'](function(_0x3856fc){_0x2e0ed5(_0x3856fc);})['catch'](function(_0x2d1318){_0x3b2c2d(_0x2d1318);});});}function sendJiraAlert(_0x25bbd2,_0x5a9a39,_0x47650b){var _0x327326='||FIELD||VALUE||\x0a';return db['User'][_0x4fc7('0xf')]({'where':{'role':_0x4fc7('0x10')},'attributes':[_0x4fc7('0x11'),'email'],'raw':!![]})[_0x4fc7('0x12')](function(_0x32582b){ADMIN=_0x32582b;_0x327326+=_0x4fc7('0x13')+_0x47650b+'|\x0a';_0x327326+='|uuid|'+_0x25bbd2+'|\x0a';_0x327326+=_0x4fc7('0x14')+_0x5a9a39+'|\x0a';_0x327326+=_0x4fc7('0x15')+ADMIN[_0x4fc7('0x11')]+'|\x0a';_0x327326+='|email|'+ADMIN[_0x4fc7('0x16')]+'|\x0a';return _0x327326;})[_0x4fc7('0x12')](function(_0x4a6ca0){var _0x3abca2=hardware['getFirstInterface']()[_0x4fc7('0x17')];return jira[_0x4fc7('0x18')]({'key':'MOTLICENSE','summary':_0x4fc7('0x19'),'description':_0x4a6ca0,'issuetype':_0x4fc7('0x1a'),'oldToken':_0x25bbd2,'newToken':_0x5a9a39,'email':ADMIN[_0x4fc7('0x16')],'name':ADMIN[_0x4fc7('0x11')],'reason':GRAY_PERIOD_REASON,'ip':_0x3abca2});});}function manageLicense(_0x32b2d0,_0x45421a){var _0x1e8225=_0x45421a['get']({'plain':!![]});httpRequest(_0x32b2d0)[_0x4fc7('0x12')](function(_0x24af0d){if(oldToken){oldToken=undefined;}if(_0x24af0d[_0x4fc7('0x1b')]){if(!_0x1e8225[_0x4fc7('0x1c')]&&_0x1e8225['license']!=_0x24af0d[_0x4fc7('0x1c')]||_0x1e8225[_0x4fc7('0x1c')]&&_0x1e8225[_0x4fc7('0x1d')]){logger[_0x4fc7('0x1e')](_0x4fc7('0x1f'));}if(_0x1e8225['license']&&!_0x1e8225[_0x4fc7('0x1d')]&&_0x1e8225[_0x4fc7('0x1c')]!=_0x24af0d['license']){logger[_0x4fc7('0x1e')](_0x4fc7('0x20'));}if(_0x1e8225[_0x4fc7('0x1c')]&&!_0x1e8225[_0x4fc7('0x1d')]&&_0x1e8225['license']==_0x24af0d[_0x4fc7('0x1c')]){return _0x45421a;}return _0x45421a['update']({'data1':_0x32b2d0,'data2':null,'license':_0x24af0d[_0x4fc7('0x1c')]});}else{if(_0x24af0d[_0x4fc7('0x1c')]||_0x1e8225[_0x4fc7('0x1c')]){if(!_0x1e8225[_0x4fc7('0x1d')]){if(_0x1e8225[_0x4fc7('0x21')]==_0x32b2d0){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4fc7('0x22');oldToken=_0x1e8225['data1'];logger[_0x4fc7('0x1e')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1e8225[_0x4fc7('0x21')],_0x32b2d0);}sendJiraAlert(_0x1e8225[_0x4fc7('0x21')],_0x24af0d['uuid'],GRAY_PERIOD_REASON);logger['info'](_0x4fc7('0x23'),GRAY_PERIOD_REASON[_0x4fc7('0x24')](),moment()[_0x4fc7('0xb')](_0x4fc7('0x25')));return _0x45421a[_0x4fc7('0x26')]({'data2':encryptor[_0x4fc7('0x27')](moment()[_0x4fc7('0xb')](_0x4fc7('0x25')))});}else{if(moment()[_0x4fc7('0x28')](encryptor[_0x4fc7('0x29')](_0x1e8225[_0x4fc7('0x1d')]),_0x4fc7('0x2a'))>DAYS){logger[_0x4fc7('0x1e')](_0x4fc7('0x2b'),moment()[_0x4fc7('0xb')](_0x4fc7('0x25')));return _0x45421a['update']({'data1':_0x32b2d0,'data2':null,'license':null});}}}else{if(_0x1e8225[_0x4fc7('0x21')]!=_0x32b2d0){logger[_0x4fc7('0x1e')](_0x4fc7('0x2c'),_0x1e8225[_0x4fc7('0x21')],_0x32b2d0);return _0x45421a[_0x4fc7('0x26')]({'data1':_0x32b2d0,'data2':null,'license':null});}}}return _0x45421a;})[_0x4fc7('0x12')](function(_0x5844d5){_0x45421a=_0x5844d5;})[_0x4fc7('0x2d')](function(_0x189d3c){logger['error'](_0x189d3c[_0x4fc7('0x2e')]);})[_0x4fc7('0x2f')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x45421a);},TIME);});}function defaultLicense(){var _0x5bb1b1=hardware[_0x4fc7('0x30')]();if(_0x5bb1b1){return db[_0x4fc7('0x31')][_0x4fc7('0x32')]({'where':{'id':0x1},'defaults':{'data1':_0x5bb1b1}})[_0x4fc7('0x33')](function(_0x3057ba,_0x1d8835){logger[_0x4fc7('0x1e')](_0x4fc7('0x34'),_0x5bb1b1);manageLicense(_0x5bb1b1,_0x3057ba);})[_0x4fc7('0x2d')](function(_0x1f321a){logger[_0x4fc7('0x35')](_0x1f321a[_0x4fc7('0x2e')]);});}}exports[_0x4fc7('0x36')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d162521..354e934 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 _0x29ac=['parse','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','lodash','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0x29ac,0x114));var _0xc29a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x29ac[_0x491a7f];return _0x3d8f44;};'use strict';var util=require('util');var _=require(_0xc29a('0x0'));var moment=require('moment');var BPromise=require(_0xc29a('0x1'));var hardware=require(_0xc29a('0x2'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc29a('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc29a('0x4'),'machineUuid':hardware[_0xc29a('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc29a('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc29a('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x185bde){return new BPromise(function(_0x2f334a,_0xb89ac4){return db[_0xc29a('0x6')][_0xc29a('0x7')](_['defaults'](_0x185bde,{'raw':!![],'where':{'id':0x1}}))[_0xc29a('0x8')](function(_0x53cded){return checkLicense(_0x53cded,null);})[_0xc29a('0x8')](function(_0x2b0b20){_0x2f334a(_0x2b0b20);return;})['catch'](function(_0x274db6){_0xb89ac4(_0x274db6);});});}function checkLicense(_0x1dea5a,_0x2edfe7){if(!_0x1dea5a){demoLicense[_0xc29a('0x9')]=_0x1dea5a[_0xc29a('0xa')];return demoLicense;}try{var _0x2cef51=_0x2edfe7||_0x1dea5a[_0xc29a('0xb')];if(_[_0xc29a('0xc')](_0x2cef51)){throw new Error(_0xc29a('0xd'));}var _0x4b0c37=_0x1dea5a[_0xc29a('0xa')];var _0x198957=_0x1dea5a[_0xc29a('0xe')];var _0x4b07d0=_0x4b0c37['split']('-')[0x4];var _0x28912e=_0x4b0c37['split']('-')[0x0];var _0x37c282=encryptor[_0xc29a('0xf')](_0x2cef51,util[_0xc29a('0x10')](_0xc29a('0x11'),_0x4b07d0,_0x4b0c37,_0x28912e));var _0x290f68=JSON[_0xc29a('0x12')](_0x37c282);_0x290f68['demo']=![];_0x290f68['uuid']=_0x4b0c37;_0x290f68['machineUuid']=hardware[_0xc29a('0x5')]();if(_0x198957){var _0x9317e=encryptor['decryptString'](_0x198957);_0x290f68[_0xc29a('0x13')]=_0x9317e;_0x290f68[_0xc29a('0x14')]=moment(_0x9317e)[_0xc29a('0x15')](0x7,_0xc29a('0x16'))[_0xc29a('0x10')]();_0x290f68[_0xc29a('0x17')]=_0x290f68[_0xc29a('0x9')]!=_0x290f68[_0xc29a('0x18')]?_0xc29a('0x19'):_0xc29a('0x1a');}return _0x290f68;}catch(_0x5cbc84){breakingLicense[_0xc29a('0x9')]=_0x1dea5a[_0xc29a('0xa')];breakingLicense[_0xc29a('0x1b')]=_0x5cbc84[_0xc29a('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xce2277,_0x367661){getLicense()[_0xc29a('0x8')](function(_0x2563dd){return db[_0xc29a('0x1c')]['findAll']({'attributes':[_0xc29a('0x1d'),[db[_0xc29a('0x1e')]['fn']('COUNT',db['sequelize'][_0xc29a('0x1f')](_0xc29a('0x1d'))),_0xc29a('0x20')]],'group':_0xc29a('0x1d'),'where':{'role':{'$or':[_0xc29a('0x21'),_0xc29a('0x22'),_0xc29a('0x23')]}},'raw':!![]})[_0xc29a('0x8')](function(_0x512cd5){var _0x3fd0ca={'user':_0x2563dd[_0xc29a('0x24')]||0x0,'telephone':_0x2563dd[_0xc29a('0x25')]||0x0};_0x512cd5[_0xc29a('0x26')](function(_0x105168){var _0x22852e=_0x105168['role']===_0xc29a('0x21')?_0xc29a('0x22'):_0x105168['role'];_0x3fd0ca[_0x22852e]-=_0x105168[_0xc29a('0x20')];if(_0x3fd0ca[_0x22852e]<0x0)_0x3fd0ca[_0x22852e]=0x0;});_0xce2277(_0x3fd0ca);return;});})[_0xc29a('0x27')](function(_0x359272){_0x367661(_0x359272);});});}function checkUserLimits(_0x16e70f){return new BPromise(function(_0x4256a3,_0x9dba3a){getLimits()[_0xc29a('0x8')](function(_0x3ff124){var _0x263ba7=_[_0xc29a('0x28')](_[_0xc29a('0x29')](_0x16e70f,_0xc29a('0x1d')),[_0xc29a('0x21'),_0xc29a('0x22'),_0xc29a('0x23')]);var _0x4da4c8=(_0x263ba7['admin']||0x0)+(_0x263ba7[_0xc29a('0x22')]||0x0);var _0x391b61=_0x263ba7[_0xc29a('0x23')]||0x0;if(_0x4da4c8>_0x3ff124['user'])return _0x9dba3a('License\x20limit\x20reached\x20for\x20users');if(_0x391b61>_0x3ff124[_0xc29a('0x23')])return _0x9dba3a('License\x20limit\x20reached\x20for\x20telephones');return _0x4256a3();})[_0xc29a('0x27')](function(_0x57c4be){_0x9dba3a(_0x57c4be);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x9e9e=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','data1','license','isEmpty','data2','split','decryptString','format','parse','demo','gray','deadline','add','days','grayReason','uuid','machineUuid','changed','disabled','message','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','../../components/encryptor','../../mysqldb'];(function(_0x5b02ce,_0x22679e){var _0x1fcca4=function(_0x182a30){while(--_0x182a30){_0x5b02ce['push'](_0x5b02ce['shift']());}};_0x1fcca4(++_0x22679e);}(_0x9e9e,0x1c7));var _0xe9e9=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9e9e[_0x36ed48];return _0x51c63a;};'use strict';var util=require(_0xe9e9('0x0'));var _=require('lodash');var moment=require(_0xe9e9('0x1'));var BPromise=require(_0xe9e9('0x2'));var hardware=require('./hardware');var encryptor=require(_0xe9e9('0x3'));var db=require(_0xe9e9('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe9e9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe9e9('0x6'),'machineUuid':hardware[_0xe9e9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe9e9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xe9e9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x47d839){return new BPromise(function(_0x1b1d2a,_0xfdb2ce){return db[_0xe9e9('0x8')][_0xe9e9('0x9')](_[_0xe9e9('0xa')](_0x47d839,{'raw':!![],'where':{'id':0x1}}))[_0xe9e9('0xb')](function(_0x434efa){return checkLicense(_0x434efa,null);})[_0xe9e9('0xb')](function(_0x42e4b9){_0x1b1d2a(_0x42e4b9);return;})[_0xe9e9('0xc')](function(_0x1ca15d){_0xfdb2ce(_0x1ca15d);});});}function checkLicense(_0x330edf,_0x1fad92){if(!_0x330edf){demoLicense['uuid']=_0x330edf[_0xe9e9('0xd')];return demoLicense;}try{var _0x379a80=_0x1fad92||_0x330edf[_0xe9e9('0xe')];if(_[_0xe9e9('0xf')](_0x379a80)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1b0beb=_0x330edf[_0xe9e9('0xd')];var _0x59132d=_0x330edf[_0xe9e9('0x10')];var _0x43f1ac=_0x1b0beb[_0xe9e9('0x11')]('-')[0x4];var _0x1987b7=_0x1b0beb[_0xe9e9('0x11')]('-')[0x0];var _0x29e2ce=encryptor[_0xe9e9('0x12')](_0x379a80,util[_0xe9e9('0x13')]('%s:%s:%s',_0x43f1ac,_0x1b0beb,_0x1987b7));var _0x9c3400=JSON[_0xe9e9('0x14')](_0x29e2ce);_0x9c3400[_0xe9e9('0x15')]=![];_0x9c3400['uuid']=_0x1b0beb;_0x9c3400['machineUuid']=hardware[_0xe9e9('0x7')]();if(_0x59132d){var _0x394497=encryptor[_0xe9e9('0x12')](_0x59132d);_0x9c3400[_0xe9e9('0x16')]=_0x394497;_0x9c3400[_0xe9e9('0x17')]=moment(_0x394497)[_0xe9e9('0x18')](0x7,_0xe9e9('0x19'))[_0xe9e9('0x13')]();_0x9c3400[_0xe9e9('0x1a')]=_0x9c3400[_0xe9e9('0x1b')]!=_0x9c3400[_0xe9e9('0x1c')]?_0xe9e9('0x1d'):_0xe9e9('0x1e');}return _0x9c3400;}catch(_0x24c780){breakingLicense[_0xe9e9('0x1b')]=_0x330edf[_0xe9e9('0xd')];breakingLicense[_0xe9e9('0x1f')]=_0x24c780[_0xe9e9('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4bb9ed,_0x3c7062){getLicense()[_0xe9e9('0xb')](function(_0x3c53a8){return db['User'][_0xe9e9('0x20')]({'attributes':[_0xe9e9('0x21'),[db['sequelize']['fn'](_0xe9e9('0x22'),db[_0xe9e9('0x23')][_0xe9e9('0x24')](_0xe9e9('0x21'))),_0xe9e9('0x25')]],'group':_0xe9e9('0x21'),'where':{'role':{'$or':[_0xe9e9('0x26'),_0xe9e9('0x27'),_0xe9e9('0x28')]}},'raw':!![]})['then'](function(_0x3a5b92){var _0x3a9cd0={'user':_0x3c53a8[_0xe9e9('0x29')]||0x0,'telephone':_0x3c53a8['telephones']||0x0};_0x3a5b92['forEach'](function(_0x549fdf){var _0x4feb5d=_0x549fdf[_0xe9e9('0x21')]==='admin'?_0xe9e9('0x27'):_0x549fdf['role'];_0x3a9cd0[_0x4feb5d]-=_0x549fdf[_0xe9e9('0x25')];if(_0x3a9cd0[_0x4feb5d]<0x0)_0x3a9cd0[_0x4feb5d]=0x0;});_0x4bb9ed(_0x3a9cd0);return;});})['catch'](function(_0x11d062){_0x3c7062(_0x11d062);});});}function checkUserLimits(_0x439ba5){return new BPromise(function(_0x535899,_0x124fa8){getLimits()['then'](function(_0x382123){var _0x5a2880=_[_0xe9e9('0x2a')](_['countBy'](_0x439ba5,_0xe9e9('0x21')),['admin',_0xe9e9('0x27'),_0xe9e9('0x28')]);var _0x2a29f3=(_0x5a2880[_0xe9e9('0x26')]||0x0)+(_0x5a2880['user']||0x0);var _0x384597=_0x5a2880[_0xe9e9('0x28')]||0x0;if(_0x2a29f3>_0x382123['user'])return _0x124fa8(_0xe9e9('0x2b'));if(_0x384597>_0x382123[_0xe9e9('0x28')])return _0x124fa8(_0xe9e9('0x2c'));return _0x535899();})[_0xe9e9('0xc')](function(_0x2acc20){_0x124fa8(_0x2acc20);});});}module[_0xe9e9('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 16886ae..aa7f086 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 _0x08f4=['app-id','http://localhost:9000'];(function(_0x10b4b8,_0x450fea){var _0x424293=function(_0x58ad42){while(--_0x58ad42){_0x10b4b8['push'](_0x10b4b8['shift']());}};_0x424293(++_0x450fea);}(_0x08f4,0xb7));var _0x408f=function(_0x253cf8,_0x494655){_0x253cf8=_0x253cf8-0x0;var _0xf9e79=_0x08f4[_0x253cf8];return _0xf9e79;};'use strict';module['exports']={'DOMAIN':_0x408f('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x408f('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x7ec8=['myappanuglar-secret','app-id','http://localhost:9000'];(function(_0x5bdd03,_0x5e7c64){var _0x31c762=function(_0x552d78){while(--_0x552d78){_0x5bdd03['push'](_0x5bdd03['shift']());}};_0x31c762(++_0x5e7c64);}(_0x7ec8,0xce));var _0x87ec=function(_0x480e55,_0x4162a1){_0x480e55=_0x480e55-0x0;var _0x10cc3e=_0x7ec8[_0x480e55];return _0x10cc3e;};'use strict';module['exports']={'DOMAIN':_0x87ec('0x0'),'SESSION_SECRET':_0x87ec('0x1'),'GOOGLE_ID':_0x87ec('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1fa2646..633c1ff 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5475=['log','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','exports','Logger','%s-%s','error','transports','File','info','Console','env','moment','winston','util','path','INFO','join','/var'];(function(_0x415264,_0x4e71cc){var _0x305b9e=function(_0x25bde5){while(--_0x25bde5){_0x415264['push'](_0x415264['shift']());}};_0x305b9e(++_0x4e71cc);}(_0x5475,0x9b));var _0x5547=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5475[_0x160c73];return _0xd9302;};'use strict';var moment=require(_0x5547('0x0'));var winston=require(_0x5547('0x1'));var util=require(_0x5547('0x2'));var path=require(_0x5547('0x3'));var debugLevel=_0x5547('0x4');function filename(_0x208b6d,_0x32ee5f){return path[_0x5547('0x5')](_0x5547('0x6'),_0x5547('0x7'),_0x5547('0x8'),util[_0x5547('0x9')](_0x5547('0xa'),_0x208b6d,_0x32ee5f));}function formatter(_0x53dceb,_0x5209db){_0x5209db[_0x5547('0xb')]=_0x5209db[_0x5547('0xb')][_0x5547('0xc')](/@@{/g,_0x5547('0xd'))[_0x5547('0xc')](/}@@/g,_0x5547('0xe'))[_0x5547('0xc')](/@{/g,'{{')[_0x5547('0xc')](/}@/g,'}}');return util[_0x5547('0x9')](_0x5547('0xf'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x5209db[_0x5547('0x10')][_0x5547('0x11')](),_0x53dceb,_0x5209db[_0x5547('0xb')]);}module[_0x5547('0x12')]=function(_0x2634a4){return new winston[(_0x5547('0x13'))]({'transports':[new winston['transports']['File']({'name':util[_0x5547('0x9')](_0x5547('0x14'),_0x2634a4,_0x5547('0x15')),'filename':filename(_0x2634a4,_0x5547('0x15')),'level':_0x5547('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a5b3c){return formatter(_0x2634a4,_0x4a5b3c);}}),new winston[(_0x5547('0x16'))][(_0x5547('0x17'))]({'name':util[_0x5547('0x9')](_0x5547('0x14'),_0x2634a4,_0x5547('0x18')),'filename':filename(_0x2634a4,_0x5547('0x18')),'level':_0x5547('0x18'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fba23){return formatter(_0x2634a4,_0x4fba23);}}),new winston['transports'][(_0x5547('0x19'))]({'level':process[_0x5547('0x1a')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x5131e9){return formatter(_0x2634a4,_0x5131e9);}})]});}; \ No newline at end of file +var _0x1dbe=['%s-%s','error','info','Console','debugLevel','winston','util','path','INFO','xcally','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','File'];(function(_0x4f043d,_0x50ec68){var _0x4577d8=function(_0x2da2db){while(--_0x2da2db){_0x4f043d['push'](_0x4f043d['shift']());}};_0x4577d8(++_0x50ec68);}(_0x1dbe,0x10d));var _0xe1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbe[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var winston=require(_0xe1db('0x0'));var util=require(_0xe1db('0x1'));var path=require(_0xe1db('0x2'));var debugLevel=_0xe1db('0x3');function filename(_0x68180c,_0x14ea9b){return path['join']('/var','log',_0xe1db('0x4'),util['format'](_0xe1db('0x5'),_0x68180c,_0x14ea9b));}function formatter(_0x359d6f,_0x106fda){_0x106fda[_0xe1db('0x6')]=_0x106fda['message'][_0xe1db('0x7')](/@@{/g,_0xe1db('0x8'))[_0xe1db('0x7')](/}@@/g,_0xe1db('0x9'))[_0xe1db('0x7')](/@{/g,'{{')[_0xe1db('0x7')](/}@/g,'}}');return util['format'](_0xe1db('0xa'),moment()[_0xe1db('0xb')](_0xe1db('0xc')),_0x106fda[_0xe1db('0xd')]['toUpperCase'](),_0x359d6f,_0x106fda[_0xe1db('0x6')]);}module[_0xe1db('0xe')]=function(_0x56b62c){return new winston[(_0xe1db('0xf'))]({'transports':[new winston['transports'][(_0xe1db('0x10'))]({'name':util[_0xe1db('0xb')](_0xe1db('0x11'),_0x56b62c,_0xe1db('0x12')),'filename':filename(_0x56b62c,_0xe1db('0x12')),'level':_0xe1db('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x589a37){return formatter(_0x56b62c,_0x589a37);}}),new winston['transports'][(_0xe1db('0x10'))]({'name':util[_0xe1db('0xb')](_0xe1db('0x11'),_0x56b62c,_0xe1db('0x13')),'filename':filename(_0x56b62c,'info'),'level':_0xe1db('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ad6f3){return formatter(_0x56b62c,_0x5ad6f3);}}),new winston['transports'][(_0xe1db('0x14'))]({'level':process['env'][_0xe1db('0x15')]||debugLevel,'json':![],'formatter':function(_0x18590e){return formatter(_0x56b62c,_0x18590e);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 18b07e8..9a334f6 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 _0x8bfe=['../../services/routing/index.js','exports','path','express','join','ami','../../services/ami/index.js','../../services/agi/index.js','email','routing'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8bfe,0x1a6));var _0xe8bf=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x8bfe[_0x421cf8];return _0x145c48;};'use strict';var path=require(_0xe8bf('0x0'));var os=require('os');var config={'apps':[{'name':_0xe8bf('0x1'),'script':path[_0xe8bf('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xe8bf('0x3'),'script':path[_0xe8bf('0x2')](__dirname,_0xe8bf('0x4'))},{'name':'agi','script':path[_0xe8bf('0x2')](__dirname,_0xe8bf('0x5'))},{'name':_0xe8bf('0x6'),'script':path[_0xe8bf('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xe8bf('0x7'),'script':path['join'](__dirname,_0xe8bf('0x8'))},{'name':'xdr','script':path[_0xe8bf('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xe8bf('0x9')]=config; \ No newline at end of file +var _0xd863=['../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x1cbda9,_0x56992d){var _0x439362=function(_0x58587e){while(--_0x58587e){_0x1cbda9['push'](_0x1cbda9['shift']());}};_0x439362(++_0x56992d);}(_0xd863,0x1c7));var _0x3d86=function(_0x362ea3,_0x516271){_0x362ea3=_0x362ea3-0x0;var _0x8818ce=_0xd863[_0x362ea3];return _0x8818ce;};'use strict';var path=require(_0x3d86('0x0'));var os=require('os');var config={'apps':[{'name':_0x3d86('0x1'),'script':path[_0x3d86('0x2')](__dirname,_0x3d86('0x3'))},{'name':_0x3d86('0x4'),'script':path['join'](__dirname,_0x3d86('0x5'))},{'name':_0x3d86('0x6'),'script':path[_0x3d86('0x2')](__dirname,_0x3d86('0x7'))},{'name':'email','script':path[_0x3d86('0x2')](__dirname,_0x3d86('0x8'))},{'name':_0x3d86('0x9'),'script':path[_0x3d86('0x2')](__dirname,_0x3d86('0xa'))},{'name':_0x3d86('0xb'),'script':path[_0x3d86('0x2')](__dirname,_0x3d86('0xc'))}]};module[_0x3d86('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 21b1ace..509ca7d 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 _0xd053=['delete','dump','saved','pm2','bluebird','connect','start','disconnect','stop','then','restart','list'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xd053,0xe7));var _0x3d05=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0xd053[_0x1fb038];return _0x1600dc;};'use strict';var pm2=require(_0x3d05('0x0'));var BPromise=require(_0x3d05('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0xee24bb,_0x35cdb1){return pm2[_0x3d05('0x2')](function(_0x55090d){if(_0x55090d){return _0x35cdb1(_0x55090d);}return _0xee24bb('connected');});});};exports[_0x3d05('0x3')]=function(_0x1fc866){return connect()['then'](function(){return new BPromise(function(_0x1e8c29,_0x2ba33b){return pm2['start'](_0x1fc866,function(_0x2bb04f,_0x10f771){if(_0x2bb04f){return _0x2ba33b(_0x2bb04f);}pm2[_0x3d05('0x4')]();return _0x1e8c29(_0x10f771);});});});};exports[_0x3d05('0x5')]=function(_0x36230f){return connect()[_0x3d05('0x6')](function(){return new BPromise(function(_0x330f7b,_0x13b83a){return pm2[_0x3d05('0x5')](_0x36230f,function(_0x16d3f1,_0x3d2db6){if(_0x16d3f1){return _0x13b83a(_0x16d3f1);}pm2['disconnect']();return _0x330f7b(_0x3d2db6);});});});};exports[_0x3d05('0x7')]=function(_0x3a9bd2){return connect()[_0x3d05('0x6')](function(){return new BPromise(function(_0x1b5126,_0xadbe49){return pm2[_0x3d05('0x7')](_0x3a9bd2,function(_0x1d3132,_0x1ab1dd){if(_0x1d3132){return _0xadbe49(_0x1d3132);}pm2[_0x3d05('0x4')]();return _0x1b5126(_0x1ab1dd);});});});};exports['list']=function(){return connect()[_0x3d05('0x6')](function(){return new BPromise(function(_0x2d62d7,_0x34f8b5){return pm2[_0x3d05('0x8')](function(_0x560aae,_0x4b3287){if(_0x560aae){return _0x34f8b5(_0x560aae);}pm2['disconnect']();return _0x2d62d7(_0x4b3287);});});});};exports['describe']=function(_0x41f12c){return connect()['then'](function(){return new BPromise(function(_0x20a85c,_0x5bd384){return pm2['describe'](_0x41f12c,function(_0x1419b4,_0x3389e5){if(_0x1419b4){return _0x5bd384(_0x1419b4);}pm2[_0x3d05('0x4')]();return _0x20a85c(_0x3389e5);});});});};exports[_0x3d05('0x9')]=function(_0x18ffa0){return connect()[_0x3d05('0x6')](function(){return new BPromise(function(_0x21994c,_0x43e829){return pm2[_0x3d05('0x9')](_0x18ffa0,function(_0xcf3bac,_0x9ad24a){if(_0xcf3bac){return _0x43e829(_0xcf3bac);}pm2[_0x3d05('0x4')]();return _0x21994c(_0x9ad24a);});});});};exports['dump']=function(){return connect()[_0x3d05('0x6')](function(){return new BPromise(function(_0x4adae2,_0x32071c){return pm2[_0x3d05('0xa')](function(_0x12f54c){if(_0x12f54c){return _0x32071c(_0x12f54c);}return _0x4adae2(_0x3d05('0xb'));});});});}; \ No newline at end of file +var _0x0c75=['dump','saved','bluebird','connect','connected','start','disconnect','stop','restart','list','then','describe','delete'];(function(_0x3093fe,_0x5a0cff){var _0x31517d=function(_0x4a6eba){while(--_0x4a6eba){_0x3093fe['push'](_0x3093fe['shift']());}};_0x31517d(++_0x5a0cff);}(_0x0c75,0x6a));var _0x50c7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0c75[_0x2641f9];return _0x585741;};'use strict';var pm2=require('pm2');var BPromise=require(_0x50c7('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x2d00bd,_0x14220a){return pm2[_0x50c7('0x1')](function(_0x23b0ec){if(_0x23b0ec){return _0x14220a(_0x23b0ec);}return _0x2d00bd(_0x50c7('0x2'));});});};exports[_0x50c7('0x3')]=function(_0x3c0314){return connect()['then'](function(){return new BPromise(function(_0x4b982e,_0x4c062f){return pm2[_0x50c7('0x3')](_0x3c0314,function(_0x594830,_0x34a297){if(_0x594830){return _0x4c062f(_0x594830);}pm2[_0x50c7('0x4')]();return _0x4b982e(_0x34a297);});});});};exports[_0x50c7('0x5')]=function(_0x53ef83){return connect()['then'](function(){return new BPromise(function(_0xbd0521,_0x474dc0){return pm2[_0x50c7('0x5')](_0x53ef83,function(_0x3fba1a,_0x3dcf76){if(_0x3fba1a){return _0x474dc0(_0x3fba1a);}pm2[_0x50c7('0x4')]();return _0xbd0521(_0x3dcf76);});});});};exports[_0x50c7('0x6')]=function(_0x4fde1f){return connect()['then'](function(){return new BPromise(function(_0x1b68f3,_0x6f2486){return pm2[_0x50c7('0x6')](_0x4fde1f,function(_0x5d07b8,_0x2a6ef2){if(_0x5d07b8){return _0x6f2486(_0x5d07b8);}pm2[_0x50c7('0x4')]();return _0x1b68f3(_0x2a6ef2);});});});};exports[_0x50c7('0x7')]=function(){return connect()[_0x50c7('0x8')](function(){return new BPromise(function(_0x1e2dc5,_0x50c690){return pm2['list'](function(_0x2d27dc,_0x303a64){if(_0x2d27dc){return _0x50c690(_0x2d27dc);}pm2['disconnect']();return _0x1e2dc5(_0x303a64);});});});};exports[_0x50c7('0x9')]=function(_0x1f1db1){return connect()[_0x50c7('0x8')](function(){return new BPromise(function(_0x4f092a,_0x552ffe){return pm2[_0x50c7('0x9')](_0x1f1db1,function(_0x150095,_0xc4d7f5){if(_0x150095){return _0x552ffe(_0x150095);}pm2['disconnect']();return _0x4f092a(_0xc4d7f5);});});});};exports[_0x50c7('0xa')]=function(_0x41024d){return connect()[_0x50c7('0x8')](function(){return new BPromise(function(_0x5d30db,_0xd5b365){return pm2['delete'](_0x41024d,function(_0xd67dee,_0x415f45){if(_0xd67dee){return _0xd5b365(_0xd67dee);}pm2[_0x50c7('0x4')]();return _0x5d30db(_0x415f45);});});});};exports[_0x50c7('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x59bbba,_0x526053){return pm2[_0x50c7('0xb')](function(_0xdea1fd){if(_0xdea1fd){return _0x526053(_0xdea1fd);}return _0x59bbba(_0x50c7('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index fe479dd..21dd8c1 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 _0x8d2b=['redis','localhost','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','then','map','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x12510b,_0x68b81d){var _0x56362f=function(_0x3ae55d){while(--_0x3ae55d){_0x12510b['push'](_0x12510b['shift']());}};_0x56362f(++_0x68b81d);}(_0x8d2b,0x94));var _0xb8d2=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x8d2b[_0x34eb31];return _0x254994;};'use strict';var _=require(_0xb8d2('0x0'));var moment=require(_0xb8d2('0x1'));var Redis=require(_0xb8d2('0x2'));var util=require(_0xb8d2('0x3'));var config=require(_0xb8d2('0x4'));var db=require(_0xb8d2('0x5'))['db'];var logger=require(_0xb8d2('0x6'))('schedule');config[_0xb8d2('0x7')]=_['defaults'](config['redis'],{'host':_0xb8d2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x420839=0x0;var _0x44903e=[];return db[_0xb8d2('0x9')][_0xb8d2('0xa')]({'raw':!![],'attributes':['id',_0xb8d2('0xb')],'where':{'id':0x1}})['then'](function(_0xa81533){_0x420839=_0xa81533[_0xb8d2('0xb')];if(_0x420839){return db[_0xb8d2('0xc')][_0xb8d2('0xd')]({'raw':!![],'attributes':['id',_0xb8d2('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb8d2('0xf')](_0xa81533[_0xb8d2('0xb')],'minutes')}}});}else{return[];}})[_0xb8d2('0x10')](function(_0x2e604f){if(_0x2e604f&&_0x2e604f['length']){_0x44903e=_[_0xb8d2('0x11')](_0x2e604f||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x44903e[_0xb8d2('0x12')]());return db[_0xb8d2('0xc')]['update']({'closeReason':_0xb8d2('0x13'),'disposition':_0xb8d2('0x14'),'closed':!![],'closedAt':moment()[_0xb8d2('0x15')](_0xb8d2('0x16'))},{'where':{'id':_0x44903e}});}})[_0xb8d2('0x10')](function(){if(_0x44903e&&_0x44903e[_0xb8d2('0x17')]){logger[_0xb8d2('0x18')](_0xb8d2('0x19'),_0x44903e[_0xb8d2('0x12')]());for(var _0x8b4c13=0x0;_0x8b4c13<_0x44903e[_0xb8d2('0x17')];_0x8b4c13++){io[_0xb8d2('0x1a')]('chatInteraction:update',{'id':_0x44903e[_0x8b4c13],'closed':!![]});}}})['catch'](function(_0x21190a){logger[_0xb8d2('0x1b')](_0xb8d2('0x1c'),_0x21190a?util[_0xb8d2('0x1d')](_0x21190a,{'showHidden':![],'depth':null}):'');});}exports[_0xb8d2('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4566=['info','join','length','emit','chatInteraction:update','catch','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults','socket.io-emitter','Setting','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','update'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x4566,0x14d));var _0x6456=function(_0x3f7c72,_0xe8396e){_0x3f7c72=_0x3f7c72-0x0;var _0x4c2357=_0x4566[_0x3f7c72];return _0x4c2357;};'use strict';var _=require(_0x6456('0x0'));var moment=require(_0x6456('0x1'));var Redis=require(_0x6456('0x2'));var util=require(_0x6456('0x3'));var config=require(_0x6456('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x6456('0x5'))('schedule');config[_0x6456('0x6')]=_[_0x6456('0x7')](config[_0x6456('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6456('0x8'))(new Redis(config[_0x6456('0x6')]));function closeInteractions(){var _0x59fd37=0x0;var _0x479a86=[];return db[_0x6456('0x9')]['find']({'raw':!![],'attributes':['id',_0x6456('0xa')],'where':{'id':0x1}})['then'](function(_0x29e4cd){_0x59fd37=_0x29e4cd[_0x6456('0xa')];if(_0x59fd37){return db[_0x6456('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x6456('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6456('0xd')](_0x29e4cd['chatTimeout'],_0x6456('0xe'))}}});}else{return[];}})[_0x6456('0xf')](function(_0x3af3a2){if(_0x3af3a2&&_0x3af3a2['length']){_0x479a86=_['map'](_0x3af3a2||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x479a86['join']());return db[_0x6456('0xb')][_0x6456('0x10')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x479a86}});}})[_0x6456('0xf')](function(){if(_0x479a86&&_0x479a86['length']){logger[_0x6456('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x479a86[_0x6456('0x12')]());for(var _0x49db66=0x0;_0x49db66<_0x479a86[_0x6456('0x13')];_0x49db66++){io[_0x6456('0x14')](_0x6456('0x15'),{'id':_0x479a86[_0x49db66],'closed':!![]});}}})[_0x6456('0x16')](function(_0x409f5d){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x409f5d?util[_0x6456('0x17')](_0x409f5d,{'showHidden':![],'depth':null}):'');});}exports[_0x6456('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 05aa447..7039ead 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 _0xe6e8=['keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','exists','startAt','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','attachments','message','text','stringify','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','MailServerOut','keys','jobs','map','toString'];(function(_0x2c86bc,_0x19f707){var _0x503e79=function(_0x45024b){while(--_0x45024b){_0x2c86bc['push'](_0x2c86bc['shift']());}};_0x503e79(++_0x19f707);}(_0xe6e8,0xc9));var _0x8e6e=function(_0x6a2406,_0x29bb3e){_0x6a2406=_0x6a2406-0x0;var _0x41670d=_0xe6e8[_0x6a2406];return _0x41670d;};'use strict';var fs=require('fs');var util=require(_0x8e6e('0x0'));var path=require(_0x8e6e('0x1'));var _=require(_0x8e6e('0x2'));var moment=require(_0x8e6e('0x3'));var CronJobManager=require(_0x8e6e('0x4'));var jayson=require(_0x8e6e('0x5'));var BPromise=require(_0x8e6e('0x6'));var logger=require(_0x8e6e('0x7'))('schedule');var db=require(_0x8e6e('0x8'))['db'];var analyticCustomReportController=require(_0x8e6e('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x8e6e('0xa')][_0x8e6e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x54e2a6,_0x471ba2){return function(){logger['info'](_0x8e6e('0xc'),_0x54e2a6[_0x8e6e('0xd')]);var _0x3b23de=!![];var _0x166443={'tls':{'rejectUnauthorized':![]}};if(_0x54e2a6[_0x8e6e('0xe')]['Smtp']['service']){_0x166443[_0x8e6e('0xf')]=_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x10')][_0x8e6e('0xf')];}else{_0x166443['host']=_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x10')][_0x8e6e('0x11')];_0x166443[_0x8e6e('0x12')]=_0x54e2a6[_0x8e6e('0xe')]['Smtp'][_0x8e6e('0x12')];_0x166443[_0x8e6e('0x13')]=_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x10')][_0x8e6e('0x13')];}if(_0x54e2a6['MailAccount']['Smtp'][_0x8e6e('0x14')]){_0x166443[_0x8e6e('0x15')]={'user':_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x10')]['user'],'pass':_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x10')][_0x8e6e('0x16')]};}var _0x15081b={'account':_0x166443,'message':{'from':util[_0x8e6e('0x17')](_0x8e6e('0x18'),_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x19')],_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0xd')]||_0x54e2a6[_0x8e6e('0xe')][_0x8e6e('0x10')][_0x8e6e('0x1a')]),'to':_0x54e2a6[_0x8e6e('0xd')],'cc':_0x54e2a6['cc'],'bcc':_0x54e2a6[_0x8e6e('0x1b')],'subject':util[_0x8e6e('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x471ba2[_0x8e6e('0x19')],_0x54e2a6[_0x8e6e('0x1c')],_0x54e2a6[_0x8e6e('0x1d')])}};var _0x123aa5=path[_0x8e6e('0x1e')](__dirname,_0x8e6e('0x1f'));var _0x49d2b7=_0x471ba2[_0x8e6e('0x20')];var _0x468dbf=util[_0x8e6e('0x17')](_0x8e6e('0x21'),path[_0x8e6e('0x22')](_0x471ba2['savename'],path[_0x8e6e('0x23')](_0x471ba2['savename'])),_0x8e6e('0x24'));var _0x599df0=path[_0x8e6e('0x1e')](_0x123aa5,_0x49d2b7);var _0x5e0983=path['join'](_0x123aa5,_0x468dbf);if(fs[_0x8e6e('0x25')](_0x599df0)){_0x471ba2['status']='Sent';_0x15081b['message'][_0x8e6e('0x26')]=[{'filename':_0x49d2b7,'path':_0x599df0}];_0x15081b[_0x8e6e('0x27')][_0x8e6e('0x28')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8e6e('0x29')](_0x471ba2,null,0x2));}else if(fs[_0x8e6e('0x25')](_0x5e0983)){_0x471ba2[_0x8e6e('0x2a')]=_0x8e6e('0x2b');_0x15081b[_0x8e6e('0x27')][_0x8e6e('0x26')]=[{'filename':_0x468dbf,'path':_0x5e0983}];}else{_0x15081b[_0x8e6e('0x27')][_0x8e6e('0x28')]=_0x8e6e('0x2c');if(!_0x54e2a6[_0x8e6e('0x2d')]){_0x3b23de=![];logger[_0x8e6e('0x2e')](_0x8e6e('0x2f'));}}if(_0x3b23de){return client['request'](_0x8e6e('0x30'),_0x15081b)[_0x8e6e('0x31')](function(_0x172984){if(_0x172984['error']){return logger[_0x8e6e('0x32')](_0x8e6e('0x33'),JSON['stringify'](_0x172984));}return logger[_0x8e6e('0x2e')](_0x8e6e('0x34'));})[_0x8e6e('0x35')](function(_0x5a4314){return logger['error']('error\x20mail',JSON[_0x8e6e('0x29')](_0x5a4314));});}};}function handleError(){return function(_0x5f011d){return logger[_0x8e6e('0x32')](JSON[_0x8e6e('0x29')](_0x5f011d));};}function handleResult(_0x2ba984){return function(_0x5bc3a1){logger[_0x8e6e('0x2e')](_0x8e6e('0x36'),JSON[_0x8e6e('0x29')](_0x5bc3a1));if(_0x2ba984[_0x8e6e('0xe')]&&_0x2ba984[_0x8e6e('0xe')][_0x8e6e('0x10')]&&!_[_0x8e6e('0x37')](_0x2ba984[_0x8e6e('0xd')])){setTimeout(handleSendEmail(_0x2ba984,_0x5bc3a1),0x3c*0x3e8);}};}function handleJob(_0x503046){return function(){try{if(_[_0x8e6e('0x37')](_0x503046['subtractNumber'])){return logger[_0x8e6e('0x2e')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x503046[_0x8e6e('0x1d')])){return logger[_0x8e6e('0x2e')]('subtractUnit\x20null\x20or\x20undefined');}var _0x488f67={'startDate':moment()[_0x8e6e('0x38')](_0x503046[_0x8e6e('0x1c')],_0x503046['subtractUnit'])[_0x8e6e('0x17')](_0x8e6e('0x39')),'endDate':moment()[_0x8e6e('0x17')](_0x8e6e('0x39')),'type':_0x8e6e('0x3a'),'output':_0x503046[_0x8e6e('0x3b')],'name':_0x503046[_0x8e6e('0x19')]};if(!_['isNil'](_0x503046[_0x8e6e('0x3c')])){logger[_0x8e6e('0x2e')]('exec\x20defaul\x20report\x20id:%s',_0x503046[_0x8e6e('0x3c')]);return analyticDefaultReportController[_0x8e6e('0x3d')]({'id':_0x503046[_0x8e6e('0x3c')]},_0x488f67)['then'](handleResult(_0x503046))[_0x8e6e('0x35')](handleError());}if(!_['isNil'](_0x503046[_0x8e6e('0x3e')])){logger[_0x8e6e('0x2e')](_0x8e6e('0x3f'),_0x503046['CustomReportId']);return analyticCustomReportController[_0x8e6e('0x3d')]({'id':_0x503046[_0x8e6e('0x3e')]},_0x488f67)[_0x8e6e('0x31')](handleResult(_0x503046))['catch'](handleError());}}catch(_0x262f94){logger[_0x8e6e('0x32')](JSON['stringify'](_0x262f94));}return logger[_0x8e6e('0x2e')]('no\x20report\x20id');};}function getJobs(_0x48aa55){var _0x2d914b={};if(_0x48aa55){_0x2d914b['id']=_0x48aa55;}return db['Schedule']['findAll']({'where':_0x2d914b,'include':[{'model':db[_0x8e6e('0xe')],'attributes':['id',_0x8e6e('0x19'),_0x8e6e('0xd')],'include':[{'model':db[_0x8e6e('0x40')],'as':_0x8e6e('0x10')}]}]})[_0x8e6e('0x31')](function(_0x44b63b){var _0x3432c5=_[_0x8e6e('0x41')](manager[_0x8e6e('0x42')]);var _0x664ee5=_[_0x8e6e('0x43')](_0x44b63b,function(_0xab37b2){return _0xab37b2['id'][_0x8e6e('0x44')]();});var _0x31bd96=_[_0x8e6e('0x45')](_0x44b63b,function(_0x533a64){return _0x533a64['id'][_0x8e6e('0x44')]();});var _0x30645b=_0x48aa55?_0x664ee5:_[_0x8e6e('0x46')](_0x664ee5,_0x3432c5);var _0x52615e=_['intersection'](_0x664ee5,_0x3432c5);var _0x117607=_[_0x8e6e('0x46')](_0x3432c5,_0x664ee5);var _0x59b5e1;var _0x3ceb21;for(_0x59b5e1=0x0;_0x59b5e1<_0x117607[_0x8e6e('0x47')]&&!_0x48aa55;_0x59b5e1+=0x1){_0x3ceb21=_0x117607[_0x59b5e1][_0x8e6e('0x44')]();if(manager['exists'](_0x3ceb21)){manager[_0x8e6e('0x48')](_0x3ceb21);manager[_0x8e6e('0x49')](_0x3ceb21);logger['info'](_0x8e6e('0x4a'),_0x3ceb21);}}logger['info'](_0x8e6e('0x4b'),JSON['stringify'](_0x30645b));for(_0x59b5e1=0x0;_0x59b5e1<_0x30645b['length'];_0x59b5e1+=0x1){_0x3ceb21=_0x30645b[_0x59b5e1][_0x8e6e('0x44')]();logger['info']('index',_0x3ceb21);if(_0x48aa55){logger[_0x8e6e('0x2e')](_0x8e6e('0x4c'),_0x48aa55);logger['info'](JSON[_0x8e6e('0x29')](_0x31bd96[_0x3ceb21]));BPromise['resolve']()['then'](handleJob(_0x31bd96[_0x3ceb21]));logger[_0x8e6e('0x2e')](_0x8e6e('0x4d'),_0x31bd96[_0x3ceb21][_0x8e6e('0x19')],_0x31bd96[_0x3ceb21][_0x8e6e('0x4e')]);}else if(_0x31bd96[_0x3ceb21]['cron']&&_0x31bd96[_0x3ceb21][_0x8e6e('0x4f')]&&moment()[_0x8e6e('0x50')](_0x31bd96[_0x3ceb21]['startAt'],_0x31bd96[_0x3ceb21][_0x8e6e('0x51')])){manager[_0x8e6e('0x52')](_0x3ceb21,_0x31bd96[_0x3ceb21]['cron'],handleJob(_0x31bd96[_0x3ceb21]));manager[_0x8e6e('0x53')](_0x3ceb21);logger[_0x8e6e('0x2e')](_0x8e6e('0x54'),_0x31bd96[_0x3ceb21][_0x8e6e('0x19')],_0x31bd96[_0x3ceb21][_0x8e6e('0x4e')]);}else if(manager[_0x8e6e('0x55')](_0x3ceb21)){manager[_0x8e6e('0x48')](_0x3ceb21);manager['deleteJob'](_0x3ceb21);logger[_0x8e6e('0x2e')]('stop\x20cron',_0x31bd96[_0x3ceb21][_0x8e6e('0x19')],_0x31bd96[_0x3ceb21][_0x8e6e('0x4e')]);}}for(_0x59b5e1=0x0,_0x3ceb21;_0x59b5e1<_0x52615e[_0x8e6e('0x47')]&&!_0x48aa55;_0x59b5e1+=0x1){_0x3ceb21=_0x52615e[_0x59b5e1][_0x8e6e('0x44')]();if(manager[_0x8e6e('0x55')](_0x3ceb21)){if(_0x31bd96[_0x3ceb21][_0x8e6e('0x4e')]&&_0x31bd96[_0x3ceb21][_0x8e6e('0x4f')]&&moment()['isBetween'](_0x31bd96[_0x3ceb21][_0x8e6e('0x56')],_0x31bd96[_0x3ceb21]['endAt'])){manager['update'](_0x3ceb21,_0x31bd96[_0x3ceb21][_0x8e6e('0x4e')],handleJob(_0x31bd96[_0x3ceb21]));logger[_0x8e6e('0x2e')](_0x8e6e('0x57'),_0x31bd96[_0x3ceb21][_0x8e6e('0x19')],_0x31bd96[_0x3ceb21][_0x8e6e('0x4e')]);}else{manager[_0x8e6e('0x48')](_0x3ceb21);manager[_0x8e6e('0x49')](_0x3ceb21);logger[_0x8e6e('0x2e')](_0x8e6e('0x58'),_0x31bd96[_0x3ceb21][_0x8e6e('0x19')],_0x31bd96[_0x3ceb21]['cron']);}}}})[_0x8e6e('0x35')](function(_0xd6f537){logger[_0x8e6e('0x32')](JSON[_0x8e6e('0x29')](_0xd6f537));});}exports[_0x8e6e('0x59')]=function(_0x1fe831){return getJobs(_0x1fe831);};exports[_0x8e6e('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x02fe=['subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','host','port','MailAccount','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','name','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','request','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x02fe,0x133));var _0xe02f=function(_0x402e26,_0xb5b676){_0x402e26=_0x402e26-0x0;var _0x16adf2=_0x02fe[_0x402e26];return _0x16adf2;};'use strict';var fs=require('fs');var util=require(_0xe02f('0x0'));var path=require(_0xe02f('0x1'));var _=require(_0xe02f('0x2'));var moment=require(_0xe02f('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xe02f('0x4'));var BPromise=require(_0xe02f('0x5'));var logger=require(_0xe02f('0x6'))(_0xe02f('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xe02f('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xe02f('0x9')][_0xe02f('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e665a,_0x36a620){return function(){logger[_0xe02f('0xb')](_0xe02f('0xc'),_0x5e665a[_0xe02f('0xd')]);var _0x593f91=!![];var _0x7110e7={'tls':{'rejectUnauthorized':![]}};if(_0x5e665a['MailAccount'][_0xe02f('0xe')]['service']){_0x7110e7['service']=_0x5e665a['MailAccount'][_0xe02f('0xe')]['service'];}else{_0x7110e7[_0xe02f('0xf')]=_0x5e665a['MailAccount'][_0xe02f('0xe')]['host'];_0x7110e7[_0xe02f('0x10')]=_0x5e665a[_0xe02f('0x11')][_0xe02f('0xe')][_0xe02f('0x10')];_0x7110e7['secure']=_0x5e665a[_0xe02f('0x11')][_0xe02f('0xe')][_0xe02f('0x12')];}if(_0x5e665a[_0xe02f('0x11')]['Smtp'][_0xe02f('0x13')]){_0x7110e7[_0xe02f('0x14')]={'user':_0x5e665a['MailAccount'][_0xe02f('0xe')]['user'],'pass':_0x5e665a['MailAccount']['Smtp'][_0xe02f('0x15')]};}var _0x2d4927={'account':_0x7110e7,'message':{'from':util['format'](_0xe02f('0x16'),_0x5e665a['MailAccount'][_0xe02f('0x17')],_0x5e665a[_0xe02f('0x11')][_0xe02f('0xd')]||_0x5e665a['MailAccount'][_0xe02f('0xe')]['user']),'to':_0x5e665a[_0xe02f('0xd')],'cc':_0x5e665a['cc'],'bcc':_0x5e665a['bcc'],'subject':util[_0xe02f('0x18')](_0xe02f('0x19'),_0x36a620[_0xe02f('0x17')],_0x5e665a[_0xe02f('0x1a')],_0x5e665a['subtractUnit'])}};var _0x69b509=path[_0xe02f('0x1b')](__dirname,_0xe02f('0x1c'));var _0x4b01b1=_0x36a620[_0xe02f('0x1d')];var _0x20c8bf=util[_0xe02f('0x18')](_0xe02f('0x1e'),path[_0xe02f('0x1f')](_0x36a620['savename'],path[_0xe02f('0x20')](_0x36a620[_0xe02f('0x1d')])),_0xe02f('0x21'));var _0x1d9a92=path[_0xe02f('0x1b')](_0x69b509,_0x4b01b1);var _0x3afa87=path[_0xe02f('0x1b')](_0x69b509,_0x20c8bf);if(fs[_0xe02f('0x22')](_0x1d9a92)){_0x36a620[_0xe02f('0x23')]=_0xe02f('0x24');_0x2d4927['message'][_0xe02f('0x25')]=[{'filename':_0x4b01b1,'path':_0x1d9a92}];_0x2d4927[_0xe02f('0x26')]['text']=util['format'](_0xe02f('0x27'),JSON[_0xe02f('0x28')](_0x36a620,null,0x2));}else if(fs['existsSync'](_0x3afa87)){_0x36a620[_0xe02f('0x23')]=_0xe02f('0x24');_0x2d4927[_0xe02f('0x26')][_0xe02f('0x25')]=[{'filename':_0x20c8bf,'path':_0x3afa87}];}else{_0x2d4927[_0xe02f('0x26')][_0xe02f('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5e665a['sendIfEmpty']){_0x593f91=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x593f91){return client[_0xe02f('0x2a')]('SendMail',_0x2d4927)['then'](function(_0x4c2873){if(_0x4c2873[_0xe02f('0x2b')]){return logger[_0xe02f('0x2b')](_0xe02f('0x2c'),JSON[_0xe02f('0x28')](_0x4c2873));}return logger[_0xe02f('0xb')](_0xe02f('0x2d'));})['catch'](function(_0x2c9a40){return logger[_0xe02f('0x2b')](_0xe02f('0x2c'),JSON[_0xe02f('0x28')](_0x2c9a40));});}};}function handleError(){return function(_0x399f34){return logger[_0xe02f('0x2b')](JSON[_0xe02f('0x28')](_0x399f34));};}function handleResult(_0xd3c3c8){return function(_0x4e229a){logger['info'](_0xe02f('0x2e'),JSON[_0xe02f('0x28')](_0x4e229a));if(_0xd3c3c8['MailAccount']&&_0xd3c3c8['MailAccount']['Smtp']&&!_[_0xe02f('0x2f')](_0xd3c3c8[_0xe02f('0xd')])){setTimeout(handleSendEmail(_0xd3c3c8,_0x4e229a),0x3c*0x3e8);}};}function handleJob(_0x305240){return function(){try{if(_[_0xe02f('0x2f')](_0x305240[_0xe02f('0x1a')])){return logger[_0xe02f('0xb')](_0xe02f('0x30'));}if(_['isNil'](_0x305240[_0xe02f('0x31')])){return logger[_0xe02f('0xb')](_0xe02f('0x32'));}var _0x3dc2f1={'startDate':moment()['subtract'](_0x305240[_0xe02f('0x1a')],_0x305240['subtractUnit'])[_0xe02f('0x18')](_0xe02f('0x33')),'endDate':moment()[_0xe02f('0x18')](_0xe02f('0x33')),'type':_0xe02f('0x34'),'output':_0x305240[_0xe02f('0x35')],'name':_0x305240[_0xe02f('0x17')]};if(!_[_0xe02f('0x2f')](_0x305240[_0xe02f('0x36')])){logger[_0xe02f('0xb')](_0xe02f('0x37'),_0x305240[_0xe02f('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x305240[_0xe02f('0x36')]},_0x3dc2f1)[_0xe02f('0x38')](handleResult(_0x305240))[_0xe02f('0x39')](handleError());}if(!_[_0xe02f('0x2f')](_0x305240[_0xe02f('0x3a')])){logger[_0xe02f('0xb')](_0xe02f('0x3b'),_0x305240[_0xe02f('0x3a')]);return analyticCustomReportController[_0xe02f('0x3c')]({'id':_0x305240[_0xe02f('0x3a')]},_0x3dc2f1)[_0xe02f('0x38')](handleResult(_0x305240))[_0xe02f('0x39')](handleError());}}catch(_0xdbda7c){logger[_0xe02f('0x2b')](JSON[_0xe02f('0x28')](_0xdbda7c));}return logger[_0xe02f('0xb')]('no\x20report\x20id');};}function getJobs(_0x57a3b8){var _0x236ed2={};if(_0x57a3b8){_0x236ed2['id']=_0x57a3b8;}return db['Schedule'][_0xe02f('0x3d')]({'where':_0x236ed2,'include':[{'model':db[_0xe02f('0x11')],'attributes':['id',_0xe02f('0x17'),_0xe02f('0xd')],'include':[{'model':db[_0xe02f('0x3e')],'as':'Smtp'}]}]})[_0xe02f('0x38')](function(_0xf39a03){var _0x49d861=_[_0xe02f('0x3f')](manager[_0xe02f('0x40')]);var _0x40539f=_[_0xe02f('0x41')](_0xf39a03,function(_0x514a06){return _0x514a06['id']['toString']();});var _0x33a87d=_[_0xe02f('0x42')](_0xf39a03,function(_0x3d7437){return _0x3d7437['id'][_0xe02f('0x43')]();});var _0x2218da=_0x57a3b8?_0x40539f:_[_0xe02f('0x44')](_0x40539f,_0x49d861);var _0x42305a=_[_0xe02f('0x45')](_0x40539f,_0x49d861);var _0x277fcd=_[_0xe02f('0x44')](_0x49d861,_0x40539f);var _0x438b24;var _0x31c2cb;for(_0x438b24=0x0;_0x438b24<_0x277fcd[_0xe02f('0x46')]&&!_0x57a3b8;_0x438b24+=0x1){_0x31c2cb=_0x277fcd[_0x438b24][_0xe02f('0x43')]();if(manager[_0xe02f('0x47')](_0x31c2cb)){manager[_0xe02f('0x48')](_0x31c2cb);manager[_0xe02f('0x49')](_0x31c2cb);logger[_0xe02f('0xb')]('delete\x20cron',_0x31c2cb);}}logger[_0xe02f('0xb')](_0xe02f('0x4a'),JSON['stringify'](_0x2218da));for(_0x438b24=0x0;_0x438b24<_0x2218da[_0xe02f('0x46')];_0x438b24+=0x1){_0x31c2cb=_0x2218da[_0x438b24][_0xe02f('0x43')]();logger[_0xe02f('0xb')](_0xe02f('0x4b'),_0x31c2cb);if(_0x57a3b8){logger[_0xe02f('0xb')](_0xe02f('0x4c'),_0x57a3b8);logger[_0xe02f('0xb')](JSON['stringify'](_0x33a87d[_0x31c2cb]));BPromise[_0xe02f('0x4d')]()['then'](handleJob(_0x33a87d[_0x31c2cb]));logger[_0xe02f('0xb')](_0xe02f('0x4e'),_0x33a87d[_0x31c2cb][_0xe02f('0x17')],_0x33a87d[_0x31c2cb]['cron']);}else if(_0x33a87d[_0x31c2cb][_0xe02f('0x4f')]&&_0x33a87d[_0x31c2cb][_0xe02f('0x50')]&&moment()[_0xe02f('0x51')](_0x33a87d[_0x31c2cb][_0xe02f('0x52')],_0x33a87d[_0x31c2cb][_0xe02f('0x53')])){manager['add'](_0x31c2cb,_0x33a87d[_0x31c2cb]['cron'],handleJob(_0x33a87d[_0x31c2cb]));manager[_0xe02f('0x54')](_0x31c2cb);logger[_0xe02f('0xb')]('add\x20cron',_0x33a87d[_0x31c2cb][_0xe02f('0x17')],_0x33a87d[_0x31c2cb]['cron']);}else if(manager['exists'](_0x31c2cb)){manager['stop'](_0x31c2cb);manager[_0xe02f('0x49')](_0x31c2cb);logger['info'](_0xe02f('0x55'),_0x33a87d[_0x31c2cb]['name'],_0x33a87d[_0x31c2cb][_0xe02f('0x4f')]);}}for(_0x438b24=0x0,_0x31c2cb;_0x438b24<_0x42305a[_0xe02f('0x46')]&&!_0x57a3b8;_0x438b24+=0x1){_0x31c2cb=_0x42305a[_0x438b24][_0xe02f('0x43')]();if(manager[_0xe02f('0x47')](_0x31c2cb)){if(_0x33a87d[_0x31c2cb]['cron']&&_0x33a87d[_0x31c2cb][_0xe02f('0x50')]&&moment()[_0xe02f('0x51')](_0x33a87d[_0x31c2cb][_0xe02f('0x52')],_0x33a87d[_0x31c2cb]['endAt'])){manager[_0xe02f('0x56')](_0x31c2cb,_0x33a87d[_0x31c2cb][_0xe02f('0x4f')],handleJob(_0x33a87d[_0x31c2cb]));logger[_0xe02f('0xb')](_0xe02f('0x57'),_0x33a87d[_0x31c2cb][_0xe02f('0x17')],_0x33a87d[_0x31c2cb][_0xe02f('0x4f')]);}else{manager[_0xe02f('0x48')](_0x31c2cb);manager[_0xe02f('0x49')](_0x31c2cb);logger[_0xe02f('0xb')](_0xe02f('0x55'),_0x33a87d[_0x31c2cb]['name'],_0x33a87d[_0x31c2cb][_0xe02f('0x4f')]);}}}})[_0xe02f('0x39')](function(_0x152e03){logger['error'](JSON[_0xe02f('0x28')](_0x152e03));});}exports[_0xe02f('0x58')]=function(_0x2210fa){return getJobs(_0x2210fa);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index e93a8ac..052d3d1 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 _0xa0e0=['SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','findOne','Neutral','catch','name','SequelizeValidationError','error','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment'];(function(_0x1a5687,_0xc2188f){var _0x257d5c=function(_0x4a1783){while(--_0x4a1783){_0x1a5687['push'](_0x1a5687['shift']());}};_0x257d5c(++_0xc2188f);}(_0xa0e0,0xab));var _0x0a0e=function(_0x18d1a4,_0x37bcd7){_0x18d1a4=_0x18d1a4-0x0;var _0x4217dc=_0xa0e0[_0x18d1a4];return _0x4217dc;};var _=require(_0x0a0e('0x0'));var AWS=require(_0x0a0e('0x1'));var rp=require(_0x0a0e('0x2'));var util=require(_0x0a0e('0x3'));var BPromise=require(_0x0a0e('0x4'));var db=require(_0x0a0e('0x5'))['db'];var logger=require(_0x0a0e('0x6'))(_0x0a0e('0x7'));function getTranscriptionJob(_0x4ff127,_0x2ed85d,_0x3e1d2d,_0x1d2552){return new Promise(function(_0x5b7898,_0x27260c){var _0x2cf34e=new AWS[(_0x0a0e('0x8'))]({'accessKeyId':_0x2ed85d,'secretAccessKey':_0x4ff127,'region':_0x3e1d2d});_0x2cf34e[_0x0a0e('0x9')]({'TranscriptionJobName':_0x1d2552},function(_0x2da2ba,_0x43d97c){if(_0x2da2ba){return _0x27260c(_0x2da2ba);}else{return _0x5b7898(_0x43d97c);}});});}function sentiment(_0x1882c5,_0x215891,_0x53d006,_0x5304c6,_0xf83a70){return new Promise(function(_0x39c576,_0x408892){var _0x11632e=new AWS[(_0x0a0e('0xa'))]({'accessKeyId':_0x215891,'secretAccessKey':_0x1882c5,'region':_0x53d006});_0x11632e[_0x0a0e('0xb')]({'Text':_0x5304c6,'LanguageCode':_0xf83a70[_0x0a0e('0xc')](0x0,0x2)},function(_0x4e85dd,_0x9bdf91){if(_0x4e85dd){return _0x408892(_0x4e85dd);}else{return _0x39c576(_0x9bdf91);}});});}function checkTranscribeJob(_0x73c32a,_0xb481b9,_0x4453af){var _0x4a5c26;return new BPromise(function(_0x2fb42d,_0x5d08c0){logger[_0x0a0e('0xd')](util[_0x0a0e('0xe')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x73c32a['id'],_0x73c32a[_0x0a0e('0xf')]));return getTranscriptionJob(_0x4453af[_0x0a0e('0x10')],_0x4453af[_0x0a0e('0x11')],_0xb481b9[_0x0a0e('0x12')],_0x73c32a[_0x0a0e('0xf')])[_0x0a0e('0x13')](function(_0x504595){logger[_0x0a0e('0xd')](util[_0x0a0e('0xe')](_0x0a0e('0x14'),_0x73c32a['id'],_0x73c32a[_0x0a0e('0xf')],_0x504595[_0x0a0e('0x15')][_0x0a0e('0x16')]));if(!_0x73c32a[_0x0a0e('0x17')]){switch(_0x504595['TranscriptionJob'][_0x0a0e('0x16')]){case _0x0a0e('0x18'):var _0x7dfb={'transcribeStatus':_0x504595[_0x0a0e('0x15')][_0x0a0e('0x16')],'fileUri':_0x504595[_0x0a0e('0x15')]['Transcript'][_0x0a0e('0x19')]};logger['info'](util[_0x0a0e('0xe')](_0x0a0e('0x1a'),_0x73c32a['id']));return rp({'uri':_0x504595[_0x0a0e('0x15')]['Transcript'][_0x0a0e('0x19')],'json':!![]})['then'](function(_0x12af8c){logger[_0x0a0e('0xd')](util[_0x0a0e('0xe')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x73c32a['id']));if(_0x12af8c&&_0x12af8c[_0x0a0e('0x1b')]&&_0x12af8c[_0x0a0e('0x1b')][_0x0a0e('0x1c')]&&_0x12af8c['results'][_0x0a0e('0x1c')][_0x0a0e('0x1d')]){_0x7dfb[_0x0a0e('0x17')]='';for(var _0x7a5367=0x0;_0x7a5367<_0x12af8c[_0x0a0e('0x1b')]['transcripts'][_0x0a0e('0x1d')];_0x7a5367++){_0x7dfb[_0x0a0e('0x17')]+=_0x12af8c[_0x0a0e('0x1b')][_0x0a0e('0x1c')][_0x7a5367][_0x0a0e('0x1e')]+'';}}return _0x73c32a[_0x0a0e('0x1f')](_0x7dfb);})[_0x0a0e('0x13')](function(){logger[_0x0a0e('0xd')](util[_0x0a0e('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x73c32a['id']));if(!_0x73c32a[_0x0a0e('0x20')]){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x23'));}if(!_0xb481b9[_0x0a0e('0x24')]||!_0xb481b9[_0x0a0e('0x25')]||!_0xb481b9[_0x0a0e('0x26')]||!_0xb481b9[_0x0a0e('0x27')]||!_0xb481b9['bucket']){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x28'));}if(!_0x7dfb[_0x0a0e('0x17')]){throw new Error(_0x0a0e('0x29'));}if(_0xb481b9[_0x0a0e('0x25')]===_0x4453af['id']){return _0x4453af;}else{return db[_0x0a0e('0x2a')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x554c6c){if(!_0x554c6c){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x2b'));}if(!_0x554c6c[_0x0a0e('0x10')]||!_0x554c6c[_0x0a0e('0x11')]){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x2c'));}_0x4a5c26=_0x554c6c;logger['info'](util[_0x0a0e('0xe')](_0x0a0e('0x2d'),_0x73c32a['id']));return sentiment(_0x4a5c26[_0x0a0e('0x10')],_0x4a5c26['data2'],_0xb481b9[_0x0a0e('0x26')],_0x7dfb[_0x0a0e('0x17')],_0xb481b9['language']);})[_0x0a0e('0x13')](function(_0x37fb58){logger['info'](util[_0x0a0e('0xe')](_0x0a0e('0x2e'),_0x73c32a['id']));return _0x73c32a[_0x0a0e('0x1f')]({'sentiment':_0x37fb58[_0x0a0e('0x2f')],'sPositive':_0x37fb58[_0x0a0e('0x30')][_0x0a0e('0x31')],'sNegative':_0x37fb58[_0x0a0e('0x30')][_0x0a0e('0x32')],'sMixed':_0x37fb58['SentimentScore'][_0x0a0e('0x33')],'sNeutral':_0x37fb58[_0x0a0e('0x30')]['Neutral']});})[_0x0a0e('0x13')](function(){logger[_0x0a0e('0xd')](util['format'](_0x0a0e('0x34'),_0x73c32a['id']));_0x2fb42d();});case _0x0a0e('0x35'):return _0x73c32a[_0x0a0e('0x1f')]({'transcribeStatus':_0x0a0e('0x35'),'failureReason':_0x504595[_0x0a0e('0x15')][_0x0a0e('0x36')]})[_0x0a0e('0x13')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x73c32a['id']));_0x2fb42d();});default:logger['info'](util[_0x0a0e('0xe')](_0x0a0e('0x37'),_0x73c32a['id']));break;}}else{return BPromise['resolve']()[_0x0a0e('0x13')](function(){if(!_0x73c32a[_0x0a0e('0x20')]){throw new db[(_0x0a0e('0x21'))]['ValidationError'](_0x0a0e('0x23'));}if(!_0xb481b9[_0x0a0e('0x24')]||!_0xb481b9[_0x0a0e('0x25')]||!_0xb481b9[_0x0a0e('0x26')]||!_0xb481b9[_0x0a0e('0x27')]||!_0xb481b9[_0x0a0e('0x38')]){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x28'));}if(!_0x73c32a[_0x0a0e('0x17')]){throw new Error(_0x0a0e('0x29'));}if(_0xb481b9[_0x0a0e('0x25')]===_0x4453af['id']){return _0x4453af;}else{return db[_0x0a0e('0x2a')][_0x0a0e('0x39')]({'where':{'id':_settings[_0x0a0e('0x25')]}});}})[_0x0a0e('0x13')](function(_0x15ff5c){if(!_0x15ff5c){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x2b'));}if(!_0x15ff5c['data1']||!_0x15ff5c['data2']){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x4a5c26=_0x15ff5c;logger[_0x0a0e('0xd')](util[_0x0a0e('0xe')](_0x0a0e('0x2d'),_0x73c32a['id']));return sentiment(_0x4a5c26[_0x0a0e('0x10')],_0x4a5c26[_0x0a0e('0x11')],_0xb481b9['sentimentRegion'],_0x73c32a[_0x0a0e('0x17')],_0xb481b9['language']);})['then'](function(_0x4dc20b){logger[_0x0a0e('0xd')](util[_0x0a0e('0xe')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x73c32a['id']));return _0x73c32a[_0x0a0e('0x1f')]({'sentiment':_0x4dc20b[_0x0a0e('0x2f')],'sPositive':_0x4dc20b['SentimentScore'][_0x0a0e('0x31')],'sNegative':_0x4dc20b[_0x0a0e('0x30')][_0x0a0e('0x32')],'sMixed':_0x4dc20b['SentimentScore'][_0x0a0e('0x33')],'sNeutral':_0x4dc20b['SentimentScore'][_0x0a0e('0x3a')],'transcribeStatus':_0x0a0e('0x18')});})['then'](function(){logger[_0x0a0e('0xd')](util['format'](_0x0a0e('0x34'),_0x73c32a['id']));_0x2fb42d();});}})[_0x0a0e('0x3b')](function(_0x334c30){if(_0x334c30){if(!_0x334c30[_0x0a0e('0x3c')]||_0x334c30[_0x0a0e('0x3c')]!==_0x0a0e('0x3d')){logger[_0x0a0e('0x3e')](util[_0x0a0e('0xe')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x73c32a['id']),util[_0x0a0e('0x3f')](_0x334c30,{'showHidden':![],'depth':null}));}}_0x2fb42d();});});}function checkTranscribe(){var _0x327116;var _0x8a499f;var _0x130899;return db['VoiceRecording'][_0x0a0e('0x40')]({'where':{'transcribeStatus':_0x0a0e('0x41')}})[_0x0a0e('0x13')](function(_0x4cf368){if(!_0x4cf368||!_0x4cf368[_0x0a0e('0x1d')]){throw new db['Sequelize'][(_0x0a0e('0x22'))](_0x0a0e('0x42'));}_0x327116=_0x4cf368;return db['Setting'][_0x0a0e('0x39')]({'where':{'id':0x1}});})[_0x0a0e('0x13')](function(_0x499037){if(!_0x499037){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x43'));}_0x8a499f=_0x499037;if(!_0x8a499f['transcribe']||!_0x8a499f[_0x0a0e('0x44')]||!_0x8a499f[_0x0a0e('0x12')]||!_0x8a499f['language']||!_0x8a499f[_0x0a0e('0x38')]){throw new db[(_0x0a0e('0x21'))][(_0x0a0e('0x22'))](_0x0a0e('0x45'));}return db[_0x0a0e('0x2a')][_0x0a0e('0x39')]({'where':{'id':_0x8a499f[_0x0a0e('0x44')]}});})[_0x0a0e('0x13')](function(_0x21d864){if(!_0x21d864){throw new db['Sequelize']['ValidationError'](_0x0a0e('0x2b'));}if(!_0x21d864[_0x0a0e('0x10')]||!_0x21d864[_0x0a0e('0x11')]){throw new db['Sequelize'][(_0x0a0e('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x130899=_0x21d864;var _0x154148=[];_0x327116[_0x0a0e('0x46')](function(_0x36efd9){_0x154148['push'](checkTranscribeJob(_0x36efd9,_0x8a499f,_0x130899));});return BPromise[_0x0a0e('0x47')](_0x154148);})[_0x0a0e('0x3b')](function(_0x59f223){if(_0x59f223){if(!_0x59f223[_0x0a0e('0x3c')]||_0x59f223['name']!=='SequelizeValidationError'){logger[_0x0a0e('0x3e')](util[_0x0a0e('0x3f')](_0x59f223,{'showHidden':![],'depth':null}));}}});}exports[_0x0a0e('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2ff8=['Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','data2'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0x2ff8,0x69));var _0x82ff=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2ff8[_0x29b609];return _0x54c952;};var _=require(_0x82ff('0x0'));var AWS=require(_0x82ff('0x1'));var rp=require(_0x82ff('0x2'));var util=require(_0x82ff('0x3'));var BPromise=require('bluebird');var db=require(_0x82ff('0x4'))['db'];var logger=require(_0x82ff('0x5'))(_0x82ff('0x6'));function getTranscriptionJob(_0x3c1055,_0x1ffdd7,_0x43a7b6,_0x5dad32){return new Promise(function(_0x428fbe,_0x4da31a){var _0x53efcd=new AWS[(_0x82ff('0x7'))]({'accessKeyId':_0x1ffdd7,'secretAccessKey':_0x3c1055,'region':_0x43a7b6});_0x53efcd[_0x82ff('0x8')]({'TranscriptionJobName':_0x5dad32},function(_0x4502e6,_0x27e6d4){if(_0x4502e6){return _0x4da31a(_0x4502e6);}else{return _0x428fbe(_0x27e6d4);}});});}function sentiment(_0x3e13cf,_0x537bee,_0x4007df,_0x200666,_0x48c1f2){return new Promise(function(_0x7a7fb5,_0x120d62){var _0x5f1710=new AWS[(_0x82ff('0x9'))]({'accessKeyId':_0x537bee,'secretAccessKey':_0x3e13cf,'region':_0x4007df});_0x5f1710[_0x82ff('0xa')]({'Text':_0x200666,'LanguageCode':_0x48c1f2[_0x82ff('0xb')](0x0,0x2)},function(_0x427b35,_0x144f92){if(_0x427b35){return _0x120d62(_0x427b35);}else{return _0x7a7fb5(_0x144f92);}});});}function checkTranscribeJob(_0x4580f8,_0x2c1ae9,_0x59d494){var _0x2539ad;return new BPromise(function(_0x3d63cf,_0x14604f){logger[_0x82ff('0xc')](util[_0x82ff('0xd')](_0x82ff('0xe'),_0x4580f8['id'],_0x4580f8[_0x82ff('0xf')]));return getTranscriptionJob(_0x59d494['data1'],_0x59d494['data2'],_0x2c1ae9[_0x82ff('0x10')],_0x4580f8[_0x82ff('0xf')])['then'](function(_0x404c9c){logger[_0x82ff('0xc')](util[_0x82ff('0xd')](_0x82ff('0x11'),_0x4580f8['id'],_0x4580f8[_0x82ff('0xf')],_0x404c9c[_0x82ff('0x12')][_0x82ff('0x13')]));if(!_0x4580f8[_0x82ff('0x14')]){switch(_0x404c9c[_0x82ff('0x12')][_0x82ff('0x13')]){case _0x82ff('0x15'):var _0x129689={'transcribeStatus':_0x404c9c['TranscriptionJob'][_0x82ff('0x13')],'fileUri':_0x404c9c['TranscriptionJob'][_0x82ff('0x16')][_0x82ff('0x17')]};logger['info'](util[_0x82ff('0xd')](_0x82ff('0x18'),_0x4580f8['id']));return rp({'uri':_0x404c9c['TranscriptionJob'][_0x82ff('0x16')]['TranscriptFileUri'],'json':!![]})[_0x82ff('0x19')](function(_0x43dec5){logger[_0x82ff('0xc')](util[_0x82ff('0xd')](_0x82ff('0x1a'),_0x4580f8['id']));if(_0x43dec5&&_0x43dec5['results']&&_0x43dec5[_0x82ff('0x1b')][_0x82ff('0x1c')]&&_0x43dec5[_0x82ff('0x1b')][_0x82ff('0x1c')][_0x82ff('0x1d')]){_0x129689[_0x82ff('0x14')]='';for(var _0x2cfbc8=0x0;_0x2cfbc8<_0x43dec5[_0x82ff('0x1b')][_0x82ff('0x1c')][_0x82ff('0x1d')];_0x2cfbc8++){_0x129689[_0x82ff('0x14')]+=_0x43dec5['results'][_0x82ff('0x1c')][_0x2cfbc8]['transcript']+'';}}return _0x4580f8[_0x82ff('0x1e')](_0x129689);})[_0x82ff('0x19')](function(){logger['info'](util[_0x82ff('0xd')](_0x82ff('0x1f'),_0x4580f8['id']));if(!_0x4580f8[_0x82ff('0x20')]){throw new db['Sequelize'][(_0x82ff('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2c1ae9[_0x82ff('0x22')]||!_0x2c1ae9[_0x82ff('0x23')]||!_0x2c1ae9[_0x82ff('0x24')]||!_0x2c1ae9[_0x82ff('0x25')]||!_0x2c1ae9[_0x82ff('0x26')]){throw new db[(_0x82ff('0x27'))][(_0x82ff('0x21'))](_0x82ff('0x28'));}if(!_0x129689[_0x82ff('0x14')]){throw new Error(_0x82ff('0x29'));}if(_0x2c1ae9[_0x82ff('0x23')]===_0x59d494['id']){return _0x59d494;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x82ff('0x23')]}});}})[_0x82ff('0x19')](function(_0x2b51f2){if(!_0x2b51f2){throw new db[(_0x82ff('0x27'))][(_0x82ff('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2b51f2['data1']||!_0x2b51f2['data2']){throw new db['Sequelize'][(_0x82ff('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x2539ad=_0x2b51f2;logger[_0x82ff('0xc')](util['format'](_0x82ff('0x2a'),_0x4580f8['id']));return sentiment(_0x2539ad[_0x82ff('0x2b')],_0x2539ad[_0x82ff('0x2c')],_0x2c1ae9['sentimentRegion'],_0x129689[_0x82ff('0x14')],_0x2c1ae9['language']);})[_0x82ff('0x19')](function(_0xe48612){logger[_0x82ff('0xc')](util[_0x82ff('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4580f8['id']));return _0x4580f8[_0x82ff('0x1e')]({'sentiment':_0xe48612[_0x82ff('0x2d')],'sPositive':_0xe48612[_0x82ff('0x2e')]['Positive'],'sNegative':_0xe48612[_0x82ff('0x2e')][_0x82ff('0x2f')],'sMixed':_0xe48612['SentimentScore']['Mixed'],'sNeutral':_0xe48612['SentimentScore'][_0x82ff('0x30')]});})[_0x82ff('0x19')](function(){logger['info'](util['format'](_0x82ff('0x1f'),_0x4580f8['id']));_0x3d63cf();});case _0x82ff('0x31'):return _0x4580f8[_0x82ff('0x1e')]({'transcribeStatus':_0x82ff('0x31'),'failureReason':_0x404c9c[_0x82ff('0x12')][_0x82ff('0x32')]})[_0x82ff('0x19')](function(){logger[_0x82ff('0xc')](util[_0x82ff('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4580f8['id']));_0x3d63cf();});default:logger[_0x82ff('0xc')](util[_0x82ff('0xd')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4580f8['id']));break;}}else{return BPromise[_0x82ff('0x33')]()[_0x82ff('0x19')](function(){if(!_0x4580f8[_0x82ff('0x20')]){throw new db[(_0x82ff('0x27'))]['ValidationError'](_0x82ff('0x34'));}if(!_0x2c1ae9['sentiment']||!_0x2c1ae9[_0x82ff('0x23')]||!_0x2c1ae9[_0x82ff('0x24')]||!_0x2c1ae9['language']||!_0x2c1ae9[_0x82ff('0x26')]){throw new db[(_0x82ff('0x27'))]['ValidationError'](_0x82ff('0x28'));}if(!_0x4580f8[_0x82ff('0x14')]){throw new Error(_0x82ff('0x29'));}if(_0x2c1ae9[_0x82ff('0x23')]===_0x59d494['id']){return _0x59d494;}else{return db[_0x82ff('0x35')][_0x82ff('0x36')]({'where':{'id':_settings[_0x82ff('0x23')]}});}})[_0x82ff('0x19')](function(_0x3c7b9f){if(!_0x3c7b9f){throw new db[(_0x82ff('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3c7b9f[_0x82ff('0x2b')]||!_0x3c7b9f[_0x82ff('0x2c')]){throw new db['Sequelize'][(_0x82ff('0x21'))](_0x82ff('0x37'));}_0x2539ad=_0x3c7b9f;logger[_0x82ff('0xc')](util[_0x82ff('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4580f8['id']));return sentiment(_0x2539ad[_0x82ff('0x2b')],_0x2539ad[_0x82ff('0x2c')],_0x2c1ae9[_0x82ff('0x24')],_0x4580f8['fileText'],_0x2c1ae9['language']);})[_0x82ff('0x19')](function(_0x26c0b6){logger[_0x82ff('0xc')](util[_0x82ff('0xd')](_0x82ff('0x38'),_0x4580f8['id']));return _0x4580f8[_0x82ff('0x1e')]({'sentiment':_0x26c0b6[_0x82ff('0x2d')],'sPositive':_0x26c0b6['SentimentScore'][_0x82ff('0x39')],'sNegative':_0x26c0b6[_0x82ff('0x2e')][_0x82ff('0x2f')],'sMixed':_0x26c0b6['SentimentScore']['Mixed'],'sNeutral':_0x26c0b6['SentimentScore'][_0x82ff('0x30')],'transcribeStatus':_0x82ff('0x15')});})[_0x82ff('0x19')](function(){logger[_0x82ff('0xc')](util[_0x82ff('0xd')](_0x82ff('0x1f'),_0x4580f8['id']));_0x3d63cf();});}})[_0x82ff('0x3a')](function(_0x46fb16){if(_0x46fb16){if(!_0x46fb16[_0x82ff('0x3b')]||_0x46fb16[_0x82ff('0x3b')]!==_0x82ff('0x3c')){logger['error'](util['format'](_0x82ff('0x3d'),_0x4580f8['id']),util[_0x82ff('0x3e')](_0x46fb16,{'showHidden':![],'depth':null}));}}_0x3d63cf();});});}function checkTranscribe(){var _0x561b44;var _0x5f00bf;var _0x110cbe;return db[_0x82ff('0x3f')][_0x82ff('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x82ff('0x19')](function(_0x27c4ae){if(!_0x27c4ae||!_0x27c4ae[_0x82ff('0x1d')]){throw new db[(_0x82ff('0x27'))][(_0x82ff('0x21'))](_0x82ff('0x41'));}_0x561b44=_0x27c4ae;return db['Setting'][_0x82ff('0x36')]({'where':{'id':0x1}});})['then'](function(_0x4c2e9c){if(!_0x4c2e9c){throw new db[(_0x82ff('0x27'))]['ValidationError'](_0x82ff('0x42'));}_0x5f00bf=_0x4c2e9c;if(!_0x5f00bf['transcribe']||!_0x5f00bf[_0x82ff('0x43')]||!_0x5f00bf[_0x82ff('0x10')]||!_0x5f00bf[_0x82ff('0x25')]||!_0x5f00bf[_0x82ff('0x26')]){throw new db['Sequelize'][(_0x82ff('0x21'))](_0x82ff('0x44'));}return db[_0x82ff('0x35')]['findOne']({'where':{'id':_0x5f00bf[_0x82ff('0x43')]}});})[_0x82ff('0x19')](function(_0x12cc8e){if(!_0x12cc8e){throw new db[(_0x82ff('0x27'))][(_0x82ff('0x21'))](_0x82ff('0x45'));}if(!_0x12cc8e[_0x82ff('0x2b')]||!_0x12cc8e[_0x82ff('0x2c')]){throw new db[(_0x82ff('0x27'))][(_0x82ff('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x110cbe=_0x12cc8e;var _0x47c6cd=[];_0x561b44[_0x82ff('0x46')](function(_0x4d32a6){_0x47c6cd[_0x82ff('0x47')](checkTranscribeJob(_0x4d32a6,_0x5f00bf,_0x110cbe));});return BPromise[_0x82ff('0x48')](_0x47c6cd);})[_0x82ff('0x3a')](function(_0x40df31){if(_0x40df31){if(!_0x40df31['name']||_0x40df31['name']!==_0x82ff('0x3c')){logger[_0x82ff('0x49')](util[_0x82ff('0x3e')](_0x40df31,{'showHidden':![],'depth':null}));}}});}exports[_0x82ff('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ae58997..e466566 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 _0x109d=['info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','findAll','subtract','hours','then','length','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x109d,0x15e));var _0xd109=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x109d[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var moment=require(_0xd109('0x0'));var Redis=require('ioredis');var util=require(_0xd109('0x1'));var config=require('../../config/environment');var db=require(_0xd109('0x2'))['db'];var logger=require(_0xd109('0x3'))(_0xd109('0x4'));config[_0xd109('0x5')]=_['defaults'](config[_0xd109('0x5')],{'host':_0xd109('0x6'),'port':0x18eb});var io=require(_0xd109('0x7'))(new Redis(config[_0xd109('0x5')]));function closeInteractions(){var _0xcb9063=[];return db['WhatsappInteraction'][_0xd109('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd109('0x9')](0x18,_0xd109('0xa'))}}})[_0xd109('0xb')](function(_0x129992){if(_0x129992&&_0x129992[_0xd109('0xc')]){_0xcb9063=_[_0xd109('0xd')](_0x129992||[],'id');logger[_0xd109('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xcb9063[_0xd109('0xf')]());return db['WhatsappInteraction'][_0xd109('0x10')]({'closeReason':_0xd109('0x11'),'disposition':_0xd109('0x12'),'closed':!![],'closedAt':moment()[_0xd109('0x13')](_0xd109('0x14'))},{'where':{'id':_0xcb9063}});}})[_0xd109('0xb')](function(){if(_0xcb9063&&_0xcb9063[_0xd109('0xc')]){logger[_0xd109('0xe')](_0xd109('0x15'),_0xcb9063[_0xd109('0xf')]());for(var _0xb5dfe5=0x0;_0xb5dfe5<_0xcb9063[_0xd109('0xc')];_0xb5dfe5++){io[_0xd109('0x16')](_0xd109('0x17'),{'id':_0xcb9063[_0xb5dfe5],'closed':!![]});}}})['catch'](function(_0x402cd1){logger['error'](_0xd109('0x18'),_0x402cd1?util['inspect'](_0x402cd1,{'showHidden':![],'depth':null}):'');});}exports[_0xd109('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x26c4=['findAll','subtract','hours','then','map','info','join','WhatsappInteraction','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','localhost','redis'];(function(_0x5ad144,_0x4b1087){var _0x48f80a=function(_0x48113c){while(--_0x48113c){_0x5ad144['push'](_0x5ad144['shift']());}};_0x48f80a(++_0x4b1087);}(_0x26c4,0x82));var _0x426c=function(_0x392489,_0x53cd8e){_0x392489=_0x392489-0x0;var _0x476834=_0x26c4[_0x392489];return _0x476834;};'use strict';var _=require(_0x426c('0x0'));var moment=require(_0x426c('0x1'));var Redis=require(_0x426c('0x2'));var util=require(_0x426c('0x3'));var config=require(_0x426c('0x4'));var db=require(_0x426c('0x5'))['db'];var logger=require(_0x426c('0x6'))(_0x426c('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x426c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x426c('0x9')]));function closeInteractions(){var _0x419845=[];return db['WhatsappInteraction'][_0x426c('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x426c('0xb')](0x18,_0x426c('0xc'))}}})[_0x426c('0xd')](function(_0x8c85b7){if(_0x8c85b7&&_0x8c85b7['length']){_0x419845=_[_0x426c('0xe')](_0x8c85b7||[],'id');logger[_0x426c('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x419845[_0x426c('0x10')]());return db[_0x426c('0x11')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x426c('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x419845}});}})[_0x426c('0xd')](function(){if(_0x419845&&_0x419845[_0x426c('0x13')]){logger[_0x426c('0xf')](_0x426c('0x14'),_0x419845['join']());for(var _0x221c7e=0x0;_0x221c7e<_0x419845[_0x426c('0x13')];_0x221c7e++){io[_0x426c('0x15')](_0x426c('0x16'),{'id':_0x419845[_0x221c7e],'closed':!![]});}}})[_0x426c('0x17')](function(_0x1c1f3f){logger[_0x426c('0x18')](_0x426c('0x19'),_0x1c1f3f?util[_0x426c('0x1a')](_0x1c1f3f,{'showHidden':![],'depth':null}):'');});}exports[_0x426c('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 1e84fd3..9a5af80 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7a8=['CmContact','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','destroy','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','hopper1'];(function(_0x213394,_0x258951){var _0x1cbfa0=function(_0xd0707a){while(--_0xd0707a){_0x213394['push'](_0x213394['shift']());}};_0x1cbfa0(++_0x258951);}(_0xe7a8,0x16b));var _0x8e7a=function(_0x5bf35e,_0x24dd1b){_0x5bf35e=_0x5bf35e-0x0;var _0x533fa1=_0xe7a8[_0x5bf35e];return _0x533fa1;};'use strict';var util=require(_0x8e7a('0x0'));var db=require(_0x8e7a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8e7a('0x2')]({'id':i,'firstName':_0x8e7a('0x3')+i,'lastName':_0x8e7a('0x4')+i,'phone':0xf879fb460+i,'email':_0x8e7a('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8e7a('0x6')](),'updatedAt':Date[_0x8e7a('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8e7a('0x3')+i,'lastName':_0x8e7a('0x4')+i,'phone':0xf879fb460+i,'email':_0x8e7a('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8e7a('0x6')](),'updatedAt':Date[_0x8e7a('0x6')]()});}db['CmContact'][_0x8e7a('0x7')]({'where':{}})[_0x8e7a('0x8')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x8e7a('0x9')]('finished\x20populating',_0x8e7a('0xa'));return db[_0x8e7a('0xb')]['destroy']({'where':{}});})['then'](function(){return db[_0x8e7a('0xb')][_0x8e7a('0xc')](hopper);})[_0x8e7a('0x8')](function(){console['log'](_0x8e7a('0xd'),_0x8e7a('0xe'));return db[_0x8e7a('0xf')]['bulkCreate'](contacts2);})[_0x8e7a('0x8')](function(){console[_0x8e7a('0x9')](_0x8e7a('0xd'),_0x8e7a('0x10'));return db[_0x8e7a('0xb')][_0x8e7a('0xc')](hopper2);})['then'](function(){console['log'](_0x8e7a('0xd'),_0x8e7a('0x11'));})['catch'](function(_0x384c06){console['log'](_0x384c06);}); \ No newline at end of file +var _0xda73=['push','Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','hopper1','contacts2','CmHopper','hopper2','util','../mysqldb'];(function(_0x4f9d26,_0x641341){var _0x57debc=function(_0x48f368){while(--_0x48f368){_0x4f9d26['push'](_0x4f9d26['shift']());}};_0x57debc(++_0x641341);}(_0xda73,0x1c9));var _0x3da7=function(_0x190569,_0x34ac3d){_0x190569=_0x190569-0x0;var _0x476c08=_0xda73[_0x190569];return _0x476c08;};'use strict';var util=require(_0x3da7('0x0'));var db=require(_0x3da7('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3da7('0x2')]({'id':i,'firstName':_0x3da7('0x3')+i,'lastName':_0x3da7('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3da7('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x3da7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3da7('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3da7('0x2')]({'id':i,'firstName':_0x3da7('0x3')+i,'lastName':_0x3da7('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3da7('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3da7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3da7('0x6')](),'updatedAt':Date[_0x3da7('0x6')]()});}db[_0x3da7('0x7')][_0x3da7('0x8')]({'where':{}})[_0x3da7('0x9')](function(){return db[_0x3da7('0x7')][_0x3da7('0xa')](contacts);})['then'](function(){console[_0x3da7('0xb')]('finished\x20populating','contacts1');return db['CmHopper'][_0x3da7('0x8')]({'where':{}});})['then'](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x3da7('0x9')](function(){console['log'](_0x3da7('0xc'),_0x3da7('0xd'));return db['CmContact'][_0x3da7('0xa')](contacts2);})[_0x3da7('0x9')](function(){console['log']('finished\x20populating',_0x3da7('0xe'));return db[_0x3da7('0xf')][_0x3da7('0xa')](hopper2);})[_0x3da7('0x9')](function(){console['log'](_0x3da7('0xc'),_0x3da7('0x10'));})['catch'](function(_0x261c9a){console['log'](_0x261c9a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index bc2c879..cf50ba3 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd62f=['add\x20user','log','../mysqldb','push','%s%s@xcally.com','agent','password','udp','wss','%s%s','yes','/etc/pki/tls/private/motion.key','actpass','format','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x5a446e,_0x14c23c){var _0x3f4c83=function(_0xc7c5cf){while(--_0xc7c5cf){_0x5a446e['push'](_0x5a446e['shift']());}};_0x3f4c83(++_0x14c23c);}(_0xd62f,0x1c4));var _0xfd62=function(_0x1c94b6,_0x3fe3e0){_0x1c94b6=_0x1c94b6-0x0;var _0x5c061a=_0xd62f[_0x1c94b6];return _0x5c061a;};'use strict';var util=require('util');var db=require(_0xfd62('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xfd62('0x1')]({'name':util['format']('%s%s','agent',i),'fullname':util['format']('%s%s','agent',i),'email':util['format'](_0xfd62('0x2'),_0xfd62('0x3'),i),'role':_0xfd62('0x3'),'password':_0xfd62('0x4'),'internal':0xfa0+i,'type':'friend','transport':[_0xfd62('0x5'),'ws',_0xfd62('0x6')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0xfd62('0x7'),_0xfd62('0x3'),i),'encryption':_0xfd62('0x8'),'avpf':_0xfd62('0x8'),'force_avp':'yes','icesupport':_0xfd62('0x8'),'dtlsenable':_0xfd62('0x8'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xfd62('0x9'),'dtlssetup':_0xfd62('0xa'),'callerid':util[_0xfd62('0xb')](_0xfd62('0xc'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xfd62('0xd')][_0xfd62('0xe')](users)[_0xfd62('0xf')](function(){console['log'](_0xfd62('0x10'));})['catch'](function(_0x1c54c7){console[_0xfd62('0x11')](_0x1c54c7);}); \ No newline at end of file +var _0x3cfa=['catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then','log','add\x20user'];(function(_0x2b2d47,_0x3916b7){var _0x5ba6b5=function(_0x3587a5){while(--_0x3587a5){_0x2b2d47['push'](_0x2b2d47['shift']());}};_0x5ba6b5(++_0x3916b7);}(_0x3cfa,0x12d));var _0xa3cf=function(_0x47a38c,_0x2efcc5){_0x47a38c=_0x47a38c-0x0;var _0x347e63=_0x3cfa[_0x47a38c];return _0x347e63;};'use strict';var util=require(_0xa3cf('0x0'));var db=require(_0xa3cf('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa3cf('0x2')]({'name':util[_0xa3cf('0x3')]('%s%s',_0xa3cf('0x4'),i),'fullname':util[_0xa3cf('0x3')](_0xa3cf('0x5'),_0xa3cf('0x4'),i),'email':util['format'](_0xa3cf('0x6'),_0xa3cf('0x4'),i),'role':_0xa3cf('0x4'),'password':_0xa3cf('0x7'),'internal':0xfa0+i,'type':_0xa3cf('0x8'),'transport':[_0xa3cf('0x9'),'ws',_0xa3cf('0xa')],'disallow':['all'],'allow':[_0xa3cf('0xb')],'defaultuser':util[_0xa3cf('0x3')](_0xa3cf('0x5'),'agent',i),'encryption':_0xa3cf('0xc'),'avpf':_0xa3cf('0xc'),'force_avp':_0xa3cf('0xc'),'icesupport':_0xa3cf('0xc'),'dtlsenable':_0xa3cf('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xa3cf('0xd'),'dtlssetup':_0xa3cf('0xe'),'callerid':util[_0xa3cf('0x3')](_0xa3cf('0xf'),util['format'](_0xa3cf('0x5'),_0xa3cf('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xa3cf('0x10')](function(){console[_0xa3cf('0x11')](_0xa3cf('0x12'));})[_0xa3cf('0x13')](function(_0x2ce50b){console[_0xa3cf('0x11')](_0x2ce50b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d770166..6848b88 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac65=['VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','Campaign','where','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','WhatsappInteraction','voice:inbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','voice:outbound','OpenchannelQueue','Trunk','getVoiceQueues','getFaxQueues','getMailQueues','getWhatsappQueues','length','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation'];(function(_0x4b4b4e,_0x341f0c){var _0xf1a943=function(_0x36fb59){while(--_0x36fb59){_0x4b4b4e['push'](_0x4b4b4e['shift']());}};_0xf1a943(++_0x341f0c);}(_0xac65,0x11d));var _0x5ac6=function(_0x4a1c8f,_0x53af36){_0x4a1c8f=_0x4a1c8f-0x0;var _0x1f148f=_0xac65[_0x4a1c8f];return _0x1f148f;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var BPromise=require(_0x5ac6('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x5ac6('0x3'));var queryQueues={'attributes':['id',_0x5ac6('0x4')],'include':[{'as':_0x5ac6('0x5'),'model':db['User'],'attributes':['id',_0x5ac6('0x4'),_0x5ac6('0x6')],'raw':!![],'where':{'role':_0x5ac6('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5ac6('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5ac6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x5ac6('0x4')],'where':{'role':_0x5ac6('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5ac6('0x4'),_0x5ac6('0x9')],'where':{'type':_0x5ac6('0xa')}};function getAssociatedResources(_0x4609fb,_0x1006ff,_0x3b04ab){return db[_0x5ac6('0xb')][_0x5ac6('0xc')]({'where':{'name':_0x4609fb,'userProfileId':_0x1006ff},'raw':!![]})[_0x5ac6('0xd')](function(_0x40a152){if(_0x40a152){if(_0x40a152[_0x5ac6('0xe')]){switch(_0x4609fb){case _0x5ac6('0xf'):case _0x5ac6('0x10'):case _0x5ac6('0x11'):case _0x5ac6('0x12'):case _0x5ac6('0x13'):case _0x5ac6('0x14'):case _0x5ac6('0x15'):return db[_0x3b04ab][_0x5ac6('0x16')](queryQueues);case _0x5ac6('0x17'):return db[_0x3b04ab][_0x5ac6('0x16')](queryTelephones);case _0x5ac6('0x18'):return db[_0x3b04ab]['findAll'](queryTrunks);case _0x5ac6('0x19'):return db[_0x3b04ab][_0x5ac6('0x16')](queryCampaigns);}}else{return db[_0x5ac6('0x1a')]['findAll']({'attributes':[_0x5ac6('0x1b')],'where':{'sectionId':_0x40a152['id']},'raw':!![]})[_0x5ac6('0xd')](function(_0x2db3af){if(_0x2db3af){var _0x158e9a={'where':{'id':_[_0x5ac6('0x1c')](_0x2db3af,'resourceId')},'raw':!![]};switch(_0x3b04ab){case _0x5ac6('0x1d'):_0x158e9a['where']['role']=_0x5ac6('0x8');break;case _0x5ac6('0x1e'):_0x158e9a[_0x5ac6('0x1f')][_0x5ac6('0x9')]=_0x5ac6('0xa');break;}return db[_0x3b04ab][_0x5ac6('0x16')](_0x158e9a);}else{return[];}});}}else{return[];}})[_0x5ac6('0xd')](function(_0x223441){return _0x223441;});}function joinOrLeaveQueues(_0x446733,_0x5a5bfa,_0xcb282a,_0x27d28e){_0x446733[_0x5a5bfa](util[_0x5ac6('0x20')](_0x5ac6('0x21'),_0xcb282a,_0x27d28e['name']));if(_0x27d28e[_0x5ac6('0x5')]){for(var _0x4fa376=0x0;_0x4fa376<_0x27d28e[_0x5ac6('0x5')]['length'];_0x4fa376+=0x1){_0x446733[_0x5a5bfa](util[_0x5ac6('0x20')](_0x5ac6('0x22'),_0x27d28e['Agents'][_0x4fa376][_0x5ac6('0x4')]));}}}function joinOrLeave(_0x270c8d,_0x52ba3f,_0x1c81e7){var _0x4c07d6;if(_0x270c8d[_0x5ac6('0x23')][_0x5ac6('0x24')]['id']){db[_0x5ac6('0x1d')][_0x5ac6('0x25')]({'attributes':['id',_0x5ac6('0x4'),_0x5ac6('0x6'),_0x5ac6('0x26')],'where':{'id':_0x270c8d['handshake'][_0x5ac6('0x24')]['id']},'include':[{'model':db[_0x5ac6('0x27')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5ac6('0x28')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5ac6('0x29')],'as':_0x5ac6('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x5ac6('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5ac6('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x5ac6('0xd')](function(_0x2c02f7){if(_0x2c02f7){_0x4c07d6=_0x2c02f7;_0x270c8d[_0x52ba3f](util['format']('user:%s',_0x2c02f7[_0x5ac6('0x4')]));var _0x591b0a=[];switch(_0x2c02f7[_0x5ac6('0x6')]){case'admin':_0x270c8d[_0x52ba3f](_0x5ac6('0x2d'));_0x270c8d[_0x52ba3f]('voice:outbound');if(queryQueues[_0x5ac6('0x2e')](_0x5ac6('0x2f'))){delete queryQueues[_0x5ac6('0x2f')];}_0x591b0a['push'](db[_0x5ac6('0x30')][_0x5ac6('0x16')](queryQueues));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x32')][_0x5ac6('0x16')](queryQueues));_0x591b0a[_0x5ac6('0x31')](db['FaxQueue']['findAll'](queryQueues));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x33')][_0x5ac6('0x16')](queryQueues));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x34')][_0x5ac6('0x16')](queryQueues));_0x591b0a[_0x5ac6('0x31')](db['OpenchannelQueue'][_0x5ac6('0x16')](queryQueues));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x35')][_0x5ac6('0x16')](queryQueues));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x1d')][_0x5ac6('0x16')](queryTelephones));_0x591b0a[_0x5ac6('0x31')](db['Trunk'][_0x5ac6('0x16')](queryTrunks));_0x591b0a[_0x5ac6('0x31')](db['Campaign']['findAll'](queryCampaigns));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x1d')][_0x5ac6('0x16')](queryAgents));break;case'user':_0x270c8d[_0x52ba3f](_0x5ac6('0x2d'));_0x270c8d[_0x52ba3f](_0x5ac6('0x36'));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources('VoiceQueues',_0x2c02f7[_0x5ac6('0x26')],'VoiceQueue'));_0x591b0a['push'](getAssociatedResources('ChatQueues',_0x2c02f7[_0x5ac6('0x26')],_0x5ac6('0x32')));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources(_0x5ac6('0x11'),_0x2c02f7[_0x5ac6('0x26')],'FaxQueue'));_0x591b0a['push'](getAssociatedResources(_0x5ac6('0x12'),_0x2c02f7[_0x5ac6('0x26')],_0x5ac6('0x33')));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources(_0x5ac6('0x13'),_0x2c02f7[_0x5ac6('0x26')],'MailQueue'));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources('OpenchannelQueues',_0x2c02f7['userProfileId'],_0x5ac6('0x37')));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources(_0x5ac6('0x15'),_0x2c02f7[_0x5ac6('0x26')],_0x5ac6('0x35')));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources(_0x5ac6('0x17'),_0x2c02f7[_0x5ac6('0x26')],_0x5ac6('0x1d')));_0x591b0a['push'](getAssociatedResources(_0x5ac6('0x18'),_0x2c02f7[_0x5ac6('0x26')],_0x5ac6('0x38')));_0x591b0a[_0x5ac6('0x31')](getAssociatedResources(_0x5ac6('0x19'),_0x2c02f7['userProfileId'],_0x5ac6('0x1e')));_0x591b0a[_0x5ac6('0x31')](db[_0x5ac6('0x1d')][_0x5ac6('0x16')](queryAgents));break;case'agent':_0x270c8d[_0x52ba3f]('voice:inbound');_0x270c8d[_0x52ba3f](_0x5ac6('0x36'));_0x591b0a[_0x5ac6('0x31')](_0x2c02f7[_0x5ac6('0x39')]({'attributes':['id','name']}));_0x591b0a[_0x5ac6('0x31')](_0x2c02f7['getChatQueues']({'attributes':['id',_0x5ac6('0x4')]}));_0x591b0a['push'](_0x2c02f7[_0x5ac6('0x3a')]({'attributes':['id',_0x5ac6('0x4')]}));_0x591b0a[_0x5ac6('0x31')](_0x2c02f7['getSmsQueues']({'attributes':['id','name']}));_0x591b0a[_0x5ac6('0x31')](_0x2c02f7[_0x5ac6('0x3b')]({'attributes':['id','name']}));_0x591b0a[_0x5ac6('0x31')](_0x2c02f7['getOpenchannelQueues']({'attributes':['id','name']}));_0x591b0a[_0x5ac6('0x31')](_0x2c02f7[_0x5ac6('0x3c')]({'attributes':['id',_0x5ac6('0x4')]}));break;}return BPromise['all'](_0x591b0a);}})[_0x5ac6('0xd')](function(_0x13b7d9){if(_0x13b7d9&&_0x13b7d9[_0x5ac6('0x3d')]){for(var _0x407dc4=0x0;_0x407dc4<_0x13b7d9['length'];_0x407dc4+=0x1){for(var _0x2ea720=0x0;_0x2ea720<_0x13b7d9[_0x407dc4][_0x5ac6('0x3d')];_0x2ea720+=0x1){switch(_0x407dc4){case 0x0:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,'voice',_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x1:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,_0x5ac6('0x3e'),_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x2:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,_0x5ac6('0x3f'),_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x3:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,_0x5ac6('0x40'),_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x4:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,_0x5ac6('0x41'),_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x5:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,'openchannel',_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x6:joinOrLeaveQueues(_0x270c8d,_0x52ba3f,_0x5ac6('0x42'),_0x13b7d9[_0x407dc4][_0x2ea720]);break;case 0x7:_0x270c8d[_0x52ba3f](util[_0x5ac6('0x20')](_0x5ac6('0x43'),_0x13b7d9[_0x407dc4][_0x2ea720][_0x5ac6('0x4')]));break;case 0x8:_0x270c8d[_0x52ba3f](util['format'](_0x5ac6('0x44'),_0x13b7d9[_0x407dc4][_0x2ea720][_0x5ac6('0x4')]));break;case 0x9:_0x270c8d[_0x52ba3f](util[_0x5ac6('0x20')](_0x5ac6('0x45'),_0x13b7d9[_0x407dc4][_0x2ea720][_0x5ac6('0x9')],_0x13b7d9[_0x407dc4][_0x2ea720][_0x5ac6('0x4')]));break;case 0xa:_0x270c8d[_0x52ba3f](util['format'](_0x5ac6('0x22'),_0x13b7d9[_0x407dc4][_0x2ea720]['name']));break;}}}}})['then'](function(){if(_0x52ba3f===_0x5ac6('0x46')){var _0x288410=_[_0x5ac6('0x1c')](_0x4c07d6['ChatInteractions'],'id');return _0x4c07d6[_0x5ac6('0x47')](_0x288410)[_0x5ac6('0xd')](function(){for(var _0xb07b84=0x0;_0xb07b84<_0x288410[_0x5ac6('0x3d')];_0xb07b84+=0x1){_0x1c81e7[_0x5ac6('0x48')](_0x5ac6('0x49'),{'ChatInteractionId':Number(_0x288410[_0xb07b84]),'UserId':Number(_0x4c07d6['id'])});}});}})[_0x5ac6('0xd')](function(){if(_0x52ba3f===_0x5ac6('0x46')){var _0x15995c=_[_0x5ac6('0x1c')](_0x4c07d6[_0x5ac6('0x4a')],'id');return _0x4c07d6[_0x5ac6('0x4b')](_0x15995c)[_0x5ac6('0xd')](function(){for(var _0x4ca920=0x0;_0x4ca920<_0x15995c[_0x5ac6('0x3d')];_0x4ca920+=0x1){_0x1c81e7[_0x5ac6('0x48')](_0x5ac6('0x4c'),{'MailInteractionId':Number(_0x15995c[_0x4ca920]),'UserId':Number(_0x4c07d6['id'])});}});}})[_0x5ac6('0xd')](function(){if(_0x52ba3f===_0x5ac6('0x46')){var _0x1dea96=_[_0x5ac6('0x1c')](_0x4c07d6[_0x5ac6('0x2a')],'id');return _0x4c07d6[_0x5ac6('0x4d')](_0x1dea96)[_0x5ac6('0xd')](function(){for(var _0x7672ef=0x0;_0x7672ef<_0x1dea96[_0x5ac6('0x3d')];_0x7672ef+=0x1){_0x1c81e7[_0x5ac6('0x48')](_0x5ac6('0x4e'),{'FaxInteractionId':Number(_0x1dea96[_0x7672ef]),'UserId':Number(_0x4c07d6['id'])});}});}})[_0x5ac6('0xd')](function(){if(_0x52ba3f===_0x5ac6('0x46')){var _0x30dc6f=_[_0x5ac6('0x1c')](_0x4c07d6[_0x5ac6('0x2b')],'id');return _0x4c07d6['removeSmsInteractions'](_0x30dc6f)['then'](function(){for(var _0x3e153c=0x0;_0x3e153c<_0x30dc6f[_0x5ac6('0x3d')];_0x3e153c+=0x1){_0x1c81e7['emit'](_0x5ac6('0x4f'),{'SmsInteractionId':Number(_0x30dc6f[_0x3e153c]),'UserId':Number(_0x4c07d6['id'])});}});}})[_0x5ac6('0xd')](function(){if(_0x52ba3f===_0x5ac6('0x46')){var _0x3b099b=_[_0x5ac6('0x1c')](_0x4c07d6[_0x5ac6('0x50')],'id');return _0x4c07d6[_0x5ac6('0x51')](_0x3b099b)[_0x5ac6('0xd')](function(){for(var _0x14340a=0x0;_0x14340a<_0x3b099b['length'];_0x14340a+=0x1){_0x1c81e7['emit'](_0x5ac6('0x52'),{'OpenchannelInteractionId':Number(_0x3b099b[_0x14340a]),'UserId':Number(_0x4c07d6['id'])});}});}})[_0x5ac6('0xd')](function(){if(_0x52ba3f==='leave'){var _0x3059ee=_[_0x5ac6('0x1c')](_0x4c07d6[_0x5ac6('0x53')],'id');return _0x4c07d6['removeWhatsappInteractions'](_0x3059ee)[_0x5ac6('0xd')](function(){for(var _0x467d2e=0x0;_0x467d2e<_0x3059ee[_0x5ac6('0x3d')];_0x467d2e+=0x1){_0x1c81e7[_0x5ac6('0x48')](_0x5ac6('0x54'),{'WhatsappInteractionId':Number(_0x3059ee[_0x467d2e]),'UserId':Number(_0x4c07d6['id'])});}});}})[_0x5ac6('0x55')](function(_0x3417c5){_0x270c8d[_0x5ac6('0x56')](_0x3417c5);});}}function onDisconnect(_0xf68c82,_0x3a2f4b){joinOrLeave(_0xf68c82,_0x5ac6('0x46'),_0x3a2f4b);}function onConnect(_0x1c4e4c){joinOrLeave(_0x1c4e4c,_0x5ac6('0x57'));}exports[_0x5ac6('0x58')]=function(_0x5eebe1){_0x5eebe1['on'](_0x5ac6('0x59'),function(_0x31a410){_0x31a410[_0x5ac6('0x5a')](0x0);_0x31a410[_0x5ac6('0x5b')]=_0x31a410[_0x5ac6('0x5c')][_0x5ac6('0x59')][_0x5ac6('0x5d')]+':'+_0x31a410[_0x5ac6('0x5c')][_0x5ac6('0x59')][_0x5ac6('0x5e')];_0x31a410[_0x5ac6('0x5f')]=new Date();_0x31a410[_0x5ac6('0x56')]=function(_0xecf294){console[_0x5ac6('0x56')](_0x5ac6('0x60')+_0x31a410['nsp'][_0x5ac6('0x4')]+'['+_0x31a410[_0x5ac6('0x5b')]+']',_0xecf294);};_0x31a410['on'](_0x5ac6('0x61'),function(){onDisconnect(_0x31a410,_0x5eebe1);_0x31a410[_0x5ac6('0x56')](_0x5ac6('0x62'));});onConnect(_0x31a410);_0x31a410[_0x5ac6('0x56')](_0x5ac6('0x63'));});}; \ No newline at end of file +var _0x0c08=['default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','nsp','address','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','user:%s','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Campaign','user','voice:outbound','VoiceQueues','FaxQueue','SmsQueues','WhatsappQueues','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','length','voice','sms','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','catch','log','join'];(function(_0x10a8dc,_0xc525c9){var _0x4bb394=function(_0x1697cb){while(--_0x1697cb){_0x10a8dc['push'](_0x10a8dc['shift']());}};_0x4bb394(++_0xc525c9);}(_0x0c08,0x1e6));var _0x80c0=function(_0x908eb6,_0x59199b){_0x908eb6=_0x908eb6-0x0;var _0x511a09=_0x0c08[_0x908eb6];return _0x511a09;};'use strict';var _=require(_0x80c0('0x0'));var util=require(_0x80c0('0x1'));var BPromise=require('bluebird');var db=require(_0x80c0('0x2'))['db'];var config=require(_0x80c0('0x3'));var queryQueues={'attributes':['id',_0x80c0('0x4')],'include':[{'as':_0x80c0('0x5'),'model':db[_0x80c0('0x6')],'attributes':['id','name',_0x80c0('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x80c0('0x4')],'where':{'role':_0x80c0('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x80c0('0x4')],'where':{'role':_0x80c0('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x80c0('0x4'),_0x80c0('0xa')],'where':{'type':_0x80c0('0xb')}};function getAssociatedResources(_0x5e9406,_0x5de4c4,_0xb7bb5d){return db[_0x80c0('0xc')][_0x80c0('0xd')]({'where':{'name':_0x5e9406,'userProfileId':_0x5de4c4},'raw':!![]})[_0x80c0('0xe')](function(_0x259637){if(_0x259637){if(_0x259637[_0x80c0('0xf')]){switch(_0x5e9406){case'VoiceQueues':case _0x80c0('0x10'):case _0x80c0('0x11'):case'SmsQueues':case'MailQueues':case _0x80c0('0x12'):case'WhatsappQueues':return db[_0xb7bb5d]['findAll'](queryQueues);case'Telephones':return db[_0xb7bb5d][_0x80c0('0x13')](queryTelephones);case _0x80c0('0x14'):return db[_0xb7bb5d][_0x80c0('0x13')](queryTrunks);case _0x80c0('0x15'):return db[_0xb7bb5d][_0x80c0('0x13')](queryCampaigns);}}else{return db[_0x80c0('0x16')][_0x80c0('0x13')]({'attributes':[_0x80c0('0x17')],'where':{'sectionId':_0x259637['id']},'raw':!![]})[_0x80c0('0xe')](function(_0x21f761){if(_0x21f761){var _0x57bbf7={'where':{'id':_[_0x80c0('0x18')](_0x21f761,'resourceId')},'raw':!![]};switch(_0xb7bb5d){case _0x80c0('0x6'):_0x57bbf7[_0x80c0('0x19')][_0x80c0('0x7')]=_0x80c0('0x8');break;case'Campaign':_0x57bbf7[_0x80c0('0x19')][_0x80c0('0xa')]='ivr';break;}return db[_0xb7bb5d][_0x80c0('0x13')](_0x57bbf7);}else{return[];}});}}else{return[];}})[_0x80c0('0xe')](function(_0x563117){return _0x563117;});}function joinOrLeaveQueues(_0x5163bf,_0x42a895,_0x19ac32,_0x3d4026){_0x5163bf[_0x42a895](util[_0x80c0('0x1a')](_0x80c0('0x1b'),_0x19ac32,_0x3d4026[_0x80c0('0x4')]));if(_0x3d4026['Agents']){for(var _0x20f480=0x0;_0x20f480<_0x3d4026[_0x80c0('0x5')]['length'];_0x20f480+=0x1){_0x5163bf[_0x42a895](util[_0x80c0('0x1a')](_0x80c0('0x1c'),_0x3d4026['Agents'][_0x20f480][_0x80c0('0x4')]));}}}function joinOrLeave(_0x47fa4d,_0x147cee,_0x4766f5){var _0x51ac53;if(_0x47fa4d['handshake']['query']['id']){db['User'][_0x80c0('0x1d')]({'attributes':['id',_0x80c0('0x4'),'role',_0x80c0('0x1e')],'where':{'id':_0x47fa4d['handshake'][_0x80c0('0x1f')]['id']},'include':[{'model':db[_0x80c0('0x20')],'as':_0x80c0('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x80c0('0x22')],'as':_0x80c0('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x80c0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x80c0('0x25')],'as':_0x80c0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x80c0('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x80c0('0xe')](function(_0x581adc){if(_0x581adc){_0x51ac53=_0x581adc;_0x47fa4d[_0x147cee](util['format'](_0x80c0('0x1c'),_0x581adc[_0x80c0('0x4')]));var _0x4eeb94=[];switch(_0x581adc[_0x80c0('0x7')]){case _0x80c0('0x28'):_0x47fa4d[_0x147cee](_0x80c0('0x29'));_0x47fa4d[_0x147cee]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x80c0('0x2a'))){delete queryQueues[_0x80c0('0x2a')];}_0x4eeb94[_0x80c0('0x2b')](db[_0x80c0('0x2c')]['findAll'](queryQueues));_0x4eeb94['push'](db[_0x80c0('0x2d')][_0x80c0('0x13')](queryQueues));_0x4eeb94[_0x80c0('0x2b')](db['FaxQueue'][_0x80c0('0x13')](queryQueues));_0x4eeb94[_0x80c0('0x2b')](db[_0x80c0('0x2e')][_0x80c0('0x13')](queryQueues));_0x4eeb94[_0x80c0('0x2b')](db[_0x80c0('0x2f')][_0x80c0('0x13')](queryQueues));_0x4eeb94[_0x80c0('0x2b')](db[_0x80c0('0x30')][_0x80c0('0x13')](queryQueues));_0x4eeb94['push'](db['WhatsappQueue'][_0x80c0('0x13')](queryQueues));_0x4eeb94[_0x80c0('0x2b')](db[_0x80c0('0x6')]['findAll'](queryTelephones));_0x4eeb94[_0x80c0('0x2b')](db['Trunk'][_0x80c0('0x13')](queryTrunks));_0x4eeb94[_0x80c0('0x2b')](db[_0x80c0('0x31')]['findAll'](queryCampaigns));_0x4eeb94['push'](db[_0x80c0('0x6')]['findAll'](queryAgents));break;case _0x80c0('0x32'):_0x47fa4d[_0x147cee]('voice:inbound');_0x47fa4d[_0x147cee](_0x80c0('0x33'));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x34'),_0x581adc[_0x80c0('0x1e')],_0x80c0('0x2c')));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x10'),_0x581adc[_0x80c0('0x1e')],'ChatQueue'));_0x4eeb94['push'](getAssociatedResources(_0x80c0('0x11'),_0x581adc[_0x80c0('0x1e')],_0x80c0('0x35')));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x36'),_0x581adc[_0x80c0('0x1e')],'SmsQueue'));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources('MailQueues',_0x581adc[_0x80c0('0x1e')],_0x80c0('0x2f')));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x12'),_0x581adc[_0x80c0('0x1e')],'OpenchannelQueue'));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x37'),_0x581adc[_0x80c0('0x1e')],_0x80c0('0x38')));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources('Telephones',_0x581adc['userProfileId'],_0x80c0('0x6')));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x14'),_0x581adc['userProfileId'],_0x80c0('0x39')));_0x4eeb94[_0x80c0('0x2b')](getAssociatedResources(_0x80c0('0x15'),_0x581adc['userProfileId'],_0x80c0('0x31')));_0x4eeb94[_0x80c0('0x2b')](db['User']['findAll'](queryAgents));break;case _0x80c0('0x9'):_0x47fa4d[_0x147cee](_0x80c0('0x29'));_0x47fa4d[_0x147cee](_0x80c0('0x33'));_0x4eeb94[_0x80c0('0x2b')](_0x581adc[_0x80c0('0x3a')]({'attributes':['id','name']}));_0x4eeb94['push'](_0x581adc[_0x80c0('0x3b')]({'attributes':['id',_0x80c0('0x4')]}));_0x4eeb94[_0x80c0('0x2b')](_0x581adc[_0x80c0('0x3c')]({'attributes':['id','name']}));_0x4eeb94['push'](_0x581adc[_0x80c0('0x3d')]({'attributes':['id','name']}));_0x4eeb94[_0x80c0('0x2b')](_0x581adc[_0x80c0('0x3e')]({'attributes':['id',_0x80c0('0x4')]}));_0x4eeb94[_0x80c0('0x2b')](_0x581adc['getOpenchannelQueues']({'attributes':['id',_0x80c0('0x4')]}));_0x4eeb94[_0x80c0('0x2b')](_0x581adc['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise['all'](_0x4eeb94);}})[_0x80c0('0xe')](function(_0x2421ee){if(_0x2421ee&&_0x2421ee[_0x80c0('0x3f')]){for(var _0x5e1b52=0x0;_0x5e1b52<_0x2421ee[_0x80c0('0x3f')];_0x5e1b52+=0x1){for(var _0x4bff8f=0x0;_0x4bff8f<_0x2421ee[_0x5e1b52][_0x80c0('0x3f')];_0x4bff8f+=0x1){switch(_0x5e1b52){case 0x0:joinOrLeaveQueues(_0x47fa4d,_0x147cee,_0x80c0('0x40'),_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x1:joinOrLeaveQueues(_0x47fa4d,_0x147cee,'chat',_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x2:joinOrLeaveQueues(_0x47fa4d,_0x147cee,'fax',_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x3:joinOrLeaveQueues(_0x47fa4d,_0x147cee,_0x80c0('0x41'),_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x4:joinOrLeaveQueues(_0x47fa4d,_0x147cee,'mail',_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x5:joinOrLeaveQueues(_0x47fa4d,_0x147cee,_0x80c0('0x42'),_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x6:joinOrLeaveQueues(_0x47fa4d,_0x147cee,'whatsapp',_0x2421ee[_0x5e1b52][_0x4bff8f]);break;case 0x7:_0x47fa4d[_0x147cee](util[_0x80c0('0x1a')](_0x80c0('0x43'),_0x2421ee[_0x5e1b52][_0x4bff8f][_0x80c0('0x4')]));break;case 0x8:_0x47fa4d[_0x147cee](util['format'](_0x80c0('0x44'),_0x2421ee[_0x5e1b52][_0x4bff8f][_0x80c0('0x4')]));break;case 0x9:_0x47fa4d[_0x147cee](util[_0x80c0('0x1a')](_0x80c0('0x45'),_0x2421ee[_0x5e1b52][_0x4bff8f][_0x80c0('0xa')],_0x2421ee[_0x5e1b52][_0x4bff8f][_0x80c0('0x4')]));break;case 0xa:_0x47fa4d[_0x147cee](util[_0x80c0('0x1a')](_0x80c0('0x1c'),_0x2421ee[_0x5e1b52][_0x4bff8f][_0x80c0('0x4')]));break;}}}}})[_0x80c0('0xe')](function(){if(_0x147cee===_0x80c0('0x46')){var _0x1478b5=_[_0x80c0('0x18')](_0x51ac53[_0x80c0('0x21')],'id');return _0x51ac53[_0x80c0('0x47')](_0x1478b5)[_0x80c0('0xe')](function(){for(var _0x3d5a0b=0x0;_0x3d5a0b<_0x1478b5['length'];_0x3d5a0b+=0x1){_0x4766f5[_0x80c0('0x48')](_0x80c0('0x49'),{'ChatInteractionId':Number(_0x1478b5[_0x3d5a0b]),'UserId':Number(_0x51ac53['id'])});}});}})[_0x80c0('0xe')](function(){if(_0x147cee==='leave'){var _0x210345=_[_0x80c0('0x18')](_0x51ac53[_0x80c0('0x23')],'id');return _0x51ac53[_0x80c0('0x4a')](_0x210345)[_0x80c0('0xe')](function(){for(var _0x41a66e=0x0;_0x41a66e<_0x210345['length'];_0x41a66e+=0x1){_0x4766f5[_0x80c0('0x48')](_0x80c0('0x4b'),{'MailInteractionId':Number(_0x210345[_0x41a66e]),'UserId':Number(_0x51ac53['id'])});}});}})[_0x80c0('0xe')](function(){if(_0x147cee===_0x80c0('0x46')){var _0xaa14af=_[_0x80c0('0x18')](_0x51ac53[_0x80c0('0x4c')],'id');return _0x51ac53[_0x80c0('0x4d')](_0xaa14af)[_0x80c0('0xe')](function(){for(var _0x3f7537=0x0;_0x3f7537<_0xaa14af[_0x80c0('0x3f')];_0x3f7537+=0x1){_0x4766f5[_0x80c0('0x48')](_0x80c0('0x4e'),{'FaxInteractionId':Number(_0xaa14af[_0x3f7537]),'UserId':Number(_0x51ac53['id'])});}});}})[_0x80c0('0xe')](function(){if(_0x147cee===_0x80c0('0x46')){var _0x26d6fe=_['map'](_0x51ac53[_0x80c0('0x24')],'id');return _0x51ac53[_0x80c0('0x4f')](_0x26d6fe)[_0x80c0('0xe')](function(){for(var _0x26dddd=0x0;_0x26dddd<_0x26d6fe['length'];_0x26dddd+=0x1){_0x4766f5[_0x80c0('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x26d6fe[_0x26dddd]),'UserId':Number(_0x51ac53['id'])});}});}})['then'](function(){if(_0x147cee===_0x80c0('0x46')){var _0x3705eb=_[_0x80c0('0x18')](_0x51ac53[_0x80c0('0x26')],'id');return _0x51ac53['removeOpenchannelInteractions'](_0x3705eb)[_0x80c0('0xe')](function(){for(var _0x7f28a=0x0;_0x7f28a<_0x3705eb['length'];_0x7f28a+=0x1){_0x4766f5[_0x80c0('0x48')](_0x80c0('0x50'),{'OpenchannelInteractionId':Number(_0x3705eb[_0x7f28a]),'UserId':Number(_0x51ac53['id'])});}});}})[_0x80c0('0xe')](function(){if(_0x147cee===_0x80c0('0x46')){var _0x4c540d=_[_0x80c0('0x18')](_0x51ac53['WhatsappInteractions'],'id');return _0x51ac53['removeWhatsappInteractions'](_0x4c540d)[_0x80c0('0xe')](function(){for(var _0xf5812=0x0;_0xf5812<_0x4c540d[_0x80c0('0x3f')];_0xf5812+=0x1){_0x4766f5[_0x80c0('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4c540d[_0xf5812]),'UserId':Number(_0x51ac53['id'])});}});}})[_0x80c0('0x51')](function(_0x231e32){_0x47fa4d[_0x80c0('0x52')](_0x231e32);});}}function onDisconnect(_0x4b89bd,_0x43c88c){joinOrLeave(_0x4b89bd,_0x80c0('0x46'),_0x43c88c);}function onConnect(_0x53c63a){joinOrLeave(_0x53c63a,_0x80c0('0x53'));}exports[_0x80c0('0x54')]=function(_0x4eb979){_0x4eb979['on'](_0x80c0('0x55'),function(_0x4f0c26){_0x4f0c26[_0x80c0('0x56')](0x0);_0x4f0c26['address']=_0x4f0c26[_0x80c0('0x57')][_0x80c0('0x55')][_0x80c0('0x58')]+':'+_0x4f0c26[_0x80c0('0x57')]['connection'][_0x80c0('0x59')];_0x4f0c26[_0x80c0('0x5a')]=new Date();_0x4f0c26[_0x80c0('0x52')]=function(_0x4719b8){console[_0x80c0('0x52')]('SocketIO\x20'+_0x4f0c26[_0x80c0('0x5b')]['name']+'['+_0x4f0c26[_0x80c0('0x5c')]+']',_0x4719b8);};_0x4f0c26['on'](_0x80c0('0x5d'),function(){onDisconnect(_0x4f0c26,_0x4eb979);_0x4f0c26['log'](_0x80c0('0x5e'));});onConnect(_0x4f0c26);_0x4f0c26[_0x80c0('0x52')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 06e37aa..7a08da4 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 _0x5898=['condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','closedinteraction','Chat','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','newmessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','interface','format','incomingmessage','opened','changed','closed','default','model','hook','callback','toLowerCase'];(function(_0x58370d,_0x204d5c){var _0x288862=function(_0x40df7e){while(--_0x40df7e){_0x58370d['push'](_0x58370d['shift']());}};_0x288862(++_0x204d5c);}(_0x5898,0x157));var _0x8589=function(_0x21a2da,_0x9f4c2b){_0x21a2da=_0x21a2da-0x0;var _0x3ff5da=_0x5898[_0x21a2da];return _0x3ff5da;};'use strict';var util=require(_0x8589('0x0'));var db=require(_0x8589('0x1'))['db'];var jayson=require(_0x8589('0x2'));var logger=require(_0x8589('0x3'))(_0x8589('0x4'));var client=jayson[_0x8589('0x5')][_0x8589('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x8589('0x7'),'event':_0x8589('0x8'),'condition':_0x8589('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0x8589('0x7'),'event':'afterUpdate','condition':_0x8589('0xa'),'callback':afterUpdate},{'channel':_0x8589('0xb'),'model':'ChatMessage','event':_0x8589('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8589('0xc'),'model':_0x8589('0xd'),'event':_0x8589('0x8'),'condition':_0x8589('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0x8589('0xd'),'event':_0x8589('0xe'),'condition':_0x8589('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0x8589('0xf'),'event':_0x8589('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8589('0x10'),'model':_0x8589('0x11'),'event':'afterCreate','condition':_0x8589('0x9'),'callback':afterCreate},{'channel':_0x8589('0x10'),'model':_0x8589('0x11'),'event':'afterUpdate','condition':_0x8589('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x8589('0x12'),'event':'afterCreate','condition':_0x8589('0x13'),'callback':afterCreateMessage},{'channel':_0x8589('0x14'),'model':'FaxInteraction','event':_0x8589('0x8'),'condition':_0x8589('0x9'),'callback':afterCreate},{'channel':_0x8589('0x14'),'model':_0x8589('0x15'),'event':'afterUpdate','condition':_0x8589('0xa'),'callback':afterUpdate},{'channel':_0x8589('0x14'),'model':_0x8589('0x16'),'event':'afterCreate','condition':_0x8589('0x13'),'callback':afterCreateMessage},{'channel':_0x8589('0x17'),'model':_0x8589('0x18'),'event':'afterCreate','condition':_0x8589('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0x8589('0x18'),'event':'afterUpdate','condition':_0x8589('0xa'),'callback':afterUpdate},{'channel':'Mail','model':_0x8589('0x19'),'event':'afterCreate','condition':_0x8589('0x13'),'callback':afterCreateMessage},{'channel':_0x8589('0x1a'),'model':_0x8589('0x1b'),'event':_0x8589('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8589('0x1a'),'model':_0x8589('0x1b'),'event':_0x8589('0xe'),'condition':_0x8589('0xa'),'callback':afterUpdate},{'channel':_0x8589('0x1a'),'model':_0x8589('0x1c'),'event':_0x8589('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x40d1b3){return client[_0x8589('0x1d')](_0x8589('0x1e'),_0x40d1b3)[_0x8589('0x1f')](function(_0x5581dc){logger[_0x8589('0x20')](_0x8589('0x21'),_0x8589('0x1e'),_0x5581dc);if(_0x5581dc['error']){if(_0x5581dc[_0x8589('0x22')][_0x8589('0x23')]===0x1f4){logger[_0x8589('0x22')](_0x8589('0x21'),_0x8589('0x1e'),_0x5581dc[_0x8589('0x22')]);}}})[_0x8589('0x24')](function(_0x15e9df){logger[_0x8589('0x22')](_0x8589('0x21'),_0x8589('0x1e'),_0x15e9df);});}function afterCreateMessage(_0x3e3fc3,_0x57b709){return function(_0x5e2045,_0x21dc31){_0x5e2045=_0x5e2045[_0x8589('0x25')]({'plain':!![]});_0x5e2045[_0x8589('0x26')]=_0x3e3fc3;_0x5e2045[_0x8589('0x27')]=_0x5e2045[_0x8589('0x28')];if(_0x5e2045[_0x8589('0x29')]){return db[_0x8589('0x2a')][_0x8589('0x2b')]({'where':{'id':_0x5e2045[_0x8589('0x29')]},'attributes':['id',_0x8589('0x2c')],'raw':!![]})[_0x8589('0x1f')](function(_0x2ba34d){_0x5e2045[_0x8589('0x2d')]=util[_0x8589('0x2e')]('SIP/%s',_0x2ba34d[_0x8589('0x2c')]);_0x5e2045[_0x8589('0x26')]=_0x3e3fc3;return request({'event':_0x8589('0x2f'),'message':_0x5e2045});})[_0x8589('0x24')](function(_0x58515c){console[_0x8589('0x22')](_0x58515c);});}else{return request({'event':'outgoingmessage','message':_0x5e2045});}};}function afterCreate(_0x5b80fd,_0x34b70c){return function(_0x41d5b8,_0x2651c9){_0x41d5b8=_0x41d5b8['get']({'plain':!![]});_0x41d5b8[_0x8589('0x26')]=_0x5b80fd;_0x41d5b8[_0x8589('0x27')]=_0x8589('0x30');return request({'event':_0x34b70c,'message':_0x41d5b8});};}function afterUpdate(_0x7b981d,_0x584112){return function(_0x5299d9,_0x25615a){if(_0x5299d9[_0x8589('0x31')](_0x8589('0x32'))&&_0x5299d9[_0x8589('0x32')]){_0x5299d9=_0x5299d9[_0x8589('0x25')]({'plain':!![]});_0x5299d9[_0x8589('0x26')]=_0x7b981d;_0x5299d9[_0x8589('0x27')]='closed';if(_0x5299d9[_0x8589('0x29')]){return db[_0x8589('0x2a')][_0x8589('0x2b')]({'where':{'id':_0x5299d9[_0x8589('0x29')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x3a9b77){_0x5299d9['interface']=util[_0x8589('0x2e')]('SIP/%s',_0x3a9b77[_0x8589('0x2c')]);return request({'event':_0x584112,'message':_0x5299d9});})[_0x8589('0x24')](function(_0x585bed){console['error'](_0x585bed);});}else{return request({'event':_0x584112,'message':_0x5299d9});}}};}exports[_0x8589('0x33')]=function(){for(var _0x27db06=0x0;_0x27db06=_0xa2cd84['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x57b17a(_0xd056a);})[_0xf623('0x12')](function(_0x58dc8c){_0x1cd516(_0x58dc8c);});});}; \ No newline at end of file +var _0xb00d=['openchannel','getChannels','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice','mail','fax','whatsapp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb00d,0x1ed));var _0xdb00=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xb00d[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xdb00('0x0'));var BPromise=require(_0xdb00('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xdb00('0x2'));var channels=[_0xdb00('0x3'),_0xdb00('0x4'),'chat',_0xdb00('0x5'),'sms',_0xdb00('0x6'),_0xdb00('0x7')];exports[_0xdb00('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x4b6083){_0x4b6083=_0x4b6083[_0xdb00('0x9')]();return _[_0xdb00('0xa')](channels,_0x4b6083);};exports[_0xdb00('0xb')]=function(_0x530ffd,_0x250604,_0x5b73c1,_0x2cb70c){var _0x5d7f86={'loginAttempts':_0x250604,'blocked':_0x5b73c1};if(!_['isUndefined'](_0x2cb70c)){_0x5d7f86[_0xdb00('0xc')]=_0x2cb70c;}return _0x530ffd[_0xdb00('0xd')](_0x5d7f86);};exports[_0xdb00('0xe')]=function(_0x4f323a){return new BPromise(function(_0x2d7122,_0x5f219d){var _0x1bfbfe=0x0;if(_0x4f323a[_0xdb00('0xf')]!==_0xdb00('0x10')){_0x2d7122(_0x4f323a);}db['User']['count']({'where':{'role':_0xdb00('0x10'),'online':!![],'id':{'$ne':_0x4f323a['id']}}})[_0xdb00('0x11')](function(_0x340d4d){_0x1bfbfe=_0x340d4d;return util[_0xdb00('0xe')]();})[_0xdb00('0x11')](function(_0x359460){if(_0x359460&&_0x359460[_0xdb00('0x12')]&&_0x1bfbfe>=_0x359460[_0xdb00('0x12')]){throw Error(_0xdb00('0x13'));}_0x2d7122(_0x4f323a);})['catch'](function(_0x4a8bb1){_0x5f219d(_0x4a8bb1);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 1c49bdb..9628881 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3dd=['exports','404','status','json','send'];(function(_0x1c011c,_0x384710){var _0x277506=function(_0x92ca26){while(--_0x92ca26){_0x1c011c['push'](_0x1c011c['shift']());}};_0x277506(++_0x384710);}(_0xf3dd,0xe1));var _0xdf3d=function(_0x151f00,_0x4ca3a1){_0x151f00=_0x151f00-0x0;var _0x418d9b=_0xf3dd[_0x151f00];return _0x418d9b;};'use strict';module[_0xdf3d('0x0')][0x194]=function pageNotFound(_0x4d994a,_0x3aa7f7){var _0x373031=_0xdf3d('0x1');var _0x29063d=0x194;var _0x5106ae={'status':_0x29063d};_0x3aa7f7['status'](_0x5106ae[_0xdf3d('0x2')]);_0x3aa7f7['render'](_0x373031,{},function(_0x3503c4,_0xb1537c){if(_0x3503c4){return _0x3aa7f7[_0xdf3d('0x2')](_0x5106ae[_0xdf3d('0x2')])[_0xdf3d('0x3')](_0x5106ae);}_0x3aa7f7[_0xdf3d('0x4')](_0xb1537c);});}; \ No newline at end of file +var _0x5d50=['exports','404','status','json','send'];(function(_0x1dc708,_0x293d95){var _0x415967=function(_0x529795){while(--_0x529795){_0x1dc708['push'](_0x1dc708['shift']());}};_0x415967(++_0x293d95);}(_0x5d50,0x17c));var _0x05d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d50[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x05d5('0x0')][0x194]=function pageNotFound(_0x21fb45,_0x15a5a8){var _0x22f384=_0x05d5('0x1');var _0xf4542c=0x194;var _0x31d7be={'status':_0xf4542c};_0x15a5a8[_0x05d5('0x2')](_0x31d7be['status']);_0x15a5a8['render'](_0x22f384,{},function(_0x480849,_0x2c59fe){if(_0x480849){return _0x15a5a8['status'](_0x31d7be['status'])[_0x05d5('0x3')](_0x31d7be);}_0x15a5a8[_0x05d5('0x4')](_0x2c59fe);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 12d7055..778a0f4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x368e=['cascade','hasMany','VoiceRecording','UserId','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','UserVoiceQueueRt','Members','VoiceQueueId','HopperHistories','CmHopperBlack','JscriptySessionReport','TrunkId','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','CmContact','Contact','MailAccountId','Imap','Smtp','Answers','Messages','Interactions','MailApplication','List','TemplateId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','ThroughTags','Users','Attachments','Interaction','restrict','IntervalId','MailQueueReport','ListId','ContactId','DashboardItem','Dispositions','FaxAccountId','Exntensions','TagId','fax_interaction_has_tags','Tags','FaxInteractionId','Attachment','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatWebsiteId','ChatGroupId','CompanyId','Hoppers','JscriptySessions','FaxInteractions','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','ParentId','Intervals','ChatApplications','FaxApplications','Schedule','CustomReportId','moh_has_sounds','mail_interaction_has_tags','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Description','DescriptionId','SugarcrmConfiguration','Subject','VariableId','int_desk_configuration_has_tags','ZohoAccount','Field','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','ServicenowConfiguration','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','SmsQueueReport','JscriptyProject','ProjectId','team_has_chat_queues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','CmCustomField','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','path','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Campaign','Migration','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x368e,0xeb));var _0xe368=function(_0x26f68f,_0x125079){_0x26f68f=_0x26f68f-0x0;var _0x3047dd=_0x368e[_0x26f68f];return _0x3047dd;};'use strict';var path=require(_0xe368('0x0'));var config=require(_0xe368('0x1'));var Sequelize=require('sequelize');var _=require(_0xe368('0x2'));var jstz=require(_0xe368('0x3'));var timezone=jstz[_0xe368('0x4')]();config['sequelize']=_[_0xe368('0x5')](config[_0xe368('0x6')],{'database':_0xe368('0x7'),'username':'xcall','password':_0xe368('0x8'),'options':{'host':_0xe368('0x9'),'port':0xcea,'dialect':_0xe368('0xa'),'dialectOptions':{'charset':_0xe368('0xb')},'logging':![],'timezone':timezone[_0xe368('0xc')](),'define':{'charset':_0xe368('0xd'),'collate':_0xe368('0xe')}}});config[_0xe368('0xf')]=_[_0xe368('0x5')](config[_0xe368('0xf')],{'database':_0xe368('0x7'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xe368('0x9'),'port':0xcea,'dialect':_0xe368('0xa'),'dialectOptions':{'charset':_0xe368('0xb')},'logging':![],'timezone':timezone[_0xe368('0xc')](),'define':{'charset':'utf8','collate':_0xe368('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe368('0x6')]['database'],config[_0xe368('0x6')][_0xe368('0x10')],config[_0xe368('0x6')][_0xe368('0x11')],config[_0xe368('0x6')][_0xe368('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe368('0xf')][_0xe368('0x13')],config[_0xe368('0xf')]['username'],config[_0xe368('0xf')][_0xe368('0x11')],config[_0xe368('0xf')][_0xe368('0x12')])};db[_0xe368('0x14')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x16'));db[_0xe368('0x17')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x18'));db[_0xe368('0x19')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x1a'));db[_0xe368('0x1b')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x1c'));db[_0xe368('0x1d')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x1e'));db[_0xe368('0x1f')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x20'));db['VoiceRecording']=db['sequelize']['import'](_0xe368('0x21'));db['ScreenRecording']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x22'));db[_0xe368('0x23')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x24'));db[_0xe368('0x25')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x26'));db[_0xe368('0x27')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x28'));db[_0xe368('0x29')]=db['sequelize'][_0xe368('0x15')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xe368('0x15')](_0xe368('0x2a'));db[_0xe368('0x2b')]=db[_0xe368('0x6')]['import'](_0xe368('0x2c'));db[_0xe368('0x2d')]=db[_0xe368('0x6')]['import'](_0xe368('0x2e'));db[_0xe368('0x2f')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x30'));db['UserVoiceQueueRt']=db['sequelize'][_0xe368('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe368('0x31')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xe368('0x32')]=db['sequelize'][_0xe368('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0xe368('0x33')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x34'));db[_0xe368('0x35')]=db['sequelize'][_0xe368('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0xe368('0x36')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x37'));db[_0xe368('0x38')]=db[_0xe368('0x6')]['import'](_0xe368('0x39'));db[_0xe368('0x3a')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x3b'));db[_0xe368('0x3c')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x3d'));db[_0xe368('0x3e')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x3f'));db['MailQueue']=db[_0xe368('0x6')][_0xe368('0x15')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0xe368('0x6')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xe368('0x40')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x41'));db[_0xe368('0x42')]=db[_0xe368('0x6')]['import'](_0xe368('0x43'));db['MailApplication']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x44'));db['MailQueueReport']=db[_0xe368('0x6')]['import'](_0xe368('0x45'));db[_0xe368('0x46')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x47'));db['DashboardItem']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x48'));db[_0xe368('0x49')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x4a'));db[_0xe368('0x4b')]=db[_0xe368('0x6')]['import'](_0xe368('0x4c'));db[_0xe368('0x4d')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x4e'));db[_0xe368('0x4f')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x50'));db[_0xe368('0x51')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x52'));db['FaxQueueReport']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x53'));db[_0xe368('0x54')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xe368('0x6')]['import'](_0xe368('0x55'));db[_0xe368('0x56')]=db[_0xe368('0x6')]['import'](_0xe368('0x57'));db[_0xe368('0x58')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x59'));db[_0xe368('0x5a')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x5b'));db['OpenchannelAccount']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x5c'));db[_0xe368('0x5d')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x5e'));db[_0xe368('0x5f')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x60'));db[_0xe368('0x61')]=db[_0xe368('0x6')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xe368('0x62')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x63'));db[_0xe368('0x64')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x65'));db[_0xe368('0x66')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x67'));db['ChatApplication']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x68'));db[_0xe368('0x69')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x6a'));db[_0xe368('0x6b')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x6c'));db[_0xe368('0x6d')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x6e'));db[_0xe368('0x6f')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x70'));db[_0xe368('0x71')]=db['sequelize']['import'](_0xe368('0x72'));db[_0xe368('0x73')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x74'));db[_0xe368('0x75')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x76'));db['CmContact']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x77'));db[_0xe368('0x78')]=db['sequelize']['import'](_0xe368('0x79'));db['CmHopperBlack']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x7a'));db[_0xe368('0x7b')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xe368('0x7c')]=db['sequelize']['import'](_0xe368('0x7d'));db['ReportAgentPreview']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x7e'));db['CmCustomField']=db['sequelize'][_0xe368('0x15')](_0xe368('0x7f'));db[_0xe368('0x80')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x81'));db[_0xe368('0x82')]=db['sequelize']['import'](_0xe368('0x83'));db[_0xe368('0x84')]=db[_0xe368('0x6')]['import'](_0xe368('0x85'));db[_0xe368('0x86')]=db[_0xe368('0x6')]['import'](_0xe368('0x87'));db[_0xe368('0x88')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x89'));db['Interval']=db[_0xe368('0x6')]['import']('../api/interval/interval.model');db['Pause']=db['sequelize'][_0xe368('0x15')](_0xe368('0x8a'));db[_0xe368('0x8b')]=db[_0xe368('0x6')]['import']('../api/cdr/cdr.model');db[_0xe368('0x8c')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x8d'));db['Schedule']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x8e'));db[_0xe368('0x8f')]=db[_0xe368('0x6')]['import']('../api/sound/sound.model');db[_0xe368('0x90')]=db[_0xe368('0x6')]['import'](_0xe368('0x91'));db[_0xe368('0x92')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x93'));db[_0xe368('0x94')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x95'));db[_0xe368('0x96')]=db['sequelize']['import'](_0xe368('0x97'));db['Integration']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x98'));db[_0xe368('0x99')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x9a'));db[_0xe368('0x9b')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x9c'));db[_0xe368('0x9d')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x9e'));db[_0xe368('0x9f')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xa0'));db[_0xe368('0xa1')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0xe368('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xe368('0x6')]['import'](_0xe368('0xa2'));db[_0xe368('0xa3')]=db[_0xe368('0x6')]['import'](_0xe368('0xa4'));db[_0xe368('0xa5')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xa6'));db[_0xe368('0xa7')]=db['sequelize'][_0xe368('0x15')](_0xe368('0xa8'));db[_0xe368('0xa9')]=db['sequelize'][_0xe368('0x15')](_0xe368('0xaa'));db['SugarcrmConfiguration']=db[_0xe368('0x6')]['import'](_0xe368('0xab'));db[_0xe368('0xac')]=db[_0xe368('0x6')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0xe368('0xad')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xae'));db[_0xe368('0xaf')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xb0'));db[_0xe368('0xb1')]=db['sequelize'][_0xe368('0x15')](_0xe368('0xb2'));db['ZohoAccount']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xb3'));db[_0xe368('0xb4')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xb5'));db[_0xe368('0xb6')]=db[_0xe368('0x6')]['import'](_0xe368('0xb7'));db['ZendeskAccount']=db[_0xe368('0x6')][_0xe368('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe368('0xb8')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xb9'));db[_0xe368('0xba')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0xe368('0xbb')]=db['sequelize']['import'](_0xe368('0xbc'));db['FreshdeskConfiguration']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xbd'));db['FreshdeskField']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xbe'));db[_0xe368('0xbf')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xc0'));db[_0xe368('0xc1')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xe368('0xc2')]=db[_0xe368('0x6')]['import'](_0xe368('0xc3'));db[_0xe368('0xc4')]=db['sequelize']['import'](_0xe368('0xc5'));db['ServicenowConfiguration']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xc6'));db[_0xe368('0xc7')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0xe368('0xc8')]=db[_0xe368('0x6')]['import'](_0xe368('0xc9'));db[_0xe368('0xca')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xe368('0xcb')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xcc'));db[_0xe368('0xcd')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xce'));db[_0xe368('0xcf')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xd0'));db['Integration']=db['sequelize'][_0xe368('0x15')](_0xe368('0x98'));db[_0xe368('0xd1')]=db['sequelize'][_0xe368('0x15')](_0xe368('0xd2'));db[_0xe368('0xd3')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xd4'));db[_0xe368('0xd5')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xd6'));db['JscriptyAnswerReport']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xd7'));db['JscriptyQuestionReport']=db[_0xe368('0x6')][_0xe368('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize'][_0xe368('0x15')](_0xe368('0xd8'));db['SmsQueueReport']=db['sequelize'][_0xe368('0x15')](_0xe368('0xd9'));db['SquareReport']=db['sequelize'][_0xe368('0x15')](_0xe368('0xda'));db[_0xe368('0xdb')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xdc'));db['JscriptyProject']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xdd'));db[_0xe368('0xde')]=db[_0xe368('0x6')]['import'](_0xe368('0xdf'));db[_0xe368('0xe0')]=db[_0xe368('0x6')]['import']('../api/squareOdbc/squareOdbc.model');db[_0xe368('0xe1')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xe2'));db[_0xe368('0xe3')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xe4'));db[_0xe368('0xe5')]=db[_0xe368('0x6')]['import'](_0xe368('0xe6'));db['Team']=db[_0xe368('0x6')]['import']('../api/team/team.model');db[_0xe368('0xe7')]=db[_0xe368('0x6')]['import']('../api/license/license.model');db[_0xe368('0xe8')]=db[_0xe368('0x6')]['import']('../api/campaign/campaign.model');db[_0xe368('0xe9')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xea'));db['Attachment']=db['sequelize'][_0xe368('0x15')]('../api/attachment/attachment.model');db[_0xe368('0xeb')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xec'));db['MailTransferReport']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xed'));db[_0xe368('0xee')]=db['sequelize'][_0xe368('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0xe368('0xef')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xf0'));db[_0xe368('0xf1')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xe368('0xf2')]=db[_0xe368('0x6')]['import'](_0xe368('0xf3'));db[_0xe368('0xf4')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xf5'));db[_0xe368('0xf6')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xf7'));db[_0xe368('0xf8')]=db[_0xe368('0x6')]['import'](_0xe368('0xf9'));db[_0xe368('0xfa')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xfb'));db[_0xe368('0xfc')]=db[_0xe368('0x6')][_0xe368('0x15')]('../api/notification/notification.model');db[_0xe368('0xfd')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xfe'));db['WhatsappApplication']=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0xff'));db[_0xe368('0x100')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x101'));db['WhatsappMessage']=db[_0xe368('0x6')][_0xe368('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0xe368('0x102')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x103'));db[_0xe368('0x104')]=db[_0xe368('0x6')][_0xe368('0x15')](_0xe368('0x105'));db['WhatsappQueue']=db['sequelize'][_0xe368('0x15')](_0xe368('0x106'));db[_0xe368('0x107')]=db['sequelize'][_0xe368('0x15')](_0xe368('0x108'));db[_0xe368('0x14')][_0xe368('0x109')](db[_0xe368('0x23')],{'as':_0xe368('0x23'),'onDelete':_0xe368('0x10a'),'foreignKey':'UserId'});db[_0xe368('0x14')][_0xe368('0x10b')](db[_0xe368('0x10c')],{'as':'Recordings','foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')][_0xe368('0x10b')](db['UserVoiceQueueRt'],{'as':_0xe368('0x10e'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')]['hasMany'](db[_0xe368('0x1b')],{'as':_0xe368('0x10f'),'onDelete':_0xe368('0x10a'),'hooks':!![]});db[_0xe368('0x14')]['hasMany'](db['CmHopperFinal'],{'as':_0xe368('0x110'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')]['hasMany'](db[_0xe368('0x7c')],{'as':_0xe368('0x111'),'foreignKey':_0xe368('0x10d')});db['User']['hasMany'](db[_0xe368('0x112')],{'as':'ReportAgentPreview','foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')][_0xe368('0x10b')](db[_0xe368('0x5f')],{'as':_0xe368('0x113'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')][_0xe368('0x10b')](db['ChatInteraction'],{'as':_0xe368('0x114'),'foreignKey':_0xe368('0x10d')});db['User']['hasMany'](db[_0xe368('0x56')],{'as':_0xe368('0x115'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')]['hasMany'](db[_0xe368('0x4d')],{'as':'FaxInteractions','foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')]['hasMany'](db[_0xe368('0x40')],{'as':_0xe368('0x116'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x14')][_0xe368('0x10b')](db['WhatsappInteraction'],{'as':_0xe368('0x117'),'foreignKey':_0xe368('0x10d')});db['User']['hasMany'](db[_0xe368('0xfc')],{'as':'Notifications','foreignKey':_0xe368('0x118')});db[_0xe368('0x14')][_0xe368('0x119')](db[_0xe368('0x11a')],{'as':_0xe368('0x11a'),'foreignKey':_0xe368('0x11b')});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0x71')],{'as':_0xe368('0x11d'),'through':_0xe368('0x11e')});db[_0xe368('0x14')]['belongsToMany'](db['CmContact'],{'as':_0xe368('0x11f'),'through':_0xe368('0x120')});db['User'][_0xe368('0x11c')](db[_0xe368('0xf4')],{'as':_0xe368('0x121'),'through':_0xe368('0x122')});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0x123')],{'through':_0xe368('0x124')});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0x40')],{'as':_0xe368('0x116'),'through':_0xe368('0x125')});db[_0xe368('0x14')][_0xe368('0x11c')](db['ChatInteraction'],{'as':_0xe368('0x114'),'through':'user_has_chat_interactions'});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0x4d')],{'as':'FaxInteractions','through':_0xe368('0x126')});db[_0xe368('0x14')][_0xe368('0x11c')](db['SmsInteraction'],{'as':_0xe368('0x115'),'through':_0xe368('0x127')});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0x5f')],{'as':_0xe368('0x113'),'through':_0xe368('0x128')});db[_0xe368('0x14')][_0xe368('0x11c')](db['WhatsappInteraction'],{'as':_0xe368('0x117'),'through':_0xe368('0x129')});db['User'][_0xe368('0x11c')](db[_0xe368('0x1f')],{'as':_0xe368('0x12a'),'through':'UserVoiceQueue','required':![]});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0x12b')],{'as':_0xe368('0x12c'),'through':_0xe368('0x33'),'required':![]});db[_0xe368('0x14')][_0xe368('0x11c')](db['ChatQueue'],{'as':_0xe368('0x12d'),'through':_0xe368('0x32'),'required':![],'hooks':!![]});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0x51')],{'as':_0xe368('0x12e'),'through':'UserFaxQueue','required':![]});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0x5a')],{'as':_0xe368('0x12f'),'through':_0xe368('0x35'),'required':![]});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0x62')],{'as':'OpenchannelQueues','through':_0xe368('0x36'),'required':![]});db['User'][_0xe368('0x11c')](db[_0xe368('0x130')],{'as':_0xe368('0x131'),'through':'UserWhatsappQueue','required':![]});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0xf4')],{'through':_0xe368('0x122')});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0xf6')],{'as':_0xe368('0x132'),'through':_0xe368('0x133'),'required':![]});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0x64')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0xe368('0x11c')](db[_0xe368('0x49')],{'as':_0xe368('0x134'),'through':_0xe368('0x135')});db['User'][_0xe368('0x11c')](db[_0xe368('0x3e')],{'as':_0xe368('0x136'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0xe368('0x137')],{'as':_0xe368('0x138'),'through':'user_has_openchannel_accounts'});db[_0xe368('0x14')]['belongsToMany'](db['SmsAccount'],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xe368('0x14')][_0xe368('0x11c')](db[_0xe368('0xfd')],{'as':_0xe368('0x139'),'through':_0xe368('0x13a')});db[_0xe368('0x14')]['belongsToMany'](db[_0xe368('0xe1')],{'as':'SquareProjects','through':_0xe368('0x13b')});db[_0xe368('0x17')][_0xe368('0x10b')](db[_0xe368('0x1b')],{'as':_0xe368('0x13c'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x13d')});db[_0xe368('0x19')][_0xe368('0x10b')](db['VoiceExtension'],{'onDelete':_0xe368('0x10a')});db[_0xe368('0x1b')][_0xe368('0x10b')](db[_0xe368('0x1b')],{'as':_0xe368('0x13e'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x1d')][_0xe368('0x11c')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0xe368('0x1f')][_0xe368('0x10b')](db[_0xe368('0x13f')],{'as':_0xe368('0x140'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe368('0x10b')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xe368('0x141')});db['VoiceQueue'][_0xe368('0x10b')](db[_0xe368('0x7b')],{'as':_0xe368('0x110'),'foreignKey':_0xe368('0x141')});db[_0xe368('0x1f')][_0xe368('0x10b')](db[_0xe368('0x7c')],{'as':_0xe368('0x142'),'foreignKey':'VoiceQueueId'});db[_0xe368('0x1f')][_0xe368('0x10b')](db[_0xe368('0x112')],{'as':_0xe368('0x112'),'foreignKey':_0xe368('0x141')});db[_0xe368('0x1f')][_0xe368('0x10b')](db[_0xe368('0x143')],{'as':'HopperBlacks','foreignKey':_0xe368('0x141')});db['VoiceQueue']['hasMany'](db[_0xe368('0x144')],{'as':'JscriptySessions','foreignKey':_0xe368('0x141')});db['VoiceQueue'][_0xe368('0x119')](db[_0xe368('0x2f')],{'as':'Trunk','foreignKey':_0xe368('0x145')});db[_0xe368('0x1f')]['belongsTo'](db[_0xe368('0x2f')],{'as':_0xe368('0x146'),'foreignKey':_0xe368('0x147')});db['VoiceQueue']['belongsTo'](db[_0xe368('0x148')],{'as':_0xe368('0x148'),'foreignKey':'IntervalId'});db[_0xe368('0x1f')]['belongsTo'](db[_0xe368('0x149')],{'as':_0xe368('0x14a'),'foreignKey':_0xe368('0x14b')});db[_0xe368('0x1f')][_0xe368('0x11c')](db[_0xe368('0xf4')],{'as':_0xe368('0x121'),'through':_0xe368('0x14c')});db['VoiceQueue'][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x14d'),'through':'UserVoiceQueue'});db[_0xe368('0x1f')][_0xe368('0x11c')](db[_0xe368('0x123')],{'as':_0xe368('0x14e'),'through':_0xe368('0x14f')});db[_0xe368('0x1f')][_0xe368('0x11c')](db[_0xe368('0xf4')],{'as':_0xe368('0x150'),'through':_0xe368('0x151')});db[_0xe368('0x10c')]['belongsTo'](db[_0xe368('0x14')],{'as':_0xe368('0x14'),'foreignKey':_0xe368('0x10d')});db['ScreenRecording'][_0xe368('0x119')](db['User'],{'as':_0xe368('0x14'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x23')][_0xe368('0x10b')](db[_0xe368('0x25')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xe368('0x152'),'sourceKey':_0xe368('0x153')});db['VoiceMailMessage'][_0xe368('0x119')](db[_0xe368('0x23')],{'foreignKey':_0xe368('0x152'),'targetKey':'mailbox'});db[_0xe368('0x27')][_0xe368('0x10b')](db[_0xe368('0x2b')],{'as':_0xe368('0x154'),'foreignKey':_0xe368('0x155'),'constraints':![]});db['VoiceCallReport'][_0xe368('0x10b')](db[_0xe368('0x156')],{'as':_0xe368('0x157'),'foreignKey':_0xe368('0x155'),'constraints':![]});db[_0xe368('0x27')]['belongsTo'](db[_0xe368('0x14')],{'as':_0xe368('0x14'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x27')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':'ContactId'});db[_0xe368('0x3a')][_0xe368('0x119')](db['MailAccount'],{'as':_0xe368('0x3e'),'foreignKey':'MailAccountId'});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0xe368('0x3e'),'foreignKey':_0xe368('0x15a')});db['MailAccount'][_0xe368('0x109')](db['MailServerIn'],{'as':_0xe368('0x15b'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x3e')][_0xe368('0x109')](db[_0xe368('0x3c')],{'as':_0xe368('0x15c'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x3e')][_0xe368('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':'MailAccountId'});db['MailAccount'][_0xe368('0x10b')](db[_0xe368('0x84')],{'as':_0xe368('0x15d'),'foreignKey':_0xe368('0x15a')});db['MailAccount'][_0xe368('0x10b')](db[_0xe368('0x42')],{'as':_0xe368('0x15e'),'foreignKey':_0xe368('0x15a')});db[_0xe368('0x3e')][_0xe368('0x10b')](db[_0xe368('0x40')],{'as':_0xe368('0x15f')});db[_0xe368('0x3e')]['hasMany'](db[_0xe368('0x160')],{'as':_0xe368('0x13e')});db[_0xe368('0x3e')]['belongsTo'](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':'ListId'});db['MailAccount']['belongsTo'](db[_0xe368('0x92')],{'as':'Template','foreignKey':_0xe368('0x162')});db['MailAccount']['belongsTo'](db[_0xe368('0x149')],{'as':'mandatoryDispositionPause','foreignKey':_0xe368('0x14b')});db[_0xe368('0x3e')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x14d'),'through':_0xe368('0x163')});db['MailQueue'][_0xe368('0x11c')](db['User'],{'as':_0xe368('0x14d'),'through':_0xe368('0x33')});db[_0xe368('0x12b')][_0xe368('0x11c')](db[_0xe368('0x123')],{'through':_0xe368('0x164'),'as':_0xe368('0x14e')});db[_0xe368('0x40')][_0xe368('0x10b')](db['MailMessage'],{'as':_0xe368('0x15e'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x165')});db['MailInteraction'][_0xe368('0x119')](db['MailAccount'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x15a')});db[_0xe368('0x40')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':'ContactId'});db[_0xe368('0x40')]['belongsTo'](db[_0xe368('0x14')],{'as':_0xe368('0x167'),'foreignKey':_0xe368('0x10d')});db['MailInteraction'][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction'][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':'mail_interaction_has_tags','as':_0xe368('0x168')});db[_0xe368('0x40')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x169'),'through':_0xe368('0x125'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xe368('0x10b')](db['Attachment'],{'as':_0xe368('0x16a'),'onDelete':'cascade'});db['MailMessage'][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x14')});db['MailMessage'][_0xe368('0x119')](db[_0xe368('0x158')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x159')});db[_0xe368('0x42')]['belongsTo'](db[_0xe368('0x40')],{'as':_0xe368('0x16b'),'foreignKey':_0xe368('0x165')});db[_0xe368('0x42')]['belongsTo'](db['MailAccount'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x15a')});db[_0xe368('0x160')][_0xe368('0x119')](db['User'],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x160')][_0xe368('0x119')](db[_0xe368('0x12b')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x160')]['belongsTo'](db['MailAccount'],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x160')]['belongsTo'](db['Interval'],{'onDelete':_0xe368('0x16c'),'foreignKey':_0xe368('0x16d')});db['MailApplication'][_0xe368('0x119')](db[_0xe368('0x90')],{'onDelete':_0xe368('0x16c'),'foreignKey':'TagId'});db[_0xe368('0x16e')]['belongsTo'](db['MailAccount'],{});db['MailQueueReport'][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':_0xe368('0x16f')});db[_0xe368('0x16e')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x16e')]['belongsTo'](db[_0xe368('0x40')],{});db[_0xe368('0x16e')][_0xe368('0x119')](db[_0xe368('0x42')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0xe368('0x12b')],{});db[_0xe368('0x46')][_0xe368('0x10b')](db[_0xe368('0x171')],{'as':'Items','onDelete':'cascade'});db[_0xe368('0x49')][_0xe368('0x10b')](db['Disposition'],{'as':_0xe368('0x172'),'foreignKey':_0xe368('0x173')});db[_0xe368('0x49')][_0xe368('0x10b')](db[_0xe368('0x84')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xe368('0x49')]['hasMany'](db['FaxInteraction'],{'as':_0xe368('0x15f')});db[_0xe368('0x49')][_0xe368('0x10b')](db[_0xe368('0x4b')],{'as':'Applications'});db['FaxAccount'][_0xe368('0x10b')](db[_0xe368('0x1b')],{'as':_0xe368('0x174'),'onDelete':_0xe368('0x10a')});db['FaxAccount'][_0xe368('0x10b')](db['FaxMessage'],{'as':_0xe368('0x15e')});db[_0xe368('0x49')][_0xe368('0x119')](db[_0xe368('0x2f')],{'as':_0xe368('0x2f')});db[_0xe368('0x49')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':'ListId'});db['FaxAccount'][_0xe368('0x119')](db[_0xe368('0x149')],{'as':'mandatoryDispositionPause','foreignKey':_0xe368('0x14b')});db['FaxAccount'][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x14d'),'through':_0xe368('0x135')});db['FaxApplication'][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x4b')][_0xe368('0x119')](db['FaxQueue'],{'onDelete':'restrict'});db[_0xe368('0x4b')][_0xe368('0x119')](db[_0xe368('0x49')],{'onDelete':'restrict'});db[_0xe368('0x4b')][_0xe368('0x119')](db[_0xe368('0x90')],{'onDelete':_0xe368('0x16c'),'foreignKey':_0xe368('0x175')});db[_0xe368('0x4d')][_0xe368('0x10b')](db[_0xe368('0x4f')],{'as':_0xe368('0x15e'),'onDelete':_0xe368('0x10a'),'foreignKey':'FaxInteractionId'});db[_0xe368('0x4d')]['belongsTo'](db[_0xe368('0x49')],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x173')});db[_0xe368('0x4d')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe368('0x4d')][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x167'),'foreignKey':'UserId'});db[_0xe368('0x4d')][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x176'),'as':_0xe368('0x177')});db['FaxInteraction'][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x176'),'as':_0xe368('0x168')});db[_0xe368('0x4d')]['belongsToMany'](db[_0xe368('0x14')],{'as':_0xe368('0x169'),'through':_0xe368('0x126'),'foreignKey':'FaxInteractionId'});db[_0xe368('0x4f')][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x14')});db[_0xe368('0x4f')]['belongsTo'](db[_0xe368('0x4d')],{'as':_0xe368('0x16b'),'foreignKey':_0xe368('0x178')});db[_0xe368('0x4f')][_0xe368('0x119')](db[_0xe368('0x158')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x159')});db[_0xe368('0x4f')]['belongsTo'](db[_0xe368('0x179')],{'as':'Attachment','foreignKey':_0xe368('0x17a')});db[_0xe368('0x4f')]['belongsTo'](db[_0xe368('0x49')],{'as':'Account','foreignKey':_0xe368('0x173')});db[_0xe368('0x51')]['belongsToMany'](db['User'],{'as':_0xe368('0x14d'),'through':_0xe368('0x17b')});db[_0xe368('0x51')][_0xe368('0x11c')](db[_0xe368('0x123')],{'through':_0xe368('0x17c'),'as':_0xe368('0x14e')});db['FaxQueueReport'][_0xe368('0x119')](db['FaxAccount'],{});db[_0xe368('0x17d')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0xe368('0x17d')]['belongsTo'](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x17d')]['belongsTo'](db[_0xe368('0x4d')],{});db['FaxQueueReport'][_0xe368('0x119')](db[_0xe368('0x4f')],{});db[_0xe368('0x17d')][_0xe368('0x119')](db[_0xe368('0x14')],{});db[_0xe368('0x17d')]['belongsTo'](db[_0xe368('0x51')],{});db[_0xe368('0x54')][_0xe368('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe368('0x17e')});db[_0xe368('0x54')][_0xe368('0x10b')](db[_0xe368('0x84')],{'as':_0xe368('0x15d'),'foreignKey':_0xe368('0x17e')});db[_0xe368('0x54')]['hasMany'](db[_0xe368('0x58')],{'as':'Messages','foreignKey':_0xe368('0x17e')});db[_0xe368('0x54')]['hasMany'](db[_0xe368('0x56')],{'as':_0xe368('0x15f')});db[_0xe368('0x54')][_0xe368('0x10b')](db[_0xe368('0x17f')],{'as':'Applications'});db['SmsAccount'][_0xe368('0x119')](db['CmList'],{'as':'List','foreignKey':_0xe368('0x16f')});db[_0xe368('0x54')][_0xe368('0x119')](db[_0xe368('0x149')],{'as':_0xe368('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe368('0x54')]['belongsToMany'](db['User'],{'as':_0xe368('0x14d'),'through':'user_has_sms_accounts'});db[_0xe368('0x17f')][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x17f')][_0xe368('0x119')](db[_0xe368('0x5a')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x17f')][_0xe368('0x119')](db[_0xe368('0x54')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x17f')]['belongsTo'](db[_0xe368('0x148')],{'onDelete':_0xe368('0x16c'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xe368('0x119')](db[_0xe368('0x90')],{'onDelete':_0xe368('0x16c'),'foreignKey':_0xe368('0x175')});db[_0xe368('0x56')][_0xe368('0x10b')](db[_0xe368('0x58')],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xe368('0x56')][_0xe368('0x119')](db['SmsAccount'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x17e')});db[_0xe368('0x56')]['belongsTo'](db['CmContact'],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x56')][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x167'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x56')][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x180'),'as':_0xe368('0x177')});db['SmsInteraction'][_0xe368('0x11c')](db['Tag'],{'through':_0xe368('0x180'),'as':_0xe368('0x168')});db[_0xe368('0x56')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x169'),'through':'user_has_sms_interactions','foreignKey':_0xe368('0x181')});db[_0xe368('0x58')]['belongsTo'](db['User'],{'as':_0xe368('0x14')});db[_0xe368('0x58')]['belongsTo'](db[_0xe368('0x158')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x159')});db[_0xe368('0x58')][_0xe368('0x119')](db[_0xe368('0x56')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x16b'),'foreignKey':_0xe368('0x181')});db[_0xe368('0x58')][_0xe368('0x119')](db['SmsAccount'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x17e')});db[_0xe368('0x5a')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x14d'),'through':_0xe368('0x35'),'foreignKey':_0xe368('0x182')});db[_0xe368('0x5a')][_0xe368('0x11c')](db[_0xe368('0x123')],{'through':_0xe368('0x183'),'as':_0xe368('0x14e')});db[_0xe368('0x137')][_0xe368('0x10b')](db['Disposition'],{'as':_0xe368('0x172'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xe368('0x84')],{'as':_0xe368('0x15d'),'foreignKey':_0xe368('0x184')});db[_0xe368('0x137')][_0xe368('0x10b')](db['OpenchannelInteraction'],{'as':_0xe368('0x15f'),'foreignKey':_0xe368('0x184')});db['OpenchannelAccount']['hasMany'](db[_0xe368('0x61')],{'as':_0xe368('0x15e'),'foreignKey':_0xe368('0x184')});db['OpenchannelAccount'][_0xe368('0x10b')](db[_0xe368('0x5d')],{'as':_0xe368('0x13e'),'foreignKey':_0xe368('0x184')});db['OpenchannelAccount'][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':'List','foreignKey':_0xe368('0x16f')});db[_0xe368('0x137')][_0xe368('0x119')](db[_0xe368('0x149')],{'as':_0xe368('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe368('0x137')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':'Agents','through':_0xe368('0x185')});db[_0xe368('0x5d')][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':_0xe368('0x16c')});db['OpenchannelApplication']['belongsTo'](db[_0xe368('0x62')],{'onDelete':_0xe368('0x16c'),'foreignKey':_0xe368('0x186')});db[_0xe368('0x5d')][_0xe368('0x119')](db[_0xe368('0x137')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xe368('0x5d')][_0xe368('0x119')](db['Interval'],{'onDelete':_0xe368('0x16c'),'foreignKey':_0xe368('0x16d')});db[_0xe368('0x5d')][_0xe368('0x119')](db[_0xe368('0x90')],{'onDelete':'restrict','foreignKey':_0xe368('0x175')});db['OpenchannelInteraction'][_0xe368('0x10b')](db[_0xe368('0x61')],{'as':_0xe368('0x15e'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xe368('0x5f')][_0xe368('0x119')](db[_0xe368('0x137')],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x184')});db['OpenchannelInteraction'][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x5f')][_0xe368('0x119')](db['User'],{'as':_0xe368('0x167'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x5f')]['belongsToMany'](db[_0xe368('0x90')],{'through':'openchannel_interaction_has_tags','as':_0xe368('0x177')});db['OpenchannelInteraction'][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':'openchannel_interaction_has_tags','as':_0xe368('0x168')});db[_0xe368('0x5f')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':'Users','through':_0xe368('0x128'),'foreignKey':_0xe368('0x187')});db[_0xe368('0x61')]['belongsTo'](db[_0xe368('0x14')],{'onDelete':_0xe368('0x10a'),'as':'User'});db[_0xe368('0x61')][_0xe368('0x119')](db[_0xe368('0x158')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x159')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0xe368('0x16b'),'foreignKey':_0xe368('0x187')});db[_0xe368('0x61')][_0xe368('0x119')](db[_0xe368('0x179')],{'as':'Attachment','foreignKey':_0xe368('0x17a')});db[_0xe368('0x61')][_0xe368('0x119')](db[_0xe368('0x137')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':'Agents','through':_0xe368('0x36'),'foreignKey':_0xe368('0x186')});db['OpenchannelQueue'][_0xe368('0x11c')](db['Team'],{'through':_0xe368('0x188'),'as':_0xe368('0x14e')});db['ChatWebsite'][_0xe368('0x10b')](db[_0xe368('0x86')],{'as':_0xe368('0x172'),'foreignKey':'ChatWebsiteId'});db[_0xe368('0x64')]['hasMany'](db[_0xe368('0x84')],{'as':_0xe368('0x15d'),'foreignKey':'ChatWebsiteId'});db[_0xe368('0x64')][_0xe368('0x10b')](db[_0xe368('0x73')],{'as':_0xe368('0x189')});db[_0xe368('0x64')]['hasMany'](db['ChatInteraction'],{'as':_0xe368('0x15f')});db['ChatWebsite']['hasMany'](db[_0xe368('0x18a')],{'as':'Applications'});db['ChatWebsite']['hasMany'](db[_0xe368('0x6b')],{'as':_0xe368('0x15e')});db[_0xe368('0x64')]['belongsTo'](db[_0xe368('0xf4')],{'as':'List','foreignKey':_0xe368('0x16f')});db['ChatWebsite']['belongsTo'](db[_0xe368('0x148')],{'as':_0xe368('0x148'),'foreignKey':_0xe368('0x16d')});db['ChatWebsite'][_0xe368('0x119')](db[_0xe368('0x149')],{'as':'mandatoryDispositionPause','foreignKey':_0xe368('0x14b')});db[_0xe368('0x64')]['belongsToMany'](db[_0xe368('0x14')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xe368('0x119')](db[_0xe368('0x137')],{});db[_0xe368('0x66')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':_0xe368('0x16f')});db['OpenchannelQueueReport'][_0xe368('0x119')](db['CmContact'],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x66')]['belongsTo'](db[_0xe368('0x5f')],{});db[_0xe368('0x66')][_0xe368('0x119')](db[_0xe368('0x61')],{});db[_0xe368('0x66')][_0xe368('0x119')](db[_0xe368('0x14')],{});db['OpenchannelQueueReport'][_0xe368('0x119')](db[_0xe368('0x62')],{});db[_0xe368('0x18a')][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x18b'),'foreignKey':_0xe368('0x10d'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db['ChatQueue'],{'as':'Queue','foreignKey':_0xe368('0x18c'),'onDelete':_0xe368('0x16c')});db['ChatApplication']['belongsTo'](db[_0xe368('0x64')],{'as':_0xe368('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0xe368('0x16c')});db[_0xe368('0x18a')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe368('0x175')});db[_0xe368('0x69')][_0xe368('0x10b')](db[_0xe368('0x6b')],{'as':_0xe368('0x15e'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0xe368('0x69')][_0xe368('0x119')](db[_0xe368('0x64')],{'as':_0xe368('0x166'),'foreignKey':'ChatWebsiteId'});db[_0xe368('0x69')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x69')][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x167'),'foreignKey':_0xe368('0x10d')});db[_0xe368('0x69')][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x18e'),'as':_0xe368('0x177')});db['ChatInteraction'][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x18e'),'as':_0xe368('0x168')});db['ChatInteraction'][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x169'),'through':_0xe368('0x18f'),'foreignKey':_0xe368('0x190')});db[_0xe368('0x6b')][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x14')});db[_0xe368('0x6b')]['belongsTo'](db[_0xe368('0x158')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x6b')][_0xe368('0x119')](db[_0xe368('0x69')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x16b'),'foreignKey':_0xe368('0x190')});db[_0xe368('0x6b')][_0xe368('0x119')](db['Attachment'],{'as':_0xe368('0x179'),'foreignKey':_0xe368('0x17a')});db[_0xe368('0x6b')]['belongsTo'](db[_0xe368('0x64')],{'as':'Account','foreignKey':_0xe368('0x191')});db[_0xe368('0x6d')][_0xe368('0x119')](db['CmContact'],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x6d')][_0xe368('0x119')](db['ChatWebsite'],{'as':_0xe368('0x166'),'foreignKey':'ChatWebsiteId'});db[_0xe368('0x6f')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':'Agents','through':_0xe368('0x32'),'hooks':!![]});db[_0xe368('0x6f')][_0xe368('0x11c')](db[_0xe368('0x123')],{'through':'team_has_chat_queues','as':_0xe368('0x14e')});db[_0xe368('0x71')][_0xe368('0x10b')](db['ChatInternalMessage'],{'as':_0xe368('0x15e'),'foreignKey':_0xe368('0x192'),'onDelete':'cascade'});db[_0xe368('0x71')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x140'),'through':_0xe368('0x11e')});db[_0xe368('0x73')][_0xe368('0x119')](db[_0xe368('0x64')],{'as':_0xe368('0x18d'),'foreignKey':'ChatWebsiteId'});db[_0xe368('0x75')][_0xe368('0x10b')](db[_0xe368('0x158')],{'as':'Contacts','foreignKey':_0xe368('0x193')});db[_0xe368('0x158')][_0xe368('0x10b')](db[_0xe368('0x78')],{'as':_0xe368('0x194'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x158')]['hasMany'](db[_0xe368('0x7b')],{'as':'HopperFinals','foreignKey':_0xe368('0x170')});db['CmContact'][_0xe368('0x10b')](db['CmHopperHistory'],{'as':_0xe368('0x142'),'foreignKey':'ContactId'});db['CmContact'][_0xe368('0x10b')](db['ReportAgentPreview'],{'as':_0xe368('0x112'),'foreignKey':'ContactId'});db[_0xe368('0x158')][_0xe368('0x10b')](db[_0xe368('0x144')],{'as':_0xe368('0x195'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x158')][_0xe368('0x10b')](db[_0xe368('0x5f')],{'as':_0xe368('0x113'),'foreignKey':'ContactId','onDelete':_0xe368('0x16c')});db['CmContact']['hasMany'](db[_0xe368('0x69')],{'as':_0xe368('0x114'),'foreignKey':_0xe368('0x170'),'onDelete':'restrict'});db[_0xe368('0x158')][_0xe368('0x10b')](db[_0xe368('0x56')],{'as':_0xe368('0x115'),'foreignKey':_0xe368('0x170'),'onDelete':_0xe368('0x16c')});db[_0xe368('0x158')][_0xe368('0x10b')](db[_0xe368('0x4d')],{'as':_0xe368('0x196'),'foreignKey':_0xe368('0x170'),'onDelete':_0xe368('0x16c')});db[_0xe368('0x158')][_0xe368('0x10b')](db[_0xe368('0x40')],{'as':'MailInteractions','foreignKey':_0xe368('0x170'),'onDelete':_0xe368('0x16c')});db[_0xe368('0x158')][_0xe368('0x119')](db[_0xe368('0x75')],{'as':_0xe368('0x197'),'foreignKey':_0xe368('0x193')});db[_0xe368('0x158')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':_0xe368('0x16f'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x158')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':_0xe368('0x169'),'through':'cm_user_has_contacts'});db[_0xe368('0x158')][_0xe368('0x11c')](db[_0xe368('0x90')],{'as':_0xe368('0x177'),'through':_0xe368('0x198')});db[_0xe368('0x158')][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x198'),'as':_0xe368('0x168')});db['CmHopper']['belongsTo'](db[_0xe368('0x158')],{'as':'Contact','foreignKey':_0xe368('0x170'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x78')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':_0xe368('0x16f'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x78')][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x18b'),'foreignKey':_0xe368('0x10d')});db['CmHopper'][_0xe368('0x119')](db[_0xe368('0x1f')],{'as':_0xe368('0x199'),'foreignKey':'VoiceQueueId','onDelete':_0xe368('0x10a')});db[_0xe368('0x78')][_0xe368('0x119')](db[_0xe368('0xe8')],{'as':_0xe368('0xe8'),'foreignKey':_0xe368('0x19a'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x78')][_0xe368('0x119')](db['User'],{'as':_0xe368('0x167'),'foreignKey':_0xe368('0x19b')});db[_0xe368('0x143')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':'Contact','foreignKey':_0xe368('0x170'),'onDelete':'cascade'});db[_0xe368('0x143')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':'ListId','onDelete':_0xe368('0x10a')});db[_0xe368('0x143')][_0xe368('0x119')](db[_0xe368('0x1f')],{'as':_0xe368('0x199'),'foreignKey':_0xe368('0x141'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x143')]['belongsTo'](db[_0xe368('0xe8')],{'as':_0xe368('0xe8'),'foreignKey':_0xe368('0x19a'),'onDelete':'cascade'});db[_0xe368('0x82')][_0xe368('0x10b')](db[_0xe368('0x88')],{'as':{'plural':_0xe368('0x19c'),'singular':_0xe368('0x19d')},'foreignKey':_0xe368('0x19e'),'onDelete':_0xe368('0x10a'),'hooks':!![]});db[_0xe368('0x82')][_0xe368('0x10b')](db[_0xe368('0x88')],{'as':{'plural':_0xe368('0x19f'),'singular':'OneAny'},'foreignKey':_0xe368('0x1a0'),'onDelete':_0xe368('0x10a'),'hooks':!![]});db['Automation'][_0xe368('0x10b')](db[_0xe368('0x80')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xe368('0x86')][_0xe368('0x10b')](db[_0xe368('0x86')],{'as':_0xe368('0x172'),'foreignKey':_0xe368('0x1a1'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x148')]['hasMany'](db[_0xe368('0x148')],{'as':_0xe368('0x1a2'),'foreignKey':_0xe368('0x16d'),'onDelete':_0xe368('0x10a'),'hooks':!![],'required':![]});db[_0xe368('0x148')][_0xe368('0x10b')](db[_0xe368('0x1b')],{'as':_0xe368('0x10f'),'foreignKey':_0xe368('0x16d'),'onDelete':'restrict'});db[_0xe368('0x148')]['hasMany'](db[_0xe368('0x160')],{'as':'MailApplications','foreignKey':_0xe368('0x16d')});db[_0xe368('0x148')][_0xe368('0x10b')](db['ChatApplication'],{'as':_0xe368('0x1a3'),'foreignKey':_0xe368('0x16d')});db[_0xe368('0x148')]['hasMany'](db[_0xe368('0x4b')],{'as':_0xe368('0x1a4'),'foreignKey':'IntervalId'});db[_0xe368('0x148')][_0xe368('0x10b')](db[_0xe368('0x17f')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0xe368('0x119')](db[_0xe368('0x3e')],{});db[_0xe368('0x1a5')][_0xe368('0x119')](db[_0xe368('0x9d')],{'foreignKey':'DefaultReportId'});db[_0xe368('0x1a5')]['belongsTo'](db[_0xe368('0x9b')],{'foreignKey':_0xe368('0x1a6')});db[_0xe368('0x8f')][_0xe368('0x11c')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0xe368('0x1a7'),'onDelete':_0xe368('0x16c')});db[_0xe368('0x90')][_0xe368('0x11c')](db[_0xe368('0x158')],{'through':'cm_contact_has_tags'});db[_0xe368('0x90')][_0xe368('0x11c')](db[_0xe368('0x69')],{'through':_0xe368('0x18e')});db[_0xe368('0x90')][_0xe368('0x11c')](db['MailInteraction'],{'through':_0xe368('0x1a8')});db[_0xe368('0x90')][_0xe368('0x11c')](db['SmsInteraction'],{'through':_0xe368('0x180')});db[_0xe368('0x90')][_0xe368('0x11c')](db[_0xe368('0x4d')],{'through':_0xe368('0x176')});db['Tag'][_0xe368('0x11c')](db[_0xe368('0x5f')],{'through':_0xe368('0x1a9')});db[_0xe368('0x90')][_0xe368('0x11c')](db[_0xe368('0x100')],{'through':_0xe368('0x1aa')});db[_0xe368('0x94')]['hasMany'](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xe368('0x1ab')},'foreignKey':_0xe368('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0xe368('0x94')][_0xe368('0x10b')](db[_0xe368('0x88')],{'as':{'plural':_0xe368('0x1ad'),'singular':'AnyCondition'},'foreignKey':_0xe368('0x1ae'),'onDelete':_0xe368('0x10a'),'hooks':!![]});db[_0xe368('0x94')][_0xe368('0x10b')](db[_0xe368('0x80')],{'as':_0xe368('0x1af'),'foreignKey':_0xe368('0x1b0'),'onDelete':_0xe368('0x10a'),'hooks':!![]});db[_0xe368('0x9b')]['hasMany'](db[_0xe368('0x1b1')],{'as':_0xe368('0x1b2'),'onDelete':'cascade','foreignKey':_0xe368('0x1a6'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe368('0x10b')](db['AnalyticFieldReport'],{'as':_0xe368('0x1b2'),'onDelete':_0xe368('0x10a'),'foreignKey':'DefaultReportId'});db[_0xe368('0xa1')][_0xe368('0x10b')](db[_0xe368('0x1b1')],{'as':_0xe368('0x1b2'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b3')});db[_0xe368('0x1b1')]['belongsTo'](db[_0xe368('0xa1')],{'foreignKey':'MetricId'});db[_0xe368('0xa3')][_0xe368('0x10b')](db[_0xe368('0xa5')],{'as':_0xe368('0x1b4'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xa5')][_0xe368('0x10b')](db['SalesforceField'],{'as':_0xe368('0x1b6'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xa5')][_0xe368('0x10b')](db[_0xe368('0xa7')],{'as':_0xe368('0x1b8'),'onDelete':_0xe368('0x10a'),'foreignKey':'DescriptionId'});db[_0xe368('0xa5')][_0xe368('0x10b')](db['SalesforceField'],{'as':_0xe368('0x1b2'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0xa5')][_0xe368('0x119')](db[_0xe368('0xa3')],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xa7')]['hasMany'](db[_0xe368('0xa7')],{'as':'Subject','foreignKey':_0xe368('0x1b7')});db[_0xe368('0xa7')]['hasMany'](db['SalesforceField'],{'as':_0xe368('0x1ba'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xa7')][_0xe368('0x10b')](db[_0xe368('0xa7')],{'as':'Field','foreignKey':_0xe368('0x1b9')});db[_0xe368('0xa7')]['belongsTo'](db[_0xe368('0x96')],{'as':_0xe368('0x96'),'foreignKey':'VariableId'});db[_0xe368('0xa9')][_0xe368('0x10b')](db[_0xe368('0x1bc')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe368('0x1b5')});db[_0xe368('0x1bc')][_0xe368('0x10b')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b7')});db['SugarcrmConfiguration']['hasMany'](db[_0xe368('0xac')],{'as':_0xe368('0x1b8'),'onDelete':_0xe368('0x10a'),'foreignKey':'DescriptionId'});db[_0xe368('0x1bc')]['hasMany'](db['SugarcrmField'],{'as':_0xe368('0x1b2'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0x1bc')][_0xe368('0x119')](db['SugarcrmAccount'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xac')][_0xe368('0x10b')](db[_0xe368('0xac')],{'as':_0xe368('0x1bd'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xac')][_0xe368('0x10b')](db[_0xe368('0xac')],{'as':_0xe368('0x1ba'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xac')][_0xe368('0x10b')](db[_0xe368('0xac')],{'as':'Field','foreignKey':_0xe368('0x1b9')});db[_0xe368('0xac')][_0xe368('0x119')](db['Variable'],{'as':_0xe368('0x96'),'foreignKey':_0xe368('0x1be')});db[_0xe368('0xad')][_0xe368('0x10b')](db[_0xe368('0xaf')],{'as':_0xe368('0x1b4'),'onDelete':'cascade','foreignKey':_0xe368('0x1b5')});db[_0xe368('0xaf')][_0xe368('0x10b')](db[_0xe368('0xb1')],{'as':_0xe368('0x1b6'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xaf')][_0xe368('0x10b')](db['DeskField'],{'as':_0xe368('0x1b8'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xaf')][_0xe368('0x10b')](db[_0xe368('0xb1')],{'as':_0xe368('0x1b2'),'onDelete':_0xe368('0x10a'),'foreignKey':'FieldId'});db[_0xe368('0xaf')][_0xe368('0x119')](db[_0xe368('0xad')],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xaf')][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':_0xe368('0x1bf')});db[_0xe368('0xb1')][_0xe368('0x10b')](db[_0xe368('0xb1')],{'as':_0xe368('0x1bd'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xb1')][_0xe368('0x10b')](db[_0xe368('0xb1')],{'as':'Description','foreignKey':_0xe368('0x1bb')});db['DeskField'][_0xe368('0x10b')](db[_0xe368('0xb1')],{'as':'Field','foreignKey':'FieldId'});db[_0xe368('0xb1')][_0xe368('0x119')](db[_0xe368('0x96')],{'as':_0xe368('0x96'),'foreignKey':'VariableId'});db[_0xe368('0x1c0')]['hasMany'](db[_0xe368('0xb4')],{'as':_0xe368('0x1b4'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xb4')][_0xe368('0x10b')](db[_0xe368('0xb6')],{'as':_0xe368('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xe368('0x10b')](db[_0xe368('0xb6')],{'as':_0xe368('0x1b8'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xb4')][_0xe368('0x10b')](db[_0xe368('0xb6')],{'as':'Fields','onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0xb4')]['belongsTo'](db[_0xe368('0x1c0')],{'as':'Account','foreignKey':_0xe368('0x1b5')});db[_0xe368('0xb6')][_0xe368('0x10b')](db[_0xe368('0xb6')],{'as':_0xe368('0x1bd'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xb6')][_0xe368('0x10b')](db[_0xe368('0xb6')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0xe368('0x10b')](db[_0xe368('0xb6')],{'as':_0xe368('0x1c1'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0xb6')][_0xe368('0x119')](db[_0xe368('0x96')],{'as':_0xe368('0x96'),'foreignKey':'VariableId'});db[_0xe368('0x1c2')][_0xe368('0x10b')](db[_0xe368('0xb8')],{'as':_0xe368('0x1b4'),'onDelete':'cascade','foreignKey':_0xe368('0x1b5')});db['ZendeskConfiguration'][_0xe368('0x10b')](db['ZendeskField'],{'as':_0xe368('0x1b6'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xb8')][_0xe368('0x10b')](db[_0xe368('0xba')],{'as':_0xe368('0x1b8'),'foreignKey':_0xe368('0x1bb')});db['ZendeskConfiguration']['hasMany'](db[_0xe368('0xba')],{'as':'Fields','foreignKey':_0xe368('0x1b9')});db[_0xe368('0xb8')][_0xe368('0x119')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0xe368('0x1b5')});db[_0xe368('0xb8')]['belongsToMany'](db[_0xe368('0x90')],{'through':_0xe368('0x1c3')});db['ZendeskField'][_0xe368('0x10b')](db['ZendeskField'],{'as':_0xe368('0x1bd'),'foreignKey':_0xe368('0x1b7')});db['ZendeskField'][_0xe368('0x10b')](db[_0xe368('0xba')],{'as':_0xe368('0x1ba'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xba')][_0xe368('0x10b')](db[_0xe368('0xba')],{'as':_0xe368('0x1c1'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0xba')][_0xe368('0x119')](db['Variable'],{'as':_0xe368('0x96'),'foreignKey':_0xe368('0x1be')});db[_0xe368('0xbb')][_0xe368('0x10b')](db[_0xe368('0x1c4')],{'as':'Configurations','onDelete':_0xe368('0x10a'),'foreignKey':'AccountId'});db[_0xe368('0x1c4')]['hasMany'](db[_0xe368('0x1c5')],{'as':_0xe368('0x1b6'),'onDelete':'cascade','foreignKey':_0xe368('0x1b7')});db[_0xe368('0x1c4')][_0xe368('0x10b')](db[_0xe368('0x1c5')],{'as':_0xe368('0x1b8'),'onDelete':'cascade','foreignKey':_0xe368('0x1bb')});db[_0xe368('0x1c4')][_0xe368('0x10b')](db[_0xe368('0x1c5')],{'as':'Fields','onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b9')});db['FreshdeskConfiguration'][_0xe368('0x119')](db[_0xe368('0xbb')],{'as':_0xe368('0x166'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xe368('0x11c')](db[_0xe368('0x90')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xe368('0x10b')](db['FreshdeskField'],{'as':_0xe368('0x1bd'),'foreignKey':'SubjectId'});db[_0xe368('0x1c5')][_0xe368('0x10b')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xe368('0x1bb')});db[_0xe368('0x1c5')][_0xe368('0x10b')](db[_0xe368('0x1c5')],{'as':_0xe368('0x1c1'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0x1c5')][_0xe368('0x119')](db[_0xe368('0x96')],{'as':_0xe368('0x96'),'foreignKey':'VariableId'});db[_0xe368('0xbf')][_0xe368('0x10b')](db['VtigerConfiguration'],{'as':_0xe368('0x1b4'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b5')});db['VtigerConfiguration'][_0xe368('0x10b')](db[_0xe368('0xc2')],{'as':'Subjects','foreignKey':_0xe368('0x1b7')});db[_0xe368('0xc1')][_0xe368('0x10b')](db[_0xe368('0xc2')],{'as':_0xe368('0x1b8'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xc1')][_0xe368('0x10b')](db[_0xe368('0xc2')],{'as':_0xe368('0x1b2'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0xc1')][_0xe368('0x119')](db[_0xe368('0xbf')],{'as':_0xe368('0x166'),'foreignKey':'AccountId'});db[_0xe368('0xc2')][_0xe368('0x10b')](db['VtigerField'],{'as':'Subject','foreignKey':_0xe368('0x1b7')});db[_0xe368('0xc2')]['hasMany'](db[_0xe368('0xc2')],{'as':_0xe368('0x1ba'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xc2')][_0xe368('0x10b')](db[_0xe368('0xc2')],{'as':_0xe368('0x1c1'),'foreignKey':_0xe368('0x1b9')});db['VtigerField'][_0xe368('0x119')](db[_0xe368('0x96')],{'as':_0xe368('0x96'),'foreignKey':_0xe368('0x1be')});db[_0xe368('0xc4')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xe368('0x1b4'),'onDelete':_0xe368('0x10a'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xe368('0x10b')](db[_0xe368('0xc7')],{'as':'Subjects','foreignKey':_0xe368('0x1b7')});db[_0xe368('0x1c6')][_0xe368('0x10b')](db[_0xe368('0xc7')],{'as':_0xe368('0x1b8'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0x1c6')][_0xe368('0x10b')](db[_0xe368('0xc7')],{'as':_0xe368('0x1b2'),'foreignKey':_0xe368('0x1b9')});db[_0xe368('0x1c6')][_0xe368('0x119')](db['ServicenowAccount'],{'as':_0xe368('0x166'),'foreignKey':'AccountId'});db[_0xe368('0xc7')][_0xe368('0x10b')](db[_0xe368('0xc7')],{'as':'Subject','foreignKey':_0xe368('0x1b7')});db[_0xe368('0xc7')][_0xe368('0x10b')](db[_0xe368('0xc7')],{'as':'Description','foreignKey':_0xe368('0x1bb')});db[_0xe368('0xc7')][_0xe368('0x10b')](db[_0xe368('0xc7')],{'as':'Field','foreignKey':'FieldId'});db[_0xe368('0xc7')]['belongsTo'](db['Variable'],{'as':_0xe368('0x96'),'foreignKey':_0xe368('0x1be')});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0xe368('0x1b4'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xca')][_0xe368('0x10b')](db[_0xe368('0xcb')],{'as':_0xe368('0x1b6'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xca')][_0xe368('0x10b')](db[_0xe368('0xcb')],{'as':_0xe368('0x1b8'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1bb')});db['Dynamics365Configuration']['hasMany'](db[_0xe368('0xcb')],{'as':'Fields','onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b9')});db['Dynamics365Configuration'][_0xe368('0x119')](db['Dynamics365Account'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x1b5')});db['Dynamics365Field']['hasMany'](db[_0xe368('0xcb')],{'as':'Subject','foreignKey':_0xe368('0x1b7')});db[_0xe368('0xcb')]['hasMany'](db[_0xe368('0xcb')],{'as':_0xe368('0x1ba'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xcb')][_0xe368('0x10b')](db[_0xe368('0xcb')],{'as':'Field','foreignKey':_0xe368('0x1b9')});db[_0xe368('0xcb')][_0xe368('0x119')](db[_0xe368('0x96')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe368('0xcd')][_0xe368('0x10b')](db[_0xe368('0xcf')],{'as':_0xe368('0x1b4'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0xcf')][_0xe368('0x10b')](db[_0xe368('0x1c7')],{'as':_0xe368('0x1b6'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0xcf')][_0xe368('0x10b')](db[_0xe368('0x1c7')],{'as':_0xe368('0x1b8'),'foreignKey':_0xe368('0x1bb')});db[_0xe368('0xcf')][_0xe368('0x10b')](db[_0xe368('0x1c7')],{'as':'Fields','foreignKey':'FieldId'});db[_0xe368('0xcf')]['belongsTo'](db['FreshsalesAccount'],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x1b5')});db[_0xe368('0x1c7')][_0xe368('0x10b')](db['FreshsalesField'],{'as':_0xe368('0x1bd'),'foreignKey':_0xe368('0x1b7')});db[_0xe368('0x1c7')][_0xe368('0x10b')](db['FreshsalesField'],{'as':_0xe368('0x1ba'),'foreignKey':'DescriptionId'});db[_0xe368('0x1c7')]['hasMany'](db[_0xe368('0x1c7')],{'as':_0xe368('0x1c1'),'foreignKey':_0xe368('0x1b9')});db['FreshsalesField'][_0xe368('0x119')](db[_0xe368('0x96')],{'as':'Variable','foreignKey':_0xe368('0x1be')});db['ChatQueueReport'][_0xe368('0x119')](db[_0xe368('0x64')],{});db[_0xe368('0xd3')][_0xe368('0x119')](db['CmList'],{'as':'List','foreignKey':_0xe368('0x16f')});db[_0xe368('0xd3')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0xd3')][_0xe368('0x119')](db[_0xe368('0x69')],{});db['ChatQueueReport'][_0xe368('0x119')](db[_0xe368('0x6b')],{});db[_0xe368('0xd3')][_0xe368('0x119')](db[_0xe368('0x14')],{});db['ChatQueueReport'][_0xe368('0x119')](db['ChatQueue'],{});db[_0xe368('0xd5')][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':'cascade','foreignKey':_0xe368('0x1c8')});db[_0xe368('0xd5')][_0xe368('0x119')](db[_0xe368('0x14')],{'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x1c9')});db[_0xe368('0x144')][_0xe368('0x10b')](db[_0xe368('0x1ca')],{'foreignKey':_0xe368('0x1cb'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x144')]['hasMany'](db[_0xe368('0x1cc')],{'foreignKey':_0xe368('0x1cb'),'onDelete':_0xe368('0x10a')});db[_0xe368('0x1cd')][_0xe368('0x119')](db[_0xe368('0x54')],{});db[_0xe368('0x1cd')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':'ListId'});db[_0xe368('0x1cd')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0xe368('0x56')],{});db['SmsQueueReport'][_0xe368('0x119')](db[_0xe368('0x58')],{});db[_0xe368('0x1cd')][_0xe368('0x119')](db['User'],{});db[_0xe368('0x1cd')][_0xe368('0x119')](db['SmsQueue'],{});db['JscriptyProject'][_0xe368('0x10b')](db[_0xe368('0x144')],{'foreignKey':'ProjectId'});db[_0xe368('0x1ce')][_0xe368('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':_0xe368('0x1cf')});db[_0xe368('0x1ce')][_0xe368('0x10b')](db[_0xe368('0x1cc')],{'foreignKey':'ProjectId'});db[_0xe368('0xe1')][_0xe368('0x11c')](db['User'],{'as':_0xe368('0x169'),'through':_0xe368('0x13b')});db['Team']['belongsToMany'](db['User'],{'as':_0xe368('0x14d'),'through':_0xe368('0x124')});db[_0xe368('0x123')][_0xe368('0x11c')](db[_0xe368('0x1f')],{'through':_0xe368('0x14f'),'as':_0xe368('0x12a')});db['Team'][_0xe368('0x11c')](db[_0xe368('0x12b')],{'through':_0xe368('0x164'),'as':'MailQueues'});db[_0xe368('0x123')][_0xe368('0x11c')](db['ChatQueue'],{'through':_0xe368('0x1d0'),'as':_0xe368('0x12d')});db[_0xe368('0x123')][_0xe368('0x11c')](db[_0xe368('0x51')],{'through':_0xe368('0x17c'),'as':_0xe368('0x12e')});db['Team'][_0xe368('0x11c')](db['SmsQueue'],{'through':_0xe368('0x183'),'as':_0xe368('0x12f')});db[_0xe368('0x123')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0xe368('0x188'),'as':_0xe368('0x1d1')});db[_0xe368('0x123')][_0xe368('0x11c')](db[_0xe368('0x130')],{'through':_0xe368('0x1d2'),'as':'WhatsappQueues'});db[_0xe368('0xe8')][_0xe368('0x10b')](db[_0xe368('0x78')],{'as':_0xe368('0x194'),'foreignKey':_0xe368('0x19a')});db['Campaign'][_0xe368('0x10b')](db[_0xe368('0x7b')],{'as':'HopperFinals','foreignKey':_0xe368('0x19a')});db[_0xe368('0xe8')][_0xe368('0x10b')](db[_0xe368('0x7c')],{'as':_0xe368('0x142'),'foreignKey':_0xe368('0x19a')});db['Campaign'][_0xe368('0x10b')](db[_0xe368('0x143')],{'as':_0xe368('0x1d3'),'foreignKey':_0xe368('0x19a')});db[_0xe368('0xe8')][_0xe368('0x119')](db[_0xe368('0x2f')],{'as':_0xe368('0x2f'),'foreignKey':_0xe368('0x145')});db[_0xe368('0xe8')][_0xe368('0x119')](db[_0xe368('0x2f')],{'as':_0xe368('0x146'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0xe368('0x119')](db[_0xe368('0x148')],{'as':_0xe368('0x148'),'foreignKey':_0xe368('0x16d')});db[_0xe368('0xe8')][_0xe368('0x119')](db[_0xe368('0xe1')],{'as':_0xe368('0xe1'),'foreignKey':_0xe368('0x1d4')});db[_0xe368('0xe8')][_0xe368('0x11c')](db[_0xe368('0xf4')],{'as':_0xe368('0x121'),'through':_0xe368('0x1d5')});db[_0xe368('0xe8')][_0xe368('0x11c')](db[_0xe368('0xf4')],{'as':_0xe368('0x150'),'through':_0xe368('0x1d6')});db[_0xe368('0x1d7')][_0xe368('0x119')](db[_0xe368('0x42')],{});db['MailTransferReport'][_0xe368('0x119')](db[_0xe368('0x40')],{});db[_0xe368('0x1d7')]['belongsTo'](db[_0xe368('0x3e')],{'foreignKey':_0xe368('0x1d8'),'as':'FromAccount'});db[_0xe368('0x1d7')][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':_0xe368('0x1d9'),'as':_0xe368('0x1da')});db['MailTransferReport'][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':'ToUserId','as':_0xe368('0x1db')});db[_0xe368('0x1d7')][_0xe368('0x119')](db[_0xe368('0x12b')],{'foreignKey':_0xe368('0x1dc'),'as':_0xe368('0x1dd')});db[_0xe368('0x1d7')][_0xe368('0x119')](db[_0xe368('0x3e')],{'foreignKey':'ToMailAccountId','as':_0xe368('0x1de')});db['ChatTransferReport'][_0xe368('0x119')](db[_0xe368('0x6b')],{});db['ChatTransferReport'][_0xe368('0x119')](db[_0xe368('0x69')],{});db['ChatTransferReport'][_0xe368('0x119')](db[_0xe368('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0xe368('0x1df')});db[_0xe368('0xee')][_0xe368('0x119')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe368('0xee')][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':'ToUserId','as':_0xe368('0x1db')});db[_0xe368('0xee')][_0xe368('0x119')](db[_0xe368('0x6f')],{'foreignKey':_0xe368('0x1e0'),'as':'ToQueue'});db[_0xe368('0xee')][_0xe368('0x119')](db[_0xe368('0x64')],{'foreignKey':_0xe368('0x1e1'),'as':_0xe368('0x1de')});db['FaxTransferReport'][_0xe368('0x119')](db[_0xe368('0x4f')],{});db[_0xe368('0xef')]['belongsTo'](db[_0xe368('0x4d')],{});db[_0xe368('0xef')]['belongsTo'](db[_0xe368('0x49')],{'foreignKey':_0xe368('0x1e2'),'as':'FromAccount'});db[_0xe368('0xef')][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':'FromUserId','as':_0xe368('0x1da')});db[_0xe368('0xef')][_0xe368('0x119')](db['User'],{'foreignKey':_0xe368('0x1e3'),'as':_0xe368('0x1db')});db['FaxTransferReport'][_0xe368('0x119')](db['FaxQueue'],{'foreignKey':_0xe368('0x1e4'),'as':'ToQueue'});db[_0xe368('0xef')][_0xe368('0x119')](db[_0xe368('0x49')],{'foreignKey':'ToFaxAccountId','as':_0xe368('0x1de')});db[_0xe368('0xf1')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xe368('0xf1')][_0xe368('0x119')](db[_0xe368('0x5f')],{});db[_0xe368('0xf1')]['belongsTo'](db[_0xe368('0x137')],{'foreignKey':_0xe368('0x1e5'),'as':'FromAccount'});db[_0xe368('0xf1')][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':'FromUserId','as':_0xe368('0x1da')});db['OpenchannelTransferReport'][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':_0xe368('0x1e3'),'as':_0xe368('0x1db')});db[_0xe368('0xf1')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0xe368('0x1e6'),'as':_0xe368('0x1dd')});db[_0xe368('0xf1')]['belongsTo'](db[_0xe368('0x137')],{'foreignKey':'ToOpenchannelAccountId','as':_0xe368('0x1de')});db[_0xe368('0xf2')][_0xe368('0x119')](db[_0xe368('0x58')],{});db[_0xe368('0xf2')][_0xe368('0x119')](db[_0xe368('0x56')],{});db[_0xe368('0xf2')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xe368('0x1e7'),'as':_0xe368('0x1df')});db[_0xe368('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0xe368('0x1d9'),'as':_0xe368('0x1da')});db[_0xe368('0xf2')]['belongsTo'](db[_0xe368('0x14')],{'foreignKey':_0xe368('0x1e3'),'as':_0xe368('0x1db')});db[_0xe368('0xf2')][_0xe368('0x119')](db[_0xe368('0x5a')],{'foreignKey':'ToSmsQueueId','as':_0xe368('0x1dd')});db['SmsTransferReport'][_0xe368('0x119')](db['SmsAccount'],{'foreignKey':_0xe368('0x1e8'),'as':_0xe368('0x1de')});db['CmList'][_0xe368('0x10b')](db[_0xe368('0x86')],{'as':'Dispositions','foreignKey':_0xe368('0x16f')});db[_0xe368('0xf4')][_0xe368('0x10b')](db[_0xe368('0x1e9')],{'as':_0xe368('0x1ea'),'foreignKey':_0xe368('0x16f')});db[_0xe368('0xf4')][_0xe368('0x10b')](db[_0xe368('0x158')],{'as':_0xe368('0x11f'),'onDelete':_0xe368('0x10a'),'foreignKey':_0xe368('0x16f')});db[_0xe368('0xf4')][_0xe368('0x10b')](db['CmHopperFinal'],{'as':_0xe368('0x110'),'foreignKey':_0xe368('0x16f')});db[_0xe368('0xf4')][_0xe368('0x10b')](db[_0xe368('0x7c')],{'as':_0xe368('0x111'),'foreignKey':_0xe368('0x16f')});db[_0xe368('0xf4')][_0xe368('0x10b')](db['ReportAgentPreview'],{'as':_0xe368('0x112'),'foreignKey':_0xe368('0x16f')});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':'Queues','through':_0xe368('0x14c')});db[_0xe368('0xf4')][_0xe368('0x11c')](db['User'],{'as':_0xe368('0x14d'),'through':_0xe368('0x122')});db[_0xe368('0xf6')][_0xe368('0x10b')](db['VoiceExtension'],{'as':_0xe368('0x10f'),'onDelete':_0xe368('0x10a')});db[_0xe368('0xf6')]['belongsToMany'](db[_0xe368('0x14')],{'as':'Agents','through':_0xe368('0x133')});db['UserProfile'][_0xe368('0x10b')](db['User'],{'as':_0xe368('0x169'),'foreignKey':_0xe368('0x11b')});db[_0xe368('0x11a')][_0xe368('0x10b')](db['UserProfileSection'],{'as':_0xe368('0x1eb'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0xe368('0xf8')][_0xe368('0x10b')](db[_0xe368('0xfa')],{'as':_0xe368('0x1ec'),'foreignKey':_0xe368('0x1ed'),'onDelete':_0xe368('0x10a')});db[_0xe368('0xfd')][_0xe368('0x10b')](db[_0xe368('0x86')],{'as':'Dispositions','foreignKey':_0xe368('0x1ee')});db[_0xe368('0xfd')][_0xe368('0x10b')](db[_0xe368('0x84')],{'as':_0xe368('0x15d'),'foreignKey':'WhatsappAccountId'});db[_0xe368('0xfd')][_0xe368('0x10b')](db[_0xe368('0x1ef')],{'as':_0xe368('0x15e'),'foreignKey':_0xe368('0x1ee')});db[_0xe368('0xfd')]['hasMany'](db[_0xe368('0x100')],{'as':_0xe368('0x15f')});db[_0xe368('0xfd')][_0xe368('0x10b')](db['WhatsappApplication'],{'as':_0xe368('0x13e')});db[_0xe368('0xfd')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':_0xe368('0x16f')});db['WhatsappAccount'][_0xe368('0x119')](db[_0xe368('0x149')],{'as':_0xe368('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe368('0xfd')][_0xe368('0x11c')](db['User'],{'as':'Agents','through':_0xe368('0x13a')});db[_0xe368('0x1f0')]['belongsTo'](db['User'],{'onDelete':_0xe368('0x16c')});db['WhatsappApplication'][_0xe368('0x119')](db[_0xe368('0x130')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x1f0')][_0xe368('0x119')](db[_0xe368('0xfd')],{'onDelete':_0xe368('0x16c')});db[_0xe368('0x1f0')][_0xe368('0x119')](db[_0xe368('0x148')],{'onDelete':_0xe368('0x16c'),'foreignKey':_0xe368('0x16d')});db[_0xe368('0x1f0')][_0xe368('0x119')](db[_0xe368('0x90')],{'onDelete':'restrict','foreignKey':_0xe368('0x175')});db['WhatsappInteraction'][_0xe368('0x10b')](db[_0xe368('0x1ef')],{'as':_0xe368('0x15e'),'onDelete':_0xe368('0x10a'),'foreignKey':'WhatsappInteractionId'});db[_0xe368('0x100')][_0xe368('0x119')](db[_0xe368('0xfd')],{'as':_0xe368('0x166'),'foreignKey':_0xe368('0x1ee')});db['WhatsappInteraction'][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db['WhatsappInteraction'][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x167'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0xe368('0x90')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xe368('0x100')][_0xe368('0x11c')](db['Tag'],{'through':_0xe368('0x1aa'),'as':_0xe368('0x168')});db[_0xe368('0x100')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':'Users','through':_0xe368('0x129'),'foreignKey':'WhatsappInteractionId'});db[_0xe368('0x1ef')][_0xe368('0x119')](db[_0xe368('0x14')],{'as':_0xe368('0x14')});db[_0xe368('0x1ef')][_0xe368('0x119')](db[_0xe368('0x158')],{'onDelete':_0xe368('0x10a'),'as':'Contact'});db[_0xe368('0x1ef')]['belongsTo'](db[_0xe368('0x100')],{'onDelete':_0xe368('0x10a'),'as':_0xe368('0x16b'),'foreignKey':_0xe368('0x1f1')});db[_0xe368('0x1ef')]['belongsTo'](db[_0xe368('0xfd')],{'as':_0xe368('0x166'),'foreignKey':'WhatsappAccountId'});db[_0xe368('0x102')][_0xe368('0x119')](db[_0xe368('0xfd')],{});db[_0xe368('0x102')][_0xe368('0x119')](db[_0xe368('0xf4')],{'as':_0xe368('0x161'),'foreignKey':_0xe368('0x16f')});db[_0xe368('0x102')][_0xe368('0x119')](db[_0xe368('0x158')],{'as':_0xe368('0x159'),'foreignKey':_0xe368('0x170')});db[_0xe368('0x102')]['belongsTo'](db[_0xe368('0x100')],{});db['WhatsappQueueReport'][_0xe368('0x119')](db[_0xe368('0x130')],{});db[_0xe368('0x102')][_0xe368('0x119')](db[_0xe368('0x1ef')],{});db['WhatsappQueueReport'][_0xe368('0x119')](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db[_0xe368('0x1ef')],{});db[_0xe368('0x104')]['belongsTo'](db[_0xe368('0x100')],{});db['WhatsappTransferReport'][_0xe368('0x119')](db[_0xe368('0xfd')],{'foreignKey':_0xe368('0x1f2'),'as':_0xe368('0x1df')});db[_0xe368('0x104')][_0xe368('0x119')](db[_0xe368('0xfd')],{'foreignKey':_0xe368('0x1f3'),'as':_0xe368('0x1de')});db[_0xe368('0x104')]['belongsTo'](db[_0xe368('0x130')],{'foreignKey':_0xe368('0x1f4'),'as':'ToQueue'});db[_0xe368('0x104')][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':_0xe368('0x1d9'),'as':'FromAgent'});db[_0xe368('0x104')][_0xe368('0x119')](db[_0xe368('0x14')],{'foreignKey':_0xe368('0x1e3'),'as':_0xe368('0x1db')});db[_0xe368('0x130')][_0xe368('0x11c')](db[_0xe368('0x14')],{'as':'Agents','through':_0xe368('0x38'),'foreignKey':'WhatsappQueueId'});db[_0xe368('0x130')][_0xe368('0x11c')](db[_0xe368('0x123')],{'through':'team_has_whatsapp_queues','as':_0xe368('0x14e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x731c=['../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../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','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','Recordings','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteraction','Notifications','belongsTo','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','cm_user_has_lists','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','MailQueues','ChatQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueue','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Interactions','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','Dashboard','Items','FaxAccountId','Answers','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsMessage','TagId','SmsInteractionId','sms_interaction_has_tags','Tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','Website','CompanyId','Hoppers','HopperHistories','Company','cm_contact_has_tags','CampaignId','OwnerId','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','Schedule','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','AnalyticFieldReport','Fields','DefaultReportId','MetricId','Configurations','AccountId','SalesforceField','DescriptionId','FieldId','SubjectId','Description','SugarcrmAccount','Subjects','Descriptions','Subject','Field','Variable','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ToId','SessionId','SmsQueueReport','ProjectId','user_has_teams','team_has_voice_queues','team_has_chat_queues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','path','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','xC@LL1234','database','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue'];(function(_0x3d85f2,_0x1fa1db){var _0x2d6d49=function(_0x1bc2a4){while(--_0x1bc2a4){_0x3d85f2['push'](_0x3d85f2['shift']());}};_0x2d6d49(++_0x1fa1db);}(_0x731c,0x1c2));var _0xc731=function(_0x4f0476,_0x1a15f3){_0x4f0476=_0x4f0476-0x0;var _0x4050d9=_0x731c[_0x4f0476];return _0x4050d9;};'use strict';var path=require(_0xc731('0x0'));var config=require(_0xc731('0x1'));var Sequelize=require(_0xc731('0x2'));var _=require('lodash');var jstz=require(_0xc731('0x3'));var timezone=jstz[_0xc731('0x4')]();config[_0xc731('0x2')]=_[_0xc731('0x5')](config[_0xc731('0x2')],{'database':_0xc731('0x6'),'username':_0xc731('0x7'),'password':'xC@LL1234','options':{'host':_0xc731('0x8'),'port':0xcea,'dialect':_0xc731('0x9'),'dialectOptions':{'charset':_0xc731('0xa')},'logging':![],'timezone':timezone[_0xc731('0xb')](),'define':{'charset':_0xc731('0xc'),'collate':'utf8_general_ci'}}});config[_0xc731('0xd')]=_[_0xc731('0x5')](config[_0xc731('0xd')],{'database':_0xc731('0x6'),'username':_0xc731('0x7'),'password':_0xc731('0xe'),'options':{'host':_0xc731('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc731('0xb')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc731('0x2')][_0xc731('0xf')],config[_0xc731('0x2')][_0xc731('0x10')],config[_0xc731('0x2')]['password'],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc731('0xd')]['database'],config[_0xc731('0xd')]['username'],config[_0xc731('0xd')]['password'],config[_0xc731('0xd')]['options'])};db[_0xc731('0x11')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x13'));db[_0xc731('0x14')]=db[_0xc731('0x2')]['import'](_0xc731('0x15'));db[_0xc731('0x16')]=db[_0xc731('0x2')]['import']('../api/voiceContext/voiceContext.model');db[_0xc731('0x17')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0xc731('0x18')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x19'));db['VoiceQueue']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x1a'));db['VoiceRecording']=db[_0xc731('0x2')]['import']('../api/voiceRecording/voiceRecording.model');db[_0xc731('0x1b')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x1c'));db[_0xc731('0x1d')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x1e'));db[_0xc731('0x1f')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0xc731('0x20')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x21'));db[_0xc731('0x22')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x23'));db[_0xc731('0x24')]=db['sequelize'][_0xc731('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xc731('0x25')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x26'));db[_0xc731('0x27')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x28'));db[_0xc731('0x29')]=db[_0xc731('0x2')]['import'](_0xc731('0x2a'));db[_0xc731('0x2b')]=db[_0xc731('0x2')]['import'](_0xc731('0x2c'));db[_0xc731('0x2d')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x2e'));db[_0xc731('0x2f')]=db[_0xc731('0x2')]['import'](_0xc731('0x30'));db[_0xc731('0x31')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x32'));db[_0xc731('0x33')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0xc731('0x34')]=db[_0xc731('0x2')]['import'](_0xc731('0x35'));db[_0xc731('0x36')]=db['sequelize']['import'](_0xc731('0x37'));db[_0xc731('0x38')]=db[_0xc731('0x2')]['import'](_0xc731('0x39'));db[_0xc731('0x3a')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0xc731('0x3b')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x3c'));db[_0xc731('0x3d')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x3e'));db[_0xc731('0x3f')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x40'));db['MailSubstatus']=db[_0xc731('0x2')][_0xc731('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db['sequelize'][_0xc731('0x12')](_0xc731('0x41'));db[_0xc731('0x42')]=db[_0xc731('0x2')]['import'](_0xc731('0x43'));db[_0xc731('0x44')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x45'));db[_0xc731('0x46')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x47'));db['Dashboard']=db[_0xc731('0x2')]['import'](_0xc731('0x48'));db[_0xc731('0x49')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x4a'));db[_0xc731('0x4b')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x4c'));db[_0xc731('0x4d')]=db['sequelize']['import'](_0xc731('0x4e'));db['FaxInteraction']=db['sequelize'][_0xc731('0x12')](_0xc731('0x4f'));db[_0xc731('0x50')]=db[_0xc731('0x2')]['import'](_0xc731('0x51'));db['FaxQueue']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x52'));db[_0xc731('0x53')]=db['sequelize'][_0xc731('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0xc731('0x54')]=db['sequelize'][_0xc731('0x12')]('../api/smsAccount/smsAccount.model');db[_0xc731('0x55')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x56'));db[_0xc731('0x57')]=db[_0xc731('0x2')]['import'](_0xc731('0x58'));db['SmsMessage']=db['sequelize']['import'](_0xc731('0x59'));db[_0xc731('0x5a')]=db[_0xc731('0x2')]['import'](_0xc731('0x5b'));db[_0xc731('0x5c')]=db[_0xc731('0x2')]['import'](_0xc731('0x5d'));db['OpenchannelApplication']=db['sequelize'][_0xc731('0x12')](_0xc731('0x5e'));db[_0xc731('0x5f')]=db[_0xc731('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x60'));db['OpenchannelQueue']=db['sequelize'][_0xc731('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0xc731('0x61')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0xc731('0x62')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x63'));db[_0xc731('0x64')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/chatApplication/chatApplication.model');db[_0xc731('0x65')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x66'));db[_0xc731('0x67')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x68'));db[_0xc731('0x69')]=db[_0xc731('0x2')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xc731('0x2')][_0xc731('0x12')]('../api/chatQueue/chatQueue.model');db[_0xc731('0x6a')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x6b'));db[_0xc731('0x6c')]=db['sequelize']['import'](_0xc731('0x6d'));db[_0xc731('0x6e')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x6f'));db[_0xc731('0x70')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/cmContact/cmContact.model');db[_0xc731('0x71')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/cmHopper/cmHopper.model');db[_0xc731('0x72')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x73'));db[_0xc731('0x74')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x75'));db[_0xc731('0x76')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x77'));db[_0xc731('0x78')]=db[_0xc731('0x2')]['import'](_0xc731('0x79'));db[_0xc731('0x7a')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x7b'));db['Action']=db['sequelize']['import'](_0xc731('0x7c'));db[_0xc731('0x7d')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/automation/automation.model');db[_0xc731('0x7e')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x7f'));db[_0xc731('0x80')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x81'));db[_0xc731('0x82')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x83'));db['Interval']=db['sequelize'][_0xc731('0x12')]('../api/interval/interval.model');db['Pause']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x84'));db[_0xc731('0x85')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/cdr/cdr.model');db[_0xc731('0x86')]=db[_0xc731('0x2')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize']['import']('../api/schedule/schedule.model');db['Sound']=db[_0xc731('0x2')]['import'](_0xc731('0x87'));db[_0xc731('0x88')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x89'));db[_0xc731('0x8a')]=db['sequelize'][_0xc731('0x12')]('../api/template/template.model');db[_0xc731('0x8b')]=db[_0xc731('0x2')]['import'](_0xc731('0x8c'));db['Variable']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x8d'));db['Integration']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x8e'));db[_0xc731('0x8f')]=db[_0xc731('0x2')]['import'](_0xc731('0x90'));db[_0xc731('0x91')]=db[_0xc731('0x2')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0xc731('0x92')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x93'));db[_0xc731('0x94')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x95'));db[_0xc731('0x96')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0xc731('0x12')](_0xc731('0x97'));db[_0xc731('0x98')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xc731('0x99')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x9a'));db[_0xc731('0x9b')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x9c'));db['SalesforceField']=db['sequelize'][_0xc731('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xc731('0x2')][_0xc731('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xc731('0x9d')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x9e'));db[_0xc731('0x9f')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xa0'));db[_0xc731('0xa1')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xa2'));db['DeskConfiguration']=db[_0xc731('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xc731('0xa3')]=db[_0xc731('0x2')]['import']('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xa4'));db[_0xc731('0xa5')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xa6'));db[_0xc731('0xa7')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xa8'));db[_0xc731('0xa9')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xaa'));db[_0xc731('0xab')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xac'));db[_0xc731('0xad')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xae'));db[_0xc731('0xaf')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xb0'));db[_0xc731('0xb1')]=db[_0xc731('0x2')]['import'](_0xc731('0xb2'));db[_0xc731('0xb3')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xc731('0xb4')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xb5'));db['VtigerField']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xb6'));db[_0xc731('0xb7')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xc731('0xb8')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xb9'));db[_0xc731('0xba')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xc731('0xbb')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xbc'));db[_0xc731('0xbd')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xbe'));db[_0xc731('0xbf')]=db[_0xc731('0x2')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xc731('0xc0')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xc1'));db[_0xc731('0xc2')]=db[_0xc731('0x2')]['import'](_0xc731('0xc3'));db[_0xc731('0xc4')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xc5'));db[_0xc731('0xc6')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0x8e'));db[_0xc731('0xc7')]=db[_0xc731('0x2')]['import'](_0xc731('0xc8'));db[_0xc731('0xc9')]=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xc731('0xca')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xc731('0xcb')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xc731('0xcc')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xcd'));db[_0xc731('0xce')]=db[_0xc731('0x2')]['import'](_0xc731('0xcf'));db['SmsQueueReport']=db[_0xc731('0x2')][_0xc731('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0xc731('0xd0')]=db['sequelize']['import'](_0xc731('0xd1'));db['SquareDetailsReport']=db[_0xc731('0x2')][_0xc731('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0xc731('0xd2')]=db[_0xc731('0x2')][_0xc731('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0xc731('0xd3')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xd4'));db[_0xc731('0xd5')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xd6'));db[_0xc731('0xd7')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xd8'));db[_0xc731('0xd9')]=db[_0xc731('0x2')]['import'](_0xc731('0xda'));db['SquareMessage']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xdb'));db[_0xc731('0xdc')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xdd'));db['License']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xde'));db[_0xc731('0xdf')]=db['sequelize']['import']('../api/campaign/campaign.model');db[_0xc731('0xe0')]=db[_0xc731('0x2')]['import'](_0xc731('0xe1'));db['Attachment']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xe2'));db[_0xc731('0xe3')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xe4'));db[_0xc731('0xe5')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xe6'));db[_0xc731('0xe7')]=db[_0xc731('0x2')]['import'](_0xc731('0xe8'));db[_0xc731('0xe9')]=db[_0xc731('0x2')]['import'](_0xc731('0xea'));db[_0xc731('0xeb')]=db[_0xc731('0x2')]['import'](_0xc731('0xec'));db['SmsTransferReport']=db[_0xc731('0x2')]['import'](_0xc731('0xed'));db[_0xc731('0xee')]=db[_0xc731('0x2')]['import'](_0xc731('0xef'));db['VoicePrefix']=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xf0'));db[_0xc731('0xf1')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xf2'));db[_0xc731('0xf3')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xf4'));db[_0xc731('0xf5')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xf6'));db['Notification']=db['sequelize'][_0xc731('0x12')]('../api/notification/notification.model');db[_0xc731('0xf7')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xf8'));db[_0xc731('0xf9')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xfa'));db[_0xc731('0xfb')]=db['sequelize'][_0xc731('0x12')](_0xc731('0xfc'));db[_0xc731('0xfd')]=db[_0xc731('0x2')][_0xc731('0x12')](_0xc731('0xfe'));db[_0xc731('0xff')]=db['sequelize'][_0xc731('0x12')](_0xc731('0x100'));db[_0xc731('0x101')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0xc731('0x2')][_0xc731('0x12')]('../api/whatsappQueue/whatsappQueue.model');db[_0xc731('0x102')]=db[_0xc731('0x2')]['import'](_0xc731('0x103'));db['User'][_0xc731('0x104')](db['VoiceMail'],{'as':_0xc731('0x105'),'onDelete':_0xc731('0x106'),'foreignKey':'UserId'});db[_0xc731('0x11')]['hasMany'](db['VoiceRecording'],{'as':_0xc731('0x107'),'foreignKey':_0xc731('0x108')});db['User'][_0xc731('0x109')](db[_0xc731('0x2b')],{'as':_0xc731('0x10a'),'foreignKey':_0xc731('0x108')});db['User'][_0xc731('0x109')](db[_0xc731('0x17')],{'as':_0xc731('0x10b'),'onDelete':_0xc731('0x106'),'hooks':!![]});db[_0xc731('0x11')]['hasMany'](db['CmHopperFinal'],{'as':_0xc731('0x10c'),'foreignKey':'UserId'});db['User'][_0xc731('0x109')](db[_0xc731('0x76')],{'as':_0xc731('0x10d'),'foreignKey':_0xc731('0x108')});db['User'][_0xc731('0x109')](db[_0xc731('0x78')],{'as':_0xc731('0x78'),'foreignKey':_0xc731('0x108')});db['User']['hasMany'](db[_0xc731('0x5f')],{'as':_0xc731('0x10e'),'foreignKey':'UserId'});db[_0xc731('0x11')][_0xc731('0x109')](db[_0xc731('0x65')],{'as':_0xc731('0x10f'),'foreignKey':_0xc731('0x108')});db[_0xc731('0x11')][_0xc731('0x109')](db[_0xc731('0x57')],{'as':_0xc731('0x110'),'foreignKey':_0xc731('0x108')});db[_0xc731('0x11')]['hasMany'](db[_0xc731('0x111')],{'as':_0xc731('0x112'),'foreignKey':_0xc731('0x108')});db[_0xc731('0x11')][_0xc731('0x109')](db[_0xc731('0x113')],{'as':'MailInteractions','foreignKey':_0xc731('0x108')});db[_0xc731('0x11')]['hasMany'](db[_0xc731('0xfb')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xc731('0x11')][_0xc731('0x109')](db['Notification'],{'as':_0xc731('0x114'),'foreignKey':'SenderId'});db['User'][_0xc731('0x115')](db[_0xc731('0xf1')],{'as':_0xc731('0xf1'),'foreignKey':_0xc731('0x116')});db[_0xc731('0x11')]['belongsToMany'](db['ChatGroup'],{'as':_0xc731('0x117'),'through':'chat_group_has_users'});db['User'][_0xc731('0x118')](db[_0xc731('0x70')],{'as':_0xc731('0x119'),'through':_0xc731('0x11a')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0xee')],{'as':'Lists','through':_0xc731('0x11b')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0xdc')],{'through':'user_has_teams'});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x113')],{'as':_0xc731('0x11c'),'through':_0xc731('0x11d')});db['User'][_0xc731('0x118')](db[_0xc731('0x65')],{'as':'ChatInteractions','through':_0xc731('0x11e')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x111')],{'as':_0xc731('0x112'),'through':_0xc731('0x11f')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x57')],{'as':_0xc731('0x110'),'through':_0xc731('0x120')});db[_0xc731('0x11')][_0xc731('0x118')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xc731('0x121')});db['User']['belongsToMany'](db[_0xc731('0xfb')],{'as':'WhatsappInteractions','through':_0xc731('0x122')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x123')],{'as':'VoiceQueues','through':_0xc731('0x2d'),'required':![]});db['User'][_0xc731('0x118')](db[_0xc731('0x3f')],{'as':_0xc731('0x124'),'through':_0xc731('0x31'),'required':![]});db['User']['belongsToMany'](db[_0xc731('0x125')],{'as':_0xc731('0x126'),'through':_0xc731('0x2f'),'required':![],'hooks':!![]});db['User'][_0xc731('0x118')](db[_0xc731('0x127')],{'as':_0xc731('0x128'),'through':'UserFaxQueue','required':![]});db[_0xc731('0x11')][_0xc731('0x118')](db['SmsQueue'],{'as':_0xc731('0x129'),'through':_0xc731('0x34'),'required':![]});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x12a')],{'as':'OpenchannelQueues','through':_0xc731('0x36'),'required':![]});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x12b')],{'as':_0xc731('0x12c'),'through':_0xc731('0x38'),'required':![]});db[_0xc731('0x11')][_0xc731('0x118')](db['CmList'],{'through':_0xc731('0x11b')});db[_0xc731('0x11')]['belongsToMany'](db[_0xc731('0x12d')],{'as':_0xc731('0x12e'),'through':_0xc731('0x12f'),'required':![]});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x61')],{'as':_0xc731('0x130'),'through':_0xc731('0x131')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x4b')],{'as':_0xc731('0x132'),'through':_0xc731('0x133')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x3d')],{'as':_0xc731('0x134'),'through':_0xc731('0x135')});db['User'][_0xc731('0x118')](db[_0xc731('0x5c')],{'as':_0xc731('0x136'),'through':_0xc731('0x137')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0x54')],{'as':'SmsAccounts','through':_0xc731('0x138')});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0xf7')],{'as':_0xc731('0x139'),'through':'user_has_whatsapp_accounts'});db[_0xc731('0x11')][_0xc731('0x118')](db[_0xc731('0xd7')],{'as':_0xc731('0x13a'),'through':_0xc731('0x13b')});db['VoiceChanSpy'][_0xc731('0x109')](db['VoiceExtension'],{'as':_0xc731('0x13c'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x13d')});db[_0xc731('0x16')][_0xc731('0x109')](db[_0xc731('0x17')],{'onDelete':_0xc731('0x106')});db['VoiceExtension'][_0xc731('0x109')](db[_0xc731('0x17')],{'as':_0xc731('0x13e'),'onDelete':_0xc731('0x106')});db[_0xc731('0x18')]['belongsToMany'](db['Sound'],{'as':_0xc731('0x13f'),'through':_0xc731('0x140')});db[_0xc731('0x123')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xc731('0x141'),'foreignKey':_0xc731('0x142')});db[_0xc731('0x123')][_0xc731('0x109')](db[_0xc731('0x71')],{'as':'Hoppers','foreignKey':_0xc731('0x142')});db['VoiceQueue'][_0xc731('0x109')](db[_0xc731('0x74')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0xc731('0x123')][_0xc731('0x109')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xc731('0x142')});db[_0xc731('0x123')]['hasMany'](db[_0xc731('0x78')],{'as':_0xc731('0x78'),'foreignKey':_0xc731('0x142')});db[_0xc731('0x123')][_0xc731('0x109')](db[_0xc731('0x72')],{'as':_0xc731('0x143'),'foreignKey':'VoiceQueueId'});db[_0xc731('0x123')][_0xc731('0x109')](db['JscriptySessionReport'],{'as':_0xc731('0x144'),'foreignKey':_0xc731('0x142')});db['VoiceQueue'][_0xc731('0x115')](db[_0xc731('0x27')],{'as':'Trunk','foreignKey':_0xc731('0x145')});db[_0xc731('0x123')][_0xc731('0x115')](db[_0xc731('0x27')],{'as':_0xc731('0x146'),'foreignKey':_0xc731('0x147')});db[_0xc731('0x123')]['belongsTo'](db['Interval'],{'as':_0xc731('0x148'),'foreignKey':_0xc731('0x149')});db[_0xc731('0x123')][_0xc731('0x115')](db[_0xc731('0x14a')],{'as':_0xc731('0x14b'),'foreignKey':_0xc731('0x14c')});db[_0xc731('0x123')][_0xc731('0x118')](db[_0xc731('0xee')],{'as':_0xc731('0x14d'),'through':_0xc731('0x14e')});db['VoiceQueue']['belongsToMany'](db['User'],{'as':_0xc731('0x14f'),'through':'UserVoiceQueue'});db[_0xc731('0x123')][_0xc731('0x118')](db[_0xc731('0xdc')],{'as':_0xc731('0x150'),'through':'team_has_voice_queues'});db[_0xc731('0x123')][_0xc731('0x118')](db[_0xc731('0xee')],{'as':'BlackLists','through':_0xc731('0x151')});db[_0xc731('0x152')]['belongsTo'](db['User'],{'as':'User','foreignKey':'UserId'});db[_0xc731('0x1b')]['belongsTo'](db[_0xc731('0x11')],{'as':'User','foreignKey':_0xc731('0x108')});db[_0xc731('0x105')]['hasMany'](db['VoiceMailMessage'],{'as':_0xc731('0x153'),'onDelete':'cascade','foreignKey':_0xc731('0x154'),'sourceKey':'mailbox'});db[_0xc731('0x1d')][_0xc731('0x115')](db[_0xc731('0x105')],{'foreignKey':_0xc731('0x154'),'targetKey':_0xc731('0x155')});db[_0xc731('0x1f')][_0xc731('0x109')](db[_0xc731('0x24')],{'as':_0xc731('0x156'),'foreignKey':'uniqueid','constraints':![]});db[_0xc731('0x1f')]['hasMany'](db[_0xc731('0x22')],{'as':_0xc731('0x157'),'foreignKey':'uniqueid','constraints':![]});db[_0xc731('0x1f')][_0xc731('0x115')](db[_0xc731('0x11')],{'as':'User','foreignKey':_0xc731('0x108')});db[_0xc731('0x1f')][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x3a')][_0xc731('0x115')](db['MailAccount'],{'as':_0xc731('0x3d'),'foreignKey':'MailAccountId'});db[_0xc731('0x3b')][_0xc731('0x115')](db['MailAccount'],{'as':_0xc731('0x3d'),'foreignKey':_0xc731('0x15a')});db[_0xc731('0x3d')][_0xc731('0x104')](db[_0xc731('0x3a')],{'as':_0xc731('0x15b'),'onDelete':_0xc731('0x106')});db[_0xc731('0x3d')]['hasOne'](db['MailServerOut'],{'as':_0xc731('0x15c'),'onDelete':_0xc731('0x106')});db['MailAccount'][_0xc731('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xc731('0x15a')});db['MailAccount'][_0xc731('0x109')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xc731('0x15a')});db[_0xc731('0x3d')][_0xc731('0x109')](db[_0xc731('0x42')],{'as':_0xc731('0x153'),'foreignKey':_0xc731('0x15a')});db[_0xc731('0x3d')][_0xc731('0x109')](db[_0xc731('0x113')],{'as':_0xc731('0x15d')});db[_0xc731('0x3d')][_0xc731('0x109')](db[_0xc731('0x44')],{'as':_0xc731('0x13e')});db[_0xc731('0x3d')][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db[_0xc731('0x3d')]['belongsTo'](db[_0xc731('0x8a')],{'as':_0xc731('0x8a'),'foreignKey':_0xc731('0x160')});db[_0xc731('0x3d')]['belongsTo'](db[_0xc731('0x14a')],{'as':_0xc731('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc731('0x3d')]['belongsToMany'](db[_0xc731('0x11')],{'as':'Agents','through':_0xc731('0x135')});db[_0xc731('0x3f')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x14f'),'through':'UserMailQueue'});db['MailQueue'][_0xc731('0x118')](db[_0xc731('0xdc')],{'through':_0xc731('0x161'),'as':_0xc731('0x150')});db[_0xc731('0x113')][_0xc731('0x109')](db[_0xc731('0x42')],{'as':_0xc731('0x153'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x162')});db['MailInteraction'][_0xc731('0x115')](db[_0xc731('0x3d')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x15a')});db[_0xc731('0x113')][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db['MailInteraction'][_0xc731('0x115')](db[_0xc731('0x11')],{'as':_0xc731('0x164'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0xc731('0x88')],{'through':_0xc731('0x165'),'as':'Tags'});db[_0xc731('0x113')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x165'),'as':_0xc731('0x166')});db['MailInteraction']['belongsToMany'](db[_0xc731('0x11')],{'as':_0xc731('0x167'),'through':'user_has_mail_interactions','foreignKey':_0xc731('0x162')});db[_0xc731('0x42')]['hasMany'](db[_0xc731('0x168')],{'as':_0xc731('0x169'),'onDelete':_0xc731('0x106')});db[_0xc731('0x42')][_0xc731('0x115')](db[_0xc731('0x11')],{'as':'User'});db['MailMessage'][_0xc731('0x115')](db[_0xc731('0x70')],{'onDelete':'cascade','as':'Contact'});db[_0xc731('0x42')][_0xc731('0x115')](db[_0xc731('0x113')],{'as':_0xc731('0x16a'),'foreignKey':'MailInteractionId'});db[_0xc731('0x42')]['belongsTo'](db[_0xc731('0x3d')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xc731('0x44')][_0xc731('0x115')](db[_0xc731('0x11')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0x44')][_0xc731('0x115')](db[_0xc731('0x3f')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0x44')][_0xc731('0x115')](db[_0xc731('0x3d')],{'onDelete':'restrict'});db[_0xc731('0x44')][_0xc731('0x115')](db['Interval'],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x149')});db[_0xc731('0x44')][_0xc731('0x115')](db[_0xc731('0x88')],{'onDelete':_0xc731('0x16b'),'foreignKey':'TagId'});db[_0xc731('0x46')]['belongsTo'](db['MailAccount'],{});db['MailQueueReport'][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db['MailQueueReport'][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x46')]['belongsTo'](db['MailInteraction'],{});db[_0xc731('0x46')][_0xc731('0x115')](db[_0xc731('0x42')],{});db['MailQueueReport'][_0xc731('0x115')](db[_0xc731('0x11')],{});db[_0xc731('0x46')][_0xc731('0x115')](db['MailQueue'],{});db[_0xc731('0x16c')]['hasMany'](db[_0xc731('0x49')],{'as':_0xc731('0x16d'),'onDelete':_0xc731('0x106')});db[_0xc731('0x4b')][_0xc731('0x109')](db[_0xc731('0x80')],{'as':'Dispositions','foreignKey':_0xc731('0x16e')});db[_0xc731('0x4b')]['hasMany'](db[_0xc731('0x7e')],{'as':_0xc731('0x16f'),'foreignKey':_0xc731('0x16e')});db['FaxAccount'][_0xc731('0x109')](db[_0xc731('0x111')],{'as':'Interactions'});db[_0xc731('0x4b')][_0xc731('0x109')](db[_0xc731('0x4d')],{'as':_0xc731('0x13e')});db[_0xc731('0x4b')][_0xc731('0x109')](db[_0xc731('0x17')],{'as':'Exntensions','onDelete':_0xc731('0x106')});db[_0xc731('0x4b')][_0xc731('0x109')](db['FaxMessage'],{'as':'Messages'});db[_0xc731('0x4b')][_0xc731('0x115')](db[_0xc731('0x27')],{'as':_0xc731('0x27')});db[_0xc731('0x4b')]['belongsTo'](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db[_0xc731('0x4b')][_0xc731('0x115')](db[_0xc731('0x14a')],{'as':_0xc731('0x14b'),'foreignKey':_0xc731('0x14c')});db[_0xc731('0x4b')][_0xc731('0x118')](db['User'],{'as':_0xc731('0x14f'),'through':_0xc731('0x133')});db['FaxApplication']['belongsTo'](db[_0xc731('0x11')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0x4d')][_0xc731('0x115')](db[_0xc731('0x127')],{'onDelete':'restrict'});db[_0xc731('0x4d')][_0xc731('0x115')](db[_0xc731('0x4b')],{'onDelete':_0xc731('0x16b')});db['FaxApplication'][_0xc731('0x115')](db[_0xc731('0x88')],{'onDelete':_0xc731('0x16b'),'foreignKey':'TagId'});db[_0xc731('0x111')][_0xc731('0x109')](db[_0xc731('0x50')],{'as':_0xc731('0x153'),'onDelete':_0xc731('0x106'),'foreignKey':'FaxInteractionId'});db[_0xc731('0x111')][_0xc731('0x115')](db[_0xc731('0x4b')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x16e')});db['FaxInteraction']['belongsTo'](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x111')][_0xc731('0x115')](db[_0xc731('0x11')],{'as':_0xc731('0x164'),'foreignKey':'UserId'});db[_0xc731('0x111')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x170'),'as':'Tags'});db[_0xc731('0x111')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x170'),'as':_0xc731('0x166')});db[_0xc731('0x111')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x167'),'through':_0xc731('0x11f'),'foreignKey':_0xc731('0x171')});db[_0xc731('0x50')][_0xc731('0x115')](db['User'],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x11')});db[_0xc731('0x50')][_0xc731('0x115')](db[_0xc731('0x111')],{'as':_0xc731('0x16a'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0xc731('0x70')],{'onDelete':_0xc731('0x106'),'as':'Contact'});db['FaxMessage']['belongsTo'](db[_0xc731('0x168')],{'as':_0xc731('0x168'),'foreignKey':_0xc731('0x172')});db[_0xc731('0x50')][_0xc731('0x115')](db[_0xc731('0x4b')],{'as':'Account','foreignKey':_0xc731('0x16e')});db[_0xc731('0x127')]['belongsToMany'](db['User'],{'as':_0xc731('0x14f'),'through':_0xc731('0x33')});db[_0xc731('0x127')][_0xc731('0x118')](db[_0xc731('0xdc')],{'through':_0xc731('0x173'),'as':_0xc731('0x150')});db['FaxQueueReport'][_0xc731('0x115')](db[_0xc731('0x4b')],{});db['FaxQueueReport'][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db[_0xc731('0x53')][_0xc731('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0xc731('0x159')});db[_0xc731('0x53')]['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport'][_0xc731('0x115')](db[_0xc731('0x50')],{});db['FaxQueueReport'][_0xc731('0x115')](db['User'],{});db[_0xc731('0x53')][_0xc731('0x115')](db[_0xc731('0x127')],{});db['SmsAccount'][_0xc731('0x109')](db[_0xc731('0x80')],{'as':_0xc731('0x174'),'foreignKey':_0xc731('0x175')});db['SmsAccount'][_0xc731('0x109')](db[_0xc731('0x7e')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xc731('0x54')][_0xc731('0x109')](db[_0xc731('0x176')],{'as':_0xc731('0x153'),'foreignKey':_0xc731('0x175')});db[_0xc731('0x54')][_0xc731('0x109')](db[_0xc731('0x57')],{'as':_0xc731('0x15d')});db[_0xc731('0x54')]['hasMany'](db['SmsApplication'],{'as':_0xc731('0x13e')});db['SmsAccount'][_0xc731('0x115')](db['CmList'],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db['SmsAccount']['belongsTo'](db[_0xc731('0x14a')],{'as':'mandatoryDispositionPause','foreignKey':_0xc731('0x14c')});db[_0xc731('0x54')]['belongsToMany'](db['User'],{'as':_0xc731('0x14f'),'through':_0xc731('0x138')});db[_0xc731('0x55')][_0xc731('0x115')](db[_0xc731('0x11')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0x55')][_0xc731('0x115')](db[_0xc731('0x5a')],{'onDelete':'restrict'});db[_0xc731('0x55')][_0xc731('0x115')](db['SmsAccount'],{'onDelete':'restrict'});db[_0xc731('0x55')][_0xc731('0x115')](db[_0xc731('0x148')],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x149')});db['SmsApplication'][_0xc731('0x115')](db[_0xc731('0x88')],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x177')});db[_0xc731('0x57')][_0xc731('0x109')](db[_0xc731('0x176')],{'as':_0xc731('0x153'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x178')});db['SmsInteraction'][_0xc731('0x115')](db['SmsAccount'],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x175')});db[_0xc731('0x57')]['belongsTo'](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xc731('0x115')](db[_0xc731('0x11')],{'as':_0xc731('0x164'),'foreignKey':_0xc731('0x108')});db[_0xc731('0x57')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x179'),'as':_0xc731('0x17a')});db[_0xc731('0x57')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x179'),'as':'ThroughTags'});db['SmsInteraction'][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x167'),'through':'user_has_sms_interactions','foreignKey':_0xc731('0x178')});db['SmsMessage']['belongsTo'](db[_0xc731('0x11')],{'as':_0xc731('0x11')});db[_0xc731('0x176')][_0xc731('0x115')](db[_0xc731('0x70')],{'onDelete':'cascade','as':_0xc731('0x158')});db[_0xc731('0x176')][_0xc731('0x115')](db[_0xc731('0x57')],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x16a'),'foreignKey':_0xc731('0x178')});db[_0xc731('0x176')]['belongsTo'](db[_0xc731('0x54')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x175')});db[_0xc731('0x5a')][_0xc731('0x118')](db['User'],{'as':'Agents','through':_0xc731('0x34'),'foreignKey':_0xc731('0x17b')});db[_0xc731('0x5a')][_0xc731('0x118')](db[_0xc731('0xdc')],{'through':_0xc731('0x17c'),'as':_0xc731('0x150')});db['OpenchannelAccount'][_0xc731('0x109')](db[_0xc731('0x80')],{'as':_0xc731('0x174'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xc731('0x109')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xc731('0x17d')});db[_0xc731('0x5c')][_0xc731('0x109')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0xc731('0x17d')});db[_0xc731('0x5c')][_0xc731('0x109')](db[_0xc731('0x17e')],{'as':_0xc731('0x153'),'foreignKey':_0xc731('0x17d')});db[_0xc731('0x5c')][_0xc731('0x109')](db[_0xc731('0x17f')],{'as':_0xc731('0x13e'),'foreignKey':_0xc731('0x17d')});db[_0xc731('0x5c')][_0xc731('0x115')](db[_0xc731('0xee')],{'as':'List','foreignKey':_0xc731('0x15f')});db['OpenchannelAccount'][_0xc731('0x115')](db[_0xc731('0x14a')],{'as':_0xc731('0x14b'),'foreignKey':_0xc731('0x14c')});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xc731('0x115')](db[_0xc731('0x11')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0x17f')][_0xc731('0x115')](db[_0xc731('0x12a')],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x180')});db['OpenchannelApplication'][_0xc731('0x115')](db[_0xc731('0x5c')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xc731('0x17f')]['belongsTo'](db[_0xc731('0x148')],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x149')});db[_0xc731('0x17f')][_0xc731('0x115')](db[_0xc731('0x88')],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x177')});db[_0xc731('0x5f')][_0xc731('0x109')](db['OpenchannelMessage'],{'as':_0xc731('0x153'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xc731('0x5f')]['belongsTo'](db[_0xc731('0x5c')],{'as':'Account','foreignKey':_0xc731('0x17d')});db[_0xc731('0x5f')]['belongsTo'](db['CmContact'],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db['OpenchannelInteraction'][_0xc731('0x115')](db[_0xc731('0x11')],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction']['belongsToMany'](db[_0xc731('0x88')],{'through':_0xc731('0x181'),'as':'Tags'});db[_0xc731('0x5f')]['belongsToMany'](db[_0xc731('0x88')],{'through':_0xc731('0x181'),'as':_0xc731('0x166')});db['OpenchannelInteraction']['belongsToMany'](db[_0xc731('0x11')],{'as':'Users','through':_0xc731('0x121'),'foreignKey':_0xc731('0x182')});db[_0xc731('0x17e')][_0xc731('0x115')](db['User'],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x11')});db[_0xc731('0x17e')][_0xc731('0x115')](db[_0xc731('0x70')],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x158')});db[_0xc731('0x17e')]['belongsTo'](db[_0xc731('0x5f')],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x16a'),'foreignKey':_0xc731('0x182')});db['OpenchannelMessage'][_0xc731('0x115')](db[_0xc731('0x168')],{'as':_0xc731('0x168'),'foreignKey':'AttachmentId'});db[_0xc731('0x17e')][_0xc731('0x115')](db['OpenchannelAccount'],{'as':_0xc731('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xc731('0x12a')]['belongsToMany'](db['User'],{'as':_0xc731('0x14f'),'through':_0xc731('0x36'),'foreignKey':_0xc731('0x180')});db[_0xc731('0x12a')]['belongsToMany'](db[_0xc731('0xdc')],{'through':_0xc731('0x183'),'as':_0xc731('0x150')});db['ChatWebsite'][_0xc731('0x109')](db[_0xc731('0x80')],{'as':_0xc731('0x174'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xc731('0x109')](db[_0xc731('0x7e')],{'as':_0xc731('0x16f'),'foreignKey':_0xc731('0x184')});db['ChatWebsite']['hasMany'](db[_0xc731('0x6c')],{'as':_0xc731('0x185')});db[_0xc731('0x61')][_0xc731('0x109')](db['ChatInteraction'],{'as':_0xc731('0x15d')});db[_0xc731('0x61')][_0xc731('0x109')](db['ChatApplication'],{'as':'Applications'});db[_0xc731('0x61')][_0xc731('0x109')](db[_0xc731('0x67')],{'as':_0xc731('0x153')});db['ChatWebsite']['belongsTo'](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db['ChatWebsite'][_0xc731('0x115')](db[_0xc731('0x148')],{'as':_0xc731('0x148'),'foreignKey':_0xc731('0x149')});db[_0xc731('0x61')]['belongsTo'](db['Pause'],{'as':_0xc731('0x14b'),'foreignKey':_0xc731('0x14c')});db[_0xc731('0x61')]['belongsToMany'](db['User'],{'as':_0xc731('0x14f'),'through':'user_has_chat_websites'});db[_0xc731('0x62')]['belongsTo'](db[_0xc731('0x5c')],{});db[_0xc731('0x62')]['belongsTo'](db['CmList'],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db['OpenchannelQueueReport'][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x62')]['belongsTo'](db[_0xc731('0x5f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xc731('0x17e')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xc731('0x11')],{});db[_0xc731('0x62')][_0xc731('0x115')](db['OpenchannelQueue'],{});db[_0xc731('0x64')]['belongsTo'](db['User'],{'as':_0xc731('0x186'),'foreignKey':_0xc731('0x108'),'onDelete':_0xc731('0x16b')});db[_0xc731('0x64')]['belongsTo'](db['ChatQueue'],{'as':_0xc731('0x187'),'foreignKey':_0xc731('0x188'),'onDelete':_0xc731('0x16b')});db[_0xc731('0x64')]['belongsTo'](db[_0xc731('0x61')],{'as':'Website','foreignKey':_0xc731('0x184'),'onDelete':_0xc731('0x16b')});db[_0xc731('0x64')][_0xc731('0x115')](db[_0xc731('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc731('0x65')][_0xc731('0x109')](db['ChatMessage'],{'as':_0xc731('0x153'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x189')});db['ChatInteraction'][_0xc731('0x115')](db[_0xc731('0x61')],{'as':'Account','foreignKey':_0xc731('0x184')});db[_0xc731('0x65')][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db['ChatInteraction'][_0xc731('0x115')](db['User'],{'as':_0xc731('0x164'),'foreignKey':'UserId'});db[_0xc731('0x65')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x18a'),'as':_0xc731('0x17a')});db[_0xc731('0x65')]['belongsToMany'](db[_0xc731('0x88')],{'through':'chat_interaction_has_tags','as':_0xc731('0x166')});db[_0xc731('0x65')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x167'),'through':_0xc731('0x11e'),'foreignKey':'ChatInteractionId'});db[_0xc731('0x67')][_0xc731('0x115')](db['User'],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x11')});db[_0xc731('0x67')]['belongsTo'](db[_0xc731('0x70')],{'onDelete':_0xc731('0x106'),'as':'Contact','foreignKey':_0xc731('0x159')});db[_0xc731('0x67')][_0xc731('0x115')](db[_0xc731('0x65')],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x16a'),'foreignKey':_0xc731('0x189')});db[_0xc731('0x67')][_0xc731('0x115')](db[_0xc731('0x168')],{'as':'Attachment','foreignKey':_0xc731('0x172')});db[_0xc731('0x67')][_0xc731('0x115')](db[_0xc731('0x61')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xc731('0x69')][_0xc731('0x115')](db[_0xc731('0x70')],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x158'),'foreignKey':'ContactId'});db[_0xc731('0x69')][_0xc731('0x115')](db[_0xc731('0x61')],{'as':'Account','foreignKey':_0xc731('0x184')});db[_0xc731('0x125')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x14f'),'through':_0xc731('0x2f'),'hooks':!![]});db[_0xc731('0x125')][_0xc731('0x118')](db[_0xc731('0xdc')],{'through':'team_has_chat_queues','as':_0xc731('0x150')});db['ChatGroup'][_0xc731('0x109')](db[_0xc731('0xca')],{'as':'Messages','foreignKey':_0xc731('0x18b'),'onDelete':'cascade'});db[_0xc731('0x6a')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x141'),'through':_0xc731('0x18c')});db['ChatProactiveAction']['belongsTo'](db[_0xc731('0x61')],{'as':_0xc731('0x18d'),'foreignKey':_0xc731('0x184')});db[_0xc731('0x6e')][_0xc731('0x109')](db[_0xc731('0x70')],{'as':_0xc731('0x119'),'foreignKey':_0xc731('0x18e')});db[_0xc731('0x70')][_0xc731('0x109')](db[_0xc731('0x71')],{'as':_0xc731('0x18f'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x70')]['hasMany'](db[_0xc731('0x74')],{'as':_0xc731('0x10c'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x70')][_0xc731('0x109')](db['CmHopperHistory'],{'as':_0xc731('0x190'),'foreignKey':_0xc731('0x159')});db['CmContact'][_0xc731('0x109')](db[_0xc731('0x78')],{'as':_0xc731('0x78'),'foreignKey':_0xc731('0x159')});db['CmContact'][_0xc731('0x109')](db['JscriptySessionReport'],{'as':_0xc731('0x144'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x70')][_0xc731('0x109')](db[_0xc731('0x5f')],{'as':'OpenchannelInteractions','foreignKey':_0xc731('0x159'),'onDelete':_0xc731('0x16b')});db[_0xc731('0x70')]['hasMany'](db[_0xc731('0x65')],{'as':_0xc731('0x10f'),'foreignKey':_0xc731('0x159'),'onDelete':'restrict'});db['CmContact'][_0xc731('0x109')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xc731('0x159'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0xc731('0x111')],{'as':_0xc731('0x112'),'foreignKey':_0xc731('0x159'),'onDelete':_0xc731('0x16b')});db['CmContact'][_0xc731('0x109')](db['MailInteraction'],{'as':_0xc731('0x11c'),'foreignKey':'ContactId','onDelete':_0xc731('0x16b')});db[_0xc731('0x70')]['belongsTo'](db[_0xc731('0x6e')],{'as':_0xc731('0x191'),'foreignKey':'CompanyId'});db['CmContact'][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f'),'onDelete':'cascade'});db[_0xc731('0x70')]['belongsToMany'](db[_0xc731('0x11')],{'as':_0xc731('0x167'),'through':_0xc731('0x11a')});db[_0xc731('0x70')][_0xc731('0x118')](db[_0xc731('0x88')],{'as':_0xc731('0x17a'),'through':_0xc731('0x192')});db[_0xc731('0x70')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db['CmHopper'][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159'),'onDelete':'cascade'});db['CmHopper'][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f'),'onDelete':_0xc731('0x106')});db[_0xc731('0x71')][_0xc731('0x115')](db['User'],{'as':'Agent','foreignKey':_0xc731('0x108')});db['CmHopper'][_0xc731('0x115')](db['VoiceQueue'],{'as':_0xc731('0x187'),'foreignKey':_0xc731('0x142'),'onDelete':'cascade'});db[_0xc731('0x71')][_0xc731('0x115')](db[_0xc731('0xdf')],{'as':_0xc731('0xdf'),'foreignKey':_0xc731('0x193'),'onDelete':_0xc731('0x106')});db[_0xc731('0x71')][_0xc731('0x115')](db['User'],{'as':_0xc731('0x164'),'foreignKey':_0xc731('0x194')});db[_0xc731('0x72')][_0xc731('0x115')](db[_0xc731('0x70')],{'as':'Contact','foreignKey':_0xc731('0x159'),'onDelete':_0xc731('0x106')});db[_0xc731('0x72')][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f'),'onDelete':_0xc731('0x106')});db['CmHopperBlack'][_0xc731('0x115')](db['VoiceQueue'],{'as':_0xc731('0x187'),'foreignKey':_0xc731('0x142'),'onDelete':'cascade'});db[_0xc731('0x72')]['belongsTo'](db[_0xc731('0xdf')],{'as':_0xc731('0xdf'),'foreignKey':'CampaignId','onDelete':_0xc731('0x106')});db[_0xc731('0x7d')][_0xc731('0x109')](db[_0xc731('0x82')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xc731('0x195'),'onDelete':_0xc731('0x106'),'hooks':!![]});db['Automation'][_0xc731('0x109')](db[_0xc731('0x82')],{'as':{'plural':_0xc731('0x196'),'singular':_0xc731('0x197')},'foreignKey':_0xc731('0x198'),'onDelete':_0xc731('0x106'),'hooks':!![]});db[_0xc731('0x7d')][_0xc731('0x109')](db[_0xc731('0x199')],{'as':_0xc731('0x19a'),'foreignKey':_0xc731('0x19b'),'onDelete':_0xc731('0x106'),'hooks':!![]});db[_0xc731('0x80')][_0xc731('0x109')](db[_0xc731('0x80')],{'as':_0xc731('0x174'),'foreignKey':_0xc731('0x19c'),'onDelete':_0xc731('0x106')});db[_0xc731('0x148')]['hasMany'](db[_0xc731('0x148')],{'as':_0xc731('0x19d'),'foreignKey':_0xc731('0x149'),'onDelete':_0xc731('0x106'),'hooks':!![],'required':![]});db['Interval'][_0xc731('0x109')](db[_0xc731('0x17')],{'as':_0xc731('0x10b'),'foreignKey':_0xc731('0x149'),'onDelete':'restrict'});db[_0xc731('0x148')][_0xc731('0x109')](db[_0xc731('0x44')],{'as':_0xc731('0x19e'),'foreignKey':_0xc731('0x149')});db[_0xc731('0x148')][_0xc731('0x109')](db[_0xc731('0x64')],{'as':_0xc731('0x19f'),'foreignKey':_0xc731('0x149')});db[_0xc731('0x148')][_0xc731('0x109')](db[_0xc731('0x4d')],{'as':'FaxApplications','foreignKey':_0xc731('0x149')});db[_0xc731('0x148')]['hasMany'](db[_0xc731('0x55')],{'as':_0xc731('0x1a0'),'foreignKey':_0xc731('0x149')});db['Schedule'][_0xc731('0x115')](db[_0xc731('0x3d')],{});db[_0xc731('0x1a1')][_0xc731('0x115')](db[_0xc731('0x92')],{'foreignKey':'DefaultReportId'});db[_0xc731('0x1a1')][_0xc731('0x115')](db['AnalyticCustomReport'],{'foreignKey':_0xc731('0x1a2')});db[_0xc731('0x1a3')][_0xc731('0x118')](db['VoiceMusicOnHold'],{'as':_0xc731('0x1a4'),'through':_0xc731('0x140'),'onDelete':_0xc731('0x16b')});db[_0xc731('0x88')][_0xc731('0x118')](db[_0xc731('0x70')],{'through':_0xc731('0x192')});db['Tag'][_0xc731('0x118')](db[_0xc731('0x65')],{'through':_0xc731('0x18a')});db[_0xc731('0x88')][_0xc731('0x118')](db['MailInteraction'],{'through':_0xc731('0x165')});db[_0xc731('0x88')]['belongsToMany'](db[_0xc731('0x57')],{'through':_0xc731('0x179')});db['Tag']['belongsToMany'](db['FaxInteraction'],{'through':_0xc731('0x170')});db[_0xc731('0x88')][_0xc731('0x118')](db[_0xc731('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0xc731('0x88')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xc731('0x1a5')});db[_0xc731('0x8b')][_0xc731('0x109')](db[_0xc731('0x82')],{'as':{'plural':_0xc731('0x1a6'),'singular':_0xc731('0x1a7')},'foreignKey':_0xc731('0x1a8'),'onDelete':_0xc731('0x106'),'hooks':!![]});db[_0xc731('0x8b')][_0xc731('0x109')](db[_0xc731('0x82')],{'as':{'plural':_0xc731('0x1a9'),'singular':_0xc731('0x1aa')},'foreignKey':'TriggerAnyId','onDelete':_0xc731('0x106'),'hooks':!![]});db[_0xc731('0x8b')][_0xc731('0x109')](db[_0xc731('0x199')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0xc731('0x91')]['hasMany'](db[_0xc731('0x1ab')],{'as':_0xc731('0x1ac'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1a2'),'hooks':!![]});db[_0xc731('0x92')][_0xc731('0x109')](db[_0xc731('0x1ab')],{'as':_0xc731('0x1ac'),'onDelete':'cascade','foreignKey':_0xc731('0x1ad')});db[_0xc731('0x96')][_0xc731('0x109')](db[_0xc731('0x1ab')],{'as':_0xc731('0x1ac'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1ae')});db[_0xc731('0x1ab')]['belongsTo'](db[_0xc731('0x96')],{'foreignKey':_0xc731('0x1ae')});db[_0xc731('0x99')][_0xc731('0x109')](db[_0xc731('0x9b')],{'as':_0xc731('0x1af'),'onDelete':'cascade','foreignKey':_0xc731('0x1b0')});db[_0xc731('0x9b')][_0xc731('0x109')](db[_0xc731('0x1b1')],{'as':'Subjects','onDelete':_0xc731('0x106'),'foreignKey':'SubjectId'});db[_0xc731('0x9b')][_0xc731('0x109')](db[_0xc731('0x1b1')],{'as':'Descriptions','onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b2')});db['SalesforceConfiguration'][_0xc731('0x109')](db[_0xc731('0x1b1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc731('0x1b3')});db[_0xc731('0x9b')][_0xc731('0x115')](db[_0xc731('0x99')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1b0')});db[_0xc731('0x1b1')][_0xc731('0x109')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xc731('0x1b4')});db[_0xc731('0x1b1')][_0xc731('0x109')](db[_0xc731('0x1b1')],{'as':_0xc731('0x1b5'),'foreignKey':'DescriptionId'});db[_0xc731('0x1b1')][_0xc731('0x109')](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc731('0x1b1')][_0xc731('0x115')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xc731('0x1b6')][_0xc731('0x109')](db[_0xc731('0x9d')],{'as':_0xc731('0x1af'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b0')});db['SugarcrmConfiguration']['hasMany'](db[_0xc731('0x9f')],{'as':_0xc731('0x1b7'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0x9d')][_0xc731('0x109')](db['SugarcrmField'],{'as':_0xc731('0x1b8'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b2')});db[_0xc731('0x9d')][_0xc731('0x109')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xc731('0x106'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xc731('0x115')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xc731('0x1b0')});db[_0xc731('0x9f')][_0xc731('0x109')](db[_0xc731('0x9f')],{'as':_0xc731('0x1b9'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0x9f')][_0xc731('0x109')](db[_0xc731('0x9f')],{'as':'Description','foreignKey':_0xc731('0x1b2')});db[_0xc731('0x9f')][_0xc731('0x109')](db[_0xc731('0x9f')],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0x9f')][_0xc731('0x115')](db['Variable'],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db[_0xc731('0xa1')][_0xc731('0x109')](db[_0xc731('0x1bd')],{'as':_0xc731('0x1af'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc731('0x1bd')][_0xc731('0x109')](db[_0xc731('0xa3')],{'as':'Subjects','onDelete':_0xc731('0x106'),'foreignKey':'SubjectId'});db[_0xc731('0x1bd')][_0xc731('0x109')](db[_0xc731('0xa3')],{'as':_0xc731('0x1b8'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b2')});db[_0xc731('0x1bd')][_0xc731('0x109')](db['DeskField'],{'as':_0xc731('0x1ac'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0x1bd')][_0xc731('0x115')](db[_0xc731('0xa1')],{'as':'Account','foreignKey':'AccountId'});db[_0xc731('0x1bd')]['belongsToMany'](db[_0xc731('0x88')],{'through':_0xc731('0x1be')});db[_0xc731('0xa3')][_0xc731('0x109')](db[_0xc731('0xa3')],{'as':_0xc731('0x1b9'),'foreignKey':_0xc731('0x1b4')});db['DeskField'][_0xc731('0x109')](db['DeskField'],{'as':_0xc731('0x1b5'),'foreignKey':_0xc731('0x1b2')});db['DeskField'][_0xc731('0x109')](db['DeskField'],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db['DeskField']['belongsTo'](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db[_0xc731('0x1bf')][_0xc731('0x109')](db['ZohoConfiguration'],{'as':_0xc731('0x1af'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b0')});db[_0xc731('0xa5')][_0xc731('0x109')](db['ZohoField'],{'as':_0xc731('0x1b7'),'onDelete':_0xc731('0x106'),'foreignKey':'SubjectId'});db[_0xc731('0xa5')]['hasMany'](db[_0xc731('0xa7')],{'as':_0xc731('0x1b8'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b2')});db['ZohoConfiguration']['hasMany'](db[_0xc731('0xa7')],{'as':_0xc731('0x1ac'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xa5')][_0xc731('0x115')](db[_0xc731('0x1bf')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1b0')});db[_0xc731('0xa7')]['hasMany'](db['ZohoField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xc731('0xa7')][_0xc731('0x109')](db['ZohoField'],{'as':_0xc731('0x1b5'),'foreignKey':_0xc731('0x1b2')});db['ZohoField'][_0xc731('0x109')](db['ZohoField'],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xa7')][_0xc731('0x115')](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db['ZendeskAccount'][_0xc731('0x109')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc731('0x1b0')});db[_0xc731('0x1c0')][_0xc731('0x109')](db[_0xc731('0xab')],{'as':_0xc731('0x1b7'),'foreignKey':'SubjectId'});db[_0xc731('0x1c0')][_0xc731('0x109')](db['ZendeskField'],{'as':_0xc731('0x1b8'),'foreignKey':_0xc731('0x1b2')});db['ZendeskConfiguration'][_0xc731('0x109')](db[_0xc731('0xab')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0xc731('0xa9')],{'as':_0xc731('0x163'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x1c1')});db[_0xc731('0xab')][_0xc731('0x109')](db[_0xc731('0xab')],{'as':_0xc731('0x1b9'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0xab')][_0xc731('0x109')](db['ZendeskField'],{'as':_0xc731('0x1b5'),'foreignKey':_0xc731('0x1b2')});db[_0xc731('0xab')]['hasMany'](db[_0xc731('0xab')],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db['ZendeskField'][_0xc731('0x115')](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db['FreshdeskAccount'][_0xc731('0x109')](db['FreshdeskConfiguration'],{'as':_0xc731('0x1af'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b0')});db[_0xc731('0xaf')][_0xc731('0x109')](db['FreshdeskField'],{'as':_0xc731('0x1b7'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b4')});db['FreshdeskConfiguration'][_0xc731('0x109')](db[_0xc731('0xb1')],{'as':_0xc731('0x1b8'),'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b2')});db['FreshdeskConfiguration'][_0xc731('0x109')](db[_0xc731('0xb1')],{'as':'Fields','onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xaf')]['belongsTo'](db[_0xc731('0xad')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1b0')});db[_0xc731('0xaf')][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x1c2')});db['FreshdeskField']['hasMany'](db[_0xc731('0xb1')],{'as':'Subject','foreignKey':_0xc731('0x1b4')});db[_0xc731('0xb1')][_0xc731('0x109')](db[_0xc731('0xb1')],{'as':_0xc731('0x1b5'),'foreignKey':_0xc731('0x1b2')});db[_0xc731('0xb1')][_0xc731('0x109')](db[_0xc731('0xb1')],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xb1')][_0xc731('0x115')](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':'VariableId'});db[_0xc731('0xb3')]['hasMany'](db[_0xc731('0xb4')],{'as':'Configurations','onDelete':_0xc731('0x106'),'foreignKey':'AccountId'});db[_0xc731('0xb4')][_0xc731('0x109')](db[_0xc731('0x1c3')],{'as':_0xc731('0x1b7'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0xb4')]['hasMany'](db[_0xc731('0x1c3')],{'as':'Descriptions','foreignKey':_0xc731('0x1b2')});db[_0xc731('0xb4')][_0xc731('0x109')](db[_0xc731('0x1c3')],{'as':_0xc731('0x1ac'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xb4')]['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':_0xc731('0x1b0')});db['VtigerField'][_0xc731('0x109')](db['VtigerField'],{'as':'Subject','foreignKey':_0xc731('0x1b4')});db['VtigerField'][_0xc731('0x109')](db[_0xc731('0x1c3')],{'as':_0xc731('0x1b5'),'foreignKey':'DescriptionId'});db[_0xc731('0x1c3')]['hasMany'](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc731('0x1c3')][_0xc731('0x115')](db['Variable'],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db[_0xc731('0xb7')][_0xc731('0x109')](db[_0xc731('0xb8')],{'as':_0xc731('0x1af'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc731('0xb8')][_0xc731('0x109')](db[_0xc731('0xba')],{'as':_0xc731('0x1b7'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0xb8')][_0xc731('0x109')](db[_0xc731('0xba')],{'as':'Descriptions','foreignKey':_0xc731('0x1b2')});db[_0xc731('0xb8')][_0xc731('0x109')](db[_0xc731('0xba')],{'as':_0xc731('0x1ac'),'foreignKey':'FieldId'});db[_0xc731('0xb8')]['belongsTo'](db[_0xc731('0xb7')],{'as':_0xc731('0x163'),'foreignKey':'AccountId'});db[_0xc731('0xba')][_0xc731('0x109')](db[_0xc731('0xba')],{'as':_0xc731('0x1b9'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0xba')][_0xc731('0x109')](db[_0xc731('0xba')],{'as':_0xc731('0x1b5'),'foreignKey':'DescriptionId'});db[_0xc731('0xba')]['hasMany'](db[_0xc731('0xba')],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db['ServicenowField'][_0xc731('0x115')](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db[_0xc731('0xbb')][_0xc731('0x109')](db[_0xc731('0xbd')],{'as':_0xc731('0x1af'),'onDelete':'cascade','foreignKey':_0xc731('0x1b0')});db[_0xc731('0xbd')][_0xc731('0x109')](db[_0xc731('0xbf')],{'as':_0xc731('0x1b7'),'onDelete':_0xc731('0x106'),'foreignKey':'SubjectId'});db[_0xc731('0xbd')][_0xc731('0x109')](db[_0xc731('0xbf')],{'as':_0xc731('0x1b8'),'onDelete':_0xc731('0x106'),'foreignKey':'DescriptionId'});db[_0xc731('0xbd')]['hasMany'](db[_0xc731('0xbf')],{'as':'Fields','onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xbd')][_0xc731('0x115')](db[_0xc731('0xbb')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1b0')});db[_0xc731('0xbf')]['hasMany'](db[_0xc731('0xbf')],{'as':_0xc731('0x1b9'),'foreignKey':'SubjectId'});db[_0xc731('0xbf')][_0xc731('0x109')](db[_0xc731('0xbf')],{'as':_0xc731('0x1b5'),'foreignKey':_0xc731('0x1b2')});db['Dynamics365Field'][_0xc731('0x109')](db['Dynamics365Field'],{'as':_0xc731('0x1ba'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xbf')][_0xc731('0x115')](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db['FreshsalesAccount'][_0xc731('0x109')](db[_0xc731('0xc2')],{'as':'Configurations','onDelete':_0xc731('0x106'),'foreignKey':'AccountId'});db[_0xc731('0xc2')][_0xc731('0x109')](db['FreshsalesField'],{'as':_0xc731('0x1b7'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0xc2')][_0xc731('0x109')](db[_0xc731('0xc4')],{'as':_0xc731('0x1b8'),'foreignKey':'DescriptionId'});db[_0xc731('0xc2')][_0xc731('0x109')](db[_0xc731('0xc4')],{'as':_0xc731('0x1ac'),'foreignKey':_0xc731('0x1b3')});db[_0xc731('0xc2')][_0xc731('0x115')](db['FreshsalesAccount'],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1b0')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0xc731('0x1b9'),'foreignKey':_0xc731('0x1b4')});db[_0xc731('0xc4')]['hasMany'](db[_0xc731('0xc4')],{'as':_0xc731('0x1b5'),'foreignKey':_0xc731('0x1b2')});db[_0xc731('0xc4')]['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0xc731('0x1b3')});db[_0xc731('0xc4')][_0xc731('0x115')](db[_0xc731('0x1bb')],{'as':_0xc731('0x1bb'),'foreignKey':_0xc731('0x1bc')});db[_0xc731('0xc9')][_0xc731('0x115')](db[_0xc731('0x61')],{});db[_0xc731('0xc9')]['belongsTo'](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xc731('0x115')](db[_0xc731('0x70')],{'as':'Contact','foreignKey':_0xc731('0x159')});db['ChatQueueReport'][_0xc731('0x115')](db[_0xc731('0x65')],{});db['ChatQueueReport'][_0xc731('0x115')](db['ChatMessage'],{});db['ChatQueueReport'][_0xc731('0x115')](db[_0xc731('0x11')],{});db[_0xc731('0xc9')][_0xc731('0x115')](db['ChatQueue'],{});db[_0xc731('0xca')][_0xc731('0x115')](db[_0xc731('0x11')],{'onDelete':_0xc731('0x106'),'foreignKey':'FromId'});db[_0xc731('0xca')][_0xc731('0x115')](db[_0xc731('0x11')],{'onDelete':_0xc731('0x106'),'foreignKey':_0xc731('0x1c4')});db[_0xc731('0xce')][_0xc731('0x109')](db[_0xc731('0xcc')],{'foreignKey':_0xc731('0x1c5'),'onDelete':_0xc731('0x106')});db[_0xc731('0xce')]['hasMany'](db[_0xc731('0xcb')],{'foreignKey':_0xc731('0x1c5'),'onDelete':'cascade'});db[_0xc731('0x1c6')][_0xc731('0x115')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0xc731('0xee')],{'as':'List','foreignKey':_0xc731('0x15f')});db[_0xc731('0x1c6')][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0x1c6')]['belongsTo'](db['SmsInteraction'],{});db[_0xc731('0x1c6')][_0xc731('0x115')](db[_0xc731('0x176')],{});db['SmsQueueReport']['belongsTo'](db[_0xc731('0x11')],{});db['SmsQueueReport'][_0xc731('0x115')](db[_0xc731('0x5a')],{});db['JscriptyProject'][_0xc731('0x109')](db[_0xc731('0xce')],{'foreignKey':_0xc731('0x1c7')});db['JscriptyProject'][_0xc731('0x109')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xc731('0x109')](db[_0xc731('0xcb')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xc731('0x118')](db['User'],{'as':_0xc731('0x167'),'through':'user_has_square_projects'});db[_0xc731('0xdc')]['belongsToMany'](db[_0xc731('0x11')],{'as':_0xc731('0x14f'),'through':_0xc731('0x1c8')});db[_0xc731('0xdc')][_0xc731('0x118')](db[_0xc731('0x123')],{'through':_0xc731('0x1c9'),'as':'VoiceQueues'});db[_0xc731('0xdc')]['belongsToMany'](db['MailQueue'],{'through':_0xc731('0x161'),'as':_0xc731('0x124')});db[_0xc731('0xdc')][_0xc731('0x118')](db[_0xc731('0x125')],{'through':_0xc731('0x1ca'),'as':_0xc731('0x126')});db['Team']['belongsToMany'](db[_0xc731('0x127')],{'through':_0xc731('0x173'),'as':_0xc731('0x128')});db['Team'][_0xc731('0x118')](db[_0xc731('0x5a')],{'through':_0xc731('0x17c'),'as':_0xc731('0x129')});db['Team'][_0xc731('0x118')](db[_0xc731('0x12a')],{'through':_0xc731('0x183'),'as':_0xc731('0x1cb')});db[_0xc731('0xdc')][_0xc731('0x118')](db['WhatsappQueue'],{'through':_0xc731('0x1cc'),'as':_0xc731('0x12c')});db[_0xc731('0xdf')][_0xc731('0x109')](db['CmHopper'],{'as':_0xc731('0x18f'),'foreignKey':'CampaignId'});db[_0xc731('0xdf')][_0xc731('0x109')](db[_0xc731('0x74')],{'as':_0xc731('0x10c'),'foreignKey':_0xc731('0x193')});db[_0xc731('0xdf')]['hasMany'](db[_0xc731('0x76')],{'as':_0xc731('0x190'),'foreignKey':_0xc731('0x193')});db[_0xc731('0xdf')]['hasMany'](db['CmHopperBlack'],{'as':_0xc731('0x143'),'foreignKey':'CampaignId'});db['Campaign'][_0xc731('0x115')](db[_0xc731('0x27')],{'as':_0xc731('0x27'),'foreignKey':_0xc731('0x145')});db[_0xc731('0xdf')][_0xc731('0x115')](db[_0xc731('0x27')],{'as':'TrunkBackup','foreignKey':_0xc731('0x147')});db[_0xc731('0xdf')]['belongsTo'](db[_0xc731('0x148')],{'as':_0xc731('0x148'),'foreignKey':_0xc731('0x149')});db[_0xc731('0xdf')]['belongsTo'](db[_0xc731('0xd7')],{'as':_0xc731('0xd7'),'foreignKey':_0xc731('0x1cd')});db[_0xc731('0xdf')][_0xc731('0x118')](db[_0xc731('0xee')],{'as':_0xc731('0x14d'),'through':_0xc731('0x1ce')});db[_0xc731('0xdf')][_0xc731('0x118')](db[_0xc731('0xee')],{'as':'BlackLists','through':_0xc731('0x1cf')});db[_0xc731('0xe5')][_0xc731('0x115')](db['MailMessage'],{});db[_0xc731('0xe5')][_0xc731('0x115')](db[_0xc731('0x113')],{});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0xc731('0x1d0'),'as':_0xc731('0x1d1')});db[_0xc731('0xe5')][_0xc731('0x115')](db[_0xc731('0x11')],{'foreignKey':_0xc731('0x1d2'),'as':_0xc731('0x1d3')});db[_0xc731('0xe5')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xc731('0x1d4')});db[_0xc731('0xe5')][_0xc731('0x115')](db['MailQueue'],{'foreignKey':_0xc731('0x1d5'),'as':_0xc731('0x1d6')});db[_0xc731('0xe5')][_0xc731('0x115')](db[_0xc731('0x3d')],{'foreignKey':_0xc731('0x1d7'),'as':_0xc731('0x1d8')});db[_0xc731('0xe7')]['belongsTo'](db[_0xc731('0x67')],{});db[_0xc731('0xe7')][_0xc731('0x115')](db['ChatInteraction'],{});db[_0xc731('0xe7')]['belongsTo'](db[_0xc731('0x61')],{'foreignKey':_0xc731('0x1d9'),'as':'FromAccount'});db[_0xc731('0xe7')][_0xc731('0x115')](db['User'],{'foreignKey':_0xc731('0x1d2'),'as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db[_0xc731('0x11')],{'foreignKey':_0xc731('0x1da'),'as':_0xc731('0x1d4')});db['ChatTransferReport'][_0xc731('0x115')](db['ChatQueue'],{'foreignKey':_0xc731('0x1db'),'as':_0xc731('0x1d6')});db['ChatTransferReport'][_0xc731('0x115')](db['ChatWebsite'],{'foreignKey':_0xc731('0x1dc'),'as':'ToAccount'});db[_0xc731('0xe9')][_0xc731('0x115')](db[_0xc731('0x50')],{});db['FaxTransferReport'][_0xc731('0x115')](db[_0xc731('0x111')],{});db[_0xc731('0xe9')]['belongsTo'](db[_0xc731('0x4b')],{'foreignKey':'FromFaxAccountId','as':_0xc731('0x1d1')});db[_0xc731('0xe9')][_0xc731('0x115')](db['User'],{'foreignKey':_0xc731('0x1d2'),'as':_0xc731('0x1d3')});db['FaxTransferReport'][_0xc731('0x115')](db[_0xc731('0x11')],{'foreignKey':'ToUserId','as':_0xc731('0x1d4')});db[_0xc731('0xe9')][_0xc731('0x115')](db[_0xc731('0x127')],{'foreignKey':_0xc731('0x1dd'),'as':_0xc731('0x1d6')});db['FaxTransferReport'][_0xc731('0x115')](db['FaxAccount'],{'foreignKey':_0xc731('0x1de'),'as':_0xc731('0x1d8')});db['OpenchannelTransferReport'][_0xc731('0x115')](db['OpenchannelMessage'],{});db[_0xc731('0xeb')]['belongsTo'](db[_0xc731('0x5f')],{});db[_0xc731('0xeb')][_0xc731('0x115')](db[_0xc731('0x5c')],{'foreignKey':_0xc731('0x1df'),'as':_0xc731('0x1d1')});db[_0xc731('0xeb')][_0xc731('0x115')](db[_0xc731('0x11')],{'foreignKey':_0xc731('0x1d2'),'as':'FromAgent'});db[_0xc731('0xeb')]['belongsTo'](db[_0xc731('0x11')],{'foreignKey':_0xc731('0x1da'),'as':_0xc731('0x1d4')});db['OpenchannelTransferReport'][_0xc731('0x115')](db[_0xc731('0x12a')],{'foreignKey':_0xc731('0x1e0'),'as':_0xc731('0x1d6')});db['OpenchannelTransferReport'][_0xc731('0x115')](db[_0xc731('0x5c')],{'foreignKey':_0xc731('0x1e1'),'as':_0xc731('0x1d8')});db[_0xc731('0x1e2')][_0xc731('0x115')](db['SmsMessage'],{});db[_0xc731('0x1e2')][_0xc731('0x115')](db['SmsInteraction'],{});db[_0xc731('0x1e2')][_0xc731('0x115')](db[_0xc731('0x54')],{'foreignKey':_0xc731('0x1e3'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db[_0xc731('0x11')],{'foreignKey':_0xc731('0x1d2'),'as':_0xc731('0x1d3')});db[_0xc731('0x1e2')][_0xc731('0x115')](db[_0xc731('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xc731('0x1e2')][_0xc731('0x115')](db[_0xc731('0x5a')],{'foreignKey':_0xc731('0x1e4'),'as':_0xc731('0x1d6')});db[_0xc731('0x1e2')]['belongsTo'](db[_0xc731('0x54')],{'foreignKey':_0xc731('0x1e5'),'as':_0xc731('0x1d8')});db['CmList'][_0xc731('0x109')](db[_0xc731('0x80')],{'as':_0xc731('0x174'),'foreignKey':_0xc731('0x15f')});db[_0xc731('0xee')][_0xc731('0x109')](db[_0xc731('0x7a')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc731('0xee')][_0xc731('0x109')](db[_0xc731('0x70')],{'as':'Contacts','onDelete':_0xc731('0x106'),'foreignKey':'ListId'});db[_0xc731('0xee')]['hasMany'](db[_0xc731('0x74')],{'as':_0xc731('0x10c'),'foreignKey':_0xc731('0x15f')});db[_0xc731('0xee')]['hasMany'](db[_0xc731('0x76')],{'as':_0xc731('0x10d'),'foreignKey':'ListId'});db[_0xc731('0xee')]['hasMany'](db[_0xc731('0x78')],{'as':_0xc731('0x78'),'foreignKey':_0xc731('0x15f')});db[_0xc731('0xee')][_0xc731('0x118')](db[_0xc731('0x123')],{'as':_0xc731('0x1e6'),'through':_0xc731('0x14e')});db[_0xc731('0xee')][_0xc731('0x118')](db['User'],{'as':_0xc731('0x14f'),'through':_0xc731('0x11b')});db[_0xc731('0x12d')]['hasMany'](db[_0xc731('0x17')],{'as':'Extensions','onDelete':_0xc731('0x106')});db[_0xc731('0x12d')][_0xc731('0x118')](db['User'],{'as':_0xc731('0x14f'),'through':_0xc731('0x12f')});db['UserProfile'][_0xc731('0x109')](db[_0xc731('0x11')],{'as':'Users','foreignKey':'userProfileId'});db[_0xc731('0xf1')]['hasMany'](db['UserProfileSection'],{'as':_0xc731('0x1e7'),'foreignKey':_0xc731('0x116'),'onDelete':_0xc731('0x106')});db['UserProfileSection'][_0xc731('0x109')](db[_0xc731('0xf5')],{'as':_0xc731('0x1e8'),'foreignKey':_0xc731('0x1e9'),'onDelete':_0xc731('0x106')});db[_0xc731('0xf7')]['hasMany'](db[_0xc731('0x80')],{'as':_0xc731('0x174'),'foreignKey':_0xc731('0x1ea')});db[_0xc731('0xf7')][_0xc731('0x109')](db[_0xc731('0x7e')],{'as':_0xc731('0x16f'),'foreignKey':_0xc731('0x1ea')});db[_0xc731('0xf7')][_0xc731('0x109')](db['WhatsappMessage'],{'as':_0xc731('0x153'),'foreignKey':_0xc731('0x1ea')});db[_0xc731('0xf7')][_0xc731('0x109')](db[_0xc731('0xfb')],{'as':_0xc731('0x15d')});db[_0xc731('0xf7')][_0xc731('0x109')](db['WhatsappApplication'],{'as':_0xc731('0x13e')});db[_0xc731('0xf7')][_0xc731('0x115')](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db['WhatsappAccount']['belongsTo'](db[_0xc731('0x14a')],{'as':_0xc731('0x14b'),'foreignKey':_0xc731('0x14c')});db[_0xc731('0xf7')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':_0xc731('0x14f'),'through':'user_has_whatsapp_accounts'});db[_0xc731('0xf9')]['belongsTo'](db[_0xc731('0x11')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0xf9')][_0xc731('0x115')](db[_0xc731('0x12b')],{'onDelete':_0xc731('0x16b')});db[_0xc731('0xf9')]['belongsTo'](db[_0xc731('0xf7')],{'onDelete':'restrict'});db[_0xc731('0xf9')][_0xc731('0x115')](db[_0xc731('0x148')],{'onDelete':_0xc731('0x16b'),'foreignKey':_0xc731('0x149')});db[_0xc731('0xf9')][_0xc731('0x115')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['WhatsappInteraction'][_0xc731('0x109')](db['WhatsappMessage'],{'as':_0xc731('0x153'),'onDelete':'cascade','foreignKey':_0xc731('0x1eb')});db[_0xc731('0xfb')][_0xc731('0x115')](db['WhatsappAccount'],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1ea')});db[_0xc731('0xfb')][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0xfb')][_0xc731('0x115')](db[_0xc731('0x11')],{'as':_0xc731('0x164'),'foreignKey':_0xc731('0x108')});db['WhatsappInteraction'][_0xc731('0x118')](db[_0xc731('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0xc731('0x17a')});db['WhatsappInteraction'][_0xc731('0x118')](db[_0xc731('0x88')],{'through':_0xc731('0x1a5'),'as':_0xc731('0x166')});db[_0xc731('0xfb')][_0xc731('0x118')](db[_0xc731('0x11')],{'as':'Users','through':_0xc731('0x122'),'foreignKey':'WhatsappInteractionId'});db[_0xc731('0xfd')][_0xc731('0x115')](db[_0xc731('0x11')],{'as':_0xc731('0x11')});db['WhatsappMessage'][_0xc731('0x115')](db[_0xc731('0x70')],{'onDelete':_0xc731('0x106'),'as':_0xc731('0x158')});db[_0xc731('0xfd')][_0xc731('0x115')](db[_0xc731('0xfb')],{'onDelete':'cascade','as':_0xc731('0x16a'),'foreignKey':_0xc731('0x1eb')});db['WhatsappMessage'][_0xc731('0x115')](db[_0xc731('0xf7')],{'as':_0xc731('0x163'),'foreignKey':_0xc731('0x1ea')});db[_0xc731('0xff')][_0xc731('0x115')](db[_0xc731('0xf7')],{});db[_0xc731('0xff')]['belongsTo'](db[_0xc731('0xee')],{'as':_0xc731('0x15e'),'foreignKey':_0xc731('0x15f')});db['WhatsappQueueReport'][_0xc731('0x115')](db[_0xc731('0x70')],{'as':_0xc731('0x158'),'foreignKey':_0xc731('0x159')});db[_0xc731('0xff')][_0xc731('0x115')](db[_0xc731('0xfb')],{});db[_0xc731('0xff')][_0xc731('0x115')](db[_0xc731('0x12b')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc731('0xfd')],{});db['WhatsappQueueReport'][_0xc731('0x115')](db['User'],{});db[_0xc731('0x101')]['belongsTo'](db[_0xc731('0xfd')],{});db[_0xc731('0x101')][_0xc731('0x115')](db[_0xc731('0xfb')],{});db[_0xc731('0x101')][_0xc731('0x115')](db[_0xc731('0xf7')],{'foreignKey':_0xc731('0x1ec'),'as':_0xc731('0x1d1')});db['WhatsappTransferReport'][_0xc731('0x115')](db[_0xc731('0xf7')],{'foreignKey':_0xc731('0x1ed'),'as':_0xc731('0x1d8')});db[_0xc731('0x101')][_0xc731('0x115')](db[_0xc731('0x12b')],{'foreignKey':_0xc731('0x1ee'),'as':_0xc731('0x1d6')});db['WhatsappTransferReport']['belongsTo'](db[_0xc731('0x11')],{'foreignKey':_0xc731('0x1d2'),'as':'FromAgent'});db['WhatsappTransferReport'][_0xc731('0x115')](db['User'],{'foreignKey':_0xc731('0x1da'),'as':_0xc731('0x1d4')});db[_0xc731('0x12b')]['belongsToMany'](db[_0xc731('0x11')],{'as':_0xc731('0x14f'),'through':_0xc731('0x38'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db[_0xc731('0xdc')],{'through':_0xc731('0x1cc'),'as':'Teams'});module[_0xc731('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 91a2eb4..9b071fe 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x47a870,_0x502e79){var _0x4f0158=function(_0x1d91df){while(--_0x1d91df){_0x47a870['push'](_0x47a870['shift']());}};_0x4f0158(++_0x502e79);}(_0x757a,0xde));var _0xa757=function(_0x532745,_0xc44a5){_0x532745=_0x532745-0x0;var _0x3dfac4=_0x757a[_0x532745];return _0x3dfac4;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file +var _0x2032=['/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/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/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','/www','/demo','/snippet','join','snippet','1.0.16','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','street','phone','fax','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','path','express','express-winston','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','method','x-forwarded-for','remoteAddress','url','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','connection','statusCode','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper'];(function(_0x4e5f40,_0x3bf5d2){var _0x7d58be=function(_0xd91e4d){while(--_0xd91e4d){_0x4e5f40['push'](_0x4e5f40['shift']());}};_0x7d58be(++_0x3bf5d2);}(_0x2032,0xd9));var _0x2203=function(_0x2b4093,_0xa7e078){_0x2b4093=_0x2b4093-0x0;var _0x591497=_0x2032[_0x2b4093];return _0x591497;};'use strict';var _=require('lodash');var path=require(_0x2203('0x0'));var express=require(_0x2203('0x1'));var ewinston=require(_0x2203('0x2'));var util=require('util');var errors=require(_0x2203('0x3'));var config=require(_0x2203('0x4'));var logger=require('./config/logger')(_0x2203('0x5'));var authLogger=require(_0x2203('0x6'))(_0x2203('0x7'));exports[_0x2203('0x8')]=function(_0x3f7ba1){_0x3f7ba1[_0x2203('0x9')](ewinston[_0x2203('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2676aa,_0x18c4d6){var _0x2049ff=_0x2203('0xb');if(!_['isEmpty'](_0x2676aa['body'])){_0x2049ff+=_0x2203('0xc');var _0x549908=_0x2676aa[_0x2203('0xd')];maskSensitiveData(_0x549908);}return util[_0x2203('0xe')](_0x2049ff,_0x2676aa[_0x2203('0xf')],_0x2676aa['headers'][_0x2203('0x10')]?_0x2676aa['headers'][_0x2203('0x10')]:_0x2676aa['connection'][_0x2203('0x11')]||_0x2676aa['ip'],_0x2676aa[_0x2203('0x12')],_0x18c4d6['statusCode'],_0x18c4d6['responseTime'],_0x2676aa['user']?_0x2676aa['user']['id']:null,_0x2676aa['user']?_0x2676aa[_0x2203('0x13')]['name']:null,_0x2676aa['user']?_0x2676aa[_0x2203('0x13')][_0x2203('0x14')]:null,_0x549908?util[_0x2203('0x15')](_0x549908,![],null):'');}}));_0x3f7ba1[_0x2203('0x9')](ewinston[_0x2203('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3fe0a8,_0x2c36e6){var _0x2c085c=_0x2203('0x16');if(_0x3fe0a8[_0x2203('0xd')]&&_0x3fe0a8['body'][_0x2203('0x17')]&&_0x3fe0a8[_0x2203('0xd')]['agent_id']){_0x2c085c=_0x2203('0x18');}return util[_0x2203('0xe')](_0x2c085c,_0x3fe0a8['method'],_0x3fe0a8[_0x2203('0x19')]['x-forwarded-for']?_0x3fe0a8[_0x2203('0x19')][_0x2203('0x10')]:_0x3fe0a8[_0x2203('0x1a')][_0x2203('0x11')]||_0x3fe0a8['ip'],_0x3fe0a8[_0x2203('0x12')],_0x2c36e6[_0x2203('0x1b')],_0x2c36e6['responseTime'],_0x3fe0a8[_0x2203('0x13')]?_0x3fe0a8['user']['id']:null,_0x3fe0a8['user']?_0x3fe0a8[_0x2203('0x13')]['name']:null,_0x3fe0a8[_0x2203('0x13')]?_0x3fe0a8[_0x2203('0x13')]['role']:null,_0x3fe0a8[_0x2203('0xd')]&&_0x3fe0a8['body']['device']?_0x3fe0a8[_0x2203('0xd')][_0x2203('0x17')]:_0x2203('0x1c'),_0x3fe0a8[_0x2203('0xd')]&&_0x3fe0a8[_0x2203('0xd')][_0x2203('0x1d')]?_0x3fe0a8[_0x2203('0xd')][_0x2203('0x1d')]:'',_0x3fe0a8['body']&&_0x3fe0a8[_0x2203('0xd')][_0x2203('0x1e')]?_0x3fe0a8[_0x2203('0xd')]['agent_name']:'');},'ignoreRoute':function(_0xb2071b){var _0x1cec17=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1cec17['test'](_0xb2071b[_0x2203('0x12')]);}}));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x1f'),require(_0x2203('0x20')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x21'),require(_0x2203('0x22')));_0x3f7ba1['use'](_0x2203('0x23'),require(_0x2203('0x24')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x25'),require('./api/voiceExtension'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x26'),require(_0x2203('0x27')));_0x3f7ba1[_0x2203('0x9')]('/api/voice/queues',require(_0x2203('0x28')));_0x3f7ba1[_0x2203('0x9')]('/api/voice/recordings',require('./api/voiceRecording'));_0x3f7ba1[_0x2203('0x9')]('/api/screen/recordings',require('./api/screenRecording'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x29'),require(_0x2203('0x2a')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2b'),require('./api/voiceMailMessage'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2c'),require('./api/voiceCallReport'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2d'),require(_0x2203('0x2e')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x2f'),require(_0x2203('0x30')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x31'),require(_0x2203('0x32')));_0x3f7ba1['use'](_0x2203('0x33'),require(_0x2203('0x34')));_0x3f7ba1['use']('/api/trunks',require(_0x2203('0x35')));_0x3f7ba1['use'](_0x2203('0x36'),require(_0x2203('0x37')));_0x3f7ba1[_0x2203('0x9')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x3f7ba1[_0x2203('0x9')]('/api/mail/accounts',require(_0x2203('0x38')));_0x3f7ba1['use'](_0x2203('0x39'),require('./api/mailQueue'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x3a'),require(_0x2203('0x3b')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x3c'),require('./api/mailInteraction'));_0x3f7ba1['use']('/api/mail/messages',require(_0x2203('0x3d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x3e'),require(_0x2203('0x3f')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x40'),require(_0x2203('0x41')));_0x3f7ba1['use'](_0x2203('0x42'),require(_0x2203('0x43')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x44'),require('./api/dashboardItem'));_0x3f7ba1['use'](_0x2203('0x45'),require('./api/faxAccount'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x46'),require(_0x2203('0x47')));_0x3f7ba1['use']('/api/fax/interactions',require(_0x2203('0x48')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x49'),require(_0x2203('0x4a')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x4b'),require('./api/faxQueue'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x4c'),require(_0x2203('0x4d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x4e'),require(_0x2203('0x4f')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x50'),require(_0x2203('0x51')));_0x3f7ba1[_0x2203('0x9')]('/api/sms/interactions',require(_0x2203('0x52')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x53'),require(_0x2203('0x54')));_0x3f7ba1['use']('/api/sms/queues',require(_0x2203('0x55')));_0x3f7ba1['use'](_0x2203('0x56'),require(_0x2203('0x57')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x58'),require('./api/openchannelApplication'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x59'),require('./api/openchannelInteraction'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x5a'),require(_0x2203('0x5b')));_0x3f7ba1[_0x2203('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3f7ba1[_0x2203('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x5c'),require(_0x2203('0x5d')));_0x3f7ba1['use']('/api/chat/applications',require(_0x2203('0x5e')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x5f'),require(_0x2203('0x60')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x61'),require('./api/chatMessage'));_0x3f7ba1[_0x2203('0x9')]('/api/chat/offline_messages',require(_0x2203('0x62')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x63'),require(_0x2203('0x64')));_0x3f7ba1['use']('/api/chat/groups',require(_0x2203('0x65')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x66'),require(_0x2203('0x67')));_0x3f7ba1['use']('/api/cm/companies',require('./api/cmCompany'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x68'),require('./api/cmContact'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x69'),require('./api/cmHopper'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x6a'),require(_0x2203('0x6b')));_0x3f7ba1[_0x2203('0x9')]('/api/cm/hopper_final',require(_0x2203('0x6c')));_0x3f7ba1['use'](_0x2203('0x6d'),require(_0x2203('0x6e')));_0x3f7ba1['use'](_0x2203('0x6f'),require(_0x2203('0x70')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x71'),require(_0x2203('0x72')));_0x3f7ba1[_0x2203('0x9')]('/api/automations',require('./api/automation'));_0x3f7ba1[_0x2203('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x73'),require(_0x2203('0x74')));_0x3f7ba1['use'](_0x2203('0x75'),require('./api/condition'));_0x3f7ba1['use'](_0x2203('0x76'),require('./api/interval'));_0x3f7ba1['use']('/api/pauses',require(_0x2203('0x77')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x78'),require(_0x2203('0x79')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x7a'),require(_0x2203('0x7b')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x7c'),require(_0x2203('0x7d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x7e'),require('./api/sound'));_0x3f7ba1['use'](_0x2203('0x7f'),require(_0x2203('0x80')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x81'),require(_0x2203('0x82')));_0x3f7ba1[_0x2203('0x9')]('/api/triggers',require('./api/trigger'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x83'),require(_0x2203('0x84')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x85'),require(_0x2203('0x86')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x87'),require(_0x2203('0x88')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x89'),require('./api/analyticCustomReport'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x8a'),require(_0x2203('0x8b')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x8c'),require(_0x2203('0x8d')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x8e'),require(_0x2203('0x8f')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x90'),require(_0x2203('0x91')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x92'),require(_0x2203('0x93')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x94'),require(_0x2203('0x95')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x96'),require('./api/intSalesforceConfiguration'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x97'),require(_0x2203('0x98')));_0x3f7ba1['use'](_0x2203('0x99'),require(_0x2203('0x9a')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x9b'),require(_0x2203('0x9c')));_0x3f7ba1['use'](_0x2203('0x9d'),require(_0x2203('0x9e')));_0x3f7ba1[_0x2203('0x9')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x3f7ba1['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x9f'),require(_0x2203('0xa0')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa1'),require(_0x2203('0xa2')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa3'),require('./api/intZohoConfiguration'));_0x3f7ba1['use'](_0x2203('0xa4'),require(_0x2203('0xa5')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa6'),require(_0x2203('0xa7')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xa8'),require(_0x2203('0xa9')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xaa'),require(_0x2203('0xab')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xac'),require(_0x2203('0xad')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xae'),require(_0x2203('0xaf')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb0'),require('./api/intFreshdeskField'));_0x3f7ba1[_0x2203('0x9')]('/api/integrations/vtiger/accounts',require(_0x2203('0xb1')));_0x3f7ba1['use'](_0x2203('0xb2'),require(_0x2203('0xb3')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb4'),require(_0x2203('0xb5')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb6'),require(_0x2203('0xb7')));_0x3f7ba1['use']('/api/integrations/servicenow/configurations',require(_0x2203('0xb8')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xb9'),require('./api/intServicenowField'));_0x3f7ba1['use']('/api/integrations/dynamics365/accounts',require(_0x2203('0xba')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xbb'),require(_0x2203('0xbc')));_0x3f7ba1['use'](_0x2203('0xbd'),require('./api/intDynamics365Field'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xbe'),require(_0x2203('0xbf')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc0'),require('./api/intFreshsalesConfiguration'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc1'),require(_0x2203('0xc2')));_0x3f7ba1['use'](_0x2203('0xc3'),require(_0x2203('0xc4')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc5'),require(_0x2203('0xc6')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc7'),require(_0x2203('0xc8')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xc9'),require(_0x2203('0xca')));_0x3f7ba1['use'](_0x2203('0xcb'),require(_0x2203('0xcc')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xcd'),require(_0x2203('0xce')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xcf'),require(_0x2203('0xd0')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd1'),require(_0x2203('0xd2')));_0x3f7ba1[_0x2203('0x9')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd3'),require(_0x2203('0xd4')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd5'),require('./api/setting'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xd6'),require('./api/squareOdbc'));_0x3f7ba1['use']('/api/square/projects',require('./api/squareProject'));_0x3f7ba1['use'](_0x2203('0xd7'),require(_0x2203('0xd8')));_0x3f7ba1[_0x2203('0x9')]('/api/square/messages',require('./api/squareMessage'));_0x3f7ba1['use'](_0x2203('0xd9'),require(_0x2203('0xda')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xdb'),require(_0x2203('0xdc')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xdd'),require('./api/campaign'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xde'),require(_0x2203('0xdf')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xe0'),require(_0x2203('0xe1')));_0x3f7ba1[_0x2203('0x9')]('/api/plugins',require(_0x2203('0xe2')));_0x3f7ba1['use']('/api/mail/reports/transfer',require(_0x2203('0xe3')));_0x3f7ba1['use'](_0x2203('0xe4'),require(_0x2203('0xe5')));_0x3f7ba1['use'](_0x2203('0xe6'),require(_0x2203('0xe7')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xe8'),require(_0x2203('0xe9')));_0x3f7ba1[_0x2203('0x9')]('/api/sms/reports/transfer',require(_0x2203('0xea')));_0x3f7ba1[_0x2203('0x9')]('/api/cm/lists',require('./api/cmList'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xeb'),require(_0x2203('0xec')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xed'),require(_0x2203('0xee')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xef'),require(_0x2203('0xf0')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf1'),require(_0x2203('0xf2')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf3'),require(_0x2203('0xf4')));_0x3f7ba1[_0x2203('0x9')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf5'),require('./api/whatsappApplication'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf6'),require('./api/whatsappInteraction'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf7'),require('./api/whatsappMessage'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf8'),require('./api/whatsappQueueReport'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xf9'),require(_0x2203('0xfa')));_0x3f7ba1[_0x2203('0x9')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xfb'),require(_0x2203('0xfc')));_0x3f7ba1['use']('/api/auth/local',require(_0x2203('0xfd')));_0x3f7ba1[_0x2203('0x9')](_0x2203('0xfe'),require('./api/authGoogle'));_0x3f7ba1['use'](_0x2203('0xff'),require(_0x2203('0x100')));_0x3f7ba1['use'](_0x2203('0x101'),require(_0x2203('0x102')));_0x3f7ba1['use'](_0x2203('0x103'),require('./api/version'));_0x3f7ba1[_0x2203('0x9')]('/api/system',require('./api/system'));_0x3f7ba1['use'](_0x2203('0x104'),require(_0x2203('0x105')));_0x3f7ba1['use'](_0x2203('0x106'),require(_0x2203('0x107')));_0x3f7ba1[_0x2203('0x9')]('/apidoc',express[_0x2203('0x108')](path['join'](config[_0x2203('0x109')],_0x2203('0x10a'))));_0x3f7ba1['use'](_0x2203('0x10b'),express[_0x2203('0x108')](path['join'](config[_0x2203('0x109')],_0x2203('0x10b'))));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x10c'),express[_0x2203('0x108')](path['join'](config[_0x2203('0x109')],_0x2203('0x10c'))));_0x3f7ba1[_0x2203('0x9')](_0x2203('0x10d'),express[_0x2203('0x108')](path[_0x2203('0x10e')](config['root'],_0x2203('0x10f'),_0x2203('0x110'))));_0x3f7ba1['use'](_0x2203('0x111'),express['static'](path[_0x2203('0x10e')](config[_0x2203('0x109')],_0x2203('0x112'))));_0x3f7ba1['route'](_0x2203('0x113'))[_0x2203('0x114')](errors[0x194]);_0x3f7ba1[_0x2203('0x115')]('/*')[_0x2203('0x114')](function(_0x2c275f,_0x2cd816){_0x2cd816[_0x2203('0x116')](path['resolve'](_0x3f7ba1['get'](_0x2203('0x117'))+_0x2203('0x118')));});};var sensitiveFields=[_0x2203('0x119'),_0x2203('0x11a'),_0x2203('0x11b'),_0x2203('0x11c'),_0x2203('0x11d'),'lastName',_0x2203('0x11e'),_0x2203('0x11f'),'mobile',_0x2203('0x120'),'email',_0x2203('0x121'),_0x2203('0x122'),'securityToken',_0x2203('0x123'),_0x2203('0x124'),_0x2203('0x125'),_0x2203('0x126'),_0x2203('0x127'),_0x2203('0x128'),_0x2203('0x129'),_0x2203('0x12a'),_0x2203('0x12b'),_0x2203('0x12c'),_0x2203('0x12d'),_0x2203('0x12e'),'calleridnum',_0x2203('0x12f'),'vidaooApiKey',_0x2203('0x130'),_0x2203('0x131'),_0x2203('0x132'),_0x2203('0x133'),_0x2203('0x134'),_0x2203('0x13'),_0x2203('0x135'),_0x2203('0x136'),_0x2203('0x137'),_0x2203('0x138'),_0x2203('0x139'),'registry',_0x2203('0x13a')];function maskSensitiveData(_0x54e773){var _0x44e091=/(?!^)[\s\S](?!$)/g;for(var _0x3deb3b in _0x54e773){if(_[_0x2203('0x13b')](_0x54e773[_0x3deb3b])){for(var _0x4a38ca=0x0;_0x4a38ca<_0x54e773[_0x3deb3b][_0x2203('0x13c')];_0x4a38ca++){maskSensitiveData(_0x54e773[_0x3deb3b][_0x4a38ca]);}}else if(_[_0x2203('0x13d')](_0x54e773[_0x3deb3b])){maskSensitiveData(_0x54e773[_0x3deb3b]);}else if(_[_0x2203('0x13e')](_0x54e773[_0x3deb3b])){_0x54e773[_0x3deb3b]=_0x54e773[_0x3deb3b][_0x2203('0x13f')](/{{{/g,_0x2203('0x140'))['replace'](/}}}/g,_0x2203('0x141'))['replace'](/{{/g,'@{')[_0x2203('0x13f')](/}}/g,'}@');if(_[_0x2203('0x142')](sensitiveFields,_0x3deb3b)){_0x54e773[_0x3deb3b]=_0x54e773[_0x3deb3b]['replace'](_0x44e091,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b5b5369..f1988d5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5574=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','server','http','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0x3285a0,_0x335785){var _0x5ca1af=function(_0x46cc68){while(--_0x46cc68){_0x3285a0['push'](_0x3285a0['shift']());}};_0x5ca1af(++_0x335785);}(_0x5574,0x145));var _0x4557=function(_0x11ec83,_0x5046db){_0x11ec83=_0x11ec83-0x0;var _0x4a4254=_0x5574[_0x11ec83];return _0x4a4254;};'use strict';var jayson=require(_0x4557('0x0'));var BPromise=require(_0x4557('0x1'));var _=require(_0x4557('0x2'));var config=require(_0x4557('0x3'));exports['listen']=function(){return new BPromise(function(_0x3e9b6a,_0x3d1dc1){var _0x4af78b={};_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/user/user.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/voiceExtension/voiceExtension.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/voiceQueue/voiceQueue.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x5')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x6')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x7')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x8')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/memberReport/memberReport.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x9')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0xa')));_0x4af78b=_['merge'](_0x4af78b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0xb')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0xc')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0xd')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/mailInteraction/mailInteraction.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0xe')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0xf')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x10')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/faxAccount/faxAccount.rpc'));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x11')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x12')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/faxMessage/faxMessage.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x13')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x14')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x15')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/smsMessage/smsMessage.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/smsQueue/smsQueue.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x16')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x17')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4af78b=_['merge'](_0x4af78b,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4af78b=_['merge'](_0x4af78b,require('../api/chatInteraction/chatInteraction.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x18')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x19')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/cmContact/cmContact.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x1a')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x1b')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x1c')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x1d')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x1e')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x1f')));_0x4af78b=_['merge'](_0x4af78b,require('../api/pause/pause.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/sound/sound.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x20')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x21')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x22')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x23')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x24')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x25')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x26')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x27')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x28')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x29')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x2a')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x2b')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x2c')));_0x4af78b=_['merge'](_0x4af78b,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x2d')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x2e')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/squareRecording/squareRecording.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/squareMessage/squareMessage.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x2f')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x30')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x31')));_0x4af78b=_['merge'](_0x4af78b,require(_0x4557('0x32')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require(_0x4557('0x33')));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4af78b=_[_0x4557('0x4')](_0x4af78b,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4af78b=_['merge'](_0x4af78b,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5ce319=jayson[_0x4557('0x34')](_0x4af78b)[_0x4557('0x35')]();var _0x5265fb=config['rpc'][_0x4557('0x36')]||config['port']+0x1;var _0x39114a=config['rpc']['ip']||'localhost';_0x5ce319['on'](_0x4557('0x37'),function(_0xf99820){return _0x3d1dc1(_0xf99820);});_0x5ce319[_0x4557('0x38')](_0x5265fb,_0x39114a,function(){console[_0x4557('0x39')](_0x4557('0x3a'),_0x39114a,_0x5265fb);require(_0x4557('0x3b'))['default']();return _0x3e9b6a(_0x4557('0x3c')+_0x39114a+':'+_0x5265fb);});});}; \ No newline at end of file +var _0x995e=['../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x256876,_0x545ef6){var _0x781184=function(_0xedf0c4){while(--_0xedf0c4){_0x256876['push'](_0x256876['shift']());}};_0x781184(++_0x545ef6);}(_0x995e,0xc3));var _0xe995=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x995e[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe995('0x0'));var _=require(_0xe995('0x1'));var config=require(_0xe995('0x2'));exports[_0xe995('0x3')]=function(){return new BPromise(function(_0x12e61c,_0x173e26){var _0x1450ad={};_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x5')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x6')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x7')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x8')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x9')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0xa')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0xb')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0xc')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0xd')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0xe')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0xf')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/mailServerIn/mailServerIn.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x10')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x11')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x12')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x13')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x14')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x15')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x16')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x17')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x18')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x19')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x1a')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x1b')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x1c')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x1d')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x1e')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x1f')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x20')));_0x1450ad=_['merge'](_0x1450ad,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x21')));_0x1450ad=_['merge'](_0x1450ad,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x22')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x23')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x24')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/chatQueue/chatQueue.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x25')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x26')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x27')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x28')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x29')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x2a')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x2b')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x2c')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x2d')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x2e')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x2f')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x30')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x31')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x32')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x33')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x34')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x35')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x36')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x37')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x38')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x39')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x3a')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x3b')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/squareRecording/squareRecording.rpc'));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x3c')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x3d')));_0x1450ad=_['merge'](_0x1450ad,require('../api/attachment/attachment.rpc'));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x3e')));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x3f')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x40')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1450ad=_['merge'](_0x1450ad,require(_0xe995('0x41')));_0x1450ad=_[_0xe995('0x4')](_0x1450ad,require(_0xe995('0x42')));var _0x1ee584=jayson[_0xe995('0x43')](_0x1450ad)[_0xe995('0x44')]();var _0x1beda7=config[_0xe995('0x45')]['port']||config[_0xe995('0x46')]+0x1;var _0x1b9ae0=config[_0xe995('0x45')]['ip']||'localhost';_0x1ee584['on'](_0xe995('0x47'),function(_0x34ac26){return _0x173e26(_0x34ac26);});_0x1ee584['listen'](_0x1beda7,_0x1b9ae0,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1b9ae0,_0x1beda7);require(_0xe995('0x48'))[_0xe995('0x49')]();return _0x12e61c(_0xe995('0x4a')+_0x1b9ae0+':'+_0x1beda7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index a9f5b15..d11d6e2 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 _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x9a07f7,_0x560cfa){var _0x4ad80a=function(_0x5320ce){while(--_0x5320ce){_0x9a07f7['push'](_0x9a07f7['shift']());}};_0x4ad80a(++_0x560cfa);}(_0x70e0,0x17b));var _0x070e=function(_0x5354e9,_0x5ae0aa){_0x5354e9=_0x5354e9-0x0;var _0x333633=_0x70e0[_0x5354e9];return _0x333633;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file +var _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','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','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0xcb91[_0x5d07ff];return _0x5226ad;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9ec02d2..f5f4058 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 _0x4e3c=['format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','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.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x42b5d3,_0x349abc){var _0x6555f=function(_0xf0d0bd){while(--_0xf0d0bd){_0x42b5d3['push'](_0x42b5d3['shift']());}};_0x6555f(++_0x349abc);}(_0x4e3c,0x1b4));var _0xc4e3=function(_0x9e575,_0x5894d4){_0x9e575=_0x9e575-0x0;var _0x522277=_0x4e3c[_0x9e575];return _0x522277;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xc4e3('0x0'),'E_AGI_ARGUMENT_PORT':_0xc4e3('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xc4e3('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xc4e3('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xc4e3('0x4'),'E_AGI_SOCKET_ERROR':_0xc4e3('0x5'),'E_AGI_SOCKET_CLOSE':_0xc4e3('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xc4e3('0x7'),'E_AGI_COMMAND_EMPTY':_0xc4e3('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc4e3('0x9'),'E_AGI_IVR_ENTRY':_0xc4e3('0xa')};function AGIError(_0x50f9b9){var _0x50f9b9=_0x50f9b9||null,_0x56c2ec=_0x56c2ec||[],_0x376a84=0x1,_0x497fbc='';if(!error[_0x50f9b9]){_0x50f9b9=_0xc4e3('0xb');}_0x56c2ec['push'](error[_0x50f9b9]);while(arguments[_0x376a84]){_0x56c2ec['push'](arguments[_0x376a84]);_0x376a84++;}_0x497fbc=util[_0xc4e3('0xc')]['apply'](util,_0x56c2ec);this[_0xc4e3('0xd')]=_0x497fbc;this[_0xc4e3('0xe')]=_0x50f9b9;}module[_0xc4e3('0xf')]=AGIError; \ No newline at end of file +var _0xc0aa=['push','apply','message','name','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\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x2bcbd8,_0x4a5fa2){var _0x4db42a=function(_0x2233b0){while(--_0x2233b0){_0x2bcbd8['push'](_0x2bcbd8['shift']());}};_0x4db42a(++_0x4a5fa2);}(_0xc0aa,0x64));var _0xac0a=function(_0x628272,_0x130060){_0x628272=_0x628272-0x0;var _0x58bbff=_0xc0aa[_0x628272];return _0x58bbff;};'use strict';var util=require(_0xac0a('0x0'));var error={'E_AGI_UNDEFINED':_0xac0a('0x1'),'E_AGI_ARGUMENT_PORT':_0xac0a('0x2'),'E_AGI_SERVER_ERROR':_0xac0a('0x3'),'E_AGI_SERVER_CLOSE':_0xac0a('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xac0a('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xac0a('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xac0a('0x7'),'E_AGI_COMMAND_EMPTY':_0xac0a('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xac0a('0x9'),'E_AGI_IVR_ENTRY':_0xac0a('0xa')};function AGIError(_0x54b72f){var _0x54b72f=_0x54b72f||null,_0x348c32=_0x348c32||[],_0x469929=0x1,_0x2fa0cc='';if(!error[_0x54b72f]){_0x54b72f=_0xac0a('0xb');}_0x348c32[_0xac0a('0xc')](error[_0x54b72f]);while(arguments[_0x469929]){_0x348c32[_0xac0a('0xc')](arguments[_0x469929]);_0x469929++;}_0x2fa0cc=util['format'][_0xac0a('0xd')](util,_0x348c32);this[_0xac0a('0xe')]=_0x2fa0cc;this[_0xac0a('0xf')]=_0x54b72f;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index aeab0f2..cc2afb4 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 _0x2b65=['../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x2b65,0x131));var _0x52b6=function(_0x56899b,_0x80fce){_0x56899b=_0x56899b-0x0;var _0x47d591=_0x2b65[_0x56899b];return _0x47d591;};'use strict';var _=require(_0x52b6('0x0'));var logger=require(_0x52b6('0x1'))(_0x52b6('0x2'));var verticesWithRetry=[_0x52b6('0x3'),_0x52b6('0x4'),_0x52b6('0x5')];var Graph=function(){this[_0x52b6('0x6')]={};this[_0x52b6('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0x52b6('0x8')][_0x52b6('0x9')]=function(_0x4707f3){this[_0x52b6('0x6')][_0x4707f3['id']]=_0x4707f3;this[_0x52b6('0x7')][_0x4707f3['id']]=[];};Graph[_0x52b6('0x8')][_0x52b6('0xa')]=function(_0x1af78f,_0x432726,_0x27c5b9){this['edges'][_0x1af78f][_0x52b6('0xb')]({'target':_0x432726,'condition':_0x27c5b9});this[_0x52b6('0xc')]+=0x1;};Graph[_0x52b6('0x8')]['size']=function(){return _[_0x52b6('0xd')](this[_0x52b6('0x6')]);};Graph[_0x52b6('0x8')][_0x52b6('0xe')]=function(){return this['numberOfEdges'];};Graph[_0x52b6('0x8')][_0x52b6('0xf')]=function(_0x1442e5){return this['vertices'][_0x1442e5];};Graph[_0x52b6('0x8')][_0x52b6('0x10')]=function(_0x5292e4,_0x10afe3){if(!this['vertices'][_0x5292e4]){return logger['info'](_0x52b6('0x11'));}var _0x911df9=_0x10afe3(this[_0x52b6('0x6')][_0x5292e4]);if(!_0x911df9){return logger[_0x52b6('0x12')](_0x52b6('0x13'));}if(this[_0x52b6('0x7')][_0x5292e4][_0x52b6('0x14')]===0x0){return logger[_0x52b6('0x12')](_0x52b6('0x15'));}for(var _0x308e69=0x0,_0x43ed6e=[],_0x307594=![];_0x308e69\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','agi','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','stack','port','format','name','message','error','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','omit','length','source','target','value'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x3e74,0x175));var _0x43e7=function(_0x8fbdbc,_0x2a030b){_0x8fbdbc=_0x8fbdbc-0x0;var _0x44b847=_0x3e74[_0x8fbdbc];return _0x44b847;};'use strict';var parser=require(_0x43e7('0x0'));var _=require('lodash');var syncho=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x43e7('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x43e7('0x5'));var mailRpc=require(_0x43e7('0x6'));var Graph=require(_0x43e7('0x7'));var Vertices=require(_0x43e7('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x43e7('0x4')]=_['defaults'](config[_0x43e7('0x4')],{'ip':_0x43e7('0x9'),'port':0x11dd});function connectionHandler(_0x2ede2d){process[_0x43e7('0xa')](function(){syncho(function(){try{setChannelVariables(_0x2ede2d);agiHandler(_0x2ede2d);}catch(_0x21f491){logger['error'](_0x21f491[_0x43e7('0xb')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x43e7('0x4')][_0x43e7('0xc')]);logger['info'](util[_0x43e7('0xd')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x43e7('0x4')]['ip'],config[_0x43e7('0x4')]['port']));}function errorHandler(_0x3eb206){if(_0x3eb206&&_0x3eb206[_0x43e7('0xe')]&&_0x3eb206[_0x43e7('0xf')]){logger[_0x43e7('0x10')](util['format']('[%s]\x20%s',_0x3eb206[_0x43e7('0xe')],_0x3eb206[_0x43e7('0xf')]));}else{logger[_0x43e7('0x10')](util['format']('[ERROR]\x20%s',_0x3eb206[_0x43e7('0xb')]));}}function closeHandler(){logger[_0x43e7('0x11')](util[_0x43e7('0xd')](_0x43e7('0x12'),this['arg_1'],this['calleridname'],this[_0x43e7('0x13')],this[_0x43e7('0x14')],this[_0x43e7('0x15')]));try{createSquareReport(this);}catch(_0x5d346f){logger['error'](_0x5d346f[_0x43e7('0xb')]);}}function timeoutHandler(){logger[_0x43e7('0x11')](util[_0x43e7('0xd')](_0x43e7('0x16'),this[_0x43e7('0x17')],this[_0x43e7('0x18')],this[_0x43e7('0x13')],this[_0x43e7('0x14')],this[_0x43e7('0x15')]));}function hangupHandler(){logger[_0x43e7('0x11')](util[_0x43e7('0xd')](_0x43e7('0x19'),this['arg_1'],this[_0x43e7('0x18')],this[_0x43e7('0x13')],this['dnid'],this[_0x43e7('0x15')]));this[_0x43e7('0x1a')]=!![];}function getRoot(_0x3945bb){return parser[_0x43e7('0x1b')](_0x3945bb,{'object':!![]})[_0x43e7('0x1c')][_0x43e7('0x1d')];}function addVertex(_0x54a9e7,_0x454359,_0x4eea52){_0x454359['agicommand']=_0x4eea52;if(_0x454359[_0x43e7('0x1e')](_0x43e7('0x1f'))){_0x454359['maxRetry']=parseInt(_0x454359[_0x43e7('0x1f')],0xa);}_0x54a9e7['addVertex'](_[_0x43e7('0x20')](_0x454359,'mxCell'));}function initGraph(_0x1af208,_0x1b5f50){var _0x20888b=new Graph();for(var _0x405f85 in _0x1af208){if(_0x1af208['hasOwnProperty'](_0x405f85)){if(_['isArray'](_0x1af208[_0x405f85])){for(var _0x805b54=0x0;_0x805b54<_0x1af208[_0x405f85]['length'];_0x805b54+=0x1){addVertex(_0x20888b,_0x1af208[_0x405f85][_0x805b54],_0x405f85);}}else{addVertex(_0x20888b,_0x1af208[_0x405f85],_0x405f85);}}}for(var _0x2dd5f=0x0;_0x2dd5f<_0x1b5f50[_0x43e7('0x21')];_0x2dd5f+=0x1){if(_0x1b5f50[_0x2dd5f][_0x43e7('0x22')]&&_0x1b5f50[_0x2dd5f][_0x43e7('0x23')]){_0x20888b['addEdge'](_0x1b5f50[_0x2dd5f][_0x43e7('0x22')],_0x1b5f50[_0x2dd5f][_0x43e7('0x23')],_0x1b5f50[_0x2dd5f][_0x43e7('0x24')]);}}return _0x20888b;}function getSquareProject(_0x50f9f5,_0x442c3b){rpc[_0x43e7('0x25')](_0x50f9f5)[_0x43e7('0x26')](function(_0x31b2a6){_0x442c3b(null,_0x31b2a6);})[_0x43e7('0x27')](function(_0x35dbcd){_0x442c3b(null,_0x35dbcd);});}function createSquareReport(_0x17df44,_0x19725a){rpc[_0x43e7('0x28')](_0x17df44)[_0x43e7('0x26')](function(_0x4bdb17){if(_0x19725a){_0x19725a(null,_0x4bdb17);}})[_0x43e7('0x27')](function(_0x44f6b0){if(_0x19725a){_0x19725a(null,_0x44f6b0);}});}function setChannelVariables(_0x3b8f78){for(var _0x183c81 in _0x3b8f78){if(_0x3b8f78[_0x43e7('0x1e')](_0x183c81)){if(_0x183c81['indexOf'](_0x43e7('0x29'))===0x0){_0x3b8f78[_0x183c81[_0x43e7('0x2a')](0x4)]=_0x3b8f78[_0x183c81];delete _0x3b8f78[_0x183c81];}}}}function getLogFromObject(_0x30d47e){return util[_0x43e7('0x2b')](_0x30d47e,{'showHidden':![],'depth':null});}function agiHandler(_0x4c61b9){var _0x5a7342,_0x5e203f,_0xf8320,_0xbe6e28,_0x117c07;logger[_0x43e7('0x2c')](_0x43e7('0x2d'),JSON[_0x43e7('0x2e')](_0x4c61b9,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4c61b9['arg_1'],_0x4c61b9['calleridname'],_0x4c61b9['callerid'],_0x4c61b9['dnid'],_0x4c61b9[_0x43e7('0x15')]));_0x4c61b9['on']('error',errorHandler);_0x4c61b9['on'](_0x43e7('0x2f'),closeHandler);_0x4c61b9['on'](_0x43e7('0x30'),timeoutHandler);_0x4c61b9[_0x43e7('0x1a')]=![];_0x4c61b9['on'](_0x43e7('0x31'),hangupHandler);var _0x40f72f=getSquareProject[_0x43e7('0x32')](null,_0x4c61b9[_0x43e7('0x17')]);if(_0x40f72f){if(_0x40f72f['production']){_0x5a7342=getRoot(_0x40f72f['production']);if(_0x5a7342&&_0x5a7342['start']){logger[_0x43e7('0x2c')](_0x43e7('0x1d'),JSON[_0x43e7('0x2e')](_0x5a7342,null,0x2));_0x4c61b9[_0x43e7('0x33')]=moment()[_0x43e7('0xd')](_0x43e7('0x34'));_0x5e203f=initGraph(_[_0x43e7('0x20')](_0x5a7342,_0x43e7('0x35')),_0x5a7342['mxCell']);_0xf8320=new Vertices(_0x4c61b9,rpc,mailRpc);logger[_0x43e7('0x11')](util[_0x43e7('0xd')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4c61b9[_0x43e7('0x17')],_0x4c61b9['calleridname'],_0x4c61b9[_0x43e7('0x13')],_0x4c61b9[_0x43e7('0x14')],_0x4c61b9[_0x43e7('0x15')]));_0x5e203f[_0x43e7('0x36')](_0x5a7342[_0x43e7('0x37')]['id'],function(_0x234d8f){try{_0x234d8f=_0xf8320['clear'](_0x234d8f);logger['debug'](_0x43e7('0x38'),JSON[_0x43e7('0x2e')](_0x234d8f,null,0x2));if(_0x234d8f[_0x43e7('0x39')]===_0x43e7('0x3a')){logger[_0x43e7('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4c61b9[_0x43e7('0x3b')]=_0x234d8f[_0x43e7('0x3b')]||_0x4c61b9['context'];_0x4c61b9[_0x43e7('0x3c')]=_0x234d8f['extension'];_0x4c61b9[_0x43e7('0x3d')]=_0x234d8f['priority']?_0x234d8f[_0x43e7('0x3d')]-0x1:0x1;return null;}else if(_0x234d8f&&_0xf8320[_0x234d8f[_0x43e7('0x39')]]){_0x117c07=_0xf8320[_0x234d8f[_0x43e7('0x39')]](_0x234d8f);logger[_0x43e7('0x11')]('response',JSON['stringify'](_0x117c07,null,0x2));if(_0x117c07&&_0x117c07[_0x43e7('0x3e')]===AGI_CODE_SUCCESS&&_0x117c07[_0x43e7('0x3f')]!==AGI_RESULT_ERROR&&!_0x4c61b9[_0x43e7('0x1a')]){logger[_0x43e7('0x2c')]('response',getLogFromObject(_0x117c07));return _['isUndefined'](_0x117c07['result'])?null:_0x117c07[_0x43e7('0x3f')]['toString']();}else{logger[_0x43e7('0x10')]('response',getLogFromObject(_0x117c07));return null;}}else{logger['error'](_0x43e7('0x40'));return null;}}catch(_0x5ee1c5){logger[_0x43e7('0x10')](_0x5ee1c5[_0x43e7('0xb')]);return null;}});if(_0x5a7342[_0x43e7('0x41')]){logger[_0x43e7('0x11')](util['format'](_0x43e7('0x42'),_0x4c61b9[_0x43e7('0x17')],_0x4c61b9[_0x43e7('0x18')],_0x4c61b9[_0x43e7('0x13')],_0x4c61b9[_0x43e7('0x14')],_0x4c61b9[_0x43e7('0x15')]));_0x5e203f['traverseBFS'](_0x5a7342['finally']['id'],function(_0x3bc9de){try{_0x3bc9de=_0xf8320[_0x43e7('0x43')](_0x3bc9de);logger[_0x43e7('0x2c')]('vertex',JSON['stringify'](_0x3bc9de,null,0x2));if(_0x3bc9de&&_0xf8320[_0x3bc9de['agicommand']]){_0x117c07=_0xf8320[_0x3bc9de[_0x43e7('0x39')]](_0x3bc9de);if(_0x117c07){logger[_0x43e7('0x2c')]('response',getLogFromObject(_0x117c07));return _[_0x43e7('0x44')](_0x117c07[_0x43e7('0x3f')])?null:_0x117c07[_0x43e7('0x3f')]['toString']();}else{logger['error']('response',getLogFromObject(_0x117c07));return null;}}else{logger['error'](_0x43e7('0x40'));return null;}}catch(_0xe955fc){logger['error'](_0xe955fc[_0x43e7('0xb')]);return null;}});}logger[_0x43e7('0x11')](util[_0x43e7('0xd')](_0x43e7('0x45'),_0x4c61b9['arg_1'],_0x4c61b9[_0x43e7('0x18')],_0x4c61b9['callerid'],_0x4c61b9['dnid'],_0x4c61b9[_0x43e7('0x15')]));logger[_0x43e7('0x11')](util[_0x43e7('0xd')](_0x43e7('0x46'),_0x4c61b9[_0x43e7('0x3b')],_0x4c61b9[_0x43e7('0x3c')],parseInt(_0x4c61b9[_0x43e7('0x3d')],0xa)+0x1));_0x4c61b9[_0x43e7('0x47')](_0x4c61b9[_0x43e7('0x3b')],_0x4c61b9[_0x43e7('0x3c')],parseInt(_0x4c61b9['priority'],0xa)+0x1);_0x4c61b9[_0x43e7('0x2f')]();}}else{logger[_0x43e7('0x10')](util['format'](_0x43e7('0x48'),_0x4c61b9['arg_1']));_0x4c61b9[_0x43e7('0x47')](_0x4c61b9[_0x43e7('0x3b')],_0x4c61b9[_0x43e7('0x3c')],parseInt(_0x4c61b9[_0x43e7('0x3d')],0xa)+0x1);_0x4c61b9[_0x43e7('0x2f')]();}}else{logger['error'](util['format'](_0x43e7('0x49'),_0x4c61b9[_0x43e7('0x17')]));_0x4c61b9[_0x43e7('0x47')](_0x4c61b9[_0x43e7('0x3b')],_0x4c61b9[_0x43e7('0x3c')],parseInt(_0x4c61b9[_0x43e7('0x3d')],0xa)+0x1);_0x4c61b9[_0x43e7('0x2f')]();}}function main(){var _0x44f8a0;return utilLicense[_0x43e7('0x4a')]()[_0x43e7('0x26')](function(_0x312306){if(_0x312306){if(_0x312306['voice']){if(_0x312306[_0x43e7('0x4b')]&&_0x312306[_0x43e7('0x4b')]>0x0){logger['info'](util[_0x43e7('0xd')](_0x43e7('0x4c'),_0x312306[_0x43e7('0x4b')]));_0x44f8a0=_0x312306['callysquare'];}else{logger['info'](_0x43e7('0x4d'));}}else{logger[_0x43e7('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x44f8a0=-0x1;}}})[_0x43e7('0x27')](function(_0x54506d){logger['error'](_0x43e7('0x4e'),_0x54506d[_0x43e7('0xb')]);})[_0x43e7('0x41')](function(){var _0x40155c=require(_0x43e7('0x4f'))(config['agi'][_0x43e7('0xc')],config[_0x43e7('0x4')]['ip'],_0x44f8a0);_0x40155c['on']('error',errorHandler);_0x40155c['on'](_0x43e7('0x50'),listeningHandler);_0x40155c['on'](_0x43e7('0x51'),connectionHandler);_0x40155c['on'](_0x43e7('0x2f'),closeHandler);});}main(); \ No newline at end of file +var _0xaba6=['omit','mxCell','isArray','length','source','addEdge','target','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','inspect','variables','close','timeout','hangup','sync','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','context','extension','priority','code','result','debug','response','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','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','../../config/logger','agi','./rpc','./mailRpc','defaults','127.0.0.1','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex'];(function(_0xa57ab1,_0x1078b6){var _0x2ffde9=function(_0x10dd0f){while(--_0x10dd0f){_0xa57ab1['push'](_0xa57ab1['shift']());}};_0x2ffde9(++_0x1078b6);}(_0xaba6,0xe2));var _0x6aba=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0xaba6[_0xfbdff6];return _0x4cb9be;};'use strict';var parser=require(_0x6aba('0x0'));var _=require(_0x6aba('0x1'));var syncho=require('syncho');var util=require('util');var moment=require('moment');var config=require('../../config/environment');var logger=require(_0x6aba('0x2'))(_0x6aba('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x6aba('0x4'));var mailRpc=require(_0x6aba('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x6aba('0x6')](config['agi'],{'ip':_0x6aba('0x7'),'port':0x11dd});function connectionHandler(_0x1a4fbc){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1a4fbc);agiHandler(_0x1a4fbc);}catch(_0x460fe2){logger[_0x6aba('0x8')](_0x460fe2['stack']);}});});}function listeningHandler(){console[_0x6aba('0x9')](_0x6aba('0xa'),config[_0x6aba('0x3')][_0x6aba('0xb')]);logger[_0x6aba('0xc')](util[_0x6aba('0xd')](_0x6aba('0xe'),config['agi']['ip'],config[_0x6aba('0x3')][_0x6aba('0xb')]));}function errorHandler(_0x43867b){if(_0x43867b&&_0x43867b[_0x6aba('0xf')]&&_0x43867b['message']){logger[_0x6aba('0x8')](util[_0x6aba('0xd')]('[%s]\x20%s',_0x43867b[_0x6aba('0xf')],_0x43867b[_0x6aba('0x10')]));}else{logger[_0x6aba('0x8')](util['format'](_0x6aba('0x11'),_0x43867b[_0x6aba('0x12')]));}}function closeHandler(){logger[_0x6aba('0xc')](util['format'](_0x6aba('0x13'),this[_0x6aba('0x14')],this[_0x6aba('0x15')],this[_0x6aba('0x16')],this[_0x6aba('0x17')],this[_0x6aba('0x18')]));try{createSquareReport(this);}catch(_0x3009a9){logger['error'](_0x3009a9[_0x6aba('0x12')]);}}function timeoutHandler(){logger[_0x6aba('0xc')](util[_0x6aba('0xd')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6aba('0x14')],this['calleridname'],this['callerid'],this[_0x6aba('0x17')],this['uniqueid']));}function hangupHandler(){logger[_0x6aba('0xc')](util[_0x6aba('0xd')](_0x6aba('0x19'),this[_0x6aba('0x14')],this[_0x6aba('0x15')],this[_0x6aba('0x16')],this[_0x6aba('0x17')],this['uniqueid']));this[_0x6aba('0x1a')]=!![];}function getRoot(_0x41464f){return parser[_0x6aba('0x1b')](_0x41464f,{'object':!![]})[_0x6aba('0x1c')][_0x6aba('0x1d')];}function addVertex(_0x43eef9,_0x44f723,_0x67ba6e){_0x44f723[_0x6aba('0x1e')]=_0x67ba6e;if(_0x44f723[_0x6aba('0x1f')](_0x6aba('0x20'))){_0x44f723[_0x6aba('0x21')]=parseInt(_0x44f723[_0x6aba('0x20')],0xa);}_0x43eef9[_0x6aba('0x22')](_[_0x6aba('0x23')](_0x44f723,_0x6aba('0x24')));}function initGraph(_0x74ac4a,_0x2f7cdd){var _0x2cbbf7=new Graph();for(var _0x5dc72b in _0x74ac4a){if(_0x74ac4a['hasOwnProperty'](_0x5dc72b)){if(_[_0x6aba('0x25')](_0x74ac4a[_0x5dc72b])){for(var _0x5b0845=0x0;_0x5b0845<_0x74ac4a[_0x5dc72b][_0x6aba('0x26')];_0x5b0845+=0x1){addVertex(_0x2cbbf7,_0x74ac4a[_0x5dc72b][_0x5b0845],_0x5dc72b);}}else{addVertex(_0x2cbbf7,_0x74ac4a[_0x5dc72b],_0x5dc72b);}}}for(var _0x108ff1=0x0;_0x108ff1<_0x2f7cdd[_0x6aba('0x26')];_0x108ff1+=0x1){if(_0x2f7cdd[_0x108ff1][_0x6aba('0x27')]&&_0x2f7cdd[_0x108ff1]['target']){_0x2cbbf7[_0x6aba('0x28')](_0x2f7cdd[_0x108ff1][_0x6aba('0x27')],_0x2f7cdd[_0x108ff1][_0x6aba('0x29')],_0x2f7cdd[_0x108ff1][_0x6aba('0x2a')]);}}return _0x2cbbf7;}function getSquareProject(_0x20b06d,_0x576799){rpc[_0x6aba('0x2b')](_0x20b06d)['then'](function(_0x6e5f02){_0x576799(null,_0x6e5f02);})[_0x6aba('0x2c')](function(_0x54e780){_0x576799(null,_0x54e780);});}function createSquareReport(_0x4d601a,_0x202a81){rpc[_0x6aba('0x2d')](_0x4d601a)[_0x6aba('0x2e')](function(_0x1ca375){if(_0x202a81){_0x202a81(null,_0x1ca375);}})[_0x6aba('0x2c')](function(_0x14d25e){if(_0x202a81){_0x202a81(null,_0x14d25e);}});}function setChannelVariables(_0x39c449){for(var _0x5cdf62 in _0x39c449){if(_0x39c449[_0x6aba('0x1f')](_0x5cdf62)){if(_0x5cdf62[_0x6aba('0x2f')](_0x6aba('0x30'))===0x0){_0x39c449[_0x5cdf62['substring'](0x4)]=_0x39c449[_0x5cdf62];delete _0x39c449[_0x5cdf62];}}}}function getLogFromObject(_0x1bfb80){return util[_0x6aba('0x31')](_0x1bfb80,{'showHidden':![],'depth':null});}function agiHandler(_0x31458f){var _0x53336b,_0x1b7881,_0x2462ed,_0x5a2594,_0x14a119;logger['debug'](_0x6aba('0x32'),JSON['stringify'](_0x31458f,null,0x2));logger[_0x6aba('0xc')](util[_0x6aba('0xd')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x31458f['arg_1'],_0x31458f[_0x6aba('0x15')],_0x31458f['callerid'],_0x31458f[_0x6aba('0x17')],_0x31458f[_0x6aba('0x18')]));_0x31458f['on']('error',errorHandler);_0x31458f['on'](_0x6aba('0x33'),closeHandler);_0x31458f['on'](_0x6aba('0x34'),timeoutHandler);_0x31458f[_0x6aba('0x1a')]=![];_0x31458f['on'](_0x6aba('0x35'),hangupHandler);var _0x8ca947=getSquareProject[_0x6aba('0x36')](null,_0x31458f[_0x6aba('0x14')]);if(_0x8ca947){if(_0x8ca947['production']){_0x53336b=getRoot(_0x8ca947['production']);if(_0x53336b&&_0x53336b[_0x6aba('0x37')]){logger['debug'](_0x6aba('0x1d'),JSON[_0x6aba('0x38')](_0x53336b,null,0x2));_0x31458f[_0x6aba('0x39')]=moment()['format'](_0x6aba('0x3a'));_0x1b7881=initGraph(_[_0x6aba('0x23')](_0x53336b,_0x6aba('0x24')),_0x53336b[_0x6aba('0x24')]);_0x2462ed=new Vertices(_0x31458f,rpc,mailRpc);logger[_0x6aba('0xc')](util[_0x6aba('0xd')](_0x6aba('0x3b'),_0x31458f[_0x6aba('0x14')],_0x31458f[_0x6aba('0x15')],_0x31458f['callerid'],_0x31458f[_0x6aba('0x17')],_0x31458f[_0x6aba('0x18')]));_0x1b7881[_0x6aba('0x3c')](_0x53336b[_0x6aba('0x37')]['id'],function(_0x4c485b){try{_0x4c485b=_0x2462ed[_0x6aba('0x3d')](_0x4c485b);logger['debug'](_0x6aba('0x3e'),JSON['stringify'](_0x4c485b,null,0x2));if(_0x4c485b['agicommand']==='gotoc'){logger[_0x6aba('0xc')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x31458f[_0x6aba('0x3f')]=_0x4c485b[_0x6aba('0x3f')]||_0x31458f[_0x6aba('0x3f')];_0x31458f[_0x6aba('0x40')]=_0x4c485b[_0x6aba('0x40')];_0x31458f[_0x6aba('0x41')]=_0x4c485b[_0x6aba('0x41')]?_0x4c485b['priority']-0x1:0x1;return null;}else if(_0x4c485b&&_0x2462ed[_0x4c485b[_0x6aba('0x1e')]]){_0x14a119=_0x2462ed[_0x4c485b[_0x6aba('0x1e')]](_0x4c485b);logger[_0x6aba('0xc')]('response',JSON['stringify'](_0x14a119,null,0x2));if(_0x14a119&&_0x14a119[_0x6aba('0x42')]===AGI_CODE_SUCCESS&&_0x14a119[_0x6aba('0x43')]!==AGI_RESULT_ERROR&&!_0x31458f[_0x6aba('0x1a')]){logger[_0x6aba('0x44')](_0x6aba('0x45'),getLogFromObject(_0x14a119));return _['isUndefined'](_0x14a119[_0x6aba('0x43')])?null:_0x14a119[_0x6aba('0x43')][_0x6aba('0x46')]();}else{logger[_0x6aba('0x8')](_0x6aba('0x45'),getLogFromObject(_0x14a119));return null;}}else{logger[_0x6aba('0x8')](_0x6aba('0x47'));return null;}}catch(_0x56eca0){logger[_0x6aba('0x8')](_0x56eca0[_0x6aba('0x12')]);return null;}});if(_0x53336b[_0x6aba('0x48')]){logger[_0x6aba('0xc')](util[_0x6aba('0xd')](_0x6aba('0x49'),_0x31458f['arg_1'],_0x31458f[_0x6aba('0x15')],_0x31458f['callerid'],_0x31458f['dnid'],_0x31458f[_0x6aba('0x18')]));_0x1b7881[_0x6aba('0x3c')](_0x53336b[_0x6aba('0x48')]['id'],function(_0x474c48){try{_0x474c48=_0x2462ed[_0x6aba('0x3d')](_0x474c48);logger[_0x6aba('0x44')](_0x6aba('0x3e'),JSON[_0x6aba('0x38')](_0x474c48,null,0x2));if(_0x474c48&&_0x2462ed[_0x474c48[_0x6aba('0x1e')]]){_0x14a119=_0x2462ed[_0x474c48[_0x6aba('0x1e')]](_0x474c48);if(_0x14a119){logger['debug'](_0x6aba('0x45'),getLogFromObject(_0x14a119));return _[_0x6aba('0x4a')](_0x14a119[_0x6aba('0x43')])?null:_0x14a119[_0x6aba('0x43')][_0x6aba('0x46')]();}else{logger[_0x6aba('0x8')](_0x6aba('0x45'),getLogFromObject(_0x14a119));return null;}}else{logger[_0x6aba('0x8')](_0x6aba('0x47'));return null;}}catch(_0x2b0963){logger[_0x6aba('0x8')](_0x2b0963[_0x6aba('0x12')]);return null;}});}logger[_0x6aba('0xc')](util['format'](_0x6aba('0x4b'),_0x31458f[_0x6aba('0x14')],_0x31458f[_0x6aba('0x15')],_0x31458f['callerid'],_0x31458f[_0x6aba('0x17')],_0x31458f['uniqueid']));logger['info'](util[_0x6aba('0xd')](_0x6aba('0x4c'),_0x31458f[_0x6aba('0x3f')],_0x31458f['extension'],parseInt(_0x31458f[_0x6aba('0x41')],0xa)+0x1));_0x31458f[_0x6aba('0x4d')](_0x31458f[_0x6aba('0x3f')],_0x31458f[_0x6aba('0x40')],parseInt(_0x31458f[_0x6aba('0x41')],0xa)+0x1);_0x31458f[_0x6aba('0x33')]();}}else{logger['error'](util[_0x6aba('0xd')](_0x6aba('0x4e'),_0x31458f['arg_1']));_0x31458f[_0x6aba('0x4d')](_0x31458f[_0x6aba('0x3f')],_0x31458f[_0x6aba('0x40')],parseInt(_0x31458f[_0x6aba('0x41')],0xa)+0x1);_0x31458f[_0x6aba('0x33')]();}}else{logger[_0x6aba('0x8')](util['format']('Project\x20%s\x20not\x20found',_0x31458f[_0x6aba('0x14')]));_0x31458f[_0x6aba('0x4d')](_0x31458f['context'],_0x31458f[_0x6aba('0x40')],parseInt(_0x31458f[_0x6aba('0x41')],0xa)+0x1);_0x31458f['close']();}}function main(){var _0x178baa;return utilLicense['getLicense']()[_0x6aba('0x2e')](function(_0x342b05){if(_0x342b05){if(_0x342b05[_0x6aba('0x4f')]){if(_0x342b05['callysquare']&&_0x342b05[_0x6aba('0x50')]>0x0){logger[_0x6aba('0xc')](util[_0x6aba('0xd')](_0x6aba('0x51'),_0x342b05[_0x6aba('0x50')]));_0x178baa=_0x342b05['callysquare'];}else{logger['info'](_0x6aba('0x52'));}}else{logger[_0x6aba('0xc')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x178baa=-0x1;}}})[_0x6aba('0x2c')](function(_0x145903){logger[_0x6aba('0x8')](_0x6aba('0x53'),_0x145903[_0x6aba('0x12')]);})[_0x6aba('0x48')](function(){var _0x52c93d=require(_0x6aba('0x54'))(config[_0x6aba('0x3')][_0x6aba('0xb')],config[_0x6aba('0x3')]['ip'],_0x178baa);_0x52c93d['on'](_0x6aba('0x8'),errorHandler);_0x52c93d['on'](_0x6aba('0x55'),listeningHandler);_0x52c93d['on'](_0x6aba('0x56'),connectionHandler);_0x52c93d['on'](_0x6aba('0x33'),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 93034a5..90db154 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2209d9,_0x2a5acb){var _0x4d6332=function(_0x4fd56e){while(--_0x4fd56e){_0x2209d9['push'](_0x2209d9['shift']());}};_0x4d6332(++_0x2a5acb);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0xb3fcef,_0x2d3fcc){var _0x1bcf86=function(_0x2f0e6b){while(--_0x2f0e6b){_0xb3fcef['push'](_0xb3fcef['shift']());}};_0x1bcf86(++_0x2d3fcc);}(_0x34e8,0x12c));var _0x834e=function(_0xdffdfd,_0x9696f4){_0xdffdfd=_0xdffdfd-0x0;var _0x4ccdd4=_0x34e8[_0xdffdfd];return _0x4ccdd4;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index a127899..3f1922d 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x5d6d88,_0x3e941e){var _0x3a5905=function(_0x38f804){while(--_0x38f804){_0x5d6d88['push'](_0x5d6d88['shift']());}};_0x3a5905(++_0x3e941e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x66f9f9,_0x4e5148){_0x66f9f9=_0x66f9f9-0x0;var _0x83efea=_0x5f2f[_0x66f9f9];return _0x83efea;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x49ca07,_0x2b01d0){var _0x15fcd6=function(_0x1d0ab8){while(--_0x1d0ab8){_0x49ca07['push'](_0x49ca07['shift']());}};_0x15fcd6(++_0x2b01d0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x226ac5,_0x181a82){_0x226ac5=_0x226ac5-0x0;var _0x3238a2=_0x5f2f[_0x226ac5];return _0x3238a2;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 8011d37..510c6fc 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 _0xb1ef=['ShowMailAccount','Smtp','name','email','getSquareProjectById','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','util','client','then','error','message','result','getSquareProject','production'];(function(_0x577f24,_0x415e8c){var _0x4b82f7=function(_0x5239f9){while(--_0x5239f9){_0x577f24['push'](_0x577f24['shift']());}};_0x4b82f7(++_0x415e8c);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xfb1e('0x0'));var moment=require('moment');var _=require(_0xfb1e('0x1'));var util=require(_0xfb1e('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xfb1e('0x3')]['http']({'port':0x2329});function request(_0x2b40bb,_0xe0b2d7){return new BPromise(function(_0x570ec8,_0xa3d5d3){return client['request'](_0x2b40bb,_0xe0b2d7)[_0xfb1e('0x4')](function(_0x4a44e2){if(_0x4a44e2['error']){return _0xa3d5d3(_0x4a44e2[_0xfb1e('0x5')][_0xfb1e('0x6')]);}else{return _0x570ec8(_0x4a44e2[_0xfb1e('0x7')]);}})['catch'](function(_0x42b8d9){return _0xa3d5d3(_0x42b8d9);});});}exports[_0xfb1e('0x8')]=function(_0x1222cb){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1222cb},'attributes':[_0xfb1e('0x9')]}});};exports['getMailAccountById']=function(_0x301566){return request(_0xfb1e('0xa'),{'options':{'raw':![],'where':{'id':_0x301566},'include':[{'model':'MailServerOut','as':_0xfb1e('0xb')}],'attributes':['id',_0xfb1e('0xc'),_0xfb1e('0xd')]}});};exports[_0xfb1e('0xe')]=function(_0x3578f2){return request(_0xfb1e('0xf'),{'options':{'where':{'id':_0x3578f2},'attributes':[_0xfb1e('0xc')]}});};exports['getVoiceQueueById']=function(_0x2f34d5){return request(_0xfb1e('0x10'),{'options':{'where':{'id':_0x2f34d5},'attributes':[_0xfb1e('0xc')]}});};exports[_0xfb1e('0x11')]=function(_0x3f2bbc){return request(_0xfb1e('0x12'),{'options':{'where':{'id':_0x3f2bbc},'attributes':['name']}});};exports[_0xfb1e('0x13')]=function(_0x70a008){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x70a008},'attributes':[_0xfb1e('0x14')]}});};exports[_0xfb1e('0x15')]=function(_0x3c7277){return request(_0xfb1e('0x16'),{'options':{'where':{'id':_0x3c7277},'attributes':[_0xfb1e('0xc')]}});};exports[_0xfb1e('0x17')]=function(_0x20d279){return request('ShowTrunk',{'options':{'where':{'id':_0x20d279},'attributes':[_0xfb1e('0xc')]}});};exports[_0xfb1e('0x18')]=function(_0x2ed8a0){return request(_0xfb1e('0x19'),{'options':{'where':{'id':_0x2ed8a0},'attributes':[_0xfb1e('0x1a')]}});};exports[_0xfb1e('0x1b')]=function(_0x1aabb7){return request(_0xfb1e('0x1c'),{'options':{'raw':![],'where':{'id':_0x1aabb7},'include':[{'model':'Interval','as':_0xfb1e('0x1d')}]}});};exports[_0xfb1e('0x1e')]=function(_0x2b8c7b){return request(_0xfb1e('0x1f'),{'options':{'where':{'id':_0x2b8c7b},'attributes':['id','name']}});};exports[_0xfb1e('0x20')]=function(_0x23f138){return request('CreateSmsMessage',{'body':_0x23f138});};exports[_0xfb1e('0x21')]=function(_0xc15ea8){return request(_0xfb1e('0x22'),{'body':_0xc15ea8});};exports[_0xfb1e('0x23')]=function(_0x3bdd80){return request(_0xfb1e('0x24'),{'body':_[_0xfb1e('0x25')](_0x3bdd80,{'project_name':_0x3bdd80[_0xfb1e('0x26')],'prev_project_name':_0x3bdd80[_0xfb1e('0x27')]||'','is_subproject':_0x3bdd80['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xfb1e('0x28')]=function(_0x5b31e2){return request(_0xfb1e('0x29'),{'body':_0x5b31e2});};exports[_0xfb1e('0x2a')]=function(_0x27abb3){return request(_0xfb1e('0x2b'),{'body':_0x27abb3});};exports[_0xfb1e('0x2c')]=function(_0x16a4ba){return request(_0xfb1e('0x2d'),{'options':{'raw':![],'where':{'phone':_0x16a4ba[_0xfb1e('0x2e')],'ListId':_0x16a4ba['ListId']}}})[_0xfb1e('0x4')](function(_0x260eb2){if(_0x260eb2){return _0x260eb2;}return request(_0xfb1e('0x2f'),{'body':_0x16a4ba});});};exports[_0xfb1e('0x30')]=function(_0x3b891c){return request('ShowPause',{'options':{'where':{'id':_0x3b891c},'attributes':[_0xfb1e('0xc')]}});};exports[_0xfb1e('0x31')]=function(_0x1266f6,_0x28ae9c){return request(_0xfb1e('0x32'),{'body':{'interface':_0x28ae9c},'options':{'where':_0x1266f6}});};exports[_0xfb1e('0x33')]=function(_0x40b534,_0x496942,_0x466833){return request(_0xfb1e('0x34'),{'body':{'type':_0x496942,'uniqueid':_0x466833},'options':{'where':_0x40b534}});};exports[_0xfb1e('0x35')]=function(_0x939cb0){return request(_0xfb1e('0x36'),{'body':{},'options':{'where':_0x939cb0}});};exports['agentLogout']=function(_0x3048e3){return request(_0xfb1e('0x37'),{'body':{},'options':{'where':_0x3048e3}});}; \ No newline at end of file +var _0xe8ae=['Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval'];(function(_0xb43f0e,_0xe8c66b){var _0x4c9cb1=function(_0x255654){while(--_0x255654){_0xb43f0e['push'](_0xb43f0e['shift']());}};_0x4c9cb1(++_0xe8c66b);}(_0xe8ae,0x163));var _0xee8a=function(_0x29370c,_0x4862a0){_0x29370c=_0x29370c-0x0;var _0x47d70b=_0xe8ae[_0x29370c];return _0x47d70b;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xee8a('0x0'));var util=require(_0xee8a('0x1'));var jayson=require(_0xee8a('0x2'));var client=jayson[_0xee8a('0x3')][_0xee8a('0x4')]({'port':0x2329});function request(_0x479f38,_0x4a199a){return new BPromise(function(_0x5c358b,_0x46cad9){return client[_0xee8a('0x5')](_0x479f38,_0x4a199a)[_0xee8a('0x6')](function(_0x1f08fc){if(_0x1f08fc[_0xee8a('0x7')]){return _0x46cad9(_0x1f08fc[_0xee8a('0x7')]['message']);}else{return _0x5c358b(_0x1f08fc[_0xee8a('0x8')]);}})[_0xee8a('0x9')](function(_0x5c1f75){return _0x46cad9(_0x5c1f75);});});}exports[_0xee8a('0xa')]=function(_0xb4ada){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xb4ada},'attributes':[_0xee8a('0xb')]}});};exports[_0xee8a('0xc')]=function(_0x2c01ad){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2c01ad},'include':[{'model':_0xee8a('0xd'),'as':_0xee8a('0xe')}],'attributes':['id',_0xee8a('0xf'),'email']}});};exports['getSquareProjectById']=function(_0x59c81e){return request(_0xee8a('0x10'),{'options':{'where':{'id':_0x59c81e},'attributes':[_0xee8a('0xf')]}});};exports[_0xee8a('0x11')]=function(_0x411de5){return request(_0xee8a('0x12'),{'options':{'where':{'id':_0x411de5},'attributes':[_0xee8a('0xf')]}});};exports[_0xee8a('0x13')]=function(_0x55ca8b){return request(_0xee8a('0x14'),{'options':{'where':{'id':_0x55ca8b},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x4a5fc0){return request(_0xee8a('0x15'),{'options':{'where':{'id':_0x4a5fc0},'attributes':[_0xee8a('0x16')]}});};exports['getUserById']=function(_0x396f1a){return request(_0xee8a('0x17'),{'options':{'where':{'id':_0x396f1a},'attributes':[_0xee8a('0xf')]}});};exports[_0xee8a('0x18')]=function(_0x18d7a3){return request('ShowTrunk',{'options':{'where':{'id':_0x18d7a3},'attributes':[_0xee8a('0xf')]}});};exports[_0xee8a('0x19')]=function(_0x444ae7){return request(_0xee8a('0x1a'),{'options':{'where':{'id':_0x444ae7},'attributes':[_0xee8a('0x1b')]}});};exports['getIntervalById']=function(_0x5a778e){return request(_0xee8a('0x1c'),{'options':{'raw':![],'where':{'id':_0x5a778e},'include':[{'model':_0xee8a('0x1d'),'as':_0xee8a('0x1e')}]}});};exports[_0xee8a('0x1f')]=function(_0x524f64){return request(_0xee8a('0x20'),{'options':{'where':{'id':_0x524f64},'attributes':['id',_0xee8a('0xf')]}});};exports[_0xee8a('0x21')]=function(_0x80fb43){return request(_0xee8a('0x22'),{'body':_0x80fb43});};exports['createSquareDetailsReport']=function(_0x39903d){return request(_0xee8a('0x23'),{'body':_0x39903d});};exports['createSquareReport']=function(_0xb2cbb3){return request(_0xee8a('0x24'),{'body':_[_0xee8a('0x25')](_0xb2cbb3,{'project_name':_0xb2cbb3['arg_1'],'prev_project_name':_0xb2cbb3['arg_2']||'','is_subproject':_0xb2cbb3['arg_2']?!![]:![],'leaveAt':moment()[_0xee8a('0x26')](_0xee8a('0x27'))})});};exports[_0xee8a('0x28')]=function(_0x1fee56){return request(_0xee8a('0x29'),{'body':_0x1fee56});};exports['createSquareMessage']=function(_0x463dde){return request(_0xee8a('0x2a'),{'body':_0x463dde});};exports[_0xee8a('0x2b')]=function(_0x20dc04){return request(_0xee8a('0x2c'),{'options':{'raw':![],'where':{'phone':_0x20dc04[_0xee8a('0x2d')],'ListId':_0x20dc04['ListId']}}})[_0xee8a('0x6')](function(_0x51b364){if(_0x51b364){return _0x51b364;}return request(_0xee8a('0x2e'),{'body':_0x20dc04});});};exports[_0xee8a('0x2f')]=function(_0x2dbebf){return request(_0xee8a('0x30'),{'options':{'where':{'id':_0x2dbebf},'attributes':[_0xee8a('0xf')]}});};exports['agentLogin']=function(_0x377b35,_0x588e41){return request(_0xee8a('0x31'),{'body':{'interface':_0x588e41},'options':{'where':_0x377b35}});};exports['agentPause']=function(_0x58b539,_0x5d399f,_0x5f4465){return request(_0xee8a('0x32'),{'body':{'type':_0x5d399f,'uniqueid':_0x5f4465},'options':{'where':_0x58b539}});};exports[_0xee8a('0x33')]=function(_0x87ba3b){return request(_0xee8a('0x34'),{'body':{},'options':{'where':_0x87ba3b}});};exports[_0xee8a('0x35')]=function(_0x58fbe4){return request(_0xee8a('0x36'),{'body':{},'options':{'where':_0x58fbe4}});}; \ 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 f6e6f6a..ed986c7 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 _0x6737=['./lex','exports'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x6737,0xe2));var _0x7673=function(_0x2b764e,_0x137d37){_0x2b764e=_0x2b764e-0x0;var _0x505b08=_0x6737[_0x2b764e];return _0x505b08;};var polly=require('./polly');var lex=require(_0x7673('0x0'));module[_0x7673('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xda55=['./lex','./polly'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda55,0x6d));var _0x5da5=function(_0x1067cd,_0x400cb1){_0x1067cd=_0x1067cd-0x0;var _0x5d980d=_0xda55[_0x1067cd];return _0x5d980d;};var polly=require(_0x5da5('0x0'));var lex=require(_0x5da5('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index e2520ef..73bbafb 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 _0x41bb=['exports','./lib/api'];(function(_0x5edcec,_0x3a886b){var _0x3d12c6=function(_0x3e3cfa){while(--_0x3e3cfa){_0x5edcec['push'](_0x5edcec['shift']());}};_0x3d12c6(++_0x3a886b);}(_0x41bb,0xc5));var _0xb41b=function(_0x1d7bfc,_0x9dc01){_0x1d7bfc=_0x1d7bfc-0x0;var _0x34d68d=_0x41bb[_0x1d7bfc];return _0x34d68d;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ No newline at end of file +var _0xde6c=['exports','./lib/api'];(function(_0x438bef,_0x46e359){var _0x2273ec=function(_0x1aa198){while(--_0x1aa198){_0x438bef['push'](_0x438bef['shift']());}};_0x2273ec(++_0x46e359);}(_0xde6c,0x119));var _0xcde6=function(_0x4cc1c1,_0x3ad908){_0x4cc1c1=_0x4cc1c1-0x0;var _0x483778=_0xde6c[_0x4cc1c1];return _0x483778;};'use strict';var lex=require(_0xcde6('0x0'));module[_0xcde6('0x1')]=function(_0x579c86,_0x20f6d2,_0x330d58,_0x22fa0d,_0x31ac8c,_0x494a32){return lex(_0x579c86,_0x20f6d2,_0x330d58,_0x22fa0d,_0x31ac8c,_0x494a32);}; \ 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 5fb0059..9c80b0e 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 _0xcc8e=['slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk','slots'];(function(_0xfb83c,_0x4ab66e){var _0x3916e8=function(_0x4fcf2a){while(--_0x4fcf2a){_0xfb83c['push'](_0xfb83c['shift']());}};_0x3916e8(++_0x4ab66e);}(_0xcc8e,0x6d));var _0xecc8=function(_0x3138a7,_0x4276d8){_0x3138a7=_0x3138a7-0x0;var _0x3df3d1=_0xcc8e[_0x3138a7];return _0x3df3d1;};'use strict';var BPromise=require(_0xecc8('0x0'));var AWS=require(_0xecc8('0x1'));function lexResult(_0x20b5f9,_0x22ac01){return new BPromise(function(_0x142f92,_0x3830c5){_0x20b5f9['postText'](_0x22ac01,function(_0x3310e1,_0x358561){if(_0x3310e1){_0x3830c5(_0x3310e1);}if(_0x358561[_0xecc8('0x2')]){for(const _0x365f4f in _0x358561['slots']){if(_0x358561[_0xecc8('0x2')]['hasOwnProperty'](_0x365f4f)){var _0x5dc4ca=_0x358561[_0xecc8('0x2')][_0x365f4f];_0x358561[_0xecc8('0x3')+_0x365f4f]=_0x5dc4ca;}}}_0x142f92(_0x358561);});});}module[_0xecc8('0x4')]=function(_0x38a194,_0x1c975b,_0x164f9b,_0x9e930d,_0x86c82f,_0x2f3397){var _0x497ea5=new AWS[(_0xecc8('0x5'))]({'accessKeyId':_0x1c975b,'secretAccessKey':_0x164f9b,'region':_0x9e930d});var _0x42f200={'botAlias':_0xecc8('0x6'),'botName':_0x2f3397,'inputText':_0x86c82f,'userId':_0x38a194};return lexResult(_0x497ea5,_0x42f200);}; \ No newline at end of file +var _0x0380=['aws-sdk','postText','slots','slot_','exports','LexRuntime','bluebird'];(function(_0x134cbc,_0x16240f){var _0x4ef52d=function(_0x555e4f){while(--_0x555e4f){_0x134cbc['push'](_0x134cbc['shift']());}};_0x4ef52d(++_0x16240f);}(_0x0380,0x172));var _0x0038=function(_0x1760f8,_0x3e8f45){_0x1760f8=_0x1760f8-0x0;var _0x3a002c=_0x0380[_0x1760f8];return _0x3a002c;};'use strict';var BPromise=require(_0x0038('0x0'));var AWS=require(_0x0038('0x1'));function lexResult(_0x4a9fb3,_0x78c44d){return new BPromise(function(_0x10156e,_0x225dc2){_0x4a9fb3[_0x0038('0x2')](_0x78c44d,function(_0xdc6b2b,_0x2cc0f5){if(_0xdc6b2b){_0x225dc2(_0xdc6b2b);}if(_0x2cc0f5[_0x0038('0x3')]){for(const _0x2f2347 in _0x2cc0f5['slots']){if(_0x2cc0f5['slots']['hasOwnProperty'](_0x2f2347)){var _0x3edfed=_0x2cc0f5[_0x0038('0x3')][_0x2f2347];_0x2cc0f5[_0x0038('0x4')+_0x2f2347]=_0x3edfed;}}}_0x10156e(_0x2cc0f5);});});}module[_0x0038('0x5')]=function(_0x547caa,_0x3e9cf2,_0x52d9d2,_0x8a7088,_0x38b5bf,_0x51b834){var _0x40c79a=new AWS[(_0x0038('0x6'))]({'accessKeyId':_0x3e9cf2,'secretAccessKey':_0x52d9d2,'region':_0x8a7088});var _0x1e114a={'botAlias':'$LATEST','botName':_0x51b834,'inputText':_0x38b5bf,'userId':_0x547caa};return lexResult(_0x40c79a,_0x1e114a);}; \ 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 84f43f6..984dec5 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 _0x9c00=['./lib/api','exports'];(function(_0x635f0c,_0x148030){var _0x37543b=function(_0x869781){while(--_0x869781){_0x635f0c['push'](_0x635f0c['shift']());}};_0x37543b(++_0x148030);}(_0x9c00,0x1b0));var _0x09c0=function(_0x98ee7c,_0x499bff){_0x98ee7c=_0x98ee7c-0x0;var _0xe4d709=_0x9c00[_0x98ee7c];return _0xe4d709;};'use strict';var polly=require(_0x09c0('0x0'));module[_0x09c0('0x1')]=function(_0x582106,_0x2d5266,_0x25d496,_0x146f55,_0x4061ac,_0x1f516a,_0x26d343){return polly(_0x582106,_0x2d5266,_0x25d496,_0x146f55,_0x4061ac,_0x1f516a,_0x26d343);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x3e0478,_0x2fce99,_0x333c26,_0x5b178a,_0xaaa562,_0x587eac,_0x1d1373){return polly(_0x3e0478,_0x2fce99,_0x333c26,_0x5b178a,_0xaaa562,_0x587eac,_0x1d1373);}; \ 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 8764f1f..b556056 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 _0xeea4=['writeFile','exports','Polly','text','mp3','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x39feb4,_0x4e8569){var _0x154ea4=function(_0xa2b85){while(--_0xa2b85){_0x39feb4['push'](_0x39feb4['shift']());}};_0x154ea4(++_0x4e8569);}(_0xeea4,0x14d));var _0x4eea=function(_0x2e78b7,_0x4da7aa){_0x2e78b7=_0x2e78b7-0x0;var _0x3fbdea=_0xeea4[_0x2e78b7];return _0x3fbdea;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x4eea('0x0'));function pollyResult(_0x14f6fa,_0x4454d5,_0x39c978){return new BPromise(function(_0x2eaade,_0x46abc5){_0x14f6fa[_0x4eea('0x1')](_0x4454d5,function(_0x17b05a,_0x1bd0dd){if(_0x17b05a){_0x46abc5(_0x17b05a);}else if(_0x1bd0dd){if(_0x1bd0dd[_0x4eea('0x2')]instanceof Buffer){fs[_0x4eea('0x3')](_0x39c978,_0x1bd0dd[_0x4eea('0x2')],function(_0x19c92e){if(_0x19c92e){_0x46abc5(_0x19c92e);}else{_0x2eaade();}});}else{_0x46abc5(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x46abc5(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x4eea('0x4')]=function(_0x2d581a,_0x1ac1b1,_0x316618,_0x1492d7,_0x201089,_0x1c641d,_0x425e6c){var _0x2194d6=new AWS[(_0x4eea('0x5'))]({'accessKeyId':_0x2d581a,'secretAccessKey':_0x1ac1b1,'region':_0x316618});var _0x2b62db={'Text':_0x201089,'TextType':_0x1c641d||_0x4eea('0x6'),'OutputFormat':_0x4eea('0x7'),'VoiceId':_0x1492d7};return pollyResult(_0x2194d6,_0x2b62db,_0x425e6c);}; \ No newline at end of file +var _0x710a=['synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','bluebird','aws-sdk'];(function(_0x2e1336,_0x2eed8e){var _0x2d6a8e=function(_0x20f2bd){while(--_0x20f2bd){_0x2e1336['push'](_0x2e1336['shift']());}};_0x2d6a8e(++_0x2eed8e);}(_0x710a,0x9f));var _0xa710=function(_0x3b7f02,_0x4c3e29){_0x3b7f02=_0x3b7f02-0x0;var _0x1ccb32=_0x710a[_0x3b7f02];return _0x1ccb32;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa710('0x0'));var rs=require('randomstring');var AWS=require(_0xa710('0x1'));function pollyResult(_0x40c43b,_0xd2c1a4,_0x4bf319){return new BPromise(function(_0x1e7fe4,_0x3e803e){_0x40c43b[_0xa710('0x2')](_0xd2c1a4,function(_0x53de97,_0x44f393){if(_0x53de97){_0x3e803e(_0x53de97);}else if(_0x44f393){if(_0x44f393[_0xa710('0x3')]instanceof Buffer){fs['writeFile'](_0x4bf319,_0x44f393['AudioStream'],function(_0x2c1564){if(_0x2c1564){_0x3e803e(_0x2c1564);}else{_0x1e7fe4();}});}else{_0x3e803e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3e803e(new Error(_0xa710('0x4')));}});});}module['exports']=function(_0x5b341a,_0x48146c,_0x30bfc9,_0xd85387,_0x5ef52e,_0x461ca9,_0x25a218){var _0x49e292=new AWS[(_0xa710('0x5'))]({'accessKeyId':_0x5b341a,'secretAccessKey':_0x48146c,'region':_0x30bfc9});var _0x562a12={'Text':_0x5ef52e,'TextType':_0x461ca9||'text','OutputFormat':_0xa710('0x6'),'VoiceId':_0xd85387};return pollyResult(_0x49e292,_0x562a12,_0x25a218);}; \ 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 b354a33..c01fa05 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 _0x0ab2=['exports','./lib/api'];(function(_0x22a944,_0xd6f862){var _0x28a4db=function(_0x31245d){while(--_0x31245d){_0x22a944['push'](_0x22a944['shift']());}};_0x28a4db(++_0xd6f862);}(_0x0ab2,0x19d));var _0x20ab=function(_0x3205e0,_0x4543b3){_0x3205e0=_0x3205e0-0x0;var _0x25fd05=_0x0ab2[_0x3205e0];return _0x25fd05;};'use strict';var asr=require(_0x20ab('0x0'));module[_0x20ab('0x1')]=function(_0x44949a,_0x58a3be,_0x1a028f,_0x40ea92){return asr(_0x44949a,_0x58a3be,_0x1a028f);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x5a5f4f,_0x592422,_0x50a14d,_0x4d66fc){return asr(_0x5a5f4f,_0x592422,_0x50a14d);}; \ 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 7b11e65..82e6d29 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 _0x1c71=['toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0xc2f290,_0x5f478c){var _0x16e940=function(_0x22116f){while(--_0x22116f){_0xc2f290['push'](_0xc2f290['shift']());}};_0x16e940(++_0x5f478c);}(_0x1c71,0xe5));var _0x11c7=function(_0x4daf1d,_0x5e6792){_0x4daf1d=_0x4daf1d-0x0;var _0x8e9b7d=_0x1c71[_0x4daf1d];return _0x8e9b7d;};'use strict';var url=require(_0x11c7('0x0'));var BPromise=require(_0x11c7('0x1'));var fs=require('fs');var host=_0x11c7('0x2');module[_0x11c7('0x3')]=function(_0x5b0622,_0x2fd386,_0x25ed01){return new BPromise(function(_0x3e9efb,_0x4a1da8){var _0x144ddf;if(typeof _0x5b0622!==_0x11c7('0x4')||_0x5b0622['length']===0x0){return _0x4a1da8(_0x11c7('0x5'));}if(typeof _0x2fd386!==_0x11c7('0x4')||_0x2fd386['length']===0x0){return _0x4a1da8(_0x11c7('0x6'));}if(typeof _0x25ed01!==_0x11c7('0x7')&&(typeof _0x25ed01!==_0x11c7('0x4')||_0x25ed01['length']===0x0)){return _0x4a1da8('lang\x20should\x20be\x20a\x20string');}try{_0x144ddf=fs[_0x11c7('0x8')](_0x5b0622)[_0x11c7('0x9')](_0x11c7('0xa'));}catch(_0x2d8ac9){return _0x4a1da8(_0x2d8ac9);}return _0x3e9efb({'method':'POST','uri':host+_0x11c7('0xb')+_0x2fd386,'body':{'config':{'encoding':_0x11c7('0xc'),'sampleRateHertz':_0x11c7('0xd'),'languageCode':_0x25ed01},'audio':{'content':_0x144ddf}},'json':!![]});});}; \ No newline at end of file +var _0x4f7c=['length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','string'];(function(_0x2110e7,_0x2b0537){var _0x323e32=function(_0x4c8908){while(--_0x4c8908){_0x2110e7['push'](_0x2110e7['shift']());}};_0x323e32(++_0x2b0537);}(_0x4f7c,0xce));var _0xc4f7=function(_0x5a0fc6,_0x4a4eb5){_0x5a0fc6=_0x5a0fc6-0x0;var _0x34c960=_0x4f7c[_0x5a0fc6];return _0x34c960;};'use strict';var url=require(_0xc4f7('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xc4f7('0x1');module[_0xc4f7('0x2')]=function(_0xbd56fa,_0x457916,_0x11f0ba){return new BPromise(function(_0x515066,_0x868b84){var _0x28f60f;if(typeof _0xbd56fa!==_0xc4f7('0x3')||_0xbd56fa[_0xc4f7('0x4')]===0x0){return _0x868b84(_0xc4f7('0x5'));}if(typeof _0x457916!==_0xc4f7('0x3')||_0x457916[_0xc4f7('0x4')]===0x0){return _0x868b84('key\x20should\x20be\x20a\x20string');}if(typeof _0x11f0ba!==_0xc4f7('0x6')&&(typeof _0x11f0ba!==_0xc4f7('0x3')||_0x11f0ba['length']===0x0)){return _0x868b84(_0xc4f7('0x7'));}try{_0x28f60f=fs[_0xc4f7('0x8')](_0xbd56fa)[_0xc4f7('0x9')]('base64');}catch(_0x15a85b){return _0x868b84(_0x15a85b);}return _0x515066({'method':_0xc4f7('0xa'),'uri':host+_0xc4f7('0xb')+_0x457916,'body':{'config':{'encoding':_0xc4f7('0xc'),'sampleRateHertz':_0xc4f7('0xd'),'languageCode':_0x11f0ba},'audio':{'content':_0x28f60f}},'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 e9e37ad..f1ea55d 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 _0x8911=['./asr','exports'];(function(_0x1e50bf,_0x52dbe7){var _0x3866fc=function(_0x58709a){while(--_0x58709a){_0x1e50bf['push'](_0x1e50bf['shift']());}};_0x3866fc(++_0x52dbe7);}(_0x8911,0x76));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};var asr=require(_0x1891('0x0'));module[_0x1891('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc0e3=['./asr'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xc0e3,0x1a5));var _0x3c0e=function(_0xdbbdc2,_0x16a3be){_0xdbbdc2=_0xdbbdc2-0x0;var _0x20f387=_0xc0e3[_0xdbbdc2];return _0x20f387;};var asr=require(_0x3c0e('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 7c087d7..c035bb9 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 _0x6201=['source','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','randomstring','sox','./aws','./google','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','.mp3','777','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','stringify','result'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x6201,0xb0));var _0x1620=function(_0x19a47e,_0x3c1900){_0x19a47e=_0x19a47e-0x0;var _0x5e22e1=_0x6201[_0x19a47e];return _0x5e22e1;};'use strict';var apiai=require(_0x1620('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x1620('0x1'));var fs=require('fs');var http=require(_0x1620('0x2'));var https=require(_0x1620('0x3'));var md5=require(_0x1620('0x4'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x1620('0x5'));var sox=require(_0x1620('0x6'));var tts=require('google-tts-api');var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x1620('0x7'));var google=require(_0x1620('0x8'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x1620('0x9');function downloadFile(_0x2ff1e6,_0x24a2a1){return new BPromise(function(_0x4c5b02,_0x41da30){var _0x5a3c71=urlParse(_0x2ff1e6);var _0x44de7e=_0x5a3c71[_0x1620('0xa')]===_0x1620('0xb')?https:http;var _0x172f85={'host':_0x5a3c71[_0x1620('0xc')],'path':_0x5a3c71[_0x1620('0xd')],'headers':{'user-agent':_0x1620('0xe')}};_0x44de7e[_0x1620('0xf')](_0x172f85,function(_0x3c30b7){if(_0x3c30b7['statusCode']!==0xc8){logger['error'](_0x1620('0x10')+_0x2ff1e6+_0x1620('0x11')+_0x3c30b7[_0x1620('0x12')]+'\x20('+_0x3c30b7[_0x1620('0x13')]+')');_0x41da30(new Error(_0x1620('0x10')+_0x2ff1e6+_0x1620('0x11')+_0x3c30b7[_0x1620('0x12')]+'\x20('+_0x3c30b7[_0x1620('0x13')]+')'));return;}var _0x33028b=fs[_0x1620('0x14')](_0x24a2a1);_0x33028b['on']('finish',function(){logger[_0x1620('0x15')](_0x1620('0x16'));_0x33028b[_0x1620('0x17')](_0x4c5b02);});_0x33028b['on'](_0x1620('0x18'),function(_0x193af3){fs[_0x1620('0x19')](_0x24a2a1);logger['error'](_0x1620('0x1a'),_0x193af3);_0x41da30(_0x193af3);});_0x3c30b7[_0x1620('0x1b')](_0x33028b);})['on'](_0x1620('0x18'),function(_0x13efaf){logger[_0x1620('0x18')](_0x13efaf);_0x41da30(_0x13efaf);})[_0x1620('0x1c')]();});}function uploadFile(_0x10cc32){return new BPromise(function(_0x39b422,_0x10ea69){var _0x2e5d5a=urlParse(_0x10cc32);var _0xabc4c=_0x2e5d5a[_0x1620('0xa')]===_0x1620('0xb')?https:http;var _0x43cdd4={'host':_0x2e5d5a[_0x1620('0xc')],'path':_0x2e5d5a[_0x1620('0xd')],'headers':{'user-agent':'WHAT_EVER'}};_0xabc4c['get'](_0x43cdd4,function(_0x2694c2){if(_0x2694c2['statusCode']!==0xc8){_0x10ea69(new Error(_0x1620('0x10')+_0x10cc32+'\x20failed,\x20status\x20code\x20=\x20'+_0x2694c2[_0x1620('0x12')]+'\x20('+_0x2694c2[_0x1620('0x13')]+')'));return;}var _0x52588='';_0x2694c2['on'](_0x1620('0x1d'),function(_0x30c267){_0x52588+=_0x30c267;});_0x2694c2['on'](_0x1620('0x1c'),function(){_0x39b422(_0x52588);});})['on']('error',function(_0x2049f2){_0x10ea69(_0x2049f2);})[_0x1620('0x1c')]();});}function convertFile(_0x35eb12,_0x2840b3){return new BPromise(function(_0x1786ae,_0x3801b4){var _0x3ebe5b=sox[_0x1620('0x1e')](_0x35eb12,_0x2840b3,{'sampleRate':0x1f40,'format':_0x1620('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3ebe5b['on']('error',function(_0x46a7c0){logger['error'](_0x1620('0x20'),_0x46a7c0);_0x3801b4(_0x46a7c0);});_0x3ebe5b['on'](_0x1620('0x1c'),function(){logger[_0x1620('0x15')](_0x1620('0x21'));_0x1786ae();});_0x3ebe5b[_0x1620('0x22')]();});}function base64Decode(_0x1ae868,_0x35bd5b){var _0x25eeff=path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+_0x1620('0x26'));fs[_0x1620('0x27')](_0x25eeff,_0x1ae868,_0x1620('0x28'));return convertFile(_0x25eeff,_0x35bd5b)[_0x1620('0x29')](function(){try{fs['unlink'](_0x25eeff);fs[_0x1620('0x2a')](_0x35bd5b,'777');}catch(_0x1e1663){logger[_0x1620('0x18')](_0x1e1663);}return _0x35bd5b[_0x1620('0x2b')]('.')[0x0];});}function base64Encode(_0x45f087){var _0xa9bda3=fs['readFileSync'](_0x45f087);return new Buffer(_0xa9bda3)[_0x1620('0x2c')](_0x1620('0x28'));}exports[_0x1620('0x2d')]=function(_0x5a4d9d,_0xb478ee,_0x341a63,_0x401439,_0x19ef41,_0x2b3247){var _0x3de5d0,_0x3ff8d0;var _0x571629=_0x1620('0x2e');var _0x16380b=_0x1620('0x2f')+_0x5a4d9d;var _0x24751f={};if(_0xb478ee===_0x1620('0x30')){_0x24751f[_0x1620('0x31')]={'ssml':_0x341a63};}else{_0x24751f[_0x1620('0x31')]={'text':_0x341a63};};_0x24751f[_0x1620('0x32')]={'languageCode':_0x401439,'ssmlGender':_0x19ef41};_0x24751f['audioConfig']={'audioEncoding':_0x1620('0x33'),'sampleRateHertz':0x1f40};var _0x2ba8e6={'url':_0x571629+_0x1620('0x34')+_0x16380b,'method':_0x1620('0x35'),'json':!![],'body':_0x24751f};return rp(_0x2ba8e6)[_0x1620('0x29')](function(_0x56098e){return new BPromise(function(_0x3d2676,_0xab2fce){_0x3de5d0=path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+'.mp3');var _0x3f85c6=Buffer[_0x1620('0x36')](_0x56098e[_0x1620('0x37')],_0x1620('0x28'));return fs[_0x1620('0x38')](_0x3de5d0,_0x3f85c6,function(_0x142616){_0xab2fce(_0x142616);},function(_0x4bd257){fs[_0x1620('0x2a')](_0x3de5d0,'777');_0x3d2676(_0x4bd257);});});})['then'](function(_0x14e899){_0x3ff8d0=path[_0x1620('0x23')](__dirname,'tmp',rs[_0x1620('0x25')](0x4)+_0x1620('0x26'));return convertFile(_0x3de5d0,_0x3ff8d0);})['then'](function(){try{fs[_0x1620('0x19')](_0x3de5d0);fs['chmodSync'](_0x3ff8d0,'777');}catch(_0x31b442){logger['error'](_0x31b442);}logger[_0x1620('0x15')](_0x1620('0x39'),_0x3ff8d0[_0x1620('0x2b')]('.')[0x0]);return _0x3ff8d0[_0x1620('0x2b')]('.')[0x0];});};exports[_0x1620('0x3a')]=function(_0x5c417,_0x2e072d){var _0x1562bb,_0x40b468;return tts(_0x5c417,_0x2e072d||'en',0x1)['then'](function(_0x3962ee){logger[_0x1620('0x15')](_0x3962ee);_0x1562bb=path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+_0x1620('0x3b'));return downloadFile(_0x3962ee,_0x1562bb);})['then'](function(){_0x40b468=path['resolve'](__dirname,'tmp',rs[_0x1620('0x25')](0x4)+_0x1620('0x26'));return convertFile(_0x1562bb,_0x40b468);})[_0x1620('0x29')](function(){try{fs[_0x1620('0x19')](_0x1562bb);fs['chmodSync'](_0x40b468,_0x1620('0x3c'));}catch(_0x24f6a7){logger['error'](_0x24f6a7);}logger[_0x1620('0x15')](_0x1620('0x3d'),_0x40b468[_0x1620('0x2b')]('.')[0x0]);return _0x40b468[_0x1620('0x2b')]('.')[0x0];});};exports[_0x1620('0x3e')]=function(_0x451eb8,_0x2038a3,_0x443e65){return google[_0x1620('0x3f')](_0x451eb8,_0x2038a3,_0x443e65)[_0x1620('0x29')](function(_0x5c8294){logger[_0x1620('0x15')](_0x5c8294[_0x1620('0x40')]);return rp(_0x5c8294);})[_0x1620('0x29')](function(_0x51585c){var _0x100766='';var _0x26e939=0x0;try{fs[_0x1620('0x19')](_0x451eb8);}catch(_0x38b028){logger['error'](_0x38b028);}if(_0x51585c&&_0x51585c[_0x1620('0x41')]){_0x100766=_0x51585c['results']['map'](function(_0x4656aa){return _0x4656aa&&_0x4656aa[_0x1620('0x42')][0x0]&&_0x4656aa[_0x1620('0x42')][0x0][_0x1620('0x43')]?_0x4656aa['alternatives'][0x0][_0x1620('0x43')]:'';})[_0x1620('0x44')]('\x0a');_0x26e939=_0x51585c['results'][_0x1620('0x45')](function(_0x1edb5e){return _0x1edb5e&&_0x1edb5e[_0x1620('0x42')][0x0]&&_0x1edb5e[_0x1620('0x42')][0x0][_0x1620('0x46')]?_0x1edb5e[_0x1620('0x42')][0x0][_0x1620('0x46')]:0x0;})[_0x1620('0x44')]('\x0a');}logger[_0x1620('0x15')]('googleASR\x20transcription',_0x100766);logger[_0x1620('0x15')](_0x1620('0x47'),_0x26e939);return{'transcript':_0x100766,'confidence':_0x26e939};})[_0x1620('0x48')](function(_0x27d481){logger[_0x1620('0x18')](_0x1620('0x49'),_0x27d481[_0x1620('0x12')],_0x27d481['name'],_0x27d481[_0x1620('0x4a')]);});};exports['googleDialogflow']=function(_0x56ee8d,_0x4e726a,_0xb8d835,_0x4177d1){var _0x66ae5e=apiai(_0x4e726a,{'language':_0x4177d1||'en'});return _0x66ae5e[_0x1620('0x4b')](_0xb8d835,{'sessionId':md5(_0x56ee8d)})[_0x1620('0x29')](function(_0x3daecc){logger['info'](JSON[_0x1620('0x4c')](_0x3daecc));return{'source':_0x3daecc[_0x1620('0x4d')][_0x1620('0x4e')],'resolvedQuery':_0x3daecc[_0x1620('0x4d')]['resolvedQuery'],'action':_0x3daecc['result'][_0x1620('0x4f')],'actionIncomplete':_0x3daecc['result'][_0x1620('0x50')],'speech':_0x3daecc['result'][_0x1620('0x51')][_0x1620('0x52')],'score':_0x3daecc[_0x1620('0x4d')][_0x1620('0x53')],'statusCode':_0x3daecc[_0x1620('0x54')]['code'],'endConversation':_0x3daecc[_0x1620('0x4d')][_0x1620('0x55')][_0x1620('0x56')]||![],'isFallbackIntent':_0x3daecc['result'][_0x1620('0x55')][_0x1620('0x57')]};});};exports['googleDialogflowV2']=function(_0x445306,_0x10ec08,_0x390c83,_0x360090,_0x1953e1,_0x3fe466){var _0x27f143=_0x360090[_0x1620('0x58')](/\\n/g,'\x0a');var _0x18e331={'credentials':{'private_key':_0x27f143,'client_email':_0x390c83}};var _0x45c305=new dialogflow[(_0x1620('0x59'))](_0x18e331);var _0x1a652b=_0x45c305['sessionPath'](_0x10ec08,md5(_0x445306));var _0x3075e4={'session':_0x1a652b,'queryInput':{'text':{'text':_0x1953e1,'languageCode':_0x3fe466}}};return _0x45c305['detectIntent'](_0x3075e4)[_0x1620('0x29')](function(_0x1f2f09){if(_0x1f2f09&&_0x1f2f09[_0x1620('0x5a')]){logger[_0x1620('0x15')](_0x1620('0x5b'),JSON[_0x1620('0x4c')](_0x1f2f09));var _0x23ef40=_0x1f2f09[0x0];if(_0x23ef40){var _0x5e6222={'action':_0x23ef40[_0x1620('0x5c')][_0x1620('0x4f')],'allRequiredParamsPresent':_0x23ef40[_0x1620('0x5c')][_0x1620('0x5d')],'endConversation':_0x23ef40[_0x1620('0x5c')][_0x1620('0x5e')]&&_0x23ef40['queryResult'][_0x1620('0x5e')]['fields']?_0x23ef40[_0x1620('0x5c')]['diagnosticInfo'][_0x1620('0x5f')]['end_conversation'][_0x1620('0x60')]:![],'fulfillmentText':_0x23ef40[_0x1620('0x5c')][_0x1620('0x61')],'intentName':_0x23ef40[_0x1620('0x5c')]['intent']['name'],'intentDisplayName':_0x23ef40[_0x1620('0x5c')][_0x1620('0x62')][_0x1620('0x63')],'isFallbackIntent':_0x23ef40['queryResult']['intent'][_0x1620('0x64')],'languageCode':_0x23ef40[_0x1620('0x5c')][_0x1620('0x65')],'queryText':_0x23ef40['queryResult'][_0x1620('0x66')],'responseId':_0x23ef40[_0x1620('0x67')],'score':_0x23ef40['queryResult'][_0x1620('0x68')],'speech':_0x23ef40[_0x1620('0x5c')][_0x1620('0x61')],'providerResponse':JSON[_0x1620('0x4c')](_0x1f2f09)};return _0x5e6222;}}});};exports[_0x1620('0x69')]=function(_0x126533,_0xf73c97,_0x5f3906,_0x34dfcb){return tilde[_0x1620('0x3f')](_0x126533,_0xf73c97,_0x5f3906,_0x34dfcb)[_0x1620('0x29')](function(_0x496e06){try{fs[_0x1620('0x19')](_0x126533);}catch(_0x3e6c69){logger[_0x1620('0x18')](_0x3e6c69);}logger[_0x1620('0x15')](_0x1620('0x6a'),_0x496e06['transcript']);logger[_0x1620('0x15')]('Tilde\x20ASR\x20confidence',_0x496e06['confidence']);return _0x496e06;});};exports[_0x1620('0x6b')]=function(_0x2db108,_0x2c6256,_0x254b7f,_0x3cc961,_0x4c204f,_0x46a6bd){var _0x390ed3=path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+'.mp3');var _0x414fa5;return aws[_0x1620('0x6c')](_0x2db108,_0x2c6256,_0x254b7f,_0x3cc961,_0x4c204f,_0x46a6bd,_0x390ed3)[_0x1620('0x29')](function(){_0x414fa5=path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+'.wav');return convertFile(_0x390ed3,_0x414fa5);})[_0x1620('0x29')](function(){try{fs[_0x1620('0x19')](_0x390ed3);fs['chmodSync'](_0x414fa5,_0x1620('0x3c'));}catch(_0x229c37){logger[_0x1620('0x18')](_0x229c37);}return _0x414fa5[_0x1620('0x2b')]('.')[0x0];});};exports[_0x1620('0x6d')]=function(_0x1c4fcb,_0x53bdbd,_0x254483,_0x58b6c4,_0x253a60,_0x41f9e1){return aws[_0x1620('0x6e')](_0x1c4fcb,_0x53bdbd,_0x254483,_0x58b6c4,_0x253a60,_0x41f9e1)['then'](function(_0x540c36){logger[_0x1620('0x15')](JSON[_0x1620('0x4c')](_0x540c36));return _0x540c36;});};exports[_0x1620('0x6f')]=function(_0x5b5cbd,_0x8d4ec5,_0xe7adfc,_0x50774a){var _0x145ac1=util[_0x1620('0x70')](_0x1620('0x71'),ISPEECH_API,_0x5b5cbd,encodeURIComponent(_0x8d4ec5),_0xe7adfc,_0x50774a);var _0x7a8c9d=path[_0x1620('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x53350d;return downloadFile(_0x145ac1,_0x7a8c9d)[_0x1620('0x29')](function(){_0x53350d=path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+_0x1620('0x26'));return convertFile(_0x7a8c9d,_0x53350d);})['then'](function(){try{fs[_0x1620('0x19')](_0x7a8c9d);fs[_0x1620('0x2a')](_0x53350d,_0x1620('0x3c'));}catch(_0x545ded){logger[_0x1620('0x18')](_0x545ded);}return _0x53350d[_0x1620('0x2b')]('.')[0x0];});};exports[_0x1620('0x72')]=function(_0x3d63a7,_0x5f1f83,_0x2a6be6,_0x2f63ed){var _0x4fbb49=util[_0x1620('0x70')](_0x1620('0x73'),ISPEECH_API,_0x5f1f83,_0x2a6be6,base64Encode(_0x3d63a7),_0x2f63ed?util['format'](_0x1620('0x74'),encodeURIComponent(_0x2f63ed)):_0x1620('0x75'));return uploadFile(_0x4fbb49)[_0x1620('0x29')](function(_0x5a6d27){return querystring[_0x1620('0x76')](_0x5a6d27);});};exports['sestekNDA']=function(_0x5d578b,_0x1a0309){return sestek[_0x1620('0x77')](_0x5d578b,_0x1a0309)[_0x1620('0x29')](function(_0x2bed08){logger[_0x1620('0x15')](JSON[_0x1620('0x4c')](_0x2bed08));var _0x29d8e3={'speech':_0x2bed08['text'],'action':_0x2bed08['channelData']?_0x2bed08[_0x1620('0x78')][_0x1620('0x79')]:undefined,'actiondata':_0x2bed08[_0x1620('0x78')]?_0x2bed08['channelData'][_0x1620('0x7a')]:undefined};if(_0x2bed08[_0x1620('0x78')]&&_0x2bed08[_0x1620('0x78')][_0x1620('0x7b')]){return base64Decode(_0x2bed08[_0x1620('0x78')][_0x1620('0x7b')][_0x1620('0x7c')],path[_0x1620('0x23')](__dirname,_0x1620('0x24'),rs[_0x1620('0x25')](0x4)+'.wav'))[_0x1620('0x29')](function(_0x4dc2bb){_0x29d8e3[_0x1620('0x7d')]=_0x4dc2bb;return _0x29d8e3;});}return _0x29d8e3;});};exports[_0x1620('0x7e')]=function(){return __dirname;}; \ No newline at end of file +var _0xf310=['fields','boolValue','fulfillmentText','name','displayName','intent','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','randomstring','google-tts-api','url','parse','./aws','./google','./sestek','../../../config/logger','agi','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','data','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','unlink','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','POST','then','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','resolve','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','stringify','result','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xf310,0x10c));var _0x0f31=function(_0x1e9f4a,_0x5b2d28){_0x1e9f4a=_0x1e9f4a-0x0;var _0x1af2b1=_0xf310[_0x1e9f4a];return _0x1af2b1;};'use strict';var apiai=require(_0x0f31('0x0'));var BPromise=require(_0x0f31('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x0f31('0x2'));var https=require(_0x0f31('0x3'));var md5=require(_0x0f31('0x4'));var path=require(_0x0f31('0x5'));var querystring=require(_0x0f31('0x6'));var rp=require('request-promise');var rs=require(_0x0f31('0x7'));var sox=require('sox');var tts=require(_0x0f31('0x8'));var urlParse=require(_0x0f31('0x9'))[_0x0f31('0xa')];var util=require('util');var aws=require(_0x0f31('0xb'));var google=require(_0x0f31('0xc'));var sestek=require(_0x0f31('0xd'));var tilde=require('./tilde');var logger=require(_0x0f31('0xe'))(_0x0f31('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x15a41b,_0x56e493){return new BPromise(function(_0x44cb34,_0x5b7b3e){var _0xc7e604=urlParse(_0x15a41b);var _0x1f22f9=_0xc7e604['protocol']===_0x0f31('0x10')?https:http;var _0x3f5ec1={'host':_0xc7e604[_0x0f31('0x11')],'path':_0xc7e604[_0x0f31('0x5')],'headers':{'user-agent':_0x0f31('0x12')}};_0x1f22f9[_0x0f31('0x13')](_0x3f5ec1,function(_0x5d32d3){if(_0x5d32d3[_0x0f31('0x14')]!==0xc8){logger[_0x0f31('0x15')](_0x0f31('0x16')+_0x15a41b+_0x0f31('0x17')+_0x5d32d3['statusCode']+'\x20('+_0x5d32d3[_0x0f31('0x18')]+')');_0x5b7b3e(new Error('request\x20to\x20'+_0x15a41b+_0x0f31('0x17')+_0x5d32d3[_0x0f31('0x14')]+'\x20('+_0x5d32d3[_0x0f31('0x18')]+')'));return;}var _0x3194a5=fs['createWriteStream'](_0x56e493);_0x3194a5['on'](_0x0f31('0x19'),function(){logger[_0x0f31('0x1a')](_0x0f31('0x1b'));_0x3194a5[_0x0f31('0x1c')](_0x44cb34);});_0x3194a5['on'](_0x0f31('0x15'),function(_0x15b879){fs['unlink'](_0x56e493);logger[_0x0f31('0x15')](_0x0f31('0x1d'),_0x15b879);_0x5b7b3e(_0x15b879);});_0x5d32d3[_0x0f31('0x1e')](_0x3194a5);})['on'](_0x0f31('0x15'),function(_0x51d564){logger['error'](_0x51d564);_0x5b7b3e(_0x51d564);})[_0x0f31('0x1f')]();});}function uploadFile(_0x7567a1){return new BPromise(function(_0x2a661c,_0x58535){var _0x23eb7b=urlParse(_0x7567a1);var _0x5939d3=_0x23eb7b[_0x0f31('0x20')]===_0x0f31('0x10')?https:http;var _0x46937c={'host':_0x23eb7b[_0x0f31('0x11')],'path':_0x23eb7b[_0x0f31('0x5')],'headers':{'user-agent':_0x0f31('0x12')}};_0x5939d3[_0x0f31('0x13')](_0x46937c,function(_0xc93628){if(_0xc93628[_0x0f31('0x14')]!==0xc8){_0x58535(new Error(_0x0f31('0x16')+_0x7567a1+_0x0f31('0x17')+_0xc93628['statusCode']+'\x20('+_0xc93628[_0x0f31('0x18')]+')'));return;}var _0x515cbc='';_0xc93628['on'](_0x0f31('0x21'),function(_0x1cbb6d){_0x515cbc+=_0x1cbb6d;});_0xc93628['on'](_0x0f31('0x1f'),function(){_0x2a661c(_0x515cbc);});})['on'](_0x0f31('0x15'),function(_0x506d50){_0x58535(_0x506d50);})[_0x0f31('0x1f')]();});}function convertFile(_0x858fb,_0x321587){return new BPromise(function(_0x5e6801,_0x43b518){var _0x18eccf=sox['transcode'](_0x858fb,_0x321587,{'sampleRate':0x1f40,'format':_0x0f31('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x18eccf['on'](_0x0f31('0x15'),function(_0x4cdaa4){logger['error'](_0x0f31('0x23'),_0x4cdaa4);_0x43b518(_0x4cdaa4);});_0x18eccf['on'](_0x0f31('0x1f'),function(){logger['info'](_0x0f31('0x24'));_0x5e6801();});_0x18eccf[_0x0f31('0x25')]();});}function base64Decode(_0x3bfb3d,_0x1d86c2){var _0x245bc0=path['resolve'](__dirname,_0x0f31('0x26'),rs[_0x0f31('0x27')](0x4)+_0x0f31('0x28'));fs['writeFileSync'](_0x245bc0,_0x3bfb3d,_0x0f31('0x29'));return convertFile(_0x245bc0,_0x1d86c2)['then'](function(){try{fs[_0x0f31('0x2a')](_0x245bc0);fs['chmodSync'](_0x1d86c2,_0x0f31('0x2b'));}catch(_0x24f74d){logger[_0x0f31('0x15')](_0x24f74d);}return _0x1d86c2[_0x0f31('0x2c')]('.')[0x0];});}function base64Encode(_0x30bcd9){var _0xd3b650=fs[_0x0f31('0x2d')](_0x30bcd9);return new Buffer(_0xd3b650)['toString'](_0x0f31('0x29'));}exports['googleCloudTTS']=function(_0x5bbee4,_0x5a662b,_0x113015,_0xd1eee2,_0x300b91,_0x3cc4a4){var _0x4f6248,_0x2b062f;var _0x2550c2=_0x0f31('0x2e');var _0x1c0052=_0x0f31('0x2f')+_0x5bbee4;var _0x26f5ae={};if(_0x5a662b===_0x0f31('0x30')){_0x26f5ae['input']={'ssml':_0x113015};}else{_0x26f5ae['input']={'text':_0x113015};};_0x26f5ae[_0x0f31('0x31')]={'languageCode':_0xd1eee2,'ssmlGender':_0x300b91};_0x26f5ae['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x3d91ea={'url':_0x2550c2+'text:synthesize'+_0x1c0052,'method':_0x0f31('0x32'),'json':!![],'body':_0x26f5ae};return rp(_0x3d91ea)[_0x0f31('0x33')](function(_0x10b8c9){return new BPromise(function(_0x20f87b,_0x91560a){_0x4f6248=path['resolve'](__dirname,_0x0f31('0x26'),rs[_0x0f31('0x27')](0x4)+_0x0f31('0x34'));var _0xc3cac9=Buffer[_0x0f31('0x35')](_0x10b8c9[_0x0f31('0x36')],'base64');return fs[_0x0f31('0x37')](_0x4f6248,_0xc3cac9,function(_0x250db4){_0x91560a(_0x250db4);},function(_0x162491){fs[_0x0f31('0x38')](_0x4f6248,_0x0f31('0x2b'));_0x20f87b(_0x162491);});});})[_0x0f31('0x33')](function(_0x36a38e){_0x2b062f=path['resolve'](__dirname,'tmp',rs[_0x0f31('0x27')](0x4)+'.wav');return convertFile(_0x4f6248,_0x2b062f);})[_0x0f31('0x33')](function(){try{fs[_0x0f31('0x2a')](_0x4f6248);fs[_0x0f31('0x38')](_0x2b062f,_0x0f31('0x2b'));}catch(_0x2a987f){logger['error'](_0x2a987f);}logger[_0x0f31('0x1a')](_0x0f31('0x39'),_0x2b062f[_0x0f31('0x2c')]('.')[0x0]);return _0x2b062f['split']('.')[0x0];});};exports[_0x0f31('0x3a')]=function(_0xfa27a3,_0x1e6ac3){var _0x15581b,_0x3c5b20;return tts(_0xfa27a3,_0x1e6ac3||'en',0x1)[_0x0f31('0x33')](function(_0x46e4cd){logger[_0x0f31('0x1a')](_0x46e4cd);_0x15581b=path['resolve'](__dirname,_0x0f31('0x26'),rs[_0x0f31('0x27')](0x4)+_0x0f31('0x34'));return downloadFile(_0x46e4cd,_0x15581b);})[_0x0f31('0x33')](function(){_0x3c5b20=path[_0x0f31('0x3b')](__dirname,'tmp',rs[_0x0f31('0x27')](0x4)+_0x0f31('0x28'));return convertFile(_0x15581b,_0x3c5b20);})[_0x0f31('0x33')](function(){try{fs['unlink'](_0x15581b);fs[_0x0f31('0x38')](_0x3c5b20,_0x0f31('0x2b'));}catch(_0x4e56e9){logger[_0x0f31('0x15')](_0x4e56e9);}logger[_0x0f31('0x1a')](_0x0f31('0x3c'),_0x3c5b20[_0x0f31('0x2c')]('.')[0x0]);return _0x3c5b20[_0x0f31('0x2c')]('.')[0x0];});};exports[_0x0f31('0x3d')]=function(_0x173b5f,_0xb14da2,_0x5ef4a0){return google['asr'](_0x173b5f,_0xb14da2,_0x5ef4a0)[_0x0f31('0x33')](function(_0x7e289d){logger[_0x0f31('0x1a')](_0x7e289d[_0x0f31('0x3e')]);return rp(_0x7e289d);})[_0x0f31('0x33')](function(_0x54a5eb){var _0x27a9de='';var _0x3fbf18=0x0;try{fs[_0x0f31('0x2a')](_0x173b5f);}catch(_0x26c4e5){logger[_0x0f31('0x15')](_0x26c4e5);}if(_0x54a5eb&&_0x54a5eb[_0x0f31('0x3f')]){_0x27a9de=_0x54a5eb[_0x0f31('0x3f')][_0x0f31('0x40')](function(_0xd9a03){return _0xd9a03&&_0xd9a03[_0x0f31('0x41')][0x0]&&_0xd9a03['alternatives'][0x0]['transcript']?_0xd9a03['alternatives'][0x0][_0x0f31('0x42')]:'';})[_0x0f31('0x43')]('\x0a');_0x3fbf18=_0x54a5eb['results'][_0x0f31('0x40')](function(_0x45cd20){return _0x45cd20&&_0x45cd20[_0x0f31('0x41')][0x0]&&_0x45cd20[_0x0f31('0x41')][0x0][_0x0f31('0x44')]?_0x45cd20[_0x0f31('0x41')][0x0][_0x0f31('0x44')]:0x0;})['join']('\x0a');}logger[_0x0f31('0x1a')](_0x0f31('0x45'),_0x27a9de);logger[_0x0f31('0x1a')](_0x0f31('0x46'),_0x3fbf18);return{'transcript':_0x27a9de,'confidence':_0x3fbf18};})[_0x0f31('0x47')](function(_0x1bd3ed){logger['error'](_0x0f31('0x48'),_0x1bd3ed[_0x0f31('0x14')],_0x1bd3ed['name'],_0x1bd3ed[_0x0f31('0x49')]);});};exports['googleDialogflow']=function(_0x36e413,_0x33851a,_0x969101,_0x18fe1e){var _0x215ec7=apiai(_0x33851a,{'language':_0x18fe1e||'en'});return _0x215ec7[_0x0f31('0x4a')](_0x969101,{'sessionId':md5(_0x36e413)})[_0x0f31('0x33')](function(_0x324725){logger[_0x0f31('0x1a')](JSON[_0x0f31('0x4b')](_0x324725));return{'source':_0x324725[_0x0f31('0x4c')]['source'],'resolvedQuery':_0x324725[_0x0f31('0x4c')][_0x0f31('0x4d')],'action':_0x324725[_0x0f31('0x4c')][_0x0f31('0x4e')],'actionIncomplete':_0x324725[_0x0f31('0x4c')][_0x0f31('0x4f')],'speech':_0x324725['result']['fulfillment'][_0x0f31('0x50')],'score':_0x324725[_0x0f31('0x4c')][_0x0f31('0x51')],'statusCode':_0x324725[_0x0f31('0x52')][_0x0f31('0x53')],'endConversation':_0x324725[_0x0f31('0x4c')][_0x0f31('0x54')][_0x0f31('0x55')]||![],'isFallbackIntent':_0x324725[_0x0f31('0x4c')][_0x0f31('0x54')][_0x0f31('0x56')]};});};exports[_0x0f31('0x57')]=function(_0x5e8fc6,_0x1a9674,_0x3278b7,_0xab4975,_0x227f17,_0x3b1135){var _0x4d448d=_0xab4975['replace'](/\\n/g,'\x0a');var _0x5d272c={'credentials':{'private_key':_0x4d448d,'client_email':_0x3278b7}};var _0x5af4ee=new dialogflow[(_0x0f31('0x58'))](_0x5d272c);var _0x486adb=_0x5af4ee[_0x0f31('0x59')](_0x1a9674,md5(_0x5e8fc6));var _0x1f7106={'session':_0x486adb,'queryInput':{'text':{'text':_0x227f17,'languageCode':_0x3b1135}}};return _0x5af4ee[_0x0f31('0x5a')](_0x1f7106)[_0x0f31('0x33')](function(_0x236dc1){if(_0x236dc1&&_0x236dc1[_0x0f31('0x5b')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x0f31('0x4b')](_0x236dc1));var _0x2f8bd3=_0x236dc1[0x0];if(_0x2f8bd3){var _0x330444={'action':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x4e')],'allRequiredParamsPresent':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x5d')],'endConversation':_0x2f8bd3[_0x0f31('0x5c')]['diagnosticInfo']&&_0x2f8bd3['queryResult'][_0x0f31('0x5e')][_0x0f31('0x5f')]?_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x5e')][_0x0f31('0x5f')]['end_conversation'][_0x0f31('0x60')]:![],'fulfillmentText':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x61')],'intentName':_0x2f8bd3[_0x0f31('0x5c')]['intent'][_0x0f31('0x62')],'intentDisplayName':_0x2f8bd3[_0x0f31('0x5c')]['intent'][_0x0f31('0x63')],'isFallbackIntent':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x64')]['isFallback'],'languageCode':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x65')],'queryText':_0x2f8bd3[_0x0f31('0x5c')]['queryText'],'responseId':_0x2f8bd3[_0x0f31('0x66')],'score':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x67')],'speech':_0x2f8bd3[_0x0f31('0x5c')][_0x0f31('0x61')],'providerResponse':JSON[_0x0f31('0x4b')](_0x236dc1)};return _0x330444;}}});};exports['tildeASR']=function(_0x1ef55d,_0x38dd77,_0x2cc0b6,_0x37fe49){return tilde['asr'](_0x1ef55d,_0x38dd77,_0x2cc0b6,_0x37fe49)[_0x0f31('0x33')](function(_0x34047b){try{fs[_0x0f31('0x2a')](_0x1ef55d);}catch(_0x34b8ce){logger[_0x0f31('0x15')](_0x34b8ce);}logger[_0x0f31('0x1a')](_0x0f31('0x68'),_0x34047b[_0x0f31('0x42')]);logger[_0x0f31('0x1a')](_0x0f31('0x69'),_0x34047b['confidence']);return _0x34047b;});};exports[_0x0f31('0x6a')]=function(_0x4c21a1,_0x886b2,_0x5ce889,_0x380aa3,_0x354674,_0x3355ca){var _0x7cc262=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x0f31('0x34'));var _0x2c3195;return aws[_0x0f31('0x6b')](_0x4c21a1,_0x886b2,_0x5ce889,_0x380aa3,_0x354674,_0x3355ca,_0x7cc262)[_0x0f31('0x33')](function(){_0x2c3195=path['resolve'](__dirname,_0x0f31('0x26'),rs['generate'](0x4)+_0x0f31('0x28'));return convertFile(_0x7cc262,_0x2c3195);})[_0x0f31('0x33')](function(){try{fs['unlink'](_0x7cc262);fs[_0x0f31('0x38')](_0x2c3195,_0x0f31('0x2b'));}catch(_0xe5d4ae){logger[_0x0f31('0x15')](_0xe5d4ae);}return _0x2c3195[_0x0f31('0x2c')]('.')[0x0];});};exports[_0x0f31('0x6c')]=function(_0x3cf0a7,_0x3f562c,_0x41fd81,_0x7389e0,_0x39651b,_0x291f2d){return aws[_0x0f31('0x6d')](_0x3cf0a7,_0x3f562c,_0x41fd81,_0x7389e0,_0x39651b,_0x291f2d)[_0x0f31('0x33')](function(_0x1f7260){logger[_0x0f31('0x1a')](JSON[_0x0f31('0x4b')](_0x1f7260));return _0x1f7260;});};exports[_0x0f31('0x6e')]=function(_0x2cf3af,_0xa71236,_0x34c450,_0x1f23f9){var _0x56789c=util[_0x0f31('0x6f')](_0x0f31('0x70'),ISPEECH_API,_0x2cf3af,encodeURIComponent(_0xa71236),_0x34c450,_0x1f23f9);var _0x155a82=path['resolve'](__dirname,_0x0f31('0x26'),rs[_0x0f31('0x27')](0x4)+_0x0f31('0x34'));var _0x3a969c;return downloadFile(_0x56789c,_0x155a82)[_0x0f31('0x33')](function(){_0x3a969c=path['resolve'](__dirname,'tmp',rs[_0x0f31('0x27')](0x4)+_0x0f31('0x28'));return convertFile(_0x155a82,_0x3a969c);})[_0x0f31('0x33')](function(){try{fs['unlink'](_0x155a82);fs['chmodSync'](_0x3a969c,_0x0f31('0x2b'));}catch(_0x35e1aa){logger[_0x0f31('0x15')](_0x35e1aa);}return _0x3a969c[_0x0f31('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0xbe3aa3,_0x2aae07,_0x50c31c,_0x543c0e){var _0x2400a6=util[_0x0f31('0x6f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2aae07,_0x50c31c,base64Encode(_0xbe3aa3),_0x543c0e?util[_0x0f31('0x6f')](_0x0f31('0x71'),encodeURIComponent(_0x543c0e)):'freeform=3');return uploadFile(_0x2400a6)[_0x0f31('0x33')](function(_0x2f7202){return querystring[_0x0f31('0xa')](_0x2f7202);});};exports['sestekNDA']=function(_0x155b70,_0x4558e2){return sestek['nda'](_0x155b70,_0x4558e2)['then'](function(_0x540ac5){logger['info'](JSON['stringify'](_0x540ac5));var _0x44bcab={'speech':_0x540ac5[_0x0f31('0x72')],'action':_0x540ac5[_0x0f31('0x73')]?_0x540ac5[_0x0f31('0x73')][_0x0f31('0x74')]:undefined,'actiondata':_0x540ac5[_0x0f31('0x73')]?_0x540ac5[_0x0f31('0x73')][_0x0f31('0x75')]:undefined};if(_0x540ac5[_0x0f31('0x73')]&&_0x540ac5[_0x0f31('0x73')][_0x0f31('0x76')]){return base64Decode(_0x540ac5[_0x0f31('0x73')][_0x0f31('0x76')]['Data'],path[_0x0f31('0x3b')](__dirname,_0x0f31('0x26'),rs['generate'](0x4)+'.wav'))[_0x0f31('0x33')](function(_0x296a4a){_0x44bcab[_0x0f31('0x77')]=_0x296a4a;return _0x44bcab;});}return _0x44bcab;});};exports[_0x0f31('0x78')]=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 5424423..c78d10b 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 _0xd4b4=['./nda'];(function(_0xe8e4ac,_0x27d8ab){var _0x266e0e=function(_0xfd4402){while(--_0xfd4402){_0xe8e4ac['push'](_0xe8e4ac['shift']());}};_0x266e0e(++_0x27d8ab);}(_0xd4b4,0xba));var _0x4d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b4[_0x3dd15e];return _0x231fd0;};var nda=require(_0x4d4b('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x5ae0=['exports','./nda'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x5ae0,0x103));var _0x05ae=function(_0xf2d807,_0x9238ae){_0xf2d807=_0xf2d807-0x0;var _0x24b0d9=_0x5ae0[_0xf2d807];return _0x24b0d9;};var nda=require(_0x05ae('0x0'));module[_0x05ae('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 22a9df8..21d2e7f 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 _0x53d4=['callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda'];(function(_0x56932a,_0xa3e3b4){var _0x4f6781=function(_0x5b1c7d){while(--_0x5b1c7d){_0x56932a['push'](_0x56932a['shift']());}};_0x4f6781(++_0xa3e3b4);}(_0x53d4,0x112));var _0x453d=function(_0x3736d7,_0x3d44f7){_0x3736d7=_0x3736d7-0x0;var _0x5e5e46=_0x53d4[_0x3736d7];return _0x5e5e46;};'use strict';var rp=require(_0x453d('0x0'));var url=require(_0x453d('0x1'));var logger=require(_0x453d('0x2'))(_0x453d('0x3'));module[_0x453d('0x4')]=function(_0x504738,_0x4ac127){var _0x33a85f={'method':_0x453d('0x5'),'uri':url['resolve'](_0x4ac127[_0x453d('0x6')],'/token'),'form':{'grant_type':_0x453d('0x7'),'username':_0x4ac127['username'],'password':_0x4ac127['password']},'json':!![]};return rp(_0x33a85f)['then'](function(_0x544159){var _0x1fa88d={'method':_0x453d('0x5'),'uri':url[_0x453d('0x8')](_0x4ac127[_0x453d('0x9')],_0x453d('0xa')),'body':{'type':_0x4ac127[_0x453d('0xb')]||_0x453d('0xc'),'channelId':_0x453d('0xd'),'conversation':{'id':_0x504738['uniqueid']},'from':{'id':_0x504738[_0x453d('0xe')],'name':_0x504738[_0x453d('0xf')]},'recipient':{'id':_0x504738[_0x453d('0x10')],'name':_0x504738[_0x453d('0x11')]},'text':_0x4ac127[_0x453d('0x12')],'channelData':{}},'headers':{'Authorization':_0x453d('0x13')+_0x544159[_0x453d('0x14')]},'json':!![]};if(_0x4ac127['project']){_0x1fa88d[_0x453d('0x15')][_0x453d('0x16')]['ProjectName']=_0x4ac127[_0x453d('0x17')];}if(_0x4ac127[_0x453d('0x18')]=='1'){_0x1fa88d[_0x453d('0x15')][_0x453d('0x16')][_0x453d('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x453d('0x1a')};}if(_0x4ac127[_0x453d('0x1b')]){_0x1fa88d['body'][_0x453d('0x16')][_0x453d('0x1c')]=_0x4ac127[_0x453d('0x1b')];if(_0x4ac127[_0x453d('0x1d')]){_0x1fa88d[_0x453d('0x15')][_0x453d('0x16')][_0x453d('0x1e')]=_0x4ac127[_0x453d('0x1d')];}}logger[_0x453d('0x1f')](JSON['stringify'](_0x1fa88d));return rp(_0x1fa88d);});}; \ No newline at end of file +var _0xafae=['ProjectName','ndagenerate_audio','channelData','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','POST','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body'];(function(_0x163448,_0x272442){var _0x3901a3=function(_0x21c262){while(--_0x21c262){_0x163448['push'](_0x163448['shift']());}};_0x3901a3(++_0x272442);}(_0xafae,0xa4));var _0xeafa=function(_0x319e4f,_0x4fd139){_0x319e4f=_0x319e4f-0x0;var _0x5dd32a=_0xafae[_0x319e4f];return _0x5dd32a;};'use strict';var rp=require(_0xeafa('0x0'));var url=require(_0xeafa('0x1'));var logger=require(_0xeafa('0x2'))('agi');module['exports']=function(_0x18e16e,_0x192d0b){var _0x5a46be={'method':_0xeafa('0x3'),'uri':url['resolve'](_0x192d0b[_0xeafa('0x4')],'/token'),'form':{'grant_type':_0xeafa('0x5'),'username':_0x192d0b[_0xeafa('0x6')],'password':_0x192d0b['password']},'json':!![]};return rp(_0x5a46be)[_0xeafa('0x7')](function(_0x189f16){var _0x236771={'method':_0xeafa('0x3'),'uri':url['resolve'](_0x192d0b[_0xeafa('0x8')],_0xeafa('0x9')),'body':{'type':_0x192d0b[_0xeafa('0xa')]||'message','channelId':_0xeafa('0xb'),'conversation':{'id':_0x18e16e[_0xeafa('0xc')]},'from':{'id':_0x18e16e[_0xeafa('0xd')],'name':_0x18e16e[_0xeafa('0xe')]},'recipient':{'id':_0x18e16e[_0xeafa('0xf')],'name':_0x18e16e[_0xeafa('0x10')]},'text':_0x192d0b[_0xeafa('0x11')],'channelData':{}},'headers':{'Authorization':_0xeafa('0x12')+_0x189f16[_0xeafa('0x13')]},'json':!![]};if(_0x192d0b[_0xeafa('0x14')]){_0x236771[_0xeafa('0x15')]['channelData'][_0xeafa('0x16')]=_0x192d0b[_0xeafa('0x14')];}if(_0x192d0b[_0xeafa('0x17')]=='1'){_0x236771[_0xeafa('0x15')][_0xeafa('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x192d0b['custom_action']){_0x236771['body'][_0xeafa('0x18')][_0xeafa('0x19')]=_0x192d0b[_0xeafa('0x1a')];if(_0x192d0b[_0xeafa('0x1b')]){_0x236771[_0xeafa('0x15')][_0xeafa('0x18')][_0xeafa('0x1c')]=_0x192d0b[_0xeafa('0x1b')];}}logger[_0xeafa('0x1d')](JSON[_0xeafa('0x1e')](_0x236771));return rp(_0x236771);});}; \ 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 49fcad8..5a8cf7b 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 _0x149f=['exports','./lib/api'];(function(_0x3759fa,_0x4a1baa){var _0x4e512e=function(_0x4cd625){while(--_0x4cd625){_0x3759fa['push'](_0x3759fa['shift']());}};_0x4e512e(++_0x4a1baa);}(_0x149f,0x115));var _0xf149=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x149f[_0x45783c];return _0x1161da;};'use strict';var asr=require(_0xf149('0x0'));module[_0xf149('0x1')]=function(_0x212a71,_0x44d837,_0x2c2c03,_0x73fbbf){return asr(_0x212a71,_0x44d837,_0x2c2c03,_0x73fbbf);}; \ No newline at end of file +var _0x3115=['exports'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0x3115,0x1f3));var _0x5311=function(_0x22e003,_0x544b4e){_0x22e003=_0x22e003-0x0;var _0x58178e=_0x3115[_0x22e003];return _0x58178e;};'use strict';var asr=require('./lib/api');module[_0x5311('0x0')]=function(_0x4983bf,_0x422bd2,_0x122e32,_0x554695){return asr(_0x4983bf,_0x422bd2,_0x122e32,_0x554695);}; \ 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 2eeccf4..7d66be9 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 _0x7031=['Close\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','crypto','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.'];(function(_0x920ae3,_0x4652ef){var _0x19ea79=function(_0x4ce49f){while(--_0x4ce49f){_0x920ae3['push'](_0x920ae3['shift']());}};_0x19ea79(++_0x4652ef);}(_0x7031,0x19a));var _0x1703=function(_0x544ded,_0x2cd874){_0x544ded=_0x544ded-0x0;var _0x598372=_0x7031[_0x544ded];return _0x598372;};'use strict';var BPromise=require(_0x1703('0x0'));var _=require(_0x1703('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1703('0x2'));var logger=require(_0x1703('0x3'))('agi');module[_0x1703('0x4')]=function(_0x193f2a,_0x520961,_0x1ad53b,_0x438115){return new BPromise(function(_0x537084,_0x9222f3){logger['info'](_0x1703('0x5'),_0x438115||_0x1703('0x6'));var _0x3117b5=new WebSocket(_0x438115||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1cba9a='';var _0x3acf9c='0';var _0x3dd60f='1';var _0x5ded48=_0x1703('0x7');function _0x3feed6(_0x3b1913){var _0x228fae=crypto[_0x1703('0x8')](_0x1703('0x9'));_0x228fae[_0x1703('0xa')](_0x3b1913);return _0x228fae[_0x1703('0xb')](_0x1703('0xc'));}function _0x2fa96c(){try{logger[_0x1703('0xd')](_0x1703('0xe'));var _0x157055=moment()[_0x1703('0xf')]();var _0x462345=_0x3feed6(_0x157055+_0x520961+_0x1ad53b);_0x3117b5[_0x1703('0x10')](JSON[_0x1703('0x11')]({'appID':_0x520961,'timestamp':_0x157055,'appKey':_0x462345}));var _0x572b96=fs['createReadStream'](_0x193f2a);_0x572b96['on'](_0x1703('0x12'),function(_0x467d31){_0x3117b5['send'](_0x467d31);});_0x572b96['on'](_0x1703('0x13'),function(){_0x3117b5[_0x1703('0x10')](_0x1703('0x14'));});}catch(_0x4c41a3){logger[_0x1703('0x15')](_0x1703('0x16'),JSON['stringify'](_0x4c41a3));_0x3117b5[_0x1703('0x17')]();}}function _0x77b9ea(_0x22eb2c){try{if(_0x22eb2c){var _0x3c0695=JSON[_0x1703('0x18')](_0x22eb2c);switch(_0x3c0695[_0x1703('0x19')]){case 0x0:if(_0x3c0695[_0x1703('0x1a')]){if(_0x3c0695['result']['final']){logger['info'](_0x1703('0x1b'),JSON['stringify'](_0x3c0695[_0x1703('0x1a')][_0x1703('0x1c')]));_0x1cba9a=_0x3c0695[_0x1703('0x1a')]['hypotheses'][0x0]['transcript'];_0x3acf9c=_0x3c0695[_0x1703('0x1a')][_0x1703('0x1c')][0x0][_0x1703('0x1d')];_0x3dd60f='0';_0x5ded48=_0x1703('0x1e');_0x3117b5['terminate']();}}break;case 0x1:logger[_0x1703('0xd')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3dd60f='1';_0x5ded48=_0x1703('0x7');break;case 0x2:logger[_0x1703('0xd')](_0x1703('0x1f'));_0x3dd60f='2';_0x5ded48=_0x1703('0x1f');break;case 0x9:logger[_0x1703('0xd')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3dd60f='9';_0x5ded48='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x1703('0xd')](_0x1703('0x20'));_0x3dd60f='10';_0x5ded48=_0x1703('0x20');break;case 0xb:logger['info'](_0x1703('0x21'));_0x3dd60f='11';_0x5ded48=_0x1703('0x21');}}}catch(_0x2be6a7){logger[_0x1703('0x15')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x2be6a7));_0x3117b5[_0x1703('0x17')]();}}function _0xfb6eb1(){logger['info'](_0x1703('0x22'));_0x537084({'transcript':_0x1cba9a,'confidence':_0x3acf9c,'status':_0x3dd60f,'status_message':_0x5ded48});}function _0x420188(_0x2adee6){logger[_0x1703('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x2adee6)){logger['error'](_[_0x1703('0x23')](_0x2adee6)?JSON[_0x1703('0x11')](_0x2adee6):_0x2adee6);}}_0x3117b5['on'](_0x1703('0x24'),_0x2fa96c);_0x3117b5['on']('message',_0x77b9ea);_0x3117b5['on'](_0x1703('0x13'),_0xfb6eb1);_0x3117b5['on'](_0x1703('0x15'),_0x420188);});}; \ No newline at end of file +var _0x3f18=['message','close','bluebird','crypto','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','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','isNil','isObject','open'];(function(_0x9b7542,_0x26ab8f){var _0x5287e6=function(_0xcfb1a8){while(--_0xcfb1a8){_0x9b7542['push'](_0x9b7542['shift']());}};_0x5287e6(++_0x26ab8f);}(_0x3f18,0x9a));var _0x83f1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3f18[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x83f1('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x83f1('0x1'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x5b5158,_0x80ce75,_0x292a50,_0x24d85d){return new BPromise(function(_0xf32161,_0x2d8024){logger[_0x83f1('0x2')](_0x83f1('0x3'),_0x24d85d||_0x83f1('0x4'));var _0x20951f=new WebSocket(_0x24d85d||_0x83f1('0x4'),{'perMessageDeflate':![]});var _0x59cb25='';var _0x3da8dc='0';var _0x43ad73='1';var _0x2646f5='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x319b4b(_0x244e74){var _0x1ab90a=crypto[_0x83f1('0x5')]('sha1');_0x1ab90a[_0x83f1('0x6')](_0x244e74);return _0x1ab90a[_0x83f1('0x7')](_0x83f1('0x8'));}function _0x38dc31(){try{logger[_0x83f1('0x2')](_0x83f1('0x9'));var _0x110939=moment()[_0x83f1('0xa')]();var _0x476a6e=_0x319b4b(_0x110939+_0x80ce75+_0x292a50);_0x20951f['send'](JSON['stringify']({'appID':_0x80ce75,'timestamp':_0x110939,'appKey':_0x476a6e}));var _0x214c94=fs[_0x83f1('0xb')](_0x5b5158);_0x214c94['on'](_0x83f1('0xc'),function(_0x452ecd){_0x20951f['send'](_0x452ecd);});_0x214c94['on']('close',function(){_0x20951f['send'](_0x83f1('0xd'));});}catch(_0x407839){logger[_0x83f1('0xe')](_0x83f1('0xf'),JSON[_0x83f1('0x10')](_0x407839));_0x20951f[_0x83f1('0x11')]();}}function _0x283afc(_0x5dfd9b){try{if(_0x5dfd9b){var _0x5dac3c=JSON[_0x83f1('0x12')](_0x5dfd9b);switch(_0x5dac3c[_0x83f1('0x13')]){case 0x0:if(_0x5dac3c[_0x83f1('0x14')]){if(_0x5dac3c[_0x83f1('0x14')][_0x83f1('0x15')]){logger[_0x83f1('0x2')](_0x83f1('0x16'),JSON[_0x83f1('0x10')](_0x5dac3c['result'][_0x83f1('0x17')]));_0x59cb25=_0x5dac3c[_0x83f1('0x14')][_0x83f1('0x17')][0x0][_0x83f1('0x18')];_0x3da8dc=_0x5dac3c[_0x83f1('0x14')][_0x83f1('0x17')][0x0][_0x83f1('0x19')];_0x43ad73='0';_0x2646f5=_0x83f1('0x1a');_0x20951f['terminate']();}}break;case 0x1:logger['info'](_0x83f1('0x1b'));_0x43ad73='1';_0x2646f5=_0x83f1('0x1b');break;case 0x2:logger[_0x83f1('0x2')](_0x83f1('0x1c'));_0x43ad73='2';_0x2646f5=_0x83f1('0x1c');break;case 0x9:logger[_0x83f1('0x2')](_0x83f1('0x1d'));_0x43ad73='9';_0x2646f5=_0x83f1('0x1d');break;case 0xa:logger['info'](_0x83f1('0x1e'));_0x43ad73='10';_0x2646f5=_0x83f1('0x1e');break;case 0xb:logger[_0x83f1('0x2')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x43ad73='11';_0x2646f5=_0x83f1('0x1f');}}}catch(_0x5ed700){logger[_0x83f1('0xe')](_0x83f1('0x20'),JSON[_0x83f1('0x10')](_0x5ed700));_0x20951f['terminate']();}}function _0x350bb9(){logger[_0x83f1('0x2')]('Close\x20Tilde\x20ASR\x20socket');_0xf32161({'transcript':_0x59cb25,'confidence':_0x3da8dc,'status':_0x43ad73,'status_message':_0x2646f5});}function _0x4d4ebc(_0xa48457){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x83f1('0x21')](_0xa48457)){logger['error'](_[_0x83f1('0x22')](_0xa48457)?JSON[_0x83f1('0x10')](_0xa48457):_0xa48457);}}_0x20951f['on'](_0x83f1('0x23'),_0x38dc31);_0x20951f['on'](_0x83f1('0x24'),_0x283afc);_0x20951f['on'](_0x83f1('0x25'),_0x350bb9);_0x20951f['on'](_0x83f1('0xe'),_0x4d4ebc);});}; \ 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 d459e42..a4a0b76 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 _0x6140=['./asr'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x6140,0x125));var _0x0614=function(_0x5760c9,_0x3ad606){_0x5760c9=_0x5760c9-0x0;var _0x6da60c=_0x6140[_0x5760c9];return _0x6da60c;};var asr=require(_0x0614('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x75ff=['exports','./asr'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x75ff,0x131));var _0xf75f=function(_0x130c7d,_0x155870){_0x130c7d=_0x130c7d-0x0;var _0xaaa03e=_0x75ff[_0x130c7d];return _0xaaa03e;};var asr=require(_0xf75f('0x0'));module[_0xf75f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 31e2413..d0c58b4 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 _0xce9b=['listen','listening','connection','getConnections','emit','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xce9b,0xc6));var _0xbce9=function(_0x41be19,_0x4296ee){_0x41be19=_0x41be19-0x0;var _0x5a1d50=_0xce9b[_0x41be19];return _0x5a1d50;};'use strict';var util=require(_0xbce9('0x0'));var net=require(_0xbce9('0x1'));var EventEmitter=require(_0xbce9('0x2'))[_0xbce9('0x3')];var AGIError=require(_0xbce9('0x4'));var AGIChannel=require(_0xbce9('0x5'));var AGIServer=function(_0xa8a2e6,_0x306247,_0x54ef29){var _0x2461ee=this,_0xa8a2e6=_0xa8a2e6||0x11dd,_0x306247=_0x306247||_0xbce9('0x6'),_0x256ce6=null,_0x1c40fa=0x0;EventEmitter[_0xbce9('0x7')](_0x2461ee);function _0x562634(){if(!_0xa8a2e6){_0x2461ee['emit'](_0xbce9('0x8'),new AGIError(_0xbce9('0x9')));return![];}_0x256ce6=net['createServer']();_0x256ce6[_0xbce9('0xa')](_0xa8a2e6,_0x306247);_0x256ce6['on'](_0xbce9('0xb'),function(){_0x2461ee['emit']('listening');});_0x256ce6['on'](_0xbce9('0xc'),function(_0x347ef1){_0x256ce6[_0xbce9('0xd')](function(_0x4dc9a9,_0x48a272){if(_0x4dc9a9){_0x2461ee[_0xbce9('0xe')](_0xbce9('0x8'),new AGIError(_0xbce9('0xf'),_0x4dc9a9));}else if(_0x54ef29&&_0x54ef29<0x0){_0x2461ee[_0xbce9('0xe')](_0xbce9('0x8'),new AGIError(_0xbce9('0x10')));_0x347ef1[_0xbce9('0x11')]();}else if(_0x54ef29&&_0x54ef29>0x0&&_0x54ef29<_0x48a272){_0x1c40fa+=0x1;_0x2461ee[_0xbce9('0xe')](_0xbce9('0x8'),new AGIError(_0xbce9('0x12'),_0x1c40fa));_0x347ef1['destroy']();}else{var _0x4353ae=new AGIChannel(_0x347ef1);_0x4353ae['on'](_0xbce9('0x13'),function(){_0x2461ee[_0xbce9('0xe')](_0xbce9('0xc'),_0x4353ae);});}});});_0x256ce6['on'](_0xbce9('0x8'),function(_0x57d866){_0x2461ee[_0xbce9('0xe')](_0xbce9('0x8'),new AGIError(_0xbce9('0xf'),_0x57d866[_0xbce9('0x14')]));});_0x256ce6['on'](_0xbce9('0x15'),function(){_0x2461ee[_0xbce9('0xe')](_0xbce9('0x15'),new AGIError(_0xbce9('0x16')));});}process[_0xbce9('0x17')](function(){_0x562634();});};util[_0xbce9('0x18')](AGIServer,EventEmitter);module[_0xbce9('0x19')]=function(_0x2ec59b,_0x486107,_0x443c95){return new AGIServer(_0x2ec59b,_0x486107,_0x443c95);}; \ No newline at end of file +var _0xda65=['nextTick','exports','util','net','events','./error','./channel','call','error','createServer','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xda65,0x1d0));var _0x5da6=function(_0x329e27,_0x3c6a84){_0x329e27=_0x329e27-0x0;var _0x1c8f3f=_0xda65[_0x329e27];return _0x1c8f3f;};'use strict';var util=require(_0x5da6('0x0'));var net=require(_0x5da6('0x1'));var EventEmitter=require(_0x5da6('0x2'))['EventEmitter'];var AGIError=require(_0x5da6('0x3'));var AGIChannel=require(_0x5da6('0x4'));var AGIServer=function(_0xd35866,_0x487700,_0x5c80b4){var _0x73d407=this,_0xd35866=_0xd35866||0x11dd,_0x487700=_0x487700||'127.0.0.1',_0x32ff03=null,_0x75126f=0x0;EventEmitter[_0x5da6('0x5')](_0x73d407);function _0x4a7040(){if(!_0xd35866){_0x73d407['emit'](_0x5da6('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x32ff03=net[_0x5da6('0x7')]();_0x32ff03[_0x5da6('0x8')](_0xd35866,_0x487700);_0x32ff03['on'](_0x5da6('0x9'),function(){_0x73d407[_0x5da6('0xa')](_0x5da6('0x9'));});_0x32ff03['on'](_0x5da6('0xb'),function(_0x3c7cbc){_0x32ff03[_0x5da6('0xc')](function(_0x4bd1cc,_0x3dc340){if(_0x4bd1cc){_0x73d407[_0x5da6('0xa')](_0x5da6('0x6'),new AGIError(_0x5da6('0xd'),_0x4bd1cc));}else if(_0x5c80b4&&_0x5c80b4<0x0){_0x73d407[_0x5da6('0xa')](_0x5da6('0x6'),new AGIError(_0x5da6('0xe')));_0x3c7cbc[_0x5da6('0xf')]();}else if(_0x5c80b4&&_0x5c80b4>0x0&&_0x5c80b4<_0x3dc340){_0x75126f+=0x1;_0x73d407[_0x5da6('0xa')]('error',new AGIError(_0x5da6('0x10'),_0x75126f));_0x3c7cbc[_0x5da6('0xf')]();}else{var _0xdb1066=new AGIChannel(_0x3c7cbc);_0xdb1066['on'](_0x5da6('0x11'),function(){_0x73d407[_0x5da6('0xa')](_0x5da6('0xb'),_0xdb1066);});}});});_0x32ff03['on'](_0x5da6('0x6'),function(_0x1c28b7){_0x73d407[_0x5da6('0xa')](_0x5da6('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1c28b7['code']));});_0x32ff03['on'](_0x5da6('0x12'),function(){_0x73d407[_0x5da6('0xa')](_0x5da6('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x5da6('0x13')](function(){_0x4a7040();});};util['inherits'](AGIServer,EventEmitter);module[_0x5da6('0x14')]=function(_0x3dc7c4,_0x1cae6,_0x3c93e2){return new AGIServer(_0x3dc7c4,_0x1cae6,_0x3c93e2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e00d0e3..1047249 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 _0x491c=['isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','split','replaceAll','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','no\x20text\x20configured','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','list_id','no\x20list\x20selected','delay','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','NOBEEP','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','debug','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','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','exports','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','en-US','MALE','audioEncoding','MP3','googleTTS','text','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','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','uri','stringify','body','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x491c,0x151));var _0xc491=function(_0x483f8d,_0x45b9a0){_0x483f8d=_0x483f8d-0x0;var _0x2216a6=_0x491c[_0x483f8d];return _0x2216a6;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xc491('0x0'));var _=require(_0xc491('0x1'));var sh=require(_0xc491('0x2'));var odbc=require(_0xc491('0x3'))();var rs=require(_0xc491('0x4'));var moment=require(_0xc491('0x5'));var Mustache=require('mustache');var rp=require(_0xc491('0x6'));var logger=require(_0xc491('0x7'))('agi');var config=require(_0xc491('0x8'));var scripts=require(_0xc491('0x9'));var FILES_PATH=_0xc491('0xa');var recursiveMapAttributes=[_0xc491('0xb'),_0xc491('0xc')];var verticesWithRetry=[_0xc491('0xd'),_0xc491('0xe'),_0xc491('0xf')];var AGIVertices=function(_0x4675e3,_0x3f17ac,_0x3cd62d){this['channel']=_0x4675e3;this['rpc']=_0x3f17ac;this[_0xc491('0x10')]=_0x3cd62d;};AGIVertices[_0xc491('0x11')][_0xc491('0x12')]=function(_0x5b8348,_0x5c56e4){this[_0xc491('0x13')]['getVariableById'](_0x5b8348)[_0xc491('0x14')](function(_0x98214c){_0x5c56e4(null,_0x98214c?_0x98214c[_0xc491('0x15')]:![]);})['catch'](function(_0x18c2be){_0x5c56e4(_0x18c2be);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x164bd1,_0x1d4954){this['rpc'][_0xc491('0x16')](_0x164bd1)[_0xc491('0x14')](function(_0x2251c5){_0x1d4954(null,_0x2251c5?_0x2251c5[_0xc491('0x15')]:![]);})[_0xc491('0x17')](function(_0x4a3105){_0x1d4954(_0x4a3105);});};AGIVertices['prototype'][_0xc491('0x18')]=function(_0x4a158e,_0x24ce88){this[_0xc491('0x13')][_0xc491('0x19')](_0x4a158e)[_0xc491('0x14')](function(_0x393bc0){_0x24ce88(null,_0x393bc0?_0x393bc0[_0xc491('0x15')]:![]);})[_0xc491('0x17')](function(_0x30102b){_0x24ce88(_0x30102b);});};AGIVertices[_0xc491('0x11')][_0xc491('0x1a')]=function(_0x2aa461,_0x109ee0){this[_0xc491('0x13')][_0xc491('0x1b')](_0x2aa461)[_0xc491('0x14')](function(_0x4c20d6){_0x109ee0(null,_0x4c20d6?_0x4c20d6[_0xc491('0x1c')]:![]);})[_0xc491('0x17')](function(_0x310bbc){_0x109ee0(_0x310bbc);});};AGIVertices[_0xc491('0x11')][_0xc491('0x1d')]=function(_0x7cb99f,_0x3961ac){this[_0xc491('0x13')][_0xc491('0x1e')](_0x7cb99f)['then'](function(_0x130030){_0x3961ac(null,_0x130030?_0x130030[_0xc491('0x15')]:![]);})[_0xc491('0x17')](function(_0x5bb5c6){_0x3961ac(_0x5bb5c6);});};AGIVertices[_0xc491('0x11')][_0xc491('0x1f')]=function(_0x293cb1,_0x9805c1){this[_0xc491('0x13')][_0xc491('0x20')](_0x293cb1)[_0xc491('0x14')](function(_0x57f7a0){_0x9805c1(null,_0x57f7a0?_0x57f7a0[_0xc491('0x15')]:![]);})[_0xc491('0x17')](function(_0x52da97){_0x9805c1(_0x52da97);});};AGIVertices[_0xc491('0x11')][_0xc491('0x21')]=function(_0x12b9eb,_0x58ec1f){var _0x3ed70e=this;this['rpc']['getSoundById'](_0x12b9eb)[_0xc491('0x14')](function(_0x2509be){_0x58ec1f(null,_0x2509be?_0x3ed70e[_0xc491('0x22')](_0x2509be[_0xc491('0x23')]):![]);})[_0xc491('0x17')](function(_0x42f5bd){_0x58ec1f(_0x42f5bd);});};AGIVertices[_0xc491('0x11')][_0xc491('0x24')]=function(_0x4f2751,_0x25bd6f){this[_0xc491('0x13')][_0xc491('0x25')](_0x4f2751)[_0xc491('0x14')](function(_0x2865d4){_0x25bd6f(null,_0x2865d4?_0x2865d4:![]);})[_0xc491('0x17')](function(_0x1cf61d){_0x25bd6f(_0x1cf61d);});};AGIVertices[_0xc491('0x11')][_0xc491('0x26')]=function(_0x56c5ba,_0x44e6e0,_0x4bfaf3){this['mailRpc'][_0xc491('0x26')](_0x56c5ba,_0x44e6e0)[_0xc491('0x14')](function(){_0x4bfaf3(null);})['catch'](function(_0x3840d0){_0x4bfaf3(_0x3840d0);});};AGIVertices[_0xc491('0x11')][_0xc491('0x27')]=function(_0x20b207,_0x4e6fe6){this['rpc']['getIntervalById'](_0x20b207)['then'](function(_0x154f1e){if(_0x154f1e){if(_0x154f1e[_0xc491('0x28')]){_0x4e6fe6(null,[_0x154f1e['interval']]);}else{_0x4e6fe6(null,_['map'](_0x154f1e[_0xc491('0x29')],'interval'));}}else{_0x4e6fe6(null,![]);}})[_0xc491('0x17')](function(_0x4d95dc){_0x4e6fe6(_0x4d95dc);});};AGIVertices[_0xc491('0x11')][_0xc491('0x22')]=function(_0x3b4a5e){return util[_0xc491('0x2a')](_0xc491('0x2b'),FILES_PATH,_0x3b4a5e);};AGIVertices[_0xc491('0x11')]['getQueryOdbc']=function(_0xa91111,_0x2a0b6b,_0x3ef2be){odbc[_0xc491('0x2c')](_0xa91111,function(_0x584053){if(_0x584053){logger[_0xc491('0x2d')](_0xc491('0x2e'),_0x584053);_0x3ef2be(_0x584053);}else{logger[_0xc491('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x2a0b6b,function(_0x4e1231,_0x3f09e3){if(_0x4e1231){logger['info'](_0xc491('0x30'),_0x2a0b6b);_0x3ef2be(_0x4e1231);}else{logger[_0xc491('0x2f')](_0xc491('0x31'),_0x2a0b6b);odbc[_0xc491('0x32')](function(_0x30fa80){if(_0x30fa80){logger['error'](_0xc491('0x33'),_0x30fa80);}_0x3ef2be(null,_0x3f09e3);});}});}});};AGIVertices[_0xc491('0x11')][_0xc491('0x34')]=function(_0x3ec839,_0x52a75f){this[_0xc491('0x13')][_0xc491('0x35')](_0x3ec839)[_0xc491('0x14')](function(_0x31fd36){_0x52a75f(null,_0x31fd36?_0x31fd36:![]);})[_0xc491('0x17')](function(_0xdaf6e7){_0x52a75f(_0xdaf6e7);});};AGIVertices[_0xc491('0x11')][_0xc491('0x36')]=function(_0x2c880d,_0x364d25){this[_0xc491('0x13')][_0xc491('0x36')](_0x2c880d)[_0xc491('0x14')](function(_0x41bc10){_0x364d25(null,_0x41bc10);})[_0xc491('0x17')](function(_0x8ad94c){_0x364d25(_0x8ad94c);});};AGIVertices[_0xc491('0x11')][_0xc491('0x37')]=function(_0x31108b,_0x3bc8d6,_0x1891ad){this['rpc'][_0xc491('0x37')]({'uniqueid':this[_0xc491('0x38')][_0xc491('0x39')],'node':_0x31108b[_0xc491('0x3a')],'application':_0x31108b[_0xc491('0x3b')],'data':_0x3bc8d6||null,'project_name':this[_0xc491('0x38')]['arg_1'],'callerid':this['channel'][_0xc491('0x3c')]})[_0xc491('0x14')](function(_0x257f6e){if(_0x1891ad){_0x1891ad(null,_0x257f6e);}})['catch'](function(_0x22de3f){if(_0x1891ad){_0x1891ad(_0x22de3f);}});};AGIVertices[_0xc491('0x11')][_0xc491('0x3d')]=function(_0x321c1d,_0x2d5e58,_0x178a72,_0x3d4106){this[_0xc491('0x13')]['createSquareRecording']({'uniqueid':this[_0xc491('0x38')][_0xc491('0x39')],'callerid':this[_0xc491('0x38')][_0xc491('0x3c')],'calleridname':this[_0xc491('0x38')][_0xc491('0x3e')],'context':this[_0xc491('0x38')][_0xc491('0x3f')],'extension':this[_0xc491('0x38')][_0xc491('0x40')],'priority':this[_0xc491('0x38')][_0xc491('0x41')],'accountcode':this['channel'][_0xc491('0x42')],'dnid':this[_0xc491('0x38')][_0xc491('0x43')],'projectName':this[_0xc491('0x38')]['arg_1'],'saveName':_0x2d5e58,'filename':_0x321c1d['file']||_0x2d5e58,'savePath':_0x178a72})[_0xc491('0x14')](function(_0x25b17d){_0x3d4106(null,_0x25b17d);})[_0xc491('0x17')](function(_0x608b4b){_0x3d4106(_0x608b4b);});};AGIVertices[_0xc491('0x11')][_0xc491('0x44')]=function(_0x50845c,_0x3f96e4,_0x21b65c,_0x17d7aa,_0x2665c4){this[_0xc491('0x13')][_0xc491('0x44')]({'uniqueid':this['channel']['uniqueid'],'body':_0x50845c,'direction':_0x3f96e4,'providerName':_0x21b65c,'providerResponse':_0x17d7aa})[_0xc491('0x14')](function(_0x16d7f0){if(_0x2665c4){_0x2665c4(null,_0x16d7f0);}})[_0xc491('0x17')](function(_0x4568b1){if(_0x2665c4){_0x2665c4(_0x4568b1);}});};AGIVertices[_0xc491('0x11')][_0xc491('0x45')]=function(_0x3f859a,_0x5cdbb1){this[_0xc491('0x13')][_0xc491('0x45')]({'firstName':_[_0xc491('0x46')](_0x3f859a['name'])||_[_0xc491('0x47')](_0x3f859a['name'])?_0xc491('0x48')+Math[_0xc491('0x49')]():_0x3f859a[_0xc491('0x15')],'lastName':_[_0xc491('0x46')](_0x3f859a['lastName'])||_['isNil'](_0x3f859a[_0xc491('0x4a')])?null:_0x3f859a[_0xc491('0x4a')],'phone':_0x3f859a[_0xc491('0x4b')],'ListId':_0x3f859a['list_id'],'scheduledat':_0x3f859a[_0xc491('0x4c')],'callbackUniqueid':this[_0xc491('0x38')][_0xc491('0x39')],'tags':'callback','description':_0xc491('0x4d')+_0x3f859a[_0xc491('0x4c')][_0xc491('0x4e')](),'priority':_0x3f859a[_0xc491('0x4f')]})[_0xc491('0x14')](function(_0x12c1c3){_0x5cdbb1(null,_0x12c1c3);})[_0xc491('0x17')](function(_0xe4b72b){_0x5cdbb1(_0xe4b72b);});};AGIVertices[_0xc491('0x11')][_0xc491('0x50')]=function(_0x5c07a5,_0x3cbc2e){this[_0xc491('0x13')]['getPauseById'](_0x5c07a5)[_0xc491('0x14')](function(_0x44f623){_0x3cbc2e(null,_0x44f623?_0x44f623['name']:![]);})['catch'](function(_0x37dc6a){_0x3cbc2e(_0x37dc6a);});};AGIVertices[_0xc491('0x11')][_0xc491('0x51')]=function(_0x7c2ed2,_0x4ee0a0,_0xe285e9){var _0x164526={'role':_0xc491('0x52')};_0x164526[_0x7c2ed2]=this[_0xc491('0x38')][_0xc491('0x3c')];this['rpc'][_0xc491('0x51')](_0x164526,_0x4ee0a0,this[_0xc491('0x38')][_0xc491('0x39')])[_0xc491('0x14')](function(_0x2f773f){_0xe285e9(null,_[_0xc491('0x47')](_0x2f773f)?![]:!![]);})[_0xc491('0x17')](function(_0x436279){logger[_0xc491('0x2d')](_0x436279);_0xe285e9(null,![]);});};AGIVertices[_0xc491('0x11')][_0xc491('0x53')]=function(_0x586e3b,_0x205702){var _0x389b5c={'role':_0xc491('0x52')};_0x389b5c[_0x586e3b]=this[_0xc491('0x38')][_0xc491('0x3c')];this[_0xc491('0x13')][_0xc491('0x53')](_0x389b5c)['then'](function(_0xdf2924){_0x205702(null,_[_0xc491('0x47')](_0xdf2924)?![]:!![]);})[_0xc491('0x17')](function(_0x475a26){logger[_0xc491('0x2d')](_0x475a26);_0x205702(null,![]);});};AGIVertices['prototype'][_0xc491('0x54')]=function(_0x4822d9,_0x450ffe){var _0x1c6409={'role':_0xc491('0x52')};_0x1c6409[_0x4822d9]=this[_0xc491('0x38')][_0xc491('0x3c')];this[_0xc491('0x13')][_0xc491('0x54')](_0x1c6409)[_0xc491('0x14')](function(_0x57c255){_0x450ffe(null,_[_0xc491('0x47')](_0x57c255)?![]:!![]);})[_0xc491('0x17')](function(_0x4c6f5a){logger[_0xc491('0x2d')](_0x4c6f5a);_0x450ffe(null,![]);});};AGIVertices[_0xc491('0x11')][_0xc491('0x55')]=function(_0x1382c3,_0x32384d){var _0x82a603={'role':_0xc491('0x52')};_0x82a603[_0x1382c3]=this[_0xc491('0x38')][_0xc491('0x3c')];var _0x17f28a=_0x1382c3!=_0xc491('0x56')?util[_0xc491('0x2a')](_0xc491('0x57'),_0xc491('0x58'),this[_0xc491('0x38')]['callerid']):undefined;this[_0xc491('0x13')][_0xc491('0x55')](_0x82a603,_0x17f28a)['then'](function(_0x123ac7){_0x32384d(null,_['isNil'](_0x123ac7)?![]:!![]);})[_0xc491('0x17')](function(_0x327dd5){logger[_0xc491('0x2d')](_0x327dd5);_0x32384d(null,![]);});};AGIVertices['prototype'][_0xc491('0x59')]=function(_0x43f720,_0x1eb0bd){sh[_0xc491('0x5a')](_[_0xc491('0x5b')](_0x43f720),function(_0x4367e8,_0x39e3cd){var _0x4082b6=_0x39e3cd['replace'](/(\r\n|\n|\r)/gm,'');_0x1eb0bd(null,_0x4082b6);});};AGIVertices[_0xc491('0x11')][_0xc491('0x5c')]=function(_0x278147,_0x6ef007){scripts['googleCloudTTS'](_0x278147['apiKey'],_0x278147['google_cloud_tts_text_type']||'text',_0x278147['text'],_0x278147['languageCode']||_0xc491('0x5d'),_0x278147['ssmlGender']||_0xc491('0x5e'),_0x278147[_0xc491('0x5f')]||_0xc491('0x60'))[_0xc491('0x14')](function(_0x507bb5){_0x6ef007(null,_0x507bb5);})[_0xc491('0x17')](function(_0x44fd94){_0x6ef007(_0x44fd94);});};AGIVertices[_0xc491('0x11')][_0xc491('0x61')]=function(_0x50a202,_0x4b578b){scripts['googleTTS'](_0x50a202[_0xc491('0x62')],_0x50a202['google_tts_language']||'en',0x1)[_0xc491('0x14')](function(_0x46f05b){_0x4b578b(null,_0x46f05b);})[_0xc491('0x17')](function(_0xdb95f4){_0x4b578b(_0xdb95f4);});};AGIVertices[_0xc491('0x11')][_0xc491('0x63')]=function(_0x2396a5,_0x574a7e){var _0x1bdf02={'uri':_0x2396a5[_0xc491('0x64')],'method':_0x2396a5[_0xc491('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2396a5[_0xc491('0x66')])==='number'&&parseInt(_0x2396a5['timeout'])>=0x1?parseInt(_0x2396a5[_0xc491('0x66')])*0x3e8:0x5*0x3e8};if(_[_0xc491('0x67')]([_0xc491('0x68'),_0xc491('0x69')],_0x1bdf02['method'][_0xc491('0x6a')]())){try{_0x1bdf02['body']=_0x2396a5[_0xc491('0xc')]?JSON[_0xc491('0x6b')](_0x2396a5[_0xc491('0xc')]):{};}catch(_0x19a2e8){logger['error'](_0xc491('0x6c'),_0x19a2e8);}}try{_0x1bdf02[_0xc491('0x6d')]=_0x2396a5[_0xc491('0xb')]?JSON['parse'](_0x2396a5['rawHeaders']):{};}catch(_0x39b520){logger[_0xc491('0x2d')](_0xc491('0x6e'),_0x39b520);}if(_0x2396a5[_0xc491('0x6f')]){try{var _0x6b3103=require(_0x2396a5[_0xc491('0x6f')])[_0xc491('0x70')](this,_0x1bdf02);_0x1bdf02[_0xc491('0x71')]=Mustache['render'](_0x2396a5[_0xc491('0x64')],_0x6b3103,{},['$$','$$']);if(_0x1bdf02[_0xc491('0x6d')]){_0x1bdf02[_0xc491('0x6d')]=JSON[_0xc491('0x6b')](Mustache['render'](JSON[_0xc491('0x72')](_0x1bdf02[_0xc491('0x6d')]),_0x6b3103,{},['$$','$$']));}if(_0x1bdf02[_0xc491('0x73')]){_0x1bdf02[_0xc491('0x73')]=JSON[_0xc491('0x6b')](Mustache[_0xc491('0x74')](JSON['stringify'](_0x1bdf02[_0xc491('0x73')]),_0x6b3103,{},['$$','$$']));}}catch(_0xb1b268){logger[_0xc491('0x2d')](_0xc491('0x75'),_0xb1b268);}}rp(_0x1bdf02)['then'](function(_0x5f26e0){var _0x4879d8={'statusCode':_0x5f26e0[_0xc491('0x76')]||0xc8,'statusMessage':_0x5f26e0[_0xc491('0x77')]||'OK','headers':_0x5f26e0['headers']||{},'body':_0x5f26e0[_0xc491('0x73')]||{}};_0x574a7e(null,_0x4879d8);})[_0xc491('0x17')](function(_0x3c0122){var _0x61f58f={'statusCode':_0x3c0122[_0xc491('0x76')]||0x1f4,'statusMessage':_0x3c0122[_0xc491('0x78')]||_0xc491('0x79'),'headers':_0x3c0122[_0xc491('0x7a')][_0xc491('0x6d')]||{},'body':_0x3c0122[_0xc491('0x7a')][_0xc491('0x73')]||{}};_0x574a7e(null,_0x61f58f);});};AGIVertices[_0xc491('0x11')][_0xc491('0x7b')]=function(_0x4a806a,_0x906443){scripts[_0xc491('0x7b')](this['channel'][_0xc491('0x39')],_0x4a806a[_0xc491('0x7c')],_0x4a806a[_0xc491('0x62')],_0x4a806a[_0xc491('0x7d')]||'en')['then'](function(_0xdb2320){_0x906443(null,_0xdb2320);})[_0xc491('0x17')](function(_0x1ef305){_0x906443(_0x1ef305);});};AGIVertices['prototype'][_0xc491('0x7e')]=function(_0xca1546,_0x4470a0){scripts[_0xc491('0x7e')](this[_0xc491('0x38')]['uniqueid'],_0xca1546[_0xc491('0x7f')],_0xca1546['client_email'],_0xca1546[_0xc491('0x80')],_0xca1546[_0xc491('0x62')],_0xca1546[_0xc491('0x81')]||'en')[_0xc491('0x14')](function(_0x26f73b){_0x4470a0(null,_0x26f73b);})[_0xc491('0x17')](function(_0x28c963){_0x4470a0(_0x28c963);});};AGIVertices['prototype'][_0xc491('0x82')]=function(_0x269cae,_0x4dbd8d){scripts[_0xc491('0x82')](this[_0xc491('0x38')],_0x269cae)[_0xc491('0x14')](function(_0x3a175a){_0x4dbd8d(null,_0x3a175a);})[_0xc491('0x17')](function(_0x35bbd1){_0x4dbd8d(_0x35bbd1);});};AGIVertices['prototype'][_0xc491('0x83')]=function(_0x2a690c,_0x57a24c){scripts['ispeechTTS'](_0x2a690c[_0xc491('0x7c')],_0x2a690c['text'],_0x2a690c['ispeech_tts_language']||_0xc491('0x5d'),_0x2a690c[_0xc491('0x84')])[_0xc491('0x14')](function(_0x4534cb){_0x57a24c(null,_0x4534cb);})['catch'](function(_0x1399a6){_0x57a24c(_0x1399a6);});};AGIVertices[_0xc491('0x11')][_0xc491('0x85')]=function(_0xf56cc2,_0x3f4444,_0x591bf4){scripts[_0xc491('0x85')](_0x3f4444,_0xf56cc2[_0xc491('0x7c')],_0xf56cc2[_0xc491('0x86')]||'en-US',this[_0xc491('0x87')](_0xf56cc2[_0xc491('0x88')])?_0xf56cc2[_0xc491('0x88')]:undefined)[_0xc491('0x14')](function(_0x5da5b5){_0x591bf4(null,_0x5da5b5);})[_0xc491('0x17')](function(_0x18fec5){_0x591bf4(_0x18fec5);});};AGIVertices[_0xc491('0x11')][_0xc491('0x89')]=function(_0x38cf1f,_0x2d17fd){scripts[_0xc491('0x89')](_0x38cf1f[_0xc491('0x8a')],_0x38cf1f[_0xc491('0x8b')],_0x38cf1f[_0xc491('0x8c')],_0x38cf1f[_0xc491('0x8d')]||_0xc491('0x8e'),_0x38cf1f[_0xc491('0x62')],_0x38cf1f[_0xc491('0x8f')]||'text')[_0xc491('0x14')](function(_0x36b27b){_0x2d17fd(null,_0x36b27b);})[_0xc491('0x17')](function(_0xfce9e8){_0x2d17fd(_0xfce9e8);});};AGIVertices[_0xc491('0x11')][_0xc491('0x90')]=function(_0x5b383c,_0x5713dc){scripts[_0xc491('0x90')](this[_0xc491('0x38')][_0xc491('0x39')],_0x5b383c[_0xc491('0x8a')],_0x5b383c['aws_secret_access_key'],_0x5b383c[_0xc491('0x91')],_0x5b383c[_0xc491('0x62')],_0x5b383c['aws_bot_name'])[_0xc491('0x14')](function(_0x3aa23f){_0x5713dc(null,_0x3aa23f);})[_0xc491('0x17')](function(_0x53adee){_0x5713dc(_0x53adee);});};AGIVertices[_0xc491('0x11')][_0xc491('0x92')]=function(_0x45238a,_0x42e327,_0x56ec8f){scripts[_0xc491('0x92')](_0x42e327,_0x45238a[_0xc491('0x7c')],_0x45238a['google_asr_language']||'en-US')[_0xc491('0x14')](function(_0x3f5b0f){_0x56ec8f(null,_0x3f5b0f);})['catch'](function(_0x57b203){_0x56ec8f(_0x57b203);});};AGIVertices['prototype']['tildeASR']=function(_0xa07b42,_0x2e80d6,_0x9664ca){scripts[_0xc491('0x93')](_0x2e80d6,_0xa07b42['appid'],_0xa07b42[_0xc491('0x94')],_0xa07b42['uri'])[_0xc491('0x14')](function(_0x1af0c1){_0x9664ca(null,_0x1af0c1);})[_0xc491('0x17')](function(_0x475805){_0x9664ca(_0x475805);});};AGIVertices[_0xc491('0x11')]['clear']=function(_0x1c367f){var _0x3b921d=_[_0xc491('0x67')](verticesWithRetry,_0x1c367f['agicommand'])?_0x1c367f:_[_0xc491('0x95')](_0x1c367f);for(var _0x2a58ff in _0x3b921d){if(_0x3b921d[_0xc491('0x96')](_0x2a58ff)){if(_0x3b921d[_0x2a58ff]&&_[_0xc491('0x97')](_0x3b921d[_0x2a58ff])){if(_[_0xc491('0x67')](recursiveMapAttributes,_0x2a58ff)){_0x3b921d[_0x2a58ff]=this[_0xc491('0x98')](_0x3b921d[_0x2a58ff]);}else{_0x3b921d[_0x2a58ff]=this[_0xc491('0x99')](_0x3b921d[_0x2a58ff]);}}}}return _0x3b921d;};AGIVertices[_0xc491('0x11')][_0xc491('0x9a')]=function(_0x304d67){for(var _0xa2fafe in _0x304d67){if(_0x304d67[_0xc491('0x96')](_0xa2fafe)){if(_[_0xc491('0x9b')](_0x304d67[_0xa2fafe])){this[_0xc491('0x9a')](_0x304d67[_0xa2fafe]);}else if(_['isArray'](_0x304d67[_0xa2fafe])){for(var _0x2b91af=0x0;_0x2b91af<_0x304d67[_0xa2fafe][_0xc491('0x9c')];_0x2b91af++){this[_0xc491('0x9a')](_0x304d67[_0xa2fafe][_0x2b91af]);}}else if(_[_0xc491('0x97')](_0x304d67[_0xa2fafe])){_0x304d67[_0xa2fafe]=this[_0xc491('0x99')](_0x304d67[_0xa2fafe]);}}}};AGIVertices[_0xc491('0x11')][_0xc491('0x9d')]=function(_0x5badc9,_0x18202f){for(var _0x983232 in _0x5badc9){if(_0x5badc9['hasOwnProperty'](_0x983232)){if(_[_0xc491('0x9b')](_0x5badc9[_0x983232])){if(!_['isEmpty'](_0x5badc9[_0x983232])){this[_0xc491('0x9d')](_0x5badc9[_0x983232],util[_0xc491('0x2a')](_0xc491('0x9e'),_0x18202f,_0x983232));}}else if(_[_0xc491('0x9f')](_0x5badc9[_0x983232])){for(var _0x425f8e=0x0;_0x425f8e<_0x5badc9[_0x983232][_0xc491('0x9c')];_0x425f8e++){this[_0xc491('0x9d')](_0x5badc9[_0x983232][_0x425f8e],util[_0xc491('0x2a')](_0xc491('0x9e'),_0x18202f,_0x983232+'['+_0x425f8e+']'));}}else{if(!_[_0xc491('0x47')](_0x5badc9[_0x983232])){this[_0xc491('0x38')]['setVariable'](util[_0xc491('0x2a')]('%s.%s',_0x18202f,_0x983232),_0x5badc9[_0x983232]);}}}}};AGIVertices[_0xc491('0x11')][_0xc491('0x98')]=function(_0x2e4a31){try{var _0xe1741c=JSON[_0xc491('0x6b')](_0x2e4a31);this[_0xc491('0x9a')](_0xe1741c);return JSON['stringify'](_0xe1741c);}catch(_0x408fe0){return this[_0xc491('0x99')](_0x2e4a31);}};AGIVertices[_0xc491('0x11')][_0xc491('0x99')]=function(_0xe413e2){var _0x22bcc3=_0xe413e2[_0xc491('0xa0')]('{');for(var _0x58a15d=0x1;_0x58a15d<_0x22bcc3[_0xc491('0x9c')];_0x58a15d+=0x1){var _0x3cbe8a=_0x22bcc3[_0x58a15d][_0xc491('0xa0')]('}');if(_0x3cbe8a[_0xc491('0x9c')]>0x1){_0xe413e2=_0xe413e2[_0xc491('0xa1')]('{'+_0x3cbe8a[0x0]+'}',this[_0xc491('0x38')][_0xc491('0x12')](_0x3cbe8a[0x0])[_0xc491('0xa2')]||_0x3cbe8a[0x0]);}}if(_0x22bcc3[_0xc491('0x9c')]===0x1){return _0xe413e2['toString']();}return this['replaceAllVariables'](_0xe413e2);};AGIVertices['prototype']['getAndSetVariable']=function(_0x490b71,_0x1e2295){var _0x1dda85=this[_0xc491('0x38')][_0xc491('0x12')](_0x490b71);if(_0x1dda85['result']===-0x1){return _0x1dda85;}logger['info'](util[_0xc491('0x2a')](_0xc491('0xa3'),_0x1e2295,_0x1dda85['extra']));return this[_0xc491('0x38')]['setVariable'](_0x1e2295,_0x1dda85[_0xc491('0xa2')]);};AGIVertices[_0xc491('0x11')][_0xc491('0x87')]=function(_0x424d23){return _0x424d23&&_0x424d23!=='0'&&_0x424d23!=='-1'&&_0x424d23!=='';};AGIVertices[_0xc491('0x11')]['maxRetry']=function(_0x45d4eb){this[_0xc491('0x37')][_0xc491('0x70')](this,_0x45d4eb,'-');_0x45d4eb['retry']=_0x45d4eb[_0xc491('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc491('0x11')]['mrcpsynth']=function(_0xbddb73){logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xbddb73[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0xbddb73[_0xc491('0x62')])){return this[_0xc491('0x38')]['noop'](_0xc491('0xa5'));}var _0x39140b='\x22'+_0xbddb73[_0xc491('0x62')]+'\x22';if(this[_0xc491('0x87')](_0xbddb73[_0xc491('0x7a')])){_0x39140b+=','+_0xbddb73[_0xc491('0x7a')];}var _0x510ef8=this[_0xc491('0x38')][_0xc491('0x5a')]('MRCPSynth',_0x39140b);if(_0x510ef8['result']===-0x1){return _0x510ef8;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xa7'),_0x39140b));};AGIVertices['prototype']['mrcprecog']=function(_0x3464be){logger['info'](util[_0xc491('0x2a')](_0xc491('0xa8'),_0x3464be['label']));if(!this['isConfigured'](_0x3464be[_0xc491('0xa9')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xaa'));}var _0x2c53c8=_0x3464be[_0xc491('0xa9')];if(this[_0xc491('0x87')](_0x3464be[_0xc491('0x7a')])){_0x2c53c8+=','+_0x3464be[_0xc491('0x7a')];}var _0x3cbc58=this[_0xc491('0x38')][_0xc491('0x5a')](_0xc491('0xab'),_0x2c53c8);if(_0x3cbc58[_0xc491('0xac')]===-0x1){return _0x3cbc58;}var _0x4b5151=this[_0xc491('0xad')](_0xc491('0xae'),'MRCP_RECOG_CONFIDENCE');if(_0x4b5151[_0xc491('0xac')]===-0x1){return _0x4b5151;}var _0xf24929=this[_0xc491('0xad')]('RECOG_INPUT()',_0xc491('0xaf'));if(_0xf24929['result']===-0x1){return _0xf24929;}var _0x18854c=this[_0xc491('0xad')](_0xc491('0xb0'),_0xc491('0xb1'));if(_0x18854c[_0xc491('0xac')]===-0x1){return _0x18854c;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xb2'),_0x2c53c8));};AGIVertices[_0xc491('0x11')]['agi']=function(_0x6b63f0){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xb3'),_0x6b63f0[_0xc491('0x3a')]));return this[_0xc491('0x38')][_0xc491('0xb4')]([_0x6b63f0[_0xc491('0xb5')],_0x6b63f0[_0xc491('0xb6')]]);};AGIVertices[_0xc491('0x11')][_0xc491('0xb7')]=function(_0x298d95){logger[_0xc491('0x2f')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x298d95[_0xc491('0x3a')]));if(this[_0xc491('0x87')](_0x298d95[_0xc491('0x66')])){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xb8'),_0x298d95[_0xc491('0x66')]));var _0xcdb1f4=this['channel'][_0xc491('0xb9')](_0x298d95[_0xc491('0x66')]);if(_0xcdb1f4['result']===-0x1){return _0xcdb1f4;}}return this[_0xc491('0x38')][_0xc491('0xb7')]();};AGIVertices[_0xc491('0x11')][_0xc491('0xba')]=function(_0x3fba20){logger['info'](util[_0xc491('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3fba20[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x3fba20[_0xc491('0xbb')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x3fba20,_0xc491('0xbc'));}_0x3fba20[_0xc491('0x4c')]=moment();if(this[_0xc491('0x87')](_0x3fba20[_0xc491('0xbd')])){_0x3fba20['scheduledAt']=moment()[_0xc491('0xbe')](_0x3fba20[_0xc491('0xbd')],'minutes');}if(!this['isConfigured'](_0x3fba20['callback_priority'])){_0x3fba20['callback_priority']=0x2;}this[_0xc491('0x45')][_0xc491('0x70')](this,_0x3fba20);return this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3fba20[_0xc491('0x4b')],_0x3fba20[_0xc491('0xbb')],_0x3fba20[_0xc491('0x4c')]));};AGIVertices[_0xc491('0x11')][_0xc491('0xbf')]=function(_0x13dfe0){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xc0'),_0x13dfe0[_0xc491('0x3a')]));var _0x1f4941=this['channel'][_0xc491('0x5a')](_0x13dfe0[_0xc491('0xc1')],_0x13dfe0['options']);if(_0x1f4941[_0xc491('0xac')]===-0x1){return _0x1f4941;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xc2'),_0x13dfe0[_0xc491('0xc1')],_0x13dfe0[_0xc491('0x7a')]));};AGIVertices['prototype'][_0xc491('0xc3')]=function(_0x253f6a){logger[_0xc491('0x2f')](util['format'](_0xc491('0xc4'),_0x253f6a[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x253f6a[_0xc491('0x62')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xa5'));}var _0xe584b3='\x22'+_0x253f6a['text']+'\x22';if(this[_0xc491('0x87')](_0x253f6a[_0xc491('0x7a')])){_0xe584b3+=','+_0x253f6a[_0xc491('0x7a')];}var _0x57f744=this[_0xc491('0x38')][_0xc491('0x5a')](_0xc491('0xc5'),_0xe584b3);if(_0x57f744[_0xc491('0xac')]===-0x1){return _0x57f744;}return this[_0xc491('0x38')]['noop'](util['format'](_0xc491('0xa7'),_0xe584b3));};AGIVertices[_0xc491('0x11')][_0xc491('0xc6')]=function(_0x2ec16f){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xc7'),_0x2ec16f[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x2ec16f[_0xc491('0x62')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xa5'));}var _0x2e4391='\x22'+_0x2ec16f[_0xc491('0x62')]+'\x22';if(this[_0xc491('0x87')](_0x2ec16f[_0xc491('0x7a')])){_0x2e4391+=','+_0x2ec16f[_0xc491('0x7a')];}var _0x2605a1=this['channel'][_0xc491('0x5a')]('MRCPSynth',_0x2e4391);if(_0x2605a1[_0xc491('0xac')]===-0x1){return _0x2605a1;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xa7'),_0x2e4391));};AGIVertices[_0xc491('0x11')][_0xc491('0xc8')]=function(_0x2869c2){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xc9'),_0x2869c2[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x2869c2[_0xc491('0xa9')])){return this['channel'][_0xc491('0xa6')](_0xc491('0xaa'));}var _0x2d0e96=_0x2869c2[_0xc491('0xa9')];if(this[_0xc491('0x87')](_0x2869c2['options'])){_0x2d0e96+=','+_0x2869c2['options'];}var _0x49f6de=this[_0xc491('0x38')][_0xc491('0x5a')](_0xc491('0xab'),_0x2d0e96);if(_0x49f6de[_0xc491('0xac')]===-0x1){return _0x49f6de;}var _0x16acda=this[_0xc491('0xad')](_0xc491('0xae'),_0xc491('0xca'));if(_0x16acda[_0xc491('0xac')]===-0x1){return _0x16acda;}var _0x2e33fd=this['getAndSetVariable'](_0xc491('0xcb'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2e33fd[_0xc491('0xac')]===-0x1){return _0x2e33fd;}var _0x3ad018=this[_0xc491('0xad')](_0xc491('0xb0'),_0xc491('0xcc'));if(_0x3ad018[_0xc491('0xac')]===-0x1){return _0x3ad018;}return this[_0xc491('0x38')]['noop'](util[_0xc491('0x2a')](_0xc491('0xb2'),_0x2d0e96));};AGIVertices['prototype'][_0xc491('0xcd')]=function(_0x52c758){logger[_0xc491('0x2f')](util['format'](_0xc491('0xce'),_0x52c758[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x52c758[_0xc491('0xa9')])){return this[_0xc491('0x38')]['noop']('no\x20grammar\x20configured');}var _0x5a3cb3=_0x52c758[_0xc491('0xa9')];if(this[_0xc491('0x87')](_0x52c758[_0xc491('0x7a')])){_0x5a3cb3+=','+_0x52c758['options'];}var _0x425b7a=this['channel'][_0xc491('0x5a')]('MRCPRecog',_0x5a3cb3);if(_0x425b7a[_0xc491('0xac')]===-0x1){return _0x425b7a;}var _0x5e5ff0=this[_0xc491('0xad')](_0xc491('0xae'),_0xc491('0xcf'));if(_0x5e5ff0['result']===-0x1){return _0x5e5ff0;}var _0x1f775d=this[_0xc491('0xad')]('RECOG_INPUT()',_0xc491('0xd0'));if(_0x1f775d['result']===-0x1){return _0x1f775d;}var _0x50496a=this[_0xc491('0xad')](_0xc491('0xb0'),_0xc491('0xd1'));if(_0x50496a['result']===-0x1){return _0x50496a;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5a3cb3));};AGIVertices[_0xc491('0x11')][_0xc491('0xd2')]=function(_0x273d37){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xd3'),_0x273d37[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x273d37[_0xc491('0xd4')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x273d37,_0xc491('0xd5'));}var _0x862e2a=this['getSquareOdbc'][_0xc491('0x70')](this,_0x273d37['odbc_id']);if(!_0x862e2a){return this['channel'][_0xc491('0x2d')](_0x273d37,_0xc491('0xd6'));}if(!this['isConfigured'](_0x273d37[_0xc491('0xd7')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x273d37,_0xc491('0xd8'));}var _0xd75dae=_0x273d37[_0xc491('0xd7')][_0xc491('0xd9')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xc491('0xa6')](util['format'](_0xc491('0xda'),_0xd75dae));var _0x156efe=this[_0xc491('0xdb')][_0xc491('0x70')](this,_0x862e2a,_0xd75dae);this['createSquareDetailsReport'][_0xc491('0x70')](this,_0x273d37,_0xd75dae);if(!this['isConfigured'](_0x273d37['variable_id'])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x217cf9=this[_0xc491('0x12')][_0xc491('0x70')](this,_0x273d37[_0xc491('0xdc')]);if(!_0x217cf9){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x273d37,'no\x20variable\x20found');}var _0x5aff1a=this;_0x156efe[_0xc491('0xdd')](function(_0x58f8ef,_0x272aff){Object[_0xc491('0xde')](_0x58f8ef)['forEach'](function(_0x412155){_0x5aff1a[_0xc491('0x38')][_0xc491('0xdf')](util['format'](_0xc491('0xe0'),_0x217cf9,_0x272aff,_0x412155),_0x58f8ef[_0x412155]);});});this[_0xc491('0x38')][_0xc491('0xdf')](util['format'](_0xc491('0xe1'),_0x217cf9),_0x156efe[_0xc491('0x9c')]);return this[_0xc491('0x38')]['noop'](util['format']('variable\x20%s\x20set',_0x217cf9));};AGIVertices[_0xc491('0x11')][_0xc491('0xe2')]=function(_0x5e8d7d){logger['debug'](util[_0xc491('0x2a')](_0xc491('0xe3'),_0x5e8d7d[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x5e8d7d['sip_id'])){return this['channel'][_0xc491('0x2d')](_0x5e8d7d,_0xc491('0xe4'));}var _0x53e89f=this[_0xc491('0x1d')][_0xc491('0x70')](this,_0x5e8d7d[_0xc491('0xe5')]);if(!_0x53e89f){return this[_0xc491('0x38')]['error'](_0x5e8d7d,'no\x20user\x20found');}var _0x1b48a3=this[_0xc491('0x38')]['exec'](_0xc491('0xe6'),[util[_0xc491('0x2a')]('SIP/%s',_0x53e89f),_0x5e8d7d[_0xc491('0x66')],_0x5e8d7d[_0xc491('0xe7')],_0x5e8d7d['url']]);if(_0x1b48a3[_0xc491('0xac')]===-0x1){return _0x1b48a3;}return this[_0xc491('0x38')]['noop'](util['format'](_0xc491('0xe8'),_0xc491('0xe6')));};AGIVertices['prototype'][_0xc491('0xe9')]=function(_0x2b233a){logger[_0xc491('0x2f')](util['format'](_0xc491('0xea'),_0x2b233a[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x2b233a[_0xc491('0x7c')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xeb'));}if(!this['isConfigured'](_0x2b233a[_0xc491('0x62')])){return this['channel'][_0xc491('0xa6')](_0xc491('0xa5'));}this[_0xc491('0x38')]['bot']=!![];this[_0xc491('0x37')](_0x2b233a);this[_0xc491('0x44')](_0x2b233a[_0xc491('0x62')],'in','','');this[_0xc491('0x38')][_0xc491('0xa6')](util['format'](_0xc491('0xec'),_0x2b233a[_0xc491('0x62')]));var _0x294caa=this['googleDialogflow'][_0xc491('0x70')](this,_0x2b233a);if(_0x294caa){for(var _0x319674 in _0x294caa){if(_0x294caa[_0xc491('0x96')](_0x319674)){this[_0xc491('0x38')][_0xc491('0xdf')](util[_0xc491('0x2a')](_0xc491('0xed'),_0x319674[_0xc491('0x6a')]()),_0x294caa[_0x319674]);}}this['createSquareMessage'](_0x294caa[_0xc491('0xee')],_0xc491('0xef'),_0xc491('0xe9'),'');return this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')]('Dialogflow\x20Result\x20%s',_0x294caa[_0xc491('0xee')]));}return this[_0xc491('0x38')]['error'](_0x2b233a,_0xc491('0xf0'));};AGIVertices['prototype'][_0xc491('0xf1')]=function(_0x7fdf02){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xf2'),_0x7fdf02[_0xc491('0x3a')]));if(!this['isConfigured'](_0x7fdf02['dialogflowV2_project_id'])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xf3'));}if(!this[_0xc491('0x87')](_0x7fdf02['client_email'])){return this[_0xc491('0x38')]['noop'](_0xc491('0xf4'));}if(!this['isConfigured'](_0x7fdf02[_0xc491('0x80')])){return this['channel']['noop'](_0xc491('0xf5'));}if(!this[_0xc491('0x87')](_0x7fdf02[_0xc491('0x81')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xf6'));}if(!this[_0xc491('0x87')](_0x7fdf02[_0xc491('0x62')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xa5'));}this[_0xc491('0x38')]['bot']=!![];this[_0xc491('0x37')](_0x7fdf02);this[_0xc491('0x44')](_0x7fdf02[_0xc491('0x62')],'in','','');this[_0xc491('0x38')][_0xc491('0xa6')](util['format'](_0xc491('0xf7'),_0x7fdf02[_0xc491('0x62')]));var _0x5800eb=this[_0xc491('0x7e')][_0xc491('0x70')](this,_0x7fdf02);if(_0x5800eb){for(var _0x16dc01 in _0x5800eb){if(_0x5800eb[_0xc491('0x96')](_0x16dc01)){if(_0x16dc01!==_0xc491('0xf8')){this[_0xc491('0x38')][_0xc491('0xdf')](util['format'](_0xc491('0xed'),_0x16dc01[_0xc491('0x6a')]()),_0x5800eb[_0x16dc01]);}}}this[_0xc491('0x44')](_0x5800eb[_0xc491('0xee')],'out',_0xc491('0xf1'),_0x5800eb['providerResponse']);return this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xf9'),_0x5800eb['speech']));}return this[_0xc491('0x38')]['error'](_0x7fdf02,_0xc491('0xfa'));};AGIVertices[_0xc491('0x11')][_0xc491('0xfb')]=function(_0x168bbf){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0xfc'),_0x168bbf[_0xc491('0x3a')]));if(!this['isConfigured'](_0x168bbf[_0xc491('0xfd')])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x168bbf[_0xc491('0xfe')])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20username\x20configured');}if(!this[_0xc491('0x87')](_0x168bbf[_0xc491('0xff')])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20password\x20configured');}if(!this[_0xc491('0x87')](_0x168bbf[_0xc491('0x100')])){return this[_0xc491('0x38')]['noop'](_0xc491('0xa5'));}this['channel'][_0xc491('0x101')]=!![];this[_0xc491('0x37')](_0x168bbf);this[_0xc491('0x44')](_0x168bbf[_0xc491('0x62')],'in','','');this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x102'),_0x168bbf[_0xc491('0x62')]));var _0x26d5ff=this['sestekNDA']['sync'](this,_0x168bbf);if(_0x26d5ff){for(var _0x4e5f6d in _0x26d5ff){if(_0x26d5ff[_0xc491('0x96')](_0x4e5f6d)){this[_0xc491('0x38')][_0xc491('0xdf')](util[_0xc491('0x2a')](_0xc491('0x103'),_0x4e5f6d['toUpperCase']()),_0x26d5ff[_0x4e5f6d]);}}this['createSquareMessage'](_0x26d5ff['speech'],_0xc491('0xef'),_0xc491('0xfb'),'');if(_0x26d5ff[_0xc491('0x104')]){this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x26d5ff[_0xc491('0x104')]));var _0x265847=this[_0xc491('0x38')][_0xc491('0x105')](_0x26d5ff[_0xc491('0x104')]);try{fs[_0xc491('0x106')](_0x26d5ff[_0xc491('0x104')]+_0xc491('0x107'));}catch(_0x1d672b){logger[_0xc491('0x2d')](_0x1d672b);}return _0x265847;}else{return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x108'),_0x26d5ff['speech']));}}return this[_0xc491('0x38')][_0xc491('0x2d')](_0x168bbf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc491('0x11')][_0xc491('0x109')]=function(_0x3e8d81){logger[_0xc491('0x2f')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x3e8d81[_0xc491('0x3a')]));return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x109'));};AGIVertices[_0xc491('0x11')][_0xc491('0x10a')]=function(_0x5f48b6){logger[_0xc491('0x2f')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5f48b6[_0xc491('0x3a')]));var _0x3ffd7c='';if(_0x5f48b6[_0xc491('0x10b')]){if(!this[_0xc491('0x87')](_0x5f48b6['trunk_id'])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x5f48b6,'no\x20trunk\x20selected');}else{var _0x40a2b7=parseInt(_0x5f48b6['trunk_id'],0xa);if(isNaN(_0x40a2b7)){_0x3ffd7c=_0x5f48b6[_0xc491('0x10b')];}else{_0x3ffd7c=this[_0xc491('0x1f')]['sync'](this,_0x5f48b6[_0xc491('0x10b')]);if(!_0x3ffd7c){return this['channel'][_0xc491('0x2d')](_0x5f48b6,_0xc491('0x10c'));}}}}else if(_0x5f48b6['trunk_name']){_0x3ffd7c=_0x5f48b6[_0xc491('0x10d')];}else{return this[_0xc491('0x38')][_0xc491('0x2d')](_0x5f48b6,_0xc491('0x10e'));}var _0x1a1f5d=this[_0xc491('0x38')][_0xc491('0x5a')]('DIAL',[util[_0xc491('0x2a')](_0xc491('0x10f'),_0x3ffd7c,_0x5f48b6[_0xc491('0x4b')]),_0x5f48b6[_0xc491('0x66')],_0x5f48b6[_0xc491('0xe7')],_0x5f48b6['url']]);if(_0x1a1f5d[_0xc491('0xac')]===-0x1){return _0x1a1f5d;}return this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xe8'),_0xc491('0xe6')));};AGIVertices[_0xc491('0x11')]['finally']=function(_0x2fd46d){logger[_0xc491('0x2f')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2fd46d['label']));return this[_0xc491('0x38')][_0xc491('0xa6')]('finally');};AGIVertices[_0xc491('0x11')][_0xc491('0xe')]=function(_0x348fc6){logger['info'](util[_0xc491('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x348fc6[_0xc491('0x3a')]));if(_0x348fc6[_0xc491('0x110')]===0x0){return this[_0xc491('0xa4')](_0x348fc6);}_0x348fc6[_0xc491('0x110')]-=0x1;if(!this[_0xc491('0x87')](_0x348fc6[_0xc491('0x111')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x348fc6,_0xc491('0x112'));}var _0x3c3173=this['getSound']['sync'](this,_0x348fc6[_0xc491('0x111')]);if(!_0x3c3173){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x348fc6,_0xc491('0x113'));}if(!this[_0xc491('0x87')](_0x348fc6[_0xc491('0xdc')])){return this['channel'][_0xc491('0x2d')](_0xc491('0x114'));}var _0x1900df=this[_0xc491('0x38')][_0xc491('0x115')](_0x3c3173,_0x348fc6['response'],_0x348fc6[_0xc491('0x116')]);var _0x334166=_0x1900df[_0xc491('0xac')]?_0x1900df[_0xc491('0xac')]['toString']():'';logger[_0xc491('0x2f')](_0xc491('0x117'),JSON[_0xc491('0x72')](_0x1900df));if(_0x1900df[_0xc491('0xac')]===-0x1){this['createSquareDetailsReport'][_0xc491('0x70')](this,_0x348fc6,_0x334166);return _0x1900df;}else if(_0x1900df[_0xc491('0xa2')]===_0xc491('0x66')){_0x1900df['result']=_0x334166[_0xc491('0x9c')]>=parseInt(_0x348fc6[_0xc491('0x118')])?'x':'i';}else{_0x1900df[_0xc491('0xac')]=_0x334166[_0xc491('0x9c')]>=parseInt(_0x348fc6[_0xc491('0x118')])&&_0x334166['length']<=parseInt(_0x348fc6['maxdigit'])?'x':'i';}var _0x22e656=this[_0xc491('0x12')][_0xc491('0x70')](this,_0x348fc6[_0xc491('0xdc')]);if(!_0x22e656){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x348fc6,'no\x20variable\x20found');}this[_0xc491('0x38')][_0xc491('0xdf')](_0x22e656,_0x334166);if(this[_0xc491('0x87')](_0x348fc6[_0xc491('0x119')])){var _0x3c9df0=parseInt(_0x348fc6[_0xc491('0x119')],0xa);var _0x37e1dd=rs[_0xc491('0x11a')]({'charset':'*','length':_0x3c9df0});var _0x43dcbb=_0x334166['length'];if(_0x43dcbb>0x0){if(_0x43dcbb>_0x3c9df0){this['createSquareDetailsReport'][_0xc491('0x70')](this,_0x348fc6,_0x348fc6[_0xc491('0x11b')]===_0xc491('0x11c')?_0x37e1dd+_0x334166[_0xc491('0x11d')](_0x3c9df0):_0x334166[_0xc491('0x11d')](0x0,_0x43dcbb-_0x3c9df0)+_0x37e1dd);}else{this[_0xc491('0x37')]['sync'](this,_0x348fc6,rs[_0xc491('0x11a')]({'charset':'*','length':_0x43dcbb}));}}else{this[_0xc491('0x37')][_0xc491('0x70')](this,_0x348fc6,'');}}else{this[_0xc491('0x37')]['sync'](this,_0x348fc6,_0x334166);}return _0x1900df;};AGIVertices[_0xc491('0x11')][_0xc491('0xf')]=function(_0x18975e){logger[_0xc491('0x2f')](util['format'](_0xc491('0x11e'),_0x18975e[_0xc491('0x3a')]));return this['getdigits'](_0x18975e);};AGIVertices['prototype'][_0xc491('0x11f')]=function(_0x23a6aa){logger['info'](util[_0xc491('0x2a')](_0xc491('0x120'),_0x23a6aa[_0xc491('0x3a')]));this[_0xc491('0x37')]['sync'](this,_0x23a6aa,_0x23a6aa['goalname']);return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x121'),_0x23a6aa[_0xc491('0x122')]));};AGIVertices[_0xc491('0x11')][_0xc491('0x123')]=function(_0x231e02){logger[_0xc491('0x2f')](util['format'](_0xc491('0x124'),_0x231e02[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x231e02[_0xc491('0x8a')])||!this[_0xc491('0x87')](_0x231e02[_0xc491('0x8b')])){return this[_0xc491('0x38')]['noop'](_0xc491('0x125'));}if(!this[_0xc491('0x87')](_0x231e02[_0xc491('0x62')])){return this['channel'][_0xc491('0xa6')](_0xc491('0xa5'));}this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x126'),_0x231e02[_0xc491('0x62')]));var _0x3d42a4=this[_0xc491('0x89')][_0xc491('0x70')](this,_0x231e02);if(_0x3d42a4){this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x127'),_0x3d42a4));var _0x1c5ceb=this[_0xc491('0x38')]['streamFile'](_0x3d42a4);try{fs[_0xc491('0x106')](_0x3d42a4+'.wav');}catch(_0x35b97a){logger[_0xc491('0x2d')](_0x35b97a);}return _0x1c5ceb;}return this[_0xc491('0x38')]['error'](_0x231e02,_0xc491('0x128'));};AGIVertices['prototype'][_0xc491('0x129')]=function(_0x53ddc6){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x12a'),_0x53ddc6[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x53ddc6[_0xc491('0x8a')])||!this[_0xc491('0x87')](_0x53ddc6[_0xc491('0x8b')])){return this['channel'][_0xc491('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xc491('0x87')](_0x53ddc6[_0xc491('0x12b')])){return this['channel'][_0xc491('0xa6')](_0xc491('0x12c'));}if(!this[_0xc491('0x87')](_0x53ddc6['text'])){return this['channel'][_0xc491('0xa6')]('no\x20text\x20configured');}this[_0xc491('0x38')]['bot']=!![];this[_0xc491('0x37')](_0x53ddc6);this[_0xc491('0x44')](_0x53ddc6[_0xc491('0x62')],'in','','');this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x53ddc6['text']));var _0x594c65=this['awsLex']['sync'](this,_0x53ddc6);if(_0x594c65){for(var _0x1fa26e in _0x594c65){if(_0x594c65[_0xc491('0x96')](_0x1fa26e)&&_['isString'](_0x594c65[_0x1fa26e])){this[_0xc491('0x38')][_0xc491('0xdf')](util['format'](_0xc491('0x12d'),_0x1fa26e[_0xc491('0x6a')]()),_0x594c65[_0x1fa26e]);}}if(_['isNil'](_0x594c65[_0xc491('0x78')])){return this[_0xc491('0x38')][_0xc491('0xa6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x594c65[_0xc491('0x78')],_0xc491('0xef'),'amazonlex','');return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x12e'),_0x594c65['message']));}}return this['channel'][_0xc491('0x2d')](_0x53ddc6,_0xc491('0x12f'));};AGIVertices[_0xc491('0x11')][_0xc491('0x130')]=function(_0x1813e0){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x131'),_0x1813e0[_0xc491('0x3a')],_0x1813e0[_0xc491('0x66')]));if(!this[_0xc491('0x87')](_0x1813e0['key'])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0xeb'));}var _0xf224f0=_0xc491('0x132');var _0x5a006b=util['format'](_0xc491('0x133'),FILES_PATH,rs[_0xc491('0x11a')](0x4));var _0x5c45b9=util[_0xc491('0x2a')](_0xc491('0x9e'),_0x5a006b,_0xf224f0);var _0x114724=!![];if(_0x1813e0['beep']==='NOBEEP'){_0x114724=![];}var _0x5cfc61=this[_0xc491('0x38')]['recordFile'](_0x5a006b,_0xf224f0,_0x1813e0[_0xc491('0x134')],_0x1813e0[_0xc491('0x66')],undefined,_0x114724);if(_0x5cfc61['result']!==-0x1){this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x135'),_0x5c45b9));var _0x52431f=this[_0xc491('0x92')][_0xc491('0x70')](this,_0x1813e0,_0x5c45b9);if(_0x52431f){for(var _0xc8afce in _0x52431f){if(_0x52431f['hasOwnProperty'](_0xc8afce)){this['channel'][_0xc491('0xdf')](util[_0xc491('0x2a')]('GOOGLE_ASR_%s',_0xc8afce[_0xc491('0x6a')]()),_0x52431f[_0xc8afce]);}}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x136'),JSON[_0xc491('0x72')](_0x52431f)));}}return _0x5cfc61;};AGIVertices[_0xc491('0x11')][_0xc491('0x137')]=function(_0x296c1f){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x138'),_0x296c1f[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x296c1f['appid'])){return this[_0xc491('0x38')]['noop'](_0xc491('0x139'));}if(!this[_0xc491('0x87')](_0x296c1f[_0xc491('0x94')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x13a'));}var _0x45474a='wav';var _0x51bf19=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xc491('0x11a')](0x4));var _0x2ad03d=util[_0xc491('0x2a')](_0xc491('0x9e'),_0x51bf19,_0x45474a);var _0x1545a3=!![];if(_0x296c1f[_0xc491('0x13b')]===_0xc491('0x13c')){_0x1545a3=![];}var _0x510db6=this['channel']['recordFile'](_0x51bf19,_0x45474a,_0x296c1f[_0xc491('0x134')],_0x296c1f['timeout'],undefined,_0x1545a3);if(_0x510db6[_0xc491('0xac')]!==-0x1){this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x13d'),_0x2ad03d));var _0x2dcabb=this[_0xc491('0x93')][_0xc491('0x70')](this,_0x296c1f,_0x2ad03d);if(_0x2dcabb){for(var _0x4861ae in _0x2dcabb){if(_0x2dcabb[_0xc491('0x96')](_0x4861ae)){this[_0xc491('0x38')]['setVariable'](util['format']('TILDE_ASR_%s',_0x4861ae[_0xc491('0x6a')]()),_0x2dcabb[_0x4861ae]);}}return this[_0xc491('0x38')][_0xc491('0xa6')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xc491('0x72')](_0x2dcabb)));}}return _0x510db6;};AGIVertices[_0xc491('0x11')][_0xc491('0x13e')]=function(_0x3bce46){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x13f'),_0x3bce46[_0xc491('0x3a')]));return this[_0xc491('0x38')]['continueAt'](_0x3bce46[_0xc491('0x3f')],_0x3bce46[_0xc491('0x40')],_0x3bce46[_0xc491('0x41')]);};AGIVertices[_0xc491('0x11')][_0xc491('0x140')]=function(_0x1927ee){logger['info'](util['format'](_0xc491('0x141'),_0x1927ee[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x1927ee[_0xc491('0x142')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x1927ee,_0xc491('0x143'));}try{var _0x573fc9=eval(_0x1927ee['condition'])?_0xc491('0x144'):_0xc491('0x145');this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x146'),_0x1927ee[_0xc491('0x142')],_0x573fc9));return{'code':0xc8,'result':_0x573fc9};}catch(_0xc998da){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc491('0x11')][_0xc491('0x147')]=function(_0xa47cbc){logger['info'](util['format'](_0xc491('0x148'),_0xa47cbc[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0xa47cbc['interval_id'])){return this['channel'][_0xc491('0x2d')](_0xa47cbc,_0xc491('0x149'));}var _0xb231e3=this['getIntervals'][_0xc491('0x70')](this,_0xa47cbc[_0xc491('0x14a')]);if(!_0xb231e3){return this[_0xc491('0x38')]['error'](_0xa47cbc,_0xc491('0x14b'));}for(var _0x4bd83c=0x0;_0x4bd83c<_0xb231e3[_0xc491('0x9c')];_0x4bd83c+=0x1){var _0x1cd74f=this['channel']['getVariable'](util[_0xc491('0x2a')](_0xc491('0x14c'),_0xb231e3[_0x4bd83c]));if(_0x1cd74f[_0xc491('0xac')]===-0x1){return _0x1cd74f;}logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x14d'),_0xb231e3[_0x4bd83c],_0x1cd74f[_0xc491('0xa2')]));if(_0x1cd74f[_0xc491('0xa2')]===_0xc491('0x144')){logger['info'](util[_0xc491('0x2a')]('IFTIME\x20%s\x20%s',_0xb231e3[_0x4bd83c],'true'));this[_0xc491('0x38')][_0xc491('0xa6')](util['format']('IFTIME\x20%s\x20%s',_0xb231e3[_0x4bd83c],_0xc491('0x144')));return{'code':0xc8,'result':_0xc491('0x144')};}else{logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x14d'),_0xb231e3[_0x4bd83c],_0xc491('0x145')));this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')]('IFTIME\x20%s\x20%s',_0xb231e3[_0x4bd83c],'false'));}}return{'code':0xc8,'result':_0xc491('0x145')};};AGIVertices[_0xc491('0x11')][_0xc491('0x14e')]=function(_0x42d785){logger[_0xc491('0x2f')](util['format'](_0xc491('0x14f'),_0x42d785['label']));return this[_0xc491('0x38')][_0xc491('0x14e')]();};AGIVertices[_0xc491('0x11')][_0xc491('0x150')]=function(_0x172dc2){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x151'),_0x172dc2[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x172dc2[_0xc491('0x7c')])){return this['channel'][_0xc491('0xa6')](_0xc491('0xeb'));}var _0x43b0f0='wav';var _0x1b88da=util[_0xc491('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x5083b4=util[_0xc491('0x2a')](_0xc491('0x9e'),_0x1b88da,_0x43b0f0);var _0x305494=!![];if(_0x172dc2[_0xc491('0x13b')]==='NOBEEP'){_0x305494=![];}var _0xa71ccd=this[_0xc491('0x38')][_0xc491('0x152')](_0x1b88da,_0x43b0f0,_0x172dc2['intKey'],_0x172dc2['timeout'],undefined,_0x305494);if(_0xa71ccd[_0xc491('0xac')]!==-0x1){this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x153'),_0x5083b4));var _0x511fab=this[_0xc491('0x85')][_0xc491('0x70')](this,_0x172dc2,_0x5083b4);if(_0x511fab){for(var _0x433935 in _0x511fab){if(_0x511fab[_0xc491('0x96')](_0x433935)){this['channel'][_0xc491('0xdf')](util[_0xc491('0x2a')](_0xc491('0x154'),_0x433935[_0xc491('0x6a')]()),_0x511fab[_0x433935]);}}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x155'),JSON['stringify'](_0x511fab)));}}return _0xa71ccd;};AGIVertices[_0xc491('0x11')][_0xc491('0x156')]=function(_0x212dda){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x157'),_0x212dda[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x212dda[_0xc491('0x7c')])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20key\x20configured');}if(!this[_0xc491('0x87')](_0x212dda[_0xc491('0x62')])){return this[_0xc491('0x38')]['noop'](_0xc491('0xa5'));}this['channel'][_0xc491('0xa6')](util['format'](_0xc491('0x158'),_0x212dda[_0xc491('0x62')]));var _0x5a5b9e=this['ispeechTTS']['sync'](this,_0x212dda);if(_0x5a5b9e){this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')]('ispeech\x20%s\x20file\x20created',_0x5a5b9e));var _0x3e614e=this['channel'][_0xc491('0x105')](_0x5a5b9e,_0x212dda[_0xc491('0x134')]);try{fs['unlink'](_0x5a5b9e+_0xc491('0x107'));}catch(_0x2a94f9){logger['error'](_0x2a94f9);}return _0x3e614e;}return this[_0xc491('0x38')][_0xc491('0x2d')](_0x212dda,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc491('0x11')][_0xc491('0x159')]=function(_0x3e0538){logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3e0538['label']));if(!this[_0xc491('0x87')](_0x3e0538['findBy'])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x3e0538,_0xc491('0x15a'));}logger[_0xc491('0x2f')](util['format'](_0xc491('0x15b'),this['channel'][_0xc491('0x3c')],_0x3e0538[_0xc491('0x15c')]));var _0x5e0994=this[_0xc491('0x55')][_0xc491('0x70')](this,_0x3e0538[_0xc491('0x15c')]);if(_0x5e0994){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x15d'),this[_0xc491('0x38')]['callerid'],_0x3e0538['findBy']));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc491('0x38')][_0xc491('0x3c')],_0x3e0538[_0xc491('0x15c')]));return{'code':0xc8,'result':_0xc491('0x15e')};}else{logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x15f'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x3e0538['findBy']));this[_0xc491('0x38')]['noop'](util[_0xc491('0x2a')](_0xc491('0x15f'),this['channel'][_0xc491('0x3c')],_0x3e0538['findBy']));return{'code':0xc8,'result':_0xc491('0x160')};}};AGIVertices['prototype'][_0xc491('0x161')]=function(_0x75e6a2){logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x75e6a2[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x75e6a2[_0xc491('0x15c')])){return this['channel'][_0xc491('0x2d')](_0x75e6a2,'no\x20find\x20by\x20configured');}logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc491('0x38')]['callerid'],_0x75e6a2[_0xc491('0x15c')]));var _0x433ba1=this['agentLogout'][_0xc491('0x70')](this,_0x75e6a2[_0xc491('0x15c')]);if(_0x433ba1){logger['info'](util[_0xc491('0x2a')](_0xc491('0x15d'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x75e6a2['findBy']));this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc491('0x3c')],_0x75e6a2['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x15f'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x75e6a2[_0xc491('0x15c')]));this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x15f'),this['channel'][_0xc491('0x3c')],_0x75e6a2[_0xc491('0x15c')]));return{'code':0xc8,'result':_0xc491('0x160')};}};AGIVertices[_0xc491('0x11')][_0xc491('0x162')]=function(_0x24a5e7){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x163'),_0x24a5e7[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x24a5e7[_0xc491('0x164')])){return this[_0xc491('0x38')]['error'](_0x24a5e7,_0xc491('0x165'));}this[_0xc491('0x38')][_0xc491('0xa6')](util['format'](_0xc491('0x166'),_0x24a5e7[_0xc491('0x164')]));var _0x588010=eval(_0x24a5e7['operation']);if(!this[_0xc491('0x87')](_0x24a5e7['variable_id'])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2a65b2=this['getVariable'][_0xc491('0x70')](this,_0x24a5e7['variable_id']);if(!_0x2a65b2){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x24a5e7,_0xc491('0x167'));}if(_[_0xc491('0x9f')](_0x588010)){var _0x5e91ab=this;_0x588010[_0xc491('0xdd')](function(_0x55876a,_0x56c464){_0x5e91ab[_0xc491('0x38')][_0xc491('0xdf')](util[_0xc491('0x2a')](_0xc491('0x168'),_0x2a65b2,_0x56c464),_0x55876a);});return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x169'),_0x2a65b2));}else{return this[_0xc491('0x38')][_0xc491('0xdf')](_0x2a65b2,_0x588010);}};AGIVertices['prototype']['menu']=function(_0x194a78){logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x194a78[_0xc491('0x3a')]));if(_0x194a78[_0xc491('0x110')]===0x0){return this['maxRetry'](_0x194a78);}_0x194a78[_0xc491('0x110')]-=0x1;if(!this[_0xc491('0x87')](_0x194a78[_0xc491('0x111')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x194a78,'no\x20file\x20audio\x20selected');}var _0x32ba37=this['getSound'][_0xc491('0x70')](this,_0x194a78[_0xc491('0x111')]);if(!_0x32ba37){return this[_0xc491('0x38')]['error'](_0x194a78,_0xc491('0x113'));}var _0x5365e0=this['channel'][_0xc491('0x115')](_0x32ba37,_0x194a78[_0xc491('0x16a')],_0x194a78[_0xc491('0x16b')]);var _0x5bcf9b=_0x5365e0[_0xc491('0xac')];if(_0x5365e0[_0xc491('0xac')]===-0x1){this[_0xc491('0x37')][_0xc491('0x70')](this,_0x194a78,'-1');return _0x5365e0;}else if(_0x5365e0['extra']===_0xc491('0x66')){_0x5365e0[_0xc491('0xac')]=_0x5365e0['result'][_0xc491('0x9c')]>0x0?_0x5365e0[_0xc491('0xac')]:'t';}else if(_['isEmpty'](_0x5365e0[_0xc491('0xac')])){_0x5365e0['result']='#';_0x5bcf9b='#';}if(!this['isConfigured'](_0x194a78['variable_id'])){this['channel']['noop'](_0xc491('0x114'));}else{var _0x2dd1db=this['getVariable']['sync'](this,_0x194a78[_0xc491('0xdc')]);if(!_0x2dd1db){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x194a78,_0xc491('0x167'));}this[_0xc491('0x38')][_0xc491('0xdf')](_0x2dd1db,_0x5bcf9b);}this['createSquareDetailsReport'][_0xc491('0x70')](this,_0x194a78,_0x5bcf9b);return _0x5365e0;};AGIVertices['prototype'][_0xc491('0xa6')]=function(_0x408aac){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x16c'),_0x408aac[_0xc491('0x3a')]));return this[_0xc491('0x38')][_0xc491('0xa6')](_0x408aac[_0xc491('0x16d')]||_0x408aac[_0xc491('0x3a')]);};AGIVertices[_0xc491('0x11')][_0xc491('0x16e')]=function(_0x1da755){logger['info'](util[_0xc491('0x2a')](_0xc491('0x16f'),_0x1da755[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x1da755[_0xc491('0x15c')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x1da755,'no\x20find\x20by\x20configured');}logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x15b'),this[_0xc491('0x38')]['callerid'],_0x1da755[_0xc491('0x15c')]));var _0x58af66=this[_0xc491('0x50')]['sync'](this,_0x1da755[_0xc491('0x170')]);var _0x5a6132=this[_0xc491('0x51')][_0xc491('0x70')](this,_0x1da755['findBy'],_0x58af66);if(_0x5a6132){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc491('0x38')][_0xc491('0x3c')],_0x1da755[_0xc491('0x15c')]));this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x15d'),this['channel']['callerid'],_0x1da755['findBy']));return{'code':0xc8,'result':_0xc491('0x15e')};}else{logger['info'](util[_0xc491('0x2a')](_0xc491('0x15f'),this['channel'][_0xc491('0x3c')],_0x1da755[_0xc491('0x15c')]));this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x15d'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x1da755[_0xc491('0x15c')]));return{'code':0xc8,'result':_0xc491('0x160')};}};AGIVertices[_0xc491('0x11')][_0xc491('0x171')]=function(_0x52ba66){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x172'),_0x52ba66[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x52ba66[_0xc491('0x111')])){return this[_0xc491('0x38')]['error'](_0x52ba66,'no\x20file\x20audio\x20selected');}var _0x2f19c6=this['getSound'][_0xc491('0x70')](this,_0x52ba66[_0xc491('0x111')]);if(!_0x2f19c6){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x52ba66,_0xc491('0x113'));}var _0x430b2a=this[_0xc491('0x38')][_0xc491('0x5a')](_0xc491('0x173'),[_0x2f19c6,_0x52ba66[_0xc491('0xe7')]]);if(_0x430b2a[_0xc491('0xac')]===-0x1){return _0x430b2a;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xc2'),_0xc491('0x173'),_0x2f19c6));};AGIVertices['prototype']['queue']=function(_0x2359f7){logger[_0xc491('0x2f')](util['format'](_0xc491('0x174'),_0x2359f7[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x2359f7[_0xc491('0x175')])){return this[_0xc491('0x38')]['error'](_0x2359f7,_0xc491('0x176'));}var _0x215076='';var _0x5d27a8=parseInt(_0x2359f7[_0xc491('0x175')],0xa);if(isNaN(_0x5d27a8)){_0x215076=_0x2359f7[_0xc491('0x175')];}else{_0x215076=this[_0xc491('0x177')][_0xc491('0x70')](this,_0x2359f7['queue_id']);if(!_0x215076){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x2359f7,_0xc491('0x178'));}}var _0x4b3d67='';if(this[_0xc491('0x87')](_0x2359f7[_0xc491('0x111')])){var _0x2a9980=this['getSound'][_0xc491('0x70')](this,_0x2359f7[_0xc491('0x111')]);if(_0x2a9980){_0x4b3d67=_0x2a9980;}}this[_0xc491('0x37')][_0xc491('0x70')](this,_0x2359f7,_0x215076);if(_0x2359f7[_0xc491('0xe7')][_0xc491('0x179')]('x')<0x0){_0x2359f7[_0xc491('0xe7')]+='x';}if(_0x2359f7[_0xc491('0xe7')]['indexOf']('X')<0x0){_0x2359f7[_0xc491('0xe7')]+='X';}this[_0xc491('0x38')][_0xc491('0xdf')](_0xc491('0x17a'),_0x215076?_0x215076[_0xc491('0x17b')]():'');var _0x2e5b01=this['channel'][_0xc491('0x5a')](_0xc491('0x17c'),[_0x215076,_0x2359f7[_0xc491('0xe7')],_0x2359f7[_0xc491('0x64')],_0x4b3d67,_0x2359f7[_0xc491('0x66')],_0x2359f7[_0xc491('0xb4')],_0x2359f7[_0xc491('0x17d')],_0x2359f7[_0xc491('0x17e')],'',_0x2359f7[_0xc491('0x17f')]]);if(_0x2e5b01['result']===-0x1){return _0x2e5b01;}return this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')]('Executed\x20command\x20%s\x20%s',_0xc491('0x17c'),_0x215076));};AGIVertices[_0xc491('0x11')][_0xc491('0x180')]=function(_0x2c1ac0){logger['info'](util[_0xc491('0x2a')](_0xc491('0x181'),_0x2c1ac0[_0xc491('0x3a')]));var _0x39cea2=_0x2c1ac0[_0xc491('0x182')]||_0xc491('0x132');var _0x16e857=util[_0xc491('0x2a')](_0xc491('0x183'),this[_0xc491('0x38')][_0xc491('0x39')],rs[_0xc491('0x11a')](0x5));var _0x2fa950=util[_0xc491('0x2a')](_0xc491('0x184'),FILES_PATH,_0x16e857,_0x39cea2);var _0x279ce3=util[_0xc491('0x2a')]('%s/recordings/%s',FILES_PATH,_0x16e857);this[_0xc491('0x3d')][_0xc491('0x70')](this,_0x2c1ac0,_0x16e857,_0x2fa950);this[_0xc491('0x38')][_0xc491('0xdf')]('RECORDING_SAVENAME',_0x16e857);logger[_0xc491('0x2f')](_0xc491('0x185'),_0x279ce3,_0x39cea2,_0x2c1ac0[_0xc491('0x186')],_0x2c1ac0[_0xc491('0x66')]);return this[_0xc491('0x38')][_0xc491('0x152')](_0x279ce3,_0x39cea2,_0x2c1ac0['escape_digits'],_0x2c1ac0['timeout'],undefined,!![]);};AGIVertices[_0xc491('0x11')][_0xc491('0x187')]=function(_0x4f0a9f){logger[_0xc491('0x2f')](util['format'](_0xc491('0x188'),_0x4f0a9f[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x4f0a9f[_0xc491('0x64')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x189'));}var _0x52f464=this['restAPI']['sync'](this,_0x4f0a9f);logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x18a'),util[_0xc491('0x18b')](_0x52f464,{'showHidden':![],'depth':null})));if(!this[_0xc491('0x87')](_0x4f0a9f[_0xc491('0xdc')])){return this[_0xc491('0x38')][_0xc491('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x550000=this['getVariable'][_0xc491('0x70')](this,_0x4f0a9f['variable_id']);if(!_0x550000){return this[_0xc491('0x38')]['error'](_0x4f0a9f,_0xc491('0x167'));}this[_0xc491('0x38')][_0xc491('0xdf')](util[_0xc491('0x2a')](_0xc491('0x18c'),_0x550000),_0x52f464['statusCode']?_0x52f464['statusCode']:_0xc491('0x18d'));this[_0xc491('0x38')][_0xc491('0xdf')](util[_0xc491('0x2a')](_0xc491('0x18e'),_0x550000),_0x52f464[_0xc491('0x77')]?_0x52f464['statusMessage']:'OK');if(_0x52f464['body']){try{this[_0xc491('0x9d')](_0x52f464[_0xc491('0x73')],_0x550000);}catch(_0x3a5f20){logger[_0xc491('0x2d')](util[_0xc491('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x550000));}}return this[_0xc491('0x38')]['noop'](util[_0xc491('0x2a')]('variable\x20%s\x20set',_0x550000));};AGIVertices[_0xc491('0x11')][_0xc491('0x18f')]=function(_0x2f6680){logger['info'](util['format'](_0xc491('0x190'),_0x2f6680['label']));return this[_0xc491('0x38')][_0xc491('0x191')](_0x2f6680[_0xc491('0x192')]['replace'](/\s+/g,''),_0x2f6680['escape_digits']);};AGIVertices[_0xc491('0x11')][_0xc491('0x193')]=function(_0x1ff1b6){logger[_0xc491('0x2f')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1ff1b6['label']));return this[_0xc491('0x38')][_0xc491('0x194')](_0x1ff1b6[_0xc491('0x195')][_0xc491('0xd9')](/\s+/g,''),_0x1ff1b6['escape_digits']);};AGIVertices[_0xc491('0x11')][_0xc491('0x196')]=function(_0x4af536){logger['info'](util[_0xc491('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4af536['label']));return this[_0xc491('0x38')][_0xc491('0x197')](_0x4af536['text'],_0x4af536[_0xc491('0x186')]);};AGIVertices[_0xc491('0x11')]['sendMail']=function(_0x58c378){logger['info'](util[_0xc491('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x58c378[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x58c378[_0xc491('0x198')])){return this[_0xc491('0x38')]['noop'](_0xc491('0x199'));}var _0x3ab7e8=this['getMailAccount'][_0xc491('0x70')](this,_0x58c378[_0xc491('0x198')]);if(!_0x3ab7e8||!_0x3ab7e8[_0xc491('0x19a')]){return this['channel'][_0xc491('0x2d')](_0x58c378,'no\x20mail\x20account\x20found');}var _0x2a8398={'from':util['format']('\x22%s\x22\x20<%s>',_0x3ab7e8[_0xc491('0x15')],_0x3ab7e8[_0xc491('0x19b')]||_0x3ab7e8[_0xc491('0x19a')]['user']),'to':_0x58c378['to']||'','cc':_0x58c378['cc']||'','bcc':_0x58c378[_0xc491('0x19c')]||'','subject':_0x58c378[_0xc491('0x19d')],'html':_0x58c378[_0xc491('0x62')],'text':_0x58c378['text']};var _0x3dd7f8={'tls':{'rejectUnauthorized':![]}};if(_0x3ab7e8[_0xc491('0x19a')][_0xc491('0x19e')]){_0x3dd7f8[_0xc491('0x19e')]=_0x3ab7e8[_0xc491('0x19a')][_0xc491('0x19e')];}else{_0x3dd7f8[_0xc491('0x19f')]=_0x3ab7e8[_0xc491('0x19a')][_0xc491('0x19f')];_0x3dd7f8[_0xc491('0x1a0')]=_0x3ab7e8['Smtp'][_0xc491('0x1a0')];_0x3dd7f8[_0xc491('0x1a1')]=_0x3ab7e8['Smtp'][_0xc491('0x1a1')];}if(_0x3ab7e8[_0xc491('0x19a')][_0xc491('0x1a2')]){_0x3dd7f8[_0xc491('0x1a3')]={'user':_0x3ab7e8[_0xc491('0x19a')][_0xc491('0x1a4')],'pass':_0x3ab7e8[_0xc491('0x19a')][_0xc491('0x1a5')]};}if(this['isConfigured'](_0x58c378[_0xc491('0x1a6')])){}logger['debug'](_0xc491('0x1a7'),JSON[_0xc491('0x72')](_0x2a8398));this[_0xc491('0x37')]['sync'](this,_0x58c378,_0x58c378[_0xc491('0x198')]);this[_0xc491('0x38')][_0xc491('0xa6')](util['format'](_0xc491('0x1a8'),_0x3ab7e8['name']));this['sendMailMessage']['sync'](this,_0x3dd7f8,_0x2a8398);return this[_0xc491('0x38')][_0xc491('0xa6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc491('0x11')][_0xc491('0x1a9')]=function(_0x4f8488){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x1aa'),_0x4f8488[_0xc491('0x3a')]));return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x1ab'));};AGIVertices[_0xc491('0x11')]['sendSMS']=function(_0x5842af){logger[_0xc491('0x2f')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5842af['label']));if(!this[_0xc491('0x87')](_0x5842af[_0xc491('0x1ac')])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x1ad'));}var _0x59ba01=this[_0xc491('0x34')]['sync'](this,_0x5842af['sms_account_id']);if(!_0x59ba01){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x5842af,_0xc491('0x1ae'));}var _0x5d03be={'body':_0x5842af[_0xc491('0x1af')],'phone':_0x5842af['to']||'','SmsAccountId':_0x59ba01['id']};logger[_0xc491('0x1b0')](_0xc491('0x1b1'),JSON[_0xc491('0x72')](_0x5d03be));this[_0xc491('0x37')][_0xc491('0x70')](this,_0x5842af,_0x5842af['sms_account_id']);this['channel']['noop'](util[_0xc491('0x2a')](_0xc491('0x1b2'),_0x59ba01[_0xc491('0x15')]));this[_0xc491('0x36')][_0xc491('0x70')](this,_0x5d03be);return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x1b3'));};AGIVertices[_0xc491('0x11')][_0xc491('0x1b4')]=function(_0x5e3f0d){logger['info'](util['format'](_0xc491('0x1b5'),_0x5e3f0d[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x5e3f0d[_0xc491('0xdc')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x5e3f0d,_0xc491('0x1b6'));}var _0x1c272a=this[_0xc491('0x12')][_0xc491('0x70')](this,_0x5e3f0d['variable_id']);if(!_0x1c272a){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x5e3f0d,'no\x20variable\x20found');}return this['channel'][_0xc491('0xdf')](_0x1c272a,_0x5e3f0d[_0xc491('0x1b7')]);};AGIVertices[_0xc491('0x11')][_0xc491('0x1b8')]=function(_0x394ba9){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x1b9'),_0x394ba9[_0xc491('0x3a')]));this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x1ba'));if(_0x394ba9['answer']===_0xc491('0x1bb')){this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x1bc'));return this[_0xc491('0x38')][_0xc491('0xb7')]();}return this['channel'][_0xc491('0xa6')](_0xc491('0x1bd'));};AGIVertices[_0xc491('0x11')]['subproject']=function(_0x47c940){logger[_0xc491('0x2f')](util['format'](_0xc491('0x1be'),_0x47c940[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x47c940['project_id'])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x47c940,_0xc491('0x1bf'));}var _0x1c9ccf=this[_0xc491('0x18')][_0xc491('0x70')](this,_0x47c940['project_id']);if(!this['isConfigured'](_0x1c9ccf)){return this['channel']['error'](_0x47c940,util[_0xc491('0x2a')](_0xc491('0x1c0'),_0x47c940['project_id']));}if(_0x1c9ccf===this[_0xc491('0x38')][_0xc491('0x1c1')]){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x47c940,_0xc491('0x1c2'));}this[_0xc491('0x37')][_0xc491('0x70')](this,_0x47c940,_0x1c9ccf);var _0x49bf25=this[_0xc491('0x38')][_0xc491('0x5a')](_0xc491('0x1c3'),util[_0xc491('0x2a')](_0xc491('0x1c4'),config[_0xc491('0xb4')][_0xc491('0x19f')]||_0xc491('0x1c5'),_0x1c9ccf,this['channel']['arg_1']));if(_0x49bf25[_0xc491('0xac')]===-0x1){return _0x49bf25;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')]('Executed\x20command\x20%s\x20%s',_0xc491('0x1c3'),_0x1c9ccf));};AGIVertices[_0xc491('0x11')][_0xc491('0x1c6')]=function(_0x206397){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x1c7'),_0x206397[_0xc491('0x3a')]));var _0x2f508e=this[_0xc491('0x59')][_0xc491('0x70')](this,_0x206397[_0xc491('0xb5')]);this[_0xc491('0x37')][_0xc491('0x70')](this,_0x206397,_0x206397['command']);if(this['isConfigured'](_0x206397['variable_id'])){var _0x113a0c=this[_0xc491('0x12')][_0xc491('0x70')](this,_0x206397[_0xc491('0xdc')]);if(_0x113a0c){this['channel']['setVariable'](_0x113a0c,_0x2f508e);return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x1c8'),_0x206397[_0xc491('0xb5')],_0x113a0c));}}return this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x1c9'),_0x206397['command']));};AGIVertices[_0xc491('0x11')][_0xc491('0x1ca')]=function(_0x255f64){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x1cb'),_0x255f64[_0xc491('0x3a')]));_0x255f64['text']=_0x255f64[_0xc491('0x62')][_0xc491('0xd9')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc491('0x87')](_0x255f64['apiKey'])){return this[_0xc491('0x38')][_0xc491('0xa6')](_0xc491('0x1cc'));}if(!this[_0xc491('0x87')](_0x255f64['text'])){return this['channel']['noop'](_0xc491('0xa5'));}this[_0xc491('0x38')]['noop'](util[_0xc491('0x2a')](_0xc491('0x1cd'),_0x255f64[_0xc491('0x62')]));var _0x32708b=this['googleCloudTTS'][_0xc491('0x70')](this,_0x255f64);if(_0x32708b){this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x1ce'),_0x32708b));var _0x7f4fdf=this[_0xc491('0x38')][_0xc491('0x105')](_0x32708b);try{fs[_0xc491('0x106')](_0x32708b+'.wav');}catch(_0x42dab1){logger[_0xc491('0x2d')](_0x42dab1);}return _0x7f4fdf;}return this['channel'][_0xc491('0x2d')](_0x255f64,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x3ac1bb){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x1cf'),_0x3ac1bb[_0xc491('0x3a')]));_0x3ac1bb[_0xc491('0x62')]=_0x3ac1bb[_0xc491('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3ac1bb[_0xc491('0x62')])){return this[_0xc491('0x38')]['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0xc491('0x2a')](_0xc491('0x1d0'),_0x3ac1bb[_0xc491('0x62')]));var _0x408054=this[_0xc491('0x61')][_0xc491('0x70')](this,_0x3ac1bb);if(_0x408054){this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x1d1'),_0x408054));var _0x129b60=this[_0xc491('0x38')]['streamFile'](_0x408054);try{fs[_0xc491('0x106')](_0x408054+'.wav');}catch(_0x196e41){logger[_0xc491('0x2d')](_0x196e41);}return _0x129b60;}return this[_0xc491('0x38')][_0xc491('0x2d')](_0x3ac1bb,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc491('0x11')][_0xc491('0x1d2')]=function(_0x89db8c){logger['info'](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x89db8c[_0xc491('0x3a')]));if(!this['isConfigured'](_0x89db8c[_0xc491('0x15c')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x89db8c,_0xc491('0x15a'));}logger['info'](util[_0xc491('0x2a')](_0xc491('0x15b'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x89db8c[_0xc491('0x15c')]));var _0x12d562=this['agentUnpause'][_0xc491('0x70')](this,_0x89db8c[_0xc491('0x15c')]);if(_0x12d562){logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc491('0x38')][_0xc491('0x3c')],_0x89db8c['findBy']));this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x15d'),this['channel']['callerid'],_0x89db8c[_0xc491('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xc491('0x2f')](util['format'](_0xc491('0x15f'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x89db8c[_0xc491('0x15c')]));this['channel'][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0x15f'),this[_0xc491('0x38')][_0xc491('0x3c')],_0x89db8c[_0xc491('0x15c')]));return{'code':0xc8,'result':_0xc491('0x160')};}};AGIVertices[_0xc491('0x11')][_0xc491('0x1d3')]=function(_0xa15362){logger[_0xc491('0x2f')](util[_0xc491('0x2a')](_0xc491('0x1d4'),_0xa15362[_0xc491('0x3a')]));var _0x2a6566=this[_0xc491('0x38')]['exec'](_0xc491('0x1d5'),[_0xa15362['mailbox'],_0xa15362[_0xc491('0x7a')]]);if(_0x2a6566[_0xc491('0xac')]===-0x1){return _0x2a6566;}return this[_0xc491('0x38')][_0xc491('0xa6')](util[_0xc491('0x2a')](_0xc491('0xc2'),_0xc491('0x1d5'),_0xa15362['mailbox']));};AGIVertices[_0xc491('0x11')][_0xc491('0x1d6')]=function(_0x3b7c0e){logger[_0xc491('0x2f')](util[_0xc491('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3b7c0e[_0xc491('0x3a')]));if(!this[_0xc491('0x87')](_0x3b7c0e[_0xc491('0xdc')])){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x3b7c0e,_0xc491('0x1b6'));}var _0x174220=this[_0xc491('0x12')][_0xc491('0x70')](this,_0x3b7c0e['variable_id']);if(!_0x174220){return this[_0xc491('0x38')][_0xc491('0x2d')](_0x3b7c0e,'no\x20variable\x20found');}var _0x57fb22=this[_0xc491('0x38')][_0xc491('0x12')](_0x174220);return{'code':0xc8,'result':_0x57fb22[_0xc491('0xa2')]?_0x57fb22[_0xc491('0xa2')]:'-'};};String[_0xc491('0x11')][_0xc491('0xa1')]=function(_0x118269,_0x4ebd44){return this['split'](_0x118269)['join'](_0x4ebd44);};module[_0xc491('0x1d7')]=AGIVertices; \ No newline at end of file +var _0xa346=['replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','noop','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','result','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','answer','wait','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','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','getVariable','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','%s/recordings/%s','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','service','host','port','secure','authentication','auth','pass','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','arg_1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','randomstring','moment','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','prototype','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','context','extension','dnid','file','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString'];(function(_0x400701,_0x35c3e4){var _0x2772ca=function(_0x673520){while(--_0x673520){_0x400701['push'](_0x400701['shift']());}};_0x2772ca(++_0x35c3e4);}(_0xa346,0x12f));var _0x6a34=function(_0x3ae618,_0x3d2d46){_0x3ae618=_0x3ae618-0x0;var _0x308ce5=_0xa346[_0x3ae618];return _0x308ce5;};'use strict';var fs=require('fs');var path=require(_0x6a34('0x0'));var util=require(_0x6a34('0x1'));var _=require(_0x6a34('0x2'));var sh=require(_0x6a34('0x3'));var odbc=require('odbc')();var rs=require(_0x6a34('0x4'));var moment=require(_0x6a34('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x6a34('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0x6a34('0x7'));var FILES_PATH=_0x6a34('0x8');var recursiveMapAttributes=[_0x6a34('0x9'),'rawBody'];var verticesWithRetry=[_0x6a34('0xa'),_0x6a34('0xb'),_0x6a34('0xc')];var AGIVertices=function(_0x19d879,_0x3c1dfb,_0x1a4f0e){this[_0x6a34('0xd')]=_0x19d879;this[_0x6a34('0xe')]=_0x3c1dfb;this['mailRpc']=_0x1a4f0e;};AGIVertices[_0x6a34('0xf')]['getVariable']=function(_0x659093,_0x192e57){this[_0x6a34('0xe')]['getVariableById'](_0x659093)[_0x6a34('0x10')](function(_0x5edefa){_0x192e57(null,_0x5edefa?_0x5edefa[_0x6a34('0x11')]:![]);})['catch'](function(_0x24f7d7){_0x192e57(_0x24f7d7);});};AGIVertices['prototype'][_0x6a34('0x12')]=function(_0x4cdf50,_0x5fd2a){this['rpc'][_0x6a34('0x13')](_0x4cdf50)[_0x6a34('0x10')](function(_0x4d0af8){_0x5fd2a(null,_0x4d0af8?_0x4d0af8['name']:![]);})[_0x6a34('0x14')](function(_0x1ed329){_0x5fd2a(_0x1ed329);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x15')]=function(_0x5233c0,_0x5966dc){this[_0x6a34('0xe')][_0x6a34('0x16')](_0x5233c0)[_0x6a34('0x10')](function(_0x1e57bc){_0x5966dc(null,_0x1e57bc?_0x1e57bc[_0x6a34('0x11')]:![]);})['catch'](function(_0x20adc0){_0x5966dc(_0x20adc0);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x17')]=function(_0x1b4960,_0x4941af){this['rpc'][_0x6a34('0x18')](_0x1b4960)['then'](function(_0x4d9d71){_0x4941af(null,_0x4d9d71?_0x4d9d71[_0x6a34('0x19')]:![]);})[_0x6a34('0x14')](function(_0x1f1a94){_0x4941af(_0x1f1a94);});};AGIVertices['prototype']['getUser']=function(_0x378e34,_0x65dac5){this[_0x6a34('0xe')][_0x6a34('0x1a')](_0x378e34)[_0x6a34('0x10')](function(_0x46492d){_0x65dac5(null,_0x46492d?_0x46492d[_0x6a34('0x11')]:![]);})[_0x6a34('0x14')](function(_0x135aa9){_0x65dac5(_0x135aa9);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x1b')]=function(_0x3764c9,_0x407387){this['rpc'][_0x6a34('0x1c')](_0x3764c9)['then'](function(_0x199259){_0x407387(null,_0x199259?_0x199259[_0x6a34('0x11')]:![]);})['catch'](function(_0x403a00){_0x407387(_0x403a00);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x1d')]=function(_0x14c2b9,_0x2a7d32){var _0x18c244=this;this[_0x6a34('0xe')]['getSoundById'](_0x14c2b9)[_0x6a34('0x10')](function(_0x5e05d7){_0x2a7d32(null,_0x5e05d7?_0x18c244['getSoundPath'](_0x5e05d7['save_name']):![]);})[_0x6a34('0x14')](function(_0x2ddffc){_0x2a7d32(_0x2ddffc);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x1e')]=function(_0x18f285,_0x36e553){this['rpc'][_0x6a34('0x1f')](_0x18f285)[_0x6a34('0x10')](function(_0x3207d7){_0x36e553(null,_0x3207d7?_0x3207d7:![]);})[_0x6a34('0x14')](function(_0xe2013f){_0x36e553(_0xe2013f);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x20')]=function(_0x4c34e1,_0x7e435b,_0x4e8b50){this['mailRpc'][_0x6a34('0x20')](_0x4c34e1,_0x7e435b)[_0x6a34('0x10')](function(){_0x4e8b50(null);})[_0x6a34('0x14')](function(_0x3291e7){_0x4e8b50(_0x3291e7);});};AGIVertices['prototype'][_0x6a34('0x21')]=function(_0x5d1ec6,_0x14ae40){this[_0x6a34('0xe')][_0x6a34('0x22')](_0x5d1ec6)[_0x6a34('0x10')](function(_0x1b4eef){if(_0x1b4eef){if(_0x1b4eef[_0x6a34('0x23')]){_0x14ae40(null,[_0x1b4eef[_0x6a34('0x24')]]);}else{_0x14ae40(null,_[_0x6a34('0x25')](_0x1b4eef[_0x6a34('0x26')],_0x6a34('0x24')));}}else{_0x14ae40(null,![]);}})[_0x6a34('0x14')](function(_0x4d918f){_0x14ae40(_0x4d918f);});};AGIVertices['prototype'][_0x6a34('0x27')]=function(_0x10bf51){return util[_0x6a34('0x28')](_0x6a34('0x29'),FILES_PATH,_0x10bf51);};AGIVertices[_0x6a34('0xf')][_0x6a34('0x2a')]=function(_0x5da29e,_0x243c9,_0x38c97c){odbc['open'](_0x5da29e,function(_0x5404e3){if(_0x5404e3){logger[_0x6a34('0x2b')](_0x6a34('0x2c'),_0x5404e3);_0x38c97c(_0x5404e3);}else{logger[_0x6a34('0x2d')](_0x6a34('0x2e'));odbc[_0x6a34('0x2f')](_0x243c9,function(_0x388d98,_0x3b2494){if(_0x388d98){logger[_0x6a34('0x2d')]('Error\x20executing\x20query\x20%s',_0x243c9);_0x38c97c(_0x388d98);}else{logger['info'](_0x6a34('0x30'),_0x243c9);odbc[_0x6a34('0x31')](function(_0x736386){if(_0x736386){logger[_0x6a34('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x736386);}_0x38c97c(null,_0x3b2494);});}});}});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x32')]=function(_0x10088c,_0x2db971){this[_0x6a34('0xe')][_0x6a34('0x33')](_0x10088c)[_0x6a34('0x10')](function(_0x2adf42){_0x2db971(null,_0x2adf42?_0x2adf42:![]);})[_0x6a34('0x14')](function(_0x22e945){_0x2db971(_0x22e945);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x34')]=function(_0x21660b,_0x58c210){this[_0x6a34('0xe')][_0x6a34('0x34')](_0x21660b)[_0x6a34('0x10')](function(_0x49f09f){_0x58c210(null,_0x49f09f);})[_0x6a34('0x14')](function(_0x1c913a){_0x58c210(_0x1c913a);});};AGIVertices[_0x6a34('0xf')]['createSquareDetailsReport']=function(_0x25349b,_0x466573,_0x6852a7){this['rpc'][_0x6a34('0x35')]({'uniqueid':this[_0x6a34('0xd')][_0x6a34('0x36')],'node':_0x25349b[_0x6a34('0x37')],'application':_0x25349b['agicommand'],'data':_0x466573||null,'project_name':this[_0x6a34('0xd')]['arg_1'],'callerid':this[_0x6a34('0xd')][_0x6a34('0x38')]})['then'](function(_0x55fcbb){if(_0x6852a7){_0x6852a7(null,_0x55fcbb);}})[_0x6a34('0x14')](function(_0x43c259){if(_0x6852a7){_0x6852a7(_0x43c259);}});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x39')]=function(_0x48e7fe,_0x54ec3a,_0x438cfb,_0x21e756){this[_0x6a34('0xe')][_0x6a34('0x39')]({'uniqueid':this[_0x6a34('0xd')][_0x6a34('0x36')],'callerid':this[_0x6a34('0xd')][_0x6a34('0x38')],'calleridname':this['channel']['calleridname'],'context':this[_0x6a34('0xd')][_0x6a34('0x3a')],'extension':this[_0x6a34('0xd')][_0x6a34('0x3b')],'priority':this[_0x6a34('0xd')]['priority'],'accountcode':this[_0x6a34('0xd')]['accountcode'],'dnid':this[_0x6a34('0xd')][_0x6a34('0x3c')],'projectName':this['channel']['arg_1'],'saveName':_0x54ec3a,'filename':_0x48e7fe[_0x6a34('0x3d')]||_0x54ec3a,'savePath':_0x438cfb})[_0x6a34('0x10')](function(_0x5ea266){_0x21e756(null,_0x5ea266);})[_0x6a34('0x14')](function(_0x27428d){_0x21e756(_0x27428d);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x3e')]=function(_0x4eace8,_0x5aada8,_0xae90b2,_0x2a0edc,_0x145e59){this[_0x6a34('0xe')][_0x6a34('0x3e')]({'uniqueid':this[_0x6a34('0xd')]['uniqueid'],'body':_0x4eace8,'direction':_0x5aada8,'providerName':_0xae90b2,'providerResponse':_0x2a0edc})['then'](function(_0x1507b7){if(_0x145e59){_0x145e59(null,_0x1507b7);}})[_0x6a34('0x14')](function(_0x34c64d){if(_0x145e59){_0x145e59(_0x34c64d);}});};AGIVertices['prototype'][_0x6a34('0x3f')]=function(_0x25d96e,_0x4f5301){this[_0x6a34('0xe')]['createCmContact']({'firstName':_['isEmpty'](_0x25d96e[_0x6a34('0x11')])||_[_0x6a34('0x40')](_0x25d96e['name'])?_0x6a34('0x41')+Math['random']():_0x25d96e[_0x6a34('0x11')],'lastName':_[_0x6a34('0x42')](_0x25d96e[_0x6a34('0x43')])||_['isNil'](_0x25d96e['lastName'])?null:_0x25d96e[_0x6a34('0x43')],'phone':_0x25d96e[_0x6a34('0x44')],'ListId':_0x25d96e[_0x6a34('0x45')],'scheduledat':_0x25d96e['scheduledAt'],'callbackUniqueid':this[_0x6a34('0xd')][_0x6a34('0x36')],'tags':_0x6a34('0x46'),'description':_0x6a34('0x47')+_0x25d96e[_0x6a34('0x48')][_0x6a34('0x49')](),'priority':_0x25d96e[_0x6a34('0x4a')]})[_0x6a34('0x10')](function(_0x37094c){_0x4f5301(null,_0x37094c);})[_0x6a34('0x14')](function(_0x144d7a){_0x4f5301(_0x144d7a);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x4b')]=function(_0xe37b17,_0x5b848c){this[_0x6a34('0xe')][_0x6a34('0x4c')](_0xe37b17)['then'](function(_0x4328fb){_0x5b848c(null,_0x4328fb?_0x4328fb[_0x6a34('0x11')]:![]);})[_0x6a34('0x14')](function(_0x246099){_0x5b848c(_0x246099);});};AGIVertices['prototype'][_0x6a34('0x4d')]=function(_0x366025,_0x3f9786,_0x2d7ba9){var _0x35008a={'role':_0x6a34('0x4e')};_0x35008a[_0x366025]=this[_0x6a34('0xd')][_0x6a34('0x38')];this[_0x6a34('0xe')][_0x6a34('0x4d')](_0x35008a,_0x3f9786,this[_0x6a34('0xd')][_0x6a34('0x36')])[_0x6a34('0x10')](function(_0x599128){_0x2d7ba9(null,_['isNil'](_0x599128)?![]:!![]);})[_0x6a34('0x14')](function(_0x433989){logger[_0x6a34('0x2b')](_0x433989);_0x2d7ba9(null,![]);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x4f')]=function(_0x1c461f,_0x245a6d){var _0x2eb365={'role':_0x6a34('0x4e')};_0x2eb365[_0x1c461f]=this[_0x6a34('0xd')]['callerid'];this[_0x6a34('0xe')][_0x6a34('0x4f')](_0x2eb365)['then'](function(_0x394803){_0x245a6d(null,_[_0x6a34('0x40')](_0x394803)?![]:!![]);})[_0x6a34('0x14')](function(_0x18b2d4){logger['error'](_0x18b2d4);_0x245a6d(null,![]);});};AGIVertices['prototype'][_0x6a34('0x50')]=function(_0x27461f,_0x69767c){var _0x2818c1={'role':_0x6a34('0x4e')};_0x2818c1[_0x27461f]=this[_0x6a34('0xd')]['callerid'];this[_0x6a34('0xe')][_0x6a34('0x50')](_0x2818c1)['then'](function(_0x5a9971){_0x69767c(null,_['isNil'](_0x5a9971)?![]:!![]);})[_0x6a34('0x14')](function(_0x101d6d){logger[_0x6a34('0x2b')](_0x101d6d);_0x69767c(null,![]);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x51')]=function(_0x1a6765,_0x3bbfa2){var _0x5aaf49={'role':_0x6a34('0x4e')};_0x5aaf49[_0x1a6765]=this[_0x6a34('0xd')][_0x6a34('0x38')];var _0x42b596=_0x1a6765!=_0x6a34('0x52')?util['format'](_0x6a34('0x53'),_0x6a34('0x54'),this[_0x6a34('0xd')][_0x6a34('0x38')]):undefined;this[_0x6a34('0xe')]['agentLogin'](_0x5aaf49,_0x42b596)['then'](function(_0x42f394){_0x3bbfa2(null,_['isNil'](_0x42f394)?![]:!![]);})[_0x6a34('0x14')](function(_0x1fb5f3){logger[_0x6a34('0x2b')](_0x1fb5f3);_0x3bbfa2(null,![]);});};AGIVertices['prototype'][_0x6a34('0x55')]=function(_0x4e262c,_0x50f84a){sh['exec'](_[_0x6a34('0x56')](_0x4e262c),function(_0x559ae7,_0x3793de){var _0x40c236=_0x3793de[_0x6a34('0x57')](/(\r\n|\n|\r)/gm,'');_0x50f84a(null,_0x40c236);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x58')]=function(_0xd0221a,_0x3a0ec1){scripts[_0x6a34('0x58')](_0xd0221a['apiKey'],_0xd0221a[_0x6a34('0x59')]||_0x6a34('0x5a'),_0xd0221a[_0x6a34('0x5a')],_0xd0221a['languageCode']||_0x6a34('0x5b'),_0xd0221a[_0x6a34('0x5c')]||_0x6a34('0x5d'),_0xd0221a[_0x6a34('0x5e')]||'MP3')['then'](function(_0x3e7cb9){_0x3a0ec1(null,_0x3e7cb9);})[_0x6a34('0x14')](function(_0x544c74){_0x3a0ec1(_0x544c74);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x5f')]=function(_0x4745d2,_0x53a5dd){scripts[_0x6a34('0x5f')](_0x4745d2[_0x6a34('0x5a')],_0x4745d2['google_tts_language']||'en',0x1)['then'](function(_0x35e3e6){_0x53a5dd(null,_0x35e3e6);})[_0x6a34('0x14')](function(_0x18fe9e){_0x53a5dd(_0x18fe9e);});};AGIVertices['prototype'][_0x6a34('0x60')]=function(_0x5a7397,_0x4e1c4a){var _0xf5bf73={'uri':_0x5a7397[_0x6a34('0x61')],'method':_0x5a7397[_0x6a34('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a7397[_0x6a34('0x63')])===_0x6a34('0x64')&&parseInt(_0x5a7397[_0x6a34('0x63')])>=0x1?parseInt(_0x5a7397['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x6a34('0x65')]([_0x6a34('0x66'),_0x6a34('0x67')],_0xf5bf73['method'][_0x6a34('0x68')]())){try{_0xf5bf73[_0x6a34('0x69')]=_0x5a7397[_0x6a34('0x6a')]?JSON[_0x6a34('0x6b')](_0x5a7397[_0x6a34('0x6a')]):{};}catch(_0x2c23eb){logger['error'](_0x6a34('0x6c'),_0x2c23eb);}}try{_0xf5bf73[_0x6a34('0x6d')]=_0x5a7397[_0x6a34('0x9')]?JSON['parse'](_0x5a7397['rawHeaders']):{};}catch(_0x1ae6cb){logger[_0x6a34('0x2b')](_0x6a34('0x6e'),_0x1ae6cb);}if(_0x5a7397[_0x6a34('0x6f')]){try{var _0x5e4fd7=require(_0x5a7397[_0x6a34('0x6f')])[_0x6a34('0x70')](this,_0xf5bf73);_0xf5bf73[_0x6a34('0x71')]=Mustache[_0x6a34('0x72')](_0x5a7397['url'],_0x5e4fd7,{},['$$','$$']);if(_0xf5bf73['headers']){_0xf5bf73['headers']=JSON[_0x6a34('0x6b')](Mustache[_0x6a34('0x72')](JSON[_0x6a34('0x73')](_0xf5bf73[_0x6a34('0x6d')]),_0x5e4fd7,{},['$$','$$']));}if(_0xf5bf73[_0x6a34('0x69')]){_0xf5bf73[_0x6a34('0x69')]=JSON['parse'](Mustache[_0x6a34('0x72')](JSON[_0x6a34('0x73')](_0xf5bf73[_0x6a34('0x69')]),_0x5e4fd7,{},['$$','$$']));}}catch(_0x125e77){logger[_0x6a34('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x125e77);}}rp(_0xf5bf73)[_0x6a34('0x10')](function(_0x2663c8){var _0x2b5b1e={'statusCode':_0x2663c8['statusCode']||0xc8,'statusMessage':_0x2663c8[_0x6a34('0x74')]||'OK','headers':_0x2663c8[_0x6a34('0x6d')]||{},'body':_0x2663c8['body']||{}};_0x4e1c4a(null,_0x2b5b1e);})[_0x6a34('0x14')](function(_0x39d099){var _0x5aad50={'statusCode':_0x39d099[_0x6a34('0x75')]||0x1f4,'statusMessage':_0x39d099['message']||_0x6a34('0x76'),'headers':_0x39d099[_0x6a34('0x77')][_0x6a34('0x6d')]||{},'body':_0x39d099[_0x6a34('0x77')][_0x6a34('0x69')]||{}};_0x4e1c4a(null,_0x5aad50);});};AGIVertices['prototype'][_0x6a34('0x78')]=function(_0x45d2b7,_0x5bd3ae){scripts['googleDialogflow'](this['channel'][_0x6a34('0x36')],_0x45d2b7[_0x6a34('0x79')],_0x45d2b7[_0x6a34('0x5a')],_0x45d2b7[_0x6a34('0x7a')]||'en')[_0x6a34('0x10')](function(_0x1b5dc1){_0x5bd3ae(null,_0x1b5dc1);})[_0x6a34('0x14')](function(_0x5a633f){_0x5bd3ae(_0x5a633f);});};AGIVertices['prototype'][_0x6a34('0x7b')]=function(_0x4c69d4,_0x5f3c8a){scripts[_0x6a34('0x7b')](this[_0x6a34('0xd')][_0x6a34('0x36')],_0x4c69d4['dialogflowV2_project_id'],_0x4c69d4['client_email'],_0x4c69d4[_0x6a34('0x7c')],_0x4c69d4['text'],_0x4c69d4[_0x6a34('0x7d')]||'en')[_0x6a34('0x10')](function(_0x2c2ded){_0x5f3c8a(null,_0x2c2ded);})['catch'](function(_0x50501e){_0x5f3c8a(_0x50501e);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x7e')]=function(_0x575908,_0x314939){scripts[_0x6a34('0x7e')](this['channel'],_0x575908)['then'](function(_0x3482fd){_0x314939(null,_0x3482fd);})[_0x6a34('0x14')](function(_0xaef67b){_0x314939(_0xaef67b);});};AGIVertices['prototype']['ispeechTTS']=function(_0x1ecacb,_0x56d20b){scripts[_0x6a34('0x7f')](_0x1ecacb[_0x6a34('0x79')],_0x1ecacb[_0x6a34('0x5a')],_0x1ecacb[_0x6a34('0x80')]||_0x6a34('0x5b'),_0x1ecacb[_0x6a34('0x81')])[_0x6a34('0x10')](function(_0x36d001){_0x56d20b(null,_0x36d001);})['catch'](function(_0x3a15a5){_0x56d20b(_0x3a15a5);});};AGIVertices[_0x6a34('0xf')]['ispeechASR']=function(_0x4a170a,_0x1641bf,_0x36747a){scripts[_0x6a34('0x82')](_0x1641bf,_0x4a170a[_0x6a34('0x79')],_0x4a170a[_0x6a34('0x83')]||_0x6a34('0x5b'),this['isConfigured'](_0x4a170a['model'])?_0x4a170a[_0x6a34('0x84')]:undefined)[_0x6a34('0x10')](function(_0x4fa92b){_0x36747a(null,_0x4fa92b);})[_0x6a34('0x14')](function(_0x4ec5b2){_0x36747a(_0x4ec5b2);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x85')]=function(_0x43145d,_0x15ca6b){scripts[_0x6a34('0x85')](_0x43145d[_0x6a34('0x86')],_0x43145d[_0x6a34('0x87')],_0x43145d['aws_polly_region'],_0x43145d[_0x6a34('0x88')]||_0x6a34('0x89'),_0x43145d[_0x6a34('0x5a')],_0x43145d[_0x6a34('0x8a')]||_0x6a34('0x5a'))[_0x6a34('0x10')](function(_0x117e33){_0x15ca6b(null,_0x117e33);})['catch'](function(_0x38ee27){_0x15ca6b(_0x38ee27);});};AGIVertices[_0x6a34('0xf')]['awsLex']=function(_0x470594,_0x72eed){scripts[_0x6a34('0x8b')](this[_0x6a34('0xd')][_0x6a34('0x36')],_0x470594[_0x6a34('0x86')],_0x470594[_0x6a34('0x87')],_0x470594[_0x6a34('0x8c')],_0x470594[_0x6a34('0x5a')],_0x470594['aws_bot_name'])[_0x6a34('0x10')](function(_0x4c81f6){_0x72eed(null,_0x4c81f6);})[_0x6a34('0x14')](function(_0x4e23da){_0x72eed(_0x4e23da);});};AGIVertices[_0x6a34('0xf')][_0x6a34('0x8d')]=function(_0x910b83,_0x456563,_0x56aec0){scripts[_0x6a34('0x8d')](_0x456563,_0x910b83['key'],_0x910b83[_0x6a34('0x8e')]||_0x6a34('0x5b'))[_0x6a34('0x10')](function(_0x492c2e){_0x56aec0(null,_0x492c2e);})[_0x6a34('0x14')](function(_0x164826){_0x56aec0(_0x164826);});};AGIVertices['prototype'][_0x6a34('0x8f')]=function(_0x866dda,_0x55c9b1,_0x1affb4){scripts[_0x6a34('0x8f')](_0x55c9b1,_0x866dda[_0x6a34('0x90')],_0x866dda[_0x6a34('0x91')],_0x866dda[_0x6a34('0x71')])[_0x6a34('0x10')](function(_0x578026){_0x1affb4(null,_0x578026);})[_0x6a34('0x14')](function(_0x5bd117){_0x1affb4(_0x5bd117);});};AGIVertices['prototype'][_0x6a34('0x92')]=function(_0xfae65e){var _0x4cc5bd=_[_0x6a34('0x65')](verticesWithRetry,_0xfae65e[_0x6a34('0x93')])?_0xfae65e:_[_0x6a34('0x94')](_0xfae65e);for(var _0x3942af in _0x4cc5bd){if(_0x4cc5bd[_0x6a34('0x95')](_0x3942af)){if(_0x4cc5bd[_0x3942af]&&_[_0x6a34('0x96')](_0x4cc5bd[_0x3942af])){if(_['includes'](recursiveMapAttributes,_0x3942af)){_0x4cc5bd[_0x3942af]=this[_0x6a34('0x97')](_0x4cc5bd[_0x3942af]);}else{_0x4cc5bd[_0x3942af]=this[_0x6a34('0x98')](_0x4cc5bd[_0x3942af]);}}}}return _0x4cc5bd;};AGIVertices['prototype'][_0x6a34('0x99')]=function(_0x331eb1){for(var _0x2123e1 in _0x331eb1){if(_0x331eb1[_0x6a34('0x95')](_0x2123e1)){if(_[_0x6a34('0x9a')](_0x331eb1[_0x2123e1])){this[_0x6a34('0x99')](_0x331eb1[_0x2123e1]);}else if(_[_0x6a34('0x9b')](_0x331eb1[_0x2123e1])){for(var _0x49113e=0x0;_0x49113e<_0x331eb1[_0x2123e1][_0x6a34('0x9c')];_0x49113e++){this[_0x6a34('0x99')](_0x331eb1[_0x2123e1][_0x49113e]);}}else if(_[_0x6a34('0x96')](_0x331eb1[_0x2123e1])){_0x331eb1[_0x2123e1]=this['replaceAllVariables'](_0x331eb1[_0x2123e1]);}}}};AGIVertices['prototype'][_0x6a34('0x9d')]=function(_0x34c2f8,_0x4811f6){for(var _0x463965 in _0x34c2f8){if(_0x34c2f8[_0x6a34('0x95')](_0x463965)){if(_[_0x6a34('0x9a')](_0x34c2f8[_0x463965])){if(!_['isEmpty'](_0x34c2f8[_0x463965])){this[_0x6a34('0x9d')](_0x34c2f8[_0x463965],util[_0x6a34('0x28')](_0x6a34('0x9e'),_0x4811f6,_0x463965));}}else if(_[_0x6a34('0x9b')](_0x34c2f8[_0x463965])){for(var _0x46d889=0x0;_0x46d889<_0x34c2f8[_0x463965][_0x6a34('0x9c')];_0x46d889++){this[_0x6a34('0x9d')](_0x34c2f8[_0x463965][_0x46d889],util['format'](_0x6a34('0x9e'),_0x4811f6,_0x463965+'['+_0x46d889+']'));}}else{if(!_[_0x6a34('0x40')](_0x34c2f8[_0x463965])){this['channel'][_0x6a34('0x9f')](util[_0x6a34('0x28')](_0x6a34('0x9e'),_0x4811f6,_0x463965),_0x34c2f8[_0x463965]);}}}}};AGIVertices[_0x6a34('0xf')][_0x6a34('0x97')]=function(_0x3540fd){try{var _0x3b799c=JSON[_0x6a34('0x6b')](_0x3540fd);this[_0x6a34('0x99')](_0x3b799c);return JSON[_0x6a34('0x73')](_0x3b799c);}catch(_0x47418a){return this[_0x6a34('0x98')](_0x3540fd);}};AGIVertices[_0x6a34('0xf')][_0x6a34('0x98')]=function(_0x14ff4f){var _0x5cc2bc=_0x14ff4f[_0x6a34('0xa0')]('{');for(var _0x406206=0x1;_0x406206<_0x5cc2bc[_0x6a34('0x9c')];_0x406206+=0x1){var _0x5b9229=_0x5cc2bc[_0x406206][_0x6a34('0xa0')]('}');if(_0x5b9229[_0x6a34('0x9c')]>0x1){_0x14ff4f=_0x14ff4f[_0x6a34('0xa1')]('{'+_0x5b9229[0x0]+'}',this['channel']['getVariable'](_0x5b9229[0x0])[_0x6a34('0xa2')]||_0x5b9229[0x0]);}}if(_0x5cc2bc[_0x6a34('0x9c')]===0x1){return _0x14ff4f[_0x6a34('0x49')]();}return this[_0x6a34('0x98')](_0x14ff4f);};AGIVertices[_0x6a34('0xf')][_0x6a34('0xa3')]=function(_0x3082b3,_0x21bd85){var _0x384d60=this[_0x6a34('0xd')]['getVariable'](_0x3082b3);if(_0x384d60['result']===-0x1){return _0x384d60;}logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0xa4'),_0x21bd85,_0x384d60['extra']));return this[_0x6a34('0xd')][_0x6a34('0x9f')](_0x21bd85,_0x384d60[_0x6a34('0xa2')]);};AGIVertices[_0x6a34('0xf')][_0x6a34('0xa5')]=function(_0x546474){return _0x546474&&_0x546474!=='0'&&_0x546474!=='-1'&&_0x546474!=='';};AGIVertices['prototype'][_0x6a34('0xa6')]=function(_0x5e27e7){this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x5e27e7,'-');_0x5e27e7[_0x6a34('0xa7')]=_0x5e27e7['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6a34('0xf')]['mrcpsynth']=function(_0x713fa3){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0xa8'),_0x713fa3['label']));if(!this[_0x6a34('0xa5')](_0x713fa3['text'])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0xa9'));}var _0x59f82c='\x22'+_0x713fa3[_0x6a34('0x5a')]+'\x22';if(this[_0x6a34('0xa5')](_0x713fa3['options'])){_0x59f82c+=','+_0x713fa3[_0x6a34('0x77')];}var _0x425dc7=this['channel'][_0x6a34('0xaa')](_0x6a34('0xab'),_0x59f82c);if(_0x425dc7['result']===-0x1){return _0x425dc7;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x59f82c));};AGIVertices['prototype'][_0x6a34('0xad')]=function(_0x5d02e5){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5d02e5[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x5d02e5[_0x6a34('0xae')])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0xaf'));}var _0x152c91=_0x5d02e5[_0x6a34('0xae')];if(this[_0x6a34('0xa5')](_0x5d02e5[_0x6a34('0x77')])){_0x152c91+=','+_0x5d02e5[_0x6a34('0x77')];}var _0x140f6b=this[_0x6a34('0xd')][_0x6a34('0xaa')](_0x6a34('0xb0'),_0x152c91);if(_0x140f6b['result']===-0x1){return _0x140f6b;}var _0x5ec857=this[_0x6a34('0xa3')](_0x6a34('0xb1'),_0x6a34('0xb2'));if(_0x5ec857['result']===-0x1){return _0x5ec857;}var _0x4c7c4f=this[_0x6a34('0xa3')](_0x6a34('0xb3'),_0x6a34('0xb4'));if(_0x4c7c4f[_0x6a34('0xb5')]===-0x1){return _0x4c7c4f;}var _0x35c927=this[_0x6a34('0xa3')]('RECOG_INSTANCE()',_0x6a34('0xb6'));if(_0x35c927['result']===-0x1){return _0x35c927;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0xb7'),_0x152c91));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xb8')]=function(_0x3e3da3){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0xb9'),_0x3e3da3[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0xb8')]([_0x3e3da3['command'],_0x3e3da3['args']]);};AGIVertices[_0x6a34('0xf')][_0x6a34('0xba')]=function(_0x3effe8){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3effe8['label']));if(this[_0x6a34('0xa5')](_0x3effe8[_0x6a34('0x63')])){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3effe8[_0x6a34('0x63')]));var _0x3415f1=this['channel'][_0x6a34('0xbb')](_0x3effe8[_0x6a34('0x63')]);if(_0x3415f1[_0x6a34('0xb5')]===-0x1){return _0x3415f1;}}return this[_0x6a34('0xd')][_0x6a34('0xba')]();};AGIVertices[_0x6a34('0xf')][_0x6a34('0x46')]=function(_0x2c61b7){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0xbc'),_0x2c61b7[_0x6a34('0x37')]));if(!this['isConfigured'](_0x2c61b7['list_id'])){return this['channel']['error'](_0x2c61b7,_0x6a34('0xbd'));}_0x2c61b7[_0x6a34('0x48')]=moment();if(this[_0x6a34('0xa5')](_0x2c61b7[_0x6a34('0xbe')])){_0x2c61b7['scheduledAt']=moment()[_0x6a34('0xbf')](_0x2c61b7[_0x6a34('0xbe')],_0x6a34('0xc0'));}if(!this[_0x6a34('0xa5')](_0x2c61b7[_0x6a34('0x4a')])){_0x2c61b7['callback_priority']=0x2;}this[_0x6a34('0x3f')][_0x6a34('0x70')](this,_0x2c61b7);return this['channel']['noop'](util[_0x6a34('0x28')](_0x6a34('0xc1'),_0x2c61b7[_0x6a34('0x44')],_0x2c61b7[_0x6a34('0x45')],_0x2c61b7[_0x6a34('0x48')]));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xc2')]=function(_0x342cbe){logger['info'](util[_0x6a34('0x28')](_0x6a34('0xc3'),_0x342cbe['label']));var _0x22428f=this[_0x6a34('0xd')][_0x6a34('0xaa')](_0x342cbe[_0x6a34('0xc4')],_0x342cbe[_0x6a34('0x77')]);if(_0x22428f[_0x6a34('0xb5')]===-0x1){return _0x22428f;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util['format'](_0x6a34('0xc5'),_0x342cbe[_0x6a34('0xc4')],_0x342cbe[_0x6a34('0x77')]));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xc6')]=function(_0x1d5a99){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0xc7'),_0x1d5a99[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x1d5a99[_0x6a34('0x5a')])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0xa9'));}var _0x435bf2='\x22'+_0x1d5a99[_0x6a34('0x5a')]+'\x22';if(this[_0x6a34('0xa5')](_0x1d5a99[_0x6a34('0x77')])){_0x435bf2+=','+_0x1d5a99['options'];}var _0x4592b0=this[_0x6a34('0xd')][_0x6a34('0xaa')](_0x6a34('0xab'),_0x435bf2);if(_0x4592b0['result']===-0x1){return _0x4592b0;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0xc8'),_0x435bf2));};AGIVertices['prototype'][_0x6a34('0xc9')]=function(_0x336a3b){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x336a3b[_0x6a34('0x37')]));if(!this['isConfigured'](_0x336a3b['text'])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20text\x20configured');}var _0x21ca18='\x22'+_0x336a3b['text']+'\x22';if(this[_0x6a34('0xa5')](_0x336a3b['options'])){_0x21ca18+=','+_0x336a3b[_0x6a34('0x77')];}var _0x45a1d3=this[_0x6a34('0xd')][_0x6a34('0xaa')]('MRCPSynth',_0x21ca18);if(_0x45a1d3[_0x6a34('0xb5')]===-0x1){return _0x45a1d3;}return this[_0x6a34('0xd')]['noop'](util['format'](_0x6a34('0xc8'),_0x21ca18));};AGIVertices['prototype'][_0x6a34('0xca')]=function(_0x313686){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0xcb'),_0x313686['label']));if(!this[_0x6a34('0xa5')](_0x313686[_0x6a34('0xae')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xaf'));}var _0x503b90=_0x313686[_0x6a34('0xae')];if(this['isConfigured'](_0x313686[_0x6a34('0x77')])){_0x503b90+=','+_0x313686['options'];}var _0x222f48=this[_0x6a34('0xd')]['exec'](_0x6a34('0xb0'),_0x503b90);if(_0x222f48[_0x6a34('0xb5')]===-0x1){return _0x222f48;}var _0x4304b4=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x6a34('0xcc'));if(_0x4304b4[_0x6a34('0xb5')]===-0x1){return _0x4304b4;}var _0x3607f6=this[_0x6a34('0xa3')]('RECOG_INPUT()',_0x6a34('0xcd'));if(_0x3607f6['result']===-0x1){return _0x3607f6;}var _0x101c6f=this[_0x6a34('0xa3')](_0x6a34('0xce'),'LUMENVOX_ASR_INSTANCE');if(_0x101c6f[_0x6a34('0xb5')]===-0x1){return _0x101c6f;}return this[_0x6a34('0xd')]['noop'](util[_0x6a34('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x503b90));};AGIVertices[_0x6a34('0xf')]['sestekasr']=function(_0x1a1b7b){logger['info'](util['format'](_0x6a34('0xcf'),_0x1a1b7b[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x1a1b7b[_0x6a34('0xae')])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0xaf'));}var _0x3d4a21=_0x1a1b7b['grammar'];if(this['isConfigured'](_0x1a1b7b['options'])){_0x3d4a21+=','+_0x1a1b7b[_0x6a34('0x77')];}var _0x1bc79f=this[_0x6a34('0xd')][_0x6a34('0xaa')](_0x6a34('0xb0'),_0x3d4a21);if(_0x1bc79f['result']===-0x1){return _0x1bc79f;}var _0x42b909=this[_0x6a34('0xa3')]('RECOG_CONFIDENCE()',_0x6a34('0xd0'));if(_0x42b909[_0x6a34('0xb5')]===-0x1){return _0x42b909;}var _0x182cc6=this['getAndSetVariable']('RECOG_INPUT()',_0x6a34('0xd1'));if(_0x182cc6[_0x6a34('0xb5')]===-0x1){return _0x182cc6;}var _0x2f3393=this['getAndSetVariable'](_0x6a34('0xce'),_0x6a34('0xd2'));if(_0x2f3393[_0x6a34('0xb5')]===-0x1){return _0x2f3393;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util['format'](_0x6a34('0xb7'),_0x3d4a21));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xd3')]=function(_0x4188e7){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0xd4'),_0x4188e7['label']));if(!this[_0x6a34('0xa5')](_0x4188e7[_0x6a34('0xd5')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x4188e7,_0x6a34('0xd6'));}var _0x543b4f=this[_0x6a34('0x17')]['sync'](this,_0x4188e7[_0x6a34('0xd5')]);if(!_0x543b4f){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x4188e7,_0x6a34('0xd7'));}if(!this['isConfigured'](_0x4188e7[_0x6a34('0x2f')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x4188e7,_0x6a34('0xd8'));}var _0x2a4c36=_0x4188e7['query'][_0x6a34('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0xd9'),_0x2a4c36));var _0xdfa005=this['getQueryOdbc'][_0x6a34('0x70')](this,_0x543b4f,_0x2a4c36);this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x4188e7,_0x2a4c36);if(!this[_0x6a34('0xa5')](_0x4188e7[_0x6a34('0xda')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x21bf45=this[_0x6a34('0xdb')]['sync'](this,_0x4188e7['variable_id']);if(!_0x21bf45){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x4188e7,'no\x20variable\x20found');}var _0x302f99=this;_0xdfa005[_0x6a34('0xdc')](function(_0x5deb16,_0x5ac0f8){Object[_0x6a34('0xdd')](_0x5deb16)[_0x6a34('0xdc')](function(_0x3ff988){_0x302f99[_0x6a34('0xd')][_0x6a34('0x9f')](util['format']('%s[%s][%s]',_0x21bf45,_0x5ac0f8,_0x3ff988),_0x5deb16[_0x3ff988]);});});this[_0x6a34('0xd')]['setVariable'](util[_0x6a34('0x28')](_0x6a34('0xde'),_0x21bf45),_0xdfa005['length']);return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('variable\x20%s\x20set',_0x21bf45));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xdf')]=function(_0x2a06e8){logger[_0x6a34('0xe0')](util[_0x6a34('0x28')](_0x6a34('0xe1'),_0x2a06e8['label']));if(!this[_0x6a34('0xa5')](_0x2a06e8['sip_id'])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x2a06e8,_0x6a34('0xe2'));}var _0x4757d6=this['getUser'][_0x6a34('0x70')](this,_0x2a06e8[_0x6a34('0xe3')]);if(!_0x4757d6){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x2a06e8,_0x6a34('0xe4'));}var _0x3717c8=this['channel'][_0x6a34('0xaa')]('DIAL',[util[_0x6a34('0x28')]('SIP/%s',_0x4757d6),_0x2a06e8[_0x6a34('0x63')],_0x2a06e8[_0x6a34('0xe5')],_0x2a06e8[_0x6a34('0x61')]]);if(_0x3717c8[_0x6a34('0xb5')]===-0x1){return _0x3717c8;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('Executed\x20command\x20%s',_0x6a34('0xe6')));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xe7')]=function(_0x2ab3e4){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0xe8'),_0x2ab3e4['label']));if(!this[_0x6a34('0xa5')](_0x2ab3e4['key'])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xe9'));}if(!this[_0x6a34('0xa5')](_0x2ab3e4[_0x6a34('0x5a')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xa9'));}this[_0x6a34('0xd')]['bot']=!![];this[_0x6a34('0x35')](_0x2ab3e4);this[_0x6a34('0x3e')](_0x2ab3e4['text'],'in','','');this[_0x6a34('0xd')][_0x6a34('0xac')](util['format']('Trying\x20Dialogflow:\x20%s',_0x2ab3e4[_0x6a34('0x5a')]));var _0x5e9977=this['googleDialogflow'][_0x6a34('0x70')](this,_0x2ab3e4);if(_0x5e9977){for(var _0x4d7c8e in _0x5e9977){if(_0x5e9977[_0x6a34('0x95')](_0x4d7c8e)){this[_0x6a34('0xd')][_0x6a34('0x9f')](util['format'](_0x6a34('0xea'),_0x4d7c8e[_0x6a34('0x68')]()),_0x5e9977[_0x4d7c8e]);}}this['createSquareMessage'](_0x5e9977[_0x6a34('0xeb')],_0x6a34('0xec'),'dialogflow','');return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0xed'),_0x5e9977[_0x6a34('0xeb')]));}return this['channel'][_0x6a34('0x2b')](_0x2ab3e4,_0x6a34('0xee'));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xef')]=function(_0x4469bd){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4469bd[_0x6a34('0x37')]));if(!this['isConfigured'](_0x4469bd[_0x6a34('0xf0')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xf1'));}if(!this[_0x6a34('0xa5')](_0x4469bd['client_email'])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xf2'));}if(!this[_0x6a34('0xa5')](_0x4469bd['private_key'])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xf3'));}if(!this[_0x6a34('0xa5')](_0x4469bd['dialogflowV2_language'])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xf4'));}if(!this[_0x6a34('0xa5')](_0x4469bd[_0x6a34('0x5a')])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0xa9'));}this[_0x6a34('0xd')][_0x6a34('0xf5')]=!![];this[_0x6a34('0x35')](_0x4469bd);this['createSquareMessage'](_0x4469bd[_0x6a34('0x5a')],'in','','');this['channel']['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x4469bd[_0x6a34('0x5a')]));var _0x575242=this[_0x6a34('0x7b')][_0x6a34('0x70')](this,_0x4469bd);if(_0x575242){for(var _0x3b88f9 in _0x575242){if(_0x575242['hasOwnProperty'](_0x3b88f9)){if(_0x3b88f9!==_0x6a34('0xf6')){this[_0x6a34('0xd')]['setVariable'](util[_0x6a34('0x28')](_0x6a34('0xea'),_0x3b88f9[_0x6a34('0x68')]()),_0x575242[_0x3b88f9]);}}}this[_0x6a34('0x3e')](_0x575242['speech'],_0x6a34('0xec'),'dialogflowV2',_0x575242['providerResponse']);return this[_0x6a34('0xd')]['noop'](util[_0x6a34('0x28')](_0x6a34('0xf7'),_0x575242[_0x6a34('0xeb')]));}return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x4469bd,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x6a34('0xf')]['sesteknda']=function(_0x40909b){logger['info'](util[_0x6a34('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x40909b[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x40909b['ndauth_url'])){return this['channel'][_0x6a34('0xac')](_0x6a34('0xf8'));}if(!this['isConfigured'](_0x40909b[_0x6a34('0xf9')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xfa'));}if(!this[_0x6a34('0xa5')](_0x40909b[_0x6a34('0xfb')])){return this[_0x6a34('0xd')]['noop']('no\x20password\x20configured');}if(!this[_0x6a34('0xa5')](_0x40909b[_0x6a34('0xfc')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xa9'));}this[_0x6a34('0xd')][_0x6a34('0xf5')]=!![];this[_0x6a34('0x35')](_0x40909b);this['createSquareMessage'](_0x40909b[_0x6a34('0x5a')],'in','','');this[_0x6a34('0xd')]['noop'](util[_0x6a34('0x28')]('Trying\x20SestekNDA:\x20%s',_0x40909b[_0x6a34('0x5a')]));var _0x5c4bbb=this['sestekNDA']['sync'](this,_0x40909b);if(_0x5c4bbb){for(var _0x26e5c7 in _0x5c4bbb){if(_0x5c4bbb['hasOwnProperty'](_0x26e5c7)){this[_0x6a34('0xd')][_0x6a34('0x9f')](util[_0x6a34('0x28')]('SESTEK_NDA_%s',_0x26e5c7[_0x6a34('0x68')]()),_0x5c4bbb[_0x26e5c7]);}}this[_0x6a34('0x3e')](_0x5c4bbb[_0x6a34('0xeb')],_0x6a34('0xec'),'sesteknda','');if(_0x5c4bbb[_0x6a34('0xfd')]){this['channel'][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0xfe'),_0x5c4bbb[_0x6a34('0xfd')]));var _0x12a26f=this[_0x6a34('0xd')][_0x6a34('0xff')](_0x5c4bbb[_0x6a34('0xfd')]);try{fs[_0x6a34('0x100')](_0x5c4bbb[_0x6a34('0xfd')]+_0x6a34('0x101'));}catch(_0x1809f0){logger['error'](_0x1809f0);}return _0x12a26f;}else{return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x102'),_0x5c4bbb['speech']));}}return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x40909b,_0x6a34('0x103'));};AGIVertices['prototype'][_0x6a34('0x104')]=function(_0x7dd843){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x105'),_0x7dd843[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x104'));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x106')]=function(_0x2733f7){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2733f7[_0x6a34('0x37')]));var _0x8d0753='';if(_0x2733f7[_0x6a34('0x107')]){if(!this[_0x6a34('0xa5')](_0x2733f7[_0x6a34('0x107')])){return this['channel']['error'](_0x2733f7,'no\x20trunk\x20selected');}else{var _0x5ba0ec=parseInt(_0x2733f7['trunk_id'],0xa);if(isNaN(_0x5ba0ec)){_0x8d0753=_0x2733f7[_0x6a34('0x107')];}else{_0x8d0753=this[_0x6a34('0x1b')][_0x6a34('0x70')](this,_0x2733f7[_0x6a34('0x107')]);if(!_0x8d0753){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x2733f7,_0x6a34('0x108'));}}}}else if(_0x2733f7['trunk_name']){_0x8d0753=_0x2733f7[_0x6a34('0x109')];}else{return this['channel'][_0x6a34('0x2b')](_0x2733f7,_0x6a34('0x10a'));}var _0x17d23b=this['channel']['exec'](_0x6a34('0xe6'),[util[_0x6a34('0x28')]('SIP/%s/%s',_0x8d0753,_0x2733f7[_0x6a34('0x44')]),_0x2733f7[_0x6a34('0x63')],_0x2733f7[_0x6a34('0xe5')],_0x2733f7[_0x6a34('0x61')]]);if(_0x17d23b[_0x6a34('0xb5')]===-0x1){return _0x17d23b;}return this['channel'][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x10b'),_0x6a34('0xe6')));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x10c')]=function(_0x35899d){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x10d'),_0x35899d[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x10c'));};AGIVertices[_0x6a34('0xf')][_0x6a34('0xb')]=function(_0x50dd84){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x50dd84[_0x6a34('0x37')]));if(_0x50dd84[_0x6a34('0xa7')]===0x0){return this[_0x6a34('0xa6')](_0x50dd84);}_0x50dd84[_0x6a34('0xa7')]-=0x1;if(!this['isConfigured'](_0x50dd84[_0x6a34('0x10e')])){return this[_0x6a34('0xd')]['error'](_0x50dd84,_0x6a34('0x10f'));}var _0x259a4a=this['getSound'][_0x6a34('0x70')](this,_0x50dd84['file_id']);if(!_0x259a4a){return this[_0x6a34('0xd')]['error'](_0x50dd84,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x50dd84['variable_id'])){return this[_0x6a34('0xd')]['error'](_0x6a34('0x110'));}var _0x4d0add=this[_0x6a34('0xd')][_0x6a34('0x111')](_0x259a4a,_0x50dd84[_0x6a34('0x112')],_0x50dd84[_0x6a34('0x113')]);var _0xa1c0b7=_0x4d0add[_0x6a34('0xb5')]?_0x4d0add[_0x6a34('0xb5')]['toString']():'';logger[_0x6a34('0x2d')](_0x6a34('0x114'),JSON[_0x6a34('0x73')](_0x4d0add));if(_0x4d0add['result']===-0x1){this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x50dd84,_0xa1c0b7);return _0x4d0add;}else if(_0x4d0add[_0x6a34('0xa2')]===_0x6a34('0x63')){_0x4d0add[_0x6a34('0xb5')]=_0xa1c0b7[_0x6a34('0x9c')]>=parseInt(_0x50dd84[_0x6a34('0x115')])?'x':'i';}else{_0x4d0add[_0x6a34('0xb5')]=_0xa1c0b7[_0x6a34('0x9c')]>=parseInt(_0x50dd84[_0x6a34('0x115')])&&_0xa1c0b7['length']<=parseInt(_0x50dd84['maxdigit'])?'x':'i';}var _0x60727c=this['getVariable']['sync'](this,_0x50dd84[_0x6a34('0xda')]);if(!_0x60727c){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x50dd84,_0x6a34('0x116'));}this['channel'][_0x6a34('0x9f')](_0x60727c,_0xa1c0b7);if(this[_0x6a34('0xa5')](_0x50dd84['hiddendigitsnum'])){var _0x46ab99=parseInt(_0x50dd84[_0x6a34('0x117')],0xa);var _0xb89577=rs[_0x6a34('0x118')]({'charset':'*','length':_0x46ab99});var _0x566432=_0xa1c0b7[_0x6a34('0x9c')];if(_0x566432>0x0){if(_0x566432>_0x46ab99){this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x50dd84,_0x50dd84[_0x6a34('0x119')]===_0x6a34('0x11a')?_0xb89577+_0xa1c0b7[_0x6a34('0x11b')](_0x46ab99):_0xa1c0b7[_0x6a34('0x11b')](0x0,_0x566432-_0x46ab99)+_0xb89577);}else{this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x50dd84,rs[_0x6a34('0x118')]({'charset':'*','length':_0x566432}));}}else{this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x50dd84,'');}}else{this['createSquareDetailsReport'][_0x6a34('0x70')](this,_0x50dd84,_0xa1c0b7);}return _0x4d0add;};AGIVertices['prototype'][_0x6a34('0xc')]=function(_0x45dd41){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x11c'),_0x45dd41[_0x6a34('0x37')]));return this[_0x6a34('0xb')](_0x45dd41);};AGIVertices['prototype']['goal']=function(_0x2cfc51){logger[_0x6a34('0x2d')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2cfc51[_0x6a34('0x37')]));this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x2cfc51,_0x2cfc51[_0x6a34('0x11d')]);return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('GOAL\x20%s',_0x2cfc51[_0x6a34('0x11d')]));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x11e')]=function(_0x8508bf){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x11f'),_0x8508bf[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x8508bf[_0x6a34('0x86')])||!this[_0x6a34('0xa5')](_0x8508bf[_0x6a34('0x87')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x120'));}if(!this[_0x6a34('0xa5')](_0x8508bf['text'])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xa9'));}this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x121'),_0x8508bf['text']));var _0x1ead85=this[_0x6a34('0x85')][_0x6a34('0x70')](this,_0x8508bf);if(_0x1ead85){this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x122'),_0x1ead85));var _0x589241=this[_0x6a34('0xd')][_0x6a34('0xff')](_0x1ead85);try{fs['unlink'](_0x1ead85+_0x6a34('0x101'));}catch(_0x111779){logger[_0x6a34('0x2b')](_0x111779);}return _0x589241;}return this['channel']['error'](_0x8508bf,_0x6a34('0x123'));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x124')]=function(_0x53fe72){logger[_0x6a34('0x2d')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x53fe72[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x53fe72['aws_access_key_id'])||!this[_0x6a34('0xa5')](_0x53fe72['aws_secret_access_key'])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0x120'));}if(!this['isConfigured'](_0x53fe72[_0x6a34('0x125')])){return this['channel']['noop'](_0x6a34('0x126'));}if(!this[_0x6a34('0xa5')](_0x53fe72[_0x6a34('0x5a')])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x6a34('0x35')](_0x53fe72);this['createSquareMessage'](_0x53fe72[_0x6a34('0x5a')],'in','','');this['channel']['noop'](util[_0x6a34('0x28')](_0x6a34('0x127'),_0x53fe72[_0x6a34('0x5a')]));var _0x1a270b=this[_0x6a34('0x8b')][_0x6a34('0x70')](this,_0x53fe72);if(_0x1a270b){for(var _0x18a814 in _0x1a270b){if(_0x1a270b[_0x6a34('0x95')](_0x18a814)&&_['isString'](_0x1a270b[_0x18a814])){this[_0x6a34('0xd')]['setVariable'](util[_0x6a34('0x28')](_0x6a34('0x128'),_0x18a814[_0x6a34('0x68')]()),_0x1a270b[_0x18a814]);}}if(_[_0x6a34('0x40')](_0x1a270b['message'])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0x129'));}else{this[_0x6a34('0x3e')](_0x1a270b[_0x6a34('0x12a')],_0x6a34('0xec'),_0x6a34('0x12b'),'');return this['channel'][_0x6a34('0xac')](util['format'](_0x6a34('0x12c'),_0x1a270b[_0x6a34('0x12a')]));}}return this['channel'][_0x6a34('0x2b')](_0x53fe72,_0x6a34('0x12d'));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x12e')]=function(_0x577ce2){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x12f'),_0x577ce2['label'],_0x577ce2[_0x6a34('0x63')]));if(!this['isConfigured'](_0x577ce2[_0x6a34('0x79')])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20key\x20configured');}var _0x31b176=_0x6a34('0x130');var _0x1494aa=util[_0x6a34('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x551078=util[_0x6a34('0x28')]('%s.%s',_0x1494aa,_0x31b176);var _0x2633af=!![];if(_0x577ce2[_0x6a34('0x131')]===_0x6a34('0x132')){_0x2633af=![];}var _0x5c60ad=this[_0x6a34('0xd')][_0x6a34('0x133')](_0x1494aa,_0x31b176,_0x577ce2['intKey'],_0x577ce2[_0x6a34('0x63')],undefined,_0x2633af);if(_0x5c60ad[_0x6a34('0xb5')]!==-0x1){this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('google\x20%s\x20file\x20created',_0x551078));var _0x4936cf=this[_0x6a34('0x8d')][_0x6a34('0x70')](this,_0x577ce2,_0x551078);if(_0x4936cf){for(var _0x1b67cd in _0x4936cf){if(_0x4936cf['hasOwnProperty'](_0x1b67cd)){this[_0x6a34('0xd')][_0x6a34('0x9f')](util['format']('GOOGLE_ASR_%s',_0x1b67cd[_0x6a34('0x68')]()),_0x4936cf[_0x1b67cd]);}}return this['channel'][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x134'),JSON[_0x6a34('0x73')](_0x4936cf)));}}return _0x5c60ad;};AGIVertices[_0x6a34('0xf')][_0x6a34('0x135')]=function(_0x150829){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x136'),_0x150829[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x150829['appid'])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20appid\x20configured');}if(!this[_0x6a34('0xa5')](_0x150829[_0x6a34('0x91')])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20appsecret\x20configured');}var _0x4b9315='wav';var _0x56d046=util[_0x6a34('0x28')](_0x6a34('0x137'),FILES_PATH,rs[_0x6a34('0x118')](0x4));var _0x3e5272=util['format'](_0x6a34('0x9e'),_0x56d046,_0x4b9315);var _0x162332=!![];if(_0x150829[_0x6a34('0x131')]===_0x6a34('0x132')){_0x162332=![];}var _0x174569=this[_0x6a34('0xd')][_0x6a34('0x133')](_0x56d046,_0x4b9315,_0x150829[_0x6a34('0x138')],_0x150829[_0x6a34('0x63')],undefined,_0x162332);if(_0x174569[_0x6a34('0xb5')]!==-0x1){this[_0x6a34('0xd')]['noop'](util[_0x6a34('0x28')](_0x6a34('0x139'),_0x3e5272));var _0x3a496b=this[_0x6a34('0x8f')]['sync'](this,_0x150829,_0x3e5272);if(_0x3a496b){for(var _0x20befd in _0x3a496b){if(_0x3a496b[_0x6a34('0x95')](_0x20befd)){this['channel'][_0x6a34('0x9f')](util[_0x6a34('0x28')](_0x6a34('0x13a'),_0x20befd[_0x6a34('0x68')]()),_0x3a496b[_0x20befd]);}}return this[_0x6a34('0xd')][_0x6a34('0xac')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x3a496b)));}}return _0x174569;};AGIVertices['prototype'][_0x6a34('0x13b')]=function(_0x2a4211){logger['info'](util[_0x6a34('0x28')](_0x6a34('0x13c'),_0x2a4211['label']));return this[_0x6a34('0xd')]['continueAt'](_0x2a4211[_0x6a34('0x3a')],_0x2a4211[_0x6a34('0x3b')],_0x2a4211[_0x6a34('0x13d')]);};AGIVertices[_0x6a34('0xf')][_0x6a34('0x13e')]=function(_0x140fa4){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x140fa4[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x140fa4[_0x6a34('0x13f')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x140fa4,_0x6a34('0x140'));}try{var _0x137e50=eval(_0x140fa4[_0x6a34('0x13f')])?_0x6a34('0x141'):_0x6a34('0x142');this['channel']['noop'](util['format'](_0x6a34('0x143'),_0x140fa4[_0x6a34('0x13f')],_0x137e50));return{'code':0xc8,'result':_0x137e50};}catch(_0x2dda9d){return{'code':0xc8,'result':_0x6a34('0x142')};}};AGIVertices[_0x6a34('0xf')][_0x6a34('0x144')]=function(_0x28b975){logger['info'](util[_0x6a34('0x28')](_0x6a34('0x145'),_0x28b975[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x28b975[_0x6a34('0x146')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x28b975,'no\x20interval\x20configured');}var _0x2f4652=this['getIntervals']['sync'](this,_0x28b975['interval_id']);if(!_0x2f4652){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x28b975,_0x6a34('0x147'));}for(var _0x3f4028=0x0;_0x3f4028<_0x2f4652['length'];_0x3f4028+=0x1){var _0x5b7f59=this[_0x6a34('0xd')][_0x6a34('0xdb')](util['format'](_0x6a34('0x148'),_0x2f4652[_0x3f4028]));if(_0x5b7f59[_0x6a34('0xb5')]===-0x1){return _0x5b7f59;}logger['info'](util[_0x6a34('0x28')](_0x6a34('0x149'),_0x2f4652[_0x3f4028],_0x5b7f59[_0x6a34('0xa2')]));if(_0x5b7f59[_0x6a34('0xa2')]===_0x6a34('0x141')){logger['info'](util[_0x6a34('0x28')]('IFTIME\x20%s\x20%s',_0x2f4652[_0x3f4028],_0x6a34('0x141')));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('IFTIME\x20%s\x20%s',_0x2f4652[_0x3f4028],_0x6a34('0x141')));return{'code':0xc8,'result':'true'};}else{logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x149'),_0x2f4652[_0x3f4028],_0x6a34('0x142')));this[_0x6a34('0xd')]['noop'](util[_0x6a34('0x28')](_0x6a34('0x149'),_0x2f4652[_0x3f4028],_0x6a34('0x142')));}}return{'code':0xc8,'result':_0x6a34('0x142')};};AGIVertices[_0x6a34('0xf')][_0x6a34('0x14a')]=function(_0x48895d){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x14b'),_0x48895d[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0x14a')]();};AGIVertices[_0x6a34('0xf')][_0x6a34('0x14c')]=function(_0x2769af){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x14d'),_0x2769af[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x2769af[_0x6a34('0x79')])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20key\x20configured');}var _0x54333c=_0x6a34('0x130');var _0x2209bf=util[_0x6a34('0x28')](_0x6a34('0x137'),FILES_PATH,rs[_0x6a34('0x118')](0x4));var _0x36ead3=util[_0x6a34('0x28')](_0x6a34('0x9e'),_0x2209bf,_0x54333c);var _0xe62a3=!![];if(_0x2769af['beep']===_0x6a34('0x132')){_0xe62a3=![];}var _0x33a7df=this[_0x6a34('0xd')][_0x6a34('0x133')](_0x2209bf,_0x54333c,_0x2769af['intKey'],_0x2769af['timeout'],undefined,_0xe62a3);if(_0x33a7df[_0x6a34('0xb5')]!==-0x1){this[_0x6a34('0xd')][_0x6a34('0xac')](util['format'](_0x6a34('0x14e'),_0x36ead3));var _0x56876c=this[_0x6a34('0x82')][_0x6a34('0x70')](this,_0x2769af,_0x36ead3);if(_0x56876c){for(var _0x17bd31 in _0x56876c){if(_0x56876c[_0x6a34('0x95')](_0x17bd31)){this['channel']['setVariable'](util['format'](_0x6a34('0x14f'),_0x17bd31[_0x6a34('0x68')]()),_0x56876c[_0x17bd31]);}}return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x150'),JSON[_0x6a34('0x73')](_0x56876c)));}}return _0x33a7df;};AGIVertices[_0x6a34('0xf')][_0x6a34('0x151')]=function(_0x3f8a99){logger['info'](util[_0x6a34('0x28')](_0x6a34('0x152'),_0x3f8a99[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x3f8a99[_0x6a34('0x79')])){return this['channel'][_0x6a34('0xac')](_0x6a34('0xe9'));}if(!this[_0x6a34('0xa5')](_0x3f8a99['text'])){return this[_0x6a34('0xd')][_0x6a34('0xac')]('no\x20text\x20configured');}this['channel'][_0x6a34('0xac')](util[_0x6a34('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x3f8a99[_0x6a34('0x5a')]));var _0x496aaa=this['ispeechTTS'][_0x6a34('0x70')](this,_0x3f8a99);if(_0x496aaa){this['channel'][_0x6a34('0xac')](util['format'](_0x6a34('0x14e'),_0x496aaa));var _0x3d96ab=this['channel'][_0x6a34('0xff')](_0x496aaa,_0x3f8a99['intKey']);try{fs[_0x6a34('0x100')](_0x496aaa+'.wav');}catch(_0x141d78){logger[_0x6a34('0x2b')](_0x141d78);}return _0x3d96ab;}return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x3f8a99,_0x6a34('0x153'));};AGIVertices['prototype'][_0x6a34('0x154')]=function(_0x9d2a56){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x9d2a56[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x9d2a56['findBy'])){return this[_0x6a34('0xd')]['error'](_0x9d2a56,_0x6a34('0x155'));}logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x156'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x9d2a56[_0x6a34('0x157')]));var _0x13e3c6=this[_0x6a34('0x51')][_0x6a34('0x70')](this,_0x9d2a56['findBy']);if(_0x13e3c6){logger[_0x6a34('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a34('0xd')][_0x6a34('0x38')],_0x9d2a56[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x158'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x9d2a56['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x159'),this['channel'][_0x6a34('0x38')],_0x9d2a56[_0x6a34('0x157')]));this['channel']['noop'](util[_0x6a34('0x28')](_0x6a34('0x159'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x9d2a56[_0x6a34('0x157')]));return{'code':0xc8,'result':_0x6a34('0x15a')};}};AGIVertices[_0x6a34('0xf')]['logout']=function(_0x47a0d4){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x15b'),_0x47a0d4['label']));if(!this[_0x6a34('0xa5')](_0x47a0d4[_0x6a34('0x157')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x47a0d4,_0x6a34('0x155'));}logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x156'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x47a0d4[_0x6a34('0x157')]));var _0x4de01b=this[_0x6a34('0x50')][_0x6a34('0x70')](this,_0x47a0d4[_0x6a34('0x157')]);if(_0x4de01b){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x158'),this['channel'][_0x6a34('0x38')],_0x47a0d4[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util['format'](_0x6a34('0x158'),this['channel']['callerid'],_0x47a0d4['findBy']));return{'code':0xc8,'result':_0x6a34('0x15c')};}else{logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x159'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x47a0d4[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x159'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x47a0d4[_0x6a34('0x157')]));return{'code':0xc8,'result':_0x6a34('0x15a')};}};AGIVertices['prototype'][_0x6a34('0x15d')]=function(_0x5ae535){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x15e'),_0x5ae535[_0x6a34('0x37')]));if(!this['isConfigured'](_0x5ae535[_0x6a34('0x15f')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x5ae535,_0x6a34('0x160'));}this[_0x6a34('0xd')]['noop'](util['format'](_0x6a34('0x161'),_0x5ae535['operation']));var _0x5d8c7b=eval(_0x5ae535[_0x6a34('0x15f')]);if(!this[_0x6a34('0xa5')](_0x5ae535[_0x6a34('0xda')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x110'));}var _0x27afee=this[_0x6a34('0xdb')][_0x6a34('0x70')](this,_0x5ae535[_0x6a34('0xda')]);if(!_0x27afee){return this['channel'][_0x6a34('0x2b')](_0x5ae535,_0x6a34('0x116'));}if(_[_0x6a34('0x9b')](_0x5d8c7b)){var _0x15ab20=this;_0x5d8c7b[_0x6a34('0xdc')](function(_0x1e2c3d,_0x28419c){_0x15ab20['channel']['setVariable'](util[_0x6a34('0x28')](_0x6a34('0x162'),_0x27afee,_0x28419c),_0x1e2c3d);});return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x163'),_0x27afee));}else{return this[_0x6a34('0xd')][_0x6a34('0x9f')](_0x27afee,_0x5d8c7b);}};AGIVertices['prototype'][_0x6a34('0xa')]=function(_0x3893cc){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x164'),_0x3893cc[_0x6a34('0x37')]));if(_0x3893cc[_0x6a34('0xa7')]===0x0){return this['maxRetry'](_0x3893cc);}_0x3893cc[_0x6a34('0xa7')]-=0x1;if(!this['isConfigured'](_0x3893cc['file_id'])){return this['channel']['error'](_0x3893cc,'no\x20file\x20audio\x20selected');}var _0x10f558=this[_0x6a34('0x1d')][_0x6a34('0x70')](this,_0x3893cc[_0x6a34('0x10e')]);if(!_0x10f558){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x3893cc,_0x6a34('0x165'));}var _0x5f4f44=this[_0x6a34('0xd')][_0x6a34('0x111')](_0x10f558,_0x3893cc[_0x6a34('0x112')],_0x3893cc[_0x6a34('0x166')]);var _0x4d9012=_0x5f4f44['result'];if(_0x5f4f44[_0x6a34('0xb5')]===-0x1){this['createSquareDetailsReport'][_0x6a34('0x70')](this,_0x3893cc,'-1');return _0x5f4f44;}else if(_0x5f4f44[_0x6a34('0xa2')]===_0x6a34('0x63')){_0x5f4f44[_0x6a34('0xb5')]=_0x5f4f44[_0x6a34('0xb5')][_0x6a34('0x9c')]>0x0?_0x5f4f44[_0x6a34('0xb5')]:'t';}else if(_[_0x6a34('0x42')](_0x5f4f44['result'])){_0x5f4f44[_0x6a34('0xb5')]='#';_0x4d9012='#';}if(!this['isConfigured'](_0x3893cc[_0x6a34('0xda')])){this[_0x6a34('0xd')]['noop'](_0x6a34('0x110'));}else{var _0x524d74=this[_0x6a34('0xdb')][_0x6a34('0x70')](this,_0x3893cc[_0x6a34('0xda')]);if(!_0x524d74){return this['channel'][_0x6a34('0x2b')](_0x3893cc,_0x6a34('0x116'));}this[_0x6a34('0xd')][_0x6a34('0x9f')](_0x524d74,_0x4d9012);}this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x3893cc,_0x4d9012);return _0x5f4f44;};AGIVertices[_0x6a34('0xf')][_0x6a34('0xac')]=function(_0x56ff6){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x56ff6[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x56ff6[_0x6a34('0x167')]||_0x56ff6[_0x6a34('0x37')]);};AGIVertices[_0x6a34('0xf')]['pause']=function(_0x3ffa1a){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x168'),_0x3ffa1a[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x3ffa1a[_0x6a34('0x157')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x3ffa1a,'no\x20find\x20by\x20configured');}logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6a34('0xd')]['callerid'],_0x3ffa1a[_0x6a34('0x157')]));var _0x1245df=this[_0x6a34('0x4b')][_0x6a34('0x70')](this,_0x3ffa1a[_0x6a34('0x169')]);var _0x45f7b6=this['agentPause']['sync'](this,_0x3ffa1a[_0x6a34('0x157')],_0x1245df);if(_0x45f7b6){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x158'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x3ffa1a[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x158'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x3ffa1a[_0x6a34('0x157')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x6a34('0x28')](_0x6a34('0x159'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x3ffa1a[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x158'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x3ffa1a[_0x6a34('0x157')]));return{'code':0xc8,'result':_0x6a34('0x15a')};}};AGIVertices[_0x6a34('0xf')]['playback']=function(_0xe5b7d){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0xe5b7d[_0x6a34('0x37')]));if(!this['isConfigured'](_0xe5b7d[_0x6a34('0x10e')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0xe5b7d,_0x6a34('0x10f'));}var _0x78b04c=this[_0x6a34('0x1d')]['sync'](this,_0xe5b7d[_0x6a34('0x10e')]);if(!_0x78b04c){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0xe5b7d,_0x6a34('0x165'));}var _0x4589c7=this[_0x6a34('0xd')][_0x6a34('0xaa')]('PLAYBACK',[_0x78b04c,_0xe5b7d[_0x6a34('0xe5')]]);if(_0x4589c7[_0x6a34('0xb5')]===-0x1){return _0x4589c7;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('Executed\x20command\x20%s\x20%s',_0x6a34('0x16a'),_0x78b04c));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x16b')]=function(_0x589ed3){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x589ed3[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x589ed3[_0x6a34('0x16c')])){return this[_0x6a34('0xd')]['error'](_0x589ed3,'no\x20queue\x20selected');}var _0x2affef='';var _0x2078fc=parseInt(_0x589ed3[_0x6a34('0x16c')],0xa);if(isNaN(_0x2078fc)){_0x2affef=_0x589ed3[_0x6a34('0x16c')];}else{_0x2affef=this[_0x6a34('0x12')][_0x6a34('0x70')](this,_0x589ed3['queue_id']);if(!_0x2affef){return this['channel'][_0x6a34('0x2b')](_0x589ed3,_0x6a34('0x16d'));}}var _0x44e65c='';if(this['isConfigured'](_0x589ed3[_0x6a34('0x10e')])){var _0x33b009=this[_0x6a34('0x1d')][_0x6a34('0x70')](this,_0x589ed3[_0x6a34('0x10e')]);if(_0x33b009){_0x44e65c=_0x33b009;}}this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x589ed3,_0x2affef);if(_0x589ed3['opts'][_0x6a34('0x16e')]('x')<0x0){_0x589ed3['opts']+='x';}if(_0x589ed3[_0x6a34('0xe5')]['indexOf']('X')<0x0){_0x589ed3[_0x6a34('0xe5')]+='X';}this[_0x6a34('0xd')][_0x6a34('0x9f')]('XMCS-QUEUE',_0x2affef?_0x2affef[_0x6a34('0x16f')]():'');var _0x2cb36d=this[_0x6a34('0xd')][_0x6a34('0xaa')]('QUEUE',[_0x2affef,_0x589ed3[_0x6a34('0xe5')],_0x589ed3['url'],_0x44e65c,_0x589ed3['timeout'],_0x589ed3['agi'],_0x589ed3[_0x6a34('0x170')],_0x589ed3[_0x6a34('0x171')],'',_0x589ed3[_0x6a34('0x172')]]);if(_0x2cb36d[_0x6a34('0xb5')]===-0x1){return _0x2cb36d;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0x2affef));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x173')]=function(_0x54c4ea){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x174'),_0x54c4ea['label']));var _0x59788c=_0x54c4ea['recordingFormat']||_0x6a34('0x130');var _0x199696=util[_0x6a34('0x28')]('%s_%s',this[_0x6a34('0xd')]['uniqueid'],rs[_0x6a34('0x118')](0x5));var _0x35eebe=util[_0x6a34('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0x199696,_0x59788c);var _0x13f6bf=util['format'](_0x6a34('0x137'),FILES_PATH,_0x199696);this['createSquareRecording'][_0x6a34('0x70')](this,_0x54c4ea,_0x199696,_0x35eebe);this[_0x6a34('0xd')][_0x6a34('0x9f')](_0x6a34('0x175'),_0x199696);logger[_0x6a34('0x2d')](_0x6a34('0x176'),_0x13f6bf,_0x59788c,_0x54c4ea[_0x6a34('0x177')],_0x54c4ea[_0x6a34('0x63')]);return this[_0x6a34('0xd')][_0x6a34('0x133')](_0x13f6bf,_0x59788c,_0x54c4ea['escape_digits'],_0x54c4ea['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x6a34('0x178')]=function(_0x5ca8dd){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x179'),_0x5ca8dd[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x5ca8dd[_0x6a34('0x61')])){return this[_0x6a34('0xd')]['noop'](_0x6a34('0x17a'));}var _0x3cc3a7=this[_0x6a34('0x60')][_0x6a34('0x70')](this,_0x5ca8dd);logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x17b'),util[_0x6a34('0x17c')](_0x3cc3a7,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5ca8dd[_0x6a34('0xda')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x17d'));}var _0x1f2897=this['getVariable'][_0x6a34('0x70')](this,_0x5ca8dd[_0x6a34('0xda')]);if(!_0x1f2897){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x5ca8dd,_0x6a34('0x116'));}this[_0x6a34('0xd')][_0x6a34('0x9f')](util[_0x6a34('0x28')]('%s_STATUS_CODE',_0x1f2897),_0x3cc3a7[_0x6a34('0x75')]?_0x3cc3a7[_0x6a34('0x75')]:'200');this['channel'][_0x6a34('0x9f')](util[_0x6a34('0x28')]('%s_STATUS_MESSAGE',_0x1f2897),_0x3cc3a7[_0x6a34('0x74')]?_0x3cc3a7[_0x6a34('0x74')]:'OK');if(_0x3cc3a7['body']){try{this[_0x6a34('0x9d')](_0x3cc3a7[_0x6a34('0x69')],_0x1f2897);}catch(_0x5f30c0){logger['error'](util[_0x6a34('0x28')](_0x6a34('0x17e'),_0x1f2897));}}return this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x17f'),_0x1f2897));};AGIVertices['prototype'][_0x6a34('0x180')]=function(_0x3ed735){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x181'),_0x3ed735[_0x6a34('0x37')]));return this[_0x6a34('0xd')]['sayDigits'](_0x3ed735['digits'][_0x6a34('0x57')](/\s+/g,''),_0x3ed735[_0x6a34('0x177')]);};AGIVertices[_0x6a34('0xf')]['saynumber']=function(_0x55ebb6){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x182'),_0x55ebb6[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0x183')](_0x55ebb6[_0x6a34('0x64')][_0x6a34('0x57')](/\s+/g,''),_0x55ebb6['escape_digits']);};AGIVertices[_0x6a34('0xf')][_0x6a34('0x184')]=function(_0x5be0a2){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5be0a2[_0x6a34('0x37')]));return this[_0x6a34('0xd')][_0x6a34('0x185')](_0x5be0a2[_0x6a34('0x5a')],_0x5be0a2['escape_digits']);};AGIVertices['prototype'][_0x6a34('0x186')]=function(_0x392b46){logger['info'](util['format'](_0x6a34('0x187'),_0x392b46[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x392b46[_0x6a34('0x188')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x189'));}var _0xcfcbe3=this[_0x6a34('0x1e')]['sync'](this,_0x392b46[_0x6a34('0x188')]);if(!_0xcfcbe3||!_0xcfcbe3[_0x6a34('0x18a')]){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x392b46,_0x6a34('0x18b'));}var _0x3ea220={'from':util[_0x6a34('0x28')](_0x6a34('0x18c'),_0xcfcbe3[_0x6a34('0x11')],_0xcfcbe3['email']||_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x18d')]),'to':_0x392b46['to']||'','cc':_0x392b46['cc']||'','bcc':_0x392b46['bcc']||'','subject':_0x392b46[_0x6a34('0x18e')],'html':_0x392b46[_0x6a34('0x5a')],'text':_0x392b46[_0x6a34('0x5a')]};var _0xb0210d={'tls':{'rejectUnauthorized':![]}};if(_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x18f')]){_0xb0210d[_0x6a34('0x18f')]=_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x18f')];}else{_0xb0210d[_0x6a34('0x190')]=_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x190')];_0xb0210d[_0x6a34('0x191')]=_0xcfcbe3[_0x6a34('0x18a')]['port'];_0xb0210d[_0x6a34('0x192')]=_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x192')];}if(_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x193')]){_0xb0210d[_0x6a34('0x194')]={'user':_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x18d')],'pass':_0xcfcbe3[_0x6a34('0x18a')][_0x6a34('0x195')]};}if(this[_0x6a34('0xa5')](_0x392b46['template_id'])){}logger[_0x6a34('0xe0')]('sendMail\x20message',JSON[_0x6a34('0x73')](_0x3ea220));this['createSquareDetailsReport'][_0x6a34('0x70')](this,_0x392b46,_0x392b46[_0x6a34('0x188')]);this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xcfcbe3[_0x6a34('0x11')]));this[_0x6a34('0x20')][_0x6a34('0x70')](this,_0xb0210d,_0x3ea220);return this['channel'][_0x6a34('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6a34('0xf')][_0x6a34('0x196')]=function(_0x2101dd){logger['info'](util['format'](_0x6a34('0x197'),_0x2101dd['label']));return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x198'));};AGIVertices['prototype'][_0x6a34('0x199')]=function(_0x1bf264){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x19a'),_0x1bf264['label']));if(!this['isConfigured'](_0x1bf264[_0x6a34('0x19b')])){return this['channel'][_0x6a34('0xac')](_0x6a34('0x19c'));}var _0x2674ef=this[_0x6a34('0x32')][_0x6a34('0x70')](this,_0x1bf264['sms_account_id']);if(!_0x2674ef){return this['channel'][_0x6a34('0x2b')](_0x1bf264,_0x6a34('0x19d'));}var _0x104143={'body':_0x1bf264[_0x6a34('0x19e')],'phone':_0x1bf264['to']||'','SmsAccountId':_0x2674ef['id']};logger[_0x6a34('0xe0')](_0x6a34('0x19f'),JSON[_0x6a34('0x73')](_0x104143));this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x1bf264,_0x1bf264[_0x6a34('0x19b')]);this['channel'][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x1a0'),_0x2674ef[_0x6a34('0x11')]));this[_0x6a34('0x34')][_0x6a34('0x70')](this,_0x104143);return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x1a1'));};AGIVertices['prototype'][_0x6a34('0x1a2')]=function(_0x193aff){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x193aff[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x193aff[_0x6a34('0xda')])){return this[_0x6a34('0xd')]['error'](_0x193aff,'no\x20variable\x20selected');}var _0x9f482=this[_0x6a34('0xdb')][_0x6a34('0x70')](this,_0x193aff[_0x6a34('0xda')]);if(!_0x9f482){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x193aff,_0x6a34('0x116'));}return this[_0x6a34('0xd')][_0x6a34('0x9f')](_0x9f482,_0x193aff[_0x6a34('0x1a3')]);};AGIVertices[_0x6a34('0xf')]['start']=function(_0xf845db){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x1a4'),_0xf845db[_0x6a34('0x37')]));this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x1a5'));if(_0xf845db[_0x6a34('0xba')]===_0x6a34('0x1a6')){this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x1a7'));return this[_0x6a34('0xd')]['answer']();}return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x1a8'));};AGIVertices['prototype']['subproject']=function(_0x537646){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x1a9'),_0x537646[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x537646[_0x6a34('0x1aa')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x537646,_0x6a34('0x1ab'));}var _0x22a4a3=this[_0x6a34('0x15')][_0x6a34('0x70')](this,_0x537646[_0x6a34('0x1aa')]);if(!this['isConfigured'](_0x22a4a3)){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x537646,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x537646[_0x6a34('0x1aa')]));}if(_0x22a4a3===this[_0x6a34('0xd')]['arg_1']){return this[_0x6a34('0xd')]['error'](_0x537646,_0x6a34('0x1ac'));}this[_0x6a34('0x35')]['sync'](this,_0x537646,_0x22a4a3);var _0x1dba3f=this[_0x6a34('0xd')][_0x6a34('0xaa')](_0x6a34('0x1ad'),util[_0x6a34('0x28')](_0x6a34('0x1ae'),config[_0x6a34('0xb8')][_0x6a34('0x190')]||_0x6a34('0x1af'),_0x22a4a3,this[_0x6a34('0xd')][_0x6a34('0x1b0')]));if(_0x1dba3f[_0x6a34('0xb5')]===-0x1){return _0x1dba3f;}return this[_0x6a34('0xd')]['noop'](util['format'](_0x6a34('0xc5'),_0x6a34('0x1ad'),_0x22a4a3));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x1b1')]=function(_0x45a2a3){logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x1b2'),_0x45a2a3['label']));var _0x1554df=this[_0x6a34('0x55')][_0x6a34('0x70')](this,_0x45a2a3[_0x6a34('0x1b3')]);this[_0x6a34('0x35')][_0x6a34('0x70')](this,_0x45a2a3,_0x45a2a3[_0x6a34('0x1b3')]);if(this[_0x6a34('0xa5')](_0x45a2a3['variable_id'])){var _0x28f102=this[_0x6a34('0xdb')][_0x6a34('0x70')](this,_0x45a2a3['variable_id']);if(_0x28f102){this[_0x6a34('0xd')]['setVariable'](_0x28f102,_0x1554df);return this['channel'][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x1b4'),_0x45a2a3[_0x6a34('0x1b3')],_0x28f102));}}return this[_0x6a34('0xd')]['noop'](util[_0x6a34('0x28')](_0x6a34('0x1b5'),_0x45a2a3['command']));};AGIVertices['prototype'][_0x6a34('0x1b6')]=function(_0x1b0301){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x1b7'),_0x1b0301[_0x6a34('0x37')]));_0x1b0301[_0x6a34('0x5a')]=_0x1b0301['text'][_0x6a34('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1b0301[_0x6a34('0x1b8')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0x1b9'));}if(!this[_0x6a34('0xa5')](_0x1b0301[_0x6a34('0x5a')])){return this['channel'][_0x6a34('0xac')](_0x6a34('0xa9'));}this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x1ba'),_0x1b0301['text']));var _0x55fddd=this[_0x6a34('0x58')]['sync'](this,_0x1b0301);if(_0x55fddd){this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x1bb'),_0x55fddd));var _0x3e50ca=this[_0x6a34('0xd')][_0x6a34('0xff')](_0x55fddd);try{fs['unlink'](_0x55fddd+'.wav');}catch(_0x753aea){logger['error'](_0x753aea);}return _0x3e50ca;}return this['channel'][_0x6a34('0x2b')](_0x1b0301,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x6a34('0x1bc')]=function(_0xba2e64){logger['info'](util[_0x6a34('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0xba2e64[_0x6a34('0x37')]));_0xba2e64[_0x6a34('0x5a')]=_0xba2e64[_0x6a34('0x5a')][_0x6a34('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6a34('0xa5')](_0xba2e64[_0x6a34('0x5a')])){return this[_0x6a34('0xd')][_0x6a34('0xac')](_0x6a34('0xa9'));}this['channel']['noop'](util[_0x6a34('0x28')](_0x6a34('0x1bd'),_0xba2e64[_0x6a34('0x5a')]));var _0xa3f00f=this['googleTTS'][_0x6a34('0x70')](this,_0xba2e64);if(_0xa3f00f){this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x1be'),_0xa3f00f));var _0x22fc2c=this['channel'][_0x6a34('0xff')](_0xa3f00f);try{fs[_0x6a34('0x100')](_0xa3f00f+_0x6a34('0x101'));}catch(_0x33ab6d){logger[_0x6a34('0x2b')](_0x33ab6d);}return _0x22fc2c;}return this[_0x6a34('0xd')]['error'](_0xba2e64,_0x6a34('0x1bf'));};AGIVertices[_0x6a34('0xf')]['unpause']=function(_0x36c9b7){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x36c9b7[_0x6a34('0x37')]));if(!this[_0x6a34('0xa5')](_0x36c9b7[_0x6a34('0x157')])){return this[_0x6a34('0xd')][_0x6a34('0x2b')](_0x36c9b7,_0x6a34('0x155'));}logger[_0x6a34('0x2d')](util['format'](_0x6a34('0x156'),this[_0x6a34('0xd')]['callerid'],_0x36c9b7['findBy']));var _0x393259=this[_0x6a34('0x4f')][_0x6a34('0x70')](this,_0x36c9b7[_0x6a34('0x157')]);if(_0x393259){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x158'),this['channel']['callerid'],_0x36c9b7[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a34('0xd')][_0x6a34('0x38')],_0x36c9b7[_0x6a34('0x157')]));return{'code':0xc8,'result':_0x6a34('0x15c')};}else{logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6a34('0xd')][_0x6a34('0x38')],_0x36c9b7[_0x6a34('0x157')]));this[_0x6a34('0xd')][_0x6a34('0xac')](util[_0x6a34('0x28')](_0x6a34('0x159'),this[_0x6a34('0xd')][_0x6a34('0x38')],_0x36c9b7[_0x6a34('0x157')]));return{'code':0xc8,'result':_0x6a34('0x15a')};}};AGIVertices[_0x6a34('0xf')]['voicemail']=function(_0x1839a6){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1839a6['label']));var _0x9d540f=this[_0x6a34('0xd')][_0x6a34('0xaa')](_0x6a34('0x1c0'),[_0x1839a6[_0x6a34('0x1c1')],_0x1839a6[_0x6a34('0x77')]]);if(_0x9d540f['result']===-0x1){return _0x9d540f;}return this[_0x6a34('0xd')][_0x6a34('0xac')](util['format'](_0x6a34('0xc5'),_0x6a34('0x1c0'),_0x1839a6[_0x6a34('0x1c1')]));};AGIVertices[_0x6a34('0xf')][_0x6a34('0x1c2')]=function(_0x1df247){logger[_0x6a34('0x2d')](util[_0x6a34('0x28')](_0x6a34('0x1c3'),_0x1df247[_0x6a34('0x37')]));if(!this['isConfigured'](_0x1df247['variable_id'])){return this['channel']['error'](_0x1df247,'no\x20variable\x20selected');}var _0x104ba4=this[_0x6a34('0xdb')]['sync'](this,_0x1df247[_0x6a34('0xda')]);if(!_0x104ba4){return this[_0x6a34('0xd')]['error'](_0x1df247,_0x6a34('0x116'));}var _0xb4a731=this[_0x6a34('0xd')][_0x6a34('0xdb')](_0x104ba4);return{'code':0xc8,'result':_0xb4a731[_0x6a34('0xa2')]?_0xb4a731['extra']:'-'};};String[_0x6a34('0xf')][_0x6a34('0xa1')]=function(_0x2e44e0,_0x16a119){return this['split'](_0x2e44e0)[_0x6a34('0x1c4')](_0x16a119);};module[_0x6a34('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 9cdc117..7ea5990 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 _0xb458=['syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','agents','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangup]\x20%s'];(function(_0x431f8c,_0x1be87){var _0xcf66c1=function(_0x133e3c){while(--_0x133e3c){_0x431f8c['push'](_0x431f8c['shift']());}};_0xcf66c1(++_0x1be87);}(_0xb458,0x103));var _0x8b45=function(_0x523507,_0x50f5b6){_0x523507=_0x523507-0x0;var _0x5eb36a=_0xb458[_0x523507];return _0x5eb36a;};'use strict';var util=require(_0x8b45('0x0'));var _=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x8b45('0x3'));var RpcUser=require(_0x8b45('0x4'));var RpcVoiceAgentReport=require(_0x8b45('0x5'));function Acw(_0x13a8c6){this['voiceQueues']=_0x13a8c6[_0x8b45('0x6')];this['agents']=_0x13a8c6['agents'];this[_0x8b45('0x7')]=_0x13a8c6[_0x8b45('0x7')];this[_0x8b45('0x8')]={};ami['on'](_0x8b45('0x9'),this[_0x8b45('0xa')]['bind'](this));ami['on'](_0x8b45('0xb'),this[_0x8b45('0xc')][_0x8b45('0xd')](this));ami['on'](_0x8b45('0xe'),this[_0x8b45('0xf')]['bind'](this));ami['on'](_0x8b45('0x10'),this[_0x8b45('0x11')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x8b45('0x12'),this[_0x8b45('0x13')][_0x8b45('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0x8b45('0x14')][_0x8b45('0xd')](this));}function getDiff(_0x42bb72){var _0x2e5ec3=moment()[_0x8b45('0x15')](0x0);var _0x2ad2ae=moment(_0x42bb72)['milliseconds'](0x0);return _0x2e5ec3['diff'](_0x2ad2ae,_0x8b45('0x16'));}Acw[_0x8b45('0x17')][_0x8b45('0x18')]=function(_0x39c1d1){try{var _0x4781d7=this;var _0x27ebb3=this[_0x8b45('0x8')][_0x39c1d1][_0x8b45('0x19')];var _0x33102e=this[_0x8b45('0x8')][_0x39c1d1][_0x8b45('0x1a')];var _0x21d5b2=this[_0x8b45('0x6')][_0x33102e];var _0x43ffb7=![];var _0x1623d8=_0x8b45('0x1b');if(_0x21d5b2[_0x8b45('0x1c')]){if(_0x21d5b2[_0x8b45('0x1d')]['name']){_0x43ffb7=!![];_0x1623d8=_0x21d5b2[_0x8b45('0x1d')][_0x8b45('0x1e')];}}ami[_0x8b45('0x1f')]({'action':_0x8b45('0x20'),'interface':_0x27ebb3,'paused':!![],'reason':_0x1623d8})[_0x8b45('0x21')](function(_0x23eae6){if(_0x4781d7[_0x8b45('0x22')][_0x27ebb3]){return RpcUser[_0x8b45('0x23')](_0x4781d7['agents'][_0x27ebb3]['id'])['then'](function(_0x41154a){if(_0x41154a&&!_0x41154a['voicePause']){logger[_0x8b45('0x24')](_0x8b45('0x25'),_0x39c1d1,_0x27ebb3,_0x33102e);var _0x30f405=_0x4781d7[_0x8b45('0x8')][_0x39c1d1][_0x8b45('0x26')]&&_0x4781d7[_0x8b45('0x8')][_0x39c1d1][_0x8b45('0x27')]?_0x4781d7['channels'][_0x39c1d1]['destlinkedid']:_0x39c1d1;return RpcUser[_0x8b45('0x28')](_0x4781d7[_0x8b45('0x22')][_0x27ebb3],_0x1623d8,_0x30f405)['then'](function(_0x5723a2){if(!_0x43ffb7){_0x4781d7[_0x8b45('0x7')][_0x27ebb3]={};logger[_0x8b45('0x24')](_0x8b45('0x29'),_0x39c1d1,_0x4781d7[_0x8b45('0x6')][_0x33102e]['acwTimeout'],_0x27ebb3,_0x33102e);_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x2a')]=setTimeout(_0x4781d7[_0x8b45('0x2b')][_0x8b45('0xd')](_0x4781d7,_0x27ebb3),_0x4781d7[_0x8b45('0x6')][_0x33102e][_0x8b45('0x2c')]*0x3e8);_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x2d')]=moment()[_0x8b45('0x2e')](_0x8b45('0x2f'));_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x30')]=_0x39c1d1;_0x4781d7[_0x8b45('0x7')][_0x27ebb3]['queue']=_0x33102e;_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x31')]=function(){var _0x34eb03=getDiff(_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x2d')]);clearTimeout(_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x2a')]);_0x4781d7[_0x8b45('0x7')][_0x27ebb3]['timer']=![];RpcVoiceAgentReport[_0x8b45('0x32')]({'acwtime':_0x34eb03},_0x4781d7[_0x8b45('0x7')][_0x27ebb3][_0x8b45('0x30')],_0x27ebb3)[_0x8b45('0x21')](function(_0x12b66d){logger['info'](_0x8b45('0x33'),_0x39c1d1,_0x34eb03,_0x12b66d);})['catch'](function(_0x5a07de){logger[_0x8b45('0x34')](_0x8b45('0x35'),_0x39c1d1,_0x5a07de);});delete _0x4781d7[_0x8b45('0x7')][_0x27ebb3];};}});}else{logger[_0x8b45('0x24')](_0x8b45('0x36'),_0x39c1d1,_0x27ebb3,_0x33102e);}});}})[_0x8b45('0x37')](function(_0x522628){logger[_0x8b45('0x34')](_0x8b45('0x29'),_0x39c1d1,_0x4781d7[_0x8b45('0x6')][_0x33102e][_0x8b45('0x2c')],_0x27ebb3,_0x33102e);})['finally'](function(){delete _0x4781d7[_0x8b45('0x8')][_0x39c1d1];});}catch(_0x213037){logger[_0x8b45('0x34')]('[ACW][START]\x20%s',_0x213037[_0x8b45('0x38')]);}};Acw[_0x8b45('0x17')][_0x8b45('0x2b')]=function(_0x58f32e){try{var _0x1adc4e=this;if(_0x1adc4e[_0x8b45('0x7')][_0x58f32e]){_0x1adc4e[_0x8b45('0x7')][_0x58f32e][_0x8b45('0x2a')]=![];var _0x58d94f=_0x1adc4e[_0x8b45('0x7')][_0x58f32e][_0x8b45('0x30')];var _0x2de02d=_0x1adc4e[_0x8b45('0x7')][_0x58f32e][_0x8b45('0x1a')];var _0x9acf8=_0x1adc4e['voiceQueues'][_0x2de02d]['acwTimeout'];logger[_0x8b45('0x24')](_0x8b45('0x39'),_0x58f32e);RpcUser[_0x8b45('0x3a')](this[_0x8b45('0x22')][_0x58f32e]);RpcVoiceAgentReport[_0x8b45('0x32')]({'acwtime':_0x9acf8,'agentacw':!![]},_0x58d94f,_0x58f32e)['then'](function(_0x120068){logger['info'](_0x8b45('0x33'),_0x58d94f,_0x9acf8,_0x120068);})[_0x8b45('0x37')](function(_0x5fae26){logger[_0x8b45('0x34')](_0x8b45('0x35'),_0x58d94f,_0x5fae26);});}else{logger[_0x8b45('0x34')](_0x8b45('0x3b'),_0x58f32e);if(_0x1adc4e[_0x8b45('0x7')]){logger[_0x8b45('0x24')](_0x8b45('0x3c'),JSON[_0x8b45('0x3d')](_0x1adc4e['timers']));}}}catch(_0x12ea31){logger['error'](_0x8b45('0x3e'),_0x12ea31['message']);}};Acw[_0x8b45('0x17')][_0x8b45('0xa')]=function(_0x117f25){try{if(this[_0x8b45('0x6')][_0x117f25[_0x8b45('0x1a')]]&&(this[_0x8b45('0x6')][_0x117f25['queue']][_0x8b45('0x3')]||this['voiceQueues'][_0x117f25['queue']][_0x8b45('0x1c')])){if(this[_0x8b45('0x22')][_0x117f25[_0x8b45('0x19')]]){this['channels'][_0x117f25[_0x8b45('0x30')]]={'queue':_0x117f25['queue'],'interface':_0x117f25[_0x8b45('0x19')],'destlinkedid':_0x117f25[_0x8b45('0x27')]};}}}catch(_0x1434d9){logger[_0x8b45('0x34')](_0x8b45('0x3f'),_0x1434d9[_0x8b45('0x38')]);}};Acw['prototype'][_0x8b45('0x14')]=function(_0x1f8f24){try{if(this[_0x8b45('0x6')][_0x1f8f24[_0x8b45('0x1a')]]&&(this[_0x8b45('0x6')][_0x1f8f24[_0x8b45('0x1a')]][_0x8b45('0x3')]||this[_0x8b45('0x6')][_0x1f8f24[_0x8b45('0x1a')]][_0x8b45('0x1c')])){if(this[_0x8b45('0x22')][_0x1f8f24[_0x8b45('0x19')]]){this[_0x8b45('0x8')][_0x1f8f24[_0x8b45('0x30')]]={'queue':_0x1f8f24[_0x8b45('0x1a')],'interface':_0x1f8f24[_0x8b45('0x19')]};}}}catch(_0x5e9499){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x5e9499[_0x8b45('0x38')]);}};Acw[_0x8b45('0x17')][_0x8b45('0xc')]=function(_0x473530){try{if(this[_0x8b45('0x8')][_0x473530[_0x8b45('0x30')]]&&_[_0x8b45('0x40')](this[_0x8b45('0x8')][_0x473530['uniqueid']][_0x8b45('0x26')])){logger['info'](_0x8b45('0x41'),_0x473530[_0x8b45('0x30')]);this[_0x8b45('0x18')](_0x473530[_0x8b45('0x30')]);}else if(this['channels'][_0x473530[_0x8b45('0x42')]]&&_[_0x8b45('0x40')](this['channels'][_0x473530[_0x8b45('0x42')]][_0x8b45('0x26')])){logger['info'](_0x8b45('0x43'),_0x473530[_0x8b45('0x42')]);this[_0x8b45('0x18')](_0x473530[_0x8b45('0x42')]);}}catch(_0x219cc0){logger[_0x8b45('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x219cc0['message']);}};Acw[_0x8b45('0x17')][_0x8b45('0xf')]=function(_0x2d5b31){try{if(this['channels'][_0x2d5b31[_0x8b45('0x30')]]&&this[_0x8b45('0x8')][_0x2d5b31[_0x8b45('0x30')]][_0x8b45('0x26')]){logger[_0x8b45('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2d5b31[_0x8b45('0x30')]);this[_0x8b45('0x18')](_0x2d5b31['uniqueid']);}else if(this[_0x8b45('0x8')][_0x2d5b31['linkedid']]&&this[_0x8b45('0x8')][_0x2d5b31[_0x8b45('0x42')]][_0x8b45('0x26')]){logger[_0x8b45('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2d5b31[_0x8b45('0x42')]);this[_0x8b45('0x18')](_0x2d5b31[_0x8b45('0x42')]);}}catch(_0x1d471e){logger[_0x8b45('0x34')](_0x8b45('0x44'),_0x1d471e[_0x8b45('0x38')]);}};Acw[_0x8b45('0x17')][_0x8b45('0x45')]=function(_0x5ba878){try{if(!_[_0x8b45('0x46')](this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x47')]])){this[_0x8b45('0x18')](_0x5ba878[_0x8b45('0x47')]);if(this['channels'][_0x5ba878[_0x8b45('0x48')]]){this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x48')]]['attended']=!![];this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x49')]]=this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x48')]];delete this['channels'][_0x5ba878[_0x8b45('0x48')]];}}else if(!_[_0x8b45('0x46')](this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x49')]])){this['startAcw'](_0x5ba878[_0x8b45('0x49')]);if(this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x4a')]]){this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x4a')]]['attended']=!![];this[_0x8b45('0x8')][_0x5ba878['transfereeuniqueid']]=this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x4a')]];delete this[_0x8b45('0x8')][_0x5ba878[_0x8b45('0x4a')]];}}}catch(_0x6a77bd){logger[_0x8b45('0x34')]('[ACW][syncAttendedTransfer]\x20%s',_0x6a77bd['message']);}};Acw[_0x8b45('0x17')][_0x8b45('0x13')]=function(_0x592d0c){try{if(this[_0x8b45('0x8')][_0x592d0c[_0x8b45('0x4b')]]){logger[_0x8b45('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x592d0c[_0x8b45('0x4b')]));this[_0x8b45('0x18')](_0x592d0c['transfereruniqueid']);}else if(this[_0x8b45('0x8')][_0x592d0c['transfererlinkedid']]){logger[_0x8b45('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x592d0c[_0x8b45('0x4c')]));this[_0x8b45('0x18')](_0x592d0c['transfererlinkedid']);}}catch(_0x324592){logger[_0x8b45('0x34')](_0x8b45('0x4d'),_0x324592[_0x8b45('0x38')]);}};Acw[_0x8b45('0x17')]['syncAgentRingNoAnswer']=function(_0x37f580){try{if(this[_0x8b45('0x6')][_0x37f580[_0x8b45('0x1a')]]&&this['voiceQueues'][_0x37f580['queue']][_0x8b45('0x4e')]==='all'){if(this[_0x8b45('0x22')][_0x37f580['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x37f580[_0x8b45('0x30')],_0x37f580['interface'],_0x37f580[_0x8b45('0x1a')]);return RpcUser[_0x8b45('0x28')](this['agents'][_0x37f580[_0x8b45('0x19')]],_0x8b45('0x4f'),_0x37f580['uniqueid']);}}}catch(_0x4352f9){logger[_0x8b45('0x34')](_0x8b45('0x50'),_0x4352f9[_0x8b45('0x38')]);}};module[_0x8b45('0x51')]=Acw; \ No newline at end of file +var _0x5fd1=['../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','stopAcw','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami'];(function(_0x2c96c7,_0x168459){var _0x49dbfd=function(_0x1b8377){while(--_0x1b8377){_0x2c96c7['push'](_0x2c96c7['shift']());}};_0x49dbfd(++_0x168459);}(_0x5fd1,0x155));var _0x15fd=function(_0x454fc,_0x5bf0c3){_0x454fc=_0x454fc-0x0;var _0x42520c=_0x5fd1[_0x454fc];return _0x42520c;};'use strict';var util=require(_0x15fd('0x0'));var _=require('lodash');var moment=require(_0x15fd('0x1'));var ami=require(_0x15fd('0x2'));var logger=require(_0x15fd('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x15fd('0x4'));function Acw(_0x3138f3){this[_0x15fd('0x5')]=_0x3138f3['voiceQueues'];this[_0x15fd('0x6')]=_0x3138f3[_0x15fd('0x6')];this[_0x15fd('0x7')]=_0x3138f3[_0x15fd('0x7')];this[_0x15fd('0x8')]={};ami['on']('agentconnect',this[_0x15fd('0x9')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xb'),this['syncHangupRequest'][_0x15fd('0xa')](this));ami['on']('hangup',this[_0x15fd('0xc')][_0x15fd('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x15fd('0xd'),this[_0x15fd('0xe')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xf'),this[_0x15fd('0x10')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0x11'),this[_0x15fd('0x12')][_0x15fd('0xa')](this));}function getDiff(_0x4cb391){var _0x5b7af0=moment()['milliseconds'](0x0);var _0x3fda60=moment(_0x4cb391)[_0x15fd('0x13')](0x0);return _0x5b7af0[_0x15fd('0x14')](_0x3fda60,_0x15fd('0x15'));}Acw[_0x15fd('0x16')][_0x15fd('0x17')]=function(_0x2c5375){try{var _0x44a63a=this;var _0x5aae13=this['channels'][_0x2c5375][_0x15fd('0x18')];var _0x5ca5a2=this[_0x15fd('0x8')][_0x2c5375]['queue'];var _0x917fe4=this[_0x15fd('0x5')][_0x5ca5a2];var _0x855bae=![];var _0x49ceac=_0x15fd('0x19');if(_0x917fe4[_0x15fd('0x1a')]){if(_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')]){_0x855bae=!![];_0x49ceac=_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')];}}ami[_0x15fd('0x1d')]({'action':_0x15fd('0x1e'),'interface':_0x5aae13,'paused':!![],'reason':_0x49ceac})[_0x15fd('0x1f')](function(_0x1eab55){if(_0x44a63a[_0x15fd('0x6')][_0x5aae13]){return RpcUser['getAgent'](_0x44a63a['agents'][_0x5aae13]['id'])[_0x15fd('0x1f')](function(_0x36b21e){if(_0x36b21e&&!_0x36b21e[_0x15fd('0x20')]){logger[_0x15fd('0x21')](_0x15fd('0x22'),_0x2c5375,_0x5aae13,_0x5ca5a2);var _0x11496a=_0x44a63a[_0x15fd('0x8')][_0x2c5375]['attended']&&_0x44a63a[_0x15fd('0x8')][_0x2c5375][_0x15fd('0x23')]?_0x44a63a[_0x15fd('0x8')][_0x2c5375]['destlinkedid']:_0x2c5375;return RpcUser[_0x15fd('0x24')](_0x44a63a['agents'][_0x5aae13],_0x49ceac,_0x11496a)[_0x15fd('0x1f')](function(_0x1fc24f){if(!_0x855bae){_0x44a63a[_0x15fd('0x7')][_0x5aae13]={};logger['info'](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')],_0x5aae13,_0x5ca5a2);_0x44a63a['timers'][_0x5aae13][_0x15fd('0x27')]=setTimeout(_0x44a63a['stopAcw'][_0x15fd('0xa')](_0x44a63a,_0x5aae13),_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')]*0x3e8);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x28')]=moment()[_0x15fd('0x29')](_0x15fd('0x2a'));_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')]=_0x2c5375;_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2c')]=_0x5ca5a2;_0x44a63a['timers'][_0x5aae13][_0x15fd('0x2d')]=function(){var _0x2fe61e=getDiff(_0x44a63a['timers'][_0x5aae13][_0x15fd('0x28')]);clearTimeout(_0x44a63a[_0x15fd('0x7')][_0x5aae13]['timer']);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2fe61e},_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')],_0x5aae13)[_0x15fd('0x1f')](function(_0x476828){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x2c5375,_0x2fe61e,_0x476828);})['catch'](function(_0x2d647c){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x2c5375,_0x2d647c);});delete _0x44a63a[_0x15fd('0x7')][_0x5aae13];};}});}else{logger['info'](_0x15fd('0x31'),_0x2c5375,_0x5aae13,_0x5ca5a2);}});}})[_0x15fd('0x32')](function(_0x11b3a1){logger[_0x15fd('0x2f')](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2]['acwTimeout'],_0x5aae13,_0x5ca5a2);})[_0x15fd('0x33')](function(){delete _0x44a63a[_0x15fd('0x8')][_0x2c5375];});}catch(_0x57c118){logger[_0x15fd('0x2f')](_0x15fd('0x34'),_0x57c118[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0x36')]=function(_0x309851){try{var _0x1732bc=this;if(_0x1732bc[_0x15fd('0x7')][_0x309851]){_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x27')]=![];var _0x4d7259=_0x1732bc['timers'][_0x309851]['uniqueid'];var _0x340d17=_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x2c')];var _0x4e608d=_0x1732bc['voiceQueues'][_0x340d17][_0x15fd('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x309851);RpcUser['saveUnpause'](this[_0x15fd('0x6')][_0x309851]);RpcVoiceAgentReport[_0x15fd('0x37')]({'acwtime':_0x4e608d,'agentacw':!![]},_0x4d7259,_0x309851)[_0x15fd('0x1f')](function(_0x59d0d7){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x4d7259,_0x4e608d,_0x59d0d7);})[_0x15fd('0x32')](function(_0x5beb6e){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x4d7259,_0x5beb6e);});}else{logger[_0x15fd('0x2f')](_0x15fd('0x38'),_0x309851);if(_0x1732bc[_0x15fd('0x7')]){logger[_0x15fd('0x21')](_0x15fd('0x39'),JSON[_0x15fd('0x3a')](_0x1732bc[_0x15fd('0x7')]));}}}catch(_0x5dd3c4){logger[_0x15fd('0x2f')](_0x15fd('0x3b'),_0x5dd3c4[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x9')]=function(_0x5f9429){try{if(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]]&&(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x5f9429['interface']]){this[_0x15fd('0x8')][_0x5f9429[_0x15fd('0x2b')]]={'queue':_0x5f9429[_0x15fd('0x2c')],'interface':_0x5f9429[_0x15fd('0x18')],'destlinkedid':_0x5f9429[_0x15fd('0x23')]};}}}catch(_0x44d08b){logger[_0x15fd('0x2f')](_0x15fd('0x3d'),_0x44d08b['message']);}};Acw['prototype'][_0x15fd('0x12')]=function(_0x57bbd5){try{if(this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]]&&(this['voiceQueues'][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x57bbd5['interface']]){this[_0x15fd('0x8')][_0x57bbd5[_0x15fd('0x2b')]]={'queue':_0x57bbd5[_0x15fd('0x2c')],'interface':_0x57bbd5[_0x15fd('0x18')]};}}}catch(_0xcce802){logger[_0x15fd('0x2f')](_0x15fd('0x3e'),_0xcce802[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x3f')]=function(_0x16b4f5){try{if(this[_0x15fd('0x8')][_0x16b4f5['uniqueid']]&&_[_0x15fd('0x40')](this['channels'][_0x16b4f5[_0x15fd('0x2b')]][_0x15fd('0x41')])){logger[_0x15fd('0x21')]('[%s][HANGUP:UNIQUEID]',_0x16b4f5[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x16b4f5[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x16b4f5['linkedid']]&&_[_0x15fd('0x40')](this[_0x15fd('0x8')][_0x16b4f5[_0x15fd('0x42')]][_0x15fd('0x41')])){logger['info'](_0x15fd('0x43'),_0x16b4f5[_0x15fd('0x42')]);this['startAcw'](_0x16b4f5['linkedid']);}}catch(_0x5da44c){logger[_0x15fd('0x2f')](_0x15fd('0x44'),_0x5da44c[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0xc')]=function(_0x33a128){try{if(this['channels'][_0x33a128[_0x15fd('0x2b')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x2b')]]['attended']){logger[_0x15fd('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x33a128[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]][_0x15fd('0x41')]){logger[_0x15fd('0x21')](_0x15fd('0x45'),_0x33a128[_0x15fd('0x42')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x42')]);}}catch(_0x5343b8){logger[_0x15fd('0x2f')]('[ACW][syncHangup]\x20%s',_0x5343b8[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0xe')]=function(_0x1fac7f){try{if(!_[_0x15fd('0x46')](this['channels'][_0x1fac7f['transfereeuniqueid']])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x47')]);if(this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]]){this['channels'][_0x1fac7f[_0x15fd('0x48')]][_0x15fd('0x41')]=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]]=this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]];delete this['channels'][_0x1fac7f[_0x15fd('0x48')]];}}else if(!_[_0x15fd('0x46')](this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x49')]);if(this['channels'][_0x1fac7f['origtransfereruniqueid']]){this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]]['attended']=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x47')]]=this['channels'][_0x1fac7f[_0x15fd('0x4a')]];delete this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]];}}}catch(_0x53bfd7){logger[_0x15fd('0x2f')](_0x15fd('0x4b'),_0x53bfd7[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x10')]=function(_0x1f4581){try{if(this[_0x15fd('0x8')][_0x1f4581[_0x15fd('0x4c')]]){logger[_0x15fd('0x21')](_0x15fd('0x4d'),JSON['stringify'](_0x1f4581[_0x15fd('0x4c')]));this[_0x15fd('0x17')](_0x1f4581['transfereruniqueid']);}else if(this['channels'][_0x1f4581[_0x15fd('0x4e')]]){logger[_0x15fd('0x21')](_0x15fd('0x4f'),JSON[_0x15fd('0x3a')](_0x1f4581[_0x15fd('0x4e')]));this[_0x15fd('0x17')](_0x1f4581['transfererlinkedid']);}}catch(_0x41d398){logger[_0x15fd('0x2f')](_0x15fd('0x50'),_0x41d398[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x51')]=function(_0xf27ab4){try{if(this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]&&this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]['autopause']==='all'){if(this[_0x15fd('0x6')][_0xf27ab4[_0x15fd('0x18')]]){logger[_0x15fd('0x21')](_0x15fd('0x52'),_0xf27ab4[_0x15fd('0x2b')],_0xf27ab4[_0x15fd('0x18')],_0xf27ab4[_0x15fd('0x2c')]);return RpcUser['savePause'](this[_0x15fd('0x6')][_0xf27ab4['interface']],_0x15fd('0x53'),_0xf27ab4['uniqueid']);}}}catch(_0x1c2828){logger['error'](_0x15fd('0x54'),_0x1c2828[_0x15fd('0x35')]);}};module[_0x15fd('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5ede930..594a094 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 _0x842f=['Action','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionDeviceStateList','actionSipPeerStatus','catch','log','exports','asterisk-manager','moment','../../config/logger','ami','asterisk','username','password','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry'];(function(_0x34fa6a,_0x4ae7ff){var _0xc8aae5=function(_0x358b91){while(--_0x358b91){_0x34fa6a['push'](_0x34fa6a['shift']());}};_0xc8aae5(++_0x4ae7ff);}(_0x842f,0x1ef));var _0xf842=function(_0x1de2bd,_0x953fb){_0x1de2bd=_0x1de2bd-0x0;var _0x595960=_0x842f[_0x1de2bd];return _0x595960;};'use strict';var Manager=require(_0xf842('0x0'));var BPromise=require('bluebird');var moment=require(_0xf842('0x1'));var util=require('util');var _=require('lodash');var logger=require(_0xf842('0x2'))(_0xf842('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xf842('0x4')]['port'],config[_0xf842('0x4')]['ip'],config[_0xf842('0x4')][_0xf842('0x5')],config['asterisk'][_0xf842('0x6')],!![]);ami[_0xf842('0x7')]();ami['Action']=BPromise['promisify'](ami[_0xf842('0x8')]);function error(_0x53b91d){logger[_0xf842('0x9')](util[_0xf842('0xa')](_0xf842('0xb'),config[_0xf842('0x4')][_0xf842('0x5')],config[_0xf842('0x4')]['ip'],config[_0xf842('0x4')][_0xf842('0xc')],util[_0xf842('0xd')](_0x53b91d,![],null)));}function close(){logger[_0xf842('0x9')](util[_0xf842('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xf842('0x5')],config[_0xf842('0x4')]['ip'],config['asterisk'][_0xf842('0xc')]));}ami[_0xf842('0xe')]=function(){return function(){return ami[_0xf842('0xf')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xf842('0xf')]({'action':_0xf842('0x10')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xf842('0xf')]({'action':_0xf842('0x11')});};};ami[_0xf842('0x12')]=function(){return function(){return ami[_0xf842('0xf')]({'action':_0xf842('0x13')});};};ami[_0xf842('0x14')]=function(){return function(){return ami[_0xf842('0xf')]({'action':_0xf842('0x15')});};};function connect(_0x36bdec){logger['info'](util['format'](_0xf842('0x16'),config[_0xf842('0x4')][_0xf842('0x5')],config[_0xf842('0x4')]['ip'],config[_0xf842('0x4')]['port']));ami['once'](_0xf842('0x9'),error);ami[_0xf842('0x17')](_0xf842('0x18'),close);}ami['on'](_0xf842('0x19'),connect);ami['on']('shutdown',function(_0x19aa71){logger[_0xf842('0x1a')](util[_0xf842('0xa')](_0xf842('0x1b'),config[_0xf842('0x4')][_0xf842('0x5')],config[_0xf842('0x4')]['ip'],config[_0xf842('0x4')][_0xf842('0xc')],util[_0xf842('0xd')](_0x19aa71,![],null)));});ami['on']('fullybooted',function(_0x5ba5a3){logger[_0xf842('0x1a')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xf842('0x4')]['username'],config['asterisk']['ip'],config[_0xf842('0x4')]['port']));return BPromise['resolve']()['then'](ami['actionSipShowRegistry']())[_0xf842('0x1c')](ami[_0xf842('0x1d')]())[_0xf842('0x1c')](ami[_0xf842('0x1e')]())[_0xf842('0x1c')](ami[_0xf842('0x12')]())[_0xf842('0x1c')](ami[_0xf842('0x14')]())[_0xf842('0x1f')](function(_0x11da94){console[_0xf842('0x20')](_0x11da94);});});ami['once']('error',error);ami[_0xf842('0x17')](_0xf842('0x18'),close);module[_0xf842('0x21')]=ami; \ No newline at end of file +var _0x88c8=['inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','error','connect','shutdown','fullybooted','then','actionQueueSummary','catch','log','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x47131b,_0x4750e6){var _0x40ccf1=function(_0x44224f){while(--_0x44224f){_0x47131b['push'](_0x47131b['shift']());}};_0x40ccf1(++_0x4750e6);}(_0x88c8,0xdb));var _0x888c=function(_0x40b9d9,_0x20f52c){_0x40b9d9=_0x40b9d9-0x0;var _0x278cf9=_0x88c8[_0x40b9d9];return _0x278cf9;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x888c('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x888c('0x1'))(_0x888c('0x2'));var config=require(_0x888c('0x3'));var ami=new Manager(config[_0x888c('0x4')][_0x888c('0x5')],config[_0x888c('0x4')]['ip'],config['asterisk'][_0x888c('0x6')],config['asterisk'][_0x888c('0x7')],!![]);ami[_0x888c('0x8')]();ami['Action']=BPromise['promisify'](ami[_0x888c('0x9')]);function error(_0x16661a){logger['error'](util[_0x888c('0xa')](_0x888c('0xb'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x888c('0x4')][_0x888c('0x5')],util[_0x888c('0xc')](_0x16661a,![],null)));}function close(){logger['error'](util[_0x888c('0xa')](_0x888c('0xd'),config[_0x888c('0x4')]['username'],config['asterisk']['ip'],config[_0x888c('0x4')][_0x888c('0x5')]));}ami[_0x888c('0xe')]=function(){return function(){return ami[_0x888c('0xf')]({'action':'sipshowregistry'});};};ami[_0x888c('0x10')]=function(){return function(){return ami[_0x888c('0xf')]({'action':_0x888c('0x11')});};};ami[_0x888c('0x12')]=function(){return function(){return ami[_0x888c('0xf')]({'action':_0x888c('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x888c('0xf')]({'action':'queuesummary'});};};ami[_0x888c('0x14')]=function(){return function(){return ami['Action']({'action':_0x888c('0x15')});};};function connect(_0x15c52e){logger[_0x888c('0x16')](util[_0x888c('0xa')](_0x888c('0x17'),config[_0x888c('0x4')]['username'],config[_0x888c('0x4')]['ip'],config[_0x888c('0x4')]['port']));ami[_0x888c('0x18')](_0x888c('0x19'),error);ami[_0x888c('0x18')]('close',close);}ami['on'](_0x888c('0x1a'),connect);ami['on'](_0x888c('0x1b'),function(_0x4382bc){logger[_0x888c('0x16')](util[_0x888c('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x888c('0x4')][_0x888c('0x6')],config[_0x888c('0x4')]['ip'],config[_0x888c('0x4')][_0x888c('0x5')],util[_0x888c('0xc')](_0x4382bc,![],null)));});ami['on'](_0x888c('0x1c'),function(_0x5967b9){logger[_0x888c('0x16')](util[_0x888c('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x888c('0x4')][_0x888c('0x6')],config[_0x888c('0x4')]['ip'],config[_0x888c('0x4')][_0x888c('0x5')]));return BPromise['resolve']()['then'](ami[_0x888c('0xe')]())[_0x888c('0x1d')](ami[_0x888c('0x10')]())[_0x888c('0x1d')](ami[_0x888c('0x12')]())[_0x888c('0x1d')](ami[_0x888c('0x1e')]())['then'](ami[_0x888c('0x14')]())[_0x888c('0x1f')](function(_0x4f6828){console[_0x888c('0x20')](_0x4f6828);});});ami[_0x888c('0x18')](_0x888c('0x19'),error);ami['once']('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9ccd6f1..cb899cd 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 _0xf0df=['../../config/logger','ami','client','http','then','rpc','memberReport','error','message','catch','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf0df,0x1a1));var _0xff0d=function(_0x117342,_0x4181e1){_0x117342=_0x117342-0x0;var _0x3ad3ad=_0xf0df[_0x117342];return _0x3ad3ad;};'use strict';var jayson=require(_0xff0d('0x0'));var BPromise=require('bluebird');var logger=require(_0xff0d('0x1'))(_0xff0d('0x2'));var client=jayson[_0xff0d('0x3')][_0xff0d('0x4')]({'port':0x2329});client['Request']=function(_0x30b5e3,_0x4cefab){return new BPromise(function(_0x12f63e,_0x900ced){return client['request'](_0x30b5e3,_0x4cefab)[_0xff0d('0x5')](function(_0x5ed7a4){logger['debug'](_0xff0d('0x6'),_0xff0d('0x7'),_0x30b5e3,_0x4cefab,_0x5ed7a4);if(_0x5ed7a4[_0xff0d('0x8')]){logger[_0xff0d('0x8')](_0xff0d('0x6'),'memberReport',_0x30b5e3,_0x5ed7a4[_0xff0d('0x8')]['message'],_0x4cefab);return _0x900ced(_0x5ed7a4[_0xff0d('0x8')][_0xff0d('0x9')]);}else{return _0x12f63e(_0x5ed7a4['result']);}})[_0xff0d('0xa')](function(_0x575fa4){logger[_0xff0d('0x8')]('rpc','memberReport',_0x30b5e3,_0x575fa4,_0x4cefab);return _0x900ced(_0x575fa4);});});};module['exports']=client; \ No newline at end of file +var _0xb9a6=['bluebird','../../config/logger','ami','client','http','request','then','debug','memberReport','error','rpc','message','catch','exports'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xb9a6,0x15e));var _0x6b9a=function(_0x5610f0,_0x18c225){_0x5610f0=_0x5610f0-0x0;var _0x14af1d=_0xb9a6[_0x5610f0];return _0x14af1d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6b9a('0x0'));var logger=require(_0x6b9a('0x1'))(_0x6b9a('0x2'));var client=jayson[_0x6b9a('0x3')][_0x6b9a('0x4')]({'port':0x2329});client['Request']=function(_0x49bfda,_0x12f6d3){return new BPromise(function(_0xcb9b7c,_0x337582){return client[_0x6b9a('0x5')](_0x49bfda,_0x12f6d3)[_0x6b9a('0x6')](function(_0x2ab557){logger[_0x6b9a('0x7')]('rpc',_0x6b9a('0x8'),_0x49bfda,_0x12f6d3,_0x2ab557);if(_0x2ab557[_0x6b9a('0x9')]){logger[_0x6b9a('0x9')](_0x6b9a('0xa'),_0x6b9a('0x8'),_0x49bfda,_0x2ab557[_0x6b9a('0x9')][_0x6b9a('0xb')],_0x12f6d3);return _0x337582(_0x2ab557[_0x6b9a('0x9')][_0x6b9a('0xb')]);}else{return _0xcb9b7c(_0x2ab557['result']);}})[_0x6b9a('0xc')](function(_0xdb5c6f){logger[_0x6b9a('0x9')]('rpc',_0x6b9a('0x8'),_0x49bfda,_0xdb5c6f,_0x12f6d3);return _0x337582(_0xdb5c6f);});});};module[_0x6b9a('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 27819d2..576e745 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4483=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x187c30,_0x238119){var _0x391824=function(_0x5e10e3){while(--_0x5e10e3){_0x187c30['push'](_0x187c30['shift']());}};_0x391824(++_0x238119);}(_0x4483,0x1a3));var _0x3448=function(_0x16b449,_0x1f7515){_0x16b449=_0x16b449-0x0;var _0x1a2442=_0x4483[_0x16b449];return _0x1a2442;};'use strict';var util=require(_0x3448('0x0'));var _=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));function checkNameSurname(_0x481d0c,_0x202d3d,_0x1fe72d){var _0x27ef60='';if(!_[_0x3448('0x3')](_0x202d3d)&&_0x3448('0x4')===typeof _0x202d3d){_0x27ef60+=_0x202d3d;}if(!_['isNil'](_0x1fe72d)&&_0x3448('0x4')===typeof _0x1fe72d){_0x27ef60+='\x20'+_0x1fe72d;}if(_0x27ef60!==''){return _0x27ef60;}return _0x481d0c;}function Action(_0x6a89b,_0x1b05db,_0xd3606d){this[_0x3448('0x5')]=_0x6a89b;this[_0x3448('0x6')]=_0xd3606d||undefined;this[_0x3448('0x7')]=checkNameSurname(_0x1b05db[_0x3448('0x8')]['phone'],_0x1b05db['Contact'][_0x3448('0x9')],_0x1b05db[_0x3448('0x8')][_0x3448('0xa')]);this[_0x3448('0xb')]=_0x1b05db[_0x3448('0x8')][_0x3448('0xc')];this[_0x3448('0xd')]=_0x6a89b[_0x3448('0x7')];this[_0x3448('0xe')]=_0x1b05db[_0x3448('0xe')]||![];this[_0x3448('0xf')]=_0x6a89b['type'];this['dialQueueTimeout']=_0x6a89b[_0x3448('0x10')]||0x3;this[_0x3448('0x11')]=_0x1b05db['scheduledat'];this[_0x3448('0x12')]=_0x1b05db[_0x3448('0x12')];this[_0x3448('0x13')]=_0x1b05db['countcongestionretry'];this[_0x3448('0x14')]=_0x1b05db[_0x3448('0x14')];this['countnosuchnumberretry']=_0x1b05db[_0x3448('0x15')];this[_0x3448('0x16')]=_0x1b05db[_0x3448('0x16')];this['countabandonedretry']=_0x1b05db[_0x3448('0x17')];this[_0x3448('0x18')]=_0x1b05db[_0x3448('0x18')];this[_0x3448('0x19')]=_0x1b05db[_0x3448('0x19')];this[_0x3448('0x1a')]=_0x1b05db[_0x3448('0x1a')];this[_0x3448('0x1b')]=_0x1b05db['ListId'];this[_0x3448('0x1c')]=_0x1b05db['UserId'];this['VoiceQueueId']=_0x1b05db['VoiceQueueId'];this[_0x3448('0x1d')]=_0x1b05db[_0x3448('0x1d')];this[_0x3448('0x1e')]=_0x1b05db['id'];this['ContactFirstName']=_0x1b05db[_0x3448('0x8')][_0x3448('0x9')]||'';this[_0x3448('0x1f')]=moment()[_0x3448('0x20')](_0x3448('0x21'));this[_0x3448('0x22')]=_0x1b05db['callback'];this['callbackuniqueid']=_0x1b05db['callbackuniqueid'];this[_0x3448('0x23')]=_0x1b05db[_0x3448('0x23')];this['recallme']=_0x1b05db['recallme'];this[_0x3448('0x24')]='';this[_0x3448('0x25')]='';}Action[_0x3448('0x26')][_0x3448('0x27')]=function(){return util[_0x3448('0x20')]('\x22%s\x22\x20<%s>',this[_0x3448('0x7')],this[_0x3448('0x5')][_0x3448('0x28')]>0x0?this[_0x3448('0xb')][_0x3448('0x29')](this['voiceQueue'][_0x3448('0x28')]):this[_0x3448('0xb')]);};Action['prototype'][_0x3448('0x2a')]=function(){return this[_0x3448('0xd')];};module[_0x3448('0x2b')]=Action; \ No newline at end of file +var _0x138d=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','queue','active','type'];(function(_0x3d65f4,_0xe14c3){var _0x128310=function(_0x228fe7){while(--_0x228fe7){_0x3d65f4['push'](_0x3d65f4['shift']());}};_0x128310(++_0xe14c3);}(_0x138d,0x1ab));var _0xd138=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x138d[_0x4c3070];return _0x536a44;};'use strict';var util=require(_0xd138('0x0'));var _=require(_0xd138('0x1'));var moment=require('moment');function checkNameSurname(_0xefc890,_0x34325b,_0x427b74){var _0x1882b8='';if(!_[_0xd138('0x2')](_0x34325b)&&_0xd138('0x3')===typeof _0x34325b){_0x1882b8+=_0x34325b;}if(!_['isNil'](_0x427b74)&&_0xd138('0x3')===typeof _0x427b74){_0x1882b8+='\x20'+_0x427b74;}if(_0x1882b8!==''){return _0x1882b8;}return _0xefc890;}function Action(_0x31c62b,_0x343962,_0x54f02e){this[_0xd138('0x4')]=_0x31c62b;this[_0xd138('0x5')]=_0x54f02e||undefined;this[_0xd138('0x6')]=checkNameSurname(_0x343962['Contact']['phone'],_0x343962[_0xd138('0x7')][_0xd138('0x8')],_0x343962[_0xd138('0x7')]['lastName']);this[_0xd138('0x9')]=_0x343962['Contact']['phone'];this[_0xd138('0xa')]=_0x31c62b[_0xd138('0x6')];this[_0xd138('0xb')]=_0x343962[_0xd138('0xb')]||![];this['type']=_0x31c62b[_0xd138('0xc')];this['dialQueueTimeout']=_0x31c62b[_0xd138('0xd')]||0x3;this[_0xd138('0xe')]=_0x343962[_0xd138('0xe')];this[_0xd138('0xf')]=_0x343962[_0xd138('0xf')];this[_0xd138('0x10')]=_0x343962[_0xd138('0x10')];this[_0xd138('0x11')]=_0x343962[_0xd138('0x11')];this[_0xd138('0x12')]=_0x343962[_0xd138('0x12')];this[_0xd138('0x13')]=_0x343962['countdropretry'];this[_0xd138('0x14')]=_0x343962[_0xd138('0x14')];this['countmachineretry']=_0x343962['countmachineretry'];this['countagentrejectretry']=_0x343962[_0xd138('0x15')];this[_0xd138('0x16')]=_0x343962['ContactId'];this[_0xd138('0x17')]=_0x343962[_0xd138('0x17')];this[_0xd138('0x18')]=_0x343962[_0xd138('0x18')];this['VoiceQueueId']=_0x343962[_0xd138('0x19')];this[_0xd138('0x1a')]=_0x343962[_0xd138('0x1a')];this[_0xd138('0x1b')]=_0x343962['id'];this[_0xd138('0x1c')]=_0x343962[_0xd138('0x7')][_0xd138('0x8')]||'';this['starttime']=moment()[_0xd138('0x1d')](_0xd138('0x1e'));this['callback']=_0x343962['callback'];this[_0xd138('0x1f')]=_0x343962['callbackuniqueid'];this['callbackat']=_0x343962['callbackat'];this[_0xd138('0x20')]=_0x343962[_0xd138('0x20')];this[_0xd138('0x21')]='';this[_0xd138('0x22')]='';}Action['prototype'][_0xd138('0x23')]=function(){return util[_0xd138('0x1d')](_0xd138('0x24'),this[_0xd138('0x6')],this[_0xd138('0x4')][_0xd138('0x25')]>0x0?this[_0xd138('0x9')][_0xd138('0x26')](this[_0xd138('0x4')][_0xd138('0x25')]):this[_0xd138('0x9')]);};Action[_0xd138('0x27')]['getQueue']=function(){return this[_0xd138('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index c82a290..0fcbb1e 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe58=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfe58,0x177));var _0x8fe5=function(_0x2c0099,_0x572104){_0x2c0099=_0x2c0099-0x0;var _0x28f43e=_0xfe58[_0x2c0099];return _0x28f43e;};'use strict';var util=require('util');var _=require(_0x8fe5('0x0'));var moment=require(_0x8fe5('0x1'));function getSeconds(_0x2a0235,_0x112aad){var _0x4c1223=moment(_0x2a0235)[_0x8fe5('0x2')](0x0);var _0x3c4657=moment(_0x112aad)[_0x8fe5('0x2')](0x0);return _0x4c1223[_0x8fe5('0x3')](_0x3c4657,'seconds');}function AgentComplete(_0x4070da,_0x5d7c6e){this[_0x8fe5('0x4')]=0x4;this[_0x8fe5('0x5')]=_0x8fe5('0x6');this['scheduledat']=_0x4070da[_0x8fe5('0x7')];this[_0x8fe5('0x8')]=_0x4070da[_0x8fe5('0x8')];this['campaigntype']=_0x4070da[_0x8fe5('0x8')]===_0x8fe5('0x9')?_0x8fe5('0xa'):_0x4070da[_0x8fe5('0x8')];this['countbusyretry']=_0x4070da[_0x8fe5('0xb')];this[_0x8fe5('0xc')]=_0x4070da[_0x8fe5('0xc')];this[_0x8fe5('0xd')]=_0x4070da[_0x8fe5('0xd')];this['countglobal']=_0x4070da['countbusyretry']+_0x4070da[_0x8fe5('0xc')]+_0x4070da[_0x8fe5('0xd')]+_0x4070da['countnosuchnumberretry']+_0x4070da['countdropretry']+_0x4070da['countabandonedretry']+_0x4070da[_0x8fe5('0xe')]+_0x4070da[_0x8fe5('0xf')];this[_0x8fe5('0x10')]=_0x4070da[_0x8fe5('0x10')];this[_0x8fe5('0x11')]=_0x4070da[_0x8fe5('0x11')];this[_0x8fe5('0x12')]=_0x4070da[_0x8fe5('0x12')];this[_0x8fe5('0xe')]=_0x4070da['countmachineretry'];this[_0x8fe5('0xf')]=_0x4070da[_0x8fe5('0xf')];this['uniqueid']=_0x5d7c6e['uniqueid'];this[_0x8fe5('0x13')]=_0x4070da[_0x8fe5('0x14')];this[_0x8fe5('0x15')]=_0x4070da[_0x8fe5('0x16')];this[_0x8fe5('0x17')]=_0x4070da[_0x8fe5('0x17')];this[_0x8fe5('0x18')]=_0x4070da[_0x8fe5('0x18')];this['answertime']=_0x4070da[_0x8fe5('0x19')];this[_0x8fe5('0x1a')]=moment()[_0x8fe5('0x1b')](_0x8fe5('0x1c'));this[_0x8fe5('0x1d')]=getSeconds(_0x4070da[_0x8fe5('0x18')],_0x4070da[_0x8fe5('0x17')]);this[_0x8fe5('0x1e')]=getSeconds(_0x4070da[_0x8fe5('0x19')],_0x4070da['responsetime']);this[_0x8fe5('0x1f')]=getSeconds(this[_0x8fe5('0x1a')],_0x4070da[_0x8fe5('0x19')]);this[_0x8fe5('0xa')]=_0x5d7c6e[_0x8fe5('0xa')];this[_0x8fe5('0x20')]=_0x5d7c6e[_0x8fe5('0x20')];this[_0x8fe5('0x21')]=_0x5d7c6e['reason'];this[_0x8fe5('0x22')]=_0x4070da['callback'];this[_0x8fe5('0x23')]=_0x4070da[_0x8fe5('0x23')];this[_0x8fe5('0x24')]=_0x4070da['callbackat'];this['recallme']=_0x4070da['recallme'];this[_0x8fe5('0x25')]=_0x4070da[_0x8fe5('0x25')];this[_0x8fe5('0x26')]=_0x4070da[_0x8fe5('0x26')];this[_0x8fe5('0x27')]=_0x4070da['UserId'];this[_0x8fe5('0x28')]=_0x4070da[_0x8fe5('0x28')];this[_0x8fe5('0x29')]=_0x4070da[_0x8fe5('0x29')];this[_0x8fe5('0x2a')]=_0x4070da['originatecalleridnum']||'';this['originatecalleridname']=_0x4070da[_0x8fe5('0x2b')]||'';}module[_0x8fe5('0x2c')]=AgentComplete; \ No newline at end of file +var _0x2db2=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type'];(function(_0x1d4ae3,_0x1f8eb7){var _0x329fca=function(_0x28c520){while(--_0x28c520){_0x1d4ae3['push'](_0x1d4ae3['shift']());}};_0x329fca(++_0x1f8eb7);}(_0x2db2,0xaa));var _0x22db=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x2db2[_0x2e8418];return _0x548fe6;};'use strict';var util=require(_0x22db('0x0'));var _=require(_0x22db('0x1'));var moment=require(_0x22db('0x2'));function getSeconds(_0x4b859d,_0x282b4b){var _0x329bba=moment(_0x4b859d)[_0x22db('0x3')](0x0);var _0x2f1e3b=moment(_0x282b4b)['milliseconds'](0x0);return _0x329bba[_0x22db('0x4')](_0x2f1e3b,'seconds');}function AgentComplete(_0x2a0574,_0xb38f46){this[_0x22db('0x5')]=0x4;this[_0x22db('0x6')]=_0x22db('0x7');this[_0x22db('0x8')]=_0x2a0574[_0x22db('0x8')];this[_0x22db('0x9')]=_0x2a0574[_0x22db('0x9')];this['campaigntype']=_0x2a0574[_0x22db('0x9')]===_0x22db('0xa')?_0x22db('0xb'):_0x2a0574[_0x22db('0x9')];this[_0x22db('0xc')]=_0x2a0574['countbusyretry'];this[_0x22db('0xd')]=_0x2a0574['countcongestionretry'];this[_0x22db('0xe')]=_0x2a0574[_0x22db('0xe')];this['countglobal']=_0x2a0574[_0x22db('0xc')]+_0x2a0574[_0x22db('0xd')]+_0x2a0574[_0x22db('0xe')]+_0x2a0574[_0x22db('0xf')]+_0x2a0574[_0x22db('0x10')]+_0x2a0574[_0x22db('0x11')]+_0x2a0574['countmachineretry']+_0x2a0574['countagentrejectretry'];this['countnosuchnumberretry']=_0x2a0574[_0x22db('0xf')];this[_0x22db('0x10')]=_0x2a0574['countdropretry'];this[_0x22db('0x11')]=_0x2a0574['countabandonedretry'];this[_0x22db('0x12')]=_0x2a0574[_0x22db('0x12')];this[_0x22db('0x13')]=_0x2a0574[_0x22db('0x13')];this[_0x22db('0x14')]=_0xb38f46[_0x22db('0x14')];this[_0x22db('0x15')]=_0x2a0574['name'];this['calleridnum']=_0x2a0574[_0x22db('0x16')];this[_0x22db('0x17')]=_0x2a0574[_0x22db('0x17')];this[_0x22db('0x18')]=_0x2a0574['responsetime'];this['answertime']=_0x2a0574[_0x22db('0x19')];this[_0x22db('0x1a')]=moment()[_0x22db('0x1b')](_0x22db('0x1c'));this[_0x22db('0x1d')]=getSeconds(_0x2a0574['responsetime'],_0x2a0574['starttime']);this['holdtime']=getSeconds(_0x2a0574[_0x22db('0x19')],_0x2a0574['responsetime']);this[_0x22db('0x1e')]=getSeconds(this['endtime'],_0x2a0574[_0x22db('0x19')]);this['queue']=_0xb38f46['queue'];this['membername']=_0xb38f46[_0x22db('0x1f')];this[_0x22db('0x20')]=_0xb38f46[_0x22db('0x20')];this[_0x22db('0x21')]=_0x2a0574[_0x22db('0x21')];this['callbackuniqueid']=_0x2a0574[_0x22db('0x22')];this[_0x22db('0x23')]=_0x2a0574[_0x22db('0x23')];this[_0x22db('0x24')]=_0x2a0574[_0x22db('0x24')];this[_0x22db('0x25')]=_0x2a0574['ContactId'];this[_0x22db('0x26')]=_0x2a0574[_0x22db('0x26')];this[_0x22db('0x27')]=_0x2a0574['UserId'];this[_0x22db('0x28')]=_0x2a0574[_0x22db('0x28')];this[_0x22db('0x29')]=_0x2a0574[_0x22db('0x29')];this[_0x22db('0x2a')]=_0x2a0574['originatecalleridnum']||'';this[_0x22db('0x2b')]=_0x2a0574['originatecalleridname']||'';}module[_0x22db('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6464dac..6f07bab 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x709a=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff'];(function(_0x4ceaa8,_0x452176){var _0x94bff6=function(_0x2b24b3){while(--_0x2b24b3){_0x4ceaa8['push'](_0x4ceaa8['shift']());}};_0x94bff6(++_0x452176);}(_0x709a,0x1d0));var _0xa709=function(_0x124eef,_0xb4bf81){_0x124eef=_0x124eef-0x0;var _0x2da177=_0x709a[_0x124eef];return _0x2da177;};'use strict';var util=require('util');var _=require(_0xa709('0x0'));var moment=require(_0xa709('0x1'));function getSeconds(_0x39df18,_0x1beae1){var _0x5673a0=moment(_0x39df18)[_0xa709('0x2')](0x0);var _0xf1da2a=moment(_0x1beae1)[_0xa709('0x2')](0x0);return _0x5673a0[_0xa709('0x3')](_0xf1da2a,'seconds');}function Final(_0x3ffbe8){this[_0xa709('0x4')]=_0x3ffbe8['uniqueid'];this[_0xa709('0x5')]=_0x3ffbe8[_0xa709('0x5')];this[_0xa709('0x6')]=_0x3ffbe8[_0xa709('0x6')];this[_0xa709('0x7')]=_0x3ffbe8['type']===_0xa709('0x8')?_0xa709('0x9'):_0x3ffbe8['type'];this['countbusyretry']=_0x3ffbe8[_0xa709('0xa')];this['countcongestionretry']=_0x3ffbe8['countcongestionretry'];this[_0xa709('0xb')]=_0x3ffbe8[_0xa709('0xb')];this[_0xa709('0xc')]=_0x3ffbe8['countbusyretry']+_0x3ffbe8[_0xa709('0xd')]+_0x3ffbe8['countnoanswerretry']+_0x3ffbe8[_0xa709('0xe')]+_0x3ffbe8['countdropretry']+_0x3ffbe8[_0xa709('0xf')]+_0x3ffbe8[_0xa709('0x10')]+_0x3ffbe8[_0xa709('0x11')];this[_0xa709('0xe')]=_0x3ffbe8['countnosuchnumberretry'];this[_0xa709('0x12')]=_0x3ffbe8['countdropretry'];this[_0xa709('0xf')]=_0x3ffbe8[_0xa709('0xf')];this['countmachineretry']=_0x3ffbe8[_0xa709('0x10')];this[_0xa709('0x11')]=_0x3ffbe8[_0xa709('0x11')];this[_0xa709('0x9')]=_0x3ffbe8[_0xa709('0x9')];this['calleridname']=_0x3ffbe8[_0xa709('0x13')];this[_0xa709('0x14')]=_0x3ffbe8[_0xa709('0x14')];this[_0xa709('0x15')]=_0x3ffbe8[_0xa709('0x15')];this[_0xa709('0x16')]=_0x3ffbe8[_0xa709('0x16')];this['endtime']=_0x3ffbe8['responsetime'];this['ringtime']=_0x3ffbe8['ringtime']||0x0;this[_0xa709('0x17')]=_0x3ffbe8[_0xa709('0x17')]||0x0;this[_0xa709('0x18')]=_0x3ffbe8[_0xa709('0x18')]||0x0;this[_0xa709('0x19')]=_0x3ffbe8['callback'];this[_0xa709('0x1a')]=_0x3ffbe8[_0xa709('0x1a')];this[_0xa709('0x1b')]=_0x3ffbe8[_0xa709('0x1b')];this[_0xa709('0x1c')]=_0x3ffbe8['recallme'];this[_0xa709('0x1d')]=_0x3ffbe8[_0xa709('0x1d')];this['ListId']=_0x3ffbe8['ListId'];this[_0xa709('0x1e')]=_0x3ffbe8[_0xa709('0x1e')];this['VoiceQueueId']=_0x3ffbe8[_0xa709('0x1f')];this[_0xa709('0x20')]=_0x3ffbe8[_0xa709('0x20')];this[_0xa709('0x21')]=_0x3ffbe8[_0xa709('0x21')]||'';this[_0xa709('0x22')]=_0x3ffbe8[_0xa709('0x22')]||'';}module[_0xa709('0x23')]=Final; \ No newline at end of file +var _0x96e6=['originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x96e6,0x1be));var _0x696e=function(_0x5533b6,_0x5dc3a7){_0x5533b6=_0x5533b6-0x0;var _0xa203b5=_0x96e6[_0x5533b6];return _0xa203b5;};'use strict';var util=require(_0x696e('0x0'));var _=require('lodash');var moment=require(_0x696e('0x1'));function getSeconds(_0x2cba92,_0xf2da00){var _0x8c8c14=moment(_0x2cba92)[_0x696e('0x2')](0x0);var _0x4c7a96=moment(_0xf2da00)['milliseconds'](0x0);return _0x8c8c14['diff'](_0x4c7a96,_0x696e('0x3'));}function Final(_0x394803){this[_0x696e('0x4')]=_0x394803['uniqueid'];this[_0x696e('0x5')]=_0x394803['scheduledat'];this[_0x696e('0x6')]=_0x394803[_0x696e('0x6')];this[_0x696e('0x7')]=_0x394803[_0x696e('0x6')]===_0x696e('0x8')?'queue':_0x394803[_0x696e('0x6')];this['countbusyretry']=_0x394803[_0x696e('0x9')];this[_0x696e('0xa')]=_0x394803[_0x696e('0xa')];this[_0x696e('0xb')]=_0x394803[_0x696e('0xb')];this[_0x696e('0xc')]=_0x394803[_0x696e('0x9')]+_0x394803[_0x696e('0xa')]+_0x394803[_0x696e('0xb')]+_0x394803[_0x696e('0xd')]+_0x394803['countdropretry']+_0x394803[_0x696e('0xe')]+_0x394803[_0x696e('0xf')]+_0x394803[_0x696e('0x10')];this['countnosuchnumberretry']=_0x394803[_0x696e('0xd')];this[_0x696e('0x11')]=_0x394803[_0x696e('0x11')];this[_0x696e('0xe')]=_0x394803['countabandonedretry'];this[_0x696e('0xf')]=_0x394803[_0x696e('0xf')];this['countagentrejectretry']=_0x394803[_0x696e('0x10')];this['queue']=_0x394803['queue'];this['calleridname']=_0x394803['calleridname'];this['calleridnum']=_0x394803[_0x696e('0x12')];this[_0x696e('0x13')]=_0x394803[_0x696e('0x13')];this[_0x696e('0x14')]=_0x394803[_0x696e('0x14')];this[_0x696e('0x15')]=_0x394803[_0x696e('0x14')];this['ringtime']=_0x394803[_0x696e('0x16')]||0x0;this['holdtime']=_0x394803[_0x696e('0x17')]||0x0;this[_0x696e('0x18')]=_0x394803[_0x696e('0x18')]||0x0;this[_0x696e('0x19')]=_0x394803[_0x696e('0x19')];this[_0x696e('0x1a')]=_0x394803[_0x696e('0x1a')];this[_0x696e('0x1b')]=_0x394803[_0x696e('0x1b')];this[_0x696e('0x1c')]=_0x394803[_0x696e('0x1c')];this[_0x696e('0x1d')]=_0x394803[_0x696e('0x1d')];this[_0x696e('0x1e')]=_0x394803[_0x696e('0x1e')];this[_0x696e('0x1f')]=_0x394803[_0x696e('0x1f')];this[_0x696e('0x20')]=_0x394803['VoiceQueueId'];this[_0x696e('0x21')]=_0x394803[_0x696e('0x21')];this[_0x696e('0x22')]=_0x394803['originatecalleridnum']||'';this[_0x696e('0x23')]=_0x394803['originatecalleridname']||'';}module[_0x696e('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 5bfb171..7c4e784 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf95a=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf95a,0x1a8));var _0xaf95=function(_0x49d2f4,_0xa0acd4){_0x49d2f4=_0x49d2f4-0x0;var _0x11becb=_0xf95a[_0x49d2f4];return _0x11becb;};'use strict';var util=require(_0xaf95('0x0'));var _=require(_0xaf95('0x1'));var moment=require(_0xaf95('0x2'));function getSeconds(_0x46e9f0,_0x13cf0e){var _0x48a000=moment(_0x46e9f0)[_0xaf95('0x3')](0x0);var _0x4f3bb2=moment(_0x13cf0e)[_0xaf95('0x3')](0x0);return _0x48a000[_0xaf95('0x4')](_0x4f3bb2,_0xaf95('0x5'));}function Hangup(_0x24b186,_0x437606){this[_0xaf95('0x6')]=0x4;this[_0xaf95('0x7')]='Answer';this[_0xaf95('0x8')]=_0x24b186[_0xaf95('0x8')];this[_0xaf95('0x9')]=_0x24b186['type'];this[_0xaf95('0xa')]=_0x24b186[_0xaf95('0x9')]===_0xaf95('0xb')?'queue':_0x24b186[_0xaf95('0x9')];this[_0xaf95('0xc')]=_0x24b186[_0xaf95('0xc')];this[_0xaf95('0xd')]=_0x24b186[_0xaf95('0xd')];this[_0xaf95('0xe')]=_0x24b186[_0xaf95('0xe')];this['countglobal']=_0x24b186[_0xaf95('0xc')]+_0x24b186[_0xaf95('0xd')]+_0x24b186[_0xaf95('0xe')]+_0x24b186[_0xaf95('0xf')]+_0x24b186[_0xaf95('0x10')]+_0x24b186[_0xaf95('0x11')]+_0x24b186[_0xaf95('0x12')]+_0x24b186[_0xaf95('0x13')];this[_0xaf95('0xf')]=_0x24b186['countnosuchnumberretry'];this[_0xaf95('0x10')]=_0x24b186[_0xaf95('0x10')];this[_0xaf95('0x11')]=_0x24b186[_0xaf95('0x11')];this[_0xaf95('0x12')]=_0x24b186[_0xaf95('0x12')];this[_0xaf95('0x13')]=_0x24b186[_0xaf95('0x13')];this['uniqueid']=_0x437606[_0xaf95('0x14')];this[_0xaf95('0x15')]=_0x24b186['name'];this[_0xaf95('0x16')]=_0x24b186[_0xaf95('0x17')];this['starttime']=_0x24b186[_0xaf95('0x18')];this[_0xaf95('0x19')]=_0x24b186['responsetime'];this[_0xaf95('0x1a')]=moment()[_0xaf95('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf95('0x1c')]=getSeconds(_0x24b186[_0xaf95('0x19')],_0x24b186[_0xaf95('0x18')]);this[_0xaf95('0x1d')]=0x0;this[_0xaf95('0x1e')]=getSeconds(this[_0xaf95('0x1a')],_0x24b186[_0xaf95('0x19')]);this[_0xaf95('0x1f')]=_0x24b186['queue'];this[_0xaf95('0x20')]=_0xaf95('0x21');this[_0xaf95('0x22')]=_0x437606['cause-txt'];this[_0xaf95('0x23')]=_0x24b186['callback'];this['callbackuniqueid']=_0x24b186[_0xaf95('0x24')];this['callbackat']=_0x24b186['callbackat'];this[_0xaf95('0x25')]=_0x24b186['recallme'];this[_0xaf95('0x26')]=_0x24b186[_0xaf95('0x26')];this[_0xaf95('0x27')]=_0x24b186['ListId'];this[_0xaf95('0x28')]=_0x24b186[_0xaf95('0x28')];this['VoiceQueueId']=_0x24b186[_0xaf95('0x29')];this['CampaignId']=_0x24b186[_0xaf95('0x2a')];}module[_0xaf95('0x2b')]=Hangup; \ No newline at end of file +var _0x15ce=['ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x55bf6b,_0x40ee51){var _0x3a1fc1=function(_0x149e86){while(--_0x149e86){_0x55bf6b['push'](_0x55bf6b['shift']());}};_0x3a1fc1(++_0x40ee51);}(_0x15ce,0x180));var _0xe15c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x15ce[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xe15c('0x0'));var _=require(_0xe15c('0x1'));var moment=require('moment');function getSeconds(_0x1cd450,_0x1d09b0){var _0x4f127d=moment(_0x1cd450)['milliseconds'](0x0);var _0xf26306=moment(_0x1d09b0)[_0xe15c('0x2')](0x0);return _0x4f127d[_0xe15c('0x3')](_0xf26306,_0xe15c('0x4'));}function Hangup(_0x397a74,_0x4e3fef){this[_0xe15c('0x5')]=0x4;this[_0xe15c('0x6')]=_0xe15c('0x7');this['scheduledat']=_0x397a74['scheduledat'];this[_0xe15c('0x8')]=_0x397a74['type'];this[_0xe15c('0x9')]=_0x397a74[_0xe15c('0x8')]===_0xe15c('0xa')?_0xe15c('0xb'):_0x397a74[_0xe15c('0x8')];this[_0xe15c('0xc')]=_0x397a74[_0xe15c('0xc')];this[_0xe15c('0xd')]=_0x397a74[_0xe15c('0xd')];this['countnoanswerretry']=_0x397a74[_0xe15c('0xe')];this[_0xe15c('0xf')]=_0x397a74[_0xe15c('0xc')]+_0x397a74[_0xe15c('0xd')]+_0x397a74[_0xe15c('0xe')]+_0x397a74[_0xe15c('0x10')]+_0x397a74[_0xe15c('0x11')]+_0x397a74[_0xe15c('0x12')]+_0x397a74[_0xe15c('0x13')]+_0x397a74[_0xe15c('0x14')];this[_0xe15c('0x10')]=_0x397a74[_0xe15c('0x10')];this[_0xe15c('0x11')]=_0x397a74[_0xe15c('0x11')];this['countabandonedretry']=_0x397a74['countabandonedretry'];this[_0xe15c('0x13')]=_0x397a74[_0xe15c('0x13')];this['countagentrejectretry']=_0x397a74[_0xe15c('0x14')];this[_0xe15c('0x15')]=_0x4e3fef['uniqueid'];this['calleridname']=_0x397a74[_0xe15c('0x16')];this[_0xe15c('0x17')]=_0x397a74[_0xe15c('0x18')];this[_0xe15c('0x19')]=_0x397a74['starttime'];this[_0xe15c('0x1a')]=_0x397a74[_0xe15c('0x1a')];this[_0xe15c('0x1b')]=moment()[_0xe15c('0x1c')](_0xe15c('0x1d'));this[_0xe15c('0x1e')]=getSeconds(_0x397a74[_0xe15c('0x1a')],_0x397a74[_0xe15c('0x19')]);this[_0xe15c('0x1f')]=0x0;this[_0xe15c('0x20')]=getSeconds(this[_0xe15c('0x1b')],_0x397a74[_0xe15c('0x1a')]);this[_0xe15c('0xb')]=_0x397a74[_0xe15c('0xb')];this[_0xe15c('0x21')]='IVR';this[_0xe15c('0x22')]=_0x4e3fef[_0xe15c('0x23')];this[_0xe15c('0x24')]=_0x397a74[_0xe15c('0x24')];this['callbackuniqueid']=_0x397a74[_0xe15c('0x25')];this[_0xe15c('0x26')]=_0x397a74[_0xe15c('0x26')];this[_0xe15c('0x27')]=_0x397a74[_0xe15c('0x27')];this[_0xe15c('0x28')]=_0x397a74['ContactId'];this['ListId']=_0x397a74[_0xe15c('0x29')];this[_0xe15c('0x2a')]=_0x397a74['UserId'];this[_0xe15c('0x2b')]=_0x397a74[_0xe15c('0x2b')];this['CampaignId']=_0x397a74[_0xe15c('0x2c')];}module[_0xe15c('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 6a45bfe..27c1ff6 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa348=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','queue','calleridname','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa348,0xb2));var _0x8a34=function(_0x29e2a2,_0x164c94){_0x29e2a2=_0x29e2a2-0x0;var _0x85c59d=_0xa348[_0x29e2a2];return _0x85c59d;};'use strict';var util=require(_0x8a34('0x0'));var _=require('lodash');var moment=require(_0x8a34('0x1'));function getSeconds(_0x524d48,_0x4dfbb8){var _0x5984ce=moment(_0x524d48)[_0x8a34('0x2')](0x0);var _0x3b1db5=moment(_0x4dfbb8)[_0x8a34('0x2')](0x0);return _0x5984ce[_0x8a34('0x3')](_0x3b1db5,_0x8a34('0x4'));}function History(_0x36db04){this[_0x8a34('0x5')]=_0x36db04[_0x8a34('0x5')];this[_0x8a34('0x6')]=_0x36db04[_0x8a34('0x6')]||undefined;this['type']=_0x36db04[_0x8a34('0x7')];this[_0x8a34('0x8')]=_0x36db04[_0x8a34('0x7')]===_0x8a34('0x9')?'queue':_0x36db04[_0x8a34('0x7')];this[_0x8a34('0xa')]=_0x36db04['countbusyretry'];this[_0x8a34('0xb')]=_0x36db04[_0x8a34('0xb')];this[_0x8a34('0xc')]=_0x36db04[_0x8a34('0xc')];this[_0x8a34('0xd')]=_0x36db04[_0x8a34('0xa')]+_0x36db04[_0x8a34('0xb')]+_0x36db04[_0x8a34('0xc')]+_0x36db04['countnosuchnumberretry']+_0x36db04['countdropretry']+_0x36db04[_0x8a34('0xe')]+_0x36db04[_0x8a34('0xf')]+_0x36db04['countagentrejectretry'];this[_0x8a34('0x10')]=_0x36db04[_0x8a34('0x10')];this[_0x8a34('0x11')]=_0x36db04[_0x8a34('0x11')];this[_0x8a34('0xe')]=_0x36db04[_0x8a34('0xe')];this[_0x8a34('0xf')]=_0x36db04[_0x8a34('0xf')];this[_0x8a34('0x12')]=_0x36db04[_0x8a34('0x12')];this['queue']=_0x36db04[_0x8a34('0x13')];this[_0x8a34('0x14')]=_0x36db04['name'];this['calleridnum']=_0x36db04[_0x8a34('0x15')];this[_0x8a34('0x16')]=_0x36db04[_0x8a34('0x16')];this['responsetime']=_0x36db04[_0x8a34('0x17')];this['endtime']=_0x36db04[_0x8a34('0x17')];this[_0x8a34('0x18')]=getSeconds(_0x36db04[_0x8a34('0x17')],_0x36db04[_0x8a34('0x16')]);this['holdtime']=0x0;this[_0x8a34('0x19')]=0x0;this[_0x8a34('0x1a')]=_0x36db04[_0x8a34('0x1a')];this[_0x8a34('0x1b')]=_0x36db04['callbackuniqueid'];this[_0x8a34('0x1c')]=_0x36db04[_0x8a34('0x1c')];this[_0x8a34('0x1d')]=_0x36db04[_0x8a34('0x1d')];this[_0x8a34('0x1e')]=_0x36db04['ContactId'];this[_0x8a34('0x1f')]=_0x36db04[_0x8a34('0x1f')];this['UserId']=_0x36db04['UserId'];this[_0x8a34('0x20')]=_0x36db04[_0x8a34('0x20')];this['CampaignId']=_0x36db04[_0x8a34('0x21')];this[_0x8a34('0x22')]=_0x36db04[_0x8a34('0x22')]||'';this[_0x8a34('0x23')]=_0x36db04[_0x8a34('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0x2eb1=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','responsetime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff'];(function(_0xaa8f3d,_0x5de7c8){var _0x2c837e=function(_0x114b3a){while(--_0x114b3a){_0xaa8f3d['push'](_0xaa8f3d['shift']());}};_0x2c837e(++_0x5de7c8);}(_0x2eb1,0xb0));var _0x12eb=function(_0x23e4a9,_0x53f462){_0x23e4a9=_0x23e4a9-0x0;var _0x54f179=_0x2eb1[_0x23e4a9];return _0x54f179;};'use strict';var util=require(_0x12eb('0x0'));var _=require(_0x12eb('0x1'));var moment=require('moment');function getSeconds(_0x6306ff,_0x179685){var _0x33f9fd=moment(_0x6306ff)[_0x12eb('0x2')](0x0);var _0x1da81d=moment(_0x179685)['milliseconds'](0x0);return _0x33f9fd[_0x12eb('0x3')](_0x1da81d,'seconds');}function History(_0x164886){this[_0x12eb('0x4')]=_0x164886[_0x12eb('0x4')];this[_0x12eb('0x5')]=_0x164886[_0x12eb('0x5')]||undefined;this[_0x12eb('0x6')]=_0x164886[_0x12eb('0x6')];this[_0x12eb('0x7')]=_0x164886['type']===_0x12eb('0x8')?_0x12eb('0x9'):_0x164886[_0x12eb('0x6')];this[_0x12eb('0xa')]=_0x164886[_0x12eb('0xa')];this[_0x12eb('0xb')]=_0x164886['countcongestionretry'];this[_0x12eb('0xc')]=_0x164886[_0x12eb('0xc')];this['countglobal']=_0x164886['countbusyretry']+_0x164886['countcongestionretry']+_0x164886[_0x12eb('0xc')]+_0x164886[_0x12eb('0xd')]+_0x164886['countdropretry']+_0x164886[_0x12eb('0xe')]+_0x164886[_0x12eb('0xf')]+_0x164886[_0x12eb('0x10')];this['countnosuchnumberretry']=_0x164886['countnosuchnumberretry'];this['countdropretry']=_0x164886[_0x12eb('0x11')];this[_0x12eb('0xe')]=_0x164886[_0x12eb('0xe')];this['countmachineretry']=_0x164886[_0x12eb('0xf')];this[_0x12eb('0x10')]=_0x164886['countagentrejectretry'];this['queue']=_0x164886[_0x12eb('0x9')];this[_0x12eb('0x12')]=_0x164886[_0x12eb('0x13')];this['calleridnum']=_0x164886[_0x12eb('0x14')];this[_0x12eb('0x15')]=_0x164886[_0x12eb('0x15')];this['responsetime']=_0x164886[_0x12eb('0x16')];this['endtime']=_0x164886[_0x12eb('0x16')];this['ringtime']=getSeconds(_0x164886[_0x12eb('0x16')],_0x164886['starttime']);this[_0x12eb('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x164886[_0x12eb('0x18')];this[_0x12eb('0x19')]=_0x164886['callbackuniqueid'];this[_0x12eb('0x1a')]=_0x164886[_0x12eb('0x1a')];this[_0x12eb('0x1b')]=_0x164886[_0x12eb('0x1b')];this[_0x12eb('0x1c')]=_0x164886['ContactId'];this[_0x12eb('0x1d')]=_0x164886[_0x12eb('0x1d')];this[_0x12eb('0x1e')]=_0x164886['UserId'];this[_0x12eb('0x1f')]=_0x164886[_0x12eb('0x1f')];this[_0x12eb('0x20')]=_0x164886['CampaignId'];this[_0x12eb('0x21')]=_0x164886[_0x12eb('0x21')]||'';this[_0x12eb('0x22')]=_0x164886[_0x12eb('0x22')]||'';}module[_0x12eb('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0e249d0..f0c9873 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 _0x2b87=['Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','pTalking','NOT_ACTIVE','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','endtime','starttime','prototype','clearZombieChannels','uniqueId','[uniqueid]','[actions]','isNil','status','channel','updateOriginated','voiceQueues','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','catch','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','saveInDb','merge','pick','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countdropretry','countabandonedretry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','syncAgentComplete','reason','agent','dialQueueProject2','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','ListId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','rrmemory','queueBooked','push','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridnum','dialCutDigit','substring','trim','from-sip','[originateError]:\x20%s','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','busyFactor','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','handleIvr','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./final','./agentComplete','./hangup','env','127.0.0.1','roundrobin','enqueue','tail','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','md5','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond'];(function(_0x1aceff,_0x58757e){var _0x1bd903=function(_0x66de46){while(--_0x66de46){_0x1aceff['push'](_0x1aceff['shift']());}};_0x1bd903(++_0x58757e);}(_0x2b87,0x186));var _0x72b8=function(_0x418f49,_0x75b1b4){_0x418f49=_0x418f49-0x0;var _0x4fcf03=_0x2b87[_0x418f49];return _0x4fcf03;};'use strict';var util=require(_0x72b8('0x0'));var _=require(_0x72b8('0x1'));var BPromise=require(_0x72b8('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x72b8('0x3'));var ut=require(_0x72b8('0x4'));var config=require(_0x72b8('0x5'));var logger=require(_0x72b8('0x6'))(_0x72b8('0x7'));var loggerBooked=require(_0x72b8('0x6'))(_0x72b8('0x8'));var loggerPredictive=require(_0x72b8('0x6'))('predictive');var loggerPredictiveCalls=require(_0x72b8('0x6'))(_0x72b8('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x72b8('0xa'));var ami=require(_0x72b8('0xb'));config[_0x72b8('0xc')]=_['defaults'](config[_0x72b8('0xc')],{'host':_0x72b8('0xd'),'port':0x18eb});var io=require(_0x72b8('0xe'))(new Redis(config['redis']));var cmHopper=require(_0x72b8('0xf'));var cmHopperHistory=require(_0x72b8('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x72b8('0x11'));var History=require('./history');var Final=require(_0x72b8('0x12'));var AgentComplete=require(_0x72b8('0x13'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x72b8('0x14'));var ipAgi=process[_0x72b8('0x15')]['XCALLY_IP_AGI']||_0x72b8('0x16');var strategy={'rrmemory':'rrmemory','roundrobin':_0x72b8('0x17')};var Sequence=function(){};Sequence['prototype'][_0x72b8('0x18')]=function(_0x4d2bf5){this[_0x72b8('0x19')]=this[_0x72b8('0x19')]?this['tail']['finally'](_0x4d2bf5):_0x4d2bf5();};function Dialer(_0x1772d0,_0x3aa06b){this[_0x72b8('0x1a')]=new Sequence();this[_0x72b8('0x1b')]=_0x3aa06b;this['voiceQueues']=_0x1772d0['voiceQueues'];this[_0x72b8('0x1c')]=_0x1772d0[_0x72b8('0x1c')];this['agents']=_0x1772d0[_0x72b8('0x1d')];this[_0x72b8('0x1e')]=_0x1772d0[_0x72b8('0x1e')];this[_0x72b8('0x1f')]=config[_0x72b8('0x1f')]||0x2;this[_0x72b8('0x20')]={};this[_0x72b8('0x21')]={};this[_0x72b8('0x22')]={};this['uniqueId']={};this[_0x72b8('0x23')]={};this[_0x72b8('0x24')]={};this[_0x72b8('0x25')]={};this[_0x72b8('0x26')]={};this['queueBooked']={};this[_0x72b8('0x27')]={};ami['on'](_0x72b8('0x28'),this[_0x72b8('0x29')]['bind'](this));ami['on'](_0x72b8('0x2a'),this[_0x72b8('0x2b')]['bind'](this));ami['on'](_0x72b8('0x2c'),this[_0x72b8('0x2d')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x72b8('0x2e')](this));ami['on']('custom:queuesummary',this[_0x72b8('0xa')][_0x72b8('0x2e')](this));ami['on'](_0x72b8('0x2f'),this['syncHangup'][_0x72b8('0x2e')](this));ami['on'](_0x72b8('0x30'),this[_0x72b8('0x31')]['bind'](this));ami['on'](_0x72b8('0x32'),this[_0x72b8('0x33')][_0x72b8('0x2e')](this));ami['on'](_0x72b8('0x34'),this[_0x72b8('0x35')][_0x72b8('0x2e')](this));ami['on'](_0x72b8('0x36'),this['syncQueueStatusComplete'][_0x72b8('0x2e')](this));this['loopCampaigns']();this[_0x72b8('0x37')]();}function isNotNull(_0x2a830e){return _0x2a830e!==null&&!_[_0x72b8('0x38')](_0x2a830e);}function checkIsLoggedIn(_0x4643e3,_0xe31f0c){return function(){if(_0xe31f0c<=0x0){_0x4643e3[_0x72b8('0x39')]=_0x72b8('0x3a');throw _0x4643e3[_0x72b8('0x3b')]+_0x72b8('0x3c');}};}function isActive(_0x4be606){return _0x4be606;}function checkIsActive(_0x5d34d3,_0x5b98e7){return function(){if(!isActive(_0x5b98e7)){_0x5d34d3[_0x72b8('0x39')]='NOT_ACTIVE';throw _0x5d34d3[_0x72b8('0x3b')]+_0x72b8('0x3d');}};}function checkInterval(_0x197ece){return function(){if(!isNotNull(_0x197ece[_0x72b8('0x3e')])){_0x197ece[_0x72b8('0x39')]='INTERVAL_IS_NULL';throw _0x197ece['name']+_0x72b8('0x3f');}if(!isNotNull(_0x197ece['Interval'][_0x72b8('0x40')])){_0x197ece[_0x72b8('0x39')]=_0x72b8('0x41');throw _0x197ece['name']+_0x72b8('0x3f');}if(!isNotNull(_['isEmpty'](_0x197ece[_0x72b8('0x3e')][_0x72b8('0x40')]))){_0x197ece[_0x72b8('0x39')]='INTERVAL_IS_NULL';throw _0x197ece['name']+_0x72b8('0x3f');}};}function msgResponse(_0x470e55,_0x522ce3,_0x2bce34){return{'action':_0x470e55,'response':_0x522ce3,'message':_0x2bce34,'stack':_0x2bce34};}function myreject(_0x18dc9b){return function(_0x5d0c0a){return _0x18dc9b(msgResponse(_0x72b8('0x42'),_0x72b8('0x43'),JSON[_0x72b8('0x44')](_0x5d0c0a)));};}function getSeconds(_0x44a11c,_0x1ab9a6){var _0xe135b=moment(_0x44a11c)[_0x72b8('0x45')](0x0);var _0x4083f4=moment(_0x1ab9a6)[_0x72b8('0x45')](0x0);return _0xe135b[_0x72b8('0x46')](_0x4083f4,'seconds');}function emit(_0x4aff5e,_0x5284e0,_0xb89f2c){io['to'](_0x4aff5e)[_0x72b8('0x47')](_0x5284e0,_0xb89f2c);}function emitVoiceQueueSummary(_0x58d0a6){if(_0x58d0a6[_0x72b8('0x48')]===_0x72b8('0x49')){var _0xcd1f1f={'id':_0x58d0a6['id'],'name':_0x58d0a6[_0x72b8('0x3b')],'strategy':_0x58d0a6[_0x72b8('0x4a')],'answered':_0x58d0a6[_0x72b8('0x4b')],'available':_0x58d0a6[_0x72b8('0x4c')],'loggedIn':_0x58d0a6[_0x72b8('0x4d')],'pTalking':_0x58d0a6['pTalking'],'sumBillable':_0x58d0a6['sumBillable'],'sumDuration':_0x58d0a6[_0x72b8('0x4e')],'sumHoldTime':_0x58d0a6['sumHoldTime']||0x0,'talking':_0x58d0a6[_0x72b8('0x4f')],'total':_0x58d0a6[_0x72b8('0x50')],'type':_0x58d0a6[_0x72b8('0x48')],'unmanaged':_0x58d0a6[_0x72b8('0x51')],'abandoned':_0x58d0a6[_0x72b8('0x52')],'waiting':_0x58d0a6[_0x72b8('0x53')],'loggedInDb':_0x58d0a6[_0x72b8('0x54')],'dialActive':_0x58d0a6[_0x72b8('0x55')],'dialMethod':_0x58d0a6[_0x72b8('0x56')],'dialOriginateCallerIdName':_0x58d0a6[_0x72b8('0x57')],'dialOriginateCallerIdNumber':_0x58d0a6['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x58d0a6[_0x72b8('0x58')],'dialPrefix':_0x58d0a6[_0x72b8('0x59')],'outboundAnswerAgiCallsDay':_0x58d0a6[_0x72b8('0x5a')],'outboundAnswerCallsDay':_0x58d0a6[_0x72b8('0x5b')],'outboundBlacklistCallsDay':_0x58d0a6['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x58d0a6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x58d0a6[_0x72b8('0x5c')],'outboundDropCallsDayACS':_0x58d0a6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x58d0a6[_0x72b8('0x5d')],'outboundDropCallsDayTimeout':_0x58d0a6[_0x72b8('0x5e')],'outboundNoAnswerCallsDay':_0x58d0a6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x58d0a6[_0x72b8('0x5f')],'outboundOriginateFailureCallsDay':_0x58d0a6[_0x72b8('0x60')],'outboundReCallsDay':_0x58d0a6['outboundReCallsDay'],'outboundRejectCallsDay':_0x58d0a6[_0x72b8('0x61')],'outboundUnknownCallsDay':_0x58d0a6[_0x72b8('0x62')],'predictiveIntervalAnsweredCalls':_0x58d0a6[_0x72b8('0x63')],'predictiveIntervalAvgHoldtime':_0x58d0a6[_0x72b8('0x64')],'predictiveIntervalAvgTalktime':_0x58d0a6[_0x72b8('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x58d0a6[_0x72b8('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x58d0a6[_0x72b8('0x67')],'predictiveIntervalErlangCalls':_0x58d0a6[_0x72b8('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x58d0a6[_0x72b8('0x69')],'predictiveIntervalHitRate':_0x58d0a6[_0x72b8('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x58d0a6['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x58d0a6[_0x72b8('0x6b')],'predictiveIntervalAvailable':_0x58d0a6[_0x72b8('0x6c')],'predictiveIntervalTotalCalls':_0x58d0a6['predictiveIntervalTotalCalls'],'message':_0x58d0a6[_0x72b8('0x39')],'originated':_0x58d0a6[_0x72b8('0x6d')],'erlangCalls':_0x58d0a6['erlangCalls'],'erlangCallToSecond':_0x58d0a6['erlangCallToSecond'],'erlangAbandonmentRate':_0x58d0a6[_0x72b8('0x6e')],'erlangBusyFactor':_0x58d0a6[_0x72b8('0x6f')],'startPredictive':_0x58d0a6[_0x72b8('0x24')],'startProgressive':_0x58d0a6[_0x72b8('0x25')]};if(_0x58d0a6['Trunk']){_0xcd1f1f[_0x72b8('0x70')]={'id':_0x58d0a6['Trunk']['id'],'name':_0x58d0a6[_0x72b8('0x70')]['name'],'active':_0x58d0a6[_0x72b8('0x70')][_0x72b8('0x71')],'callerid':_0x58d0a6[_0x72b8('0x70')]['callerid']};}if(_0x58d0a6[_0x72b8('0x3e')]){_0xcd1f1f[_0x72b8('0x3e')]={'id':_0x58d0a6['Interval']['id'],'name':_0x58d0a6[_0x72b8('0x3e')][_0x72b8('0x3b')]};}var _0xe4d808=md5(JSON[_0x72b8('0x44')](_0xcd1f1f));if(_0x58d0a6['md5']!==_0xe4d808){_0x58d0a6[_0x72b8('0x72')]=_0xe4d808;emit(util['format'](_0x72b8('0x73'),_0xcd1f1f[_0x72b8('0x3b')]),_0x72b8('0x74'),_0xcd1f1f);}}}function emitCampaignSummary(_0x1cd964){if(_0x1cd964['type']===_0x72b8('0x75')){emit(util[_0x72b8('0x76')](_0x72b8('0x77'),_0x1cd964[_0x72b8('0x3b')]),_0x72b8('0x78'),_0x1cd964);}}function checkGetDataPredictive(_0x464700){if(isNotNull(_0x464700)&&!_[_0x72b8('0x79')](_0x464700)){loggerPredictive['info'](_0x72b8('0x7a'));loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x7c'),_0x464700['predictiveIntervalTotalCalls']);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x7d'),_0x464700[_0x72b8('0x63')]);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x7e'),_0x464700[_0x72b8('0x67')]);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x7f'),_0x464700[_0x72b8('0x66')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x464700[_0x72b8('0x64')]);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x80'),_0x464700[_0x72b8('0x65')]);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x81'));if(_0x464700[_0x72b8('0x82')]>0x0){if(!_['isUndefined'](_0x464700[_0x72b8('0x65')])&&_0x464700[_0x72b8('0x65')]>0x0){return!![];}loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x83'));if(!_[_0x72b8('0x38')](_0x464700[_0x72b8('0x64')])&&_0x464700[_0x72b8('0x64')]>0x0){return!![];}loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x84'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2e54cb){return function(_0x2c8edd){loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x85'));loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x86'),_0x2c8edd[_0x72b8('0x87')]);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x88'),_0x2c8edd[_0x72b8('0x89')]);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x8a'),_0x2c8edd[_0x72b8('0x6e')]);loggerPredictive['info'](_0x72b8('0x8b'),_0x2c8edd[_0x72b8('0x6f')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c8edd[_0x72b8('0x6e')]);loggerPredictive['info'](_0x72b8('0x81'));_['merge'](_0x2e54cb,_0x2c8edd);};}function getDiff(_0x4bb794){var _0x32f9e6=moment()[_0x72b8('0x45')](0x0);var _0x18182d=moment(_0x4bb794)[_0x72b8('0x45')](0x0);return _0x32f9e6[_0x72b8('0x46')](_0x18182d,_0x72b8('0x8c'));}function ifInterval(_0xc496b0,_0x21aaea){if(_[_0x72b8('0x38')](_0x21aaea)){return![];}return getDiff(_0x21aaea)<_0xc496b0*0x3c;}function freeVariablesPredictive(_0x33c307){if(isNotNull(_0x33c307)){if(!_[_0x72b8('0x38')](_0x33c307['startProgressive'])){_0x33c307['startProgressive']=undefined;loggerPredictive[_0x72b8('0x7b')](_0x33c307[_0x72b8('0x3b')],_0x72b8('0x8d'));}if(!_['isUndefined'](_0x33c307[_0x72b8('0x24')])){_0x33c307[_0x72b8('0x24')]=undefined;loggerPredictive[_0x72b8('0x7b')](_0x33c307[_0x72b8('0x3b')],_0x72b8('0x8e'));}if(!_['isUndefined'](_0x33c307[_0x72b8('0x8f')])){clearInterval(_0x33c307[_0x72b8('0x8f')]);_0x33c307[_0x72b8('0x8f')]=undefined;loggerPredictive[_0x72b8('0x7b')](_0x33c307[_0x72b8('0x3b')],_0x72b8('0x90'));}}}function erlangb(_0x11ed3f,_0x19ab17){if(_0x19ab17===0x0){return 0x0;}var _0x452550=0x1;for(var _0x449618=0x1;_0x449618<=_0x19ab17;_0x449618+=0x1){_0x452550=0x1+_0x452550*_0x449618/_0x11ed3f;}return 0x1/_0x452550;}function isVoiceQueueOutbound(_0x22b6e6){return _0x22b6e6==='outbound';}function isNotPreview(_0xae1168){return _0xae1168!=='preview';}function isCampaignIvr(_0x3431a0){return _0x3431a0===_0x72b8('0x75');}function getCallerId(_0x43aa5d,_0x16774b,_0x2e438c){if(!_['isUndefined'](_0x2e438c)&&typeof _0x2e438c===_0x72b8('0x91')&&!_[_0x72b8('0x79')](_0x2e438c)){if(!_[_0x72b8('0x38')](_0x16774b)&&typeof _0x16774b==='string'&&!_['isEmpty'](_0x16774b)){return util[_0x72b8('0x76')]('\x22%s\x22\x20<%s>',_0x16774b,_0x2e438c);}return util['format']('\x22%s\x22\x20<%s>',_0x2e438c,_0x2e438c);}if(!_['isUndefined'](_0x43aa5d)&&typeof _0x43aa5d==='string'&&!_[_0x72b8('0x79')](_0x43aa5d)){return _0x43aa5d;}return _0x72b8('0x92');}function loggerCatchQueueSummary(_0x15207d,_0x396877){return function(_0x18206f){freeVariablesPredictive(_0x396877);emitVoiceQueueSummary(_0x396877);emitCampaignSummary(_0x396877);loggerSyncQueueSummary[_0x72b8('0x93')](_0x15207d,util[_0x72b8('0x94')](_0x18206f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x39d807,_0x1de46f){return function(_0x5416e7){loggerPredictive[_0x72b8('0x93')](_0x1de46f['name'],_0x39d807);loggerPredictive[_0x72b8('0x93')](_0x5416e7['stack']);freeVariablesPredictive(_0x1de46f);};}function loggerCatch(_0x961b54){return function(_0x25ab8c){logger[_0x72b8('0x93')](_0x961b54,util[_0x72b8('0x94')](_0x25ab8c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1863e2){return _0x1863e2&&!_[_0x72b8('0x38')](_0x1863e2)&&_0x1863e2[_0x72b8('0x95')]>0x0;}function decremetOriginate(_0x4cf0e5){if(!_['isUndefined'](_0x4cf0e5)&&_0x4cf0e5!==null){if(typeof _0x4cf0e5[_0x72b8('0x6d')]!=='undefined'){if(_0x4cf0e5[_0x72b8('0x6d')]>0x0){_0x4cf0e5[_0x72b8('0x6d')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x72b8('0x96'));}}function checkContactLowerLimitOriginate(_0x1a30c9,_0x351217,_0x30507d){if(_0x351217>_0x30507d){for(var _0x121826=0x0;_0x121826<_0x351217-_0x30507d;_0x121826+=0x1){decremetOriginate(_0x1a30c9);}}}function loggerGetContactDialer(_0xd7b20c,_0x5a72fa,_0x5b53d0){return function(_0x346057){checkContactLowerLimitOriginate(_0x5a72fa,_0x5b53d0,0x0);logger['error'](_0xd7b20c,util[_0x72b8('0x94')](_0x346057,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1af8f2){return function(_0x4f9d37){if(isNotNull(_0x4f9d37)&&isNotNull(_0x4f9d37[0x0])){if(_0x4f9d37[0x0][_0x72b8('0x97')]>0x0){_0x1af8f2[_0x72b8('0x39')]=_0x72b8('0x98');logger['info'](_0x72b8('0x99')+_0x1af8f2[_0x72b8('0x3b')],_0x4f9d37[0x0][_0x72b8('0x97')],'contacts');}else{_0x1af8f2[_0x72b8('0x39')]=_0x72b8('0x9a');logger['info']('[getContactDialer2][Empty]'+_0x1af8f2[_0x72b8('0x3b')]);}}};}function notSendMessagesQueue(_0x2190d4){if(_0x2190d4['sendMessageOneNotActive']){freeVariablesPredictive(_0x2190d4);if(_0x2190d4[_0x72b8('0x6d')]===0x0&&_0x2190d4[_0x72b8('0x4f')]===0x0&&_0x2190d4[_0x72b8('0x53')]===0x0&&(_0x2190d4[_0x72b8('0x9b')]||0x0)===0x0){_0x2190d4['sendMessageOneNotActive']=![];_0x2190d4[_0x72b8('0x4c')]=0x0;_0x2190d4[_0x72b8('0x39')]=_0x72b8('0x9c');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2190d4[_0x72b8('0x3b')],_0x72b8('0x9d'));}else{_0x2190d4['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x72b8('0x93')](_0x72b8('0x9e'),_0x2190d4['name'],_0x72b8('0x9f'));}emitVoiceQueueSummary(_0x2190d4);}}function notSendMessagesCampaign(_0x33cd93){if(_0x33cd93[_0x72b8('0xa0')]){if(_0x33cd93['originated']===0x0){_0x33cd93[_0x72b8('0xa0')]=![];_0x33cd93[_0x72b8('0x39')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x72b8('0xa1'),_0x33cd93[_0x72b8('0x3b')],_0x72b8('0x9d'));}else{_0x33cd93[_0x72b8('0x39')]=_0x72b8('0xa2');loggerSyncQueueSummary[_0x72b8('0x93')](_0x72b8('0xa1'),_0x33cd93[_0x72b8('0x3b')],_0x72b8('0x9f'));}emitCampaignSummary(_0x33cd93);}}function createObjHistory(_0x11016f,_0xa8cbec,_0x38c2a8,_0x2b3b23,_0x4baba4){_0x11016f[_0x72b8('0x39')]=_0x38c2a8;var _0x4bd6d9=new Action(_0x11016f,_0xa8cbec);var _0xa86666=new History(_0x4bd6d9);_0xa86666[_0x72b8('0xa3')]=_0x2b3b23;_0xa86666['statedesc']=_0x4baba4;_0xa86666[_0x72b8('0xa4')]=_0x4bd6d9[_0x72b8('0xa5')];return _0xa86666;}Dialer[_0x72b8('0xa6')][_0x72b8('0x37')]=function(){var _0x2528b5=this;setInterval(function(){_0x2528b5[_0x72b8('0xa7')](_0x2528b5[_0x72b8('0xa8')],_0x72b8('0xa9'));_0x2528b5[_0x72b8('0xa7')](_0x2528b5[_0x72b8('0x21')],_0x72b8('0xaa'));},0x32c8);};Dialer[_0x72b8('0xa6')][_0x72b8('0xa7')]=function(_0x2336f0,_0x4d81fe){var _0x5c9952=this;for(var _0x849f3d in _0x2336f0){if(typeof _0x2336f0[_0x849f3d]!=='undefined'){this[_0x72b8('0x1a')][_0x72b8('0x18')](function(){if(!_[_0x72b8('0xab')](_0x2336f0[_0x849f3d])){return ami['Action']({'action':_0x72b8('0xac'),'channel':_0x2336f0[_0x849f3d][_0x72b8('0xad')]})['catch'](function(_0xc57946){if(_0xc57946[_0x72b8('0x39')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2336f0[_0x849f3d]&&_0x2336f0[_0x849f3d][_0x72b8('0x48')]!==_0x72b8('0x75')){_0x5c9952[_0x72b8('0xae')](_0x5c9952[_0x72b8('0xaf')][_0x2336f0[_0x849f3d][_0x72b8('0xb0')]]);logger[_0x72b8('0x93')](_0x72b8('0xb1'),_0x4d81fe,_0x849f3d,_0x2336f0[_0x849f3d][_0x72b8('0xb0')]);delete _0x2336f0[_0x849f3d];}if(_0x2336f0[_0x849f3d]&&_0x2336f0[_0x849f3d][_0x72b8('0x48')]===_0x72b8('0x75')){_0x5c9952[_0x72b8('0xae')](_0x5c9952['campaigns'][_0x2336f0[_0x849f3d][_0x72b8('0xb0')]]);logger[_0x72b8('0x93')](_0x72b8('0xb2'),_0x4d81fe,_0x849f3d,_0x2336f0[_0x849f3d]['queue']);delete _0x2336f0[_0x849f3d];}},0x2328);}});}});}}};Dialer[_0x72b8('0xa6')]['countReScheduled']=function(_0x3e2915){return BPromise[_0x72b8('0xb3')]()['then'](cmHopper[_0x72b8('0xb4')](_0x3e2915))['catch'](loggerCatch(_0x72b8('0xb5')));};Dialer['prototype'][_0x72b8('0xb6')]=function(_0x18b767){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](cmHopperBlack[_0x72b8('0xb6')](_0x18b767))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x72b8('0xa6')]['checkIsBlackListIvr']=function(_0x352399){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](cmHopperBlack[_0x72b8('0xb8')](_0x352399))['catch'](loggerCatch(_0x72b8('0xb9')));};Dialer[_0x72b8('0xa6')][_0x72b8('0xba')]=function(_0x1be199){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](cmHopperHistory['avgHandleTime'](_0x1be199))['catch'](loggerCatch(_0x72b8('0xbb')));};Dialer[_0x72b8('0xa6')][_0x72b8('0xbc')]=function(_0x1a1145){return BPromise[_0x72b8('0xb3')]()['then'](cmHopper[_0x72b8('0xbc')](_0x1a1145))[_0x72b8('0xbd')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x72b8('0xa6')][_0x72b8('0xbe')]=function(_0x447bb8,_0x6e7499,_0x30a3d4){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](cmHopper['unlockContact'](_0x447bb8,_0x6e7499,_0x30a3d4))[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xbf')));};Dialer[_0x72b8('0xa6')][_0x72b8('0xc0')]=function(_0x3fe4e9,_0x517ce6,_0x4ba3d1,_0x5933a3){return BPromise['resolve']()['then'](cmHopper[_0x72b8('0xc0')](_0x3fe4e9,_0x517ce6,_0x4ba3d1,_0x5933a3))['catch'](loggerCatch(_0x72b8('0xc1')));};Dialer[_0x72b8('0xa6')]['getContactDialerIvr']=function(_0x2dbfd9,_0x4c40e3,_0x1c5f03){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](cmHopper[_0x72b8('0xc2')](_0x2dbfd9,_0x4c40e3,_0x1c5f03))['catch'](loggerCatch(_0x72b8('0xc1')));};Dialer[_0x72b8('0xa6')][_0x72b8('0xc3')]=function(_0x473360){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](voiceQueueRt[_0x72b8('0xc3')](_0x473360))[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xc4')));};Dialer['prototype'][_0x72b8('0xc5')]=function(_0x3974f0){return BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](cmHopper[_0x72b8('0xc5')](_0x3974f0))[_0x72b8('0xbd')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x72b8('0xa6')]['createHistory']=function(_0x244b8f){return BPromise[_0x72b8('0xb3')]()['then'](cmHopperHistory[_0x72b8('0xc6')](_0x244b8f))[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xc7')));};Dialer[_0x72b8('0xa6')]['updateOriginated']=function(_0x377db0){if(!_[_0x72b8('0x38')](_0x377db0)&&_0x377db0!==null){if(typeof _0x377db0['originated']!==_0x72b8('0xc8')){if(_0x377db0[_0x72b8('0x6d')]>0x0){_0x377db0[_0x72b8('0x6d')]-=0x1;}else{logger[_0x72b8('0x93')](_0x72b8('0xc9'));}}}else{logger[_0x72b8('0x93')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x72b8('0xa6')][_0x72b8('0xca')]=function(_0x6935a9,_0x210889){var _0x17d108=this;return function(_0x1d5e94){_0x17d108[_0x72b8('0xae')](_0x210889);logger['error'](_0x6935a9,util[_0x72b8('0x94')](_0x1d5e94,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x22ab2c,_0x52c43e,_0x10486b){var _0x558431={'state':0x19,'statedesc':'notFound'};this[_0x72b8('0xae')](_0x52c43e);this[_0x72b8('0xcb')](_[_0x72b8('0xcc')](_0x558431,_[_0x72b8('0xcd')](_0x10486b,['ContactId','ListId',_0x72b8('0xce'),_0x72b8('0xcf'),_0x72b8('0xd0')])),_0x72b8('0xd1'),_0x72b8('0xd2'));logger[_0x72b8('0x93')](_0x22ab2c);};Dialer['prototype']['isSuccess']=function(_0x2746ec){return _0x2746ec===_0x72b8('0xd3');};Dialer[_0x72b8('0xa6')][_0x72b8('0xd4')]=function(_0x5afcfd){return!_['isUndefined'](_0x5afcfd)&&_0x5afcfd&&!_[_0x72b8('0x38')](_0x5afcfd[_0x72b8('0x3b')])&&!_[_0x72b8('0x38')](_0x5afcfd[_0x72b8('0x71')])&&_0x5afcfd[_0x72b8('0x71')]&&(this[_0x72b8('0x1e')][util['format'](_0x72b8('0xd5'),_0x5afcfd[_0x72b8('0x3b')])][_0x72b8('0xac')]==='reachable'||this[_0x72b8('0x1e')][util[_0x72b8('0x76')](_0x72b8('0xd5'),_0x5afcfd[_0x72b8('0x3b')])]['status']==='unmonitored');};Dialer['prototype'][_0x72b8('0xcb')]=function(_0x235239,_0x4612d0,_0x431921){this[_0x72b8('0xc6')](_0x235239)[_0x72b8('0xbd')](loggerCatch(_0x4612d0));this[_0x72b8('0xc5')](_0x235239)[_0x72b8('0xbd')](loggerCatch(_0x431921));};Dialer['prototype'][_0x72b8('0x33')]=function(_0x303cd4){var _0x52b495=this['uniqueId'][_0x303cd4[_0x72b8('0xd6')]];var _0x28f4e7;if(!_['isNil'](_0x303cd4)&&!_[_0x72b8('0xab')](_0x303cd4[_0x72b8('0xd7')])&&!_[_0x72b8('0xab')](_0x303cd4[_0x72b8('0xd7')][_0x72b8('0xd8')])&&_0x303cd4[_0x72b8('0xd9')]===_0x72b8('0xda')&&_0x52b495){if(_0x52b495[_0x72b8('0x48')]!=='ivr'&&this['voiceQueues'][_0x52b495[_0x72b8('0xb0')]][_0x72b8('0xdb')]&&_0x303cd4[_0x72b8('0xdc')]===_0x72b8('0xdd')){delete this[_0x72b8('0xa8')][_0x303cd4['uniqueid']];this['updateOriginated'](this[_0x72b8('0xaf')][_0x52b495[_0x72b8('0xb0')]]);this['voiceQueues'][_0x52b495[_0x72b8('0xb0')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x52b495['queue']][_0x72b8('0x5a')]+=0x1;_0x28f4e7=new Hangup(_0x52b495,_0x303cd4);_0x28f4e7['state']=0x12;_0x28f4e7[_0x72b8('0xde')]=_0x72b8('0xdf');_0x28f4e7['membername']=_0x72b8('0xe0');this['saveInDb'](_0x28f4e7,_0x72b8('0xe1'),_0x72b8('0xe2'));}if(_0x52b495['type']!==_0x72b8('0x75')&&this['voiceQueues'][_0x52b495[_0x72b8('0xb0')]][_0x72b8('0xdb')]&&_0x303cd4[_0x72b8('0xdc')]==='MACHINE'){var _0x4d5c7d=this;return new BPromise(function(_0xdb0a79,_0xff59e9){delete _0x4d5c7d['uniqueId'][_0x303cd4['uniqueid']];_0x4d5c7d[_0x72b8('0xae')](_0x4d5c7d['voiceQueues'][_0x52b495[_0x72b8('0xb0')]]);_0x4d5c7d['voiceQueues'][_0x52b495[_0x72b8('0xb0')]]['outboundAnswerCallsDay']+=0x1;_0x4d5c7d[_0x72b8('0xaf')][_0x52b495[_0x72b8('0xb0')]][_0x72b8('0x5a')]+=0x1;var _0x89b027=_0x4d5c7d[_0x72b8('0xaf')][_0x52b495[_0x72b8('0xb0')]];var _0x12fcf4=new Hangup(_0x52b495,_0x303cd4);_0x12fcf4[_0x72b8('0xa3')]=0x13;_0x12fcf4[_0x72b8('0xde')]=_0x72b8('0xe3');_0x12fcf4[_0x72b8('0xe4')]='AMD';_0x12fcf4['countmachineretry']+=0x1;_0x12fcf4[_0x72b8('0xe5')]+=0x1;_0x12fcf4[_0x72b8('0xe6')]=!![];_0x4d5c7d[_0x72b8('0xc6')](_0x12fcf4)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xe7')));if(_0x12fcf4[_0x72b8('0xe8')]+_0x12fcf4[_0x72b8('0xe9')]+_0x12fcf4['countnoanswerretry']+_0x12fcf4[_0x72b8('0xea')]+_0x12fcf4['countdropretry']+_0x12fcf4['countabandonedretry']+_0x12fcf4[_0x72b8('0xeb')]+_0x12fcf4[_0x72b8('0xec')]>=_0x89b027[_0x72b8('0xed')]){_0x4d5c7d[_0x72b8('0xee')](_0x12fcf4,_0xdb0a79,_0xff59e9,_0x72b8('0xef'));}else{if(_0x12fcf4['countmachineretry']>=_0x89b027[_0x72b8('0xf0')]){_0x4d5c7d['createStateFinal'](_0x12fcf4,_0xdb0a79,_0xff59e9,_0x72b8('0xf1'));}else{_0x4d5c7d['rescheduleContact']({'active':![],'countmachineretry':_0x12fcf4['countmachineretry'],'scheduledat':moment()[_0x72b8('0xf2')](_0x89b027['dialMachineRetryFrequency'],_0x72b8('0xf3'))[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x12fcf4[_0x72b8('0xf5')],'ListId':_0x12fcf4['ListId'],'VoiceQueueId':_0x12fcf4[_0x72b8('0xcf')]||undefined,'CampaignId':_0x12fcf4[_0x72b8('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xdb0a79({'reschedule':0x1});}}});}if(_0x52b495[_0x72b8('0x48')]==='ivr'&&this['campaigns'][_0x52b495[_0x72b8('0xb0')]]['dialAMDActive']&&_0x303cd4['value']==='HANGUP'){delete this[_0x72b8('0xa8')][_0x303cd4[_0x72b8('0xd6')]];this['updateOriginated'](this['campaigns'][_0x52b495[_0x72b8('0xb0')]]);_0x28f4e7=new Hangup(_0x52b495,_0x303cd4);_0x28f4e7[_0x72b8('0xa3')]=0x12;_0x28f4e7[_0x72b8('0xde')]=_0x72b8('0xdf');_0x28f4e7[_0x72b8('0xe4')]=_0x72b8('0xe0');this[_0x72b8('0xcb')](_0x28f4e7,_0x72b8('0xf6'),_0x72b8('0xf7'));}if(_0x52b495[_0x72b8('0x48')]==='ivr'&&this[_0x72b8('0x1c')][_0x52b495[_0x72b8('0xb0')]][_0x72b8('0xdb')]&&_0x303cd4[_0x72b8('0xdc')]===_0x72b8('0xf8')){var _0x4d5c7d=this;return new BPromise(function(_0x51e83a,_0x7630b5){delete _0x4d5c7d[_0x72b8('0xa8')][_0x303cd4[_0x72b8('0xd6')]];_0x4d5c7d['updateOriginated'](_0x4d5c7d['campaigns'][_0x52b495[_0x72b8('0xb0')]]);_0x4d5c7d[_0x72b8('0x1c')][_0x52b495[_0x72b8('0xb0')]]['outboundAnswerCallsDay']+=0x1;_0x4d5c7d[_0x72b8('0x1c')][_0x52b495[_0x72b8('0xb0')]][_0x72b8('0x5a')]+=0x1;var _0x573294=_0x4d5c7d[_0x72b8('0x1c')][_0x52b495[_0x72b8('0xb0')]];var _0x29e136=new Hangup(_0x52b495,_0x303cd4);_0x29e136[_0x72b8('0xa3')]=0x13;_0x29e136[_0x72b8('0xde')]=_0x72b8('0xe3');_0x29e136[_0x72b8('0xe4')]=_0x72b8('0xe0');_0x29e136[_0x72b8('0xeb')]+=0x1;_0x29e136[_0x72b8('0xe5')]+=0x1;_0x29e136[_0x72b8('0xe6')]=!![];_0x4d5c7d[_0x72b8('0xc6')](_0x29e136)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xe7')));if(_0x29e136['countbusyretry']+_0x29e136['countcongestionretry']+_0x29e136['countnoanswerretry']+_0x29e136['countnosuchnumberretry']+_0x29e136[_0x72b8('0xf9')]+_0x29e136[_0x72b8('0xfa')]+_0x29e136[_0x72b8('0xeb')]+_0x29e136['countagentrejectretry']>=_0x573294[_0x72b8('0xed')]){_0x4d5c7d[_0x72b8('0xee')](_0x29e136,_0x51e83a,_0x7630b5,'reason19\x20machine....');}else{if(_0x29e136[_0x72b8('0xeb')]>=_0x573294[_0x72b8('0xf0')]){_0x4d5c7d[_0x72b8('0xfb')](_0x29e136,_0x51e83a,_0x7630b5,'reason\x2019\x20machine....');}else{_0x4d5c7d[_0x72b8('0xbc')]({'active':![],'countmachineretry':_0x29e136[_0x72b8('0xeb')],'scheduledat':moment()[_0x72b8('0xf2')](_0x573294[_0x72b8('0xfc')],_0x72b8('0xf3'))[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x29e136['ContactId'],'ListId':_0x29e136['ListId'],'VoiceQueueId':_0x29e136[_0x72b8('0xcf')]||undefined,'CampaignId':_0x29e136[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xfd')));_0x51e83a({'reschedule':0x1});}}});}}};Dialer[_0x72b8('0xa6')]['syncHangup']=function(_0x91deaa){var _0x24b0fe=this['uniqueId'][_0x91deaa['uniqueid']];var _0xe4ccd2=this;var _0x3d2fe8;if(_0x24b0fe&&_0x24b0fe[_0x72b8('0x48')]===_0x72b8('0x75')){delete this[_0x72b8('0xa8')][_0x91deaa['uniqueid']];this[_0x72b8('0xae')](this[_0x72b8('0x1c')][_0x24b0fe[_0x72b8('0xb0')]]);this[_0x72b8('0x1c')][_0x24b0fe[_0x72b8('0xb0')]][_0x72b8('0xfe')]+=0x1;_0x3d2fe8=new Hangup(_0x24b0fe,_0x91deaa);this[_0x72b8('0xc6')](_0x3d2fe8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xff')));this[_0x72b8('0xc5')](_0x3d2fe8)[_0x72b8('0xbd')](loggerCatch('[syncHangupIvr]'));}if(_0x24b0fe&&_0x24b0fe[_0x72b8('0x48')]!==_0x72b8('0x75')&&isNotNull(this[_0x72b8('0xaf')][_0x24b0fe['queue']][_0x72b8('0x100')])){delete this[_0x72b8('0xa8')][_0x91deaa[_0x72b8('0xd6')]];this[_0x72b8('0xae')](this[_0x72b8('0xaf')][_0x24b0fe['queue']]);this[_0x72b8('0xaf')][_0x24b0fe[_0x72b8('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0x72b8('0xaf')][_0x24b0fe[_0x72b8('0xb0')]][_0x72b8('0x5a')]+=0x1;_0x3d2fe8=new Hangup(_0x24b0fe,_0x91deaa);_0x3d2fe8[_0x72b8('0xa3')]=0x10;_0x3d2fe8[_0x72b8('0xde')]=_0x72b8('0x101');_0x3d2fe8['membername']=_0x72b8('0x102');this['createHistory'](_0x3d2fe8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xff')));this[_0x72b8('0xc5')](_0x3d2fe8)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x24b0fe&&_0x24b0fe[_0x72b8('0x48')]!==_0x72b8('0x75')&&!isNotNull(this[_0x72b8('0xaf')][_0x24b0fe[_0x72b8('0xb0')]]['dialQueueProject'])){delete this[_0x72b8('0xa8')][_0x91deaa[_0x72b8('0xd6')]];this['updateOriginated'](this[_0x72b8('0xaf')][_0x24b0fe['queue']]);this[_0x72b8('0xaf')][_0x24b0fe['queue']][_0x72b8('0x62')]+=0x1;_0x3d2fe8=new Hangup(_0x24b0fe,_0x91deaa);_0x3d2fe8[_0x72b8('0xa3')]=0xc;_0x3d2fe8[_0x72b8('0xde')]=_0x91deaa['cause-txt'];_0x3d2fe8[_0x72b8('0xe4')]='Unknow';this[_0x72b8('0xc6')](_0x3d2fe8)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x72b8('0xc5')](_0x3d2fe8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x103')));}};Dialer[_0x72b8('0xa6')][_0x72b8('0x104')]=function(_0x3238e8){var _0x241c9c=this[_0x72b8('0xa8')][_0x3238e8[_0x72b8('0xd6')]];var _0x529a18=this;if(this[_0x72b8('0xaf')][_0x3238e8[_0x72b8('0xb0')]]){if(_0x241c9c&&_0x241c9c[_0x72b8('0x48')]!==_0x72b8('0x75')){delete this[_0x72b8('0xa8')][_0x3238e8[_0x72b8('0xd6')]];this[_0x72b8('0xaf')][_0x3238e8[_0x72b8('0xb0')]][_0x72b8('0x5b')]+=0x1;var _0x503502=new AgentComplete(_0x241c9c,_0x3238e8);if(_0x3238e8[_0x72b8('0x105')]===_0x72b8('0x106')){_0x503502['agiafterat']=this[_0x72b8('0xaf')][_0x3238e8[_0x72b8('0xb0')]][_0x72b8('0x107')]&&this[_0x72b8('0xaf')][_0x3238e8[_0x72b8('0xb0')]]['dialAgiAfterHangupAgent']?moment()[_0x72b8('0x76')](_0x72b8('0xf4')):undefined;}this[_0x72b8('0xc6')](_0x503502)[_0x72b8('0xbd')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x503502)['catch'](loggerCatch(_0x72b8('0x108')));}}};Dialer[_0x72b8('0xa6')][_0x72b8('0x29')]=function(_0x445733){if(this['voiceQueues'][_0x445733[_0x72b8('0xb0')]]){if(this[_0x72b8('0xa8')][_0x445733[_0x72b8('0xd6')]]&&this['uniqueId'][_0x445733['uniqueid']][_0x72b8('0x48')]!==_0x72b8('0x75')){this['updateOriginated'](this[_0x72b8('0xaf')][_0x445733['queue']]);this[_0x72b8('0xa8')][_0x445733[_0x72b8('0xd6')]][_0x72b8('0x109')]=moment()[_0x72b8('0x76')](_0x72b8('0xf4'));}}};Dialer[_0x72b8('0xa6')][_0x72b8('0x10a')]=function(_0x2c087c){this[_0x72b8('0xc6')](_0x2c087c)[_0x72b8('0xbd')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x72b8('0xc5')](_0x2c087c)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x10b')));};Dialer[_0x72b8('0xa6')][_0x72b8('0x2b')]=function(_0x2424ba){var _0x4c2a20=this[_0x72b8('0xa8')][_0x2424ba[_0x72b8('0xd6')]];var _0x378ec9=this;if(this['voiceQueues'][_0x2424ba[_0x72b8('0xb0')]]){if(_0x4c2a20&&_0x4c2a20[_0x72b8('0x48')]!=='ivr'){delete this['uniqueId'][_0x2424ba[_0x72b8('0xd6')]];this[_0x72b8('0xae')](this['voiceQueues'][_0x2424ba[_0x72b8('0xb0')]]);_0x4c2a20['droptime']=moment()[_0x72b8('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4ee8b8=new QueueCallerAbandon(_0x4c2a20,_0x2424ba);if(getSeconds(_0x4c2a20[_0x72b8('0x10c')],_0x4c2a20[_0x72b8('0x10d')])>=_0x4c2a20['dialQueueTimeout']){this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]][_0x72b8('0x67')]+=0x1;this['voiceQueues'][_0x2424ba[_0x72b8('0xb0')]][_0x72b8('0x5e')]+=0x1;this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]][_0x72b8('0x69')]+=0x1;_0x4ee8b8[_0x72b8('0xa3')]=0xa;_0x4ee8b8['statedesc']=_0x72b8('0x10e');_0x4ee8b8[_0x72b8('0x10f')]='TIMEOUT';_0x4ee8b8['agiafterat']=this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]][_0x72b8('0x107')]?moment()[_0x72b8('0x76')](_0x72b8('0xf4')):undefined;_0x4ee8b8['countdropretry']+=0x1;_0x4ee8b8['countglobal']+=0x1;if(_0x4ee8b8[_0x72b8('0xf9')]>=this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]]['dialDropMaxRetry']){this[_0x72b8('0x10a')](_0x4ee8b8);}else{this[_0x72b8('0xbc')]({'active':![],'countdropretry':_0x4ee8b8['countdropretry'],'scheduledat':moment()[_0x72b8('0xf2')](this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]]['dialDropRetryFrequency'],_0x72b8('0xf3'))[_0x72b8('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c2a20[_0x72b8('0xf5')],'ListId':_0x4c2a20[_0x72b8('0x110')],'VoiceQueueId':_0x4c2a20[_0x72b8('0xcf')]||undefined,'CampaignId':_0x4c2a20[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x111')));var _0x61293a=new History(_0x4ee8b8);_0x61293a[_0x72b8('0xa3')]=0xa;_0x61293a['statedesc']=_0x72b8('0x10e');_0x61293a[_0x72b8('0xa5')]=moment()[_0x72b8('0x76')](_0x72b8('0xf4'));_0x61293a[_0x72b8('0xa4')]=_0x61293a[_0x72b8('0xa5')];_0x61293a[_0x72b8('0x112')]=_0x4ee8b8[_0x72b8('0x112')];_0x61293a[_0x72b8('0x113')]=_0x4ee8b8[_0x72b8('0x113')];this[_0x72b8('0xc6')](_0x61293a)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x114')));}}else{this['voiceQueues'][_0x2424ba['queue']][_0x72b8('0x66')]+=0x1;this['voiceQueues'][_0x2424ba[_0x72b8('0xb0')]]['outboundDropCallsDayCallersExit']+=0x1;_0x4ee8b8[_0x72b8('0xa3')]=0xb;_0x4ee8b8[_0x72b8('0xde')]=_0x72b8('0x115');_0x4ee8b8[_0x72b8('0x10f')]=_0x72b8('0x116');_0x4ee8b8[_0x72b8('0xfa')]+=0x1;_0x4ee8b8[_0x72b8('0xe5')]+=0x1;if(_0x4ee8b8[_0x72b8('0xfa')]>=this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]]['dialAbandonedMaxRetry']){this[_0x72b8('0x10a')](_0x4ee8b8);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x4ee8b8[_0x72b8('0xfa')],'scheduledat':moment()['add'](this[_0x72b8('0xaf')][_0x2424ba[_0x72b8('0xb0')]][_0x72b8('0x117')],_0x72b8('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c2a20[_0x72b8('0xf5')],'ListId':_0x4c2a20[_0x72b8('0x110')],'VoiceQueueId':_0x4c2a20[_0x72b8('0xcf')]||undefined,'CampaignId':_0x4c2a20[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x118')));var _0x61293a=new History(_0x4ee8b8);_0x61293a[_0x72b8('0xa3')]=0xb;_0x61293a['statedesc']='Abandoned';_0x61293a[_0x72b8('0xa5')]=moment()[_0x72b8('0x76')](_0x72b8('0xf4'));_0x61293a[_0x72b8('0xa4')]=_0x61293a[_0x72b8('0xa5')];_0x61293a['calleridname']=_0x4ee8b8[_0x72b8('0x112')];_0x61293a[_0x72b8('0x113')]=_0x4ee8b8['calleridnum'];this[_0x72b8('0xc6')](_0x61293a)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x119')));}}}}};Dialer[_0x72b8('0xa6')]['syncNewExten']=function(_0x300961){if(this['actions'][_0x300961['uniqueid']]){this['actions'][_0x300961['uniqueid']][_0x72b8('0xad')]=_0x300961[_0x72b8('0xad')];}if(this['uniqueId'][_0x300961['uniqueid']]){this[_0x72b8('0xa8')][_0x300961['uniqueid']][_0x72b8('0xad')]=_0x300961[_0x72b8('0xad')];}};Dialer[_0x72b8('0xa6')]['syncQueueMember']=function(_0x2104d4){if(strategy[this[_0x72b8('0xaf')][this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0xb0')]][_0x72b8('0x4a')]]===_0x72b8('0x17')){if(this['actions'][_0x2104d4[_0x72b8('0x11a')]]&&_[_0x72b8('0xab')](this['actions'][_0x2104d4[_0x72b8('0x11a')]]['locked'])&&_0x2104d4[_0x72b8('0xac')]==='1'&&_0x2104d4[_0x72b8('0x11b')]==='0'){if(this['agents'][_0x2104d4['stateinterface']]){if(!this['agents'][_0x2104d4['stateinterface']]['locked']){this[_0x72b8('0x1d')][_0x2104d4[_0x72b8('0x11c')]][_0x72b8('0x11d')]=!![];this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0x11d')]=!![];this['actions'][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0x11c')]=_0x2104d4[_0x72b8('0x11c')];}}}}else if((strategy[this[_0x72b8('0xaf')][this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0xb0')]][_0x72b8('0x4a')]]||_0x72b8('0x11e'))==='rrmemory'){if(this[_0x72b8('0x21')][_0x2104d4['actionid']]){if(this[_0x72b8('0x1d')][_0x2104d4[_0x72b8('0x11c')]]){this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0x11c')]=_0x2104d4[_0x72b8('0x11c')];if(_['isNil'](this[_0x72b8('0x11f')][this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0xb0')]])){this[_0x72b8('0x11f')][this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]]['queue']]=[];}this[_0x72b8('0x11f')][this['actions'][_0x2104d4[_0x72b8('0x11a')]][_0x72b8('0xb0')]][_0x72b8('0x120')](_['merge'](_[_0x72b8('0xcd')](this[_0x72b8('0x21')][_0x2104d4[_0x72b8('0x11a')]],['idHopper','stateinterface']),{'status':_0x2104d4[_0x72b8('0xac')],'paused':_0x2104d4[_0x72b8('0x11b')]}));}}}};function unlockQueueStatus(_0x32aa5a,_0x1c1dd2){setTimeout(function(){if(_[_0x72b8('0x38')](_0x32aa5a[_0x72b8('0x121')])){loggerBooked[_0x72b8('0x93')]('[unlockQueueStatus][undefined]',_0x1c1dd2);}_0x32aa5a[_0x72b8('0x121')]=!![];loggerBooked[_0x72b8('0x7b')](_0x72b8('0x122'),_0x1c1dd2,JSON['stringify'](_[_0x72b8('0xcd')](_0x32aa5a,[_0x72b8('0x3b'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x72b8('0xa6')][_0x72b8('0x123')]=function(_0xe35856){var _0x35c4cc=this;var _0x3e63bd=_0x35c4cc['voiceQueues'][_0x35c4cc['actions'][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]];if(strategy[this[_0x72b8('0xaf')][this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]][_0x72b8('0x4a')]]===_0x72b8('0x17')){if(this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]]&&this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0x11c')]){this[_0x72b8('0x1b')][_0x72b8('0x124')](this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0x125')],this['actions'][_0xe35856['actionid']][_0x72b8('0x11c')])[_0x72b8('0xbd')](function(_0x2fb1f8){logger[_0x72b8('0x93')](_0x72b8('0x126'),util[_0x72b8('0x94')](_0x2fb1f8,{'showHidden':![],'depth':null}));})['finally'](function(){_0x35c4cc['updateOriginated'](_0x35c4cc[_0x72b8('0xaf')][_0x35c4cc[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]);_0x35c4cc[_0x72b8('0x1d')][_0x35c4cc[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0x11c')]][_0x72b8('0x11d')]=![];delete _0x35c4cc[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]];unlockQueueStatus(_0x3e63bd);});}else{this[_0x72b8('0xae')](this[_0x72b8('0xaf')][this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]);this[_0x72b8('0xbc')]({'active':![],'ContactId':this['actions'][_0xe35856[_0x72b8('0x11a')]]['ContactId'],'ListId':this['actions'][_0xe35856['actionid']][_0x72b8('0x110')],'VoiceQueueId':this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xcf')]||undefined,'CampaignId':this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0xe35856[_0x72b8('0x11a')]];unlockQueueStatus(_0x3e63bd);}}else if((strategy[this[_0x72b8('0xaf')][this['actions'][_0xe35856['actionid']]['queue']][_0x72b8('0x4a')]]||_0x72b8('0x11e'))===_0x72b8('0x11e')){var _0x1cbc9d;if(this['actions'][_0xe35856[_0x72b8('0x11a')]]&&!_[_0x72b8('0x79')](this['queueBooked'][this['actions'][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]])){if(this[_0x72b8('0x27')][_0x35c4cc['actions'][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]){this['queueBookedRR'][_0x35c4cc[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]=this['queueBookedRR'][this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]?this[_0x72b8('0x27')][this[_0x72b8('0x21')][_0xe35856['actionid']][_0x72b8('0xb0')]]:this['queueBooked'][this[_0x72b8('0x21')][_0xe35856['actionid']][_0x72b8('0xb0')]]?this['queueBooked'][this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]['_rr']||0x0:0x0;}this[_0x72b8('0x11f')][this[_0x72b8('0x21')][_0xe35856[_0x72b8('0x11a')]][_0x72b8('0xb0')]]['_rr']=this['queueBookedRR'][this[_0x72b8('0x21')][_0xe35856['actionid']]['queue']];for(var _0x2d039e=0x0;_0x2d039e=0x0;})[_0x72b8('0xbd')](myreject(_0x48915f)));}}else{_0xe2a218['push'](ami['Action']({'action':_0x72b8('0x13f'),'command':util[_0x72b8('0x76')](_0x72b8('0x140'),_0x4c68eb,!_[_0x72b8('0x38')](config[_0x72b8('0x139')][_0x2f62bf])?_0x2f62bf:'')})['then'](function(_0x3485a3){return _0x3485a3['content']['indexOf'](_0x72b8('0x143'))>=0x0;})[_0x72b8('0xbd')](myreject(_0x48915f)));}BPromise['all'](_0xe2a218)[_0x72b8('0xb7')](function(_0x5093a2){var _0x2d9ad8=_[_0x72b8('0x144')](_0x5093a2);if(_0x2d9ad8){return _0x105caf(_0x2d9ad8);}else{_0x7ac464['message']=_0x589e0d?_0x72b8('0x145'):'INTERVAL_IS_OVERTIME';return _0x48915f(msgResponse(_0x72b8('0x146'),_0x72b8('0x13b'),_0x72b8('0x147')+_0x589e0d+'\x20'+_0x293edb+_0x72b8('0x148')+util['inspect'](_0x4c68eb,{'showHidden':![],'depth':null})+_0x72b8('0x149')+_0x2f62bf));}})[_0x72b8('0xbd')](function(_0x3607ba){return _0x48915f(msgResponse(_0x72b8('0x137'),_0x72b8('0x13b'),JSON[_0x72b8('0x44')](_0x3607ba)));});});};Dialer[_0x72b8('0xa6')][_0x72b8('0x14a')]=function(_0x427ca2){var _0x8a423b=this;return function(){switch(_0x427ca2[_0x72b8('0x56')]){case _0x72b8('0x14b'):freeVariablesPredictive(_0x427ca2);_0x8a423b[_0x72b8('0x14c')](_0x427ca2,0x1);break;case _0x72b8('0x14d'):freeVariablesPredictive(_0x427ca2);_0x8a423b[_0x72b8('0x14c')](_0x427ca2,_0x427ca2[_0x72b8('0x14e')]);break;case'predictive':_0x8a423b[_0x72b8('0x14f')](_0x427ca2);break;case _0x72b8('0x8'):freeVariablesPredictive(_0x427ca2);_0x8a423b['handlePower'](_0x427ca2,0x1);break;default:freeVariablesPredictive(_0x427ca2);logger[_0x72b8('0x93')](_0x72b8('0x150'),_0x427ca2[_0x72b8('0x3b')],_0x72b8('0x151'));}};};Dialer[_0x72b8('0xa6')][_0x72b8('0x152')]=function(_0xe9f9ad){var _0x1530af=this;return function(){_0x1530af['handleIvr'](_0xe9f9ad);};};Dialer[_0x72b8('0xa6')]['syncQueueSummary']=function(_0x1ac13d){var _0x345412=this;if(isNotPreview(_0x1ac13d[_0x72b8('0x56')])){if(isVoiceQueueOutbound(_0x1ac13d[_0x72b8('0x48')])&&isActive(_0x1ac13d[_0x72b8('0x55')])){_0x1ac13d[_0x72b8('0xa0')]=!![];BPromise[_0x72b8('0xb3')]()['then'](checkIsLoggedIn(_0x1ac13d,_0x1ac13d[_0x72b8('0x4d')]))[_0x72b8('0xb7')](checkIsActive(_0x1ac13d,_0x1ac13d[_0x72b8('0x55')]))['then'](checkInterval(_0x1ac13d))[_0x72b8('0xb7')](_0x345412['checkIsTrunkReachable'](_0x1ac13d))[_0x72b8('0xb7')](_0x345412[_0x72b8('0x135')](_0x1ac13d['dialGlobalInterval'],_0x1ac13d[_0x72b8('0x153')],_0x1ac13d[_0x72b8('0x3b')],_0x1ac13d))[_0x72b8('0xb7')](_0x345412['checkIfTimeIntervals'](_0x1ac13d[_0x72b8('0x3e')],_0x1ac13d[_0x72b8('0x153')],_0x1ac13d[_0x72b8('0x3b')],_0x1ac13d))[_0x72b8('0xb7')](_0x345412['checkDialMethod'](_0x1ac13d))[_0x72b8('0xbd')](loggerCatchQueueSummary(_0x72b8('0x154'),_0x1ac13d));}else{notSendMessagesQueue(_0x1ac13d);}}else{freeVariablesPredictive(_0x1ac13d);}};Dialer['prototype'][_0x72b8('0x132')]=function(){var _0x3dc40b=this;var _0x3e79cb;for(var _0x268985 in this['campaigns']){if(typeof this['campaigns'][_0x268985]!==_0x72b8('0xc8')){_0x3e79cb=this['campaigns'][_0x268985];if(isCampaignIvr(_0x3e79cb[_0x72b8('0x48')])&&isActive(_0x3e79cb[_0x72b8('0x71')])){_0x3e79cb[_0x72b8('0xa0')]=!![];BPromise[_0x72b8('0xb3')]()[_0x72b8('0xb7')](checkIsActive(_0x3e79cb,_0x3e79cb[_0x72b8('0x71')]))[_0x72b8('0xb7')](checkInterval(_0x3e79cb))['then'](_0x3dc40b['checkIsTrunkReachable'](_0x3e79cb))[_0x72b8('0xb7')](_0x3dc40b[_0x72b8('0x135')](_0x3e79cb['dialGlobalInterval'],_0x3e79cb[_0x72b8('0x153')],_0x3e79cb[_0x72b8('0x3b')],_0x3e79cb))[_0x72b8('0xb7')](_0x3dc40b[_0x72b8('0x136')](_0x3e79cb['Interval'],_0x3e79cb[_0x72b8('0x153')],_0x3e79cb[_0x72b8('0x3b')],_0x3e79cb))[_0x72b8('0xb7')](_0x3dc40b['launchHandleIvr'](_0x3e79cb))[_0x72b8('0xbd')](loggerCatchQueueSummary(_0x72b8('0x155'),_0x3e79cb));}else{notSendMessagesCampaign(_0x3e79cb);}}}};function getCallerIdRandom(_0x26686d,_0x4c247e){var _0x37893d;var _0x4d314f;var _0x5343e6;if(_0x4c247e<=0x0){_0x4c247e=0x1;}_0x37893d=new RegExp(_0x72b8('0x156')+_0x4c247e+'}$');_0x4d314f=Math[_0x72b8('0x157')](0xa,_0x4c247e-0x1);_0x5343e6=Math['pow'](0xa,_0x4c247e)-0x1;return util[_0x72b8('0x76')]('%s',_[_0x72b8('0x158')](_0x26686d,_0x37893d,_[_0x72b8('0x159')](_0x4d314f,_0x5343e6)));}function extractCalleridName(_0x1975ab){var _0x4b2e32=_0x1975ab[_0x72b8('0x15a')](/"(.*?)"/);return _0x4b2e32?_0x4b2e32[0x1]:_0x1975ab;}function extractCalleridNumber(_0x1b919d){var _0x55bd21=_0x1b919d[_0x72b8('0x15a')](/<(.*?)>/);return _0x55bd21?_0x55bd21[0x1]:_0x1b919d;}Dialer['prototype'][_0x72b8('0x15b')]=function(_0xb97388,_0xe9685b){var _0x7b542c=this;var _0x1d1b98=uuid['v4']();this[_0x72b8('0x21')][_0x1d1b98]=new Action(_0xb97388,_0xe9685b,_0x1d1b98);return new BPromise(function(_0x577364,_0x418f5b){if(_[_0x72b8('0x38')](_0xb97388)&&typeof _0xb97388!=='object'){return _0x418f5b(msgResponse(_0x72b8('0x15c'),'Failure',_0x72b8('0x15d')));}if(_['isUndefined'](_0xe9685b[_0x72b8('0x15e')][_0x72b8('0x15f')])||_0xe9685b[_0x72b8('0x15e')]['phone']===null){return _0x418f5b(msgResponse(_0x72b8('0x15c'),'Failure','contact\x20is\x20undefine'));}var _0x340c93={'XMD-CALLERID':_0x7b542c[_0x72b8('0x21')][_0x1d1b98][_0x72b8('0x160')](),'XMD-AGI':_0xb97388['dialQueueProject']?util[_0x72b8('0x76')](_0x72b8('0x161'),ipAgi,_0xb97388['dialQueueProject']):'NONE','XMD-AGIAFTER':_0xb97388[_0x72b8('0x107')]?util[_0x72b8('0x76')](_0x72b8('0x161'),ipAgi,_0xb97388[_0x72b8('0x107')]):_0x72b8('0x162'),'XMD-QUEUE':_0xb97388[_0x72b8('0x48')]===_0x72b8('0x49')?util['format'](_0x72b8('0x163'),_0xb97388[_0x72b8('0x3b')],_0xb97388[_0x72b8('0x164')]||'',_0xb97388[_0x72b8('0x165')]?'c':'',_0xb97388[_0x72b8('0x166')]||0x3):_0x72b8('0x162'),'XMD-CONTACTID':_0xe9685b[_0x72b8('0xf5')],'XMD-CDRTYPE':_0x72b8('0x7'),'CALLERID(all)':_0x7b542c[_0x72b8('0x21')][_0x1d1b98][_0x72b8('0x160')](),'XMD-AMD':_0xb97388[_0x72b8('0xdb')]?_0x72b8('0x167'):_0x72b8('0x162'),'XMD-DESTINATION':_0x72b8('0xda')};if(_0xb97388[_0x72b8('0xdb')]){_0x340c93['XMD-AMDINITIALSILENCE']=_0xb97388['dialAMDInitialSilence']||0x9c4;_0x340c93[_0x72b8('0x168')]=_0xb97388['dialAMDGreeting']||0x5dc;_0x340c93[_0x72b8('0x169')]=_0xb97388['dialAMDAfterGreetingSilence']||0x320;_0x340c93[_0x72b8('0x16a')]=_0xb97388['dialAMDTotalAnalysisTime']||0x1388;_0x340c93[_0x72b8('0x16b')]=_0xb97388[_0x72b8('0x16c')]||0x64;_0x340c93[_0x72b8('0x16d')]=_0xb97388[_0x72b8('0x16e')]||0x32;_0x340c93['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xb97388[_0x72b8('0x16f')]||0x3;_0x340c93[_0x72b8('0x170')]=_0xb97388['dialAMDSilenceThreshold']||0x100;_0x340c93[_0x72b8('0x171')]=_0xb97388[_0x72b8('0x172')]||0x1388;}if(_0xb97388[_0x72b8('0x48')]==='outbound'){_0x340c93[_0x72b8('0x173')]=_0xe9685b[_0x72b8('0xcf')];}else{_0x340c93[_0x72b8('0x174')]=_0xe9685b[_0x72b8('0xd0')];}for(var _0x5d82f3 in _0xe9685b[_0x72b8('0x15e')]){if(typeof _0xe9685b[_0x72b8('0x15e')][_0x5d82f3]!==_0x72b8('0xc8')){if(isNotNull(_0xe9685b[_0x72b8('0x15e')][_0x5d82f3])&&_0x5d82f3!=='id'&&_0x5d82f3!==_0x72b8('0x175')&&_0x5d82f3!==_0x72b8('0x176')&&_0x5d82f3!=='updatedAt'){_0x340c93[util['format'](_0x72b8('0x177'),'XMD-',_['toUpper'](_0x5d82f3))]=_0xe9685b[_0x72b8('0x15e')][_0x5d82f3];}}}var _0x36d1d3=_0x7b542c[_0x72b8('0xd4')](_0xb97388[_0x72b8('0x70')])?getCallerId(_0xb97388['Trunk']['callerid'],_0xb97388['dialOriginateCallerIdName'],_0xb97388[_0x72b8('0x178')]>0x0?getCallerIdRandom(_0xb97388[_0x72b8('0x179')],_0xb97388[_0x72b8('0x178')]):_0xb97388[_0x72b8('0x179')]):getCallerId(_[_0x72b8('0xab')](_0xb97388['TrunkBackup'])?_0xb97388[_0x72b8('0x70')][_0x72b8('0x17a')]:_0xb97388[_0x72b8('0x17b')][_0x72b8('0x17a')],_0xb97388[_0x72b8('0x57')],_0xb97388[_0x72b8('0x178')]>0x0?getCallerIdRandom(_0xb97388[_0x72b8('0x179')],_0xb97388[_0x72b8('0x178')]):_0xb97388['dialOriginateCallerIdNumber']);if(_0x36d1d3){_0x340c93[_0x72b8('0x17c')]=_0x7b542c[_0x72b8('0x21')][_0x1d1b98]['originatecalleridname']=extractCalleridName(_0x36d1d3);_0x340c93['XMD-ORIGINATECALLERIDNUM']=_0x7b542c[_0x72b8('0x21')][_0x1d1b98][_0x72b8('0x17d')]=extractCalleridNumber(_0x36d1d3);}return ami[_0x72b8('0x13e')]({'actionid':_0x1d1b98,'action':_0x72b8('0x15c'),'channel':_0x7b542c[_0x72b8('0xd4')](_0xb97388[_0x72b8('0x70')])?util[_0x72b8('0x76')]('SIP/%s/%s%s',_0xb97388[_0x72b8('0x70')]['name'],isNotNull(_0xb97388[_0x72b8('0x59')])?_0xb97388[_0x72b8('0x59')]['trim']()||'':'',_0xb97388[_0x72b8('0x17e')]>0x0?_0xe9685b[_0x72b8('0x15e')][_0x72b8('0x15f')][_0x72b8('0x17f')](_0xb97388[_0x72b8('0x17e')]):_0xe9685b[_0x72b8('0x15e')][_0x72b8('0x15f')]):util[_0x72b8('0x76')]('SIP/%s/%s%s',_['isNil'](_0xb97388[_0x72b8('0x17b')])?_0xb97388[_0x72b8('0x70')][_0x72b8('0x3b')]:_0xb97388[_0x72b8('0x17b')][_0x72b8('0x3b')],isNotNull(_0xb97388[_0x72b8('0x59')])?_0xb97388[_0x72b8('0x59')][_0x72b8('0x180')]()||'':'',_0xb97388[_0x72b8('0x17e')]>0x0?_0xe9685b[_0x72b8('0x15e')][_0x72b8('0x15f')][_0x72b8('0x17f')](_0xb97388[_0x72b8('0x17e')]):_0xe9685b[_0x72b8('0x15e')][_0x72b8('0x15f')]),'callerid':_0x36d1d3,'Exten':_0x72b8('0xda'),'Context':_0x72b8('0x181'),'Priority':'1','variable':_0x340c93,'timeout':(_0xb97388[_0x72b8('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1d1b98})[_0x72b8('0xb7')](function(_0x43ab1c){return _0x577364(_0x43ab1c);})[_0x72b8('0xbd')](function(_0x50f29a){_0xb97388['outboundOriginateFailureCallsDay']+=0x1;var _0x2157f1=new History(_0x7b542c[_0x72b8('0x21')][_0x1d1b98]);logger[_0x72b8('0x93')](util[_0x72b8('0x76')](_0x72b8('0x182'),JSON['stringify'](_0x50f29a)));_0x2157f1['state']=0xe;_0x2157f1[_0x72b8('0xde')]='OriginateError';_0x2157f1[_0x72b8('0xa5')]=moment()[_0x72b8('0x76')](_0x72b8('0xf4'));_0x2157f1['endtime']=_0x2157f1[_0x72b8('0xa5')];_0x7b542c[_0x72b8('0xc6')](_0x2157f1)[_0x72b8('0xbd')](loggerCatch('[originate][error]'));_0x7b542c[_0x72b8('0xc5')](_0x2157f1)[_0x72b8('0xbd')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x7b542c[_0x72b8('0x21')][_0x1d1b98];return _0x418f5b(msgResponse(_0x72b8('0x15c'),_0x72b8('0x43'),_0x72b8('0x183')));});});});};Dialer[_0x72b8('0xa6')][_0x72b8('0x2d')]=function(_0x298672){var _0x4d3084=this[_0x72b8('0x21')][_0x298672[_0x72b8('0x11a')]];if(_0x4d3084){delete this[_0x72b8('0x21')][_0x298672[_0x72b8('0x11a')]];_0x4d3084[_0x72b8('0x10d')]=moment()[_0x72b8('0x76')](_0x72b8('0xf4'));var _0x4fda1d=_0x4d3084[_0x72b8('0x48')]===_0x72b8('0x75')?this['campaigns'][_0x4d3084[_0x72b8('0xb0')]]:this[_0x72b8('0xaf')][_0x4d3084[_0x72b8('0x184')]()];if(!this[_0x72b8('0x185')](_0x298672[_0x72b8('0x186')])){this[_0x72b8('0xae')](_0x4fda1d);return this[_0x72b8('0x187')](_0x4d3084,_0x4fda1d,_0x298672)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x188')));}this[_0x72b8('0xa8')][_0x298672[_0x72b8('0xd6')]]=_0x4d3084;}};Dialer['prototype'][_0x72b8('0x189')]=function(_0x5825c7,_0x5aa982,_0x14e6f6){var _0x535caa=new History(_0x5aa982);if(_0x535caa[_0x72b8('0xe8')]+_0x535caa[_0x72b8('0xe9')]+_0x535caa[_0x72b8('0x18a')]+_0x535caa['countnosuchnumberretry']+_0x535caa[_0x72b8('0xf9')]+_0x535caa[_0x72b8('0xfa')]+_0x535caa[_0x72b8('0xeb')]+_0x535caa[_0x72b8('0xec')]>=_0x14e6f6['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5825c7){case 0x3:if(_0x535caa[_0x72b8('0x18a')]>=_0x14e6f6['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x72b8('0xbc')]({'active':![],'countnoanswerretry':_0x535caa[_0x72b8('0x18a')]+=0x1,'scheduledat':moment()[_0x72b8('0xf2')](_0x14e6f6['dialNoAnswerRetryFrequency'],_0x72b8('0xf3'))[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa[_0x72b8('0x110')],'VoiceQueueId':_0x535caa[_0x72b8('0xcf')]||undefined,'CampaignId':_0x535caa[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x535caa[_0x72b8('0xe8')]>=_0x14e6f6[_0x72b8('0x18b')]-0x1){return!![];}this[_0x72b8('0xbc')]({'active':![],'countbusyretry':_0x535caa[_0x72b8('0xe8')]+=0x1,'scheduledat':moment()[_0x72b8('0xf2')](_0x14e6f6[_0x72b8('0x18c')],_0x72b8('0xf3'))[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x535caa['ContactId'],'ListId':_0x535caa['ListId'],'VoiceQueueId':_0x535caa[_0x72b8('0xcf')]||undefined,'CampaignId':_0x535caa[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x18d')));break;case 0x8:if(_0x535caa[_0x72b8('0xe9')]>=_0x14e6f6['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x535caa[_0x72b8('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x14e6f6['dialCongestionRetryFrequency'],'minutes')[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa['ListId'],'VoiceQueueId':_0x535caa['VoiceQueueId']||undefined,'CampaignId':_0x535caa[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x18e')));break;case 0x0:if(_0x535caa[_0x72b8('0xea')]>=_0x14e6f6[_0x72b8('0x18f')]-0x1){return!![];}else{this[_0x72b8('0xbc')]({'active':![],'countnosuchnumberretry':_0x535caa['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x72b8('0xf2')](_0x14e6f6[_0x72b8('0x190')],_0x72b8('0xf3'))[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa[_0x72b8('0x110')],'VoiceQueueId':_0x535caa[_0x72b8('0xcf')]||undefined,'CampaignId':_0x535caa[_0x72b8('0xd0')]||undefined})['catch'](loggerCatch(_0x72b8('0x191')));}break;case 0xa:if(_0x535caa[_0x72b8('0xf9')]>=_0x14e6f6[_0x72b8('0x192')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x535caa[_0x72b8('0xf9')]+=0x1,'scheduledat':moment()[_0x72b8('0xf2')](_0x14e6f6[_0x72b8('0x193')],'minutes')[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa[_0x72b8('0x110')],'VoiceQueueId':_0x535caa[_0x72b8('0xcf')]||undefined,'CampaignId':_0x535caa['CampaignId']||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x111')));break;case 0xb:if(_0x535caa[_0x72b8('0xfa')]>=_0x14e6f6[_0x72b8('0x194')]-0x1){return!![];}this[_0x72b8('0xbc')]({'active':![],'countabandonedretry':_0x535caa[_0x72b8('0xfa')]+=0x1,'scheduledat':moment()[_0x72b8('0xf2')](_0x14e6f6[_0x72b8('0x117')],_0x72b8('0xf3'))[_0x72b8('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa[_0x72b8('0x110')],'VoiceQueueId':_0x535caa[_0x72b8('0xcf')]||undefined,'CampaignId':_0x535caa[_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x118')));break;case 0x13:if(_0x535caa['countmachineretry']>=_0x14e6f6[_0x72b8('0xf0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x535caa[_0x72b8('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x14e6f6[_0x72b8('0xfc')],_0x72b8('0xf3'))[_0x72b8('0x76')](_0x72b8('0xf4')),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa['ListId'],'VoiceQueueId':_0x535caa['VoiceQueueId']||undefined,'CampaignId':_0x535caa['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x535caa[_0x72b8('0xec')]>=_0x14e6f6[_0x72b8('0x195')]-0x1){return!![];}this[_0x72b8('0xbc')]({'active':![],'countagentrejectretry':_0x535caa['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x72b8('0xf2')](_0x14e6f6[_0x72b8('0x196')],'minutes')[_0x72b8('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x535caa[_0x72b8('0xf5')],'ListId':_0x535caa[_0x72b8('0x110')],'VoiceQueueId':_0x535caa['VoiceQueueId']||undefined,'CampaignId':_0x535caa[_0x72b8('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x72b8('0x187')]=function(_0x31aba5,_0x447a38,_0x40cc2f){var _0x796ae=this;var _0x5b34c8=new History(_0x31aba5);return new BPromise(function(_0x45c95b,_0x53549f){if(_['isUndefined'](_0x447a38)&&typeof _0x447a38!==_0x72b8('0x197')){return _0x53549f(msgResponse(_0x72b8('0x198'),_0x72b8('0x13b'),_0x72b8('0x199')));}if(_['isUndefined'](_0x40cc2f)&&typeof _0x40cc2f!==_0x72b8('0x197')){return _0x53549f(msgResponse(_0x72b8('0x198'),_0x72b8('0x13b'),_0x72b8('0x19a')));}switch(_0x40cc2f['reason']){case'0':_0x447a38[_0x72b8('0x5f')]+=0x1;_0x5b34c8[_0x72b8('0xa3')]=0x0;_0x5b34c8['statedesc']=_0x72b8('0x19b');_0x5b34c8[_0x72b8('0xea')]+=0x1;_0x5b34c8['countglobal']+=0x1;ami[_0x72b8('0x47')]('custom:agentnosuchnumber',ut[_0x72b8('0x19c')](_0x31aba5,_0x72b8('0x19d')));_0x796ae[_0x72b8('0xc6')](_0x5b34c8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xe7')));if(_0x796ae[_0x72b8('0x189')](0x0,_0x31aba5,_0x447a38)){if(_0x5b34c8['countnosuchnumberretry']>=_0x447a38[_0x72b8('0x18f')]){_0x796ae['createStateFinal'](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x19e'));}else{_0x796ae[_0x72b8('0xee')](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x19e'));}}break;case'3':_0x447a38['outboundNoAnswerCallsDay']+=0x1;_0x5b34c8['state']=0x3;_0x5b34c8[_0x72b8('0xde')]=_0x72b8('0x19f');_0x5b34c8['countnoanswerretry']+=0x1;_0x5b34c8[_0x72b8('0xe5')]+=0x1;ami[_0x72b8('0x47')](_0x72b8('0x1a0'),ut[_0x72b8('0x19c')](_0x31aba5,_0x72b8('0x1a1')));_0x796ae[_0x72b8('0xc6')](_0x5b34c8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x1a2')));if(_0x796ae[_0x72b8('0x189')](0x3,_0x31aba5,_0x447a38)){if(_0x5b34c8[_0x72b8('0x18a')]>=_0x447a38[_0x72b8('0x1a3')]){_0x796ae['createStateFinal'](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1a4'));}else{_0x796ae[_0x72b8('0xee')](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1a4'));}}break;case'5':_0x447a38[_0x72b8('0x1a5')]+=0x1;_0x5b34c8['state']=0x5;_0x5b34c8['statedesc']='Busy';_0x5b34c8[_0x72b8('0xe8')]+=0x1;_0x5b34c8['countglobal']+=0x1;ami['emit'](_0x72b8('0x1a6'),ut['buildObj'](_0x31aba5,_0x72b8('0x1a7')));_0x796ae['createHistory'](_0x5b34c8)['catch'](loggerCatch(_0x72b8('0x1a8')));if(_0x796ae[_0x72b8('0x189')](0x5,_0x31aba5,_0x447a38)){if(_0x5b34c8['countbusyretry']>=_0x447a38[_0x72b8('0x18b')]){_0x796ae['createStateFinal'](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1a9'));}else{_0x796ae[_0x72b8('0xee')](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1a9'));}}break;case'8':_0x447a38['outboundCongestionCallsDay']+=0x1;_0x5b34c8[_0x72b8('0xa3')]=0x8;_0x5b34c8['statedesc']='Congestion';_0x5b34c8[_0x72b8('0xe9')]+=0x1;_0x5b34c8[_0x72b8('0xe5')]+=0x1;ami[_0x72b8('0x47')](_0x72b8('0x1aa'),ut[_0x72b8('0x19c')](_0x31aba5,_0x72b8('0x1ab')));_0x796ae[_0x72b8('0xc6')](_0x5b34c8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x1ac')));if(_0x796ae[_0x72b8('0x189')](0x8,_0x31aba5,_0x447a38)){if(_0x5b34c8[_0x72b8('0xe9')]>=_0x447a38['dialCongestionMaxRetry']){_0x796ae[_0x72b8('0xfb')](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1ad'));}else{_0x796ae['stateGlobal'](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1ad'));}}break;case'11':_0x447a38[_0x72b8('0x1ae')]+=0x1;_0x5b34c8[_0x72b8('0xa3')]=0xb;_0x5b34c8['statedesc']=_0x72b8('0x115');_0x5b34c8['countabandonedretry']+=0x1;_0x5b34c8['countglobal']+=0x1;_0x796ae[_0x72b8('0xc6')](_0x5b34c8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x119')));if(_0x796ae[_0x72b8('0x189')](0xb,_0x31aba5,_0x447a38)){if(_0x5b34c8[_0x72b8('0xfa')]>=_0x447a38[_0x72b8('0x194')]){_0x796ae[_0x72b8('0xfb')](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1af'));}else{_0x796ae[_0x72b8('0xee')](_0x5b34c8,_0x45c95b,_0x53549f,'reason\x2011\x20abandoned');}}break;case'20':_0x447a38['outboundRejectCallsDay']+=0x1;_0x5b34c8[_0x72b8('0xa3')]=0x14;_0x5b34c8[_0x72b8('0xde')]=_0x72b8('0x1b0');_0x5b34c8['countagentrejectretry']+=0x1;_0x5b34c8[_0x72b8('0xe5')]+=0x1;ami[_0x72b8('0x47')](_0x72b8('0x1b1'),ut[_0x72b8('0x19c')](_0x31aba5,_0x72b8('0x1b2')));_0x796ae[_0x72b8('0xc6')](_0x5b34c8)['catch'](loggerCatch(_0x72b8('0x1b3')));if(_0x796ae[_0x72b8('0x189')](0x14,_0x31aba5,_0x447a38)){if(_0x5b34c8['countagentrejectretry']>=_0x447a38['dialAgentRejectMaxRetry']){_0x796ae[_0x72b8('0xfb')](_0x5b34c8,_0x45c95b,_0x53549f,'reason\x2020\x20agentreject');}else{_0x796ae[_0x72b8('0xee')](_0x5b34c8,_0x45c95b,_0x53549f,_0x72b8('0x1b4'));}}break;default:_0x447a38[_0x72b8('0x62')]+=0x1;_0x5b34c8['state']=0xc;_0x5b34c8[_0x72b8('0xde')]=_0x40cc2f[_0x72b8('0x105')];_0x796ae[_0x72b8('0xc6')](_0x5b34c8)[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x1b5')));if(_0x796ae[_0x72b8('0x189')](_0x40cc2f[_0x72b8('0x105')],_0x31aba5,_0x447a38)){if(_0x5b34c8['countbusyretry']+_0x5b34c8[_0x72b8('0xe9')]+_0x5b34c8['countnoanswerretry']+_0x5b34c8['countnosuchnumberretry']+_0x5b34c8[_0x72b8('0xf9')]+_0x5b34c8[_0x72b8('0xfa')]+_0x5b34c8[_0x72b8('0xeb')]+_0x5b34c8['countagentrejectretry']>=_0x447a38[_0x72b8('0xed')]){_0x796ae[_0x72b8('0xee')](_0x5b34c8,_0x45c95b,_0x53549f,_0x40cc2f[_0x72b8('0x105')]);}else{_0x796ae[_0x72b8('0xfb')](_0x5b34c8,_0x45c95b,_0x53549f,_0x40cc2f[_0x72b8('0x105')]);}}}});};Dialer[_0x72b8('0xa6')]['stateGlobal']=function(_0x182fdb,_0x6e4419,_0x39071e,_0x4db29e){var _0x1cb24b=new Final(_0x182fdb);_0x1cb24b[_0x72b8('0xa3')]=0xf;_0x1cb24b['statedesc']=_0x72b8('0x1b6');this[_0x72b8('0xfb')](_0x1cb24b,_0x6e4419,_0x39071e,_0x4db29e);};Dialer[_0x72b8('0xa6')]['createStateFinal']=function(_0x2f8e57,_0x3faddb,_0x2348e0,_0x948f1f){this[_0x72b8('0xc5')](_0x2f8e57)[_0x72b8('0xb7')](function(){return _0x3faddb(msgResponse(_0x72b8('0x198'),'Success',_0x948f1f));})[_0x72b8('0xbd')](function(){return _0x2348e0(msgResponse(_0x72b8('0x1b7'),_0x72b8('0x13b'),_0x72b8('0x1b8')));});};Dialer[_0x72b8('0xa6')][_0x72b8('0x14f')]=function(_0x1a8cd3){var _0x26eee6=_0x1a8cd3[_0x72b8('0x1b9')]/0x64;var _0x98139e=_0x1a8cd3[_0x72b8('0x5e')]/(_0x1a8cd3[_0x72b8('0x5e')]+_0x1a8cd3['outboundAnswerCallsDay']);var _0x3e34d9=Math[_0x72b8('0x1ba')](_0x1a8cd3[_0x72b8('0x6c')]*(_0x1a8cd3[_0x72b8('0x1bb')]/0x64));var _0x5059ac=Math[_0x72b8('0x1ba')](_0x1a8cd3[_0x72b8('0x6c')]*(_0x1a8cd3[_0x72b8('0x1bc')]/0x64));var _0x5e6130=_0x1a8cd3[_0x72b8('0x4c')]+_0x1a8cd3[_0x72b8('0x4f')];var _0x37d53e=Math[_0x72b8('0x1bd')](_0x1a8cd3['erlangCalls']*_0x1a8cd3[_0x72b8('0x6e')]*_0x1a8cd3[_0x72b8('0x6a')]*_0x1a8cd3[_0x72b8('0x1be')]);if(_['isUndefined'](_0x1a8cd3[_0x72b8('0x25')])){if(!_[_0x72b8('0x38')](_0x1a8cd3[_0x72b8('0x24')])){_0x1a8cd3[_0x72b8('0x24')]=undefined;loggerPredictive[_0x72b8('0x93')]('[startMethodPredictive][StartProgressive]',_0x72b8('0x1bf'));}if(!_[_0x72b8('0x38')](_0x1a8cd3[_0x72b8('0x8f')])){loggerPredictive[_0x72b8('0x93')]('[startMethodPredictive][StartProgressive]',_0x72b8('0x1c0'));clearInterval(_0x1a8cd3['handlePredictive']);_0x1a8cd3['handlePredictive']=undefined;}_0x1a8cd3['startProgressive']=moment()[_0x72b8('0x76')](_0x72b8('0xf4'));loggerPredictive[_0x72b8('0x7b')](_0x1a8cd3[_0x72b8('0x3b')],'collection\x20data\x20in\x20progressive\x20at',_0x1a8cd3['startProgressive']);this[_0x72b8('0x14c')](_0x1a8cd3,0x1);}else if(ifInterval(_0x1a8cd3[_0x72b8('0x1c1')],_0x1a8cd3[_0x72b8('0x25')])){this[_0x72b8('0x14c')](_0x1a8cd3,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x1a8cd3[_0x72b8('0x25')],_0x1a8cd3['name']);_0x1a8cd3[_0x72b8('0x87')]=0x0;_0x1a8cd3['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x26eee6<_0x98139e&&_0x1a8cd3[_0x72b8('0x1c2')]==='dropRate'){freeVariablesPredictive(_0x1a8cd3);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x1c3'),_0x72b8('0x1c4'),_0x98139e,_0x72b8('0x25'),_0x1a8cd3['name']);}else if(_0x37d53e<_0x1a8cd3['predictiveIntervalErlangCallsDroppedCalls']&&_0x1a8cd3[_0x72b8('0x1c2')]===_0x72b8('0x1c5')){freeVariablesPredictive(_0x1a8cd3);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x1c6'),_0x72b8('0x1c7'),_0x37d53e,_0x72b8('0x1c8'),_0x1a8cd3[_0x72b8('0x69')],'startProgressive',_0x1a8cd3[_0x72b8('0x3b')]);}else if(!ifInterval(_0x1a8cd3[_0x72b8('0x1c1')],_0x1a8cd3[_0x72b8('0x25')])&&_['isUndefined'](_0x1a8cd3[_0x72b8('0x24')])&&!_[_0x72b8('0x38')](_0x1a8cd3[_0x72b8('0x25')])){_0x1a8cd3['startPredictive']=moment()['format'](_0x72b8('0xf4'));loggerPredictive[_0x72b8('0x7b')](_0x1a8cd3[_0x72b8('0x3b')],_0x72b8('0x1c9'),_0x1a8cd3[_0x72b8('0x24')]);this['averageHandleTime'](_0x1a8cd3[_0x72b8('0x1c1')])['then'](this[_0x72b8('0x1ca')](_0x1a8cd3))[_0x72b8('0xb7')](mergeDataErlangB(_0x1a8cd3))[_0x72b8('0xb7')](this[_0x72b8('0x1cb')](_0x1a8cd3))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1a8cd3));}else if(!ifInterval(_0x1a8cd3['dialPredictiveInterval'],_0x1a8cd3[_0x72b8('0x24')])){_0x1a8cd3[_0x72b8('0x69')]=0x0;_0x1a8cd3[_0x72b8('0x24')]=moment()[_0x72b8('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x72b8('0x7b')](_0x1a8cd3['name'],_0x72b8('0x1cc'),_0x1a8cd3['startPredictive']);clearInterval(_0x1a8cd3['handlePredictive']);_0x1a8cd3[_0x72b8('0x8f')]=undefined;this[_0x72b8('0xba')](_0x1a8cd3['dialPredictiveInterval'])[_0x72b8('0xb7')](this[_0x72b8('0x1ca')](_0x1a8cd3))['then'](mergeDataErlangB(_0x1a8cd3))['then'](this[_0x72b8('0x1cb')](_0x1a8cd3))[_0x72b8('0xbd')](loggerCatchPredictive(_0x72b8('0x1cd'),_0x1a8cd3));}else if(_0x1a8cd3[_0x72b8('0x6c')]&&_0x5e6130<_0x1a8cd3[_0x72b8('0x6c')]-_0x5059ac){freeVariablesPredictive(_0x1a8cd3);loggerPredictive['info'](_0x1a8cd3[_0x72b8('0x3b')],_0x72b8('0x1ce'),_0x5e6130,')\x20are\x20less\x20than\x20threshold\x20(',_0x1a8cd3[_0x72b8('0x6c')],'-',_0x5059ac,'=',_0x1a8cd3[_0x72b8('0x6c')]-_0x5059ac,')');}else if(_0x1a8cd3[_0x72b8('0x6c')]&&_0x5e6130>_0x1a8cd3[_0x72b8('0x6c')]+_0x3e34d9){freeVariablesPredictive(_0x1a8cd3);loggerPredictive[_0x72b8('0x7b')](_0x1a8cd3[_0x72b8('0x3b')],_0x72b8('0x1ce'),_0x5e6130,_0x72b8('0x1cf'),_0x1a8cd3['predictiveIntervalAvailable'],'+',_0x3e34d9,'=',_0x1a8cd3[_0x72b8('0x6c')]+_0x3e34d9,')');}};Dialer[_0x72b8('0xa6')]['getDataPredictive']=function(_0x110232){var _0x3a4f07=this;return function(_0x9530fb){return new BPromise(function(_0x21a222,_0x3444b7){_['merge'](_0x110232,_0x9530fb[0x0]);if(checkGetDataPredictive(_0x9530fb[0x0])){var _0x2ef393=_0x110232[_0x72b8('0x6c')]=_0x110232['talking']+_0x110232[_0x72b8('0x4c')];var _0x2c113e=_0x110232[_0x72b8('0x1c1')]*0x3c;var _0x58e8f4=_0x9530fb[0x0][_0x72b8('0x65')]+_0x9530fb[0x0][_0x72b8('0x64')];var _0x4a3c1f=(_0x9530fb[0x0][_0x72b8('0x63')]+_0x9530fb[0x0][_0x72b8('0x67')]+_0x9530fb[0x0][_0x72b8('0x66')])/_0x9530fb[0x0][_0x72b8('0x82')];_0x110232[_0x72b8('0x6a')]=_0x4a3c1f>0x0?_0x4a3c1f:0x1;switch(_0x110232['dialPredictiveOptimization']){case _0x72b8('0x1c5'):var _0x38dc81=_0x110232['dialPredictiveOptimizationPercentage']/0x64;return _0x3a4f07[_0x72b8('0x1d0')](_0x2ef393,_0x2c113e,_0x58e8f4,_0x4a3c1f,_0x38dc81)['then'](function(_0x1844f0){return _0x21a222(_0x1844f0);});case _0x72b8('0x1d1'):var _0x10c03f=_0x110232[_0x72b8('0x1b9')]/0x64;return _0x3a4f07['busyFactor'](_0x2ef393,_0x2c113e,_0x58e8f4,_0x4a3c1f,_0x10c03f)[_0x72b8('0xb7')](function(_0x4eada9){return _0x21a222(_0x4eada9);});default:return _0x3444b7(msgResponse(_0x72b8('0x1d2'),_0x72b8('0x13b'),_0x72b8('0x1d3')));}}else{return _0x3444b7(msgResponse(_0x72b8('0x1d2'),_0x72b8('0x13b'),_0x72b8('0x1d4')));}});};};Dialer[_0x72b8('0xa6')]['getDataPredictiveOld']=function(_0x25d792){var _0x232597=this;return function(_0x1bc58e){return new BPromise(function(_0x2edcfc,_0x517503){_[_0x72b8('0xcc')](_0x25d792,_0x1bc58e[0x0]);if(checkGetDataPredictive(_0x1bc58e[0x0])){loggerPredictive['info'](JSON[_0x72b8('0x44')](_0x1bc58e[0x0]));if(_0x25d792[_0x72b8('0x1c2')]===_0x72b8('0x1c5')){return _0x232597[_0x72b8('0xc3')](_0x25d792['id'])['then'](function(_0x275486){var _0xd9395b=_0x25d792[_0x72b8('0x4d')]-_0x275486[0x0][_0x72b8('0x1d5')];var _0x1daabd=_0x25d792[_0x72b8('0x1c1')]*0x3c;var _0x37610f=_0x1bc58e[0x0][_0x72b8('0x65')]+_0x1bc58e[0x0][_0x72b8('0x64')];var _0x19b34d=(_0x1bc58e[0x0][_0x72b8('0x63')]+_0x1bc58e[0x0][_0x72b8('0x67')]+_0x1bc58e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1bc58e[0x0][_0x72b8('0x82')];var _0x24959f=_0x25d792[_0x72b8('0x1b9')]/0x64;_0x25d792[_0x72b8('0x6b')]=_0x275486[0x0][_0x72b8('0x1d5')]||0x0;_0x25d792['predictiveIntervalHitRate']=_0x19b34d>0x0?_0x19b34d:0x1;return _0x232597['abandonmentRate'](_0xd9395b,_0x1daabd,_0x37610f,_0x19b34d,_0x24959f);})[_0x72b8('0xb7')](function(_0x5df808){return _0x2edcfc(_0x5df808);})[_0x72b8('0xbd')](function(_0x345b04){return _0x517503(msgResponse('[CatchErlangB]',_0x72b8('0x13b'),JSON[_0x72b8('0x44')](_0x345b04)));});}if(_0x25d792['dialPredictiveOptimization']===_0x72b8('0x1d1')){return _0x232597[_0x72b8('0xc3')](_0x25d792['id'])[_0x72b8('0xb7')](function(_0x2756d9){var _0x2cb586=_0x25d792[_0x72b8('0x4d')]-_0x2756d9[0x0][_0x72b8('0x1d5')];var _0x54194d=_0x25d792[_0x72b8('0x1c1')]*0x3c;var _0x1d3eab=_0x1bc58e[0x0]['predictiveIntervalAvgTalktime']+_0x1bc58e[0x0][_0x72b8('0x64')];var _0xe1555c=(_0x1bc58e[0x0]['predictiveIntervalAnsweredCalls']+_0x1bc58e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1bc58e[0x0][_0x72b8('0x66')])/_0x1bc58e[0x0][_0x72b8('0x82')];var _0x456509=_0x25d792[_0x72b8('0x1b9')]/0x64;_0x25d792[_0x72b8('0x6b')]=_0x2756d9[0x0][_0x72b8('0x1d5')]||0x0;_0x25d792[_0x72b8('0x6a')]=_0xe1555c>0x0?_0xe1555c:0x1;return _0x232597[_0x72b8('0x1d6')](_0x2cb586,_0x54194d,_0x1d3eab,_0xe1555c,_0x456509);})[_0x72b8('0xb7')](function(_0x415bed){return _0x2edcfc(_0x415bed);})[_0x72b8('0xbd')](function(_0x52d2f8){return _0x517503(msgResponse(_0x72b8('0x1d7'),'Failure',JSON[_0x72b8('0x44')](_0x52d2f8)));});}}else{return _0x517503(msgResponse(_0x72b8('0x1d2'),_0x72b8('0x13b'),_0x72b8('0x1d4')));}});};};Dialer[_0x72b8('0xa6')]['startMethodPredictive']=function(_0x480cb8){var _0x4a5745=this;return function(){var _0x529e01=0x0;var _0x3be466=Math[_0x72b8('0x1bd')](_0x480cb8[_0x72b8('0x89')]*0x3e8);if(_0x3be466>0x0){_0x3be466=_0x3be466<0x64?0x64:_0x3be466;loggerPredictive[_0x72b8('0x7b')](_0x480cb8['name'],_0x72b8('0x1d8'),_0x3be466,'milliseconds');_0x480cb8[_0x72b8('0x8f')]=setInterval(function(){_0x4a5745[_0x72b8('0x8f')](_0x480cb8);loggerPredictiveCalls[_0x72b8('0x7b')](_0x72b8('0x1d9'),_0x529e01+=0x1);},_0x3be466);}else{loggerPredictive[_0x72b8('0x7b')](_0x480cb8[_0x72b8('0x3b')],_0x72b8('0x1da'));}};};Dialer['prototype'][_0x72b8('0x1db')]=function(_0x4ae429,_0x21cdd8){var _0x59572e=this;return function(_0x27843f){if(_[_0x72b8('0x79')](_0x27843f)){if(_['isNil'](_0x21cdd8[_0x72b8('0xce')])||!_0x21cdd8[_0x72b8('0x1dc')]){if(_0x4ae429[_0x72b8('0x56')]===_0x72b8('0x8')){_0x4ae429[_0x72b8('0x121')]=_['isUndefined'](_0x4ae429[_0x72b8('0x121')])?!![]:_0x4ae429[_0x72b8('0x121')];var _0x24382d=uuid['v4']();_0x59572e[_0x72b8('0x21')][_0x24382d]=new Action(_0x4ae429,_0x21cdd8,_0x24382d);loggerBooked[_0x72b8('0x7b')](_0x72b8('0x1dd'),_0x24382d,_0x72b8('0x1de'),JSON[_0x72b8('0x44')](_0x4ae429[_0x72b8('0x121')]),_0x72b8('0x1df'),_0x4ae429[_0x72b8('0x3b')]);if(_0x4ae429[_0x72b8('0x121')]){_0x4ae429['queueStatusComplete']=![];_0x59572e[_0x72b8('0x11f')][_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0xb0')]]=[];ami[_0x72b8('0x13e')]({'actionid':_0x24382d,'action':'queuestatus','queue':_0x4ae429['name']})['catch'](function(){_0x59572e[_0x72b8('0xae')](_0x4ae429);_0x59572e[_0x72b8('0xbc')]({'active':![],'ContactId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0xf5')],'ListId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0x110')],'VoiceQueueId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0xcf')]||undefined,'CampaignId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0xd0')]||undefined})['catch'](loggerCatch(_0x72b8('0x1e0')));delete _0x59572e[_0x72b8('0x21')][_0x24382d];});}else{loggerBooked['info'](_0x72b8('0x1e1'),JSON[_0x72b8('0x44')](_0x4ae429[_0x72b8('0x121')]),_0x72b8('0x1df'),_0x4ae429['name']);_0x59572e['updateOriginated'](_0x4ae429);_0x59572e[_0x72b8('0xbc')]({'active':![],'ContactId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0xf5')],'ListId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0x110')],'VoiceQueueId':_0x59572e['actions'][_0x24382d][_0x72b8('0xcf')]||undefined,'CampaignId':_0x59572e[_0x72b8('0x21')][_0x24382d][_0x72b8('0xd0')]||undefined})[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x1e0')));delete _0x59572e[_0x72b8('0x21')][_0x24382d];}}else{return _0x59572e['actionOriginate'](_0x4ae429,_0x21cdd8);}}else{if(getDiff(_0x21cdd8[_0x72b8('0x1e2')])<_0x4ae429[_0x72b8('0x1e3')]*0x3c){if(_0x21cdd8[_0x72b8('0x1e4')]&&!_0x21cdd8[_0x72b8('0x1e4')][_0x72b8('0x1e5')]){_0x59572e[_0x72b8('0x1b')][_0x72b8('0x124')](_0x21cdd8['id'])[_0x72b8('0x12b')](function(){_0x59572e[_0x72b8('0xae')](_0x4ae429);});}else{_0x59572e[_0x72b8('0xbe')]({'active':![]},_0x21cdd8['id'],0x1)['finally'](function(){_0x59572e[_0x72b8('0xae')](_0x4ae429);});}}else{_0x4ae429[_0x72b8('0x1e6')]+=0x1;_0x59572e[_0x72b8('0xae')](_0x4ae429);if(_0x4ae429[_0x72b8('0x1e7')]){_0x59572e[_0x72b8('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x21cdd8[_0x72b8('0xf5')],'ListId':_0x21cdd8['ListId'],'VoiceQueueId':_0x21cdd8[_0x72b8('0xcf')]||undefined,'CampaignId':_0x21cdd8[_0x72b8('0xd0')]||undefined})['catch'](loggerCatch(_0x72b8('0x1e8')));_0x59572e[_0x72b8('0xc6')](createObjHistory(_0x4ae429,_0x21cdd8,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0x72b8('0xbd')](loggerCatch(_0x72b8('0x1e9')));}else{_0x59572e[_0x72b8('0xcb')](createObjHistory(_0x4ae429,_0x21cdd8,'RECALLFAILEDTIMEOUT',0x16,_0x72b8('0x1ea')),'[Originate][HistoryRecallClose][historyCatch]',_0x72b8('0x1eb'));}}}}else{_0x4ae429[_0x72b8('0x1ec')]+=0x1;_0x59572e['saveInDb'](createObjHistory(_0x4ae429,_0x21cdd8,'BLACKLIST',0xd,_0x72b8('0x1ed')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x72b8('0xa6')][_0x72b8('0x1ee')]=function(_0xd5e27e){var _0x22095f=this;var _0x3141be=_0xd5e27e[_0x72b8('0x1ef')]-_0xd5e27e[_0x72b8('0x6d')]-_0xd5e27e[_0x72b8('0x1f0')];emitCampaignSummary(_0xd5e27e);if(_0x3141be>0x0){if(_0x3141be>this[_0x72b8('0x1f')]){_0x3141be=this[_0x72b8('0x1f')];}_0xd5e27e[_0x72b8('0x1f0')]+=_0x3141be;this[_0x72b8('0xc2')](_0xd5e27e['id'],_0x3141be,_0xd5e27e['dialOrderByScheduledAt'])['then'](function(_0x803e85){_0xd5e27e[_0x72b8('0x1f0')]-=_0x3141be;_0xd5e27e['temp']=_0xd5e27e['temp']>0x0?_0xd5e27e['temp']:0x0;if(!checkContactEmpty(_0x803e85)){_0xd5e27e[_0x72b8('0x39')]=_0x72b8('0x9a');logger[_0x72b8('0x7b')](_0x72b8('0x1f1')+_0xd5e27e['name']);}else{_0xd5e27e[_0x72b8('0x6d')]+=_0x803e85[_0x72b8('0x95')];_0xd5e27e[_0x72b8('0x39')]=_0x72b8('0x1f2');for(var _0x3c9eec=0x0;_0x3c9eec<_0x803e85[_0x72b8('0x95')];_0x3c9eec+=0x1){_0xd5e27e[_0x72b8('0x1f3')]+=0x1;if(_[_0x72b8('0xab')](_0x803e85[_0x3c9eec])||_[_0x72b8('0xab')](_0x803e85[_0x3c9eec]['Contact'])||_[_0x72b8('0xab')](_0x803e85[_0x3c9eec][_0x72b8('0x15e')]['phone'])){_0x22095f[_0x72b8('0x1f4')](_0x72b8('0x1f5'),_0xd5e27e,_0x803e85[_0x3c9eec]);}else{_0x22095f['checkIsBlackListIvr'](_['pick'](_0x803e85[_0x3c9eec],[_0x72b8('0xd0'),_0x72b8('0x1f6')]))[_0x72b8('0xb7')](_0x22095f[_0x72b8('0x1db')](_0xd5e27e,_0x803e85[_0x3c9eec]))[_0x72b8('0xbd')](_0x22095f[_0x72b8('0xca')](_0x72b8('0x1f7'),_0xd5e27e));}}}})[_0x72b8('0xbd')](loggerGetContactDialer(_0x72b8('0x1f8'),_0xd5e27e,_0x3141be));}};Dialer[_0x72b8('0xa6')][_0x72b8('0x14c')]=function(_0x5ee4db,_0x180b3c){var _0x5b1fe8=this;var _0x225113=[];var _0x50972d=_0x180b3c>=0x1?_0x180b3c:0x1;if(_0x5ee4db[_0x72b8('0x56')]===_0x72b8('0x8')){_0x50972d=0x1;}var _0x521c62=Math[_0x72b8('0x1bd')](_0x5ee4db[_0x72b8('0x4c')]*_0x50972d)-_0x5ee4db[_0x72b8('0x6d')]-_0x5ee4db[_0x72b8('0x1f0')];emitVoiceQueueSummary(_0x5ee4db);if(_0x5ee4db[_0x72b8('0x1f9')]>0x0){var _0x1c14f4=_0x5ee4db[_0x72b8('0x1f9')]-_0x5ee4db[_0x72b8('0x6d')]-_0x5ee4db['talking']-_0x5ee4db[_0x72b8('0x1f0')]-_0x5ee4db[_0x72b8('0x9b')];if(_0x521c62>_0x1c14f4){_0x521c62=_0x1c14f4;}}if(_0x521c62>0x0){if(_0x5ee4db['dialMethod']===_0x72b8('0x8')){_0x521c62=0x1;}if(_0x521c62>this[_0x72b8('0x1f')]){_0x521c62=this[_0x72b8('0x1f')];}_0x5ee4db[_0x72b8('0x1f0')]+=_0x521c62;for(var _0x39c0b5 in this[_0x72b8('0x1d')]){if(typeof this[_0x72b8('0x1d')][_0x39c0b5]!==_0x72b8('0xc8')){if(this[_0x72b8('0x1d')][_0x39c0b5][_0x72b8('0xa3')]===_0x72b8('0x1fa')&&this[_0x72b8('0x1d')][_0x39c0b5]['status']===_0x72b8('0x1fb')){_0x225113[_0x72b8('0x120')](this[_0x72b8('0x1d')][_0x39c0b5]['id']);}}}this[_0x72b8('0xc0')](_0x5ee4db['id'],_0x225113,_0x521c62,_0x5ee4db[_0x72b8('0x1fc')])[_0x72b8('0xb7')](function(_0x308883){_0x5ee4db[_0x72b8('0x1f0')]-=_0x521c62;_0x5ee4db['temp']=_0x5ee4db[_0x72b8('0x1f0')]>0x0?_0x5ee4db[_0x72b8('0x1f0')]:0x0;if(!checkContactEmpty(_0x308883)){_0x5b1fe8['countReScheduled'](_0x5ee4db)[_0x72b8('0xb7')](sendMessageReschedule(_0x5ee4db))[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xb5')));}else{_0x5ee4db['originated']+=_0x308883[_0x72b8('0x95')];_0x5ee4db[_0x72b8('0x39')]=_0x5ee4db[_0x72b8('0x56')]==='booked'?_0x72b8('0x167'):_0x72b8('0x1f2');for(var _0x84184=0x0;_0x84184<_0x308883[_0x72b8('0x95')];_0x84184+=0x1){if(_[_0x72b8('0xab')](_0x308883[_0x84184])||_[_0x72b8('0xab')](_0x308883[_0x84184][_0x72b8('0x15e')])||_[_0x72b8('0xab')](_0x308883[_0x84184][_0x72b8('0x15e')][_0x72b8('0x15f')])){_0x5b1fe8[_0x72b8('0x1f4')](_0x72b8('0x1f5'),_0x5ee4db,_0x308883[_0x84184]);}else{_0x5b1fe8[_0x72b8('0xb6')](_[_0x72b8('0xcd')](_0x308883[_0x84184],[_0x72b8('0xcf'),_0x72b8('0x1f6')]))[_0x72b8('0xb7')](_0x5b1fe8[_0x72b8('0x1db')](_0x5ee4db,_0x308883[_0x84184]))[_0x72b8('0xbd')](_0x5b1fe8[_0x72b8('0xca')](_0x72b8('0x1f5'),_0x5ee4db));}}}})[_0x72b8('0xbd')](loggerGetContactDialer(_0x72b8('0x1fd'),_0x5ee4db,_0x521c62));}};Dialer[_0x72b8('0xa6')]['handlePredictive']=function(_0x5e6273){if(_0x5e6273['dialLimitQueue']>0x0){var _0x3ff62a=_0x5e6273['dialLimitQueue']-_0x5e6273[_0x72b8('0x6d')]-_0x5e6273[_0x72b8('0x4f')];if(_0x3ff62a>0x0){this[_0x72b8('0x1fe')](_0x5e6273);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x5e6273);}};Dialer[_0x72b8('0xa6')][_0x72b8('0x1fe')]=function(_0x2eaecc){var _0x3fb0d5=this;var _0x3bdc57=[];_0x2eaecc[_0x72b8('0x6d')]+=0x1;for(var _0x34e5fb in this[_0x72b8('0x1d')]){if(typeof this[_0x72b8('0x1d')][_0x34e5fb]!==_0x72b8('0xc8')){if(this[_0x72b8('0x1d')][_0x34e5fb][_0x72b8('0xa3')]===_0x72b8('0x1fa')&&this[_0x72b8('0x1d')][_0x34e5fb][_0x72b8('0xac')]===_0x72b8('0x1fb')){_0x3bdc57['push'](this[_0x72b8('0x1d')][_0x34e5fb]['id']);}}}this[_0x72b8('0xc0')](_0x2eaecc['id'],_0x3bdc57,0x1,_0x2eaecc[_0x72b8('0x1fc')])[_0x72b8('0xb7')](function(_0x59fdce){if(!checkContactEmpty(_0x59fdce)){checkContactLowerLimitOriginate(_0x2eaecc,0x1,0x0);_0x3fb0d5[_0x72b8('0xb4')](_0x2eaecc)[_0x72b8('0xb7')](sendMessageReschedule(_0x2eaecc))[_0x72b8('0xbd')](loggerCatch(_0x72b8('0xb5')));}else{_0x2eaecc[_0x72b8('0x39')]=_0x72b8('0x1f2');if(_[_0x72b8('0xab')](_0x59fdce[0x0])||_['isNil'](_0x59fdce[0x0][_0x72b8('0x15e')])||_['isNil'](_0x59fdce[0x0][_0x72b8('0x15e')][_0x72b8('0x15f')])){_0x3fb0d5[_0x72b8('0x1f4')](_0x72b8('0x1f5'),_0x2eaecc,_0x59fdce[0x0]);}else{_0x3fb0d5['checkIsBlackList'](_[_0x72b8('0xcd')](_0x59fdce[0x0],[_0x72b8('0xcf'),_0x72b8('0x1f6')]))[_0x72b8('0xb7')](_0x3fb0d5[_0x72b8('0x1db')](_0x2eaecc,_0x59fdce[0x0]))[_0x72b8('0xbd')](_0x3fb0d5[_0x72b8('0xca')](_0x72b8('0x1ff'),_0x2eaecc));}}})[_0x72b8('0xbd')](loggerGetContactDialer(_0x72b8('0x200'),_0x2eaecc,0x1));emitVoiceQueueSummary(_0x2eaecc);};Dialer[_0x72b8('0xa6')][_0x72b8('0x1d0')]=function(_0x15db40,_0x8d97bb,_0x55ebec,_0x2279aa,_0x35df47,_0x69000b){loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x201'));loggerPredictive[_0x72b8('0x7b')]('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',_0x15db40);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x202'),_0x8d97bb);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x203'),_0x55ebec);loggerPredictive[_0x72b8('0x7b')]('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',_0x2279aa);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x204'),_0x35df47);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x81'));return new BPromise(function(_0x3f8f90,_0x5cc520){if(_0x15db40<=0x0||isNaN(_0x15db40)){return _0x5cc520(msgResponse(_0x72b8('0x205'),_0x72b8('0x43'),_0x72b8('0x206')+_0x15db40));}if(_0x55ebec<=0x0||isNaN(_0x55ebec)){return _0x5cc520(msgResponse(_0x72b8('0x205'),_0x72b8('0x43'),'Ts\x20=\x20'+_0x55ebec));}if(_0x2279aa<=0x0||isNaN(_0x2279aa)){return _0x5cc520(msgResponse(_0x72b8('0x205'),_0x72b8('0x43'),_0x72b8('0x207')+_0x2279aa));}if(_0x8d97bb<=0x0||isNaN(_0x8d97bb)){return _0x5cc520(msgResponse('[abandonmentRate]','Error',_0x72b8('0x208')+_0x8d97bb));}if(_0x35df47<=0x0||isNaN(_0x35df47)){return _0x5cc520(msgResponse(_0x72b8('0x205'),'Error',_0x72b8('0x209')+_0x35df47));}_0x69000b=_0x69000b||0x0;var _0x4f15c0=0x1/_0x55ebec;var _0x442fb7=0x0;var _0x2017b8=0x0;var _0x490854=0x0;var _0x2a1b4e=0x0;for(var _0x33c892=0x0;_0x490854<_0x35df47;_0x33c892+=0x1){_0x2017b8=_0x33c892/_0x8d97bb;_0x442fb7=(_0x2279aa*_0x2017b8+_0x69000b)/_0x4f15c0;_0x490854=erlangb(_0x442fb7,_0x15db40);_0x2a1b4e=_0x442fb7/_0x15db40*(0x1-erlangb(_0x442fb7,_0x15db40));}return _0x3f8f90({'erlangCalls':_0x33c892,'erlangCallToSecond':_0x8d97bb/_0x33c892,'erlangAbandonmentRate':_0x490854,'erlangBusyFactor':_0x2a1b4e});});};Dialer['prototype']['busyFactor']=function(_0x1ce364,_0x236cd7,_0x2f4961,_0x2b5901,_0x516eb1,_0x2994f4){loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x20a'));loggerPredictive[_0x72b8('0x7b')]('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',_0x1ce364);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x202'),_0x236cd7);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x203'),_0x2f4961);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x20b'),_0x2b5901);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x20c'),_0x516eb1);loggerPredictive[_0x72b8('0x7b')](_0x72b8('0x81'));return new BPromise(function(_0x486136,_0x4a4fe8){if(_0x1ce364<=0x0||isNaN(_0x1ce364)){return _0x4a4fe8(msgResponse(_0x72b8('0x20d'),_0x72b8('0x43'),_0x72b8('0x206')+_0x1ce364));}if(_0x2f4961<=0x0||isNaN(_0x2f4961)){return _0x4a4fe8(msgResponse(_0x72b8('0x20d'),_0x72b8('0x43'),_0x72b8('0x20e')+_0x2f4961));}if(_0x2b5901<=0x0||isNaN(_0x2b5901)){return _0x4a4fe8(msgResponse('[busyFactor]',_0x72b8('0x43'),_0x72b8('0x207')+_0x2b5901));}if(_0x236cd7<=0x0||isNaN(_0x236cd7)){return _0x4a4fe8(msgResponse(_0x72b8('0x20d'),'Error','interval\x20=\x20'+_0x236cd7));}if(_0x516eb1<=0x0||isNaN(_0x516eb1)){return _0x4a4fe8(msgResponse(_0x72b8('0x20d'),_0x72b8('0x43'),_0x72b8('0x20f')+_0x516eb1));}_0x2994f4=_0x2994f4||0x0;var _0x3d037b=0x1/_0x2f4961;var _0x2903e9=0x0;var _0x6be925=0x0;var _0x3bc2a6=0x0;var _0x3e204e=0x0;for(var _0x216cb0=0x0;_0x3e204e<_0x516eb1;_0x216cb0+=0x1){_0x6be925=_0x216cb0/_0x236cd7;_0x2903e9=(_0x2b5901*_0x6be925+_0x2994f4)/_0x3d037b;_0x3bc2a6=erlangb(_0x2903e9,_0x1ce364);_0x3e204e=_0x2903e9/_0x1ce364*(0x1-erlangb(_0x2903e9,_0x1ce364));}return _0x486136({'erlangCalls':_0x216cb0,'erlangCallToSecond':_0x236cd7/_0x216cb0,'erlangAbandonmentRate':_0x3bc2a6,'erlangBusyFactor':_0x3e204e});});};module['exports']=Dialer; \ No newline at end of file +var _0x4d37=['Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','syncQueueSummary','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','object','originate','voiceQueue\x20is\x20undefine','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','reason','emit','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','checkRetriveMax','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','startProgressive','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','Error','milliseconds','seconds','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','startPredictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','then','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','inspect','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','status','uniqueId','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerCallsDay','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countbusyretry','countabandonedretry','dialGlobalMaxRetry','add','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','Drop','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4d37,0xe6));var _0x74d3=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x4d37[_0x1defb2];return _0xad8973;};'use strict';var util=require(_0x74d3('0x0'));var _=require(_0x74d3('0x1'));var BPromise=require(_0x74d3('0x2'));var uuid=require('uuid');var moment=require(_0x74d3('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x74d3('0x4'));var ut=require(_0x74d3('0x5'));var config=require(_0x74d3('0x6'));var logger=require(_0x74d3('0x7'))(_0x74d3('0x8'));var loggerBooked=require(_0x74d3('0x7'))(_0x74d3('0x9'));var loggerPredictive=require('../../../config/logger')(_0x74d3('0xa'));var loggerPredictiveCalls=require(_0x74d3('0x7'))(_0x74d3('0xb'));var loggerSyncQueueSummary=require(_0x74d3('0x7'))('syncQueueSummary');var ami=require(_0x74d3('0xc'));config[_0x74d3('0xd')]=_['defaults'](config[_0x74d3('0xd')],{'host':_0x74d3('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x74d3('0xd')]));var cmHopper=require(_0x74d3('0xf'));var cmHopperHistory=require(_0x74d3('0x10'));var cmHopperBlack=require(_0x74d3('0x11'));var voiceQueueRt=require(_0x74d3('0x12'));var Action=require(_0x74d3('0x13'));var History=require(_0x74d3('0x14'));var Final=require(_0x74d3('0x15'));var AgentComplete=require(_0x74d3('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x74d3('0x17'));var ipAgi=process[_0x74d3('0x18')][_0x74d3('0x19')]||_0x74d3('0x1a');var strategy={'rrmemory':_0x74d3('0x1b'),'roundrobin':_0x74d3('0x1c')};var Sequence=function(){};Sequence[_0x74d3('0x1d')][_0x74d3('0x1e')]=function(_0x66b139){this[_0x74d3('0x1f')]=this[_0x74d3('0x1f')]?this[_0x74d3('0x1f')]['finally'](_0x66b139):_0x66b139();};function Dialer(_0x4e6160,_0x3c7c68){this['sequence']=new Sequence();this[_0x74d3('0x20')]=_0x3c7c68;this[_0x74d3('0x21')]=_0x4e6160[_0x74d3('0x21')];this[_0x74d3('0x22')]=_0x4e6160['campaigns'];this[_0x74d3('0x23')]=_0x4e6160['agents'];this['trunks']=_0x4e6160[_0x74d3('0x24')];this[_0x74d3('0x25')]=config[_0x74d3('0x25')]||0x2;this[_0x74d3('0x26')]={};this['actions']={};this[_0x74d3('0x27')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x74d3('0x28')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x74d3('0x29'),this[_0x74d3('0x2a')]['bind'](this));ami['on'](_0x74d3('0x2b'),this[_0x74d3('0x2c')]['bind'](this));ami['on'](_0x74d3('0x2d'),this[_0x74d3('0x2e')][_0x74d3('0x2f')](this));ami['on'](_0x74d3('0x30'),this[_0x74d3('0x31')][_0x74d3('0x2f')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x74d3('0x2f')](this));ami['on'](_0x74d3('0x32'),this['syncHangup'][_0x74d3('0x2f')](this));ami['on'](_0x74d3('0x33'),this[_0x74d3('0x34')]['bind'](this));ami['on'](_0x74d3('0x35'),this[_0x74d3('0x36')][_0x74d3('0x2f')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x74d3('0x37'),this['syncQueueStatusComplete']['bind'](this));this[_0x74d3('0x38')]();this[_0x74d3('0x39')]();}function isNotNull(_0x30b3df){return _0x30b3df!==null&&!_['isUndefined'](_0x30b3df);}function checkIsLoggedIn(_0x47ff27,_0x211afa){return function(){if(_0x211afa<=0x0){_0x47ff27['message']=_0x74d3('0x3a');throw _0x47ff27['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x7997e0){return _0x7997e0;}function checkIsActive(_0x32bc28,_0x1af7f5){return function(){if(!isActive(_0x1af7f5)){_0x32bc28[_0x74d3('0x3b')]=_0x74d3('0x3c');throw _0x32bc28['name']+_0x74d3('0x3d');}};}function checkInterval(_0x339831){return function(){if(!isNotNull(_0x339831[_0x74d3('0x3e')])){_0x339831[_0x74d3('0x3b')]=_0x74d3('0x3f');throw _0x339831[_0x74d3('0x40')]+_0x74d3('0x41');}if(!isNotNull(_0x339831[_0x74d3('0x3e')][_0x74d3('0x42')])){_0x339831[_0x74d3('0x3b')]=_0x74d3('0x3f');throw _0x339831[_0x74d3('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x339831[_0x74d3('0x3e')]['Intervals']))){_0x339831[_0x74d3('0x3b')]='INTERVAL_IS_NULL';throw _0x339831[_0x74d3('0x40')]+_0x74d3('0x41');}};}function msgResponse(_0x5442e3,_0x33e55e,_0x36abad){return{'action':_0x5442e3,'response':_0x33e55e,'message':_0x36abad,'stack':_0x36abad};}function myreject(_0x570eae){return function(_0x35e3e8){return _0x570eae(msgResponse('[ifTime][Action]',_0x74d3('0x43'),JSON['stringify'](_0x35e3e8)));};}function getSeconds(_0x1b146a,_0x2ac09c){var _0x145eda=moment(_0x1b146a)[_0x74d3('0x44')](0x0);var _0x40ee37=moment(_0x2ac09c)[_0x74d3('0x44')](0x0);return _0x145eda['diff'](_0x40ee37,_0x74d3('0x45'));}function emit(_0x2206aa,_0x5ba530,_0x2cc0fb){io['to'](_0x2206aa)['emit'](_0x5ba530,_0x2cc0fb);}function emitVoiceQueueSummary(_0x42fd2d){if(_0x42fd2d[_0x74d3('0x46')]===_0x74d3('0x47')){var _0x12629e={'id':_0x42fd2d['id'],'name':_0x42fd2d[_0x74d3('0x40')],'strategy':_0x42fd2d[_0x74d3('0x48')],'answered':_0x42fd2d[_0x74d3('0x49')],'available':_0x42fd2d[_0x74d3('0x4a')],'loggedIn':_0x42fd2d['loggedIn'],'pTalking':_0x42fd2d[_0x74d3('0x4b')],'sumBillable':_0x42fd2d[_0x74d3('0x4c')],'sumDuration':_0x42fd2d[_0x74d3('0x4d')],'sumHoldTime':_0x42fd2d[_0x74d3('0x4e')]||0x0,'talking':_0x42fd2d[_0x74d3('0x4f')],'total':_0x42fd2d[_0x74d3('0x50')],'type':_0x42fd2d[_0x74d3('0x46')],'unmanaged':_0x42fd2d[_0x74d3('0x51')],'abandoned':_0x42fd2d[_0x74d3('0x52')],'waiting':_0x42fd2d['waiting'],'loggedInDb':_0x42fd2d[_0x74d3('0x53')],'dialActive':_0x42fd2d[_0x74d3('0x54')],'dialMethod':_0x42fd2d[_0x74d3('0x55')],'dialOriginateCallerIdName':_0x42fd2d[_0x74d3('0x56')],'dialOriginateCallerIdNumber':_0x42fd2d[_0x74d3('0x57')],'dialOriginateTimeout':_0x42fd2d['dialOriginateTimeout'],'dialPrefix':_0x42fd2d[_0x74d3('0x58')],'outboundAnswerAgiCallsDay':_0x42fd2d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x42fd2d['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x42fd2d[_0x74d3('0x59')],'outboundBusyCallsDay':_0x42fd2d[_0x74d3('0x5a')],'outboundCongestionCallsDay':_0x42fd2d[_0x74d3('0x5b')],'outboundDropCallsDayACS':_0x42fd2d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x42fd2d[_0x74d3('0x5c')],'outboundDropCallsDayTimeout':_0x42fd2d[_0x74d3('0x5d')],'outboundNoAnswerCallsDay':_0x42fd2d[_0x74d3('0x5e')],'outboundNoSuchCallsDay':_0x42fd2d[_0x74d3('0x5f')],'outboundOriginateFailureCallsDay':_0x42fd2d[_0x74d3('0x60')],'outboundReCallsDay':_0x42fd2d['outboundReCallsDay'],'outboundRejectCallsDay':_0x42fd2d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x42fd2d['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x42fd2d[_0x74d3('0x61')],'predictiveIntervalAvgHoldtime':_0x42fd2d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x42fd2d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x42fd2d[_0x74d3('0x62')],'predictiveIntervalDroppedCallsTimeout':_0x42fd2d['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x42fd2d[_0x74d3('0x63')],'predictiveIntervalErlangCallsDroppedCalls':_0x42fd2d[_0x74d3('0x64')],'predictiveIntervalHitRate':_0x42fd2d[_0x74d3('0x65')],'predictiveIntervalMultiplicativeFactor':_0x42fd2d[_0x74d3('0x66')],'predictiveIntervalPauses':_0x42fd2d[_0x74d3('0x67')],'predictiveIntervalAvailable':_0x42fd2d[_0x74d3('0x68')],'predictiveIntervalTotalCalls':_0x42fd2d[_0x74d3('0x69')],'message':_0x42fd2d[_0x74d3('0x3b')],'originated':_0x42fd2d['originated'],'erlangCalls':_0x42fd2d[_0x74d3('0x6a')],'erlangCallToSecond':_0x42fd2d[_0x74d3('0x6b')],'erlangAbandonmentRate':_0x42fd2d[_0x74d3('0x6c')],'erlangBusyFactor':_0x42fd2d[_0x74d3('0x6d')],'startPredictive':_0x42fd2d['startPredictive'],'startProgressive':_0x42fd2d[_0x74d3('0x28')]};if(_0x42fd2d[_0x74d3('0x6e')]){_0x12629e['Trunk']={'id':_0x42fd2d['Trunk']['id'],'name':_0x42fd2d[_0x74d3('0x6e')]['name'],'active':_0x42fd2d['Trunk'][_0x74d3('0x6f')],'callerid':_0x42fd2d[_0x74d3('0x6e')][_0x74d3('0x70')]};}if(_0x42fd2d[_0x74d3('0x3e')]){_0x12629e['Interval']={'id':_0x42fd2d['Interval']['id'],'name':_0x42fd2d[_0x74d3('0x3e')][_0x74d3('0x40')]};}var _0x339335=md5(JSON[_0x74d3('0x71')](_0x12629e));if(_0x42fd2d[_0x74d3('0x72')]!==_0x339335){_0x42fd2d['md5']=_0x339335;emit(util[_0x74d3('0x73')](_0x74d3('0x74'),_0x12629e[_0x74d3('0x40')]),_0x74d3('0x75'),_0x12629e);}}}function emitCampaignSummary(_0x1d22ac){if(_0x1d22ac[_0x74d3('0x46')]===_0x74d3('0x76')){emit(util[_0x74d3('0x73')](_0x74d3('0x77'),_0x1d22ac['name']),_0x74d3('0x78'),_0x1d22ac);}}function checkGetDataPredictive(_0x107229){if(isNotNull(_0x107229)&&!_[_0x74d3('0x79')](_0x107229)){loggerPredictive['info'](_0x74d3('0x7a'));loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x7c'),_0x107229[_0x74d3('0x69')]);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x7d'),_0x107229[_0x74d3('0x61')]);loggerPredictive['info'](_0x74d3('0x7e'),_0x107229['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x7f'),_0x107229['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x80'),_0x107229[_0x74d3('0x81')]);loggerPredictive['info'](_0x74d3('0x82'),_0x107229[_0x74d3('0x83')]);loggerPredictive['info'](_0x74d3('0x84'));if(_0x107229[_0x74d3('0x69')]>0x0){if(!_['isUndefined'](_0x107229['predictiveIntervalAvgTalktime'])&&_0x107229[_0x74d3('0x83')]>0x0){return!![];}loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x85'));if(!_[_0x74d3('0x86')](_0x107229['predictiveIntervalAvgHoldtime'])&&_0x107229['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x87'));}}else{loggerPredictive['info'](_0x74d3('0x88'));}return![];}function mergeDataErlangB(_0x45b0a8){return function(_0x169e00){loggerPredictive['info'](_0x74d3('0x89'));loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x8a'),_0x169e00['erlangCalls']);loggerPredictive['info'](_0x74d3('0x8b'),_0x169e00[_0x74d3('0x6b')]);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x8c'),_0x169e00[_0x74d3('0x6c')]);loggerPredictive[_0x74d3('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x169e00[_0x74d3('0x6d')]);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x8c'),_0x169e00[_0x74d3('0x6c')]);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x84'));_[_0x74d3('0x8d')](_0x45b0a8,_0x169e00);};}function getDiff(_0x38c6b7){var _0xb7fb5b=moment()['milliseconds'](0x0);var _0x1f5dbe=moment(_0x38c6b7)[_0x74d3('0x44')](0x0);return _0xb7fb5b[_0x74d3('0x8e')](_0x1f5dbe,_0x74d3('0x45'));}function ifInterval(_0x475442,_0x5c3e90){if(_[_0x74d3('0x86')](_0x5c3e90)){return![];}return getDiff(_0x5c3e90)<_0x475442*0x3c;}function freeVariablesPredictive(_0x4d8eec){if(isNotNull(_0x4d8eec)){if(!_[_0x74d3('0x86')](_0x4d8eec[_0x74d3('0x28')])){_0x4d8eec['startProgressive']=undefined;loggerPredictive['info'](_0x4d8eec[_0x74d3('0x40')],_0x74d3('0x8f'));}if(!_[_0x74d3('0x86')](_0x4d8eec[_0x74d3('0x90')])){_0x4d8eec[_0x74d3('0x90')]=undefined;loggerPredictive[_0x74d3('0x7b')](_0x4d8eec['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x74d3('0x86')](_0x4d8eec['handlePredictive'])){clearInterval(_0x4d8eec[_0x74d3('0x91')]);_0x4d8eec[_0x74d3('0x91')]=undefined;loggerPredictive[_0x74d3('0x7b')](_0x4d8eec[_0x74d3('0x40')],_0x74d3('0x92'));}}}function erlangb(_0x155dbe,_0xff1940){if(_0xff1940===0x0){return 0x0;}var _0x4f9561=0x1;for(var _0xc124a3=0x1;_0xc124a3<=_0xff1940;_0xc124a3+=0x1){_0x4f9561=0x1+_0x4f9561*_0xc124a3/_0x155dbe;}return 0x1/_0x4f9561;}function isVoiceQueueOutbound(_0xc3f1ea){return _0xc3f1ea===_0x74d3('0x47');}function isNotPreview(_0x732e09){return _0x732e09!=='preview';}function isCampaignIvr(_0x1753c6){return _0x1753c6===_0x74d3('0x76');}function getCallerId(_0x6ede80,_0x9f2304,_0x2dc99f){if(!_[_0x74d3('0x86')](_0x2dc99f)&&typeof _0x2dc99f===_0x74d3('0x93')&&!_[_0x74d3('0x79')](_0x2dc99f)){if(!_[_0x74d3('0x86')](_0x9f2304)&&typeof _0x9f2304===_0x74d3('0x93')&&!_['isEmpty'](_0x9f2304)){return util[_0x74d3('0x73')](_0x74d3('0x94'),_0x9f2304,_0x2dc99f);}return util[_0x74d3('0x73')](_0x74d3('0x94'),_0x2dc99f,_0x2dc99f);}if(!_[_0x74d3('0x86')](_0x6ede80)&&typeof _0x6ede80===_0x74d3('0x93')&&!_['isEmpty'](_0x6ede80)){return _0x6ede80;}return _0x74d3('0x95');}function loggerCatchQueueSummary(_0x34cfcd,_0x3de3fc){return function(_0x15577a){freeVariablesPredictive(_0x3de3fc);emitVoiceQueueSummary(_0x3de3fc);emitCampaignSummary(_0x3de3fc);loggerSyncQueueSummary[_0x74d3('0x96')](_0x34cfcd,util['inspect'](_0x15577a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4a7f3a,_0x57b5ea){return function(_0x14785c){loggerPredictive[_0x74d3('0x96')](_0x57b5ea[_0x74d3('0x40')],_0x4a7f3a);loggerPredictive[_0x74d3('0x96')](_0x14785c[_0x74d3('0x97')]);freeVariablesPredictive(_0x57b5ea);};}function loggerCatch(_0x1f8f13){return function(_0x3b529e){logger['error'](_0x1f8f13,util['inspect'](_0x3b529e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x12cab0){return _0x12cab0&&!_[_0x74d3('0x86')](_0x12cab0)&&_0x12cab0[_0x74d3('0x98')]>0x0;}function decremetOriginate(_0x182678){if(!_[_0x74d3('0x86')](_0x182678)&&_0x182678!==null){if(typeof _0x182678[_0x74d3('0x99')]!==_0x74d3('0x9a')){if(_0x182678[_0x74d3('0x99')]>0x0){_0x182678[_0x74d3('0x99')]-=0x1;}else{logger[_0x74d3('0x96')](_0x74d3('0x9b'));}}}else{logger[_0x74d3('0x96')](_0x74d3('0x9c'));}}function checkContactLowerLimitOriginate(_0x3cf0f7,_0x2f1aa9,_0x2b2a9b){if(_0x2f1aa9>_0x2b2a9b){for(var _0x45f92c=0x0;_0x45f92c<_0x2f1aa9-_0x2b2a9b;_0x45f92c+=0x1){decremetOriginate(_0x3cf0f7);}}}function loggerGetContactDialer(_0x177137,_0x4e30be,_0x3ecd46){return function(_0x1a2d5c){checkContactLowerLimitOriginate(_0x4e30be,_0x3ecd46,0x0);logger[_0x74d3('0x96')](_0x177137,util['inspect'](_0x1a2d5c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1353c2){return function(_0x315491){if(isNotNull(_0x315491)&&isNotNull(_0x315491[0x0])){if(_0x315491[0x0]['contactsRescheduled']>0x0){_0x1353c2['message']=_0x74d3('0x9d');logger[_0x74d3('0x7b')](_0x74d3('0x9e')+_0x1353c2[_0x74d3('0x40')],_0x315491[0x0][_0x74d3('0x9f')],_0x74d3('0xa0'));}else{_0x1353c2[_0x74d3('0x3b')]=_0x74d3('0xa1');logger[_0x74d3('0x7b')]('[getContactDialer2][Empty]'+_0x1353c2[_0x74d3('0x40')]);}}};}function notSendMessagesQueue(_0x280aea){if(_0x280aea[_0x74d3('0xa2')]){freeVariablesPredictive(_0x280aea);if(_0x280aea[_0x74d3('0x99')]===0x0&&_0x280aea[_0x74d3('0x4f')]===0x0&&_0x280aea[_0x74d3('0xa3')]===0x0&&(_0x280aea[_0x74d3('0x4b')]||0x0)===0x0){_0x280aea['sendMessageOneNotActive']=![];_0x280aea[_0x74d3('0x4a')]=0x0;_0x280aea[_0x74d3('0x3b')]=_0x74d3('0x3c');loggerSyncQueueSummary[_0x74d3('0x96')](_0x74d3('0xa4'),_0x280aea[_0x74d3('0x40')],_0x74d3('0xa5'));}else{_0x280aea['message']=_0x74d3('0xa6');loggerSyncQueueSummary[_0x74d3('0x96')](_0x74d3('0xa4'),_0x280aea['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x280aea);}}function notSendMessagesCampaign(_0x180fc8){if(_0x180fc8['sendMessageOneNotActive']){if(_0x180fc8[_0x74d3('0x99')]===0x0){_0x180fc8[_0x74d3('0xa2')]=![];_0x180fc8[_0x74d3('0x3b')]=_0x74d3('0x3c');loggerSyncQueueSummary[_0x74d3('0x96')](_0x74d3('0xa7'),_0x180fc8[_0x74d3('0x40')],_0x74d3('0xa5'));}else{_0x180fc8[_0x74d3('0x3b')]=_0x74d3('0xa6');loggerSyncQueueSummary[_0x74d3('0x96')](_0x74d3('0xa7'),_0x180fc8[_0x74d3('0x40')],_0x74d3('0xa8'));}emitCampaignSummary(_0x180fc8);}}function createObjHistory(_0x91cce8,_0x2a9ca4,_0x1045ca,_0x1390a0,_0x1be784){_0x91cce8['message']=_0x1045ca;var _0x4c8dae=new Action(_0x91cce8,_0x2a9ca4);var _0x18dd2c=new History(_0x4c8dae);_0x18dd2c[_0x74d3('0xa9')]=_0x1390a0;_0x18dd2c[_0x74d3('0xaa')]=_0x1be784;_0x18dd2c[_0x74d3('0xab')]=_0x4c8dae[_0x74d3('0xac')];return _0x18dd2c;}Dialer[_0x74d3('0x1d')][_0x74d3('0x39')]=function(){var _0x29b5f3=this;setInterval(function(){_0x29b5f3[_0x74d3('0xad')](_0x29b5f3['uniqueId'],_0x74d3('0xae'));_0x29b5f3[_0x74d3('0xad')](_0x29b5f3[_0x74d3('0xaf')],_0x74d3('0xb0'));},0x32c8);};Dialer[_0x74d3('0x1d')][_0x74d3('0xad')]=function(_0x21fd55,_0x3b8e66){var _0x53cd8d=this;for(var _0x551367 in _0x21fd55){if(typeof _0x21fd55[_0x551367]!=='undefined'){this[_0x74d3('0xb1')][_0x74d3('0x1e')](function(){if(!_['isNil'](_0x21fd55[_0x551367])){return ami[_0x74d3('0xb2')]({'action':'status','channel':_0x21fd55[_0x551367][_0x74d3('0xb3')]})[_0x74d3('0xb4')](function(_0xc231ea){if(_0xc231ea['message']===_0x74d3('0xb5')){setTimeout(function(){if(_0x21fd55[_0x551367]&&_0x21fd55[_0x551367][_0x74d3('0x46')]!==_0x74d3('0x76')){_0x53cd8d[_0x74d3('0xb6')](_0x53cd8d[_0x74d3('0x21')][_0x21fd55[_0x551367][_0x74d3('0xb7')]]);logger[_0x74d3('0x96')]('[Dialer][checkChannel]',_0x3b8e66,_0x551367,_0x21fd55[_0x551367][_0x74d3('0xb7')]);delete _0x21fd55[_0x551367];}if(_0x21fd55[_0x551367]&&_0x21fd55[_0x551367][_0x74d3('0x46')]==='ivr'){_0x53cd8d[_0x74d3('0xb6')](_0x53cd8d[_0x74d3('0x22')][_0x21fd55[_0x551367]['queue']]);logger[_0x74d3('0x96')](_0x74d3('0xb8'),_0x3b8e66,_0x551367,_0x21fd55[_0x551367][_0x74d3('0xb7')]);delete _0x21fd55[_0x551367];}},0x2328);}});}});}}};Dialer['prototype'][_0x74d3('0xb9')]=function(_0x35f592){return BPromise[_0x74d3('0xba')]()['then'](cmHopper['countReScheduled'](_0x35f592))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xbb')));};Dialer[_0x74d3('0x1d')][_0x74d3('0xbc')]=function(_0x5a7c80){return BPromise[_0x74d3('0xba')]()['then'](cmHopperBlack[_0x74d3('0xbc')](_0x5a7c80))[_0x74d3('0xb4')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x74d3('0x1d')][_0x74d3('0xbd')]=function(_0x430bb2){return BPromise['resolve']()[_0x74d3('0xbe')](cmHopperBlack[_0x74d3('0xbd')](_0x430bb2))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xbf')));};Dialer[_0x74d3('0x1d')][_0x74d3('0xc0')]=function(_0x4d136b){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](cmHopperHistory['avgHandleTime'](_0x4d136b))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xc1')));};Dialer[_0x74d3('0x1d')][_0x74d3('0xc2')]=function(_0x5e2cbc){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](cmHopper['rescheduleContact'](_0x5e2cbc))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xc3')));};Dialer[_0x74d3('0x1d')][_0x74d3('0xc4')]=function(_0x47d1d0,_0x1aa829,_0x10b026){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](cmHopper[_0x74d3('0xc4')](_0x47d1d0,_0x1aa829,_0x10b026))[_0x74d3('0xb4')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x74d3('0x1d')][_0x74d3('0xc5')]=function(_0x246598,_0x4dff38,_0x33082d,_0x326003){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](cmHopper[_0x74d3('0xc5')](_0x246598,_0x4dff38,_0x33082d,_0x326003))[_0x74d3('0xb4')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x74d3('0x1d')][_0x74d3('0xc6')]=function(_0x39cb2d,_0xff6043,_0x39473e){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](cmHopper[_0x74d3('0xc6')](_0x39cb2d,_0xff6043,_0x39473e))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xc7')));};Dialer[_0x74d3('0x1d')]['getVoiceQueueRtPauses']=function(_0x2c8234){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](voiceQueueRt[_0x74d3('0xc8')](_0x2c8234))[_0x74d3('0xb4')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x74d3('0x1d')][_0x74d3('0xc9')]=function(_0xc3817a){return BPromise['resolve']()['then'](cmHopper[_0x74d3('0xc9')](_0xc3817a))[_0x74d3('0xb4')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x74d3('0x1d')][_0x74d3('0xca')]=function(_0x1e9d94){return BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](cmHopperHistory['createHistory'](_0x1e9d94))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0x74d3('0x1d')][_0x74d3('0xb6')]=function(_0x31d8c1){if(!_[_0x74d3('0x86')](_0x31d8c1)&&_0x31d8c1!==null){if(typeof _0x31d8c1[_0x74d3('0x99')]!==_0x74d3('0x9a')){if(_0x31d8c1['originated']>0x0){_0x31d8c1['originated']-=0x1;}else{logger[_0x74d3('0x96')](_0x74d3('0xcb'));}}}else{logger[_0x74d3('0x96')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x74d3('0x1d')]['loggerHandler']=function(_0x4c7ad4,_0x4d229e){var _0x1b9b45=this;return function(_0x20d4ce){_0x1b9b45[_0x74d3('0xb6')](_0x4d229e);logger['error'](_0x4c7ad4,util[_0x74d3('0xcc')](_0x20d4ce,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x74d3('0xcd')]=function(_0xb548a2,_0x3a440a,_0x307cdf){var _0x328e9a={'state':0x19,'statedesc':_0x74d3('0xce')};this[_0x74d3('0xb6')](_0x3a440a);this[_0x74d3('0xcf')](_[_0x74d3('0x8d')](_0x328e9a,_[_0x74d3('0xd0')](_0x307cdf,[_0x74d3('0xd1'),_0x74d3('0xd2'),_0x74d3('0xd3'),_0x74d3('0xd4'),_0x74d3('0xd5')])),_0x74d3('0xd6'),_0x74d3('0xd7'));logger['error'](_0xb548a2);};Dialer['prototype'][_0x74d3('0xd8')]=function(_0x515357){return _0x515357===_0x74d3('0xd9');};Dialer[_0x74d3('0x1d')]['isTrunkReachable']=function(_0x2f39aa){return!_[_0x74d3('0x86')](_0x2f39aa)&&_0x2f39aa&&!_[_0x74d3('0x86')](_0x2f39aa[_0x74d3('0x40')])&&!_[_0x74d3('0x86')](_0x2f39aa[_0x74d3('0x6f')])&&_0x2f39aa['active']&&(this[_0x74d3('0x24')][util[_0x74d3('0x73')]('SIP/%s',_0x2f39aa[_0x74d3('0x40')])]['status']==='reachable'||this[_0x74d3('0x24')][util[_0x74d3('0x73')](_0x74d3('0xda'),_0x2f39aa[_0x74d3('0x40')])][_0x74d3('0xdb')]==='unmonitored');};Dialer[_0x74d3('0x1d')][_0x74d3('0xcf')]=function(_0x5befcf,_0x22fe19,_0x2cd432){this[_0x74d3('0xca')](_0x5befcf)[_0x74d3('0xb4')](loggerCatch(_0x22fe19));this[_0x74d3('0xc9')](_0x5befcf)[_0x74d3('0xb4')](loggerCatch(_0x2cd432));};Dialer[_0x74d3('0x1d')][_0x74d3('0x36')]=function(_0x1e7283){var _0xec95a1=this[_0x74d3('0xdc')][_0x1e7283[_0x74d3('0xdd')]];var _0x26cbb6;if(!_[_0x74d3('0xde')](_0x1e7283)&&!_[_0x74d3('0xde')](_0x1e7283[_0x74d3('0xdf')])&&!_['isNil'](_0x1e7283['variable'][_0x74d3('0xe0')])&&_0x1e7283[_0x74d3('0xe1')]===_0x74d3('0xe2')&&_0xec95a1){if(_0xec95a1[_0x74d3('0x46')]!==_0x74d3('0x76')&&this[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xe3')]&&_0x1e7283[_0x74d3('0xe4')]===_0x74d3('0xe5')){delete this[_0x74d3('0xdc')][_0x1e7283[_0x74d3('0xdd')]];this['updateOriginated'](this[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]]);this[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xe6')]+=0x1;_0x26cbb6=new Hangup(_0xec95a1,_0x1e7283);_0x26cbb6['state']=0x12;_0x26cbb6[_0x74d3('0xaa')]='HangupInAMD';_0x26cbb6[_0x74d3('0xe7')]=_0x74d3('0xe8');this['saveInDb'](_0x26cbb6,_0x74d3('0xe9'),_0x74d3('0xea'));}if(_0xec95a1[_0x74d3('0x46')]!==_0x74d3('0x76')&&this['voiceQueues'][_0xec95a1[_0x74d3('0xb7')]]['dialAMDActive']&&_0x1e7283[_0x74d3('0xe4')]===_0x74d3('0xeb')){var _0x5d1438=this;return new BPromise(function(_0x8ba984,_0x6f5ad){delete _0x5d1438[_0x74d3('0xdc')][_0x1e7283[_0x74d3('0xdd')]];_0x5d1438[_0x74d3('0xb6')](_0x5d1438[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]]);_0x5d1438[_0x74d3('0x21')][_0xec95a1['queue']][_0x74d3('0xec')]+=0x1;_0x5d1438[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xe6')]+=0x1;var _0x3175cd=_0x5d1438[_0x74d3('0x21')][_0xec95a1[_0x74d3('0xb7')]];var _0xcedc3a=new Hangup(_0xec95a1,_0x1e7283);_0xcedc3a[_0x74d3('0xa9')]=0x13;_0xcedc3a['statedesc']=_0x74d3('0xed');_0xcedc3a[_0x74d3('0xe7')]=_0x74d3('0xe8');_0xcedc3a[_0x74d3('0xee')]+=0x1;_0xcedc3a['countglobal']+=0x1;_0xcedc3a[_0x74d3('0xef')]=!![];_0x5d1438[_0x74d3('0xca')](_0xcedc3a)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xf0')));if(_0xcedc3a['countbusyretry']+_0xcedc3a[_0x74d3('0xf1')]+_0xcedc3a[_0x74d3('0xf2')]+_0xcedc3a[_0x74d3('0xf3')]+_0xcedc3a[_0x74d3('0xf4')]+_0xcedc3a['countabandonedretry']+_0xcedc3a['countmachineretry']+_0xcedc3a[_0x74d3('0xf5')]>=_0x3175cd['dialGlobalMaxRetry']){_0x5d1438[_0x74d3('0xf6')](_0xcedc3a,_0x8ba984,_0x6f5ad,_0x74d3('0xf7'));}else{if(_0xcedc3a['countmachineretry']>=_0x3175cd[_0x74d3('0xf8')]){_0x5d1438[_0x74d3('0xf9')](_0xcedc3a,_0x8ba984,_0x6f5ad,_0x74d3('0xfa'));}else{_0x5d1438[_0x74d3('0xc2')]({'active':![],'countmachineretry':_0xcedc3a['countmachineretry'],'scheduledat':moment()['add'](_0x3175cd[_0x74d3('0xfb')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0xcedc3a[_0x74d3('0xd1')],'ListId':_0xcedc3a[_0x74d3('0xd2')],'VoiceQueueId':_0xcedc3a[_0x74d3('0xd4')]||undefined,'CampaignId':_0xcedc3a[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xfe')));_0x8ba984({'reschedule':0x1});}}});}if(_0xec95a1[_0x74d3('0x46')]===_0x74d3('0x76')&&this['campaigns'][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xe3')]&&_0x1e7283[_0x74d3('0xe4')]===_0x74d3('0xe5')){delete this[_0x74d3('0xdc')][_0x1e7283[_0x74d3('0xdd')]];this[_0x74d3('0xb6')](this[_0x74d3('0x22')][_0xec95a1[_0x74d3('0xb7')]]);_0x26cbb6=new Hangup(_0xec95a1,_0x1e7283);_0x26cbb6[_0x74d3('0xa9')]=0x12;_0x26cbb6[_0x74d3('0xaa')]=_0x74d3('0xff');_0x26cbb6['membername']=_0x74d3('0xe8');this[_0x74d3('0xcf')](_0x26cbb6,_0x74d3('0x100'),_0x74d3('0x101'));}if(_0xec95a1[_0x74d3('0x46')]===_0x74d3('0x76')&&this[_0x74d3('0x22')][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xe3')]&&_0x1e7283[_0x74d3('0xe4')]==='MACHINE'){var _0x5d1438=this;return new BPromise(function(_0x57346c,_0x95def2){delete _0x5d1438['uniqueId'][_0x1e7283[_0x74d3('0xdd')]];_0x5d1438[_0x74d3('0xb6')](_0x5d1438[_0x74d3('0x22')][_0xec95a1[_0x74d3('0xb7')]]);_0x5d1438['campaigns'][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xec')]+=0x1;_0x5d1438[_0x74d3('0x22')][_0xec95a1[_0x74d3('0xb7')]][_0x74d3('0xe6')]+=0x1;var _0x5d6efe=_0x5d1438[_0x74d3('0x22')][_0xec95a1[_0x74d3('0xb7')]];var _0x4df366=new Hangup(_0xec95a1,_0x1e7283);_0x4df366[_0x74d3('0xa9')]=0x13;_0x4df366['statedesc']=_0x74d3('0xed');_0x4df366['membername']=_0x74d3('0xe8');_0x4df366['countmachineretry']+=0x1;_0x4df366[_0x74d3('0x102')]+=0x1;_0x4df366[_0x74d3('0xef')]=!![];_0x5d1438[_0x74d3('0xca')](_0x4df366)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xf0')));if(_0x4df366[_0x74d3('0x103')]+_0x4df366[_0x74d3('0xf1')]+_0x4df366['countnoanswerretry']+_0x4df366[_0x74d3('0xf3')]+_0x4df366['countdropretry']+_0x4df366[_0x74d3('0x104')]+_0x4df366[_0x74d3('0xee')]+_0x4df366['countagentrejectretry']>=_0x5d6efe[_0x74d3('0x105')]){_0x5d1438[_0x74d3('0xf6')](_0x4df366,_0x57346c,_0x95def2,'reason19\x20machine....');}else{if(_0x4df366[_0x74d3('0xee')]>=_0x5d6efe[_0x74d3('0xf8')]){_0x5d1438[_0x74d3('0xf9')](_0x4df366,_0x57346c,_0x95def2,_0x74d3('0xfa'));}else{_0x5d1438[_0x74d3('0xc2')]({'active':![],'countmachineretry':_0x4df366[_0x74d3('0xee')],'scheduledat':moment()[_0x74d3('0x106')](_0x5d6efe[_0x74d3('0xfb')],_0x74d3('0xfc'))['format'](_0x74d3('0xfd')),'ContactId':_0x4df366[_0x74d3('0xd1')],'ListId':_0x4df366[_0x74d3('0xd2')],'VoiceQueueId':_0x4df366[_0x74d3('0xd4')]||undefined,'CampaignId':_0x4df366[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch('[rescheduleContact][Machine]'));_0x57346c({'reschedule':0x1});}}});}}};Dialer[_0x74d3('0x1d')][_0x74d3('0x107')]=function(_0x7d292c){var _0x81a83f=this['uniqueId'][_0x7d292c[_0x74d3('0xdd')]];var _0x4845a2=this;var _0x5a611a;if(_0x81a83f&&_0x81a83f[_0x74d3('0x46')]===_0x74d3('0x76')){delete this[_0x74d3('0xdc')][_0x7d292c[_0x74d3('0xdd')]];this[_0x74d3('0xb6')](this[_0x74d3('0x22')][_0x81a83f[_0x74d3('0xb7')]]);this[_0x74d3('0x22')][_0x81a83f[_0x74d3('0xb7')]][_0x74d3('0x108')]+=0x1;_0x5a611a=new Hangup(_0x81a83f,_0x7d292c);this[_0x74d3('0xca')](_0x5a611a)[_0x74d3('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x5a611a)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x109')));}if(_0x81a83f&&_0x81a83f[_0x74d3('0x46')]!==_0x74d3('0x76')&&isNotNull(this[_0x74d3('0x21')][_0x81a83f[_0x74d3('0xb7')]][_0x74d3('0x10a')])){delete this['uniqueId'][_0x7d292c['uniqueid']];this[_0x74d3('0xb6')](this[_0x74d3('0x21')][_0x81a83f[_0x74d3('0xb7')]]);this['voiceQueues'][_0x81a83f[_0x74d3('0xb7')]][_0x74d3('0xec')]+=0x1;this[_0x74d3('0x21')][_0x81a83f['queue']][_0x74d3('0xe6')]+=0x1;_0x5a611a=new Hangup(_0x81a83f,_0x7d292c);_0x5a611a[_0x74d3('0xa9')]=0x10;_0x5a611a[_0x74d3('0xaa')]=_0x74d3('0x10b');_0x5a611a[_0x74d3('0xe7')]=_0x74d3('0x10c');this[_0x74d3('0xca')](_0x5a611a)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x10d')));this[_0x74d3('0xc9')](_0x5a611a)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x109')));}if(_0x81a83f&&_0x81a83f[_0x74d3('0x46')]!=='ivr'&&!isNotNull(this[_0x74d3('0x21')][_0x81a83f['queue']][_0x74d3('0x10a')])){delete this[_0x74d3('0xdc')][_0x7d292c['uniqueid']];this[_0x74d3('0xb6')](this['voiceQueues'][_0x81a83f[_0x74d3('0xb7')]]);this[_0x74d3('0x21')][_0x81a83f[_0x74d3('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x5a611a=new Hangup(_0x81a83f,_0x7d292c);_0x5a611a[_0x74d3('0xa9')]=0xc;_0x5a611a[_0x74d3('0xaa')]=_0x7d292c['cause-txt'];_0x5a611a[_0x74d3('0xe7')]=_0x74d3('0x10e');this[_0x74d3('0xca')](_0x5a611a)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x10d')));this[_0x74d3('0xc9')](_0x5a611a)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x109')));}};Dialer[_0x74d3('0x1d')]['syncAgentComplete']=function(_0x2e7c5c){var _0x963ffd=this[_0x74d3('0xdc')][_0x2e7c5c[_0x74d3('0xdd')]];var _0x3089a4=this;if(this[_0x74d3('0x21')][_0x2e7c5c[_0x74d3('0xb7')]]){if(_0x963ffd&&_0x963ffd['type']!==_0x74d3('0x76')){delete this[_0x74d3('0xdc')][_0x2e7c5c[_0x74d3('0xdd')]];this[_0x74d3('0x21')][_0x2e7c5c[_0x74d3('0xb7')]][_0x74d3('0xec')]+=0x1;var _0x4eee0=new AgentComplete(_0x963ffd,_0x2e7c5c);if(_0x2e7c5c['reason']===_0x74d3('0x10f')){_0x4eee0[_0x74d3('0x110')]=this['voiceQueues'][_0x2e7c5c[_0x74d3('0xb7')]][_0x74d3('0x111')]&&this[_0x74d3('0x21')][_0x2e7c5c[_0x74d3('0xb7')]][_0x74d3('0x112')]?moment()['format'](_0x74d3('0xfd')):undefined;}this[_0x74d3('0xca')](_0x4eee0)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x113')));this[_0x74d3('0xc9')](_0x4eee0)['catch'](loggerCatch(_0x74d3('0x114')));}}};Dialer[_0x74d3('0x1d')][_0x74d3('0x2a')]=function(_0x3ef882){if(this[_0x74d3('0x21')][_0x3ef882[_0x74d3('0xb7')]]){if(this[_0x74d3('0xdc')][_0x3ef882[_0x74d3('0xdd')]]&&this[_0x74d3('0xdc')][_0x3ef882[_0x74d3('0xdd')]][_0x74d3('0x46')]!==_0x74d3('0x76')){this['updateOriginated'](this[_0x74d3('0x21')][_0x3ef882[_0x74d3('0xb7')]]);this[_0x74d3('0xdc')][_0x3ef882['uniqueid']]['answertime']=moment()['format'](_0x74d3('0xfd'));}}};Dialer[_0x74d3('0x1d')][_0x74d3('0x115')]=function(_0x39eac4){this[_0x74d3('0xca')](_0x39eac4)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x113')));this[_0x74d3('0xc9')](_0x39eac4)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x116')));};Dialer[_0x74d3('0x1d')][_0x74d3('0x2c')]=function(_0x30d369){var _0x2b41c6=this[_0x74d3('0xdc')][_0x30d369[_0x74d3('0xdd')]];var _0x4c1784=this;if(this[_0x74d3('0x21')][_0x30d369['queue']]){if(_0x2b41c6&&_0x2b41c6[_0x74d3('0x46')]!==_0x74d3('0x76')){delete this[_0x74d3('0xdc')][_0x30d369['uniqueid']];this[_0x74d3('0xb6')](this[_0x74d3('0x21')][_0x30d369[_0x74d3('0xb7')]]);_0x2b41c6[_0x74d3('0x117')]=moment()[_0x74d3('0x73')](_0x74d3('0xfd'));var _0x55391b=new QueueCallerAbandon(_0x2b41c6,_0x30d369);if(getSeconds(_0x2b41c6['droptime'],_0x2b41c6[_0x74d3('0x118')])>=_0x2b41c6['dialQueueTimeout']){this[_0x74d3('0x21')][_0x30d369['queue']][_0x74d3('0x119')]+=0x1;this[_0x74d3('0x21')][_0x30d369['queue']][_0x74d3('0x5d')]+=0x1;this[_0x74d3('0x21')][_0x30d369[_0x74d3('0xb7')]][_0x74d3('0x64')]+=0x1;_0x55391b[_0x74d3('0xa9')]=0xa;_0x55391b['statedesc']=_0x74d3('0x11a');_0x55391b['dropreason']=_0x74d3('0x11b');_0x55391b[_0x74d3('0x110')]=this[_0x74d3('0x21')][_0x30d369[_0x74d3('0xb7')]]['dialQueueProject2']?moment()[_0x74d3('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x55391b[_0x74d3('0xf4')]+=0x1;_0x55391b['countglobal']+=0x1;if(_0x55391b[_0x74d3('0xf4')]>=this[_0x74d3('0x21')][_0x30d369[_0x74d3('0xb7')]]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x55391b);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x55391b[_0x74d3('0xf4')],'scheduledat':moment()[_0x74d3('0x106')](this[_0x74d3('0x21')][_0x30d369['queue']][_0x74d3('0x11c')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x2b41c6[_0x74d3('0xd1')],'ListId':_0x2b41c6['ListId'],'VoiceQueueId':_0x2b41c6[_0x74d3('0xd4')]||undefined,'CampaignId':_0x2b41c6[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x11d')));var _0x263a38=new History(_0x55391b);_0x263a38[_0x74d3('0xa9')]=0xa;_0x263a38[_0x74d3('0xaa')]=_0x74d3('0x11a');_0x263a38[_0x74d3('0xac')]=moment()['format'](_0x74d3('0xfd'));_0x263a38['endtime']=_0x263a38['starttime'];_0x263a38['calleridname']=_0x55391b[_0x74d3('0x11e')];_0x263a38['calleridnum']=_0x55391b[_0x74d3('0x11f')];this[_0x74d3('0xca')](_0x263a38)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x120')));}}else{this[_0x74d3('0x21')][_0x30d369[_0x74d3('0xb7')]][_0x74d3('0x62')]+=0x1;this[_0x74d3('0x21')][_0x30d369[_0x74d3('0xb7')]][_0x74d3('0x5c')]+=0x1;_0x55391b[_0x74d3('0xa9')]=0xb;_0x55391b['statedesc']=_0x74d3('0x121');_0x55391b[_0x74d3('0x122')]=_0x74d3('0x123');_0x55391b[_0x74d3('0x104')]+=0x1;_0x55391b['countglobal']+=0x1;if(_0x55391b[_0x74d3('0x104')]>=this['voiceQueues'][_0x30d369['queue']]['dialAbandonedMaxRetry']){this[_0x74d3('0x115')](_0x55391b);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x55391b[_0x74d3('0x104')],'scheduledat':moment()[_0x74d3('0x106')](this['voiceQueues'][_0x30d369[_0x74d3('0xb7')]][_0x74d3('0x124')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x2b41c6[_0x74d3('0xd1')],'ListId':_0x2b41c6[_0x74d3('0xd2')],'VoiceQueueId':_0x2b41c6['VoiceQueueId']||undefined,'CampaignId':_0x2b41c6[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x125')));var _0x263a38=new History(_0x55391b);_0x263a38[_0x74d3('0xa9')]=0xb;_0x263a38[_0x74d3('0xaa')]=_0x74d3('0x121');_0x263a38[_0x74d3('0xac')]=moment()[_0x74d3('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x263a38['endtime']=_0x263a38[_0x74d3('0xac')];_0x263a38[_0x74d3('0x11e')]=_0x55391b[_0x74d3('0x11e')];_0x263a38[_0x74d3('0x11f')]=_0x55391b[_0x74d3('0x11f')];this['createHistory'](_0x263a38)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x74d3('0x1d')][_0x74d3('0x34')]=function(_0x1ce29d){if(this['actions'][_0x1ce29d[_0x74d3('0xdd')]]){this[_0x74d3('0xaf')][_0x1ce29d['uniqueid']][_0x74d3('0xb3')]=_0x1ce29d[_0x74d3('0xb3')];}if(this[_0x74d3('0xdc')][_0x1ce29d['uniqueid']]){this[_0x74d3('0xdc')][_0x1ce29d['uniqueid']][_0x74d3('0xb3')]=_0x1ce29d[_0x74d3('0xb3')];}};Dialer['prototype'][_0x74d3('0x126')]=function(_0x3d9390){if(strategy[this[_0x74d3('0x21')][this[_0x74d3('0xaf')][_0x3d9390['actionid']][_0x74d3('0xb7')]][_0x74d3('0x48')]]===_0x74d3('0x1c')){if(this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]]&&_[_0x74d3('0xde')](this['actions'][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0x128')])&&_0x3d9390[_0x74d3('0xdb')]==='1'&&_0x3d9390[_0x74d3('0x129')]==='0'){if(this[_0x74d3('0x23')][_0x3d9390[_0x74d3('0x12a')]]){if(!this['agents'][_0x3d9390[_0x74d3('0x12a')]][_0x74d3('0x128')]){this[_0x74d3('0x23')][_0x3d9390[_0x74d3('0x12a')]]['locked']=!![];this['actions'][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0x128')]=!![];this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0x12a')]=_0x3d9390[_0x74d3('0x12a')];}}}}else if((strategy[this[_0x74d3('0x21')][this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0xb7')]][_0x74d3('0x48')]]||_0x74d3('0x1b'))==='rrmemory'){if(this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]]){if(this[_0x74d3('0x23')][_0x3d9390['stateinterface']]){this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0x12a')]=_0x3d9390[_0x74d3('0x12a')];if(_['isNil'](this['queueBooked'][this[_0x74d3('0xaf')][_0x3d9390['actionid']][_0x74d3('0xb7')]])){this['queueBooked'][this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0xb7')]]=[];}this[_0x74d3('0x12b')][this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]][_0x74d3('0xb7')]][_0x74d3('0x12c')](_[_0x74d3('0x8d')](_[_0x74d3('0xd0')](this[_0x74d3('0xaf')][_0x3d9390[_0x74d3('0x127')]],[_0x74d3('0x12d'),_0x74d3('0x12a')]),{'status':_0x3d9390['status'],'paused':_0x3d9390[_0x74d3('0x129')]}));}}}};function unlockQueueStatus(_0xf3528c,_0x1b6286){setTimeout(function(){if(_[_0x74d3('0x86')](_0xf3528c[_0x74d3('0x12e')])){loggerBooked[_0x74d3('0x96')](_0x74d3('0x12f'),_0x1b6286);}_0xf3528c['queueStatusComplete']=!![];loggerBooked[_0x74d3('0x7b')](_0x74d3('0x130'),_0x1b6286,JSON[_0x74d3('0x71')](_['pick'](_0xf3528c,['name',_0x74d3('0x12e')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x577a0d){var _0x3d2d9b=this;var _0x3f64a9=_0x3d2d9b[_0x74d3('0x21')][_0x3d2d9b[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]];if(strategy[this['voiceQueues'][this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]['strategy']]==='roundrobin'){if(this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]]&&this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]]['stateinterface']){this[_0x74d3('0x20')]['run'](this[_0x74d3('0xaf')][_0x577a0d['actionid']][_0x74d3('0x12d')],this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0x12a')])[_0x74d3('0xb4')](function(_0x550f60){logger[_0x74d3('0x96')](_0x74d3('0x131'),util[_0x74d3('0xcc')](_0x550f60,{'showHidden':![],'depth':null}));})[_0x74d3('0x132')](function(){_0x3d2d9b[_0x74d3('0xb6')](_0x3d2d9b[_0x74d3('0x21')][_0x3d2d9b[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]);_0x3d2d9b[_0x74d3('0x23')][_0x3d2d9b[_0x74d3('0xaf')][_0x577a0d['actionid']][_0x74d3('0x12a')]]['locked']=![];delete _0x3d2d9b[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]];unlockQueueStatus(_0x3f64a9);});}else{this[_0x74d3('0xb6')](this[_0x74d3('0x21')][this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]);this[_0x74d3('0xc2')]({'active':![],'ContactId':this['actions'][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xd1')],'ListId':this[_0x74d3('0xaf')][_0x577a0d['actionid']][_0x74d3('0xd2')],'VoiceQueueId':this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xd4')]||undefined,'CampaignId':this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x133')));delete this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]];unlockQueueStatus(_0x3f64a9);}}else if((strategy[this[_0x74d3('0x21')][this['actions'][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]['strategy']]||'rrmemory')===_0x74d3('0x1b')){var _0x5eb1c2;if(this['actions'][_0x577a0d[_0x74d3('0x127')]]&&!_[_0x74d3('0x79')](this[_0x74d3('0x12b')][this[_0x74d3('0xaf')][_0x577a0d['actionid']][_0x74d3('0xb7')]])){if(this['queueBookedRR'][_0x3d2d9b[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]){this[_0x74d3('0x134')][_0x3d2d9b[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]=this[_0x74d3('0x134')][this['actions'][_0x577a0d['actionid']]['queue']]?this[_0x74d3('0x134')][this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]:this[_0x74d3('0x12b')][this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]]?this[_0x74d3('0x12b')][this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]][_0x74d3('0x135')]||0x0:0x0;}this['queueBooked'][this[_0x74d3('0xaf')][_0x577a0d['actionid']][_0x74d3('0xb7')]]['_rr']=this[_0x74d3('0x134')][this[_0x74d3('0xaf')][_0x577a0d[_0x74d3('0x127')]][_0x74d3('0xb7')]];for(var _0x264aa2=0x0;_0x264aa2=0x0;})[_0x74d3('0xb4')](myreject(_0x2ba1d7)));}}else{_0x319b75[_0x74d3('0x12c')](ami[_0x74d3('0xb2')]({'action':_0x74d3('0x14e'),'command':util['format']('iftime\x20%s,%s',_0x27691e,!_[_0x74d3('0x86')](config[_0x74d3('0x151')][_0x43b672])?_0x43b672:'')})['then'](function(_0x1f4538){return _0x1f4538[_0x74d3('0x152')][_0x74d3('0x153')](_0x74d3('0x154'))>=0x0;})[_0x74d3('0xb4')](myreject(_0x2ba1d7)));}BPromise[_0x74d3('0x155')](_0x319b75)['then'](function(_0x1c6692){var _0x52b61d=_[_0x74d3('0x156')](_0x1c6692);if(_0x52b61d){return _0x5c2bc2(_0x52b61d);}else{_0xaefebf['message']=_0x1a61f7?_0x74d3('0x157'):_0x74d3('0x158');return _0x2ba1d7(msgResponse(_0x74d3('0x159'),_0x74d3('0x14a'),_0x74d3('0x15a')+_0x1a61f7+'\x20'+_0x3febbb+_0x74d3('0x15b')+util[_0x74d3('0xcc')](_0x27691e,{'showHidden':![],'depth':null})+_0x74d3('0x15c')+_0x43b672));}})[_0x74d3('0xb4')](function(_0x33afdc){return _0x2ba1d7(msgResponse('ifTime',_0x74d3('0x14a'),JSON['stringify'](_0x33afdc)));});});};Dialer[_0x74d3('0x1d')][_0x74d3('0x15d')]=function(_0xe30d9f){var _0x331f8c=this;return function(){switch(_0xe30d9f[_0x74d3('0x55')]){case'progressive':freeVariablesPredictive(_0xe30d9f);_0x331f8c['handlePower'](_0xe30d9f,0x1);break;case _0x74d3('0x15e'):freeVariablesPredictive(_0xe30d9f);_0x331f8c[_0x74d3('0x15f')](_0xe30d9f,_0xe30d9f[_0x74d3('0x160')]);break;case'predictive':_0x331f8c[_0x74d3('0xa')](_0xe30d9f);break;case _0x74d3('0x9'):freeVariablesPredictive(_0xe30d9f);_0x331f8c[_0x74d3('0x15f')](_0xe30d9f,0x1);break;default:freeVariablesPredictive(_0xe30d9f);logger[_0x74d3('0x96')](_0x74d3('0x161'),_0xe30d9f[_0x74d3('0x40')],_0x74d3('0x162'));}};};Dialer[_0x74d3('0x1d')][_0x74d3('0x163')]=function(_0x391551){var _0x15ea16=this;return function(){_0x15ea16[_0x74d3('0x164')](_0x391551);};};Dialer[_0x74d3('0x1d')][_0x74d3('0x165')]=function(_0x308c3d){var _0x44156d=this;if(isNotPreview(_0x308c3d['dialMethod'])){if(isVoiceQueueOutbound(_0x308c3d[_0x74d3('0x46')])&&isActive(_0x308c3d[_0x74d3('0x54')])){_0x308c3d['sendMessageOneNotActive']=!![];BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](checkIsLoggedIn(_0x308c3d,_0x308c3d[_0x74d3('0x166')]))[_0x74d3('0xbe')](checkIsActive(_0x308c3d,_0x308c3d[_0x74d3('0x54')]))[_0x74d3('0xbe')](checkInterval(_0x308c3d))['then'](_0x44156d[_0x74d3('0x167')](_0x308c3d))[_0x74d3('0xbe')](_0x44156d[_0x74d3('0x146')](_0x308c3d[_0x74d3('0x168')],_0x308c3d['dialTimezone'],_0x308c3d[_0x74d3('0x40')],_0x308c3d))['then'](_0x44156d[_0x74d3('0x148')](_0x308c3d[_0x74d3('0x3e')],_0x308c3d[_0x74d3('0x169')],_0x308c3d[_0x74d3('0x40')],_0x308c3d))[_0x74d3('0xbe')](_0x44156d[_0x74d3('0x15d')](_0x308c3d))[_0x74d3('0xb4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x308c3d));}else{notSendMessagesQueue(_0x308c3d);}}else{freeVariablesPredictive(_0x308c3d);}};Dialer[_0x74d3('0x1d')]['syncCampaigns']=function(){var _0x15f7c3=this;var _0x415e3c;for(var _0x15f571 in this[_0x74d3('0x22')]){if(typeof this[_0x74d3('0x22')][_0x15f571]!==_0x74d3('0x9a')){_0x415e3c=this[_0x74d3('0x22')][_0x15f571];if(isCampaignIvr(_0x415e3c['type'])&&isActive(_0x415e3c[_0x74d3('0x6f')])){_0x415e3c[_0x74d3('0xa2')]=!![];BPromise[_0x74d3('0xba')]()[_0x74d3('0xbe')](checkIsActive(_0x415e3c,_0x415e3c['active']))[_0x74d3('0xbe')](checkInterval(_0x415e3c))[_0x74d3('0xbe')](_0x15f7c3[_0x74d3('0x167')](_0x415e3c))[_0x74d3('0xbe')](_0x15f7c3[_0x74d3('0x146')](_0x415e3c[_0x74d3('0x168')],_0x415e3c[_0x74d3('0x169')],_0x415e3c[_0x74d3('0x40')],_0x415e3c))[_0x74d3('0xbe')](_0x15f7c3[_0x74d3('0x148')](_0x415e3c[_0x74d3('0x3e')],_0x415e3c[_0x74d3('0x169')],_0x415e3c[_0x74d3('0x40')],_0x415e3c))[_0x74d3('0xbe')](_0x15f7c3[_0x74d3('0x163')](_0x415e3c))['catch'](loggerCatchQueueSummary(_0x74d3('0x16a'),_0x415e3c));}else{notSendMessagesCampaign(_0x415e3c);}}}};function getCallerIdRandom(_0x1e510b,_0x260059){var _0x59d210;var _0x2cbade;var _0x47a775;if(_0x260059<=0x0){_0x260059=0x1;}_0x59d210=new RegExp(_0x74d3('0x16b')+_0x260059+'}$');_0x2cbade=Math[_0x74d3('0x16c')](0xa,_0x260059-0x1);_0x47a775=Math['pow'](0xa,_0x260059)-0x1;return util[_0x74d3('0x73')]('%s',_[_0x74d3('0x16d')](_0x1e510b,_0x59d210,_[_0x74d3('0x16e')](_0x2cbade,_0x47a775)));}function extractCalleridName(_0x22129f){var _0x301675=_0x22129f['match'](/"(.*?)"/);return _0x301675?_0x301675[0x1]:_0x22129f;}function extractCalleridNumber(_0x2f4af8){var _0x525739=_0x2f4af8['match'](/<(.*?)>/);return _0x525739?_0x525739[0x1]:_0x2f4af8;}Dialer[_0x74d3('0x1d')]['actionOriginate']=function(_0x4b3ea5,_0x51010c){var _0x1c61fa=this;var _0x3e213c=uuid['v4']();this[_0x74d3('0xaf')][_0x3e213c]=new Action(_0x4b3ea5,_0x51010c,_0x3e213c);return new BPromise(function(_0x5a7790,_0x3ba048){if(_[_0x74d3('0x86')](_0x4b3ea5)&&typeof _0x4b3ea5!==_0x74d3('0x16f')){return _0x3ba048(msgResponse(_0x74d3('0x170'),_0x74d3('0x14a'),_0x74d3('0x171')));}if(_[_0x74d3('0x86')](_0x51010c[_0x74d3('0x172')]['phone'])||_0x51010c[_0x74d3('0x172')]['phone']===null){return _0x3ba048(msgResponse(_0x74d3('0x170'),_0x74d3('0x14a'),_0x74d3('0x173')));}var _0xc0b180={'XMD-CALLERID':_0x1c61fa[_0x74d3('0xaf')][_0x3e213c][_0x74d3('0x174')](),'XMD-AGI':_0x4b3ea5[_0x74d3('0x10a')]?util['format'](_0x74d3('0x175'),ipAgi,_0x4b3ea5[_0x74d3('0x10a')]):_0x74d3('0x176'),'XMD-AGIAFTER':_0x4b3ea5['dialQueueProject2']?util['format'](_0x74d3('0x175'),ipAgi,_0x4b3ea5[_0x74d3('0x111')]):_0x74d3('0x176'),'XMD-QUEUE':_0x4b3ea5[_0x74d3('0x46')]===_0x74d3('0x47')?util[_0x74d3('0x73')](_0x74d3('0x177'),_0x4b3ea5[_0x74d3('0x40')],_0x4b3ea5['dialQueueOptions']||'',_0x4b3ea5[_0x74d3('0x112')]?'c':'',_0x4b3ea5[_0x74d3('0x178')]||0x3):_0x74d3('0x176'),'XMD-CONTACTID':_0x51010c[_0x74d3('0xd1')],'XMD-CDRTYPE':_0x74d3('0x8'),'CALLERID(all)':_0x1c61fa[_0x74d3('0xaf')][_0x3e213c][_0x74d3('0x174')](),'XMD-AMD':_0x4b3ea5[_0x74d3('0xe3')]?_0x74d3('0x179'):_0x74d3('0x176'),'XMD-DESTINATION':_0x74d3('0xe2')};if(_0x4b3ea5[_0x74d3('0xe3')]){_0xc0b180[_0x74d3('0x17a')]=_0x4b3ea5[_0x74d3('0x17b')]||0x9c4;_0xc0b180[_0x74d3('0x17c')]=_0x4b3ea5['dialAMDGreeting']||0x5dc;_0xc0b180[_0x74d3('0x17d')]=_0x4b3ea5['dialAMDAfterGreetingSilence']||0x320;_0xc0b180[_0x74d3('0x17e')]=_0x4b3ea5[_0x74d3('0x17f')]||0x1388;_0xc0b180[_0x74d3('0x180')]=_0x4b3ea5[_0x74d3('0x181')]||0x64;_0xc0b180[_0x74d3('0x182')]=_0x4b3ea5['dialAMDBetweenWordsSilence']||0x32;_0xc0b180[_0x74d3('0x183')]=_0x4b3ea5['dialAMDMaximumNumberOfWords']||0x3;_0xc0b180['XMD-AMDSILENCETHRESHOLD']=_0x4b3ea5[_0x74d3('0x184')]||0x100;_0xc0b180[_0x74d3('0x185')]=_0x4b3ea5[_0x74d3('0x186')]||0x1388;}if(_0x4b3ea5[_0x74d3('0x46')]===_0x74d3('0x47')){_0xc0b180[_0x74d3('0x187')]=_0x51010c[_0x74d3('0xd4')];}else{_0xc0b180[_0x74d3('0x188')]=_0x51010c[_0x74d3('0xd5')];}for(var _0x1de78a in _0x51010c[_0x74d3('0x172')]){if(typeof _0x51010c[_0x74d3('0x172')][_0x1de78a]!=='undefined'){if(isNotNull(_0x51010c[_0x74d3('0x172')][_0x1de78a])&&_0x1de78a!=='id'&&_0x1de78a!==_0x74d3('0x189')&&_0x1de78a!==_0x74d3('0x18a')&&_0x1de78a!==_0x74d3('0x18b')){_0xc0b180[util[_0x74d3('0x73')](_0x74d3('0x18c'),_0x74d3('0x18d'),_[_0x74d3('0x18e')](_0x1de78a))]=_0x51010c[_0x74d3('0x172')][_0x1de78a];}}}var _0x3a1d3d=_0x1c61fa[_0x74d3('0x142')](_0x4b3ea5['Trunk'])?getCallerId(_0x4b3ea5[_0x74d3('0x6e')][_0x74d3('0x70')],_0x4b3ea5['dialOriginateCallerIdName'],_0x4b3ea5[_0x74d3('0x18f')]>0x0?getCallerIdRandom(_0x4b3ea5['dialOriginateCallerIdNumber'],_0x4b3ea5[_0x74d3('0x18f')]):_0x4b3ea5[_0x74d3('0x57')]):getCallerId(_[_0x74d3('0xde')](_0x4b3ea5[_0x74d3('0x143')])?_0x4b3ea5['Trunk'][_0x74d3('0x70')]:_0x4b3ea5[_0x74d3('0x143')][_0x74d3('0x70')],_0x4b3ea5[_0x74d3('0x56')],_0x4b3ea5[_0x74d3('0x18f')]>0x0?getCallerIdRandom(_0x4b3ea5[_0x74d3('0x57')],_0x4b3ea5[_0x74d3('0x18f')]):_0x4b3ea5[_0x74d3('0x57')]);if(_0x3a1d3d){_0xc0b180[_0x74d3('0x190')]=_0x1c61fa[_0x74d3('0xaf')][_0x3e213c]['originatecalleridname']=extractCalleridName(_0x3a1d3d);_0xc0b180[_0x74d3('0x191')]=_0x1c61fa['actions'][_0x3e213c][_0x74d3('0x192')]=extractCalleridNumber(_0x3a1d3d);}return ami[_0x74d3('0xb2')]({'actionid':_0x3e213c,'action':_0x74d3('0x170'),'channel':_0x1c61fa['isTrunkReachable'](_0x4b3ea5[_0x74d3('0x6e')])?util[_0x74d3('0x73')](_0x74d3('0x193'),_0x4b3ea5[_0x74d3('0x6e')][_0x74d3('0x40')],isNotNull(_0x4b3ea5[_0x74d3('0x58')])?_0x4b3ea5[_0x74d3('0x58')][_0x74d3('0x194')]()||'':'',_0x4b3ea5[_0x74d3('0x195')]>0x0?_0x51010c[_0x74d3('0x172')][_0x74d3('0x196')][_0x74d3('0x197')](_0x4b3ea5[_0x74d3('0x195')]):_0x51010c['Contact'][_0x74d3('0x196')]):util['format'](_0x74d3('0x193'),_[_0x74d3('0xde')](_0x4b3ea5[_0x74d3('0x143')])?_0x4b3ea5[_0x74d3('0x6e')][_0x74d3('0x40')]:_0x4b3ea5[_0x74d3('0x143')][_0x74d3('0x40')],isNotNull(_0x4b3ea5['dialPrefix'])?_0x4b3ea5['dialPrefix'][_0x74d3('0x194')]()||'':'',_0x4b3ea5[_0x74d3('0x195')]>0x0?_0x51010c[_0x74d3('0x172')]['phone']['substring'](_0x4b3ea5['dialCutDigit']):_0x51010c[_0x74d3('0x172')][_0x74d3('0x196')]),'callerid':_0x3a1d3d,'Exten':_0x74d3('0xe2'),'Context':_0x74d3('0x198'),'Priority':'1','variable':_0xc0b180,'timeout':(_0x4b3ea5['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3e213c})[_0x74d3('0xbe')](function(_0x5956ee){return _0x5a7790(_0x5956ee);})[_0x74d3('0xb4')](function(_0x72b1a8){_0x4b3ea5[_0x74d3('0x60')]+=0x1;var _0x705339=new History(_0x1c61fa['actions'][_0x3e213c]);logger[_0x74d3('0x96')](util[_0x74d3('0x73')](_0x74d3('0x199'),JSON[_0x74d3('0x71')](_0x72b1a8)));_0x705339[_0x74d3('0xa9')]=0xe;_0x705339[_0x74d3('0xaa')]=_0x74d3('0x19a');_0x705339[_0x74d3('0xac')]=moment()[_0x74d3('0x73')](_0x74d3('0xfd'));_0x705339[_0x74d3('0xab')]=_0x705339[_0x74d3('0xac')];_0x1c61fa[_0x74d3('0xca')](_0x705339)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x19b')));_0x1c61fa[_0x74d3('0xc9')](_0x705339)[_0x74d3('0xb4')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x1c61fa[_0x74d3('0xaf')][_0x3e213c];return _0x3ba048(msgResponse(_0x74d3('0x170'),_0x74d3('0x43'),'originate\x20action\x20Error'));});});});};Dialer[_0x74d3('0x1d')][_0x74d3('0x2e')]=function(_0x34ea4c){var _0x5c48c3=this['actions'][_0x34ea4c[_0x74d3('0x127')]];if(_0x5c48c3){delete this[_0x74d3('0xaf')][_0x34ea4c['actionid']];_0x5c48c3[_0x74d3('0x118')]=moment()['format'](_0x74d3('0xfd'));var _0x4e974d=_0x5c48c3[_0x74d3('0x46')]===_0x74d3('0x76')?this[_0x74d3('0x22')][_0x5c48c3[_0x74d3('0xb7')]]:this['voiceQueues'][_0x5c48c3[_0x74d3('0x19c')]()];if(!this[_0x74d3('0xd8')](_0x34ea4c[_0x74d3('0x19d')])){this[_0x74d3('0xb6')](_0x4e974d);return this[_0x74d3('0x19e')](_0x5c48c3,_0x4e974d,_0x34ea4c)[_0x74d3('0xb4')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x74d3('0xdc')][_0x34ea4c['uniqueid']]=_0x5c48c3;}};Dialer[_0x74d3('0x1d')]['checkRetriveMax']=function(_0x434da6,_0x242523,_0x1feae6){var _0x226a75=new History(_0x242523);if(_0x226a75[_0x74d3('0x103')]+_0x226a75['countcongestionretry']+_0x226a75['countnoanswerretry']+_0x226a75[_0x74d3('0xf3')]+_0x226a75['countdropretry']+_0x226a75[_0x74d3('0x104')]+_0x226a75[_0x74d3('0xee')]+_0x226a75['countagentrejectretry']>=_0x1feae6[_0x74d3('0x105')]-0x1){return!![];}switch(_0x434da6){case 0x3:if(_0x226a75[_0x74d3('0xf2')]>=_0x1feae6[_0x74d3('0x19f')]-0x1){return!![];}this[_0x74d3('0xc2')]({'active':![],'countnoanswerretry':_0x226a75['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x74d3('0x106')](_0x1feae6[_0x74d3('0x1a0')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75['ListId'],'VoiceQueueId':_0x226a75['VoiceQueueId']||undefined,'CampaignId':_0x226a75['CampaignId']||undefined})['catch'](loggerCatch(_0x74d3('0x1a1')));break;case 0x5:if(_0x226a75['countbusyretry']>=_0x1feae6[_0x74d3('0x1a2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x226a75['countbusyretry']+=0x1,'scheduledat':moment()[_0x74d3('0x106')](_0x1feae6[_0x74d3('0x1a3')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75['VoiceQueueId']||undefined,'CampaignId':_0x226a75[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x226a75[_0x74d3('0xf1')]>=_0x1feae6[_0x74d3('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x226a75[_0x74d3('0xf1')]+=0x1,'scheduledat':moment()[_0x74d3('0x106')](_0x1feae6[_0x74d3('0x1a5')],_0x74d3('0xfc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75[_0x74d3('0xd4')]||undefined,'CampaignId':_0x226a75[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x1a6')));break;case 0x0:if(_0x226a75[_0x74d3('0xf3')]>=_0x1feae6[_0x74d3('0x1a7')]-0x1){return!![];}else{this[_0x74d3('0xc2')]({'active':![],'countnosuchnumberretry':_0x226a75[_0x74d3('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x1feae6[_0x74d3('0x1a8')],'minutes')[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75['VoiceQueueId']||undefined,'CampaignId':_0x226a75[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x1a9')));}break;case 0xa:if(_0x226a75[_0x74d3('0xf4')]>=_0x1feae6[_0x74d3('0x1aa')]-0x1){return!![];}this[_0x74d3('0xc2')]({'active':![],'countdropretry':_0x226a75[_0x74d3('0xf4')]+=0x1,'scheduledat':moment()[_0x74d3('0x106')](_0x1feae6[_0x74d3('0x11c')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75[_0x74d3('0xd4')]||undefined,'CampaignId':_0x226a75['CampaignId']||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x11d')));break;case 0xb:if(_0x226a75[_0x74d3('0x104')]>=_0x1feae6[_0x74d3('0x1ab')]-0x1){return!![];}this[_0x74d3('0xc2')]({'active':![],'countabandonedretry':_0x226a75[_0x74d3('0x104')]+=0x1,'scheduledat':moment()[_0x74d3('0x106')](_0x1feae6[_0x74d3('0x124')],_0x74d3('0xfc'))[_0x74d3('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75[_0x74d3('0xd4')]||undefined,'CampaignId':_0x226a75['CampaignId']||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x125')));break;case 0x13:if(_0x226a75[_0x74d3('0xee')]>=_0x1feae6[_0x74d3('0xf8')]-0x1){return!![];}this[_0x74d3('0xc2')]({'active':![],'countmachineretry':_0x226a75[_0x74d3('0xee')]+=0x1,'scheduledat':moment()['add'](_0x1feae6[_0x74d3('0xfb')],'minutes')[_0x74d3('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75[_0x74d3('0xd4')]||undefined,'CampaignId':_0x226a75[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xfe')));break;case 0x14:if(_0x226a75[_0x74d3('0xf5')]>=_0x1feae6[_0x74d3('0x1ac')]-0x1){return!![];}this[_0x74d3('0xc2')]({'active':![],'countagentrejectretry':_0x226a75['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x74d3('0x106')](_0x1feae6[_0x74d3('0x1ad')],_0x74d3('0xfc'))[_0x74d3('0x73')](_0x74d3('0xfd')),'ContactId':_0x226a75[_0x74d3('0xd1')],'ListId':_0x226a75[_0x74d3('0xd2')],'VoiceQueueId':_0x226a75[_0x74d3('0xd4')]||undefined,'CampaignId':_0x226a75[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x2d55d1,_0x1a93ee,_0x81b411){var _0x3e3dda=this;var _0x42716b=new History(_0x2d55d1);return new BPromise(function(_0x2e5b78,_0x5ae163){if(_[_0x74d3('0x86')](_0x1a93ee)&&typeof _0x1a93ee!==_0x74d3('0x16f')){return _0x5ae163(msgResponse('[callProgressDetecting]',_0x74d3('0x14a'),_0x74d3('0x1ae')));}if(_[_0x74d3('0x86')](_0x81b411)&&typeof _0x81b411!==_0x74d3('0x16f')){return _0x5ae163(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}switch(_0x81b411[_0x74d3('0x1af')]){case'0':_0x1a93ee[_0x74d3('0x5f')]+=0x1;_0x42716b[_0x74d3('0xa9')]=0x0;_0x42716b['statedesc']='NoSuchNumber';_0x42716b[_0x74d3('0xf3')]+=0x1;_0x42716b[_0x74d3('0x102')]+=0x1;ami[_0x74d3('0x1b0')]('custom:agentnosuchnumber',ut[_0x74d3('0x1b1')](_0x2d55d1,_0x74d3('0x1b2')));_0x3e3dda[_0x74d3('0xca')](_0x42716b)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xf0')));if(_0x3e3dda['checkRetriveMax'](0x0,_0x2d55d1,_0x1a93ee)){if(_0x42716b[_0x74d3('0xf3')]>=_0x1a93ee[_0x74d3('0x1a7')]){_0x3e3dda['createStateFinal'](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1b3'));}else{_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1a93ee[_0x74d3('0x5e')]+=0x1;_0x42716b[_0x74d3('0xa9')]=0x3;_0x42716b[_0x74d3('0xaa')]=_0x74d3('0x1b4');_0x42716b[_0x74d3('0xf2')]+=0x1;_0x42716b[_0x74d3('0x102')]+=0x1;ami[_0x74d3('0x1b0')]('custom:agentnoanswer',ut[_0x74d3('0x1b1')](_0x2d55d1,_0x74d3('0x1b5')));_0x3e3dda[_0x74d3('0xca')](_0x42716b)['catch'](loggerCatch(_0x74d3('0x1b6')));if(_0x3e3dda['checkRetriveMax'](0x3,_0x2d55d1,_0x1a93ee)){if(_0x42716b['countnoanswerretry']>=_0x1a93ee['dialNoAnswerMaxRetry']){_0x3e3dda['createStateFinal'](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1b7'));}else{_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1b7'));}}break;case'5':_0x1a93ee[_0x74d3('0x5a')]+=0x1;_0x42716b[_0x74d3('0xa9')]=0x5;_0x42716b[_0x74d3('0xaa')]=_0x74d3('0x1b8');_0x42716b[_0x74d3('0x103')]+=0x1;_0x42716b[_0x74d3('0x102')]+=0x1;ami[_0x74d3('0x1b0')]('custom:agentbusy',ut[_0x74d3('0x1b1')](_0x2d55d1,_0x74d3('0x1b9')));_0x3e3dda[_0x74d3('0xca')](_0x42716b)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3e3dda[_0x74d3('0x1ba')](0x5,_0x2d55d1,_0x1a93ee)){if(_0x42716b[_0x74d3('0x103')]>=_0x1a93ee[_0x74d3('0x1a2')]){_0x3e3dda['createStateFinal'](_0x42716b,_0x2e5b78,_0x5ae163,'reason\x205\x20busy');}else{_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,'reason\x205\x20busy');}}break;case'8':_0x1a93ee[_0x74d3('0x5b')]+=0x1;_0x42716b[_0x74d3('0xa9')]=0x8;_0x42716b[_0x74d3('0xaa')]=_0x74d3('0x1bb');_0x42716b[_0x74d3('0xf1')]+=0x1;_0x42716b[_0x74d3('0x102')]+=0x1;ami[_0x74d3('0x1b0')]('custom:agentcongestion',ut[_0x74d3('0x1b1')](_0x2d55d1,_0x74d3('0x1bc')));_0x3e3dda[_0x74d3('0xca')](_0x42716b)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x1bd')));if(_0x3e3dda[_0x74d3('0x1ba')](0x8,_0x2d55d1,_0x1a93ee)){if(_0x42716b[_0x74d3('0xf1')]>=_0x1a93ee[_0x74d3('0x1a4')]){_0x3e3dda[_0x74d3('0xf9')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1be'));}else{_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1be'));}}break;case'11':_0x1a93ee['outboundAbandonedCallsDay']+=0x1;_0x42716b[_0x74d3('0xa9')]=0xb;_0x42716b[_0x74d3('0xaa')]=_0x74d3('0x121');_0x42716b[_0x74d3('0x104')]+=0x1;_0x42716b['countglobal']+=0x1;_0x3e3dda[_0x74d3('0xca')](_0x42716b)[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x1bf')));if(_0x3e3dda['checkRetriveMax'](0xb,_0x2d55d1,_0x1a93ee)){if(_0x42716b[_0x74d3('0x104')]>=_0x1a93ee[_0x74d3('0x1ab')]){_0x3e3dda[_0x74d3('0xf9')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1c0'));}else{_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1c0'));}}break;case'20':_0x1a93ee[_0x74d3('0x1c1')]+=0x1;_0x42716b[_0x74d3('0xa9')]=0x14;_0x42716b[_0x74d3('0xaa')]=_0x74d3('0x1c2');_0x42716b['countagentrejectretry']+=0x1;_0x42716b[_0x74d3('0x102')]+=0x1;ami[_0x74d3('0x1b0')](_0x74d3('0x1c3'),ut[_0x74d3('0x1b1')](_0x2d55d1,_0x74d3('0x1c4')));_0x3e3dda['createHistory'](_0x42716b)['catch'](loggerCatch(_0x74d3('0x1c5')));if(_0x3e3dda[_0x74d3('0x1ba')](0x14,_0x2d55d1,_0x1a93ee)){if(_0x42716b[_0x74d3('0xf5')]>=_0x1a93ee[_0x74d3('0x1ac')]){_0x3e3dda[_0x74d3('0xf9')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1c6'));}else{_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,_0x74d3('0x1c6'));}}break;default:_0x1a93ee[_0x74d3('0x1c7')]+=0x1;_0x42716b[_0x74d3('0xa9')]=0xc;_0x42716b['statedesc']=_0x81b411[_0x74d3('0x1af')];_0x3e3dda[_0x74d3('0xca')](_0x42716b)[_0x74d3('0xb4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3e3dda[_0x74d3('0x1ba')](_0x81b411[_0x74d3('0x1af')],_0x2d55d1,_0x1a93ee)){if(_0x42716b['countbusyretry']+_0x42716b[_0x74d3('0xf1')]+_0x42716b['countnoanswerretry']+_0x42716b[_0x74d3('0xf3')]+_0x42716b['countdropretry']+_0x42716b[_0x74d3('0x104')]+_0x42716b[_0x74d3('0xee')]+_0x42716b[_0x74d3('0xf5')]>=_0x1a93ee[_0x74d3('0x105')]){_0x3e3dda[_0x74d3('0xf6')](_0x42716b,_0x2e5b78,_0x5ae163,_0x81b411[_0x74d3('0x1af')]);}else{_0x3e3dda[_0x74d3('0xf9')](_0x42716b,_0x2e5b78,_0x5ae163,_0x81b411[_0x74d3('0x1af')]);}}}});};Dialer[_0x74d3('0x1d')]['stateGlobal']=function(_0x2c49ab,_0xbc449a,_0x11121a,_0x2261a3){var _0x2849ca=new Final(_0x2c49ab);_0x2849ca[_0x74d3('0xa9')]=0xf;_0x2849ca[_0x74d3('0xaa')]='Global';this['createStateFinal'](_0x2849ca,_0xbc449a,_0x11121a,_0x2261a3);};Dialer['prototype']['createStateFinal']=function(_0x2f8100,_0x4f41a3,_0x28f6d6,_0x40a922){this[_0x74d3('0xc9')](_0x2f8100)['then'](function(){return _0x4f41a3(msgResponse('[callProgressDetecting]',_0x74d3('0xd9'),_0x40a922));})['catch'](function(){return _0x28f6d6(msgResponse(_0x74d3('0x1c8'),_0x74d3('0x14a'),_0x74d3('0x1c9')));});};Dialer[_0x74d3('0x1d')]['predictive']=function(_0x2203ca){var _0x5921d9=_0x2203ca[_0x74d3('0x1ca')]/0x64;var _0x4167f9=_0x2203ca['outboundDropCallsDayTimeout']/(_0x2203ca[_0x74d3('0x5d')]+_0x2203ca['outboundAnswerCallsDay']);var _0x26b0d4=Math[_0x74d3('0x1cb')](_0x2203ca[_0x74d3('0x68')]*(_0x2203ca[_0x74d3('0x1cc')]/0x64));var _0x33c890=Math[_0x74d3('0x1cb')](_0x2203ca[_0x74d3('0x68')]*(_0x2203ca['predictiveIntervalMinThreshold']/0x64));var _0x31179e=_0x2203ca[_0x74d3('0x4a')]+_0x2203ca[_0x74d3('0x4f')];var _0x3a5637=Math[_0x74d3('0x1cd')](_0x2203ca[_0x74d3('0x6a')]*_0x2203ca['erlangAbandonmentRate']*_0x2203ca[_0x74d3('0x65')]*_0x2203ca[_0x74d3('0x66')]);if(_[_0x74d3('0x86')](_0x2203ca[_0x74d3('0x28')])){if(!_[_0x74d3('0x86')](_0x2203ca['startPredictive'])){_0x2203ca[_0x74d3('0x90')]=undefined;loggerPredictive[_0x74d3('0x96')](_0x74d3('0x1ce'),_0x74d3('0x1cf'));}if(!_[_0x74d3('0x86')](_0x2203ca[_0x74d3('0x91')])){loggerPredictive[_0x74d3('0x96')](_0x74d3('0x1ce'),_0x74d3('0x1d0'));clearInterval(_0x2203ca[_0x74d3('0x91')]);_0x2203ca['handlePredictive']=undefined;}_0x2203ca[_0x74d3('0x28')]=moment()[_0x74d3('0x73')](_0x74d3('0xfd'));loggerPredictive['info'](_0x2203ca[_0x74d3('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x2203ca['startProgressive']);this[_0x74d3('0x15f')](_0x2203ca,0x1);}else if(ifInterval(_0x2203ca['dialPredictiveInterval'],_0x2203ca[_0x74d3('0x28')])){this[_0x74d3('0x15f')](_0x2203ca,0x1);loggerPredictiveCalls[_0x74d3('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x2203ca[_0x74d3('0x28')],_0x2203ca[_0x74d3('0x40')]);_0x2203ca['erlangCalls']=0x0;_0x2203ca[_0x74d3('0x64')]=0x0;}else if(_0x5921d9<_0x4167f9&&_0x2203ca['dialPredictiveOptimization']===_0x74d3('0x1d1')){freeVariablesPredictive(_0x2203ca);loggerPredictive['info'](_0x74d3('0x1d2'),_0x74d3('0x1d3'),_0x4167f9,_0x74d3('0x28'),_0x2203ca['name']);}else if(_0x3a5637<_0x2203ca[_0x74d3('0x64')]&&_0x2203ca[_0x74d3('0x1d4')]===_0x74d3('0x1d1')){freeVariablesPredictive(_0x2203ca);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x3a5637,'Drop\x20in\x20this\x20interval',_0x2203ca[_0x74d3('0x64')],_0x74d3('0x28'),_0x2203ca[_0x74d3('0x40')]);}else if(!ifInterval(_0x2203ca[_0x74d3('0x1d5')],_0x2203ca['startProgressive'])&&_['isUndefined'](_0x2203ca[_0x74d3('0x90')])&&!_[_0x74d3('0x86')](_0x2203ca['startProgressive'])){_0x2203ca['startPredictive']=moment()[_0x74d3('0x73')](_0x74d3('0xfd'));loggerPredictive[_0x74d3('0x7b')](_0x2203ca[_0x74d3('0x40')],_0x74d3('0x1d6'),_0x2203ca[_0x74d3('0x90')]);this[_0x74d3('0xc0')](_0x2203ca[_0x74d3('0x1d5')])[_0x74d3('0xbe')](this[_0x74d3('0x1d7')](_0x2203ca))['then'](mergeDataErlangB(_0x2203ca))[_0x74d3('0xbe')](this['startMethodPredictive'](_0x2203ca))[_0x74d3('0xb4')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2203ca));}else if(!ifInterval(_0x2203ca[_0x74d3('0x1d5')],_0x2203ca['startPredictive'])){_0x2203ca[_0x74d3('0x64')]=0x0;_0x2203ca['startPredictive']=moment()['format'](_0x74d3('0xfd'));loggerPredictive[_0x74d3('0x7b')](_0x2203ca['name'],_0x74d3('0x1d8'),_0x2203ca['startPredictive']);clearInterval(_0x2203ca[_0x74d3('0x91')]);_0x2203ca['handlePredictive']=undefined;this[_0x74d3('0xc0')](_0x2203ca[_0x74d3('0x1d5')])[_0x74d3('0xbe')](this[_0x74d3('0x1d7')](_0x2203ca))[_0x74d3('0xbe')](mergeDataErlangB(_0x2203ca))[_0x74d3('0xbe')](this[_0x74d3('0x1d9')](_0x2203ca))[_0x74d3('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2203ca));}else if(_0x2203ca[_0x74d3('0x68')]&&_0x31179e<_0x2203ca['predictiveIntervalAvailable']-_0x33c890){freeVariablesPredictive(_0x2203ca);loggerPredictive['info'](_0x2203ca[_0x74d3('0x40')],_0x74d3('0x1da'),_0x31179e,_0x74d3('0x1db'),_0x2203ca['predictiveIntervalAvailable'],'-',_0x33c890,'=',_0x2203ca[_0x74d3('0x68')]-_0x33c890,')');}else if(_0x2203ca[_0x74d3('0x68')]&&_0x31179e>_0x2203ca[_0x74d3('0x68')]+_0x26b0d4){freeVariablesPredictive(_0x2203ca);loggerPredictive[_0x74d3('0x7b')](_0x2203ca[_0x74d3('0x40')],_0x74d3('0x1da'),_0x31179e,_0x74d3('0x1dc'),_0x2203ca['predictiveIntervalAvailable'],'+',_0x26b0d4,'=',_0x2203ca['predictiveIntervalAvailable']+_0x26b0d4,')');}};Dialer['prototype']['getDataPredictive']=function(_0x515ede){var _0x2024e5=this;return function(_0x485cc4){return new BPromise(function(_0x358495,_0x56b072){_[_0x74d3('0x8d')](_0x515ede,_0x485cc4[0x0]);if(checkGetDataPredictive(_0x485cc4[0x0])){var _0x5545ad=_0x515ede['predictiveIntervalAvailable']=_0x515ede['talking']+_0x515ede['available'];var _0x1a5847=_0x515ede['dialPredictiveInterval']*0x3c;var _0xda1e8b=_0x485cc4[0x0]['predictiveIntervalAvgTalktime']+_0x485cc4[0x0][_0x74d3('0x81')];var _0x2be672=(_0x485cc4[0x0][_0x74d3('0x61')]+_0x485cc4[0x0][_0x74d3('0x119')]+_0x485cc4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x485cc4[0x0]['predictiveIntervalTotalCalls'];_0x515ede[_0x74d3('0x65')]=_0x2be672>0x0?_0x2be672:0x1;switch(_0x515ede[_0x74d3('0x1d4')]){case _0x74d3('0x1d1'):var _0x89a3dc=_0x515ede['dialPredictiveOptimizationPercentage']/0x64;return _0x2024e5[_0x74d3('0x1dd')](_0x5545ad,_0x1a5847,_0xda1e8b,_0x2be672,_0x89a3dc)['then'](function(_0x2cf666){return _0x358495(_0x2cf666);});case _0x74d3('0x1de'):var _0x1c7099=_0x515ede[_0x74d3('0x1ca')]/0x64;return _0x2024e5[_0x74d3('0x1df')](_0x5545ad,_0x1a5847,_0xda1e8b,_0x2be672,_0x1c7099)[_0x74d3('0xbe')](function(_0x215d40){return _0x358495(_0x215d40);});default:return _0x56b072(msgResponse('[getDataPredictive]',_0x74d3('0x14a'),_0x74d3('0x1e0')));}}else{return _0x56b072(msgResponse(_0x74d3('0x1e1'),_0x74d3('0x14a'),_0x74d3('0x1e2')));}});};};Dialer[_0x74d3('0x1d')][_0x74d3('0x1e3')]=function(_0x14e799){var _0x11122f=this;return function(_0x3bb22f){return new BPromise(function(_0x408836,_0x46ba67){_['merge'](_0x14e799,_0x3bb22f[0x0]);if(checkGetDataPredictive(_0x3bb22f[0x0])){loggerPredictive[_0x74d3('0x7b')](JSON[_0x74d3('0x71')](_0x3bb22f[0x0]));if(_0x14e799[_0x74d3('0x1d4')]==='dropRate'){return _0x11122f[_0x74d3('0xc8')](_0x14e799['id'])[_0x74d3('0xbe')](function(_0x23a159){var _0x519c91=_0x14e799[_0x74d3('0x166')]-_0x23a159[0x0][_0x74d3('0x1e4')];var _0x2d9a13=_0x14e799[_0x74d3('0x1d5')]*0x3c;var _0x207e76=_0x3bb22f[0x0]['predictiveIntervalAvgTalktime']+_0x3bb22f[0x0][_0x74d3('0x81')];var _0x21a408=(_0x3bb22f[0x0][_0x74d3('0x61')]+_0x3bb22f[0x0][_0x74d3('0x119')]+_0x3bb22f[0x0][_0x74d3('0x62')])/_0x3bb22f[0x0][_0x74d3('0x69')];var _0xc4c4e6=_0x14e799[_0x74d3('0x1ca')]/0x64;_0x14e799[_0x74d3('0x67')]=_0x23a159[0x0][_0x74d3('0x1e4')]||0x0;_0x14e799[_0x74d3('0x65')]=_0x21a408>0x0?_0x21a408:0x1;return _0x11122f[_0x74d3('0x1dd')](_0x519c91,_0x2d9a13,_0x207e76,_0x21a408,_0xc4c4e6);})[_0x74d3('0xbe')](function(_0x19b878){return _0x408836(_0x19b878);})[_0x74d3('0xb4')](function(_0x99412b){return _0x46ba67(msgResponse(_0x74d3('0x1e5'),_0x74d3('0x14a'),JSON[_0x74d3('0x71')](_0x99412b)));});}if(_0x14e799['dialPredictiveOptimization']===_0x74d3('0x1de')){return _0x11122f[_0x74d3('0xc8')](_0x14e799['id'])['then'](function(_0x39c983){var _0x4574a3=_0x14e799['loggedIn']-_0x39c983[0x0]['outboundQueuePauses'];var _0x5a5d3b=_0x14e799[_0x74d3('0x1d5')]*0x3c;var _0x4a96a9=_0x3bb22f[0x0][_0x74d3('0x83')]+_0x3bb22f[0x0][_0x74d3('0x81')];var _0x4c7ead=(_0x3bb22f[0x0]['predictiveIntervalAnsweredCalls']+_0x3bb22f[0x0][_0x74d3('0x119')]+_0x3bb22f[0x0][_0x74d3('0x62')])/_0x3bb22f[0x0][_0x74d3('0x69')];var _0x2a9e73=_0x14e799[_0x74d3('0x1ca')]/0x64;_0x14e799['predictiveIntervalPauses']=_0x39c983[0x0][_0x74d3('0x1e4')]||0x0;_0x14e799[_0x74d3('0x65')]=_0x4c7ead>0x0?_0x4c7ead:0x1;return _0x11122f[_0x74d3('0x1df')](_0x4574a3,_0x5a5d3b,_0x4a96a9,_0x4c7ead,_0x2a9e73);})['then'](function(_0x1c2a29){return _0x408836(_0x1c2a29);})[_0x74d3('0xb4')](function(_0xff24a4){return _0x46ba67(msgResponse(_0x74d3('0x1e5'),'Failure',JSON[_0x74d3('0x71')](_0xff24a4)));});}}else{return _0x46ba67(msgResponse(_0x74d3('0x1e1'),_0x74d3('0x14a'),_0x74d3('0x1e2')));}});};};Dialer[_0x74d3('0x1d')][_0x74d3('0x1d9')]=function(_0x29e3bb){var _0x24e836=this;return function(){var _0x3a172a=0x0;var _0x265349=Math[_0x74d3('0x1cd')](_0x29e3bb[_0x74d3('0x6b')]*0x3e8);if(_0x265349>0x0){_0x265349=_0x265349<0x64?0x64:_0x265349;loggerPredictive['info'](_0x29e3bb[_0x74d3('0x40')],'one\x20call\x20every:',_0x265349,'milliseconds');_0x29e3bb[_0x74d3('0x91')]=setInterval(function(){_0x24e836[_0x74d3('0x91')](_0x29e3bb);loggerPredictiveCalls[_0x74d3('0x7b')]('[handlePredictive]',_0x3a172a+=0x1);},_0x265349);}else{loggerPredictive['info'](_0x29e3bb['name'],_0x74d3('0x1e6'));}};};Dialer[_0x74d3('0x1d')][_0x74d3('0x1e7')]=function(_0x4f0729,_0x4e9bc6){var _0x3deea3=this;return function(_0x2221be){if(_['isEmpty'](_0x2221be)){if(_[_0x74d3('0xde')](_0x4e9bc6[_0x74d3('0xd3')])||!_0x4e9bc6['recallme']){if(_0x4f0729['dialMethod']===_0x74d3('0x9')){_0x4f0729[_0x74d3('0x12e')]=_[_0x74d3('0x86')](_0x4f0729[_0x74d3('0x12e')])?!![]:_0x4f0729['queueStatusComplete'];var _0x4efcf0=uuid['v4']();_0x3deea3[_0x74d3('0xaf')][_0x4efcf0]=new Action(_0x4f0729,_0x4e9bc6,_0x4efcf0);loggerBooked['info'](_0x74d3('0x1e8'),_0x4efcf0,_0x74d3('0x1e9'),JSON['stringify'](_0x4f0729[_0x74d3('0x12e')]),'Queue:\x20',_0x4f0729[_0x74d3('0x40')]);if(_0x4f0729[_0x74d3('0x12e')]){_0x4f0729[_0x74d3('0x12e')]=![];_0x3deea3[_0x74d3('0x12b')][_0x3deea3[_0x74d3('0xaf')][_0x4efcf0]['queue']]=[];ami[_0x74d3('0xb2')]({'actionid':_0x4efcf0,'action':_0x74d3('0x1ea'),'queue':_0x4f0729['name']})[_0x74d3('0xb4')](function(){_0x3deea3[_0x74d3('0xb6')](_0x4f0729);_0x3deea3[_0x74d3('0xc2')]({'active':![],'ContactId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0][_0x74d3('0xd1')],'ListId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0]['ListId'],'VoiceQueueId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0][_0x74d3('0xd4')]||undefined,'CampaignId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0]['CampaignId']||undefined})[_0x74d3('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3deea3[_0x74d3('0xaf')][_0x4efcf0];});}else{loggerBooked[_0x74d3('0x7b')]('[booked][checkContactBlack][else]',JSON[_0x74d3('0x71')](_0x4f0729[_0x74d3('0x12e')]),_0x74d3('0x1eb'),_0x4f0729[_0x74d3('0x40')]);_0x3deea3['updateOriginated'](_0x4f0729);_0x3deea3[_0x74d3('0xc2')]({'active':![],'ContactId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0][_0x74d3('0xd1')],'ListId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0][_0x74d3('0xd2')],'VoiceQueueId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0][_0x74d3('0xd4')]||undefined,'CampaignId':_0x3deea3[_0x74d3('0xaf')][_0x4efcf0]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3deea3[_0x74d3('0xaf')][_0x4efcf0];}}else{return _0x3deea3[_0x74d3('0x1ec')](_0x4f0729,_0x4e9bc6);}}else{if(getDiff(_0x4e9bc6[_0x74d3('0x1ed')])<_0x4f0729[_0x74d3('0x1ee')]*0x3c){if(_0x4e9bc6['Agent']&&!_0x4e9bc6[_0x74d3('0x1ef')][_0x74d3('0x1f0')]){_0x3deea3[_0x74d3('0x20')][_0x74d3('0x13a')](_0x4e9bc6['id'])[_0x74d3('0x132')](function(){_0x3deea3[_0x74d3('0xb6')](_0x4f0729);});}else{_0x3deea3[_0x74d3('0xc4')]({'active':![]},_0x4e9bc6['id'],0x1)[_0x74d3('0x132')](function(){_0x3deea3[_0x74d3('0xb6')](_0x4f0729);});}}else{_0x4f0729['outboundReCallsDay']+=0x1;_0x3deea3['updateOriginated'](_0x4f0729);if(_0x4f0729[_0x74d3('0x1f1')]){_0x3deea3[_0x74d3('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e9bc6['ContactId'],'ListId':_0x4e9bc6[_0x74d3('0xd2')],'VoiceQueueId':_0x4e9bc6[_0x74d3('0xd4')]||undefined,'CampaignId':_0x4e9bc6[_0x74d3('0xd5')]||undefined})[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x1f2')));_0x3deea3[_0x74d3('0xca')](createObjHistory(_0x4f0729,_0x4e9bc6,'RECALLINQUEUE',0x17,_0x74d3('0x1f3')))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0x1f4')));}else{_0x3deea3[_0x74d3('0xcf')](createObjHistory(_0x4f0729,_0x4e9bc6,_0x74d3('0x1f5'),0x16,_0x74d3('0x1f6')),_0x74d3('0x1f7'),'[Originate][HistoryRecallClose]');}}}}else{_0x4f0729[_0x74d3('0x59')]+=0x1;_0x3deea3[_0x74d3('0xcf')](createObjHistory(_0x4f0729,_0x4e9bc6,_0x74d3('0x1f8'),0xd,_0x74d3('0x1f9')),_0x74d3('0x1fa'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x2b26d5){var _0x1d7231=this;var _0x5e9808=_0x2b26d5[_0x74d3('0x1fb')]-_0x2b26d5[_0x74d3('0x99')]-_0x2b26d5[_0x74d3('0x1fc')];emitCampaignSummary(_0x2b26d5);if(_0x5e9808>0x0){if(_0x5e9808>this[_0x74d3('0x25')]){_0x5e9808=this[_0x74d3('0x25')];}_0x2b26d5['temp']+=_0x5e9808;this['getContactDialerIvr'](_0x2b26d5['id'],_0x5e9808,_0x2b26d5['dialOrderByScheduledAt'])[_0x74d3('0xbe')](function(_0x43c120){_0x2b26d5[_0x74d3('0x1fc')]-=_0x5e9808;_0x2b26d5[_0x74d3('0x1fc')]=_0x2b26d5[_0x74d3('0x1fc')]>0x0?_0x2b26d5['temp']:0x0;if(!checkContactEmpty(_0x43c120)){_0x2b26d5[_0x74d3('0x3b')]=_0x74d3('0xa1');logger[_0x74d3('0x7b')](_0x74d3('0x1fd')+_0x2b26d5[_0x74d3('0x40')]);}else{_0x2b26d5[_0x74d3('0x99')]+=_0x43c120['length'];_0x2b26d5['message']=_0x74d3('0x1fe');for(var _0x4001e3=0x0;_0x4001e3<_0x43c120[_0x74d3('0x98')];_0x4001e3+=0x1){_0x2b26d5[_0x74d3('0x1ff')]+=0x1;if(_['isNil'](_0x43c120[_0x4001e3])||_['isNil'](_0x43c120[_0x4001e3][_0x74d3('0x172')])||_[_0x74d3('0xde')](_0x43c120[_0x4001e3][_0x74d3('0x172')][_0x74d3('0x196')])){_0x1d7231['emptyContact'](_0x74d3('0x200'),_0x2b26d5,_0x43c120[_0x4001e3]);}else{_0x1d7231['checkIsBlackListIvr'](_[_0x74d3('0xd0')](_0x43c120[_0x4001e3],['CampaignId','Contact.phone']))[_0x74d3('0xbe')](_0x1d7231[_0x74d3('0x1e7')](_0x2b26d5,_0x43c120[_0x4001e3]))[_0x74d3('0xb4')](_0x1d7231[_0x74d3('0x201')](_0x74d3('0x202'),_0x2b26d5));}}}})[_0x74d3('0xb4')](loggerGetContactDialer(_0x74d3('0x203'),_0x2b26d5,_0x5e9808));}};Dialer[_0x74d3('0x1d')][_0x74d3('0x15f')]=function(_0x7b5301,_0x5ab9d0){var _0x3a248b=this;var _0x48491d=[];var _0x5ed46c=_0x5ab9d0>=0x1?_0x5ab9d0:0x1;if(_0x7b5301[_0x74d3('0x55')]==='booked'){_0x5ed46c=0x1;}var _0x9f5e1=Math['floor'](_0x7b5301['available']*_0x5ed46c)-_0x7b5301['originated']-_0x7b5301[_0x74d3('0x1fc')];emitVoiceQueueSummary(_0x7b5301);if(_0x7b5301['dialLimitQueue']>0x0){var _0x2d0044=_0x7b5301[_0x74d3('0x204')]-_0x7b5301[_0x74d3('0x99')]-_0x7b5301[_0x74d3('0x4f')]-_0x7b5301[_0x74d3('0x1fc')]-_0x7b5301[_0x74d3('0x4b')];if(_0x9f5e1>_0x2d0044){_0x9f5e1=_0x2d0044;}}if(_0x9f5e1>0x0){if(_0x7b5301[_0x74d3('0x55')]===_0x74d3('0x9')){_0x9f5e1=0x1;}if(_0x9f5e1>this[_0x74d3('0x25')]){_0x9f5e1=this['maxNumberOriginate'];}_0x7b5301[_0x74d3('0x1fc')]+=_0x9f5e1;for(var _0x1b6737 in this[_0x74d3('0x23')]){if(typeof this['agents'][_0x1b6737]!==_0x74d3('0x9a')){if(this[_0x74d3('0x23')][_0x1b6737][_0x74d3('0xa9')]==='not_inuse'&&this[_0x74d3('0x23')][_0x1b6737][_0x74d3('0xdb')]===_0x74d3('0x205')){_0x48491d[_0x74d3('0x12c')](this[_0x74d3('0x23')][_0x1b6737]['id']);}}}this['getContactDialer'](_0x7b5301['id'],_0x48491d,_0x9f5e1,_0x7b5301['dialOrderByScheduledAt'])[_0x74d3('0xbe')](function(_0x31fad7){_0x7b5301[_0x74d3('0x1fc')]-=_0x9f5e1;_0x7b5301[_0x74d3('0x1fc')]=_0x7b5301[_0x74d3('0x1fc')]>0x0?_0x7b5301[_0x74d3('0x1fc')]:0x0;if(!checkContactEmpty(_0x31fad7)){_0x3a248b['countReScheduled'](_0x7b5301)[_0x74d3('0xbe')](sendMessageReschedule(_0x7b5301))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xbb')));}else{_0x7b5301[_0x74d3('0x99')]+=_0x31fad7[_0x74d3('0x98')];_0x7b5301[_0x74d3('0x3b')]=_0x7b5301[_0x74d3('0x55')]===_0x74d3('0x9')?'ACTIVE':_0x74d3('0x1fe');for(var _0x451e63=0x0;_0x451e63<_0x31fad7[_0x74d3('0x98')];_0x451e63+=0x1){if(_[_0x74d3('0xde')](_0x31fad7[_0x451e63])||_['isNil'](_0x31fad7[_0x451e63][_0x74d3('0x172')])||_[_0x74d3('0xde')](_0x31fad7[_0x451e63][_0x74d3('0x172')][_0x74d3('0x196')])){_0x3a248b[_0x74d3('0xcd')](_0x74d3('0x200'),_0x7b5301,_0x31fad7[_0x451e63]);}else{_0x3a248b[_0x74d3('0xbc')](_[_0x74d3('0xd0')](_0x31fad7[_0x451e63],['VoiceQueueId','Contact.phone']))[_0x74d3('0xbe')](_0x3a248b[_0x74d3('0x1e7')](_0x7b5301,_0x31fad7[_0x451e63]))[_0x74d3('0xb4')](_0x3a248b[_0x74d3('0x201')](_0x74d3('0x200'),_0x7b5301));}}}})['catch'](loggerGetContactDialer(_0x74d3('0x206'),_0x7b5301,_0x9f5e1));}};Dialer[_0x74d3('0x1d')]['handlePredictive']=function(_0xc4572e){if(_0xc4572e[_0x74d3('0x204')]>0x0){var _0x336fdf=_0xc4572e['dialLimitQueue']-_0xc4572e[_0x74d3('0x99')]-_0xc4572e[_0x74d3('0x4f')];if(_0x336fdf>0x0){this[_0x74d3('0x207')](_0xc4572e);}else{loggerPredictiveCalls['info'](_0x74d3('0x208'));}}else{this[_0x74d3('0x207')](_0xc4572e);}};Dialer[_0x74d3('0x1d')][_0x74d3('0x207')]=function(_0xfb3716){var _0x5d0af5=this;var _0x3ce79b=[];_0xfb3716[_0x74d3('0x99')]+=0x1;for(var _0x4e3c00 in this[_0x74d3('0x23')]){if(typeof this['agents'][_0x4e3c00]!==_0x74d3('0x9a')){if(this[_0x74d3('0x23')][_0x4e3c00][_0x74d3('0xa9')]===_0x74d3('0x209')&&this[_0x74d3('0x23')][_0x4e3c00][_0x74d3('0xdb')]===_0x74d3('0x205')){_0x3ce79b[_0x74d3('0x12c')](this[_0x74d3('0x23')][_0x4e3c00]['id']);}}}this['getContactDialer'](_0xfb3716['id'],_0x3ce79b,0x1,_0xfb3716[_0x74d3('0x20a')])[_0x74d3('0xbe')](function(_0x44f3a4){if(!checkContactEmpty(_0x44f3a4)){checkContactLowerLimitOriginate(_0xfb3716,0x1,0x0);_0x5d0af5[_0x74d3('0xb9')](_0xfb3716)[_0x74d3('0xbe')](sendMessageReschedule(_0xfb3716))[_0x74d3('0xb4')](loggerCatch(_0x74d3('0xbb')));}else{_0xfb3716['message']=_0x74d3('0x1fe');if(_[_0x74d3('0xde')](_0x44f3a4[0x0])||_[_0x74d3('0xde')](_0x44f3a4[0x0][_0x74d3('0x172')])||_['isNil'](_0x44f3a4[0x0][_0x74d3('0x172')][_0x74d3('0x196')])){_0x5d0af5['emptyContact'](_0x74d3('0x200'),_0xfb3716,_0x44f3a4[0x0]);}else{_0x5d0af5[_0x74d3('0xbc')](_[_0x74d3('0xd0')](_0x44f3a4[0x0],[_0x74d3('0xd4'),_0x74d3('0x20b')]))[_0x74d3('0xbe')](_0x5d0af5[_0x74d3('0x1e7')](_0xfb3716,_0x44f3a4[0x0]))[_0x74d3('0xb4')](_0x5d0af5[_0x74d3('0x201')](_0x74d3('0x20c'),_0xfb3716));}}})[_0x74d3('0xb4')](loggerGetContactDialer(_0x74d3('0x20d'),_0xfb3716,0x1));emitVoiceQueueSummary(_0xfb3716);};Dialer['prototype'][_0x74d3('0x1dd')]=function(_0x59e1b6,_0x319caa,_0x369f92,_0x501a26,_0x2d6330,_0x63e912){loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x20e'));loggerPredictive[_0x74d3('0x7b')]('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',_0x59e1b6);loggerPredictive['info'](_0x74d3('0x20f'),_0x319caa);loggerPredictive['info'](_0x74d3('0x210'),_0x369f92);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x211'),_0x501a26);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x212'),_0x2d6330);loggerPredictive[_0x74d3('0x7b')]('---------------------------');return new BPromise(function(_0x4ba51e,_0x519a54){if(_0x59e1b6<=0x0||isNaN(_0x59e1b6)){return _0x519a54(msgResponse(_0x74d3('0x213'),_0x74d3('0x43'),_0x74d3('0x214')+_0x59e1b6));}if(_0x369f92<=0x0||isNaN(_0x369f92)){return _0x519a54(msgResponse('[abandonmentRate]',_0x74d3('0x43'),_0x74d3('0x215')+_0x369f92));}if(_0x501a26<=0x0||isNaN(_0x501a26)){return _0x519a54(msgResponse('[abandonmentRate]',_0x74d3('0x43'),_0x74d3('0x216')+_0x501a26));}if(_0x319caa<=0x0||isNaN(_0x319caa)){return _0x519a54(msgResponse('[abandonmentRate]',_0x74d3('0x43'),'interval\x20=\x20'+_0x319caa));}if(_0x2d6330<=0x0||isNaN(_0x2d6330)){return _0x519a54(msgResponse(_0x74d3('0x213'),_0x74d3('0x43'),_0x74d3('0x217')+_0x2d6330));}_0x63e912=_0x63e912||0x0;var _0x5e27d1=0x1/_0x369f92;var _0x118c9e=0x0;var _0x2074ac=0x0;var _0x64338e=0x0;var _0x20f813=0x0;for(var _0x171ac5=0x0;_0x64338e<_0x2d6330;_0x171ac5+=0x1){_0x2074ac=_0x171ac5/_0x319caa;_0x118c9e=(_0x501a26*_0x2074ac+_0x63e912)/_0x5e27d1;_0x64338e=erlangb(_0x118c9e,_0x59e1b6);_0x20f813=_0x118c9e/_0x59e1b6*(0x1-erlangb(_0x118c9e,_0x59e1b6));}return _0x4ba51e({'erlangCalls':_0x171ac5,'erlangCallToSecond':_0x319caa/_0x171ac5,'erlangAbandonmentRate':_0x64338e,'erlangBusyFactor':_0x20f813});});};Dialer['prototype'][_0x74d3('0x1df')]=function(_0x33753c,_0x20679a,_0x30a07d,_0x2e5933,_0x59826f,_0x18f467){loggerPredictive['info'](_0x74d3('0x218'));loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x219'),_0x33753c);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x20f'),_0x20679a);loggerPredictive[_0x74d3('0x7b')]('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',_0x30a07d);loggerPredictive[_0x74d3('0x7b')](_0x74d3('0x211'),_0x2e5933);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59826f);loggerPredictive[_0x74d3('0x7b')]('---------------------------');return new BPromise(function(_0x37e7e3,_0x15535c){if(_0x33753c<=0x0||isNaN(_0x33753c)){return _0x15535c(msgResponse('[busyFactor]',_0x74d3('0x43'),_0x74d3('0x214')+_0x33753c));}if(_0x30a07d<=0x0||isNaN(_0x30a07d)){return _0x15535c(msgResponse(_0x74d3('0x21a'),_0x74d3('0x43'),_0x74d3('0x215')+_0x30a07d));}if(_0x2e5933<=0x0||isNaN(_0x2e5933)){return _0x15535c(msgResponse(_0x74d3('0x21a'),_0x74d3('0x43'),_0x74d3('0x216')+_0x2e5933));}if(_0x20679a<=0x0||isNaN(_0x20679a)){return _0x15535c(msgResponse('[busyFactor]','Error',_0x74d3('0x21b')+_0x20679a));}if(_0x59826f<=0x0||isNaN(_0x59826f)){return _0x15535c(msgResponse(_0x74d3('0x21a'),_0x74d3('0x43'),_0x74d3('0x21c')+_0x59826f));}_0x18f467=_0x18f467||0x0;var _0x5f350f=0x1/_0x30a07d;var _0x1d5026=0x0;var _0x4bc8d9=0x0;var _0x124288=0x0;var _0x167ff7=0x0;for(var _0x13a77a=0x0;_0x167ff7<_0x59826f;_0x13a77a+=0x1){_0x4bc8d9=_0x13a77a/_0x20679a;_0x1d5026=(_0x2e5933*_0x4bc8d9+_0x18f467)/_0x5f350f;_0x124288=erlangb(_0x1d5026,_0x33753c);_0x167ff7=_0x1d5026/_0x33753c*(0x1-erlangb(_0x1d5026,_0x33753c));}return _0x37e7e3({'erlangCalls':_0x13a77a,'erlangCallToSecond':_0x20679a/_0x13a77a,'erlangAbandonmentRate':_0x124288,'erlangBusyFactor':_0x167ff7});});};module[_0x74d3('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index fc762a9..2ffa8dc 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b0f=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x5b0f,0x134));var _0xf5b0=function(_0x5c9fff,_0x1124b5){_0x5c9fff=_0x5c9fff-0x0;var _0x335b76=_0x5b0f[_0x5c9fff];return _0x335b76;};'use strict';var util=require(_0xf5b0('0x0'));var _=require(_0xf5b0('0x1'));var moment=require('moment');function getSeconds(_0x492746,_0x59614c){var _0x49d2a8=moment(_0x492746)['milliseconds'](0x0);var _0x2f1231=moment(_0x59614c)[_0xf5b0('0x2')](0x0);return _0x49d2a8[_0xf5b0('0x3')](_0x2f1231,_0xf5b0('0x4'));}function QueueCallerAbandon(_0x5dc73b,_0x22377c){this[_0xf5b0('0x5')]=_0x5dc73b[_0xf5b0('0x5')];this[_0xf5b0('0x6')]=_0x5dc73b['type'];this[_0xf5b0('0x7')]=_0x5dc73b[_0xf5b0('0x6')]===_0xf5b0('0x8')?'queue':_0x5dc73b['type'];this['countbusyretry']=_0x5dc73b[_0xf5b0('0x9')];this['countcongestionretry']=_0x5dc73b[_0xf5b0('0xa')];this[_0xf5b0('0xb')]=_0x5dc73b[_0xf5b0('0xb')];this[_0xf5b0('0xc')]=_0x5dc73b[_0xf5b0('0x9')]+_0x5dc73b[_0xf5b0('0xa')]+_0x5dc73b[_0xf5b0('0xb')]+_0x5dc73b[_0xf5b0('0xd')]+_0x5dc73b[_0xf5b0('0xe')]+_0x5dc73b[_0xf5b0('0xf')]+_0x5dc73b[_0xf5b0('0x10')]+_0x5dc73b[_0xf5b0('0x11')];this[_0xf5b0('0xd')]=_0x5dc73b[_0xf5b0('0xd')];this[_0xf5b0('0xe')]=_0x5dc73b[_0xf5b0('0xe')];this['countabandonedretry']=_0x5dc73b[_0xf5b0('0xf')];this[_0xf5b0('0x10')]=_0x5dc73b[_0xf5b0('0x10')];this[_0xf5b0('0x11')]=_0x5dc73b['countagentrejectretry'];this[_0xf5b0('0x12')]=_0x22377c['uniqueid'];this[_0xf5b0('0x13')]=_0x5dc73b[_0xf5b0('0x14')];this[_0xf5b0('0x15')]=_0x5dc73b['number'];this[_0xf5b0('0x16')]=_0x5dc73b[_0xf5b0('0x16')];this[_0xf5b0('0x17')]=_0x5dc73b['responsetime'];this[_0xf5b0('0x18')]=_0x5dc73b[_0xf5b0('0x18')];this[_0xf5b0('0x19')]=this[_0xf5b0('0x18')];this[_0xf5b0('0x1a')]=getSeconds(_0x5dc73b[_0xf5b0('0x17')],_0x5dc73b[_0xf5b0('0x16')]);this[_0xf5b0('0x1b')]=getSeconds(this[_0xf5b0('0x18')],_0x5dc73b[_0xf5b0('0x17')]);this[_0xf5b0('0x1c')]=0x0;this[_0xf5b0('0x1d')]=_0x22377c[_0xf5b0('0x1d')];this[_0xf5b0('0x1e')]=_0x22377c[_0xf5b0('0x1f')];this['reason']=_0x22377c[_0xf5b0('0x20')];this['callback']=_0x5dc73b[_0xf5b0('0x21')];this[_0xf5b0('0x22')]=_0x5dc73b[_0xf5b0('0x22')];this[_0xf5b0('0x23')]=_0x5dc73b['callbackat'];this[_0xf5b0('0x24')]=_0x5dc73b[_0xf5b0('0x24')];this[_0xf5b0('0x25')]=_0x5dc73b[_0xf5b0('0x25')];this['ListId']=_0x5dc73b[_0xf5b0('0x26')];this[_0xf5b0('0x27')]=_0x5dc73b['UserId'];this[_0xf5b0('0x28')]=_0x5dc73b[_0xf5b0('0x28')];this[_0xf5b0('0x29')]=_0x5dc73b[_0xf5b0('0x29')];this['originatecalleridnum']=_0x5dc73b['originatecalleridnum']||'';this['originatecalleridname']=_0x5dc73b[_0xf5b0('0x2a')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x7810=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback'];(function(_0x37b599,_0x8e26cc){var _0x123314=function(_0x48a619){while(--_0x48a619){_0x37b599['push'](_0x37b599['shift']());}};_0x123314(++_0x8e26cc);}(_0x7810,0xbb));var _0x0781=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x7810[_0x565c49];return _0x20ca34;};'use strict';var util=require(_0x0781('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1276c9,_0x373f92){var _0x9b11ea=moment(_0x1276c9)['milliseconds'](0x0);var _0xc42f2e=moment(_0x373f92)[_0x0781('0x1')](0x0);return _0x9b11ea[_0x0781('0x2')](_0xc42f2e,_0x0781('0x3'));}function QueueCallerAbandon(_0x20c0cf,_0x587bc1){this['scheduledat']=_0x20c0cf[_0x0781('0x4')];this[_0x0781('0x5')]=_0x20c0cf[_0x0781('0x5')];this[_0x0781('0x6')]=_0x20c0cf[_0x0781('0x5')]===_0x0781('0x7')?_0x0781('0x8'):_0x20c0cf[_0x0781('0x5')];this['countbusyretry']=_0x20c0cf[_0x0781('0x9')];this[_0x0781('0xa')]=_0x20c0cf[_0x0781('0xa')];this[_0x0781('0xb')]=_0x20c0cf[_0x0781('0xb')];this[_0x0781('0xc')]=_0x20c0cf[_0x0781('0x9')]+_0x20c0cf['countcongestionretry']+_0x20c0cf[_0x0781('0xb')]+_0x20c0cf[_0x0781('0xd')]+_0x20c0cf[_0x0781('0xe')]+_0x20c0cf[_0x0781('0xf')]+_0x20c0cf[_0x0781('0x10')]+_0x20c0cf[_0x0781('0x11')];this[_0x0781('0xd')]=_0x20c0cf['countnosuchnumberretry'];this[_0x0781('0xe')]=_0x20c0cf[_0x0781('0xe')];this['countabandonedretry']=_0x20c0cf[_0x0781('0xf')];this[_0x0781('0x10')]=_0x20c0cf[_0x0781('0x10')];this[_0x0781('0x11')]=_0x20c0cf['countagentrejectretry'];this[_0x0781('0x12')]=_0x587bc1['uniqueid'];this[_0x0781('0x13')]=_0x20c0cf[_0x0781('0x14')];this['calleridnum']=_0x20c0cf[_0x0781('0x15')];this[_0x0781('0x16')]=_0x20c0cf[_0x0781('0x16')];this[_0x0781('0x17')]=_0x20c0cf[_0x0781('0x17')];this[_0x0781('0x18')]=_0x20c0cf[_0x0781('0x18')];this[_0x0781('0x19')]=this[_0x0781('0x18')];this[_0x0781('0x1a')]=getSeconds(_0x20c0cf['responsetime'],_0x20c0cf[_0x0781('0x16')]);this[_0x0781('0x1b')]=getSeconds(this[_0x0781('0x18')],_0x20c0cf[_0x0781('0x17')]);this[_0x0781('0x1c')]=0x0;this['queue']=_0x587bc1[_0x0781('0x8')];this[_0x0781('0x1d')]=_0x587bc1[_0x0781('0x1e')];this[_0x0781('0x1f')]=_0x587bc1[_0x0781('0x1f')];this[_0x0781('0x20')]=_0x20c0cf[_0x0781('0x20')];this[_0x0781('0x21')]=_0x20c0cf[_0x0781('0x21')];this['callbackat']=_0x20c0cf[_0x0781('0x22')];this[_0x0781('0x23')]=_0x20c0cf[_0x0781('0x23')];this[_0x0781('0x24')]=_0x20c0cf[_0x0781('0x24')];this[_0x0781('0x25')]=_0x20c0cf['ListId'];this[_0x0781('0x26')]=_0x20c0cf[_0x0781('0x26')];this[_0x0781('0x27')]=_0x20c0cf[_0x0781('0x27')];this[_0x0781('0x28')]=_0x20c0cf['CampaignId'];this[_0x0781('0x29')]=_0x20c0cf[_0x0781('0x29')]||'';this[_0x0781('0x2a')]=_0x20c0cf['originatecalleridname']||'';}module[_0x0781('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 39e2f57..e6e3ef0 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 _0x0422=['fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','channel','format','tech','Trunk','name'];(function(_0x5513dc,_0x347bd5){var _0x1ba8dc=function(_0x517a86){while(--_0x517a86){_0x5513dc['push'](_0x5513dc['shift']());}};_0x1ba8dc(++_0x347bd5);}(_0x0422,0xd8));var _0x2042=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x0422[_0x4e697a];return _0x88850c;};'use strict';var util=require(_0x2042('0x0'));var _=require(_0x2042('0x1'));var moment=require(_0x2042('0x2'));function Action(_0x4e31c7,_0x3b2743,_0x1da32b){this['uniqueid']=_0x4e31c7||undefined;this[_0x2042('0x3')]=util[_0x2042('0x4')]('%s/%s/%s',_0x3b2743[_0x2042('0x5')],_0x3b2743[_0x2042('0x6')][_0x2042('0x7')],_0x1da32b[_0x2042('0x8')]);this[_0x2042('0x9')]=_0x3b2743['localstationid'];this['headerinfo']=_0x3b2743[_0x2042('0xa')];this[_0x2042('0xb')]=_0x1da32b['path'];this[_0x2042('0xc')]=_0x1da32b[_0x2042('0xc')];}module[_0x2042('0xd')]=Action; \ No newline at end of file +var _0xd222=['util','moment','uniqueid','channel','format','%s/%s/%s','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xd222,0xcc));var _0x2d22=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xd222[_0x1030ce];return _0x3367fd;};'use strict';var util=require(_0x2d22('0x0'));var _=require('lodash');var moment=require(_0x2d22('0x1'));function Action(_0x28daae,_0x59cd6c,_0x2f2bd9){this[_0x2d22('0x2')]=_0x28daae||undefined;this[_0x2d22('0x3')]=util[_0x2d22('0x4')](_0x2d22('0x5'),_0x59cd6c['tech'],_0x59cd6c['Trunk'][_0x2d22('0x6')],_0x2f2bd9[_0x2d22('0x7')]);this[_0x2d22('0x8')]=_0x59cd6c['localstationid'];this[_0x2d22('0x9')]=_0x59cd6c[_0x2d22('0x9')];this['path']=_0x2f2bd9[_0x2d22('0xa')];this['AttachmentId']=_0x2f2bd9[_0x2d22('0xb')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 2e8c93f..367d438 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 _0x5052=['hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','Fax\x20failed','checkAfterSend','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','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','util','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x5052,0x13e));var _0x2505=function(_0x4ca29f,_0xbd0bdf){_0x4ca29f=_0x4ca29f-0x0;var _0xe8ce27=_0x5052[_0x4ca29f];return _0xe8ce27;};'use strict';var util=require(_0x2505('0x0'));var _=require('lodash');var BPromise=require(_0x2505('0x1'));var uuid=require(_0x2505('0x2'));var moment=require(_0x2505('0x3'));var path=require('path');var tiff2pdf=require(_0x2505('0x4'));var gs=require(_0x2505('0x5'));var logger=require(_0x2505('0x6'))('fax');var ami=require(_0x2505('0x7'));var rpcDb=require(_0x2505('0x8'));var Channel=require(_0x2505('0x9'));var ut=require(_0x2505('0xa'));var Action=require(_0x2505('0xb'));var faxAccount=require(_0x2505('0xc'));var attachment=require(_0x2505('0xd'));var faxMessage=require(_0x2505('0xe'));function Fax(_0x33d432){this[_0x2505('0xf')]={};this[_0x2505('0x10')]=_0x33d432['faxAccounts'];this['trunks']=_0x33d432['trunks'];this[_0x2505('0x11')]={};ami['on']('newchannel',this[_0x2505('0x12')][_0x2505('0x13')](this));ami['on'](_0x2505('0x14'),this[_0x2505('0x15')][_0x2505('0x13')](this));ami['on']('newstate',this[_0x2505('0x16')][_0x2505('0x13')](this));ami['on'](_0x2505('0x17'),this['syncNewExten'][_0x2505('0x13')](this));ami['on'](_0x2505('0x18'),this[_0x2505('0x19')][_0x2505('0x13')](this));ami['on'](_0x2505('0x1a'),this[_0x2505('0x1b')][_0x2505('0x13')](this));ami['on'](_0x2505('0x1c'),this[_0x2505('0x1d')][_0x2505('0x13')](this));ami['on']('originateresponse',this[_0x2505('0x1e')][_0x2505('0x13')](this));}Fax['prototype']['syncNewchannel']=function(_0x1c246a){if(_0x1c246a[_0x2505('0x1f')]===_0x2505('0x20')){for(var _0x4d36f7 in this[_0x2505('0x10')]){if(this[_0x2505('0x10')][_0x2505('0x21')](_0x4d36f7)){if(_0x1c246a[_0x2505('0x22')]===this[_0x2505('0x10')][_0x4d36f7][_0x2505('0x23')]){this[_0x2505('0xf')][_0x1c246a[_0x2505('0x24')]]={};this[_0x2505('0xf')][_0x1c246a[_0x2505('0x24')]][_0x2505('0x25')]=_0x1c246a[_0x2505('0x25')];this[_0x2505('0xf')][_0x1c246a['uniqueid']]['id']=this[_0x2505('0x10')][_0x4d36f7]['id'];this[_0x2505('0xf')][_0x1c246a[_0x2505('0x24')]][_0x2505('0x26')]=this[_0x2505('0x10')][_0x4d36f7][_0x2505('0x26')];logger[_0x2505('0x27')](_0x1c246a[_0x2505('0x24')],_0x2505('0x28'));}}}}if(this[_0x2505('0x11')][_0x1c246a['uniqueid']]){this['channels'][_0x1c246a[_0x2505('0x24')]]={};this[_0x2505('0xf')][_0x1c246a[_0x2505('0x24')]][_0x2505('0x25')]=_0x1c246a['channel'];logger[_0x2505('0x27')](_0x1c246a[_0x2505('0x24')],_0x2505('0x28'));}};Fax[_0x2505('0x29')][_0x2505('0x15')]=function(_0x291dea){if(this[_0x2505('0xf')][_0x291dea[_0x2505('0x24')]]){for(var _0x2a30cc in _0x291dea[_0x2505('0x2a')]){if(_0x291dea[_0x2505('0x2a')][_0x2505('0x21')](_0x2a30cc)){this[_0x2505('0xf')][_0x291dea[_0x2505('0x24')]][_0x2a30cc]=_0x291dea[_0x2505('0x2b')];}}}};Fax['prototype']['syncNewState']=function(_0x25f1e7){if(this[_0x2505('0xf')][_0x25f1e7[_0x2505('0x24')]]){this['channels'][_0x25f1e7[_0x2505('0x24')]][_0x2505('0x2c')]=_0x25f1e7['channelstate'];this[_0x2505('0xf')][_0x25f1e7[_0x2505('0x24')]]['channelstatedesc']=_0x25f1e7['channelstatedesc'];}};Fax['prototype'][_0x2505('0x2d')]=function(_0x361f8e){if(this[_0x2505('0xf')][_0x361f8e[_0x2505('0x24')]]){for(var _0x252246 in _0x361f8e['variable']){if(_0x361f8e[_0x2505('0x2a')][_0x2505('0x21')](_0x252246)){this[_0x2505('0xf')][_0x361f8e[_0x2505('0x24')]][_0x252246]=_0x361f8e[_0x2505('0x2b')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x309cd5){if(this[_0x2505('0xf')][_0x309cd5[_0x2505('0x24')]]){this['channels'][_0x309cd5[_0x2505('0x24')]]['operation']=_0x309cd5[_0x2505('0x2e')];this[_0x2505('0xf')][_0x309cd5[_0x2505('0x24')]]['status']=_0x309cd5[_0x2505('0x2f')];this[_0x2505('0xf')][_0x309cd5['uniqueid']][_0x2505('0x23')]=_0x309cd5[_0x2505('0x23')];this[_0x2505('0xf')][_0x309cd5['uniqueid']][_0x2505('0x30')]=_0x309cd5['filename'];logger[_0x2505('0x27')](_0x309cd5[_0x2505('0x24')],_0x2505('0x31'));}};Fax[_0x2505('0x29')][_0x2505('0x1b')]=function(_0x208e0){var _0x114f88=this;if(this[_0x2505('0xf')][_0x208e0[_0x2505('0x24')]]){var _0x86e094=this[_0x2505('0xf')][_0x208e0['uniqueid']]['id'];this[_0x2505('0xf')][_0x208e0[_0x2505('0x24')]]['remotestationid']=_0x208e0[_0x2505('0x32')];this['channels'][_0x208e0[_0x2505('0x24')]][_0x2505('0x33')]=_0x208e0[_0x2505('0x33')];this[_0x2505('0xf')][_0x208e0[_0x2505('0x24')]][_0x2505('0x23')]=_0x208e0['localstationid'];this[_0x2505('0xf')][_0x208e0[_0x2505('0x24')]][_0x2505('0x34')]=_0x208e0[_0x2505('0x34')];this['channels'][_0x208e0[_0x2505('0x24')]][_0x2505('0x35')]=_0x208e0['transferrate'];this['channels'][_0x208e0[_0x2505('0x24')]]['filename']=_0x208e0['filename'];this[_0x2505('0xf')][_0x208e0[_0x2505('0x24')]]['calleridnum']=_0x208e0[_0x2505('0x36')];if(this[_0x2505('0xf')][_0x208e0[_0x2505('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x208e0['filename'],_0x2505('0x37'),function(_0x5f011a){logger[_0x2505('0x27')](_0x208e0[_0x2505('0x24')],'\x20result\x20conversion\x20file\x20',_0x5f011a[_0x2505('0x38')]);attachment[_0x2505('0x39')]({'name':path['parse'](_0x208e0[_0x2505('0x30')])[_0x2505('0x26')],'basename':path[_0x2505('0x3a')](_0x208e0['filename'])[_0x2505('0x26')]+_0x2505('0x3b'),'type':_0x2505('0x3c')})[_0x2505('0x3d')](function(_0x1242c7){faxAccount[_0x2505('0x3e')](_0x86e094,{'from':_0x208e0[_0x2505('0x36')],'mapKey':_0x2505('0x3f'),'body':path[_0x2505('0x3a')](_0x208e0[_0x2505('0x30')])[_0x2505('0x26')]+_0x2505('0x3b'),'AttachmentId':_0x1242c7['id']})[_0x2505('0x40')](function(_0xbb9c17){logger[_0x2505('0x41')](_0x208e0[_0x2505('0x24')],_0x2505('0x42'),JSON['stringify'](_0xbb9c17));});})['catch'](function(_0x308bef){logger[_0x2505('0x41')](_0x208e0[_0x2505('0x24')],_0x2505('0x43'),JSON[_0x2505('0x44')](_0x308bef));});});}logger[_0x2505('0x27')](_0x208e0[_0x2505('0x24')],_0x2505('0x43'));}};Fax[_0x2505('0x29')][_0x2505('0x1e')]=function(_0x3a0796){if(this['actions'][_0x3a0796[_0x2505('0x24')]]){_['merge'](this[_0x2505('0xf')][_0x3a0796[_0x2505('0x24')]],_[_0x2505('0x45')](_0x3a0796,[_0x2505('0x46'),_0x2505('0x47')]));}};function updateStatus(_0x460701){if(_0x460701[_0x2505('0x48')]){faxMessage[_0x2505('0x49')](_0x460701[_0x2505('0x48')],{'failMessage':_0x2505('0x4a')})['then'](function(_0x565639){ut[_0x2505('0x4b')]('[Fax][Message][Error][Updated]',_0x565639);})[_0x2505('0x40')](function(_0x13b339){ut[_0x2505('0x4b')]('[Fax][Message][Error][NoUpdate1]',_0x13b339);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x2505('0x29')][_0x2505('0x4c')]=function(_0x492997,_0x130fe2,_0xa8a923){var _0x522338=this;var _0xd7c517={};if(_0x130fe2){_0xd7c517={'read':_0x130fe2};}else{_0xd7c517={'failMessage':_0xa8a923};}if(this[_0x2505('0x11')][_0x492997][_0x2505('0x48')]){faxMessage['update'](this[_0x2505('0x11')][_0x492997][_0x2505('0x48')],_0xd7c517)[_0x2505('0x3d')](function(_0x186aa2){ut[_0x2505('0x4b')](_0x2505('0x4d'),_0x186aa2);})[_0x2505('0x40')](function(_0xdf0c2){ut[_0x2505('0x4b')](_0x2505('0x4e'),_0xdf0c2);})[_0x2505('0x4f')](function(){delete _0x522338[_0x2505('0xf')][_0x492997];delete _0x522338['actions'][_0x492997];});}else{ut[_0x2505('0x4b')]('[Fax][Message][NoUpdate2]');delete this[_0x2505('0xf')][_0x492997];delete this[_0x2505('0x11')][_0x492997];}};Fax[_0x2505('0x29')][_0x2505('0x1d')]=function(_0x4b7d34){var _0x346d6a=this;if(this['channels'][_0x4b7d34[_0x2505('0x24')]]){if(this[_0x2505('0x11')][_0x4b7d34[_0x2505('0x24')]]){this[_0x2505('0xf')][_0x4b7d34[_0x2505('0x24')]]['id']=this[_0x2505('0x11')][_0x4b7d34[_0x2505('0x24')]]['id'];this['channels'][_0x4b7d34['uniqueid']]['name']=this[_0x2505('0x11')][_0x4b7d34[_0x2505('0x24')]][_0x2505('0x26')];}logger['info'](_0x4b7d34[_0x2505('0x24')],this[_0x2505('0x11')][_0x4b7d34[_0x2505('0x24')]]?_0x2505('0x50'):'\x20hangup\x20faxRiceive\x20',JSON[_0x2505('0x44')](this[_0x2505('0xf')][_0x4b7d34[_0x2505('0x24')]]));if(this[_0x2505('0x11')][_0x4b7d34['uniqueid']]){if(this[_0x2505('0xf')][_0x4b7d34[_0x2505('0x24')]][_0x2505('0x51')]>0x0&&this['channels'][_0x4b7d34[_0x2505('0x24')]][_0x2505('0x18')]===_0x2505('0x52')){this[_0x2505('0x4c')](_0x4b7d34['uniqueid'],!![]);}else{this[_0x2505('0x4c')](_0x4b7d34['uniqueid'],![],this[_0x2505('0xf')][_0x4b7d34[_0x2505('0x24')]][_0x2505('0x53')]?'SENDING\x20FAILED:\x20'+this[_0x2505('0xf')][_0x4b7d34[_0x2505('0x24')]][_0x2505('0x53')]:_0x2505('0x54'));}}}};Fax[_0x2505('0x29')][_0x2505('0x55')]=function(_0x52decc){var _0x5c3cf1=this;return new BPromise(function(_0x189e5c,_0x20db21){_0x5c3cf1[_0x2505('0x56')](_0x52decc,_0x5c3cf1[_0x2505('0x10')][_0x52decc[_0x2505('0x57')]])[_0x2505('0x3d')](function(_0x4f4523){ut[_0x2505('0x4b')]('[Fax][execOriginate][success]',_0x4f4523);_0x189e5c(ut[_0x2505('0x38')](_0x2505('0x58')));})[_0x2505('0x40')](function(_0x447137){ut['logger']('[Fax][execOriginate][failure]',_0x447137);updateStatus(_0x52decc);_0x20db21(ut[_0x2505('0x38')](_0x2505('0x59')));});});};Fax[_0x2505('0x29')][_0x2505('0x5a')]=function(_0x5a42c){var _0x2dd633=this;return new BPromise(function(_0x57f7fa,_0x3e2cfa){var _0x218d05=_0x2dd633[_0x2505('0x5b')](_0x2dd633['faxAccounts'][_0x5a42c[_0x2505('0x57')]][_0x2505('0x5c')],_0x5a42c);if(_0x218d05[_0x2505('0x5d')]){_0x57f7fa(ut[_0x2505('0x38')]('Trunk\x20Reachable'));}else{_0x3e2cfa(ut[_0x2505('0x38')](_0x218d05[_0x2505('0x38')]));}});};function originate(_0x4cb557,_0x3b5ead,_0x1bf6f6){return new BPromise(function(_0x176b30,_0x470118){if(_0x1bf6f6){var _0x1ea31c=util[_0x2505('0x5e')](_0x2505('0x5f'),path['parse'](_0x4cb557[_0x2505('0x60')])[_0x2505('0x26')],_0x4cb557[_0x2505('0x60')]);gs[_0x2505('0x61')](_0x1ea31c)['then'](function(){_0x4cb557[_0x2505('0x60')]=util['format'](_0x2505('0x62'),path[_0x2505('0x3a')](_0x4cb557['path'])['dir'],path[_0x2505('0x3a')](_0x4cb557[_0x2505('0x60')])[_0x2505('0x26')]);_0x3b5ead[_0x2505('0x63')]=_0x4cb557['path'];ut['logger'](_0x2505('0x64'),'');ami[_0x2505('0x65')](ut[_0x2505('0x66')](_0x4cb557,_0x3b5ead))[_0x2505('0x3d')](function(_0x56103f){_0x176b30(_0x56103f);})[_0x2505('0x40')](function(_0x3dee4e){_0x470118(_0x3dee4e);});})['catch'](function(_0x5e1d02){_0x470118(_0x5e1d02);});}else{ami[_0x2505('0x65')](ut[_0x2505('0x66')](_0x4cb557,_0x3b5ead))[_0x2505('0x3d')](function(_0x6dc8f6){_0x176b30(_0x6dc8f6);})[_0x2505('0x40')](function(_0x27e6a5){_0x470118(_0x27e6a5);});}});}Fax[_0x2505('0x29')][_0x2505('0x56')]=function(_0xbcec1f,_0x39c8f1){var _0x3ba30d=this;return new BPromise(function(_0x25a868,_0x41a4a6){var _0x44fb25=uuid['v4']();var _0x221b14=ut[_0x2505('0x67')](_0xbcec1f,_0x39c8f1);_0x3ba30d[_0x2505('0x11')][_0x44fb25]=new Action(_0x44fb25,_0x39c8f1,_0xbcec1f);var _0x319c10=_0x3ba30d[_0x2505('0x11')][_0x44fb25];if(path[_0x2505('0x3a')](_0xbcec1f[_0x2505('0x60')])[_0x2505('0x68')]===_0x2505('0x3b')){originate(_0x319c10,_0x221b14,!![])['then'](function(_0x4748ed){_0x25a868(_0x4748ed);})['catch'](function(_0xb99a22){_0x41a4a6(_0xb99a22);});}else{originate(_0x319c10,_0x221b14,![])['then'](function(_0x426995){_0x25a868(_0x426995);})[_0x2505('0x40')](function(_0x206bb1){_0x41a4a6(_0x206bb1);});}});};Fax[_0x2505('0x29')][_0x2505('0x69')]=function(_0xc6762e){return!_[_0x2505('0x6a')](_0xc6762e)&&!_['isNil'](_0xc6762e[_0x2505('0x26')])&&!_[_0x2505('0x6a')](_0xc6762e[_0x2505('0x6b')])&&_0xc6762e['active']&&!_[_0x2505('0x6a')](this[_0x2505('0x6c')][util['format']('SIP/%s',_0xc6762e['name'])])&&!_['isNil'](this[_0x2505('0x6c')][util['format'](_0x2505('0x6d'),_0xc6762e['name'])][_0x2505('0x2f')])&&(this[_0x2505('0x6c')][util[_0x2505('0x5e')](_0x2505('0x6d'),_0xc6762e[_0x2505('0x26')])][_0x2505('0x2f')]===_0x2505('0x6e')||this['trunks'][util[_0x2505('0x5e')]('SIP/%s',_0xc6762e[_0x2505('0x26')])]['status']===_0x2505('0x6f'));};Fax['prototype'][_0x2505('0x5b')]=function(_0x39f6a6,_0x40c509){if(!this['isTrunkReachable'](_0x39f6a6)){ut['logger'](_0x2505('0x70'),_[_0x2505('0x6a')](_0x39f6a6)?'':_0x39f6a6['name']+_0x2505('0x71'));return{'isValid':![],'message':_0x2505('0x72')};}if(_[_0x2505('0x6a')](_0x40c509['fax'])){ut['logger'](_0x2505('0x73'),JSON[_0x2505('0x44')](_0x40c509));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2505('0x6a')](_0x40c509[_0x2505('0x60')])){ut[_0x2505('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x2505('0x44')](_0x40c509));return{'isValid':![],'message':_0x2505('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x22d1=['hangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','localstationid','uniqueid','name','\x20syncNewchannel\x20','channel','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','status','filename','info','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20received','Fax\x20failed','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x22d1,0x1a6));var _0x122d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x22d1[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x122d('0x0'));var _=require('lodash');var BPromise=require(_0x122d('0x1'));var uuid=require(_0x122d('0x2'));var moment=require(_0x122d('0x3'));var path=require(_0x122d('0x4'));var tiff2pdf=require(_0x122d('0x5'));var gs=require(_0x122d('0x6'));var logger=require('../../../config/logger')(_0x122d('0x7'));var ami=require(_0x122d('0x8'));var rpcDb=require(_0x122d('0x9'));var Channel=require(_0x122d('0xa'));var ut=require(_0x122d('0xb'));var Action=require('./action');var faxAccount=require(_0x122d('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x122d('0xd'));function Fax(_0x1047c2){this[_0x122d('0xe')]={};this[_0x122d('0xf')]=_0x1047c2[_0x122d('0xf')];this['trunks']=_0x1047c2[_0x122d('0x10')];this[_0x122d('0x11')]={};ami['on']('newchannel',this[_0x122d('0x12')]['bind'](this));ami['on'](_0x122d('0x13'),this['syncVarSet'][_0x122d('0x14')](this));ami['on'](_0x122d('0x15'),this[_0x122d('0x16')]['bind'](this));ami['on'](_0x122d('0x17'),this['syncNewExten'][_0x122d('0x14')](this));ami['on'](_0x122d('0x18'),this[_0x122d('0x19')][_0x122d('0x14')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x122d('0x14')](this));ami['on'](_0x122d('0x1a'),this['syncHangup'][_0x122d('0x14')](this));ami['on'](_0x122d('0x1b'),this[_0x122d('0x1c')]['bind'](this));}Fax['prototype'][_0x122d('0x12')]=function(_0x1a6b13){if(_0x1a6b13[_0x122d('0x1d')]==='from-voip-provider'){for(var _0xf0c47e in this[_0x122d('0xf')]){if(this['faxAccounts'][_0x122d('0x1e')](_0xf0c47e)){if(_0x1a6b13['exten']===this['faxAccounts'][_0xf0c47e][_0x122d('0x1f')]){this[_0x122d('0xe')][_0x1a6b13[_0x122d('0x20')]]={};this[_0x122d('0xe')][_0x1a6b13['uniqueid']]['channel']=_0x1a6b13['channel'];this[_0x122d('0xe')][_0x1a6b13['uniqueid']]['id']=this[_0x122d('0xf')][_0xf0c47e]['id'];this[_0x122d('0xe')][_0x1a6b13['uniqueid']]['name']=this['faxAccounts'][_0xf0c47e][_0x122d('0x21')];logger['info'](_0x1a6b13[_0x122d('0x20')],_0x122d('0x22'));}}}}if(this[_0x122d('0x11')][_0x1a6b13[_0x122d('0x20')]]){this['channels'][_0x1a6b13['uniqueid']]={};this['channels'][_0x1a6b13['uniqueid']]['channel']=_0x1a6b13[_0x122d('0x23')];logger['info'](_0x1a6b13[_0x122d('0x20')],_0x122d('0x22'));}};Fax[_0x122d('0x24')][_0x122d('0x25')]=function(_0x6e30b2){if(this['channels'][_0x6e30b2['uniqueid']]){for(var _0x3e664d in _0x6e30b2['variable']){if(_0x6e30b2[_0x122d('0x26')][_0x122d('0x1e')](_0x3e664d)){this[_0x122d('0xe')][_0x6e30b2[_0x122d('0x20')]][_0x3e664d]=_0x6e30b2[_0x122d('0x27')];}}}};Fax['prototype'][_0x122d('0x16')]=function(_0x36fcd3){if(this[_0x122d('0xe')][_0x36fcd3[_0x122d('0x20')]]){this['channels'][_0x36fcd3['uniqueid']][_0x122d('0x28')]=_0x36fcd3[_0x122d('0x28')];this['channels'][_0x36fcd3['uniqueid']]['channelstatedesc']=_0x36fcd3[_0x122d('0x29')];}};Fax[_0x122d('0x24')]['syncNewExten']=function(_0x142b20){if(this['channels'][_0x142b20[_0x122d('0x20')]]){for(var _0x20dd26 in _0x142b20[_0x122d('0x26')]){if(_0x142b20['variable'][_0x122d('0x1e')](_0x20dd26)){this[_0x122d('0xe')][_0x142b20[_0x122d('0x20')]][_0x20dd26]=_0x142b20[_0x122d('0x27')];}}}};Fax[_0x122d('0x24')][_0x122d('0x19')]=function(_0x42ce0e){if(this[_0x122d('0xe')][_0x42ce0e[_0x122d('0x20')]]){this['channels'][_0x42ce0e[_0x122d('0x20')]]['operation']=_0x42ce0e['operation'];this['channels'][_0x42ce0e['uniqueid']][_0x122d('0x2a')]=_0x42ce0e[_0x122d('0x2a')];this[_0x122d('0xe')][_0x42ce0e['uniqueid']][_0x122d('0x1f')]=_0x42ce0e[_0x122d('0x1f')];this[_0x122d('0xe')][_0x42ce0e[_0x122d('0x20')]][_0x122d('0x2b')]=_0x42ce0e['filename'];logger[_0x122d('0x2c')](_0x42ce0e['uniqueid'],_0x122d('0x2d'));}};Fax[_0x122d('0x24')][_0x122d('0x2e')]=function(_0x4f9cd1){var _0x49a9f8=this;if(this['channels'][_0x4f9cd1[_0x122d('0x20')]]){var _0x55274c=this[_0x122d('0xe')][_0x4f9cd1[_0x122d('0x20')]]['id'];this[_0x122d('0xe')][_0x4f9cd1['uniqueid']][_0x122d('0x2f')]=_0x4f9cd1[_0x122d('0x2f')];this[_0x122d('0xe')][_0x4f9cd1[_0x122d('0x20')]]['pagestransferred']=_0x4f9cd1[_0x122d('0x30')];this['channels'][_0x4f9cd1[_0x122d('0x20')]][_0x122d('0x1f')]=_0x4f9cd1[_0x122d('0x1f')];this[_0x122d('0xe')][_0x4f9cd1[_0x122d('0x20')]]['resolution']=_0x4f9cd1[_0x122d('0x31')];this[_0x122d('0xe')][_0x4f9cd1[_0x122d('0x20')]][_0x122d('0x32')]=_0x4f9cd1[_0x122d('0x32')];this['channels'][_0x4f9cd1[_0x122d('0x20')]]['filename']=_0x4f9cd1[_0x122d('0x2b')];this[_0x122d('0xe')][_0x4f9cd1[_0x122d('0x20')]]['calleridnum']=_0x4f9cd1[_0x122d('0x33')];if(this[_0x122d('0xe')][_0x4f9cd1['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4f9cd1[_0x122d('0x2b')],_0x122d('0x34'),function(_0x11a909){logger[_0x122d('0x2c')](_0x4f9cd1['uniqueid'],_0x122d('0x35'),_0x11a909[_0x122d('0x36')]);attachment['create']({'name':path[_0x122d('0x37')](_0x4f9cd1[_0x122d('0x2b')])[_0x122d('0x21')],'basename':path[_0x122d('0x37')](_0x4f9cd1['filename'])[_0x122d('0x21')]+_0x122d('0x38'),'type':'application/pdf'})[_0x122d('0x39')](function(_0x285650){faxAccount[_0x122d('0x3a')](_0x55274c,{'from':_0x4f9cd1[_0x122d('0x33')],'mapKey':'fax','body':path[_0x122d('0x37')](_0x4f9cd1[_0x122d('0x2b')])[_0x122d('0x21')]+_0x122d('0x38'),'AttachmentId':_0x285650['id']})['catch'](function(_0xdcca68){logger[_0x122d('0x3b')](_0x4f9cd1[_0x122d('0x20')],_0x122d('0x3c'),JSON[_0x122d('0x3d')](_0xdcca68));});})[_0x122d('0x3e')](function(_0x37c318){logger[_0x122d('0x3b')](_0x4f9cd1[_0x122d('0x20')],'\x20receiveFax\x20',JSON[_0x122d('0x3d')](_0x37c318));});});}logger[_0x122d('0x2c')](_0x4f9cd1[_0x122d('0x20')],_0x122d('0x3f'));}};Fax[_0x122d('0x24')]['syncOriginateResponse']=function(_0x455208){if(this[_0x122d('0x11')][_0x455208[_0x122d('0x20')]]){_[_0x122d('0x40')](this[_0x122d('0xe')][_0x455208[_0x122d('0x20')]],_[_0x122d('0x41')](_0x455208,['response',_0x122d('0x42')]));}};function updateStatus(_0x24e60f){if(_0x24e60f['AttachmentId']){faxMessage[_0x122d('0x43')](_0x24e60f[_0x122d('0x44')],{'failMessage':_0x122d('0x45')})[_0x122d('0x39')](function(_0x2a1222){ut[_0x122d('0x46')]('[Fax][Message][Error][Updated]',_0x2a1222);})[_0x122d('0x3e')](function(_0x1de19f){ut[_0x122d('0x46')](_0x122d('0x47'),_0x1de19f);});}else{ut[_0x122d('0x46')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x122d('0x24')][_0x122d('0x48')]=function(_0x26c7e9,_0x4479b9,_0x21a23b){var _0xf6c2f3=this;var _0x22742d={};if(_0x4479b9){_0x22742d={'read':_0x4479b9};}else{_0x22742d={'failMessage':_0x21a23b};}if(this[_0x122d('0x11')][_0x26c7e9][_0x122d('0x44')]){faxMessage[_0x122d('0x43')](this[_0x122d('0x11')][_0x26c7e9]['AttachmentId'],_0x22742d)['then'](function(_0x187e1a){ut[_0x122d('0x46')](_0x122d('0x49'),_0x187e1a);})[_0x122d('0x3e')](function(_0x327f2e){ut[_0x122d('0x46')](_0x122d('0x4a'),_0x327f2e);})[_0x122d('0x4b')](function(){delete _0xf6c2f3['channels'][_0x26c7e9];delete _0xf6c2f3['actions'][_0x26c7e9];});}else{ut[_0x122d('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x122d('0xe')][_0x26c7e9];delete this[_0x122d('0x11')][_0x26c7e9];}};Fax[_0x122d('0x24')][_0x122d('0x4c')]=function(_0x36ca15){var _0x4ff1b5=this;if(this[_0x122d('0xe')][_0x36ca15[_0x122d('0x20')]]){if(this[_0x122d('0x11')][_0x36ca15[_0x122d('0x20')]]){this[_0x122d('0xe')][_0x36ca15[_0x122d('0x20')]]['id']=this[_0x122d('0x11')][_0x36ca15['uniqueid']]['id'];this[_0x122d('0xe')][_0x36ca15['uniqueid']][_0x122d('0x21')]=this[_0x122d('0x11')][_0x36ca15[_0x122d('0x20')]][_0x122d('0x21')];}logger['info'](_0x36ca15[_0x122d('0x20')],this['actions'][_0x36ca15['uniqueid']]?_0x122d('0x4d'):_0x122d('0x4e'),JSON[_0x122d('0x3d')](this[_0x122d('0xe')][_0x36ca15[_0x122d('0x20')]]));if(this['actions'][_0x36ca15['uniqueid']]){if(this['channels'][_0x36ca15[_0x122d('0x20')]][_0x122d('0x4f')]>0x0&&this[_0x122d('0xe')][_0x36ca15[_0x122d('0x20')]][_0x122d('0x18')]===_0x122d('0x50')){this[_0x122d('0x48')](_0x36ca15[_0x122d('0x20')],!![]);}else{this['updateStatus'](_0x36ca15[_0x122d('0x20')],![],this['channels'][_0x36ca15[_0x122d('0x20')]]['faxstatusstring']?_0x122d('0x51')+this[_0x122d('0xe')][_0x36ca15['uniqueid']]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x122d('0x52')]=function(_0xae3a2b){var _0x4b5683=this;return new BPromise(function(_0x267f34,_0x9914a4){_0x4b5683[_0x122d('0x53')](_0xae3a2b,_0x4b5683[_0x122d('0xf')][_0xae3a2b[_0x122d('0x54')]])[_0x122d('0x39')](function(_0x3667b4){ut[_0x122d('0x46')]('[Fax][execOriginate][success]',_0x3667b4);_0x267f34(ut[_0x122d('0x36')](_0x122d('0x55')));})[_0x122d('0x3e')](function(_0x41a940){ut[_0x122d('0x46')]('[Fax][execOriginate][failure]',_0x41a940);updateStatus(_0xae3a2b);_0x9914a4(ut[_0x122d('0x36')](_0x122d('0x56')));});});};Fax['prototype']['checkAfterSend']=function(_0x5ce7a2){var _0x2003d6=this;return new BPromise(function(_0x146bc7,_0x2ec031){var _0x387636=_0x2003d6[_0x122d('0x57')](_0x2003d6['faxAccounts'][_0x5ce7a2['FaxAccountId']][_0x122d('0x58')],_0x5ce7a2);if(_0x387636[_0x122d('0x59')]){_0x146bc7(ut[_0x122d('0x36')]('Trunk\x20Reachable'));}else{_0x2ec031(ut['message'](_0x387636[_0x122d('0x36')]));}});};function originate(_0x366e7e,_0x33a182,_0x56e378){return new BPromise(function(_0x13de88,_0x27089f){if(_0x56e378){var _0x1aae03=util['format'](_0x122d('0x5a'),path['parse'](_0x366e7e[_0x122d('0x4')])['name'],_0x366e7e[_0x122d('0x4')]);gs[_0x122d('0x5b')](_0x1aae03)[_0x122d('0x39')](function(){_0x366e7e[_0x122d('0x4')]=util[_0x122d('0x5c')](_0x122d('0x5d'),path['parse'](_0x366e7e[_0x122d('0x4')])[_0x122d('0x5e')],path['parse'](_0x366e7e[_0x122d('0x4')])['name']);_0x33a182[_0x122d('0x5f')]=_0x366e7e['path'];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x122d('0x60')](ut[_0x122d('0x61')](_0x366e7e,_0x33a182))[_0x122d('0x39')](function(_0x2663f9){_0x13de88(_0x2663f9);})[_0x122d('0x3e')](function(_0x12d35a){_0x27089f(_0x12d35a);});})[_0x122d('0x3e')](function(_0x52444e){_0x27089f(_0x52444e);});}else{ami[_0x122d('0x60')](ut[_0x122d('0x61')](_0x366e7e,_0x33a182))[_0x122d('0x39')](function(_0x29b045){_0x13de88(_0x29b045);})[_0x122d('0x3e')](function(_0x17912b){_0x27089f(_0x17912b);});}});}Fax[_0x122d('0x24')][_0x122d('0x53')]=function(_0x22fe2f,_0x13f1e1){var _0x108a5c=this;return new BPromise(function(_0x3bbbd4,_0x4b00d0){var _0xad7b96=uuid['v4']();var _0xddbe9d=ut[_0x122d('0x62')](_0x22fe2f,_0x13f1e1);_0x108a5c['actions'][_0xad7b96]=new Action(_0xad7b96,_0x13f1e1,_0x22fe2f);var _0xd6863f=_0x108a5c[_0x122d('0x11')][_0xad7b96];if(path[_0x122d('0x37')](_0x22fe2f[_0x122d('0x4')])['ext']===_0x122d('0x38')){originate(_0xd6863f,_0xddbe9d,!![])[_0x122d('0x39')](function(_0x87bf09){_0x3bbbd4(_0x87bf09);})[_0x122d('0x3e')](function(_0x5f44fb){_0x4b00d0(_0x5f44fb);});}else{originate(_0xd6863f,_0xddbe9d,![])[_0x122d('0x39')](function(_0x64663f){_0x3bbbd4(_0x64663f);})['catch'](function(_0x58a4d5){_0x4b00d0(_0x58a4d5);});}});};Fax[_0x122d('0x24')][_0x122d('0x63')]=function(_0x562e41){return!_['isNil'](_0x562e41)&&!_[_0x122d('0x64')](_0x562e41[_0x122d('0x21')])&&!_[_0x122d('0x64')](_0x562e41[_0x122d('0x65')])&&_0x562e41[_0x122d('0x65')]&&!_[_0x122d('0x64')](this[_0x122d('0x10')][util[_0x122d('0x5c')]('SIP/%s',_0x562e41['name'])])&&!_[_0x122d('0x64')](this[_0x122d('0x10')][util[_0x122d('0x5c')](_0x122d('0x66'),_0x562e41[_0x122d('0x21')])][_0x122d('0x2a')])&&(this[_0x122d('0x10')][util[_0x122d('0x5c')]('SIP/%s',_0x562e41[_0x122d('0x21')])][_0x122d('0x2a')]===_0x122d('0x67')||this[_0x122d('0x10')][util[_0x122d('0x5c')](_0x122d('0x66'),_0x562e41[_0x122d('0x21')])][_0x122d('0x2a')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0xbd35fb,_0x377096){if(!this[_0x122d('0x63')](_0xbd35fb)){ut['logger'](_0x122d('0x68'),_[_0x122d('0x64')](_0xbd35fb)?'':_0xbd35fb[_0x122d('0x21')]+_0x122d('0x69'));return{'isValid':![],'message':_0x122d('0x6a')};}if(_[_0x122d('0x64')](_0x377096['fax'])){ut[_0x122d('0x46')](_0x122d('0x6b'),JSON[_0x122d('0x3d')](_0x377096));return{'isValid':![],'message':_0x122d('0x6c')};}if(_[_0x122d('0x64')](_0x377096[_0x122d('0x4')])){ut[_0x122d('0x46')](_0x122d('0x6d'),JSON[_0x122d('0x3d')](_0x377096));return{'isValid':![],'message':_0x122d('0x6e')};}return{'isValid':!![],'message':_0x122d('0x6f')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fa33acf..791f874 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 _0xf5ab=['preview','lodash','error','inspect','resolve','then','notify','catch','util','../../../config/logger'];(function(_0x320d4a,_0x123103){var _0x37c05a=function(_0x4b6a47){while(--_0x4b6a47){_0x320d4a['push'](_0x320d4a['shift']());}};_0x37c05a(++_0x123103);}(_0xf5ab,0xa8));var _0xbf5a=function(_0x18a016,_0x9be28b){_0x18a016=_0x18a016-0x0;var _0x19f6c5=_0xf5ab[_0x18a016];return _0x19f6c5;};'use strict';var util=require(_0xbf5a('0x0'));var BPromise=require('bluebird');var logger=require(_0xbf5a('0x1'))(_0xbf5a('0x2'));var _=require(_0xbf5a('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x184720){return function(_0x4aaa41){logger[_0xbf5a('0x4')](_0x184720,util[_0xbf5a('0x5')](_0x4aaa41,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4632f3,_0x3f2339){return BPromise[_0xbf5a('0x6')]()[_0xbf5a('0x7')](faxAccount[_0xbf5a('0x8')](_0x4632f3,_0x3f2339))[_0xbf5a('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x113a=['error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x113a,0x13a));var _0xa113=function(_0x1f6b9e,_0xcb26e4){_0x1f6b9e=_0x1f6b9e-0x0;var _0x429cbc=_0x113a[_0x1f6b9e];return _0x429cbc;};'use strict';var util=require(_0xa113('0x0'));var BPromise=require(_0xa113('0x1'));var logger=require(_0xa113('0x2'))(_0xa113('0x3'));var _=require('lodash');var faxAccount=require(_0xa113('0x4'));function loggerCatch(_0x67b349){return function(_0x40dd4e){logger[_0xa113('0x5')](_0x67b349,util['inspect'](_0x40dd4e,{'showHidden':![],'depth':null}));};}exports[_0xa113('0x6')]=function(_0x482a93,_0x29675e){return BPromise[_0xa113('0x7')]()[_0xa113('0x8')](faxAccount[_0xa113('0x6')](_0x482a93,_0x29675e))[_0xa113('0x9')](loggerCatch(_0xa113('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index f0358a6..945eef7 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 _0x965b=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x965b,0x187));var _0xb965=function(_0x40af21,_0x1365cb){_0x40af21=_0x40af21-0x0;var _0x2a42a6=_0x965b[_0x40af21];return _0x2a42a6;};'use strict';var util=require('util');var logger=require(_0xb965('0x0'))(_0xb965('0x1'));var BPromise=require(_0xb965('0x2'));var exec=require(_0xb965('0x3'))[_0xb965('0x4')];exports['execute']=function(_0x524658){return new BPromise(function(_0x3dc882,_0x413dec){exec(_0x524658,function(_0x4402da,_0x27cb1a,_0x4c45fd){logger[_0xb965('0x5')](_0xb965('0x6'),_0x27cb1a);if(_0x4402da){logger[_0xb965('0x5')](_0xb965('0x6'),_0xb965('0x7'),util[_0xb965('0x8')](_0x4402da,{'showHidden':![],'depth':null}),_0x27cb1a,_0x4c45fd);_0x413dec(_0x4402da);}_0x3dc882(_0x27cb1a);});});}; \ No newline at end of file +var _0x842a=['../../../../config/logger','fax','child_process','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x4ad12d,_0x3dcea5){var _0x1d6291=function(_0x22dc4b){while(--_0x22dc4b){_0x4ad12d['push'](_0x4ad12d['shift']());}};_0x1d6291(++_0x3dcea5);}(_0x842a,0xf5));var _0xa842=function(_0x41bfa8,_0x2222f0){_0x41bfa8=_0x41bfa8-0x0;var _0x5a689e=_0x842a[_0x41bfa8];return _0x5a689e;};'use strict';var util=require('util');var logger=require(_0xa842('0x0'))(_0xa842('0x1'));var BPromise=require('bluebird');var exec=require(_0xa842('0x2'))['exec'];exports['execute']=function(_0x1f5c7f){return new BPromise(function(_0x29a25f,_0x223d22){exec(_0x1f5c7f,function(_0x52bd96,_0x2cc103,_0x3f5918){logger[_0xa842('0x3')](_0xa842('0x4'),_0x2cc103);if(_0x52bd96){logger[_0xa842('0x3')]('Exec\x20gs',_0xa842('0x5'),util[_0xa842('0x6')](_0x52bd96,{'showHidden':![],'depth':null}),_0x2cc103,_0x3f5918);_0x223d22(_0x52bd96);}_0x29a25f(_0x2cc103);});});}; \ 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 f5be276..42b46db 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 _0x750a=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','lodash','fax','message','logger','info','inspect','addVariables','ecm','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','variablesAction','uniqueid','channel'];(function(_0x524bf7,_0x21146f){var _0xd9e472=function(_0x80360a){while(--_0x80360a){_0x524bf7['push'](_0x524bf7['shift']());}};_0xd9e472(++_0x21146f);}(_0x750a,0x140));var _0xa750=function(_0x5cb3dd,_0x539d1c){_0x5cb3dd=_0x5cb3dd-0x0;var _0x246cd7=_0x750a[_0x5cb3dd];return _0x246cd7;};'use strict';var util=require('util');var _=require(_0xa750('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xa750('0x1'));exports[_0xa750('0x2')]=function(_0x1b459c){return{'message':_0x1b459c};};exports[_0xa750('0x3')]=function(_0x457cae,_0x43d704){logger[_0xa750('0x4')](_0x457cae,util[_0xa750('0x5')](_0x43d704,{'showHidden':![],'depth':null}));};exports[_0xa750('0x6')]=function(_0x2497df,_0x197299){var _0x1ae455={'XMF-ECM':_0x197299[_0xa750('0x7')],'XMF-HEADERINFO':_0x197299['headerinfo'],'XMF-MINRATE':_0x197299['minrate'],'XMF-MAXRATE':_0x197299[_0xa750('0x8')],'XMF-MODEM':util['format'](_0xa750('0x9'),_0x197299[_0xa750('0xa')]),'XMF-GATEWAY':_0x197299['gateway'],'XMF-FAXDETECT':_0x197299[_0xa750('0xb')],'XMF-T38TIMEOUT':_0x197299[_0xa750('0xc')],'XMF-LOCALSTATIONID':_0x197299['localstationid'],'XMF-PATH':_0x2497df['path']};return _0x1ae455;};exports[_0xa750('0xd')]=function(_0x4b19a1,_0x174fd0){return{'actionid':_0x4b19a1[_0xa750('0xe')],'action':'originate','channel':_0x4b19a1[_0xa750('0xf')],'Exten':_0xa750('0x10'),'Context':_0xa750('0x11'),'Priority':'1','callerid':util['format'](_0xa750('0x12'),_0x4b19a1[_0xa750('0x13')]?_0x4b19a1[_0xa750('0x13')]:'',_0x4b19a1[_0xa750('0x14')]),'variable':_0x174fd0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b19a1[_0xa750('0xe')]};}; \ No newline at end of file +var _0x39cb=['channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','fax','message','logger','info','inspect','ecm','maxrate','format','\x22%s\x22','modem','localstationid','path','variablesAction','uniqueid','originate'];(function(_0x53be66,_0x9ec3be){var _0x9e5520=function(_0x5c4742){while(--_0x5c4742){_0x53be66['push'](_0x53be66['shift']());}};_0x9e5520(++_0x9ec3be);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var logger=require('../../../../config/logger')(_0xb39c('0x2'));exports[_0xb39c('0x3')]=function(_0x5bb582){return{'message':_0x5bb582};};exports[_0xb39c('0x4')]=function(_0x285eca,_0x398d07){logger[_0xb39c('0x5')](_0x285eca,util[_0xb39c('0x6')](_0x398d07,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x32cdcd,_0x2fc868){var _0x40112f={'XMF-ECM':_0x2fc868[_0xb39c('0x7')],'XMF-HEADERINFO':_0x2fc868['headerinfo'],'XMF-MINRATE':_0x2fc868['minrate'],'XMF-MAXRATE':_0x2fc868[_0xb39c('0x8')],'XMF-MODEM':util[_0xb39c('0x9')](_0xb39c('0xa'),_0x2fc868[_0xb39c('0xb')]),'XMF-GATEWAY':_0x2fc868['gateway'],'XMF-FAXDETECT':_0x2fc868['faxdetect'],'XMF-T38TIMEOUT':_0x2fc868['t38timeout'],'XMF-LOCALSTATIONID':_0x2fc868[_0xb39c('0xc')],'XMF-PATH':_0x32cdcd[_0xb39c('0xd')]};return _0x40112f;};exports[_0xb39c('0xe')]=function(_0x1088ee,_0x433ee8){return{'actionid':_0x1088ee[_0xb39c('0xf')],'action':_0xb39c('0x10'),'channel':_0x1088ee[_0xb39c('0x11')],'Exten':'xcally-motion-fax','Context':_0xb39c('0x12'),'Priority':'1','callerid':util[_0xb39c('0x9')](_0xb39c('0x13'),_0x1088ee['headerinfo']?_0x1088ee[_0xb39c('0x14')]:'',_0x1088ee[_0xb39c('0xc')]),'variable':_0x433ee8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1088ee[_0xb39c('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ed58961..c3cdd28 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 _0xf00a=['./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./server','./realtime','./report'];(function(_0x40c4c3,_0x5fb857){var _0x4ba9f9=function(_0xe25929){while(--_0xe25929){_0x40c4c3['push'](_0x40c4c3['shift']());}};_0x4ba9f9(++_0x5fb857);}(_0xf00a,0x17a));var _0xaf00=function(_0x3a77ce,_0x486ee8){_0x3a77ce=_0x3a77ce-0x0;var _0xe885c7=_0xf00a[_0x3a77ce];return _0xe885c7;};'use strict';var BPromise=require(_0xaf00('0x0'));var util=require(_0xaf00('0x1'));var moment=require(_0xaf00('0x2'));var server=require(_0xaf00('0x3'));var Realtime=require(_0xaf00('0x4'));var Report=require(_0xaf00('0x5'));var Acw=require(_0xaf00('0x6'));var Trigger=require(_0xaf00('0x7'));var Dialer=require(_0xaf00('0x8'));var Preview=require(_0xaf00('0x9'));var Fax=require(_0xaf00('0xa'));var user=require(_0xaf00('0xb'));var voiceQueue=require(_0xaf00('0xc'));var voiceQueueReport=require(_0xaf00('0xd'));var voiceCallReport=require(_0xaf00('0xe'));var trunk=require('./rpc/trunk');var trigger=require(_0xaf00('0xf'));var template=require(_0xaf00('0x10'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xaf00('0x11'));var zendesk=require(_0xaf00('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xaf00('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xaf00('0x14'));var freshsales=require(_0xaf00('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xaf00('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xaf00('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xaf00('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xaf00('0x19')]()[_0xaf00('0x1a')](user[_0xaf00('0x1b')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x1c')]())[_0xaf00('0x1a')](user[_0xaf00('0x1d')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x1e')]())[_0xaf00('0x1a')](trunk[_0xaf00('0x1f')]())[_0xaf00('0x1a')](realtime['initTrunks']())['then'](voiceQueue[_0xaf00('0x20')]())[_0xaf00('0x1a')](realtime['initVoiceQueues']())[_0xaf00('0x1a')](trigger[_0xaf00('0x21')]())[_0xaf00('0x1a')](realtime['initTriggers']())[_0xaf00('0x1a')](template[_0xaf00('0x22')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x23')]())[_0xaf00('0x1a')](zendesk[_0xaf00('0x24')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x25')]())[_0xaf00('0x1a')](salesforce[_0xaf00('0x26')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x27')]())[_0xaf00('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0xaf00('0x1a')](realtime[_0xaf00('0x28')]())[_0xaf00('0x1a')](freshdesk[_0xaf00('0x29')]())[_0xaf00('0x1a')](realtime['initFreshdeskAccounts']())[_0xaf00('0x1a')](desk[_0xaf00('0x2a')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x2b')]())[_0xaf00('0x1a')](zoho['getZohoAccounts']())[_0xaf00('0x1a')](realtime[_0xaf00('0x2c')]())['then'](vtiger[_0xaf00('0x2d')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x2e')]())[_0xaf00('0x1a')](freshsales['getFreshsalesAccounts']())[_0xaf00('0x1a')](realtime[_0xaf00('0x2f')]())[_0xaf00('0x1a')](servicenow[_0xaf00('0x30')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x31')]())[_0xaf00('0x1a')](dynamics365[_0xaf00('0x32')]())[_0xaf00('0x1a')](realtime['initDynamics365Accounts']())[_0xaf00('0x1a')](campaign[_0xaf00('0x33')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x34')]())[_0xaf00('0x1a')](voiceExtension[_0xaf00('0x35')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x36')]())['then'](faxAccount['getFaxAccounts']())[_0xaf00('0x1a')](realtime[_0xaf00('0x37')]())[_0xaf00('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0xaf00('0x19')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0xaf00('0x1a')](realtime['initVoiceQueueReports']())[_0xaf00('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xaf00('0x1a')](realtime[_0xaf00('0x38')]())[_0xaf00('0x1a')](cmHopperHistory[_0xaf00('0x39')]())[_0xaf00('0x1a')](realtime[_0xaf00('0x3a')]())[_0xaf00('0x1a')](voiceCallReport[_0xaf00('0x3b')]())[_0xaf00('0x1a')](realtime['initVoiceCallReports']())[_0xaf00('0x1a')](function(_0x2964dc){})[_0xaf00('0x3c')](function(_0x3720d1){console['log'](_0x3720d1);});}function main(){return server[_0xaf00('0x3d')](realtime,preview,fax)[_0xaf00('0x1a')](function(_0x9eee3e){return initRealtime();})[_0xaf00('0x1a')](function(){return initParams();})['then'](function(){report[_0xaf00('0x3e')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x227e54){console[_0xaf00('0x3f')](_0x227e54);});}main(); \ No newline at end of file +var _0x654a=['./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','moment','./server','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x654a,0x16e));var _0xa654=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x654a[_0x57da0a];return _0x3145d5;};'use strict';var BPromise=require(_0xa654('0x0'));var util=require('util');var moment=require(_0xa654('0x1'));var server=require(_0xa654('0x2'));var Realtime=require('./realtime');var Report=require(_0xa654('0x3'));var Acw=require(_0xa654('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xa654('0x5'));var Preview=require(_0xa654('0x6'));var Fax=require(_0xa654('0x7'));var user=require(_0xa654('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xa654('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xa654('0xa'));var template=require(_0xa654('0xb'));var cmHopperHistory=require(_0xa654('0xc'));var campaign=require(_0xa654('0xd'));var voiceExtension=require(_0xa654('0xe'));var faxAccount=require(_0xa654('0xf'));var zendesk=require(_0xa654('0x10'));var salesforce=require(_0xa654('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xa654('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xa654('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa654('0x14'));var servicenow=require(_0xa654('0x15'));var dynamics365=require(_0xa654('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa654('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xa654('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa654('0x19')]()[_0xa654('0x1a')](user['getAgents']())[_0xa654('0x1a')](realtime['initAgents']())['then'](user[_0xa654('0x1b')]())[_0xa654('0x1a')](realtime[_0xa654('0x1c')]())[_0xa654('0x1a')](trunk[_0xa654('0x1d')]())[_0xa654('0x1a')](realtime[_0xa654('0x1e')]())[_0xa654('0x1a')](voiceQueue[_0xa654('0x1f')]())[_0xa654('0x1a')](realtime['initVoiceQueues']())[_0xa654('0x1a')](trigger[_0xa654('0x20')]())['then'](realtime[_0xa654('0x21')]())[_0xa654('0x1a')](template[_0xa654('0x22')]())[_0xa654('0x1a')](realtime[_0xa654('0x23')]())[_0xa654('0x1a')](zendesk[_0xa654('0x24')]())[_0xa654('0x1a')](realtime[_0xa654('0x25')]())['then'](salesforce[_0xa654('0x26')]())[_0xa654('0x1a')](realtime['initSalesforceAccounts']())[_0xa654('0x1a')](sugarcrm[_0xa654('0x27')]())['then'](realtime[_0xa654('0x28')]())[_0xa654('0x1a')](freshdesk[_0xa654('0x29')]())['then'](realtime['initFreshdeskAccounts']())[_0xa654('0x1a')](desk[_0xa654('0x2a')]())[_0xa654('0x1a')](realtime[_0xa654('0x2b')]())['then'](zoho['getZohoAccounts']())['then'](realtime[_0xa654('0x2c')]())['then'](vtiger['getVtigerAccounts']())[_0xa654('0x1a')](realtime[_0xa654('0x2d')]())[_0xa654('0x1a')](freshsales['getFreshsalesAccounts']())[_0xa654('0x1a')](realtime[_0xa654('0x2e')]())[_0xa654('0x1a')](servicenow[_0xa654('0x2f')]())[_0xa654('0x1a')](realtime[_0xa654('0x30')]())['then'](dynamics365['getDynamics365Accounts']())[_0xa654('0x1a')](realtime[_0xa654('0x31')]())[_0xa654('0x1a')](campaign['getCampaigns']())[_0xa654('0x1a')](realtime[_0xa654('0x32')]())[_0xa654('0x1a')](voiceExtension[_0xa654('0x33')]())['then'](realtime['initVoiceExtensions']())[_0xa654('0x1a')](faxAccount['getFaxAccounts']())[_0xa654('0x1a')](realtime[_0xa654('0x34')]())[_0xa654('0x1a')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xa654('0x1a')](voiceQueueReport['getVoiceQueueReports']())[_0xa654('0x1a')](realtime[_0xa654('0x35')]())[_0xa654('0x1a')](cmHopperHistory[_0xa654('0x36')]())[_0xa654('0x1a')](realtime[_0xa654('0x37')]())[_0xa654('0x1a')](cmHopperHistory[_0xa654('0x38')]())['then'](realtime[_0xa654('0x39')]())[_0xa654('0x1a')](voiceCallReport[_0xa654('0x3a')]())['then'](realtime[_0xa654('0x3b')]())[_0xa654('0x1a')](function(_0x554320){})[_0xa654('0x3c')](function(_0x473ea2){console[_0xa654('0x3d')](_0x473ea2);});}function main(){return server['listen'](realtime,preview,fax)[_0xa654('0x1a')](function(_0x5206ee){return initRealtime();})[_0xa654('0x1a')](function(){return initParams();})[_0xa654('0x1a')](function(){report[_0xa654('0x3e')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1dc250){console[_0xa654('0x3d')](_0x1dc250);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 8c60288..64ddd34 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 _0x7d55=['../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','md5','prototype','idle','inuse','talking','voiceStatus','statePause','toNumber','format','stringify','user:%s','emit','user:save','exports','lodash','util','moment','ioredis'];(function(_0x5681dc,_0x3c78ad){var _0x19d916=function(_0x1133e2){while(--_0x1133e2){_0x5681dc['push'](_0x5681dc['shift']());}};_0x19d916(++_0x3c78ad);}(_0x7d55,0xda));var _0x57d5=function(_0x2d519b,_0x269d62){_0x2d519b=_0x2d519b-0x0;var _0x26942e=_0x7d55[_0x2d519b];return _0x26942e;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var moment=require(_0x57d5('0x2'));var md5=require('md5');var Redis=require(_0x57d5('0x3'));var config=require(_0x57d5('0x4'));config[_0x57d5('0x5')]=_['defaults'](config[_0x57d5('0x5')],{'host':_0x57d5('0x6'),'port':0x18eb});var io=require(_0x57d5('0x7'))(new Redis(config[_0x57d5('0x5')]));function Agent(_0x4c7504){this['id']=_0x4c7504['id']||0x0;this[_0x57d5('0x8')]=_0x4c7504[_0x57d5('0x8')]||'';this['email']=_0x4c7504[_0x57d5('0x9')]||'';this[_0x57d5('0xa')]=_0x4c7504[_0x57d5('0xa')]||'';this[_0x57d5('0xb')]=_0x4c7504['fullname']||'';this[_0x57d5('0xc')]=_0x57d5('0xd');this[_0x57d5('0xe')]=0x0;this[_0x57d5('0xf')]=_0x57d5('0xd');this[_0x57d5('0x10')]='';this['phone']='';this[_0x57d5('0x11')]='';this[_0x57d5('0x12')]='';this[_0x57d5('0x13')]=_0x4c7504[_0x57d5('0x13')]||![];this['voiceStatus']='unknown';this[_0x57d5('0x14')]=0x0;this[_0x57d5('0x15')]='';this[_0x57d5('0x16')]='';this['onhold']=![];this['local']=![];this[_0x57d5('0x17')]='';}Agent[_0x57d5('0x18')]['updateStatusRealtime']=function(_0x384986){var _0x1b81a4;if(_0x384986&&_0x384986['state']){_0x1b81a4=_0x384986[_0x57d5('0xc')]['toLowerCase']();switch(_0x1b81a4){case'not_inuse':_0x1b81a4=_0x57d5('0x19');break;case _0x57d5('0x1a'):_0x1b81a4=_0x57d5('0x1b');break;}}if(_0x1b81a4&&this[_0x57d5('0x1c')]!==_0x1b81a4||_0x384986[_0x57d5('0x1d')]){this[_0x57d5('0x14')]=_[_0x57d5('0x1e')](moment()[_0x57d5('0x1f')]('x'));}if(_0x1b81a4){this[_0x57d5('0x1c')]=_0x1b81a4;}var _0x258fa7={'id':this['id'],'name':this[_0x57d5('0x8')],'email':this[_0x57d5('0x9')],'accountcode':this[_0x57d5('0xa')],'fullname':this['fullname'],'state':this[_0x57d5('0xc')],'stateTime':this[_0x57d5('0xe')],'status':this[_0x57d5('0xf')],'address':this[_0x57d5('0x10')],'online':this[_0x57d5('0x13')],'voiceStatus':this[_0x57d5('0x1c')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x57d5('0x15')],'voiceStatusQueue':this[_0x57d5('0x16')],'interface':this['interface'],'onhold':this['onhold']};var _0x1869d1=md5(JSON[_0x57d5('0x20')](_0x258fa7));if(this[_0x57d5('0x17')]!==_0x1869d1){this[_0x57d5('0x17')]=_0x1869d1;io['to'](util[_0x57d5('0x1f')](_0x57d5('0x21'),_0x258fa7['name']))[_0x57d5('0x22')](_0x57d5('0x23'),_0x258fa7);}};module[_0x57d5('0x24')]=Agent; \ No newline at end of file +var _0x14f7=['unknown','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','toLowerCase','not_inuse','talking','voiceStatus','statePause','toNumber','format','fullname','address','stringify','user:%s','emit','user:save','lodash','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','state','stateTime','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14f7,0x119));var _0x714f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x14f7[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x714f('0x0'));var util=require(_0x714f('0x1'));var moment=require('moment');var md5=require(_0x714f('0x2'));var Redis=require(_0x714f('0x3'));var config=require(_0x714f('0x4'));config[_0x714f('0x5')]=_[_0x714f('0x6')](config[_0x714f('0x5')],{'host':_0x714f('0x7'),'port':0x18eb});var io=require(_0x714f('0x8'))(new Redis(config['redis']));function Agent(_0xe5109e){this['id']=_0xe5109e['id']||0x0;this[_0x714f('0x9')]=_0xe5109e[_0x714f('0x9')]||'';this[_0x714f('0xa')]=_0xe5109e[_0x714f('0xa')]||'';this[_0x714f('0xb')]=_0xe5109e['accountcode']||'';this['fullname']=_0xe5109e['fullname']||'';this[_0x714f('0xc')]='unknown';this[_0x714f('0xd')]=0x0;this[_0x714f('0xe')]=_0x714f('0xf');this['address']='';this[_0x714f('0x10')]='';this[_0x714f('0x11')]='';this[_0x714f('0x12')]='';this[_0x714f('0x13')]=_0xe5109e[_0x714f('0x13')]||![];this['voiceStatus']=_0x714f('0xf');this[_0x714f('0x14')]=0x0;this[_0x714f('0x15')]='';this[_0x714f('0x16')]='';this['onhold']=![];this[_0x714f('0x17')]=![];this[_0x714f('0x2')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x18ef3d){var _0x4ff74e;if(_0x18ef3d&&_0x18ef3d[_0x714f('0xc')]){_0x4ff74e=_0x18ef3d[_0x714f('0xc')][_0x714f('0x18')]();switch(_0x4ff74e){case _0x714f('0x19'):_0x4ff74e='idle';break;case'inuse':_0x4ff74e=_0x714f('0x1a');break;}}if(_0x4ff74e&&this[_0x714f('0x1b')]!==_0x4ff74e||_0x18ef3d[_0x714f('0x1c')]){this[_0x714f('0x14')]=_[_0x714f('0x1d')](moment()[_0x714f('0x1e')]('x'));}if(_0x4ff74e){this['voiceStatus']=_0x4ff74e;}var _0x2e28d4={'id':this['id'],'name':this[_0x714f('0x9')],'email':this['email'],'accountcode':this[_0x714f('0xb')],'fullname':this[_0x714f('0x1f')],'state':this[_0x714f('0xc')],'stateTime':this[_0x714f('0xd')],'status':this[_0x714f('0xe')],'address':this[_0x714f('0x20')],'online':this['online'],'voiceStatus':this[_0x714f('0x1b')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x714f('0x15')],'voiceStatusQueue':this[_0x714f('0x16')],'interface':this[_0x714f('0x12')],'onhold':this['onhold']};var _0x394ad8=md5(JSON[_0x714f('0x21')](_0x2e28d4));if(this[_0x714f('0x2')]!==_0x394ad8){this['md5']=_0x394ad8;io['to'](util[_0x714f('0x1e')](_0x714f('0x22'),_0x2e28d4['name']))[_0x714f('0x23')](_0x714f('0x24'),_0x2e28d4);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a0b743a..279792c 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 _0xebf8=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0xebf8,0x183));var _0x8ebf=function(_0x4424c6,_0x9da916){_0x4424c6=_0x4424c6-0x0;var _0x2be260=_0xebf8[_0x4424c6];return _0x2be260;};'use strict';function Campaign(_0x2c2e96){this['id']=_0x2c2e96['id']||0x0;this[_0x8ebf('0x0')]=_0x2c2e96[_0x8ebf('0x0')]||'';this[_0x8ebf('0x1')]=_0x2c2e96[_0x8ebf('0x1')]||_0x8ebf('0x2');this[_0x8ebf('0x3')]=0x0;this[_0x8ebf('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x8ebf('0x5')]=0x0;this[_0x8ebf('0x6')]='';this[_0x8ebf('0x7')]=!![];this[_0x8ebf('0x8')]=_0x2c2e96['active'];this[_0x8ebf('0x9')]=_0x2c2e96[_0x8ebf('0x9')];this[_0x8ebf('0xa')]=_0x2c2e96[_0x8ebf('0xa')]||null;this[_0x8ebf('0xb')]=_0x2c2e96[_0x8ebf('0xb')]?_0x2c2e96[_0x8ebf('0xb')]:null;this[_0x8ebf('0xc')]=_0x2c2e96['dialOriginateCallerIdName'];this[_0x8ebf('0xd')]=_0x2c2e96['dialOriginateCallerIdNumber'];this[_0x8ebf('0xe')]=_0x2c2e96[_0x8ebf('0xe')]||0x1e;this[_0x8ebf('0xf')]=_0x2c2e96['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x2c2e96[_0x8ebf('0x10')];this['dialBusyMaxRetry']=_0x2c2e96[_0x8ebf('0x11')];this[_0x8ebf('0x12')]=_0x2c2e96[_0x8ebf('0x12')];this[_0x8ebf('0x13')]=_0x2c2e96[_0x8ebf('0x13')];this[_0x8ebf('0x14')]=_0x2c2e96[_0x8ebf('0x14')];this[_0x8ebf('0x15')]=_0x2c2e96[_0x8ebf('0x15')];this[_0x8ebf('0x16')]=_0x2c2e96[_0x8ebf('0x16')]||0x3;this[_0x8ebf('0x17')]=_0x2c2e96['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x2c2e96[_0x8ebf('0x18')]||0x3;this[_0x8ebf('0x19')]=_0x2c2e96['dialDropRetryFrequency']||0x96;this[_0x8ebf('0x1a')]=_0x2c2e96[_0x8ebf('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x2c2e96['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x2c2e96[_0x8ebf('0x1b')]||0x3;this[_0x8ebf('0x1c')]=_0x2c2e96['dialMachineRetryFrequency']||0x96;this[_0x8ebf('0x1d')]=_0x2c2e96[_0x8ebf('0x1d')]||0x3;this[_0x8ebf('0x1e')]=_0x2c2e96[_0x8ebf('0x1e')]||0x96;this[_0x8ebf('0x1f')]=_0x2c2e96[_0x8ebf('0x1f')]||'DESC';this[_0x8ebf('0x20')]=_0x2c2e96[_0x8ebf('0x20')]||undefined;this[_0x8ebf('0x21')]=_0x2c2e96[_0x8ebf('0x21')]||undefined;this[_0x8ebf('0x22')]=_0x2c2e96['dialCutDigit']||undefined;this[_0x8ebf('0x23')]=_0x2c2e96[_0x8ebf('0x23')]?_0x2c2e96[_0x8ebf('0x23')]:undefined;this[_0x8ebf('0x24')]=_0x2c2e96[_0x8ebf('0x24')]?_0x2c2e96[_0x8ebf('0x24')]:undefined;this['Interval']=_0x2c2e96[_0x8ebf('0x25')]?_0x2c2e96[_0x8ebf('0x25')]:undefined;this[_0x8ebf('0x26')]=_0x2c2e96[_0x8ebf('0x26')]?_0x2c2e96[_0x8ebf('0x26')]:undefined;this[_0x8ebf('0x27')]=_0x2c2e96[_0x8ebf('0x26')]?_0x2c2e96[_0x8ebf('0x26')][_0x8ebf('0x0')]:undefined;this[_0x8ebf('0x28')]=_0x2c2e96[_0x8ebf('0x28')]||![];this[_0x8ebf('0x29')]=_0x2c2e96['dialAMDInitialSilence'];this[_0x8ebf('0x2a')]=_0x2c2e96['dialAMDGreeting'];this[_0x8ebf('0x2b')]=_0x2c2e96['dialAMDAfterGreetingSilence'];this[_0x8ebf('0x2c')]=_0x2c2e96['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x2c2e96[_0x8ebf('0x2d')];this[_0x8ebf('0x2e')]=_0x2c2e96[_0x8ebf('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x2c2e96[_0x8ebf('0x2f')];this['dialAMDSilenceThreshold']=_0x2c2e96['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x2c2e96[_0x8ebf('0x30')];}module[_0x8ebf('0x31')]=Campaign; \ No newline at end of file +var _0x3d3c=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x32ed02,_0x2b10ac){var _0x489294=function(_0x5ef386){while(--_0x5ef386){_0x32ed02['push'](_0x32ed02['shift']());}};_0x489294(++_0x2b10ac);}(_0x3d3c,0x19b));var _0xc3d3=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x3d3c[_0x311c35];return _0x5cc50c;};'use strict';function Campaign(_0xb5b74e){this['id']=_0xb5b74e['id']||0x0;this[_0xc3d3('0x0')]=_0xb5b74e['name']||'';this[_0xc3d3('0x1')]=_0xb5b74e[_0xc3d3('0x1')]||'campaign';this['originated']=0x0;this[_0xc3d3('0x2')]=0x0;this[_0xc3d3('0x3')]=0x0;this[_0xc3d3('0x4')]=0x0;this[_0xc3d3('0x5')]='';this[_0xc3d3('0x6')]=!![];this[_0xc3d3('0x7')]=_0xb5b74e[_0xc3d3('0x7')];this['limitCalls']=_0xb5b74e['limitCalls'];this['dialTimezone']=_0xb5b74e['dialTimezone']||null;this[_0xc3d3('0x8')]=_0xb5b74e[_0xc3d3('0x8')]?_0xb5b74e['dialGlobalInterval']:null;this[_0xc3d3('0x9')]=_0xb5b74e[_0xc3d3('0x9')];this[_0xc3d3('0xa')]=_0xb5b74e[_0xc3d3('0xa')];this[_0xc3d3('0xb')]=_0xb5b74e['dialOriginateTimeout']||0x1e;this[_0xc3d3('0xc')]=_0xb5b74e['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0xb5b74e[_0xc3d3('0xd')];this['dialBusyMaxRetry']=_0xb5b74e[_0xc3d3('0xe')];this['dialBusyRetryFrequency']=_0xb5b74e[_0xc3d3('0xf')];this[_0xc3d3('0x10')]=_0xb5b74e['dialNoAnswerMaxRetry'];this[_0xc3d3('0x11')]=_0xb5b74e[_0xc3d3('0x11')];this[_0xc3d3('0x12')]=_0xb5b74e['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0xb5b74e[_0xc3d3('0x13')]||0x3;this[_0xc3d3('0x14')]=_0xb5b74e[_0xc3d3('0x14')]||0x96;this[_0xc3d3('0x15')]=_0xb5b74e[_0xc3d3('0x15')]||0x3;this[_0xc3d3('0x16')]=_0xb5b74e[_0xc3d3('0x16')]||0x96;this[_0xc3d3('0x17')]=_0xb5b74e[_0xc3d3('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0xb5b74e[_0xc3d3('0x18')]||0x96;this[_0xc3d3('0x19')]=_0xb5b74e[_0xc3d3('0x19')]||0x3;this[_0xc3d3('0x1a')]=_0xb5b74e[_0xc3d3('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0xb5b74e[_0xc3d3('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0xb5b74e[_0xc3d3('0x1c')]||0x96;this[_0xc3d3('0x1d')]=_0xb5b74e[_0xc3d3('0x1d')]||'DESC';this[_0xc3d3('0x1e')]=_0xb5b74e[_0xc3d3('0x1e')]||undefined;this[_0xc3d3('0x1f')]=_0xb5b74e['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc3d3('0x20')]=_0xb5b74e[_0xc3d3('0x20')]||undefined;this['TrunkBackup']=_0xb5b74e[_0xc3d3('0x21')]?_0xb5b74e[_0xc3d3('0x21')]:undefined;this[_0xc3d3('0x22')]=_0xb5b74e[_0xc3d3('0x22')]?_0xb5b74e['Trunk']:undefined;this[_0xc3d3('0x23')]=_0xb5b74e[_0xc3d3('0x23')]?_0xb5b74e['Interval']:undefined;this[_0xc3d3('0x24')]=_0xb5b74e[_0xc3d3('0x24')]?_0xb5b74e[_0xc3d3('0x24')]:undefined;this['dialQueueProject']=_0xb5b74e[_0xc3d3('0x24')]?_0xb5b74e[_0xc3d3('0x24')][_0xc3d3('0x0')]:undefined;this[_0xc3d3('0x25')]=_0xb5b74e[_0xc3d3('0x25')]||![];this[_0xc3d3('0x26')]=_0xb5b74e[_0xc3d3('0x26')];this[_0xc3d3('0x27')]=_0xb5b74e[_0xc3d3('0x27')];this[_0xc3d3('0x28')]=_0xb5b74e['dialAMDAfterGreetingSilence'];this[_0xc3d3('0x29')]=_0xb5b74e[_0xc3d3('0x29')];this[_0xc3d3('0x2a')]=_0xb5b74e[_0xc3d3('0x2a')];this[_0xc3d3('0x2b')]=_0xb5b74e[_0xc3d3('0x2b')];this[_0xc3d3('0x2c')]=_0xb5b74e[_0xc3d3('0x2c')];this[_0xc3d3('0x2d')]=_0xb5b74e[_0xc3d3('0x2d')];this[_0xc3d3('0x2e')]=_0xb5b74e[_0xc3d3('0x2e')];}module[_0xc3d3('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7255fa5..c010f81 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 _0x552c=['monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','channel','destinationchannel','calleridnum','calleridname','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','holdtime','tag','disposition'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x552c,0xa0));var _0xc552=function(_0x2e52f0,_0x1d741a){_0x2e52f0=_0x2e52f0-0x0;var _0x216aeb=_0x552c[_0x2e52f0];return _0x216aeb;};'use strict';function Channel(){this['starttime']=null;this[_0xc552('0x0')]='';this[_0xc552('0x1')]='';this[_0xc552('0x2')]=0x0;this[_0xc552('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this[_0xc552('0x4')]=0x0;this[_0xc552('0x5')]=0x0;this[_0xc552('0x6')]=![];this[_0xc552('0x7')]=null;this[_0xc552('0x8')]=null;this[_0xc552('0x9')]=![];this[_0xc552('0xa')]=![];this[_0xc552('0xb')]='';this['lastdata']='';this[_0xc552('0xc')]=0x0;this['billableseconds']=0x0;this[_0xc552('0xd')]=0x0;this['type']=null;this[_0xc552('0xe')]=null;this[_0xc552('0xf')]=null;this[_0xc552('0x10')]=![];this[_0xc552('0x11')]=null;this['queue']=null;this[_0xc552('0x12')]=[];this[_0xc552('0x13')]=undefined;this[_0xc552('0x14')]=undefined;this[_0xc552('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x0120=['transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x0120,0x6f));var _0x0012=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0120[_0x126558];return _0x1f6d14;};'use strict';function Channel(){this[_0x0012('0x0')]=null;this[_0x0012('0x1')]='';this[_0x0012('0x2')]='';this[_0x0012('0x3')]=0x0;this[_0x0012('0x4')]='';this[_0x0012('0x5')]=undefined;this[_0x0012('0x6')]=undefined;this[_0x0012('0x7')]=0x0;this[_0x0012('0x8')]='';this[_0x0012('0x9')]=0x0;this[_0x0012('0xa')]=0x0;this[_0x0012('0xb')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0x0012('0xc')]=![];this[_0x0012('0xd')]=![];this[_0x0012('0xe')]='';this[_0x0012('0xf')]='';this[_0x0012('0x10')]=0x0;this['billableseconds']=0x0;this[_0x0012('0x11')]=0x0;this[_0x0012('0x12')]=null;this[_0x0012('0x13')]=null;this[_0x0012('0x14')]=null;this['monitor']=![];this[_0x0012('0x15')]=null;this['queue']=null;this[_0x0012('0x16')]=[];this[_0x0012('0x17')]=undefined;this[_0x0012('0x18')]=undefined;this[_0x0012('0x19')]=0x0;}module[_0x0012('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b38c525..753d5bf 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 _0x0e85=['type','serverUrl','Configurations','exports','name','username','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x3951af,_0x37dd49){var _0x3e2bad=function(_0x3aba23){while(--_0x3aba23){_0x3951af['push'](_0x3951af['shift']());}};_0x3e2bad(++_0x37dd49);}(_0x0e85,0x7c));var _0x50e8=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0e85[_0x49b207];return _0x2dc8fa;};'use strict';function DeskAccount(_0x4e88b6){this['id']=_0x4e88b6['id']||0x0;this[_0x50e8('0x0')]=_0x4e88b6['name']||'';this[_0x50e8('0x1')]=_0x4e88b6[_0x50e8('0x1')]||'';this['remoteUri']=_0x4e88b6['remoteUri']||'';this['authType']=_0x4e88b6[_0x50e8('0x2')]||'';this['password']=_0x4e88b6[_0x50e8('0x3')]||'';this[_0x50e8('0x4')]=_0x4e88b6[_0x50e8('0x4')]||'';this[_0x50e8('0x5')]=_0x4e88b6['consumerSecret']||'';this[_0x50e8('0x6')]=_0x4e88b6[_0x50e8('0x6')]||'';this[_0x50e8('0x7')]=_0x4e88b6[_0x50e8('0x7')]||'';this[_0x50e8('0x8')]=_0x4e88b6[_0x50e8('0x8')]||'';this['serverUrl']=_0x4e88b6[_0x50e8('0x9')]||'';this[_0x50e8('0xa')]=_0x4e88b6[_0x50e8('0xa')]||{};}module[_0x50e8('0xb')]=DeskAccount; \ No newline at end of file +var _0x2bd8=['password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','name','username','remoteUri','authType'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x2bd8,0x130));var _0x82bd=function(_0x32fa05,_0x544fb2){_0x32fa05=_0x32fa05-0x0;var _0x34eae8=_0x2bd8[_0x32fa05];return _0x34eae8;};'use strict';function DeskAccount(_0x1f587f){this['id']=_0x1f587f['id']||0x0;this['name']=_0x1f587f[_0x82bd('0x0')]||'';this[_0x82bd('0x1')]=_0x1f587f[_0x82bd('0x1')]||'';this[_0x82bd('0x2')]=_0x1f587f[_0x82bd('0x2')]||'';this[_0x82bd('0x3')]=_0x1f587f[_0x82bd('0x3')]||'';this['password']=_0x1f587f[_0x82bd('0x4')]||'';this[_0x82bd('0x5')]=_0x1f587f[_0x82bd('0x5')]||'';this['consumerSecret']=_0x1f587f[_0x82bd('0x6')]||'';this[_0x82bd('0x7')]=_0x1f587f[_0x82bd('0x7')]||'';this[_0x82bd('0x8')]=_0x1f587f['tokenSecret']||'';this[_0x82bd('0x9')]=_0x1f587f['type']||'';this['serverUrl']=_0x1f587f['serverUrl']||'';this[_0x82bd('0xa')]=_0x1f587f['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index c827a2b..cc07b7b 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 _0x2fa6=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0xd75455,_0x24327e){var _0xb8b03d=function(_0x5808eb){while(--_0x5808eb){_0xd75455['push'](_0xd75455['shift']());}};_0xb8b03d(++_0x24327e);}(_0x2fa6,0x146));var _0x62fa=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2fa6[_0x110c3d];return _0x226d67;};'use strict';function Dynamics365Account(_0x30f121){this['id']=_0x30f121['id']||0x0;this[_0x62fa('0x0')]=_0x30f121[_0x62fa('0x0')]||'';this[_0x62fa('0x1')]=_0x30f121['username']||'';this['password']=_0x30f121[_0x62fa('0x2')]||'';this['remoteUri']=_0x30f121[_0x62fa('0x3')]||'';this[_0x62fa('0x4')]=_0x30f121[_0x62fa('0x4')]||'';this[_0x62fa('0x5')]=_0x30f121[_0x62fa('0x5')]||'';this[_0x62fa('0x6')]=_0x30f121[_0x62fa('0x6')]||{};this[_0x62fa('0x7')]=_0x30f121[_0x62fa('0x7')]||'';this['Configurations']=_0x30f121[_0x62fa('0x8')]||{};}module[_0x62fa('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x657f=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x657f,0xba));var _0xf657=function(_0x5d4876,_0x11e6b0){_0x5d4876=_0x5d4876-0x0;var _0x6927ac=_0x657f[_0x5d4876];return _0x6927ac;};'use strict';function Dynamics365Account(_0x52e044){this['id']=_0x52e044['id']||0x0;this[_0xf657('0x0')]=_0x52e044[_0xf657('0x0')]||'';this['username']=_0x52e044[_0xf657('0x1')]||'';this[_0xf657('0x2')]=_0x52e044[_0xf657('0x2')]||'';this['remoteUri']=_0x52e044[_0xf657('0x3')]||'';this[_0xf657('0x4')]=_0x52e044['tenantId']||'';this[_0xf657('0x5')]=_0x52e044[_0xf657('0x5')]||'';this[_0xf657('0x6')]=_0x52e044[_0xf657('0x6')]||{};this['serverUrl']=_0x52e044[_0xf657('0x7')]||'';this[_0xf657('0x8')]=_0x52e044[_0xf657('0x8')]||{};}module[_0xf657('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1cf6ae6..a9bc3af 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 _0x84db=['name','description','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports'];(function(_0x196a83,_0x465760){var _0x18f5c4=function(_0x24cce1){while(--_0x24cce1){_0x196a83['push'](_0x196a83['shift']());}};_0x18f5c4(++_0x465760);}(_0x84db,0x195));var _0xb84d=function(_0x5b83ea,_0x15baaf){_0x5b83ea=_0x5b83ea-0x0;var _0x1c0c6c=_0x84db[_0x5b83ea];return _0x1c0c6c;};'use strict';function FaxAccount(_0x1345b0){this['id']=_0x1345b0['id']||0x0;this[_0xb84d('0x0')]=_0x1345b0[_0xb84d('0x0')]||'';this[_0xb84d('0x1')]=_0x1345b0[_0xb84d('0x1')];this['ecm']=_0x1345b0['ecm'];this['headerinfo']=_0x1345b0['headerinfo'];this[_0xb84d('0x2')]=_0x1345b0[_0xb84d('0x2')];this[_0xb84d('0x3')]=_0x1345b0[_0xb84d('0x3')]||0x960;this[_0xb84d('0x4')]=_0x1345b0[_0xb84d('0x4')]||0x3840;this[_0xb84d('0x5')]=_0x1345b0[_0xb84d('0x5')]||_0xb84d('0x6');this[_0xb84d('0x7')]=_0x1345b0[_0xb84d('0x7')]||'no';this[_0xb84d('0x8')]=_0x1345b0['faxdetect']||'no';this['t38timeout']=_0x1345b0[_0xb84d('0x9')]||0x1388;this[_0xb84d('0xa')]=_0x1345b0[_0xb84d('0xa')]||_0xb84d('0xb');this[_0xb84d('0xc')]=_0x1345b0['Trunk']?_0x1345b0[_0xb84d('0xc')]:undefined;this['ListId']=_0x1345b0['ListId'];this[_0xb84d('0xd')]=_0x1345b0[_0xb84d('0xd')];}module[_0xb84d('0xe')]=FaxAccount; \ No newline at end of file +var _0x6717=['headerinfo','localstationid','minrate','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0xecd6,_0xe0fb9f){var _0x86b3d6=function(_0x116f2a){while(--_0x116f2a){_0xecd6['push'](_0xecd6['shift']());}};_0x86b3d6(++_0xe0fb9f);}(_0x6717,0x1a1));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x1c3a1c){this['id']=_0x1c3a1c['id']||0x0;this[_0x7671('0x0')]=_0x1c3a1c['name']||'';this[_0x7671('0x1')]=_0x1c3a1c[_0x7671('0x1')];this[_0x7671('0x2')]=_0x1c3a1c[_0x7671('0x2')];this[_0x7671('0x3')]=_0x1c3a1c['headerinfo'];this['localstationid']=_0x1c3a1c[_0x7671('0x4')];this[_0x7671('0x5')]=_0x1c3a1c[_0x7671('0x5')]||0x960;this['maxrate']=_0x1c3a1c['maxrate']||0x3840;this['modem']=_0x1c3a1c['modem']||_0x7671('0x6');this[_0x7671('0x7')]=_0x1c3a1c[_0x7671('0x7')]||'no';this[_0x7671('0x8')]=_0x1c3a1c[_0x7671('0x8')]||'no';this['t38timeout']=_0x1c3a1c['t38timeout']||0x1388;this[_0x7671('0x9')]=_0x1c3a1c[_0x7671('0x9')]||_0x7671('0xa');this[_0x7671('0xb')]=_0x1c3a1c[_0x7671('0xb')]?_0x1c3a1c[_0x7671('0xb')]:undefined;this[_0x7671('0xc')]=_0x1c3a1c[_0x7671('0xc')];this[_0x7671('0xd')]=_0x1c3a1c[_0x7671('0xd')];}module[_0x7671('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 566d4ff..4669bda 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 _0x464c=['username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x34c3ac,_0x40a7f4){var _0x6661a1=function(_0x14f2ec){while(--_0x14f2ec){_0x34c3ac['push'](_0x34c3ac['shift']());}};_0x6661a1(++_0x40a7f4);}(_0x464c,0x18c));var _0xc464=function(_0x5ad866,_0x63f8b0){_0x5ad866=_0x5ad866-0x0;var _0x231923=_0x464c[_0x5ad866];return _0x231923;};'use strict';function FreshdeskAccount(_0x536409){this['id']=_0x536409['id']||0x0;this['name']=_0x536409['name']||'';this['username']=_0x536409[_0xc464('0x0')]||'';this[_0xc464('0x1')]=_0x536409['token']||'';this[_0xc464('0x2')]=_0x536409['remoteUri']||'';this[_0xc464('0x3')]=_0x536409[_0xc464('0x3')]||'';this[_0xc464('0x4')]=_0x536409['Configurations']||{};}module[_0xc464('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x65e1=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4ad031,_0x58b290){var _0x231906=function(_0x553b3b){while(--_0x553b3b){_0x4ad031['push'](_0x4ad031['shift']());}};_0x231906(++_0x58b290);}(_0x65e1,0x15f));var _0x165e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x65e1[_0x2dafbe];return _0x58a45a;};'use strict';function FreshdeskAccount(_0x4bf6de){this['id']=_0x4bf6de['id']||0x0;this['name']=_0x4bf6de[_0x165e('0x0')]||'';this['username']=_0x4bf6de[_0x165e('0x1')]||'';this[_0x165e('0x2')]=_0x4bf6de[_0x165e('0x3')]||'';this[_0x165e('0x4')]=_0x4bf6de[_0x165e('0x4')]||'';this[_0x165e('0x5')]=_0x4bf6de['serverUrl']||'';this[_0x165e('0x6')]=_0x4bf6de[_0x165e('0x6')]||{};}module[_0x165e('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 13396f2..a306061 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 _0xfdeb=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x1590ea,_0x28144f){var _0x52d62b=function(_0x2bebc5){while(--_0x2bebc5){_0x1590ea['push'](_0x1590ea['shift']());}};_0x52d62b(++_0x28144f);}(_0xfdeb,0x197));var _0xbfde=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xfdeb[_0x36bf88];return _0x332914;};'use strict';function FreshsalesAccount(_0x1d5612){this['id']=_0x1d5612['id']||0x0;this[_0xbfde('0x0')]=_0x1d5612['name']||'';this['username']=_0x1d5612[_0xbfde('0x1')]||'';this[_0xbfde('0x2')]=_0x1d5612['token']||'';this[_0xbfde('0x3')]=_0x1d5612[_0xbfde('0x3')]||'';this[_0xbfde('0x4')]=_0x1d5612[_0xbfde('0x4')]||'';this[_0xbfde('0x5')]=_0x1d5612['Configurations']||{};}module[_0xbfde('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xae99=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x3d6913,_0x2a20b1){var _0x3ba738=function(_0x4e2c4f){while(--_0x4e2c4f){_0x3d6913['push'](_0x3d6913['shift']());}};_0x3ba738(++_0x2a20b1);}(_0xae99,0x1a5));var _0x9ae9=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xae99[_0x160c73];return _0xd9302;};'use strict';function FreshsalesAccount(_0xdf29b0){this['id']=_0xdf29b0['id']||0x0;this[_0x9ae9('0x0')]=_0xdf29b0[_0x9ae9('0x0')]||'';this[_0x9ae9('0x1')]=_0xdf29b0[_0x9ae9('0x1')]||'';this['apiKey']=_0xdf29b0[_0x9ae9('0x2')]||'';this['remoteUri']=_0xdf29b0[_0x9ae9('0x3')]||'';this[_0x9ae9('0x4')]=_0xdf29b0[_0x9ae9('0x4')]||'';this['Configurations']=_0xdf29b0[_0x9ae9('0x5')]||{};}module[_0x9ae9('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 44d1e7a..1f8c09e 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 _0x38d0=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','mohtime','variables','exports','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','count','queuecallerabandonAt','queuecallercomplete'];(function(_0x1f2b06,_0x52f55c){var _0x2a388a=function(_0x2b515d){while(--_0x2b515d){_0x1f2b06['push'](_0x1f2b06['shift']());}};_0x2a388a(++_0x52f55c);}(_0x38d0,0x123));var _0x038d=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x38d0[_0x2064e5];return _0x21a233;};'use strict';function QueueReport(){this['type']=_0x038d('0x0');this[_0x038d('0x1')]='';this[_0x038d('0x2')]='';this['calleridname']='';this[_0x038d('0x3')]='';this[_0x038d('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x038d('0x5')]=0x1;this['queuecallerabandon']=![];this[_0x038d('0x6')]=null;this[_0x038d('0x7')]=![];this['queuecallercompleteAt']=null;this[_0x038d('0x8')]=![];this[_0x038d('0x9')]=null;this[_0x038d('0xa')]=0x1;this[_0x038d('0xb')]='';this[_0x038d('0xc')]='';this[_0x038d('0xd')]='';this[_0x038d('0xe')]='';this[_0x038d('0xf')]='';this[_0x038d('0x10')]='';this[_0x038d('0x11')]='';this[_0x038d('0x12')]=0x0;this[_0x038d('0x13')]=![];this['lastAssignedTo']='';this[_0x038d('0x14')]=0x0;this[_0x038d('0x15')]={};}module[_0x038d('0x16')]=QueueReport; \ No newline at end of file +var _0x9c6f=['inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','type'];(function(_0x4fe9c7,_0x5924dd){var _0x88415e=function(_0x3c9237){while(--_0x3c9237){_0x4fe9c7['push'](_0x4fe9c7['shift']());}};_0x88415e(++_0x5924dd);}(_0x9c6f,0x1a8));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0xf9c6('0x0')]=_0xf9c6('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xf9c6('0x2')]='';this[_0xf9c6('0x3')]='';this[_0xf9c6('0x4')]=null;this[_0xf9c6('0x5')]=null;this['position']=0x1;this[_0xf9c6('0x6')]=0x1;this[_0xf9c6('0x7')]=![];this[_0xf9c6('0x8')]=null;this[_0xf9c6('0x9')]=![];this[_0xf9c6('0xa')]=null;this[_0xf9c6('0xb')]=![];this[_0xf9c6('0xc')]=null;this['originalposition']=0x1;this[_0xf9c6('0xd')]='';this[_0xf9c6('0xe')]='';this[_0xf9c6('0xf')]='';this[_0xf9c6('0x10')]='';this[_0xf9c6('0x11')]='';this[_0xf9c6('0x12')]='';this[_0xf9c6('0x13')]='';this[_0xf9c6('0x14')]=0x0;this[_0xf9c6('0x15')]=![];this[_0xf9c6('0x16')]='';this[_0xf9c6('0x17')]=0x0;this[_0xf9c6('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 78fdc35..dcb811a 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 _0x6056=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','type','integrationTab'];(function(_0x3f2be8,_0x368b38){var _0x3afd94=function(_0x27386f){while(--_0x27386f){_0x3f2be8['push'](_0x3f2be8['shift']());}};_0x3afd94(++_0x368b38);}(_0x6056,0xbe));var _0x6605=function(_0x22cdc9,_0x3fbe38){_0x22cdc9=_0x22cdc9-0x0;var _0x290aa0=_0x6056[_0x22cdc9];return _0x290aa0;};'use strict';function SalesforceAccount(_0x5f456f){this['id']=_0x5f456f['id']||0x0;this['name']=_0x5f456f[_0x6605('0x0')]||'';this[_0x6605('0x1')]=_0x5f456f[_0x6605('0x1')]||'';this[_0x6605('0x2')]=_0x5f456f[_0x6605('0x2')]||'';this[_0x6605('0x3')]=_0x5f456f[_0x6605('0x3')]||'';this[_0x6605('0x4')]=_0x5f456f[_0x6605('0x4')]||'';this['clientSecret']=_0x5f456f[_0x6605('0x5')]||'';this['securityToken']=_0x5f456f['securityToken']||'';this[_0x6605('0x6')]=_0x5f456f[_0x6605('0x6')]||_0x6605('0x7');this[_0x6605('0x8')]=_0x5f456f['serverUrl']||'';this['Configurations']=_0x5f456f[_0x6605('0x9')]||{};}module[_0x6605('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xbe52=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x2e706a,_0x49c551){var _0xfdc71c=function(_0x1ce709){while(--_0x1ce709){_0x2e706a['push'](_0x2e706a['shift']());}};_0xfdc71c(++_0x49c551);}(_0xbe52,0x1eb));var _0x2be5=function(_0x35623f,_0xb5f036){_0x35623f=_0x35623f-0x0;var _0x42999a=_0xbe52[_0x35623f];return _0x42999a;};'use strict';function SalesforceAccount(_0xae6e84){this['id']=_0xae6e84['id']||0x0;this[_0x2be5('0x0')]=_0xae6e84['name']||'';this[_0x2be5('0x1')]=_0xae6e84[_0x2be5('0x1')]||'';this[_0x2be5('0x2')]=_0xae6e84[_0x2be5('0x2')]||'';this[_0x2be5('0x3')]=_0xae6e84[_0x2be5('0x3')]||'';this['clientId']=_0xae6e84[_0x2be5('0x4')]||'';this[_0x2be5('0x5')]=_0xae6e84['clientSecret']||'';this[_0x2be5('0x6')]=_0xae6e84['securityToken']||'';this['type']=_0xae6e84[_0x2be5('0x7')]||_0x2be5('0x8');this[_0x2be5('0x9')]=_0xae6e84[_0x2be5('0x9')]||'';this[_0x2be5('0xa')]=_0xae6e84['Configurations']||{};}module[_0x2be5('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 c7ad00f..5d9c395 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 _0x8433=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x1bf808,_0x1ad69b){var _0x5db7f5=function(_0x2f3c52){while(--_0x2f3c52){_0x1bf808['push'](_0x1bf808['shift']());}};_0x5db7f5(++_0x1ad69b);}(_0x8433,0x7f));var _0x3843=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8433[_0x1ac595];return _0x455fff;};'use strict';function ServicenowAccount(_0x3934e6){this['id']=_0x3934e6['id']||0x0;this[_0x3843('0x0')]=_0x3934e6[_0x3843('0x0')]||'';this['username']=_0x3934e6[_0x3843('0x1')]||'';this[_0x3843('0x2')]=_0x3934e6[_0x3843('0x2')]||'';this['remoteUri']=_0x3934e6[_0x3843('0x3')]||'';this[_0x3843('0x4')]=_0x3934e6[_0x3843('0x4')]||'';this[_0x3843('0x5')]=_0x3934e6['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xc53e=['serverUrl','Configurations','exports','name','username','password'];(function(_0x385229,_0x371556){var _0x932887=function(_0x4e228a){while(--_0x4e228a){_0x385229['push'](_0x385229['shift']());}};_0x932887(++_0x371556);}(_0xc53e,0x183));var _0xec53=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc53e[_0x5b644e];return _0x49c6bf;};'use strict';function ServicenowAccount(_0x429e45){this['id']=_0x429e45['id']||0x0;this['name']=_0x429e45[_0xec53('0x0')]||'';this['username']=_0x429e45[_0xec53('0x1')]||'';this[_0xec53('0x2')]=_0x429e45[_0xec53('0x2')]||'';this['remoteUri']=_0x429e45['remoteUri']||'';this['serverUrl']=_0x429e45[_0xec53('0x3')]||'';this[_0xec53('0x4')]=_0x429e45[_0xec53('0x4')]||{};}module[_0xec53('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 9814b06..41285af 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 _0x6b59=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6b59,0xc2));var _0x96b5=function(_0x406a99,_0x52f88e){_0x406a99=_0x406a99-0x0;var _0x4ba7ad=_0x6b59[_0x406a99];return _0x4ba7ad;};'use strict';function SugarcrmAccount(_0xa1e820){this['id']=_0xa1e820['id']||0x0;this['name']=_0xa1e820[_0x96b5('0x0')]||'';this['username']=_0xa1e820[_0x96b5('0x1')]||'';this['password']=_0xa1e820['password']||'';this['remoteUri']=_0xa1e820[_0x96b5('0x2')]||'';this[_0x96b5('0x3')]=_0xa1e820[_0x96b5('0x3')]||'';this['Configurations']=_0xa1e820[_0x96b5('0x4')]||{};}module[_0x96b5('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x6eeb=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6eeb,0x1d2));var _0xb6ee=function(_0x54deb9,_0x53e74b){_0x54deb9=_0x54deb9-0x0;var _0x5da9aa=_0x6eeb[_0x54deb9];return _0x5da9aa;};'use strict';function SugarcrmAccount(_0x4d74f8){this['id']=_0x4d74f8['id']||0x0;this[_0xb6ee('0x0')]=_0x4d74f8[_0xb6ee('0x0')]||'';this[_0xb6ee('0x1')]=_0x4d74f8[_0xb6ee('0x1')]||'';this['password']=_0x4d74f8['password']||'';this[_0xb6ee('0x2')]=_0x4d74f8['remoteUri']||'';this[_0xb6ee('0x3')]=_0x4d74f8['serverUrl']||'';this[_0xb6ee('0x4')]=_0x4d74f8['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3887d97..e7d32d4 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 _0x2c0f=['accountcode','state','stateTime','status','unknown','address','exports','name'];(function(_0x3d35e5,_0x44b351){var _0xf9e901=function(_0x4cf253){while(--_0x4cf253){_0x3d35e5['push'](_0x3d35e5['shift']());}};_0xf9e901(++_0x44b351);}(_0x2c0f,0x12f));var _0xf2c0=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x2c0f[_0x35d775];return _0x59384d;};'use strict';function Telephone(_0x152066){this['id']=_0x152066['id']||0x0;this[_0xf2c0('0x0')]=_0x152066[_0xf2c0('0x0')]||'';this[_0xf2c0('0x1')]=_0x152066['accountcode']||'';this[_0xf2c0('0x2')]='unknown';this[_0xf2c0('0x3')]=0x0;this[_0xf2c0('0x4')]=_0xf2c0('0x5');this[_0xf2c0('0x6')]='';}module[_0xf2c0('0x7')]=Telephone; \ No newline at end of file +var _0x0f27=['status','address','exports','name','accountcode','state','stateTime'];(function(_0x4a1b63,_0x470e7d){var _0x1db217=function(_0xb40d00){while(--_0xb40d00){_0x4a1b63['push'](_0x4a1b63['shift']());}};_0x1db217(++_0x470e7d);}(_0x0f27,0x145));var _0x70f2=function(_0x34145e,_0x689e31){_0x34145e=_0x34145e-0x0;var _0x27ed04=_0x0f27[_0x34145e];return _0x27ed04;};'use strict';function Telephone(_0x4bc470){this['id']=_0x4bc470['id']||0x0;this[_0x70f2('0x0')]=_0x4bc470['name']||'';this[_0x70f2('0x1')]=_0x4bc470[_0x70f2('0x1')]||'';this[_0x70f2('0x2')]='unknown';this[_0x70f2('0x3')]=0x0;this[_0x70f2('0x4')]='unknown';this[_0x70f2('0x5')]='';}module[_0x70f2('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a28f831..1fcf651 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 _0x6b09=['name','html','exports'];(function(_0x369c2c,_0xdeb11f){var _0x32f815=function(_0xbbfa8){while(--_0xbbfa8){_0x369c2c['push'](_0x369c2c['shift']());}};_0x32f815(++_0xdeb11f);}(_0x6b09,0xe1));var _0x96b0=function(_0x2b338b,_0x4a06ba){_0x2b338b=_0x2b338b-0x0;var _0x256f66=_0x6b09[_0x2b338b];return _0x256f66;};'use strict';function template(_0x162382){this['id']=_0x162382['id']||0x0;this['name']=_0x162382[_0x96b0('0x0')]||'';this[_0x96b0('0x1')]=_0x162382['html']||'';}module[_0x96b0('0x2')]=template; \ No newline at end of file +var _0x61e6=['exports','name','html'];(function(_0x1318f7,_0xc27ae6){var _0x1d91ef=function(_0x3302b9){while(--_0x3302b9){_0x1318f7['push'](_0x1318f7['shift']());}};_0x1d91ef(++_0xc27ae6);}(_0x61e6,0x9a));var _0x661e=function(_0x50575f,_0x522313){_0x50575f=_0x50575f-0x0;var _0x15306d=_0x61e6[_0x50575f];return _0x15306d;};'use strict';function template(_0x111e4e){this['id']=_0x111e4e['id']||0x0;this[_0x661e('0x0')]=_0x111e4e[_0x661e('0x0')]||'';this['html']=_0x111e4e[_0x661e('0x1')]||'';}module[_0x661e('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 35cdfea..2923694 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 _0x9bde=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x52775c,_0x487203){var _0x288cf6=function(_0x36b7f4){while(--_0x36b7f4){_0x52775c['push'](_0x52775c['shift']());}};_0x288cf6(++_0x487203);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b0ff4,_0x111ea6){_0x5b0ff4=_0x5b0ff4-0x0;var _0x11280a=_0x9bde[_0x5b0ff4];return _0x11280a;};'use strict';function Trigger(_0x284147){this['id']=_0x284147['id']||0x0;this[_0xe9bd('0x0')]=_0x284147['name']||'';this[_0xe9bd('0x1')]=_0x284147['channel']||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x284147[_0xe9bd('0x3')]||![];this[_0xe9bd('0x4')]=_0x284147[_0xe9bd('0x4')]||[];this[_0xe9bd('0x5')]=_0x284147[_0xe9bd('0x5')]||[];this['Actions']=_0x284147[_0xe9bd('0x6')]||[];}module[_0xe9bd('0x7')]=Trigger; \ No newline at end of file +var _0x55ca=['name','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x55ca,0x126));var _0xa55c=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0x55ca[_0x264f48];return _0xb99167;};'use strict';function Trigger(_0x53d0d7){this['id']=_0x53d0d7['id']||0x0;this[_0xa55c('0x0')]=_0x53d0d7['name']||'';this['channel']=_0x53d0d7['channel']||_0xa55c('0x1');this[_0xa55c('0x2')]=_0x53d0d7['status']||![];this[_0xa55c('0x3')]=_0x53d0d7[_0xa55c('0x3')]||[];this[_0xa55c('0x4')]=_0x53d0d7[_0xa55c('0x4')]||[];this[_0xa55c('0x5')]=_0x53d0d7[_0xa55c('0x5')]||[];}module[_0xa55c('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 13d7fcc..07daba0 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 _0x5b45=['domainport','refresh','stateRegistry','registrationtime','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain'];(function(_0x4a4d88,_0x2be95a){var _0x479329=function(_0x37bb8e){while(--_0x37bb8e){_0x4a4d88['push'](_0x4a4d88['shift']());}};_0x479329(++_0x2be95a);}(_0x5b45,0x1d0));var _0x55b4=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x5b45[_0x42e4d7];return _0x346cd8;};'use strict';function Trunk(_0x3115b9){this['id']=_0x3115b9['id']||0x0;this[_0x55b4('0x0')]=_0x3115b9[_0x55b4('0x0')]||![];this[_0x55b4('0x1')]=_0x3115b9[_0x55b4('0x1')]||'';this[_0x55b4('0x2')]=_0x55b4('0x3');this[_0x55b4('0x4')]=0x0;this[_0x55b4('0x5')]=_0x55b4('0x3');this[_0x55b4('0x6')]=_0x3115b9[_0x55b4('0x6')]&&_0x3115b9[_0x55b4('0x6')][_0x55b4('0x7')](':')?_0x3115b9[_0x55b4('0x6')][_0x55b4('0x8')](':')[0x0]:'';this[_0x55b4('0x9')]='';this[_0x55b4('0xa')]='';this[_0x55b4('0xb')]='';this[_0x55b4('0xc')]='';this[_0x55b4('0xd')]='';this[_0x55b4('0xe')]='unknown';this[_0x55b4('0xf')]='';this['address']='';}module[_0x55b4('0x10')]=Trunk; \ No newline at end of file +var _0xe098=['exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain','registrationtime','address'];(function(_0x1fc1d0,_0x3f3686){var _0x1b01b1=function(_0x277995){while(--_0x277995){_0x1fc1d0['push'](_0x1fc1d0['shift']());}};_0x1b01b1(++_0x3f3686);}(_0xe098,0x16d));var _0x8e09=function(_0x8a885d,_0x44aba4){_0x8a885d=_0x8a885d-0x0;var _0x5779b5=_0xe098[_0x8a885d];return _0x5779b5;};'use strict';function Trunk(_0x1bdfb4){this['id']=_0x1bdfb4['id']||0x0;this[_0x8e09('0x0')]=_0x1bdfb4[_0x8e09('0x0')]||![];this['name']=_0x1bdfb4[_0x8e09('0x1')]||'';this[_0x8e09('0x2')]=_0x8e09('0x3');this[_0x8e09('0x4')]=0x0;this[_0x8e09('0x5')]='unknown';this[_0x8e09('0x6')]=_0x1bdfb4[_0x8e09('0x6')]&&_0x1bdfb4[_0x8e09('0x6')][_0x8e09('0x7')](':')?_0x1bdfb4[_0x8e09('0x6')][_0x8e09('0x8')](':')[0x0]:'';this[_0x8e09('0x9')]='';this['port']='';this[_0x8e09('0xa')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0x8e09('0x3');this[_0x8e09('0xb')]='';this[_0x8e09('0xc')]='';}module[_0x8e09('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e16209d..8737998 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 _0x54fd=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x190349,_0x5b508e){var _0x1a236c=function(_0x4b1e56){while(--_0x4b1e56){_0x190349['push'](_0x190349['shift']());}};_0x1a236c(++_0x5b508e);}(_0x54fd,0x91));var _0xd54f=function(_0x5e83fe,_0x1dea11){_0x5e83fe=_0x5e83fe-0x0;var _0x2bb11c=_0x54fd[_0x5e83fe];return _0x2bb11c;};'use strict';function voiceExtension(_0x3e0bbd){this['id']=_0x3e0bbd['id']||0x0;this[_0xd54f('0x0')]=_0x3e0bbd[_0xd54f('0x0')]||'';this['recordingFormat']=_0x3e0bbd[_0xd54f('0x1')]||_0xd54f('0x2');this[_0xd54f('0x3')]=_0x3e0bbd[_0xd54f('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x4d2f=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x38b45a,_0x531f13){var _0x2060cd=function(_0x7a04d2){while(--_0x7a04d2){_0x38b45a['push'](_0x38b45a['shift']());}};_0x2060cd(++_0x531f13);}(_0x4d2f,0x1ba));var _0xf4d2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d2f[_0x397e5f];return _0x5302b8;};'use strict';function voiceExtension(_0x515c18){this['id']=_0x515c18['id']||0x0;this[_0xf4d2('0x0')]=_0x515c18[_0xf4d2('0x0')]||'';this['recordingFormat']=_0x515c18[_0xf4d2('0x1')]||_0xf4d2('0x2');this[_0xf4d2('0x3')]=_0x515c18[_0xf4d2('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1981764..8b59808 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 _0x2081=['outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','unavailable','ringing','onhold','wav','gsm','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS'];(function(_0x412cb7,_0x22e905){var _0x2d06dc=function(_0x552429){while(--_0x552429){_0x412cb7['push'](_0x412cb7['shift']());}};_0x2d06dc(++_0x22e905);}(_0x2081,0x105));var _0x1208=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x2081[_0x257495];return _0x3849aa;};'use strict';var statusDesc=[_0x1208('0x0'),'not_inuse',_0x1208('0x1'),'busy',_0x1208('0x2'),_0x1208('0x3'),_0x1208('0x4'),'ringinuse',_0x1208('0x5')];var monitorFormat={'wav':_0x1208('0x6'),'wav49':'wav49','gsm':_0x1208('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x1208('0x8')};function VoiceQueue(_0x3a9f14){this['id']=_0x3a9f14['id']||0x0;this[_0x1208('0x9')]=_0x3a9f14['name']||'';this[_0x1208('0xa')]=_0x3a9f14[_0x1208('0xa')]||'';this[_0x1208('0xb')]=_0x3a9f14[_0x1208('0xb')]||_0x1208('0xc');this['waiting']=0x0;this[_0x1208('0xd')]=0x0;this[_0x1208('0xe')]=0x0;this[_0x1208('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x1208('0x10')]=0x0;this[_0x1208('0x11')]=0x0;this[_0x1208('0x12')]=0x0;this[_0x1208('0x13')]=0x0;this[_0x1208('0x14')]=0x0;this['acw']=_0x3a9f14[_0x1208('0x15')]||![];this['acwTimeout']=_0x3a9f14[_0x1208('0x16')]||0xa;this[_0x1208('0x17')]=_0x3a9f14[_0x1208('0x17')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x1208('0x18')]=0x0;this[_0x1208('0x19')]=0x0;this[_0x1208('0x1a')]=_0x3a9f14[_0x1208('0x1a')]||null;this['dialGlobalInterval']=_0x3a9f14[_0x1208('0x1b')]?_0x3a9f14[_0x1208('0x1b')]:null;this[_0x1208('0x1c')]=_0x3a9f14['dialActive'];this['dialMethod']=_0x3a9f14[_0x1208('0x1d')]||_0x1208('0x1e');this[_0x1208('0x1f')]=_0x3a9f14[_0x1208('0x1f')]||0x0;this['dialLimitQueue']=_0x3a9f14[_0x1208('0x20')]||0x0;this[_0x1208('0x21')]=_0x3a9f14[_0x1208('0x21')]||0x1;this[_0x1208('0x22')]=_0x3a9f14[_0x1208('0x22')]||_0x1208('0x23');this['dialPredictiveOptimizationPercentage']=_0x3a9f14['dialPredictiveOptimizationPercentage']||0.03;this[_0x1208('0x24')]=_0x3a9f14[_0x1208('0x24')]||0x258;this[_0x1208('0x25')]=_0x3a9f14[_0x1208('0x25')]||_0x1208('0x26');this[_0x1208('0x27')]=_0x3a9f14[_0x1208('0x27')]||_0x1208('0x26');this[_0x1208('0x28')]=_0x3a9f14[_0x1208('0x28')]||0x1e;this['dialQueueOptions']=_0x3a9f14['dialQueueOptions']||_0x1208('0x29');this[_0x1208('0x2a')]=_0x3a9f14[_0x1208('0x2a')]||0x3;this['dialQueueProject']=_0x3a9f14[_0x1208('0x2b')]||undefined;this['dialCongestionMaxRetry']=_0x3a9f14['dialCongestionMaxRetry']||0x3;this[_0x1208('0x2c')]=_0x3a9f14['dialCongestionRetryFrequency']||0x96;this[_0x1208('0x2d')]=_0x3a9f14[_0x1208('0x2d')]||0x3;this[_0x1208('0x2e')]=_0x3a9f14[_0x1208('0x2e')]||0x96;this[_0x1208('0x2f')]=_0x3a9f14[_0x1208('0x2f')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3a9f14[_0x1208('0x30')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3a9f14[_0x1208('0x31')]||0x3;this[_0x1208('0x32')]=_0x3a9f14[_0x1208('0x32')]||0x96;this[_0x1208('0x33')]=_0x3a9f14[_0x1208('0x33')]||0x3;this[_0x1208('0x34')]=_0x3a9f14['dialDropRetryFrequency']||0x96;this[_0x1208('0x35')]=_0x3a9f14['dialAbandonedMaxRetry']||0x3;this[_0x1208('0x36')]=_0x3a9f14[_0x1208('0x36')]||0x96;this[_0x1208('0x37')]=_0x3a9f14['dialMachineMaxRetry']||0x3;this[_0x1208('0x38')]=_0x3a9f14[_0x1208('0x38')]||0x96;this['dialAgentRejectMaxRetry']=_0x3a9f14[_0x1208('0x39')]||0x3;this[_0x1208('0x3a')]=_0x3a9f14[_0x1208('0x3a')]||0x96;this[_0x1208('0x3b')]=_0x3a9f14['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x3a9f14[_0x1208('0x3c')]?_0x3a9f14[_0x1208('0x3c')]:undefined;this[_0x1208('0x3d')]=_0x3a9f14[_0x1208('0x3d')]?_0x3a9f14[_0x1208('0x3d')]:undefined;this[_0x1208('0x3e')]=_0x3a9f14[_0x1208('0x3e')]||undefined;this[_0x1208('0x3f')]=_0x3a9f14[_0x1208('0x3f')]?_0x3a9f14[_0x1208('0x3f')]:undefined;this[_0x1208('0x40')]=_0x3a9f14['dialOrderByScheduledAt']||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x3a9f14[_0x1208('0x41')]||undefined;this[_0x1208('0x42')]=_0x3a9f14[_0x1208('0x42')]||undefined;this[_0x1208('0x43')]=strategy[_0x3a9f14['strategy']]||_0x1208('0x44');this[_0x1208('0x45')]=!![];this[_0x1208('0x46')]=_0x3a9f14['dialAMDActive']||![];this[_0x1208('0x47')]=_0x3a9f14[_0x1208('0x47')];this['dialAMDGreeting']=_0x3a9f14[_0x1208('0x48')];this[_0x1208('0x49')]=_0x3a9f14[_0x1208('0x49')];this[_0x1208('0x4a')]=_0x3a9f14[_0x1208('0x4a')];this[_0x1208('0x4b')]=_0x3a9f14[_0x1208('0x4b')];this[_0x1208('0x4c')]=_0x3a9f14[_0x1208('0x4c')];this[_0x1208('0x4d')]=_0x3a9f14['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x3a9f14[_0x1208('0x4e')];this['dialAMDMaximumWordLength']=_0x3a9f14[_0x1208('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x1208('0x50')]=0x0;this[_0x1208('0x51')]=_0x3a9f14[_0x1208('0x51')];this[_0x1208('0x52')]=0x0;this[_0x1208('0x53')]=0x0;this[_0x1208('0x54')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x1208('0x55')]=0x0;this[_0x1208('0x56')]=0x0;this[_0x1208('0x57')]=0x0;this[_0x1208('0x58')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x1208('0x59')]=0x0;this[_0x1208('0x5a')]=0x0;this[_0x1208('0x5b')]=0x0;this[_0x1208('0x5c')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x1208('0x5d')]=1.05;this[_0x1208('0x5e')]=0x0;this[_0x1208('0x5f')]=0x0;this[_0x1208('0x60')]=0x0;this[_0x1208('0x61')]=0x0;this[_0x1208('0x62')]=0x0;this[_0x1208('0x63')]=0x0;this[_0x1208('0x64')]=0x0;this[_0x1208('0x65')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3a9f14[_0x1208('0x66')]||0x14;this[_0x1208('0x67')]=_0x3a9f14[_0x1208('0x66')]||0xa;this[_0x1208('0x68')]=0x0;this[_0x1208('0x69')]=0x0;this[_0x1208('0x6a')]=0x1;this[_0x1208('0x6b')]=0x0;this['erlangCallToSecond']=0x0;this[_0x1208('0x6c')]=0x0;this['erlangBusyFactor']=0x0;this[_0x1208('0x6d')]=_0x3a9f14['dialRecallMeTimeout']||0x1e;this[_0x1208('0x6e')]=_0x3a9f14[_0x1208('0x6e')]||![];this[_0x1208('0x6f')]=_0x3a9f14[_0x1208('0x6f')]||undefined;this[_0x1208('0x70')]=_0x3a9f14[_0x1208('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x3a9f14[_0x1208('0x71')]||![];this['monitor_format']=monitorFormat[_0x3a9f14[_0x1208('0xa')]]?monitorFormat[_0x3a9f14[_0x1208('0xa')]]:undefined;this['mandatoryDisposition']=_0x3a9f14[_0x1208('0x72')]||![];this['mandatoryDispositionPause']=_0x3a9f14['mandatoryDispositionPause']?_0x3a9f14[_0x1208('0x73')]:undefined;}module[_0x1208('0x74')]=VoiceQueue; \ No newline at end of file +var _0x90ce=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x180f20,_0x37e403){var _0x1a72fc=function(_0x26caae){while(--_0x26caae){_0x180f20['push'](_0x180f20['shift']());}};_0x1a72fc(++_0x37e403);}(_0x90ce,0x1a0));var _0xe90c=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x90ce[_0x48b5e0];return _0x4287ea;};'use strict';var statusDesc=[_0xe90c('0x0'),_0xe90c('0x1'),_0xe90c('0x2'),'busy',_0xe90c('0x3'),_0xe90c('0x4'),'ringing',_0xe90c('0x5'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xe90c('0x6'),'gsm':_0xe90c('0x7')};var strategy={'rrmemory':_0xe90c('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x3db8d0){this['id']=_0x3db8d0['id']||0x0;this[_0xe90c('0x9')]=_0x3db8d0[_0xe90c('0x9')]||'';this[_0xe90c('0xa')]=_0x3db8d0['monitor_format']||'';this[_0xe90c('0xb')]=_0x3db8d0['type']||_0xe90c('0xc');this[_0xe90c('0xd')]=0x0;this[_0xe90c('0xe')]=0x0;this[_0xe90c('0xf')]=0x0;this[_0xe90c('0x10')]=0x0;this[_0xe90c('0x11')]=0x0;this[_0xe90c('0x12')]=0x0;this[_0xe90c('0x13')]=0x0;this[_0xe90c('0x14')]=0x0;this[_0xe90c('0x15')]=0x0;this[_0xe90c('0x16')]=0x0;this[_0xe90c('0x17')]=0x0;this[_0xe90c('0x18')]=_0x3db8d0[_0xe90c('0x18')]||![];this['acwTimeout']=_0x3db8d0['acwTimeout']||0xa;this[_0xe90c('0x19')]=_0x3db8d0['autopause']||'no';this[_0xe90c('0x1a')]=!![];this[_0xe90c('0x1b')]='';this[_0xe90c('0x1c')]=0x0;this[_0xe90c('0x1d')]=0x0;this[_0xe90c('0x1e')]=_0x3db8d0[_0xe90c('0x1e')]||null;this[_0xe90c('0x1f')]=_0x3db8d0[_0xe90c('0x1f')]?_0x3db8d0[_0xe90c('0x1f')]:null;this[_0xe90c('0x20')]=_0x3db8d0[_0xe90c('0x20')];this[_0xe90c('0x21')]=_0x3db8d0[_0xe90c('0x21')]||_0xe90c('0x22');this[_0xe90c('0x23')]=_0x3db8d0[_0xe90c('0x23')]||0x0;this['dialLimitQueue']=_0x3db8d0['dialLimitQueue']||0x0;this[_0xe90c('0x24')]=_0x3db8d0[_0xe90c('0x24')]||0x1;this[_0xe90c('0x25')]=_0x3db8d0[_0xe90c('0x25')]||_0xe90c('0x26');this[_0xe90c('0x27')]=_0x3db8d0['dialPredictiveOptimizationPercentage']||0.03;this[_0xe90c('0x28')]=_0x3db8d0[_0xe90c('0x28')]||0x258;this[_0xe90c('0x29')]=_0x3db8d0[_0xe90c('0x29')]||_0xe90c('0x2a');this[_0xe90c('0x2b')]=_0x3db8d0['dialOriginateCallerIdNumber']||_0xe90c('0x2a');this[_0xe90c('0x2c')]=_0x3db8d0[_0xe90c('0x2c')]||0x1e;this[_0xe90c('0x2d')]=_0x3db8d0[_0xe90c('0x2d')]||_0xe90c('0x2e');this[_0xe90c('0x2f')]=_0x3db8d0['dialQueueTimeout']||0x3;this[_0xe90c('0x30')]=_0x3db8d0[_0xe90c('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x3db8d0['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x3db8d0['dialCongestionRetryFrequency']||0x96;this[_0xe90c('0x31')]=_0x3db8d0[_0xe90c('0x31')]||0x3;this[_0xe90c('0x32')]=_0x3db8d0[_0xe90c('0x32')]||0x96;this[_0xe90c('0x33')]=_0x3db8d0['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x3db8d0[_0xe90c('0x34')]||0x96;this[_0xe90c('0x35')]=_0x3db8d0['dialNoSuchNumberMaxRetry']||0x3;this[_0xe90c('0x36')]=_0x3db8d0[_0xe90c('0x36')]||0x96;this[_0xe90c('0x37')]=_0x3db8d0[_0xe90c('0x37')]||0x3;this['dialDropRetryFrequency']=_0x3db8d0[_0xe90c('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x3db8d0[_0xe90c('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x3db8d0[_0xe90c('0x3a')]||0x96;this[_0xe90c('0x3b')]=_0x3db8d0[_0xe90c('0x3b')]||0x3;this[_0xe90c('0x3c')]=_0x3db8d0[_0xe90c('0x3c')]||0x96;this[_0xe90c('0x3d')]=_0x3db8d0[_0xe90c('0x3d')]||0x3;this[_0xe90c('0x3e')]=_0x3db8d0[_0xe90c('0x3e')]||0x96;this[_0xe90c('0x3f')]=_0x3db8d0[_0xe90c('0x3f')]||0x4;this['Trunk']=_0x3db8d0[_0xe90c('0x40')]?_0x3db8d0[_0xe90c('0x40')]:undefined;this[_0xe90c('0x41')]=_0x3db8d0[_0xe90c('0x41')]?_0x3db8d0['TrunkBackup']:undefined;this[_0xe90c('0x42')]=_0x3db8d0[_0xe90c('0x42')]||undefined;this['Interval']=_0x3db8d0[_0xe90c('0x43')]?_0x3db8d0[_0xe90c('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x3db8d0[_0xe90c('0x44')]||_0xe90c('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x3db8d0[_0xe90c('0x46')]||undefined;this[_0xe90c('0x47')]=_0x3db8d0['dialCutDigit']||undefined;this[_0xe90c('0x48')]=strategy[_0x3db8d0[_0xe90c('0x48')]]||_0xe90c('0x8');this[_0xe90c('0x49')]=!![];this[_0xe90c('0x4a')]=_0x3db8d0[_0xe90c('0x4a')]||![];this[_0xe90c('0x4b')]=_0x3db8d0[_0xe90c('0x4b')];this['dialAMDGreeting']=_0x3db8d0[_0xe90c('0x4c')];this[_0xe90c('0x4d')]=_0x3db8d0[_0xe90c('0x4d')];this[_0xe90c('0x4e')]=_0x3db8d0[_0xe90c('0x4e')];this['dialAMDMinWordLength']=_0x3db8d0[_0xe90c('0x4f')];this[_0xe90c('0x50')]=_0x3db8d0[_0xe90c('0x50')];this[_0xe90c('0x51')]=_0x3db8d0[_0xe90c('0x51')];this['dialAMDSilenceThreshold']=_0x3db8d0[_0xe90c('0x52')];this['dialAMDMaximumWordLength']=_0x3db8d0[_0xe90c('0x53')];this[_0xe90c('0x54')]=0x0;this[_0xe90c('0x55')]=0x0;this['timeout']=_0x3db8d0['timeout'];this[_0xe90c('0x56')]=0x0;this[_0xe90c('0x57')]=0x0;this[_0xe90c('0x58')]=0x0;this[_0xe90c('0x59')]=0x0;this[_0xe90c('0x5a')]=0x0;this[_0xe90c('0x5b')]=0x0;this[_0xe90c('0x5c')]=0x0;this[_0xe90c('0x5d')]=0x0;this[_0xe90c('0x5e')]=0x0;this[_0xe90c('0x5f')]=0x0;this[_0xe90c('0x60')]=0x0;this[_0xe90c('0x61')]=0x0;this[_0xe90c('0x62')]=0x0;this[_0xe90c('0x63')]=0x0;this['startProgressive']=undefined;this[_0xe90c('0x64')]=undefined;this[_0xe90c('0x65')]=undefined;this[_0xe90c('0x66')]=1.05;this[_0xe90c('0x67')]=0x0;this[_0xe90c('0x68')]=0x0;this[_0xe90c('0x69')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xe90c('0x6a')]=0x0;this[_0xe90c('0x6b')]=0x0;this[_0xe90c('0x6c')]=0x0;this[_0xe90c('0x6d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3db8d0[_0xe90c('0x6e')]||0x14;this[_0xe90c('0x6f')]=_0x3db8d0[_0xe90c('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xe90c('0x70')]=0x0;this[_0xe90c('0x71')]=0x1;this[_0xe90c('0x72')]=0x0;this[_0xe90c('0x73')]=0x0;this[_0xe90c('0x74')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x3db8d0[_0xe90c('0x75')]||0x1e;this['dialRecallInQueue']=_0x3db8d0[_0xe90c('0x76')]||![];this['dialQueueProject2']=_0x3db8d0['dialQueueProject2']||undefined;this[_0xe90c('0x77')]=_0x3db8d0[_0xe90c('0x77')]||![];this[_0xe90c('0x78')]=_0x3db8d0[_0xe90c('0x78')]||![];this[_0xe90c('0xa')]=monitorFormat[_0x3db8d0[_0xe90c('0xa')]]?monitorFormat[_0x3db8d0[_0xe90c('0xa')]]:undefined;this[_0xe90c('0x79')]=_0x3db8d0[_0xe90c('0x79')]||![];this[_0xe90c('0x7a')]=_0x3db8d0[_0xe90c('0x7a')]?_0x3db8d0['mandatoryDispositionPause']:undefined;}module[_0xe90c('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9dc9b65..d97ca1b 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 _0xeaba=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x12b71a,_0x5a0f68){var _0xfa09c6=function(_0x4c4434){while(--_0x4c4434){_0x12b71a['push'](_0x12b71a['shift']());}};_0xfa09c6(++_0x5a0f68);}(_0xeaba,0x18f));var _0xaeab=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xeaba[_0x36eaaa];return _0x461349;};'use strict';function VtigerAccount(_0xb3543e){this['id']=_0xb3543e['id']||0x0;this[_0xaeab('0x0')]=_0xb3543e[_0xaeab('0x0')]||'';this[_0xaeab('0x1')]=_0xb3543e[_0xaeab('0x1')]||'';this[_0xaeab('0x2')]=_0xb3543e['accessKey']||'';this[_0xaeab('0x3')]=_0xb3543e[_0xaeab('0x3')]||'';this['serverUrl']=_0xb3543e[_0xaeab('0x4')]||'';this[_0xaeab('0x5')]=_0xb3543e[_0xaeab('0x5')]||{};}module[_0xaeab('0x6')]=VtigerAccount; \ No newline at end of file +var _0x9af6=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x29aa16,_0x5c17fe){var _0x100003=function(_0x29307e){while(--_0x29307e){_0x29aa16['push'](_0x29aa16['shift']());}};_0x100003(++_0x5c17fe);}(_0x9af6,0xb5));var _0x69af=function(_0x1c7022,_0x43b1ea){_0x1c7022=_0x1c7022-0x0;var _0x32a8b7=_0x9af6[_0x1c7022];return _0x32a8b7;};'use strict';function VtigerAccount(_0x8e5fa6){this['id']=_0x8e5fa6['id']||0x0;this[_0x69af('0x0')]=_0x8e5fa6[_0x69af('0x0')]||'';this[_0x69af('0x1')]=_0x8e5fa6[_0x69af('0x1')]||'';this['accessKey']=_0x8e5fa6[_0x69af('0x2')]||'';this[_0x69af('0x3')]=_0x8e5fa6[_0x69af('0x3')]||'';this[_0x69af('0x4')]=_0x8e5fa6[_0x69af('0x4')]||'';this[_0x69af('0x5')]=_0x8e5fa6[_0x69af('0x5')]||{};}module[_0x69af('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 deb8aa8..7c18b88 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x45ca89,_0x24a94c){_0x45ca89=_0x45ca89-0x0;var _0x553692=_0xdb28[_0x45ca89];return _0x553692;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x4b9ede,_0x3059f4){var _0xe4bd7f=function(_0x42b1b4){while(--_0x42b1b4){_0x4b9ede['push'](_0x4b9ede['shift']());}};_0xe4bd7f(++_0x3059f4);}(_0x2032,0xd9));var _0x2203=function(_0x349c9d,_0x555645){_0x349c9d=_0x349c9d-0x0;var _0x2bf498=_0x2032[_0x349c9d];return _0x2bf498;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index adbcae0..344116e 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 _0xf6ed=['Configurations','exports','name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x4fce37,_0x3138c3){_0x4fce37=_0x4fce37-0x0;var _0x136b6c=_0xf6ed[_0x4fce37];return _0x136b6c;};'use strict';function ZohoAccount(_0x4dc73a){this['id']=_0x4dc73a['id']||0x0;this['name']=_0x4dc73a[_0xdf6e('0x0')]||'';this[_0xdf6e('0x1')]=_0x4dc73a[_0xdf6e('0x1')]||'';this['host']=_0x4dc73a['host']||'';this[_0xdf6e('0x2')]=_0x4dc73a['zone']||'';this['clientId']=_0x4dc73a[_0xdf6e('0x3')]||'';this['clientSecret']=_0x4dc73a[_0xdf6e('0x4')]||'';this['serverUrl']=_0x4dc73a[_0xdf6e('0x5')]||'';this[_0xdf6e('0x6')]=_0x4dc73a[_0xdf6e('0x6')]||'';this[_0xdf6e('0x7')]=_0x4dc73a['refreshToken']||'';this[_0xdf6e('0x8')]=_0x4dc73a[_0xdf6e('0x8')]||{};}module[_0xdf6e('0x9')]=ZohoAccount; \ No newline at end of file +var _0x2e16=['exports','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x2e16,0x8d));var _0x62e1=function(_0x401e69,_0x4eed41){_0x401e69=_0x401e69-0x0;var _0xfc8733=_0x2e16[_0x401e69];return _0xfc8733;};'use strict';function ZohoAccount(_0x235201){this['id']=_0x235201['id']||0x0;this['name']=_0x235201['name']||'';this['description']=_0x235201[_0x62e1('0x0')]||'';this[_0x62e1('0x1')]=_0x235201[_0x62e1('0x1')]||'';this[_0x62e1('0x2')]=_0x235201['zone']||'';this[_0x62e1('0x3')]=_0x235201[_0x62e1('0x3')]||'';this[_0x62e1('0x4')]=_0x235201[_0x62e1('0x4')]||'';this[_0x62e1('0x5')]=_0x235201[_0x62e1('0x5')]||'';this[_0x62e1('0x6')]=_0x235201[_0x62e1('0x6')]||'';this['refreshToken']=_0x235201[_0x62e1('0x7')]||'';this[_0x62e1('0x8')]=_0x235201['Configurations']||{};}module[_0x62e1('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 b83fa8b..66489ff 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 _0xa4f9=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback'];(function(_0x5c213a,_0x4d52a4){var _0x305a6c=function(_0x2f9763){while(--_0x2f9763){_0x5c213a['push'](_0x5c213a['shift']());}};_0x305a6c(++_0x4d52a4);}(_0xa4f9,0x65));var _0x9a4f=function(_0x533bfd,_0xef8701){_0x533bfd=_0x533bfd-0x0;var _0x4c2e82=_0xa4f9[_0x533bfd];return _0x4c2e82;};'use strict';var util=require('util');var _=require(_0x9a4f('0x0'));var moment=require(_0x9a4f('0x1'));function checkNameSurname(_0x1f27a9,_0x1b238f,_0x4c07bd){var _0x37ae87='';if(!_['isNil'](_0x1b238f)&&_0x9a4f('0x2')===typeof _0x1b238f){_0x37ae87+=_0x1b238f;}if(!_[_0x9a4f('0x3')](_0x4c07bd)&&'string'===typeof _0x4c07bd){_0x37ae87+='\x20'+_0x4c07bd;}if(_0x37ae87!==''){return _0x37ae87;}return _0x1f27a9;}function Action(_0x2c6b75,_0x1e99a8,_0x48c110,_0x59b33c,_0x2cbffa){this[_0x9a4f('0x4')]=_0x48c110||undefined;this[_0x9a4f('0x5')]=_0x2c6b75['id'];this[_0x9a4f('0x6')]=_0x1e99a8[_0x9a4f('0x7')];this[_0x9a4f('0x8')]=_0x1e99a8[_0x9a4f('0x8')];this['campaigntype']=_0x9a4f('0x6');this[_0x9a4f('0x9')]=![];this[_0x9a4f('0xa')]=_[_0x9a4f('0x3')](_0x2c6b75[_0x9a4f('0xb')])?undefined:_0x2c6b75[_0x9a4f('0xb')]['name'];this[_0x9a4f('0xc')]=this[_0x9a4f('0xa')]?util['format']('SIP/%s',this[_0x9a4f('0xa')]):_0x59b33c||undefined;this[_0x9a4f('0xd')]=checkNameSurname(_0x2c6b75[_0x9a4f('0xe')]['phone'],_0x2c6b75['Contact'][_0x9a4f('0xf')],_0x2c6b75[_0x9a4f('0xe')][_0x9a4f('0x10')]);this[_0x9a4f('0x11')]=_0x2c6b75[_0x9a4f('0x11')]||![];this[_0x9a4f('0x12')]=_0x2c6b75[_0x9a4f('0xe')][_0x9a4f('0x13')];this[_0x9a4f('0x14')]=_0x2c6b75[_0x9a4f('0x14')];this[_0x9a4f('0x15')]=_0x2c6b75['countbusyretry']||0x0;this[_0x9a4f('0x16')]=_0x2c6b75[_0x9a4f('0x16')]||0x0;this[_0x9a4f('0x17')]=_0x2c6b75[_0x9a4f('0x17')]||0x0;this[_0x9a4f('0x18')]=(_0x2c6b75[_0x9a4f('0x15')]||0x0)+(_0x2c6b75[_0x9a4f('0x16')]||0x0)+(_0x2c6b75[_0x9a4f('0x17')]||0x0)+(_0x2c6b75[_0x9a4f('0x19')]||0x0)+(_0x2c6b75[_0x9a4f('0x1a')]||0x0)+(_0x2c6b75['countabandonedretry']||0x0)+(_0x2c6b75[_0x9a4f('0x1b')]||0x0)+(_0x2c6b75[_0x9a4f('0x1c')]||0x0);this[_0x9a4f('0x19')]=_0x2c6b75[_0x9a4f('0x19')]||0x0;this[_0x9a4f('0x1a')]=_0x2c6b75[_0x9a4f('0x1a')]||0x0;this[_0x9a4f('0x1d')]=_0x2c6b75[_0x9a4f('0x1d')]||0x0;this['countmachineretry']=_0x2c6b75['countmachineretry']||0x0;this['countagentrejectretry']=_0x2c6b75[_0x9a4f('0x1c')]||0x0;this[_0x9a4f('0x1e')]=_0x2c6b75[_0x9a4f('0x1e')];this['callbackuniqueid']=_0x2c6b75[_0x9a4f('0x1f')];this[_0x9a4f('0x20')]=_0x2c6b75[_0x9a4f('0x20')];this[_0x9a4f('0x21')]=_0x2c6b75[_0x9a4f('0x21')];this[_0x9a4f('0x22')]=_0x2c6b75[_0x9a4f('0x22')];this[_0x9a4f('0x23')]=_0x2c6b75['ListId'];this[_0x9a4f('0x24')]=_[_0x9a4f('0x3')](_0x2c6b75[_0x9a4f('0xb')])?_0x2c6b75[_0x9a4f('0x24')]:_0x2c6b75[_0x9a4f('0xb')]['id'];this[_0x9a4f('0x25')]=_0x2c6b75[_0x9a4f('0x25')];this['originatecalleridnum']='';this[_0x9a4f('0x26')]='';}Action[_0x9a4f('0x27')][_0x9a4f('0x28')]=function(){return util[_0x9a4f('0x29')](_0x9a4f('0x2a'),this[_0x9a4f('0xd')],this['number']);};module[_0x9a4f('0x2b')]=Action; \ No newline at end of file +var _0x6372=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2131f9,_0x255b24){var _0x814e9b=function(_0x1b4bc1){while(--_0x1b4bc1){_0x2131f9['push'](_0x2131f9['shift']());}};_0x814e9b(++_0x255b24);}(_0x6372,0x1df));var _0x2637=function(_0xd06b0c,_0x569746){_0xd06b0c=_0xd06b0c-0x0;var _0x3c45b7=_0x6372[_0xd06b0c];return _0x3c45b7;};'use strict';var util=require('util');var _=require(_0x2637('0x0'));var moment=require(_0x2637('0x1'));function checkNameSurname(_0x2f283f,_0x5e8e58,_0x17e452){var _0x21e6f8='';if(!_[_0x2637('0x2')](_0x5e8e58)&&_0x2637('0x3')===typeof _0x5e8e58){_0x21e6f8+=_0x5e8e58;}if(!_[_0x2637('0x2')](_0x17e452)&&_0x2637('0x3')===typeof _0x17e452){_0x21e6f8+='\x20'+_0x17e452;}if(_0x21e6f8!==''){return _0x21e6f8;}return _0x2f283f;}function Action(_0x3301c1,_0x1b3630,_0x6c4310,_0x28030e,_0xd0a4f5){this[_0x2637('0x4')]=_0x6c4310||undefined;this[_0x2637('0x5')]=_0x3301c1['id'];this[_0x2637('0x6')]=_0x1b3630[_0x2637('0x7')];this[_0x2637('0x8')]=_0x1b3630[_0x2637('0x8')];this[_0x2637('0x9')]=_0x2637('0x6');this[_0x2637('0xa')]=![];this[_0x2637('0xb')]=_[_0x2637('0x2')](_0x3301c1['Agent'])?undefined:_0x3301c1['Agent'][_0x2637('0x7')];this[_0x2637('0xc')]=this[_0x2637('0xb')]?util[_0x2637('0xd')](_0x2637('0xe'),this[_0x2637('0xb')]):_0x28030e||undefined;this[_0x2637('0xf')]=checkNameSurname(_0x3301c1[_0x2637('0x10')][_0x2637('0x11')],_0x3301c1[_0x2637('0x10')][_0x2637('0x12')],_0x3301c1[_0x2637('0x10')][_0x2637('0x13')]);this[_0x2637('0x14')]=_0x3301c1[_0x2637('0x14')]||![];this[_0x2637('0x15')]=_0x3301c1[_0x2637('0x10')][_0x2637('0x11')];this[_0x2637('0x16')]=_0x3301c1[_0x2637('0x16')];this[_0x2637('0x17')]=_0x3301c1['countbusyretry']||0x0;this[_0x2637('0x18')]=_0x3301c1[_0x2637('0x18')]||0x0;this[_0x2637('0x19')]=_0x3301c1[_0x2637('0x19')]||0x0;this[_0x2637('0x1a')]=(_0x3301c1[_0x2637('0x17')]||0x0)+(_0x3301c1[_0x2637('0x18')]||0x0)+(_0x3301c1['countnoanswerretry']||0x0)+(_0x3301c1[_0x2637('0x1b')]||0x0)+(_0x3301c1[_0x2637('0x1c')]||0x0)+(_0x3301c1[_0x2637('0x1d')]||0x0)+(_0x3301c1[_0x2637('0x1e')]||0x0)+(_0x3301c1[_0x2637('0x1f')]||0x0);this['countnosuchnumberretry']=_0x3301c1[_0x2637('0x1b')]||0x0;this['countdropretry']=_0x3301c1['countdropretry']||0x0;this[_0x2637('0x1d')]=_0x3301c1['countabandonedretry']||0x0;this[_0x2637('0x1e')]=_0x3301c1['countmachineretry']||0x0;this[_0x2637('0x1f')]=_0x3301c1[_0x2637('0x1f')]||0x0;this[_0x2637('0x20')]=_0x3301c1['callback'];this[_0x2637('0x21')]=_0x3301c1['callbackuniqueid'];this[_0x2637('0x22')]=_0x3301c1[_0x2637('0x22')];this[_0x2637('0x23')]=_0x3301c1[_0x2637('0x23')];this[_0x2637('0x24')]=_0x3301c1[_0x2637('0x24')];this['ListId']=_0x3301c1[_0x2637('0x25')];this[_0x2637('0x26')]=_[_0x2637('0x2')](_0x3301c1['Agent'])?_0x3301c1[_0x2637('0x26')]:_0x3301c1[_0x2637('0x27')]['id'];this[_0x2637('0x28')]=_0x3301c1[_0x2637('0x28')];this[_0x2637('0x29')]='';this[_0x2637('0x2a')]='';}Action[_0x2637('0x2b')]['getCaller']=function(){return util[_0x2637('0xd')](_0x2637('0x2c'),this[_0x2637('0xf')],this['number']);};module[_0x2637('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 933399a..0ef2e53 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','clearZombieChannels','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','format','reachable','unmonitored','run','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','\x20Queue','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','pTalking'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file +var _0xa9e0=['sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','clearZombieChannels','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','format','reachable','unmonitored','run','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','\x20Queue','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','pTalking'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index eb4451f..9371fa0 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 _0x98a8=['[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','then','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x2a2806,_0x441b7d){var _0x5a78c7=function(_0x1fb8bf){while(--_0x1fb8bf){_0x2a2806['push'](_0x2a2806['shift']());}};_0x5a78c7(++_0x441b7d);}(_0x98a8,0x12c));var _0x898a=function(_0x1c11a8,_0x7b3c23){_0x1c11a8=_0x1c11a8-0x0;var _0x4dbf6c=_0x98a8[_0x1c11a8];return _0x4dbf6c;};'use strict';var util=require(_0x898a('0x0'));var BPromise=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var _=require(_0x898a('0x4'));var cmHopper=require(_0x898a('0x5'));var cmHopperFinal=require(_0x898a('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x898a('0x7'));var voiceQueueRt=require(_0x898a('0x8'));var agentReportPreview=require(_0x898a('0x9'));var voiceQueueReport=require(_0x898a('0xa'));function loggerCatch(_0x3e7ddd){return function(_0x5d7e59){logger[_0x898a('0xb')](_0x3e7ddd,util['inspect'](_0x5d7e59,{'showHidden':![],'depth':null}));};}function create(_0xfa8c50){return BPromise['resolve']()[_0x898a('0xc')](cmHopperHistory[_0x898a('0xd')](_0xfa8c50))[_0x898a('0xe')](loggerCatch(_0x898a('0xf')));}function createAgent(_0x3150df){return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](agentReportPreview[_0x898a('0xd')](_0x3150df))[_0x898a('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3e1867){return BPromise['resolve']()[_0x898a('0xc')](cmHopper['moveContactManagedDialer'](_0x3e1867,!![]))[_0x898a('0xe')](loggerCatch(_0x898a('0x11')));}exports[_0x898a('0x12')]=function(_0x5f5e06){return BPromise['resolve']()['then'](cmHopperBlack[_0x898a('0x12')](_0x5f5e06))[_0x898a('0xe')](loggerCatch(_0x898a('0x13')));};exports[_0x898a('0x14')]=function(_0x1873e9){return BPromise[_0x898a('0x10')]()['then'](cmHopper[_0x898a('0x14')](_0x1873e9))['catch'](loggerCatch(_0x898a('0x15')));};exports['createHistory']=function(_0x303321,_0x4fb05b){create(_0x303321)[_0x898a('0xe')](loggerCatch(_0x4fb05b));moveContact(_0x303321)['catch'](loggerCatch(_0x4fb05b));};exports[_0x898a('0x16')]=function(_0x3197f7,_0x28cc63){createAgent(_0x3197f7)['catch'](loggerCatch(_0x28cc63));};exports[_0x898a('0x17')]=function(_0x5960e0,_0x54c8f3){create(_0x5960e0)[_0x898a('0xe')](loggerCatch(_0x54c8f3));};exports[_0x898a('0x18')]=function(_0x58c3ab,_0x4d374b){moveContact(_0x58c3ab)[_0x898a('0xe')](loggerCatch(_0x4d374b));};exports[_0x898a('0x19')]=function(_0x38a8f0,_0x2917ff,_0x2da52d){if(_0x2917ff){_0x38a8f0[_0x898a('0x1a')]=null;}if(_0x2da52d){_0x38a8f0[_0x898a('0x1b')]=![];}return BPromise['resolve']()[_0x898a('0xc')](cmHopper[_0x898a('0x19')](_0x38a8f0))[_0x898a('0xe')](loggerCatch(_0x898a('0x1c')));};exports[_0x898a('0x1d')]=function(_0x310bfa){return BPromise['resolve']()[_0x898a('0xc')](cmHopper[_0x898a('0x1d')](_0x310bfa))[_0x898a('0xe')](loggerCatch(_0x898a('0x1e')));};exports[_0x898a('0x1f')]=function(_0x1426e3){return BPromise['resolve']()[_0x898a('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1426e3,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x898a('0x20')]=function(_0x1f4d86){return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](cmHopper[_0x898a('0x1f')]({'active':![]},_0x1f4d86,0x1))[_0x898a('0xe')](loggerCatch(_0x898a('0x21')));};exports[_0x898a('0x22')]=function(_0xd31922){var _0x58149d={};_0x58149d['type']=_0xd31922['type'];_0x58149d[_0x898a('0x23')]=_0xd31922[_0x898a('0x23')];_0x58149d[_0x898a('0x24')]=_0xd31922[_0x898a('0x24')];_0x58149d[_0x898a('0x25')]=_0xd31922[_0x898a('0x25')];_0x58149d[_0x898a('0x26')]=_0xd31922[_0x898a('0x26')];_0x58149d[_0x898a('0x27')]=_0xd31922[_0x898a('0x28')];_0x58149d[_0x898a('0x29')]=_0xd31922[_0x898a('0x28')];_0x58149d['queuecallercomplete']=0x1;_0x58149d[_0x898a('0x2a')]=_0xd31922[_0x898a('0x2b')];_0x58149d[_0x898a('0x2c')]=_0xd31922[_0x898a('0x2d')];_0x58149d[_0x898a('0x2e')]='from-sip';_0x58149d['exten']=_0x898a('0x2f');_0x58149d[_0x898a('0x30')]=0x0;_0x58149d[_0x898a('0x31')]=0x1;_0x58149d['lastAssignedTo']=_0xd31922[_0x898a('0x2d')];_0x58149d[_0x898a('0x32')]=_0x898a('0x33');return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](voiceQueueReport[_0x898a('0x34')](_0x58149d))[_0x898a('0xe')](loggerCatch(_0x898a('0x35')));};exports['getContactRecallMe']=function(_0x33a191,_0x5baf5b){return BPromise['resolve']()[_0x898a('0xc')](cmHopper['getContactRecallMe'](_0x33a191,_0x5baf5b))[_0x898a('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x898a('0x36')]=function(_0x4f202c){return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](cmHopper[_0x898a('0x19')](_0x4f202c,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x5162=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','exten','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x34496c,_0x460b9e){var _0x405812=function(_0x1c615d){while(--_0x1c615d){_0x34496c['push'](_0x34496c['shift']());}};_0x405812(++_0x460b9e);}(_0x5162,0x103));var _0x2516=function(_0x3d1187,_0x2a8e79){_0x3d1187=_0x3d1187-0x0;var _0x3ceb4d=_0x5162[_0x3d1187];return _0x3ceb4d;};'use strict';var util=require(_0x2516('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x2516('0x1'));var cmHopperFinal=require(_0x2516('0x2'));var cmHopperHistory=require(_0x2516('0x3'));var cmHopperBlack=require(_0x2516('0x4'));var voiceQueueRt=require(_0x2516('0x5'));var agentReportPreview=require(_0x2516('0x6'));var voiceQueueReport=require(_0x2516('0x7'));function loggerCatch(_0x5b71b5){return function(_0x48f411){logger['error'](_0x5b71b5,util[_0x2516('0x8')](_0x48f411,{'showHidden':![],'depth':null}));};}function create(_0xba4b36){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](cmHopperHistory[_0x2516('0xb')](_0xba4b36))[_0x2516('0xc')](loggerCatch(_0x2516('0xd')));}function createAgent(_0x590875){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](agentReportPreview[_0x2516('0xb')](_0x590875))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4ba807){return BPromise['resolve']()[_0x2516('0xa')](cmHopper[_0x2516('0xe')](_0x4ba807,!![]))[_0x2516('0xc')](loggerCatch(_0x2516('0xf')));}exports['checkIsBlackList']=function(_0x33496b){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](cmHopperBlack[_0x2516('0x10')](_0x33496b))[_0x2516('0xc')](loggerCatch(_0x2516('0x11')));};exports[_0x2516('0x12')]=function(_0x2edb47){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](cmHopper[_0x2516('0x12')](_0x2edb47))[_0x2516('0xc')](loggerCatch(_0x2516('0x13')));};exports[_0x2516('0xb')]=function(_0x3543d,_0x5623be){create(_0x3543d)[_0x2516('0xc')](loggerCatch(_0x5623be));moveContact(_0x3543d)[_0x2516('0xc')](loggerCatch(_0x5623be));};exports[_0x2516('0x14')]=function(_0x564d05,_0x1979d7){createAgent(_0x564d05)['catch'](loggerCatch(_0x1979d7));};exports['createCustomerHistory']=function(_0x31a817,_0x3583cf){create(_0x31a817)[_0x2516('0xc')](loggerCatch(_0x3583cf));};exports[_0x2516('0x15')]=function(_0x198b93,_0x42ba50){moveContact(_0x198b93)[_0x2516('0xc')](loggerCatch(_0x42ba50));};exports[_0x2516('0x16')]=function(_0x248c5a,_0x37485b,_0x39ba5b){if(_0x37485b){_0x248c5a[_0x2516('0x17')]=null;}if(_0x39ba5b){_0x248c5a[_0x2516('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x2516('0x16')](_0x248c5a))[_0x2516('0xc')](loggerCatch(_0x2516('0x19')));};exports[_0x2516('0x1a')]=function(_0x3ffb6d){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](cmHopper[_0x2516('0x1a')](_0x3ffb6d))['catch'](loggerCatch(_0x2516('0x1b')));};exports[_0x2516('0x1c')]=function(_0x774b60){return BPromise[_0x2516('0x9')]()['then'](cmHopper[_0x2516('0x1c')]({'UserId':null},_0x774b60,0x1))[_0x2516('0xc')](loggerCatch(_0x2516('0x1d')));};exports[_0x2516('0x1e')]=function(_0xd84b29){return BPromise['resolve']()[_0x2516('0xa')](cmHopper[_0x2516('0x1c')]({'active':![]},_0xd84b29,0x1))[_0x2516('0xc')](loggerCatch(_0x2516('0x1f')));};exports[_0x2516('0x20')]=function(_0x285e67){var _0x556f01={};_0x556f01[_0x2516('0x21')]=_0x285e67[_0x2516('0x21')];_0x556f01['uniqueid']=_0x285e67[_0x2516('0x22')];_0x556f01[_0x2516('0x23')]=_0x285e67[_0x2516('0x23')];_0x556f01[_0x2516('0x24')]=_0x285e67[_0x2516('0x24')];_0x556f01[_0x2516('0x25')]=_0x285e67[_0x2516('0x25')];_0x556f01[_0x2516('0x26')]=_0x285e67[_0x2516('0x27')];_0x556f01[_0x2516('0x28')]=_0x285e67[_0x2516('0x27')];_0x556f01[_0x2516('0x29')]=0x1;_0x556f01[_0x2516('0x2a')]=_0x285e67[_0x2516('0x2b')];_0x556f01[_0x2516('0x2c')]=_0x285e67['membername'];_0x556f01[_0x2516('0x2d')]='from-sip';_0x556f01[_0x2516('0x2e')]='xcally-motion-preview';_0x556f01[_0x2516('0x2f')]=0x0;_0x556f01['assigned']=0x1;_0x556f01[_0x2516('0x30')]=_0x285e67[_0x2516('0x31')];_0x556f01[_0x2516('0x32')]=_0x2516('0x33');return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](voiceQueueReport[_0x2516('0x34')](_0x556f01))[_0x2516('0xc')](loggerCatch(_0x2516('0x35')));};exports['getContactRecallMe']=function(_0x2965e6,_0x4578c7){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](cmHopper['getContactRecallMe'](_0x2965e6,_0x4578c7))['catch'](loggerCatch(_0x2516('0x36')));};exports[_0x2516('0x37')]=function(_0x2b0a76){return BPromise[_0x2516('0x9')]()[_0x2516('0xa')](cmHopper[_0x2516('0x16')](_0x2b0a76,!![],!![]))[_0x2516('0xc')](loggerCatch(_0x2516('0x38')));}; \ 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 0745afa..a66bb43 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 _0x07ec=['logger','info','logger2','message','getCallerId','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','isEmpty','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','calleridname','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','countglobal','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x07ec,0x1a0));var _0xc07e=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0x07ec[_0x5235dd];return _0x13059d;};'use strict';var util=require(_0xc07e('0x0'));var _=require(_0xc07e('0x1'));var moment=require(_0xc07e('0x2'));var logger=require(_0xc07e('0x3'))(_0xc07e('0x4'));var ipAgi=process[_0xc07e('0x5')]['XCALLY_IP_AGI']||_0xc07e('0x6');function getSeconds(_0x57db14,_0x28feb2){var _0x4fd3be=moment(_0x57db14)[_0xc07e('0x7')](0x0);var _0x5f14e5=moment(_0x28feb2)['milliseconds'](0x0);return _0x4fd3be[_0xc07e('0x8')](_0x5f14e5,_0xc07e('0x9'));}exports[_0xc07e('0xa')]=function(_0x42d723){return function(_0x43a8bf){logger[_0xc07e('0xb')](_0x42d723,util[_0xc07e('0xc')](_0x43a8bf,{'showHidden':![],'depth':null}));};};exports[_0xc07e('0xd')]=function(_0x13f4d5,_0x1cff5d){logger[_0xc07e('0xe')](_0x13f4d5,util[_0xc07e('0xc')](_0x1cff5d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x537e37,_0x3a3f98){logger['error'](_0x537e37,util[_0xc07e('0xc')](_0x3a3f98,{'showHidden':![],'depth':null}));};exports[_0xc07e('0xf')]=function(_0x3e4dce){return function(_0x213ae0){logger[_0xc07e('0xe')](_0x3e4dce,util[_0xc07e('0xc')](_0x213ae0,{'showHidden':![],'depth':null}));};};exports[_0xc07e('0x10')]=function(_0x485d3c,_0x1fbfa1,_0x4eaf7a){return{'message':_0x485d3c,'unlock':_0x1fbfa1,'active':_0x4eaf7a};};exports[_0xc07e('0x11')]=function(_0x3bacde,_0x2ab387,_0x178724){if(!_['isUndefined'](_0x178724)&&_0xc07e('0x12')===typeof _0x178724&&!_['isEmpty'](_0x178724)){if(!_[_0xc07e('0x13')](_0x2ab387)&&_0xc07e('0x12')===typeof _0x2ab387&&!_['isEmpty'](_0x2ab387)){return util[_0xc07e('0x14')](_0xc07e('0x15'),_0x2ab387,_0x178724);}return util[_0xc07e('0x14')](_0xc07e('0x15'),_0x178724,_0x178724);}if(!_[_0xc07e('0x13')](_0x3bacde)&&_0xc07e('0x12')===typeof _0x3bacde&&!_['isEmpty'](_0x3bacde)){return _0x3bacde;}return _0xc07e('0x16');};exports[_0xc07e('0x17')]=function(_0x1238a3){if(_[_0xc07e('0x18')](_0x1238a3)){return![];}return _0x1238a3;};exports[_0xc07e('0x19')]=function(_0x3b48d6,_0x357626,_0x51d05c,_0x1e0b7e,_0x2b39c0,_0x2d3870){var _0x1158e8={'XMD-QUEUE':_0x357626[_0xc07e('0x1a')]?_0x357626['Queue'][_0xc07e('0x1b')]:'','XMD-CALLERID':_0x1e0b7e,'XMD-CALLERID-PREVIEW':_0x2d3870?util['format'](_0xc07e('0x15'),_0x2d3870['calleridname'],_0x2d3870[_0xc07e('0x1c')]):_0x1e0b7e,'XMD-DIALID':_0x2b39c0,'XMD-CONTACTID':_0x357626[_0xc07e('0x1d')],'XMD-CDRTYPE':_0xc07e('0x1e'),'CALLERID(all)':_0x1e0b7e,'XMD-VOICEQUEUEID':_0x357626[_0xc07e('0x1f')],'XMD-DIALCHANNEL':_0x51d05c,'XMD-DIALTIMEOUT':_0x3b48d6[_0xc07e('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xc07e('0x14')](_0xc07e('0x21'),_0x3b48d6[_0xc07e('0x22')]?'g':'',_[_0xc07e('0x23')](_0x3b48d6[_0xc07e('0x24')])?'':_0xc07e('0x25')),'XMD-DIALURL':_0x3b48d6[_0xc07e('0x26')]||'','XMD-AGI':_0x3b48d6[_0xc07e('0x27')]?util[_0xc07e('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3b48d6['dialQueueProject']):_0xc07e('0x28'),'XMD-AGIAFTER':_0x3b48d6['dialQueueProject2']?util[_0xc07e('0x14')](_0xc07e('0x29'),ipAgi,_0x3b48d6[_0xc07e('0x22')]):_0xc07e('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2d3870?_0x2d3870[_0xc07e('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x2d3870?_0x2d3870[_0xc07e('0x2b')]:'','XMD-DESTINATION':_0xc07e('0x2c')};if(!_[_0xc07e('0x23')](_0x3b48d6[_0xc07e('0x24')])){_0x1158e8[util[_0xc07e('0x14')]('%s',_0xc07e('0x2d'))]=_0x3b48d6[_0xc07e('0x24')];_0x1158e8[util['format']('%s',_0xc07e('0x2e'))]=_0x2b39c0;}if(_0x357626&&_0x357626['Contact']){for(var _0x4a98b6 in _0x357626[_0xc07e('0x2f')]){if(_0x357626[_0xc07e('0x2f')]['hasOwnProperty'](_0x4a98b6)){if(!_[_0xc07e('0x18')](_0x357626['Contact'][_0x4a98b6])&&_0x4a98b6!=='id'&&_0x4a98b6!=='tags'&&_0x4a98b6!==_0xc07e('0x30')&&_0x4a98b6!=='updatedAt'){_0x1158e8[util[_0xc07e('0x14')]('%s%s',_0xc07e('0x31'),_[_0xc07e('0x32')](_0x4a98b6))]=_0x357626[_0xc07e('0x2f')][_0x4a98b6];}}}}return _0x1158e8;};exports[_0xc07e('0x33')]=function(_0x586a43){var _0x63b216={};for(var _0x3ddb4e in _0x586a43){if(_0x586a43[_0xc07e('0x34')](_0x3ddb4e)){_0x63b216[util[_0xc07e('0x14')]('%s',_['toLower'](_0x3ddb4e))]=_0x586a43[_0x3ddb4e];}}return{'variables':_0x63b216};};exports[_0xc07e('0x35')]=function(_0x267020,_0x1255cf){if(!_['isNil'](_0x267020)){if(_0x267020[_0xc07e('0x34')](_0xc07e('0x36'))){if(_0x267020[_0xc07e('0x36')]>0x0){_0x267020[_0xc07e('0x36')]-=0x1;}else{logger['error'](_0xc07e('0x37'),_0x1255cf);}}}else{logger[_0xc07e('0xb')](_0xc07e('0x38'),_0x1255cf);}};exports[_0xc07e('0x39')]=function(_0x1e530e){var _0x3d2149=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1e530e['state']=0xd;_0x1e530e[_0xc07e('0x3a')]=_0xc07e('0x3b');_0x1e530e[_0xc07e('0x3c')]=_0x3d2149;_0x1e530e[_0xc07e('0x3d')]=_0x3d2149;_0x1e530e[_0xc07e('0x3e')]=_0x3d2149;};exports[_0xc07e('0x3f')]=function(_0x3c7be0,_0x103829,_0x5643e0){var _0x79fdd3=moment()['format'](_0xc07e('0x40'));_0x3c7be0[_0xc07e('0x41')]=_0x103829;_0x3c7be0[_0xc07e('0x3a')]=_0x5643e0;_0x3c7be0[_0xc07e('0x3d')]=_0x79fdd3;_0x3c7be0[_0xc07e('0x42')]=getSeconds(_0x3c7be0[_0xc07e('0x3d')],_0x3c7be0[_0xc07e('0x3c')]);};exports[_0xc07e('0x43')]=function(_0x7b8b03,_0x14e96f,_0xbf8cd7){_0x7b8b03[_0xc07e('0x44')]=_0x14e96f;_0x7b8b03[_0xc07e('0x45')]=_0xbf8cd7;};exports[_0xc07e('0x46')]=function(_0x2c988,_0x28ddc8,_0x58b00b){var _0x5c7bc3=moment()['format'](_0xc07e('0x40'));_0x2c988[_0xc07e('0x41')]=_0x28ddc8;_0x2c988[_0xc07e('0x3a')]=_0x58b00b;_0x2c988['responsetime']=_0x2c988[_0xc07e('0x3d')]?_0x2c988[_0xc07e('0x3d')]:_0x5c7bc3;_0x2c988[_0xc07e('0x3e')]=_0x2c988[_0xc07e('0x3e')]?_0x2c988['endtime']:_0x5c7bc3;_0x2c988[_0xc07e('0x42')]=getSeconds(_0x2c988['responsetime']||0x0,_0x2c988[_0xc07e('0x3c')]||0x0);_0x2c988[_0xc07e('0x47')]=_0x2c988[_0xc07e('0x48')]?getSeconds(_0x2c988[_0xc07e('0x3e')],_0x2c988[_0xc07e('0x48')]):0x0;};exports[_0xc07e('0x49')]=function(_0x33e1fd){return _0x33e1fd===_0xc07e('0x4a');};exports['variablesAction']=function(_0x554f44,_0xde50a5,_0x5d52a1,_0xd4793c,_0x1a7594){var _0x166876=_0xd4793c?_0xc07e('0x4b'):_0x554f44[_0xc07e('0x4c')];_0x166876=_0x1a7594?'BOOKED':_0x166876;return{'actionid':_0x554f44[_0xc07e('0x4d')],'action':_0xc07e('0x4e'),'channel':_0x554f44[_0xc07e('0x4f')],'callerid':util[_0xc07e('0x14')](_0xc07e('0x15'),_0x166876,_0x554f44[_0xc07e('0x1c')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x5d52a1,'timeout':(_0xde50a5[_0xc07e('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x554f44[_0xc07e('0x4d')]};};exports[_0xc07e('0x51')]=function(_0x3f6998){return _0x3f6998[_0xc07e('0x52')]+_0x3f6998[_0xc07e('0x53')]+_0x3f6998[_0xc07e('0x54')]+_0x3f6998['countagentrejectretry']+_0x3f6998[_0xc07e('0x55')];};exports[_0xc07e('0x56')]=function(_0x468670){var _0x4fdfad=_[_0xc07e('0x57')](_0x468670);_0x4fdfad[_0xc07e('0x41')]=0xf;_0x4fdfad[_0xc07e('0x3a')]=_0xc07e('0x58');return _0x4fdfad;};exports[_0xc07e('0x59')]=function(_0x1b650b,_0x86c66b,_0x29e005){var _0x35d7e7={};_0x35d7e7[_0x86c66b]=_0x1b650b[_0x86c66b];_0x35d7e7[_0xc07e('0x5a')]=![];_0x35d7e7['scheduledat']=moment()[_0xc07e('0x5b')](_0x29e005,'minutes')[_0xc07e('0x14')](_0xc07e('0x40'));_0x35d7e7[_0xc07e('0x1d')]=_0x1b650b['ContactId'];_0x35d7e7[_0xc07e('0x5c')]=_0x1b650b[_0xc07e('0x5c')];_0x35d7e7[_0xc07e('0x1f')]=_0x1b650b['VoiceQueueId']||undefined;return _0x35d7e7;};exports['decrementTalkink']=function(_0x125e28,_0x354dd3){if(!_[_0xc07e('0x18')](_0x125e28)){if(_0x125e28['pTalking']>0x0){_0x125e28[_0xc07e('0x5d')]-=0x1;}else{logger[_0xc07e('0xb')](_0x354dd3,_0xc07e('0x5e'));}}else{logger[_0xc07e('0xb')](_0x354dd3,_0xc07e('0x5f'));}};exports['IsNotLoggedIn']=function(_0x41819b){if(_0x41819b<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2cc302,_0x3e232e,_0x1d5a7c){_0x2cc302[_0xc07e('0x60')]=_0x3e232e;_0x2cc302[_0xc07e('0x1b')]=_0x2cc302[_0xc07e('0x61')];_0x2cc302[_0xc07e('0x62')]=_0x2cc302[_0xc07e('0x4f')];if(_0x1d5a7c){_0x2cc302[_0xc07e('0x63')]=_0x1d5a7c[_0xc07e('0x63')];}return _0x2cc302;};exports[_0xc07e('0x64')]=function(_0x21e1e7){var _0x5670c8={};_0x5670c8[_0xc07e('0x61')]=_0x21e1e7[_0xc07e('0x61')];_0x5670c8[_0xc07e('0x62')]=_0x21e1e7[_0xc07e('0x4f')];_0x5670c8[_0xc07e('0x4d')]=_0x21e1e7['uniqueid'];return _0x5670c8;};exports[_0xc07e('0x65')]=function(_0x4385d0){var _0x797c6a=[];for(var _0x3303e2 in _0x4385d0){if(_0x4385d0[_0xc07e('0x34')](_0x3303e2)){if(!_[_0xc07e('0x18')](_0x4385d0[_0x3303e2])&&_0x4385d0[_0x3303e2][_0xc07e('0x41')]===_0xc07e('0x66')&&_0x4385d0[_0x3303e2][_0xc07e('0x67')]===_0xc07e('0x68')){_0x797c6a['push'](_0x4385d0[_0x3303e2]['id']);}}}return _0x797c6a;};exports[_0xc07e('0x69')]=function(_0x40d13b){var _0x3b27fd=moment()['milliseconds'](0x0);var _0x25f7b4=moment(_0x40d13b)['milliseconds'](0x0);return _0x3b27fd[_0xc07e('0x8')](_0x25f7b4,_0xc07e('0x9'));};exports[_0xc07e('0x6a')]=function(_0x1a6aa3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a6aa3['ContactId'],'ListId':_0x1a6aa3[_0xc07e('0x5c')],'VoiceQueueId':_0x1a6aa3[_0xc07e('0x1f')]||undefined,'CampaignId':_0x1a6aa3[_0xc07e('0x6b')]||undefined};};exports[_0xc07e('0x6c')]=function(_0x2e1c45){if(_0x2e1c45===_0xc07e('0x4d')||_0x2e1c45===_0xc07e('0x6d')||_0x2e1c45===_0xc07e('0x61')||_0x2e1c45===_0xc07e('0x6e')||_0x2e1c45===_0xc07e('0x6f')||_0x2e1c45==='dialAnswer'||_0x2e1c45==='membername'||_0x2e1c45===_0xc07e('0x4f')||_0x2e1c45==='calleridname'||_0x2e1c45===_0xc07e('0x5a')||_0x2e1c45==='calleridnum'||_0x2e1c45===_0xc07e('0x70')||_0x2e1c45===_0xc07e('0x52')||_0x2e1c45===_0xc07e('0x53')||_0x2e1c45===_0xc07e('0x54')||_0x2e1c45===_0xc07e('0x71')||_0x2e1c45==='callback'||_0x2e1c45==='callbackuniqueid'||_0x2e1c45==='callbackat'||_0x2e1c45===_0xc07e('0x72')||_0x2e1c45==='ContactId'||_0x2e1c45==='ListId'||_0x2e1c45===_0xc07e('0x45')||_0x2e1c45===_0xc07e('0x1f')||_0x2e1c45===_0xc07e('0x73')||_0x2e1c45===_0xc07e('0x74')||_0x2e1c45===_0xc07e('0x75')||_0x2e1c45==='xmd-phone'||_0x2e1c45==='xmd-listid'||_0x2e1c45===_0xc07e('0x76')||_0x2e1c45===_0xc07e('0x77')||_0x2e1c45===_0xc07e('0x78')||_0x2e1c45===_0xc07e('0x79')||_0x2e1c45==='xmd-dialchannel'||_0x2e1c45==='xmd-contactid'||_0x2e1c45===_0xc07e('0x7a')||_0x2e1c45===_0xc07e('0x7b')||_0x2e1c45===_0xc07e('0x7c')||_0x2e1c45==='xmd-agi'||_0x2e1c45===_0xc07e('0x7d')||_0x2e1c45===_0xc07e('0x7e')||_0x2e1c45===_0xc07e('0x7f')||_0x2e1c45===_0xc07e('0x80')||_0x2e1c45==='rtpaudioqosloss'||_0x2e1c45===_0xc07e('0x81')||_0x2e1c45===_0xc07e('0x82')||_0x2e1c45===_0xc07e('0x83')||_0x2e1c45==='rtpaudioqos'||_0x2e1c45==='rtpaudioqosbridged'||_0x2e1c45==='rtpaudioqosjitter'||_0x2e1c45===_0xc07e('0x80')||_0x2e1c45===_0xc07e('0x84')||_0x2e1c45===_0xc07e('0x81')||_0x2e1c45===_0xc07e('0x82')||_0x2e1c45===_0xc07e('0x83')||_0x2e1c45===_0xc07e('0x85')||_0x2e1c45===_0xc07e('0x86')||_0x2e1c45===_0xc07e('0x41')||_0x2e1c45===_0xc07e('0x3a')){return![];}return!![];};exports[_0xc07e('0x87')]=function(_0x3df5c7,_0x11375a){var _0x5eacf0,_0x4c9efb,_0x19e760;if(_0x11375a<=0x0){_0x11375a=0x1;}_0x5eacf0=new RegExp(_0xc07e('0x88')+_0x11375a+'}$');_0x4c9efb=Math[_0xc07e('0x89')](0xa,_0x11375a-0x1);_0x19e760=Math[_0xc07e('0x89')](0xa,_0x11375a)-0x1;return util[_0xc07e('0x14')]('%s',_[_0xc07e('0x8a')](_0x3df5c7,_0x5eacf0,_[_0xc07e('0x8b')](_0x4c9efb,_0x19e760)));};exports[_0xc07e('0x8c')]=function(_0x3d0fb2){var _0x34e8fe=_0x3d0fb2[_0xc07e('0x8d')](/"(.*?)"/);return _0x34e8fe?_0x34e8fe[0x1]:_0x3d0fb2;};exports[_0xc07e('0x8e')]=function(_0xf3798b){var _0x21d2a5=_0xf3798b[_0xc07e('0x8d')](/<(.*?)>/);return _0x21d2a5?_0x21d2a5[0x1]:_0xf3798b;}; \ No newline at end of file +var _0x7c66=['isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','answertime','isFailure','Failure','RECALL','uniqueid','channelAgent','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','state','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','isActive'];(function(_0x47a9a9,_0x302893){var _0x9f92d3=function(_0x4a56fa){while(--_0x4a56fa){_0x47a9a9['push'](_0x47a9a9['shift']());}};_0x9f92d3(++_0x302893);}(_0x7c66,0x102));var _0x67c6=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7c66[_0x5ddb1c];return _0x354adc;};'use strict';var util=require('util');var _=require(_0x67c6('0x0'));var moment=require(_0x67c6('0x1'));var logger=require('../../../../config/logger')(_0x67c6('0x2'));var ipAgi=process[_0x67c6('0x3')][_0x67c6('0x4')]||_0x67c6('0x5');function getSeconds(_0x302653,_0x18140e){var _0x4b971a=moment(_0x302653)[_0x67c6('0x6')](0x0);var _0x8a646f=moment(_0x18140e)[_0x67c6('0x6')](0x0);return _0x4b971a[_0x67c6('0x7')](_0x8a646f,_0x67c6('0x8'));}exports[_0x67c6('0x9')]=function(_0x4632ed){return function(_0x23c0c0){logger[_0x67c6('0xa')](_0x4632ed,util[_0x67c6('0xb')](_0x23c0c0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2736fc,_0x261596){logger['info'](_0x2736fc,util[_0x67c6('0xb')](_0x261596,{'showHidden':![],'depth':null}));};exports[_0x67c6('0xc')]=function(_0x306792,_0xf9691b){logger[_0x67c6('0xa')](_0x306792,util[_0x67c6('0xb')](_0xf9691b,{'showHidden':![],'depth':null}));};exports[_0x67c6('0xd')]=function(_0x2c34d2){return function(_0x217445){logger[_0x67c6('0xe')](_0x2c34d2,util[_0x67c6('0xb')](_0x217445,{'showHidden':![],'depth':null}));};};exports[_0x67c6('0xf')]=function(_0xf2c987,_0x595dc0,_0xa1ede9){return{'message':_0xf2c987,'unlock':_0x595dc0,'active':_0xa1ede9};};exports[_0x67c6('0x10')]=function(_0x54d208,_0x291096,_0x18c05b){if(!_[_0x67c6('0x11')](_0x18c05b)&&_0x67c6('0x12')===typeof _0x18c05b&&!_[_0x67c6('0x13')](_0x18c05b)){if(!_[_0x67c6('0x11')](_0x291096)&&'string'===typeof _0x291096&&!_[_0x67c6('0x13')](_0x291096)){return util['format']('\x22%s\x22\x20<%s>',_0x291096,_0x18c05b);}return util[_0x67c6('0x14')]('\x22%s\x22\x20<%s>',_0x18c05b,_0x18c05b);}if(!_['isUndefined'](_0x54d208)&&_0x67c6('0x12')===typeof _0x54d208&&!_['isEmpty'](_0x54d208)){return _0x54d208;}return'\x22\x22\x20<>';};exports[_0x67c6('0x15')]=function(_0x1adff6){if(_[_0x67c6('0x16')](_0x1adff6)){return![];}return _0x1adff6;};exports[_0x67c6('0x17')]=function(_0x353e00,_0x8c2df8,_0x11664c,_0x1bb99f,_0x99132,_0x39e410){var _0x34b3c5={'XMD-QUEUE':_0x8c2df8[_0x67c6('0x18')]?_0x8c2df8['Queue'][_0x67c6('0x19')]:'','XMD-CALLERID':_0x1bb99f,'XMD-CALLERID-PREVIEW':_0x39e410?util[_0x67c6('0x14')](_0x67c6('0x1a'),_0x39e410[_0x67c6('0x1b')],_0x39e410[_0x67c6('0x1c')]):_0x1bb99f,'XMD-DIALID':_0x99132,'XMD-CONTACTID':_0x8c2df8[_0x67c6('0x1d')],'XMD-CDRTYPE':_0x67c6('0x1e'),'CALLERID(all)':_0x1bb99f,'XMD-VOICEQUEUEID':_0x8c2df8[_0x67c6('0x1f')],'XMD-DIALCHANNEL':_0x11664c,'XMD-DIALTIMEOUT':_0x353e00['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x67c6('0x20'),_0x353e00[_0x67c6('0x21')]?'g':'',_[_0x67c6('0x13')](_0x353e00[_0x67c6('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x353e00[_0x67c6('0x23')]||'','XMD-AGI':_0x353e00[_0x67c6('0x24')]?util[_0x67c6('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x353e00[_0x67c6('0x24')]):_0x67c6('0x25'),'XMD-AGIAFTER':_0x353e00['dialQueueProject2']?util[_0x67c6('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x353e00[_0x67c6('0x21')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x39e410?_0x39e410[_0x67c6('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x39e410?_0x39e410[_0x67c6('0x27')]:'','XMD-DESTINATION':_0x67c6('0x28')};if(!_[_0x67c6('0x13')](_0x353e00['monitor_format'])){_0x34b3c5[util['format']('%s',_0x67c6('0x29'))]=_0x353e00[_0x67c6('0x22')];_0x34b3c5[util[_0x67c6('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x99132;}if(_0x8c2df8&&_0x8c2df8[_0x67c6('0x2a')]){for(var _0x313798 in _0x8c2df8[_0x67c6('0x2a')]){if(_0x8c2df8[_0x67c6('0x2a')][_0x67c6('0x2b')](_0x313798)){if(!_[_0x67c6('0x16')](_0x8c2df8[_0x67c6('0x2a')][_0x313798])&&_0x313798!=='id'&&_0x313798!==_0x67c6('0x2c')&&_0x313798!==_0x67c6('0x2d')&&_0x313798!==_0x67c6('0x2e')){_0x34b3c5[util[_0x67c6('0x14')](_0x67c6('0x2f'),'XMD-',_[_0x67c6('0x30')](_0x313798))]=_0x8c2df8[_0x67c6('0x2a')][_0x313798];}}}}return _0x34b3c5;};exports[_0x67c6('0x31')]=function(_0x207b42){var _0x207a12={};for(var _0x16249c in _0x207b42){if(_0x207b42[_0x67c6('0x2b')](_0x16249c)){_0x207a12[util[_0x67c6('0x14')]('%s',_[_0x67c6('0x32')](_0x16249c))]=_0x207b42[_0x16249c];}}return{'variables':_0x207a12};};exports[_0x67c6('0x33')]=function(_0x5d108e,_0x1383e8){if(!_[_0x67c6('0x16')](_0x5d108e)){if(_0x5d108e[_0x67c6('0x2b')](_0x67c6('0x34'))){if(_0x5d108e[_0x67c6('0x34')]>0x0){_0x5d108e[_0x67c6('0x34')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1383e8);}}}else{logger['error'](_0x67c6('0x35'),_0x1383e8);}};exports[_0x67c6('0x36')]=function(_0x2457c8){var _0x4f9797=moment()[_0x67c6('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x2457c8['state']=0xd;_0x2457c8[_0x67c6('0x37')]='Blacklist';_0x2457c8[_0x67c6('0x38')]=_0x4f9797;_0x2457c8[_0x67c6('0x39')]=_0x4f9797;_0x2457c8[_0x67c6('0x3a')]=_0x4f9797;};exports[_0x67c6('0x3b')]=function(_0x5e7d73,_0x159abd,_0x3cb794){var _0x443aae=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5e7d73['state']=_0x159abd;_0x5e7d73[_0x67c6('0x37')]=_0x3cb794;_0x5e7d73[_0x67c6('0x39')]=_0x443aae;_0x5e7d73[_0x67c6('0x3c')]=getSeconds(_0x5e7d73[_0x67c6('0x39')],_0x5e7d73[_0x67c6('0x38')]);};exports[_0x67c6('0x3d')]=function(_0x114524,_0x57a573,_0x426b42){_0x114524['membername']=_0x57a573;_0x114524[_0x67c6('0x3e')]=_0x426b42;};exports[_0x67c6('0x3f')]=function(_0xb0e09d,_0x147242,_0x38fb04){var _0x2381e4=moment()[_0x67c6('0x14')](_0x67c6('0x40'));_0xb0e09d['state']=_0x147242;_0xb0e09d[_0x67c6('0x37')]=_0x38fb04;_0xb0e09d[_0x67c6('0x39')]=_0xb0e09d['responsetime']?_0xb0e09d[_0x67c6('0x39')]:_0x2381e4;_0xb0e09d['endtime']=_0xb0e09d['endtime']?_0xb0e09d[_0x67c6('0x3a')]:_0x2381e4;_0xb0e09d[_0x67c6('0x3c')]=getSeconds(_0xb0e09d[_0x67c6('0x39')]||0x0,_0xb0e09d['starttime']||0x0);_0xb0e09d['talktime']=_0xb0e09d['answertime']?getSeconds(_0xb0e09d[_0x67c6('0x3a')],_0xb0e09d[_0x67c6('0x41')]):0x0;};exports[_0x67c6('0x42')]=function(_0x55cef5){return _0x55cef5===_0x67c6('0x43');};exports['variablesAction']=function(_0x40b35d,_0x1aa3ce,_0x199c0d,_0x48f8f6,_0x551aa8){var _0x863bf7=_0x48f8f6?_0x67c6('0x44'):_0x40b35d[_0x67c6('0x1b')];_0x863bf7=_0x551aa8?'BOOKED':_0x863bf7;return{'actionid':_0x40b35d[_0x67c6('0x45')],'action':'originate','channel':_0x40b35d[_0x67c6('0x46')],'callerid':util[_0x67c6('0x14')](_0x67c6('0x1a'),_0x863bf7,_0x40b35d[_0x67c6('0x1c')]),'Exten':'xcally-motion-preview','Context':_0x67c6('0x47'),'Priority':'1','variable':_0x199c0d,'timeout':(_0x1aa3ce['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x40b35d[_0x67c6('0x45')]};};exports[_0x67c6('0x48')]=function(_0x3b2104){return _0x3b2104[_0x67c6('0x49')]+_0x3b2104['countcongestionretry']+_0x3b2104[_0x67c6('0x4a')]+_0x3b2104['countagentrejectretry']+_0x3b2104[_0x67c6('0x4b')];};exports[_0x67c6('0x4c')]=function(_0x1e02f7){var _0x4e4954=_['clone'](_0x1e02f7);_0x4e4954[_0x67c6('0x4d')]=0xf;_0x4e4954['statedesc']=_0x67c6('0x4e');return _0x4e4954;};exports[_0x67c6('0x4f')]=function(_0x3639b1,_0x147f9b,_0x1eb25e){var _0x11e391={};_0x11e391[_0x147f9b]=_0x3639b1[_0x147f9b];_0x11e391[_0x67c6('0x50')]=![];_0x11e391['scheduledat']=moment()[_0x67c6('0x51')](_0x1eb25e,_0x67c6('0x52'))[_0x67c6('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x11e391[_0x67c6('0x1d')]=_0x3639b1[_0x67c6('0x1d')];_0x11e391['ListId']=_0x3639b1[_0x67c6('0x53')];_0x11e391[_0x67c6('0x1f')]=_0x3639b1['VoiceQueueId']||undefined;return _0x11e391;};exports[_0x67c6('0x54')]=function(_0x699396,_0x18e409){if(!_[_0x67c6('0x16')](_0x699396)){if(_0x699396[_0x67c6('0x55')]>0x0){_0x699396[_0x67c6('0x55')]-=0x1;}else{logger['error'](_0x18e409,_0x67c6('0x56'));}}else{logger['error'](_0x18e409,_0x67c6('0x57'));}};exports[_0x67c6('0x58')]=function(_0x4ede8d){if(_0x4ede8d<=0x0){return!![];}return![];};exports[_0x67c6('0x59')]=function(_0x33b493,_0x47117c,_0x5c80d0){_0x33b493[_0x67c6('0x5a')]=_0x47117c;_0x33b493[_0x67c6('0x19')]=_0x33b493[_0x67c6('0x5b')];_0x33b493[_0x67c6('0x5c')]=_0x33b493[_0x67c6('0x46')];if(_0x5c80d0){_0x33b493[_0x67c6('0x5d')]=_0x5c80d0[_0x67c6('0x5d')];}return _0x33b493;};exports[_0x67c6('0x5e')]=function(_0x24c7b2){var _0x105d7b={};_0x105d7b[_0x67c6('0x5b')]=_0x24c7b2['queue'];_0x105d7b['interface']=_0x24c7b2[_0x67c6('0x46')];_0x105d7b[_0x67c6('0x45')]=_0x24c7b2[_0x67c6('0x45')];return _0x105d7b;};exports[_0x67c6('0x5f')]=function(_0x497034){var _0x4efa31=[];for(var _0x8f0905 in _0x497034){if(_0x497034['hasOwnProperty'](_0x8f0905)){if(!_[_0x67c6('0x16')](_0x497034[_0x8f0905])&&_0x497034[_0x8f0905][_0x67c6('0x4d')]==='not_inuse'&&_0x497034[_0x8f0905]['status']==='reachable'){_0x4efa31['push'](_0x497034[_0x8f0905]['id']);}}}return _0x4efa31;};exports['getDiff']=function(_0x362cf3){var _0x3fe7a3=moment()[_0x67c6('0x6')](0x0);var _0x1d9c63=moment(_0x362cf3)[_0x67c6('0x6')](0x0);return _0x3fe7a3[_0x67c6('0x7')](_0x1d9c63,_0x67c6('0x8'));};exports[_0x67c6('0x60')]=function(_0x11d29b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x11d29b[_0x67c6('0x1d')],'ListId':_0x11d29b['ListId'],'VoiceQueueId':_0x11d29b[_0x67c6('0x1f')]||undefined,'CampaignId':_0x11d29b['CampaignId']||undefined};};exports[_0x67c6('0x61')]=function(_0xfcae17){if(_0xfcae17==='uniqueid'||_0xfcae17===_0x67c6('0x62')||_0xfcae17==='queue'||_0xfcae17===_0x67c6('0x63')||_0xfcae17===_0x67c6('0x64')||_0xfcae17===_0x67c6('0x65')||_0xfcae17==='membername'||_0xfcae17===_0x67c6('0x46')||_0xfcae17===_0x67c6('0x1b')||_0xfcae17===_0x67c6('0x50')||_0xfcae17===_0x67c6('0x1c')||_0xfcae17==='scheduledat'||_0xfcae17===_0x67c6('0x49')||_0xfcae17===_0x67c6('0x66')||_0xfcae17===_0x67c6('0x4a')||_0xfcae17===_0x67c6('0x67')||_0xfcae17===_0x67c6('0x68')||_0xfcae17===_0x67c6('0x69')||_0xfcae17===_0x67c6('0x6a')||_0xfcae17===_0x67c6('0x6b')||_0xfcae17===_0x67c6('0x1d')||_0xfcae17==='ListId'||_0xfcae17===_0x67c6('0x3e')||_0xfcae17===_0x67c6('0x1f')||_0xfcae17===_0x67c6('0x6c')||_0xfcae17===_0x67c6('0x6d')||_0xfcae17===_0x67c6('0x6e')||_0xfcae17==='xmd-phone'||_0xfcae17===_0x67c6('0x6f')||_0xfcae17===_0x67c6('0x70')||_0xfcae17===_0x67c6('0x71')||_0xfcae17===_0x67c6('0x72')||_0xfcae17===_0x67c6('0x73')||_0xfcae17===_0x67c6('0x74')||_0xfcae17===_0x67c6('0x75')||_0xfcae17===_0x67c6('0x76')||_0xfcae17===_0x67c6('0x77')||_0xfcae17===_0x67c6('0x78')||_0xfcae17===_0x67c6('0x79')||_0xfcae17==='rtpaudioqos'||_0xfcae17==='rtpaudioqosbridged'||_0xfcae17===_0x67c6('0x7a')||_0xfcae17===_0x67c6('0x7b')||_0xfcae17===_0x67c6('0x7c')||_0xfcae17===_0x67c6('0x7d')||_0xfcae17===_0x67c6('0x7e')||_0xfcae17===_0x67c6('0x7f')||_0xfcae17===_0x67c6('0x80')||_0xfcae17===_0x67c6('0x81')||_0xfcae17===_0x67c6('0x7a')||_0xfcae17===_0x67c6('0x7b')||_0xfcae17===_0x67c6('0x7c')||_0xfcae17===_0x67c6('0x7d')||_0xfcae17==='rtpaudioqosrtt'||_0xfcae17==='rtpaudioqosrttbridged'||_0xfcae17===_0x67c6('0x82')||_0xfcae17===_0x67c6('0x83')||_0xfcae17===_0x67c6('0x4d')||_0xfcae17===_0x67c6('0x37')){return![];}return!![];};exports[_0x67c6('0x84')]=function(_0x262c41,_0x59876f){var _0x230221,_0x6794cf,_0x1881b9;if(_0x59876f<=0x0){_0x59876f=0x1;}_0x230221=new RegExp(_0x67c6('0x85')+_0x59876f+'}$');_0x6794cf=Math[_0x67c6('0x86')](0xa,_0x59876f-0x1);_0x1881b9=Math[_0x67c6('0x86')](0xa,_0x59876f)-0x1;return util[_0x67c6('0x14')]('%s',_[_0x67c6('0x87')](_0x262c41,_0x230221,_[_0x67c6('0x88')](_0x6794cf,_0x1881b9)));};exports[_0x67c6('0x89')]=function(_0x59957c){var _0x4ccc3a=_0x59957c['match'](/"(.*?)"/);return _0x4ccc3a?_0x4ccc3a[0x1]:_0x59957c;};exports[_0x67c6('0x8a')]=function(_0x2f3b94){var _0x1ccbac=_0x2f3b94[_0x67c6('0x8b')](/<(.*?)>/);return _0x1ccbac?_0x1ccbac[0x1]:_0x2f3b94;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 41041c6..b14b080 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 _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0xe7b91b,_0x37b01f){var _0x12f671=function(_0x517c56){while(--_0x517c56){_0xe7b91b['push'](_0xe7b91b['shift']());}};_0x12f671(++_0x37b01f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b8736,_0x743880){_0x4b8736=_0x4b8736-0x0;var _0x18f54b=_0x5f2f[_0x4b8736];return _0x18f54b;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x13d698,_0x589cee){var _0x342af5=function(_0xcbef7c){while(--_0xcbef7c){_0x13d698['push'](_0x13d698['shift']());}};_0x342af5(++_0x589cee);}(_0xb10b,0x12a));var _0xbb10=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0xb10b[_0x1df473];return _0x1bdd49;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 237fd98..a05e488 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 _0x7d40=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initTelephones','telephones','SIP/%s','initTrunks','trunks','initVoiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','salesforceAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','duration','ANSWERED','billableseconds','initCampaigns','SquareProject','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','format','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x7d40,0x9d));var _0x07d4=function(_0x441c2b,_0x55b78d){_0x441c2b=_0x441c2b-0x0;var _0x2ec518=_0x7d40[_0x441c2b];return _0x2ec518;};'use strict';var BPromise=require(_0x07d4('0x0'));var util=require(_0x07d4('0x1'));var _=require(_0x07d4('0x2'));var moment=require(_0x07d4('0x3'));var Agent=require(_0x07d4('0x4'));var Telephone=require(_0x07d4('0x5'));var Trunk=require(_0x07d4('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x07d4('0x7'));var Campaign=require(_0x07d4('0x8'));var VoiceExtension=require(_0x07d4('0x9'));var ZendeskAccount=require(_0x07d4('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x07d4('0xb'));var SugarcrmAccount=require(_0x07d4('0xc'));var ZohoAccount=require(_0x07d4('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x07d4('0xe'));var ServicenowAccount=require(_0x07d4('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x07d4('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this['trunks']={};this[_0x07d4('0x11')]={};this[_0x07d4('0x12')]={};this[_0x07d4('0x13')]={};this[_0x07d4('0x14')]={};this[_0x07d4('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x07d4('0x16')]={};this[_0x07d4('0x17')]={};this[_0x07d4('0x18')]={};this[_0x07d4('0x19')]={};this[_0x07d4('0x1a')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x07d4('0x1b')]={};this[_0x07d4('0x1c')]={};this[_0x07d4('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x07d4('0x1e')]={};this[_0x07d4('0x1f')]={};this[_0x07d4('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x1f26d4,_0x3211a4,_0x22bc01){var _0x345895=_['mapKeys'](_0x1f26d4,function(_0xd222b5,_0x14df3a){return _0xd222b5[_0x22bc01];});for(var _0x49b56c in _0x3211a4){if(_0x3211a4[_0x07d4('0x21')](_0x49b56c)){if(!_0x345895[_0x49b56c]){delete _0x3211a4[_0x49b56c];}}}}function freeIsNotKeySip(_0x4f1570,_0x546c34){var _0x425571=_['mapKeys'](_0x4f1570,function(_0x21f178,_0x46b6e0){return util[_0x07d4('0x22')]('SIP/%s',_0x21f178[_0x07d4('0x23')]);});for(var _0x2d4bfa in _0x546c34){if(_0x546c34[_0x07d4('0x21')](_0x2d4bfa)){if(!_0x425571[_0x2d4bfa]){delete _0x546c34[_0x2d4bfa];}}}}function freeIsNotKeyAgent(_0x5807da,_0x529b4a){var _0x42b8c0=_['mapKeys'](_0x5807da,function(_0x462e02,_0x4fb753){var _0x3386f0=_[_0x07d4('0x24')](_0x462e02[_0x07d4('0x25')])?util[_0x07d4('0x22')]('SIP/%s',_0x462e02['name']):_0x462e02['interface'];return _0x3386f0;});for(var _0x454f0e in _0x529b4a){if(_0x529b4a[_0x07d4('0x21')](_0x454f0e)){if(!_0x42b8c0[_0x454f0e]){delete _0x529b4a[_0x454f0e];}}}}function clearVoiceCallReports(_0x5cc0ef){_0x5cc0ef[_0x07d4('0x26')]=0x0;_0x5cc0ef[_0x07d4('0x27')]=0x0;_0x5cc0ef[_0x07d4('0x28')]=0x0;_0x5cc0ef[_0x07d4('0x29')]=0x0;_0x5cc0ef[_0x07d4('0x2a')]=0x0;}function clearCampaigns(_0x2dbdab){if(!_[_0x07d4('0x2b')](_0x2dbdab)){for(var _0x47c209 in _0x2dbdab){if(_0x2dbdab['hasOwnProperty'](_0x47c209)){_0x2dbdab[_0x47c209]['ivrTotalCallsDays']=0x0;_0x2dbdab[_0x47c209][_0x07d4('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x25468a){if(!_['isEmpty'](_0x25468a)){for(var _0x3a501e in _0x25468a){if(_0x25468a['hasOwnProperty'](_0x3a501e)){_0x25468a[_0x3a501e]['total']=0x0;_0x25468a[_0x3a501e][_0x07d4('0x27')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x2d')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x2e')]=0x0;_0x25468a[_0x3a501e]['sumHoldTime']=0x0;_0x25468a[_0x3a501e][_0x07d4('0x29')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x2a')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x2f')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x30')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x31')]=0x0;_0x25468a[_0x3a501e]['outboundCongestionCallsDay']=0x0;_0x25468a[_0x3a501e][_0x07d4('0x32')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x33')]=0x0;_0x25468a[_0x3a501e]['outboundDropCallsDayTimeout']=0x0;_0x25468a[_0x3a501e][_0x07d4('0x34')]=0x0;_0x25468a[_0x3a501e]['outboundBlacklistCallsDay']=0x0;_0x25468a[_0x3a501e][_0x07d4('0x35')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x36')]=0x0;_0x25468a[_0x3a501e]['outboundReCallsDay']=0x0;_0x25468a[_0x3a501e][_0x07d4('0x2f')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x37')]=0x0;_0x25468a[_0x3a501e][_0x07d4('0x38')]=!![];}}}}Realtime[_0x07d4('0x39')][_0x07d4('0x3a')]=function(_0x217043,_0x15bd51){for(var _0x107a4a in _0x15bd51){if(_0x217043[_0x07d4('0x21')](_0x107a4a)){_0x217043[_0x107a4a]=_0x15bd51[_0x107a4a];}}};Realtime['prototype'][_0x07d4('0x3b')]=function(){var _0x306d78=this;return function(_0x49d707){if(_0x49d707){freeIsNotKeyAgent(_0x49d707,_0x306d78[_0x07d4('0x3c')]);for(var _0x2f4931=0x0,_0x467ce2={},_0x24c659={};_0x2f4931<_0x49d707[_0x07d4('0x3d')];_0x2f4931+=0x1){_0x467ce2=_0x49d707[_0x2f4931];var _0xa4f467=_[_0x07d4('0x24')](_0x467ce2[_0x07d4('0x25')])?util[_0x07d4('0x22')]('SIP/%s',_0x467ce2[_0x07d4('0x23')]):_0x467ce2[_0x07d4('0x25')];if(_[_0x07d4('0x3e')](_0x306d78['agents'][_0xa4f467])){_0x306d78[_0x07d4('0x3c')][_0xa4f467]=new Agent(_0x467ce2);}else{_0x306d78[_0x07d4('0x3a')](_0x306d78[_0x07d4('0x3c')][_0xa4f467],_0x467ce2);}}}return _0x306d78[_0x07d4('0x3c')];};};Realtime['prototype'][_0x07d4('0x3f')]=function(){var _0x1a3e8b=this;return function(_0x4d7978){if(_0x4d7978){freeIsNotKeySip(_0x4d7978,_0x1a3e8b[_0x07d4('0x40')]);for(var _0x59cdf1=0x0,_0x49562e={},_0x5a66fa={};_0x59cdf1<_0x4d7978[_0x07d4('0x3d')];_0x59cdf1+=0x1){_0x49562e=_0x4d7978[_0x59cdf1];if(_[_0x07d4('0x3e')](_0x1a3e8b[_0x07d4('0x40')][util[_0x07d4('0x22')](_0x07d4('0x41'),_0x49562e['name'])])){_0x1a3e8b[_0x07d4('0x40')][util['format']('SIP/%s',_0x49562e['name'])]=new Telephone(_0x49562e);}else{_0x1a3e8b['mergeFromDatabase'](_0x1a3e8b[_0x07d4('0x40')][util[_0x07d4('0x22')](_0x07d4('0x41'),_0x49562e[_0x07d4('0x23')])],_0x49562e);}}}return _0x1a3e8b[_0x07d4('0x40')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x42')]=function(){var _0x362aaa=this;return function(_0x6a963d){if(_0x6a963d){freeIsNotKeySip(_0x6a963d,_0x362aaa[_0x07d4('0x43')]);for(var _0x192831=0x0,_0x20d2dd={},_0x2d6b5d={};_0x192831<_0x6a963d[_0x07d4('0x3d')];_0x192831+=0x1){_0x20d2dd=_0x6a963d[_0x192831];if(_[_0x07d4('0x3e')](_0x362aaa['trunks'][util['format'](_0x07d4('0x41'),_0x20d2dd[_0x07d4('0x23')])])){_0x362aaa[_0x07d4('0x43')][util[_0x07d4('0x22')](_0x07d4('0x41'),_0x20d2dd[_0x07d4('0x23')])]=new Trunk(_0x20d2dd);}else{_0x362aaa[_0x07d4('0x3a')](_0x362aaa[_0x07d4('0x43')][util['format']('SIP/%s',_0x20d2dd[_0x07d4('0x23')])],_0x20d2dd);}}}return _0x362aaa['trunks'];};};Realtime['prototype'][_0x07d4('0x44')]=function(){var _0x3f08b7=this;return function(_0x26d738){if(_0x26d738){freeIsNotKey(_0x26d738,_0x3f08b7[_0x07d4('0x11')],_0x07d4('0x23'));for(var _0x4d1215=0x0,_0x1a2165={},_0x430730={};_0x4d1215<_0x26d738[_0x07d4('0x3d')];_0x4d1215+=0x1){_0x1a2165=_0x26d738[_0x4d1215];if(_['isUndefined'](_0x3f08b7[_0x07d4('0x11')][_0x1a2165[_0x07d4('0x23')]])){_0x3f08b7[_0x07d4('0x11')][_0x1a2165['name']]=new VoiceQueue(_0x1a2165);}else{_0x3f08b7[_0x07d4('0x3a')](_0x3f08b7[_0x07d4('0x11')][_0x1a2165[_0x07d4('0x23')]],_0x1a2165);}}}return _0x3f08b7[_0x07d4('0x11')];};};Realtime[_0x07d4('0x39')]['initTriggers']=function(){var _0x8d075b=this;return function(_0x43b52b){if(_0x43b52b){freeIsNotKey(_0x43b52b,_0x8d075b[_0x07d4('0x12')],'id');for(var _0x34d979=0x0,_0x29bf12={},_0x2d06c3={};_0x34d979<_0x43b52b[_0x07d4('0x3d')];_0x34d979+=0x1){_0x29bf12=_0x43b52b[_0x34d979];if(_[_0x07d4('0x3e')](_0x8d075b['triggers'][_0x29bf12['id']])){_0x8d075b[_0x07d4('0x12')][_0x29bf12['id']]=new Trigger(_0x29bf12);}else{_0x8d075b[_0x07d4('0x3a')](_0x8d075b[_0x07d4('0x12')][_0x29bf12['id']],_0x29bf12);}}}return _0x8d075b['triggers'];};};Realtime[_0x07d4('0x39')][_0x07d4('0x45')]=function(){var _0x3f9ed6=this;return function(_0x519f9c){if(_0x519f9c){freeIsNotKey(_0x519f9c,_0x3f9ed6['templates'],'id');for(var _0x374202=0x0,_0xe84391={},_0x141305={};_0x374202<_0x519f9c[_0x07d4('0x3d')];_0x374202+=0x1){_0xe84391=_0x519f9c[_0x374202];if(_[_0x07d4('0x3e')](_0x3f9ed6['templates'][_0xe84391['id']])){_0x3f9ed6[_0x07d4('0x14')][_0xe84391['id']]=new Template(_0xe84391);}else{_0x3f9ed6['mergeFromDatabase'](_0x3f9ed6[_0x07d4('0x14')][_0xe84391['id']],_0xe84391);}}}return _0x3f9ed6[_0x07d4('0x14')];};};Realtime['prototype'][_0x07d4('0x46')]=function(){var _0x7d2ec2=this;return function(_0x479edf){if(_0x479edf){freeIsNotKey(_0x479edf,_0x7d2ec2[_0x07d4('0x47')],'id');for(var _0x2d9352=0x0,_0x3895b2={},_0x228c81={};_0x2d9352<_0x479edf[_0x07d4('0x3d')];_0x2d9352+=0x1){_0x3895b2=_0x479edf[_0x2d9352];if(_[_0x07d4('0x3e')](_0x7d2ec2[_0x07d4('0x47')][_0x3895b2['id']])){_0x7d2ec2[_0x07d4('0x47')][_0x3895b2['id']]=new ZendeskAccount(_0x3895b2);}else{_0x7d2ec2[_0x07d4('0x3a')](_0x7d2ec2[_0x07d4('0x47')][_0x3895b2['id']],_0x3895b2);}}}return _0x7d2ec2[_0x07d4('0x47')];};};Realtime[_0x07d4('0x39')]['initSalesforceAccounts']=function(){var _0x2fad92=this;return function(_0x4afa3f){if(_0x4afa3f){freeIsNotKey(_0x4afa3f,_0x2fad92[_0x07d4('0x48')],'id');for(var _0x269793=0x0,_0x371f8d={},_0x42edc2={};_0x269793<_0x4afa3f[_0x07d4('0x3d')];_0x269793+=0x1){_0x371f8d=_0x4afa3f[_0x269793];if(_[_0x07d4('0x3e')](_0x2fad92[_0x07d4('0x48')][_0x371f8d['id']])){_0x2fad92['salesforceAccounts'][_0x371f8d['id']]=new SalesforceAccount(_0x371f8d);}else{_0x2fad92[_0x07d4('0x3a')](_0x2fad92[_0x07d4('0x48')][_0x371f8d['id']],_0x371f8d);}}}return _0x2fad92[_0x07d4('0x48')];};};Realtime[_0x07d4('0x39')]['initFreshdeskAccounts']=function(){var _0x557470=this;return function(_0x5e1a15){if(_0x5e1a15){freeIsNotKey(_0x5e1a15,_0x557470[_0x07d4('0x1c')],'id');for(var _0x4652ca=0x0,_0x30dfd7={},_0x34eb93={};_0x4652ca<_0x5e1a15['length'];_0x4652ca+=0x1){_0x30dfd7=_0x5e1a15[_0x4652ca];if(_[_0x07d4('0x3e')](_0x557470[_0x07d4('0x1c')][_0x30dfd7['id']])){_0x557470[_0x07d4('0x1c')][_0x30dfd7['id']]=new FreshdeskAccount(_0x30dfd7);}else{_0x557470['mergeFromDatabase'](_0x557470[_0x07d4('0x1c')][_0x30dfd7['id']],_0x30dfd7);}}}return _0x557470[_0x07d4('0x1c')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x49')]=function(){var _0xfe17f1=this;return function(_0x35f567){if(_0x35f567){freeIsNotKey(_0x35f567,_0xfe17f1[_0x07d4('0x1d')],'id');for(var _0x40c4d7=0x0,_0x29f09f={},_0xa6ab2b={};_0x40c4d7<_0x35f567[_0x07d4('0x3d')];_0x40c4d7+=0x1){_0x29f09f=_0x35f567[_0x40c4d7];if(_[_0x07d4('0x3e')](_0xfe17f1[_0x07d4('0x1d')][_0x29f09f['id']])){_0xfe17f1[_0x07d4('0x1d')][_0x29f09f['id']]=new ZohoAccount(_0x29f09f);}else{_0xfe17f1[_0x07d4('0x3a')](_0xfe17f1[_0x07d4('0x1d')][_0x29f09f['id']],_0x29f09f);}}}return _0xfe17f1[_0x07d4('0x1d')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x4a')]=function(){var _0x4c5ae0=this;return function(_0x33b16d){if(_0x33b16d){freeIsNotKey(_0x33b16d,_0x4c5ae0[_0x07d4('0x4b')],'id');for(var _0x521370=0x0,_0xeede95={},_0x4d6a2b={};_0x521370<_0x33b16d['length'];_0x521370+=0x1){_0xeede95=_0x33b16d[_0x521370];if(_[_0x07d4('0x3e')](_0x4c5ae0[_0x07d4('0x4b')][_0xeede95['id']])){_0x4c5ae0['deskAccounts'][_0xeede95['id']]=new DeskAccount(_0xeede95);}else{_0x4c5ae0['mergeFromDatabase'](_0x4c5ae0[_0x07d4('0x4b')][_0xeede95['id']],_0xeede95);}}}return _0x4c5ae0[_0x07d4('0x4b')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x4c')]=function(){var _0x2d10e5=this;return function(_0x2d3aea){if(_0x2d3aea){freeIsNotKey(_0x2d3aea,_0x2d10e5[_0x07d4('0x1b')],'id');for(var _0x3162b3=0x0,_0x42daa6={},_0x50e6ff={};_0x3162b3<_0x2d3aea[_0x07d4('0x3d')];_0x3162b3+=0x1){_0x42daa6=_0x2d3aea[_0x3162b3];if(_[_0x07d4('0x3e')](_0x2d10e5[_0x07d4('0x1b')][_0x42daa6['id']])){_0x2d10e5[_0x07d4('0x1b')][_0x42daa6['id']]=new SugarcrmAccount(_0x42daa6);}else{_0x2d10e5[_0x07d4('0x3a')](_0x2d10e5[_0x07d4('0x1b')][_0x42daa6['id']],_0x42daa6);}}}return _0x2d10e5[_0x07d4('0x1b')];};};Realtime[_0x07d4('0x39')]['initVtigerAccounts']=function(){var _0x3eeec8=this;return function(_0xcbeff9){if(_0xcbeff9){freeIsNotKey(_0xcbeff9,_0x3eeec8['vtigerAccounts'],'id');for(var _0x58318a=0x0,_0xcf8440={},_0x511af2={};_0x58318a<_0xcbeff9[_0x07d4('0x3d')];_0x58318a+=0x1){_0xcf8440=_0xcbeff9[_0x58318a];if(_[_0x07d4('0x3e')](_0x3eeec8[_0x07d4('0x4d')][_0xcf8440['id']])){_0x3eeec8[_0x07d4('0x4d')][_0xcf8440['id']]=new VtigerAccount(_0xcf8440);}else{_0x3eeec8[_0x07d4('0x3a')](_0x3eeec8[_0x07d4('0x4d')][_0xcf8440['id']],_0xcf8440);}}}return _0x3eeec8[_0x07d4('0x4d')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x4e')]=function(){var _0x14010a=this;return function(_0x260eb0){if(_0x260eb0){freeIsNotKey(_0x260eb0,_0x14010a[_0x07d4('0x1e')],'id');for(var _0xed5c3c=0x0,_0x3b21c7={},_0x16e8a7={};_0xed5c3c<_0x260eb0['length'];_0xed5c3c+=0x1){_0x3b21c7=_0x260eb0[_0xed5c3c];if(_[_0x07d4('0x3e')](_0x14010a['servicenowAccounts'][_0x3b21c7['id']])){_0x14010a[_0x07d4('0x1e')][_0x3b21c7['id']]=new ServicenowAccount(_0x3b21c7);}else{_0x14010a[_0x07d4('0x3a')](_0x14010a[_0x07d4('0x1e')][_0x3b21c7['id']],_0x3b21c7);}}}return _0x14010a[_0x07d4('0x1e')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x4f')]=function(){var _0x17d707=this;return function(_0x147e44){if(_0x147e44){freeIsNotKey(_0x147e44,_0x17d707['dynamics365Accounts'],'id');for(var _0x1fce37=0x0,_0x3a3d0e={},_0x14d564={};_0x1fce37<_0x147e44[_0x07d4('0x3d')];_0x1fce37+=0x1){_0x3a3d0e=_0x147e44[_0x1fce37];if(_['isUndefined'](_0x17d707['dynamics365Accounts'][_0x3a3d0e['id']])){_0x17d707['dynamics365Accounts'][_0x3a3d0e['id']]=new Dynamics365Account(_0x3a3d0e);}else{_0x17d707[_0x07d4('0x3a')](_0x17d707['dynamics365Accounts'][_0x3a3d0e['id']],_0x3a3d0e);}}}return _0x17d707[_0x07d4('0x1f')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x50')]=function(){var _0x3a9613=this;return function(_0x4cf83d){if(_0x4cf83d){freeIsNotKey(_0x4cf83d,_0x3a9613[_0x07d4('0x20')],'id');for(var _0x17d2ee=0x0,_0x2f76fb={},_0x4b5c4a={};_0x17d2ee<_0x4cf83d['length'];_0x17d2ee+=0x1){_0x2f76fb=_0x4cf83d[_0x17d2ee];if(_[_0x07d4('0x3e')](_0x3a9613['freshsalesAccounts'][_0x2f76fb['id']])){_0x3a9613[_0x07d4('0x20')][_0x2f76fb['id']]=new FreshsalesAccount(_0x2f76fb);}else{_0x3a9613['mergeFromDatabase'](_0x3a9613[_0x07d4('0x20')][_0x2f76fb['id']],_0x2f76fb);}}}return _0x3a9613[_0x07d4('0x20')];};};Realtime[_0x07d4('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x38e25a=this;return function(_0x3a1928){for(var _0x22a110=0x0;_0x22a110<_0x3a1928[_0x07d4('0x3d')];_0x22a110+=0x1){_[_0x07d4('0x51')](_0x38e25a[_0x07d4('0x11')][_0x3a1928[_0x22a110]['name']],_0x3a1928[_0x22a110]);}return _0x38e25a[_0x07d4('0x11')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x52')]=function(){var _0x5a4001=this;return function(_0x53bc6a){clearVoiceQueues(_0x5a4001[_0x07d4('0x11')]);if(_0x53bc6a){_0x53bc6a=_[_0x07d4('0x53')](_0x53bc6a,_0x07d4('0x54'));for(var _0x989bd2 in _0x53bc6a){if(_0x53bc6a['hasOwnProperty'](_0x989bd2)){var _0xce4035={};for(var _0x2fb007=0x0;_0x2fb007<_0x53bc6a[_0x989bd2]['length'];_0x2fb007+=0x1){var _0x1efe57=_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x55')];if(_0x5a4001[_0x07d4('0x11')][_0x1efe57]){if(_0x53bc6a[_0x989bd2][_0x2fb007]['queuecallerexit']){_0x5a4001[_0x07d4('0x11')][_0x1efe57]['unmanaged']+=0x1;}if(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x56')]){_0x5a4001[_0x07d4('0x11')][_0x1efe57][_0x07d4('0x2e')]+=0x1;}_0x5a4001[_0x07d4('0x11')][_0x1efe57][_0x07d4('0x28')]+=moment(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x57')])[_0x07d4('0x58')](moment(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x59')]),_0x07d4('0x5a'))||0x0;if(_0x2fb007===_0x53bc6a[_0x989bd2]['length']-0x1){_0x5a4001['voiceQueues'][_0x1efe57][_0x07d4('0x29')]+=moment(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x5b')]||_0x53bc6a[_0x989bd2][_0x2fb007]['queuecallerabandonAt']||_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x5c')])[_0x07d4('0x58')](moment(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x59')]),'seconds')||0x0;_0x5a4001[_0x07d4('0x11')][_0x1efe57][_0x07d4('0x26')]+=0x1;if(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x5d')]){_0x5a4001[_0x07d4('0x11')][_0x1efe57][_0x07d4('0x27')]+=0x1;_0x5a4001[_0x07d4('0x11')][_0x1efe57]['sumBillable']+=moment(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x5b')])[_0x07d4('0x58')](moment(_0x53bc6a[_0x989bd2][_0x2fb007][_0x07d4('0x57')]),_0x07d4('0x5a'))||0x0;}}else{_0x5a4001[_0x07d4('0x11')][_0x1efe57]['sumDuration']+=_0x5a4001[_0x07d4('0x11')][_0x1efe57][_0x07d4('0x28')]||0x0;}}}}}}return _0x5a4001[_0x07d4('0x11')];};};Realtime[_0x07d4('0x39')]['initVoiceCallReports']=function(){var _0x176a3b=this;return function(_0x58afb2){clearVoiceCallReports(_0x176a3b[_0x07d4('0x15')]);if(_0x58afb2){for(var _0x2dda3f=0x0;_0x2dda3f<_0x58afb2[_0x07d4('0x3d')];_0x2dda3f+=0x1){_0x176a3b[_0x07d4('0x15')]['total']+=0x1;_0x176a3b[_0x07d4('0x15')][_0x07d4('0x29')]+=_0x58afb2[_0x2dda3f][_0x07d4('0x5e')];if(_0x58afb2[_0x2dda3f]['disposition']===_0x07d4('0x5f')){_0x176a3b['outbound']['answered']+=0x1;_0x176a3b[_0x07d4('0x15')][_0x07d4('0x28')]+=_0x58afb2[_0x2dda3f]['duration']-_0x58afb2[_0x2dda3f]['billableseconds']||0x0;_0x176a3b[_0x07d4('0x15')]['sumBillable']+=_0x58afb2[_0x2dda3f][_0x07d4('0x60')];}}}return _0x176a3b['outbound'];};};Realtime[_0x07d4('0x39')][_0x07d4('0x61')]=function(){var _0x888132=this;return function(_0xceddf5){if(_0xceddf5){freeIsNotKey(_0xceddf5,_0x888132[_0x07d4('0x13')],_0x07d4('0x23'));for(var _0x108577=0x0,_0x135f4c={};_0x108577<_0xceddf5['length'];_0x108577+=0x1){_0x135f4c=_0xceddf5[_0x108577];if(_[_0x07d4('0x3e')](_0x888132['campaigns'][_0x135f4c['name']])){_0x888132[_0x07d4('0x13')][_0x135f4c[_0x07d4('0x23')]]=new Campaign(_0x135f4c);}else{_0x888132[_0x07d4('0x3a')](_0x888132[_0x07d4('0x13')][_0x135f4c[_0x07d4('0x23')]],_0x135f4c);_0x888132[_0x07d4('0x13')][_0x135f4c['name']]['dialQueueProject']=_0x135f4c['SquareProject']?_0x135f4c[_0x07d4('0x62')]['name']:undefined;}}}return _0x888132['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x35a5c9=this;return function(_0x233c80){if(_0x233c80){freeIsNotKey(_0x233c80,_0x35a5c9[_0x07d4('0x16')],'id');for(var _0x3361b3=0x0,_0x3598cb={};_0x3361b3<_0x233c80[_0x07d4('0x3d')];_0x3361b3+=0x1){_0x3598cb=_0x233c80[_0x3361b3];if(_['isUndefined'](_0x35a5c9['voiceExtensions'][_0x3598cb['id']])){_0x35a5c9[_0x07d4('0x16')][_0x3598cb['id']]=new VoiceExtension(_0x3598cb);}else{_0x35a5c9[_0x07d4('0x3a')](_0x35a5c9[_0x07d4('0x16')][_0x3598cb['id']],_0x3598cb);}}}return _0x35a5c9['voiceExtensions'];};};Realtime[_0x07d4('0x39')]['initCampaignHopperHistory']=function(){var _0x22ae24=this;return function(_0xf45a8){clearCampaigns(_0x22ae24[_0x07d4('0x13')]);for(var _0x2c8649=0x0;_0x2c8649<_0xf45a8['length'];_0x2c8649+=0x1){_[_0x07d4('0x51')](_0x22ae24['campaigns'][_0xf45a8[_0x2c8649][_0x07d4('0x23')]],_0xf45a8[_0x2c8649]);}return _0x22ae24[_0x07d4('0x13')];};};Realtime[_0x07d4('0x39')][_0x07d4('0x63')]=function(){var _0x49d2c6=this;return function(_0x31c9a0){if(_0x31c9a0){freeIsNotKey(_0x31c9a0,_0x49d2c6[_0x07d4('0x64')],'id');for(var _0x4fc29c=0x0,_0x5373b3={},_0x214c2f={};_0x4fc29c<_0x31c9a0[_0x07d4('0x3d')];_0x4fc29c+=0x1){_0x5373b3=_0x31c9a0[_0x4fc29c];if(_[_0x07d4('0x3e')](_0x49d2c6['faxAccounts'][_0x5373b3['id']])){_0x49d2c6[_0x07d4('0x64')][_0x5373b3['id']]=new FaxAccount(_0x5373b3);}else{_0x49d2c6[_0x07d4('0x3a')](_0x49d2c6['faxAccounts'][_0x5373b3['id']],_0x5373b3);}}}return _0x49d2c6[_0x07d4('0x64')];};};module[_0x07d4('0x65')]=Realtime; \ No newline at end of file +var _0xc547=['queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','sumDuration','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/telephone','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','telephones','trunks','voiceQueues','triggers','templates','outbound','queueChannels','outboundChannels','timers','freshdeskAccounts','deskAccounts','servicenowAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','merge','groupBy','queue','queuecallerexit','unmanaged'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc547,0x153));var _0x7c54=function(_0x5846b4,_0x2a47f9){_0x5846b4=_0x5846b4-0x0;var _0x49a222=_0xc547[_0x5846b4];return _0x49a222;};'use strict';var BPromise=require('bluebird');var util=require(_0x7c54('0x0'));var _=require('lodash');var moment=require(_0x7c54('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x7c54('0x2'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x7c54('0x3'));var Template=require(_0x7c54('0x4'));var Campaign=require(_0x7c54('0x5'));var VoiceExtension=require(_0x7c54('0x6'));var ZendeskAccount=require(_0x7c54('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x7c54('0x8'));var ZohoAccount=require(_0x7c54('0x9'));var DeskAccount=require(_0x7c54('0xa'));var VtigerAccount=require(_0x7c54('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x7c54('0xc'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x7c54('0xd'));var Realtime=function(){this['agents']={};this[_0x7c54('0xe')]={};this[_0x7c54('0xf')]={};this[_0x7c54('0x10')]={};this[_0x7c54('0x11')]={};this['campaigns']={};this[_0x7c54('0x12')]={};this[_0x7c54('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x7c54('0x14')]={};this[_0x7c54('0x15')]={};this[_0x7c54('0x16')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x7c54('0x17')]={};this['zohoAccounts']={};this[_0x7c54('0x18')]={};this['vtigerAccounts']={};this[_0x7c54('0x19')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0x7c54('0x1a')]={};};function freeIsNotKey(_0x5b4e9f,_0x3f0ca3,_0x500e1c){var _0x57bf21=_[_0x7c54('0x1b')](_0x5b4e9f,function(_0x8ca09c,_0x69eb4){return _0x8ca09c[_0x500e1c];});for(var _0x44a7dc in _0x3f0ca3){if(_0x3f0ca3[_0x7c54('0x1c')](_0x44a7dc)){if(!_0x57bf21[_0x44a7dc]){delete _0x3f0ca3[_0x44a7dc];}}}}function freeIsNotKeySip(_0xed7452,_0x18a9c2){var _0x5e9415=_[_0x7c54('0x1b')](_0xed7452,function(_0x4fbcf4,_0x595e7e){return util[_0x7c54('0x1d')](_0x7c54('0x1e'),_0x4fbcf4[_0x7c54('0x1f')]);});for(var _0x70c03a in _0x18a9c2){if(_0x18a9c2['hasOwnProperty'](_0x70c03a)){if(!_0x5e9415[_0x70c03a]){delete _0x18a9c2[_0x70c03a];}}}}function freeIsNotKeyAgent(_0x3d1952,_0x54c111){var _0x54877e=_['mapKeys'](_0x3d1952,function(_0x170b85,_0x1270e6){var _0x115685=_['isNil'](_0x170b85[_0x7c54('0x20')])?util[_0x7c54('0x1d')](_0x7c54('0x1e'),_0x170b85[_0x7c54('0x1f')]):_0x170b85['interface'];return _0x115685;});for(var _0x55f5e2 in _0x54c111){if(_0x54c111[_0x7c54('0x1c')](_0x55f5e2)){if(!_0x54877e[_0x55f5e2]){delete _0x54c111[_0x55f5e2];}}}}function clearVoiceCallReports(_0x338e37){_0x338e37['total']=0x0;_0x338e37['answered']=0x0;_0x338e37['sumHoldTime']=0x0;_0x338e37['sumDuration']=0x0;_0x338e37[_0x7c54('0x21')]=0x0;}function clearCampaigns(_0x510007){if(!_[_0x7c54('0x22')](_0x510007)){for(var _0x567562 in _0x510007){if(_0x510007[_0x7c54('0x1c')](_0x567562)){_0x510007[_0x567562]['ivrTotalCallsDays']=0x0;_0x510007[_0x567562][_0x7c54('0x23')]=0x0;}}}}function clearVoiceQueues(_0x32a377){if(!_[_0x7c54('0x22')](_0x32a377)){for(var _0x38d9bd in _0x32a377){if(_0x32a377[_0x7c54('0x1c')](_0x38d9bd)){_0x32a377[_0x38d9bd][_0x7c54('0x24')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x25')]=0x0;_0x32a377[_0x38d9bd]['unmanaged']=0x0;_0x32a377[_0x38d9bd]['abandoned']=0x0;_0x32a377[_0x38d9bd]['sumHoldTime']=0x0;_0x32a377[_0x38d9bd]['sumDuration']=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x21')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x26')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x27')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x28')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x29')]=0x0;_0x32a377[_0x38d9bd]['outboundNoSuchCallsDay']=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x2a')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x2b')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x2c')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x2d')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x2e')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x2f')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x30')]=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x26')]=0x0;_0x32a377[_0x38d9bd]['outboundAnswerCallsDay']=0x0;_0x32a377[_0x38d9bd][_0x7c54('0x31')]=!![];}}}}Realtime[_0x7c54('0x32')][_0x7c54('0x33')]=function(_0x173944,_0x1ad06e){for(var _0x2e52f1 in _0x1ad06e){if(_0x173944[_0x7c54('0x1c')](_0x2e52f1)){_0x173944[_0x2e52f1]=_0x1ad06e[_0x2e52f1];}}};Realtime['prototype'][_0x7c54('0x34')]=function(){var _0x17b552=this;return function(_0xa71cf7){if(_0xa71cf7){freeIsNotKeyAgent(_0xa71cf7,_0x17b552[_0x7c54('0x35')]);for(var _0x5ba849=0x0,_0x4acb3b={},_0xaf989e={};_0x5ba849<_0xa71cf7[_0x7c54('0x36')];_0x5ba849+=0x1){_0x4acb3b=_0xa71cf7[_0x5ba849];var _0x1d2573=_[_0x7c54('0x37')](_0x4acb3b[_0x7c54('0x20')])?util['format'](_0x7c54('0x1e'),_0x4acb3b[_0x7c54('0x1f')]):_0x4acb3b['interface'];if(_[_0x7c54('0x38')](_0x17b552['agents'][_0x1d2573])){_0x17b552[_0x7c54('0x35')][_0x1d2573]=new Agent(_0x4acb3b);}else{_0x17b552[_0x7c54('0x33')](_0x17b552[_0x7c54('0x35')][_0x1d2573],_0x4acb3b);}}}return _0x17b552['agents'];};};Realtime['prototype'][_0x7c54('0x39')]=function(){var _0x354a5a=this;return function(_0x508034){if(_0x508034){freeIsNotKeySip(_0x508034,_0x354a5a['telephones']);for(var _0x31b7b0=0x0,_0x1df3f8={},_0x4804cb={};_0x31b7b0<_0x508034['length'];_0x31b7b0+=0x1){_0x1df3f8=_0x508034[_0x31b7b0];if(_[_0x7c54('0x38')](_0x354a5a[_0x7c54('0xe')][util[_0x7c54('0x1d')]('SIP/%s',_0x1df3f8[_0x7c54('0x1f')])])){_0x354a5a['telephones'][util[_0x7c54('0x1d')](_0x7c54('0x1e'),_0x1df3f8[_0x7c54('0x1f')])]=new Telephone(_0x1df3f8);}else{_0x354a5a[_0x7c54('0x33')](_0x354a5a[_0x7c54('0xe')][util[_0x7c54('0x1d')]('SIP/%s',_0x1df3f8[_0x7c54('0x1f')])],_0x1df3f8);}}}return _0x354a5a[_0x7c54('0xe')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x3a')]=function(){var _0x4428fb=this;return function(_0x2244e6){if(_0x2244e6){freeIsNotKeySip(_0x2244e6,_0x4428fb[_0x7c54('0xf')]);for(var _0x249814=0x0,_0x4fa4d9={},_0x4e4cfc={};_0x249814<_0x2244e6[_0x7c54('0x36')];_0x249814+=0x1){_0x4fa4d9=_0x2244e6[_0x249814];if(_['isUndefined'](_0x4428fb[_0x7c54('0xf')][util[_0x7c54('0x1d')]('SIP/%s',_0x4fa4d9[_0x7c54('0x1f')])])){_0x4428fb['trunks'][util['format'](_0x7c54('0x1e'),_0x4fa4d9['name'])]=new Trunk(_0x4fa4d9);}else{_0x4428fb[_0x7c54('0x33')](_0x4428fb[_0x7c54('0xf')][util[_0x7c54('0x1d')](_0x7c54('0x1e'),_0x4fa4d9[_0x7c54('0x1f')])],_0x4fa4d9);}}}return _0x4428fb[_0x7c54('0xf')];};};Realtime['prototype'][_0x7c54('0x3b')]=function(){var _0x3b637f=this;return function(_0x949459){if(_0x949459){freeIsNotKey(_0x949459,_0x3b637f[_0x7c54('0x10')],'name');for(var _0x499020=0x0,_0x224905={},_0x3da4a0={};_0x499020<_0x949459['length'];_0x499020+=0x1){_0x224905=_0x949459[_0x499020];if(_[_0x7c54('0x38')](_0x3b637f[_0x7c54('0x10')][_0x224905[_0x7c54('0x1f')]])){_0x3b637f[_0x7c54('0x10')][_0x224905[_0x7c54('0x1f')]]=new VoiceQueue(_0x224905);}else{_0x3b637f[_0x7c54('0x33')](_0x3b637f[_0x7c54('0x10')][_0x224905[_0x7c54('0x1f')]],_0x224905);}}}return _0x3b637f['voiceQueues'];};};Realtime['prototype'][_0x7c54('0x3c')]=function(){var _0x36d853=this;return function(_0x225dbf){if(_0x225dbf){freeIsNotKey(_0x225dbf,_0x36d853['triggers'],'id');for(var _0x10f9ea=0x0,_0x265397={},_0x5091cd={};_0x10f9ea<_0x225dbf[_0x7c54('0x36')];_0x10f9ea+=0x1){_0x265397=_0x225dbf[_0x10f9ea];if(_[_0x7c54('0x38')](_0x36d853[_0x7c54('0x11')][_0x265397['id']])){_0x36d853[_0x7c54('0x11')][_0x265397['id']]=new Trigger(_0x265397);}else{_0x36d853[_0x7c54('0x33')](_0x36d853[_0x7c54('0x11')][_0x265397['id']],_0x265397);}}}return _0x36d853[_0x7c54('0x11')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x3d')]=function(){var _0x2310a8=this;return function(_0x4f34d5){if(_0x4f34d5){freeIsNotKey(_0x4f34d5,_0x2310a8['templates'],'id');for(var _0x7711a6=0x0,_0xf765ec={},_0x95382d={};_0x7711a6<_0x4f34d5[_0x7c54('0x36')];_0x7711a6+=0x1){_0xf765ec=_0x4f34d5[_0x7711a6];if(_[_0x7c54('0x38')](_0x2310a8[_0x7c54('0x12')][_0xf765ec['id']])){_0x2310a8['templates'][_0xf765ec['id']]=new Template(_0xf765ec);}else{_0x2310a8[_0x7c54('0x33')](_0x2310a8[_0x7c54('0x12')][_0xf765ec['id']],_0xf765ec);}}}return _0x2310a8[_0x7c54('0x12')];};};Realtime['prototype'][_0x7c54('0x3e')]=function(){var _0x35ce1a=this;return function(_0x3656a6){if(_0x3656a6){freeIsNotKey(_0x3656a6,_0x35ce1a[_0x7c54('0x3f')],'id');for(var _0x2db6bf=0x0,_0x4d845a={},_0x129225={};_0x2db6bf<_0x3656a6[_0x7c54('0x36')];_0x2db6bf+=0x1){_0x4d845a=_0x3656a6[_0x2db6bf];if(_[_0x7c54('0x38')](_0x35ce1a['zendeskAccounts'][_0x4d845a['id']])){_0x35ce1a[_0x7c54('0x3f')][_0x4d845a['id']]=new ZendeskAccount(_0x4d845a);}else{_0x35ce1a['mergeFromDatabase'](_0x35ce1a[_0x7c54('0x3f')][_0x4d845a['id']],_0x4d845a);}}}return _0x35ce1a[_0x7c54('0x3f')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x40')]=function(){var _0x280cfa=this;return function(_0x1df2c8){if(_0x1df2c8){freeIsNotKey(_0x1df2c8,_0x280cfa[_0x7c54('0x41')],'id');for(var _0x4b8595=0x0,_0x5b94ba={},_0x394a10={};_0x4b8595<_0x1df2c8[_0x7c54('0x36')];_0x4b8595+=0x1){_0x5b94ba=_0x1df2c8[_0x4b8595];if(_[_0x7c54('0x38')](_0x280cfa[_0x7c54('0x41')][_0x5b94ba['id']])){_0x280cfa[_0x7c54('0x41')][_0x5b94ba['id']]=new SalesforceAccount(_0x5b94ba);}else{_0x280cfa[_0x7c54('0x33')](_0x280cfa[_0x7c54('0x41')][_0x5b94ba['id']],_0x5b94ba);}}}return _0x280cfa[_0x7c54('0x41')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x3bb952=this;return function(_0x3b005b){if(_0x3b005b){freeIsNotKey(_0x3b005b,_0x3bb952[_0x7c54('0x17')],'id');for(var _0x50c3f9=0x0,_0x387daa={},_0x2cae0f={};_0x50c3f9<_0x3b005b[_0x7c54('0x36')];_0x50c3f9+=0x1){_0x387daa=_0x3b005b[_0x50c3f9];if(_[_0x7c54('0x38')](_0x3bb952[_0x7c54('0x17')][_0x387daa['id']])){_0x3bb952['freshdeskAccounts'][_0x387daa['id']]=new FreshdeskAccount(_0x387daa);}else{_0x3bb952[_0x7c54('0x33')](_0x3bb952[_0x7c54('0x17')][_0x387daa['id']],_0x387daa);}}}return _0x3bb952[_0x7c54('0x17')];};};Realtime[_0x7c54('0x32')]['initZohoAccounts']=function(){var _0x2b7977=this;return function(_0x75c757){if(_0x75c757){freeIsNotKey(_0x75c757,_0x2b7977[_0x7c54('0x42')],'id');for(var _0x17b153=0x0,_0x24d5e2={},_0x3d9f30={};_0x17b153<_0x75c757[_0x7c54('0x36')];_0x17b153+=0x1){_0x24d5e2=_0x75c757[_0x17b153];if(_[_0x7c54('0x38')](_0x2b7977[_0x7c54('0x42')][_0x24d5e2['id']])){_0x2b7977['zohoAccounts'][_0x24d5e2['id']]=new ZohoAccount(_0x24d5e2);}else{_0x2b7977[_0x7c54('0x33')](_0x2b7977[_0x7c54('0x42')][_0x24d5e2['id']],_0x24d5e2);}}}return _0x2b7977[_0x7c54('0x42')];};};Realtime['prototype'][_0x7c54('0x43')]=function(){var _0x2639a1=this;return function(_0xc8d5d4){if(_0xc8d5d4){freeIsNotKey(_0xc8d5d4,_0x2639a1[_0x7c54('0x18')],'id');for(var _0x1c50ea=0x0,_0x3a5351={},_0x48c24a={};_0x1c50ea<_0xc8d5d4[_0x7c54('0x36')];_0x1c50ea+=0x1){_0x3a5351=_0xc8d5d4[_0x1c50ea];if(_[_0x7c54('0x38')](_0x2639a1[_0x7c54('0x18')][_0x3a5351['id']])){_0x2639a1['deskAccounts'][_0x3a5351['id']]=new DeskAccount(_0x3a5351);}else{_0x2639a1[_0x7c54('0x33')](_0x2639a1['deskAccounts'][_0x3a5351['id']],_0x3a5351);}}}return _0x2639a1[_0x7c54('0x18')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x44')]=function(){var _0x19bf2a=this;return function(_0x5ef847){if(_0x5ef847){freeIsNotKey(_0x5ef847,_0x19bf2a[_0x7c54('0x45')],'id');for(var _0x5d44b2=0x0,_0x4a718b={},_0x2f706b={};_0x5d44b2<_0x5ef847[_0x7c54('0x36')];_0x5d44b2+=0x1){_0x4a718b=_0x5ef847[_0x5d44b2];if(_[_0x7c54('0x38')](_0x19bf2a[_0x7c54('0x45')][_0x4a718b['id']])){_0x19bf2a[_0x7c54('0x45')][_0x4a718b['id']]=new SugarcrmAccount(_0x4a718b);}else{_0x19bf2a[_0x7c54('0x33')](_0x19bf2a[_0x7c54('0x45')][_0x4a718b['id']],_0x4a718b);}}}return _0x19bf2a[_0x7c54('0x45')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x46')]=function(){var _0x50847c=this;return function(_0x290960){if(_0x290960){freeIsNotKey(_0x290960,_0x50847c['vtigerAccounts'],'id');for(var _0x5053d7=0x0,_0x4e7b89={},_0x1bcd06={};_0x5053d7<_0x290960[_0x7c54('0x36')];_0x5053d7+=0x1){_0x4e7b89=_0x290960[_0x5053d7];if(_[_0x7c54('0x38')](_0x50847c[_0x7c54('0x47')][_0x4e7b89['id']])){_0x50847c[_0x7c54('0x47')][_0x4e7b89['id']]=new VtigerAccount(_0x4e7b89);}else{_0x50847c[_0x7c54('0x33')](_0x50847c[_0x7c54('0x47')][_0x4e7b89['id']],_0x4e7b89);}}}return _0x50847c['vtigerAccounts'];};};Realtime[_0x7c54('0x32')]['initServicenowAccounts']=function(){var _0x34607f=this;return function(_0x4376d3){if(_0x4376d3){freeIsNotKey(_0x4376d3,_0x34607f[_0x7c54('0x19')],'id');for(var _0x150875=0x0,_0x1ec196={},_0xffa9e3={};_0x150875<_0x4376d3['length'];_0x150875+=0x1){_0x1ec196=_0x4376d3[_0x150875];if(_[_0x7c54('0x38')](_0x34607f[_0x7c54('0x19')][_0x1ec196['id']])){_0x34607f[_0x7c54('0x19')][_0x1ec196['id']]=new ServicenowAccount(_0x1ec196);}else{_0x34607f[_0x7c54('0x33')](_0x34607f[_0x7c54('0x19')][_0x1ec196['id']],_0x1ec196);}}}return _0x34607f[_0x7c54('0x19')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x48')]=function(){var _0x1997cc=this;return function(_0x11a316){if(_0x11a316){freeIsNotKey(_0x11a316,_0x1997cc[_0x7c54('0x49')],'id');for(var _0x30976d=0x0,_0x312c3d={},_0x45f1d1={};_0x30976d<_0x11a316[_0x7c54('0x36')];_0x30976d+=0x1){_0x312c3d=_0x11a316[_0x30976d];if(_[_0x7c54('0x38')](_0x1997cc[_0x7c54('0x49')][_0x312c3d['id']])){_0x1997cc[_0x7c54('0x49')][_0x312c3d['id']]=new Dynamics365Account(_0x312c3d);}else{_0x1997cc['mergeFromDatabase'](_0x1997cc['dynamics365Accounts'][_0x312c3d['id']],_0x312c3d);}}}return _0x1997cc[_0x7c54('0x49')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x4a')]=function(){var _0x8d5ea4=this;return function(_0x1b3689){if(_0x1b3689){freeIsNotKey(_0x1b3689,_0x8d5ea4[_0x7c54('0x4b')],'id');for(var _0xba4f4=0x0,_0x41e475={},_0x259dac={};_0xba4f4<_0x1b3689[_0x7c54('0x36')];_0xba4f4+=0x1){_0x41e475=_0x1b3689[_0xba4f4];if(_[_0x7c54('0x38')](_0x8d5ea4['freshsalesAccounts'][_0x41e475['id']])){_0x8d5ea4[_0x7c54('0x4b')][_0x41e475['id']]=new FreshsalesAccount(_0x41e475);}else{_0x8d5ea4[_0x7c54('0x33')](_0x8d5ea4[_0x7c54('0x4b')][_0x41e475['id']],_0x41e475);}}}return _0x8d5ea4['freshsalesAccounts'];};};Realtime[_0x7c54('0x32')]['initVoiceQueueHopperHistory']=function(){var _0x3c4b56=this;return function(_0x3b94e0){for(var _0x432eed=0x0;_0x432eed<_0x3b94e0[_0x7c54('0x36')];_0x432eed+=0x1){_[_0x7c54('0x4c')](_0x3c4b56[_0x7c54('0x10')][_0x3b94e0[_0x432eed][_0x7c54('0x1f')]],_0x3b94e0[_0x432eed]);}return _0x3c4b56['voiceQueues'];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x206b2b=this;return function(_0x589fc8){clearVoiceQueues(_0x206b2b[_0x7c54('0x10')]);if(_0x589fc8){_0x589fc8=_[_0x7c54('0x4d')](_0x589fc8,'uniqueid');for(var _0x2e86f1 in _0x589fc8){if(_0x589fc8[_0x7c54('0x1c')](_0x2e86f1)){var _0x30d77a={};for(var _0x82ce39=0x0;_0x82ce39<_0x589fc8[_0x2e86f1][_0x7c54('0x36')];_0x82ce39+=0x1){var _0x18e8ab=_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x4e')];if(_0x206b2b[_0x7c54('0x10')][_0x18e8ab]){if(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x4f')]){_0x206b2b[_0x7c54('0x10')][_0x18e8ab][_0x7c54('0x50')]+=0x1;}if(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x51')]){_0x206b2b[_0x7c54('0x10')][_0x18e8ab]['abandoned']+=0x1;}_0x206b2b[_0x7c54('0x10')][_0x18e8ab][_0x7c54('0x52')]+=moment(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x53')])[_0x7c54('0x54')](moment(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x55')]),_0x7c54('0x56'))||0x0;if(_0x82ce39===_0x589fc8[_0x2e86f1]['length']-0x1){_0x206b2b[_0x7c54('0x10')][_0x18e8ab]['sumDuration']+=moment(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x57')]||_0x589fc8[_0x2e86f1][_0x82ce39]['queuecallerabandonAt']||_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x58')])[_0x7c54('0x54')](moment(_0x589fc8[_0x2e86f1][_0x82ce39]['queuecallerjoinAt']),_0x7c54('0x56'))||0x0;_0x206b2b[_0x7c54('0x10')][_0x18e8ab][_0x7c54('0x24')]+=0x1;if(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x59')]){_0x206b2b['voiceQueues'][_0x18e8ab][_0x7c54('0x25')]+=0x1;_0x206b2b[_0x7c54('0x10')][_0x18e8ab][_0x7c54('0x21')]+=moment(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x57')])[_0x7c54('0x54')](moment(_0x589fc8[_0x2e86f1][_0x82ce39][_0x7c54('0x53')]),'seconds')||0x0;}}else{_0x206b2b[_0x7c54('0x10')][_0x18e8ab][_0x7c54('0x5a')]+=_0x206b2b[_0x7c54('0x10')][_0x18e8ab][_0x7c54('0x52')]||0x0;}}}}}}return _0x206b2b[_0x7c54('0x10')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x5b')]=function(){var _0x39994=this;return function(_0x5dd2d9){clearVoiceCallReports(_0x39994[_0x7c54('0x13')]);if(_0x5dd2d9){for(var _0x2e1828=0x0;_0x2e1828<_0x5dd2d9[_0x7c54('0x36')];_0x2e1828+=0x1){_0x39994[_0x7c54('0x13')][_0x7c54('0x24')]+=0x1;_0x39994['outbound'][_0x7c54('0x5a')]+=_0x5dd2d9[_0x2e1828]['duration'];if(_0x5dd2d9[_0x2e1828][_0x7c54('0x5c')]===_0x7c54('0x5d')){_0x39994[_0x7c54('0x13')]['answered']+=0x1;_0x39994['outbound'][_0x7c54('0x52')]+=_0x5dd2d9[_0x2e1828][_0x7c54('0x5e')]-_0x5dd2d9[_0x2e1828][_0x7c54('0x5f')]||0x0;_0x39994[_0x7c54('0x13')]['sumBillable']+=_0x5dd2d9[_0x2e1828][_0x7c54('0x5f')];}}}return _0x39994[_0x7c54('0x13')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x60')]=function(){var _0x3597c9=this;return function(_0x2d1d0b){if(_0x2d1d0b){freeIsNotKey(_0x2d1d0b,_0x3597c9[_0x7c54('0x61')],_0x7c54('0x1f'));for(var _0x1387ab=0x0,_0x3b4a22={};_0x1387ab<_0x2d1d0b[_0x7c54('0x36')];_0x1387ab+=0x1){_0x3b4a22=_0x2d1d0b[_0x1387ab];if(_[_0x7c54('0x38')](_0x3597c9[_0x7c54('0x61')][_0x3b4a22[_0x7c54('0x1f')]])){_0x3597c9['campaigns'][_0x3b4a22[_0x7c54('0x1f')]]=new Campaign(_0x3b4a22);}else{_0x3597c9['mergeFromDatabase'](_0x3597c9[_0x7c54('0x61')][_0x3b4a22[_0x7c54('0x1f')]],_0x3b4a22);_0x3597c9[_0x7c54('0x61')][_0x3b4a22['name']][_0x7c54('0x62')]=_0x3b4a22[_0x7c54('0x63')]?_0x3b4a22[_0x7c54('0x63')][_0x7c54('0x1f')]:undefined;}}}return _0x3597c9[_0x7c54('0x61')];};};Realtime[_0x7c54('0x32')][_0x7c54('0x64')]=function(){var _0x551046=this;return function(_0x108b8d){if(_0x108b8d){freeIsNotKey(_0x108b8d,_0x551046[_0x7c54('0x65')],'id');for(var _0x3d02d8=0x0,_0x5b880c={};_0x3d02d8<_0x108b8d['length'];_0x3d02d8+=0x1){_0x5b880c=_0x108b8d[_0x3d02d8];if(_[_0x7c54('0x38')](_0x551046[_0x7c54('0x65')][_0x5b880c['id']])){_0x551046['voiceExtensions'][_0x5b880c['id']]=new VoiceExtension(_0x5b880c);}else{_0x551046['mergeFromDatabase'](_0x551046[_0x7c54('0x65')][_0x5b880c['id']],_0x5b880c);}}}return _0x551046[_0x7c54('0x65')];};};Realtime['prototype'][_0x7c54('0x66')]=function(){var _0x2974e1=this;return function(_0x1fc184){clearCampaigns(_0x2974e1[_0x7c54('0x61')]);for(var _0x3f32bc=0x0;_0x3f32bc<_0x1fc184[_0x7c54('0x36')];_0x3f32bc+=0x1){_[_0x7c54('0x4c')](_0x2974e1[_0x7c54('0x61')][_0x1fc184[_0x3f32bc][_0x7c54('0x1f')]],_0x1fc184[_0x3f32bc]);}return _0x2974e1['campaigns'];};};Realtime[_0x7c54('0x32')][_0x7c54('0x67')]=function(){var _0x567c8d=this;return function(_0x21a69b){if(_0x21a69b){freeIsNotKey(_0x21a69b,_0x567c8d[_0x7c54('0x1a')],'id');for(var _0x266e75=0x0,_0x4024c0={},_0x46c93f={};_0x266e75<_0x21a69b[_0x7c54('0x36')];_0x266e75+=0x1){_0x4024c0=_0x21a69b[_0x266e75];if(_[_0x7c54('0x38')](_0x567c8d[_0x7c54('0x1a')][_0x4024c0['id']])){_0x567c8d['faxAccounts'][_0x4024c0['id']]=new FaxAccount(_0x4024c0);}else{_0x567c8d['mergeFromDatabase'](_0x567c8d['faxAccounts'][_0x4024c0['id']],_0x4024c0);}}}return _0x567c8d[_0x7c54('0x1a')];};};module[_0x7c54('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index fd0e3a0..9992941 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 _0x211e=['substring','indexOf','phone','lastIndexOf','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','agents','telephones','sync','realtime','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','interface','format','SIP/%s','name','voiceQueueReport','length','accountcode','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','dialer','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','membername','forEach','voiceDialReport','startsWith','Local'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x211e,0x1a9));var _0xe211=function(_0x5c646c,_0x3c5e8f){_0x5c646c=_0x5c646c-0x0;var _0x1b9917=_0x211e[_0x5c646c];return _0x1b9917;};'use strict';var _=require(_0xe211('0x0'));var moment=require(_0xe211('0x1'));var util=require(_0xe211('0x2'));var config=require('../../../config/environment');var ami=require(_0xe211('0x3'));var RpcVoiceAgentReport=require(_0xe211('0x4'));var RpcVoiceCallReport=require(_0xe211('0x5'));var RpcVoiceDialReport=require(_0xe211('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xe211('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xe211('0x8'));var VoiceQueueReport=require(_0xe211('0x9'));var VoiceCallReport=require(_0xe211('0xa'));var VoiceAgentReport=require(_0xe211('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x4f6090){this['realtime']=_0x4f6090;this[_0xe211('0xc')]=_0x4f6090[_0xe211('0xc')];this[_0xe211('0xd')]=_0x4f6090[_0xe211('0xd')];}Report['prototype'][_0xe211('0xe')]=function(_0x3d73c2){var _0x39f186=new VoiceQueueReport(this[_0xe211('0xf')]);var _0x2efba8=new VoiceAgentReport(this[_0xe211('0xf')]);var _0x384e3f=new VoiceDialReport(this['realtime']);var _0x25af72=new VoiceCallReport(this[_0xe211('0xf')]);var _0x455e86=new UserReport(this['realtime']);if(config['xdr']&&config['xdr'][_0xe211('0x10')]){ami['on'](_0xe211('0x11'),this['voiceQueueReport'][_0xe211('0x12')](this));ami['on'](_0xe211('0x13'),this[_0xe211('0x14')][_0xe211('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0xe211('0x15')][_0xe211('0x12')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xe211('0x12')](this));ami['on'](_0xe211('0x16'),this[_0xe211('0x17')][_0xe211('0x12')](this));ami['on'](_0xe211('0x18'),this[_0xe211('0x19')][_0xe211('0x12')](this));}};Report[_0xe211('0x1a')][_0xe211('0x1b')]=function(_0xf18439){var _0x152b70;_0x152b70=_[_0xe211('0x1c')](this[_0xe211('0xc')],function(_0x4ff125){return _0x4ff125['accountcode']==_0xf18439||_0x4ff125['name']==_0xf18439;});if(_['isNil'](_0x152b70)){var _0x53306d=_[_0xe211('0x1c')](this[_0xe211('0xd')],function(_0x27f2b2){return _0x27f2b2['accountcode']==_0xf18439||_0x27f2b2['name']==_0xf18439;});if(_0x53306d){_0x152b70=_['find'](this[_0xe211('0xc')],function(_0x5e9d24){return _0x5e9d24[_0xe211('0x1d')]==util[_0xe211('0x1e')](_0xe211('0x1f'),_0x53306d[_0xe211('0x20')]);});}}return _0x152b70;};Report[_0xe211('0x1a')][_0xe211('0x21')]=function(_0x33c0c9){for(var _0x241c87=0x0;_0x241c87<_0x33c0c9[_0xe211('0x22')];_0x241c87+=0x1){var _0x33ffce=this['findAgent'](_0x33c0c9[_0x241c87]['connectedlinenum']);if(_0x33ffce){_0x33c0c9[_0x241c87]['accountcode']=_0x33ffce[_0xe211('0x23')];_0x33c0c9[_0x241c87][_0xe211('0x24')]=!![];_0x33c0c9[_0x241c87][_0xe211('0x25')]=_0x33ffce[_0xe211('0x20')];_0x33c0c9[_0x241c87][_0xe211('0x1d')]=_[_0xe211('0x26')](_0x33ffce['interface'])?util[_0xe211('0x1e')](_0xe211('0x1f'),_0x33ffce['name']):_0x33ffce['interface'];if(_0x33c0c9[_0x241c87][_0xe211('0x27')]){_0x33c0c9[_0x241c87][_0xe211('0x28')]=moment()[_0xe211('0x1e')](_0xe211('0x29'));}if(_0x33c0c9[_0x241c87][_0xe211('0x2a')]){_0x33c0c9[_0x241c87][_0xe211('0x2b')]=moment()[_0xe211('0x1e')](_0xe211('0x29'));}RpcMemberReport['voiceQueueReport'](_0x33c0c9[_0x241c87]);}RpcVoiceQueueReport[_0xe211('0x2c')](_0x33c0c9[_0x241c87]);}};function extractCalleridNumber(_0x8f8a67){var _0x41e102=_0x8f8a67[_0xe211('0x2d')](/<(.*?)>/);return _0x41e102?_0x41e102[0x1]:_0x8f8a67;}Report[_0xe211('0x1a')][_0xe211('0x14')]=function(_0x1a4ca3){_0x1a4ca3[_0xe211('0x2e')]=_0x1a4ca3[_0xe211('0x2e')]||_0x1a4ca3['exten'];if(_0x1a4ca3['type']==_0xe211('0x2f')){_0x1a4ca3['lastapplication']=_0xe211('0x30');_0x1a4ca3[_0xe211('0x31')]=_0x1a4ca3[_0xe211('0x30')];if(_0x1a4ca3[_0xe211('0x32')]==_0xe211('0x33')){_0x1a4ca3[_0xe211('0x23')]='';_0x1a4ca3[_0xe211('0x2e')]=extractCalleridNumber(_0x1a4ca3[_0xe211('0x34')]);}else if(_0x1a4ca3[_0xe211('0x32')]=='from-sip'){if(_0x1a4ca3['destination']==_0xe211('0x35')){_0x1a4ca3['destination']=extractCalleridNumber(_0x1a4ca3[_0xe211('0x36')]);_0x1a4ca3[_0xe211('0x37')]=_0x1a4ca3[_0xe211('0x38')];_0x1a4ca3['destinationchannel']=[_0x1a4ca3[_0xe211('0x39')],_0x1a4ca3[_0xe211('0x39')]=_0x1a4ca3[_0xe211('0x3a')]][0x0];_0x1a4ca3[_0xe211('0x34')]=_0x1a4ca3[_0xe211('0x36')];}else{_0x1a4ca3[_0xe211('0x2e')]=_0x1a4ca3[_0xe211('0x37')];_0x1a4ca3[_0xe211('0x37')]=_0x1a4ca3[_0xe211('0x38')];if(_0x1a4ca3[_0xe211('0x3b')]==_0xe211('0x3c')){_0x1a4ca3[_0xe211('0x23')]=_0x1a4ca3[_0xe211('0x3d')];}else{_0x1a4ca3['accountcode']='';}}}}else{_0x1a4ca3[_0xe211('0x34')]=util[_0xe211('0x1e')](_0xe211('0x3e'),_0x1a4ca3[_0xe211('0x3f')],_0x1a4ca3[_0xe211('0x37')]);}if(RpcVoiceTransferReport[_0xe211('0x40')][_0x1a4ca3['linkedid']]){var _0x1fbc3c=RpcVoiceTransferReport['transfers'][_0x1a4ca3[_0xe211('0x41')]];_0x1fbc3c['transfereelinkedid']=_0x1a4ca3[_0xe211('0x42')];RpcVoiceTransferReport['blindTransfer'](_0x1fbc3c);delete RpcVoiceTransferReport['transfers'][_0x1a4ca3[_0xe211('0x41')]];}RpcVoiceCallReport[_0xe211('0x2c')](_0x1a4ca3);if(_0x1a4ca3[_0xe211('0x43')]){for(var _0x11fa44=0x0;_0x11fa44<_0x1a4ca3['monitors'][_0xe211('0x22')];_0x11fa44+=0x1){_0x1a4ca3[_0xe211('0x44')]=_0x1a4ca3[_0xe211('0x45')][_0x11fa44][_0xe211('0x46')];_0x1a4ca3[_0xe211('0x47')]=_0x1a4ca3['monitors'][_0x11fa44]['createdAt'];if(_0x1a4ca3[_0xe211('0x48')]=='xcally-motion-preview'){_0x1a4ca3[_0xe211('0x37')]=_0x1a4ca3['connectedlinenum'];_0x1a4ca3['calleridname']=_0x1a4ca3[_0xe211('0x49')];_0x1a4ca3['connectedlinenum']=_0x1a4ca3[_0xe211('0x23')];_0x1a4ca3[_0xe211('0x49')]=_0x1a4ca3[_0xe211('0x4a')];_0x1a4ca3[_0xe211('0x48')]=_0x1a4ca3[_0xe211('0x38')];}else if(_0x1a4ca3[_0xe211('0x48')]=='xcally-motion-dialer'){_0x1a4ca3[_0xe211('0x37')]=_0x1a4ca3[_0xe211('0x2e')];_0x1a4ca3[_0xe211('0x48')]=_0x1a4ca3[_0xe211('0x38')];}RpcVoiceRecording['create'](_0x1a4ca3);}}};Report[_0xe211('0x1a')]['voiceAgentReport']=function(_0x4ed473){if(_['isArray'](_0x4ed473)){_0x4ed473[_0xe211('0x4b')](function(_0x34b948){RpcVoiceAgentReport['create'](_0x34b948);});}else{RpcVoiceAgentReport['create'](_0x4ed473);}};Report[_0xe211('0x1a')][_0xe211('0x4c')]=function(_0x1a5dfc){RpcVoiceDialReport[_0xe211('0x2c')](_0x1a5dfc);var _0xd24b1b;var _0x222e79;var _0x59762b=_0x1a5dfc['channel'];if(_[_0xe211('0x4d')](_0x59762b,_0xe211('0x4e'))){_0x222e79=_0x59762b[_0xe211('0x4f')](_0x59762b[_0xe211('0x50')]('/')+0x1,_0x59762b[_0xe211('0x50')]('@'));_0xd24b1b=_[_0xe211('0x1c')](this[_0xe211('0xc')],function(_0x1c3228){return _0x1c3228['mobile']==_0x222e79||_0x1c3228[_0xe211('0x51')]==_0x222e79||_0x1c3228[_0xe211('0x23')]==_0x222e79;});}else{_0x222e79=_0x59762b[_0xe211('0x4f')](_0x59762b[_0xe211('0x50')]('/')+0x1,_0x59762b[_0xe211('0x52')]('-'));_0xd24b1b=this['findAgent'](_0x222e79);}if(_0xd24b1b){_0x1a5dfc['interface']=_[_0xe211('0x26')](_0xd24b1b[_0xe211('0x1d')])?util[_0xe211('0x1e')](_0xe211('0x1f'),_0xd24b1b['name']):_0xd24b1b[_0xe211('0x1d')];_0x1a5dfc[_0xe211('0x4a')]=_0xd24b1b[_0xe211('0x20')];_0x1a5dfc[_0xe211('0x23')]=_0xd24b1b['accountcode'];RpcMemberReport[_0xe211('0x4c')](_0x1a5dfc);}};Report[_0xe211('0x1a')][_0xe211('0x17')]=function(_0x4ada24){RpcVoiceTransferReport['transfers'][_0x4ada24['transfererlinkedid']]=_0x4ada24;};Report[_0xe211('0x1a')]['attendedTransfer']=function(_0x47bb91){RpcVoiceTransferReport[_0xe211('0x19')](_0x47bb91);};module[_0xe211('0x53')]=Report; \ No newline at end of file +var _0x01fd=['from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitor','monitors','length','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','prototype','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider'];(function(_0x8940b9,_0x257c0c){var _0xcc272e=function(_0x57baa1){while(--_0x57baa1){_0x8940b9['push'](_0x8940b9['shift']());}};_0xcc272e(++_0x257c0c);}(_0x01fd,0xd9));var _0xd01f=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x01fd[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xd01f('0x0'));var config=require(_0xd01f('0x1'));var ami=require(_0xd01f('0x2'));var RpcVoiceAgentReport=require(_0xd01f('0x3'));var RpcVoiceCallReport=require(_0xd01f('0x4'));var RpcVoiceDialReport=require(_0xd01f('0x5'));var RpcMemberReport=require(_0xd01f('0x6'));var RpcVoiceQueueReport=require(_0xd01f('0x7'));var RpcVoiceRecording=require(_0xd01f('0x8'));var RpcVoiceTransferReport=require(_0xd01f('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xd01f('0xa'));var UserReport=require(_0xd01f('0xb'));function Report(_0xb4cc6e){this[_0xd01f('0xc')]=_0xb4cc6e;this[_0xd01f('0xd')]=_0xb4cc6e[_0xd01f('0xd')];this[_0xd01f('0xe')]=_0xb4cc6e[_0xd01f('0xe')];}Report['prototype'][_0xd01f('0xf')]=function(_0x11ad6a){var _0x586db7=new VoiceQueueReport(this[_0xd01f('0xc')]);var _0x5e1544=new VoiceAgentReport(this[_0xd01f('0xc')]);var _0x56d2f4=new VoiceDialReport(this[_0xd01f('0xc')]);var _0x12f08b=new VoiceCallReport(this[_0xd01f('0xc')]);var _0x2ed9a8=new UserReport(this[_0xd01f('0xc')]);if(config['xdr']&&config[_0xd01f('0x10')][_0xd01f('0x11')]){ami['on'](_0xd01f('0x12'),this[_0xd01f('0x13')]['bind'](this));ami['on'](_0xd01f('0x14'),this[_0xd01f('0x15')][_0xd01f('0x16')](this));ami['on'](_0xd01f('0x17'),this[_0xd01f('0x18')][_0xd01f('0x16')](this));ami['on']('custom:voiceDialReport',this[_0xd01f('0x19')]['bind'](this));ami['on'](_0xd01f('0x1a'),this['blindTransfer'][_0xd01f('0x16')](this));ami['on']('attendedtransfer',this[_0xd01f('0x1b')][_0xd01f('0x16')](this));}};Report['prototype'][_0xd01f('0x1c')]=function(_0x5f3959){var _0xfa397;_0xfa397=_[_0xd01f('0x1d')](this[_0xd01f('0xd')],function(_0x2f9475){return _0x2f9475['accountcode']==_0x5f3959||_0x2f9475[_0xd01f('0x1e')]==_0x5f3959;});if(_[_0xd01f('0x1f')](_0xfa397)){var _0x3e6da9=_[_0xd01f('0x1d')](this['telephones'],function(_0x1b7829){return _0x1b7829[_0xd01f('0x20')]==_0x5f3959||_0x1b7829['name']==_0x5f3959;});if(_0x3e6da9){_0xfa397=_[_0xd01f('0x1d')](this[_0xd01f('0xd')],function(_0x168a66){return _0x168a66[_0xd01f('0x21')]==util[_0xd01f('0x22')](_0xd01f('0x23'),_0x3e6da9['name']);});}}return _0xfa397;};Report[_0xd01f('0x24')]['voiceQueueReport']=function(_0x4b2b62){for(var _0x557002=0x0;_0x557002<_0x4b2b62['length'];_0x557002+=0x1){var _0x3fda63=this[_0xd01f('0x1c')](_0x4b2b62[_0x557002][_0xd01f('0x25')]);if(_0x3fda63){_0x4b2b62[_0x557002]['accountcode']=_0x3fda63[_0xd01f('0x20')];_0x4b2b62[_0x557002][_0xd01f('0x26')]=!![];_0x4b2b62[_0x557002][_0xd01f('0x27')]=_0x3fda63[_0xd01f('0x1e')];_0x4b2b62[_0x557002]['interface']=_['isNil'](_0x3fda63[_0xd01f('0x21')])?util[_0xd01f('0x22')](_0xd01f('0x23'),_0x3fda63['name']):_0x3fda63[_0xd01f('0x21')];if(_0x4b2b62[_0x557002][_0xd01f('0x28')]){_0x4b2b62[_0x557002][_0xd01f('0x29')]=moment()[_0xd01f('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4b2b62[_0x557002][_0xd01f('0x2a')]){_0x4b2b62[_0x557002][_0xd01f('0x2b')]=moment()['format'](_0xd01f('0x2c'));}RpcMemberReport[_0xd01f('0x13')](_0x4b2b62[_0x557002]);}RpcVoiceQueueReport[_0xd01f('0x2d')](_0x4b2b62[_0x557002]);}};function extractCalleridNumber(_0x541aee){var _0x2e4227=_0x541aee[_0xd01f('0x2e')](/<(.*?)>/);return _0x2e4227?_0x2e4227[0x1]:_0x541aee;}Report[_0xd01f('0x24')][_0xd01f('0x15')]=function(_0x14b3a0){_0x14b3a0[_0xd01f('0x2f')]=_0x14b3a0[_0xd01f('0x2f')]||_0x14b3a0[_0xd01f('0x30')];if(_0x14b3a0[_0xd01f('0x31')]==_0xd01f('0x32')){_0x14b3a0[_0xd01f('0x33')]=_0xd01f('0x34');_0x14b3a0[_0xd01f('0x35')]=_0x14b3a0[_0xd01f('0x34')];if(_0x14b3a0[_0xd01f('0x36')]==_0xd01f('0x37')){_0x14b3a0['accountcode']='';_0x14b3a0[_0xd01f('0x2f')]=extractCalleridNumber(_0x14b3a0['callerid']);}else if(_0x14b3a0[_0xd01f('0x36')]==_0xd01f('0x38')){if(_0x14b3a0[_0xd01f('0x2f')]==_0xd01f('0x39')){_0x14b3a0['destination']=extractCalleridNumber(_0x14b3a0[_0xd01f('0x3a')]);_0x14b3a0[_0xd01f('0x3b')]=_0x14b3a0[_0xd01f('0x3c')];_0x14b3a0[_0xd01f('0x3d')]=[_0x14b3a0[_0xd01f('0x3e')],_0x14b3a0[_0xd01f('0x3e')]=_0x14b3a0[_0xd01f('0x3d')]][0x0];_0x14b3a0[_0xd01f('0x3f')]=_0x14b3a0[_0xd01f('0x3a')];}else{_0x14b3a0[_0xd01f('0x2f')]=_0x14b3a0['calleridnum'];_0x14b3a0[_0xd01f('0x3b')]=_0x14b3a0['originatecalleridnum'];if(_0x14b3a0[_0xd01f('0x40')]==_0xd01f('0x41')){_0x14b3a0['accountcode']=_0x14b3a0[_0xd01f('0x25')];}else{_0x14b3a0[_0xd01f('0x20')]='';}}}}else{_0x14b3a0['callerid']=util[_0xd01f('0x22')](_0xd01f('0x42'),_0x14b3a0['calleridname'],_0x14b3a0[_0xd01f('0x3b')]);}if(RpcVoiceTransferReport[_0xd01f('0x43')][_0x14b3a0[_0xd01f('0x44')]]){var _0x23dd6a=RpcVoiceTransferReport[_0xd01f('0x43')][_0x14b3a0[_0xd01f('0x44')]];_0x23dd6a[_0xd01f('0x45')]=_0x14b3a0[_0xd01f('0x46')];RpcVoiceTransferReport[_0xd01f('0x47')](_0x23dd6a);delete RpcVoiceTransferReport[_0xd01f('0x43')][_0x14b3a0[_0xd01f('0x44')]];}RpcVoiceCallReport[_0xd01f('0x2d')](_0x14b3a0);if(_0x14b3a0[_0xd01f('0x48')]){for(var _0x5b4c0c=0x0;_0x5b4c0c<_0x14b3a0[_0xd01f('0x49')][_0xd01f('0x4a')];_0x5b4c0c+=0x1){_0x14b3a0[_0xd01f('0x4b')]=_0x14b3a0['monitors'][_0x5b4c0c][_0xd01f('0x4c')];_0x14b3a0[_0xd01f('0x4d')]=_0x14b3a0[_0xd01f('0x49')][_0x5b4c0c][_0xd01f('0x4d')];if(_0x14b3a0[_0xd01f('0x30')]=='xcally-motion-preview'){_0x14b3a0[_0xd01f('0x3b')]=_0x14b3a0[_0xd01f('0x25')];_0x14b3a0[_0xd01f('0x4e')]=_0x14b3a0[_0xd01f('0x4f')];_0x14b3a0[_0xd01f('0x25')]=_0x14b3a0[_0xd01f('0x20')];_0x14b3a0[_0xd01f('0x4f')]=_0x14b3a0[_0xd01f('0x50')];_0x14b3a0[_0xd01f('0x30')]=_0x14b3a0[_0xd01f('0x3c')];}else if(_0x14b3a0[_0xd01f('0x30')]==_0xd01f('0x51')){_0x14b3a0[_0xd01f('0x3b')]=_0x14b3a0[_0xd01f('0x2f')];_0x14b3a0[_0xd01f('0x30')]=_0x14b3a0[_0xd01f('0x3c')];}RpcVoiceRecording[_0xd01f('0x2d')](_0x14b3a0);}}};Report[_0xd01f('0x24')][_0xd01f('0x18')]=function(_0x42b9b7){if(_['isArray'](_0x42b9b7)){_0x42b9b7[_0xd01f('0x52')](function(_0x35aba2){RpcVoiceAgentReport[_0xd01f('0x2d')](_0x35aba2);});}else{RpcVoiceAgentReport[_0xd01f('0x2d')](_0x42b9b7);}};Report['prototype']['voiceDialReport']=function(_0x3864c2){RpcVoiceDialReport[_0xd01f('0x2d')](_0x3864c2);var _0x2f74ea;var _0x230788;var _0x3def82=_0x3864c2[_0xd01f('0x3e')];if(_[_0xd01f('0x53')](_0x3def82,'Local')){_0x230788=_0x3def82[_0xd01f('0x54')](_0x3def82[_0xd01f('0x55')]('/')+0x1,_0x3def82[_0xd01f('0x55')]('@'));_0x2f74ea=_[_0xd01f('0x1d')](this[_0xd01f('0xd')],function(_0x1a3255){return _0x1a3255[_0xd01f('0x56')]==_0x230788||_0x1a3255[_0xd01f('0x57')]==_0x230788||_0x1a3255[_0xd01f('0x20')]==_0x230788;});}else{_0x230788=_0x3def82['substring'](_0x3def82[_0xd01f('0x55')]('/')+0x1,_0x3def82[_0xd01f('0x58')]('-'));_0x2f74ea=this[_0xd01f('0x1c')](_0x230788);}if(_0x2f74ea){_0x3864c2[_0xd01f('0x21')]=_[_0xd01f('0x1f')](_0x2f74ea[_0xd01f('0x21')])?util['format'](_0xd01f('0x23'),_0x2f74ea[_0xd01f('0x1e')]):_0x2f74ea[_0xd01f('0x21')];_0x3864c2[_0xd01f('0x50')]=_0x2f74ea[_0xd01f('0x1e')];_0x3864c2[_0xd01f('0x20')]=_0x2f74ea[_0xd01f('0x20')];RpcMemberReport[_0xd01f('0x19')](_0x3864c2);}};Report[_0xd01f('0x24')][_0xd01f('0x47')]=function(_0xb8af4a){RpcVoiceTransferReport['transfers'][_0xb8af4a[_0xd01f('0x59')]]=_0xb8af4a;};Report['prototype'][_0xd01f('0x1b')]=function(_0x35557b){RpcVoiceTransferReport['attendedTransfer'](_0x35557b);};module[_0xd01f('0x5a')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index e6f1114..665b439 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4484=['device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:%s','startsWith','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','stateRegistry','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','syncDeviceState'];(function(_0x1c6d44,_0x1b7780){var _0x49d1a7=function(_0x1e6b18){while(--_0x1e6b18){_0x1c6d44['push'](_0x1c6d44['shift']());}};_0x49d1a7(++_0x1b7780);}(_0x4484,0xf2));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x4448('0x0'));var config=require(_0x4448('0x1'));var logger=require(_0x4448('0x2'))(_0x4448('0x3'));var ami=require(_0x4448('0x4'));config[_0x4448('0x5')]=_[_0x4448('0x6')](config[_0x4448('0x5')],{'host':_0x4448('0x7'),'port':0x18eb});var io=require(_0x4448('0x8'))(new Redis(config['redis']));function UserReport(_0x20374b){this['trunks']=_0x20374b[_0x4448('0x9')];this[_0x4448('0xa')]=_0x20374b[_0x4448('0xa')];this[_0x4448('0xb')]=_0x20374b[_0x4448('0xb')];ami['on'](_0x4448('0xc'),this[_0x4448('0xd')][_0x4448('0xe')](this));ami['on'](_0x4448('0xf'),this[_0x4448('0xd')][_0x4448('0xe')](this));ami['on'](_0x4448('0x10'),this['syncDeviceState']['bind'](this));ami['on'](_0x4448('0x11'),this[_0x4448('0x12')][_0x4448('0xe')](this));return this[_0x4448('0x13')]();}function showSipRegistrations(){Promise['resolve']()[_0x4448('0x14')](ami['actionSipShowRegistry']())[_0x4448('0x15')](function(_0x177034){logger[_0x4448('0x16')](_0x4448('0x17'),util[_0x4448('0x18')](_0x177034,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x4448('0x14')](ami[_0x4448('0x19')]())['catch'](function(_0x110748){logger[_0x4448('0x16')]('[userReport][devicestatelist]',util[_0x4448('0x18')](_0x110748,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x4448('0x1a')]()[_0x4448('0x14')](ami[_0x4448('0x1b')]())[_0x4448('0x15')](function(_0x398bbc){logger['error'](_0x4448('0x1c'),util[_0x4448('0x18')](_0x398bbc,{'showHidden':![],'depth':null}));});}UserReport[_0x4448('0x1d')][_0x4448('0x13')]=function(){setInterval(function(){BPromise[_0x4448('0x1a')]()['then'](showSipRegistrations())[_0x4448('0x14')](listDeviceStates())[_0x4448('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x4448('0x1d')][_0x4448('0x1e')]=function(_0x45d3c3){return _0x45d3c3!==null&&!_[_0x4448('0x1f')](_0x45d3c3);};UserReport[_0x4448('0x1d')]['emit']=function(_0x30f5c0,_0x4f91ed,_0x422988){io['to'](_0x30f5c0)[_0x4448('0x20')](_0x4f91ed,_0x422988);};UserReport[_0x4448('0x1d')][_0x4448('0xd')]=function(_0x554719){try{if(this[_0x4448('0x1e')](_0x554719)){logger[_0x4448('0x21')](_0x4448('0x22'),_0x554719[_0x4448('0x23')],_0x554719['state']);logger[_0x4448('0x24')](_0x4448('0x25'),util[_0x4448('0x18')](_0x554719,{'showHidden':![],'depth':null}));var _0x466dbc=_[_0x4448('0x26')](this['trunks'],{'registry':_0x554719[_0x4448('0x23')]});if(_0x466dbc){_0x554719[_0x4448('0x27')]=_0x554719[_0x4448('0x28')];_[_0x4448('0x29')](_0x466dbc,_[_0x4448('0x2a')](_0x554719,[_0x4448('0x2b'),_0x4448('0x2c'),'username',_0x4448('0x28')]));logger[_0x4448('0x24')](_0x4448('0x2d'),util[_0x4448('0x18')](_0x466dbc,{'showHidden':![],'depth':null}));this['emit'](util[_0x4448('0x2e')]('trunk:%s',_0x466dbc[_0x4448('0x2f')]),_0x4448('0x30'),_0x466dbc);}}}catch(_0x1a293f){logger['error'](_0x4448('0x25'),util[_0x4448('0x18')](_0x1a293f,{'showHidden':![],'depth':null}));}};UserReport[_0x4448('0x1d')][_0x4448('0x31')]=function(_0x1f6eec){try{if(this['isNotNull'](_0x1f6eec)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x1f6eec[_0x4448('0x32')],_0x1f6eec[_0x4448('0x28')]);logger[_0x4448('0x24')](_0x4448('0x33'),util[_0x4448('0x18')](_0x1f6eec,{'showHidden':![],'depth':null}));if(this[_0x4448('0xa')][_0x1f6eec[_0x4448('0x32')]]){if(!this['agents'][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x34')]||_0x1f6eec[_0x4448('0x28')][_0x4448('0x35')]()==_0x4448('0x36')){this[_0x4448('0xa')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x34')]=![];if(this[_0x4448('0xa')][_0x1f6eec['device']]['state']!==_0x1f6eec[_0x4448('0x28')][_0x4448('0x35')]()){this[_0x4448('0xa')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x37')]=_['toNumber'](moment()[_0x4448('0x2e')]('x'));}this[_0x4448('0xa')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x28')]=_0x1f6eec[_0x4448('0x28')][_0x4448('0x35')]();this[_0x4448('0xa')][_0x1f6eec['device']][_0x4448('0x38')](_0x1f6eec);}}else if(this[_0x4448('0xb')][_0x1f6eec[_0x4448('0x32')]]){if(this[_0x4448('0xb')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x28')]!==_0x1f6eec[_0x4448('0x28')]['toLowerCase']()){this[_0x4448('0xb')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x37')]=_[_0x4448('0x39')](moment()[_0x4448('0x2e')]('x'));}this['telephones'][_0x1f6eec[_0x4448('0x32')]]['state']=_0x1f6eec[_0x4448('0x28')][_0x4448('0x35')]();logger[_0x4448('0x24')](_0x4448('0x3a'),util['inspect'](this[_0x4448('0xb')][_0x1f6eec['device']],{'showHidden':![],'depth':null}));this[_0x4448('0x20')](util[_0x4448('0x2e')](_0x4448('0x3b'),this[_0x4448('0xb')][_0x1f6eec[_0x4448('0x32')]]['name']),_0x4448('0x3c'),this[_0x4448('0xb')][_0x1f6eec[_0x4448('0x32')]]);}else if(this[_0x4448('0x9')][_0x1f6eec[_0x4448('0x32')]]){if(this['trunks'][_0x1f6eec[_0x4448('0x32')]]['state']!==_0x1f6eec[_0x4448('0x28')][_0x4448('0x35')]()){this[_0x4448('0x9')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x37')]=_['toNumber'](moment()[_0x4448('0x2e')]('x'));}this[_0x4448('0x9')][_0x1f6eec['device']][_0x4448('0x28')]=_0x1f6eec[_0x4448('0x28')][_0x4448('0x35')]();logger[_0x4448('0x24')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x4448('0x18')](this[_0x4448('0x9')][_0x1f6eec[_0x4448('0x32')]],{'showHidden':![],'depth':null}));this[_0x4448('0x20')](util[_0x4448('0x2e')](_0x4448('0x3d'),this[_0x4448('0x9')][_0x1f6eec[_0x4448('0x32')]][_0x4448('0x2f')]),_0x4448('0x30'),this[_0x4448('0x9')][_0x1f6eec['device']]);}else if(_[_0x4448('0x3e')](_0x1f6eec[_0x4448('0x32')],'Local')){var _0x4b660d=_0x1f6eec['device'];var _0x15bcd6=_0x4b660d['substring'](_0x4b660d[_0x4448('0x3f')]('/')+0x1,_0x4b660d[_0x4448('0x3f')]('@'));var _0x34107b=_['find'](this['agents'],function(_0x301eb4){return _0x301eb4[_0x4448('0x40')]==_0x15bcd6||_0x301eb4['phone']==_0x15bcd6||_0x301eb4[_0x4448('0x41')]==_0x15bcd6;});if(_0x34107b){if(_0x34107b['state']!==_0x1f6eec[_0x4448('0x28')]['toLowerCase']()){_0x34107b[_0x4448('0x37')]=_['toNumber'](moment()[_0x4448('0x2e')]('x'));}_0x34107b['state']=_0x1f6eec[_0x4448('0x28')]['toLowerCase']();_0x34107b[_0x4448('0x34')]=!![];_0x34107b[_0x4448('0x38')](_0x1f6eec);}}}}catch(_0x2c91a7){logger[_0x4448('0x16')]('[userReport][devicestatechange]',util[_0x4448('0x18')](_0x2c91a7,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x4810b3){try{if(this[_0x4448('0x1e')](_0x4810b3)&&this['isNotNull'](_0x4810b3[_0x4448('0x11')])){logger['info'](_0x4448('0x42'),_0x4810b3[_0x4448('0x43')],_0x4810b3[_0x4448('0x44')],_0x4810b3[_0x4448('0x11')]);logger[_0x4448('0x24')]('[userReport][peerstatus]',util[_0x4448('0x18')](_0x4810b3,{'showHidden':![],'depth':null}));if(this[_0x4448('0xa')][_0x4810b3[_0x4448('0x43')]]){if(!this[_0x4448('0xa')][_0x4810b3[_0x4448('0x43')]]['local']||_0x4810b3[_0x4448('0x11')][_0x4448('0x35')]()=='registered'){this[_0x4448('0xa')][_0x4810b3[_0x4448('0x43')]][_0x4448('0x34')]=![];this[_0x4448('0xa')][_0x4810b3[_0x4448('0x43')]][_0x4448('0x45')]=_0x4810b3[_0x4448('0x11')][_0x4448('0x35')]();this[_0x4448('0xa')][_0x4810b3['peer']]['address']=_0x4810b3['address'];this[_0x4448('0xa')][_0x4810b3[_0x4448('0x43')]]['updateStatusRealtime'](_0x4810b3);}}else if(this['telephones'][_0x4810b3[_0x4448('0x43')]]){this['telephones'][_0x4810b3[_0x4448('0x43')]]['status']=_0x4810b3['peerstatus'][_0x4448('0x35')]();this['telephones'][_0x4810b3[_0x4448('0x43')]][_0x4448('0x44')]=_0x4810b3[_0x4448('0x44')];logger[_0x4448('0x24')](_0x4448('0x46'),util[_0x4448('0x18')](this[_0x4448('0xb')][_0x4810b3[_0x4448('0x43')]],{'showHidden':![],'depth':null}));this[_0x4448('0x20')](util[_0x4448('0x2e')]('telephone:%s',this[_0x4448('0xb')][_0x4810b3[_0x4448('0x43')]][_0x4448('0x2f')]),_0x4448('0x3c'),this[_0x4448('0xb')][_0x4810b3[_0x4448('0x43')]]);}else if(this['trunks'][_0x4810b3[_0x4448('0x43')]]){this[_0x4448('0x9')][_0x4810b3['peer']][_0x4448('0x45')]=_0x4810b3[_0x4448('0x11')][_0x4448('0x35')]();this[_0x4448('0x9')][_0x4810b3[_0x4448('0x43')]][_0x4448('0x44')]=_0x4810b3['address'];logger[_0x4448('0x24')](_0x4448('0x47'),util[_0x4448('0x18')](this[_0x4448('0x9')][_0x4810b3[_0x4448('0x43')]],{'showHidden':![],'depth':null}));this[_0x4448('0x20')](util['format'](_0x4448('0x3d'),this[_0x4448('0x9')][_0x4810b3['peer']][_0x4448('0x2f')]),_0x4448('0x30'),this[_0x4448('0x9')][_0x4810b3['peer']]);}}}catch(_0x14e3e3){logger[_0x4448('0x16')]('[userReport][peerstatus]',util['inspect'](_0x14e3e3,{'showHidden':![],'depth':null}));}};module[_0x4448('0x48')]=UserReport; \ No newline at end of file +var _0xb5f3=['peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','local','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','[userReport][peerstatus]','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','redis','defaults','localhost','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','stateTime','format','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode'];(function(_0x4d5d10,_0x203d60){var _0x1490fe=function(_0x19af79){while(--_0x19af79){_0x4d5d10['push'](_0x4d5d10['shift']());}};_0x1490fe(++_0x203d60);}(_0xb5f3,0x137));var _0x3b5f=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xb5f3[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x3b5f('0x0'));var moment=require(_0x3b5f('0x1'));var util=require(_0x3b5f('0x2'));var Redis=require('ioredis');var BPromise=require(_0x3b5f('0x3'));var config=require(_0x3b5f('0x4'));var logger=require(_0x3b5f('0x5'))('ami');var ami=require('../ami');config[_0x3b5f('0x6')]=_[_0x3b5f('0x7')](config[_0x3b5f('0x6')],{'host':_0x3b5f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b5f('0x6')]));function UserReport(_0x1b6d67){this['trunks']=_0x1b6d67[_0x3b5f('0x9')];this['agents']=_0x1b6d67[_0x3b5f('0xa')];this[_0x3b5f('0xb')]=_0x1b6d67[_0x3b5f('0xb')];ami['on'](_0x3b5f('0xc'),this['syncRegistry'][_0x3b5f('0xd')](this));ami['on'](_0x3b5f('0xe'),this[_0x3b5f('0xf')][_0x3b5f('0xd')](this));ami['on'](_0x3b5f('0x10'),this['syncDeviceState']['bind'](this));ami['on']('peerstatus',this[_0x3b5f('0x11')][_0x3b5f('0xd')](this));return this[_0x3b5f('0x12')]();}function showSipRegistrations(){Promise[_0x3b5f('0x13')]()[_0x3b5f('0x14')](ami[_0x3b5f('0x15')]())[_0x3b5f('0x16')](function(_0x302c0a){logger['error'](_0x3b5f('0x17'),util[_0x3b5f('0x18')](_0x302c0a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3b5f('0x13')]()['then'](ami[_0x3b5f('0x19')]())['catch'](function(_0x5df2e7){logger[_0x3b5f('0x1a')]('[userReport][devicestatelist]',util[_0x3b5f('0x18')](_0x5df2e7,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3b5f('0x13')]()[_0x3b5f('0x14')](ami[_0x3b5f('0x1b')]())['catch'](function(_0x2db25f){logger['error'](_0x3b5f('0x1c'),util[_0x3b5f('0x18')](_0x2db25f,{'showHidden':![],'depth':null}));});}UserReport[_0x3b5f('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x3b5f('0x14')](showSipRegistrations())[_0x3b5f('0x14')](listDeviceStates())[_0x3b5f('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x3b5f('0x1d')]['isNotNull']=function(_0x101a00){return _0x101a00!==null&&!_[_0x3b5f('0x1e')](_0x101a00);};UserReport[_0x3b5f('0x1d')][_0x3b5f('0x1f')]=function(_0x474697,_0x4580e5,_0x56a1d0){io['to'](_0x474697)['emit'](_0x4580e5,_0x56a1d0);};UserReport[_0x3b5f('0x1d')][_0x3b5f('0xf')]=function(_0x2d3fe4){try{if(this[_0x3b5f('0x20')](_0x2d3fe4)){logger[_0x3b5f('0x21')](_0x3b5f('0x22'),_0x2d3fe4[_0x3b5f('0x23')],_0x2d3fe4[_0x3b5f('0x24')]);logger[_0x3b5f('0x25')](_0x3b5f('0x26'),util['inspect'](_0x2d3fe4,{'showHidden':![],'depth':null}));var _0x55fb32=_[_0x3b5f('0x27')](this[_0x3b5f('0x9')],{'registry':_0x2d3fe4[_0x3b5f('0x23')]});if(_0x55fb32){_0x2d3fe4[_0x3b5f('0x28')]=_0x2d3fe4[_0x3b5f('0x24')];_['merge'](_0x55fb32,_[_0x3b5f('0x29')](_0x2d3fe4,[_0x3b5f('0x2a'),_0x3b5f('0x2b'),_0x3b5f('0x23'),'state']));logger['debug'](_0x3b5f('0x2c'),util[_0x3b5f('0x18')](_0x55fb32,{'showHidden':![],'depth':null}));this[_0x3b5f('0x1f')](util['format']('trunk:%s',_0x55fb32[_0x3b5f('0x2d')]),_0x3b5f('0x2e'),_0x55fb32);}}}catch(_0x5f171d){logger[_0x3b5f('0x1a')]('[userReport][registry]',util[_0x3b5f('0x18')](_0x5f171d,{'showHidden':![],'depth':null}));}};UserReport[_0x3b5f('0x1d')]['syncDeviceState']=function(_0x490a72){try{if(this[_0x3b5f('0x20')](_0x490a72)){logger[_0x3b5f('0x21')](_0x3b5f('0x2f'),_0x490a72[_0x3b5f('0x30')],_0x490a72[_0x3b5f('0x24')]);logger[_0x3b5f('0x25')](_0x3b5f('0x31'),util[_0x3b5f('0x18')](_0x490a72,{'showHidden':![],'depth':null}));if(this['agents'][_0x490a72[_0x3b5f('0x30')]]){if(!this[_0x3b5f('0xa')][_0x490a72[_0x3b5f('0x30')]]['local']||_0x490a72[_0x3b5f('0x24')][_0x3b5f('0x32')]()==_0x3b5f('0x33')){this[_0x3b5f('0xa')][_0x490a72[_0x3b5f('0x30')]]['local']=![];if(this['agents'][_0x490a72['device']][_0x3b5f('0x24')]!==_0x490a72[_0x3b5f('0x24')][_0x3b5f('0x32')]()){this[_0x3b5f('0xa')][_0x490a72[_0x3b5f('0x30')]][_0x3b5f('0x34')]=_['toNumber'](moment()[_0x3b5f('0x35')]('x'));}this[_0x3b5f('0xa')][_0x490a72[_0x3b5f('0x30')]]['state']=_0x490a72['state'][_0x3b5f('0x32')]();this['agents'][_0x490a72['device']]['updateStatusRealtime'](_0x490a72);}}else if(this[_0x3b5f('0xb')][_0x490a72['device']]){if(this[_0x3b5f('0xb')][_0x490a72[_0x3b5f('0x30')]][_0x3b5f('0x24')]!==_0x490a72['state'][_0x3b5f('0x32')]()){this['telephones'][_0x490a72[_0x3b5f('0x30')]][_0x3b5f('0x34')]=_[_0x3b5f('0x36')](moment()[_0x3b5f('0x35')]('x'));}this[_0x3b5f('0xb')][_0x490a72['device']][_0x3b5f('0x24')]=_0x490a72[_0x3b5f('0x24')]['toLowerCase']();logger[_0x3b5f('0x25')](_0x3b5f('0x37'),util[_0x3b5f('0x18')](this[_0x3b5f('0xb')][_0x490a72[_0x3b5f('0x30')]],{'showHidden':![],'depth':null}));this[_0x3b5f('0x1f')](util['format']('telephone:%s',this['telephones'][_0x490a72['device']][_0x3b5f('0x2d')]),_0x3b5f('0x38'),this[_0x3b5f('0xb')][_0x490a72[_0x3b5f('0x30')]]);}else if(this['trunks'][_0x490a72[_0x3b5f('0x30')]]){if(this[_0x3b5f('0x9')][_0x490a72[_0x3b5f('0x30')]]['state']!==_0x490a72[_0x3b5f('0x24')][_0x3b5f('0x32')]()){this[_0x3b5f('0x9')][_0x490a72['device']][_0x3b5f('0x34')]=_['toNumber'](moment()[_0x3b5f('0x35')]('x'));}this[_0x3b5f('0x9')][_0x490a72[_0x3b5f('0x30')]][_0x3b5f('0x24')]=_0x490a72[_0x3b5f('0x24')][_0x3b5f('0x32')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x3b5f('0x18')](this[_0x3b5f('0x9')][_0x490a72['device']],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this['trunks'][_0x490a72[_0x3b5f('0x30')]][_0x3b5f('0x2d')]),_0x3b5f('0x2e'),this['trunks'][_0x490a72[_0x3b5f('0x30')]]);}else if(_[_0x3b5f('0x39')](_0x490a72[_0x3b5f('0x30')],_0x3b5f('0x3a'))){var _0x46a356=_0x490a72[_0x3b5f('0x30')];var _0x4dda92=_0x46a356[_0x3b5f('0x3b')](_0x46a356[_0x3b5f('0x3c')]('/')+0x1,_0x46a356[_0x3b5f('0x3c')]('@'));var _0x44c008=_[_0x3b5f('0x27')](this['agents'],function(_0x44e477){return _0x44e477[_0x3b5f('0x3d')]==_0x4dda92||_0x44e477[_0x3b5f('0x3e')]==_0x4dda92||_0x44e477[_0x3b5f('0x3f')]==_0x4dda92;});if(_0x44c008){if(_0x44c008['state']!==_0x490a72[_0x3b5f('0x24')][_0x3b5f('0x32')]()){_0x44c008[_0x3b5f('0x34')]=_[_0x3b5f('0x36')](moment()[_0x3b5f('0x35')]('x'));}_0x44c008[_0x3b5f('0x24')]=_0x490a72[_0x3b5f('0x24')][_0x3b5f('0x32')]();_0x44c008['local']=!![];_0x44c008['updateStatusRealtime'](_0x490a72);}}}}catch(_0x2eb003){logger[_0x3b5f('0x1a')](_0x3b5f('0x31'),util[_0x3b5f('0x18')](_0x2eb003,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3b5f('0x11')]=function(_0x538cbe){try{if(this[_0x3b5f('0x20')](_0x538cbe)&&this[_0x3b5f('0x20')](_0x538cbe[_0x3b5f('0x40')])){logger['info'](_0x3b5f('0x41'),_0x538cbe[_0x3b5f('0x42')],_0x538cbe['address'],_0x538cbe[_0x3b5f('0x40')]);logger[_0x3b5f('0x25')]('[userReport][peerstatus]',util['inspect'](_0x538cbe,{'showHidden':![],'depth':null}));if(this[_0x3b5f('0xa')][_0x538cbe[_0x3b5f('0x42')]]){if(!this[_0x3b5f('0xa')][_0x538cbe[_0x3b5f('0x42')]][_0x3b5f('0x43')]||_0x538cbe['peerstatus'][_0x3b5f('0x32')]()==_0x3b5f('0x44')){this['agents'][_0x538cbe[_0x3b5f('0x42')]]['local']=![];this[_0x3b5f('0xa')][_0x538cbe['peer']]['status']=_0x538cbe[_0x3b5f('0x40')][_0x3b5f('0x32')]();this[_0x3b5f('0xa')][_0x538cbe[_0x3b5f('0x42')]]['address']=_0x538cbe[_0x3b5f('0x45')];this['agents'][_0x538cbe[_0x3b5f('0x42')]]['updateStatusRealtime'](_0x538cbe);}}else if(this[_0x3b5f('0xb')][_0x538cbe['peer']]){this[_0x3b5f('0xb')][_0x538cbe['peer']][_0x3b5f('0x46')]=_0x538cbe[_0x3b5f('0x40')]['toLowerCase']();this[_0x3b5f('0xb')][_0x538cbe[_0x3b5f('0x42')]][_0x3b5f('0x45')]=_0x538cbe[_0x3b5f('0x45')];logger['debug'](_0x3b5f('0x47'),util[_0x3b5f('0x18')](this['telephones'][_0x538cbe[_0x3b5f('0x42')]],{'showHidden':![],'depth':null}));this[_0x3b5f('0x1f')](util[_0x3b5f('0x35')]('telephone:%s',this[_0x3b5f('0xb')][_0x538cbe[_0x3b5f('0x42')]][_0x3b5f('0x2d')]),_0x3b5f('0x38'),this[_0x3b5f('0xb')][_0x538cbe['peer']]);}else if(this[_0x3b5f('0x9')][_0x538cbe[_0x3b5f('0x42')]]){this[_0x3b5f('0x9')][_0x538cbe['peer']][_0x3b5f('0x46')]=_0x538cbe[_0x3b5f('0x40')]['toLowerCase']();this[_0x3b5f('0x9')][_0x538cbe[_0x3b5f('0x42')]][_0x3b5f('0x45')]=_0x538cbe['address'];logger['debug'](_0x3b5f('0x48'),util[_0x3b5f('0x18')](this['trunks'][_0x538cbe[_0x3b5f('0x42')]],{'showHidden':![],'depth':null}));this[_0x3b5f('0x1f')](util[_0x3b5f('0x35')](_0x3b5f('0x49'),this['trunks'][_0x538cbe['peer']][_0x3b5f('0x2d')]),'trunk:save',this['trunks'][_0x538cbe[_0x3b5f('0x42')]]);}}}catch(_0x2fa5ab){logger[_0x3b5f('0x1a')](_0x3b5f('0x4a'),util[_0x3b5f('0x18')](_0x2fa5ab,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index b80daa1..1d2e310 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ec1=['destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','channels','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','destuniqueid','omit','privilege','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','connectedlinename','connectedlinenum','destchannelstate'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0ec1,0xea));var _0x10ec=function(_0x3ad849,_0x118fa8){_0x3ad849=_0x3ad849-0x0;var _0x395b20=_0x0ec1[_0x3ad849];return _0x395b20;};'use strict';var _=require(_0x10ec('0x0'));var moment=require(_0x10ec('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x10ec('0x2'));var logger=require(_0x10ec('0x3'))('ami');var ami=require(_0x10ec('0x4'));config['redis']=_[_0x10ec('0x5')](config[_0x10ec('0x6')],{'host':_0x10ec('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x10ec('0x6')]));function VoiceAgentReport(_0x2c2464){this[_0x10ec('0x8')]={};this['voiceQueues']=_0x2c2464[_0x10ec('0x9')];this[_0x10ec('0xa')]=_0x2c2464[_0x10ec('0xa')];this[_0x10ec('0xb')]={};ami['on'](_0x10ec('0xc'),this['syncAgentCalled']['bind'](this));ami['on'](_0x10ec('0xd'),this[_0x10ec('0xe')][_0x10ec('0xf')](this));ami['on']('agentringnoanswer',this[_0x10ec('0x10')]['bind'](this));ami['on']('queuecallerabandon',this[_0x10ec('0x11')][_0x10ec('0xf')](this));ami['on'](_0x10ec('0x12'),this['syncAgentComplete'][_0x10ec('0xf')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x10ec('0x13'),this[_0x10ec('0x14')][_0x10ec('0xf')](this));ami['on'](_0x10ec('0x15'),this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this[_0x10ec('0x16')][_0x10ec('0xf')](this));ami['on'](_0x10ec('0x17'),this[_0x10ec('0x18')][_0x10ec('0xf')](this));ami['on']('blindtransfer',this[_0x10ec('0x19')][_0x10ec('0xf')](this));}VoiceAgentReport[_0x10ec('0x1a')]['emit']=function(_0x4467c6,_0x3d8f28,_0x1f6ca5){io['to'](_0x4467c6)[_0x10ec('0x1b')](_0x3d8f28,_0x1f6ca5);};VoiceAgentReport[_0x10ec('0x1a')]['isNotNull']=function(_0x22ec9e){return _0x22ec9e!==null&&!_[_0x10ec('0x1c')](_0x22ec9e);};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0x1d')]=function(_0x1e2be8){try{if(this[_0x10ec('0x1e')](_0x1e2be8)){logger[_0x10ec('0x1f')](_0x10ec('0x20'),_0x1e2be8[_0x10ec('0x21')],_0x1e2be8[_0x10ec('0x22')],_0x1e2be8['destuniqueid']);logger[_0x10ec('0x23')](_0x10ec('0x24'),_0x1e2be8['uniqueid'],util[_0x10ec('0x25')](_0x1e2be8,{'showHidden':![],'depth':null}));if(_[_0x10ec('0x1c')](this['channels'][_0x1e2be8['uniqueid']])){this[_0x10ec('0x8')][_0x1e2be8[_0x10ec('0x21')]]={};}if(_['isUndefined'](this[_0x10ec('0x8')][_0x1e2be8[_0x10ec('0x21')]][_0x1e2be8['destuniqueid']])){this[_0x10ec('0x8')][_0x1e2be8['uniqueid']][_0x1e2be8['destuniqueid']]={'agentcalledAt':moment()[_0x10ec('0x26')](_0x10ec('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x10ec('0x9')][_0x1e2be8[_0x10ec('0x28')]]?this[_0x10ec('0x9')][_0x1e2be8[_0x10ec('0x28')]]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x1e2be8['queue']]?this[_0x10ec('0x9')][_0x1e2be8[_0x10ec('0x28')]][_0x10ec('0x29')]||_0x10ec('0x2a'):_0x10ec('0x2a'),'variables':this[_0x10ec('0xb')][_0x1e2be8[_0x10ec('0x21')]]};}_[_0x10ec('0x2b')](this[_0x10ec('0x8')][_0x1e2be8[_0x10ec('0x21')]][_0x1e2be8[_0x10ec('0x2c')]],_[_0x10ec('0x2d')](_0x1e2be8,['event',_0x10ec('0x2e')]));logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x1e2be8[_0x10ec('0x21')],util[_0x10ec('0x25')](this[_0x10ec('0x8')][_0x1e2be8[_0x10ec('0x21')]][_0x1e2be8[_0x10ec('0x2c')]],{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')](_0x10ec('0x2f'),this['channels'][_0x1e2be8[_0x10ec('0x21')]][_0x1e2be8[_0x10ec('0x2c')]]);logger[_0x10ec('0x23')](_0x10ec('0x30'),_0x1e2be8['uniqueid'],util[_0x10ec('0x25')](this[_0x10ec('0x8')][_0x1e2be8['uniqueid']][_0x1e2be8[_0x10ec('0x2c')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x10ec('0x26')](_0x10ec('0x31'),_0x1e2be8[_0x10ec('0x22')]),_0x10ec('0x32'),this[_0x10ec('0x8')][_0x1e2be8['uniqueid']][_0x1e2be8[_0x10ec('0x2c')]]);}}catch(_0x3e297c){logger[_0x10ec('0x33')]('[%s][voiceAgentReport][agentcalled]',_0x1e2be8[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x3e297c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0xe')]=function(_0x44fad6){try{if(this[_0x10ec('0x1e')](_0x44fad6)){if(this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]]){logger[_0x10ec('0x23')](_0x10ec('0x34'),_0x44fad6[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x44fad6,{'showHidden':![],'depth':null}));for(var _0x228fe5 in this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]]){if(this['channels'][_0x44fad6[_0x10ec('0x21')]]['hasOwnProperty'](_0x228fe5)){if(_0x44fad6[_0x10ec('0x2c')]===_0x228fe5){logger[_0x10ec('0x1f')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x44fad6[_0x10ec('0x21')],_0x44fad6['membername'],_0x44fad6[_0x10ec('0x2c')]);this['channels'][_0x44fad6['uniqueid']][_0x228fe5]['agentconnectAt']=moment()[_0x10ec('0x26')](_0x10ec('0x27'));this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x35')]=_0x44fad6[_0x10ec('0x35')];this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x36')]=_0x44fad6[_0x10ec('0x36')];this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5]['destchannelstate']=_0x44fad6[_0x10ec('0x37')];this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x38')]=_0x44fad6[_0x10ec('0x38')];this[_0x10ec('0x8')][_0x44fad6['uniqueid']][_0x228fe5]['holdtime']=_0x44fad6[_0x10ec('0x39')];this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x3a')]=_0x10ec('0x3b');_[_0x10ec('0x2b')](this[_0x10ec('0xa')][_0x44fad6[_0x10ec('0x3c')]],_[_0x10ec('0x3d')](_0x44fad6,[_0x10ec('0x28'),_0x10ec('0x3e')]));logger[_0x10ec('0x23')](_0x10ec('0x3f'),_0x44fad6[_0x10ec('0x21')],util[_0x10ec('0x25')](this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x44fad6[_0x10ec('0x2c')]],{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')](_0x10ec('0x40'),this[_0x10ec('0x8')][_0x44fad6['uniqueid']][_0x44fad6['destuniqueid']]);logger['debug'](_0x10ec('0x41'),_0x44fad6[_0x10ec('0x21')],util[_0x10ec('0x25')](this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x44fad6[_0x10ec('0x2c')]],{'showHidden':![],'depth':null}));this[_0x10ec('0x1b')](util['format'](_0x10ec('0x31'),_0x44fad6[_0x10ec('0x22')]),_0x10ec('0x42'),this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x44fad6[_0x10ec('0x2c')]]);}else if(!this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x43')]&&!this[_0x10ec('0x8')][_0x44fad6['uniqueid']][_0x228fe5][_0x10ec('0x12')]){logger[_0x10ec('0x1f')](_0x10ec('0x44'),_0x44fad6[_0x10ec('0x21')],this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x22')],_0x228fe5);this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x43')]=!![];this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x45')]=moment()['format'](_0x10ec('0x27'));this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x46')]=_0x44fad6[_0x10ec('0x2c')];this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x47')]=_0x44fad6[_0x10ec('0x22')];this[_0x10ec('0x8')][_0x44fad6[_0x10ec('0x21')]][_0x228fe5][_0x10ec('0x3a')]='answered_elsewhere';this[_0x10ec('0x8')][_0x44fad6['uniqueid']][_0x228fe5]['reason']='answered_elsewhere';logger['debug'](_0x10ec('0x48'),_0x44fad6['uniqueid'],util[_0x10ec('0x25')](this[_0x10ec('0x8')][_0x44fad6['uniqueid']][_0x228fe5],{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')]('custom:agentansweredelsewhere',this['channels'][_0x44fad6[_0x10ec('0x21')]][_0x228fe5]);}}}}}}catch(_0x381e47){logger[_0x10ec('0x33')](_0x10ec('0x49'),_0x44fad6[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x381e47,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10ec('0x10')]=function(_0x56dfcb){try{if(this[_0x10ec('0x1e')](_0x56dfcb)){logger['debug'](_0x10ec('0x4a'),_0x56dfcb[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x56dfcb,{'showHidden':![],'depth':null}));if(this[_0x10ec('0x8')][_0x56dfcb[_0x10ec('0x21')]]&&this[_0x10ec('0x8')][_0x56dfcb['uniqueid']][_0x56dfcb[_0x10ec('0x2c')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x56dfcb[_0x10ec('0x21')],_0x56dfcb[_0x10ec('0x22')],_0x56dfcb[_0x10ec('0x2c')]);this[_0x10ec('0x8')][_0x56dfcb['uniqueid']][_0x56dfcb[_0x10ec('0x2c')]][_0x10ec('0x43')]=!![];this[_0x10ec('0x8')][_0x56dfcb[_0x10ec('0x21')]][_0x56dfcb[_0x10ec('0x2c')]][_0x10ec('0x45')]=moment()['format'](_0x10ec('0x27'));this[_0x10ec('0x8')][_0x56dfcb[_0x10ec('0x21')]][_0x56dfcb[_0x10ec('0x2c')]][_0x10ec('0x3a')]=_0x10ec('0x4b');this['channels'][_0x56dfcb['uniqueid']][_0x56dfcb[_0x10ec('0x2c')]][_0x10ec('0x4c')]='rejected';logger['debug'](_0x10ec('0x4d'),_0x56dfcb[_0x10ec('0x21')],util[_0x10ec('0x25')](this['channels'][_0x56dfcb[_0x10ec('0x21')]][_0x56dfcb[_0x10ec('0x2c')]],{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')](_0x10ec('0x4e'),this[_0x10ec('0x8')][_0x56dfcb[_0x10ec('0x21')]][_0x56dfcb[_0x10ec('0x2c')]]);}}}catch(_0x53f57c){logger[_0x10ec('0x33')](_0x10ec('0x4f'),_0x56dfcb['uniqueid'],util[_0x10ec('0x25')](_0x53f57c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10ec('0x11')]=function(_0x1ab78f){try{if(this[_0x10ec('0x1e')](_0x1ab78f)){logger[_0x10ec('0x23')](_0x10ec('0x50'),_0x1ab78f['uniqueid'],util[_0x10ec('0x25')](_0x1ab78f,{'showHidden':![],'depth':null}));if(this[_0x10ec('0x8')][_0x1ab78f['uniqueid']]){for(var _0x151813 in this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]]){if(this['channels'][_0x1ab78f['uniqueid']][_0x10ec('0x51')](_0x151813)&&!this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813][_0x10ec('0x43')]&&!this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813][_0x10ec('0x12')]){logger[_0x10ec('0x1f')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ab78f['uniqueid'],this['channels'][_0x1ab78f[_0x10ec('0x21')]][_0x151813][_0x10ec('0x22')],_0x151813);this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813][_0x10ec('0x43')]=!![];this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813]['agentringnoanswerAt']=moment()[_0x10ec('0x26')](_0x10ec('0x27'));this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813][_0x10ec('0x3a')]=_0x10ec('0x52');this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813]['reason']=_0x10ec('0x52');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x1ab78f[_0x10ec('0x21')],util['inspect'](this[_0x10ec('0x8')][_0x1ab78f[_0x10ec('0x21')]][_0x151813],{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')](_0x10ec('0x53'),this[_0x10ec('0x8')][_0x1ab78f['uniqueid']][_0x151813]);}}}}}catch(_0x5c51b0){logger[_0x10ec('0x33')]('[%s][voiceAgentReport][queuecallerabandon]',_0x1ab78f[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x5c51b0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10ec('0x1a')]['syncAgentComplete']=function(_0xb61f42){try{if(this[_0x10ec('0x1e')](_0xb61f42)){logger[_0x10ec('0x23')](_0x10ec('0x54'),_0xb61f42[_0x10ec('0x21')],util['inspect'](_0xb61f42,{'showHidden':![],'depth':null}));if(this[_0x10ec('0x8')][_0xb61f42['uniqueid']]){for(var _0x26c6d8 in this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]]){if(this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]]['hasOwnProperty'](_0x26c6d8)){if(this['channels'][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x55')]&&!this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x12')]){logger[_0x10ec('0x1f')](_0x10ec('0x56'),_0xb61f42[_0x10ec('0x21')],this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x22')],_0x26c6d8);this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x12')]=!![];this['channels'][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x57')]=moment()['format'](_0x10ec('0x27'));this['channels'][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8]['lastevent']='complete';this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x4c')]=_0xb61f42[_0x10ec('0x4c')]==_0x10ec('0x58')?_0x10ec('0x59'):_0xb61f42[_0x10ec('0x4c')];this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x5a')]=_0xb61f42[_0x10ec('0x5a')];if(this[_0x10ec('0x9')][_0xb61f42[_0x10ec('0x28')]]&&this[_0x10ec('0x9')][_0xb61f42[_0x10ec('0x28')]][_0x10ec('0x5b')]){this['channels'][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x5c')]=this[_0x10ec('0x9')][_0xb61f42[_0x10ec('0x28')]][_0x10ec('0x5d')];this['channels'][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8][_0x10ec('0x5e')]=!![];}this[_0x10ec('0xa')][_0xb61f42['interface']]=_[_0x10ec('0x2d')](this[_0x10ec('0xa')][_0xb61f42['interface']],[_0x10ec('0x28'),_0x10ec('0x3e')]);logger['debug'](_0x10ec('0x5f'),_0xb61f42[_0x10ec('0x21')],util[_0x10ec('0x25')](this[_0x10ec('0x8')][_0xb61f42['uniqueid']][_0x26c6d8],{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')](_0x10ec('0x60'),this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8]);logger['debug'](_0x10ec('0x61'),_0xb61f42['uniqueid'],util[_0x10ec('0x25')](this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8],{'showHidden':![],'depth':null}));this[_0x10ec('0x1b')](util[_0x10ec('0x26')](_0x10ec('0x31'),_0xb61f42[_0x10ec('0x22')]),_0x10ec('0x62'),this[_0x10ec('0x8')][_0xb61f42[_0x10ec('0x21')]][_0x26c6d8]);}}}}}}catch(_0x496576){logger[_0x10ec('0x33')](_0x10ec('0x63'),_0xb61f42[_0x10ec('0x21')],util['inspect'](_0x496576,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0x64')]=function(_0x3d11cc){try{if(this[_0x10ec('0x1e')](_0x3d11cc)){logger['debug'](_0x10ec('0x65'),_0x3d11cc[_0x10ec('0x21')],util['inspect'](_0x3d11cc,{'showHidden':![],'depth':null}));this[_0x10ec('0x66')](_0x3d11cc[_0x10ec('0x21')],_[_0x10ec('0x67')](_0x3d11cc[_0x10ec('0x68')])[0x0],_0x3d11cc[_0x10ec('0x69')]);if(this[_0x10ec('0x8')][_0x3d11cc[_0x10ec('0x21')]]){for(var _0x2ddb94 in this[_0x10ec('0x8')][_0x3d11cc['uniqueid']]){if(this[_0x10ec('0x8')][_0x3d11cc[_0x10ec('0x21')]]['hasOwnProperty'](_0x2ddb94)){logger[_0x10ec('0x1f')](_0x10ec('0x6a'),_0x3d11cc[_0x10ec('0x21')],_0x2ddb94,_[_0x10ec('0x67')](_0x3d11cc[_0x10ec('0x68')])[0x0],_0x3d11cc['value']);if(_[_0x10ec('0x1c')](this[_0x10ec('0x8')][_0x3d11cc[_0x10ec('0x21')]][_0x2ddb94][_0x10ec('0xb')])){this[_0x10ec('0x8')][_0x3d11cc['uniqueid']][_0x2ddb94]['variables']={};}this['channels'][_0x3d11cc['uniqueid']][_0x2ddb94][_0x10ec('0xb')]=this[_0x10ec('0xb')][_0x3d11cc[_0x10ec('0x21')]];}}}}}catch(_0x2ea0c0){logger[_0x10ec('0x33')]('[%s][voiceAgentReport][varset]',_0x3d11cc[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x2ea0c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0x66')]=function(_0x1da288,_0x344386,_0x2fc290){var _0x14c255=['rtpaudioqos',_0x10ec('0x6b'),_0x10ec('0x6c'),_0x10ec('0x6d'),'rtpaudioqosloss',_0x10ec('0x6e'),_0x10ec('0x6f'),_0x10ec('0x70'),'sipcallid',_0x10ec('0x71'),'bridgepeer',_0x10ec('0x72'),'membercalls','memberdynamic',_0x10ec('0x73'),_0x10ec('0x74'),_0x10ec('0x22'),_0x10ec('0x75'),_0x10ec('0x76')];if(!_[_0x10ec('0x77')](_0x344386)&&!_[_0x10ec('0x78')](_0x14c255,_0x344386)){if(_[_0x10ec('0x1c')](this[_0x10ec('0xb')][_0x1da288])){this[_0x10ec('0xb')][_0x1da288]={};}this['variables'][_0x1da288][_0x344386]=_0x2fc290;}};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0x14')]=function(_0x2e7666){try{if(this[_0x10ec('0x1e')](_0x2e7666)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x2e7666['uniqueid'],util[_0x10ec('0x25')](_0x2e7666,{'showHidden':![],'depth':null}));if(this[_0x10ec('0x8')][_0x2e7666['uniqueid']]){for(var _0x33e076 in this[_0x10ec('0x8')][_0x2e7666[_0x10ec('0x21')]]){if(this['channels'][_0x2e7666[_0x10ec('0x21')]][_0x10ec('0x51')](_0x33e076)){if(this[_0x10ec('0x8')][_0x2e7666['uniqueid']][_0x33e076]['reason']=='transfer'&&this[_0x10ec('0x8')][_0x2e7666[_0x10ec('0x21')]][_0x33e076][_0x10ec('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x2e7666['uniqueid'],_0x33e076);this[_0x10ec('0x8')][_0x2e7666[_0x10ec('0x21')]][_0x33e076][_0x10ec('0x57')]=moment()['format'](_0x10ec('0x27'));}}}logger[_0x10ec('0x23')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2e7666[_0x10ec('0x21')],util[_0x10ec('0x25')](_['values'](this[_0x10ec('0x8')][_0x2e7666[_0x10ec('0x21')]]),{'showHidden':![],'depth':null}));ami[_0x10ec('0x1b')](_0x10ec('0x79'),_[_0x10ec('0x7a')](this[_0x10ec('0x8')][_0x2e7666[_0x10ec('0x21')]]));delete this[_0x10ec('0x8')][_0x2e7666[_0x10ec('0x21')]];}if(this['variables'][_0x2e7666['uniqueid']]){delete this[_0x10ec('0xb')][_0x2e7666['uniqueid']];}}}catch(_0x1e46dd){logger[_0x10ec('0x33')](_0x10ec('0x7b'),_0x2e7666['uniqueid'],util[_0x10ec('0x25')](_0x1e46dd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10ec('0x18')]=function(_0x3e714b){try{if(this[_0x10ec('0x1e')](_0x3e714b)){logger[_0x10ec('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x3e714b[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x3e714b,{'showHidden':![],'depth':null}));if(this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]]){for(var _0xe69769 in this['channels'][_0x3e714b['transfereeuniqueid']]){if(this['channels'][_0x3e714b[_0x10ec('0x7c')]][_0x10ec('0x51')](_0xe69769)){if(_0x3e714b[_0x10ec('0x7d')]===_0xe69769){logger[_0x10ec('0x1f')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3e714b[_0x10ec('0x21')],this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769]['membername'],_0xe69769);var _0x2a3869=moment();this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769][_0x10ec('0x12')]=!![];this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769][_0x10ec('0x57')]=moment()[_0x10ec('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769][_0x10ec('0x3a')]=_0x10ec('0x7e');this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769]['reason']=_0x10ec('0x58');this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769][_0x10ec('0x5a')]=_0x2a3869[_0x10ec('0x7f')](this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x7c')]][_0xe69769][_0x10ec('0x55')],'seconds');}}}}if(this['channels'][_0x3e714b[_0x10ec('0x80')]]){var _0x50ac9b=this[_0x10ec('0x8')][_0x3e714b['secondtransfereruniqueid']];this[_0x10ec('0x8')][_0x3e714b[_0x10ec('0x80')]]=this[_0x10ec('0x8')][_0x3e714b['transfereeuniqueid']];this['channels'][_0x3e714b[_0x10ec('0x7c')]]=_0x50ac9b;}}}catch(_0x5e6184){logger[_0x10ec('0x33')](_0x10ec('0x81'),_0x3e714b[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x5e6184,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0x19')]=function(_0x2efcdb){try{if(this['isNotNull'](_0x2efcdb)){logger[_0x10ec('0x23')](_0x10ec('0x82'),_0x2efcdb[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x2efcdb,{'showHidden':![],'depth':null}));if(this[_0x10ec('0x8')][_0x2efcdb[_0x10ec('0x7c')]]){for(var _0xa3c10d in this[_0x10ec('0x8')][_0x2efcdb[_0x10ec('0x7c')]]){if(this[_0x10ec('0x8')][_0x2efcdb[_0x10ec('0x7c')]][_0x10ec('0x51')](_0xa3c10d)){if(_0x2efcdb['transfereruniqueid']===_0xa3c10d){logger['info'](_0x10ec('0x83'),_0x2efcdb['uniqueid'],this[_0x10ec('0x8')][_0x2efcdb['transfereeuniqueid']][_0xa3c10d]['membername'],_0xa3c10d);var _0x35f47b=moment();this['channels'][_0x2efcdb[_0x10ec('0x7c')]][_0xa3c10d][_0x10ec('0x12')]=!![];this['channels'][_0x2efcdb[_0x10ec('0x7c')]][_0xa3c10d][_0x10ec('0x57')]=_0x35f47b;this[_0x10ec('0x8')][_0x2efcdb[_0x10ec('0x7c')]][_0xa3c10d][_0x10ec('0x3a')]='complete';this[_0x10ec('0x8')][_0x2efcdb[_0x10ec('0x7c')]][_0xa3c10d][_0x10ec('0x4c')]='transfer';this[_0x10ec('0x8')][_0x2efcdb[_0x10ec('0x7c')]][_0xa3c10d][_0x10ec('0x5a')]=_0x35f47b['diff'](this[_0x10ec('0x8')][_0x2efcdb['transfereeuniqueid']][_0xa3c10d]['agentconnectAt'],_0x10ec('0x84'));}}}}}}catch(_0x1ec415){logger[_0x10ec('0x33')]('[%s][voiceAgentReport][blindtransfer]',_0x2efcdb[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x1ec415,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10ec('0x85')]=function(_0xb794b4){var _0x33532e='';try{if(this[_0x10ec('0x1e')](_0xb794b4)){logger[_0x10ec('0x23')](_0x10ec('0x86'),_0xb794b4['uniqueid'],util[_0x10ec('0x25')](_0xb794b4,{'showHidden':![],'depth':null}));if(_0xb794b4[_0x10ec('0x87')]){_0x33532e=_0xb794b4[_0x10ec('0x87')][_0x10ec('0x88')](0x0,_0xb794b4[_0x10ec('0x87')][_0x10ec('0x89')]('-'));if(this[_0x10ec('0xa')][_0x33532e]){logger[_0x10ec('0x1f')](_0x10ec('0x8a'),_0xb794b4[_0x10ec('0x21')],_0x33532e);this[_0x10ec('0xa')][_0x33532e]['onhold']=!![];}}}}catch(_0x564b64){logger[_0x10ec('0x33')](_0x10ec('0x8b'),_0xb794b4[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x564b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10ec('0x1a')][_0x10ec('0x16')]=function(_0x4ee8c1){var _0x4e7be1='';try{if(this[_0x10ec('0x1e')](_0x4ee8c1)){logger[_0x10ec('0x23')](_0x10ec('0x8c'),_0x4ee8c1['uniqueid'],util['inspect'](_0x4ee8c1,{'showHidden':![],'depth':null}));if(_0x4ee8c1[_0x10ec('0x87')]){_0x4e7be1=_0x4ee8c1[_0x10ec('0x87')][_0x10ec('0x88')](0x0,_0x4ee8c1['channel'][_0x10ec('0x89')]('-'));if(this[_0x10ec('0xa')][_0x4e7be1]){logger[_0x10ec('0x1f')](_0x10ec('0x8d'),_0x4ee8c1[_0x10ec('0x21')],_0x4e7be1);this[_0x10ec('0xa')][_0x4e7be1][_0x10ec('0x8e')]=![];}}}}catch(_0x1b675e){logger[_0x10ec('0x33')](_0x10ec('0x8f'),_0x4ee8c1[_0x10ec('0x21')],util[_0x10ec('0x25')](_0x1b675e,{'showHidden':![],'depth':null}));}};module[_0x10ec('0x90')]=VoiceAgentReport; \ No newline at end of file +var _0x4c70=['[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agentconnectAt','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agent','talktime','acw','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]'];(function(_0x51dd2c,_0x2a2345){var _0x41c678=function(_0xa14c31){while(--_0xa14c31){_0x51dd2c['push'](_0x51dd2c['shift']());}};_0x41c678(++_0x2a2345);}(_0x4c70,0x1d5));var _0x04c7=function(_0x498381,_0x122bfc){_0x498381=_0x498381-0x0;var _0x7e0ae8=_0x4c70[_0x498381];return _0x7e0ae8;};'use strict';var _=require(_0x04c7('0x0'));var moment=require('moment');var util=require(_0x04c7('0x1'));var Redis=require(_0x04c7('0x2'));var config=require(_0x04c7('0x3'));var logger=require(_0x04c7('0x4'))(_0x04c7('0x5'));var ami=require(_0x04c7('0x6'));config[_0x04c7('0x7')]=_[_0x04c7('0x8')](config[_0x04c7('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x4b9cf3){this[_0x04c7('0x9')]={};this[_0x04c7('0xa')]=_0x4b9cf3['voiceQueues'];this[_0x04c7('0xb')]=_0x4b9cf3['agents'];this[_0x04c7('0xc')]={};ami['on'](_0x04c7('0xd'),this[_0x04c7('0xe')][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x10'),this[_0x04c7('0x11')][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x12'),this['syncAgentRingNoAnswer'][_0x04c7('0xf')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x13'),this[_0x04c7('0x14')][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x15'),this[_0x04c7('0x16')]['bind'](this));ami['on']('hangup',this[_0x04c7('0x17')][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x18'),this[_0x04c7('0x19')][_0x04c7('0xf')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x1a'),this[_0x04c7('0x1b')][_0x04c7('0xf')](this));ami['on'](_0x04c7('0x1c'),this[_0x04c7('0x1d')][_0x04c7('0xf')](this));}VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0x1f')]=function(_0x4f3fa2,_0x1d87e9,_0x48f037){io['to'](_0x4f3fa2)['emit'](_0x1d87e9,_0x48f037);};VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0x20')]=function(_0x4fdfa6){return _0x4fdfa6!==null&&!_[_0x04c7('0x21')](_0x4fdfa6);};VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0xe')]=function(_0xe2baaf){try{if(this[_0x04c7('0x20')](_0xe2baaf)){logger[_0x04c7('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xe2baaf[_0x04c7('0x23')],_0xe2baaf[_0x04c7('0x24')],_0xe2baaf[_0x04c7('0x25')]);logger['debug'](_0x04c7('0x26'),_0xe2baaf[_0x04c7('0x23')],util[_0x04c7('0x27')](_0xe2baaf,{'showHidden':![],'depth':null}));if(_[_0x04c7('0x21')](this[_0x04c7('0x9')][_0xe2baaf[_0x04c7('0x23')]])){this[_0x04c7('0x9')][_0xe2baaf[_0x04c7('0x23')]]={};}if(_['isUndefined'](this[_0x04c7('0x9')][_0xe2baaf[_0x04c7('0x23')]][_0xe2baaf[_0x04c7('0x25')]])){this[_0x04c7('0x9')][_0xe2baaf['uniqueid']][_0xe2baaf[_0x04c7('0x25')]]={'agentcalledAt':moment()[_0x04c7('0x28')](_0x04c7('0x29')),'lastevent':_0x04c7('0x2a'),'mandatoryDisposition':this['voiceQueues'][_0xe2baaf[_0x04c7('0x2b')]]?this['voiceQueues'][_0xe2baaf[_0x04c7('0x2b')]]['mandatoryDisposition']||![]:![],'type':this[_0x04c7('0xa')][_0xe2baaf[_0x04c7('0x2b')]]?this[_0x04c7('0xa')][_0xe2baaf[_0x04c7('0x2b')]][_0x04c7('0x2c')]||_0x04c7('0x2d'):'inbound','variables':this[_0x04c7('0xc')][_0xe2baaf[_0x04c7('0x23')]]};}_['merge'](this['channels'][_0xe2baaf[_0x04c7('0x23')]][_0xe2baaf[_0x04c7('0x25')]],_[_0x04c7('0x2e')](_0xe2baaf,['event',_0x04c7('0x2f')]));logger['debug'](_0x04c7('0x30'),_0xe2baaf[_0x04c7('0x23')],util[_0x04c7('0x27')](this[_0x04c7('0x9')][_0xe2baaf[_0x04c7('0x23')]][_0xe2baaf[_0x04c7('0x25')]],{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')](_0x04c7('0x31'),this[_0x04c7('0x9')][_0xe2baaf[_0x04c7('0x23')]][_0xe2baaf[_0x04c7('0x25')]]);logger[_0x04c7('0x32')](_0x04c7('0x33'),_0xe2baaf[_0x04c7('0x23')],util[_0x04c7('0x27')](this[_0x04c7('0x9')][_0xe2baaf[_0x04c7('0x23')]][_0xe2baaf[_0x04c7('0x25')]],{'showHidden':![],'depth':null}));this[_0x04c7('0x1f')](util[_0x04c7('0x28')](_0x04c7('0x34'),_0xe2baaf[_0x04c7('0x24')]),_0x04c7('0x35'),this['channels'][_0xe2baaf[_0x04c7('0x23')]][_0xe2baaf['destuniqueid']]);}}catch(_0x437b8a){logger[_0x04c7('0x36')]('[%s][voiceAgentReport][agentcalled]',_0xe2baaf[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x437b8a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0x11')]=function(_0x5067f0){try{if(this[_0x04c7('0x20')](_0x5067f0)){if(this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]]){logger[_0x04c7('0x32')](_0x04c7('0x37'),_0x5067f0[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x5067f0,{'showHidden':![],'depth':null}));for(var _0x5a20b3 in this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]]){if(this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x04c7('0x38')](_0x5a20b3)){if(_0x5067f0[_0x04c7('0x25')]===_0x5a20b3){logger[_0x04c7('0x22')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5067f0['uniqueid'],_0x5067f0['membername'],_0x5067f0[_0x04c7('0x25')]);this['channels'][_0x5067f0['uniqueid']][_0x5a20b3]['agentconnectAt']=moment()[_0x04c7('0x28')](_0x04c7('0x29'));this['channels'][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3]['connectedlinename']=_0x5067f0[_0x04c7('0x39')];this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5a20b3]['connectedlinenum']=_0x5067f0[_0x04c7('0x3a')];this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x3b')]=_0x5067f0[_0x04c7('0x3b')];this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5a20b3][_0x04c7('0x3c')]=_0x5067f0['destchannelstatedesc'];this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5a20b3][_0x04c7('0x3d')]=_0x5067f0[_0x04c7('0x3d')];this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x3e')]=_0x04c7('0x3f');_['merge'](this[_0x04c7('0xb')][_0x5067f0[_0x04c7('0x40')]],_['pick'](_0x5067f0,['queue',_0x04c7('0x41')]));logger[_0x04c7('0x32')](_0x04c7('0x42'),_0x5067f0['uniqueid'],util[_0x04c7('0x27')](this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5067f0[_0x04c7('0x25')]],{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')]('custom:agentconnect',this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5067f0[_0x04c7('0x25')]]);logger[_0x04c7('0x32')](_0x04c7('0x43'),_0x5067f0[_0x04c7('0x23')],util['inspect'](this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5067f0[_0x04c7('0x25')]],{'showHidden':![],'depth':null}));this[_0x04c7('0x1f')](util[_0x04c7('0x28')]('user:%s',_0x5067f0[_0x04c7('0x24')]),_0x04c7('0x44'),this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5067f0[_0x04c7('0x25')]]);}else if(!this['channels'][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x12')]&&!this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x13')]){logger['info'](_0x04c7('0x45'),_0x5067f0[_0x04c7('0x23')],this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x24')],_0x5a20b3);this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5a20b3][_0x04c7('0x12')]=!![];this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x46')]=moment()[_0x04c7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3]['answeredelsewheredestinationuniqueid']=_0x5067f0[_0x04c7('0x25')];this[_0x04c7('0x9')][_0x5067f0['uniqueid']][_0x5a20b3][_0x04c7('0x47')]=_0x5067f0[_0x04c7('0x24')];this['channels'][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3][_0x04c7('0x3e')]=_0x04c7('0x48');this['channels'][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3]['reason']=_0x04c7('0x48');logger[_0x04c7('0x32')](_0x04c7('0x49'),_0x5067f0[_0x04c7('0x23')],util[_0x04c7('0x27')](this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3],{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')](_0x04c7('0x4a'),this[_0x04c7('0x9')][_0x5067f0[_0x04c7('0x23')]][_0x5a20b3]);}}}}}}catch(_0x413b0f){logger[_0x04c7('0x36')](_0x04c7('0x4b'),_0x5067f0[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x413b0f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0x4c')]=function(_0x4aca6d){try{if(this['isNotNull'](_0x4aca6d)){logger[_0x04c7('0x32')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x4aca6d[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x4aca6d,{'showHidden':![],'depth':null}));if(this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]]&&this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d[_0x04c7('0x25')]]){logger[_0x04c7('0x22')](_0x04c7('0x4d'),_0x4aca6d[_0x04c7('0x23')],_0x4aca6d[_0x04c7('0x24')],_0x4aca6d[_0x04c7('0x25')]);this['channels'][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d[_0x04c7('0x25')]]['agentringnoanswer']=!![];this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d[_0x04c7('0x25')]][_0x04c7('0x46')]=moment()[_0x04c7('0x28')](_0x04c7('0x29'));this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d[_0x04c7('0x25')]]['lastevent']='rejected';this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d[_0x04c7('0x25')]][_0x04c7('0x4e')]=_0x04c7('0x4f');logger[_0x04c7('0x32')](_0x04c7('0x50'),_0x4aca6d[_0x04c7('0x23')],util['inspect'](this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')](_0x04c7('0x51'),this[_0x04c7('0x9')][_0x4aca6d[_0x04c7('0x23')]][_0x4aca6d['destuniqueid']]);}}}catch(_0x2101fa){logger[_0x04c7('0x36')](_0x04c7('0x52'),_0x4aca6d[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x2101fa,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x04c7('0x53')]=function(_0x587865){try{if(this['isNotNull'](_0x587865)){logger[_0x04c7('0x32')](_0x04c7('0x54'),_0x587865[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x587865,{'showHidden':![],'depth':null}));if(this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]]){for(var _0x2c3cfd in this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]]){if(this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x04c7('0x38')](_0x2c3cfd)&&!this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd][_0x04c7('0x12')]&&!this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd][_0x04c7('0x13')]){logger[_0x04c7('0x22')](_0x04c7('0x55'),_0x587865[_0x04c7('0x23')],this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd][_0x04c7('0x24')],_0x2c3cfd);this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd]['agentringnoanswer']=!![];this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd][_0x04c7('0x46')]=moment()[_0x04c7('0x28')](_0x04c7('0x29'));this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd][_0x04c7('0x3e')]='abandoned';this[_0x04c7('0x9')][_0x587865['uniqueid']][_0x2c3cfd][_0x04c7('0x4e')]=_0x04c7('0x56');logger['debug'](_0x04c7('0x57'),_0x587865['uniqueid'],util[_0x04c7('0x27')](this['channels'][_0x587865[_0x04c7('0x23')]][_0x2c3cfd],{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')](_0x04c7('0x58'),this[_0x04c7('0x9')][_0x587865[_0x04c7('0x23')]][_0x2c3cfd]);}}}}}catch(_0xa6074f){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x587865[_0x04c7('0x23')],util[_0x04c7('0x27')](_0xa6074f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04c7('0x1e')]['syncAgentComplete']=function(_0x3e4a8e){try{if(this['isNotNull'](_0x3e4a8e)){logger[_0x04c7('0x32')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x3e4a8e[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x3e4a8e,{'showHidden':![],'depth':null}));if(this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]]){for(var _0x1ae430 in this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]]){if(this['channels'][_0x3e4a8e[_0x04c7('0x23')]][_0x04c7('0x38')](_0x1ae430)){if(this['channels'][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]['agentconnectAt']&&!this['channels'][_0x3e4a8e['uniqueid']][_0x1ae430]['agentcomplete']){logger['info'](_0x04c7('0x59'),_0x3e4a8e[_0x04c7('0x23')],this['channels'][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]['membername'],_0x1ae430);this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430][_0x04c7('0x13')]=!![];this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]['agentcompleteAt']=moment()[_0x04c7('0x28')](_0x04c7('0x29'));this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430][_0x04c7('0x3e')]='complete';this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430][_0x04c7('0x4e')]=_0x3e4a8e[_0x04c7('0x4e')]=='transfer'?_0x04c7('0x5a'):_0x3e4a8e[_0x04c7('0x4e')];this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]['talktime']=_0x3e4a8e[_0x04c7('0x5b')];if(this[_0x04c7('0xa')][_0x3e4a8e['queue']]&&this[_0x04c7('0xa')][_0x3e4a8e['queue']][_0x04c7('0x5c')]){this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]['acwtime']=this[_0x04c7('0xa')][_0x3e4a8e['queue']][_0x04c7('0x5d')];this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430][_0x04c7('0x5e')]=!![];}this[_0x04c7('0xb')][_0x3e4a8e[_0x04c7('0x40')]]=_[_0x04c7('0x2e')](this[_0x04c7('0xb')][_0x3e4a8e[_0x04c7('0x40')]],[_0x04c7('0x2b'),_0x04c7('0x41')]);logger[_0x04c7('0x32')](_0x04c7('0x5f'),_0x3e4a8e['uniqueid'],util[_0x04c7('0x27')](this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430],{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')](_0x04c7('0x60'),this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]);logger[_0x04c7('0x32')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3e4a8e['uniqueid'],util[_0x04c7('0x27')](this[_0x04c7('0x9')][_0x3e4a8e['uniqueid']][_0x1ae430],{'showHidden':![],'depth':null}));this[_0x04c7('0x1f')](util[_0x04c7('0x28')](_0x04c7('0x34'),_0x3e4a8e[_0x04c7('0x24')]),_0x04c7('0x61'),this[_0x04c7('0x9')][_0x3e4a8e[_0x04c7('0x23')]][_0x1ae430]);}}}}}}catch(_0x4c5b52){logger['error'](_0x04c7('0x62'),_0x3e4a8e[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x4c5b52,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x1f5414){try{if(this[_0x04c7('0x20')](_0x1f5414)){logger[_0x04c7('0x32')]('[%s][voiceAgentReport][varset]\x20event:',_0x1f5414[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x1f5414,{'showHidden':![],'depth':null}));this['addVariable'](_0x1f5414[_0x04c7('0x23')],_[_0x04c7('0x63')](_0x1f5414[_0x04c7('0x64')])[0x0],_0x1f5414[_0x04c7('0x65')]);if(this['channels'][_0x1f5414[_0x04c7('0x23')]]){for(var _0x2d11fd in this[_0x04c7('0x9')][_0x1f5414[_0x04c7('0x23')]]){if(this['channels'][_0x1f5414[_0x04c7('0x23')]][_0x04c7('0x38')](_0x2d11fd)){logger[_0x04c7('0x22')](_0x04c7('0x66'),_0x1f5414[_0x04c7('0x23')],_0x2d11fd,_[_0x04c7('0x63')](_0x1f5414[_0x04c7('0x64')])[0x0],_0x1f5414['value']);if(_['isUndefined'](this[_0x04c7('0x9')][_0x1f5414['uniqueid']][_0x2d11fd][_0x04c7('0xc')])){this[_0x04c7('0x9')][_0x1f5414[_0x04c7('0x23')]][_0x2d11fd][_0x04c7('0xc')]={};}this[_0x04c7('0x9')][_0x1f5414[_0x04c7('0x23')]][_0x2d11fd][_0x04c7('0xc')]=this['variables'][_0x1f5414[_0x04c7('0x23')]];}}}}}catch(_0x2fd6af){logger[_0x04c7('0x36')](_0x04c7('0x67'),_0x1f5414[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x2fd6af,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x04c7('0x68')]=function(_0x593d9a,_0x37d662,_0xd0d95d){var _0x4db836=[_0x04c7('0x69'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x04c7('0x6a'),_0x04c7('0x6b'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x04c7('0x6c'),_0x04c7('0x6d'),'sipuri',_0x04c7('0x6e'),_0x04c7('0x6f'),_0x04c7('0x70'),'memberdynamic','memberinterface',_0x04c7('0x71'),'membername',_0x04c7('0x72'),_0x04c7('0x73')];if(!_[_0x04c7('0x74')](_0x37d662)&&!_['includes'](_0x4db836,_0x37d662)){if(_[_0x04c7('0x21')](this[_0x04c7('0xc')][_0x593d9a])){this[_0x04c7('0xc')][_0x593d9a]={};}this[_0x04c7('0xc')][_0x593d9a][_0x37d662]=_0xd0d95d;}};VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0x17')]=function(_0x1aa012){try{if(this[_0x04c7('0x20')](_0x1aa012)){logger[_0x04c7('0x32')](_0x04c7('0x75'),_0x1aa012['uniqueid'],util[_0x04c7('0x27')](_0x1aa012,{'showHidden':![],'depth':null}));if(this[_0x04c7('0x9')][_0x1aa012[_0x04c7('0x23')]]){for(var _0x4cbc80 in this[_0x04c7('0x9')][_0x1aa012[_0x04c7('0x23')]]){if(this[_0x04c7('0x9')][_0x1aa012[_0x04c7('0x23')]][_0x04c7('0x38')](_0x4cbc80)){if(this[_0x04c7('0x9')][_0x1aa012[_0x04c7('0x23')]][_0x4cbc80]['reason']==_0x04c7('0x76')&&this['channels'][_0x1aa012[_0x04c7('0x23')]][_0x4cbc80][_0x04c7('0x13')]){logger[_0x04c7('0x22')](_0x04c7('0x77'),_0x1aa012[_0x04c7('0x23')],_0x4cbc80);this[_0x04c7('0x9')][_0x1aa012['uniqueid']][_0x4cbc80]['agentcompleteAt']=moment()[_0x04c7('0x28')](_0x04c7('0x29'));}}}logger[_0x04c7('0x32')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x1aa012['uniqueid'],util[_0x04c7('0x27')](_['values'](this['channels'][_0x1aa012['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x04c7('0x1f')](_0x04c7('0x78'),_[_0x04c7('0x79')](this['channels'][_0x1aa012[_0x04c7('0x23')]]));delete this['channels'][_0x1aa012[_0x04c7('0x23')]];}if(this[_0x04c7('0xc')][_0x1aa012['uniqueid']]){delete this[_0x04c7('0xc')][_0x1aa012[_0x04c7('0x23')]];}}}catch(_0x5f5bc6){logger['error'](_0x04c7('0x7a'),_0x1aa012[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x5f5bc6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04c7('0x1e')]['syncAttendedTransfer']=function(_0x5c1c4e){try{if(this[_0x04c7('0x20')](_0x5c1c4e)){logger[_0x04c7('0x32')](_0x04c7('0x7b'),_0x5c1c4e[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x5c1c4e,{'showHidden':![],'depth':null}));if(this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x7c')]]){for(var _0x5bf5fa in this['channels'][_0x5c1c4e['transfereeuniqueid']]){if(this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x7c')]]['hasOwnProperty'](_0x5bf5fa)){if(_0x5c1c4e[_0x04c7('0x7d')]===_0x5bf5fa){logger[_0x04c7('0x22')](_0x04c7('0x7e'),_0x5c1c4e['uniqueid'],this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa][_0x04c7('0x24')],_0x5bf5fa);var _0x370185=moment();this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa][_0x04c7('0x13')]=!![];this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa][_0x04c7('0x7f')]=moment()[_0x04c7('0x28')](_0x04c7('0x29'));this['channels'][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa][_0x04c7('0x3e')]=_0x04c7('0x80');this['channels'][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa]['reason']=_0x04c7('0x76');this['channels'][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa][_0x04c7('0x5b')]=_0x370185['diff'](this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x7c')]][_0x5bf5fa][_0x04c7('0x81')],_0x04c7('0x82'));}}}}if(this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x83')]]){var _0x507d33=this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x83')]];this[_0x04c7('0x9')][_0x5c1c4e[_0x04c7('0x83')]]=this['channels'][_0x5c1c4e['transfereeuniqueid']];this['channels'][_0x5c1c4e[_0x04c7('0x7c')]]=_0x507d33;}}}catch(_0x197b3d){logger['error'](_0x04c7('0x84'),_0x5c1c4e[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x197b3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x04c7('0x1d')]=function(_0x27a702){try{if(this[_0x04c7('0x20')](_0x27a702)){logger[_0x04c7('0x32')](_0x04c7('0x85'),_0x27a702['uniqueid'],util[_0x04c7('0x27')](_0x27a702,{'showHidden':![],'depth':null}));if(this['channels'][_0x27a702[_0x04c7('0x7c')]]){for(var _0x27ffdc in this[_0x04c7('0x9')][_0x27a702[_0x04c7('0x7c')]]){if(this[_0x04c7('0x9')][_0x27a702['transfereeuniqueid']][_0x04c7('0x38')](_0x27ffdc)){if(_0x27a702[_0x04c7('0x86')]===_0x27ffdc){logger[_0x04c7('0x22')](_0x04c7('0x87'),_0x27a702['uniqueid'],this[_0x04c7('0x9')][_0x27a702['transfereeuniqueid']][_0x27ffdc][_0x04c7('0x24')],_0x27ffdc);var _0x1511f9=moment();this[_0x04c7('0x9')][_0x27a702['transfereeuniqueid']][_0x27ffdc][_0x04c7('0x13')]=!![];this[_0x04c7('0x9')][_0x27a702['transfereeuniqueid']][_0x27ffdc][_0x04c7('0x7f')]=_0x1511f9;this[_0x04c7('0x9')][_0x27a702[_0x04c7('0x7c')]][_0x27ffdc][_0x04c7('0x3e')]=_0x04c7('0x80');this[_0x04c7('0x9')][_0x27a702[_0x04c7('0x7c')]][_0x27ffdc]['reason']=_0x04c7('0x76');this[_0x04c7('0x9')][_0x27a702['transfereeuniqueid']][_0x27ffdc][_0x04c7('0x5b')]=_0x1511f9['diff'](this[_0x04c7('0x9')][_0x27a702['transfereeuniqueid']][_0x27ffdc]['agentconnectAt'],_0x04c7('0x82'));}}}}}}catch(_0x21dc0e){logger['error'](_0x04c7('0x88'),_0x27a702[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x21dc0e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x04c7('0x19')]=function(_0xf04981){var _0x4bfddc='';try{if(this[_0x04c7('0x20')](_0xf04981)){logger[_0x04c7('0x32')](_0x04c7('0x89'),_0xf04981[_0x04c7('0x23')],util[_0x04c7('0x27')](_0xf04981,{'showHidden':![],'depth':null}));if(_0xf04981[_0x04c7('0x8a')]){_0x4bfddc=_0xf04981[_0x04c7('0x8a')][_0x04c7('0x8b')](0x0,_0xf04981[_0x04c7('0x8a')][_0x04c7('0x8c')]('-'));if(this[_0x04c7('0xb')][_0x4bfddc]){logger[_0x04c7('0x22')](_0x04c7('0x8d'),_0xf04981['uniqueid'],_0x4bfddc);this[_0x04c7('0xb')][_0x4bfddc][_0x04c7('0x8e')]=!![];}}}}catch(_0x47e34e){logger[_0x04c7('0x36')](_0x04c7('0x8f'),_0xf04981[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x47e34e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04c7('0x1e')][_0x04c7('0x90')]=function(_0x10a27d){var _0x25491b='';try{if(this[_0x04c7('0x20')](_0x10a27d)){logger['debug'](_0x04c7('0x91'),_0x10a27d[_0x04c7('0x23')],util[_0x04c7('0x27')](_0x10a27d,{'showHidden':![],'depth':null}));if(_0x10a27d['channel']){_0x25491b=_0x10a27d[_0x04c7('0x8a')]['substring'](0x0,_0x10a27d[_0x04c7('0x8a')][_0x04c7('0x8c')]('-'));if(this[_0x04c7('0xb')][_0x25491b]){logger[_0x04c7('0x22')](_0x04c7('0x92'),_0x10a27d[_0x04c7('0x23')],_0x25491b);this[_0x04c7('0xb')][_0x25491b]['onhold']=![];}}}}catch(_0x534467){logger[_0x04c7('0x36')](_0x04c7('0x93'),_0x10a27d['uniqueid'],util['inspect'](_0x534467,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ab2cea2..7c9fa68 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a68=['user:%s','BlindTransfer','blindTransfers','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','path','ioredis','../../../config/environment','../../../config/logger','../ami','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newstate','syncNewState','varset','syncVarSet','hangup','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','[%s][voiceCallReport][newcallerid]','syncNewChannel','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','disposition','toNumber','channelstate','from-sip','split','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','linkedid','OutgoingSpoolFailed','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','connectedlinename','destinationchannel','UserId','membername','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','holdtime'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x8a68,0xd6));var _0x88a6=function(_0x3fabf7,_0x5cc54d){_0x3fabf7=_0x3fabf7-0x0;var _0x474adc=_0x8a68[_0x3fabf7];return _0x474adc;};'use strict';var BPromise=require('bluebird');var _=require(_0x88a6('0x0'));var moment=require('moment');var util=require('util');var path=require(_0x88a6('0x1'));var Redis=require(_0x88a6('0x2'));var config=require(_0x88a6('0x3'));var logger=require(_0x88a6('0x4'))('ami');var ami=require(_0x88a6('0x5'));var Channel=require('../model/channel');var statusDesc=[_0x88a6('0x6'),_0x88a6('0x7'),_0x88a6('0x8'),_0x88a6('0x9'),_0x88a6('0xa'),'unavailable',_0x88a6('0xb'),_0x88a6('0xc'),_0x88a6('0xd')];var applications=[_0x88a6('0xe'),_0x88a6('0xf'),_0x88a6('0x10'),_0x88a6('0x11'),_0x88a6('0x12'),_0x88a6('0x13')];var dispositions=['NO\x20ANSWER',_0x88a6('0x14'),_0x88a6('0x14'),_0x88a6('0x15'),_0x88a6('0x15'),'NO\x20ANSWER',_0x88a6('0x16'),'BUSY',_0x88a6('0x14'),_0x88a6('0x14'),_0x88a6('0x14')];var actions={};config[_0x88a6('0x17')]=_[_0x88a6('0x18')](config['redis'],{'host':_0x88a6('0x19'),'port':0x18eb});var io=require(_0x88a6('0x1a'))(new Redis(config[_0x88a6('0x17')]));function VoiceCallReport(_0xa91ee9){this[_0x88a6('0x1b')]=_0xa91ee9[_0x88a6('0x1b')];this[_0x88a6('0x1c')]=_0xa91ee9['agents'];this['blindTransfers']={};ami['on'](_0x88a6('0x1d'),this[_0x88a6('0x1e')][_0x88a6('0x1f')](this));ami['on'](_0x88a6('0x20'),this[_0x88a6('0x1e')]['bind'](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on'](_0x88a6('0x21'),this[_0x88a6('0x22')][_0x88a6('0x1f')](this));ami['on'](_0x88a6('0x23'),this[_0x88a6('0x24')]['bind'](this));ami['on'](_0x88a6('0x25'),this['syncHangup'][_0x88a6('0x1f')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x88a6('0x1f')](this));ami['on'](_0x88a6('0x26'),this[_0x88a6('0x27')]['bind'](this));ami['on'](_0x88a6('0x28'),this['syncBlindTransfer'][_0x88a6('0x1f')](this));ami['on'](_0x88a6('0x29'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x88a6('0x2a'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x88a6('0x2b')](_0x88a6('0x2c'));ami['actionCoreShowChannels']();}catch(_0x1e2914){logger[_0x88a6('0x2d')]('[voiceCallReport][coreshowchannels]',util[_0x88a6('0x2e')](_0x1e2914,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x30')]=function(_0x3ac036){return _0x3ac036!==null&&!_[_0x88a6('0x31')](_0x3ac036);};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x32')]=function(_0x211c78,_0x12a438,_0x391b62){io['to'](_0x211c78)['emit'](_0x12a438,_0x391b62);};VoiceCallReport['prototype'][_0x88a6('0x33')]=function(_0x3570eb){try{if(this[_0x88a6('0x30')](_0x3570eb)){logger[_0x88a6('0x2b')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3570eb[_0x88a6('0x34')],_0x3570eb[_0x88a6('0x35')],_0x3570eb['calleridnum']);logger[_0x88a6('0x36')](_0x88a6('0x37'),_0x3570eb[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x3570eb,{'showHidden':![],'depth':null}));if(_0x3570eb[_0x88a6('0x34')]===_0x3570eb['linkedid']){if(!_[_0x88a6('0x31')](this['channels'][_0x3570eb[_0x88a6('0x34')]])){_[_0x88a6('0x38')](this[_0x88a6('0x1b')][_0x3570eb['uniqueid']],_[_0x88a6('0x39')](_0x3570eb,_[_0x88a6('0x3a')](this['channels'][_0x3570eb[_0x88a6('0x34')]])));}}}}catch(_0x33a817){logger['error'](_0x88a6('0x3b'),_0x3570eb[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x33a817,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x3c')]=function(_0x586a34){try{if(this[_0x88a6('0x30')](_0x586a34)){logger[_0x88a6('0x36')]('[%s][voiceCallReport][newchannel]\x20event:',_0x586a34['uniqueid'],util[_0x88a6('0x2e')](_0x586a34,{'showHidden':![],'depth':null}));if(_0x586a34[_0x88a6('0x34')]===_0x586a34['linkedid']&&_0x586a34[_0x88a6('0x3d')]!='OutgoingSpoolFailed'){if(_[_0x88a6('0x31')](this['channels'][_0x586a34[_0x88a6('0x34')]])){logger['info'](_0x88a6('0x3e'),_0x586a34[_0x88a6('0x34')],_0x586a34[_0x88a6('0x3f')],_0x586a34['exten']);this[_0x88a6('0x1b')][_0x586a34[_0x88a6('0x34')]]=new Channel();this[_0x88a6('0x1b')][_0x586a34[_0x88a6('0x34')]][_0x88a6('0x40')]=moment()[_0x88a6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x88a6('0x1b')][_0x586a34[_0x88a6('0x34')]][_0x88a6('0x42')]=dispositions[_[_0x88a6('0x43')](_0x586a34[_0x88a6('0x44')])];_[_0x88a6('0x38')](this['channels'][_0x586a34['uniqueid']],_[_0x88a6('0x39')](_0x586a34,_[_0x88a6('0x3a')](this[_0x88a6('0x1b')][_0x586a34['uniqueid']])));if(_0x586a34['context']===_0x88a6('0x45')){if(this[_0x88a6('0x1c')][_0x586a34[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]]){this[_0x88a6('0x1c')][_0x586a34[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x586a34[_0x88a6('0x47')];logger[_0x88a6('0x36')](_0x88a6('0x48'),_0x586a34[_0x88a6('0x34')],util[_0x88a6('0x2e')]({'destaccountcode':this[_0x88a6('0x1c')][_0x586a34[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]][_0x88a6('0x49')],'destconnectedlinenum':_0x586a34[_0x88a6('0x47')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',this[_0x88a6('0x1c')][_0x586a34['channel'][_0x88a6('0x46')]('-')[0x0]]['name']),_0x88a6('0x4a'),{'destaccountcode':this[_0x88a6('0x1c')][_0x586a34[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]][_0x88a6('0x49')],'destconnectedlinenum':_0x586a34[_0x88a6('0x47')]});}}}}}}catch(_0x42580a){logger['error']('[%s][voiceCallReport][newchannel]',_0x586a34[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x42580a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x15841a){try{if(this[_0x88a6('0x30')](_0x15841a)){logger[_0x88a6('0x36')](_0x88a6('0x4b'),_0x15841a['uniqueid'],util[_0x88a6('0x2e')](_0x15841a,{'showHidden':![],'depth':null}));if(_0x15841a[_0x88a6('0x34')]===_0x15841a[_0x88a6('0x4c')]&&_0x15841a['exten']!='h'&&_0x15841a['channel']!=_0x88a6('0x4d')){_0x15841a[_0x88a6('0x4e')]=_0x15841a['application'][_0x88a6('0x4f')]();_0x15841a[_0x88a6('0x50')]=(_0x15841a['appdata']||_0x15841a[_0x88a6('0x50')])[_0x88a6('0x4f')]();logger[_0x88a6('0x2b')](_0x88a6('0x51'),_0x15841a[_0x88a6('0x34')],_0x15841a['application'],_0x15841a[_0x88a6('0x50')]);if(_[_0x88a6('0x31')](this[_0x88a6('0x1b')][_0x15841a[_0x88a6('0x34')]])){this['channels'][_0x15841a[_0x88a6('0x34')]]=new Channel();this[_0x88a6('0x1b')][_0x15841a[_0x88a6('0x34')]][_0x88a6('0x40')]=_0x15841a[_0x88a6('0x52')]?moment()[_0x88a6('0x53')](moment['duration'](_0x15841a[_0x88a6('0x52')])[_0x88a6('0x54')](),_0x88a6('0x54'))[_0x88a6('0x41')](_0x88a6('0x55')):moment()[_0x88a6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x88a6('0x1b')][_0x15841a['uniqueid']][_0x88a6('0x42')]=_0x88a6('0x15');}_['merge'](this[_0x88a6('0x1b')][_0x15841a[_0x88a6('0x34')]],_[_0x88a6('0x39')](_0x15841a,_[_0x88a6('0x3a')](this['channels'][_0x15841a['uniqueid']])));if(_[_0x88a6('0x56')](applications,_0x15841a[_0x88a6('0x4e')])){this['channels'][_0x15841a['uniqueid']][_0x88a6('0x57')]=_0x15841a['application'];this[_0x88a6('0x1b')][_0x15841a[_0x88a6('0x34')]][_0x88a6('0x58')]=_0x15841a[_0x88a6('0x50')];if(_0x15841a['application']==='set'&&_[_0x88a6('0x59')](_0x15841a[_0x88a6('0x50')],_0x88a6('0x5a'))){var _0x12064b=_0x15841a[_0x88a6('0x50')][_0x88a6('0x46')]('=');var _0x2ea327=_0x12064b[0x0][_0x88a6('0x5b')](/cdr\((.*)\)/);if(_0x2ea327){this[_0x88a6('0x1b')][_0x15841a[_0x88a6('0x34')]][_0x2ea327[0x1]]=_0x12064b[0x1];}}else if(_0x15841a['application']==='queue'){this[_0x88a6('0x1b')][_0x15841a[_0x88a6('0x34')]][_0x88a6('0xf')]=_0x15841a[_0x88a6('0x50')][_0x88a6('0x46')](',')[0x0];}}}}}catch(_0x78fe93){logger['error'](_0x88a6('0x5c'),_0x15841a[_0x88a6('0x34')],util['inspect'](_0x78fe93,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x22')]=function(_0xacf68){try{if(this['isNotNull'](_0xacf68)){logger['info'](_0x88a6('0x5d'),_0xacf68[_0x88a6('0x34')],_0xacf68['linkedid'],_0xacf68[_0x88a6('0x35')],_0xacf68[_0x88a6('0x5e')]);logger['debug'](_0x88a6('0x5f'),_0xacf68[_0x88a6('0x34')],util['inspect'](_0xacf68,{'showHidden':![],'depth':null}));if(_0xacf68[_0x88a6('0x34')]!==_0xacf68[_0x88a6('0x4c')]){if(this['channels'][_0xacf68[_0x88a6('0x4c')]]){if(_0xacf68[_0x88a6('0x44')]==='6'){if(!this['channels'][_0xacf68[_0x88a6('0x4c')]][_0x88a6('0x60')]){var _0xcef0f4=moment();this[_0x88a6('0x1b')][_0xacf68[_0x88a6('0x4c')]][_0x88a6('0x60')]=!![];this['channels'][_0xacf68[_0x88a6('0x4c')]][_0x88a6('0x61')]=_0xcef0f4[_0x88a6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x88a6('0x1b')][_0xacf68['linkedid']][_0x88a6('0x40')]){this[_0x88a6('0x1b')][_0xacf68['linkedid']]['holdtime']=_0xcef0f4['diff'](this[_0x88a6('0x1b')][_0xacf68['linkedid']][_0x88a6('0x40')],_0x88a6('0x54'));}}this['channels'][_0xacf68[_0x88a6('0x4c')]][_0x88a6('0x4c')]=_0xacf68[_0x88a6('0x34')];if(_0xacf68[_0x88a6('0x5e')]!=='xcally-motion-preview'){this[_0x88a6('0x1b')][_0xacf68['linkedid']]['connectedlinenum']=_0xacf68[_0x88a6('0x5e')];}this[_0x88a6('0x1b')][_0xacf68[_0x88a6('0x4c')]][_0x88a6('0x62')]=_0xacf68[_0x88a6('0x35')];this[_0x88a6('0x1b')][_0xacf68['linkedid']][_0x88a6('0x63')]=_0xacf68['channel'];this[_0x88a6('0x1b')][_0xacf68['linkedid']]['disposition']=dispositions[_[_0x88a6('0x43')](_0xacf68['channelstate'])];if(this['agents'][_0xacf68['channel'][_0x88a6('0x46')]('-')[0x0]]){this[_0x88a6('0x1b')][_0xacf68['linkedid']][_0x88a6('0x64')]=this[_0x88a6('0x1c')][_0xacf68[_0x88a6('0x3d')]['split']('-')[0x0]]['id'];this['channels'][_0xacf68[_0x88a6('0x4c')]][_0x88a6('0x65')]=this['agents'][_0xacf68['channel'][_0x88a6('0x46')]('-')[0x0]][_0x88a6('0x66')];}}}}else{if(this['channels'][_0xacf68[_0x88a6('0x34')]]){if(_0xacf68['channelstate']==='6'){if(this[_0x88a6('0x1c')][_0xacf68[_0x88a6('0x3d')]['split']('-')[0x0]]){this[_0x88a6('0x1b')][_0xacf68[_0x88a6('0x34')]][_0x88a6('0x64')]=this[_0x88a6('0x1c')][_0xacf68[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]]['id'];this['channels'][_0xacf68[_0x88a6('0x34')]][_0x88a6('0x65')]=this[_0x88a6('0x1c')][_0xacf68[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]][_0x88a6('0x66')];}}}}}}catch(_0xc2f038){logger['error'](_0x88a6('0x67'),_0xacf68[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0xc2f038,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x68')]=function(_0x4c14a2,_0x176641){try{if(this['channels'][_0x4c14a2]){logger[_0x88a6('0x2b')](_0x88a6('0x69'),_0x4c14a2,_0x176641);this['channels'][_0x4c14a2][_0x88a6('0x6a')]=!![];if(_[_0x88a6('0x6b')](_0x176641,_0x88a6('0x6c'))){_0x176641=_0x176641[_0x88a6('0x6d')](_0x88a6('0x6c'),_0x88a6('0x6e'));}this[_0x88a6('0x1b')][_0x4c14a2][_0x88a6('0x6f')]=_0x176641;var _0x33d415=_[_0x88a6('0x70')](this[_0x88a6('0x1b')][_0x4c14a2][_0x88a6('0x71')],{'filename':_0x176641});if(_[_0x88a6('0x72')](_0x33d415)){this[_0x88a6('0x1b')][_0x4c14a2][_0x88a6('0x71')][_0x88a6('0x73')]({'filename':_0x176641,'createdAt':moment()[_0x88a6('0x41')](_0x88a6('0x55')),'mixmonitorid':'','status':_0x88a6('0x74')});}}}catch(_0x32b8e5){logger[_0x88a6('0x2d')](_0x88a6('0x75'),_0x4c14a2,util['inspect'](_0x32b8e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x24')]=function(_0x5bc1f2){try{if(this[_0x88a6('0x30')](_0x5bc1f2)){logger['debug'](_0x88a6('0x76'),_0x5bc1f2[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x5bc1f2,{'showHidden':![],'depth':null}));if(this[_0x88a6('0x1b')][_0x5bc1f2['uniqueid']]&&_0x5bc1f2[_0x88a6('0x3d')]!=_0x88a6('0x4d')){if(this[_0x88a6('0x30')](_0x5bc1f2[_0x88a6('0x77')])){if(this[_0x88a6('0x30')](_0x5bc1f2[_0x88a6('0x77')][_0x88a6('0x78')])){logger[_0x88a6('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x68')](_0x5bc1f2['uniqueid'],_0x5bc1f2[_0x88a6('0x79')]);}else if(this['isNotNull'](_0x5bc1f2['variable']['xmd-phone'])){logger[_0x88a6('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2['value']);this['channels'][_0x5bc1f2[_0x88a6('0x34')]][_0x88a6('0x5e')]=_0x5bc1f2[_0x88a6('0x79')];}else if(this['isNotNull'](_0x5bc1f2['variable']['xmd-callerid'])){logger[_0x88a6('0x2b')](_0x88a6('0x7a'),_0x5bc1f2['uniqueid'],_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x1b')][_0x5bc1f2['uniqueid']][_0x88a6('0x7b')]=_0x5bc1f2[_0x88a6('0x79')];}else if(this['isNotNull'](_0x5bc1f2['variable'][_0x88a6('0x7c')])){logger[_0x88a6('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2[_0x88a6('0x79')]);this['channels'][_0x5bc1f2[_0x88a6('0x34')]]['type']=_0x5bc1f2['value'];}else if(this['isNotNull'](_0x5bc1f2[_0x88a6('0x77')][_0x88a6('0x7d')])){logger[_0x88a6('0x2b')](_0x88a6('0x7e'),_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2['value'][_0x88a6('0x46')](',')[0x0]);this['channels'][_0x5bc1f2[_0x88a6('0x34')]][_0x88a6('0xf')]=_0x5bc1f2[_0x88a6('0x79')]['split'](',')[0x0];}else if(this[_0x88a6('0x30')](_0x5bc1f2['variable']['xmd-originatecalleridnum'])){logger[_0x88a6('0x2b')](_0x88a6('0x7f'),_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x1b')][_0x5bc1f2[_0x88a6('0x34')]]['originatecalleridnum']=_0x5bc1f2[_0x88a6('0x79')];}else if(this[_0x88a6('0x30')](_0x5bc1f2[_0x88a6('0x77')]['xmd-destination'])){logger[_0x88a6('0x2b')](_0x88a6('0x80'),_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x1b')][_0x5bc1f2[_0x88a6('0x34')]][_0x88a6('0x81')]=_0x5bc1f2[_0x88a6('0x79')];}else if(this['isNotNull'](_0x5bc1f2['variable'][_0x88a6('0x82')])){logger[_0x88a6('0x2b')](_0x88a6('0x83'),_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2[_0x88a6('0x79')]);this['channels'][_0x5bc1f2['uniqueid']][_0x88a6('0x84')]=_0x5bc1f2[_0x88a6('0x79')];}else if(this[_0x88a6('0x30')](_0x5bc1f2['variable']['xmcs-queue'])){logger[_0x88a6('0x2b')](_0x88a6('0x85'),_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2['value']);this[_0x88a6('0x1b')][_0x5bc1f2[_0x88a6('0x34')]][_0x88a6('0xf')]=_0x5bc1f2[_0x88a6('0x79')];}else if(this[_0x88a6('0x30')](_0x5bc1f2[_0x88a6('0x77')]['sipcallid'])){logger[_0x88a6('0x2b')](_0x88a6('0x86'),_0x5bc1f2[_0x88a6('0x34')],_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x1b')][_0x5bc1f2['uniqueid']]['sipcalluniqueid']=_0x5bc1f2['value'];}}}else if(this[_0x88a6('0x30')](_0x5bc1f2[_0x88a6('0x77')]['mixmonitor_filename'])){if(_0x5bc1f2['value']){var _0x1096b7=path[_0x88a6('0x87')](_0x5bc1f2[_0x88a6('0x79')])['name'];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x1096b7,_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x68')](_0x1096b7,_0x5bc1f2[_0x88a6('0x79')]);}}else if(this['channels'][_0x5bc1f2['linkedid']]){if(this[_0x88a6('0x30')](_0x5bc1f2['variable'])){if(this[_0x88a6('0x30')](_0x5bc1f2[_0x88a6('0x77')]['sipcallid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5bc1f2[_0x88a6('0x4c')],_0x5bc1f2[_0x88a6('0x79')]);this[_0x88a6('0x1b')][_0x5bc1f2['linkedid']][_0x88a6('0x88')]=_0x5bc1f2[_0x88a6('0x79')];}}}}}catch(_0xc1bd72){logger['error'](_0x88a6('0x89'),_0x5bc1f2['uniqueid'],util[_0x88a6('0x2e')](_0xc1bd72,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x88a6('0x8a')]=function(_0x1f6760){try{if(this[_0x88a6('0x30')](_0x1f6760)){logger[_0x88a6('0x36')](_0x88a6('0x8b'),_0x1f6760[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x1f6760,{'showHidden':![],'depth':null}));if(this[_0x88a6('0x1b')][_0x1f6760['uniqueid']]){logger[_0x88a6('0x2b')](_0x88a6('0x8c'),_0x1f6760[_0x88a6('0x34')],_0x1f6760[_0x88a6('0x8d')]);var _0x50c1f7=moment();this['channels'][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x8e')]=_0x50c1f7['format'](_0x88a6('0x55'));this[_0x88a6('0x1b')][_0x1f6760['uniqueid']][_0x88a6('0x52')]=_0x50c1f7[_0x88a6('0x8f')](this['channels'][_0x1f6760['uniqueid']][_0x88a6('0x40')],'seconds');if(this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x60')]){this[_0x88a6('0x1b')][_0x1f6760['uniqueid']][_0x88a6('0x90')]=_0x50c1f7[_0x88a6('0x8f')](this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x61')],_0x88a6('0x54'));this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x91')]=this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x52')]-this[_0x88a6('0x1b')][_0x1f6760['uniqueid']]['billableseconds'];}if(_0x1f6760[_0x88a6('0x3f')]===_0x88a6('0x45')){if(this[_0x88a6('0x1c')][_0x1f6760['channel'][_0x88a6('0x46')]('-')[0x0]]){this[_0x88a6('0x1c')][_0x1f6760[_0x88a6('0x3d')]['split']('-')[0x0]]=_['omit'](this[_0x88a6('0x1c')][_0x1f6760[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]],['destconnectedlinenum']);logger[_0x88a6('0x36')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x1f6760[_0x88a6('0x34')],util[_0x88a6('0x2e')]({'destaccountcode':this['agents'][_0x1f6760[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]][_0x88a6('0x49')]},{'showHidden':![],'depth':null}));this[_0x88a6('0x32')](util[_0x88a6('0x41')](_0x88a6('0x92'),this[_0x88a6('0x1c')][_0x1f6760[_0x88a6('0x3d')][_0x88a6('0x46')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0x88a6('0x1c')][_0x1f6760['channel'][_0x88a6('0x46')]('-')[0x0]][_0x88a6('0x49')]});}}if(_0x1f6760['event']===_0x88a6('0x93')){this[_0x88a6('0x94')][_0x1f6760['uniqueid']]=this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]];}else{if(this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x95')]===_0x88a6('0x96')&&this[_0x88a6('0x94')][_0x1f6760['uniqueid']]){this[_0x88a6('0x1b')][_0x1f6760['uniqueid']][_0x88a6('0x34')]=[this['channels'][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x4c')],this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]]['linkedid']=this['channels'][_0x1f6760[_0x88a6('0x34')]][_0x88a6('0x34')]][0x0];delete this['blindTransfers'][_0x1f6760[_0x88a6('0x34')]];}}logger[_0x88a6('0x36')](_0x88a6('0x97'),_0x1f6760[_0x88a6('0x34')],util['inspect'](this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]],{'showHidden':![],'depth':null}));ami[_0x88a6('0x32')](_0x88a6('0x98'),this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]]);delete this[_0x88a6('0x1b')][_0x1f6760[_0x88a6('0x34')]];}}}catch(_0x33f05b){logger[_0x88a6('0x2d')](_0x88a6('0x99'),_0x1f6760[_0x88a6('0x34')],util['inspect'](_0x33f05b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0x27')]=function(_0x4bf668){try{if(this[_0x88a6('0x30')](_0x4bf668)){logger[_0x88a6('0x2b')](_0x88a6('0x9a'),_0x4bf668[_0x88a6('0x34')],_0x4bf668[_0x88a6('0x9b')],_0x4bf668[_0x88a6('0x9c')]);logger[_0x88a6('0x36')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x4bf668[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x4bf668,{'showHidden':![],'depth':null}));if(this[_0x88a6('0x1b')][_0x4bf668['transfereeuniqueid']]){this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0x9d')]][_0x88a6('0x9e')]=_0x4bf668[_0x88a6('0x9b')];this[_0x88a6('0x1b')][_0x4bf668['transfereeuniqueid']]['transferconnectedlinenum']=_0x4bf668['transfertargetcalleridnum'];if(this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0x9f')]]){var _0x1e7428=this['channels'][_0x4bf668[_0x88a6('0x9f')]];this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0x9f')]]=this[_0x88a6('0x1b')][_0x4bf668['transfereeuniqueid']];this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0x9d')]]=_0x1e7428;}}else if(this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0xa0')]]){this[_0x88a6('0x1b')][_0x4bf668['transfertargetuniqueid']][_0x88a6('0x9e')]=_0x4bf668[_0x88a6('0x9b')];this['channels'][_0x4bf668[_0x88a6('0xa0')]][_0x88a6('0xa1')]=_0x4bf668[_0x88a6('0x9c')];if(this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0xa2')]]){var _0x1e7428=this['channels'][_0x4bf668[_0x88a6('0xa2')]];this['channels'][_0x4bf668[_0x88a6('0xa2')]]=this[_0x88a6('0x1b')][_0x4bf668[_0x88a6('0xa0')]];this[_0x88a6('0x1b')][_0x4bf668['transfertargetuniqueid']]=_0x1e7428;}}}}catch(_0x283f9e){logger[_0x88a6('0x2d')](_0x88a6('0xa3'),_0x4bf668[_0x88a6('0x34')],util['inspect'](_0x283f9e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0xa4')]=function(_0x1ecf75){try{if(this['isNotNull'](_0x1ecf75)){logger[_0x88a6('0x2b')](_0x88a6('0xa5'),_0x1ecf75[_0x88a6('0x34')],_0x1ecf75[_0x88a6('0xa6')],_0x1ecf75[_0x88a6('0xa7')]);logger['debug'](_0x88a6('0xa8'),_0x1ecf75['uniqueid'],util[_0x88a6('0x2e')](_0x1ecf75,{'showHidden':![],'depth':null}));if(this[_0x88a6('0x1b')][_0x1ecf75[_0x88a6('0x9d')]]){this[_0x88a6('0x1b')][_0x1ecf75[_0x88a6('0x9d')]][_0x88a6('0x9e')]=_0x1ecf75[_0x88a6('0xa6')];this[_0x88a6('0x1b')][_0x1ecf75[_0x88a6('0x9d')]][_0x88a6('0xa1')]=_0x1ecf75[_0x88a6('0xa7')];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x1ecf75[_0x88a6('0x9d')],'context':_0x1ecf75[_0x88a6('0x3f')],'channel':_0x1ecf75[_0x88a6('0xa9')]});}}}catch(_0x2e9c97){logger[_0x88a6('0x2d')]('[%s][voiceCallReport][blindtransfer]',_0x1ecf75['uniqueid'],util[_0x88a6('0x2e')](_0x2e9c97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x88a6('0x2f')][_0x88a6('0xaa')]=function(_0x30e169){try{if(this[_0x88a6('0x30')](_0x30e169)){logger['debug'](_0x88a6('0xab'),_0x30e169[_0x88a6('0x34')],util['inspect'](_0x30e169,{'showHidden':![],'depth':null}));if(this['channels'][_0x30e169['uniqueid']]){if(!_['isNil'](this[_0x88a6('0x1b')][_0x30e169['uniqueid']][_0x88a6('0x61')])){this[_0x88a6('0x1b')][_0x30e169[_0x88a6('0x34')]][_0x88a6('0xac')]=moment()[_0x88a6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x88a6('0x2b')](_0x88a6('0xad'),_0x30e169['uniqueid'],this['channels'][_0x30e169[_0x88a6('0x34')]]['mohstarttime']);}}}}catch(_0x441a80){logger['error']('[%s][voiceCallReport][musiconholdstart]',_0x30e169['uniqueid'],util['inspect'](_0x441a80,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x88a6('0xae')]=function(_0x497834){try{if(this['isNotNull'](_0x497834)){logger[_0x88a6('0x36')](_0x88a6('0xaf'),_0x497834[_0x88a6('0x34')],util[_0x88a6('0x2e')](_0x497834,{'showHidden':![],'depth':null}));if(this[_0x88a6('0x1b')][_0x497834[_0x88a6('0x34')]]){if(!_[_0x88a6('0x72')](this[_0x88a6('0x1b')][_0x497834[_0x88a6('0x34')]][_0x88a6('0xac')])){this[_0x88a6('0x1b')][_0x497834[_0x88a6('0x34')]][_0x88a6('0xb0')]+=moment()[_0x88a6('0xb1')](0x0)['diff'](this[_0x88a6('0x1b')][_0x497834['uniqueid']][_0x88a6('0xac')],_0x88a6('0x54'));logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x497834[_0x88a6('0x34')],this[_0x88a6('0x1b')][_0x497834['uniqueid']]['mohtime']);delete this[_0x88a6('0x1b')][_0x497834[_0x88a6('0x34')]][_0x88a6('0xac')];}}}}catch(_0x3e142b){logger[_0x88a6('0x2d')](_0x88a6('0xb2'),_0x497834[_0x88a6('0x34')],util['inspect'](_0x3e142b,{'showHidden':![],'depth':null}));}};module[_0x88a6('0xb3')]=VoiceCallReport; \ No newline at end of file +var _0x7f6b=['type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','holdtime','omit','destconnectedlinenum','user:agentcomplete','BlindTransfer','blindTransfers','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transferconnectedlinenum','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','unavailable','ringinuse','onhold','set','queue','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','newexten','newchannel','syncNewChannel','bind','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','merge','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','from-sip','channel','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','includes','startsWith','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype'];(function(_0x1a2d35,_0x10af53){var _0x3099a3=function(_0x50fd75){while(--_0x50fd75){_0x1a2d35['push'](_0x1a2d35['shift']());}};_0x3099a3(++_0x10af53);}(_0x7f6b,0xe7));var _0xb7f6=function(_0x11f695,_0x36d4a4){_0x11f695=_0x11f695-0x0;var _0x5ab686=_0x7f6b[_0x11f695];return _0x5ab686;};'use strict';var BPromise=require(_0xb7f6('0x0'));var _=require(_0xb7f6('0x1'));var moment=require(_0xb7f6('0x2'));var util=require(_0xb7f6('0x3'));var path=require(_0xb7f6('0x4'));var Redis=require(_0xb7f6('0x5'));var config=require(_0xb7f6('0x6'));var logger=require(_0xb7f6('0x7'))(_0xb7f6('0x8'));var ami=require(_0xb7f6('0x9'));var Channel=require(_0xb7f6('0xa'));var statusDesc=[_0xb7f6('0xb'),'not_inuse',_0xb7f6('0xc'),'busy','invalid',_0xb7f6('0xd'),'ringing',_0xb7f6('0xe'),_0xb7f6('0xf')];var applications=[_0xb7f6('0x10'),_0xb7f6('0x11'),'agi',_0xb7f6('0x12'),_0xb7f6('0x13'),'voicemail'];var dispositions=[_0xb7f6('0x14'),'FAILED',_0xb7f6('0x15'),_0xb7f6('0x14'),_0xb7f6('0x14'),'NO\x20ANSWER',_0xb7f6('0x16'),_0xb7f6('0x17'),_0xb7f6('0x15'),_0xb7f6('0x15'),'FAILED'];var actions={};config[_0xb7f6('0x18')]=_[_0xb7f6('0x19')](config[_0xb7f6('0x18')],{'host':_0xb7f6('0x1a'),'port':0x18eb});var io=require(_0xb7f6('0x1b'))(new Redis(config[_0xb7f6('0x18')]));function VoiceCallReport(_0x32f401){this['channels']=_0x32f401[_0xb7f6('0x1c')];this[_0xb7f6('0x1d')]=_0x32f401[_0xb7f6('0x1d')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0xb7f6('0x1e')]['bind'](this));ami['on'](_0xb7f6('0x1f'),this[_0xb7f6('0x1e')]['bind'](this));ami['on'](_0xb7f6('0x20'),this[_0xb7f6('0x21')][_0xb7f6('0x22')](this));ami['on']('newstate',this['syncNewState'][_0xb7f6('0x22')](this));ami['on']('varset',this[_0xb7f6('0x23')][_0xb7f6('0x22')](this));ami['on'](_0xb7f6('0x24'),this[_0xb7f6('0x25')][_0xb7f6('0x22')](this));ami['on'](_0xb7f6('0x26'),this[_0xb7f6('0x27')][_0xb7f6('0x22')](this));ami['on'](_0xb7f6('0x28'),this[_0xb7f6('0x29')]['bind'](this));ami['on']('blindtransfer',this[_0xb7f6('0x2a')][_0xb7f6('0x22')](this));ami['on'](_0xb7f6('0x2b'),this[_0xb7f6('0x2c')]['bind'](this));ami['on'](_0xb7f6('0x2d'),this[_0xb7f6('0x2e')]['bind'](this));try{logger[_0xb7f6('0x2f')](_0xb7f6('0x30'));ami[_0xb7f6('0x31')]();}catch(_0x19f58a){logger[_0xb7f6('0x32')]('[voiceCallReport][coreshowchannels]',util[_0xb7f6('0x33')](_0x19f58a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x35')]=function(_0x133a68){return _0x133a68!==null&&!_[_0xb7f6('0x36')](_0x133a68);};VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x37')]=function(_0x48f4bd,_0x1ada7a,_0x23e755){io['to'](_0x48f4bd)[_0xb7f6('0x37')](_0x1ada7a,_0x23e755);};VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x27')]=function(_0x2bb668){try{if(this[_0xb7f6('0x35')](_0x2bb668)){logger['info'](_0xb7f6('0x38'),_0x2bb668['uniqueid'],_0x2bb668[_0xb7f6('0x39')],_0x2bb668[_0xb7f6('0x3a')]);logger[_0xb7f6('0x3b')](_0xb7f6('0x3c'),_0x2bb668['uniqueid'],util[_0xb7f6('0x33')](_0x2bb668,{'showHidden':![],'depth':null}));if(_0x2bb668['uniqueid']===_0x2bb668['linkedid']){if(!_[_0xb7f6('0x36')](this[_0xb7f6('0x1c')][_0x2bb668[_0xb7f6('0x3d')]])){_[_0xb7f6('0x3e')](this[_0xb7f6('0x1c')][_0x2bb668[_0xb7f6('0x3d')]],_['pick'](_0x2bb668,_[_0xb7f6('0x3f')](this['channels'][_0x2bb668[_0xb7f6('0x3d')]])));}}}}catch(_0xd42f51){logger[_0xb7f6('0x32')](_0xb7f6('0x40'),_0x2bb668[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0xd42f51,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x21')]=function(_0x4254d4){try{if(this[_0xb7f6('0x35')](_0x4254d4)){logger[_0xb7f6('0x3b')](_0xb7f6('0x41'),_0x4254d4[_0xb7f6('0x3d')],util['inspect'](_0x4254d4,{'showHidden':![],'depth':null}));if(_0x4254d4['uniqueid']===_0x4254d4[_0xb7f6('0x42')]&&_0x4254d4['channel']!='OutgoingSpoolFailed'){if(_[_0xb7f6('0x36')](this[_0xb7f6('0x1c')][_0x4254d4[_0xb7f6('0x3d')]])){logger[_0xb7f6('0x2f')](_0xb7f6('0x43'),_0x4254d4[_0xb7f6('0x3d')],_0x4254d4[_0xb7f6('0x44')],_0x4254d4[_0xb7f6('0x45')]);this[_0xb7f6('0x1c')][_0x4254d4[_0xb7f6('0x3d')]]=new Channel();this[_0xb7f6('0x1c')][_0x4254d4[_0xb7f6('0x3d')]]['starttime']=moment()[_0xb7f6('0x46')](_0xb7f6('0x47'));this['channels'][_0x4254d4['uniqueid']][_0xb7f6('0x48')]=dispositions[_[_0xb7f6('0x49')](_0x4254d4[_0xb7f6('0x4a')])];_['merge'](this[_0xb7f6('0x1c')][_0x4254d4[_0xb7f6('0x3d')]],_[_0xb7f6('0x4b')](_0x4254d4,_[_0xb7f6('0x3f')](this[_0xb7f6('0x1c')][_0x4254d4[_0xb7f6('0x3d')]])));if(_0x4254d4[_0xb7f6('0x44')]===_0xb7f6('0x4c')){if(this[_0xb7f6('0x1d')][_0x4254d4[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]]){this[_0xb7f6('0x1d')][_0x4254d4[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]]['destconnectedlinenum']=_0x4254d4[_0xb7f6('0x45')];logger['debug'](_0xb7f6('0x4f'),_0x4254d4[_0xb7f6('0x3d')],util[_0xb7f6('0x33')]({'destaccountcode':this[_0xb7f6('0x1d')][_0x4254d4['channel'][_0xb7f6('0x4e')]('-')[0x0]][_0xb7f6('0x50')],'destconnectedlinenum':_0x4254d4[_0xb7f6('0x45')]},{'showHidden':![],'depth':null}));this[_0xb7f6('0x37')](util['format'](_0xb7f6('0x51'),this[_0xb7f6('0x1d')][_0x4254d4[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]][_0xb7f6('0x52')]),_0xb7f6('0x53'),{'destaccountcode':this[_0xb7f6('0x1d')][_0x4254d4[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]][_0xb7f6('0x50')],'destconnectedlinenum':_0x4254d4['exten']});}}}}}}catch(_0x45a002){logger[_0xb7f6('0x32')]('[%s][voiceCallReport][newchannel]',_0x4254d4[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x45a002,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb7f6('0x1e')]=function(_0x57a050){try{if(this['isNotNull'](_0x57a050)){logger[_0xb7f6('0x3b')](_0xb7f6('0x54'),_0x57a050[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x57a050,{'showHidden':![],'depth':null}));if(_0x57a050[_0xb7f6('0x3d')]===_0x57a050['linkedid']&&_0x57a050[_0xb7f6('0x45')]!='h'&&_0x57a050['channel']!='OutgoingSpoolFailed'){_0x57a050[_0xb7f6('0x55')]=_0x57a050[_0xb7f6('0x55')]['toLowerCase']();_0x57a050[_0xb7f6('0x56')]=(_0x57a050[_0xb7f6('0x57')]||_0x57a050[_0xb7f6('0x56')])[_0xb7f6('0x58')]();logger['info'](_0xb7f6('0x59'),_0x57a050['uniqueid'],_0x57a050[_0xb7f6('0x55')],_0x57a050['applicationdata']);if(_[_0xb7f6('0x36')](this[_0xb7f6('0x1c')][_0x57a050['uniqueid']])){this['channels'][_0x57a050['uniqueid']]=new Channel();this[_0xb7f6('0x1c')][_0x57a050[_0xb7f6('0x3d')]][_0xb7f6('0x5a')]=_0x57a050[_0xb7f6('0x5b')]?moment()['subtract'](moment[_0xb7f6('0x5b')](_0x57a050[_0xb7f6('0x5b')])[_0xb7f6('0x5c')](),_0xb7f6('0x5c'))['format'](_0xb7f6('0x47')):moment()[_0xb7f6('0x46')](_0xb7f6('0x47'));this[_0xb7f6('0x1c')][_0x57a050[_0xb7f6('0x3d')]]['disposition']=_0xb7f6('0x14');}_[_0xb7f6('0x3e')](this[_0xb7f6('0x1c')][_0x57a050['uniqueid']],_[_0xb7f6('0x4b')](_0x57a050,_[_0xb7f6('0x3f')](this[_0xb7f6('0x1c')][_0x57a050[_0xb7f6('0x3d')]])));if(_[_0xb7f6('0x5d')](applications,_0x57a050[_0xb7f6('0x55')])){this[_0xb7f6('0x1c')][_0x57a050[_0xb7f6('0x3d')]]['lastapplication']=_0x57a050['application'];this['channels'][_0x57a050[_0xb7f6('0x3d')]]['lastdata']=_0x57a050[_0xb7f6('0x56')];if(_0x57a050['application']===_0xb7f6('0x10')&&_[_0xb7f6('0x5e')](_0x57a050[_0xb7f6('0x56')],'cdr(')){var _0x43bfd3=_0x57a050[_0xb7f6('0x56')][_0xb7f6('0x4e')]('=');var _0x359529=_0x43bfd3[0x0]['match'](/cdr\((.*)\)/);if(_0x359529){this[_0xb7f6('0x1c')][_0x57a050[_0xb7f6('0x3d')]][_0x359529[0x1]]=_0x43bfd3[0x1];}}else if(_0x57a050[_0xb7f6('0x55')]===_0xb7f6('0x11')){this['channels'][_0x57a050[_0xb7f6('0x3d')]][_0xb7f6('0x11')]=_0x57a050[_0xb7f6('0x56')]['split'](',')[0x0];}}}}}catch(_0x163970){logger[_0xb7f6('0x32')]('[%s][voiceCallReport][newexten]',_0x57a050['uniqueid'],util['inspect'](_0x163970,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')]['syncNewState']=function(_0x58733a){try{if(this[_0xb7f6('0x35')](_0x58733a)){logger[_0xb7f6('0x2f')](_0xb7f6('0x5f'),_0x58733a[_0xb7f6('0x3d')],_0x58733a[_0xb7f6('0x42')],_0x58733a[_0xb7f6('0x39')],_0x58733a['calleridnum']);logger[_0xb7f6('0x3b')](_0xb7f6('0x60'),_0x58733a[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x58733a,{'showHidden':![],'depth':null}));if(_0x58733a['uniqueid']!==_0x58733a[_0xb7f6('0x42')]){if(this['channels'][_0x58733a[_0xb7f6('0x42')]]){if(_0x58733a[_0xb7f6('0x4a')]==='6'){if(!this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x61')]){var _0x1aa344=moment();this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x61')]=!![];this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x62')]=_0x1aa344[_0xb7f6('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xb7f6('0x1c')][_0x58733a['linkedid']]['starttime']){this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]]['holdtime']=_0x1aa344[_0xb7f6('0x63')](this['channels'][_0x58733a['linkedid']]['starttime'],_0xb7f6('0x5c'));}}this['channels'][_0x58733a[_0xb7f6('0x42')]]['linkedid']=_0x58733a[_0xb7f6('0x3d')];if(_0x58733a[_0xb7f6('0x3a')]!==_0xb7f6('0x64')){this[_0xb7f6('0x1c')][_0x58733a['linkedid']][_0xb7f6('0x65')]=_0x58733a[_0xb7f6('0x3a')];}this['channels'][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x66')]=_0x58733a['calleridname'];this['channels'][_0x58733a['linkedid']][_0xb7f6('0x67')]=_0x58733a[_0xb7f6('0x4d')];this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x48')]=dispositions[_['toNumber'](_0x58733a['channelstate'])];if(this['agents'][_0x58733a[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]]){this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x68')]=this['agents'][_0x58733a['channel'][_0xb7f6('0x4e')]('-')[0x0]]['id'];this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x42')]][_0xb7f6('0x69')]=this['agents'][_0x58733a['channel'][_0xb7f6('0x4e')]('-')[0x0]][_0xb7f6('0x52')];}}}}else{if(this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x3d')]]){if(_0x58733a[_0xb7f6('0x4a')]==='6'){if(this['agents'][_0x58733a[_0xb7f6('0x4d')]['split']('-')[0x0]]){this[_0xb7f6('0x1c')][_0x58733a[_0xb7f6('0x3d')]]['UserId']=this[_0xb7f6('0x1d')][_0x58733a['channel'][_0xb7f6('0x4e')]('-')[0x0]]['id'];this[_0xb7f6('0x1c')][_0x58733a['uniqueid']][_0xb7f6('0x69')]=this[_0xb7f6('0x1d')][_0x58733a[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]][_0xb7f6('0x52')];}}}}}}catch(_0x343a55){logger[_0xb7f6('0x32')]('[%s][voiceCallReport][newstate]',_0x58733a[_0xb7f6('0x3d')],util['inspect'](_0x343a55,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x6a')]=function(_0x4fcbd7,_0x45e851){try{if(this['channels'][_0x4fcbd7]){logger[_0xb7f6('0x2f')](_0xb7f6('0x6b'),_0x4fcbd7,_0x45e851);this[_0xb7f6('0x1c')][_0x4fcbd7]['monitor']=!![];if(_[_0xb7f6('0x6c')](_0x45e851,'.wav49')){_0x45e851=_0x45e851[_0xb7f6('0x6d')](_0xb7f6('0x6e'),_0xb7f6('0x6f'));}this['channels'][_0x4fcbd7][_0xb7f6('0x70')]=_0x45e851;var _0x271d6b=_[_0xb7f6('0x71')](this[_0xb7f6('0x1c')][_0x4fcbd7][_0xb7f6('0x72')],{'filename':_0x45e851});if(_[_0xb7f6('0x73')](_0x271d6b)){this['channels'][_0x4fcbd7]['monitors'][_0xb7f6('0x74')]({'filename':_0x45e851,'createdAt':moment()[_0xb7f6('0x46')](_0xb7f6('0x47')),'mixmonitorid':'','status':'rec'});}}}catch(_0x32092a){logger[_0xb7f6('0x32')](_0xb7f6('0x75'),_0x4fcbd7,util['inspect'](_0x32092a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb7f6('0x23')]=function(_0x3f79a6){try{if(this[_0xb7f6('0x35')](_0x3f79a6)){logger[_0xb7f6('0x3b')](_0xb7f6('0x76'),_0x3f79a6[_0xb7f6('0x3d')],util['inspect'](_0x3f79a6,{'showHidden':![],'depth':null}));if(this[_0xb7f6('0x1c')][_0x3f79a6['uniqueid']]&&_0x3f79a6['channel']!=_0xb7f6('0x77')){if(this[_0xb7f6('0x35')](_0x3f79a6['variable'])){if(this['isNotNull'](_0x3f79a6[_0xb7f6('0x78')][_0xb7f6('0x79')])){logger[_0xb7f6('0x2f')](_0xb7f6('0x7a'),_0x3f79a6['uniqueid'],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x6a')](_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);}else if(this[_0xb7f6('0x35')](_0x3f79a6['variable']['xmd-phone'])){logger[_0xb7f6('0x2f')](_0xb7f6('0x7c'),_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this['channels'][_0x3f79a6['uniqueid']][_0xb7f6('0x3a')]=_0x3f79a6[_0xb7f6('0x7b')];}else if(this[_0xb7f6('0x35')](_0x3f79a6[_0xb7f6('0x78')]['xmd-callerid'])){logger[_0xb7f6('0x2f')](_0xb7f6('0x7d'),_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x3d')]]['callerid']=_0x3f79a6[_0xb7f6('0x7b')];}else if(this['isNotNull'](_0x3f79a6[_0xb7f6('0x78')][_0xb7f6('0x7e')])){logger[_0xb7f6('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x3d')]][_0xb7f6('0x7f')]=_0x3f79a6['value'];}else if(this[_0xb7f6('0x35')](_0x3f79a6['variable']['xmd-queue'])){logger['info'](_0xb7f6('0x80'),_0x3f79a6['uniqueid'],_0x3f79a6[_0xb7f6('0x7b')][_0xb7f6('0x4e')](',')[0x0]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x3d')]]['queue']=_0x3f79a6[_0xb7f6('0x7b')][_0xb7f6('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x3f79a6[_0xb7f6('0x78')][_0xb7f6('0x81')])){logger[_0xb7f6('0x2f')](_0xb7f6('0x82'),_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x3d')]][_0xb7f6('0x83')]=_0x3f79a6[_0xb7f6('0x7b')];}else if(this[_0xb7f6('0x35')](_0x3f79a6[_0xb7f6('0x78')][_0xb7f6('0x84')])){logger[_0xb7f6('0x2f')](_0xb7f6('0x85'),_0x3f79a6['uniqueid'],_0x3f79a6[_0xb7f6('0x7b')]);this['channels'][_0x3f79a6['uniqueid']]['destination']=_0x3f79a6[_0xb7f6('0x7b')];}else if(this[_0xb7f6('0x35')](_0x3f79a6[_0xb7f6('0x78')][_0xb7f6('0x86')])){logger[_0xb7f6('0x2f')](_0xb7f6('0x87'),_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x3d')]]['calleridpreview']=_0x3f79a6['value'];}else if(this[_0xb7f6('0x35')](_0x3f79a6['variable'][_0xb7f6('0x88')])){logger[_0xb7f6('0x2f')](_0xb7f6('0x89'),_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x3d')]][_0xb7f6('0x11')]=_0x3f79a6[_0xb7f6('0x7b')];}else if(this['isNotNull'](_0x3f79a6['variable']['sipcallid'])){logger[_0xb7f6('0x2f')](_0xb7f6('0x8a'),_0x3f79a6[_0xb7f6('0x3d')],_0x3f79a6[_0xb7f6('0x7b')]);this['channels'][_0x3f79a6['uniqueid']]['sipcalluniqueid']=_0x3f79a6[_0xb7f6('0x7b')];}}}else if(this[_0xb7f6('0x35')](_0x3f79a6['variable'][_0xb7f6('0x79')])){if(_0x3f79a6[_0xb7f6('0x7b')]){var _0x540992=path[_0xb7f6('0x8b')](_0x3f79a6[_0xb7f6('0x7b')])[_0xb7f6('0x52')];logger[_0xb7f6('0x2f')](_0xb7f6('0x7a'),_0x540992,_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x6a')](_0x540992,_0x3f79a6['value']);}}else if(this['channels'][_0x3f79a6['linkedid']]){if(this['isNotNull'](_0x3f79a6[_0xb7f6('0x78')])){if(this[_0xb7f6('0x35')](_0x3f79a6[_0xb7f6('0x78')][_0xb7f6('0x8c')])){logger[_0xb7f6('0x2f')](_0xb7f6('0x8a'),_0x3f79a6[_0xb7f6('0x42')],_0x3f79a6[_0xb7f6('0x7b')]);this[_0xb7f6('0x1c')][_0x3f79a6[_0xb7f6('0x42')]][_0xb7f6('0x8d')]=_0x3f79a6['value'];}}}}}catch(_0x2d70b5){logger[_0xb7f6('0x32')](_0xb7f6('0x8e'),_0x3f79a6[_0xb7f6('0x3d')],util['inspect'](_0x2d70b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x25')]=function(_0x17553e){try{if(this[_0xb7f6('0x35')](_0x17553e)){logger[_0xb7f6('0x3b')]('[%s][voiceCallReport][hangup]\x20event:',_0x17553e[_0xb7f6('0x3d')],util['inspect'](_0x17553e,{'showHidden':![],'depth':null}));if(this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]]){logger[_0xb7f6('0x2f')](_0xb7f6('0x8f'),_0x17553e[_0xb7f6('0x3d')],_0x17553e[_0xb7f6('0x90')]);var _0x1fefd4=moment();this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x91')]=_0x1fefd4[_0xb7f6('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x5b')]=_0x1fefd4[_0xb7f6('0x63')](this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x5a')],_0xb7f6('0x5c'));if(this['channels'][_0x17553e['uniqueid']][_0xb7f6('0x61')]){this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x92')]=_0x1fefd4[_0xb7f6('0x63')](this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x62')],_0xb7f6('0x5c'));this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x93')]=this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x5b')]-this['channels'][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x92')];}if(_0x17553e[_0xb7f6('0x44')]===_0xb7f6('0x4c')){if(this[_0xb7f6('0x1d')][_0x17553e['channel'][_0xb7f6('0x4e')]('-')[0x0]]){this['agents'][_0x17553e[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]]=_[_0xb7f6('0x94')](this['agents'][_0x17553e[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]],[_0xb7f6('0x95')]);logger[_0xb7f6('0x3b')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x17553e['uniqueid'],util['inspect']({'destaccountcode':this[_0xb7f6('0x1d')][_0x17553e[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]][_0xb7f6('0x50')]},{'showHidden':![],'depth':null}));this[_0xb7f6('0x37')](util[_0xb7f6('0x46')](_0xb7f6('0x51'),this[_0xb7f6('0x1d')][_0x17553e['channel']['split']('-')[0x0]][_0xb7f6('0x52')]),_0xb7f6('0x96'),{'destaccountcode':this[_0xb7f6('0x1d')][_0x17553e[_0xb7f6('0x4d')][_0xb7f6('0x4e')]('-')[0x0]]['accountcode']});}}if(_0x17553e['event']===_0xb7f6('0x97')){this[_0xb7f6('0x98')][_0x17553e[_0xb7f6('0x3d')]]=this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]];}else{if(this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x7f')]===_0xb7f6('0x99')&&this[_0xb7f6('0x98')][_0x17553e[_0xb7f6('0x3d')]]){this['channels'][_0x17553e['uniqueid']][_0xb7f6('0x3d')]=[this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x42')],this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]][_0xb7f6('0x42')]=this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]]['uniqueid']][0x0];delete this[_0xb7f6('0x98')][_0x17553e['uniqueid']];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x17553e['uniqueid'],util[_0xb7f6('0x33')](this['channels'][_0x17553e[_0xb7f6('0x3d')]],{'showHidden':![],'depth':null}));ami[_0xb7f6('0x37')](_0xb7f6('0x9a'),this[_0xb7f6('0x1c')][_0x17553e[_0xb7f6('0x3d')]]);delete this['channels'][_0x17553e[_0xb7f6('0x3d')]];}}}catch(_0x2c37c5){logger['error'](_0xb7f6('0x9b'),_0x17553e[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x2c37c5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')][_0xb7f6('0x29')]=function(_0x323b10){try{if(this[_0xb7f6('0x35')](_0x323b10)){logger['info'](_0xb7f6('0x9c'),_0x323b10[_0xb7f6('0x3d')],_0x323b10['origtransferercalleridnum'],_0x323b10[_0xb7f6('0x9d')]);logger[_0xb7f6('0x3b')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x323b10[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x323b10,{'showHidden':![],'depth':null}));if(this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0x9e')]]){this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0x9e')]][_0xb7f6('0x9f')]=_0x323b10['origtransferercalleridnum'];this['channels'][_0x323b10[_0xb7f6('0x9e')]]['transferconnectedlinenum']=_0x323b10[_0xb7f6('0x9d')];if(this[_0xb7f6('0x1c')][_0x323b10['secondtransfereruniqueid']]){var _0x29af05=this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0xa0')]];this['channels'][_0x323b10[_0xb7f6('0xa0')]]=this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0x9e')]];this['channels'][_0x323b10[_0xb7f6('0x9e')]]=_0x29af05;}}else if(this['channels'][_0x323b10[_0xb7f6('0xa1')]]){this[_0xb7f6('0x1c')][_0x323b10['transfertargetuniqueid']]['transfercalleridnum']=_0x323b10[_0xb7f6('0xa2')];this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0xa1')]]['transferconnectedlinenum']=_0x323b10[_0xb7f6('0x9d')];if(this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0xa3')]]){var _0x29af05=this['channels'][_0x323b10[_0xb7f6('0xa3')]];this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0xa3')]]=this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0xa1')]];this[_0xb7f6('0x1c')][_0x323b10[_0xb7f6('0xa1')]]=_0x29af05;}}}}catch(_0x475419){logger[_0xb7f6('0x32')](_0xb7f6('0xa4'),_0x323b10[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x475419,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')]['syncBlindTransfer']=function(_0x5f1037){try{if(this['isNotNull'](_0x5f1037)){logger[_0xb7f6('0x2f')](_0xb7f6('0xa5'),_0x5f1037[_0xb7f6('0x3d')],_0x5f1037['transfereecalleridnum'],_0x5f1037[_0xb7f6('0xa6')]);logger[_0xb7f6('0x3b')](_0xb7f6('0xa7'),_0x5f1037[_0xb7f6('0x3d')],util['inspect'](_0x5f1037,{'showHidden':![],'depth':null}));if(this[_0xb7f6('0x1c')][_0x5f1037[_0xb7f6('0x9e')]]){this['channels'][_0x5f1037[_0xb7f6('0x9e')]][_0xb7f6('0x9f')]=_0x5f1037[_0xb7f6('0xa8')];this[_0xb7f6('0x1c')][_0x5f1037[_0xb7f6('0x9e')]][_0xb7f6('0xa9')]=_0x5f1037[_0xb7f6('0xa6')];this[_0xb7f6('0x25')]({'event':'BlindTransfer','uniqueid':_0x5f1037[_0xb7f6('0x9e')],'context':_0x5f1037[_0xb7f6('0x44')],'channel':_0x5f1037['transfererchannel']});}}}catch(_0x34d3ac){logger['error'](_0xb7f6('0xaa'),_0x5f1037[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x34d3ac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7f6('0x34')]['syncMusicOnHoldStart']=function(_0x372ca6){try{if(this[_0xb7f6('0x35')](_0x372ca6)){logger[_0xb7f6('0x3b')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x372ca6[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x372ca6,{'showHidden':![],'depth':null}));if(this[_0xb7f6('0x1c')][_0x372ca6[_0xb7f6('0x3d')]]){if(!_[_0xb7f6('0x73')](this['channels'][_0x372ca6[_0xb7f6('0x3d')]][_0xb7f6('0x62')])){this[_0xb7f6('0x1c')][_0x372ca6[_0xb7f6('0x3d')]]['mohstarttime']=moment()['format'](_0xb7f6('0x47'));logger['info'](_0xb7f6('0xab'),_0x372ca6[_0xb7f6('0x3d')],this[_0xb7f6('0x1c')][_0x372ca6[_0xb7f6('0x3d')]]['mohstarttime']);}}}}catch(_0x31126f){logger[_0xb7f6('0x32')](_0xb7f6('0xac'),_0x372ca6[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x31126f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0xe7647a){try{if(this[_0xb7f6('0x35')](_0xe7647a)){logger[_0xb7f6('0x3b')](_0xb7f6('0xad'),_0xe7647a[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0xe7647a,{'showHidden':![],'depth':null}));if(this[_0xb7f6('0x1c')][_0xe7647a[_0xb7f6('0x3d')]]){if(!_[_0xb7f6('0x73')](this[_0xb7f6('0x1c')][_0xe7647a[_0xb7f6('0x3d')]][_0xb7f6('0xae')])){this[_0xb7f6('0x1c')][_0xe7647a[_0xb7f6('0x3d')]]['mohtime']+=moment()[_0xb7f6('0xaf')](0x0)[_0xb7f6('0x63')](this[_0xb7f6('0x1c')][_0xe7647a[_0xb7f6('0x3d')]][_0xb7f6('0xae')],_0xb7f6('0x5c'));logger[_0xb7f6('0x2f')](_0xb7f6('0xb0'),_0xe7647a[_0xb7f6('0x3d')],this['channels'][_0xe7647a[_0xb7f6('0x3d')]][_0xb7f6('0xb1')]);delete this[_0xb7f6('0x1c')][_0xe7647a[_0xb7f6('0x3d')]][_0xb7f6('0xae')];}}}}catch(_0x2b5dec){logger[_0xb7f6('0x32')]('[%s][voiceCallReport][musiconholdstop]',_0xe7647a[_0xb7f6('0x3d')],util[_0xb7f6('0x33')](_0x2b5dec,{'showHidden':![],'depth':null}));}};module[_0xb7f6('0xb2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 1171188..dea7d60 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7636=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','isUndefined','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','complete','total','answertime','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','[%s][voiceDialReport][hangup]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos'];(function(_0x3269fb,_0x59b766){var _0x3f80fc=function(_0x59eb8f){while(--_0x59eb8f){_0x3269fb['push'](_0x3269fb['shift']());}};_0x3f80fc(++_0x59b766);}(_0x7636,0x98));var _0x6763=function(_0x28d391,_0x1357b3){_0x28d391=_0x28d391-0x0;var _0x3c8bf0=_0x7636[_0x28d391];return _0x3c8bf0;};'use strict';var _=require(_0x6763('0x0'));var moment=require(_0x6763('0x1'));var util=require('util');var Redis=require(_0x6763('0x2'));var config=require(_0x6763('0x3'));var logger=require(_0x6763('0x4'))(_0x6763('0x5'));var ami=require(_0x6763('0x6'));config['redis']=_[_0x6763('0x7')](config['redis'],{'host':_0x6763('0x8'),'port':0x18eb});var io=require(_0x6763('0x9'))(new Redis(config[_0x6763('0xa')]));function VoiceDialReport(_0x24dac0){this['channels']=_0x24dac0[_0x6763('0xb')];this['outbound']=_0x24dac0[_0x6763('0xc')];this[_0x6763('0xd')]={};ami['on'](_0x6763('0xe'),this[_0x6763('0xf')][_0x6763('0x10')](this));ami['on'](_0x6763('0x11'),this[_0x6763('0x12')][_0x6763('0x10')](this));ami['on'](_0x6763('0x13'),this[_0x6763('0x14')][_0x6763('0x10')](this));ami['on'](_0x6763('0x15'),this[_0x6763('0x16')][_0x6763('0x10')](this));}VoiceDialReport[_0x6763('0x17')][_0x6763('0x18')]=function(_0xe77b88){return _0xe77b88!==null&&!_['isUndefined'](_0xe77b88);};VoiceDialReport[_0x6763('0x17')]['emit']=function(_0xc1d3ed,_0x4a271a,_0x5f1dbc){io['to'](_0xc1d3ed)[_0x6763('0x19')](_0x4a271a,_0x5f1dbc);};VoiceDialReport[_0x6763('0x17')][_0x6763('0xf')]=function(_0x2a1e30){try{if(this['isNotNull'](_0x2a1e30)){logger[_0x6763('0x1a')](_0x6763('0x1b'),_0x2a1e30[_0x6763('0x1c')],util[_0x6763('0x1d')](_0x2a1e30,{'showHidden':![],'depth':null}));if(this[_0x6763('0x1e')][_0x2a1e30['uniqueid']]){_['merge'](this['channels'][_0x2a1e30[_0x6763('0x1c')]],{'starttime':moment()[_0x6763('0x1f')](_0x6763('0x20')),'lastevent':_0x6763('0x21'),'interface':_0x2a1e30[_0x6763('0x22')]['substring'](0x0,_0x2a1e30[_0x6763('0x22')]['lastIndexOf']('-')),'membername':_0x2a1e30[_0x6763('0x22')][_0x6763('0x23')](_0x2a1e30[_0x6763('0x22')][_0x6763('0x24')]('/')+0x1,_0x2a1e30[_0x6763('0x22')][_0x6763('0x24')]('-'))},_[_0x6763('0x25')](_0x2a1e30,[_0x6763('0x26'),_0x6763('0x27')]));logger[_0x6763('0x28')](_0x6763('0x29'),_0x2a1e30['uniqueid'],this[_0x6763('0x1e')][_0x2a1e30[_0x6763('0x1c')]][_0x6763('0x2a')],this[_0x6763('0x1e')][_0x2a1e30[_0x6763('0x1c')]][_0x6763('0x2b')]);logger[_0x6763('0x1a')](_0x6763('0x2c'),_0x2a1e30[_0x6763('0x1c')],util[_0x6763('0x1d')](this[_0x6763('0x1e')][_0x2a1e30[_0x6763('0x1c')]],{'showHidden':![],'depth':null}));this[_0x6763('0x19')](_0x6763('0x2d'),'voice_outbound_channel:save',this[_0x6763('0x1e')][_0x2a1e30[_0x6763('0x1c')]]);logger[_0x6763('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x2a1e30['uniqueid'],util[_0x6763('0x1d')](this['channels'][_0x2a1e30['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x6763('0x2e'),this[_0x6763('0x1e')][_0x2a1e30['uniqueid']]);}}}catch(_0x596cd6){logger[_0x6763('0x2f')]('[%s][voiceDialReport][dialbegin]',_0x2a1e30[_0x6763('0x1c')],util[_0x6763('0x1d')](_0x596cd6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6763('0x17')][_0x6763('0x12')]=function(_0x20352c){try{if(this['isNotNull'](_0x20352c)){logger['debug'](_0x6763('0x30'),_0x20352c['uniqueid'],util[_0x6763('0x1d')](_0x20352c,{'showHidden':![],'depth':null}));if(this[_0x6763('0x1e')][_0x20352c['uniqueid']]){this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]][_0x6763('0x31')]=_0x20352c[_0x6763('0x31')];if(_0x20352c[_0x6763('0x31')]===_0x6763('0x32')){this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]][_0x6763('0x33')]=_0x20352c[_0x6763('0x33')];this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]][_0x6763('0x34')]=_0x20352c['connectedlinename'];this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]]['answertime']=moment()[_0x6763('0x1f')](_0x6763('0x20'));this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]][_0x6763('0x35')]=_0x6763('0x36');logger[_0x6763('0x28')](_0x6763('0x37'),_0x20352c['uniqueid'],_0x20352c['channel'][_0x6763('0x23')](_0x20352c[_0x6763('0x22')][_0x6763('0x24')]('/')+0x1,_0x20352c['channel']['lastIndexOf']('-')));logger[_0x6763('0x1a')](_0x6763('0x38'),_0x20352c[_0x6763('0x1c')],util[_0x6763('0x1d')](this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x6763('0x19')](_0x6763('0x39'),this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]]);}logger['debug'](_0x6763('0x3a'),_0x20352c[_0x6763('0x1c')],util['inspect'](this['channels'][_0x20352c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6763('0x19')](_0x6763('0x2d'),_0x6763('0x3b'),this[_0x6763('0x1e')][_0x20352c[_0x6763('0x1c')]]);}}}catch(_0x593b49){logger[_0x6763('0x2f')](_0x6763('0x3c'),_0x20352c[_0x6763('0x1c')],util['inspect'](_0x593b49,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6763('0x17')]['syncVarSet']=function(_0x7e8b32){try{if(this['isNotNull'](_0x7e8b32)){logger[_0x6763('0x1a')](_0x6763('0x3d'),_0x7e8b32[_0x6763('0x1c')],util[_0x6763('0x1d')](_0x7e8b32,{'showHidden':![],'depth':null}));this[_0x6763('0x3e')](_0x7e8b32['uniqueid'],_['keys'](_0x7e8b32[_0x6763('0x3f')])[0x0],_0x7e8b32['value']);if(this[_0x6763('0x18')](_0x7e8b32[_0x6763('0x3f')])&&this[_0x6763('0x18')](_0x7e8b32['variable'][_0x6763('0x40')])){if(_['isUndefined'](this[_0x6763('0x1e')][_0x7e8b32[_0x6763('0x1c')]])){this[_0x6763('0x1e')][_0x7e8b32['uniqueid']]={'routeId':_0x7e8b32[_0x6763('0x41')],'variables':this['variables'][_0x7e8b32[_0x6763('0x1c')]]};logger[_0x6763('0x28')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x7e8b32[_0x6763('0x1c')],_0x7e8b32['variable'][_0x6763('0x40')],_['keys'](_0x7e8b32[_0x6763('0x3f')])[0x0],_0x7e8b32['value']);logger[_0x6763('0x1a')](_0x6763('0x42'),_0x7e8b32['uniqueid'],util['inspect'](this['channels'][_0x7e8b32[_0x6763('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x6763('0x2d'),_0x6763('0x3b'),this[_0x6763('0x1e')][_0x7e8b32[_0x6763('0x1c')]]);}}}}catch(_0x2219e1){logger['error']('[%s][voiceDialReport][varset]',_0x7e8b32[_0x6763('0x1c')],util[_0x6763('0x1d')](_0x2219e1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6763('0x17')][_0x6763('0x3e')]=function(_0x31905f,_0x2bea41,_0x1d088c){var _0x2b33d6=[_0x6763('0x43'),_0x6763('0x44'),_0x6763('0x45'),_0x6763('0x46'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x6763('0x47'),_0x6763('0x48'),_0x6763('0x49'),_0x6763('0x4a'),_0x6763('0x4b'),'bridgepvtcallid',_0x6763('0x4c'),_0x6763('0x4d'),_0x6763('0x4e'),_0x6763('0x4f'),_0x6763('0x2a'),_0x6763('0x50'),'memberrealtime'];if(!_[_0x6763('0x51')](_0x2bea41)&&!_[_0x6763('0x52')](_0x2b33d6,_0x2bea41)){if(_[_0x6763('0x53')](this[_0x6763('0xd')][_0x31905f])){this[_0x6763('0xd')][_0x31905f]={};}this[_0x6763('0xd')][_0x31905f][_0x2bea41]=_0x1d088c;}};VoiceDialReport['prototype']['syncHangup']=function(_0x1306aa){try{if(this[_0x6763('0x18')](_0x1306aa)){logger[_0x6763('0x1a')]('[%s][voiceDialReport][hangup]\x20event:',_0x1306aa[_0x6763('0x1c')],util[_0x6763('0x1d')](_0x1306aa,{'showHidden':![],'depth':null}));if(this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]){logger[_0x6763('0x28')](_0x6763('0x54'),_0x1306aa[_0x6763('0x1c')],_0x1306aa[_0x6763('0x55')]);this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x56')]=moment()['format'](_0x6763('0x20'));this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]['duration']=moment(this['channels'][_0x1306aa[_0x6763('0x1c')]]['endtime'])[_0x6763('0x57')](this['channels'][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x58')],_0x6763('0x59'));this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x35')]=_0x6763('0x5a');this[_0x6763('0xc')][_0x6763('0x5b')]+=0x1;if(this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x5c')]){this[_0x6763('0xc')][_0x6763('0x5d')]+=0x1;this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]['holdtime']=moment(this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x5c')])[_0x6763('0x57')](this['channels'][_0x1306aa['uniqueid']]['starttime'],'seconds');this[_0x6763('0x1e')][_0x1306aa['uniqueid']][_0x6763('0x5e')]=moment(this['channels'][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x56')])[_0x6763('0x57')](this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]['answertime'],_0x6763('0x59'));this[_0x6763('0xc')][_0x6763('0x5f')]+=this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]][_0x6763('0x60')]||0x0;this['outbound'][_0x6763('0x61')]+=this[_0x6763('0x1e')][_0x1306aa['uniqueid']][_0x6763('0x5e')];}this[_0x6763('0xc')][_0x6763('0x62')]+=this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]['duration'];logger[_0x6763('0x1a')](_0x6763('0x63'),_0x1306aa['uniqueid'],util[_0x6763('0x1d')](this[_0x6763('0x1e')][_0x1306aa['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x6763('0x19')](_0x6763('0x64'),this[_0x6763('0x1e')][_0x1306aa['uniqueid']]);logger[_0x6763('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x1306aa['uniqueid'],util[_0x6763('0x1d')](this['channels'][_0x1306aa[_0x6763('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x6763('0x19')](_0x6763('0x65'),this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]);logger['debug'](_0x6763('0x66'),_0x1306aa[_0x6763('0x1c')],util[_0x6763('0x1d')](this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]],{'showHidden':![],'depth':null}));this[_0x6763('0x19')](_0x6763('0x2d'),_0x6763('0x67'),this[_0x6763('0xc')]);logger['info'](_0x6763('0x68'),JSON[_0x6763('0x69')](this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]));logger[_0x6763('0x1a')](_0x6763('0x6a'),_0x1306aa[_0x6763('0x1c')],util[_0x6763('0x1d')](this['channels'][_0x1306aa['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6763('0x19')]('voice:outbound','voice_outbound_channel:remove',this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]]);delete this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x1c')]];}else if(this['channels'][_0x1306aa[_0x6763('0x6b')]]){this['channels'][_0x1306aa[_0x6763('0x6b')]]['uniqueid']=this[_0x6763('0x1e')][_0x1306aa[_0x6763('0x6b')]]['destuniqueid'];}if(this[_0x6763('0xd')][_0x1306aa[_0x6763('0x1c')]]){delete this['variables'][_0x1306aa[_0x6763('0x1c')]];}}}catch(_0x404629){logger[_0x6763('0x2f')](_0x6763('0x6c'),_0x1306aa['uniqueid'],util['inspect'](_0x404629,{'showHidden':![],'depth':null}));}};module[_0x6763('0x6d')]=VoiceDialReport; \ No newline at end of file +var _0xd795=['addVariable','variable','outboundrouteid','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','starttime','seconds','complete','total','answered','diff','billableseconds','holdtime','sumBillable','sumDuration','duration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','channels','outbound','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','hangup','prototype','isUndefined','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xd795,0x1e5));var _0x5d79=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xd795[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x5d79('0x0'));var moment=require('moment');var util=require(_0x5d79('0x1'));var Redis=require(_0x5d79('0x2'));var config=require(_0x5d79('0x3'));var logger=require(_0x5d79('0x4'))('ami');var ami=require(_0x5d79('0x5'));config[_0x5d79('0x6')]=_[_0x5d79('0x7')](config['redis'],{'host':_0x5d79('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5d79('0x6')]));function VoiceDialReport(_0x39c34a){this[_0x5d79('0x9')]=_0x39c34a['outboundChannels'];this[_0x5d79('0xa')]=_0x39c34a[_0x5d79('0xa')];this['variables']={};ami['on'](_0x5d79('0xb'),this[_0x5d79('0xc')]['bind'](this));ami['on'](_0x5d79('0xd'),this[_0x5d79('0xe')][_0x5d79('0xf')](this));ami['on'](_0x5d79('0x10'),this['syncVarSet'][_0x5d79('0xf')](this));ami['on'](_0x5d79('0x11'),this['syncHangup']['bind'](this));}VoiceDialReport[_0x5d79('0x12')]['isNotNull']=function(_0x14ab18){return _0x14ab18!==null&&!_[_0x5d79('0x13')](_0x14ab18);};VoiceDialReport[_0x5d79('0x12')][_0x5d79('0x14')]=function(_0x5b66b7,_0x8c399c,_0x397090){io['to'](_0x5b66b7)[_0x5d79('0x14')](_0x8c399c,_0x397090);};VoiceDialReport['prototype'][_0x5d79('0xc')]=function(_0x469c32){try{if(this[_0x5d79('0x15')](_0x469c32)){logger['debug'](_0x5d79('0x16'),_0x469c32[_0x5d79('0x17')],util[_0x5d79('0x18')](_0x469c32,{'showHidden':![],'depth':null}));if(this[_0x5d79('0x9')][_0x469c32[_0x5d79('0x17')]]){_[_0x5d79('0x19')](this['channels'][_0x469c32[_0x5d79('0x17')]],{'starttime':moment()['format'](_0x5d79('0x1a')),'lastevent':_0x5d79('0x1b'),'interface':_0x469c32[_0x5d79('0x1c')][_0x5d79('0x1d')](0x0,_0x469c32['channel'][_0x5d79('0x1e')]('-')),'membername':_0x469c32['channel']['substring'](_0x469c32['channel']['lastIndexOf']('/')+0x1,_0x469c32[_0x5d79('0x1c')][_0x5d79('0x1e')]('-'))},_[_0x5d79('0x1f')](_0x469c32,[_0x5d79('0x20'),_0x5d79('0x21')]));logger[_0x5d79('0x22')](_0x5d79('0x23'),_0x469c32[_0x5d79('0x17')],this['channels'][_0x469c32[_0x5d79('0x17')]][_0x5d79('0x24')],this['channels'][_0x469c32[_0x5d79('0x17')]][_0x5d79('0x25')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x469c32['uniqueid'],util[_0x5d79('0x18')](this[_0x5d79('0x9')][_0x469c32[_0x5d79('0x17')]],{'showHidden':![],'depth':null}));this[_0x5d79('0x14')](_0x5d79('0x26'),'voice_outbound_channel:save',this[_0x5d79('0x9')][_0x469c32[_0x5d79('0x17')]]);logger[_0x5d79('0x27')](_0x5d79('0x28'),_0x469c32['uniqueid'],util[_0x5d79('0x18')](this[_0x5d79('0x9')][_0x469c32[_0x5d79('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5d79('0x14')](_0x5d79('0x29'),this[_0x5d79('0x9')][_0x469c32[_0x5d79('0x17')]]);}}}catch(_0x2699b0){logger[_0x5d79('0x2a')](_0x5d79('0x2b'),_0x469c32[_0x5d79('0x17')],util[_0x5d79('0x18')](_0x2699b0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5d79('0xe')]=function(_0x3158d4){try{if(this[_0x5d79('0x15')](_0x3158d4)){logger[_0x5d79('0x27')](_0x5d79('0x2c'),_0x3158d4[_0x5d79('0x17')],util[_0x5d79('0x18')](_0x3158d4,{'showHidden':![],'depth':null}));if(this[_0x5d79('0x9')][_0x3158d4[_0x5d79('0x17')]]){this[_0x5d79('0x9')][_0x3158d4[_0x5d79('0x17')]]['dialstatus']=_0x3158d4[_0x5d79('0x2d')];if(_0x3158d4['dialstatus']===_0x5d79('0x2e')){this['channels'][_0x3158d4[_0x5d79('0x17')]][_0x5d79('0x2f')]=_0x3158d4['connectedlinenum'];this[_0x5d79('0x9')][_0x3158d4[_0x5d79('0x17')]][_0x5d79('0x30')]=_0x3158d4[_0x5d79('0x30')];this[_0x5d79('0x9')][_0x3158d4[_0x5d79('0x17')]][_0x5d79('0x31')]=moment()[_0x5d79('0x32')](_0x5d79('0x1a'));this[_0x5d79('0x9')][_0x3158d4[_0x5d79('0x17')]][_0x5d79('0x33')]='connect';logger['info'](_0x5d79('0x34'),_0x3158d4['uniqueid'],_0x3158d4['channel']['substring'](_0x3158d4[_0x5d79('0x1c')][_0x5d79('0x1e')]('/')+0x1,_0x3158d4['channel'][_0x5d79('0x1e')]('-')));logger[_0x5d79('0x27')](_0x5d79('0x35'),_0x3158d4['uniqueid'],util[_0x5d79('0x18')](this['channels'][_0x3158d4['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5d79('0x14')](_0x5d79('0x36'),this['channels'][_0x3158d4['uniqueid']]);}logger[_0x5d79('0x27')](_0x5d79('0x37'),_0x3158d4[_0x5d79('0x17')],util[_0x5d79('0x18')](this[_0x5d79('0x9')][_0x3158d4[_0x5d79('0x17')]],{'showHidden':![],'depth':null}));this[_0x5d79('0x14')]('voice:outbound',_0x5d79('0x38'),this['channels'][_0x3158d4[_0x5d79('0x17')]]);}}}catch(_0x31a797){logger[_0x5d79('0x2a')](_0x5d79('0x39'),_0x3158d4[_0x5d79('0x17')],util[_0x5d79('0x18')](_0x31a797,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5d79('0x12')][_0x5d79('0x3a')]=function(_0x564fb9){try{if(this[_0x5d79('0x15')](_0x564fb9)){logger[_0x5d79('0x27')](_0x5d79('0x3b'),_0x564fb9[_0x5d79('0x17')],util[_0x5d79('0x18')](_0x564fb9,{'showHidden':![],'depth':null}));this[_0x5d79('0x3c')](_0x564fb9[_0x5d79('0x17')],_['keys'](_0x564fb9[_0x5d79('0x3d')])[0x0],_0x564fb9['value']);if(this['isNotNull'](_0x564fb9[_0x5d79('0x3d')])&&this['isNotNull'](_0x564fb9[_0x5d79('0x3d')][_0x5d79('0x3e')])){if(_['isUndefined'](this[_0x5d79('0x9')][_0x564fb9['uniqueid']])){this['channels'][_0x564fb9[_0x5d79('0x17')]]={'routeId':_0x564fb9[_0x5d79('0x3f')],'variables':this[_0x5d79('0x40')][_0x564fb9['uniqueid']]};logger[_0x5d79('0x22')](_0x5d79('0x41'),_0x564fb9[_0x5d79('0x17')],_0x564fb9[_0x5d79('0x3d')][_0x5d79('0x3e')],_[_0x5d79('0x42')](_0x564fb9[_0x5d79('0x3d')])[0x0],_0x564fb9[_0x5d79('0x3f')]);logger[_0x5d79('0x27')](_0x5d79('0x43'),_0x564fb9[_0x5d79('0x17')],util[_0x5d79('0x18')](this[_0x5d79('0x9')][_0x564fb9['uniqueid']],{'showHidden':![],'depth':null}));this[_0x5d79('0x14')](_0x5d79('0x26'),_0x5d79('0x38'),this[_0x5d79('0x9')][_0x564fb9[_0x5d79('0x17')]]);}}}}catch(_0xced3bf){logger[_0x5d79('0x2a')]('[%s][voiceDialReport][varset]',_0x564fb9[_0x5d79('0x17')],util['inspect'](_0xced3bf,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5d79('0x12')][_0x5d79('0x3c')]=function(_0x59948b,_0x5214ec,_0x3d0284){var _0x1085a7=[_0x5d79('0x44'),_0x5d79('0x45'),_0x5d79('0x46'),_0x5d79('0x47'),_0x5d79('0x48'),_0x5d79('0x49'),_0x5d79('0x4a'),_0x5d79('0x4b'),_0x5d79('0x4c'),_0x5d79('0x4d'),_0x5d79('0x4e'),_0x5d79('0x4f'),'membercalls',_0x5d79('0x50'),'memberinterface',_0x5d79('0x51'),_0x5d79('0x24'),_0x5d79('0x52'),_0x5d79('0x53')];if(!_['isNil'](_0x5214ec)&&!_[_0x5d79('0x54')](_0x1085a7,_0x5214ec)){if(_[_0x5d79('0x13')](this[_0x5d79('0x40')][_0x59948b])){this[_0x5d79('0x40')][_0x59948b]={};}this[_0x5d79('0x40')][_0x59948b][_0x5214ec]=_0x3d0284;}};VoiceDialReport[_0x5d79('0x12')][_0x5d79('0x55')]=function(_0x258b9e){try{if(this[_0x5d79('0x15')](_0x258b9e)){logger[_0x5d79('0x27')](_0x5d79('0x56'),_0x258b9e['uniqueid'],util['inspect'](_0x258b9e,{'showHidden':![],'depth':null}));if(this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]]){logger[_0x5d79('0x22')](_0x5d79('0x57'),_0x258b9e['uniqueid'],_0x258b9e['cause-txt']);this[_0x5d79('0x9')][_0x258b9e['uniqueid']]['endtime']=moment()[_0x5d79('0x32')](_0x5d79('0x1a'));this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]]['duration']=moment(this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x58')])['diff'](this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x59')],_0x5d79('0x5a'));this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x33')]=_0x5d79('0x5b');this[_0x5d79('0xa')][_0x5d79('0x5c')]+=0x1;if(this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x31')]){this['outbound'][_0x5d79('0x5d')]+=0x1;this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]]['holdtime']=moment(this['channels'][_0x258b9e['uniqueid']]['answertime'])[_0x5d79('0x5e')](this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x59')],_0x5d79('0x5a'));this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x5f')]=moment(this[_0x5d79('0x9')][_0x258b9e['uniqueid']][_0x5d79('0x58')])[_0x5d79('0x5e')](this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x31')],_0x5d79('0x5a'));this['outbound']['sumHoldTime']+=this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x60')]||0x0;this['outbound'][_0x5d79('0x61')]+=this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]]['billableseconds'];}this[_0x5d79('0xa')][_0x5d79('0x62')]+=this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]][_0x5d79('0x63')];logger[_0x5d79('0x27')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x258b9e[_0x5d79('0x17')],util[_0x5d79('0x18')](this['channels'][_0x258b9e['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5d79('0x14')](_0x5d79('0x64'),this[_0x5d79('0x9')][_0x258b9e['uniqueid']]);logger[_0x5d79('0x27')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x258b9e['uniqueid'],util[_0x5d79('0x18')](this['channels'][_0x258b9e[_0x5d79('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5d79('0x14')](_0x5d79('0x65'),this[_0x5d79('0x9')][_0x258b9e['uniqueid']]);logger[_0x5d79('0x27')](_0x5d79('0x66'),_0x258b9e[_0x5d79('0x17')],util[_0x5d79('0x18')](this['channels'][_0x258b9e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x5d79('0x14')](_0x5d79('0x26'),_0x5d79('0x67'),this[_0x5d79('0xa')]);logger[_0x5d79('0x22')](_0x5d79('0x68'),JSON['stringify'](this['channels'][_0x258b9e[_0x5d79('0x17')]]));logger[_0x5d79('0x27')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x258b9e[_0x5d79('0x17')],util[_0x5d79('0x18')](this[_0x5d79('0x9')][_0x258b9e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x5d79('0x14')](_0x5d79('0x26'),_0x5d79('0x69'),this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x17')]]);delete this[_0x5d79('0x9')][_0x258b9e['uniqueid']];}else if(this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x6a')]]){this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x6a')]]['uniqueid']=this[_0x5d79('0x9')][_0x258b9e[_0x5d79('0x6a')]]['destuniqueid'];}if(this[_0x5d79('0x40')][_0x258b9e['uniqueid']]){delete this['variables'][_0x258b9e['uniqueid']];}}}catch(_0x32c14a){logger[_0x5d79('0x2a')](_0x5d79('0x6b'),_0x258b9e['uniqueid'],util[_0x5d79('0x18')](_0x32c14a,{'showHidden':![],'depth':null}));}};module[_0x5d79('0x6c')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4e9b160..b3d5f06 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3646=['[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','keys','push','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','linkedid','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','value','variable','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','BLINDTRANSFER','diff','length','milliseconds','total','queuecallercompleteAt','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','md5','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','hasOwnProperty','talking','pTalking','waiting','unlockRR','prototype','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','Trunk','Interval','stringify','debug','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]','queue'];(function(_0x3e8848,_0x392aab){var _0x477a5d=function(_0x1f693c){while(--_0x1f693c){_0x3e8848['push'](_0x3e8848['shift']());}};_0x477a5d(++_0x392aab);}(_0x3646,0x15f));var _0x6364=function(_0x2aa896,_0x519091){_0x2aa896=_0x2aa896-0x0;var _0x320399=_0x3646[_0x2aa896];return _0x320399;};'use strict';var _=require(_0x6364('0x0'));var moment=require(_0x6364('0x1'));var util=require(_0x6364('0x2'));var md5=require(_0x6364('0x3'));var Redis=require('ioredis');var config=require(_0x6364('0x4'));var logger=require(_0x6364('0x5'))(_0x6364('0x6'));var ami=require(_0x6364('0x7'));var QueueReport=require(_0x6364('0x8'));config[_0x6364('0x9')]=_[_0x6364('0xa')](config[_0x6364('0x9')],{'host':_0x6364('0xb'),'port':0x18eb});var io=require(_0x6364('0xc'))(new Redis(config[_0x6364('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x6364('0xd')]=function(_0x24706f){this[_0x6364('0xe')]=this[_0x6364('0xe')]?this['tail']['finally'](_0x24706f):_0x24706f();};function VoiceQueueReport(_0x51998c){this[_0x6364('0xf')]=new Sequence();this[_0x6364('0x10')]={};this[_0x6364('0x11')]=_0x51998c[_0x6364('0x11')];this[_0x6364('0x12')]=_0x51998c[_0x6364('0x13')];this[_0x6364('0x14')]=_0x51998c['voiceQueues'];this[_0x6364('0x15')]=!![];this[_0x6364('0x16')]=_0x51998c[_0x6364('0x16')];this['variables']={};ami['on'](_0x6364('0x17'),this[_0x6364('0x18')][_0x6364('0x19')](this));ami['on'](_0x6364('0x1a'),this['syncQueueSummaryComplete'][_0x6364('0x19')](this));ami['on']('queuecallerjoin',this[_0x6364('0x1b')][_0x6364('0x19')](this));ami['on'](_0x6364('0x1c'),this['syncQueueCallerAbandon'][_0x6364('0x19')](this));ami['on'](_0x6364('0x1d'),this[_0x6364('0x1e')][_0x6364('0x19')](this));ami['on'](_0x6364('0x1f'),this[_0x6364('0x20')][_0x6364('0x19')](this));ami['on']('agentconnect',this[_0x6364('0x21')]['bind'](this));ami['on'](_0x6364('0x22'),this[_0x6364('0x23')][_0x6364('0x19')](this));ami['on'](_0x6364('0x24'),this[_0x6364('0x25')]['bind'](this));ami['on'](_0x6364('0x26'),this[_0x6364('0x27')]['bind'](this));ami['on'](_0x6364('0x28'),this['syncMusicOnHoldStart'][_0x6364('0x19')](this));ami['on'](_0x6364('0x29'),this[_0x6364('0x2a')][_0x6364('0x19')](this));ami['on'](_0x6364('0x2b'),this[_0x6364('0x2c')][_0x6364('0x19')](this));ami['on']('blindtransfer',this[_0x6364('0x2d')]['bind'](this));this[_0x6364('0x2e')]();this[_0x6364('0x2f')]();}function clearChannels(_0x374c01){if(!_['isEmpty'](_0x374c01)){for(var _0x1baf99 in _0x374c01){if(_0x374c01['hasOwnProperty'](_0x1baf99)){delete _0x374c01[_0x1baf99];}}}}function clearCampaigns(_0x32c3e8){if(!_[_0x6364('0x30')](_0x32c3e8)){for(var _0x4028d8 in _0x32c3e8){if(_0x32c3e8['hasOwnProperty'](_0x4028d8)){_0x32c3e8[_0x4028d8][_0x6364('0x31')]=0x0;}}}}function clearVoiceQueues(_0x548ef2){if(!_[_0x6364('0x30')](_0x548ef2)){for(var _0x585bbb in _0x548ef2){if(_0x548ef2[_0x6364('0x32')](_0x585bbb)){_0x548ef2[_0x585bbb]['originated']=0x0;_0x548ef2[_0x585bbb][_0x6364('0x33')]=0x0;_0x548ef2[_0x585bbb][_0x6364('0x34')]=0x0;_0x548ef2[_0x585bbb][_0x6364('0x35')]=0x0;_0x548ef2[_0x585bbb]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xd879a7){if(!_[_0x6364('0x30')](_0xd879a7)){for(var _0x265106 in _0xd879a7){if(_0xd879a7['hasOwnProperty'](_0x265106)){_0xd879a7[_0x265106][_0x6364('0x36')]=!![];}}}}VoiceQueueReport[_0x6364('0x37')]['clearZombieChannels']=function(){var _0x221544=this;for(var _0x34b612 in this[_0x6364('0x12')]){if(this[_0x6364('0x12')][_0x6364('0x32')](_0x34b612)&&!this[_0x6364('0x12')][_0x34b612][_0x6364('0x38')]){this[_0x6364('0xf')]['enqueue'](function(){if(!_[_0x6364('0x39')](_0x221544[_0x6364('0x12')][_0x34b612])){return ami[_0x6364('0x3a')]({'action':_0x6364('0x3b'),'channel':_0x221544['channels'][_0x34b612][_0x6364('0x3c')]})[_0x6364('0x3d')](function(_0x314d04){if(_0x314d04[_0x6364('0x3e')]===_0x6364('0x3f')){setTimeout(function(){if(_0x221544[_0x6364('0x12')][_0x34b612]){delete _0x221544[_0x6364('0x12')][_0x34b612];logger['error'](_0x6364('0x40'),_0x34b612,util[_0x6364('0x41')](_0x314d04,{'showHidden':![],'depth':null}));}if(_0x221544[_0x6364('0x10')][_0x34b612]){delete _0x221544[_0x6364('0x10')][_0x34b612];logger[_0x6364('0x42')](_0x6364('0x43'),_0x34b612,util['inspect'](_0x314d04,{'showHidden':![],'depth':null}));}if(_0x221544[_0x6364('0x44')][_0x34b612]){delete _0x221544[_0x6364('0x44')][_0x34b612];logger['error'](_0x6364('0x45'),_0x34b612,util['inspect'](_0x314d04,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x27')]=function(){logger[_0x6364('0x42')](_0x6364('0x46'));clearChannels(this[_0x6364('0x12')]);this[_0x6364('0x47')](this[_0x6364('0x10')]);clearAgentBooked(this['agents']);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x2dd785){var _0x784b32=this;if(!_[_0x6364('0x30')](_0x2dd785)){for(var _0x484f54 in _0x2dd785){if(_0x2dd785['hasOwnProperty'](_0x484f54)){_0x784b32['emitVoiceQueueChannelRemove'](_0x2dd785[_0x484f54],_0x6364('0x48'));delete _0x2dd785[_0x484f54];}}}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x49')]=function(_0xfc6934,_0x268211,_0x1dee57){io['to'](_0xfc6934)['emit'](_0x268211,_0x1dee57);};VoiceQueueReport[_0x6364('0x37')]['emitVoiceQueueChannelSave']=function(_0x463077,_0x341582){logger['debug'](_0x6364('0x4a')+_0x341582+_0x6364('0x4b'),_0x463077[_0x6364('0x4c')],util[_0x6364('0x41')](_0x463077,{'showHidden':![],'depth':null}));this['emit'](util[_0x6364('0x4d')](_0x6364('0x4e'),_0x463077[_0x6364('0x4f')]),'voice_queue_channel:save',_0x463077);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x57c4a8,_0x191d40){logger['debug'](_0x6364('0x4a')+_0x191d40+_0x6364('0x50'),_0x57c4a8[_0x6364('0x4c')],util[_0x6364('0x41')](_0x57c4a8,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x6364('0x4e'),_0x57c4a8[_0x6364('0x4f')]),_0x6364('0x51'),_0x57c4a8);};VoiceQueueReport[_0x6364('0x37')]['emitVoiceQueueSummary']=function(_0x2b5b10,_0x562421){if(_0x2b5b10['type']==='inbound'){var _0x2ddf99={'id':_0x2b5b10['id'],'name':_0x2b5b10[_0x6364('0x4f')],'strategy':_0x2b5b10[_0x6364('0x52')],'answered':_0x2b5b10[_0x6364('0x53')],'available':_0x2b5b10[_0x6364('0x54')],'loggedIn':_0x2b5b10[_0x6364('0x55')],'pTalking':_0x2b5b10[_0x6364('0x34')],'sumBillable':_0x2b5b10[_0x6364('0x56')],'sumDuration':_0x2b5b10[_0x6364('0x57')],'sumHoldTime':_0x2b5b10[_0x6364('0x58')]||0x0,'talking':_0x2b5b10['talking'],'total':_0x2b5b10['total'],'type':_0x2b5b10[_0x6364('0x59')],'unmanaged':_0x2b5b10[_0x6364('0x5a')],'abandoned':_0x2b5b10[_0x6364('0x5b')],'waiting':_0x2b5b10['waiting']};if(_0x2b5b10[_0x6364('0x5c')]){_0x2ddf99[_0x6364('0x5c')]={'id':_0x2b5b10['Trunk']['id'],'name':_0x2b5b10[_0x6364('0x5c')]['name'],'active':_0x2b5b10[_0x6364('0x5c')]['active'],'callerid':_0x2b5b10['Trunk']['callerid']};}if(_0x2b5b10[_0x6364('0x5d')]){_0x2ddf99[_0x6364('0x5d')]={'id':_0x2b5b10[_0x6364('0x5d')]['id'],'name':_0x2b5b10[_0x6364('0x5d')][_0x6364('0x4f')]};}var _0x5aa0d1=md5(JSON[_0x6364('0x5e')](_0x2ddf99));if(_0x2b5b10[_0x6364('0x3')]!==_0x5aa0d1){_0x2b5b10[_0x6364('0x3')]=_0x5aa0d1;logger[_0x6364('0x5f')](_0x6364('0x60')+_0x562421+_0x6364('0x61'),util['inspect'](_0x2ddf99,{'showHidden':![],'depth':null}));this['emit'](util[_0x6364('0x4d')](_0x6364('0x4e'),_0x2ddf99[_0x6364('0x4f')]),_0x6364('0x62'),_0x2ddf99);}}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x63')]=function(_0x5dcaa9){return _0x5dcaa9!==null&&!_[_0x6364('0x64')](_0x5dcaa9);};VoiceQueueReport['prototype'][_0x6364('0x2f')]=function(){var _0x579641=this;setInterval(function(){_0x579641[_0x6364('0x65')]();ami[_0x6364('0x3a')]({'action':'queues'})[_0x6364('0x3d')](function(_0x439a4c){logger[_0x6364('0x42')](_0x6364('0x66'),util[_0x6364('0x41')](_0x439a4c,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x2e')]=function(){var _0x1b73d6=this;setInterval(function(){if(_0x1b73d6[_0x6364('0x15')]){return ami[_0x6364('0x3a')]({'action':_0x6364('0x17')})['then'](function(_0x3e0e2e){_0x1b73d6[_0x6364('0x15')]=![];})[_0x6364('0x3d')](function(_0x457c1b){logger[_0x6364('0x42')](_0x6364('0x67'),util[_0x6364('0x41')](_0x457c1b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x6364('0x18')]=function(_0x463e8e){try{if(this[_0x6364('0x63')](_0x463e8e)&&this[_0x6364('0x63')](_0x463e8e[_0x6364('0x68')])){logger['debug'](_0x6364('0x69'),util['inspect'](_0x463e8e,{'showHidden':![],'depth':null}));if(this[_0x6364('0x14')][_0x463e8e['queue']]){logger[_0x6364('0x6a')](_0x6364('0x6b'),_0x463e8e[_0x6364('0x68')]);var _0x78f6f0=_['countBy'](this['channels'],'queue')[_0x463e8e[_0x6364('0x68')]]||0x0;var _0x467c77=_0x78f6f0-_0x463e8e[_0x6364('0x6c')];if(this[_0x6364('0x14')][_0x463e8e['queue']]['waiting']!==_[_0x6364('0x6d')](_0x463e8e['callers'])||this[_0x6364('0x14')][_0x463e8e[_0x6364('0x68')]][_0x6364('0x55')]!==_['toNumber'](_0x463e8e[_0x6364('0x6e')])||this[_0x6364('0x14')][_0x463e8e['queue']][_0x6364('0x54')]!==_[_0x6364('0x6d')](_0x463e8e['available'])||this[_0x6364('0x14')][_0x463e8e[_0x6364('0x68')]][_0x6364('0x33')]!==_0x467c77){this[_0x6364('0x14')][_0x463e8e['queue']]['waiting']=_[_0x6364('0x6d')](_0x463e8e['callers']);this['voiceQueues'][_0x463e8e[_0x6364('0x68')]][_0x6364('0x55')]=_[_0x6364('0x6d')](_0x463e8e[_0x6364('0x6e')]);this['voiceQueues'][_0x463e8e['queue']][_0x6364('0x54')]=_[_0x6364('0x6d')](_0x463e8e['available']);this[_0x6364('0x14')][_0x463e8e[_0x6364('0x68')]]['talking']=_0x467c77>0x0?_0x467c77:0x0;this[_0x6364('0x14')][_0x463e8e[_0x6364('0x68')]]['talking']=this[_0x6364('0x14')][_0x463e8e['queue']][_0x6364('0x33')]>_['toNumber'](_0x463e8e[_0x6364('0x6e')])?_[_0x6364('0x6d')](_0x463e8e[_0x6364('0x6e')]):this['voiceQueues'][_0x463e8e[_0x6364('0x68')]]['talking'];this[_0x6364('0x6f')](this[_0x6364('0x14')][_0x463e8e[_0x6364('0x68')]],_0x6364('0x17'));}logger[_0x6364('0x5f')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x6364('0x41')](this[_0x6364('0x14')][_0x463e8e[_0x6364('0x68')]],{'showHidden':![],'depth':null}));ami[_0x6364('0x49')](_0x6364('0x70'),this[_0x6364('0x14')][_0x463e8e['queue']]);}}}catch(_0x28bbf8){logger[_0x6364('0x42')]('[voiceQueueReport][queuesummary]',util[_0x6364('0x41')](_0x28bbf8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6364('0x71')]=function(_0x25aaa3){logger[_0x6364('0x5f')](_0x6364('0x72'),util['inspect'](_0x25aaa3,{'showHidden':![],'depth':null}));this[_0x6364('0x15')]=!![];};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x1b')]=function(_0x3ef11b){try{if(this[_0x6364('0x63')](_0x3ef11b)){logger[_0x6364('0x5f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3ef11b[_0x6364('0x4c')],util[_0x6364('0x41')](_0x3ef11b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x3ef11b[_0x6364('0x4c')]])){this[_0x6364('0x10')][_0x3ef11b[_0x6364('0x4c')]]=[];this['channels'][_0x3ef11b[_0x6364('0x4c')]]={};}var _0x337d9d=new QueueReport();_0x337d9d[_0x6364('0x4f')]=_0x3ef11b[_0x6364('0x68')];_0x337d9d[_0x6364('0x59')]=this[_0x6364('0x14')][_0x337d9d[_0x6364('0x4f')]]&&this[_0x6364('0x14')][_0x337d9d[_0x6364('0x4f')]][_0x6364('0x59')]?this[_0x6364('0x14')][_0x337d9d[_0x6364('0x4f')]]['type']||'inbound':_0x6364('0x73');_0x337d9d[_0x6364('0x68')]=_0x3ef11b[_0x6364('0x68')];_0x337d9d[_0x6364('0x74')]=moment()[_0x6364('0x4d')](_0x6364('0x75'));_0x337d9d['position']=_0x3ef11b[_0x6364('0x76')];_0x337d9d[_0x6364('0x77')]=_0x3ef11b[_0x6364('0x77')];_0x337d9d[_0x6364('0x4c')]=_0x3ef11b[_0x6364('0x4c')];logger['info'](_0x6364('0x78'),_0x337d9d[_0x6364('0x4f')],_0x337d9d[_0x6364('0x59')]);_[_0x6364('0x79')](_0x337d9d,_['pick'](_0x3ef11b,_[_0x6364('0x7a')](_0x337d9d)));this[_0x6364('0x10')][_0x3ef11b[_0x6364('0x4c')]][_0x6364('0x7b')](_0x337d9d);this[_0x6364('0x12')][_0x3ef11b[_0x6364('0x4c')]]=_0x337d9d;this[_0x6364('0x7c')](_0x337d9d,_0x6364('0x7d'));}}catch(_0x1453ec){logger[_0x6364('0x42')](_0x6364('0x7e'),_0x3ef11b[_0x6364('0x4c')],util[_0x6364('0x41')](_0x1453ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6364('0x7f')]=function(_0x22f007){try{if(this[_0x6364('0x63')](_0x22f007)){logger[_0x6364('0x5f')](_0x6364('0x80'),_0x22f007[_0x6364('0x4c')],util[_0x6364('0x41')](_0x22f007,{'showHidden':![],'depth':null}));if(this[_0x6364('0x10')][_0x22f007[_0x6364('0x4c')]]){var _0x2bf995=_[_0x6364('0x81')](this[_0x6364('0x10')][_0x22f007[_0x6364('0x4c')]]);_0x2bf995['queuecallercomplete']=![];_0x2bf995['queuecallercompleteAt']=null;_0x2bf995[_0x6364('0x82')]=_0x22f007[_0x6364('0x82')];_0x2bf995[_0x6364('0x83')]=_0x22f007[_0x6364('0x83')];_0x2bf995[_0x6364('0x1c')]=!![];_0x2bf995['queuecallerabandonAt']=moment()[_0x6364('0x4d')](_0x6364('0x75'));_0x2bf995[_0x6364('0x84')]=_0x6364('0x85');_0x2bf995[_0x6364('0x86')]=null;logger[_0x6364('0x6a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2bf995[_0x6364('0x4f')],_0x2bf995[_0x6364('0x59')]);this[_0x6364('0x12')][_0x22f007['uniqueid']]=_0x2bf995;this[_0x6364('0x87')](_0x2bf995,_0x6364('0x1c'));}}}catch(_0x365d1e){logger[_0x6364('0x42')](_0x6364('0x80'),_0x22f007[_0x6364('0x4c')],util[_0x6364('0x41')](_0x365d1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x1e')]=function(_0x4fb155){try{if(this[_0x6364('0x63')](_0x4fb155)){logger[_0x6364('0x5f')](_0x6364('0x88'),_0x4fb155['uniqueid'],util[_0x6364('0x41')](_0x4fb155,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4fb155[_0x6364('0x4c')]]){var _0x5b2985=_[_0x6364('0x81')](this['queueReports'][_0x4fb155['uniqueid']]);_0x5b2985[_0x6364('0x89')]=moment()[_0x6364('0x4d')](_0x6364('0x75'));_0x5b2985['connectedlinenum']=_0x4fb155[_0x6364('0x8a')];_0x5b2985[_0x6364('0x8b')]=_0x4fb155[_0x6364('0x8b')];logger['info'](_0x6364('0x8c'),_0x5b2985[_0x6364('0x4f')],_0x5b2985[_0x6364('0x59')],_0x4fb155[_0x6364('0x8a')],_0x4fb155[_0x6364('0x8b')]);this['channels'][_0x4fb155[_0x6364('0x4c')]]=_0x5b2985;this[_0x6364('0x7c')](_0x5b2985,_0x6364('0x1d'));}}}catch(_0xd45ad7){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x4fb155['uniqueid'],util['inspect'](_0xd45ad7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x21')]=function(_0x5d5fde){try{if(this[_0x6364('0x63')](_0x5d5fde)){logger[_0x6364('0x5f')](_0x6364('0x8d'),_0x5d5fde['uniqueid'],util['inspect'](_0x5d5fde,{'showHidden':![],'depth':null}));if(this[_0x6364('0x10')][_0x5d5fde[_0x6364('0x4c')]]){var _0x495ba5=_[_0x6364('0x81')](this[_0x6364('0x10')][_0x5d5fde[_0x6364('0x4c')]]);_0x495ba5[_0x6364('0x8e')]=!![];_0x495ba5['queuecallerexitreason']=_0x6364('0x8f');logger[_0x6364('0x6a')](_0x6364('0x90'),_0x495ba5['name'],_0x495ba5[_0x6364('0x59')]);}}}catch(_0x4947e2){logger[_0x6364('0x42')](_0x6364('0x8d'),_0x5d5fde[_0x6364('0x4c')],util[_0x6364('0x41')](_0x4947e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x20')]=function(_0xfe04c){try{if(this[_0x6364('0x63')](_0xfe04c)){logger[_0x6364('0x5f')](_0x6364('0x91'),_0xfe04c[_0x6364('0x4c')],util[_0x6364('0x41')](_0xfe04c,{'showHidden':![],'depth':null}));if(this[_0x6364('0x10')][_0xfe04c[_0x6364('0x4c')]]){var _0x3db63a=_[_0x6364('0x81')](this['queueReports'][_0xfe04c['uniqueid']]);_0x3db63a[_0x6364('0x1c')]=![];_0x3db63a[_0x6364('0x92')]=null;_0x3db63a[_0x6364('0x93')]=!![];_0x3db63a[_0x6364('0x86')]=_0xfe04c[_0x6364('0x94')];_0x3db63a[_0x6364('0x82')]=_0xfe04c[_0x6364('0x82')];_0x3db63a['queuecallercomplete']=!![];_0x3db63a[_0x6364('0x95')]=![];_0x3db63a[_0x6364('0x96')]=null;if(!_0x3db63a['transfer']){if(_0xfe04c['reason']==_0x6364('0x97')){_0x3db63a[_0x6364('0x84')]=_0x6364('0x98');logger[_0x6364('0x6a')](_0x6364('0x99'),_0x3db63a[_0x6364('0x4f')],_0x3db63a[_0x6364('0x59')]);}else{if(_['startsWith'](_0xfe04c['channel'][_0x6364('0x9a')](),'local/')){if(this[_0x6364('0x10')][_0xfe04c['linkedid']]){var _0x4a3135=_[_0x6364('0x81')](this[_0x6364('0x10')][_0xfe04c['linkedid']]);_0x4a3135[_0x6364('0x8e')]=![];_0x4a3135['queuecallerexit']=!![];_0x4a3135[_0x6364('0x96')]=moment(_0x3db63a['queuecallerjoinAt'])[_0x6364('0x9b')](_0xfe04c[_0x6364('0x82')],_0x6364('0x9c'))['format'](_0x6364('0x75'));_0x4a3135[_0x6364('0x84')]=_0x6364('0x9d');_0x4a3135[_0x6364('0x97')]=!![];_0x4a3135[_0x6364('0x9e')]=_0x6364('0x9f');_0x4a3135[_0x6364('0xa0')]=_0xfe04c[_0x6364('0xa1')];_0x4a3135[_0x6364('0xa2')]=_0xfe04c[_0x6364('0x4c')];logger[_0x6364('0x6a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4a3135[_0x6364('0x4f')],_0x4a3135['type']);var _0x1d9898=this['queueReports'][_0xfe04c[_0x6364('0xa3')]];this[_0x6364('0x10')][_0xfe04c['linkedid']]=this[_0x6364('0x10')][_0xfe04c[_0x6364('0x4c')]];this[_0x6364('0x10')][_0xfe04c[_0x6364('0x4c')]]=_0x1d9898;}}else{_0x3db63a['queuecallerexitreason']='COMPLETEDBY'+_0xfe04c[_0x6364('0xa4')][_0x6364('0xa5')]();logger[_0x6364('0x6a')](_0x6364('0xa6'),_0x3db63a[_0x6364('0x4f')],_0x3db63a[_0x6364('0x59')],_0x3db63a[_0x6364('0x84')]);}}}this['channels'][_0xfe04c[_0x6364('0x4c')]]=_0x3db63a;this[_0x6364('0x87')](_0x3db63a,_0x6364('0x1f'));}}}catch(_0x3040a9){logger[_0x6364('0x42')](_0x6364('0x91'),_0xfe04c[_0x6364('0x4c')],util[_0x6364('0x41')](_0x3040a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6364('0x37')][_0x6364('0x23')]=function(_0x3cc374){try{if(this[_0x6364('0x63')](_0x3cc374)){logger[_0x6364('0x5f')](_0x6364('0xa7'),_0x3cc374[_0x6364('0x4c')],util[_0x6364('0x41')](_0x3cc374,{'showHidden':![],'depth':null}));this[_0x6364('0xa8')](_0x3cc374[_0x6364('0x4c')],_[_0x6364('0x7a')](_0x3cc374['variable'])[0x0],_0x3cc374[_0x6364('0xa9')]);if(this['queueReports'][_0x3cc374[_0x6364('0x4c')]]){var _0x43e00f=_[_0x6364('0x81')](this['queueReports'][_0x3cc374[_0x6364('0x4c')]]);if(_0x43e00f){if(this[_0x6364('0x63')](_0x3cc374[_0x6364('0xaa')])&&this['isNotNull'](_0x3cc374[_0x6364('0xaa')][_0x6364('0xab')])){switch(_0x3cc374[_0x6364('0xa9')]){case _0x6364('0xac'):_0x43e00f[_0x6364('0x95')]=![];_0x43e00f['queuecallerexitAt']=null;break;case _0x6364('0xad'):_0x43e00f[_0x6364('0xae')]=_0x6364('0xaf');_0x43e00f['queuecallerexit']=!![];_0x43e00f[_0x6364('0x96')]=moment()[_0x6364('0x4d')](_0x6364('0x75'));_0x43e00f[_0x6364('0x89')]=moment()[_0x6364('0x4d')](_0x6364('0x75'));logger[_0x6364('0x5f')](_0x6364('0xb0'),_0x3cc374['uniqueid'],util[_0x6364('0x41')](_0x43e00f,{'showHidden':![],'depth':null}));ami[_0x6364('0x49')](_0x6364('0xb1'),_0x43e00f);break;default:_0x43e00f[_0x6364('0x95')]=!![];_0x43e00f['queuecallerexitAt']=moment()[_0x6364('0x4d')](_0x6364('0x75'));_0x43e00f['queuecallerleaveAt']=moment()[_0x6364('0x4d')](_0x6364('0x75'));}_0x43e00f['queuecallerabandon']=![];_0x43e00f['queuecallerabandonAt']=null;_0x43e00f[_0x6364('0x84')]=_0x3cc374[_0x6364('0xa9')];this[_0x6364('0x12')][_0x3cc374[_0x6364('0x4c')]]=_0x43e00f;this[_0x6364('0x87')](_0x43e00f,_0x6364('0x22'));}else if(this[_0x6364('0x63')](_0x3cc374[_0x6364('0xaa')])&&this[_0x6364('0x63')](_0x3cc374[_0x6364('0xaa')]['queueposition'])){if(!_0x43e00f['queuecallerabandon']){_0x43e00f[_0x6364('0x95')]=!![];_0x43e00f[_0x6364('0x96')]=moment()[_0x6364('0x4d')](_0x6364('0x75'));_0x43e00f[_0x6364('0x84')]=_0x6364('0xb2');_0x43e00f[_0x6364('0x89')]=moment()[_0x6364('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3cc374[_0x6364('0x4c')]]=_0x43e00f;}}logger[_0x6364('0x6a')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3cc374[_0x6364('0x4c')],_0x43e00f[_0x6364('0x4f')],_0x43e00f[_0x6364('0x59')],_['keys'](_0x3cc374['variable'])[0x0],_0x3cc374[_0x6364('0xa9')]);_0x43e00f[_0x6364('0x44')]=this[_0x6364('0x44')][_0x3cc374[_0x6364('0x4c')]];}}}}catch(_0x107a8a){logger[_0x6364('0x42')](_0x6364('0xa7'),_0x3cc374[_0x6364('0x4c')],util[_0x6364('0x41')](_0x107a8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6364('0x37')]['addVariable']=function(_0x3b3dd8,_0x569251,_0x1c6463){var _0x38537b=[_0x6364('0xb3'),_0x6364('0xb4'),_0x6364('0xb5'),_0x6364('0xb6'),_0x6364('0xb7'),'rtpaudioqoslossbridged',_0x6364('0xb8'),_0x6364('0xb9'),'sipcallid',_0x6364('0xba'),'bridgepeer',_0x6364('0xbb'),'membercalls',_0x6364('0xbc'),_0x6364('0xbd'),_0x6364('0xbe'),_0x6364('0x94'),_0x6364('0xbf'),_0x6364('0xc0')];if(!_[_0x6364('0x39')](_0x569251)&&!_[_0x6364('0xc1')](_0x38537b,_0x569251)){if(_[_0x6364('0x64')](this[_0x6364('0x44')][_0x3b3dd8])){this[_0x6364('0x44')][_0x3b3dd8]={};}this[_0x6364('0x44')][_0x3b3dd8][_0x569251]=_0x1c6463;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x56ceb0){try{if(this[_0x6364('0x63')](_0x56ceb0)){logger[_0x6364('0x5f')](_0x6364('0xc2'),_0x56ceb0['uniqueid'],util['inspect'](_0x56ceb0,{'showHidden':![],'depth':null}));if(this[_0x6364('0x10')][_0x56ceb0[_0x6364('0x4c')]]){for(var _0x2147cc=0x0,_0xe99b6b={};_0x2147cc0x0?_0x4b8562:0x0;this[_0x7532('0x12')][_0x35aa5b[_0x7532('0x61')]][_0x7532('0x2f')]=this[_0x7532('0x12')][_0x35aa5b['queue']][_0x7532('0x2f')]>_[_0x7532('0x66')](_0x35aa5b[_0x7532('0x68')])?_[_0x7532('0x66')](_0x35aa5b[_0x7532('0x68')]):this[_0x7532('0x12')][_0x35aa5b[_0x7532('0x61')]][_0x7532('0x2f')];this[_0x7532('0x69')](this['voiceQueues'][_0x35aa5b[_0x7532('0x61')]],_0x7532('0x14'));}logger[_0x7532('0x44')](_0x7532('0x6a'),util[_0x7532('0x37')](this[_0x7532('0x12')][_0x35aa5b[_0x7532('0x61')]],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this[_0x7532('0x12')][_0x35aa5b['queue']]);}}}catch(_0x36977f){logger[_0x7532('0x38')](_0x7532('0x6b'),util['inspect'](_0x36977f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x18')]=function(_0x2281aa){logger[_0x7532('0x44')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x2281aa,{'showHidden':![],'depth':null}));this[_0x7532('0x5e')]=!![];};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x6c')]=function(_0x161f4d){try{if(this[_0x7532('0x5a')](_0x161f4d)){logger[_0x7532('0x44')]('[%s][voiceQueueReport][queuecallerjoin]',_0x161f4d['uniqueid'],util[_0x7532('0x37')](_0x161f4d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7532('0xf')][_0x161f4d[_0x7532('0x41')]])){this[_0x7532('0xf')][_0x161f4d[_0x7532('0x41')]]=[];this['channels'][_0x161f4d[_0x7532('0x41')]]={};}var _0x3b4c32=new QueueReport();_0x3b4c32[_0x7532('0x43')]=_0x161f4d[_0x7532('0x61')];_0x3b4c32['type']=this[_0x7532('0x12')][_0x3b4c32['name']]&&this[_0x7532('0x12')][_0x3b4c32[_0x7532('0x43')]][_0x7532('0x49')]?this[_0x7532('0x12')][_0x3b4c32[_0x7532('0x43')]][_0x7532('0x49')]||_0x7532('0x4a'):'inbound';_0x3b4c32['queue']=_0x161f4d[_0x7532('0x61')];_0x3b4c32['queuecallerjoinAt']=moment()[_0x7532('0x46')](_0x7532('0x6d'));_0x3b4c32['position']=_0x161f4d[_0x7532('0x6e')];_0x3b4c32[_0x7532('0x6f')]=_0x161f4d[_0x7532('0x6f')];_0x3b4c32[_0x7532('0x41')]=_0x161f4d['uniqueid'];logger[_0x7532('0x70')](_0x7532('0x71'),_0x3b4c32[_0x7532('0x43')],_0x3b4c32[_0x7532('0x49')]);_[_0x7532('0x72')](_0x3b4c32,_['pick'](_0x161f4d,_[_0x7532('0x73')](_0x3b4c32)));this['queueReports'][_0x161f4d[_0x7532('0x41')]][_0x7532('0x74')](_0x3b4c32);this['channels'][_0x161f4d[_0x7532('0x41')]]=_0x3b4c32;this[_0x7532('0x75')](_0x3b4c32,_0x7532('0x19'));}}catch(_0x52e403){logger[_0x7532('0x38')]('[%s][voiceQueueReport][queuecallerjoin]',_0x161f4d[_0x7532('0x41')],util[_0x7532('0x37')](_0x52e403,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x1b')]=function(_0x30e536){try{if(this[_0x7532('0x5a')](_0x30e536)){logger[_0x7532('0x44')](_0x7532('0x76'),_0x30e536[_0x7532('0x41')],util[_0x7532('0x37')](_0x30e536,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x30e536['uniqueid']]){var _0x494b92=_['last'](this[_0x7532('0xf')][_0x30e536['uniqueid']]);_0x494b92[_0x7532('0x77')]=![];_0x494b92[_0x7532('0x78')]=null;_0x494b92['holdtime']=_0x30e536[_0x7532('0x79')];_0x494b92[_0x7532('0x7a')]=_0x30e536[_0x7532('0x7a')];_0x494b92['queuecallerabandon']=!![];_0x494b92['queuecallerabandonAt']=moment()[_0x7532('0x46')](_0x7532('0x6d'));_0x494b92['queuecallerexitreason']='ABANDONED';_0x494b92[_0x7532('0x7b')]=null;logger['info'](_0x7532('0x7c'),_0x494b92['name'],_0x494b92[_0x7532('0x49')]);this['channels'][_0x30e536[_0x7532('0x41')]]=_0x494b92;this['emitVoiceQueueChannelRemove'](_0x494b92,_0x7532('0x1a'));}}}catch(_0x49d692){logger[_0x7532('0x38')](_0x7532('0x76'),_0x30e536[_0x7532('0x41')],util[_0x7532('0x37')](_0x49d692,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x1d')]=function(_0x4af9ec){try{if(this[_0x7532('0x5a')](_0x4af9ec)){logger['debug'](_0x7532('0x7d'),_0x4af9ec['uniqueid'],util[_0x7532('0x37')](_0x4af9ec,{'showHidden':![],'depth':null}));if(this[_0x7532('0xf')][_0x4af9ec[_0x7532('0x41')]]){var _0x270e70=_['last'](this['queueReports'][_0x4af9ec[_0x7532('0x41')]]);_0x270e70[_0x7532('0x7e')]=moment()[_0x7532('0x46')](_0x7532('0x6d'));_0x270e70[_0x7532('0x7f')]=_0x4af9ec[_0x7532('0x7f')];_0x270e70[_0x7532('0x80')]=_0x4af9ec[_0x7532('0x80')];logger[_0x7532('0x70')](_0x7532('0x81'),_0x270e70[_0x7532('0x43')],_0x270e70[_0x7532('0x49')],_0x4af9ec[_0x7532('0x7f')],_0x4af9ec[_0x7532('0x80')]);this['channels'][_0x4af9ec[_0x7532('0x41')]]=_0x270e70;this[_0x7532('0x75')](_0x270e70,_0x7532('0x1c'));}}}catch(_0x15d700){logger[_0x7532('0x38')](_0x7532('0x7d'),_0x4af9ec[_0x7532('0x41')],util['inspect'](_0x15d700,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x82')]=function(_0x5ae8c4){try{if(this[_0x7532('0x5a')](_0x5ae8c4)){logger[_0x7532('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x5ae8c4[_0x7532('0x41')],util[_0x7532('0x37')](_0x5ae8c4,{'showHidden':![],'depth':null}));if(this[_0x7532('0xf')][_0x5ae8c4[_0x7532('0x41')]]){var _0x17fd50=_['last'](this[_0x7532('0xf')][_0x5ae8c4[_0x7532('0x41')]]);_0x17fd50['queuecallercomplete']=!![];_0x17fd50[_0x7532('0x83')]=_0x7532('0x84');logger[_0x7532('0x70')](_0x7532('0x85'),_0x17fd50[_0x7532('0x43')],_0x17fd50[_0x7532('0x49')]);}}}catch(_0x2f7dc0){logger[_0x7532('0x38')](_0x7532('0x86'),_0x5ae8c4[_0x7532('0x41')],util['inspect'](_0x2f7dc0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x1f')]=function(_0xfdfb42){try{if(this[_0x7532('0x5a')](_0xfdfb42)){logger[_0x7532('0x44')](_0x7532('0x87'),_0xfdfb42[_0x7532('0x41')],util[_0x7532('0x37')](_0xfdfb42,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xfdfb42[_0x7532('0x41')]]){var _0x457e57=_[_0x7532('0x88')](this[_0x7532('0xf')][_0xfdfb42[_0x7532('0x41')]]);_0x457e57[_0x7532('0x1a')]=![];_0x457e57['queuecallerabandonAt']=null;_0x457e57[_0x7532('0x89')]=!![];_0x457e57[_0x7532('0x7b')]=_0xfdfb42[_0x7532('0x8a')];_0x457e57['holdtime']=_0xfdfb42[_0x7532('0x79')];_0x457e57[_0x7532('0x77')]=!![];_0x457e57[_0x7532('0x8b')]=![];_0x457e57[_0x7532('0x8c')]=null;if(!_0x457e57[_0x7532('0x8d')]){if(_0xfdfb42[_0x7532('0x8e')]==_0x7532('0x8d')){_0x457e57[_0x7532('0x83')]=_0x7532('0x8f');logger['info'](_0x7532('0x90'),_0x457e57[_0x7532('0x43')],_0x457e57[_0x7532('0x49')]);}else{if(_['startsWith'](_0xfdfb42[_0x7532('0x91')]['toLowerCase'](),_0x7532('0x92'))){if(this[_0x7532('0xf')][_0xfdfb42[_0x7532('0x93')]]){var _0x6dc4d6=_[_0x7532('0x88')](this[_0x7532('0xf')][_0xfdfb42[_0x7532('0x93')]]);_0x6dc4d6['queuecallercomplete']=![];_0x6dc4d6['queuecallerexit']=!![];_0x6dc4d6[_0x7532('0x8c')]=moment(_0x457e57['queuecallerjoinAt'])[_0x7532('0x94')](_0xfdfb42['holdtime'],'seconds')[_0x7532('0x46')](_0x7532('0x6d'));_0x6dc4d6[_0x7532('0x83')]=_0x7532('0x95');_0x6dc4d6['transfer']=!![];_0x6dc4d6['transfertype']=_0x7532('0x96');_0x6dc4d6[_0x7532('0x97')]=_0xfdfb42[_0x7532('0x98')];_0x6dc4d6[_0x7532('0x99')]=_0xfdfb42[_0x7532('0x41')];logger[_0x7532('0x70')](_0x7532('0x9a'),_0x6dc4d6['name'],_0x6dc4d6['type']);var _0x1e4100=this[_0x7532('0xf')][_0xfdfb42['linkedid']];this[_0x7532('0xf')][_0xfdfb42[_0x7532('0x93')]]=this[_0x7532('0xf')][_0xfdfb42[_0x7532('0x41')]];this[_0x7532('0xf')][_0xfdfb42[_0x7532('0x41')]]=_0x1e4100;}}else{_0x457e57[_0x7532('0x83')]=_0x7532('0x9b')+_0xfdfb42[_0x7532('0x8e')][_0x7532('0x9c')]();logger[_0x7532('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x457e57[_0x7532('0x43')],_0x457e57['type'],_0x457e57[_0x7532('0x83')]);}}}this[_0x7532('0x11')][_0xfdfb42[_0x7532('0x41')]]=_0x457e57;this[_0x7532('0x9d')](_0x457e57,_0x7532('0x1e'));}}}catch(_0x654325){logger[_0x7532('0x38')](_0x7532('0x87'),_0xfdfb42['uniqueid'],util[_0x7532('0x37')](_0x654325,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x56f22a){try{if(this[_0x7532('0x5a')](_0x56f22a)){logger[_0x7532('0x44')](_0x7532('0x9e'),_0x56f22a['uniqueid'],util[_0x7532('0x37')](_0x56f22a,{'showHidden':![],'depth':null}));this['addVariable'](_0x56f22a['uniqueid'],_[_0x7532('0x73')](_0x56f22a[_0x7532('0x9f')])[0x0],_0x56f22a[_0x7532('0xa0')]);if(this[_0x7532('0xf')][_0x56f22a['uniqueid']]){var _0xadac1e=_[_0x7532('0x88')](this[_0x7532('0xf')][_0x56f22a['uniqueid']]);if(_0xadac1e){if(this[_0x7532('0x5a')](_0x56f22a[_0x7532('0x9f')])&&this[_0x7532('0x5a')](_0x56f22a[_0x7532('0x9f')]['queuestatus'])){switch(_0x56f22a[_0x7532('0xa0')]){case'CONTINUE':_0xadac1e['queuecallerexit']=![];_0xadac1e[_0x7532('0x8c')]=null;break;case _0x7532('0xa1'):_0xadac1e[_0x7532('0xa2')]=_0x7532('0xa3');_0xadac1e[_0x7532('0x8b')]=!![];_0xadac1e[_0x7532('0x8c')]=moment()[_0x7532('0x46')](_0x7532('0x6d'));_0xadac1e[_0x7532('0x7e')]=moment()[_0x7532('0x46')](_0x7532('0x6d'));logger[_0x7532('0x44')](_0x7532('0xa4'),_0x56f22a[_0x7532('0x41')],util[_0x7532('0x37')](_0xadac1e,{'showHidden':![],'depth':null}));ami['emit'](_0x7532('0xa5'),_0xadac1e);break;default:_0xadac1e['queuecallerexit']=!![];_0xadac1e[_0x7532('0x8c')]=moment()[_0x7532('0x46')](_0x7532('0x6d'));_0xadac1e['queuecallerleaveAt']=moment()[_0x7532('0x46')](_0x7532('0x6d'));}_0xadac1e[_0x7532('0x1a')]=![];_0xadac1e['queuecallerabandonAt']=null;_0xadac1e['queuecallerexitreason']=_0x56f22a[_0x7532('0xa0')];this[_0x7532('0x11')][_0x56f22a[_0x7532('0x41')]]=_0xadac1e;this[_0x7532('0x9d')](_0xadac1e,_0x7532('0x21'));}else if(this[_0x7532('0x5a')](_0x56f22a[_0x7532('0x9f')])&&this[_0x7532('0x5a')](_0x56f22a[_0x7532('0x9f')]['queueposition'])){if(!_0xadac1e[_0x7532('0x1a')]){_0xadac1e['queuecallerexit']=!![];_0xadac1e[_0x7532('0x8c')]=moment()[_0x7532('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xadac1e[_0x7532('0x83')]='EXITWITHKEY';_0xadac1e[_0x7532('0x7e')]=moment()[_0x7532('0x46')](_0x7532('0x6d'));this[_0x7532('0x11')][_0x56f22a[_0x7532('0x41')]]=_0xadac1e;}}logger[_0x7532('0x70')](_0x7532('0xa6'),_0x56f22a[_0x7532('0x41')],_0xadac1e[_0x7532('0x43')],_0xadac1e[_0x7532('0x49')],_[_0x7532('0x73')](_0x56f22a[_0x7532('0x9f')])[0x0],_0x56f22a[_0x7532('0xa0')]);_0xadac1e[_0x7532('0x3a')]=this[_0x7532('0x3a')][_0x56f22a[_0x7532('0x41')]];}}}}catch(_0x4ce5d4){logger[_0x7532('0x38')](_0x7532('0x9e'),_0x56f22a[_0x7532('0x41')],util[_0x7532('0x37')](_0x4ce5d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7532('0x3c')]['addVariable']=function(_0x3c2a21,_0x222e44,_0x3353c8){var _0x52a863=['rtpaudioqos','rtpaudioqosbridged',_0x7532('0xa7'),_0x7532('0xa8'),_0x7532('0xa9'),_0x7532('0xaa'),_0x7532('0xab'),_0x7532('0xac'),_0x7532('0xad'),_0x7532('0xae'),_0x7532('0xaf'),_0x7532('0xb0'),'membercalls',_0x7532('0xb1'),_0x7532('0xb2'),_0x7532('0xb3'),_0x7532('0x8a'),_0x7532('0xb4'),_0x7532('0xb5')];if(!_[_0x7532('0x32')](_0x222e44)&&!_[_0x7532('0xb6')](_0x52a863,_0x222e44)){if(_[_0x7532('0xb7')](this['variables'][_0x3c2a21])){this[_0x7532('0x3a')][_0x3c2a21]={};}this['variables'][_0x3c2a21][_0x222e44]=_0x3353c8;}};VoiceQueueReport[_0x7532('0x3c')][_0x7532('0x24')]=function(_0x363f72){try{if(this[_0x7532('0x5a')](_0x363f72)){logger[_0x7532('0x44')]('[%s][voiceQueueReport][hangup]',_0x363f72[_0x7532('0x41')],util['inspect'](_0x363f72,{'showHidden':![],'depth':null}));if(this[_0x7532('0xf')][_0x363f72[_0x7532('0x41')]]){for(var _0x1c58a6=0x0,_0x17ddad={};_0x1c58a6=0x0?moment(_0x19abfa[_0x1346('0x18')])['diff'](_0x19abfa[_0x1346('0x19')],_0x1346('0x1a')):null,'data1':_0x1346('0x1b'),'data2':_0x19abfa['accountcode'],'data3':_0x19abfa['exten'],'data4':_0x19abfa[_0x1346('0x1c')]||null,'role':_0x1346('0x1d'),'internal':_0x19abfa[_0x1346('0x13')]?_[_0x1346('0x14')](_0x19abfa[_0x1346('0x13')]):undefined,'uniqueid':_0x19abfa[_0x1346('0x1e')]},'log':_0x1346('0x15')});}; \ No newline at end of file +var _0x0acf=['CreateMemberReport','voiceDialReport','membername','starttime','endtime','diff','outbound','dialstring','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','calleridnum','exten','queue','agent','accountcode','toNumber'];(function(_0x2deb01,_0x4e741c){var _0x3920b3=function(_0x391a64){while(--_0x391a64){_0x2deb01['push'](_0x2deb01['shift']());}};_0x3920b3(++_0x4e741c);}(_0x0acf,0x13f));var _0xf0ac=function(_0x35a441,_0x3a2ec6){_0x35a441=_0x35a441-0x0;var _0x571ce3=_0x0acf[_0x35a441];return _0x571ce3;};'use strict';var moment=require(_0xf0ac('0x0'));var _=require(_0xf0ac('0x1'));var util=require(_0xf0ac('0x2'));var client=require(_0xf0ac('0x3'));exports[_0xf0ac('0x4')]=function(_0x865f79){var _0x5039fc=_0x865f79['queuecallercompleteAt']||_0x865f79[_0xf0ac('0x5')];return client[_0xf0ac('0x6')]('CreateMemberReport',{'body':{'channel':_0xf0ac('0x7'),'membername':_0x865f79[_0xf0ac('0x8')],'interface':_[_0xf0ac('0x9')](_0x865f79[_0xf0ac('0xa')])?util[_0xf0ac('0xb')](_0xf0ac('0xc'),_0x865f79[_0xf0ac('0x8')]):_0x865f79['interface'],'type':_0xf0ac('0xd'),'enterAt':_0x865f79[_0xf0ac('0xe')],'exitAt':_0x5039fc,'duration':moment(_0x5039fc)['diff'](_0x865f79[_0xf0ac('0xe')],_0xf0ac('0xf')),'data1':'inbound','data2':_0x865f79[_0xf0ac('0x10')],'data3':_0x865f79[_0xf0ac('0x11')],'data4':null,'data5':_0x865f79[_0xf0ac('0x12')],'role':_0xf0ac('0x13'),'internal':_0x865f79[_0xf0ac('0x14')]?_[_0xf0ac('0x15')](_0x865f79['accountcode']):undefined,'uniqueid':_0x865f79['uniqueid']},'log':_0xf0ac('0x16')});};exports[_0xf0ac('0x17')]=function(_0x4c47f7){return client[_0xf0ac('0x6')](_0xf0ac('0x16'),{'body':{'channel':_0xf0ac('0x7'),'membername':_0x4c47f7[_0xf0ac('0x18')],'interface':_0x4c47f7[_0xf0ac('0xa')],'type':'TALKING','enterAt':_0x4c47f7[_0xf0ac('0x19')],'exitAt':_0x4c47f7[_0xf0ac('0x1a')],'duration':moment(_0x4c47f7[_0xf0ac('0x1a')])[_0xf0ac('0x1b')](_0x4c47f7[_0xf0ac('0x19')],_0xf0ac('0xf'))>=0x0?moment(_0x4c47f7[_0xf0ac('0x1a')])[_0xf0ac('0x1b')](_0x4c47f7['starttime'],_0xf0ac('0xf')):null,'data1':_0xf0ac('0x1c'),'data2':_0x4c47f7[_0xf0ac('0x14')],'data3':_0x4c47f7[_0xf0ac('0x11')],'data4':_0x4c47f7[_0xf0ac('0x1d')]||null,'role':_0xf0ac('0x13'),'internal':_0x4c47f7['accountcode']?_['toNumber'](_0x4c47f7['accountcode']):undefined,'uniqueid':_0x4c47f7[_0xf0ac('0x1e')]},'log':_0xf0ac('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 92e5bcb..114550f 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 _0xfc03=['html','../client','GetTemplate'];(function(_0x36767a,_0x12df0e){var _0x46c0e3=function(_0x502d7c){while(--_0x502d7c){_0x36767a['push'](_0x36767a['shift']());}};_0x46c0e3(++_0x12df0e);}(_0xfc03,0x16f));var _0x3fc0=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xfc03[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require(_0x3fc0('0x0'));exports['getTemplates']=function(_0x5b3d80){return function(_0x27411e){return client['Request'](_0x3fc0('0x1'),{'options':{'raw':!![],'attributes':['id','name',_0x3fc0('0x2')]},'log':_0x3fc0('0x1')});};}; \ No newline at end of file +var _0x4fad=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x4fad,0xcb));var _0xd4fa=function(_0x45352d,_0x1c79f1){_0x45352d=_0x45352d-0x0;var _0xda7a70=_0x4fad[_0x45352d];return _0xda7a70;};'use strict';var client=require(_0xd4fa('0x0'));exports[_0xd4fa('0x1')]=function(_0x398f3c){return function(_0x5ee49f){return client[_0xd4fa('0x2')](_0xd4fa('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd4fa('0x4'),_0xd4fa('0x5')]},'log':_0xd4fa('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d152a8f..abda41a 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 _0x06a0=['data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data1','data2','data6'];(function(_0x29ab82,_0x453cfa){var _0x5cfd62=function(_0x3c6cdf){while(--_0x3c6cdf){_0x29ab82['push'](_0x29ab82['shift']());}};_0x5cfd62(++_0x453cfa);}(_0x06a0,0x1c3));var _0x006a=function(_0x4a782b,_0x55584a){_0x4a782b=_0x4a782b-0x0;var _0x5cb5a0=_0x06a0[_0x4a782b];return _0x5cb5a0;};'use strict';var client=require(_0x006a('0x0'));exports[_0x006a('0x1')]=function(_0x1bea7d){return function(_0x5040be){return client[_0x006a('0x2')](_0x006a('0x3'),{'options':{'raw':![],'attributes':['id',_0x006a('0x4'),_0x006a('0x5'),'status'],'include':[{'model':_0x006a('0x6'),'as':_0x006a('0x7'),'attributes':['id',_0x006a('0x8'),_0x006a('0x9'),_0x006a('0xa')]},{'model':_0x006a('0x6'),'as':_0x006a('0xb'),'attributes':['id',_0x006a('0x8'),_0x006a('0x9'),_0x006a('0xa')]},{'model':_0x006a('0xc'),'as':_0x006a('0xd'),'attributes':['id','action',_0x006a('0xe'),_0x006a('0xf'),'data3','data4','data5',_0x006a('0x10'),_0x006a('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x3bb1=['getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data3','data4','data5','data6','data7','../client'];(function(_0x1a6c83,_0x257f26){var _0x58c994=function(_0x52efe6){while(--_0x52efe6){_0x1a6c83['push'](_0x1a6c83['shift']());}};_0x58c994(++_0x257f26);}(_0x3bb1,0x1df));var _0x13bb=function(_0x2afa5e,_0x3b01c0){_0x2afa5e=_0x2afa5e-0x0;var _0xa21dc8=_0x3bb1[_0x2afa5e];return _0xa21dc8;};'use strict';var client=require(_0x13bb('0x0'));exports[_0x13bb('0x1')]=function(_0x259e72){return function(_0x2fef24){return client['Request'](_0x13bb('0x2'),{'options':{'raw':![],'attributes':['id',_0x13bb('0x3'),_0x13bb('0x4'),_0x13bb('0x5')],'include':[{'model':_0x13bb('0x6'),'as':_0x13bb('0x7'),'attributes':['id',_0x13bb('0x8'),_0x13bb('0x9'),_0x13bb('0xa')]},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0x13bb('0x9'),'value']},{'model':_0x13bb('0xb'),'as':_0x13bb('0xc'),'attributes':['id',_0x13bb('0xd'),_0x13bb('0xe'),'data2',_0x13bb('0xf'),_0x13bb('0x10'),_0x13bb('0x11'),_0x13bb('0x12'),_0x13bb('0x13')]}]},'log':_0x13bb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 185e36f..e09b83b 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 _0x7ec0=['GetTrunk','../client','Request','registry'];(function(_0x2dd0d8,_0x46460f){var _0x46a8bb=function(_0x316f59){while(--_0x316f59){_0x2dd0d8['push'](_0x2dd0d8['shift']());}};_0x46a8bb(++_0x46460f);}(_0x7ec0,0x159));var _0x07ec=function(_0x59f57f,_0x4ba9dd){_0x59f57f=_0x59f57f-0x0;var _0x17acfc=_0x7ec0[_0x59f57f];return _0x17acfc;};'use strict';var client=require(_0x07ec('0x0'));exports['getTrunks']=function(_0x37c7c1){return function(_0x275a3d){return client[_0x07ec('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x07ec('0x2')]},'log':_0x07ec('0x3')});};}; \ No newline at end of file +var _0x4a7f=['../client','getTrunks','Request','GetTrunk','registry'];(function(_0x53666a,_0x7c9d81){var _0x304a0c=function(_0x1f2d9b){while(--_0x1f2d9b){_0x53666a['push'](_0x53666a['shift']());}};_0x304a0c(++_0x7c9d81);}(_0x4a7f,0x1d6));var _0xf4a7=function(_0xccd4cb,_0x294db6){_0xccd4cb=_0xccd4cb-0x0;var _0x2fad4c=_0x4a7f[_0xccd4cb];return _0x2fad4c;};'use strict';var client=require(_0xf4a7('0x0'));exports[_0xf4a7('0x1')]=function(_0x22240c){return function(_0x4a11ae){return client[_0xf4a7('0x2')](_0xf4a7('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf4a7('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3f1f079..ce0b873 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 _0x04bf=['mobile','interface','telephone','getTelephones','savePause','PauseUser','ShowUser','getAgent','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone'];(function(_0x3972dd,_0x298e3f){var _0x3a29c8=function(_0x461387){while(--_0x461387){_0x3972dd['push'](_0x3972dd['shift']());}};_0x3a29c8(++_0x298e3f);}(_0x04bf,0x1a6));var _0xf04b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x04bf[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xf04b('0x0'));exports[_0xf04b('0x1')]=function(){return function(){return client[_0xf04b('0x2')](_0xf04b('0x3'),{'options':{'raw':![],'where':{'role':_0xf04b('0x4')},'attributes':['id',_0xf04b('0x5'),_0xf04b('0x6'),_0xf04b('0x7'),_0xf04b('0x8'),_0xf04b('0x9'),_0xf04b('0xa'),_0xf04b('0xb'),_0xf04b('0xc'),_0xf04b('0xd'),_0xf04b('0xe'),_0xf04b('0xf'),_0xf04b('0x10')]},'log':_0xf04b('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xf04b('0x3'),{'options':{'raw':!![],'where':{'role':_0xf04b('0x11')},'attributes':['id',_0xf04b('0x5'),_0xf04b('0x7'),'internal']},'log':_0xf04b('0x12')});};};exports[_0xf04b('0x13')]=function(_0x2d0c35,_0x35b0c6,_0x1505e5){return client['Request'](_0xf04b('0x14'),{'body':{'type':_0x35b0c6,'uniqueid':_0x1505e5},'options':{'where':{'id':_0x2d0c35['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x5cf5bf){return client[_0xf04b('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5cf5bf['id']}},'log':'savePause'});};exports['getAgent']=function(_0x1f81a8){return client[_0xf04b('0x2')](_0xf04b('0x15'),{'options':{'raw':![],'where':{'role':_0xf04b('0x4'),'id':_0x1f81a8},'attributes':['id',_0xf04b('0x5'),_0xf04b('0x6'),_0xf04b('0x7'),_0xf04b('0x8'),'online',_0xf04b('0xa'),_0xf04b('0xb'),_0xf04b('0xc'),_0xf04b('0xd'),_0xf04b('0x10')]},'log':_0xf04b('0x16')});}; \ No newline at end of file +var _0x425e=['phone','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname','lastLoginAt','../client','getAgents','Request','GetUser','agent','name','email','accountcode','online','pauseType','lastPauseAt','voicePause'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x425e,0x1ac));var _0xe425=function(_0x5ed362,_0x154b84){_0x5ed362=_0x5ed362-0x0;var _0x82e3cd=_0x425e[_0x5ed362];return _0x82e3cd;};'use strict';var client=require(_0xe425('0x0'));exports[_0xe425('0x1')]=function(){return function(){return client[_0xe425('0x2')](_0xe425('0x3'),{'options':{'raw':![],'where':{'role':_0xe425('0x4')},'attributes':['id',_0xe425('0x5'),_0xe425('0x6'),_0xe425('0x7'),'fullname',_0xe425('0x8'),'lastLoginAt',_0xe425('0x9'),_0xe425('0xa'),_0xe425('0xb'),_0xe425('0xc'),'mobile','interface']},'log':_0xe425('0x1')});};};exports[_0xe425('0xd')]=function(){return function(){return client[_0xe425('0x2')](_0xe425('0x3'),{'options':{'raw':!![],'where':{'role':_0xe425('0xe')},'attributes':['id',_0xe425('0x5'),_0xe425('0x7'),_0xe425('0xf')]},'log':_0xe425('0xd')});};};exports['savePause']=function(_0x2a5e91,_0x556f12,_0x11922c){return client['Request'](_0xe425('0x10'),{'body':{'type':_0x556f12,'uniqueid':_0x11922c},'options':{'where':{'id':_0x2a5e91['id']}},'log':_0xe425('0x11')});};exports['saveUnpause']=function(_0x5ab58d){return client[_0xe425('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5ab58d['id']}},'log':_0xe425('0x11')});};exports[_0xe425('0x12')]=function(_0x489f2d){return client['Request'](_0xe425('0x13'),{'options':{'raw':![],'where':{'role':_0xe425('0x4'),'id':_0x489f2d},'attributes':['id',_0xe425('0x5'),_0xe425('0x6'),_0xe425('0x7'),_0xe425('0x14'),_0xe425('0x8'),_0xe425('0x15'),'pauseType',_0xe425('0xa'),'voicePause','interface']},'log':_0xe425('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 09b11aa..62b3155 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 _0x9f47=['UpdateVoiceAgentReport','Request','CreateVoiceAgentReport','update'];(function(_0x3f6db8,_0x2eb5fe){var _0x32b843=function(_0x3a1359){while(--_0x3a1359){_0x3f6db8['push'](_0x3f6db8['shift']());}};_0x32b843(++_0x2eb5fe);}(_0x9f47,0x1e9));var _0x79f4=function(_0xfe1cf1,_0x547c17){_0xfe1cf1=_0xfe1cf1-0x0;var _0x52041c=_0x9f47[_0xfe1cf1];return _0x52041c;};'use strict';var client=require('../client');exports['create']=function(_0x3a227a){return client[_0x79f4('0x0')](_0x79f4('0x1'),{'body':_0x3a227a,'log':_0x79f4('0x1')});};exports[_0x79f4('0x2')]=function(_0x587078,_0x503c01,_0x2aeecd){return client[_0x79f4('0x0')](_0x79f4('0x3'),{'body':_0x587078,'options':{'where':{'uniqueid':_0x503c01,'interface':_0x2aeecd,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x4902=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4902,0xa9));var _0x2490=function(_0x400a3d,_0x376549){_0x400a3d=_0x400a3d-0x0;var _0x25fb8a=_0x4902[_0x400a3d];return _0x25fb8a;};'use strict';var client=require(_0x2490('0x0'));exports[_0x2490('0x1')]=function(_0x59ebbe){return client[_0x2490('0x2')](_0x2490('0x3'),{'body':_0x59ebbe,'log':'CreateVoiceAgentReport'});};exports[_0x2490('0x4')]=function(_0x2b26ff,_0x468b05,_0x1d9a51){return client[_0x2490('0x2')]('UpdateVoiceAgentReport',{'body':_0x2b26ff,'options':{'where':{'uniqueid':_0x468b05,'interface':_0x1d9a51,'agentcomplete':!![]}},'log':_0x2490('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e7c808a..1464050 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 _0xa1e3=['util','../client','calleridnum','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','billableseconds','GetVoiceCallReports'];(function(_0x5779dd,_0x3e6fdc){var _0xc84315=function(_0xa2db05){while(--_0xa2db05){_0x5779dd['push'](_0x5779dd['shift']());}};_0xc84315(++_0x3e6fdc);}(_0xa1e3,0x80));var _0x3a1e=function(_0x4ab726,_0x3b3e57){_0x4ab726=_0x4ab726-0x0;var _0x42ed8c=_0xa1e3[_0x4ab726];return _0x42ed8c;};'use strict';var moment=require('moment');var util=require(_0x3a1e('0x0'));var _=require('lodash');var client=require(_0x3a1e('0x1'));exports['create']=function(_0x1d1ef5){return client['Request']('CreateVoiceCallReport',{'body':_['merge'](_0x1d1ef5,{'source':_0x1d1ef5[_0x3a1e('0x2')],'destinationcontext':_0x1d1ef5['context'],'callerid':_0x1d1ef5['callerid'],'amaflags':_0x3a1e('0x3')}),'log':_0x3a1e('0x4')});};exports[_0x3a1e('0x5')]=function(){return function(){return client[_0x3a1e('0x6')](_0x3a1e('0x7'),{'options':{'where':{'type':[_0x3a1e('0x8')],'createdAt':{'$between':[moment()['startOf'](_0x3a1e('0x9'))[_0x3a1e('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3a1e('0xb')](_0x3a1e('0x9'))['format'](_0x3a1e('0xc'))]}},'attributes':['type',_0x3a1e('0xd'),'duration',_0x3a1e('0xe')]},'log':_0x3a1e('0xf')});};}; \ No newline at end of file +var _0xeeb9=['calleridnum','context','callerid','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x287450,_0x6257e8){var _0x106a4d=function(_0x5c337f){while(--_0x5c337f){_0x287450['push'](_0x287450['shift']());}};_0x106a4d(++_0x6257e8);}(_0xeeb9,0x110));var _0x9eeb=function(_0x245442,_0x58e21d){_0x245442=_0x245442-0x0;var _0x5d6463=_0xeeb9[_0x245442];return _0x5d6463;};'use strict';var moment=require(_0x9eeb('0x0'));var util=require(_0x9eeb('0x1'));var _=require(_0x9eeb('0x2'));var client=require(_0x9eeb('0x3'));exports[_0x9eeb('0x4')]=function(_0x486230){return client[_0x9eeb('0x5')](_0x9eeb('0x6'),{'body':_[_0x9eeb('0x7')](_0x486230,{'source':_0x486230[_0x9eeb('0x8')],'destinationcontext':_0x486230[_0x9eeb('0x9')],'callerid':_0x486230[_0x9eeb('0xa')],'amaflags':'DOCUMENTATION'}),'log':_0x9eeb('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9eeb('0x5')](_0x9eeb('0xb'),{'options':{'where':{'type':[_0x9eeb('0xc')],'createdAt':{'$between':[moment()[_0x9eeb('0xd')](_0x9eeb('0xe'))[_0x9eeb('0xf')](_0x9eeb('0x10')),moment()[_0x9eeb('0x11')]('day')[_0x9eeb('0xf')](_0x9eeb('0x10'))]}},'attributes':[_0x9eeb('0x12'),'disposition',_0x9eeb('0x13'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a265423..684e9c5 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 _0x9e0b=['create','Request','CreateVoiceDialReport'];(function(_0x142ab4,_0x133efe){var _0x238aa6=function(_0x4c32aa){while(--_0x4c32aa){_0x142ab4['push'](_0x142ab4['shift']());}};_0x238aa6(++_0x133efe);}(_0x9e0b,0x147));var _0xb9e0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9e0b[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0xb9e0('0x0')]=function(_0x278026){return client[_0xb9e0('0x1')](_0xb9e0('0x2'),{'body':_0x278026,'log':_0xb9e0('0x2')});}; \ No newline at end of file +var _0xedaa=['Request','CreateVoiceDialReport','../client','create'];(function(_0x4bd0da,_0x4fd852){var _0xeb867f=function(_0x1522a0){while(--_0x1522a0){_0x4bd0da['push'](_0x4bd0da['shift']());}};_0xeb867f(++_0x4fd852);}(_0xedaa,0x152));var _0xaeda=function(_0x460499,_0x4ebc36){_0x460499=_0x460499-0x0;var _0x1042f5=_0xedaa[_0x460499];return _0x1042f5;};'use strict';var client=require(_0xaeda('0x0'));exports[_0xaeda('0x1')]=function(_0x5b232a){return client[_0xaeda('0x2')](_0xaeda('0x3'),{'body':_0x5b232a,'log':_0xaeda('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 23d41de..b0ffe7e 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 _0x1226=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x1226,0x1c1));var _0x6122=function(_0x10d392,_0x34a8ce){_0x10d392=_0x10d392-0x0;var _0x550cf8=_0x1226[_0x10d392];return _0x550cf8;};'use strict';var client=require(_0x6122('0x0'));exports[_0x6122('0x1')]=function(){return function(){return client[_0x6122('0x2')](_0x6122('0x3'),{'options':{'raw':!![],'attributes':['id',_0x6122('0x4'),_0x6122('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x6122('0x1')});};}; \ No newline at end of file +var _0xcb49=['../client','Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x31ad84,_0x3a1364){var _0x2ab374=function(_0x596f0a){while(--_0x596f0a){_0x31ad84['push'](_0x31ad84['shift']());}};_0x2ab374(++_0x3a1364);}(_0xcb49,0x156));var _0x9cb4=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xcb49[_0x4c2dfc];return _0xfd728d;};'use strict';var client=require(_0x9cb4('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x9cb4('0x1')](_0x9cb4('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9cb4('0x3'),_0x9cb4('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9cb4('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5b03092..4a4f24d 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 _0x4222=['Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x57d4b2,_0x43236a){var _0x57fc1c=function(_0x348421){while(--_0x348421){_0x57d4b2['push'](_0x57d4b2['shift']());}};_0x57fc1c(++_0x43236a);}(_0x4222,0x105));var _0x2422=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4222[_0x346737];return _0x1ade2e;};'use strict';var client=require(_0x2422('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x2422('0x1'),{'options':{'raw':![],'attributes':['id',_0x2422('0x2'),_0x2422('0x3'),'acwTimeout',_0x2422('0x4'),_0x2422('0x5'),_0x2422('0x6'),_0x2422('0x7'),'dialMethod',_0x2422('0x8'),_0x2422('0x9'),'dialPowerLevel',_0x2422('0xa'),_0x2422('0xb'),'dialPredictiveInterval',_0x2422('0xc'),_0x2422('0xd'),_0x2422('0xe'),_0x2422('0xf'),'dialQueueTimeout',_0x2422('0x10'),_0x2422('0x11'),_0x2422('0x12'),_0x2422('0x13'),_0x2422('0x14'),'dialNoAnswerMaxRetry',_0x2422('0x15'),_0x2422('0x16'),_0x2422('0x17'),_0x2422('0x18'),_0x2422('0x19'),_0x2422('0x1a'),_0x2422('0x1b'),_0x2422('0x1c'),_0x2422('0x1d'),'dialAMDAfterGreetingSilence',_0x2422('0x1e'),_0x2422('0x1f'),_0x2422('0x20'),_0x2422('0x21'),_0x2422('0x22'),_0x2422('0x23'),_0x2422('0x24'),'dialRecallMeTimeout',_0x2422('0x25'),_0x2422('0x26'),_0x2422('0x27'),_0x2422('0x28'),_0x2422('0x29'),_0x2422('0x5'),'strategy',_0x2422('0x2a'),_0x2422('0x2b'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x2422('0x2c'),_0x2422('0x2d'),_0x2422('0x2e'),_0x2422('0x2f'),_0x2422('0x30'),'dialMachineRetryFrequency',_0x2422('0x31'),_0x2422('0x32'),_0x2422('0x33'),_0x2422('0x34'),_0x2422('0x35')],'include':[{'model':_0x2422('0x36'),'as':_0x2422('0x36'),'attributes':['id',_0x2422('0x2'),_0x2422('0x37'),'active']},{'model':_0x2422('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x2422('0x2')]},{'model':'Trunk','as':_0x2422('0x39'),'attributes':['id','name',_0x2422('0x37'),_0x2422('0x3a')]},{'model':_0x2422('0x3b'),'as':_0x2422('0x3b'),'attributes':['id',_0x2422('0x2')],'include':[{'model':_0x2422('0x3b'),'as':_0x2422('0x3c'),'attributes':['id',_0x2422('0x2'),_0x2422('0x3d')]}]}]},'log':_0x2422('0x3e')});};}; \ No newline at end of file +var _0xe635=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','active','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialOriginateCallerIdName'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xe635,0x14e));var _0x5e63=function(_0x4f83d9,_0x4e9dd3){_0x4f83d9=_0x4f83d9-0x0;var _0x499684=_0xe635[_0x4f83d9];return _0x499684;};'use strict';var client=require(_0x5e63('0x0'));exports[_0x5e63('0x1')]=function(){return function(){return client[_0x5e63('0x2')](_0x5e63('0x3'),{'options':{'raw':![],'attributes':['id',_0x5e63('0x4'),_0x5e63('0x5'),_0x5e63('0x6'),'autopause',_0x5e63('0x7'),'type',_0x5e63('0x8'),_0x5e63('0x9'),_0x5e63('0xa'),_0x5e63('0xb'),'dialPowerLevel',_0x5e63('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x5e63('0xd'),_0x5e63('0xe'),_0x5e63('0xf'),_0x5e63('0x10'),_0x5e63('0x11'),_0x5e63('0x12'),_0x5e63('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x5e63('0x14'),_0x5e63('0x15'),_0x5e63('0x16'),_0x5e63('0x17'),_0x5e63('0x18'),'dialGlobalInterval',_0x5e63('0x19'),_0x5e63('0x1a'),'dialAMDActive','dialAMDInitialSilence',_0x5e63('0x1b'),_0x5e63('0x1c'),_0x5e63('0x1d'),_0x5e63('0x1e'),_0x5e63('0x1f'),_0x5e63('0x20'),'dialAMDSilenceThreshold',_0x5e63('0x21'),'timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt',_0x5e63('0x22'),_0x5e63('0x23'),_0x5e63('0x24'),_0x5e63('0x7'),'strategy',_0x5e63('0x25'),'dialCutDigit',_0x5e63('0x26'),_0x5e63('0x27'),_0x5e63('0x28'),_0x5e63('0x29'),_0x5e63('0x2a'),_0x5e63('0x2b'),_0x5e63('0x2c'),_0x5e63('0x2d'),_0x5e63('0x2e'),_0x5e63('0x2f'),_0x5e63('0x30'),_0x5e63('0x31'),_0x5e63('0x32')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name','callerid','active']},{'model':_0x5e63('0x33'),'as':_0x5e63('0x34'),'attributes':['id',_0x5e63('0x4')]},{'model':_0x5e63('0x35'),'as':_0x5e63('0x36'),'attributes':['id',_0x5e63('0x4'),'callerid',_0x5e63('0x37')]},{'model':_0x5e63('0x38'),'as':_0x5e63('0x38'),'attributes':['id',_0x5e63('0x4')],'include':[{'model':'Interval','as':_0x5e63('0x39'),'attributes':['id',_0x5e63('0x4'),'interval']}]}]},'log':_0x5e63('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 215d039..b6c8965 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 _0x2b29=['queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x5ef5b5,_0x166017){var _0x2a2606=function(_0x476968){while(--_0x476968){_0x5ef5b5['push'](_0x5ef5b5['shift']());}};_0x2a2606(++_0x166017);}(_0x2b29,0x163));var _0x92b2=function(_0x58d804,_0x4341f2){_0x58d804=_0x58d804-0x0;var _0x4352ad=_0x2b29[_0x58d804];return _0x4352ad;};'use strict';var moment=require('moment');var _=require(_0x92b2('0x0'));var client=require(_0x92b2('0x1'));exports[_0x92b2('0x2')]=function(_0x17e1d8){return client['Request'](_0x92b2('0x3'),{'body':_0x17e1d8,'log':_0x92b2('0x3')});};exports[_0x92b2('0x4')]=function(){return function(){return client[_0x92b2('0x5')](_0x92b2('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x92b2('0x7')]('day')[_0x92b2('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x92b2('0x9')](_0x92b2('0xa'))['format'](_0x92b2('0xb'))]}},'attributes':[_0x92b2('0xc'),_0x92b2('0xd'),_0x92b2('0xe'),'queuecallerleaveAt',_0x92b2('0xf'),_0x92b2('0x10'),_0x92b2('0x11'),_0x92b2('0x12'),_0x92b2('0x13'),_0x92b2('0x14')]},'log':_0x92b2('0x15')});};}; \ No newline at end of file +var _0x7f5b=['GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports'];(function(_0x11a522,_0x513912){var _0x218dfc=function(_0x1a7757){while(--_0x1a7757){_0x11a522['push'](_0x11a522['shift']());}};_0x218dfc(++_0x513912);}(_0x7f5b,0x19e));var _0xb7f5=function(_0x1d2e5e,_0x145ae6){_0x1d2e5e=_0x1d2e5e-0x0;var _0x4a1d68=_0x7f5b[_0x1d2e5e];return _0x4a1d68;};'use strict';var moment=require(_0xb7f5('0x0'));var _=require(_0xb7f5('0x1'));var client=require(_0xb7f5('0x2'));exports['create']=function(_0xcfa151){return client[_0xb7f5('0x3')](_0xb7f5('0x4'),{'body':_0xcfa151,'log':_0xb7f5('0x4')});};exports[_0xb7f5('0x5')]=function(){return function(){return client['Request'](_0xb7f5('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xb7f5('0x7'))[_0xb7f5('0x8')](_0xb7f5('0x9')),moment()[_0xb7f5('0xa')]('day')[_0xb7f5('0x8')](_0xb7f5('0x9'))]}},'attributes':[_0xb7f5('0xb'),'queue',_0xb7f5('0xc'),_0xb7f5('0xd'),_0xb7f5('0xe'),_0xb7f5('0xf'),_0xb7f5('0x10'),_0xb7f5('0x11'),_0xb7f5('0x12'),_0xb7f5('0x13')]},'log':_0xb7f5('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 648c1ce..1b54f62 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 _0xedf5=['getVoiceQueueRtPauses','Request'];(function(_0x4a47e3,_0x4fa471){var _0xfe3d51=function(_0x44fc8e){while(--_0x44fc8e){_0x4a47e3['push'](_0x4a47e3['shift']());}};_0xfe3d51(++_0x4fa471);}(_0xedf5,0x10e));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x5edf('0x0')]=function(_0x5e669e){return function(){return client[_0x5edf('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5e669e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x345e=['../client','getVoiceQueueRtPauses'];(function(_0x220551,_0x42f15d){var _0x50a719=function(_0x239390){while(--_0x239390){_0x220551['push'](_0x220551['shift']());}};_0x50a719(++_0x42f15d);}(_0x345e,0x156));var _0xe345=function(_0x503f4d,_0x476e97){_0x503f4d=_0x503f4d-0x0;var _0x4ce6d1=_0x345e[_0x503f4d];return _0x4ce6d1;};'use strict';var client=require(_0xe345('0x0'));exports[_0xe345('0x1')]=function(_0x264aa6){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x264aa6,'paused':!![]},'raw':!![]},'log':_0xe345('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c88d58a..c26763d 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 _0x70e0=['Request','merge','monitorFilename','CreateVoiceRecording','lodash','../client','create'];(function(_0xf7cef4,_0x16ce2f){var _0x4cd2a0=function(_0xf3f530){while(--_0xf3f530){_0xf7cef4['push'](_0xf7cef4['shift']());}};_0x4cd2a0(++_0x16ce2f);}(_0x70e0,0xa5));var _0x070e=function(_0x27c2f2,_0x1b6d00){_0x27c2f2=_0x27c2f2-0x0;var _0x5cb5e1=_0x70e0[_0x27c2f2];return _0x5cb5e1;};'use strict';var _=require(_0x070e('0x0'));var client=require(_0x070e('0x1'));exports[_0x070e('0x2')]=function(_0x56ec12){return client[_0x070e('0x3')]('CreateVoiceRecording',{'body':_[_0x070e('0x4')](_0x56ec12,{'value':_0x56ec12[_0x070e('0x5')]}),'log':_0x070e('0x6')});}; \ No newline at end of file +var _0x48a4=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x14323d,_0x2d125c){var _0x41c0a1=function(_0x2aac62){while(--_0x2aac62){_0x14323d['push'](_0x14323d['shift']());}};_0x41c0a1(++_0x2d125c);}(_0x48a4,0xc9));var _0x448a=function(_0xba3017,_0x1fad18){_0xba3017=_0xba3017-0x0;var _0x20579c=_0x48a4[_0xba3017];return _0x20579c;};'use strict';var _=require(_0x448a('0x0'));var client=require(_0x448a('0x1'));exports[_0x448a('0x2')]=function(_0x23dbcd){return client['Request'](_0x448a('0x3'),{'body':_[_0x448a('0x4')](_0x23dbcd,{'value':_0x23dbcd[_0x448a('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 579688c..cf43e94 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 _0x22f3=['origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','context','extension','blind','CreateVoiceTransferReport','attendedTransfer'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x22f3,0xc8));var _0x322f=function(_0x349c2f,_0x41bd46){_0x349c2f=_0x349c2f-0x0;var _0x5ef6c6=_0x22f3[_0x349c2f];return _0x5ef6c6;};'use strict';var client=require(_0x322f('0x0'));exports[_0x322f('0x1')]={};exports[_0x322f('0x2')]=function(_0xc481b3){return client[_0x322f('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0xc481b3[_0x322f('0x4')],'transfererchannel':_0xc481b3['transfererchannel'],'transferercalleridnum':_0xc481b3[_0x322f('0x5')],'transferercalleridname':_0xc481b3[_0x322f('0x6')],'transfererconnectedlinenum':_0xc481b3[_0x322f('0x7')],'transfererconnectedlinename':_0xc481b3[_0x322f('0x8')],'transfereraccountcode':_0xc481b3[_0x322f('0x9')],'transferercontext':_0xc481b3['transferercontext'],'transfererexten':_0xc481b3[_0x322f('0xa')],'transfererlinkedid':_0xc481b3['transfererlinkedid'],'transfereechannel':_0xc481b3[_0x322f('0xb')],'transfereecalleridnum':_0xc481b3[_0x322f('0xc')],'transfereecalleridname':_0xc481b3['transfereecalleridname'],'transfereeconnectedlinenum':_0xc481b3[_0x322f('0xd')],'transfereeconnectedlinename':_0xc481b3[_0x322f('0xe')],'transfereeaccountcode':_0xc481b3['transfereeaccountcode'],'transfereecontext':_0xc481b3[_0x322f('0xf')],'transfereeexten':_0xc481b3[_0x322f('0x10')],'transfereelinkedid':_0xc481b3['transfereelinkedid'],'isexternal':_0xc481b3['isexternal'],'context':_0xc481b3[_0x322f('0x11')],'extension':_0xc481b3[_0x322f('0x12')],'type':_0x322f('0x13')},'log':_0x322f('0x14')});};exports[_0x322f('0x15')]=function(_0x5beba7){return client[_0x322f('0x3')](_0x322f('0x14'),{'body':{'result':_0x5beba7[_0x322f('0x4')],'transfererchannel':_0x5beba7[_0x322f('0x16')],'transferercalleridnum':_0x5beba7[_0x322f('0x17')],'transferercalleridname':_0x5beba7[_0x322f('0x18')],'transfererconnectedlinenum':_0x5beba7['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5beba7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5beba7[_0x322f('0x19')],'transferercontext':_0x5beba7['secondtransferercontext'],'transfererexten':_0x5beba7[_0x322f('0x1a')],'transfererlinkedid':_0x5beba7[_0x322f('0x1b')],'transfereechannel':_0x5beba7[_0x322f('0x1c')],'transfereecalleridnum':_0x5beba7['transfertargetcalleridnum'],'transfereecalleridname':_0x5beba7[_0x322f('0x1d')],'transfereeconnectedlinenum':_0x5beba7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5beba7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5beba7[_0x322f('0x1e')],'transfereecontext':_0x5beba7[_0x322f('0x1f')],'transfereeexten':_0x5beba7[_0x322f('0x20')],'transfereelinkedid':_0x5beba7[_0x322f('0x21')],'isexternal':_0x5beba7['isexternal'],'context':_0x5beba7[_0x322f('0x22')],'extension':_0x5beba7[_0x322f('0x23')],'type':_0x322f('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xc77f=['transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','Request','result'];(function(_0x20488f,_0x5d7c3d){var _0x19350e=function(_0x1c85db){while(--_0x1c85db){_0x20488f['push'](_0x20488f['shift']());}};_0x19350e(++_0x5d7c3d);}(_0xc77f,0x1d9));var _0xfc77=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0xc77f[_0x1ffff7];return _0x49d017;};'use strict';var client=require(_0xfc77('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x1a4ebc){return client[_0xfc77('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x1a4ebc[_0xfc77('0x2')],'transfererchannel':_0x1a4ebc[_0xfc77('0x3')],'transferercalleridnum':_0x1a4ebc[_0xfc77('0x4')],'transferercalleridname':_0x1a4ebc['transferercalleridname'],'transfererconnectedlinenum':_0x1a4ebc[_0xfc77('0x5')],'transfererconnectedlinename':_0x1a4ebc['transfererconnectedlinename'],'transfereraccountcode':_0x1a4ebc[_0xfc77('0x6')],'transferercontext':_0x1a4ebc[_0xfc77('0x7')],'transfererexten':_0x1a4ebc['transfererexten'],'transfererlinkedid':_0x1a4ebc[_0xfc77('0x8')],'transfereechannel':_0x1a4ebc[_0xfc77('0x9')],'transfereecalleridnum':_0x1a4ebc[_0xfc77('0xa')],'transfereecalleridname':_0x1a4ebc[_0xfc77('0xb')],'transfereeconnectedlinenum':_0x1a4ebc[_0xfc77('0xc')],'transfereeconnectedlinename':_0x1a4ebc['transfereeconnectedlinename'],'transfereeaccountcode':_0x1a4ebc[_0xfc77('0xd')],'transfereecontext':_0x1a4ebc[_0xfc77('0xe')],'transfereeexten':_0x1a4ebc['transfereeexten'],'transfereelinkedid':_0x1a4ebc[_0xfc77('0xf')],'isexternal':_0x1a4ebc[_0xfc77('0x10')],'context':_0x1a4ebc['context'],'extension':_0x1a4ebc[_0xfc77('0x11')],'type':_0xfc77('0x12')},'log':_0xfc77('0x13')});};exports[_0xfc77('0x14')]=function(_0x3ad374){return client['Request'](_0xfc77('0x13'),{'body':{'result':_0x3ad374[_0xfc77('0x2')],'transfererchannel':_0x3ad374[_0xfc77('0x15')],'transferercalleridnum':_0x3ad374['origtransferercalleridnum'],'transferercalleridname':_0x3ad374['origtransferercalleridname'],'transfererconnectedlinenum':_0x3ad374[_0xfc77('0x16')],'transfererconnectedlinename':_0x3ad374[_0xfc77('0x17')],'transfereraccountcode':_0x3ad374['origtransfereraccountcode'],'transferercontext':_0x3ad374[_0xfc77('0x18')],'transfererexten':_0x3ad374[_0xfc77('0x19')],'transfererlinkedid':_0x3ad374[_0xfc77('0x1a')],'transfereechannel':_0x3ad374['transfertargetchannel'],'transfereecalleridnum':_0x3ad374[_0xfc77('0x1b')],'transfereecalleridname':_0x3ad374[_0xfc77('0x1c')],'transfereeconnectedlinenum':_0x3ad374['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3ad374[_0xfc77('0x1d')],'transfereeaccountcode':_0x3ad374['transfertargetaccountcode'],'transfereecontext':_0x3ad374[_0xfc77('0x1e')],'transfereeexten':_0x3ad374[_0xfc77('0x1f')],'transfereelinkedid':_0x3ad374[_0xfc77('0x20')],'isexternal':_0x3ad374[_0xfc77('0x10')],'context':_0x3ad374['origtransferercontext'],'extension':_0x3ad374['origtransfererexten'],'type':_0xfc77('0x21')},'log':_0xfc77('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b799f7d..289c1a0 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 _0x37a0=['username','command','content','voiceQueues','hasOwnProperty','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','length','voicechannel','validate','map','find','uniqueid','channel','filename','wav','MixMonitor','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','emit','custom:','faxAccounts','send','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch'];(function(_0x454329,_0x1aa6e7){var _0x53e4a3=function(_0x208435){while(--_0x208435){_0x454329['push'](_0x454329['shift']());}};_0x53e4a3(++_0x1aa6e7);}(_0x37a0,0xf2));var _0x037a=function(_0x4e7bf2,_0x35a456){_0x4e7bf2=_0x4e7bf2-0x0;var _0x182f34=_0x37a0[_0x4e7bf2];return _0x182f34;};'use strict';var _=require('lodash');var util=require(_0x037a('0x0'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x037a('0x1'));var moment=require(_0x037a('0x2'));var config=require(_0x037a('0x3'));var properties=require(_0x037a('0x4'));var ami=require(_0x037a('0x5'));exports[_0x037a('0x6')]=function(_0x27f95c,_0xa3fbad,_0xd444a5){return new BPromise(function(_0x281509,_0x4bbfac){var _0x223c23={'QueuePause':function(_0x3e6053){return new Promise(function(_0x55525d,_0x294971){var _0x1b53e1=util[_0x037a('0x7')](_0x037a('0x8'),_0x037a('0x9'),_0x3e6053[_0x037a('0xa')]);if(_0x27f95c[_0x037a('0xb')]&&_0x27f95c[_0x037a('0xb')][_0x1b53e1]&&_0x27f95c['timers'][_0x1b53e1]['timer']){_0x27f95c[_0x037a('0xb')][_0x1b53e1][_0x037a('0xc')]();}if(_0x27f95c[_0x037a('0xd')][_0x1b53e1]){_0x27f95c[_0x037a('0xd')][_0x1b53e1][_0x037a('0xe')]({'statePause':_0x3e6053['pause']?!![]:![]});}_0x55525d({'code':0xc8,'message':_0x037a('0xf')});});},'Reload':function(_0xb5c771){var _0x2010b2=this;return new Promise(function(_0xd668f9,_0x255dc0){if(ami[_0x037a('0x10')]()==![]){return _0x255dc0(_0x2010b2[_0x037a('0x11')](0x1f4,[config[_0x037a('0x12')]['ip'],config[_0x037a('0x12')]['username'],_0x037a('0x13')][_0x037a('0x14')]('\x20')));}_0xb5c771=_[_0x037a('0x15')](_0xb5c771,_[_0x037a('0x16')](properties[_0x037a('0x17')]));_0xb5c771[_0x037a('0x18')]=_0x037a('0x19');return ami[_0x037a('0x1a')](_0xb5c771)[_0x037a('0x1b')](function(_0x4ebd82){_0xd668f9({'code':0xc8,'message':_0x4ebd82[_0x037a('0x1c')]});})[_0x037a('0x1d')](function(_0x11ddaa){_0x255dc0(_0x2010b2[_0x037a('0x11')](0x1f5,_0x11ddaa['message']));});});},'Command':function(_0xe7432b){var _0x5123d2=this;return new Promise(function(_0x4b12f5,_0x3b658b){if(ami['isConnected']()==![]){return _0x3b658b(_0x5123d2['error'](0x1f4,[config[_0x037a('0x12')]['ip'],config[_0x037a('0x12')][_0x037a('0x1e')],_0x037a('0x13')][_0x037a('0x14')]('\x20')));}_0xe7432b=_[_0x037a('0x15')](_0xe7432b,_0x037a('0x1f'));_0xe7432b[_0x037a('0x18')]='Command';return ami[_0x037a('0x1a')](_0xe7432b)[_0x037a('0x1b')](function(_0x15e463){_0x4b12f5({'code':0xc8,'message':_0x15e463[_0x037a('0x20')]});})[_0x037a('0x1d')](function(_0x326f17){_0x3b658b(_0x5123d2[_0x037a('0x11')](0x1f5,_0x326f17[_0x037a('0x1c')]));});});},'VoiceQueues':function(_0x190cca){return new Promise(function(_0x58ed2a,_0xb53bf2){var _0x3ed3d1=[];for(var _0x3c4591 in _0x27f95c[_0x037a('0x21')]){if(_0x27f95c[_0x037a('0x21')][_0x037a('0x22')](_0x3c4591)){var _0x3fe70b=_0x27f95c[_0x037a('0x21')][_0x3c4591];var _0x575b51={'id':_0x3fe70b['id'],'name':_0x3fe70b['name'],'strategy':_0x3fe70b['strategy'],'answered':_0x3fe70b['answered'],'available':_0x3fe70b[_0x037a('0x23')],'loggedIn':_0x3fe70b[_0x037a('0x24')],'pTalking':_0x3fe70b[_0x037a('0x25')],'sumBillable':_0x3fe70b[_0x037a('0x26')],'sumDuration':_0x3fe70b[_0x037a('0x27')],'sumHoldTime':_0x3fe70b[_0x037a('0x28')]||0x0,'talking':_0x3fe70b[_0x037a('0x29')],'total':_0x3fe70b[_0x037a('0x2a')],'type':_0x3fe70b['type'],'unmanaged':_0x3fe70b['unmanaged'],'abandoned':_0x3fe70b[_0x037a('0x2b')],'waiting':_0x3fe70b['waiting'],'loggedInDb':_0x3fe70b[_0x037a('0x2c')]};if(_0x3fe70b[_0x037a('0x2d')]===_0x037a('0x2e')){_0x575b51[_0x037a('0x2f')]=_0x3fe70b[_0x037a('0x2f')];_0x575b51['dialMethod']=_0x3fe70b[_0x037a('0x30')];_0x575b51[_0x037a('0x31')]=_0x3fe70b[_0x037a('0x31')];_0x575b51['dialOriginateCallerIdNumber']=_0x3fe70b[_0x037a('0x32')];_0x575b51['dialOriginateTimeout']=_0x3fe70b['dialOriginateTimeout'];_0x575b51[_0x037a('0x33')]=_0x3fe70b['dialPrefix'];_0x575b51[_0x037a('0x34')]=_0x3fe70b[_0x037a('0x34')];_0x575b51['outboundAnswerCallsDay']=_0x3fe70b[_0x037a('0x35')];_0x575b51[_0x037a('0x36')]=_0x3fe70b[_0x037a('0x36')];_0x575b51[_0x037a('0x37')]=_0x3fe70b[_0x037a('0x37')];_0x575b51[_0x037a('0x38')]=_0x3fe70b[_0x037a('0x38')];_0x575b51[_0x037a('0x39')]=_0x3fe70b[_0x037a('0x39')];_0x575b51['outboundDropCallsDayCallersExit']=_0x3fe70b['outboundDropCallsDayCallersExit'];_0x575b51['outboundDropCallsDayTimeout']=_0x3fe70b[_0x037a('0x3a')];_0x575b51['outboundNoAnswerCallsDay']=_0x3fe70b[_0x037a('0x3b')];_0x575b51[_0x037a('0x3c')]=_0x3fe70b[_0x037a('0x3c')];_0x575b51[_0x037a('0x3d')]=_0x3fe70b['outboundOriginateFailureCallsDay'];_0x575b51[_0x037a('0x3e')]=_0x3fe70b['outboundReCallsDay'];_0x575b51[_0x037a('0x3f')]=_0x3fe70b['outboundRejectCallsDay'];_0x575b51[_0x037a('0x40')]=_0x3fe70b[_0x037a('0x40')];_0x575b51[_0x037a('0x41')]=_0x3fe70b[_0x037a('0x41')];_0x575b51[_0x037a('0x42')]=_0x3fe70b[_0x037a('0x42')];_0x575b51[_0x037a('0x43')]=_0x3fe70b[_0x037a('0x43')];_0x575b51[_0x037a('0x44')]=_0x3fe70b[_0x037a('0x44')];_0x575b51['predictiveIntervalDroppedCallsTimeout']=_0x3fe70b['predictiveIntervalDroppedCallsTimeout'];_0x575b51['predictiveIntervalErlangCalls']=_0x3fe70b[_0x037a('0x45')];_0x575b51['predictiveIntervalErlangCallsDroppedCalls']=_0x3fe70b[_0x037a('0x46')];_0x575b51['predictiveIntervalHitRate']=_0x3fe70b[_0x037a('0x47')];_0x575b51[_0x037a('0x48')]=_0x3fe70b[_0x037a('0x48')];_0x575b51[_0x037a('0x49')]=_0x3fe70b['predictiveIntervalPauses'];_0x575b51[_0x037a('0x4a')]=_0x3fe70b['predictiveIntervalAvailable'];_0x575b51[_0x037a('0x4b')]=_0x3fe70b['predictiveIntervalTotalCalls'];_0x575b51[_0x037a('0x1c')]=_0x3fe70b['message'];_0x575b51['originated']=_0x3fe70b[_0x037a('0x4c')];_0x575b51[_0x037a('0x4d')]=_0x3fe70b[_0x037a('0x4d')];_0x575b51[_0x037a('0x4e')]=_0x3fe70b[_0x037a('0x4e')];_0x575b51[_0x037a('0x4f')]=_0x3fe70b[_0x037a('0x4f')];_0x575b51[_0x037a('0x50')]=_0x3fe70b[_0x037a('0x50')];_0x575b51[_0x037a('0x51')]=_0x3fe70b[_0x037a('0x51')];_0x575b51['startProgressive']=_0x3fe70b[_0x037a('0x52')];}if(_0x3fe70b['Trunk']){_0x575b51[_0x037a('0x53')]={'id':_0x3fe70b[_0x037a('0x53')]['id'],'name':_0x3fe70b[_0x037a('0x53')][_0x037a('0xa')],'active':_0x3fe70b[_0x037a('0x53')][_0x037a('0x54')],'callerid':_0x3fe70b['Trunk'][_0x037a('0x55')]};}if(_0x3fe70b['Interval']){_0x575b51[_0x037a('0x56')]={'id':_0x3fe70b['Interval']['id'],'name':_0x3fe70b[_0x037a('0x56')]['name']};}_0x3ed3d1[_0x037a('0x57')](_0x575b51);}}_0x58ed2a({'count':_0x3ed3d1['length'],'rows':_0x3ed3d1});});},'VoiceChannels':function(_0x1d463c){return new Promise(function(_0x23fa9e,_0x38bf5e){var _0xe921c4=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x59')]);_0x23fa9e({'count':_0xe921c4[_0x037a('0x5a')],'rows':_0xe921c4});});},'VoiceChannelMixMonitor':function(_0x3ad1db){var _0x20ffb9=this;return new Promise(function(_0x2ca1d9,_0x243245){if(ami[_0x037a('0x10')]()==![]){return _0x243245(_0x20ffb9[_0x037a('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x037a('0x12')][_0x037a('0x1e')],'ami\x20disconnected']['join']('\x20')));}var _0x2e92d3=schema(properties[_0x037a('0x5b')])[_0x037a('0x5c')](_0x3ad1db);if(_0x2e92d3['length']>0x0){return _0x243245(_0x20ffb9[_0x037a('0x11')](0x1f4,_[_0x037a('0x5d')](_0x2e92d3,'message')['join'](',\x20')));}var _0x2a677c=_[_0x037a('0x5e')](_0x27f95c[_0x037a('0x59')],{'uniqueid':_0x3ad1db[_0x037a('0x5f')]});if(_0x2a677c&&_0x2a677c[_0x037a('0x60')]){var _0x34782e=util[_0x037a('0x7')]('%s.%s',_0x3ad1db[_0x037a('0x61')]||_0x3ad1db[_0x037a('0x5f')],_0x3ad1db['format']||_0x037a('0x62'));return ami['Action']({'action':_0x037a('0x63'),'channel':_0x2a677c[_0x037a('0x60')],'file':_0x34782e,'options':'ai(mixmonitorid)'})['then'](function(_0x5568f7){var _0x41d77e=_[_0x037a('0x5e')](_0x2a677c['monitors'],{'filename':_0x037a('0x64')+_0x34782e[_0x037a('0x65')]()});if(_[_0x037a('0x66')](_0x41d77e)){_0x2a677c[_0x037a('0x67')]['push']({'filename':_0x037a('0x64')+_0x34782e[_0x037a('0x65')](),'createdAt':moment()[_0x037a('0x7')](_0x037a('0x68')),'mixmonitorid':_0x5568f7[_0x037a('0x69')],'status':_0x037a('0x6a')});}else{_0x41d77e[_0x037a('0x69')]=_0x5568f7[_0x037a('0x69')];_0x41d77e[_0x037a('0x6b')]=_0x037a('0x6a');}_0x2ca1d9({'code':0xc8,'message':[_0x3ad1db[_0x037a('0x5f')],'MixMonitor\x20Success',_0x5568f7[_0x037a('0x69')]]['join']('\x20'),'mixmonitorid':_0x5568f7['mixmonitorid']});})[_0x037a('0x1d')](function(_0x124e6f){_0x243245(_0x20ffb9[_0x037a('0x11')](0x1f5,[_0x3ad1db[_0x037a('0x5f')],_0x124e6f['message'][_0x037a('0x65')]()][_0x037a('0x14')]('\x20')));});}else{return _0x243245(_0x20ffb9[_0x037a('0x11')](0x1f5,_0x037a('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x169fb8){var _0x1e17cf=this;return new Promise(function(_0x5ab571,_0x270668){if(ami[_0x037a('0x10')]()==![]){return _0x270668(_0x1e17cf[_0x037a('0x11')](0x1f4,[config[_0x037a('0x12')]['ip'],config[_0x037a('0x12')]['username'],'ami\x20disconnected'][_0x037a('0x14')]('\x20')));}var _0x4f1b2a=schema(properties[_0x037a('0x5b')])[_0x037a('0x5c')](_0x169fb8);if(_0x4f1b2a[_0x037a('0x5a')]>0x0){return _0x270668(_0x1e17cf['error'](0x1f4,_['map'](_0x4f1b2a,_0x037a('0x1c'))[_0x037a('0x14')](',\x20')));}var _0x1b27c8=_[_0x037a('0x5e')](_0x27f95c['channels'],{'uniqueid':_0x169fb8[_0x037a('0x5f')]});if(_0x1b27c8){return BPromise[_0x037a('0x6d')]()[_0x037a('0x1b')](function(){if(_0x1b27c8['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x1b27c8[_0x037a('0x60')],'mixmonitorid':_0x169fb8[_0x037a('0x69')]})[_0x037a('0x1d')](function(_0x210912){});}})[_0x037a('0x1b')](function(){if(_0x1b27c8[_0x037a('0x6e')]){return ami[_0x037a('0x1a')]({'action':_0x037a('0x6f'),'channel':_0x1b27c8[_0x037a('0x6e')],'mixmonitorid':_0x169fb8[_0x037a('0x69')]})['catch'](function(_0x37e0b4){});}})[_0x037a('0x1b')](function(_0x461468){var _0x1b319f=_[_0x037a('0x5e')](_0x1b27c8[_0x037a('0x67')],{'mixmonitorid':_0x169fb8[_0x037a('0x69')]});if(_0x1b319f){_0x1b319f[_0x037a('0x6b')]=_0x037a('0x70');}})[_0x037a('0x1b')](function(){var _0xba54c5=util[_0x037a('0x7')](_0x037a('0x71'),_0x169fb8[_0x037a('0x61')]||_0x169fb8[_0x037a('0x5f')],_0x169fb8['format']||_0x037a('0x62'));var _0x10534b=_[_0x037a('0x5e')](_0x1b27c8[_0x037a('0x67')],{'filename':_0x037a('0x64')+_0xba54c5['toLowerCase']()});if(_0x10534b){_0x10534b[_0x037a('0x6b')]='stop';}})[_0x037a('0x1b')](function(){_0x5ab571({'code':0xc8,'message':[_0x169fb8[_0x037a('0x5f')],_0x037a('0x72')][_0x037a('0x14')]('\x20')});})[_0x037a('0x1d')](function(_0xd40846){_0x270668(_0x1e17cf[_0x037a('0x11')](0x1f5,[_0x169fb8[_0x037a('0x5f')],_0xd40846['message'][_0x037a('0x65')]()][_0x037a('0x14')]('\x20')));});}else{return _0x270668(_0x1e17cf['error'](0x1f5,_0x037a('0x6c')));}});},'VoiceQueuesChannels':function(_0x5859fa){return new Promise(function(_0x15a84f,_0xa77ef5){var _0x1a37f1=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x73')]);_0x15a84f({'count':_0x1a37f1['length'],'rows':_0x1a37f1});});},'VoiceQueuesChannel':function(_0x54975e){var _0x3622f6=this;return new Promise(function(_0x425f0e,_0x534456){var _0x3378a8=schema(properties[_0x037a('0x74')])['validate'](_0x54975e);if(_0x3378a8['length']>0x0){return _0x534456(_0x3622f6['error'](0x1f4,_[_0x037a('0x5d')](_0x3378a8,_0x037a('0x1c'))[_0x037a('0x14')](',\x20')));}var _0xecb61e=_['find'](_0x27f95c[_0x037a('0x73')],{'uniqueid':_0x54975e['uniqueid']});if(_0xecb61e){_0x425f0e(_0xecb61e);}else{return _0x534456(_0x3622f6['error'](0x1f5,_0x037a('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x33b619){var _0x29c486=this;return new Promise(function(_0x1f6e90,_0x2df7ab){if(ami[_0x037a('0x10')]()==![]){return _0x2df7ab(_0x29c486['error'](0x1f4,[config[_0x037a('0x12')]['ip'],config[_0x037a('0x12')][_0x037a('0x1e')],'ami\x20disconnected'][_0x037a('0x14')]('\x20')));}var _0x20db49=schema(properties[_0x037a('0x75')])[_0x037a('0x5c')](_0x33b619);if(_0x20db49[_0x037a('0x5a')]>0x0){return _0x2df7ab(_0x29c486[_0x037a('0x11')](0x1f4,_[_0x037a('0x5d')](_0x20db49,_0x037a('0x1c'))['join'](',\x20')));}var _0x2945a2=_['find'](_0x27f95c[_0x037a('0x73')],{'uniqueid':_0x33b619[_0x037a('0x5f')]});if(_0x2945a2&&_0x2945a2[_0x037a('0x60')]){return ami[_0x037a('0x1a')]({'action':_0x037a('0x76'),'channel':_0x2945a2['channel']})[_0x037a('0x1b')](function(_0x2b6581){_0x1f6e90({'code':0xc8,'message':[_0x33b619[_0x037a('0x5f')],_0x2b6581[_0x037a('0x1c')][_0x037a('0x65')]()]['join']('\x20')});})[_0x037a('0x1d')](function(_0x111c2c){_0x2df7ab(_0x29c486[_0x037a('0x11')](0x1f5,[_0x33b619[_0x037a('0x5f')],_0x111c2c[_0x037a('0x1c')][_0x037a('0x65')]()][_0x037a('0x14')]('\x20')));});}else{return _0x2df7ab(_0x29c486[_0x037a('0x11')](0x1f5,_0x037a('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x3c14aa){var _0x33ab6a=this;return new Promise(function(_0x164841,_0x29f830){if(ami[_0x037a('0x10')]()==![]){return _0x29f830(_0x33ab6a[_0x037a('0x11')](0x1f4,[config[_0x037a('0x12')]['ip'],config[_0x037a('0x12')][_0x037a('0x1e')],_0x037a('0x13')]['join']('\x20')));}var _0x3f2a31=schema(properties[_0x037a('0x77')])[_0x037a('0x5c')](_0x3c14aa);if(_0x3f2a31[_0x037a('0x5a')]>0x0){return _0x29f830(_0x33ab6a[_0x037a('0x11')](0x1f4,_[_0x037a('0x5d')](_0x3f2a31,_0x037a('0x1c'))[_0x037a('0x14')](',\x20')));}var _0x336865=_['find'](_0x27f95c[_0x037a('0x73')],{'uniqueid':_0x3c14aa[_0x037a('0x5f')]});if(_0x336865&&_0x336865[_0x037a('0x60')]){return ami[_0x037a('0x1a')]({'action':_0x037a('0x78'),'channel':_0x336865[_0x037a('0x60')],'exten':_0x3c14aa[_0x037a('0x79')],'context':_0x3c14aa['context']||_0x336865[_0x037a('0x7a')],'priority':0x1})[_0x037a('0x1b')](function(_0x141b3d){_0x164841({'code':0xc8,'message':[_0x3c14aa['uniqueid'],_0x141b3d[_0x037a('0x1c')][_0x037a('0x65')]()][_0x037a('0x14')]('\x20')});})[_0x037a('0x1d')](function(_0x224941){_0x29f830(_0x33ab6a[_0x037a('0x11')](0x1f5,[_0x3c14aa[_0x037a('0x5f')],_0x224941[_0x037a('0x1c')][_0x037a('0x65')]()][_0x037a('0x14')]('\x20')));});}else{return _0x29f830(_0x33ab6a[_0x037a('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3bc875){return new Promise(function(_0x1d1bae,_0x1aefe4){var _0x57822b=_['values'](_0x27f95c[_0x037a('0xd')]);_0x1d1bae({'count':_0x57822b[_0x037a('0x5a')],'rows':_0x57822b});});},'Telephones':function(_0x447641){return new Promise(function(_0x360a20,_0x5ca31a){var _0x4530c0=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x7b')]);_0x360a20({'count':_0x4530c0[_0x037a('0x5a')],'rows':_0x4530c0});});},'Trunks':function(_0x4637cb){return new Promise(function(_0x531192,_0x329a5e){var _0x51f312=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x7c')]);_0x531192({'count':_0x51f312[_0x037a('0x5a')],'rows':_0x51f312});});},'OutboundChannels':function(_0x444b9c){return new Promise(function(_0x5caf76,_0x23e258){var _0xaec48c=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x7d')]);_0x5caf76({'count':_0xaec48c[_0x037a('0x5a')],'rows':_0xaec48c});});},'Outbound':function(_0x74f4a1){return new Promise(function(_0x56b4bb,_0x1cd0dc){_0x56b4bb(_0x27f95c[_0x037a('0x2e')]);});},'Campaigns':function(_0x5f1362){return new Promise(function(_0x29d6bf,_0x3f6378){var _0x1116c2=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x7e')]);_0x29d6bf({'count':_0x1116c2[_0x037a('0x5a')],'rows':_0x1116c2});});},'VoiceQueuesPreview':function(_0x58ca10){var _0xfe2eca=this;return new Promise(function(_0x9cfa57,_0x5a6c97){_0xa3fbad[_0x037a('0x7f')](_0x58ca10['id'])[_0x037a('0x1b')](function(_0x4ada32){_0x9cfa57({'code':0xc8,'message':_0x4ada32[_0x037a('0x1c')]});})[_0x037a('0x1d')](function(_0x3df16b){_0x5a6c97(_0xfe2eca['error'](0x1f4,_0x3df16b[_0x037a('0x1c')]));});});},'EventManager':function(_0x25f189){var _0x2ee103=this;return new Promise(function(_0xde6a86,_0x2308ad){if(!_0x25f189['event']){return _0x2308ad(_0x2ee103[_0x037a('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x037a('0x80')](_0x037a('0x81')+_0x25f189['event'],_0x25f189[_0x037a('0x1c')]);_0xde6a86({'code':0xc8,'message':_0x25f189});});},'FaxAccounts':function(_0x1fcb50){return new Promise(function(_0x167f5a,_0xcce8ba){var _0x5b57be=_[_0x037a('0x58')](_0x27f95c[_0x037a('0x82')]);_0x167f5a({'count':_0x5b57be[_0x037a('0x5a')],'rows':_0x5b57be});});},'SendFax':function(_0x100683){var _0x13d6e9=this;return new Promise(function(_0x1f2d6c,_0x15218a){_0xd444a5[_0x037a('0x83')](_0x100683)[_0x037a('0x1b')](function(_0xd9881b){_0x1f2d6c({'code':0xc8,'message':_0xd9881b[_0x037a('0x1c')]});})[_0x037a('0x1d')](function(_0x2cceed){_0x15218a(_0x13d6e9[_0x037a('0x11')](0x1f4,_0x2cceed[_0x037a('0x1c')]));});});},'CheckAfterSend':function(_0x1d9dd7){var _0x3fe39e=this;return new Promise(function(_0x4ef5a0,_0x5b515c){_0xd444a5[_0x037a('0x84')](_0x1d9dd7)[_0x037a('0x1b')](function(_0x55287e){_0x4ef5a0({'code':0xc8,'message':_0x55287e[_0x037a('0x1c')]});})[_0x037a('0x1d')](function(_0x1bb12f){_0x5b515c(_0x3fe39e['error'](0x1f4,_0x1bb12f[_0x037a('0x1c')]));});});}};var _0x4cda5c=jayson[_0x037a('0x85')](_0x223c23)[_0x037a('0x86')]();_0x4cda5c['on'](_0x037a('0x11'),function(_0x37304a){return _0x4bbfac(_0x37304a);});_0x4cda5c[_0x037a('0x6')](0x232a,'127.0.0.1',function(){console['log'](_0x037a('0x87'),0x232a);return _0x281509('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xad86=['MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','send','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../ami','listen','format','%s/%s','name','timers','updateAcw','agents','QueuePause','isConnected','error','asterisk','join','pick','keys','Reload','Action','then','catch','username','ami\x20disconnected','Command','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','values','channels','voicechannel','find','uniqueid','channel','filename','wav'];(function(_0x7633c,_0x1e45bf){var _0x1b77e2=function(_0x4c3e7f){while(--_0x4c3e7f){_0x7633c['push'](_0x7633c['shift']());}};_0x1b77e2(++_0x1e45bf);}(_0xad86,0x1b5));var _0x6ad8=function(_0x5befc0,_0x48f1bf){_0x5befc0=_0x5befc0-0x0;var _0x1ea7d8=_0xad86[_0x5befc0];return _0x1ea7d8;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var jayson=require(_0x6ad8('0x2'));var schema=require(_0x6ad8('0x3'));var BPromise=require(_0x6ad8('0x4'));var moment=require('moment');var config=require(_0x6ad8('0x5'));var properties=require('../properties');var ami=require(_0x6ad8('0x6'));exports[_0x6ad8('0x7')]=function(_0x4c7be8,_0x67a9fa,_0x5113f3){return new BPromise(function(_0x2af3f7,_0x4c59cf){var _0x4e6599={'QueuePause':function(_0x4bfd14){return new Promise(function(_0x1f2784,_0x4ad881){var _0x120ed4=util[_0x6ad8('0x8')](_0x6ad8('0x9'),'SIP',_0x4bfd14[_0x6ad8('0xa')]);if(_0x4c7be8[_0x6ad8('0xb')]&&_0x4c7be8[_0x6ad8('0xb')][_0x120ed4]&&_0x4c7be8[_0x6ad8('0xb')][_0x120ed4]['timer']){_0x4c7be8['timers'][_0x120ed4][_0x6ad8('0xc')]();}if(_0x4c7be8[_0x6ad8('0xd')][_0x120ed4]){_0x4c7be8[_0x6ad8('0xd')][_0x120ed4]['updateStatusRealtime']({'statePause':_0x4bfd14['pause']?!![]:![]});}_0x1f2784({'code':0xc8,'message':_0x6ad8('0xe')});});},'Reload':function(_0x327450){var _0x34e279=this;return new Promise(function(_0x5259f6,_0x2a18e5){if(ami[_0x6ad8('0xf')]()==![]){return _0x2a18e5(_0x34e279[_0x6ad8('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x6ad8('0x11')]['username'],'ami\x20disconnected'][_0x6ad8('0x12')]('\x20')));}_0x327450=_[_0x6ad8('0x13')](_0x327450,_[_0x6ad8('0x14')](properties['module']));_0x327450['action']=_0x6ad8('0x15');return ami[_0x6ad8('0x16')](_0x327450)[_0x6ad8('0x17')](function(_0x39c508){_0x5259f6({'code':0xc8,'message':_0x39c508['message']});})[_0x6ad8('0x18')](function(_0xc27f75){_0x2a18e5(_0x34e279[_0x6ad8('0x10')](0x1f5,_0xc27f75['message']));});});},'Command':function(_0x2a4e5c){var _0x23a852=this;return new Promise(function(_0x55443e,_0x532c14){if(ami['isConnected']()==![]){return _0x532c14(_0x23a852[_0x6ad8('0x10')](0x1f4,[config[_0x6ad8('0x11')]['ip'],config['asterisk'][_0x6ad8('0x19')],_0x6ad8('0x1a')][_0x6ad8('0x12')]('\x20')));}_0x2a4e5c=_[_0x6ad8('0x13')](_0x2a4e5c,'command');_0x2a4e5c['action']=_0x6ad8('0x1b');return ami[_0x6ad8('0x16')](_0x2a4e5c)[_0x6ad8('0x17')](function(_0x25b3c6){_0x55443e({'code':0xc8,'message':_0x25b3c6['content']});})[_0x6ad8('0x18')](function(_0x3fa636){_0x532c14(_0x23a852['error'](0x1f5,_0x3fa636['message']));});});},'VoiceQueues':function(_0x2dfd33){return new Promise(function(_0x4500b4,_0x30835f){var _0x1bcb8f=[];for(var _0x2b299b in _0x4c7be8['voiceQueues']){if(_0x4c7be8[_0x6ad8('0x1c')][_0x6ad8('0x1d')](_0x2b299b)){var _0x1c873f=_0x4c7be8[_0x6ad8('0x1c')][_0x2b299b];var _0x58d5cd={'id':_0x1c873f['id'],'name':_0x1c873f[_0x6ad8('0xa')],'strategy':_0x1c873f[_0x6ad8('0x1e')],'answered':_0x1c873f[_0x6ad8('0x1f')],'available':_0x1c873f[_0x6ad8('0x20')],'loggedIn':_0x1c873f[_0x6ad8('0x21')],'pTalking':_0x1c873f['pTalking'],'sumBillable':_0x1c873f[_0x6ad8('0x22')],'sumDuration':_0x1c873f[_0x6ad8('0x23')],'sumHoldTime':_0x1c873f[_0x6ad8('0x24')]||0x0,'talking':_0x1c873f[_0x6ad8('0x25')],'total':_0x1c873f[_0x6ad8('0x26')],'type':_0x1c873f[_0x6ad8('0x27')],'unmanaged':_0x1c873f[_0x6ad8('0x28')],'abandoned':_0x1c873f[_0x6ad8('0x29')],'waiting':_0x1c873f['waiting'],'loggedInDb':_0x1c873f[_0x6ad8('0x2a')]};if(_0x1c873f['type']===_0x6ad8('0x2b')){_0x58d5cd[_0x6ad8('0x2c')]=_0x1c873f[_0x6ad8('0x2c')];_0x58d5cd[_0x6ad8('0x2d')]=_0x1c873f[_0x6ad8('0x2d')];_0x58d5cd['dialOriginateCallerIdName']=_0x1c873f[_0x6ad8('0x2e')];_0x58d5cd['dialOriginateCallerIdNumber']=_0x1c873f['dialOriginateCallerIdNumber'];_0x58d5cd[_0x6ad8('0x2f')]=_0x1c873f[_0x6ad8('0x2f')];_0x58d5cd[_0x6ad8('0x30')]=_0x1c873f[_0x6ad8('0x30')];_0x58d5cd[_0x6ad8('0x31')]=_0x1c873f[_0x6ad8('0x31')];_0x58d5cd[_0x6ad8('0x32')]=_0x1c873f['outboundAnswerCallsDay'];_0x58d5cd[_0x6ad8('0x33')]=_0x1c873f[_0x6ad8('0x33')];_0x58d5cd['outboundBusyCallsDay']=_0x1c873f[_0x6ad8('0x34')];_0x58d5cd['outboundCongestionCallsDay']=_0x1c873f[_0x6ad8('0x35')];_0x58d5cd[_0x6ad8('0x36')]=_0x1c873f[_0x6ad8('0x36')];_0x58d5cd[_0x6ad8('0x37')]=_0x1c873f['outboundDropCallsDayCallersExit'];_0x58d5cd[_0x6ad8('0x38')]=_0x1c873f[_0x6ad8('0x38')];_0x58d5cd[_0x6ad8('0x39')]=_0x1c873f[_0x6ad8('0x39')];_0x58d5cd[_0x6ad8('0x3a')]=_0x1c873f[_0x6ad8('0x3a')];_0x58d5cd[_0x6ad8('0x3b')]=_0x1c873f['outboundOriginateFailureCallsDay'];_0x58d5cd[_0x6ad8('0x3c')]=_0x1c873f['outboundReCallsDay'];_0x58d5cd[_0x6ad8('0x3d')]=_0x1c873f[_0x6ad8('0x3d')];_0x58d5cd['outboundUnknownCallsDay']=_0x1c873f[_0x6ad8('0x3e')];_0x58d5cd[_0x6ad8('0x3f')]=_0x1c873f['predictiveIntervalAnsweredCalls'];_0x58d5cd[_0x6ad8('0x40')]=_0x1c873f['predictiveIntervalAvgHoldtime'];_0x58d5cd[_0x6ad8('0x41')]=_0x1c873f['predictiveIntervalAvgTalktime'];_0x58d5cd[_0x6ad8('0x42')]=_0x1c873f['predictiveIntervalDroppedCallsCallersExit'];_0x58d5cd[_0x6ad8('0x43')]=_0x1c873f[_0x6ad8('0x43')];_0x58d5cd[_0x6ad8('0x44')]=_0x1c873f[_0x6ad8('0x44')];_0x58d5cd['predictiveIntervalErlangCallsDroppedCalls']=_0x1c873f[_0x6ad8('0x45')];_0x58d5cd[_0x6ad8('0x46')]=_0x1c873f['predictiveIntervalHitRate'];_0x58d5cd[_0x6ad8('0x47')]=_0x1c873f[_0x6ad8('0x47')];_0x58d5cd[_0x6ad8('0x48')]=_0x1c873f[_0x6ad8('0x48')];_0x58d5cd[_0x6ad8('0x49')]=_0x1c873f[_0x6ad8('0x49')];_0x58d5cd['predictiveIntervalTotalCalls']=_0x1c873f[_0x6ad8('0x4a')];_0x58d5cd[_0x6ad8('0x4b')]=_0x1c873f['message'];_0x58d5cd[_0x6ad8('0x4c')]=_0x1c873f['originated'];_0x58d5cd['erlangCalls']=_0x1c873f['erlangCalls'];_0x58d5cd[_0x6ad8('0x4d')]=_0x1c873f['erlangCallToSecond'];_0x58d5cd[_0x6ad8('0x4e')]=_0x1c873f[_0x6ad8('0x4e')];_0x58d5cd['erlangBusyFactor']=_0x1c873f[_0x6ad8('0x4f')];_0x58d5cd['startPredictive']=_0x1c873f[_0x6ad8('0x50')];_0x58d5cd[_0x6ad8('0x51')]=_0x1c873f[_0x6ad8('0x51')];}if(_0x1c873f[_0x6ad8('0x52')]){_0x58d5cd[_0x6ad8('0x52')]={'id':_0x1c873f['Trunk']['id'],'name':_0x1c873f[_0x6ad8('0x52')][_0x6ad8('0xa')],'active':_0x1c873f[_0x6ad8('0x52')][_0x6ad8('0x53')],'callerid':_0x1c873f['Trunk']['callerid']};}if(_0x1c873f[_0x6ad8('0x54')]){_0x58d5cd[_0x6ad8('0x54')]={'id':_0x1c873f[_0x6ad8('0x54')]['id'],'name':_0x1c873f[_0x6ad8('0x54')][_0x6ad8('0xa')]};}_0x1bcb8f[_0x6ad8('0x55')](_0x58d5cd);}}_0x4500b4({'count':_0x1bcb8f[_0x6ad8('0x56')],'rows':_0x1bcb8f});});},'VoiceChannels':function(_0x6e0005){return new Promise(function(_0x1890c5,_0xa2fd28){var _0xd4ddb0=_[_0x6ad8('0x57')](_0x4c7be8[_0x6ad8('0x58')]);_0x1890c5({'count':_0xd4ddb0[_0x6ad8('0x56')],'rows':_0xd4ddb0});});},'VoiceChannelMixMonitor':function(_0x3d0ce9){var _0x333b62=this;return new Promise(function(_0xe04fc2,_0x2294a6){if(ami[_0x6ad8('0xf')]()==![]){return _0x2294a6(_0x333b62['error'](0x1f4,[config[_0x6ad8('0x11')]['ip'],config[_0x6ad8('0x11')][_0x6ad8('0x19')],_0x6ad8('0x1a')][_0x6ad8('0x12')]('\x20')));}var _0x22e8b5=schema(properties[_0x6ad8('0x59')])['validate'](_0x3d0ce9);if(_0x22e8b5['length']>0x0){return _0x2294a6(_0x333b62[_0x6ad8('0x10')](0x1f4,_['map'](_0x22e8b5,_0x6ad8('0x4b'))[_0x6ad8('0x12')](',\x20')));}var _0x217f00=_[_0x6ad8('0x5a')](_0x4c7be8[_0x6ad8('0x58')],{'uniqueid':_0x3d0ce9[_0x6ad8('0x5b')]});if(_0x217f00&&_0x217f00[_0x6ad8('0x5c')]){var _0x8673fd=util[_0x6ad8('0x8')]('%s.%s',_0x3d0ce9[_0x6ad8('0x5d')]||_0x3d0ce9[_0x6ad8('0x5b')],_0x3d0ce9['format']||_0x6ad8('0x5e'));return ami[_0x6ad8('0x16')]({'action':_0x6ad8('0x5f'),'channel':_0x217f00[_0x6ad8('0x5c')],'file':_0x8673fd,'options':_0x6ad8('0x60')})[_0x6ad8('0x17')](function(_0x453d67){var _0x1b56b5=_[_0x6ad8('0x5a')](_0x217f00[_0x6ad8('0x61')],{'filename':_0x6ad8('0x62')+_0x8673fd[_0x6ad8('0x63')]()});if(_[_0x6ad8('0x64')](_0x1b56b5)){_0x217f00['monitors'][_0x6ad8('0x55')]({'filename':_0x6ad8('0x62')+_0x8673fd[_0x6ad8('0x63')](),'createdAt':moment()[_0x6ad8('0x8')](_0x6ad8('0x65')),'mixmonitorid':_0x453d67['mixmonitorid'],'status':_0x6ad8('0x66')});}else{_0x1b56b5[_0x6ad8('0x67')]=_0x453d67['mixmonitorid'];_0x1b56b5[_0x6ad8('0x68')]=_0x6ad8('0x66');}_0xe04fc2({'code':0xc8,'message':[_0x3d0ce9[_0x6ad8('0x5b')],_0x6ad8('0x69'),_0x453d67[_0x6ad8('0x67')]][_0x6ad8('0x12')]('\x20'),'mixmonitorid':_0x453d67[_0x6ad8('0x67')]});})[_0x6ad8('0x18')](function(_0x5e0984){_0x2294a6(_0x333b62[_0x6ad8('0x10')](0x1f5,[_0x3d0ce9['uniqueid'],_0x5e0984['message'][_0x6ad8('0x63')]()]['join']('\x20')));});}else{return _0x2294a6(_0x333b62[_0x6ad8('0x10')](0x1f5,_0x6ad8('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x56f8bb){var _0x5d8d2e=this;return new Promise(function(_0x16d6f2,_0xf3681c){if(ami[_0x6ad8('0xf')]()==![]){return _0xf3681c(_0x5d8d2e[_0x6ad8('0x10')](0x1f4,[config[_0x6ad8('0x11')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6ad8('0x12')]('\x20')));}var _0x7dd74b=schema(properties['voicechannel'])[_0x6ad8('0x3')](_0x56f8bb);if(_0x7dd74b[_0x6ad8('0x56')]>0x0){return _0xf3681c(_0x5d8d2e[_0x6ad8('0x10')](0x1f4,_[_0x6ad8('0x6b')](_0x7dd74b,'message')[_0x6ad8('0x12')](',\x20')));}var _0x274f3f=_[_0x6ad8('0x5a')](_0x4c7be8[_0x6ad8('0x58')],{'uniqueid':_0x56f8bb['uniqueid']});if(_0x274f3f){return BPromise[_0x6ad8('0x6c')]()[_0x6ad8('0x17')](function(){if(_0x274f3f[_0x6ad8('0x5c')]){return ami[_0x6ad8('0x16')]({'action':_0x6ad8('0x6d'),'channel':_0x274f3f[_0x6ad8('0x5c')],'mixmonitorid':_0x56f8bb['mixmonitorid']})['catch'](function(_0x28b131){});}})[_0x6ad8('0x17')](function(){if(_0x274f3f[_0x6ad8('0x6e')]){return ami[_0x6ad8('0x16')]({'action':_0x6ad8('0x6d'),'channel':_0x274f3f['destinationchannel'],'mixmonitorid':_0x56f8bb[_0x6ad8('0x67')]})[_0x6ad8('0x18')](function(_0xba7018){});}})['then'](function(_0x41d153){var _0x5a5868=_['find'](_0x274f3f[_0x6ad8('0x61')],{'mixmonitorid':_0x56f8bb['mixmonitorid']});if(_0x5a5868){_0x5a5868[_0x6ad8('0x68')]=_0x6ad8('0x6f');}})[_0x6ad8('0x17')](function(){var _0x3aa304=util[_0x6ad8('0x8')](_0x6ad8('0x70'),_0x56f8bb[_0x6ad8('0x5d')]||_0x56f8bb[_0x6ad8('0x5b')],_0x56f8bb[_0x6ad8('0x8')]||_0x6ad8('0x5e'));var _0x34e82a=_[_0x6ad8('0x5a')](_0x274f3f[_0x6ad8('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x3aa304[_0x6ad8('0x63')]()});if(_0x34e82a){_0x34e82a[_0x6ad8('0x68')]='stop';}})[_0x6ad8('0x17')](function(){_0x16d6f2({'code':0xc8,'message':[_0x56f8bb[_0x6ad8('0x5b')],_0x6ad8('0x71')]['join']('\x20')});})[_0x6ad8('0x18')](function(_0x47349d){_0xf3681c(_0x5d8d2e[_0x6ad8('0x10')](0x1f5,[_0x56f8bb[_0x6ad8('0x5b')],_0x47349d['message']['toLowerCase']()][_0x6ad8('0x12')]('\x20')));});}else{return _0xf3681c(_0x5d8d2e[_0x6ad8('0x10')](0x1f5,_0x6ad8('0x6a')));}});},'VoiceQueuesChannels':function(_0x2211d8){return new Promise(function(_0x205bf1,_0x21cec8){var _0xe79602=_[_0x6ad8('0x57')](_0x4c7be8[_0x6ad8('0x72')]);_0x205bf1({'count':_0xe79602[_0x6ad8('0x56')],'rows':_0xe79602});});},'VoiceQueuesChannel':function(_0x2baabf){var _0x18de26=this;return new Promise(function(_0x34918e,_0x1d228f){var _0x343480=schema(properties[_0x6ad8('0x73')])[_0x6ad8('0x3')](_0x2baabf);if(_0x343480[_0x6ad8('0x56')]>0x0){return _0x1d228f(_0x18de26[_0x6ad8('0x10')](0x1f4,_[_0x6ad8('0x6b')](_0x343480,_0x6ad8('0x4b'))[_0x6ad8('0x12')](',\x20')));}var _0x4fad91=_[_0x6ad8('0x5a')](_0x4c7be8[_0x6ad8('0x72')],{'uniqueid':_0x2baabf['uniqueid']});if(_0x4fad91){_0x34918e(_0x4fad91);}else{return _0x1d228f(_0x18de26[_0x6ad8('0x10')](0x1f5,_0x6ad8('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x49bf0e){var _0x4ebe6b=this;return new Promise(function(_0x1ee902,_0x85fc27){if(ami['isConnected']()==![]){return _0x85fc27(_0x4ebe6b[_0x6ad8('0x10')](0x1f4,[config[_0x6ad8('0x11')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6ad8('0x12')]('\x20')));}var _0x26220b=schema(properties[_0x6ad8('0x74')])['validate'](_0x49bf0e);if(_0x26220b[_0x6ad8('0x56')]>0x0){return _0x85fc27(_0x4ebe6b[_0x6ad8('0x10')](0x1f4,_[_0x6ad8('0x6b')](_0x26220b,_0x6ad8('0x4b'))[_0x6ad8('0x12')](',\x20')));}var _0x16a2a5=_[_0x6ad8('0x5a')](_0x4c7be8[_0x6ad8('0x72')],{'uniqueid':_0x49bf0e[_0x6ad8('0x5b')]});if(_0x16a2a5&&_0x16a2a5[_0x6ad8('0x5c')]){return ami[_0x6ad8('0x16')]({'action':_0x6ad8('0x75'),'channel':_0x16a2a5[_0x6ad8('0x5c')]})['then'](function(_0x471f14){_0x1ee902({'code':0xc8,'message':[_0x49bf0e[_0x6ad8('0x5b')],_0x471f14[_0x6ad8('0x4b')][_0x6ad8('0x63')]()]['join']('\x20')});})[_0x6ad8('0x18')](function(_0x5c614c){_0x85fc27(_0x4ebe6b[_0x6ad8('0x10')](0x1f5,[_0x49bf0e[_0x6ad8('0x5b')],_0x5c614c[_0x6ad8('0x4b')][_0x6ad8('0x63')]()][_0x6ad8('0x12')]('\x20')));});}else{return _0x85fc27(_0x4ebe6b[_0x6ad8('0x10')](0x1f5,_0x6ad8('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x1b3cbf){var _0x2d01c9=this;return new Promise(function(_0x5a924d,_0x16c803){if(ami[_0x6ad8('0xf')]()==![]){return _0x16c803(_0x2d01c9[_0x6ad8('0x10')](0x1f4,[config[_0x6ad8('0x11')]['ip'],config[_0x6ad8('0x11')][_0x6ad8('0x19')],_0x6ad8('0x1a')][_0x6ad8('0x12')]('\x20')));}var _0x358c0d=schema(properties['voicequeuechannelredirect'])[_0x6ad8('0x3')](_0x1b3cbf);if(_0x358c0d['length']>0x0){return _0x16c803(_0x2d01c9[_0x6ad8('0x10')](0x1f4,_['map'](_0x358c0d,_0x6ad8('0x4b'))[_0x6ad8('0x12')](',\x20')));}var _0x1ef8f0=_[_0x6ad8('0x5a')](_0x4c7be8[_0x6ad8('0x72')],{'uniqueid':_0x1b3cbf[_0x6ad8('0x5b')]});if(_0x1ef8f0&&_0x1ef8f0[_0x6ad8('0x5c')]){return ami['Action']({'action':_0x6ad8('0x76'),'channel':_0x1ef8f0[_0x6ad8('0x5c')],'exten':_0x1b3cbf[_0x6ad8('0x77')],'context':_0x1b3cbf[_0x6ad8('0x78')]||_0x1ef8f0['context'],'priority':0x1})['then'](function(_0x2453e7){_0x5a924d({'code':0xc8,'message':[_0x1b3cbf[_0x6ad8('0x5b')],_0x2453e7[_0x6ad8('0x4b')][_0x6ad8('0x63')]()][_0x6ad8('0x12')]('\x20')});})[_0x6ad8('0x18')](function(_0x234b6f){_0x16c803(_0x2d01c9[_0x6ad8('0x10')](0x1f5,[_0x1b3cbf['uniqueid'],_0x234b6f[_0x6ad8('0x4b')][_0x6ad8('0x63')]()]['join']('\x20')));});}else{return _0x16c803(_0x2d01c9[_0x6ad8('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x4818eb){return new Promise(function(_0x19f5fd,_0x3b76a7){var _0x34292b=_[_0x6ad8('0x57')](_0x4c7be8[_0x6ad8('0xd')]);_0x19f5fd({'count':_0x34292b['length'],'rows':_0x34292b});});},'Telephones':function(_0x11acd0){return new Promise(function(_0x1e0a8e,_0x2d719f){var _0x14fd59=_[_0x6ad8('0x57')](_0x4c7be8[_0x6ad8('0x79')]);_0x1e0a8e({'count':_0x14fd59[_0x6ad8('0x56')],'rows':_0x14fd59});});},'Trunks':function(_0x1ce7d3){return new Promise(function(_0x4a0e3,_0x2f39ad){var _0x4f7fe9=_[_0x6ad8('0x57')](_0x4c7be8[_0x6ad8('0x7a')]);_0x4a0e3({'count':_0x4f7fe9['length'],'rows':_0x4f7fe9});});},'OutboundChannels':function(_0x477835){return new Promise(function(_0x23720e,_0x39897b){var _0x456e86=_['values'](_0x4c7be8[_0x6ad8('0x7b')]);_0x23720e({'count':_0x456e86['length'],'rows':_0x456e86});});},'Outbound':function(_0xf874c0){return new Promise(function(_0x5b8ade,_0x16889f){_0x5b8ade(_0x4c7be8[_0x6ad8('0x2b')]);});},'Campaigns':function(_0x3a7f62){return new Promise(function(_0x1a34ba,_0x325c79){var _0x3b6196=_[_0x6ad8('0x57')](_0x4c7be8[_0x6ad8('0x7c')]);_0x1a34ba({'count':_0x3b6196['length'],'rows':_0x3b6196});});},'VoiceQueuesPreview':function(_0x35514a){var _0x1d0966=this;return new Promise(function(_0x47e3e2,_0x228c95){_0x67a9fa[_0x6ad8('0x7d')](_0x35514a['id'])[_0x6ad8('0x17')](function(_0x24a419){_0x47e3e2({'code':0xc8,'message':_0x24a419[_0x6ad8('0x4b')]});})[_0x6ad8('0x18')](function(_0x11a1ad){_0x228c95(_0x1d0966[_0x6ad8('0x10')](0x1f4,_0x11a1ad['message']));});});},'EventManager':function(_0x52fe84){var _0x5a4442=this;return new Promise(function(_0x3a4734,_0x15c14b){if(!_0x52fe84[_0x6ad8('0x7e')]){return _0x15c14b(_0x5a4442[_0x6ad8('0x10')](0x1f4,_0x6ad8('0x7f')));}ami[_0x6ad8('0x80')]('custom:'+_0x52fe84[_0x6ad8('0x7e')],_0x52fe84[_0x6ad8('0x4b')]);_0x3a4734({'code':0xc8,'message':_0x52fe84});});},'FaxAccounts':function(_0x1947aa){return new Promise(function(_0x591295,_0x5732b1){var _0x2d6608=_['values'](_0x4c7be8['faxAccounts']);_0x591295({'count':_0x2d6608[_0x6ad8('0x56')],'rows':_0x2d6608});});},'SendFax':function(_0x3795cb){var _0x7b0aab=this;return new Promise(function(_0x11f531,_0x3db2d7){_0x5113f3[_0x6ad8('0x81')](_0x3795cb)[_0x6ad8('0x17')](function(_0x396cfb){_0x11f531({'code':0xc8,'message':_0x396cfb[_0x6ad8('0x4b')]});})[_0x6ad8('0x18')](function(_0x346500){_0x3db2d7(_0x7b0aab[_0x6ad8('0x10')](0x1f4,_0x346500[_0x6ad8('0x4b')]));});});},'CheckAfterSend':function(_0x3b3116){var _0x5d71a1=this;return new Promise(function(_0x5644ef,_0x2a949d){_0x5113f3['checkAfterSend'](_0x3b3116)[_0x6ad8('0x17')](function(_0x40a5f1){_0x5644ef({'code':0xc8,'message':_0x40a5f1['message']});})['catch'](function(_0x2c1f3b){_0x2a949d(_0x5d71a1['error'](0x1f4,_0x2c1f3b[_0x6ad8('0x4b')]));});});}};var _0x88ca76=jayson['server'](_0x4e6599)['http']();_0x88ca76['on'](_0x6ad8('0x10'),function(_0x59daa4){return _0x4c59cf(_0x59daa4);});_0x88ca76[_0x6ad8('0x7')](0x232a,_0x6ad8('0x82'),function(){console[_0x6ad8('0x83')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2af3f7(_0x6ad8('0x84')+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 14121fc..72614c2 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 _0x98e2=['then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','resolve'];(function(_0x2b010c,_0x328d56){var _0x5c3908=function(_0x53a606){while(--_0x53a606){_0x2b010c['push'](_0x2b010c['shift']());}};_0x5c3908(++_0x328d56);}(_0x98e2,0xc6));var _0x298e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x98e2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x298e('0x0'));var BPromise=require(_0x298e('0x1'));var Redis=require(_0x298e('0x2'));var util=require(_0x298e('0x3'));var config=require(_0x298e('0x4'));var logger=require(_0x298e('0x5'))(_0x298e('0x6'));var cmContactRpc=require(_0x298e('0x7'));config['redis']=_[_0x298e('0x8')](config[_0x298e('0x9')],{'host':_0x298e('0xa'),'port':0x18eb});var io=require(_0x298e('0xb'))(new Redis(config[_0x298e('0x9')]));function emit(_0x5b2fab,_0x8a88a2,_0x3e6f9a,_0x3ebbfc,_0x17a6e9){logger['info'](_0x298e('0xc'),_0x5b2fab,_0x8a88a2['id'],_0x3e6f9a,_0x3ebbfc,JSON[_0x298e('0xd')](_0x17a6e9));io['to'](_0x3e6f9a)['emit'](_0x3ebbfc,_0x17a6e9);}exports[_0x298e('0xe')]=function(_0x108d38,_0xabd3a8,_0x1cc6ea,_0x377cdf){var _0x50411a,_0x47947e;var _0x29801d={};var _0x55ea76=Number(_0x1cc6ea[_0x298e('0xf')]);var _0x2c5a17=_0x1cc6ea[_0x298e('0x10')]?Boolean(Number(_0x1cc6ea[_0x298e('0x10')])):![];var _0x398ef7;if(_0x377cdf['xmd-contactid']){_0x29801d['id']=_0x377cdf[_0x298e('0x11')];}if(!_0x29801d['id']){_0x29801d[_0x298e('0x12')]=_0x55ea76;_0x398ef7=_0x1cc6ea[_0x298e('0x13')]&&_0x1cc6ea[_0x298e('0x13')]!=='0'?_0x1cc6ea[_0x298e('0x13')][_0x298e('0x14')](','):[_0x298e('0x15')];_0x29801d[_0x298e('0x16')]=_[_0x298e('0x17')](_0x398ef7,function(_0x1d32cc){var _0x1a6304={};_0x1a6304[_0x1d32cc]=_0x377cdf[_0x298e('0x18')]?_0x377cdf[_0x298e('0x19')]:_0x377cdf[_0x298e('0x1a')];return _0x1a6304;});}var _0x4e8bea=['id',_0x298e('0x1b'),_0x298e('0x1c'),_0x298e('0x15'),_0x298e('0x1d'),'fax',_0x298e('0x12'),_0x298e('0x1e'),_0x298e('0x1f'),_0x298e('0x20')];var _0x34f8ff=_['union'](_0x4e8bea,_0x398ef7);BPromise[_0x298e('0x21')]()[_0x298e('0x22')](cmContactRpc['getContacts']({'attributes':_0x34f8ff,'where':_0x29801d}))[_0x298e('0x22')](function(_0x201bf1){_0x47947e=_0x201bf1;if(!_[_0x298e('0x23')](_0x47947e)){if(_0x47947e[_0x298e('0x24')]===0x1){_0x50411a=_0x47947e[0x0];logger[_0x298e('0x25')](_0x298e('0x26'),_0x377cdf[_0x298e('0x27')],_0xabd3a8['id'],_0x50411a['id']);}else{logger[_0x298e('0x25')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x377cdf[_0x298e('0x27')],_0xabd3a8['id'],_['map'](_0x47947e,'id')[_0x298e('0x28')](','));}return;}else{logger['info'](_0x298e('0x29'),_0x377cdf['uniqueid'],_0xabd3a8['id']);var _0x15ff82={'ListId':_0x55ea76};var _0x427007=_0x1cc6ea[_0x298e('0x2a')]&&_0x1cc6ea[_0x298e('0x2a')]!=='0'?_0x1cc6ea[_0x298e('0x2a')]:_0x298e('0x15');if(_0x2c5a17){logger[_0x298e('0x25')](_0x298e('0x2b'),_0x377cdf['uniqueid'],_0xabd3a8['id']);_0x15ff82[_0x427007]=_[_0x298e('0x2c')](_0x377cdf[_0x298e('0x18')])?_0x377cdf[_0x298e('0x1a')]:_0x377cdf[_0x298e('0x19')];if(_[_0x298e('0x2c')](_0x377cdf[_0x298e('0x18')])){_0x15ff82[_0x298e('0x1b')]=_0x377cdf['calleridname']&&_0x377cdf[_0x298e('0x2d')]!==_0x298e('0x2e')?_0x377cdf[_0x298e('0x2d')]:_0x298e('0x2f');}else{_0x15ff82[_0x298e('0x1b')]=_0x377cdf[_0x298e('0x30')]&&_0x377cdf[_0x298e('0x30')]!==''?_0x377cdf[_0x298e('0x30')]:_0x298e('0x2f');}return BPromise[_0x298e('0x21')]()[_0x298e('0x22')](cmContactRpc[_0x298e('0x31')](_0x15ff82))[_0x298e('0x22')](function(_0x4d38f8){_0x50411a=_0x4d38f8;_0x47947e[_0x298e('0x32')](_0x4d38f8);if(_0x50411a){logger[_0x298e('0x25')](_0x298e('0x33'),_0x377cdf[_0x298e('0x27')],_0xabd3a8['id'],_0x50411a['id']);}return;});}else{logger[_0x298e('0x25')](_0x298e('0x34'),_0x377cdf[_0x298e('0x27')],_0xabd3a8['id']);_0x15ff82[_0x427007]=_[_0x298e('0x2c')](_0x377cdf['routeId'])?_0x377cdf['calleridnum']:_0x377cdf[_0x298e('0x19')];if(_['isNil'](_0x377cdf[_0x298e('0x18')])){_0x15ff82['firstName']=_0x377cdf[_0x298e('0x2d')]&&_0x377cdf[_0x298e('0x2d')]!==''?_0x377cdf['calleridname']:_0x298e('0x2f');}else{_0x15ff82['firstName']=_0x377cdf[_0x298e('0x30')]&&_0x377cdf[_0x298e('0x30')]!==''?_0x377cdf[_0x298e('0x30')]:'Unknown';}_0x50411a=_0x15ff82;_0x47947e[_0x298e('0x32')](_0x15ff82);return;}}})[_0x298e('0x22')](function(){if(_0x108d38){emit(_0x377cdf[_0x298e('0x27')],_0xabd3a8,util['format']('user:%s',_0x108d38['name']),util[_0x298e('0x35')](_0x298e('0x36'),_0x1cc6ea[_0x298e('0x37')][_0x298e('0x38')]()),{'evt':_[_0x298e('0x39')](_0x377cdf,{'autoCreate':_0x2c5a17}),'contact':_0x50411a===undefined?{}:_0x50411a,'contacts':_0x47947e[_0x298e('0x24')]===0x0?undefined:_0x47947e});}});}; \ No newline at end of file +var _0x5e95=['util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','action','toLowerCase','merge','lodash','bluebird','ioredis'];(function(_0x54d26e,_0x169876){var _0x5da276=function(_0x463b3e){while(--_0x463b3e){_0x54d26e['push'](_0x54d26e['shift']());}};_0x5da276(++_0x169876);}(_0x5e95,0x19a));var _0x55e9=function(_0x236aaa,_0x2a1f38){_0x236aaa=_0x236aaa-0x0;var _0x341724=_0x5e95[_0x236aaa];return _0x341724;};'use strict';var _=require(_0x55e9('0x0'));var BPromise=require(_0x55e9('0x1'));var Redis=require(_0x55e9('0x2'));var util=require(_0x55e9('0x3'));var config=require(_0x55e9('0x4'));var logger=require(_0x55e9('0x5'))(_0x55e9('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x55e9('0x7')]=_[_0x55e9('0x8')](config[_0x55e9('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x55e9('0x9'))(new Redis(config[_0x55e9('0x7')]));function emit(_0x2efe48,_0x30541a,_0x5d1b88,_0x201041,_0x4a10c5){logger[_0x55e9('0xa')](_0x55e9('0xb'),_0x2efe48,_0x30541a['id'],_0x5d1b88,_0x201041,JSON[_0x55e9('0xc')](_0x4a10c5));io['to'](_0x5d1b88)[_0x55e9('0xd')](_0x201041,_0x4a10c5);}exports[_0x55e9('0xe')]=function(_0x3a7288,_0x278a2c,_0x7d4f9e,_0x5a4809){var _0x54406e,_0x80716f;var _0x47f323={};var _0x1ddd10=Number(_0x7d4f9e[_0x55e9('0xf')]);var _0x1d6b49=_0x7d4f9e[_0x55e9('0x10')]?Boolean(Number(_0x7d4f9e[_0x55e9('0x10')])):![];var _0x32a0e5;if(_0x5a4809[_0x55e9('0x11')]){_0x47f323['id']=_0x5a4809[_0x55e9('0x11')];}if(!_0x47f323['id']){_0x47f323[_0x55e9('0x12')]=_0x1ddd10;_0x32a0e5=_0x7d4f9e[_0x55e9('0x13')]&&_0x7d4f9e[_0x55e9('0x13')]!=='0'?_0x7d4f9e['data3'][_0x55e9('0x14')](','):[_0x55e9('0x15')];_0x47f323[_0x55e9('0x16')]=_[_0x55e9('0x17')](_0x32a0e5,function(_0x44e157){var _0x1af860={};_0x1af860[_0x44e157]=_0x5a4809['routeId']?_0x5a4809[_0x55e9('0x18')]:_0x5a4809[_0x55e9('0x19')];return _0x1af860;});}var _0x22ffbb=['id',_0x55e9('0x1a'),_0x55e9('0x1b'),_0x55e9('0x15'),_0x55e9('0x1c'),_0x55e9('0x1d'),_0x55e9('0x12'),_0x55e9('0x1e'),_0x55e9('0x1f'),_0x55e9('0x20')];var _0x48f00c=_[_0x55e9('0x21')](_0x22ffbb,_0x32a0e5);BPromise[_0x55e9('0x22')]()[_0x55e9('0x23')](cmContactRpc['getContacts']({'attributes':_0x48f00c,'where':_0x47f323}))[_0x55e9('0x23')](function(_0x155698){_0x80716f=_0x155698;if(!_[_0x55e9('0x24')](_0x80716f)){if(_0x80716f[_0x55e9('0x25')]===0x1){_0x54406e=_0x80716f[0x0];logger[_0x55e9('0xa')](_0x55e9('0x26'),_0x5a4809[_0x55e9('0x27')],_0x278a2c['id'],_0x54406e['id']);}else{logger['info'](_0x55e9('0x28'),_0x5a4809[_0x55e9('0x27')],_0x278a2c['id'],_[_0x55e9('0x17')](_0x80716f,'id')[_0x55e9('0x29')](','));}return;}else{logger['info'](_0x55e9('0x2a'),_0x5a4809[_0x55e9('0x27')],_0x278a2c['id']);var _0x38846e={'ListId':_0x1ddd10};var _0x2f7b95=_0x7d4f9e[_0x55e9('0x2b')]&&_0x7d4f9e['data4']!=='0'?_0x7d4f9e[_0x55e9('0x2b')]:_0x55e9('0x15');if(_0x1d6b49){logger[_0x55e9('0xa')](_0x55e9('0x2c'),_0x5a4809[_0x55e9('0x27')],_0x278a2c['id']);_0x38846e[_0x2f7b95]=_[_0x55e9('0x2d')](_0x5a4809[_0x55e9('0x2e')])?_0x5a4809[_0x55e9('0x19')]:_0x5a4809[_0x55e9('0x18')];if(_[_0x55e9('0x2d')](_0x5a4809[_0x55e9('0x2e')])){_0x38846e[_0x55e9('0x1a')]=_0x5a4809['calleridname']&&_0x5a4809[_0x55e9('0x2f')]!==_0x55e9('0x30')?_0x5a4809['calleridname']:_0x55e9('0x31');}else{_0x38846e[_0x55e9('0x1a')]=_0x5a4809[_0x55e9('0x32')]&&_0x5a4809['destcalleridname']!==_0x55e9('0x30')?_0x5a4809[_0x55e9('0x32')]:_0x55e9('0x31');}return BPromise['resolve']()[_0x55e9('0x23')](cmContactRpc[_0x55e9('0x33')](_0x38846e))[_0x55e9('0x23')](function(_0xda1702){_0x54406e=_0xda1702;_0x80716f[_0x55e9('0x34')](_0xda1702);if(_0x54406e){logger['info'](_0x55e9('0x35'),_0x5a4809[_0x55e9('0x27')],_0x278a2c['id'],_0x54406e['id']);}return;});}else{logger[_0x55e9('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5a4809[_0x55e9('0x27')],_0x278a2c['id']);_0x38846e[_0x2f7b95]=_[_0x55e9('0x2d')](_0x5a4809[_0x55e9('0x2e')])?_0x5a4809['calleridnum']:_0x5a4809['destcalleridnum'];if(_[_0x55e9('0x2d')](_0x5a4809[_0x55e9('0x2e')])){_0x38846e[_0x55e9('0x1a')]=_0x5a4809[_0x55e9('0x2f')]&&_0x5a4809['calleridname']!==_0x55e9('0x30')?_0x5a4809[_0x55e9('0x2f')]:_0x55e9('0x31');}else{_0x38846e[_0x55e9('0x1a')]=_0x5a4809[_0x55e9('0x32')]&&_0x5a4809[_0x55e9('0x32')]!==_0x55e9('0x30')?_0x5a4809[_0x55e9('0x32')]:_0x55e9('0x31');}_0x54406e=_0x38846e;_0x80716f[_0x55e9('0x34')](_0x38846e);return;}}})[_0x55e9('0x23')](function(){if(_0x3a7288){emit(_0x5a4809[_0x55e9('0x27')],_0x278a2c,util[_0x55e9('0x36')](_0x55e9('0x37'),_0x3a7288['name']),util[_0x55e9('0x36')]('trigger:%s',_0x7d4f9e[_0x55e9('0x38')][_0x55e9('0x39')]()),{'evt':_[_0x55e9('0x3a')](_0x5a4809,{'autoCreate':_0x1d6b49}),'contact':_0x54406e===undefined?{}:_0x54406e,'contacts':_0x80716f[_0x55e9('0x25')]===0x0?undefined:_0x80716f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a324665..f13ea69 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 _0xf2ac=['name','trigger:%s:%s','toLowerCase','merge','user:%s','trigger:%s','exec','queue','urlforward','script','query','checkTrigger','AllConditions','every','checkConditions','AnyConditions','some','account','channel','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','lastevent','routeId','exports','util','mustache','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','sugarcrmAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:rejectmessage','prototype','info','emit','clone','checkTriggers','hasOwnProperty','variables','Actions','length','interface','action','contactmanager','motionbar','data1','popup','TemplateId','html','render','data2','template\x20not\x20found','buildUri','isNil','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','data3','format'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf2ac,0x91));var _0xcf2a=function(_0x5b82b7,_0x3c184d){_0x5b82b7=_0x5b82b7-0x0;var _0x3cccc=_0xf2ac[_0x5b82b7];return _0x3cccc;};'use strict';var util=require(_0xcf2a('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0xcf2a('0x1'));var Redis=require('ioredis');var urlforward=require(_0xcf2a('0x2'));var integration=require(_0xcf2a('0x3'));var cmContact=require(_0xcf2a('0x4'));var script=require('./script');var config=require(_0xcf2a('0x5'));var logger=require(_0xcf2a('0x6'))(_0xcf2a('0x7'));var ami=require(_0xcf2a('0x8'));config['redis']=_[_0xcf2a('0x9')](config[_0xcf2a('0xa')],{'host':_0xcf2a('0xb'),'port':0x18eb});var io=require(_0xcf2a('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x317781,_0x2b2472){return _0x317781==_0x2b2472;},'not_equals':function(_0x3aa3b0,_0x580d6b){return _0x3aa3b0!=_0x580d6b;}};var barAndWebActions=['popup',_0xcf2a('0xd'),_0xcf2a('0xe')];function Trigger(_0x495c89){this[_0xcf2a('0xf')]=_0x495c89['triggers'];this[_0xcf2a('0x10')]=_0x495c89[_0xcf2a('0x10')];this[_0xcf2a('0x11')]=_0x495c89['voiceQueues'];this[_0xcf2a('0x12')]=_0x495c89[_0xcf2a('0x12')];this[_0xcf2a('0x13')]=_0x495c89['voiceExtensions'];this[_0xcf2a('0x14')]=_0x495c89[_0xcf2a('0x14')];this[_0xcf2a('0x15')]=_0x495c89[_0xcf2a('0x15')];this['salesforceAccounts']=_0x495c89[_0xcf2a('0x16')];this['sugarcrmAccounts']=_0x495c89['sugarcrmAccounts'];this[_0xcf2a('0x17')]=_0x495c89[_0xcf2a('0x17')];this[_0xcf2a('0x18')]=_0x495c89[_0xcf2a('0x18')];this[_0xcf2a('0x19')]=_0x495c89[_0xcf2a('0x19')];this['servicenowAccounts']=_0x495c89[_0xcf2a('0x1a')];this[_0xcf2a('0x1b')]=_0x495c89[_0xcf2a('0x1b')];this['freshsalesAccounts']=_0x495c89[_0xcf2a('0x1c')];this['accounts']={'zendesk':this[_0xcf2a('0x14')],'salesforce':this[_0xcf2a('0x16')],'freshdesk':this[_0xcf2a('0x15')],'sugarcrm':this[_0xcf2a('0x1d')],'zoho':this[_0xcf2a('0x17')],'desk':this[_0xcf2a('0x18')],'vtiger':this[_0xcf2a('0x19')],'dynamics365':this[_0xcf2a('0x1b')],'freshsales':this[_0xcf2a('0x1c')],'servicenow':this[_0xcf2a('0x1a')]};ami['on']('custom:agentcalled',this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x20'),this[_0xcf2a('0x1e')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xcf2a('0x1e')]['bind'](this));ami['on'](_0xcf2a('0x21'),this['syncCustomEvent'][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x22'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x23'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x24'),this['syncCustomEvent'][_0xcf2a('0x1f')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x25'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x26'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x27'),this[_0xcf2a('0x1e')]['bind'](this));ami['on'](_0xcf2a('0x28'),this[_0xcf2a('0x29')]['bind'](this));ami['on'](_0xcf2a('0x2a'),this[_0xcf2a('0x29')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x2b'),this[_0xcf2a('0x29')]['bind'](this));ami['on'](_0xcf2a('0x2c'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x2d'),this['syncCustomEvent'][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x2e'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on']('custom:acceptmessage',this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));ami['on'](_0xcf2a('0x2f'),this[_0xcf2a('0x1e')][_0xcf2a('0x1f')](this));}Trigger[_0xcf2a('0x30')]['emit']=function(_0x4c1a73,_0x49d862,_0x40e921){logger[_0xcf2a('0x31')](_0x4c1a73,_0x49d862,JSON['stringify'](_0x40e921));io['to'](_0x4c1a73)[_0xcf2a('0x32')](_0x49d862,_0x40e921);};Trigger[_0xcf2a('0x30')][_0xcf2a('0x1e')]=function(_0x11c79e){var _0x386d35=_[_0xcf2a('0x33')](_0x11c79e);this[_0xcf2a('0x34')](_0x386d35);};Trigger[_0xcf2a('0x30')]['syncAgentDial']=function(_0xe4958f){if(this[_0xcf2a('0x10')][_0xe4958f['interface']]){this[_0xcf2a('0x1e')](_0xe4958f);}};Trigger[_0xcf2a('0x30')][_0xcf2a('0x34')]=function(_0x5b1ba1){var _0x54d925;for(var _0x46e5eb in this[_0xcf2a('0xf')]){if(this['triggers'][_0xcf2a('0x35')](_0x46e5eb)){if(this[_0xcf2a('0xf')][_0x46e5eb]['status']){_0x54d925=this['checkTrigger'](this[_0xcf2a('0xf')][_0x46e5eb],_0x5b1ba1);if(_0x54d925){_['merge'](_0x5b1ba1,_0x5b1ba1[_0xcf2a('0x36')]);for(var _0x2818c8=0x0,_0x306497,_0x59728f,_0x23d388;_0x2818c80x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ 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 8d1c683..88ae07c 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 _0x6066=['string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecalls','callDirection','queue','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','toUpperCase','message','GET','Bearer\x20','4.0','then','isNil','validateEmail','email','userEmail','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','catch','toLowerCase','destcalleridnum','calleridnum','headers','odata-entityid','substring','enduserId','contacts?$select=telephone1','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6066,0x1c6));var _0x6606=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x6066[_0x2f9467];return _0x39894c;};'use strict';var _=require(_0x6606('0x0'));var BPromise=require(_0x6606('0x1'));var rp=require(_0x6606('0x2'));var util=require(_0x6606('0x3'));var intUtil=require(_0x6606('0x4'));var md5=require(_0x6606('0x5'));var Redis=require(_0x6606('0x6'));var logger=require(_0x6606('0x7'))(_0x6606('0x8'));var config=require(_0x6606('0x9'));config[_0x6606('0xa')]=_[_0x6606('0xb')](config[_0x6606('0xa')],{'host':_0x6606('0xc'),'port':0x18eb});var io=require(_0x6606('0xd'))(new Redis(config[_0x6606('0xa')]));function getAuthToken(_0x11a5da,_0x3af386,_0x136973){var _0xb3673e={'method':_0x6606('0xe'),'uri':_0x3af386,'form':{'client_id':_0x11a5da['clientId'],'resource':_0x11a5da[_0x6606('0xf')],'username':_0x11a5da[_0x6606('0x10')],'password':_0x11a5da[_0x6606('0x11')],'grant_type':'password','client_secret':_0x11a5da[_0x6606('0x12')]},'json':!![]};return rp(_0xb3673e)['then'](function(_0x4cf94e){return _0x4cf94e['access_token'];})['catch'](function(_0x3a3a85){logger['error']('['+[_0x136973[_0x6606('0x13')]()]+']\x20Wrong\x20credentials!');return _0x3a3a85[_0x6606('0x14')];});}function getUser(_0x1b4a2f,_0x53ea3b,_0x2ed69d,_0x3fa371,_0x1d3b23,_0x2c8478){return new BPromise(function(_0x527e47,_0x23fd89){return getAuthToken(_0x53ea3b,_0x3fa371,_0x2c8478)['then'](function(_0x77e55c){var _0x369f16={'method':_0x6606('0x15'),'uri':_0x1d3b23+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x6606('0x16')+_0x77e55c,'OData-Version':_0x6606('0x17')},'json':!![]};return rp(_0x369f16);})[_0x6606('0x18')](function(_0x20308f){var _0x213a91=_0x20308f['value'];var _0x5b598f=![];var _0x52be73=null;if(!_[_0x6606('0x19')](_0x2ed69d)){if(intUtil[_0x6606('0x1a')](_0x2ed69d[_0x6606('0x1b')])){_0x1b4a2f[_0x6606('0x1c')]=_0x2ed69d['email'];for(_0x52be73=0x0;_0x52be73<_0x213a91['length'];_0x52be73++){if(_0x213a91[_0x52be73]['internalemailaddress']===_0x2ed69d['email']&&!_0x213a91[_0x52be73][_0x6606('0x1d')]){_0x5b598f=!![];logger[_0x6606('0x1e')]('['+[_0x2c8478[_0x6606('0x13')]()]+']\x20Agent\x20found\x20'+_0x213a91[_0x52be73][_0x6606('0x1f')]+'!');_0x1b4a2f[_0x6606('0x20')]=_0x213a91[_0x52be73]['systemuserid'];}}}}if(!_0x5b598f){logger[_0x6606('0x1e')]('['+[_0x2c8478[_0x6606('0x13')]()]+_0x6606('0x21'));_0x1b4a2f[_0x6606('0x1c')]=_0x53ea3b[_0x6606('0x10')];for(_0x52be73=0x0;_0x52be73<_0x213a91[_0x6606('0x22')];_0x52be73++){if(_0x213a91[_0x52be73][_0x6606('0x23')]===_0x53ea3b[_0x6606('0x10')]){_0x1b4a2f[_0x6606('0x20')]=_0x213a91[_0x52be73][_0x6606('0x1f')];}}}_0x527e47(_0x1b4a2f);})[_0x6606('0x24')](function(_0x3b243d){_0x23fd89(_0x3b243d[_0x6606('0x14')]);});});}function createEndUser(_0x1604ff,_0x2ab590,_0x7dac35,_0x49754e,_0x5b28f3,_0x552435){return new BPromise(function(_0x4e6587,_0x4e5704){return getAuthToken(_0x2ab590,_0x7dac35,_0x552435)[_0x6606('0x18')](function(_0x4936de){var _0x3e4df7=_0x552435[_0x6606('0x25')]()==='outbound'?_0x5b28f3[_0x6606('0x26')]:_0x5b28f3[_0x6606('0x27')];var _0x53f769={'method':_0x6606('0xe'),'uri':_0x49754e+'contacts','body':{'telephone1':_0x3e4df7,'fullname':_0x3e4df7,'firstname':_0x3e4df7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1604ff[_0x6606('0x20')]+')'},'headers':{'Authorization':_0x6606('0x16')+_0x4936de,'OData-Version':_0x6606('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x53f769);})['then'](function(_0x12bd00){var _0x4161f5=_0x12bd00[_0x6606('0x28')][_0x6606('0x29')];var _0x17f706=_0x4161f5[_0x6606('0x2a')](_0x4161f5['lastIndexOf']('(')+0x1,_0x4161f5['lastIndexOf'](')'));_0x1604ff[_0x6606('0x2b')]=_0x17f706;_0x4e6587(_0x1604ff);})['catch'](function(_0x156325){_0x4e5704(_0x156325[_0x6606('0x14')]);});});}function getEndUser(_0x3d66b8,_0x407e13,_0x4bc5b8,_0x52656c,_0x50f97b,_0x159ef7){return new BPromise(function(_0x17cb0b,_0x4b2035){return getAuthToken(_0x407e13,_0x4bc5b8,_0x159ef7)[_0x6606('0x18')](function(_0x24d427){var _0x5f24da={'method':_0x6606('0x15'),'uri':_0x52656c+_0x6606('0x2c'),'headers':{'Authorization':'Bearer\x20'+_0x24d427,'If-None-Match':null,'OData-Version':_0x6606('0x17')},'json':!![]};return rp(_0x5f24da);})[_0x6606('0x18')](function(_0x2398ca){var _0x6c6a27=null;if(_0x2398ca){var _0x5d377f=_0x2398ca['value'];var _0x17921f=![];for(_0x6c6a27=0x0;_0x6c6a27<_0x5d377f[_0x6606('0x22')];_0x6c6a27++){var _0x3049af=_0x159ef7[_0x6606('0x25')]()===_0x6606('0x2d')?_0x50f97b[_0x6606('0x26')]:_0x50f97b[_0x6606('0x27')];if(_0x5d377f[_0x6c6a27][_0x6606('0x2e')]===_0x3049af){_0x17921f=!![];_0x3d66b8[_0x6606('0x2b')]=_0x5d377f[_0x6c6a27][_0x6606('0x2f')];}}if(_0x17921f){_0x17cb0b(_0x3d66b8);}else{return createEndUser(_0x3d66b8,_0x407e13,_0x4bc5b8,_0x52656c,_0x50f97b,_0x159ef7)[_0x6606('0x18')](function(_0x26b830){logger[_0x6606('0x1e')]('['+[_0x159ef7[_0x6606('0x13')]()]+_0x6606('0x30'),_0x26b830['enduserId']);_0x17cb0b(_0x26b830);});}}else{return createEndUser(_0x3d66b8,_0x407e13,_0x4bc5b8,_0x52656c,_0x50f97b,_0x159ef7)[_0x6606('0x18')](function(_0xe2cba6){logger[_0x6606('0x1e')]('['+[_0x159ef7[_0x6606('0x13')]()]+_0x6606('0x31'),_0xe2cba6[_0x6606('0x2b')]);_0x17cb0b(_0xe2cba6);});}});});}function getCustomFields(_0xd97468,_0x1dc5eb,_0x157539){var _0x12a9d0={};if(_0xd97468[_0x6606('0x22')]>0x0){_[_0x6606('0x32')](_0xd97468,function(_0x5860eb){if(_0x5860eb['type']===_0x6606('0x33')&&_0x5860eb[_0x6606('0x34')]&&!_0x5860eb[_0x6606('0x35')]){var _0x41d26f=_0x5860eb[_0x6606('0x36')][_0x6606('0x25')]();var _0x31243c=_0x41d26f['substring'](0x0,_0x41d26f[_0x6606('0x37')]('_'));var _0x39f91f=_0x41d26f[_0x6606('0x2a')](_0x41d26f['indexOf']('_')+0x1);if(_0x31243c===_0x157539){_0x12a9d0[_0x39f91f]=_0x5860eb[_0x6606('0x38')];}}});}return _0x12a9d0;}function getTicket(_0x16f2fc,_0x3078cb,_0xd1c9fd,_0x24450a,_0x843242,_0x4a72f4,_0x485f38){return new BPromise(function(_0x19009c,_0x5112d3){var _0x2deae5;return getAuthToken(_0x3078cb,_0xd1c9fd,_0x485f38)[_0x6606('0x18')](function(_0x59f327){if(_0x4a72f4[_0x6606('0x39')]===_0x6606('0x3a')){_0x2deae5={'method':'POST','uri':_0x24450a+_0x6606('0x3b'),'body':Object[_0x6606('0x3c')]({},{'title':intUtil[_0x6606('0x3d')](_0x4a72f4[_0x6606('0x3e')],_0x843242,'\x20'),'description':intUtil[_0x6606('0x3d')](_0x4a72f4[_0x6606('0x3f')],_0x843242,'\x0a'),'customerid_contact@odata.bind':_0x6606('0x40')+_0x16f2fc[_0x6606('0x2b')]+')','ownerid@odata.bind':_0x6606('0x41')+_0x16f2fc[_0x6606('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x4a72f4[_0x6606('0x42')],_0x843242,_0x4a72f4[_0x6606('0x39')])),'headers':{'Authorization':_0x6606('0x16')+_0x59f327,'OData-Version':_0x6606('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4a72f4[_0x6606('0x39')]==='phonecall'){_0x2deae5={'method':_0x6606('0xe'),'uri':_0x24450a+_0x6606('0x43'),'body':Object[_0x6606('0x3c')]({},{'subject':intUtil[_0x6606('0x3d')](_0x4a72f4[_0x6606('0x3e')],_0x843242,'\x20'),'phonenumber':String(_0x843242['calleridnum']),'description':intUtil['getString'](_0x4a72f4[_0x6606('0x3f')],_0x843242,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6606('0x40')+_0x16f2fc[_0x6606('0x2b')]+')','ownerid@odata.bind':_0x6606('0x41')+_0x16f2fc[_0x6606('0x20')]+')','directioncode':_0x16f2fc[_0x6606('0x44')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x6606('0x41')+_0x16f2fc[_0x6606('0x20')]+')','participationtypemask':_0x16f2fc[_0x6606('0x44')]===_0x6606('0x45')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x16f2fc['enduserId']+')','participationtypemask':_0x16f2fc['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x4a72f4[_0x6606('0x42')],_0x843242,_0x4a72f4[_0x6606('0x39')])),'headers':{'Authorization':_0x6606('0x16')+_0x59f327,'OData-Version':_0x6606('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2deae5);})[_0x6606('0x18')](function(_0x7fdba3){var _0x199b6a=_0x7fdba3[_0x6606('0x28')][_0x6606('0x29')];var _0x1c9fff=_0x199b6a['substring'](_0x199b6a[_0x6606('0x46')]('(')+0x1,_0x199b6a[_0x6606('0x46')](')'));_0x16f2fc[_0x6606('0x47')]=_0x1c9fff;_0x19009c(_0x16f2fc);})[_0x6606('0x24')](function(_0x1b46db){_0x5112d3(_0x1b46db[_0x6606('0x14')]);});});}function emit(_0x51428d,_0x16af3c,_0x44d082,_0x2032b4){var _0xdef3ce={'uri':util[_0x6606('0x48')](_0x6606('0x49'),_0x51428d,_0x44d082,_0x2032b4)};io['to'](util[_0x6606('0x48')](_0x6606('0x4a'),_0x16af3c))[_0x6606('0x4b')](_0x6606('0x4c'),_0xdef3ce);}exports['cs']=function(_0x3c338b,_0x26387a,_0x117ede,_0xd11271,_0x4f484f,_0x8c1b23,_0x28c4c2,_0x42f992){var _0x366f38={};_0x8c1b23[_0x6606('0xf')]=intUtil[_0x6606('0x4d')](_0x8c1b23[_0x6606('0xf')]);_0x8c1b23[_0x6606('0x4e')]=intUtil[_0x6606('0x4d')](_0x8c1b23[_0x6606('0x4e')]);_0x366f38['callDirection']=_0x42f992===_0x6606('0x45')||_0x42f992===_0x6606('0x4f')?_0x6606('0x45'):_0x6606('0x2d');var _0x30186d=util[_0x6606('0x48')](_0x6606('0x50'),_0x8c1b23[_0x6606('0xf')]);var _0x3106ef=util[_0x6606('0x48')](_0x6606('0x51'),_0x8c1b23[_0x6606('0x52')]);var _0x20a268=util[_0x6606('0x48')](_0x6606('0x53'),_0x8c1b23[_0x6606('0x4e')],_0x26387a[_0x6606('0x54')],md5(_0x26387a[_0x6606('0x54')]));if(_0x4f484f&&_0x4f484f[_0x6606('0x55')]){logger['info'](_0x6606('0x56'),'Recording\x20is\x20enabled!');_0x26387a[_0x6606('0x57')]=_0x20a268;}else if(_0x28c4c2&&_0x28c4c2[_0x6606('0x58')]&&_0x28c4c2[_0x6606('0x58')]!==_0x6606('0x59')){logger[_0x6606('0x1e')](_0x6606('0x5a'),_0x6606('0x5b'));_0x26387a[_0x6606('0x57')]=_0x20a268;}else{_0x26387a[_0x6606('0x57')]='';}return getUser(_0x366f38,_0x8c1b23,_0xd11271,_0x3106ef,_0x30186d,_0x42f992)[_0x6606('0x18')](function(_0x314991){logger[_0x6606('0x1e')]('['+_0x42f992[_0x6606('0x13')]()+_0x6606('0x5c'),_0x314991[_0x6606('0x20')]);logger['info']('['+_0x42f992[_0x6606('0x13')]()+_0x6606('0x5d'),_0x314991[_0x6606('0x1c')]);return getEndUser(_0x314991,_0x8c1b23,_0x3106ef,_0x30186d,_0x26387a,_0x42f992);})['then'](function(_0x38e0bf){logger[_0x6606('0x1e')]('['+_0x42f992[_0x6606('0x13')]()+_0x6606('0x5e'),_0x38e0bf[_0x6606('0x2b')]);logger[_0x6606('0x1e')]('['+_0x42f992[_0x6606('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x26387a[_0x6606('0x27')]);return getTicket(_0x38e0bf,_0x8c1b23,_0x3106ef,_0x30186d,_0x26387a,_0x117ede,_0x42f992);})[_0x6606('0x18')](function(_0x1e9164){logger['info'](util['format']('['+_0x42f992['toUpperCase']()+_0x6606('0x5f'),_0x117ede[_0x6606('0x39')],_0x1e9164['ticketId']));logger['info'](util['format']('['+_0x42f992[_0x6606('0x13')]()+']\x20Call\x20direction:\x20%s',_0x42f992));if(_0x42f992!==_0x6606('0x4f')){logger[_0x6606('0x1e')]('['+_0x42f992[_0x6606('0x13')]()+']',_0x6606('0x60'));emit(_0x8c1b23[_0x6606('0xf')],_0xd11271[_0x6606('0x61')],_0x117ede[_0x6606('0x39')],_0x1e9164[_0x6606('0x47')]);}})[_0x6606('0x24')](function(_0x185cf5){logger[_0x6606('0x62')]('['+_0x42f992['toUpperCase']()+_0x6606('0x63'),util[_0x6606('0x64')](_0x185cf5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2628=['toUpperCase','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','substring','lastIndexOf','value','telephone1','enduserId','info',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/systemusers(','Fields','ticketType','phonecalls','/contacts(','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled'];(function(_0xb2492e,_0xb6db90){var _0xa70fb6=function(_0x44c360){while(--_0x44c360){_0xb2492e['push'](_0xb2492e['shift']());}};_0xa70fb6(++_0xb6db90);}(_0x2628,0x1ce));var _0x8262=function(_0x135270,_0x3b5978){_0x135270=_0x135270-0x0;var _0x3b511a=_0x2628[_0x135270];return _0x3b511a;};'use strict';var _=require(_0x8262('0x0'));var BPromise=require(_0x8262('0x1'));var rp=require(_0x8262('0x2'));var util=require(_0x8262('0x3'));var intUtil=require('./util');var md5=require(_0x8262('0x4'));var Redis=require(_0x8262('0x5'));var logger=require(_0x8262('0x6'))(_0x8262('0x7'));var config=require(_0x8262('0x8'));config['redis']=_['defaults'](config[_0x8262('0x9')],{'host':_0x8262('0xa'),'port':0x18eb});var io=require(_0x8262('0xb'))(new Redis(config[_0x8262('0x9')]));function getAuthToken(_0x1d5f02,_0x5b2c35,_0x52bd35){var _0x45cd23={'method':_0x8262('0xc'),'uri':_0x5b2c35,'form':{'client_id':_0x1d5f02[_0x8262('0xd')],'resource':_0x1d5f02['remoteUri'],'username':_0x1d5f02['username'],'password':_0x1d5f02[_0x8262('0xe')],'grant_type':_0x8262('0xe'),'client_secret':_0x1d5f02[_0x8262('0xf')]},'json':!![]};return rp(_0x45cd23)[_0x8262('0x10')](function(_0x2d0a2c){return _0x2d0a2c[_0x8262('0x11')];})[_0x8262('0x12')](function(_0x340bb9){logger[_0x8262('0x13')]('['+[_0x52bd35['toUpperCase']()]+_0x8262('0x14'));return _0x340bb9[_0x8262('0x15')];});}function getUser(_0x561012,_0x395055,_0xb88589,_0x40b810,_0x40eb65,_0x3bcd5b){return new BPromise(function(_0x1356e7,_0x25b1ee){return getAuthToken(_0x395055,_0x40b810,_0x3bcd5b)[_0x8262('0x10')](function(_0x3d7077){var _0x2a3a92={'method':_0x8262('0x16'),'uri':_0x40eb65+_0x8262('0x17'),'headers':{'Authorization':_0x8262('0x18')+_0x3d7077,'OData-Version':_0x8262('0x19')},'json':!![]};return rp(_0x2a3a92);})[_0x8262('0x10')](function(_0x3feef4){var _0x48a3d3=_0x3feef4['value'];var _0x23243b=![];var _0x5d3ae0=null;if(!_[_0x8262('0x1a')](_0xb88589)){if(intUtil[_0x8262('0x1b')](_0xb88589[_0x8262('0x1c')])){_0x561012[_0x8262('0x1d')]=_0xb88589[_0x8262('0x1c')];for(_0x5d3ae0=0x0;_0x5d3ae0<_0x48a3d3[_0x8262('0x1e')];_0x5d3ae0++){if(_0x48a3d3[_0x5d3ae0][_0x8262('0x1f')]===_0xb88589['email']&&!_0x48a3d3[_0x5d3ae0][_0x8262('0x20')]){_0x23243b=!![];logger['info']('['+[_0x3bcd5b[_0x8262('0x21')]()]+']\x20Agent\x20found\x20'+_0x48a3d3[_0x5d3ae0][_0x8262('0x22')]+'!');_0x561012[_0x8262('0x23')]=_0x48a3d3[_0x5d3ae0][_0x8262('0x22')];}}}}if(!_0x23243b){logger['info']('['+[_0x3bcd5b['toUpperCase']()]+_0x8262('0x24'));_0x561012['userEmail']=_0x395055[_0x8262('0x25')];for(_0x5d3ae0=0x0;_0x5d3ae0<_0x48a3d3['length'];_0x5d3ae0++){if(_0x48a3d3[_0x5d3ae0][_0x8262('0x1f')]===_0x395055[_0x8262('0x25')]){_0x561012[_0x8262('0x23')]=_0x48a3d3[_0x5d3ae0][_0x8262('0x22')];}}}_0x1356e7(_0x561012);})[_0x8262('0x12')](function(_0x2fd6c5){_0x25b1ee(_0x2fd6c5['message']);});});}function createEndUser(_0x543607,_0x244804,_0x580eed,_0x59d263,_0x60474,_0x3ff3ef){return new BPromise(function(_0xc8c158,_0x53ea5d){return getAuthToken(_0x244804,_0x580eed,_0x3ff3ef)[_0x8262('0x10')](function(_0x711085){var _0x24e541=_0x3ff3ef[_0x8262('0x26')]()===_0x8262('0x27')?_0x60474[_0x8262('0x28')]:_0x60474[_0x8262('0x29')];var _0x48f04={'method':'POST','uri':_0x59d263+_0x8262('0x2a'),'body':{'telephone1':_0x24e541,'fullname':_0x24e541,'firstname':_0x24e541,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x543607[_0x8262('0x23')]+')'},'headers':{'Authorization':_0x8262('0x18')+_0x711085,'OData-Version':_0x8262('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x48f04);})[_0x8262('0x10')](function(_0x548104){var _0x321c05=_0x548104['headers'][_0x8262('0x2b')];var _0x542ea7=_0x321c05[_0x8262('0x2c')](_0x321c05[_0x8262('0x2d')]('(')+0x1,_0x321c05[_0x8262('0x2d')](')'));_0x543607['enduserId']=_0x542ea7;_0xc8c158(_0x543607);})[_0x8262('0x12')](function(_0x1566b7){_0x53ea5d(_0x1566b7['message']);});});}function getEndUser(_0x5dcb5e,_0x3dcd71,_0x4ecdd6,_0x92b699,_0x48f504,_0x454417){return new BPromise(function(_0x2befaf,_0x5842d2){return getAuthToken(_0x3dcd71,_0x4ecdd6,_0x454417)[_0x8262('0x10')](function(_0x4f901d){var _0x2e4e0d={'method':_0x8262('0x16'),'uri':_0x92b699+'contacts?$select=telephone1','headers':{'Authorization':_0x8262('0x18')+_0x4f901d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e4e0d);})[_0x8262('0x10')](function(_0x5ea1e8){var _0x320944=null;if(_0x5ea1e8){var _0x1dc69d=_0x5ea1e8[_0x8262('0x2e')];var _0x32a58e=![];for(_0x320944=0x0;_0x320944<_0x1dc69d[_0x8262('0x1e')];_0x320944++){var _0x5385ac=_0x454417[_0x8262('0x26')]()===_0x8262('0x27')?_0x48f504[_0x8262('0x28')]:_0x48f504[_0x8262('0x29')];if(_0x1dc69d[_0x320944][_0x8262('0x2f')]===_0x5385ac){_0x32a58e=!![];_0x5dcb5e[_0x8262('0x30')]=_0x1dc69d[_0x320944]['contactid'];}}if(_0x32a58e){_0x2befaf(_0x5dcb5e);}else{return createEndUser(_0x5dcb5e,_0x3dcd71,_0x4ecdd6,_0x92b699,_0x48f504,_0x454417)[_0x8262('0x10')](function(_0x75418f){logger[_0x8262('0x31')]('['+[_0x454417[_0x8262('0x21')]()]+_0x8262('0x32'),_0x75418f[_0x8262('0x30')]);_0x2befaf(_0x75418f);});}}else{return createEndUser(_0x5dcb5e,_0x3dcd71,_0x4ecdd6,_0x92b699,_0x48f504,_0x454417)[_0x8262('0x10')](function(_0x17284f){logger[_0x8262('0x31')]('['+[_0x454417[_0x8262('0x21')]()]+']\x20Enduser\x20Created!',_0x17284f['enduserId']);_0x2befaf(_0x17284f);});}});});}function getCustomFields(_0x59e281,_0xe5b460,_0x249996){var _0x41bd42={};if(_0x59e281[_0x8262('0x1e')]>0x0){_[_0x8262('0x33')](_0x59e281,function(_0x129d33){if(_0x129d33[_0x8262('0x34')]===_0x8262('0x35')&&_0x129d33[_0x8262('0x36')]&&!_0x129d33[_0x8262('0x37')]){var _0x44e1c4=_0x129d33[_0x8262('0x38')][_0x8262('0x26')]();var _0x5c40d1=_0x44e1c4[_0x8262('0x2c')](0x0,_0x44e1c4[_0x8262('0x39')]('_'));var _0x4cb879=_0x44e1c4[_0x8262('0x2c')](_0x44e1c4[_0x8262('0x39')]('_')+0x1);if(_0x5c40d1===_0x249996){_0x41bd42[_0x4cb879]=_0x129d33[_0x8262('0x3a')];}}});}return _0x41bd42;}function getTicket(_0x3c0d71,_0x5aa823,_0x63dc5f,_0x3de545,_0x23a8b1,_0x3339f2,_0x4e972f){return new BPromise(function(_0x2a3db4,_0x53e9c1){var _0x20e8f9;return getAuthToken(_0x5aa823,_0x63dc5f,_0x4e972f)[_0x8262('0x10')](function(_0x423228){if(_0x3339f2['ticketType']===_0x8262('0x3b')){_0x20e8f9={'method':_0x8262('0xc'),'uri':_0x3de545+_0x8262('0x3c'),'body':Object[_0x8262('0x3d')]({},{'title':intUtil[_0x8262('0x3e')](_0x3339f2[_0x8262('0x3f')],_0x23a8b1,'\x20'),'description':intUtil[_0x8262('0x3e')](_0x3339f2[_0x8262('0x40')],_0x23a8b1,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x3c0d71[_0x8262('0x30')]+')','ownerid@odata.bind':_0x8262('0x41')+_0x3c0d71[_0x8262('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x3339f2[_0x8262('0x42')],_0x23a8b1,_0x3339f2[_0x8262('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x423228,'OData-Version':_0x8262('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3339f2[_0x8262('0x43')]==='phonecall'){_0x20e8f9={'method':'POST','uri':_0x3de545+_0x8262('0x44'),'body':Object[_0x8262('0x3d')]({},{'subject':intUtil[_0x8262('0x3e')](_0x3339f2[_0x8262('0x3f')],_0x23a8b1,'\x20'),'phonenumber':String(_0x23a8b1[_0x8262('0x29')]),'description':intUtil[_0x8262('0x3e')](_0x3339f2[_0x8262('0x40')],_0x23a8b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8262('0x45')+_0x3c0d71['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x3c0d71[_0x8262('0x23')]+')','directioncode':_0x3c0d71[_0x8262('0x46')]===_0x8262('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3c0d71[_0x8262('0x23')]+')','participationtypemask':_0x3c0d71['callDirection']===_0x8262('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x8262('0x45')+_0x3c0d71[_0x8262('0x30')]+')','participationtypemask':_0x3c0d71[_0x8262('0x46')]===_0x8262('0x47')?0x1:0x2}]},getCustomFields(_0x3339f2[_0x8262('0x42')],_0x23a8b1,_0x3339f2[_0x8262('0x43')])),'headers':{'Authorization':_0x8262('0x18')+_0x423228,'OData-Version':_0x8262('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x20e8f9);})[_0x8262('0x10')](function(_0x297b71){var _0x149383=_0x297b71['headers'][_0x8262('0x2b')];var _0x3be88d=_0x149383[_0x8262('0x2c')](_0x149383[_0x8262('0x2d')]('(')+0x1,_0x149383[_0x8262('0x2d')](')'));_0x3c0d71[_0x8262('0x48')]=_0x3be88d;_0x2a3db4(_0x3c0d71);})[_0x8262('0x12')](function(_0xb370c8){_0x53e9c1(_0xb370c8['message']);});});}function emit(_0x452be2,_0xd2b5af,_0x4d8394,_0x2bb89e){var _0x2da805={'uri':util['format'](_0x8262('0x49'),_0x452be2,_0x4d8394,_0x2bb89e)};io['to'](util[_0x8262('0x4a')](_0x8262('0x4b'),_0xd2b5af))[_0x8262('0x4c')](_0x8262('0x4d'),_0x2da805);}exports['cs']=function(_0x4e0398,_0xf9c1f3,_0x3df376,_0x502583,_0x3a528b,_0x1a4a7a,_0x5f28db,_0x2e2bd3){var _0x27c534={};_0x1a4a7a['remoteUri']=intUtil[_0x8262('0x4e')](_0x1a4a7a[_0x8262('0x4f')]);_0x1a4a7a[_0x8262('0x50')]=intUtil[_0x8262('0x4e')](_0x1a4a7a[_0x8262('0x50')]);_0x27c534[_0x8262('0x46')]=_0x2e2bd3===_0x8262('0x47')||_0x2e2bd3===_0x8262('0x51')?_0x8262('0x47'):_0x8262('0x27');var _0x5ca32f=util[_0x8262('0x4a')](_0x8262('0x52'),_0x1a4a7a[_0x8262('0x4f')]);var _0x531b69=util[_0x8262('0x4a')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1a4a7a[_0x8262('0x53')]);var _0x597584=util[_0x8262('0x4a')](_0x8262('0x54'),_0x1a4a7a[_0x8262('0x50')],_0xf9c1f3['uniqueid'],md5(_0xf9c1f3[_0x8262('0x55')]));if(_0x3a528b&&_0x3a528b[_0x8262('0x56')]){logger[_0x8262('0x31')](_0x8262('0x57'),_0x8262('0x58'));_0xf9c1f3['recordingURL']=_0x597584;}else if(_0x5f28db&&_0x5f28db['recordingFormat']&&_0x5f28db[_0x8262('0x59')]!==_0x8262('0x5a')){logger['info']('[OUTBOUND]',_0x8262('0x58'));_0xf9c1f3[_0x8262('0x5b')]=_0x597584;}else{_0xf9c1f3[_0x8262('0x5b')]='';}return getUser(_0x27c534,_0x1a4a7a,_0x502583,_0x531b69,_0x5ca32f,_0x2e2bd3)['then'](function(_0x2de8b9){logger[_0x8262('0x31')]('['+_0x2e2bd3[_0x8262('0x21')]()+_0x8262('0x5c'),_0x2de8b9[_0x8262('0x23')]);logger[_0x8262('0x31')]('['+_0x2e2bd3[_0x8262('0x21')]()+']\x20The\x20User\x20email\x20is:',_0x2de8b9[_0x8262('0x1d')]);return getEndUser(_0x2de8b9,_0x1a4a7a,_0x531b69,_0x5ca32f,_0xf9c1f3,_0x2e2bd3);})[_0x8262('0x10')](function(_0x56110f){logger[_0x8262('0x31')]('['+_0x2e2bd3[_0x8262('0x21')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x56110f['enduserId']);logger[_0x8262('0x31')]('['+_0x2e2bd3[_0x8262('0x21')]()+_0x8262('0x5d'),_0xf9c1f3['calleridnum']);return getTicket(_0x56110f,_0x1a4a7a,_0x531b69,_0x5ca32f,_0xf9c1f3,_0x3df376,_0x2e2bd3);})[_0x8262('0x10')](function(_0x2b7168){logger[_0x8262('0x31')](util['format']('['+_0x2e2bd3[_0x8262('0x21')]()+_0x8262('0x5e'),_0x3df376[_0x8262('0x43')],_0x2b7168[_0x8262('0x48')]));logger[_0x8262('0x31')](util[_0x8262('0x4a')]('['+_0x2e2bd3[_0x8262('0x21')]()+_0x8262('0x5f'),_0x2e2bd3));if(_0x2e2bd3!=='unmanaged'){logger[_0x8262('0x31')]('['+_0x2e2bd3[_0x8262('0x21')]()+']',_0x8262('0x60'));emit(_0x1a4a7a['remoteUri'],_0x502583[_0x8262('0x61')],_0x3df376[_0x8262('0x43')],_0x2b7168[_0x8262('0x48')]);}})['catch'](function(_0x3ac321){logger[_0x8262('0x13')]('['+_0x2e2bd3[_0x8262('0x21')]()+_0x8262('0x62'),util['inspect'](_0x3ac321,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index f9a2fb9..25fb1b2 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 _0x0159=['Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','Subjects','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','%s/api/v2/tickets','POST','Ticket\x20created!','%s/api/v2/agents','remoteUri','then','length','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','content','toString','idField','customField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','monitor_format','lastevent','toUpperCase','calleridnum','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info'];(function(_0x45b072,_0x550fac){var _0x1f3aac=function(_0xd9f3c6){while(--_0xd9f3c6){_0x45b072['push'](_0x45b072['shift']());}};_0x1f3aac(++_0x550fac);}(_0x0159,0xa7));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9015('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9015('0x1'));var Redis=require(_0x9015('0x2'));var intUtil=require(_0x9015('0x3'));var config=require(_0x9015('0x4'));var logger=require(_0x9015('0x5'))('freshdesk');config[_0x9015('0x6')]=_[_0x9015('0x7')](config[_0x9015('0x6')],{'host':_0x9015('0x8'),'port':0x18eb});var io=require(_0x9015('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x9015('0xa'),'Accept':_0x9015('0xa')};function emit(_0xefa4d5,_0x236b28,_0x104722){io['to'](_0xefa4d5)[_0x9015('0xb')](_0x236b28,_0x104722);}function getTicket(_0x2b1c08,_0x2e25c3,_0x5101b3,_0xcecf8e,_0x5411a5){logger[_0x9015('0xc')](_0x9015('0xd'));var _0x34d39f=_[_0x9015('0xe')]({'responder_id':_0x2e25c3['id'],'requester_id':_0x5101b3['id'],'name':util[_0x9015('0xf')](_0x9015('0x10'),_0x5411a5['calleridname']),'phone':_0x5411a5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xcecf8e[_0x9015('0x11')],_0x5411a5,'\x20'),'description':intUtil[_0x9015('0x12')](_0xcecf8e[_0x9015('0x13')],_0x5411a5,_0x9015('0x14')),'tags':getTags(_0xcecf8e[_0x9015('0x15')],_0x9015('0x16'))},getCustomFields(_0xcecf8e[_0x9015('0x17')],_0x5411a5));_0x34d39f['custom_fields']=_[_0x9015('0x18')](_[_0x9015('0x19')](_0x34d39f[_0x9015('0x1a')],'id'),'value');return request({'uri':util[_0x9015('0xf')](_0x9015('0x1b'),_0x2b1c08['remoteUri']),'method':_0x9015('0x1c'),'body':_0x34d39f})['then'](function(_0x5c4dbe){logger[_0x9015('0xc')](_0x9015('0x1d'));return _0x5c4dbe;});}function getUser(_0x5d6871,_0x29ef35){if(intUtil['validateEmail'](_0x29ef35)){return request({'uri':util['format'](_0x9015('0x1e'),_0x5d6871[_0x9015('0x1f')]),'qs':{'email':_0x29ef35}})[_0x9015('0x20')](function(_0x260a72){if(_0x260a72[_0x9015('0x21')]){logger['info']('Agent\x20found!');return _[_0x9015('0x22')](_0x260a72,function(_0x35f2e0){return _0x35f2e0['contact'][_0x9015('0x23')]===_0x29ef35;});}else{logger[_0x9015('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9015('0xf')](_0x9015('0x24'),_0x5d6871[_0x9015('0x1f')])})[_0x9015('0x20')](function(_0x13d9d0){logger[_0x9015('0xc')]('Admin\x20account\x20selected.');return _0x13d9d0;});}});}else{logger[_0x9015('0xc')](_0x9015('0x25'));return request({'uri':util[_0x9015('0xf')](_0x9015('0x24'),_0x5d6871['remoteUri'])})[_0x9015('0x20')](function(_0x546b27){logger[_0x9015('0xc')](_0x9015('0x26'));return _0x546b27;});}}function getEndUser(_0x4bbc3a,_0x3cb77c,_0x529f1c){logger[_0x9015('0xc')](_0x9015('0x27'),_0x529f1c);return request({'uri':util[_0x9015('0xf')](_0x9015('0x28'),_0x4bbc3a[_0x9015('0x1f')]),'qs':{'phone':_0x529f1c}})[_0x9015('0x20')](function(_0xc3f4a3){if(_0xc3f4a3['length']){logger[_0x9015('0xc')](_0x9015('0x29'));return _['find'](_0xc3f4a3,{'phone':_0x529f1c});}else{logger[_0x9015('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x9015('0x28'),_0x4bbc3a['remoteUri']),'method':_0x9015('0x1c'),'body':{'name':_0x3cb77c,'phone':_0x529f1c}})[_0x9015('0x20')](function(_0x3af34a){logger[_0x9015('0xc')]('Enduser\x20created.');return _0x3af34a;});}});}function getAuth(_0x5a29ba){return util[_0x9015('0xf')](_0x9015('0x2a'),new Buffer(_0x5a29ba[_0x9015('0x2b')]+':X')['toString']('base64'));}function request(_0x51bfd2){logger[_0x9015('0x2c')](_0x9015('0x2d'),JSON[_0x9015('0x2e')](_0x51bfd2));return rp(_[_0x9015('0x7')](_0x51bfd2,{'method':_0x9015('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x3feafb,_0x2d8738){var _0x78f4bc=[];if(_0x3feafb&&_0x3feafb['length']>0x0){_0x78f4bc=_[_0x9015('0x30')](_0x3feafb,_0x2d8738);}return _0x78f4bc;}function getCustomFields(_0x2d3e1c,_0x2138d8){var _0x565d1a=[];var _0x448552={'custom_fields':[]};if(_0x2d3e1c[_0x9015('0x21')]>0x0){_[_0x9015('0x31')](_0x2d3e1c,function(_0x4762b1){if(_0x4762b1[_0x9015('0x32')]==='string'&&_0x4762b1[_0x9015('0x33')]&&!_0x4762b1['customField']){_0x448552[_0x4762b1['nameField']['toLowerCase']()]=_0x4762b1[_0x9015('0x34')][_0x9015('0x35')]();}else if(_0x4762b1[_0x9015('0x32')]==='string'&&_0x4762b1[_0x9015('0x36')]&&_0x4762b1[_0x9015('0x37')]){_0x448552[_0x9015('0x1a')][_0x9015('0x38')]({'id':_0x4762b1['idField'],'value':_0x4762b1[_0x9015('0x34')][_0x9015('0x35')]()});}else if(_0x4762b1['type']===_0x9015('0x39')&&_0x4762b1[_0x9015('0x3a')]&&_0x4762b1['idField']&&_0x4762b1[_0x9015('0x37')]){_0x2138d8[_0x4762b1[_0x9015('0x3a')]]&&_0x448552[_0x9015('0x1a')][_0x9015('0x38')]({'id':_0x4762b1[_0x9015('0x36')],'value':_0x2138d8[_0x4762b1[_0x9015('0x3a')]]['toString']()});}else if(_0x4762b1[_0x9015('0x32')]===_0x9015('0x3b')&&_0x4762b1[_0x9015('0x3c')]&&_0x4762b1[_0x9015('0x3c')]['name']&&_0x4762b1[_0x9015('0x36')]&&_0x4762b1['customField']){_0x2138d8[_0x4762b1[_0x9015('0x3c')]['name'][_0x9015('0x3d')]()]&&_0x448552[_0x9015('0x1a')][_0x9015('0x38')]({'id':_0x4762b1['idField'],'value':_0x2138d8[_0x4762b1['Variable'][_0x9015('0x16')]['toLowerCase']()][_0x9015('0x35')]()});}});}return _0x448552;}exports[_0x9015('0x3e')]=function(_0x21a638,_0x5e7931,_0x3a5843,_0x14ed04,_0x5f4844,_0x20af21){var _0xde3ea9,_0x17942f;_0x20af21['remoteUri']=intUtil[_0x9015('0x3f')](_0x20af21[_0x9015('0x1f')]);_0x20af21['serverUrl']=intUtil[_0x9015('0x3f')](_0x20af21[_0x9015('0x40')]);if(_0x5f4844&&_0x5f4844['monitor_format']){logger[_0x9015('0xc')]('[QUEUE]',_0x9015('0x41'));_0x5e7931['recordingURL']=util[_0x9015('0xf')](_0x9015('0x42'),_0x20af21[_0x9015('0x40')],_0x5e7931[_0x9015('0x43')],md5(_0x5e7931[_0x9015('0x43')]));}else{_0x5e7931[_0x9015('0x44')]='';}headers['Authorization']=getAuth(_0x20af21);return getUser(_0x20af21,_0x14ed04['email'])[_0x9015('0x20')](function(_0x2ea5a1){_0xde3ea9=_0x2ea5a1;logger['info'](_0x9015('0x45'),_0xde3ea9['id']);return getEndUser(_0x20af21,_0x5e7931[_0x9015('0x46')],_0x5e7931['calleridnum']);})[_0x9015('0x20')](function(_0x19f9ba){_0x17942f=_0x19f9ba;logger[_0x9015('0xc')](_0x9015('0x47'),_0x17942f['id']);return getTicket(_0x20af21,_0xde3ea9,_0x17942f,_0x3a5843,_0x5e7931);})[_0x9015('0x20')](function(_0x39e6fc){if(_0x39e6fc&&_0x39e6fc['id']){logger[_0x9015('0xc')]('Ticket\x20created!');logger[_0x9015('0xc')](_0x9015('0x48'),_0x39e6fc['id']);logger[_0x9015('0xc')](_0x9015('0x49'),_0x9015('0x4a'));emit(util[_0x9015('0xf')](_0x9015('0x4b'),_0x14ed04['name']),_0x9015('0x4c'),{'uri':util[_0x9015('0xf')](_0x9015('0x4d'),_0x20af21[_0x9015('0x1f')],_0x39e6fc['id'])});}})[_0x9015('0x4e')](function(_0x41e775){logger[_0x9015('0x4f')](_0x9015('0x49'),JSON[_0x9015('0x2e')](_0x41e775));});};exports['outbound']=function(_0x2600ad,_0x54a18a,_0x54b31a,_0x26df21,_0x541ba0,_0x1cb40e,_0x15a338){var _0x3ad073,_0x2baf85;_0x1cb40e[_0x9015('0x1f')]=intUtil[_0x9015('0x3f')](_0x1cb40e[_0x9015('0x1f')]);_0x1cb40e['serverUrl']=intUtil[_0x9015('0x3f')](_0x1cb40e[_0x9015('0x40')]);if(_0x15a338&&_0x15a338[_0x9015('0x50')]&&_0x15a338[_0x9015('0x50')]!==_0x9015('0x51')){logger[_0x9015('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x54a18a[_0x9015('0x44')]=util[_0x9015('0xf')](_0x9015('0x42'),_0x1cb40e[_0x9015('0x40')],_0x54a18a[_0x9015('0x43')],md5(_0x54a18a['uniqueid']));}headers[_0x9015('0x52')]=getAuth(_0x1cb40e);return getUser(_0x1cb40e,_0x26df21[_0x9015('0x23')])[_0x9015('0x20')](function(_0x4212de){_0x3ad073=_0x4212de;logger[_0x9015('0xc')](_0x9015('0x45'),_0x3ad073['id']);return getEndUser(_0x1cb40e,_0x54a18a[_0x9015('0x53')],_0x54a18a[_0x9015('0x54')]);})['then'](function(_0x5b026b){_0x2baf85=_0x5b026b;logger[_0x9015('0xc')](_0x9015('0x47'),_0x2baf85['id']);return getTicket(_0x1cb40e,_0x3ad073,_0x2baf85,_0x54b31a,_0x54a18a);})[_0x9015('0x20')](function(_0x14c1a4){if(_0x14c1a4&&_0x14c1a4['id']){logger['info'](_0x9015('0x1d'));logger[_0x9015('0xc')]('The\x20Ticket\x20ID\x20is:',_0x14c1a4['id']);logger[_0x9015('0xc')](_0x9015('0x55'),_0x9015('0x4a'));emit(util[_0x9015('0xf')](_0x9015('0x4b'),_0x26df21[_0x9015('0x16')]),_0x9015('0x4c'),{'uri':util[_0x9015('0xf')](_0x9015('0x4d'),_0x1cb40e[_0x9015('0x1f')],_0x14c1a4['id'])});}})[_0x9015('0x4e')](function(_0x548900){logger[_0x9015('0x4f')](_0x9015('0x55'),JSON[_0x9015('0x2e')](_0x548900));});};exports['unmanaged']=function(_0xcfab41,_0x11ceca,_0x54038f,_0x4ae10d,_0x24c359,_0x37da6c){var _0x2f710e,_0x57f009;_0x37da6c[_0x9015('0x1f')]=intUtil[_0x9015('0x3f')](_0x37da6c[_0x9015('0x1f')]);_0x37da6c[_0x9015('0x40')]=intUtil['stripTrailingSlash'](_0x37da6c[_0x9015('0x40')]);if(_0x24c359&&_0x24c359[_0x9015('0x56')]){logger[_0x9015('0xc')]('['+_0x11ceca[_0x9015('0x57')][_0x9015('0x58')]()+']',_0x9015('0x41'));_0x11ceca[_0x9015('0x44')]=util[_0x9015('0xf')](_0x9015('0x42'),_0x37da6c[_0x9015('0x40')],_0x11ceca[_0x9015('0x43')],md5(_0x11ceca[_0x9015('0x43')]));}else{_0x11ceca['recordingURL']='';}headers[_0x9015('0x52')]=getAuth(_0x37da6c);return getUser(_0x37da6c,'')['then'](function(_0x74f17){_0x2f710e=_0x74f17;logger[_0x9015('0xc')]('The\x20User\x20ID\x20is:',_0x2f710e['id']);return getEndUser(_0x37da6c,_0x11ceca[_0x9015('0x46')],_0x11ceca[_0x9015('0x59')]);})[_0x9015('0x20')](function(_0x5c180c){_0x57f009=_0x5c180c;logger['info'](_0x9015('0x47'),_0x57f009['id']);return getTicket(_0x37da6c,_0x2f710e,_0x57f009,_0x54038f,_0x11ceca);})[_0x9015('0x20')](function(_0x3ff5fa){if(_0x3ff5fa){logger[_0x9015('0xc')](_0x9015('0x1d'));logger[_0x9015('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3ff5fa['id']);}})['catch'](function(_0x3df17f){logger[_0x9015('0x4f')]('['+_0x11ceca[_0x9015('0x57')][_0x9015('0x58')]()+']',JSON[_0x9015('0x2e')](_0x3df17f));});}; \ No newline at end of file +var _0xa017=['format','calleridname','calleridnum','getString','Subjects','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','GET','forEach','type','string','nameField','toLowerCase','content','idField','customField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','md5','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge'];(function(_0x2e9361,_0x471c93){var _0x3c2162=function(_0x5793d8){while(--_0x5793d8){_0x2e9361['push'](_0x2e9361['shift']());}};_0x3c2162(++_0x471c93);}(_0xa017,0x1b6));var _0x7a01=function(_0x32b715,_0x8f0a4d){_0x32b715=_0x32b715-0x0;var _0x198fdd=_0xa017[_0x32b715];return _0x198fdd;};'use strict';var _=require('lodash');var rp=require(_0x7a01('0x0'));var md5=require(_0x7a01('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x7a01('0x2'));var config=require(_0x7a01('0x3'));var logger=require('../../../../config/logger')(_0x7a01('0x4'));config[_0x7a01('0x5')]=_[_0x7a01('0x6')](config[_0x7a01('0x5')],{'host':_0x7a01('0x7'),'port':0x18eb});var io=require(_0x7a01('0x8'))(new Redis(config[_0x7a01('0x5')]));var headers={'Content-Type':_0x7a01('0x9'),'Accept':_0x7a01('0x9')};function emit(_0x1935bc,_0x1223a3,_0x1cf932){io['to'](_0x1935bc)['emit'](_0x1223a3,_0x1cf932);}function getTicket(_0x47e105,_0x1a585c,_0x4d07d4,_0x5a7fa1,_0x4ff59b){logger['info'](_0x7a01('0xa'));var _0x4d2baf=_[_0x7a01('0xb')]({'responder_id':_0x1a585c['id'],'requester_id':_0x4d07d4['id'],'name':util[_0x7a01('0xc')]('Caller\x20-\x20%s',_0x4ff59b[_0x7a01('0xd')]),'phone':_0x4ff59b[_0x7a01('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7a01('0xf')](_0x5a7fa1[_0x7a01('0x10')],_0x4ff59b,'\x20'),'description':intUtil[_0x7a01('0xf')](_0x5a7fa1['Descriptions'],_0x4ff59b,'
'),'tags':getTags(_0x5a7fa1[_0x7a01('0x11')],_0x7a01('0x12'))},getCustomFields(_0x5a7fa1[_0x7a01('0x13')],_0x4ff59b));_0x4d2baf[_0x7a01('0x14')]=_[_0x7a01('0x15')](_[_0x7a01('0x16')](_0x4d2baf[_0x7a01('0x14')],'id'),_0x7a01('0x17'));return request({'uri':util[_0x7a01('0xc')]('%s/api/v2/tickets',_0x47e105[_0x7a01('0x18')]),'method':'POST','body':_0x4d2baf})[_0x7a01('0x19')](function(_0x4b8a42){logger[_0x7a01('0x1a')](_0x7a01('0x1b'));return _0x4b8a42;});}function getUser(_0x3b5e60,_0x198eb6){if(intUtil['validateEmail'](_0x198eb6)){return request({'uri':util[_0x7a01('0xc')](_0x7a01('0x1c'),_0x3b5e60['remoteUri']),'qs':{'email':_0x198eb6}})[_0x7a01('0x19')](function(_0x5f4346){if(_0x5f4346[_0x7a01('0x1d')]){logger[_0x7a01('0x1a')](_0x7a01('0x1e'));return _[_0x7a01('0x1f')](_0x5f4346,function(_0x37cf7c){return _0x37cf7c[_0x7a01('0x20')][_0x7a01('0x21')]===_0x198eb6;});}else{logger[_0x7a01('0x1a')](_0x7a01('0x22'));return request({'uri':util[_0x7a01('0xc')](_0x7a01('0x23'),_0x3b5e60[_0x7a01('0x18')])})[_0x7a01('0x19')](function(_0x2db819){logger['info']('Admin\x20account\x20selected.');return _0x2db819;});}});}else{logger[_0x7a01('0x1a')](_0x7a01('0x24'));return request({'uri':util[_0x7a01('0xc')](_0x7a01('0x23'),_0x3b5e60['remoteUri'])})['then'](function(_0x2f0c5e){logger[_0x7a01('0x1a')](_0x7a01('0x25'));return _0x2f0c5e;});}}function getEndUser(_0x3bce6e,_0x22e3b4,_0x5bd43e){logger[_0x7a01('0x1a')](_0x7a01('0x26'),_0x5bd43e);return request({'uri':util['format']('%s/api/v2/contacts',_0x3bce6e['remoteUri']),'qs':{'phone':_0x5bd43e}})[_0x7a01('0x19')](function(_0x3ed806){if(_0x3ed806['length']){logger[_0x7a01('0x1a')](_0x7a01('0x27'));return _['find'](_0x3ed806,{'phone':_0x5bd43e});}else{logger[_0x7a01('0x1a')](_0x7a01('0x28'));return request({'uri':util[_0x7a01('0xc')](_0x7a01('0x29'),_0x3bce6e[_0x7a01('0x18')]),'method':_0x7a01('0x2a'),'body':{'name':_0x22e3b4,'phone':_0x5bd43e}})[_0x7a01('0x19')](function(_0x19d867){logger[_0x7a01('0x1a')](_0x7a01('0x2b'));return _0x19d867;});}});}function getAuth(_0x1c191c){return util[_0x7a01('0xc')](_0x7a01('0x2c'),new Buffer(_0x1c191c[_0x7a01('0x2d')]+':X')[_0x7a01('0x2e')](_0x7a01('0x2f')));}function request(_0xb84f12){logger[_0x7a01('0x30')]('[HTTP]',JSON[_0x7a01('0x31')](_0xb84f12));return rp(_[_0x7a01('0x6')](_0xb84f12,{'method':_0x7a01('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5e6558,_0x92e4a0){var _0x23a4bc=[];if(_0x5e6558&&_0x5e6558['length']>0x0){_0x23a4bc=_['map'](_0x5e6558,_0x92e4a0);}return _0x23a4bc;}function getCustomFields(_0x8f6aa0,_0x5ae9bd){var _0x5e96ce=[];var _0x5df70d={'custom_fields':[]};if(_0x8f6aa0['length']>0x0){_[_0x7a01('0x33')](_0x8f6aa0,function(_0x6cbe18){if(_0x6cbe18[_0x7a01('0x34')]===_0x7a01('0x35')&&_0x6cbe18[_0x7a01('0x36')]&&!_0x6cbe18['customField']){_0x5df70d[_0x6cbe18[_0x7a01('0x36')][_0x7a01('0x37')]()]=_0x6cbe18[_0x7a01('0x38')][_0x7a01('0x2e')]();}else if(_0x6cbe18[_0x7a01('0x34')]==='string'&&_0x6cbe18[_0x7a01('0x39')]&&_0x6cbe18[_0x7a01('0x3a')]){_0x5df70d[_0x7a01('0x14')][_0x7a01('0x3b')]({'id':_0x6cbe18['idField'],'value':_0x6cbe18[_0x7a01('0x38')][_0x7a01('0x2e')]()});}else if(_0x6cbe18[_0x7a01('0x34')]===_0x7a01('0x3c')&&_0x6cbe18[_0x7a01('0x3d')]&&_0x6cbe18[_0x7a01('0x39')]&&_0x6cbe18[_0x7a01('0x3a')]){_0x5ae9bd[_0x6cbe18['variableName']]&&_0x5df70d[_0x7a01('0x14')][_0x7a01('0x3b')]({'id':_0x6cbe18['idField'],'value':_0x5ae9bd[_0x6cbe18[_0x7a01('0x3d')]]['toString']()});}else if(_0x6cbe18[_0x7a01('0x34')]===_0x7a01('0x3e')&&_0x6cbe18[_0x7a01('0x3f')]&&_0x6cbe18[_0x7a01('0x3f')][_0x7a01('0x12')]&&_0x6cbe18[_0x7a01('0x39')]&&_0x6cbe18[_0x7a01('0x3a')]){_0x5ae9bd[_0x6cbe18[_0x7a01('0x3f')]['name']['toLowerCase']()]&&_0x5df70d[_0x7a01('0x14')][_0x7a01('0x3b')]({'id':_0x6cbe18[_0x7a01('0x39')],'value':_0x5ae9bd[_0x6cbe18[_0x7a01('0x3f')][_0x7a01('0x12')]['toLowerCase']()][_0x7a01('0x2e')]()});}});}return _0x5df70d;}exports[_0x7a01('0x40')]=function(_0x521584,_0x9bd05b,_0xc725d2,_0x3ef43b,_0x5090ba,_0x3331d3){var _0x24477f,_0x4c1ff4;_0x3331d3['remoteUri']=intUtil[_0x7a01('0x41')](_0x3331d3[_0x7a01('0x18')]);_0x3331d3['serverUrl']=intUtil[_0x7a01('0x41')](_0x3331d3[_0x7a01('0x42')]);if(_0x5090ba&&_0x5090ba['monitor_format']){logger[_0x7a01('0x1a')](_0x7a01('0x43'),_0x7a01('0x44'));_0x9bd05b['recordingURL']=util[_0x7a01('0xc')](_0x7a01('0x45'),_0x3331d3[_0x7a01('0x42')],_0x9bd05b['uniqueid'],md5(_0x9bd05b[_0x7a01('0x46')]));}else{_0x9bd05b[_0x7a01('0x47')]='';}headers[_0x7a01('0x48')]=getAuth(_0x3331d3);return getUser(_0x3331d3,_0x3ef43b[_0x7a01('0x21')])[_0x7a01('0x19')](function(_0x38fa9b){_0x24477f=_0x38fa9b;logger[_0x7a01('0x1a')](_0x7a01('0x49'),_0x24477f['id']);return getEndUser(_0x3331d3,_0x9bd05b['calleridname'],_0x9bd05b[_0x7a01('0xe')]);})['then'](function(_0x14c6cc){_0x4c1ff4=_0x14c6cc;logger[_0x7a01('0x1a')](_0x7a01('0x4a'),_0x4c1ff4['id']);return getTicket(_0x3331d3,_0x24477f,_0x4c1ff4,_0xc725d2,_0x9bd05b);})['then'](function(_0x11d1b9){if(_0x11d1b9&&_0x11d1b9['id']){logger[_0x7a01('0x1a')](_0x7a01('0x1b'));logger[_0x7a01('0x1a')](_0x7a01('0x4b'),_0x11d1b9['id']);logger[_0x7a01('0x1a')](_0x7a01('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7a01('0x4c'),_0x3ef43b[_0x7a01('0x12')]),_0x7a01('0x4d'),{'uri':util[_0x7a01('0xc')](_0x7a01('0x4e'),_0x3331d3[_0x7a01('0x18')],_0x11d1b9['id'])});}})[_0x7a01('0x4f')](function(_0x5e161f){logger[_0x7a01('0x50')](_0x7a01('0x43'),JSON['stringify'](_0x5e161f));});};exports[_0x7a01('0x51')]=function(_0x29259b,_0x8f55ab,_0x20abf1,_0x14463f,_0x4c48fb,_0x55689c,_0x2f2035){var _0x24cfd6,_0x450456;_0x55689c[_0x7a01('0x18')]=intUtil[_0x7a01('0x41')](_0x55689c[_0x7a01('0x18')]);_0x55689c['serverUrl']=intUtil[_0x7a01('0x41')](_0x55689c[_0x7a01('0x42')]);if(_0x2f2035&&_0x2f2035[_0x7a01('0x52')]&&_0x2f2035[_0x7a01('0x52')]!==_0x7a01('0x53')){logger[_0x7a01('0x1a')](_0x7a01('0x54'),'Recording\x20is\x20enabled!');_0x8f55ab['recordingURL']=util[_0x7a01('0xc')](_0x7a01('0x45'),_0x55689c[_0x7a01('0x42')],_0x8f55ab[_0x7a01('0x46')],md5(_0x8f55ab[_0x7a01('0x46')]));}headers[_0x7a01('0x48')]=getAuth(_0x55689c);return getUser(_0x55689c,_0x14463f[_0x7a01('0x21')])['then'](function(_0x3bfd0a){_0x24cfd6=_0x3bfd0a;logger[_0x7a01('0x1a')](_0x7a01('0x49'),_0x24cfd6['id']);return getEndUser(_0x55689c,_0x8f55ab[_0x7a01('0x55')],_0x8f55ab['destcalleridnum']);})['then'](function(_0x10a1b5){_0x450456=_0x10a1b5;logger[_0x7a01('0x1a')](_0x7a01('0x4a'),_0x450456['id']);return getTicket(_0x55689c,_0x24cfd6,_0x450456,_0x20abf1,_0x8f55ab);})['then'](function(_0xd7ebab){if(_0xd7ebab&&_0xd7ebab['id']){logger['info'](_0x7a01('0x1b'));logger['info'](_0x7a01('0x4b'),_0xd7ebab['id']);logger[_0x7a01('0x1a')](_0x7a01('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7a01('0xc')](_0x7a01('0x4c'),_0x14463f[_0x7a01('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x7a01('0x4e'),_0x55689c['remoteUri'],_0xd7ebab['id'])});}})[_0x7a01('0x4f')](function(_0x1e3910){logger[_0x7a01('0x50')]('[OUTBOUND]',JSON['stringify'](_0x1e3910));});};exports[_0x7a01('0x56')]=function(_0x558298,_0x23fb0f,_0x516222,_0x2ff22e,_0xd373d0,_0x4cd87f){var _0x14ba5e,_0x35771e;_0x4cd87f['remoteUri']=intUtil['stripTrailingSlash'](_0x4cd87f[_0x7a01('0x18')]);_0x4cd87f[_0x7a01('0x42')]=intUtil['stripTrailingSlash'](_0x4cd87f[_0x7a01('0x42')]);if(_0xd373d0&&_0xd373d0[_0x7a01('0x57')]){logger[_0x7a01('0x1a')]('['+_0x23fb0f[_0x7a01('0x58')][_0x7a01('0x59')]()+']',_0x7a01('0x44'));_0x23fb0f[_0x7a01('0x47')]=util[_0x7a01('0xc')](_0x7a01('0x45'),_0x4cd87f['serverUrl'],_0x23fb0f[_0x7a01('0x46')],md5(_0x23fb0f[_0x7a01('0x46')]));}else{_0x23fb0f[_0x7a01('0x47')]='';}headers[_0x7a01('0x48')]=getAuth(_0x4cd87f);return getUser(_0x4cd87f,'')[_0x7a01('0x19')](function(_0x272d9d){_0x14ba5e=_0x272d9d;logger[_0x7a01('0x1a')](_0x7a01('0x49'),_0x14ba5e['id']);return getEndUser(_0x4cd87f,_0x23fb0f[_0x7a01('0xd')],_0x23fb0f[_0x7a01('0xe')]);})[_0x7a01('0x19')](function(_0x3f11f7){_0x35771e=_0x3f11f7;logger[_0x7a01('0x1a')](_0x7a01('0x4a'),_0x35771e['id']);return getTicket(_0x4cd87f,_0x14ba5e,_0x35771e,_0x516222,_0x23fb0f);})['then'](function(_0x544850){if(_0x544850){logger[_0x7a01('0x1a')](_0x7a01('0x1b'));logger[_0x7a01('0x1a')](_0x7a01('0x4b'),_0x544850['id']);}})[_0x7a01('0x4f')](function(_0x51ad5f){logger[_0x7a01('0x50')]('['+_0x23fb0f[_0x7a01('0x58')][_0x7a01('0x59')]()+']',JSON[_0x7a01('0x31')](_0x51ad5f));});}; \ 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 58084de..a272bbb 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 _0xc2d6=['headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','userId','Admin\x20selected','adminEmail','catch','/api/lookup?q=','&f=','find','contacts','format','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message'];(function(_0x2ed1f2,_0x18d2db){var _0x5228df=function(_0x8a90bd){while(--_0x8a90bd){_0x2ed1f2['push'](_0x2ed1f2['shift']());}};_0x5228df(++_0x18d2db);}(_0xc2d6,0x171));var _0x6c2d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc2d6[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var rp=require(_0x6c2d('0x0'));var md5=require(_0x6c2d('0x1'));var util=require(_0x6c2d('0x2'));var moment=require(_0x6c2d('0x3'));var Promise=require(_0x6c2d('0x4'));var Redis=require(_0x6c2d('0x5'));var intUtil=require(_0x6c2d('0x6'));var config=require(_0x6c2d('0x7'));var logger=require(_0x6c2d('0x8'))(_0x6c2d('0x9'));config['redis']=_[_0x6c2d('0xa')](config[_0x6c2d('0xb')],{'host':_0x6c2d('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c2d('0xb')]));function getAdminId(_0x5f5134,_0x5670fb,_0xa545c5,_0x7a1226){return new Promise(function(_0x536d03,_0x5ed660){var _0x33de9c=![];var _0x20b3a0={'method':_0x6c2d('0xd'),'uri':_0x7a1226+_0x6c2d('0xe'),'json':!![]};_0x20b3a0['headers']=_0xa545c5;logger[_0x6c2d('0xf')](_0x6c2d('0x10'));return rp(_0x20b3a0)[_0x6c2d('0x11')](function(_0x127f69){if(_0x127f69){var _0x20e193=_0x127f69[_0x6c2d('0x12')];var _0x5ccd68=null;for(_0x5ccd68=0x0;_0x5ccd68<_0x20e193['length'];_0x5ccd68++){if(_0x20e193[_0x5ccd68][_0x6c2d('0x13')]===_0x5f5134['adminEmail']){_0x5f5134[_0x6c2d('0x14')]=_0x20e193[_0x5ccd68]['id'];_0x33de9c=!![];}}if(_0x33de9c){logger[_0x6c2d('0xf')](_0x6c2d('0x15'),_0x5f5134['adminId']);_0x536d03(_0x5f5134);}else{_0x5ed660({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5ed660({'statusCode':0x194,'message':_0x6c2d('0x16')});}})['catch'](function(_0x2e9475){logger[_0x6c2d('0x17')]('['+[_0x5670fb[_0x6c2d('0x18')]()]+']',_0x2e9475[_0x6c2d('0x19')]);_0x5ed660(_0x2e9475);});});}function getUser(_0x2f0a40,_0x35006e,_0x5a3e6c){return function(_0x1f75b5){return new Promise(function(_0x30cf74,_0xc70f8e){var _0x12b0de={'method':_0x6c2d('0xd'),'uri':_0x5a3e6c+_0x6c2d('0xe'),'json':!![]};_0x12b0de[_0x6c2d('0x1a')]=_0x35006e;logger[_0x6c2d('0xf')](_0x6c2d('0x1b'));return rp(_0x12b0de)['then'](function(_0x84b94a){if(_0x84b94a){var _0x2923be=_0x84b94a['users'];var _0xe941d9=![];var _0x1f3941=null;if(_0x1f75b5[_0x6c2d('0x1c')]!==null){logger['info'](_0x6c2d('0x1d'),_0x1f75b5[_0x6c2d('0x1c')]);_0x1f75b5['userEmail']=_0x1f75b5[_0x6c2d('0x1c')];for(_0x1f3941=0x0;_0x1f3941<_0x2923be[_0x6c2d('0x1e')];_0x1f3941++){if(_0x2923be[_0x1f3941][_0x6c2d('0x13')]===_0x1f75b5['agentEmail']){_0xe941d9=!![];_0x1f75b5[_0x6c2d('0x1f')]=_0x2923be[_0x1f3941]['id'];logger[_0x6c2d('0xf')]('User\x20found:',_0x1f75b5['userId']);}}}if(!_0xe941d9){logger[_0x6c2d('0xf')](_0x6c2d('0x20'));_0x1f75b5['userEmail']=_0x1f75b5[_0x6c2d('0x21')];_0x1f75b5[_0x6c2d('0x1f')]=_0x1f75b5['adminId'];_0xe941d9=!![];}if(_0xe941d9){_0x30cf74(_0x1f75b5);}else{_0xc70f8e({'statusCode':0x194,'message':_0x6c2d('0x16')});}}else{_0xc70f8e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6c2d('0x22')](function(_0x3b9c71){logger[_0x6c2d('0x17')]('['+[_0x2f0a40[_0x6c2d('0x18')]()]+']',_0x3b9c71[_0x6c2d('0x19')]);_0xc70f8e(_0x3b9c71);});});};}function searchContact(_0x15920f,_0x450f43,_0x20acf1,_0x2eae75){return new Promise(function(_0x2358b4,_0x3c8d61){var _0x3eb54e={'method':'GET','headers':_0x450f43,'uri':_0x15920f+_0x6c2d('0x23')+_0x2eae75+_0x6c2d('0x24')+_0x20acf1+'&entities=contact','json':!![]};rp(_0x3eb54e)[_0x6c2d('0x11')](function(_0x3f48af){var _0x3df0dd=_[_0x6c2d('0x25')](_0x3f48af[_0x6c2d('0x26')][_0x6c2d('0x26')],[_0x20acf1,_0x2eae75]);_0x2358b4(_0x3df0dd);})['catch'](function(_0x5a6a2e){_0x3c8d61(_0x5a6a2e);});});}function getEndUser(_0x4e2e7f,_0x109c0a,_0x1b52bc){return function(_0x18fc52){return new Promise(function(_0x5c1036,_0x4a0f69){logger['info'](util[_0x6c2d('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x18fc52['contactNumber']));searchContact(_0x1b52bc,_0x109c0a,'mobile_number',_0x18fc52[_0x6c2d('0x28')])['then'](function(_0x12a392){if(_0x12a392){_0x18fc52['endUserId']=_0x12a392['id'];logger[_0x6c2d('0xf')](_0x6c2d('0x29'),_0x18fc52[_0x6c2d('0x2a')]);return _0x5c1036(_0x18fc52);}searchContact(_0x1b52bc,_0x109c0a,_0x6c2d('0x2b'),_0x18fc52[_0x6c2d('0x28')])[_0x6c2d('0x11')](function(_0x2cafd7){if(_0x2cafd7){_0x18fc52['endUserId']=_0x2cafd7['id'];logger[_0x6c2d('0xf')](_0x6c2d('0x2c'),_0x18fc52['endUserId']);return _0x5c1036(_0x18fc52);}createEndUser(_0x18fc52,_0x4e2e7f,_0x109c0a,_0x1b52bc)['then'](function(_0x3581c0){logger[_0x6c2d('0xf')]('Contact\x20created:',_0x3581c0[_0x6c2d('0x2a')]);return _0x5c1036(_0x3581c0);});});})[_0x6c2d('0x22')](function(_0x38b5e2){_0x4a0f69(_0x38b5e2);});});};}function createEndUser(_0xbf3ea2,_0x377b58,_0x1dc34b,_0x187321){return new Promise(function(_0x1dcd34,_0x35f11b){var _0x28bd3b=moment();var _0x257b0a={'method':'POST','uri':_0x187321+'/api/contacts','body':{'contact':{'last_name':_0xbf3ea2['contactNumber'],'work_number':_0xbf3ea2[_0x6c2d('0x28')],'mobile_number':_0xbf3ea2[_0x6c2d('0x28')],'owner_id':_0xbf3ea2[_0x6c2d('0x1f')],'created_at':_0x28bd3b['format'](_0x6c2d('0x2d'))}},'json':!![]};_0x257b0a[_0x6c2d('0x1a')]=_0x1dc34b;logger[_0x6c2d('0xf')](_0x6c2d('0x2e'));return rp(_0x257b0a)['then'](function(_0x20cb45){_0xbf3ea2[_0x6c2d('0x2a')]=_0x20cb45['contact']['id'];_0x1dcd34(_0xbf3ea2);})[_0x6c2d('0x22')](function(_0x322adc){logger['error']('['+[_0x377b58['toUpperCase']()]+']',_0x322adc['message']);_0x35f11b(_0x322adc[_0x6c2d('0x19')]);});});}function getTicket(_0x4d2809,_0x47e891,_0x341f79,_0x331758,_0xb234ba){return function(_0x2cf7e3){logger[_0x6c2d('0xf')](_0x6c2d('0x2f'));return new Promise(function(_0x5f5010,_0x2a7e43){var _0x330f7d=moment();var _0x2656fb={'method':_0x6c2d('0x30'),'uri':_0x341f79+_0x6c2d('0x31'),'body':{'title':intUtil[_0x6c2d('0x32')](_0x331758['Subjects'],_0xb234ba,'\x20'),'description':intUtil[_0x6c2d('0x32')](_0x331758[_0x6c2d('0x33')],_0xb234ba,'\x0a'),'owner_id':_0x2cf7e3[_0x6c2d('0x1f')],'creater_id':_0x2cf7e3[_0x6c2d('0x14')],'targetable_id':_0x2cf7e3['endUserId'],'targetable_type':_0x6c2d('0x34'),'created_at':_0x330f7d[_0x6c2d('0x27')](_0x6c2d('0x2d')),'due_date':_0x330f7d[_0x6c2d('0x35')](0x1e,'m')[_0x6c2d('0x27')](_0x6c2d('0x2d'))},'json':!![]};_0x2656fb[_0x6c2d('0x1a')]=_0x47e891;return rp(_0x2656fb)[_0x6c2d('0x11')](function(_0xfcaa77){_0x2cf7e3['ticketId']=_0xfcaa77[_0x6c2d('0x36')]['id'];logger[_0x6c2d('0xf')](_0x6c2d('0x37'),_0x2cf7e3[_0x6c2d('0x38')]);_0x5f5010(_0x2cf7e3);})['catch'](function(_0x1258ad){logger[_0x6c2d('0x17')]('['+[_0x4d2809[_0x6c2d('0x18')]()]+']',_0x1258ad['message']);_0x2a7e43(_0x1258ad[_0x6c2d('0x19')]);});});};}function emit(_0x48b353,_0x190f60,_0x4a7f37){var _0x52b2d8={'uri':_0x48b353+_0x6c2d('0x39')+_0x4a7f37};io['to'](util[_0x6c2d('0x27')](_0x6c2d('0x3a'),_0x190f60))[_0x6c2d('0x3b')](_0x6c2d('0x3c'),_0x52b2d8);}exports['cs']=function(_0x2b2eeb,_0x2b7db7,_0x54640b,_0x45ddb4,_0x4c0f68,_0x4a648c,_0x37fe8c,_0x4d98ce){var _0x40ae43={};var _0x2a665a={'Authorization':'Token\x20token='+_0x4a648c[_0x6c2d('0x3d')]};_0x4a648c[_0x6c2d('0x3e')]=intUtil['stripTrailingSlash'](_0x4a648c[_0x6c2d('0x3e')]);_0x4a648c['serverUrl']=intUtil[_0x6c2d('0x3f')](_0x4a648c[_0x6c2d('0x40')]);var _0x4f2f9d=_0x4a648c[_0x6c2d('0x3e')];_0x40ae43['adminEmail']=_0x4a648c['username'];_0x40ae43[_0x6c2d('0x28')]=_0x4d98ce[_0x6c2d('0x41')]()==='outbound'?_0x2b7db7[_0x6c2d('0x42')]:_0x2b7db7[_0x6c2d('0x43')];_0x40ae43['callDirection']=_0x4d98ce==='queue'||_0x4d98ce==='unmanaged'?_0x6c2d('0x44'):_0x6c2d('0x45');if(_0x45ddb4){_0x40ae43[_0x6c2d('0x1c')]=_0x45ddb4['email'];}var _0x56004f=util[_0x6c2d('0x27')](_0x6c2d('0x46'),_0x4a648c[_0x6c2d('0x40')],_0x2b7db7[_0x6c2d('0x47')],md5(_0x2b7db7['uniqueid']));if(_0x4c0f68&&_0x4c0f68[_0x6c2d('0x48')]){logger[_0x6c2d('0xf')]('[QUEUE]',_0x6c2d('0x49'));_0x2b7db7[_0x6c2d('0x4a')]=_0x56004f;}else if(_0x37fe8c&&_0x37fe8c['recordingFormat']&&_0x37fe8c[_0x6c2d('0x4b')]!=='none'){logger[_0x6c2d('0xf')](_0x6c2d('0x4c'),_0x6c2d('0x49'));_0x2b7db7[_0x6c2d('0x4a')]=_0x56004f;}else{_0x2b7db7[_0x6c2d('0x4a')]='';}return getAdminId(_0x40ae43,_0x4d98ce,_0x2a665a,_0x4f2f9d)['then'](getUser(_0x4d98ce,_0x2a665a,_0x4f2f9d))[_0x6c2d('0x11')](getEndUser(_0x4d98ce,_0x2a665a,_0x4f2f9d))[_0x6c2d('0x11')](getTicket(_0x4d98ce,_0x2a665a,_0x4f2f9d,_0x54640b,_0x2b7db7))['then'](function(_0x4a0749){logger[_0x6c2d('0xf')](util[_0x6c2d('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4a0749['ticketId']));if(_0x4d98ce!=='unmanaged'){logger['info']('['+[_0x4d98ce[_0x6c2d('0x18')]()]+']',_0x6c2d('0x4d'));emit(_0x4f2f9d,_0x45ddb4[_0x6c2d('0x4e')],_0x4a0749[_0x6c2d('0x2a')]);}})[_0x6c2d('0x22')](function(_0x446182){logger[_0x6c2d('0x17')]('['+[_0x4d98ce['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x446182,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd206=['%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','name','error',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','socket.io-emitter','redis','GET','/api/selector/owners','info','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/lookup?q=','&f=','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','serverUrl','remoteUri','username','outbound','calleridnum','callDirection','unmanaged','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd206,0x107));var _0x6d20=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd206[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6d20('0x0'));var rp=require(_0x6d20('0x1'));var md5=require('md5');var util=require(_0x6d20('0x2'));var moment=require(_0x6d20('0x3'));var Promise=require(_0x6d20('0x4'));var Redis=require('ioredis');var intUtil=require(_0x6d20('0x5'));var config=require(_0x6d20('0x6'));var logger=require(_0x6d20('0x7'))(_0x6d20('0x8'));config['redis']=_[_0x6d20('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6d20('0xa'))(new Redis(config[_0x6d20('0xb')]));function getAdminId(_0x5b4154,_0x2b338c,_0x56b407,_0x3ce1be){return new Promise(function(_0x4222dc,_0x49fc93){var _0x588dfb=![];var _0x5610b6={'method':_0x6d20('0xc'),'uri':_0x3ce1be+_0x6d20('0xd'),'json':!![]};_0x5610b6['headers']=_0x56b407;logger[_0x6d20('0xe')]('Getting\x20admin\x20information');return rp(_0x5610b6)[_0x6d20('0xf')](function(_0x4c909b){if(_0x4c909b){var _0x57f713=_0x4c909b['users'];var _0x555d7f=null;for(_0x555d7f=0x0;_0x555d7f<_0x57f713[_0x6d20('0x10')];_0x555d7f++){if(_0x57f713[_0x555d7f][_0x6d20('0x11')]===_0x5b4154[_0x6d20('0x12')]){_0x5b4154[_0x6d20('0x13')]=_0x57f713[_0x555d7f]['id'];_0x588dfb=!![];}}if(_0x588dfb){logger[_0x6d20('0xe')](_0x6d20('0x14'),_0x5b4154['adminId']);_0x4222dc(_0x5b4154);}else{_0x49fc93({'statusCode':0x194,'message':_0x6d20('0x15')});}}else{_0x49fc93({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6d20('0x16')](function(_0x37151b){logger['error']('['+[_0x2b338c[_0x6d20('0x17')]()]+']',_0x37151b[_0x6d20('0x18')]);_0x49fc93(_0x37151b);});});}function getUser(_0xf93805,_0x133cd0,_0x48cc05){return function(_0x5ef31b){return new Promise(function(_0x24ee5e,_0x12fad7){var _0x4f938f={'method':_0x6d20('0xc'),'uri':_0x48cc05+'/api/selector/owners','json':!![]};_0x4f938f['headers']=_0x133cd0;logger[_0x6d20('0xe')](_0x6d20('0x19'));return rp(_0x4f938f)[_0x6d20('0xf')](function(_0x42e463){if(_0x42e463){var _0x5cdbfa=_0x42e463[_0x6d20('0x1a')];var _0x3ad6bb=![];var _0x35802d=null;if(_0x5ef31b[_0x6d20('0x1b')]!==null){logger[_0x6d20('0xe')](_0x6d20('0x1c'),_0x5ef31b[_0x6d20('0x1b')]);_0x5ef31b[_0x6d20('0x1d')]=_0x5ef31b[_0x6d20('0x1b')];for(_0x35802d=0x0;_0x35802d<_0x5cdbfa[_0x6d20('0x10')];_0x35802d++){if(_0x5cdbfa[_0x35802d]['email']===_0x5ef31b[_0x6d20('0x1b')]){_0x3ad6bb=!![];_0x5ef31b['userId']=_0x5cdbfa[_0x35802d]['id'];logger[_0x6d20('0xe')]('User\x20found:',_0x5ef31b[_0x6d20('0x1e')]);}}}if(!_0x3ad6bb){logger[_0x6d20('0xe')](_0x6d20('0x1f'));_0x5ef31b[_0x6d20('0x1d')]=_0x5ef31b[_0x6d20('0x12')];_0x5ef31b[_0x6d20('0x1e')]=_0x5ef31b[_0x6d20('0x13')];_0x3ad6bb=!![];}if(_0x3ad6bb){_0x24ee5e(_0x5ef31b);}else{_0x12fad7({'statusCode':0x194,'message':_0x6d20('0x15')});}}else{_0x12fad7({'statusCode':0x194,'message':_0x6d20('0x15')});}})[_0x6d20('0x16')](function(_0x14504f){logger['error']('['+[_0xf93805[_0x6d20('0x17')]()]+']',_0x14504f['message']);_0x12fad7(_0x14504f);});});};}function searchContact(_0x3da5a3,_0x29c2d3,_0x251958,_0x4f2364){return new Promise(function(_0xf51845,_0x51bf95){var _0x26aa8d={'method':_0x6d20('0xc'),'headers':_0x29c2d3,'uri':_0x3da5a3+_0x6d20('0x20')+_0x4f2364+_0x6d20('0x21')+_0x251958+'&entities=contact','json':!![]};rp(_0x26aa8d)[_0x6d20('0xf')](function(_0x136d60){var _0x3b182c=_['find'](_0x136d60[_0x6d20('0x22')][_0x6d20('0x22')],[_0x251958,_0x4f2364]);_0xf51845(_0x3b182c);})[_0x6d20('0x16')](function(_0x3cbb12){_0x51bf95(_0x3cbb12);});});}function getEndUser(_0x31045d,_0x192d39,_0xd2431f){return function(_0x1b8541){return new Promise(function(_0x375ef0,_0x38db48){logger[_0x6d20('0xe')](util[_0x6d20('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x1b8541[_0x6d20('0x24')]));searchContact(_0xd2431f,_0x192d39,_0x6d20('0x25'),_0x1b8541[_0x6d20('0x24')])[_0x6d20('0xf')](function(_0x562494){if(_0x562494){_0x1b8541['endUserId']=_0x562494['id'];logger[_0x6d20('0xe')](_0x6d20('0x26'),_0x1b8541[_0x6d20('0x27')]);return _0x375ef0(_0x1b8541);}searchContact(_0xd2431f,_0x192d39,_0x6d20('0x28'),_0x1b8541['contactNumber'])[_0x6d20('0xf')](function(_0x374fba){if(_0x374fba){_0x1b8541[_0x6d20('0x27')]=_0x374fba['id'];logger[_0x6d20('0xe')](_0x6d20('0x29'),_0x1b8541[_0x6d20('0x27')]);return _0x375ef0(_0x1b8541);}createEndUser(_0x1b8541,_0x31045d,_0x192d39,_0xd2431f)[_0x6d20('0xf')](function(_0x2157d2){logger['info'](_0x6d20('0x2a'),_0x2157d2['endUserId']);return _0x375ef0(_0x2157d2);});});})[_0x6d20('0x16')](function(_0x1ff848){_0x38db48(_0x1ff848);});});};}function createEndUser(_0x2580f8,_0x24bb33,_0x5baf4d,_0x44c83d){return new Promise(function(_0x4c9d8d,_0x14cbac){var _0xc69e3e=moment();var _0x42d684={'method':_0x6d20('0x2b'),'uri':_0x44c83d+_0x6d20('0x2c'),'body':{'contact':{'last_name':_0x2580f8[_0x6d20('0x24')],'work_number':_0x2580f8['contactNumber'],'mobile_number':_0x2580f8[_0x6d20('0x24')],'owner_id':_0x2580f8['userId'],'created_at':_0xc69e3e[_0x6d20('0x23')](_0x6d20('0x2d'))}},'json':!![]};_0x42d684['headers']=_0x5baf4d;logger[_0x6d20('0xe')](_0x6d20('0x2e'));return rp(_0x42d684)['then'](function(_0x316349){_0x2580f8['endUserId']=_0x316349[_0x6d20('0x2f')]['id'];_0x4c9d8d(_0x2580f8);})[_0x6d20('0x16')](function(_0x1e50eb){logger['error']('['+[_0x24bb33[_0x6d20('0x17')]()]+']',_0x1e50eb[_0x6d20('0x18')]);_0x14cbac(_0x1e50eb[_0x6d20('0x18')]);});});}function getTicket(_0x5ceca8,_0x2b5fb7,_0x348b3f,_0x47019b,_0x1cc3ca){return function(_0x315949){logger['info'](_0x6d20('0x30'));return new Promise(function(_0x277390,_0x15496d){var _0x7a137=moment();var _0x2da7ca={'method':'POST','uri':_0x348b3f+_0x6d20('0x31'),'body':{'title':intUtil[_0x6d20('0x32')](_0x47019b[_0x6d20('0x33')],_0x1cc3ca,'\x20'),'description':intUtil[_0x6d20('0x32')](_0x47019b[_0x6d20('0x34')],_0x1cc3ca,'\x0a'),'owner_id':_0x315949['userId'],'creater_id':_0x315949[_0x6d20('0x13')],'targetable_id':_0x315949['endUserId'],'targetable_type':_0x6d20('0x35'),'created_at':_0x7a137[_0x6d20('0x23')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x7a137['add'](0x1e,'m')[_0x6d20('0x23')](_0x6d20('0x2d'))},'json':!![]};_0x2da7ca['headers']=_0x2b5fb7;return rp(_0x2da7ca)[_0x6d20('0xf')](function(_0x49e27d){_0x315949[_0x6d20('0x36')]=_0x49e27d['task']['id'];logger['info'](_0x6d20('0x37'),_0x315949[_0x6d20('0x36')]);_0x277390(_0x315949);})[_0x6d20('0x16')](function(_0x107cc6){logger['error']('['+[_0x5ceca8[_0x6d20('0x17')]()]+']',_0x107cc6[_0x6d20('0x18')]);_0x15496d(_0x107cc6[_0x6d20('0x18')]);});});};}function emit(_0x48e6d6,_0x32b8c6,_0x45e223){var _0x3a1c99={'uri':_0x48e6d6+_0x6d20('0x38')+_0x45e223};io['to'](util['format'](_0x6d20('0x39'),_0x32b8c6))[_0x6d20('0x3a')]('trigger:browser:url',_0x3a1c99);}exports['cs']=function(_0x49c09,_0x40d23d,_0x9c487b,_0x2f0d96,_0xe07f91,_0x4a14aa,_0x26269e,_0x45730f){var _0x22b5e5={};var _0x2b6a7a={'Authorization':_0x6d20('0x3b')+_0x4a14aa[_0x6d20('0x3c')]};_0x4a14aa['remoteUri']=intUtil['stripTrailingSlash'](_0x4a14aa['remoteUri']);_0x4a14aa['serverUrl']=intUtil['stripTrailingSlash'](_0x4a14aa[_0x6d20('0x3d')]);var _0x3eaad9=_0x4a14aa[_0x6d20('0x3e')];_0x22b5e5[_0x6d20('0x12')]=_0x4a14aa[_0x6d20('0x3f')];_0x22b5e5[_0x6d20('0x24')]=_0x45730f['toLowerCase']()===_0x6d20('0x40')?_0x40d23d['destcalleridnum']:_0x40d23d[_0x6d20('0x41')];_0x22b5e5[_0x6d20('0x42')]=_0x45730f==='queue'||_0x45730f===_0x6d20('0x43')?_0x6d20('0x44'):_0x6d20('0x40');if(_0x2f0d96){_0x22b5e5[_0x6d20('0x1b')]=_0x2f0d96['email'];}var _0x5161e7=util[_0x6d20('0x23')](_0x6d20('0x45'),_0x4a14aa['serverUrl'],_0x40d23d[_0x6d20('0x46')],md5(_0x40d23d[_0x6d20('0x46')]));if(_0xe07f91&&_0xe07f91[_0x6d20('0x47')]){logger['info'](_0x6d20('0x48'),_0x6d20('0x49'));_0x40d23d[_0x6d20('0x4a')]=_0x5161e7;}else if(_0x26269e&&_0x26269e[_0x6d20('0x4b')]&&_0x26269e['recordingFormat']!==_0x6d20('0x4c')){logger[_0x6d20('0xe')](_0x6d20('0x4d'),_0x6d20('0x49'));_0x40d23d['recordingURL']=_0x5161e7;}else{_0x40d23d['recordingURL']='';}return getAdminId(_0x22b5e5,_0x45730f,_0x2b6a7a,_0x3eaad9)[_0x6d20('0xf')](getUser(_0x45730f,_0x2b6a7a,_0x3eaad9))[_0x6d20('0xf')](getEndUser(_0x45730f,_0x2b6a7a,_0x3eaad9))['then'](getTicket(_0x45730f,_0x2b6a7a,_0x3eaad9,_0x9c487b,_0x40d23d))[_0x6d20('0xf')](function(_0x57af05){logger[_0x6d20('0xe')](util[_0x6d20('0x23')](_0x6d20('0x4e'),_0x57af05[_0x6d20('0x36')]));if(_0x45730f!=='unmanaged'){logger['info']('['+[_0x45730f['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3eaad9,_0x2f0d96[_0x6d20('0x4f')],_0x57af05[_0x6d20('0x27')]);}})['catch'](function(_0x9cc36b){logger[_0x6d20('0x50')]('['+[_0x45730f[_0x6d20('0x17')]()]+_0x6d20('0x51'),util[_0x6d20('0x52')](_0x9cc36b,{'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 e534071..556994d 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 _0x9c00=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk'];(function(_0x491882,_0xbb6d1a){var _0x5c85df=function(_0x2f187b){while(--_0x2f187b){_0x491882['push'](_0x491882['shift']());}};_0x5c85df(++_0xbb6d1a);}(_0x9c00,0x1a0));var _0x09c0=function(_0x48271f,_0xc4f6d3){_0x48271f=_0x48271f-0x0;var _0x13eb5c=_0x9c00[_0x48271f];return _0x13eb5c;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x09c0('0x2'));var freshdesk=require(_0x09c0('0x3'));var zoho=require('./zoho');var desk=require(_0x09c0('0x4'));var vtiger=require(_0x09c0('0x5'));var servicenow=require(_0x09c0('0x6'));var dynamics365=require(_0x09c0('0x7'));var freshsales=require(_0x09c0('0x8'));var integrations=['zendesk','salesforce',_0x09c0('0x9'),_0x09c0('0xa'),_0x09c0('0xb'),_0x09c0('0xc'),_0x09c0('0xd'),'dynamics365',_0x09c0('0xe'),_0x09c0('0xf')];exports[_0x09c0('0x10')]=function(_0x1feb1d,_0x27a33c,_0x1e16f4,_0x1fec4f,_0x36f26d,_0x278f8b){if(_0x1e16f4){if(_[_0x09c0('0x11')](integrations,_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]())){try{var _0x2929f1=null;var _0x144271='';var _0x3b95cc=_0x1e16f4[_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]()];if(_0x3b95cc){var _0x2a86da=_0x3b95cc[_0x1feb1d[_0x09c0('0x14')]];if(_0x2a86da){var _0x3649d2=_[_0x09c0('0x15')](_0x2a86da[_0x09c0('0x16')],{'id':parseInt(_0x1feb1d[_0x09c0('0x17')],0xa)});if(_0x3649d2){if(_0x1fec4f){if(_0x36f26d&&_0x27a33c[_0x09c0('0x18')]){_0x144271=_0x09c0('0x18');}else if(_0x27a33c[_0x09c0('0x19')]){_0x144271='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x27a33c);}}else{_0x144271=_0x09c0('0x1a');}switch(_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]()){case _0x09c0('0x1b'):zendesk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'salesforce':salesforce[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0x9'):sugarcrm[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'freshdesk':freshdesk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'zoho':zoho[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0xc'):desk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'vtiger':vtiger[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0xe'):freshsales['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;case _0x09c0('0xf'):servicenow['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;case _0x09c0('0x1c'):dynamics365['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;default:console['log'](_0x09c0('0x1d'));}}else{_0x2929f1=require(_0x09c0('0x1e'))(_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]());_0x2929f1[_0x09c0('0x1f')](_0x09c0('0x20'),util[_0x09c0('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')](),_0x1feb1d[_0x09c0('0x17')]));}}else{_0x2929f1=require(_0x09c0('0x1e'))(_0x1feb1d['data1']['toLowerCase']());_0x2929f1[_0x09c0('0x1f')](_0x09c0('0x20'),util[_0x09c0('0x21')](_0x09c0('0x22'),_0x1feb1d['data1'][_0x09c0('0x13')](),_0x1feb1d[_0x09c0('0x14')]));}}else{}}catch(_0x56d883){console[_0x09c0('0x1f')](_0x56d883);}}}}; \ No newline at end of file +var _0x2032=['./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','includes','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','dynamics365','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./zoho'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2032,0xd9));var _0x2203=function(_0x3606ac,_0x4d7a1a){_0x3606ac=_0x3606ac-0x0;var _0x362e95=_0x2032[_0x3606ac];return _0x362e95;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var zendesk=require(_0x2203('0x1'));var salesforce=require(_0x2203('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2203('0x3'));var zoho=require(_0x2203('0x4'));var desk=require('./desk');var vtiger=require(_0x2203('0x5'));var servicenow=require(_0x2203('0x6'));var dynamics365=require(_0x2203('0x7'));var freshsales=require(_0x2203('0x8'));var integrations=[_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),_0x2203('0xe'),_0x2203('0xf'),'dynamics365','freshsales',_0x2203('0x10')];exports['exec']=function(_0x27081c,_0x2972f3,_0x6339c4,_0x5b19df,_0x849049,_0x4a6832){if(_0x6339c4){if(_[_0x2203('0x11')](integrations,_0x27081c['data1'][_0x2203('0x12')]())){try{var _0x1abb51=null;var _0x4b9376='';var _0x583bc7=_0x6339c4[_0x27081c['data1']['toLowerCase']()];if(_0x583bc7){var _0x4bad7c=_0x583bc7[_0x27081c[_0x2203('0x13')]];if(_0x4bad7c){var _0x538b30=_['find'](_0x4bad7c[_0x2203('0x14')],{'id':parseInt(_0x27081c[_0x2203('0x15')],0xa)});if(_0x538b30){if(_0x5b19df){if(_0x849049&&_0x2972f3[_0x2203('0x16')]){_0x4b9376=_0x2203('0x16');}else if(_0x2972f3[_0x2203('0x17')]){_0x4b9376=_0x2203('0x18');}else{console[_0x2203('0x19')](_0x2203('0x1a'),_0x2972f3);}}else{_0x4b9376=_0x2203('0x1b');}switch(_0x27081c[_0x2203('0x1c')]['toLowerCase']()){case _0x2203('0x9'):zendesk[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case _0x2203('0xa'):salesforce[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case'sugarcrm':sugarcrm[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case _0x2203('0xc'):freshdesk[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case _0x2203('0xd'):zoho[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case'desk':desk[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case _0x2203('0xf'):vtiger[_0x4b9376](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832);break;case'freshsales':freshsales['cs'](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832,_0x4b9376);break;case _0x2203('0x10'):servicenow['cs'](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832,_0x4b9376);break;case _0x2203('0x1d'):dynamics365['cs'](_0x27081c,_0x2972f3,_0x538b30,_0x5b19df,_0x849049,_0x4bad7c,_0x4a6832,_0x4b9376);break;default:console[_0x2203('0x19')](_0x2203('0x1e'));}}else{_0x1abb51=require(_0x2203('0x1f'))(_0x27081c[_0x2203('0x1c')]['toLowerCase']());_0x1abb51[_0x2203('0x20')]('[EXEC]',util['format'](_0x2203('0x21'),_0x27081c['data1'][_0x2203('0x12')](),_0x27081c[_0x2203('0x15')]));}}else{_0x1abb51=require('../../../../config/logger')(_0x27081c[_0x2203('0x1c')]['toLowerCase']());_0x1abb51['error'](_0x2203('0x22'),util[_0x2203('0x23')](_0x2203('0x24'),_0x27081c[_0x2203('0x1c')][_0x2203('0x12')](),_0x27081c[_0x2203('0x13')]));}}else{}}catch(_0x49c12){console[_0x2203('0x20')](_0x49c12);}}}}; \ 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 8557be0..04b7087 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 _0xebe3=['jsforce','./util','../../../../config/environment','salesforce','defaults','redis','localhost','emit','assign','Subjects','getString','Descriptions','ticketType','Case','ContactId','sobject','create','isNil','validateEmail','User','execute','then','find','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Task','moduleSearch','Contact','Lead','contact','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','length','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','type','string','content','toString','variableName','idField','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname',']\x20Ticket\x20%s\x20created.','lodash','request-promise','bluebird','md5'];(function(_0x499e56,_0x217119){var _0xe2e626=function(_0x3b7672){while(--_0x3b7672){_0x499e56['push'](_0x499e56['shift']());}};_0xe2e626(++_0x217119);}(_0xebe3,0x19c));var _0x3ebe=function(_0x19dffc,_0x1c7720){_0x19dffc=_0x19dffc-0x0;var _0x3785a9=_0xebe3[_0x19dffc];return _0x3785a9;};'use strict';var _=require(_0x3ebe('0x0'));var rp=require(_0x3ebe('0x1'));var moment=require('moment');var BPromise=require(_0x3ebe('0x2'));var md5=require(_0x3ebe('0x3'));var jsforce=require(_0x3ebe('0x4'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x3ebe('0x5'));var config=require(_0x3ebe('0x6'));var logger=require('../../../../config/logger')(_0x3ebe('0x7'));config['redis']=_[_0x3ebe('0x8')](config[_0x3ebe('0x9')],{'host':_0x3ebe('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3ebe('0x9')]));function emit(_0x23aa1b,_0x49339e,_0x318ebc){io['to'](_0x23aa1b)[_0x3ebe('0xb')](_0x49339e,_0x318ebc);}function getTicket(_0xe1c5a8,_0x38f987,_0x4af960,_0x12caf6,_0x32546d,_0x191228,_0x429066,_0x2720ea){var _0x1cfeec={};if(_0x12caf6['ticketType']==='Task'){_0x1cfeec=Object[_0x3ebe('0xc')]({},{'OwnerId':_0x38f987['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x12caf6[_0x3ebe('0xd')],_0x32546d,'\x20'),'Description':intUtil[_0x3ebe('0xe')](_0x12caf6[_0x3ebe('0xf')],_0x32546d,'\x0a')},getCustomFields(_0x191228,_0x32546d));if(_0x4af960){_0x1cfeec['WhoId']=_0x4af960['id'];}}else if(_0x12caf6[_0x3ebe('0x10')]===_0x3ebe('0x11')){_0x1cfeec=Object[_0x3ebe('0xc')]({},{'OwnerId':_0x38f987['id'],'Subject':intUtil[_0x3ebe('0xe')](_0x12caf6[_0x3ebe('0xd')],_0x32546d,'\x20'),'Description':intUtil['getString'](_0x12caf6[_0x3ebe('0xf')],_0x32546d,'\x0a')},getCustomFields(_0x191228,_0x32546d));if(_0x4af960){_0x1cfeec[_0x3ebe('0x12')]=_0x4af960['id'];}}return _0x429066[_0x3ebe('0x13')](_0x12caf6[_0x3ebe('0x10')])[_0x3ebe('0x14')](_0x1cfeec);}function getUser(_0x157459,_0xa9d165,_0x5634e5){if(!_[_0x3ebe('0x15')](_0xa9d165)&&intUtil[_0x3ebe('0x16')](_0xa9d165)){var _0x14d6cd={'Email':_0xa9d165};var _0x12798e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5634e5[_0x3ebe('0x13')](_0x3ebe('0x17'))['find'](_0x14d6cd,_0x12798e)[_0x3ebe('0x18')]()[_0x3ebe('0x19')](function(_0x32c4ea){if(_0x32c4ea['length']){var _0x50c5c1=_[_0x3ebe('0x1a')](_0x32c4ea,function(_0x970b31){return _0x970b31['Email']===_0xa9d165;});if(_0x50c5c1){logger[_0x3ebe('0x1b')](_0x3ebe('0x1c'),_0xa9d165);return BPromise[_0x3ebe('0x1d')]({'id':_0x50c5c1['Id'],'name':_0x50c5c1[_0x3ebe('0x1e')]});}}else{logger[_0x3ebe('0x1b')](_0x3ebe('0x1f'),_0xa9d165);return _0x5634e5[_0x3ebe('0x20')]()[_0x3ebe('0x19')](function(_0x1eeee5){return BPromise[_0x3ebe('0x1d')]({'id':_0x1eeee5['user_id'],'name':_0x1eeee5[_0x3ebe('0x21')]});});}});}else{logger[_0x3ebe('0x1b')](_0x3ebe('0x1f'),_0xa9d165);return _0x5634e5[_0x3ebe('0x20')]()[_0x3ebe('0x19')](function(_0x4ce351){return BPromise['resolve']({'id':_0x4ce351[_0x3ebe('0x22')],'name':_0x4ce351[_0x3ebe('0x21')]});});}}function getEndUser(_0x518946,_0x31745b,_0x238424,_0x11edd8,_0x3ae1d2){var _0x2bcc8={'Phone':_0x11edd8};var _0x307726={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3ebe('0x1d')]()[_0x3ebe('0x19')](function(){if(_0x31745b[_0x3ebe('0x10')]===_0x3ebe('0x23')){logger[_0x3ebe('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x11edd8,_0x31745b[_0x3ebe('0x24')]);switch(_0x31745b[_0x3ebe('0x24')]){case'contact_lead':return _0x3ae1d2['sobject'](_0x3ebe('0x25'))['find'](_0x2bcc8,_0x307726)[_0x3ebe('0x18')]()[_0x3ebe('0x19')](function(_0x188375){if(_0x188375&&_0x188375['length']){return _0x188375;}else{return _0x3ae1d2['sobject'](_0x3ebe('0x26'))[_0x3ebe('0x1a')](_0x2bcc8,_0x307726);}});case _0x3ebe('0x27'):return _0x3ae1d2['sobject']('Contact')['find'](_0x2bcc8,_0x307726)[_0x3ebe('0x18')]();case'lead':return _0x3ae1d2[_0x3ebe('0x13')]('Lead')[_0x3ebe('0x1a')](_0x2bcc8,_0x307726);default:return null;}}else if(_0x31745b[_0x3ebe('0x10')]===_0x3ebe('0x11')){logger[_0x3ebe('0x1b')](_0x3ebe('0x28'),_0x11edd8,_0x3ebe('0x27'));return _0x3ae1d2[_0x3ebe('0x13')](_0x3ebe('0x25'))['find'](_0x2bcc8,_0x307726)[_0x3ebe('0x18')]();}})[_0x3ebe('0x19')](function(_0x30a274){if(_0x30a274&&_0x30a274[_0x3ebe('0x29')]){var _0x1d3220=_[_0x3ebe('0x1a')](_0x30a274,function(_0x6c6525){return _0x6c6525[_0x3ebe('0x2a')]===_0x11edd8;});if(_0x1d3220){return BPromise[_0x3ebe('0x1d')]({'id':_0x1d3220['Id'],'name':_0x1d3220[_0x3ebe('0x1e')],'phone':_0x1d3220['Phone']});}}})[_0x3ebe('0x19')](function(_0x1426a1){if(_0x1426a1){logger['info'](_0x3ebe('0x2b'),_0x11edd8);return BPromise[_0x3ebe('0x1d')](_0x1426a1);}else{logger[_0x3ebe('0x1b')](_0x3ebe('0x2c'),_0x11edd8);var _0x36e2ce={'LastName':_0x238424!==_0x3ebe('0x2d')?_0x238424:util[_0x3ebe('0x2e')](_0x3ebe('0x2f'),_0x11edd8),'Phone':_0x11edd8};if(_0x31745b['moduleCreate']){if(_0x31745b[_0x3ebe('0x30')]==='contact'){logger[_0x3ebe('0x1b')](_0x3ebe('0x31'),_0x11edd8,_0x31745b[_0x3ebe('0x30')]);}else if(_0x31745b[_0x3ebe('0x30')]==='lead'&&_0x31745b[_0x3ebe('0x10')]==='Task'){logger[_0x3ebe('0x1b')](_0x3ebe('0x31'),_0x11edd8,_0x31745b['moduleCreate']);_0x36e2ce[_0x3ebe('0x32')]=_0x3ebe('0x33');}else{return null;}}return _0x3ae1d2[_0x3ebe('0x13')](_['upperFirst'](_0x31745b[_0x3ebe('0x30')]))[_0x3ebe('0x14')](_0x36e2ce);}});}function getCustomFields(_0x89b44c,_0x59a2db){var _0x3939d2={};if(_0x89b44c['length']>0x0){_['forEach'](_0x89b44c,function(_0x2cb460){if(_0x2cb460[_0x3ebe('0x34')]===_0x3ebe('0x35')&&_0x2cb460['idField']){_0x3939d2[_0x2cb460['idField']]=_0x2cb460[_0x3ebe('0x36')][_0x3ebe('0x37')]();}else if(_0x2cb460[_0x3ebe('0x34')]==='variable'&&_0x2cb460[_0x3ebe('0x38')]&&_0x2cb460[_0x3ebe('0x39')]){_0x59a2db[_0x2cb460[_0x3ebe('0x38')]]&&(_0x3939d2[_0x2cb460[_0x3ebe('0x39')]]=_0x59a2db[_0x2cb460[_0x3ebe('0x38')]][_0x3ebe('0x37')]());}else if(_0x2cb460[_0x3ebe('0x34')]===_0x3ebe('0x3a')&&_0x2cb460[_0x3ebe('0x3b')]&&_0x2cb460['Variable'][_0x3ebe('0x3c')]&&_0x2cb460['idField']){_0x59a2db[_0x2cb460[_0x3ebe('0x3b')]['name'][_0x3ebe('0x3d')]()]&&(_0x3939d2[_0x2cb460[_0x3ebe('0x39')]]=_0x59a2db[_0x2cb460['Variable'][_0x3ebe('0x3c')][_0x3ebe('0x3d')]()][_0x3ebe('0x37')]());}});}return _0x3939d2;}function getConnection(_0x2c28f6){var _0x205320=_0x2c28f6['password'][_0x3ebe('0x3e')](_0x2c28f6[_0x3ebe('0x3f')]);var _0x215554=new jsforce[(_0x3ebe('0x40'))]({'oauth2':{'loginUrl':_0x2c28f6[_0x3ebe('0x41')]||'https://login.salesforce.com','clientId':_0x2c28f6[_0x3ebe('0x42')],'clientSecret':_0x2c28f6['clientSecret']}});return _0x215554[_0x3ebe('0x43')](_0x2c28f6[_0x3ebe('0x44')],_0x205320)[_0x3ebe('0x19')](function(){logger[_0x3ebe('0x1b')](_0x3ebe('0x45'));return _0x215554;});}exports[_0x3ebe('0x46')]=function(_0x1ebb6e,_0x150762,_0x46c187,_0x3404b7,_0x39df33,_0x191310){var _0xc1331e,_0x2379c8,_0x431385,_0x2815db;_0x191310['serverUrl']=intUtil[_0x3ebe('0x47')](_0x191310[_0x3ebe('0x48')]);_0x191310[_0x3ebe('0x41')]=intUtil[_0x3ebe('0x47')](_0x191310[_0x3ebe('0x41')]);if(_0x39df33&&_0x39df33[_0x3ebe('0x49')]){logger[_0x3ebe('0x1b')](_0x3ebe('0x4a'),_0x3ebe('0x4b'));_0x150762[_0x3ebe('0x4c')]=util[_0x3ebe('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x191310['serverUrl'],_0x150762['uniqueid'],md5(_0x150762[_0x3ebe('0x4d')]));}else{_0x150762['recordingURL']='';}return getConnection(_0x191310)[_0x3ebe('0x19')](function(_0x4b210c){_0x2815db=_0x4b210c;return getUser(_0x191310,_0x3404b7[_0x3ebe('0x4e')],_0x2815db);})[_0x3ebe('0x19')](function(_0x42c203){_0xc1331e=_0x42c203;return getEndUser(_0x191310,_0x46c187,_0x150762['calleridname'],_0x150762['calleridnum'],_0x2815db);})['then'](function(_0x189b6b){_0x2379c8=_0x189b6b;return getTicket(_0x191310,_0xc1331e,_0x2379c8,_0x46c187,_0x150762,_0x46c187[_0x3ebe('0x4f')],_0x2815db,_0x3ebe('0x46'));})[_0x3ebe('0x19')](function(_0x32a127){_0x431385=_0x32a127;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x431385['id']);logger[_0x3ebe('0x1b')](_0x3ebe('0x50'),_0x431385['id'],_0x3404b7[_0x3ebe('0x3c')],_0x191310['type']);switch(_0x191310['type']){case'integrationTab':emit(util[_0x3ebe('0x2e')](_0x3ebe('0x51'),_0x3404b7[_0x3ebe('0x3c')]),'trigger:salesforce:display',{'recordId':_0x431385['id']});break;case'newTab':emit(util['format'](_0x3ebe('0x51'),_0x3404b7[_0x3ebe('0x3c')]),_0x3ebe('0x52'),{'uri':util[_0x3ebe('0x2e')](_0x3ebe('0x53'),_0x2815db[_0x3ebe('0x54')],_0x431385['id'])});break;default:logger['error'](_0x3ebe('0x55'));}})[_0x3ebe('0x56')](function(_0x477f48){logger[_0x3ebe('0x57')](_0x3ebe('0x4a'),JSON[_0x3ebe('0x58')](_0x477f48));});};exports[_0x3ebe('0x59')]=function(_0x487cdd,_0x20572a,_0x63c6d0,_0x5ab0d6,_0x40a1b7,_0x1f7f76,_0x184082){var _0x276247,_0x5a64b5,_0x38a617,_0x59511f;_0x1f7f76['serverUrl']=intUtil[_0x3ebe('0x47')](_0x1f7f76[_0x3ebe('0x48')]);_0x1f7f76['remoteUri']=intUtil[_0x3ebe('0x47')](_0x1f7f76[_0x3ebe('0x41')]);if(_0x184082&&_0x184082['recordingFormat']&&_0x184082['recordingFormat']!==_0x3ebe('0x5a')){logger[_0x3ebe('0x1b')]('[OUTBOUND]',_0x3ebe('0x4b'));_0x20572a[_0x3ebe('0x4c')]=util[_0x3ebe('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f7f76[_0x3ebe('0x48')],_0x20572a[_0x3ebe('0x4d')],md5(_0x20572a['uniqueid']));}return getConnection(_0x1f7f76)['then'](function(_0x2c8aef){_0x59511f=_0x2c8aef;return getUser(_0x1f7f76,_0x5ab0d6[_0x3ebe('0x4e')],_0x59511f);})[_0x3ebe('0x19')](function(_0x39299d){_0x276247=_0x39299d;return getEndUser(_0x1f7f76,_0x63c6d0,_0x20572a[_0x3ebe('0x5b')],_0x20572a[_0x3ebe('0x5c')],_0x59511f);})[_0x3ebe('0x19')](function(_0x9fd4ed){_0x5a64b5=_0x9fd4ed;return getTicket(_0x1f7f76,_0x276247,_0x5a64b5,_0x63c6d0,_0x20572a,_0x63c6d0[_0x3ebe('0x4f')],_0x59511f,_0x3ebe('0x59'));})[_0x3ebe('0x19')](function(_0x1603bd){_0x38a617=_0x1603bd;logger[_0x3ebe('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x38a617['id']);logger['info'](_0x3ebe('0x5d'),_0x38a617['id'],_0x5ab0d6['name'],_0x1f7f76['type']);switch(_0x1f7f76[_0x3ebe('0x34')]){case'integrationTab':emit(util[_0x3ebe('0x2e')](_0x3ebe('0x51'),_0x5ab0d6['name']),_0x3ebe('0x5e'),{'recordId':_0x38a617['id']});break;case _0x3ebe('0x5f'):emit(util[_0x3ebe('0x2e')]('user:%s',_0x5ab0d6['name']),'trigger:browser:url',{'uri':util[_0x3ebe('0x2e')](_0x3ebe('0x53'),_0x59511f[_0x3ebe('0x54')],_0x38a617['id'])});break;default:logger[_0x3ebe('0x57')](_0x3ebe('0x60'),_0x3ebe('0x61'));}})['catch'](function(_0x555dcb){logger[_0x3ebe('0x57')](_0x3ebe('0x60'),JSON[_0x3ebe('0x58')](_0x555dcb));});};exports[_0x3ebe('0x62')]=function(_0x2aca58,_0x569e8c,_0x3fd4f8,_0x14f056,_0x5e709c,_0x9ab06d){var _0x4b885f,_0x400a0d,_0x2ed462,_0x359b40;_0x9ab06d[_0x3ebe('0x48')]=intUtil[_0x3ebe('0x47')](_0x9ab06d['serverUrl']);_0x9ab06d[_0x3ebe('0x41')]=intUtil[_0x3ebe('0x47')](_0x9ab06d['remoteUri']);if(_0x5e709c&&_0x5e709c[_0x3ebe('0x49')]){logger['info']('['+_0x569e8c[_0x3ebe('0x63')][_0x3ebe('0x64')]()+']',_0x3ebe('0x4b'));_0x569e8c['recordingURL']=util['format'](_0x3ebe('0x65'),_0x9ab06d[_0x3ebe('0x48')],_0x569e8c['uniqueid'],md5(_0x569e8c[_0x3ebe('0x4d')]));}else{_0x569e8c[_0x3ebe('0x4c')]='';}return getConnection(_0x9ab06d)['then'](function(_0x105e82){_0x359b40=_0x105e82;if(!_[_0x3ebe('0x15')](_0x14f056)){return getUser(_0x9ab06d,_0x14f056[_0x3ebe('0x3c')],_0x359b40);}else{return getUser(_0x9ab06d,null,_0x359b40);}})[_0x3ebe('0x19')](function(_0x266b00){_0x4b885f=_0x266b00;return getEndUser(_0x9ab06d,_0x3fd4f8,_0x569e8c[_0x3ebe('0x66')],_0x569e8c['calleridnum'],_0x359b40);})[_0x3ebe('0x19')](function(_0x5708a2){_0x400a0d=_0x5708a2;return getTicket(_0x9ab06d,_0x4b885f,_0x400a0d,_0x3fd4f8,_0x569e8c,_0x3fd4f8[_0x3ebe('0x4f')],_0x359b40);})[_0x3ebe('0x19')](function(_0x31edc2){_0x2ed462=_0x31edc2;logger[_0x3ebe('0x1b')]('['+_0x569e8c[_0x3ebe('0x63')][_0x3ebe('0x64')]()+_0x3ebe('0x67'),_0x2ed462['id']);logger['info']('['+_0x569e8c[_0x3ebe('0x63')][_0x3ebe('0x64')]()+']\x20Integration\x20account\x20type\x20%s.',_0x9ab06d[_0x3ebe('0x34')]);})['catch'](function(_0xeb7a1c){logger[_0x3ebe('0x57')]('['+_0x569e8c['lastevent'][_0x3ebe('0x64')]()+']',JSON[_0x3ebe('0x58')](_0xeb7a1c));});}; \ No newline at end of file +var _0x6a44=['outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','stringify','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','ticketType','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','create','isNil','validateEmail','sobject','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','lead','resolve','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','Variable','name','toLowerCase','securityToken','Connection','remoteUri','https://login.salesforce.com','login','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum'];(function(_0x56b91b,_0xf2607d){var _0x47b4be=function(_0x3aa78b){while(--_0x3aa78b){_0x56b91b['push'](_0x56b91b['shift']());}};_0x47b4be(++_0xf2607d);}(_0x6a44,0x6f));var _0x46a4=function(_0x267d96,_0x1ba62a){_0x267d96=_0x267d96-0x0;var _0x3af64a=_0x6a44[_0x267d96];return _0x3af64a;};'use strict';var _=require(_0x46a4('0x0'));var rp=require('request-promise');var moment=require(_0x46a4('0x1'));var BPromise=require(_0x46a4('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x46a4('0x3'));var config=require(_0x46a4('0x4'));var logger=require(_0x46a4('0x5'))(_0x46a4('0x6'));config[_0x46a4('0x7')]=_[_0x46a4('0x8')](config[_0x46a4('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46a4('0x7')]));function emit(_0x964e80,_0x5567c1,_0x43baea){io['to'](_0x964e80)['emit'](_0x5567c1,_0x43baea);}function getTicket(_0x235dc0,_0x1893b2,_0x39ec1e,_0x590297,_0x219b35,_0x4edba4,_0x34a1a7,_0x12fc70){var _0x5ba35a={};if(_0x590297[_0x46a4('0x9')]==='Task'){_0x5ba35a=Object[_0x46a4('0xa')]({},{'OwnerId':_0x1893b2['id'],'ActivityDate':moment[_0x46a4('0xb')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x46a4('0xc')](_0x590297[_0x46a4('0xd')],_0x219b35,'\x20'),'Description':intUtil[_0x46a4('0xc')](_0x590297[_0x46a4('0xe')],_0x219b35,'\x0a')},getCustomFields(_0x4edba4,_0x219b35));if(_0x39ec1e){_0x5ba35a[_0x46a4('0xf')]=_0x39ec1e['id'];}}else if(_0x590297[_0x46a4('0x9')]===_0x46a4('0x10')){_0x5ba35a=Object['assign']({},{'OwnerId':_0x1893b2['id'],'Subject':intUtil[_0x46a4('0xc')](_0x590297[_0x46a4('0xd')],_0x219b35,'\x20'),'Description':intUtil['getString'](_0x590297['Descriptions'],_0x219b35,'\x0a')},getCustomFields(_0x4edba4,_0x219b35));if(_0x39ec1e){_0x5ba35a[_0x46a4('0x11')]=_0x39ec1e['id'];}}return _0x34a1a7['sobject'](_0x590297[_0x46a4('0x9')])[_0x46a4('0x12')](_0x5ba35a);}function getUser(_0x1e011d,_0x51483b,_0x4fea24){if(!_[_0x46a4('0x13')](_0x51483b)&&intUtil[_0x46a4('0x14')](_0x51483b)){var _0xb30424={'Email':_0x51483b};var _0x44a47c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4fea24[_0x46a4('0x15')]('User')[_0x46a4('0x16')](_0xb30424,_0x44a47c)[_0x46a4('0x17')]()[_0x46a4('0x18')](function(_0x1c2140){if(_0x1c2140[_0x46a4('0x19')]){var _0x10db6f=_['find'](_0x1c2140,function(_0x494637){return _0x494637[_0x46a4('0x1a')]===_0x51483b;});if(_0x10db6f){logger[_0x46a4('0x1b')](_0x46a4('0x1c'),_0x51483b);return BPromise['resolve']({'id':_0x10db6f['Id'],'name':_0x10db6f['Name']});}}else{logger['info'](_0x46a4('0x1d'),_0x51483b);return _0x4fea24[_0x46a4('0x1e')]()['then'](function(_0x113265){return BPromise['resolve']({'id':_0x113265[_0x46a4('0x1f')],'name':_0x113265[_0x46a4('0x20')]});});}});}else{logger[_0x46a4('0x1b')](_0x46a4('0x1d'),_0x51483b);return _0x4fea24[_0x46a4('0x1e')]()[_0x46a4('0x18')](function(_0xa74ea5){return BPromise['resolve']({'id':_0xa74ea5[_0x46a4('0x1f')],'name':_0xa74ea5[_0x46a4('0x20')]});});}}function getEndUser(_0x469850,_0x1cbbb7,_0x4caf90,_0x2d1fb4,_0x89d178){var _0x3cd633={'Phone':_0x2d1fb4};var _0x1686c9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x1cbbb7[_0x46a4('0x9')]===_0x46a4('0x21')){logger[_0x46a4('0x1b')](_0x46a4('0x22'),_0x2d1fb4,_0x1cbbb7[_0x46a4('0x23')]);switch(_0x1cbbb7[_0x46a4('0x23')]){case'contact_lead':return _0x89d178['sobject'](_0x46a4('0x24'))[_0x46a4('0x16')](_0x3cd633,_0x1686c9)['execute']()[_0x46a4('0x18')](function(_0xc0c09){if(_0xc0c09&&_0xc0c09[_0x46a4('0x19')]){return _0xc0c09;}else{return _0x89d178['sobject'](_0x46a4('0x25'))[_0x46a4('0x16')](_0x3cd633,_0x1686c9);}});case _0x46a4('0x26'):return _0x89d178['sobject'](_0x46a4('0x24'))[_0x46a4('0x16')](_0x3cd633,_0x1686c9)[_0x46a4('0x17')]();case _0x46a4('0x27'):return _0x89d178[_0x46a4('0x15')](_0x46a4('0x25'))[_0x46a4('0x16')](_0x3cd633,_0x1686c9);default:return null;}}else if(_0x1cbbb7['ticketType']===_0x46a4('0x10')){logger[_0x46a4('0x1b')](_0x46a4('0x22'),_0x2d1fb4,'contact');return _0x89d178[_0x46a4('0x15')](_0x46a4('0x24'))['find'](_0x3cd633,_0x1686c9)[_0x46a4('0x17')]();}})[_0x46a4('0x18')](function(_0x35d567){if(_0x35d567&&_0x35d567[_0x46a4('0x19')]){var _0x2c4c21=_['find'](_0x35d567,function(_0x404d0d){return _0x404d0d['Phone']===_0x2d1fb4;});if(_0x2c4c21){return BPromise[_0x46a4('0x28')]({'id':_0x2c4c21['Id'],'name':_0x2c4c21['Name'],'phone':_0x2c4c21[_0x46a4('0x29')]});}}})[_0x46a4('0x18')](function(_0x46c2f7){if(_0x46c2f7){logger[_0x46a4('0x1b')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x2d1fb4);return BPromise[_0x46a4('0x28')](_0x46c2f7);}else{logger['info'](_0x46a4('0x2a'),_0x2d1fb4);var _0x50e81e={'LastName':_0x4caf90!==''?_0x4caf90:util[_0x46a4('0x2b')](_0x46a4('0x2c'),_0x2d1fb4),'Phone':_0x2d1fb4};if(_0x1cbbb7[_0x46a4('0x2d')]){if(_0x1cbbb7['moduleCreate']===_0x46a4('0x26')){logger['info'](_0x46a4('0x2e'),_0x2d1fb4,_0x1cbbb7[_0x46a4('0x2d')]);}else if(_0x1cbbb7[_0x46a4('0x2d')]===_0x46a4('0x27')&&_0x1cbbb7['ticketType']===_0x46a4('0x21')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2d1fb4,_0x1cbbb7[_0x46a4('0x2d')]);_0x50e81e['Company']=_0x46a4('0x2f');}else{return null;}}return _0x89d178[_0x46a4('0x15')](_[_0x46a4('0x30')](_0x1cbbb7['moduleCreate']))[_0x46a4('0x12')](_0x50e81e);}});}function getCustomFields(_0xdb04f8,_0x1ed190){var _0x1d8256={};if(_0xdb04f8[_0x46a4('0x19')]>0x0){_[_0x46a4('0x31')](_0xdb04f8,function(_0xd3eac1){if(_0xd3eac1[_0x46a4('0x32')]===_0x46a4('0x33')&&_0xd3eac1[_0x46a4('0x34')]){_0x1d8256[_0xd3eac1['idField']]=_0xd3eac1[_0x46a4('0x35')]['toString']();}else if(_0xd3eac1[_0x46a4('0x32')]===_0x46a4('0x36')&&_0xd3eac1[_0x46a4('0x37')]&&_0xd3eac1[_0x46a4('0x34')]){_0x1ed190[_0xd3eac1['variableName']]&&(_0x1d8256[_0xd3eac1[_0x46a4('0x34')]]=_0x1ed190[_0xd3eac1['variableName']][_0x46a4('0x38')]());}else if(_0xd3eac1['type']==='customVariable'&&_0xd3eac1[_0x46a4('0x39')]&&_0xd3eac1[_0x46a4('0x39')][_0x46a4('0x3a')]&&_0xd3eac1[_0x46a4('0x34')]){_0x1ed190[_0xd3eac1['Variable']['name'][_0x46a4('0x3b')]()]&&(_0x1d8256[_0xd3eac1[_0x46a4('0x34')]]=_0x1ed190[_0xd3eac1[_0x46a4('0x39')]['name'][_0x46a4('0x3b')]()][_0x46a4('0x38')]());}});}return _0x1d8256;}function getConnection(_0x29e0e6){var _0x4ecb7d=_0x29e0e6['password']['concat'](_0x29e0e6[_0x46a4('0x3c')]);var _0x4b44b3=new jsforce[(_0x46a4('0x3d'))]({'oauth2':{'loginUrl':_0x29e0e6[_0x46a4('0x3e')]||_0x46a4('0x3f'),'clientId':_0x29e0e6['clientId'],'clientSecret':_0x29e0e6['clientSecret']}});return _0x4b44b3[_0x46a4('0x40')](_0x29e0e6['username'],_0x4ecb7d)['then'](function(){logger[_0x46a4('0x1b')]('Connection\x20established.');return _0x4b44b3;});}exports[_0x46a4('0x41')]=function(_0x5aedc7,_0x2e9f27,_0x4456d6,_0x24abf4,_0x4fb5cc,_0x480d9a){var _0x43b55d,_0x5b0834,_0x5db39b,_0x313538;_0x480d9a[_0x46a4('0x42')]=intUtil[_0x46a4('0x43')](_0x480d9a[_0x46a4('0x42')]);_0x480d9a[_0x46a4('0x3e')]=intUtil['stripTrailingSlash'](_0x480d9a[_0x46a4('0x3e')]);if(_0x4fb5cc&&_0x4fb5cc['monitor_format']){logger[_0x46a4('0x1b')]('[QUEUE]',_0x46a4('0x44'));_0x2e9f27['recordingURL']=util['format'](_0x46a4('0x45'),_0x480d9a[_0x46a4('0x42')],_0x2e9f27[_0x46a4('0x46')],md5(_0x2e9f27['uniqueid']));}else{_0x2e9f27['recordingURL']='';}return getConnection(_0x480d9a)[_0x46a4('0x18')](function(_0x50442a){_0x313538=_0x50442a;return getUser(_0x480d9a,_0x24abf4[_0x46a4('0x47')],_0x313538);})['then'](function(_0x445f1d){_0x43b55d=_0x445f1d;return getEndUser(_0x480d9a,_0x4456d6,_0x2e9f27['calleridname'],_0x2e9f27[_0x46a4('0x48')],_0x313538);})['then'](function(_0x5e067b){_0x5b0834=_0x5e067b;return getTicket(_0x480d9a,_0x43b55d,_0x5b0834,_0x4456d6,_0x2e9f27,_0x4456d6[_0x46a4('0x49')],_0x313538,'queue');})['then'](function(_0xb91a6c){_0x5db39b=_0xb91a6c;logger[_0x46a4('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5db39b['id']);logger[_0x46a4('0x1b')](_0x46a4('0x4a'),_0x5db39b['id'],_0x24abf4[_0x46a4('0x3a')],_0x480d9a[_0x46a4('0x32')]);switch(_0x480d9a['type']){case _0x46a4('0x4b'):emit(util['format'](_0x46a4('0x4c'),_0x24abf4[_0x46a4('0x3a')]),_0x46a4('0x4d'),{'recordId':_0x5db39b['id']});break;case _0x46a4('0x4e'):emit(util[_0x46a4('0x2b')](_0x46a4('0x4c'),_0x24abf4[_0x46a4('0x3a')]),_0x46a4('0x4f'),{'uri':util[_0x46a4('0x2b')](_0x46a4('0x50'),_0x313538[_0x46a4('0x51')],_0x5db39b['id'])});break;default:logger[_0x46a4('0x52')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0xdeeac6){logger['error'](_0x46a4('0x53'),JSON['stringify'](_0xdeeac6));});};exports['outbound']=function(_0x5188e5,_0x5443ab,_0x46b12f,_0x40712c,_0x4633b8,_0x519b91,_0x2f1727){var _0x5d9e87,_0x34d394,_0x5bfb50,_0x53e523;_0x519b91[_0x46a4('0x42')]=intUtil['stripTrailingSlash'](_0x519b91[_0x46a4('0x42')]);_0x519b91[_0x46a4('0x3e')]=intUtil[_0x46a4('0x43')](_0x519b91['remoteUri']);if(_0x2f1727&&_0x2f1727[_0x46a4('0x54')]&&_0x2f1727[_0x46a4('0x54')]!==_0x46a4('0x55')){logger[_0x46a4('0x1b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5443ab[_0x46a4('0x56')]=util['format'](_0x46a4('0x45'),_0x519b91[_0x46a4('0x42')],_0x5443ab[_0x46a4('0x46')],md5(_0x5443ab[_0x46a4('0x46')]));}return getConnection(_0x519b91)[_0x46a4('0x18')](function(_0x1c9291){_0x53e523=_0x1c9291;return getUser(_0x519b91,_0x40712c[_0x46a4('0x47')],_0x53e523);})[_0x46a4('0x18')](function(_0x519d3b){_0x5d9e87=_0x519d3b;return getEndUser(_0x519b91,_0x46b12f,_0x5443ab[_0x46a4('0x57')],_0x5443ab[_0x46a4('0x58')],_0x53e523);})[_0x46a4('0x18')](function(_0x575002){_0x34d394=_0x575002;return getTicket(_0x519b91,_0x5d9e87,_0x34d394,_0x46b12f,_0x5443ab,_0x46b12f[_0x46a4('0x49')],_0x53e523,_0x46a4('0x59'));})[_0x46a4('0x18')](function(_0x4b733e){_0x5bfb50=_0x4b733e;logger[_0x46a4('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5bfb50['id']);logger['info'](_0x46a4('0x5a'),_0x5bfb50['id'],_0x40712c[_0x46a4('0x3a')],_0x519b91[_0x46a4('0x32')]);switch(_0x519b91['type']){case'integrationTab':emit(util[_0x46a4('0x2b')](_0x46a4('0x4c'),_0x40712c[_0x46a4('0x3a')]),'trigger:salesforce:display',{'recordId':_0x5bfb50['id']});break;case _0x46a4('0x4e'):emit(util['format'](_0x46a4('0x4c'),_0x40712c[_0x46a4('0x3a')]),_0x46a4('0x4f'),{'uri':util[_0x46a4('0x2b')](_0x46a4('0x50'),_0x53e523[_0x46a4('0x51')],_0x5bfb50['id'])});break;default:logger['error'](_0x46a4('0x5b'),_0x46a4('0x5c'));}})[_0x46a4('0x5d')](function(_0x388cfa){logger[_0x46a4('0x52')](_0x46a4('0x5b'),JSON[_0x46a4('0x5e')](_0x388cfa));});};exports['unmanaged']=function(_0x19f39c,_0x300ae9,_0x194d57,_0x58834d,_0x242c66,_0x4eeb90){var _0x145834,_0x9a561,_0x155ca5,_0x26e442;_0x4eeb90['serverUrl']=intUtil[_0x46a4('0x43')](_0x4eeb90[_0x46a4('0x42')]);_0x4eeb90[_0x46a4('0x3e')]=intUtil[_0x46a4('0x43')](_0x4eeb90[_0x46a4('0x3e')]);if(_0x242c66&&_0x242c66[_0x46a4('0x5f')]){logger[_0x46a4('0x1b')]('['+_0x300ae9[_0x46a4('0x60')][_0x46a4('0x61')]()+']',_0x46a4('0x44'));_0x300ae9[_0x46a4('0x56')]=util[_0x46a4('0x2b')](_0x46a4('0x45'),_0x4eeb90['serverUrl'],_0x300ae9[_0x46a4('0x46')],md5(_0x300ae9[_0x46a4('0x46')]));}else{_0x300ae9[_0x46a4('0x56')]='';}return getConnection(_0x4eeb90)[_0x46a4('0x18')](function(_0x704e43){_0x26e442=_0x704e43;if(!_[_0x46a4('0x13')](_0x58834d)){return getUser(_0x4eeb90,_0x58834d['name'],_0x26e442);}else{return getUser(_0x4eeb90,null,_0x26e442);}})['then'](function(_0x5681c2){_0x145834=_0x5681c2;return getEndUser(_0x4eeb90,_0x194d57,_0x300ae9['calleridname'],_0x300ae9[_0x46a4('0x48')],_0x26e442);})[_0x46a4('0x18')](function(_0x187304){_0x9a561=_0x187304;return getTicket(_0x4eeb90,_0x145834,_0x9a561,_0x194d57,_0x300ae9,_0x194d57['Fields'],_0x26e442);})[_0x46a4('0x18')](function(_0xbc0013){_0x155ca5=_0xbc0013;logger['info']('['+_0x300ae9['lastevent']['toUpperCase']()+_0x46a4('0x62'),_0x155ca5['id']);logger[_0x46a4('0x1b')]('['+_0x300ae9[_0x46a4('0x60')][_0x46a4('0x61')]()+_0x46a4('0x63'),_0x4eeb90[_0x46a4('0x32')]);})[_0x46a4('0x5d')](function(_0x45006b){logger[_0x46a4('0x52')]('['+_0x300ae9[_0x46a4('0x60')][_0x46a4('0x61')]()+']',JSON[_0x46a4('0x5e')](_0x45006b));});}; \ 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 8df1605..b0c64d1 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 _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','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','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x18dedd,_0x4cb9e5){var _0x35b7e1=function(_0x429eb0){while(--_0x429eb0){_0x18dedd['push'](_0x18dedd['shift']());}};_0x35b7e1(++_0x4cb9e5);}(_0x7a54,0x106));var _0x47a5=function(_0xec03d0,_0x2cadfe){_0xec03d0=_0xec03d0-0x0;var _0x2a0587=_0x7a54[_0xec03d0];return _0x2a0587;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x434138,_0x74656){var _0x40ebdd=function(_0x2b8c41){while(--_0x2b8c41){_0x434138['push'](_0x434138['shift']());}};_0x40ebdd(++_0x74656);}(_0x326f,0xd1));var _0xf326=function(_0x2d66b5,_0x465768){_0x2d66b5=_0x2d66b5-0x0;var _0x6fda50=_0x326f[_0x2d66b5];return _0x6fda50;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'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 bb3ccec..fbcf860 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 _0xe4de=['user:%s','catch','outbound','uri','%s/service/v4_1/rest.php','destcalleridname','Outbound','[OUTBOUND]','trigger:browser:url','error','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_name','length','forEach','variableName','push','idField','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','customField','nameField','toLowerCase','content','string','custom_fields','variable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','remoteUri','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x1cde58,_0x2a8f9c){var _0x364f42=function(_0x4ebdb4){while(--_0x4ebdb4){_0x1cde58['push'](_0x1cde58['shift']());}};_0x364f42(++_0x2a8f9c);}(_0xe4de,0x16e));var _0xee4d=function(_0x254273,_0x3836fd){_0x254273=_0x254273-0x0;var _0x2f93c0=_0xe4de[_0x254273];return _0x2f93c0;};'use strict';var _=require(_0xee4d('0x0'));var rp=require(_0xee4d('0x1'));var BPromise=require(_0xee4d('0x2'));var md5=require(_0xee4d('0x3'));var util=require('util');var Redis=require(_0xee4d('0x4'));var intUtil=require(_0xee4d('0x5'));var config=require(_0xee4d('0x6'));var logger=require(_0xee4d('0x7'))(_0xee4d('0x8'));config[_0xee4d('0x9')]=_['defaults'](config[_0xee4d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xee4d('0xa'))(new Redis(config[_0xee4d('0x9')]));var def={'method':_0xee4d('0xb'),'json':!![]};function emit(_0xf2b5e5,_0x3dff3a,_0x51c990){io['to'](_0xf2b5e5)['emit'](_0x3dff3a,_0x51c990);}function getTicket(_0x2bd93c,_0x1f6cb9,_0x175e36,_0x1db967,_0x10dbab,_0x1a88b1,_0x50f1a9,_0x1ca1aa){logger['info'](_0xee4d('0xc'));var _0x4e4766=new Date();var _0x492870=[{'name':_0xee4d('0xd'),'value':intUtil[_0xee4d('0xe')](_0x1db967[_0xee4d('0xf')],_0x10dbab,'\x20')},{'name':_0xee4d('0x10'),'value':_0x1f6cb9['id']},{'name':_0xee4d('0x11'),'value':_0x1f6cb9['id']},{'name':_0xee4d('0x12'),'value':intUtil[_0xee4d('0xe')](_0x1db967[_0xee4d('0x13')],_0x10dbab,'\x0a')},{'name':_0xee4d('0x14'),'value':_0x4e4766[_0xee4d('0x15')]()[_0xee4d('0x16')](0x0,0x13)[_0xee4d('0x17')]('T','\x20')},{'name':_0xee4d('0x18'),'value':'0'},{'name':_0xee4d('0x19'),'value':'15'},{'name':'parent_id','value':_0x175e36['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xee4d('0x1a'),'value':_0x175e36[_0xee4d('0xd')]},{'name':'direction','value':_0x1ca1aa}];if(_0x1a88b1[_0xee4d('0x1b')]){_[_0xee4d('0x1c')](_0x1a88b1,function(_0x323830){if(_0x10dbab[_0x323830[_0xee4d('0x1d')]]){_0x492870[_0xee4d('0x1e')]({'name':_0x323830[_0xee4d('0x1f')],'value':_0x10dbab[_0x323830['variableName']]});}});}return request({'form':{'method':_0xee4d('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xee4d('0x21')]({'session':_0x50f1a9['id'],'module_name':_0xee4d('0x22'),'name_value_list':_0x492870})}});}function getAuth(_0x30b382){return util[_0xee4d('0x23')](_0xee4d('0x24'),new Buffer(_0x30b382[_0xee4d('0x25')]+':X')[_0xee4d('0x26')](_0xee4d('0x27')));}function getServerInfo(_0x207d64){return request({'form':{'method':_0xee4d('0x28'),'input_type':_0xee4d('0x29'),'response_type':_0xee4d('0x29'),'rest_data':JSON[_0xee4d('0x21')]({'session':_0x207d64['id']})}});}function getUser(_0x29d448,_0x44a151,_0x18f6a3){if(!_[_0xee4d('0x2a')](_0x44a151)){logger[_0xee4d('0x2b')](_0xee4d('0x2c'),_0x44a151);return request({'form':{'method':_0xee4d('0x2d'),'input_type':_0xee4d('0x29'),'response_type':_0xee4d('0x29'),'rest_data':JSON[_0xee4d('0x21')]({'session':_0x18f6a3['id'],'module_name':_0xee4d('0x2e'),'query':util[_0xee4d('0x23')](_0xee4d('0x2f'),_0x44a151),'order_by':'','offset':'0','select_fields':['id',_0xee4d('0xd'),_0xee4d('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee4d('0x31')](function(_0x2045c5){if(_0x2045c5[_0xee4d('0x32')][_0xee4d('0x1b')]){var _0x4e6e1c=_[_0xee4d('0x33')](_0x2045c5[_0xee4d('0x32')],function(_0x56b371){return _0x56b371[_0xee4d('0x34')]['user_name'][_0xee4d('0x35')]===_0x44a151;});if(_0x4e6e1c){logger[_0xee4d('0x2b')](_0xee4d('0x36'));return BPromise[_0xee4d('0x37')]({'id':_0x4e6e1c[_0xee4d('0x34')]['id']['value'],'name':_0x4e6e1c[_0xee4d('0x34')][_0xee4d('0xd')][_0xee4d('0x35')]});}}logger[_0xee4d('0x2b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x18f6a3[_0xee4d('0x34')]['user_id'][_0xee4d('0x35')],'name':_0x18f6a3[_0xee4d('0x34')][_0xee4d('0x30')][_0xee4d('0x35')]});});}else{logger[_0xee4d('0x2b')](_0xee4d('0x38'));return BPromise['resolve']({'id':_0x18f6a3[_0xee4d('0x34')][_0xee4d('0x39')]['value'],'name':_0x18f6a3[_0xee4d('0x34')][_0xee4d('0x30')][_0xee4d('0x35')]});}}function getEndUser(_0x1f64e0,_0x23d2e5,_0x12fb01,_0x54e378){logger['info'](_0xee4d('0x3a'),_0x12fb01);return request({'form':{'method':_0xee4d('0x2d'),'input_type':_0xee4d('0x29'),'response_type':_0xee4d('0x29'),'rest_data':JSON[_0xee4d('0x21')]({'session':_0x54e378['id'],'module_name':'Contacts','query':util['format'](_0xee4d('0x3b'),_0x12fb01),'order_by':'','offset':'0','select_fields':['id','name',_0xee4d('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee4d('0x31')](function(_0xe5fc4a){if(_0xe5fc4a[_0xee4d('0x32')]['length']){var _0x4d7a88=_[_0xee4d('0x33')](_0xe5fc4a[_0xee4d('0x32')],function(_0x49adec){return _0x49adec[_0xee4d('0x34')][_0xee4d('0x3c')][_0xee4d('0x35')]===_0x12fb01;});if(_0x4d7a88){logger[_0xee4d('0x2b')]('Enduser\x20found!');return BPromise[_0xee4d('0x37')]({'id':_0x4d7a88[_0xee4d('0x34')]['id']['value'],'name':_0x4d7a88['name_value_list'][_0xee4d('0xd')]['value'],'phone':_0x4d7a88[_0xee4d('0x34')]['phone_home'][_0xee4d('0x35')]});}}else{logger[_0xee4d('0x2b')](_0xee4d('0x3d'));return request({'form':{'method':_0xee4d('0x20'),'input_type':_0xee4d('0x29'),'response_type':_0xee4d('0x29'),'rest_data':JSON[_0xee4d('0x21')]({'session':_0x54e378['id'],'module_name':_0xee4d('0x3e'),'name_value_list':[{'name':'first_name','value':_0x23d2e5!==''?_0x23d2e5:util['format'](_0xee4d('0x3f'),_0x12fb01)},{'name':_0xee4d('0x3c'),'value':_0x12fb01}]})}})[_0xee4d('0x31')](function(_0x140be7){logger[_0xee4d('0x2b')](_0xee4d('0x40'));return BPromise['resolve']({'id':_0x140be7['id'],'name':_0x140be7[_0xee4d('0x32')]['first_name'][_0xee4d('0x35')],'phone':_0x140be7[_0xee4d('0x32')][_0xee4d('0x3c')][_0xee4d('0x35')]});});}});}function request(_0x5a3e7b){logger[_0xee4d('0x41')](_0xee4d('0x42'),JSON[_0xee4d('0x21')](_0x5a3e7b));return rp(_['merge'](def,_0x5a3e7b));}function getTags(_0x40cb84,_0x19d9b3){var _0x1bcfa9=[];if(_0x40cb84&&_0x40cb84[_0xee4d('0x1b')]>0x0){_0x1bcfa9=_[_0xee4d('0x43')](_0x40cb84,_0x19d9b3);}return _0x1bcfa9;}function getCustomFields(_0x201db1,_0x2cef89){var _0x664191=[];var _0x53fb8c={'custom_fields':[]};if(_0x201db1[_0xee4d('0x1b')]>0x0){_[_0xee4d('0x1c')](_0x201db1,function(_0x73cf9){if(_0x73cf9[_0xee4d('0x44')]==='string'&&_0x73cf9['nameField']&&!_0x73cf9[_0xee4d('0x45')]){_0x53fb8c[_0x73cf9[_0xee4d('0x46')][_0xee4d('0x47')]()]=_0x73cf9[_0xee4d('0x48')][_0xee4d('0x26')]();}else if(_0x73cf9[_0xee4d('0x44')]===_0xee4d('0x49')&&_0x73cf9[_0xee4d('0x1f')]&&_0x73cf9[_0xee4d('0x45')]){_0x53fb8c[_0xee4d('0x4a')][_0xee4d('0x1e')]({'id':_0x73cf9[_0xee4d('0x1f')],'value':_0x73cf9['content']['toString']()});}else if(_0x73cf9['type']===_0xee4d('0x4b')&&_0x73cf9[_0xee4d('0x1d')]&&_0x73cf9[_0xee4d('0x1f')]&&_0x73cf9['customField']){_0x2cef89[_0x73cf9[_0xee4d('0x1d')]]&&_0x53fb8c['custom_fields'][_0xee4d('0x1e')]({'id':_0x73cf9[_0xee4d('0x1f')],'value':_0x2cef89[_0x73cf9[_0xee4d('0x1d')]]['toString']()});}else if(_0x73cf9[_0xee4d('0x44')]==='customVariable'&&_0x73cf9[_0xee4d('0x4c')]&&_0x73cf9[_0xee4d('0x4c')]['name']&&_0x73cf9[_0xee4d('0x1f')]&&_0x73cf9[_0xee4d('0x45')]){_0x2cef89[_0x73cf9['Variable']['name'][_0xee4d('0x47')]()]&&_0x53fb8c['custom_fields'][_0xee4d('0x1e')]({'id':_0x73cf9[_0xee4d('0x1f')],'value':_0x2cef89[_0x73cf9[_0xee4d('0x4c')][_0xee4d('0xd')][_0xee4d('0x47')]()][_0xee4d('0x26')]()});}});}return _0x53fb8c;}function getConnection(_0x19432d){return request({'method':_0xee4d('0xb'),'form':{'method':_0xee4d('0x4d'),'input_type':_0xee4d('0x29'),'response_type':_0xee4d('0x29'),'rest_data':JSON[_0xee4d('0x21')]({'user_auth':{'user_name':_0x19432d[_0xee4d('0x4e')],'password':_0x19432d['password'],'encryption':'PLAIN'},'application':_0xee4d('0x4f')})}})[_0xee4d('0x31')](function(_0x559a68){var _0x528dfe=_0x559a68;if(_0x528dfe['id']){def[_0xee4d('0x50')]=_0x528dfe['id'];return BPromise['resolve'](_0x528dfe);}else{throw new Error(util[_0xee4d('0x23')](_0xee4d('0x51'),_0x19432d['id']));}});}function setRelationship(_0xae37e0,_0x3ee3ad,_0x50f96d,_0x3ec2a6){return request({'form':{'method':_0xee4d('0x52'),'input_type':_0xee4d('0x29'),'response_type':_0xee4d('0x29'),'rest_data':JSON['stringify']({'session':_0xae37e0['id'],'module_name':_0xee4d('0x22'),'module_id':_0x50f96d['id'],'link_field_name':_0x3ec2a6,'related_ids':[_0x3ee3ad['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5e9bcd,_0x14a0f0,_0x562d00,_0x5d4f5e,_0x27f4c0,_0x38ed48){var _0x589142,_0x6f46f0,_0x48cffb,_0x426365;_0x38ed48['remoteUri']=intUtil[_0xee4d('0x53')](_0x38ed48[_0xee4d('0x54')]);_0x38ed48[_0xee4d('0x55')]=intUtil[_0xee4d('0x53')](_0x38ed48[_0xee4d('0x55')]);def['uri']=util[_0xee4d('0x23')]('%s/service/v4_1/rest.php',_0x38ed48[_0xee4d('0x54')]);if(_0x27f4c0&&_0x27f4c0['monitor_format']){logger['info']('[QUEUE]',_0xee4d('0x56'));_0x14a0f0[_0xee4d('0x57')]=util[_0xee4d('0x23')](_0xee4d('0x58'),_0x38ed48[_0xee4d('0x55')],_0x14a0f0[_0xee4d('0x59')],md5(_0x14a0f0[_0xee4d('0x59')]));}else{_0x14a0f0[_0xee4d('0x57')]='';}return getConnection(_0x38ed48)[_0xee4d('0x31')](function(_0x1c63ea){_0x426365=_0x1c63ea;return getUser(_0x38ed48,_0x5d4f5e[_0xee4d('0xd')],_0x426365);})['then'](function(_0x4b1295){_0x589142=_0x4b1295;logger['info'](_0xee4d('0x5a'),_0x589142['id']);return getEndUser(_0x38ed48,_0x14a0f0[_0xee4d('0x5b')],_0x14a0f0[_0xee4d('0x5c')],_0x426365);})[_0xee4d('0x31')](function(_0x25feaf){_0x6f46f0=_0x25feaf;logger['info'](_0xee4d('0x5d'),_0x6f46f0['id']);return getTicket(_0x38ed48,_0x589142,_0x6f46f0,_0x562d00,_0x14a0f0,_0x562d00[_0xee4d('0x5e')],_0x426365,_0xee4d('0x5f'));})[_0xee4d('0x31')](function(_0x327f5f){_0x48cffb=_0x327f5f;logger[_0xee4d('0x2b')](_0xee4d('0x60'));logger[_0xee4d('0x2b')](_0xee4d('0x61'),_0x48cffb['id']);return setRelationship(_0x426365,_0x589142,_0x48cffb,_0xee4d('0x62'));})['then'](function(){return setRelationship(_0x426365,_0x6f46f0,_0x48cffb,_0xee4d('0x63'));})[_0xee4d('0x31')](function(){return getServerInfo(_0x426365);})['then'](function(_0x357584){var _0x1e20be=parseInt(_0x357584[_0xee4d('0x64')][_0xee4d('0x65')](0x0));var _0x2bec4e=util[_0xee4d('0x23')](_0xee4d('0x66'),_0x38ed48[_0xee4d('0x54')],_0x48cffb['id']);if(_0x1e20be>0x6){_0x2bec4e=util['format'](_0xee4d('0x67'),_0x38ed48[_0xee4d('0x54')],_0x48cffb['id']);}logger[_0xee4d('0x2b')](_0xee4d('0x68'),_0xee4d('0x69'));emit(util[_0xee4d('0x23')](_0xee4d('0x6a'),_0x5d4f5e['name']),'trigger:browser:url',{'uri':_0x2bec4e});})[_0xee4d('0x6b')](function(_0x206ee5){logger['error'](_0xee4d('0x68'),JSON[_0xee4d('0x21')](_0x206ee5));});};exports[_0xee4d('0x6c')]=function(_0x2450ab,_0x16d3a9,_0x20f3bd,_0x4d788d,_0x2a9369,_0x7a8ae8,_0x57e960){var _0x5a1117,_0x27e517,_0x10035b,_0xe96072;_0x7a8ae8['remoteUri']=intUtil[_0xee4d('0x53')](_0x7a8ae8[_0xee4d('0x54')]);_0x7a8ae8[_0xee4d('0x55')]=intUtil[_0xee4d('0x53')](_0x7a8ae8[_0xee4d('0x55')]);def[_0xee4d('0x6d')]=util[_0xee4d('0x23')](_0xee4d('0x6e'),_0x7a8ae8[_0xee4d('0x54')]);if(_0x57e960&&_0x57e960['recordingFormat']&&_0x57e960['recordingFormat']!=='none'){logger[_0xee4d('0x2b')]('[OUTBOUND]',_0xee4d('0x56'));_0x16d3a9['recordingURL']=util['format'](_0xee4d('0x58'),_0x7a8ae8[_0xee4d('0x55')],_0x16d3a9['uniqueid'],md5(_0x16d3a9[_0xee4d('0x59')]));}return getConnection(_0x7a8ae8)['then'](function(_0x38dd63){_0xe96072=_0x38dd63;return getUser(_0x7a8ae8,_0x4d788d[_0xee4d('0xd')],_0xe96072);})[_0xee4d('0x31')](function(_0x541659){_0x5a1117=_0x541659;logger[_0xee4d('0x2b')]('The\x20User\x20ID\x20is:',_0x5a1117['id']);return getEndUser(_0x7a8ae8,_0x16d3a9[_0xee4d('0x6f')],_0x16d3a9['destcalleridnum'],_0xe96072);})[_0xee4d('0x31')](function(_0x13656a){_0x27e517=_0x13656a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x27e517['id']);return getTicket(_0x7a8ae8,_0x5a1117,_0x27e517,_0x20f3bd,_0x16d3a9,_0x20f3bd['Fields'],_0xe96072,_0xee4d('0x70'));})[_0xee4d('0x31')](function(_0x51d741){_0x10035b=_0x51d741;logger[_0xee4d('0x2b')](_0xee4d('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x10035b['id']);return setRelationship(_0xe96072,_0x5a1117,_0x10035b,_0xee4d('0x62'));})[_0xee4d('0x31')](function(){return setRelationship(_0xe96072,_0x27e517,_0x10035b,_0xee4d('0x63'));})[_0xee4d('0x31')](function(){return getServerInfo(_0xe96072);})[_0xee4d('0x31')](function(_0x18192b){var _0x34d49f=parseInt(_0x18192b[_0xee4d('0x64')][_0xee4d('0x65')](0x0));var _0x138c59=util[_0xee4d('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x7a8ae8['remoteUri'],_0x10035b['id']);if(_0x34d49f>0x6){_0x138c59=util[_0xee4d('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x7a8ae8[_0xee4d('0x54')],_0x10035b['id']);}logger[_0xee4d('0x2b')](_0xee4d('0x71'),_0xee4d('0x69'));emit(util['format'](_0xee4d('0x6a'),_0x4d788d[_0xee4d('0xd')]),_0xee4d('0x72'),{'uri':_0x138c59});})[_0xee4d('0x6b')](function(_0x399653){logger[_0xee4d('0x73')](_0xee4d('0x71'),JSON[_0xee4d('0x21')](_0x399653));});};exports['unmanaged']=function(_0x254ba7,_0x77eb61,_0x3a964c,_0x4385ee,_0x330813,_0x8fdbcf){var _0x427c7d,_0x4dc789,_0x5445b3,_0x21ccd2;_0x8fdbcf['remoteUri']=intUtil[_0xee4d('0x53')](_0x8fdbcf[_0xee4d('0x54')]);_0x8fdbcf[_0xee4d('0x55')]=intUtil[_0xee4d('0x53')](_0x8fdbcf[_0xee4d('0x55')]);def[_0xee4d('0x6d')]=util[_0xee4d('0x23')](_0xee4d('0x6e'),_0x8fdbcf['remoteUri']);if(_0x330813&&_0x330813['monitor_format']){logger[_0xee4d('0x2b')]('['+_0x77eb61[_0xee4d('0x74')][_0xee4d('0x75')]()+']',_0xee4d('0x56'));_0x77eb61[_0xee4d('0x57')]=util['format'](_0xee4d('0x58'),_0x8fdbcf[_0xee4d('0x55')],_0x77eb61[_0xee4d('0x59')],md5(_0x77eb61[_0xee4d('0x59')]));}else{_0x77eb61[_0xee4d('0x57')]='';}return getConnection(_0x8fdbcf)[_0xee4d('0x31')](function(_0x48a39b){_0x21ccd2=_0x48a39b;if(!_[_0xee4d('0x2a')](_0x4385ee)){return getUser(_0x8fdbcf,_0x4385ee['name'],_0x21ccd2);}else{return getUser(_0x8fdbcf,null,_0x21ccd2);}})[_0xee4d('0x31')](function(_0x4e49de){_0x427c7d=_0x4e49de;logger[_0xee4d('0x2b')](_0xee4d('0x5a'),_0x427c7d['id']);return getEndUser(_0x8fdbcf,_0x77eb61[_0xee4d('0x5b')],_0x77eb61['calleridnum'],_0x21ccd2);})[_0xee4d('0x31')](function(_0xda8c27){_0x4dc789=_0xda8c27;logger[_0xee4d('0x2b')](_0xee4d('0x5d'),_0x4dc789['id']);return getTicket(_0x8fdbcf,_0x427c7d,_0x4dc789,_0x3a964c,_0x77eb61,_0x3a964c[_0xee4d('0x5e')],_0x21ccd2,_0xee4d('0x5f'));})[_0xee4d('0x31')](function(_0x32883a){_0x5445b3=_0x32883a;logger[_0xee4d('0x2b')](_0xee4d('0x60'));logger['info'](_0xee4d('0x61'),_0x5445b3['id']);return setRelationship(_0x21ccd2,_0x427c7d,_0x5445b3,_0xee4d('0x62'));})[_0xee4d('0x31')](function(){return setRelationship(_0x21ccd2,_0x4dc789,_0x5445b3,_0xee4d('0x63'));})[_0xee4d('0x31')](function(){return getServerInfo(_0x21ccd2);})[_0xee4d('0x6b')](function(_0x14fadc){logger[_0xee4d('0x73')]('['+_0x77eb61[_0xee4d('0x74')][_0xee4d('0x75')]()+']',JSON['stringify'](_0x14fadc));});}; \ No newline at end of file +var _0x9a8f=['bluebird','md5','util','ioredis','./util','redis','defaults','localhost','POST','emit','Subjects','created_by','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','variableName','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','string','nameField','customField','toLowerCase','content','type','custom_fields','idField','push','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','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','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','calleridnum','request-promise'];(function(_0x1b7f95,_0x4bdec0){var _0x2b5559=function(_0x4c8446){while(--_0x4c8446){_0x1b7f95['push'](_0x1b7f95['shift']());}};_0x2b5559(++_0x4bdec0);}(_0x9a8f,0x1df));var _0xf9a8=function(_0x2767b7,_0x29428a){_0x2767b7=_0x2767b7-0x0;var _0x273c84=_0x9a8f[_0x2767b7];return _0x273c84;};'use strict';var _=require('lodash');var rp=require(_0xf9a8('0x0'));var BPromise=require(_0xf9a8('0x1'));var md5=require(_0xf9a8('0x2'));var util=require(_0xf9a8('0x3'));var Redis=require(_0xf9a8('0x4'));var intUtil=require(_0xf9a8('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0xf9a8('0x6')]=_[_0xf9a8('0x7')](config[_0xf9a8('0x6')],{'host':_0xf9a8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf9a8('0x6')]));var def={'method':_0xf9a8('0x9'),'json':!![]};function emit(_0x48c2a5,_0x30ba3f,_0x4a8059){io['to'](_0x48c2a5)[_0xf9a8('0xa')](_0x30ba3f,_0x4a8059);}function getTicket(_0x5efb07,_0x3da92f,_0x2e5e06,_0x52a92e,_0x1d77ed,_0x107bd3,_0x1ffaa8,_0xb1b3a1){logger['info']('Creating\x20new\x20ticket...');var _0x4cac1f=new Date();var _0xe7aa5e=[{'name':'name','value':intUtil['getString'](_0x52a92e[_0xf9a8('0xb')],_0x1d77ed,'\x20')},{'name':'assigned_user_id','value':_0x3da92f['id']},{'name':_0xf9a8('0xc'),'value':_0x3da92f['id']},{'name':'description','value':intUtil['getString'](_0x52a92e[_0xf9a8('0xd')],_0x1d77ed,'\x0a')},{'name':_0xf9a8('0xe'),'value':_0x4cac1f[_0xf9a8('0xf')]()['slice'](0x0,0x13)[_0xf9a8('0x10')]('T','\x20')},{'name':_0xf9a8('0x11'),'value':'0'},{'name':_0xf9a8('0x12'),'value':'15'},{'name':_0xf9a8('0x13'),'value':_0x2e5e06['id']},{'name':_0xf9a8('0x14'),'value':_0xf9a8('0x15')},{'name':_0xf9a8('0x16'),'value':_0x2e5e06[_0xf9a8('0x17')]},{'name':_0xf9a8('0x18'),'value':_0xb1b3a1}];if(_0x107bd3['length']){_['forEach'](_0x107bd3,function(_0x5b7a92){if(_0x1d77ed[_0x5b7a92['variableName']]){_0xe7aa5e['push']({'name':_0x5b7a92['idField'],'value':_0x1d77ed[_0x5b7a92[_0xf9a8('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xf9a8('0x1a'),'rest_data':JSON[_0xf9a8('0x1b')]({'session':_0x1ffaa8['id'],'module_name':_0xf9a8('0x1c'),'name_value_list':_0xe7aa5e})}});}function getAuth(_0x52d111){return util[_0xf9a8('0x1d')](_0xf9a8('0x1e'),new Buffer(_0x52d111[_0xf9a8('0x1f')]+':X')[_0xf9a8('0x20')](_0xf9a8('0x21')));}function getServerInfo(_0x3b44fd){return request({'form':{'method':_0xf9a8('0x22'),'input_type':_0xf9a8('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf9a8('0x1b')]({'session':_0x3b44fd['id']})}});}function getUser(_0x5e42c1,_0x5679da,_0x2953ce){if(!_[_0xf9a8('0x23')](_0x5679da)){logger[_0xf9a8('0x24')](_0xf9a8('0x25'),_0x5679da);return request({'form':{'method':'get_entry_list','input_type':_0xf9a8('0x1a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2953ce['id'],'module_name':_0xf9a8('0x26'),'query':util['format'](_0xf9a8('0x27'),_0x5679da),'order_by':'','offset':'0','select_fields':['id','name',_0xf9a8('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1b115a){if(_0x1b115a[_0xf9a8('0x29')][_0xf9a8('0x2a')]){var _0x1260fb=_[_0xf9a8('0x2b')](_0x1b115a[_0xf9a8('0x29')],function(_0x11748a){return _0x11748a[_0xf9a8('0x2c')][_0xf9a8('0x28')][_0xf9a8('0x2d')]===_0x5679da;});if(_0x1260fb){logger[_0xf9a8('0x24')]('Agent\x20found!');return BPromise[_0xf9a8('0x2e')]({'id':_0x1260fb[_0xf9a8('0x2c')]['id']['value'],'name':_0x1260fb[_0xf9a8('0x2c')][_0xf9a8('0x17')][_0xf9a8('0x2d')]});}}logger[_0xf9a8('0x24')](_0xf9a8('0x2f'));return BPromise['resolve']({'id':_0x2953ce[_0xf9a8('0x2c')][_0xf9a8('0x30')]['value'],'name':_0x2953ce['name_value_list'][_0xf9a8('0x28')]['value']});});}else{logger[_0xf9a8('0x24')](_0xf9a8('0x31'));return BPromise[_0xf9a8('0x2e')]({'id':_0x2953ce[_0xf9a8('0x2c')][_0xf9a8('0x30')][_0xf9a8('0x2d')],'name':_0x2953ce['name_value_list'][_0xf9a8('0x28')][_0xf9a8('0x2d')]});}}function getEndUser(_0x48b513,_0xcc6f82,_0x1c40bd,_0x3f4645){logger['info'](_0xf9a8('0x32'),_0x1c40bd);return request({'form':{'method':_0xf9a8('0x33'),'input_type':_0xf9a8('0x1a'),'response_type':_0xf9a8('0x1a'),'rest_data':JSON[_0xf9a8('0x1b')]({'session':_0x3f4645['id'],'module_name':_0xf9a8('0x15'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x1c40bd),'order_by':'','offset':'0','select_fields':['id',_0xf9a8('0x17'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf9a8('0x34')](function(_0x1811a2){if(_0x1811a2['entry_list'][_0xf9a8('0x2a')]){var _0x41e229=_['find'](_0x1811a2[_0xf9a8('0x29')],function(_0x165f5f){return _0x165f5f[_0xf9a8('0x2c')][_0xf9a8('0x35')][_0xf9a8('0x2d')]===_0x1c40bd;});if(_0x41e229){logger[_0xf9a8('0x24')](_0xf9a8('0x36'));return BPromise[_0xf9a8('0x2e')]({'id':_0x41e229['name_value_list']['id'][_0xf9a8('0x2d')],'name':_0x41e229['name_value_list']['name']['value'],'phone':_0x41e229[_0xf9a8('0x2c')][_0xf9a8('0x35')]['value']});}}else{logger[_0xf9a8('0x24')](_0xf9a8('0x37'));return request({'form':{'method':_0xf9a8('0x38'),'input_type':_0xf9a8('0x1a'),'response_type':_0xf9a8('0x1a'),'rest_data':JSON[_0xf9a8('0x1b')]({'session':_0x3f4645['id'],'module_name':_0xf9a8('0x15'),'name_value_list':[{'name':_0xf9a8('0x39'),'value':_0xcc6f82!==_0xf9a8('0x3a')?_0xcc6f82:util[_0xf9a8('0x1d')](_0xf9a8('0x3b'),_0x1c40bd)},{'name':_0xf9a8('0x35'),'value':_0x1c40bd}]})}})[_0xf9a8('0x34')](function(_0x58eacd){logger[_0xf9a8('0x24')](_0xf9a8('0x3c'));return BPromise[_0xf9a8('0x2e')]({'id':_0x58eacd['id'],'name':_0x58eacd[_0xf9a8('0x29')][_0xf9a8('0x39')][_0xf9a8('0x2d')],'phone':_0x58eacd[_0xf9a8('0x29')]['phone_home'][_0xf9a8('0x2d')]});});}});}function request(_0x3718cd){logger[_0xf9a8('0x3d')](_0xf9a8('0x3e'),JSON[_0xf9a8('0x1b')](_0x3718cd));return rp(_['merge'](def,_0x3718cd));}function getTags(_0x135ca0,_0x19c1c9){var _0x180ce3=[];if(_0x135ca0&&_0x135ca0[_0xf9a8('0x2a')]>0x0){_0x180ce3=_[_0xf9a8('0x3f')](_0x135ca0,_0x19c1c9);}return _0x180ce3;}function getCustomFields(_0x5d874e,_0x28ba38){var _0x5d2335=[];var _0x50beb0={'custom_fields':[]};if(_0x5d874e[_0xf9a8('0x2a')]>0x0){_['forEach'](_0x5d874e,function(_0x2f5084){if(_0x2f5084['type']===_0xf9a8('0x40')&&_0x2f5084[_0xf9a8('0x41')]&&!_0x2f5084[_0xf9a8('0x42')]){_0x50beb0[_0x2f5084[_0xf9a8('0x41')][_0xf9a8('0x43')]()]=_0x2f5084[_0xf9a8('0x44')][_0xf9a8('0x20')]();}else if(_0x2f5084[_0xf9a8('0x45')]==='string'&&_0x2f5084['idField']&&_0x2f5084[_0xf9a8('0x42')]){_0x50beb0[_0xf9a8('0x46')]['push']({'id':_0x2f5084[_0xf9a8('0x47')],'value':_0x2f5084[_0xf9a8('0x44')][_0xf9a8('0x20')]()});}else if(_0x2f5084[_0xf9a8('0x45')]==='variable'&&_0x2f5084[_0xf9a8('0x19')]&&_0x2f5084['idField']&&_0x2f5084[_0xf9a8('0x42')]){_0x28ba38[_0x2f5084[_0xf9a8('0x19')]]&&_0x50beb0[_0xf9a8('0x46')][_0xf9a8('0x48')]({'id':_0x2f5084[_0xf9a8('0x47')],'value':_0x28ba38[_0x2f5084[_0xf9a8('0x19')]][_0xf9a8('0x20')]()});}else if(_0x2f5084[_0xf9a8('0x45')]===_0xf9a8('0x49')&&_0x2f5084[_0xf9a8('0x4a')]&&_0x2f5084[_0xf9a8('0x4a')][_0xf9a8('0x17')]&&_0x2f5084['idField']&&_0x2f5084[_0xf9a8('0x42')]){_0x28ba38[_0x2f5084[_0xf9a8('0x4a')][_0xf9a8('0x17')][_0xf9a8('0x43')]()]&&_0x50beb0[_0xf9a8('0x46')][_0xf9a8('0x48')]({'id':_0x2f5084['idField'],'value':_0x28ba38[_0x2f5084[_0xf9a8('0x4a')][_0xf9a8('0x17')][_0xf9a8('0x43')]()][_0xf9a8('0x20')]()});}});}return _0x50beb0;}function getConnection(_0x4b40df){return request({'method':_0xf9a8('0x9'),'form':{'method':_0xf9a8('0x4b'),'input_type':_0xf9a8('0x1a'),'response_type':_0xf9a8('0x1a'),'rest_data':JSON[_0xf9a8('0x1b')]({'user_auth':{'user_name':_0x4b40df['username'],'password':_0x4b40df[_0xf9a8('0x4c')],'encryption':_0xf9a8('0x4d')},'application':_0xf9a8('0x4e')})}})[_0xf9a8('0x34')](function(_0xe666b4){var _0x1cf1ee=_0xe666b4;if(_0x1cf1ee['id']){def[_0xf9a8('0x4f')]=_0x1cf1ee['id'];return BPromise[_0xf9a8('0x2e')](_0x1cf1ee);}else{throw new Error(util[_0xf9a8('0x1d')](_0xf9a8('0x50'),_0x4b40df['id']));}});}function setRelationship(_0x31ebf6,_0x478707,_0x5adab9,_0x5868cb){return request({'form':{'method':_0xf9a8('0x51'),'input_type':'JSON','response_type':_0xf9a8('0x1a'),'rest_data':JSON[_0xf9a8('0x1b')]({'session':_0x31ebf6['id'],'module_name':_0xf9a8('0x1c'),'module_id':_0x5adab9['id'],'link_field_name':_0x5868cb,'related_ids':[_0x478707['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf9a8('0x52')]=function(_0x53b0df,_0xd7cd34,_0x5cdc4b,_0x149545,_0x4fe5e2,_0x150a87){var _0x8acbea,_0x35fb84,_0x20b70e,_0x4c01db;_0x150a87['remoteUri']=intUtil[_0xf9a8('0x53')](_0x150a87[_0xf9a8('0x54')]);_0x150a87[_0xf9a8('0x55')]=intUtil[_0xf9a8('0x53')](_0x150a87[_0xf9a8('0x55')]);def[_0xf9a8('0x56')]=util[_0xf9a8('0x1d')](_0xf9a8('0x57'),_0x150a87['remoteUri']);if(_0x4fe5e2&&_0x4fe5e2[_0xf9a8('0x58')]){logger['info'](_0xf9a8('0x59'),_0xf9a8('0x5a'));_0xd7cd34[_0xf9a8('0x5b')]=util[_0xf9a8('0x1d')](_0xf9a8('0x5c'),_0x150a87[_0xf9a8('0x55')],_0xd7cd34[_0xf9a8('0x5d')],md5(_0xd7cd34['uniqueid']));}else{_0xd7cd34[_0xf9a8('0x5b')]='';}return getConnection(_0x150a87)[_0xf9a8('0x34')](function(_0x440e8c){_0x4c01db=_0x440e8c;return getUser(_0x150a87,_0x149545[_0xf9a8('0x17')],_0x4c01db);})['then'](function(_0x357162){_0x8acbea=_0x357162;logger['info'](_0xf9a8('0x5e'),_0x8acbea['id']);return getEndUser(_0x150a87,_0xd7cd34[_0xf9a8('0x5f')],_0xd7cd34['calleridnum'],_0x4c01db);})['then'](function(_0x18cf58){_0x35fb84=_0x18cf58;logger[_0xf9a8('0x24')](_0xf9a8('0x60'),_0x35fb84['id']);return getTicket(_0x150a87,_0x8acbea,_0x35fb84,_0x5cdc4b,_0xd7cd34,_0x5cdc4b[_0xf9a8('0x61')],_0x4c01db,_0xf9a8('0x62'));})[_0xf9a8('0x34')](function(_0x35f089){_0x20b70e=_0x35f089;logger['info'](_0xf9a8('0x63'));logger[_0xf9a8('0x24')](_0xf9a8('0x64'),_0x20b70e['id']);return setRelationship(_0x4c01db,_0x8acbea,_0x20b70e,_0xf9a8('0x65'));})[_0xf9a8('0x34')](function(){return setRelationship(_0x4c01db,_0x35fb84,_0x20b70e,_0xf9a8('0x66'));})[_0xf9a8('0x34')](function(){return getServerInfo(_0x4c01db);})['then'](function(_0x15dde9){var _0x238dc3=parseInt(_0x15dde9[_0xf9a8('0x67')][_0xf9a8('0x68')](0x0));var _0x18586d=util[_0xf9a8('0x1d')](_0xf9a8('0x69'),_0x150a87[_0xf9a8('0x54')],_0x20b70e['id']);if(_0x238dc3>0x6){_0x18586d=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x150a87[_0xf9a8('0x54')],_0x20b70e['id']);}logger[_0xf9a8('0x24')](_0xf9a8('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf9a8('0x1d')]('user:%s',_0x149545['name']),'trigger:browser:url',{'uri':_0x18586d});})['catch'](function(_0x520020){logger[_0xf9a8('0x6a')](_0xf9a8('0x59'),JSON['stringify'](_0x520020));});};exports[_0xf9a8('0x6b')]=function(_0x3f3de4,_0x124315,_0x27010f,_0x41074d,_0x1a6e1c,_0x1c25ca,_0x32a4cf){var _0x49066a,_0x537c1f,_0x45b1c4,_0x267cab;_0x1c25ca[_0xf9a8('0x54')]=intUtil[_0xf9a8('0x53')](_0x1c25ca[_0xf9a8('0x54')]);_0x1c25ca[_0xf9a8('0x55')]=intUtil['stripTrailingSlash'](_0x1c25ca['serverUrl']);def[_0xf9a8('0x56')]=util[_0xf9a8('0x1d')](_0xf9a8('0x57'),_0x1c25ca[_0xf9a8('0x54')]);if(_0x32a4cf&&_0x32a4cf[_0xf9a8('0x6c')]&&_0x32a4cf['recordingFormat']!==_0xf9a8('0x6d')){logger[_0xf9a8('0x24')](_0xf9a8('0x6e'),'Recording\x20is\x20enabled!');_0x124315[_0xf9a8('0x5b')]=util['format'](_0xf9a8('0x5c'),_0x1c25ca['serverUrl'],_0x124315[_0xf9a8('0x5d')],md5(_0x124315[_0xf9a8('0x5d')]));}return getConnection(_0x1c25ca)[_0xf9a8('0x34')](function(_0x449326){_0x267cab=_0x449326;return getUser(_0x1c25ca,_0x41074d[_0xf9a8('0x17')],_0x267cab);})['then'](function(_0x3b681a){_0x49066a=_0x3b681a;logger[_0xf9a8('0x24')]('The\x20User\x20ID\x20is:',_0x49066a['id']);return getEndUser(_0x1c25ca,_0x124315[_0xf9a8('0x6f')],_0x124315['destcalleridnum'],_0x267cab);})['then'](function(_0x29946c){_0x537c1f=_0x29946c;logger[_0xf9a8('0x24')](_0xf9a8('0x60'),_0x537c1f['id']);return getTicket(_0x1c25ca,_0x49066a,_0x537c1f,_0x27010f,_0x124315,_0x27010f['Fields'],_0x267cab,'Outbound');})[_0xf9a8('0x34')](function(_0x440a80){_0x45b1c4=_0x440a80;logger['info'](_0xf9a8('0x63'));logger[_0xf9a8('0x24')](_0xf9a8('0x64'),_0x45b1c4['id']);return setRelationship(_0x267cab,_0x49066a,_0x45b1c4,_0xf9a8('0x65'));})[_0xf9a8('0x34')](function(){return setRelationship(_0x267cab,_0x537c1f,_0x45b1c4,_0xf9a8('0x66'));})[_0xf9a8('0x34')](function(){return getServerInfo(_0x267cab);})[_0xf9a8('0x34')](function(_0x4dadf5){var _0x13cfd7=parseInt(_0x4dadf5['version'][_0xf9a8('0x68')](0x0));var _0x47cf8e=util[_0xf9a8('0x1d')](_0xf9a8('0x69'),_0x1c25ca['remoteUri'],_0x45b1c4['id']);if(_0x13cfd7>0x6){_0x47cf8e=util[_0xf9a8('0x1d')](_0xf9a8('0x70'),_0x1c25ca['remoteUri'],_0x45b1c4['id']);}logger[_0xf9a8('0x24')](_0xf9a8('0x6e'),_0xf9a8('0x71'));emit(util['format']('user:%s',_0x41074d[_0xf9a8('0x17')]),_0xf9a8('0x72'),{'uri':_0x47cf8e});})[_0xf9a8('0x73')](function(_0x2d1543){logger['error']('[OUTBOUND]',JSON[_0xf9a8('0x1b')](_0x2d1543));});};exports[_0xf9a8('0x74')]=function(_0x441233,_0x5ec2aa,_0x1cffb0,_0x2fa223,_0x3ecba9,_0x22e492){var _0x5cf47d,_0x13a283,_0x42ccd1,_0x3cb6a6;_0x22e492['remoteUri']=intUtil[_0xf9a8('0x53')](_0x22e492['remoteUri']);_0x22e492[_0xf9a8('0x55')]=intUtil['stripTrailingSlash'](_0x22e492[_0xf9a8('0x55')]);def[_0xf9a8('0x56')]=util[_0xf9a8('0x1d')](_0xf9a8('0x57'),_0x22e492['remoteUri']);if(_0x3ecba9&&_0x3ecba9[_0xf9a8('0x58')]){logger[_0xf9a8('0x24')]('['+_0x5ec2aa[_0xf9a8('0x75')][_0xf9a8('0x76')]()+']',_0xf9a8('0x5a'));_0x5ec2aa['recordingURL']=util[_0xf9a8('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22e492[_0xf9a8('0x55')],_0x5ec2aa[_0xf9a8('0x5d')],md5(_0x5ec2aa[_0xf9a8('0x5d')]));}else{_0x5ec2aa[_0xf9a8('0x5b')]='';}return getConnection(_0x22e492)[_0xf9a8('0x34')](function(_0x2297ce){_0x3cb6a6=_0x2297ce;if(!_[_0xf9a8('0x23')](_0x2fa223)){return getUser(_0x22e492,_0x2fa223[_0xf9a8('0x17')],_0x3cb6a6);}else{return getUser(_0x22e492,null,_0x3cb6a6);}})[_0xf9a8('0x34')](function(_0x3f1068){_0x5cf47d=_0x3f1068;logger[_0xf9a8('0x24')](_0xf9a8('0x5e'),_0x5cf47d['id']);return getEndUser(_0x22e492,_0x5ec2aa[_0xf9a8('0x5f')],_0x5ec2aa[_0xf9a8('0x77')],_0x3cb6a6);})[_0xf9a8('0x34')](function(_0x30239f){_0x13a283=_0x30239f;logger[_0xf9a8('0x24')](_0xf9a8('0x60'),_0x13a283['id']);return getTicket(_0x22e492,_0x5cf47d,_0x13a283,_0x1cffb0,_0x5ec2aa,_0x1cffb0['Fields'],_0x3cb6a6,_0xf9a8('0x62'));})[_0xf9a8('0x34')](function(_0x4e88e3){_0x42ccd1=_0x4e88e3;logger[_0xf9a8('0x24')](_0xf9a8('0x63'));logger[_0xf9a8('0x24')](_0xf9a8('0x64'),_0x42ccd1['id']);return setRelationship(_0x3cb6a6,_0x5cf47d,_0x42ccd1,'users');})[_0xf9a8('0x34')](function(){return setRelationship(_0x3cb6a6,_0x13a283,_0x42ccd1,_0xf9a8('0x66'));})[_0xf9a8('0x34')](function(){return getServerInfo(_0x3cb6a6);})[_0xf9a8('0x73')](function(_0x2f2ac5){logger[_0xf9a8('0x6a')]('['+_0x5ec2aa[_0xf9a8('0x75')][_0xf9a8('0x76')]()+']',JSON[_0xf9a8('0x1b')](_0x2f2ac5));});}; \ 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 3a08d62..04c80e5 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 _0x3041=['join','stripTrailingSlash','substring','validateEmail','test','lodash','length','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','variable'];(function(_0x198226,_0x45e36e){var _0x37683b=function(_0xf44605){while(--_0xf44605){_0x198226['push'](_0x198226['shift']());}};_0x37683b(++_0x45e36e);}(_0x3041,0x7d));var _0x1304=function(_0x5397f4,_0x3f2c05){_0x5397f4=_0x5397f4-0x0;var _0x4cba07=_0x3041[_0x5397f4];return _0x4cba07;};'use strict';var _=require(_0x1304('0x0'));var util=require('util');exports['getString']=function(_0x4cdb4b,_0x364a62,_0xbc10de){var _0x2120e5=[];if(_0x4cdb4b['length']>0x0){var _0x29ed9c=_['sortBy'](_0x4cdb4b,['id']);for(var _0x4acade=0x0;_0x4acade<_0x29ed9c[_0x1304('0x1')];_0x4acade++){var _0x3fc720=_0x29ed9c[_0x4acade];if(_0x3fc720[_0x1304('0x2')]===_0x1304('0x3')){_0x2120e5[_0x1304('0x4')](_0x3fc720[_0x1304('0x5')]);}else if(_0x3fc720[_0x1304('0x2')]==='variable'&&_0x3fc720[_0x1304('0x6')]){_0x364a62[_0x3fc720['variableName']]&&_0x2120e5[_0x1304('0x4')](_0x364a62[_0x3fc720[_0x1304('0x6')]][_0x1304('0x7')]());}else if(_0x3fc720['type']===_0x1304('0x8')&&_0x3fc720[_0x1304('0x9')]&&_0x3fc720[_0x1304('0x9')][_0x1304('0xa')]){_0x364a62[_0x3fc720[_0x1304('0x9')][_0x1304('0xa')][_0x1304('0xb')]()]&&_0x2120e5[_0x1304('0x4')](_0x364a62[_0x3fc720[_0x1304('0x9')][_0x1304('0xa')][_0x1304('0xb')]()][_0x1304('0x7')]());}else if(_0x3fc720[_0x1304('0x2')]===_0x1304('0xc')){if(_0x3fc720[_0x1304('0xd')]===_0x1304('0x3')&&_0x3fc720['key']){_0x2120e5[_0x1304('0x4')](util[_0x1304('0xe')](_0x1304('0xf'),_0x3fc720[_0x1304('0x10')],_0x3fc720[_0x1304('0x11')]));}else if(_0x3fc720[_0x1304('0xd')]===_0x1304('0x12')&&_0x3fc720[_0x1304('0x6')]&&_0x3fc720[_0x1304('0x10')]){_0x364a62[_0x3fc720[_0x1304('0x6')]]&&_0x2120e5['push'](util['format'](_0x1304('0xf'),_0x3fc720['key'],_0x364a62[_0x3fc720[_0x1304('0x6')]]));}else if(_0x3fc720[_0x1304('0xd')]==='customVariable'&&_0x3fc720[_0x1304('0x9')]&&_0x3fc720[_0x1304('0x9')][_0x1304('0xa')]&&_0x3fc720[_0x1304('0x10')]){_0x364a62[_0x3fc720[_0x1304('0x9')]['name'][_0x1304('0xb')]()]&&_0x2120e5[_0x1304('0x4')](util[_0x1304('0xe')](_0x1304('0xf'),_0x3fc720[_0x1304('0x10')],_0x364a62[_0x3fc720[_0x1304('0x9')][_0x1304('0xa')][_0x1304('0xb')]()]));}}}}return _0x2120e5[_0x1304('0x13')](_0xbc10de);};exports[_0x1304('0x14')]=function(_0x3ff61a){var _0x3ede15=_0x3ff61a['slice'](-0x1);if(_0x3ede15==='/'){_0x3ff61a=_0x3ff61a[_0x1304('0x15')](0x0,_0x3ff61a['lastIndexOf'](_0x3ede15));}return _0x3ff61a;};exports[_0x1304('0x16')]=function(_0x22899d){if(!_['isNil'](_0x22899d)&&_0x22899d!==''){var _0x405f48=/^(([^<>()\[\]\\.,;:\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 _0x405f48[_0x1304('0x17')](String(_0x22899d)[_0x1304('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xcc5b=['length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyType','%s:\x20%s','keyContent','format','key','join','slice','substring','lastIndexOf','validateEmail','test','lodash','util'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0xcc5b,0x19e));var _0xbcc5=function(_0x52971a,_0x3271c9){_0x52971a=_0x52971a-0x0;var _0x25c22c=_0xcc5b[_0x52971a];return _0x25c22c;};'use strict';var _=require(_0xbcc5('0x0'));var util=require(_0xbcc5('0x1'));exports['getString']=function(_0x30c073,_0x5c7f1a,_0x2d94c8){var _0x2e45c7=[];if(_0x30c073[_0xbcc5('0x2')]>0x0){var _0x17e4eb=_[_0xbcc5('0x3')](_0x30c073,['id']);for(var _0x2e588a=0x0;_0x2e588a<_0x17e4eb[_0xbcc5('0x2')];_0x2e588a++){var _0x1dd644=_0x17e4eb[_0x2e588a];if(_0x1dd644[_0xbcc5('0x4')]===_0xbcc5('0x5')){_0x2e45c7[_0xbcc5('0x6')](_0x1dd644[_0xbcc5('0x7')]);}else if(_0x1dd644[_0xbcc5('0x4')]===_0xbcc5('0x8')&&_0x1dd644[_0xbcc5('0x9')]){_0x5c7f1a[_0x1dd644[_0xbcc5('0x9')]]&&_0x2e45c7['push'](_0x5c7f1a[_0x1dd644[_0xbcc5('0x9')]]['toString']());}else if(_0x1dd644[_0xbcc5('0x4')]===_0xbcc5('0xa')&&_0x1dd644[_0xbcc5('0xb')]&&_0x1dd644[_0xbcc5('0xb')][_0xbcc5('0xc')]){_0x5c7f1a[_0x1dd644[_0xbcc5('0xb')][_0xbcc5('0xc')][_0xbcc5('0xd')]()]&&_0x2e45c7[_0xbcc5('0x6')](_0x5c7f1a[_0x1dd644[_0xbcc5('0xb')][_0xbcc5('0xc')]['toLowerCase']()][_0xbcc5('0xe')]());}else if(_0x1dd644[_0xbcc5('0x4')]==='keyValue'){if(_0x1dd644[_0xbcc5('0xf')]==='string'&&_0x1dd644['key']){_0x2e45c7['push'](util['format'](_0xbcc5('0x10'),_0x1dd644['key'],_0x1dd644[_0xbcc5('0x11')]));}else if(_0x1dd644[_0xbcc5('0xf')]===_0xbcc5('0x8')&&_0x1dd644[_0xbcc5('0x9')]&&_0x1dd644['key']){_0x5c7f1a[_0x1dd644[_0xbcc5('0x9')]]&&_0x2e45c7['push'](util[_0xbcc5('0x12')]('%s:\x20%s',_0x1dd644[_0xbcc5('0x13')],_0x5c7f1a[_0x1dd644[_0xbcc5('0x9')]]));}else if(_0x1dd644[_0xbcc5('0xf')]==='customVariable'&&_0x1dd644['Variable']&&_0x1dd644['Variable'][_0xbcc5('0xc')]&&_0x1dd644[_0xbcc5('0x13')]){_0x5c7f1a[_0x1dd644['Variable'][_0xbcc5('0xc')][_0xbcc5('0xd')]()]&&_0x2e45c7[_0xbcc5('0x6')](util[_0xbcc5('0x12')](_0xbcc5('0x10'),_0x1dd644[_0xbcc5('0x13')],_0x5c7f1a[_0x1dd644[_0xbcc5('0xb')][_0xbcc5('0xc')][_0xbcc5('0xd')]()]));}}}}return _0x2e45c7[_0xbcc5('0x14')](_0x2d94c8);};exports['stripTrailingSlash']=function(_0x1e32d2){var _0x5f32e5=_0x1e32d2[_0xbcc5('0x15')](-0x1);if(_0x5f32e5==='/'){_0x1e32d2=_0x1e32d2[_0xbcc5('0x16')](0x0,_0x1e32d2[_0xbcc5('0x17')](_0x5f32e5));}return _0x1e32d2;};exports[_0xbcc5('0x18')]=function(_0x44f360){if(!_['isNil'](_0x44f360)&&_0x44f360!==''){var _0x1889a0=/^(([^<>()\[\]\\.,;:\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 _0x1889a0[_0xbcc5('0x19')](String(_0x44f360)[_0xbcc5('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 2db7b5d..715563d 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 _0x2b78=['POST','format','%s/webservice.php','remoteUri','create','username','sessionName','stringify','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','Agent\x20found!','email1','first_name','last_name','userId','admin','getUser','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;','then','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','uniqueid','destcalleridname','Fields','[OUTBOUND]','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','vTiger','defaults','redis','localhost','socket.io-emitter','emit','forEach','type','string','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','Creating\x20new\x20ticket...','merge','getString','Subjects'];(function(_0x14d68d,_0x19141f){var _0x46e9c2=function(_0x2841c4){while(--_0x2841c4){_0x14d68d['push'](_0x14d68d['shift']());}};_0x46e9c2(++_0x19141f);}(_0x2b78,0x118));var _0x82b7=function(_0xb60674,_0xa4e08a){_0xb60674=_0xb60674-0x0;var _0x2514a0=_0x2b78[_0xb60674];return _0x2514a0;};'use strict';var _=require(_0x82b7('0x0'));var rp=require(_0x82b7('0x1'));var BPromise=require(_0x82b7('0x2'));var md5=require(_0x82b7('0x3'));var util=require(_0x82b7('0x4'));var Redis=require(_0x82b7('0x5'));var intUtil=require(_0x82b7('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x82b7('0x7'));config['redis']=_[_0x82b7('0x8')](config[_0x82b7('0x9')],{'host':_0x82b7('0xa'),'port':0x18eb});var io=require(_0x82b7('0xb'))(new Redis(config['redis']));function emit(_0x5408a3,_0xa7ff98,_0x45fb41){io['to'](_0x5408a3)[_0x82b7('0xc')](_0xa7ff98,_0x45fb41);}function getCustomFields(_0xf1119,_0x3c80f6){var _0xec7387={};if(_0xf1119['length']>0x0){_[_0x82b7('0xd')](_0xf1119,function(_0x14575a){if(_0x14575a[_0x82b7('0xe')]===_0x82b7('0xf')&&_0x14575a['idField']){_0xec7387[_0x14575a[_0x82b7('0x10')]]=_0x14575a[_0x82b7('0x11')][_0x82b7('0x12')]();}else if(_0x14575a['type']===_0x82b7('0x13')&&_0x14575a[_0x82b7('0x14')]&&_0x14575a[_0x82b7('0x10')]&&_0x3c80f6[_0x14575a['variableName']]){_0xec7387[_0x14575a['idField']]=_0x3c80f6[_0x14575a[_0x82b7('0x14')]][_0x82b7('0x12')]();}else if(_0x14575a[_0x82b7('0xe')]===_0x82b7('0x15')&&_0x14575a['Variable']&&_0x14575a['Variable'][_0x82b7('0x16')]&&_0x14575a[_0x82b7('0x10')]&&_0x3c80f6[_0x14575a[_0x82b7('0x17')]['name'][_0x82b7('0x18')]()]){_0xec7387[_0x14575a[_0x82b7('0x10')]]=_0x3c80f6[_0x14575a[_0x82b7('0x17')][_0x82b7('0x16')]['toLowerCase']()][_0x82b7('0x12')]();}});}return _0xec7387;}function createTicket(_0x29b93b,_0x5d6843,_0x4049f1,_0x21138f,_0x27ce07,_0x4f9182,_0xcb4f1f){logger['info'](_0x82b7('0x19'));var _0x36cb6f=_[_0x82b7('0x1a')]({'parent_id':'','assigned_user_id':_0x5d6843['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0x82b7('0x1b')](_0x21138f[_0x82b7('0x1c')],_0x27ce07,'\x20'),'description':intUtil[_0x82b7('0x1b')](_0x21138f['Descriptions'],_0x27ce07,'\x0a'),'contact_id':_0x4049f1['id']},getCustomFields(_0x4f9182,_0x27ce07));var _0x4d0bc2={'method':_0x82b7('0x1d'),'uri':util[_0x82b7('0x1e')](_0x82b7('0x1f'),_0x29b93b[_0x82b7('0x20')]),'form':{'operation':_0x82b7('0x21'),'username':_0x29b93b[_0x82b7('0x22')],'sessionName':_0xcb4f1f[_0x82b7('0x23')],'elementType':'HelpDesk','element':JSON[_0x82b7('0x24')](_0x36cb6f)},'json':!![]};return request(_0x4d0bc2)['then'](function(_0x15ce8e){if(_0x15ce8e[_0x82b7('0x25')]){return BPromise[_0x82b7('0x26')]({'id':_0x15ce8e[_0x82b7('0x27')]['id']});}else{throw new Error(util[_0x82b7('0x1e')](_0x82b7('0x28'),JSON['stringify'](_0x15ce8e[_0x82b7('0x29')])));}})[_0x82b7('0x2a')](function(_0x98c94){var _0x55ae2e=_0x98c94[_0x82b7('0x2b')]||0x1f4;logger[_0x82b7('0x29')](_0x82b7('0x2c'),_0x82b7('0x2d'),_0x55ae2e,JSON[_0x82b7('0x24')](_0x98c94));});}function getUser(_0xbb3d57,_0x5dd45d,_0x1bc927){if(intUtil[_0x82b7('0x2e')](_0x5dd45d)){logger[_0x82b7('0x2f')]('Getting\x20agent\x20with\x20email',_0x5dd45d);return request({'method':'GET','uri':util[_0x82b7('0x1e')](_0x82b7('0x1f'),_0xbb3d57[_0x82b7('0x20')]),'qs':{'operation':'query','username':_0xbb3d57[_0x82b7('0x22')],'sessionName':_0x1bc927[_0x82b7('0x23')],'query':util[_0x82b7('0x1e')](_0x82b7('0x30'),_0x5dd45d)},'json':!![]})['then'](function(_0x5fe5cb){if(_0x5fe5cb[_0x82b7('0x25')]&&_0x5fe5cb[_0x82b7('0x27')][_0x82b7('0x31')]){logger[_0x82b7('0x2f')](_0x82b7('0x32'));return BPromise[_0x82b7('0x26')]({'id':_0x5fe5cb[_0x82b7('0x27')][0x0]['id'],'email':_0x5fe5cb[_0x82b7('0x27')][0x0][_0x82b7('0x33')],'name':_0x5fe5cb['result'][0x0][_0x82b7('0x34')]+'\x20'+_0x5fe5cb[_0x82b7('0x27')][_0x82b7('0x35')]});}else{logger[_0x82b7('0x2f')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x82b7('0x26')]({'id':_0x1bc927[_0x82b7('0x36')],'email':_0xbb3d57[_0x82b7('0x22')],'name':_0x82b7('0x37')});}})[_0x82b7('0x2a')](function(_0xd3e38f){var _0x1a7b89=_0xd3e38f[_0x82b7('0x2b')]||0x1f4;logger[_0x82b7('0x29')](_0x82b7('0x2c'),_0x82b7('0x38'),_0x1a7b89,JSON['stringify'](_0xd3e38f));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x82b7('0x26')]({'id':_0x1bc927[_0x82b7('0x36')],'email':_0xbb3d57[_0x82b7('0x22')],'name':_0x82b7('0x37')})['catch'](function(_0x41069d){var _0x4e1845=_0x41069d['statusCode']||0x1f4;logger[_0x82b7('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4e1845,JSON[_0x82b7('0x24')](_0x41069d));});}}function getEndUser(_0x4c414e,_0xc2428,_0x295ec2,_0x35002d){logger[_0x82b7('0x2f')]('Searching\x20end\x20user\x20with\x20phone',_0x295ec2);return request({'method':'GET','uri':util[_0x82b7('0x1e')](_0x82b7('0x1f'),_0x4c414e['remoteUri']),'qs':{'operation':'query','username':_0x4c414e[_0x82b7('0x22')],'sessionName':_0x35002d[_0x82b7('0x23')],'query':util[_0x82b7('0x1e')](_0x82b7('0x39'),_0x295ec2,_0x295ec2,_0x295ec2,_0x295ec2,_0x295ec2)},'json':!![]})[_0x82b7('0x3a')](function(_0x201c1c){if(_0x201c1c['success']&&_0x201c1c[_0x82b7('0x27')]['length']){logger[_0x82b7('0x2f')](_0x82b7('0x3b'));return BPromise['resolve']({'id':_0x201c1c[_0x82b7('0x27')][0x0]['id'],'name':_0x201c1c['result'][0x0][_0x82b7('0x3c')]+'\x20'+_0x201c1c[_0x82b7('0x27')][0x0][_0x82b7('0x3d')],'phone':_0x295ec2});}else{logger['info'](_0x82b7('0x3e'));return request({'method':_0x82b7('0x1d'),'uri':util[_0x82b7('0x1e')](_0x82b7('0x1f'),_0x4c414e[_0x82b7('0x20')]),'form':{'operation':_0x82b7('0x21'),'sessionName':_0x35002d[_0x82b7('0x23')],'elementType':_0x82b7('0x3f'),'element':JSON[_0x82b7('0x24')]({'lastname':_0xc2428,'phone':_0x295ec2,'assigned_user_id':'\x20'})},'json':!![]})[_0x82b7('0x3a')](function(_0x14769f){logger[_0x82b7('0x2f')](_0x82b7('0x40'));return BPromise['resolve']({'id':_0x14769f['result']['id'],'name':_0x14769f[_0x82b7('0x27')]['lastname'],'phone':_0x14769f[_0x82b7('0x27')]['phone']});})[_0x82b7('0x2a')](function(_0x163ee4){var _0x3b03f3=_0x163ee4[_0x82b7('0x2b')]||0x1f4;logger[_0x82b7('0x29')](_0x82b7('0x2c'),_0x82b7('0x41'),_0x3b03f3,JSON[_0x82b7('0x24')](_0x163ee4));});}});}function getConnection(_0x168b61){var _0x2f353a=_0x168b61[_0x82b7('0x22')];var _0xf2899d=_0x168b61[_0x82b7('0x42')];return request({'method':'GET','uri':util[_0x82b7('0x1e')](_0x82b7('0x1f'),_0x168b61[_0x82b7('0x20')]),'qs':{'operation':_0x82b7('0x43'),'username':_0x2f353a},'json':!![]})[_0x82b7('0x3a')](function(_0x22a4bf){if(_0x22a4bf[_0x82b7('0x25')]){return request({'method':_0x82b7('0x1d'),'uri':util[_0x82b7('0x1e')](_0x82b7('0x1f'),_0x168b61[_0x82b7('0x20')]),'form':{'operation':_0x82b7('0x44'),'username':_0x2f353a,'accessKey':md5(_0x22a4bf[_0x82b7('0x27')][_0x82b7('0x45')]+_0xf2899d)},'json':!![]});}})[_0x82b7('0x3a')](function(_0x3f049e){if(_0x3f049e[_0x82b7('0x25')]){return BPromise[_0x82b7('0x26')](_0x3f049e[_0x82b7('0x27')]);}else{throw new Error(util[_0x82b7('0x1e')](_0x82b7('0x46'),_0x168b61['id']));}})[_0x82b7('0x2a')](function(_0x50e617){var _0x1644e1=_0x50e617[_0x82b7('0x2b')]||0x1f4;logger[_0x82b7('0x29')](_0x82b7('0x2c'),_0x82b7('0x47'),_0x1644e1,JSON['stringify'](_0x50e617));});}function request(_0x37c6ba){logger[_0x82b7('0x2f')](_0x82b7('0x48'),JSON['stringify'](_0x37c6ba));return rp(_0x37c6ba);}exports[_0x82b7('0x49')]=function(_0x9d87fb,_0x15ad8b,_0x484c3,_0x1503dd,_0x57caf5,_0x33181a){var _0x2f963f,_0x46034a,_0x522671,_0x482392;_0x33181a[_0x82b7('0x20')]=intUtil[_0x82b7('0x4a')](_0x33181a['remoteUri']);if(_0x57caf5&&_0x57caf5[_0x82b7('0x4b')]){logger[_0x82b7('0x2f')]('[QUEUE]',_0x82b7('0x4c'));_0x15ad8b[_0x82b7('0x4d')]=util[_0x82b7('0x1e')](_0x82b7('0x4e'),_0x33181a[_0x82b7('0x4f')],_0x15ad8b['uniqueid'],md5(_0x15ad8b['uniqueid']));}else{_0x15ad8b[_0x82b7('0x4d')]='';}return getConnection(_0x33181a)[_0x82b7('0x3a')](function(_0x171a4e){_0x482392=_0x171a4e;return getUser(_0x33181a,_0x1503dd[_0x82b7('0x50')],_0x482392);})[_0x82b7('0x3a')](function(_0x463bbf){_0x2f963f=_0x463bbf;logger[_0x82b7('0x2f')](_0x82b7('0x51'),_0x2f963f['id']);return getEndUser(_0x33181a,_0x15ad8b[_0x82b7('0x52')],_0x15ad8b[_0x82b7('0x53')],_0x482392);})['then'](function(_0x465078){_0x46034a=_0x465078;logger[_0x82b7('0x2f')](_0x82b7('0x54'),_0x46034a['id']);return createTicket(_0x33181a,_0x2f963f,_0x46034a,_0x484c3,_0x15ad8b,_0x484c3['Fields'],_0x482392);})['then'](function(_0x2d17d2){_0x522671=_0x2d17d2;logger[_0x82b7('0x2f')](_0x82b7('0x55'));logger[_0x82b7('0x2f')](_0x82b7('0x56'),_0x522671['id']);var _0x598f29=util['format'](_0x82b7('0x57'),_0x33181a[_0x82b7('0x20')],_[_0x82b7('0x58')](_0x522671['id'],'x')[0x1]);logger[_0x82b7('0x2f')](_0x82b7('0x59'),_0x82b7('0x5a'));emit(util['format'](_0x82b7('0x5b'),_0x1503dd[_0x82b7('0x16')]),'trigger:browser:url',{'uri':_0x598f29});})[_0x82b7('0x2a')](function(_0x44ba23){logger['error'](_0x82b7('0x59'),JSON[_0x82b7('0x24')](_0x44ba23));});};exports[_0x82b7('0x5c')]=function(_0x352d83,_0x41d23b,_0x1d745d,_0x28f89c,_0x45aca3,_0x4dd49a,_0x2ce831){var _0x4df4a2,_0x4dfb67,_0x2bd9aa,_0x4a286a;_0x4dd49a[_0x82b7('0x20')]=intUtil[_0x82b7('0x4a')](_0x4dd49a['remoteUri']);_0x4dd49a[_0x82b7('0x4f')]=intUtil[_0x82b7('0x4a')](_0x4dd49a[_0x82b7('0x4f')]);if(_0x2ce831&&_0x2ce831['recordingFormat']&&_0x2ce831[_0x82b7('0x5d')]!==_0x82b7('0x5e')){logger[_0x82b7('0x2f')]('[OUTBOUND]',_0x82b7('0x4c'));_0x41d23b['recordingURL']=util[_0x82b7('0x1e')](_0x82b7('0x4e'),_0x4dd49a['serverUrl'],_0x41d23b['uniqueid'],md5(_0x41d23b[_0x82b7('0x5f')]));}return getConnection(_0x4dd49a)['then'](function(_0x3b45de){_0x4a286a=_0x3b45de;return getUser(_0x4dd49a,_0x28f89c[_0x82b7('0x50')],_0x4a286a);})[_0x82b7('0x3a')](function(_0x1d7235){_0x4df4a2=_0x1d7235;logger[_0x82b7('0x2f')]('The\x20User\x20ID\x20is:',_0x4df4a2['id']);return getEndUser(_0x4dd49a,_0x41d23b[_0x82b7('0x60')],_0x41d23b['destcalleridnum'],_0x4a286a);})[_0x82b7('0x3a')](function(_0x553204){_0x4dfb67=_0x553204;logger[_0x82b7('0x2f')](_0x82b7('0x54'),_0x4dfb67['id']);return createTicket(_0x4dd49a,_0x4df4a2,_0x4dfb67,_0x1d745d,_0x41d23b,_0x1d745d[_0x82b7('0x61')],_0x4a286a);})[_0x82b7('0x3a')](function(_0x53f1ee){_0x2bd9aa=_0x53f1ee;logger[_0x82b7('0x2f')](_0x82b7('0x55'));logger['info'](_0x82b7('0x56'),_0x2bd9aa['id']);var _0x9d495=util[_0x82b7('0x1e')](_0x82b7('0x57'),_0x4dd49a[_0x82b7('0x20')],_[_0x82b7('0x58')](_0x2bd9aa['id'],'x')[0x1]);logger[_0x82b7('0x2f')](_0x82b7('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x82b7('0x5b'),_0x28f89c[_0x82b7('0x16')]),_0x82b7('0x63'),{'uri':_0x9d495});})[_0x82b7('0x2a')](function(_0x4b1c10){logger[_0x82b7('0x29')](_0x82b7('0x62'),JSON[_0x82b7('0x24')](_0x4b1c10));});};exports[_0x82b7('0x64')]=function(_0x173004,_0x10b75a,_0xdf64d8,_0x160012,_0xc35068,_0x11ebb0){var _0x7618ba,_0x578471,_0x593562,_0x343bba;_0x11ebb0[_0x82b7('0x20')]=intUtil[_0x82b7('0x4a')](_0x11ebb0['remoteUri']);_0x11ebb0['serverUrl']=intUtil[_0x82b7('0x4a')](_0x11ebb0[_0x82b7('0x4f')]);if(_0xc35068&&_0xc35068[_0x82b7('0x4b')]){logger[_0x82b7('0x2f')]('['+_0x10b75a[_0x82b7('0x65')][_0x82b7('0x66')]()+']',_0x82b7('0x4c'));_0x10b75a['recordingURL']=util[_0x82b7('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11ebb0[_0x82b7('0x4f')],_0x10b75a[_0x82b7('0x5f')],md5(_0x10b75a[_0x82b7('0x5f')]));}else{_0x10b75a[_0x82b7('0x4d')]='';}return getConnection(_0x11ebb0)[_0x82b7('0x3a')](function(_0x82863d){_0x343bba=_0x82863d;return getUser(_0x11ebb0,'',_0x343bba);})[_0x82b7('0x3a')](function(_0x11f427){_0x7618ba=_0x11f427;logger[_0x82b7('0x2f')](_0x82b7('0x51'),_0x7618ba['id']);return getEndUser(_0x11ebb0,_0x10b75a[_0x82b7('0x52')],_0x10b75a[_0x82b7('0x53')],_0x343bba);})[_0x82b7('0x3a')](function(_0x3ed2bb){_0x578471=_0x3ed2bb;logger[_0x82b7('0x2f')](_0x82b7('0x54'),_0x578471['id']);return createTicket(_0x11ebb0,_0x7618ba,_0x578471,_0xdf64d8,_0x10b75a,_0xdf64d8[_0x82b7('0x61')],_0x343bba);})[_0x82b7('0x3a')](function(_0x20434c){_0x593562=_0x20434c;logger[_0x82b7('0x2f')]('Ticket\x20created!');logger[_0x82b7('0x2f')](_0x82b7('0x56'),_0x593562['id']);})['catch'](function(_0x5217d7){logger[_0x82b7('0x29')]('['+_0x10b75a[_0x82b7('0x65')][_0x82b7('0x66')]()+']',JSON[_0x82b7('0x24')](_0x5217d7));});}; \ No newline at end of file +var _0x2d50=['Normal','Open','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','username','sessionName','HelpDesk','then','success','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','format','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','statusCode','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;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','getEndUser','getchallenge','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','[QUEUE]','user:%s','trigger:browser:url','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','socket.io-emitter','redis','emit','length','forEach','string','idField','content','toString','type','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x2d50,0x1db));var _0x02d5=function(_0x3380cb,_0x296719){_0x3380cb=_0x3380cb-0x0;var _0x2f6303=_0x2d50[_0x3380cb];return _0x2f6303;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x02d5('0x0'));var md5=require(_0x02d5('0x1'));var util=require(_0x02d5('0x2'));var Redis=require('ioredis');var intUtil=require(_0x02d5('0x3'));var config=require(_0x02d5('0x4'));var logger=require(_0x02d5('0x5'))(_0x02d5('0x6'));config['redis']=_[_0x02d5('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x02d5('0x8'))(new Redis(config[_0x02d5('0x9')]));function emit(_0x4a3982,_0x161f26,_0x43cd36){io['to'](_0x4a3982)[_0x02d5('0xa')](_0x161f26,_0x43cd36);}function getCustomFields(_0x6760f3,_0x4f2ce1){var _0x4ba3d8={};if(_0x6760f3[_0x02d5('0xb')]>0x0){_[_0x02d5('0xc')](_0x6760f3,function(_0x17ac51){if(_0x17ac51['type']===_0x02d5('0xd')&&_0x17ac51['idField']){_0x4ba3d8[_0x17ac51[_0x02d5('0xe')]]=_0x17ac51[_0x02d5('0xf')][_0x02d5('0x10')]();}else if(_0x17ac51[_0x02d5('0x11')]==='variable'&&_0x17ac51[_0x02d5('0x12')]&&_0x17ac51[_0x02d5('0xe')]&&_0x4f2ce1[_0x17ac51[_0x02d5('0x12')]]){_0x4ba3d8[_0x17ac51[_0x02d5('0xe')]]=_0x4f2ce1[_0x17ac51[_0x02d5('0x12')]]['toString']();}else if(_0x17ac51[_0x02d5('0x11')]==='customVariable'&&_0x17ac51[_0x02d5('0x13')]&&_0x17ac51[_0x02d5('0x13')][_0x02d5('0x14')]&&_0x17ac51[_0x02d5('0xe')]&&_0x4f2ce1[_0x17ac51[_0x02d5('0x13')]['name'][_0x02d5('0x15')]()]){_0x4ba3d8[_0x17ac51[_0x02d5('0xe')]]=_0x4f2ce1[_0x17ac51[_0x02d5('0x13')][_0x02d5('0x14')][_0x02d5('0x15')]()]['toString']();}});}return _0x4ba3d8;}function createTicket(_0x3d2f21,_0x5332a7,_0x3ae1f7,_0x18075d,_0x496a0f,_0x331140,_0x2b9a67){logger[_0x02d5('0x16')](_0x02d5('0x17'));var _0x275dfa=_[_0x02d5('0x18')]({'parent_id':'','assigned_user_id':_0x5332a7['id'],'ticketpriorities':_0x02d5('0x19'),'ticketstatus':_0x02d5('0x1a'),'ticket_title':intUtil[_0x02d5('0x1b')](_0x18075d[_0x02d5('0x1c')],_0x496a0f,'\x20'),'description':intUtil[_0x02d5('0x1b')](_0x18075d[_0x02d5('0x1d')],_0x496a0f,'\x0a'),'contact_id':_0x3ae1f7['id']},getCustomFields(_0x331140,_0x496a0f));var _0x9cf5c7={'method':_0x02d5('0x1e'),'uri':util['format'](_0x02d5('0x1f'),_0x3d2f21[_0x02d5('0x20')]),'form':{'operation':'create','username':_0x3d2f21[_0x02d5('0x21')],'sessionName':_0x2b9a67[_0x02d5('0x22')],'elementType':_0x02d5('0x23'),'element':JSON['stringify'](_0x275dfa)},'json':!![]};return request(_0x9cf5c7)[_0x02d5('0x24')](function(_0x4011c7){if(_0x4011c7[_0x02d5('0x25')]){return BPromise['resolve']({'id':_0x4011c7['result']['id']});}else{throw new Error(util['format'](_0x02d5('0x26'),JSON[_0x02d5('0x27')](_0x4011c7['error'])));}})[_0x02d5('0x28')](function(_0x37f02c){var _0x13c528=_0x37f02c['statusCode']||0x1f4;logger[_0x02d5('0x29')](_0x02d5('0x2a'),_0x02d5('0x2b'),_0x13c528,JSON[_0x02d5('0x27')](_0x37f02c));});}function getUser(_0x5dae50,_0x1adafc,_0x2c7251){if(intUtil[_0x02d5('0x2c')](_0x1adafc)){logger[_0x02d5('0x16')](_0x02d5('0x2d'),_0x1adafc);return request({'method':_0x02d5('0x2e'),'uri':util[_0x02d5('0x2f')](_0x02d5('0x1f'),_0x5dae50[_0x02d5('0x20')]),'qs':{'operation':_0x02d5('0x30'),'username':_0x5dae50[_0x02d5('0x21')],'sessionName':_0x2c7251[_0x02d5('0x22')],'query':util[_0x02d5('0x2f')](_0x02d5('0x31'),_0x1adafc)},'json':!![]})[_0x02d5('0x24')](function(_0x5134a4){if(_0x5134a4[_0x02d5('0x25')]&&_0x5134a4[_0x02d5('0x32')][_0x02d5('0xb')]){logger[_0x02d5('0x16')](_0x02d5('0x33'));return BPromise['resolve']({'id':_0x5134a4[_0x02d5('0x32')][0x0]['id'],'email':_0x5134a4['result'][0x0][_0x02d5('0x34')],'name':_0x5134a4[_0x02d5('0x32')][0x0][_0x02d5('0x35')]+'\x20'+_0x5134a4[_0x02d5('0x32')]['last_name']});}else{logger[_0x02d5('0x16')](_0x02d5('0x36'));return BPromise[_0x02d5('0x37')]({'id':_0x2c7251[_0x02d5('0x38')],'email':_0x5dae50[_0x02d5('0x21')],'name':_0x02d5('0x39')});}})[_0x02d5('0x28')](function(_0x2ed4e9){var _0x455751=_0x2ed4e9[_0x02d5('0x3a')]||0x1f4;logger['error'](_0x02d5('0x2a'),'getUser',_0x455751,JSON[_0x02d5('0x27')](_0x2ed4e9));});}else{logger[_0x02d5('0x16')](_0x02d5('0x36'));return BPromise[_0x02d5('0x37')]({'id':_0x2c7251['userId'],'email':_0x5dae50[_0x02d5('0x21')],'name':_0x02d5('0x39')})[_0x02d5('0x28')](function(_0x26e38f){var _0xac7b94=_0x26e38f[_0x02d5('0x3a')]||0x1f4;logger[_0x02d5('0x29')](_0x02d5('0x2a'),'getUser',_0xac7b94,JSON['stringify'](_0x26e38f));});}}function getEndUser(_0x473a72,_0x9140fe,_0x3d2a06,_0x46aa03){logger[_0x02d5('0x16')]('Searching\x20end\x20user\x20with\x20phone',_0x3d2a06);return request({'method':_0x02d5('0x2e'),'uri':util[_0x02d5('0x2f')](_0x02d5('0x1f'),_0x473a72[_0x02d5('0x20')]),'qs':{'operation':_0x02d5('0x30'),'username':_0x473a72[_0x02d5('0x21')],'sessionName':_0x46aa03[_0x02d5('0x22')],'query':util[_0x02d5('0x2f')](_0x02d5('0x3b'),_0x3d2a06,_0x3d2a06,_0x3d2a06,_0x3d2a06,_0x3d2a06)},'json':!![]})[_0x02d5('0x24')](function(_0x3e15c0){if(_0x3e15c0[_0x02d5('0x25')]&&_0x3e15c0[_0x02d5('0x32')]['length']){logger['info']('Enduser\x20found!');return BPromise[_0x02d5('0x37')]({'id':_0x3e15c0[_0x02d5('0x32')][0x0]['id'],'name':_0x3e15c0[_0x02d5('0x32')][0x0][_0x02d5('0x3c')]+'\x20'+_0x3e15c0[_0x02d5('0x32')][0x0][_0x02d5('0x3d')],'phone':_0x3d2a06});}else{logger[_0x02d5('0x16')](_0x02d5('0x3e'));return request({'method':_0x02d5('0x1e'),'uri':util[_0x02d5('0x2f')](_0x02d5('0x1f'),_0x473a72[_0x02d5('0x20')]),'form':{'operation':_0x02d5('0x3f'),'sessionName':_0x46aa03[_0x02d5('0x22')],'elementType':_0x02d5('0x40'),'element':JSON['stringify']({'lastname':_0x9140fe,'phone':_0x3d2a06,'assigned_user_id':'\x20'})},'json':!![]})[_0x02d5('0x24')](function(_0xe8ba4b){logger[_0x02d5('0x16')](_0x02d5('0x41'));return BPromise[_0x02d5('0x37')]({'id':_0xe8ba4b[_0x02d5('0x32')]['id'],'name':_0xe8ba4b[_0x02d5('0x32')][_0x02d5('0x3d')],'phone':_0xe8ba4b[_0x02d5('0x32')]['phone']});})[_0x02d5('0x28')](function(_0x30ba00){var _0x5cd5a5=_0x30ba00[_0x02d5('0x3a')]||0x1f4;logger['error'](_0x02d5('0x2a'),_0x02d5('0x42'),_0x5cd5a5,JSON[_0x02d5('0x27')](_0x30ba00));});}});}function getConnection(_0x4f2b3e){var _0x1a9d04=_0x4f2b3e[_0x02d5('0x21')];var _0x2b9d49=_0x4f2b3e['accessKey'];return request({'method':_0x02d5('0x2e'),'uri':util[_0x02d5('0x2f')](_0x02d5('0x1f'),_0x4f2b3e[_0x02d5('0x20')]),'qs':{'operation':_0x02d5('0x43'),'username':_0x1a9d04},'json':!![]})[_0x02d5('0x24')](function(_0x225d77){if(_0x225d77[_0x02d5('0x25')]){return request({'method':_0x02d5('0x1e'),'uri':util[_0x02d5('0x2f')]('%s/webservice.php',_0x4f2b3e[_0x02d5('0x20')]),'form':{'operation':'login','username':_0x1a9d04,'accessKey':md5(_0x225d77[_0x02d5('0x32')]['token']+_0x2b9d49)},'json':!![]});}})['then'](function(_0x119640){if(_0x119640[_0x02d5('0x25')]){return BPromise[_0x02d5('0x37')](_0x119640[_0x02d5('0x32')]);}else{throw new Error(util[_0x02d5('0x2f')](_0x02d5('0x44'),_0x4f2b3e['id']));}})['catch'](function(_0xf0b8e3){var _0x2f1106=_0xf0b8e3[_0x02d5('0x3a')]||0x1f4;logger['error'](_0x02d5('0x2a'),'getConnection',_0x2f1106,JSON[_0x02d5('0x27')](_0xf0b8e3));});}function request(_0x412613){logger['info'](_0x02d5('0x45'),JSON['stringify'](_0x412613));return rp(_0x412613);}exports[_0x02d5('0x46')]=function(_0x5a26eb,_0x37a5da,_0x20a65b,_0x11b0dd,_0x5c01ae,_0xcbb909){var _0x2b8a2d,_0x365728,_0x3eda85,_0x5622f6;_0xcbb909['remoteUri']=intUtil[_0x02d5('0x47')](_0xcbb909['remoteUri']);if(_0x5c01ae&&_0x5c01ae[_0x02d5('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x37a5da[_0x02d5('0x49')]=util['format'](_0x02d5('0x4a'),_0xcbb909[_0x02d5('0x4b')],_0x37a5da[_0x02d5('0x4c')],md5(_0x37a5da[_0x02d5('0x4c')]));}else{_0x37a5da[_0x02d5('0x49')]='';}return getConnection(_0xcbb909)[_0x02d5('0x24')](function(_0x156044){_0x5622f6=_0x156044;return getUser(_0xcbb909,_0x11b0dd[_0x02d5('0x4d')],_0x5622f6);})[_0x02d5('0x24')](function(_0x53dd41){_0x2b8a2d=_0x53dd41;logger[_0x02d5('0x16')]('The\x20User\x20ID\x20is:',_0x2b8a2d['id']);return getEndUser(_0xcbb909,_0x37a5da[_0x02d5('0x4e')],_0x37a5da[_0x02d5('0x4f')],_0x5622f6);})['then'](function(_0x4fa04f){_0x365728=_0x4fa04f;logger[_0x02d5('0x16')](_0x02d5('0x50'),_0x365728['id']);return createTicket(_0xcbb909,_0x2b8a2d,_0x365728,_0x20a65b,_0x37a5da,_0x20a65b[_0x02d5('0x51')],_0x5622f6);})[_0x02d5('0x24')](function(_0x25b907){_0x3eda85=_0x25b907;logger[_0x02d5('0x16')](_0x02d5('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3eda85['id']);var _0x34cba6=util[_0x02d5('0x2f')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xcbb909[_0x02d5('0x20')],_['split'](_0x3eda85['id'],'x')[0x1]);logger['info'](_0x02d5('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x02d5('0x54'),_0x11b0dd[_0x02d5('0x14')]),_0x02d5('0x55'),{'uri':_0x34cba6});})[_0x02d5('0x28')](function(_0x3121b7){logger[_0x02d5('0x29')](_0x02d5('0x53'),JSON['stringify'](_0x3121b7));});};exports['outbound']=function(_0x5da013,_0x3477b2,_0x3e2d00,_0x59c6f6,_0x576661,_0x3b5488,_0x41ad86){var _0x2a492f,_0x5740c4,_0x2c6586,_0x327277;_0x3b5488[_0x02d5('0x20')]=intUtil['stripTrailingSlash'](_0x3b5488[_0x02d5('0x20')]);_0x3b5488['serverUrl']=intUtil[_0x02d5('0x47')](_0x3b5488['serverUrl']);if(_0x41ad86&&_0x41ad86['recordingFormat']&&_0x41ad86[_0x02d5('0x56')]!==_0x02d5('0x57')){logger['info']('[OUTBOUND]',_0x02d5('0x58'));_0x3477b2[_0x02d5('0x49')]=util[_0x02d5('0x2f')](_0x02d5('0x4a'),_0x3b5488['serverUrl'],_0x3477b2['uniqueid'],md5(_0x3477b2['uniqueid']));}return getConnection(_0x3b5488)[_0x02d5('0x24')](function(_0x5757fc){_0x327277=_0x5757fc;return getUser(_0x3b5488,_0x59c6f6[_0x02d5('0x4d')],_0x327277);})[_0x02d5('0x24')](function(_0x48b87b){_0x2a492f=_0x48b87b;logger[_0x02d5('0x16')](_0x02d5('0x59'),_0x2a492f['id']);return getEndUser(_0x3b5488,_0x3477b2[_0x02d5('0x5a')],_0x3477b2[_0x02d5('0x5b')],_0x327277);})['then'](function(_0x25b20d){_0x5740c4=_0x25b20d;logger[_0x02d5('0x16')](_0x02d5('0x50'),_0x5740c4['id']);return createTicket(_0x3b5488,_0x2a492f,_0x5740c4,_0x3e2d00,_0x3477b2,_0x3e2d00[_0x02d5('0x51')],_0x327277);})['then'](function(_0x1faa93){_0x2c6586=_0x1faa93;logger[_0x02d5('0x16')](_0x02d5('0x52'));logger['info'](_0x02d5('0x5c'),_0x2c6586['id']);var _0x1f5fde=util[_0x02d5('0x2f')](_0x02d5('0x5d'),_0x3b5488[_0x02d5('0x20')],_[_0x02d5('0x5e')](_0x2c6586['id'],'x')[0x1]);logger['info'](_0x02d5('0x5f'),_0x02d5('0x60'));emit(util[_0x02d5('0x2f')](_0x02d5('0x54'),_0x59c6f6[_0x02d5('0x14')]),_0x02d5('0x55'),{'uri':_0x1f5fde});})[_0x02d5('0x28')](function(_0x20c0a4){logger[_0x02d5('0x29')]('[OUTBOUND]',JSON[_0x02d5('0x27')](_0x20c0a4));});};exports[_0x02d5('0x61')]=function(_0x597162,_0x1c7428,_0x121b33,_0x3749e2,_0x28d51d,_0x399674){var _0xf47c8e,_0x2bb2e1,_0x3f956d,_0xe9a3f5;_0x399674[_0x02d5('0x20')]=intUtil['stripTrailingSlash'](_0x399674['remoteUri']);_0x399674['serverUrl']=intUtil['stripTrailingSlash'](_0x399674[_0x02d5('0x4b')]);if(_0x28d51d&&_0x28d51d[_0x02d5('0x48')]){logger[_0x02d5('0x16')]('['+_0x1c7428[_0x02d5('0x62')]['toUpperCase']()+']',_0x02d5('0x58'));_0x1c7428[_0x02d5('0x49')]=util[_0x02d5('0x2f')](_0x02d5('0x4a'),_0x399674['serverUrl'],_0x1c7428['uniqueid'],md5(_0x1c7428['uniqueid']));}else{_0x1c7428['recordingURL']='';}return getConnection(_0x399674)[_0x02d5('0x24')](function(_0x96263d){_0xe9a3f5=_0x96263d;return getUser(_0x399674,'',_0xe9a3f5);})[_0x02d5('0x24')](function(_0x3d77de){_0xf47c8e=_0x3d77de;logger['info'](_0x02d5('0x59'),_0xf47c8e['id']);return getEndUser(_0x399674,_0x1c7428[_0x02d5('0x4e')],_0x1c7428[_0x02d5('0x4f')],_0xe9a3f5);})[_0x02d5('0x24')](function(_0xfacb8d){_0x2bb2e1=_0xfacb8d;logger[_0x02d5('0x16')](_0x02d5('0x50'),_0x2bb2e1['id']);return createTicket(_0x399674,_0xf47c8e,_0x2bb2e1,_0x121b33,_0x1c7428,_0x121b33['Fields'],_0xe9a3f5);})[_0x02d5('0x24')](function(_0x485e2e){_0x3f956d=_0x485e2e;logger['info']('Ticket\x20created!');logger[_0x02d5('0x16')](_0x02d5('0x5c'),_0x3f956d['id']);})[_0x02d5('0x28')](function(_0x33b747){logger[_0x02d5('0x29')]('['+_0x1c7428[_0x02d5('0x62')][_0x02d5('0x63')]()+']',JSON[_0x02d5('0x27')](_0x33b747));});}; \ 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 2abed45..e9a6f88 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 _0xac76=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','username','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','string','customField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','%s/agent/tickets/%s','error','unmanaged','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first'];(function(_0x9777e8,_0x435ce7){var _0x14437f=function(_0xe69fb9){while(--_0xe69fb9){_0x9777e8['push'](_0x9777e8['shift']());}};_0x14437f(++_0x435ce7);}(_0xac76,0x12b));var _0x6ac7=function(_0x26e782,_0x2f9b47){_0x26e782=_0x26e782-0x0;var _0x823b67=_0xac76[_0x26e782];return _0x823b67;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6ac7('0x0'));var util=require(_0x6ac7('0x1'));var Redis=require(_0x6ac7('0x2'));var intUtil=require(_0x6ac7('0x3'));var config=require(_0x6ac7('0x4'));var logger=require(_0x6ac7('0x5'))(_0x6ac7('0x6'));config[_0x6ac7('0x7')]=_['defaults'](config[_0x6ac7('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6ac7('0x8'))(new Redis(config[_0x6ac7('0x7')]));function emit(_0x21d376,_0x486ab6,_0x33be42){io['to'](_0x21d376)[_0x6ac7('0x9')](_0x486ab6,_0x33be42);}var headers={'Content-Type':'application/json','Accept':_0x6ac7('0xa')};function getTicket(_0x6af5d9,_0x1f2d26,_0x2f9dd4,_0x45fda9,_0x4ef24f){logger[_0x6ac7('0xb')](_0x6ac7('0xc'));return request({'uri':util[_0x6ac7('0xd')](_0x6ac7('0xe'),_0x6af5d9[_0x6ac7('0xf')]),'method':'POST','body':{'ticket':_[_0x6ac7('0x10')]({'requester_id':_0x2f9dd4['id'],'submitter_id':_0x1f2d26?_0x1f2d26['id']:undefined,'assignee_id':_0x1f2d26?_0x1f2d26['id']:undefined,'tags':getTags(_0x45fda9['Tags'],_0x6ac7('0x11')),'subject':intUtil[_0x6ac7('0x12')](_0x45fda9[_0x6ac7('0x13')],_0x4ef24f,'\x20'),'description':intUtil['getString'](_0x45fda9[_0x6ac7('0x14')],_0x4ef24f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x45fda9[_0x6ac7('0x14')],_0x4ef24f,'\x0a')}},getCustomFields(_0x45fda9['Fields'],_0x4ef24f))}})['then'](function(_0x84e9f9){logger[_0x6ac7('0xb')](_0x6ac7('0x15'));return _0x84e9f9[_0x6ac7('0x16')];});}function getUser(_0x1217c6,_0x17d7cc){if(intUtil['validateEmail'](_0x17d7cc)){logger[_0x6ac7('0xb')](_0x6ac7('0x17'),_0x17d7cc);return request({'uri':util['format'](_0x6ac7('0x18'),_0x1217c6[_0x6ac7('0xf')]),'qs':{'query':util[_0x6ac7('0xd')](_0x6ac7('0x19'),_0x17d7cc)}})['then'](function(_0x2b3d43){if(_0x2b3d43[_0x6ac7('0x1a')]){logger[_0x6ac7('0xb')]('Agent\x20found!');return _[_0x6ac7('0x1b')](_0x2b3d43['results'],{'email':_0x17d7cc,'role':_0x6ac7('0x1c')});}else{logger[_0x6ac7('0xb')](_0x6ac7('0x1d'));return request({'uri':util['format'](_0x6ac7('0x1e'),_0x1217c6[_0x6ac7('0xf')])})[_0x6ac7('0x1f')](function(_0x1b514b){logger[_0x6ac7('0xb')]('Admin\x20account\x20selected.');return _0x1b514b[_0x6ac7('0x20')];});}});}else{logger[_0x6ac7('0xb')](_0x6ac7('0x1d'));return request({'uri':util[_0x6ac7('0xd')]('%s/users/me.json',_0x1217c6[_0x6ac7('0xf')])})[_0x6ac7('0x1f')](function(_0x4a30aa){logger[_0x6ac7('0xb')](_0x6ac7('0x21'));return _0x4a30aa['user'];});}}function getEndUser(_0x3c0049,_0x19e802,_0x3dbe0e){logger[_0x6ac7('0xb')]('Searching\x20enduser\x20with\x20phone',_0x3dbe0e);return request({'uri':util[_0x6ac7('0xd')]('%s/search.json',_0x3c0049[_0x6ac7('0xf')]),'qs':{'query':util['format'](_0x6ac7('0x22'),_0x3dbe0e)}})['then'](function(_0x4c4144){var _0x562672;if(_0x4c4144[_0x6ac7('0x23')][_0x6ac7('0x24')]){_0x4c4144['results']=_[_0x6ac7('0x25')](_0x4c4144[_0x6ac7('0x23')],{'suspended':![],'role':_0x6ac7('0x26')});if(_0x4c4144[_0x6ac7('0x23')][_0x6ac7('0x24')]){_0x562672=_[_0x6ac7('0x27')](_0x4c4144[_0x6ac7('0x23')]);}}if(_0x562672){logger['info'](_0x6ac7('0x28'));return _0x562672;}else{logger['info'](_0x6ac7('0x29'));return request({'uri':util['format'](_0x6ac7('0x2a'),_0x3c0049[_0x6ac7('0xf')]),'method':_0x6ac7('0x2b'),'body':{'user':{'role':_0x6ac7('0x26'),'name':util[_0x6ac7('0xd')](_0x6ac7('0x2c'),_0x19e802||_0x3dbe0e),'phone':_0x3dbe0e}}})[_0x6ac7('0x1f')](function(_0x1a6129){logger[_0x6ac7('0xb')](_0x6ac7('0x2d'));return _0x1a6129[_0x6ac7('0x20')];});}});}function getAuth(_0x336ed7){var _0x35deeb;if(_0x336ed7['authType']===_0x6ac7('0x2e')){_0x35deeb=util[_0x6ac7('0xd')](_0x6ac7('0x2f'),_0x336ed7['username'],_0x336ed7[_0x6ac7('0x2e')]);}else if(_0x336ed7[_0x6ac7('0x30')]===_0x6ac7('0x31')){_0x35deeb=util[_0x6ac7('0xd')](_0x6ac7('0x32'),_0x336ed7[_0x6ac7('0x33')],_0x336ed7[_0x6ac7('0x31')]);}return util[_0x6ac7('0xd')](_0x6ac7('0x34'),new Buffer(_0x35deeb)[_0x6ac7('0x35')]('base64'));}function request(_0xe1efe8){logger[_0x6ac7('0x36')](_0x6ac7('0x37'),JSON[_0x6ac7('0x38')](_0xe1efe8));return rp(_[_0x6ac7('0x39')](_0xe1efe8,{'method':_0x6ac7('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x46ad5a,_0x23a677){var _0x1be680=[];if(_0x46ad5a&&_0x46ad5a[_0x6ac7('0x24')]>0x0){_0x1be680=_[_0x6ac7('0x3b')](_0x46ad5a,_0x23a677);}return _0x1be680;}function getCustomFields(_0x3f674d,_0x1f5e8e){var _0x355a8c=[];var _0x2e92b0={'custom_fields':[]};if(_0x3f674d[_0x6ac7('0x24')]>0x0){_[_0x6ac7('0x3c')](_0x3f674d,function(_0x98b740){if(_0x98b740[_0x6ac7('0x3d')]===_0x6ac7('0x3e')&&_0x98b740['nameField']&&!_0x98b740[_0x6ac7('0x3f')]){_0x2e92b0[_0x98b740['nameField'][_0x6ac7('0x40')]()]=_0x98b740['content'][_0x6ac7('0x35')]();}else if(_0x98b740[_0x6ac7('0x3d')]===_0x6ac7('0x3e')&&_0x98b740[_0x6ac7('0x41')]&&_0x98b740[_0x6ac7('0x3f')]){_0x2e92b0[_0x6ac7('0x42')][_0x6ac7('0x43')]({'id':_0x98b740['idField'],'value':_0x98b740[_0x6ac7('0x44')][_0x6ac7('0x35')]()});}else if(_0x98b740['type']===_0x6ac7('0x45')&&_0x98b740[_0x6ac7('0x46')]&&_0x98b740[_0x6ac7('0x41')]&&_0x98b740[_0x6ac7('0x3f')]){_0x1f5e8e[_0x98b740['variableName']]&&_0x2e92b0[_0x6ac7('0x42')]['push']({'id':_0x98b740['idField'],'value':_0x1f5e8e[_0x98b740[_0x6ac7('0x46')]][_0x6ac7('0x35')]()});}else if(_0x98b740[_0x6ac7('0x3d')]===_0x6ac7('0x47')&&_0x98b740['Variable']&&_0x98b740[_0x6ac7('0x48')]['name']&&_0x98b740['idField']&&_0x98b740[_0x6ac7('0x3f')]){_0x1f5e8e[_0x98b740[_0x6ac7('0x48')]['name'][_0x6ac7('0x40')]()]&&_0x2e92b0[_0x6ac7('0x42')][_0x6ac7('0x43')]({'id':_0x98b740[_0x6ac7('0x41')],'value':_0x1f5e8e[_0x98b740['Variable']['name'][_0x6ac7('0x40')]()][_0x6ac7('0x35')]()});}});}return _0x2e92b0;}exports[_0x6ac7('0x49')]=function(_0x513168,_0x3fc40f,_0x428888,_0x35853e,_0x2f0103,_0x42351c){var _0x36c20e,_0x2eb5b6;_0x42351c['remoteUri']=intUtil['stripTrailingSlash'](_0x42351c['remoteUri']);_0x42351c[_0x6ac7('0x4a')]=intUtil[_0x6ac7('0x4b')](_0x42351c['serverUrl']);if(_0x2f0103&&_0x2f0103[_0x6ac7('0x4c')]){logger['info']('[QUEUE]',_0x6ac7('0x4d'));_0x3fc40f['recordingURL']=util[_0x6ac7('0xd')](_0x6ac7('0x4e'),_0x42351c[_0x6ac7('0x4a')],_0x3fc40f[_0x6ac7('0x4f')],md5(_0x3fc40f[_0x6ac7('0x4f')]));}else{_0x3fc40f[_0x6ac7('0x50')]='';}headers[_0x6ac7('0x51')]=getAuth(_0x42351c);return getUser(_0x42351c,_0x35853e['email'])[_0x6ac7('0x1f')](function(_0x40d7eb){_0x36c20e=_0x40d7eb;logger[_0x6ac7('0xb')](_0x6ac7('0x52'),_0x36c20e['id']);return getEndUser(_0x42351c,_0x3fc40f[_0x6ac7('0x53')],_0x3fc40f['calleridnum']);})[_0x6ac7('0x1f')](function(_0x567302){_0x2eb5b6=_0x567302;logger['info'](_0x6ac7('0x54'),_0x2eb5b6['id']);return getTicket(_0x42351c,_0x36c20e,_0x2eb5b6,_0x428888,_0x3fc40f);})['then'](function(_0x595e77){if(_0x595e77){logger['info'](_0x6ac7('0x55'),_0x595e77['id']);switch(_0x42351c[_0x6ac7('0x3d')]){case'integrationTab':logger[_0x6ac7('0xb')](_0x6ac7('0x56'),_0x6ac7('0x57'));return request({'uri':util['format'](_0x6ac7('0x58'),_0x42351c['remoteUri'],_0x36c20e['id'],_0x595e77['id']),'method':'POST'});case _0x6ac7('0x59'):logger['info'](_0x6ac7('0x56'),_0x6ac7('0x5a'));emit(util['format'](_0x6ac7('0x5b'),_0x35853e[_0x6ac7('0x11')]),_0x6ac7('0x5c'),{'uri':util['format']('%s/agent/tickets/%s',_0x42351c['remoteUri'][_0x6ac7('0x5d')](_0x6ac7('0x5e'),''),_0x595e77['id'])});break;default:logger['error']('[QUEUE]',_0x6ac7('0x5f'));}}})[_0x6ac7('0x60')](function(_0x180b98){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x6ac7('0x61')](_0x180b98,{'showHidden':!![],'depth':null}));});};exports[_0x6ac7('0x62')]=function(_0x2a335c,_0x1230ea,_0x177e20,_0x59988b,_0x1f0237,_0x50c464,_0x1389a7){var _0x576856,_0x36a943;_0x50c464[_0x6ac7('0xf')]=intUtil[_0x6ac7('0x4b')](_0x50c464[_0x6ac7('0xf')]);_0x50c464[_0x6ac7('0x4a')]=intUtil['stripTrailingSlash'](_0x50c464['serverUrl']);if(_0x1389a7&&_0x1389a7[_0x6ac7('0x63')]&&_0x1389a7[_0x6ac7('0x63')]!==_0x6ac7('0x64')){logger[_0x6ac7('0xb')]('[OUTBOUND]',_0x6ac7('0x4d'));_0x1230ea['recordingURL']=util[_0x6ac7('0xd')](_0x6ac7('0x4e'),_0x50c464[_0x6ac7('0x4a')],_0x1230ea[_0x6ac7('0x4f')],md5(_0x1230ea[_0x6ac7('0x4f')]));}headers['Authorization']=getAuth(_0x50c464);return getUser(_0x50c464,_0x59988b[_0x6ac7('0x65')])['then'](function(_0x4f8655){_0x576856=_0x4f8655;logger['info'](_0x6ac7('0x52'),_0x576856['id']);return getEndUser(_0x50c464,_0x1230ea[_0x6ac7('0x66')],_0x1230ea[_0x6ac7('0x67')]);})[_0x6ac7('0x1f')](function(_0x30563a){_0x36a943=_0x30563a;logger[_0x6ac7('0xb')](_0x6ac7('0x54'),_0x36a943['id']);return getTicket(_0x50c464,_0x576856,_0x36a943,_0x177e20,_0x1230ea);})['then'](function(_0x3da46f){if(_0x3da46f){logger['info'](_0x6ac7('0x55'),_0x3da46f['id']);switch(_0x50c464['type']){case _0x6ac7('0x68'):logger[_0x6ac7('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x6ac7('0x58'),_0x50c464[_0x6ac7('0xf')],_0x576856['id'],_0x3da46f['id']),'method':_0x6ac7('0x2b')});case _0x6ac7('0x59'):logger[_0x6ac7('0xb')](_0x6ac7('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6ac7('0xd')](_0x6ac7('0x5b'),_0x59988b[_0x6ac7('0x11')]),_0x6ac7('0x5c'),{'uri':util[_0x6ac7('0xd')](_0x6ac7('0x6a'),_0x50c464[_0x6ac7('0xf')]['replace'](_0x6ac7('0x5e'),''),_0x3da46f['id'])});break;default:logger[_0x6ac7('0x6b')]('[OUTBOUND]',_0x6ac7('0x5f'));}}})[_0x6ac7('0x60')](function(_0x581182){logger[_0x6ac7('0x6b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x6ac7('0x61')](_0x581182,{'showHidden':!![],'depth':null}));});};exports[_0x6ac7('0x6c')]=function(_0x123f9e,_0x1e076c,_0x529cba,_0x49d245,_0x38c147,_0x328798){var _0x21517f,_0x4cd585;_0x328798[_0x6ac7('0xf')]=intUtil[_0x6ac7('0x4b')](_0x328798[_0x6ac7('0xf')]);_0x328798[_0x6ac7('0x4a')]=intUtil[_0x6ac7('0x4b')](_0x328798[_0x6ac7('0x4a')]);if(_0x38c147&&_0x38c147['monitor_format']){logger[_0x6ac7('0xb')]('['+_0x1e076c['lastevent'][_0x6ac7('0x6d')]()+']',_0x6ac7('0x4d'));_0x1e076c[_0x6ac7('0x50')]=util[_0x6ac7('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x328798['serverUrl'],_0x1e076c[_0x6ac7('0x4f')],md5(_0x1e076c[_0x6ac7('0x4f')]));}else{_0x1e076c[_0x6ac7('0x50')]='';}headers[_0x6ac7('0x51')]=getAuth(_0x328798);return getUser(_0x328798)[_0x6ac7('0x1f')](function(_0x43a7ab){_0x21517f=_0x43a7ab;logger['info'](_0x6ac7('0x52'),_0x21517f['id']);return getEndUser(_0x328798,_0x1e076c['calleridname'],_0x1e076c[_0x6ac7('0x6e')]);})['then'](function(_0x9b040){_0x4cd585=_0x9b040;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4cd585['id']);return getTicket(_0x328798,_0x21517f,_0x4cd585,_0x529cba,_0x1e076c);})[_0x6ac7('0x1f')](function(_0x776637){if(_0x776637){logger[_0x6ac7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x776637['id']);}})[_0x6ac7('0x60')](function(_0x52bae9){logger[_0x6ac7('0x6b')]('['+_0x1e076c[_0x6ac7('0x6f')]['toUpperCase']()+']'+_0x6ac7('0x70'),util['inspect'](_0x52bae9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5646=['[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','end-user','length','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','toString','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0xa7c20e,_0x106202){var _0x53cddf=function(_0x2410ae){while(--_0x2410ae){_0xa7c20e['push'](_0xa7c20e['shift']());}};_0x53cddf(++_0x106202);}(_0x5646,0x1b8));var _0x6564=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x5646[_0x2b4448];return _0xb4b465;};'use strict';var _=require(_0x6564('0x0'));var rp=require(_0x6564('0x1'));var md5=require(_0x6564('0x2'));var util=require(_0x6564('0x3'));var Redis=require(_0x6564('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x6564('0x5'));config[_0x6564('0x6')]=_[_0x6564('0x7')](config['redis'],{'host':_0x6564('0x8'),'port':0x18eb});var io=require(_0x6564('0x9'))(new Redis(config[_0x6564('0x6')]));function emit(_0x296800,_0x308026,_0x4b6c9f){io['to'](_0x296800)['emit'](_0x308026,_0x4b6c9f);}var headers={'Content-Type':_0x6564('0xa'),'Accept':'application/json'};function getTicket(_0x4826cf,_0x3d10c2,_0x5da893,_0x5d13fb,_0x12d7d2){logger[_0x6564('0xb')](_0x6564('0xc'));return request({'uri':util[_0x6564('0xd')](_0x6564('0xe'),_0x4826cf[_0x6564('0xf')]),'method':_0x6564('0x10'),'body':{'ticket':_[_0x6564('0x11')]({'requester_id':_0x5da893['id'],'submitter_id':_0x3d10c2?_0x3d10c2['id']:undefined,'assignee_id':_0x3d10c2?_0x3d10c2['id']:undefined,'tags':getTags(_0x5d13fb['Tags'],'name'),'subject':intUtil[_0x6564('0x12')](_0x5d13fb['Subjects'],_0x12d7d2,'\x20'),'description':intUtil['getString'](_0x5d13fb[_0x6564('0x13')],_0x12d7d2,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6564('0x12')](_0x5d13fb[_0x6564('0x13')],_0x12d7d2,'\x0a')}},getCustomFields(_0x5d13fb[_0x6564('0x14')],_0x12d7d2))}})[_0x6564('0x15')](function(_0x3c69a2){logger['info'](_0x6564('0x16'));return _0x3c69a2[_0x6564('0x17')];});}function getUser(_0x509330,_0x42811a){if(intUtil[_0x6564('0x18')](_0x42811a)){logger[_0x6564('0xb')](_0x6564('0x19'),_0x42811a);return request({'uri':util[_0x6564('0xd')](_0x6564('0x1a'),_0x509330[_0x6564('0xf')]),'qs':{'query':util['format'](_0x6564('0x1b'),_0x42811a)}})['then'](function(_0x376a42){if(_0x376a42[_0x6564('0x1c')]){logger[_0x6564('0xb')](_0x6564('0x1d'));return _['find'](_0x376a42[_0x6564('0x1e')],{'email':_0x42811a,'role':_0x6564('0x1f')});}else{logger[_0x6564('0xb')](_0x6564('0x20'));return request({'uri':util[_0x6564('0xd')](_0x6564('0x21'),_0x509330['remoteUri'])})[_0x6564('0x15')](function(_0xbc75bb){logger[_0x6564('0xb')](_0x6564('0x22'));return _0xbc75bb['user'];});}});}else{logger[_0x6564('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6564('0xd')](_0x6564('0x21'),_0x509330[_0x6564('0xf')])})[_0x6564('0x15')](function(_0x9f1920){logger[_0x6564('0xb')](_0x6564('0x22'));return _0x9f1920[_0x6564('0x23')];});}}function getEndUser(_0x4c6c8e,_0x5b064d,_0x4775a2){logger[_0x6564('0xb')]('Searching\x20enduser\x20with\x20phone',_0x4775a2);return request({'uri':util['format'](_0x6564('0x1a'),_0x4c6c8e[_0x6564('0xf')]),'qs':{'query':util['format'](_0x6564('0x24'),_0x4775a2)}})[_0x6564('0x15')](function(_0x4564bc){var _0x459b27;if(_0x4564bc[_0x6564('0x1e')]['length']){_0x4564bc[_0x6564('0x1e')]=_['filter'](_0x4564bc[_0x6564('0x1e')],{'suspended':![],'role':_0x6564('0x25')});if(_0x4564bc[_0x6564('0x1e')][_0x6564('0x26')]){_0x459b27=_[_0x6564('0x27')](_0x4564bc[_0x6564('0x1e')]);}}if(_0x459b27){logger[_0x6564('0xb')](_0x6564('0x28'));return _0x459b27;}else{logger[_0x6564('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x6564('0xd')](_0x6564('0x29'),_0x4c6c8e[_0x6564('0xf')]),'method':_0x6564('0x10'),'body':{'user':{'role':_0x6564('0x25'),'name':util[_0x6564('0xd')]('Caller\x20-\x20%s',_0x5b064d||_0x4775a2),'phone':_0x4775a2}}})[_0x6564('0x15')](function(_0x1bc8ea){logger['info'](_0x6564('0x2a'));return _0x1bc8ea['user'];});}});}function getAuth(_0x4007b0){var _0x1bfa1f;if(_0x4007b0[_0x6564('0x2b')]===_0x6564('0x2c')){_0x1bfa1f=util['format'](_0x6564('0x2d'),_0x4007b0[_0x6564('0x2e')],_0x4007b0[_0x6564('0x2c')]);}else if(_0x4007b0[_0x6564('0x2b')]==='token'){_0x1bfa1f=util[_0x6564('0xd')](_0x6564('0x2f'),_0x4007b0[_0x6564('0x2e')],_0x4007b0[_0x6564('0x30')]);}return util[_0x6564('0xd')]('Basic\x20%s',new Buffer(_0x1bfa1f)[_0x6564('0x31')]('base64'));}function request(_0x5d1fba){logger[_0x6564('0x32')](_0x6564('0x33'),JSON[_0x6564('0x34')](_0x5d1fba));return rp(_[_0x6564('0x7')](_0x5d1fba,{'method':_0x6564('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x363ca9,_0x329ee8){var _0x2b6d8f=[];if(_0x363ca9&&_0x363ca9[_0x6564('0x26')]>0x0){_0x2b6d8f=_[_0x6564('0x36')](_0x363ca9,_0x329ee8);}return _0x2b6d8f;}function getCustomFields(_0x1b6c43,_0x140cfa){var _0x2952ed=[];var _0x49b95d={'custom_fields':[]};if(_0x1b6c43['length']>0x0){_[_0x6564('0x37')](_0x1b6c43,function(_0x521621){if(_0x521621[_0x6564('0x38')]===_0x6564('0x39')&&_0x521621[_0x6564('0x3a')]&&!_0x521621[_0x6564('0x3b')]){_0x49b95d[_0x521621[_0x6564('0x3a')][_0x6564('0x3c')]()]=_0x521621[_0x6564('0x3d')]['toString']();}else if(_0x521621[_0x6564('0x38')]===_0x6564('0x39')&&_0x521621[_0x6564('0x3e')]&&_0x521621[_0x6564('0x3b')]){_0x49b95d[_0x6564('0x3f')][_0x6564('0x40')]({'id':_0x521621[_0x6564('0x3e')],'value':_0x521621[_0x6564('0x3d')][_0x6564('0x31')]()});}else if(_0x521621[_0x6564('0x38')]===_0x6564('0x41')&&_0x521621[_0x6564('0x42')]&&_0x521621[_0x6564('0x3e')]&&_0x521621[_0x6564('0x3b')]){_0x140cfa[_0x521621[_0x6564('0x42')]]&&_0x49b95d['custom_fields']['push']({'id':_0x521621[_0x6564('0x3e')],'value':_0x140cfa[_0x521621[_0x6564('0x42')]][_0x6564('0x31')]()});}else if(_0x521621['type']===_0x6564('0x43')&&_0x521621['Variable']&&_0x521621[_0x6564('0x44')]['name']&&_0x521621[_0x6564('0x3e')]&&_0x521621[_0x6564('0x3b')]){_0x140cfa[_0x521621[_0x6564('0x44')][_0x6564('0x45')][_0x6564('0x3c')]()]&&_0x49b95d[_0x6564('0x3f')][_0x6564('0x40')]({'id':_0x521621[_0x6564('0x3e')],'value':_0x140cfa[_0x521621['Variable'][_0x6564('0x45')][_0x6564('0x3c')]()][_0x6564('0x31')]()});}});}return _0x49b95d;}exports[_0x6564('0x46')]=function(_0x568118,_0x2d1ae2,_0x400e04,_0x1fcf8d,_0x4a02d1,_0x5bc47f){var _0x31da2f,_0x58b77b;_0x5bc47f[_0x6564('0xf')]=intUtil[_0x6564('0x47')](_0x5bc47f[_0x6564('0xf')]);_0x5bc47f[_0x6564('0x48')]=intUtil[_0x6564('0x47')](_0x5bc47f['serverUrl']);if(_0x4a02d1&&_0x4a02d1['monitor_format']){logger['info'](_0x6564('0x49'),_0x6564('0x4a'));_0x2d1ae2[_0x6564('0x4b')]=util[_0x6564('0xd')](_0x6564('0x4c'),_0x5bc47f[_0x6564('0x48')],_0x2d1ae2[_0x6564('0x4d')],md5(_0x2d1ae2[_0x6564('0x4d')]));}else{_0x2d1ae2[_0x6564('0x4b')]='';}headers['Authorization']=getAuth(_0x5bc47f);return getUser(_0x5bc47f,_0x1fcf8d['email'])[_0x6564('0x15')](function(_0x16cee4){_0x31da2f=_0x16cee4;logger[_0x6564('0xb')](_0x6564('0x4e'),_0x31da2f['id']);return getEndUser(_0x5bc47f,_0x2d1ae2['calleridname'],_0x2d1ae2['calleridnum']);})['then'](function(_0x1c7920){_0x58b77b=_0x1c7920;logger[_0x6564('0xb')](_0x6564('0x4f'),_0x58b77b['id']);return getTicket(_0x5bc47f,_0x31da2f,_0x58b77b,_0x400e04,_0x2d1ae2);})[_0x6564('0x15')](function(_0x2e6c7f){if(_0x2e6c7f){logger[_0x6564('0xb')](_0x6564('0x50'),_0x2e6c7f['id']);switch(_0x5bc47f[_0x6564('0x38')]){case'integrationTab':logger['info'](_0x6564('0x49'),_0x6564('0x51'));return request({'uri':util['format'](_0x6564('0x52'),_0x5bc47f['remoteUri'],_0x31da2f['id'],_0x2e6c7f['id']),'method':_0x6564('0x10')});case _0x6564('0x53'):logger[_0x6564('0xb')](_0x6564('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6564('0x54'),_0x1fcf8d[_0x6564('0x45')]),_0x6564('0x55'),{'uri':util[_0x6564('0xd')](_0x6564('0x56'),_0x5bc47f[_0x6564('0xf')]['replace'](_0x6564('0x57'),''),_0x2e6c7f['id'])});break;default:logger[_0x6564('0x58')](_0x6564('0x49'),_0x6564('0x59'));}}})[_0x6564('0x5a')](function(_0x1acccb){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1acccb,{'showHidden':!![],'depth':null}));});};exports[_0x6564('0x5b')]=function(_0x4d0002,_0x4f8771,_0x175bce,_0x40001d,_0x20ce34,_0xa1e2c6,_0x114e11){var _0x5f5079,_0x46baac;_0xa1e2c6[_0x6564('0xf')]=intUtil[_0x6564('0x47')](_0xa1e2c6[_0x6564('0xf')]);_0xa1e2c6[_0x6564('0x48')]=intUtil[_0x6564('0x47')](_0xa1e2c6[_0x6564('0x48')]);if(_0x114e11&&_0x114e11['recordingFormat']&&_0x114e11[_0x6564('0x5c')]!==_0x6564('0x5d')){logger[_0x6564('0xb')](_0x6564('0x5e'),_0x6564('0x4a'));_0x4f8771[_0x6564('0x4b')]=util[_0x6564('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa1e2c6[_0x6564('0x48')],_0x4f8771[_0x6564('0x4d')],md5(_0x4f8771[_0x6564('0x4d')]));}headers[_0x6564('0x5f')]=getAuth(_0xa1e2c6);return getUser(_0xa1e2c6,_0x40001d[_0x6564('0x60')])[_0x6564('0x15')](function(_0x3dc2fe){_0x5f5079=_0x3dc2fe;logger['info'](_0x6564('0x4e'),_0x5f5079['id']);return getEndUser(_0xa1e2c6,_0x4f8771[_0x6564('0x61')],_0x4f8771[_0x6564('0x62')]);})[_0x6564('0x15')](function(_0xa3336a){_0x46baac=_0xa3336a;logger[_0x6564('0xb')](_0x6564('0x4f'),_0x46baac['id']);return getTicket(_0xa1e2c6,_0x5f5079,_0x46baac,_0x175bce,_0x4f8771);})[_0x6564('0x15')](function(_0x4a8772){if(_0x4a8772){logger[_0x6564('0xb')](_0x6564('0x50'),_0x4a8772['id']);switch(_0xa1e2c6['type']){case'integrationTab':logger[_0x6564('0xb')](_0x6564('0x5e'),_0x6564('0x51'));return request({'uri':util[_0x6564('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xa1e2c6[_0x6564('0xf')],_0x5f5079['id'],_0x4a8772['id']),'method':_0x6564('0x10')});case _0x6564('0x53'):logger[_0x6564('0xb')](_0x6564('0x5e'),_0x6564('0x63'));emit(util[_0x6564('0xd')](_0x6564('0x54'),_0x40001d['name']),_0x6564('0x55'),{'uri':util[_0x6564('0xd')](_0x6564('0x56'),_0xa1e2c6[_0x6564('0xf')]['replace'](_0x6564('0x57'),''),_0x4a8772['id'])});break;default:logger[_0x6564('0x58')](_0x6564('0x5e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6564('0x5a')](function(_0x3609f6){logger[_0x6564('0x58')](_0x6564('0x64'),util[_0x6564('0x65')](_0x3609f6,{'showHidden':!![],'depth':null}));});};exports[_0x6564('0x66')]=function(_0x10a730,_0x4ebfb4,_0x3dd39c,_0x4a348f,_0x5e8dcf,_0x21d855){var _0x42b149,_0x4d0f32;_0x21d855[_0x6564('0xf')]=intUtil[_0x6564('0x47')](_0x21d855[_0x6564('0xf')]);_0x21d855[_0x6564('0x48')]=intUtil['stripTrailingSlash'](_0x21d855[_0x6564('0x48')]);if(_0x5e8dcf&&_0x5e8dcf[_0x6564('0x67')]){logger[_0x6564('0xb')]('['+_0x4ebfb4[_0x6564('0x68')][_0x6564('0x69')]()+']',_0x6564('0x4a'));_0x4ebfb4[_0x6564('0x4b')]=util[_0x6564('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21d855[_0x6564('0x48')],_0x4ebfb4['uniqueid'],md5(_0x4ebfb4[_0x6564('0x4d')]));}else{_0x4ebfb4['recordingURL']='';}headers[_0x6564('0x5f')]=getAuth(_0x21d855);return getUser(_0x21d855)[_0x6564('0x15')](function(_0x4fea1b){_0x42b149=_0x4fea1b;logger[_0x6564('0xb')](_0x6564('0x4e'),_0x42b149['id']);return getEndUser(_0x21d855,_0x4ebfb4['calleridname'],_0x4ebfb4[_0x6564('0x6a')]);})[_0x6564('0x15')](function(_0x31d880){_0x4d0f32=_0x31d880;logger[_0x6564('0xb')](_0x6564('0x4f'),_0x4d0f32['id']);return getTicket(_0x21d855,_0x42b149,_0x4d0f32,_0x3dd39c,_0x4ebfb4);})[_0x6564('0x15')](function(_0x1f9af0){if(_0x1f9af0){logger[_0x6564('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1f9af0['id']);}})['catch'](function(_0x53ad39){logger[_0x6564('0x58')]('['+_0x4ebfb4[_0x6564('0x68')][_0x6564('0x69')]()+']'+_0x6564('0x6b'),util[_0x6564('0x65')](_0x53ad39,{'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 ae7caf2..891507a 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 _0x8dd1=['err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','[OUTBOUND]','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','info','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','What_Id','Last_Name','talktime','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','called','Called','complete','connect','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','Zoho-oauthtoken\x20'];(function(_0x30cf13,_0x3fd023){var _0x5e15e3=function(_0x2ffc7d){while(--_0x2ffc7d){_0x30cf13['push'](_0x30cf13['shift']());}};_0x5e15e3(++_0x3fd023);}(_0x8dd1,0x1e5));var _0x18dd=function(_0x20a725,_0x3c8c95){_0x20a725=_0x20a725-0x0;var _0xedc192=_0x8dd1[_0x20a725];return _0xedc192;};'use strict';var _=require(_0x18dd('0x0'));var rp=require(_0x18dd('0x1'));var md5=require(_0x18dd('0x2'));var util=require('util');var intUtil=require(_0x18dd('0x3'));var moment=require('moment');var Redis=require(_0x18dd('0x4'));var BPromise=require(_0x18dd('0x5'));var config=require(_0x18dd('0x6'));var logger=require(_0x18dd('0x7'))('zoho');config[_0x18dd('0x8')]=_[_0x18dd('0x9')](config[_0x18dd('0x8')],{'host':_0x18dd('0xa'),'port':0x18eb});var io=require(_0x18dd('0xb'))(new Redis(config[_0x18dd('0x8')]));function emit(_0x4e2363,_0x5026de,_0x348663){io['to'](_0x4e2363)['emit'](_0x5026de,_0x348663);}function request(_0x426a4a){logger[_0x18dd('0xc')](_0x18dd('0xd'),JSON[_0x18dd('0xe')](_0x426a4a));return rp(_0x426a4a);}function getCustomFields(_0x36568b,_0x1dccf5){var _0x7faf3e={};if(_0x36568b['length']>0x0){_[_0x18dd('0xf')](_0x36568b,function(_0x337886){if(_0x337886[_0x18dd('0x10')]===_0x18dd('0x11')&&_0x337886[_0x18dd('0x12')]){_0x7faf3e[_0x337886['idField']]=_0x337886[_0x18dd('0x13')][_0x18dd('0x14')]();}else if(_0x337886[_0x18dd('0x10')]===_0x18dd('0x15')&&_0x337886[_0x18dd('0x16')]&&_0x337886[_0x18dd('0x12')]&&_0x1dccf5[_0x337886[_0x18dd('0x16')]]){_0x7faf3e[_0x337886[_0x18dd('0x12')]]=_0x1dccf5[_0x337886[_0x18dd('0x16')]]['toString']();}else if(_0x337886[_0x18dd('0x10')]===_0x18dd('0x17')&&_0x337886[_0x18dd('0x18')]&&_0x337886['Variable'][_0x18dd('0x19')]&&_0x337886[_0x18dd('0x12')]&&_0x1dccf5[_0x337886['Variable'][_0x18dd('0x19')][_0x18dd('0x1a')]()]){_0x7faf3e[_0x337886[_0x18dd('0x12')]]=_0x1dccf5[_0x337886[_0x18dd('0x18')][_0x18dd('0x19')]['toLowerCase']()]['toString']();}});}return _0x7faf3e;}function getName(_0x2c82a2){if(_0x2c82a2[_0x18dd('0x1b')]('\x20')>0x0){var _0x3427ec=_0x2c82a2[_0x18dd('0x1c')](/ (.+)/);if(_0x3427ec[0x1]){return _0x3427ec;}}return[_0x2c82a2,_0x2c82a2];}var accountsTokens={};function getAccessToken(_0x2f7875){return new Promise(function(_0x63a095,_0x382fef){if(!_[_0x18dd('0x1d')](accountsTokens[_0x2f7875['id']])&&!_['isNil'](accountsTokens[_0x2f7875['id']][_0x18dd('0x1e')])){if(moment()[_0x18dd('0x1f')](accountsTokens[_0x2f7875['id']]['expires_in'])){_0x63a095(accountsTokens[_0x2f7875['id']][_0x18dd('0x1e')]);}}var _0x5cae41;switch(_0x2f7875[_0x18dd('0x20')]){case'US':_0x5cae41=_0x18dd('0x21');break;case'AU':_0x5cae41=_0x18dd('0x22');break;case'EU':_0x5cae41='https://accounts.zoho.eu';break;case'IN':_0x5cae41=_0x18dd('0x23');break;case'CN':_0x5cae41='https://accounts.zoho.com.cn';break;default:_0x5cae41=_0x18dd('0x24');break;}var _0x316100={'method':'POST','uri':_0x5cae41+_0x18dd('0x25'),'qs':{'refresh_token':_0x2f7875[_0x18dd('0x26')],'client_id':_0x2f7875[_0x18dd('0x27')],'client_secret':_0x2f7875[_0x18dd('0x28')],'grant_type':_0x18dd('0x29')},'json':!![]};return rp(_0x316100)[_0x18dd('0x2a')](function(_0x3e194e){accountsTokens[_0x2f7875['id']]={'access_token':_0x3e194e[_0x18dd('0x1e')],'expires_in':moment()[_0x18dd('0x2b')](_0x3e194e[_0x18dd('0x2c')],_0x18dd('0x2d'))};_0x63a095(_0x3e194e[_0x18dd('0x1e')]);})[_0x18dd('0x2e')](function(_0x95207c){logger[_0x18dd('0x2f')]('Failing\x20creating\x20the\x20access_token',_0x95207c[_0x18dd('0x30')]);_0x382fef(_0x95207c);});});}function getUser(_0x5b4516,_0x5a67df,_0x1419a9,_0x487d01){logger['info'](_0x18dd('0x31'));return request({'method':_0x18dd('0x32'),'uri':util[_0x18dd('0x33')](_0x18dd('0x34'),_0x5a67df),'qs':{'type':_0x18dd('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5b4516},'json':!![]})[_0x18dd('0x2a')](function(_0x3bae34){if(_0x3bae34[_0x18dd('0x36')]){var _0xb059d8=-0x1;if(_[_0x18dd('0x37')](_0x3bae34['users'])){if(!_[_0x18dd('0x1d')](_0x487d01)){_0xb059d8=_[_0x18dd('0x38')](_0x3bae34[_0x18dd('0x36')],function(_0x9385b0){return _0x9385b0[_0x18dd('0x39')]===_0x487d01;});}if(_0xb059d8>=0x0){logger[_0x18dd('0x3a')]('Agent\x20found!');}else{logger[_0x18dd('0x3a')]('Using\x20the\x20admin\x20account!');_0xb059d8=_[_0x18dd('0x38')](_0x3bae34['users'],function(_0xfaaf30){return _0xfaaf30['profile'][_0x18dd('0x19')]==='Administrator';});}return _0x3bae34[_0x18dd('0x36')][_0xb059d8];}else{if(_0x3bae34[_0x18dd('0x3b')]['profile']['name']==='Administrator'){logger[_0x18dd('0x3a')]('Using\x20the\x20admin\x20account!');user=_0x3bae34[_0x18dd('0x3b')];return user;}else{logger['error'](_0x18dd('0x3c'),JSON[_0x18dd('0xe')](_0x3bae34));throw new Error(_0x18dd('0x3d')+JSON[_0x18dd('0xe')](_0x3bae34));}}}else{logger[_0x18dd('0x2f')](_0x18dd('0x3c'),JSON[_0x18dd('0xe')](_0x3bae34));throw new Error(_0x18dd('0x3d')+JSON[_0x18dd('0xe')](_0x3bae34));}})[_0x18dd('0x2e')](function(_0x4dc1b4){console['error'](_0x4dc1b4);});}function getZohoUser(_0x1da523,_0x2f1dd9){return new BPromise(function(_0x54e0ca,_0x39662e){request(_0x1da523)[_0x18dd('0x2a')](function(_0x5c4811){var _0xb0046c=null;if(_0x5c4811){_0xb0046c=_0x5c4811['data'][0x0];_0xb0046c[_0x18dd('0x3e')]=_0x2f1dd9;}_0x54e0ca(_0xb0046c);})['catch'](function(_0x295090){_0x39662e(_0x295090);});});}function createEndUser(_0x4af606,_0x51ebf5,_0x5ee322,_0xad89df,_0x37eb69,_0x18e54c){var _0x5ee322=getName(_0x5ee322);return request({'method':_0x18dd('0x3f'),'uri':_0x18dd('0x40')+_0x51ebf5+_0x18dd('0x41')+_[_0x18dd('0x42')](_0x18e54c[_0x18dd('0x43')])+'s','body':{'data':[{'Last_Name':_0x5ee322[0x1],'First_Name':_0x5ee322[0x0],'Phone':_0xad89df,'Owner':{'name':!_['isNil'](_0x37eb69[_0x18dd('0x44')][_0x18dd('0x19')])?_0x37eb69[_0x18dd('0x44')][_0x18dd('0x19')]:!_['isNil'](_0x37eb69[_0x18dd('0x45')])?_0x37eb69[_0x18dd('0x45')]+'\x20'+_0x37eb69[_0x18dd('0x46')]:_0x37eb69[_0x18dd('0x46')],'id':_0x37eb69['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4af606},'json':!![]})[_0x18dd('0x2a')](function(_0x329cc8){if(_0x329cc8&&_0x329cc8[_0x18dd('0x47')][0x0][_0x18dd('0x48')]===_0x18dd('0x49')){var _0x59648a=_0x329cc8[_0x18dd('0x47')][0x0][_0x18dd('0x4a')];_0x59648a['enduserType']=_['startCase'](_0x18e54c[_0x18dd('0x43')])+'s';return _0x59648a;}logger[_0x18dd('0x2f')](_0x18dd('0x3c'),JSON[_0x18dd('0xe')](data));throw new Error(_0x18dd('0x4b')+JSON[_0x18dd('0xe')](data));})[_0x18dd('0x2e')](function(_0x16dc79){console[_0x18dd('0x4c')](_0x18dd('0x4d'),_0x16dc79);});}function getEndUser(_0x46d32f,_0xd57bb5,_0x3f9331,_0x34f7db,_0x4f0ece,_0x17c9f0,_0x553e5a){var _0x4bc960={'method':_0x18dd('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x46d32f},'json':!![]};switch(_0x553e5a[_0x18dd('0x4e')]){case _0x18dd('0x4f'):_0x4bc960[_0x18dd('0x50')]=_0x18dd('0x40')+_0xd57bb5+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4f0ece+'))';return getZohoUser(_0x4bc960,'Contacts')[_0x18dd('0x2a')](function(_0x30e688){if(_0x30e688)return _0x30e688;_0x4bc960[_0x18dd('0x50')]=_0x18dd('0x40')+_0xd57bb5+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4f0ece+'))';return getZohoUser(_0x4bc960,'Leads')[_0x18dd('0x2a')](function(_0x38fbe1){if(_0x38fbe1)return _0x38fbe1;if(_0x553e5a[_0x18dd('0x43')]!=_0x18dd('0x51')){return createEndUser(_0x46d32f,_0xd57bb5,_0x34f7db,_0x4f0ece,_0x17c9f0,_0x553e5a);}else{return{};}});});break;case'contact':_0x4bc960[_0x18dd('0x50')]='https://www.zohoapis.'+_0xd57bb5+_0x18dd('0x52')+_0x4f0ece+'))';return getZohoUser(_0x4bc960,_0x18dd('0x53'))['then'](function(_0x40971c){if(_0x40971c)return _0x40971c;if(_0x553e5a['moduleCreate']!=_0x18dd('0x51')){return createEndUser(_0x46d32f,_0xd57bb5,_0x34f7db,_0x4f0ece,_0x17c9f0,_0x553e5a);}else{return{};}});break;case'lead':_0x4bc960[_0x18dd('0x50')]=_0x18dd('0x40')+_0xd57bb5+_0x18dd('0x54')+_0x4f0ece+'))';return getZohoUser(_0x4bc960,_0x18dd('0x55'))[_0x18dd('0x2a')](function(_0x5c8ae1){if(_0x5c8ae1)return _0x5c8ae1;if(_0x553e5a['moduleCreate']!=_0x18dd('0x51')){return createEndUser(_0x46d32f,_0xd57bb5,_0x34f7db,_0x4f0ece,_0x17c9f0,_0x553e5a);}else{return{};}});break;}}function getCall(_0x1ec4ec,_0xb4d2e1,_0x4c88e5,_0x563eb5,_0x1ce84d,_0x45ca1b,_0x5ba9b9,_0x2e6e89){logger['info'](_0x18dd('0x56'));var _0x3b4f3e={};_0x3b4f3e[_0x18dd('0x57')]={'name':!_[_0x18dd('0x1d')](_0x563eb5['role']['name'])&&!_[_0x18dd('0x1d')](_0x563eb5[_0x18dd('0x58')][_0x18dd('0x19')])&&_0x563eb5[_0x18dd('0x58')][_0x18dd('0x19')]===_0x18dd('0x59')?_0x563eb5[_0x18dd('0x44')][_0x18dd('0x19')]:!_[_0x18dd('0x1d')](_0x563eb5['first_name'])?_0x563eb5[_0x18dd('0x45')]+'\x20'+_0x563eb5[_0x18dd('0x46')]:_0x563eb5[_0x18dd('0x46')],'id':_0x563eb5['id']};_0x3b4f3e[_0x18dd('0x5a')]=intUtil[_0x18dd('0x5b')](_0x45ca1b[_0x18dd('0x5c')],_0x5ba9b9,'\x20');_0x3b4f3e[_0x18dd('0x5d')]=intUtil[_0x18dd('0x5b')](_0x45ca1b[_0x18dd('0x5e')],_0x5ba9b9,'\x0a');if(_0x1ce84d[_0x18dd('0x3e')]===_0x18dd('0x53')){_0x3b4f3e['Who_Id']={'name':!_[_0x18dd('0x1d')](_0x1ce84d[_0x18dd('0x5f')])?_0x1ce84d[_0x18dd('0x5f')]:!_['isNil'](_0x1ce84d[_0x18dd('0x60')])?_0x1ce84d[_0x18dd('0x60')]+'\x20'+_0x1ce84d['Last_Name']:_0x1ce84d['Last_Name'],'id':_0x1ce84d['id']};}if(_0x1ce84d[_0x18dd('0x3e')]===_0x18dd('0x55')){_0x3b4f3e[_0x18dd('0x61')]={'name':!_[_0x18dd('0x1d')](_0x1ce84d[_0x18dd('0x5f')])?_0x1ce84d[_0x18dd('0x5f')]:!_[_0x18dd('0x1d')](_0x1ce84d[_0x18dd('0x60')])?_0x1ce84d[_0x18dd('0x60')]+'\x20'+_0x1ce84d[_0x18dd('0x62')]:_0x1ce84d[_0x18dd('0x62')],'id':_0x1ce84d['id']};_0x3b4f3e['$se_module']=_['startCase'](_0x1ce84d['enduserType']);}if(_0x5ba9b9[_0x18dd('0x63')]){_0x3b4f3e['Call_Duration']=moment['utc'](parseInt(_0x5ba9b9[_0x18dd('0x63')])*0x3e8)[_0x18dd('0x33')](_0x18dd('0x64'));}else if(_0x5ba9b9[_0x18dd('0x65')]&&_0x5ba9b9['endtime']){_0x3b4f3e['Call_Duration']=moment['utc'](moment(_0x5ba9b9['endtime'],_0x18dd('0x66'))[_0x18dd('0x67')](moment(_0x5ba9b9['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x18dd('0x33')](_0x18dd('0x64'));}switch(_0x5ba9b9['lastevent']){case _0x18dd('0x68'):_0x3b4f3e['Call_Result']=_0x18dd('0x69');break;case _0x18dd('0x6a'):case _0x18dd('0x6b'):_0x3b4f3e[_0x18dd('0x6c')]='Answered';break;case _0x18dd('0x6d'):_0x3b4f3e[_0x18dd('0x6c')]=_0x18dd('0x6e');break;case _0x18dd('0x6f'):_0x3b4f3e[_0x18dd('0x6c')]=_0x18dd('0x70');break;case _0x18dd('0x71'):_0x3b4f3e['Call_Result']='Timeout';default:}_0x3b4f3e[_0x18dd('0x72')]=(_0x2e6e89===_0x18dd('0x73')?moment(_0x5ba9b9[_0x18dd('0x74')])[_0x18dd('0x33')](_0x18dd('0x66')):moment(_0x5ba9b9[_0x18dd('0x75')])[_0x18dd('0x33')](_0x18dd('0x66')))||moment()[_0x18dd('0x33')](_0x18dd('0x66'));_0x3b4f3e[_0x18dd('0x76')]=_0x2e6e89||_0x18dd('0x77');_0x3b4f3e=_[_0x18dd('0x78')](_0x3b4f3e,getCustomFields(_0x45ca1b[_0x18dd('0x79')],_0x5ba9b9));return request({'method':_0x18dd('0x3f'),'uri':_0x18dd('0x40')+_0xb4d2e1+'/crm/v2/Calls','headers':{'Authorization':_0x18dd('0x7a')+_0x1ec4ec},'body':{'data':[_0x3b4f3e]},'json':!![]})[_0x18dd('0x2a')](function(_0x3e1314){if(_0x3e1314&&_0x3e1314[_0x18dd('0x47')][0x0][_0x18dd('0x48')]===_0x18dd('0x49')){logger[_0x18dd('0x3a')]('Call\x20created!');return{'id':_0x3e1314['data'][0x0][_0x18dd('0x4a')]['id']};}})[_0x18dd('0x2e')](function(_0xe298c8){logger['info']('err',_0xe298c8[_0x18dd('0x30')]);console['log'](_0x18dd('0x7b'),_0xe298c8);});}exports[_0x18dd('0x7c')]=function(_0x180f91,_0x46391f,_0x57b3c6,_0x34bd4f,_0x30a1f3,_0x4dad8d){var _0x466c31,_0x583677,_0x1883f3;_0x4dad8d['host']=intUtil[_0x18dd('0x7d')](_0x4dad8d[_0x18dd('0x7e')]);_0x4dad8d[_0x18dd('0x7f')]=intUtil[_0x18dd('0x7d')](_0x4dad8d[_0x18dd('0x7f')]);if(_0x30a1f3&&_0x30a1f3[_0x18dd('0x80')]){logger[_0x18dd('0x3a')](_0x18dd('0x81'),_0x18dd('0x82'));_0x46391f[_0x18dd('0x83')]=_0x4dad8d['serverUrl']+_0x18dd('0x84')+_0x46391f[_0x18dd('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x46391f['uniqueid']);}else{_0x46391f[_0x18dd('0x83')]='';}var _0x469482=_0x4dad8d[_0x18dd('0x7e')]===_0x18dd('0x86')?'eu':_0x18dd('0x87');return getAccessToken(_0x4dad8d)['then'](function(_0x2d3d8d){_0x1883f3=_0x2d3d8d;return getUser(_0x1883f3,_0x469482,_0x4dad8d,_0x34bd4f[_0x18dd('0x39')]);})[_0x18dd('0x2a')](function(_0x4b825c){_0x466c31=_0x4b825c;logger['info'](_0x18dd('0x88'),_0x466c31['id']);return getEndUser(_0x1883f3,_0x469482,_0x4dad8d,_0x46391f['calleridname'],_0x46391f[_0x18dd('0x89')],_0x466c31,_0x57b3c6);})[_0x18dd('0x2a')](function(_0x3df471){_0x583677=_0x3df471;return getCall(_0x1883f3,_0x469482,_0x4dad8d,_0x466c31,_0x583677,_0x57b3c6,_0x46391f,_0x18dd('0x77'));})['then'](function(_0x5c9ec6){if(_0x5c9ec6){logger[_0x18dd('0x3a')](_0x18dd('0x8a'),_0x5c9ec6['id']);logger[_0x18dd('0x3a')](_0x18dd('0x81'),_0x18dd('0x8b'));emit(util[_0x18dd('0x33')]('user:%s',_0x34bd4f[_0x18dd('0x19')]),'trigger:browser:url',{'uri':_0x18dd('0x8c')+_0x4dad8d[_0x18dd('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5c9ec6['id']});}})[_0x18dd('0x2e')](function(_0x51e015){logger[_0x18dd('0x2f')](_0x18dd('0x81'),JSON[_0x18dd('0xe')](_0x51e015));});};exports['outbound']=function(_0x8b1b51,_0x166fd6,_0x4ef6f4,_0x93e238,_0x5418d7,_0x35061d,_0x16d926){var _0x43b1a2,_0x5f2536,_0x333684;_0x35061d[_0x18dd('0x7e')]=intUtil[_0x18dd('0x7d')](_0x35061d['host']);_0x35061d[_0x18dd('0x7f')]=intUtil['stripTrailingSlash'](_0x35061d[_0x18dd('0x7f')]);if(_0x16d926&&_0x16d926[_0x18dd('0x8d')]&&_0x16d926[_0x18dd('0x8d')]!==_0x18dd('0x8e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x166fd6[_0x18dd('0x83')]=_0x35061d[_0x18dd('0x7f')]+'/api/voice/recordings/'+_0x166fd6[_0x18dd('0x85')]+_0x18dd('0x8f')+md5(_0x166fd6[_0x18dd('0x85')]);}var _0x354fae=_0x35061d[_0x18dd('0x7e')]==='zoho.eu'?'eu':_0x18dd('0x87');return getAccessToken(_0x35061d)[_0x18dd('0x2a')](function(_0x59a9b6){_0x333684=_0x59a9b6;return getUser(_0x333684,_0x354fae,_0x35061d,_0x93e238[_0x18dd('0x39')]);})[_0x18dd('0x2a')](function(_0x3ba9eb){_0x43b1a2=_0x3ba9eb;logger['info'](_0x18dd('0x88'),_0x43b1a2['id']);return getEndUser(_0x333684,_0x354fae,_0x35061d,_0x166fd6[_0x18dd('0x90')],_0x166fd6['destcalleridnum'],_0x43b1a2,_0x4ef6f4);})['then'](function(_0x3e25a7){_0x5f2536=_0x3e25a7;return getCall(_0x333684,_0x354fae,_0x35061d,_0x43b1a2,_0x5f2536,_0x4ef6f4,_0x166fd6,'Outbound');})[_0x18dd('0x2a')](function(_0x1971aa){if(_0x1971aa){logger['info'](_0x18dd('0x8a'),_0x1971aa['id']);logger[_0x18dd('0x3a')](_0x18dd('0x91'),_0x18dd('0x8b'));emit(util[_0x18dd('0x33')](_0x18dd('0x92'),_0x93e238[_0x18dd('0x19')]),_0x18dd('0x93'),{'uri':_0x18dd('0x8c')+_0x35061d['host']+_0x18dd('0x94')+_0x1971aa['id']});}})[_0x18dd('0x2e')](function(_0x3e3738){logger[_0x18dd('0x2f')](_0x18dd('0x91'),JSON[_0x18dd('0xe')](_0x3e3738));});};exports[_0x18dd('0x95')]=function(_0xc35dc3,_0x4f6a71,_0x13a889,_0x4d24a2,_0x15951b,_0x3f3afa){var _0x3de1d1,_0x14c05f,_0x52733d;_0x3f3afa[_0x18dd('0x7e')]=intUtil[_0x18dd('0x7d')](_0x3f3afa[_0x18dd('0x7e')]);_0x3f3afa[_0x18dd('0x7f')]=intUtil[_0x18dd('0x7d')](_0x3f3afa[_0x18dd('0x7f')]);if(_0x15951b&&_0x15951b['monitor_format']){logger[_0x18dd('0x3a')]('['+_0x4f6a71[_0x18dd('0x96')][_0x18dd('0x97')]()+']',_0x18dd('0x82'));_0x4f6a71[_0x18dd('0x83')]=_0x3f3afa[_0x18dd('0x7f')]+'/api/voice/recordings/'+_0x4f6a71[_0x18dd('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x4f6a71['uniqueid']);}else{_0x4f6a71[_0x18dd('0x83')]='';}var _0x4d8d71=_0x3f3afa[_0x18dd('0x7e')]===_0x18dd('0x86')?'eu':_0x18dd('0x87');return getAccessToken(_0x3f3afa)['then'](function(_0x400f7c){_0x52733d=_0x400f7c;return getUser(_0x52733d,_0x4d8d71,_0x3f3afa);})[_0x18dd('0x2a')](function(_0x2faf4b){_0x3de1d1=_0x2faf4b;logger[_0x18dd('0x3a')](_0x18dd('0x88'),_0x3de1d1['id']);return getEndUser(_0x52733d,_0x4d8d71,_0x3f3afa,_0x4f6a71['calleridname'],_0x4f6a71[_0x18dd('0x89')],_0x3de1d1,_0x13a889);})['then'](function(_0xbeebcd){_0x14c05f=_0xbeebcd;return getCall(_0x52733d,_0x4d8d71,_0x3f3afa,_0x3de1d1,_0x14c05f,_0x13a889,_0x4f6a71,_0x18dd('0x77'));})[_0x18dd('0x2a')](function(_0x58f124){if(_0x58f124){logger[_0x18dd('0x3a')]('The\x20Call\x20ID\x20is:',_0x58f124['id']);}})['catch'](function(_0x53b041){logger[_0x18dd('0x2f')]('['+_0x4f6a71[_0x18dd('0x96')]['toUpperCase']()+']',JSON[_0x18dd('0xe')](_0x53b041));});}; \ No newline at end of file +var _0x1ae4=['expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','log','moduleSearch','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','code','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','access_token','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x1ae4,0x114));var _0x41ae=function(_0x15c1ec,_0x57b6a5){_0x15c1ec=_0x15c1ec-0x0;var _0x4c7189=_0x1ae4[_0x15c1ec];return _0x4c7189;};'use strict';var _=require(_0x41ae('0x0'));var rp=require(_0x41ae('0x1'));var md5=require(_0x41ae('0x2'));var util=require('util');var intUtil=require(_0x41ae('0x3'));var moment=require(_0x41ae('0x4'));var Redis=require(_0x41ae('0x5'));var BPromise=require(_0x41ae('0x6'));var config=require(_0x41ae('0x7'));var logger=require(_0x41ae('0x8'))(_0x41ae('0x9'));config['redis']=_[_0x41ae('0xa')](config[_0x41ae('0xb')],{'host':_0x41ae('0xc'),'port':0x18eb});var io=require(_0x41ae('0xd'))(new Redis(config['redis']));function emit(_0x12a66c,_0x4ff3d6,_0x19f63d){io['to'](_0x12a66c)[_0x41ae('0xe')](_0x4ff3d6,_0x19f63d);}function request(_0x5f1096){logger[_0x41ae('0xf')](_0x41ae('0x10'),JSON['stringify'](_0x5f1096));return rp(_0x5f1096);}function getCustomFields(_0x151268,_0x4b5a3c){var _0x4e48be={};if(_0x151268['length']>0x0){_[_0x41ae('0x11')](_0x151268,function(_0x3efe1b){if(_0x3efe1b['type']===_0x41ae('0x12')&&_0x3efe1b['idField']){_0x4e48be[_0x3efe1b[_0x41ae('0x13')]]=_0x3efe1b[_0x41ae('0x14')][_0x41ae('0x15')]();}else if(_0x3efe1b[_0x41ae('0x16')]===_0x41ae('0x17')&&_0x3efe1b['variableName']&&_0x3efe1b[_0x41ae('0x13')]&&_0x4b5a3c[_0x3efe1b[_0x41ae('0x18')]]){_0x4e48be[_0x3efe1b[_0x41ae('0x13')]]=_0x4b5a3c[_0x3efe1b['variableName']]['toString']();}else if(_0x3efe1b['type']==='customVariable'&&_0x3efe1b['Variable']&&_0x3efe1b[_0x41ae('0x19')][_0x41ae('0x1a')]&&_0x3efe1b[_0x41ae('0x13')]&&_0x4b5a3c[_0x3efe1b[_0x41ae('0x19')][_0x41ae('0x1a')][_0x41ae('0x1b')]()]){_0x4e48be[_0x3efe1b[_0x41ae('0x13')]]=_0x4b5a3c[_0x3efe1b[_0x41ae('0x19')][_0x41ae('0x1a')][_0x41ae('0x1b')]()][_0x41ae('0x15')]();}});}return _0x4e48be;}function getName(_0x19f038){if(_0x19f038[_0x41ae('0x1c')]('\x20')>0x0){var _0x5cb637=_0x19f038[_0x41ae('0x1d')](/ (.+)/);if(_0x5cb637[0x1]){return _0x5cb637;}}return[_0x19f038,_0x19f038];}var accountsTokens={};function getAccessToken(_0x5b981a){return new Promise(function(_0x2b07ec,_0x1c6cf2){if(!_['isNil'](accountsTokens[_0x5b981a['id']])&&!_[_0x41ae('0x1e')](accountsTokens[_0x5b981a['id']]['access_token'])){if(moment()[_0x41ae('0x1f')](accountsTokens[_0x5b981a['id']]['expires_in'])){_0x2b07ec(accountsTokens[_0x5b981a['id']][_0x41ae('0x20')]);}}var _0xeabf7a;switch(_0x5b981a['zone']){case'US':_0xeabf7a=_0x41ae('0x21');break;case'AU':_0xeabf7a='https://accounts.zoho.com.au';break;case'EU':_0xeabf7a=_0x41ae('0x22');break;case'IN':_0xeabf7a=_0x41ae('0x23');break;case'CN':_0xeabf7a=_0x41ae('0x24');break;default:_0xeabf7a=_0x41ae('0x22');break;}var _0x2f7ea5={'method':_0x41ae('0x25'),'uri':_0xeabf7a+_0x41ae('0x26'),'qs':{'refresh_token':_0x5b981a[_0x41ae('0x27')],'client_id':_0x5b981a[_0x41ae('0x28')],'client_secret':_0x5b981a['clientSecret'],'grant_type':_0x41ae('0x29')},'json':!![]};return rp(_0x2f7ea5)[_0x41ae('0x2a')](function(_0x5011c3){accountsTokens[_0x5b981a['id']]={'access_token':_0x5011c3[_0x41ae('0x20')],'expires_in':moment()[_0x41ae('0x2b')](_0x5011c3[_0x41ae('0x2c')],_0x41ae('0x2d'))};_0x2b07ec(_0x5011c3['access_token']);})[_0x41ae('0x2e')](function(_0x286b77){logger[_0x41ae('0x2f')](_0x41ae('0x30'),_0x286b77[_0x41ae('0x31')]);_0x1c6cf2(_0x286b77);});});}function getUser(_0x17f796,_0x268a5f,_0x1269c3,_0x48f878){logger[_0x41ae('0x32')](_0x41ae('0x33'));return request({'method':_0x41ae('0x34'),'uri':util['format'](_0x41ae('0x35'),_0x268a5f),'qs':{'type':_0x41ae('0x36')},'headers':{'Authorization':_0x41ae('0x37')+_0x17f796},'json':!![]})[_0x41ae('0x2a')](function(_0x3fcab3){if(_0x3fcab3[_0x41ae('0x38')]){var _0x3dd801=-0x1;if(_[_0x41ae('0x39')](_0x3fcab3[_0x41ae('0x38')])){if(!_['isNil'](_0x48f878)){_0x3dd801=_[_0x41ae('0x3a')](_0x3fcab3['users'],function(_0x4c60cd){return _0x4c60cd[_0x41ae('0x3b')]===_0x48f878;});}if(_0x3dd801>=0x0){logger[_0x41ae('0x32')](_0x41ae('0x3c'));}else{logger[_0x41ae('0x32')](_0x41ae('0x3d'));_0x3dd801=_[_0x41ae('0x3a')](_0x3fcab3[_0x41ae('0x38')],function(_0x1dd774){return _0x1dd774[_0x41ae('0x3e')]['name']==='Administrator';});}return _0x3fcab3[_0x41ae('0x38')][_0x3dd801];}else{if(_0x3fcab3[_0x41ae('0x3f')]['profile']['name']===_0x41ae('0x40')){logger[_0x41ae('0x32')](_0x41ae('0x3d'));user=_0x3fcab3[_0x41ae('0x3f')];return user;}else{logger[_0x41ae('0x2f')](_0x41ae('0x41'),JSON[_0x41ae('0x42')](_0x3fcab3));throw new Error(_0x41ae('0x43')+JSON[_0x41ae('0x42')](_0x3fcab3));}}}else{logger[_0x41ae('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x41ae('0x42')](_0x3fcab3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x41ae('0x42')](_0x3fcab3));}})[_0x41ae('0x2e')](function(_0x3e02e7){console[_0x41ae('0x2f')](_0x3e02e7);});}function getZohoUser(_0x30d1d5,_0x9d2c1c){return new BPromise(function(_0x120977,_0x2bb528){request(_0x30d1d5)[_0x41ae('0x2a')](function(_0x2a4213){var _0x19b481=null;if(_0x2a4213){_0x19b481=_0x2a4213['data'][0x0];_0x19b481[_0x41ae('0x44')]=_0x9d2c1c;}_0x120977(_0x19b481);})[_0x41ae('0x2e')](function(_0x1cd80d){_0x2bb528(_0x1cd80d);});});}function createEndUser(_0x2d3765,_0x57572c,_0x34be77,_0x10c54d,_0x46902b,_0x1ca867){var _0x34be77=getName(_0x34be77);return request({'method':_0x41ae('0x25'),'uri':_0x41ae('0x45')+_0x57572c+_0x41ae('0x46')+_[_0x41ae('0x47')](_0x1ca867[_0x41ae('0x48')])+'s','body':{'data':[{'Last_Name':_0x34be77[0x1],'First_Name':_0x34be77[0x0],'Phone':_0x10c54d,'Owner':{'name':!_[_0x41ae('0x1e')](_0x46902b[_0x41ae('0x49')][_0x41ae('0x1a')])?_0x46902b[_0x41ae('0x49')][_0x41ae('0x1a')]:!_[_0x41ae('0x1e')](_0x46902b[_0x41ae('0x4a')])?_0x46902b[_0x41ae('0x4a')]+'\x20'+_0x46902b[_0x41ae('0x4b')]:_0x46902b[_0x41ae('0x4b')],'id':_0x46902b['id']}}]},'headers':{'Authorization':_0x41ae('0x37')+_0x2d3765},'json':!![]})['then'](function(_0x66aa7c){if(_0x66aa7c&&_0x66aa7c[_0x41ae('0x4c')][0x0]['code']===_0x41ae('0x4d')){var _0x403b88=_0x66aa7c[_0x41ae('0x4c')][0x0][_0x41ae('0x4e')];_0x403b88[_0x41ae('0x44')]=_[_0x41ae('0x47')](_0x1ca867[_0x41ae('0x48')])+'s';return _0x403b88;}logger[_0x41ae('0x2f')](_0x41ae('0x41'),JSON[_0x41ae('0x42')](data));throw new Error('Error:\x20'+JSON[_0x41ae('0x42')](data));})[_0x41ae('0x2e')](function(_0x35f210){console[_0x41ae('0x4f')]('CREATE\x20ERROR',_0x35f210);});}function getEndUser(_0x199b92,_0x2bfe30,_0xa91815,_0x4226a2,_0x5e21a0,_0xf0d7aa,_0x1ecadc){var _0x1415bd={'method':'GET','uri':'','headers':{'Authorization':_0x41ae('0x37')+_0x199b92},'json':!![]};switch(_0x1ecadc[_0x41ae('0x50')]){case'contact_lead':_0x1415bd[_0x41ae('0x51')]=_0x41ae('0x45')+_0x2bfe30+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5e21a0+'))';return getZohoUser(_0x1415bd,'Contacts')[_0x41ae('0x2a')](function(_0x1e51ce){if(_0x1e51ce)return _0x1e51ce;_0x1415bd['uri']=_0x41ae('0x45')+_0x2bfe30+_0x41ae('0x52')+_0x5e21a0+'))';return getZohoUser(_0x1415bd,_0x41ae('0x53'))['then'](function(_0x3bfd3a){if(_0x3bfd3a)return _0x3bfd3a;if(_0x1ecadc[_0x41ae('0x48')]!=_0x41ae('0x54')){return createEndUser(_0x199b92,_0x2bfe30,_0x4226a2,_0x5e21a0,_0xf0d7aa,_0x1ecadc);}else{return{};}});});break;case'contact':_0x1415bd[_0x41ae('0x51')]='https://www.zohoapis.'+_0x2bfe30+_0x41ae('0x55')+_0x5e21a0+'))';return getZohoUser(_0x1415bd,_0x41ae('0x56'))[_0x41ae('0x2a')](function(_0x5a7d22){if(_0x5a7d22)return _0x5a7d22;if(_0x1ecadc[_0x41ae('0x48')]!='nothing'){return createEndUser(_0x199b92,_0x2bfe30,_0x4226a2,_0x5e21a0,_0xf0d7aa,_0x1ecadc);}else{return{};}});break;case _0x41ae('0x57'):_0x1415bd['uri']=_0x41ae('0x45')+_0x2bfe30+_0x41ae('0x52')+_0x5e21a0+'))';return getZohoUser(_0x1415bd,_0x41ae('0x53'))[_0x41ae('0x2a')](function(_0x3f51e2){if(_0x3f51e2)return _0x3f51e2;if(_0x1ecadc['moduleCreate']!=_0x41ae('0x54')){return createEndUser(_0x199b92,_0x2bfe30,_0x4226a2,_0x5e21a0,_0xf0d7aa,_0x1ecadc);}else{return{};}});break;}}function getCall(_0x292912,_0x2c88df,_0x31a683,_0x4a07a4,_0x4c817d,_0x5dc393,_0x16f99a,_0x46ee61){logger[_0x41ae('0x32')](_0x41ae('0x58'));var _0x3c0736={};_0x3c0736[_0x41ae('0x59')]={'name':!_[_0x41ae('0x1e')](_0x4a07a4['role']['name'])&&!_[_0x41ae('0x1e')](_0x4a07a4[_0x41ae('0x3e')][_0x41ae('0x1a')])&&_0x4a07a4[_0x41ae('0x3e')][_0x41ae('0x1a')]===_0x41ae('0x5a')?_0x4a07a4[_0x41ae('0x49')][_0x41ae('0x1a')]:!_[_0x41ae('0x1e')](_0x4a07a4['first_name'])?_0x4a07a4['first_name']+'\x20'+_0x4a07a4['last_name']:_0x4a07a4[_0x41ae('0x4b')],'id':_0x4a07a4['id']};_0x3c0736[_0x41ae('0x5b')]=intUtil[_0x41ae('0x5c')](_0x5dc393[_0x41ae('0x5d')],_0x16f99a,'\x20');_0x3c0736[_0x41ae('0x5e')]=intUtil[_0x41ae('0x5c')](_0x5dc393['Descriptions'],_0x16f99a,'\x0a');if(_0x4c817d['enduserType']===_0x41ae('0x56')){_0x3c0736['Who_Id']={'name':!_[_0x41ae('0x1e')](_0x4c817d[_0x41ae('0x5f')])?_0x4c817d[_0x41ae('0x5f')]:!_['isNil'](_0x4c817d['First_Name'])?_0x4c817d[_0x41ae('0x60')]+'\x20'+_0x4c817d['Last_Name']:_0x4c817d[_0x41ae('0x61')],'id':_0x4c817d['id']};}if(_0x4c817d['enduserType']===_0x41ae('0x53')){_0x3c0736[_0x41ae('0x62')]={'name':!_[_0x41ae('0x1e')](_0x4c817d['Full_Name'])?_0x4c817d[_0x41ae('0x5f')]:!_['isNil'](_0x4c817d[_0x41ae('0x60')])?_0x4c817d[_0x41ae('0x60')]+'\x20'+_0x4c817d[_0x41ae('0x61')]:_0x4c817d[_0x41ae('0x61')],'id':_0x4c817d['id']};_0x3c0736[_0x41ae('0x63')]=_[_0x41ae('0x47')](_0x4c817d[_0x41ae('0x44')]);}if(_0x16f99a[_0x41ae('0x64')]){_0x3c0736[_0x41ae('0x65')]=moment[_0x41ae('0x66')](parseInt(_0x16f99a[_0x41ae('0x64')])*0x3e8)[_0x41ae('0x67')]('mm:ss');}else if(_0x16f99a[_0x41ae('0x68')]&&_0x16f99a[_0x41ae('0x69')]){_0x3c0736[_0x41ae('0x65')]=moment['utc'](moment(_0x16f99a['endtime'],_0x41ae('0x6a'))[_0x41ae('0x6b')](moment(_0x16f99a[_0x41ae('0x6c')],_0x41ae('0x6a'))))[_0x41ae('0x67')](_0x41ae('0x6d'));}switch(_0x16f99a['lastevent']){case _0x41ae('0x6e'):_0x3c0736[_0x41ae('0x6f')]=_0x41ae('0x70');break;case _0x41ae('0x71'):case _0x41ae('0x72'):_0x3c0736[_0x41ae('0x6f')]=_0x41ae('0x73');break;case _0x41ae('0x74'):_0x3c0736[_0x41ae('0x6f')]=_0x41ae('0x75');break;case _0x41ae('0x76'):_0x3c0736[_0x41ae('0x6f')]='Abandoned';break;case _0x41ae('0x77'):_0x3c0736['Call_Result']='Timeout';default:}_0x3c0736[_0x41ae('0x78')]=(_0x46ee61===_0x41ae('0x79')?moment(_0x16f99a[_0x41ae('0x6c')])[_0x41ae('0x67')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x16f99a[_0x41ae('0x7a')])[_0x41ae('0x67')](_0x41ae('0x6a')))||moment()[_0x41ae('0x67')](_0x41ae('0x6a'));_0x3c0736['Call_Type']=_0x46ee61||_0x41ae('0x7b');_0x3c0736=_[_0x41ae('0x7c')](_0x3c0736,getCustomFields(_0x5dc393[_0x41ae('0x7d')],_0x16f99a));return request({'method':_0x41ae('0x25'),'uri':_0x41ae('0x45')+_0x2c88df+_0x41ae('0x7e'),'headers':{'Authorization':_0x41ae('0x37')+_0x292912},'body':{'data':[_0x3c0736]},'json':!![]})[_0x41ae('0x2a')](function(_0x9feb80){if(_0x9feb80&&_0x9feb80['data'][0x0][_0x41ae('0x7f')]===_0x41ae('0x4d')){logger[_0x41ae('0x32')]('Call\x20created!');return{'id':_0x9feb80[_0x41ae('0x4c')][0x0][_0x41ae('0x4e')]['id']};}})[_0x41ae('0x2e')](function(_0x2b6281){logger[_0x41ae('0x32')](_0x41ae('0x80'),_0x2b6281[_0x41ae('0x31')]);console[_0x41ae('0x4f')](_0x41ae('0x80'),_0x2b6281);});}exports[_0x41ae('0x81')]=function(_0x2f598e,_0x4abebb,_0x52cf59,_0x431f2d,_0x299566,_0x11fdb8){var _0x3928c7,_0x5886b9,_0x43f17a;_0x11fdb8[_0x41ae('0x82')]=intUtil['stripTrailingSlash'](_0x11fdb8['host']);_0x11fdb8[_0x41ae('0x83')]=intUtil[_0x41ae('0x84')](_0x11fdb8['serverUrl']);if(_0x299566&&_0x299566[_0x41ae('0x85')]){logger[_0x41ae('0x32')](_0x41ae('0x86'),'Recording\x20is\x20enabled!');_0x4abebb['recordingURL']=_0x11fdb8[_0x41ae('0x83')]+_0x41ae('0x87')+_0x4abebb[_0x41ae('0x88')]+_0x41ae('0x89')+md5(_0x4abebb[_0x41ae('0x88')]);}else{_0x4abebb['recordingURL']='';}var _0x2cbed8=_0x11fdb8[_0x41ae('0x82')]===_0x41ae('0x8a')?'eu':_0x41ae('0x8b');return getAccessToken(_0x11fdb8)[_0x41ae('0x2a')](function(_0x5bfdbf){_0x43f17a=_0x5bfdbf;return getUser(_0x43f17a,_0x2cbed8,_0x11fdb8,_0x431f2d[_0x41ae('0x3b')]);})[_0x41ae('0x2a')](function(_0x59a11d){_0x3928c7=_0x59a11d;logger['info'](_0x41ae('0x8c'),_0x3928c7['id']);return getEndUser(_0x43f17a,_0x2cbed8,_0x11fdb8,_0x4abebb[_0x41ae('0x8d')],_0x4abebb['calleridnum'],_0x3928c7,_0x52cf59);})[_0x41ae('0x2a')](function(_0x5b58ac){_0x5886b9=_0x5b58ac;return getCall(_0x43f17a,_0x2cbed8,_0x11fdb8,_0x3928c7,_0x5886b9,_0x52cf59,_0x4abebb,_0x41ae('0x7b'));})[_0x41ae('0x2a')](function(_0x1ada9f){if(_0x1ada9f){logger['info']('The\x20Call\x20ID\x20is:',_0x1ada9f['id']);logger[_0x41ae('0x32')](_0x41ae('0x86'),_0x41ae('0x8e'));emit(util[_0x41ae('0x67')](_0x41ae('0x8f'),_0x431f2d[_0x41ae('0x1a')]),_0x41ae('0x90'),{'uri':_0x41ae('0x91')+_0x11fdb8[_0x41ae('0x82')]+_0x41ae('0x92')+_0x1ada9f['id']});}})[_0x41ae('0x2e')](function(_0x353e01){logger[_0x41ae('0x2f')](_0x41ae('0x86'),JSON[_0x41ae('0x42')](_0x353e01));});};exports[_0x41ae('0x79')]=function(_0x278348,_0x171519,_0x3781a7,_0x8d65ca,_0x56a0fe,_0x3c093a,_0x32c391){var _0x3bead1,_0x17980b,_0x58782f;_0x3c093a[_0x41ae('0x82')]=intUtil[_0x41ae('0x84')](_0x3c093a[_0x41ae('0x82')]);_0x3c093a[_0x41ae('0x83')]=intUtil[_0x41ae('0x84')](_0x3c093a['serverUrl']);if(_0x32c391&&_0x32c391[_0x41ae('0x93')]&&_0x32c391[_0x41ae('0x93')]!==_0x41ae('0x94')){logger['info'](_0x41ae('0x95'),_0x41ae('0x96'));_0x171519[_0x41ae('0x97')]=_0x3c093a[_0x41ae('0x83')]+_0x41ae('0x87')+_0x171519[_0x41ae('0x88')]+_0x41ae('0x89')+md5(_0x171519[_0x41ae('0x88')]);}var _0x128af5=_0x3c093a[_0x41ae('0x82')]===_0x41ae('0x8a')?'eu':'com';return getAccessToken(_0x3c093a)[_0x41ae('0x2a')](function(_0x18f77e){_0x58782f=_0x18f77e;return getUser(_0x58782f,_0x128af5,_0x3c093a,_0x8d65ca[_0x41ae('0x3b')]);})[_0x41ae('0x2a')](function(_0x140239){_0x3bead1=_0x140239;logger[_0x41ae('0x32')](_0x41ae('0x8c'),_0x3bead1['id']);return getEndUser(_0x58782f,_0x128af5,_0x3c093a,_0x171519[_0x41ae('0x98')],_0x171519[_0x41ae('0x99')],_0x3bead1,_0x3781a7);})[_0x41ae('0x2a')](function(_0x1512b5){_0x17980b=_0x1512b5;return getCall(_0x58782f,_0x128af5,_0x3c093a,_0x3bead1,_0x17980b,_0x3781a7,_0x171519,_0x41ae('0x9a'));})[_0x41ae('0x2a')](function(_0x53a1b9){if(_0x53a1b9){logger['info'](_0x41ae('0x9b'),_0x53a1b9['id']);logger[_0x41ae('0x32')]('[OUTBOUND]',_0x41ae('0x8e'));emit(util[_0x41ae('0x67')](_0x41ae('0x8f'),_0x8d65ca['name']),_0x41ae('0x90'),{'uri':'https://crm.'+_0x3c093a[_0x41ae('0x82')]+_0x41ae('0x92')+_0x53a1b9['id']});}})[_0x41ae('0x2e')](function(_0x3a95b6){logger[_0x41ae('0x2f')](_0x41ae('0x95'),JSON['stringify'](_0x3a95b6));});};exports[_0x41ae('0x9c')]=function(_0x1f37f2,_0x4ccf1f,_0x318ae1,_0x4607ac,_0x246546,_0x3930de){var _0x52a6d9,_0x349dc5,_0x539265;_0x3930de[_0x41ae('0x82')]=intUtil[_0x41ae('0x84')](_0x3930de[_0x41ae('0x82')]);_0x3930de[_0x41ae('0x83')]=intUtil[_0x41ae('0x84')](_0x3930de[_0x41ae('0x83')]);if(_0x246546&&_0x246546['monitor_format']){logger[_0x41ae('0x32')]('['+_0x4ccf1f[_0x41ae('0x9d')][_0x41ae('0x9e')]()+']',_0x41ae('0x96'));_0x4ccf1f[_0x41ae('0x97')]=_0x3930de[_0x41ae('0x83')]+_0x41ae('0x87')+_0x4ccf1f['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4ccf1f[_0x41ae('0x88')]);}else{_0x4ccf1f['recordingURL']='';}var _0x30598c=_0x3930de[_0x41ae('0x82')]===_0x41ae('0x8a')?'eu':'com';return getAccessToken(_0x3930de)[_0x41ae('0x2a')](function(_0x1ccb02){_0x539265=_0x1ccb02;return getUser(_0x539265,_0x30598c,_0x3930de);})[_0x41ae('0x2a')](function(_0x1e98a8){_0x52a6d9=_0x1e98a8;logger[_0x41ae('0x32')](_0x41ae('0x8c'),_0x52a6d9['id']);return getEndUser(_0x539265,_0x30598c,_0x3930de,_0x4ccf1f[_0x41ae('0x8d')],_0x4ccf1f[_0x41ae('0x9f')],_0x52a6d9,_0x318ae1);})[_0x41ae('0x2a')](function(_0x258c25){_0x349dc5=_0x258c25;return getCall(_0x539265,_0x30598c,_0x3930de,_0x52a6d9,_0x349dc5,_0x318ae1,_0x4ccf1f,_0x41ae('0x7b'));})[_0x41ae('0x2a')](function(_0x4b5d06){if(_0x4b5d06){logger[_0x41ae('0x32')]('The\x20Call\x20ID\x20is:',_0x4b5d06['id']);}})[_0x41ae('0x2e')](function(_0x1a5a00){logger['error']('['+_0x4ccf1f[_0x41ae('0x9d')]['toUpperCase']()+']',JSON[_0x41ae('0x42')](_0x1a5a00));});}; \ 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 625227e..05e32ff 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x41acdd,_0x3053b9){var _0x26636f=function(_0xa9c1b4){while(--_0xa9c1b4){_0x41acdd['push'](_0x41acdd['shift']());}};_0x26636f(++_0x3053b9);}(_0x7a54,0x106));var _0x47a5=function(_0x4b23e7,_0x1ff116){_0x4b23e7=_0x4b23e7-0x0;var _0x553df7=_0x7a54[_0x4b23e7];return _0x553df7;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3e623b,_0x5c4919){var _0x95b803=function(_0x40d17b){while(--_0x40d17b){_0x3e623b['push'](_0x3e623b['shift']());}};_0x95b803(++_0x5c4919);}(_0x7a54,0x106));var _0x47a5=function(_0x34e157,_0x4b63f8){_0x34e157=_0x34e157-0x0;var _0x527831=_0x7a54[_0x34e157];return _0x527831;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 a730244..f90a824 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x143dfb,_0x1293dc){var _0x191831=function(_0x406df8){while(--_0x406df8){_0x143dfb['push'](_0x143dfb['shift']());}};_0x191831(++_0x1293dc);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e283,_0x2b5a6e){_0x20e283=_0x20e283-0x0;var _0x199e10=_0xb10b[_0x20e283];return _0x199e10;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x25d13b,_0x37cc22){var _0x4c6e13=function(_0x571aaf){while(--_0x571aaf){_0x25d13b['push'](_0x25d13b['shift']());}};_0x4c6e13(++_0x37cc22);}(_0x7a54,0x106));var _0x47a5=function(_0x4a4d82,_0x2dc1a3){_0x4a4d82=_0x4a4d82-0x0;var _0x443372=_0x7a54[_0x4a4d82];return _0x443372;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 2439296..8d666f5 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 _0xcd4e=['exports','jayson/promise','bluebird','../../config/logger','routing','Request','request','debug','rpc','error','message','result','catch'];(function(_0x59b157,_0x27829a){var _0x1dd89d=function(_0x41c540){while(--_0x41c540){_0x59b157['push'](_0x59b157['shift']());}};_0x1dd89d(++_0x27829a);}(_0xcd4e,0x187));var _0xecd4=function(_0x3deb1a,_0x423a23){_0x3deb1a=_0x3deb1a-0x0;var _0x1ab0e0=_0xcd4e[_0x3deb1a];return _0x1ab0e0;};'use strict';var jayson=require(_0xecd4('0x0'));var BPromise=require(_0xecd4('0x1'));var logger=require(_0xecd4('0x2'))(_0xecd4('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xecd4('0x4')]=function(_0x40ed13,_0x59d583){return new BPromise(function(_0x1e1511,_0x4e8050){return client[_0xecd4('0x5')](_0x40ed13,_0x59d583)['then'](function(_0x41dd0c){logger[_0xecd4('0x6')](_0xecd4('0x7'),_0xecd4('0x3'),_0x40ed13,_0x59d583,_0x41dd0c);if(_0x41dd0c[_0xecd4('0x8')]){logger['error'](_0xecd4('0x7'),_0xecd4('0x3'),_0x40ed13,_0x41dd0c['error'][_0xecd4('0x9')],_0x59d583);return _0x4e8050(_0x41dd0c['error'][_0xecd4('0x9')]);}else{return _0x1e1511(_0x41dd0c[_0xecd4('0xa')]);}})[_0xecd4('0xb')](function(_0x478efb){logger[_0xecd4('0x8')](_0xecd4('0x7'),'routing',_0x40ed13,_0x478efb,_0x59d583);return _0x4e8050(_0x478efb);});});};module[_0xecd4('0xc')]=client; \ No newline at end of file +var _0xb26e=['request','then','debug','rpc','routing','error','message','result','exports','jayson/promise','client','http'];(function(_0xae399a,_0x22c407){var _0x2488c8=function(_0x406785){while(--_0x406785){_0xae399a['push'](_0xae399a['shift']());}};_0x2488c8(++_0x22c407);}(_0xb26e,0x11d));var _0xeb26=function(_0x179170,_0x414a7a){_0x179170=_0x179170-0x0;var _0x2e0aac=_0xb26e[_0x179170];return _0x2e0aac;};'use strict';var jayson=require(_0xeb26('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0xeb26('0x1')][_0xeb26('0x2')]({'port':0x2329});client['Request']=function(_0x3bdbef,_0x3b8a6f){return new BPromise(function(_0x2817de,_0x3ec03a){return client[_0xeb26('0x3')](_0x3bdbef,_0x3b8a6f)[_0xeb26('0x4')](function(_0x2351f9){logger[_0xeb26('0x5')](_0xeb26('0x6'),_0xeb26('0x7'),_0x3bdbef,_0x3b8a6f,_0x2351f9);if(_0x2351f9[_0xeb26('0x8')]){logger[_0xeb26('0x8')](_0xeb26('0x6'),'routing',_0x3bdbef,_0x2351f9[_0xeb26('0x8')]['message'],_0x3b8a6f);return _0x3ec03a(_0x2351f9['error'][_0xeb26('0x9')]);}else{return _0x2817de(_0x2351f9[_0xeb26('0xa')]);}})['catch'](function(_0x3bcb40){logger['error'](_0xeb26('0x6'),_0xeb26('0x7'),_0x3bdbef,_0x3bcb40,_0x3b8a6f);return _0x3ec03a(_0x3bcb40);});});};module[_0xeb26('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7a7fea4..b614152 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 _0x9f02=['bluebird','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','findOne','loginMailFrequency','catch'];(function(_0x3cb5bd,_0x11882c){var _0x5451fa=function(_0x4288cd){while(--_0x4288cd){_0x3cb5bd['push'](_0x3cb5bd['shift']());}};_0x5451fa(++_0x11882c);}(_0x9f02,0x68));var _0x29f0=function(_0x3fbccf,_0x14ff02){_0x3fbccf=_0x3fbccf-0x0;var _0x43657e=_0x9f02[_0x3fbccf];return _0x43657e;};'use strict';var BPromise=require(_0x29f0('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x29f0('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x29f0('0x2'))['db'];function initRealtime(){return BPromise[_0x29f0('0x3')]()[_0x29f0('0x4')](mailAccount[_0x29f0('0x5')]())['then'](realtime[_0x29f0('0x6')]())['then'](function(){email[_0x29f0('0x7')](realtime[_0x29f0('0x8')]);return realtime;});}function main(){return server[_0x29f0('0x9')](realtime,email)['then'](function(_0x4d47b3){return initRealtime();})['then'](function(_0x1da49e){return db['Setting'][_0x29f0('0xa')]({'attributes':['id',_0x29f0('0xb')],'raw':!![]});})[_0x29f0('0x4')](function(_0x529ded){return setInterval(initRealtime,_0x529ded['loginMailFrequency']*0x3e8);})[_0x29f0('0xc')](function(_0x5a8eb2){console['log'](_0x5a8eb2);});}main(); \ No newline at end of file +var _0x0650=['then','initMailAccounts','mailAccounts','findOne','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','../../mysqldb','getMailAccounts'];(function(_0x3a7e42,_0x58e47d){var _0x7122b7=function(_0x42acab){while(--_0x42acab){_0x3a7e42['push'](_0x3a7e42['shift']());}};_0x7122b7(++_0x58e47d);}(_0x0650,0x1aa));var _0x0065=function(_0x422fa5,_0x4fc338){_0x422fa5=_0x422fa5-0x0;var _0x132d59=_0x0650[_0x422fa5];return _0x132d59;};'use strict';var BPromise=require(_0x0065('0x0'));var server=require(_0x0065('0x1'));var Realtime=require(_0x0065('0x2'));var EmailChannel=require(_0x0065('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x0065('0x4'))['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0x0065('0x5')]())[_0x0065('0x6')](realtime[_0x0065('0x7')]())['then'](function(){email['refresh'](realtime[_0x0065('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x49d04d){return initRealtime();})['then'](function(_0x25892a){return db['Setting'][_0x0065('0x9')]({'attributes':['id',_0x0065('0xa')],'raw':!![]});})['then'](function(_0x2afe89){return setInterval(initRealtime,_0x2afe89[_0x0065('0xa')]*0x3e8);})['catch'](function(_0x535a92){console[_0x0065('0xb')](_0x535a92);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3340c7e..1d4bd94 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 _0x2b9e=['active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','prototype','sendMail','send','verifySmtp','Smtp','verify','verified','catch','lodash','moment','md5','../../../config/environment','email','redis','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name'];(function(_0x4a1764,_0x2cc393){var _0xb3f61e=function(_0x109761){while(--_0x109761){_0x4a1764['push'](_0x4a1764['shift']());}};_0xb3f61e(++_0x2cc393);}(_0x2b9e,0xfa));var _0xe2b9=function(_0x19b22b,_0x3b21d5){_0x19b22b=_0x19b22b-0x0;var _0x4759e4=_0x2b9e[_0x19b22b];return _0x4759e4;};'use strict';var _=require(_0xe2b9('0x0'));var moment=require(_0xe2b9('0x1'));var BPromise=require('bluebird');var md5=require(_0xe2b9('0x2'));var Redis=require('ioredis');var config=require(_0xe2b9('0x3'));var logger=require('../../../config/logger')(_0xe2b9('0x4'));config[_0xe2b9('0x5')]=_['defaults'](config[_0xe2b9('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe2b9('0x5')]));var EmailImap=require(_0xe2b9('0x6'));var EmailSmtp=require(_0xe2b9('0x7'));var mailAccount=require(_0xe2b9('0x8'));var md5Accounts={};function EmailChannel(_0x179806){logger['info'](_0xe2b9('0x9'));this[_0xe2b9('0xa')]=_0x179806[_0xe2b9('0xa')];this[_0xe2b9('0xb')]={};this[_0xe2b9('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0xe2b9('0xd')]=function(_0x118e85){var _0x4c9c4d=this['mailAccounts'][_0x118e85];var _0x2689c3={'id':_0x4c9c4d['id'],'name':_0x4c9c4d[_0xe2b9('0xe')],'key':_0x4c9c4d['key'],'active':_0x4c9c4d[_0xe2b9('0xf')],'Imap':{'status':_0x4c9c4d[_0xe2b9('0x10')][_0xe2b9('0x11')],'messageStatus':_0x4c9c4d[_0xe2b9('0x10')][_0xe2b9('0x12')],'total':_0x4c9c4d[_0xe2b9('0x10')][_0xe2b9('0x13')]}};if(_['isNil'](md5Accounts[_0x118e85])){md5Accounts[_0x118e85]={};}var _0x3538a4=md5(JSON[_0xe2b9('0x14')](_0x2689c3));if(md5Accounts[_0x118e85][_0xe2b9('0x2')]!==_0x3538a4){md5Accounts[_0x118e85]['md5']=_0x3538a4;io[_0xe2b9('0xd')](_0xe2b9('0x15'),_0x2689c3);}};EmailChannel['prototype'][_0xe2b9('0x16')]=function(_0x143eca){for(var _0x10aabf in _0x143eca){if(_0x143eca[_0xe2b9('0x17')](_0x10aabf)){if(_0x143eca[_0x10aabf][_0xe2b9('0x10')]&&_0x143eca[_0x10aabf][_0xe2b9('0xf')]){var _0x44814b=_0x143eca[_0x10aabf][_0xe2b9('0x10')];if(!this['imapAccounts'][_0xe2b9('0x17')](_0x44814b['id'])){this['imapAccounts'][_0x44814b['id']]=new EmailImap(_0x44814b,_0x143eca[_0x10aabf][_0xe2b9('0x4')]);this[_0xe2b9('0xb')][_0x44814b['id']]['on'](_0xe2b9('0x18'),this['handleImapBox'][_0xe2b9('0x19')](this,_0x10aabf));this[_0xe2b9('0xb')][_0x44814b['id']]['on'](_0xe2b9('0x4'),this[_0xe2b9('0x1a')][_0xe2b9('0x19')](this,_0x10aabf));this['imapAccounts'][_0x44814b['id']]['on'](_0xe2b9('0x1b'),this[_0xe2b9('0x1c')]['bind'](this,_0x10aabf));this['imapAccounts'][_0x44814b['id']]['on'](_0xe2b9('0x1d'),this[_0xe2b9('0x1e')][_0xe2b9('0x19')](this,_0x10aabf));}}else{if(_[_0xe2b9('0x1f')](this[_0xe2b9('0xa')][_0x10aabf][_0xe2b9('0x10')])){this[_0xe2b9('0xa')][_0x10aabf][_0xe2b9('0x10')]={};}this[_0xe2b9('0xa')][_0x10aabf][_0xe2b9('0x10')][_0xe2b9('0x11')]=_0xe2b9('0x20');this[_0xe2b9('0xa')][_0x10aabf][_0xe2b9('0x10')][_0xe2b9('0x12')]='';this[_0xe2b9('0xd')](_0x10aabf);}}}};EmailChannel['prototype'][_0xe2b9('0x21')]=function(_0x4d108b,_0x1eff50){if(this[_0xe2b9('0xa')][_0x4d108b]){this[_0xe2b9('0xa')][_0x4d108b][_0xe2b9('0x10')]['status']=_0xe2b9('0x22');this[_0xe2b9('0xa')][_0x4d108b][_0xe2b9('0x10')][_0xe2b9('0x12')]=_0x1eff50[_0xe2b9('0xe')];if(_0x1eff50[_0xe2b9('0x23')]){this[_0xe2b9('0xa')][_0x4d108b][_0xe2b9('0x10')][_0xe2b9('0x13')]=_0x1eff50['messages'][_0xe2b9('0x13')];}return this[_0xe2b9('0xd')](_0x4d108b);}};EmailChannel['prototype'][_0xe2b9('0x1a')]=function(_0x590464,_0x3ac676){logger['info'](_0xe2b9('0x24'),_0x3ac676[_0xe2b9('0x25')],_0x3ac676[_0xe2b9('0x26')],_0x3ac676[_0xe2b9('0x27')],_0x590464);if(this[_0xe2b9('0xa')][_0x590464]){return mailAccount[_0xe2b9('0x28')](_0x590464,_0x3ac676)[_0xe2b9('0x29')](function(_0x5a44f5){if(_0x5a44f5){logger[_0xe2b9('0x2a')](_0xe2b9('0x2b'));}})['catch'](function(_0x644c60){logger['error'](_0xe2b9('0x2c'),JSON[_0xe2b9('0x14')](_0x644c60));});}};EmailChannel['prototype'][_0xe2b9('0x1c')]=function(_0xac8648){if(this['mailAccounts'][_0xac8648]&&this[_0xe2b9('0xa')][_0xac8648][_0xe2b9('0x10')]){if(this['imapAccounts'][this[_0xe2b9('0xa')][_0xac8648]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0xac8648]['Imap']['id']];}this[_0xe2b9('0xa')][_0xac8648][_0xe2b9('0x10')]['lastSync']=moment();this[_0xe2b9('0xd')](_0xac8648);}};EmailChannel['prototype']['handleImapError']=function(_0x58eda9,_0x3b4a1e){if(this[_0xe2b9('0xa')][_0x58eda9]){this[_0xe2b9('0xa')][_0x58eda9][_0xe2b9('0x10')][_0xe2b9('0x11')]=_0xe2b9('0x1d');this[_0xe2b9('0xa')][_0x58eda9][_0xe2b9('0x10')][_0xe2b9('0x12')]=_0x3b4a1e;return this[_0xe2b9('0xd')](_0x58eda9);}};EmailChannel[_0xe2b9('0x2d')][_0xe2b9('0x2e')]=function(_0x244fc8,_0x5a8e29){return this[_0xe2b9('0xc')][_0xe2b9('0x2f')](_0x244fc8,_0x5a8e29);};EmailChannel['prototype'][_0xe2b9('0x30')]=function(_0x3d9773){var _0x37a9db=this;if(this[_0xe2b9('0xa')][_0x3d9773['id']]){if(_['isNil'](this[_0xe2b9('0xa')][_0x3d9773['id']][_0xe2b9('0x31')])){this['mailAccounts'][_0x3d9773['id']][_0xe2b9('0x31')]={};}this[_0xe2b9('0xa')][_0x3d9773['id']][_0xe2b9('0x31')]['lastSync']=moment();return new BPromise(function(_0x4b5692,_0x23d271){return _0x37a9db[_0xe2b9('0xc')][_0xe2b9('0x32')](_0x3d9773)[_0xe2b9('0x29')](function(_0x5d8896){_0x37a9db['mailAccounts'][_0x3d9773['id']][_0xe2b9('0x31')]['status']=_0xe2b9('0x33');_0x37a9db[_0xe2b9('0xa')][_0x3d9773['id']]['Smtp'][_0xe2b9('0x12')]='';_0x37a9db['emit'](_0x3d9773['id']);_0x4b5692(_0x5d8896);})[_0xe2b9('0x34')](function(_0x3d795b){_0x37a9db['mailAccounts'][_0x3d9773['id']][_0xe2b9('0x31')][_0xe2b9('0x11')]=_0xe2b9('0x1d');_0x37a9db[_0xe2b9('0xa')][_0x3d9773['id']][_0xe2b9('0x31')][_0xe2b9('0x12')]=_0x3d795b;_0x37a9db['emit'](_0x3d9773['id']);_0x23d271(_0x3d795b);});});}return this[_0xe2b9('0xc')][_0xe2b9('0x32')](_0x3d9773);};module['exports']=EmailChannel; \ No newline at end of file +var _0xf83f=['./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','sendMail','send','Smtp','lastSync','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter'];(function(_0x16660f,_0x476509){var _0x47ca80=function(_0x384258){while(--_0x384258){_0x16660f['push'](_0x16660f['shift']());}};_0x47ca80(++_0x476509);}(_0xf83f,0xcd));var _0xff83=function(_0x21ce01,_0x5a5e6a){_0x21ce01=_0x21ce01-0x0;var _0x4ac3d3=_0xf83f[_0x21ce01];return _0x4ac3d3;};'use strict';var _=require(_0xff83('0x0'));var moment=require(_0xff83('0x1'));var BPromise=require(_0xff83('0x2'));var md5=require(_0xff83('0x3'));var Redis=require(_0xff83('0x4'));var config=require(_0xff83('0x5'));var logger=require(_0xff83('0x6'))(_0xff83('0x7'));config[_0xff83('0x8')]=_[_0xff83('0x9')](config[_0xff83('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xff83('0xa'))(new Redis(config[_0xff83('0x8')]));var EmailImap=require(_0xff83('0xb'));var EmailSmtp=require(_0xff83('0xc'));var mailAccount=require(_0xff83('0xd'));var md5Accounts={};function EmailChannel(_0x2c2d24){logger[_0xff83('0xe')](_0xff83('0xf'));this[_0xff83('0x10')]=_0x2c2d24[_0xff83('0x10')];this[_0xff83('0x11')]={};this[_0xff83('0x12')]=new EmailSmtp();}EmailChannel[_0xff83('0x13')][_0xff83('0x14')]=function(_0x2c834e){var _0xb3fecf=this[_0xff83('0x10')][_0x2c834e];var _0xff174d={'id':_0xb3fecf['id'],'name':_0xb3fecf[_0xff83('0x15')],'key':_0xb3fecf[_0xff83('0x16')],'active':_0xb3fecf[_0xff83('0x17')],'Imap':{'status':_0xb3fecf[_0xff83('0x18')]['status'],'messageStatus':_0xb3fecf[_0xff83('0x18')][_0xff83('0x19')],'total':_0xb3fecf[_0xff83('0x18')][_0xff83('0x1a')]}};if(_[_0xff83('0x1b')](md5Accounts[_0x2c834e])){md5Accounts[_0x2c834e]={};}var _0x104223=md5(JSON[_0xff83('0x1c')](_0xff174d));if(md5Accounts[_0x2c834e][_0xff83('0x3')]!==_0x104223){md5Accounts[_0x2c834e][_0xff83('0x3')]=_0x104223;io[_0xff83('0x14')](_0xff83('0x1d'),_0xff174d);}};EmailChannel[_0xff83('0x13')][_0xff83('0x1e')]=function(_0x361056){for(var _0x173d1d in _0x361056){if(_0x361056['hasOwnProperty'](_0x173d1d)){if(_0x361056[_0x173d1d][_0xff83('0x18')]&&_0x361056[_0x173d1d][_0xff83('0x17')]){var _0x2e6980=_0x361056[_0x173d1d][_0xff83('0x18')];if(!this[_0xff83('0x11')][_0xff83('0x1f')](_0x2e6980['id'])){this[_0xff83('0x11')][_0x2e6980['id']]=new EmailImap(_0x2e6980,_0x361056[_0x173d1d][_0xff83('0x7')]);this[_0xff83('0x11')][_0x2e6980['id']]['on'](_0xff83('0x20'),this['handleImapBox'][_0xff83('0x21')](this,_0x173d1d));this[_0xff83('0x11')][_0x2e6980['id']]['on'](_0xff83('0x7'),this[_0xff83('0x22')][_0xff83('0x21')](this,_0x173d1d));this[_0xff83('0x11')][_0x2e6980['id']]['on'](_0xff83('0x23'),this[_0xff83('0x24')]['bind'](this,_0x173d1d));this[_0xff83('0x11')][_0x2e6980['id']]['on'](_0xff83('0x25'),this[_0xff83('0x26')][_0xff83('0x21')](this,_0x173d1d));}}else{if(_[_0xff83('0x1b')](this[_0xff83('0x10')][_0x173d1d][_0xff83('0x18')])){this['mailAccounts'][_0x173d1d][_0xff83('0x18')]={};}this[_0xff83('0x10')][_0x173d1d][_0xff83('0x18')][_0xff83('0x27')]='disabled';this[_0xff83('0x10')][_0x173d1d][_0xff83('0x18')][_0xff83('0x19')]='';this[_0xff83('0x14')](_0x173d1d);}}}};EmailChannel[_0xff83('0x13')][_0xff83('0x28')]=function(_0x410102,_0x29b5b7){if(this[_0xff83('0x10')][_0x410102]){this[_0xff83('0x10')][_0x410102][_0xff83('0x18')][_0xff83('0x27')]=_0xff83('0x29');this[_0xff83('0x10')][_0x410102][_0xff83('0x18')][_0xff83('0x19')]=_0x29b5b7['name'];if(_0x29b5b7[_0xff83('0x2a')]){this[_0xff83('0x10')][_0x410102][_0xff83('0x18')][_0xff83('0x1a')]=_0x29b5b7[_0xff83('0x2a')]['total'];}return this[_0xff83('0x14')](_0x410102);}};EmailChannel[_0xff83('0x13')]['handleImapEmail']=function(_0x3f807a,_0x1eb784){logger['info'](_0xff83('0x2b'),_0x1eb784[_0xff83('0x2c')],_0x1eb784[_0xff83('0x2d')],_0x1eb784['from'],_0x3f807a);if(this[_0xff83('0x10')][_0x3f807a]){return mailAccount[_0xff83('0x2e')](_0x3f807a,_0x1eb784)[_0xff83('0x2f')](function(_0x5c27f5){if(_0x5c27f5){logger[_0xff83('0xe')](_0xff83('0x30'));}})['catch'](function(_0xb9eda1){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xff83('0x1c')](_0xb9eda1));});}};EmailChannel[_0xff83('0x13')]['handleImapEnd']=function(_0x45f021){if(this[_0xff83('0x10')][_0x45f021]&&this[_0xff83('0x10')][_0x45f021][_0xff83('0x18')]){if(this['imapAccounts'][this[_0xff83('0x10')][_0x45f021][_0xff83('0x18')]['id']]){delete this[_0xff83('0x11')][this[_0xff83('0x10')][_0x45f021][_0xff83('0x18')]['id']];}this[_0xff83('0x10')][_0x45f021][_0xff83('0x18')]['lastSync']=moment();this[_0xff83('0x14')](_0x45f021);}};EmailChannel[_0xff83('0x13')]['handleImapError']=function(_0x50807b,_0x55f54d){if(this['mailAccounts'][_0x50807b]){this[_0xff83('0x10')][_0x50807b][_0xff83('0x18')]['status']=_0xff83('0x25');this[_0xff83('0x10')][_0x50807b][_0xff83('0x18')][_0xff83('0x19')]=_0x55f54d;return this[_0xff83('0x14')](_0x50807b);}};EmailChannel[_0xff83('0x13')][_0xff83('0x31')]=function(_0x482be2,_0x400522){return this['smtp'][_0xff83('0x32')](_0x482be2,_0x400522);};EmailChannel[_0xff83('0x13')]['verifySmtp']=function(_0x4470fa){var _0x5f5b05=this;if(this[_0xff83('0x10')][_0x4470fa['id']]){if(_[_0xff83('0x1b')](this[_0xff83('0x10')][_0x4470fa['id']][_0xff83('0x33')])){this['mailAccounts'][_0x4470fa['id']][_0xff83('0x33')]={};}this[_0xff83('0x10')][_0x4470fa['id']][_0xff83('0x33')][_0xff83('0x34')]=moment();return new BPromise(function(_0x2a1fc1,_0x204d4f){return _0x5f5b05[_0xff83('0x12')]['verify'](_0x4470fa)[_0xff83('0x2f')](function(_0xb197aa){_0x5f5b05[_0xff83('0x10')][_0x4470fa['id']][_0xff83('0x33')][_0xff83('0x27')]=_0xff83('0x35');_0x5f5b05[_0xff83('0x10')][_0x4470fa['id']][_0xff83('0x33')][_0xff83('0x19')]='';_0x5f5b05[_0xff83('0x14')](_0x4470fa['id']);_0x2a1fc1(_0xb197aa);})['catch'](function(_0x1ace16){_0x5f5b05[_0xff83('0x10')][_0x4470fa['id']][_0xff83('0x33')][_0xff83('0x27')]=_0xff83('0x25');_0x5f5b05[_0xff83('0x10')][_0x4470fa['id']][_0xff83('0x33')]['messageStatus']=_0x1ace16;_0x5f5b05[_0xff83('0x14')](_0x4470fa['id']);_0x204d4f(_0x1ace16);});});}return this[_0xff83('0x12')]['verify'](_0x4470fa);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f29ddb9..9b031e9 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 _0x6217=['message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','emit','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','path','util','imap','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','required','getHost','anonymous@xcally.com','handleOpenBox','box','readUnseen','UNSEEN','handleReadUnseen','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6217,0x1bc));var _0x7621=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x6217[_0x38fb8b];return _0x1ec681;};'use strict';var fs=require('fs');var path=require(_0x7621('0x0'));var util=require(_0x7621('0x1'));var Imap=require(_0x7621('0x2'));var _=require(_0x7621('0x3'));var rs=require(_0x7621('0x4'));var simpleParser=require(_0x7621('0x5'))[_0x7621('0x6')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x7621('0x7'))[_0x7621('0x8')];var utils=require(_0x7621('0x9'));var logger=require(_0x7621('0xa'))(_0x7621('0xb'));function EmailImap(_0x14c30b,_0x1cef2e){this[_0x7621('0xc')]=_0x7621('0xd');this[_0x7621('0xe')]=this[_0x7621('0xf')](_0x14c30b,_0x1cef2e);this[_0x7621('0x2')]=new Imap(this[_0x7621('0xe')]);this[_0x7621('0x2')]['once'](_0x7621('0x10'),this[_0x7621('0x11')][_0x7621('0x12')](this));this['imap'][_0x7621('0x13')](_0x7621('0x14'),this[_0x7621('0x15')][_0x7621('0x12')](this));this[_0x7621('0x2')]['on'](_0x7621('0x16'),this[_0x7621('0x17')][_0x7621('0x12')](this));this[_0x7621('0x2')]['connect']();}util[_0x7621('0x18')](EmailImap,EventEmitter);EmailImap[_0x7621('0x19')]['getAccount']=function(_0x5e543f,_0x39484e){var _0x56eb46={'connTimeout':_0x5e543f['connTimeout']?_0x5e543f[_0x7621('0x1a')]*0x3e8:0x2710,'authTimeout':_0x5e543f[_0x7621('0x1b')]?_0x5e543f[_0x7621('0x1b')]*0x3e8:0x1388};if(_[_0x7621('0x1c')](_0x5e543f[_0x7621('0x1d')])){if(_0x5e543f['authentication']){_0x56eb46[_0x7621('0x1e')]=_0x5e543f[_0x7621('0x1e')];_0x56eb46[_0x7621('0x1f')]=_0x5e543f['password'];}_0x56eb46['host']=_0x5e543f[_0x7621('0x20')];_0x56eb46[_0x7621('0x21')]=_0x5e543f[_0x7621('0x21')]||0x3e1;if(_0x5e543f['tls']){_0x56eb46[_0x7621('0x22')]=!![];}else{_0x56eb46[_0x7621('0x22')]=![];_0x56eb46['autotls']=_0x7621('0x23');}}else{_0x56eb46[_0x7621('0x1e')]=_0x5e543f['user'];_0x56eb46[_0x7621('0x1f')]=_0x5e543f[_0x7621('0x1f')];_0x56eb46[_0x7621('0x20')]=utils[_0x7621('0x24')](_0x5e543f[_0x7621('0x1d')]);_0x56eb46['port']=0x3e1;_0x56eb46[_0x7621('0x22')]=!![];}_0x56eb46[_0x7621('0xb')]=_0x39484e||_0x5e543f['user']||_0x7621('0x25');return _0x56eb46;};EmailImap[_0x7621('0x19')][_0x7621('0x11')]=function(){this[_0x7621('0x2')]['openBox'](this[_0x7621('0xc')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x7621('0x19')][_0x7621('0x26')]=function(_0x249ff6,_0x5d2eb8){if(_0x249ff6){this[_0x7621('0x17')](_0x249ff6,!![]);}else{this['emit'](_0x7621('0x27'),_0x5d2eb8);this[_0x7621('0x28')]();}};EmailImap[_0x7621('0x19')]['handleCloseBox']=function(_0x15289e){if(_0x15289e){this[_0x7621('0x17')](_0x15289e,!![]);}else{this[_0x7621('0x2')]['end']();}};EmailImap[_0x7621('0x19')][_0x7621('0x28')]=function(){this[_0x7621('0x2')]['search']([_0x7621('0x29')],this[_0x7621('0x2a')][_0x7621('0x12')](this));};EmailImap[_0x7621('0x19')][_0x7621('0x2a')]=function(_0x4d8e21,_0x159530){if(_0x4d8e21){this['handleError'](_0x4d8e21,!![]);}else{if(_0x159530[_0x7621('0x2b')]){try{var _0x1564cd=this['imap']['fetch'](_0x159530,{'bodies':'','markSeen':!![]});_0x1564cd['on'](_0x7621('0x2c'),this[_0x7621('0x2d')][_0x7621('0x12')](this));_0x1564cd[_0x7621('0x13')]('error',this[_0x7621('0x2e')]['bind'](this));_0x1564cd[_0x7621('0x13')](_0x7621('0x14'),this['handleFetchEnd'][_0x7621('0x12')](this));}catch(_0x5a4ffd){logger[_0x7621('0x16')](_0x5a4ffd);}}else{this[_0x7621('0x2')][_0x7621('0x2f')](!![],this[_0x7621('0x30')][_0x7621('0x12')](this));}}};EmailImap['prototype'][_0x7621('0x2d')]=function(_0x3384c1,_0x481999){_0x3384c1['on'](_0x7621('0x31'),this['handleMessageBody']['bind'](this));_0x3384c1['once'](_0x7621('0x32'),this[_0x7621('0x33')]['bind'](this));_0x3384c1[_0x7621('0x13')](_0x7621('0x14'),this[_0x7621('0x34')][_0x7621('0x12')](this));};EmailImap[_0x7621('0x19')][_0x7621('0x35')]=function(_0x2bb555,_0x530541){simpleParser(_0x2bb555,{'Iconv':Iconv},this[_0x7621('0x36')][_0x7621('0x12')](this));};EmailImap['prototype'][_0x7621('0x33')]=function(_0x434eeb){};EmailImap[_0x7621('0x19')][_0x7621('0x34')]=function(){};EmailImap[_0x7621('0x19')][_0x7621('0x36')]=function(_0x3d39f3,_0x5edecf){if(_0x3d39f3){logger[_0x7621('0x16')](_0x3d39f3);}else{var _0x2cb59d=this;utils['parser'](this[_0x7621('0xe')],_0x5edecf,function(_0x11d60d){_0x2cb59d[_0x7621('0x37')](_0x7621('0xb'),_0x11d60d);});}};EmailImap[_0x7621('0x19')][_0x7621('0x38')]=function(){this[_0x7621('0x2')][_0x7621('0x2f')](!![],this['handleCloseBox'][_0x7621('0x12')](this));};EmailImap[_0x7621('0x19')][_0x7621('0x2e')]=function(_0x174ad5){this[_0x7621('0x17')](_0x174ad5);this[_0x7621('0x2')]['closeBox'](!![],this[_0x7621('0x30')][_0x7621('0x12')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x7621('0x37')]('end');};EmailImap[_0x7621('0x19')][_0x7621('0x17')]=function(_0xff84b2,_0x276bd9){logger[_0x7621('0x16')](_0x7621('0x17'),this[_0x7621('0xe')][_0x7621('0xb')],JSON[_0x7621('0x39')](_0xff84b2));var _0xa62c2f='';if(_0xff84b2){if(_0xff84b2[_0x7621('0x3a')]){_0xa62c2f=_0xff84b2[_0x7621('0x3a')];}else{for(var _0xdc478c in _0xff84b2){if(_0xff84b2[_0x7621('0x3b')](_0xdc478c)){_0xa62c2f+=_[_0x7621('0x3c')](_0xdc478c)+':\x20'+_0xff84b2[_0xdc478c]+'\x0a';}}}}if(_0x276bd9){this[_0x7621('0x2')][_0x7621('0x14')]();}else{this['emit'](_0x7621('0x16'),_0xa62c2f);this['emit'](_0x7621('0x14'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x21a6=['getAccount','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','hasOwnProperty','upperFirst','exports','util','imap','lodash','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x21a6,0x129));var _0x621a=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x21a6[_0x1a0600];return _0x734670;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x621a('0x0'));var Imap=require(_0x621a('0x1'));var _=require(_0x621a('0x2'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0x621a('0x3')];var Iconv=require(_0x621a('0x4'))[_0x621a('0x5')];var EventEmitter=require(_0x621a('0x6'))[_0x621a('0x7')];var utils=require(_0x621a('0x8'));var logger=require(_0x621a('0x9'))(_0x621a('0xa'));function EmailImap(_0x51de01,_0x3ca86b){this[_0x621a('0xb')]=_0x621a('0xc');this['account']=this[_0x621a('0xd')](_0x51de01,_0x3ca86b);this[_0x621a('0x1')]=new Imap(this[_0x621a('0xe')]);this[_0x621a('0x1')][_0x621a('0xf')](_0x621a('0x10'),this[_0x621a('0x11')][_0x621a('0x12')](this));this[_0x621a('0x1')][_0x621a('0xf')](_0x621a('0x13'),this[_0x621a('0x14')]['bind'](this));this[_0x621a('0x1')]['on'](_0x621a('0x15'),this[_0x621a('0x16')][_0x621a('0x12')](this));this[_0x621a('0x1')]['connect']();}util[_0x621a('0x17')](EmailImap,EventEmitter);EmailImap[_0x621a('0x18')]['getAccount']=function(_0x36d359,_0x3dd39e){var _0xfee4b3={'connTimeout':_0x36d359['connTimeout']?_0x36d359['connTimeout']*0x3e8:0x2710,'authTimeout':_0x36d359[_0x621a('0x19')]?_0x36d359['authTimeout']*0x3e8:0x1388};if(_[_0x621a('0x1a')](_0x36d359[_0x621a('0x1b')])){if(_0x36d359['authentication']){_0xfee4b3[_0x621a('0x1c')]=_0x36d359[_0x621a('0x1c')];_0xfee4b3[_0x621a('0x1d')]=_0x36d359['password'];}_0xfee4b3[_0x621a('0x1e')]=_0x36d359['host'];_0xfee4b3[_0x621a('0x1f')]=_0x36d359[_0x621a('0x1f')]||0x3e1;if(_0x36d359[_0x621a('0x20')]){_0xfee4b3[_0x621a('0x20')]=!![];}else{_0xfee4b3[_0x621a('0x20')]=![];_0xfee4b3[_0x621a('0x21')]=_0x621a('0x22');}}else{_0xfee4b3['user']=_0x36d359['user'];_0xfee4b3[_0x621a('0x1d')]=_0x36d359[_0x621a('0x1d')];_0xfee4b3[_0x621a('0x1e')]=utils[_0x621a('0x23')](_0x36d359[_0x621a('0x1b')]);_0xfee4b3[_0x621a('0x1f')]=0x3e1;_0xfee4b3['tls']=!![];}_0xfee4b3[_0x621a('0xa')]=_0x3dd39e||_0x36d359[_0x621a('0x1c')]||_0x621a('0x24');return _0xfee4b3;};EmailImap[_0x621a('0x18')][_0x621a('0x11')]=function(){this[_0x621a('0x1')][_0x621a('0x25')](this[_0x621a('0xb')],![],this[_0x621a('0x26')][_0x621a('0x12')](this));};EmailImap['prototype'][_0x621a('0x26')]=function(_0x2aee1f,_0x3e3538){if(_0x2aee1f){this[_0x621a('0x16')](_0x2aee1f,!![]);}else{this[_0x621a('0x27')](_0x621a('0x28'),_0x3e3538);this[_0x621a('0x29')]();}};EmailImap[_0x621a('0x18')]['handleCloseBox']=function(_0x5dd0a4){if(_0x5dd0a4){this[_0x621a('0x16')](_0x5dd0a4,!![]);}else{this[_0x621a('0x1')][_0x621a('0x13')]();}};EmailImap[_0x621a('0x18')][_0x621a('0x29')]=function(){this[_0x621a('0x1')][_0x621a('0x2a')]([_0x621a('0x2b')],this[_0x621a('0x2c')][_0x621a('0x12')](this));};EmailImap[_0x621a('0x18')][_0x621a('0x2c')]=function(_0xe38704,_0x56b1bf){if(_0xe38704){this['handleError'](_0xe38704,!![]);}else{if(_0x56b1bf['length']){try{var _0x3955a0=this[_0x621a('0x1')]['fetch'](_0x56b1bf,{'bodies':'','markSeen':!![]});_0x3955a0['on'](_0x621a('0x2d'),this[_0x621a('0x2e')][_0x621a('0x12')](this));_0x3955a0[_0x621a('0xf')]('error',this[_0x621a('0x2f')][_0x621a('0x12')](this));_0x3955a0[_0x621a('0xf')](_0x621a('0x13'),this['handleFetchEnd']['bind'](this));}catch(_0x2996fc){logger[_0x621a('0x15')](_0x2996fc);}}else{this[_0x621a('0x1')][_0x621a('0x30')](!![],this[_0x621a('0x31')][_0x621a('0x12')](this));}}};EmailImap['prototype'][_0x621a('0x2e')]=function(_0x442120,_0x4070dd){_0x442120['on'](_0x621a('0x32'),this[_0x621a('0x33')][_0x621a('0x12')](this));_0x442120[_0x621a('0xf')](_0x621a('0x34'),this[_0x621a('0x35')][_0x621a('0x12')](this));_0x442120['once'](_0x621a('0x13'),this[_0x621a('0x36')]['bind'](this));};EmailImap[_0x621a('0x18')][_0x621a('0x33')]=function(_0x13db08,_0x437263){simpleParser(_0x13db08,{'Iconv':Iconv},this[_0x621a('0x37')][_0x621a('0x12')](this));};EmailImap[_0x621a('0x18')][_0x621a('0x35')]=function(_0xfced99){};EmailImap[_0x621a('0x18')][_0x621a('0x36')]=function(){};EmailImap[_0x621a('0x18')][_0x621a('0x37')]=function(_0x30d095,_0xd854a5){if(_0x30d095){logger[_0x621a('0x15')](_0x30d095);}else{var _0x5b910d=this;utils[_0x621a('0x38')](this[_0x621a('0xe')],_0xd854a5,function(_0x53a70c){_0x5b910d['emit'](_0x621a('0xa'),_0x53a70c);});}};EmailImap[_0x621a('0x18')][_0x621a('0x39')]=function(){this[_0x621a('0x1')]['closeBox'](!![],this[_0x621a('0x31')][_0x621a('0x12')](this));};EmailImap[_0x621a('0x18')][_0x621a('0x2f')]=function(_0x14f9c0){this[_0x621a('0x16')](_0x14f9c0);this['imap']['closeBox'](!![],this[_0x621a('0x31')][_0x621a('0x12')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x621a('0x27')]('end');};EmailImap['prototype']['handleError']=function(_0x473bad,_0x28dea4){logger[_0x621a('0x15')](_0x621a('0x16'),this['account'][_0x621a('0xa')],JSON[_0x621a('0x3a')](_0x473bad));var _0x3820f9='';if(_0x473bad){if(_0x473bad['textCode']){_0x3820f9=_0x473bad['textCode'];}else{for(var _0x19479a in _0x473bad){if(_0x473bad[_0x621a('0x3b')](_0x19479a)){_0x3820f9+=_[_0x621a('0x3c')](_0x19479a)+':\x20'+_0x473bad[_0x19479a]+'\x0a';}}}}if(_0x28dea4){this['imap'][_0x621a('0x13')]();}else{this[_0x621a('0x27')](_0x621a('0x15'),_0x3820f9);this[_0x621a('0x27')]('end');}};module[_0x621a('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index a7fa333..862daba 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 _0x16a5=['prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x469852,_0x532e8c){var _0xa844b9=function(_0x511046){while(--_0x511046){_0x469852['push'](_0x469852['shift']());}};_0xa844b9(++_0x532e8c);}(_0x16a5,0x18f));var _0x516a=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x16a5[_0x4b26b5];return _0x4dec71;};'use strict';var nodemailer=require(_0x516a('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x516a('0x1')]['send']=function(_0x3d566d,_0x2deebe){return new BPromise(function(_0x47a559,_0x246462){var _0x3284d3=nodemailer[_0x516a('0x2')](_0x3d566d);_0x3284d3[_0x516a('0x3')](_0x516a('0x4'),inlineBase64());_0x3284d3[_0x516a('0x5')](_0x2deebe,function(_0x20e8ea,_0x4498de){if(_0x20e8ea){_0x246462(_0x20e8ea[_0x516a('0x6')]());}else{_0x47a559(_0x4498de);}});});};EmailSmtp[_0x516a('0x1')][_0x516a('0x7')]=function(_0x2f88d7){return new BPromise(function(_0x425220,_0x2178c4){var _0x6b9604=nodemailer[_0x516a('0x2')](_0x2f88d7);_0x6b9604['verify'](function(_0x30d7e8,_0x5916f6){if(_0x30d7e8){_0x2178c4(_0x30d7e8[_0x516a('0x6')]());}else{if(_0x5916f6){_0x425220(_0x5916f6);}else{_0x2178c4(_0x516a('0x8'));}}});});};module[_0x516a('0x9')]=EmailSmtp; \ No newline at end of file +var _0xc364=['Not\x20verifired','exports','nodemailer','bluebird','prototype','createTransport','use','compile','toString','verify'];(function(_0x565d21,_0x55b8f1){var _0x4ed1f8=function(_0x3a679a){while(--_0x3a679a){_0x565d21['push'](_0x565d21['shift']());}};_0x4ed1f8(++_0x55b8f1);}(_0xc364,0x8e));var _0x4c36=function(_0x3fd66d,_0x410d26){_0x3fd66d=_0x3fd66d-0x0;var _0x5a6464=_0xc364[_0x3fd66d];return _0x5a6464;};'use strict';var nodemailer=require(_0x4c36('0x0'));var BPromise=require(_0x4c36('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x4c36('0x2')]['send']=function(_0x28163b,_0x3fcbad){return new BPromise(function(_0x1e0ea5,_0x598df6){var _0x2ab39c=nodemailer[_0x4c36('0x3')](_0x28163b);_0x2ab39c[_0x4c36('0x4')](_0x4c36('0x5'),inlineBase64());_0x2ab39c['sendMail'](_0x3fcbad,function(_0x222cfb,_0x3bc16a){if(_0x222cfb){_0x598df6(_0x222cfb[_0x4c36('0x6')]());}else{_0x1e0ea5(_0x3bc16a);}});});};EmailSmtp[_0x4c36('0x2')]['verify']=function(_0x41b9fa){return new BPromise(function(_0x2fc6e0,_0x53be2c){var _0x510199=nodemailer['createTransport'](_0x41b9fa);_0x510199[_0x4c36('0x7')](function(_0xb2915c,_0x386b80){if(_0xb2915c){_0x53be2c(_0xb2915c[_0x4c36('0x6')]());}else{if(_0x386b80){_0x2fc6e0(_0x386b80);}else{_0x53be2c(_0x4c36('0x8'));}}});});};module[_0x4c36('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f5b6b72..5ff6d8a 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 _0xf8e2=['node-tnef','../../../config/logger','email','../../../config/environment','head','address','generate','value','name','split','length','join','Anonymous','pop','anonymous','@xcally.com','html','replace','body','textAsHtml','message','originTo','isEmpty','includes','originCc','bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','parser','from','subject','messageId','inReplyTo','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','getHost','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util'];(function(_0x36d01e,_0x3119fe){var _0xd23fba=function(_0x33036e){while(--_0x33036e){_0x36d01e['push'](_0x36d01e['shift']());}};_0xd23fba(++_0x3119fe);}(_0xf8e2,0x181));var _0x2f8e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf8e2[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2f8e('0x0'));var moment=require(_0x2f8e('0x1'));var random=require(_0x2f8e('0x2'));var fs=require('fs');var path=require(_0x2f8e('0x3'));var util=require(_0x2f8e('0x4'));var tnef=require(_0x2f8e('0x5'));var logger=require(_0x2f8e('0x6'))(_0x2f8e('0x7'));var config=require(_0x2f8e('0x8'));function getAddress(_0x1ca06c){var _0x154137=_[_0x2f8e('0x9')](_0x1ca06c['value']);return _0x154137&&_0x154137[_0x2f8e('0xa')]?_0x154137[_0x2f8e('0xa')]:'anonymous'+random[_0x2f8e('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x1b51c7){var _0x224aa9=_['head'](_0x1b51c7[_0x2f8e('0xc')]);if(_0x224aa9&&_0x224aa9[_0x2f8e('0xd')]){var _0x478c4d=_0x224aa9[_0x2f8e('0xd')][_0x2f8e('0xe')](/\s+/);return _0x478c4d[_0x2f8e('0xf')]?_0x478c4d['slice'](0x0,-0x1)[_0x2f8e('0x10')]('\x20'):_0x224aa9[_0x2f8e('0xd')];}return _0x2f8e('0x11');}function getLastName(_0x4a9cb9){var _0x61c25a=_[_0x2f8e('0x9')](_0x4a9cb9[_0x2f8e('0xc')]);if(_0x61c25a&&_0x61c25a[_0x2f8e('0xd')]){var _0x4d93d1=_0x61c25a[_0x2f8e('0xd')]['split'](/\s+/);return _0x4d93d1[_0x2f8e('0xf')]>0x1?_0x4d93d1[_0x2f8e('0x12')]():'';}return'';}function getMails(_0x2d2578,_0x1479f0){var _0x555007='';for(var _0x45a329=0x0;_0x45a329<_0x1479f0['value']['length'];_0x45a329+=0x1){if(_0x1479f0['value'][_0x45a329][_0x2f8e('0xa')]!==_0x2d2578){if(!_['isEmpty'](_0x555007)){_0x555007+=',';}_0x555007+=_0x1479f0[_0x2f8e('0xc')][_0x45a329][_0x2f8e('0xd')]||_0x1479f0[_0x2f8e('0xc')][_0x45a329][_0x2f8e('0xa')]||'';_0x555007+='\x20<';_0x555007+=_0x1479f0[_0x2f8e('0xc')][_0x45a329]['address']?_0x1479f0[_0x2f8e('0xc')][_0x45a329]['address']:_0x2f8e('0x13')+random[_0x2f8e('0xb')](0x6)+_0x2f8e('0x14');_0x555007+='>';}}return _0x555007;}function parseEmail(_0x10c0a9,_0x2b9056,_0x37b7bc){if(_0x2b9056['html']){var _0x4377b7=/)<[^<]*)*<\/script>/gi;while(_0x4377b7['test'](_0x2b9056[_0x2f8e('0x15')])){_0x2b9056['html']=_0x2b9056[_0x2f8e('0x15')][_0x2f8e('0x16')](_0x4377b7,'');}_0x37b7bc[_0x2f8e('0x17')]=_0x2b9056[_0x2f8e('0x15')];}else{_0x37b7bc['body']=_0x2b9056[_0x2f8e('0x18')];}if(_0x37b7bc[_0x2f8e('0x17')]){_0x37b7bc[_0x2f8e('0x17')]=_0x37b7bc[_0x2f8e('0x17')]['replace'](/Empty\x20message

';if(_0x13c728[_0x2f8e('0x37')]){for(var _0x36723c=0x0;_0x36723c<_0x13c728['Attachments'][_0x2f8e('0xf')];_0x36723c++){var _0x170eab=_0x13c728['Attachments'][_0x36723c];_0x185da1[_0x2f8e('0x19')][_0x2f8e('0x1f')]['push']({'filename':_0x170eab[_0x2f8e('0x38')],'content':new Buffer(_0x170eab[_0x2f8e('0x39')])});}}}_0x4681bf(parseEmail(_0x3be367,_0x543932,_0x185da1));});}else{_0x543932[_0x2f8e('0x15')]=_0x2f8e('0x3a');_0x4681bf(parseEmail(_0x3be367,_0x543932,_0x185da1));}}else{_0x4681bf(parseEmail(_0x3be367,_0x543932,_0x185da1));}};exports[_0x2f8e('0x3b')]=function(_0x178f09){switch(_0x178f09){case'gmail':return _0x2f8e('0x3c');case _0x2f8e('0x3d'):return'imap.mail.yahoo.com';case'hotmail':return _0x2f8e('0x3e');case _0x2f8e('0x3f'):return'outlook.office365.com';}return _0x2f8e('0x40');}; \ No newline at end of file +var _0xa78b=['name','split','length','slice','Anonymous','isEmpty','anonymous','html','test','textAsHtml','body','replace','message','includes','originTo','bcc','attachments','attach','attachment','filename','format','%s-%s','now','join','root','server/files/attachments/','content','push','contentType','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com'];(function(_0xd92111,_0x339fb7){var _0x4c7f39=function(_0x3faa03){while(--_0x3faa03){_0xd92111['push'](_0xd92111['shift']());}};_0x4c7f39(++_0x339fb7);}(_0xa78b,0xf0));var _0xba78=function(_0x10b1f5,_0x33a1b3){_0x10b1f5=_0x10b1f5-0x0;var _0x3e3410=_0xa78b[_0x10b1f5];return _0x3e3410;};'use strict';var _=require(_0xba78('0x0'));var moment=require(_0xba78('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xba78('0x2'));var tnef=require(_0xba78('0x3'));var logger=require(_0xba78('0x4'))(_0xba78('0x5'));var config=require(_0xba78('0x6'));function getAddress(_0x3024f1){var _0x41b728=_[_0xba78('0x7')](_0x3024f1[_0xba78('0x8')]);return _0x41b728&&_0x41b728['address']?_0x41b728[_0xba78('0x9')]:'anonymous'+random[_0xba78('0xa')](0x6)+_0xba78('0xb');}function getFirstName(_0x20cdf2){var _0x2f4371=_['head'](_0x20cdf2[_0xba78('0x8')]);if(_0x2f4371&&_0x2f4371[_0xba78('0xc')]){var _0x1cc9f3=_0x2f4371[_0xba78('0xc')][_0xba78('0xd')](/\s+/);return _0x1cc9f3[_0xba78('0xe')]?_0x1cc9f3[_0xba78('0xf')](0x0,-0x1)['join']('\x20'):_0x2f4371[_0xba78('0xc')];}return _0xba78('0x10');}function getLastName(_0x1c32aa){var _0x2b75c7=_[_0xba78('0x7')](_0x1c32aa[_0xba78('0x8')]);if(_0x2b75c7&&_0x2b75c7[_0xba78('0xc')]){var _0x9cde56=_0x2b75c7[_0xba78('0xc')]['split'](/\s+/);return _0x9cde56[_0xba78('0xe')]>0x1?_0x9cde56['pop']():'';}return'';}function getMails(_0x27d2b6,_0x221562){var _0x3725d0='';for(var _0x41442a=0x0;_0x41442a<_0x221562[_0xba78('0x8')][_0xba78('0xe')];_0x41442a+=0x1){if(_0x221562[_0xba78('0x8')][_0x41442a][_0xba78('0x9')]!==_0x27d2b6){if(!_[_0xba78('0x11')](_0x3725d0)){_0x3725d0+=',';}_0x3725d0+=_0x221562[_0xba78('0x8')][_0x41442a]['name']||_0x221562['value'][_0x41442a][_0xba78('0x9')]||'';_0x3725d0+='\x20<';_0x3725d0+=_0x221562[_0xba78('0x8')][_0x41442a][_0xba78('0x9')]?_0x221562[_0xba78('0x8')][_0x41442a][_0xba78('0x9')]:_0xba78('0x12')+random['generate'](0x6)+_0xba78('0xb');_0x3725d0+='>';}}return _0x3725d0;}function parseEmail(_0xf75bab,_0x4537fc,_0x32921d){if(_0x4537fc[_0xba78('0x13')]){var _0x419d6c=/)<[^<]*)*<\/script>/gi;while(_0x419d6c[_0xba78('0x14')](_0x4537fc[_0xba78('0x13')])){_0x4537fc[_0xba78('0x13')]=_0x4537fc[_0xba78('0x13')]['replace'](_0x419d6c,'');}_0x32921d['body']=_0x4537fc[_0xba78('0x13')];}else{_0x32921d['body']=_0x4537fc[_0xba78('0x15')];}if(_0x32921d[_0xba78('0x16')]){_0x32921d[_0xba78('0x16')]=_0x32921d[_0xba78('0x16')][_0xba78('0x17')](/0x0){if(this[_0x40d58e+_0x5bc9('0x26')]>0x0&&this[_0x40d58e+_0x5bc9('0x25')]>=this[_0x40d58e+_0x5bc9('0x26')]){return _0x5bc9('0x27');}else{return _0x5bc9('0x28');}}else{return _0x5bc9('0x29');}};Agent[_0x5bc9('0x2a')]['updateRealtime']=function(){var _0x1add71=[_0x5bc9('0x2b'),_0x5bc9('0x2c'),_0x5bc9('0x2d'),'fax',_0x5bc9('0x2e'),'whatsapp'];for(var _0x358ae1=0x0;_0x358ae1<_0x1add71[_0x5bc9('0x2f')];_0x358ae1+=0x1){var _0x2d0db2=this[_0x5bc9('0x30')](_0x1add71[_0x358ae1]);if(this[_0x1add71[_0x358ae1]+'Status']!==_0x2d0db2){this[_0x1add71[_0x358ae1]+_0x5bc9('0x31')]=_['toNumber'](moment()['format']('x'));}this[_0x1add71[_0x358ae1]+_0x5bc9('0x32')]=_0x2d0db2;}var _0x5124db={'id':this['id'],'name':this[_0x5bc9('0x7')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x5bc9('0x9')],'mailPause':this[_0x5bc9('0xa')],'smsPause':this[_0x5bc9('0xc')],'faxPause':this[_0x5bc9('0xb')],'openchannelPause':this[_0x5bc9('0x33')],'chatStatus':this[_0x5bc9('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x5bc9('0x12')],'mailCapacity':this[_0x5bc9('0x13')],'mailCurrentCapacity':this[_0x5bc9('0x14')],'faxStatus':this[_0x5bc9('0x34')],'faxStatusTime':this[_0x5bc9('0x15')],'faxCapacity':this[_0x5bc9('0x16')],'faxCurrentCapacity':this[_0x5bc9('0x17')],'smsStatus':this[_0x5bc9('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x5bc9('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x5bc9('0x1c')],'whatsappCapacity':this[_0x5bc9('0x1d')],'whatsappCurrentCapacity':this[_0x5bc9('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5bc9('0x21')],'busy':this[_0x5bc9('0x22')],'busyQueue':this[_0x5bc9('0x23')]};var _0x14f047=md5(JSON[_0x5bc9('0x35')](_0x5124db));if(this[_0x5bc9('0x2')]!==_0x14f047){this[_0x5bc9('0x2')]=_0x14f047;io[_0x5bc9('0x36')]('user:save',_0x5124db);}};module[_0x5bc9('0x37')]=Agent; \ No newline at end of file +var _0xd732=['faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','smsCapacity','smsCurrentCapacity','openchannelStatusTime','stringify','emit','user:save','exports','lodash','md5','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus'];(function(_0x4c04c6,_0x382d1a){var _0x25cfc7=function(_0x29f6cf){while(--_0x29f6cf){_0x4c04c6['push'](_0x4c04c6['shift']());}};_0x25cfc7(++_0x382d1a);}(_0xd732,0x18e));var _0x2d73=function(_0x1030fb,_0x30c5f1){_0x1030fb=_0x1030fb-0x0;var _0x4398dd=_0xd732[_0x1030fb];return _0x4398dd;};'use strict';var _=require(_0x2d73('0x0'));var moment=require('moment');var md5=require(_0x2d73('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2d73('0x2')]=_[_0x2d73('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2d73('0x4'))(new Redis(config['redis']));function Agent(_0x462758){this['id']=_0x462758['id']||0x0;this[_0x2d73('0x5')]=_0x462758['name']||'';this['online']=_0x462758[_0x2d73('0x6')]||!![];this['voicePause']=_0x462758[_0x2d73('0x7')]||![];this[_0x2d73('0x8')]=_0x462758[_0x2d73('0x8')]||![];this[_0x2d73('0x9')]=_0x462758['mailPause']||![];this[_0x2d73('0xa')]=_0x462758[_0x2d73('0xa')]||![];this[_0x2d73('0xb')]=_0x462758[_0x2d73('0xb')]||![];this['openchannelPause']=_0x462758[_0x2d73('0xc')]||![];this[_0x2d73('0xd')]=_0x2d73('0xe');this[_0x2d73('0xf')]=0x0;this[_0x2d73('0x10')]=_0x462758[_0x2d73('0x10')]||0x0;this[_0x2d73('0x11')]=0x0;this[_0x2d73('0x12')]=_0x2d73('0xe');this[_0x2d73('0x13')]=0x0;this[_0x2d73('0x14')]=_0x462758[_0x2d73('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x2d73('0x15')]='unknown';this[_0x2d73('0x16')]=0x0;this['faxCapacity']=_0x462758[_0x2d73('0x17')]||0x0;this[_0x2d73('0x18')]=0x0;this[_0x2d73('0x19')]=_0x2d73('0xe');this[_0x2d73('0x1a')]=0x0;this['smsCapacity']=_0x462758['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x2d73('0x1b')]=_0x2d73('0xe');this[_0x2d73('0x1c')]=0x0;this['whatsappCapacity']=_0x462758[_0x2d73('0x1d')]||0x0;this[_0x2d73('0x1e')]=0x0;this[_0x2d73('0x1f')]=_0x2d73('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x462758[_0x2d73('0x20')]||0x0;this[_0x2d73('0x21')]=0x0;this[_0x2d73('0x22')]=![];this[_0x2d73('0x23')]=undefined;this[_0x2d73('0x1')]='';this[_0x2d73('0x24')]();}Agent[_0x2d73('0x25')][_0x2d73('0x26')]=function(_0x503b49){if(this[_0x503b49+_0x2d73('0x27')]>0x0){if(this[_0x503b49+_0x2d73('0x28')]>0x0&&this[_0x503b49+_0x2d73('0x27')]>=this[_0x503b49+_0x2d73('0x28')]){return'maxcapacity';}else{return _0x2d73('0x29');}}else{return _0x2d73('0x2a');}};Agent[_0x2d73('0x25')][_0x2d73('0x24')]=function(){var _0x1899d6=[_0x2d73('0x2b'),_0x2d73('0x2c'),_0x2d73('0x2d'),_0x2d73('0x2e'),_0x2d73('0x2f'),_0x2d73('0x30')];for(var _0x20b818=0x0;_0x20b818<_0x1899d6[_0x2d73('0x31')];_0x20b818+=0x1){var _0x11d2f3=this[_0x2d73('0x26')](_0x1899d6[_0x20b818]);if(this[_0x1899d6[_0x20b818]+_0x2d73('0x32')]!==_0x11d2f3){this[_0x1899d6[_0x20b818]+_0x2d73('0x33')]=_['toNumber'](moment()[_0x2d73('0x34')]('x'));}this[_0x1899d6[_0x20b818]+_0x2d73('0x32')]=_0x11d2f3;}var _0x2cdfd0={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x2d73('0x7')],'chatPause':this[_0x2d73('0x8')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x2d73('0xa')],'openchannelPause':this[_0x2d73('0xc')],'chatStatus':this[_0x2d73('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2d73('0x11')],'mailStatus':this[_0x2d73('0x12')],'mailStatusTime':this[_0x2d73('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x2d73('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x2d73('0x17')],'faxCurrentCapacity':this[_0x2d73('0x18')],'smsStatus':this[_0x2d73('0x19')],'smsStatusTime':this[_0x2d73('0x1a')],'smsCapacity':this[_0x2d73('0x35')],'smsCurrentCapacity':this[_0x2d73('0x36')],'whatsappStatus':this[_0x2d73('0x1b')],'whatsappStatusTime':this[_0x2d73('0x1c')],'whatsappCapacity':this[_0x2d73('0x1d')],'whatsappCurrentCapacity':this[_0x2d73('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x2d73('0x37')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x2d73('0x21')],'busy':this['busy'],'busyQueue':this[_0x2d73('0x23')]};var _0x28bc43=md5(JSON[_0x2d73('0x38')](_0x2cdfd0));if(this[_0x2d73('0x1')]!==_0x28bc43){this[_0x2d73('0x1')]=_0x28bc43;io[_0x2d73('0x39')](_0x2d73('0x3a'),_0x2cdfd0);}};module[_0x2d73('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d27d846..6881943 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 _0x3bdc=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','online','chatPause','available','format','emit','chat_queue:save'];(function(_0x1fc2fe,_0x5d3fc4){var _0x4bbba9=function(_0x52278b){while(--_0x52278b){_0x1fc2fe['push'](_0x1fc2fe['shift']());}};_0x4bbba9(++_0x5d3fc4);}(_0x3bdc,0xfd));var _0xc3bd=function(_0x38b431,_0x26b793){_0x38b431=_0x38b431-0x0;var _0x205832=_0x3bdc[_0x38b431];return _0x205832;};'use strict';var _=require(_0xc3bd('0x0'));var md5=require(_0xc3bd('0x1'));var util=require(_0xc3bd('0x2'));var Redis=require(_0xc3bd('0x3'));var config=require(_0xc3bd('0x4'));config[_0xc3bd('0x5')]=_[_0xc3bd('0x6')](config[_0xc3bd('0x5')],{'host':_0xc3bd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc3bd('0x5')]));function ChatQueue(_0x4f690b){this['id']=_0x4f690b['id']||0x0;this[_0xc3bd('0x8')]=_0x4f690b[_0xc3bd('0x8')]||'';this[_0xc3bd('0x9')]=_0x4f690b[_0xc3bd('0x9')]||0xa;this[_0xc3bd('0xa')]=_0x4f690b[_0xc3bd('0xa')]||_0xc3bd('0xb');this[_0xc3bd('0xc')]=_0x4f690b[_0xc3bd('0xc')];this[_0xc3bd('0xd')]={};this[_0xc3bd('0xe')]=0x0;this[_0xc3bd('0x1')]='';this[_0xc3bd('0xf')]();this['updateRealtime']();}ChatQueue[_0xc3bd('0x10')][_0xc3bd('0xf')]=function(){var _0x19eab4=this['mapAgentsId'][_0xc3bd('0x11')];this['mapAgentsId']=_[_0xc3bd('0x12')](this[_0xc3bd('0xc')],'id');this[_0xc3bd('0xd')]['_rr']=_0x19eab4;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xc3bd('0x13')]=0x0;this[_0xc3bd('0x14')]=0x0;for(var _0x1c9d43=0x0;_0x1c9d43=0x0?this[_0xc3bd('0x17')]:0x0;var _0x14f08b={'id':this['id'],'available':this[_0xc3bd('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xc3bd('0x8')],'paused':this[_0xc3bd('0x14')],'waiting':this['waiting']};var _0x4aac6b=md5(JSON['stringify'](_0x14f08b));if(this[_0xc3bd('0x1')]!==_0x4aac6b){this[_0xc3bd('0x1')]=_0x4aac6b;io['to'](util[_0xc3bd('0x18')]('chat:queue:%s',_0x14f08b['name']))[_0xc3bd('0x19')](_0xc3bd('0x1a'),_0x14f08b);}};module[_0xc3bd('0x1b')]=ChatQueue; \ No newline at end of file +var _0x63a3=['util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','loggedIn','length','online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','exports','md5'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63a3,0x8b));var _0x363a=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x63a3[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require('lodash');var md5=require(_0x363a('0x0'));var util=require(_0x363a('0x1'));var Redis=require(_0x363a('0x2'));var config=require('../../../config/environment');config[_0x363a('0x3')]=_[_0x363a('0x4')](config[_0x363a('0x3')],{'host':_0x363a('0x5'),'port':0x18eb});var io=require(_0x363a('0x6'))(new Redis(config[_0x363a('0x3')]));function ChatQueue(_0x1a2529){this['id']=_0x1a2529['id']||0x0;this[_0x363a('0x7')]=_0x1a2529['name']||'';this['timeout']=_0x1a2529[_0x363a('0x8')]||0xa;this[_0x363a('0x9')]=_0x1a2529['strategy']||_0x363a('0xa');this['Agents']=_0x1a2529[_0x363a('0xb')];this[_0x363a('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x363a('0xd')]();}ChatQueue[_0x363a('0xe')][_0x363a('0xf')]=function(){var _0x225fc7=this['mapAgentsId']['_rr'];this[_0x363a('0xc')]=_['map'](this[_0x363a('0xb')],'id');this[_0x363a('0xc')][_0x363a('0x10')]=_0x225fc7;};ChatQueue[_0x363a('0xe')][_0x363a('0xd')]=function(){this[_0x363a('0x11')]=0x0;this['paused']=0x0;for(var _0x56c1c5=0x0;_0x56c1c5=0x0?this[_0x363a('0x16')]:0x0;var _0x2c2bde={'id':this['id'],'available':this[_0x363a('0x16')],'loggedIn':this[_0x363a('0x11')],'name':this[_0x363a('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x49a06c=md5(JSON[_0x363a('0x17')](_0x2c2bde));if(this['md5']!==_0x49a06c){this['md5']=_0x49a06c;io['to'](util[_0x363a('0x18')](_0x363a('0x19'),_0x2c2bde['name']))[_0x363a('0x1a')]('chat_queue:save',_0x2c2bde);}};module[_0x363a('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5374b6e..6791959 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x5d9e7f,_0x5403c6){var _0x3b3c08=function(_0x3a4ade){while(--_0x3a4ade){_0x5d9e7f['push'](_0x5d9e7f['shift']());}};_0x3b3c08(++_0x5403c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x1de08e,_0x41a385){var _0x47e8b5=function(_0x568648){while(--_0x568648){_0x1de08e['push'](_0x1de08e['shift']());}};_0x47e8b5(++_0x41a385);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index f0a387b..bc9fa87 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 _0x9b6e=['name','Intervals'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9b6e,0x144));var _0xe9b6=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x9b6e[_0xbf8ebe];return _0x1e25e8;};'use strict';function Interval(_0xa61568){this['id']=_0xa61568['id']||0x0;this[_0xe9b6('0x0')]=_0xa61568['name']||'';this[_0xe9b6('0x1')]=_0xa61568['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x3ac4=['name','Intervals'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x3ac4,0x130));var _0x43ac=function(_0x3fc2aa,_0x544448){_0x3fc2aa=_0x3fc2aa-0x0;var _0x25bc78=_0x3ac4[_0x3fc2aa];return _0x25bc78;};'use strict';function Interval(_0x2adbbf){this['id']=_0x2adbbf['id']||0x0;this[_0x43ac('0x0')]=_0x2adbbf[_0x43ac('0x0')]||'';this['Intervals']=_0x2adbbf[_0x43ac('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 18509a5..3f8e0ed 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 _0x2d53=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','loggedIn','paused','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x726aa8,_0x17b83d){var _0x2896a1=function(_0x22952d){while(--_0x22952d){_0x726aa8['push'](_0x726aa8['shift']());}};_0x2896a1(++_0x17b83d);}(_0x2d53,0xae));var _0x32d5=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x2d53[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x32d5('0x0'));var md5=require(_0x32d5('0x1'));var util=require(_0x32d5('0x2'));var Redis=require(_0x32d5('0x3'));var config=require(_0x32d5('0x4'));config[_0x32d5('0x5')]=_[_0x32d5('0x6')](config[_0x32d5('0x5')],{'host':_0x32d5('0x7'),'port':0x18eb});var io=require(_0x32d5('0x8'))(new Redis(config[_0x32d5('0x5')]));function MailQueue(_0x11a5ce){this['id']=_0x11a5ce['id']||0x0;this[_0x32d5('0x9')]=_0x11a5ce[_0x32d5('0x9')]||'';this[_0x32d5('0xa')]=_0x11a5ce[_0x32d5('0xa')]||0xa;this['strategy']=_0x11a5ce[_0x32d5('0xb')]||_0x32d5('0xc');this[_0x32d5('0xd')]=_0x11a5ce[_0x32d5('0xd')];this[_0x32d5('0xe')]={};this['waiting']=0x0;this[_0x32d5('0x1')]='';this['updateRouting']();this[_0x32d5('0xf')]();}MailQueue[_0x32d5('0x10')]['updateRouting']=function(){var _0x59ad7b=this[_0x32d5('0xe')][_0x32d5('0x11')];this[_0x32d5('0xe')]=_['map'](this[_0x32d5('0xd')],'id');this['mapAgentsId']['_rr']=_0x59ad7b;};MailQueue[_0x32d5('0x10')]['updateRealtime']=function(){this[_0x32d5('0x12')]=0x0;this[_0x32d5('0x13')]=0x0;for(var _0x1e151e=0x0;_0x1e151e=0x0?this[_0x32d5('0x16')]:0x0;var _0x4445a7={'id':this['id'],'available':this[_0x32d5('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x32d5('0x9')],'paused':this[_0x32d5('0x13')],'waiting':this[_0x32d5('0x17')]};var _0x17e5dc=md5(JSON[_0x32d5('0x18')](_0x4445a7));if(this[_0x32d5('0x1')]!==_0x17e5dc){this['md5']=_0x17e5dc;io['to'](util[_0x32d5('0x19')](_0x32d5('0x1a'),_0x4445a7[_0x32d5('0x9')]))[_0x32d5('0x1b')](_0x32d5('0x1c'),_0x4445a7);}};module[_0x32d5('0x1d')]=MailQueue; \ No newline at end of file +var _0x5f63=['online','mailPause','available','paused','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f63,0x117));var _0x35f6=function(_0x1c6ca9,_0x5c8bb5){_0x1c6ca9=_0x1c6ca9-0x0;var _0x4b1965=_0x5f63[_0x1c6ca9];return _0x4b1965;};'use strict';var _=require(_0x35f6('0x0'));var md5=require(_0x35f6('0x1'));var util=require(_0x35f6('0x2'));var Redis=require(_0x35f6('0x3'));var config=require(_0x35f6('0x4'));config[_0x35f6('0x5')]=_[_0x35f6('0x6')](config[_0x35f6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x35f6('0x7'))(new Redis(config[_0x35f6('0x5')]));function MailQueue(_0x34f0c2){this['id']=_0x34f0c2['id']||0x0;this[_0x35f6('0x8')]=_0x34f0c2[_0x35f6('0x8')]||'';this[_0x35f6('0x9')]=_0x34f0c2['timeout']||0xa;this[_0x35f6('0xa')]=_0x34f0c2[_0x35f6('0xa')]||_0x35f6('0xb');this[_0x35f6('0xc')]=_0x34f0c2[_0x35f6('0xc')];this[_0x35f6('0xd')]={};this[_0x35f6('0xe')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x35f6('0xf')][_0x35f6('0x10')]=function(){var _0x235b37=this['mapAgentsId'][_0x35f6('0x11')];this[_0x35f6('0xd')]=_[_0x35f6('0x12')](this[_0x35f6('0xc')],'id');this[_0x35f6('0xd')][_0x35f6('0x11')]=_0x235b37;};MailQueue[_0x35f6('0xf')][_0x35f6('0x13')]=function(){this[_0x35f6('0x14')]=0x0;this['paused']=0x0;for(var _0x3d1f23=0x0;_0x3d1f23=0x0?this[_0x35f6('0x17')]:0x0;var _0x2e2673={'id':this['id'],'available':this['available'],'loggedIn':this[_0x35f6('0x14')],'name':this[_0x35f6('0x8')],'paused':this[_0x35f6('0x18')],'waiting':this[_0x35f6('0xe')]};var _0x5281a5=md5(JSON[_0x35f6('0x19')](_0x2e2673));if(this[_0x35f6('0x1')]!==_0x5281a5){this[_0x35f6('0x1')]=_0x5281a5;io['to'](util[_0x35f6('0x1a')](_0x35f6('0x1b'),_0x2e2673['name']))[_0x35f6('0x1c')]('mail_queue:save',_0x2e2673);}};module[_0x35f6('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a3f9a28..35b0871 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 _0x322e=['_rr','loggedIn','paused','online','available','stringify','openchannel:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','Agents'];(function(_0x31bd03,_0x4a270d){var _0x26132c=function(_0x4c0296){while(--_0x4c0296){_0x31bd03['push'](_0x31bd03['shift']());}};_0x26132c(++_0x4a270d);}(_0x322e,0xcd));var _0xe322=function(_0x198da9,_0x270aa2){_0x198da9=_0x198da9-0x0;var _0x2cae60=_0x322e[_0x198da9];return _0x2cae60;};'use strict';var _=require(_0xe322('0x0'));var md5=require(_0xe322('0x1'));var util=require(_0xe322('0x2'));var Redis=require(_0xe322('0x3'));var config=require(_0xe322('0x4'));config[_0xe322('0x5')]=_[_0xe322('0x6')](config[_0xe322('0x5')],{'host':_0xe322('0x7'),'port':0x18eb});var io=require(_0xe322('0x8'))(new Redis(config[_0xe322('0x5')]));function OpenchannelQueue(_0x203273){this['id']=_0x203273['id']||0x0;this[_0xe322('0x9')]=_0x203273[_0xe322('0x9')]||'';this['timeout']=_0x203273[_0xe322('0xa')]||0xa;this[_0xe322('0xb')]=_0x203273[_0xe322('0xb')]||_0xe322('0xc');this['Agents']=_0x203273['Agents'];this['mapAgentsId']={};this[_0xe322('0xd')]=0x0;this[_0xe322('0x1')]='';this[_0xe322('0xe')]();this[_0xe322('0xf')]();}OpenchannelQueue[_0xe322('0x10')]['updateRouting']=function(){var _0x2a0e96=this[_0xe322('0x11')]['_rr'];this[_0xe322('0x11')]=_['map'](this[_0xe322('0x12')],'id');this[_0xe322('0x11')][_0xe322('0x13')]=_0x2a0e96;};OpenchannelQueue[_0xe322('0x10')][_0xe322('0xf')]=function(){this[_0xe322('0x14')]=0x0;this[_0xe322('0x15')]=0x0;for(var _0x5352fa=0x0;_0x5352fa=0x0?this[_0xe322('0x17')]:0x0;var _0x5e85fa={'id':this['id'],'available':this[_0xe322('0x17')],'loggedIn':this[_0xe322('0x14')],'name':this[_0xe322('0x9')],'paused':this[_0xe322('0x15')],'waiting':this['waiting']};var _0x2dbe6c=md5(JSON[_0xe322('0x18')](_0x5e85fa));if(this[_0xe322('0x1')]!==_0x2dbe6c){this[_0xe322('0x1')]=_0x2dbe6c;io['to'](util['format'](_0xe322('0x19'),_0x5e85fa[_0xe322('0x9')]))[_0xe322('0x1a')]('openchannel_queue:save',_0x5e85fa);}};module[_0xe322('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0xdb47=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','waiting','stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','name','timeout'];(function(_0x28fb63,_0x1a6af2){var _0x780678=function(_0x435e1a){while(--_0x435e1a){_0x28fb63['push'](_0x28fb63['shift']());}};_0x780678(++_0x1a6af2);}(_0xdb47,0x19c));var _0x7db4=function(_0x3540f7,_0x18e5f1){_0x3540f7=_0x3540f7-0x0;var _0x4f6425=_0xdb47[_0x3540f7];return _0x4f6425;};'use strict';var _=require(_0x7db4('0x0'));var md5=require(_0x7db4('0x1'));var util=require(_0x7db4('0x2'));var Redis=require(_0x7db4('0x3'));var config=require('../../../config/environment');config[_0x7db4('0x4')]=_[_0x7db4('0x5')](config[_0x7db4('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7db4('0x4')]));function OpenchannelQueue(_0x17cc7e){this['id']=_0x17cc7e['id']||0x0;this['name']=_0x17cc7e[_0x7db4('0x6')]||'';this[_0x7db4('0x7')]=_0x17cc7e[_0x7db4('0x7')]||0xa;this[_0x7db4('0x8')]=_0x17cc7e[_0x7db4('0x8')]||_0x7db4('0x9');this[_0x7db4('0xa')]=_0x17cc7e['Agents'];this[_0x7db4('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x7db4('0xc')]();this[_0x7db4('0xd')]();}OpenchannelQueue[_0x7db4('0xe')][_0x7db4('0xc')]=function(){var _0x31fe2c=this['mapAgentsId'][_0x7db4('0xf')];this[_0x7db4('0xb')]=_[_0x7db4('0x10')](this[_0x7db4('0xa')],'id');this[_0x7db4('0xb')][_0x7db4('0xf')]=_0x31fe2c;};OpenchannelQueue[_0x7db4('0xe')][_0x7db4('0xd')]=function(){this[_0x7db4('0x11')]=0x0;this[_0x7db4('0x12')]=0x0;for(var _0x5cfdfe=0x0;_0x5cfdfe=0x0?this[_0x7db4('0x16')]:0x0;var _0x152e04={'id':this['id'],'available':this[_0x7db4('0x16')],'loggedIn':this[_0x7db4('0x11')],'name':this['name'],'paused':this[_0x7db4('0x12')],'waiting':this[_0x7db4('0x17')]};var _0x531612=md5(JSON[_0x7db4('0x18')](_0x152e04));if(this[_0x7db4('0x1')]!==_0x531612){this[_0x7db4('0x1')]=_0x531612;io['to'](util[_0x7db4('0x19')]('openchannel:queue:%s',_0x152e04[_0x7db4('0x6')]))['emit'](_0x7db4('0x1a'),_0x152e04);}};module[_0x7db4('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6eb902d..56888c5 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x39405d,_0x3aba83){var _0x104590=function(_0x2b9166){while(--_0x2b9166){_0x39405d['push'](_0x39405d['shift']());}};_0x104590(++_0x3aba83);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 721fd82..93fb3ba 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 _0x6d70=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','available','format','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0x6d70,0x13e));var _0x06d7=function(_0x488f7f,_0x282ca3){_0x488f7f=_0x488f7f-0x0;var _0xe33283=_0x6d70[_0x488f7f];return _0xe33283;};'use strict';var _=require(_0x06d7('0x0'));var md5=require(_0x06d7('0x1'));var util=require('util');var Redis=require(_0x06d7('0x2'));var config=require(_0x06d7('0x3'));config[_0x06d7('0x4')]=_[_0x06d7('0x5')](config[_0x06d7('0x4')],{'host':_0x06d7('0x6'),'port':0x18eb});var io=require(_0x06d7('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x404592){this['id']=_0x404592['id']||0x0;this[_0x06d7('0x8')]=_0x404592['name']||'';this[_0x06d7('0x9')]=_0x404592['timeout']||0xa;this[_0x06d7('0xa')]=_0x404592['strategy']||_0x06d7('0xb');this[_0x06d7('0xc')]=_0x404592[_0x06d7('0xc')];this[_0x06d7('0xd')]={};this[_0x06d7('0xe')]=0x0;this[_0x06d7('0x1')]='';this['updateRouting']();this[_0x06d7('0xf')]();}WhatsappQueue[_0x06d7('0x10')][_0x06d7('0x11')]=function(){var _0x6a8f27=this[_0x06d7('0xd')][_0x06d7('0x12')];this[_0x06d7('0xd')]=_[_0x06d7('0x13')](this[_0x06d7('0xc')],'id');this[_0x06d7('0xd')][_0x06d7('0x12')]=_0x6a8f27;};WhatsappQueue[_0x06d7('0x10')][_0x06d7('0xf')]=function(){this[_0x06d7('0x14')]=0x0;this[_0x06d7('0x15')]=0x0;for(var _0x413643=0x0;_0x413643=0x0?this[_0x06d7('0x16')]:0x0;var _0x3f6625={'id':this['id'],'available':this[_0x06d7('0x16')],'loggedIn':this[_0x06d7('0x14')],'name':this[_0x06d7('0x8')],'paused':this[_0x06d7('0x15')],'waiting':this[_0x06d7('0xe')]};var _0x101efb=md5(JSON['stringify'](_0x3f6625));if(this[_0x06d7('0x1')]!==_0x101efb){this['md5']=_0x101efb;io['to'](util[_0x06d7('0x17')]('whatsapp:queue:%s',_0x3f6625[_0x06d7('0x8')]))[_0x06d7('0x18')](_0x06d7('0x19'),_0x3f6625);}};module[_0x06d7('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xead5=['updateRouting','updateRealtime','map','loggedIn','paused','length','online','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x4aeabc,_0x5326fd){var _0x4f4ed7=function(_0x18169f){while(--_0x18169f){_0x4aeabc['push'](_0x4aeabc['shift']());}};_0x4f4ed7(++_0x5326fd);}(_0xead5,0xaf));var _0x5ead=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xead5[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x5ead('0x0'));var md5=require(_0x5ead('0x1'));var util=require('util');var Redis=require(_0x5ead('0x2'));var config=require(_0x5ead('0x3'));config[_0x5ead('0x4')]=_['defaults'](config['redis'],{'host':_0x5ead('0x5'),'port':0x18eb});var io=require(_0x5ead('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x461992){this['id']=_0x461992['id']||0x0;this[_0x5ead('0x7')]=_0x461992['name']||'';this[_0x5ead('0x8')]=_0x461992[_0x5ead('0x8')]||0xa;this[_0x5ead('0x9')]=_0x461992['strategy']||_0x5ead('0xa');this[_0x5ead('0xb')]=_0x461992[_0x5ead('0xb')];this[_0x5ead('0xc')]={};this[_0x5ead('0xd')]=0x0;this[_0x5ead('0x1')]='';this[_0x5ead('0xe')]();this[_0x5ead('0xf')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x353c7e=this[_0x5ead('0xc')]['_rr'];this[_0x5ead('0xc')]=_[_0x5ead('0x10')](this[_0x5ead('0xb')],'id');this[_0x5ead('0xc')]['_rr']=_0x353c7e;};WhatsappQueue['prototype'][_0x5ead('0xf')]=function(){this[_0x5ead('0x11')]=0x0;this[_0x5ead('0x12')]=0x0;for(var _0x3d57bb=0x0;_0x3d57bb=0x0?this['available']:0x0;var _0x2339bc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5ead('0x11')],'name':this[_0x5ead('0x7')],'paused':this[_0x5ead('0x12')],'waiting':this[_0x5ead('0xd')]};var _0x12b2a0=md5(JSON[_0x5ead('0x16')](_0x2339bc));if(this[_0x5ead('0x1')]!==_0x12b2a0){this['md5']=_0x12b2a0;io['to'](util['format'](_0x5ead('0x17'),_0x2339bc['name']))[_0x5ead('0x18')](_0x5ead('0x19'),_0x2339bc);}};module[_0x5ead('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3d78e13..b731745 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 _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x41fbf0,_0x4ed92b){var _0x3f46e7=function(_0x5a5f1a){while(--_0x5a5f1a){_0x41fbf0['push'](_0x41fbf0['shift']());}};_0x3f46e7(++_0x4ed92b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2f430a,_0x46d370){_0x2f430a=_0x2f430a-0x0;var _0x10def3=_0x7fbe[_0x2f430a];return _0x10def3;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file +var _0x55ca=['initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initFaxQueues','faxQueues','exports','bluebird','util','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x33a0bb,_0x5c268b){_0x33a0bb=_0x33a0bb-0x0;var _0x229f56=_0x55ca[_0x33a0bb];return _0x229f56;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0xa55c('0x2'));var OpenchannelQueue=require(_0xa55c('0x3'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xa55c('0x4'));var MailQueue=require(_0xa55c('0x5'));var FaxQueue=require(_0xa55c('0x6'));var WhatsappQueue=require(_0xa55c('0x7'));var Realtime=function(){this[_0xa55c('0x8')]={};this[_0xa55c('0x9')]={};this[_0xa55c('0xa')]={};this['chatQueues']={};this[_0xa55c('0xb')]={};this[_0xa55c('0xc')]={};this['faxQueues']={};this[_0xa55c('0xd')]={};this[_0xa55c('0xe')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};};function freeIsNotKey(_0x5d8e5a,_0x31646d,_0xe6d826){var _0x508342=_[_0xa55c('0x12')](_0x5d8e5a,function(_0x3998f7,_0x15eec8){return _0x3998f7[_0xe6d826];});for(var _0x5d47ff in _0x31646d){if(_0x31646d['hasOwnProperty'](_0x5d47ff)){if(!_0x508342[_0x5d47ff]){delete _0x31646d[_0x5d47ff];}}}}Realtime[_0xa55c('0x13')]['mergeFromDatabase']=function(_0x5a3672,_0x59ea8d){for(var _0x18ee85 in _0x59ea8d){if(_0x5a3672[_0xa55c('0x14')](_0x18ee85)){_0x5a3672[_0x18ee85]=_0x59ea8d[_0x18ee85];}}};Realtime[_0xa55c('0x13')][_0xa55c('0x15')]=function(){var _0x458480=this;return function(_0x247e77){if(_0x247e77){freeIsNotKey(_0x247e77,_0x458480['agents'],'id');for(var _0x3ccf65=0x0,_0x3dcf4f={},_0x25934f={};_0x3ccf65<_0x247e77[_0xa55c('0x16')];_0x3ccf65+=0x1){_0x3dcf4f=_0x247e77[_0x3ccf65];if(_[_0xa55c('0x17')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']])){_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']]=new Agent(_0x3dcf4f);}else{_0x458480[_0xa55c('0x18')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']],_0x3dcf4f);}}}return _0x458480['agents'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x19')]=function(){var _0x461284=this;return function(_0x358b61){if(_0x358b61){freeIsNotKey(_0x358b61,_0x461284[_0xa55c('0x9')],'id');for(var _0x5426e5=0x0,_0x4c0daf={},_0x5f5158={};_0x5426e5<_0x358b61[_0xa55c('0x16')];_0x5426e5+=0x1){_0x4c0daf=_0x358b61[_0x5426e5];if(_[_0xa55c('0x17')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']])){_0x461284['intervals'][_0x4c0daf['id']]=new Interval(_0x4c0daf);}else{_0x461284[_0xa55c('0x18')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']],_0x4c0daf);}}}return _0x461284['intervals'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1a')]=function(){var _0x940f28=this;return function(_0x1965f1){if(_0x1965f1){freeIsNotKey(_0x1965f1,_0x940f28[_0xa55c('0xa')],'id');for(var _0x49ed04=0x0,_0x1fc828={},_0x504c24={};_0x49ed04<_0x1965f1['length'];_0x49ed04+=0x1){_0x1fc828=_0x1965f1[_0x49ed04];if(_['isUndefined'](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']])){_0x940f28['openchannelQueues'][_0x1fc828['id']]=new OpenchannelQueue(_0x1fc828);}else{_0x940f28[_0xa55c('0x18')](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']],_0x1fc828);}_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1b')]();_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1c')]();}}return _0x940f28[_0xa55c('0xa')];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1d')]=function(){var _0x3cd152=this;return function(_0x1273d7){if(_0x1273d7){freeIsNotKey(_0x1273d7,_0x3cd152['chatQueues'],'id');for(var _0x430d55=0x0,_0x28814f={},_0x1c9f6b={};_0x430d55<_0x1273d7[_0xa55c('0x16')];_0x430d55+=0x1){_0x28814f=_0x1273d7[_0x430d55];if(_['isUndefined'](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']])){_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']]=new ChatQueue(_0x28814f);}else{_0x3cd152[_0xa55c('0x18')](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']],_0x28814f);}_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']][_0xa55c('0x1b')]();_0x3cd152['chatQueues'][_0x28814f['id']][_0xa55c('0x1c')]();}}return _0x3cd152['chatQueues'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1f')]=function(){var _0x1cc53e=this;return function(_0x223813){if(_0x223813){freeIsNotKey(_0x223813,_0x1cc53e['smsQueues'],'id');for(var _0x3d28fb=0x0,_0x2096ae={},_0x331e58={};_0x3d28fb<_0x223813[_0xa55c('0x16')];_0x3d28fb+=0x1){_0x2096ae=_0x223813[_0x3d28fb];if(_[_0xa55c('0x17')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']])){_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']]=new SmsQueue(_0x2096ae);}else{_0x1cc53e[_0xa55c('0x18')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']],_0x2096ae);}_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']][_0xa55c('0x1b')]();_0x1cc53e['smsQueues'][_0x2096ae['id']]['updateRealtime']();}}return _0x1cc53e[_0xa55c('0xb')];};};Realtime[_0xa55c('0x13')]['initMailQueues']=function(){var _0x30fadd=this;return function(_0x2f0110){if(_0x2f0110){freeIsNotKey(_0x2f0110,_0x30fadd[_0xa55c('0xc')],'id');for(var _0x1839ac=0x0,_0x30d4f8={},_0x38ff96={};_0x1839ac<_0x2f0110[_0xa55c('0x16')];_0x1839ac+=0x1){_0x30d4f8=_0x2f0110[_0x1839ac];if(_[_0xa55c('0x17')](_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']])){_0x30fadd['mailQueues'][_0x30d4f8['id']]=new MailQueue(_0x30d4f8);}else{_0x30fadd['mergeFromDatabase'](_0x30fadd['mailQueues'][_0x30d4f8['id']],_0x30d4f8);}_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']][_0xa55c('0x1b')]();_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']]['updateRealtime']();}}return _0x30fadd[_0xa55c('0xc')];};};Realtime['prototype'][_0xa55c('0x20')]=function(){var _0x4ad813=this;return function(_0x18c6f1){if(_0x18c6f1){freeIsNotKey(_0x18c6f1,_0x4ad813[_0xa55c('0x21')],'id');for(var _0x3c0ec1=0x0,_0x4d3eb5={},_0x7c4a47={};_0x3c0ec1<_0x18c6f1[_0xa55c('0x16')];_0x3c0ec1+=0x1){_0x4d3eb5=_0x18c6f1[_0x3c0ec1];if(_['isUndefined'](_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']])){_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]=new FaxQueue(_0x4d3eb5);}else{_0x4ad813['mergeFromDatabase'](_0x4ad813['faxQueues'][_0x4d3eb5['id']],_0x4d3eb5);}_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]['updateRouting']();_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']][_0xa55c('0x1c')]();}}return _0x4ad813['faxQueues'];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x4de781=this;return function(_0x3b3308){if(_0x3b3308){freeIsNotKey(_0x3b3308,_0x4de781[_0xa55c('0xd')],'id');for(var _0x429336=0x0,_0x99c4f8={},_0x2d8cbf={};_0x429336<_0x3b3308['length'];_0x429336+=0x1){_0x99c4f8=_0x3b3308[_0x429336];if(_[_0xa55c('0x17')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']])){_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]=new WhatsappQueue(_0x99c4f8);}else{_0x4de781[_0xa55c('0x18')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']],_0x99c4f8);}_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRouting']();_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRealtime']();}}return _0x4de781['whatsappQueues'];};};module[_0xa55c('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 979a384..abac698 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 _0x27b6=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','addTags'];(function(_0x47ac57,_0x28e4ae){var _0x5e1613=function(_0x1a78c4){while(--_0x1a78c4){_0x47ac57['push'](_0x47ac57['shift']());}};_0x5e1613(++_0x28e4ae);}(_0x27b6,0x1a7));var _0x627b=function(_0x28bff9,_0x10c70c){_0x28bff9=_0x28bff9-0x0;var _0x4d8eae=_0x27b6[_0x28bff9];return _0x4d8eae;};'use strict';var client=require(_0x627b('0x0'));exports[_0x627b('0x1')]=function(_0x1a52f4,_0x280f4e){return client['Request'](_0x627b('0x2'),{'body':_0x280f4e,'options':{'where':{'id':_0x1a52f4}},'log':'updateChatInteraction'});};exports[_0x627b('0x3')]=function(_0x26a5e2,_0x2bc530){return client[_0x627b('0x4')](_0x627b('0x5'),{'body':_0x2bc530,'options':{'where':{'id':_0x26a5e2}},'log':_0x627b('0x6')});}; \ No newline at end of file +var _0x41b7=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x586184,_0x57c05e){var _0xaafcdb=function(_0x48904d){while(--_0x48904d){_0x586184['push'](_0x586184['shift']());}};_0xaafcdb(++_0x57c05e);}(_0x41b7,0x9b));var _0x741b=function(_0x1ef0d7,_0x2c62b1){_0x1ef0d7=_0x1ef0d7-0x0;var _0x103c77=_0x41b7[_0x1ef0d7];return _0x103c77;};'use strict';var client=require(_0x741b('0x0'));exports[_0x741b('0x1')]=function(_0x5464f5,_0xdba1b9){return client[_0x741b('0x2')](_0x741b('0x3'),{'body':_0xdba1b9,'options':{'where':{'id':_0x5464f5}},'log':_0x741b('0x4')});};exports[_0x741b('0x5')]=function(_0x127dac,_0x1bdc4e){return client[_0x741b('0x2')](_0x741b('0x6'),{'body':_0x1bdc4e,'options':{'where':{'id':_0x127dac}},'log':_0x741b('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1d0cd0e..ebc00b0 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 _0x32ea=['CreateChatMessage','../client','create','Request'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x32ea,0x13d));var _0xa32e=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x32ea[_0x49ad79];return _0xa4e38a;};'use strict';var client=require(_0xa32e('0x0'));exports[_0xa32e('0x1')]=function(_0x2ceb58){return client[_0xa32e('0x2')](_0xa32e('0x3'),{'body':_0x2ceb58,'log':'createChatMessage'});}; \ No newline at end of file +var _0x62a1=['create','Request','CreateChatMessage','../client'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x62a1,0x12f));var _0x162a=function(_0x30fecd,_0x37f63c){_0x30fecd=_0x30fecd-0x0;var _0x15ce83=_0x62a1[_0x30fecd];return _0x15ce83;};'use strict';var client=require(_0x162a('0x0'));exports[_0x162a('0x1')]=function(_0x272e0e){return client[_0x162a('0x2')](_0x162a('0x3'),{'body':_0x272e0e,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2258468..ee69739 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 _0x28a0=['GetChatQueue','timeout','Agents','online','getChatQueues','Request'];(function(_0x183b25,_0x467ad5){var _0x368aa4=function(_0x4dc59f){while(--_0x4dc59f){_0x183b25['push'](_0x183b25['shift']());}};_0x368aa4(++_0x467ad5);}(_0x28a0,0x64));var _0x028a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x28a0[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require('../client');exports[_0x028a('0x0')]=function(){return function(){return client[_0x028a('0x1')](_0x028a('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x028a('0x3'),'strategy'],'include':[{'model':'User','as':_0x028a('0x4'),'attributes':['id','name',_0x028a('0x5'),'chatPause']}]},'log':_0x028a('0x0')});};}; \ No newline at end of file +var _0xf626=['../client','getChatQueues','Request','name','timeout','User','Agents','chatPause'];(function(_0x34ed44,_0x908217){var _0x474bdc=function(_0x5b1f62){while(--_0x5b1f62){_0x34ed44['push'](_0x34ed44['shift']());}};_0x474bdc(++_0x908217);}(_0xf626,0x68));var _0x6f62=function(_0x543728,_0x564488){_0x543728=_0x543728-0x0;var _0x2a3ece=_0xf626[_0x543728];return _0x2a3ece;};'use strict';var client=require(_0x6f62('0x0'));exports[_0x6f62('0x1')]=function(){return function(){return client[_0x6f62('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x6f62('0x3'),_0x6f62('0x4'),'strategy'],'include':[{'model':_0x6f62('0x5'),'as':_0x6f62('0x6'),'attributes':['id',_0x6f62('0x3'),'online',_0x6f62('0x7')]}]},'log':_0x6f62('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f1e20cf..3023eee 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 _0x8f37=['CreateChatQueueReport','update','Request','DESC','../client','create'];(function(_0x42b453,_0x5d1ac8){var _0x4a8e88=function(_0xead1c5){while(--_0xead1c5){_0x42b453['push'](_0x42b453['shift']());}};_0x4a8e88(++_0x5d1ac8);}(_0x8f37,0x190));var _0x78f3=function(_0x22e93a,_0x17d803){_0x22e93a=_0x22e93a-0x0;var _0x538ad5=_0x8f37[_0x22e93a];return _0x538ad5;};'use strict';var client=require(_0x78f3('0x0'));exports[_0x78f3('0x1')]=function(_0x351c4f){return client['Request']('CreateChatQueueReport',{'body':_0x351c4f,'log':_0x78f3('0x2')});};exports[_0x78f3('0x3')]=function(_0x3b0667,_0x539794){return client[_0x78f3('0x4')]('UpdateChatQueueReport',{'body':_0x539794,'options':{'where':{'uniqueid':_0x3b0667},'order':[['id',_0x78f3('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xac72=['DESC','../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0xac72,0x1eb));var _0x2ac7=function(_0x3c0a0a,_0x5d5883){_0x3c0a0a=_0x3c0a0a-0x0;var _0x28bdc2=_0xac72[_0x3c0a0a];return _0x28bdc2;};'use strict';var client=require(_0x2ac7('0x0'));exports[_0x2ac7('0x1')]=function(_0x3e3f7d){return client['Request'](_0x2ac7('0x2'),{'body':_0x3e3f7d,'log':_0x2ac7('0x2')});};exports[_0x2ac7('0x3')]=function(_0x260649,_0x238ae5){return client[_0x2ac7('0x4')](_0x2ac7('0x5'),{'body':_0x238ae5,'options':{'where':{'uniqueid':_0x260649},'order':[['id',_0x2ac7('0x6')]],'limit':0x1},'log':_0x2ac7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8538955..3835396 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 _0xf901=['UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0xf901,0x170));var _0x1f90=function(_0xe37de3,_0x5d2969){_0xe37de3=_0xe37de3-0x0;var _0x268c01=_0xf901[_0xe37de3];return _0x268c01;};'use strict';var client=require(_0x1f90('0x0'));exports[_0x1f90('0x1')]=function(_0x1c201c,_0x38e14c){return client['Request'](_0x1f90('0x2'),{'body':_0x38e14c,'options':{'where':{'id':_0x1c201c}},'log':'updateFaxInteraction'});};exports[_0x1f90('0x3')]=function(_0x17c694,_0x4e0bb8){return client['Request'](_0x1f90('0x4'),{'body':_0x4e0bb8,'options':{'where':{'id':_0x17c694}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xbe5c=['addTags','addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0x488163,_0x51204f){var _0x1ba13b=function(_0x269a5d){while(--_0x269a5d){_0x488163['push'](_0x488163['shift']());}};_0x1ba13b(++_0x51204f);}(_0xbe5c,0x146));var _0xcbe5=function(_0x1edec2,_0x167ac0){_0x1edec2=_0x1edec2-0x0;var _0x1d392a=_0xbe5c[_0x1edec2];return _0x1d392a;};'use strict';var client=require(_0xcbe5('0x0'));exports['update']=function(_0x11da3f,_0x1e477f){return client[_0xcbe5('0x1')](_0xcbe5('0x2'),{'body':_0x1e477f,'options':{'where':{'id':_0x11da3f}},'log':_0xcbe5('0x3')});};exports[_0xcbe5('0x4')]=function(_0x55a19f,_0x555ddd){return client[_0xcbe5('0x1')]('AddTagsToFaxInteraction',{'body':_0x555ddd,'options':{'where':{'id':_0x55a19f}},'log':_0xcbe5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a7e396e..13cf015 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 _0xcbf4=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcbf4,0x1d7));var _0x4cbf=function(_0x3c5fb3,_0x12c077){_0x3c5fb3=_0x3c5fb3-0x0;var _0x1119b1=_0xcbf4[_0x3c5fb3];return _0x1119b1;};'use strict';var client=require('../client');exports['create']=function(_0x39b947){return client[_0x4cbf('0x0')](_0x4cbf('0x1'),{'body':_0x39b947,'log':_0x4cbf('0x2')});}; \ No newline at end of file +var _0x475b=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x475b,0x8a));var _0xb475=function(_0x412ca4,_0x110b15){_0x412ca4=_0x412ca4-0x0;var _0x192e25=_0x475b[_0x412ca4];return _0x192e25;};'use strict';var client=require(_0xb475('0x0'));exports[_0xb475('0x1')]=function(_0x32953e){return client[_0xb475('0x2')](_0xb475('0x3'),{'body':_0x32953e,'log':_0xb475('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 821586c..7ad55c4 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 _0xc5e3=['getFaxQueues','Request','GetFaxQueue','name','strategy','Agents','../client'];(function(_0x75267d,_0x5d286c){var _0x21ccec=function(_0x1a3c1f){while(--_0x1a3c1f){_0x75267d['push'](_0x75267d['shift']());}};_0x21ccec(++_0x5d286c);}(_0xc5e3,0x16b));var _0x3c5e=function(_0x5aaa20,_0x80fdef){_0x5aaa20=_0x5aaa20-0x0;var _0x1a4b0c=_0xc5e3[_0x5aaa20];return _0x1a4b0c;};'use strict';var client=require(_0x3c5e('0x0'));exports[_0x3c5e('0x1')]=function(){return function(){return client[_0x3c5e('0x2')](_0x3c5e('0x3'),{'options':{'raw':![],'attributes':['id',_0x3c5e('0x4'),'timeout',_0x3c5e('0x5')],'include':[{'model':'User','as':_0x3c5e('0x6'),'attributes':['id',_0x3c5e('0x4'),'online','faxPause']}]},'log':_0x3c5e('0x1')});};}; \ No newline at end of file +var _0xb91a=['User','Agents','online','faxPause','getFaxQueues','GetFaxQueue','name','timeout','strategy'];(function(_0x4582e8,_0x45f260){var _0x41d8df=function(_0x3f154){while(--_0x3f154){_0x4582e8['push'](_0x4582e8['shift']());}};_0x41d8df(++_0x45f260);}(_0xb91a,0x13f));var _0xab91=function(_0x37f414,_0x174577){_0x37f414=_0x37f414-0x0;var _0x173278=_0xb91a[_0x37f414];return _0x173278;};'use strict';var client=require('../client');exports[_0xab91('0x0')]=function(){return function(){return client['Request'](_0xab91('0x1'),{'options':{'raw':![],'attributes':['id',_0xab91('0x2'),_0xab91('0x3'),_0xab91('0x4')],'include':[{'model':_0xab91('0x5'),'as':_0xab91('0x6'),'attributes':['id',_0xab91('0x2'),_0xab91('0x7'),_0xab91('0x8')]}]},'log':_0xab91('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 11671a6..fdf626b 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 _0xece0=['CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client','create','Request'];(function(_0x6c5894,_0x470257){var _0x15fa10=function(_0x9c3b63){while(--_0x9c3b63){_0x6c5894['push'](_0x6c5894['shift']());}};_0x15fa10(++_0x470257);}(_0xece0,0xa5));var _0x0ece=function(_0x1e486a,_0x10047e){_0x1e486a=_0x1e486a-0x0;var _0x22d8ca=_0xece0[_0x1e486a];return _0x22d8ca;};'use strict';var client=require(_0x0ece('0x0'));exports[_0x0ece('0x1')]=function(_0x50b067){return client[_0x0ece('0x2')](_0x0ece('0x3'),{'body':_0x50b067,'log':'CreateFaxQueueReport'});};exports[_0x0ece('0x4')]=function(_0x186cfb,_0xc9c26b){return client['Request']('UpdateFaxQueueReport',{'body':_0xc9c26b,'options':{'where':{'uniqueid':_0x186cfb},'order':[['id',_0x0ece('0x5')]],'limit':0x1},'log':_0x0ece('0x6')});}; \ No newline at end of file +var _0xfb33=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client'];(function(_0x40f3da,_0x43db41){var _0x363e0f=function(_0x567101){while(--_0x567101){_0x40f3da['push'](_0x40f3da['shift']());}};_0x363e0f(++_0x43db41);}(_0xfb33,0x19d));var _0x3fb3=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0xfb33[_0x5de214];return _0x4df627;};'use strict';var client=require(_0x3fb3('0x0'));exports[_0x3fb3('0x1')]=function(_0x12c66d){return client[_0x3fb3('0x2')](_0x3fb3('0x3'),{'body':_0x12c66d,'log':'CreateFaxQueueReport'});};exports[_0x3fb3('0x4')]=function(_0x2c0daa,_0x31d2bc){return client[_0x3fb3('0x2')](_0x3fb3('0x5'),{'body':_0x31d2bc,'options':{'where':{'uniqueid':_0x2c0daa},'order':[['id','DESC']],'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 9a5833f..4b3d22f 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 _0x1399=['../client','getIntervals','GetInterval','Interval','Intervals','name','interval'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x1399,0x16c));var _0x9139=function(_0xb4f240,_0x15f734){_0xb4f240=_0xb4f240-0x0;var _0x30682a=_0x1399[_0xb4f240];return _0x30682a;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(){return function(){return client['Request'](_0x9139('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9139('0x3'),'as':_0x9139('0x4'),'attributes':['id',_0x9139('0x5'),_0x9139('0x6')]}]},'log':_0x9139('0x1')});};}; \ No newline at end of file +var _0xd547=['GetInterval','name','Interval','interval','Request'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0xd547,0x1c1));var _0x7d54=function(_0x3a5248,_0x34e201){_0x3a5248=_0x3a5248-0x0;var _0x4175a1=_0xd547[_0x3a5248];return _0x4175a1;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x7d54('0x0')](_0x7d54('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7d54('0x2')],'include':[{'model':_0x7d54('0x3'),'as':'Intervals','attributes':['id','name',_0x7d54('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 53b76ed..f7b3c28 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 _0xd694=['AddTagsToMailInteraction','../client','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x504802,_0x92fa52){var _0x3b0b5b=function(_0x477099){while(--_0x477099){_0x504802['push'](_0x504802['shift']());}};_0x3b0b5b(++_0x92fa52);}(_0xd694,0xec));var _0x4d69=function(_0x2dc5b5,_0x10d82c){_0x2dc5b5=_0x2dc5b5-0x0;var _0x2a8ccc=_0xd694[_0x2dc5b5];return _0x2a8ccc;};'use strict';var client=require(_0x4d69('0x0'));exports[_0x4d69('0x1')]=function(_0xd0f1ad,_0x3a14e2){return client['Request'](_0x4d69('0x2'),{'body':_0x3a14e2,'options':{'where':{'id':_0xd0f1ad}},'log':_0x4d69('0x3')});};exports['addTags']=function(_0x55c792,_0x4fe206){return client['Request'](_0x4d69('0x4'),{'body':_0x4fe206,'options':{'where':{'id':_0x55c792}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x953c=['update','UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x221416,_0x1b7dfc){var _0x189366=function(_0x21220b){while(--_0x21220b){_0x221416['push'](_0x221416['shift']());}};_0x189366(++_0x1b7dfc);}(_0x953c,0x148));var _0xc953=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x953c[_0x1b8e60];return _0x363363;};'use strict';var client=require(_0xc953('0x0'));exports[_0xc953('0x1')]=function(_0x1d1d90,_0x5cc663){return client['Request'](_0xc953('0x2'),{'body':_0x5cc663,'options':{'where':{'id':_0x1d1d90}},'log':_0xc953('0x3')});};exports[_0xc953('0x4')]=function(_0x2f05fe,_0xb1df6c){return client[_0xc953('0x5')]('AddTagsToMailInteraction',{'body':_0xb1df6c,'options':{'where':{'id':_0x2f05fe}},'log':_0xc953('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5b7e217..6181604 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 _0x66fc=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x470b24,_0x58a01e){var _0xde9b3d=function(_0x445f8c){while(--_0x445f8c){_0x470b24['push'](_0x470b24['shift']());}};_0xde9b3d(++_0x58a01e);}(_0x66fc,0x9e));var _0xc66f=function(_0x6661c8,_0x18a63c){_0x6661c8=_0x6661c8-0x0;var _0xc2a189=_0x66fc[_0x6661c8];return _0xc2a189;};'use strict';var client=require(_0xc66f('0x0'));exports['create']=function(_0x1a7de5){return client[_0xc66f('0x1')](_0xc66f('0x2'),{'body':_0x1a7de5,'log':_0xc66f('0x3')});}; \ No newline at end of file +var _0xb55e=['../client','create','Request','CreateMailMessage'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xb55e,0xa4));var _0xeb55=function(_0x18c86c,_0x3035a0){_0x18c86c=_0x18c86c-0x0;var _0x2fbe57=_0xb55e[_0x18c86c];return _0x2fbe57;};'use strict';var client=require(_0xeb55('0x0'));exports[_0xeb55('0x1')]=function(_0x37d280){return client[_0xeb55('0x2')](_0xeb55('0x3'),{'body':_0x37d280,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0a7045d..7936bd5 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 _0x80fd=['GetMailQueue','strategy','User','online','mailPause','../client','getMailQueues','Request'];(function(_0x41ee60,_0x1d8c3c){var _0x34e5ce=function(_0x6521d2){while(--_0x6521d2){_0x41ee60['push'](_0x41ee60['shift']());}};_0x34e5ce(++_0x1d8c3c);}(_0x80fd,0x12d));var _0xd80f=function(_0x5dfd7a,_0x4e3742){_0x5dfd7a=_0x5dfd7a-0x0;var _0x4a7114=_0x80fd[_0x5dfd7a];return _0x4a7114;};'use strict';var client=require(_0xd80f('0x0'));exports[_0xd80f('0x1')]=function(){return function(){return client[_0xd80f('0x2')](_0xd80f('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xd80f('0x4')],'include':[{'model':_0xd80f('0x5'),'as':'Agents','attributes':['id','name',_0xd80f('0x6'),_0xd80f('0x7')]}]},'log':_0xd80f('0x1')});};}; \ No newline at end of file +var _0xabe9=['getMailQueues','GetMailQueue','name','timeout','strategy','Agents','online','mailPause'];(function(_0x4b1760,_0x26c4e2){var _0x4f082d=function(_0xedb210){while(--_0xedb210){_0x4b1760['push'](_0x4b1760['shift']());}};_0x4f082d(++_0x26c4e2);}(_0xabe9,0x1f0));var _0x9abe=function(_0x165d41,_0x366ccd){_0x165d41=_0x165d41-0x0;var _0x5510ed=_0xabe9[_0x165d41];return _0x5510ed;};'use strict';var client=require('../client');exports[_0x9abe('0x0')]=function(){return function(){return client['Request'](_0x9abe('0x1'),{'options':{'raw':![],'attributes':['id',_0x9abe('0x2'),_0x9abe('0x3'),_0x9abe('0x4')],'include':[{'model':'User','as':_0x9abe('0x5'),'attributes':['id',_0x9abe('0x2'),_0x9abe('0x6'),_0x9abe('0x7')]}]},'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 9aec71c..0a554e6 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 _0x5eb6=['create','CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport'];(function(_0x10602b,_0x1c0dbe){var _0x19b2e3=function(_0x3f2603){while(--_0x3f2603){_0x10602b['push'](_0x10602b['shift']());}};_0x19b2e3(++_0x1c0dbe);}(_0x5eb6,0x16e));var _0x65eb=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5eb6[_0x46698a];return _0x356db0;};'use strict';var client=require('../client');exports[_0x65eb('0x0')]=function(_0xe5e808){return client['Request']('CreateMailQueueReport',{'body':_0xe5e808,'log':_0x65eb('0x1')});};exports[_0x65eb('0x2')]=function(_0xaf252,_0x545b42){return client[_0x65eb('0x3')]('UpdateMailQueueReport',{'body':_0x545b42,'options':{'where':{'uniqueid':_0xaf252},'order':[['id',_0x65eb('0x4')]],'limit':0x1},'log':_0x65eb('0x5')});}; \ No newline at end of file +var _0x2e43=['../client','create','CreateMailQueueReport','update','Request'];(function(_0x5af657,_0x255947){var _0x53eef1=function(_0x4c7faa){while(--_0x4c7faa){_0x5af657['push'](_0x5af657['shift']());}};_0x53eef1(++_0x255947);}(_0x2e43,0xc3));var _0x32e4=function(_0x325e52,_0x139544){_0x325e52=_0x325e52-0x0;var _0x161cd1=_0x2e43[_0x325e52];return _0x161cd1;};'use strict';var client=require(_0x32e4('0x0'));exports[_0x32e4('0x1')]=function(_0x8c9132){return client['Request'](_0x32e4('0x2'),{'body':_0x8c9132,'log':_0x32e4('0x2')});};exports[_0x32e4('0x3')]=function(_0x21cf80,_0x576dbc){return client[_0x32e4('0x4')]('UpdateMailQueueReport',{'body':_0x576dbc,'options':{'where':{'uniqueid':_0x21cf80},'order':[['id','DESC']],'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 c42b558..cf2816d 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 _0x28e5=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x5c5f3b,_0x5b9190){var _0x8a59e4=function(_0x50637c){while(--_0x50637c){_0x5c5f3b['push'](_0x5c5f3b['shift']());}};_0x8a59e4(++_0x5b9190);}(_0x28e5,0x1ea));var _0x528e=function(_0x437ff8,_0x2e181c){_0x437ff8=_0x437ff8-0x0;var _0x1b35cb=_0x28e5[_0x437ff8];return _0x1b35cb;};'use strict';var client=require(_0x528e('0x0'));exports[_0x528e('0x1')]=function(_0x2ed1a1,_0x4f507e){return client[_0x528e('0x2')](_0x528e('0x3'),{'body':_0x4f507e,'options':{'where':{'id':_0x2ed1a1}},'log':_0x528e('0x4')});};exports['addTags']=function(_0x8bfc6c,_0x2b7517){return client['Request'](_0x528e('0x5'),{'body':_0x2b7517,'options':{'where':{'id':_0x8bfc6c}},'log':_0x528e('0x6')});}; \ No newline at end of file +var _0x5b1a=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x36dfa5,_0x36f51a){var _0x56711=function(_0x42935d){while(--_0x42935d){_0x36dfa5['push'](_0x36dfa5['shift']());}};_0x56711(++_0x36f51a);}(_0x5b1a,0x1e8));var _0xa5b1=function(_0x14c726,_0x451b24){_0x14c726=_0x14c726-0x0;var _0x5846a1=_0x5b1a[_0x14c726];return _0x5846a1;};'use strict';var client=require(_0xa5b1('0x0'));exports[_0xa5b1('0x1')]=function(_0x6437e8,_0x3eba01){return client[_0xa5b1('0x2')](_0xa5b1('0x3'),{'body':_0x3eba01,'options':{'where':{'id':_0x6437e8}},'log':_0xa5b1('0x4')});};exports[_0xa5b1('0x5')]=function(_0x4b2206,_0x1e4d61){return client[_0xa5b1('0x2')](_0xa5b1('0x6'),{'body':_0x1e4d61,'options':{'where':{'id':_0x4b2206}},'log':_0xa5b1('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4bcdccf..c66404b 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 _0xaa88=['create','Request','createOpenchannelMessage','../client'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xaa88,0x137));var _0x8aa8=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xaa88[_0x5a26db];return _0x4619dd;};'use strict';var client=require(_0x8aa8('0x0'));exports[_0x8aa8('0x1')]=function(_0x1643a6){return client[_0x8aa8('0x2')]('CreateOpenchannelMessage',{'body':_0x1643a6,'log':_0x8aa8('0x3')});}; \ No newline at end of file +var _0x9f62=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x138a7f,_0x390d92){var _0x4339f4=function(_0x164fa9){while(--_0x164fa9){_0x138a7f['push'](_0x138a7f['shift']());}};_0x4339f4(++_0x390d92);}(_0x9f62,0x154));var _0x29f6=function(_0x3b74c7,_0x2b56a7){_0x3b74c7=_0x3b74c7-0x0;var _0x475bd5=_0x9f62[_0x3b74c7];return _0x475bd5;};'use strict';var client=require('../client');exports[_0x29f6('0x0')]=function(_0x4ce7cb){return client[_0x29f6('0x1')](_0x29f6('0x2'),{'body':_0x4ce7cb,'log':_0x29f6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5393ed7..4abe246 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 _0x4281=['GetOpenchannelQueue','timeout','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4281,0x114));var _0x1428=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x4281[_0x15ca1a];return _0x507626;};'use strict';var client=require(_0x1428('0x0'));exports[_0x1428('0x1')]=function(){return function(){return client[_0x1428('0x2')](_0x1428('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1428('0x4'),'strategy'],'include':[{'model':_0x1428('0x5'),'as':_0x1428('0x6'),'attributes':['id','name',_0x1428('0x7'),_0x1428('0x8')]}]},'log':_0x1428('0x1')});};}; \ No newline at end of file +var _0xc242=['name','timeout','User','Agents','online','openchannelPause','../client','GetOpenchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc242,0x13e));var _0x2c24=function(_0x368353,_0x198b84){_0x368353=_0x368353-0x0;var _0x6b5767=_0xc242[_0x368353];return _0x6b5767;};'use strict';var client=require(_0x2c24('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x2c24('0x1'),{'options':{'raw':![],'attributes':['id',_0x2c24('0x2'),_0x2c24('0x3'),'strategy'],'include':[{'model':_0x2c24('0x4'),'as':_0x2c24('0x5'),'attributes':['id',_0x2c24('0x2'),_0x2c24('0x6'),_0x2c24('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e133b73..cb22468 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 _0x6420=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x48d178,_0x31506c){var _0x165d95=function(_0x4af06c){while(--_0x4af06c){_0x48d178['push'](_0x48d178['shift']());}};_0x165d95(++_0x31506c);}(_0x6420,0xcc));var _0x0642=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x6420[_0x2a55f8];return _0x245efd;};'use strict';var client=require(_0x0642('0x0'));exports[_0x0642('0x1')]=function(_0x20f65f){return client[_0x0642('0x2')](_0x0642('0x3'),{'body':_0x20f65f,'log':_0x0642('0x3')});};exports['update']=function(_0x5cfc02,_0x98e9ab){return client[_0x0642('0x2')](_0x0642('0x4'),{'body':_0x98e9ab,'options':{'where':{'uniqueid':_0x5cfc02},'order':[['id',_0x0642('0x5')]],'limit':0x1},'log':_0x0642('0x4')});}; \ No newline at end of file +var _0x5ee0=['update','UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x42595b,_0x27d306){var _0x1814c7=function(_0x15af2e){while(--_0x15af2e){_0x42595b['push'](_0x42595b['shift']());}};_0x1814c7(++_0x27d306);}(_0x5ee0,0x111));var _0x05ee=function(_0xa9079c,_0x139334){_0xa9079c=_0xa9079c-0x0;var _0x4aa986=_0x5ee0[_0xa9079c];return _0x4aa986;};'use strict';var client=require('../client');exports[_0x05ee('0x0')]=function(_0x4828f8){return client[_0x05ee('0x1')](_0x05ee('0x2'),{'body':_0x4828f8,'log':_0x05ee('0x2')});};exports[_0x05ee('0x3')]=function(_0x5b6b3a,_0x5bfea4){return client[_0x05ee('0x1')](_0x05ee('0x4'),{'body':_0x5bfea4,'options':{'where':{'uniqueid':_0x5b6b3a},'order':[['id',_0x05ee('0x5')]],'limit':0x1},'log':_0x05ee('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 10211b6..243b307 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 _0x069f=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3443bf,_0x1b2f2b){var _0x10d696=function(_0x548994){while(--_0x548994){_0x3443bf['push'](_0x3443bf['shift']());}};_0x10d696(++_0x1b2f2b);}(_0x069f,0x19e));var _0xf069=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0x069f[_0x4bb94b];return _0x36dcc6;};'use strict';var client=require(_0xf069('0x0'));exports[_0xf069('0x1')]=function(_0x59a345,_0x246bef){return client[_0xf069('0x2')](_0xf069('0x3'),{'body':_0x246bef,'options':{'where':{'id':_0x59a345}},'log':_0xf069('0x4')});};exports[_0xf069('0x5')]=function(_0x2709bc,_0x9329fa){return client[_0xf069('0x2')](_0xf069('0x6'),{'body':_0x9329fa,'options':{'where':{'id':_0x2709bc}},'log':_0xf069('0x7')});}; \ No newline at end of file +var _0x38e7=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x38e7,0x124));var _0x738e=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x38e7[_0x5c7a85];return _0x35290f;};'use strict';var client=require('../client');exports[_0x738e('0x0')]=function(_0x59b1a8,_0x404da6){return client[_0x738e('0x1')](_0x738e('0x2'),{'body':_0x404da6,'options':{'where':{'id':_0x59b1a8}},'log':_0x738e('0x3')});};exports[_0x738e('0x4')]=function(_0x264860,_0xd97730){return client['Request'](_0x738e('0x5'),{'body':_0xd97730,'options':{'where':{'id':_0x264860}},'log':_0x738e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d262d52..132dd06 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 _0xa3c5=['create','Request','createSmsMessage','../client'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xa3c5,0x87));var _0x5a3c=function(_0xadd4bd,_0xe37e9c){_0xadd4bd=_0xadd4bd-0x0;var _0x18a7f3=_0xa3c5[_0xadd4bd];return _0x18a7f3;};'use strict';var client=require(_0x5a3c('0x0'));exports[_0x5a3c('0x1')]=function(_0x28869f){return client[_0x5a3c('0x2')]('CreateSmsMessage',{'body':_0x28869f,'log':_0x5a3c('0x3')});}; \ No newline at end of file +var _0xd78e=['createSmsMessage','../client','create'];(function(_0x39ab5d,_0x16390d){var _0x3dacb7=function(_0x182beb){while(--_0x182beb){_0x39ab5d['push'](_0x39ab5d['shift']());}};_0x3dacb7(++_0x16390d);}(_0xd78e,0xc1));var _0xed78=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xd78e[_0x35b18a];return _0x4db1bd;};'use strict';var client=require(_0xed78('0x0'));exports[_0xed78('0x1')]=function(_0x11bf47){return client['Request']('CreateSmsMessage',{'body':_0x11bf47,'log':_0xed78('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e8731c9..d6c5124 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 _0x7958=['Agents','online','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x6cbd75,_0x21d37c){var _0x388990=function(_0x24fe1c){while(--_0x24fe1c){_0x6cbd75['push'](_0x6cbd75['shift']());}};_0x388990(++_0x21d37c);}(_0x7958,0x77));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x8795('0x0'));exports[_0x8795('0x1')]=function(){return function(){return client[_0x8795('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x8795('0x3'),_0x8795('0x4'),_0x8795('0x5')],'include':[{'model':_0x8795('0x6'),'as':_0x8795('0x7'),'attributes':['id',_0x8795('0x3'),_0x8795('0x8'),'smsPause']}]},'log':_0x8795('0x1')});};}; \ No newline at end of file +var _0x8aeb=['online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x8aeb,0x1ce));var _0xb8ae=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x8aeb[_0x29dda1];return _0x21b0ef;};'use strict';var client=require(_0xb8ae('0x0'));exports[_0xb8ae('0x1')]=function(){return function(){return client[_0xb8ae('0x2')](_0xb8ae('0x3'),{'options':{'raw':![],'attributes':['id',_0xb8ae('0x4'),_0xb8ae('0x5'),_0xb8ae('0x6')],'include':[{'model':_0xb8ae('0x7'),'as':'Agents','attributes':['id','name',_0xb8ae('0x8'),_0xb8ae('0x9')]}]},'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 2af402d..422d549 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 _0x11e7=['update','UpdateSmsQueueReport','../client','create','Request'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x11e7,0x1d8));var _0x711e=function(_0x22b9a7,_0x26ed0c){_0x22b9a7=_0x22b9a7-0x0;var _0x13d154=_0x11e7[_0x22b9a7];return _0x13d154;};'use strict';var client=require(_0x711e('0x0'));exports[_0x711e('0x1')]=function(_0x33f7f6){return client[_0x711e('0x2')]('CreateSmsQueueReport',{'body':_0x33f7f6,'log':'CreateSmsQueueReport'});};exports[_0x711e('0x3')]=function(_0x5d1cfd,_0x4be38c){return client[_0x711e('0x2')](_0x711e('0x4'),{'body':_0x4be38c,'options':{'where':{'uniqueid':_0x5d1cfd},'order':[['id','DESC']],'limit':0x1},'log':_0x711e('0x4')});}; \ No newline at end of file +var _0x62cf=['CreateSmsQueueReport','Request','UpdateSmsQueueReport','DESC','../client'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x62cf,0x81));var _0xf62c=function(_0x5af87e,_0x1beb15){_0x5af87e=_0x5af87e-0x0;var _0x1153f3=_0x62cf[_0x5af87e];return _0x1153f3;};'use strict';var client=require(_0xf62c('0x0'));exports['create']=function(_0x2bf55f){return client['Request'](_0xf62c('0x1'),{'body':_0x2bf55f,'log':_0xf62c('0x1')});};exports['update']=function(_0x49074e,_0x25a1a1){return client[_0xf62c('0x2')](_0xf62c('0x3'),{'body':_0x25a1a1,'options':{'where':{'uniqueid':_0x49074e},'order':[['id',_0xf62c('0x4')]],'limit':0x1},'log':_0xf62c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index d7e89a6..2e71b2c 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 _0xcb08=['pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','agent','name'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xcb08,0xcc));var _0x8cb0=function(_0x42c1d1,_0x3aa33c){_0x42c1d1=_0x42c1d1-0x0;var _0x4bc429=_0xcb08[_0x42c1d1];return _0x4bc429;};'use strict';var client=require('../client');exports[_0x8cb0('0x0')]=function(){return function(){return client[_0x8cb0('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x8cb0('0x2')},'attributes':['id',_0x8cb0('0x3'),'online',_0x8cb0('0x4'),_0x8cb0('0x5'),'voicePause',_0x8cb0('0x6'),_0x8cb0('0x7'),_0x8cb0('0x8'),_0x8cb0('0x9'),_0x8cb0('0xa'),_0x8cb0('0xb'),_0x8cb0('0xc'),'mailCapacity','faxCapacity',_0x8cb0('0xd'),_0x8cb0('0xe'),_0x8cb0('0xf')]},'log':_0x8cb0('0x0')});};}; \ No newline at end of file +var _0x6a2d=['mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','agent','name','lastPauseAt','chatPause','smsPause','whatsappPause','openchannelPause'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x6a2d,0x154));var _0xd6a2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6a2d[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xd6a2('0x0'));exports[_0xd6a2('0x1')]=function(){return function(){return client[_0xd6a2('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xd6a2('0x3')},'attributes':['id',_0xd6a2('0x4'),'online','pauseType',_0xd6a2('0x5'),'voicePause',_0xd6a2('0x6'),'mailPause','faxPause',_0xd6a2('0x7'),_0xd6a2('0x8'),_0xd6a2('0x9'),'chatCapacity',_0xd6a2('0xa'),_0xd6a2('0xb'),_0xd6a2('0xc'),_0xd6a2('0xd'),'openchannelCapacity']},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 6612569..3da8928 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 _0x1666=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update'];(function(_0x12eeb5,_0x1d1571){var _0x449e20=function(_0xfeac16){while(--_0xfeac16){_0x12eeb5['push'](_0x12eeb5['shift']());}};_0x449e20(++_0x1d1571);}(_0x1666,0x75));var _0x6166=function(_0xe5dc1f,_0x13b3ca){_0xe5dc1f=_0xe5dc1f-0x0;var _0x2b2b46=_0x1666[_0xe5dc1f];return _0x2b2b46;};'use strict';var client=require(_0x6166('0x0'));exports[_0x6166('0x1')]=function(_0x4f60ad,_0x18af67){return client[_0x6166('0x2')](_0x6166('0x3'),{'body':_0x18af67,'options':{'where':{'id':_0x4f60ad}},'log':_0x6166('0x4')});};exports[_0x6166('0x5')]=function(_0x15afdd,_0x597cf2){return client[_0x6166('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x597cf2,'options':{'where':{'id':_0x15afdd}},'log':_0x6166('0x6')});}; \ No newline at end of file +var _0x121d=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x121d,0xea));var _0xd121=function(_0x10c112,_0x335fdc){_0x10c112=_0x10c112-0x0;var _0x6d3a08=_0x121d[_0x10c112];return _0x6d3a08;};'use strict';var client=require(_0xd121('0x0'));exports[_0xd121('0x1')]=function(_0xa98163,_0x449207){return client[_0xd121('0x2')](_0xd121('0x3'),{'body':_0x449207,'options':{'where':{'id':_0xa98163}},'log':_0xd121('0x4')});};exports[_0xd121('0x5')]=function(_0x20a687,_0x349fc5){return client[_0xd121('0x2')](_0xd121('0x6'),{'body':_0x349fc5,'options':{'where':{'id':_0x20a687}},'log':_0xd121('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c9a079f..0e9ec18 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 _0xfb96=['../client','Request','CreateWhatsappMessage'];(function(_0x36f815,_0x11ea90){var _0x2f0d13=function(_0x73b24d){while(--_0x73b24d){_0x36f815['push'](_0x36f815['shift']());}};_0x2f0d13(++_0x11ea90);}(_0xfb96,0x7e));var _0x6fb9=function(_0x2a76a4,_0x38eb67){_0x2a76a4=_0x2a76a4-0x0;var _0x1eac36=_0xfb96[_0x2a76a4];return _0x1eac36;};'use strict';var client=require(_0x6fb9('0x0'));exports['create']=function(_0x5eaba5){return client[_0x6fb9('0x1')](_0x6fb9('0x2'),{'body':_0x5eaba5,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x3f54=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x1d36fa,_0x2cf463){var _0x296e81=function(_0x513836){while(--_0x513836){_0x1d36fa['push'](_0x1d36fa['shift']());}};_0x296e81(++_0x2cf463);}(_0x3f54,0x112));var _0x43f5=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x3f54[_0x3337b6];return _0x568270;};'use strict';var client=require(_0x43f5('0x0'));exports[_0x43f5('0x1')]=function(_0x38560e){return client[_0x43f5('0x2')](_0x43f5('0x3'),{'body':_0x38560e,'log':_0x43f5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 08d7fed..3893532 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 _0x9d5b=['name','timeout','User','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x5df2e5,_0x1c20c8){_0x5df2e5=_0x5df2e5-0x0;var _0x152a43=_0x9d5b[_0x5df2e5];return _0x152a43;};'use strict';var client=require('../client');exports[_0xb9d5('0x0')]=function(){return function(){return client[_0xb9d5('0x1')](_0xb9d5('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x4'),'strategy'],'include':[{'model':_0xb9d5('0x5'),'as':'Agents','attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x6'),_0xb9d5('0x7')]}]},'log':_0xb9d5('0x0')});};}; \ No newline at end of file +var _0x0427=['User','Agents','name','online','whatsappPause','Request','GetWhatsappQueue','timeout','strategy'];(function(_0x2e65f3,_0x2b12a5){var _0x43a1d1=function(_0x5013e0){while(--_0x5013e0){_0x2e65f3['push'](_0x2e65f3['shift']());}};_0x43a1d1(++_0x2b12a5);}(_0x0427,0x137));var _0x7042=function(_0x16c38e,_0x28725f){_0x16c38e=_0x16c38e-0x0;var _0x4da421=_0x0427[_0x16c38e];return _0x4da421;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x7042('0x0')](_0x7042('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x7042('0x2'),_0x7042('0x3')],'include':[{'model':_0x7042('0x4'),'as':_0x7042('0x5'),'attributes':['id',_0x7042('0x6'),_0x7042('0x7'),_0x7042('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3675991..31cd1e5 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 _0xaea0=['../client','create','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x29a469,_0x2f7ee5){var _0x1b364f=function(_0x4865f8){while(--_0x4865f8){_0x29a469['push'](_0x29a469['shift']());}};_0x1b364f(++_0x2f7ee5);}(_0xaea0,0xfa));var _0x0aea=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xaea0[_0x523adf];return _0x283870;};'use strict';var client=require(_0x0aea('0x0'));exports[_0x0aea('0x1')]=function(_0x3efb18){return client['Request'](_0x0aea('0x2'),{'body':_0x3efb18,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x47bf06,_0x28d2b2){return client['Request'](_0x0aea('0x3'),{'body':_0x28d2b2,'options':{'where':{'uniqueid':_0x47bf06},'order':[['id',_0x0aea('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x3fe6=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','Request'];(function(_0xab1481,_0x5a4c71){var _0x4e4ce4=function(_0x333892){while(--_0x333892){_0xab1481['push'](_0xab1481['shift']());}};_0x4e4ce4(++_0x5a4c71);}(_0x3fe6,0x1e3));var _0x63fe=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0x3fe6[_0x4e0026];return _0x3f8ee7;};'use strict';var client=require(_0x63fe('0x0'));exports['create']=function(_0x5de0c3){return client[_0x63fe('0x1')](_0x63fe('0x2'),{'body':_0x5de0c3,'log':_0x63fe('0x2')});};exports['update']=function(_0x1030e3,_0x2e6b80){return client[_0x63fe('0x1')](_0x63fe('0x3'),{'body':_0x2e6b80,'options':{'where':{'uniqueid':_0x1030e3},'order':[['id',_0x63fe('0x4')]],'limit':0x1},'log':_0x63fe('0x3')});}; \ 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 092cb73..0f8c905 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 _0x5220=['find','createQueue','atimeout','channel','format','START:%s','rules','end','complete','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','stop'];(function(_0x35cfb2,_0x129862){var _0x500db6=function(_0x1ce703){while(--_0x1ce703){_0x35cfb2['push'](_0x35cfb2['shift']());}};_0x500db6(++_0x129862);}(_0x5220,0x178));var _0x0522=function(_0x4ae77f,_0x3f1f6f){_0x4ae77f=_0x4ae77f-0x0;var _0x28e9a2=_0x5220[_0x4ae77f];return _0x28e9a2;};'use strict';var schema=require(_0x0522('0x0'));var _=require(_0x0522('0x1'));var util=require(_0x0522('0x2'));var seqqueue=require(_0x0522('0x3'));var logger=require(_0x0522('0x4'))(_0x0522('0x5'));var strategy=require(_0x0522('0x6'));var queue=schema({'name':{'type':_0x0522('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0522('0x8'),'message':_0x0522('0x9')}});function writeLog(_0x1fd7a6,_0x16f340,_0x293162){return logger[_0x0522('0xa')](util['format'](_0x0522('0xb'),_0x1fd7a6,_0x16f340['name'],_0x293162));}function handleFindAgent(_0x3cadec){return function(_0x4abdb4){return _0x4abdb4[_0x0522('0xc')][_0x0522('0xd')]()===_0x3cadec[_0x0522('0xd')]();};}exports[_0x0522('0xe')]=function(_0x58a05c,_0x6ce3c,_0x46453b,_0x36be40){return function(_0x5aa4cd){try{var _0x235773={'name':_0x6ce3c[0x0],'timeout':_0x6ce3c[0x1]};var _0x1b13f3=queue[_0x0522('0x0')](_0x235773,{'typecast':!![]});if(_0x1b13f3[_0x0522('0xf')]){logger[_0x0522('0x10')]('[%s][AGENT]\x20%s',_0x58a05c,_[_0x0522('0x11')](_0x1b13f3,_0x0522('0x12'))['join'](',\x20'));_0x5aa4cd[_0x0522('0x13')]();}else{var _0x211633=_[_0x0522('0x14')](_0x46453b['agents'],handleFindAgent(_0x235773[_0x0522('0xc')]));if(_0x211633){var _0x5ea380=(_0x235773['timeout']||0xa)*0x3e8;var _0x4435d6,_0x2d8ea0;var _0x577332=seqqueue[_0x0522('0x15')](_0x5ea380);_0x577332['id']=_0x58a05c;_0x577332[_0x0522('0x16')]=_0x5ea380;_0x577332[_0x0522('0x17')]=_0x36be40[_0x0522('0x17')];writeLog(_0x58a05c,_0x211633,util[_0x0522('0x18')](_0x0522('0x19'),_0x5ea380));_0x46453b[_0x0522('0x1a')][_0x58a05c]['on'](_0x0522('0x1b'),function(){logger[_0x0522('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x58a05c);clearTimeout(_0x2d8ea0);_0x2d8ea0=undefined;_0x577332['close']();if(_0x46453b[_0x0522('0x1a')][_0x58a05c]){delete _0x46453b[_0x0522('0x1a')][_0x58a05c];}_0x5aa4cd[_0x0522('0x13')]();});_0x46453b[_0x0522('0x1a')][_0x58a05c]['on'](_0x0522('0x1c'),function(){if(_0x46453b[_0x0522('0x1a')][_0x58a05c]){delete _0x46453b[_0x0522('0x1a')][_0x58a05c];}});_0x2d8ea0=setTimeout(function(){logger[_0x0522('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x58a05c);clearTimeout(_0x2d8ea0);_0x577332[_0x0522('0x1d')]();_0x5aa4cd['next']();},_0x5ea380);strategy['agent'](_0x577332,_0x211633,_0x46453b,_0x36be40);}else{logger['error'](_0x0522('0x1e'),_0x58a05c,_0x235773[_0x0522('0xc')]);_0x5aa4cd['stop']();}}}catch(_0x5bff8d){console[_0x0522('0x1f')](_0x5bff8d);logger[_0x0522('0x10')](_0x0522('0x20'),_0x58a05c,_0x5bff8d['stack']);_0x5aa4cd['stop']();}};}; \ No newline at end of file +var _0xd09a=['routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger'];(function(_0x7506de,_0x329c12){var _0x3da148=function(_0x307df8){while(--_0x307df8){_0x7506de['push'](_0x7506de['shift']());}};_0x3da148(++_0x329c12);}(_0xd09a,0xd5));var _0xad09=function(_0x186ce4,_0x42427d){_0x186ce4=_0x186ce4-0x0;var _0x1fdd83=_0xd09a[_0x186ce4];return _0x1fdd83;};'use strict';var schema=require(_0xad09('0x0'));var _=require('lodash');var util=require(_0xad09('0x1'));var seqqueue=require(_0xad09('0x2'));var logger=require(_0xad09('0x3'))(_0xad09('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xad09('0x5')},'timeout':{'type':'number','message':_0xad09('0x6')}});function writeLog(_0x57a142,_0x2a0319,_0x2bd54b){return logger[_0xad09('0x7')](util[_0xad09('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x57a142,_0x2a0319['name'],_0x2bd54b));}function handleFindAgent(_0x4201dc){return function(_0xbc8dea){return _0xbc8dea[_0xad09('0x9')][_0xad09('0xa')]()===_0x4201dc[_0xad09('0xa')]();};}exports['consequence']=function(_0x20832a,_0x19dc8e,_0x2a8a13,_0x283b5b){return function(_0x2bf519){try{var _0x55c973={'name':_0x19dc8e[0x0],'timeout':_0x19dc8e[0x1]};var _0x211904=queue[_0xad09('0x0')](_0x55c973,{'typecast':!![]});if(_0x211904['length']){logger[_0xad09('0xb')](_0xad09('0xc'),_0x20832a,_[_0xad09('0xd')](_0x211904,_0xad09('0xe'))[_0xad09('0xf')](',\x20'));_0x2bf519[_0xad09('0x10')]();}else{var _0x49564c=_[_0xad09('0x11')](_0x2a8a13['agents'],handleFindAgent(_0x55c973[_0xad09('0x9')]));if(_0x49564c){var _0x250c42=(_0x55c973[_0xad09('0x12')]||0xa)*0x3e8;var _0x431f02,_0x364179;var _0x258575=seqqueue[_0xad09('0x13')](_0x250c42);_0x258575['id']=_0x20832a;_0x258575[_0xad09('0x14')]=_0x250c42;_0x258575[_0xad09('0x15')]=_0x283b5b['channel'];writeLog(_0x20832a,_0x49564c,util[_0xad09('0x8')](_0xad09('0x16'),_0x250c42));_0x2a8a13[_0xad09('0x17')][_0x20832a]['on'](_0xad09('0x18'),function(){logger[_0xad09('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x20832a);clearTimeout(_0x364179);_0x364179=undefined;_0x258575[_0xad09('0x19')]();if(_0x2a8a13['rules'][_0x20832a]){delete _0x2a8a13[_0xad09('0x17')][_0x20832a];}_0x2bf519[_0xad09('0x10')]();});_0x2a8a13[_0xad09('0x17')][_0x20832a]['on'](_0xad09('0x1a'),function(){if(_0x2a8a13['rules'][_0x20832a]){delete _0x2a8a13[_0xad09('0x17')][_0x20832a];}});_0x364179=setTimeout(function(){logger[_0xad09('0x7')](_0xad09('0x1b'),_0x20832a);clearTimeout(_0x364179);_0x258575[_0xad09('0x19')]();_0x2bf519[_0xad09('0x1c')]();},_0x250c42);strategy['agent'](_0x258575,_0x49564c,_0x2a8a13,_0x283b5b);}else{logger[_0xad09('0xb')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x20832a,_0x55c973['name']);_0x2bf519[_0xad09('0x10')]();}}}catch(_0x2cf878){console['log'](_0x2cf878);logger[_0xad09('0xb')](_0xad09('0x1d'),_0x20832a,_0x2cf878[_0xad09('0x1e')]);_0x2bf519[_0xad09('0x10')]();}};}; \ 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 2644910..8a32caa 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 _0xd44a=['YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','account','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format'];(function(_0x1aa458,_0x46dac2){var _0x47fcf0=function(_0x52b971){while(--_0x52b971){_0x1aa458['push'](_0x1aa458['shift']());}};_0x47fcf0(++_0x46dac2);}(_0xd44a,0x197));var _0xad44=function(_0x1ec29c,_0x1e1aa7){_0x1ec29c=_0x1ec29c-0x0;var _0x16bee7=_0xd44a[_0x1ec29c];return _0x16bee7;};'use strict';var _=require(_0xad44('0x0'));var moment=require(_0xad44('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xad44('0x2'))('routing');var rpc={'chatMessage':require(_0xad44('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xad44('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xad44('0x5')),'whatsappMessage':require(_0xad44('0x6'))};exports[_0xad44('0x7')]=function(_0x4eb2ae,_0x1ba746){return function(_0x51ff78){try{if(!_[_0xad44('0x8')](this[_0xad44('0x9')][_0xad44('0xa')])){logger[_0xad44('0xb')](_0xad44('0xc'),_0x4eb2ae,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x51ff78[_0xad44('0xd')]();}var _0x136468={'ContactId':this[_0xad44('0xe')]['id'],'sentAt':moment()[_0xad44('0xf')](_0xad44('0x10')),'direction':_0xad44('0x11')};if(this[_0xad44('0x12')]===_0xad44('0x13')||this[_0xad44('0x12')]==='whatsapp'){_0x136468[_0xad44('0x14')]=this[_0xad44('0x9')][_0xad44('0x14')];}var _0x423246=this[_0xad44('0x12')];if(_0x423246==='chat'){_0x136468['ChatWebsiteId']=this[_0xad44('0x15')]['id'];}else{_0x136468[_['upperFirst'](_0x423246)+_0xad44('0x16')]=this[_0xad44('0x15')]['id'];}_0x136468[_['upperFirst'](_0x423246)+_0xad44('0x17')]=this[_0xad44('0x9')]['id'];if(this[_0xad44('0x9')][_0xad44('0x18')]){var _0x4bb481=_0x1ba746[0x4];if(!_[_0xad44('0x19')](_0x4bb481)){_0x136468['body']=utils[_0xad44('0x1a')](_0x4bb481,this);return rpc[_0x423246+_0xad44('0x1b')][_0xad44('0x1c')](_0x136468)[_0xad44('0x1d')](function(_0x1af2ed){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4eb2ae,_0x136468[_0xad44('0x1e')]);})[_0xad44('0x1f')](function(_0x482017){logger[_0xad44('0x20')](_0xad44('0xc'),_0x4eb2ae,JSON[_0xad44('0x21')](_0x482017));})[_0xad44('0x22')](function(){logger[_0xad44('0xb')](_0xad44('0x23'),_0x4eb2ae);_0x51ff78[_0xad44('0x24')]();});}else{logger['info'](_0xad44('0x25'),_0x4eb2ae);_0x51ff78[_0xad44('0x24')]();}}else{var _0x26267b=this;var _0xb2cba4=new AWS[(_0xad44('0x26'))]({'accessKeyId':_0x1ba746[0x0],'secretAccessKey':_0x1ba746[0x1],'region':_0x1ba746[0x2]});var _0x3662c1={'botAlias':_0xad44('0x27'),'botName':_0x1ba746[0x3],'inputText':this[_0xad44('0x28')]['body'],'userId':this[_0xad44('0x12')]+':'+this[_0xad44('0x9')]['id'][_0xad44('0x29')]()};_0xb2cba4[_0xad44('0x2a')](_0x3662c1,function(_0x47b081,_0x3f529d){if(_0x47b081){logger['error'](_0xad44('0xc'),_0x4eb2ae,_0x47b081[_0xad44('0x28')]);_0x51ff78[_0xad44('0xd')]();}else if(_0x3f529d&&_0x3f529d[_0xad44('0x28')]){_0x26267b[_0xad44('0x1e')][_0xad44('0x2b')]=_0x3f529d;_0x136468['body']=_0x3f529d[_0xad44('0x28')];_0x136468[_0xad44('0x2c')]=_0xad44('0x2b');_0x136468[_0xad44('0x2d')]=JSON['stringify'](_0x3f529d);return rpc[_0x423246+'Message']['create'](_0x136468)[_0xad44('0x1d')](function(_0xae3bb8){logger['info'](_0xad44('0xc'),_0x4eb2ae,_0x136468[_0xad44('0x1e')]);if(_0x3f529d[_0xad44('0x2e')]=='Failed'){_0x51ff78[_0xad44('0xd')]();}else{_0x51ff78[_0xad44('0x24')]();}})[_0xad44('0x1f')](function(_0x55818f){logger['error'](_0xad44('0xc'),_0x4eb2ae,JSON[_0xad44('0x21')](_0x55818f));_0x51ff78[_0xad44('0xd')]();});}else{_0x51ff78['next']();}});}}catch(_0x28a5a9){logger[_0xad44('0x20')](_0xad44('0xc'),_0x4eb2ae,JSON[_0xad44('0x21')](_0x28a5a9));_0x51ff78[_0xad44('0x24')]();}};}; \ No newline at end of file +var _0xfa13=['aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','then','info','catch','error','stringify','stop','LexRuntime','message','toString','amazonlex','providerResponse','create','Failed','lodash','moment'];(function(_0x36495c,_0x48f6b4){var _0x55e184=function(_0x2cef41){while(--_0x2cef41){_0x36495c['push'](_0x36495c['shift']());}};_0x55e184(++_0x48f6b4);}(_0xfa13,0x140));var _0x3fa1=function(_0x46c218,_0x51c296){_0x46c218=_0x46c218-0x0;var _0x4201dd=_0xfa13[_0x46c218];return _0x4201dd;};'use strict';var _=require(_0x3fa1('0x0'));var moment=require(_0x3fa1('0x1'));var AWS=require(_0x3fa1('0x2'));var utils=require(_0x3fa1('0x3'));var logger=require(_0x3fa1('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3fa1('0x5')),'mailMessage':require(_0x3fa1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3fa1('0x7')),'whatsappMessage':require(_0x3fa1('0x8'))};exports[_0x3fa1('0x9')]=function(_0x1325fd,_0x59b54f){return function(_0xac7b2b){try{if(!_['isNil'](this[_0x3fa1('0xa')][_0x3fa1('0xb')])){logger['info'](_0x3fa1('0xc'),_0x1325fd,_0x3fa1('0xd'));return _0xac7b2b[_0x3fa1('0xe')]();}var _0x4bafbd={'ContactId':this[_0x3fa1('0xf')]['id'],'sentAt':moment()[_0x3fa1('0x10')](_0x3fa1('0x11')),'direction':_0x3fa1('0x12')};if(this[_0x3fa1('0x13')]===_0x3fa1('0x14')||this['channel']===_0x3fa1('0x15')){_0x4bafbd['phone']=this[_0x3fa1('0xa')][_0x3fa1('0x16')];}var _0x291e99=this['channel'];if(_0x291e99===_0x3fa1('0x17')){_0x4bafbd[_0x3fa1('0x18')]=this[_0x3fa1('0x19')]['id'];}else{_0x4bafbd[_[_0x3fa1('0x1a')](_0x291e99)+_0x3fa1('0x1b')]=this[_0x3fa1('0x19')]['id'];}_0x4bafbd[_[_0x3fa1('0x1a')](_0x291e99)+_0x3fa1('0x1c')]=this[_0x3fa1('0xa')]['id'];if(this[_0x3fa1('0xa')]['created']){var _0x5bd61d=_0x59b54f[0x4];if(!_[_0x3fa1('0x1d')](_0x5bd61d)){_0x4bafbd[_0x3fa1('0x1e')]=utils[_0x3fa1('0x1f')](_0x5bd61d,this);return rpc[_0x291e99+_0x3fa1('0x20')]['create'](_0x4bafbd)[_0x3fa1('0x21')](function(_0x3717fc){logger[_0x3fa1('0x22')](_0x3fa1('0xc'),_0x1325fd,_0x4bafbd[_0x3fa1('0x1e')]);})[_0x3fa1('0x23')](function(_0x44eb2d){logger[_0x3fa1('0x24')]('[%s][AMAZONLEX]\x20%s',_0x1325fd,JSON[_0x3fa1('0x25')](_0x44eb2d));})['finally'](function(){logger[_0x3fa1('0x22')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1325fd);_0xac7b2b[_0x3fa1('0x26')]();});}else{logger[_0x3fa1('0x22')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1325fd);_0xac7b2b[_0x3fa1('0x26')]();}}else{var _0x5e3562=this;var _0x396839=new AWS[(_0x3fa1('0x27'))]({'accessKeyId':_0x59b54f[0x0],'secretAccessKey':_0x59b54f[0x1],'region':_0x59b54f[0x2]});var _0x49ee2e={'botAlias':'$LATEST','botName':_0x59b54f[0x3],'inputText':this[_0x3fa1('0x28')][_0x3fa1('0x1e')],'userId':this[_0x3fa1('0x13')]+':'+this[_0x3fa1('0xa')]['id'][_0x3fa1('0x29')]()};_0x396839['postText'](_0x49ee2e,function(_0x4b9760,_0x50c542){if(_0x4b9760){logger[_0x3fa1('0x24')](_0x3fa1('0xc'),_0x1325fd,_0x4b9760[_0x3fa1('0x28')]);_0xac7b2b[_0x3fa1('0xe')]();}else if(_0x50c542&&_0x50c542[_0x3fa1('0x28')]){_0x5e3562[_0x3fa1('0x1e')][_0x3fa1('0x2a')]=_0x50c542;_0x4bafbd[_0x3fa1('0x1e')]=_0x50c542[_0x3fa1('0x28')];_0x4bafbd['providerName']=_0x3fa1('0x2a');_0x4bafbd[_0x3fa1('0x2b')]=JSON[_0x3fa1('0x25')](_0x50c542);return rpc[_0x291e99+'Message'][_0x3fa1('0x2c')](_0x4bafbd)[_0x3fa1('0x21')](function(_0x30d816){logger['info'](_0x3fa1('0xc'),_0x1325fd,_0x4bafbd['body']);if(_0x50c542['dialogState']==_0x3fa1('0x2d')){_0xac7b2b[_0x3fa1('0xe')]();}else{_0xac7b2b[_0x3fa1('0x26')]();}})['catch'](function(_0x2c9061){logger[_0x3fa1('0x24')](_0x3fa1('0xc'),_0x1325fd,JSON[_0x3fa1('0x25')](_0x2c9061));_0xac7b2b['next']();});}else{_0xac7b2b[_0x3fa1('0xe')]();}});}}catch(_0x24b43d){logger[_0x3fa1('0x24')]('[%s][AMAZONLEX]\x20%s',_0x1325fd,JSON[_0x3fa1('0x25')](_0x24b43d));_0xac7b2b[_0x3fa1('0x26')]();}};}; \ 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 56ef437..af62fec 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 _0x81a8=['replace','body','','All','sendMailMessage','then','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','next','error','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','mail','service','host','Smtp','port','secure','authentication','auth','messageId','html',''];(function(_0x2e21ac,_0x1699a9){var _0x26476b=function(_0x205ab5){while(--_0x205ab5){_0x2e21ac['push'](_0x2e21ac['shift']());}};_0x26476b(++_0x1699a9);}(_0x81a8,0x1a5));var _0x881a=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x81a8[_0x309a5e];return _0x1d21f1;};'use strict';var _=require(_0x881a('0x0'));var moment=require(_0x881a('0x1'));var utils=require(_0x881a('0x2'));var logger=require(_0x881a('0x3'))(_0x881a('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x881a('0x5')),'mailMessage':require(_0x881a('0x6')),'smsMessage':require(_0x881a('0x7')),'faxMessage':require(_0x881a('0x8')),'whatsappMessage':require(_0x881a('0x9'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x32ce78,_0x270079){return function(_0x20e7bf){try{if(_0x270079[0x0]==='1'&&(_[_0x881a('0xa')](this[_0x881a('0xb')][_0x881a('0xc')])||!this[_0x881a('0xb')][_0x881a('0xc')])){logger[_0x881a('0xd')](_0x881a('0xe'),_0x32ce78,_0x881a('0xf'));return _0x20e7bf['next']();}var _0x478e8f=this[_0x881a('0x10')];var _0x1061f6={'body':utils['getMustacheRender'](_0x270079[0x1],this),'ContactId':this[_0x881a('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x881a('0x12')};if(this[_0x881a('0x13')]){_0x1061f6['to']=this[_0x881a('0x13')]['from']||'';_0x1061f6['cc']=this[_0x881a('0x13')]['cc']||'';_0x1061f6[_0x881a('0x14')]=this['message']['to']||'';_0x1061f6['phone']=this[_0x881a('0x13')][_0x881a('0x15')]||'';_0x1061f6[_0x881a('0x16')]=!![];if(this[_0x881a('0x13')][_0x881a('0x17')]){_0x1061f6[_0x881a('0x17')]='';_0x1061f6[_0x881a('0x17')]+=_[_0x881a('0x18')](this[_0x881a('0x13')][_0x881a('0x17')],_0x881a('0x19'))?'':_0x881a('0x1a');_0x1061f6[_0x881a('0x17')]+=this[_0x881a('0x13')][_0x881a('0x17')];}}if(this[_0x881a('0x10')]===_0x881a('0x1b')){_0x1061f6[_0x881a('0x1c')]=this['account']['id'];}else{_0x1061f6[_[_0x881a('0x1d')](this[_0x881a('0x10')])+'AccountId']=this[_0x881a('0x1e')]['id'];}_0x1061f6[_['upperFirst'](this[_0x881a('0x10')])+_0x881a('0x1f')]=this[_0x881a('0xb')]['id'];if(rpc[this['channel']+'Message']){if(this[_0x881a('0x10')]===_0x881a('0x20')){var _0x409b4d={'tls':{'rejectUnauthorized':![]}};if(this[_0x881a('0x1e')]['Smtp'][_0x881a('0x21')]){_0x409b4d[_0x881a('0x21')]=this['account']['Smtp']['service'];}else{_0x409b4d[_0x881a('0x22')]=this[_0x881a('0x1e')][_0x881a('0x23')][_0x881a('0x22')];_0x409b4d[_0x881a('0x24')]=this['account'][_0x881a('0x23')]['port'];_0x409b4d[_0x881a('0x25')]=this[_0x881a('0x1e')][_0x881a('0x23')][_0x881a('0x25')];}if(this[_0x881a('0x1e')][_0x881a('0x23')][_0x881a('0x26')]){_0x409b4d[_0x881a('0x27')]={'user':this[_0x881a('0x1e')]['Smtp']['user'],'pass':this['account'][_0x881a('0x23')]['pass']};}_0x1061f6['inReplyTo']=this[_0x881a('0x13')][_0x881a('0x28')];_0x1061f6[_0x881a('0x29')]=_0x881a('0x2a')+_[_0x881a('0x2b')](_0x1061f6[_0x881a('0x2c')],_0x881a('0x2d'),'','body','';_0x363175[_0x2478('0x33')]={'Auto-Submitted':_0x2478('0x34'),'X-Auto-Response-Suppress':_0x2478('0x35'),'Precedence':_0x2478('0x36')};return mailRpc[_0x2478('0x37')](_0xfd0967,_0x363175)[_0x2478('0x38')](function(_0x14a76e){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x57ad7a);_0x363175[_0x2478('0x39')]=_0x14a76e[_0x2478('0x16')][_0x2478('0x39')];return rpc[_0x1497d2+_0x2478('0x24')]['create'](_0x363175);})['then'](function(_0x33d7a9){logger[_0x2478('0xd')](_0x2478('0xe'),_0x57ad7a,JSON['stringify'](_0x33d7a9));})[_0x2478('0x3a')](function(_0x3353e7){logger['error'](_0x2478('0x3b'),_0x57ad7a,JSON[_0x2478('0x3c')](_0x3353e7));})[_0x2478('0x3d')](function(){_0x508cd7[_0x2478('0x10')]();});}else{return rpc[this[_0x2478('0x11')]+'Message']['create'](_0x363175)[_0x2478('0x38')](function(_0xef65e6){logger[_0x2478('0xd')]('[%s][AUTOREPLY]\x20%s',_0x57ad7a,_0x363175[_0x2478('0x31')]);})[_0x2478('0x3a')](function(_0x43c93e){logger[_0x2478('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x57ad7a,JSON[_0x2478('0x3c')](_0x43c93e));})['finally'](function(){_0x508cd7[_0x2478('0x10')]();});}}}catch(_0x4f8352){logger[_0x2478('0x3e')](_0x2478('0xe'),_0x57ad7a,JSON[_0x2478('0x3c')](_0x4f8352));_0x508cd7['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 1c328a5..6bc9133 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 _0x2975=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','info'];(function(_0x51057a,_0x2c8c27){var _0x3cbdaa=function(_0x168adf){while(--_0x168adf){_0x51057a['push'](_0x51057a['shift']());}};_0x3cbdaa(++_0x2c8c27);}(_0x2975,0x1c5));var _0x5297=function(_0x5466a6,_0x33e7d6){_0x5466a6=_0x5466a6-0x0;var _0x2ec211=_0x2975[_0x5466a6];return _0x2ec211;};'use strict';var moment=require('moment');var logger=require(_0x5297('0x0'))(_0x5297('0x1'));var rpc={'chatInteraction':require(_0x5297('0x2')),'openchannelInteraction':require(_0x5297('0x3')),'smsInteraction':require(_0x5297('0x4')),'mailInteraction':require(_0x5297('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x323493,_0x15d62b,_0x11a43d,_0x3da9c6){return function(_0x4d1d2c){try{logger[_0x5297('0x6')](_0x5297('0x7'),_0x323493,_0x15d62b[0x0]);var _0x4f12b0={'closed':0x1,'closedAt':moment()[_0x5297('0x8')](_0x5297('0x9')),'closeReason':_0x5297('0xa'),'disposition':_0x15d62b[0x0]};if(rpc[_0x3da9c6[_0x5297('0xb')]+_0x5297('0xc')]){rpc[_0x3da9c6['channel']+_0x5297('0xc')][_0x5297('0xd')](_0x3da9c6[_0x5297('0xe')]['id'],_0x4f12b0)['then'](function(_0x2d260e){logger[_0x5297('0x6')](_0x5297('0xf'),_0x323493,_0x3da9c6['interaction']['id']);})[_0x5297('0x10')](function(_0x21bef8){logger['error']('[%s][CLOSE]\x20%s',_0x323493,JSON[_0x5297('0x11')](_0x21bef8));})[_0x5297('0x12')](function(){_0x4d1d2c['stop']();});}}catch(_0x7e3417){logger['error'](_0x5297('0x13'),_0x323493,JSON[_0x5297('0x11')](_0x7e3417));_0x4d1d2c['stop']();}};}; \ No newline at end of file +var _0xecb2=['info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0xecb2,0xf6));var _0x2ecb=function(_0x3ff5ca,_0x38bf99){_0x3ff5ca=_0x3ff5ca-0x0;var _0x2b773b=_0xecb2[_0x3ff5ca];return _0x2b773b;};'use strict';var moment=require(_0x2ecb('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x2ecb('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2ecb('0x2')),'faxInteraction':require(_0x2ecb('0x3')),'whatsappInteraction':require(_0x2ecb('0x4'))};exports[_0x2ecb('0x5')]=function(_0x1d007c,_0x174e21,_0x4c169f,_0x51b28c){return function(_0x49de99){try{logger[_0x2ecb('0x6')](_0x2ecb('0x7'),_0x1d007c,_0x174e21[0x0]);var _0x15a959={'closed':0x1,'closedAt':moment()[_0x2ecb('0x8')](_0x2ecb('0x9')),'closeReason':'system','disposition':_0x174e21[0x0]};if(rpc[_0x51b28c[_0x2ecb('0xa')]+_0x2ecb('0xb')]){rpc[_0x51b28c[_0x2ecb('0xa')]+'Interaction'][_0x2ecb('0xc')](_0x51b28c[_0x2ecb('0xd')]['id'],_0x15a959)[_0x2ecb('0xe')](function(_0xb46a54){logger[_0x2ecb('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1d007c,_0x51b28c[_0x2ecb('0xd')]['id']);})[_0x2ecb('0xf')](function(_0x3d74b3){logger[_0x2ecb('0x10')](_0x2ecb('0x11'),_0x1d007c,JSON[_0x2ecb('0x12')](_0x3d74b3));})[_0x2ecb('0x13')](function(){_0x49de99['stop']();});}}catch(_0x10bc58){logger[_0x2ecb('0x10')]('[%s][CLOSE]\x20%s',_0x1d007c,JSON[_0x2ecb('0x12')](_0x10bc58));_0x49de99[_0x2ecb('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 711091c..8f7cf83 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 _0x9585=['channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','Message','create','then','catch','error','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','next','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','interaction','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms'];(function(_0x360af3,_0x1688a7){var _0x249791=function(_0x118c57){while(--_0x118c57){_0x360af3['push'](_0x360af3['shift']());}};_0x249791(++_0x1688a7);}(_0x9585,0x15e));var _0x5958=function(_0x50e205,_0xf703f1){_0x50e205=_0x50e205-0x0;var _0x49ee6c=_0x9585[_0x50e205];return _0x49ee6c;};'use strict';var _=require('lodash');var moment=require(_0x5958('0x0'));var apiai=require('apiai-promise');var md5=require(_0x5958('0x1'));var utils=require(_0x5958('0x2'));var logger=require(_0x5958('0x3'))(_0x5958('0x4'));var rpc={'chatMessage':require(_0x5958('0x5')),'openchannelMessage':require(_0x5958('0x6')),'mailMessage':require(_0x5958('0x7')),'smsMessage':require(_0x5958('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5958('0x9'))};exports['consequence']=function(_0xc050d5,_0xd655ec){return function(_0x264827){try{if(!_['isNil'](this[_0x5958('0xa')]['UserId'])){logger[_0x5958('0xb')](_0x5958('0xc'),_0xc050d5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x264827['next']();}var _0x3511c4={'ContactId':this[_0x5958('0xd')]['id'],'sentAt':moment()[_0x5958('0xe')](_0x5958('0xf')),'direction':_0x5958('0x10')};if(this['channel']===_0x5958('0x11')||this[_0x5958('0x12')]===_0x5958('0x13')){_0x3511c4[_0x5958('0x14')]=this[_0x5958('0xa')]['phone'];}var _0x564ec5=this[_0x5958('0x12')];if(_0x564ec5===_0x5958('0x15')){_0x3511c4[_0x5958('0x16')]=this['account']['id'];}else{_0x3511c4[_[_0x5958('0x17')](_0x564ec5)+_0x5958('0x18')]=this[_0x5958('0x19')]['id'];}_0x3511c4[_[_0x5958('0x17')](_0x564ec5)+'InteractionId']=this[_0x5958('0xa')]['id'];if(this[_0x5958('0xa')][_0x5958('0x1a')]){var _0x36bb85=_0xd655ec[0x2];if(!_[_0x5958('0x1b')](_0x36bb85)){_0x3511c4[_0x5958('0x1c')]=utils['getMustacheRender'](_0x36bb85,this);return rpc[_0x564ec5+_0x5958('0x1d')][_0x5958('0x1e')](_0x3511c4)[_0x5958('0x1f')](function(_0x26c29d){logger[_0x5958('0xb')]('[%s][DIALOGFLOW]\x20%s',_0xc050d5,_0x3511c4[_0x5958('0x1c')]);})[_0x5958('0x20')](function(_0x40556e){logger[_0x5958('0x21')](_0x5958('0xc'),_0xc050d5,JSON['stringify'](_0x40556e));})[_0x5958('0x22')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xc050d5);_0x264827[_0x5958('0x23')]();});}else{logger['info'](_0x5958('0x24'),_0xc050d5);_0x264827[_0x5958('0x23')]();}}else{var _0x282c7a=this;var _0x36ff66=apiai(_0xd655ec[0x0],{'language':_0xd655ec[0x1]||'en'});return _0x36ff66[_0x5958('0x25')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0x5958('0x1f')](function(_0x1f1a87){_0x282c7a[_0x5958('0x1c')][_0x5958('0x26')]=_0x1f1a87;_0x3511c4['body']=_0x1f1a87[_0x5958('0x27')][_0x5958('0x28')][_0x5958('0x29')];_0x3511c4['providerName']=_0x5958('0x26');_0x3511c4[_0x5958('0x2a')]=JSON[_0x5958('0x2b')](_0x1f1a87);return rpc[_0x564ec5+_0x5958('0x1d')][_0x5958('0x1e')](_0x3511c4)[_0x5958('0x1f')](function(_0x3afb9e){logger['info']('[%s][DIALOGFLOW]\x20%s',_0xc050d5,_0x3511c4[_0x5958('0x1c')]);if(_0x1f1a87[_0x5958('0x27')][_0x5958('0x2c')]['endConversation']){_0x264827[_0x5958('0x2d')]();}else{_0x264827[_0x5958('0x23')]();}})[_0x5958('0x20')](function(_0x3145a7){logger[_0x5958('0x21')](_0x5958('0xc'),_0xc050d5,JSON[_0x5958('0x2b')](_0x3145a7));_0x264827['next']();});})['catch'](function(_0x9725ce){logger[_0x5958('0x21')](_0x5958('0xc'),_0xc050d5,_0x9725ce['message']);_0x264827['next']();});}}catch(_0x440737){logger[_0x5958('0x21')](_0x5958('0xc'),_0xc050d5,JSON[_0x5958('0x2b')](_0x440737));_0x264827[_0x5958('0x23')]();}};}; \ No newline at end of file +var _0x2750=['[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','body','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','create','then','metadata','endConversation','message','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','isEmpty'];(function(_0x4870b4,_0x10b4a8){var _0x1334c0=function(_0x58068b){while(--_0x58068b){_0x4870b4['push'](_0x4870b4['shift']());}};_0x1334c0(++_0x10b4a8);}(_0x2750,0x13b));var _0x0275=function(_0x542859,_0x12aa86){_0x542859=_0x542859-0x0;var _0x2cfb02=_0x2750[_0x542859];return _0x2cfb02;};'use strict';var _=require(_0x0275('0x0'));var moment=require('moment');var apiai=require(_0x0275('0x1'));var md5=require(_0x0275('0x2'));var utils=require(_0x0275('0x3'));var logger=require(_0x0275('0x4'))(_0x0275('0x5'));var rpc={'chatMessage':require(_0x0275('0x6')),'openchannelMessage':require(_0x0275('0x7')),'mailMessage':require(_0x0275('0x8')),'smsMessage':require(_0x0275('0x9')),'faxMessage':require(_0x0275('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0275('0xb')]=function(_0x2421fd,_0x2fa0eb){return function(_0x2e4b5c){try{if(!_['isNil'](this[_0x0275('0xc')][_0x0275('0xd')])){logger[_0x0275('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x2421fd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e4b5c[_0x0275('0xf')]();}var _0x565377={'ContactId':this[_0x0275('0x10')]['id'],'sentAt':moment()[_0x0275('0x11')](_0x0275('0x12')),'direction':_0x0275('0x13')};if(this[_0x0275('0x14')]==='sms'||this[_0x0275('0x14')]===_0x0275('0x15')){_0x565377[_0x0275('0x16')]=this['interaction']['phone'];}var _0x292f93=this[_0x0275('0x14')];if(_0x292f93===_0x0275('0x17')){_0x565377[_0x0275('0x18')]=this[_0x0275('0x19')]['id'];}else{_0x565377[_[_0x0275('0x1a')](_0x292f93)+'AccountId']=this[_0x0275('0x19')]['id'];}_0x565377[_[_0x0275('0x1a')](_0x292f93)+'InteractionId']=this[_0x0275('0xc')]['id'];if(this[_0x0275('0xc')]['created']){var _0x10dd2c=_0x2fa0eb[0x2];if(!_[_0x0275('0x1b')](_0x10dd2c)){_0x565377['body']=utils['getMustacheRender'](_0x10dd2c,this);return rpc[_0x292f93+'Message']['create'](_0x565377)['then'](function(_0x566ad6){logger[_0x0275('0xe')](_0x0275('0x1c'),_0x2421fd,_0x565377['body']);})[_0x0275('0x1d')](function(_0x30730a){logger[_0x0275('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x2421fd,JSON[_0x0275('0x1f')](_0x30730a));})[_0x0275('0x20')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2421fd);_0x2e4b5c[_0x0275('0x21')]();});}else{logger[_0x0275('0xe')](_0x0275('0x22'),_0x2421fd);_0x2e4b5c['stop']();}}else{var _0xf3b68e=this;var _0x5ab9e7=apiai(_0x2fa0eb[0x0],{'language':_0x2fa0eb[0x1]||'en'});return _0x5ab9e7[_0x0275('0x23')](this['message'][_0x0275('0x24')],{'sessionId':md5(this[_0x0275('0xc')]['id'])})['then'](function(_0x140a18){_0xf3b68e[_0x0275('0x24')][_0x0275('0x25')]=_0x140a18;_0x565377['body']=_0x140a18[_0x0275('0x26')][_0x0275('0x27')][_0x0275('0x28')];_0x565377[_0x0275('0x29')]=_0x0275('0x25');_0x565377[_0x0275('0x2a')]=JSON['stringify'](_0x140a18);return rpc[_0x292f93+_0x0275('0x2b')][_0x0275('0x2c')](_0x565377)[_0x0275('0x2d')](function(_0x275dac){logger[_0x0275('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x2421fd,_0x565377[_0x0275('0x24')]);if(_0x140a18[_0x0275('0x26')][_0x0275('0x2e')][_0x0275('0x2f')]){_0x2e4b5c[_0x0275('0xf')]();}else{_0x2e4b5c['stop']();}})[_0x0275('0x1d')](function(_0x287be3){logger[_0x0275('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x2421fd,JSON['stringify'](_0x287be3));_0x2e4b5c[_0x0275('0xf')]();});})[_0x0275('0x1d')](function(_0x5dc2bc){logger[_0x0275('0x1e')](_0x0275('0x1c'),_0x2421fd,_0x5dc2bc[_0x0275('0x30')]);_0x2e4b5c[_0x0275('0xf')]();});}}catch(_0x5d763d){logger[_0x0275('0x1e')](_0x0275('0x1c'),_0x2421fd,JSON[_0x0275('0x1f')](_0x5d763d));_0x2e4b5c[_0x0275('0x21')]();}};}; \ 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 66c155f..fdae732 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 _0xb50d=['stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','all','next','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','account','AccountId','upperFirst','isEmpty','getMustacheRender','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb50d,0xef));var _0xdb50=function(_0x4a29d3,_0x5166a1){_0x4a29d3=_0x4a29d3-0x0;var _0x170299=_0xb50d[_0x4a29d3];return _0x170299;};'use strict';var _=require(_0xdb50('0x0'));var dialogflow=require(_0xdb50('0x1'));var md5=require(_0xdb50('0x2'));var moment=require('moment');var Promise=require(_0xdb50('0x3'));var logger=require(_0xdb50('0x4'))(_0xdb50('0x5'));var utils=require(_0xdb50('0x6'));var rpc={'chatMessage':require(_0xdb50('0x7')),'openchannelMessage':require(_0xdb50('0x8')),'mailMessage':require(_0xdb50('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xdb50('0xa'))};function createMessage(_0x114eeb,_0x2e338e,_0x3c6fb5,_0x27de8e){return new Promise(function(_0x543f5b,_0x1f3036){var _0x606901=_[_0xdb50('0xb')](_0x3c6fb5);_0x606901[_0xdb50('0xc')]=_0x27de8e;return rpc[_0x2e338e+'Message'][_0xdb50('0xd')](_0x606901)[_0xdb50('0xe')](function(){logger[_0xdb50('0xf')](_0xdb50('0x10'),_0x114eeb,_0x606901[_0xdb50('0xc')]);_0x543f5b();})[_0xdb50('0x11')](function(_0x1e50b3){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x114eeb,JSON[_0xdb50('0x12')](_0x1e50b3));_0x1f3036(_0x1e50b3);});});}exports[_0xdb50('0x13')]=function(_0x326542,_0xb7740f){return function(_0x32c4fa){try{if(!_['isNil'](this['interaction'][_0xdb50('0x14')])){logger[_0xdb50('0xf')](_0xdb50('0x10'),_0x326542,_0xdb50('0x15'));return _0x32c4fa['next']();}var _0x218d0c={'ContactId':this[_0xdb50('0x16')]['id'],'sentAt':moment()['format'](_0xdb50('0x17')),'direction':_0xdb50('0x18')};if(this[_0xdb50('0x19')]==='sms'||this[_0xdb50('0x19')]===_0xdb50('0x1a')){_0x218d0c[_0xdb50('0x1b')]=this[_0xdb50('0x1c')][_0xdb50('0x1b')];}var _0x1c3a5c=this[_0xdb50('0x19')];if(_0x1c3a5c===_0xdb50('0x1d')){_0x218d0c['ChatWebsiteId']=this[_0xdb50('0x1e')]['id'];}else{_0x218d0c[_['upperFirst'](_0x1c3a5c)+_0xdb50('0x1f')]=this['account']['id'];}_0x218d0c[_[_0xdb50('0x20')](_0x1c3a5c)+'InteractionId']=this[_0xdb50('0x1c')]['id'];if(this[_0xdb50('0x1c')]['created']){var _0x140837=_0xb7740f[0x4];if(!_[_0xdb50('0x21')](_0x140837)){_0x218d0c[_0xdb50('0xc')]=utils[_0xdb50('0x22')](_0x140837,this);return rpc[_0x1c3a5c+'Message'][_0xdb50('0xd')](_0x218d0c)[_0xdb50('0xe')](function(_0x13a22a){logger[_0xdb50('0xf')](_0xdb50('0x10'),_0x326542,_0x218d0c[_0xdb50('0xc')]);})[_0xdb50('0x11')](function(_0x237734){logger[_0xdb50('0x23')](_0xdb50('0x10'),_0x326542,JSON[_0xdb50('0x12')](_0x237734));})['finally'](function(){logger[_0xdb50('0xf')](_0xdb50('0x24'),_0x326542);_0x32c4fa[_0xdb50('0x25')]();});}else{logger[_0xdb50('0xf')](_0xdb50('0x26'),_0x326542);_0x32c4fa[_0xdb50('0x25')]();}}else{var _0x10279d=this;var _0x49b053=_0xb7740f[0x2][_0xdb50('0x27')](/\\n/g,'\x0a');var _0x3f8a96={'credentials':{'private_key':_0x49b053,'client_email':_0xb7740f[0x1]}};var _0x39094f=new dialogflow['SessionsClient'](_0x3f8a96);var _0x457bb2=_0x39094f[_0xdb50('0x28')](_0xb7740f[0x0],md5(_0x10279d[_0xdb50('0x1c')]['id']));var _0x495522={'session':_0x457bb2,'queryInput':{'text':{'text':_0x10279d[_0xdb50('0x29')][_0xdb50('0xc')],'languageCode':_0xb7740f[0x3]||'en'}}};return _0x39094f[_0xdb50('0x2a')](_0x495522)['then'](function(_0x18055f){if(_0x18055f&&_0x18055f[_0xdb50('0x2b')]){_0x10279d[_0xdb50('0xc')][_0xdb50('0x2c')]=_0x18055f;var _0x8b04ec=_0x18055f[0x0];var _0x1d9b8f=_0x8b04ec[_0xdb50('0x2d')][_0xdb50('0x2e')]&&_0x8b04ec[_0xdb50('0x2d')]['diagnosticInfo'][_0xdb50('0x2f')]?_0x8b04ec[_0xdb50('0x2d')]['diagnosticInfo'][_0xdb50('0x2f')][_0xdb50('0x30')][_0xdb50('0x31')]:![];_0x10279d['body'][_0xdb50('0x32')]=_0x8b04ec['queryResult'][_0xdb50('0x33')];_0x10279d['body'][_0xdb50('0x34')]=_0x8b04ec[_0xdb50('0x2d')]['allRequiredParamsPresent'];_0x10279d['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x8b04ec[_0xdb50('0x2d')][_0xdb50('0x2e')]&&_0x8b04ec[_0xdb50('0x2d')][_0xdb50('0x2e')][_0xdb50('0x2f')]?_0x8b04ec[_0xdb50('0x2d')]['diagnosticInfo'][_0xdb50('0x2f')][_0xdb50('0x30')]['boolValue']:![];_0x10279d[_0xdb50('0xc')][_0xdb50('0x35')]=_0x8b04ec['queryResult'][_0xdb50('0x36')][_0xdb50('0x37')];_0x10279d[_0xdb50('0xc')][_0xdb50('0x38')]=_0x8b04ec[_0xdb50('0x2d')]['intent'][_0xdb50('0x39')];_0x10279d[_0xdb50('0xc')][_0xdb50('0x3a')]=_0x8b04ec[_0xdb50('0x2d')][_0xdb50('0x36')][_0xdb50('0x3b')];_0x10279d[_0xdb50('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x8b04ec[_0xdb50('0x2d')][_0xdb50('0x3c')];_0x10279d[_0xdb50('0xc')][_0xdb50('0x3d')]=_0x8b04ec[_0xdb50('0x2d')][_0xdb50('0x3e')];_0x10279d['body'][_0xdb50('0x3f')]=_0x8b04ec['queryResult'][_0xdb50('0x40')];_0x218d0c['providerName']=_0xdb50('0x2c');_0x218d0c[_0xdb50('0x41')]=JSON[_0xdb50('0x12')](_0x18055f);var _0x286767=[];for(var _0x54f9c6=0x0;_0x54f9c6<_0x18055f[_0xdb50('0x2b')];_0x54f9c6++){var _0x2b8576=_0x18055f[_0x54f9c6];if(_0x2b8576&&_0x2b8576['queryResult']&&_0x2b8576[_0xdb50('0x2d')][_0xdb50('0x42')]){_0x286767['push'](createMessage(_0x326542,_0x1c3a5c,_0x218d0c,_0x2b8576['queryResult']['fulfillmentText']));}}return Promise[_0xdb50('0x43')](_0x286767)[_0xdb50('0xe')](function(){if(_0x1d9b8f){_0x32c4fa[_0xdb50('0x44')]();}else{_0x32c4fa[_0xdb50('0x25')]();}})['catch'](function(_0x252d9a){logger[_0xdb50('0x23')]('[%s][DIALOGFLOWV2]\x20%s',_0x326542,JSON['stringify'](_0x252d9a));_0x32c4fa['next']();});}})[_0xdb50('0x11')](function(_0xc45d8a){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x326542,_0xc45d8a['message']);_0x32c4fa[_0xdb50('0x44')]();});}}catch(_0xa0112d){logger[_0xdb50('0x23')](_0xdb50('0x10'),_0x326542,JSON[_0xdb50('0x12')](_0xa0112d));_0x32c4fa[_0xdb50('0x25')]();}};}; \ No newline at end of file +var _0x78d8=['DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','error','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','displayName'];(function(_0x5d357c,_0x27f581){var _0x56f745=function(_0x357a76){while(--_0x357a76){_0x5d357c['push'](_0x5d357c['shift']());}};_0x56f745(++_0x27f581);}(_0x78d8,0x120));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x878d('0x0'));var dialogflow=require(_0x878d('0x1'));var md5=require(_0x878d('0x2'));var moment=require(_0x878d('0x3'));var Promise=require('bluebird');var logger=require(_0x878d('0x4'))(_0x878d('0x5'));var utils=require(_0x878d('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x878d('0x7')),'mailMessage':require(_0x878d('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x878d('0x9'))};function createMessage(_0x5bd5ef,_0x2af687,_0x481890,_0x2a9ef0){return new Promise(function(_0x2a71f7,_0x1ce8ef){var _0x477361=_['clone'](_0x481890);_0x477361['body']=_0x2a9ef0;return rpc[_0x2af687+_0x878d('0xa')][_0x878d('0xb')](_0x477361)[_0x878d('0xc')](function(){logger[_0x878d('0xd')](_0x878d('0xe'),_0x5bd5ef,_0x477361[_0x878d('0xf')]);_0x2a71f7();})[_0x878d('0x10')](function(_0x171e63){logger['error'](_0x878d('0xe'),_0x5bd5ef,JSON['stringify'](_0x171e63));_0x1ce8ef(_0x171e63);});});}exports[_0x878d('0x11')]=function(_0x36a15f,_0x21af71){return function(_0x1bdf55){try{if(!_['isNil'](this[_0x878d('0x12')]['UserId'])){logger['info'](_0x878d('0xe'),_0x36a15f,_0x878d('0x13'));return _0x1bdf55[_0x878d('0x14')]();}var _0x480554={'ContactId':this[_0x878d('0x15')]['id'],'sentAt':moment()['format'](_0x878d('0x16')),'direction':_0x878d('0x17')};if(this['channel']===_0x878d('0x18')||this[_0x878d('0x19')]===_0x878d('0x1a')){_0x480554['phone']=this[_0x878d('0x12')][_0x878d('0x1b')];}var _0x26d59b=this[_0x878d('0x19')];if(_0x26d59b===_0x878d('0x1c')){_0x480554['ChatWebsiteId']=this[_0x878d('0x1d')]['id'];}else{_0x480554[_[_0x878d('0x1e')](_0x26d59b)+_0x878d('0x1f')]=this[_0x878d('0x1d')]['id'];}_0x480554[_['upperFirst'](_0x26d59b)+_0x878d('0x20')]=this['interaction']['id'];if(this[_0x878d('0x12')][_0x878d('0x21')]){var _0x3931e1=_0x21af71[0x4];if(!_[_0x878d('0x22')](_0x3931e1)){_0x480554[_0x878d('0xf')]=utils[_0x878d('0x23')](_0x3931e1,this);return rpc[_0x26d59b+'Message'][_0x878d('0xb')](_0x480554)[_0x878d('0xc')](function(_0x188156){logger['info'](_0x878d('0xe'),_0x36a15f,_0x480554[_0x878d('0xf')]);})[_0x878d('0x10')](function(_0x4acd3e){logger['error'](_0x878d('0xe'),_0x36a15f,JSON[_0x878d('0x24')](_0x4acd3e));})[_0x878d('0x25')](function(){logger[_0x878d('0xd')](_0x878d('0x26'),_0x36a15f);_0x1bdf55[_0x878d('0x27')]();});}else{logger[_0x878d('0xd')](_0x878d('0x28'),_0x36a15f);_0x1bdf55[_0x878d('0x27')]();}}else{var _0x5a3d0e=this;var _0xda02d1=_0x21af71[0x2][_0x878d('0x29')](/\\n/g,'\x0a');var _0x2d942f={'credentials':{'private_key':_0xda02d1,'client_email':_0x21af71[0x1]}};var _0x2eaa80=new dialogflow[(_0x878d('0x2a'))](_0x2d942f);var _0x4f6cde=_0x2eaa80[_0x878d('0x2b')](_0x21af71[0x0],md5(_0x5a3d0e['interaction']['id']));var _0x2d6572={'session':_0x4f6cde,'queryInput':{'text':{'text':_0x5a3d0e['message'][_0x878d('0xf')],'languageCode':_0x21af71[0x3]||'en'}}};return _0x2eaa80[_0x878d('0x2c')](_0x2d6572)[_0x878d('0xc')](function(_0x2bc7a7){if(_0x2bc7a7&&_0x2bc7a7['length']){_0x5a3d0e[_0x878d('0xf')][_0x878d('0x2d')]=_0x2bc7a7;var _0x22a0a4=_0x2bc7a7[0x0];var _0x47da3c=_0x22a0a4[_0x878d('0x2e')][_0x878d('0x2f')]&&_0x22a0a4[_0x878d('0x2e')][_0x878d('0x2f')]['fields']?_0x22a0a4[_0x878d('0x2e')][_0x878d('0x2f')][_0x878d('0x30')]['end_conversation'][_0x878d('0x31')]:![];_0x5a3d0e['body'][_0x878d('0x32')]=_0x22a0a4[_0x878d('0x2e')][_0x878d('0x33')];_0x5a3d0e[_0x878d('0xf')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x22a0a4['queryResult'][_0x878d('0x34')];_0x5a3d0e[_0x878d('0xf')][_0x878d('0x35')]=_0x22a0a4[_0x878d('0x2e')][_0x878d('0x2f')]&&_0x22a0a4[_0x878d('0x2e')]['diagnosticInfo']['fields']?_0x22a0a4['queryResult'][_0x878d('0x2f')][_0x878d('0x30')]['end_conversation'][_0x878d('0x31')]:![];_0x5a3d0e[_0x878d('0xf')]['DIALOGFLOWV2_INTENTNAME']=_0x22a0a4['queryResult'][_0x878d('0x36')][_0x878d('0x37')];_0x5a3d0e[_0x878d('0xf')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x22a0a4[_0x878d('0x2e')]['intent'][_0x878d('0x38')];_0x5a3d0e[_0x878d('0xf')][_0x878d('0x39')]=_0x22a0a4[_0x878d('0x2e')][_0x878d('0x36')][_0x878d('0x3a')];_0x5a3d0e[_0x878d('0xf')][_0x878d('0x3b')]=_0x22a0a4[_0x878d('0x2e')]['languageCode'];_0x5a3d0e[_0x878d('0xf')][_0x878d('0x3c')]=_0x22a0a4['queryResult'][_0x878d('0x3d')];_0x5a3d0e[_0x878d('0xf')]['DIALOGFLOWV2_SCORE']=_0x22a0a4['queryResult'][_0x878d('0x3e')];_0x480554[_0x878d('0x3f')]=_0x878d('0x2d');_0x480554[_0x878d('0x40')]=JSON[_0x878d('0x24')](_0x2bc7a7);var _0x10de20=[];for(var _0x39bcae=0x0;_0x39bcae<_0x2bc7a7[_0x878d('0x41')];_0x39bcae++){var _0x37d23e=_0x2bc7a7[_0x39bcae];if(_0x37d23e&&_0x37d23e['queryResult']&&_0x37d23e[_0x878d('0x2e')][_0x878d('0x42')]){_0x10de20[_0x878d('0x43')](createMessage(_0x36a15f,_0x26d59b,_0x480554,_0x37d23e['queryResult']['fulfillmentText']));}}return Promise['all'](_0x10de20)['then'](function(){if(_0x47da3c){_0x1bdf55['next']();}else{_0x1bdf55[_0x878d('0x27')]();}})[_0x878d('0x10')](function(_0x1bd5f5){logger['error'](_0x878d('0xe'),_0x36a15f,JSON[_0x878d('0x24')](_0x1bd5f5));_0x1bdf55[_0x878d('0x14')]();});}})['catch'](function(_0x7f1a2f){logger[_0x878d('0x44')](_0x878d('0xe'),_0x36a15f,_0x7f1a2f['message']);_0x1bdf55[_0x878d('0x14')]();});}}catch(_0x770542){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x36a15f,JSON[_0x878d('0x24')](_0x770542));_0x1bdf55[_0x878d('0x27')]();}};}; \ 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 82791ff..d54a942 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 _0x30e0=['findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','stringify','validate','lodash','./utils','../../../../config/logger','string','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next'];(function(_0x3ebb04,_0x1a63a6){var _0x535db0=function(_0x651fb4){while(--_0x651fb4){_0x3ebb04['push'](_0x3ebb04['shift']());}};_0x535db0(++_0x1a63a6);}(_0x30e0,0x115));var _0x030e=function(_0x212b03,_0x1f1b50){_0x212b03=_0x212b03-0x0;var _0x423115=_0x30e0[_0x212b03];return _0x423115;};'use strict';var schema=require(_0x030e('0x0'));var _=require(_0x030e('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x030e('0x2'));var logger=require(_0x030e('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x030e('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x030e('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0x030e('0x6')}});exports[_0x030e('0x7')]=function(_0x3c7026,_0x62ef97){return function(_0x2bb56e){try{var _0x39d7b2={'condition':htmlToText[_0x030e('0x8')](utils[_0x030e('0x9')](_0x62ef97[0x0],this),{'wordwrap':![]})[_0x030e('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x62ef97[0x1],'priorityFalse':_0x62ef97[0x2]};var _0x154bee=gotoif['validate'](_0x39d7b2,{'typecast':!![]});if(_0x154bee[_0x030e('0xb')]){logger[_0x030e('0xc')](_0x030e('0xd'),_0x3c7026,_[_0x030e('0xe')](_0x154bee,_0x030e('0xf'))[_0x030e('0x10')](',\x20'));_0x2bb56e['stop']();}else{try{var _0x5514b7=eval('('+_0x39d7b2['condition']+')');var _0x4855bf=_0x5514b7?_0x39d7b2[_0x030e('0x11')]:_0x39d7b2[_0x030e('0x12')];logger[_0x030e('0x13')](_0x030e('0x14'),_0x3c7026,_0x39d7b2[_0x030e('0x15')],_0x5514b7,_0x4855bf||_0x030e('0x16'));if(_0x4855bf){var _0x66c264=_[_0x030e('0x17')](_0x2bb56e[_0x030e('0x18')](),{'p':_0x4855bf});if(_0x66c264>=0x0){logger['info'](_0x030e('0x19'),_0x3c7026,_0x4855bf||'next',_0x66c264);_0x2bb56e[_0x030e('0x16')](_0x66c264);}else{logger['info'](_0x030e('0x1a'),_0x3c7026,_0x4855bf||_0x030e('0x16'));_0x2bb56e['stop']();}}else{_0x2bb56e[_0x030e('0x16')]();}}catch(_0xa8f7a3){logger[_0x030e('0xc')](_0x030e('0x1b'),_0x3c7026,_0xa8f7a3[_0x030e('0xf')]);_0x2bb56e[_0x030e('0x1c')]();}}}catch(_0x5e8742){logger['error'](_0x030e('0xd'),_0x3c7026,JSON[_0x030e('0x1d')](_0x5e8742));_0x2bb56e[_0x030e('0x1c')]();}};}; \ No newline at end of file +var _0x2cbc=['error','stringify','validate','lodash','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x17cb3a,_0x377c52){var _0x42369b=function(_0x2eb01a){while(--_0x2eb01a){_0x17cb3a['push'](_0x17cb3a['shift']());}};_0x42369b(++_0x377c52);}(_0x2cbc,0xe8));var _0xc2cb=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x2cbc[_0x34933a];return _0x36abb4;};'use strict';var schema=require(_0xc2cb('0x0'));var _=require(_0xc2cb('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xc2cb('0x2'));var gotoif=schema({'condition':{'type':_0xc2cb('0x3'),'required':!![],'message':_0xc2cb('0x4')},'priorityTrue':{'type':_0xc2cb('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xc2cb('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc2cb('0x6')]=function(_0x4c481f,_0x46990f){return function(_0x1885f0){try{var _0x5f39e6={'condition':htmlToText[_0xc2cb('0x7')](utils['getMustacheRender'](_0x46990f[0x0],this),{'wordwrap':![]})[_0xc2cb('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x46990f[0x1],'priorityFalse':_0x46990f[0x2]};var _0x42b336=gotoif[_0xc2cb('0x0')](_0x5f39e6,{'typecast':!![]});if(_0x42b336[_0xc2cb('0x9')]){logger['error'](_0xc2cb('0xa'),_0x4c481f,_['map'](_0x42b336,'message')[_0xc2cb('0xb')](',\x20'));_0x1885f0[_0xc2cb('0xc')]();}else{try{var _0x1ae767=eval('('+_0x5f39e6[_0xc2cb('0xd')]+')');var _0x257317=_0x1ae767?_0x5f39e6['priorityTrue']:_0x5f39e6[_0xc2cb('0xe')];logger[_0xc2cb('0xf')](_0xc2cb('0x10'),_0x4c481f,_0x5f39e6[_0xc2cb('0xd')],_0x1ae767,_0x257317||_0xc2cb('0x11'));if(_0x257317){var _0x2e4923=_[_0xc2cb('0x12')](_0x1885f0[_0xc2cb('0x13')](),{'p':_0x257317});if(_0x2e4923>=0x0){logger[_0xc2cb('0xf')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4c481f,_0x257317||_0xc2cb('0x11'),_0x2e4923);_0x1885f0['next'](_0x2e4923);}else{logger[_0xc2cb('0xf')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4c481f,_0x257317||_0xc2cb('0x11'));_0x1885f0['stop']();}}else{_0x1885f0[_0xc2cb('0x11')]();}}catch(_0x4f1854){logger['error'](_0xc2cb('0x14'),_0x4c481f,_0x4f1854['message']);_0x1885f0[_0xc2cb('0xc')]();}}}catch(_0x3e9702){logger[_0xc2cb('0x15')](_0xc2cb('0xa'),_0x4c481f,JSON[_0xc2cb('0x16')](_0x3e9702));_0x1885f0['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 328187f..9ea4b1f 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 _0x7b8f=['error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x5c1723,_0x513d5f){var _0x38c6c0=function(_0x5b7187){while(--_0x5b7187){_0x5c1723['push'](_0x5c1723['shift']());}};_0x38c6c0(++_0x513d5f);}(_0x7b8f,0xc7));var _0xf7b8=function(_0x475263,_0x352104){_0x475263=_0x475263-0x0;var _0x32ff14=_0x7b8f[_0x475263];return _0x32ff14;};'use strict';var schema=require(_0xf7b8('0x0'));var _=require(_0xf7b8('0x1'));var logger=require(_0xf7b8('0x2'))(_0xf7b8('0x3'));var gotop=schema({'priority':{'type':_0xf7b8('0x4'),'required':!![],'message':_0xf7b8('0x5')}});exports[_0xf7b8('0x6')]=function(_0x1ae585,_0x5a2aa3){return function(_0x5ebb19){try{var _0x49ac69={'priority':_0x5a2aa3[0x0]};var _0x499dbc=gotop[_0xf7b8('0x0')](_0x49ac69,{'typecast':!![]});if(_0x499dbc[_0xf7b8('0x7')]){logger[_0xf7b8('0x8')](_0xf7b8('0x9'),_0x1ae585,_[_0xf7b8('0xa')](_0x499dbc,_0xf7b8('0xb'))[_0xf7b8('0xc')](',\x20'));_0x5ebb19[_0xf7b8('0xd')]();}else{logger[_0xf7b8('0xe')](_0xf7b8('0xf'),_0x1ae585,_0x49ac69['priority']);if(_0x49ac69[_0xf7b8('0x10')]){var _0x4c5227=_[_0xf7b8('0x11')](_0x5ebb19[_0xf7b8('0x12')](),{'p':_0x49ac69[_0xf7b8('0x10')]});if(_0x4c5227>=0x0){logger[_0xf7b8('0xe')](_0xf7b8('0x13'),_0x1ae585,_0x49ac69[_0xf7b8('0x10')]||_0xf7b8('0x14'),_0x4c5227);_0x5ebb19[_0xf7b8('0x14')](_0x4c5227);}else{logger[_0xf7b8('0xe')](_0xf7b8('0x15'),_0x1ae585,_0x49ac69[_0xf7b8('0x10')]||_0xf7b8('0x14'));_0x5ebb19[_0xf7b8('0xd')]();}}else{_0x5ebb19[_0xf7b8('0x14')]();}}}catch(_0x4117e4){logger[_0xf7b8('0x8')](_0xf7b8('0x9'),_0x1ae585,JSON[_0xf7b8('0x16')](_0x4117e4));_0x5ebb19[_0xf7b8('0xd')]();}};}; \ No newline at end of file +var _0x640d=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x3ee65e,_0x3f1a22){var _0x1ba256=function(_0x53a08f){while(--_0x53a08f){_0x3ee65e['push'](_0x3ee65e['shift']());}};_0x1ba256(++_0x3f1a22);}(_0x640d,0x1b9));var _0xd640=function(_0xf51142,_0xce6d4a){_0xf51142=_0xf51142-0x0;var _0x32ec62=_0x640d[_0xf51142];return _0x32ec62;};'use strict';var schema=require(_0xd640('0x0'));var _=require(_0xd640('0x1'));var logger=require(_0xd640('0x2'))(_0xd640('0x3'));var gotop=schema({'priority':{'type':_0xd640('0x4'),'required':!![],'message':_0xd640('0x5')}});exports[_0xd640('0x6')]=function(_0x17cc1e,_0x162d33){return function(_0x245d36){try{var _0x1d0908={'priority':_0x162d33[0x0]};var _0x444bac=gotop[_0xd640('0x0')](_0x1d0908,{'typecast':!![]});if(_0x444bac[_0xd640('0x7')]){logger[_0xd640('0x8')](_0xd640('0x9'),_0x17cc1e,_[_0xd640('0xa')](_0x444bac,'message')[_0xd640('0xb')](',\x20'));_0x245d36[_0xd640('0xc')]();}else{logger[_0xd640('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x17cc1e,_0x1d0908[_0xd640('0xe')]);if(_0x1d0908[_0xd640('0xe')]){var _0x157773=_[_0xd640('0xf')](_0x245d36[_0xd640('0x10')](),{'p':_0x1d0908['priority']});if(_0x157773>=0x0){logger['info'](_0xd640('0x11'),_0x17cc1e,_0x1d0908[_0xd640('0xe')]||_0xd640('0x12'),_0x157773);_0x245d36[_0xd640('0x12')](_0x157773);}else{logger[_0xd640('0xd')](_0xd640('0x13'),_0x17cc1e,_0x1d0908[_0xd640('0xe')]||_0xd640('0x12'));_0x245d36[_0xd640('0xc')]();}}else{_0x245d36[_0xd640('0x12')]();}}}catch(_0x259b6f){logger[_0xd640('0x8')](_0xd640('0x9'),_0x17cc1e,JSON['stringify'](_0x259b6f));_0x245d36[_0xd640('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 43691bc..1f6ebde 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 _0x1128=['stringify','stop','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next'];(function(_0x3e849b,_0xded180){var _0x498f38=function(_0x1f0afd){while(--_0x1f0afd){_0x3e849b['push'](_0x3e849b['shift']());}};_0x498f38(++_0xded180);}(_0x1128,0x189));var _0x8112=function(_0xc50ae6,_0x24c785){_0xc50ae6=_0xc50ae6-0x0;var _0x5f0312=_0x1128[_0xc50ae6];return _0x5f0312;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x8112('0x0'))('routing');var rpc={'chatMessage':require(_0x8112('0x1')),'openchannelMessage':require(_0x8112('0x2')),'mailMessage':require(_0x8112('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8112('0x4')),'whatsappMessage':require(_0x8112('0x5'))};exports['consequence']=function(_0x1861fa,_0x5e8718){return function(_0xe9301b){try{var _0x339cd2={'body':utils[_0x8112('0x6')](_0x5e8718[0x0],this),'ContactId':this[_0x8112('0x7')]['id']};if(this[_0x8112('0x8')]===_0x8112('0x9')){_0x339cd2[_0x8112('0xa')]=this[_0x8112('0xb')]['id'];}else{_0x339cd2[_[_0x8112('0xc')](this['channel'])+_0x8112('0xd')]=this[_0x8112('0xb')]['id'];}_0x339cd2[_[_0x8112('0xc')](this[_0x8112('0x8')])+_0x8112('0xe')]=this['interaction']['id'];if(rpc[this['channel']+_0x8112('0xf')]){return rpc[this[_0x8112('0x8')]+_0x8112('0xf')][_0x8112('0x10')](_0x339cd2)[_0x8112('0x11')](function(_0x4241de){logger['info'](_0x8112('0x12'),_0x1861fa,_0x339cd2[_0x8112('0x13')]);_0xe9301b[_0x8112('0x14')]();})['catch'](function(_0x15bafb){logger['error'](_0x8112('0x12'),_0x1861fa,JSON[_0x8112('0x15')](_0x15bafb));_0xe9301b[_0x8112('0x16')]();});}}catch(_0x23fb96){logger['error'](_0x8112('0x12'),_0x1861fa,JSON[_0x8112('0x15')](_0x23fb96));_0xe9301b[_0x8112('0x16')]();}};}; \ No newline at end of file +var _0xdc93=['body','next','catch','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','account','upperFirst','AccountId','channel','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xdc93,0x6e));var _0x3dc9=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xdc93[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0x3dc9('0x0'));var utils=require(_0x3dc9('0x1'));var logger=require(_0x3dc9('0x2'))(_0x3dc9('0x3'));var rpc={'chatMessage':require(_0x3dc9('0x4')),'openchannelMessage':require(_0x3dc9('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3dc9('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3dc9('0x7'))};exports[_0x3dc9('0x8')]=function(_0x42729b,_0x3e4e8a){return function(_0x2e17a3){try{var _0x58b3bc={'body':utils[_0x3dc9('0x9')](_0x3e4e8a[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x58b3bc['ChatWebsiteId']=this[_0x3dc9('0xa')]['id'];}else{_0x58b3bc[_[_0x3dc9('0xb')](this['channel'])+_0x3dc9('0xc')]=this[_0x3dc9('0xa')]['id'];}_0x58b3bc[_['upperFirst'](this[_0x3dc9('0xd')])+_0x3dc9('0xe')]=this[_0x3dc9('0xf')]['id'];if(rpc[this[_0x3dc9('0xd')]+_0x3dc9('0x10')]){return rpc[this[_0x3dc9('0xd')]+_0x3dc9('0x10')]['create'](_0x58b3bc)[_0x3dc9('0x11')](function(_0x4674e0){logger[_0x3dc9('0x12')](_0x3dc9('0x13'),_0x42729b,_0x58b3bc[_0x3dc9('0x14')]);_0x2e17a3[_0x3dc9('0x15')]();})[_0x3dc9('0x16')](function(_0x287faf){logger[_0x3dc9('0x17')](_0x3dc9('0x13'),_0x42729b,JSON['stringify'](_0x287faf));_0x2e17a3[_0x3dc9('0x18')]();});}}catch(_0x311173){logger['error'](_0x3dc9('0x13'),_0x42729b,JSON[_0x3dc9('0x19')](_0x311173));_0x2e17a3[_0x3dc9('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 3353c07..c0dee32 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 _0xada5=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xada5,0x1ed));var _0x5ada=function(_0x8db571,_0x35c59c){_0x8db571=_0x8db571-0x0;var _0x1747eb=_0xada5[_0x8db571];return _0x1747eb;};'use strict';var utils=require(_0x5ada('0x0'));var logger=require(_0x5ada('0x1'))('routing');exports[_0x5ada('0x2')]=function(_0x370bc8,_0x5402a8){return function(_0x53b5c2){try{logger[_0x5ada('0x3')](_0x5ada('0x4'),_0x370bc8,utils[_0x5ada('0x5')](_0x5402a8[0x0],this));_0x53b5c2['next']();}catch(_0x1bc81b){logger[_0x5ada('0x6')](_0x5ada('0x4'),_0x370bc8,JSON[_0x5ada('0x7')](_0x1bc81b));_0x53b5c2[_0x5ada('0x8')]();}};}; \ No newline at end of file +var _0x1ec0=['[%s][NOOP]\x20%s','error','stringify','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x424a41,_0x24034e){var _0x5ab2cf=function(_0x51bb43){while(--_0x51bb43){_0x424a41['push'](_0x424a41['shift']());}};_0x5ab2cf(++_0x24034e);}(_0x1ec0,0x17b));var _0x01ec=function(_0x4fb930,_0x4141c4){_0x4fb930=_0x4fb930-0x0;var _0x59adc4=_0x1ec0[_0x4fb930];return _0x59adc4;};'use strict';var utils=require(_0x01ec('0x0'));var logger=require(_0x01ec('0x1'))(_0x01ec('0x2'));exports[_0x01ec('0x3')]=function(_0x1b2e13,_0x3d207e){return function(_0x3b5ba7){try{logger[_0x01ec('0x4')](_0x01ec('0x5'),_0x1b2e13,utils['getMustacheRender'](_0x3d207e[0x0],this));_0x3b5ba7['next']();}catch(_0x5d5820){logger[_0x01ec('0x6')](_0x01ec('0x5'),_0x1b2e13,JSON[_0x01ec('0x7')](_0x5d5820));_0x3b5ba7['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 3e4a31d..5671ccd 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 _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x3e74,0x175));var _0x43e7=function(_0x50cefe,_0x13b0ce){_0x50cefe=_0x50cefe-0x0;var _0x3be4e9=_0x3e74[_0x50cefe];return _0x3be4e9;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x299304,_0x368ad5){var _0xe33445=function(_0x5989e4){while(--_0x5989e4){_0x299304['push'](_0x299304['shift']());}};_0xe33445(++_0x368ad5);}(_0x008c,0x188));var _0xc008=function(_0x4f89ff,_0x5e466b){_0x4f89ff=_0x4f89ff-0x0;var _0x42f34c=_0x008c[_0x4f89ff];return _0x42f34c;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ 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 cfaa55f..d6e82cb 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 _0xc130=['busy','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','realtime','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busyQueue','showNotification','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification'];(function(_0xd8ab2,_0x4b1e8){var _0xbdcf17=function(_0x239129){while(--_0x239129){_0xd8ab2['push'](_0xd8ab2['shift']());}};_0xbdcf17(++_0x4b1e8);}(_0xc130,0x115));var _0x0c13=function(_0x3e4db9,_0xb285fa){_0x3e4db9=_0x3e4db9-0x0;var _0x241419=_0xc130[_0x3e4db9];return _0x241419;};'use strict';var _=require(_0x0c13('0x0'));var uuid=require(_0x0c13('0x1'));var util=require(_0x0c13('0x2'));var logger=require(_0x0c13('0x3'))(_0x0c13('0x4'));var Agent=function(_0x21b639,_0x4940f9,_0x3b6e8d,_0x395935){this['notificationId']=uuid['v4']();this[_0x0c13('0x5')]=_0x21b639;this[_0x0c13('0x6')]=_0x4940f9;this['realtime']=_0x3b6e8d;this['routing']=_0x395935;this[_0x0c13('0x5')][_0x0c13('0x7')](this[_0x0c13('0x8')]['bind'](this),this[_0x0c13('0x9')][_0x0c13('0xa')](this));this['squeue']['on'](_0x0c13('0xb'),this[_0x0c13('0x9')][_0x0c13('0xa')](this));this['squeue']['on'](_0x0c13('0xc'),this[_0x0c13('0xd')][_0x0c13('0xa')](this));};Agent[_0x0c13('0xe')]['push']=function(){this[_0x0c13('0x5')][_0x0c13('0x7')](this['handleRun'][_0x0c13('0xa')](this),this[_0x0c13('0x9')][_0x0c13('0xa')](this));};Agent['prototype'][_0x0c13('0xd')]=function(){this[_0x0c13('0x9')](!![]);};Agent['prototype'][_0x0c13('0x8')]=function(_0x571027){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x0c13('0x6')]['id']);if(_[_0x0c13('0xf')](this[_0x0c13('0x10')]['agents'][this[_0x0c13('0x6')]['id']])){logger[_0x0c13('0x11')](_0x0c13('0x12'),this[_0x0c13('0x5')]['id'],this[_0x0c13('0x6')]['id']);setTimeout(this[_0x0c13('0x7')][_0x0c13('0xa')](this),0x3e8);}else{if(this[_0x0c13('0x4')][_0x0c13('0x13')]||util[_0x0c13('0x14')](this[_0x0c13('0x5')]['id'],this['realtime'][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']],this[_0x0c13('0x5')]['channel'],![])){this[_0x0c13('0x10')][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']]['busy']=!![];this[_0x0c13('0x10')][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']][_0x0c13('0x16')]=undefined;util[_0x0c13('0x17')](this[_0x0c13('0x18')],this[_0x0c13('0x5')]['id'],this[_0x0c13('0x10')][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']],null,this[_0x0c13('0x4')]);util['writeLog'](this[_0x0c13('0x5')]['id'],this[_0x0c13('0x10')]['agents'][this[_0x0c13('0x6')]['id']],_0x0c13('0x19')+(this[_0x0c13('0x4')]['forcedOwnership']?_0x0c13('0x1a'):''));}else{logger[_0x0c13('0x11')](_0x0c13('0x1b'),this[_0x0c13('0x5')]['id'],this[_0x0c13('0x6')]['id']);setTimeout(this[_0x0c13('0x7')][_0x0c13('0xa')](this),0x3e8);}}};Agent[_0x0c13('0xe')][_0x0c13('0x9')]=function(_0x4008c2){if(_[_0x0c13('0xf')](this['realtime']['agents'][this['agent']['id']])){return logger[_0x0c13('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x0c13('0x5')]['id'],this[_0x0c13('0x6')]['id']);}else{logger[_0x0c13('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x0c13('0x5')]['id'],this['agent']['id']);util[_0x0c13('0x1c')](this[_0x0c13('0x18')],this[_0x0c13('0x5')]['id'],this[_0x0c13('0x10')][_0x0c13('0x15')][this['agent']['id']],null,this['routing']);this[_0x0c13('0x10')][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']][_0x0c13('0x1d')]=![];this['realtime'][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']][_0x0c13('0x16')]=undefined;util[_0x0c13('0x1e')](this[_0x0c13('0x5')]['id'],this[_0x0c13('0x10')][_0x0c13('0x15')][this[_0x0c13('0x6')]['id']],_0x4008c2?_0x0c13('0x1f'):_0x0c13('0x20'));}if(!_0x4008c2){setTimeout(this['push'][_0x0c13('0xa')](this),0x3e8);}};function agent(_0x3df1bc,_0x47c848,_0x339ee6,_0x2ca4ca){return new Agent(_0x3df1bc,_0x47c848,_0x339ee6,_0x2ca4ca);}module[_0x0c13('0x21')]=agent; \ No newline at end of file +var _0xfacc=['TIMEOUT','exports','./util','../../../../../config/logger','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x1d363c,_0x5bca40){var _0x346c50=function(_0x761759){while(--_0x761759){_0x1d363c['push'](_0x1d363c['shift']());}};_0x346c50(++_0x5bca40);}(_0xfacc,0x8a));var _0xcfac=function(_0x71fdbc,_0xc528f2){_0x71fdbc=_0x71fdbc-0x0;var _0x5ec9f8=_0xfacc[_0x71fdbc];return _0x5ec9f8;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xcfac('0x0'));var logger=require(_0xcfac('0x1'))('routing');var Agent=function(_0xc7f743,_0x28cf9d,_0x13efd8,_0xfc8385){this['notificationId']=uuid['v4']();this[_0xcfac('0x2')]=_0xc7f743;this[_0xcfac('0x3')]=_0x28cf9d;this[_0xcfac('0x4')]=_0x13efd8;this['routing']=_0xfc8385;this['squeue'][_0xcfac('0x5')](this['handleRun'][_0xcfac('0x6')](this),this[_0xcfac('0x7')][_0xcfac('0x6')](this));this[_0xcfac('0x2')]['on'](_0xcfac('0x8'),this['handleTimeout']['bind'](this));this[_0xcfac('0x2')]['on'](_0xcfac('0x9'),this[_0xcfac('0xa')][_0xcfac('0x6')](this));};Agent[_0xcfac('0xb')][_0xcfac('0x5')]=function(){this[_0xcfac('0x2')][_0xcfac('0x5')](this[_0xcfac('0xc')][_0xcfac('0x6')](this),this[_0xcfac('0x7')][_0xcfac('0x6')](this));};Agent['prototype'][_0xcfac('0xa')]=function(){this[_0xcfac('0x7')](!![]);};Agent['prototype'][_0xcfac('0xc')]=function(_0x2c8308){logger[_0xcfac('0xd')](_0xcfac('0xe'),this['squeue']['id'],this[_0xcfac('0x3')]['id']);if(_[_0xcfac('0xf')](this[_0xcfac('0x4')][_0xcfac('0x10')][this['agent']['id']])){logger[_0xcfac('0xd')](_0xcfac('0x11'),this['squeue']['id'],this[_0xcfac('0x3')]['id']);setTimeout(this[_0xcfac('0x5')][_0xcfac('0x6')](this),0x3e8);}else{if(this[_0xcfac('0x12')][_0xcfac('0x13')]||util[_0xcfac('0x14')](this[_0xcfac('0x2')]['id'],this[_0xcfac('0x4')][_0xcfac('0x10')][this['agent']['id']],this[_0xcfac('0x2')][_0xcfac('0x15')],![])){this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']][_0xcfac('0x16')]=!![];this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']][_0xcfac('0x17')]=undefined;util[_0xcfac('0x18')](this[_0xcfac('0x19')],this['squeue']['id'],this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']],null,this[_0xcfac('0x12')]);util[_0xcfac('0x1a')](this[_0xcfac('0x2')]['id'],this['realtime'][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']],_0xcfac('0x1b')+(this[_0xcfac('0x12')][_0xcfac('0x13')]?_0xcfac('0x1c'):''));}else{logger['info'](_0xcfac('0x1d'),this[_0xcfac('0x2')]['id'],this[_0xcfac('0x3')]['id']);setTimeout(this[_0xcfac('0x5')][_0xcfac('0x6')](this),0x3e8);}}};Agent[_0xcfac('0xb')][_0xcfac('0x7')]=function(_0x565a6c){if(_['isNil'](this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']])){return logger['info'](_0xcfac('0x11'),this[_0xcfac('0x2')]['id'],this['agent']['id']);}else{logger[_0xcfac('0xd')](_0xcfac('0x1e'),this[_0xcfac('0x2')]['id'],this['agent']['id']);util[_0xcfac('0x1f')](this['notificationId'],this[_0xcfac('0x2')]['id'],this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']],null,this[_0xcfac('0x12')]);this[_0xcfac('0x4')]['agents'][this['agent']['id']][_0xcfac('0x16')]=![];this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']][_0xcfac('0x17')]=undefined;util[_0xcfac('0x1a')](this[_0xcfac('0x2')]['id'],this[_0xcfac('0x4')][_0xcfac('0x10')][this[_0xcfac('0x3')]['id']],_0x565a6c?'STOP':_0xcfac('0x20'));}if(!_0x565a6c){setTimeout(this[_0xcfac('0x5')]['bind'](this),0x3e8);}};function agent(_0x4d0e29,_0x44bd0c,_0x302562,_0x580e51){return new Agent(_0x4d0e29,_0x44bd0c,_0x302562,_0x580e51);}module[_0xcfac('0x21')]=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 7561c2c..599f5a8 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 _0x8e9a=['../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','drained','prototype','push','handleDrained','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','busyQueue','uuid','./util'];(function(_0x4e4c6b,_0x2502f5){var _0x5e05c2=function(_0x1d096){while(--_0x1d096){_0x4e4c6b['push'](_0x4e4c6b['shift']());}};_0x5e05c2(++_0x2502f5);}(_0x8e9a,0xf6));var _0xa8e9=function(_0x4684a7,_0x268d4d){_0x4684a7=_0x4684a7-0x0;var _0x182034=_0x8e9a[_0x4684a7];return _0x182034;};'use strict';var _=require('lodash');var uuid=require(_0xa8e9('0x0'));var util=require(_0xa8e9('0x1'));var logger=require(_0xa8e9('0x2'))(_0xa8e9('0x3'));var Beepall=function(_0x4f1264,_0x5ce7bb,_0x33c47f,_0x190afe){this[_0xa8e9('0x4')]=uuid['v4']();this[_0xa8e9('0x5')]=_0x4f1264;this[_0xa8e9('0x6')]=_0x5ce7bb;this[_0xa8e9('0x7')]=_0x33c47f;this[_0xa8e9('0x3')]=_0x190afe;this[_0xa8e9('0x5')]['push'](this[_0xa8e9('0x8')][_0xa8e9('0x9')](this),this[_0xa8e9('0xa')][_0xa8e9('0x9')](this));this[_0xa8e9('0x5')]['on']('timeout',this[_0xa8e9('0xa')][_0xa8e9('0x9')](this));this[_0xa8e9('0x5')]['on'](_0xa8e9('0xb'),this['handleDrained']['bind'](this));};Beepall[_0xa8e9('0xc')][_0xa8e9('0xd')]=function(){this[_0xa8e9('0x5')]['push'](this[_0xa8e9('0x8')][_0xa8e9('0x9')](this),this[_0xa8e9('0xa')][_0xa8e9('0x9')](this));};Beepall[_0xa8e9('0xc')][_0xa8e9('0xe')]=function(_0x27d409){this[_0xa8e9('0xa')](!![]);};Beepall[_0xa8e9('0xc')][_0xa8e9('0x8')]=function(_0x4ea7a8){var _0x4734e9=!![];if(!_['isNil'](this[_0xa8e9('0x6')])&&!_[_0xa8e9('0xf')](this[_0xa8e9('0x6')][_0xa8e9('0x10')])&&this[_0xa8e9('0x6')][_0xa8e9('0x10')][_0xa8e9('0x11')]>0x0){for(var _0x4a82d7=0x0,_0x2f9bd1;_0x4a82d70x0){for(var _0x4b2875=0x0,_0x163a12;_0x4b28750x0&&_0x5b336e[_0x189989+_0x9a69('0x25')]>=_0x5b336e[_0x189989+_0x9a69('0x24')]){writeLog(_0x4b9b28,_0x5b336e,_0x189989[_0x9a69('0x26')]()+_0x9a69('0x27'));return![];}}return!![];};exports[_0x9a69('0x28')]=function(_0x1e8334,_0x447f0f,_0xbdd2c0,_0x36af38,_0x47916a){return sendNotification(!![],_0x1e8334,_0x447f0f,_0xbdd2c0,_0x36af38,_0x47916a);};exports[_0x9a69('0x29')]=function(_0x165a87,_0x5433b3,_0x54e643,_0x4b3539,_0x1f976b){return sendNotification(![],_0x165a87,_0x5433b3,_0x54e643,_0x4b3539,_0x1f976b);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x6305=['hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','emit','format','user:%s','user:save','split','\x20interaction','name','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE'];(function(_0x4a42dd,_0x4dca7c){var _0x3169ae=function(_0x317d8f){while(--_0x317d8f){_0x4a42dd['push'](_0x4a42dd['shift']());}};_0x3169ae(++_0x4dca7c);}(_0x6305,0x1ab));var _0x5630=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x6305[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x5630('0x0'));var utils=require('../utils');var Mustache=require(_0x5630('0x1'));var Redis=require(_0x5630('0x2'));var config=require(_0x5630('0x3'));var logger=require(_0x5630('0x4'))(_0x5630('0x5'));config['redis']=_[_0x5630('0x6')](config[_0x5630('0x7')],{'host':_0x5630('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x76ef62,_0x287406,_0x32de50){io['to'](_0x76ef62)[_0x5630('0x9')](_0x287406,_0x32de50);}function sendNotification(_0x15c9de,_0x3ac92a,_0x192a87,_0x3a96cd,_0x827e37,_0x42e81f){io['to'](util[_0x5630('0xa')](_0x5630('0xb'),_0x3a96cd['name']))[_0x5630('0x9')](_0x5630('0xc'),_0x3a96cd);var _0x3ba104=_0x42e81f||{};var _0x396771=_0x192a87[_0x5630('0xd')]('.');var _0x5758f1={'uniqueid':_0x3ac92a,'channel':_0x396771[0x0],'id':_0x396771[0x1],'title':_0x396771[0x0]+_0x5630('0xe'),'interactionId':_0x396771[0x2],'queue':_0x827e37?_0x827e37[_0x5630('0xf')]:null,'sound':_0x3ba104['account'][_0x5630('0x10')],'shake':_0x3ba104[_0x5630('0x11')][_0x5630('0x12')]};try{if(!_0x3ba104[_0x5630('0x13')]){_0x3ba104[_0x5630('0x13')]={};}if(_0x827e37){_0x3ba104[_0x5630('0x13')]['queue']=_0x827e37;}else if(_0x3ba104[_0x5630('0x13')][_0x5630('0x14')]){delete _0x3ba104[_0x5630('0x13')][_0x5630('0x14')];}_0x5758f1[_0x5630('0x15')]=utils[_0x5630('0x16')](_0x3ba104[_0x5630('0x11')][_0x5630('0x17')],_0x3ba104);}catch(_0x4be855){_0x5758f1['msg']=_0x5630('0x18');logger[_0x5630('0x19')](util[_0x5630('0xa')]('[%s][QUEUE]\x20%s',_0x3ac92a,_0x4be855['message']));}io['to'](util[_0x5630('0xa')](_0x5630('0xb'),_0x3a96cd[_0x5630('0xf')]))[_0x5630('0x9')](util[_0x5630('0xa')]('notification:%s',_0x15c9de?_0x5630('0x1a'):_0x5630('0x1b')),_0x5758f1);}function writeLog(_0x582c19,_0x2eeb31,_0x57a98b){return logger['info'](util[_0x5630('0xa')](_0x5630('0x1c'),_0x582c19,_0x2eeb31[_0x5630('0xf')],_0x57a98b));}exports['isAgentAvailable']=function(_0xf50409,_0x643e6b,_0x26327f,_0x2e8b7a){if(_0x643e6b[_0x5630('0x1d')]){writeLog(_0xf50409,_0x643e6b,_0x5630('0x1e'));return![];}if(!_0x643e6b[_0x5630('0x1f')]){writeLog(_0xf50409,_0x643e6b,_0x5630('0x20'));return![];}if(_0x643e6b[_0x26327f+_0x5630('0x21')]){writeLog(_0xf50409,_0x643e6b,_0x5630('0x22'));return![];}if(_0x2e8b7a&&_0x643e6b[_0x5630('0x23')](_0x26327f+'Capacity')&&_0x643e6b['hasOwnProperty'](_0x26327f+_0x5630('0x24'))){if(_0x643e6b[_0x26327f+_0x5630('0x25')]>0x0&&_0x643e6b[_0x26327f+_0x5630('0x24')]>=_0x643e6b[_0x26327f+_0x5630('0x25')]){writeLog(_0xf50409,_0x643e6b,_0x26327f[_0x5630('0x26')]()+_0x5630('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x4aee3b,_0x38a59a,_0x571112,_0x40c9ba,_0x11ed26){return sendNotification(!![],_0x4aee3b,_0x38a59a,_0x571112,_0x40c9ba,_0x11ed26);};exports[_0x5630('0x28')]=function(_0x14a359,_0x5051fb,_0x3db5a3,_0x4226a2,_0x42b618){return sendNotification(![],_0x14a359,_0x5051fb,_0x3db5a3,_0x4226a2,_0x42b618);};exports[_0x5630('0x29')]=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 36e4180..f9416c2 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 _0xbb83=['lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','next','validate','shelljs'];(function(_0x4ed844,_0x5cf8a1){var _0x3958cf=function(_0x5ba68e){while(--_0x5ba68e){_0x4ed844['push'](_0x4ed844['shift']());}};_0x3958cf(++_0x5cf8a1);}(_0xbb83,0x19e));var _0x3bb8=function(_0x274b07,_0x16ffda){_0x274b07=_0x274b07-0x0;var _0xd7516f=_0xbb83[_0x274b07];return _0xd7516f;};'use strict';var schema=require(_0x3bb8('0x0'));var sh=require(_0x3bb8('0x1'));var _=require(_0x3bb8('0x2'));var utils=require(_0x3bb8('0x3'));var logger=require(_0x3bb8('0x4'))(_0x3bb8('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x3bb8('0x6')}});exports[_0x3bb8('0x7')]=function(_0x126f5c,_0x184bd1){return function(_0x38e034){try{var _0x14128f={'command':_0x184bd1[0x0]};var _0x1a082a=system[_0x3bb8('0x0')](_0x14128f,{'typecast':!![]});if(_0x1a082a[_0x3bb8('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x126f5c,_[_0x3bb8('0x9')](_0x1a082a,_0x3bb8('0xa'))[_0x3bb8('0xb')](',\x20'));logger['info'](_0x3bb8('0xc'),_0x126f5c);_0x38e034['next']();}else{var _0x20da20=this;var _0x1bb4f1=utils[_0x3bb8('0xd')](_0x184bd1[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x126f5c,_0x1bb4f1);sh[_0x3bb8('0xe')](_['trim'](_0x1bb4f1),function(_0x5c5667,_0x3a33d1){logger[_0x3bb8('0xf')](_0x3bb8('0x10'),_0x126f5c,_0x5c5667);if(_0x5c5667==0x0){var _0x4622b0=_0x3a33d1[_0x3bb8('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x3bb8('0x12')](_0x184bd1[0x1])||_[_0x3bb8('0x13')](_0x184bd1[0x1])){logger[_0x3bb8('0xf')](_0x3bb8('0x14'),_0x126f5c);_0x20da20[_0x3bb8('0x15')][_0x184bd1[0x1]]=_0x4622b0;}else{logger[_0x3bb8('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x126f5c,_0x184bd1[0x1],_0x4622b0);_0x20da20[_0x3bb8('0x15')][_0x184bd1[0x1]]=_0x4622b0;}}_0x38e034['next']();});}}catch(_0x3cafb7){logger['error'](_0x3bb8('0x16'),_0x126f5c,_[_0x3bb8('0x17')](_0x3cafb7)?JSON[_0x3bb8('0x18')](_0x3cafb7):_0x3cafb7);logger[_0x3bb8('0xf')](_0x3bb8('0xc'),_0x126f5c);_0x38e034[_0x3bb8('0x19')]();}};}; \ No newline at end of file +var _0x9e5e=['lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','validate','shelljs'];(function(_0x4e2056,_0xa4c0d5){var _0x54c2d5=function(_0x445019){while(--_0x445019){_0x4e2056['push'](_0x4e2056['shift']());}};_0x54c2d5(++_0xa4c0d5);}(_0x9e5e,0x112));var _0xe9e5=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x9e5e[_0x39c734];return _0xb2a2f9;};'use strict';var schema=require(_0xe9e5('0x0'));var sh=require(_0xe9e5('0x1'));var _=require(_0xe9e5('0x2'));var utils=require(_0xe9e5('0x3'));var logger=require(_0xe9e5('0x4'))('routing');var system=schema({'command':{'type':_0xe9e5('0x5'),'required':!![],'message':_0xe9e5('0x6')}});exports[_0xe9e5('0x7')]=function(_0x2385a8,_0x388bcf){return function(_0x1ca874){try{var _0x53da73={'command':_0x388bcf[0x0]};var _0x32d438=system[_0xe9e5('0x0')](_0x53da73,{'typecast':!![]});if(_0x32d438[_0xe9e5('0x8')]){logger[_0xe9e5('0x9')](_0xe9e5('0xa'),_0x2385a8,_[_0xe9e5('0xb')](_0x32d438,_0xe9e5('0xc'))[_0xe9e5('0xd')](',\x20'));logger['info'](_0xe9e5('0xe'),_0x2385a8);_0x1ca874[_0xe9e5('0xf')]();}else{var _0xe477c3=this;var _0x35536c=utils['getMustacheRender'](_0x388bcf[0x0],this);logger[_0xe9e5('0x10')](_0xe9e5('0x11'),_0x2385a8,_0x35536c);sh['exec'](_['trim'](_0x35536c),function(_0x656c35,_0x191ac5){logger[_0xe9e5('0x10')](_0xe9e5('0x12'),_0x2385a8,_0x656c35);if(_0x656c35==0x0){var _0x515099=_0x191ac5[_0xe9e5('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x388bcf[0x1])||_['isEmpty'](_0x388bcf[0x1])){logger[_0xe9e5('0x10')]('[%s][SYSTEM]\x20no\x20variable',_0x2385a8);_0xe477c3['body'][_0x388bcf[0x1]]=_0x515099;}else{logger[_0xe9e5('0x10')](_0xe9e5('0x14'),_0x2385a8,_0x388bcf[0x1],_0x515099);_0xe477c3[_0xe9e5('0x15')][_0x388bcf[0x1]]=_0x515099;}}_0x1ca874['next']();});}}catch(_0x2dd4cb){logger[_0xe9e5('0x9')]('[%s][SYSTEM]\x20%s',_0x2385a8,_[_0xe9e5('0x16')](_0x2dd4cb)?JSON['stringify'](_0x2dd4cb):_0x2dd4cb);logger[_0xe9e5('0x10')](_0xe9e5('0xe'),_0x2385a8);_0x1ca874[_0xe9e5('0xf')]();}};}; \ 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 598d8b0..23d0c28 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 _0x6d03=['finally','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s'];(function(_0x2ff1f6,_0x1bc588){var _0xbae96d=function(_0x505c67){while(--_0x505c67){_0x2ff1f6['push'](_0x2ff1f6['shift']());}};_0xbae96d(++_0x1bc588);}(_0x6d03,0x153));var _0x36d0=function(_0x1db428,_0x29159f){_0x1db428=_0x1db428-0x0;var _0x598db1=_0x6d03[_0x1db428];return _0x598db1;};'use strict';var schema=require(_0x36d0('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x36d0('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x36d0('0x2')),'whatsappInteraction':require(_0x36d0('0x3'))};var logger=require(_0x36d0('0x4'))(_0x36d0('0x5'));var tag=schema({'tag':{'type':_0x36d0('0x6'),'required':!![],'message':_0x36d0('0x7')}});exports['consequence']=function(_0x771bc2,_0x5e83e5,_0x1fcd24,_0xc60aa0){return function(_0x5e96f1){try{var _0x1e7c5e={'tag':_0x5e83e5[0x0]};var _0x2d6bdf=tag[_0x36d0('0x0')](_0x1e7c5e,{'typecast':!![]});if(_0x2d6bdf[_0x36d0('0x8')]){logger[_0x36d0('0x9')]('[%s][TAG]\x20%s',_0x771bc2,_['map'](_0x2d6bdf,_0x36d0('0xa'))[_0x36d0('0xb')](',\x20'));logger[_0x36d0('0xc')](_0x36d0('0xd'),_0x771bc2);_0x5e96f1[_0x36d0('0xe')]();}else{var _0x25d789={'ids':[_0x5e83e5[0x0]]};if(rpc[_0xc60aa0['channel']+'Interaction']){rpc[_0xc60aa0['channel']+_0x36d0('0xf')][_0x36d0('0x10')](_0xc60aa0[_0x36d0('0x11')]['id'],_0x25d789)[_0x36d0('0x12')](function(_0x2a0271){logger[_0x36d0('0xc')](_0x36d0('0x13'),_0x771bc2,_0x5e83e5[0x1],_0xc60aa0['channel'],_0xc60aa0['interaction']['id']);})['catch'](function(_0x472761){logger['error'](_0x36d0('0x14'),_0x771bc2,JSON['stringify'](_0x472761));logger[_0x36d0('0xc')](_0x36d0('0xd'),_0x771bc2);})[_0x36d0('0x15')](function(){_0x5e96f1[_0x36d0('0xe')]();});}}}catch(_0x434904){logger[_0x36d0('0x9')](_0x36d0('0x14'),_0x771bc2,_[_0x36d0('0x16')](_0x434904)?JSON[_0x36d0('0x17')](_0x434904):_0x434904);logger[_0x36d0('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x771bc2);_0x5e96f1[_0x36d0('0xe')]();}};}; \ No newline at end of file +var _0x1e2b=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','catch','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join'];(function(_0x3997bb,_0x2feba2){var _0x300324=function(_0x224e2d){while(--_0x224e2d){_0x3997bb['push'](_0x3997bb['shift']());}};_0x300324(++_0x2feba2);}(_0x1e2b,0x81));var _0xb1e2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1e2b[_0x4a9fb1];return _0x348672;};'use strict';var schema=require(_0xb1e2('0x0'));var _=require(_0xb1e2('0x1'));var rpc={'chatInteraction':require(_0xb1e2('0x2')),'openchannelInteraction':require(_0xb1e2('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xb1e2('0x4')),'faxInteraction':require(_0xb1e2('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xb1e2('0x6'))(_0xb1e2('0x7'));var tag=schema({'tag':{'type':_0xb1e2('0x8'),'required':!![],'message':_0xb1e2('0x9')}});exports['consequence']=function(_0x500f33,_0x284442,_0x2f42ee,_0x44f514){return function(_0x5b7e67){try{var _0xee4369={'tag':_0x284442[0x0]};var _0x5ea393=tag['validate'](_0xee4369,{'typecast':!![]});if(_0x5ea393['length']){logger[_0xb1e2('0xa')](_0xb1e2('0xb'),_0x500f33,_[_0xb1e2('0xc')](_0x5ea393,_0xb1e2('0xd'))[_0xb1e2('0xe')](',\x20'));logger[_0xb1e2('0xf')](_0xb1e2('0x10'),_0x500f33);_0x5b7e67[_0xb1e2('0x11')]();}else{var _0x5f0896={'ids':[_0x284442[0x0]]};if(rpc[_0x44f514[_0xb1e2('0x12')]+'Interaction']){rpc[_0x44f514[_0xb1e2('0x12')]+_0xb1e2('0x13')][_0xb1e2('0x14')](_0x44f514[_0xb1e2('0x15')]['id'],_0x5f0896)['then'](function(_0x29e50e){logger[_0xb1e2('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x500f33,_0x284442[0x1],_0x44f514[_0xb1e2('0x12')],_0x44f514[_0xb1e2('0x15')]['id']);})[_0xb1e2('0x16')](function(_0x36dcb4){logger['error'](_0xb1e2('0xb'),_0x500f33,JSON['stringify'](_0x36dcb4));logger[_0xb1e2('0xf')](_0xb1e2('0x10'),_0x500f33);})[_0xb1e2('0x17')](function(){_0x5b7e67['next']();});}}}catch(_0x464d35){logger[_0xb1e2('0xa')]('[%s][TAG]\x20%s',_0x500f33,_['isObject'](_0x464d35)?JSON['stringify'](_0x464d35):_0x464d35);logger['info'](_0xb1e2('0x10'),_0x500f33);_0x5b7e67[_0xb1e2('0x11')]();}};}; \ 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 6c56303..91a2abd 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 _0x70e0=['list','mustache','lodash','exports','render','merge','body','contact','account'];(function(_0x161ede,_0x27cd5c){var _0x44db1c=function(_0x2add60){while(--_0x2add60){_0x161ede['push'](_0x161ede['shift']());}};_0x44db1c(++_0x27cd5c);}(_0x70e0,0x17b));var _0x070e=function(_0x124982,_0x2005b1){_0x124982=_0x124982-0x0;var _0x107353=_0x70e0[_0x124982];return _0x107353;};'use strict';var Mustache=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));module[_0x070e('0x2')]={'getMustacheRender':function(_0x4d95bb,_0x579b83){return Mustache[_0x070e('0x3')](_0x4d95bb,_[_0x070e('0x4')](_0x579b83[_0x070e('0x5')],{'contact':_0x579b83[_0x070e('0x6')],'message':_0x579b83['message'],'account':_0x579b83[_0x070e('0x7')],'interaction':_0x579b83['interaction'],'list':_0x579b83[_0x070e('0x8')]}))||'';}}; \ No newline at end of file +var _0x6364=['render','merge','body','contact','message','interaction','list','exports'];(function(_0x332414,_0x5731f7){var _0x2b9797=function(_0x244800){while(--_0x244800){_0x332414['push'](_0x332414['shift']());}};_0x2b9797(++_0x5731f7);}(_0x6364,0x8f));var _0x4636=function(_0x57ebc5,_0xfc7dc5){_0x57ebc5=_0x57ebc5-0x0;var _0x1aa39e=_0x6364[_0x57ebc5];return _0x1aa39e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x4636('0x0')]={'getMustacheRender':function(_0xa0eea0,_0x17c69f){return Mustache[_0x4636('0x1')](_0xa0eea0,_[_0x4636('0x2')](_0x17c69f[_0x4636('0x3')],{'contact':_0x17c69f[_0x4636('0x4')],'message':_0x17c69f[_0x4636('0x5')],'account':_0x17c69f['account'],'interaction':_0x17c69f[_0x4636('0x6')],'list':_0x17c69f[_0x4636('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 01a300d..7b7e897 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 _0xa020=['available','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','.js','app','autoreply','appdata','split','push','slice','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','name','paused','waiting','mailQueues'];(function(_0xc5c57d,_0x5bccbd){var _0x3e6506=function(_0x11c184){while(--_0x11c184){_0xc5c57d['push'](_0xc5c57d['shift']());}};_0x3e6506(++_0x5bccbd);}(_0xa020,0x6c));var _0x0a02=function(_0xbbf64c,_0x363ad9){_0xbbf64c=_0xbbf64c-0x0;var _0x3c83c1=_0xa020[_0xbbf64c];return _0x3c83c1;};'use strict';var _=require('lodash');var util=require(_0x0a02('0x0'));var path=require(_0x0a02('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x0a02('0x2'));var uuid=require(_0x0a02('0x3'));var config=require(_0x0a02('0x4'));var logger=require(_0x0a02('0x5'))(_0x0a02('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0a02('0x7')),'smsQueueReport':require(_0x0a02('0x8')),'faxQueueReport':require(_0x0a02('0x9')),'whatsappQueueReport':require(_0x0a02('0xa'))};var RuleEngine=require(_0x0a02('0xb'));function getId(_0x41893b,_0x21aeff,_0x3e561d){return util[_0x0a02('0xc')](_0x0a02('0xd'),_0x41893b,_0x21aeff||0x0,_0x3e561d||0x0);}function getIntervals(_0xe2e5da,_0xdd339f){var _0xf6001=[];if(!_[_0x0a02('0xe')](_0xdd339f['IntervalId'])&&!_[_0x0a02('0xe')](_0xe2e5da[_0xdd339f['IntervalId']])&&!_['isNil'](_0xe2e5da[_0xdd339f[_0x0a02('0xf')]][_0x0a02('0x10')])){_0xf6001=_[_0x0a02('0x11')](_0xe2e5da[_0xdd339f['IntervalId']]['Intervals'],_0x0a02('0x12'));}else if(!_['isNil'](_0xdd339f[_0x0a02('0x12')])){_0xf6001=[_0xdd339f[_0x0a02('0x12')]];}return _0xf6001;}exports[_0x0a02('0x13')]=function(_0xee8114){_0xee8114[_0x0a02('0x14')]={};return new BPromise(function(_0x115c77,_0x7fb60e){var _0x33f8f5={'Start':function(_0x13c94f){var _0x1b4f68=this;return new Promise(function(_0x4bf5ac,_0x3a88d7){if(_0x13c94f){try{var _0x4c97de=[];var _0x39505c=getId(_0x13c94f[_0x0a02('0x15')],_0x13c94f[_0x0a02('0x16')]?_0x13c94f[_0x0a02('0x16')]['id']:0x0,_0x13c94f[_0x0a02('0x17')]?_0x13c94f[_0x0a02('0x17')]['id']:0x0);if(_0x13c94f[_0x0a02('0x18')]&&_['isArray'](_0x13c94f[_0x0a02('0x18')])&&_0x13c94f[_0x0a02('0x18')][_0x0a02('0x19')]){for(var _0x297a4f=0x0;_0x297a4f<_0x13c94f[_0x0a02('0x18')]['length'];_0x297a4f+=0x1){var _0x2871de=_0x13c94f[_0x0a02('0x18')][_0x297a4f];if(fs[_0x0a02('0x1a')](path[_0x0a02('0x1b')](__dirname,'applications',_0x2871de['app']+_0x0a02('0x1c')))){var _0x4ca892=[];switch(_0x2871de[_0x0a02('0x1d')]['toLowerCase']()){case _0x0a02('0x1e'):var _0x26a3bb=_0x2871de[_0x0a02('0x1f')][_0x0a02('0x20')](',');_0x4ca892[_0x0a02('0x21')](_0x26a3bb[0x0]);_0x4ca892[_0x0a02('0x21')](_0x26a3bb[_0x0a02('0x22')](0x1,_0x26a3bb[_0x0a02('0x19')])['join'](','));break;case'dialogflow':var _0x3ea942=_0x2871de[_0x0a02('0x1f')]['split'](',');_0x4ca892[_0x0a02('0x21')](_0x3ea942[0x0]);_0x4ca892['push'](_0x3ea942[0x1]);_0x4ca892[_0x0a02('0x21')](_0x3ea942[_0x0a02('0x22')](0x2,_0x3ea942['length'])[_0x0a02('0x1b')](','));break;case'dialogflowv2':var _0xe56f86=_0x2871de[_0x0a02('0x1f')]['split'](',');_0x4ca892[_0x0a02('0x21')](_0xe56f86[0x0]);_0x4ca892[_0x0a02('0x21')](_0xe56f86[0x1]);_0x4ca892['push'](_0xe56f86[0x2]);_0x4ca892[_0x0a02('0x21')](_0xe56f86[0x3]);_0x4ca892[_0x0a02('0x21')](_0xe56f86[_0x0a02('0x22')](0x4,_0xe56f86[_0x0a02('0x19')])[_0x0a02('0x1b')](','));break;case _0x0a02('0x23'):var _0x5141f5=_0x2871de[_0x0a02('0x1f')][_0x0a02('0x20')](',');_0x4ca892[_0x0a02('0x21')](_0x5141f5[0x0]);_0x4ca892['push'](_0x5141f5[0x1]);_0x4ca892[_0x0a02('0x21')](_0x5141f5[0x2]);_0x4ca892['push'](_0x5141f5[0x3]);_0x4ca892[_0x0a02('0x21')](_0x5141f5[_0x0a02('0x22')](0x4,_0x5141f5[_0x0a02('0x19')])[_0x0a02('0x1b')](','));break;case _0x0a02('0x16'):_0x4ca892[_0x0a02('0x21')](_0x2871de[_0x0a02('0x1f')]);break;case _0x0a02('0x24'):_0x4ca892['push'](_0x2871de[_0x0a02('0x25')]);_0x4ca892[_0x0a02('0x21')](_0x2871de['appdata']);break;default:_0x4ca892=_['isNil'](_0x2871de[_0x0a02('0x1f')])?[]:_0x2871de[_0x0a02('0x1f')][_0x0a02('0x20')](',');}var _0x4255fb={'id':util[_0x0a02('0xc')](_0x0a02('0x26'),_0x39505c,_0x2871de['id'],_0x2871de[_0x0a02('0x1d')]),'condition':require(_0x0a02('0x27'))['condition'](_0x39505c,getIntervals(_0xee8114[_0x0a02('0x28')],_0x2871de),_0xee8114),'consequence':require(_0x0a02('0x29')+_0x2871de[_0x0a02('0x1d')])[_0x0a02('0x2a')](_0x39505c,_0x4ca892,_0xee8114,_0x13c94f),'p':_0x2871de[_0x0a02('0x2b')]||0x0};logger[_0x0a02('0x2c')]('Push\x20new\x20rule',_0x4255fb['id'],_0x0a02('0x2d'),getIntervals(_0xee8114['intervals'],_0x2871de)[_0x0a02('0x1b')](_0x0a02('0x2e')));_0x4c97de[_0x0a02('0x21')](_0x4255fb);}else{logger[_0x0a02('0x2f')](_0x0a02('0x30'),path[_0x0a02('0x1b')](__dirname,_0x0a02('0x18'),_0x2871de[_0x0a02('0x1d')]+_0x0a02('0x1c')));}}_0xee8114[_0x0a02('0x14')][_0x39505c]=new RuleEngine(_0x4c97de);_0xee8114[_0x0a02('0x14')][_0x39505c][_0x0a02('0x31')](_0x13c94f,function(_0xcb5c43){logger['info'](_0x0a02('0x32'),JSON['stringify'](_0xcb5c43[_0x0a02('0x33')]));if(_0xee8114[_0x0a02('0x14')][_0x39505c]){_0xee8114[_0x0a02('0x14')][_0x39505c][_0x0a02('0x34')]('complete');}});return _0x4bf5ac({'code':0xc8,'message':_0x13c94f});}else{logger[_0x0a02('0x2c')](_0x0a02('0x35'));return _0x4bf5ac({'code':0xc8,'message':_0x13c94f});}}catch(_0x110442){logger[_0x0a02('0x2f')](_0x110442[_0x0a02('0x36')]);return _0x3a88d7(_0x1b4f68[_0x0a02('0x2f')](0x1f4,_0x110442));}}return _0x3a88d7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x1837d2){var _0x112e16=this;return new Promise(function(_0x242d33,_0x441689){if(_0x1837d2[_0x0a02('0x16')]&&_0x1837d2[_0x0a02('0x16')]['id']){try{var _0x184a13=getId(_0x1837d2[_0x0a02('0x15')],_0x1837d2['message']?_0x1837d2[_0x0a02('0x16')]['id']:0x0,_0x1837d2[_0x0a02('0x17')]?_0x1837d2['interaction']['id']:0x0);if(_0xee8114[_0x0a02('0x14')][_0x184a13]){_0xee8114['rules'][_0x184a13][_0x0a02('0x34')](_0x0a02('0x37'));if(rpc[_0x1837d2[_0x0a02('0x15')]+_0x0a02('0x38')]){rpc[_0x1837d2[_0x0a02('0x15')]+_0x0a02('0x38')][_0x0a02('0x39')](_0x184a13,{'UserId':_0x1837d2[_0x0a02('0x16')][_0x0a02('0x3a')]})['catch'](function(_0x18df87){logger[_0x0a02('0x2f')](_0x0a02('0x3b'));});}}return _0x242d33({'code':0xc8,'message':_0x1837d2});}catch(_0x3046f4){logger[_0x0a02('0x2f')](_0x3046f4[_0x0a02('0x36')]);return _0x441689(_0x112e16[_0x0a02('0x2f')](0x1f4,_0x3046f4));}}logger[_0x0a02('0x2f')](_0x0a02('0x3c'));return _0x441689(_0x112e16['error'](0x1f4,_0x0a02('0x3c')));});},'RejectMessage':function(_0x14476f){var _0x3d8e01=this;return new Promise(function(_0x14a700,_0x1c25fb){if(_0x14476f[_0x0a02('0x3d')]&&_0x14476f[_0x0a02('0x3d')]['id']){try{if(_0xee8114[_0x0a02('0x3e')][_0x14476f[_0x0a02('0x3d')]['id']]){_0xee8114[_0x0a02('0x3e')][_0x14476f[_0x0a02('0x3d')]['id']][_0x0a02('0x3f')]=![];_0xee8114[_0x0a02('0x3e')][_0x14476f[_0x0a02('0x3d')]['id']][_0x0a02('0x40')]=undefined;}return _0x14a700({'code':0xc8,'message':_0x14476f});}catch(_0x41af97){logger[_0x0a02('0x2f')](_0x41af97[_0x0a02('0x36')]);return _0x1c25fb(_0x3d8e01['error'](0x1f4,_0x41af97));}}logger['error'](_0x0a02('0x3c'));return _0x1c25fb(_0x3d8e01['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3e2821){var _0x1ff236=this;return new Promise(function(_0x5a19f1,_0x574fdd){if(_0x3e2821['channel']&&_0x3e2821[_0x0a02('0x17')]&&_0x3e2821[_0x0a02('0x17')]['id']){try{var _0x1f3225=getId(_0x3e2821[_0x0a02('0x15')],_0x3e2821[_0x0a02('0x16')]?_0x3e2821['message']['id']:0x0,_0x3e2821['interaction']?_0x3e2821['interaction']['id']:0x0);if(_0xee8114[_0x0a02('0x14')][_0x1f3225]){_0xee8114[_0x0a02('0x14')][_0x1f3225][_0x0a02('0x34')]('end');}return _0x5a19f1({'code':0xc8,'message':_0x3e2821});}catch(_0x541dfc){logger[_0x0a02('0x2f')](_0x541dfc[_0x0a02('0x36')]);return _0x574fdd(_0x1ff236[_0x0a02('0x2f')](0x1f4,_0x541dfc));}}logger[_0x0a02('0x2f')](_0x0a02('0x3c'));return _0x574fdd(_0x1ff236[_0x0a02('0x2f')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5667da){var _0x275175=this;return new Promise(function(_0x1543e8,_0x2e5ed1){if(_0xee8114[_0x0a02('0x3e')][_0x0a02('0x41')](_0x5667da['id'])){for(var _0x3d0943 in _0x5667da[_0x0a02('0x42')]){if(_0x5667da['capacity'][_0x0a02('0x41')](_0x3d0943)){if(_0xee8114[_0x0a02('0x3e')][_0x5667da['id']][_0x0a02('0x41')](_0x3d0943+_0x0a02('0x43'))){_0xee8114[_0x0a02('0x3e')][_0x5667da['id']][_0x3d0943+_0x0a02('0x43')]=parseInt(_0x5667da[_0x0a02('0x42')][_0x3d0943],0xa);}}}_0xee8114[_0x0a02('0x3e')][_0x5667da['id']][_0x0a02('0x44')]();return _0x1543e8({'code':0xc8,'message':_0xee8114['agents'][_0x5667da['id']]});}else{return _0x2e5ed1(_0x275175[_0x0a02('0x2f')](0x1f4,_0x0a02('0x45')));}});},'Agents':function(_0x5d9c25){return new Promise(function(_0x4a248c,_0x2f8fd2){var _0x24fc98=_[_0x0a02('0x46')](_0xee8114[_0x0a02('0x3e')]);_0x4a248c({'count':_0x24fc98[_0x0a02('0x19')],'rows':_0x24fc98});});},'ChatQueues':function(_0x41a9b0){return new Promise(function(_0x48acb6,_0x214f58){var _0x5bee69=[];for(var _0x35da31 in _0xee8114[_0x0a02('0x47')]){if(_0xee8114[_0x0a02('0x47')]['hasOwnProperty'](_0x35da31)){var _0x14bca5=_0xee8114[_0x0a02('0x47')][_0x35da31];var _0x3e7b30={'id':_0x14bca5['id'],'available':_0x14bca5['available'],'loggedIn':_0x14bca5['loggedIn'],'name':_0x14bca5[_0x0a02('0x48')],'paused':_0x14bca5[_0x0a02('0x49')],'waiting':_0x14bca5[_0x0a02('0x4a')]};_0x5bee69['push'](_0x3e7b30);}}_0x48acb6({'count':_0x5bee69['length'],'rows':_0x5bee69});});},'MailQueues':function(_0x44cde3){return new Promise(function(_0x4ceb37,_0x2521c4){var _0xa5e92d=[];for(var _0x328c08 in _0xee8114[_0x0a02('0x4b')]){if(_0xee8114[_0x0a02('0x4b')][_0x0a02('0x41')](_0x328c08)){var _0x54a585=_0xee8114[_0x0a02('0x4b')][_0x328c08];var _0x55b20f={'id':_0x54a585['id'],'available':_0x54a585[_0x0a02('0x4c')],'loggedIn':_0x54a585['loggedIn'],'name':_0x54a585[_0x0a02('0x48')],'paused':_0x54a585['paused'],'waiting':_0x54a585[_0x0a02('0x4a')]};_0xa5e92d[_0x0a02('0x21')](_0x55b20f);}}_0x4ceb37({'count':_0xa5e92d['length'],'rows':_0xa5e92d});});},'OpenchannelQueues':function(_0x417030){return new Promise(function(_0x232cb4,_0xf0ccfb){var _0x5ba4d9=[];for(var _0x38e61f in _0xee8114['openchannelQueues']){if(_0xee8114[_0x0a02('0x4d')][_0x0a02('0x41')](_0x38e61f)){var _0xf390eb=_0xee8114[_0x0a02('0x4d')][_0x38e61f];var _0x3a85c6={'id':_0xf390eb['id'],'available':_0xf390eb['available'],'loggedIn':_0xf390eb[_0x0a02('0x4e')],'name':_0xf390eb[_0x0a02('0x48')],'paused':_0xf390eb[_0x0a02('0x49')],'waiting':_0xf390eb[_0x0a02('0x4a')]};_0x5ba4d9[_0x0a02('0x21')](_0x3a85c6);}}_0x232cb4({'count':_0x5ba4d9[_0x0a02('0x19')],'rows':_0x5ba4d9});});},'SmsQueues':function(_0x3ea89a){return new Promise(function(_0x5c0fb3,_0x263fd5){var _0x116d82=[];for(var _0x848f0 in _0xee8114[_0x0a02('0x4f')]){if(_0xee8114[_0x0a02('0x4f')]['hasOwnProperty'](_0x848f0)){var _0x131f57=_0xee8114['smsQueues'][_0x848f0];var _0x3d1406={'id':_0x131f57['id'],'available':_0x131f57[_0x0a02('0x4c')],'loggedIn':_0x131f57[_0x0a02('0x4e')],'name':_0x131f57[_0x0a02('0x48')],'paused':_0x131f57[_0x0a02('0x49')],'waiting':_0x131f57['waiting']};_0x116d82[_0x0a02('0x21')](_0x3d1406);}}_0x5c0fb3({'count':_0x116d82[_0x0a02('0x19')],'rows':_0x116d82});});},'FaxQueues':function(_0x4f3d0e){return new Promise(function(_0x27bd3d,_0x54c2b8){var _0x3c6ba6=[];for(var _0x227ceb in _0xee8114[_0x0a02('0x50')]){if(_0xee8114[_0x0a02('0x50')][_0x0a02('0x41')](_0x227ceb)){var _0x5115b7=_0xee8114['faxQueues'][_0x227ceb];var _0x2f0bbb={'id':_0x5115b7['id'],'available':_0x5115b7[_0x0a02('0x4c')],'loggedIn':_0x5115b7['loggedIn'],'name':_0x5115b7[_0x0a02('0x48')],'paused':_0x5115b7[_0x0a02('0x49')],'waiting':_0x5115b7[_0x0a02('0x4a')]};_0x3c6ba6[_0x0a02('0x21')](_0x2f0bbb);}}_0x27bd3d({'count':_0x3c6ba6['length'],'rows':_0x3c6ba6});});},'WhatsappQueues':function(_0x43151a){return new Promise(function(_0x17834a,_0x4c15de){var _0x288522=[];for(var _0x492f77 in _0xee8114[_0x0a02('0x51')]){if(_0xee8114['whatsappQueues']['hasOwnProperty'](_0x492f77)){var _0x22d0d9=_0xee8114['whatsappQueues'][_0x492f77];var _0x30105b={'id':_0x22d0d9['id'],'available':_0x22d0d9[_0x0a02('0x4c')],'loggedIn':_0x22d0d9['loggedIn'],'name':_0x22d0d9['name'],'paused':_0x22d0d9['paused'],'waiting':_0x22d0d9[_0x0a02('0x4a')]};_0x288522[_0x0a02('0x21')](_0x30105b);}}_0x17834a({'count':_0x288522[_0x0a02('0x19')],'rows':_0x288522});});},'ChatQueuesWaitingInteractions':function(_0x665114){return new Promise(function(_0x314abb,_0x8e014d){var _0x5b5572=_[_0x0a02('0x46')](_0xee8114[_0x0a02('0x52')]);_0x314abb({'count':_0x5b5572[_0x0a02('0x19')],'rows':_0x5b5572});});},'MailQueuesWaitingInteractions':function(_0x42ea68){return new Promise(function(_0x1d4c2c,_0x167a4d){var _0x902ac4=_['values'](_0xee8114[_0x0a02('0x53')]);_0x1d4c2c({'count':_0x902ac4[_0x0a02('0x19')],'rows':_0x902ac4});});},'OpenchannelQueuesWaitingInteractions':function(_0x42dc36){return new Promise(function(_0x4eed09,_0x5898b4){var _0x25a63a=_['values'](_0xee8114[_0x0a02('0x54')]);_0x4eed09({'count':_0x25a63a['length'],'rows':_0x25a63a});});},'SmsQueuesWaitingInteractions':function(_0x133b9f){return new Promise(function(_0x37b007,_0x2b62d8){var _0x58dc60=_[_0x0a02('0x46')](_0xee8114[_0x0a02('0x55')]);_0x37b007({'count':_0x58dc60[_0x0a02('0x19')],'rows':_0x58dc60});});},'FaxQueuesWaitingInteractions':function(_0x429806){return new Promise(function(_0x1c755a,_0xc3a655){var _0x4f1131=_[_0x0a02('0x46')](_0xee8114[_0x0a02('0x56')]);_0x1c755a({'count':_0x4f1131[_0x0a02('0x19')],'rows':_0x4f1131});});},'WhatsappQueuesWaitingInteractions':function(_0x3f47d6){return new Promise(function(_0x2debce,_0x1ffb2e){var _0x1e4e79=_[_0x0a02('0x46')](_0xee8114[_0x0a02('0x57')]);_0x2debce({'count':_0x1e4e79['length'],'rows':_0x1e4e79});});}};var _0x536bda=jayson[_0x0a02('0x58')](_0x33f8f5)[_0x0a02('0x59')]();_0x536bda['on'](_0x0a02('0x2f'),function(_0x36db6c){logger[_0x0a02('0x2f')](JSON[_0x0a02('0x5a')](_0x36db6c));return _0x7fb60e(_0x36db6c);});_0x536bda['listen'](0x232c,'127.0.0.1',function(){console['log'](_0x0a02('0x5b'),0x232c);return _0x115c77('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x270b=['uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','join','app','.js','autoreply','split','push','appdata','slice','dialogflowv2','TagId','format','%s:%s:%s','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Applications\x20executed','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird'];(function(_0x506f1f,_0x43362c){var _0x20f804=function(_0xb3924b){while(--_0xb3924b){_0x506f1f['push'](_0x506f1f['shift']());}};_0x20f804(++_0x43362c);}(_0x270b,0xf2));var _0xb270=function(_0x2cd096,_0x2517fc){_0x2cd096=_0x2cd096-0x0;var _0x20c6be=_0x270b[_0x2cd096];return _0x20c6be;};'use strict';var _=require(_0xb270('0x0'));var util=require(_0xb270('0x1'));var path=require(_0xb270('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb270('0x3'));var uuid=require(_0xb270('0x4'));var config=require(_0xb270('0x5'));var logger=require(_0xb270('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xb270('0x7')),'mailQueueReport':require(_0xb270('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0xef248a,_0x456916,_0x1545ba){return util['format'](_0xb270('0x9'),_0xef248a,_0x456916||0x0,_0x1545ba||0x0);}function getIntervals(_0xc931f,_0x490a05){var _0x48170b=[];if(!_[_0xb270('0xa')](_0x490a05['IntervalId'])&&!_[_0xb270('0xa')](_0xc931f[_0x490a05[_0xb270('0xb')]])&&!_[_0xb270('0xa')](_0xc931f[_0x490a05[_0xb270('0xb')]][_0xb270('0xc')])){_0x48170b=_[_0xb270('0xd')](_0xc931f[_0x490a05[_0xb270('0xb')]]['Intervals'],_0xb270('0xe'));}else if(!_[_0xb270('0xa')](_0x490a05[_0xb270('0xe')])){_0x48170b=[_0x490a05[_0xb270('0xe')]];}return _0x48170b;}exports[_0xb270('0xf')]=function(_0x3eb9a6){_0x3eb9a6[_0xb270('0x10')]={};return new BPromise(function(_0x50c9b3,_0x1e0208){var _0x231d74={'Start':function(_0x566b1a){var _0x32aed6=this;return new Promise(function(_0x9bba99,_0x8d0149){if(_0x566b1a){try{var _0x1f473a=[];var _0x2f5053=getId(_0x566b1a[_0xb270('0x11')],_0x566b1a[_0xb270('0x12')]?_0x566b1a[_0xb270('0x12')]['id']:0x0,_0x566b1a[_0xb270('0x13')]?_0x566b1a[_0xb270('0x13')]['id']:0x0);if(_0x566b1a['applications']&&_['isArray'](_0x566b1a[_0xb270('0x14')])&&_0x566b1a[_0xb270('0x14')][_0xb270('0x15')]){for(var _0x42b818=0x0;_0x42b818<_0x566b1a['applications'][_0xb270('0x15')];_0x42b818+=0x1){var _0x47c380=_0x566b1a[_0xb270('0x14')][_0x42b818];if(fs['existsSync'](path[_0xb270('0x16')](__dirname,_0xb270('0x14'),_0x47c380[_0xb270('0x17')]+_0xb270('0x18')))){var _0x86402b=[];switch(_0x47c380[_0xb270('0x17')]['toLowerCase']()){case _0xb270('0x19'):var _0x24d5d7=_0x47c380['appdata'][_0xb270('0x1a')](',');_0x86402b[_0xb270('0x1b')](_0x24d5d7[0x0]);_0x86402b[_0xb270('0x1b')](_0x24d5d7['slice'](0x1,_0x24d5d7[_0xb270('0x15')])[_0xb270('0x16')](','));break;case'dialogflow':var _0x18f08f=_0x47c380[_0xb270('0x1c')]['split'](',');_0x86402b[_0xb270('0x1b')](_0x18f08f[0x0]);_0x86402b[_0xb270('0x1b')](_0x18f08f[0x1]);_0x86402b['push'](_0x18f08f[_0xb270('0x1d')](0x2,_0x18f08f[_0xb270('0x15')])['join'](','));break;case _0xb270('0x1e'):var _0x196f95=_0x47c380[_0xb270('0x1c')][_0xb270('0x1a')](',');_0x86402b[_0xb270('0x1b')](_0x196f95[0x0]);_0x86402b[_0xb270('0x1b')](_0x196f95[0x1]);_0x86402b['push'](_0x196f95[0x2]);_0x86402b[_0xb270('0x1b')](_0x196f95[0x3]);_0x86402b[_0xb270('0x1b')](_0x196f95[_0xb270('0x1d')](0x4,_0x196f95[_0xb270('0x15')])['join'](','));break;case'amazonlex':var _0xed56a1=_0x47c380['appdata'][_0xb270('0x1a')](',');_0x86402b['push'](_0xed56a1[0x0]);_0x86402b[_0xb270('0x1b')](_0xed56a1[0x1]);_0x86402b[_0xb270('0x1b')](_0xed56a1[0x2]);_0x86402b[_0xb270('0x1b')](_0xed56a1[0x3]);_0x86402b[_0xb270('0x1b')](_0xed56a1[_0xb270('0x1d')](0x4,_0xed56a1[_0xb270('0x15')])[_0xb270('0x16')](','));break;case _0xb270('0x12'):_0x86402b[_0xb270('0x1b')](_0x47c380[_0xb270('0x1c')]);break;case'tag':_0x86402b[_0xb270('0x1b')](_0x47c380[_0xb270('0x1f')]);_0x86402b[_0xb270('0x1b')](_0x47c380[_0xb270('0x1c')]);break;default:_0x86402b=_[_0xb270('0xa')](_0x47c380[_0xb270('0x1c')])?[]:_0x47c380[_0xb270('0x1c')][_0xb270('0x1a')](',');}var _0x206537={'id':util[_0xb270('0x20')](_0xb270('0x21'),_0x2f5053,_0x47c380['id'],_0x47c380[_0xb270('0x17')]),'condition':require('./interval')[_0xb270('0x22')](_0x2f5053,getIntervals(_0x3eb9a6[_0xb270('0x23')],_0x47c380),_0x3eb9a6),'consequence':require(_0xb270('0x24')+_0x47c380[_0xb270('0x17')])[_0xb270('0x25')](_0x2f5053,_0x86402b,_0x3eb9a6,_0x566b1a),'p':_0x47c380['priority']||0x0};logger[_0xb270('0x26')](_0xb270('0x27'),_0x206537['id'],_0xb270('0x28'),getIntervals(_0x3eb9a6['intervals'],_0x47c380)[_0xb270('0x16')](_0xb270('0x29')));_0x1f473a[_0xb270('0x1b')](_0x206537);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xb270('0x16')](__dirname,_0xb270('0x14'),_0x47c380['app']+_0xb270('0x18')));}}_0x3eb9a6[_0xb270('0x10')][_0x2f5053]=new RuleEngine(_0x1f473a);_0x3eb9a6[_0xb270('0x10')][_0x2f5053]['execute'](_0x566b1a,function(_0x51063d){logger[_0xb270('0x26')](_0xb270('0x2a'),JSON['stringify'](_0x51063d['matchPath']));if(_0x3eb9a6[_0xb270('0x10')][_0x2f5053]){_0x3eb9a6[_0xb270('0x10')][_0x2f5053][_0xb270('0x2b')](_0xb270('0x2c'));}});return _0x9bba99({'code':0xc8,'message':_0x566b1a});}else{logger[_0xb270('0x26')](_0xb270('0x2d'));return _0x9bba99({'code':0xc8,'message':_0x566b1a});}}catch(_0x549f4c){logger[_0xb270('0x2e')](_0x549f4c[_0xb270('0x2f')]);return _0x8d0149(_0x32aed6['error'](0x1f4,_0x549f4c));}}return _0x8d0149(_0xb270('0x30'));});},'AcceptMessage':function(_0x2c9688){var _0x2508aa=this;return new Promise(function(_0x106c60,_0x19723e){if(_0x2c9688[_0xb270('0x12')]&&_0x2c9688[_0xb270('0x12')]['id']){try{var _0x1abf77=getId(_0x2c9688[_0xb270('0x11')],_0x2c9688[_0xb270('0x12')]?_0x2c9688[_0xb270('0x12')]['id']:0x0,_0x2c9688[_0xb270('0x13')]?_0x2c9688[_0xb270('0x13')]['id']:0x0);if(_0x3eb9a6[_0xb270('0x10')][_0x1abf77]){_0x3eb9a6[_0xb270('0x10')][_0x1abf77][_0xb270('0x2b')](_0xb270('0x31'));if(rpc[_0x2c9688['channel']+_0xb270('0x32')]){rpc[_0x2c9688['channel']+'QueueReport'][_0xb270('0x33')](_0x1abf77,{'UserId':_0x2c9688[_0xb270('0x12')]['UserId']})['catch'](function(_0x5ed705){logger[_0xb270('0x2e')](_0xb270('0x34'));});}}return _0x106c60({'code':0xc8,'message':_0x2c9688});}catch(_0x906219){logger[_0xb270('0x2e')](_0x906219[_0xb270('0x2f')]);return _0x19723e(_0x2508aa['error'](0x1f4,_0x906219));}}logger[_0xb270('0x2e')](_0xb270('0x35'));return _0x19723e(_0x2508aa[_0xb270('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x317c60){var _0x519b70=this;return new Promise(function(_0x82ad42,_0x10d549){if(_0x317c60['agent']&&_0x317c60[_0xb270('0x36')]['id']){try{if(_0x3eb9a6[_0xb270('0x37')][_0x317c60[_0xb270('0x36')]['id']]){_0x3eb9a6[_0xb270('0x37')][_0x317c60[_0xb270('0x36')]['id']][_0xb270('0x38')]=![];_0x3eb9a6[_0xb270('0x37')][_0x317c60[_0xb270('0x36')]['id']][_0xb270('0x39')]=undefined;}return _0x82ad42({'code':0xc8,'message':_0x317c60});}catch(_0x5c76df){logger[_0xb270('0x2e')](_0x5c76df[_0xb270('0x2f')]);return _0x10d549(_0x519b70[_0xb270('0x2e')](0x1f4,_0x5c76df));}}logger[_0xb270('0x2e')](_0xb270('0x35'));return _0x10d549(_0x519b70[_0xb270('0x2e')](0x1f4,_0xb270('0x35')));});},'AbandonInteraction':function(_0x1dcbb4){var _0x2f8236=this;return new Promise(function(_0x45aa2f,_0x54b0be){if(_0x1dcbb4[_0xb270('0x11')]&&_0x1dcbb4['interaction']&&_0x1dcbb4[_0xb270('0x13')]['id']){try{var _0x5a2430=getId(_0x1dcbb4[_0xb270('0x11')],_0x1dcbb4[_0xb270('0x12')]?_0x1dcbb4[_0xb270('0x12')]['id']:0x0,_0x1dcbb4[_0xb270('0x13')]?_0x1dcbb4[_0xb270('0x13')]['id']:0x0);if(_0x3eb9a6[_0xb270('0x10')][_0x5a2430]){_0x3eb9a6[_0xb270('0x10')][_0x5a2430]['emit']('end');}return _0x45aa2f({'code':0xc8,'message':_0x1dcbb4});}catch(_0x27a776){logger['error'](_0x27a776['stack']);return _0x54b0be(_0x2f8236[_0xb270('0x2e')](0x1f4,_0x27a776));}}logger[_0xb270('0x2e')](_0xb270('0x35'));return _0x54b0be(_0x2f8236[_0xb270('0x2e')](0x1f4,_0xb270('0x35')));});},'AgentCapacity':function(_0x1de0a5){var _0x217249=this;return new Promise(function(_0x9a968f,_0x2b0027){if(_0x3eb9a6[_0xb270('0x37')][_0xb270('0x3a')](_0x1de0a5['id'])){for(var _0xf1183 in _0x1de0a5[_0xb270('0x3b')]){if(_0x1de0a5['capacity'][_0xb270('0x3a')](_0xf1183)){if(_0x3eb9a6[_0xb270('0x37')][_0x1de0a5['id']]['hasOwnProperty'](_0xf1183+_0xb270('0x3c'))){_0x3eb9a6['agents'][_0x1de0a5['id']][_0xf1183+_0xb270('0x3c')]=parseInt(_0x1de0a5[_0xb270('0x3b')][_0xf1183],0xa);}}}_0x3eb9a6['agents'][_0x1de0a5['id']][_0xb270('0x3d')]();return _0x9a968f({'code':0xc8,'message':_0x3eb9a6['agents'][_0x1de0a5['id']]});}else{return _0x2b0027(_0x217249[_0xb270('0x2e')](0x1f4,_0xb270('0x3e')));}});},'Agents':function(_0x19b0fe){return new Promise(function(_0x28b178,_0x2a8b40){var _0x146216=_[_0xb270('0x3f')](_0x3eb9a6[_0xb270('0x37')]);_0x28b178({'count':_0x146216['length'],'rows':_0x146216});});},'ChatQueues':function(_0x183122){return new Promise(function(_0x49b587,_0x1a3485){var _0x8e33ca=[];for(var _0x8ec16e in _0x3eb9a6[_0xb270('0x40')]){if(_0x3eb9a6[_0xb270('0x40')]['hasOwnProperty'](_0x8ec16e)){var _0x95edff=_0x3eb9a6['chatQueues'][_0x8ec16e];var _0x44288f={'id':_0x95edff['id'],'available':_0x95edff[_0xb270('0x41')],'loggedIn':_0x95edff['loggedIn'],'name':_0x95edff[_0xb270('0x42')],'paused':_0x95edff[_0xb270('0x43')],'waiting':_0x95edff['waiting']};_0x8e33ca[_0xb270('0x1b')](_0x44288f);}}_0x49b587({'count':_0x8e33ca[_0xb270('0x15')],'rows':_0x8e33ca});});},'MailQueues':function(_0x3cbed5){return new Promise(function(_0x2e2a2a,_0x282fab){var _0x279b7c=[];for(var _0x2551ab in _0x3eb9a6[_0xb270('0x44')]){if(_0x3eb9a6[_0xb270('0x44')][_0xb270('0x3a')](_0x2551ab)){var _0x1f9241=_0x3eb9a6['mailQueues'][_0x2551ab];var _0x50d46e={'id':_0x1f9241['id'],'available':_0x1f9241['available'],'loggedIn':_0x1f9241[_0xb270('0x45')],'name':_0x1f9241['name'],'paused':_0x1f9241[_0xb270('0x43')],'waiting':_0x1f9241[_0xb270('0x46')]};_0x279b7c[_0xb270('0x1b')](_0x50d46e);}}_0x2e2a2a({'count':_0x279b7c[_0xb270('0x15')],'rows':_0x279b7c});});},'OpenchannelQueues':function(_0x227792){return new Promise(function(_0x3393c9,_0x232c42){var _0x4a004b=[];for(var _0x48256a in _0x3eb9a6[_0xb270('0x47')]){if(_0x3eb9a6[_0xb270('0x47')][_0xb270('0x3a')](_0x48256a)){var _0x49fc8f=_0x3eb9a6[_0xb270('0x47')][_0x48256a];var _0x1505f8={'id':_0x49fc8f['id'],'available':_0x49fc8f[_0xb270('0x41')],'loggedIn':_0x49fc8f['loggedIn'],'name':_0x49fc8f['name'],'paused':_0x49fc8f[_0xb270('0x43')],'waiting':_0x49fc8f[_0xb270('0x46')]};_0x4a004b[_0xb270('0x1b')](_0x1505f8);}}_0x3393c9({'count':_0x4a004b[_0xb270('0x15')],'rows':_0x4a004b});});},'SmsQueues':function(_0x52e906){return new Promise(function(_0x210375,_0x23c92a){var _0x173676=[];for(var _0x34d786 in _0x3eb9a6['smsQueues']){if(_0x3eb9a6[_0xb270('0x48')][_0xb270('0x3a')](_0x34d786)){var _0xc60a25=_0x3eb9a6['smsQueues'][_0x34d786];var _0x5a7fd8={'id':_0xc60a25['id'],'available':_0xc60a25['available'],'loggedIn':_0xc60a25[_0xb270('0x45')],'name':_0xc60a25[_0xb270('0x42')],'paused':_0xc60a25[_0xb270('0x43')],'waiting':_0xc60a25[_0xb270('0x46')]};_0x173676[_0xb270('0x1b')](_0x5a7fd8);}}_0x210375({'count':_0x173676[_0xb270('0x15')],'rows':_0x173676});});},'FaxQueues':function(_0x27527f){return new Promise(function(_0x2c84db,_0x292210){var _0x473f01=[];for(var _0x5443f9 in _0x3eb9a6['faxQueues']){if(_0x3eb9a6[_0xb270('0x49')][_0xb270('0x3a')](_0x5443f9)){var _0x4e5407=_0x3eb9a6[_0xb270('0x49')][_0x5443f9];var _0x218fc1={'id':_0x4e5407['id'],'available':_0x4e5407['available'],'loggedIn':_0x4e5407[_0xb270('0x45')],'name':_0x4e5407[_0xb270('0x42')],'paused':_0x4e5407[_0xb270('0x43')],'waiting':_0x4e5407['waiting']};_0x473f01['push'](_0x218fc1);}}_0x2c84db({'count':_0x473f01[_0xb270('0x15')],'rows':_0x473f01});});},'WhatsappQueues':function(_0x5651a5){return new Promise(function(_0x1474b4,_0x503810){var _0x4bc517=[];for(var _0x30c905 in _0x3eb9a6['whatsappQueues']){if(_0x3eb9a6['whatsappQueues']['hasOwnProperty'](_0x30c905)){var _0x47fb92=_0x3eb9a6[_0xb270('0x4a')][_0x30c905];var _0xcf70f5={'id':_0x47fb92['id'],'available':_0x47fb92[_0xb270('0x41')],'loggedIn':_0x47fb92[_0xb270('0x45')],'name':_0x47fb92[_0xb270('0x42')],'paused':_0x47fb92[_0xb270('0x43')],'waiting':_0x47fb92[_0xb270('0x46')]};_0x4bc517[_0xb270('0x1b')](_0xcf70f5);}}_0x1474b4({'count':_0x4bc517[_0xb270('0x15')],'rows':_0x4bc517});});},'ChatQueuesWaitingInteractions':function(_0x1dc9c4){return new Promise(function(_0xc228f1,_0x3c7ae1){var _0x2c10a6=_[_0xb270('0x3f')](_0x3eb9a6['chatQueuesWaitingInteractions']);_0xc228f1({'count':_0x2c10a6['length'],'rows':_0x2c10a6});});},'MailQueuesWaitingInteractions':function(_0x3e44f5){return new Promise(function(_0x34930a,_0x20ef22){var _0xebddf6=_[_0xb270('0x3f')](_0x3eb9a6[_0xb270('0x4b')]);_0x34930a({'count':_0xebddf6[_0xb270('0x15')],'rows':_0xebddf6});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f288f){return new Promise(function(_0xb675bf,_0x9e367e){var _0x563fda=_[_0xb270('0x3f')](_0x3eb9a6[_0xb270('0x4c')]);_0xb675bf({'count':_0x563fda[_0xb270('0x15')],'rows':_0x563fda});});},'SmsQueuesWaitingInteractions':function(_0x2159e5){return new Promise(function(_0x17fe59,_0x22252b){var _0x272f9d=_[_0xb270('0x3f')](_0x3eb9a6[_0xb270('0x4d')]);_0x17fe59({'count':_0x272f9d[_0xb270('0x15')],'rows':_0x272f9d});});},'FaxQueuesWaitingInteractions':function(_0x26bc9c){return new Promise(function(_0x41ce0a,_0x213431){var _0x4030a2=_[_0xb270('0x3f')](_0x3eb9a6['faxQueuesWaitingInteractions']);_0x41ce0a({'count':_0x4030a2[_0xb270('0x15')],'rows':_0x4030a2});});},'WhatsappQueuesWaitingInteractions':function(_0x54fd5a){return new Promise(function(_0x333a61,_0x18d212){var _0x5d1c25=_['values'](_0x3eb9a6['whatsappQueuesWaitingInteractions']);_0x333a61({'count':_0x5d1c25[_0xb270('0x15')],'rows':_0x5d1c25});});}};var _0x4687ad=jayson[_0xb270('0x4e')](_0x231d74)['http']();_0x4687ad['on'](_0xb270('0x2e'),function(_0x33330f){logger['error'](JSON['stringify'](_0x33330f));return _0x1e0208(_0x33330f);});_0x4687ad['listen'](0x232c,'127.0.0.1',function(){console[_0xb270('0x4f')](_0xb270('0x50'),0x232c);return _0x50c9b3(_0xb270('0x51')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3ea686d..d86bba5 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 _0x2d54=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','stack'];(function(_0x18261f,_0x3eddfa){var _0x1c5910=function(_0x57224e){while(--_0x57224e){_0x18261f['push'](_0x18261f['shift']());}};_0x1c5910(++_0x3eddfa);}(_0x2d54,0x186));var _0x42d5=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x2d54[_0x43fdf8];return _0x1160c6;};'use strict';var util=require('util');var BPromise=require(_0x42d5('0x0'));var jayson=require(_0x42d5('0x1'));var _=require(_0x42d5('0x2'));var logger=require(_0x42d5('0x3'))(_0x42d5('0x4'));var client=jayson[_0x42d5('0x5')][_0x42d5('0x6')]({'port':0x232a});function request(_0x5ce332,_0x36073d){return new BPromise(function(_0x2ea9b3,_0x1f2186){return client[_0x42d5('0x7')](_0x5ce332,_0x36073d)[_0x42d5('0x8')](function(_0x522940){if(_0x522940[_0x42d5('0x9')]){return _0x1f2186(_0x522940[_0x42d5('0x9')][_0x42d5('0xa')]);}else{return _0x2ea9b3(_0x522940[_0x42d5('0xb')]);}})['catch'](function(_0x454074){return _0x1f2186(_0x454074);});});}exports[_0x42d5('0xc')]=function(_0x2627ab,_0x3bd8ea,_0xbccef7){return function(_0x2e27b8){if(_0xbccef7[_0x42d5('0xd')]&&!_0xbccef7[_0x42d5('0xd')][_0x2627ab]){logger['info'](_0x42d5('0xe'),_0x2627ab);return _0x2e27b8[_0x42d5('0xf')]();}var _0x49b0c7=[];for(var _0x463957=0x0;_0x463957<_0x3bd8ea[_0x42d5('0x10')];_0x463957+=0x1){_0x49b0c7[_0x42d5('0x11')](request(_0x42d5('0x12'),{'command':util['format'](_0x42d5('0x13'),_0x3bd8ea[_0x463957])})['then'](function(_0x5b5c9b){return _0x5b5c9b&&_0x5b5c9b['message']&&_0x5b5c9b[_0x42d5('0xa')][_0x42d5('0x14')]('true')>=0x0?!![]:![];})['catch'](function(_0x33bd95){logger[_0x42d5('0x9')]('[%s][INTERVAL]\x20%s',_0x2627ab,_0x3bd8ea[_0x463957]);}));}BPromise[_0x42d5('0x15')](_0x49b0c7)[_0x42d5('0x8')](function(_0x49827d){var _0x30ce49=_[_0x42d5('0x16')](_0x49827d);logger[_0x42d5('0x17')](_0x42d5('0x18'),_0x2627ab,_0x3bd8ea[_0x42d5('0x19')](_0x42d5('0x1a')),_0x30ce49);_0x2e27b8[_0x42d5('0x1b')](_0x30ce49);})[_0x42d5('0x1c')](function(_0x1242b0){console['log'](_0x1242b0);logger[_0x42d5('0x9')](_0x42d5('0x18'),_0x2627ab,_0x3bd8ea[_0x42d5('0x19')](_0x42d5('0x1a')),_0x1242b0[_0x42d5('0x1d')]);_0x2e27b8[_0x42d5('0xf')]();});};}; \ No newline at end of file +var _0x4437=['error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','message','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then'];(function(_0x1ada8f,_0x4f4eb9){var _0x105975=function(_0xa4bd03){while(--_0xa4bd03){_0x1ada8f['push'](_0x1ada8f['shift']());}};_0x105975(++_0x4f4eb9);}(_0x4437,0x19a));var _0x7443=function(_0x116a60,_0x48d08d){_0x116a60=_0x116a60-0x0;var _0x1d1185=_0x4437[_0x116a60];return _0x1d1185;};'use strict';var util=require(_0x7443('0x0'));var BPromise=require(_0x7443('0x1'));var jayson=require(_0x7443('0x2'));var _=require(_0x7443('0x3'));var logger=require(_0x7443('0x4'))(_0x7443('0x5'));var client=jayson[_0x7443('0x6')][_0x7443('0x7')]({'port':0x232a});function request(_0x39c930,_0x3e5450){return new BPromise(function(_0x18b0d5,_0x6b7de){return client[_0x7443('0x8')](_0x39c930,_0x3e5450)[_0x7443('0x9')](function(_0x1d67d4){if(_0x1d67d4[_0x7443('0xa')]){return _0x6b7de(_0x1d67d4[_0x7443('0xa')]['message']);}else{return _0x18b0d5(_0x1d67d4['result']);}})[_0x7443('0xb')](function(_0x289920){return _0x6b7de(_0x289920);});});}exports[_0x7443('0xc')]=function(_0x4039cc,_0x2ad10d,_0x574d38){return function(_0x346066){if(_0x574d38[_0x7443('0xd')]&&!_0x574d38[_0x7443('0xd')][_0x4039cc]){logger[_0x7443('0xe')](_0x7443('0xf'),_0x4039cc);return _0x346066[_0x7443('0x10')]();}var _0x2da711=[];for(var _0x4d2eb7=0x0;_0x4d2eb7<_0x2ad10d['length'];_0x4d2eb7+=0x1){_0x2da711[_0x7443('0x11')](request('Command',{'command':util['format']('iftime\x20%s',_0x2ad10d[_0x4d2eb7])})[_0x7443('0x9')](function(_0x30fea1){return _0x30fea1&&_0x30fea1[_0x7443('0x12')]&&_0x30fea1[_0x7443('0x12')][_0x7443('0x13')](_0x7443('0x14'))>=0x0?!![]:![];})['catch'](function(_0x3099e7){logger[_0x7443('0xa')]('[%s][INTERVAL]\x20%s',_0x4039cc,_0x2ad10d[_0x4d2eb7]);}));}BPromise[_0x7443('0x15')](_0x2da711)[_0x7443('0x9')](function(_0x3089c0){var _0x32b6d5=_['some'](_0x3089c0);logger[_0x7443('0xe')](_0x7443('0x16'),_0x4039cc,_0x2ad10d['join'](_0x7443('0x17')),_0x32b6d5);_0x346066[_0x7443('0x18')](_0x32b6d5);})[_0x7443('0xb')](function(_0x2acc23){console[_0x7443('0x19')](_0x2acc23);logger[_0x7443('0xa')](_0x7443('0x16'),_0x4039cc,_0x2ad10d[_0x7443('0x1a')](_0x7443('0x17')),_0x2acc23[_0x7443('0x1b')]);_0x346066[_0x7443('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 22e3e6a..aedabd2 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 _0x4984=['CreateVoiceAgentReport','request','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','isNil','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','agent','util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentcomplete','acwtime','agentacw','acwTimeout'];(function(_0x3bd4ec,_0x4cb5ce){var _0x5062dc=function(_0x1e14a3){while(--_0x1e14a3){_0x3bd4ec['push'](_0x3bd4ec['shift']());}};_0x5062dc(++_0x4cb5ce);}(_0x4984,0xa2));var _0x4498=function(_0x257603,_0x5eeacd){_0x257603=_0x257603-0x0;var _0x5b58f3=_0x4984[_0x257603];return _0x5b58f3;};'use strict';var _=require('lodash');var util=require(_0x4498('0x0'));var utils=require(_0x4498('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xe5e92d,_0x2575cb){utils[_0x4498('0x2')](util['format'](_0x4498('0x3'),_0xe5e92d[_0x4498('0x4')],_0xe5e92d['channel'],_0xe5e92d[_0x4498('0x5')],_0xe5e92d[_0x4498('0x6')],_0xe5e92d['interface'],_0xe5e92d[_0x4498('0x7')],_0xe5e92d[_0x4498('0x8')],_0xe5e92d['lastevent']));if(_0xe5e92d['queue']){utils[_0x4498('0x9')](_0xe5e92d[_0x4498('0x5')])[_0x4498('0xa')](function(_0x3556bf){if(_0x3556bf){_0xe5e92d[_0x4498('0xb')]=_0x3556bf[_0x4498('0xb')];_0xe5e92d['agentacw']=_0xe5e92d[_0x4498('0xc')]?_0x3556bf['acw']:![];_0xe5e92d[_0x4498('0xd')]=_0xe5e92d[_0x4498('0xe')]?_0x3556bf[_0x4498('0xf')]:0x0;}utils['request'](_0x4498('0x10'),_0xe5e92d);});}else{utils[_0x4498('0x11')]('CreateVoiceAgentReport',_0xe5e92d);}if(_0x2575cb){delete transfers[_0xe5e92d[_0x4498('0x4')]];}else{delete agents[_0xe5e92d[_0x4498('0x12')]];}}exports[_0x4498('0x13')]=function(_0x2cf316){try{utils['debug'](util[_0x4498('0x14')](_0x4498('0x15'),_0x2cf316[_0x4498('0x4')]),_0x2cf316);agents[_0x2cf316[_0x4498('0x12')]]=_0x2cf316;agents[_0x2cf316[_0x4498('0x12')]]['agentcalledAt']=utils[_0x4498('0x16')]();agents[_0x2cf316[_0x4498('0x12')]][_0x4498('0x17')]=_0x4498('0x18');agents[_0x2cf316[_0x4498('0x12')]][_0x4498('0x8')]=null;agents[_0x2cf316[_0x4498('0x12')]][_0x4498('0x19')]=null;utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x1a'),_0x2cf316['uniqueid'],agents[_0x2cf316[_0x4498('0x12')]][_0x4498('0x6')],_0x2cf316[_0x4498('0x12')]));}catch(_0x6b0455){utils[_0x4498('0x1b')](util[_0x4498('0x14')](_0x4498('0x15'),_0x2cf316[_0x4498('0x4')]),_0x6b0455);}};exports[_0x4498('0x1c')]=function(_0x35dbaf){try{if(!_['isNil'](agents[_0x35dbaf[_0x4498('0x12')]])){utils[_0x4498('0x1d')](util[_0x4498('0x14')](_0x4498('0x1e'),_0x35dbaf[_0x4498('0x4')]),_0x35dbaf);utils[_0x4498('0x2')](util['format'](_0x4498('0x1f'),_0x35dbaf['uniqueid'],agents[_0x35dbaf[_0x4498('0x12')]][_0x4498('0x6')],_0x35dbaf[_0x4498('0x12')]));agents[_0x35dbaf[_0x4498('0x12')]][_0x4498('0x1c')]=!![];agents[_0x35dbaf[_0x4498('0x12')]]['agentringnoanswerAt']=utils[_0x4498('0x16')]();agents[_0x35dbaf[_0x4498('0x12')]]['lastevent']=_0x4498('0x20');agents[_0x35dbaf['destuniqueid']][_0x4498('0x21')]=_0x4498('0x20');agents[_0x35dbaf[_0x4498('0x12')]][_0x4498('0x22')]=_0x35dbaf[_0x4498('0x23')]?parseInt(_0x35dbaf[_0x4498('0x23')])/0x3e8:0x0;agents[_0x35dbaf[_0x4498('0x12')]][_0x4498('0x24')]=0x0;unanswered[_0x4498('0x25')](_0x35dbaf[_0x4498('0x12')]);}}catch(_0x17532b){utils[_0x4498('0x1b')](util[_0x4498('0x14')](_0x4498('0x1e'),_0x35dbaf[_0x4498('0x4')]),_0x17532b);}};exports[_0x4498('0x26')]=function(_0x32004f){try{_[_0x4498('0x27')](agents,function(_0x210cdb,_0x14f648){if(_0x210cdb['uniqueid']==_0x32004f['uniqueid']&&!_[_0x4498('0x28')](unanswered,_0x210cdb[_0x4498('0x12')])){utils[_0x4498('0x1d')](util[_0x4498('0x14')](_0x4498('0x29'),_0x32004f[_0x4498('0x4')]),_0x32004f);utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x2a'),_0x32004f[_0x4498('0x4')],_0x210cdb['membername'],_0x210cdb[_0x4498('0x12')]));_0x210cdb['agentringnoanswer']=!![];_0x210cdb[_0x4498('0x2b')]=utils[_0x4498('0x16')]();_0x210cdb[_0x4498('0x17')]=_0x4498('0x2c');_0x210cdb['reason']=_0x4498('0x2c');_0x210cdb['holdtime']=_0x32004f[_0x4498('0x22')];_0x210cdb[_0x4498('0x24')]=0x0;writeDB(_0x210cdb);}});}catch(_0x1b3989){utils[_0x4498('0x1b')](util[_0x4498('0x14')]('[%s][agents][queuecallerabandon]',_0x32004f['uniqueid']),_0x1b3989);}};exports[_0x4498('0x2d')]=function(_0x3ea8d5){try{if(agents[_0x3ea8d5[_0x4498('0x12')]]){utils['debug'](util[_0x4498('0x14')](_0x4498('0x2e'),_0x3ea8d5[_0x4498('0x4')]),_0x3ea8d5);utils['info'](util[_0x4498('0x14')](_0x4498('0x2f'),_0x3ea8d5[_0x4498('0x4')],agents[_0x3ea8d5[_0x4498('0x12')]][_0x4498('0x6')],_0x3ea8d5[_0x4498('0x12')]));agents[_0x3ea8d5[_0x4498('0x12')]]['agentconnectAt']=utils[_0x4498('0x16')]();agents[_0x3ea8d5['destuniqueid']]['connectedlinenum']=_0x3ea8d5[_0x4498('0x8')];agents[_0x3ea8d5[_0x4498('0x12')]][_0x4498('0x19')]=_0x3ea8d5[_0x4498('0x19')];agents[_0x3ea8d5['destuniqueid']][_0x4498('0x22')]=_0x3ea8d5[_0x4498('0x23')];agents[_0x3ea8d5[_0x4498('0x12')]][_0x4498('0x17')]='connect';_[_0x4498('0x27')](agents,function(_0x43458e,_0x22ab60){if(_0x43458e[_0x4498('0x12')]!=_0x3ea8d5[_0x4498('0x12')]&&_0x43458e[_0x4498('0x4')]==_0x3ea8d5['uniqueid']){_0x43458e[_0x4498('0x24')]=0x0;_0x43458e[_0x4498('0x22')]=_0x3ea8d5[_0x4498('0x23')];_0x43458e['agentringnoanswer']=!![];_0x43458e['agentringnoanswerAt']=utils[_0x4498('0x16')]();_0x43458e[_0x4498('0x17')]=_0x4498('0x30');_0x43458e[_0x4498('0x21')]=_0x4498('0x30');_0x43458e[_0x4498('0x31')]=_0x3ea8d5[_0x4498('0x12')];_0x43458e[_0x4498('0x32')]=_0x3ea8d5[_0x4498('0x6')];writeDB(_0x43458e);}});}}catch(_0x1b4f05){utils[_0x4498('0x1b')](util[_0x4498('0x14')]('[%s][agents][agentconnect]',_0x3ea8d5[_0x4498('0x4')]),_0x1b4f05);}};exports[_0x4498('0xc')]=function(_0x2038b5){try{if(!_['isNil'](agents[_0x2038b5[_0x4498('0x12')]])){utils[_0x4498('0x1d')](util[_0x4498('0x14')](_0x4498('0x33'),_0x2038b5[_0x4498('0x4')]),_0x2038b5);utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x34'),_0x2038b5[_0x4498('0x4')],agents[_0x2038b5[_0x4498('0x12')]][_0x4498('0x6')],_0x2038b5[_0x4498('0x12')]));agents[_0x2038b5[_0x4498('0x12')]]['agentcomplete']=!![];agents[_0x2038b5[_0x4498('0x12')]][_0x4498('0x35')]=utils['now']();agents[_0x2038b5[_0x4498('0x12')]][_0x4498('0x24')]=utils[_0x4498('0x36')](agents[_0x2038b5['destuniqueid']][_0x4498('0x35')],agents[_0x2038b5[_0x4498('0x12')]][_0x4498('0x37')]);agents[_0x2038b5[_0x4498('0x12')]][_0x4498('0x21')]=_0x2038b5[_0x4498('0x21')];agents[_0x2038b5[_0x4498('0x12')]]['lastevent']='complete';writeDB(agents[_0x2038b5[_0x4498('0x12')]]);}}catch(_0x440399){utils[_0x4498('0x1b')](util[_0x4498('0x14')](_0x4498('0x33'),_0x2038b5[_0x4498('0x4')]),_0x440399);}};exports[_0x4498('0x38')]=function(_0x393fa3){try{if(!_['isNil'](agents[_0x393fa3[_0x4498('0x39')]])){utils[_0x4498('0x1d')](util[_0x4498('0x14')]('[%s][agents][blindtransfer]',_0x393fa3['uniqueid']),_0x393fa3);utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x3a'),_0x393fa3[_0x4498('0x4')],agents[_0x393fa3['transfereruniqueid']][_0x4498('0x6')],agents[_0x393fa3[_0x4498('0x39')]]['uniqueid']));agents[_0x393fa3['transfereruniqueid']][_0x4498('0x3b')]=!![];agents[_0x393fa3['transfereruniqueid']][_0x4498('0x3c')]='blind';agents[_0x393fa3[_0x4498('0x39')]]['transferexten']=_0x393fa3[_0x4498('0x3d')];agents[_0x393fa3[_0x4498('0x39')]][_0x4498('0x3e')]=agents[_0x393fa3[_0x4498('0x39')]][_0x4498('0x4')];}}catch(_0x46a5d8){utils[_0x4498('0x1b')](util[_0x4498('0x14')]('[%s][agents][blindtransfer]',_0x393fa3[_0x4498('0x4')]),_0x46a5d8);}};exports[_0x4498('0x3f')]=function(_0x57e824){try{utils[_0x4498('0x1d')](util[_0x4498('0x14')](_0x4498('0x40'),_0x57e824[_0x4498('0x41')]),_0x57e824);if(_0x57e824[_0x4498('0x41')]==_0x57e824[_0x4498('0x42')]){if(!_[_0x4498('0x43')](agents[_0x57e824[_0x4498('0x44')]])){utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x45'),_0x57e824[_0x4498('0x41')],agents[_0x57e824[_0x4498('0x44')]][_0x4498('0x6')]));agents[_0x57e824[_0x4498('0x44')]][_0x4498('0x3b')]=!![];agents[_0x57e824[_0x4498('0x44')]][_0x4498('0x3c')]=_0x4498('0x46');agents[_0x57e824[_0x4498('0x44')]][_0x4498('0x47')]=_0x57e824[_0x4498('0x48')];agents[_0x57e824[_0x4498('0x44')]][_0x4498('0x3e')]=_0x57e824[_0x4498('0x41')];}if(_0x57e824[_0x4498('0x49')]&&agents[_0x57e824['transfereeuniqueid']]){agents[_0x57e824[_0x4498('0x49')]][_0x4498('0x4a')]=0x1;transfers[_0x57e824[_0x4498('0x49')]]=_[_0x4498('0x4b')](agents[_0x57e824[_0x4498('0x49')]]);transfers[_0x57e824[_0x4498('0x49')]][_0x4498('0x7')]=agents[_0x57e824['secondtransfereruniqueid']][_0x4498('0x7')];transfers[_0x57e824[_0x4498('0x49')]][_0x4498('0x4c')]=agents[_0x57e824['secondtransfereruniqueid']][_0x4498('0x4c')];transfers[_0x57e824[_0x4498('0x49')]][_0x4498('0x4d')]=utils[_0x4498('0x16')]();transfers[_0x57e824['transfereeuniqueid']][_0x4498('0x37')]=utils[_0x4498('0x16')]();transfers[_0x57e824['transfereeuniqueid']][_0x4498('0x22')]=0x0;transfers[_0x57e824['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x57e824[_0x4498('0x44')]==_0x57e824[_0x4498('0x4e')]){if(!_['isNil'](agents[_0x57e824['origtransfereruniqueid']])){utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x45'),_0x57e824[_0x4498('0x41')],agents[_0x57e824[_0x4498('0x41')]][_0x4498('0x6')]));agents[_0x57e824[_0x4498('0x41')]][_0x4498('0x3b')]=!![];agents[_0x57e824[_0x4498('0x41')]][_0x4498('0x3c')]=_0x4498('0x46');agents[_0x57e824[_0x4498('0x41')]][_0x4498('0x47')]=_0x57e824[_0x4498('0x4f')];agents[_0x57e824['origtransfereruniqueid']][_0x4498('0x3e')]=_0x57e824[_0x4498('0x44')];}if(_0x57e824[_0x4498('0x50')]&&agents[_0x57e824['transfertargetuniqueid']]){agents[_0x57e824[_0x4498('0x50')]][_0x4498('0x4a')]=0x1;transfers[_0x57e824[_0x4498('0x50')]]=_[_0x4498('0x4b')](agents[_0x57e824[_0x4498('0x50')]]);transfers[_0x57e824[_0x4498('0x50')]]['calleridnum']=agents[_0x57e824[_0x4498('0x41')]]['calleridnum'];transfers[_0x57e824[_0x4498('0x50')]][_0x4498('0x4c')]=agents[_0x57e824[_0x4498('0x41')]][_0x4498('0x4c')];transfers[_0x57e824['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x57e824[_0x4498('0x50')]][_0x4498('0x37')]=utils['now']();transfers[_0x57e824['transfertargetuniqueid']][_0x4498('0x22')]=0x0;transfers[_0x57e824['transfertargetuniqueid']][_0x4498('0x4a')]=0x2;}}}catch(_0x22643a){utils[_0x4498('0x1b')](util[_0x4498('0x14')]('[%s][agents][attendedtransfer]',_0x57e824[_0x4498('0x41')]),_0x22643a);}};exports[_0x4498('0x51')]=function(_0x21a4d1){try{utils[_0x4498('0x1d')](util[_0x4498('0x14')]('[%s][agents][hangup]',_0x21a4d1[_0x4498('0x4')]),_0x21a4d1);if(agents[_0x21a4d1['uniqueid']]&&agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x21')]===_0x4498('0x20')){if(_0x21a4d1[_0x4498('0x52')]==='21'){agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x21')]=_0x4498('0x53');agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x17')]=_0x4498('0x53');}utils['info'](util[_0x4498('0x14')](_0x4498('0x54'),_0x21a4d1[_0x4498('0x4')],agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x6')],agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x21')],agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x17')]));writeDB(agents[_0x21a4d1[_0x4498('0x4')]]);var _0x4a60e2=unanswered[_0x4498('0x55')](_0x21a4d1[_0x4498('0x4')]);if(_0x4a60e2>-0x1){unanswered[_0x4498('0x56')](_0x4a60e2,0x1);}}if(transfers[_0x21a4d1['uniqueid']]){transfers[_0x21a4d1[_0x4498('0x4')]]['agentcomplete']=!![];transfers[_0x21a4d1[_0x4498('0x4')]]['agentcompleteAt']=utils[_0x4498('0x16')]();transfers[_0x21a4d1['uniqueid']]['talktime']=utils[_0x4498('0x36')](transfers[_0x21a4d1['uniqueid']][_0x4498('0x35')],transfers[_0x21a4d1[_0x4498('0x4')]]['agentconnectAt']);transfers[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x21')]='agent';transfers[_0x21a4d1['uniqueid']][_0x4498('0x17')]=_0x4498('0x57');utils[_0x4498('0x2')](util[_0x4498('0x14')](_0x4498('0x54'),_0x21a4d1['uniqueid'],transfers[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x6')],transfers[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x21')],transfers[_0x21a4d1['uniqueid']][_0x4498('0x17')]));writeDB(transfers[_0x21a4d1['uniqueid']],!![]);}if(agents[_0x21a4d1[_0x4498('0x4')]]&&agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x37')]){agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0xc')]=!![];agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x35')]=utils[_0x4498('0x16')]();agents[_0x21a4d1['uniqueid']][_0x4498('0x24')]=utils[_0x4498('0x36')](agents[_0x21a4d1[_0x4498('0x4')]]['agentcompleteAt'],agents[_0x21a4d1[_0x4498('0x4')]]['agentconnectAt']);agents[_0x21a4d1['uniqueid']][_0x4498('0x21')]=agents[_0x21a4d1[_0x4498('0x4')]]['transfer']?_0x4498('0x3b'):_0x4498('0x58');agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x17')]=_0x4498('0x57');utils[_0x4498('0x2')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x21a4d1[_0x4498('0x4')],agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x6')],agents[_0x21a4d1[_0x4498('0x4')]][_0x4498('0x21')],agents[_0x21a4d1[_0x4498('0x4')]]['lastevent']));writeDB(agents[_0x21a4d1['uniqueid']]);}}catch(_0x125d4b){utils[_0x4498('0x1b')](util['format']('[%s][agents][hangup]',_0x21a4d1[_0x4498('0x4')]),_0x125d4b);}}; \ No newline at end of file +var _0x1358=['./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','now','lastevent','reason','timeout','ringtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','agentcalledAt','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util'];(function(_0x187443,_0x24c80f){var _0x3ae339=function(_0x78e7e7){while(--_0x78e7e7){_0x187443['push'](_0x187443['shift']());}};_0x3ae339(++_0x24c80f);}(_0x1358,0x1b6));var _0x8135=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1358[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8135('0x0'));var util=require(_0x8135('0x1'));var utils=require(_0x8135('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x49dc2b,_0x39387c){utils['info'](util[_0x8135('0x3')](_0x8135('0x4'),_0x49dc2b['uniqueid'],_0x49dc2b[_0x8135('0x5')],_0x49dc2b[_0x8135('0x6')],_0x49dc2b[_0x8135('0x7')],_0x49dc2b['interface'],_0x49dc2b[_0x8135('0x8')],_0x49dc2b[_0x8135('0x9')],_0x49dc2b['lastevent']));if(_0x49dc2b['queue']){utils[_0x8135('0xa')](_0x49dc2b['queue'])[_0x8135('0xb')](function(_0x21f30f){if(_0x21f30f){_0x49dc2b[_0x8135('0xc')]=_0x21f30f['type'];_0x49dc2b[_0x8135('0xd')]=_0x49dc2b[_0x8135('0xe')]?_0x21f30f[_0x8135('0xf')]:![];_0x49dc2b[_0x8135('0x10')]=_0x49dc2b[_0x8135('0xd')]?_0x21f30f[_0x8135('0x11')]:0x0;}utils[_0x8135('0x12')]('CreateVoiceAgentReport',_0x49dc2b);});}else{utils[_0x8135('0x12')](_0x8135('0x13'),_0x49dc2b);}if(_0x39387c){delete transfers[_0x49dc2b['uniqueid']];}else{delete agents[_0x49dc2b[_0x8135('0x14')]];}}exports[_0x8135('0x15')]=function(_0x4a3fa8){try{utils[_0x8135('0x16')](util[_0x8135('0x3')](_0x8135('0x17'),_0x4a3fa8[_0x8135('0x18')]),_0x4a3fa8);agents[_0x4a3fa8['destuniqueid']]=_0x4a3fa8;agents[_0x4a3fa8[_0x8135('0x14')]]['agentcalledAt']=utils['now']();agents[_0x4a3fa8[_0x8135('0x14')]]['lastevent']='called';agents[_0x4a3fa8['destuniqueid']][_0x8135('0x9')]=null;agents[_0x4a3fa8[_0x8135('0x14')]][_0x8135('0x19')]=null;utils[_0x8135('0x1a')](util[_0x8135('0x3')](_0x8135('0x1b'),_0x4a3fa8['uniqueid'],agents[_0x4a3fa8[_0x8135('0x14')]][_0x8135('0x7')],_0x4a3fa8[_0x8135('0x14')]));}catch(_0x4bdfce){utils[_0x8135('0x1c')](util['format'](_0x8135('0x17'),_0x4a3fa8[_0x8135('0x18')]),_0x4bdfce);}};exports[_0x8135('0x1d')]=function(_0x1089c6){try{if(!_[_0x8135('0x1e')](agents[_0x1089c6[_0x8135('0x14')]])){utils[_0x8135('0x16')](util[_0x8135('0x3')](_0x8135('0x1f'),_0x1089c6[_0x8135('0x18')]),_0x1089c6);utils['info'](util[_0x8135('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1089c6[_0x8135('0x18')],agents[_0x1089c6[_0x8135('0x14')]][_0x8135('0x7')],_0x1089c6['destuniqueid']));agents[_0x1089c6['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1089c6['destuniqueid']][_0x8135('0x20')]=utils[_0x8135('0x21')]();agents[_0x1089c6[_0x8135('0x14')]][_0x8135('0x22')]='timeout';agents[_0x1089c6['destuniqueid']][_0x8135('0x23')]=_0x8135('0x24');agents[_0x1089c6[_0x8135('0x14')]]['holdtime']=_0x1089c6['ringtime']?parseInt(_0x1089c6[_0x8135('0x25')])/0x3e8:0x0;agents[_0x1089c6[_0x8135('0x14')]][_0x8135('0x26')]=0x0;unanswered['push'](_0x1089c6[_0x8135('0x14')]);}}catch(_0x5a9f31){utils['error'](util[_0x8135('0x3')]('[%s][agents][agentringnoanswer]',_0x1089c6['uniqueid']),_0x5a9f31);}};exports[_0x8135('0x27')]=function(_0x5cf552){try{_[_0x8135('0x28')](agents,function(_0x3c0220,_0x3fca1f){if(_0x3c0220['uniqueid']==_0x5cf552[_0x8135('0x18')]&&!_['includes'](unanswered,_0x3c0220[_0x8135('0x14')])){utils[_0x8135('0x16')](util[_0x8135('0x3')](_0x8135('0x29'),_0x5cf552['uniqueid']),_0x5cf552);utils['info'](util['format'](_0x8135('0x2a'),_0x5cf552['uniqueid'],_0x3c0220['membername'],_0x3c0220[_0x8135('0x14')]));_0x3c0220[_0x8135('0x1d')]=!![];_0x3c0220[_0x8135('0x20')]=utils[_0x8135('0x21')]();_0x3c0220[_0x8135('0x22')]=_0x8135('0x2b');_0x3c0220['reason']=_0x8135('0x2b');_0x3c0220[_0x8135('0x2c')]=_0x5cf552[_0x8135('0x2c')];_0x3c0220[_0x8135('0x26')]=0x0;writeDB(_0x3c0220);}});}catch(_0x38fd62){utils[_0x8135('0x1c')](util['format']('[%s][agents][queuecallerabandon]',_0x5cf552[_0x8135('0x18')]),_0x38fd62);}};exports[_0x8135('0x2d')]=function(_0x310fd7){try{if(agents[_0x310fd7['destuniqueid']]){utils[_0x8135('0x16')](util[_0x8135('0x3')](_0x8135('0x2e'),_0x310fd7[_0x8135('0x18')]),_0x310fd7);utils['info'](util[_0x8135('0x3')](_0x8135('0x2f'),_0x310fd7[_0x8135('0x18')],agents[_0x310fd7['destuniqueid']][_0x8135('0x7')],_0x310fd7[_0x8135('0x14')]));agents[_0x310fd7[_0x8135('0x14')]][_0x8135('0x30')]=utils[_0x8135('0x21')]();agents[_0x310fd7['destuniqueid']][_0x8135('0x9')]=_0x310fd7[_0x8135('0x9')];agents[_0x310fd7[_0x8135('0x14')]][_0x8135('0x19')]=_0x310fd7[_0x8135('0x19')];agents[_0x310fd7[_0x8135('0x14')]][_0x8135('0x2c')]=_0x310fd7['ringtime'];agents[_0x310fd7[_0x8135('0x14')]]['lastevent']=_0x8135('0x31');_[_0x8135('0x28')](agents,function(_0x18b609,_0x1bb691){if(_0x18b609[_0x8135('0x14')]!=_0x310fd7[_0x8135('0x14')]&&_0x18b609['uniqueid']==_0x310fd7[_0x8135('0x18')]){_0x18b609[_0x8135('0x26')]=0x0;_0x18b609[_0x8135('0x2c')]=_0x310fd7[_0x8135('0x25')];_0x18b609[_0x8135('0x1d')]=!![];_0x18b609[_0x8135('0x20')]=utils[_0x8135('0x21')]();_0x18b609[_0x8135('0x22')]=_0x8135('0x32');_0x18b609[_0x8135('0x23')]=_0x8135('0x32');_0x18b609['answeredelsewheredestinationuniqueid']=_0x310fd7[_0x8135('0x14')];_0x18b609['answeredelsewheremembername']=_0x310fd7[_0x8135('0x7')];writeDB(_0x18b609);}});}}catch(_0x1c5d64){utils[_0x8135('0x1c')](util[_0x8135('0x3')](_0x8135('0x2e'),_0x310fd7[_0x8135('0x18')]),_0x1c5d64);}};exports[_0x8135('0xe')]=function(_0x503f7f){try{if(!_[_0x8135('0x1e')](agents[_0x503f7f[_0x8135('0x14')]])){utils['debug'](util[_0x8135('0x3')](_0x8135('0x33'),_0x503f7f[_0x8135('0x18')]),_0x503f7f);utils[_0x8135('0x1a')](util['format'](_0x8135('0x34'),_0x503f7f[_0x8135('0x18')],agents[_0x503f7f[_0x8135('0x14')]][_0x8135('0x7')],_0x503f7f[_0x8135('0x14')]));agents[_0x503f7f['destuniqueid']][_0x8135('0xe')]=!![];agents[_0x503f7f[_0x8135('0x14')]][_0x8135('0x35')]=utils[_0x8135('0x21')]();agents[_0x503f7f[_0x8135('0x14')]][_0x8135('0x26')]=utils[_0x8135('0x36')](agents[_0x503f7f[_0x8135('0x14')]][_0x8135('0x35')],agents[_0x503f7f[_0x8135('0x14')]][_0x8135('0x30')]);agents[_0x503f7f[_0x8135('0x14')]][_0x8135('0x23')]=_0x503f7f[_0x8135('0x23')];agents[_0x503f7f['destuniqueid']][_0x8135('0x22')]=_0x8135('0x37');writeDB(agents[_0x503f7f[_0x8135('0x14')]]);}}catch(_0x5dd545){utils['error'](util[_0x8135('0x3')](_0x8135('0x33'),_0x503f7f['uniqueid']),_0x5dd545);}};exports[_0x8135('0x38')]=function(_0x46438f){try{if(!_[_0x8135('0x1e')](agents[_0x46438f[_0x8135('0x39')]])){utils[_0x8135('0x16')](util[_0x8135('0x3')](_0x8135('0x3a'),_0x46438f[_0x8135('0x18')]),_0x46438f);utils[_0x8135('0x1a')](util['format'](_0x8135('0x3b'),_0x46438f[_0x8135('0x18')],agents[_0x46438f[_0x8135('0x39')]]['membername'],agents[_0x46438f[_0x8135('0x39')]][_0x8135('0x18')]));agents[_0x46438f['transfereruniqueid']][_0x8135('0x3c')]=!![];agents[_0x46438f[_0x8135('0x39')]][_0x8135('0x3d')]=_0x8135('0x3e');agents[_0x46438f[_0x8135('0x39')]][_0x8135('0x3f')]=_0x46438f[_0x8135('0x40')];agents[_0x46438f['transfereruniqueid']]['transferuniqueid']=agents[_0x46438f[_0x8135('0x39')]][_0x8135('0x18')];}}catch(_0x4e62ff){utils['error'](util['format'](_0x8135('0x3a'),_0x46438f[_0x8135('0x18')]),_0x4e62ff);}};exports['attendedtransfer']=function(_0x81a5b2){try{utils[_0x8135('0x16')](util[_0x8135('0x3')]('[%s][agents][attendedtransfer]',_0x81a5b2[_0x8135('0x41')]),_0x81a5b2);if(_0x81a5b2['origtransfereruniqueid']==_0x81a5b2[_0x8135('0x42')]){if(!_['isNil'](agents[_0x81a5b2[_0x8135('0x43')]])){utils[_0x8135('0x1a')](util[_0x8135('0x3')](_0x8135('0x44'),_0x81a5b2['origtransfereruniqueid'],agents[_0x81a5b2[_0x8135('0x43')]]['membername']));agents[_0x81a5b2[_0x8135('0x43')]][_0x8135('0x3c')]=!![];agents[_0x81a5b2['secondtransfereruniqueid']][_0x8135('0x3d')]=_0x8135('0x45');agents[_0x81a5b2['secondtransfereruniqueid']]['transferexten']=_0x81a5b2[_0x8135('0x46')];agents[_0x81a5b2[_0x8135('0x43')]][_0x8135('0x47')]=_0x81a5b2[_0x8135('0x41')];}if(_0x81a5b2[_0x8135('0x48')]&&agents[_0x81a5b2[_0x8135('0x48')]]){agents[_0x81a5b2[_0x8135('0x48')]][_0x8135('0x49')]=0x1;transfers[_0x81a5b2['transfereeuniqueid']]=_['clone'](agents[_0x81a5b2[_0x8135('0x48')]]);transfers[_0x81a5b2['transfereeuniqueid']][_0x8135('0x8')]=agents[_0x81a5b2[_0x8135('0x43')]][_0x8135('0x8')];transfers[_0x81a5b2['transfereeuniqueid']][_0x8135('0x4a')]=agents[_0x81a5b2[_0x8135('0x43')]][_0x8135('0x4a')];transfers[_0x81a5b2['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x81a5b2[_0x8135('0x48')]]['agentconnectAt']=utils[_0x8135('0x21')]();transfers[_0x81a5b2[_0x8135('0x48')]][_0x8135('0x2c')]=0x0;transfers[_0x81a5b2[_0x8135('0x48')]][_0x8135('0x49')]=0x2;}}else if(_0x81a5b2['secondtransfereruniqueid']==_0x81a5b2[_0x8135('0x4b')]){if(!_[_0x8135('0x1e')](agents[_0x81a5b2[_0x8135('0x41')]])){utils[_0x8135('0x1a')](util['format'](_0x8135('0x44'),_0x81a5b2[_0x8135('0x41')],agents[_0x81a5b2[_0x8135('0x41')]][_0x8135('0x7')]));agents[_0x81a5b2[_0x8135('0x41')]][_0x8135('0x3c')]=!![];agents[_0x81a5b2[_0x8135('0x41')]][_0x8135('0x3d')]=_0x8135('0x45');agents[_0x81a5b2[_0x8135('0x41')]][_0x8135('0x3f')]=_0x81a5b2[_0x8135('0x4c')];agents[_0x81a5b2['origtransfereruniqueid']][_0x8135('0x47')]=_0x81a5b2[_0x8135('0x43')];}if(_0x81a5b2[_0x8135('0x4d')]&&agents[_0x81a5b2[_0x8135('0x4d')]]){agents[_0x81a5b2[_0x8135('0x4d')]][_0x8135('0x49')]=0x1;transfers[_0x81a5b2['transfertargetuniqueid']]=_[_0x8135('0x4e')](agents[_0x81a5b2[_0x8135('0x4d')]]);transfers[_0x81a5b2['transfertargetuniqueid']]['calleridnum']=agents[_0x81a5b2[_0x8135('0x41')]][_0x8135('0x8')];transfers[_0x81a5b2['transfertargetuniqueid']]['calleridname']=agents[_0x81a5b2[_0x8135('0x41')]]['calleridname'];transfers[_0x81a5b2[_0x8135('0x4d')]][_0x8135('0x4f')]=utils[_0x8135('0x21')]();transfers[_0x81a5b2[_0x8135('0x4d')]][_0x8135('0x30')]=utils['now']();transfers[_0x81a5b2['transfertargetuniqueid']][_0x8135('0x2c')]=0x0;transfers[_0x81a5b2[_0x8135('0x4d')]][_0x8135('0x49')]=0x2;}}}catch(_0x2cf284){utils[_0x8135('0x1c')](util[_0x8135('0x3')]('[%s][agents][attendedtransfer]',_0x81a5b2[_0x8135('0x41')]),_0x2cf284);}};exports[_0x8135('0x50')]=function(_0xb3ebd4){try{utils[_0x8135('0x16')](util[_0x8135('0x3')](_0x8135('0x51'),_0xb3ebd4['uniqueid']),_0xb3ebd4);if(agents[_0xb3ebd4[_0x8135('0x18')]]&&agents[_0xb3ebd4['uniqueid']][_0x8135('0x23')]===_0x8135('0x24')){if(_0xb3ebd4[_0x8135('0x52')]==='21'){agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x23')]=_0x8135('0x53');agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x22')]='rejected';}utils['info'](util['format'](_0x8135('0x54'),_0xb3ebd4['uniqueid'],agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x7')],agents[_0xb3ebd4[_0x8135('0x18')]]['reason'],agents[_0xb3ebd4['uniqueid']][_0x8135('0x22')]));writeDB(agents[_0xb3ebd4[_0x8135('0x18')]]);var _0x5bafdc=unanswered[_0x8135('0x55')](_0xb3ebd4['uniqueid']);if(_0x5bafdc>-0x1){unanswered[_0x8135('0x56')](_0x5bafdc,0x1);}}if(transfers[_0xb3ebd4[_0x8135('0x18')]]){transfers[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0xe')]=!![];transfers[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x35')]=utils[_0x8135('0x21')]();transfers[_0xb3ebd4[_0x8135('0x18')]]['talktime']=utils['diffTime'](transfers[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x35')],transfers[_0xb3ebd4['uniqueid']][_0x8135('0x30')]);transfers[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x23')]=_0x8135('0x57');transfers[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x22')]='complete';utils[_0x8135('0x1a')](util['format'](_0x8135('0x54'),_0xb3ebd4['uniqueid'],transfers[_0xb3ebd4[_0x8135('0x18')]]['membername'],transfers[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x23')],transfers[_0xb3ebd4['uniqueid']][_0x8135('0x22')]));writeDB(transfers[_0xb3ebd4['uniqueid']],!![]);}if(agents[_0xb3ebd4[_0x8135('0x18')]]&&agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x30')]){agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0xe')]=!![];agents[_0xb3ebd4[_0x8135('0x18')]]['agentcompleteAt']=utils['now']();agents[_0xb3ebd4['uniqueid']][_0x8135('0x26')]=utils[_0x8135('0x36')](agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x35')],agents[_0xb3ebd4[_0x8135('0x18')]]['agentconnectAt']);agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x23')]=agents[_0xb3ebd4[_0x8135('0x18')]][_0x8135('0x3c')]?'transfer':_0x8135('0x57');agents[_0xb3ebd4[_0x8135('0x18')]]['lastevent']=_0x8135('0x37');utils[_0x8135('0x1a')](util[_0x8135('0x3')](_0x8135('0x54'),_0xb3ebd4[_0x8135('0x18')],agents[_0xb3ebd4[_0x8135('0x18')]]['membername'],agents[_0xb3ebd4['uniqueid']][_0x8135('0x23')],agents[_0xb3ebd4['uniqueid']][_0x8135('0x22')]));writeDB(agents[_0xb3ebd4[_0x8135('0x18')]]);}}catch(_0x53cb27){utils['error'](util['format'](_0x8135('0x51'),_0xb3ebd4[_0x8135('0x18')]),_0x53cb27);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c8e1546..6185cf9 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 _0xba69=['lastIndexOf','includes','noop','execif','gotoif','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','uniqueid','queue','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split'];(function(_0x23f642,_0x3c8f66){var _0x4ba0d0=function(_0x507a88){while(--_0x507a88){_0x23f642['push'](_0x23f642['shift']());}};_0x4ba0d0(++_0x3c8f66);}(_0xba69,0x6e));var _0x9ba6=function(_0xc9b9c1,_0x49714a){_0xc9b9c1=_0xc9b9c1-0x0;var _0xf0aa3e=_0xba69[_0xc9b9c1];return _0xf0aa3e;};'use strict';var _=require('lodash');var util=require(_0x9ba6('0x0'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x9ba6('0x1'),_0x9ba6('0x1'),_0x9ba6('0x2'),_0x9ba6('0x2'),_0x9ba6('0x2'),_0x9ba6('0x3'),_0x9ba6('0x4'),_0x9ba6('0x1'),_0x9ba6('0x1'),_0x9ba6('0x1')];var channels={};function writeDB(_0x19f968){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x19f968[_0x9ba6('0x7')],_0x19f968['channel'],_0x19f968[_0x9ba6('0x8')],_0x19f968['membername'],_0x19f968[_0x9ba6('0x9')],_0x19f968[_0x9ba6('0xa')],_0x19f968[_0x9ba6('0xb')],_0x19f968[_0x9ba6('0xc')]));if(_0x19f968['accountcode']){utils[_0x9ba6('0xd')](_0x19f968[_0x9ba6('0xe')])[_0x9ba6('0xf')](function(_0x11b4fb){if(_0x11b4fb){_0x19f968[_0x9ba6('0x10')]=_0x11b4fb['id'];}utils['request'](_0x9ba6('0x11'),_0x19f968);});}else{utils[_0x9ba6('0x12')](_0x9ba6('0x11'),_0x19f968);}if(channels[_0x19f968[_0x9ba6('0x7')]]){delete channels[_0x19f968[_0x9ba6('0x7')]];}}exports[_0x9ba6('0x13')]=function(_0xa53c1a){try{utils['debug'](util[_0x9ba6('0x6')](_0x9ba6('0x14'),_0xa53c1a[_0x9ba6('0x7')]),_0xa53c1a);if(_0xa53c1a['uniqueid']==_0xa53c1a[_0x9ba6('0x15')]&&_0xa53c1a[_0x9ba6('0x16')]!=_0x9ba6('0x17')){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x18'),_0xa53c1a[_0x9ba6('0x7')],_0xa53c1a[_0x9ba6('0x19')],_0xa53c1a['exten']));channels[_0xa53c1a[_0x9ba6('0x7')]]={'uniqueid':_0xa53c1a[_0x9ba6('0x7')],'accountcode':_0xa53c1a[_0x9ba6('0xe')],'source':_0xa53c1a['calleridnum'],'destination':_0xa53c1a[_0x9ba6('0x1a')],'destinationcontext':_0xa53c1a[_0x9ba6('0x19')],'channel':_0xa53c1a[_0x9ba6('0x16')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9ba6('0x2'),'amaflags':_0x9ba6('0x1b')};}}catch(_0x28d201){utils[_0x9ba6('0x1c')](util['format']('[%s][calls][newchannel]',_0xa53c1a[_0x9ba6('0x7')]),_0x28d201);}};exports['newstate']=function(_0x19fc92){try{utils[_0x9ba6('0x1d')](util[_0x9ba6('0x6')](_0x9ba6('0x1e'),_0x19fc92[_0x9ba6('0x7')]),_0x19fc92);if(!_[_0x9ba6('0x1f')](channels[_0x19fc92[_0x9ba6('0x7')]])&&_0x19fc92[_0x9ba6('0x20')]==0x6){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x21'),_0x19fc92[_0x9ba6('0x7')],_0x19fc92[_0x9ba6('0x19')],_0x19fc92[_0x9ba6('0x16')]));if(_[_0x9ba6('0x1f')](channels[_0x19fc92['uniqueid']][_0x9ba6('0x22')])){channels[_0x19fc92[_0x9ba6('0x7')]][_0x9ba6('0x22')]=utils[_0x9ba6('0x23')]();}}else if(!_[_0x9ba6('0x1f')](channels[_0x19fc92[_0x9ba6('0x15')]])&&_0x19fc92[_0x9ba6('0x20')]==0x6&&_0x19fc92[_0x9ba6('0x19')]!='transfer'){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x24'),_0x19fc92[_0x9ba6('0x7')],_0x19fc92[_0x9ba6('0x15')],_0x19fc92[_0x9ba6('0x19')],_0x19fc92[_0x9ba6('0x16')]));channels[_0x19fc92['linkedid']]['accountcode']=_0x19fc92[_0x9ba6('0xe')];channels[_0x19fc92[_0x9ba6('0x15')]][_0x9ba6('0x25')]=_0x19fc92[_0x9ba6('0x16')];if(_['isNil'](channels[_0x19fc92[_0x9ba6('0x15')]][_0x9ba6('0x26')])){channels[_0x19fc92[_0x9ba6('0x15')]][_0x9ba6('0x26')]=utils[_0x9ba6('0x23')]();}channels[_0x19fc92[_0x9ba6('0x15')]]['disposition']=dispositions[_[_0x9ba6('0x27')](_0x19fc92[_0x9ba6('0x20')])]||_0x9ba6('0x3');}}catch(_0x27b11a){utils[_0x9ba6('0x1c')](util[_0x9ba6('0x6')](_0x9ba6('0x1e'),_0x19fc92[_0x9ba6('0x7')]),_0x27b11a);}};exports[_0x9ba6('0x28')]=function(_0x598325){try{if(!_[_0x9ba6('0x1f')](channels[_0x598325[_0x9ba6('0x7')]])){utils[_0x9ba6('0x1d')](util[_0x9ba6('0x6')](_0x9ba6('0x29'),_0x598325['uniqueid']),_0x598325);if(_[_0x9ba6('0x1f')](channels[_0x598325['uniqueid']][_0x9ba6('0x2a')])){channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x2a')]=_0x598325['calleridname']+'\x20<'+_0x598325['calleridnum']+'>';}utils[_0x9ba6('0x5')](util['format'](_0x9ba6('0x2b'),_0x598325['uniqueid'],channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x2a')],_0x598325[_0x9ba6('0x2c')]));channels[_0x598325['uniqueid']][_0x9ba6('0x2d')]=utils['now']();channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x2e')]=utils[_0x9ba6('0x2f')](channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x2d')],channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x30')]);channels[_0x598325['uniqueid']]['billableseconds']=channels[_0x598325['uniqueid']][_0x9ba6('0x26')]?utils[_0x9ba6('0x2f')](channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x2d')],channels[_0x598325[_0x9ba6('0x7')]][_0x9ba6('0x26')]):0x0;writeDB(channels[_0x598325[_0x9ba6('0x7')]]);}}catch(_0x35ff02){utils[_0x9ba6('0x1c')](util[_0x9ba6('0x6')](_0x9ba6('0x29'),_0x598325['uniqueid']),_0x35ff02);}};exports[_0x9ba6('0x31')]=function(_0x22c2d0){try{if(!_['isNil'](channels[_0x22c2d0[_0x9ba6('0x32')]])){utils['debug'](util[_0x9ba6('0x6')]('[%s][calls][attendedtransfer]',_0x22c2d0['origtransfereruniqueid']),_0x22c2d0);if(channels[_0x22c2d0[_0x9ba6('0x32')]][_0x9ba6('0x16')]==_0x22c2d0[_0x9ba6('0x33')]){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x34'),_0x22c2d0[_0x9ba6('0x35')],_0x22c2d0['localtwolinkedid'],_0x22c2d0['secondtransfererchannel']));channels[_0x22c2d0[_0x9ba6('0x32')]][_0x9ba6('0x25')]=_0x22c2d0[_0x9ba6('0x36')];channels[_0x22c2d0[_0x9ba6('0x32')]][_0x9ba6('0x37')]=_0x9ba6('0x38');}else if(channels[_0x22c2d0[_0x9ba6('0x32')]][_0x9ba6('0x16')]=_0x22c2d0['transfertargetchannel']){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x34'),_0x22c2d0[_0x9ba6('0x35')],_0x22c2d0['localtwolinkedid'],_0x22c2d0[_0x9ba6('0x39')]));channels[_0x22c2d0[_0x9ba6('0x32')]]['destinationchannel']=_0x22c2d0[_0x9ba6('0x39')];channels[_0x22c2d0[_0x9ba6('0x32')]][_0x9ba6('0x37')]=_0x9ba6('0x38');}}}catch(_0x21f86d){utils[_0x9ba6('0x1c')](util[_0x9ba6('0x6')](_0x9ba6('0x3a'),_0x22c2d0[_0x9ba6('0x35')]),_0x21f86d);}};exports[_0x9ba6('0x3b')]=function(_0x58cf31){try{if(!_[_0x9ba6('0x1f')](channels[_0x58cf31[_0x9ba6('0x7')]])){utils[_0x9ba6('0x1d')](util['format'](_0x9ba6('0x3c'),_0x58cf31[_0x9ba6('0x7')]),_0x58cf31);channels[_0x58cf31[_0x9ba6('0x7')]]['musiconholdstartAt']=utils['now']();utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x58cf31[_0x9ba6('0x7')],channels[_0x58cf31[_0x9ba6('0x7')]][_0x9ba6('0x3d')]));}}catch(_0x4a6d3c){utils[_0x9ba6('0x1c')](util['format'](_0x9ba6('0x3c'),_0x58cf31[_0x9ba6('0x7')]),_0x4a6d3c);}};exports['musiconholdstop']=function(_0x33f73f){try{if(!_[_0x9ba6('0x1f')](channels[_0x33f73f[_0x9ba6('0x7')]])){utils[_0x9ba6('0x1d')](util[_0x9ba6('0x6')](_0x9ba6('0x3e'),_0x33f73f[_0x9ba6('0x7')]),_0x33f73f);if(!_[_0x9ba6('0x1f')](channels[_0x33f73f[_0x9ba6('0x7')]][_0x9ba6('0x3d')])){channels[_0x33f73f[_0x9ba6('0x7')]][_0x9ba6('0x3f')]+=utils['diffTime'](utils[_0x9ba6('0x23')](),channels[_0x33f73f[_0x9ba6('0x7')]]['musiconholdstartAt']);utils['info'](util[_0x9ba6('0x6')](_0x9ba6('0x40'),_0x33f73f[_0x9ba6('0x7')],channels[_0x33f73f[_0x9ba6('0x7')]]['mohtime']));delete channels[_0x33f73f[_0x9ba6('0x7')]][_0x9ba6('0x3d')];}}}catch(_0x49d1a4){utils['error'](util['format'](_0x9ba6('0x3e'),_0x33f73f[_0x9ba6('0x7')]),_0x49d1a4);}};exports['varset']=function(_0x432412){try{if(!_[_0x9ba6('0x1f')](channels[_0x432412[_0x9ba6('0x7')]])){utils[_0x9ba6('0x1d')](util[_0x9ba6('0x6')](_0x9ba6('0x41'),_0x432412[_0x9ba6('0x7')]),_0x432412);if(!_[_0x9ba6('0x1f')](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x43')])){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x44'),_0x432412[_0x9ba6('0x7')],_0x432412[_0x9ba6('0x45')]));channels[_0x432412[_0x9ba6('0x7')]][_0x9ba6('0x46')]=_0x432412[_0x9ba6('0x45')];}if(!_['isNil'](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x47')])){utils['info'](util['format'](_0x9ba6('0x48'),_0x432412[_0x9ba6('0x7')],_0x432412[_0x9ba6('0x45')]));channels[_0x432412['uniqueid']][_0x9ba6('0x49')]=_0x432412[_0x9ba6('0x45')];channels[_0x432412['uniqueid']]['callerid']='\x22'+_0x432412[_0x9ba6('0x45')]+_0x9ba6('0x4a')+_0x432412['value']+'>';}if(!_['isNil'](_0x432412['variable']['xmd-callerid-preview'])||!_[_0x9ba6('0x1f')](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x4b')])){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x4c'),_0x432412[_0x9ba6('0x7')],!_[_0x9ba6('0x1f')](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x4d')])?_0x9ba6('0x4d'):_0x9ba6('0x4b'),_0x432412[_0x9ba6('0x45')]));channels[_0x432412[_0x9ba6('0x7')]][_0x9ba6('0x2a')]=_0x432412['value'];}if(!_[_0x9ba6('0x1f')](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x4e')])||!_['isNil'](_0x432412['variable']['xmcs-queue'])){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x432412[_0x9ba6('0x7')],!_['isNil'](_0x432412[_0x9ba6('0x42')]['xmd-queue'])?_0x9ba6('0x4e'):_0x9ba6('0x4f'),_0x432412[_0x9ba6('0x45')]));channels[_0x432412['uniqueid']][_0x9ba6('0x50')]='Queue';channels[_0x432412['uniqueid']][_0x9ba6('0x51')]=_0x432412[_0x9ba6('0x45')];channels[_0x432412[_0x9ba6('0x7')]][_0x9ba6('0x8')]=!![];}if(!_[_0x9ba6('0x1f')](_0x432412['variable'][_0x9ba6('0x52')])){utils['info'](util[_0x9ba6('0x6')](_0x9ba6('0x53'),_0x432412[_0x9ba6('0x7')],_0x432412[_0x9ba6('0x45')]));channels[_0x432412[_0x9ba6('0x7')]][_0x9ba6('0x54')]=_0x432412[_0x9ba6('0x45')];}if(!_[_0x9ba6('0x1f')](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x55')])){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x432412[_0x9ba6('0x7')],_0x432412['value']));channels[_0x432412[_0x9ba6('0x7')]][_0x9ba6('0x56')]=_0x432412[_0x9ba6('0x45')];}if(!_['isNil'](_0x432412['variable'][_0x9ba6('0x57')])){utils['info'](util[_0x9ba6('0x6')](_0x9ba6('0x58'),_0x432412[_0x9ba6('0x7')],_0x432412[_0x9ba6('0x45')]));channels[_0x432412[_0x9ba6('0x7')]][_0x9ba6('0x59')]=_0x432412[_0x9ba6('0x45')];}if(!_[_0x9ba6('0x1f')](_0x432412[_0x9ba6('0x42')][_0x9ba6('0x5a')])){utils[_0x9ba6('0x5')](util[_0x9ba6('0x6')](_0x9ba6('0x5b'),_0x432412[_0x9ba6('0x7')],_0x432412[_0x9ba6('0x45')]));channels[_0x432412[_0x9ba6('0x7')]]['sipcallid']=_0x432412[_0x9ba6('0x45')];}}}catch(_0x25e04d){utils[_0x9ba6('0x1c')](util['format'](_0x9ba6('0x41'),_0x432412[_0x9ba6('0x7')]),_0x25e04d);}};exports[_0x9ba6('0x5c')]=function(_0x3a6650){try{if(!_[_0x9ba6('0x1f')](channels[_0x3a6650['uniqueid']])){utils[_0x9ba6('0x1d')](util[_0x9ba6('0x6')]('[%s][calls][newexten]',_0x3a6650[_0x9ba6('0x7')]),_0x3a6650);utils[_0x9ba6('0x5')](util['format'](_0x9ba6('0x5d'),_0x3a6650['uniqueid'],_0x3a6650[_0x9ba6('0x5e')],_0x3a6650['appdata']));if(_0x3a6650[_0x9ba6('0x5e')][_0x9ba6('0x5f')]()==_0x9ba6('0x60')&&_[_0x9ba6('0x61')](_0x3a6650[_0x9ba6('0x62')][_0x9ba6('0x5f')](),'cdr')){var _0x1ddf66=_0x3a6650[_0x9ba6('0x62')][_0x9ba6('0x63')]('=');var _0x7a7081=_0x1ddf66[0x0]['substring'](_0x1ddf66[0x0][_0x9ba6('0x64')]('(')+0x1,_0x1ddf66[0x0]['lastIndexOf'](')'));var _0x104051=_0x1ddf66[0x1];channels[_0x3a6650[_0x9ba6('0x7')]][_0x7a7081]=_0x104051;}if(!_[_0x9ba6('0x65')]([_0x9ba6('0x28'),_0x9ba6('0x66'),_0x9ba6('0x67'),_0x9ba6('0x60'),_0x9ba6('0x68')],_0x3a6650[_0x9ba6('0x5e')][_0x9ba6('0x5f')]())){channels[_0x3a6650[_0x9ba6('0x7')]]['lastapplication']=_0x3a6650[_0x9ba6('0x5e')];channels[_0x3a6650[_0x9ba6('0x7')]][_0x9ba6('0x51')]=_0x3a6650[_0x9ba6('0x62')];}}}catch(_0x31f643){utils[_0x9ba6('0x1c')](util[_0x9ba6('0x6')]('[%s][calls][newexten]',_0x3a6650[_0x9ba6('0x7')]),_0x31f643);}}; \ No newline at end of file +var _0x3261=['membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','cause-txt','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','application','toLowerCase','cdr','appdata','split','substring','lastIndexOf','hangup','noop','execif','set','gotoif','lastapplication','[%s][calls][newexten]','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0x3261,0x194));var _0x1326=function(_0x290ae1,_0x4ed7a7){_0x290ae1=_0x290ae1-0x0;var _0x35ba0e=_0x3261[_0x290ae1];return _0x35ba0e;};'use strict';var _=require(_0x1326('0x0'));var util=require(_0x1326('0x1'));var utils=require(_0x1326('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x1326('0x3'),_0x1326('0x4'),_0x1326('0x4'),_0x1326('0x4'),'ANSWERED',_0x1326('0x5'),_0x1326('0x3'),_0x1326('0x3'),_0x1326('0x3')];var channels={};function writeDB(_0x5245c1){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x8'),_0x5245c1[_0x1326('0x9')],_0x5245c1[_0x1326('0xa')],_0x5245c1[_0x1326('0xb')],_0x5245c1[_0x1326('0xc')],_0x5245c1[_0x1326('0xd')],_0x5245c1[_0x1326('0xe')],_0x5245c1[_0x1326('0xf')],_0x5245c1[_0x1326('0x10')]));if(_0x5245c1[_0x1326('0x11')]){utils['getUserByInternal'](_0x5245c1[_0x1326('0x11')])[_0x1326('0x12')](function(_0x4d3c10){if(_0x4d3c10){_0x5245c1['UserId']=_0x4d3c10['id'];}utils[_0x1326('0x13')](_0x1326('0x14'),_0x5245c1);});}else{utils[_0x1326('0x13')]('CreateVoiceCallReport',_0x5245c1);}if(channels[_0x5245c1[_0x1326('0x9')]]){delete channels[_0x5245c1[_0x1326('0x9')]];}}exports['newchannel']=function(_0x456b00){try{utils[_0x1326('0x15')](util['format'](_0x1326('0x16'),_0x456b00[_0x1326('0x9')]),_0x456b00);if(_0x456b00['uniqueid']==_0x456b00[_0x1326('0x17')]&&_0x456b00[_0x1326('0xa')]!=_0x1326('0x18')){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x19'),_0x456b00[_0x1326('0x9')],_0x456b00[_0x1326('0x1a')],_0x456b00[_0x1326('0x1b')]));channels[_0x456b00[_0x1326('0x9')]]={'uniqueid':_0x456b00[_0x1326('0x9')],'accountcode':_0x456b00[_0x1326('0x11')],'source':_0x456b00[_0x1326('0xe')],'destination':_0x456b00[_0x1326('0x1b')],'destinationcontext':_0x456b00[_0x1326('0x1a')],'channel':_0x456b00[_0x1326('0xa')],'starttime':utils[_0x1326('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1326('0x4'),'amaflags':_0x1326('0x1d')};}}catch(_0x5a2013){utils[_0x1326('0x1e')](util['format'](_0x1326('0x16'),_0x456b00[_0x1326('0x9')]),_0x5a2013);}};exports[_0x1326('0x1f')]=function(_0x53ad44){try{utils[_0x1326('0x15')](util['format'](_0x1326('0x20'),_0x53ad44['uniqueid']),_0x53ad44);if(!_[_0x1326('0x21')](channels[_0x53ad44[_0x1326('0x9')]])&&_0x53ad44[_0x1326('0x22')]==0x6){utils[_0x1326('0x6')](util[_0x1326('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x53ad44[_0x1326('0x9')],_0x53ad44[_0x1326('0x1a')],_0x53ad44[_0x1326('0xa')]));if(_[_0x1326('0x21')](channels[_0x53ad44[_0x1326('0x9')]][_0x1326('0x23')])){channels[_0x53ad44['uniqueid']][_0x1326('0x23')]=utils[_0x1326('0x1c')]();}}else if(!_[_0x1326('0x21')](channels[_0x53ad44[_0x1326('0x17')]])&&_0x53ad44['channelstate']==0x6&&_0x53ad44['context']!=_0x1326('0x24')){utils[_0x1326('0x6')](util[_0x1326('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x53ad44[_0x1326('0x9')],_0x53ad44[_0x1326('0x17')],_0x53ad44[_0x1326('0x1a')],_0x53ad44[_0x1326('0xa')]));channels[_0x53ad44['linkedid']][_0x1326('0x11')]=_0x53ad44[_0x1326('0x11')];channels[_0x53ad44[_0x1326('0x17')]][_0x1326('0x25')]=_0x53ad44['channel'];if(_[_0x1326('0x21')](channels[_0x53ad44[_0x1326('0x17')]][_0x1326('0x26')])){channels[_0x53ad44[_0x1326('0x17')]][_0x1326('0x26')]=utils[_0x1326('0x1c')]();}channels[_0x53ad44[_0x1326('0x17')]]['disposition']=dispositions[_[_0x1326('0x27')](_0x53ad44[_0x1326('0x22')])]||'ANSWERED';}}catch(_0x21aac0){utils[_0x1326('0x1e')](util['format'](_0x1326('0x20'),_0x53ad44['uniqueid']),_0x21aac0);}};exports['hangup']=function(_0x5a9219){try{if(!_['isNil'](channels[_0x5a9219['uniqueid']])){utils[_0x1326('0x15')](util['format'](_0x1326('0x28'),_0x5a9219[_0x1326('0x9')]),_0x5a9219);if(_[_0x1326('0x21')](channels[_0x5a9219[_0x1326('0x9')]][_0x1326('0x29')])){channels[_0x5a9219[_0x1326('0x9')]]['callerid']=_0x5a9219['calleridname']+'\x20<'+_0x5a9219[_0x1326('0xe')]+'>';}utils[_0x1326('0x6')](util[_0x1326('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5a9219['uniqueid'],channels[_0x5a9219[_0x1326('0x9')]]['callerid'],_0x5a9219[_0x1326('0x2a')]));channels[_0x5a9219[_0x1326('0x9')]]['endtime']=utils[_0x1326('0x1c')]();channels[_0x5a9219[_0x1326('0x9')]][_0x1326('0x2b')]=utils[_0x1326('0x2c')](channels[_0x5a9219[_0x1326('0x9')]][_0x1326('0x2d')],channels[_0x5a9219[_0x1326('0x9')]][_0x1326('0x2e')]);channels[_0x5a9219['uniqueid']][_0x1326('0x2f')]=channels[_0x5a9219[_0x1326('0x9')]][_0x1326('0x26')]?utils[_0x1326('0x2c')](channels[_0x5a9219['uniqueid']][_0x1326('0x2d')],channels[_0x5a9219[_0x1326('0x9')]][_0x1326('0x26')]):0x0;writeDB(channels[_0x5a9219[_0x1326('0x9')]]);}}catch(_0x552415){utils[_0x1326('0x1e')](util['format']('[%s][calls][hangup]',_0x5a9219[_0x1326('0x9')]),_0x552415);}};exports['attendedtransfer']=function(_0x415c25){try{if(!_[_0x1326('0x21')](channels[_0x415c25['localtwolinkedid']])){utils['debug'](util[_0x1326('0x7')](_0x1326('0x30'),_0x415c25[_0x1326('0x31')]),_0x415c25);if(channels[_0x415c25['localtwolinkedid']][_0x1326('0xa')]==_0x415c25['transfereechannel']){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x32'),_0x415c25[_0x1326('0x31')],_0x415c25[_0x1326('0x33')],_0x415c25[_0x1326('0x34')]));channels[_0x415c25[_0x1326('0x33')]][_0x1326('0x25')]=_0x415c25[_0x1326('0x34')];channels[_0x415c25['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x415c25[_0x1326('0x33')]][_0x1326('0xa')]=_0x415c25[_0x1326('0x35')]){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x32'),_0x415c25[_0x1326('0x31')],_0x415c25['localtwolinkedid'],_0x415c25[_0x1326('0x36')]));channels[_0x415c25[_0x1326('0x33')]][_0x1326('0x25')]=_0x415c25[_0x1326('0x36')];channels[_0x415c25[_0x1326('0x33')]]['userfield']=_0x1326('0x37');}}}catch(_0x3812b9){utils[_0x1326('0x1e')](util['format'](_0x1326('0x30'),_0x415c25[_0x1326('0x31')]),_0x3812b9);}};exports[_0x1326('0x38')]=function(_0x2c235f){try{if(!_[_0x1326('0x21')](channels[_0x2c235f[_0x1326('0x9')]])){utils[_0x1326('0x15')](util[_0x1326('0x7')](_0x1326('0x39'),_0x2c235f[_0x1326('0x9')]),_0x2c235f);channels[_0x2c235f[_0x1326('0x9')]][_0x1326('0x3a')]=utils[_0x1326('0x1c')]();utils['info'](util[_0x1326('0x7')](_0x1326('0x3b'),_0x2c235f[_0x1326('0x9')],channels[_0x2c235f[_0x1326('0x9')]][_0x1326('0x3a')]));}}catch(_0x47a556){utils[_0x1326('0x1e')](util[_0x1326('0x7')](_0x1326('0x39'),_0x2c235f['uniqueid']),_0x47a556);}};exports['musiconholdstop']=function(_0x588618){try{if(!_[_0x1326('0x21')](channels[_0x588618[_0x1326('0x9')]])){utils[_0x1326('0x15')](util[_0x1326('0x7')]('[%s][calls][musiconholdstop]',_0x588618[_0x1326('0x9')]),_0x588618);if(!_['isNil'](channels[_0x588618['uniqueid']][_0x1326('0x3a')])){channels[_0x588618[_0x1326('0x9')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x588618[_0x1326('0x9')]][_0x1326('0x3a')]);utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x3c'),_0x588618['uniqueid'],channels[_0x588618['uniqueid']][_0x1326('0x3d')]));delete channels[_0x588618[_0x1326('0x9')]][_0x1326('0x3a')];}}}catch(_0x15243b){utils[_0x1326('0x1e')](util['format'](_0x1326('0x3e'),_0x588618[_0x1326('0x9')]),_0x15243b);}};exports[_0x1326('0x3f')]=function(_0x505fe8){try{if(!_[_0x1326('0x21')](channels[_0x505fe8['uniqueid']])){utils[_0x1326('0x15')](util[_0x1326('0x7')](_0x1326('0x40'),_0x505fe8[_0x1326('0x9')]),_0x505fe8);if(!_['isNil'](_0x505fe8[_0x1326('0x41')][_0x1326('0x42')])){utils['info'](util[_0x1326('0x7')](_0x1326('0x43'),_0x505fe8[_0x1326('0x9')],_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8[_0x1326('0x9')]][_0x1326('0x45')]=_0x505fe8['value'];}if(!_[_0x1326('0x21')](_0x505fe8[_0x1326('0x41')][_0x1326('0x46')])){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x47'),_0x505fe8[_0x1326('0x9')],_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8[_0x1326('0x9')]][_0x1326('0x48')]=_0x505fe8[_0x1326('0x44')];channels[_0x505fe8['uniqueid']][_0x1326('0x29')]='\x22'+_0x505fe8[_0x1326('0x44')]+_0x1326('0x49')+_0x505fe8[_0x1326('0x44')]+'>';}if(!_[_0x1326('0x21')](_0x505fe8[_0x1326('0x41')]['xmd-callerid-preview'])||!_[_0x1326('0x21')](_0x505fe8['variable'][_0x1326('0x4a')])){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x4b'),_0x505fe8[_0x1326('0x9')],!_[_0x1326('0x21')](_0x505fe8[_0x1326('0x41')]['xmd-callerid-preview'])?_0x1326('0x4c'):_0x1326('0x4a'),_0x505fe8['value']));channels[_0x505fe8[_0x1326('0x9')]][_0x1326('0x29')]=_0x505fe8['value'];}if(!_[_0x1326('0x21')](_0x505fe8[_0x1326('0x41')]['xmd-queue'])||!_[_0x1326('0x21')](_0x505fe8[_0x1326('0x41')][_0x1326('0x4d')])){utils['info'](util['format'](_0x1326('0x4b'),_0x505fe8[_0x1326('0x9')],!_['isNil'](_0x505fe8[_0x1326('0x41')][_0x1326('0x4e')])?_0x1326('0x4e'):_0x1326('0x4d'),_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8[_0x1326('0x9')]]['lastapplication']=_0x1326('0x4f');channels[_0x505fe8[_0x1326('0x9')]][_0x1326('0x50')]=_0x505fe8[_0x1326('0x44')];channels[_0x505fe8['uniqueid']][_0x1326('0xb')]=!![];}if(!_[_0x1326('0x21')](_0x505fe8['variable'][_0x1326('0x51')])){utils[_0x1326('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x505fe8[_0x1326('0x9')],_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8[_0x1326('0x9')]][_0x1326('0x52')]=_0x505fe8[_0x1326('0x44')];}if(!_[_0x1326('0x21')](_0x505fe8[_0x1326('0x41')][_0x1326('0x53')])){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x54'),_0x505fe8[_0x1326('0x9')],_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8[_0x1326('0x9')]][_0x1326('0x55')]=_0x505fe8['value'];}if(!_['isNil'](_0x505fe8[_0x1326('0x41')]['outboundrouteid'])){utils['info'](util[_0x1326('0x7')](_0x1326('0x56'),_0x505fe8[_0x1326('0x9')],_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8[_0x1326('0x9')]]['routeid']=_0x505fe8[_0x1326('0x44')];}if(!_['isNil'](_0x505fe8['variable'][_0x1326('0x57')])){utils[_0x1326('0x6')](util[_0x1326('0x7')](_0x1326('0x58'),_0x505fe8[_0x1326('0x9')],_0x505fe8[_0x1326('0x44')]));channels[_0x505fe8['uniqueid']]['sipcallid']=_0x505fe8[_0x1326('0x44')];}}}catch(_0x2195bd){utils[_0x1326('0x1e')](util['format']('[%s][calls][varset]',_0x505fe8[_0x1326('0x9')]),_0x2195bd);}};exports[_0x1326('0x59')]=function(_0x2567a8){try{if(!_[_0x1326('0x21')](channels[_0x2567a8[_0x1326('0x9')]])){utils[_0x1326('0x15')](util['format']('[%s][calls][newexten]',_0x2567a8['uniqueid']),_0x2567a8);utils[_0x1326('0x6')](util[_0x1326('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2567a8[_0x1326('0x9')],_0x2567a8['application'],_0x2567a8['appdata']));if(_0x2567a8[_0x1326('0x5a')][_0x1326('0x5b')]()=='set'&&_['startsWith'](_0x2567a8['appdata']['toLowerCase'](),_0x1326('0x5c'))){var _0x281f3e=_0x2567a8[_0x1326('0x5d')][_0x1326('0x5e')]('=');var _0x2065d9=_0x281f3e[0x0][_0x1326('0x5f')](_0x281f3e[0x0]['lastIndexOf']('(')+0x1,_0x281f3e[0x0][_0x1326('0x60')](')'));var _0x11f48c=_0x281f3e[0x1];channels[_0x2567a8[_0x1326('0x9')]][_0x2065d9]=_0x11f48c;}if(!_['includes']([_0x1326('0x61'),_0x1326('0x62'),_0x1326('0x63'),_0x1326('0x64'),_0x1326('0x65')],_0x2567a8[_0x1326('0x5a')][_0x1326('0x5b')]())){channels[_0x2567a8[_0x1326('0x9')]][_0x1326('0x66')]=_0x2567a8[_0x1326('0x5a')];channels[_0x2567a8[_0x1326('0x9')]][_0x1326('0x50')]=_0x2567a8[_0x1326('0x5d')];}}}catch(_0x46c6c8){utils[_0x1326('0x1e')](util[_0x1326('0x7')](_0x1326('0x67'),_0x2567a8[_0x1326('0x9')]),_0x46c6c8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5f73189..9c5415d 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 _0xd6ee=['fullybooted','error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0x26ac08,_0x22eedb){var _0x1f7e25=function(_0x4a991f){while(--_0x4a991f){_0x26ac08['push'](_0x26ac08['shift']());}};_0x1f7e25(++_0x22eedb);}(_0xd6ee,0x1e9));var _0xed6e=function(_0xffb079,_0x2d5dc0){_0xffb079=_0xffb079-0x0;var _0x4ed0ee=_0xd6ee[_0xffb079];return _0x4ed0ee;};'use strict';var utils=require(_0xed6e('0x0'));exports[_0xed6e('0x1')]=function(){utils['info'](_0xed6e('0x2'));};exports[_0xed6e('0x3')]=function(){utils[_0xed6e('0x4')](_0xed6e('0x5'));};exports[_0xed6e('0x6')]=function(){utils[_0xed6e('0x4')]('[core]\x20fullybooted');};exports[_0xed6e('0x7')]=function(_0x3100c9){utils[_0xed6e('0x7')]('[core]\x20error',_0x3100c9);};exports[_0xed6e('0x8')]=function(){utils[_0xed6e('0x4')](_0xed6e('0x9'));};exports[_0xed6e('0xa')]=function(_0x486676){}; \ No newline at end of file +var _0x57cd=['[core]\x20error','[core]\x20close','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x10ceca,_0xb7217b){var _0x42a6fe=function(_0x351652){while(--_0x351652){_0x10ceca['push'](_0x10ceca['shift']());}};_0x42a6fe(++_0xb7217b);}(_0x57cd,0xe2));var _0xd57c=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0x57cd[_0x252ef1];return _0x25817c;};'use strict';var utils=require('./utils');exports[_0xd57c('0x0')]=function(){utils[_0xd57c('0x1')](_0xd57c('0x2'));};exports[_0xd57c('0x3')]=function(){utils['info'](_0xd57c('0x4'));};exports['fullybooted']=function(){utils[_0xd57c('0x1')](_0xd57c('0x5'));};exports['error']=function(_0xcaf5d4){utils['error'](_0xd57c('0x6'),_0xcaf5d4);};exports['close']=function(){utils[_0xd57c('0x1')](_0xd57c('0x7'));};exports['managerevent']=function(_0x5cee4d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index eef4b86..400ad49 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 _0x3a8f=['dialbegin','isNil','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','diffTime','endtime','[%s][dials][hangup]','lodash','util','info','format','uniqueid','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','error','varset','debug','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x3ca34b,_0x14c706){var _0x149003=function(_0xa67827){while(--_0xa67827){_0x3ca34b['push'](_0x3ca34b['shift']());}};_0x149003(++_0x14c706);}(_0x3a8f,0x99));var _0xf3a8=function(_0xd65643,_0x2b8337){_0xd65643=_0xd65643-0x0;var _0x19dc56=_0x3a8f[_0xd65643];return _0x19dc56;};'use strict';var _=require(_0xf3a8('0x0'));var util=require(_0xf3a8('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x52371d){utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x52371d[_0xf3a8('0x4')],_0x52371d['channel'],_0x52371d[_0xf3a8('0x5')],_0x52371d[_0xf3a8('0x6')],_0x52371d[_0xf3a8('0x7')],_0x52371d['dialstatus']));utils[_0xf3a8('0x8')](_0xf3a8('0x9'),_0x52371d);delete dials[_0x52371d['uniqueid']];}exports[_0xf3a8('0xa')]=function(_0x40e634){try{utils['debug'](util[_0xf3a8('0x3')](_0xf3a8('0xb'),_0x40e634[_0xf3a8('0x4')]),_0x40e634);utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0xc'),_0x40e634[_0xf3a8('0x4')],_0x40e634[_0xf3a8('0xd')],_0x40e634['appdata']));if(_0x40e634[_0xf3a8('0xd')][_0xf3a8('0xe')]()=='set'&&_[_0xf3a8('0xf')](_0x40e634[_0xf3a8('0x10')][_0xf3a8('0xe')](),'cdr(routeid)')){var _0x1b05f3=_0x40e634['appdata']['split']('=');dials[_0x40e634[_0xf3a8('0x4')]]={'routeId':_0x1b05f3[0x1]};}}catch(_0x5d9077){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')]('[%s][dials][newexten]',_0x40e634[_0xf3a8('0x4')]),_0x5d9077);}};exports[_0xf3a8('0x12')]=function(_0xb24381){try{utils[_0xf3a8('0x13')](util[_0xf3a8('0x3')](_0xf3a8('0x14'),_0xb24381[_0xf3a8('0x4')]),_0xb24381);if(!_['isNil'](_0xb24381['variable']['outboundrouteid'])){utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0x15'),_0xb24381[_0xf3a8('0x4')],_0xb24381[_0xf3a8('0x16')]));dials[_0xb24381[_0xf3a8('0x4')]]={'routeId':_0xb24381[_0xf3a8('0x16')]};}}catch(_0x337d42){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')](_0xf3a8('0x14'),_0xb24381[_0xf3a8('0x4')]),_0x337d42);}};exports[_0xf3a8('0x17')]=function(_0x9902bd){try{if(!_[_0xf3a8('0x18')](dials[_0x9902bd['uniqueid']])){utils['debug'](util[_0xf3a8('0x3')]('[%s][dials][dialbegin]',_0x9902bd[_0xf3a8('0x4')]),_0x9902bd);dials[_0x9902bd[_0xf3a8('0x4')]]=_[_0xf3a8('0x19')](dials[_0x9902bd[_0xf3a8('0x4')]],_0x9902bd);dials[_0x9902bd[_0xf3a8('0x4')]][_0xf3a8('0x1a')]=utils[_0xf3a8('0x1b')]();dials[_0x9902bd['uniqueid']][_0xf3a8('0x1c')]=_0xf3a8('0x1d');utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0x1e'),_0x9902bd[_0xf3a8('0x4')],dials[_0x9902bd[_0xf3a8('0x4')]][_0xf3a8('0x1a')]));}}catch(_0x55019f){utils[_0xf3a8('0x11')](util['format'](_0xf3a8('0x1f'),_0x9902bd[_0xf3a8('0x4')]),_0x55019f);}};exports['dialend']=function(_0x18b105){try{if(!_['isNil'](dials[_0x18b105['uniqueid']])){utils[_0xf3a8('0x13')](util[_0xf3a8('0x3')](_0xf3a8('0x20'),_0x18b105[_0xf3a8('0x4')]),_0x18b105);dials[_0x18b105[_0xf3a8('0x4')]][_0xf3a8('0x21')]=_0x18b105[_0xf3a8('0x21')];if(_0x18b105['dialstatus']==_0xf3a8('0x22')){dials[_0x18b105[_0xf3a8('0x4')]]=_[_0xf3a8('0x19')](dials[_0x18b105[_0xf3a8('0x4')]],_0x18b105);dials[_0x18b105['uniqueid']][_0xf3a8('0x23')]=utils[_0xf3a8('0x1b')]();dials[_0x18b105[_0xf3a8('0x4')]][_0xf3a8('0x1c')]=_0xf3a8('0x24');utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0x25'),_0x18b105[_0xf3a8('0x4')],_0x18b105[_0xf3a8('0x21')],dials[_0x18b105[_0xf3a8('0x4')]][_0xf3a8('0x23')]));}else{utils[_0xf3a8('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x18b105[_0xf3a8('0x4')],_0x18b105['dialstatus']));}}}catch(_0x4db5b3){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')]('[%s][dials][dialend]',_0x18b105[_0xf3a8('0x4')]),_0x4db5b3);}};exports['hangup']=function(_0x12bed5){try{if(!_[_0xf3a8('0x18')](dials[_0x12bed5[_0xf3a8('0x4')]])){utils[_0xf3a8('0x13')](util[_0xf3a8('0x3')]('[%s][dials][hangup]',_0x12bed5[_0xf3a8('0x4')]),_0x12bed5);utils['info'](util[_0xf3a8('0x3')](_0xf3a8('0x26'),_0x12bed5[_0xf3a8('0x4')],_0x12bed5[_0xf3a8('0x6')],_0x12bed5[_0xf3a8('0x27')],_0x12bed5['cause-txt']));dials[_0x12bed5['uniqueid']]=_[_0xf3a8('0x19')](dials[_0x12bed5[_0xf3a8('0x4')]],{'endtime':utils[_0xf3a8('0x1b')](),'lastevent':'complete'});dials[_0x12bed5['uniqueid']][_0xf3a8('0x28')]=utils[_0xf3a8('0x29')](dials[_0x12bed5['uniqueid']][_0xf3a8('0x2a')],dials[_0x12bed5[_0xf3a8('0x4')]][_0xf3a8('0x1a')]);dials[_0x12bed5['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x12bed5[_0xf3a8('0x4')]][_0xf3a8('0x23')]||dials[_0x12bed5[_0xf3a8('0x4')]]['endtime'],dials[_0x12bed5[_0xf3a8('0x4')]]['starttime']);dials[_0x12bed5['uniqueid']]['billableseconds']=dials[_0x12bed5[_0xf3a8('0x4')]]['answertime']?utils[_0xf3a8('0x29')](dials[_0x12bed5[_0xf3a8('0x4')]][_0xf3a8('0x2a')],dials[_0x12bed5[_0xf3a8('0x4')]]['answertime']):0x0;writeDB(dials[_0x12bed5[_0xf3a8('0x4')]]);}}catch(_0x59355d){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')](_0xf3a8('0x2b'),_0x12bed5['uniqueid']),_0x59355d);}}; \ No newline at end of file +var _0x4636=['lastevent','connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime'];(function(_0x29f730,_0x23d7ed){var _0x189806=function(_0x2838a7){while(--_0x2838a7){_0x29f730['push'](_0x29f730['shift']());}};_0x189806(++_0x23d7ed);}(_0x4636,0xd2));var _0x6463=function(_0x39c00e,_0x2254fc){_0x39c00e=_0x39c00e-0x0;var _0x3415f9=_0x4636[_0x39c00e];return _0x3415f9;};'use strict';var _=require(_0x6463('0x0'));var util=require(_0x6463('0x1'));var utils=require(_0x6463('0x2'));var dials={};function writeDB(_0x231054){utils[_0x6463('0x3')](util[_0x6463('0x4')](_0x6463('0x5'),_0x231054[_0x6463('0x6')],_0x231054[_0x6463('0x7')],_0x231054[_0x6463('0x8')],_0x231054[_0x6463('0x9')],_0x231054[_0x6463('0xa')],_0x231054['dialstatus']));utils[_0x6463('0xb')](_0x6463('0xc'),_0x231054);delete dials[_0x231054[_0x6463('0x6')]];}exports[_0x6463('0xd')]=function(_0x5d0e63){try{utils[_0x6463('0xe')](util[_0x6463('0x4')](_0x6463('0xf'),_0x5d0e63[_0x6463('0x6')]),_0x5d0e63);utils[_0x6463('0x3')](util[_0x6463('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5d0e63[_0x6463('0x6')],_0x5d0e63['application'],_0x5d0e63['appdata']));if(_0x5d0e63[_0x6463('0x10')][_0x6463('0x11')]()==_0x6463('0x12')&&_[_0x6463('0x13')](_0x5d0e63[_0x6463('0x14')][_0x6463('0x11')](),_0x6463('0x15'))){var _0x4d1034=_0x5d0e63[_0x6463('0x14')][_0x6463('0x16')]('=');dials[_0x5d0e63[_0x6463('0x6')]]={'routeId':_0x4d1034[0x1]};}}catch(_0x1bec91){utils[_0x6463('0x17')](util[_0x6463('0x4')](_0x6463('0xf'),_0x5d0e63[_0x6463('0x6')]),_0x1bec91);}};exports['varset']=function(_0x1627df){try{utils[_0x6463('0xe')](util[_0x6463('0x4')](_0x6463('0x18'),_0x1627df[_0x6463('0x6')]),_0x1627df);if(!_[_0x6463('0x19')](_0x1627df[_0x6463('0x1a')][_0x6463('0x1b')])){utils['info'](util['format'](_0x6463('0x1c'),_0x1627df[_0x6463('0x6')],_0x1627df[_0x6463('0x1d')]));dials[_0x1627df[_0x6463('0x6')]]={'routeId':_0x1627df[_0x6463('0x1d')]};}}catch(_0x339052){utils[_0x6463('0x17')](util[_0x6463('0x4')]('[%s][dials][varset]',_0x1627df[_0x6463('0x6')]),_0x339052);}};exports['dialbegin']=function(_0x5cc6d5){try{if(!_['isNil'](dials[_0x5cc6d5['uniqueid']])){utils[_0x6463('0xe')](util[_0x6463('0x4')](_0x6463('0x1e'),_0x5cc6d5[_0x6463('0x6')]),_0x5cc6d5);dials[_0x5cc6d5[_0x6463('0x6')]]=_[_0x6463('0x1f')](dials[_0x5cc6d5[_0x6463('0x6')]],_0x5cc6d5);dials[_0x5cc6d5['uniqueid']][_0x6463('0x20')]=utils[_0x6463('0x21')]();dials[_0x5cc6d5[_0x6463('0x6')]]['lastevent']='called';utils[_0x6463('0x3')](util[_0x6463('0x4')](_0x6463('0x22'),_0x5cc6d5['uniqueid'],dials[_0x5cc6d5[_0x6463('0x6')]]['starttime']));}}catch(_0x280517){utils[_0x6463('0x17')](util[_0x6463('0x4')](_0x6463('0x1e'),_0x5cc6d5[_0x6463('0x6')]),_0x280517);}};exports[_0x6463('0x23')]=function(_0x2287c8){try{if(!_[_0x6463('0x19')](dials[_0x2287c8[_0x6463('0x6')]])){utils[_0x6463('0xe')](util[_0x6463('0x4')](_0x6463('0x24'),_0x2287c8[_0x6463('0x6')]),_0x2287c8);dials[_0x2287c8[_0x6463('0x6')]][_0x6463('0x25')]=_0x2287c8[_0x6463('0x25')];if(_0x2287c8[_0x6463('0x25')]==_0x6463('0x26')){dials[_0x2287c8[_0x6463('0x6')]]=_[_0x6463('0x1f')](dials[_0x2287c8[_0x6463('0x6')]],_0x2287c8);dials[_0x2287c8[_0x6463('0x6')]][_0x6463('0x27')]=utils[_0x6463('0x21')]();dials[_0x2287c8['uniqueid']][_0x6463('0x28')]=_0x6463('0x29');utils[_0x6463('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2287c8['uniqueid'],_0x2287c8[_0x6463('0x25')],dials[_0x2287c8['uniqueid']][_0x6463('0x27')]));}else{utils[_0x6463('0x3')](util[_0x6463('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x2287c8[_0x6463('0x6')],_0x2287c8[_0x6463('0x25')]));}}}catch(_0x16a5e5){utils[_0x6463('0x17')](util[_0x6463('0x4')](_0x6463('0x24'),_0x2287c8['uniqueid']),_0x16a5e5);}};exports['hangup']=function(_0x4fe7f7){try{if(!_[_0x6463('0x19')](dials[_0x4fe7f7[_0x6463('0x6')]])){utils[_0x6463('0xe')](util['format'](_0x6463('0x2a'),_0x4fe7f7['uniqueid']),_0x4fe7f7);utils[_0x6463('0x3')](util[_0x6463('0x4')](_0x6463('0x2b'),_0x4fe7f7[_0x6463('0x6')],_0x4fe7f7[_0x6463('0x9')],_0x4fe7f7[_0x6463('0x2c')],_0x4fe7f7['cause-txt']));dials[_0x4fe7f7[_0x6463('0x6')]]=_[_0x6463('0x1f')](dials[_0x4fe7f7[_0x6463('0x6')]],{'endtime':utils[_0x6463('0x21')](),'lastevent':_0x6463('0x2d')});dials[_0x4fe7f7[_0x6463('0x6')]][_0x6463('0x2e')]=utils[_0x6463('0x2f')](dials[_0x4fe7f7['uniqueid']][_0x6463('0x30')],dials[_0x4fe7f7[_0x6463('0x6')]][_0x6463('0x20')]);dials[_0x4fe7f7[_0x6463('0x6')]]['holdtime']=utils['diffTime'](dials[_0x4fe7f7[_0x6463('0x6')]][_0x6463('0x27')]||dials[_0x4fe7f7['uniqueid']]['endtime'],dials[_0x4fe7f7[_0x6463('0x6')]]['starttime']);dials[_0x4fe7f7[_0x6463('0x6')]][_0x6463('0x31')]=dials[_0x4fe7f7['uniqueid']][_0x6463('0x27')]?utils['diffTime'](dials[_0x4fe7f7[_0x6463('0x6')]][_0x6463('0x30')],dials[_0x4fe7f7[_0x6463('0x6')]][_0x6463('0x27')]):0x0;writeDB(dials[_0x4fe7f7['uniqueid']]);}}catch(_0x5a57f4){utils[_0x6463('0x17')](util[_0x6463('0x4')](_0x6463('0x2a'),_0x4fe7f7[_0x6463('0x6')]),_0x5a57f4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e63e456..9bef31c 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 _0x26e7=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialend','[%s][index][dialend]','../../config/environment','util','port','asterisk','username','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','debug','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr'];(function(_0x1e45f2,_0x4f7668){var _0x107a4b=function(_0x15decd){while(--_0x15decd){_0x1e45f2['push'](_0x1e45f2['shift']());}};_0x107a4b(++_0x4f7668);}(_0x26e7,0x153));var _0x726e=function(_0x21e79a,_0x5a7990){_0x21e79a=_0x21e79a-0x0;var _0x506c02=_0x26e7[_0x21e79a];return _0x506c02;};var AsteriskManager=require('asterisk-manager');var config=require(_0x726e('0x0'));var utils=require('./utils');var util=require(_0x726e('0x1'));var ami=new AsteriskManager(config['asterisk'][_0x726e('0x2')],config[_0x726e('0x3')]['ip'],config[_0x726e('0x3')][_0x726e('0x4')],config[_0x726e('0x3')]['password'],!![]);ami['keepConnected']();if(config['xdr']&&config[_0x726e('0x5')][_0x726e('0x6')]){utils[_0x726e('0x7')](_0x726e('0x8'));}else{var agents=require(_0x726e('0x9'));var calls=require(_0x726e('0xa'));var queues=require(_0x726e('0xb'));var recordings=require(_0x726e('0xc'));var members=require(_0x726e('0xd'));var dials=require(_0x726e('0xe'));var transfers=require(_0x726e('0xf'));var core=require(_0x726e('0x10'));ami['on'](_0x726e('0x11'),core[_0x726e('0x11')]);ami['on']('shutdown',core[_0x726e('0x12')]);ami['on'](_0x726e('0x13'),core[_0x726e('0x13')]);ami['on'](_0x726e('0x14'),core['error']);ami['on'](_0x726e('0x15'),core[_0x726e('0x15')]);ami['on'](_0x726e('0x16'),core[_0x726e('0x16')]);ami['on'](_0x726e('0x17'),function(_0x1aa7ba){try{utils['debug'](util['format'](_0x726e('0x18'),_0x1aa7ba[_0x726e('0x19')]),_0x1aa7ba);members[_0x726e('0x17')](_0x1aa7ba);}catch(_0xc1eaf3){utils[_0x726e('0x14')](util[_0x726e('0x1a')]('[%s][index][devicestatechange]',_0x1aa7ba[_0x726e('0x19')]),_0xc1eaf3);}});ami['on']('agentcalled',function(_0x3a4501){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')]('[%s][index][agentcalled]',_0x3a4501[_0x726e('0x1c')]),_0x3a4501);agents['agentcalled'](_0x3a4501);}catch(_0x39f195){utils[_0x726e('0x14')](util['format'](_0x726e('0x1d'),_0x3a4501[_0x726e('0x1c')]),_0x39f195);}});ami['on']('agentringnoanswer',function(_0x310ebb){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x1e'),_0x310ebb[_0x726e('0x1c')]),_0x310ebb);agents[_0x726e('0x1f')](_0x310ebb);}catch(_0x1defab){utils[_0x726e('0x14')](util[_0x726e('0x1a')]('[%s][index][agentringnoanswer]',_0x310ebb[_0x726e('0x1c')]),_0x1defab);}});ami['on'](_0x726e('0x20'),function(_0x42d358){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x21'),_0x42d358['uniqueid']),_0x42d358);agents[_0x726e('0x20')](_0x42d358);queues[_0x726e('0x20')](_0x42d358);}catch(_0x42a2d7){utils[_0x726e('0x14')](util[_0x726e('0x1a')](_0x726e('0x21'),_0x42d358[_0x726e('0x1c')]),_0x42a2d7);}});ami['on'](_0x726e('0x22'),function(_0x14edb6){try{utils[_0x726e('0x1b')](util['format'](_0x726e('0x23'),_0x14edb6[_0x726e('0x1c')]),_0x14edb6);agents[_0x726e('0x22')](_0x14edb6);queues[_0x726e('0x22')](_0x14edb6);members['agentcomplete'](_0x14edb6);}catch(_0x32e32c){utils[_0x726e('0x14')](util[_0x726e('0x1a')]('[%s][index][agentcomplete]',_0x14edb6[_0x726e('0x1c')]),_0x32e32c);}});ami['on']('queuecallerabandon',function(_0x30381a){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x24'),_0x30381a['uniqueid']),_0x30381a);agents[_0x726e('0x25')](_0x30381a);queues[_0x726e('0x25')](_0x30381a);}catch(_0x52abb8){utils[_0x726e('0x14')](util[_0x726e('0x1a')]('[%s][index][queuecallerabandon]',_0x30381a[_0x726e('0x1c')]),_0x52abb8);}});ami['on'](_0x726e('0x26'),function(_0x56fb62){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x27'),_0x56fb62[_0x726e('0x1c')]),_0x56fb62);queues[_0x726e('0x26')](_0x56fb62);recordings[_0x726e('0x26')](_0x56fb62);}catch(_0x5541be){utils[_0x726e('0x14')](util['format'](_0x726e('0x27'),_0x56fb62[_0x726e('0x1c')]),_0x5541be);}});ami['on'](_0x726e('0x28'),function(_0x21bc2a){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')]('[%s][index][queuecallerleave]',_0x21bc2a['uniqueid']),_0x21bc2a);queues[_0x726e('0x28')](_0x21bc2a);}catch(_0x21406f){utils['error'](util[_0x726e('0x1a')](_0x726e('0x29'),_0x21bc2a[_0x726e('0x1c')]),_0x21406f);}});ami['on']('musiconholdstart',function(_0x1cd152){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x2a'),_0x1cd152[_0x726e('0x1c')]),_0x1cd152);queues[_0x726e('0x2b')](_0x1cd152);calls['musiconholdstart'](_0x1cd152);}catch(_0x3b3ec6){utils[_0x726e('0x14')](util[_0x726e('0x1a')](_0x726e('0x2a'),_0x1cd152[_0x726e('0x1c')]),_0x3b3ec6);}});ami['on']('musiconholdstop',function(_0x4bcac4){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x2c'),_0x4bcac4[_0x726e('0x1c')]),_0x4bcac4);queues[_0x726e('0x2d')](_0x4bcac4);calls[_0x726e('0x2d')](_0x4bcac4);}catch(_0x2f3c00){utils['error'](util[_0x726e('0x1a')](_0x726e('0x2c'),_0x4bcac4[_0x726e('0x1c')]),_0x2f3c00);}});ami['on'](_0x726e('0x2e'),function(_0x2b3bff){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x2f'),_0x2b3bff['uniqueid']),_0x2b3bff);calls['newstate'](_0x2b3bff);recordings[_0x726e('0x2e')](_0x2b3bff);}catch(_0x867bc7){utils[_0x726e('0x14')](util['format']('[%s][index][newstate]',_0x2b3bff[_0x726e('0x1c')]),_0x867bc7);}});ami['on']('hangup',function(_0x5a06cd){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')]('[%s][index][hangup]',_0x5a06cd[_0x726e('0x1c')]),_0x5a06cd);calls['hangup'](_0x5a06cd);recordings[_0x726e('0x30')](_0x5a06cd);dials[_0x726e('0x30')](_0x5a06cd);agents[_0x726e('0x30')](_0x5a06cd);queues[_0x726e('0x30')](_0x5a06cd);}catch(_0x197fa8){utils[_0x726e('0x14')](util[_0x726e('0x1a')](_0x726e('0x31'),_0x5a06cd[_0x726e('0x1c')]),_0x197fa8);}});ami['on']('cdr',function(_0x5c2d98){try{utils[_0x726e('0x1b')](util['format']('[%s][index][cdr]',_0x5c2d98[_0x726e('0x1c')]),_0x5c2d98);members[_0x726e('0x32')](_0x5c2d98);}catch(_0x5722ea){utils[_0x726e('0x14')](util[_0x726e('0x1a')](_0x726e('0x33'),_0x5c2d98[_0x726e('0x1c')]),_0x5722ea);}});ami['on'](_0x726e('0x34'),function(_0x59009a){try{utils['debug'](util[_0x726e('0x1a')](_0x726e('0x35'),_0x59009a[_0x726e('0x1c')]),_0x59009a);queues[_0x726e('0x34')](_0x59009a);agents[_0x726e('0x34')](_0x59009a);transfers[_0x726e('0x34')](_0x59009a);}catch(_0x20e784){utils['error'](util[_0x726e('0x1a')](_0x726e('0x35'),_0x59009a[_0x726e('0x1c')]),_0x20e784);}});ami['on'](_0x726e('0x36'),function(_0x57ee50){try{utils['debug'](util[_0x726e('0x1a')](_0x726e('0x37'),_0x57ee50[_0x726e('0x38')]),_0x57ee50);queues[_0x726e('0x36')](_0x57ee50);transfers['attendedtransfer'](_0x57ee50);agents['attendedtransfer'](_0x57ee50);calls[_0x726e('0x36')](_0x57ee50);}catch(_0x2f7c94){utils[_0x726e('0x14')](util[_0x726e('0x1a')]('[%s][index][attendedtransfer]',_0x57ee50['origtransfereruniqueid']),_0x2f7c94);}});ami['on'](_0x726e('0x39'),function(_0x320e94){try{utils['debug'](util[_0x726e('0x1a')](_0x726e('0x3a'),_0x320e94[_0x726e('0x1c')]),_0x320e94);queues[_0x726e('0x39')](_0x320e94);recordings[_0x726e('0x39')](_0x320e94);calls[_0x726e('0x39')](_0x320e94);dials['varset'](_0x320e94);}catch(_0x2f53c9){utils[_0x726e('0x14')](util[_0x726e('0x1a')](_0x726e('0x3a'),_0x320e94[_0x726e('0x1c')]),_0x2f53c9);}});ami['on'](_0x726e('0x3b'),function(_0x447602){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')]('[%s][index][newexten]',_0x447602[_0x726e('0x1c')]),_0x447602);calls[_0x726e('0x3b')](_0x447602);recordings[_0x726e('0x3b')](_0x447602);dials[_0x726e('0x3b')](_0x447602);}catch(_0x44d502){utils['error'](util['format'](_0x726e('0x3c'),_0x447602[_0x726e('0x1c')]),_0x44d502);}});ami['on']('newchannel',function(_0x47cfea){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')](_0x726e('0x3d'),_0x47cfea[_0x726e('0x1c')]),_0x47cfea);calls[_0x726e('0x3e')](_0x47cfea);recordings[_0x726e('0x3e')](_0x47cfea);}catch(_0x5540ae){utils[_0x726e('0x14')](util[_0x726e('0x1a')](_0x726e('0x3d'),_0x47cfea[_0x726e('0x1c')]),_0x5540ae);}});ami['on']('dialbegin',function(_0x3def52){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x3def52[_0x726e('0x1c')]),_0x3def52);dials['dialbegin'](_0x3def52);}catch(_0x32dc06){utils[_0x726e('0x14')](util[_0x726e('0x1a')]('[%s]dialbegin',_0x3def52['uniqueid']),_0x32dc06);}});ami['on'](_0x726e('0x3f'),function(_0x2ffb58){try{utils[_0x726e('0x1b')](util[_0x726e('0x1a')]('[%s][index][dialend]',_0x2ffb58[_0x726e('0x1c')]),_0x2ffb58);dials['dialend'](_0x2ffb58);}catch(_0x4dee1c){utils['error'](util['format'](_0x726e('0x40'),_0x2ffb58[_0x726e('0x1c')]),_0x4dee1c);}});} \ No newline at end of file +var _0x869d=['agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x4d7079,_0x3ec1ea){var _0xb207f3=function(_0x4315e7){while(--_0x4315e7){_0x4d7079['push'](_0x4d7079['shift']());}};_0xb207f3(++_0x3ec1ea);}(_0x869d,0x1a8));var _0xd869=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x869d[_0x1d426f];return _0x17f71a;};var AsteriskManager=require(_0xd869('0x0'));var config=require(_0xd869('0x1'));var utils=require('./utils');var util=require(_0xd869('0x2'));var ami=new AsteriskManager(config[_0xd869('0x3')][_0xd869('0x4')],config['asterisk']['ip'],config[_0xd869('0x3')][_0xd869('0x5')],config[_0xd869('0x3')][_0xd869('0x6')],!![]);ami['keepConnected']();if(config[_0xd869('0x7')]&&config['xdr'][_0xd869('0x8')]){utils[_0xd869('0x9')]('XDR\x20DISABLED');}else{var agents=require(_0xd869('0xa'));var calls=require(_0xd869('0xb'));var queues=require(_0xd869('0xc'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0xd869('0xd'));ami['on'](_0xd869('0xe'),core['connect']);ami['on'](_0xd869('0xf'),core[_0xd869('0xf')]);ami['on'](_0xd869('0x10'),core[_0xd869('0x10')]);ami['on']('error',core[_0xd869('0x11')]);ami['on'](_0xd869('0x12'),core[_0xd869('0x12')]);ami['on'](_0xd869('0x13'),core[_0xd869('0x13')]);ami['on'](_0xd869('0x14'),function(_0x5a7d54){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x17'),_0x5a7d54['device']),_0x5a7d54);members[_0xd869('0x14')](_0x5a7d54);}catch(_0x5da12d){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x17'),_0x5a7d54['device']),_0x5da12d);}});ami['on'](_0xd869('0x18'),function(_0x2174f9){try{utils[_0xd869('0x15')](util[_0xd869('0x16')]('[%s][index][agentcalled]',_0x2174f9[_0xd869('0x19')]),_0x2174f9);agents[_0xd869('0x18')](_0x2174f9);}catch(_0x5a2f71){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x1a'),_0x2174f9['uniqueid']),_0x5a2f71);}});ami['on'](_0xd869('0x1b'),function(_0x5b5bee){try{utils[_0xd869('0x15')](util[_0xd869('0x16')]('[%s][index][agentringnoanswer]',_0x5b5bee['uniqueid']),_0x5b5bee);agents['agentringnoanswer'](_0x5b5bee);}catch(_0x2cb73c){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x1c'),_0x5b5bee[_0xd869('0x19')]),_0x2cb73c);}});ami['on'](_0xd869('0x1d'),function(_0x586fd0){try{utils['debug'](util[_0xd869('0x16')](_0xd869('0x1e'),_0x586fd0['uniqueid']),_0x586fd0);agents[_0xd869('0x1d')](_0x586fd0);queues['agentconnect'](_0x586fd0);}catch(_0x3a902c){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x1e'),_0x586fd0['uniqueid']),_0x3a902c);}});ami['on'](_0xd869('0x1f'),function(_0x98dfa3){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x20'),_0x98dfa3[_0xd869('0x19')]),_0x98dfa3);agents[_0xd869('0x1f')](_0x98dfa3);queues[_0xd869('0x1f')](_0x98dfa3);members[_0xd869('0x1f')](_0x98dfa3);}catch(_0x27054f){utils[_0xd869('0x11')](util['format'](_0xd869('0x20'),_0x98dfa3[_0xd869('0x19')]),_0x27054f);}});ami['on']('queuecallerabandon',function(_0x14582d){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x21'),_0x14582d[_0xd869('0x19')]),_0x14582d);agents[_0xd869('0x22')](_0x14582d);queues['queuecallerabandon'](_0x14582d);}catch(_0x2e205a){utils[_0xd869('0x11')](util[_0xd869('0x16')]('[%s][index][queuecallerabandon]',_0x14582d[_0xd869('0x19')]),_0x2e205a);}});ami['on'](_0xd869('0x23'),function(_0x3ccc93){try{utils[_0xd869('0x15')](util[_0xd869('0x16')]('[%s][index][queuecallerjoin]',_0x3ccc93[_0xd869('0x19')]),_0x3ccc93);queues['queuecallerjoin'](_0x3ccc93);recordings['queuecallerjoin'](_0x3ccc93);}catch(_0x48b9d3){utils[_0xd869('0x11')](util['format'](_0xd869('0x24'),_0x3ccc93[_0xd869('0x19')]),_0x48b9d3);}});ami['on'](_0xd869('0x25'),function(_0x11249d){try{utils[_0xd869('0x15')](util[_0xd869('0x16')]('[%s][index][queuecallerleave]',_0x11249d['uniqueid']),_0x11249d);queues[_0xd869('0x25')](_0x11249d);}catch(_0x38bf7d){utils['error'](util[_0xd869('0x16')](_0xd869('0x26'),_0x11249d[_0xd869('0x19')]),_0x38bf7d);}});ami['on']('musiconholdstart',function(_0x47ca8e){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x27'),_0x47ca8e['uniqueid']),_0x47ca8e);queues['musiconholdstart'](_0x47ca8e);calls[_0xd869('0x28')](_0x47ca8e);}catch(_0x1b06b7){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x27'),_0x47ca8e[_0xd869('0x19')]),_0x1b06b7);}});ami['on'](_0xd869('0x29'),function(_0x38fb95){try{utils['debug'](util['format']('[%s][index][musiconholdstop]',_0x38fb95[_0xd869('0x19')]),_0x38fb95);queues[_0xd869('0x29')](_0x38fb95);calls['musiconholdstop'](_0x38fb95);}catch(_0x547411){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x2a'),_0x38fb95[_0xd869('0x19')]),_0x547411);}});ami['on'](_0xd869('0x2b'),function(_0xcbf7d){try{utils['debug'](util[_0xd869('0x16')](_0xd869('0x2c'),_0xcbf7d[_0xd869('0x19')]),_0xcbf7d);calls[_0xd869('0x2b')](_0xcbf7d);recordings['newstate'](_0xcbf7d);}catch(_0x4c40db){utils[_0xd869('0x11')](util['format'](_0xd869('0x2c'),_0xcbf7d[_0xd869('0x19')]),_0x4c40db);}});ami['on'](_0xd869('0x2d'),function(_0x2a5f18){try{utils['debug'](util['format'](_0xd869('0x2e'),_0x2a5f18['uniqueid']),_0x2a5f18);calls[_0xd869('0x2d')](_0x2a5f18);recordings[_0xd869('0x2d')](_0x2a5f18);dials[_0xd869('0x2d')](_0x2a5f18);agents[_0xd869('0x2d')](_0x2a5f18);queues[_0xd869('0x2d')](_0x2a5f18);}catch(_0x324049){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x2e'),_0x2a5f18['uniqueid']),_0x324049);}});ami['on'](_0xd869('0x2f'),function(_0x4a375f){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x30'),_0x4a375f[_0xd869('0x19')]),_0x4a375f);members['cdr'](_0x4a375f);}catch(_0x58a51e){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x30'),_0x4a375f[_0xd869('0x19')]),_0x58a51e);}});ami['on']('blindtransfer',function(_0x5b28f6){try{utils['debug'](util[_0xd869('0x16')]('[%s][index][blindtransfer]',_0x5b28f6['uniqueid']),_0x5b28f6);queues[_0xd869('0x31')](_0x5b28f6);agents[_0xd869('0x31')](_0x5b28f6);transfers[_0xd869('0x31')](_0x5b28f6);}catch(_0x5bd587){utils[_0xd869('0x11')](util['format'](_0xd869('0x32'),_0x5b28f6['uniqueid']),_0x5bd587);}});ami['on'](_0xd869('0x33'),function(_0x1fc930){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x34'),_0x1fc930[_0xd869('0x35')]),_0x1fc930);queues[_0xd869('0x33')](_0x1fc930);transfers[_0xd869('0x33')](_0x1fc930);agents[_0xd869('0x33')](_0x1fc930);calls['attendedtransfer'](_0x1fc930);}catch(_0x43d221){utils['error'](util[_0xd869('0x16')](_0xd869('0x34'),_0x1fc930['origtransfereruniqueid']),_0x43d221);}});ami['on']('varset',function(_0x3dc14e){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x36'),_0x3dc14e['uniqueid']),_0x3dc14e);queues[_0xd869('0x37')](_0x3dc14e);recordings['varset'](_0x3dc14e);calls['varset'](_0x3dc14e);dials[_0xd869('0x37')](_0x3dc14e);}catch(_0x4ede18){utils[_0xd869('0x11')](util['format'](_0xd869('0x36'),_0x3dc14e[_0xd869('0x19')]),_0x4ede18);}});ami['on'](_0xd869('0x38'),function(_0x1d33f9){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x39'),_0x1d33f9['uniqueid']),_0x1d33f9);calls['newexten'](_0x1d33f9);recordings[_0xd869('0x38')](_0x1d33f9);dials[_0xd869('0x38')](_0x1d33f9);}catch(_0x5a3f14){utils[_0xd869('0x11')](util[_0xd869('0x16')](_0xd869('0x39'),_0x1d33f9[_0xd869('0x19')]),_0x5a3f14);}});ami['on']('newchannel',function(_0x3b75d4){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x3a'),_0x3b75d4['uniqueid']),_0x3b75d4);calls[_0xd869('0x3b')](_0x3b75d4);recordings[_0xd869('0x3b')](_0x3b75d4);}catch(_0x1205b4){utils['error'](util[_0xd869('0x16')](_0xd869('0x3a'),_0x3b75d4[_0xd869('0x19')]),_0x1205b4);}});ami['on'](_0xd869('0x3c'),function(_0x44a15a){try{utils[_0xd869('0x15')](util[_0xd869('0x16')](_0xd869('0x3d'),_0x44a15a[_0xd869('0x19')]),_0x44a15a);dials[_0xd869('0x3c')](_0x44a15a);}catch(_0x20d823){utils['error'](util[_0xd869('0x16')](_0xd869('0x3e'),_0x44a15a['uniqueid']),_0x20d823);}});ami['on']('dialend',function(_0xa2a7bd){try{utils['debug'](util[_0xd869('0x16')]('[%s][index][dialend]',_0xa2a7bd['uniqueid']),_0xa2a7bd);dials[_0xd869('0x3f')](_0xa2a7bd);}catch(_0x155641){utils['error'](util[_0xd869('0x16')](_0xd869('0x40'),_0xa2a7bd[_0xd869('0x19')]),_0x155641);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ceecde9..8947e51 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 _0xada4=['channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data2','source','util','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xada4,0x1e5));var _0x4ada=function(_0x48f318,_0x6f301f){_0x48f318=_0x48f318-0x0;var _0x77bf4d=_0xada4[_0x48f318];return _0x77bf4d;};'use strict';var _=require('lodash');var util=require(_0x4ada('0x0'));var utils=require('./utils');var members={};var exclude=[_0x4ada('0x1'),_0x4ada('0x2')];function writeDB(_0x488334){utils[_0x4ada('0x3')](util[_0x4ada('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x488334[_0x4ada('0x5')],_0x488334[_0x4ada('0x6')],_0x488334['channel'],_0x488334['data2'],_0x488334[_0x4ada('0x7')],_0x488334[_0x4ada('0x8')]));if(_0x488334['interface']){utils[_0x4ada('0x9')](_0x488334[_0x4ada('0x6')])[_0x4ada('0xa')](function(_0x20f7b1){if(_0x20f7b1){_0x488334[_0x4ada('0x7')]=_0x20f7b1[_0x4ada('0xb')];_0x488334[_0x4ada('0xc')]=_0x20f7b1[_0x4ada('0xc')];utils[_0x4ada('0xd')](_0x4ada('0xe'),_0x488334);}else{utils[_0x4ada('0xf')](_0x488334[_0x4ada('0x6')][_0x4ada('0x10')]('/')[0x1])[_0x4ada('0xa')](function(_0x3b6f09){if(_0x3b6f09){_0x488334[_0x4ada('0x7')]=_0x3b6f09[_0x4ada('0xb')];_0x488334[_0x4ada('0xc')]=_0x3b6f09[_0x4ada('0xc')];utils[_0x4ada('0xd')]('CreateMemberReport',_0x488334);}});}})[_0x4ada('0x11')](function(_0x34b24b){utils[_0x4ada('0x12')](util[_0x4ada('0x4')](_0x4ada('0x13'),_0x488334['uniqueid']),_0x34b24b);});}delete members[_0x488334['interface']];}function startsWith(_0x450c8b,_0x527407){return _[_0x4ada('0x14')](_0x450c8b,function(_0x5acfc3){return _[_0x4ada('0x15')](_0x527407,_0x5acfc3);});}exports[_0x4ada('0x16')]=function(_0x5cda0b){try{utils[_0x4ada('0x17')](util[_0x4ada('0x4')]('[%s][members][devicestatechange]',members[_0x5cda0b[_0x4ada('0x18')]]?members[_0x5cda0b[_0x4ada('0x18')]][_0x4ada('0x5')]:_0x5cda0b[_0x4ada('0x18')]),_0x5cda0b);utils[_0x4ada('0x3')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5cda0b[_0x4ada('0x18')]]?members[_0x5cda0b[_0x4ada('0x18')]][_0x4ada('0x5')]:_0x5cda0b[_0x4ada('0x18')],_0x5cda0b[_0x4ada('0x19')],_0x5cda0b['device']));switch(_0x5cda0b[_0x4ada('0x19')]){case _0x4ada('0x1a'):case _0x4ada('0x1b'):if(!startsWith(exclude,_0x5cda0b[_0x4ada('0x18')])){members[_0x5cda0b[_0x4ada('0x18')]]={'channel':_0x4ada('0x1c'),'interface':_0x5cda0b['device'],'type':'TALKING','enterAt':utils[_0x4ada('0x1d')](),'role':_0x4ada('0x1e')};}break;case _0x4ada('0x1f'):if(!_[_0x4ada('0x20')](members[_0x5cda0b[_0x4ada('0x18')]])){members[_0x5cda0b[_0x4ada('0x18')]][_0x4ada('0x21')]=utils[_0x4ada('0x1d')]();members[_0x5cda0b['device']][_0x4ada('0x22')]=utils[_0x4ada('0x23')](members[_0x5cda0b[_0x4ada('0x18')]][_0x4ada('0x21')],members[_0x5cda0b[_0x4ada('0x18')]][_0x4ada('0x24')]);if(members[_0x5cda0b[_0x4ada('0x18')]][_0x4ada('0x5')]){writeDB(members[_0x5cda0b[_0x4ada('0x18')]]);}}break;default:break;}}catch(_0xce79e){utils[_0x4ada('0x12')](util[_0x4ada('0x4')](_0x4ada('0x25'),members[_0x5cda0b['device']]?members[_0x5cda0b['device']][_0x4ada('0x5')]:_0x5cda0b[_0x4ada('0x18')]),_0xce79e);}};exports[_0x4ada('0x26')]=function(_0x99fef){try{if(!_[_0x4ada('0x20')](members[_0x99fef['interface']])){utils[_0x4ada('0x17')](util[_0x4ada('0x4')]('[%s][members][agentcomplete]',_0x99fef[_0x4ada('0x5')]),_0x99fef);utils[_0x4ada('0x3')](util[_0x4ada('0x4')](_0x4ada('0x27'),_0x99fef['uniqueid'],_0x99fef[_0x4ada('0x6')],_0x99fef[_0x4ada('0x28')]));members[_0x99fef[_0x4ada('0x6')]]=_[_0x4ada('0x29')](members[_0x99fef[_0x4ada('0x6')]],{'data4':_0x99fef[_0x4ada('0x28')],'uniqueid':_0x99fef[_0x4ada('0x5')]});}}catch(_0x18f649){utils['error'](util[_0x4ada('0x4')](_0x4ada('0x2a'),_0x99fef[_0x4ada('0x5')]),_0x18f649);}};exports[_0x4ada('0x2b')]=function(_0x3ffcd8){try{utils['debug'](util[_0x4ada('0x4')](_0x4ada('0x2c'),_0x3ffcd8[_0x4ada('0x5')]),_0x3ffcd8);if(_0x3ffcd8['channel']){var _0x5666c0=_0x3ffcd8[_0x4ada('0x2d')][_0x4ada('0x10')]('-')[0x0];if(!_[_0x4ada('0x20')](members[_0x5666c0])){members[_0x5666c0]=_[_0x4ada('0x29')](members[_0x5666c0],{'data1':members[_0x5666c0][_0x4ada('0x2e')]||_0x3ffcd8['type'],'data2':members[_0x5666c0]['data2']||_0x3ffcd8['source'],'data3':members[_0x5666c0][_0x4ada('0x2f')]||_0x3ffcd8[_0x4ada('0x30')],'uniqueid':members[_0x5666c0][_0x4ada('0x5')]||_0x3ffcd8[_0x4ada('0x5')]});utils[_0x4ada('0x3')](util['format'](_0x4ada('0x31'),_0x3ffcd8[_0x4ada('0x5')],members[_0x5666c0][_0x4ada('0x2e')],members[_0x5666c0]['data2'],members[_0x5666c0]['data3']));if(members[_0x5666c0][_0x4ada('0x21')]){writeDB(members[_0x5666c0]);}}}if(_0x3ffcd8[_0x4ada('0x32')]){var _0x1bf6c0=_0x3ffcd8[_0x4ada('0x32')][_0x4ada('0x10')]('-')[0x0];if(!_[_0x4ada('0x20')](members[_0x1bf6c0])){members[_0x1bf6c0]=_[_0x4ada('0x29')](members[_0x1bf6c0],{'data1':members[_0x1bf6c0][_0x4ada('0x2e')]||_0x3ffcd8[_0x4ada('0x8')],'data2':members[_0x1bf6c0][_0x4ada('0x33')]||_0x3ffcd8[_0x4ada('0x34')],'data3':members[_0x1bf6c0][_0x4ada('0x2f')]||_0x3ffcd8[_0x4ada('0x30')],'uniqueid':members[_0x1bf6c0][_0x4ada('0x5')]||_0x3ffcd8[_0x4ada('0x5')]});utils[_0x4ada('0x3')](util[_0x4ada('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3ffcd8['uniqueid'],members[_0x1bf6c0][_0x4ada('0x2e')],members[_0x1bf6c0][_0x4ada('0x33')],members[_0x1bf6c0]['data3']));if(members[_0x1bf6c0][_0x4ada('0x21')]){writeDB(members[_0x1bf6c0]);}}}}catch(_0x26a663){utils[_0x4ada('0x12')](util['format'](_0x4ada('0x2c'),_0x3ffcd8[_0x4ada('0x5')]),_0x26a663);}}; \ No newline at end of file +var _0xbe36=['diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','[%s][members][cdr]','split','data1','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','source','lodash','./utils','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','format','uniqueid','some','startsWith','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','exitAt','duration'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0xbe36,0x15e));var _0x6be3=function(_0x135e83,_0x20ef62){_0x135e83=_0x135e83-0x0;var _0x11c6d9=_0xbe36[_0x135e83];return _0x11c6d9;};'use strict';var _=require(_0x6be3('0x0'));var util=require('util');var utils=require(_0x6be3('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x6be3('0x2')];function writeDB(_0x4b10c2){utils['info'](util['format'](_0x6be3('0x3'),_0x4b10c2['uniqueid'],_0x4b10c2['interface'],_0x4b10c2[_0x6be3('0x4')],_0x4b10c2[_0x6be3('0x5')],_0x4b10c2[_0x6be3('0x6')],_0x4b10c2[_0x6be3('0x7')]));if(_0x4b10c2[_0x6be3('0x8')]){utils[_0x6be3('0x9')](_0x4b10c2['interface'])[_0x6be3('0xa')](function(_0x166cb5){if(_0x166cb5){_0x4b10c2[_0x6be3('0x6')]=_0x166cb5[_0x6be3('0xb')];_0x4b10c2[_0x6be3('0xc')]=_0x166cb5[_0x6be3('0xc')];utils[_0x6be3('0xd')](_0x6be3('0xe'),_0x4b10c2);}else{utils[_0x6be3('0xf')](_0x4b10c2['interface']['split']('/')[0x1])[_0x6be3('0xa')](function(_0x211375){if(_0x211375){_0x4b10c2[_0x6be3('0x6')]=_0x211375['name'];_0x4b10c2[_0x6be3('0xc')]=_0x211375[_0x6be3('0xc')];utils[_0x6be3('0xd')]('CreateMemberReport',_0x4b10c2);}});}})[_0x6be3('0x10')](function(_0x1ee3a4){utils[_0x6be3('0x11')](util[_0x6be3('0x12')]('[%s][members][writeDB]',_0x4b10c2[_0x6be3('0x13')]),_0x1ee3a4);});}delete members[_0x4b10c2[_0x6be3('0x8')]];}function startsWith(_0x329db8,_0xe150dd){return _[_0x6be3('0x14')](_0x329db8,function(_0x262d59){return _[_0x6be3('0x15')](_0xe150dd,_0x262d59);});}exports['devicestatechange']=function(_0x35d68a){try{utils[_0x6be3('0x16')](util[_0x6be3('0x12')](_0x6be3('0x17'),members[_0x35d68a[_0x6be3('0x18')]]?members[_0x35d68a[_0x6be3('0x18')]][_0x6be3('0x13')]:_0x35d68a['device']),_0x35d68a);utils[_0x6be3('0x19')](util[_0x6be3('0x12')](_0x6be3('0x1a'),members[_0x35d68a[_0x6be3('0x18')]]?members[_0x35d68a[_0x6be3('0x18')]][_0x6be3('0x13')]:_0x35d68a[_0x6be3('0x18')],_0x35d68a[_0x6be3('0x1b')],_0x35d68a[_0x6be3('0x18')]));switch(_0x35d68a[_0x6be3('0x1b')]){case _0x6be3('0x1c'):case _0x6be3('0x1d'):if(!startsWith(exclude,_0x35d68a[_0x6be3('0x18')])){members[_0x35d68a[_0x6be3('0x18')]]={'channel':'voice','interface':_0x35d68a[_0x6be3('0x18')],'type':'TALKING','enterAt':utils[_0x6be3('0x1e')](),'role':_0x6be3('0x1f')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x35d68a[_0x6be3('0x18')]])){members[_0x35d68a[_0x6be3('0x18')]][_0x6be3('0x20')]=utils['now']();members[_0x35d68a[_0x6be3('0x18')]][_0x6be3('0x21')]=utils[_0x6be3('0x22')](members[_0x35d68a['device']][_0x6be3('0x20')],members[_0x35d68a[_0x6be3('0x18')]][_0x6be3('0x23')]);if(members[_0x35d68a['device']][_0x6be3('0x13')]){writeDB(members[_0x35d68a[_0x6be3('0x18')]]);}}break;default:break;}}catch(_0x50d05b){utils['error'](util[_0x6be3('0x12')](_0x6be3('0x17'),members[_0x35d68a[_0x6be3('0x18')]]?members[_0x35d68a['device']]['uniqueid']:_0x35d68a[_0x6be3('0x18')]),_0x50d05b);}};exports[_0x6be3('0x24')]=function(_0x9d07ff){try{if(!_[_0x6be3('0x25')](members[_0x9d07ff[_0x6be3('0x8')]])){utils[_0x6be3('0x16')](util['format'](_0x6be3('0x26'),_0x9d07ff[_0x6be3('0x13')]),_0x9d07ff);utils[_0x6be3('0x19')](util[_0x6be3('0x12')](_0x6be3('0x27'),_0x9d07ff[_0x6be3('0x13')],_0x9d07ff['interface'],_0x9d07ff['queue']));members[_0x9d07ff[_0x6be3('0x8')]]=_[_0x6be3('0x28')](members[_0x9d07ff[_0x6be3('0x8')]],{'data4':_0x9d07ff['queue'],'uniqueid':_0x9d07ff[_0x6be3('0x13')]});}}catch(_0x2d4231){utils[_0x6be3('0x11')](util[_0x6be3('0x12')](_0x6be3('0x26'),_0x9d07ff[_0x6be3('0x13')]),_0x2d4231);}};exports['cdr']=function(_0x5c9c70){try{utils[_0x6be3('0x16')](util[_0x6be3('0x12')](_0x6be3('0x29'),_0x5c9c70[_0x6be3('0x13')]),_0x5c9c70);if(_0x5c9c70['channel']){var _0x25209e=_0x5c9c70['channel'][_0x6be3('0x2a')]('-')[0x0];if(!_[_0x6be3('0x25')](members[_0x25209e])){members[_0x25209e]=_[_0x6be3('0x28')](members[_0x25209e],{'data1':members[_0x25209e][_0x6be3('0x2b')]||_0x5c9c70[_0x6be3('0x7')],'data2':members[_0x25209e]['data2']||_0x5c9c70['source'],'data3':members[_0x25209e]['data3']||_0x5c9c70['destination'],'uniqueid':members[_0x25209e][_0x6be3('0x13')]||_0x5c9c70[_0x6be3('0x13')]});utils[_0x6be3('0x19')](util[_0x6be3('0x12')](_0x6be3('0x2c'),_0x5c9c70['uniqueid'],members[_0x25209e][_0x6be3('0x2b')],members[_0x25209e][_0x6be3('0x5')],members[_0x25209e][_0x6be3('0x2d')]));if(members[_0x25209e][_0x6be3('0x20')]){writeDB(members[_0x25209e]);}}}if(_0x5c9c70[_0x6be3('0x2e')]){var _0x2b0a63=_0x5c9c70[_0x6be3('0x2e')][_0x6be3('0x2a')]('-')[0x0];if(!_[_0x6be3('0x25')](members[_0x2b0a63])){members[_0x2b0a63]=_[_0x6be3('0x28')](members[_0x2b0a63],{'data1':members[_0x2b0a63]['data1']||_0x5c9c70[_0x6be3('0x7')],'data2':members[_0x2b0a63][_0x6be3('0x5')]||_0x5c9c70[_0x6be3('0x2f')],'data3':members[_0x2b0a63]['data3']||_0x5c9c70['destination'],'uniqueid':members[_0x2b0a63][_0x6be3('0x13')]||_0x5c9c70[_0x6be3('0x13')]});utils[_0x6be3('0x19')](util['format'](_0x6be3('0x2c'),_0x5c9c70[_0x6be3('0x13')],members[_0x2b0a63][_0x6be3('0x2b')],members[_0x2b0a63][_0x6be3('0x5')],members[_0x2b0a63][_0x6be3('0x2d')]));if(members[_0x2b0a63][_0x6be3('0x20')]){writeDB(members[_0x2b0a63]);}}}}catch(_0x4d0ff3){utils[_0x6be3('0x11')](util[_0x6be3('0x12')](_0x6be3('0x29'),_0x5c9c70[_0x6be3('0x13')]),_0x4d0ff3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2da9255..b29eea9 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 _0xb923=['[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','value','variable','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','[%s][queues][queuecallerjoin]','assign','position','now','error','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt'];(function(_0x18d885,_0x38de7f){var _0x4a0f2c=function(_0x18b2f7){while(--_0x18b2f7){_0x18d885['push'](_0x18d885['shift']());}};_0x4a0f2c(++_0x38de7f);}(_0xb923,0xa2));var _0x3b92=function(_0x46aad3,_0x5c363f){_0x46aad3=_0x46aad3-0x0;var _0x20e425=_0xb923[_0x46aad3];return _0x20e425;};'use strict';var _=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var utils=require(_0x3b92('0x2'));var queues={};function writeDB(_0x4d0b7b){utils[_0x3b92('0x3')](util[_0x3b92('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4d0b7b['uniqueid'],_0x4d0b7b['channel'],_0x4d0b7b[_0x3b92('0x5')],_0x4d0b7b[_0x3b92('0x6')],_0x4d0b7b[_0x3b92('0x7')],_0x4d0b7b[_0x3b92('0x8')],_0x4d0b7b[_0x3b92('0x9')]));if(_0x4d0b7b[_0x3b92('0x5')]){utils[_0x3b92('0xa')](_0x4d0b7b['queue'])['then'](function(_0x2aefa5){if(_0x2aefa5){_0x4d0b7b['type']=_0x2aefa5[_0x3b92('0xb')];}utils[_0x3b92('0xc')]('CreateVoiceQueueReport',_0x4d0b7b);});}else{utils[_0x3b92('0xc')](_0x3b92('0xd'),_0x4d0b7b);}if(_0x4d0b7b[_0x3b92('0xe')]){delete queues[_0x4d0b7b[_0x3b92('0xe')]];}else{delete queues[_0x4d0b7b[_0x3b92('0xf')]];}}exports['queuecallerjoin']=function(_0xd82192){try{utils['debug'](util['format'](_0x3b92('0x10'),_0xd82192[_0x3b92('0xf')]),_0xd82192);utils[_0x3b92('0x3')](util[_0x3b92('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xd82192['uniqueid'],_0xd82192[_0x3b92('0x5')],_0xd82192['position']));queues[_0xd82192['uniqueid']]=_[_0x3b92('0x11')](_0xd82192,{'originalposition':_0xd82192[_0x3b92('0x12')],'queuecallerjoinAt':utils[_0x3b92('0x13')](),'mohtime':0x0});}catch(_0x2470b7){utils[_0x3b92('0x14')](util['format'](_0x3b92('0x10'),_0xd82192[_0x3b92('0xf')]),_0x2470b7);}};exports['hangup']=function(_0x4e6da7){try{if(!_[_0x3b92('0x15')](queues[_0x4e6da7[_0x3b92('0xf')]])){utils[_0x3b92('0x16')](util[_0x3b92('0x4')](_0x3b92('0x17'),_0x4e6da7[_0x3b92('0xf')]),_0x4e6da7);if(queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0x18')]){if(!queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0x19')]&&!queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0x1a')]){queues[_0x4e6da7[_0x3b92('0xf')]]['queuecallercomplete']=!![];queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0x1b')]=utils[_0x3b92('0x13')]();queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0x9')]=_0x3b92('0x1c');}utils['info'](util[_0x3b92('0x4')](_0x3b92('0x1d'),_0x4e6da7['uniqueid'],queues[_0x4e6da7['uniqueid']]['name'],queues[_0x4e6da7['uniqueid']][_0x3b92('0x9')]));writeDB(queues[_0x4e6da7[_0x3b92('0xf')]]);}else if(queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0xe')]){utils[_0x3b92('0x3')](util[_0x3b92('0x4')](_0x3b92('0x1e'),_0x4e6da7['uniqueid'],queues[_0x4e6da7[_0x3b92('0xf')]]['name'],queues[_0x4e6da7[_0x3b92('0xf')]]['transfereduniqueid']));queues[queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0xe')]]=queues[_0x4e6da7[_0x3b92('0xf')]];queues[queues[_0x4e6da7[_0x3b92('0xf')]][_0x3b92('0xe')]][_0x3b92('0x1f')]=0x2;delete queues[_0x4e6da7['uniqueid']];}}}catch(_0x407496){utils[_0x3b92('0x14')](util[_0x3b92('0x4')]('[%s][queues][hangup]',_0x4e6da7['uniqueid']),_0x407496);}};exports[_0x3b92('0x20')]=function(_0x3d96d5){try{utils['debug'](util['format'](_0x3b92('0x21'),_0x3d96d5['uniqueid']),_0x3d96d5);if(!_[_0x3b92('0x15')](_0x3d96d5['variable']['queuestatus'])&&_0x3d96d5['value'][_0x3b92('0x22')]()!==_0x3b92('0x23')){if(!_['isNil'](queues[_0x3d96d5[_0x3b92('0xf')]])){queues[_0x3d96d5[_0x3b92('0xf')]]['queuecallerabandon']=![];queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x24')]=null;queues[_0x3d96d5[_0x3b92('0xf')]]['queuecallerexit']=!![];queues[_0x3d96d5['uniqueid']][_0x3b92('0x25')]=utils[_0x3b92('0x13')]();queues[_0x3d96d5[_0x3b92('0xf')]]['queuecallerexitreason']=_0x3d96d5['value'][_0x3b92('0x22')]();utils['info'](util[_0x3b92('0x4')](_0x3b92('0x26'),_0x3d96d5[_0x3b92('0xf')],queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x27')],_0x3d96d5[_0x3b92('0x28')],queues[_0x3d96d5[_0x3b92('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x3d96d5[_0x3b92('0xf')]]);}}else if(!_[_0x3b92('0x15')](_0x3d96d5[_0x3b92('0x29')]['queueposition'])){if(!_[_0x3b92('0x15')](queues[_0x3d96d5[_0x3b92('0xf')]])&&!queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x19')]){queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x19')]=![];queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x24')]=null;queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x1a')]=!![];queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x25')]=utils[_0x3b92('0x13')]();queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x9')]=_0x3b92('0x2a');utils[_0x3b92('0x3')](util[_0x3b92('0x4')](_0x3b92('0x2b'),_0x3d96d5[_0x3b92('0xf')],queues[_0x3d96d5[_0x3b92('0xf')]][_0x3b92('0x27')],_0x3d96d5[_0x3b92('0x28')],queues[_0x3d96d5[_0x3b92('0xf')]]['queuecallerexitreason']));}}}catch(_0x4423cb){utils[_0x3b92('0x14')](util['format'](_0x3b92('0x21'),_0x3d96d5[_0x3b92('0xf')]),_0x4423cb);}};exports[_0x3b92('0x19')]=function(_0x2e84a7){try{if(!_[_0x3b92('0x15')](queues[_0x2e84a7[_0x3b92('0xf')]])){utils[_0x3b92('0x16')](util[_0x3b92('0x4')](_0x3b92('0x2c'),_0x2e84a7['uniqueid']),_0x2e84a7);queues[_0x2e84a7[_0x3b92('0xf')]][_0x3b92('0x1a')]=![];queues[_0x2e84a7['uniqueid']][_0x3b92('0x25')]=null;queues[_0x2e84a7['uniqueid']][_0x3b92('0x19')]=!![];queues[_0x2e84a7['uniqueid']][_0x3b92('0x24')]=utils[_0x3b92('0x13')]();queues[_0x2e84a7[_0x3b92('0xf')]][_0x3b92('0x9')]=_0x3b92('0x2d');utils['info'](util[_0x3b92('0x4')](_0x3b92('0x2e'),_0x2e84a7[_0x3b92('0xf')],queues[_0x2e84a7[_0x3b92('0xf')]][_0x3b92('0x27')],queues[_0x2e84a7[_0x3b92('0xf')]][_0x3b92('0x9')]));}}catch(_0x5b1bee){utils[_0x3b92('0x14')](util[_0x3b92('0x4')](_0x3b92('0x2c'),_0x2e84a7['uniqueid']),_0x5b1bee);}};exports[_0x3b92('0x2f')]=function(_0x56adfa){try{if(!_[_0x3b92('0x15')](queues[_0x56adfa[_0x3b92('0xf')]])){utils[_0x3b92('0x16')](util[_0x3b92('0x4')](_0x3b92('0x30'),_0x56adfa['uniqueid']),_0x56adfa);utils['info'](util[_0x3b92('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x56adfa[_0x3b92('0xf')],queues[_0x56adfa['uniqueid']][_0x3b92('0x27')],_0x56adfa['connectedlinenum'],_0x56adfa[_0x3b92('0x31')]));queues[_0x56adfa[_0x3b92('0xf')]]['queuecallerleave']=!![];queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x18')]=utils[_0x3b92('0x13')]();queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x32')]=utils[_0x3b92('0x33')](queues[_0x56adfa['uniqueid']]['queuecallerleaveAt'],queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x34')]);queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x12')]=_0x56adfa[_0x3b92('0x12')];queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x35')]=_0x56adfa['count'];queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x36')]=_0x56adfa[_0x3b92('0x36')];queues[_0x56adfa[_0x3b92('0xf')]][_0x3b92('0x31')]=_0x56adfa[_0x3b92('0x31')];}}catch(_0xdf0884){utils[_0x3b92('0x14')](util[_0x3b92('0x4')](_0x3b92('0x30'),_0x56adfa[_0x3b92('0xf')]),_0xdf0884);}};exports['agentconnect']=function(_0x1dbb09){try{if(!_['isNil'](queues[_0x1dbb09[_0x3b92('0xf')]])){utils[_0x3b92('0x16')](util[_0x3b92('0x4')](_0x3b92('0x37'),_0x1dbb09[_0x3b92('0xf')]),_0x1dbb09);utils[_0x3b92('0x3')](util[_0x3b92('0x4')](_0x3b92('0x38'),_0x1dbb09[_0x3b92('0xf')],queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x27')],_0x1dbb09['membername'],_0x1dbb09[_0x3b92('0x39')]));queues[_0x1dbb09[_0x3b92('0xf')]]['queuecallerabandon']=![];queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x19')]=![];queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x24')]=null;queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x1a')]=![];queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x9')]=null;queues[_0x1dbb09['uniqueid']][_0x3b92('0x25')]=null;queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x3a')]=!![];queues[_0x1dbb09['uniqueid']][_0x3b92('0x8')]=_0x1dbb09['destaccountcode'];queues[_0x1dbb09[_0x3b92('0xf')]][_0x3b92('0x6')]=_0x1dbb09[_0x3b92('0x3b')];}}catch(_0x451494){utils[_0x3b92('0x14')](util[_0x3b92('0x4')](_0x3b92('0x37'),_0x1dbb09[_0x3b92('0xf')]),_0x451494);}};exports[_0x3b92('0x3c')]=function(_0x29206f){try{if(!_[_0x3b92('0x15')](queues[_0x29206f[_0x3b92('0xf')]])){if(queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x18')]){utils[_0x3b92('0x16')](util['format'](_0x3b92('0x3d'),_0x29206f[_0x3b92('0xf')]),_0x29206f);queues[_0x29206f['uniqueid']][_0x3b92('0x19')]=![];queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x19')]=![];queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x24')]=null;queues[_0x29206f[_0x3b92('0xf')]]['queuecallerexit']=![];queues[_0x29206f['uniqueid']][_0x3b92('0x25')]=null;queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x3a')]=!![];queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x6')]=_0x29206f['membername'];queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x3e')]=!![];queues[_0x29206f[_0x3b92('0xf')]]['queuecallercompleteAt']=utils[_0x3b92('0x13')]();if(_0x29206f['reason']==_0x3b92('0x3f')){if(!queues[_0x29206f['uniqueid']][_0x3b92('0x3f')]){queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x9')]=_0x3b92('0x40');}}else{queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x9')]=_0x3b92('0x41')+_0x29206f[_0x3b92('0x42')][_0x3b92('0x22')]();}utils[_0x3b92('0x3')](util[_0x3b92('0x4')](_0x3b92('0x43'),_0x29206f['uniqueid'],queues[_0x29206f['uniqueid']]['name'],_0x29206f[_0x3b92('0x3b')],queues[_0x29206f[_0x3b92('0xf')]][_0x3b92('0x9')]));writeDB(queues[_0x29206f[_0x3b92('0xf')]]);}}}catch(_0x418912){utils['error'](util['format'](_0x3b92('0x3d'),_0x29206f['uniqueid']),_0x418912);}};exports[_0x3b92('0x44')]=function(_0x59ed06){try{if(!_[_0x3b92('0x15')](queues[_0x59ed06[_0x3b92('0x45')]])){utils['debug'](util[_0x3b92('0x4')](_0x3b92('0x46'),_0x59ed06[_0x3b92('0xf')]),_0x59ed06);queues[_0x59ed06[_0x3b92('0x45')]][_0x3b92('0x3f')]=!![];queues[_0x59ed06['transfereeuniqueid']][_0x3b92('0x47')]=_0x3b92('0x48');queues[_0x59ed06['transfereeuniqueid']][_0x3b92('0x49')]=_0x59ed06[_0x3b92('0x4a')];queues[_0x59ed06[_0x3b92('0x45')]]['transferuniqueid']=_0x59ed06[_0x3b92('0x45')];queues[_0x59ed06[_0x3b92('0x45')]][_0x3b92('0x9')]='BLINDTRANSFER';utils['info'](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x59ed06['uniqueid'],queues[_0x59ed06['transfereeuniqueid']][_0x3b92('0x27')],_0x59ed06[_0x3b92('0x45')],_0x59ed06[_0x3b92('0x4a')]));}}catch(_0x30d132){utils['error'](util[_0x3b92('0x4')](_0x3b92('0x46'),_0x59ed06['uniqueid']),_0x30d132);}};exports[_0x3b92('0x4b')]=function(_0x5a4bbb){try{utils[_0x3b92('0x16')](util['format'](_0x3b92('0x4c'),_0x5a4bbb[_0x3b92('0x4d')]),_0x5a4bbb);if(_0x5a4bbb[_0x3b92('0x4d')]==_0x5a4bbb['origtransfererlinkedid']){if(!_[_0x3b92('0x15')](queues[_0x5a4bbb[_0x3b92('0x4e')]])){utils['info'](util[_0x3b92('0x4')](_0x3b92('0x4f'),_0x5a4bbb[_0x3b92('0x4d')],queues[_0x5a4bbb['secondtransfererlinkedid']][_0x3b92('0x27')],_0x5a4bbb[_0x3b92('0x50')]));queues[_0x5a4bbb[_0x3b92('0x4e')]][_0x3b92('0x3f')]=!![];queues[_0x5a4bbb[_0x3b92('0x4e')]]['transfertype']=_0x3b92('0x51');queues[_0x5a4bbb[_0x3b92('0x4e')]][_0x3b92('0x49')]=_0x5a4bbb['origtransfererexten'];queues[_0x5a4bbb[_0x3b92('0x4e')]][_0x3b92('0x52')]=_0x5a4bbb['origtransfereruniqueid'];queues[_0x5a4bbb[_0x3b92('0x4e')]][_0x3b92('0x9')]=_0x3b92('0x53');}if(!_[_0x3b92('0x15')](queues[_0x5a4bbb[_0x3b92('0x54')]])){if(_0x5a4bbb[_0x3b92('0x55')]&&queues[_0x5a4bbb[_0x3b92('0x55')]]){queues[_0x5a4bbb['transfereelinkedid']][_0x3b92('0x1f')]=0x1;queues[_0x5a4bbb[_0x3b92('0x45')]]=_[_0x3b92('0x56')](queues[_0x5a4bbb[_0x3b92('0x55')]]);queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0xe')]=_0x5a4bbb[_0x3b92('0x57')];queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x1f')]=0x2;queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x7')]=queues[_0x5a4bbb['secondtransfererlinkedid']][_0x3b92('0x7')];queues[_0x5a4bbb['transfereeuniqueid']][_0x3b92('0x58')]=queues[_0x5a4bbb[_0x3b92('0x4e')]][_0x3b92('0x58')];queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x34')]=utils[_0x3b92('0x13')]();queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x18')]=utils['now']();queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x32')]=0x0;queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x59')]=0x0;utils[_0x3b92('0x3')](util['format'](_0x3b92('0x5a'),_0x5a4bbb['origtransfereruniqueid'],queues[_0x5a4bbb['transfereeuniqueid']]['name'],queues[_0x5a4bbb[_0x3b92('0x45')]][_0x3b92('0x7')],queues[_0x5a4bbb['transfereeuniqueid']]['calleridname']));}else{utils[_0x3b92('0x3')](util[_0x3b92('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5a4bbb[_0x3b92('0x4d')],queues[_0x5a4bbb[_0x3b92('0x54')]]['name'],_0x5a4bbb[_0x3b92('0x4e')]));queues[_0x5a4bbb[_0x3b92('0x54')]][_0x3b92('0xe')]=_0x5a4bbb[_0x3b92('0x4e')];}}}else if(_0x5a4bbb[_0x3b92('0x5b')]==_0x5a4bbb['secondtransfererlinkedid']){if(!_[_0x3b92('0x15')](queues[_0x5a4bbb[_0x3b92('0x54')]])){utils[_0x3b92('0x3')](util[_0x3b92('0x4')](_0x3b92('0x5c'),_0x5a4bbb[_0x3b92('0x4d')],queues[_0x5a4bbb[_0x3b92('0x54')]]['name'],_0x5a4bbb[_0x3b92('0x5b')],_0x5a4bbb[_0x3b92('0x5d')]));queues[_0x5a4bbb[_0x3b92('0x54')]]['transfer']=!![];queues[_0x5a4bbb[_0x3b92('0x54')]][_0x3b92('0x47')]=_0x3b92('0x51');queues[_0x5a4bbb[_0x3b92('0x54')]][_0x3b92('0x49')]=_0x5a4bbb[_0x3b92('0x5d')];queues[_0x5a4bbb[_0x3b92('0x54')]][_0x3b92('0x52')]=_0x5a4bbb['secondtransfereruniqueid'];queues[_0x5a4bbb['origtransfererlinkedid']][_0x3b92('0x9')]=_0x3b92('0x53');}if(!_[_0x3b92('0x15')](queues[_0x5a4bbb[_0x3b92('0x4e')]])){if(_0x5a4bbb['transfertargetlinkedid']&&queues[_0x5a4bbb['transfertargetlinkedid']]){queues[_0x5a4bbb['transfertargetlinkedid']][_0x3b92('0x1f')]=0x1;queues[_0x5a4bbb['transfertargetuniqueid']]=_[_0x3b92('0x56')](queues[_0x5a4bbb['transfertargetlinkedid']]);queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0xe')]=_0x5a4bbb[_0x3b92('0x57')];queues[_0x5a4bbb[_0x3b92('0x57')]]['queuecallerenterreason']=0x2;queues[_0x5a4bbb['transfertargetuniqueid']][_0x3b92('0x7')]=queues[_0x5a4bbb[_0x3b92('0x54')]][_0x3b92('0x7')];queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0x58')]=queues[_0x5a4bbb['origtransfererlinkedid']][_0x3b92('0x58')];queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0x34')]=utils['now']();queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0x18')]=utils[_0x3b92('0x13')]();queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0x32')]=0x0;queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0x59')]=0x0;utils[_0x3b92('0x3')](util[_0x3b92('0x4')](_0x3b92('0x5e'),_0x5a4bbb[_0x3b92('0x4d')],queues[_0x5a4bbb[_0x3b92('0x57')]]['name'],queues[_0x5a4bbb[_0x3b92('0x57')]][_0x3b92('0xe')],queues[_0x5a4bbb[_0x3b92('0x57')]]['calleridnum'],queues[_0x5a4bbb[_0x3b92('0x57')]]['calleridname']));}else{utils['info'](util[_0x3b92('0x4')](_0x3b92('0x5f'),_0x5a4bbb[_0x3b92('0x4d')],queues[_0x5a4bbb[_0x3b92('0x4e')]]['name'],_0x5a4bbb[_0x3b92('0x54')]));queues[_0x5a4bbb[_0x3b92('0x4e')]]['transfereduniqueid']=_0x5a4bbb[_0x3b92('0x54')];}}}}catch(_0xa19f4f){utils[_0x3b92('0x14')](util[_0x3b92('0x4')](_0x3b92('0x4c'),_0x5a4bbb[_0x3b92('0x4d')]),_0xa19f4f);}};exports[_0x3b92('0x60')]=function(_0x28399d){try{if(!_[_0x3b92('0x15')](queues[_0x28399d[_0x3b92('0xf')]])){utils[_0x3b92('0x16')](util['format'](_0x3b92('0x61'),_0x28399d[_0x3b92('0xf')]),_0x28399d);queues[_0x28399d[_0x3b92('0xf')]]['musiconholdstartAt']=utils[_0x3b92('0x13')]();utils[_0x3b92('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x28399d[_0x3b92('0xf')],queues[_0x28399d[_0x3b92('0xf')]][_0x3b92('0x27')],queues[_0x28399d['uniqueid']][_0x3b92('0x62')]));}}catch(_0x3cb07c){utils[_0x3b92('0x14')](util['format'](_0x3b92('0x61'),_0x28399d[_0x3b92('0xf')]),_0x3cb07c);}};exports['musiconholdstop']=function(_0xd10181){try{if(!_[_0x3b92('0x15')](queues[_0xd10181[_0x3b92('0xf')]])){if(!_[_0x3b92('0x15')](queues[_0xd10181['uniqueid']][_0x3b92('0x62')])){utils['debug'](util[_0x3b92('0x4')](_0x3b92('0x63'),_0xd10181['uniqueid']),_0xd10181);queues[_0xd10181[_0x3b92('0xf')]]['mohtime']+=utils[_0x3b92('0x33')](utils['now'](),queues[_0xd10181['uniqueid']][_0x3b92('0x62')]);utils['info'](util[_0x3b92('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xd10181[_0x3b92('0xf')],queues[_0xd10181[_0x3b92('0xf')]][_0x3b92('0x27')],queues[_0xd10181[_0x3b92('0xf')]][_0x3b92('0x59')]));delete queues[_0xd10181[_0x3b92('0xf')]][_0x3b92('0x62')];}}}catch(_0x3fbdc1){utils[_0x3b92('0x14')](util[_0x3b92('0x4')](_0x3b92('0x63'),_0xd10181['uniqueid']),_0x3fbdc1);}}; \ No newline at end of file +var _0x9f37=['util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','format','position','assign','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f37,0xd1));var _0x79f3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9f37[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x226d40){utils['info'](util['format'](_0x79f3('0x2'),_0x226d40[_0x79f3('0x3')],_0x226d40[_0x79f3('0x4')],_0x226d40['queue'],_0x226d40[_0x79f3('0x5')],_0x226d40[_0x79f3('0x6')],_0x226d40['accountcode'],_0x226d40['queuecallerexitreason']));if(_0x226d40[_0x79f3('0x7')]){utils[_0x79f3('0x8')](_0x226d40[_0x79f3('0x7')])[_0x79f3('0x9')](function(_0x59efc6){if(_0x59efc6){_0x226d40[_0x79f3('0xa')]=_0x59efc6[_0x79f3('0xa')];}utils['request'](_0x79f3('0xb'),_0x226d40);});}else{utils[_0x79f3('0xc')](_0x79f3('0xb'),_0x226d40);}if(_0x226d40[_0x79f3('0xd')]){delete queues[_0x226d40[_0x79f3('0xd')]];}else{delete queues[_0x226d40['uniqueid']];}}exports[_0x79f3('0xe')]=function(_0x33e502){try{utils['debug'](util['format'](_0x79f3('0xf'),_0x33e502[_0x79f3('0x3')]),_0x33e502);utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x33e502[_0x79f3('0x3')],_0x33e502[_0x79f3('0x7')],_0x33e502[_0x79f3('0x12')]));queues[_0x33e502[_0x79f3('0x3')]]=_[_0x79f3('0x13')](_0x33e502,{'originalposition':_0x33e502[_0x79f3('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5764d4){utils[_0x79f3('0x14')](util[_0x79f3('0x11')]('[%s][queues][queuecallerjoin]',_0x33e502[_0x79f3('0x3')]),_0x5764d4);}};exports[_0x79f3('0x15')]=function(_0x23874b){try{if(!_[_0x79f3('0x16')](queues[_0x23874b['uniqueid']])){utils[_0x79f3('0x17')](util[_0x79f3('0x11')](_0x79f3('0x18'),_0x23874b[_0x79f3('0x3')]),_0x23874b);if(queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x19')]){if(!queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x1a')]&&!queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x1b')]){queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x1c')]=!![];queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x1d')]=utils[_0x79f3('0x1e')]();queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x1f')]=_0x79f3('0x20');}utils[_0x79f3('0x10')](util[_0x79f3('0x11')](_0x79f3('0x21'),_0x23874b[_0x79f3('0x3')],queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x22')],queues[_0x23874b[_0x79f3('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x23874b[_0x79f3('0x3')]]);}else if(queues[_0x23874b['uniqueid']][_0x79f3('0xd')]){utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x23874b['uniqueid'],queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0x22')],queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0xd')]));queues[queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0xd')]]=queues[_0x23874b['uniqueid']];queues[queues[_0x23874b[_0x79f3('0x3')]][_0x79f3('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x23874b[_0x79f3('0x3')]];}}}catch(_0x201235){utils[_0x79f3('0x14')](util['format']('[%s][queues][hangup]',_0x23874b[_0x79f3('0x3')]),_0x201235);}};exports[_0x79f3('0x23')]=function(_0x1cb0c5){try{utils[_0x79f3('0x17')](util[_0x79f3('0x11')](_0x79f3('0x24'),_0x1cb0c5[_0x79f3('0x3')]),_0x1cb0c5);if(!_[_0x79f3('0x16')](_0x1cb0c5[_0x79f3('0x25')][_0x79f3('0x26')])&&_0x1cb0c5[_0x79f3('0x27')][_0x79f3('0x28')]()!==_0x79f3('0x29')){if(!_[_0x79f3('0x16')](queues[_0x1cb0c5[_0x79f3('0x3')]])){queues[_0x1cb0c5[_0x79f3('0x3')]][_0x79f3('0x1a')]=![];queues[_0x1cb0c5[_0x79f3('0x3')]][_0x79f3('0x2a')]=null;queues[_0x1cb0c5[_0x79f3('0x3')]][_0x79f3('0x1b')]=!![];queues[_0x1cb0c5['uniqueid']]['queuecallerexitAt']=utils[_0x79f3('0x1e')]();queues[_0x1cb0c5['uniqueid']][_0x79f3('0x1f')]=_0x1cb0c5[_0x79f3('0x27')][_0x79f3('0x28')]();utils['info'](util[_0x79f3('0x11')](_0x79f3('0x2b'),_0x1cb0c5[_0x79f3('0x3')],queues[_0x1cb0c5['uniqueid']][_0x79f3('0x22')],_0x1cb0c5['value'],queues[_0x1cb0c5[_0x79f3('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x1cb0c5[_0x79f3('0x3')]]);}}else if(!_[_0x79f3('0x16')](_0x1cb0c5[_0x79f3('0x25')][_0x79f3('0x2c')])){if(!_[_0x79f3('0x16')](queues[_0x1cb0c5['uniqueid']])&&!queues[_0x1cb0c5[_0x79f3('0x3')]][_0x79f3('0x1a')]){queues[_0x1cb0c5[_0x79f3('0x3')]]['queuecallerabandon']=![];queues[_0x1cb0c5['uniqueid']][_0x79f3('0x2a')]=null;queues[_0x1cb0c5[_0x79f3('0x3')]]['queuecallerexit']=!![];queues[_0x1cb0c5[_0x79f3('0x3')]][_0x79f3('0x2d')]=utils['now']();queues[_0x1cb0c5[_0x79f3('0x3')]]['queuecallerexitreason']=_0x79f3('0x2e');utils[_0x79f3('0x10')](util[_0x79f3('0x11')](_0x79f3('0x2f'),_0x1cb0c5['uniqueid'],queues[_0x1cb0c5[_0x79f3('0x3')]]['name'],_0x1cb0c5[_0x79f3('0x27')],queues[_0x1cb0c5[_0x79f3('0x3')]]['queuecallerexitreason']));}}}catch(_0x460535){utils[_0x79f3('0x14')](util['format'](_0x79f3('0x24'),_0x1cb0c5[_0x79f3('0x3')]),_0x460535);}};exports[_0x79f3('0x1a')]=function(_0x316554){try{if(!_[_0x79f3('0x16')](queues[_0x316554[_0x79f3('0x3')]])){utils['debug'](util[_0x79f3('0x11')](_0x79f3('0x30'),_0x316554[_0x79f3('0x3')]),_0x316554);queues[_0x316554[_0x79f3('0x3')]]['queuecallerexit']=![];queues[_0x316554['uniqueid']][_0x79f3('0x2d')]=null;queues[_0x316554['uniqueid']][_0x79f3('0x1a')]=!![];queues[_0x316554[_0x79f3('0x3')]][_0x79f3('0x2a')]=utils[_0x79f3('0x1e')]();queues[_0x316554[_0x79f3('0x3')]][_0x79f3('0x1f')]='ABANDONED';utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x316554[_0x79f3('0x3')],queues[_0x316554['uniqueid']][_0x79f3('0x22')],queues[_0x316554[_0x79f3('0x3')]]['queuecallerexitreason']));}}catch(_0x15eefc){utils[_0x79f3('0x14')](util[_0x79f3('0x11')](_0x79f3('0x30'),_0x316554[_0x79f3('0x3')]),_0x15eefc);}};exports[_0x79f3('0x31')]=function(_0xbb6334){try{if(!_['isNil'](queues[_0xbb6334[_0x79f3('0x3')]])){utils[_0x79f3('0x17')](util['format'](_0x79f3('0x32'),_0xbb6334[_0x79f3('0x3')]),_0xbb6334);utils[_0x79f3('0x10')](util[_0x79f3('0x11')](_0x79f3('0x33'),_0xbb6334[_0x79f3('0x3')],queues[_0xbb6334[_0x79f3('0x3')]]['name'],_0xbb6334[_0x79f3('0x34')],_0xbb6334['connectedlinename']));queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x31')]=!![];queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x19')]=utils[_0x79f3('0x1e')]();queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x35')]=utils[_0x79f3('0x36')](queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x19')],queues[_0xbb6334[_0x79f3('0x3')]]['queuecallerjoinAt']);queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x12')]=_0xbb6334[_0x79f3('0x12')];queues[_0xbb6334['uniqueid']][_0x79f3('0x37')]=_0xbb6334[_0x79f3('0x37')];queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x34')]=_0xbb6334[_0x79f3('0x34')];queues[_0xbb6334[_0x79f3('0x3')]][_0x79f3('0x38')]=_0xbb6334[_0x79f3('0x38')];}}catch(_0x98098c){utils[_0x79f3('0x14')](util['format'](_0x79f3('0x32'),_0xbb6334[_0x79f3('0x3')]),_0x98098c);}};exports[_0x79f3('0x39')]=function(_0x2aed12){try{if(!_[_0x79f3('0x16')](queues[_0x2aed12[_0x79f3('0x3')]])){utils[_0x79f3('0x17')](util[_0x79f3('0x11')](_0x79f3('0x3a'),_0x2aed12[_0x79f3('0x3')]),_0x2aed12);utils[_0x79f3('0x10')](util[_0x79f3('0x11')](_0x79f3('0x3b'),_0x2aed12[_0x79f3('0x3')],queues[_0x2aed12[_0x79f3('0x3')]][_0x79f3('0x22')],_0x2aed12[_0x79f3('0x3c')],_0x2aed12[_0x79f3('0x3d')]));queues[_0x2aed12[_0x79f3('0x3')]][_0x79f3('0x1a')]=![];queues[_0x2aed12[_0x79f3('0x3')]][_0x79f3('0x1a')]=![];queues[_0x2aed12[_0x79f3('0x3')]]['queuecallerabandonAt']=null;queues[_0x2aed12[_0x79f3('0x3')]]['queuecallerexit']=![];queues[_0x2aed12['uniqueid']][_0x79f3('0x1f')]=null;queues[_0x2aed12['uniqueid']][_0x79f3('0x2d')]=null;queues[_0x2aed12[_0x79f3('0x3')]][_0x79f3('0x3e')]=!![];queues[_0x2aed12[_0x79f3('0x3')]][_0x79f3('0x3f')]=_0x2aed12[_0x79f3('0x3d')];queues[_0x2aed12['uniqueid']][_0x79f3('0x5')]=_0x2aed12[_0x79f3('0x3c')];}}catch(_0x46f84e){utils[_0x79f3('0x14')](util['format'](_0x79f3('0x3a'),_0x2aed12[_0x79f3('0x3')]),_0x46f84e);}};exports[_0x79f3('0x40')]=function(_0x25f1ce){try{if(!_[_0x79f3('0x16')](queues[_0x25f1ce[_0x79f3('0x3')]])){if(queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x19')]){utils[_0x79f3('0x17')](util[_0x79f3('0x11')](_0x79f3('0x41'),_0x25f1ce[_0x79f3('0x3')]),_0x25f1ce);queues[_0x25f1ce['uniqueid']]['queuecallerabandon']=![];queues[_0x25f1ce[_0x79f3('0x3')]]['queuecallerabandon']=![];queues[_0x25f1ce['uniqueid']][_0x79f3('0x2a')]=null;queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x1b')]=![];queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x2d')]=null;queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x3e')]=!![];queues[_0x25f1ce[_0x79f3('0x3')]]['lastAssignedTo']=_0x25f1ce[_0x79f3('0x3c')];queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x1c')]=!![];queues[_0x25f1ce['uniqueid']][_0x79f3('0x1d')]=utils[_0x79f3('0x1e')]();if(_0x25f1ce[_0x79f3('0x42')]==_0x79f3('0x43')){if(!queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x43')]){queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x1f')]=_0x79f3('0x44');}}else{queues[_0x25f1ce['uniqueid']]['queuecallerexitreason']=_0x79f3('0x45')+_0x25f1ce[_0x79f3('0x42')][_0x79f3('0x28')]();}utils[_0x79f3('0x10')](util['format'](_0x79f3('0x46'),_0x25f1ce['uniqueid'],queues[_0x25f1ce[_0x79f3('0x3')]]['name'],_0x25f1ce['membername'],queues[_0x25f1ce[_0x79f3('0x3')]][_0x79f3('0x1f')]));writeDB(queues[_0x25f1ce[_0x79f3('0x3')]]);}}}catch(_0x9feee5){utils[_0x79f3('0x14')](util[_0x79f3('0x11')]('[%s][queues][agentcomplete]',_0x25f1ce[_0x79f3('0x3')]),_0x9feee5);}};exports[_0x79f3('0x47')]=function(_0x1d463e){try{if(!_[_0x79f3('0x16')](queues[_0x1d463e[_0x79f3('0x48')]])){utils[_0x79f3('0x17')](util[_0x79f3('0x11')](_0x79f3('0x49'),_0x1d463e['uniqueid']),_0x1d463e);queues[_0x1d463e['transfereeuniqueid']][_0x79f3('0x43')]=!![];queues[_0x1d463e[_0x79f3('0x48')]]['transfertype']='BLIND';queues[_0x1d463e[_0x79f3('0x48')]][_0x79f3('0x4a')]=_0x1d463e['extension'];queues[_0x1d463e[_0x79f3('0x48')]]['transferuniqueid']=_0x1d463e[_0x79f3('0x48')];queues[_0x1d463e[_0x79f3('0x48')]]['queuecallerexitreason']=_0x79f3('0x4b');utils[_0x79f3('0x10')](util[_0x79f3('0x11')](_0x79f3('0x4c'),_0x1d463e[_0x79f3('0x3')],queues[_0x1d463e[_0x79f3('0x48')]][_0x79f3('0x22')],_0x1d463e[_0x79f3('0x48')],_0x1d463e[_0x79f3('0x4d')]));}}catch(_0x2b5b6d){utils[_0x79f3('0x14')](util[_0x79f3('0x11')](_0x79f3('0x49'),_0x1d463e[_0x79f3('0x3')]),_0x2b5b6d);}};exports[_0x79f3('0x4e')]=function(_0x268442){try{utils[_0x79f3('0x17')](util['format']('[%s][queues][attendedtransfer]',_0x268442['origtransfereruniqueid']),_0x268442);if(_0x268442[_0x79f3('0x4f')]==_0x268442['origtransfererlinkedid']){if(!_[_0x79f3('0x16')](queues[_0x268442[_0x79f3('0x50')]])){utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x268442['origtransfereruniqueid'],queues[_0x268442[_0x79f3('0x50')]][_0x79f3('0x22')],_0x268442[_0x79f3('0x51')]));queues[_0x268442[_0x79f3('0x50')]][_0x79f3('0x43')]=!![];queues[_0x268442[_0x79f3('0x50')]][_0x79f3('0x52')]=_0x79f3('0x53');queues[_0x268442[_0x79f3('0x50')]][_0x79f3('0x4a')]=_0x268442[_0x79f3('0x51')];queues[_0x268442[_0x79f3('0x50')]][_0x79f3('0x54')]=_0x268442[_0x79f3('0x4f')];queues[_0x268442[_0x79f3('0x50')]]['queuecallerexitreason']=_0x79f3('0x55');}if(!_[_0x79f3('0x16')](queues[_0x268442[_0x79f3('0x56')]])){if(_0x268442[_0x79f3('0x57')]&&queues[_0x268442[_0x79f3('0x57')]]){queues[_0x268442[_0x79f3('0x57')]][_0x79f3('0x58')]=0x1;queues[_0x268442[_0x79f3('0x48')]]=_[_0x79f3('0x59')](queues[_0x268442[_0x79f3('0x57')]]);queues[_0x268442['transfereeuniqueid']][_0x79f3('0xd')]=_0x268442[_0x79f3('0x5a')];queues[_0x268442[_0x79f3('0x48')]][_0x79f3('0x58')]=0x2;queues[_0x268442['transfereeuniqueid']][_0x79f3('0x6')]=queues[_0x268442[_0x79f3('0x50')]]['calleridnum'];queues[_0x268442[_0x79f3('0x48')]][_0x79f3('0x5b')]=queues[_0x268442['secondtransfererlinkedid']][_0x79f3('0x5b')];queues[_0x268442[_0x79f3('0x48')]]['queuecallerjoinAt']=utils['now']();queues[_0x268442[_0x79f3('0x48')]][_0x79f3('0x19')]=utils[_0x79f3('0x1e')]();queues[_0x268442[_0x79f3('0x48')]][_0x79f3('0x35')]=0x0;queues[_0x268442['transfereeuniqueid']][_0x79f3('0x5c')]=0x0;utils['info'](util[_0x79f3('0x11')](_0x79f3('0x5d'),_0x268442['origtransfereruniqueid'],queues[_0x268442[_0x79f3('0x48')]][_0x79f3('0x22')],queues[_0x268442['transfereeuniqueid']][_0x79f3('0x6')],queues[_0x268442[_0x79f3('0x48')]]['calleridname']));}else{utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x268442[_0x79f3('0x4f')],queues[_0x268442[_0x79f3('0x56')]][_0x79f3('0x22')],_0x268442[_0x79f3('0x50')]));queues[_0x268442[_0x79f3('0x56')]][_0x79f3('0xd')]=_0x268442[_0x79f3('0x50')];}}}else if(_0x268442['secondtransfereruniqueid']==_0x268442[_0x79f3('0x50')]){if(!_['isNil'](queues[_0x268442['origtransfererlinkedid']])){utils[_0x79f3('0x10')](util[_0x79f3('0x11')](_0x79f3('0x5e'),_0x268442[_0x79f3('0x4f')],queues[_0x268442['origtransfererlinkedid']]['name'],_0x268442[_0x79f3('0x5f')],_0x268442[_0x79f3('0x60')]));queues[_0x268442[_0x79f3('0x56')]][_0x79f3('0x43')]=!![];queues[_0x268442['origtransfererlinkedid']][_0x79f3('0x52')]=_0x79f3('0x53');queues[_0x268442[_0x79f3('0x56')]][_0x79f3('0x4a')]=_0x268442[_0x79f3('0x60')];queues[_0x268442[_0x79f3('0x56')]][_0x79f3('0x54')]=_0x268442[_0x79f3('0x5f')];queues[_0x268442[_0x79f3('0x56')]][_0x79f3('0x1f')]=_0x79f3('0x55');}if(!_[_0x79f3('0x16')](queues[_0x268442['secondtransfererlinkedid']])){if(_0x268442[_0x79f3('0x61')]&&queues[_0x268442[_0x79f3('0x61')]]){queues[_0x268442[_0x79f3('0x61')]]['queuecallerenterreason']=0x1;queues[_0x268442[_0x79f3('0x5a')]]=_[_0x79f3('0x59')](queues[_0x268442['transfertargetlinkedid']]);queues[_0x268442['transfertargetuniqueid']]['transfereduniqueid']=_0x268442[_0x79f3('0x5a')];queues[_0x268442[_0x79f3('0x5a')]][_0x79f3('0x58')]=0x2;queues[_0x268442['transfertargetuniqueid']][_0x79f3('0x6')]=queues[_0x268442['origtransfererlinkedid']]['calleridnum'];queues[_0x268442[_0x79f3('0x5a')]][_0x79f3('0x5b')]=queues[_0x268442['origtransfererlinkedid']]['calleridname'];queues[_0x268442[_0x79f3('0x5a')]][_0x79f3('0x62')]=utils[_0x79f3('0x1e')]();queues[_0x268442[_0x79f3('0x5a')]][_0x79f3('0x19')]=utils[_0x79f3('0x1e')]();queues[_0x268442[_0x79f3('0x5a')]][_0x79f3('0x35')]=0x0;queues[_0x268442[_0x79f3('0x5a')]][_0x79f3('0x5c')]=0x0;utils[_0x79f3('0x10')](util['format'](_0x79f3('0x63'),_0x268442[_0x79f3('0x4f')],queues[_0x268442[_0x79f3('0x5a')]]['name'],queues[_0x268442[_0x79f3('0x5a')]]['transfereduniqueid'],queues[_0x268442['transfertargetuniqueid']]['calleridnum'],queues[_0x268442['transfertargetuniqueid']][_0x79f3('0x5b')]));}else{utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x268442[_0x79f3('0x4f')],queues[_0x268442['secondtransfererlinkedid']]['name'],_0x268442[_0x79f3('0x56')]));queues[_0x268442[_0x79f3('0x50')]][_0x79f3('0xd')]=_0x268442[_0x79f3('0x56')];}}}}catch(_0x4a4df1){utils[_0x79f3('0x14')](util[_0x79f3('0x11')](_0x79f3('0x64'),_0x268442[_0x79f3('0x4f')]),_0x4a4df1);}};exports[_0x79f3('0x65')]=function(_0x1140a2){try{if(!_[_0x79f3('0x16')](queues[_0x1140a2[_0x79f3('0x3')]])){utils['debug'](util[_0x79f3('0x11')](_0x79f3('0x66'),_0x1140a2[_0x79f3('0x3')]),_0x1140a2);queues[_0x1140a2[_0x79f3('0x3')]][_0x79f3('0x67')]=utils[_0x79f3('0x1e')]();utils['info'](util[_0x79f3('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1140a2[_0x79f3('0x3')],queues[_0x1140a2[_0x79f3('0x3')]][_0x79f3('0x22')],queues[_0x1140a2[_0x79f3('0x3')]][_0x79f3('0x67')]));}}catch(_0x522bda){utils[_0x79f3('0x14')](util['format'](_0x79f3('0x66'),_0x1140a2[_0x79f3('0x3')]),_0x522bda);}};exports['musiconholdstop']=function(_0x536380){try{if(!_[_0x79f3('0x16')](queues[_0x536380[_0x79f3('0x3')]])){if(!_[_0x79f3('0x16')](queues[_0x536380['uniqueid']]['musiconholdstartAt'])){utils[_0x79f3('0x17')](util['format'](_0x79f3('0x68'),_0x536380['uniqueid']),_0x536380);queues[_0x536380['uniqueid']][_0x79f3('0x5c')]+=utils[_0x79f3('0x36')](utils['now'](),queues[_0x536380['uniqueid']][_0x79f3('0x67')]);utils[_0x79f3('0x10')](util[_0x79f3('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x536380[_0x79f3('0x3')],queues[_0x536380[_0x79f3('0x3')]][_0x79f3('0x22')],queues[_0x536380[_0x79f3('0x3')]][_0x79f3('0x5c')]));delete queues[_0x536380[_0x79f3('0x3')]]['musiconholdstartAt'];}}}catch(_0x3c05ae){utils[_0x79f3('0x14')](util[_0x79f3('0x11')](_0x79f3('0x68'),_0x536380['uniqueid']),_0x3c05ae);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f87d585..f32f72b 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 _0x8ce1=['[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','uniqueid','accountcode','getUserByInternal','then','request','CreateVoiceRecording','newchannel','debug','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','hangup'];(function(_0x217a47,_0xfbd2d3){var _0x22ef5e=function(_0x597b70){while(--_0x597b70){_0x217a47['push'](_0x217a47['shift']());}};_0x22ef5e(++_0xfbd2d3);}(_0x8ce1,0x97));var _0x18ce=function(_0x5926dc,_0x37a56f){_0x5926dc=_0x5926dc-0x0;var _0x190af0=_0x8ce1[_0x5926dc];return _0x190af0;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var utils=require(_0x18ce('0x2'));var recordings={};function writeDB(_0x4198ff){utils['info'](util[_0x18ce('0x3')]('[%s][recordings][writeDB]',_0x4198ff[_0x18ce('0x4')]));if(_0x4198ff[_0x18ce('0x5')]){utils[_0x18ce('0x6')](_0x4198ff['accountcode'])[_0x18ce('0x7')](function(_0x139020){if(_0x139020){_0x4198ff['membername']=_0x139020['name'];_0x4198ff['UserId']=_0x139020['id'];}utils[_0x18ce('0x8')]('CreateVoiceRecording',_0x4198ff);});}else{utils[_0x18ce('0x8')](_0x18ce('0x9'),_0x4198ff);}}exports[_0x18ce('0xa')]=function(_0xa734e8){try{utils[_0x18ce('0xb')](util[_0x18ce('0x3')]('[%s][recordings][newchannel]',_0xa734e8[_0x18ce('0x4')]),_0xa734e8);if(_0xa734e8[_0x18ce('0x4')]==_0xa734e8[_0x18ce('0xc')]){utils[_0x18ce('0xd')](util[_0x18ce('0x3')](_0x18ce('0xe'),_0xa734e8[_0x18ce('0x4')],_0xa734e8[_0x18ce('0xf')],_0xa734e8[_0x18ce('0x10')]));recordings[_0xa734e8[_0x18ce('0x4')]]={'uniqueid':_0xa734e8['uniqueid'],'accountcode':_0xa734e8['accountcode'],'exten':_0xa734e8[_0x18ce('0x10')],'context':_0xa734e8['context'],'channel':_0xa734e8['channel'],'monitors':[]};}}catch(_0x5c2d93){utils['error'](util[_0x18ce('0x3')](_0x18ce('0x11'),_0xa734e8[_0x18ce('0x4')]),_0x5c2d93);}};exports[_0x18ce('0x12')]=function(_0x59734d){try{utils[_0x18ce('0xb')](util[_0x18ce('0x3')](_0x18ce('0x13'),_0x59734d[_0x18ce('0x4')]),_0x59734d);if(!_[_0x18ce('0x14')](recordings[_0x59734d[_0x18ce('0x4')]])&&_0x59734d['channelstate']==0x6){utils[_0x18ce('0xd')](util[_0x18ce('0x3')](_0x18ce('0x15'),_0x59734d[_0x18ce('0x4')],_0x59734d['context'],_0x59734d[_0x18ce('0x16')]));}else if(!_['isNil'](recordings[_0x59734d['linkedid']])&&_0x59734d[_0x18ce('0x17')]==0x6&&_0x59734d[_0x18ce('0xf')]!='transfer'){utils[_0x18ce('0xd')](util['format'](_0x18ce('0x18'),_0x59734d[_0x18ce('0x4')],_0x59734d[_0x18ce('0xc')],_0x59734d['context'],_0x59734d[_0x18ce('0x16')]));recordings[_0x59734d['linkedid']][_0x18ce('0x5')]=_0x59734d[_0x18ce('0x5')];}}catch(_0x142b51){utils[_0x18ce('0x19')](util['format'](_0x18ce('0x13'),_0x59734d['uniqueid']),_0x142b51);}};exports['varset']=function(_0x5b6e47){try{if(!_[_0x18ce('0x14')](_0x5b6e47['variable'])&&!_[_0x18ce('0x14')](_0x5b6e47[_0x18ce('0x1a')][_0x18ce('0x1b')])){utils[_0x18ce('0xb')](util[_0x18ce('0x3')](_0x18ce('0x1c'),_0x5b6e47[_0x18ce('0x4')]),_0x5b6e47);utils[_0x18ce('0xd')](util['format'](_0x18ce('0x1d'),_0x5b6e47[_0x18ce('0x4')],_0x5b6e47[_0x18ce('0x1a')],_0x5b6e47[_0x18ce('0x1e')]));if(_[_0x18ce('0x1f')](_0x5b6e47[_0x18ce('0x1e')],_0x18ce('0x20'))){_0x5b6e47['value']=_0x5b6e47[_0x18ce('0x1e')]['replace'](_0x18ce('0x20'),_0x18ce('0x21'));}if(recordings[_0x5b6e47['linkedid']]){var _0x515c9c=_[_0x18ce('0x22')](recordings[_0x5b6e47[_0x18ce('0xc')]]['monitors'],{'value':_0x5b6e47['value']});if(_['isNil'](_0x515c9c)){recordings[_0x5b6e47['linkedid']][_0x18ce('0x23')][_0x18ce('0x24')]({'value':_0x5b6e47[_0x18ce('0x1e')]});}}}}catch(_0x48f384){utils[_0x18ce('0x19')](util[_0x18ce('0x3')](_0x18ce('0x1c'),_0x5b6e47[_0x18ce('0x4')]),_0x48f384);}};exports[_0x18ce('0x25')]=function(_0x6cfe6a){try{if(!_[_0x18ce('0x14')](recordings[_0x6cfe6a[_0x18ce('0x4')]])){utils[_0x18ce('0xb')](util['format']('[%s][recordings][hangup]',_0x6cfe6a[_0x18ce('0x4')]),_0x6cfe6a);utils[_0x18ce('0xd')](util[_0x18ce('0x3')](_0x18ce('0x26'),_0x6cfe6a['uniqueid'],_0x6cfe6a[_0x18ce('0x27')],_0x6cfe6a[_0x18ce('0x28')],_0x6cfe6a[_0x18ce('0x29')]));recordings[_0x6cfe6a[_0x18ce('0x4')]][_0x18ce('0x27')]=_0x6cfe6a[_0x18ce('0x27')];recordings[_0x6cfe6a['uniqueid']][_0x18ce('0x28')]=_0x6cfe6a[_0x18ce('0x28')];recordings[_0x6cfe6a[_0x18ce('0x4')]][_0x18ce('0x2a')]=_0x6cfe6a[_0x18ce('0x2a')];recordings[_0x6cfe6a[_0x18ce('0x4')]]['connectedlinename']=_0x6cfe6a[_0x18ce('0x2b')];if(recordings[_0x6cfe6a[_0x18ce('0x4')]][_0x18ce('0x2c')]==_0x18ce('0x2d')&&recordings[_0x6cfe6a[_0x18ce('0x4')]][_0x18ce('0x5')]){recordings[_0x6cfe6a[_0x18ce('0x4')]]['connectedlinenum']=recordings[_0x6cfe6a[_0x18ce('0x4')]]['accountcode'];recordings[_0x6cfe6a[_0x18ce('0x4')]]['connectedlinename']='';}recordings[_0x6cfe6a[_0x18ce('0x4')]]['monitors'][_0x18ce('0x2e')](function(_0x5d3452){var _0x48763d=_['clone'](recordings[_0x6cfe6a[_0x18ce('0x4')]]);_0x48763d[_0x18ce('0x1e')]=_0x5d3452[_0x18ce('0x1e')];writeDB(_0x48763d);});delete recordings[_0x6cfe6a[_0x18ce('0x4')]];}}catch(_0x3dd0ca){utils['error'](util[_0x18ce('0x3')](_0x18ce('0x2f'),_0x6cfe6a['uniqueid']),_0x3dd0ca);}};exports[_0x18ce('0x30')]=function(_0x33df8e){try{if(!_[_0x18ce('0x14')](recordings[_0x33df8e[_0x18ce('0x4')]])){utils[_0x18ce('0xb')](util['format'](_0x18ce('0x31'),_0x33df8e[_0x18ce('0x4')]),_0x33df8e);utils[_0x18ce('0xd')](util[_0x18ce('0x3')](_0x18ce('0x32'),_0x33df8e[_0x18ce('0x4')],_0x33df8e[_0x18ce('0x33')],_0x33df8e['appdata']));if(_0x33df8e[_0x18ce('0x33')][_0x18ce('0x34')]()==_0x18ce('0x35')&&_[_0x18ce('0x36')](_0x33df8e[_0x18ce('0x37')]['toLowerCase'](),_0x18ce('0x38'))){var _0x1ffaf4=_0x33df8e['appdata'][_0x18ce('0x39')]('=');var _0x626e0e=_0x1ffaf4[0x0][_0x18ce('0x3a')](_0x1ffaf4[0x0][_0x18ce('0x3b')]('(')+0x1,_0x1ffaf4[0x0][_0x18ce('0x3b')](')'));var _0x22f07a=_0x1ffaf4[0x1];recordings[_0x33df8e[_0x18ce('0x4')]][_0x626e0e]=_0x22f07a;}}}catch(_0x2c8897){utils[_0x18ce('0x19')](util[_0x18ce('0x3')](_0x18ce('0x31'),_0x33df8e[_0x18ce('0x4')]),_0x2c8897);}};exports['queuecallerjoin']=function(_0x277074){try{if(!_['isNil'](recordings[_0x277074[_0x18ce('0x4')]])){utils[_0x18ce('0xb')](util[_0x18ce('0x3')](_0x18ce('0x3c'),_0x277074[_0x18ce('0x4')]),_0x277074);utils[_0x18ce('0xd')](util[_0x18ce('0x3')](_0x18ce('0x3d'),_0x277074[_0x18ce('0x4')],_0x277074['queue']));recordings[_0x277074[_0x18ce('0x4')]][_0x18ce('0x3e')]=_0x277074[_0x18ce('0x3e')];}}catch(_0x191123){utils[_0x18ce('0x19')](util[_0x18ce('0x3')](_0x18ce('0x3c'),_0x277074['uniqueid']),_0x191123);}}; \ No newline at end of file +var _0xe955=['[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','format','uniqueid','accountcode','then','membername','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','find','monitors','push','hangup'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe955,0x115));var _0x5e95=function(_0x101bf5,_0x2602f6){_0x101bf5=_0x101bf5-0x0;var _0x513275=_0xe955[_0x101bf5];return _0x513275;};'use strict';var _=require(_0x5e95('0x0'));var util=require(_0x5e95('0x1'));var utils=require(_0x5e95('0x2'));var recordings={};function writeDB(_0x3f092f){utils['info'](util[_0x5e95('0x3')]('[%s][recordings][writeDB]',_0x3f092f[_0x5e95('0x4')]));if(_0x3f092f[_0x5e95('0x5')]){utils['getUserByInternal'](_0x3f092f[_0x5e95('0x5')])[_0x5e95('0x6')](function(_0x43bd33){if(_0x43bd33){_0x3f092f[_0x5e95('0x7')]=_0x43bd33[_0x5e95('0x8')];_0x3f092f['UserId']=_0x43bd33['id'];}utils['request'](_0x5e95('0x9'),_0x3f092f);});}else{utils[_0x5e95('0xa')](_0x5e95('0x9'),_0x3f092f);}}exports[_0x5e95('0xb')]=function(_0x2a5172){try{utils[_0x5e95('0xc')](util[_0x5e95('0x3')](_0x5e95('0xd'),_0x2a5172[_0x5e95('0x4')]),_0x2a5172);if(_0x2a5172[_0x5e95('0x4')]==_0x2a5172[_0x5e95('0xe')]){utils[_0x5e95('0xf')](util[_0x5e95('0x3')](_0x5e95('0x10'),_0x2a5172[_0x5e95('0x4')],_0x2a5172['context'],_0x2a5172[_0x5e95('0x11')]));recordings[_0x2a5172[_0x5e95('0x4')]]={'uniqueid':_0x2a5172[_0x5e95('0x4')],'accountcode':_0x2a5172[_0x5e95('0x5')],'exten':_0x2a5172['exten'],'context':_0x2a5172[_0x5e95('0x12')],'channel':_0x2a5172[_0x5e95('0x13')],'monitors':[]};}}catch(_0x4c2c94){utils[_0x5e95('0x14')](util[_0x5e95('0x3')](_0x5e95('0xd'),_0x2a5172[_0x5e95('0x4')]),_0x4c2c94);}};exports['newstate']=function(_0x36dd2c){try{utils['debug'](util[_0x5e95('0x3')](_0x5e95('0x15'),_0x36dd2c['uniqueid']),_0x36dd2c);if(!_[_0x5e95('0x16')](recordings[_0x36dd2c['uniqueid']])&&_0x36dd2c[_0x5e95('0x17')]==0x6){utils[_0x5e95('0xf')](util[_0x5e95('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x36dd2c[_0x5e95('0x4')],_0x36dd2c[_0x5e95('0x12')],_0x36dd2c[_0x5e95('0x13')]));}else if(!_[_0x5e95('0x16')](recordings[_0x36dd2c[_0x5e95('0xe')]])&&_0x36dd2c[_0x5e95('0x17')]==0x6&&_0x36dd2c['context']!=_0x5e95('0x18')){utils[_0x5e95('0xf')](util[_0x5e95('0x3')](_0x5e95('0x19'),_0x36dd2c['uniqueid'],_0x36dd2c[_0x5e95('0xe')],_0x36dd2c['context'],_0x36dd2c['channel']));recordings[_0x36dd2c['linkedid']][_0x5e95('0x5')]=_0x36dd2c['accountcode'];}}catch(_0x2ade90){utils[_0x5e95('0x14')](util['format'](_0x5e95('0x15'),_0x36dd2c[_0x5e95('0x4')]),_0x2ade90);}};exports[_0x5e95('0x1a')]=function(_0x31bf10){try{if(!_['isNil'](_0x31bf10['variable'])&&!_[_0x5e95('0x16')](_0x31bf10['variable'][_0x5e95('0x1b')])){utils[_0x5e95('0xc')](util[_0x5e95('0x3')](_0x5e95('0x1c'),_0x31bf10['uniqueid']),_0x31bf10);utils[_0x5e95('0xf')](util[_0x5e95('0x3')](_0x5e95('0x1d'),_0x31bf10['uniqueid'],_0x31bf10['variable'],_0x31bf10['value']));if(_[_0x5e95('0x1e')](_0x31bf10['value'],_0x5e95('0x1f'))){_0x31bf10['value']=_0x31bf10[_0x5e95('0x20')][_0x5e95('0x21')]('.wav49','.WAV');}if(recordings[_0x31bf10[_0x5e95('0xe')]]){var _0x5a4a9d=_[_0x5e95('0x22')](recordings[_0x31bf10[_0x5e95('0xe')]]['monitors'],{'value':_0x31bf10[_0x5e95('0x20')]});if(_[_0x5e95('0x16')](_0x5a4a9d)){recordings[_0x31bf10[_0x5e95('0xe')]][_0x5e95('0x23')][_0x5e95('0x24')]({'value':_0x31bf10[_0x5e95('0x20')]});}}}}catch(_0x5130fa){utils[_0x5e95('0x14')](util[_0x5e95('0x3')](_0x5e95('0x1c'),_0x31bf10[_0x5e95('0x4')]),_0x5130fa);}};exports[_0x5e95('0x25')]=function(_0x269420){try{if(!_[_0x5e95('0x16')](recordings[_0x269420['uniqueid']])){utils[_0x5e95('0xc')](util[_0x5e95('0x3')](_0x5e95('0x26'),_0x269420[_0x5e95('0x4')]),_0x269420);utils[_0x5e95('0xf')](util['format'](_0x5e95('0x27'),_0x269420['uniqueid'],_0x269420[_0x5e95('0x28')],_0x269420[_0x5e95('0x29')],_0x269420[_0x5e95('0x2a')]));recordings[_0x269420['uniqueid']][_0x5e95('0x28')]=_0x269420[_0x5e95('0x28')];recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x29')]=_0x269420[_0x5e95('0x29')];recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x2b')]=_0x269420[_0x5e95('0x2b')];recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x2c')]=_0x269420[_0x5e95('0x2c')];if(recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x2d')]==_0x5e95('0x2e')&&recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x5')]){recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x2b')]=recordings[_0x269420[_0x5e95('0x4')]][_0x5e95('0x5')];recordings[_0x269420['uniqueid']][_0x5e95('0x2c')]='';}recordings[_0x269420['uniqueid']][_0x5e95('0x23')][_0x5e95('0x2f')](function(_0x5a8313){var _0x168b21=_[_0x5e95('0x30')](recordings[_0x269420[_0x5e95('0x4')]]);_0x168b21['value']=_0x5a8313[_0x5e95('0x20')];writeDB(_0x168b21);});delete recordings[_0x269420['uniqueid']];}}catch(_0x4a4d22){utils[_0x5e95('0x14')](util['format']('[%s][recordings][hangup]',_0x269420[_0x5e95('0x4')]),_0x4a4d22);}};exports['newexten']=function(_0x3264de){try{if(!_[_0x5e95('0x16')](recordings[_0x3264de['uniqueid']])){utils[_0x5e95('0xc')](util['format'](_0x5e95('0x31'),_0x3264de['uniqueid']),_0x3264de);utils[_0x5e95('0xf')](util['format'](_0x5e95('0x32'),_0x3264de['uniqueid'],_0x3264de[_0x5e95('0x33')],_0x3264de[_0x5e95('0x34')]));if(_0x3264de[_0x5e95('0x33')][_0x5e95('0x35')]()==_0x5e95('0x36')&&_[_0x5e95('0x37')](_0x3264de[_0x5e95('0x34')]['toLowerCase'](),_0x5e95('0x38'))){var _0x51179d=_0x3264de[_0x5e95('0x34')]['split']('=');var _0x3b1aae=_0x51179d[0x0][_0x5e95('0x39')](_0x51179d[0x0][_0x5e95('0x3a')]('(')+0x1,_0x51179d[0x0]['lastIndexOf'](')'));var _0x451f42=_0x51179d[0x1];recordings[_0x3264de[_0x5e95('0x4')]][_0x3b1aae]=_0x451f42;}}}catch(_0x2f43e7){utils[_0x5e95('0x14')](util[_0x5e95('0x3')](_0x5e95('0x31'),_0x3264de[_0x5e95('0x4')]),_0x2f43e7);}};exports[_0x5e95('0x3b')]=function(_0x4598fe){try{if(!_[_0x5e95('0x16')](recordings[_0x4598fe[_0x5e95('0x4')]])){utils[_0x5e95('0xc')](util[_0x5e95('0x3')]('[%s][recordings][queuecallerjoin]',_0x4598fe[_0x5e95('0x4')]),_0x4598fe);utils[_0x5e95('0xf')](util[_0x5e95('0x3')](_0x5e95('0x3c'),_0x4598fe[_0x5e95('0x4')],_0x4598fe['queue']));recordings[_0x4598fe[_0x5e95('0x4')]][_0x5e95('0x3d')]=_0x4598fe[_0x5e95('0x3d')];}}catch(_0x5b78ae){utils[_0x5e95('0x14')](util[_0x5e95('0x3')](_0x5e95('0x3e'),_0x4598fe[_0x5e95('0x4')]),_0x5b78ae);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 272c6e3..cbc4b7d 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 _0x3e76=['attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','isNil','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x4e3dc7,_0x35c77e){var _0x2ded18=function(_0x8854a8){while(--_0x8854a8){_0x4e3dc7['push'](_0x4e3dc7['shift']());}};_0x2ded18(++_0x35c77e);}(_0x3e76,0x151));var _0x63e7=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3e76[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0x63e7('0x0'));var utils=require(_0x63e7('0x1'));function writeDB(_0x5ba07c){utils['info'](util[_0x63e7('0x2')](_0x63e7('0x3'),_0x5ba07c[_0x63e7('0x4')]===_0x63e7('0x5')?_0x5ba07c['origtransfereruniqueid']:_0x5ba07c[_0x63e7('0x6')],_0x5ba07c[_0x63e7('0x4')]));utils[_0x63e7('0x7')](_0x63e7('0x8'),_0x5ba07c);}exports[_0x63e7('0x9')]=function(_0x6830e2){try{utils[_0x63e7('0xa')](util[_0x63e7('0x2')](_0x63e7('0xb'),_0x6830e2[_0x63e7('0x6')]),_0x6830e2);utils[_0x63e7('0xc')](util[_0x63e7('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x6830e2[_0x63e7('0x6')],_0x6830e2[_0x63e7('0xd')],_0x6830e2[_0x63e7('0xe')],_0x6830e2[_0x63e7('0xf')],_0x6830e2[_0x63e7('0x10')]));_0x6830e2[_0x63e7('0x4')]=_0x63e7('0x11');writeDB(_0x6830e2);}catch(_0x4d0e1b){utils['error'](util['format'](_0x63e7('0xb'),_0x6830e2[_0x63e7('0x6')]),_0x4d0e1b);}};exports['attendedtransfer']=function(_0x2dd171){try{utils[_0x63e7('0xa')](util[_0x63e7('0x2')](_0x63e7('0x12'),_0x2dd171[_0x63e7('0x13')]),_0x2dd171);utils[_0x63e7('0xc')](util['format'](_0x63e7('0x14'),_0x2dd171['origtransfereruniqueid'],_0x2dd171[_0x63e7('0x15')],_0x2dd171[_0x63e7('0x16')],_0x2dd171[_0x63e7('0x17')],_0x2dd171[_0x63e7('0x18')]));_0x2dd171=_['assign'](_0x2dd171,{'transfererchannel':_0x2dd171[_0x63e7('0x19')],'transferercalleridnum':_0x2dd171[_0x63e7('0x15')],'transferercalleridname':_0x2dd171[_0x63e7('0x16')],'transfererconnectedlinenum':_0x2dd171[_0x63e7('0x1a')],'transfererconnectedlinename':_0x2dd171[_0x63e7('0x1b')],'transfereraccountcode':_0x2dd171[_0x63e7('0x1c')],'transferercontext':_0x2dd171['secondtransferercontext'],'transfererexten':_0x2dd171[_0x63e7('0x1d')],'transfererlinkedid':_0x2dd171['origtransfererlinkedid'],'context':_0x2dd171[_0x63e7('0x1e')],'extension':_0x2dd171['origtransfererexten'],'type':_0x63e7('0x5')});if(_[_0x63e7('0x1f')](_0x2dd171['transfereechannel'])){_0x2dd171=_['assign'](_0x2dd171,{'transfereechannel':_0x2dd171['transfertargetchannel'],'transfereecalleridnum':_0x2dd171[_0x63e7('0x17')],'transfereecalleridname':_0x2dd171['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2dd171[_0x63e7('0x20')],'transfereeconnectedlinename':_0x2dd171[_0x63e7('0x21')],'transfereeaccountcode':_0x2dd171[_0x63e7('0x22')],'transfereecontext':_0x2dd171['transfertargetcontext'],'transfereeexten':_0x2dd171[_0x63e7('0x23')],'transfereelinkedid':_0x2dd171[_0x63e7('0x24')]});}writeDB(_0x2dd171);}catch(_0x3b6afc){utils[_0x63e7('0x25')](util['format'](_0x63e7('0x12'),_0x2dd171['origtransfereruniqueid']),_0x3b6afc);}}; \ No newline at end of file +var _0x436f=['type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','error','format','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x436f,0xb6));var _0xf436=function(_0x5a089c,_0x1d46c2){_0x5a089c=_0x5a089c-0x0;var _0x5b3dbe=_0x436f[_0x5a089c];return _0x5b3dbe;};'use strict';var _=require(_0xf436('0x0'));var util=require(_0xf436('0x1'));var utils=require('./utils');function writeDB(_0x35dc65){utils[_0xf436('0x2')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x35dc65[_0xf436('0x3')]==='attended'?_0x35dc65[_0xf436('0x4')]:_0x35dc65[_0xf436('0x5')],_0x35dc65['type']));utils[_0xf436('0x6')](_0xf436('0x7'),_0x35dc65);}exports[_0xf436('0x8')]=function(_0x5037d8){try{utils[_0xf436('0x9')](util['format'](_0xf436('0xa'),_0x5037d8[_0xf436('0x5')]),_0x5037d8);utils[_0xf436('0x2')](util['format'](_0xf436('0xb'),_0x5037d8['uniqueid'],_0x5037d8[_0xf436('0xc')],_0x5037d8['transferercalleridname'],_0x5037d8[_0xf436('0xd')],_0x5037d8['transfereecalleridname']));_0x5037d8[_0xf436('0x3')]=_0xf436('0xe');writeDB(_0x5037d8);}catch(_0xcfe523){utils[_0xf436('0xf')](util[_0xf436('0x10')](_0xf436('0xa'),_0x5037d8[_0xf436('0x5')]),_0xcfe523);}};exports[_0xf436('0x11')]=function(_0x595dee){try{utils[_0xf436('0x9')](util[_0xf436('0x10')](_0xf436('0x12'),_0x595dee[_0xf436('0x4')]),_0x595dee);utils[_0xf436('0x2')](util[_0xf436('0x10')](_0xf436('0x13'),_0x595dee[_0xf436('0x4')],_0x595dee[_0xf436('0x14')],_0x595dee['origtransferercalleridname'],_0x595dee[_0xf436('0x15')],_0x595dee[_0xf436('0x16')]));_0x595dee=_[_0xf436('0x17')](_0x595dee,{'transfererchannel':_0x595dee[_0xf436('0x18')],'transferercalleridnum':_0x595dee[_0xf436('0x14')],'transferercalleridname':_0x595dee['origtransferercalleridname'],'transfererconnectedlinenum':_0x595dee[_0xf436('0x19')],'transfererconnectedlinename':_0x595dee['secondtransfererconnectedlinename'],'transfereraccountcode':_0x595dee['origtransfereraccountcode'],'transferercontext':_0x595dee['secondtransferercontext'],'transfererexten':_0x595dee[_0xf436('0x1a')],'transfererlinkedid':_0x595dee['origtransfererlinkedid'],'context':_0x595dee[_0xf436('0x1b')],'extension':_0x595dee[_0xf436('0x1c')],'type':'attended'});if(_['isNil'](_0x595dee[_0xf436('0x1d')])){_0x595dee=_[_0xf436('0x17')](_0x595dee,{'transfereechannel':_0x595dee[_0xf436('0x1e')],'transfereecalleridnum':_0x595dee[_0xf436('0x15')],'transfereecalleridname':_0x595dee['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x595dee[_0xf436('0x1f')],'transfereeconnectedlinename':_0x595dee[_0xf436('0x20')],'transfereeaccountcode':_0x595dee[_0xf436('0x21')],'transfereecontext':_0x595dee[_0xf436('0x22')],'transfereeexten':_0x595dee[_0xf436('0x23')],'transfereelinkedid':_0x595dee[_0xf436('0x24')]});}writeDB(_0x595dee);}catch(_0x115adf){utils[_0xf436('0xf')](util[_0xf436('0x10')](_0xf436('0x12'),_0x595dee['origtransfereruniqueid']),_0x115adf);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5c84b42..60a5f94 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 _0x7a54=['result','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]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x41b986,_0x5a1dc2){var _0x5ede09=function(_0x2b91ff){while(--_0x2b91ff){_0x41b986['push'](_0x41b986['shift']());}};_0x5ede09(++_0x5a1dc2);}(_0x7a54,0x106));var _0x47a5=function(_0x3ab702,_0x346905){_0x3ab702=_0x3ab702-0x0;var _0x264ffb=_0x7a54[_0x3ab702];return _0x264ffb;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb10b,0x12a));var _0xbb10=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0xb10b[_0x18c8b5];return _0x358984;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file